From: support Date: Thu, 26 Jan 2023 15:32:08 +0000 (+0000) Subject: Built motion from commit 3d3e98f2.|2.6.29 X-Git-Url: http://repos.xcallymotion.com/?a=commitdiff_plain;h=8e20e7bb88da93d953b1dfa9253a27c19083e8f0;p=motion2.git Built motion from commit 3d3e98f2.|2.6.29 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 22531c4..909ab6f 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-01-26T08:54:16.058Z", + "time": "2023-01-26T15:23:20.058Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index be6c95b..9744e48 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2023-01-26T08:54:16.058Z", + "time": "2023-01-26T15:23:20.058Z", "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 5935a87..edcb981 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 _0x1bce=['browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[headers],\x20browser[wsindowHeight]','urlForward[body]','sequelize','exports','getDataValue','action','STRING','contactManager','integration','motionbar','jscripty','urlForward','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]'];(function(_0x20a7ec,_0x19a8fa){var _0x24c67b=function(_0x63fbe3){while(--_0x63fbe3){_0x20a7ec['push'](_0x20a7ec['shift']());}};_0x24c67b(++_0x19a8fa);}(_0x1bce,0x73));var _0xe1bc=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x1bce[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0xe1bc('0x0'));module[_0xe1bc('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x29839d){return this[_0xe1bc('0x2')](_0xe1bc('0x3'));}},'action':{'type':Sequelize[_0xe1bc('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0xe1bc('0x5'),_0xe1bc('0x6'),_0xe1bc('0x7'),_0xe1bc('0x8'),_0xe1bc('0x9'),'browser','bot',_0xe1bc('0xa')]],'msg':_0xe1bc('0xb')}},'comment':_0xe1bc('0xb')},'data1':{'type':Sequelize[_0xe1bc('0x4')](0x1000),'comment':_0xe1bc('0xc')},'data2':{'type':Sequelize[_0xe1bc('0x4')](0x1000),'comment':'contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]'},'data3':{'type':Sequelize[_0xe1bc('0x4')](0x1000),'comment':'contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]'},'data4':{'type':Sequelize[_0xe1bc('0x4')](0x1000),'comments':_0xe1bc('0xd')},'data5':{'type':Sequelize[_0xe1bc('0x4')](0x1000),'comments':'urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]'},'data6':{'type':Sequelize[_0xe1bc('0x4')],'comments':_0xe1bc('0xe')},'data7':{'type':Sequelize['TEXT'],'comments':_0xe1bc('0xf')}}; \ No newline at end of file +var _0x1135=['jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','sequelize','VIRTUAL','getDataValue','action','STRING','contactManager','integration','motionbar','jscripty','urlForward','browser','bot','script'];(function(_0x6da121,_0x328b63){var _0x469631=function(_0x3ad3a6){while(--_0x3ad3a6){_0x6da121['push'](_0x6da121['shift']());}};_0x469631(++_0x328b63);}(_0x1135,0x119));var _0x5113=function(_0x175ed6,_0x4389fb){_0x175ed6=_0x175ed6-0x0;var _0x406416=_0x1135[_0x175ed6];return _0x406416;};'use strict';var Sequelize=require(_0x5113('0x0'));module['exports']={'name':{'type':Sequelize[_0x5113('0x1')],'get':function(_0x37cb87){return this[_0x5113('0x2')](_0x5113('0x3'));}},'action':{'type':Sequelize[_0x5113('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0x5113('0x5'),_0x5113('0x6'),_0x5113('0x7'),_0x5113('0x8'),_0x5113('0x9'),_0x5113('0xa'),_0x5113('0xb'),_0x5113('0xc')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize[_0x5113('0x4')](0x1000),'comment':_0x5113('0xd')},'data2':{'type':Sequelize[_0x5113('0x4')](0x1000),'comment':_0x5113('0xe')},'data3':{'type':Sequelize['STRING'](0x1000),'comment':_0x5113('0xf')},'data4':{'type':Sequelize[_0x5113('0x4')](0x1000),'comments':_0x5113('0x10')},'data5':{'type':Sequelize[_0x5113('0x4')](0x1000),'comments':_0x5113('0x11')},'data6':{'type':Sequelize[_0x5113('0x4')],'comments':_0x5113('0x12')},'data7':{'type':Sequelize[_0x5113('0x13')],'comments':_0x5113('0x14')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index e580594..2fe184e 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 _0xfbfa=['then','destroy','stack','name','send','Action','find','params','body','catch','eml-format','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update'];(function(_0x599bcd,_0x165930){var _0x5662d2=function(_0x3a9a1c){while(--_0x3a9a1c){_0x599bcd['push'](_0x599bcd['shift']());}};_0x5662d2(++_0x165930);}(_0xfbfa,0x11e));var _0xafbf=function(_0x3f83dc,_0x5c8047){_0x3f83dc=_0x3f83dc-0x0;var _0x3876b8=_0xfbfa[_0x3f83dc];return _0x3876b8;};'use strict';var emlformat=require(_0xafbf('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xafbf('0x1'));var moment=require('moment');var BPromise=require(_0xafbf('0x2'));var Mustache=require(_0xafbf('0x3'));var util=require('util');var path=require(_0xafbf('0x4'));var sox=require(_0xafbf('0x5'));var csv=require(_0xafbf('0x6'));var ejs=require(_0xafbf('0x7'));var fs=require('fs');var fs_extra=require(_0xafbf('0x8'));var _=require('lodash');var squel=require(_0xafbf('0x9'));var crypto=require(_0xafbf('0xa'));var jsforce=require(_0xafbf('0xb'));var deskjs=require(_0xafbf('0xc'));var toCsv=require('to-csv');var querystring=require(_0xafbf('0xd'));var Papa=require(_0xafbf('0xe'));var Redis=require(_0xafbf('0xf'));var authService=require(_0xafbf('0x10'));var qs=require(_0xafbf('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xafbf('0x12'));var logger=require('../../config/logger')(_0xafbf('0x13'));var utils=require(_0xafbf('0x14'));var config=require(_0xafbf('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xafbf('0x16'))['db'];function respondWithStatusCode(_0x36aaf1,_0x39d6be){_0x39d6be=_0x39d6be||0xcc;return function(_0x3fa2ed){if(_0x3fa2ed){return _0x36aaf1[_0xafbf('0x17')](_0x39d6be);}return _0x36aaf1[_0xafbf('0x18')](_0x39d6be)[_0xafbf('0x19')]();};}function respondWithResult(_0x152601,_0x4f9f6d){_0x4f9f6d=_0x4f9f6d||0xc8;return function(_0x37adfe){if(_0x37adfe){return _0x152601[_0xafbf('0x18')](_0x4f9f6d)['json'](_0x37adfe);}};}function respondWithFilteredResult(_0x524b97,_0x53a3e4){return function(_0x54dd08){if(_0x54dd08){var _0x2576c7=typeof _0x53a3e4[_0xafbf('0x1a')]===_0xafbf('0x1b')&&typeof _0x53a3e4[_0xafbf('0x1c')]==='undefined';var _0x37c4a9=_0x54dd08[_0xafbf('0x1d')];var _0x4667c1=_0x2576c7?0x0:_0x53a3e4[_0xafbf('0x1a')];var _0x3b9b73=_0x2576c7?_0x54dd08['count']:_0x53a3e4[_0xafbf('0x1a')]+_0x53a3e4[_0xafbf('0x1c')];var _0x1cd1d9;if(_0x3b9b73>=_0x37c4a9){_0x3b9b73=_0x37c4a9;_0x1cd1d9=0xc8;}else{_0x1cd1d9=0xce;}_0x524b97[_0xafbf('0x18')](_0x1cd1d9);return _0x524b97[_0xafbf('0x1e')](_0xafbf('0x1f'),_0x4667c1+'-'+_0x3b9b73+'/'+_0x37c4a9)[_0xafbf('0x20')](_0x54dd08);}return null;};}function patchUpdates(_0x51f0a4){return function(_0x1bd716){try{jsonpatch[_0xafbf('0x21')](_0x1bd716,_0x51f0a4,!![]);}catch(_0x1d337f){return BPromise[_0xafbf('0x22')](_0x1d337f);}return _0x1bd716['save']();};}function saveUpdates(_0x486c4a,_0x3d2cd4){return function(_0x23ad8d){if(_0x23ad8d){return _0x23ad8d[_0xafbf('0x23')](_0x486c4a)[_0xafbf('0x24')](function(_0x459892){return _0x459892;});}return null;};}function removeEntity(_0x4d4f58,_0xf44039){return function(_0x376e22){if(_0x376e22){return _0x376e22[_0xafbf('0x25')]()[_0xafbf('0x24')](function(){_0x4d4f58[_0xafbf('0x18')](0xcc)[_0xafbf('0x19')]();});}};}function handleEntityNotFound(_0x30de1e,_0xcb8521){return function(_0x41d5ba){if(!_0x41d5ba){_0x30de1e[_0xafbf('0x17')](0x194);}return _0x41d5ba;};}function handleError(_0x14e6df,_0x36a75d){_0x36a75d=_0x36a75d||0x1f4;return function(_0x5d59c6){logger['error'](_0x5d59c6[_0xafbf('0x26')]);if(_0x5d59c6[_0xafbf('0x27')]){delete _0x5d59c6['name'];}_0x14e6df[_0xafbf('0x18')](_0x36a75d)[_0xafbf('0x28')](_0x5d59c6);};}exports['update']=function(_0x5af226,_0x217897){if(_0x5af226['body']['id']){delete _0x5af226['body']['id'];}return db[_0xafbf('0x29')][_0xafbf('0x2a')]({'where':{'id':_0x5af226[_0xafbf('0x2b')]['id']}})['then'](handleEntityNotFound(_0x217897,null))[_0xafbf('0x24')](saveUpdates(_0x5af226[_0xafbf('0x2c')],null))[_0xafbf('0x24')](respondWithResult(_0x217897,null))[_0xafbf('0x2d')](handleError(_0x217897,null));};exports[_0xafbf('0x25')]=function(_0x5aa05d,_0x13ca8c){return db[_0xafbf('0x29')][_0xafbf('0x2a')]({'where':{'id':_0x5aa05d[_0xafbf('0x2b')]['id']}})['then'](handleEntityNotFound(_0x13ca8c,null))[_0xafbf('0x24')](removeEntity(_0x13ca8c,null))['catch'](handleError(_0x13ca8c,null));}; \ No newline at end of file +var _0x8f87=['Action','then','catch','find','eml-format','rimraf','zip-dir','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','destroy','end','error','stack','name','update','body'];(function(_0x22bf11,_0x15de4a){var _0x44a575=function(_0x147d64){while(--_0x147d64){_0x22bf11['push'](_0x22bf11['shift']());}};_0x44a575(++_0x15de4a);}(_0x8f87,0x138));var _0x78f8=function(_0x4695ba,_0x5a7f2a){_0x4695ba=_0x4695ba-0x0;var _0x524b7d=_0x8f87[_0x4695ba];return _0x524b7d;};'use strict';var emlformat=require(_0x78f8('0x0'));var rimraf=require(_0x78f8('0x1'));var zipdir=require(_0x78f8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x78f8('0x3'));var util=require(_0x78f8('0x4'));var path=require(_0x78f8('0x5'));var sox=require('sox');var csv=require(_0x78f8('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x78f8('0x7'));var squel=require(_0x78f8('0x8'));var crypto=require(_0x78f8('0x9'));var jsforce=require(_0x78f8('0xa'));var deskjs=require(_0x78f8('0xb'));var toCsv=require('to-csv');var querystring=require(_0x78f8('0xc'));var Papa=require('papaparse');var Redis=require(_0x78f8('0xd'));var authService=require(_0x78f8('0xe'));var qs=require(_0x78f8('0xf'));var as=require(_0x78f8('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x78f8('0x11'));var utils=require(_0x78f8('0x12'));var config=require(_0x78f8('0x13'));var licenseUtil=require(_0x78f8('0x14'));var db=require(_0x78f8('0x15'))['db'];function respondWithStatusCode(_0x5f0e7d,_0x426301){_0x426301=_0x426301||0xcc;return function(_0x16eb62){if(_0x16eb62){return _0x5f0e7d[_0x78f8('0x16')](_0x426301);}return _0x5f0e7d[_0x78f8('0x17')](_0x426301)['end']();};}function respondWithResult(_0x1b5519,_0x1de356){_0x1de356=_0x1de356||0xc8;return function(_0x3ff360){if(_0x3ff360){return _0x1b5519['status'](_0x1de356)[_0x78f8('0x18')](_0x3ff360);}};}function respondWithFilteredResult(_0x3f99d3,_0x14a3cd){return function(_0x5850b1){if(_0x5850b1){var _0x4e641e=typeof _0x14a3cd[_0x78f8('0x19')]===_0x78f8('0x1a')&&typeof _0x14a3cd[_0x78f8('0x1b')]===_0x78f8('0x1a');var _0x40ce82=_0x5850b1[_0x78f8('0x1c')];var _0x3118db=_0x4e641e?0x0:_0x14a3cd[_0x78f8('0x19')];var _0x5b7fe3=_0x4e641e?_0x5850b1[_0x78f8('0x1c')]:_0x14a3cd[_0x78f8('0x19')]+_0x14a3cd[_0x78f8('0x1b')];var _0x1c42f2;if(_0x5b7fe3>=_0x40ce82){_0x5b7fe3=_0x40ce82;_0x1c42f2=0xc8;}else{_0x1c42f2=0xce;}_0x3f99d3[_0x78f8('0x17')](_0x1c42f2);return _0x3f99d3[_0x78f8('0x1d')](_0x78f8('0x1e'),_0x3118db+'-'+_0x5b7fe3+'/'+_0x40ce82)[_0x78f8('0x18')](_0x5850b1);}return null;};}function patchUpdates(_0x5cf316){return function(_0x2756b8){try{jsonpatch[_0x78f8('0x1f')](_0x2756b8,_0x5cf316,!![]);}catch(_0x3194c6){return BPromise[_0x78f8('0x20')](_0x3194c6);}return _0x2756b8['save']();};}function saveUpdates(_0x1c3f3b,_0x145e73){return function(_0x29358d){if(_0x29358d){return _0x29358d['update'](_0x1c3f3b)['then'](function(_0x13894a){return _0x13894a;});}return null;};}function removeEntity(_0x2e842e,_0x2b3f59){return function(_0x2fa458){if(_0x2fa458){return _0x2fa458[_0x78f8('0x21')]()['then'](function(){_0x2e842e[_0x78f8('0x17')](0xcc)[_0x78f8('0x22')]();});}};}function handleEntityNotFound(_0x47075e,_0x9e88d4){return function(_0x137eb4){if(!_0x137eb4){_0x47075e[_0x78f8('0x16')](0x194);}return _0x137eb4;};}function handleError(_0x5660da,_0x22e882){_0x22e882=_0x22e882||0x1f4;return function(_0x2d61bb){logger[_0x78f8('0x23')](_0x2d61bb[_0x78f8('0x24')]);if(_0x2d61bb[_0x78f8('0x25')]){delete _0x2d61bb[_0x78f8('0x25')];}_0x5660da['status'](_0x22e882)['send'](_0x2d61bb);};}exports[_0x78f8('0x26')]=function(_0x4bc637,_0x77ac2c){if(_0x4bc637[_0x78f8('0x27')]['id']){delete _0x4bc637[_0x78f8('0x27')]['id'];}return db[_0x78f8('0x28')]['find']({'where':{'id':_0x4bc637['params']['id']}})[_0x78f8('0x29')](handleEntityNotFound(_0x77ac2c,null))[_0x78f8('0x29')](saveUpdates(_0x4bc637[_0x78f8('0x27')],null))[_0x78f8('0x29')](respondWithResult(_0x77ac2c,null))[_0x78f8('0x2a')](handleError(_0x77ac2c,null));};exports[_0x78f8('0x21')]=function(_0x34996f,_0x3a432a){return db['Action'][_0x78f8('0x2b')]({'where':{'id':_0x34996f['params']['id']}})[_0x78f8('0x29')](handleEntityNotFound(_0x3a432a,null))['then'](removeEntity(_0x3a432a,null))[_0x78f8('0x2a')](handleError(_0x3a432a,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 0aecb3a..53c0923 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 _0x0f13=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./action.attributes','define','Action','tools_actions','lodash','util'];(function(_0x1aa899,_0x140215){var _0x5332d5=function(_0x399517){while(--_0x399517){_0x1aa899['push'](_0x1aa899['shift']());}};_0x5332d5(++_0x140215);}(_0x0f13,0x16a));var _0x30f1=function(_0x549376,_0x2b2ca3){_0x549376=_0x549376-0x0;var _0x10b732=_0x0f13[_0x549376];return _0x10b732;};'use strict';var _=require(_0x30f1('0x0'));var util=require(_0x30f1('0x1'));var logger=require(_0x30f1('0x2'))('api');var moment=require(_0x30f1('0x3'));var BPromise=require(_0x30f1('0x4'));var rp=require(_0x30f1('0x5'));var fs=require('fs');var path=require(_0x30f1('0x6'));var rimraf=require(_0x30f1('0x7'));var config=require(_0x30f1('0x8'));var attributes=require(_0x30f1('0x9'));module['exports']=function(_0x3d96dc,_0x4a99f0){return _0x3d96dc[_0x30f1('0xa')](_0x30f1('0xb'),attributes,{'tableName':_0x30f1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdfd8=['bluebird','request-promise','path','rimraf','../../config/environment','./action.attributes','define','Action','tools_actions','lodash','util','../../config/logger','moment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xdfd8,0x100));var _0x8dfd=function(_0x12cd3a,_0x4088b7){_0x12cd3a=_0x12cd3a-0x0;var _0x353534=_0xdfd8[_0x12cd3a];return _0x353534;};'use strict';var _=require(_0x8dfd('0x0'));var util=require(_0x8dfd('0x1'));var logger=require(_0x8dfd('0x2'))('api');var moment=require(_0x8dfd('0x3'));var BPromise=require(_0x8dfd('0x4'));var rp=require(_0x8dfd('0x5'));var fs=require('fs');var path=require(_0x8dfd('0x6'));var rimraf=require(_0x8dfd('0x7'));var config=require(_0x8dfd('0x8'));var attributes=require(_0x8dfd('0x9'));module['exports']=function(_0xf4ad7b,_0x2930f2){return _0xf4ad7b[_0x8dfd('0xa')](_0x8dfd('0xb'),attributes,{'tableName':_0x8dfd('0xc'),'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 97aa294..985d5b4 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 _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','Action,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x358ac0,_0x11aa3b){var _0x269561=function(_0x55eab0){while(--_0x55eab0){_0x358ac0['push'](_0x358ac0['shift']());}};_0x269561(++_0x11aa3b);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0xc4aa[_0x1694f5];return _0x5b4321;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('Action,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});} \ No newline at end of file +var _0x5fab=['../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Action,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x23cc28,_0x357303){var _0x31402c=function(_0x30a760){while(--_0x30a760){_0x23cc28['push'](_0x23cc28['shift']());}};_0x31402c(++_0x357303);}(_0x5fab,0x177));var _0xb5fa=function(_0xf96ff1,_0x1db6e7){_0xf96ff1=_0xf96ff1-0x0;var _0x1f4042=_0x5fab[_0xf96ff1];return _0x1f4042;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var moment=require('moment');var BPromise=require(_0xb5fa('0x2'));var rs=require(_0xb5fa('0x3'));var fs=require('fs');var Redis=require(_0xb5fa('0x4'));var db=require(_0xb5fa('0x5'))['db'];var utils=require(_0xb5fa('0x6'));var logger=require(_0xb5fa('0x7'))(_0xb5fa('0x8'));var config=require(_0xb5fa('0x9'));var jayson=require(_0xb5fa('0xa'));var client=jayson[_0xb5fa('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d70f6,_0x2e3804,_0x1aec3e){return new BPromise(function(_0x9c7bce,_0x56d018){return client[_0xb5fa('0xc')](_0x5d70f6,_0x1aec3e)[_0xb5fa('0xd')](function(_0x2cf4a5){logger['info']('Action,\x20%s,\x20%s',_0x2e3804,_0xb5fa('0xe'));logger[_0xb5fa('0xf')](_0xb5fa('0x10'),_0x2e3804,_0xb5fa('0xe'),JSON[_0xb5fa('0x11')](_0x2cf4a5));if(_0x2cf4a5[_0xb5fa('0x12')]){if(_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x13')]===0x1f4){logger[_0xb5fa('0x12')]('Action,\x20%s,\x20%s',_0x2e3804,_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);return _0x56d018(_0x2cf4a5['error'][_0xb5fa('0x14')]);}logger['error'](_0xb5fa('0x15'),_0x2e3804,_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);return _0x9c7bce(_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);}else{logger['info']('Action,\x20%s,\x20%s',_0x2e3804,_0xb5fa('0xe'));_0x9c7bce(_0x2cf4a5[_0xb5fa('0x16')][_0xb5fa('0x14')]);}})[_0xb5fa('0x17')](function(_0x56fe10){logger['error'](_0xb5fa('0x15'),_0x2e3804,_0x56fe10);_0x56d018(_0x56fe10);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 7fbaad3..6012b25 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 _0x723f=['../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','put','isAuthenticated','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0x28c111,_0x1bf840){var _0x291b4a=function(_0xecd8c0){while(--_0xecd8c0){_0x28c111['push'](_0x28c111['shift']());}};_0x291b4a(++_0x1bf840);}(_0x723f,0x18a));var _0xf723=function(_0x4faa65,_0x3d1eb4){_0x4faa65=_0x4faa65-0x0;var _0x592c59=_0x723f[_0x4faa65];return _0x592c59;};'use strict';var multer=require(_0xf723('0x0'));var util=require(_0xf723('0x1'));var path=require('path');var timeout=require(_0xf723('0x2'));var express=require(_0xf723('0x3'));var router=express[_0xf723('0x4')]();var fs_extra=require(_0xf723('0x5'));var auth=require(_0xf723('0x6'));var interaction=require(_0xf723('0x7'));var config=require(_0xf723('0x8'));var controller=require(_0xf723('0x9'));router[_0xf723('0xa')]('/:id',auth[_0xf723('0xb')](),controller[_0xf723('0xc')]);router[_0xf723('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xf723('0xe')]);module[_0xf723('0xf')]=router; \ No newline at end of file +var _0xdda6=['update','delete','/:id','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','put','isAuthenticated'];(function(_0x50a161,_0x453637){var _0x4315dd=function(_0x32ff9f){while(--_0x32ff9f){_0x50a161['push'](_0x50a161['shift']());}};_0x4315dd(++_0x453637);}(_0xdda6,0x135));var _0x6dda=function(_0x407d57,_0xc7e784){_0x407d57=_0x407d57-0x0;var _0x16a22b=_0xdda6[_0x407d57];return _0x16a22b;};'use strict';var multer=require(_0x6dda('0x0'));var util=require(_0x6dda('0x1'));var path=require(_0x6dda('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6dda('0x3')]();var fs_extra=require(_0x6dda('0x4'));var auth=require(_0x6dda('0x5'));var interaction=require(_0x6dda('0x6'));var config=require(_0x6dda('0x7'));var controller=require(_0x6dda('0x8'));router[_0x6dda('0x9')]('/:id',auth[_0x6dda('0xa')](),controller[_0x6dda('0xb')]);router[_0x6dda('0xc')](_0x6dda('0xd'),auth['isAuthenticated'](),controller[_0x6dda('0xe')]);module[_0x6dda('0xf')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index db527e2..f62de54 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 _0xeda8=['sequelize','exports','STRING','TEXT'];(function(_0x5f2c87,_0x346d13){var _0x16107d=function(_0x550e3d){while(--_0x550e3d){_0x5f2c87['push'](_0x5f2c87['shift']());}};_0x16107d(++_0x346d13);}(_0xeda8,0x104));var _0x8eda=function(_0x584000,_0x49f097){_0x584000=_0x584000-0x0;var _0x17fb26=_0xeda8[_0x584000];return _0x17fb26;};'use strict';var Sequelize=require(_0x8eda('0x0'));module[_0x8eda('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x8eda('0x2')]},'parent':{'type':Sequelize[_0x8eda('0x2')]},'table':{'type':Sequelize[_0x8eda('0x2')]},'conditions':{'type':Sequelize[_0x8eda('0x3')]},'joins':{'type':Sequelize[_0x8eda('0x3')]}}; \ No newline at end of file +var _0xfdbd=['sequelize','exports','STRING','TEXT'];(function(_0x5a488c,_0x4cc470){var _0x53a7d6=function(_0x43a0d8){while(--_0x43a0d8){_0x5a488c['push'](_0x5a488c['shift']());}};_0x53a7d6(++_0x4cc470);}(_0xfdbd,0xf0));var _0xdfdb=function(_0xa087f5,_0x34fd10){_0xa087f5=_0xa087f5-0x0;var _0x4c8806=_0xfdbd[_0xa087f5];return _0x4c8806;};'use strict';var Sequelize=require(_0xdfdb('0x0'));module[_0xdfdb('0x1')]={'name':{'type':Sequelize[_0xdfdb('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xdfdb('0x2')]},'parent':{'type':Sequelize[_0xdfdb('0x2')]},'table':{'type':Sequelize[_0xdfdb('0x2')]},'conditions':{'type':Sequelize[_0xdfdb('0x3')]},'joins':{'type':Sequelize[_0xdfdb('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 43af0cb..385ec71 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 _0x726f=['CustomReports','UserProfileResource','end','stack','name','send','map','AnalyticCustomReport','rawAttributes','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','merge','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','error','preview','join','left_join','SUM(%s)','COUNT(%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','select','from','MetricId','metric','function','replace','format','groupBy','orderBy','alias','joins','parse','includes','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','table','foreignKey','conditions','clone','debug','Limited\x20Query:','sequelize','toString','SELECT','right_join','cross_join','COUNT(DISTINCT\x20%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NOT\x20NULL','value','getFields','keyBy','DESC','output','web','%s-%s.%s','generate','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','Run\x20Query:','child_process','fork','savename','countTable','COUNT(*)','QueryTypes','runReport','ValidationErrorItem','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','squel','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','json','offset','undefined','count','limit','apply','reject','save','update','destroy','then','get'];(function(_0x383f33,_0x290ffa){var _0x357573=function(_0xe4c4d6){while(--_0xe4c4d6){_0x383f33['push'](_0x383f33['shift']());}};_0x357573(++_0x290ffa);}(_0x726f,0x1ca));var _0xf726=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x726f[_0x465a0c];return _0x1e202e;};'use strict';var emlformat=require(_0xf726('0x0'));var rimraf=require(_0xf726('0x1'));var zipdir=require(_0xf726('0x2'));var jsonpatch=require(_0xf726('0x3'));var rp=require(_0xf726('0x4'));var moment=require(_0xf726('0x5'));var BPromise=require(_0xf726('0x6'));var Mustache=require(_0xf726('0x7'));var util=require(_0xf726('0x8'));var path=require(_0xf726('0x9'));var sox=require(_0xf726('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf726('0xb'));var _=require('lodash');var squel=require(_0xf726('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf726('0xd'));var toCsv=require(_0xf726('0xe'));var querystring=require(_0xf726('0xf'));var Papa=require('papaparse');var Redis=require(_0xf726('0x10'));var authService=require(_0xf726('0x11'));var qs=require(_0xf726('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf726('0x13'));var logger=require(_0xf726('0x14'))('api');var utils=require(_0xf726('0x15'));var config=require(_0xf726('0x16'));var licenseUtil=require(_0xf726('0x17'));var db=require('../../mysqldb')['db'];var dbH=require(_0xf726('0x18'))[_0xf726('0x19')];function respondWithStatusCode(_0xa6ef02,_0x4a525e){_0x4a525e=_0x4a525e||0xcc;return function(_0x2bb0){if(_0x2bb0){return _0xa6ef02[_0xf726('0x1a')](_0x4a525e);}return _0xa6ef02[_0xf726('0x1b')](_0x4a525e)['end']();};}function respondWithResult(_0x648402,_0x31abf7){_0x31abf7=_0x31abf7||0xc8;return function(_0x43a4e1){if(_0x43a4e1){return _0x648402[_0xf726('0x1b')](_0x31abf7)[_0xf726('0x1c')](_0x43a4e1);}};}function respondWithFilteredResult(_0x56f4fb,_0x15b294){return function(_0x213753){if(_0x213753){var _0x3f9cfc=typeof _0x15b294[_0xf726('0x1d')]===_0xf726('0x1e')&&typeof _0x15b294['limit']===_0xf726('0x1e');var _0x1d1f38=_0x213753[_0xf726('0x1f')];var _0x18f98a=_0x3f9cfc?0x0:_0x15b294['offset'];var _0x20252b=_0x3f9cfc?_0x213753['count']:_0x15b294[_0xf726('0x1d')]+_0x15b294[_0xf726('0x20')];var _0x472655;if(_0x20252b>=_0x1d1f38){_0x20252b=_0x1d1f38;_0x472655=0xc8;}else{_0x472655=0xce;}_0x56f4fb[_0xf726('0x1b')](_0x472655);return _0x56f4fb['set']('Content-Range',_0x18f98a+'-'+_0x20252b+'/'+_0x1d1f38)[_0xf726('0x1c')](_0x213753);}return null;};}function patchUpdates(_0xfd1430){return function(_0x5b73db){try{jsonpatch[_0xf726('0x21')](_0x5b73db,_0xfd1430,!![]);}catch(_0x2ac348){return BPromise[_0xf726('0x22')](_0x2ac348);}return _0x5b73db[_0xf726('0x23')]();};}function saveUpdates(_0x3bf3b5,_0x27732e){return function(_0x93c0de){if(_0x93c0de){return _0x93c0de[_0xf726('0x24')](_0x3bf3b5)['then'](function(_0x37a921){return _0x37a921;});}return null;};}function removeEntity(_0x35ac1a,_0x2d1152){return function(_0x1cc87c){if(_0x1cc87c){return _0x1cc87c[_0xf726('0x25')]()[_0xf726('0x26')](function(){var _0x375f6e=_0x1cc87c[_0xf726('0x27')]({'plain':!![]});var _0x5566d8=_0xf726('0x28');return db[_0xf726('0x29')][_0xf726('0x25')]({'where':{'type':_0x5566d8,'resourceId':_0x375f6e['id']}})[_0xf726('0x26')](function(){return _0x1cc87c;});})[_0xf726('0x26')](function(){_0x35ac1a[_0xf726('0x1b')](0xcc)[_0xf726('0x2a')]();});}};}function handleEntityNotFound(_0x4b1511,_0x393a4e){return function(_0x57a0a9){if(!_0x57a0a9){_0x4b1511[_0xf726('0x1a')](0x194);}return _0x57a0a9;};}function handleError(_0x3a07be,_0x50f0f8){_0x50f0f8=_0x50f0f8||0x1f4;return function(_0x1a2325){logger['error'](_0x1a2325[_0xf726('0x2b')]);if(_0x1a2325[_0xf726('0x2c')]){delete _0x1a2325['name'];}_0x3a07be[_0xf726('0x1b')](_0x50f0f8)[_0xf726('0x2d')](_0x1a2325);};}exports['index']=function(_0x58cace,_0x3d4800){var _0x232727={},_0x2098e9={},_0x4fd1cc={'count':0x0,'rows':[]};var _0x26e081=_[_0xf726('0x2e')](db[_0xf726('0x2f')][_0xf726('0x30')],function(_0x4ffbe7){return{'name':_0x4ffbe7['fieldName'],'type':_0x4ffbe7['type']['key']};});_0x2098e9[_0xf726('0x31')]=_[_0xf726('0x2e')](_0x26e081,_0xf726('0x2c'));_0x2098e9['query']=_[_0xf726('0x32')](_0x58cace[_0xf726('0x33')]);_0x2098e9[_0xf726('0x34')]=_['intersection'](_0x2098e9[_0xf726('0x31')],_0x2098e9[_0xf726('0x33')]);_0x232727[_0xf726('0x35')]=_[_0xf726('0x36')](_0x2098e9['model'],qs[_0xf726('0x37')](_0x58cace['query'][_0xf726('0x37')]));_0x232727[_0xf726('0x35')]=_0x232727[_0xf726('0x35')][_0xf726('0x38')]?_0x232727[_0xf726('0x35')]:_0x2098e9[_0xf726('0x31')];if(!_0x58cace[_0xf726('0x33')][_0xf726('0x39')](_0xf726('0x3a'))){_0x232727['limit']=qs[_0xf726('0x20')](_0x58cace[_0xf726('0x33')]['limit']);_0x232727[_0xf726('0x1d')]=qs['offset'](_0x58cace[_0xf726('0x33')][_0xf726('0x1d')]);}_0x232727[_0xf726('0x3b')]=qs[_0xf726('0x3c')](_0x58cace[_0xf726('0x33')][_0xf726('0x3c')]);_0x232727[_0xf726('0x3d')]=qs[_0xf726('0x34')](_[_0xf726('0x3e')](_0x58cace[_0xf726('0x33')],_0x2098e9[_0xf726('0x34')]),_0x26e081);if(_0x58cace[_0xf726('0x33')][_0xf726('0x3f')]){_0x232727['where']=_['merge'](_0x232727[_0xf726('0x3d')],{'$or':_[_0xf726('0x2e')](_0x26e081,function(_0x89f9a5){if(_0x89f9a5[_0xf726('0x40')]!==_0xf726('0x41')){var _0x1fd596={};_0x1fd596[_0x89f9a5['name']]={'$like':'%'+_0x58cace['query'][_0xf726('0x3f')]+'%'};return _0x1fd596;}})});}_0x232727=_['merge']({},_0x232727,_0x58cace[_0xf726('0x42')]);var _0x480442={'where':_0x232727['where']};return db[_0xf726('0x2f')][_0xf726('0x1f')](_0x480442)['then'](function(_0x133c6d){_0x4fd1cc[_0xf726('0x1f')]=_0x133c6d;if(_0x58cace[_0xf726('0x33')]['includeAll']){_0x232727[_0xf726('0x43')]=[{'all':!![]}];}return db[_0xf726('0x2f')][_0xf726('0x44')](_0x232727);})[_0xf726('0x26')](function(_0x515315){_0x4fd1cc[_0xf726('0x45')]=_0x515315;return _0x4fd1cc;})[_0xf726('0x26')](respondWithFilteredResult(_0x3d4800,_0x232727))[_0xf726('0x46')](handleError(_0x3d4800,null));};exports[_0xf726('0x47')]=function(_0x441c03,_0x44a230){var _0x5dd329={'raw':![],'where':{'id':_0x441c03[_0xf726('0x48')]['id']}},_0x40331e={};_0x40331e[_0xf726('0x31')]=_[_0xf726('0x32')](db[_0xf726('0x2f')][_0xf726('0x30')]);_0x40331e[_0xf726('0x33')]=_['keys'](_0x441c03[_0xf726('0x33')]);_0x40331e['filters']=_[_0xf726('0x36')](_0x40331e[_0xf726('0x31')],_0x40331e[_0xf726('0x33')]);_0x5dd329[_0xf726('0x35')]=_[_0xf726('0x36')](_0x40331e[_0xf726('0x31')],qs[_0xf726('0x37')](_0x441c03['query'][_0xf726('0x37')]));_0x5dd329['attributes']=_0x5dd329[_0xf726('0x35')][_0xf726('0x38')]?_0x5dd329[_0xf726('0x35')]:_0x40331e[_0xf726('0x31')];if(_0x441c03['query'][_0xf726('0x49')]){_0x5dd329['include']=[{'all':!![]}];}_0x5dd329=_[_0xf726('0x4a')]({},_0x5dd329,_0x441c03[_0xf726('0x42')]);return db[_0xf726('0x2f')]['find'](_0x5dd329)[_0xf726('0x26')](handleEntityNotFound(_0x44a230,null))['then'](respondWithResult(_0x44a230,null))[_0xf726('0x46')](handleError(_0x44a230,null));};exports[_0xf726('0x4b')]=function(_0x36344f,_0x40f290){return db[_0xf726('0x2f')][_0xf726('0x4b')](_0x36344f[_0xf726('0x4c')],{})[_0xf726('0x26')](function(_0x51cbc5){var _0x15d9c0=_0x36344f[_0xf726('0x4d')][_0xf726('0x27')]({'plain':!![]});if(!_0x15d9c0)throw new Error(_0xf726('0x4e'));if(_0x15d9c0[_0xf726('0x4f')]===_0xf726('0x4d')){var _0x3a8179=_0x51cbc5[_0xf726('0x27')]({'plain':!![]});var _0x194801='Reports';return db[_0xf726('0x50')][_0xf726('0x51')]({'where':{'name':_0x194801,'userProfileId':_0x15d9c0[_0xf726('0x52')]},'raw':!![]})[_0xf726('0x26')](function(_0x1b9a13){if(_0x1b9a13&&_0x1b9a13[_0xf726('0x53')]===0x0){return db[_0xf726('0x29')][_0xf726('0x4b')]({'name':_0x3a8179['name'],'resourceId':_0x3a8179['id'],'type':'CustomReports','sectionId':_0x1b9a13['id']},{})[_0xf726('0x26')](function(){return _0x51cbc5;});}else{return _0x51cbc5;}})[_0xf726('0x46')](function(_0x1f7ab5){logger[_0xf726('0x54')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1f7ab5);throw _0x1f7ab5;});}return _0x51cbc5;})[_0xf726('0x26')](respondWithResult(_0x40f290,0xc9))[_0xf726('0x46')](handleError(_0x40f290,null));};exports[_0xf726('0x24')]=function(_0x4ff875,_0x4b9e55){if(_0x4ff875['body']['id']){delete _0x4ff875[_0xf726('0x4c')]['id'];}return db[_0xf726('0x2f')][_0xf726('0x51')]({'where':{'id':_0x4ff875[_0xf726('0x48')]['id']}})[_0xf726('0x26')](handleEntityNotFound(_0x4b9e55,null))[_0xf726('0x26')](saveUpdates(_0x4ff875[_0xf726('0x4c')],null))[_0xf726('0x26')](respondWithResult(_0x4b9e55,null))[_0xf726('0x46')](handleError(_0x4b9e55,null));};exports[_0xf726('0x25')]=function(_0x56ac6b,_0x47de18){return db[_0xf726('0x2f')]['find']({'where':{'id':_0x56ac6b[_0xf726('0x48')]['id']}})[_0xf726('0x26')](handleEntityNotFound(_0x47de18,null))[_0xf726('0x26')](removeEntity(_0x47de18,null))[_0xf726('0x46')](handleError(_0x47de18,null));};exports[_0xf726('0x55')]=function(_0x2c5d8b,_0x9480ca){var _0x196f63=0xa;var _0x1c208a=[_0xf726('0x56'),_0xf726('0x57'),'right_join','cross_join'];var _0x5a3beb={'SUM':_0xf726('0x58'),'COUNT':_0xf726('0x59'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xf726('0x5a'),'MIN':_0xf726('0x5b'),'AVG':_0xf726('0x5c'),'GROUP_CONCAT':_0xf726('0x5d'),'GROUP_CONCAT ASC':_0xf726('0x5e'),'GROUP_CONCAT DESC':_0xf726('0x5f')};var _0x2fb478={'SEC_TO_TIME':_0xf726('0x60'),'DATE':_0xf726('0x61'),'HOUR':_0xf726('0x62'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x787498=function(_0x5cbe89){return!_['includes']([_0xf726('0x63'),'IS\x20NOT\x20NULL',_0xf726('0x64'),_0xf726('0x65')],_0x5cbe89);};var _0x18996a=function(_0x56cdea){if(!_0x56cdea||!_0x56cdea['rules'][_0xf726('0x38')]){return'';}for(var _0x32626d='(',_0x5c3cb9=0x0;_0x5c3cb9<_0x56cdea[_0xf726('0x66')][_0xf726('0x38')];_0x5c3cb9+=0x1){_0x5c3cb9>0x0&&(_0x32626d+='\x20'+_0x56cdea[_0xf726('0x67')]+'\x20');_0x32626d+=_0x56cdea[_0xf726('0x66')][_0x5c3cb9][_0xf726('0x68')]?_0x18996a(_0x56cdea[_0xf726('0x66')][_0x5c3cb9]['group']):_0x56cdea[_0xf726('0x66')][_0x5c3cb9][_0xf726('0x69')]+'\x20'+_0x56cdea['rules'][_0x5c3cb9][_0xf726('0x6a')]+(_0x787498(_0x56cdea[_0xf726('0x66')][_0x5c3cb9]['condition'])?'\x20'+_0x56cdea[_0xf726('0x66')][_0x5c3cb9]['value']:'');}return _0x32626d+')';};var _0x563b5a={'where':{'id':_0x2c5d8b['params']['id']}},_0x4bc1fe,_0x11a932,_0x3ba961,_0x26f068,_0x5e1555;_0x563b5a=_[_0xf726('0x4a')]({},_0x563b5a,_0x2c5d8b[_0xf726('0x42')]);return db[_0xf726('0x2f')][_0xf726('0x51')](_0x563b5a)[_0xf726('0x26')](function(_0xa0b997){if(_0xa0b997){_0x4bc1fe=_0xa0b997;return _0xa0b997['getFields']();}return null;})[_0xf726('0x26')](function(_0x375f17){if(_0x375f17){if(!_0x375f17[_0xf726('0x38')]){throw new db[(_0xf726('0x6b'))]['ValidationErrorItem'](_0xf726('0x6c'),0x193);}_0x11a932=_0x375f17;return db[_0xf726('0x6d')]['findAll']({'raw':!![]});}return null;})[_0xf726('0x26')](function(_0x24ad62){if(_0x24ad62){_0x3ba961=_['keyBy'](_0x24ad62,'id');var _0x28af4d;var _0x13484f=squel[_0xf726('0x6e')]();_0x13484f[_0xf726('0x6f')](_0x4bc1fe['table']);for(var _0x5d2ec6=0x0;_0x5d2ec6<_0x11a932[_0xf726('0x38')];_0x5d2ec6+=0x1){_0x28af4d=_0x11a932[_0x5d2ec6][_0xf726('0x70')]?_0x3ba961[_0x11a932[_0x5d2ec6][_0xf726('0x70')]][_0xf726('0x71')]:_0x11a932[_0x5d2ec6][_0xf726('0x69')];_0x28af4d=_0x11a932[_0x5d2ec6][_0xf726('0x72')]?_[_0xf726('0x73')](_0x5a3beb[_0x11a932[_0x5d2ec6]['function']],'%s',_0x28af4d):_0x28af4d;_0x28af4d=_0x11a932[_0x5d2ec6][_0xf726('0x74')]?_[_0xf726('0x73')](_0x2fb478[_0x11a932[_0x5d2ec6]['format']],'%s',_0x28af4d):_0x28af4d;if(_0x11a932[_0x5d2ec6][_0xf726('0x75')]){_0x13484f['group'](_0x28af4d);}_0x11a932[_0x5d2ec6]['orderBy']&&_0x13484f['order'](_0x28af4d,_0x11a932[_0x5d2ec6][_0xf726('0x76')]==='DESC'?![]:!![]);_0x13484f['field'](_0x28af4d,_0x11a932[_0x5d2ec6][_0xf726('0x77')]||_0x28af4d);}if(_0x4bc1fe[_0xf726('0x78')]){_0x4bc1fe[_0xf726('0x78')]=JSON[_0xf726('0x79')](_0x4bc1fe[_0xf726('0x78')]);for(var _0x1b5001=0x0;_0x1b5001<_0x4bc1fe[_0xf726('0x78')][_0xf726('0x38')];_0x1b5001+=0x1){if(_0x4bc1fe[_0xf726('0x78')][_0x1b5001][_0xf726('0x40')]&&_[_0xf726('0x7a')](_0x1c208a,_0x4bc1fe[_0xf726('0x78')][_0x1b5001][_0xf726('0x40')])&&_0x4bc1fe[_0xf726('0x78')][_0x1b5001][_0xf726('0x7b')]&&_0x4bc1fe[_0xf726('0x78')][_0x1b5001][_0xf726('0x7c')]&&_0x4bc1fe[_0xf726('0x78')][_0x1b5001]['foreignKey']){_0x13484f[_0x4bc1fe[_0xf726('0x78')][_0x1b5001]['type']](_0x4bc1fe[_0xf726('0x78')][_0x1b5001]['foreignTable'],null,util[_0xf726('0x74')](_0xf726('0x7d'),_0x4bc1fe[_0xf726('0x7e')],_0x4bc1fe[_0xf726('0x78')][_0x1b5001][_0xf726('0x7b')],_0x4bc1fe[_0xf726('0x78')][_0x1b5001][_0xf726('0x7c')],_0x4bc1fe[_0xf726('0x78')][_0x1b5001][_0xf726('0x7f')]));}}}if(_0x4bc1fe[_0xf726('0x80')]){_0x4bc1fe['conditions']=JSON[_0xf726('0x79')](_0x4bc1fe[_0xf726('0x80')]);_0x13484f[_0xf726('0x3d')](_0x18996a(_0x4bc1fe[_0xf726('0x80')][_0xf726('0x68')]));}_0x5e1555=_0x13484f[_0xf726('0x81')]();_0x13484f[_0xf726('0x20')](_0x196f63);_0x13484f['offset'](0x0);logger[_0xf726('0x82')](_0xf726('0x83'),_0x13484f['toString']());return dbH[_0xf726('0x84')][_0xf726('0x33')](_0x13484f[_0xf726('0x85')](),{'type':dbH[_0xf726('0x84')]['QueryTypes'][_0xf726('0x86')]});}})['then'](respondWithResult(_0x9480ca,null))[_0xf726('0x46')](handleError(_0x9480ca,null));};function runReport(_0x11f0b3,_0x3530b4,_0x557204){var _0x4447b7=_0x3530b4[_0xf726('0x2c')];var _0x16a696=0xa;var _0x3187d3=[_0xf726('0x56'),_0xf726('0x57'),_0xf726('0x87'),_0xf726('0x88')];var _0x53fda4={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0xf726('0x89'),'MAX':_0xf726('0x5a'),'MIN':_0xf726('0x5b'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xf726('0x5d'),'GROUP_CONCAT ASC':_0xf726('0x5e'),'GROUP_CONCAT DESC':_0xf726('0x5f')};var _0x53d3f9={'SEC_TO_TIME':_0xf726('0x60'),'DATE':_0xf726('0x61'),'HOUR':_0xf726('0x62'),'ROUND':_0xf726('0x8a'),'UNIX_TIMESTAMP':_0xf726('0x8b')};var _0x22c032=function(_0x16d79f){return!_[_0xf726('0x7a')]([_0xf726('0x63'),_0xf726('0x8c'),_0xf726('0x64'),_0xf726('0x65')],_0x16d79f);};var _0x3b3b54=function(_0x1aa18b){if(!_0x1aa18b||!_0x1aa18b[_0xf726('0x66')][_0xf726('0x38')]){return'';}for(var _0x35e8f7='(',_0x929b02=0x0;_0x929b02<_0x1aa18b[_0xf726('0x66')][_0xf726('0x38')];_0x929b02+=0x1){_0x929b02>0x0&&(_0x35e8f7+='\x20'+_0x1aa18b[_0xf726('0x67')]+'\x20');_0x35e8f7+=_0x1aa18b[_0xf726('0x66')][_0x929b02][_0xf726('0x68')]?_0x3b3b54(_0x1aa18b[_0xf726('0x66')][_0x929b02]['group']):_0x1aa18b[_0xf726('0x66')][_0x929b02][_0xf726('0x69')]+'\x20'+_0x1aa18b[_0xf726('0x66')][_0x929b02][_0xf726('0x6a')]+(_0x22c032(_0x1aa18b[_0xf726('0x66')][_0x929b02][_0xf726('0x6a')])?'\x20'+_0x1aa18b[_0xf726('0x66')][_0x929b02][_0xf726('0x8d')]:'');}return _0x35e8f7+')';};var _0x42305b={'where':{'id':_0x11f0b3['id']}},_0xaef66d,_0x4ba1d7,_0x4476ab,_0x1b62d2,_0x507b77;_0x42305b=_[_0xf726('0x4a')]({},_0x42305b,_0x557204);return db[_0xf726('0x2f')][_0xf726('0x51')](_0x42305b)[_0xf726('0x26')](function(_0x17b1e9){if(_0x17b1e9){_0xaef66d=_0x17b1e9;return _0x17b1e9[_0xf726('0x8e')]();}return null;})[_0xf726('0x26')](function(_0x1563c0){if(_0x1563c0){if(!_0x1563c0['length']){throw new db[(_0xf726('0x6b'))]['ValidationErrorItem'](_0xf726('0x6c'),0x193);}_0x4ba1d7=_0x1563c0;return db[_0xf726('0x6d')][_0xf726('0x44')]({'raw':!![]});}return null;})[_0xf726('0x26')](function(_0x3253bc){if(_0x3253bc){_0x4476ab=_[_0xf726('0x8f')](_0x3253bc,'id');var _0xa645da;var _0xecd933=squel[_0xf726('0x6e')]();_0xecd933[_0xf726('0x6f')](_0xaef66d['table']);for(var _0x187d9a=0x0;_0x187d9a<_0x4ba1d7[_0xf726('0x38')];_0x187d9a+=0x1){_0xa645da=_0x4ba1d7[_0x187d9a][_0xf726('0x70')]?_0x4476ab[_0x4ba1d7[_0x187d9a][_0xf726('0x70')]]['metric']:_0x4ba1d7[_0x187d9a][_0xf726('0x69')];_0xa645da=_0x4ba1d7[_0x187d9a][_0xf726('0x72')]?_[_0xf726('0x73')](_0x53fda4[_0x4ba1d7[_0x187d9a]['function']],'%s',_0xa645da):_0xa645da;_0xa645da=_0x4ba1d7[_0x187d9a]['format']?_[_0xf726('0x73')](_0x53d3f9[_0x4ba1d7[_0x187d9a][_0xf726('0x74')]],'%s',_0xa645da):_0xa645da;if(_0x4ba1d7[_0x187d9a]['groupBy']){_0xecd933[_0xf726('0x68')](_0xa645da);}_0x4ba1d7[_0x187d9a][_0xf726('0x76')]&&_0xecd933[_0xf726('0x3b')](_0xa645da,_0x4ba1d7[_0x187d9a][_0xf726('0x76')]===_0xf726('0x90')?![]:!![]);_0xecd933[_0xf726('0x69')](_0xa645da,_0x4ba1d7[_0x187d9a][_0xf726('0x77')]||_0xa645da);}if(_0xaef66d[_0xf726('0x78')]){_0xaef66d[_0xf726('0x78')]=JSON[_0xf726('0x79')](_0xaef66d[_0xf726('0x78')]);for(var _0x2605cb=0x0;_0x2605cb<_0xaef66d[_0xf726('0x78')][_0xf726('0x38')];_0x2605cb+=0x1){if(_0xaef66d['joins'][_0x2605cb][_0xf726('0x40')]&&_[_0xf726('0x7a')](_0x3187d3,_0xaef66d[_0xf726('0x78')][_0x2605cb][_0xf726('0x40')])&&_0xaef66d['joins'][_0x2605cb][_0xf726('0x7b')]&&_0xaef66d[_0xf726('0x78')][_0x2605cb]['foreignTable']&&_0xaef66d['joins'][_0x2605cb][_0xf726('0x7f')]){_0xecd933[_0xaef66d[_0xf726('0x78')][_0x2605cb][_0xf726('0x40')]](_0xaef66d[_0xf726('0x78')][_0x2605cb][_0xf726('0x7c')],null,util[_0xf726('0x74')](_0xf726('0x7d'),_0xaef66d[_0xf726('0x7e')],_0xaef66d['joins'][_0x2605cb][_0xf726('0x7b')],_0xaef66d['joins'][_0x2605cb][_0xf726('0x7c')],_0xaef66d[_0xf726('0x78')][_0x2605cb]['foreignKey']));}}}if(_0xaef66d['conditions']){_0xaef66d[_0xf726('0x80')]=JSON[_0xf726('0x79')](_0xaef66d['conditions']);_0xecd933[_0xf726('0x3d')](_0x3b3b54(_0xaef66d[_0xf726('0x80')]['group']));}_0x507b77=_0xecd933[_0xf726('0x81')]();_0xecd933[_0xf726('0x20')](_0x16a696);_0xecd933[_0xf726('0x1d')](0x0);return;}})['then'](function(){if(_0x3530b4[_0xf726('0x91')]===_0xf726('0x92')){return null;}var _0x5e9486=_[_0xf726('0x4a')](_0x3530b4,{'name':_0x3530b4['fullPath']||_0x3530b4[_0xf726('0x2c')]||_0xaef66d[_0xf726('0x2c')],'basename':_0x4447b7,'savename':util[_0xf726('0x74')](_0xf726('0x93'),_0x3530b4[_0xf726('0x2c')]||_0xaef66d[_0xf726('0x2c')],require('randomstring')[_0xf726('0x94')](0x4),_0x3530b4[_0xf726('0x91')]||_0xf726('0x95')),'reportId':_0xaef66d['id'],'reportType':_0xf726('0x96')});return db[_0xf726('0x97')]['create'](_0x5e9486,{'raw':!![]});})[_0xf726('0x26')](function(_0x1911e2){if(_0xaef66d[_0xf726('0x7e')]===_0xf726('0x98')){_0x507b77['where'](_0xaef66d[_0xf726('0x7e')]+_0xf726('0x99'),_0x3530b4[_0xf726('0x9a')],_0x3530b4['endDate']);}else{_0x507b77['where'](_0xaef66d[_0xf726('0x7e')]+_0xf726('0x9b'),_0x3530b4[_0xf726('0x9a')],_0x3530b4[_0xf726('0x9c')]);}if(_0x1911e2){logger['info'](_0xf726('0x9d'),_0x507b77[_0xf726('0x85')]());require(_0xf726('0x9e'))[_0xf726('0x9f')](path[_0xf726('0x56')](__dirname,'../../components/export/',_0x1911e2[_0xf726('0x91')]),[_0x1911e2['id'],_0x507b77[_0xf726('0x85')](),path[_0xf726('0x56')](__dirname,'../../files/reports',_0x1911e2[_0xf726('0xa0')]),_0x4447b7]);return _0x1911e2;}else{var _0x2bc16a=squel['select']();_0x2bc16a[_0xf726('0x6f')]('('+_0x507b77[_0xf726('0x85')]()+')',_0xf726('0xa1'));_0x2bc16a['field'](_0xf726('0xa2'),'count');_0x507b77[_0xf726('0x20')](_0x3530b4[_0xf726('0x20')]||_0x16a696);_0x507b77['offset'](_0x3530b4[_0xf726('0x1d')]||0x0);return dbH[_0xf726('0x84')][_0xf726('0x33')](_0x2bc16a[_0xf726('0x85')](),{'type':dbH[_0xf726('0x84')][_0xf726('0xa3')]['SELECT']})[_0xf726('0x26')](function(_0x12985a){if(!_0x12985a[_0xf726('0x38')]){_0x1b62d2=0x0;}else{_0x1b62d2=_0x12985a[0x0][_0xf726('0x1f')]||0x0;}return dbH[_0xf726('0x84')]['query'](_0x507b77[_0xf726('0x85')](),{'type':dbH[_0xf726('0x84')][_0xf726('0xa3')][_0xf726('0x86')]});})[_0xf726('0x26')](function(_0x260185){return{'rows':_0x260185||[],'count':_0x1b62d2};});}});}exports['run']=function(_0x93c8d6,_0x3070d5){return runReport(_0x93c8d6[_0xf726('0x48')],_0x93c8d6[_0xf726('0x33')],_0x93c8d6[_0xf726('0x42')])[_0xf726('0x26')](respondWithResult(_0x3070d5,null))[_0xf726('0x46')](handleError(_0x3070d5,null));};exports[_0xf726('0xa4')]=runReport;exports[_0xf726('0x33')]=function(_0x5dd1b4,_0x2132a6){var _0x53f49d=0xa;var _0x588592=[_0xf726('0x56'),_0xf726('0x57'),'right_join',_0xf726('0x88')];var _0x38b20f={'SUM':_0xf726('0x58'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xf726('0x89'),'MAX':'MAX(%s)','MIN':_0xf726('0x5b'),'AVG':_0xf726('0x5c'),'GROUP_CONCAT':_0xf726('0x5d'),'GROUP_CONCAT ASC':_0xf726('0x5e'),'GROUP_CONCAT DESC':_0xf726('0x5f')};var _0x1d5f4f={'SEC_TO_TIME':_0xf726('0x60'),'DATE':_0xf726('0x61'),'HOUR':_0xf726('0x62'),'ROUND':_0xf726('0x8a'),'UNIX_TIMESTAMP':_0xf726('0x8b')};var _0x3374a1=function(_0x139f7c){return!_[_0xf726('0x7a')]([_0xf726('0x63'),_0xf726('0x8c'),_0xf726('0x64'),_0xf726('0x65')],_0x139f7c);};var _0x246126=function(_0x14897a){if(!_0x14897a||!_0x14897a['rules']['length']){return'';}for(var _0x21e4a4='(',_0x5d4622=0x0;_0x5d4622<_0x14897a['rules'][_0xf726('0x38')];_0x5d4622+=0x1){_0x5d4622>0x0&&(_0x21e4a4+='\x20'+_0x14897a[_0xf726('0x67')]+'\x20');_0x21e4a4+=_0x14897a['rules'][_0x5d4622]['group']?_0x246126(_0x14897a['rules'][_0x5d4622][_0xf726('0x68')]):_0x14897a['rules'][_0x5d4622]['field']+'\x20'+_0x14897a[_0xf726('0x66')][_0x5d4622]['condition']+(_0x3374a1(_0x14897a[_0xf726('0x66')][_0x5d4622][_0xf726('0x6a')])?'\x20'+_0x14897a[_0xf726('0x66')][_0x5d4622]['value']:'');}return _0x21e4a4+')';};var _0x4cd62f={'where':{'id':_0x5dd1b4[_0xf726('0x48')]['id']}},_0x5c8fe9,_0x4e4569,_0x50e45d,_0x49c457,_0x52b699;_0x4cd62f=_[_0xf726('0x4a')]({},_0x4cd62f,_0x5dd1b4[_0xf726('0x42')]);return db['AnalyticCustomReport']['find'](_0x4cd62f)[_0xf726('0x26')](function(_0x29c393){if(_0x29c393){_0x5c8fe9=_0x29c393;return _0x29c393[_0xf726('0x8e')]();}return null;})[_0xf726('0x26')](function(_0x36ff13){if(_0x36ff13){if(!_0x36ff13[_0xf726('0x38')]){throw new db[(_0xf726('0x6b'))][(_0xf726('0xa5'))](_0xf726('0x6c'),0x193);}_0x4e4569=_0x36ff13;return db[_0xf726('0x6d')]['findAll']({'raw':!![]});}return null;})[_0xf726('0x26')](function(_0x1e021f){if(_0x1e021f){_0x50e45d=_['keyBy'](_0x1e021f,'id');var _0x1e1346;var _0x283b40=squel[_0xf726('0x6e')]();_0x283b40[_0xf726('0x6f')](_0x5c8fe9[_0xf726('0x7e')]);for(var _0x31931b=0x0;_0x31931b<_0x4e4569[_0xf726('0x38')];_0x31931b+=0x1){_0x1e1346=_0x4e4569[_0x31931b][_0xf726('0x70')]?_0x50e45d[_0x4e4569[_0x31931b][_0xf726('0x70')]]['metric']:_0x4e4569[_0x31931b][_0xf726('0x69')];_0x1e1346=_0x4e4569[_0x31931b]['function']?_[_0xf726('0x73')](_0x38b20f[_0x4e4569[_0x31931b]['function']],'%s',_0x1e1346):_0x1e1346;_0x1e1346=_0x4e4569[_0x31931b][_0xf726('0x74')]?_[_0xf726('0x73')](_0x1d5f4f[_0x4e4569[_0x31931b][_0xf726('0x74')]],'%s',_0x1e1346):_0x1e1346;if(_0x4e4569[_0x31931b][_0xf726('0x75')]){_0x283b40[_0xf726('0x68')](_0x1e1346);}_0x4e4569[_0x31931b][_0xf726('0x76')]&&_0x283b40[_0xf726('0x3b')](_0x1e1346,_0x4e4569[_0x31931b][_0xf726('0x76')]===_0xf726('0x90')?![]:!![]);_0x283b40[_0xf726('0x69')](_0x1e1346,_0x4e4569[_0x31931b][_0xf726('0x77')]||_0x1e1346);}if(_0x5c8fe9[_0xf726('0x78')]){_0x5c8fe9[_0xf726('0x78')]=JSON['parse'](_0x5c8fe9['joins']);for(var _0x9fd53=0x0;_0x9fd53<_0x5c8fe9[_0xf726('0x78')][_0xf726('0x38')];_0x9fd53+=0x1){if(_0x5c8fe9[_0xf726('0x78')][_0x9fd53]['type']&&_['includes'](_0x588592,_0x5c8fe9[_0xf726('0x78')][_0x9fd53][_0xf726('0x40')])&&_0x5c8fe9[_0xf726('0x78')][_0x9fd53][_0xf726('0x7b')]&&_0x5c8fe9['joins'][_0x9fd53]['foreignTable']&&_0x5c8fe9[_0xf726('0x78')][_0x9fd53][_0xf726('0x7f')]){_0x283b40[_0x5c8fe9[_0xf726('0x78')][_0x9fd53]['type']](_0x5c8fe9[_0xf726('0x78')][_0x9fd53]['foreignTable'],null,util['format'](_0xf726('0x7d'),_0x5c8fe9[_0xf726('0x7e')],_0x5c8fe9[_0xf726('0x78')][_0x9fd53][_0xf726('0x7b')],_0x5c8fe9[_0xf726('0x78')][_0x9fd53]['foreignTable'],_0x5c8fe9[_0xf726('0x78')][_0x9fd53][_0xf726('0x7f')]));}}}if(_0x5c8fe9[_0xf726('0x80')]){_0x5c8fe9[_0xf726('0x80')]=JSON[_0xf726('0x79')](_0x5c8fe9['conditions']);_0x283b40[_0xf726('0x3d')](_0x246126(_0x5c8fe9[_0xf726('0x80')][_0xf726('0x68')]));}_0x52b699=_0x283b40[_0xf726('0x81')]();_0x283b40['limit'](_0x53f49d);_0x283b40[_0xf726('0x1d')](0x0);logger['debug'](_0xf726('0x83'),_0x283b40['toString']());return dbH[_0xf726('0x84')][_0xf726('0x33')](_0x283b40['toString'](),{'type':dbH[_0xf726('0x84')][_0xf726('0xa3')][_0xf726('0x86')]});}})[_0xf726('0x26')](function(){return{'sql':_0x52b699[_0xf726('0x85')]()};})[_0xf726('0x26')](respondWithResult(_0x2132a6,null))[_0xf726('0x46')](handleError(_0x2132a6,null));}; \ No newline at end of file +var _0xbeb2=['destroy','UserProfileResource','end','stack','name','index','map','AnalyticCustomReport','rawAttributes','fieldName','key','model','keys','filters','intersection','query','fields','attributes','hasOwnProperty','sort','where','filter','merge','type','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','get','Reports','userProfileId','CustomReports','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','right_join','cross_join','COUNT(DISTINCT\x20%s)','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','length','operator','group','field','condition','value','options','getFields','Sequelize','ValidationErrorItem','AnalyticMetric','keyBy','table','MetricId','function','replace','format','groupBy','orderBy','order','DESC','joins','parse','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','parentKey','conditions','clone','debug','Limited\x20Query:','sequelize','QueryTypes','SUM(%s)','HOUR(%s)','IS\x20EMPTY','Please\x20insert\x20at\x20least\x20one\x20field','select','from','metric','alias','output','%s-%s.%s','randomstring','generate','custom','cdr','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','child_process','fork','../../components/export/','toString','../../files/reports','savename','countTable','COUNT(*)','SELECT','run','runReport','COUNT(%s)','rimraf','zip-dir','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then'];(function(_0x1a0e44,_0x2492ee){var _0x4db347=function(_0x51ae55){while(--_0x51ae55){_0x1a0e44['push'](_0x1a0e44['shift']());}};_0x4db347(++_0x2492ee);}(_0xbeb2,0x1ba));var _0x2beb=function(_0x1aa52b,_0x4665e2){_0x1aa52b=_0x1aa52b-0x0;var _0x3201ab=_0xbeb2[_0x1aa52b];return _0x3201ab;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2beb('0x0'));var zipdir=require(_0x2beb('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2beb('0x2'));var Mustache=require(_0x2beb('0x3'));var util=require('util');var path=require('path');var sox=require(_0x2beb('0x4'));var csv=require(_0x2beb('0x5'));var ejs=require(_0x2beb('0x6'));var fs=require('fs');var fs_extra=require(_0x2beb('0x7'));var _=require(_0x2beb('0x8'));var squel=require(_0x2beb('0x9'));var crypto=require(_0x2beb('0xa'));var jsforce=require(_0x2beb('0xb'));var deskjs=require(_0x2beb('0xc'));var toCsv=require(_0x2beb('0x5'));var querystring=require(_0x2beb('0xd'));var Papa=require(_0x2beb('0xe'));var Redis=require(_0x2beb('0xf'));var authService=require(_0x2beb('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x2beb('0x11'));var hardwareService=require(_0x2beb('0x12'));var logger=require(_0x2beb('0x13'))('api');var utils=require(_0x2beb('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2beb('0x15'))['db'];var dbH=require(_0x2beb('0x15'))['dbH'];function respondWithStatusCode(_0x1ecd30,_0x55305c){_0x55305c=_0x55305c||0xcc;return function(_0x36e48b){if(_0x36e48b){return _0x1ecd30[_0x2beb('0x16')](_0x55305c);}return _0x1ecd30[_0x2beb('0x17')](_0x55305c)['end']();};}function respondWithResult(_0xb52087,_0x51c821){_0x51c821=_0x51c821||0xc8;return function(_0x43a9c8){if(_0x43a9c8){return _0xb52087['status'](_0x51c821)[_0x2beb('0x18')](_0x43a9c8);}};}function respondWithFilteredResult(_0x548184,_0x281cc6){return function(_0x3f399c){if(_0x3f399c){var _0x35e66e=typeof _0x281cc6[_0x2beb('0x19')]==='undefined'&&typeof _0x281cc6[_0x2beb('0x1a')]===_0x2beb('0x1b');var _0x4f3ee7=_0x3f399c['count'];var _0x2c2c34=_0x35e66e?0x0:_0x281cc6[_0x2beb('0x19')];var _0x30840c=_0x35e66e?_0x3f399c[_0x2beb('0x1c')]:_0x281cc6[_0x2beb('0x19')]+_0x281cc6[_0x2beb('0x1a')];var _0x4b85cf;if(_0x30840c>=_0x4f3ee7){_0x30840c=_0x4f3ee7;_0x4b85cf=0xc8;}else{_0x4b85cf=0xce;}_0x548184['status'](_0x4b85cf);return _0x548184[_0x2beb('0x1d')](_0x2beb('0x1e'),_0x2c2c34+'-'+_0x30840c+'/'+_0x4f3ee7)[_0x2beb('0x18')](_0x3f399c);}return null;};}function patchUpdates(_0x593da4){return function(_0xc063f2){try{jsonpatch[_0x2beb('0x1f')](_0xc063f2,_0x593da4,!![]);}catch(_0x4f4c71){return BPromise[_0x2beb('0x20')](_0x4f4c71);}return _0xc063f2[_0x2beb('0x21')]();};}function saveUpdates(_0x21d364,_0x84740d){return function(_0x92b55f){if(_0x92b55f){return _0x92b55f['update'](_0x21d364)[_0x2beb('0x22')](function(_0x5bf0b8){return _0x5bf0b8;});}return null;};}function removeEntity(_0x4cb1b5,_0x15b35b){return function(_0x532925){if(_0x532925){return _0x532925[_0x2beb('0x23')]()[_0x2beb('0x22')](function(){var _0x27162c=_0x532925['get']({'plain':!![]});var _0x235f81='CustomReports';return db[_0x2beb('0x24')][_0x2beb('0x23')]({'where':{'type':_0x235f81,'resourceId':_0x27162c['id']}})[_0x2beb('0x22')](function(){return _0x532925;});})[_0x2beb('0x22')](function(){_0x4cb1b5[_0x2beb('0x17')](0xcc)[_0x2beb('0x25')]();});}};}function handleEntityNotFound(_0x17b97c,_0x31151c){return function(_0x1b199c){if(!_0x1b199c){_0x17b97c[_0x2beb('0x16')](0x194);}return _0x1b199c;};}function handleError(_0x427f65,_0x48649b){_0x48649b=_0x48649b||0x1f4;return function(_0x2dc6d4){logger['error'](_0x2dc6d4[_0x2beb('0x26')]);if(_0x2dc6d4[_0x2beb('0x27')]){delete _0x2dc6d4[_0x2beb('0x27')];}_0x427f65['status'](_0x48649b)['send'](_0x2dc6d4);};}exports[_0x2beb('0x28')]=function(_0x38ac5a,_0x5b022e){var _0x3ab779={},_0x296d04={},_0x41a68f={'count':0x0,'rows':[]};var _0x4e136d=_[_0x2beb('0x29')](db[_0x2beb('0x2a')][_0x2beb('0x2b')],function(_0x1fc7d0){return{'name':_0x1fc7d0[_0x2beb('0x2c')],'type':_0x1fc7d0['type'][_0x2beb('0x2d')]};});_0x296d04[_0x2beb('0x2e')]=_[_0x2beb('0x29')](_0x4e136d,_0x2beb('0x27'));_0x296d04['query']=_[_0x2beb('0x2f')](_0x38ac5a['query']);_0x296d04[_0x2beb('0x30')]=_[_0x2beb('0x31')](_0x296d04[_0x2beb('0x2e')],_0x296d04[_0x2beb('0x32')]);_0x3ab779['attributes']=_[_0x2beb('0x31')](_0x296d04[_0x2beb('0x2e')],qs['fields'](_0x38ac5a['query'][_0x2beb('0x33')]));_0x3ab779[_0x2beb('0x34')]=_0x3ab779['attributes']['length']?_0x3ab779[_0x2beb('0x34')]:_0x296d04[_0x2beb('0x2e')];if(!_0x38ac5a[_0x2beb('0x32')][_0x2beb('0x35')]('nolimit')){_0x3ab779[_0x2beb('0x1a')]=qs['limit'](_0x38ac5a[_0x2beb('0x32')][_0x2beb('0x1a')]);_0x3ab779[_0x2beb('0x19')]=qs[_0x2beb('0x19')](_0x38ac5a['query']['offset']);}_0x3ab779['order']=qs[_0x2beb('0x36')](_0x38ac5a[_0x2beb('0x32')][_0x2beb('0x36')]);_0x3ab779[_0x2beb('0x37')]=qs['filters'](_['pick'](_0x38ac5a[_0x2beb('0x32')],_0x296d04[_0x2beb('0x30')]),_0x4e136d);if(_0x38ac5a[_0x2beb('0x32')][_0x2beb('0x38')]){_0x3ab779[_0x2beb('0x37')]=_[_0x2beb('0x39')](_0x3ab779['where'],{'$or':_[_0x2beb('0x29')](_0x4e136d,function(_0x1d05a6){if(_0x1d05a6[_0x2beb('0x3a')]!=='VIRTUAL'){var _0x4c28ea={};_0x4c28ea[_0x1d05a6[_0x2beb('0x27')]]={'$like':'%'+_0x38ac5a['query'][_0x2beb('0x38')]+'%'};return _0x4c28ea;}})});}_0x3ab779=_[_0x2beb('0x39')]({},_0x3ab779,_0x38ac5a['options']);var _0x3f7151={'where':_0x3ab779[_0x2beb('0x37')]};return db[_0x2beb('0x2a')][_0x2beb('0x1c')](_0x3f7151)[_0x2beb('0x22')](function(_0xdb9edf){_0x41a68f[_0x2beb('0x1c')]=_0xdb9edf;if(_0x38ac5a[_0x2beb('0x32')][_0x2beb('0x3b')]){_0x3ab779[_0x2beb('0x3c')]=[{'all':!![]}];}return db[_0x2beb('0x2a')][_0x2beb('0x3d')](_0x3ab779);})['then'](function(_0x569718){_0x41a68f[_0x2beb('0x3e')]=_0x569718;return _0x41a68f;})[_0x2beb('0x22')](respondWithFilteredResult(_0x5b022e,_0x3ab779))[_0x2beb('0x3f')](handleError(_0x5b022e,null));};exports[_0x2beb('0x40')]=function(_0x468dd4,_0x1b75ab){var _0x57110c={'raw':![],'where':{'id':_0x468dd4[_0x2beb('0x41')]['id']}},_0x669191={};_0x669191[_0x2beb('0x2e')]=_['keys'](db[_0x2beb('0x2a')][_0x2beb('0x2b')]);_0x669191[_0x2beb('0x32')]=_[_0x2beb('0x2f')](_0x468dd4[_0x2beb('0x32')]);_0x669191[_0x2beb('0x30')]=_[_0x2beb('0x31')](_0x669191[_0x2beb('0x2e')],_0x669191[_0x2beb('0x32')]);_0x57110c['attributes']=_[_0x2beb('0x31')](_0x669191['model'],qs[_0x2beb('0x33')](_0x468dd4[_0x2beb('0x32')][_0x2beb('0x33')]));_0x57110c[_0x2beb('0x34')]=_0x57110c[_0x2beb('0x34')]['length']?_0x57110c[_0x2beb('0x34')]:_0x669191[_0x2beb('0x2e')];if(_0x468dd4[_0x2beb('0x32')]['includeAll']){_0x57110c[_0x2beb('0x3c')]=[{'all':!![]}];}_0x57110c=_['merge']({},_0x57110c,_0x468dd4['options']);return db['AnalyticCustomReport'][_0x2beb('0x42')](_0x57110c)['then'](handleEntityNotFound(_0x1b75ab,null))[_0x2beb('0x22')](respondWithResult(_0x1b75ab,null))[_0x2beb('0x3f')](handleError(_0x1b75ab,null));};exports[_0x2beb('0x43')]=function(_0x517638,_0x38a149){return db['AnalyticCustomReport'][_0x2beb('0x43')](_0x517638[_0x2beb('0x44')],{})['then'](function(_0x1bf2e2){var _0x144ca3=_0x517638[_0x2beb('0x45')][_0x2beb('0x46')]({'plain':!![]});if(!_0x144ca3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x144ca3['role']===_0x2beb('0x45')){var _0x2293ec=_0x1bf2e2['get']({'plain':!![]});var _0x7107c=_0x2beb('0x47');return db['UserProfileSection'][_0x2beb('0x42')]({'where':{'name':_0x7107c,'userProfileId':_0x144ca3[_0x2beb('0x48')]},'raw':!![]})['then'](function(_0x439edd){if(_0x439edd&&_0x439edd['autoAssociation']===0x0){return db[_0x2beb('0x24')]['create']({'name':_0x2293ec[_0x2beb('0x27')],'resourceId':_0x2293ec['id'],'type':_0x2beb('0x49'),'sectionId':_0x439edd['id']},{})[_0x2beb('0x22')](function(){return _0x1bf2e2;});}else{return _0x1bf2e2;}})[_0x2beb('0x3f')](function(_0x27a56e){logger[_0x2beb('0x4a')](_0x2beb('0x4b'),_0x27a56e);throw _0x27a56e;});}return _0x1bf2e2;})[_0x2beb('0x22')](respondWithResult(_0x38a149,0xc9))[_0x2beb('0x3f')](handleError(_0x38a149,null));};exports['update']=function(_0x46ba81,_0x4831a3){if(_0x46ba81[_0x2beb('0x44')]['id']){delete _0x46ba81[_0x2beb('0x44')]['id'];}return db['AnalyticCustomReport'][_0x2beb('0x42')]({'where':{'id':_0x46ba81[_0x2beb('0x41')]['id']}})[_0x2beb('0x22')](handleEntityNotFound(_0x4831a3,null))[_0x2beb('0x22')](saveUpdates(_0x46ba81['body'],null))[_0x2beb('0x22')](respondWithResult(_0x4831a3,null))[_0x2beb('0x3f')](handleError(_0x4831a3,null));};exports[_0x2beb('0x23')]=function(_0x14c078,_0x29cad0){return db[_0x2beb('0x2a')][_0x2beb('0x42')]({'where':{'id':_0x14c078['params']['id']}})[_0x2beb('0x22')](handleEntityNotFound(_0x29cad0,null))[_0x2beb('0x22')](removeEntity(_0x29cad0,null))[_0x2beb('0x3f')](handleError(_0x29cad0,null));};exports[_0x2beb('0x4c')]=function(_0x1211c1,_0xff2664){var _0x160bb0=0xa;var _0x5d5e79=[_0x2beb('0x4d'),_0x2beb('0x4e'),_0x2beb('0x4f'),_0x2beb('0x50')];var _0x100b00={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x2beb('0x51'),'MAX':_0x2beb('0x52'),'MIN':'MIN(%s)','AVG':_0x2beb('0x53'),'GROUP_CONCAT':_0x2beb('0x54'),'GROUP_CONCAT ASC':_0x2beb('0x55'),'GROUP_CONCAT DESC':_0x2beb('0x56')};var _0x1d6390={'SEC_TO_TIME':_0x2beb('0x57'),'DATE':_0x2beb('0x58'),'HOUR':'HOUR(%s)','ROUND':_0x2beb('0x59'),'UNIX_TIMESTAMP':_0x2beb('0x5a')};var _0x124830=function(_0x3cd80c){return!_[_0x2beb('0x5b')]([_0x2beb('0x5c'),_0x2beb('0x5d'),'IS\x20EMPTY',_0x2beb('0x5e')],_0x3cd80c);};var _0x14b93c=function(_0x5076cc){if(!_0x5076cc||!_0x5076cc[_0x2beb('0x5f')][_0x2beb('0x60')]){return'';}for(var _0x50a1ee='(',_0x17f877=0x0;_0x17f877<_0x5076cc['rules']['length'];_0x17f877+=0x1){_0x17f877>0x0&&(_0x50a1ee+='\x20'+_0x5076cc[_0x2beb('0x61')]+'\x20');_0x50a1ee+=_0x5076cc['rules'][_0x17f877]['group']?_0x14b93c(_0x5076cc['rules'][_0x17f877][_0x2beb('0x62')]):_0x5076cc[_0x2beb('0x5f')][_0x17f877][_0x2beb('0x63')]+'\x20'+_0x5076cc[_0x2beb('0x5f')][_0x17f877][_0x2beb('0x64')]+(_0x124830(_0x5076cc[_0x2beb('0x5f')][_0x17f877][_0x2beb('0x64')])?'\x20'+_0x5076cc[_0x2beb('0x5f')][_0x17f877][_0x2beb('0x65')]:'');}return _0x50a1ee+')';};var _0xae979={'where':{'id':_0x1211c1['params']['id']}},_0x9f6a9b,_0x5975bf,_0x2abbd8,_0x18f305,_0x305274;_0xae979=_['merge']({},_0xae979,_0x1211c1[_0x2beb('0x66')]);return db[_0x2beb('0x2a')][_0x2beb('0x42')](_0xae979)[_0x2beb('0x22')](function(_0x38c36d){if(_0x38c36d){_0x9f6a9b=_0x38c36d;return _0x38c36d[_0x2beb('0x67')]();}return null;})[_0x2beb('0x22')](function(_0x19e3e2){if(_0x19e3e2){if(!_0x19e3e2[_0x2beb('0x60')]){throw new db[(_0x2beb('0x68'))][(_0x2beb('0x69'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x5975bf=_0x19e3e2;return db[_0x2beb('0x6a')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x2448fe){if(_0x2448fe){_0x2abbd8=_[_0x2beb('0x6b')](_0x2448fe,'id');var _0x20fa29;var _0x148af8=squel['select']();_0x148af8['from'](_0x9f6a9b[_0x2beb('0x6c')]);for(var _0x4057bd=0x0;_0x4057bd<_0x5975bf[_0x2beb('0x60')];_0x4057bd+=0x1){_0x20fa29=_0x5975bf[_0x4057bd][_0x2beb('0x6d')]?_0x2abbd8[_0x5975bf[_0x4057bd][_0x2beb('0x6d')]]['metric']:_0x5975bf[_0x4057bd][_0x2beb('0x63')];_0x20fa29=_0x5975bf[_0x4057bd][_0x2beb('0x6e')]?_[_0x2beb('0x6f')](_0x100b00[_0x5975bf[_0x4057bd][_0x2beb('0x6e')]],'%s',_0x20fa29):_0x20fa29;_0x20fa29=_0x5975bf[_0x4057bd][_0x2beb('0x70')]?_['replace'](_0x1d6390[_0x5975bf[_0x4057bd][_0x2beb('0x70')]],'%s',_0x20fa29):_0x20fa29;if(_0x5975bf[_0x4057bd][_0x2beb('0x71')]){_0x148af8[_0x2beb('0x62')](_0x20fa29);}_0x5975bf[_0x4057bd][_0x2beb('0x72')]&&_0x148af8[_0x2beb('0x73')](_0x20fa29,_0x5975bf[_0x4057bd][_0x2beb('0x72')]===_0x2beb('0x74')?![]:!![]);_0x148af8[_0x2beb('0x63')](_0x20fa29,_0x5975bf[_0x4057bd]['alias']||_0x20fa29);}if(_0x9f6a9b['joins']){_0x9f6a9b[_0x2beb('0x75')]=JSON[_0x2beb('0x76')](_0x9f6a9b[_0x2beb('0x75')]);for(var _0x45b449=0x0;_0x45b449<_0x9f6a9b[_0x2beb('0x75')][_0x2beb('0x60')];_0x45b449+=0x1){if(_0x9f6a9b[_0x2beb('0x75')][_0x45b449][_0x2beb('0x3a')]&&_[_0x2beb('0x5b')](_0x5d5e79,_0x9f6a9b[_0x2beb('0x75')][_0x45b449]['type'])&&_0x9f6a9b['joins'][_0x45b449]['parentKey']&&_0x9f6a9b[_0x2beb('0x75')][_0x45b449]['foreignTable']&&_0x9f6a9b['joins'][_0x45b449][_0x2beb('0x77')]){_0x148af8[_0x9f6a9b[_0x2beb('0x75')][_0x45b449][_0x2beb('0x3a')]](_0x9f6a9b[_0x2beb('0x75')][_0x45b449][_0x2beb('0x78')],null,util['format'](_0x2beb('0x79'),_0x9f6a9b[_0x2beb('0x6c')],_0x9f6a9b[_0x2beb('0x75')][_0x45b449][_0x2beb('0x7a')],_0x9f6a9b['joins'][_0x45b449][_0x2beb('0x78')],_0x9f6a9b[_0x2beb('0x75')][_0x45b449][_0x2beb('0x77')]));}}}if(_0x9f6a9b[_0x2beb('0x7b')]){_0x9f6a9b[_0x2beb('0x7b')]=JSON['parse'](_0x9f6a9b[_0x2beb('0x7b')]);_0x148af8[_0x2beb('0x37')](_0x14b93c(_0x9f6a9b[_0x2beb('0x7b')][_0x2beb('0x62')]));}_0x305274=_0x148af8[_0x2beb('0x7c')]();_0x148af8[_0x2beb('0x1a')](_0x160bb0);_0x148af8[_0x2beb('0x19')](0x0);logger[_0x2beb('0x7d')](_0x2beb('0x7e'),_0x148af8['toString']());return dbH[_0x2beb('0x7f')][_0x2beb('0x32')](_0x148af8['toString'](),{'type':dbH[_0x2beb('0x7f')][_0x2beb('0x80')]['SELECT']});}})[_0x2beb('0x22')](respondWithResult(_0xff2664,null))[_0x2beb('0x3f')](handleError(_0xff2664,null));};function runReport(_0x401ab6,_0x3ca54a,_0x1af9c6){var _0x125802=_0x3ca54a[_0x2beb('0x27')];var _0xcbc1a2=0xa;var _0x3ce371=[_0x2beb('0x4d'),'left_join',_0x2beb('0x4f'),_0x2beb('0x50')];var _0x368a13={'SUM':_0x2beb('0x81'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x2beb('0x51'),'MAX':_0x2beb('0x52'),'MIN':'MIN(%s)','AVG':_0x2beb('0x53'),'GROUP_CONCAT':_0x2beb('0x54'),'GROUP_CONCAT ASC':_0x2beb('0x55'),'GROUP_CONCAT DESC':_0x2beb('0x56')};var _0xc74e0d={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x2beb('0x58'),'HOUR':_0x2beb('0x82'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x2beb('0x5a')};var _0x2d3ced=function(_0x255e38){return!_['includes']([_0x2beb('0x5c'),_0x2beb('0x5d'),_0x2beb('0x83'),_0x2beb('0x5e')],_0x255e38);};var _0x459dee=function(_0x208196){if(!_0x208196||!_0x208196[_0x2beb('0x5f')][_0x2beb('0x60')]){return'';}for(var _0x3cf553='(',_0x4b0458=0x0;_0x4b0458<_0x208196[_0x2beb('0x5f')]['length'];_0x4b0458+=0x1){_0x4b0458>0x0&&(_0x3cf553+='\x20'+_0x208196[_0x2beb('0x61')]+'\x20');_0x3cf553+=_0x208196[_0x2beb('0x5f')][_0x4b0458][_0x2beb('0x62')]?_0x459dee(_0x208196['rules'][_0x4b0458]['group']):_0x208196[_0x2beb('0x5f')][_0x4b0458][_0x2beb('0x63')]+'\x20'+_0x208196['rules'][_0x4b0458][_0x2beb('0x64')]+(_0x2d3ced(_0x208196[_0x2beb('0x5f')][_0x4b0458]['condition'])?'\x20'+_0x208196['rules'][_0x4b0458][_0x2beb('0x65')]:'');}return _0x3cf553+')';};var _0x2054a2={'where':{'id':_0x401ab6['id']}},_0x30bf0f,_0x351bda,_0x37a4fc,_0x58c740,_0x53906b;_0x2054a2=_['merge']({},_0x2054a2,_0x1af9c6);return db[_0x2beb('0x2a')][_0x2beb('0x42')](_0x2054a2)[_0x2beb('0x22')](function(_0x40a94e){if(_0x40a94e){_0x30bf0f=_0x40a94e;return _0x40a94e[_0x2beb('0x67')]();}return null;})[_0x2beb('0x22')](function(_0x26aad1){if(_0x26aad1){if(!_0x26aad1[_0x2beb('0x60')]){throw new db[(_0x2beb('0x68'))][(_0x2beb('0x69'))](_0x2beb('0x84'),0x193);}_0x351bda=_0x26aad1;return db['AnalyticMetric'][_0x2beb('0x3d')]({'raw':!![]});}return null;})[_0x2beb('0x22')](function(_0x18e61c){if(_0x18e61c){_0x37a4fc=_[_0x2beb('0x6b')](_0x18e61c,'id');var _0xe600b5;var _0x23ee2e=squel[_0x2beb('0x85')]();_0x23ee2e[_0x2beb('0x86')](_0x30bf0f[_0x2beb('0x6c')]);for(var _0x51de54=0x0;_0x51de54<_0x351bda[_0x2beb('0x60')];_0x51de54+=0x1){_0xe600b5=_0x351bda[_0x51de54][_0x2beb('0x6d')]?_0x37a4fc[_0x351bda[_0x51de54][_0x2beb('0x6d')]][_0x2beb('0x87')]:_0x351bda[_0x51de54][_0x2beb('0x63')];_0xe600b5=_0x351bda[_0x51de54][_0x2beb('0x6e')]?_[_0x2beb('0x6f')](_0x368a13[_0x351bda[_0x51de54][_0x2beb('0x6e')]],'%s',_0xe600b5):_0xe600b5;_0xe600b5=_0x351bda[_0x51de54][_0x2beb('0x70')]?_[_0x2beb('0x6f')](_0xc74e0d[_0x351bda[_0x51de54][_0x2beb('0x70')]],'%s',_0xe600b5):_0xe600b5;if(_0x351bda[_0x51de54]['groupBy']){_0x23ee2e[_0x2beb('0x62')](_0xe600b5);}_0x351bda[_0x51de54]['orderBy']&&_0x23ee2e[_0x2beb('0x73')](_0xe600b5,_0x351bda[_0x51de54]['orderBy']==='DESC'?![]:!![]);_0x23ee2e[_0x2beb('0x63')](_0xe600b5,_0x351bda[_0x51de54][_0x2beb('0x88')]||_0xe600b5);}if(_0x30bf0f['joins']){_0x30bf0f['joins']=JSON[_0x2beb('0x76')](_0x30bf0f[_0x2beb('0x75')]);for(var _0x2926ab=0x0;_0x2926ab<_0x30bf0f[_0x2beb('0x75')][_0x2beb('0x60')];_0x2926ab+=0x1){if(_0x30bf0f['joins'][_0x2926ab][_0x2beb('0x3a')]&&_['includes'](_0x3ce371,_0x30bf0f[_0x2beb('0x75')][_0x2926ab][_0x2beb('0x3a')])&&_0x30bf0f['joins'][_0x2926ab]['parentKey']&&_0x30bf0f['joins'][_0x2926ab]['foreignTable']&&_0x30bf0f[_0x2beb('0x75')][_0x2926ab][_0x2beb('0x77')]){_0x23ee2e[_0x30bf0f['joins'][_0x2926ab][_0x2beb('0x3a')]](_0x30bf0f['joins'][_0x2926ab][_0x2beb('0x78')],null,util[_0x2beb('0x70')](_0x2beb('0x79'),_0x30bf0f[_0x2beb('0x6c')],_0x30bf0f['joins'][_0x2926ab][_0x2beb('0x7a')],_0x30bf0f[_0x2beb('0x75')][_0x2926ab]['foreignTable'],_0x30bf0f['joins'][_0x2926ab][_0x2beb('0x77')]));}}}if(_0x30bf0f[_0x2beb('0x7b')]){_0x30bf0f[_0x2beb('0x7b')]=JSON['parse'](_0x30bf0f[_0x2beb('0x7b')]);_0x23ee2e[_0x2beb('0x37')](_0x459dee(_0x30bf0f[_0x2beb('0x7b')][_0x2beb('0x62')]));}_0x53906b=_0x23ee2e[_0x2beb('0x7c')]();_0x23ee2e['limit'](_0xcbc1a2);_0x23ee2e[_0x2beb('0x19')](0x0);return;}})[_0x2beb('0x22')](function(){if(_0x3ca54a[_0x2beb('0x89')]==='web'){return null;}var _0x433d5f=_[_0x2beb('0x39')](_0x3ca54a,{'name':_0x3ca54a['fullPath']||_0x3ca54a[_0x2beb('0x27')]||_0x30bf0f[_0x2beb('0x27')],'basename':_0x125802,'savename':util[_0x2beb('0x70')](_0x2beb('0x8a'),_0x3ca54a[_0x2beb('0x27')]||_0x30bf0f['name'],require(_0x2beb('0x8b'))[_0x2beb('0x8c')](0x4),_0x3ca54a[_0x2beb('0x89')]||'csv'),'reportId':_0x30bf0f['id'],'reportType':_0x2beb('0x8d')});return db['AnalyticExtractedReport'][_0x2beb('0x43')](_0x433d5f,{'raw':!![]});})[_0x2beb('0x22')](function(_0x394f51){if(_0x30bf0f[_0x2beb('0x6c')]===_0x2beb('0x8e')){_0x53906b[_0x2beb('0x37')](_0x30bf0f[_0x2beb('0x6c')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x3ca54a[_0x2beb('0x8f')],_0x3ca54a[_0x2beb('0x90')]);}else{_0x53906b['where'](_0x30bf0f[_0x2beb('0x6c')]+_0x2beb('0x91'),_0x3ca54a[_0x2beb('0x8f')],_0x3ca54a[_0x2beb('0x90')]);}if(_0x394f51){logger[_0x2beb('0x92')]('Run\x20Query:',_0x53906b['toString']());require(_0x2beb('0x93'))[_0x2beb('0x94')](path['join'](__dirname,_0x2beb('0x95'),_0x394f51[_0x2beb('0x89')]),[_0x394f51['id'],_0x53906b[_0x2beb('0x96')](),path['join'](__dirname,_0x2beb('0x97'),_0x394f51[_0x2beb('0x98')]),_0x125802]);return _0x394f51;}else{var _0x198baf=squel[_0x2beb('0x85')]();_0x198baf[_0x2beb('0x86')]('('+_0x53906b[_0x2beb('0x96')]()+')',_0x2beb('0x99'));_0x198baf[_0x2beb('0x63')](_0x2beb('0x9a'),_0x2beb('0x1c'));_0x53906b[_0x2beb('0x1a')](_0x3ca54a[_0x2beb('0x1a')]||_0xcbc1a2);_0x53906b[_0x2beb('0x19')](_0x3ca54a[_0x2beb('0x19')]||0x0);return dbH[_0x2beb('0x7f')][_0x2beb('0x32')](_0x198baf[_0x2beb('0x96')](),{'type':dbH[_0x2beb('0x7f')][_0x2beb('0x80')]['SELECT']})[_0x2beb('0x22')](function(_0x45d6b2){if(!_0x45d6b2[_0x2beb('0x60')]){_0x58c740=0x0;}else{_0x58c740=_0x45d6b2[0x0]['count']||0x0;}return dbH[_0x2beb('0x7f')][_0x2beb('0x32')](_0x53906b['toString'](),{'type':dbH[_0x2beb('0x7f')][_0x2beb('0x80')][_0x2beb('0x9b')]});})[_0x2beb('0x22')](function(_0x2de4b1){return{'rows':_0x2de4b1||[],'count':_0x58c740};});}});}exports[_0x2beb('0x9c')]=function(_0x42a53d,_0x49d527){return runReport(_0x42a53d['params'],_0x42a53d[_0x2beb('0x32')],_0x42a53d['options'])['then'](respondWithResult(_0x49d527,null))['catch'](handleError(_0x49d527,null));};exports[_0x2beb('0x9d')]=runReport;exports[_0x2beb('0x32')]=function(_0x274f1a,_0x304aa9){var _0xd9cb92=0xa;var _0x3d5df9=['join','left_join','right_join',_0x2beb('0x50')];var _0x33ab0b={'SUM':_0x2beb('0x81'),'COUNT':_0x2beb('0x9e'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x2beb('0x52'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x2beb('0x54'),'GROUP_CONCAT ASC':_0x2beb('0x55'),'GROUP_CONCAT DESC':_0x2beb('0x56')};var _0x3bcde4={'SEC_TO_TIME':_0x2beb('0x57'),'DATE':_0x2beb('0x58'),'HOUR':_0x2beb('0x82'),'ROUND':_0x2beb('0x59'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x3408fe=function(_0x2a193e){return!_['includes']([_0x2beb('0x5c'),'IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x2a193e);};var _0x3f65fb=function(_0x3ee5f5){if(!_0x3ee5f5||!_0x3ee5f5[_0x2beb('0x5f')][_0x2beb('0x60')]){return'';}for(var _0x507f37='(',_0x1661f3=0x0;_0x1661f3<_0x3ee5f5[_0x2beb('0x5f')][_0x2beb('0x60')];_0x1661f3+=0x1){_0x1661f3>0x0&&(_0x507f37+='\x20'+_0x3ee5f5[_0x2beb('0x61')]+'\x20');_0x507f37+=_0x3ee5f5[_0x2beb('0x5f')][_0x1661f3][_0x2beb('0x62')]?_0x3f65fb(_0x3ee5f5['rules'][_0x1661f3]['group']):_0x3ee5f5[_0x2beb('0x5f')][_0x1661f3][_0x2beb('0x63')]+'\x20'+_0x3ee5f5['rules'][_0x1661f3][_0x2beb('0x64')]+(_0x3408fe(_0x3ee5f5['rules'][_0x1661f3]['condition'])?'\x20'+_0x3ee5f5['rules'][_0x1661f3][_0x2beb('0x65')]:'');}return _0x507f37+')';};var _0x57a64e={'where':{'id':_0x274f1a[_0x2beb('0x41')]['id']}},_0x464a5d,_0x2efbf9,_0x4751f0,_0x44a28e,_0x2e8a0b;_0x57a64e=_[_0x2beb('0x39')]({},_0x57a64e,_0x274f1a[_0x2beb('0x66')]);return db[_0x2beb('0x2a')]['find'](_0x57a64e)[_0x2beb('0x22')](function(_0xa2a2b5){if(_0xa2a2b5){_0x464a5d=_0xa2a2b5;return _0xa2a2b5['getFields']();}return null;})[_0x2beb('0x22')](function(_0x33fd15){if(_0x33fd15){if(!_0x33fd15[_0x2beb('0x60')]){throw new db[(_0x2beb('0x68'))][(_0x2beb('0x69'))](_0x2beb('0x84'),0x193);}_0x2efbf9=_0x33fd15;return db[_0x2beb('0x6a')][_0x2beb('0x3d')]({'raw':!![]});}return null;})[_0x2beb('0x22')](function(_0x5dbaf0){if(_0x5dbaf0){_0x4751f0=_[_0x2beb('0x6b')](_0x5dbaf0,'id');var _0x584fc9;var _0x245921=squel[_0x2beb('0x85')]();_0x245921['from'](_0x464a5d[_0x2beb('0x6c')]);for(var _0x1e7023=0x0;_0x1e7023<_0x2efbf9[_0x2beb('0x60')];_0x1e7023+=0x1){_0x584fc9=_0x2efbf9[_0x1e7023]['MetricId']?_0x4751f0[_0x2efbf9[_0x1e7023][_0x2beb('0x6d')]][_0x2beb('0x87')]:_0x2efbf9[_0x1e7023][_0x2beb('0x63')];_0x584fc9=_0x2efbf9[_0x1e7023]['function']?_['replace'](_0x33ab0b[_0x2efbf9[_0x1e7023][_0x2beb('0x6e')]],'%s',_0x584fc9):_0x584fc9;_0x584fc9=_0x2efbf9[_0x1e7023][_0x2beb('0x70')]?_[_0x2beb('0x6f')](_0x3bcde4[_0x2efbf9[_0x1e7023][_0x2beb('0x70')]],'%s',_0x584fc9):_0x584fc9;if(_0x2efbf9[_0x1e7023][_0x2beb('0x71')]){_0x245921['group'](_0x584fc9);}_0x2efbf9[_0x1e7023][_0x2beb('0x72')]&&_0x245921[_0x2beb('0x73')](_0x584fc9,_0x2efbf9[_0x1e7023][_0x2beb('0x72')]===_0x2beb('0x74')?![]:!![]);_0x245921[_0x2beb('0x63')](_0x584fc9,_0x2efbf9[_0x1e7023][_0x2beb('0x88')]||_0x584fc9);}if(_0x464a5d[_0x2beb('0x75')]){_0x464a5d[_0x2beb('0x75')]=JSON[_0x2beb('0x76')](_0x464a5d[_0x2beb('0x75')]);for(var _0x36c15e=0x0;_0x36c15e<_0x464a5d[_0x2beb('0x75')][_0x2beb('0x60')];_0x36c15e+=0x1){if(_0x464a5d[_0x2beb('0x75')][_0x36c15e][_0x2beb('0x3a')]&&_[_0x2beb('0x5b')](_0x3d5df9,_0x464a5d[_0x2beb('0x75')][_0x36c15e]['type'])&&_0x464a5d[_0x2beb('0x75')][_0x36c15e][_0x2beb('0x7a')]&&_0x464a5d['joins'][_0x36c15e][_0x2beb('0x78')]&&_0x464a5d['joins'][_0x36c15e][_0x2beb('0x77')]){_0x245921[_0x464a5d[_0x2beb('0x75')][_0x36c15e][_0x2beb('0x3a')]](_0x464a5d['joins'][_0x36c15e]['foreignTable'],null,util[_0x2beb('0x70')](_0x2beb('0x79'),_0x464a5d[_0x2beb('0x6c')],_0x464a5d[_0x2beb('0x75')][_0x36c15e][_0x2beb('0x7a')],_0x464a5d[_0x2beb('0x75')][_0x36c15e][_0x2beb('0x78')],_0x464a5d[_0x2beb('0x75')][_0x36c15e][_0x2beb('0x77')]));}}}if(_0x464a5d['conditions']){_0x464a5d[_0x2beb('0x7b')]=JSON['parse'](_0x464a5d['conditions']);_0x245921[_0x2beb('0x37')](_0x3f65fb(_0x464a5d[_0x2beb('0x7b')][_0x2beb('0x62')]));}_0x2e8a0b=_0x245921[_0x2beb('0x7c')]();_0x245921[_0x2beb('0x1a')](_0xd9cb92);_0x245921[_0x2beb('0x19')](0x0);logger['debug']('Limited\x20Query:',_0x245921[_0x2beb('0x96')]());return dbH[_0x2beb('0x7f')]['query'](_0x245921[_0x2beb('0x96')](),{'type':dbH[_0x2beb('0x7f')]['QueryTypes'][_0x2beb('0x9b')]});}})[_0x2beb('0x22')](function(){return{'sql':_0x2e8a0b['toString']()};})['then'](respondWithResult(_0x304aa9,null))[_0x2beb('0x3f')](handleError(_0x304aa9,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index bcb1fd6..58bfcfe 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 _0xd20a=['util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','analytics_custom_reports'];(function(_0x1717a0,_0x3df0e9){var _0x4065f3=function(_0x54fce6){while(--_0x54fce6){_0x1717a0['push'](_0x1717a0['shift']());}};_0x4065f3(++_0x3df0e9);}(_0xd20a,0x84));var _0xad20=function(_0x458cf1,_0x525b5a){_0x458cf1=_0x458cf1-0x0;var _0x5e1440=_0xd20a[_0x458cf1];return _0x5e1440;};'use strict';var _=require('lodash');var util=require(_0xad20('0x0'));var logger=require(_0xad20('0x1'))(_0xad20('0x2'));var moment=require('moment');var BPromise=require(_0xad20('0x3'));var rp=require(_0xad20('0x4'));var fs=require('fs');var path=require(_0xad20('0x5'));var rimraf=require('rimraf');var config=require(_0xad20('0x6'));var attributes=require(_0xad20('0x7'));module[_0xad20('0x8')]=function(_0x2cf3c6,_0x37402a){return _0x2cf3c6[_0xad20('0x9')](_0xad20('0xa'),attributes,{'tableName':_0xad20('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0d9a=['api','moment','request-promise','path','rimraf','../../config/environment','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','analytics_custom_reports','lodash','util','../../config/logger'];(function(_0x55781e,_0x1c0def){var _0xd03779=function(_0x561069){while(--_0x561069){_0x55781e['push'](_0x55781e['shift']());}};_0xd03779(++_0x1c0def);}(_0x0d9a,0xf9));var _0xa0d9=function(_0x349c0a,_0x35383b){_0x349c0a=_0x349c0a-0x0;var _0x5b29e1=_0x0d9a[_0x349c0a];return _0x5b29e1;};'use strict';var _=require(_0xa0d9('0x0'));var util=require(_0xa0d9('0x1'));var logger=require(_0xa0d9('0x2'))(_0xa0d9('0x3'));var moment=require(_0xa0d9('0x4'));var BPromise=require('bluebird');var rp=require(_0xa0d9('0x5'));var fs=require('fs');var path=require(_0xa0d9('0x6'));var rimraf=require(_0xa0d9('0x7'));var config=require(_0xa0d9('0x8'));var attributes=require(_0xa0d9('0x9'));module[_0xa0d9('0xa')]=function(_0x5c2cfe,_0x1ab948){return _0x5c2cfe[_0xa0d9('0xb')](_0xa0d9('0xc'),attributes,{'tableName':_0xa0d9('0xd'),'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 c29ef57..bcdce92 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 _0x874e=['../../mysqldb','rpc','jayson/promise','http','request','info','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticCustomReport,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','ioredis'];(function(_0x18e10b,_0x4361c7){var _0x147d88=function(_0x23f3af){while(--_0x23f3af){_0x18e10b['push'](_0x18e10b['shift']());}};_0x147d88(++_0x4361c7);}(_0x874e,0xb0));var _0xe874=function(_0x4d07cc,_0x587613){_0x4d07cc=_0x4d07cc-0x0;var _0x42de3b=_0x874e[_0x4d07cc];return _0x42de3b;};'use strict';var _=require(_0xe874('0x0'));var util=require('util');var moment=require(_0xe874('0x1'));var BPromise=require(_0xe874('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe874('0x3'));var db=require(_0xe874('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe874('0x5'));var config=require('../../config/environment');var jayson=require(_0xe874('0x6'));var client=jayson['client'][_0xe874('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x31a0ee,_0x4f3740,_0x3a3550){return new BPromise(function(_0x56c746,_0x4c7250){return client[_0xe874('0x8')](_0x31a0ee,_0x3a3550)['then'](function(_0x1faf1d){logger[_0xe874('0x9')]('AnalyticCustomReport,\x20%s,\x20%s',_0x4f3740,_0xe874('0xa'));logger[_0xe874('0xb')](_0xe874('0xc'),_0x4f3740,_0xe874('0xa'),JSON[_0xe874('0xd')](_0x1faf1d));if(_0x1faf1d[_0xe874('0xe')]){if(_0x1faf1d['error'][_0xe874('0xf')]===0x1f4){logger[_0xe874('0xe')](_0xe874('0x10'),_0x4f3740,_0x1faf1d['error'][_0xe874('0x11')]);return _0x4c7250(_0x1faf1d[_0xe874('0xe')]['message']);}logger['error']('AnalyticCustomReport,\x20%s,\x20%s',_0x4f3740,_0x1faf1d[_0xe874('0xe')][_0xe874('0x11')]);return _0x56c746(_0x1faf1d[_0xe874('0xe')]['message']);}else{logger['info']('AnalyticCustomReport,\x20%s,\x20%s',_0x4f3740,_0xe874('0xa'));_0x56c746(_0x1faf1d[_0xe874('0x12')][_0xe874('0x11')]);}})[_0xe874('0x13')](function(_0x3bac81){logger[_0xe874('0xe')](_0xe874('0x10'),_0x4f3740,_0x3bac81);_0x4c7250(_0x3bac81);});});} \ No newline at end of file +var _0x54ac=['client','http','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x40fa9c,_0x589db6){var _0x47403e=function(_0x3d147d){while(--_0x3d147d){_0x40fa9c['push'](_0x40fa9c['shift']());}};_0x47403e(++_0x589db6);}(_0x54ac,0x1c7));var _0xc54a=function(_0x1139d0,_0x41e5f8){_0x1139d0=_0x1139d0-0x0;var _0xcc01a6=_0x54ac[_0x1139d0];return _0xcc01a6;};'use strict';var _=require('lodash');var util=require(_0xc54a('0x0'));var moment=require(_0xc54a('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc54a('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc54a('0x3'))(_0xc54a('0x4'));var config=require(_0xc54a('0x5'));var jayson=require(_0xc54a('0x6'));var client=jayson[_0xc54a('0x7')][_0xc54a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x52cb59,_0x6fa2c,_0x3a4dce){return new BPromise(function(_0x1f343a,_0x4f26d4){return client['request'](_0x52cb59,_0x3a4dce)[_0xc54a('0x9')](function(_0x2f6902){logger[_0xc54a('0xa')](_0xc54a('0xb'),_0x6fa2c,_0xc54a('0xc'));logger[_0xc54a('0xd')](_0xc54a('0xe'),_0x6fa2c,'request\x20sent',JSON[_0xc54a('0xf')](_0x2f6902));if(_0x2f6902[_0xc54a('0x10')]){if(_0x2f6902[_0xc54a('0x10')][_0xc54a('0x11')]===0x1f4){logger[_0xc54a('0x10')](_0xc54a('0xb'),_0x6fa2c,_0x2f6902[_0xc54a('0x10')][_0xc54a('0x12')]);return _0x4f26d4(_0x2f6902['error'][_0xc54a('0x12')]);}logger[_0xc54a('0x10')]('AnalyticCustomReport,\x20%s,\x20%s',_0x6fa2c,_0x2f6902[_0xc54a('0x10')][_0xc54a('0x12')]);return _0x1f343a(_0x2f6902['error']['message']);}else{logger[_0xc54a('0xa')]('AnalyticCustomReport,\x20%s,\x20%s',_0x6fa2c,'request\x20sent');_0x1f343a(_0x2f6902[_0xc54a('0x13')][_0xc54a('0x12')]);}})[_0xc54a('0x14')](function(_0x16b15f){logger[_0xc54a('0x10')](_0xc54a('0xb'),_0x6fa2c,_0x16b15f);_0x4f26d4(_0x16b15f);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 2749fd0..9eb462e 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 _0xfa1b=['post','create','update','delete','destroy','exports','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','index','/:id','isAuthenticated','/:id/preview','preview','/:id/run','run','/:id/query'];(function(_0x36ed3c,_0x44a00a){var _0x52a2e0=function(_0x3f7af9){while(--_0x3f7af9){_0x36ed3c['push'](_0x36ed3c['shift']());}};_0x52a2e0(++_0x44a00a);}(_0xfa1b,0x103));var _0xbfa1=function(_0x173214,_0x297c63){_0x173214=_0x173214-0x0;var _0x328a6d=_0xfa1b[_0x173214];return _0x328a6d;};'use strict';var multer=require(_0xbfa1('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xbfa1('0x1'));var express=require(_0xbfa1('0x2'));var router=express['Router']();var fs_extra=require(_0xbfa1('0x3'));var auth=require(_0xbfa1('0x4'));var interaction=require(_0xbfa1('0x5'));var config=require(_0xbfa1('0x6'));var controller=require(_0xbfa1('0x7'));router[_0xbfa1('0x8')]('/',auth['isAuthenticated'](),controller[_0xbfa1('0x9')]);router['get'](_0xbfa1('0xa'),auth[_0xbfa1('0xb')](),controller['show']);router[_0xbfa1('0x8')](_0xbfa1('0xc'),auth[_0xbfa1('0xb')](),controller[_0xbfa1('0xd')]);router[_0xbfa1('0x8')](_0xbfa1('0xe'),auth[_0xbfa1('0xb')](),controller[_0xbfa1('0xf')]);router['get'](_0xbfa1('0x10'),auth[_0xbfa1('0xb')](),controller['query']);router[_0xbfa1('0x11')]('/',auth[_0xbfa1('0xb')](),controller[_0xbfa1('0x12')]);router['put'](_0xbfa1('0xa'),auth[_0xbfa1('0xb')](),controller[_0xbfa1('0x13')]);router[_0xbfa1('0x14')](_0xbfa1('0xa'),auth[_0xbfa1('0xb')](),controller[_0xbfa1('0x15')]);module[_0xbfa1('0x16')]=router; \ No newline at end of file +var _0xae95=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','/:id/run','run','/:id/query','create','destroy','exports','util'];(function(_0x4f8ef6,_0x31607b){var _0x4f6880=function(_0x30efa6){while(--_0x30efa6){_0x4f8ef6['push'](_0x4f8ef6['shift']());}};_0x4f6880(++_0x31607b);}(_0xae95,0xfb));var _0x5ae9=function(_0x5aeb74,_0x31df7d){_0x5aeb74=_0x5aeb74-0x0;var _0x3032a5=_0xae95[_0x5aeb74];return _0x3032a5;};'use strict';var multer=require('multer');var util=require(_0x5ae9('0x0'));var path=require('path');var timeout=require(_0x5ae9('0x1'));var express=require(_0x5ae9('0x2'));var router=express[_0x5ae9('0x3')]();var fs_extra=require(_0x5ae9('0x4'));var auth=require(_0x5ae9('0x5'));var interaction=require(_0x5ae9('0x6'));var config=require(_0x5ae9('0x7'));var controller=require(_0x5ae9('0x8'));router[_0x5ae9('0x9')]('/',auth[_0x5ae9('0xa')](),controller[_0x5ae9('0xb')]);router[_0x5ae9('0x9')](_0x5ae9('0xc'),auth['isAuthenticated'](),controller[_0x5ae9('0xd')]);router[_0x5ae9('0x9')](_0x5ae9('0xe'),auth['isAuthenticated'](),controller['preview']);router[_0x5ae9('0x9')](_0x5ae9('0xf'),auth['isAuthenticated'](),controller[_0x5ae9('0x10')]);router[_0x5ae9('0x9')](_0x5ae9('0x11'),auth[_0x5ae9('0xa')](),controller['query']);router['post']('/',auth[_0x5ae9('0xa')](),controller[_0x5ae9('0x12')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x5ae9('0xc'),auth[_0x5ae9('0xa')](),controller[_0x5ae9('0x13')]);module[_0x5ae9('0x14')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index fc557ac..7b8460c 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 _0xf494=['STRING','TEXT','sequelize','exports'];(function(_0x5e980d,_0x316987){var _0x347477=function(_0x5566a8){while(--_0x5566a8){_0x5e980d['push'](_0x5e980d['shift']());}};_0x347477(++_0x316987);}(_0xf494,0x1c6));var _0x4f49=function(_0x9baa9,_0x5319dc){_0x9baa9=_0x9baa9-0x0;var _0x386cc0=_0xf494[_0x9baa9];return _0x386cc0;};'use strict';var Sequelize=require(_0x4f49('0x0'));module[_0x4f49('0x1')]={'name':{'type':Sequelize[_0x4f49('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x4f49('0x2')]},'table':{'type':Sequelize[_0x4f49('0x2')]},'conditions':{'type':Sequelize[_0x4f49('0x3')]},'joins':{'type':Sequelize[_0x4f49('0x3')]}}; \ No newline at end of file +var _0x4819=['TEXT','exports','STRING'];(function(_0x232ec0,_0x45fdd0){var _0x356705=function(_0x4099ea){while(--_0x4099ea){_0x232ec0['push'](_0x232ec0['shift']());}};_0x356705(++_0x45fdd0);}(_0x4819,0xcd));var _0x9481=function(_0x5c2cfc,_0x225457){_0x5c2cfc=_0x5c2cfc-0x0;var _0x39ef01=_0x4819[_0x5c2cfc];return _0x39ef01;};'use strict';var Sequelize=require('sequelize');module[_0x9481('0x0')]={'name':{'type':Sequelize[_0x9481('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x9481('0x1')]},'parent':{'type':Sequelize[_0x9481('0x1')]},'table':{'type':Sequelize[_0x9481('0x1')]},'conditions':{'type':Sequelize[_0x9481('0x2')]},'joins':{'type':Sequelize[_0x9481('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index ca4cafc..0bb7fe7 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 _0x53ec=['IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','value','getFields','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','keyBy','select','from','table','MetricId','metric','function','format','replace','orderBy','DESC','alias','joins','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','parse','clone','debug','Limited\x20Query:','sequelize','toString','QueryTypes','right_join','SUM(%s)','COUNT(DISTINCT\x20%s)','GROUP_CONCAT(%s)','HOUR(%s)','ROUND(%s)','condition','Sequelize','groupBy','foreignKey','output','fullPath','%s-%s.%s','randomstring','generate','csv','default','AnalyticExtractedReport','cdr','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../files/reports','savename','countTable','COUNT(*)','SELECT','runReport','cross_join','COUNT(%s)','MIN(%s)','ValidationErrorItem','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','DefaultReports','UserProfileResource','error','stack','name','send','index','map','rawAttributes','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','filter','merge','type','include','AnalyticDefaultReport','params','includeAll','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','catch','preview','join','left_join','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','UNIX_TIMESTAMP(%s)','includes'];(function(_0x5b7588,_0x509594){var _0x39ccbf=function(_0x1ed509){while(--_0x1ed509){_0x5b7588['push'](_0x5b7588['shift']());}};_0x39ccbf(++_0x509594);}(_0x53ec,0x192));var _0xc53e=function(_0x68361,_0x231f90){_0x68361=_0x68361-0x0;var _0xbb709a=_0x53ec[_0x68361];return _0xbb709a;};'use strict';var emlformat=require(_0xc53e('0x0'));var rimraf=require(_0xc53e('0x1'));var zipdir=require(_0xc53e('0x2'));var jsonpatch=require(_0xc53e('0x3'));var rp=require(_0xc53e('0x4'));var moment=require(_0xc53e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc53e('0x6'));var util=require('util');var path=require(_0xc53e('0x7'));var sox=require(_0xc53e('0x8'));var csv=require('to-csv');var ejs=require(_0xc53e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc53e('0xa'));var squel=require(_0xc53e('0xb'));var crypto=require('crypto');var jsforce=require(_0xc53e('0xc'));var deskjs=require(_0xc53e('0xd'));var toCsv=require(_0xc53e('0xe'));var querystring=require(_0xc53e('0xf'));var Papa=require(_0xc53e('0x10'));var Redis=require(_0xc53e('0x11'));var authService=require(_0xc53e('0x12'));var qs=require(_0xc53e('0x13'));var as=require(_0xc53e('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc53e('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc53e('0x16'));var db=require(_0xc53e('0x17'))['db'];var dbH=require(_0xc53e('0x17'))[_0xc53e('0x18')];function respondWithStatusCode(_0x56f0e5,_0x4e74c9){_0x4e74c9=_0x4e74c9||0xcc;return function(_0x1c06cd){if(_0x1c06cd){return _0x56f0e5[_0xc53e('0x19')](_0x4e74c9);}return _0x56f0e5[_0xc53e('0x1a')](_0x4e74c9)[_0xc53e('0x1b')]();};}function respondWithResult(_0x358ef3,_0x382e87){_0x382e87=_0x382e87||0xc8;return function(_0x3dc2fa){if(_0x3dc2fa){return _0x358ef3[_0xc53e('0x1a')](_0x382e87)[_0xc53e('0x1c')](_0x3dc2fa);}};}function respondWithFilteredResult(_0x2ad6eb,_0x5b0a88){return function(_0x8a522e){if(_0x8a522e){var _0x191567=typeof _0x5b0a88[_0xc53e('0x1d')]===_0xc53e('0x1e')&&typeof _0x5b0a88[_0xc53e('0x1f')]===_0xc53e('0x1e');var _0x164016=_0x8a522e[_0xc53e('0x20')];var _0x3b550e=_0x191567?0x0:_0x5b0a88['offset'];var _0x546fab=_0x191567?_0x8a522e[_0xc53e('0x20')]:_0x5b0a88[_0xc53e('0x1d')]+_0x5b0a88[_0xc53e('0x1f')];var _0x2e85df;if(_0x546fab>=_0x164016){_0x546fab=_0x164016;_0x2e85df=0xc8;}else{_0x2e85df=0xce;}_0x2ad6eb[_0xc53e('0x1a')](_0x2e85df);return _0x2ad6eb[_0xc53e('0x21')](_0xc53e('0x22'),_0x3b550e+'-'+_0x546fab+'/'+_0x164016)[_0xc53e('0x1c')](_0x8a522e);}return null;};}function patchUpdates(_0x364c80){return function(_0x401af6){try{jsonpatch[_0xc53e('0x23')](_0x401af6,_0x364c80,!![]);}catch(_0x44fd93){return BPromise[_0xc53e('0x24')](_0x44fd93);}return _0x401af6['save']();};}function saveUpdates(_0x47cfdd,_0x531ede){return function(_0x4f4304){if(_0x4f4304){return _0x4f4304[_0xc53e('0x25')](_0x47cfdd)[_0xc53e('0x26')](function(_0x4015c8){return _0x4015c8;});}return null;};}function removeEntity(_0x180811,_0x5009e1){return function(_0x5e5377){if(_0x5e5377){return _0x5e5377[_0xc53e('0x27')]()['then'](function(){var _0x1ae55e=_0x5e5377[_0xc53e('0x28')]({'plain':!![]});var _0x443179=_0xc53e('0x29');return db[_0xc53e('0x2a')]['destroy']({'where':{'type':_0x443179,'resourceId':_0x1ae55e['id']}})[_0xc53e('0x26')](function(){return _0x5e5377;});})['then'](function(){_0x180811['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c5056,_0x57a1f5){return function(_0x28240a){if(!_0x28240a){_0x3c5056['sendStatus'](0x194);}return _0x28240a;};}function handleError(_0x24a77e,_0x5112d2){_0x5112d2=_0x5112d2||0x1f4;return function(_0x5ce216){logger[_0xc53e('0x2b')](_0x5ce216[_0xc53e('0x2c')]);if(_0x5ce216[_0xc53e('0x2d')]){delete _0x5ce216[_0xc53e('0x2d')];}_0x24a77e[_0xc53e('0x1a')](_0x5112d2)[_0xc53e('0x2e')](_0x5ce216);};}exports[_0xc53e('0x2f')]=function(_0x2a2ca9,_0x4ace0b){var _0x437893={},_0x311835={},_0x2d36c0={'count':0x0,'rows':[]};var _0x56206b=_[_0xc53e('0x30')](db['AnalyticDefaultReport'][_0xc53e('0x31')],function(_0x2467f4){return{'name':_0x2467f4['fieldName'],'type':_0x2467f4['type'][_0xc53e('0x32')]};});_0x311835[_0xc53e('0x33')]=_[_0xc53e('0x30')](_0x56206b,_0xc53e('0x2d'));_0x311835[_0xc53e('0x34')]=_[_0xc53e('0x35')](_0x2a2ca9[_0xc53e('0x34')]);_0x311835[_0xc53e('0x36')]=_['intersection'](_0x311835[_0xc53e('0x33')],_0x311835[_0xc53e('0x34')]);_0x437893[_0xc53e('0x37')]=_[_0xc53e('0x38')](_0x311835[_0xc53e('0x33')],qs[_0xc53e('0x39')](_0x2a2ca9[_0xc53e('0x34')][_0xc53e('0x39')]));_0x437893[_0xc53e('0x37')]=_0x437893['attributes'][_0xc53e('0x3a')]?_0x437893['attributes']:_0x311835[_0xc53e('0x33')];if(!_0x2a2ca9[_0xc53e('0x34')]['hasOwnProperty'](_0xc53e('0x3b'))){_0x437893[_0xc53e('0x1f')]=qs[_0xc53e('0x1f')](_0x2a2ca9['query'][_0xc53e('0x1f')]);_0x437893[_0xc53e('0x1d')]=qs[_0xc53e('0x1d')](_0x2a2ca9[_0xc53e('0x34')][_0xc53e('0x1d')]);}_0x437893[_0xc53e('0x3c')]=qs[_0xc53e('0x3d')](_0x2a2ca9['query'][_0xc53e('0x3d')]);_0x437893[_0xc53e('0x3e')]=qs[_0xc53e('0x36')](_['pick'](_0x2a2ca9[_0xc53e('0x34')],_0x311835['filters']),_0x56206b);if(_0x2a2ca9[_0xc53e('0x34')][_0xc53e('0x3f')]){_0x437893[_0xc53e('0x3e')]=_[_0xc53e('0x40')](_0x437893[_0xc53e('0x3e')],{'$or':_['map'](_0x56206b,function(_0x3dda55){if(_0x3dda55[_0xc53e('0x41')]!=='VIRTUAL'){var _0x5b7354={};_0x5b7354[_0x3dda55['name']]={'$like':'%'+_0x2a2ca9['query'][_0xc53e('0x3f')]+'%'};return _0x5b7354;}})});}_0x437893=_[_0xc53e('0x40')]({},_0x437893,_0x2a2ca9['options']);var _0x460ee6={'where':_0x437893['where']};return db['AnalyticDefaultReport']['count'](_0x460ee6)[_0xc53e('0x26')](function(_0x4ba96f){_0x2d36c0['count']=_0x4ba96f;if(_0x2a2ca9[_0xc53e('0x34')]['includeAll']){_0x437893[_0xc53e('0x42')]=[{'all':!![]}];}return db[_0xc53e('0x43')]['findAll'](_0x437893);})[_0xc53e('0x26')](function(_0x3a4ebc){_0x2d36c0['rows']=_0x3a4ebc;return _0x2d36c0;})[_0xc53e('0x26')](respondWithFilteredResult(_0x4ace0b,_0x437893))['catch'](handleError(_0x4ace0b,null));};exports['show']=function(_0x481e6d,_0x4efee5){var _0x887d78={'raw':!![],'where':{'id':_0x481e6d[_0xc53e('0x44')]['id']}},_0x17b586={};_0x17b586['model']=_[_0xc53e('0x35')](db[_0xc53e('0x43')]['rawAttributes']);_0x17b586['query']=_[_0xc53e('0x35')](_0x481e6d[_0xc53e('0x34')]);_0x17b586[_0xc53e('0x36')]=_['intersection'](_0x17b586[_0xc53e('0x33')],_0x17b586[_0xc53e('0x34')]);_0x887d78[_0xc53e('0x37')]=_[_0xc53e('0x38')](_0x17b586[_0xc53e('0x33')],qs[_0xc53e('0x39')](_0x481e6d[_0xc53e('0x34')]['fields']));_0x887d78[_0xc53e('0x37')]=_0x887d78[_0xc53e('0x37')][_0xc53e('0x3a')]?_0x887d78['attributes']:_0x17b586[_0xc53e('0x33')];if(_0x481e6d[_0xc53e('0x34')][_0xc53e('0x45')]){_0x887d78[_0xc53e('0x42')]=[{'all':!![]}];}_0x887d78=_[_0xc53e('0x40')]({},_0x887d78,_0x481e6d[_0xc53e('0x46')]);return db['AnalyticDefaultReport'][_0xc53e('0x47')](_0x887d78)[_0xc53e('0x26')](handleEntityNotFound(_0x4efee5,null))[_0xc53e('0x26')](respondWithResult(_0x4efee5,null))['catch'](handleError(_0x4efee5,null));};exports[_0xc53e('0x48')]=function(_0x1d2491,_0x1eeb65){return db[_0xc53e('0x43')][_0xc53e('0x48')](_0x1d2491[_0xc53e('0x49')],{})[_0xc53e('0x26')](function(_0x2ba2b4){var _0x34de2d=_0x1d2491[_0xc53e('0x4a')]['get']({'plain':!![]});if(!_0x34de2d)throw new Error(_0xc53e('0x4b'));if(_0x34de2d[_0xc53e('0x4c')]===_0xc53e('0x4a')){var _0x3d74ac=_0x2ba2b4[_0xc53e('0x28')]({'plain':!![]});var _0x52dac7='Reports';return db[_0xc53e('0x4d')]['find']({'where':{'name':_0x52dac7,'userProfileId':_0x34de2d[_0xc53e('0x4e')]},'raw':!![]})['then'](function(_0x3a49a4){if(_0x3a49a4&&_0x3a49a4[_0xc53e('0x4f')]===0x0){return db[_0xc53e('0x2a')]['create']({'name':_0x3d74ac[_0xc53e('0x2d')],'resourceId':_0x3d74ac['id'],'type':_0xc53e('0x29'),'sectionId':_0x3a49a4['id']},{})[_0xc53e('0x26')](function(){return _0x2ba2b4;});}else{return _0x2ba2b4;}})['catch'](function(_0x2f7df2){logger['error'](_0xc53e('0x50'),_0x2f7df2);throw _0x2f7df2;});}return _0x2ba2b4;})[_0xc53e('0x26')](respondWithResult(_0x1eeb65,0xc9))['catch'](handleError(_0x1eeb65,null));};exports[_0xc53e('0x25')]=function(_0x1515ea,_0x5bba72){if(_0x1515ea[_0xc53e('0x49')]['id']){delete _0x1515ea[_0xc53e('0x49')]['id'];}return db[_0xc53e('0x43')][_0xc53e('0x47')]({'where':{'id':_0x1515ea[_0xc53e('0x44')]['id']}})[_0xc53e('0x26')](handleEntityNotFound(_0x5bba72,null))[_0xc53e('0x26')](saveUpdates(_0x1515ea[_0xc53e('0x49')],null))[_0xc53e('0x26')](respondWithResult(_0x5bba72,null))[_0xc53e('0x51')](handleError(_0x5bba72,null));};exports[_0xc53e('0x27')]=function(_0x47dd5a,_0x8364f6){return db['AnalyticDefaultReport'][_0xc53e('0x47')]({'where':{'id':_0x47dd5a['params']['id']}})[_0xc53e('0x26')](handleEntityNotFound(_0x8364f6,null))[_0xc53e('0x26')](removeEntity(_0x8364f6,null))['catch'](handleError(_0x8364f6,null));};exports[_0xc53e('0x52')]=function(_0x7f0bc0,_0x9c0112){var _0x432a91=0xa;var _0x53083b=[_0xc53e('0x53'),_0xc53e('0x54'),'right_join','cross_join'];var _0x3c0aa1={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xc53e('0x55'),'MIN':'MIN(%s)','AVG':_0xc53e('0x56'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xc53e('0x57'),'GROUP_CONCAT DESC':_0xc53e('0x58')};var _0x5fcd58={'SEC_TO_TIME':_0xc53e('0x59'),'DATE':_0xc53e('0x5a'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xc53e('0x5b')};var _0x37b091=function(_0x31e22b){return!_[_0xc53e('0x5c')]([_0xc53e('0x5d'),_0xc53e('0x5e'),_0xc53e('0x5f'),_0xc53e('0x60')],_0x31e22b);};var _0x13bf71=function(_0x16d8a1){if(!_0x16d8a1||!_0x16d8a1[_0xc53e('0x61')][_0xc53e('0x3a')]){return'';}for(var _0xdc0e49='(',_0x520738=0x0;_0x520738<_0x16d8a1[_0xc53e('0x61')]['length'];_0x520738+=0x1){_0x520738>0x0&&(_0xdc0e49+='\x20'+_0x16d8a1[_0xc53e('0x62')]+'\x20');_0xdc0e49+=_0x16d8a1[_0xc53e('0x61')][_0x520738][_0xc53e('0x63')]?_0x13bf71(_0x16d8a1[_0xc53e('0x61')][_0x520738][_0xc53e('0x63')]):_0x16d8a1[_0xc53e('0x61')][_0x520738][_0xc53e('0x64')]+'\x20'+_0x16d8a1[_0xc53e('0x61')][_0x520738]['condition']+(_0x37b091(_0x16d8a1['rules'][_0x520738]['condition'])?'\x20'+_0x16d8a1[_0xc53e('0x61')][_0x520738][_0xc53e('0x65')]:'');}return _0xdc0e49+')';};var _0x37ac78={'where':{'id':_0x7f0bc0['params']['id']}},_0x25e4b6,_0x247d99,_0x160ca3,_0x3581ab,_0x5a9596;_0x37ac78=_['merge']({},_0x37ac78,_0x7f0bc0[_0xc53e('0x46')]);return db[_0xc53e('0x43')]['find'](_0x37ac78)[_0xc53e('0x26')](function(_0x235a6b){if(_0x235a6b){_0x25e4b6=_0x235a6b;return _0x235a6b[_0xc53e('0x66')]();}return null;})[_0xc53e('0x26')](function(_0x22829b){if(_0x22829b){if(!_0x22829b[_0xc53e('0x3a')]){throw new db['Sequelize']['ValidationErrorItem'](_0xc53e('0x67'),0x193);}_0x247d99=_0x22829b;return db[_0xc53e('0x68')][_0xc53e('0x69')]({'raw':!![]});}return null;})[_0xc53e('0x26')](function(_0x29ee08){if(_0x29ee08){_0x160ca3=_[_0xc53e('0x6a')](_0x29ee08,'id');var _0x5a1a4b;var _0x2b6734=squel[_0xc53e('0x6b')]();_0x2b6734[_0xc53e('0x6c')](_0x25e4b6[_0xc53e('0x6d')]);for(var _0x4d2609=0x0;_0x4d2609<_0x247d99[_0xc53e('0x3a')];_0x4d2609+=0x1){_0x5a1a4b=_0x247d99[_0x4d2609][_0xc53e('0x6e')]?_0x160ca3[_0x247d99[_0x4d2609][_0xc53e('0x6e')]][_0xc53e('0x6f')]:_0x247d99[_0x4d2609][_0xc53e('0x64')];_0x5a1a4b=_0x247d99[_0x4d2609][_0xc53e('0x70')]?_['replace'](_0x3c0aa1[_0x247d99[_0x4d2609][_0xc53e('0x70')]],'%s',_0x5a1a4b):_0x5a1a4b;_0x5a1a4b=_0x247d99[_0x4d2609][_0xc53e('0x71')]?_[_0xc53e('0x72')](_0x5fcd58[_0x247d99[_0x4d2609][_0xc53e('0x71')]],'%s',_0x5a1a4b):_0x5a1a4b;if(_0x247d99[_0x4d2609]['groupBy']){_0x2b6734['group'](_0x5a1a4b);}_0x247d99[_0x4d2609][_0xc53e('0x73')]&&_0x2b6734[_0xc53e('0x3c')](_0x5a1a4b,_0x247d99[_0x4d2609][_0xc53e('0x73')]===_0xc53e('0x74')?![]:!![]);_0x2b6734['field'](_0x5a1a4b,_0x247d99[_0x4d2609][_0xc53e('0x75')]||_0x5a1a4b);}if(_0x25e4b6['joins']){_0x25e4b6[_0xc53e('0x76')]=JSON['parse'](_0x25e4b6[_0xc53e('0x76')]);for(var _0x4e128a=0x0;_0x4e128a<_0x25e4b6[_0xc53e('0x76')][_0xc53e('0x3a')];_0x4e128a+=0x1){if(_0x25e4b6['joins'][_0x4e128a][_0xc53e('0x41')]&&_[_0xc53e('0x5c')](_0x53083b,_0x25e4b6['joins'][_0x4e128a]['type'])&&_0x25e4b6[_0xc53e('0x76')][_0x4e128a][_0xc53e('0x77')]&&_0x25e4b6['joins'][_0x4e128a]['foreignTable']&&_0x25e4b6[_0xc53e('0x76')][_0x4e128a]['foreignKey']){_0x2b6734[_0x25e4b6[_0xc53e('0x76')][_0x4e128a]['type']](_0x25e4b6[_0xc53e('0x76')][_0x4e128a][_0xc53e('0x78')],null,util[_0xc53e('0x71')](_0xc53e('0x79'),_0x25e4b6[_0xc53e('0x6d')],_0x25e4b6[_0xc53e('0x76')][_0x4e128a][_0xc53e('0x77')],_0x25e4b6[_0xc53e('0x76')][_0x4e128a][_0xc53e('0x78')],_0x25e4b6[_0xc53e('0x76')][_0x4e128a]['foreignKey']));}}}if(_0x25e4b6[_0xc53e('0x7a')]){_0x25e4b6['conditions']=JSON[_0xc53e('0x7b')](_0x25e4b6[_0xc53e('0x7a')]);_0x2b6734[_0xc53e('0x3e')](_0x13bf71(_0x25e4b6[_0xc53e('0x7a')][_0xc53e('0x63')]));}_0x5a9596=_0x2b6734[_0xc53e('0x7c')]();_0x2b6734[_0xc53e('0x1f')](_0x432a91);_0x2b6734[_0xc53e('0x1d')](0x0);logger[_0xc53e('0x7d')](_0xc53e('0x7e'),_0x2b6734['toString']());return dbH[_0xc53e('0x7f')]['query'](_0x2b6734[_0xc53e('0x80')](),{'type':dbH[_0xc53e('0x7f')][_0xc53e('0x81')]['SELECT']});}})[_0xc53e('0x26')](respondWithResult(_0x9c0112,null))[_0xc53e('0x51')](handleError(_0x9c0112,null));};function runReport(_0x381652,_0xec3738,_0x3a84a2){var _0x508671=_0xec3738[_0xc53e('0x2d')];var _0x48e337=0xa;var _0x56c66f=[_0xc53e('0x53'),_0xc53e('0x54'),_0xc53e('0x82'),'cross_join'];var _0x35b6dc={'SUM':_0xc53e('0x83'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xc53e('0x84'),'MAX':_0xc53e('0x55'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0xc53e('0x85'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xc53e('0x58')};var _0x3d2636={'SEC_TO_TIME':_0xc53e('0x59'),'DATE':'DATE(%s)','HOUR':_0xc53e('0x86'),'ROUND':_0xc53e('0x87'),'UNIX_TIMESTAMP':_0xc53e('0x5b')};var _0x4c8112=function(_0x1a8ae4){return!_[_0xc53e('0x5c')]([_0xc53e('0x5d'),_0xc53e('0x5e'),_0xc53e('0x5f'),'IS\x20NOT\x20EMPTY'],_0x1a8ae4);};var _0x3dac82=function(_0x325287){if(!_0x325287||!_0x325287[_0xc53e('0x61')][_0xc53e('0x3a')]){return'';}for(var _0xe6a976='(',_0x4102bc=0x0;_0x4102bc<_0x325287[_0xc53e('0x61')][_0xc53e('0x3a')];_0x4102bc+=0x1){_0x4102bc>0x0&&(_0xe6a976+='\x20'+_0x325287[_0xc53e('0x62')]+'\x20');_0xe6a976+=_0x325287['rules'][_0x4102bc][_0xc53e('0x63')]?_0x3dac82(_0x325287[_0xc53e('0x61')][_0x4102bc][_0xc53e('0x63')]):_0x325287[_0xc53e('0x61')][_0x4102bc][_0xc53e('0x64')]+'\x20'+_0x325287[_0xc53e('0x61')][_0x4102bc][_0xc53e('0x88')]+(_0x4c8112(_0x325287[_0xc53e('0x61')][_0x4102bc][_0xc53e('0x88')])?'\x20'+_0x325287['rules'][_0x4102bc][_0xc53e('0x65')]:'');}return _0xe6a976+')';};var _0x190509={'where':{'id':_0x381652['id']}},_0x110e32,_0x2135d4,_0x4bbf8a,_0x31b06d,_0x21fc8d;_0x190509=_[_0xc53e('0x40')]({},_0x190509,_0x3a84a2);return db[_0xc53e('0x43')]['find'](_0x190509)[_0xc53e('0x26')](function(_0x138870){if(_0x138870){_0x110e32=_0x138870;return _0x138870[_0xc53e('0x66')]();}return null;})[_0xc53e('0x26')](function(_0x621e78){if(_0x621e78){if(!_0x621e78[_0xc53e('0x3a')]){throw new db[(_0xc53e('0x89'))]['ValidationErrorItem'](_0xc53e('0x67'),0x193);}_0x2135d4=_0x621e78;return db['AnalyticMetric'][_0xc53e('0x69')]({'raw':!![]});}return null;})[_0xc53e('0x26')](function(_0x3fe278){if(_0x3fe278){_0x4bbf8a=_['keyBy'](_0x3fe278,'id');var _0x7c56eb;var _0x36dffe=squel[_0xc53e('0x6b')]();_0x36dffe['from'](_0x110e32[_0xc53e('0x6d')]);for(var _0xedb93a=0x0;_0xedb93a<_0x2135d4[_0xc53e('0x3a')];_0xedb93a+=0x1){_0x7c56eb=_0x2135d4[_0xedb93a]['MetricId']?_0x4bbf8a[_0x2135d4[_0xedb93a][_0xc53e('0x6e')]][_0xc53e('0x6f')]:_0x2135d4[_0xedb93a][_0xc53e('0x64')];_0x7c56eb=_0x2135d4[_0xedb93a][_0xc53e('0x70')]?_[_0xc53e('0x72')](_0x35b6dc[_0x2135d4[_0xedb93a]['function']],'%s',_0x7c56eb):_0x7c56eb;_0x7c56eb=_0x2135d4[_0xedb93a]['format']?_['replace'](_0x3d2636[_0x2135d4[_0xedb93a][_0xc53e('0x71')]],'%s',_0x7c56eb):_0x7c56eb;if(_0x2135d4[_0xedb93a][_0xc53e('0x8a')]){_0x36dffe[_0xc53e('0x63')](_0x7c56eb);}_0x2135d4[_0xedb93a][_0xc53e('0x73')]&&_0x36dffe['order'](_0x7c56eb,_0x2135d4[_0xedb93a][_0xc53e('0x73')]==='DESC'?![]:!![]);_0x36dffe[_0xc53e('0x64')](_0x7c56eb,_0x2135d4[_0xedb93a][_0xc53e('0x75')]||_0x7c56eb);}if(_0x110e32[_0xc53e('0x76')]){_0x110e32[_0xc53e('0x76')]=JSON['parse'](_0x110e32[_0xc53e('0x76')]);for(var _0xc23eef=0x0;_0xc23eef<_0x110e32[_0xc53e('0x76')][_0xc53e('0x3a')];_0xc23eef+=0x1){if(_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x41')]&&_[_0xc53e('0x5c')](_0x56c66f,_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x41')])&&_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x77')]&&_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x78')]&&_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x8b')]){_0x36dffe[_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x41')]](_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x78')],null,util[_0xc53e('0x71')](_0xc53e('0x79'),_0x110e32[_0xc53e('0x6d')],_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x77')],_0x110e32[_0xc53e('0x76')][_0xc23eef]['foreignTable'],_0x110e32[_0xc53e('0x76')][_0xc23eef]['foreignKey']));}}}if(_0x110e32[_0xc53e('0x7a')]){_0x110e32[_0xc53e('0x7a')]=JSON['parse'](_0x110e32[_0xc53e('0x7a')]);_0x36dffe[_0xc53e('0x3e')](_0x3dac82(_0x110e32[_0xc53e('0x7a')][_0xc53e('0x63')]));}_0x21fc8d=_0x36dffe[_0xc53e('0x7c')]();_0x36dffe[_0xc53e('0x1f')](_0x48e337);_0x36dffe[_0xc53e('0x1d')](0x0);return;}})[_0xc53e('0x26')](function(){if(_0xec3738[_0xc53e('0x8c')]==='web'){return null;}var _0x37c8e6=_['merge'](_0xec3738,{'name':_0xec3738[_0xc53e('0x8d')]||_0xec3738[_0xc53e('0x2d')]||_0x110e32[_0xc53e('0x2d')],'basename':_0x508671,'savename':util[_0xc53e('0x71')](_0xc53e('0x8e'),_0xec3738[_0xc53e('0x2d')]||_0x110e32[_0xc53e('0x2d')],require(_0xc53e('0x8f'))[_0xc53e('0x90')](0x4),_0xec3738[_0xc53e('0x8c')]||_0xc53e('0x91')),'reportId':_0x110e32['id'],'reportType':_0xc53e('0x92')});return db[_0xc53e('0x93')]['create'](_0x37c8e6,{'raw':!![]});})[_0xc53e('0x26')](function(_0x575ef5){if(_0x110e32[_0xc53e('0x6d')]===_0xc53e('0x94')){_0x21fc8d[_0xc53e('0x3e')](_0x110e32[_0xc53e('0x6d')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0xec3738['startDate'],_0xec3738[_0xc53e('0x95')]);}else{_0x21fc8d[_0xc53e('0x3e')](_0x110e32[_0xc53e('0x6d')]+_0xc53e('0x96'),_0xec3738['startDate'],_0xec3738['endDate']);}if(_0x575ef5){logger[_0xc53e('0x97')](_0xc53e('0x98'),_0x21fc8d[_0xc53e('0x80')]());require(_0xc53e('0x99'))[_0xc53e('0x9a')](path[_0xc53e('0x53')](__dirname,'../../components/export/',_0x575ef5[_0xc53e('0x8c')]),[_0x575ef5['id'],_0x21fc8d[_0xc53e('0x80')](),path[_0xc53e('0x53')](__dirname,_0xc53e('0x9b'),_0x575ef5[_0xc53e('0x9c')]),_0x508671]);return _0x575ef5;}else{var _0x4f527e=squel[_0xc53e('0x6b')]();_0x4f527e[_0xc53e('0x6c')]('('+_0x21fc8d[_0xc53e('0x80')]()+')',_0xc53e('0x9d'));_0x4f527e[_0xc53e('0x64')](_0xc53e('0x9e'),_0xc53e('0x20'));_0x21fc8d[_0xc53e('0x1f')](_0xec3738[_0xc53e('0x1f')]||_0x48e337);_0x21fc8d[_0xc53e('0x1d')](_0xec3738[_0xc53e('0x1d')]||0x0);return dbH[_0xc53e('0x7f')][_0xc53e('0x34')](_0x4f527e['toString'](),{'type':dbH[_0xc53e('0x7f')][_0xc53e('0x81')]['SELECT']})[_0xc53e('0x26')](function(_0x4ee56b){if(!_0x4ee56b['length']){_0x31b06d=0x0;}else{_0x31b06d=_0x4ee56b[0x0][_0xc53e('0x20')]||0x0;}return dbH['sequelize'][_0xc53e('0x34')](_0x21fc8d['toString'](),{'type':dbH[_0xc53e('0x7f')]['QueryTypes'][_0xc53e('0x9f')]});})[_0xc53e('0x26')](function(_0x10ad32){return{'rows':_0x10ad32||[],'count':_0x31b06d};});}});}exports['run']=function(_0xf3f34a,_0x5dd87e){return runReport(_0xf3f34a[_0xc53e('0x44')],_0xf3f34a[_0xc53e('0x34')],_0xf3f34a[_0xc53e('0x46')])[_0xc53e('0x26')](respondWithResult(_0x5dd87e,null))[_0xc53e('0x51')](handleError(_0x5dd87e,null));};exports[_0xc53e('0xa0')]=runReport;exports[_0xc53e('0x34')]=function(_0x265292,_0x2c776c){var _0x383f22=0xa;var _0x51f2a4=['join',_0xc53e('0x54'),'right_join',_0xc53e('0xa1')];var _0xbc960={'SUM':_0xc53e('0x83'),'COUNT':_0xc53e('0xa2'),'COUNT DISTINCT':_0xc53e('0x84'),'MAX':_0xc53e('0x55'),'MIN':_0xc53e('0xa3'),'AVG':_0xc53e('0x56'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xc53e('0x57'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x34cb12={'SEC_TO_TIME':_0xc53e('0x59'),'DATE':_0xc53e('0x5a'),'HOUR':_0xc53e('0x86'),'ROUND':_0xc53e('0x87'),'UNIX_TIMESTAMP':_0xc53e('0x5b')};var _0x227e0c=function(_0x4c0802){return!_[_0xc53e('0x5c')]([_0xc53e('0x5d'),_0xc53e('0x5e'),_0xc53e('0x5f'),_0xc53e('0x60')],_0x4c0802);};var _0x590fb6=function(_0x15d269){if(!_0x15d269||!_0x15d269[_0xc53e('0x61')]['length']){return'';}for(var _0x5253b1='(',_0x208c17=0x0;_0x208c17<_0x15d269['rules'][_0xc53e('0x3a')];_0x208c17+=0x1){_0x208c17>0x0&&(_0x5253b1+='\x20'+_0x15d269[_0xc53e('0x62')]+'\x20');_0x5253b1+=_0x15d269['rules'][_0x208c17]['group']?_0x590fb6(_0x15d269[_0xc53e('0x61')][_0x208c17]['group']):_0x15d269[_0xc53e('0x61')][_0x208c17]['field']+'\x20'+_0x15d269[_0xc53e('0x61')][_0x208c17][_0xc53e('0x88')]+(_0x227e0c(_0x15d269[_0xc53e('0x61')][_0x208c17][_0xc53e('0x88')])?'\x20'+_0x15d269[_0xc53e('0x61')][_0x208c17]['value']:'');}return _0x5253b1+')';};var _0x2f5d22={'where':{'id':_0x265292[_0xc53e('0x44')]['id']}},_0x478e57,_0x5e427a,_0x3e666b,_0x365a98,_0x375d8b;_0x2f5d22=_[_0xc53e('0x40')]({},_0x2f5d22,_0x265292[_0xc53e('0x46')]);return db[_0xc53e('0x43')][_0xc53e('0x47')](_0x2f5d22)[_0xc53e('0x26')](function(_0x3b778b){if(_0x3b778b){_0x478e57=_0x3b778b;return _0x3b778b[_0xc53e('0x66')]();}return null;})[_0xc53e('0x26')](function(_0x55581a){if(_0x55581a){if(!_0x55581a[_0xc53e('0x3a')]){throw new db[(_0xc53e('0x89'))][(_0xc53e('0xa4'))](_0xc53e('0x67'),0x193);}_0x5e427a=_0x55581a;return db[_0xc53e('0x68')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x34c717){if(_0x34c717){_0x3e666b=_[_0xc53e('0x6a')](_0x34c717,'id');var _0x2718fe;var _0x15014e=squel[_0xc53e('0x6b')]();_0x15014e[_0xc53e('0x6c')](_0x478e57[_0xc53e('0x6d')]);for(var _0x2d80f5=0x0;_0x2d80f5<_0x5e427a[_0xc53e('0x3a')];_0x2d80f5+=0x1){_0x2718fe=_0x5e427a[_0x2d80f5][_0xc53e('0x6e')]?_0x3e666b[_0x5e427a[_0x2d80f5][_0xc53e('0x6e')]][_0xc53e('0x6f')]:_0x5e427a[_0x2d80f5][_0xc53e('0x64')];_0x2718fe=_0x5e427a[_0x2d80f5]['function']?_[_0xc53e('0x72')](_0xbc960[_0x5e427a[_0x2d80f5][_0xc53e('0x70')]],'%s',_0x2718fe):_0x2718fe;_0x2718fe=_0x5e427a[_0x2d80f5]['format']?_[_0xc53e('0x72')](_0x34cb12[_0x5e427a[_0x2d80f5][_0xc53e('0x71')]],'%s',_0x2718fe):_0x2718fe;if(_0x5e427a[_0x2d80f5][_0xc53e('0x8a')]){_0x15014e['group'](_0x2718fe);}_0x5e427a[_0x2d80f5]['orderBy']&&_0x15014e[_0xc53e('0x3c')](_0x2718fe,_0x5e427a[_0x2d80f5][_0xc53e('0x73')]===_0xc53e('0x74')?![]:!![]);_0x15014e[_0xc53e('0x64')](_0x2718fe,_0x5e427a[_0x2d80f5]['alias']||_0x2718fe);}if(_0x478e57[_0xc53e('0x76')]){_0x478e57[_0xc53e('0x76')]=JSON[_0xc53e('0x7b')](_0x478e57['joins']);for(var _0x48d301=0x0;_0x48d301<_0x478e57[_0xc53e('0x76')][_0xc53e('0x3a')];_0x48d301+=0x1){if(_0x478e57[_0xc53e('0x76')][_0x48d301]['type']&&_[_0xc53e('0x5c')](_0x51f2a4,_0x478e57[_0xc53e('0x76')][_0x48d301]['type'])&&_0x478e57[_0xc53e('0x76')][_0x48d301][_0xc53e('0x77')]&&_0x478e57[_0xc53e('0x76')][_0x48d301][_0xc53e('0x78')]&&_0x478e57[_0xc53e('0x76')][_0x48d301]['foreignKey']){_0x15014e[_0x478e57[_0xc53e('0x76')][_0x48d301][_0xc53e('0x41')]](_0x478e57[_0xc53e('0x76')][_0x48d301]['foreignTable'],null,util['format'](_0xc53e('0x79'),_0x478e57[_0xc53e('0x6d')],_0x478e57[_0xc53e('0x76')][_0x48d301][_0xc53e('0x77')],_0x478e57[_0xc53e('0x76')][_0x48d301]['foreignTable'],_0x478e57[_0xc53e('0x76')][_0x48d301]['foreignKey']));}}}if(_0x478e57[_0xc53e('0x7a')]){_0x478e57[_0xc53e('0x7a')]=JSON[_0xc53e('0x7b')](_0x478e57[_0xc53e('0x7a')]);_0x15014e[_0xc53e('0x3e')](_0x590fb6(_0x478e57[_0xc53e('0x7a')][_0xc53e('0x63')]));}_0x375d8b=_0x15014e[_0xc53e('0x7c')]();_0x15014e[_0xc53e('0x1f')](_0x383f22);_0x15014e['offset'](0x0);logger[_0xc53e('0x7d')](_0xc53e('0x7e'),_0x15014e[_0xc53e('0x80')]());return dbH[_0xc53e('0x7f')][_0xc53e('0x34')](_0x15014e[_0xc53e('0x80')](),{'type':dbH['sequelize'][_0xc53e('0x81')][_0xc53e('0x9f')]});}})[_0xc53e('0x26')](function(){return{'sql':_0x375d8b[_0xc53e('0x80')]()};})[_0xc53e('0x26')](respondWithResult(_0x2c776c,null))[_0xc53e('0x51')](handleError(_0x2c776c,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(_0x1649ec,_0x1181da){var _0x2409f3=function(_0x3b3e1a){while(--_0x3b3e1a){_0x1649ec['push'](_0x1649ec['shift']());}};_0x2409f3(++_0x1181da);}(_0x814b,0x1a2));var _0xb814=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0x814b[_0x500419];return _0x241c1a;};'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 471f5ac..f120dd9 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 _0xd2a3=['AnalyticDefaultReport','analytics_default_reports','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./analyticDefaultReport.attributes'];(function(_0x55c3d9,_0x3bf75c){var _0x19fd97=function(_0x2b0205){while(--_0x2b0205){_0x55c3d9['push'](_0x55c3d9['shift']());}};_0x19fd97(++_0x3bf75c);}(_0xd2a3,0x1e2));var _0x3d2a=function(_0x1d475d,_0x1fcbfd){_0x1d475d=_0x1d475d-0x0;var _0x40b934=_0xd2a3[_0x1d475d];return _0x40b934;};'use strict';var _=require(_0x3d2a('0x0'));var util=require(_0x3d2a('0x1'));var logger=require(_0x3d2a('0x2'))(_0x3d2a('0x3'));var moment=require(_0x3d2a('0x4'));var BPromise=require(_0x3d2a('0x5'));var rp=require(_0x3d2a('0x6'));var fs=require('fs');var path=require(_0x3d2a('0x7'));var rimraf=require('rimraf');var config=require(_0x3d2a('0x8'));var attributes=require(_0x3d2a('0x9'));module['exports']=function(_0x39e530,_0x4e32c3){return _0x39e530['define'](_0x3d2a('0xa'),attributes,{'tableName':_0x3d2a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1507=['api','moment','bluebird','request-promise','path','../../config/environment','./analyticDefaultReport.attributes','AnalyticDefaultReport','analytics_default_reports','lodash','util'];(function(_0x53a36c,_0x406b76){var _0x461476=function(_0x292956){while(--_0x292956){_0x53a36c['push'](_0x53a36c['shift']());}};_0x461476(++_0x406b76);}(_0x1507,0xc4));var _0x7150=function(_0xdaab62,_0x2728ab){_0xdaab62=_0xdaab62-0x0;var _0x13d767=_0x1507[_0xdaab62];return _0x13d767;};'use strict';var _=require(_0x7150('0x0'));var util=require(_0x7150('0x1'));var logger=require('../../config/logger')(_0x7150('0x2'));var moment=require(_0x7150('0x3'));var BPromise=require(_0x7150('0x4'));var rp=require(_0x7150('0x5'));var fs=require('fs');var path=require(_0x7150('0x6'));var rimraf=require('rimraf');var config=require(_0x7150('0x7'));var attributes=require(_0x7150('0x8'));module['exports']=function(_0x389b4c,_0x1585e8){return _0x389b4c['define'](_0x7150('0x9'),attributes,{'tableName':_0x7150('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index cbd088f..164efab 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 _0xb88c=['debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent'];(function(_0x1afc5d,_0x4de135){var _0x563b82=function(_0x4899b7){while(--_0x4899b7){_0x1afc5d['push'](_0x1afc5d['shift']());}};_0x563b82(++_0x4de135);}(_0xb88c,0xa1));var _0xcb88=function(_0x276986,_0x58a02e){_0x276986=_0x276986-0x0;var _0x1b9e9e=_0xb88c[_0x276986];return _0x1b9e9e;};'use strict';var _=require(_0xcb88('0x0'));var util=require('util');var moment=require(_0xcb88('0x1'));var BPromise=require(_0xcb88('0x2'));var rs=require(_0xcb88('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xcb88('0x4'))(_0xcb88('0x5'));var config=require(_0xcb88('0x6'));var jayson=require(_0xcb88('0x7'));var client=jayson[_0xcb88('0x8')][_0xcb88('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x225676,_0x181695,_0x5d8524){return new BPromise(function(_0x2c8dcb,_0x5517a1){return client[_0xcb88('0xa')](_0x225676,_0x5d8524)[_0xcb88('0xb')](function(_0x53496f){logger[_0xcb88('0xc')](_0xcb88('0xd'),_0x181695,_0xcb88('0xe'));logger[_0xcb88('0xf')](_0xcb88('0x10'),_0x181695,_0xcb88('0xe'),JSON[_0xcb88('0x11')](_0x53496f));if(_0x53496f[_0xcb88('0x12')]){if(_0x53496f[_0xcb88('0x12')]['code']===0x1f4){logger[_0xcb88('0x12')](_0xcb88('0xd'),_0x181695,_0x53496f['error']['message']);return _0x5517a1(_0x53496f['error'][_0xcb88('0x13')]);}logger['error'](_0xcb88('0xd'),_0x181695,_0x53496f[_0xcb88('0x12')][_0xcb88('0x13')]);return _0x2c8dcb(_0x53496f[_0xcb88('0x12')][_0xcb88('0x13')]);}else{logger[_0xcb88('0xc')](_0xcb88('0xd'),_0x181695,_0xcb88('0xe'));_0x2c8dcb(_0x53496f[_0xcb88('0x14')][_0xcb88('0x13')]);}})[_0xcb88('0x15')](function(_0xca887c){logger[_0xcb88('0x12')](_0xcb88('0xd'),_0x181695,_0xca887c);_0x5517a1(_0xca887c);});});} \ No newline at end of file +var _0x3869=['../../config/environment','jayson/promise','http','request','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','lodash','moment','ioredis','../../mysqldb','../../config/logger'];(function(_0x710c76,_0xcab6ce){var _0x5420fe=function(_0x5d3228){while(--_0x5d3228){_0x710c76['push'](_0x710c76['shift']());}};_0x5420fe(++_0xcab6ce);}(_0x3869,0x187));var _0x9386=function(_0x21ee36,_0x27dcfa){_0x21ee36=_0x21ee36-0x0;var _0x5ecb9a=_0x3869[_0x21ee36];return _0x5ecb9a;};'use strict';var _=require(_0x9386('0x0'));var util=require('util');var moment=require(_0x9386('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9386('0x2'));var db=require(_0x9386('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x9386('0x4'))('rpc');var config=require(_0x9386('0x5'));var jayson=require(_0x9386('0x6'));var client=jayson['client'][_0x9386('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x28d507,_0x31d194,_0x55771f){return new BPromise(function(_0x2318b5,_0x11ded7){return client[_0x9386('0x8')](_0x28d507,_0x55771f)['then'](function(_0x5e1abb){logger['info'](_0x9386('0x9'),_0x31d194,_0x9386('0xa'));logger[_0x9386('0xb')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x31d194,_0x9386('0xa'),JSON['stringify'](_0x5e1abb));if(_0x5e1abb[_0x9386('0xc')]){if(_0x5e1abb[_0x9386('0xc')][_0x9386('0xd')]===0x1f4){logger['error'](_0x9386('0x9'),_0x31d194,_0x5e1abb['error'][_0x9386('0xe')]);return _0x11ded7(_0x5e1abb[_0x9386('0xc')]['message']);}logger[_0x9386('0xc')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x31d194,_0x5e1abb['error'][_0x9386('0xe')]);return _0x2318b5(_0x5e1abb['error']['message']);}else{logger[_0x9386('0xf')](_0x9386('0x9'),_0x31d194,_0x9386('0xa'));_0x2318b5(_0x5e1abb[_0x9386('0x10')]['message']);}})[_0x9386('0x11')](function(_0x5167f6){logger['error'](_0x9386('0x9'),_0x31d194,_0x5167f6);_0x11ded7(_0x5167f6);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 6b71178..938de0f 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 _0xf304=['../../components/interaction/service','./analyticDefaultReport.controller','isAuthenticated','index','get','/:id','show','/:id/preview','preview','/:id/run','run','/:id/query','query','post','create','update','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x4b28da,_0x2249ca){var _0x147ad7=function(_0x3187fc){while(--_0x3187fc){_0x4b28da['push'](_0x4b28da['shift']());}};_0x147ad7(++_0x2249ca);}(_0xf304,0x88));var _0x4f30=function(_0x5f1212,_0x116bf1){_0x5f1212=_0x5f1212-0x0;var _0x336e3b=_0xf304[_0x5f1212];return _0x336e3b;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x4f30('0x0'));var express=require('express');var router=express[_0x4f30('0x1')]();var fs_extra=require(_0x4f30('0x2'));var auth=require(_0x4f30('0x3'));var interaction=require(_0x4f30('0x4'));var config=require('../../config/environment');var controller=require(_0x4f30('0x5'));router['get']('/',auth[_0x4f30('0x6')](),controller[_0x4f30('0x7')]);router[_0x4f30('0x8')](_0x4f30('0x9'),auth[_0x4f30('0x6')](),controller[_0x4f30('0xa')]);router[_0x4f30('0x8')](_0x4f30('0xb'),auth[_0x4f30('0x6')](),controller[_0x4f30('0xc')]);router[_0x4f30('0x8')](_0x4f30('0xd'),auth['isAuthenticated'](),controller[_0x4f30('0xe')]);router[_0x4f30('0x8')](_0x4f30('0xf'),auth[_0x4f30('0x6')](),controller[_0x4f30('0x10')]);router[_0x4f30('0x11')]('/',auth[_0x4f30('0x6')](),controller[_0x4f30('0x12')]);router['put'](_0x4f30('0x9'),auth[_0x4f30('0x6')](),controller[_0x4f30('0x13')]);router['delete'](_0x4f30('0x9'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xdec3=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/preview','run','query','create','put','update','exports','multer','path','connect-timeout'];(function(_0x3c2db0,_0x12d7b2){var _0xd5d161=function(_0x2539d5){while(--_0x2539d5){_0x3c2db0['push'](_0x3c2db0['shift']());}};_0xd5d161(++_0x12d7b2);}(_0xdec3,0x89));var _0x3dec=function(_0x1b7bb8,_0x86eade){_0x1b7bb8=_0x1b7bb8-0x0;var _0x2a21c1=_0xdec3[_0x1b7bb8];return _0x2a21c1;};'use strict';var multer=require(_0x3dec('0x0'));var util=require('util');var path=require(_0x3dec('0x1'));var timeout=require(_0x3dec('0x2'));var express=require(_0x3dec('0x3'));var router=express['Router']();var fs_extra=require(_0x3dec('0x4'));var auth=require(_0x3dec('0x5'));var interaction=require(_0x3dec('0x6'));var config=require(_0x3dec('0x7'));var controller=require('./analyticDefaultReport.controller');router[_0x3dec('0x8')]('/',auth[_0x3dec('0x9')](),controller[_0x3dec('0xa')]);router[_0x3dec('0x8')](_0x3dec('0xb'),auth[_0x3dec('0x9')](),controller[_0x3dec('0xc')]);router['get'](_0x3dec('0xd'),auth[_0x3dec('0x9')](),controller['preview']);router[_0x3dec('0x8')]('/:id/run',auth['isAuthenticated'](),controller[_0x3dec('0xe')]);router[_0x3dec('0x8')]('/:id/query',auth[_0x3dec('0x9')](),controller[_0x3dec('0xf')]);router['post']('/',auth[_0x3dec('0x9')](),controller[_0x3dec('0x10')]);router[_0x3dec('0x11')](_0x3dec('0xb'),auth[_0x3dec('0x9')](),controller[_0x3dec('0x12')]);router['delete']('/:id',auth[_0x3dec('0x9')](),controller['destroy']);module[_0x3dec('0x13')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 89a7468..2737a51 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 _0xac4e=['xlsx','DATE','Loading','manual','INTEGER','UNSIGNED','sequelize','moment','exports','STRING','ENUM','csv'];(function(_0x136d61,_0x5ec9c4){var _0x28c43f=function(_0x974720){while(--_0x974720){_0x136d61['push'](_0x136d61['shift']());}};_0x28c43f(++_0x5ec9c4);}(_0xac4e,0x132));var _0xeac4=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xac4e[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require(_0xeac4('0x0'));var moment=require(_0xeac4('0x1'));module[_0xeac4('0x2')]={'name':{'type':Sequelize[_0xeac4('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0xeac4('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0xeac4('0x4')](_0xeac4('0x5'),'pdf',_0xeac4('0x6')),'allowNull':![],'defaultValue':_0xeac4('0x5')},'savename':{'type':Sequelize[_0xeac4('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0xeac4('0x7')]},'endDate':{'type':Sequelize[_0xeac4('0x7')]},'status':{'type':Sequelize[_0xeac4('0x3')],'defaultValue':_0xeac4('0x8')},'type':{'type':Sequelize[_0xeac4('0x4')](_0xeac4('0x9'),'scheduled'),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize[_0xeac4('0xa')](0xb)[_0xeac4('0xb')]},'reportType':{'type':Sequelize[_0xeac4('0x3')]}}; \ No newline at end of file +var _0x4ac3=['STRING','ENUM','csv','xlsx','DATE','manual','scheduled','INTEGER','sequelize','exports'];(function(_0x3e7f14,_0x4e214a){var _0x4939d6=function(_0x52f8ef){while(--_0x52f8ef){_0x3e7f14['push'](_0x3e7f14['shift']());}};_0x4939d6(++_0x4e214a);}(_0x4ac3,0x1ac));var _0x34ac=function(_0x24f37e,_0x5e1d02){_0x24f37e=_0x24f37e-0x0;var _0xde05aa=_0x4ac3[_0x24f37e];return _0xde05aa;};'use strict';var Sequelize=require(_0x34ac('0x0'));var moment=require('moment');module[_0x34ac('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize[_0x34ac('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0x34ac('0x3')](_0x34ac('0x4'),'pdf',_0x34ac('0x5')),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize[_0x34ac('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0x34ac('0x6')]},'endDate':{'type':Sequelize[_0x34ac('0x6')]},'status':{'type':Sequelize[_0x34ac('0x2')],'defaultValue':'Loading'},'type':{'type':Sequelize['ENUM'](_0x34ac('0x7'),_0x34ac('0x8')),'allowNull':![],'defaultValue':_0x34ac('0x7')},'reportId':{'type':Sequelize[_0x34ac('0x9')](0xb)['UNSIGNED']},'reportType':{'type':Sequelize[_0x34ac('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index d62aedf..ae796f3 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 _0xf641=['status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','ExtractedReports','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','merge','filter','options','AnalyticExtractedReport','includeAll','include','catch','show','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','download','savename','output','join','root','server/files/reports','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','format','basename','toLowerCase','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf641,0xad));var _0x1f64=function(_0x74f52,_0x15fb1d){_0x74f52=_0x74f52-0x0;var _0x2d5b52=_0xf641[_0x74f52];return _0x2d5b52;};'use strict';var emlformat=require(_0x1f64('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1f64('0x1'));var jsonpatch=require(_0x1f64('0x2'));var rp=require('request-promise');var moment=require(_0x1f64('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1f64('0x4'));var util=require(_0x1f64('0x5'));var path=require(_0x1f64('0x6'));var sox=require(_0x1f64('0x7'));var csv=require('to-csv');var ejs=require(_0x1f64('0x8'));var fs=require('fs');var fs_extra=require(_0x1f64('0x9'));var _=require(_0x1f64('0xa'));var squel=require(_0x1f64('0xb'));var crypto=require(_0x1f64('0xc'));var jsforce=require(_0x1f64('0xd'));var deskjs=require(_0x1f64('0xe'));var toCsv=require(_0x1f64('0xf'));var querystring=require(_0x1f64('0x10'));var Papa=require(_0x1f64('0x11'));var Redis=require(_0x1f64('0x12'));var authService=require(_0x1f64('0x13'));var qs=require(_0x1f64('0x14'));var as=require(_0x1f64('0x15'));var hardwareService=require(_0x1f64('0x16'));var logger=require(_0x1f64('0x17'))(_0x1f64('0x18'));var utils=require(_0x1f64('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x1f64('0x1a'));var db=require(_0x1f64('0x1b'))['db'];function respondWithStatusCode(_0x223419,_0x2e5b34){_0x2e5b34=_0x2e5b34||0xcc;return function(_0x2821fb){if(_0x2821fb){return _0x223419[_0x1f64('0x1c')](_0x2e5b34);}return _0x223419[_0x1f64('0x1d')](_0x2e5b34)[_0x1f64('0x1e')]();};}function respondWithResult(_0x354456,_0x5c92b9){_0x5c92b9=_0x5c92b9||0xc8;return function(_0x517b66){if(_0x517b66){return _0x354456[_0x1f64('0x1d')](_0x5c92b9)[_0x1f64('0x1f')](_0x517b66);}};}function respondWithFilteredResult(_0x37fa16,_0x601bc0){return function(_0x3596f1){if(_0x3596f1){var _0x3ba79e=typeof _0x601bc0[_0x1f64('0x20')]===_0x1f64('0x21')&&typeof _0x601bc0[_0x1f64('0x22')]==='undefined';var _0x119a8f=_0x3596f1[_0x1f64('0x23')];var _0x280da9=_0x3ba79e?0x0:_0x601bc0['offset'];var _0x11eefd=_0x3ba79e?_0x3596f1[_0x1f64('0x23')]:_0x601bc0[_0x1f64('0x20')]+_0x601bc0[_0x1f64('0x22')];var _0x44e6d8;if(_0x11eefd>=_0x119a8f){_0x11eefd=_0x119a8f;_0x44e6d8=0xc8;}else{_0x44e6d8=0xce;}_0x37fa16[_0x1f64('0x1d')](_0x44e6d8);return _0x37fa16[_0x1f64('0x24')](_0x1f64('0x25'),_0x280da9+'-'+_0x11eefd+'/'+_0x119a8f)[_0x1f64('0x1f')](_0x3596f1);}return null;};}function patchUpdates(_0x137d05){return function(_0x1748d1){try{jsonpatch[_0x1f64('0x26')](_0x1748d1,_0x137d05,!![]);}catch(_0x280649){return BPromise[_0x1f64('0x27')](_0x280649);}return _0x1748d1[_0x1f64('0x28')]();};}function saveUpdates(_0x2656a9,_0x5a5b6e){return function(_0xb9035e){if(_0xb9035e){return _0xb9035e['update'](_0x2656a9)[_0x1f64('0x29')](function(_0x1a40c7){return _0x1a40c7;});}return null;};}function removeEntity(_0x3bc89f,_0x13b4a7){return function(_0x12ff98){if(_0x12ff98){return _0x12ff98[_0x1f64('0x2a')]()['then'](function(){var _0x1a0207=_0x12ff98['get']({'plain':!![]});var _0x9f53b=_0x1f64('0x2b');return db[_0x1f64('0x2c')][_0x1f64('0x2a')]({'where':{'type':_0x9f53b,'resourceId':_0x1a0207['id']}})[_0x1f64('0x29')](function(){return _0x12ff98;});})['then'](function(){_0x3bc89f[_0x1f64('0x1d')](0xcc)[_0x1f64('0x1e')]();});}};}function handleEntityNotFound(_0x1512d1,_0xe4e10b){return function(_0xac6216){if(!_0xac6216){_0x1512d1['sendStatus'](0x194);}return _0xac6216;};}function handleError(_0x136c4b,_0x57d134){_0x57d134=_0x57d134||0x1f4;return function(_0x583bc4){logger[_0x1f64('0x2d')](_0x583bc4[_0x1f64('0x2e')]);if(_0x583bc4[_0x1f64('0x2f')]){delete _0x583bc4['name'];}_0x136c4b[_0x1f64('0x1d')](_0x57d134)[_0x1f64('0x30')](_0x583bc4);};}exports[_0x1f64('0x31')]=function(_0x5a4729,_0x4df21d){var _0xea0d16={},_0xe64dc4={},_0x48c10c={'count':0x0,'rows':[]};var _0x1a9179=_[_0x1f64('0x32')](db['AnalyticExtractedReport'][_0x1f64('0x33')],function(_0x534cd0){return{'name':_0x534cd0[_0x1f64('0x34')],'type':_0x534cd0[_0x1f64('0x35')][_0x1f64('0x36')]};});_0xe64dc4[_0x1f64('0x37')]=_[_0x1f64('0x32')](_0x1a9179,_0x1f64('0x2f'));_0xe64dc4[_0x1f64('0x38')]=_[_0x1f64('0x39')](_0x5a4729['query']);_0xe64dc4['filters']=_['intersection'](_0xe64dc4[_0x1f64('0x37')],_0xe64dc4['query']);_0xea0d16[_0x1f64('0x3a')]=_[_0x1f64('0x3b')](_0xe64dc4[_0x1f64('0x37')],qs[_0x1f64('0x3c')](_0x5a4729['query'][_0x1f64('0x3c')]));_0xea0d16[_0x1f64('0x3a')]=_0xea0d16['attributes'][_0x1f64('0x3d')]?_0xea0d16[_0x1f64('0x3a')]:_0xe64dc4[_0x1f64('0x37')];if(!_0x5a4729['query'][_0x1f64('0x3e')](_0x1f64('0x3f'))){_0xea0d16[_0x1f64('0x22')]=qs['limit'](_0x5a4729[_0x1f64('0x38')][_0x1f64('0x22')]);_0xea0d16['offset']=qs[_0x1f64('0x20')](_0x5a4729[_0x1f64('0x38')]['offset']);}_0xea0d16[_0x1f64('0x40')]=qs[_0x1f64('0x41')](_0x5a4729[_0x1f64('0x38')][_0x1f64('0x41')]);_0xea0d16[_0x1f64('0x42')]=qs['filters'](_[_0x1f64('0x43')](_0x5a4729[_0x1f64('0x38')],_0xe64dc4[_0x1f64('0x44')]),_0x1a9179);if(_0x5a4729[_0x1f64('0x38')]['filter']){_0xea0d16[_0x1f64('0x42')]=_[_0x1f64('0x45')](_0xea0d16[_0x1f64('0x42')],{'$or':_[_0x1f64('0x32')](_0x1a9179,function(_0x7998b7){if(_0x7998b7['type']!=='VIRTUAL'){var _0x368ab6={};_0x368ab6[_0x7998b7[_0x1f64('0x2f')]]={'$like':'%'+_0x5a4729[_0x1f64('0x38')][_0x1f64('0x46')]+'%'};return _0x368ab6;}})});}_0xea0d16=_[_0x1f64('0x45')]({},_0xea0d16,_0x5a4729[_0x1f64('0x47')]);var _0x972584={'where':_0xea0d16[_0x1f64('0x42')]};return db[_0x1f64('0x48')][_0x1f64('0x23')](_0x972584)[_0x1f64('0x29')](function(_0x2bb56d){_0x48c10c[_0x1f64('0x23')]=_0x2bb56d;if(_0x5a4729['query'][_0x1f64('0x49')]){_0xea0d16[_0x1f64('0x4a')]=[{'all':!![]}];}return db[_0x1f64('0x48')]['findAll'](_0xea0d16);})[_0x1f64('0x29')](function(_0x250e7c){_0x48c10c['rows']=_0x250e7c;return _0x48c10c;})['then'](respondWithFilteredResult(_0x4df21d,_0xea0d16))[_0x1f64('0x4b')](handleError(_0x4df21d,null));};exports[_0x1f64('0x4c')]=function(_0x3df481,_0x476898){var _0x111576={'raw':!![],'where':{'id':_0x3df481[_0x1f64('0x4d')]['id']}},_0x5eb292={};_0x5eb292[_0x1f64('0x37')]=_[_0x1f64('0x39')](db[_0x1f64('0x48')][_0x1f64('0x33')]);_0x5eb292[_0x1f64('0x38')]=_[_0x1f64('0x39')](_0x3df481[_0x1f64('0x38')]);_0x5eb292['filters']=_['intersection'](_0x5eb292[_0x1f64('0x37')],_0x5eb292[_0x1f64('0x38')]);_0x111576[_0x1f64('0x3a')]=_[_0x1f64('0x3b')](_0x5eb292[_0x1f64('0x37')],qs['fields'](_0x3df481['query'][_0x1f64('0x3c')]));_0x111576['attributes']=_0x111576['attributes'][_0x1f64('0x3d')]?_0x111576[_0x1f64('0x3a')]:_0x5eb292['model'];if(_0x3df481[_0x1f64('0x38')][_0x1f64('0x49')]){_0x111576[_0x1f64('0x4a')]=[{'all':!![]}];}_0x111576=_[_0x1f64('0x45')]({},_0x111576,_0x3df481['options']);return db[_0x1f64('0x48')][_0x1f64('0x4e')](_0x111576)['then'](handleEntityNotFound(_0x476898,null))[_0x1f64('0x29')](respondWithResult(_0x476898,null))['catch'](handleError(_0x476898,null));};exports[_0x1f64('0x4f')]=function(_0x40c010,_0x2f27aa){return db[_0x1f64('0x48')]['create'](_0x40c010[_0x1f64('0x50')],{})['then'](function(_0x276ab0){var _0x3cea89=_0x40c010[_0x1f64('0x51')][_0x1f64('0x52')]({'plain':!![]});if(!_0x3cea89)throw new Error(_0x1f64('0x53'));if(_0x3cea89[_0x1f64('0x54')]==='user'){var _0x1b8487=_0x276ab0[_0x1f64('0x52')]({'plain':!![]});var _0x5e7453=_0x1f64('0x2b');return db[_0x1f64('0x55')][_0x1f64('0x4e')]({'where':{'name':_0x5e7453,'userProfileId':_0x3cea89['userProfileId']},'raw':!![]})[_0x1f64('0x29')](function(_0x112c1c){if(_0x112c1c&&_0x112c1c[_0x1f64('0x56')]===0x0){return db[_0x1f64('0x2c')][_0x1f64('0x4f')]({'name':_0x1b8487[_0x1f64('0x2f')],'resourceId':_0x1b8487['id'],'type':_0x112c1c[_0x1f64('0x2f')],'sectionId':_0x112c1c['id']},{})[_0x1f64('0x29')](function(){return _0x276ab0;});}else{return _0x276ab0;}})[_0x1f64('0x4b')](function(_0x1d5a5b){logger[_0x1f64('0x2d')](_0x1f64('0x57'),_0x1d5a5b);throw _0x1d5a5b;});}return _0x276ab0;})[_0x1f64('0x29')](respondWithResult(_0x2f27aa,0xc9))[_0x1f64('0x4b')](handleError(_0x2f27aa,null));};exports[_0x1f64('0x58')]=function(_0x381fe9,_0x570ba8){if(_0x381fe9[_0x1f64('0x50')]['id']){delete _0x381fe9['body']['id'];}return db['AnalyticExtractedReport'][_0x1f64('0x4e')]({'where':{'id':_0x381fe9[_0x1f64('0x4d')]['id']}})['then'](handleEntityNotFound(_0x570ba8,null))[_0x1f64('0x29')](saveUpdates(_0x381fe9[_0x1f64('0x50')],null))[_0x1f64('0x29')](respondWithResult(_0x570ba8,null))[_0x1f64('0x4b')](handleError(_0x570ba8,null));};exports[_0x1f64('0x2a')]=function(_0x4999c3,_0x5d88d8){return db['AnalyticExtractedReport'][_0x1f64('0x4e')]({'where':{'id':_0x4999c3[_0x1f64('0x4d')]['id']}})[_0x1f64('0x29')](handleEntityNotFound(_0x5d88d8,null))[_0x1f64('0x29')](removeEntity(_0x5d88d8,null))[_0x1f64('0x4b')](handleError(_0x5d88d8,null));};exports[_0x1f64('0x59')]=function(_0x394bcd,_0x233974,_0x56a322){return db[_0x1f64('0x48')][_0x1f64('0x4e')]({'where':{'id':_0x394bcd[_0x1f64('0x4d')]['id']},'attributes':[_0x1f64('0x2f'),'basename',_0x1f64('0x5a'),_0x1f64('0x5b')],'raw':!![]})[_0x1f64('0x29')](handleEntityNotFound(_0x233974,null))['then'](function(_0x31d0ec){if(_0x31d0ec){if(!fs['existsSync'](path[_0x1f64('0x5c')](config[_0x1f64('0x5d')],_0x1f64('0x5e'),_0x31d0ec[_0x1f64('0x5a')]))){throw new db['Sequelize'][(_0x1f64('0x5f'))](_0x1f64('0x60'));}if(_0x394bcd[_0x1f64('0x38')][_0x1f64('0x61')]){return _0x233974[_0x1f64('0x1c')](0xc8);}return _0x233974[_0x1f64('0x59')](path[_0x1f64('0x5c')](config[_0x1f64('0x5d')],'server/files/reports',_0x31d0ec[_0x1f64('0x5a')]),util[_0x1f64('0x62')]('%s.%s',_0x31d0ec[_0x1f64('0x63')]||_0x31d0ec[_0x1f64('0x2f')],_0x31d0ec[_0x1f64('0x5b')][_0x1f64('0x64')]()));}})[_0x1f64('0x4b')](handleError(_0x233974,null));}; \ No newline at end of file +var _0x91cc=['join','root','server/files/reports','Sequelize','exists','format','%s.%s','toLowerCase','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','ExtractedReports','UserProfileResource','stack','name','AnalyticExtractedReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','error','download','basename','savename','output'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x91cc,0xc0));var _0xc91c=function(_0x3305de,_0x16582f){_0x3305de=_0x3305de-0x0;var _0x3b5a84=_0x91cc[_0x3305de];return _0x3b5a84;};'use strict';var emlformat=require(_0xc91c('0x0'));var rimraf=require(_0xc91c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc91c('0x2'));var rp=require(_0xc91c('0x3'));var moment=require(_0xc91c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc91c('0x5'));var util=require(_0xc91c('0x6'));var path=require(_0xc91c('0x7'));var sox=require(_0xc91c('0x8'));var csv=require(_0xc91c('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc91c('0xa'));var _=require(_0xc91c('0xb'));var squel=require(_0xc91c('0xc'));var crypto=require(_0xc91c('0xd'));var jsforce=require(_0xc91c('0xe'));var deskjs=require(_0xc91c('0xf'));var toCsv=require(_0xc91c('0x9'));var querystring=require('querystring');var Papa=require(_0xc91c('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc91c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc91c('0x12'));var logger=require('../../config/logger')(_0xc91c('0x13'));var utils=require(_0xc91c('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc91c('0x15'))['db'];function respondWithStatusCode(_0x2420bb,_0x2a2cfd){_0x2a2cfd=_0x2a2cfd||0xcc;return function(_0x5dfea2){if(_0x5dfea2){return _0x2420bb[_0xc91c('0x16')](_0x2a2cfd);}return _0x2420bb[_0xc91c('0x17')](_0x2a2cfd)[_0xc91c('0x18')]();};}function respondWithResult(_0x5eb620,_0x57ae85){_0x57ae85=_0x57ae85||0xc8;return function(_0x906bd7){if(_0x906bd7){return _0x5eb620[_0xc91c('0x17')](_0x57ae85)[_0xc91c('0x19')](_0x906bd7);}};}function respondWithFilteredResult(_0x4afebd,_0x23858a){return function(_0x381a1b){if(_0x381a1b){var _0x50d002=typeof _0x23858a[_0xc91c('0x1a')]===_0xc91c('0x1b')&&typeof _0x23858a[_0xc91c('0x1c')]===_0xc91c('0x1b');var _0x1141da=_0x381a1b[_0xc91c('0x1d')];var _0x247ddf=_0x50d002?0x0:_0x23858a[_0xc91c('0x1a')];var _0x34fab6=_0x50d002?_0x381a1b[_0xc91c('0x1d')]:_0x23858a[_0xc91c('0x1a')]+_0x23858a['limit'];var _0x3a998a;if(_0x34fab6>=_0x1141da){_0x34fab6=_0x1141da;_0x3a998a=0xc8;}else{_0x3a998a=0xce;}_0x4afebd[_0xc91c('0x17')](_0x3a998a);return _0x4afebd['set'](_0xc91c('0x1e'),_0x247ddf+'-'+_0x34fab6+'/'+_0x1141da)[_0xc91c('0x19')](_0x381a1b);}return null;};}function patchUpdates(_0x185a25){return function(_0x12f9f6){try{jsonpatch[_0xc91c('0x1f')](_0x12f9f6,_0x185a25,!![]);}catch(_0x2c7e69){return BPromise[_0xc91c('0x20')](_0x2c7e69);}return _0x12f9f6[_0xc91c('0x21')]();};}function saveUpdates(_0x21ceab,_0x205a80){return function(_0x3fa2ef){if(_0x3fa2ef){return _0x3fa2ef[_0xc91c('0x22')](_0x21ceab)[_0xc91c('0x23')](function(_0x5f58b2){return _0x5f58b2;});}return null;};}function removeEntity(_0x2cf17f,_0x5c7917){return function(_0x4409b6){if(_0x4409b6){return _0x4409b6[_0xc91c('0x24')]()[_0xc91c('0x23')](function(){var _0x5ad445=_0x4409b6['get']({'plain':!![]});var _0x11ff01=_0xc91c('0x25');return db[_0xc91c('0x26')][_0xc91c('0x24')]({'where':{'type':_0x11ff01,'resourceId':_0x5ad445['id']}})[_0xc91c('0x23')](function(){return _0x4409b6;});})[_0xc91c('0x23')](function(){_0x2cf17f[_0xc91c('0x17')](0xcc)[_0xc91c('0x18')]();});}};}function handleEntityNotFound(_0x37a497,_0xea0a7a){return function(_0x9bea44){if(!_0x9bea44){_0x37a497[_0xc91c('0x16')](0x194);}return _0x9bea44;};}function handleError(_0x446710,_0x22fcfe){_0x22fcfe=_0x22fcfe||0x1f4;return function(_0x936b56){logger['error'](_0x936b56[_0xc91c('0x27')]);if(_0x936b56[_0xc91c('0x28')]){delete _0x936b56[_0xc91c('0x28')];}_0x446710[_0xc91c('0x17')](_0x22fcfe)['send'](_0x936b56);};}exports['index']=function(_0xa39067,_0x52a0bd){var _0x14831f={},_0x28b828={},_0x451537={'count':0x0,'rows':[]};var _0x54cc4b=_['map'](db[_0xc91c('0x29')][_0xc91c('0x2a')],function(_0x29c5f8){return{'name':_0x29c5f8[_0xc91c('0x2b')],'type':_0x29c5f8[_0xc91c('0x2c')][_0xc91c('0x2d')]};});_0x28b828[_0xc91c('0x2e')]=_[_0xc91c('0x2f')](_0x54cc4b,_0xc91c('0x28'));_0x28b828[_0xc91c('0x30')]=_[_0xc91c('0x31')](_0xa39067['query']);_0x28b828[_0xc91c('0x32')]=_[_0xc91c('0x33')](_0x28b828[_0xc91c('0x2e')],_0x28b828[_0xc91c('0x30')]);_0x14831f[_0xc91c('0x34')]=_[_0xc91c('0x33')](_0x28b828['model'],qs['fields'](_0xa39067[_0xc91c('0x30')][_0xc91c('0x35')]));_0x14831f[_0xc91c('0x34')]=_0x14831f[_0xc91c('0x34')][_0xc91c('0x36')]?_0x14831f['attributes']:_0x28b828[_0xc91c('0x2e')];if(!_0xa39067[_0xc91c('0x30')]['hasOwnProperty'](_0xc91c('0x37'))){_0x14831f['limit']=qs[_0xc91c('0x1c')](_0xa39067[_0xc91c('0x30')]['limit']);_0x14831f['offset']=qs[_0xc91c('0x1a')](_0xa39067['query'][_0xc91c('0x1a')]);}_0x14831f[_0xc91c('0x38')]=qs[_0xc91c('0x39')](_0xa39067['query']['sort']);_0x14831f[_0xc91c('0x3a')]=qs['filters'](_[_0xc91c('0x3b')](_0xa39067['query'],_0x28b828[_0xc91c('0x32')]),_0x54cc4b);if(_0xa39067[_0xc91c('0x30')][_0xc91c('0x3c')]){_0x14831f[_0xc91c('0x3a')]=_[_0xc91c('0x3d')](_0x14831f[_0xc91c('0x3a')],{'$or':_[_0xc91c('0x2f')](_0x54cc4b,function(_0x284eef){if(_0x284eef[_0xc91c('0x2c')]!==_0xc91c('0x3e')){var _0x3f5d8d={};_0x3f5d8d[_0x284eef[_0xc91c('0x28')]]={'$like':'%'+_0xa39067['query'][_0xc91c('0x3c')]+'%'};return _0x3f5d8d;}})});}_0x14831f=_[_0xc91c('0x3d')]({},_0x14831f,_0xa39067[_0xc91c('0x3f')]);var _0x548ed0={'where':_0x14831f[_0xc91c('0x3a')]};return db[_0xc91c('0x29')][_0xc91c('0x1d')](_0x548ed0)[_0xc91c('0x23')](function(_0x53725c){_0x451537['count']=_0x53725c;if(_0xa39067['query'][_0xc91c('0x40')]){_0x14831f[_0xc91c('0x41')]=[{'all':!![]}];}return db[_0xc91c('0x29')][_0xc91c('0x42')](_0x14831f);})[_0xc91c('0x23')](function(_0x537e28){_0x451537[_0xc91c('0x43')]=_0x537e28;return _0x451537;})['then'](respondWithFilteredResult(_0x52a0bd,_0x14831f))[_0xc91c('0x44')](handleError(_0x52a0bd,null));};exports[_0xc91c('0x45')]=function(_0x3da658,_0x5b5160){var _0x491155={'raw':!![],'where':{'id':_0x3da658[_0xc91c('0x46')]['id']}},_0x1b6e62={};_0x1b6e62[_0xc91c('0x2e')]=_[_0xc91c('0x31')](db[_0xc91c('0x29')]['rawAttributes']);_0x1b6e62[_0xc91c('0x30')]=_['keys'](_0x3da658[_0xc91c('0x30')]);_0x1b6e62[_0xc91c('0x32')]=_[_0xc91c('0x33')](_0x1b6e62[_0xc91c('0x2e')],_0x1b6e62[_0xc91c('0x30')]);_0x491155[_0xc91c('0x34')]=_[_0xc91c('0x33')](_0x1b6e62[_0xc91c('0x2e')],qs[_0xc91c('0x35')](_0x3da658[_0xc91c('0x30')][_0xc91c('0x35')]));_0x491155['attributes']=_0x491155[_0xc91c('0x34')]['length']?_0x491155['attributes']:_0x1b6e62['model'];if(_0x3da658[_0xc91c('0x30')][_0xc91c('0x40')]){_0x491155[_0xc91c('0x41')]=[{'all':!![]}];}_0x491155=_[_0xc91c('0x3d')]({},_0x491155,_0x3da658[_0xc91c('0x3f')]);return db[_0xc91c('0x29')][_0xc91c('0x47')](_0x491155)['then'](handleEntityNotFound(_0x5b5160,null))[_0xc91c('0x23')](respondWithResult(_0x5b5160,null))[_0xc91c('0x44')](handleError(_0x5b5160,null));};exports['create']=function(_0x8f816f,_0xb27ff5){return db[_0xc91c('0x29')]['create'](_0x8f816f[_0xc91c('0x48')],{})['then'](function(_0x5e2e0b){var _0x59cf79=_0x8f816f[_0xc91c('0x49')][_0xc91c('0x4a')]({'plain':!![]});if(!_0x59cf79)throw new Error(_0xc91c('0x4b'));if(_0x59cf79['role']===_0xc91c('0x49')){var _0xba5e60=_0x5e2e0b['get']({'plain':!![]});var _0x22fe48=_0xc91c('0x25');return db[_0xc91c('0x4c')][_0xc91c('0x47')]({'where':{'name':_0x22fe48,'userProfileId':_0x59cf79[_0xc91c('0x4d')]},'raw':!![]})['then'](function(_0x36130d){if(_0x36130d&&_0x36130d[_0xc91c('0x4e')]===0x0){return db[_0xc91c('0x26')]['create']({'name':_0xba5e60[_0xc91c('0x28')],'resourceId':_0xba5e60['id'],'type':_0x36130d[_0xc91c('0x28')],'sectionId':_0x36130d['id']},{})['then'](function(){return _0x5e2e0b;});}else{return _0x5e2e0b;}})[_0xc91c('0x44')](function(_0x25b0c1){logger[_0xc91c('0x4f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x25b0c1);throw _0x25b0c1;});}return _0x5e2e0b;})['then'](respondWithResult(_0xb27ff5,0xc9))[_0xc91c('0x44')](handleError(_0xb27ff5,null));};exports[_0xc91c('0x22')]=function(_0x19d09f,_0x9f70e8){if(_0x19d09f['body']['id']){delete _0x19d09f[_0xc91c('0x48')]['id'];}return db[_0xc91c('0x29')][_0xc91c('0x47')]({'where':{'id':_0x19d09f['params']['id']}})['then'](handleEntityNotFound(_0x9f70e8,null))[_0xc91c('0x23')](saveUpdates(_0x19d09f[_0xc91c('0x48')],null))[_0xc91c('0x23')](respondWithResult(_0x9f70e8,null))[_0xc91c('0x44')](handleError(_0x9f70e8,null));};exports['destroy']=function(_0x4c0739,_0x441df5){return db['AnalyticExtractedReport']['find']({'where':{'id':_0x4c0739['params']['id']}})[_0xc91c('0x23')](handleEntityNotFound(_0x441df5,null))[_0xc91c('0x23')](removeEntity(_0x441df5,null))[_0xc91c('0x44')](handleError(_0x441df5,null));};exports[_0xc91c('0x50')]=function(_0xc08f24,_0x5dfe10,_0x1c7cd8){return db['AnalyticExtractedReport'][_0xc91c('0x47')]({'where':{'id':_0xc08f24[_0xc91c('0x46')]['id']},'attributes':[_0xc91c('0x28'),_0xc91c('0x51'),_0xc91c('0x52'),_0xc91c('0x53')],'raw':!![]})[_0xc91c('0x23')](handleEntityNotFound(_0x5dfe10,null))[_0xc91c('0x23')](function(_0x3b877c){if(_0x3b877c){if(!fs['existsSync'](path[_0xc91c('0x54')](config[_0xc91c('0x55')],_0xc91c('0x56'),_0x3b877c['savename']))){throw new db[(_0xc91c('0x57'))]['ValidationError']('Report\x20not\x20found\x20or\x20empty');}if(_0xc08f24[_0xc91c('0x30')][_0xc91c('0x58')]){return _0x5dfe10[_0xc91c('0x16')](0xc8);}return _0x5dfe10[_0xc91c('0x50')](path[_0xc91c('0x54')](config[_0xc91c('0x55')],'server/files/reports',_0x3b877c[_0xc91c('0x52')]),util[_0xc91c('0x59')](_0xc91c('0x5a'),_0x3b877c[_0xc91c('0x51')]||_0x3b877c[_0xc91c('0x28')],_0x3b877c[_0xc91c('0x53')][_0xc91c('0x5b')]()));}})[_0xc91c('0x44')](handleError(_0x5dfe10,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 4f43682..41ea37f 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 _0x164f=['path','rimraf','../../config/environment','define','analytics_extracted_reports','util','api','request-promise'];(function(_0x275099,_0x55dbea){var _0x14f25d=function(_0x1fb867){while(--_0x1fb867){_0x275099['push'](_0x275099['shift']());}};_0x14f25d(++_0x55dbea);}(_0x164f,0x85));var _0xf164=function(_0x2f5d9f,_0x52f77b){_0x2f5d9f=_0x2f5d9f-0x0;var _0x41fb32=_0x164f[_0x2f5d9f];return _0x41fb32;};'use strict';var _=require('lodash');var util=require(_0xf164('0x0'));var logger=require('../../config/logger')(_0xf164('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf164('0x2'));var fs=require('fs');var path=require(_0xf164('0x3'));var rimraf=require(_0xf164('0x4'));var config=require(_0xf164('0x5'));var attributes=require('./analyticExtractedReport.attributes');module['exports']=function(_0x565b04,_0x24d092){return _0x565b04[_0xf164('0x6')]('AnalyticExtractedReport',attributes,{'tableName':_0xf164('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeccc=['./analyticExtractedReport.attributes','exports','define','analytics_extracted_reports','../../config/logger','moment','bluebird','path','../../config/environment'];(function(_0x4f8edc,_0x1832e8){var _0x37aed5=function(_0x8b634d){while(--_0x8b634d){_0x4f8edc['push'](_0x4f8edc['shift']());}};_0x37aed5(++_0x1832e8);}(_0xeccc,0x94));var _0xcecc=function(_0x2acd64,_0x4e8ce8){_0x2acd64=_0x2acd64-0x0;var _0x3d3fce=_0xeccc[_0x2acd64];return _0x3d3fce;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xcecc('0x0'))('api');var moment=require(_0xcecc('0x1'));var BPromise=require(_0xcecc('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcecc('0x3'));var rimraf=require('rimraf');var config=require(_0xcecc('0x4'));var attributes=require(_0xcecc('0x5'));module[_0xcecc('0x6')]=function(_0xd6e58d,_0x41ef7f){return _0xd6e58d[_0xcecc('0x7')]('AnalyticExtractedReport',attributes,{'tableName':_0xcecc('0x8'),'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 6de49da..0760cec 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 _0x5248=['info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x2f1807,_0x15d983){var _0x424695=function(_0x2a4c5f){while(--_0x2a4c5f){_0x2f1807['push'](_0x2f1807['shift']());}};_0x424695(++_0x15d983);}(_0x5248,0x1a5));var _0x8524=function(_0x1c97d8,_0x1ef568){_0x1c97d8=_0x1c97d8-0x0;var _0x553eb1=_0x5248[_0x1c97d8];return _0x553eb1;};'use strict';var _=require('lodash');var util=require(_0x8524('0x0'));var moment=require('moment');var BPromise=require(_0x8524('0x1'));var rs=require(_0x8524('0x2'));var fs=require('fs');var Redis=require(_0x8524('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x8524('0x4'));var logger=require(_0x8524('0x5'))(_0x8524('0x6'));var config=require(_0x8524('0x7'));var jayson=require(_0x8524('0x8'));var client=jayson[_0x8524('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3dbb02,_0xa8b462,_0x36aeb8){return new BPromise(function(_0x108f2b,_0x1ef973){return client[_0x8524('0xa')](_0x3dbb02,_0x36aeb8)['then'](function(_0x3937d1){logger[_0x8524('0xb')](_0x8524('0xc'),_0xa8b462,_0x8524('0xd'));logger['debug']('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0xa8b462,_0x8524('0xd'),JSON[_0x8524('0xe')](_0x3937d1));if(_0x3937d1[_0x8524('0xf')]){if(_0x3937d1[_0x8524('0xf')]['code']===0x1f4){logger[_0x8524('0xf')](_0x8524('0xc'),_0xa8b462,_0x3937d1[_0x8524('0xf')]['message']);return _0x1ef973(_0x3937d1[_0x8524('0xf')]['message']);}logger[_0x8524('0xf')](_0x8524('0xc'),_0xa8b462,_0x3937d1[_0x8524('0xf')][_0x8524('0x10')]);return _0x108f2b(_0x3937d1[_0x8524('0xf')][_0x8524('0x10')]);}else{logger['info'](_0x8524('0xc'),_0xa8b462,_0x8524('0xd'));_0x108f2b(_0x3937d1[_0x8524('0x11')][_0x8524('0x10')]);}})['catch'](function(_0x2d4fbf){logger['error'](_0x8524('0xc'),_0xa8b462,_0x2d4fbf);_0x1ef973(_0x2d4fbf);});});} \ No newline at end of file +var _0xaffb=['request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xaffb,0xc3));var _0xbaff=function(_0x215e65,_0x183f97){_0x215e65=_0x215e65-0x0;var _0xa85842=_0xaffb[_0x215e65];return _0xa85842;};'use strict';var _=require(_0xbaff('0x0'));var util=require(_0xbaff('0x1'));var moment=require('moment');var BPromise=require(_0xbaff('0x2'));var rs=require(_0xbaff('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbaff('0x4'))['db'];var utils=require(_0xbaff('0x5'));var logger=require(_0xbaff('0x6'))(_0xbaff('0x7'));var config=require(_0xbaff('0x8'));var jayson=require(_0xbaff('0x9'));var client=jayson[_0xbaff('0xa')][_0xbaff('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x53dfcf,_0x99ecec,_0x3d46c1){return new BPromise(function(_0x396c83,_0x28bb05){return client[_0xbaff('0xc')](_0x53dfcf,_0x3d46c1)[_0xbaff('0xd')](function(_0x3b550c){logger[_0xbaff('0xe')](_0xbaff('0xf'),_0x99ecec,_0xbaff('0x10'));logger[_0xbaff('0x11')](_0xbaff('0x12'),_0x99ecec,_0xbaff('0x10'),JSON[_0xbaff('0x13')](_0x3b550c));if(_0x3b550c[_0xbaff('0x14')]){if(_0x3b550c['error']['code']===0x1f4){logger['error'](_0xbaff('0xf'),_0x99ecec,_0x3b550c['error'][_0xbaff('0x15')]);return _0x28bb05(_0x3b550c[_0xbaff('0x14')][_0xbaff('0x15')]);}logger[_0xbaff('0x14')](_0xbaff('0xf'),_0x99ecec,_0x3b550c['error'][_0xbaff('0x15')]);return _0x396c83(_0x3b550c[_0xbaff('0x14')][_0xbaff('0x15')]);}else{logger[_0xbaff('0xe')](_0xbaff('0xf'),_0x99ecec,_0xbaff('0x10'));_0x396c83(_0x3b550c[_0xbaff('0x16')][_0xbaff('0x15')]);}})['catch'](function(_0x276f59){logger[_0xbaff('0x14')](_0xbaff('0xf'),_0x99ecec,_0x276f59);_0x28bb05(_0x276f59);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index ce04a16..e7bd61d 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 _0xc007=['isAuthenticated','index','/:id/download','download','create','put','/:id','update','delete','destroy','exports','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticExtractedReport.controller','get'];(function(_0x424a9a,_0x2dd9af){var _0xa7831c=function(_0x512534){while(--_0x512534){_0x424a9a['push'](_0x424a9a['shift']());}};_0xa7831c(++_0x2dd9af);}(_0xc007,0xf5));var _0x7c00=function(_0x278a5f,_0x5ece9b){_0x278a5f=_0x278a5f-0x0;var _0xaa2f08=_0xc007[_0x278a5f];return _0xaa2f08;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7c00('0x0'));var router=express[_0x7c00('0x1')]();var fs_extra=require(_0x7c00('0x2'));var auth=require(_0x7c00('0x3'));var interaction=require(_0x7c00('0x4'));var config=require('../../config/environment');var controller=require(_0x7c00('0x5'));router[_0x7c00('0x6')]('/',auth[_0x7c00('0x7')](),controller[_0x7c00('0x8')]);router[_0x7c00('0x6')]('/:id',auth[_0x7c00('0x7')](),controller['show']);router['get'](_0x7c00('0x9'),auth[_0x7c00('0x7')](),controller[_0x7c00('0xa')]);router['post']('/',auth[_0x7c00('0x7')](),controller[_0x7c00('0xb')]);router[_0x7c00('0xc')](_0x7c00('0xd'),auth[_0x7c00('0x7')](),controller[_0x7c00('0xe')]);router[_0x7c00('0xf')](_0x7c00('0xd'),auth['isAuthenticated'](),controller[_0x7c00('0x10')]);module[_0x7c00('0x11')]=router; \ No newline at end of file +var _0x7338=['show','/:id/download','download','post','update','delete','util','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','index','/:id'];(function(_0x3f492f,_0x422bec){var _0xcb377c=function(_0x20ddbe){while(--_0x20ddbe){_0x3f492f['push'](_0x3f492f['shift']());}};_0xcb377c(++_0x422bec);}(_0x7338,0x149));var _0x8733=function(_0x26462c,_0xd20a35){_0x26462c=_0x26462c-0x0;var _0x509a42=_0x7338[_0x26462c];return _0x509a42;};'use strict';var multer=require('multer');var util=require(_0x8733('0x0'));var path=require(_0x8733('0x1'));var timeout=require(_0x8733('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x8733('0x3'));var auth=require(_0x8733('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x8733('0x5'));var controller=require(_0x8733('0x6'));router[_0x8733('0x7')]('/',auth[_0x8733('0x8')](),controller[_0x8733('0x9')]);router[_0x8733('0x7')](_0x8733('0xa'),auth[_0x8733('0x8')](),controller[_0x8733('0xb')]);router['get'](_0x8733('0xc'),auth[_0x8733('0x8')](),controller[_0x8733('0xd')]);router[_0x8733('0xe')]('/',auth[_0x8733('0x8')](),controller['create']);router['put'](_0x8733('0xa'),auth['isAuthenticated'](),controller[_0x8733('0xf')]);router[_0x8733('0x10')](_0x8733('0xa'),auth[_0x8733('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 058b5e1..3cccd24 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 _0x2383=['sequelize','exports','TEXT','STRING','BOOLEAN'];(function(_0x28bcea,_0x11a683){var _0x2a6025=function(_0x299e16){while(--_0x299e16){_0x28bcea['push'](_0x28bcea['shift']());}};_0x2a6025(++_0x11a683);}(_0x2383,0x1ea));var _0x3238=function(_0x3030c8,_0x4c12d4){_0x3030c8=_0x3030c8-0x0;var _0x35c4da=_0x2383[_0x3030c8];return _0x35c4da;};'use strict';var Sequelize=require(_0x3238('0x0'));module[_0x3238('0x1')]={'field':{'type':Sequelize[_0x3238('0x2')]},'alias':{'type':Sequelize[_0x3238('0x3')]},'function':{'type':Sequelize[_0x3238('0x3')]},'format':{'type':Sequelize['STRING']},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x3238('0x3')]},'custom':{'type':Sequelize[_0x3238('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x4e93=['STRING','BOOLEAN'];(function(_0x37d1e1,_0x3ea09f){var _0xe5daae=function(_0x470bac){while(--_0x470bac){_0x37d1e1['push'](_0x37d1e1['shift']());}};_0xe5daae(++_0x3ea09f);}(_0x4e93,0x19c));var _0x34e9=function(_0x5c9f8a,_0x1561ea){_0x5c9f8a=_0x5c9f8a-0x0;var _0x2bdb45=_0x4e93[_0x5c9f8a];return _0x2bdb45;};'use strict';var Sequelize=require('sequelize');module['exports']={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize[_0x34e9('0x0')]},'function':{'type':Sequelize[_0x34e9('0x0')]},'format':{'type':Sequelize[_0x34e9('0x0')]},'groupBy':{'type':Sequelize[_0x34e9('0x1')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x34e9('0x0')]},'custom':{'type':Sequelize[_0x34e9('0x1')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index df33568..bfea0e6 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 _0x7d28=['bulkCreate','body','destroy','bulkDestroy','ids','addFields','findOne','sequelize','transaction','CustomReportId','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','set','Content-Range','json','apply','save','update','error','stack','name','send','index','AnalyticFieldReport','rawAttributes','fieldName','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','type','VIRTUAL','options','count','then','findAll','rows','show','params','includeAll','include','merge','find','catch','create'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x7d28,0x112));var _0x87d2=function(_0x102e45,_0x149fe5){_0x102e45=_0x102e45-0x0;var _0x56bb42=_0x7d28[_0x102e45];return _0x56bb42;};'use strict';var emlformat=require(_0x87d2('0x0'));var rimraf=require(_0x87d2('0x1'));var zipdir=require(_0x87d2('0x2'));var jsonpatch=require(_0x87d2('0x3'));var rp=require(_0x87d2('0x4'));var moment=require(_0x87d2('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x87d2('0x6'));var util=require('util');var path=require('path');var sox=require(_0x87d2('0x7'));var csv=require('to-csv');var ejs=require(_0x87d2('0x8'));var fs=require('fs');var fs_extra=require(_0x87d2('0x9'));var _=require(_0x87d2('0xa'));var squel=require(_0x87d2('0xb'));var crypto=require(_0x87d2('0xc'));var jsforce=require(_0x87d2('0xd'));var deskjs=require(_0x87d2('0xe'));var toCsv=require(_0x87d2('0xf'));var querystring=require(_0x87d2('0x10'));var Papa=require('papaparse');var Redis=require(_0x87d2('0x11'));var authService=require(_0x87d2('0x12'));var qs=require(_0x87d2('0x13'));var as=require(_0x87d2('0x14'));var hardwareService=require(_0x87d2('0x15'));var logger=require(_0x87d2('0x16'))(_0x87d2('0x17'));var utils=require(_0x87d2('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x87d2('0x19'));var db=require(_0x87d2('0x1a'))['db'];function respondWithStatusCode(_0x45a73a,_0x453988){_0x453988=_0x453988||0xcc;return function(_0x2a9387){if(_0x2a9387){return _0x45a73a[_0x87d2('0x1b')](_0x453988);}return _0x45a73a[_0x87d2('0x1c')](_0x453988)[_0x87d2('0x1d')]();};}function respondWithResult(_0x527090,_0x1cb94f){_0x1cb94f=_0x1cb94f||0xc8;return function(_0x2ba3c4){if(_0x2ba3c4){return _0x527090[_0x87d2('0x1c')](_0x1cb94f)['json'](_0x2ba3c4);}};}function respondWithFilteredResult(_0x3d203a,_0x4bb56e){return function(_0x3ee74a){if(_0x3ee74a){var _0x5bc682=typeof _0x4bb56e[_0x87d2('0x1e')]===_0x87d2('0x1f')&&typeof _0x4bb56e['limit']===_0x87d2('0x1f');var _0x27569d=_0x3ee74a['count'];var _0x477ea2=_0x5bc682?0x0:_0x4bb56e[_0x87d2('0x1e')];var _0x2ee899=_0x5bc682?_0x3ee74a['count']:_0x4bb56e['offset']+_0x4bb56e[_0x87d2('0x20')];var _0x263159;if(_0x2ee899>=_0x27569d){_0x2ee899=_0x27569d;_0x263159=0xc8;}else{_0x263159=0xce;}_0x3d203a[_0x87d2('0x1c')](_0x263159);return _0x3d203a[_0x87d2('0x21')](_0x87d2('0x22'),_0x477ea2+'-'+_0x2ee899+'/'+_0x27569d)[_0x87d2('0x23')](_0x3ee74a);}return null;};}function patchUpdates(_0x3031a6){return function(_0x207c95){try{jsonpatch[_0x87d2('0x24')](_0x207c95,_0x3031a6,!![]);}catch(_0x4ec8f6){return BPromise['reject'](_0x4ec8f6);}return _0x207c95[_0x87d2('0x25')]();};}function saveUpdates(_0x5683ba,_0x296c56){return function(_0x53bb94){if(_0x53bb94){return _0x53bb94[_0x87d2('0x26')](_0x5683ba)['then'](function(_0x2198e2){return _0x2198e2;});}return null;};}function removeEntity(_0x13524c,_0x2e1842){return function(_0x4c2816){if(_0x4c2816){return _0x4c2816['destroy']()['then'](function(){_0x13524c['status'](0xcc)[_0x87d2('0x1d')]();});}};}function handleEntityNotFound(_0x25c18f,_0xff83c0){return function(_0x433933){if(!_0x433933){_0x25c18f[_0x87d2('0x1b')](0x194);}return _0x433933;};}function handleError(_0x2fd268,_0x23e95d){_0x23e95d=_0x23e95d||0x1f4;return function(_0x38da34){logger[_0x87d2('0x27')](_0x38da34[_0x87d2('0x28')]);if(_0x38da34['name']){delete _0x38da34[_0x87d2('0x29')];}_0x2fd268[_0x87d2('0x1c')](_0x23e95d)[_0x87d2('0x2a')](_0x38da34);};}exports[_0x87d2('0x2b')]=function(_0x3ced2a,_0x92d513){var _0x539cc0={},_0x49193c={},_0x15ec76={'count':0x0,'rows':[]};var _0x3f8e6e=_['map'](db[_0x87d2('0x2c')][_0x87d2('0x2d')],function(_0x1c4b67){return{'name':_0x1c4b67[_0x87d2('0x2e')],'type':_0x1c4b67['type']['key']};});_0x49193c[_0x87d2('0x2f')]=_[_0x87d2('0x30')](_0x3f8e6e,'name');_0x49193c[_0x87d2('0x31')]=_[_0x87d2('0x32')](_0x3ced2a[_0x87d2('0x31')]);_0x49193c[_0x87d2('0x33')]=_['intersection'](_0x49193c[_0x87d2('0x2f')],_0x49193c[_0x87d2('0x31')]);_0x539cc0[_0x87d2('0x34')]=_[_0x87d2('0x35')](_0x49193c[_0x87d2('0x2f')],qs[_0x87d2('0x36')](_0x3ced2a[_0x87d2('0x31')]['fields']));_0x539cc0[_0x87d2('0x34')]=_0x539cc0[_0x87d2('0x34')][_0x87d2('0x37')]?_0x539cc0['attributes']:_0x49193c[_0x87d2('0x2f')];if(!_0x3ced2a[_0x87d2('0x31')][_0x87d2('0x38')](_0x87d2('0x39'))){_0x539cc0[_0x87d2('0x20')]=qs[_0x87d2('0x20')](_0x3ced2a['query'][_0x87d2('0x20')]);_0x539cc0[_0x87d2('0x1e')]=qs[_0x87d2('0x1e')](_0x3ced2a[_0x87d2('0x31')]['offset']);}_0x539cc0[_0x87d2('0x3a')]=qs[_0x87d2('0x3b')](_0x3ced2a['query'][_0x87d2('0x3b')]);_0x539cc0['where']=qs[_0x87d2('0x33')](_[_0x87d2('0x3c')](_0x3ced2a[_0x87d2('0x31')],_0x49193c[_0x87d2('0x33')]),_0x3f8e6e);if(_0x3ced2a[_0x87d2('0x31')][_0x87d2('0x3d')]){_0x539cc0[_0x87d2('0x3e')]=_['merge'](_0x539cc0[_0x87d2('0x3e')],{'$or':_[_0x87d2('0x30')](_0x3f8e6e,function(_0x29d569){if(_0x29d569[_0x87d2('0x3f')]!==_0x87d2('0x40')){var _0x77f140={};_0x77f140[_0x29d569[_0x87d2('0x29')]]={'$like':'%'+_0x3ced2a[_0x87d2('0x31')]['filter']+'%'};return _0x77f140;}})});}_0x539cc0=_['merge']({},_0x539cc0,_0x3ced2a[_0x87d2('0x41')]);var _0x3fa6c8={'where':_0x539cc0['where']};return db[_0x87d2('0x2c')][_0x87d2('0x42')](_0x3fa6c8)[_0x87d2('0x43')](function(_0x10460b){_0x15ec76['count']=_0x10460b;if(_0x3ced2a[_0x87d2('0x31')]['includeAll']){_0x539cc0['include']=[{'all':!![]}];}return db[_0x87d2('0x2c')][_0x87d2('0x44')](_0x539cc0);})['then'](function(_0x3434ac){_0x15ec76[_0x87d2('0x45')]=_0x3434ac;return _0x15ec76;})[_0x87d2('0x43')](respondWithFilteredResult(_0x92d513,_0x539cc0))['catch'](handleError(_0x92d513,null));};exports[_0x87d2('0x46')]=function(_0x51f6bb,_0x1c40c4){var _0x426d30={'raw':![],'where':{'id':_0x51f6bb[_0x87d2('0x47')]['id']}},_0x12bcdd={};_0x12bcdd[_0x87d2('0x2f')]=_['keys'](db['AnalyticFieldReport']['rawAttributes']);_0x12bcdd[_0x87d2('0x31')]=_[_0x87d2('0x32')](_0x51f6bb[_0x87d2('0x31')]);_0x12bcdd[_0x87d2('0x33')]=_['intersection'](_0x12bcdd['model'],_0x12bcdd[_0x87d2('0x31')]);_0x426d30['attributes']=_[_0x87d2('0x35')](_0x12bcdd['model'],qs[_0x87d2('0x36')](_0x51f6bb[_0x87d2('0x31')]['fields']));_0x426d30['attributes']=_0x426d30[_0x87d2('0x34')][_0x87d2('0x37')]?_0x426d30[_0x87d2('0x34')]:_0x12bcdd[_0x87d2('0x2f')];if(_0x51f6bb[_0x87d2('0x31')][_0x87d2('0x48')]){_0x426d30[_0x87d2('0x49')]=[{'all':!![]}];}_0x426d30=_[_0x87d2('0x4a')]({},_0x426d30,_0x51f6bb[_0x87d2('0x41')]);return db[_0x87d2('0x2c')][_0x87d2('0x4b')](_0x426d30)[_0x87d2('0x43')](handleEntityNotFound(_0x1c40c4,null))[_0x87d2('0x43')](respondWithResult(_0x1c40c4,null))[_0x87d2('0x4c')](handleError(_0x1c40c4,null));};exports[_0x87d2('0x4d')]=function(_0x585e86,_0x2af80d){return db['AnalyticFieldReport'][_0x87d2('0x4d')](_0x585e86['body'],{})[_0x87d2('0x43')](respondWithResult(_0x2af80d,0xc9))[_0x87d2('0x4c')](handleError(_0x2af80d,null));};exports[_0x87d2('0x4e')]=function(_0x1928df,_0x5a9df8){return db[_0x87d2('0x2c')][_0x87d2('0x4e')](_0x1928df[_0x87d2('0x4f')],{'raw':![],'individualHooks':!![]})[_0x87d2('0x43')](respondWithResult(_0x5a9df8,0xc9))['catch'](handleError(_0x5a9df8,null));};exports[_0x87d2('0x26')]=function(_0x14e4c0,_0x7f9ee0){if(_0x14e4c0['body']['id']){delete _0x14e4c0[_0x87d2('0x4f')]['id'];}return db[_0x87d2('0x2c')]['find']({'where':{'id':_0x14e4c0[_0x87d2('0x47')]['id']}})['then'](handleEntityNotFound(_0x7f9ee0,null))['then'](saveUpdates(_0x14e4c0[_0x87d2('0x4f')],null))[_0x87d2('0x43')](respondWithResult(_0x7f9ee0,null))[_0x87d2('0x4c')](handleError(_0x7f9ee0,null));};exports[_0x87d2('0x50')]=function(_0x4a9ec5,_0x106551){return db[_0x87d2('0x2c')]['find']({'where':{'id':_0x4a9ec5[_0x87d2('0x47')]['id']}})[_0x87d2('0x43')](handleEntityNotFound(_0x106551,null))['then'](removeEntity(_0x106551,null))[_0x87d2('0x4c')](handleError(_0x106551,null));};exports[_0x87d2('0x51')]=function(_0x2921ca,_0x2ec277){return db['AnalyticFieldReport']['destroy']({'where':{'id':_0x2921ca['query'][_0x87d2('0x52')]||[]},'raw':![],'individualHooks':!![]})[_0x87d2('0x43')](respondWithResult(_0x2ec277,0xcc))[_0x87d2('0x4c')](handleError(_0x2ec277,null));};exports[_0x87d2('0x53')]=function(_0xb9aed5,_0x18b6bb,_0x265190){return db['AnalyticCustomReport'][_0x87d2('0x54')]({'where':{'id':_0xb9aed5[_0x87d2('0x47')]['id']}})[_0x87d2('0x43')](handleEntityNotFound(_0x18b6bb,null))[_0x87d2('0x43')](function(_0x4ae584){if(_0x4ae584){return db[_0x87d2('0x55')][_0x87d2('0x56')](function(_0xb1c426){return db[_0x87d2('0x2c')]['destroy']({'where':{'CustomReportId':_0xb9aed5[_0x87d2('0x47')]['id']},'transaction':_0xb1c426})['then'](function(_0x3fc5b0){var _0x47e13b=_['map'](_0xb9aed5[_0x87d2('0x4f')],function(_0x259c34){delete _0x259c34['id'];_0x259c34[_0x87d2('0x57')]=_0xb9aed5[_0x87d2('0x47')]['id'];return _0x259c34;});return db['AnalyticFieldReport']['bulkCreate'](_0x47e13b,{'transaction':_0xb1c426});});})[_0x87d2('0x43')](function(){return db[_0x87d2('0x2c')][_0x87d2('0x44')]({'where':{'CustomReportId':_0xb9aed5['params']['id']}});});}})['then'](respondWithResult(_0x18b6bb,null))[_0x87d2('0x4c')](handleError(_0x18b6bb,null));}; \ No newline at end of file +var _0x7472=['type','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','length','include','find','create','body','bulkCreate','bulkDestroy','ids','addFields','AnalyticCustomReport','sequelize','CustomReportId','eml-format','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','update','then','destroy','error','stack','index','map','AnalyticFieldReport','rawAttributes','key','model','name','query','keys','filters','intersection','attributes','fields','nolimit','sort','where','filter','merge'];(function(_0x2beb6f,_0x545855){var _0x1b0e3c=function(_0x4a04bc){while(--_0x4a04bc){_0x2beb6f['push'](_0x2beb6f['shift']());}};_0x1b0e3c(++_0x545855);}(_0x7472,0xb3));var _0x2747=function(_0x21b762,_0xc8ef11){_0x21b762=_0x21b762-0x0;var _0x2ea6d4=_0x7472[_0x21b762];return _0x2ea6d4;};'use strict';var emlformat=require(_0x2747('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2747('0x1'));var rp=require('request-promise');var moment=require(_0x2747('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x2747('0x3'));var util=require(_0x2747('0x4'));var path=require('path');var sox=require(_0x2747('0x5'));var csv=require(_0x2747('0x6'));var ejs=require(_0x2747('0x7'));var fs=require('fs');var fs_extra=require(_0x2747('0x8'));var _=require(_0x2747('0x9'));var squel=require(_0x2747('0xa'));var crypto=require(_0x2747('0xb'));var jsforce=require(_0x2747('0xc'));var deskjs=require(_0x2747('0xd'));var toCsv=require(_0x2747('0x6'));var querystring=require(_0x2747('0xe'));var Papa=require(_0x2747('0xf'));var Redis=require('ioredis');var authService=require(_0x2747('0x10'));var qs=require(_0x2747('0x11'));var as=require(_0x2747('0x12'));var hardwareService=require(_0x2747('0x13'));var logger=require(_0x2747('0x14'))(_0x2747('0x15'));var utils=require(_0x2747('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x2747('0x17'));var db=require(_0x2747('0x18'))['db'];function respondWithStatusCode(_0x35e2cc,_0x18be54){_0x18be54=_0x18be54||0xcc;return function(_0x2f96ab){if(_0x2f96ab){return _0x35e2cc[_0x2747('0x19')](_0x18be54);}return _0x35e2cc['status'](_0x18be54)[_0x2747('0x1a')]();};}function respondWithResult(_0x2aa79f,_0x5e5c69){_0x5e5c69=_0x5e5c69||0xc8;return function(_0x18feae){if(_0x18feae){return _0x2aa79f[_0x2747('0x1b')](_0x5e5c69)[_0x2747('0x1c')](_0x18feae);}};}function respondWithFilteredResult(_0x39d379,_0x53e443){return function(_0xb965f5){if(_0xb965f5){var _0x3b7285=typeof _0x53e443[_0x2747('0x1d')]===_0x2747('0x1e')&&typeof _0x53e443[_0x2747('0x1f')]===_0x2747('0x1e');var _0x2eca25=_0xb965f5[_0x2747('0x20')];var _0x35beff=_0x3b7285?0x0:_0x53e443[_0x2747('0x1d')];var _0x118ba3=_0x3b7285?_0xb965f5[_0x2747('0x20')]:_0x53e443['offset']+_0x53e443[_0x2747('0x1f')];var _0x3cc56e;if(_0x118ba3>=_0x2eca25){_0x118ba3=_0x2eca25;_0x3cc56e=0xc8;}else{_0x3cc56e=0xce;}_0x39d379[_0x2747('0x1b')](_0x3cc56e);return _0x39d379['set'](_0x2747('0x21'),_0x35beff+'-'+_0x118ba3+'/'+_0x2eca25)['json'](_0xb965f5);}return null;};}function patchUpdates(_0x3ab298){return function(_0xc708b4){try{jsonpatch[_0x2747('0x22')](_0xc708b4,_0x3ab298,!![]);}catch(_0x31e135){return BPromise['reject'](_0x31e135);}return _0xc708b4['save']();};}function saveUpdates(_0x39a57d,_0x138fa8){return function(_0x4de716){if(_0x4de716){return _0x4de716[_0x2747('0x23')](_0x39a57d)[_0x2747('0x24')](function(_0x4944a8){return _0x4944a8;});}return null;};}function removeEntity(_0x186f15,_0x8a02a8){return function(_0x359457){if(_0x359457){return _0x359457[_0x2747('0x25')]()[_0x2747('0x24')](function(){_0x186f15[_0x2747('0x1b')](0xcc)[_0x2747('0x1a')]();});}};}function handleEntityNotFound(_0x160899,_0x30ddfb){return function(_0x207bb2){if(!_0x207bb2){_0x160899['sendStatus'](0x194);}return _0x207bb2;};}function handleError(_0x60f2ba,_0x227812){_0x227812=_0x227812||0x1f4;return function(_0x3f9d3f){logger[_0x2747('0x26')](_0x3f9d3f[_0x2747('0x27')]);if(_0x3f9d3f['name']){delete _0x3f9d3f['name'];}_0x60f2ba[_0x2747('0x1b')](_0x227812)['send'](_0x3f9d3f);};}exports[_0x2747('0x28')]=function(_0xce886f,_0x5c1563){var _0x1d45c3={},_0x13525b={},_0x2365bd={'count':0x0,'rows':[]};var _0x50be9f=_[_0x2747('0x29')](db[_0x2747('0x2a')][_0x2747('0x2b')],function(_0x3313b1){return{'name':_0x3313b1['fieldName'],'type':_0x3313b1['type'][_0x2747('0x2c')]};});_0x13525b[_0x2747('0x2d')]=_['map'](_0x50be9f,_0x2747('0x2e'));_0x13525b[_0x2747('0x2f')]=_[_0x2747('0x30')](_0xce886f['query']);_0x13525b[_0x2747('0x31')]=_[_0x2747('0x32')](_0x13525b['model'],_0x13525b['query']);_0x1d45c3[_0x2747('0x33')]=_[_0x2747('0x32')](_0x13525b[_0x2747('0x2d')],qs[_0x2747('0x34')](_0xce886f[_0x2747('0x2f')][_0x2747('0x34')]));_0x1d45c3[_0x2747('0x33')]=_0x1d45c3[_0x2747('0x33')]['length']?_0x1d45c3[_0x2747('0x33')]:_0x13525b[_0x2747('0x2d')];if(!_0xce886f[_0x2747('0x2f')]['hasOwnProperty'](_0x2747('0x35'))){_0x1d45c3[_0x2747('0x1f')]=qs[_0x2747('0x1f')](_0xce886f[_0x2747('0x2f')][_0x2747('0x1f')]);_0x1d45c3[_0x2747('0x1d')]=qs['offset'](_0xce886f['query']['offset']);}_0x1d45c3['order']=qs[_0x2747('0x36')](_0xce886f[_0x2747('0x2f')][_0x2747('0x36')]);_0x1d45c3[_0x2747('0x37')]=qs[_0x2747('0x31')](_['pick'](_0xce886f[_0x2747('0x2f')],_0x13525b[_0x2747('0x31')]),_0x50be9f);if(_0xce886f['query'][_0x2747('0x38')]){_0x1d45c3['where']=_[_0x2747('0x39')](_0x1d45c3[_0x2747('0x37')],{'$or':_[_0x2747('0x29')](_0x50be9f,function(_0x4c422b){if(_0x4c422b[_0x2747('0x3a')]!==_0x2747('0x3b')){var _0x265201={};_0x265201[_0x4c422b[_0x2747('0x2e')]]={'$like':'%'+_0xce886f['query'][_0x2747('0x38')]+'%'};return _0x265201;}})});}_0x1d45c3=_[_0x2747('0x39')]({},_0x1d45c3,_0xce886f[_0x2747('0x3c')]);var _0x487d5e={'where':_0x1d45c3[_0x2747('0x37')]};return db[_0x2747('0x2a')][_0x2747('0x20')](_0x487d5e)['then'](function(_0x2ffc76){_0x2365bd[_0x2747('0x20')]=_0x2ffc76;if(_0xce886f[_0x2747('0x2f')][_0x2747('0x3d')]){_0x1d45c3['include']=[{'all':!![]}];}return db[_0x2747('0x2a')][_0x2747('0x3e')](_0x1d45c3);})[_0x2747('0x24')](function(_0x23cf33){_0x2365bd[_0x2747('0x3f')]=_0x23cf33;return _0x2365bd;})['then'](respondWithFilteredResult(_0x5c1563,_0x1d45c3))[_0x2747('0x40')](handleError(_0x5c1563,null));};exports[_0x2747('0x41')]=function(_0x1b3173,_0xe4575a){var _0x5e4428={'raw':![],'where':{'id':_0x1b3173[_0x2747('0x42')]['id']}},_0x469c68={};_0x469c68['model']=_[_0x2747('0x30')](db[_0x2747('0x2a')]['rawAttributes']);_0x469c68[_0x2747('0x2f')]=_[_0x2747('0x30')](_0x1b3173['query']);_0x469c68[_0x2747('0x31')]=_[_0x2747('0x32')](_0x469c68['model'],_0x469c68[_0x2747('0x2f')]);_0x5e4428[_0x2747('0x33')]=_[_0x2747('0x32')](_0x469c68[_0x2747('0x2d')],qs[_0x2747('0x34')](_0x1b3173[_0x2747('0x2f')][_0x2747('0x34')]));_0x5e4428[_0x2747('0x33')]=_0x5e4428[_0x2747('0x33')][_0x2747('0x43')]?_0x5e4428[_0x2747('0x33')]:_0x469c68[_0x2747('0x2d')];if(_0x1b3173['query'][_0x2747('0x3d')]){_0x5e4428[_0x2747('0x44')]=[{'all':!![]}];}_0x5e4428=_[_0x2747('0x39')]({},_0x5e4428,_0x1b3173[_0x2747('0x3c')]);return db[_0x2747('0x2a')][_0x2747('0x45')](_0x5e4428)[_0x2747('0x24')](handleEntityNotFound(_0xe4575a,null))[_0x2747('0x24')](respondWithResult(_0xe4575a,null))[_0x2747('0x40')](handleError(_0xe4575a,null));};exports['create']=function(_0x977f03,_0x4fa552){return db[_0x2747('0x2a')][_0x2747('0x46')](_0x977f03[_0x2747('0x47')],{})[_0x2747('0x24')](respondWithResult(_0x4fa552,0xc9))[_0x2747('0x40')](handleError(_0x4fa552,null));};exports[_0x2747('0x48')]=function(_0x5b597b,_0x19a88e){return db['AnalyticFieldReport'][_0x2747('0x48')](_0x5b597b[_0x2747('0x47')],{'raw':![],'individualHooks':!![]})[_0x2747('0x24')](respondWithResult(_0x19a88e,0xc9))[_0x2747('0x40')](handleError(_0x19a88e,null));};exports['update']=function(_0x56743b,_0x313883){if(_0x56743b[_0x2747('0x47')]['id']){delete _0x56743b[_0x2747('0x47')]['id'];}return db[_0x2747('0x2a')][_0x2747('0x45')]({'where':{'id':_0x56743b[_0x2747('0x42')]['id']}})[_0x2747('0x24')](handleEntityNotFound(_0x313883,null))[_0x2747('0x24')](saveUpdates(_0x56743b['body'],null))[_0x2747('0x24')](respondWithResult(_0x313883,null))[_0x2747('0x40')](handleError(_0x313883,null));};exports[_0x2747('0x25')]=function(_0x406e27,_0x44ca35){return db['AnalyticFieldReport']['find']({'where':{'id':_0x406e27[_0x2747('0x42')]['id']}})[_0x2747('0x24')](handleEntityNotFound(_0x44ca35,null))[_0x2747('0x24')](removeEntity(_0x44ca35,null))[_0x2747('0x40')](handleError(_0x44ca35,null));};exports[_0x2747('0x49')]=function(_0x41b4c9,_0x3b1e59){return db['AnalyticFieldReport']['destroy']({'where':{'id':_0x41b4c9[_0x2747('0x2f')][_0x2747('0x4a')]||[]},'raw':![],'individualHooks':!![]})[_0x2747('0x24')](respondWithResult(_0x3b1e59,0xcc))[_0x2747('0x40')](handleError(_0x3b1e59,null));};exports[_0x2747('0x4b')]=function(_0x22f71e,_0x65a89b,_0xa978db){return db[_0x2747('0x4c')]['findOne']({'where':{'id':_0x22f71e['params']['id']}})['then'](handleEntityNotFound(_0x65a89b,null))['then'](function(_0x518d0b){if(_0x518d0b){return db[_0x2747('0x4d')]['transaction'](function(_0x50a053){return db[_0x2747('0x2a')][_0x2747('0x25')]({'where':{'CustomReportId':_0x22f71e['params']['id']},'transaction':_0x50a053})['then'](function(_0x24d1e8){var _0x3a88f1=_['map'](_0x22f71e[_0x2747('0x47')],function(_0x78c01b){delete _0x78c01b['id'];_0x78c01b[_0x2747('0x4e')]=_0x22f71e[_0x2747('0x42')]['id'];return _0x78c01b;});return db[_0x2747('0x2a')][_0x2747('0x48')](_0x3a88f1,{'transaction':_0x50a053});});})[_0x2747('0x24')](function(){return db[_0x2747('0x2a')][_0x2747('0x3e')]({'where':{'CustomReportId':_0x22f71e[_0x2747('0x42')]['id']}});});}})['then'](respondWithResult(_0x65a89b,null))[_0x2747('0x40')](handleError(_0x65a89b,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 9aeca2e..d8528d2 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 _0xb643=['analytics_report_fields','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticFieldReport.attributes','AnalyticFieldReport'];(function(_0x5322e6,_0x18725d){var _0x3b55a1=function(_0xff01f0){while(--_0xff01f0){_0x5322e6['push'](_0x5322e6['shift']());}};_0x3b55a1(++_0x18725d);}(_0xb643,0x145));var _0x3b64=function(_0x1a0c87,_0x270cc4){_0x1a0c87=_0x1a0c87-0x0;var _0x222ff5=_0xb643[_0x1a0c87];return _0x222ff5;};'use strict';var _=require(_0x3b64('0x0'));var util=require(_0x3b64('0x1'));var logger=require('../../config/logger')(_0x3b64('0x2'));var moment=require(_0x3b64('0x3'));var BPromise=require(_0x3b64('0x4'));var rp=require(_0x3b64('0x5'));var fs=require('fs');var path=require(_0x3b64('0x6'));var rimraf=require(_0x3b64('0x7'));var config=require(_0x3b64('0x8'));var attributes=require(_0x3b64('0x9'));module['exports']=function(_0x4c4ba1,_0x309019){return _0x4c4ba1['define'](_0x3b64('0xa'),attributes,{'tableName':_0x3b64('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc2b2=['request-promise','rimraf','../../config/environment','exports','define','analytics_report_fields','util','../../config/logger','api','bluebird'];(function(_0x2d59aa,_0x1b6975){var _0x2df4a9=function(_0x17db34){while(--_0x17db34){_0x2d59aa['push'](_0x2d59aa['shift']());}};_0x2df4a9(++_0x1b6975);}(_0xc2b2,0x196));var _0x2c2b=function(_0x18e655,_0x5a0036){_0x18e655=_0x18e655-0x0;var _0x23eeed=_0xc2b2[_0x18e655];return _0x23eeed;};'use strict';var _=require('lodash');var util=require(_0x2c2b('0x0'));var logger=require(_0x2c2b('0x1'))(_0x2c2b('0x2'));var moment=require('moment');var BPromise=require(_0x2c2b('0x3'));var rp=require(_0x2c2b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2c2b('0x5'));var config=require(_0x2c2b('0x6'));var attributes=require('./analyticFieldReport.attributes');module[_0x2c2b('0x7')]=function(_0x5ed172,_0x136e73){return _0x5ed172[_0x2c2b('0x8')]('AnalyticFieldReport',attributes,{'tableName':_0x2c2b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.rpc.js b/server/api/analyticFieldReport/analyticFieldReport.rpc.js index 3808c04..2797fda 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 _0xdcff=['message','AnalyticFieldReport,\x20%s,\x20%s','info','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','client','http','request','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0xfbe72b,_0x284351){var _0xe38d9d=function(_0x5199ee){while(--_0x5199ee){_0xfbe72b['push'](_0xfbe72b['shift']());}};_0xe38d9d(++_0x284351);}(_0xdcff,0x168));var _0xfdcf=function(_0x13d1df,_0x25258d){_0x13d1df=_0x13d1df-0x0;var _0x72a648=_0xdcff[_0x13d1df];return _0x72a648;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xfdcf('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfdcf('0x1'));var db=require(_0xfdcf('0x2'))['db'];var utils=require(_0xfdcf('0x3'));var logger=require('../../config/logger')(_0xfdcf('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xfdcf('0x5')][_0xfdcf('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x1257c7,_0x26f33e,_0x61cac1){return new BPromise(function(_0x4ce564,_0x43710a){return client[_0xfdcf('0x7')](_0x1257c7,_0x61cac1)['then'](function(_0x34224d){logger['info']('AnalyticFieldReport,\x20%s,\x20%s',_0x26f33e,_0xfdcf('0x8'));logger[_0xfdcf('0x9')](_0xfdcf('0xa'),_0x26f33e,_0xfdcf('0x8'),JSON[_0xfdcf('0xb')](_0x34224d));if(_0x34224d[_0xfdcf('0xc')]){if(_0x34224d['error'][_0xfdcf('0xd')]===0x1f4){logger['error']('AnalyticFieldReport,\x20%s,\x20%s',_0x26f33e,_0x34224d[_0xfdcf('0xc')][_0xfdcf('0xe')]);return _0x43710a(_0x34224d[_0xfdcf('0xc')]['message']);}logger[_0xfdcf('0xc')](_0xfdcf('0xf'),_0x26f33e,_0x34224d['error'][_0xfdcf('0xe')]);return _0x4ce564(_0x34224d[_0xfdcf('0xc')]['message']);}else{logger[_0xfdcf('0x10')](_0xfdcf('0xf'),_0x26f33e,'request\x20sent');_0x4ce564(_0x34224d['result'][_0xfdcf('0xe')]);}})['catch'](function(_0x85d836){logger[_0xfdcf('0xc')](_0xfdcf('0xf'),_0x26f33e,_0x85d836);_0x43710a(_0x85d836);});});} \ No newline at end of file +var _0x5018=['stringify','error','message','catch','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x5018,0x193));var _0x8501=function(_0x58381c,_0x3b9374){_0x58381c=_0x58381c-0x0;var _0x1a7440=_0x5018[_0x58381c];return _0x1a7440;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8501('0x0'));var BPromise=require(_0x8501('0x1'));var rs=require(_0x8501('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8501('0x3'))['db'];var utils=require(_0x8501('0x4'));var logger=require(_0x8501('0x5'))(_0x8501('0x6'));var config=require('../../config/environment');var jayson=require(_0x8501('0x7'));var client=jayson[_0x8501('0x8')][_0x8501('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x187c31,_0x4f0830,_0x16fd95){return new BPromise(function(_0x2d40d3,_0x2c6c5f){return client['request'](_0x187c31,_0x16fd95)['then'](function(_0xeb7874){logger[_0x8501('0xa')](_0x8501('0xb'),_0x4f0830,_0x8501('0xc'));logger[_0x8501('0xd')](_0x8501('0xe'),_0x4f0830,'request\x20sent',JSON[_0x8501('0xf')](_0xeb7874));if(_0xeb7874[_0x8501('0x10')]){if(_0xeb7874['error']['code']===0x1f4){logger[_0x8501('0x10')]('AnalyticFieldReport,\x20%s,\x20%s',_0x4f0830,_0xeb7874[_0x8501('0x10')][_0x8501('0x11')]);return _0x2c6c5f(_0xeb7874[_0x8501('0x10')][_0x8501('0x11')]);}logger['error'](_0x8501('0xb'),_0x4f0830,_0xeb7874[_0x8501('0x10')]['message']);return _0x2d40d3(_0xeb7874[_0x8501('0x10')][_0x8501('0x11')]);}else{logger[_0x8501('0xa')](_0x8501('0xb'),_0x4f0830,'request\x20sent');_0x2d40d3(_0xeb7874['result'][_0x8501('0x11')]);}})[_0x8501('0x12')](function(_0x78112d){logger[_0x8501('0x10')](_0x8501('0xb'),_0x4f0830,_0x78112d);_0x2c6c5f(_0x78112d);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index cdafc35..808e1dc 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(_0x3849ff,_0x4ae25e){var _0x3ab676=function(_0x50a39e){while(--_0x50a39e){_0x3849ff['push'](_0x3849ff['shift']());}};_0x3ab676(++_0x4ae25e);}(_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'));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(_0x13211b,_0x3050c2){var _0x4adb44=function(_0x3885c6){while(--_0x3885c6){_0x13211b['push'](_0x13211b['shift']());}};_0x4adb44(++_0x3050c2);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xa9e0[_0xf0bcac];return _0x4e4c65;};'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 06512d7..2fc9025 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 _0xc900=['name','STRING'];(function(_0x4e291f,_0x202c9){var _0x3b2d52=function(_0x2004a8){while(--_0x2004a8){_0x4e291f['push'](_0x4e291f['shift']());}};_0x3b2d52(++_0x202c9);}(_0xc900,0xb3));var _0x0c90=function(_0x5554da,_0x4de156){_0x5554da=_0x5554da-0x0;var _0x14d91d=_0xc900[_0x5554da];return _0x14d91d;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x0c90('0x0')],'allowNull':![],'unique':_0x0c90('0x1')},'table':{'type':Sequelize[_0x0c90('0x0')]},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize[_0x0c90('0x0')]}}; \ No newline at end of file +var _0x2b4f=['STRING','TEXT','exports','name'];(function(_0x551f47,_0x5369e0){var _0x35fbf7=function(_0xaa3a68){while(--_0xaa3a68){_0x551f47['push'](_0x551f47['shift']());}};_0x35fbf7(++_0x5369e0);}(_0x2b4f,0x142));var _0xf2b4=function(_0x1a3789,_0x44c290){_0x1a3789=_0x1a3789-0x0;var _0x428b5e=_0x2b4f[_0x1a3789];return _0x428b5e;};'use strict';var Sequelize=require('sequelize');module[_0xf2b4('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xf2b4('0x1')},'table':{'type':Sequelize[_0xf2b4('0x2')]},'metric':{'type':Sequelize[_0xf2b4('0x3')]},'description':{'type':Sequelize[_0xf2b4('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index b13584d..4de6658 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 _0x7217=['Content-Range','apply','reject','save','update','then','destroy','get','Metrics','UserProfileResource','sendStatus','error','stack','name','send','index','map','AnalyticMetric','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','rawAttributes','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set'];(function(_0x174c8f,_0xf83f63){var _0x17f057=function(_0x178231){while(--_0x178231){_0x174c8f['push'](_0x174c8f['shift']());}};_0x17f057(++_0xf83f63);}(_0x7217,0x19e));var _0x7721=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0x7217[_0x3635ce];return _0x97ecd0;};'use strict';var emlformat=require(_0x7721('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7721('0x1'));var jsonpatch=require(_0x7721('0x2'));var rp=require(_0x7721('0x3'));var moment=require(_0x7721('0x4'));var BPromise=require(_0x7721('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7721('0x6'));var sox=require(_0x7721('0x7'));var csv=require(_0x7721('0x8'));var ejs=require(_0x7721('0x9'));var fs=require('fs');var fs_extra=require(_0x7721('0xa'));var _=require(_0x7721('0xb'));var squel=require(_0x7721('0xc'));var crypto=require(_0x7721('0xd'));var jsforce=require(_0x7721('0xe'));var deskjs=require(_0x7721('0xf'));var toCsv=require(_0x7721('0x8'));var querystring=require(_0x7721('0x10'));var Papa=require(_0x7721('0x11'));var Redis=require(_0x7721('0x12'));var authService=require(_0x7721('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x7721('0x14'));var hardwareService=require(_0x7721('0x15'));var logger=require(_0x7721('0x16'))(_0x7721('0x17'));var utils=require(_0x7721('0x18'));var config=require(_0x7721('0x19'));var licenseUtil=require(_0x7721('0x1a'));var db=require(_0x7721('0x1b'))['db'];function respondWithStatusCode(_0x55b4ca,_0x2911ec){_0x2911ec=_0x2911ec||0xcc;return function(_0x199930){if(_0x199930){return _0x55b4ca['sendStatus'](_0x2911ec);}return _0x55b4ca[_0x7721('0x1c')](_0x2911ec)[_0x7721('0x1d')]();};}function respondWithResult(_0x3f01c5,_0x2e9752){_0x2e9752=_0x2e9752||0xc8;return function(_0x5069da){if(_0x5069da){return _0x3f01c5[_0x7721('0x1c')](_0x2e9752)[_0x7721('0x1e')](_0x5069da);}};}function respondWithFilteredResult(_0x534f1b,_0x4e199a){return function(_0x4b183e){if(_0x4b183e){var _0x5ed54=typeof _0x4e199a[_0x7721('0x1f')]===_0x7721('0x20')&&typeof _0x4e199a[_0x7721('0x21')]==='undefined';var _0x20f669=_0x4b183e['count'];var _0x3fc09e=_0x5ed54?0x0:_0x4e199a['offset'];var _0xfec626=_0x5ed54?_0x4b183e[_0x7721('0x22')]:_0x4e199a[_0x7721('0x1f')]+_0x4e199a[_0x7721('0x21')];var _0x2286e5;if(_0xfec626>=_0x20f669){_0xfec626=_0x20f669;_0x2286e5=0xc8;}else{_0x2286e5=0xce;}_0x534f1b[_0x7721('0x1c')](_0x2286e5);return _0x534f1b[_0x7721('0x23')](_0x7721('0x24'),_0x3fc09e+'-'+_0xfec626+'/'+_0x20f669)[_0x7721('0x1e')](_0x4b183e);}return null;};}function patchUpdates(_0xaeccc4){return function(_0x4ce1db){try{jsonpatch[_0x7721('0x25')](_0x4ce1db,_0xaeccc4,!![]);}catch(_0x2c1583){return BPromise[_0x7721('0x26')](_0x2c1583);}return _0x4ce1db[_0x7721('0x27')]();};}function saveUpdates(_0x57140c,_0x28f5a6){return function(_0x512f31){if(_0x512f31){return _0x512f31[_0x7721('0x28')](_0x57140c)[_0x7721('0x29')](function(_0x3e8a4e){return _0x3e8a4e;});}return null;};}function removeEntity(_0x1caad8,_0x121cc4){return function(_0x395b15){if(_0x395b15){return _0x395b15[_0x7721('0x2a')]()['then'](function(){var _0x216f20=_0x395b15[_0x7721('0x2b')]({'plain':!![]});var _0x125564=_0x7721('0x2c');return db[_0x7721('0x2d')][_0x7721('0x2a')]({'where':{'type':_0x125564,'resourceId':_0x216f20['id']}})[_0x7721('0x29')](function(){return _0x395b15;});})[_0x7721('0x29')](function(){_0x1caad8[_0x7721('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x258ddf,_0x5b0551){return function(_0x499b87){if(!_0x499b87){_0x258ddf[_0x7721('0x2e')](0x194);}return _0x499b87;};}function handleError(_0x343c19,_0x53c904){_0x53c904=_0x53c904||0x1f4;return function(_0x158d98){logger[_0x7721('0x2f')](_0x158d98[_0x7721('0x30')]);if(_0x158d98[_0x7721('0x31')]){delete _0x158d98[_0x7721('0x31')];}_0x343c19['status'](_0x53c904)[_0x7721('0x32')](_0x158d98);};}exports[_0x7721('0x33')]=function(_0x497f9f,_0x4a25c9){var _0xfde9ec={},_0x220bbf={},_0x48f329={'count':0x0,'rows':[]};var _0x46f772=_[_0x7721('0x34')](db[_0x7721('0x35')]['rawAttributes'],function(_0x3d9a32){return{'name':_0x3d9a32[_0x7721('0x36')],'type':_0x3d9a32[_0x7721('0x37')][_0x7721('0x38')]};});_0x220bbf[_0x7721('0x39')]=_['map'](_0x46f772,_0x7721('0x31'));_0x220bbf[_0x7721('0x3a')]=_[_0x7721('0x3b')](_0x497f9f['query']);_0x220bbf[_0x7721('0x3c')]=_[_0x7721('0x3d')](_0x220bbf['model'],_0x220bbf[_0x7721('0x3a')]);_0xfde9ec['attributes']=_[_0x7721('0x3d')](_0x220bbf[_0x7721('0x39')],qs[_0x7721('0x3e')](_0x497f9f[_0x7721('0x3a')][_0x7721('0x3e')]));_0xfde9ec[_0x7721('0x3f')]=_0xfde9ec[_0x7721('0x3f')][_0x7721('0x40')]?_0xfde9ec[_0x7721('0x3f')]:_0x220bbf[_0x7721('0x39')];if(!_0x497f9f[_0x7721('0x3a')]['hasOwnProperty'](_0x7721('0x41'))){_0xfde9ec['limit']=qs[_0x7721('0x21')](_0x497f9f[_0x7721('0x3a')][_0x7721('0x21')]);_0xfde9ec[_0x7721('0x1f')]=qs[_0x7721('0x1f')](_0x497f9f[_0x7721('0x3a')]['offset']);}_0xfde9ec['order']=qs['sort'](_0x497f9f['query'][_0x7721('0x42')]);_0xfde9ec[_0x7721('0x43')]=qs[_0x7721('0x3c')](_[_0x7721('0x44')](_0x497f9f['query'],_0x220bbf[_0x7721('0x3c')]),_0x46f772);if(_0x497f9f['query'][_0x7721('0x45')]){_0xfde9ec[_0x7721('0x43')]=_['merge'](_0xfde9ec[_0x7721('0x43')],{'$or':_[_0x7721('0x34')](_0x46f772,function(_0x4e77ff){if(_0x4e77ff['type']!==_0x7721('0x46')){var _0xfc4dc4={};_0xfc4dc4[_0x4e77ff[_0x7721('0x31')]]={'$like':'%'+_0x497f9f[_0x7721('0x3a')]['filter']+'%'};return _0xfc4dc4;}})});}_0xfde9ec=_[_0x7721('0x47')]({},_0xfde9ec,_0x497f9f[_0x7721('0x48')]);var _0x40ce8c={'where':_0xfde9ec[_0x7721('0x43')]};return db[_0x7721('0x35')]['count'](_0x40ce8c)[_0x7721('0x29')](function(_0x4a2c28){_0x48f329[_0x7721('0x22')]=_0x4a2c28;if(_0x497f9f['query'][_0x7721('0x49')]){_0xfde9ec[_0x7721('0x4a')]=[{'all':!![]}];}return db[_0x7721('0x35')]['findAll'](_0xfde9ec);})[_0x7721('0x29')](function(_0x11d853){_0x48f329[_0x7721('0x4b')]=_0x11d853;return _0x48f329;})['then'](respondWithFilteredResult(_0x4a25c9,_0xfde9ec))[_0x7721('0x4c')](handleError(_0x4a25c9,null));};exports[_0x7721('0x4d')]=function(_0xdb3033,_0x2d5f35){var _0x135dbc={'raw':!![],'where':{'id':_0xdb3033[_0x7721('0x4e')]['id']}},_0x57d09b={};_0x57d09b['model']=_['keys'](db[_0x7721('0x35')][_0x7721('0x4f')]);_0x57d09b[_0x7721('0x3a')]=_[_0x7721('0x3b')](_0xdb3033[_0x7721('0x3a')]);_0x57d09b[_0x7721('0x3c')]=_[_0x7721('0x3d')](_0x57d09b[_0x7721('0x39')],_0x57d09b[_0x7721('0x3a')]);_0x135dbc[_0x7721('0x3f')]=_['intersection'](_0x57d09b['model'],qs[_0x7721('0x3e')](_0xdb3033[_0x7721('0x3a')][_0x7721('0x3e')]));_0x135dbc[_0x7721('0x3f')]=_0x135dbc['attributes'][_0x7721('0x40')]?_0x135dbc[_0x7721('0x3f')]:_0x57d09b['model'];if(_0xdb3033[_0x7721('0x3a')]['includeAll']){_0x135dbc[_0x7721('0x4a')]=[{'all':!![]}];}_0x135dbc=_['merge']({},_0x135dbc,_0xdb3033[_0x7721('0x48')]);return db[_0x7721('0x35')][_0x7721('0x50')](_0x135dbc)['then'](handleEntityNotFound(_0x2d5f35,null))[_0x7721('0x29')](respondWithResult(_0x2d5f35,null))[_0x7721('0x4c')](handleError(_0x2d5f35,null));};exports['create']=function(_0x223d93,_0x1196c2){return db[_0x7721('0x35')]['create'](_0x223d93[_0x7721('0x51')],{})['then'](function(_0xdb1ca8){var _0x310549=_0x223d93[_0x7721('0x52')][_0x7721('0x2b')]({'plain':!![]});if(!_0x310549)throw new Error(_0x7721('0x53'));if(_0x310549[_0x7721('0x54')]===_0x7721('0x52')){var _0x7fbb73=_0xdb1ca8[_0x7721('0x2b')]({'plain':!![]});var _0x3386aa=_0x7721('0x2c');return db[_0x7721('0x55')][_0x7721('0x50')]({'where':{'name':_0x3386aa,'userProfileId':_0x310549[_0x7721('0x56')]},'raw':!![]})[_0x7721('0x29')](function(_0x5b741d){if(_0x5b741d&&_0x5b741d[_0x7721('0x57')]===0x0){return db[_0x7721('0x2d')][_0x7721('0x58')]({'name':_0x7fbb73[_0x7721('0x31')],'resourceId':_0x7fbb73['id'],'type':_0x5b741d[_0x7721('0x31')],'sectionId':_0x5b741d['id']},{})[_0x7721('0x29')](function(){return _0xdb1ca8;});}else{return _0xdb1ca8;}})[_0x7721('0x4c')](function(_0x57484c){logger[_0x7721('0x2f')](_0x7721('0x59'),_0x57484c);throw _0x57484c;});}return _0xdb1ca8;})[_0x7721('0x29')](respondWithResult(_0x1196c2,0xc9))[_0x7721('0x4c')](handleError(_0x1196c2,null));};exports[_0x7721('0x28')]=function(_0x9c0d4,_0x7fbd6c){if(_0x9c0d4[_0x7721('0x51')]['id']){delete _0x9c0d4[_0x7721('0x51')]['id'];}return db[_0x7721('0x35')][_0x7721('0x50')]({'where':{'id':_0x9c0d4['params']['id']}})[_0x7721('0x29')](handleEntityNotFound(_0x7fbd6c,null))[_0x7721('0x29')](saveUpdates(_0x9c0d4[_0x7721('0x51')],null))[_0x7721('0x29')](respondWithResult(_0x7fbd6c,null))[_0x7721('0x4c')](handleError(_0x7fbd6c,null));};exports[_0x7721('0x2a')]=function(_0x41644f,_0x36fe6f){return db[_0x7721('0x35')][_0x7721('0x50')]({'where':{'id':_0x41644f[_0x7721('0x4e')]['id']}})[_0x7721('0x29')](handleEntityNotFound(_0x36fe6f,null))[_0x7721('0x29')](removeEntity(_0x36fe6f,null))[_0x7721('0x4c')](handleError(_0x36fe6f,null));}; \ No newline at end of file +var _0x8ef6=['../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','then','destroy','get','UserProfileResource','error','stack','name','index','map','fieldName','key','model','keys','query','intersection','attributes','length','hasOwnProperty','order','sort','where','filters','filter','merge','type','VIRTUAL','options','AnalyticMetric','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','fields','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Metrics','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','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'];(function(_0xcb423a,_0x3f03e1){var _0x8e28a0=function(_0x34d63c){while(--_0x34d63c){_0xcb423a['push'](_0xcb423a['shift']());}};_0x8e28a0(++_0x3f03e1);}(_0x8ef6,0xf2));var _0x68ef=function(_0x32ebcb,_0x2c22b0){_0x32ebcb=_0x32ebcb-0x0;var _0x22bd6e=_0x8ef6[_0x32ebcb];return _0x22bd6e;};'use strict';var emlformat=require(_0x68ef('0x0'));var rimraf=require(_0x68ef('0x1'));var zipdir=require(_0x68ef('0x2'));var jsonpatch=require(_0x68ef('0x3'));var rp=require(_0x68ef('0x4'));var moment=require(_0x68ef('0x5'));var BPromise=require(_0x68ef('0x6'));var Mustache=require('mustache');var util=require(_0x68ef('0x7'));var path=require(_0x68ef('0x8'));var sox=require(_0x68ef('0x9'));var csv=require(_0x68ef('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x68ef('0xb'));var squel=require(_0x68ef('0xc'));var crypto=require(_0x68ef('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x68ef('0xe'));var toCsv=require(_0x68ef('0xa'));var querystring=require(_0x68ef('0xf'));var Papa=require(_0x68ef('0x10'));var Redis=require(_0x68ef('0x11'));var authService=require(_0x68ef('0x12'));var qs=require(_0x68ef('0x13'));var as=require(_0x68ef('0x14'));var hardwareService=require(_0x68ef('0x15'));var logger=require(_0x68ef('0x16'))(_0x68ef('0x17'));var utils=require(_0x68ef('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x68ef('0x19'));var db=require(_0x68ef('0x1a'))['db'];function respondWithStatusCode(_0x1e117a,_0x454ef4){_0x454ef4=_0x454ef4||0xcc;return function(_0x40f253){if(_0x40f253){return _0x1e117a[_0x68ef('0x1b')](_0x454ef4);}return _0x1e117a['status'](_0x454ef4)[_0x68ef('0x1c')]();};}function respondWithResult(_0xc50cce,_0x2657c5){_0x2657c5=_0x2657c5||0xc8;return function(_0x47fbb5){if(_0x47fbb5){return _0xc50cce[_0x68ef('0x1d')](_0x2657c5)[_0x68ef('0x1e')](_0x47fbb5);}};}function respondWithFilteredResult(_0x24682d,_0x5005ba){return function(_0x35493d){if(_0x35493d){var _0x37c4cc=typeof _0x5005ba[_0x68ef('0x1f')]===_0x68ef('0x20')&&typeof _0x5005ba['limit']===_0x68ef('0x20');var _0x54139e=_0x35493d['count'];var _0x2633c1=_0x37c4cc?0x0:_0x5005ba[_0x68ef('0x1f')];var _0x4ade0d=_0x37c4cc?_0x35493d['count']:_0x5005ba[_0x68ef('0x1f')]+_0x5005ba[_0x68ef('0x21')];var _0x318514;if(_0x4ade0d>=_0x54139e){_0x4ade0d=_0x54139e;_0x318514=0xc8;}else{_0x318514=0xce;}_0x24682d['status'](_0x318514);return _0x24682d[_0x68ef('0x22')](_0x68ef('0x23'),_0x2633c1+'-'+_0x4ade0d+'/'+_0x54139e)[_0x68ef('0x1e')](_0x35493d);}return null;};}function patchUpdates(_0x5b246b){return function(_0x3c46d4){try{jsonpatch[_0x68ef('0x24')](_0x3c46d4,_0x5b246b,!![]);}catch(_0x5af19f){return BPromise[_0x68ef('0x25')](_0x5af19f);}return _0x3c46d4[_0x68ef('0x26')]();};}function saveUpdates(_0x19aa3d,_0x5ddec7){return function(_0x59723c){if(_0x59723c){return _0x59723c['update'](_0x19aa3d)[_0x68ef('0x27')](function(_0x2023f2){return _0x2023f2;});}return null;};}function removeEntity(_0x312cc9,_0x2e6e39){return function(_0x438b4c){if(_0x438b4c){return _0x438b4c[_0x68ef('0x28')]()[_0x68ef('0x27')](function(){var _0x49374f=_0x438b4c[_0x68ef('0x29')]({'plain':!![]});var _0x13280b='Metrics';return db[_0x68ef('0x2a')]['destroy']({'where':{'type':_0x13280b,'resourceId':_0x49374f['id']}})['then'](function(){return _0x438b4c;});})['then'](function(){_0x312cc9[_0x68ef('0x1d')](0xcc)[_0x68ef('0x1c')]();});}};}function handleEntityNotFound(_0x123041,_0x29518e){return function(_0x52e67e){if(!_0x52e67e){_0x123041['sendStatus'](0x194);}return _0x52e67e;};}function handleError(_0x1cbe4f,_0x28907a){_0x28907a=_0x28907a||0x1f4;return function(_0x7bf96){logger[_0x68ef('0x2b')](_0x7bf96[_0x68ef('0x2c')]);if(_0x7bf96[_0x68ef('0x2d')]){delete _0x7bf96[_0x68ef('0x2d')];}_0x1cbe4f[_0x68ef('0x1d')](_0x28907a)['send'](_0x7bf96);};}exports[_0x68ef('0x2e')]=function(_0x4314bd,_0x132d9e){var _0x4c25aa={},_0x370a8f={},_0x523120={'count':0x0,'rows':[]};var _0x133788=_[_0x68ef('0x2f')](db['AnalyticMetric']['rawAttributes'],function(_0x159395){return{'name':_0x159395[_0x68ef('0x30')],'type':_0x159395['type'][_0x68ef('0x31')]};});_0x370a8f[_0x68ef('0x32')]=_[_0x68ef('0x2f')](_0x133788,_0x68ef('0x2d'));_0x370a8f['query']=_[_0x68ef('0x33')](_0x4314bd[_0x68ef('0x34')]);_0x370a8f['filters']=_[_0x68ef('0x35')](_0x370a8f['model'],_0x370a8f[_0x68ef('0x34')]);_0x4c25aa[_0x68ef('0x36')]=_['intersection'](_0x370a8f[_0x68ef('0x32')],qs['fields'](_0x4314bd[_0x68ef('0x34')]['fields']));_0x4c25aa[_0x68ef('0x36')]=_0x4c25aa[_0x68ef('0x36')][_0x68ef('0x37')]?_0x4c25aa['attributes']:_0x370a8f[_0x68ef('0x32')];if(!_0x4314bd['query'][_0x68ef('0x38')]('nolimit')){_0x4c25aa[_0x68ef('0x21')]=qs[_0x68ef('0x21')](_0x4314bd[_0x68ef('0x34')][_0x68ef('0x21')]);_0x4c25aa[_0x68ef('0x1f')]=qs[_0x68ef('0x1f')](_0x4314bd['query'][_0x68ef('0x1f')]);}_0x4c25aa[_0x68ef('0x39')]=qs[_0x68ef('0x3a')](_0x4314bd['query'][_0x68ef('0x3a')]);_0x4c25aa[_0x68ef('0x3b')]=qs[_0x68ef('0x3c')](_['pick'](_0x4314bd['query'],_0x370a8f[_0x68ef('0x3c')]),_0x133788);if(_0x4314bd[_0x68ef('0x34')][_0x68ef('0x3d')]){_0x4c25aa[_0x68ef('0x3b')]=_[_0x68ef('0x3e')](_0x4c25aa[_0x68ef('0x3b')],{'$or':_[_0x68ef('0x2f')](_0x133788,function(_0x5b1246){if(_0x5b1246[_0x68ef('0x3f')]!==_0x68ef('0x40')){var _0x2f6ee0={};_0x2f6ee0[_0x5b1246[_0x68ef('0x2d')]]={'$like':'%'+_0x4314bd['query'][_0x68ef('0x3d')]+'%'};return _0x2f6ee0;}})});}_0x4c25aa=_[_0x68ef('0x3e')]({},_0x4c25aa,_0x4314bd[_0x68ef('0x41')]);var _0x410c10={'where':_0x4c25aa[_0x68ef('0x3b')]};return db[_0x68ef('0x42')]['count'](_0x410c10)[_0x68ef('0x27')](function(_0x3f7699){_0x523120[_0x68ef('0x43')]=_0x3f7699;if(_0x4314bd[_0x68ef('0x34')][_0x68ef('0x44')]){_0x4c25aa[_0x68ef('0x45')]=[{'all':!![]}];}return db[_0x68ef('0x42')][_0x68ef('0x46')](_0x4c25aa);})[_0x68ef('0x27')](function(_0x531096){_0x523120[_0x68ef('0x47')]=_0x531096;return _0x523120;})[_0x68ef('0x27')](respondWithFilteredResult(_0x132d9e,_0x4c25aa))[_0x68ef('0x48')](handleError(_0x132d9e,null));};exports[_0x68ef('0x49')]=function(_0xdeacf2,_0x183377){var _0xcac58f={'raw':!![],'where':{'id':_0xdeacf2[_0x68ef('0x4a')]['id']}},_0x576767={};_0x576767['model']=_[_0x68ef('0x33')](db[_0x68ef('0x42')][_0x68ef('0x4b')]);_0x576767[_0x68ef('0x34')]=_['keys'](_0xdeacf2[_0x68ef('0x34')]);_0x576767['filters']=_[_0x68ef('0x35')](_0x576767['model'],_0x576767[_0x68ef('0x34')]);_0xcac58f[_0x68ef('0x36')]=_[_0x68ef('0x35')](_0x576767['model'],qs['fields'](_0xdeacf2[_0x68ef('0x34')][_0x68ef('0x4c')]));_0xcac58f['attributes']=_0xcac58f['attributes']['length']?_0xcac58f[_0x68ef('0x36')]:_0x576767[_0x68ef('0x32')];if(_0xdeacf2[_0x68ef('0x34')][_0x68ef('0x44')]){_0xcac58f[_0x68ef('0x45')]=[{'all':!![]}];}_0xcac58f=_['merge']({},_0xcac58f,_0xdeacf2['options']);return db[_0x68ef('0x42')][_0x68ef('0x4d')](_0xcac58f)[_0x68ef('0x27')](handleEntityNotFound(_0x183377,null))[_0x68ef('0x27')](respondWithResult(_0x183377,null))['catch'](handleError(_0x183377,null));};exports[_0x68ef('0x4e')]=function(_0x474e5a,_0x1c9b6f){return db[_0x68ef('0x42')]['create'](_0x474e5a['body'],{})[_0x68ef('0x27')](function(_0x3c3074){var _0x566e7c=_0x474e5a[_0x68ef('0x4f')][_0x68ef('0x29')]({'plain':!![]});if(!_0x566e7c)throw new Error(_0x68ef('0x50'));if(_0x566e7c[_0x68ef('0x51')]===_0x68ef('0x4f')){var _0x4f0f77=_0x3c3074[_0x68ef('0x29')]({'plain':!![]});var _0x3984ca=_0x68ef('0x52');return db['UserProfileSection'][_0x68ef('0x4d')]({'where':{'name':_0x3984ca,'userProfileId':_0x566e7c[_0x68ef('0x53')]},'raw':!![]})[_0x68ef('0x27')](function(_0x50ef1f){if(_0x50ef1f&&_0x50ef1f[_0x68ef('0x54')]===0x0){return db['UserProfileResource']['create']({'name':_0x4f0f77[_0x68ef('0x2d')],'resourceId':_0x4f0f77['id'],'type':_0x50ef1f['name'],'sectionId':_0x50ef1f['id']},{})[_0x68ef('0x27')](function(){return _0x3c3074;});}else{return _0x3c3074;}})[_0x68ef('0x48')](function(_0x53ebd){logger[_0x68ef('0x2b')](_0x68ef('0x55'),_0x53ebd);throw _0x53ebd;});}return _0x3c3074;})[_0x68ef('0x27')](respondWithResult(_0x1c9b6f,0xc9))[_0x68ef('0x48')](handleError(_0x1c9b6f,null));};exports[_0x68ef('0x56')]=function(_0x2b35f4,_0x247915){if(_0x2b35f4['body']['id']){delete _0x2b35f4['body']['id'];}return db[_0x68ef('0x42')][_0x68ef('0x4d')]({'where':{'id':_0x2b35f4[_0x68ef('0x4a')]['id']}})[_0x68ef('0x27')](handleEntityNotFound(_0x247915,null))[_0x68ef('0x27')](saveUpdates(_0x2b35f4[_0x68ef('0x57')],null))[_0x68ef('0x27')](respondWithResult(_0x247915,null))[_0x68ef('0x48')](handleError(_0x247915,null));};exports[_0x68ef('0x28')]=function(_0x4c2e9c,_0x5685bb){return db[_0x68ef('0x42')]['find']({'where':{'id':_0x4c2e9c[_0x68ef('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5685bb,null))[_0x68ef('0x27')](removeEntity(_0x5685bb,null))[_0x68ef('0x48')](handleError(_0x5685bb,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index b243f9b..e53b15e 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 _0xc812=['bluebird','request-promise','path','../../config/environment','./analyticMetric.attributes','define','AnalyticMetric','analytics_metrics','lodash','util','../../config/logger','moment'];(function(_0x2c9040,_0x57d998){var _0xae884d=function(_0x5c072a){while(--_0x5c072a){_0x2c9040['push'](_0x2c9040['shift']());}};_0xae884d(++_0x57d998);}(_0xc812,0xbc));var _0x2c81=function(_0x58bd9c,_0xb29b2){_0x58bd9c=_0x58bd9c-0x0;var _0x283661=_0xc812[_0x58bd9c];return _0x283661;};'use strict';var _=require(_0x2c81('0x0'));var util=require(_0x2c81('0x1'));var logger=require(_0x2c81('0x2'))('api');var moment=require(_0x2c81('0x3'));var BPromise=require(_0x2c81('0x4'));var rp=require(_0x2c81('0x5'));var fs=require('fs');var path=require(_0x2c81('0x6'));var rimraf=require('rimraf');var config=require(_0x2c81('0x7'));var attributes=require(_0x2c81('0x8'));module['exports']=function(_0x209191,_0x132a16){return _0x209191[_0x2c81('0x9')](_0x2c81('0xa'),attributes,{'tableName':_0x2c81('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2cd0=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./analyticMetric.attributes','exports','define','AnalyticMetric','lodash','util'];(function(_0x2c2cf1,_0x3b6635){var _0x585793=function(_0x882043){while(--_0x882043){_0x2c2cf1['push'](_0x2c2cf1['shift']());}};_0x585793(++_0x3b6635);}(_0x2cd0,0x10f));var _0x02cd=function(_0x23ec89,_0x11c956){_0x23ec89=_0x23ec89-0x0;var _0x51aea2=_0x2cd0[_0x23ec89];return _0x51aea2;};'use strict';var _=require(_0x02cd('0x0'));var util=require(_0x02cd('0x1'));var logger=require(_0x02cd('0x2'))(_0x02cd('0x3'));var moment=require(_0x02cd('0x4'));var BPromise=require(_0x02cd('0x5'));var rp=require(_0x02cd('0x6'));var fs=require('fs');var path=require(_0x02cd('0x7'));var rimraf=require('rimraf');var config=require(_0x02cd('0x8'));var attributes=require(_0x02cd('0x9'));module[_0x02cd('0xa')]=function(_0x17860f,_0x5172cc){return _0x17860f[_0x02cd('0xb')](_0x02cd('0xc'),attributes,{'tableName':'analytics_metrics','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 a6bdc28..6506f34 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 _0xac3f=['AnalyticMetric,\x20%s,\x20%s','request\x20sent','AnalyticMetric,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','then','info'];(function(_0x95411e,_0x38b4c3){var _0x2c8718=function(_0x35c672){while(--_0x35c672){_0x95411e['push'](_0x95411e['shift']());}};_0x2c8718(++_0x38b4c3);}(_0xac3f,0x197));var _0xfac3=function(_0x412686,_0x3fde24){_0x412686=_0x412686-0x0;var _0x18619e=_0xac3f[_0x412686];return _0x18619e;};'use strict';var _=require(_0xfac3('0x0'));var util=require(_0xfac3('0x1'));var moment=require(_0xfac3('0x2'));var BPromise=require(_0xfac3('0x3'));var rs=require(_0xfac3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfac3('0x5'))['db'];var utils=require(_0xfac3('0x6'));var logger=require(_0xfac3('0x7'))(_0xfac3('0x8'));var config=require('../../config/environment');var jayson=require(_0xfac3('0x9'));var client=jayson[_0xfac3('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3dfa70,_0x4007ca,_0x201ab7){return new BPromise(function(_0x41b9b5,_0x101da0){return client['request'](_0x3dfa70,_0x201ab7)[_0xfac3('0xb')](function(_0x4c3955){logger[_0xfac3('0xc')](_0xfac3('0xd'),_0x4007ca,_0xfac3('0xe'));logger['debug'](_0xfac3('0xf'),_0x4007ca,'request\x20sent',JSON['stringify'](_0x4c3955));if(_0x4c3955[_0xfac3('0x10')]){if(_0x4c3955[_0xfac3('0x10')][_0xfac3('0x11')]===0x1f4){logger[_0xfac3('0x10')](_0xfac3('0xd'),_0x4007ca,_0x4c3955[_0xfac3('0x10')]['message']);return _0x101da0(_0x4c3955[_0xfac3('0x10')][_0xfac3('0x12')]);}logger['error'](_0xfac3('0xd'),_0x4007ca,_0x4c3955['error'][_0xfac3('0x12')]);return _0x41b9b5(_0x4c3955['error'][_0xfac3('0x12')]);}else{logger[_0xfac3('0xc')](_0xfac3('0xd'),_0x4007ca,_0xfac3('0xe'));_0x41b9b5(_0x4c3955[_0xfac3('0x13')][_0xfac3('0x12')]);}})['catch'](function(_0x36a7f3){logger[_0xfac3('0x10')](_0xfac3('0xd'),_0x4007ca,_0x36a7f3);_0x101da0(_0x36a7f3);});});} \ No newline at end of file +var _0xbfc4=['error','code','AnalyticMetric,\x20%s,\x20%s','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify'];(function(_0x3e7caa,_0x2e8bd3){var _0x247ffb=function(_0x3e5952){while(--_0x3e5952){_0x3e7caa['push'](_0x3e7caa['shift']());}};_0x247ffb(++_0x2e8bd3);}(_0xbfc4,0xf7));var _0x4bfc=function(_0x477355,_0x4490a8){_0x477355=_0x477355-0x0;var _0x41db7e=_0xbfc4[_0x477355];return _0x41db7e;};'use strict';var _=require(_0x4bfc('0x0'));var util=require(_0x4bfc('0x1'));var moment=require('moment');var BPromise=require(_0x4bfc('0x2'));var rs=require(_0x4bfc('0x3'));var fs=require('fs');var Redis=require(_0x4bfc('0x4'));var db=require(_0x4bfc('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4bfc('0x6'));var config=require(_0x4bfc('0x7'));var jayson=require(_0x4bfc('0x8'));var client=jayson[_0x4bfc('0x9')][_0x4bfc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x55a121,_0x361853,_0x2c7d16){return new BPromise(function(_0x8b9839,_0x422a32){return client[_0x4bfc('0xb')](_0x55a121,_0x2c7d16)[_0x4bfc('0xc')](function(_0x344557){logger[_0x4bfc('0xd')]('AnalyticMetric,\x20%s,\x20%s',_0x361853,_0x4bfc('0xe'));logger[_0x4bfc('0xf')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x361853,'request\x20sent',JSON[_0x4bfc('0x10')](_0x344557));if(_0x344557[_0x4bfc('0x11')]){if(_0x344557[_0x4bfc('0x11')][_0x4bfc('0x12')]===0x1f4){logger[_0x4bfc('0x11')](_0x4bfc('0x13'),_0x361853,_0x344557[_0x4bfc('0x11')][_0x4bfc('0x14')]);return _0x422a32(_0x344557[_0x4bfc('0x11')][_0x4bfc('0x14')]);}logger[_0x4bfc('0x11')](_0x4bfc('0x13'),_0x361853,_0x344557['error'][_0x4bfc('0x14')]);return _0x8b9839(_0x344557['error'][_0x4bfc('0x14')]);}else{logger[_0x4bfc('0xd')](_0x4bfc('0x13'),_0x361853,'request\x20sent');_0x8b9839(_0x344557['result'][_0x4bfc('0x14')]);}})[_0x4bfc('0x15')](function(_0x3a0117){logger[_0x4bfc('0x11')](_0x4bfc('0x13'),_0x361853,_0x3a0117);_0x422a32(_0x3a0117);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 619b706..6f3abfc 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 _0x4fd7=['fs-extra','../../components/auth/service','../../config/environment','get','index','isAuthenticated','show','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x5af387,_0x272591){var _0x4a61f9=function(_0x22064d){while(--_0x22064d){_0x5af387['push'](_0x5af387['shift']());}};_0x4a61f9(++_0x272591);}(_0x4fd7,0xe6));var _0x74fd=function(_0x27bca6,_0x2e2de5){_0x27bca6=_0x27bca6-0x0;var _0x562231=_0x4fd7[_0x27bca6];return _0x562231;};'use strict';var multer=require(_0x74fd('0x0'));var util=require(_0x74fd('0x1'));var path=require(_0x74fd('0x2'));var timeout=require(_0x74fd('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x74fd('0x4'));var auth=require(_0x74fd('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x74fd('0x6'));var controller=require('./analyticMetric.controller');router[_0x74fd('0x7')]('/',auth['isAuthenticated'](),controller[_0x74fd('0x8')]);router[_0x74fd('0x7')]('/:id',auth[_0x74fd('0x9')](),controller[_0x74fd('0xa')]);router['post']('/',auth[_0x74fd('0x9')](),controller[_0x74fd('0xb')]);router[_0x74fd('0xc')](_0x74fd('0xd'),auth[_0x74fd('0x9')](),controller[_0x74fd('0xe')]);router[_0x74fd('0xf')](_0x74fd('0xd'),auth[_0x74fd('0x9')](),controller[_0x74fd('0x10')]);module[_0x74fd('0x11')]=router; \ No newline at end of file +var _0xb138=['./analyticMetric.controller','isAuthenticated','index','/:id','show','create','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x3fa00a,_0x412b75){var _0x48b70d=function(_0x589c8c){while(--_0x589c8c){_0x3fa00a['push'](_0x3fa00a['shift']());}};_0x48b70d(++_0x412b75);}(_0xb138,0x1dd));var _0x8b13=function(_0x21c3f6,_0x3c726c){_0x21c3f6=_0x21c3f6-0x0;var _0x288fac=_0xb138[_0x21c3f6];return _0x288fac;};'use strict';var multer=require(_0x8b13('0x0'));var util=require(_0x8b13('0x1'));var path=require(_0x8b13('0x2'));var timeout=require(_0x8b13('0x3'));var express=require(_0x8b13('0x4'));var router=express[_0x8b13('0x5')]();var fs_extra=require(_0x8b13('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x8b13('0x7'));var config=require(_0x8b13('0x8'));var controller=require(_0x8b13('0x9'));router['get']('/',auth[_0x8b13('0xa')](),controller[_0x8b13('0xb')]);router['get'](_0x8b13('0xc'),auth[_0x8b13('0xa')](),controller[_0x8b13('0xd')]);router['post']('/',auth[_0x8b13('0xa')](),controller[_0x8b13('0xe')]);router['put']('/:id',auth[_0x8b13('0xa')](),controller[_0x8b13('0xf')]);router[_0x8b13('0x10')](_0x8b13('0xc'),auth[_0x8b13('0xa')](),controller['destroy']);module[_0x8b13('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 dc8f352..01429e0 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 _0xc774=['sequelize','TEXT'];(function(_0xaccd3b,_0x48ab9d){var _0x2db73d=function(_0x5a3663){while(--_0x5a3663){_0xaccd3b['push'](_0xaccd3b['shift']());}};_0x2db73d(++_0x48ab9d);}(_0xc774,0x180));var _0x4c77=function(_0x370709,_0x387263){_0x370709=_0x370709-0x0;var _0x38ee0f=_0xc774[_0x370709];return _0x38ee0f;};'use strict';var Sequelize=require(_0x4c77('0x0'));module['exports']={'tree':{'type':Sequelize[_0x4c77('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x0f61=['sequelize','exports','TEXT'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x0f61,0x105));var _0x10f6=function(_0x39515f,_0x3fa33f){_0x39515f=_0x39515f-0x0;var _0x149e8b=_0x0f61[_0x39515f];return _0x149e8b;};'use strict';var Sequelize=require(_0x10f6('0x0'));module[_0x10f6('0x1')]={'tree':{'type':Sequelize[_0x10f6('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 36dd198..afa21cc 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 _0x24c2=['map','fieldName','type','key','model','query','filters','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','AnalyticTreeReport','count','then','include','rows','show','params','keys','rawAttributes','intersection','find','create','body','catch','update','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','set','apply','reject','destroy','error','name','send'];(function(_0x2dc564,_0x33be76){var _0x1f40c0=function(_0x124bd3){while(--_0x124bd3){_0x2dc564['push'](_0x2dc564['shift']());}};_0x1f40c0(++_0x33be76);}(_0x24c2,0x139));var _0x224c=function(_0x2c9fb5,_0x42600b){_0x2c9fb5=_0x2c9fb5-0x0;var _0x3acadc=_0x24c2[_0x2c9fb5];return _0x3acadc;};'use strict';var emlformat=require(_0x224c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x224c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x224c('0x2'));var moment=require(_0x224c('0x3'));var BPromise=require(_0x224c('0x4'));var Mustache=require(_0x224c('0x5'));var util=require(_0x224c('0x6'));var path=require('path');var sox=require(_0x224c('0x7'));var csv=require(_0x224c('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x224c('0x9'));var _=require(_0x224c('0xa'));var squel=require('squel');var crypto=require(_0x224c('0xb'));var jsforce=require(_0x224c('0xc'));var deskjs=require(_0x224c('0xd'));var toCsv=require(_0x224c('0x8'));var querystring=require(_0x224c('0xe'));var Papa=require('papaparse');var Redis=require(_0x224c('0xf'));var authService=require(_0x224c('0x10'));var qs=require(_0x224c('0x11'));var as=require(_0x224c('0x12'));var hardwareService=require(_0x224c('0x13'));var logger=require(_0x224c('0x14'))(_0x224c('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x224c('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5d6509,_0x5bb1b2){_0x5bb1b2=_0x5bb1b2||0xcc;return function(_0x2d64b9){if(_0x2d64b9){return _0x5d6509[_0x224c('0x17')](_0x5bb1b2);}return _0x5d6509[_0x224c('0x18')](_0x5bb1b2)[_0x224c('0x19')]();};}function respondWithResult(_0x61b155,_0x2e4ff3){_0x2e4ff3=_0x2e4ff3||0xc8;return function(_0x372820){if(_0x372820){return _0x61b155[_0x224c('0x18')](_0x2e4ff3)[_0x224c('0x1a')](_0x372820);}};}function respondWithFilteredResult(_0x51a05c,_0x259916){return function(_0x17d229){if(_0x17d229){var _0x8eacd5=typeof _0x259916[_0x224c('0x1b')]===_0x224c('0x1c')&&typeof _0x259916[_0x224c('0x1d')]==='undefined';var _0x56307a=_0x17d229['count'];var _0x5de001=_0x8eacd5?0x0:_0x259916[_0x224c('0x1b')];var _0x10f8a9=_0x8eacd5?_0x17d229['count']:_0x259916[_0x224c('0x1b')]+_0x259916[_0x224c('0x1d')];var _0x189ac6;if(_0x10f8a9>=_0x56307a){_0x10f8a9=_0x56307a;_0x189ac6=0xc8;}else{_0x189ac6=0xce;}_0x51a05c[_0x224c('0x18')](_0x189ac6);return _0x51a05c[_0x224c('0x1e')]('Content-Range',_0x5de001+'-'+_0x10f8a9+'/'+_0x56307a)[_0x224c('0x1a')](_0x17d229);}return null;};}function patchUpdates(_0x584e87){return function(_0x2b0e78){try{jsonpatch[_0x224c('0x1f')](_0x2b0e78,_0x584e87,!![]);}catch(_0x3ad29e){return BPromise[_0x224c('0x20')](_0x3ad29e);}return _0x2b0e78['save']();};}function saveUpdates(_0x3d991b,_0x5d37e9){return function(_0x2342ef){if(_0x2342ef){return _0x2342ef['update'](_0x3d991b)['then'](function(_0x279f07){return _0x279f07;});}return null;};}function removeEntity(_0x4248b3,_0x55b06f){return function(_0x2ce418){if(_0x2ce418){return _0x2ce418[_0x224c('0x21')]()['then'](function(){_0x4248b3[_0x224c('0x18')](0xcc)[_0x224c('0x19')]();});}};}function handleEntityNotFound(_0x1f8423,_0xc1fa37){return function(_0x51bf22){if(!_0x51bf22){_0x1f8423[_0x224c('0x17')](0x194);}return _0x51bf22;};}function handleError(_0x4f468b,_0x4e89b){_0x4e89b=_0x4e89b||0x1f4;return function(_0x1d706f){logger[_0x224c('0x22')](_0x1d706f['stack']);if(_0x1d706f[_0x224c('0x23')]){delete _0x1d706f[_0x224c('0x23')];}_0x4f468b[_0x224c('0x18')](_0x4e89b)[_0x224c('0x24')](_0x1d706f);};}exports['index']=function(_0x22b2e9,_0x27ce6a){var _0xae6d2c={},_0x56a8a1={},_0x4cb62f={'count':0x0,'rows':[]};var _0xd453ba=_[_0x224c('0x25')](db['AnalyticTreeReport']['rawAttributes'],function(_0x232120){return{'name':_0x232120[_0x224c('0x26')],'type':_0x232120[_0x224c('0x27')][_0x224c('0x28')]};});_0x56a8a1[_0x224c('0x29')]=_['map'](_0xd453ba,_0x224c('0x23'));_0x56a8a1[_0x224c('0x2a')]=_['keys'](_0x22b2e9[_0x224c('0x2a')]);_0x56a8a1[_0x224c('0x2b')]=_['intersection'](_0x56a8a1['model'],_0x56a8a1[_0x224c('0x2a')]);_0xae6d2c[_0x224c('0x2c')]=_['intersection'](_0x56a8a1['model'],qs[_0x224c('0x2d')](_0x22b2e9[_0x224c('0x2a')]['fields']));_0xae6d2c[_0x224c('0x2c')]=_0xae6d2c[_0x224c('0x2c')][_0x224c('0x2e')]?_0xae6d2c['attributes']:_0x56a8a1[_0x224c('0x29')];if(!_0x22b2e9[_0x224c('0x2a')]['hasOwnProperty'](_0x224c('0x2f'))){_0xae6d2c[_0x224c('0x1d')]=qs['limit'](_0x22b2e9[_0x224c('0x2a')][_0x224c('0x1d')]);_0xae6d2c[_0x224c('0x1b')]=qs['offset'](_0x22b2e9[_0x224c('0x2a')][_0x224c('0x1b')]);}_0xae6d2c[_0x224c('0x30')]=qs[_0x224c('0x31')](_0x22b2e9['query'][_0x224c('0x31')]);_0xae6d2c[_0x224c('0x32')]=qs[_0x224c('0x2b')](_[_0x224c('0x33')](_0x22b2e9[_0x224c('0x2a')],_0x56a8a1[_0x224c('0x2b')]),_0xd453ba);if(_0x22b2e9[_0x224c('0x2a')][_0x224c('0x34')]){_0xae6d2c['where']=_[_0x224c('0x35')](_0xae6d2c['where'],{'$or':_[_0x224c('0x25')](_0xd453ba,function(_0x3d9840){if(_0x3d9840[_0x224c('0x27')]!=='VIRTUAL'){var _0x231d99={};_0x231d99[_0x3d9840['name']]={'$like':'%'+_0x22b2e9[_0x224c('0x2a')]['filter']+'%'};return _0x231d99;}})});}_0xae6d2c=_[_0x224c('0x35')]({},_0xae6d2c,_0x22b2e9[_0x224c('0x36')]);var _0x2f0e47={'where':_0xae6d2c['where']};return db[_0x224c('0x37')][_0x224c('0x38')](_0x2f0e47)[_0x224c('0x39')](function(_0xf9f987){_0x4cb62f['count']=_0xf9f987;if(_0x22b2e9['query']['includeAll']){_0xae6d2c[_0x224c('0x3a')]=[{'all':!![]}];}return db[_0x224c('0x37')]['findAll'](_0xae6d2c);})[_0x224c('0x39')](function(_0x447510){_0x4cb62f[_0x224c('0x3b')]=_0x447510;return _0x4cb62f;})[_0x224c('0x39')](respondWithFilteredResult(_0x27ce6a,_0xae6d2c))['catch'](handleError(_0x27ce6a,null));};exports[_0x224c('0x3c')]=function(_0x170c66,_0xe1f548){var _0x4ed63d={'raw':!![],'where':{'id':_0x170c66[_0x224c('0x3d')]['id']}},_0x320d9e={};_0x320d9e[_0x224c('0x29')]=_[_0x224c('0x3e')](db['AnalyticTreeReport'][_0x224c('0x3f')]);_0x320d9e[_0x224c('0x2a')]=_[_0x224c('0x3e')](_0x170c66[_0x224c('0x2a')]);_0x320d9e['filters']=_[_0x224c('0x40')](_0x320d9e[_0x224c('0x29')],_0x320d9e[_0x224c('0x2a')]);_0x4ed63d['attributes']=_[_0x224c('0x40')](_0x320d9e[_0x224c('0x29')],qs[_0x224c('0x2d')](_0x170c66['query'][_0x224c('0x2d')]));_0x4ed63d[_0x224c('0x2c')]=_0x4ed63d['attributes'][_0x224c('0x2e')]?_0x4ed63d[_0x224c('0x2c')]:_0x320d9e[_0x224c('0x29')];if(_0x170c66['query']['includeAll']){_0x4ed63d[_0x224c('0x3a')]=[{'all':!![]}];}_0x4ed63d=_[_0x224c('0x35')]({},_0x4ed63d,_0x170c66['options']);return db[_0x224c('0x37')][_0x224c('0x41')](_0x4ed63d)[_0x224c('0x39')](handleEntityNotFound(_0xe1f548,null))[_0x224c('0x39')](respondWithResult(_0xe1f548,null))['catch'](handleError(_0xe1f548,null));};exports['create']=function(_0x3943db,_0x4d1ac2){return db[_0x224c('0x37')][_0x224c('0x42')](_0x3943db[_0x224c('0x43')],{})['then'](respondWithResult(_0x4d1ac2,0xc9))[_0x224c('0x44')](handleError(_0x4d1ac2,null));};exports[_0x224c('0x45')]=function(_0x4f124f,_0x2a2f50){if(_0x4f124f[_0x224c('0x43')]['id']){delete _0x4f124f[_0x224c('0x43')]['id'];}return db[_0x224c('0x37')][_0x224c('0x41')]({'where':{'id':_0x4f124f['params']['id']}})[_0x224c('0x39')](handleEntityNotFound(_0x2a2f50,null))[_0x224c('0x39')](saveUpdates(_0x4f124f[_0x224c('0x43')],null))[_0x224c('0x39')](respondWithResult(_0x2a2f50,null))['catch'](handleError(_0x2a2f50,null));};exports[_0x224c('0x21')]=function(_0x3b604c,_0x45c797){return db['AnalyticTreeReport'][_0x224c('0x41')]({'where':{'id':_0x3b604c[_0x224c('0x3d')]['id']}})[_0x224c('0x39')](handleEntityNotFound(_0x45c797,null))[_0x224c('0x39')](removeEntity(_0x45c797,null))[_0x224c('0x44')](handleError(_0x45c797,null));}; \ No newline at end of file +var _0x2e22=['hasOwnProperty','nolimit','order','sort','where','filter','merge','type','options','then','includeAll','include','findAll','catch','show','params','find','create','body','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','stack','name','send','map','AnalyticTreeReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length'];(function(_0x49f203,_0xae3dbe){var _0x5c7510=function(_0x496f8b){while(--_0x496f8b){_0x49f203['push'](_0x49f203['shift']());}};_0x5c7510(++_0xae3dbe);}(_0x2e22,0x17b));var _0x22e2=function(_0x4d5672,_0x4517e7){_0x4d5672=_0x4d5672-0x0;var _0x4a7aec=_0x2e22[_0x4d5672];return _0x4a7aec;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x22e2('0x0'));var zipdir=require(_0x22e2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x22e2('0x2'));var moment=require(_0x22e2('0x3'));var BPromise=require(_0x22e2('0x4'));var Mustache=require(_0x22e2('0x5'));var util=require(_0x22e2('0x6'));var path=require(_0x22e2('0x7'));var sox=require(_0x22e2('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x22e2('0x9'));var _=require(_0x22e2('0xa'));var squel=require(_0x22e2('0xb'));var crypto=require('crypto');var jsforce=require(_0x22e2('0xc'));var deskjs=require(_0x22e2('0xd'));var toCsv=require(_0x22e2('0xe'));var querystring=require(_0x22e2('0xf'));var Papa=require(_0x22e2('0x10'));var Redis=require(_0x22e2('0x11'));var authService=require(_0x22e2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x22e2('0x13'));var hardwareService=require(_0x22e2('0x14'));var logger=require(_0x22e2('0x15'))(_0x22e2('0x16'));var utils=require(_0x22e2('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2c06fb,_0x3e32e0){_0x3e32e0=_0x3e32e0||0xcc;return function(_0x41c709){if(_0x41c709){return _0x2c06fb[_0x22e2('0x18')](_0x3e32e0);}return _0x2c06fb[_0x22e2('0x19')](_0x3e32e0)['end']();};}function respondWithResult(_0x1c7c27,_0x2c4782){_0x2c4782=_0x2c4782||0xc8;return function(_0x24efd7){if(_0x24efd7){return _0x1c7c27[_0x22e2('0x19')](_0x2c4782)[_0x22e2('0x1a')](_0x24efd7);}};}function respondWithFilteredResult(_0x2b5699,_0x2a42fc){return function(_0x22e340){if(_0x22e340){var _0x594897=typeof _0x2a42fc[_0x22e2('0x1b')]===_0x22e2('0x1c')&&typeof _0x2a42fc[_0x22e2('0x1d')]===_0x22e2('0x1c');var _0x1909e2=_0x22e340['count'];var _0x2af03a=_0x594897?0x0:_0x2a42fc[_0x22e2('0x1b')];var _0xb2d6d5=_0x594897?_0x22e340[_0x22e2('0x1e')]:_0x2a42fc['offset']+_0x2a42fc[_0x22e2('0x1d')];var _0x4935c3;if(_0xb2d6d5>=_0x1909e2){_0xb2d6d5=_0x1909e2;_0x4935c3=0xc8;}else{_0x4935c3=0xce;}_0x2b5699[_0x22e2('0x19')](_0x4935c3);return _0x2b5699[_0x22e2('0x1f')]('Content-Range',_0x2af03a+'-'+_0xb2d6d5+'/'+_0x1909e2)['json'](_0x22e340);}return null;};}function patchUpdates(_0x354180){return function(_0x480d21){try{jsonpatch[_0x22e2('0x20')](_0x480d21,_0x354180,!![]);}catch(_0x5d154f){return BPromise[_0x22e2('0x21')](_0x5d154f);}return _0x480d21[_0x22e2('0x22')]();};}function saveUpdates(_0x4d30b2,_0x124eea){return function(_0xd7f20d){if(_0xd7f20d){return _0xd7f20d[_0x22e2('0x23')](_0x4d30b2)['then'](function(_0x5f44f3){return _0x5f44f3;});}return null;};}function removeEntity(_0x12ed4c,_0x318914){return function(_0x14bf42){if(_0x14bf42){return _0x14bf42[_0x22e2('0x24')]()['then'](function(){_0x12ed4c[_0x22e2('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa3a9ca,_0x12de67){return function(_0x336ecf){if(!_0x336ecf){_0xa3a9ca[_0x22e2('0x18')](0x194);}return _0x336ecf;};}function handleError(_0x5fc21c,_0x4c6150){_0x4c6150=_0x4c6150||0x1f4;return function(_0x1f77ce){logger['error'](_0x1f77ce[_0x22e2('0x25')]);if(_0x1f77ce[_0x22e2('0x26')]){delete _0x1f77ce[_0x22e2('0x26')];}_0x5fc21c[_0x22e2('0x19')](_0x4c6150)[_0x22e2('0x27')](_0x1f77ce);};}exports['index']=function(_0x56238c,_0x27a071){var _0x96a229={},_0x2d7124={},_0x5caa66={'count':0x0,'rows':[]};var _0x54c1f1=_[_0x22e2('0x28')](db[_0x22e2('0x29')][_0x22e2('0x2a')],function(_0x2f3556){return{'name':_0x2f3556[_0x22e2('0x2b')],'type':_0x2f3556['type'][_0x22e2('0x2c')]};});_0x2d7124[_0x22e2('0x2d')]=_[_0x22e2('0x28')](_0x54c1f1,'name');_0x2d7124[_0x22e2('0x2e')]=_[_0x22e2('0x2f')](_0x56238c['query']);_0x2d7124[_0x22e2('0x30')]=_[_0x22e2('0x31')](_0x2d7124['model'],_0x2d7124[_0x22e2('0x2e')]);_0x96a229['attributes']=_[_0x22e2('0x31')](_0x2d7124[_0x22e2('0x2d')],qs[_0x22e2('0x32')](_0x56238c[_0x22e2('0x2e')][_0x22e2('0x32')]));_0x96a229[_0x22e2('0x33')]=_0x96a229[_0x22e2('0x33')][_0x22e2('0x34')]?_0x96a229[_0x22e2('0x33')]:_0x2d7124[_0x22e2('0x2d')];if(!_0x56238c[_0x22e2('0x2e')][_0x22e2('0x35')](_0x22e2('0x36'))){_0x96a229['limit']=qs[_0x22e2('0x1d')](_0x56238c['query'][_0x22e2('0x1d')]);_0x96a229['offset']=qs[_0x22e2('0x1b')](_0x56238c[_0x22e2('0x2e')][_0x22e2('0x1b')]);}_0x96a229[_0x22e2('0x37')]=qs[_0x22e2('0x38')](_0x56238c[_0x22e2('0x2e')]['sort']);_0x96a229[_0x22e2('0x39')]=qs[_0x22e2('0x30')](_['pick'](_0x56238c['query'],_0x2d7124[_0x22e2('0x30')]),_0x54c1f1);if(_0x56238c[_0x22e2('0x2e')][_0x22e2('0x3a')]){_0x96a229[_0x22e2('0x39')]=_[_0x22e2('0x3b')](_0x96a229[_0x22e2('0x39')],{'$or':_['map'](_0x54c1f1,function(_0x46e02c){if(_0x46e02c[_0x22e2('0x3c')]!=='VIRTUAL'){var _0x62981d={};_0x62981d[_0x46e02c[_0x22e2('0x26')]]={'$like':'%'+_0x56238c['query'][_0x22e2('0x3a')]+'%'};return _0x62981d;}})});}_0x96a229=_[_0x22e2('0x3b')]({},_0x96a229,_0x56238c[_0x22e2('0x3d')]);var _0x418712={'where':_0x96a229[_0x22e2('0x39')]};return db[_0x22e2('0x29')][_0x22e2('0x1e')](_0x418712)[_0x22e2('0x3e')](function(_0x490f97){_0x5caa66[_0x22e2('0x1e')]=_0x490f97;if(_0x56238c[_0x22e2('0x2e')][_0x22e2('0x3f')]){_0x96a229[_0x22e2('0x40')]=[{'all':!![]}];}return db[_0x22e2('0x29')][_0x22e2('0x41')](_0x96a229);})[_0x22e2('0x3e')](function(_0x22c4ee){_0x5caa66['rows']=_0x22c4ee;return _0x5caa66;})['then'](respondWithFilteredResult(_0x27a071,_0x96a229))[_0x22e2('0x42')](handleError(_0x27a071,null));};exports[_0x22e2('0x43')]=function(_0x581e22,_0x225da3){var _0x574c46={'raw':!![],'where':{'id':_0x581e22[_0x22e2('0x44')]['id']}},_0x5d5586={};_0x5d5586['model']=_[_0x22e2('0x2f')](db['AnalyticTreeReport']['rawAttributes']);_0x5d5586['query']=_[_0x22e2('0x2f')](_0x581e22[_0x22e2('0x2e')]);_0x5d5586[_0x22e2('0x30')]=_['intersection'](_0x5d5586[_0x22e2('0x2d')],_0x5d5586[_0x22e2('0x2e')]);_0x574c46[_0x22e2('0x33')]=_['intersection'](_0x5d5586[_0x22e2('0x2d')],qs[_0x22e2('0x32')](_0x581e22[_0x22e2('0x2e')][_0x22e2('0x32')]));_0x574c46[_0x22e2('0x33')]=_0x574c46[_0x22e2('0x33')][_0x22e2('0x34')]?_0x574c46[_0x22e2('0x33')]:_0x5d5586[_0x22e2('0x2d')];if(_0x581e22[_0x22e2('0x2e')][_0x22e2('0x3f')]){_0x574c46[_0x22e2('0x40')]=[{'all':!![]}];}_0x574c46=_[_0x22e2('0x3b')]({},_0x574c46,_0x581e22[_0x22e2('0x3d')]);return db[_0x22e2('0x29')][_0x22e2('0x45')](_0x574c46)[_0x22e2('0x3e')](handleEntityNotFound(_0x225da3,null))[_0x22e2('0x3e')](respondWithResult(_0x225da3,null))[_0x22e2('0x42')](handleError(_0x225da3,null));};exports[_0x22e2('0x46')]=function(_0x26dbd9,_0x497f06){return db[_0x22e2('0x29')][_0x22e2('0x46')](_0x26dbd9['body'],{})[_0x22e2('0x3e')](respondWithResult(_0x497f06,0xc9))[_0x22e2('0x42')](handleError(_0x497f06,null));};exports[_0x22e2('0x23')]=function(_0x5edf53,_0x40add2){if(_0x5edf53[_0x22e2('0x47')]['id']){delete _0x5edf53[_0x22e2('0x47')]['id'];}return db[_0x22e2('0x29')][_0x22e2('0x45')]({'where':{'id':_0x5edf53[_0x22e2('0x44')]['id']}})[_0x22e2('0x3e')](handleEntityNotFound(_0x40add2,null))[_0x22e2('0x3e')](saveUpdates(_0x5edf53[_0x22e2('0x47')],null))[_0x22e2('0x3e')](respondWithResult(_0x40add2,null))['catch'](handleError(_0x40add2,null));};exports['destroy']=function(_0x5fcea3,_0x2f738e){return db[_0x22e2('0x29')][_0x22e2('0x45')]({'where':{'id':_0x5fcea3[_0x22e2('0x44')]['id']}})[_0x22e2('0x3e')](handleEntityNotFound(_0x2f738e,null))['then'](removeEntity(_0x2f738e,null))['catch'](handleError(_0x2f738e,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 86454de..5dc1748 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 _0x7fec=['analytics_report_trees','lodash','api','moment','bluebird','request-promise','path','rimraf','./analyticTreeReport.attributes','exports','AnalyticTreeReport'];(function(_0x3a34be,_0x43cc18){var _0x478b0e=function(_0x374709){while(--_0x374709){_0x3a34be['push'](_0x3a34be['shift']());}};_0x478b0e(++_0x43cc18);}(_0x7fec,0x114));var _0xc7fe=function(_0x35317b,_0x88e4d7){_0x35317b=_0x35317b-0x0;var _0x54ea05=_0x7fec[_0x35317b];return _0x54ea05;};'use strict';var _=require(_0xc7fe('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc7fe('0x1'));var moment=require(_0xc7fe('0x2'));var BPromise=require(_0xc7fe('0x3'));var rp=require(_0xc7fe('0x4'));var fs=require('fs');var path=require(_0xc7fe('0x5'));var rimraf=require(_0xc7fe('0x6'));var config=require('../../config/environment');var attributes=require(_0xc7fe('0x7'));module[_0xc7fe('0x8')]=function(_0x408a1d,_0x17b4d2){return _0x408a1d['define'](_0xc7fe('0x9'),attributes,{'tableName':_0xc7fe('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x12fb=['rimraf','../../config/environment','./analyticTreeReport.attributes','exports','define','AnalyticTreeReport','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x50b310,_0x599d64){var _0x1e1515=function(_0x302ada){while(--_0x302ada){_0x50b310['push'](_0x50b310['shift']());}};_0x1e1515(++_0x599d64);}(_0x12fb,0x1c6));var _0xb12f=function(_0x40a740,_0x5e1944){_0x40a740=_0x40a740-0x0;var _0x2b5bbb=_0x12fb[_0x40a740];return _0x2b5bbb;};'use strict';var _=require(_0xb12f('0x0'));var util=require(_0xb12f('0x1'));var logger=require(_0xb12f('0x2'))(_0xb12f('0x3'));var moment=require(_0xb12f('0x4'));var BPromise=require(_0xb12f('0x5'));var rp=require(_0xb12f('0x6'));var fs=require('fs');var path=require(_0xb12f('0x7'));var rimraf=require(_0xb12f('0x8'));var config=require(_0xb12f('0x9'));var attributes=require(_0xb12f('0xa'));module[_0xb12f('0xb')]=function(_0x7c2d54,_0x1bdbee){return _0x7c2d54[_0xb12f('0xc')](_0xb12f('0xd'),attributes,{'tableName':'analytics_report_trees','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index 0b44a0d..da45ecd 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 _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(_0x2c9596,_0x10d04a){var _0x41adb6=function(_0x43cbae){while(--_0x43cbae){_0x2c9596['push'](_0x2c9596['shift']());}};_0x41adb6(++_0x10d04a);}(_0x2ef3,0xba));var _0x32ef=function(_0x171d78,_0x211505){_0x171d78=_0x171d78-0x0;var _0x2c9914=_0x2ef3[_0x171d78];return _0x2c9914;};'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 +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(_0xf24d41,_0x165ced){var _0x2c1563=function(_0x269255){while(--_0x269255){_0xf24d41['push'](_0xf24d41['shift']());}};_0x2c1563(++_0x165ced);}(_0x1261,0x144));var _0x1126=function(_0x5ca353,_0x21eb37){_0x5ca353=_0x5ca353-0x0;var _0x4f2fe5=_0x1261[_0x5ca353];return _0x4f2fe5;};'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 diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index b5a9a4c..9198dcf 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 _0xda03=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','index','show','create','put','update','destroy','exports'];(function(_0x179290,_0x23da54){var _0x36905f=function(_0xb8f88c){while(--_0xb8f88c){_0x179290['push'](_0x179290['shift']());}};_0x36905f(++_0x23da54);}(_0xda03,0xdc));var _0x3da0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xda03[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x3da0('0x0'));var util=require(_0x3da0('0x1'));var path=require(_0x3da0('0x2'));var timeout=require(_0x3da0('0x3'));var express=require(_0x3da0('0x4'));var router=express[_0x3da0('0x5')]();var fs_extra=require(_0x3da0('0x6'));var auth=require(_0x3da0('0x7'));var interaction=require(_0x3da0('0x8'));var config=require(_0x3da0('0x9'));var controller=require(_0x3da0('0xa'));router[_0x3da0('0xb')]('/',auth[_0x3da0('0xc')](),controller[_0x3da0('0xd')]);router['get']('/:id',auth[_0x3da0('0xc')](),controller[_0x3da0('0xe')]);router['post']('/',auth[_0x3da0('0xc')](),controller[_0x3da0('0xf')]);router[_0x3da0('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x3da0('0x11')]);router['delete']('/:id',auth[_0x3da0('0xc')](),controller[_0x3da0('0x12')]);module[_0x3da0('0x13')]=router; \ No newline at end of file +var _0x852a=['../../config/environment','get','isAuthenticated','index','/:id','show','put','update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/interaction/service'];(function(_0x541cc4,_0x4e0979){var _0x94514c=function(_0x228441){while(--_0x228441){_0x541cc4['push'](_0x541cc4['shift']());}};_0x94514c(++_0x4e0979);}(_0x852a,0xd7));var _0xa852=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x852a[_0xbca1b1];return _0x4e1686;};'use strict';var multer=require(_0xa852('0x0'));var util=require(_0xa852('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa852('0x2'));var router=express[_0xa852('0x3')]();var fs_extra=require(_0xa852('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xa852('0x5'));var config=require(_0xa852('0x6'));var controller=require('./analyticTreeReport.controller');router[_0xa852('0x7')]('/',auth[_0xa852('0x8')](),controller[_0xa852('0x9')]);router[_0xa852('0x7')](_0xa852('0xa'),auth[_0xa852('0x8')](),controller[_0xa852('0xb')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xa852('0xc')](_0xa852('0xa'),auth[_0xa852('0x8')](),controller[_0xa852('0xd')]);router[_0xa852('0xe')](_0xa852('0xa'),auth['isAuthenticated'](),controller[_0xa852('0xf')]);module[_0xa852('0x10')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 0c9d7ca..06d7444 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 _0x8db0=['exports','STRING','sequelize'];(function(_0x77d310,_0x2b2fe7){var _0x2cdce4=function(_0xbaa481){while(--_0xbaa481){_0x77d310['push'](_0x77d310['shift']());}};_0x2cdce4(++_0x2b2fe7);}(_0x8db0,0x65));var _0x08db=function(_0x11a962,_0x3cc338){_0x11a962=_0x11a962-0x0;var _0x55d423=_0x8db0[_0x11a962];return _0x55d423;};'use strict';var Sequelize=require(_0x08db('0x0'));module[_0x08db('0x1')]={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0x08db('0x2')]},'type':{'type':Sequelize[_0x08db('0x2')]}}; \ No newline at end of file +var _0xa7dc=['sequelize','exports','STRING'];(function(_0xf5aede,_0x5b2e7f){var _0x5c6890=function(_0x12db0f){while(--_0x12db0f){_0xf5aede['push'](_0xf5aede['shift']());}};_0x5c6890(++_0x5b2e7f);}(_0xa7dc,0x11d));var _0xca7d=function(_0x9ce9b2,_0x1de6ef){_0x9ce9b2=_0x9ce9b2-0x0;var _0x5939b7=_0xa7dc[_0x9ce9b2];return _0x5939b7;};'use strict';var Sequelize=require(_0xca7d('0x0'));module[_0xca7d('0x1')]={'name':{'type':Sequelize[_0xca7d('0x2')]},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xca7d('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 341b27d..f437de3 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 _0x3a9a=['set','Content-Range','json','apply','reject','save','update','destroy','then','status','error','stack','name','send','index','map','Attachment','fieldName','type','key','model','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','catch','show','rawAttributes','intersection','length','includeAll','clone','params','get','omit','createdAt','updatedAt','body','create','find','file','originalname','basename','filename','download','findOne','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','rimraf','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../mysqldb','sendStatus','end','offset','undefined','count','limit'];(function(_0xa5a0b4,_0x144a09){var _0x2f1d72=function(_0x52fe78){while(--_0x52fe78){_0xa5a0b4['push'](_0xa5a0b4['shift']());}};_0x2f1d72(++_0x144a09);}(_0x3a9a,0x149));var _0xa3a9=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0x3a9a[_0x525c7b];return _0x27b33e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa3a9('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa3a9('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa3a9('0x2'));var Mustache=require(_0xa3a9('0x3'));var util=require(_0xa3a9('0x4'));var path=require(_0xa3a9('0x5'));var sox=require('sox');var csv=require(_0xa3a9('0x6'));var ejs=require(_0xa3a9('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa3a9('0x8'));var squel=require(_0xa3a9('0x9'));var crypto=require(_0xa3a9('0xa'));var jsforce=require(_0xa3a9('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xa3a9('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa3a9('0xc'));var authService=require('../../components/auth/service');var qs=require(_0xa3a9('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa3a9('0xe'))('api');var utils=require(_0xa3a9('0xf'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xa3a9('0x10'))['db'];function respondWithStatusCode(_0x1ed4fd,_0x5b3e87){_0x5b3e87=_0x5b3e87||0xcc;return function(_0x787ca9){if(_0x787ca9){return _0x1ed4fd[_0xa3a9('0x11')](_0x5b3e87);}return _0x1ed4fd['status'](_0x5b3e87)[_0xa3a9('0x12')]();};}function respondWithResult(_0x5aea07,_0x52a41b){_0x52a41b=_0x52a41b||0xc8;return function(_0xc5eb8d){if(_0xc5eb8d){return _0x5aea07['status'](_0x52a41b)['json'](_0xc5eb8d);}};}function respondWithFilteredResult(_0x363696,_0x4dbdd1){return function(_0x515731){if(_0x515731){var _0x23bbd3=typeof _0x4dbdd1[_0xa3a9('0x13')]===_0xa3a9('0x14')&&typeof _0x4dbdd1['limit']===_0xa3a9('0x14');var _0x4b4aa8=_0x515731['count'];var _0x34cc0e=_0x23bbd3?0x0:_0x4dbdd1[_0xa3a9('0x13')];var _0x3cf7d9=_0x23bbd3?_0x515731[_0xa3a9('0x15')]:_0x4dbdd1[_0xa3a9('0x13')]+_0x4dbdd1[_0xa3a9('0x16')];var _0x247f28;if(_0x3cf7d9>=_0x4b4aa8){_0x3cf7d9=_0x4b4aa8;_0x247f28=0xc8;}else{_0x247f28=0xce;}_0x363696['status'](_0x247f28);return _0x363696[_0xa3a9('0x17')](_0xa3a9('0x18'),_0x34cc0e+'-'+_0x3cf7d9+'/'+_0x4b4aa8)[_0xa3a9('0x19')](_0x515731);}return null;};}function patchUpdates(_0x3c2e7d){return function(_0xca519f){try{jsonpatch[_0xa3a9('0x1a')](_0xca519f,_0x3c2e7d,!![]);}catch(_0x123218){return BPromise[_0xa3a9('0x1b')](_0x123218);}return _0xca519f[_0xa3a9('0x1c')]();};}function saveUpdates(_0x45a544,_0xd106f6){return function(_0x502963){if(_0x502963){return _0x502963[_0xa3a9('0x1d')](_0x45a544)['then'](function(_0x17771f){return _0x17771f;});}return null;};}function removeEntity(_0x88644e,_0x210cce){return function(_0x5e46fc){if(_0x5e46fc){return _0x5e46fc[_0xa3a9('0x1e')]()[_0xa3a9('0x1f')](function(){_0x88644e[_0xa3a9('0x20')](0xcc)[_0xa3a9('0x12')]();});}};}function handleEntityNotFound(_0x50dde1,_0x1e78ba){return function(_0x13eeed){if(!_0x13eeed){_0x50dde1[_0xa3a9('0x11')](0x194);}return _0x13eeed;};}function handleError(_0x3180a5,_0x2f66f6){_0x2f66f6=_0x2f66f6||0x1f4;return function(_0x1a3618){logger[_0xa3a9('0x21')](_0x1a3618[_0xa3a9('0x22')]);if(_0x1a3618[_0xa3a9('0x23')]){delete _0x1a3618[_0xa3a9('0x23')];}_0x3180a5[_0xa3a9('0x20')](_0x2f66f6)[_0xa3a9('0x24')](_0x1a3618);};}exports[_0xa3a9('0x25')]=function(_0x5993fd,_0x4e2ca4){var _0x19a652={},_0x4d1633={},_0x32385f={'count':0x0,'rows':[]};var _0x3b3345=_[_0xa3a9('0x26')](db[_0xa3a9('0x27')]['rawAttributes'],function(_0x2b77b2){return{'name':_0x2b77b2[_0xa3a9('0x28')],'type':_0x2b77b2[_0xa3a9('0x29')][_0xa3a9('0x2a')]};});_0x4d1633[_0xa3a9('0x2b')]=_[_0xa3a9('0x26')](_0x3b3345,'name');_0x4d1633[_0xa3a9('0x2c')]=_[_0xa3a9('0x2d')](_0x5993fd[_0xa3a9('0x2c')]);_0x4d1633[_0xa3a9('0x2e')]=_['intersection'](_0x4d1633[_0xa3a9('0x2b')],_0x4d1633[_0xa3a9('0x2c')]);_0x19a652[_0xa3a9('0x2f')]=_['intersection'](_0x4d1633['model'],qs['fields'](_0x5993fd[_0xa3a9('0x2c')][_0xa3a9('0x30')]));_0x19a652['attributes']=_0x19a652[_0xa3a9('0x2f')]['length']?_0x19a652[_0xa3a9('0x2f')]:_0x4d1633[_0xa3a9('0x2b')];if(!_0x5993fd['query'][_0xa3a9('0x31')](_0xa3a9('0x32'))){_0x19a652[_0xa3a9('0x16')]=qs['limit'](_0x5993fd[_0xa3a9('0x2c')]['limit']);_0x19a652['offset']=qs[_0xa3a9('0x13')](_0x5993fd[_0xa3a9('0x2c')]['offset']);}_0x19a652[_0xa3a9('0x33')]=qs[_0xa3a9('0x34')](_0x5993fd[_0xa3a9('0x2c')]['sort']);_0x19a652['where']=qs[_0xa3a9('0x2e')](_[_0xa3a9('0x35')](_0x5993fd['query'],_0x4d1633[_0xa3a9('0x2e')]),_0x3b3345);if(_0x5993fd[_0xa3a9('0x2c')][_0xa3a9('0x36')]){_0x19a652[_0xa3a9('0x37')]=_[_0xa3a9('0x38')](_0x19a652['where'],{'$or':_[_0xa3a9('0x26')](_0x3b3345,function(_0x49db61){if(_0x49db61[_0xa3a9('0x29')]!==_0xa3a9('0x39')){var _0x3850cf={};_0x3850cf[_0x49db61[_0xa3a9('0x23')]]={'$like':'%'+_0x5993fd[_0xa3a9('0x2c')][_0xa3a9('0x36')]+'%'};return _0x3850cf;}})});}_0x19a652=_[_0xa3a9('0x38')]({},_0x19a652,_0x5993fd[_0xa3a9('0x3a')]);var _0x41abf4={'where':_0x19a652['where']};return db[_0xa3a9('0x27')][_0xa3a9('0x15')](_0x41abf4)[_0xa3a9('0x1f')](function(_0x371a74){_0x32385f[_0xa3a9('0x15')]=_0x371a74;if(_0x5993fd['query']['includeAll']){_0x19a652[_0xa3a9('0x3b')]=[{'all':!![]}];}return db[_0xa3a9('0x27')][_0xa3a9('0x3c')](_0x19a652);})[_0xa3a9('0x1f')](function(_0x44ba4a){_0x32385f[_0xa3a9('0x3d')]=_0x44ba4a;return _0x32385f;})[_0xa3a9('0x1f')](respondWithFilteredResult(_0x4e2ca4,_0x19a652))[_0xa3a9('0x3e')](handleError(_0x4e2ca4,null));};exports[_0xa3a9('0x3f')]=function(_0x5d9847,_0x2a3c3c){var _0x10f7e5={'raw':!![],'where':{'id':_0x5d9847['params']['id']}},_0x51483b={};_0x51483b['model']=_[_0xa3a9('0x2d')](db[_0xa3a9('0x27')][_0xa3a9('0x40')]);_0x51483b[_0xa3a9('0x2c')]=_[_0xa3a9('0x2d')](_0x5d9847[_0xa3a9('0x2c')]);_0x51483b['filters']=_[_0xa3a9('0x41')](_0x51483b[_0xa3a9('0x2b')],_0x51483b[_0xa3a9('0x2c')]);_0x10f7e5[_0xa3a9('0x2f')]=_[_0xa3a9('0x41')](_0x51483b[_0xa3a9('0x2b')],qs[_0xa3a9('0x30')](_0x5d9847[_0xa3a9('0x2c')][_0xa3a9('0x30')]));_0x10f7e5[_0xa3a9('0x2f')]=_0x10f7e5[_0xa3a9('0x2f')][_0xa3a9('0x42')]?_0x10f7e5[_0xa3a9('0x2f')]:_0x51483b[_0xa3a9('0x2b')];if(_0x5d9847['query'][_0xa3a9('0x43')]){_0x10f7e5['include']=[{'all':!![]}];}_0x10f7e5=_[_0xa3a9('0x38')]({},_0x10f7e5,_0x5d9847[_0xa3a9('0x3a')]);return db['Attachment']['find'](_0x10f7e5)[_0xa3a9('0x1f')](handleEntityNotFound(_0x2a3c3c,null))[_0xa3a9('0x1f')](respondWithResult(_0x2a3c3c,null))[_0xa3a9('0x3e')](handleError(_0x2a3c3c,null));};exports[_0xa3a9('0x44')]=function(_0x1582a8,_0x57146b){var _0x171a78={'where':{'id':_0x1582a8[_0xa3a9('0x45')]['id']}},_0x2524dc={};_0x2524dc[_0xa3a9('0x2b')]=_[_0xa3a9('0x2d')](db[_0xa3a9('0x27')]['rawAttributes']);_0x171a78[_0xa3a9('0x2f')]=_[_0xa3a9('0x41')](_0x2524dc[_0xa3a9('0x2b')],qs[_0xa3a9('0x30')](_0x1582a8[_0xa3a9('0x2c')][_0xa3a9('0x30')]));_0x171a78[_0xa3a9('0x2f')]=_0x171a78[_0xa3a9('0x2f')][_0xa3a9('0x42')]?_0x171a78[_0xa3a9('0x2f')]:_0x2524dc[_0xa3a9('0x2b')];if(_0x1582a8[_0xa3a9('0x2c')][_0xa3a9('0x43')]){_0x171a78[_0xa3a9('0x3b')]=[{'all':!![]}];}_0x171a78=_[_0xa3a9('0x38')]({},_0x171a78,_0x1582a8[_0xa3a9('0x3a')]);return db[_0xa3a9('0x27')]['find'](_0x171a78)['then'](handleEntityNotFound(_0x57146b,null))[_0xa3a9('0x1f')](function(_0x26bacc){if(_0x26bacc){var _0x4bb3b5=_0x26bacc[_0xa3a9('0x46')]({'plain':!![]});_0x4bb3b5=qs[_0xa3a9('0x47')](_0x4bb3b5,['id',_0xa3a9('0x48'),_0xa3a9('0x49')]);_0x1582a8['body']=_[_0xa3a9('0x47')](_0x1582a8[_0xa3a9('0x4a')],['id','createdAt',_0xa3a9('0x49')]);return db[_0xa3a9('0x27')][_0xa3a9('0x4b')](_[_0xa3a9('0x38')](_0x4bb3b5,_0x1582a8[_0xa3a9('0x4a')]),{'include':_0x1582a8['query']['includeAll']?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x57146b,0xc9))['catch'](handleError(_0x57146b,null));};exports[_0xa3a9('0x1d')]=function(_0x4bac92,_0x4f19af){if(_0x4bac92['body']['id']){delete _0x4bac92[_0xa3a9('0x4a')]['id'];}return db[_0xa3a9('0x27')][_0xa3a9('0x4c')]({'where':{'id':_0x4bac92[_0xa3a9('0x45')]['id']}})['then'](handleEntityNotFound(_0x4f19af,null))['then'](saveUpdates(_0x4bac92[_0xa3a9('0x4a')],null))[_0xa3a9('0x1f')](respondWithResult(_0x4f19af,null))['catch'](handleError(_0x4f19af,null));};exports['destroy']=function(_0x4aef70,_0x56b6df){return db['Attachment'][_0xa3a9('0x4c')]({'where':{'id':_0x4aef70[_0xa3a9('0x45')]['id']}})[_0xa3a9('0x1f')](handleEntityNotFound(_0x56b6df,null))[_0xa3a9('0x1f')](removeEntity(_0x56b6df,null))[_0xa3a9('0x3e')](handleError(_0x56b6df,null));};exports['create']=function(_0x259c9e,_0x30feb8,_0x4cb2bf){_0x259c9e[_0xa3a9('0x4a')][_0xa3a9('0x23')]=_0x259c9e[_0xa3a9('0x4d')][_0xa3a9('0x4e')];_0x259c9e['body'][_0xa3a9('0x4f')]=_0x259c9e[_0xa3a9('0x4d')][_0xa3a9('0x50')];_0x259c9e['body'][_0xa3a9('0x29')]=_0x259c9e[_0xa3a9('0x4d')]['mimetype'];return db[_0xa3a9('0x27')][_0xa3a9('0x4b')](_0x259c9e['body'])[_0xa3a9('0x1f')](respondWithResult(_0x30feb8,0xc9))['catch'](handleError(_0x30feb8,null));};exports[_0xa3a9('0x51')]=function(_0x3d1ece,_0x203830,_0x20406d){return db[_0xa3a9('0x27')][_0xa3a9('0x52')]({'where':{'id':_0x3d1ece['params']['id']},'raw':!![]})[_0xa3a9('0x1f')](handleEntityNotFound(_0x203830,null))['then'](function(_0x3211a0){if(_0x3211a0){var _0x51a31c=_0x3211a0[_0xa3a9('0x53')]!==null;var _0x3e07b6=path[_0xa3a9('0x54')](config[_0xa3a9('0x55')],_0xa3a9('0x56'));if(_0x51a31c){_0x3e07b6=path[_0xa3a9('0x54')](_0x3e07b6,_0xa3a9('0x57'));}var _0x68690b=path[_0xa3a9('0x54')](_0x3e07b6,_0x3211a0[_0xa3a9('0x4f')]);return _0x203830[_0xa3a9('0x51')](_0x68690b);}})[_0xa3a9('0x3e')](handleError(_0x203830,null));}; \ No newline at end of file +var _0x7954=['nolimit','order','sort','pick','filters','where','merge','map','filter','options','count','includeAll','include','Attachment','rows','catch','show','params','fields','clone','get','omit','createdAt','updatedAt','body','create','find','originalname','basename','filename','download','findOne','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','set','Content-Range','apply','reject','update','destroy','then','end','error','stack','name','send','index','rawAttributes','type','model','query','keys','intersection','attributes','length','hasOwnProperty'];(function(_0x32139a,_0x36ec8c){var _0x33e57b=function(_0x49407a){while(--_0x49407a){_0x32139a['push'](_0x32139a['shift']());}};_0x33e57b(++_0x36ec8c);}(_0x7954,0x191));var _0x4795=function(_0xb67251,_0x1f6208){_0xb67251=_0xb67251-0x0;var _0x979d96=_0x7954[_0xb67251];return _0x979d96;};'use strict';var emlformat=require(_0x4795('0x0'));var rimraf=require(_0x4795('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4795('0x2'));var rp=require(_0x4795('0x3'));var moment=require(_0x4795('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4795('0x5'));var util=require('util');var path=require(_0x4795('0x6'));var sox=require(_0x4795('0x7'));var csv=require('to-csv');var ejs=require(_0x4795('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4795('0x9'));var squel=require(_0x4795('0xa'));var crypto=require(_0x4795('0xb'));var jsforce=require(_0x4795('0xc'));var deskjs=require(_0x4795('0xd'));var toCsv=require(_0x4795('0xe'));var querystring=require(_0x4795('0xf'));var Papa=require('papaparse');var Redis=require(_0x4795('0x10'));var authService=require(_0x4795('0x11'));var qs=require(_0x4795('0x12'));var as=require(_0x4795('0x13'));var hardwareService=require(_0x4795('0x14'));var logger=require(_0x4795('0x15'))(_0x4795('0x16'));var utils=require(_0x4795('0x17'));var config=require(_0x4795('0x18'));var licenseUtil=require(_0x4795('0x19'));var db=require(_0x4795('0x1a'))['db'];function respondWithStatusCode(_0x136797,_0x4a0b5f){_0x4a0b5f=_0x4a0b5f||0xcc;return function(_0x58c024){if(_0x58c024){return _0x136797[_0x4795('0x1b')](_0x4a0b5f);}return _0x136797[_0x4795('0x1c')](_0x4a0b5f)['end']();};}function respondWithResult(_0x174b7c,_0x52c7e3){_0x52c7e3=_0x52c7e3||0xc8;return function(_0x552849){if(_0x552849){return _0x174b7c[_0x4795('0x1c')](_0x52c7e3)['json'](_0x552849);}};}function respondWithFilteredResult(_0x40e1b9,_0xd5c4c){return function(_0x4ef416){if(_0x4ef416){var _0x293f5b=typeof _0xd5c4c[_0x4795('0x1d')]===_0x4795('0x1e')&&typeof _0xd5c4c['limit']===_0x4795('0x1e');var _0x5a88f4=_0x4ef416['count'];var _0x532c89=_0x293f5b?0x0:_0xd5c4c[_0x4795('0x1d')];var _0x5a0eac=_0x293f5b?_0x4ef416['count']:_0xd5c4c[_0x4795('0x1d')]+_0xd5c4c[_0x4795('0x1f')];var _0x1901ef;if(_0x5a0eac>=_0x5a88f4){_0x5a0eac=_0x5a88f4;_0x1901ef=0xc8;}else{_0x1901ef=0xce;}_0x40e1b9[_0x4795('0x1c')](_0x1901ef);return _0x40e1b9[_0x4795('0x20')](_0x4795('0x21'),_0x532c89+'-'+_0x5a0eac+'/'+_0x5a88f4)['json'](_0x4ef416);}return null;};}function patchUpdates(_0x152049){return function(_0x1d64cb){try{jsonpatch[_0x4795('0x22')](_0x1d64cb,_0x152049,!![]);}catch(_0xd6c796){return BPromise[_0x4795('0x23')](_0xd6c796);}return _0x1d64cb['save']();};}function saveUpdates(_0x5e5d38,_0x4ef544){return function(_0x396165){if(_0x396165){return _0x396165[_0x4795('0x24')](_0x5e5d38)['then'](function(_0x1cbc91){return _0x1cbc91;});}return null;};}function removeEntity(_0x3eb61e,_0x2f620b){return function(_0x32b430){if(_0x32b430){return _0x32b430[_0x4795('0x25')]()[_0x4795('0x26')](function(){_0x3eb61e[_0x4795('0x1c')](0xcc)[_0x4795('0x27')]();});}};}function handleEntityNotFound(_0x5e7da9,_0x4e705c){return function(_0xb4170b){if(!_0xb4170b){_0x5e7da9[_0x4795('0x1b')](0x194);}return _0xb4170b;};}function handleError(_0x54fd09,_0x1cd34a){_0x1cd34a=_0x1cd34a||0x1f4;return function(_0x373008){logger[_0x4795('0x28')](_0x373008[_0x4795('0x29')]);if(_0x373008[_0x4795('0x2a')]){delete _0x373008[_0x4795('0x2a')];}_0x54fd09[_0x4795('0x1c')](_0x1cd34a)[_0x4795('0x2b')](_0x373008);};}exports[_0x4795('0x2c')]=function(_0x117bdd,_0x82203e){var _0x39fd43={},_0x597228={},_0x2770da={'count':0x0,'rows':[]};var _0x92cc7b=_['map'](db['Attachment'][_0x4795('0x2d')],function(_0x1608cb){return{'name':_0x1608cb['fieldName'],'type':_0x1608cb[_0x4795('0x2e')]['key']};});_0x597228[_0x4795('0x2f')]=_['map'](_0x92cc7b,_0x4795('0x2a'));_0x597228[_0x4795('0x30')]=_[_0x4795('0x31')](_0x117bdd['query']);_0x597228['filters']=_[_0x4795('0x32')](_0x597228[_0x4795('0x2f')],_0x597228[_0x4795('0x30')]);_0x39fd43[_0x4795('0x33')]=_[_0x4795('0x32')](_0x597228[_0x4795('0x2f')],qs['fields'](_0x117bdd[_0x4795('0x30')]['fields']));_0x39fd43[_0x4795('0x33')]=_0x39fd43['attributes'][_0x4795('0x34')]?_0x39fd43[_0x4795('0x33')]:_0x597228[_0x4795('0x2f')];if(!_0x117bdd[_0x4795('0x30')][_0x4795('0x35')](_0x4795('0x36'))){_0x39fd43[_0x4795('0x1f')]=qs[_0x4795('0x1f')](_0x117bdd[_0x4795('0x30')]['limit']);_0x39fd43['offset']=qs[_0x4795('0x1d')](_0x117bdd['query'][_0x4795('0x1d')]);}_0x39fd43[_0x4795('0x37')]=qs[_0x4795('0x38')](_0x117bdd[_0x4795('0x30')]['sort']);_0x39fd43['where']=qs['filters'](_[_0x4795('0x39')](_0x117bdd[_0x4795('0x30')],_0x597228[_0x4795('0x3a')]),_0x92cc7b);if(_0x117bdd[_0x4795('0x30')]['filter']){_0x39fd43[_0x4795('0x3b')]=_[_0x4795('0x3c')](_0x39fd43['where'],{'$or':_[_0x4795('0x3d')](_0x92cc7b,function(_0x301c94){if(_0x301c94[_0x4795('0x2e')]!=='VIRTUAL'){var _0x1b1675={};_0x1b1675[_0x301c94[_0x4795('0x2a')]]={'$like':'%'+_0x117bdd['query'][_0x4795('0x3e')]+'%'};return _0x1b1675;}})});}_0x39fd43=_[_0x4795('0x3c')]({},_0x39fd43,_0x117bdd[_0x4795('0x3f')]);var _0x4eee99={'where':_0x39fd43[_0x4795('0x3b')]};return db['Attachment']['count'](_0x4eee99)[_0x4795('0x26')](function(_0x22f0fa){_0x2770da[_0x4795('0x40')]=_0x22f0fa;if(_0x117bdd[_0x4795('0x30')][_0x4795('0x41')]){_0x39fd43[_0x4795('0x42')]=[{'all':!![]}];}return db[_0x4795('0x43')]['findAll'](_0x39fd43);})[_0x4795('0x26')](function(_0xdc1803){_0x2770da[_0x4795('0x44')]=_0xdc1803;return _0x2770da;})[_0x4795('0x26')](respondWithFilteredResult(_0x82203e,_0x39fd43))[_0x4795('0x45')](handleError(_0x82203e,null));};exports[_0x4795('0x46')]=function(_0x21982c,_0x4633e0){var _0x15ab9e={'raw':!![],'where':{'id':_0x21982c[_0x4795('0x47')]['id']}},_0x10ffe9={};_0x10ffe9[_0x4795('0x2f')]=_['keys'](db[_0x4795('0x43')][_0x4795('0x2d')]);_0x10ffe9[_0x4795('0x30')]=_['keys'](_0x21982c[_0x4795('0x30')]);_0x10ffe9[_0x4795('0x3a')]=_[_0x4795('0x32')](_0x10ffe9['model'],_0x10ffe9[_0x4795('0x30')]);_0x15ab9e[_0x4795('0x33')]=_[_0x4795('0x32')](_0x10ffe9[_0x4795('0x2f')],qs['fields'](_0x21982c[_0x4795('0x30')][_0x4795('0x48')]));_0x15ab9e['attributes']=_0x15ab9e[_0x4795('0x33')]['length']?_0x15ab9e[_0x4795('0x33')]:_0x10ffe9[_0x4795('0x2f')];if(_0x21982c[_0x4795('0x30')][_0x4795('0x41')]){_0x15ab9e['include']=[{'all':!![]}];}_0x15ab9e=_[_0x4795('0x3c')]({},_0x15ab9e,_0x21982c[_0x4795('0x3f')]);return db[_0x4795('0x43')]['find'](_0x15ab9e)[_0x4795('0x26')](handleEntityNotFound(_0x4633e0,null))[_0x4795('0x26')](respondWithResult(_0x4633e0,null))[_0x4795('0x45')](handleError(_0x4633e0,null));};exports[_0x4795('0x49')]=function(_0x2ab15a,_0x21cc88){var _0x30cdf3={'where':{'id':_0x2ab15a[_0x4795('0x47')]['id']}},_0x3095dd={};_0x3095dd['model']=_[_0x4795('0x31')](db[_0x4795('0x43')][_0x4795('0x2d')]);_0x30cdf3[_0x4795('0x33')]=_[_0x4795('0x32')](_0x3095dd[_0x4795('0x2f')],qs['fields'](_0x2ab15a['query']['fields']));_0x30cdf3['attributes']=_0x30cdf3['attributes'][_0x4795('0x34')]?_0x30cdf3[_0x4795('0x33')]:_0x3095dd['model'];if(_0x2ab15a['query'][_0x4795('0x41')]){_0x30cdf3[_0x4795('0x42')]=[{'all':!![]}];}_0x30cdf3=_[_0x4795('0x3c')]({},_0x30cdf3,_0x2ab15a['options']);return db[_0x4795('0x43')]['find'](_0x30cdf3)['then'](handleEntityNotFound(_0x21cc88,null))['then'](function(_0x438b93){if(_0x438b93){var _0xee1f06=_0x438b93[_0x4795('0x4a')]({'plain':!![]});_0xee1f06=qs[_0x4795('0x4b')](_0xee1f06,['id',_0x4795('0x4c'),_0x4795('0x4d')]);_0x2ab15a[_0x4795('0x4e')]=_[_0x4795('0x4b')](_0x2ab15a['body'],['id','createdAt','updatedAt']);return db['Attachment'][_0x4795('0x4f')](_[_0x4795('0x3c')](_0xee1f06,_0x2ab15a[_0x4795('0x4e')]),{'include':_0x2ab15a['query'][_0x4795('0x41')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x21cc88,0xc9))[_0x4795('0x45')](handleError(_0x21cc88,null));};exports['update']=function(_0x312586,_0x83e9ff){if(_0x312586[_0x4795('0x4e')]['id']){delete _0x312586[_0x4795('0x4e')]['id'];}return db['Attachment'][_0x4795('0x50')]({'where':{'id':_0x312586['params']['id']}})['then'](handleEntityNotFound(_0x83e9ff,null))[_0x4795('0x26')](saveUpdates(_0x312586[_0x4795('0x4e')],null))[_0x4795('0x26')](respondWithResult(_0x83e9ff,null))[_0x4795('0x45')](handleError(_0x83e9ff,null));};exports[_0x4795('0x25')]=function(_0x5bc6bd,_0x29c49a){return db[_0x4795('0x43')][_0x4795('0x50')]({'where':{'id':_0x5bc6bd['params']['id']}})['then'](handleEntityNotFound(_0x29c49a,null))[_0x4795('0x26')](removeEntity(_0x29c49a,null))[_0x4795('0x45')](handleError(_0x29c49a,null));};exports[_0x4795('0x4f')]=function(_0x1ecc56,_0xd4ed02,_0x1eed0b){_0x1ecc56[_0x4795('0x4e')][_0x4795('0x2a')]=_0x1ecc56['file'][_0x4795('0x51')];_0x1ecc56['body'][_0x4795('0x52')]=_0x1ecc56['file'][_0x4795('0x53')];_0x1ecc56['body']['type']=_0x1ecc56['file']['mimetype'];return db[_0x4795('0x43')]['create'](_0x1ecc56[_0x4795('0x4e')])['then'](respondWithResult(_0xd4ed02,0xc9))[_0x4795('0x45')](handleError(_0xd4ed02,null));};exports[_0x4795('0x54')]=function(_0x3d3094,_0x1b4a19,_0x462613){return db[_0x4795('0x43')][_0x4795('0x55')]({'where':{'id':_0x3d3094[_0x4795('0x47')]['id']},'raw':!![]})[_0x4795('0x26')](handleEntityNotFound(_0x1b4a19,null))[_0x4795('0x26')](function(_0x4b622b){if(_0x4b622b){var _0x21014e=_0x4b622b[_0x4795('0x56')]!==null;var _0x2ff2f1=path[_0x4795('0x57')](config[_0x4795('0x58')],_0x4795('0x59'));if(_0x21014e){_0x2ff2f1=path[_0x4795('0x57')](_0x2ff2f1,_0x4795('0x5a'));}var _0x1f0143=path['join'](_0x2ff2f1,_0x4b622b[_0x4795('0x52')]);return _0x1b4a19['download'](_0x1f0143);}})[_0x4795('0x45')](handleError(_0x1b4a19,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index f68f47c..20d8c5b 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 _0xe563=['util','../../config/logger','api','request-promise','path','../../config/environment','./attachment.attributes','exports','define','Attachment','attachments','lodash'];(function(_0x1f46b0,_0x539013){var _0x5e4365=function(_0x297dd8){while(--_0x297dd8){_0x1f46b0['push'](_0x1f46b0['shift']());}};_0x5e4365(++_0x539013);}(_0xe563,0x113));var _0x3e56=function(_0x122bd6,_0x1c92bd){_0x122bd6=_0x122bd6-0x0;var _0x2ee437=_0xe563[_0x122bd6];return _0x2ee437;};'use strict';var _=require(_0x3e56('0x0'));var util=require(_0x3e56('0x1'));var logger=require(_0x3e56('0x2'))(_0x3e56('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3e56('0x4'));var fs=require('fs');var path=require(_0x3e56('0x5'));var rimraf=require('rimraf');var config=require(_0x3e56('0x6'));var attributes=require(_0x3e56('0x7'));module[_0x3e56('0x8')]=function(_0x33fdcc,_0x4da54c){return _0x33fdcc[_0x3e56('0x9')](_0x3e56('0xa'),attributes,{'tableName':_0x3e56('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc2e2=['Attachment','attachments','lodash','util','../../config/logger','moment','request-promise','path','../../config/environment','./attachment.attributes','exports','define'];(function(_0x20e8d6,_0x4d9a75){var _0x44ea29=function(_0x1eb036){while(--_0x1eb036){_0x20e8d6['push'](_0x20e8d6['shift']());}};_0x44ea29(++_0x4d9a75);}(_0xc2e2,0xf2));var _0x2c2e=function(_0x35c7e3,_0xf2b5b1){_0x35c7e3=_0x35c7e3-0x0;var _0x48bcbd=_0xc2e2[_0x35c7e3];return _0x48bcbd;};'use strict';var _=require(_0x2c2e('0x0'));var util=require(_0x2c2e('0x1'));var logger=require(_0x2c2e('0x2'))('api');var moment=require(_0x2c2e('0x3'));var BPromise=require('bluebird');var rp=require(_0x2c2e('0x4'));var fs=require('fs');var path=require(_0x2c2e('0x5'));var rimraf=require('rimraf');var config=require(_0x2c2e('0x6'));var attributes=require(_0x2c2e('0x7'));module[_0x2c2e('0x8')]=function(_0x47efad,_0x2d61c1){return _0x47efad[_0x2c2e('0x9')](_0x2c2e('0xa'),attributes,{'tableName':_0x2c2e('0xb'),'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 4fc802e..ee2a9fe 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 _0x0ba7=['rpc','../../config/environment','jayson/promise','client','http','request','then','Attachment,\x20%s,\x20%s','debug','Attachment,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','message','error','info','result','catch','CreateAttachment','Attachment','create','body','options','raw','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x50c05a,_0x4f01ef){var _0x2ca1b4=function(_0x4ab5e0){while(--_0x4ab5e0){_0x50c05a['push'](_0x50c05a['shift']());}};_0x2ca1b4(++_0x4f01ef);}(_0x0ba7,0x16d));var _0x70ba=function(_0x272b80,_0x5aa1ec){_0x272b80=_0x272b80-0x0;var _0x5a4211=_0x0ba7[_0x272b80];return _0x5a4211;};'use strict';var _=require(_0x70ba('0x0'));var util=require('util');var moment=require(_0x70ba('0x1'));var BPromise=require(_0x70ba('0x2'));var rs=require(_0x70ba('0x3'));var fs=require('fs');var Redis=require(_0x70ba('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x70ba('0x5'));var logger=require(_0x70ba('0x6'))(_0x70ba('0x7'));var config=require(_0x70ba('0x8'));var jayson=require(_0x70ba('0x9'));var client=jayson[_0x70ba('0xa')][_0x70ba('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2d5a16,_0x240696,_0x1185cb){return new BPromise(function(_0x1a968b,_0x41cd10){return client[_0x70ba('0xc')](_0x2d5a16,_0x1185cb)[_0x70ba('0xd')](function(_0x465b7c){logger['info'](_0x70ba('0xe'),_0x240696,'request\x20sent');logger[_0x70ba('0xf')](_0x70ba('0x10'),_0x240696,_0x70ba('0x11'),JSON[_0x70ba('0x12')](_0x465b7c));if(_0x465b7c['error']){if(_0x465b7c['error'][_0x70ba('0x13')]===0x1f4){logger['error'](_0x70ba('0xe'),_0x240696,_0x465b7c['error'][_0x70ba('0x14')]);return _0x41cd10(_0x465b7c[_0x70ba('0x15')]['message']);}logger[_0x70ba('0x15')]('Attachment,\x20%s,\x20%s',_0x240696,_0x465b7c[_0x70ba('0x15')][_0x70ba('0x14')]);return _0x1a968b(_0x465b7c[_0x70ba('0x15')][_0x70ba('0x14')]);}else{logger[_0x70ba('0x16')](_0x70ba('0xe'),_0x240696,_0x70ba('0x11'));_0x1a968b(_0x465b7c[_0x70ba('0x17')][_0x70ba('0x14')]);}})[_0x70ba('0x18')](function(_0x30ac22){logger[_0x70ba('0x15')](_0x70ba('0xe'),_0x240696,_0x30ac22);_0x41cd10(_0x30ac22);});});}exports[_0x70ba('0x19')]=function(_0x5ed907){var _0x5dad2d=this;return new Promise(function(_0x489cf9,_0x265245){return db[_0x70ba('0x1a')][_0x70ba('0x1b')](_0x5ed907[_0x70ba('0x1c')],{'raw':_0x5ed907[_0x70ba('0x1d')]?_0x5ed907[_0x70ba('0x1d')][_0x70ba('0x1e')]===undefined?!![]:![]:!![]})[_0x70ba('0xd')](function(_0x415879){logger[_0x70ba('0x16')](_0x70ba('0x19'),_0x5ed907);logger[_0x70ba('0xf')](_0x70ba('0x19'),_0x5ed907,JSON[_0x70ba('0x12')](_0x415879));_0x489cf9(_0x415879);})[_0x70ba('0x18')](function(_0x5ebe9d){logger[_0x70ba('0x15')](_0x70ba('0x19'),_0x5ebe9d['message'],_0x5ed907);_0x265245(_0x5dad2d[_0x70ba('0x15')](0x1f4,_0x5ebe9d['message']));});});}; \ No newline at end of file +var _0x4fef=['debug','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateAttachment','Attachment','create','body','options','raw'];(function(_0x5984bb,_0x56f02a){var _0x5351d8=function(_0x43415a){while(--_0x43415a){_0x5984bb['push'](_0x5984bb['shift']());}};_0x5351d8(++_0x56f02a);}(_0x4fef,0x10f));var _0xf4fe=function(_0x32bb97,_0x44ab2){_0x32bb97=_0x32bb97-0x0;var _0x52dc73=_0x4fef[_0x32bb97];return _0x52dc73;};'use strict';var _=require(_0xf4fe('0x0'));var util=require(_0xf4fe('0x1'));var moment=require('moment');var BPromise=require(_0xf4fe('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf4fe('0x3'));var db=require(_0xf4fe('0x4'))['db'];var utils=require(_0xf4fe('0x5'));var logger=require(_0xf4fe('0x6'))(_0xf4fe('0x7'));var config=require(_0xf4fe('0x8'));var jayson=require(_0xf4fe('0x9'));var client=jayson[_0xf4fe('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x363096,_0x3e844d,_0x4805b0){return new BPromise(function(_0x23b761,_0x1e858f){return client[_0xf4fe('0xb')](_0x363096,_0x4805b0)[_0xf4fe('0xc')](function(_0xdec534){logger[_0xf4fe('0xd')](_0xf4fe('0xe'),_0x3e844d,_0xf4fe('0xf'));logger['debug'](_0xf4fe('0x10'),_0x3e844d,'request\x20sent',JSON[_0xf4fe('0x11')](_0xdec534));if(_0xdec534[_0xf4fe('0x12')]){if(_0xdec534[_0xf4fe('0x12')][_0xf4fe('0x13')]===0x1f4){logger[_0xf4fe('0x12')]('Attachment,\x20%s,\x20%s',_0x3e844d,_0xdec534[_0xf4fe('0x12')][_0xf4fe('0x14')]);return _0x1e858f(_0xdec534[_0xf4fe('0x12')]['message']);}logger[_0xf4fe('0x12')]('Attachment,\x20%s,\x20%s',_0x3e844d,_0xdec534[_0xf4fe('0x12')][_0xf4fe('0x14')]);return _0x23b761(_0xdec534[_0xf4fe('0x12')]['message']);}else{logger[_0xf4fe('0xd')](_0xf4fe('0xe'),_0x3e844d,'request\x20sent');_0x23b761(_0xdec534[_0xf4fe('0x15')][_0xf4fe('0x14')]);}})[_0xf4fe('0x16')](function(_0x565dc6){logger['error'](_0xf4fe('0xe'),_0x3e844d,_0x565dc6);_0x1e858f(_0x565dc6);});});}exports[_0xf4fe('0x17')]=function(_0x5ad86c){var _0x519f1d=this;return new Promise(function(_0x24c818,_0x2b58dd){return db[_0xf4fe('0x18')][_0xf4fe('0x19')](_0x5ad86c[_0xf4fe('0x1a')],{'raw':_0x5ad86c[_0xf4fe('0x1b')]?_0x5ad86c[_0xf4fe('0x1b')][_0xf4fe('0x1c')]===undefined?!![]:![]:!![]})[_0xf4fe('0xc')](function(_0x223676){logger[_0xf4fe('0xd')](_0xf4fe('0x17'),_0x5ad86c);logger[_0xf4fe('0x1d')](_0xf4fe('0x17'),_0x5ad86c,JSON['stringify'](_0x223676));_0x24c818(_0x223676);})[_0xf4fe('0x16')](function(_0x5e8e18){logger['error']('CreateAttachment',_0x5e8e18[_0xf4fe('0x14')],_0x5ad86c);_0x2b58dd(_0x519f1d['error'](0x1f4,_0x5e8e18['message']));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 0fecebc..b926d22 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(_0x380e58,_0x4ccc58){var _0x5a1b02=function(_0x514739){while(--_0x514739){_0x380e58['push'](_0x380e58['shift']());}};_0x5a1b02(++_0x4ccc58);}(_0xb10b,0x12a));var _0xbb10=function(_0x487f47,_0x32b30b){_0x487f47=_0x487f47-0x0;var _0x35988b=_0xb10b[_0x487f47];return _0x35988b;};'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 _0xadb5=['root','format','%s-%s','originalname','replace','file','put','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/download','download','post','/:id/clone'];(function(_0x37a874,_0x35af75){var _0x31fcd1=function(_0x353e1b){while(--_0x353e1b){_0x37a874['push'](_0x37a874['shift']());}};_0x31fcd1(++_0x35af75);}(_0xadb5,0xad));var _0x5adb=function(_0x372e27,_0x8a9596){_0x372e27=_0x372e27-0x0;var _0x38ac13=_0xadb5[_0x372e27];return _0x38ac13;};'use strict';var multer=require('multer');var util=require(_0x5adb('0x0'));var path=require('path');var timeout=require(_0x5adb('0x1'));var express=require(_0x5adb('0x2'));var router=express[_0x5adb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5adb('0x4'));var interaction=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var controller=require('./attachment.controller');router[_0x5adb('0x7')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0x9')]);router[_0x5adb('0x7')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xb')]);router[_0x5adb('0x7')](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xd')]);router[_0x5adb('0xe')](_0x5adb('0xf'),auth[_0x5adb('0x8')](),controller['clone']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1a8f66,_0x1ea238,_0x82e67e){_0x82e67e(null,path['join'](config[_0x5adb('0x10')],'server/files/attachments/'));},'filename':function(_0x2a0b70,_0x5433bf,_0x8cfcc6){_0x8cfcc6(null,util[_0x5adb('0x11')](_0x5adb('0x12'),Date['now'](),_0x5433bf[_0x5adb('0x13')][_0x5adb('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x5adb('0xe')]('/',upload['single'](_0x5adb('0x15')),controller['create']);router[_0x5adb('0x16')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x17')]);router[_0x5adb('0x18')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x19')]);module[_0x5adb('0x1a')]=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index ebaebd7..57a7cf6 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 _0xd1a8=['send','message','login','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','use','passport','Strategy','moment','activedirectory2','util','../../mysqldb','../../config/utils','../../config/environment','../../config/logger','api','activedirectory','undefined','baseDN','domain','authenticate','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','error','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','findOne','adSsoEnabled','blockDuration','then','name','salt','role','disabled','blockedAt','online','admin','blocked','add','clearBlockUser','getLicense','catch','status'];(function(_0x230062,_0xf75914){var _0x1b1f93=function(_0x5a9f3c){while(--_0x5a9f3c){_0x230062['push'](_0x230062['shift']());}};_0x1b1f93(++_0xf75914);}(_0xd1a8,0xee));var _0x8d1a=function(_0x1d0fd5,_0x111e03){_0x1d0fd5=_0x1d0fd5-0x0;var _0xd3b5d1=_0xd1a8[_0x1d0fd5];return _0xd3b5d1;};'use strict';var passport=require(_0x8d1a('0x0'));var LocalStrategy=require('passport-local')[_0x8d1a('0x1')];var moment=require(_0x8d1a('0x2'));var ActiveDirectory=require(_0x8d1a('0x3'));var BPromise=require('bluebird');var util=require(_0x8d1a('0x4'));var db=require(_0x8d1a('0x5'))['db'];var authService=require('../../components/auth/service');var utils=require(_0x8d1a('0x6'));var config=require(_0x8d1a('0x7'));var logger=require(_0x8d1a('0x8'))(_0x8d1a('0x9'));function isActiveDirectoryConfigured(_0x475841){var _0x2fb492=![];if(typeof _0x475841[_0x8d1a('0xa')]!==_0x8d1a('0xb')){_0x2fb492=_0x475841[_0x8d1a('0xa')][_0x8d1a('0xc')]&&_0x475841['activedirectory']['url']&&_0x475841[_0x8d1a('0xa')][_0x8d1a('0xd')];}return _0x2fb492;}function adAuthenticate(_0x523e93,_0x278cb8,_0xbb616c){return new BPromise(function(_0x52cc8f,_0x5eafa7){try{var _0x1d0bf1=new ActiveDirectory(_0x523e93);_0x1d0bf1[_0x8d1a('0xe')](_0x278cb8,_0xbb616c,function(_0x4f9464,_0x216269){if(_0x4f9464){logger['error']('Error\x20authenticate\x20%s:\x20%s',_0x278cb8,util[_0x8d1a('0xf')](_0x4f9464,{'showHidden':![],'depth':null}));_0x5eafa7(_0x8d1a('0x10'));}else if(!_0x216269){logger['error'](_0x8d1a('0x11'),_0x278cb8);_0x5eafa7('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x52cc8f(_0x216269);}});}catch(_0x54b59f){_0x5eafa7(_0x54b59f);}});}function ActiveDirectoryAuthenticate(_0x503a2a,_0x236a89,_0x53a628,_0x9f5cd2){var _0x11b49f,_0x4f6dfe;if(!isActiveDirectoryConfigured(config)){logger[_0x8d1a('0x12')](_0x8d1a('0x13'),_0x236a89);return _0x9f5cd2(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}return db[_0x8d1a('0x14')][_0x8d1a('0x15')]({'where':{'id':0x1},'attributes':[_0x8d1a('0x16'),_0x8d1a('0x17')],'raw':!![]})[_0x8d1a('0x18')](function(_0x14c108){_0x11b49f=_0x14c108;if(!_0x11b49f['adSsoEnabled']){logger[_0x8d1a('0x12')]('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled',_0x236a89);throw new Error(_0x8d1a('0x10'));}return _0x503a2a['findOne']({'attributes':['id',_0x8d1a('0x19'),'password',_0x8d1a('0x1a'),_0x8d1a('0x1b'),_0x8d1a('0x1c'),'blocked',_0x8d1a('0x1d'),_0x8d1a('0x1e')],'where':{'name':_0x236a89,'role':{'$or':[_0x8d1a('0x1f'),'user','agent']},'adSsoEnabled':!![]}});})[_0x8d1a('0x18')](function(_0x4899ca){if(!_0x4899ca||_0x4899ca&&_0x4899ca[_0x8d1a('0x19')]!==_0x236a89){throw new Error(_0x8d1a('0x10'));}_0x4f6dfe=_0x4899ca;var _0x578f5b=_0x4f6dfe[_0x8d1a('0x19')]+'@'+config[_0x8d1a('0xa')][_0x8d1a('0xd')];return adAuthenticate(config[_0x8d1a('0xa')],_0x578f5b,_0x53a628);})[_0x8d1a('0x18')](function(_0x57c803){if(_0x4f6dfe[_0x8d1a('0x1c')]){throw new Error(_0x8d1a('0x10'));}if(_0x11b49f[_0x8d1a('0x17')]>0x0){if(_0x4f6dfe[_0x8d1a('0x20')]){if(moment(_0x4f6dfe[_0x8d1a('0x1d')])[_0x8d1a('0x21')](_0x11b49f['blockDuration'],'minutes')>moment()){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return utils[_0x8d1a('0x22')](_0x4f6dfe,0x0,![],null)[_0x8d1a('0x18')](function(){return utils[_0x8d1a('0x23')](_0x4f6dfe);})[_0x8d1a('0x18')](function(){return _0x9f5cd2(null,_0x4f6dfe);});}else{return utils['getLicense'](_0x4f6dfe)[_0x8d1a('0x18')](function(){return _0x9f5cd2(null,_0x4f6dfe);});}}else{return utils[_0x8d1a('0x23')](_0x4f6dfe)[_0x8d1a('0x18')](function(){return _0x9f5cd2(null,_0x4f6dfe);});}})[_0x8d1a('0x24')](function(_0x102bfd){return _0x9f5cd2(null,![],_0x102bfd);});}function handleError(_0x17f5cf,_0x42d510,_0x1548d5){return _0x17f5cf[_0x8d1a('0x25')](_0x42d510||0x1f4)[_0x8d1a('0x26')]({'message':_0x1548d5?_0x1548d5[_0x8d1a('0x27')]||_0x1548d5:''});}exports[_0x8d1a('0x28')]=function(_0xee839b,_0xae3f73,_0x431891){passport[_0x8d1a('0xe')](_0x8d1a('0x29'),function(_0x181744,_0x131c6f,_0x44e534){var _0x3034b6=_0x181744||_0x44e534;if(_0x3034b6){return handleError(_0xae3f73,0x191,_0x3034b6);}if(!_0x131c6f){return handleError(_0xae3f73,0x194,{'message':_0x8d1a('0x2a')});}else{var _0x1e4ba4={'payload':{'id':_0x131c6f['id'],'role':_0x131c6f[_0x8d1a('0x1b')]},'options':{'expiresIn':0x15180}};return authService[_0x8d1a('0x2b')](_0x1e4ba4)[_0x8d1a('0x18')](function(_0x530586){_0xae3f73[_0x8d1a('0x2c')]({'id':_0x131c6f['id'],'token':_0x530586,'statusCall':'','isAlreadyLogged':_0x131c6f[_0x8d1a('0x1e')]});});}})(_0xee839b,_0xae3f73,_0x431891);};passport[_0x8d1a('0x2d')](_0x8d1a('0x29'),new LocalStrategy({'usernameField':_0x8d1a('0x19'),'passwordField':'password'},function(_0xd54ab1,_0x54dffc,_0x528672){return ActiveDirectoryAuthenticate(db['User'],_0xd54ab1,_0x54dffc,_0x528672);})); \ No newline at end of file +var _0x8332=['domain','add','minutes','getLicense','status','send','login','authenticate','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','use','User','passport','passport-local','Strategy','activedirectory2','bluebird','util','../../mysqldb','../../components/auth/service','../../config/utils','../../config/environment','../../config/logger','activedirectory','undefined','url','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','Setting','findOne','adSsoEnabled','blockDuration','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','password','salt','role','disabled','blocked','online','admin','user','agent','then','name'];(function(_0x2745d7,_0x23b55a){var _0x537ad2=function(_0x396ae4){while(--_0x396ae4){_0x2745d7['push'](_0x2745d7['shift']());}};_0x537ad2(++_0x23b55a);}(_0x8332,0x134));var _0x2833=function(_0x3b42ca,_0x9d516c){_0x3b42ca=_0x3b42ca-0x0;var _0x116219=_0x8332[_0x3b42ca];return _0x116219;};'use strict';var passport=require(_0x2833('0x0'));var LocalStrategy=require(_0x2833('0x1'))[_0x2833('0x2')];var moment=require('moment');var ActiveDirectory=require(_0x2833('0x3'));var BPromise=require(_0x2833('0x4'));var util=require(_0x2833('0x5'));var db=require(_0x2833('0x6'))['db'];var authService=require(_0x2833('0x7'));var utils=require(_0x2833('0x8'));var config=require(_0x2833('0x9'));var logger=require(_0x2833('0xa'))('api');function isActiveDirectoryConfigured(_0x75c69b){var _0x4494d2=![];if(typeof _0x75c69b[_0x2833('0xb')]!==_0x2833('0xc')){_0x4494d2=_0x75c69b[_0x2833('0xb')]['baseDN']&&_0x75c69b[_0x2833('0xb')][_0x2833('0xd')]&&_0x75c69b[_0x2833('0xb')]['domain'];}return _0x4494d2;}function adAuthenticate(_0x59c9f4,_0x388712,_0x271235){return new BPromise(function(_0x1bed10,_0x455d49){try{var _0x43ef2b=new ActiveDirectory(_0x59c9f4);_0x43ef2b['authenticate'](_0x388712,_0x271235,function(_0x14db43,_0x55dbe0){if(_0x14db43){logger[_0x2833('0xe')]('Error\x20authenticate\x20%s:\x20%s',_0x388712,util[_0x2833('0xf')](_0x14db43,{'showHidden':![],'depth':null}));_0x455d49(_0x2833('0x10'));}else if(!_0x55dbe0){logger[_0x2833('0xe')](_0x2833('0x11'),_0x388712);_0x455d49(_0x2833('0x10'));}else{_0x1bed10(_0x55dbe0);}});}catch(_0x104e2b){_0x455d49(_0x104e2b);}});}function ActiveDirectoryAuthenticate(_0x55cde6,_0x392d1d,_0x497c5f,_0x426c14){var _0x47731c,_0xcd6845;if(!isActiveDirectoryConfigured(config)){logger[_0x2833('0xe')](_0x2833('0x12'),_0x392d1d);return _0x426c14(null,![],{'message':_0x2833('0x10')});}return db[_0x2833('0x13')][_0x2833('0x14')]({'where':{'id':0x1},'attributes':[_0x2833('0x15'),_0x2833('0x16')],'raw':!![]})['then'](function(_0x33c3c8){_0x47731c=_0x33c3c8;if(!_0x47731c[_0x2833('0x15')]){logger[_0x2833('0xe')](_0x2833('0x17'),_0x392d1d);throw new Error(_0x2833('0x10'));}return _0x55cde6[_0x2833('0x14')]({'attributes':['id','name',_0x2833('0x18'),_0x2833('0x19'),_0x2833('0x1a'),_0x2833('0x1b'),_0x2833('0x1c'),'blockedAt',_0x2833('0x1d')],'where':{'name':_0x392d1d,'role':{'$or':[_0x2833('0x1e'),_0x2833('0x1f'),_0x2833('0x20')]},'adSsoEnabled':!![]}});})[_0x2833('0x21')](function(_0x3a7d8b){if(!_0x3a7d8b||_0x3a7d8b&&_0x3a7d8b[_0x2833('0x22')]!==_0x392d1d){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}_0xcd6845=_0x3a7d8b;var _0x3a12e1=_0xcd6845[_0x2833('0x22')]+'@'+config[_0x2833('0xb')][_0x2833('0x23')];return adAuthenticate(config[_0x2833('0xb')],_0x3a12e1,_0x497c5f);})[_0x2833('0x21')](function(_0x28d335){if(_0xcd6845[_0x2833('0x1b')]){throw new Error(_0x2833('0x10'));}if(_0x47731c[_0x2833('0x16')]>0x0){if(_0xcd6845[_0x2833('0x1c')]){if(moment(_0xcd6845['blockedAt'])[_0x2833('0x24')](_0x47731c[_0x2833('0x16')],_0x2833('0x25'))>moment()){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return utils['clearBlockUser'](_0xcd6845,0x0,![],null)['then'](function(){return utils[_0x2833('0x26')](_0xcd6845);})[_0x2833('0x21')](function(){return _0x426c14(null,_0xcd6845);});}else{return utils[_0x2833('0x26')](_0xcd6845)[_0x2833('0x21')](function(){return _0x426c14(null,_0xcd6845);});}}else{return utils[_0x2833('0x26')](_0xcd6845)[_0x2833('0x21')](function(){return _0x426c14(null,_0xcd6845);});}})['catch'](function(_0x43de77){return _0x426c14(null,![],_0x43de77);});}function handleError(_0x44ca2d,_0x5a739c,_0x16fbf8){return _0x44ca2d[_0x2833('0x27')](_0x5a739c||0x1f4)[_0x2833('0x28')]({'message':_0x16fbf8?_0x16fbf8['message']||_0x16fbf8:''});}exports[_0x2833('0x29')]=function(_0x5cf629,_0x597b66,_0xc37c12){passport[_0x2833('0x2a')](_0x2833('0x2b'),function(_0xa998e8,_0x3eba13,_0x4e4c6c){var _0x4bc466=_0xa998e8||_0x4e4c6c;if(_0x4bc466){return handleError(_0x597b66,0x191,_0x4bc466);}if(!_0x3eba13){return handleError(_0x597b66,0x194,{'message':_0x2833('0x2c')});}else{var _0x3ba4d7={'payload':{'id':_0x3eba13['id'],'role':_0x3eba13['role']},'options':{'expiresIn':0x15180}};return authService[_0x2833('0x2d')](_0x3ba4d7)['then'](function(_0x5f415e){_0x597b66[_0x2833('0x2e')]({'id':_0x3eba13['id'],'token':_0x5f415e,'statusCall':'','isAlreadyLogged':_0x3eba13[_0x2833('0x1d')]});});}})(_0x5cf629,_0x597b66,_0xc37c12);};passport[_0x2833('0x2f')](_0x2833('0x2b'),new LocalStrategy({'usernameField':'name','passwordField':_0x2833('0x18')},function(_0x56b803,_0x285cfe,_0x5093f8){return ActiveDirectoryAuthenticate(db[_0x2833('0x30')],_0x56b803,_0x285cfe,_0x5093f8);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index a86bb71..55820f2 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 _0x30b9=['exports','express','Router','post','login'];(function(_0x480bc8,_0x1fac40){var _0x28c245=function(_0x22a049){while(--_0x22a049){_0x480bc8['push'](_0x480bc8['shift']());}};_0x28c245(++_0x1fac40);}(_0x30b9,0xce));var _0x930b=function(_0x104f61,_0x407853){_0x104f61=_0x104f61-0x0;var _0x3fad72=_0x30b9[_0x104f61];return _0x3fad72;};'use strict';var express=require(_0x930b('0x0'));var router=express[_0x930b('0x1')]();var controller=require('./authActiveDirectory.controller');router[_0x930b('0x2')]('/',controller[_0x930b('0x3')]);module[_0x930b('0x4')]=router; \ No newline at end of file +var _0x9f13=['Router','./authActiveDirectory.controller','post','exports'];(function(_0x5e3a45,_0x45f0c5){var _0x13419f=function(_0x5ac996){while(--_0x5ac996){_0x5e3a45['push'](_0x5e3a45['shift']());}};_0x13419f(++_0x45f0c5);}(_0x9f13,0x1c8));var _0x39f1=function(_0x1fcd21,_0x1a7d49){_0x1fcd21=_0x1fcd21-0x0;var _0x23c4cc=_0x9f13[_0x1fcd21];return _0x23c4cc;};'use strict';var express=require('express');var router=express[_0x39f1('0x0')]();var controller=require(_0x39f1('0x1'));router[_0x39f1('0x2')]('/',controller['login']);module[_0x39f1('0x3')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 1ced3ea..fb8eee7 100644 --- a/server/api/authGoogle/authGoogle.controller.js +++ b/server/api/authGoogle/authGoogle.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['../../config/environment','../../config/utils','login','google','/login','profile','email','callback','authenticate','use','clientID','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','User','find','map','emails','value','admin','user','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blocked','blockedAt','add','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','../../mysqldb'];(function(_0x539143,_0x476a19){var _0x21c88e=function(_0x3131ff){while(--_0x3131ff){_0x539143['push'](_0x539143['shift']());}};_0x21c88e(++_0x476a19);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x7995('0x0'));var passport=require(_0x7995('0x1'));var GoogleStrategy=require(_0x7995('0x2'))[_0x7995('0x3')];var moment=require('moment');var db=require(_0x7995('0x4'))['db'];var config=require(_0x7995('0x5'));var utils=require(_0x7995('0x6'));exports[_0x7995('0x7')]=passport['authenticate'](_0x7995('0x8'),{'failureRedirect':_0x7995('0x9'),'scope':[_0x7995('0xa'),_0x7995('0xb')],'session':![]});exports[_0x7995('0xc')]=passport[_0x7995('0xd')]('google',{'failureRedirect':_0x7995('0x9'),'session':![]});passport[_0x7995('0xe')](new GoogleStrategy({'clientID':config['google']?config[_0x7995('0x8')][_0x7995('0xf')]:'id','clientSecret':config[_0x7995('0x8')]?config[_0x7995('0x8')][_0x7995('0x10')]:_0x7995('0x11'),'callbackURL':config[_0x7995('0x8')]?config['google'][_0x7995('0x12')]:''},function(_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e,_0x385f00;return db[_0x7995('0x13')][_0x7995('0x14')]({'where':{'id':0x1},'attributes':[_0x7995('0x15'),'blockDuration'],'raw':!![]})['then'](function(_0x2b4e94){_0x19a27e=_0x2b4e94;return db[_0x7995('0x16')][_0x7995('0x17')]({'where':{'email':_[_0x7995('0x18')](_0xb0c872[_0x7995('0x19')],_0x7995('0x1a')),'role':{'$or':[_0x7995('0x1b'),_0x7995('0x1c'),'agent']}}});})[_0x7995('0x1d')](function(_0x565d97){_0x385f00=_0x565d97;if(_0x385f00){if(_0x385f00[_0x7995('0x1e')]){return _0x2cb37a(_0x7995('0x1f'));}else if(_0x19a27e[_0x7995('0x20')]>0x0){if(_0x385f00[_0x7995('0x21')]){if(moment(_0x385f00[_0x7995('0x22')])[_0x7995('0x23')](_0x19a27e['blockDuration'],'minutes')>moment()){return _0x2cb37a(_0x7995('0x1f'));}else{return utils['clearBlockUser'](_0x385f00,0x0,![],null)['then'](function(){return utils[_0x7995('0x24')](_0x385f00);})[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)['then'](function(){return _0x2cb37a(null,_0x385f00);});}}return _0x2cb37a(_0x7995('0x1f'));})[_0x7995('0x25')](function(_0x350fd9){_0x2cb37a(_0x350fd9);});})); \ No newline at end of file +var _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0x7a54,0x106));var _0x47a5=function(_0x386a34,_0x2b7456){_0x386a34=_0x386a34-0x0;var _0x2ce315=_0x7a54[_0x386a34];return _0x2ce315;};'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 7617219..897e26a 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 _0x2e51=['express','passport','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get','login','callback','setTokenCookie'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2e51,0x1b9));var _0x12e5=function(_0x20a558,_0x160e0e){_0x20a558=_0x20a558-0x0;var _0x53d3f7=_0x2e51[_0x20a558];return _0x53d3f7;};'use strict';var express=require(_0x12e5('0x0'));var passport=require(_0x12e5('0x1'));var router=express['Router']();var controller=require(_0x12e5('0x2'));var userController=require(_0x12e5('0x3'));var authService=require(_0x12e5('0x4'));router[_0x12e5('0x5')]('/',controller[_0x12e5('0x6')]);router[_0x12e5('0x5')]('/callback',controller[_0x12e5('0x7')],authService['isMiddleware'],userController[_0x12e5('0x6')],authService[_0x12e5('0x8')]);module['exports']=router; \ No newline at end of file +var _0x9362=['express','passport','Router','./authGoogle.controller','../user/user.controller.js','get','login','/callback','callback','isMiddleware','setTokenCookie','exports'];(function(_0xd8bc86,_0x2d70de){var _0x139174=function(_0x48fccd){while(--_0x48fccd){_0xd8bc86['push'](_0xd8bc86['shift']());}};_0x139174(++_0x2d70de);}(_0x9362,0xcc));var _0x2936=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9362[_0x20a584];return _0x4b41a8;};'use strict';var express=require(_0x2936('0x0'));var passport=require(_0x2936('0x1'));var router=express[_0x2936('0x2')]();var controller=require(_0x2936('0x3'));var userController=require(_0x2936('0x4'));var authService=require('../../components/auth/service');router[_0x2936('0x5')]('/',controller[_0x2936('0x6')]);router[_0x2936('0x5')](_0x2936('0x7'),controller[_0x2936('0x8')],authService[_0x2936('0x9')],userController[_0x2936('0x6')],authService[_0x2936('0xa')]);module[_0x2936('0xb')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 97daf85..b1cd389 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 _0x9ec8=['MailServerOut','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','merge','\x22%s\x22\x20<%s>','request','SendMail','error','format','send','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','json','online','body','email','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','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','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','status','params','token','enforcePasswordHistory','passwordHistoryLimit','securePassword','password','previousPasswords','validatePasswordHistory','Password\x20reset!','use','util','passport-local','Strategy','jayson/promise','randomstring','../../mysqldb','../../config/utils','client','http','Setting','findOne','allowedLoginAttempts','blockDuration','then','role','disabled','blockedAt','admin','user','name','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','loginAttempts','blocked','clearBlockUser','add','minutes','getLicense','catch','MailAccount','find'];(function(_0x246cac,_0x3a71b3){var _0x56423c=function(_0x55987d){while(--_0x55987d){_0x246cac['push'](_0x246cac['shift']());}};_0x56423c(++_0x3a71b3);}(_0x9ec8,0x79));var _0x89ec=function(_0x47b8d4,_0x157abc){_0x47b8d4=_0x47b8d4-0x0;var _0x34eb0f=_0x9ec8[_0x47b8d4];return _0x34eb0f;};'use strict';var util=require(_0x89ec('0x0'));var passport=require('passport');var LocalStrategy=require(_0x89ec('0x1'))[_0x89ec('0x2')];var jayson=require(_0x89ec('0x3'));var _=require('lodash');var rs=require(_0x89ec('0x4'));var moment=require('moment');var db=require(_0x89ec('0x5'))['db'];var authService=require('../../components/auth/service');var utils=require(_0x89ec('0x6'));var client=jayson[_0x89ec('0x7')][_0x89ec('0x8')]({'port':0x232b});function localAuthenticate(_0x1a78cb,_0x1e0c54,_0x55b599,_0x4c3bf0){var _0x260120,_0x1527c9;return db[_0x89ec('0x9')][_0x89ec('0xa')]({'where':{'id':0x1},'attributes':[_0x89ec('0xb'),_0x89ec('0xc')],'raw':!![]})[_0x89ec('0xd')](function(_0x4ccddc){_0x260120=_0x4ccddc;return _0x1a78cb[_0x89ec('0xa')]({'attributes':['id','name','password','salt',_0x89ec('0xe'),_0x89ec('0xf'),'blocked',_0x89ec('0x10'),'loginAttempts'],'where':{'name':_0x1e0c54,'role':{'$or':[_0x89ec('0x11'),_0x89ec('0x12'),'agent']}}});})[_0x89ec('0xd')](function(_0x2a8d18){if(!_0x2a8d18||_0x2a8d18&&_0x2a8d18[_0x89ec('0x13')]!==_0x1e0c54){throw new Error(_0x89ec('0x14'));}else{_0x1527c9=_0x2a8d18;return _0x1527c9;}})[_0x89ec('0xd')](function(){_0x1527c9[_0x89ec('0x15')](_0x55b599,function(_0x3ce91b,_0x23be7f){var _0x3ec2f3=_0x1527c9[_0x89ec('0x16')]+0x1;if(_0x3ce91b){return _0x4c3bf0(_0x3ce91b);}else if(!_0x23be7f){if(_0x1527c9[_0x89ec('0xf')]){return _0x4c3bf0(null,![],{'message':_0x89ec('0x14')});}else if(_0x260120['allowedLoginAttempts']>0x0){if(_0x1527c9[_0x89ec('0x17')]){if(_0x260120[_0x89ec('0xc')]>0x0){if(moment(_0x1527c9['blockedAt'])['add'](_0x260120[_0x89ec('0xc')],'minutes')>moment()){return _0x4c3bf0(null,![],{'message':_0x89ec('0x14')});}else{return utils['clearBlockUser'](_0x1527c9,_0x3ec2f3,![],null)['then'](function(){return _0x4c3bf0(null,![],{'message':_0x89ec('0x14')});});}}else{return _0x4c3bf0(null,![],{'message':_0x89ec('0x14')});}}else{if(_0x3ec2f3>=_0x260120[_0x89ec('0xb')]){return utils[_0x89ec('0x18')](_0x1527c9,0x0,!![],moment())[_0x89ec('0xd')](function(){return _0x4c3bf0(null,![],{'message':_0x89ec('0x14')});});}else{return utils[_0x89ec('0x18')](_0x1527c9,_0x3ec2f3,![],null)[_0x89ec('0xd')](function(){return _0x4c3bf0(null,![],{'message':_0x89ec('0x14')});});}}}else{return _0x4c3bf0(null,![],{'message':_0x89ec('0x14')});}}else{if(_0x1527c9['disabled']){return _0x4c3bf0(null,![],{'message':_0x89ec('0x14')});}else if(_0x260120[_0x89ec('0xb')]>0x0){if(_0x1527c9[_0x89ec('0x17')]){if(_0x260120['blockDuration']>0x0){if(moment(_0x1527c9['blockedAt'])[_0x89ec('0x19')](_0x260120[_0x89ec('0xc')],_0x89ec('0x1a'))>moment()){return _0x4c3bf0(null,![],{'message':_0x89ec('0x14')});}else{return utils['clearBlockUser'](_0x1527c9,0x0,![],null)[_0x89ec('0xd')](function(){return utils[_0x89ec('0x1b')](_0x1527c9);})['then'](function(){return _0x4c3bf0(null,_0x1527c9);});}}else{return _0x4c3bf0(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils[_0x89ec('0x18')](_0x1527c9,0x0,![],null)[_0x89ec('0xd')](function(){return utils[_0x89ec('0x1b')](_0x1527c9);})[_0x89ec('0xd')](function(){return _0x4c3bf0(null,_0x1527c9);})[_0x89ec('0x1c')](function(_0xb712bd){return _0x4c3bf0(null,![],_0xb712bd);});}}else{if(_0x1527c9['blocked']){return _0x4c3bf0(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x89ec('0x1b')](_0x1527c9)['then'](function(){return _0x4c3bf0(null,_0x1527c9);});}}}});})[_0x89ec('0x1c')](function(_0x294cc9){return _0x4c3bf0(null,![],_0x294cc9);});}function sendServiceMail(_0x16383b){return db[_0x89ec('0x1d')][_0x89ec('0x1e')]({'where':{'service':!![]},'attributes':['id','name','email'],'include':[{'model':db[_0x89ec('0x1f')],'as':_0x89ec('0x20'),'include':[{'model':db[_0x89ec('0x21')],'as':'CloudProvider'}]}]})['then'](function(_0x19e91d){if(!_0x19e91d){throw new Error(_0x89ec('0x22'));}var _0x4bdccb=_0x19e91d[_0x89ec('0x23')]();var _0x364171={'account':_0x4bdccb,'message':_[_0x89ec('0x24')]({'from':util['format'](_0x89ec('0x25'),_0x19e91d['name'],_0x19e91d['email']||_0x19e91d[_0x89ec('0x20')][_0x89ec('0x12')])},_0x16383b)};return client[_0x89ec('0x26')](_0x89ec('0x27'),_0x364171);})['then'](function(_0x362bd4){if(_0x362bd4[_0x89ec('0x28')]){throw new Error(util[_0x89ec('0x29')]('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x362bd4['error']['message']||JSON['stringify'](_0x362bd4[_0x89ec('0x28')])));}return!![];});}function handleError(_0x3a90af,_0x5dec08,_0x3b33bf){return _0x3a90af['status'](_0x5dec08||0x1f4)[_0x89ec('0x2a')]({'message':_0x3b33bf?_0x3b33bf['message']||_0x3b33bf:''});}exports[_0x89ec('0x2b')]=function(_0xc74fc3,_0x46980c,_0x2f7a81){passport[_0x89ec('0x15')](_0x89ec('0x2c'),function(_0x54da46,_0x1b5be5,_0x144284){var _0x140f44=_0x54da46||_0x144284;if(_0x140f44){return handleError(_0x46980c,0x191,_0x140f44);}if(!_0x1b5be5){return handleError(_0x46980c,0x194,{'message':_0x89ec('0x2d')});}else{var _0x2d50d0={'payload':{'id':_0x1b5be5['id'],'role':_0x1b5be5[_0x89ec('0xe')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x2d50d0)[_0x89ec('0xd')](function(_0x51eddd){_0x46980c[_0x89ec('0x2e')]({'id':_0x1b5be5['id'],'token':_0x51eddd,'statusCall':'','isAlreadyLogged':_0x1b5be5[_0x89ec('0x2f')]});});}})(_0xc74fc3,_0x46980c,_0x2f7a81);};exports['forgot']=function(_0xfcfe24,_0x4f1c84){if(!_0xfcfe24[_0x89ec('0x30')]['email']){return handleError(_0x4f1c84,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x53d396=rs['generate']();_0xfcfe24[_0x89ec('0x30')][_0x89ec('0x31')]=_0xfcfe24['body'][_0x89ec('0x31')]['trim']()[_0x89ec('0x32')]();var _0x668ed;return db[_0x89ec('0x9')][_0x89ec('0xa')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts','blockDuration'],'raw':!![]})[_0x89ec('0xd')](function(_0x27a078){_0x668ed=_0x27a078;return db[_0x89ec('0x33')][_0x89ec('0x1e')]({'where':{'email':_0xfcfe24[_0x89ec('0x30')][_0x89ec('0x31')]}});})[_0x89ec('0xd')](function(_0x447d43){if(!_0x447d43){throw new Error(_0x89ec('0x34'));}if(_0x447d43[_0x89ec('0xf')]){throw new Error(_0x89ec('0x35'));}if(_0x447d43[_0x89ec('0x17')]){if(moment(_0x447d43[_0x89ec('0x10')])[_0x89ec('0x19')](_0x668ed[_0x89ec('0xc')],_0x89ec('0x1a'))>moment()){throw new Error(_0x89ec('0x36'));}else{_0x447d43[_0x89ec('0x17')]=![];_0x447d43[_0x89ec('0x10')]=null;}}_0x447d43[_0x89ec('0x37')]=_0x53d396;_0x447d43[_0x89ec('0x38')]=Date[_0x89ec('0x39')]()+0x36ee80;return _0x447d43[_0x89ec('0x3a')]();})[_0x89ec('0xd')](function(){return sendServiceMail({'to':_0xfcfe24[_0x89ec('0x30')][_0x89ec('0x31')],'subject':'xCally\x20Motion\x20Password\x20Reset','text':_0x89ec('0x3b')+_0x89ec('0x3c')+_0x89ec('0x3d')+_0xfcfe24[_0x89ec('0x3e')][_0x89ec('0x3f')]+'/reset/'+_0x53d396+'\x0a\x0a'+_0x89ec('0x40')});})[_0x89ec('0xd')](function(){_0x4f1c84[_0x89ec('0x41')](0xc8)[_0x89ec('0x2a')]({'message':'Reset\x20Email\x20sent!'});})[_0x89ec('0x1c')](function(_0x565d89){return handleError(_0x4f1c84,0x1f4,_0x565d89);});};exports['reset']=function(_0x1f6f41,_0x242f25){return db[_0x89ec('0x33')][_0x89ec('0x1e')]({'where':{'resetPasswordToken':_0x1f6f41[_0x89ec('0x42')][_0x89ec('0x43')],'resetPasswordExpires':{'$gt':Date[_0x89ec('0x39')]()}}})['then'](function(_0x2e1f13){if(!_0x2e1f13){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db[_0x89ec('0x9')][_0x89ec('0xa')]({'attributes':['id','securePassword',_0x89ec('0x44'),_0x89ec('0x45')]})['then'](function(_0x379be4){if(_0x379be4[_0x89ec('0x46')])authService['validatePasswordPattern'](_0x1f6f41[_0x89ec('0x30')][_0x89ec('0x47')]);if(!_0x379be4['enforcePasswordHistory']||!_0x2e1f13[_0x89ec('0x48')])return _0x2e1f13;authService[_0x89ec('0x49')](_0x1f6f41['body'][_0x89ec('0x47')],_0x2e1f13['previousPasswords'],_0x379be4[_0x89ec('0x45')]);return _0x2e1f13;})[_0x89ec('0xd')](function(){_0x2e1f13[_0x89ec('0x47')]=_0x1f6f41[_0x89ec('0x30')]['password'];_0x2e1f13[_0x89ec('0x37')]=null;_0x2e1f13[_0x89ec('0x38')]=null;return _0x2e1f13[_0x89ec('0x3a')]();});})[_0x89ec('0xd')](function(){_0x242f25[_0x89ec('0x41')](0xc8)[_0x89ec('0x2a')]({'message':_0x89ec('0x4a')});})['catch'](function(_0x85b65a){return handleError(_0x242f25,0x1f4,_0x85b65a);});};passport[_0x89ec('0x4b')]('local-login',new LocalStrategy({'usernameField':_0x89ec('0x13'),'passwordField':_0x89ec('0x47')},function(_0x1af8b3,_0x272569,_0x5af6f6){return localAuthenticate(db['User'],_0x1af8b3,_0x272569,_0x5af6f6);})); \ No newline at end of file +var _0x9043=['token','now','enforcePasswordHistory','passwordHistoryLimit','securePassword','validatePasswordPattern','previousPasswords','validatePasswordHistory','Password\x20reset!','use','local-login','util','passport','passport-local','Strategy','lodash','../../mysqldb','../../components/auth/service','client','http','Setting','findOne','allowedLoginAttempts','blockDuration','then','name','password','role','blockedAt','loginAttempts','admin','user','agent','authenticate','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked','add','minutes','clearBlockUser','getLicense','catch','MailAccount','email','MailServerOut','Smtp','CloudProvider','getSmtpOptions','\x22%s\x22\x20<%s>','SendMail','error','format','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','save','xCally\x20Motion\x20Password\x20Reset','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','host','/reset/','reset','User','find','params'];(function(_0x3eb89d,_0x546e9c){var _0x1d749b=function(_0x55c849){while(--_0x55c849){_0x3eb89d['push'](_0x3eb89d['shift']());}};_0x1d749b(++_0x546e9c);}(_0x9043,0xfe));var _0x3904=function(_0x531bc4,_0x1ee38e){_0x531bc4=_0x531bc4-0x0;var _0xff9d7d=_0x9043[_0x531bc4];return _0xff9d7d;};'use strict';var util=require(_0x3904('0x0'));var passport=require(_0x3904('0x1'));var LocalStrategy=require(_0x3904('0x2'))[_0x3904('0x3')];var jayson=require('jayson/promise');var _=require(_0x3904('0x4'));var rs=require('randomstring');var moment=require('moment');var db=require(_0x3904('0x5'))['db'];var authService=require(_0x3904('0x6'));var utils=require('../../config/utils');var client=jayson[_0x3904('0x7')][_0x3904('0x8')]({'port':0x232b});function localAuthenticate(_0x53b1a8,_0x598420,_0x120e17,_0x1fd165){var _0x5e903f,_0x1a79be;return db[_0x3904('0x9')][_0x3904('0xa')]({'where':{'id':0x1},'attributes':[_0x3904('0xb'),_0x3904('0xc')],'raw':!![]})[_0x3904('0xd')](function(_0xbba2e8){_0x5e903f=_0xbba2e8;return _0x53b1a8[_0x3904('0xa')]({'attributes':['id',_0x3904('0xe'),_0x3904('0xf'),'salt',_0x3904('0x10'),'disabled','blocked',_0x3904('0x11'),_0x3904('0x12')],'where':{'name':_0x598420,'role':{'$or':[_0x3904('0x13'),_0x3904('0x14'),_0x3904('0x15')]}}});})[_0x3904('0xd')](function(_0x43c9a1){if(!_0x43c9a1||_0x43c9a1&&_0x43c9a1[_0x3904('0xe')]!==_0x598420){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x1a79be=_0x43c9a1;return _0x1a79be;}})[_0x3904('0xd')](function(){_0x1a79be[_0x3904('0x16')](_0x120e17,function(_0x523de4,_0x3ee94e){var _0x1cc9b6=_0x1a79be[_0x3904('0x12')]+0x1;if(_0x523de4){return _0x1fd165(_0x523de4);}else if(!_0x3ee94e){if(_0x1a79be[_0x3904('0x17')]){return _0x1fd165(null,![],{'message':_0x3904('0x18')});}else if(_0x5e903f[_0x3904('0xb')]>0x0){if(_0x1a79be[_0x3904('0x19')]){if(_0x5e903f[_0x3904('0xc')]>0x0){if(moment(_0x1a79be['blockedAt'])[_0x3904('0x1a')](_0x5e903f['blockDuration'],_0x3904('0x1b'))>moment()){return _0x1fd165(null,![],{'message':_0x3904('0x18')});}else{return utils[_0x3904('0x1c')](_0x1a79be,_0x1cc9b6,![],null)[_0x3904('0xd')](function(){return _0x1fd165(null,![],{'message':_0x3904('0x18')});});}}else{return _0x1fd165(null,![],{'message':_0x3904('0x18')});}}else{if(_0x1cc9b6>=_0x5e903f[_0x3904('0xb')]){return utils[_0x3904('0x1c')](_0x1a79be,0x0,!![],moment())['then'](function(){return _0x1fd165(null,![],{'message':_0x3904('0x18')});});}else{return utils[_0x3904('0x1c')](_0x1a79be,_0x1cc9b6,![],null)[_0x3904('0xd')](function(){return _0x1fd165(null,![],{'message':_0x3904('0x18')});});}}}else{return _0x1fd165(null,![],{'message':_0x3904('0x18')});}}else{if(_0x1a79be[_0x3904('0x17')]){return _0x1fd165(null,![],{'message':_0x3904('0x18')});}else if(_0x5e903f[_0x3904('0xb')]>0x0){if(_0x1a79be['blocked']){if(_0x5e903f[_0x3904('0xc')]>0x0){if(moment(_0x1a79be[_0x3904('0x11')])[_0x3904('0x1a')](_0x5e903f[_0x3904('0xc')],'minutes')>moment()){return _0x1fd165(null,![],{'message':_0x3904('0x18')});}else{return utils['clearBlockUser'](_0x1a79be,0x0,![],null)['then'](function(){return utils[_0x3904('0x1d')](_0x1a79be);})[_0x3904('0xd')](function(){return _0x1fd165(null,_0x1a79be);});}}else{return _0x1fd165(null,![],{'message':_0x3904('0x18')});}}else{return utils['clearBlockUser'](_0x1a79be,0x0,![],null)[_0x3904('0xd')](function(){return utils[_0x3904('0x1d')](_0x1a79be);})[_0x3904('0xd')](function(){return _0x1fd165(null,_0x1a79be);})[_0x3904('0x1e')](function(_0x23c9e9){return _0x1fd165(null,![],_0x23c9e9);});}}else{if(_0x1a79be['blocked']){return _0x1fd165(null,![],{'message':_0x3904('0x18')});}else{return utils['getLicense'](_0x1a79be)[_0x3904('0xd')](function(){return _0x1fd165(null,_0x1a79be);});}}}});})[_0x3904('0x1e')](function(_0x59c4b0){return _0x1fd165(null,![],_0x59c4b0);});}function sendServiceMail(_0x37a128){return db[_0x3904('0x1f')]['find']({'where':{'service':!![]},'attributes':['id',_0x3904('0xe'),_0x3904('0x20')],'include':[{'model':db[_0x3904('0x21')],'as':_0x3904('0x22'),'include':[{'model':db[_0x3904('0x23')],'as':'CloudProvider'}]}]})[_0x3904('0xd')](function(_0x48a7bf){if(!_0x48a7bf){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x15df30=_0x48a7bf[_0x3904('0x24')]();var _0x2ab2da={'account':_0x15df30,'message':_['merge']({'from':util['format'](_0x3904('0x25'),_0x48a7bf['name'],_0x48a7bf['email']||_0x48a7bf['Smtp'][_0x3904('0x14')])},_0x37a128)};return client['request'](_0x3904('0x26'),_0x2ab2da);})['then'](function(_0x43da44){if(_0x43da44[_0x3904('0x27')]){throw new Error(util[_0x3904('0x28')](_0x3904('0x29'),_0x43da44[_0x3904('0x27')][_0x3904('0x2a')]||JSON[_0x3904('0x2b')](_0x43da44['error'])));}return!![];});}function handleError(_0x5ebcf8,_0x4345dd,_0x2c4fc5){return _0x5ebcf8[_0x3904('0x2c')](_0x4345dd||0x1f4)[_0x3904('0x2d')]({'message':_0x2c4fc5?_0x2c4fc5[_0x3904('0x2a')]||_0x2c4fc5:''});}exports['login']=function(_0x19914a,_0x5cf6dc,_0xc12d8f){passport[_0x3904('0x16')]('local-login',function(_0x2cc4d7,_0x5f567a,_0x333fe1){var _0x338f6e=_0x2cc4d7||_0x333fe1;if(_0x338f6e){return handleError(_0x5cf6dc,0x191,_0x338f6e);}if(!_0x5f567a){return handleError(_0x5cf6dc,0x194,{'message':_0x3904('0x2e')});}else{var _0x178a0b={'payload':{'id':_0x5f567a['id'],'role':_0x5f567a[_0x3904('0x10')]},'options':{'expiresIn':0x15180}};return authService[_0x3904('0x2f')](_0x178a0b)[_0x3904('0xd')](function(_0x598639){_0x5cf6dc[_0x3904('0x30')]({'id':_0x5f567a['id'],'token':_0x598639,'statusCall':'','isAlreadyLogged':_0x5f567a[_0x3904('0x31')]});});}})(_0x19914a,_0x5cf6dc,_0xc12d8f);};exports[_0x3904('0x32')]=function(_0x31cd3d,_0x39011b){if(!_0x31cd3d[_0x3904('0x33')][_0x3904('0x20')]){return handleError(_0x39011b,0x1f4,{'message':_0x3904('0x34')});}var _0x44965e=rs[_0x3904('0x35')]();_0x31cd3d[_0x3904('0x33')]['email']=_0x31cd3d[_0x3904('0x33')]['email'][_0x3904('0x36')]()[_0x3904('0x37')]();var _0xa7e8ee;return db[_0x3904('0x9')]['findOne']({'where':{'id':0x1},'attributes':[_0x3904('0xb'),_0x3904('0xc')],'raw':!![]})[_0x3904('0xd')](function(_0x1da820){_0xa7e8ee=_0x1da820;return db['User']['find']({'where':{'email':_0x31cd3d[_0x3904('0x33')][_0x3904('0x20')]}});})[_0x3904('0xd')](function(_0x2147c2){if(!_0x2147c2){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x2147c2[_0x3904('0x17')]){throw new Error(_0x3904('0x38'));}if(_0x2147c2[_0x3904('0x19')]){if(moment(_0x2147c2[_0x3904('0x11')])['add'](_0xa7e8ee['blockDuration'],_0x3904('0x1b'))>moment()){throw new Error(_0x3904('0x39'));}else{_0x2147c2[_0x3904('0x19')]=![];_0x2147c2[_0x3904('0x11')]=null;}}_0x2147c2[_0x3904('0x3a')]=_0x44965e;_0x2147c2[_0x3904('0x3b')]=Date['now']()+0x36ee80;return _0x2147c2[_0x3904('0x3c')]();})[_0x3904('0xd')](function(){return sendServiceMail({'to':_0x31cd3d['body'][_0x3904('0x20')],'subject':_0x3904('0x3d'),'text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0x3904('0x3e')+_0x3904('0x3f')+_0x31cd3d['headers'][_0x3904('0x40')]+_0x3904('0x41')+_0x44965e+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})[_0x3904('0xd')](function(){_0x39011b[_0x3904('0x2c')](0xc8)[_0x3904('0x2d')]({'message':'Reset\x20Email\x20sent!'});})[_0x3904('0x1e')](function(_0x12eebb){return handleError(_0x39011b,0x1f4,_0x12eebb);});};exports[_0x3904('0x42')]=function(_0x3005c1,_0x421c37){return db[_0x3904('0x43')][_0x3904('0x44')]({'where':{'resetPasswordToken':_0x3005c1[_0x3904('0x45')][_0x3904('0x46')],'resetPasswordExpires':{'$gt':Date[_0x3904('0x47')]()}}})[_0x3904('0xd')](function(_0x5cb9dc){if(!_0x5cb9dc){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db[_0x3904('0x9')]['findOne']({'attributes':['id','securePassword',_0x3904('0x48'),_0x3904('0x49')]})[_0x3904('0xd')](function(_0x378205){if(_0x378205[_0x3904('0x4a')])authService[_0x3904('0x4b')](_0x3005c1[_0x3904('0x33')][_0x3904('0xf')]);if(!_0x378205[_0x3904('0x48')]||!_0x5cb9dc[_0x3904('0x4c')])return _0x5cb9dc;authService[_0x3904('0x4d')](_0x3005c1[_0x3904('0x33')][_0x3904('0xf')],_0x5cb9dc[_0x3904('0x4c')],_0x378205[_0x3904('0x49')]);return _0x5cb9dc;})[_0x3904('0xd')](function(){_0x5cb9dc[_0x3904('0xf')]=_0x3005c1[_0x3904('0x33')][_0x3904('0xf')];_0x5cb9dc[_0x3904('0x3a')]=null;_0x5cb9dc[_0x3904('0x3b')]=null;return _0x5cb9dc[_0x3904('0x3c')]();});})[_0x3904('0xd')](function(){_0x421c37[_0x3904('0x2c')](0xc8)[_0x3904('0x2d')]({'message':_0x3904('0x4e')});})[_0x3904('0x1e')](function(_0x597377){return handleError(_0x421c37,0x1f4,_0x597377);});};passport[_0x3904('0x4f')](_0x3904('0x50'),new LocalStrategy({'usernameField':_0x3904('0xe'),'passwordField':_0x3904('0xf')},function(_0x2f8853,_0x282991,_0x1e580a){return localAuthenticate(db[_0x3904('0x43')],_0x2f8853,_0x282991,_0x1e580a);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 0ca5cdb..75d1009 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 _0x878c=['forgot','/reset/:token','exports','Router','./authLocal.controller','post','login','/forgot'];(function(_0x18b959,_0x1580ab){var _0x33c55f=function(_0x5d7f0a){while(--_0x5d7f0a){_0x18b959['push'](_0x18b959['shift']());}};_0x33c55f(++_0x1580ab);}(_0x878c,0x1e3));var _0xc878=function(_0x3f29b4,_0x2b5b02){_0x3f29b4=_0x3f29b4-0x0;var _0x4d8893=_0x878c[_0x3f29b4];return _0x4d8893;};'use strict';var express=require('express');var router=express[_0xc878('0x0')]();var controller=require(_0xc878('0x1'));router[_0xc878('0x2')]('/',controller[_0xc878('0x3')]);router['post'](_0xc878('0x4'),controller[_0xc878('0x5')]);router['post'](_0xc878('0x6'),controller['reset']);module[_0xc878('0x7')]=router; \ No newline at end of file +var _0x03a4=['/forgot','forgot','/reset/:token','exports','./authLocal.controller','login','post'];(function(_0x2c4aa2,_0x4539ea){var _0x30f267=function(_0x587c28){while(--_0x587c28){_0x2c4aa2['push'](_0x2c4aa2['shift']());}};_0x30f267(++_0x4539ea);}(_0x03a4,0x18c));var _0x403a=function(_0x2e1f14,_0x4bca84){_0x2e1f14=_0x2e1f14-0x0;var _0x5ef864=_0x03a4[_0x2e1f14];return _0x5ef864;};'use strict';var express=require('express');var router=express['Router']();var controller=require(_0x403a('0x0'));router['post']('/',controller[_0x403a('0x1')]);router[_0x403a('0x2')](_0x403a('0x3'),controller[_0x403a('0x4')]);router[_0x403a('0x2')](_0x403a('0x5'),controller['reset']);module[_0x403a('0x6')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 8243210..2e23cb5 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 _0x56b0=['exports','STRING','BOOLEAN','INTEGER','sequelize'];(function(_0x5f0b80,_0x3a42a5){var _0x460a43=function(_0x4d20fd){while(--_0x4d20fd){_0x5f0b80['push'](_0x5f0b80['shift']());}};_0x460a43(++_0x3a42a5);}(_0x56b0,0x95));var _0x056b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x56b0[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x056b('0x0'));module[_0x056b('0x1')]={'name':{'type':Sequelize[_0x056b('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x056b('0x2')]},'description':{'type':Sequelize[_0x056b('0x2')]},'status':{'type':Sequelize[_0x056b('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x056b('0x4')],'defaultValue':0xa}}; \ No newline at end of file +var _0x151d=['exports','STRING','BOOLEAN','INTEGER','sequelize'];(function(_0x57e8e2,_0x13c31f){var _0x3ddac5=function(_0x1c895b){while(--_0x1c895b){_0x57e8e2['push'](_0x57e8e2['shift']());}};_0x3ddac5(++_0x13c31f);}(_0x151d,0xfe));var _0xd151=function(_0x30133c,_0x42bb03){_0x30133c=_0x30133c-0x0;var _0x88a9dc=_0x151d[_0x30133c];return _0x88a9dc;};'use strict';var Sequelize=require(_0xd151('0x0'));module[_0xd151('0x1')]={'name':{'type':Sequelize[_0xd151('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0xd151('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0xd151('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0xd151('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 399f6c4..3315e92 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 _0xae0f=['findOne','Action','order','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','Automation','includeAll','findAll','rows','catch','include','options','find','create','body','params','destroy','addConditions','Condition','ids','omit','getConditions','nolimit','addActions','getActions'];(function(_0x832fdb,_0x150d5a){var _0x5a1986=function(_0x51a922){while(--_0x51a922){_0x832fdb['push'](_0x832fdb['shift']());}};_0x5a1986(++_0x150d5a);}(_0xae0f,0x1ac));var _0xfae0=function(_0x18e787,_0x4d3b61){_0x18e787=_0x18e787-0x0;var _0x359561=_0xae0f[_0x18e787];return _0x359561;};'use strict';var emlformat=require(_0xfae0('0x0'));var rimraf=require(_0xfae0('0x1'));var zipdir=require(_0xfae0('0x2'));var jsonpatch=require(_0xfae0('0x3'));var rp=require(_0xfae0('0x4'));var moment=require(_0xfae0('0x5'));var BPromise=require(_0xfae0('0x6'));var Mustache=require(_0xfae0('0x7'));var util=require(_0xfae0('0x8'));var path=require(_0xfae0('0x9'));var sox=require(_0xfae0('0xa'));var csv=require(_0xfae0('0xb'));var ejs=require(_0xfae0('0xc'));var fs=require('fs');var fs_extra=require(_0xfae0('0xd'));var _=require(_0xfae0('0xe'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xfae0('0xf'));var deskjs=require(_0xfae0('0x10'));var toCsv=require(_0xfae0('0xb'));var querystring=require(_0xfae0('0x11'));var Papa=require(_0xfae0('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xfae0('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfae0('0x14'));var logger=require(_0xfae0('0x15'))('api');var utils=require(_0xfae0('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xfae0('0x17'))['db'];function respondWithStatusCode(_0x3d1864,_0x5d952b){_0x5d952b=_0x5d952b||0xcc;return function(_0x263d82){if(_0x263d82){return _0x3d1864['sendStatus'](_0x5d952b);}return _0x3d1864[_0xfae0('0x18')](_0x5d952b)[_0xfae0('0x19')]();};}function respondWithResult(_0x40ea34,_0x4c04be){_0x4c04be=_0x4c04be||0xc8;return function(_0xab815a){if(_0xab815a){return _0x40ea34[_0xfae0('0x18')](_0x4c04be)[_0xfae0('0x1a')](_0xab815a);}};}function respondWithFilteredResult(_0x2660d5,_0x20904a){return function(_0x1189b3){if(_0x1189b3){var _0x4638a7=typeof _0x20904a[_0xfae0('0x1b')]===_0xfae0('0x1c')&&typeof _0x20904a[_0xfae0('0x1d')]===_0xfae0('0x1c');var _0x481c80=_0x1189b3[_0xfae0('0x1e')];var _0x24971c=_0x4638a7?0x0:_0x20904a['offset'];var _0x2b3466=_0x4638a7?_0x1189b3[_0xfae0('0x1e')]:_0x20904a[_0xfae0('0x1b')]+_0x20904a[_0xfae0('0x1d')];var _0x5ea766;if(_0x2b3466>=_0x481c80){_0x2b3466=_0x481c80;_0x5ea766=0xc8;}else{_0x5ea766=0xce;}_0x2660d5['status'](_0x5ea766);return _0x2660d5[_0xfae0('0x1f')](_0xfae0('0x20'),_0x24971c+'-'+_0x2b3466+'/'+_0x481c80)[_0xfae0('0x1a')](_0x1189b3);}return null;};}function patchUpdates(_0x500a38){return function(_0x10f5c4){try{jsonpatch[_0xfae0('0x21')](_0x10f5c4,_0x500a38,!![]);}catch(_0x2bbcd9){return BPromise[_0xfae0('0x22')](_0x2bbcd9);}return _0x10f5c4[_0xfae0('0x23')]();};}function saveUpdates(_0x401094,_0x2f3136){return function(_0x3c2c37){if(_0x3c2c37){return _0x3c2c37[_0xfae0('0x24')](_0x401094)[_0xfae0('0x25')](function(_0x5d8ee8){return _0x5d8ee8;});}return null;};}function removeEntity(_0x48590d,_0x4ca462){return function(_0x777acc){if(_0x777acc){return _0x777acc['destroy']()[_0xfae0('0x25')](function(){_0x48590d[_0xfae0('0x18')](0xcc)[_0xfae0('0x19')]();});}};}function handleEntityNotFound(_0x36a6a9,_0x1b2cda){return function(_0x353d3b){if(!_0x353d3b){_0x36a6a9[_0xfae0('0x26')](0x194);}return _0x353d3b;};}function handleError(_0x2c7ed9,_0x28690e){_0x28690e=_0x28690e||0x1f4;return function(_0x567adf){logger[_0xfae0('0x27')](_0x567adf[_0xfae0('0x28')]);if(_0x567adf[_0xfae0('0x29')]){delete _0x567adf['name'];}_0x2c7ed9[_0xfae0('0x18')](_0x28690e)['send'](_0x567adf);};}exports['index']=function(_0x4471fa,_0x5788c7){var _0x3892de={},_0x2fb09e={},_0x5c41c3={'count':0x0,'rows':[]};var _0x4dc8db=_[_0xfae0('0x2a')](db['Automation'][_0xfae0('0x2b')],function(_0x162cfb){return{'name':_0x162cfb[_0xfae0('0x2c')],'type':_0x162cfb[_0xfae0('0x2d')][_0xfae0('0x2e')]};});_0x2fb09e[_0xfae0('0x2f')]=_['map'](_0x4dc8db,_0xfae0('0x29'));_0x2fb09e[_0xfae0('0x30')]=_[_0xfae0('0x31')](_0x4471fa[_0xfae0('0x30')]);_0x2fb09e[_0xfae0('0x32')]=_[_0xfae0('0x33')](_0x2fb09e[_0xfae0('0x2f')],_0x2fb09e[_0xfae0('0x30')]);_0x3892de[_0xfae0('0x34')]=_[_0xfae0('0x33')](_0x2fb09e[_0xfae0('0x2f')],qs['fields'](_0x4471fa['query'][_0xfae0('0x35')]));_0x3892de[_0xfae0('0x34')]=_0x3892de[_0xfae0('0x34')][_0xfae0('0x36')]?_0x3892de[_0xfae0('0x34')]:_0x2fb09e[_0xfae0('0x2f')];if(!_0x4471fa['query'][_0xfae0('0x37')]('nolimit')){_0x3892de['limit']=qs[_0xfae0('0x1d')](_0x4471fa[_0xfae0('0x30')][_0xfae0('0x1d')]);_0x3892de[_0xfae0('0x1b')]=qs[_0xfae0('0x1b')](_0x4471fa[_0xfae0('0x30')][_0xfae0('0x1b')]);}_0x3892de['order']=qs[_0xfae0('0x38')](_0x4471fa[_0xfae0('0x30')][_0xfae0('0x38')]);_0x3892de[_0xfae0('0x39')]=qs[_0xfae0('0x32')](_[_0xfae0('0x3a')](_0x4471fa[_0xfae0('0x30')],_0x2fb09e['filters']),_0x4dc8db);if(_0x4471fa[_0xfae0('0x30')][_0xfae0('0x3b')]){_0x3892de[_0xfae0('0x39')]=_[_0xfae0('0x3c')](_0x3892de[_0xfae0('0x39')],{'$or':_[_0xfae0('0x2a')](_0x4dc8db,function(_0x56443c){if(_0x56443c[_0xfae0('0x2d')]!==_0xfae0('0x3d')){var _0x2335fb={};_0x2335fb[_0x56443c[_0xfae0('0x29')]]={'$like':'%'+_0x4471fa[_0xfae0('0x30')][_0xfae0('0x3b')]+'%'};return _0x2335fb;}})});}_0x3892de=_['merge']({},_0x3892de,_0x4471fa['options']);var _0x1c1d7d={'where':_0x3892de['where']};return db[_0xfae0('0x3e')][_0xfae0('0x1e')](_0x1c1d7d)[_0xfae0('0x25')](function(_0x425495){_0x5c41c3[_0xfae0('0x1e')]=_0x425495;if(_0x4471fa[_0xfae0('0x30')][_0xfae0('0x3f')]){_0x3892de['include']=[{'all':!![]}];}return db[_0xfae0('0x3e')][_0xfae0('0x40')](_0x3892de);})[_0xfae0('0x25')](function(_0x3532b2){_0x5c41c3[_0xfae0('0x41')]=_0x3532b2;return _0x5c41c3;})[_0xfae0('0x25')](respondWithFilteredResult(_0x5788c7,_0x3892de))[_0xfae0('0x42')](handleError(_0x5788c7,null));};exports['show']=function(_0x4393cb,_0x231549){var _0x114d54={'raw':![],'where':{'id':_0x4393cb['params']['id']}},_0x4dd98f={};_0x4dd98f[_0xfae0('0x2f')]=_[_0xfae0('0x31')](db[_0xfae0('0x3e')]['rawAttributes']);_0x4dd98f[_0xfae0('0x30')]=_[_0xfae0('0x31')](_0x4393cb['query']);_0x4dd98f[_0xfae0('0x32')]=_[_0xfae0('0x33')](_0x4dd98f[_0xfae0('0x2f')],_0x4dd98f[_0xfae0('0x30')]);_0x114d54[_0xfae0('0x34')]=_[_0xfae0('0x33')](_0x4dd98f[_0xfae0('0x2f')],qs[_0xfae0('0x35')](_0x4393cb[_0xfae0('0x30')][_0xfae0('0x35')]));_0x114d54[_0xfae0('0x34')]=_0x114d54[_0xfae0('0x34')][_0xfae0('0x36')]?_0x114d54['attributes']:_0x4dd98f[_0xfae0('0x2f')];if(_0x4393cb[_0xfae0('0x30')][_0xfae0('0x3f')]){_0x114d54[_0xfae0('0x43')]=[{'all':!![]}];}_0x114d54=_['merge']({},_0x114d54,_0x4393cb[_0xfae0('0x44')]);return db['Automation'][_0xfae0('0x45')](_0x114d54)['then'](handleEntityNotFound(_0x231549,null))[_0xfae0('0x25')](respondWithResult(_0x231549,null))[_0xfae0('0x42')](handleError(_0x231549,null));};exports[_0xfae0('0x46')]=function(_0x5cab3f,_0x565294){return db[_0xfae0('0x3e')][_0xfae0('0x46')](_0x5cab3f[_0xfae0('0x47')],{})[_0xfae0('0x25')](respondWithResult(_0x565294,0xc9))['catch'](handleError(_0x565294,null));};exports[_0xfae0('0x24')]=function(_0x96e996,_0x5991a3){if(_0x96e996[_0xfae0('0x47')]['id']){delete _0x96e996[_0xfae0('0x47')]['id'];}return db[_0xfae0('0x3e')][_0xfae0('0x45')]({'where':{'id':_0x96e996[_0xfae0('0x48')]['id']}})[_0xfae0('0x25')](handleEntityNotFound(_0x5991a3,null))[_0xfae0('0x25')](saveUpdates(_0x96e996['body'],null))['then'](respondWithResult(_0x5991a3,null))[_0xfae0('0x42')](handleError(_0x5991a3,null));};exports[_0xfae0('0x49')]=function(_0x3ed3f9,_0x4d2ef8){return db[_0xfae0('0x3e')][_0xfae0('0x45')]({'where':{'id':_0x3ed3f9[_0xfae0('0x48')]['id']}})[_0xfae0('0x25')](handleEntityNotFound(_0x4d2ef8,null))[_0xfae0('0x25')](removeEntity(_0x4d2ef8,null))[_0xfae0('0x42')](handleError(_0x4d2ef8,null));};exports[_0xfae0('0x4a')]=function(_0x1210bb,_0x5c1541,_0x5c3068){return db[_0xfae0('0x4b')][_0xfae0('0x45')]({'where':{'id':_0x1210bb[_0xfae0('0x48')]['id']}})[_0xfae0('0x25')](handleEntityNotFound(_0x5c1541,null))[_0xfae0('0x25')](function(_0x319d86){if(_0x319d86){return _0x319d86[_0xfae0('0x4a')](_0x1210bb[_0xfae0('0x47')][_0xfae0('0x4c')],_[_0xfae0('0x4d')](_0x1210bb[_0xfae0('0x47')],[_0xfae0('0x4c'),'id'])||{});}})[_0xfae0('0x25')](respondWithResult(_0x5c1541,null))[_0xfae0('0x42')](handleError(_0x5c1541,null));};exports[_0xfae0('0x4e')]=function(_0xb01c31,_0x3b3b63,_0x4ef121){var _0x4471d6={};var _0x5365cd={};var _0x249e38;var _0xfc3bc4;return db['Automation']['findOne']({'where':{'id':_0xb01c31[_0xfae0('0x48')]['id']}})['then'](handleEntityNotFound(_0x3b3b63,null))[_0xfae0('0x25')](function(_0x1dbb75){if(_0x1dbb75){_0x249e38=_0x1dbb75;_0x5365cd[_0xfae0('0x2f')]=_['keys'](db['Condition'][_0xfae0('0x2b')]);_0x5365cd[_0xfae0('0x30')]=_[_0xfae0('0x31')](_0xb01c31[_0xfae0('0x30')]);_0x5365cd[_0xfae0('0x32')]=_['intersection'](_0x5365cd[_0xfae0('0x2f')],_0x5365cd['query']);_0x4471d6[_0xfae0('0x34')]=_[_0xfae0('0x33')](_0x5365cd['model'],qs[_0xfae0('0x35')](_0xb01c31['query'][_0xfae0('0x35')]));_0x4471d6[_0xfae0('0x34')]=_0x4471d6[_0xfae0('0x34')][_0xfae0('0x36')]?_0x4471d6[_0xfae0('0x34')]:_0x5365cd['model'];_0x4471d6['order']=qs[_0xfae0('0x38')](_0xb01c31[_0xfae0('0x30')][_0xfae0('0x38')]);_0x4471d6[_0xfae0('0x39')]=qs[_0xfae0('0x32')](_[_0xfae0('0x3a')](_0xb01c31[_0xfae0('0x30')],_0x5365cd[_0xfae0('0x32')]));if(_0xb01c31[_0xfae0('0x30')][_0xfae0('0x3b')]){_0x4471d6['where']=_[_0xfae0('0x3c')](_0x4471d6[_0xfae0('0x39')],{'$or':_[_0xfae0('0x2a')](_0x4471d6[_0xfae0('0x34')],function(_0x301430){var _0x7a0c9d={};_0x7a0c9d[_0x301430]={'$like':'%'+_0xb01c31[_0xfae0('0x30')][_0xfae0('0x3b')]+'%'};return _0x7a0c9d;})});}_0x4471d6=_['merge']({},_0x4471d6,_0xb01c31['options']);return _0x249e38['getConditions'](_0x4471d6);}})[_0xfae0('0x25')](function(_0x37d613){if(_0x37d613){_0xfc3bc4=_0x37d613['length'];if(!_0xb01c31[_0xfae0('0x30')][_0xfae0('0x37')](_0xfae0('0x4f'))){_0x4471d6[_0xfae0('0x1d')]=qs[_0xfae0('0x1d')](_0xb01c31['query'][_0xfae0('0x1d')]);_0x4471d6[_0xfae0('0x1b')]=qs['offset'](_0xb01c31[_0xfae0('0x30')]['offset']);}return _0x249e38['getConditions'](_0x4471d6);}})[_0xfae0('0x25')](function(_0x21d428){if(_0x21d428){return _0x21d428?{'count':_0xfc3bc4,'rows':_0x21d428}:null;}})[_0xfae0('0x25')](respondWithResult(_0x3b3b63,null))[_0xfae0('0x42')](handleError(_0x3b3b63,null));};exports[_0xfae0('0x50')]=function(_0x42b416,_0x18453c,_0xa09074){return db['Action'][_0xfae0('0x45')]({'where':{'id':_0x42b416[_0xfae0('0x48')]['id']}})['then'](handleEntityNotFound(_0x18453c,null))[_0xfae0('0x25')](function(_0xce1036){if(_0xce1036){return _0xce1036[_0xfae0('0x50')](_0x42b416[_0xfae0('0x47')][_0xfae0('0x4c')],_['omit'](_0x42b416[_0xfae0('0x47')],[_0xfae0('0x4c'),'id'])||{});}})['then'](respondWithResult(_0x18453c,null))['catch'](handleError(_0x18453c,null));};exports[_0xfae0('0x51')]=function(_0x169efa,_0x2a3496,_0x91dddd){var _0x1975bb={};var _0x135403={};var _0x3dcee1;var _0x9722a3;return db[_0xfae0('0x3e')][_0xfae0('0x52')]({'where':{'id':_0x169efa[_0xfae0('0x48')]['id']}})[_0xfae0('0x25')](handleEntityNotFound(_0x2a3496,null))[_0xfae0('0x25')](function(_0x499b68){if(_0x499b68){_0x3dcee1=_0x499b68;_0x135403[_0xfae0('0x2f')]=_[_0xfae0('0x31')](db[_0xfae0('0x53')][_0xfae0('0x2b')]);_0x135403[_0xfae0('0x30')]=_[_0xfae0('0x31')](_0x169efa['query']);_0x135403[_0xfae0('0x32')]=_['intersection'](_0x135403['model'],_0x135403[_0xfae0('0x30')]);_0x1975bb['attributes']=_[_0xfae0('0x33')](_0x135403[_0xfae0('0x2f')],qs[_0xfae0('0x35')](_0x169efa[_0xfae0('0x30')][_0xfae0('0x35')]));_0x1975bb[_0xfae0('0x34')]=_0x1975bb[_0xfae0('0x34')][_0xfae0('0x36')]?_0x1975bb['attributes']:_0x135403['model'];_0x1975bb[_0xfae0('0x54')]=qs['sort'](_0x169efa['query'][_0xfae0('0x38')]);_0x1975bb['where']=qs[_0xfae0('0x32')](_['pick'](_0x169efa[_0xfae0('0x30')],_0x135403[_0xfae0('0x32')]));if(_0x169efa[_0xfae0('0x30')][_0xfae0('0x3b')]){_0x1975bb['where']=_[_0xfae0('0x3c')](_0x1975bb['where'],{'$or':_[_0xfae0('0x2a')](_0x1975bb[_0xfae0('0x34')],function(_0x14769b){var _0x313d9c={};_0x313d9c[_0x14769b]={'$like':'%'+_0x169efa[_0xfae0('0x30')][_0xfae0('0x3b')]+'%'};return _0x313d9c;})});}_0x1975bb=_[_0xfae0('0x3c')]({},_0x1975bb,_0x169efa['options']);return _0x3dcee1[_0xfae0('0x51')](_0x1975bb);}})['then'](function(_0x83a503){if(_0x83a503){_0x9722a3=_0x83a503[_0xfae0('0x36')];if(!_0x169efa['query'][_0xfae0('0x37')](_0xfae0('0x4f'))){_0x1975bb['limit']=qs['limit'](_0x169efa[_0xfae0('0x30')][_0xfae0('0x1d')]);_0x1975bb[_0xfae0('0x1b')]=qs[_0xfae0('0x1b')](_0x169efa['query'][_0xfae0('0x1b')]);}return _0x3dcee1['getActions'](_0x1975bb);}})[_0xfae0('0x25')](function(_0x468b31){if(_0x468b31){return _0x468b31?{'count':_0x9722a3,'rows':_0x468b31}:null;}})[_0xfae0('0x25')](respondWithResult(_0x2a3496,null))[_0xfae0('0x42')](handleError(_0x2a3496,null));}; \ No newline at end of file +var _0x967a=['create','body','addConditions','Condition','ids','getConditions','findOne','addActions','Action','omit','getActions','rimraf','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','end','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','then','sendStatus','error','stack','name','send','index','rawAttributes','fieldName','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','Automation','rows','catch','params','find'];(function(_0x23493c,_0xece383){var _0xb4af18=function(_0x3d28af){while(--_0x3d28af){_0x23493c['push'](_0x23493c['shift']());}};_0xb4af18(++_0xece383);}(_0x967a,0xf2));var _0xa967=function(_0x5170b3,_0x5df19e){_0x5170b3=_0x5170b3-0x0;var _0x4e43a7=_0x967a[_0x5170b3];return _0x4e43a7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa967('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa967('0x1'));var rp=require(_0xa967('0x2'));var moment=require('moment');var BPromise=require(_0xa967('0x3'));var Mustache=require('mustache');var util=require(_0xa967('0x4'));var path=require('path');var sox=require(_0xa967('0x5'));var csv=require(_0xa967('0x6'));var ejs=require(_0xa967('0x7'));var fs=require('fs');var fs_extra=require(_0xa967('0x8'));var _=require(_0xa967('0x9'));var squel=require('squel');var crypto=require(_0xa967('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa967('0xb'));var Redis=require(_0xa967('0xc'));var authService=require(_0xa967('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xa967('0xe'));var hardwareService=require(_0xa967('0xf'));var logger=require(_0xa967('0x10'))(_0xa967('0x11'));var utils=require(_0xa967('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x40eabd,_0x218ed5){_0x218ed5=_0x218ed5||0xcc;return function(_0x3e4d19){if(_0x3e4d19){return _0x40eabd['sendStatus'](_0x218ed5);}return _0x40eabd['status'](_0x218ed5)[_0xa967('0x13')]();};}function respondWithResult(_0x330e97,_0x17fff1){_0x17fff1=_0x17fff1||0xc8;return function(_0x129b0c){if(_0x129b0c){return _0x330e97[_0xa967('0x14')](_0x17fff1)[_0xa967('0x15')](_0x129b0c);}};}function respondWithFilteredResult(_0x396487,_0x4d1ef2){return function(_0x234bdc){if(_0x234bdc){var _0x3c73df=typeof _0x4d1ef2[_0xa967('0x16')]==='undefined'&&typeof _0x4d1ef2['limit']===_0xa967('0x17');var _0xd66328=_0x234bdc['count'];var _0x295d7b=_0x3c73df?0x0:_0x4d1ef2['offset'];var _0x3d3257=_0x3c73df?_0x234bdc[_0xa967('0x18')]:_0x4d1ef2['offset']+_0x4d1ef2[_0xa967('0x19')];var _0x320b81;if(_0x3d3257>=_0xd66328){_0x3d3257=_0xd66328;_0x320b81=0xc8;}else{_0x320b81=0xce;}_0x396487['status'](_0x320b81);return _0x396487['set'](_0xa967('0x1a'),_0x295d7b+'-'+_0x3d3257+'/'+_0xd66328)[_0xa967('0x15')](_0x234bdc);}return null;};}function patchUpdates(_0x615df6){return function(_0xa859d0){try{jsonpatch[_0xa967('0x1b')](_0xa859d0,_0x615df6,!![]);}catch(_0x171871){return BPromise[_0xa967('0x1c')](_0x171871);}return _0xa859d0[_0xa967('0x1d')]();};}function saveUpdates(_0x517cf4,_0x5b8047){return function(_0x1e0645){if(_0x1e0645){return _0x1e0645['update'](_0x517cf4)[_0xa967('0x1e')](function(_0x42c808){return _0x42c808;});}return null;};}function removeEntity(_0x59ddf7,_0x5a99d7){return function(_0x2cf1d7){if(_0x2cf1d7){return _0x2cf1d7['destroy']()[_0xa967('0x1e')](function(){_0x59ddf7[_0xa967('0x14')](0xcc)[_0xa967('0x13')]();});}};}function handleEntityNotFound(_0x31f84f,_0x4bb2d1){return function(_0x4dc81c){if(!_0x4dc81c){_0x31f84f[_0xa967('0x1f')](0x194);}return _0x4dc81c;};}function handleError(_0x410204,_0x13cc54){_0x13cc54=_0x13cc54||0x1f4;return function(_0xb413b7){logger[_0xa967('0x20')](_0xb413b7[_0xa967('0x21')]);if(_0xb413b7['name']){delete _0xb413b7[_0xa967('0x22')];}_0x410204[_0xa967('0x14')](_0x13cc54)[_0xa967('0x23')](_0xb413b7);};}exports[_0xa967('0x24')]=function(_0xf2845d,_0x50953f){var _0x3c977d={},_0x5ab51a={},_0x327950={'count':0x0,'rows':[]};var _0x52b37d=_['map'](db['Automation'][_0xa967('0x25')],function(_0x29f77d){return{'name':_0x29f77d[_0xa967('0x26')],'type':_0x29f77d['type']['key']};});_0x5ab51a[_0xa967('0x27')]=_[_0xa967('0x28')](_0x52b37d,_0xa967('0x22'));_0x5ab51a[_0xa967('0x29')]=_[_0xa967('0x2a')](_0xf2845d['query']);_0x5ab51a['filters']=_[_0xa967('0x2b')](_0x5ab51a[_0xa967('0x27')],_0x5ab51a['query']);_0x3c977d['attributes']=_[_0xa967('0x2b')](_0x5ab51a['model'],qs[_0xa967('0x2c')](_0xf2845d[_0xa967('0x29')][_0xa967('0x2c')]));_0x3c977d[_0xa967('0x2d')]=_0x3c977d['attributes'][_0xa967('0x2e')]?_0x3c977d[_0xa967('0x2d')]:_0x5ab51a[_0xa967('0x27')];if(!_0xf2845d['query'][_0xa967('0x2f')](_0xa967('0x30'))){_0x3c977d[_0xa967('0x19')]=qs['limit'](_0xf2845d[_0xa967('0x29')][_0xa967('0x19')]);_0x3c977d[_0xa967('0x16')]=qs[_0xa967('0x16')](_0xf2845d[_0xa967('0x29')]['offset']);}_0x3c977d[_0xa967('0x31')]=qs[_0xa967('0x32')](_0xf2845d[_0xa967('0x29')][_0xa967('0x32')]);_0x3c977d[_0xa967('0x33')]=qs[_0xa967('0x34')](_[_0xa967('0x35')](_0xf2845d[_0xa967('0x29')],_0x5ab51a['filters']),_0x52b37d);if(_0xf2845d['query'][_0xa967('0x36')]){_0x3c977d['where']=_[_0xa967('0x37')](_0x3c977d[_0xa967('0x33')],{'$or':_['map'](_0x52b37d,function(_0x46ef2b){if(_0x46ef2b[_0xa967('0x38')]!==_0xa967('0x39')){var _0x52c631={};_0x52c631[_0x46ef2b[_0xa967('0x22')]]={'$like':'%'+_0xf2845d['query'][_0xa967('0x36')]+'%'};return _0x52c631;}})});}_0x3c977d=_['merge']({},_0x3c977d,_0xf2845d[_0xa967('0x3a')]);var _0xed8ef1={'where':_0x3c977d[_0xa967('0x33')]};return db['Automation'][_0xa967('0x18')](_0xed8ef1)[_0xa967('0x1e')](function(_0x58fc26){_0x327950[_0xa967('0x18')]=_0x58fc26;if(_0xf2845d[_0xa967('0x29')][_0xa967('0x3b')]){_0x3c977d[_0xa967('0x3c')]=[{'all':!![]}];}return db[_0xa967('0x3d')]['findAll'](_0x3c977d);})[_0xa967('0x1e')](function(_0x3cb6de){_0x327950[_0xa967('0x3e')]=_0x3cb6de;return _0x327950;})[_0xa967('0x1e')](respondWithFilteredResult(_0x50953f,_0x3c977d))[_0xa967('0x3f')](handleError(_0x50953f,null));};exports['show']=function(_0x1cbfd5,_0x3e86c7){var _0x1a29c0={'raw':![],'where':{'id':_0x1cbfd5[_0xa967('0x40')]['id']}},_0x16d800={};_0x16d800['model']=_[_0xa967('0x2a')](db[_0xa967('0x3d')]['rawAttributes']);_0x16d800[_0xa967('0x29')]=_['keys'](_0x1cbfd5[_0xa967('0x29')]);_0x16d800[_0xa967('0x34')]=_[_0xa967('0x2b')](_0x16d800[_0xa967('0x27')],_0x16d800[_0xa967('0x29')]);_0x1a29c0[_0xa967('0x2d')]=_[_0xa967('0x2b')](_0x16d800['model'],qs[_0xa967('0x2c')](_0x1cbfd5['query'][_0xa967('0x2c')]));_0x1a29c0[_0xa967('0x2d')]=_0x1a29c0['attributes'][_0xa967('0x2e')]?_0x1a29c0[_0xa967('0x2d')]:_0x16d800[_0xa967('0x27')];if(_0x1cbfd5['query'][_0xa967('0x3b')]){_0x1a29c0['include']=[{'all':!![]}];}_0x1a29c0=_[_0xa967('0x37')]({},_0x1a29c0,_0x1cbfd5['options']);return db['Automation'][_0xa967('0x41')](_0x1a29c0)['then'](handleEntityNotFound(_0x3e86c7,null))[_0xa967('0x1e')](respondWithResult(_0x3e86c7,null))[_0xa967('0x3f')](handleError(_0x3e86c7,null));};exports[_0xa967('0x42')]=function(_0x1b9408,_0x1e63e0){return db[_0xa967('0x3d')]['create'](_0x1b9408[_0xa967('0x43')],{})[_0xa967('0x1e')](respondWithResult(_0x1e63e0,0xc9))[_0xa967('0x3f')](handleError(_0x1e63e0,null));};exports['update']=function(_0xb5f0ae,_0x3ec895){if(_0xb5f0ae[_0xa967('0x43')]['id']){delete _0xb5f0ae['body']['id'];}return db['Automation'][_0xa967('0x41')]({'where':{'id':_0xb5f0ae[_0xa967('0x40')]['id']}})['then'](handleEntityNotFound(_0x3ec895,null))[_0xa967('0x1e')](saveUpdates(_0xb5f0ae[_0xa967('0x43')],null))[_0xa967('0x1e')](respondWithResult(_0x3ec895,null))[_0xa967('0x3f')](handleError(_0x3ec895,null));};exports['destroy']=function(_0xb36b39,_0x296a37){return db[_0xa967('0x3d')]['find']({'where':{'id':_0xb36b39[_0xa967('0x40')]['id']}})[_0xa967('0x1e')](handleEntityNotFound(_0x296a37,null))['then'](removeEntity(_0x296a37,null))[_0xa967('0x3f')](handleError(_0x296a37,null));};exports[_0xa967('0x44')]=function(_0x6eef9c,_0x26ae51,_0x116438){return db[_0xa967('0x45')][_0xa967('0x41')]({'where':{'id':_0x6eef9c[_0xa967('0x40')]['id']}})['then'](handleEntityNotFound(_0x26ae51,null))[_0xa967('0x1e')](function(_0x559c2a){if(_0x559c2a){return _0x559c2a[_0xa967('0x44')](_0x6eef9c[_0xa967('0x43')][_0xa967('0x46')],_['omit'](_0x6eef9c[_0xa967('0x43')],[_0xa967('0x46'),'id'])||{});}})[_0xa967('0x1e')](respondWithResult(_0x26ae51,null))[_0xa967('0x3f')](handleError(_0x26ae51,null));};exports[_0xa967('0x47')]=function(_0x3f3e3b,_0x4eb75f,_0x2248c8){var _0x56baa2={};var _0x38bfff={};var _0x5c72f1;var _0x20c74c;return db[_0xa967('0x3d')][_0xa967('0x48')]({'where':{'id':_0x3f3e3b[_0xa967('0x40')]['id']}})[_0xa967('0x1e')](handleEntityNotFound(_0x4eb75f,null))['then'](function(_0x100556){if(_0x100556){_0x5c72f1=_0x100556;_0x38bfff[_0xa967('0x27')]=_[_0xa967('0x2a')](db['Condition'][_0xa967('0x25')]);_0x38bfff[_0xa967('0x29')]=_[_0xa967('0x2a')](_0x3f3e3b['query']);_0x38bfff['filters']=_[_0xa967('0x2b')](_0x38bfff['model'],_0x38bfff[_0xa967('0x29')]);_0x56baa2['attributes']=_['intersection'](_0x38bfff[_0xa967('0x27')],qs[_0xa967('0x2c')](_0x3f3e3b[_0xa967('0x29')][_0xa967('0x2c')]));_0x56baa2[_0xa967('0x2d')]=_0x56baa2[_0xa967('0x2d')][_0xa967('0x2e')]?_0x56baa2[_0xa967('0x2d')]:_0x38bfff['model'];_0x56baa2[_0xa967('0x31')]=qs[_0xa967('0x32')](_0x3f3e3b[_0xa967('0x29')]['sort']);_0x56baa2[_0xa967('0x33')]=qs[_0xa967('0x34')](_[_0xa967('0x35')](_0x3f3e3b[_0xa967('0x29')],_0x38bfff[_0xa967('0x34')]));if(_0x3f3e3b['query'][_0xa967('0x36')]){_0x56baa2[_0xa967('0x33')]=_[_0xa967('0x37')](_0x56baa2['where'],{'$or':_[_0xa967('0x28')](_0x56baa2[_0xa967('0x2d')],function(_0x500092){var _0x1c4c2b={};_0x1c4c2b[_0x500092]={'$like':'%'+_0x3f3e3b['query'][_0xa967('0x36')]+'%'};return _0x1c4c2b;})});}_0x56baa2=_[_0xa967('0x37')]({},_0x56baa2,_0x3f3e3b[_0xa967('0x3a')]);return _0x5c72f1[_0xa967('0x47')](_0x56baa2);}})[_0xa967('0x1e')](function(_0x1df1b1){if(_0x1df1b1){_0x20c74c=_0x1df1b1[_0xa967('0x2e')];if(!_0x3f3e3b[_0xa967('0x29')]['hasOwnProperty'](_0xa967('0x30'))){_0x56baa2[_0xa967('0x19')]=qs[_0xa967('0x19')](_0x3f3e3b[_0xa967('0x29')][_0xa967('0x19')]);_0x56baa2[_0xa967('0x16')]=qs[_0xa967('0x16')](_0x3f3e3b['query'][_0xa967('0x16')]);}return _0x5c72f1[_0xa967('0x47')](_0x56baa2);}})[_0xa967('0x1e')](function(_0x4c5948){if(_0x4c5948){return _0x4c5948?{'count':_0x20c74c,'rows':_0x4c5948}:null;}})[_0xa967('0x1e')](respondWithResult(_0x4eb75f,null))[_0xa967('0x3f')](handleError(_0x4eb75f,null));};exports[_0xa967('0x49')]=function(_0x5d70d4,_0x27479f,_0x220b29){return db[_0xa967('0x4a')][_0xa967('0x41')]({'where':{'id':_0x5d70d4['params']['id']}})['then'](handleEntityNotFound(_0x27479f,null))[_0xa967('0x1e')](function(_0xf14816){if(_0xf14816){return _0xf14816['addActions'](_0x5d70d4['body'][_0xa967('0x46')],_[_0xa967('0x4b')](_0x5d70d4[_0xa967('0x43')],[_0xa967('0x46'),'id'])||{});}})[_0xa967('0x1e')](respondWithResult(_0x27479f,null))[_0xa967('0x3f')](handleError(_0x27479f,null));};exports[_0xa967('0x4c')]=function(_0x20c239,_0x4e2776,_0x57c1f2){var _0x1ebc68={};var _0x6e3587={};var _0x344c28;var _0x54df72;return db[_0xa967('0x3d')][_0xa967('0x48')]({'where':{'id':_0x20c239[_0xa967('0x40')]['id']}})[_0xa967('0x1e')](handleEntityNotFound(_0x4e2776,null))[_0xa967('0x1e')](function(_0x1435ab){if(_0x1435ab){_0x344c28=_0x1435ab;_0x6e3587[_0xa967('0x27')]=_['keys'](db[_0xa967('0x4a')][_0xa967('0x25')]);_0x6e3587[_0xa967('0x29')]=_['keys'](_0x20c239[_0xa967('0x29')]);_0x6e3587[_0xa967('0x34')]=_['intersection'](_0x6e3587[_0xa967('0x27')],_0x6e3587[_0xa967('0x29')]);_0x1ebc68['attributes']=_[_0xa967('0x2b')](_0x6e3587[_0xa967('0x27')],qs['fields'](_0x20c239[_0xa967('0x29')]['fields']));_0x1ebc68[_0xa967('0x2d')]=_0x1ebc68['attributes'][_0xa967('0x2e')]?_0x1ebc68[_0xa967('0x2d')]:_0x6e3587[_0xa967('0x27')];_0x1ebc68['order']=qs['sort'](_0x20c239[_0xa967('0x29')][_0xa967('0x32')]);_0x1ebc68['where']=qs['filters'](_[_0xa967('0x35')](_0x20c239[_0xa967('0x29')],_0x6e3587[_0xa967('0x34')]));if(_0x20c239[_0xa967('0x29')][_0xa967('0x36')]){_0x1ebc68[_0xa967('0x33')]=_[_0xa967('0x37')](_0x1ebc68['where'],{'$or':_['map'](_0x1ebc68[_0xa967('0x2d')],function(_0x20e36b){var _0x3a00a9={};_0x3a00a9[_0x20e36b]={'$like':'%'+_0x20c239['query'][_0xa967('0x36')]+'%'};return _0x3a00a9;})});}_0x1ebc68=_[_0xa967('0x37')]({},_0x1ebc68,_0x20c239[_0xa967('0x3a')]);return _0x344c28[_0xa967('0x4c')](_0x1ebc68);}})['then'](function(_0x10a07d){if(_0x10a07d){_0x54df72=_0x10a07d[_0xa967('0x2e')];if(!_0x20c239['query'][_0xa967('0x2f')](_0xa967('0x30'))){_0x1ebc68[_0xa967('0x19')]=qs['limit'](_0x20c239[_0xa967('0x29')][_0xa967('0x19')]);_0x1ebc68['offset']=qs[_0xa967('0x16')](_0x20c239[_0xa967('0x29')]['offset']);}return _0x344c28[_0xa967('0x4c')](_0x1ebc68);}})[_0xa967('0x1e')](function(_0x442bb2){if(_0x442bb2){return _0x442bb2?{'count':_0x54df72,'rows':_0x442bb2}:null;}})[_0xa967('0x1e')](respondWithResult(_0x4e2776,null))['catch'](handleError(_0x4e2776,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 1aea0fa..a8e3ae3 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 _0x2f74=['path','../../config/environment','./automation.attributes','Automation','tools_automations','lodash','util','../../config/logger','moment','request-promise'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2f74,0xeb));var _0x42f7=function(_0x5517c0,_0x358609){_0x5517c0=_0x5517c0-0x0;var _0x33803b=_0x2f74[_0x5517c0];return _0x33803b;};'use strict';var _=require(_0x42f7('0x0'));var util=require(_0x42f7('0x1'));var logger=require(_0x42f7('0x2'))('api');var moment=require(_0x42f7('0x3'));var BPromise=require('bluebird');var rp=require(_0x42f7('0x4'));var fs=require('fs');var path=require(_0x42f7('0x5'));var rimraf=require('rimraf');var config=require(_0x42f7('0x6'));var attributes=require(_0x42f7('0x7'));module['exports']=function(_0x4b0ac4,_0x113c1c){return _0x4b0ac4['define'](_0x42f7('0x8'),attributes,{'tableName':_0x42f7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x337a=['rimraf','./automation.attributes','exports','define','Automation','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x337a,0x131));var _0xa337=function(_0x51af8e,_0x36c7b1){_0x51af8e=_0x51af8e-0x0;var _0x3138f2=_0x337a[_0x51af8e];return _0x3138f2;};'use strict';var _=require(_0xa337('0x0'));var util=require(_0xa337('0x1'));var logger=require(_0xa337('0x2'))(_0xa337('0x3'));var moment=require(_0xa337('0x4'));var BPromise=require(_0xa337('0x5'));var rp=require(_0xa337('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa337('0x7'));var config=require('../../config/environment');var attributes=require(_0xa337('0x8'));module[_0xa337('0x9')]=function(_0x433cd4,_0x4dc102){return _0x433cd4[_0xa337('0xa')](_0xa337('0xb'),attributes,{'tableName':'tools_automations','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 a69b5c3..da4ffa1 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 _0xe34f=['result','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Automation,\x20%s,\x20%s','request\x20sent','error','message'];(function(_0x420b24,_0x382adc){var _0x4da552=function(_0x4e1623){while(--_0x4e1623){_0x420b24['push'](_0x420b24['shift']());}};_0x4da552(++_0x382adc);}(_0xe34f,0xbc));var _0xfe34=function(_0x5d66a2,_0x1ac1c9){_0x5d66a2=_0x5d66a2-0x0;var _0x1923d0=_0xe34f[_0x5d66a2];return _0x1923d0;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xfe34('0x0'));var fs=require('fs');var Redis=require(_0xfe34('0x1'));var db=require(_0xfe34('0x2'))['db'];var utils=require(_0xfe34('0x3'));var logger=require(_0xfe34('0x4'))(_0xfe34('0x5'));var config=require(_0xfe34('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xfe34('0x7')][_0xfe34('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x195bcd,_0x3fe816,_0x25f17a){return new BPromise(function(_0x4fa1cd,_0x5cdc7e){return client[_0xfe34('0x9')](_0x195bcd,_0x25f17a)[_0xfe34('0xa')](function(_0x252ec7){logger[_0xfe34('0xb')](_0xfe34('0xc'),_0x3fe816,_0xfe34('0xd'));logger['debug']('Automation,\x20%s,\x20%s,\x20%s',_0x3fe816,'request\x20sent',JSON['stringify'](_0x252ec7));if(_0x252ec7[_0xfe34('0xe')]){if(_0x252ec7[_0xfe34('0xe')]['code']===0x1f4){logger[_0xfe34('0xe')](_0xfe34('0xc'),_0x3fe816,_0x252ec7[_0xfe34('0xe')][_0xfe34('0xf')]);return _0x5cdc7e(_0x252ec7[_0xfe34('0xe')][_0xfe34('0xf')]);}logger['error'](_0xfe34('0xc'),_0x3fe816,_0x252ec7[_0xfe34('0xe')][_0xfe34('0xf')]);return _0x4fa1cd(_0x252ec7[_0xfe34('0xe')][_0xfe34('0xf')]);}else{logger['info'](_0xfe34('0xc'),_0x3fe816,_0xfe34('0xd'));_0x4fa1cd(_0x252ec7[_0xfe34('0x10')][_0xfe34('0xf')]);}})['catch'](function(_0x53b469){logger['error'](_0xfe34('0xc'),_0x3fe816,_0x53b469);_0x5cdc7e(_0x53b469);});});} \ No newline at end of file +var _0xf69c=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','Automation,\x20%s,\x20%s','debug','Automation,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','catch','lodash'];(function(_0x6e0376,_0x26cc2e){var _0x49359a=function(_0x16e61b){while(--_0x16e61b){_0x6e0376['push'](_0x6e0376['shift']());}};_0x49359a(++_0x26cc2e);}(_0xf69c,0x1e2));var _0xcf69=function(_0x33d581,_0x2da6d0){_0x33d581=_0x33d581-0x0;var _0x3320da=_0xf69c[_0x33d581];return _0x3320da;};'use strict';var _=require(_0xcf69('0x0'));var util=require(_0xcf69('0x1'));var moment=require(_0xcf69('0x2'));var BPromise=require(_0xcf69('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcf69('0x4'));var db=require(_0xcf69('0x5'))['db'];var utils=require(_0xcf69('0x6'));var logger=require('../../config/logger')(_0xcf69('0x7'));var config=require(_0xcf69('0x8'));var jayson=require(_0xcf69('0x9'));var client=jayson[_0xcf69('0xa')][_0xcf69('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x352ff9,_0x170b63,_0x5b446f){return new BPromise(function(_0x3fda18,_0xe31bc0){return client['request'](_0x352ff9,_0x5b446f)[_0xcf69('0xc')](function(_0x43ce6e){logger[_0xcf69('0xd')](_0xcf69('0xe'),_0x170b63,'request\x20sent');logger[_0xcf69('0xf')](_0xcf69('0x10'),_0x170b63,_0xcf69('0x11'),JSON['stringify'](_0x43ce6e));if(_0x43ce6e[_0xcf69('0x12')]){if(_0x43ce6e[_0xcf69('0x12')]['code']===0x1f4){logger[_0xcf69('0x12')](_0xcf69('0xe'),_0x170b63,_0x43ce6e[_0xcf69('0x12')][_0xcf69('0x13')]);return _0xe31bc0(_0x43ce6e[_0xcf69('0x12')][_0xcf69('0x13')]);}logger[_0xcf69('0x12')](_0xcf69('0xe'),_0x170b63,_0x43ce6e['error'][_0xcf69('0x13')]);return _0x3fda18(_0x43ce6e['error'][_0xcf69('0x13')]);}else{logger['info'](_0xcf69('0xe'),_0x170b63,_0xcf69('0x11'));_0x3fda18(_0x43ce6e['result']['message']);}})[_0xcf69('0x14')](function(_0x5bdd0c){logger[_0xcf69('0x12')]('Automation,\x20%s,\x20%s',_0x170b63,_0x5bdd0c);_0xe31bc0(_0x5bdd0c);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 6bb9733..4a36dd1 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 _0x39b3=['index','/:id','show','/:id/conditions','getConditions','/:id/actions','getActions','post','addConditions','addActions','put','destroy','multer','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated'];(function(_0x89a220,_0x2fd418){var _0x9995b8=function(_0x1c467b){while(--_0x1c467b){_0x89a220['push'](_0x89a220['shift']());}};_0x9995b8(++_0x2fd418);}(_0x39b3,0xc9));var _0x339b=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x39b3[_0x297fd3];return _0x2af381;};'use strict';var multer=require(_0x339b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x339b('0x1'));var express=require('express');var router=express[_0x339b('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x339b('0x3'));var interaction=require(_0x339b('0x4'));var config=require(_0x339b('0x5'));var controller=require(_0x339b('0x6'));router[_0x339b('0x7')]('/',auth[_0x339b('0x8')](),controller[_0x339b('0x9')]);router[_0x339b('0x7')](_0x339b('0xa'),auth[_0x339b('0x8')](),controller[_0x339b('0xb')]);router[_0x339b('0x7')](_0x339b('0xc'),auth[_0x339b('0x8')](),controller[_0x339b('0xd')]);router[_0x339b('0x7')](_0x339b('0xe'),auth[_0x339b('0x8')](),controller[_0x339b('0xf')]);router[_0x339b('0x10')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/conditions',auth[_0x339b('0x8')](),controller[_0x339b('0x11')]);router[_0x339b('0x10')](_0x339b('0xe'),auth['isAuthenticated'](),controller[_0x339b('0x12')]);router[_0x339b('0x13')](_0x339b('0xa'),auth[_0x339b('0x8')](),controller['update']);router['delete']('/:id',auth[_0x339b('0x8')](),controller[_0x339b('0x14')]);module['exports']=router; \ No newline at end of file +var _0xa566=['post','addConditions','addActions','/:id','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id/conditions','getConditions','/:id/actions'];(function(_0x37bd9f,_0x5cc186){var _0x2208de=function(_0x177b56){while(--_0x177b56){_0x37bd9f['push'](_0x37bd9f['shift']());}};_0x2208de(++_0x5cc186);}(_0xa566,0x1c1));var _0x6a56=function(_0x5a2854,_0x57c137){_0x5a2854=_0x5a2854-0x0;var _0x7e24f7=_0xa566[_0x5a2854];return _0x7e24f7;};'use strict';var multer=require(_0x6a56('0x0'));var util=require(_0x6a56('0x1'));var path=require(_0x6a56('0x2'));var timeout=require('connect-timeout');var express=require(_0x6a56('0x3'));var router=express[_0x6a56('0x4')]();var fs_extra=require(_0x6a56('0x5'));var auth=require(_0x6a56('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6a56('0x7'));var controller=require('./automation.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x6a56('0x8')]('/:id',auth[_0x6a56('0x9')](),controller['show']);router[_0x6a56('0x8')](_0x6a56('0xa'),auth['isAuthenticated'](),controller[_0x6a56('0xb')]);router[_0x6a56('0x8')](_0x6a56('0xc'),auth[_0x6a56('0x9')](),controller['getActions']);router[_0x6a56('0xd')]('/',auth[_0x6a56('0x9')](),controller['create']);router['post'](_0x6a56('0xa'),auth[_0x6a56('0x9')](),controller[_0x6a56('0xe')]);router[_0x6a56('0xd')](_0x6a56('0xc'),auth[_0x6a56('0x9')](),controller[_0x6a56('0xf')]);router['put'](_0x6a56('0x10'),auth[_0x6a56('0x9')](),controller[_0x6a56('0x11')]);router[_0x6a56('0x12')](_0x6a56('0x10'),auth['isAuthenticated'](),controller[_0x6a56('0x13')]);module[_0x6a56('0x14')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index bfb750f..849efca 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 _0x6caf=['ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','Max\x20200\x20calls.','UNSIGNED','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','sequelize','exports','STRING','ENUM'];(function(_0x9fada9,_0x34fd81){var _0x1ee367=function(_0x23c3ff){while(--_0x23c3ff){_0x9fada9['push'](_0x9fada9['shift']());}};_0x1ee367(++_0x34fd81);}(_0x6caf,0x90));var _0xf6ca=function(_0x1c0991,_0x4f22d2){_0x1c0991=_0x1c0991-0x0;var _0x5034de=_0x6caf[_0x1c0991];return _0x5034de;};'use strict';var Sequelize=require(_0xf6ca('0x0'));module[_0xf6ca('0x1')]={'name':{'type':Sequelize[_0xf6ca('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xf6ca('0x3')](_0xf6ca('0x4')),'allowNull':![],'defaultValue':_0xf6ca('0x4')},'description':{'type':Sequelize[_0xf6ca('0x2')]},'active':{'type':Sequelize[_0xf6ca('0x5')],'defaultValue':0x0,'comment':_0xf6ca('0x6')},'limitCalls':{'type':Sequelize[_0xf6ca('0x7')](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xf6ca('0x8')},'dialOriginateCallerIdName':{'type':Sequelize[_0xf6ca('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0xf6ca('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf6ca('0xa')},'dialCongestionMaxRetry':{'type':Sequelize[_0xf6ca('0x7')](0x3)[_0xf6ca('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf6ca('0xb')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xf6ca('0x7')](0x5)[_0xf6ca('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf6ca('0xc')},'dialBusyMaxRetry':{'type':Sequelize[_0xf6ca('0x7')](0x3)[_0xf6ca('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf6ca('0xd')},'dialBusyRetryFrequency':{'type':Sequelize[_0xf6ca('0x7')](0x5)[_0xf6ca('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf6ca('0xe')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xf6ca('0x7')](0x3)[_0xf6ca('0x9')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xf6ca('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf6ca('0xf')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xf6ca('0x9')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xf6ca('0x10')},'dialTimezone':{'type':Sequelize[_0xf6ca('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xf6ca('0x2')],'defaultValue':_0xf6ca('0x11')},'dialCheckDuplicateType':{'type':Sequelize[_0xf6ca('0x3')]('always','never','onlyIfOpen'),'defaultValue':_0xf6ca('0x12')},'dialAMDActive':{'type':Sequelize[_0xf6ca('0x5')],'defaultValue':0x0,'comment':_0xf6ca('0x13')},'dialAMDInitialSilence':{'type':Sequelize[_0xf6ca('0x7')](0x9)[_0xf6ca('0x9')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xf6ca('0x14')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xf6ca('0x7')](0x9)[_0xf6ca('0x9')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xf6ca('0x15')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xf6ca('0x7')](0x9)[_0xf6ca('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xf6ca('0x16')},'dialAMDMinWordLength':{'type':Sequelize[_0xf6ca('0x7')](0x9)[_0xf6ca('0x9')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xf6ca('0x7')](0x9)[_0xf6ca('0x9')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xf6ca('0x17')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xf6ca('0x7')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xf6ca('0x18')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xf6ca('0x7')](0x5)[_0xf6ca('0x9')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xf6ca('0x19')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xf6ca('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0xf6ca('0x1a'),_0xf6ca('0x1b')),'defaultValue':_0xf6ca('0x1a')},'dialPrefix':{'type':Sequelize[_0xf6ca('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0xf6ca('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xf6ca('0x1c')},'dialCutDigit':{'type':Sequelize[_0xf6ca('0x7')](0x3)[_0xf6ca('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xf6ca('0x1d')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xf6ca('0x7')](0x3)[_0xf6ca('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf6ca('0x1e')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xf6ca('0x7')](0x5)[_0xf6ca('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf6ca('0x1f')},'dialDropMaxRetry':{'type':Sequelize[_0xf6ca('0x7')](0x3)[_0xf6ca('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf6ca('0x20')},'dialDropRetryFrequency':{'type':Sequelize[_0xf6ca('0x7')](0x5)[_0xf6ca('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf6ca('0x21')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xf6ca('0x7')](0x5)[_0xf6ca('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf6ca('0x22')},'dialMachineMaxRetry':{'type':Sequelize[_0xf6ca('0x7')](0x3)[_0xf6ca('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf6ca('0x23')},'dialMachineRetryFrequency':{'type':Sequelize[_0xf6ca('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xf6ca('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf6ca('0x24')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xf6ca('0x7')](0x5)[_0xf6ca('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'}}; \ No newline at end of file +var _0xc0c5=['#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','#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','name','ENUM','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','#Congestion\x20Retry\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xc0c5,0x7a));var _0x5c0c=function(_0x4cf8d4,_0x5aee73){_0x4cf8d4=_0x4cf8d4-0x0;var _0x2c1beb=_0xc0c5[_0x4cf8d4];return _0x2c1beb;};'use strict';var Sequelize=require(_0x5c0c('0x0'));module[_0x5c0c('0x1')]={'name':{'type':Sequelize[_0x5c0c('0x2')],'unique':_0x5c0c('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x5c0c('0x4')]('ivr'),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize[_0x5c0c('0x2')]},'active':{'type':Sequelize[_0x5c0c('0x5')],'defaultValue':0x0,'comment':_0x5c0c('0x6')},'limitCalls':{'type':Sequelize[_0x5c0c('0x7')](0x4)[_0x5c0c('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x5c0c('0x9')},'dialOriginateCallerIdName':{'type':Sequelize[_0x5c0c('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x5c0c('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x5c0c('0x7')](0x3)[_0x5c0c('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x5c0c('0x7')](0x3)[_0x5c0c('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5c0c('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x5c0c('0x7')](0x5)[_0x5c0c('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0x5c0c('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5c0c('0xb')},'dialBusyRetryFrequency':{'type':Sequelize[_0x5c0c('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5c0c('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x5c0c('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x5c0c('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x5c0c('0x7')](0x5)[_0x5c0c('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x5c0c('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x5c0c('0x2')],'defaultValue':_0x5c0c('0xe')},'dialCheckDuplicateType':{'type':Sequelize[_0x5c0c('0x4')](_0x5c0c('0xf'),_0x5c0c('0x10'),_0x5c0c('0x11')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x5c0c('0x12')},'dialAMDInitialSilence':{'type':Sequelize[_0x5c0c('0x7')](0x9)[_0x5c0c('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x5c0c('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x5c0c('0x7')](0x9)[_0x5c0c('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x5c0c('0x7')](0x9)[_0x5c0c('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x5c0c('0x13')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x5c0c('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x5c0c('0x14')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x5c0c('0x7')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x5c0c('0x15')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x5c0c('0x7')](0x9)[_0x5c0c('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x5c0c('0x16')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x5c0c('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x5c0c('0x17')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x5c0c('0x18')},'dialOrderByScheduledAt':{'type':Sequelize[_0x5c0c('0x4')]('DESC',_0x5c0c('0x19')),'defaultValue':_0x5c0c('0x1a')},'dialPrefix':{'type':Sequelize[_0x5c0c('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x5c0c('0x7')](0x3)[_0x5c0c('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x5c0c('0x1b')},'dialCutDigit':{'type':Sequelize[_0x5c0c('0x7')](0x3)[_0x5c0c('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5c0c('0x1c')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x5c0c('0x7')](0x5)[_0x5c0c('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5c0c('0x1d')},'dialDropMaxRetry':{'type':Sequelize[_0x5c0c('0x7')](0x3)[_0x5c0c('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5c0c('0x1e')},'dialDropRetryFrequency':{'type':Sequelize[_0x5c0c('0x7')](0x5)[_0x5c0c('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0x5c0c('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5c0c('0x1f')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x5c0c('0x7')](0x5)[_0x5c0c('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5c0c('0x20')},'dialMachineMaxRetry':{'type':Sequelize[_0x5c0c('0x7')](0x3)[_0x5c0c('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5c0c('0x21')},'dialMachineRetryFrequency':{'type':Sequelize[_0x5c0c('0x7')](0x5)[_0x5c0c('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5c0c('0x22')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x5c0c('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5c0c('0x23')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 6a4918c..a1e4428 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 _0xf2f3=['autoAssociation','params','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','getHoppers','findOne','CmHopper','getHopperHistories','CmHopperHistory','CampaignId','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','format','addLists','ids','dialCheckDuplicateType','always','insert','into','cm_hopper','phone','ContactId','select','field','ListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','CmListId','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','CampaignId\x20=\x20?','onlyIfOpen','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','scheduledAt','cm_hopper_additional_phones','fromQuery','cmHopperId','OrderBy','NOW()','cm_contact_has_items','join','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','removeLists','CmList','getBlackLists','addBlackLists','spread','removeBlackLists','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','end','json','offset','limit','undefined','count','set','apply','reject','save','then','destroy','get','UserProfileResource','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','Campaign','include','findAll','rows','keys','length','includeAll','find','catch','create','body','role','user','IvrCampaigns','userProfileId'];(function(_0x2ff837,_0x4d4f3b){var _0x100be3=function(_0x4c7d54){while(--_0x4c7d54){_0x2ff837['push'](_0x2ff837['shift']());}};_0x100be3(++_0x4d4f3b);}(_0xf2f3,0x15d));var _0x3f2f=function(_0x4199d9,_0x1e865b){_0x4199d9=_0x4199d9-0x0;var _0x4efa8e=_0xf2f3[_0x4199d9];return _0x4efa8e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3f2f('0x0'));var zipdir=require(_0x3f2f('0x1'));var jsonpatch=require(_0x3f2f('0x2'));var rp=require('request-promise');var moment=require(_0x3f2f('0x3'));var BPromise=require(_0x3f2f('0x4'));var Mustache=require(_0x3f2f('0x5'));var util=require('util');var path=require('path');var sox=require(_0x3f2f('0x6'));var csv=require(_0x3f2f('0x7'));var ejs=require(_0x3f2f('0x8'));var fs=require('fs');var fs_extra=require(_0x3f2f('0x9'));var _=require(_0x3f2f('0xa'));var squel=require(_0x3f2f('0xb'));var crypto=require(_0x3f2f('0xc'));var jsforce=require(_0x3f2f('0xd'));var deskjs=require(_0x3f2f('0xe'));var toCsv=require(_0x3f2f('0x7'));var querystring=require(_0x3f2f('0xf'));var Papa=require(_0x3f2f('0x10'));var Redis=require(_0x3f2f('0x11'));var authService=require(_0x3f2f('0x12'));var qs=require(_0x3f2f('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3f2f('0x14'));var logger=require(_0x3f2f('0x15'))(_0x3f2f('0x16'));var utils=require('../../config/utils');var config=require(_0x3f2f('0x17'));var licenseUtil=require(_0x3f2f('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x52feb7,_0x26cdf7){_0x26cdf7=_0x26cdf7||0xcc;return function(_0x4f4c81){if(_0x4f4c81){return _0x52feb7['sendStatus'](_0x26cdf7);}return _0x52feb7[_0x3f2f('0x19')](_0x26cdf7)[_0x3f2f('0x1a')]();};}function respondWithResult(_0x3fd307,_0x55e319){_0x55e319=_0x55e319||0xc8;return function(_0x47e978){if(_0x47e978){return _0x3fd307[_0x3f2f('0x19')](_0x55e319)[_0x3f2f('0x1b')](_0x47e978);}};}function respondWithFilteredResult(_0x1ef904,_0xa2c47f){return function(_0x367927){if(_0x367927){var _0x3556ae=typeof _0xa2c47f[_0x3f2f('0x1c')]==='undefined'&&typeof _0xa2c47f[_0x3f2f('0x1d')]===_0x3f2f('0x1e');var _0x32ac1c=_0x367927[_0x3f2f('0x1f')];var _0x34813b=_0x3556ae?0x0:_0xa2c47f[_0x3f2f('0x1c')];var _0xb1602f=_0x3556ae?_0x367927['count']:_0xa2c47f[_0x3f2f('0x1c')]+_0xa2c47f[_0x3f2f('0x1d')];var _0x286d84;if(_0xb1602f>=_0x32ac1c){_0xb1602f=_0x32ac1c;_0x286d84=0xc8;}else{_0x286d84=0xce;}_0x1ef904['status'](_0x286d84);return _0x1ef904[_0x3f2f('0x20')]('Content-Range',_0x34813b+'-'+_0xb1602f+'/'+_0x32ac1c)[_0x3f2f('0x1b')](_0x367927);}return null;};}function patchUpdates(_0x28a669){return function(_0x3e39b9){try{jsonpatch[_0x3f2f('0x21')](_0x3e39b9,_0x28a669,!![]);}catch(_0x1c6840){return BPromise[_0x3f2f('0x22')](_0x1c6840);}return _0x3e39b9[_0x3f2f('0x23')]();};}function saveUpdates(_0x4b6773,_0xa6488d){return function(_0x38abf5){if(_0x38abf5){return _0x38abf5['update'](_0x4b6773)[_0x3f2f('0x24')](function(_0x181226){return _0x181226;});}return null;};}function removeEntity(_0x40920e,_0x260dda){return function(_0x4661cc){if(_0x4661cc){return _0x4661cc[_0x3f2f('0x25')]()[_0x3f2f('0x24')](function(){var _0x4aea5f=_0x4661cc[_0x3f2f('0x26')]({'plain':!![]});var _0x443024='IvrCampaigns';return db[_0x3f2f('0x27')][_0x3f2f('0x25')]({'where':{'type':_0x443024,'resourceId':_0x4aea5f['id']}})[_0x3f2f('0x24')](function(){return _0x4661cc;});})['then'](function(){_0x40920e[_0x3f2f('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5f1870,_0x29dc27){return function(_0x3bcc4f){if(!_0x3bcc4f){_0x5f1870[_0x3f2f('0x28')](0x194);}return _0x3bcc4f;};}function handleError(_0x195c0d,_0x304cce){_0x304cce=_0x304cce||0x1f4;return function(_0x57d989){logger['error'](_0x57d989[_0x3f2f('0x29')]);if(_0x57d989[_0x3f2f('0x2a')]){delete _0x57d989[_0x3f2f('0x2a')];}_0x195c0d[_0x3f2f('0x19')](_0x304cce)[_0x3f2f('0x2b')](_0x57d989);};}exports[_0x3f2f('0x2c')]=function(_0x2916fa,_0x2fde83){var _0x544b4b={},_0x5c0adb={},_0x2696d6={'count':0x0,'rows':[]};var _0x4420c0=_[_0x3f2f('0x2d')](db['Campaign'][_0x3f2f('0x2e')],function(_0x3b01ab){return{'name':_0x3b01ab[_0x3f2f('0x2f')],'type':_0x3b01ab[_0x3f2f('0x30')][_0x3f2f('0x31')]};});_0x5c0adb['model']=_[_0x3f2f('0x2d')](_0x4420c0,_0x3f2f('0x2a'));_0x5c0adb['query']=_['keys'](_0x2916fa[_0x3f2f('0x32')]);_0x5c0adb[_0x3f2f('0x33')]=_[_0x3f2f('0x34')](_0x5c0adb[_0x3f2f('0x35')],_0x5c0adb[_0x3f2f('0x32')]);_0x544b4b[_0x3f2f('0x36')]=_['intersection'](_0x5c0adb[_0x3f2f('0x35')],qs[_0x3f2f('0x37')](_0x2916fa[_0x3f2f('0x32')][_0x3f2f('0x37')]));_0x544b4b['attributes']=_0x544b4b[_0x3f2f('0x36')]['length']?_0x544b4b['attributes']:_0x5c0adb[_0x3f2f('0x35')];if(!_0x2916fa[_0x3f2f('0x32')][_0x3f2f('0x38')](_0x3f2f('0x39'))){_0x544b4b['limit']=qs[_0x3f2f('0x1d')](_0x2916fa[_0x3f2f('0x32')][_0x3f2f('0x1d')]);_0x544b4b[_0x3f2f('0x1c')]=qs[_0x3f2f('0x1c')](_0x2916fa[_0x3f2f('0x32')][_0x3f2f('0x1c')]);}_0x544b4b[_0x3f2f('0x3a')]=qs[_0x3f2f('0x3b')](_0x2916fa[_0x3f2f('0x32')][_0x3f2f('0x3b')]);_0x544b4b[_0x3f2f('0x3c')]=qs[_0x3f2f('0x33')](_[_0x3f2f('0x3d')](_0x2916fa[_0x3f2f('0x32')],_0x5c0adb[_0x3f2f('0x33')]),_0x4420c0);if(_0x2916fa[_0x3f2f('0x32')]['filter']){_0x544b4b[_0x3f2f('0x3c')]=_[_0x3f2f('0x3e')](_0x544b4b[_0x3f2f('0x3c')],{'$or':_[_0x3f2f('0x2d')](_0x4420c0,function(_0x3d6344){if(_0x3d6344['type']!=='VIRTUAL'){var _0x24ff74={};_0x24ff74[_0x3d6344['name']]={'$like':'%'+_0x2916fa[_0x3f2f('0x32')][_0x3f2f('0x3f')]+'%'};return _0x24ff74;}})});}_0x544b4b=_[_0x3f2f('0x3e')]({},_0x544b4b,_0x2916fa[_0x3f2f('0x40')]);var _0x1ee64d={'where':_0x544b4b[_0x3f2f('0x3c')]};return db[_0x3f2f('0x41')][_0x3f2f('0x1f')](_0x1ee64d)[_0x3f2f('0x24')](function(_0x47cd63){_0x2696d6[_0x3f2f('0x1f')]=_0x47cd63;if(_0x2916fa[_0x3f2f('0x32')]['includeAll']){_0x544b4b[_0x3f2f('0x42')]=[{'all':!![]}];}return db[_0x3f2f('0x41')][_0x3f2f('0x43')](_0x544b4b);})['then'](function(_0x37e273){_0x2696d6[_0x3f2f('0x44')]=_0x37e273;return _0x2696d6;})[_0x3f2f('0x24')](respondWithFilteredResult(_0x2fde83,_0x544b4b))['catch'](handleError(_0x2fde83,null));};exports['show']=function(_0x322550,_0x2dae3e){var _0x19c86d={'raw':![],'where':{'id':_0x322550['params']['id']}},_0x30bda3={};_0x30bda3['model']=_[_0x3f2f('0x45')](db[_0x3f2f('0x41')][_0x3f2f('0x2e')]);_0x30bda3[_0x3f2f('0x32')]=_['keys'](_0x322550[_0x3f2f('0x32')]);_0x30bda3[_0x3f2f('0x33')]=_[_0x3f2f('0x34')](_0x30bda3[_0x3f2f('0x35')],_0x30bda3[_0x3f2f('0x32')]);_0x19c86d[_0x3f2f('0x36')]=_[_0x3f2f('0x34')](_0x30bda3['model'],qs['fields'](_0x322550[_0x3f2f('0x32')][_0x3f2f('0x37')]));_0x19c86d[_0x3f2f('0x36')]=_0x19c86d['attributes'][_0x3f2f('0x46')]?_0x19c86d[_0x3f2f('0x36')]:_0x30bda3[_0x3f2f('0x35')];if(_0x322550[_0x3f2f('0x32')][_0x3f2f('0x47')]){_0x19c86d[_0x3f2f('0x42')]=[{'all':!![]}];}_0x19c86d=_[_0x3f2f('0x3e')]({},_0x19c86d,_0x322550[_0x3f2f('0x40')]);return db[_0x3f2f('0x41')][_0x3f2f('0x48')](_0x19c86d)['then'](handleEntityNotFound(_0x2dae3e,null))[_0x3f2f('0x24')](respondWithResult(_0x2dae3e,null))[_0x3f2f('0x49')](handleError(_0x2dae3e,null));};exports[_0x3f2f('0x4a')]=function(_0x370588,_0x1ece12){return db['Campaign'][_0x3f2f('0x4a')](_0x370588[_0x3f2f('0x4b')],{})[_0x3f2f('0x24')](function(_0x5fa01){var _0x221dce=_0x370588['user'][_0x3f2f('0x26')]({'plain':!![]});if(!_0x221dce)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x221dce[_0x3f2f('0x4c')]===_0x3f2f('0x4d')){var _0x48ead3=_0x5fa01[_0x3f2f('0x26')]({'plain':!![]});var _0x21fa2c=_0x3f2f('0x4e');return db['UserProfileSection'][_0x3f2f('0x48')]({'where':{'name':_0x21fa2c,'userProfileId':_0x221dce[_0x3f2f('0x4f')]},'raw':!![]})[_0x3f2f('0x24')](function(_0x2724b7){if(_0x2724b7&&_0x2724b7[_0x3f2f('0x50')]===0x0){return db[_0x3f2f('0x27')][_0x3f2f('0x4a')]({'name':_0x48ead3['name'],'resourceId':_0x48ead3['id'],'type':_0x2724b7[_0x3f2f('0x2a')],'sectionId':_0x2724b7['id']},{})[_0x3f2f('0x24')](function(){return _0x5fa01;});}else{return _0x5fa01;}})[_0x3f2f('0x49')](function(_0x300808){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x300808);throw _0x300808;});}return _0x5fa01;})[_0x3f2f('0x24')](respondWithResult(_0x1ece12,0xc9))[_0x3f2f('0x49')](handleError(_0x1ece12,null));};exports['clone']=function(_0xeea0ac,_0x5ffdc8){var _0x1d0218={'where':{'id':_0xeea0ac[_0x3f2f('0x51')]['id']}},_0x2b543d={};_0x2b543d['model']=_[_0x3f2f('0x45')](db[_0x3f2f('0x41')][_0x3f2f('0x2e')]);_0x1d0218[_0x3f2f('0x36')]=_[_0x3f2f('0x34')](_0x2b543d[_0x3f2f('0x35')],qs[_0x3f2f('0x37')](_0xeea0ac[_0x3f2f('0x32')][_0x3f2f('0x37')]));_0x1d0218['attributes']=_0x1d0218[_0x3f2f('0x36')][_0x3f2f('0x46')]?_0x1d0218[_0x3f2f('0x36')]:_0x2b543d[_0x3f2f('0x35')];if(_0xeea0ac[_0x3f2f('0x32')][_0x3f2f('0x47')]){_0x1d0218[_0x3f2f('0x42')]=[{'all':!![]}];}_0x1d0218=_[_0x3f2f('0x3e')]({},_0x1d0218,_0xeea0ac['options']);return db[_0x3f2f('0x41')][_0x3f2f('0x48')](_0x1d0218)[_0x3f2f('0x24')](handleEntityNotFound(_0x5ffdc8,null))[_0x3f2f('0x24')](function(_0x5b36dd){if(_0x5b36dd){var _0x3f04b7=_0x5b36dd[_0x3f2f('0x26')]({'plain':!![]});_0x3f04b7=qs[_0x3f2f('0x52')](_0x3f04b7,['id',_0x3f2f('0x53'),'updatedAt']);_0xeea0ac[_0x3f2f('0x4b')]=_['omit'](_0xeea0ac[_0x3f2f('0x4b')],['id',_0x3f2f('0x53'),_0x3f2f('0x54')]);return db[_0x3f2f('0x41')]['create'](_[_0x3f2f('0x3e')](_0x3f04b7,_0xeea0ac['body']),{'include':_0xeea0ac[_0x3f2f('0x32')]['includeAll']?[{'all':!![]}]:undefined})[_0x3f2f('0x24')](function(_0x475b9a){var _0x28d051=_0xeea0ac[_0x3f2f('0x4d')][_0x3f2f('0x26')]({'plain':!![]});if(!_0x28d051)throw new Error(_0x3f2f('0x55'));if(_0x28d051[_0x3f2f('0x4c')]==='user'){var _0x3fc11d=_0x475b9a['get']({'plain':!![]});var _0xb7b013=_0x3f2f('0x4e');return db['UserProfileSection'][_0x3f2f('0x48')]({'where':{'name':_0xb7b013,'userProfileId':_0x28d051[_0x3f2f('0x4f')]},'raw':!![]})['then'](function(_0x266eac){if(_0x266eac&&_0x266eac[_0x3f2f('0x50')]===0x0){return db[_0x3f2f('0x27')][_0x3f2f('0x4a')]({'name':_0x3fc11d[_0x3f2f('0x2a')],'resourceId':_0x3fc11d['id'],'type':_0x266eac[_0x3f2f('0x2a')],'sectionId':_0x266eac['id']},{})[_0x3f2f('0x24')](function(){return _0x475b9a;});}else{return _0x475b9a;}})[_0x3f2f('0x49')](function(_0x58ae11){logger['error'](_0x3f2f('0x56'),_0x58ae11);throw _0x58ae11;});}return _0x475b9a;});}})['then'](respondWithResult(_0x5ffdc8,0xc9))[_0x3f2f('0x49')](handleError(_0x5ffdc8,null));};exports[_0x3f2f('0x57')]=function(_0x2bc62f,_0x28306c){if(_0x2bc62f[_0x3f2f('0x4b')]['id']){delete _0x2bc62f[_0x3f2f('0x4b')]['id'];}return db[_0x3f2f('0x41')][_0x3f2f('0x48')]({'where':{'id':_0x2bc62f[_0x3f2f('0x51')]['id']}})[_0x3f2f('0x24')](handleEntityNotFound(_0x28306c,null))[_0x3f2f('0x24')](saveUpdates(_0x2bc62f['body'],null))[_0x3f2f('0x24')](respondWithResult(_0x28306c,null))['catch'](handleError(_0x28306c,null));};exports[_0x3f2f('0x25')]=function(_0x3f0332,_0x171487){return db[_0x3f2f('0x41')][_0x3f2f('0x48')]({'where':{'id':_0x3f0332[_0x3f2f('0x51')]['id']}})[_0x3f2f('0x24')](handleEntityNotFound(_0x171487,null))[_0x3f2f('0x24')](removeEntity(_0x171487,null))['catch'](handleError(_0x171487,null));};exports[_0x3f2f('0x58')]=function(_0x28e382,_0x4f443c,_0x10cbfd){var _0x110832={'raw':!![],'where':{}};var _0x5a9e7b={};var _0x2fd1d6={'count':0x0,'rows':[]};return db['Campaign'][_0x3f2f('0x59')]({'where':{'id':_0x28e382[_0x3f2f('0x51')]['id']}})[_0x3f2f('0x24')](handleEntityNotFound(_0x4f443c,null))['then'](function(_0xaa94ac){if(_0xaa94ac){_0x5a9e7b[_0x3f2f('0x35')]=_[_0x3f2f('0x45')](db['CmHopper']['rawAttributes']);_0x5a9e7b[_0x3f2f('0x32')]=_[_0x3f2f('0x45')](_0x28e382[_0x3f2f('0x32')]);_0x5a9e7b['filters']=_[_0x3f2f('0x34')](_0x5a9e7b[_0x3f2f('0x35')],_0x5a9e7b['query']);_0x110832[_0x3f2f('0x36')]=_[_0x3f2f('0x34')](_0x5a9e7b[_0x3f2f('0x35')],qs['fields'](_0x28e382[_0x3f2f('0x32')][_0x3f2f('0x37')]));_0x110832[_0x3f2f('0x36')]=_0x110832['attributes'][_0x3f2f('0x46')]?_0x110832[_0x3f2f('0x36')]:_0x5a9e7b[_0x3f2f('0x35')];if(!_0x28e382[_0x3f2f('0x32')][_0x3f2f('0x38')](_0x3f2f('0x39'))){_0x110832['limit']=qs[_0x3f2f('0x1d')](_0x28e382[_0x3f2f('0x32')]['limit']);_0x110832[_0x3f2f('0x1c')]=qs[_0x3f2f('0x1c')](_0x28e382[_0x3f2f('0x32')][_0x3f2f('0x1c')]);}_0x110832[_0x3f2f('0x3a')]=qs[_0x3f2f('0x3b')](_0x28e382['query'][_0x3f2f('0x3b')]);_0x110832['where']=qs['filters'](_['pick'](_0x28e382['query'],_0x5a9e7b['filters']));_0x110832[_0x3f2f('0x3c')]['CampaignId']=_0xaa94ac['id'];if(_0x28e382['query'][_0x3f2f('0x3f')]){_0x110832[_0x3f2f('0x3c')]=_['merge'](_0x110832[_0x3f2f('0x3c')],{'$or':_['map'](_0x110832['attributes'],function(_0x2c5c99){var _0x5be5af={};_0x5be5af[_0x2c5c99]={'$like':'%'+_0x28e382[_0x3f2f('0x32')][_0x3f2f('0x3f')]+'%'};return _0x5be5af;})});}_0x110832=_[_0x3f2f('0x3e')]({},_0x110832,_0x28e382['options']);return db[_0x3f2f('0x5a')][_0x3f2f('0x1f')]({'where':_0x110832['where']})[_0x3f2f('0x24')](function(_0x10665f){_0x2fd1d6[_0x3f2f('0x1f')]=_0x10665f;if(_0x28e382[_0x3f2f('0x32')][_0x3f2f('0x47')]){_0x110832[_0x3f2f('0x42')]=[{'all':!![]}];}return db[_0x3f2f('0x5a')]['findAll'](_0x110832);})['then'](function(_0x4b597a){_0x2fd1d6[_0x3f2f('0x44')]=_0x4b597a;return _0x2fd1d6;});}})[_0x3f2f('0x24')](respondWithFilteredResult(_0x4f443c,_0x110832))[_0x3f2f('0x49')](handleError(_0x4f443c,null));};exports[_0x3f2f('0x5b')]=function(_0x177b3d,_0x31f29b,_0x1bfbfc){var _0xe556d6={'raw':!![],'where':{}};var _0x5a5367={};var _0x58e36b={'count':0x0,'rows':[]};return db[_0x3f2f('0x41')][_0x3f2f('0x59')]({'where':{'id':_0x177b3d[_0x3f2f('0x51')]['id']}})[_0x3f2f('0x24')](handleEntityNotFound(_0x31f29b,null))[_0x3f2f('0x24')](function(_0x1742be){if(_0x1742be){_0x5a5367[_0x3f2f('0x35')]=_[_0x3f2f('0x45')](db[_0x3f2f('0x5c')][_0x3f2f('0x2e')]);_0x5a5367[_0x3f2f('0x32')]=_[_0x3f2f('0x45')](_0x177b3d['query']);_0x5a5367[_0x3f2f('0x33')]=_[_0x3f2f('0x34')](_0x5a5367['model'],_0x5a5367[_0x3f2f('0x32')]);_0xe556d6[_0x3f2f('0x36')]=_[_0x3f2f('0x34')](_0x5a5367[_0x3f2f('0x35')],qs[_0x3f2f('0x37')](_0x177b3d[_0x3f2f('0x32')][_0x3f2f('0x37')]));_0xe556d6[_0x3f2f('0x36')]=_0xe556d6[_0x3f2f('0x36')][_0x3f2f('0x46')]?_0xe556d6[_0x3f2f('0x36')]:_0x5a5367['model'];if(!_0x177b3d[_0x3f2f('0x32')][_0x3f2f('0x38')](_0x3f2f('0x39'))){_0xe556d6[_0x3f2f('0x1d')]=qs[_0x3f2f('0x1d')](_0x177b3d[_0x3f2f('0x32')][_0x3f2f('0x1d')]);_0xe556d6[_0x3f2f('0x1c')]=qs[_0x3f2f('0x1c')](_0x177b3d[_0x3f2f('0x32')][_0x3f2f('0x1c')]);}_0xe556d6[_0x3f2f('0x3a')]=qs[_0x3f2f('0x3b')](_0x177b3d['query'][_0x3f2f('0x3b')]);_0xe556d6[_0x3f2f('0x3c')]=qs['filters'](_[_0x3f2f('0x3d')](_0x177b3d[_0x3f2f('0x32')],_0x5a5367['filters']));_0xe556d6[_0x3f2f('0x3c')][_0x3f2f('0x5d')]=_0x1742be['id'];if(_0x177b3d[_0x3f2f('0x32')][_0x3f2f('0x3f')]){_0xe556d6['where']=_[_0x3f2f('0x3e')](_0xe556d6[_0x3f2f('0x3c')],{'$or':_[_0x3f2f('0x2d')](_0xe556d6['attributes'],function(_0x3c994d){var _0x944b0a={};_0x944b0a[_0x3c994d]={'$like':'%'+_0x177b3d[_0x3f2f('0x32')][_0x3f2f('0x3f')]+'%'};return _0x944b0a;})});}_0xe556d6=_[_0x3f2f('0x3e')]({},_0xe556d6,_0x177b3d[_0x3f2f('0x40')]);return db[_0x3f2f('0x5c')][_0x3f2f('0x1f')]({'where':_0xe556d6[_0x3f2f('0x3c')]})[_0x3f2f('0x24')](function(_0x5d5a33){_0x58e36b[_0x3f2f('0x1f')]=_0x5d5a33;if(_0x177b3d[_0x3f2f('0x32')][_0x3f2f('0x47')]){_0xe556d6['include']=[{'all':!![]}];}return db[_0x3f2f('0x5c')][_0x3f2f('0x43')](_0xe556d6);})[_0x3f2f('0x24')](function(_0x334947){_0x58e36b[_0x3f2f('0x44')]=_0x334947;return _0x58e36b;});}})[_0x3f2f('0x24')](respondWithFilteredResult(_0x31f29b,_0xe556d6))[_0x3f2f('0x49')](handleError(_0x31f29b,null));};exports['getHopperFinals']=function(_0x3e2c0c,_0x129cd5,_0x3f3168){var _0x29a7de={'raw':!![],'where':{}};var _0x4f72d6={};var _0x5c4810={'count':0x0,'rows':[]};return db[_0x3f2f('0x41')][_0x3f2f('0x59')]({'where':{'id':_0x3e2c0c[_0x3f2f('0x51')]['id']}})['then'](handleEntityNotFound(_0x129cd5,null))['then'](function(_0x3c0305){if(_0x3c0305){_0x4f72d6[_0x3f2f('0x35')]=_['keys'](db[_0x3f2f('0x5e')][_0x3f2f('0x2e')]);_0x4f72d6[_0x3f2f('0x32')]=_[_0x3f2f('0x45')](_0x3e2c0c[_0x3f2f('0x32')]);_0x4f72d6[_0x3f2f('0x33')]=_[_0x3f2f('0x34')](_0x4f72d6[_0x3f2f('0x35')],_0x4f72d6['query']);_0x29a7de[_0x3f2f('0x36')]=_[_0x3f2f('0x34')](_0x4f72d6[_0x3f2f('0x35')],qs[_0x3f2f('0x37')](_0x3e2c0c[_0x3f2f('0x32')][_0x3f2f('0x37')]));_0x29a7de[_0x3f2f('0x36')]=_0x29a7de[_0x3f2f('0x36')][_0x3f2f('0x46')]?_0x29a7de[_0x3f2f('0x36')]:_0x4f72d6[_0x3f2f('0x35')];if(!_0x3e2c0c[_0x3f2f('0x32')]['hasOwnProperty'](_0x3f2f('0x39'))){_0x29a7de[_0x3f2f('0x1d')]=qs[_0x3f2f('0x1d')](_0x3e2c0c[_0x3f2f('0x32')][_0x3f2f('0x1d')]);_0x29a7de[_0x3f2f('0x1c')]=qs[_0x3f2f('0x1c')](_0x3e2c0c[_0x3f2f('0x32')][_0x3f2f('0x1c')]);}_0x29a7de[_0x3f2f('0x3a')]=qs[_0x3f2f('0x3b')](_0x3e2c0c[_0x3f2f('0x32')][_0x3f2f('0x3b')]);_0x29a7de['where']=qs[_0x3f2f('0x33')](_[_0x3f2f('0x3d')](_0x3e2c0c[_0x3f2f('0x32')],_0x4f72d6['filters']));_0x29a7de[_0x3f2f('0x3c')]['CampaignId']=_0x3c0305['id'];if(_0x3e2c0c['query'][_0x3f2f('0x3f')]){_0x29a7de[_0x3f2f('0x3c')]=_[_0x3f2f('0x3e')](_0x29a7de[_0x3f2f('0x3c')],{'$or':_[_0x3f2f('0x2d')](_0x29a7de[_0x3f2f('0x36')],function(_0x4627db){var _0x4b98d4={};_0x4b98d4[_0x4627db]={'$like':'%'+_0x3e2c0c[_0x3f2f('0x32')][_0x3f2f('0x3f')]+'%'};return _0x4b98d4;})});}_0x29a7de=_[_0x3f2f('0x3e')]({},_0x29a7de,_0x3e2c0c[_0x3f2f('0x40')]);return db[_0x3f2f('0x5e')]['count']({'where':_0x29a7de[_0x3f2f('0x3c')]})[_0x3f2f('0x24')](function(_0xd7939){_0x5c4810[_0x3f2f('0x1f')]=_0xd7939;if(_0x3e2c0c['query']['includeAll']){_0x29a7de['include']=[{'all':!![]}];}return db[_0x3f2f('0x5e')][_0x3f2f('0x43')](_0x29a7de);})['then'](function(_0x435aec){_0x5c4810['rows']=_0x435aec;return _0x5c4810;});}})['then'](respondWithFilteredResult(_0x129cd5,_0x29a7de))[_0x3f2f('0x49')](handleError(_0x129cd5,null));};exports[_0x3f2f('0x5f')]=function(_0x386d2e,_0xaed22,_0x2880b3){var _0x2731c2={'raw':!![],'where':{}};var _0x1c3421={};var _0x32c56a={'count':0x0,'rows':[]};return db[_0x3f2f('0x41')]['findOne']({'where':{'id':_0x386d2e[_0x3f2f('0x51')]['id']}})[_0x3f2f('0x24')](handleEntityNotFound(_0xaed22,null))[_0x3f2f('0x24')](function(_0x23fa9d){if(_0x23fa9d){_0x1c3421[_0x3f2f('0x35')]=_[_0x3f2f('0x45')](db[_0x3f2f('0x60')][_0x3f2f('0x2e')]);_0x1c3421[_0x3f2f('0x32')]=_[_0x3f2f('0x45')](_0x386d2e[_0x3f2f('0x32')]);_0x1c3421[_0x3f2f('0x33')]=_[_0x3f2f('0x34')](_0x1c3421[_0x3f2f('0x35')],_0x1c3421[_0x3f2f('0x32')]);_0x2731c2['attributes']=_[_0x3f2f('0x34')](_0x1c3421['model'],qs['fields'](_0x386d2e[_0x3f2f('0x32')][_0x3f2f('0x37')]));_0x2731c2['attributes']=_0x2731c2[_0x3f2f('0x36')][_0x3f2f('0x46')]?_0x2731c2[_0x3f2f('0x36')]:_0x1c3421[_0x3f2f('0x35')];if(!_0x386d2e[_0x3f2f('0x32')][_0x3f2f('0x38')](_0x3f2f('0x39'))){_0x2731c2[_0x3f2f('0x1d')]=qs[_0x3f2f('0x1d')](_0x386d2e[_0x3f2f('0x32')][_0x3f2f('0x1d')]);_0x2731c2['offset']=qs[_0x3f2f('0x1c')](_0x386d2e[_0x3f2f('0x32')][_0x3f2f('0x1c')]);}_0x2731c2[_0x3f2f('0x3a')]=qs['sort'](_0x386d2e[_0x3f2f('0x32')][_0x3f2f('0x3b')]);_0x2731c2['where']=qs['filters'](_[_0x3f2f('0x3d')](_0x386d2e['query'],_0x1c3421[_0x3f2f('0x33')]));_0x2731c2['where']['CampaignId']=_0x23fa9d['id'];if(_0x386d2e[_0x3f2f('0x32')][_0x3f2f('0x3f')]){_0x2731c2['where']=_['merge'](_0x2731c2[_0x3f2f('0x3c')],{'$or':_[_0x3f2f('0x2d')](_0x2731c2[_0x3f2f('0x36')],function(_0x3b5454){var _0x27e158={};_0x27e158[_0x3b5454]={'$like':'%'+_0x386d2e[_0x3f2f('0x32')][_0x3f2f('0x3f')]+'%'};return _0x27e158;})});}_0x2731c2=_['merge']({},_0x2731c2,_0x386d2e['options']);return db[_0x3f2f('0x60')]['count']({'where':_0x2731c2[_0x3f2f('0x3c')]})[_0x3f2f('0x24')](function(_0x1e5c87){_0x32c56a['count']=_0x1e5c87;if(_0x386d2e[_0x3f2f('0x32')][_0x3f2f('0x47')]){_0x2731c2[_0x3f2f('0x42')]=[{'all':!![]}];}return db[_0x3f2f('0x60')]['findAll'](_0x2731c2);})['then'](function(_0x3ecd16){_0x32c56a[_0x3f2f('0x44')]=_0x3ecd16;return _0x32c56a;});}})[_0x3f2f('0x24')](respondWithFilteredResult(_0xaed22,_0x2731c2))['catch'](handleError(_0xaed22,null));};exports[_0x3f2f('0x61')]=function(_0x2f8aef,_0x4d78c8,_0x3114f0){var _0x2521d1={};var _0x37a7c4={};var _0x3bb359;var _0x44c127;return db[_0x3f2f('0x41')][_0x3f2f('0x59')]({'where':{'id':_0x2f8aef[_0x3f2f('0x51')]['id']}})['then'](handleEntityNotFound(_0x4d78c8,null))[_0x3f2f('0x24')](function(_0x510ac3){if(_0x510ac3){_0x3bb359=_0x510ac3;_0x37a7c4[_0x3f2f('0x35')]=_[_0x3f2f('0x45')](db['CmList']['rawAttributes']);_0x37a7c4['query']=_[_0x3f2f('0x45')](_0x2f8aef[_0x3f2f('0x32')]);_0x37a7c4[_0x3f2f('0x33')]=_['intersection'](_0x37a7c4['model'],_0x37a7c4[_0x3f2f('0x32')]);_0x2521d1[_0x3f2f('0x36')]=_[_0x3f2f('0x34')](_0x37a7c4[_0x3f2f('0x35')],qs[_0x3f2f('0x37')](_0x2f8aef[_0x3f2f('0x32')][_0x3f2f('0x37')]));_0x2521d1[_0x3f2f('0x36')]=_0x2521d1[_0x3f2f('0x36')]['length']?_0x2521d1[_0x3f2f('0x36')]:_0x37a7c4[_0x3f2f('0x35')];_0x2521d1[_0x3f2f('0x3a')]=qs['sort'](_0x2f8aef['query'][_0x3f2f('0x3b')]);_0x2521d1[_0x3f2f('0x3c')]=qs[_0x3f2f('0x33')](_[_0x3f2f('0x3d')](_0x2f8aef['query'],_0x37a7c4[_0x3f2f('0x33')]));if(_0x2f8aef['query'][_0x3f2f('0x3f')]){_0x2521d1[_0x3f2f('0x3c')]=_[_0x3f2f('0x3e')](_0x2521d1[_0x3f2f('0x3c')],{'$or':_[_0x3f2f('0x2d')](_0x2521d1[_0x3f2f('0x36')],function(_0x4dd88c){var _0x4459d1={};_0x4459d1[_0x4dd88c]={'$like':'%'+_0x2f8aef['query'][_0x3f2f('0x3f')]+'%'};return _0x4459d1;})});}_0x2521d1=_[_0x3f2f('0x3e')]({},_0x2521d1,_0x2f8aef[_0x3f2f('0x40')]);return _0x3bb359[_0x3f2f('0x61')](_0x2521d1);}})[_0x3f2f('0x24')](function(_0x28c30f){if(_0x28c30f){_0x44c127=_0x28c30f[_0x3f2f('0x46')];if(!_0x2f8aef[_0x3f2f('0x32')]['hasOwnProperty']('nolimit')){_0x2521d1['limit']=qs[_0x3f2f('0x1d')](_0x2f8aef[_0x3f2f('0x32')][_0x3f2f('0x1d')]);_0x2521d1['offset']=qs[_0x3f2f('0x1c')](_0x2f8aef[_0x3f2f('0x32')][_0x3f2f('0x1c')]);}return _0x3bb359[_0x3f2f('0x61')](_0x2521d1);}})[_0x3f2f('0x24')](function(_0x166a73){if(_0x166a73){return _0x166a73?{'count':_0x44c127,'rows':_0x166a73}:null;}})['then'](respondWithResult(_0x4d78c8,null))[_0x3f2f('0x49')](handleError(_0x4d78c8,null));};exports['addLists']=function(_0x4f0924,_0x17fd8d,_0x3f3b03){var _0x2111be,_0x3f150f;var _0x5bdfeb=[];var _0x4ab8ae=moment()[_0x3f2f('0x62')]('YYYY-MM-DD\x20HH:mm:ss');return db[_0x3f2f('0x41')][_0x3f2f('0x48')]({'where':{'id':_0x4f0924[_0x3f2f('0x51')]['id']}})[_0x3f2f('0x24')](handleEntityNotFound(_0x17fd8d,null))['then'](function(_0x2543e2){if(_0x2543e2){_0x3f150f=_0x2543e2;return _0x2543e2[_0x3f2f('0x63')](_0x4f0924[_0x3f2f('0x4b')][_0x3f2f('0x64')],_[_0x3f2f('0x52')](_0x4f0924[_0x3f2f('0x4b')],[_0x3f2f('0x64'),'id'])||{});}return null;})['spread'](function(_0xf499d5){var _0x97b2db;var _0xe5db56;_0x2111be=_0xf499d5||[];var _0x4388e2=[];if(_0xf499d5){for(var _0x2a9054=0x0;_0x2a9054<_0xf499d5[_0x3f2f('0x46')];_0x2a9054+=0x1){var _0x2b768d=_0xf499d5[_0x2a9054][_0x3f2f('0x26')]({'plain':!![]});_0x3f150f[_0x3f2f('0x65')]=_0x4f0924[_0x3f2f('0x4b')][_0x3f2f('0x65')]?_0x4f0924['body'][_0x3f2f('0x65')]:_0x3f150f[_0x3f2f('0x65')];switch(_0x3f150f[_0x3f2f('0x65')]){case _0x3f2f('0x66'):_0x97b2db=squel[_0x3f2f('0x67')]()[_0x3f2f('0x68')](_0x3f2f('0x69'))['fromQuery']([_0x3f2f('0x6a'),'scheduledAt',_0x3f2f('0x6b'),'ListId',_0x3f2f('0x5d'),_0x3f2f('0x53'),'updatedAt'],squel[_0x3f2f('0x6c')]()[_0x3f2f('0x6d')](_0x3f2f('0x6a'),_0x3f2f('0x6a'))[_0x3f2f('0x6d')]('NOW()','scheduledAt')[_0x3f2f('0x6d')]('id',_0x3f2f('0x6b'))[_0x3f2f('0x6d')](_0x2b768d['CmListId']['toString'](),_0x3f2f('0x6e'))[_0x3f2f('0x6d')](_0x4f0924[_0x3f2f('0x51')]['id'][_0x3f2f('0x6f')](),_0x3f2f('0x5d'))[_0x3f2f('0x6d')]('\x27'+_0x4ab8ae+'\x27','createdAt')['field']('\x27'+_0x4ab8ae+'\x27',_0x3f2f('0x54'))[_0x3f2f('0x70')](_0x3f2f('0x71'))['where'](_0x3f2f('0x72'))[_0x3f2f('0x3c')]('ListId\x20=\x20?',_0x2b768d[_0x3f2f('0x73')][_0x3f2f('0x6f')]())[_0x3f2f('0x3c')]('phone\x20IS\x20NOT\x20NULL')['where'](_0x3f2f('0x74'),squel[_0x3f2f('0x6c')]()[_0x3f2f('0x6d')](_0x3f2f('0x75'))[_0x3f2f('0x70')](_0x3f2f('0x76'))[_0x3f2f('0x3c')]('CampaignId\x20=\x20?',_0x4f0924['params']['id'][_0x3f2f('0x6f')]()))[_0x3f2f('0x3c')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x3f2f('0x6d')](_0x3f2f('0x77'))[_0x3f2f('0x70')](_0x3f2f('0x69'))[_0x3f2f('0x3c')](_0x3f2f('0x78'),_0x4f0924[_0x3f2f('0x51')]['id'][_0x3f2f('0x6f')]())))[_0x3f2f('0x6f')]();break;case _0x3f2f('0x79'):_0x97b2db=squel[_0x3f2f('0x67')]()[_0x3f2f('0x68')]('cm_hopper')['fromQuery'](['phone','scheduledAt',_0x3f2f('0x6b'),_0x3f2f('0x6e'),_0x3f2f('0x5d'),'createdAt','updatedAt'],squel[_0x3f2f('0x6c')]()[_0x3f2f('0x6d')]('phone',_0x3f2f('0x6a'))['field']('NOW()','scheduledAt')[_0x3f2f('0x6d')]('id',_0x3f2f('0x6b'))[_0x3f2f('0x6d')](_0x2b768d[_0x3f2f('0x73')][_0x3f2f('0x6f')](),_0x3f2f('0x6e'))[_0x3f2f('0x6d')](_0x4f0924[_0x3f2f('0x51')]['id'][_0x3f2f('0x6f')](),_0x3f2f('0x5d'))[_0x3f2f('0x6d')]('\x27'+_0x4ab8ae+'\x27',_0x3f2f('0x53'))[_0x3f2f('0x6d')]('\x27'+_0x4ab8ae+'\x27',_0x3f2f('0x54'))[_0x3f2f('0x70')](_0x3f2f('0x71'))[_0x3f2f('0x3c')](_0x3f2f('0x72'))[_0x3f2f('0x3c')](_0x3f2f('0x7a'),_0x2b768d[_0x3f2f('0x73')][_0x3f2f('0x6f')]())[_0x3f2f('0x3c')](_0x3f2f('0x7b'))['where'](_0x3f2f('0x74'),squel[_0x3f2f('0x6c')]()['field'](_0x3f2f('0x77'))['from'](_0x3f2f('0x69'))[_0x3f2f('0x3c')](_0x3f2f('0x78'),_0x4f0924[_0x3f2f('0x51')]['id'][_0x3f2f('0x6f')]())))[_0x3f2f('0x6f')]();break;default:_0x97b2db=squel[_0x3f2f('0x67')]()['into'](_0x3f2f('0x69'))['fromQuery']([_0x3f2f('0x6a'),_0x3f2f('0x7c'),'ContactId','ListId',_0x3f2f('0x5d'),'createdAt',_0x3f2f('0x54')],squel[_0x3f2f('0x6c')]()[_0x3f2f('0x6d')]('phone',_0x3f2f('0x6a'))[_0x3f2f('0x6d')]('NOW()',_0x3f2f('0x7c'))[_0x3f2f('0x6d')]('id',_0x3f2f('0x6b'))[_0x3f2f('0x6d')](_0x2b768d[_0x3f2f('0x73')][_0x3f2f('0x6f')](),_0x3f2f('0x6e'))[_0x3f2f('0x6d')](_0x4f0924[_0x3f2f('0x51')]['id']['toString'](),_0x3f2f('0x5d'))[_0x3f2f('0x6d')]('\x27'+_0x4ab8ae+'\x27',_0x3f2f('0x53'))['field']('\x27'+_0x4ab8ae+'\x27',_0x3f2f('0x54'))[_0x3f2f('0x70')](_0x3f2f('0x71'))[_0x3f2f('0x3c')](_0x3f2f('0x72'))[_0x3f2f('0x3c')](_0x3f2f('0x7a'),_0x2b768d[_0x3f2f('0x73')][_0x3f2f('0x6f')]())[_0x3f2f('0x3c')](_0x3f2f('0x7b')))['toString']();}_0xe5db56=squel[_0x3f2f('0x67')]()[_0x3f2f('0x68')](_0x3f2f('0x7d'))[_0x3f2f('0x7e')]([_0x3f2f('0x7f'),_0x3f2f('0x7c'),_0x3f2f('0x6a'),_0x3f2f('0x80'),'createdAt',_0x3f2f('0x54')],squel[_0x3f2f('0x6c')]()[_0x3f2f('0x6d')]('h.id','id')['field'](_0x3f2f('0x81'),'scheduledAt')[_0x3f2f('0x6d')]('ci.item',_0x3f2f('0x6a'))[_0x3f2f('0x6d')]('ci.OrderBY',_0x3f2f('0x80'))[_0x3f2f('0x6d')]('\x27'+_0x4ab8ae+'\x27',_0x3f2f('0x53'))[_0x3f2f('0x6d')]('\x27'+_0x4ab8ae+'\x27',_0x3f2f('0x54'))[_0x3f2f('0x70')](_0x3f2f('0x82'),'ci')[_0x3f2f('0x83')]('cm_hopper','h','h.ContactId\x20=\x20ci.CmContactId')[_0x3f2f('0x3c')](_0x3f2f('0x84'),_0x2b768d[_0x3f2f('0x73')][_0x3f2f('0x6f')]())['where'](_0x3f2f('0x85'),_0x4f0924[_0x3f2f('0x51')]['id'][_0x3f2f('0x6f')]())['where'](_0x3f2f('0x86'),_0x4ab8ae))[_0x3f2f('0x6f')]();_0x4388e2[_0x3f2f('0x87')](db['sequelize'][_0x3f2f('0x32')](_0x97b2db));_0x5bdfeb['push'](db[_0x3f2f('0x88')][_0x3f2f('0x32')](_0xe5db56));}return BPromise['all'](_0x4388e2);}})[_0x3f2f('0x24')](function(){return BPromise['all'](_0x5bdfeb);})[_0x3f2f('0x24')](function(){return _0x2111be;})['then'](respondWithResult(_0x17fd8d,null))['catch'](handleError(_0x17fd8d,null));};exports[_0x3f2f('0x89')]=function(_0x39f5a2,_0x2cd2b6,_0x55ddd9){return db[_0x3f2f('0x41')][_0x3f2f('0x48')]({'where':{'id':_0x39f5a2[_0x3f2f('0x51')]['id']}})[_0x3f2f('0x24')](handleEntityNotFound(_0x2cd2b6,null))['then'](function(_0x4059a5){if(_0x4059a5){return _0x4059a5[_0x3f2f('0x89')](_0x39f5a2[_0x3f2f('0x32')][_0x3f2f('0x64')]);}})[_0x3f2f('0x24')](function(_0x503937){if(_0x503937){return db[_0x3f2f('0x5a')][_0x3f2f('0x25')]({'where':{'ListId':_0x39f5a2[_0x3f2f('0x32')][_0x3f2f('0x64')],'CampaignId':_0x39f5a2[_0x3f2f('0x51')]['id']}})[_0x3f2f('0x24')](function(){return _0x503937;});}})[_0x3f2f('0x24')](respondWithStatusCode(_0x2cd2b6,null))[_0x3f2f('0x49')](handleError(_0x2cd2b6,null));};exports['getBlackLists']=function(_0x4bd25a,_0x2ed07b,_0x10b9d2){var _0x44d5a9={};var _0x5ac6f5={};var _0x1cc1c5;var _0x37d6b9;return db[_0x3f2f('0x41')][_0x3f2f('0x59')]({'where':{'id':_0x4bd25a[_0x3f2f('0x51')]['id']}})[_0x3f2f('0x24')](handleEntityNotFound(_0x2ed07b,null))[_0x3f2f('0x24')](function(_0x3ab4d2){if(_0x3ab4d2){_0x1cc1c5=_0x3ab4d2;_0x5ac6f5['model']=_[_0x3f2f('0x45')](db[_0x3f2f('0x8a')][_0x3f2f('0x2e')]);_0x5ac6f5[_0x3f2f('0x32')]=_[_0x3f2f('0x45')](_0x4bd25a['query']);_0x5ac6f5['filters']=_[_0x3f2f('0x34')](_0x5ac6f5[_0x3f2f('0x35')],_0x5ac6f5[_0x3f2f('0x32')]);_0x44d5a9[_0x3f2f('0x36')]=_['intersection'](_0x5ac6f5[_0x3f2f('0x35')],qs['fields'](_0x4bd25a['query'][_0x3f2f('0x37')]));_0x44d5a9['attributes']=_0x44d5a9[_0x3f2f('0x36')][_0x3f2f('0x46')]?_0x44d5a9['attributes']:_0x5ac6f5[_0x3f2f('0x35')];_0x44d5a9['order']=qs[_0x3f2f('0x3b')](_0x4bd25a[_0x3f2f('0x32')][_0x3f2f('0x3b')]);_0x44d5a9[_0x3f2f('0x3c')]=qs[_0x3f2f('0x33')](_[_0x3f2f('0x3d')](_0x4bd25a[_0x3f2f('0x32')],_0x5ac6f5[_0x3f2f('0x33')]));if(_0x4bd25a[_0x3f2f('0x32')][_0x3f2f('0x3f')]){_0x44d5a9[_0x3f2f('0x3c')]=_[_0x3f2f('0x3e')](_0x44d5a9[_0x3f2f('0x3c')],{'$or':_[_0x3f2f('0x2d')](_0x44d5a9[_0x3f2f('0x36')],function(_0x2339b1){var _0x9e9086={};_0x9e9086[_0x2339b1]={'$like':'%'+_0x4bd25a[_0x3f2f('0x32')]['filter']+'%'};return _0x9e9086;})});}_0x44d5a9=_['merge']({},_0x44d5a9,_0x4bd25a['options']);return _0x1cc1c5[_0x3f2f('0x8b')](_0x44d5a9);}})['then'](function(_0x1e9d76){if(_0x1e9d76){_0x37d6b9=_0x1e9d76[_0x3f2f('0x46')];if(!_0x4bd25a[_0x3f2f('0x32')][_0x3f2f('0x38')](_0x3f2f('0x39'))){_0x44d5a9[_0x3f2f('0x1d')]=qs['limit'](_0x4bd25a[_0x3f2f('0x32')]['limit']);_0x44d5a9[_0x3f2f('0x1c')]=qs[_0x3f2f('0x1c')](_0x4bd25a[_0x3f2f('0x32')][_0x3f2f('0x1c')]);}return _0x1cc1c5[_0x3f2f('0x8b')](_0x44d5a9);}})['then'](function(_0x14b969){if(_0x14b969){return _0x14b969?{'count':_0x37d6b9,'rows':_0x14b969}:null;}})[_0x3f2f('0x24')](respondWithResult(_0x2ed07b,null))[_0x3f2f('0x49')](handleError(_0x2ed07b,null));};exports['addBlackLists']=function(_0x178f38,_0x2f9897,_0x8873b0){var _0xe05e6c,_0x4cc102;var _0xaae38c=[];var _0x35f25e=moment()[_0x3f2f('0x62')]('YYYY-MM-DD\x20HH:mm:ss');return db['Campaign'][_0x3f2f('0x48')]({'where':{'id':_0x178f38[_0x3f2f('0x51')]['id']}})[_0x3f2f('0x24')](handleEntityNotFound(_0x2f9897,null))[_0x3f2f('0x24')](function(_0x3e4927){if(_0x3e4927){_0x4cc102=_0x3e4927;return _0x3e4927[_0x3f2f('0x8c')](_0x178f38[_0x3f2f('0x4b')]['ids'],_[_0x3f2f('0x52')](_0x178f38[_0x3f2f('0x4b')],[_0x3f2f('0x64'),'id'])||{});}return null;})[_0x3f2f('0x8d')](function(_0x1427ba){var _0x354321;var _0x11c50a;_0xe05e6c=_0x1427ba||[];var _0x2b5541=[];if(_0x1427ba){for(var _0x449b58=0x0;_0x449b58<_0x1427ba[_0x3f2f('0x46')];_0x449b58+=0x1){var _0x3348db=_0x1427ba[_0x449b58][_0x3f2f('0x26')]({'plain':!![]});_0x354321=squel[_0x3f2f('0x67')]()[_0x3f2f('0x68')]('cm_hopper_black')[_0x3f2f('0x7e')](['phone',_0x3f2f('0x6b'),_0x3f2f('0x6e'),'CampaignId',_0x3f2f('0x53'),'updatedAt'],squel[_0x3f2f('0x6c')]()[_0x3f2f('0x6d')](_0x3f2f('0x6a'),_0x3f2f('0x6a'))[_0x3f2f('0x6d')]('id',_0x3f2f('0x6b'))[_0x3f2f('0x6d')](_0x3348db['CmListId'][_0x3f2f('0x6f')](),_0x3f2f('0x6e'))[_0x3f2f('0x6d')](_0x178f38[_0x3f2f('0x51')]['id'][_0x3f2f('0x6f')](),'CampaignId')[_0x3f2f('0x6d')]('NOW()',_0x3f2f('0x53'))['field'](_0x3f2f('0x81'),_0x3f2f('0x54'))[_0x3f2f('0x70')](_0x3f2f('0x71'))[_0x3f2f('0x3c')](_0x3f2f('0x72'))[_0x3f2f('0x3c')](_0x3f2f('0x7a'),_0x3348db[_0x3f2f('0x73')][_0x3f2f('0x6f')]())[_0x3f2f('0x3c')](_0x3f2f('0x7b')))[_0x3f2f('0x6f')]();_0x2b5541[_0x3f2f('0x87')](db[_0x3f2f('0x88')][_0x3f2f('0x32')](_0x354321));}return BPromise['all'](_0x2b5541);}})[_0x3f2f('0x24')](function(){return _0xe05e6c;})['then'](respondWithResult(_0x2f9897,null))[_0x3f2f('0x49')](handleError(_0x2f9897,null));};exports['removeBlackLists']=function(_0x36d59e,_0x2cea27,_0x217eae){return db[_0x3f2f('0x41')][_0x3f2f('0x48')]({'where':{'id':_0x36d59e[_0x3f2f('0x51')]['id']}})[_0x3f2f('0x24')](handleEntityNotFound(_0x2cea27,null))[_0x3f2f('0x24')](function(_0x32c8cd){if(_0x32c8cd){return _0x32c8cd[_0x3f2f('0x8e')](_0x36d59e[_0x3f2f('0x32')][_0x3f2f('0x64')]);}})[_0x3f2f('0x24')](function(_0x5ddbd9){if(_0x5ddbd9){return db['CmHopperBlack']['destroy']({'where':{'ListId':_0x36d59e[_0x3f2f('0x32')][_0x3f2f('0x64')],'CampaignId':_0x36d59e[_0x3f2f('0x51')]['id']}})[_0x3f2f('0x24')](function(){return _0x5ddbd9;});}})['then'](respondWithStatusCode(_0x2cea27,null))['catch'](handleError(_0x2cea27,null));}; \ No newline at end of file +var _0xd10f=['send','index','map','Campaign','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','getHoppers','findOne','CmHopper','nolimit','CampaignId','filter','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','format','YYYY-MM-DD\x20HH:mm:ss','addLists','ids','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','select','field','NOW()','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','ListId\x20=\x20?','cm_hopper_additional_phones','cmHopperId','OrderBy','h.id','ci.item','ci.OrderBY','cm_contact_has_items','h.ContactId\x20=\x20ci.CmContactId','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','CmList','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','IvrCampaigns','error','stack','name'];(function(_0x166b67,_0x3ae234){var _0x1e1c00=function(_0x394e7d){while(--_0x394e7d){_0x166b67['push'](_0x166b67['shift']());}};_0x1e1c00(++_0x3ae234);}(_0xd10f,0x198));var _0xfd10=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xd10f[_0x5b644e];return _0x49c6bf;};'use strict';var emlformat=require(_0xfd10('0x0'));var rimraf=require(_0xfd10('0x1'));var zipdir=require(_0xfd10('0x2'));var jsonpatch=require(_0xfd10('0x3'));var rp=require(_0xfd10('0x4'));var moment=require('moment');var BPromise=require(_0xfd10('0x5'));var Mustache=require(_0xfd10('0x6'));var util=require('util');var path=require('path');var sox=require(_0xfd10('0x7'));var csv=require(_0xfd10('0x8'));var ejs=require(_0xfd10('0x9'));var fs=require('fs');var fs_extra=require(_0xfd10('0xa'));var _=require(_0xfd10('0xb'));var squel=require(_0xfd10('0xc'));var crypto=require(_0xfd10('0xd'));var jsforce=require(_0xfd10('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xfd10('0x8'));var querystring=require(_0xfd10('0xf'));var Papa=require('papaparse');var Redis=require(_0xfd10('0x10'));var authService=require(_0xfd10('0x11'));var qs=require(_0xfd10('0x12'));var as=require(_0xfd10('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xfd10('0x14'));var utils=require(_0xfd10('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xfd10('0x16'));var db=require(_0xfd10('0x17'))['db'];function respondWithStatusCode(_0x456752,_0x156806){_0x156806=_0x156806||0xcc;return function(_0x3d2d5b){if(_0x3d2d5b){return _0x456752[_0xfd10('0x18')](_0x156806);}return _0x456752[_0xfd10('0x19')](_0x156806)[_0xfd10('0x1a')]();};}function respondWithResult(_0x12cfe3,_0x18e5d1){_0x18e5d1=_0x18e5d1||0xc8;return function(_0x250cb0){if(_0x250cb0){return _0x12cfe3[_0xfd10('0x19')](_0x18e5d1)[_0xfd10('0x1b')](_0x250cb0);}};}function respondWithFilteredResult(_0x21dc0a,_0x1e2f26){return function(_0x24b017){if(_0x24b017){var _0x1dcd95=typeof _0x1e2f26[_0xfd10('0x1c')]===_0xfd10('0x1d')&&typeof _0x1e2f26[_0xfd10('0x1e')]===_0xfd10('0x1d');var _0x448045=_0x24b017[_0xfd10('0x1f')];var _0x4ffe07=_0x1dcd95?0x0:_0x1e2f26[_0xfd10('0x1c')];var _0x4b2c63=_0x1dcd95?_0x24b017[_0xfd10('0x1f')]:_0x1e2f26['offset']+_0x1e2f26[_0xfd10('0x1e')];var _0x316274;if(_0x4b2c63>=_0x448045){_0x4b2c63=_0x448045;_0x316274=0xc8;}else{_0x316274=0xce;}_0x21dc0a[_0xfd10('0x19')](_0x316274);return _0x21dc0a[_0xfd10('0x20')]('Content-Range',_0x4ffe07+'-'+_0x4b2c63+'/'+_0x448045)[_0xfd10('0x1b')](_0x24b017);}return null;};}function patchUpdates(_0x1dcc7a){return function(_0x546537){try{jsonpatch[_0xfd10('0x21')](_0x546537,_0x1dcc7a,!![]);}catch(_0x36ddf1){return BPromise['reject'](_0x36ddf1);}return _0x546537[_0xfd10('0x22')]();};}function saveUpdates(_0x21fc27,_0x4014a3){return function(_0x52e614){if(_0x52e614){return _0x52e614[_0xfd10('0x23')](_0x21fc27)[_0xfd10('0x24')](function(_0x44490e){return _0x44490e;});}return null;};}function removeEntity(_0x47f63d,_0x464122){return function(_0x4a57fd){if(_0x4a57fd){return _0x4a57fd[_0xfd10('0x25')]()['then'](function(){var _0x59af0c=_0x4a57fd['get']({'plain':!![]});var _0x31b470=_0xfd10('0x26');return db['UserProfileResource'][_0xfd10('0x25')]({'where':{'type':_0x31b470,'resourceId':_0x59af0c['id']}})[_0xfd10('0x24')](function(){return _0x4a57fd;});})[_0xfd10('0x24')](function(){_0x47f63d[_0xfd10('0x19')](0xcc)[_0xfd10('0x1a')]();});}};}function handleEntityNotFound(_0x105ec4,_0x48ab62){return function(_0x2419fa){if(!_0x2419fa){_0x105ec4[_0xfd10('0x18')](0x194);}return _0x2419fa;};}function handleError(_0x881ace,_0x49d8d2){_0x49d8d2=_0x49d8d2||0x1f4;return function(_0x77aa08){logger[_0xfd10('0x27')](_0x77aa08[_0xfd10('0x28')]);if(_0x77aa08[_0xfd10('0x29')]){delete _0x77aa08['name'];}_0x881ace['status'](_0x49d8d2)[_0xfd10('0x2a')](_0x77aa08);};}exports[_0xfd10('0x2b')]=function(_0x542962,_0x2971dc){var _0x3fdd9a={},_0x586118={},_0x545ad1={'count':0x0,'rows':[]};var _0x3b46f1=_[_0xfd10('0x2c')](db[_0xfd10('0x2d')][_0xfd10('0x2e')],function(_0x1c9cd7){return{'name':_0x1c9cd7['fieldName'],'type':_0x1c9cd7[_0xfd10('0x2f')][_0xfd10('0x30')]};});_0x586118[_0xfd10('0x31')]=_[_0xfd10('0x2c')](_0x3b46f1,_0xfd10('0x29'));_0x586118[_0xfd10('0x32')]=_[_0xfd10('0x33')](_0x542962['query']);_0x586118['filters']=_[_0xfd10('0x34')](_0x586118['model'],_0x586118[_0xfd10('0x32')]);_0x3fdd9a['attributes']=_[_0xfd10('0x34')](_0x586118[_0xfd10('0x31')],qs[_0xfd10('0x35')](_0x542962['query'][_0xfd10('0x35')]));_0x3fdd9a[_0xfd10('0x36')]=_0x3fdd9a[_0xfd10('0x36')][_0xfd10('0x37')]?_0x3fdd9a[_0xfd10('0x36')]:_0x586118[_0xfd10('0x31')];if(!_0x542962[_0xfd10('0x32')][_0xfd10('0x38')]('nolimit')){_0x3fdd9a['limit']=qs['limit'](_0x542962[_0xfd10('0x32')][_0xfd10('0x1e')]);_0x3fdd9a[_0xfd10('0x1c')]=qs[_0xfd10('0x1c')](_0x542962[_0xfd10('0x32')][_0xfd10('0x1c')]);}_0x3fdd9a[_0xfd10('0x39')]=qs['sort'](_0x542962[_0xfd10('0x32')][_0xfd10('0x3a')]);_0x3fdd9a[_0xfd10('0x3b')]=qs[_0xfd10('0x3c')](_[_0xfd10('0x3d')](_0x542962['query'],_0x586118[_0xfd10('0x3c')]),_0x3b46f1);if(_0x542962[_0xfd10('0x32')]['filter']){_0x3fdd9a[_0xfd10('0x3b')]=_[_0xfd10('0x3e')](_0x3fdd9a[_0xfd10('0x3b')],{'$or':_[_0xfd10('0x2c')](_0x3b46f1,function(_0x2055d9){if(_0x2055d9['type']!==_0xfd10('0x3f')){var _0x39ccee={};_0x39ccee[_0x2055d9[_0xfd10('0x29')]]={'$like':'%'+_0x542962[_0xfd10('0x32')]['filter']+'%'};return _0x39ccee;}})});}_0x3fdd9a=_[_0xfd10('0x3e')]({},_0x3fdd9a,_0x542962[_0xfd10('0x40')]);var _0x2fecbd={'where':_0x3fdd9a[_0xfd10('0x3b')]};return db[_0xfd10('0x2d')][_0xfd10('0x1f')](_0x2fecbd)[_0xfd10('0x24')](function(_0x41eae9){_0x545ad1[_0xfd10('0x1f')]=_0x41eae9;if(_0x542962[_0xfd10('0x32')][_0xfd10('0x41')]){_0x3fdd9a['include']=[{'all':!![]}];}return db[_0xfd10('0x2d')][_0xfd10('0x42')](_0x3fdd9a);})[_0xfd10('0x24')](function(_0x52a50e){_0x545ad1[_0xfd10('0x43')]=_0x52a50e;return _0x545ad1;})[_0xfd10('0x24')](respondWithFilteredResult(_0x2971dc,_0x3fdd9a))[_0xfd10('0x44')](handleError(_0x2971dc,null));};exports[_0xfd10('0x45')]=function(_0x28bb7b,_0x3837d8){var _0x5bc341={'raw':![],'where':{'id':_0x28bb7b[_0xfd10('0x46')]['id']}},_0x155c3c={};_0x155c3c[_0xfd10('0x31')]=_[_0xfd10('0x33')](db[_0xfd10('0x2d')][_0xfd10('0x2e')]);_0x155c3c[_0xfd10('0x32')]=_[_0xfd10('0x33')](_0x28bb7b[_0xfd10('0x32')]);_0x155c3c[_0xfd10('0x3c')]=_['intersection'](_0x155c3c[_0xfd10('0x31')],_0x155c3c[_0xfd10('0x32')]);_0x5bc341['attributes']=_[_0xfd10('0x34')](_0x155c3c[_0xfd10('0x31')],qs[_0xfd10('0x35')](_0x28bb7b[_0xfd10('0x32')][_0xfd10('0x35')]));_0x5bc341[_0xfd10('0x36')]=_0x5bc341[_0xfd10('0x36')][_0xfd10('0x37')]?_0x5bc341[_0xfd10('0x36')]:_0x155c3c[_0xfd10('0x31')];if(_0x28bb7b[_0xfd10('0x32')][_0xfd10('0x41')]){_0x5bc341[_0xfd10('0x47')]=[{'all':!![]}];}_0x5bc341=_[_0xfd10('0x3e')]({},_0x5bc341,_0x28bb7b[_0xfd10('0x40')]);return db['Campaign'][_0xfd10('0x48')](_0x5bc341)['then'](handleEntityNotFound(_0x3837d8,null))['then'](respondWithResult(_0x3837d8,null))[_0xfd10('0x44')](handleError(_0x3837d8,null));};exports[_0xfd10('0x49')]=function(_0xaf20f4,_0x1b10d4){return db[_0xfd10('0x2d')][_0xfd10('0x49')](_0xaf20f4[_0xfd10('0x4a')],{})['then'](function(_0x56a26c){var _0x49397d=_0xaf20f4[_0xfd10('0x4b')]['get']({'plain':!![]});if(!_0x49397d)throw new Error(_0xfd10('0x4c'));if(_0x49397d[_0xfd10('0x4d')]===_0xfd10('0x4b')){var _0x35b87e=_0x56a26c[_0xfd10('0x4e')]({'plain':!![]});var _0x8373f2=_0xfd10('0x26');return db[_0xfd10('0x4f')][_0xfd10('0x48')]({'where':{'name':_0x8373f2,'userProfileId':_0x49397d[_0xfd10('0x50')]},'raw':!![]})['then'](function(_0x12d159){if(_0x12d159&&_0x12d159[_0xfd10('0x51')]===0x0){return db[_0xfd10('0x52')][_0xfd10('0x49')]({'name':_0x35b87e[_0xfd10('0x29')],'resourceId':_0x35b87e['id'],'type':_0x12d159[_0xfd10('0x29')],'sectionId':_0x12d159['id']},{})[_0xfd10('0x24')](function(){return _0x56a26c;});}else{return _0x56a26c;}})[_0xfd10('0x44')](function(_0x27c1a4){logger['error'](_0xfd10('0x53'),_0x27c1a4);throw _0x27c1a4;});}return _0x56a26c;})['then'](respondWithResult(_0x1b10d4,0xc9))[_0xfd10('0x44')](handleError(_0x1b10d4,null));};exports[_0xfd10('0x54')]=function(_0x19b396,_0x19c253){var _0x5a7cef={'where':{'id':_0x19b396[_0xfd10('0x46')]['id']}},_0x44e17c={};_0x44e17c[_0xfd10('0x31')]=_[_0xfd10('0x33')](db[_0xfd10('0x2d')]['rawAttributes']);_0x5a7cef[_0xfd10('0x36')]=_[_0xfd10('0x34')](_0x44e17c[_0xfd10('0x31')],qs[_0xfd10('0x35')](_0x19b396[_0xfd10('0x32')]['fields']));_0x5a7cef[_0xfd10('0x36')]=_0x5a7cef[_0xfd10('0x36')][_0xfd10('0x37')]?_0x5a7cef[_0xfd10('0x36')]:_0x44e17c[_0xfd10('0x31')];if(_0x19b396['query'][_0xfd10('0x41')]){_0x5a7cef['include']=[{'all':!![]}];}_0x5a7cef=_['merge']({},_0x5a7cef,_0x19b396['options']);return db[_0xfd10('0x2d')][_0xfd10('0x48')](_0x5a7cef)[_0xfd10('0x24')](handleEntityNotFound(_0x19c253,null))[_0xfd10('0x24')](function(_0x29b8b0){if(_0x29b8b0){var _0x5349f7=_0x29b8b0[_0xfd10('0x4e')]({'plain':!![]});_0x5349f7=qs[_0xfd10('0x55')](_0x5349f7,['id',_0xfd10('0x56'),_0xfd10('0x57')]);_0x19b396[_0xfd10('0x4a')]=_[_0xfd10('0x55')](_0x19b396[_0xfd10('0x4a')],['id',_0xfd10('0x56'),_0xfd10('0x57')]);return db[_0xfd10('0x2d')][_0xfd10('0x49')](_[_0xfd10('0x3e')](_0x5349f7,_0x19b396['body']),{'include':_0x19b396['query']['includeAll']?[{'all':!![]}]:undefined})[_0xfd10('0x24')](function(_0x48c7b5){var _0xae547=_0x19b396[_0xfd10('0x4b')][_0xfd10('0x4e')]({'plain':!![]});if(!_0xae547)throw new Error(_0xfd10('0x4c'));if(_0xae547[_0xfd10('0x4d')]===_0xfd10('0x4b')){var _0x1ba89c=_0x48c7b5[_0xfd10('0x4e')]({'plain':!![]});var _0x490a53=_0xfd10('0x26');return db[_0xfd10('0x4f')][_0xfd10('0x48')]({'where':{'name':_0x490a53,'userProfileId':_0xae547[_0xfd10('0x50')]},'raw':!![]})[_0xfd10('0x24')](function(_0x3a3e59){if(_0x3a3e59&&_0x3a3e59[_0xfd10('0x51')]===0x0){return db['UserProfileResource'][_0xfd10('0x49')]({'name':_0x1ba89c[_0xfd10('0x29')],'resourceId':_0x1ba89c['id'],'type':_0x3a3e59[_0xfd10('0x29')],'sectionId':_0x3a3e59['id']},{})['then'](function(){return _0x48c7b5;});}else{return _0x48c7b5;}})[_0xfd10('0x44')](function(_0x482eda){logger[_0xfd10('0x27')](_0xfd10('0x53'),_0x482eda);throw _0x482eda;});}return _0x48c7b5;});}})[_0xfd10('0x24')](respondWithResult(_0x19c253,0xc9))['catch'](handleError(_0x19c253,null));};exports[_0xfd10('0x23')]=function(_0x4d1c77,_0x3a1f02){if(_0x4d1c77[_0xfd10('0x4a')]['id']){delete _0x4d1c77[_0xfd10('0x4a')]['id'];}return db['Campaign'][_0xfd10('0x48')]({'where':{'id':_0x4d1c77[_0xfd10('0x46')]['id']}})[_0xfd10('0x24')](handleEntityNotFound(_0x3a1f02,null))[_0xfd10('0x24')](saveUpdates(_0x4d1c77[_0xfd10('0x4a')],null))[_0xfd10('0x24')](respondWithResult(_0x3a1f02,null))[_0xfd10('0x44')](handleError(_0x3a1f02,null));};exports['destroy']=function(_0x16292a,_0xa6fa7e){return db['Campaign']['find']({'where':{'id':_0x16292a[_0xfd10('0x46')]['id']}})[_0xfd10('0x24')](handleEntityNotFound(_0xa6fa7e,null))['then'](removeEntity(_0xa6fa7e,null))[_0xfd10('0x44')](handleError(_0xa6fa7e,null));};exports[_0xfd10('0x58')]=function(_0x3a7211,_0x669431,_0x2a089a){var _0x13e68e={'raw':!![],'where':{}};var _0x3bfbfb={};var _0x39485f={'count':0x0,'rows':[]};return db[_0xfd10('0x2d')][_0xfd10('0x59')]({'where':{'id':_0x3a7211[_0xfd10('0x46')]['id']}})[_0xfd10('0x24')](handleEntityNotFound(_0x669431,null))[_0xfd10('0x24')](function(_0x2b2db7){if(_0x2b2db7){_0x3bfbfb[_0xfd10('0x31')]=_[_0xfd10('0x33')](db[_0xfd10('0x5a')][_0xfd10('0x2e')]);_0x3bfbfb[_0xfd10('0x32')]=_[_0xfd10('0x33')](_0x3a7211[_0xfd10('0x32')]);_0x3bfbfb['filters']=_[_0xfd10('0x34')](_0x3bfbfb[_0xfd10('0x31')],_0x3bfbfb['query']);_0x13e68e['attributes']=_[_0xfd10('0x34')](_0x3bfbfb['model'],qs['fields'](_0x3a7211[_0xfd10('0x32')]['fields']));_0x13e68e['attributes']=_0x13e68e[_0xfd10('0x36')][_0xfd10('0x37')]?_0x13e68e[_0xfd10('0x36')]:_0x3bfbfb[_0xfd10('0x31')];if(!_0x3a7211['query']['hasOwnProperty'](_0xfd10('0x5b'))){_0x13e68e[_0xfd10('0x1e')]=qs[_0xfd10('0x1e')](_0x3a7211[_0xfd10('0x32')]['limit']);_0x13e68e[_0xfd10('0x1c')]=qs[_0xfd10('0x1c')](_0x3a7211[_0xfd10('0x32')][_0xfd10('0x1c')]);}_0x13e68e[_0xfd10('0x39')]=qs[_0xfd10('0x3a')](_0x3a7211['query'][_0xfd10('0x3a')]);_0x13e68e[_0xfd10('0x3b')]=qs[_0xfd10('0x3c')](_[_0xfd10('0x3d')](_0x3a7211['query'],_0x3bfbfb[_0xfd10('0x3c')]));_0x13e68e[_0xfd10('0x3b')][_0xfd10('0x5c')]=_0x2b2db7['id'];if(_0x3a7211['query'][_0xfd10('0x5d')]){_0x13e68e[_0xfd10('0x3b')]=_[_0xfd10('0x3e')](_0x13e68e[_0xfd10('0x3b')],{'$or':_[_0xfd10('0x2c')](_0x13e68e[_0xfd10('0x36')],function(_0x4d49e7){var _0x1a5697={};_0x1a5697[_0x4d49e7]={'$like':'%'+_0x3a7211[_0xfd10('0x32')][_0xfd10('0x5d')]+'%'};return _0x1a5697;})});}_0x13e68e=_[_0xfd10('0x3e')]({},_0x13e68e,_0x3a7211[_0xfd10('0x40')]);return db[_0xfd10('0x5a')][_0xfd10('0x1f')]({'where':_0x13e68e[_0xfd10('0x3b')]})['then'](function(_0x91b0a8){_0x39485f[_0xfd10('0x1f')]=_0x91b0a8;if(_0x3a7211[_0xfd10('0x32')][_0xfd10('0x41')]){_0x13e68e['include']=[{'all':!![]}];}return db[_0xfd10('0x5a')]['findAll'](_0x13e68e);})[_0xfd10('0x24')](function(_0x4ece84){_0x39485f['rows']=_0x4ece84;return _0x39485f;});}})[_0xfd10('0x24')](respondWithFilteredResult(_0x669431,_0x13e68e))[_0xfd10('0x44')](handleError(_0x669431,null));};exports[_0xfd10('0x5e')]=function(_0x2d7da6,_0xbc2014,_0x8f3fb0){var _0x5e6310={'raw':!![],'where':{}};var _0x5e3939={};var _0x105198={'count':0x0,'rows':[]};return db[_0xfd10('0x2d')][_0xfd10('0x59')]({'where':{'id':_0x2d7da6[_0xfd10('0x46')]['id']}})[_0xfd10('0x24')](handleEntityNotFound(_0xbc2014,null))[_0xfd10('0x24')](function(_0x3a16b9){if(_0x3a16b9){_0x5e3939[_0xfd10('0x31')]=_[_0xfd10('0x33')](db[_0xfd10('0x5f')][_0xfd10('0x2e')]);_0x5e3939[_0xfd10('0x32')]=_[_0xfd10('0x33')](_0x2d7da6[_0xfd10('0x32')]);_0x5e3939['filters']=_[_0xfd10('0x34')](_0x5e3939['model'],_0x5e3939[_0xfd10('0x32')]);_0x5e6310[_0xfd10('0x36')]=_[_0xfd10('0x34')](_0x5e3939['model'],qs[_0xfd10('0x35')](_0x2d7da6[_0xfd10('0x32')][_0xfd10('0x35')]));_0x5e6310[_0xfd10('0x36')]=_0x5e6310['attributes'][_0xfd10('0x37')]?_0x5e6310[_0xfd10('0x36')]:_0x5e3939[_0xfd10('0x31')];if(!_0x2d7da6[_0xfd10('0x32')]['hasOwnProperty'](_0xfd10('0x5b'))){_0x5e6310['limit']=qs['limit'](_0x2d7da6[_0xfd10('0x32')][_0xfd10('0x1e')]);_0x5e6310['offset']=qs[_0xfd10('0x1c')](_0x2d7da6['query'][_0xfd10('0x1c')]);}_0x5e6310[_0xfd10('0x39')]=qs[_0xfd10('0x3a')](_0x2d7da6[_0xfd10('0x32')][_0xfd10('0x3a')]);_0x5e6310[_0xfd10('0x3b')]=qs[_0xfd10('0x3c')](_[_0xfd10('0x3d')](_0x2d7da6[_0xfd10('0x32')],_0x5e3939['filters']));_0x5e6310[_0xfd10('0x3b')][_0xfd10('0x5c')]=_0x3a16b9['id'];if(_0x2d7da6[_0xfd10('0x32')][_0xfd10('0x5d')]){_0x5e6310['where']=_[_0xfd10('0x3e')](_0x5e6310[_0xfd10('0x3b')],{'$or':_[_0xfd10('0x2c')](_0x5e6310[_0xfd10('0x36')],function(_0x557a2d){var _0x583dbc={};_0x583dbc[_0x557a2d]={'$like':'%'+_0x2d7da6['query'][_0xfd10('0x5d')]+'%'};return _0x583dbc;})});}_0x5e6310=_[_0xfd10('0x3e')]({},_0x5e6310,_0x2d7da6[_0xfd10('0x40')]);return db[_0xfd10('0x5f')][_0xfd10('0x1f')]({'where':_0x5e6310['where']})[_0xfd10('0x24')](function(_0x3137c4){_0x105198[_0xfd10('0x1f')]=_0x3137c4;if(_0x2d7da6[_0xfd10('0x32')][_0xfd10('0x41')]){_0x5e6310[_0xfd10('0x47')]=[{'all':!![]}];}return db[_0xfd10('0x5f')][_0xfd10('0x42')](_0x5e6310);})[_0xfd10('0x24')](function(_0x194dc1){_0x105198['rows']=_0x194dc1;return _0x105198;});}})[_0xfd10('0x24')](respondWithFilteredResult(_0xbc2014,_0x5e6310))['catch'](handleError(_0xbc2014,null));};exports[_0xfd10('0x60')]=function(_0x4f15fd,_0x138dd3,_0x4bf837){var _0x37fe95={'raw':!![],'where':{}};var _0x21ff09={};var _0xdfbfb0={'count':0x0,'rows':[]};return db['Campaign'][_0xfd10('0x59')]({'where':{'id':_0x4f15fd[_0xfd10('0x46')]['id']}})[_0xfd10('0x24')](handleEntityNotFound(_0x138dd3,null))[_0xfd10('0x24')](function(_0x3d3918){if(_0x3d3918){_0x21ff09['model']=_[_0xfd10('0x33')](db[_0xfd10('0x61')][_0xfd10('0x2e')]);_0x21ff09['query']=_[_0xfd10('0x33')](_0x4f15fd['query']);_0x21ff09[_0xfd10('0x3c')]=_[_0xfd10('0x34')](_0x21ff09['model'],_0x21ff09[_0xfd10('0x32')]);_0x37fe95[_0xfd10('0x36')]=_[_0xfd10('0x34')](_0x21ff09['model'],qs[_0xfd10('0x35')](_0x4f15fd[_0xfd10('0x32')][_0xfd10('0x35')]));_0x37fe95[_0xfd10('0x36')]=_0x37fe95[_0xfd10('0x36')][_0xfd10('0x37')]?_0x37fe95['attributes']:_0x21ff09[_0xfd10('0x31')];if(!_0x4f15fd[_0xfd10('0x32')]['hasOwnProperty'](_0xfd10('0x5b'))){_0x37fe95['limit']=qs[_0xfd10('0x1e')](_0x4f15fd[_0xfd10('0x32')]['limit']);_0x37fe95['offset']=qs[_0xfd10('0x1c')](_0x4f15fd[_0xfd10('0x32')][_0xfd10('0x1c')]);}_0x37fe95[_0xfd10('0x39')]=qs[_0xfd10('0x3a')](_0x4f15fd['query'][_0xfd10('0x3a')]);_0x37fe95[_0xfd10('0x3b')]=qs[_0xfd10('0x3c')](_[_0xfd10('0x3d')](_0x4f15fd[_0xfd10('0x32')],_0x21ff09[_0xfd10('0x3c')]));_0x37fe95[_0xfd10('0x3b')][_0xfd10('0x5c')]=_0x3d3918['id'];if(_0x4f15fd['query'][_0xfd10('0x5d')]){_0x37fe95['where']=_[_0xfd10('0x3e')](_0x37fe95['where'],{'$or':_['map'](_0x37fe95[_0xfd10('0x36')],function(_0x16e5fb){var _0x17b8a4={};_0x17b8a4[_0x16e5fb]={'$like':'%'+_0x4f15fd['query'][_0xfd10('0x5d')]+'%'};return _0x17b8a4;})});}_0x37fe95=_[_0xfd10('0x3e')]({},_0x37fe95,_0x4f15fd[_0xfd10('0x40')]);return db[_0xfd10('0x61')]['count']({'where':_0x37fe95[_0xfd10('0x3b')]})[_0xfd10('0x24')](function(_0x2a6178){_0xdfbfb0[_0xfd10('0x1f')]=_0x2a6178;if(_0x4f15fd[_0xfd10('0x32')][_0xfd10('0x41')]){_0x37fe95[_0xfd10('0x47')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x37fe95);})[_0xfd10('0x24')](function(_0x5ea862){_0xdfbfb0[_0xfd10('0x43')]=_0x5ea862;return _0xdfbfb0;});}})[_0xfd10('0x24')](respondWithFilteredResult(_0x138dd3,_0x37fe95))[_0xfd10('0x44')](handleError(_0x138dd3,null));};exports[_0xfd10('0x62')]=function(_0x52366a,_0x3b35ad,_0x23c4e0){var _0x2eeffc={'raw':!![],'where':{}};var _0x35cc56={};var _0x312bc5={'count':0x0,'rows':[]};return db[_0xfd10('0x2d')][_0xfd10('0x59')]({'where':{'id':_0x52366a[_0xfd10('0x46')]['id']}})[_0xfd10('0x24')](handleEntityNotFound(_0x3b35ad,null))['then'](function(_0x1bdbd5){if(_0x1bdbd5){_0x35cc56[_0xfd10('0x31')]=_[_0xfd10('0x33')](db[_0xfd10('0x63')][_0xfd10('0x2e')]);_0x35cc56[_0xfd10('0x32')]=_['keys'](_0x52366a[_0xfd10('0x32')]);_0x35cc56[_0xfd10('0x3c')]=_['intersection'](_0x35cc56[_0xfd10('0x31')],_0x35cc56[_0xfd10('0x32')]);_0x2eeffc[_0xfd10('0x36')]=_[_0xfd10('0x34')](_0x35cc56[_0xfd10('0x31')],qs['fields'](_0x52366a['query']['fields']));_0x2eeffc[_0xfd10('0x36')]=_0x2eeffc[_0xfd10('0x36')][_0xfd10('0x37')]?_0x2eeffc[_0xfd10('0x36')]:_0x35cc56[_0xfd10('0x31')];if(!_0x52366a[_0xfd10('0x32')]['hasOwnProperty']('nolimit')){_0x2eeffc[_0xfd10('0x1e')]=qs[_0xfd10('0x1e')](_0x52366a['query']['limit']);_0x2eeffc[_0xfd10('0x1c')]=qs[_0xfd10('0x1c')](_0x52366a[_0xfd10('0x32')][_0xfd10('0x1c')]);}_0x2eeffc[_0xfd10('0x39')]=qs['sort'](_0x52366a['query']['sort']);_0x2eeffc[_0xfd10('0x3b')]=qs[_0xfd10('0x3c')](_[_0xfd10('0x3d')](_0x52366a[_0xfd10('0x32')],_0x35cc56[_0xfd10('0x3c')]));_0x2eeffc['where'][_0xfd10('0x5c')]=_0x1bdbd5['id'];if(_0x52366a[_0xfd10('0x32')][_0xfd10('0x5d')]){_0x2eeffc[_0xfd10('0x3b')]=_[_0xfd10('0x3e')](_0x2eeffc[_0xfd10('0x3b')],{'$or':_['map'](_0x2eeffc['attributes'],function(_0x1f9709){var _0x17e009={};_0x17e009[_0x1f9709]={'$like':'%'+_0x52366a[_0xfd10('0x32')]['filter']+'%'};return _0x17e009;})});}_0x2eeffc=_[_0xfd10('0x3e')]({},_0x2eeffc,_0x52366a[_0xfd10('0x40')]);return db['CmHopperBlack'][_0xfd10('0x1f')]({'where':_0x2eeffc[_0xfd10('0x3b')]})[_0xfd10('0x24')](function(_0x5c24f3){_0x312bc5[_0xfd10('0x1f')]=_0x5c24f3;if(_0x52366a[_0xfd10('0x32')][_0xfd10('0x41')]){_0x2eeffc[_0xfd10('0x47')]=[{'all':!![]}];}return db['CmHopperBlack'][_0xfd10('0x42')](_0x2eeffc);})[_0xfd10('0x24')](function(_0x52f9c5){_0x312bc5[_0xfd10('0x43')]=_0x52f9c5;return _0x312bc5;});}})[_0xfd10('0x24')](respondWithFilteredResult(_0x3b35ad,_0x2eeffc))[_0xfd10('0x44')](handleError(_0x3b35ad,null));};exports['getLists']=function(_0x443b1c,_0x3aa4b2,_0x37160e){var _0x5c7cb3={};var _0x3298b5={};var _0x27e737;var _0x4fe865;return db['Campaign'][_0xfd10('0x59')]({'where':{'id':_0x443b1c[_0xfd10('0x46')]['id']}})[_0xfd10('0x24')](handleEntityNotFound(_0x3aa4b2,null))['then'](function(_0x159ec1){if(_0x159ec1){_0x27e737=_0x159ec1;_0x3298b5['model']=_[_0xfd10('0x33')](db['CmList']['rawAttributes']);_0x3298b5[_0xfd10('0x32')]=_['keys'](_0x443b1c[_0xfd10('0x32')]);_0x3298b5[_0xfd10('0x3c')]=_[_0xfd10('0x34')](_0x3298b5[_0xfd10('0x31')],_0x3298b5[_0xfd10('0x32')]);_0x5c7cb3[_0xfd10('0x36')]=_[_0xfd10('0x34')](_0x3298b5[_0xfd10('0x31')],qs[_0xfd10('0x35')](_0x443b1c[_0xfd10('0x32')][_0xfd10('0x35')]));_0x5c7cb3['attributes']=_0x5c7cb3[_0xfd10('0x36')]['length']?_0x5c7cb3[_0xfd10('0x36')]:_0x3298b5[_0xfd10('0x31')];_0x5c7cb3[_0xfd10('0x39')]=qs[_0xfd10('0x3a')](_0x443b1c[_0xfd10('0x32')]['sort']);_0x5c7cb3[_0xfd10('0x3b')]=qs[_0xfd10('0x3c')](_[_0xfd10('0x3d')](_0x443b1c[_0xfd10('0x32')],_0x3298b5['filters']));if(_0x443b1c[_0xfd10('0x32')][_0xfd10('0x5d')]){_0x5c7cb3[_0xfd10('0x3b')]=_[_0xfd10('0x3e')](_0x5c7cb3[_0xfd10('0x3b')],{'$or':_[_0xfd10('0x2c')](_0x5c7cb3[_0xfd10('0x36')],function(_0x1e1e72){var _0x5f2509={};_0x5f2509[_0x1e1e72]={'$like':'%'+_0x443b1c[_0xfd10('0x32')][_0xfd10('0x5d')]+'%'};return _0x5f2509;})});}_0x5c7cb3=_[_0xfd10('0x3e')]({},_0x5c7cb3,_0x443b1c[_0xfd10('0x40')]);return _0x27e737[_0xfd10('0x64')](_0x5c7cb3);}})['then'](function(_0xd65f11){if(_0xd65f11){_0x4fe865=_0xd65f11[_0xfd10('0x37')];if(!_0x443b1c[_0xfd10('0x32')][_0xfd10('0x38')]('nolimit')){_0x5c7cb3[_0xfd10('0x1e')]=qs[_0xfd10('0x1e')](_0x443b1c[_0xfd10('0x32')][_0xfd10('0x1e')]);_0x5c7cb3[_0xfd10('0x1c')]=qs[_0xfd10('0x1c')](_0x443b1c['query']['offset']);}return _0x27e737['getLists'](_0x5c7cb3);}})[_0xfd10('0x24')](function(_0x3d1b54){if(_0x3d1b54){return _0x3d1b54?{'count':_0x4fe865,'rows':_0x3d1b54}:null;}})[_0xfd10('0x24')](respondWithResult(_0x3aa4b2,null))[_0xfd10('0x44')](handleError(_0x3aa4b2,null));};exports['addLists']=function(_0x492f49,_0x4fc865,_0x551333){var _0xd3aabc,_0x19636f;var _0x8a5522=[];var _0x19c3d9=moment()[_0xfd10('0x65')](_0xfd10('0x66'));return db[_0xfd10('0x2d')][_0xfd10('0x48')]({'where':{'id':_0x492f49['params']['id']}})[_0xfd10('0x24')](handleEntityNotFound(_0x4fc865,null))[_0xfd10('0x24')](function(_0x263d1f){if(_0x263d1f){_0x19636f=_0x263d1f;return _0x263d1f[_0xfd10('0x67')](_0x492f49[_0xfd10('0x4a')][_0xfd10('0x68')],_['omit'](_0x492f49[_0xfd10('0x4a')],[_0xfd10('0x68'),'id'])||{});}return null;})['spread'](function(_0x585188){var _0x54992a;var _0x671103;_0xd3aabc=_0x585188||[];var _0x15299c=[];if(_0x585188){for(var _0x2ea49e=0x0;_0x2ea49e<_0x585188[_0xfd10('0x37')];_0x2ea49e+=0x1){var _0x23669b=_0x585188[_0x2ea49e][_0xfd10('0x4e')]({'plain':!![]});_0x19636f[_0xfd10('0x69')]=_0x492f49[_0xfd10('0x4a')][_0xfd10('0x69')]?_0x492f49[_0xfd10('0x4a')][_0xfd10('0x69')]:_0x19636f[_0xfd10('0x69')];switch(_0x19636f[_0xfd10('0x69')]){case _0xfd10('0x6a'):_0x54992a=squel[_0xfd10('0x6b')]()[_0xfd10('0x6c')](_0xfd10('0x6d'))[_0xfd10('0x6e')]([_0xfd10('0x6f'),_0xfd10('0x70'),_0xfd10('0x71'),_0xfd10('0x72'),_0xfd10('0x5c'),_0xfd10('0x56'),_0xfd10('0x57')],squel[_0xfd10('0x73')]()['field']('phone',_0xfd10('0x6f'))[_0xfd10('0x74')](_0xfd10('0x75'),_0xfd10('0x70'))['field']('id',_0xfd10('0x71'))['field'](_0x23669b[_0xfd10('0x76')][_0xfd10('0x77')](),_0xfd10('0x72'))[_0xfd10('0x74')](_0x492f49[_0xfd10('0x46')]['id']['toString'](),_0xfd10('0x5c'))[_0xfd10('0x74')]('\x27'+_0x19c3d9+'\x27',_0xfd10('0x56'))[_0xfd10('0x74')]('\x27'+_0x19c3d9+'\x27',_0xfd10('0x57'))[_0xfd10('0x78')](_0xfd10('0x79'))[_0xfd10('0x3b')](_0xfd10('0x7a'))[_0xfd10('0x3b')]('ListId\x20=\x20?',_0x23669b[_0xfd10('0x76')][_0xfd10('0x77')]())[_0xfd10('0x3b')](_0xfd10('0x7b'))['where'](_0xfd10('0x7c'),squel[_0xfd10('0x73')]()[_0xfd10('0x74')](_0xfd10('0x7d'))[_0xfd10('0x78')](_0xfd10('0x7e'))[_0xfd10('0x3b')](_0xfd10('0x7f'),_0x492f49[_0xfd10('0x46')]['id'][_0xfd10('0x77')]()))[_0xfd10('0x3b')](_0xfd10('0x7c'),squel['select']()['field'](_0xfd10('0x80'))[_0xfd10('0x78')]('cm_hopper')['where'](_0xfd10('0x7f'),_0x492f49[_0xfd10('0x46')]['id'][_0xfd10('0x77')]())))[_0xfd10('0x77')]();break;case _0xfd10('0x81'):_0x54992a=squel['insert']()[_0xfd10('0x6c')]('cm_hopper')['fromQuery']([_0xfd10('0x6f'),_0xfd10('0x70'),_0xfd10('0x71'),_0xfd10('0x72'),_0xfd10('0x5c'),_0xfd10('0x56'),'updatedAt'],squel[_0xfd10('0x73')]()['field'](_0xfd10('0x6f'),_0xfd10('0x6f'))[_0xfd10('0x74')](_0xfd10('0x75'),_0xfd10('0x70'))[_0xfd10('0x74')]('id','ContactId')['field'](_0x23669b[_0xfd10('0x76')][_0xfd10('0x77')](),_0xfd10('0x72'))[_0xfd10('0x74')](_0x492f49['params']['id'][_0xfd10('0x77')](),'CampaignId')[_0xfd10('0x74')]('\x27'+_0x19c3d9+'\x27','createdAt')['field']('\x27'+_0x19c3d9+'\x27','updatedAt')[_0xfd10('0x78')]('cm_contacts')[_0xfd10('0x3b')](_0xfd10('0x7a'))['where'](_0xfd10('0x82'),_0x23669b[_0xfd10('0x76')][_0xfd10('0x77')]())['where'](_0xfd10('0x7b'))[_0xfd10('0x3b')](_0xfd10('0x7c'),squel[_0xfd10('0x73')]()[_0xfd10('0x74')](_0xfd10('0x80'))[_0xfd10('0x78')](_0xfd10('0x6d'))[_0xfd10('0x3b')](_0xfd10('0x7f'),_0x492f49[_0xfd10('0x46')]['id'][_0xfd10('0x77')]())))['toString']();break;default:_0x54992a=squel['insert']()[_0xfd10('0x6c')]('cm_hopper')['fromQuery']([_0xfd10('0x6f'),_0xfd10('0x70'),'ContactId','ListId',_0xfd10('0x5c'),_0xfd10('0x56'),_0xfd10('0x57')],squel['select']()[_0xfd10('0x74')](_0xfd10('0x6f'),_0xfd10('0x6f'))[_0xfd10('0x74')](_0xfd10('0x75'),_0xfd10('0x70'))['field']('id',_0xfd10('0x71'))['field'](_0x23669b['CmListId']['toString'](),_0xfd10('0x72'))[_0xfd10('0x74')](_0x492f49['params']['id'][_0xfd10('0x77')](),'CampaignId')['field']('\x27'+_0x19c3d9+'\x27',_0xfd10('0x56'))[_0xfd10('0x74')]('\x27'+_0x19c3d9+'\x27',_0xfd10('0x57'))['from'](_0xfd10('0x79'))[_0xfd10('0x3b')](_0xfd10('0x7a'))[_0xfd10('0x3b')](_0xfd10('0x82'),_0x23669b['CmListId'][_0xfd10('0x77')]())[_0xfd10('0x3b')](_0xfd10('0x7b')))['toString']();}_0x671103=squel[_0xfd10('0x6b')]()[_0xfd10('0x6c')](_0xfd10('0x83'))['fromQuery']([_0xfd10('0x84'),_0xfd10('0x70'),'phone',_0xfd10('0x85'),_0xfd10('0x56'),_0xfd10('0x57')],squel[_0xfd10('0x73')]()['field'](_0xfd10('0x86'),'id')[_0xfd10('0x74')](_0xfd10('0x75'),_0xfd10('0x70'))[_0xfd10('0x74')](_0xfd10('0x87'),_0xfd10('0x6f'))[_0xfd10('0x74')](_0xfd10('0x88'),_0xfd10('0x85'))[_0xfd10('0x74')]('\x27'+_0x19c3d9+'\x27',_0xfd10('0x56'))['field']('\x27'+_0x19c3d9+'\x27',_0xfd10('0x57'))[_0xfd10('0x78')](_0xfd10('0x89'),'ci')['join'](_0xfd10('0x6d'),'h',_0xfd10('0x8a'))[_0xfd10('0x3b')]('h.ListId\x20=\x20?',_0x23669b['CmListId'][_0xfd10('0x77')]())[_0xfd10('0x3b')](_0xfd10('0x8b'),_0x492f49[_0xfd10('0x46')]['id'][_0xfd10('0x77')]())[_0xfd10('0x3b')](_0xfd10('0x8c'),_0x19c3d9))[_0xfd10('0x77')]();_0x15299c[_0xfd10('0x8d')](db[_0xfd10('0x8e')]['query'](_0x54992a));_0x8a5522['push'](db[_0xfd10('0x8e')][_0xfd10('0x32')](_0x671103));}return BPromise[_0xfd10('0x8f')](_0x15299c);}})['then'](function(){return BPromise[_0xfd10('0x8f')](_0x8a5522);})['then'](function(){return _0xd3aabc;})['then'](respondWithResult(_0x4fc865,null))[_0xfd10('0x44')](handleError(_0x4fc865,null));};exports[_0xfd10('0x90')]=function(_0x2354b8,_0x18d548,_0xddad5d){return db[_0xfd10('0x2d')]['find']({'where':{'id':_0x2354b8[_0xfd10('0x46')]['id']}})['then'](handleEntityNotFound(_0x18d548,null))[_0xfd10('0x24')](function(_0x580523){if(_0x580523){return _0x580523[_0xfd10('0x90')](_0x2354b8[_0xfd10('0x32')]['ids']);}})[_0xfd10('0x24')](function(_0xf5cbe1){if(_0xf5cbe1){return db[_0xfd10('0x5a')][_0xfd10('0x25')]({'where':{'ListId':_0x2354b8['query'][_0xfd10('0x68')],'CampaignId':_0x2354b8[_0xfd10('0x46')]['id']}})['then'](function(){return _0xf5cbe1;});}})[_0xfd10('0x24')](respondWithStatusCode(_0x18d548,null))['catch'](handleError(_0x18d548,null));};exports[_0xfd10('0x91')]=function(_0x3acab0,_0x559577,_0xa8f6e3){var _0x50d4be={};var _0x35c039={};var _0x441ee9;var _0x4724c5;return db['Campaign'][_0xfd10('0x59')]({'where':{'id':_0x3acab0['params']['id']}})[_0xfd10('0x24')](handleEntityNotFound(_0x559577,null))[_0xfd10('0x24')](function(_0x3bdf2b){if(_0x3bdf2b){_0x441ee9=_0x3bdf2b;_0x35c039[_0xfd10('0x31')]=_[_0xfd10('0x33')](db[_0xfd10('0x92')][_0xfd10('0x2e')]);_0x35c039[_0xfd10('0x32')]=_['keys'](_0x3acab0['query']);_0x35c039[_0xfd10('0x3c')]=_[_0xfd10('0x34')](_0x35c039[_0xfd10('0x31')],_0x35c039[_0xfd10('0x32')]);_0x50d4be[_0xfd10('0x36')]=_[_0xfd10('0x34')](_0x35c039[_0xfd10('0x31')],qs[_0xfd10('0x35')](_0x3acab0[_0xfd10('0x32')]['fields']));_0x50d4be[_0xfd10('0x36')]=_0x50d4be[_0xfd10('0x36')][_0xfd10('0x37')]?_0x50d4be[_0xfd10('0x36')]:_0x35c039['model'];_0x50d4be[_0xfd10('0x39')]=qs['sort'](_0x3acab0[_0xfd10('0x32')][_0xfd10('0x3a')]);_0x50d4be['where']=qs[_0xfd10('0x3c')](_[_0xfd10('0x3d')](_0x3acab0[_0xfd10('0x32')],_0x35c039[_0xfd10('0x3c')]));if(_0x3acab0[_0xfd10('0x32')]['filter']){_0x50d4be[_0xfd10('0x3b')]=_[_0xfd10('0x3e')](_0x50d4be[_0xfd10('0x3b')],{'$or':_[_0xfd10('0x2c')](_0x50d4be[_0xfd10('0x36')],function(_0x106f3e){var _0x4c9fd2={};_0x4c9fd2[_0x106f3e]={'$like':'%'+_0x3acab0[_0xfd10('0x32')]['filter']+'%'};return _0x4c9fd2;})});}_0x50d4be=_[_0xfd10('0x3e')]({},_0x50d4be,_0x3acab0[_0xfd10('0x40')]);return _0x441ee9[_0xfd10('0x91')](_0x50d4be);}})['then'](function(_0x4c6eb7){if(_0x4c6eb7){_0x4724c5=_0x4c6eb7[_0xfd10('0x37')];if(!_0x3acab0['query'][_0xfd10('0x38')]('nolimit')){_0x50d4be['limit']=qs[_0xfd10('0x1e')](_0x3acab0[_0xfd10('0x32')][_0xfd10('0x1e')]);_0x50d4be[_0xfd10('0x1c')]=qs[_0xfd10('0x1c')](_0x3acab0[_0xfd10('0x32')][_0xfd10('0x1c')]);}return _0x441ee9['getBlackLists'](_0x50d4be);}})[_0xfd10('0x24')](function(_0x5a1839){if(_0x5a1839){return _0x5a1839?{'count':_0x4724c5,'rows':_0x5a1839}:null;}})[_0xfd10('0x24')](respondWithResult(_0x559577,null))[_0xfd10('0x44')](handleError(_0x559577,null));};exports[_0xfd10('0x93')]=function(_0x87826,_0x22d06a,_0x1e93cc){var _0x53d83d,_0x18b0fa;var _0x5182d7=[];var _0x5f0e51=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');return db[_0xfd10('0x2d')]['find']({'where':{'id':_0x87826[_0xfd10('0x46')]['id']}})['then'](handleEntityNotFound(_0x22d06a,null))['then'](function(_0x7066d0){if(_0x7066d0){_0x18b0fa=_0x7066d0;return _0x7066d0[_0xfd10('0x93')](_0x87826[_0xfd10('0x4a')][_0xfd10('0x68')],_[_0xfd10('0x55')](_0x87826[_0xfd10('0x4a')],[_0xfd10('0x68'),'id'])||{});}return null;})['spread'](function(_0x118ce8){var _0x3b1a9f;var _0x409462;_0x53d83d=_0x118ce8||[];var _0x488cec=[];if(_0x118ce8){for(var _0x171ee4=0x0;_0x171ee4<_0x118ce8['length'];_0x171ee4+=0x1){var _0x2dbfa3=_0x118ce8[_0x171ee4][_0xfd10('0x4e')]({'plain':!![]});_0x3b1a9f=squel[_0xfd10('0x6b')]()[_0xfd10('0x6c')](_0xfd10('0x94'))[_0xfd10('0x6e')]([_0xfd10('0x6f'),_0xfd10('0x71'),_0xfd10('0x72'),'CampaignId','createdAt','updatedAt'],squel[_0xfd10('0x73')]()[_0xfd10('0x74')]('phone',_0xfd10('0x6f'))['field']('id',_0xfd10('0x71'))[_0xfd10('0x74')](_0x2dbfa3[_0xfd10('0x76')][_0xfd10('0x77')](),_0xfd10('0x72'))[_0xfd10('0x74')](_0x87826['params']['id'][_0xfd10('0x77')](),'CampaignId')[_0xfd10('0x74')](_0xfd10('0x75'),_0xfd10('0x56'))[_0xfd10('0x74')](_0xfd10('0x75'),_0xfd10('0x57'))[_0xfd10('0x78')]('cm_contacts')['where'](_0xfd10('0x7a'))[_0xfd10('0x3b')](_0xfd10('0x82'),_0x2dbfa3['CmListId'][_0xfd10('0x77')]())[_0xfd10('0x3b')](_0xfd10('0x7b')))['toString']();_0x488cec[_0xfd10('0x8d')](db[_0xfd10('0x8e')]['query'](_0x3b1a9f));}return BPromise[_0xfd10('0x8f')](_0x488cec);}})[_0xfd10('0x24')](function(){return _0x53d83d;})[_0xfd10('0x24')](respondWithResult(_0x22d06a,null))[_0xfd10('0x44')](handleError(_0x22d06a,null));};exports[_0xfd10('0x95')]=function(_0x1403b7,_0x57923e,_0x5e2be6){return db[_0xfd10('0x2d')][_0xfd10('0x48')]({'where':{'id':_0x1403b7[_0xfd10('0x46')]['id']}})['then'](handleEntityNotFound(_0x57923e,null))[_0xfd10('0x24')](function(_0x503d56){if(_0x503d56){return _0x503d56[_0xfd10('0x95')](_0x1403b7[_0xfd10('0x32')][_0xfd10('0x68')]);}})[_0xfd10('0x24')](function(_0x220259){if(_0x220259){return db[_0xfd10('0x63')][_0xfd10('0x25')]({'where':{'ListId':_0x1403b7['query']['ids'],'CampaignId':_0x1403b7[_0xfd10('0x46')]['id']}})[_0xfd10('0x24')](function(){return _0x220259;});}})[_0xfd10('0x24')](respondWithStatusCode(_0x57923e,null))['catch'](handleError(_0x57923e,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index d69e898..451a0bd 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(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'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(_0x31a371,_0x50828e){var _0x2a5bd6=function(_0x2fb481){while(--_0x2fb481){_0x31a371['push'](_0x31a371['shift']());}};_0x2a5bd6(++_0x50828e);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index dfd5fe6..daf9a62 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 _0x52b2=['http','then','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetCampaign','findAll','options','raw','where','limit','include','map','model','attributes','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x577df6,_0x238b61){var _0x17cf7d=function(_0x3ec22d){while(--_0x3ec22d){_0x577df6['push'](_0x577df6['shift']());}};_0x17cf7d(++_0x238b61);}(_0x52b2,0x11e));var _0x252b=function(_0x3f111f,_0x18da01){_0x3f111f=_0x3f111f-0x0;var _0x3ed245=_0x52b2[_0x3f111f];return _0x3ed245;};'use strict';var _=require(_0x252b('0x0'));var util=require(_0x252b('0x1'));var moment=require(_0x252b('0x2'));var BPromise=require(_0x252b('0x3'));var rs=require(_0x252b('0x4'));var fs=require('fs');var Redis=require(_0x252b('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x252b('0x6'));var logger=require(_0x252b('0x7'))(_0x252b('0x8'));var config=require(_0x252b('0x9'));var jayson=require(_0x252b('0xa'));var client=jayson['client'][_0x252b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x409365,_0x3e071a,_0x81d77a){return new BPromise(function(_0x147e21,_0x1f3992){return client['request'](_0x409365,_0x81d77a)[_0x252b('0xc')](function(_0x1d0fb2){logger['info'](_0x252b('0xd'),_0x3e071a,_0x252b('0xe'));logger[_0x252b('0xf')](_0x252b('0x10'),_0x3e071a,_0x252b('0xe'),JSON[_0x252b('0x11')](_0x1d0fb2));if(_0x1d0fb2[_0x252b('0x12')]){if(_0x1d0fb2[_0x252b('0x12')][_0x252b('0x13')]===0x1f4){logger[_0x252b('0x12')](_0x252b('0xd'),_0x3e071a,_0x1d0fb2['error'][_0x252b('0x14')]);return _0x1f3992(_0x1d0fb2[_0x252b('0x12')][_0x252b('0x14')]);}logger[_0x252b('0x12')](_0x252b('0xd'),_0x3e071a,_0x1d0fb2[_0x252b('0x12')][_0x252b('0x14')]);return _0x147e21(_0x1d0fb2[_0x252b('0x12')][_0x252b('0x14')]);}else{logger['info'](_0x252b('0xd'),_0x3e071a,_0x252b('0xe'));_0x147e21(_0x1d0fb2[_0x252b('0x15')][_0x252b('0x14')]);}})['catch'](function(_0x4d852e){logger[_0x252b('0x12')]('Campaign,\x20%s,\x20%s',_0x3e071a,_0x4d852e);_0x1f3992(_0x4d852e);});});}exports[_0x252b('0x16')]=function(_0x20ffd6){var _0x15247b=this;return new Promise(function(_0x1048f3,_0x2fcf48){return db['Campaign'][_0x252b('0x17')]({'raw':_0x20ffd6[_0x252b('0x18')]?_0x20ffd6[_0x252b('0x18')][_0x252b('0x19')]===undefined?!![]:![]:!![],'where':_0x20ffd6[_0x252b('0x18')]?_0x20ffd6[_0x252b('0x18')][_0x252b('0x1a')]||null:null,'attributes':_0x20ffd6[_0x252b('0x18')]?_0x20ffd6[_0x252b('0x18')]['attributes']||null:null,'limit':_0x20ffd6[_0x252b('0x18')]?_0x20ffd6[_0x252b('0x18')][_0x252b('0x1b')]||null:null,'include':_0x20ffd6[_0x252b('0x18')]?_0x20ffd6['options'][_0x252b('0x1c')]?_[_0x252b('0x1d')](_0x20ffd6['options'][_0x252b('0x1c')],function(_0x1f5924){return{'model':db[_0x1f5924[_0x252b('0x1e')]],'as':_0x1f5924['as'],'attributes':_0x1f5924[_0x252b('0x1f')],'include':_0x1f5924[_0x252b('0x1c')]?_['map'](_0x1f5924[_0x252b('0x1c')],function(_0x39649d){return{'model':db[_0x39649d['model']],'as':_0x39649d['as'],'attributes':_0x39649d[_0x252b('0x1f')],'include':_0x39649d[_0x252b('0x1c')]?_[_0x252b('0x1d')](_0x39649d[_0x252b('0x1c')],function(_0x239b4a){return{'model':db[_0x239b4a[_0x252b('0x1e')]],'as':_0x239b4a['as'],'attributes':_0x239b4a[_0x252b('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x252b('0xc')](function(_0x57fa7b){logger['info'](_0x252b('0x16'),_0x20ffd6);logger[_0x252b('0xf')](_0x252b('0x16'),_0x20ffd6,JSON[_0x252b('0x11')](_0x57fa7b));_0x1048f3(_0x57fa7b);})[_0x252b('0x20')](function(_0x425060){logger[_0x252b('0x12')]('GetCampaign',_0x425060[_0x252b('0x14')],_0x20ffd6);_0x2fcf48(_0x15247b[_0x252b('0x12')](0x1f4,_0x425060[_0x252b('0x14')]));});});}; \ No newline at end of file +var _0x1e69=['include','model','map','then','catch','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','GetCampaign','Campaign','findAll','options','raw','where','attributes','limit'];(function(_0x593fd4,_0x43f32a){var _0x28db4e=function(_0xbfae11){while(--_0xbfae11){_0x593fd4['push'](_0x593fd4['shift']());}};_0x28db4e(++_0x43f32a);}(_0x1e69,0x85));var _0x91e6=function(_0x34c437,_0x28501c){_0x34c437=_0x34c437-0x0;var _0x37e190=_0x1e69[_0x34c437];return _0x37e190;};'use strict';var _=require('lodash');var util=require(_0x91e6('0x0'));var moment=require(_0x91e6('0x1'));var BPromise=require(_0x91e6('0x2'));var rs=require(_0x91e6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x91e6('0x4'));var logger=require(_0x91e6('0x5'))(_0x91e6('0x6'));var config=require(_0x91e6('0x7'));var jayson=require(_0x91e6('0x8'));var client=jayson[_0x91e6('0x9')][_0x91e6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2733bf,_0x1347c3,_0x375184){return new BPromise(function(_0x266fe6,_0x46edd7){return client[_0x91e6('0xb')](_0x2733bf,_0x375184)['then'](function(_0x57682b){logger[_0x91e6('0xc')](_0x91e6('0xd'),_0x1347c3,_0x91e6('0xe'));logger[_0x91e6('0xf')]('Campaign,\x20%s,\x20%s,\x20%s',_0x1347c3,_0x91e6('0xe'),JSON[_0x91e6('0x10')](_0x57682b));if(_0x57682b[_0x91e6('0x11')]){if(_0x57682b[_0x91e6('0x11')]['code']===0x1f4){logger[_0x91e6('0x11')](_0x91e6('0xd'),_0x1347c3,_0x57682b[_0x91e6('0x11')][_0x91e6('0x12')]);return _0x46edd7(_0x57682b[_0x91e6('0x11')][_0x91e6('0x12')]);}logger[_0x91e6('0x11')]('Campaign,\x20%s,\x20%s',_0x1347c3,_0x57682b[_0x91e6('0x11')][_0x91e6('0x12')]);return _0x266fe6(_0x57682b[_0x91e6('0x11')][_0x91e6('0x12')]);}else{logger['info'](_0x91e6('0xd'),_0x1347c3,_0x91e6('0xe'));_0x266fe6(_0x57682b['result'][_0x91e6('0x12')]);}})['catch'](function(_0x57d30d){logger['error']('Campaign,\x20%s,\x20%s',_0x1347c3,_0x57d30d);_0x46edd7(_0x57d30d);});});}exports[_0x91e6('0x13')]=function(_0xdc9327){var _0x4b53b0=this;return new Promise(function(_0x5bda45,_0x368329){return db[_0x91e6('0x14')][_0x91e6('0x15')]({'raw':_0xdc9327[_0x91e6('0x16')]?_0xdc9327[_0x91e6('0x16')][_0x91e6('0x17')]===undefined?!![]:![]:!![],'where':_0xdc9327[_0x91e6('0x16')]?_0xdc9327[_0x91e6('0x16')][_0x91e6('0x18')]||null:null,'attributes':_0xdc9327[_0x91e6('0x16')]?_0xdc9327['options'][_0x91e6('0x19')]||null:null,'limit':_0xdc9327[_0x91e6('0x16')]?_0xdc9327[_0x91e6('0x16')][_0x91e6('0x1a')]||null:null,'include':_0xdc9327[_0x91e6('0x16')]?_0xdc9327[_0x91e6('0x16')]['include']?_['map'](_0xdc9327[_0x91e6('0x16')][_0x91e6('0x1b')],function(_0x581fcd){return{'model':db[_0x581fcd[_0x91e6('0x1c')]],'as':_0x581fcd['as'],'attributes':_0x581fcd['attributes'],'include':_0x581fcd[_0x91e6('0x1b')]?_[_0x91e6('0x1d')](_0x581fcd[_0x91e6('0x1b')],function(_0x1024a5){return{'model':db[_0x1024a5[_0x91e6('0x1c')]],'as':_0x1024a5['as'],'attributes':_0x1024a5[_0x91e6('0x19')],'include':_0x1024a5[_0x91e6('0x1b')]?_[_0x91e6('0x1d')](_0x1024a5[_0x91e6('0x1b')],function(_0x18c614){return{'model':db[_0x18c614[_0x91e6('0x1c')]],'as':_0x18c614['as'],'attributes':_0x18c614['attributes']};}):[]};}):[]};}):[]:[]})[_0x91e6('0x1e')](function(_0x360f21){logger[_0x91e6('0xc')](_0x91e6('0x13'),_0xdc9327);logger[_0x91e6('0xf')]('GetCampaign',_0xdc9327,JSON[_0x91e6('0x10')](_0x360f21));_0x5bda45(_0x360f21);})[_0x91e6('0x1f')](function(_0x4ca580){logger[_0x91e6('0x11')](_0x91e6('0x13'),_0x4ca580[_0x91e6('0x12')],_0xdc9327);_0x368329(_0x4b53b0['error'](0x1f4,_0x4ca580[_0x91e6('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index de3f77e..4b6a2cb 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 _0x78cc=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','/:id','isAuthenticated','getHoppers','get','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','/:id/blacklists','create','post','/:id/clone','clone','addBlackLists','put','destroy','delete','removeLists','removeBlackLists','exports','multer','path','connect-timeout','express'];(function(_0x2680a3,_0x4f839b){var _0x43dc12=function(_0x3378e2){while(--_0x3378e2){_0x2680a3['push'](_0x2680a3['shift']());}};_0x43dc12(++_0x4f839b);}(_0x78cc,0x11c));var _0xc78c=function(_0x238a32,_0x596754){_0x238a32=_0x238a32-0x0;var _0x266ed5=_0x78cc[_0x238a32];return _0x266ed5;};'use strict';var multer=require(_0xc78c('0x0'));var util=require('util');var path=require(_0xc78c('0x1'));var timeout=require(_0xc78c('0x2'));var express=require(_0xc78c('0x3'));var router=express[_0xc78c('0x4')]();var fs_extra=require(_0xc78c('0x5'));var auth=require(_0xc78c('0x6'));var interaction=require(_0xc78c('0x7'));var config=require(_0xc78c('0x8'));var controller=require('./campaign.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xc78c('0x9')]);router['get'](_0xc78c('0xa'),auth['isAuthenticated'](),controller['show']);router['get']('/:id/hoppers',auth[_0xc78c('0xb')](),controller[_0xc78c('0xc')]);router[_0xc78c('0xd')]('/:id/hopper_histories',auth[_0xc78c('0xb')](),controller[_0xc78c('0xe')]);router[_0xc78c('0xd')](_0xc78c('0xf'),auth['isAuthenticated'](),controller[_0xc78c('0x10')]);router['get'](_0xc78c('0x11'),auth['isAuthenticated'](),controller[_0xc78c('0x12')]);router['get'](_0xc78c('0x13'),auth['isAuthenticated'](),controller['getLists']);router[_0xc78c('0xd')](_0xc78c('0x14'),auth['isAuthenticated'](),controller['getBlackLists']);router['post']('/',auth[_0xc78c('0xb')](),controller[_0xc78c('0x15')]);router[_0xc78c('0x16')](_0xc78c('0x17'),auth[_0xc78c('0xb')](),controller[_0xc78c('0x18')]);router[_0xc78c('0x16')]('/:id/lists',auth[_0xc78c('0xb')](),controller['addLists']);router['post'](_0xc78c('0x14'),auth[_0xc78c('0xb')](),controller[_0xc78c('0x19')]);router[_0xc78c('0x1a')](_0xc78c('0xa'),auth[_0xc78c('0xb')](),controller['update']);router['delete'](_0xc78c('0xa'),auth[_0xc78c('0xb')](),controller[_0xc78c('0x1b')]);router[_0xc78c('0x1c')](_0xc78c('0x13'),auth['isAuthenticated'](),controller[_0xc78c('0x1d')]);router['delete'](_0xc78c('0x14'),auth['isAuthenticated'](),controller[_0xc78c('0x1e')]);module[_0xc78c('0x1f')]=router; \ No newline at end of file +var _0x5b4a=['connect-timeout','express','Router','fs-extra','../../components/auth/service','./campaign.controller','get','index','/:id','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','getLists','/:id/blacklists','getBlackLists','create','post','/:id/clone','clone','addLists','addBlackLists','put','update','delete','destroy','/:id/lists','removeLists','removeBlackLists','exports','multer','util','path'];(function(_0x590a38,_0x2bc65c){var _0xf36626=function(_0x551cd1){while(--_0x551cd1){_0x590a38['push'](_0x590a38['shift']());}};_0xf36626(++_0x2bc65c);}(_0x5b4a,0x1d1));var _0xa5b4=function(_0x2053ac,_0x2ecb7a){_0x2053ac=_0x2053ac-0x0;var _0x48aa7c=_0x5b4a[_0x2053ac];return _0x48aa7c;};'use strict';var multer=require(_0xa5b4('0x0'));var util=require(_0xa5b4('0x1'));var path=require(_0xa5b4('0x2'));var timeout=require(_0xa5b4('0x3'));var express=require(_0xa5b4('0x4'));var router=express[_0xa5b4('0x5')]();var fs_extra=require(_0xa5b4('0x6'));var auth=require(_0xa5b4('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa5b4('0x8'));router[_0xa5b4('0x9')]('/',auth['isAuthenticated'](),controller[_0xa5b4('0xa')]);router[_0xa5b4('0x9')](_0xa5b4('0xb'),auth[_0xa5b4('0xc')](),controller[_0xa5b4('0xd')]);router[_0xa5b4('0x9')](_0xa5b4('0xe'),auth[_0xa5b4('0xc')](),controller[_0xa5b4('0xf')]);router[_0xa5b4('0x9')](_0xa5b4('0x10'),auth[_0xa5b4('0xc')](),controller[_0xa5b4('0x11')]);router[_0xa5b4('0x9')](_0xa5b4('0x12'),auth['isAuthenticated'](),controller[_0xa5b4('0x13')]);router[_0xa5b4('0x9')](_0xa5b4('0x14'),auth['isAuthenticated'](),controller[_0xa5b4('0x15')]);router[_0xa5b4('0x9')]('/:id/lists',auth[_0xa5b4('0xc')](),controller[_0xa5b4('0x16')]);router[_0xa5b4('0x9')](_0xa5b4('0x17'),auth[_0xa5b4('0xc')](),controller[_0xa5b4('0x18')]);router['post']('/',auth[_0xa5b4('0xc')](),controller[_0xa5b4('0x19')]);router[_0xa5b4('0x1a')](_0xa5b4('0x1b'),auth['isAuthenticated'](),controller[_0xa5b4('0x1c')]);router['post']('/:id/lists',auth[_0xa5b4('0xc')](),controller[_0xa5b4('0x1d')]);router[_0xa5b4('0x1a')]('/:id/blacklists',auth[_0xa5b4('0xc')](),controller[_0xa5b4('0x1e')]);router[_0xa5b4('0x1f')](_0xa5b4('0xb'),auth['isAuthenticated'](),controller[_0xa5b4('0x20')]);router[_0xa5b4('0x21')](_0xa5b4('0xb'),auth[_0xa5b4('0xc')](),controller[_0xa5b4('0x22')]);router[_0xa5b4('0x21')](_0xa5b4('0x23'),auth['isAuthenticated'](),controller[_0xa5b4('0x24')]);router[_0xa5b4('0x21')](_0xa5b4('0x17'),auth[_0xa5b4('0xc')](),controller[_0xa5b4('0x25')]);module[_0xa5b4('0x26')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index ecb550e..738df09 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 _0x2655=['medium','STRING','VIRTUAL','getDataValue','exports','TEXT'];(function(_0xbd49d8,_0x49d3eb){var _0x3b039e=function(_0x27e9cd){while(--_0x27e9cd){_0xbd49d8['push'](_0xbd49d8['shift']());}};_0x3b039e(++_0x49d3eb);}(_0x2655,0xd6));var _0x5265=function(_0x1eacf,_0x20e4ae){_0x1eacf=_0x1eacf-0x0;var _0x22faa6=_0x2655[_0x1eacf];return _0x22faa6;};'use strict';var Sequelize=require('sequelize');module[_0x5265('0x0')]={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0x5265('0x1')],'length':_0x5265('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x5265('0x3')]},'name':{'type':Sequelize[_0x5265('0x4')],'get':function(){return this[_0x5265('0x5')]('key');}}}; \ No newline at end of file +var _0x166c=['STRING','TEXT','medium','getDataValue','key','exports'];(function(_0x3fa9ae,_0x3be9c7){var _0x355b1b=function(_0x5b3048){while(--_0x5b3048){_0x3fa9ae['push'](_0x3fa9ae['shift']());}};_0x355b1b(++_0x3be9c7);}(_0x166c,0x113));var _0xc166=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x166c[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xc166('0x0')]={'key':{'type':Sequelize[_0xc166('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0xc166('0x2')],'length':_0xc166('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xc166('0x1')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xc166('0x4')](_0xc166('0x5'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 0ff1c25..42f68bf 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 _0x5a9d=['desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','apply','reject','destroy','then','get','UserProfileResource','end','error','stack','name','index','map','CannedAnswer','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','show','params','find','update','body','create','key','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','CannedAnswers','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','to-csv','lodash','squel','crypto'];(function(_0x4c53ca,_0x5c0321){var _0x3079f1=function(_0x292b24){while(--_0x292b24){_0x4c53ca['push'](_0x4c53ca['shift']());}};_0x3079f1(++_0x5c0321);}(_0x5a9d,0xfd));var _0xd5a9=function(_0xd000c0,_0x3b13b4){_0xd000c0=_0xd000c0-0x0;var _0x5071a6=_0x5a9d[_0xd000c0];return _0x5071a6;};'use strict';var emlformat=require(_0xd5a9('0x0'));var rimraf=require(_0xd5a9('0x1'));var zipdir=require(_0xd5a9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd5a9('0x3'));var moment=require(_0xd5a9('0x4'));var BPromise=require(_0xd5a9('0x5'));var Mustache=require('mustache');var util=require(_0xd5a9('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xd5a9('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd5a9('0x8'));var squel=require(_0xd5a9('0x9'));var crypto=require(_0xd5a9('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xd5a9('0xb'));var toCsv=require(_0xd5a9('0x7'));var querystring=require(_0xd5a9('0xc'));var Papa=require('papaparse');var Redis=require(_0xd5a9('0xd'));var authService=require(_0xd5a9('0xe'));var qs=require(_0xd5a9('0xf'));var as=require(_0xd5a9('0x10'));var hardwareService=require(_0xd5a9('0x11'));var logger=require(_0xd5a9('0x12'))(_0xd5a9('0x13'));var utils=require(_0xd5a9('0x14'));var config=require(_0xd5a9('0x15'));var licenseUtil=require(_0xd5a9('0x16'));var db=require(_0xd5a9('0x17'))['db'];function respondWithStatusCode(_0xc70783,_0x4bd61a){_0x4bd61a=_0x4bd61a||0xcc;return function(_0x47fd5f){if(_0x47fd5f){return _0xc70783[_0xd5a9('0x18')](_0x4bd61a);}return _0xc70783['status'](_0x4bd61a)['end']();};}function respondWithResult(_0x2d7648,_0x513ef3){_0x513ef3=_0x513ef3||0xc8;return function(_0x1376fb){if(_0x1376fb){return _0x2d7648[_0xd5a9('0x19')](_0x513ef3)[_0xd5a9('0x1a')](_0x1376fb);}};}function respondWithFilteredResult(_0x383b8a,_0x387fb4){return function(_0xc42790){if(_0xc42790){var _0x3171cb=typeof _0x387fb4[_0xd5a9('0x1b')]==='undefined'&&typeof _0x387fb4[_0xd5a9('0x1c')]===_0xd5a9('0x1d');var _0x4cb122=_0xc42790[_0xd5a9('0x1e')];var _0x39e63f=_0x3171cb?0x0:_0x387fb4[_0xd5a9('0x1b')];var _0x431cf7=_0x3171cb?_0xc42790['count']:_0x387fb4[_0xd5a9('0x1b')]+_0x387fb4[_0xd5a9('0x1c')];var _0x5f4458;if(_0x431cf7>=_0x4cb122){_0x431cf7=_0x4cb122;_0x5f4458=0xc8;}else{_0x5f4458=0xce;}_0x383b8a[_0xd5a9('0x19')](_0x5f4458);return _0x383b8a[_0xd5a9('0x1f')]('Content-Range',_0x39e63f+'-'+_0x431cf7+'/'+_0x4cb122)[_0xd5a9('0x1a')](_0xc42790);}return null;};}function patchUpdates(_0x4c36f9){return function(_0x462d14){try{jsonpatch[_0xd5a9('0x20')](_0x462d14,_0x4c36f9,!![]);}catch(_0xa51a42){return BPromise[_0xd5a9('0x21')](_0xa51a42);}return _0x462d14['save']();};}function saveUpdates(_0x35ae99,_0x627d91){return function(_0x46ac0b){if(_0x46ac0b){return _0x46ac0b['update'](_0x35ae99)['then'](function(_0x45cce0){return _0x45cce0;});}return null;};}function removeEntity(_0x22eae3,_0x1ef521){return function(_0x8577da){if(_0x8577da){return _0x8577da[_0xd5a9('0x22')]()[_0xd5a9('0x23')](function(){var _0x45bb0e=_0x8577da[_0xd5a9('0x24')]({'plain':!![]});var _0x179071='CannedAnswers';return db[_0xd5a9('0x25')][_0xd5a9('0x22')]({'where':{'type':_0x179071,'resourceId':_0x45bb0e['id']}})[_0xd5a9('0x23')](function(){return _0x8577da;});})[_0xd5a9('0x23')](function(){_0x22eae3[_0xd5a9('0x19')](0xcc)[_0xd5a9('0x26')]();});}};}function handleEntityNotFound(_0x41a7b4,_0x5954b4){return function(_0x1ceeaf){if(!_0x1ceeaf){_0x41a7b4['sendStatus'](0x194);}return _0x1ceeaf;};}function handleError(_0x3d43d0,_0x1e74a9){_0x1e74a9=_0x1e74a9||0x1f4;return function(_0x2fd864){logger[_0xd5a9('0x27')](_0x2fd864[_0xd5a9('0x28')]);if(_0x2fd864[_0xd5a9('0x29')]){delete _0x2fd864[_0xd5a9('0x29')];}_0x3d43d0[_0xd5a9('0x19')](_0x1e74a9)['send'](_0x2fd864);};}exports[_0xd5a9('0x2a')]=function(_0x1483e1,_0x247d0c){var _0x54f544={},_0x2e8862={},_0x459632={'count':0x0,'rows':[]};var _0x3a1f90=_[_0xd5a9('0x2b')](db[_0xd5a9('0x2c')][_0xd5a9('0x2d')],function(_0x61a560){return{'name':_0x61a560[_0xd5a9('0x2e')],'type':_0x61a560[_0xd5a9('0x2f')]['key']};});_0x2e8862[_0xd5a9('0x30')]=_[_0xd5a9('0x2b')](_0x3a1f90,_0xd5a9('0x29'));_0x2e8862[_0xd5a9('0x31')]=_[_0xd5a9('0x32')](_0x1483e1[_0xd5a9('0x31')]);_0x2e8862[_0xd5a9('0x33')]=_['intersection'](_0x2e8862[_0xd5a9('0x30')],_0x2e8862['query']);_0x54f544['attributes']=_[_0xd5a9('0x34')](_0x2e8862[_0xd5a9('0x30')],qs['fields'](_0x1483e1[_0xd5a9('0x31')][_0xd5a9('0x35')]));_0x54f544[_0xd5a9('0x36')]=_0x54f544['attributes'][_0xd5a9('0x37')]?_0x54f544['attributes']:_0x2e8862[_0xd5a9('0x30')];if(!_0x1483e1[_0xd5a9('0x31')][_0xd5a9('0x38')](_0xd5a9('0x39'))){_0x54f544['limit']=qs[_0xd5a9('0x1c')](_0x1483e1[_0xd5a9('0x31')]['limit']);_0x54f544[_0xd5a9('0x1b')]=qs[_0xd5a9('0x1b')](_0x1483e1['query'][_0xd5a9('0x1b')]);}_0x54f544[_0xd5a9('0x3a')]=qs[_0xd5a9('0x3b')](_0x1483e1[_0xd5a9('0x31')]['sort']);_0x54f544[_0xd5a9('0x3c')]=qs['filters'](_[_0xd5a9('0x3d')](_0x1483e1[_0xd5a9('0x31')],_0x2e8862[_0xd5a9('0x33')]),_0x3a1f90);if(_0x1483e1[_0xd5a9('0x31')][_0xd5a9('0x3e')]){_0x54f544[_0xd5a9('0x3c')]=_[_0xd5a9('0x3f')](_0x54f544[_0xd5a9('0x3c')],{'$or':[{'key':{'$like':'%'+_0x1483e1[_0xd5a9('0x31')][_0xd5a9('0x3e')]+'%'}},{'value':{'$like':'%'+_0x1483e1[_0xd5a9('0x31')][_0xd5a9('0x3e')]+'%'}}]});}_0x54f544=_['merge']({},_0x54f544,_0x1483e1[_0xd5a9('0x40')]);var _0x382720={'where':_0x54f544[_0xd5a9('0x3c')]};return db[_0xd5a9('0x2c')][_0xd5a9('0x1e')](_0x382720)[_0xd5a9('0x23')](function(_0x5eeb7e){_0x459632['count']=_0x5eeb7e;if(_0x1483e1['query'][_0xd5a9('0x41')]){_0x54f544[_0xd5a9('0x42')]=[{'all':!![]}];}return db[_0xd5a9('0x2c')]['findAll'](_0x54f544);})['then'](function(_0x40ba6d){_0x459632[_0xd5a9('0x43')]=_0x40ba6d;return _0x459632;})['then'](respondWithFilteredResult(_0x247d0c,_0x54f544))[_0xd5a9('0x44')](handleError(_0x247d0c,null));};exports[_0xd5a9('0x45')]=function(_0x156a21,_0x3824f6){var _0x413dfb={'raw':!![],'where':{'id':_0x156a21[_0xd5a9('0x46')]['id']}},_0x508137={};_0x508137[_0xd5a9('0x30')]=_[_0xd5a9('0x32')](db[_0xd5a9('0x2c')]['rawAttributes']);_0x508137[_0xd5a9('0x31')]=_[_0xd5a9('0x32')](_0x156a21[_0xd5a9('0x31')]);_0x508137[_0xd5a9('0x33')]=_[_0xd5a9('0x34')](_0x508137[_0xd5a9('0x30')],_0x508137[_0xd5a9('0x31')]);_0x413dfb[_0xd5a9('0x36')]=_['intersection'](_0x508137['model'],qs[_0xd5a9('0x35')](_0x156a21[_0xd5a9('0x31')][_0xd5a9('0x35')]));_0x413dfb[_0xd5a9('0x36')]=_0x413dfb[_0xd5a9('0x36')]['length']?_0x413dfb[_0xd5a9('0x36')]:_0x508137['model'];if(_0x156a21[_0xd5a9('0x31')][_0xd5a9('0x41')]){_0x413dfb[_0xd5a9('0x42')]=[{'all':!![]}];}_0x413dfb=_['merge']({},_0x413dfb,_0x156a21[_0xd5a9('0x40')]);return db[_0xd5a9('0x2c')][_0xd5a9('0x47')](_0x413dfb)['then'](handleEntityNotFound(_0x3824f6,null))['then'](respondWithResult(_0x3824f6,null))[_0xd5a9('0x44')](handleError(_0x3824f6,null));};exports[_0xd5a9('0x48')]=function(_0x138887,_0x328642){if(_0x138887[_0xd5a9('0x49')]['id']){delete _0x138887[_0xd5a9('0x49')]['id'];}return db[_0xd5a9('0x2c')][_0xd5a9('0x47')]({'where':{'id':_0x138887[_0xd5a9('0x46')]['id']}})[_0xd5a9('0x23')](handleEntityNotFound(_0x328642,null))[_0xd5a9('0x23')](saveUpdates(_0x138887[_0xd5a9('0x49')],null))[_0xd5a9('0x23')](respondWithResult(_0x328642,null))[_0xd5a9('0x44')](handleError(_0x328642,null));};exports[_0xd5a9('0x22')]=function(_0x1a144e,_0x29f590){return db[_0xd5a9('0x2c')][_0xd5a9('0x47')]({'where':{'id':_0x1a144e[_0xd5a9('0x46')]['id']}})[_0xd5a9('0x23')](handleEntityNotFound(_0x29f590,null))[_0xd5a9('0x23')](removeEntity(_0x29f590,null))[_0xd5a9('0x44')](handleError(_0x29f590,null));};exports[_0xd5a9('0x4a')]=function(_0x529199,_0x293b9f){var _0x3c9c76={'key':_0x529199[_0xd5a9('0x49')][_0xd5a9('0x4b')]};if(_0x529199['body'][_0xd5a9('0x4c')]){_0x3c9c76['MailAccountId']=_0x529199['body']['MailAccountId'];}else if(_0x529199['body'][_0xd5a9('0x4d')]){_0x3c9c76[_0xd5a9('0x4d')]=_0x529199[_0xd5a9('0x49')][_0xd5a9('0x4d')];}else if(_0x529199[_0xd5a9('0x49')]['OpenchannelAccountId']){_0x3c9c76[_0xd5a9('0x4e')]=_0x529199['body'][_0xd5a9('0x4e')];}else if(_0x529199[_0xd5a9('0x49')]['ChatWebsiteId']){_0x3c9c76[_0xd5a9('0x4f')]=_0x529199[_0xd5a9('0x49')][_0xd5a9('0x4f')];}return db[_0xd5a9('0x2c')][_0xd5a9('0x47')]({'where':_0x3c9c76})[_0xd5a9('0x23')](function(_0x354cba){if(_0x354cba){throw new db['Sequelize'][(_0xd5a9('0x50'))](_0xd5a9('0x51'));}return db[_0xd5a9('0x2c')][_0xd5a9('0x4a')](_0x529199[_0xd5a9('0x49')]);})[_0xd5a9('0x23')](function(_0x19c58e){var _0x4bd451=_0x529199[_0xd5a9('0x52')][_0xd5a9('0x24')]({'plain':!![]});if(!_0x4bd451)throw new Error(_0xd5a9('0x53'));if(_0x4bd451['role']===_0xd5a9('0x52')){var _0x5a4791=_0x19c58e[_0xd5a9('0x24')]({'plain':!![]});return db['UserProfileSection'][_0xd5a9('0x47')]({'where':{'name':_0xd5a9('0x54'),'userProfileId':_0x4bd451[_0xd5a9('0x55')]},'raw':!![]})[_0xd5a9('0x23')](function(_0x241733){if(_0x241733&&_0x241733[_0xd5a9('0x56')]===0x0){return db[_0xd5a9('0x25')][_0xd5a9('0x4a')]({'name':_0x5a4791['name'],'resourceId':_0x5a4791['id'],'type':_0x241733[_0xd5a9('0x29')],'sectionId':_0x241733['id']},{})[_0xd5a9('0x23')](function(){return _0x19c58e;});}else{return _0x19c58e;}})[_0xd5a9('0x44')](function(_0x2ad9e1){logger[_0xd5a9('0x27')](_0xd5a9('0x57'),_0x2ad9e1);throw _0x2ad9e1;});}return _0x19c58e;})['then'](respondWithResult(_0x293b9f,0xc9))[_0xd5a9('0x44')](handleError(_0x293b9f,null));}; \ No newline at end of file +var _0x18ae=['where','filters','pick','filter','merge','options','include','catch','show','params','includeAll','find','body','destroy','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','save','update','then','get','CannedAnswers','UserProfileResource','error','stack','name','index','map','CannedAnswer','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0x18ae,0xcb));var _0xe18a=function(_0x2967c1,_0x202a72){_0x2967c1=_0x2967c1-0x0;var _0x103397=_0x18ae[_0x2967c1];return _0x103397;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe18a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe18a('0x1'));var rp=require('request-promise');var moment=require(_0xe18a('0x2'));var BPromise=require(_0xe18a('0x3'));var Mustache=require(_0xe18a('0x4'));var util=require('util');var path=require(_0xe18a('0x5'));var sox=require('sox');var csv=require(_0xe18a('0x6'));var ejs=require(_0xe18a('0x7'));var fs=require('fs');var fs_extra=require(_0xe18a('0x8'));var _=require(_0xe18a('0x9'));var squel=require(_0xe18a('0xa'));var crypto=require(_0xe18a('0xb'));var jsforce=require(_0xe18a('0xc'));var deskjs=require(_0xe18a('0xd'));var toCsv=require('to-csv');var querystring=require(_0xe18a('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe18a('0xf'));var qs=require(_0xe18a('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe18a('0x11'))('api');var utils=require(_0xe18a('0x12'));var config=require(_0xe18a('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xe18a('0x14'))['db'];function respondWithStatusCode(_0x547141,_0x3d83cb){_0x3d83cb=_0x3d83cb||0xcc;return function(_0x5d3168){if(_0x5d3168){return _0x547141[_0xe18a('0x15')](_0x3d83cb);}return _0x547141[_0xe18a('0x16')](_0x3d83cb)[_0xe18a('0x17')]();};}function respondWithResult(_0x203d69,_0x297559){_0x297559=_0x297559||0xc8;return function(_0x1f36be){if(_0x1f36be){return _0x203d69['status'](_0x297559)['json'](_0x1f36be);}};}function respondWithFilteredResult(_0x4da655,_0x50ddbd){return function(_0x1d6ceb){if(_0x1d6ceb){var _0x56d05c=typeof _0x50ddbd['offset']===_0xe18a('0x18')&&typeof _0x50ddbd[_0xe18a('0x19')]===_0xe18a('0x18');var _0x4e36cb=_0x1d6ceb[_0xe18a('0x1a')];var _0x2bb86a=_0x56d05c?0x0:_0x50ddbd['offset'];var _0x244efa=_0x56d05c?_0x1d6ceb['count']:_0x50ddbd[_0xe18a('0x1b')]+_0x50ddbd[_0xe18a('0x19')];var _0x5e3320;if(_0x244efa>=_0x4e36cb){_0x244efa=_0x4e36cb;_0x5e3320=0xc8;}else{_0x5e3320=0xce;}_0x4da655[_0xe18a('0x16')](_0x5e3320);return _0x4da655[_0xe18a('0x1c')](_0xe18a('0x1d'),_0x2bb86a+'-'+_0x244efa+'/'+_0x4e36cb)[_0xe18a('0x1e')](_0x1d6ceb);}return null;};}function patchUpdates(_0x51b957){return function(_0x16a1aa){try{jsonpatch['apply'](_0x16a1aa,_0x51b957,!![]);}catch(_0x2b1c70){return BPromise['reject'](_0x2b1c70);}return _0x16a1aa[_0xe18a('0x1f')]();};}function saveUpdates(_0x15691b,_0x2359f6){return function(_0x2f0484){if(_0x2f0484){return _0x2f0484[_0xe18a('0x20')](_0x15691b)[_0xe18a('0x21')](function(_0x21c3ac){return _0x21c3ac;});}return null;};}function removeEntity(_0x307bb0,_0x25f19d){return function(_0x10f296){if(_0x10f296){return _0x10f296['destroy']()[_0xe18a('0x21')](function(){var _0x35d8ae=_0x10f296[_0xe18a('0x22')]({'plain':!![]});var _0x110455=_0xe18a('0x23');return db[_0xe18a('0x24')]['destroy']({'where':{'type':_0x110455,'resourceId':_0x35d8ae['id']}})[_0xe18a('0x21')](function(){return _0x10f296;});})['then'](function(){_0x307bb0[_0xe18a('0x16')](0xcc)[_0xe18a('0x17')]();});}};}function handleEntityNotFound(_0x2cd881,_0x51dac6){return function(_0x4bf0fd){if(!_0x4bf0fd){_0x2cd881[_0xe18a('0x15')](0x194);}return _0x4bf0fd;};}function handleError(_0x2d5852,_0x8b3767){_0x8b3767=_0x8b3767||0x1f4;return function(_0x1f3d36){logger[_0xe18a('0x25')](_0x1f3d36[_0xe18a('0x26')]);if(_0x1f3d36['name']){delete _0x1f3d36[_0xe18a('0x27')];}_0x2d5852['status'](_0x8b3767)['send'](_0x1f3d36);};}exports[_0xe18a('0x28')]=function(_0x39c3be,_0x2b1170){var _0x4cd6c2={},_0x4881f7={},_0x3aa8d3={'count':0x0,'rows':[]};var _0x23cb0b=_[_0xe18a('0x29')](db[_0xe18a('0x2a')][_0xe18a('0x2b')],function(_0x2cb513){return{'name':_0x2cb513[_0xe18a('0x2c')],'type':_0x2cb513[_0xe18a('0x2d')][_0xe18a('0x2e')]};});_0x4881f7[_0xe18a('0x2f')]=_[_0xe18a('0x29')](_0x23cb0b,_0xe18a('0x27'));_0x4881f7['query']=_[_0xe18a('0x30')](_0x39c3be[_0xe18a('0x31')]);_0x4881f7['filters']=_[_0xe18a('0x32')](_0x4881f7[_0xe18a('0x2f')],_0x4881f7[_0xe18a('0x31')]);_0x4cd6c2[_0xe18a('0x33')]=_[_0xe18a('0x32')](_0x4881f7[_0xe18a('0x2f')],qs[_0xe18a('0x34')](_0x39c3be['query'][_0xe18a('0x34')]));_0x4cd6c2[_0xe18a('0x33')]=_0x4cd6c2[_0xe18a('0x33')][_0xe18a('0x35')]?_0x4cd6c2[_0xe18a('0x33')]:_0x4881f7['model'];if(!_0x39c3be[_0xe18a('0x31')][_0xe18a('0x36')](_0xe18a('0x37'))){_0x4cd6c2[_0xe18a('0x19')]=qs[_0xe18a('0x19')](_0x39c3be[_0xe18a('0x31')]['limit']);_0x4cd6c2['offset']=qs['offset'](_0x39c3be[_0xe18a('0x31')][_0xe18a('0x1b')]);}_0x4cd6c2[_0xe18a('0x38')]=qs[_0xe18a('0x39')](_0x39c3be['query'][_0xe18a('0x39')]);_0x4cd6c2[_0xe18a('0x3a')]=qs[_0xe18a('0x3b')](_[_0xe18a('0x3c')](_0x39c3be[_0xe18a('0x31')],_0x4881f7[_0xe18a('0x3b')]),_0x23cb0b);if(_0x39c3be[_0xe18a('0x31')][_0xe18a('0x3d')]){_0x4cd6c2[_0xe18a('0x3a')]=_[_0xe18a('0x3e')](_0x4cd6c2[_0xe18a('0x3a')],{'$or':[{'key':{'$like':'%'+_0x39c3be['query'][_0xe18a('0x3d')]+'%'}},{'value':{'$like':'%'+_0x39c3be[_0xe18a('0x31')][_0xe18a('0x3d')]+'%'}}]});}_0x4cd6c2=_[_0xe18a('0x3e')]({},_0x4cd6c2,_0x39c3be[_0xe18a('0x3f')]);var _0xaaa35f={'where':_0x4cd6c2[_0xe18a('0x3a')]};return db[_0xe18a('0x2a')][_0xe18a('0x1a')](_0xaaa35f)[_0xe18a('0x21')](function(_0x4ecd4d){_0x3aa8d3[_0xe18a('0x1a')]=_0x4ecd4d;if(_0x39c3be[_0xe18a('0x31')]['includeAll']){_0x4cd6c2[_0xe18a('0x40')]=[{'all':!![]}];}return db[_0xe18a('0x2a')]['findAll'](_0x4cd6c2);})[_0xe18a('0x21')](function(_0x556080){_0x3aa8d3['rows']=_0x556080;return _0x3aa8d3;})[_0xe18a('0x21')](respondWithFilteredResult(_0x2b1170,_0x4cd6c2))[_0xe18a('0x41')](handleError(_0x2b1170,null));};exports[_0xe18a('0x42')]=function(_0x3f17f8,_0x2d2c1f){var _0x2c1262={'raw':!![],'where':{'id':_0x3f17f8[_0xe18a('0x43')]['id']}},_0x348faa={};_0x348faa[_0xe18a('0x2f')]=_[_0xe18a('0x30')](db[_0xe18a('0x2a')][_0xe18a('0x2b')]);_0x348faa[_0xe18a('0x31')]=_[_0xe18a('0x30')](_0x3f17f8[_0xe18a('0x31')]);_0x348faa[_0xe18a('0x3b')]=_['intersection'](_0x348faa['model'],_0x348faa[_0xe18a('0x31')]);_0x2c1262[_0xe18a('0x33')]=_[_0xe18a('0x32')](_0x348faa[_0xe18a('0x2f')],qs['fields'](_0x3f17f8['query']['fields']));_0x2c1262[_0xe18a('0x33')]=_0x2c1262[_0xe18a('0x33')][_0xe18a('0x35')]?_0x2c1262[_0xe18a('0x33')]:_0x348faa[_0xe18a('0x2f')];if(_0x3f17f8[_0xe18a('0x31')][_0xe18a('0x44')]){_0x2c1262[_0xe18a('0x40')]=[{'all':!![]}];}_0x2c1262=_[_0xe18a('0x3e')]({},_0x2c1262,_0x3f17f8[_0xe18a('0x3f')]);return db[_0xe18a('0x2a')][_0xe18a('0x45')](_0x2c1262)[_0xe18a('0x21')](handleEntityNotFound(_0x2d2c1f,null))['then'](respondWithResult(_0x2d2c1f,null))[_0xe18a('0x41')](handleError(_0x2d2c1f,null));};exports[_0xe18a('0x20')]=function(_0x545082,_0x522cf8){if(_0x545082[_0xe18a('0x46')]['id']){delete _0x545082[_0xe18a('0x46')]['id'];}return db[_0xe18a('0x2a')]['find']({'where':{'id':_0x545082[_0xe18a('0x43')]['id']}})[_0xe18a('0x21')](handleEntityNotFound(_0x522cf8,null))[_0xe18a('0x21')](saveUpdates(_0x545082[_0xe18a('0x46')],null))['then'](respondWithResult(_0x522cf8,null))[_0xe18a('0x41')](handleError(_0x522cf8,null));};exports[_0xe18a('0x47')]=function(_0x1e45e0,_0x1764a4){return db[_0xe18a('0x2a')]['find']({'where':{'id':_0x1e45e0[_0xe18a('0x43')]['id']}})['then'](handleEntityNotFound(_0x1764a4,null))['then'](removeEntity(_0x1764a4,null))[_0xe18a('0x41')](handleError(_0x1764a4,null));};exports[_0xe18a('0x48')]=function(_0x34cc83,_0x20a851){var _0x3b886a={'key':_0x34cc83['body'][_0xe18a('0x2e')]};if(_0x34cc83[_0xe18a('0x46')]['MailAccountId']){_0x3b886a[_0xe18a('0x49')]=_0x34cc83[_0xe18a('0x46')]['MailAccountId'];}else if(_0x34cc83[_0xe18a('0x46')][_0xe18a('0x4a')]){_0x3b886a['SmsAccountId']=_0x34cc83['body']['SmsAccountId'];}else if(_0x34cc83[_0xe18a('0x46')][_0xe18a('0x4b')]){_0x3b886a[_0xe18a('0x4b')]=_0x34cc83['body']['OpenchannelAccountId'];}else if(_0x34cc83[_0xe18a('0x46')][_0xe18a('0x4c')]){_0x3b886a['ChatWebsiteId']=_0x34cc83[_0xe18a('0x46')][_0xe18a('0x4c')];}return db['CannedAnswer'][_0xe18a('0x45')]({'where':_0x3b886a})['then'](function(_0x1b786b){if(_0x1b786b){throw new db[(_0xe18a('0x4d'))][(_0xe18a('0x4e'))](_0xe18a('0x4f'));}return db[_0xe18a('0x2a')][_0xe18a('0x48')](_0x34cc83[_0xe18a('0x46')]);})[_0xe18a('0x21')](function(_0xd712f1){var _0x5353e3=_0x34cc83[_0xe18a('0x50')][_0xe18a('0x22')]({'plain':!![]});if(!_0x5353e3)throw new Error(_0xe18a('0x51'));if(_0x5353e3[_0xe18a('0x52')]==='user'){var _0x3395fe=_0xd712f1['get']({'plain':!![]});return db[_0xe18a('0x53')][_0xe18a('0x45')]({'where':{'name':'CannedAnswers','userProfileId':_0x5353e3[_0xe18a('0x54')]},'raw':!![]})[_0xe18a('0x21')](function(_0x37149c){if(_0x37149c&&_0x37149c[_0xe18a('0x55')]===0x0){return db[_0xe18a('0x24')][_0xe18a('0x48')]({'name':_0x3395fe[_0xe18a('0x27')],'resourceId':_0x3395fe['id'],'type':_0x37149c[_0xe18a('0x27')],'sectionId':_0x37149c['id']},{})[_0xe18a('0x21')](function(){return _0xd712f1;});}else{return _0xd712f1;}})[_0xe18a('0x41')](function(_0x2db4da){logger['error'](_0xe18a('0x56'),_0x2db4da);throw _0x2db4da;});}return _0xd712f1;})[_0xe18a('0x21')](respondWithResult(_0x20a851,0xc9))['catch'](handleError(_0x20a851,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 80a33f6..f8630df 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 _0x4991=['define','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird','rimraf','./cannedAnswer.attributes'];(function(_0x338990,_0x4755d9){var _0x14f156=function(_0xfb48d5){while(--_0xfb48d5){_0x338990['push'](_0x338990['shift']());}};_0x14f156(++_0x4755d9);}(_0x4991,0xa5));var _0x1499=function(_0x3cbd23,_0x1e2ebd){_0x3cbd23=_0x3cbd23-0x0;var _0xc1cd6f=_0x4991[_0x3cbd23];return _0xc1cd6f;};'use strict';var _=require('lodash');var util=require(_0x1499('0x0'));var logger=require(_0x1499('0x1'))('api');var moment=require(_0x1499('0x2'));var BPromise=require(_0x1499('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1499('0x4'));var config=require('../../config/environment');var attributes=require(_0x1499('0x5'));module['exports']=function(_0x30a41f,_0x25c6fc){return _0x30a41f[_0x1499('0x6')]('CannedAnswer',attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1499('0x7'),'collate':_0x1499('0x8')});}; \ No newline at end of file +var _0x1a2c=['utf8mb4_unicode_ci','util','api','request-promise','path','rimraf','../../config/environment','define','CannedAnswer','tools_canned_answers','utf8mb4'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0x1a2c,0xf3));var _0xc1a2=function(_0x2bc21b,_0x17ad9d){_0x2bc21b=_0x2bc21b-0x0;var _0x4f11d2=_0x1a2c[_0x2bc21b];return _0x4f11d2;};'use strict';var _=require('lodash');var util=require(_0xc1a2('0x0'));var logger=require('../../config/logger')(_0xc1a2('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc1a2('0x2'));var fs=require('fs');var path=require(_0xc1a2('0x3'));var rimraf=require(_0xc1a2('0x4'));var config=require(_0xc1a2('0x5'));var attributes=require('./cannedAnswer.attributes');module['exports']=function(_0x550efb,_0x22a15c){return _0x550efb[_0xc1a2('0x6')](_0xc1a2('0x7'),attributes,{'tableName':_0xc1a2('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc1a2('0x9'),'collate':_0xc1a2('0xa')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 65c13e2..69d044f 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(_0x497f51,_0x142fcd){var _0x3fb92d=function(_0x37888e){while(--_0x37888e){_0x497f51['push'](_0x497f51['shift']());}};_0x3fb92d(++_0x142fcd);}(_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(_0x1ecfeb,_0x506506){var _0x442830=function(_0x2aaf1b){while(--_0x2aaf1b){_0x1ecfeb['push'](_0x1ecfeb['shift']());}};_0x442830(++_0x506506);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'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 98cc9e1..47af3d8 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 _0xe563=['post','create','isAuthenticated','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','get','/:id','show'];(function(_0x5b757a,_0x4ee636){var _0x4ab9f4=function(_0x14142a){while(--_0x14142a){_0x5b757a['push'](_0x5b757a['shift']());}};_0x4ab9f4(++_0x4ee636);}(_0xe563,0x126));var _0x3e56=function(_0x153703,_0x387bd4){_0x153703=_0x153703-0x0;var _0x12722e=_0xe563[_0x153703];return _0x12722e;};'use strict';var multer=require(_0x3e56('0x0'));var util=require(_0x3e56('0x1'));var path=require(_0x3e56('0x2'));var timeout=require(_0x3e56('0x3'));var express=require(_0x3e56('0x4'));var router=express[_0x3e56('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x3e56('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./cannedAnswer.controller');router[_0x3e56('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x3e56('0x7')](_0x3e56('0x8'),auth['isAuthenticated'](),controller[_0x3e56('0x9')]);router[_0x3e56('0xa')]('/',auth['isAuthenticated'](),controller[_0x3e56('0xb')]);router['put']('/:id',auth[_0x3e56('0xc')](),controller[_0x3e56('0xd')]);router[_0x3e56('0xe')](_0x3e56('0x8'),auth[_0x3e56('0xc')](),controller['destroy']);module[_0x3e56('0xf')]=router; \ No newline at end of file +var _0x54fd=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','index','show','put','/:id','update'];(function(_0x411e81,_0xb23b26){var _0x4ddd52=function(_0x471ad9){while(--_0x471ad9){_0x411e81['push'](_0x411e81['shift']());}};_0x4ddd52(++_0xb23b26);}(_0x54fd,0x16a));var _0xd54f=function(_0x1f8ce6,_0x17e7b6){_0x1f8ce6=_0x1f8ce6-0x0;var _0x4dec6c=_0x54fd[_0x1f8ce6];return _0x4dec6c;};'use strict';var multer=require(_0xd54f('0x0'));var util=require(_0xd54f('0x1'));var path=require(_0xd54f('0x2'));var timeout=require(_0xd54f('0x3'));var express=require(_0xd54f('0x4'));var router=express[_0xd54f('0x5')]();var fs_extra=require(_0xd54f('0x6'));var auth=require(_0xd54f('0x7'));var interaction=require(_0xd54f('0x8'));var config=require(_0xd54f('0x9'));var controller=require(_0xd54f('0xa'));router[_0xd54f('0xb')]('/',auth[_0xd54f('0xc')](),controller[_0xd54f('0xd')]);router[_0xd54f('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xd54f('0xe')]);router['post']('/',auth[_0xd54f('0xc')](),controller['create']);router[_0xd54f('0xf')](_0xd54f('0x10'),auth[_0xd54f('0xc')](),controller[_0xd54f('0x11')]);router['delete'](_0xd54f('0x10'),auth[_0xd54f('0xc')](),controller[_0xd54f('0x12')]);module[_0xd54f('0x13')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 44874c9..7d8a197 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 _0xe827=['STRING','INTEGER','sequelize','exports','DATE'];(function(_0x652c38,_0x4ec2a3){var _0x31d2fd=function(_0x4fcab4){while(--_0x4fcab4){_0x652c38['push'](_0x652c38['shift']());}};_0x31d2fd(++_0x4ec2a3);}(_0xe827,0x1dd));var _0x7e82=function(_0x4abbd3,_0x7e10e7){_0x4abbd3=_0x4abbd3-0x0;var _0x4e6d5=_0xe827[_0x4abbd3];return _0x4e6d5;};'use strict';var Sequelize=require(_0x7e82('0x0'));module[_0x7e82('0x1')]={'calldate':{'type':Sequelize[_0x7e82('0x2')],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize[_0x7e82('0x3')]},'src':{'type':Sequelize[_0x7e82('0x3')]},'dst':{'type':Sequelize[_0x7e82('0x3')]},'dcontext':{'type':Sequelize[_0x7e82('0x3')]},'channel':{'type':Sequelize[_0x7e82('0x3')]},'dstchannel':{'type':Sequelize[_0x7e82('0x3')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0x7e82('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x7e82('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x7e82('0x3')]},'amaflags':{'type':Sequelize[_0x7e82('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x7e82('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0x7e82('0x3')]},'sequence':{'type':Sequelize[_0x7e82('0x3')]},'peeraccount':{'type':Sequelize[_0x7e82('0x3')]},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0x7e82('0x3')]}}; \ No newline at end of file +var _0xef8e=['exports','DATE','1970-01-01\x2000:00:01','STRING','INTEGER'];(function(_0x56fb7d,_0x539ea1){var _0x3be1c3=function(_0x521d3f){while(--_0x521d3f){_0x56fb7d['push'](_0x56fb7d['shift']());}};_0x3be1c3(++_0x539ea1);}(_0xef8e,0x8c));var _0xeef8=function(_0x1a6f52,_0x28f18f){_0x1a6f52=_0x1a6f52-0x0;var _0x48bde4=_0xef8e[_0x1a6f52];return _0x48bde4;};'use strict';var Sequelize=require('sequelize');module[_0xeef8('0x0')]={'calldate':{'type':Sequelize[_0xeef8('0x1')],'allowNull':![],'defaultValue':_0xeef8('0x2')},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize[_0xeef8('0x3')]},'dst':{'type':Sequelize[_0xeef8('0x3')]},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize[_0xeef8('0x3')]},'lastapp':{'type':Sequelize[_0xeef8('0x3')]},'lastdata':{'type':Sequelize[_0xeef8('0x3')]},'duration':{'type':Sequelize[_0xeef8('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xeef8('0x3')]},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xeef8('0x3')]},'userfield':{'type':Sequelize[_0xeef8('0x3')]},'uniqueid':{'type':Sequelize[_0xeef8('0x3')]},'linkedid':{'type':Sequelize[_0xeef8('0x3')]},'sequence':{'type':Sequelize[_0xeef8('0x3')]},'peeraccount':{'type':Sequelize[_0xeef8('0x3')]},'type':{'type':Sequelize[_0xeef8('0x3')]},'tag':{'type':Sequelize[_0xeef8('0x3')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index ec0c69c..f498d6d 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 _0x4b19=['model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','type','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','destroy','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','end','error','name','index','map','Cdr','fieldName','key'];(function(_0x59b243,_0x56c78f){var _0x2ea249=function(_0xf690a3){while(--_0xf690a3){_0x59b243['push'](_0x59b243['shift']());}};_0x2ea249(++_0x56c78f);}(_0x4b19,0x195));var _0x94b1=function(_0x4f3fae,_0x338661){_0x4f3fae=_0x4f3fae-0x0;var _0x2bb251=_0x4b19[_0x4f3fae];return _0x2bb251;};'use strict';var emlformat=require(_0x94b1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x94b1('0x1'));var jsonpatch=require(_0x94b1('0x2'));var rp=require(_0x94b1('0x3'));var moment=require('moment');var BPromise=require(_0x94b1('0x4'));var Mustache=require(_0x94b1('0x5'));var util=require(_0x94b1('0x6'));var path=require('path');var sox=require(_0x94b1('0x7'));var csv=require(_0x94b1('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x94b1('0x9'));var _=require(_0x94b1('0xa'));var squel=require('squel');var crypto=require(_0x94b1('0xb'));var jsforce=require(_0x94b1('0xc'));var deskjs=require(_0x94b1('0xd'));var toCsv=require('to-csv');var querystring=require(_0x94b1('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x94b1('0xf'));var qs=require(_0x94b1('0x10'));var as=require(_0x94b1('0x11'));var hardwareService=require(_0x94b1('0x12'));var logger=require(_0x94b1('0x13'))(_0x94b1('0x14'));var utils=require('../../config/utils');var config=require(_0x94b1('0x15'));var licenseUtil=require(_0x94b1('0x16'));var db=require(_0x94b1('0x17'))['db'];function respondWithStatusCode(_0x2b378c,_0x5cbf96){_0x5cbf96=_0x5cbf96||0xcc;return function(_0x4a4fe6){if(_0x4a4fe6){return _0x2b378c[_0x94b1('0x18')](_0x5cbf96);}return _0x2b378c[_0x94b1('0x19')](_0x5cbf96)['end']();};}function respondWithResult(_0x5059d8,_0x9329c9){_0x9329c9=_0x9329c9||0xc8;return function(_0xb9924c){if(_0xb9924c){return _0x5059d8['status'](_0x9329c9)[_0x94b1('0x1a')](_0xb9924c);}};}function respondWithFilteredResult(_0x58fab3,_0x4ea6a4){return function(_0x192c03){if(_0x192c03){var _0x1f0560=typeof _0x4ea6a4[_0x94b1('0x1b')]===_0x94b1('0x1c')&&typeof _0x4ea6a4['limit']===_0x94b1('0x1c');var _0x424c45=_0x192c03[_0x94b1('0x1d')];var _0x224099=_0x1f0560?0x0:_0x4ea6a4[_0x94b1('0x1b')];var _0x1abb7f=_0x1f0560?_0x192c03[_0x94b1('0x1d')]:_0x4ea6a4['offset']+_0x4ea6a4[_0x94b1('0x1e')];var _0x447b8f;if(_0x1abb7f>=_0x424c45){_0x1abb7f=_0x424c45;_0x447b8f=0xc8;}else{_0x447b8f=0xce;}_0x58fab3[_0x94b1('0x19')](_0x447b8f);return _0x58fab3['set'](_0x94b1('0x1f'),_0x224099+'-'+_0x1abb7f+'/'+_0x424c45)[_0x94b1('0x1a')](_0x192c03);}return null;};}function patchUpdates(_0x4c40c5){return function(_0x602c3b){try{jsonpatch[_0x94b1('0x20')](_0x602c3b,_0x4c40c5,!![]);}catch(_0x29af54){return BPromise[_0x94b1('0x21')](_0x29af54);}return _0x602c3b[_0x94b1('0x22')]();};}function saveUpdates(_0x38448d,_0x36180a){return function(_0xc8543){if(_0xc8543){return _0xc8543[_0x94b1('0x23')](_0x38448d)[_0x94b1('0x24')](function(_0x49c248){return _0x49c248;});}return null;};}function removeEntity(_0xa333a8,_0xa112b1){return function(_0x34c324){if(_0x34c324){return _0x34c324['destroy']()[_0x94b1('0x24')](function(){_0xa333a8['status'](0xcc)[_0x94b1('0x25')]();});}};}function handleEntityNotFound(_0x3d10ea,_0x14b8fe){return function(_0x109a81){if(!_0x109a81){_0x3d10ea['sendStatus'](0x194);}return _0x109a81;};}function handleError(_0x4ea6d9,_0x1d6ea6){_0x1d6ea6=_0x1d6ea6||0x1f4;return function(_0x4d5685){logger[_0x94b1('0x26')](_0x4d5685['stack']);if(_0x4d5685[_0x94b1('0x27')]){delete _0x4d5685[_0x94b1('0x27')];}_0x4ea6d9[_0x94b1('0x19')](_0x1d6ea6)['send'](_0x4d5685);};}exports[_0x94b1('0x28')]=function(_0x1d86bd,_0x467c42){var _0x319618={},_0xd86145={},_0x43b67c={'count':0x0,'rows':[]};var _0x2661ca=_[_0x94b1('0x29')](db[_0x94b1('0x2a')]['rawAttributes'],function(_0x2eb1fa){return{'name':_0x2eb1fa[_0x94b1('0x2b')],'type':_0x2eb1fa['type'][_0x94b1('0x2c')]};});_0xd86145[_0x94b1('0x2d')]=_[_0x94b1('0x29')](_0x2661ca,_0x94b1('0x27'));_0xd86145[_0x94b1('0x2e')]=_[_0x94b1('0x2f')](_0x1d86bd['query']);_0xd86145[_0x94b1('0x30')]=_['intersection'](_0xd86145[_0x94b1('0x2d')],_0xd86145['query']);_0x319618['attributes']=_[_0x94b1('0x31')](_0xd86145[_0x94b1('0x2d')],qs[_0x94b1('0x32')](_0x1d86bd[_0x94b1('0x2e')][_0x94b1('0x32')]));_0x319618[_0x94b1('0x33')]=_0x319618[_0x94b1('0x33')][_0x94b1('0x34')]?_0x319618[_0x94b1('0x33')]:_0xd86145[_0x94b1('0x2d')];if(!_0x1d86bd[_0x94b1('0x2e')][_0x94b1('0x35')]('nolimit')){_0x319618['limit']=qs[_0x94b1('0x1e')](_0x1d86bd[_0x94b1('0x2e')][_0x94b1('0x1e')]);_0x319618[_0x94b1('0x1b')]=qs[_0x94b1('0x1b')](_0x1d86bd[_0x94b1('0x2e')][_0x94b1('0x1b')]);}_0x319618[_0x94b1('0x36')]=qs[_0x94b1('0x37')](_0x1d86bd['query'][_0x94b1('0x37')]);_0x319618['where']=qs[_0x94b1('0x30')](_[_0x94b1('0x38')](_0x1d86bd[_0x94b1('0x2e')],_0xd86145['filters']),_0x2661ca);if(_0x1d86bd[_0x94b1('0x2e')][_0x94b1('0x39')]){_0x319618[_0x94b1('0x3a')]=_['merge'](_0x319618[_0x94b1('0x3a')],{'$or':_[_0x94b1('0x29')](_0x2661ca,function(_0x1d4168){if(_0x1d4168[_0x94b1('0x3b')]!==_0x94b1('0x3c')){var _0x2e6fb9={};_0x2e6fb9[_0x1d4168[_0x94b1('0x27')]]={'$like':'%'+_0x1d86bd[_0x94b1('0x2e')][_0x94b1('0x39')]+'%'};return _0x2e6fb9;}})});}_0x319618=_[_0x94b1('0x3d')]({},_0x319618,_0x1d86bd[_0x94b1('0x3e')]);var _0xfb5e55={'where':_0x319618[_0x94b1('0x3a')]};return db['Cdr'][_0x94b1('0x1d')](_0xfb5e55)[_0x94b1('0x24')](function(_0xf29a10){_0x43b67c[_0x94b1('0x1d')]=_0xf29a10;if(_0x1d86bd[_0x94b1('0x2e')]['includeAll']){_0x319618[_0x94b1('0x3f')]=[{'all':!![]}];}return db[_0x94b1('0x2a')][_0x94b1('0x40')](_0x319618);})[_0x94b1('0x24')](function(_0x3cf664){_0x43b67c[_0x94b1('0x41')]=_0x3cf664;return _0x43b67c;})['then'](respondWithFilteredResult(_0x467c42,_0x319618))[_0x94b1('0x42')](handleError(_0x467c42,null));};exports[_0x94b1('0x43')]=function(_0x592daa,_0x317932){var _0x19d4e4={'raw':!![],'where':{'id':_0x592daa[_0x94b1('0x44')]['id']}},_0x59311b={};_0x59311b[_0x94b1('0x2d')]=_[_0x94b1('0x2f')](db['Cdr'][_0x94b1('0x45')]);_0x59311b[_0x94b1('0x2e')]=_[_0x94b1('0x2f')](_0x592daa[_0x94b1('0x2e')]);_0x59311b[_0x94b1('0x30')]=_[_0x94b1('0x31')](_0x59311b[_0x94b1('0x2d')],_0x59311b['query']);_0x19d4e4[_0x94b1('0x33')]=_[_0x94b1('0x31')](_0x59311b[_0x94b1('0x2d')],qs['fields'](_0x592daa[_0x94b1('0x2e')][_0x94b1('0x32')]));_0x19d4e4['attributes']=_0x19d4e4[_0x94b1('0x33')][_0x94b1('0x34')]?_0x19d4e4[_0x94b1('0x33')]:_0x59311b[_0x94b1('0x2d')];if(_0x592daa[_0x94b1('0x2e')][_0x94b1('0x46')]){_0x19d4e4[_0x94b1('0x3f')]=[{'all':!![]}];}_0x19d4e4=_[_0x94b1('0x3d')]({},_0x19d4e4,_0x592daa[_0x94b1('0x3e')]);return db[_0x94b1('0x2a')][_0x94b1('0x47')](_0x19d4e4)[_0x94b1('0x24')](handleEntityNotFound(_0x317932,null))[_0x94b1('0x24')](respondWithResult(_0x317932,null))[_0x94b1('0x42')](handleError(_0x317932,null));};exports[_0x94b1('0x48')]=function(_0x1a2aab,_0xfe1c8f){return db[_0x94b1('0x2a')][_0x94b1('0x48')](_0x1a2aab['body'],{})[_0x94b1('0x24')](respondWithResult(_0xfe1c8f,0xc9))['catch'](handleError(_0xfe1c8f,null));};exports[_0x94b1('0x23')]=function(_0x3fc0fc,_0x1d8e57){if(_0x3fc0fc['body']['id']){delete _0x3fc0fc['body']['id'];}return db['Cdr'][_0x94b1('0x47')]({'where':{'id':_0x3fc0fc[_0x94b1('0x44')]['id']}})[_0x94b1('0x24')](handleEntityNotFound(_0x1d8e57,null))['then'](saveUpdates(_0x3fc0fc['body'],null))['then'](respondWithResult(_0x1d8e57,null))[_0x94b1('0x42')](handleError(_0x1d8e57,null));};exports[_0x94b1('0x49')]=function(_0xbfd51b,_0x2a0f4c){return db[_0x94b1('0x2a')][_0x94b1('0x47')]({'where':{'id':_0xbfd51b[_0x94b1('0x44')]['id']}})['then'](handleEntityNotFound(_0x2a0f4c,null))[_0x94b1('0x24')](removeEntity(_0x2a0f4c,null))[_0x94b1('0x42')](handleError(_0x2a0f4c,null));};exports[_0x94b1('0x4a')]=function(_0x1d9648,_0x344ebe){return db[_0x94b1('0x2a')][_0x94b1('0x4a')]()[_0x94b1('0x24')](respondWithResult(_0x344ebe,null))[_0x94b1('0x42')](handleError(_0x344ebe,null));}; \ No newline at end of file +var _0x9b67=['where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','error','name','send','map','Cdr','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','order','sort'];(function(_0x3df870,_0x32e29f){var _0x53e934=function(_0x5a636d){while(--_0x5a636d){_0x3df870['push'](_0x3df870['shift']());}};_0x53e934(++_0x32e29f);}(_0x9b67,0xf6));var _0x79b6=function(_0x5c3980,_0xdf3452){_0x5c3980=_0x5c3980-0x0;var _0x49c45c=_0x9b67[_0x5c3980];return _0x49c45c;};'use strict';var emlformat=require(_0x79b6('0x0'));var rimraf=require(_0x79b6('0x1'));var zipdir=require(_0x79b6('0x2'));var jsonpatch=require(_0x79b6('0x3'));var rp=require(_0x79b6('0x4'));var moment=require('moment');var BPromise=require(_0x79b6('0x5'));var Mustache=require(_0x79b6('0x6'));var util=require('util');var path=require('path');var sox=require(_0x79b6('0x7'));var csv=require(_0x79b6('0x8'));var ejs=require(_0x79b6('0x9'));var fs=require('fs');var fs_extra=require(_0x79b6('0xa'));var _=require(_0x79b6('0xb'));var squel=require(_0x79b6('0xc'));var crypto=require(_0x79b6('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x79b6('0xe'));var toCsv=require(_0x79b6('0x8'));var querystring=require(_0x79b6('0xf'));var Papa=require(_0x79b6('0x10'));var Redis=require(_0x79b6('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x79b6('0x12'));var as=require(_0x79b6('0x13'));var hardwareService=require(_0x79b6('0x14'));var logger=require(_0x79b6('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x79b6('0x16'));var licenseUtil=require(_0x79b6('0x17'));var db=require(_0x79b6('0x18'))['db'];function respondWithStatusCode(_0x526727,_0xc05a77){_0xc05a77=_0xc05a77||0xcc;return function(_0x2df08d){if(_0x2df08d){return _0x526727[_0x79b6('0x19')](_0xc05a77);}return _0x526727[_0x79b6('0x1a')](_0xc05a77)[_0x79b6('0x1b')]();};}function respondWithResult(_0x40478d,_0x19d5b2){_0x19d5b2=_0x19d5b2||0xc8;return function(_0x3ef1fa){if(_0x3ef1fa){return _0x40478d[_0x79b6('0x1a')](_0x19d5b2)[_0x79b6('0x1c')](_0x3ef1fa);}};}function respondWithFilteredResult(_0x2ac966,_0x3563cc){return function(_0x1e8bf1){if(_0x1e8bf1){var _0x4cf491=typeof _0x3563cc[_0x79b6('0x1d')]===_0x79b6('0x1e')&&typeof _0x3563cc[_0x79b6('0x1f')]===_0x79b6('0x1e');var _0x2a8788=_0x1e8bf1[_0x79b6('0x20')];var _0x131bc5=_0x4cf491?0x0:_0x3563cc[_0x79b6('0x1d')];var _0x3ff583=_0x4cf491?_0x1e8bf1[_0x79b6('0x20')]:_0x3563cc[_0x79b6('0x1d')]+_0x3563cc[_0x79b6('0x1f')];var _0x1361f6;if(_0x3ff583>=_0x2a8788){_0x3ff583=_0x2a8788;_0x1361f6=0xc8;}else{_0x1361f6=0xce;}_0x2ac966['status'](_0x1361f6);return _0x2ac966[_0x79b6('0x21')]('Content-Range',_0x131bc5+'-'+_0x3ff583+'/'+_0x2a8788)[_0x79b6('0x1c')](_0x1e8bf1);}return null;};}function patchUpdates(_0x532e65){return function(_0x28b9c2){try{jsonpatch[_0x79b6('0x22')](_0x28b9c2,_0x532e65,!![]);}catch(_0x299bed){return BPromise['reject'](_0x299bed);}return _0x28b9c2[_0x79b6('0x23')]();};}function saveUpdates(_0x30dc0b,_0x53208a){return function(_0x565f86){if(_0x565f86){return _0x565f86[_0x79b6('0x24')](_0x30dc0b)[_0x79b6('0x25')](function(_0x9bd2cc){return _0x9bd2cc;});}return null;};}function removeEntity(_0x268826,_0x3b2a2a){return function(_0x488102){if(_0x488102){return _0x488102[_0x79b6('0x26')]()[_0x79b6('0x25')](function(){_0x268826[_0x79b6('0x1a')](0xcc)[_0x79b6('0x1b')]();});}};}function handleEntityNotFound(_0x4c275d,_0x53c03c){return function(_0x40ef76){if(!_0x40ef76){_0x4c275d[_0x79b6('0x19')](0x194);}return _0x40ef76;};}function handleError(_0x37b01b,_0xc25c99){_0xc25c99=_0xc25c99||0x1f4;return function(_0x4adf15){logger[_0x79b6('0x27')](_0x4adf15['stack']);if(_0x4adf15[_0x79b6('0x28')]){delete _0x4adf15[_0x79b6('0x28')];}_0x37b01b[_0x79b6('0x1a')](_0xc25c99)[_0x79b6('0x29')](_0x4adf15);};}exports['index']=function(_0x1484e5,_0x310832){var _0x53b463={},_0x158221={},_0x2d219c={'count':0x0,'rows':[]};var _0x1b1f2b=_[_0x79b6('0x2a')](db[_0x79b6('0x2b')][_0x79b6('0x2c')],function(_0x53b2f5){return{'name':_0x53b2f5[_0x79b6('0x2d')],'type':_0x53b2f5[_0x79b6('0x2e')][_0x79b6('0x2f')]};});_0x158221[_0x79b6('0x30')]=_[_0x79b6('0x2a')](_0x1b1f2b,_0x79b6('0x28'));_0x158221['query']=_[_0x79b6('0x31')](_0x1484e5[_0x79b6('0x32')]);_0x158221[_0x79b6('0x33')]=_['intersection'](_0x158221['model'],_0x158221[_0x79b6('0x32')]);_0x53b463[_0x79b6('0x34')]=_[_0x79b6('0x35')](_0x158221[_0x79b6('0x30')],qs[_0x79b6('0x36')](_0x1484e5[_0x79b6('0x32')]['fields']));_0x53b463['attributes']=_0x53b463[_0x79b6('0x34')]['length']?_0x53b463[_0x79b6('0x34')]:_0x158221['model'];if(!_0x1484e5[_0x79b6('0x32')][_0x79b6('0x37')]('nolimit')){_0x53b463[_0x79b6('0x1f')]=qs[_0x79b6('0x1f')](_0x1484e5['query'][_0x79b6('0x1f')]);_0x53b463['offset']=qs[_0x79b6('0x1d')](_0x1484e5[_0x79b6('0x32')][_0x79b6('0x1d')]);}_0x53b463[_0x79b6('0x38')]=qs[_0x79b6('0x39')](_0x1484e5[_0x79b6('0x32')][_0x79b6('0x39')]);_0x53b463[_0x79b6('0x3a')]=qs[_0x79b6('0x33')](_[_0x79b6('0x3b')](_0x1484e5['query'],_0x158221['filters']),_0x1b1f2b);if(_0x1484e5['query'][_0x79b6('0x3c')]){_0x53b463[_0x79b6('0x3a')]=_['merge'](_0x53b463[_0x79b6('0x3a')],{'$or':_['map'](_0x1b1f2b,function(_0x179a98){if(_0x179a98[_0x79b6('0x2e')]!==_0x79b6('0x3d')){var _0x53db1d={};_0x53db1d[_0x179a98[_0x79b6('0x28')]]={'$like':'%'+_0x1484e5['query'][_0x79b6('0x3c')]+'%'};return _0x53db1d;}})});}_0x53b463=_[_0x79b6('0x3e')]({},_0x53b463,_0x1484e5[_0x79b6('0x3f')]);var _0x2feeeb={'where':_0x53b463[_0x79b6('0x3a')]};return db['Cdr']['count'](_0x2feeeb)[_0x79b6('0x25')](function(_0x48ae49){_0x2d219c[_0x79b6('0x20')]=_0x48ae49;if(_0x1484e5[_0x79b6('0x32')][_0x79b6('0x40')]){_0x53b463[_0x79b6('0x41')]=[{'all':!![]}];}return db[_0x79b6('0x2b')][_0x79b6('0x42')](_0x53b463);})[_0x79b6('0x25')](function(_0x4a7f90){_0x2d219c[_0x79b6('0x43')]=_0x4a7f90;return _0x2d219c;})[_0x79b6('0x25')](respondWithFilteredResult(_0x310832,_0x53b463))[_0x79b6('0x44')](handleError(_0x310832,null));};exports[_0x79b6('0x45')]=function(_0x568f6b,_0x12ea22){var _0x4f803c={'raw':!![],'where':{'id':_0x568f6b[_0x79b6('0x46')]['id']}},_0x4ba212={};_0x4ba212[_0x79b6('0x30')]=_[_0x79b6('0x31')](db[_0x79b6('0x2b')][_0x79b6('0x2c')]);_0x4ba212[_0x79b6('0x32')]=_[_0x79b6('0x31')](_0x568f6b[_0x79b6('0x32')]);_0x4ba212['filters']=_[_0x79b6('0x35')](_0x4ba212['model'],_0x4ba212['query']);_0x4f803c[_0x79b6('0x34')]=_[_0x79b6('0x35')](_0x4ba212[_0x79b6('0x30')],qs[_0x79b6('0x36')](_0x568f6b[_0x79b6('0x32')][_0x79b6('0x36')]));_0x4f803c[_0x79b6('0x34')]=_0x4f803c[_0x79b6('0x34')][_0x79b6('0x47')]?_0x4f803c['attributes']:_0x4ba212[_0x79b6('0x30')];if(_0x568f6b[_0x79b6('0x32')][_0x79b6('0x40')]){_0x4f803c[_0x79b6('0x41')]=[{'all':!![]}];}_0x4f803c=_[_0x79b6('0x3e')]({},_0x4f803c,_0x568f6b['options']);return db[_0x79b6('0x2b')][_0x79b6('0x48')](_0x4f803c)['then'](handleEntityNotFound(_0x12ea22,null))['then'](respondWithResult(_0x12ea22,null))[_0x79b6('0x44')](handleError(_0x12ea22,null));};exports[_0x79b6('0x49')]=function(_0x247c79,_0xa0c396){return db[_0x79b6('0x2b')][_0x79b6('0x49')](_0x247c79[_0x79b6('0x4a')],{})[_0x79b6('0x25')](respondWithResult(_0xa0c396,0xc9))[_0x79b6('0x44')](handleError(_0xa0c396,null));};exports[_0x79b6('0x24')]=function(_0x15c795,_0x39972b){if(_0x15c795[_0x79b6('0x4a')]['id']){delete _0x15c795[_0x79b6('0x4a')]['id'];}return db[_0x79b6('0x2b')][_0x79b6('0x48')]({'where':{'id':_0x15c795[_0x79b6('0x46')]['id']}})[_0x79b6('0x25')](handleEntityNotFound(_0x39972b,null))[_0x79b6('0x25')](saveUpdates(_0x15c795['body'],null))['then'](respondWithResult(_0x39972b,null))['catch'](handleError(_0x39972b,null));};exports['destroy']=function(_0x56deb2,_0x412c1e){return db[_0x79b6('0x2b')][_0x79b6('0x48')]({'where':{'id':_0x56deb2[_0x79b6('0x46')]['id']}})[_0x79b6('0x25')](handleEntityNotFound(_0x412c1e,null))[_0x79b6('0x25')](removeEntity(_0x412c1e,null))['catch'](handleError(_0x412c1e,null));};exports[_0x79b6('0x4b')]=function(_0xa2ba0e,_0x58232b){return db[_0x79b6('0x2b')]['describe']()[_0x79b6('0x25')](respondWithResult(_0x58232b,null))['catch'](handleError(_0x58232b,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index fdb4b05..7f1e32f 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(_0x5e225b,_0x268aa9){var _0x139652=function(_0x1c20b3){while(--_0x1c20b3){_0x5e225b['push'](_0x5e225b['shift']());}};_0x139652(++_0x268aa9);}(_0x7a54,0x106));var _0x47a5=function(_0x5ddd02,_0x12b9b6){_0x5ddd02=_0x5ddd02-0x0;var _0x50ec8e=_0x7a54[_0x5ddd02];return _0x50ec8e;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file +var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x1e403a,_0x47abde){var _0x583989=function(_0x4fdd54){while(--_0x4fdd54){_0x1e403a['push'](_0x1e403a['shift']());}};_0x583989(++_0x47abde);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index eff6f0f..1833f93 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 _0x89ca=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x386be9,_0x8a3198){var _0x3d6ad3=function(_0x3b2ca8){while(--_0x3b2ca8){_0x386be9['push'](_0x386be9['shift']());}};_0x3d6ad3(++_0x8a3198);}(_0x89ca,0x90));var _0xa89c=function(_0x752136,_0x24cb0e){_0x752136=_0x752136-0x0;var _0x4e04c1=_0x89ca[_0x752136];return _0x4e04c1;};'use strict';var _=require(_0xa89c('0x0'));var util=require(_0xa89c('0x1'));var moment=require(_0xa89c('0x2'));var BPromise=require(_0xa89c('0x3'));var rs=require(_0xa89c('0x4'));var fs=require('fs');var Redis=require(_0xa89c('0x5'));var db=require(_0xa89c('0x6'))['db'];var utils=require(_0xa89c('0x7'));var logger=require(_0xa89c('0x8'))(_0xa89c('0x9'));var config=require(_0xa89c('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xa89c('0xb')][_0xa89c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xf9f728,_0xf23222,_0x4cfd51){return new BPromise(function(_0x2a5a25,_0x5984d5){return client[_0xa89c('0xd')](_0xf9f728,_0x4cfd51)[_0xa89c('0xe')](function(_0x4d7c10){logger[_0xa89c('0xf')](_0xa89c('0x10'),_0xf23222,_0xa89c('0x11'));logger[_0xa89c('0x12')](_0xa89c('0x13'),_0xf23222,_0xa89c('0x11'),JSON[_0xa89c('0x14')](_0x4d7c10));if(_0x4d7c10[_0xa89c('0x15')]){if(_0x4d7c10[_0xa89c('0x15')][_0xa89c('0x16')]===0x1f4){logger[_0xa89c('0x15')](_0xa89c('0x10'),_0xf23222,_0x4d7c10[_0xa89c('0x15')]['message']);return _0x5984d5(_0x4d7c10[_0xa89c('0x15')][_0xa89c('0x17')]);}logger[_0xa89c('0x15')](_0xa89c('0x10'),_0xf23222,_0x4d7c10[_0xa89c('0x15')][_0xa89c('0x17')]);return _0x2a5a25(_0x4d7c10[_0xa89c('0x15')][_0xa89c('0x17')]);}else{logger[_0xa89c('0xf')](_0xa89c('0x10'),_0xf23222,_0xa89c('0x11'));_0x2a5a25(_0x4d7c10[_0xa89c('0x18')][_0xa89c('0x17')]);}})['catch'](function(_0x5ebdf2){logger[_0xa89c('0x15')](_0xa89c('0x10'),_0xf23222,_0x5ebdf2);_0x5984d5(_0x5ebdf2);});});} \ No newline at end of file +var _0x562c=['Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x846f06,_0x4b9509){var _0x20a953=function(_0x419d22){while(--_0x419d22){_0x846f06['push'](_0x846f06['shift']());}};_0x20a953(++_0x4b9509);}(_0x562c,0x179));var _0xc562=function(_0x1c74b8,_0x239b6a){_0x1c74b8=_0x1c74b8-0x0;var _0x58d3f2=_0x562c[_0x1c74b8];return _0x58d3f2;};'use strict';var _=require(_0xc562('0x0'));var util=require('util');var moment=require(_0xc562('0x1'));var BPromise=require(_0xc562('0x2'));var rs=require(_0xc562('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc562('0x4'))['db'];var utils=require(_0xc562('0x5'));var logger=require('../../config/logger')(_0xc562('0x6'));var config=require(_0xc562('0x7'));var jayson=require(_0xc562('0x8'));var client=jayson[_0xc562('0x9')][_0xc562('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x44b159,_0x42673a,_0x2a84d2){return new BPromise(function(_0x1edf54,_0x5a7514){return client[_0xc562('0xb')](_0x44b159,_0x2a84d2)[_0xc562('0xc')](function(_0x34efb2){logger[_0xc562('0xd')](_0xc562('0xe'),_0x42673a,_0xc562('0xf'));logger[_0xc562('0x10')](_0xc562('0x11'),_0x42673a,_0xc562('0xf'),JSON[_0xc562('0x12')](_0x34efb2));if(_0x34efb2[_0xc562('0x13')]){if(_0x34efb2[_0xc562('0x13')][_0xc562('0x14')]===0x1f4){logger[_0xc562('0x13')](_0xc562('0xe'),_0x42673a,_0x34efb2['error'][_0xc562('0x15')]);return _0x5a7514(_0x34efb2[_0xc562('0x13')][_0xc562('0x15')]);}logger[_0xc562('0x13')](_0xc562('0xe'),_0x42673a,_0x34efb2[_0xc562('0x13')][_0xc562('0x15')]);return _0x1edf54(_0x34efb2[_0xc562('0x13')][_0xc562('0x15')]);}else{logger[_0xc562('0xd')]('Cdr,\x20%s,\x20%s',_0x42673a,_0xc562('0xf'));_0x1edf54(_0x34efb2[_0xc562('0x16')][_0xc562('0x15')]);}})['catch'](function(_0xcd1c18){logger[_0xc562('0x13')](_0xc562('0xe'),_0x42673a,_0xcd1c18);_0x5a7514(_0xcd1c18);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 8fd7c10..3cc174f 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 _0xb10b=['../../components/interaction/service','../../config/environment','./cdr.controller','get','index','isAuthenticated','describe','/:id','show','post','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x150c78,_0x2a95a3){var _0x92575b=function(_0x2d676f){while(--_0x2d676f){_0x150c78['push'](_0x150c78['shift']());}};_0x92575b(++_0x2a95a3);}(_0xb10b,0x12a));var _0xbb10=function(_0x1c2fd7,_0x595cf1){_0x1c2fd7=_0x1c2fd7-0x0;var _0x369e9d=_0xb10b[_0x1c2fd7];return _0x369e9d;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/describe',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')]('/',auth[_0xbb10('0xb')](),controller['create']);router['put'](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x10')]);router['delete'](_0xbb10('0xd'),auth['isAuthenticated'](),controller[_0xbb10('0x11')]);module[_0xbb10('0x12')]=router; \ No newline at end of file +var _0xb10b=['../../components/interaction/service','../../config/environment','./cdr.controller','get','index','isAuthenticated','describe','/:id','show','post','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0xc9619c,_0x448ed3){var _0x3058aa=function(_0x3dced2){while(--_0x3dced2){_0xc9619c['push'](_0xc9619c['shift']());}};_0x3058aa(++_0x448ed3);}(_0xb10b,0x12a));var _0xbb10=function(_0x2d0b84,_0x34682d){_0x2d0b84=_0x2d0b84-0x0;var _0x8d0088=_0xb10b[_0x2d0b84];return _0x8d0088;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/describe',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')]('/',auth[_0xbb10('0xb')](),controller['create']);router['put'](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x10')]);router['delete'](_0xbb10('0xd'),auth['isAuthenticated'](),controller[_0xbb10('0x11')]);module[_0xbb10('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index dc87124..cc26627 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 _0xa279=['noop','STRING','sequelize','exports','INTEGER'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xa279,0x7f));var _0x9a27=function(_0x56d9f3,_0x5995de){_0x56d9f3=_0x56d9f3-0x0;var _0x49ecce=_0xa279[_0x56d9f3];return _0x49ecce;};'use strict';var Sequelize=require(_0x9a27('0x0'));module[_0x9a27('0x1')]={'priority':{'type':Sequelize[_0x9a27('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x9a27('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x9a27('0x4')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x2c24=['STRING','noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0x1fc122,_0x5e2c17){var _0xa2cb13=function(_0x263b13){while(--_0x263b13){_0x1fc122['push'](_0x1fc122['shift']());}};_0xa2cb13(++_0x5e2c17);}(_0x2c24,0x190));var _0x42c2=function(_0x1fb429,_0xfff02){_0x1fb429=_0x1fb429-0x0;var _0x23494f=_0x2c24[_0x1fb429];return _0x23494f;};'use strict';var Sequelize=require(_0x42c2('0x0'));module[_0x42c2('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x42c2('0x2')],'allowNull':![],'defaultValue':_0x42c2('0x3')},'appdata':{'type':Sequelize[_0x42c2('0x4')]()},'description':{'type':Sequelize[_0x42c2('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x42c2('0x5')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 0a2b8cf..8c58393 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 _0xbf1a=['fields','merge','options','ChatApplication','find','then','catch','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','json','reject','save','update','error','stack','name','show','params','model','keys','rawAttributes','query','attributes','intersection'];(function(_0x54818c,_0x4077bb){var _0x2d0e3d=function(_0x7516a9){while(--_0x7516a9){_0x54818c['push'](_0x54818c['shift']());}};_0x2d0e3d(++_0x4077bb);}(_0xbf1a,0x7c));var _0xabf1=function(_0x5364a1,_0x2d99f7){_0x5364a1=_0x5364a1-0x0;var _0x353c71=_0xbf1a[_0x5364a1];return _0x353c71;};'use strict';var emlformat=require(_0xabf1('0x0'));var rimraf=require(_0xabf1('0x1'));var zipdir=require(_0xabf1('0x2'));var jsonpatch=require(_0xabf1('0x3'));var rp=require(_0xabf1('0x4'));var moment=require('moment');var BPromise=require(_0xabf1('0x5'));var Mustache=require('mustache');var util=require(_0xabf1('0x6'));var path=require(_0xabf1('0x7'));var sox=require(_0xabf1('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xabf1('0x9'));var _=require('lodash');var squel=require(_0xabf1('0xa'));var crypto=require(_0xabf1('0xb'));var jsforce=require(_0xabf1('0xc'));var deskjs=require(_0xabf1('0xd'));var toCsv=require(_0xabf1('0xe'));var querystring=require(_0xabf1('0xf'));var Papa=require('papaparse');var Redis=require(_0xabf1('0x10'));var authService=require(_0xabf1('0x11'));var qs=require(_0xabf1('0x12'));var as=require(_0xabf1('0x13'));var hardwareService=require(_0xabf1('0x14'));var logger=require(_0xabf1('0x15'))('api');var utils=require(_0xabf1('0x16'));var config=require(_0xabf1('0x17'));var licenseUtil=require(_0xabf1('0x18'));var db=require(_0xabf1('0x19'))['db'];function respondWithStatusCode(_0x3e1738,_0x1186b7){_0x1186b7=_0x1186b7||0xcc;return function(_0x27ade4){if(_0x27ade4){return _0x3e1738[_0xabf1('0x1a')](_0x1186b7);}return _0x3e1738[_0xabf1('0x1b')](_0x1186b7)[_0xabf1('0x1c')]();};}function respondWithResult(_0x4cb7f7,_0x783976){_0x783976=_0x783976||0xc8;return function(_0xcbe7da){if(_0xcbe7da){return _0x4cb7f7[_0xabf1('0x1b')](_0x783976)['json'](_0xcbe7da);}};}function respondWithFilteredResult(_0x293110,_0x3dd81a){return function(_0x719d3e){if(_0x719d3e){var _0x3537e4=typeof _0x3dd81a['offset']===_0xabf1('0x1d')&&typeof _0x3dd81a['limit']===_0xabf1('0x1d');var _0x23093b=_0x719d3e[_0xabf1('0x1e')];var _0x363c21=_0x3537e4?0x0:_0x3dd81a[_0xabf1('0x1f')];var _0xd5dc16=_0x3537e4?_0x719d3e[_0xabf1('0x1e')]:_0x3dd81a[_0xabf1('0x1f')]+_0x3dd81a[_0xabf1('0x20')];var _0x18f315;if(_0xd5dc16>=_0x23093b){_0xd5dc16=_0x23093b;_0x18f315=0xc8;}else{_0x18f315=0xce;}_0x293110[_0xabf1('0x1b')](_0x18f315);return _0x293110[_0xabf1('0x21')](_0xabf1('0x22'),_0x363c21+'-'+_0xd5dc16+'/'+_0x23093b)[_0xabf1('0x23')](_0x719d3e);}return null;};}function patchUpdates(_0x367d7e){return function(_0x5a0413){try{jsonpatch['apply'](_0x5a0413,_0x367d7e,!![]);}catch(_0xa715e7){return BPromise[_0xabf1('0x24')](_0xa715e7);}return _0x5a0413[_0xabf1('0x25')]();};}function saveUpdates(_0x53e531,_0x216862){return function(_0x3fbce0){if(_0x3fbce0){return _0x3fbce0[_0xabf1('0x26')](_0x53e531)['then'](function(_0xb16c27){return _0xb16c27;});}return null;};}function removeEntity(_0x57fea6,_0x30fac8){return function(_0x551401){if(_0x551401){return _0x551401['destroy']()['then'](function(){_0x57fea6[_0xabf1('0x1b')](0xcc)[_0xabf1('0x1c')]();});}};}function handleEntityNotFound(_0x4939cd,_0x14c6f0){return function(_0x69ddb8){if(!_0x69ddb8){_0x4939cd['sendStatus'](0x194);}return _0x69ddb8;};}function handleError(_0x507a76,_0x25d432){_0x25d432=_0x25d432||0x1f4;return function(_0x175678){logger[_0xabf1('0x27')](_0x175678[_0xabf1('0x28')]);if(_0x175678[_0xabf1('0x29')]){delete _0x175678['name'];}_0x507a76[_0xabf1('0x1b')](_0x25d432)['send'](_0x175678);};}exports[_0xabf1('0x2a')]=function(_0x5ddf0d,_0xb54b63){var _0x582fbf={'raw':!![],'where':{'id':_0x5ddf0d[_0xabf1('0x2b')]['id']}},_0x45e64f={};_0x45e64f[_0xabf1('0x2c')]=_[_0xabf1('0x2d')](db['ChatApplication'][_0xabf1('0x2e')]);_0x45e64f[_0xabf1('0x2f')]=_['keys'](_0x5ddf0d[_0xabf1('0x2f')]);_0x45e64f['filters']=_['intersection'](_0x45e64f['model'],_0x45e64f[_0xabf1('0x2f')]);_0x582fbf[_0xabf1('0x30')]=_[_0xabf1('0x31')](_0x45e64f[_0xabf1('0x2c')],qs['fields'](_0x5ddf0d[_0xabf1('0x2f')][_0xabf1('0x32')]));_0x582fbf[_0xabf1('0x30')]=_0x582fbf[_0xabf1('0x30')]['length']?_0x582fbf[_0xabf1('0x30')]:_0x45e64f['model'];if(_0x5ddf0d[_0xabf1('0x2f')]['includeAll']){_0x582fbf['include']=[{'all':!![]}];}_0x582fbf=_[_0xabf1('0x33')]({},_0x582fbf,_0x5ddf0d[_0xabf1('0x34')]);return db[_0xabf1('0x35')][_0xabf1('0x36')](_0x582fbf)[_0xabf1('0x37')](handleEntityNotFound(_0xb54b63,null))[_0xabf1('0x37')](respondWithResult(_0xb54b63,null))[_0xabf1('0x38')](handleError(_0xb54b63,null));};exports[_0xabf1('0x26')]=function(_0x58f5b7,_0x1acc54){if(_0x58f5b7[_0xabf1('0x39')]['id']){delete _0x58f5b7['body']['id'];}return db['ChatApplication']['find']({'where':{'id':_0x58f5b7[_0xabf1('0x2b')]['id']}})['then'](handleEntityNotFound(_0x1acc54,null))[_0xabf1('0x37')](saveUpdates(_0x58f5b7[_0xabf1('0x39')],null))[_0xabf1('0x37')](respondWithResult(_0x1acc54,null))[_0xabf1('0x38')](handleError(_0x1acc54,null));};exports['destroy']=function(_0xd23acf,_0x49bb46){return db[_0xabf1('0x35')][_0xabf1('0x36')]({'where':{'id':_0xd23acf[_0xabf1('0x2b')]['id']}})[_0xabf1('0x37')](handleEntityNotFound(_0x49bb46,null))['then'](removeEntity(_0x49bb46,null))[_0xabf1('0x38')](handleError(_0x49bb46,null));}; \ No newline at end of file +var _0xe600=['sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','show','params','keys','rawAttributes','query','filters','intersection','model','attributes','fields','length','includeAll','merge','options','ChatApplication','find','catch','body','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','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'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0xe600,0x159));var _0x0e60=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe600[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0e60('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0e60('0x1'));var rp=require(_0x0e60('0x2'));var moment=require(_0x0e60('0x3'));var BPromise=require(_0x0e60('0x4'));var Mustache=require(_0x0e60('0x5'));var util=require(_0x0e60('0x6'));var path=require(_0x0e60('0x7'));var sox=require(_0x0e60('0x8'));var csv=require(_0x0e60('0x9'));var ejs=require(_0x0e60('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0e60('0xb'));var squel=require(_0x0e60('0xc'));var crypto=require(_0x0e60('0xd'));var jsforce=require(_0x0e60('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x0e60('0x9'));var querystring=require(_0x0e60('0xf'));var Papa=require(_0x0e60('0x10'));var Redis=require(_0x0e60('0x11'));var authService=require(_0x0e60('0x12'));var qs=require(_0x0e60('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0e60('0x14'));var logger=require(_0x0e60('0x15'))(_0x0e60('0x16'));var utils=require(_0x0e60('0x17'));var config=require(_0x0e60('0x18'));var licenseUtil=require(_0x0e60('0x19'));var db=require(_0x0e60('0x1a'))['db'];function respondWithStatusCode(_0x2f5ee4,_0x540411){_0x540411=_0x540411||0xcc;return function(_0x2d848f){if(_0x2d848f){return _0x2f5ee4[_0x0e60('0x1b')](_0x540411);}return _0x2f5ee4[_0x0e60('0x1c')](_0x540411)[_0x0e60('0x1d')]();};}function respondWithResult(_0x45328b,_0x37bf95){_0x37bf95=_0x37bf95||0xc8;return function(_0x5d7f84){if(_0x5d7f84){return _0x45328b[_0x0e60('0x1c')](_0x37bf95)['json'](_0x5d7f84);}};}function respondWithFilteredResult(_0x91cd1,_0x128887){return function(_0x170890){if(_0x170890){var _0x5ab4ba=typeof _0x128887[_0x0e60('0x1e')]===_0x0e60('0x1f')&&typeof _0x128887[_0x0e60('0x20')]===_0x0e60('0x1f');var _0x2e6270=_0x170890['count'];var _0x992490=_0x5ab4ba?0x0:_0x128887[_0x0e60('0x1e')];var _0x599c1d=_0x5ab4ba?_0x170890[_0x0e60('0x21')]:_0x128887[_0x0e60('0x1e')]+_0x128887[_0x0e60('0x20')];var _0x504b31;if(_0x599c1d>=_0x2e6270){_0x599c1d=_0x2e6270;_0x504b31=0xc8;}else{_0x504b31=0xce;}_0x91cd1[_0x0e60('0x1c')](_0x504b31);return _0x91cd1['set'](_0x0e60('0x22'),_0x992490+'-'+_0x599c1d+'/'+_0x2e6270)[_0x0e60('0x23')](_0x170890);}return null;};}function patchUpdates(_0xb9f037){return function(_0xabf953){try{jsonpatch[_0x0e60('0x24')](_0xabf953,_0xb9f037,!![]);}catch(_0x31a63e){return BPromise[_0x0e60('0x25')](_0x31a63e);}return _0xabf953[_0x0e60('0x26')]();};}function saveUpdates(_0x352633,_0x10f875){return function(_0x22c0e0){if(_0x22c0e0){return _0x22c0e0[_0x0e60('0x27')](_0x352633)[_0x0e60('0x28')](function(_0x16985f){return _0x16985f;});}return null;};}function removeEntity(_0x4702f,_0x33f9f3){return function(_0x41642c){if(_0x41642c){return _0x41642c[_0x0e60('0x29')]()[_0x0e60('0x28')](function(){_0x4702f['status'](0xcc)[_0x0e60('0x1d')]();});}};}function handleEntityNotFound(_0x41ad9a,_0x5ea254){return function(_0x10451f){if(!_0x10451f){_0x41ad9a['sendStatus'](0x194);}return _0x10451f;};}function handleError(_0x3ddc19,_0x5665c2){_0x5665c2=_0x5665c2||0x1f4;return function(_0x48d950){logger[_0x0e60('0x2a')](_0x48d950[_0x0e60('0x2b')]);if(_0x48d950['name']){delete _0x48d950['name'];}_0x3ddc19[_0x0e60('0x1c')](_0x5665c2)['send'](_0x48d950);};}exports[_0x0e60('0x2c')]=function(_0x548919,_0x4e6b41){var _0x154478={'raw':!![],'where':{'id':_0x548919[_0x0e60('0x2d')]['id']}},_0x3d3c13={};_0x3d3c13['model']=_[_0x0e60('0x2e')](db['ChatApplication'][_0x0e60('0x2f')]);_0x3d3c13[_0x0e60('0x30')]=_[_0x0e60('0x2e')](_0x548919['query']);_0x3d3c13[_0x0e60('0x31')]=_[_0x0e60('0x32')](_0x3d3c13[_0x0e60('0x33')],_0x3d3c13['query']);_0x154478[_0x0e60('0x34')]=_[_0x0e60('0x32')](_0x3d3c13[_0x0e60('0x33')],qs[_0x0e60('0x35')](_0x548919[_0x0e60('0x30')]['fields']));_0x154478[_0x0e60('0x34')]=_0x154478['attributes'][_0x0e60('0x36')]?_0x154478['attributes']:_0x3d3c13[_0x0e60('0x33')];if(_0x548919[_0x0e60('0x30')][_0x0e60('0x37')]){_0x154478['include']=[{'all':!![]}];}_0x154478=_[_0x0e60('0x38')]({},_0x154478,_0x548919[_0x0e60('0x39')]);return db[_0x0e60('0x3a')][_0x0e60('0x3b')](_0x154478)[_0x0e60('0x28')](handleEntityNotFound(_0x4e6b41,null))[_0x0e60('0x28')](respondWithResult(_0x4e6b41,null))[_0x0e60('0x3c')](handleError(_0x4e6b41,null));};exports[_0x0e60('0x27')]=function(_0x138505,_0x8d6440){if(_0x138505[_0x0e60('0x3d')]['id']){delete _0x138505[_0x0e60('0x3d')]['id'];}return db['ChatApplication'][_0x0e60('0x3b')]({'where':{'id':_0x138505[_0x0e60('0x2d')]['id']}})[_0x0e60('0x28')](handleEntityNotFound(_0x8d6440,null))[_0x0e60('0x28')](saveUpdates(_0x138505['body'],null))['then'](respondWithResult(_0x8d6440,null))[_0x0e60('0x3c')](handleError(_0x8d6440,null));};exports['destroy']=function(_0x29ac4b,_0x52759f){return db[_0x0e60('0x3a')][_0x0e60('0x3b')]({'where':{'id':_0x29ac4b[_0x0e60('0x2d')]['id']}})[_0x0e60('0x28')](handleEntityNotFound(_0x52759f,null))[_0x0e60('0x28')](removeEntity(_0x52759f,null))[_0x0e60('0x3c')](handleError(_0x52759f,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index f38396a..a95d7aa 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 _0x12c9=['request-promise','path','rimraf','../../config/environment','./chatApplication.attributes','define','ChatApplication','chat_applications','utf8mb4','lodash','util','../../config/logger','api','moment'];(function(_0x19f137,_0x69a6c5){var _0x13021f=function(_0x53e2c5){while(--_0x53e2c5){_0x19f137['push'](_0x19f137['shift']());}};_0x13021f(++_0x69a6c5);}(_0x12c9,0x1c9));var _0x912c=function(_0x3926c9,_0x5c7a00){_0x3926c9=_0x3926c9-0x0;var _0x55c66c=_0x12c9[_0x3926c9];return _0x55c66c;};'use strict';var _=require(_0x912c('0x0'));var util=require(_0x912c('0x1'));var logger=require(_0x912c('0x2'))(_0x912c('0x3'));var moment=require(_0x912c('0x4'));var BPromise=require('bluebird');var rp=require(_0x912c('0x5'));var fs=require('fs');var path=require(_0x912c('0x6'));var rimraf=require(_0x912c('0x7'));var config=require(_0x912c('0x8'));var attributes=require(_0x912c('0x9'));module['exports']=function(_0x584a27,_0xe29019){return _0x584a27[_0x912c('0xa')](_0x912c('0xb'),attributes,{'tableName':_0x912c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x912c('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xcb88=['path','rimraf','exports','define','ChatApplication','chat_applications','utf8mb4','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x1c1557,_0x5058ad){var _0x2b89d0=function(_0x4b62c1){while(--_0x4b62c1){_0x1c1557['push'](_0x1c1557['shift']());}};_0x2b89d0(++_0x5058ad);}(_0xcb88,0x14c));var _0x8cb8=function(_0x91d3a0,_0x2bbcaa){_0x91d3a0=_0x91d3a0-0x0;var _0x4214f1=_0xcb88[_0x91d3a0];return _0x4214f1;};'use strict';var _=require(_0x8cb8('0x0'));var util=require(_0x8cb8('0x1'));var logger=require(_0x8cb8('0x2'))(_0x8cb8('0x3'));var moment=require(_0x8cb8('0x4'));var BPromise=require('bluebird');var rp=require(_0x8cb8('0x5'));var fs=require('fs');var path=require(_0x8cb8('0x6'));var rimraf=require(_0x8cb8('0x7'));var config=require('../../config/environment');var attributes=require('./chatApplication.attributes');module[_0x8cb8('0x8')]=function(_0x1a8447,_0x3941ca){return _0x1a8447[_0x8cb8('0x9')](_0x8cb8('0xa'),attributes,{'tableName':_0x8cb8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8cb8('0xc'),'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 1f135dc..f06b477 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 _0xf86f=['../../config/environment','jayson/promise','client','request','then','request\x20sent','ChatApplication,\x20%s,\x20%s,\x20%s','error','code','ChatApplication,\x20%s,\x20%s','message','result','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x35e84b,_0x454479){var _0x4fb29e=function(_0x551707){while(--_0x551707){_0x35e84b['push'](_0x35e84b['shift']());}};_0x4fb29e(++_0x454479);}(_0xf86f,0x129));var _0xff86=function(_0x1b6186,_0x1ec7f2){_0x1b6186=_0x1b6186-0x0;var _0x186121=_0xf86f[_0x1b6186];return _0x186121;};'use strict';var _=require(_0xff86('0x0'));var util=require(_0xff86('0x1'));var moment=require(_0xff86('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xff86('0x3'));var db=require(_0xff86('0x4'))['db'];var utils=require(_0xff86('0x5'));var logger=require(_0xff86('0x6'))('rpc');var config=require(_0xff86('0x7'));var jayson=require(_0xff86('0x8'));var client=jayson[_0xff86('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2ba864,_0x28f860,_0x3499dc){return new BPromise(function(_0x35c6b8,_0x44d93a){return client[_0xff86('0xa')](_0x2ba864,_0x3499dc)[_0xff86('0xb')](function(_0x197d94){logger['info']('ChatApplication,\x20%s,\x20%s',_0x28f860,_0xff86('0xc'));logger['debug'](_0xff86('0xd'),_0x28f860,_0xff86('0xc'),JSON['stringify'](_0x197d94));if(_0x197d94[_0xff86('0xe')]){if(_0x197d94['error'][_0xff86('0xf')]===0x1f4){logger[_0xff86('0xe')](_0xff86('0x10'),_0x28f860,_0x197d94[_0xff86('0xe')]['message']);return _0x44d93a(_0x197d94[_0xff86('0xe')][_0xff86('0x11')]);}logger[_0xff86('0xe')](_0xff86('0x10'),_0x28f860,_0x197d94['error'][_0xff86('0x11')]);return _0x35c6b8(_0x197d94[_0xff86('0xe')][_0xff86('0x11')]);}else{logger['info']('ChatApplication,\x20%s,\x20%s',_0x28f860,_0xff86('0xc'));_0x35c6b8(_0x197d94[_0xff86('0x12')]['message']);}})['catch'](function(_0x38d102){logger['error'](_0xff86('0x10'),_0x28f860,_0x38d102);_0x44d93a(_0x38d102);});});} \ No newline at end of file +var _0xf1d0=['request\x20sent','stringify','error','ChatApplication,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request'];(function(_0x35f021,_0x2ec9c4){var _0x1c0dcb=function(_0x4db006){while(--_0x4db006){_0x35f021['push'](_0x35f021['shift']());}};_0x1c0dcb(++_0x2ec9c4);}(_0xf1d0,0x94));var _0x0f1d=function(_0xc2dde6,_0x1cccc9){_0xc2dde6=_0xc2dde6-0x0;var _0x9fc29c=_0xf1d0[_0xc2dde6];return _0x9fc29c;};'use strict';var _=require(_0x0f1d('0x0'));var util=require(_0x0f1d('0x1'));var moment=require(_0x0f1d('0x2'));var BPromise=require(_0x0f1d('0x3'));var rs=require(_0x0f1d('0x4'));var fs=require('fs');var Redis=require(_0x0f1d('0x5'));var db=require(_0x0f1d('0x6'))['db'];var utils=require(_0x0f1d('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x0f1d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0f1d('0x9')][_0x0f1d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1ab595,_0x3fa962,_0x11cc92){return new BPromise(function(_0x44cda6,_0x47d157){return client[_0x0f1d('0xb')](_0x1ab595,_0x11cc92)['then'](function(_0x2cb199){logger['info']('ChatApplication,\x20%s,\x20%s',_0x3fa962,'request\x20sent');logger['debug']('ChatApplication,\x20%s,\x20%s,\x20%s',_0x3fa962,_0x0f1d('0xc'),JSON[_0x0f1d('0xd')](_0x2cb199));if(_0x2cb199[_0x0f1d('0xe')]){if(_0x2cb199[_0x0f1d('0xe')]['code']===0x1f4){logger[_0x0f1d('0xe')](_0x0f1d('0xf'),_0x3fa962,_0x2cb199['error'][_0x0f1d('0x10')]);return _0x47d157(_0x2cb199[_0x0f1d('0xe')][_0x0f1d('0x10')]);}logger[_0x0f1d('0xe')](_0x0f1d('0xf'),_0x3fa962,_0x2cb199['error'][_0x0f1d('0x10')]);return _0x44cda6(_0x2cb199[_0x0f1d('0xe')][_0x0f1d('0x10')]);}else{logger[_0x0f1d('0x11')](_0x0f1d('0xf'),_0x3fa962,_0x0f1d('0xc'));_0x44cda6(_0x2cb199[_0x0f1d('0x12')][_0x0f1d('0x10')]);}})[_0x0f1d('0x13')](function(_0x409aa7){logger[_0x0f1d('0xe')](_0x0f1d('0xf'),_0x3fa962,_0x409aa7);_0x47d157(_0x409aa7);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 6ad2e47..a487882 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 _0xddf0=['isAuthenticated','update','delete','destroy','exports','multer','path','express','Router','../../components/interaction/service','./chatApplication.controller','get','/:id','show'];(function(_0x305f5e,_0x4c3b40){var _0x139bde=function(_0x1f9325){while(--_0x1f9325){_0x305f5e['push'](_0x305f5e['shift']());}};_0x139bde(++_0x4c3b40);}(_0xddf0,0x155));var _0x0ddf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xddf0[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x0ddf('0x0'));var util=require('util');var path=require(_0x0ddf('0x1'));var timeout=require('connect-timeout');var express=require(_0x0ddf('0x2'));var router=express[_0x0ddf('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x0ddf('0x4'));var config=require('../../config/environment');var controller=require(_0x0ddf('0x5'));router[_0x0ddf('0x6')](_0x0ddf('0x7'),auth['isAuthenticated'](),controller[_0x0ddf('0x8')]);router['put'](_0x0ddf('0x7'),auth[_0x0ddf('0x9')](),controller[_0x0ddf('0xa')]);router[_0x0ddf('0xb')](_0x0ddf('0x7'),auth[_0x0ddf('0x9')](),controller[_0x0ddf('0xc')]);module[_0x0ddf('0xd')]=router; \ No newline at end of file +var _0xd3c9=['isAuthenticated','put','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./chatApplication.controller','/:id'];(function(_0x33a98c,_0x2d47f4){var _0x2e7eff=function(_0xec8f4){while(--_0xec8f4){_0x33a98c['push'](_0x33a98c['shift']());}};_0x2e7eff(++_0x2d47f4);}(_0xd3c9,0x8c));var _0x9d3c=function(_0x206857,_0x3e4ef5){_0x206857=_0x206857-0x0;var _0x4c4ccc=_0xd3c9[_0x206857];return _0x4c4ccc;};'use strict';var multer=require(_0x9d3c('0x0'));var util=require(_0x9d3c('0x1'));var path=require(_0x9d3c('0x2'));var timeout=require(_0x9d3c('0x3'));var express=require(_0x9d3c('0x4'));var router=express['Router']();var fs_extra=require(_0x9d3c('0x5'));var auth=require(_0x9d3c('0x6'));var interaction=require(_0x9d3c('0x7'));var config=require('../../config/environment');var controller=require(_0x9d3c('0x8'));router['get'](_0x9d3c('0x9'),auth[_0x9d3c('0xa')](),controller['show']);router[_0x9d3c('0xb')](_0x9d3c('0x9'),auth[_0x9d3c('0xa')](),controller['update']);router[_0x9d3c('0xc')](_0x9d3c('0x9'),auth[_0x9d3c('0xa')](),controller[_0x9d3c('0xd')]);module[_0x9d3c('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 baeaa05..e87aa8d 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 _0x935e=['STRING','BOOLEAN','sequelize','exports'];(function(_0x2cff4f,_0x21e344){var _0x3df848=function(_0x49474b){while(--_0x49474b){_0x2cff4f['push'](_0x2cff4f['shift']());}};_0x3df848(++_0x21e344);}(_0x935e,0x17e));var _0xe935=function(_0x4ff238,_0x181101){_0x4ff238=_0x4ff238-0x0;var _0x18be1e=_0x935e[_0x4ff238];return _0x18be1e;};'use strict';var Sequelize=require(_0xe935('0x0'));module[_0xe935('0x1')]={'name':{'type':Sequelize[_0xe935('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xe935('0x2')]},'write':{'type':Sequelize[_0xe935('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0xd8fb=['sequelize','exports','STRING'];(function(_0x4b959b,_0x3773ad){var _0x43362b=function(_0x3267f1){while(--_0x3267f1){_0x4b959b['push'](_0x4b959b['shift']());}};_0x43362b(++_0x3773ad);}(_0xd8fb,0x99));var _0xbd8f=function(_0x3ec84f,_0x18722b){_0x3ec84f=_0x3ec84f-0x0;var _0x24256b=_0xd8fb[_0x3ec84f];return _0x24256b;};'use strict';var Sequelize=require(_0xbd8f('0x0'));module[_0xbd8f('0x1')]={'name':{'type':Sequelize[_0xbd8f('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xbd8f('0x2')]},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index ba18fe3..8f02bad 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 _0x5c8d=['sox','to-csv','ejs','fs-extra','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./chatGroup.socket','sendStatus','status','end','json','offset','undefined','count','set','apply','reject','save','update','then','destroy','name','map','fieldName','type','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','filters','filter','where','merge','VIRTUAL','ChatGroup','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','find','body','describe','getUnread','ChatInternalMessage','user','ids','omit','getMembers','findOne','User','pick','removeMembers','ChatGroupId','getMessages','$gte','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x1a1cb9,_0x522442){var _0x40d0f3=function(_0x380cc4){while(--_0x380cc4){_0x1a1cb9['push'](_0x1a1cb9['shift']());}};_0x40d0f3(++_0x522442);}(_0x5c8d,0xad));var _0xd5c8=function(_0xfa60f7,_0x303a04){_0xfa60f7=_0xfa60f7-0x0;var _0x33a9c0=_0x5c8d[_0xfa60f7];return _0x33a9c0;};'use strict';var emlformat=require(_0xd5c8('0x0'));var rimraf=require(_0xd5c8('0x1'));var zipdir=require(_0xd5c8('0x2'));var jsonpatch=require(_0xd5c8('0x3'));var rp=require(_0xd5c8('0x4'));var moment=require(_0xd5c8('0x5'));var BPromise=require(_0xd5c8('0x6'));var Mustache=require(_0xd5c8('0x7'));var util=require(_0xd5c8('0x8'));var path=require('path');var sox=require(_0xd5c8('0x9'));var csv=require(_0xd5c8('0xa'));var ejs=require(_0xd5c8('0xb'));var fs=require('fs');var fs_extra=require(_0xd5c8('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xd5c8('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd5c8('0xa'));var querystring=require(_0xd5c8('0xe'));var Papa=require(_0xd5c8('0xf'));var Redis=require(_0xd5c8('0x10'));var authService=require(_0xd5c8('0x11'));var qs=require(_0xd5c8('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd5c8('0x13'));var logger=require(_0xd5c8('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xd5c8('0x15'));var licenseUtil=require(_0xd5c8('0x16'));var db=require(_0xd5c8('0x17'))['db'];config[_0xd5c8('0x18')]=_[_0xd5c8('0x19')](config[_0xd5c8('0x18')],{'host':_0xd5c8('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd5c8('0x18')]));require(_0xd5c8('0x1b'))['register'](socket);function respondWithStatusCode(_0x1e27d1,_0x14cb27){_0x14cb27=_0x14cb27||0xcc;return function(_0x43f82b){if(_0x43f82b){return _0x1e27d1[_0xd5c8('0x1c')](_0x14cb27);}return _0x1e27d1[_0xd5c8('0x1d')](_0x14cb27)[_0xd5c8('0x1e')]();};}function respondWithResult(_0x14765a,_0x4c6901){_0x4c6901=_0x4c6901||0xc8;return function(_0x405168){if(_0x405168){return _0x14765a[_0xd5c8('0x1d')](_0x4c6901)[_0xd5c8('0x1f')](_0x405168);}};}function respondWithFilteredResult(_0x4d6719,_0x2a64ae){return function(_0x387c26){if(_0x387c26){var _0x2781cb=typeof _0x2a64ae[_0xd5c8('0x20')]===_0xd5c8('0x21')&&typeof _0x2a64ae['limit']===_0xd5c8('0x21');var _0x4ee5b9=_0x387c26['count'];var _0x48ac20=_0x2781cb?0x0:_0x2a64ae[_0xd5c8('0x20')];var _0x4b867c=_0x2781cb?_0x387c26[_0xd5c8('0x22')]:_0x2a64ae['offset']+_0x2a64ae['limit'];var _0x1df3b8;if(_0x4b867c>=_0x4ee5b9){_0x4b867c=_0x4ee5b9;_0x1df3b8=0xc8;}else{_0x1df3b8=0xce;}_0x4d6719[_0xd5c8('0x1d')](_0x1df3b8);return _0x4d6719[_0xd5c8('0x23')]('Content-Range',_0x48ac20+'-'+_0x4b867c+'/'+_0x4ee5b9)[_0xd5c8('0x1f')](_0x387c26);}return null;};}function patchUpdates(_0x5c296a){return function(_0xfffda9){try{jsonpatch[_0xd5c8('0x24')](_0xfffda9,_0x5c296a,!![]);}catch(_0x224ef4){return BPromise[_0xd5c8('0x25')](_0x224ef4);}return _0xfffda9[_0xd5c8('0x26')]();};}function saveUpdates(_0x554baa,_0x36daf6){return function(_0x3f1bb6){if(_0x3f1bb6){return _0x3f1bb6[_0xd5c8('0x27')](_0x554baa)[_0xd5c8('0x28')](function(_0x5ab3bd){return _0x5ab3bd;});}return null;};}function removeEntity(_0x1f0ec7,_0x4c48fd){return function(_0x448db0){if(_0x448db0){return _0x448db0[_0xd5c8('0x29')]()[_0xd5c8('0x28')](function(){_0x1f0ec7['status'](0xcc)[_0xd5c8('0x1e')]();});}};}function handleEntityNotFound(_0x221112,_0x45b2ec){return function(_0x127250){if(!_0x127250){_0x221112[_0xd5c8('0x1c')](0x194);}return _0x127250;};}function handleError(_0x28272e,_0x2b7453){_0x2b7453=_0x2b7453||0x1f4;return function(_0x1dd0b9){logger['error'](_0x1dd0b9['stack']);if(_0x1dd0b9[_0xd5c8('0x2a')]){delete _0x1dd0b9[_0xd5c8('0x2a')];}_0x28272e['status'](_0x2b7453)['send'](_0x1dd0b9);};}exports['index']=function(_0x47008d,_0xb30aac){var _0x65c3a2={},_0x115aef={},_0x3ae0a7={'count':0x0,'rows':[]};var _0x12bd86=_[_0xd5c8('0x2b')](db['ChatGroup']['rawAttributes'],function(_0x99087d){return{'name':_0x99087d[_0xd5c8('0x2c')],'type':_0x99087d[_0xd5c8('0x2d')][_0xd5c8('0x2e')]};});_0x115aef[_0xd5c8('0x2f')]=_[_0xd5c8('0x2b')](_0x12bd86,'name');_0x115aef['query']=_[_0xd5c8('0x30')](_0x47008d[_0xd5c8('0x31')]);_0x115aef['filters']=_[_0xd5c8('0x32')](_0x115aef[_0xd5c8('0x2f')],_0x115aef['query']);_0x65c3a2['attributes']=_[_0xd5c8('0x32')](_0x115aef[_0xd5c8('0x2f')],qs[_0xd5c8('0x33')](_0x47008d[_0xd5c8('0x31')]['fields']));_0x65c3a2[_0xd5c8('0x34')]=_0x65c3a2[_0xd5c8('0x34')][_0xd5c8('0x35')]?_0x65c3a2[_0xd5c8('0x34')]:_0x115aef[_0xd5c8('0x2f')];if(!_0x47008d[_0xd5c8('0x31')][_0xd5c8('0x36')](_0xd5c8('0x37'))){_0x65c3a2[_0xd5c8('0x38')]=qs[_0xd5c8('0x38')](_0x47008d[_0xd5c8('0x31')][_0xd5c8('0x38')]);_0x65c3a2[_0xd5c8('0x20')]=qs['offset'](_0x47008d[_0xd5c8('0x31')]['offset']);}_0x65c3a2[_0xd5c8('0x39')]=qs[_0xd5c8('0x3a')](_0x47008d[_0xd5c8('0x31')][_0xd5c8('0x3a')]);_0x65c3a2['where']=qs['filters'](_['pick'](_0x47008d['query'],_0x115aef[_0xd5c8('0x3b')]),_0x12bd86);if(_0x47008d[_0xd5c8('0x31')][_0xd5c8('0x3c')]){_0x65c3a2[_0xd5c8('0x3d')]=_[_0xd5c8('0x3e')](_0x65c3a2[_0xd5c8('0x3d')],{'$or':_[_0xd5c8('0x2b')](_0x12bd86,function(_0x27519b){if(_0x27519b[_0xd5c8('0x2d')]!==_0xd5c8('0x3f')){var _0x532d57={};_0x532d57[_0x27519b['name']]={'$like':'%'+_0x47008d['query'][_0xd5c8('0x3c')]+'%'};return _0x532d57;}})});}_0x65c3a2=_['merge']({},_0x65c3a2,_0x47008d['options']);var _0x622d3f={'where':_0x65c3a2[_0xd5c8('0x3d')]};return db[_0xd5c8('0x40')][_0xd5c8('0x22')](_0x622d3f)['then'](function(_0x54a29d){_0x3ae0a7[_0xd5c8('0x22')]=_0x54a29d;if(_0x47008d[_0xd5c8('0x31')][_0xd5c8('0x41')]){_0x65c3a2[_0xd5c8('0x42')]=[{'all':!![]}];}return db['ChatGroup'][_0xd5c8('0x43')](_0x65c3a2);})['then'](function(_0x296805){_0x3ae0a7[_0xd5c8('0x44')]=_0x296805;return _0x3ae0a7;})[_0xd5c8('0x28')](respondWithFilteredResult(_0xb30aac,_0x65c3a2))[_0xd5c8('0x45')](handleError(_0xb30aac,null));};exports[_0xd5c8('0x46')]=function(_0x5e754d,_0x3a9e70){var _0x409d28={'raw':!![],'where':{'id':_0x5e754d[_0xd5c8('0x47')]['id']}},_0x4277d2={};_0x4277d2[_0xd5c8('0x2f')]=_['keys'](db[_0xd5c8('0x40')][_0xd5c8('0x48')]);_0x4277d2[_0xd5c8('0x31')]=_['keys'](_0x5e754d[_0xd5c8('0x31')]);_0x4277d2[_0xd5c8('0x3b')]=_[_0xd5c8('0x32')](_0x4277d2['model'],_0x4277d2[_0xd5c8('0x31')]);_0x409d28[_0xd5c8('0x34')]=_[_0xd5c8('0x32')](_0x4277d2[_0xd5c8('0x2f')],qs[_0xd5c8('0x33')](_0x5e754d[_0xd5c8('0x31')][_0xd5c8('0x33')]));_0x409d28['attributes']=_0x409d28[_0xd5c8('0x34')][_0xd5c8('0x35')]?_0x409d28[_0xd5c8('0x34')]:_0x4277d2[_0xd5c8('0x2f')];if(_0x5e754d[_0xd5c8('0x31')][_0xd5c8('0x41')]){_0x409d28[_0xd5c8('0x42')]=[{'all':!![]}];}_0x409d28=_[_0xd5c8('0x3e')]({},_0x409d28,_0x5e754d[_0xd5c8('0x49')]);return db[_0xd5c8('0x40')][_0xd5c8('0x4a')](_0x409d28)['then'](handleEntityNotFound(_0x3a9e70,null))[_0xd5c8('0x28')](respondWithResult(_0x3a9e70,null))[_0xd5c8('0x45')](handleError(_0x3a9e70,null));};exports['create']=function(_0x144979,_0xfc7e78){return db[_0xd5c8('0x40')]['create'](_0x144979[_0xd5c8('0x4b')],{})[_0xd5c8('0x28')](respondWithResult(_0xfc7e78,0xc9))[_0xd5c8('0x45')](handleError(_0xfc7e78,null));};exports['update']=function(_0x1292b6,_0x502f40){if(_0x1292b6['body']['id']){delete _0x1292b6[_0xd5c8('0x4b')]['id'];}return db[_0xd5c8('0x40')]['find']({'where':{'id':_0x1292b6[_0xd5c8('0x47')]['id']}})[_0xd5c8('0x28')](handleEntityNotFound(_0x502f40,null))['then'](saveUpdates(_0x1292b6[_0xd5c8('0x4b')],null))['then'](respondWithResult(_0x502f40,null))[_0xd5c8('0x45')](handleError(_0x502f40,null));};exports[_0xd5c8('0x29')]=function(_0x32cb66,_0x11e82c){return db['ChatGroup'][_0xd5c8('0x4a')]({'where':{'id':_0x32cb66[_0xd5c8('0x47')]['id']}})[_0xd5c8('0x28')](handleEntityNotFound(_0x11e82c,null))[_0xd5c8('0x28')](removeEntity(_0x11e82c,null))['catch'](handleError(_0x11e82c,null));};exports[_0xd5c8('0x4c')]=function(_0x32e1e4,_0x7b78ca){return db['ChatGroup']['describe']()[_0xd5c8('0x28')](respondWithResult(_0x7b78ca,null))[_0xd5c8('0x45')](handleError(_0x7b78ca,null));};exports[_0xd5c8('0x4d')]=function(_0x14b704,_0x2806c6,_0x3c61e8){return db[_0xd5c8('0x4e')][_0xd5c8('0x22')]({'where':{'ChatGroupId':_0x14b704[_0xd5c8('0x47')]['id'],'ToId':_0x14b704[_0xd5c8('0x4f')]['id'],'read':![]}})['then'](function(_0x31caeb){return{'id':_['toInteger'](_0x14b704[_0xd5c8('0x47')]['id']),'count':_0x31caeb};})[_0xd5c8('0x28')](respondWithResult(_0x2806c6,null))[_0xd5c8('0x45')](handleError(_0x2806c6,null));};exports['addMembers']=function(_0x291f7b,_0x3784e5,_0x2b8afc){return db[_0xd5c8('0x40')]['find']({'where':{'id':_0x291f7b['params']['id']}})['then'](handleEntityNotFound(_0x3784e5,null))['then'](function(_0x28606d){if(_0x28606d){return _0x28606d['addMembers'](_0x291f7b[_0xd5c8('0x4b')][_0xd5c8('0x50')],_[_0xd5c8('0x51')](_0x291f7b[_0xd5c8('0x4b')],['ids','id'])||{});}})[_0xd5c8('0x28')](respondWithResult(_0x3784e5,null))[_0xd5c8('0x45')](handleError(_0x3784e5,null));};exports[_0xd5c8('0x52')]=function(_0x701336,_0x335c21,_0x20d4d0){var _0x51f28e={};var _0x1f525={};var _0x5930fe;var _0x58abe5;return db[_0xd5c8('0x40')][_0xd5c8('0x53')]({'where':{'id':_0x701336['params']['id']}})[_0xd5c8('0x28')](handleEntityNotFound(_0x335c21,null))[_0xd5c8('0x28')](function(_0x44aec2){if(_0x44aec2){_0x5930fe=_0x44aec2;_0x1f525[_0xd5c8('0x2f')]=_[_0xd5c8('0x30')](db[_0xd5c8('0x54')][_0xd5c8('0x48')]);_0x1f525[_0xd5c8('0x31')]=_[_0xd5c8('0x30')](_0x701336[_0xd5c8('0x31')]);_0x1f525['filters']=_[_0xd5c8('0x32')](_0x1f525['model'],_0x1f525[_0xd5c8('0x31')]);_0x51f28e[_0xd5c8('0x34')]=_[_0xd5c8('0x32')](_0x1f525['model'],qs[_0xd5c8('0x33')](_0x701336[_0xd5c8('0x31')][_0xd5c8('0x33')]));_0x51f28e['attributes']=_0x51f28e[_0xd5c8('0x34')][_0xd5c8('0x35')]?_0x51f28e[_0xd5c8('0x34')]:_0x1f525['model'];_0x51f28e['order']=qs[_0xd5c8('0x3a')](_0x701336[_0xd5c8('0x31')]['sort']);_0x51f28e[_0xd5c8('0x3d')]=qs[_0xd5c8('0x3b')](_[_0xd5c8('0x55')](_0x701336[_0xd5c8('0x31')],_0x1f525[_0xd5c8('0x3b')]));if(_0x701336['query'][_0xd5c8('0x3c')]){_0x51f28e[_0xd5c8('0x3d')]=_['merge'](_0x51f28e[_0xd5c8('0x3d')],{'$or':_['map'](_0x51f28e[_0xd5c8('0x34')],function(_0x2493e1){var _0x105e08={};_0x105e08[_0x2493e1]={'$like':'%'+_0x701336[_0xd5c8('0x31')][_0xd5c8('0x3c')]+'%'};return _0x105e08;})});}_0x51f28e=_[_0xd5c8('0x3e')]({},_0x51f28e,_0x701336[_0xd5c8('0x49')]);return _0x5930fe[_0xd5c8('0x52')](_0x51f28e);}})['then'](function(_0x5c38de){if(_0x5c38de){_0x58abe5=_0x5c38de[_0xd5c8('0x35')];if(!_0x701336[_0xd5c8('0x31')]['hasOwnProperty'](_0xd5c8('0x37'))){_0x51f28e['limit']=qs[_0xd5c8('0x38')](_0x701336[_0xd5c8('0x31')][_0xd5c8('0x38')]);_0x51f28e[_0xd5c8('0x20')]=qs[_0xd5c8('0x20')](_0x701336[_0xd5c8('0x31')]['offset']);}return _0x5930fe['getMembers'](_0x51f28e);}})[_0xd5c8('0x28')](function(_0x4d8ef4){if(_0x4d8ef4){return _0x4d8ef4?{'count':_0x58abe5,'rows':_0x4d8ef4}:null;}})[_0xd5c8('0x28')](respondWithResult(_0x335c21,null))[_0xd5c8('0x45')](handleError(_0x335c21,null));};exports[_0xd5c8('0x56')]=function(_0x1f16ec,_0x43db97,_0x25cf03){return db[_0xd5c8('0x40')][_0xd5c8('0x4a')]({'where':{'id':_0x1f16ec[_0xd5c8('0x47')]['id']}})['then'](handleEntityNotFound(_0x43db97,null))[_0xd5c8('0x28')](function(_0x1e3519){if(_0x1e3519){return _0x1e3519['removeMembers'](_0x1f16ec[_0xd5c8('0x31')]['ids']);}})['then'](respondWithStatusCode(_0x43db97,null))[_0xd5c8('0x45')](handleError(_0x43db97,null));};exports['addMessage']=function(_0x119b64,_0x5b921f,_0x4a9269){if(_0x119b64[_0xd5c8('0x4b')]['id']){delete _0x119b64['body']['id'];}return db[_0xd5c8('0x40')][_0xd5c8('0x4a')]({'where':{'id':_0x119b64['params']['id']}})[_0xd5c8('0x28')](handleEntityNotFound(_0x5b921f,null))[_0xd5c8('0x28')](function(_0xc43856){if(_0xc43856){_0x119b64['body'][_0xd5c8('0x57')]=_0xc43856['id'];return db[_0xd5c8('0x4e')]['create'](_0x119b64[_0xd5c8('0x4b')]);}})[_0xd5c8('0x28')](respondWithResult(_0x5b921f,null))[_0xd5c8('0x45')](handleError(_0x5b921f,null));};exports[_0xd5c8('0x58')]=function(_0x1a9547,_0x459f71,_0x533587){var _0xa0850={};var _0x4acf88={};var _0xf73b0c;var _0x1ebce1;return db['ChatGroup'][_0xd5c8('0x53')]({'where':{'id':_0x1a9547['params']['id']}})[_0xd5c8('0x28')](handleEntityNotFound(_0x459f71,null))[_0xd5c8('0x28')](function(_0x5cdf0c){if(_0x5cdf0c){_0xf73b0c=_0x5cdf0c;_0x4acf88[_0xd5c8('0x2f')]=_[_0xd5c8('0x30')](db[_0xd5c8('0x4e')][_0xd5c8('0x48')]);_0x4acf88[_0xd5c8('0x31')]=_[_0xd5c8('0x30')](_0x1a9547['query']);_0x4acf88[_0xd5c8('0x3b')]=_[_0xd5c8('0x32')](_0x4acf88[_0xd5c8('0x2f')],_0x4acf88[_0xd5c8('0x31')]);_0xa0850[_0xd5c8('0x34')]=_[_0xd5c8('0x32')](_0x4acf88[_0xd5c8('0x2f')],qs['fields'](_0x1a9547[_0xd5c8('0x31')][_0xd5c8('0x33')]));_0xa0850[_0xd5c8('0x34')]=_0xa0850[_0xd5c8('0x34')][_0xd5c8('0x35')]?_0xa0850[_0xd5c8('0x34')]:_0x4acf88[_0xd5c8('0x2f')];_0xa0850[_0xd5c8('0x39')]=qs[_0xd5c8('0x3a')](_0x1a9547[_0xd5c8('0x31')][_0xd5c8('0x3a')]);_0xa0850[_0xd5c8('0x3d')]=qs['filters'](_['pick'](_0x1a9547[_0xd5c8('0x31')],_0x4acf88[_0xd5c8('0x3b')]));if(_0x1a9547[_0xd5c8('0x31')][_0xd5c8('0x3c')]){_0xa0850[_0xd5c8('0x3d')]=_[_0xd5c8('0x3e')](_0xa0850[_0xd5c8('0x3d')],{'$or':_['map'](_0xa0850[_0xd5c8('0x34')],function(_0x4fe8f1){var _0x308854={};_0x308854[_0x4fe8f1]={'$like':'%'+_0x1a9547[_0xd5c8('0x31')][_0xd5c8('0x3c')]+'%'};return _0x308854;})});}if(_0x1a9547[_0xd5c8('0x31')][_0xd5c8('0x59')]){var _0x38ba16=_0x1a9547[_0xd5c8('0x31')][_0xd5c8('0x59')]['split'](',');var _0x164669={};_0x164669[_0x38ba16[0x0]]={'$gte':moment(_0x38ba16[0x1])['format'](_0xd5c8('0x5a'))};_0xa0850[_0xd5c8('0x3d')]=_['merge'](_0xa0850[_0xd5c8('0x3d')],_0x164669);}_0xa0850=_[_0xd5c8('0x3e')]({},_0xa0850,_0x1a9547[_0xd5c8('0x49')]);return _0xf73b0c[_0xd5c8('0x58')](_0xa0850);}})[_0xd5c8('0x28')](function(_0x5dc962){if(_0x5dc962){_0x1ebce1=_0x5dc962[_0xd5c8('0x35')];if(!_0x1a9547[_0xd5c8('0x31')]['hasOwnProperty'](_0xd5c8('0x37'))){_0xa0850[_0xd5c8('0x38')]=qs['limit'](_0x1a9547[_0xd5c8('0x31')][_0xd5c8('0x38')]);_0xa0850[_0xd5c8('0x20')]=qs[_0xd5c8('0x20')](_0x1a9547[_0xd5c8('0x31')][_0xd5c8('0x20')]);}return _0xf73b0c[_0xd5c8('0x58')](_0xa0850);}})[_0xd5c8('0x28')](function(_0xd86e7f){if(_0xd86e7f){return _0xd86e7f?{'count':_0x1ebce1,'rows':_0xd86e7f}:null;}})[_0xd5c8('0x28')](respondWithResult(_0x459f71,null))[_0xd5c8('0x45')](handleError(_0x459f71,null));}; \ No newline at end of file +var _0x4199=['defaults','localhost','socket.io-emitter','./chatGroup.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','map','ChatGroup','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','getUnread','user','toInteger','addMembers','ids','getMembers','User','nolimit','addMessage','ChatGroupId','ChatInternalMessage','getMessages','findOne','$gte','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis'];(function(_0x3eda0c,_0x42d940){var _0x3ec8dc=function(_0x3f3f3a){while(--_0x3f3f3a){_0x3eda0c['push'](_0x3eda0c['shift']());}};_0x3ec8dc(++_0x42d940);}(_0x4199,0x109));var _0x9419=function(_0x45d45a,_0x1ec85d){_0x45d45a=_0x45d45a-0x0;var _0x4e7b61=_0x4199[_0x45d45a];return _0x4e7b61;};'use strict';var emlformat=require(_0x9419('0x0'));var rimraf=require(_0x9419('0x1'));var zipdir=require(_0x9419('0x2'));var jsonpatch=require(_0x9419('0x3'));var rp=require(_0x9419('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9419('0x5'));var util=require(_0x9419('0x6'));var path=require(_0x9419('0x7'));var sox=require(_0x9419('0x8'));var csv=require(_0x9419('0x9'));var ejs=require(_0x9419('0xa'));var fs=require('fs');var fs_extra=require(_0x9419('0xb'));var _=require(_0x9419('0xc'));var squel=require(_0x9419('0xd'));var crypto=require(_0x9419('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x9419('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9419('0x10'));var Redis=require(_0x9419('0x11'));var authService=require(_0x9419('0x12'));var qs=require(_0x9419('0x13'));var as=require(_0x9419('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9419('0x15'))('api');var utils=require(_0x9419('0x16'));var config=require(_0x9419('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x9419('0x18'))['db'];config[_0x9419('0x19')]=_[_0x9419('0x1a')](config['redis'],{'host':_0x9419('0x1b'),'port':0x18eb});var socket=require(_0x9419('0x1c'))(new Redis(config[_0x9419('0x19')]));require(_0x9419('0x1d'))['register'](socket);function respondWithStatusCode(_0x64fd8b,_0x1487ff){_0x1487ff=_0x1487ff||0xcc;return function(_0x2eb7a5){if(_0x2eb7a5){return _0x64fd8b[_0x9419('0x1e')](_0x1487ff);}return _0x64fd8b[_0x9419('0x1f')](_0x1487ff)[_0x9419('0x20')]();};}function respondWithResult(_0x33ea42,_0x4b7296){_0x4b7296=_0x4b7296||0xc8;return function(_0x278cb7){if(_0x278cb7){return _0x33ea42[_0x9419('0x1f')](_0x4b7296)[_0x9419('0x21')](_0x278cb7);}};}function respondWithFilteredResult(_0x4bf26d,_0x1dcbce){return function(_0x428596){if(_0x428596){var _0x21fd7f=typeof _0x1dcbce[_0x9419('0x22')]===_0x9419('0x23')&&typeof _0x1dcbce[_0x9419('0x24')]===_0x9419('0x23');var _0xbb1461=_0x428596[_0x9419('0x25')];var _0x8b209=_0x21fd7f?0x0:_0x1dcbce[_0x9419('0x22')];var _0x1bd554=_0x21fd7f?_0x428596['count']:_0x1dcbce[_0x9419('0x22')]+_0x1dcbce[_0x9419('0x24')];var _0x5e035a;if(_0x1bd554>=_0xbb1461){_0x1bd554=_0xbb1461;_0x5e035a=0xc8;}else{_0x5e035a=0xce;}_0x4bf26d[_0x9419('0x1f')](_0x5e035a);return _0x4bf26d[_0x9419('0x26')](_0x9419('0x27'),_0x8b209+'-'+_0x1bd554+'/'+_0xbb1461)['json'](_0x428596);}return null;};}function patchUpdates(_0x433d99){return function(_0x392f96){try{jsonpatch[_0x9419('0x28')](_0x392f96,_0x433d99,!![]);}catch(_0x4543ac){return BPromise['reject'](_0x4543ac);}return _0x392f96[_0x9419('0x29')]();};}function saveUpdates(_0x288b1b,_0x2dcb45){return function(_0x4709b7){if(_0x4709b7){return _0x4709b7[_0x9419('0x2a')](_0x288b1b)[_0x9419('0x2b')](function(_0x2141ef){return _0x2141ef;});}return null;};}function removeEntity(_0x2e9d93,_0x338feb){return function(_0x60760f){if(_0x60760f){return _0x60760f[_0x9419('0x2c')]()[_0x9419('0x2b')](function(){_0x2e9d93['status'](0xcc)[_0x9419('0x20')]();});}};}function handleEntityNotFound(_0x32a6fd,_0x19c899){return function(_0x5b2808){if(!_0x5b2808){_0x32a6fd['sendStatus'](0x194);}return _0x5b2808;};}function handleError(_0x955817,_0x22a5b9){_0x22a5b9=_0x22a5b9||0x1f4;return function(_0x2e2565){logger[_0x9419('0x2d')](_0x2e2565[_0x9419('0x2e')]);if(_0x2e2565[_0x9419('0x2f')]){delete _0x2e2565['name'];}_0x955817[_0x9419('0x1f')](_0x22a5b9)[_0x9419('0x30')](_0x2e2565);};}exports['index']=function(_0x18ba08,_0x326b20){var _0x414c72={},_0x4ca4bd={},_0x4292c5={'count':0x0,'rows':[]};var _0x23c694=_[_0x9419('0x31')](db[_0x9419('0x32')][_0x9419('0x33')],function(_0x9c6855){return{'name':_0x9c6855[_0x9419('0x34')],'type':_0x9c6855[_0x9419('0x35')]['key']};});_0x4ca4bd['model']=_[_0x9419('0x31')](_0x23c694,_0x9419('0x2f'));_0x4ca4bd[_0x9419('0x36')]=_[_0x9419('0x37')](_0x18ba08[_0x9419('0x36')]);_0x4ca4bd[_0x9419('0x38')]=_[_0x9419('0x39')](_0x4ca4bd[_0x9419('0x3a')],_0x4ca4bd[_0x9419('0x36')]);_0x414c72['attributes']=_[_0x9419('0x39')](_0x4ca4bd[_0x9419('0x3a')],qs[_0x9419('0x3b')](_0x18ba08[_0x9419('0x36')][_0x9419('0x3b')]));_0x414c72[_0x9419('0x3c')]=_0x414c72[_0x9419('0x3c')][_0x9419('0x3d')]?_0x414c72['attributes']:_0x4ca4bd[_0x9419('0x3a')];if(!_0x18ba08['query'][_0x9419('0x3e')]('nolimit')){_0x414c72[_0x9419('0x24')]=qs[_0x9419('0x24')](_0x18ba08[_0x9419('0x36')][_0x9419('0x24')]);_0x414c72[_0x9419('0x22')]=qs['offset'](_0x18ba08['query'][_0x9419('0x22')]);}_0x414c72[_0x9419('0x3f')]=qs[_0x9419('0x40')](_0x18ba08[_0x9419('0x36')]['sort']);_0x414c72[_0x9419('0x41')]=qs[_0x9419('0x38')](_[_0x9419('0x42')](_0x18ba08[_0x9419('0x36')],_0x4ca4bd['filters']),_0x23c694);if(_0x18ba08[_0x9419('0x36')]['filter']){_0x414c72[_0x9419('0x41')]=_['merge'](_0x414c72[_0x9419('0x41')],{'$or':_[_0x9419('0x31')](_0x23c694,function(_0x3e2ba2){if(_0x3e2ba2[_0x9419('0x35')]!==_0x9419('0x43')){var _0x18def2={};_0x18def2[_0x3e2ba2[_0x9419('0x2f')]]={'$like':'%'+_0x18ba08[_0x9419('0x36')][_0x9419('0x44')]+'%'};return _0x18def2;}})});}_0x414c72=_[_0x9419('0x45')]({},_0x414c72,_0x18ba08[_0x9419('0x46')]);var _0x29d579={'where':_0x414c72[_0x9419('0x41')]};return db[_0x9419('0x32')][_0x9419('0x25')](_0x29d579)[_0x9419('0x2b')](function(_0x37e41f){_0x4292c5[_0x9419('0x25')]=_0x37e41f;if(_0x18ba08[_0x9419('0x36')][_0x9419('0x47')]){_0x414c72[_0x9419('0x48')]=[{'all':!![]}];}return db[_0x9419('0x32')][_0x9419('0x49')](_0x414c72);})[_0x9419('0x2b')](function(_0x22d251){_0x4292c5[_0x9419('0x4a')]=_0x22d251;return _0x4292c5;})[_0x9419('0x2b')](respondWithFilteredResult(_0x326b20,_0x414c72))[_0x9419('0x4b')](handleError(_0x326b20,null));};exports[_0x9419('0x4c')]=function(_0x792135,_0x4f8793){var _0x51eb60={'raw':!![],'where':{'id':_0x792135[_0x9419('0x4d')]['id']}},_0x102c3a={};_0x102c3a[_0x9419('0x3a')]=_[_0x9419('0x37')](db['ChatGroup']['rawAttributes']);_0x102c3a[_0x9419('0x36')]=_[_0x9419('0x37')](_0x792135[_0x9419('0x36')]);_0x102c3a['filters']=_['intersection'](_0x102c3a[_0x9419('0x3a')],_0x102c3a['query']);_0x51eb60[_0x9419('0x3c')]=_[_0x9419('0x39')](_0x102c3a[_0x9419('0x3a')],qs['fields'](_0x792135[_0x9419('0x36')]['fields']));_0x51eb60['attributes']=_0x51eb60['attributes']['length']?_0x51eb60[_0x9419('0x3c')]:_0x102c3a[_0x9419('0x3a')];if(_0x792135[_0x9419('0x36')][_0x9419('0x47')]){_0x51eb60[_0x9419('0x48')]=[{'all':!![]}];}_0x51eb60=_[_0x9419('0x45')]({},_0x51eb60,_0x792135['options']);return db[_0x9419('0x32')][_0x9419('0x4e')](_0x51eb60)['then'](handleEntityNotFound(_0x4f8793,null))[_0x9419('0x2b')](respondWithResult(_0x4f8793,null))[_0x9419('0x4b')](handleError(_0x4f8793,null));};exports[_0x9419('0x4f')]=function(_0x12d17f,_0x368178){return db['ChatGroup'][_0x9419('0x4f')](_0x12d17f['body'],{})[_0x9419('0x2b')](respondWithResult(_0x368178,0xc9))[_0x9419('0x4b')](handleError(_0x368178,null));};exports[_0x9419('0x2a')]=function(_0x52c8c9,_0x1730fb){if(_0x52c8c9['body']['id']){delete _0x52c8c9[_0x9419('0x50')]['id'];}return db['ChatGroup']['find']({'where':{'id':_0x52c8c9[_0x9419('0x4d')]['id']}})[_0x9419('0x2b')](handleEntityNotFound(_0x1730fb,null))[_0x9419('0x2b')](saveUpdates(_0x52c8c9[_0x9419('0x50')],null))[_0x9419('0x2b')](respondWithResult(_0x1730fb,null))[_0x9419('0x4b')](handleError(_0x1730fb,null));};exports['destroy']=function(_0x5a1a32,_0x37bc25){return db[_0x9419('0x32')]['find']({'where':{'id':_0x5a1a32['params']['id']}})['then'](handleEntityNotFound(_0x37bc25,null))[_0x9419('0x2b')](removeEntity(_0x37bc25,null))['catch'](handleError(_0x37bc25,null));};exports[_0x9419('0x51')]=function(_0x411623,_0x659f2b){return db[_0x9419('0x32')][_0x9419('0x51')]()['then'](respondWithResult(_0x659f2b,null))[_0x9419('0x4b')](handleError(_0x659f2b,null));};exports[_0x9419('0x52')]=function(_0x24fdcf,_0x548f49,_0x521379){return db['ChatInternalMessage'][_0x9419('0x25')]({'where':{'ChatGroupId':_0x24fdcf[_0x9419('0x4d')]['id'],'ToId':_0x24fdcf[_0x9419('0x53')]['id'],'read':![]}})[_0x9419('0x2b')](function(_0x2d21f9){return{'id':_[_0x9419('0x54')](_0x24fdcf[_0x9419('0x4d')]['id']),'count':_0x2d21f9};})['then'](respondWithResult(_0x548f49,null))['catch'](handleError(_0x548f49,null));};exports[_0x9419('0x55')]=function(_0x287248,_0x531855,_0x155e8b){return db[_0x9419('0x32')][_0x9419('0x4e')]({'where':{'id':_0x287248['params']['id']}})[_0x9419('0x2b')](handleEntityNotFound(_0x531855,null))[_0x9419('0x2b')](function(_0x34a7b8){if(_0x34a7b8){return _0x34a7b8[_0x9419('0x55')](_0x287248['body'][_0x9419('0x56')],_['omit'](_0x287248[_0x9419('0x50')],[_0x9419('0x56'),'id'])||{});}})['then'](respondWithResult(_0x531855,null))[_0x9419('0x4b')](handleError(_0x531855,null));};exports[_0x9419('0x57')]=function(_0x5a9dd6,_0xfd40d0,_0x20f0d7){var _0x52f7de={};var _0x18ba2a={};var _0x34c1c6;var _0x3e1515;return db[_0x9419('0x32')]['findOne']({'where':{'id':_0x5a9dd6[_0x9419('0x4d')]['id']}})[_0x9419('0x2b')](handleEntityNotFound(_0xfd40d0,null))[_0x9419('0x2b')](function(_0x4aa621){if(_0x4aa621){_0x34c1c6=_0x4aa621;_0x18ba2a[_0x9419('0x3a')]=_[_0x9419('0x37')](db[_0x9419('0x58')][_0x9419('0x33')]);_0x18ba2a[_0x9419('0x36')]=_[_0x9419('0x37')](_0x5a9dd6[_0x9419('0x36')]);_0x18ba2a[_0x9419('0x38')]=_[_0x9419('0x39')](_0x18ba2a[_0x9419('0x3a')],_0x18ba2a[_0x9419('0x36')]);_0x52f7de[_0x9419('0x3c')]=_[_0x9419('0x39')](_0x18ba2a[_0x9419('0x3a')],qs[_0x9419('0x3b')](_0x5a9dd6[_0x9419('0x36')][_0x9419('0x3b')]));_0x52f7de[_0x9419('0x3c')]=_0x52f7de['attributes'][_0x9419('0x3d')]?_0x52f7de[_0x9419('0x3c')]:_0x18ba2a['model'];_0x52f7de[_0x9419('0x3f')]=qs[_0x9419('0x40')](_0x5a9dd6[_0x9419('0x36')][_0x9419('0x40')]);_0x52f7de['where']=qs[_0x9419('0x38')](_[_0x9419('0x42')](_0x5a9dd6[_0x9419('0x36')],_0x18ba2a[_0x9419('0x38')]));if(_0x5a9dd6[_0x9419('0x36')][_0x9419('0x44')]){_0x52f7de[_0x9419('0x41')]=_['merge'](_0x52f7de[_0x9419('0x41')],{'$or':_[_0x9419('0x31')](_0x52f7de['attributes'],function(_0x13d803){var _0x1ddef0={};_0x1ddef0[_0x13d803]={'$like':'%'+_0x5a9dd6[_0x9419('0x36')][_0x9419('0x44')]+'%'};return _0x1ddef0;})});}_0x52f7de=_['merge']({},_0x52f7de,_0x5a9dd6[_0x9419('0x46')]);return _0x34c1c6[_0x9419('0x57')](_0x52f7de);}})['then'](function(_0x38e634){if(_0x38e634){_0x3e1515=_0x38e634['length'];if(!_0x5a9dd6[_0x9419('0x36')][_0x9419('0x3e')](_0x9419('0x59'))){_0x52f7de[_0x9419('0x24')]=qs[_0x9419('0x24')](_0x5a9dd6[_0x9419('0x36')][_0x9419('0x24')]);_0x52f7de[_0x9419('0x22')]=qs[_0x9419('0x22')](_0x5a9dd6[_0x9419('0x36')][_0x9419('0x22')]);}return _0x34c1c6['getMembers'](_0x52f7de);}})['then'](function(_0x4479d9){if(_0x4479d9){return _0x4479d9?{'count':_0x3e1515,'rows':_0x4479d9}:null;}})[_0x9419('0x2b')](respondWithResult(_0xfd40d0,null))[_0x9419('0x4b')](handleError(_0xfd40d0,null));};exports['removeMembers']=function(_0x295894,_0x239c08,_0x4e4c61){return db['ChatGroup'][_0x9419('0x4e')]({'where':{'id':_0x295894['params']['id']}})[_0x9419('0x2b')](handleEntityNotFound(_0x239c08,null))[_0x9419('0x2b')](function(_0x330f66){if(_0x330f66){return _0x330f66['removeMembers'](_0x295894['query'][_0x9419('0x56')]);}})[_0x9419('0x2b')](respondWithStatusCode(_0x239c08,null))['catch'](handleError(_0x239c08,null));};exports[_0x9419('0x5a')]=function(_0xdc2815,_0x248fea,_0x4c858b){if(_0xdc2815[_0x9419('0x50')]['id']){delete _0xdc2815[_0x9419('0x50')]['id'];}return db[_0x9419('0x32')][_0x9419('0x4e')]({'where':{'id':_0xdc2815[_0x9419('0x4d')]['id']}})[_0x9419('0x2b')](handleEntityNotFound(_0x248fea,null))[_0x9419('0x2b')](function(_0x4e8ee6){if(_0x4e8ee6){_0xdc2815[_0x9419('0x50')][_0x9419('0x5b')]=_0x4e8ee6['id'];return db[_0x9419('0x5c')]['create'](_0xdc2815[_0x9419('0x50')]);}})[_0x9419('0x2b')](respondWithResult(_0x248fea,null))['catch'](handleError(_0x248fea,null));};exports[_0x9419('0x5d')]=function(_0x3ad46a,_0x315df4,_0x26f98e){var _0x281a76={};var _0x3add74={};var _0x175f58;var _0x3c79ce;return db[_0x9419('0x32')][_0x9419('0x5e')]({'where':{'id':_0x3ad46a[_0x9419('0x4d')]['id']}})[_0x9419('0x2b')](handleEntityNotFound(_0x315df4,null))['then'](function(_0x105516){if(_0x105516){_0x175f58=_0x105516;_0x3add74[_0x9419('0x3a')]=_[_0x9419('0x37')](db[_0x9419('0x5c')][_0x9419('0x33')]);_0x3add74[_0x9419('0x36')]=_[_0x9419('0x37')](_0x3ad46a[_0x9419('0x36')]);_0x3add74['filters']=_[_0x9419('0x39')](_0x3add74[_0x9419('0x3a')],_0x3add74[_0x9419('0x36')]);_0x281a76[_0x9419('0x3c')]=_[_0x9419('0x39')](_0x3add74[_0x9419('0x3a')],qs[_0x9419('0x3b')](_0x3ad46a[_0x9419('0x36')][_0x9419('0x3b')]));_0x281a76[_0x9419('0x3c')]=_0x281a76[_0x9419('0x3c')][_0x9419('0x3d')]?_0x281a76['attributes']:_0x3add74['model'];_0x281a76['order']=qs[_0x9419('0x40')](_0x3ad46a[_0x9419('0x36')][_0x9419('0x40')]);_0x281a76[_0x9419('0x41')]=qs[_0x9419('0x38')](_['pick'](_0x3ad46a[_0x9419('0x36')],_0x3add74[_0x9419('0x38')]));if(_0x3ad46a[_0x9419('0x36')][_0x9419('0x44')]){_0x281a76[_0x9419('0x41')]=_[_0x9419('0x45')](_0x281a76[_0x9419('0x41')],{'$or':_[_0x9419('0x31')](_0x281a76['attributes'],function(_0x22d211){var _0x463480={};_0x463480[_0x22d211]={'$like':'%'+_0x3ad46a[_0x9419('0x36')]['filter']+'%'};return _0x463480;})});}if(_0x3ad46a[_0x9419('0x36')][_0x9419('0x5f')]){var _0x18a194=_0x3ad46a[_0x9419('0x36')][_0x9419('0x5f')]['split'](',');var _0x41edb9={};_0x41edb9[_0x18a194[0x0]]={'$gte':moment(_0x18a194[0x1])['format'](_0x9419('0x60'))};_0x281a76['where']=_[_0x9419('0x45')](_0x281a76[_0x9419('0x41')],_0x41edb9);}_0x281a76=_[_0x9419('0x45')]({},_0x281a76,_0x3ad46a[_0x9419('0x46')]);return _0x175f58['getMessages'](_0x281a76);}})[_0x9419('0x2b')](function(_0xeb80ff){if(_0xeb80ff){_0x3c79ce=_0xeb80ff[_0x9419('0x3d')];if(!_0x3ad46a[_0x9419('0x36')][_0x9419('0x3e')](_0x9419('0x59'))){_0x281a76['limit']=qs[_0x9419('0x24')](_0x3ad46a[_0x9419('0x36')][_0x9419('0x24')]);_0x281a76[_0x9419('0x22')]=qs[_0x9419('0x22')](_0x3ad46a[_0x9419('0x36')][_0x9419('0x22')]);}return _0x175f58[_0x9419('0x5d')](_0x281a76);}})[_0x9419('0x2b')](function(_0x54e219){if(_0x54e219){return _0x54e219?{'count':_0x3c79ce,'rows':_0x54e219}:null;}})['then'](respondWithResult(_0x315df4,null))['catch'](handleError(_0x315df4,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 8aa84e2..595c1ed 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 _0xa329=['hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','update','remove','emit'];(function(_0x4c9d58,_0x1c83f0){var _0x3ad22d=function(_0xd95048){while(--_0xd95048){_0x4c9d58['push'](_0x4c9d58['shift']());}};_0x3ad22d(++_0x1c83f0);}(_0xa329,0x162));var _0x9a32=function(_0x1d3c6c,_0x56562e){_0x1d3c6c=_0x1d3c6c-0x0;var _0x3c215b=_0xa329[_0x1d3c6c];return _0x3c215b;};'use strict';var EventEmitter=require(_0x9a32('0x0'));var ChatGroup=require(_0x9a32('0x1'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x9a32('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9a32('0x3'),'afterDestroy':_0x9a32('0x4')};function emitEvent(_0x5c3175){return function(_0x5b4426,_0x3a567e,_0x38884d){ChatGroupEvents[_0x9a32('0x5')](_0x5c3175+':'+_0x5b4426['id'],_0x5b4426);ChatGroupEvents[_0x9a32('0x5')](_0x5c3175,_0x5b4426);_0x38884d(null);};}for(var e in events){if(events[_0x9a32('0x6')](e)){var event=events[e];ChatGroup[_0x9a32('0x7')](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file +var _0x2b10=['save','update','remove','emit','hasOwnProperty','hook','events','ChatGroup','setMaxListeners'];(function(_0x6ad65,_0x1a955a){var _0x159041=function(_0x8c86d){while(--_0x8c86d){_0x6ad65['push'](_0x6ad65['shift']());}};_0x159041(++_0x1a955a);}(_0x2b10,0x114));var _0x02b1=function(_0x5e7e25,_0x394941){_0x5e7e25=_0x5e7e25-0x0;var _0x4b1ae8=_0x2b10[_0x5e7e25];return _0x4b1ae8;};'use strict';var EventEmitter=require(_0x02b1('0x0'));var ChatGroup=require('../../mysqldb')['db'][_0x02b1('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x02b1('0x2')](0x0);var events={'afterCreate':_0x02b1('0x3'),'afterUpdate':_0x02b1('0x4'),'afterDestroy':_0x02b1('0x5')};function emitEvent(_0x582561){return function(_0x24f889,_0x5900ca,_0x51f63e){ChatGroupEvents[_0x02b1('0x6')](_0x582561+':'+_0x24f889['id'],_0x24f889);ChatGroupEvents[_0x02b1('0x6')](_0x582561,_0x24f889);_0x51f63e(null);};}for(var e in events){if(events[_0x02b1('0x7')](e)){var event=events[e];ChatGroup[_0x02b1('0x8')](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index ee7acc0..4f44181 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 _0xcca5=['api','moment','bluebird','path','rimraf','../../config/environment','./chatGroup.attributes','exports','define','ChatGroup','chat_groups','lodash','util'];(function(_0x589358,_0x280e1a){var _0xb5d5ae=function(_0x4cd3f8){while(--_0x4cd3f8){_0x589358['push'](_0x589358['shift']());}};_0xb5d5ae(++_0x280e1a);}(_0xcca5,0x73));var _0x5cca=function(_0x4d35f3,_0x19ba66){_0x4d35f3=_0x4d35f3-0x0;var _0x382fea=_0xcca5[_0x4d35f3];return _0x382fea;};'use strict';var _=require(_0x5cca('0x0'));var util=require(_0x5cca('0x1'));var logger=require('../../config/logger')(_0x5cca('0x2'));var moment=require(_0x5cca('0x3'));var BPromise=require(_0x5cca('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5cca('0x5'));var rimraf=require(_0x5cca('0x6'));var config=require(_0x5cca('0x7'));var attributes=require(_0x5cca('0x8'));module[_0x5cca('0x9')]=function(_0x8436a2,_0x59c4ec){return _0x8436a2[_0x5cca('0xa')](_0x5cca('0xb'),attributes,{'tableName':_0x5cca('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x273a=['bluebird','request-promise','path','../../config/environment','exports','ChatGroup','util','../../config/logger','api','moment'];(function(_0x1739e3,_0x31f4bf){var _0x238d44=function(_0x4e67f8){while(--_0x4e67f8){_0x1739e3['push'](_0x1739e3['shift']());}};_0x238d44(++_0x31f4bf);}(_0x273a,0x1dc));var _0xa273=function(_0xcbb555,_0x418f6b){_0xcbb555=_0xcbb555-0x0;var _0xf61310=_0x273a[_0xcbb555];return _0xf61310;};'use strict';var _=require('lodash');var util=require(_0xa273('0x0'));var logger=require(_0xa273('0x1'))(_0xa273('0x2'));var moment=require(_0xa273('0x3'));var BPromise=require(_0xa273('0x4'));var rp=require(_0xa273('0x5'));var fs=require('fs');var path=require(_0xa273('0x6'));var rimraf=require('rimraf');var config=require(_0xa273('0x7'));var attributes=require('./chatGroup.attributes');module[_0xa273('0x8')]=function(_0x306f2d,_0x3e96b1){return _0x306f2d['define'](_0xa273('0x9'),attributes,{'tableName':'chat_groups','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.rpc.js b/server/api/chatGroup/chatGroup.rpc.js index 0bd5cd0..ffd63a7 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 _0x705e=['moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','ChatGroup,\x20%s,\x20%s','request\x20sent','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','util'];(function(_0x327afa,_0x503bf3){var _0x45dae3=function(_0xb8116c){while(--_0xb8116c){_0x327afa['push'](_0x327afa['shift']());}};_0x45dae3(++_0x503bf3);}(_0x705e,0x107));var _0xe705=function(_0xa58570,_0x8c4ff2){_0xa58570=_0xa58570-0x0;var _0x407ff5=_0x705e[_0xa58570];return _0x407ff5;};'use strict';var _=require('lodash');var util=require(_0xe705('0x0'));var moment=require(_0xe705('0x1'));var BPromise=require(_0xe705('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe705('0x3'));var logger=require(_0xe705('0x4'))(_0xe705('0x5'));var config=require(_0xe705('0x6'));var jayson=require(_0xe705('0x7'));var client=jayson[_0xe705('0x8')][_0xe705('0x9')]({'port':0x232a});config[_0xe705('0xa')]=_[_0xe705('0xb')](config[_0xe705('0xa')],{'host':_0xe705('0xc'),'port':0x18eb});var socket=require(_0xe705('0xd'))(new Redis(config[_0xe705('0xa')]));require('./chatGroup.socket')['register'](socket);function respondWithRpcPromise(_0x192eb3,_0x1ebbe1,_0x3a9ce0){return new BPromise(function(_0x317e85,_0x334c67){return client['request'](_0x192eb3,_0x3a9ce0)['then'](function(_0x481231){logger['info'](_0xe705('0xe'),_0x1ebbe1,_0xe705('0xf'));logger['debug'](_0xe705('0x10'),_0x1ebbe1,_0xe705('0xf'),JSON[_0xe705('0x11')](_0x481231));if(_0x481231[_0xe705('0x12')]){if(_0x481231[_0xe705('0x12')]['code']===0x1f4){logger[_0xe705('0x12')](_0xe705('0xe'),_0x1ebbe1,_0x481231[_0xe705('0x12')]['message']);return _0x334c67(_0x481231[_0xe705('0x12')][_0xe705('0x13')]);}logger['error'](_0xe705('0xe'),_0x1ebbe1,_0x481231[_0xe705('0x12')][_0xe705('0x13')]);return _0x317e85(_0x481231['error'][_0xe705('0x13')]);}else{logger[_0xe705('0x14')](_0xe705('0xe'),_0x1ebbe1,_0xe705('0xf'));_0x317e85(_0x481231['result'][_0xe705('0x13')]);}})[_0xe705('0x15')](function(_0x445536){logger[_0xe705('0x12')](_0xe705('0xe'),_0x1ebbe1,_0x445536);_0x334c67(_0x445536);});});} \ No newline at end of file +var _0xd730=['util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','localhost','./chatGroup.socket','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0x39e9f4,_0x7da7be){var _0x16b495=function(_0x4e126d){while(--_0x4e126d){_0x39e9f4['push'](_0x39e9f4['shift']());}};_0x16b495(++_0x7da7be);}(_0xd730,0xfd));var _0x0d73=function(_0x1387af,_0x50f1c5){_0x1387af=_0x1387af-0x0;var _0x2bff7e=_0xd730[_0x1387af];return _0x2bff7e;};'use strict';var _=require('lodash');var util=require(_0x0d73('0x0'));var moment=require('moment');var BPromise=require(_0x0d73('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d73('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x0d73('0x3'));var logger=require(_0x0d73('0x4'))(_0x0d73('0x5'));var config=require(_0x0d73('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x0d73('0x7')][_0x0d73('0x8')]({'port':0x232a});config['redis']=_[_0x0d73('0x9')](config['redis'],{'host':_0x0d73('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0d73('0xb'))['register'](socket);function respondWithRpcPromise(_0x2db5e3,_0x1cce65,_0x1e7510){return new BPromise(function(_0x5e0fb1,_0x350876){return client['request'](_0x2db5e3,_0x1e7510)[_0x0d73('0xc')](function(_0x1c10de){logger[_0x0d73('0xd')](_0x0d73('0xe'),_0x1cce65,_0x0d73('0xf'));logger[_0x0d73('0x10')](_0x0d73('0x11'),_0x1cce65,_0x0d73('0xf'),JSON[_0x0d73('0x12')](_0x1c10de));if(_0x1c10de[_0x0d73('0x13')]){if(_0x1c10de[_0x0d73('0x13')][_0x0d73('0x14')]===0x1f4){logger[_0x0d73('0x13')]('ChatGroup,\x20%s,\x20%s',_0x1cce65,_0x1c10de[_0x0d73('0x13')][_0x0d73('0x15')]);return _0x350876(_0x1c10de[_0x0d73('0x13')][_0x0d73('0x15')]);}logger[_0x0d73('0x13')]('ChatGroup,\x20%s,\x20%s',_0x1cce65,_0x1c10de[_0x0d73('0x13')][_0x0d73('0x15')]);return _0x5e0fb1(_0x1c10de['error']['message']);}else{logger['info'](_0x0d73('0xe'),_0x1cce65,_0x0d73('0xf'));_0x5e0fb1(_0x1c10de['result']['message']);}})[_0x0d73('0x16')](function(_0x45177d){logger[_0x0d73('0x13')](_0x0d73('0xe'),_0x1cce65,_0x45177d);_0x350876(_0x45177d);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index a77ea6d..e6b734a 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 _0xab12=['update','emit','removeListener','register','length','chatGroup:','./chatGroup.events','save','remove'];(function(_0x5da187,_0x45b0a8){var _0x1a8cd6=function(_0x46530a){while(--_0x46530a){_0x5da187['push'](_0x5da187['shift']());}};_0x1a8cd6(++_0x45b0a8);}(_0xab12,0xc3));var _0x2ab1=function(_0x2f15da,_0x20c487){_0x2f15da=_0x2f15da-0x0;var _0x363fd6=_0xab12[_0x2f15da];return _0x363fd6;};'use strict';var ChatGroupEvents=require(_0x2ab1('0x0'));var events=[_0x2ab1('0x1'),_0x2ab1('0x2'),_0x2ab1('0x3')];function createListener(_0x5ada4d,_0x5bc4fa){return function(_0x4f45f6){_0x5bc4fa[_0x2ab1('0x4')](_0x5ada4d,_0x4f45f6);};}function removeListener(_0x5ca9d4,_0x533fc6){return function(){ChatGroupEvents[_0x2ab1('0x5')](_0x5ca9d4,_0x533fc6);};}exports[_0x2ab1('0x6')]=function(_0x3f5415){for(var _0xd0281=0x0,_0x5d578b=events[_0x2ab1('0x7')];_0xd0281<_0x5d578b;_0xd0281++){var _0x4498f1=events[_0xd0281];var _0x40c6a8=createListener(_0x2ab1('0x8')+_0x4498f1,_0x3f5415);ChatGroupEvents['on'](_0x4498f1,_0x40c6a8);}}; \ No newline at end of file +var _0xcc6a=['chatGroup:','./chatGroup.events','save','remove','update','emit','removeListener','register','length'];(function(_0x23b860,_0x301013){var _0x376c16=function(_0x253635){while(--_0x253635){_0x23b860['push'](_0x23b860['shift']());}};_0x376c16(++_0x301013);}(_0xcc6a,0x13c));var _0xacc6=function(_0xa0d3a6,_0x2c31dc){_0xa0d3a6=_0xa0d3a6-0x0;var _0x52b5c8=_0xcc6a[_0xa0d3a6];return _0x52b5c8;};'use strict';var ChatGroupEvents=require(_0xacc6('0x0'));var events=[_0xacc6('0x1'),_0xacc6('0x2'),_0xacc6('0x3')];function createListener(_0x5881ef,_0x43a12a){return function(_0x2438fd){_0x43a12a[_0xacc6('0x4')](_0x5881ef,_0x2438fd);};}function removeListener(_0x5e9d11,_0x274281){return function(){ChatGroupEvents[_0xacc6('0x5')](_0x5e9d11,_0x274281);};}exports[_0xacc6('0x6')]=function(_0x5084c8){for(var _0x373c9a=0x0,_0x4d0380=events[_0xacc6('0x7')];_0x373c9a<_0x4d0380;_0x373c9a++){var _0x13f466=events[_0x373c9a];var _0x5a6356=createListener(_0xacc6('0x8')+_0x13f466,_0x5084c8);ChatGroupEvents['on'](_0x13f466,_0x5a6356);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 9219c6e..488b88f 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 _0x8593=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','isAuthenticated','describe','show','/:id/unread','get','/:id/members','/:id/messages','getMessages','post','create','addMembers','addMessage','put','/:id','update','delete','destroy','removeMembers','exports','multer','util'];(function(_0x4b2037,_0x41055c){var _0x48599b=function(_0x251da3){while(--_0x251da3){_0x4b2037['push'](_0x4b2037['shift']());}};_0x48599b(++_0x41055c);}(_0x8593,0xac));var _0x3859=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x8593[_0x13e741];return _0x3f8bb3;};'use strict';var multer=require(_0x3859('0x0'));var util=require(_0x3859('0x1'));var path=require(_0x3859('0x2'));var timeout=require(_0x3859('0x3'));var express=require('express');var router=express[_0x3859('0x4')]();var fs_extra=require(_0x3859('0x5'));var auth=require(_0x3859('0x6'));var interaction=require(_0x3859('0x7'));var config=require(_0x3859('0x8'));var controller=require(_0x3859('0x9'));router['get']('/',auth[_0x3859('0xa')](),controller['index']);router['get']('/describe',auth[_0x3859('0xa')](),controller[_0x3859('0xb')]);router['get']('/:id',auth[_0x3859('0xa')](),controller[_0x3859('0xc')]);router['get'](_0x3859('0xd'),auth[_0x3859('0xa')](),controller['getUnread']);router[_0x3859('0xe')](_0x3859('0xf'),auth['isAuthenticated'](),controller['getMembers']);router['get'](_0x3859('0x10'),auth['isAuthenticated'](),controller[_0x3859('0x11')]);router[_0x3859('0x12')]('/',auth[_0x3859('0xa')](),controller[_0x3859('0x13')]);router[_0x3859('0x12')]('/:id/members',auth['isAuthenticated'](),controller[_0x3859('0x14')]);router[_0x3859('0x12')](_0x3859('0x10'),auth[_0x3859('0xa')](),controller[_0x3859('0x15')]);router[_0x3859('0x16')](_0x3859('0x17'),auth[_0x3859('0xa')](),controller[_0x3859('0x18')]);router[_0x3859('0x19')]('/:id',auth[_0x3859('0xa')](),controller[_0x3859('0x1a')]);router[_0x3859('0x19')]('/:id/members',auth[_0x3859('0xa')](),controller[_0x3859('0x1b')]);module[_0x3859('0x1c')]=router; \ No newline at end of file +var _0x87bc=['exports','multer','util','path','express','Router','../../components/auth/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/unread','getUnread','/:id/members','/:id/messages','getMessages','post','addMembers','addMessage','put','update','delete','destroy'];(function(_0xdf9b3c,_0xb472f0){var _0x5d7d6b=function(_0x2c490e){while(--_0x2c490e){_0xdf9b3c['push'](_0xdf9b3c['shift']());}};_0x5d7d6b(++_0xb472f0);}(_0x87bc,0xa9));var _0xc87b=function(_0x20d881,_0x1f2c2b){_0x20d881=_0x20d881-0x0;var _0xca999b=_0x87bc[_0x20d881];return _0xca999b;};'use strict';var multer=require(_0xc87b('0x0'));var util=require(_0xc87b('0x1'));var path=require(_0xc87b('0x2'));var timeout=require('connect-timeout');var express=require(_0xc87b('0x3'));var router=express[_0xc87b('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xc87b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc87b('0x6'));var controller=require(_0xc87b('0x7'));router[_0xc87b('0x8')]('/',auth[_0xc87b('0x9')](),controller[_0xc87b('0xa')]);router['get'](_0xc87b('0xb'),auth[_0xc87b('0x9')](),controller[_0xc87b('0xc')]);router['get'](_0xc87b('0xd'),auth[_0xc87b('0x9')](),controller[_0xc87b('0xe')]);router[_0xc87b('0x8')](_0xc87b('0xf'),auth[_0xc87b('0x9')](),controller[_0xc87b('0x10')]);router[_0xc87b('0x8')](_0xc87b('0x11'),auth['isAuthenticated'](),controller['getMembers']);router[_0xc87b('0x8')](_0xc87b('0x12'),auth[_0xc87b('0x9')](),controller[_0xc87b('0x13')]);router[_0xc87b('0x14')]('/',auth[_0xc87b('0x9')](),controller['create']);router[_0xc87b('0x14')]('/:id/members',auth[_0xc87b('0x9')](),controller[_0xc87b('0x15')]);router[_0xc87b('0x14')](_0xc87b('0x12'),auth['isAuthenticated'](),controller[_0xc87b('0x16')]);router[_0xc87b('0x17')]('/:id',auth[_0xc87b('0x9')](),controller[_0xc87b('0x18')]);router[_0xc87b('0x19')](_0xc87b('0xd'),auth[_0xc87b('0x9')](),controller[_0xc87b('0x1a')]);router['delete']('/:id/members',auth['isAuthenticated'](),controller['removeMembers']);module[_0xc87b('0x1b')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 265a50e..6cf7452 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 _0xa5b1=['ENUM','star','TEXT','DATE','STRING','long','out','BOOLEAN','exports','INTEGER'];(function(_0x230934,_0x2c07cf){var _0x336abd=function(_0x3bec8b){while(--_0x3bec8b){_0x230934['push'](_0x230934['shift']());}};_0x336abd(++_0x2c07cf);}(_0xa5b1,0x1ca));var _0x1a5b=function(_0x449e3e,_0x3e113e){_0x449e3e=_0x449e3e-0x0;var _0x6cc58a=_0xa5b1[_0x449e3e];return _0x6cc58a;};'use strict';var Sequelize=require('sequelize');module[_0x1a5b('0x0')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x1a5b('0x1')]},'ratingType':{'type':Sequelize[_0x1a5b('0x2')](_0x1a5b('0x3'),'thumb'),'defaultValue':'star'},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize[_0x1a5b('0x4')]},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x1a5b('0x5')]},'disposition':{'type':Sequelize[_0x1a5b('0x6')]},'secondDisposition':{'type':Sequelize[_0x1a5b('0x6')]},'thirdDisposition':{'type':Sequelize[_0x1a5b('0x6')]},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize[_0x1a5b('0x6')]},'osName':{'type':Sequelize[_0x1a5b('0x6')]},'osVersion':{'type':Sequelize[_0x1a5b('0x6')]},'deviceModel':{'type':Sequelize[_0x1a5b('0x6')]},'deviceVendor':{'type':Sequelize[_0x1a5b('0x6')]},'deviceType':{'type':Sequelize[_0x1a5b('0x6')]},'referer':{'type':Sequelize[_0x1a5b('0x4')]},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize['TEXT'](_0x1a5b('0x7'))},'read1stAt':{'type':Sequelize[_0x1a5b('0x5')]},'lastMsgAt':{'type':Sequelize[_0x1a5b('0x5')]},'lastMsgDirection':{'type':Sequelize[_0x1a5b('0x2')]('in',_0x1a5b('0x8')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x1a5b('0x6')]},'customerPort':{'type':Sequelize[_0x1a5b('0x6')]},'vidaooSessionId':{'type':Sequelize[_0x1a5b('0x4')]},'autoreplyExecuted':{'type':Sequelize[_0x1a5b('0x9')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x1a5b('0x1')]}}; \ No newline at end of file +var _0xc9f3=['exports','BOOLEAN','INTEGER','ENUM','star','thumb','TEXT','STRING','DATE','long','out','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc9f3,0xd7));var _0x3c9f=function(_0x2a7699,_0x3c7de8){_0x2a7699=_0x2a7699-0x0;var _0x16d9b6=_0xc9f3[_0x2a7699];return _0x16d9b6;};'use strict';var Sequelize=require(_0x3c9f('0x0'));module[_0x3c9f('0x1')]={'closed':{'type':Sequelize[_0x3c9f('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x3c9f('0x3')]},'ratingType':{'type':Sequelize[_0x3c9f('0x4')](_0x3c9f('0x5'),_0x3c9f('0x6')),'defaultValue':_0x3c9f('0x5')},'ratingMessage':{'type':Sequelize[_0x3c9f('0x7')]},'pathTranscript':{'type':Sequelize[_0x3c9f('0x7')]},'mailTranscript':{'type':Sequelize[_0x3c9f('0x8')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x3c9f('0x9')]},'disposition':{'type':Sequelize[_0x3c9f('0x8')]},'secondDisposition':{'type':Sequelize[_0x3c9f('0x8')]},'thirdDisposition':{'type':Sequelize[_0x3c9f('0x8')]},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize[_0x3c9f('0x8')]},'browserVersion':{'type':Sequelize[_0x3c9f('0x8')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize[_0x3c9f('0x8')]},'deviceVendor':{'type':Sequelize[_0x3c9f('0x8')]},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0x3c9f('0x8')]},'formData':{'type':Sequelize[_0x3c9f('0x7')](_0x3c9f('0xa'))},'read1stAt':{'type':Sequelize[_0x3c9f('0x9')]},'lastMsgAt':{'type':Sequelize[_0x3c9f('0x9')]},'lastMsgDirection':{'type':Sequelize[_0x3c9f('0x4')]('in',_0x3c9f('0xb')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x3c9f('0x8')]},'customerPort':{'type':Sequelize[_0x3c9f('0x8')]},'vidaooSessionId':{'type':Sequelize[_0x3c9f('0x7')]},'autoreplyExecuted':{'type':Sequelize[_0x3c9f('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x3c9f('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index adc449a..4969865 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 _0x2c80=['updateAttributes','customUpdate','CmContact','Contact','entity\x20not\x20found','sendStatus','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','abandon','attachmentUpload','file','originalname','basename','filename','mimetype','Attachment','attachmentDownload','Unauthorized','attachId','join','root','server/files/attachments/','offline-chat/','download','server/files/chat/upload/','transcript-%s.txt','pathTranscript','Messages','User','ChatWebsite','ContactId','UserId','format','%s%d','System','customer','agentIdentifier','website_alias','agent_alias','alias','agentAlias','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','MailServerOut','Smtp','CloudProvider','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','mailTranscript','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','keys','nolimit','sort','where','pick','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','merge','getMyMessages','hasOwnProperty','order','includeAgent','rows','addTags','Tag','color','removeTags','toString','server','files','tmp','attachments','push','lastName','createdAt','read','Account','get','Chat','Owner','N.A.','browserName','osName','referer','customerIp','customerPort','tail','createReadStream','pipe','firstName','value','renderFile','views','downloadInteraction.ejs','.pdf','createPdfFromHTML','unlinkSync','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','../../components/parsers/qs','../../components/export/pdf','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','http','client','request','info','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','status','end','json','undefined','limit','count','offset','set','Content-Range','update','then','destroy','stack','name','send','render','agent','interaction','account','map','ChatInteraction','rawAttributes','fieldName','type','getOptions','findAll','chat','query','user','show','params','filters','intersection','model','attributes','fields','length','includeAll','include','options','find','create','body','createVidaooSession','findOne','ChatWebsiteId','vidaooApiKey','vidaooTopic','vidaooNote','vidaooEscalation','fullname','contact','POST','https://api-vidaoo.xcally.com/api/v1/meetings','email','isNull','follow','vidaooMetadata','parse','metadata','Error\x20in\x20conversion\x20vidaooMetadata','Sequelize','ValidationError','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session'];(function(_0x269243,_0x53aa29){var _0xadb518=function(_0x4b178d){while(--_0x4b178d){_0x269243['push'](_0x269243['shift']());}};_0xadb518(++_0x53aa29);}(_0x2c80,0x6f));var _0x02c8=function(_0x1595ff,_0x238718){_0x1595ff=_0x1595ff-0x0;var _0x571b9d=_0x2c80[_0x1595ff];return _0x571b9d;};'use strict';var rimraf=require(_0x02c8('0x0'));var zipdir=require(_0x02c8('0x1'));var rp=require(_0x02c8('0x2'));var moment=require(_0x02c8('0x3'));var BPromise=require(_0x02c8('0x4'));var Mustache=require(_0x02c8('0x5'));var util=require(_0x02c8('0x6'));var path=require(_0x02c8('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var Redis=require('ioredis');var interaction=require('../../components/interaction/service');var qs=require(_0x02c8('0x8'));var pdf=require(_0x02c8('0x9'));var logger=require('../../config/logger')('api');var config=require(_0x02c8('0xa'));var db=require(_0x02c8('0xb'))['db'];config['redis']=_['defaults'](config[_0x02c8('0xc')],{'host':_0x02c8('0xd'),'port':0x18eb});var socket=require(_0x02c8('0xe'))(new Redis(config[_0x02c8('0xc')]));require(_0x02c8('0xf'))[_0x02c8('0x10')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x02c8('0x11')]({'port':0x232b});var client9004=jayson[_0x02c8('0x12')][_0x02c8('0x11')]({'port':0x232c});function respondWithRpcPromise(_0x1e006a,_0x219c15,_0x2b0333,_0x23b5b2){return new BPromise(function(_0x85978d,_0x2910a2){var _0x2137d0=_0x23b5b2||client;return _0x2137d0[_0x02c8('0x13')](_0x1e006a,_0x2b0333)['then'](function(_0x58ce9d){logger[_0x02c8('0x14')](_0x02c8('0x15'),_0x219c15,'request\x20sent');logger[_0x02c8('0x16')](_0x02c8('0x17'),_0x219c15,'request\x20sent',JSON[_0x02c8('0x18')](_0x58ce9d));if(_0x58ce9d[_0x02c8('0x19')]){if(_0x58ce9d['error'][_0x02c8('0x1a')]===0x1f4){logger[_0x02c8('0x19')]('ChatInteraction,\x20%s,\x20%s',_0x219c15,_0x58ce9d['error'][_0x02c8('0x1b')]);return _0x2910a2(_0x58ce9d[_0x02c8('0x19')][_0x02c8('0x1b')]);}logger[_0x02c8('0x19')]('ChatInteraction,\x20%s,\x20%s',_0x219c15,_0x58ce9d[_0x02c8('0x19')][_0x02c8('0x1b')]);return _0x85978d(_0x58ce9d['error']['message']);}else{logger['info']('ChatInteraction,\x20%s,\x20%s',_0x219c15,_0x02c8('0x1c'));_0x85978d(_0x58ce9d[_0x02c8('0x1d')]['message']);}})[_0x02c8('0x1e')](function(_0x3ea257){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x219c15,_0x3ea257);_0x2910a2(_0x3ea257);});});}function respondWithStatusCode(_0x234007,_0x4fb538){_0x4fb538=_0x4fb538||0xcc;return function(_0x5bc533){if(_0x5bc533){return _0x234007['sendStatus'](_0x4fb538);}return _0x234007[_0x02c8('0x1f')](_0x4fb538)[_0x02c8('0x20')]();};}function respondWithResult(_0x34fdab,_0x21e196){_0x21e196=_0x21e196||0xc8;return function(_0xff8c35){if(_0xff8c35){return _0x34fdab['status'](_0x21e196)[_0x02c8('0x21')](_0xff8c35);}};}function respondWithFilteredResult(_0x41ce70,_0x5ce2e7){return function(_0x2a6feb){if(_0x2a6feb){var _0x275b76=typeof _0x5ce2e7['offset']===_0x02c8('0x22')&&typeof _0x5ce2e7[_0x02c8('0x23')]===_0x02c8('0x22');var _0x4459b8=_0x2a6feb[_0x02c8('0x24')];var _0x5e0f6f=_0x275b76?0x0:_0x5ce2e7['offset'];var _0x6041f=_0x275b76?_0x2a6feb['count']:_0x5ce2e7[_0x02c8('0x25')]+_0x5ce2e7[_0x02c8('0x23')];var _0x5f5336;if(_0x6041f>=_0x4459b8){_0x6041f=_0x4459b8;_0x5f5336=0xc8;}else{_0x5f5336=0xce;}_0x41ce70['status'](_0x5f5336);return _0x41ce70[_0x02c8('0x26')](_0x02c8('0x27'),_0x5e0f6f+'-'+_0x6041f+'/'+_0x4459b8)[_0x02c8('0x21')](_0x2a6feb);}return null;};}function saveUpdates(_0xaba6f6){return function(_0x14b88a){if(_0x14b88a){return _0x14b88a[_0x02c8('0x28')](_0xaba6f6)[_0x02c8('0x29')](function(_0x34d5df){return _0x34d5df;});}return null;};}function removeEntity(_0x4f8502){return function(_0x186d4e){if(_0x186d4e){return _0x186d4e[_0x02c8('0x2a')]()['then'](function(){_0x4f8502[_0x02c8('0x1f')](0xcc)[_0x02c8('0x20')]();});}};}function handleEntityNotFound(_0x437d29){return function(_0x50f230){if(!_0x50f230){_0x437d29['sendStatus'](0x194);}return _0x50f230;};}function handleError(_0x5cf641,_0x1485ba){_0x1485ba=_0x1485ba||0x1f4;return function(_0x1aac3d){logger[_0x02c8('0x19')](_0x1aac3d[_0x02c8('0x2b')]);if(_0x1aac3d[_0x02c8('0x2c')]){delete _0x1aac3d[_0x02c8('0x2c')];}_0x5cf641[_0x02c8('0x1f')](_0x1485ba)[_0x02c8('0x2d')](_0x1aac3d);};}function getMustacheRender(_0x571051,_0x4372ad){return Mustache[_0x02c8('0x2e')](_0x571051,_['merge'](_0x4372ad['body'],{'contact':_0x4372ad['contact'],'message':_0x4372ad['message'],'agent':_0x4372ad[_0x02c8('0x2f')],'interaction':_0x4372ad[_0x02c8('0x30')],'account':_0x4372ad[_0x02c8('0x31')]}))||'';}exports['index']=function(_0x525e37,_0x43dad4){var _0x226bf9={};var _0x5c0005=_[_0x02c8('0x32')](db[_0x02c8('0x33')][_0x02c8('0x34')],function(_0x1868c2){return{'name':_0x1868c2[_0x02c8('0x35')],'type':_0x1868c2[_0x02c8('0x36')]['key']};});_0x226bf9=qs[_0x02c8('0x37')](_0x5c0005,_0x525e37);return interaction[_0x02c8('0x38')](_0x02c8('0x39'),_0x525e37[_0x02c8('0x3a')],_0x525e37[_0x02c8('0x3b')],_0x226bf9,_0x5c0005)[_0x02c8('0x29')](respondWithFilteredResult(_0x43dad4,_0x226bf9))['catch'](handleError(_0x43dad4,null));};exports[_0x02c8('0x3c')]=function(_0x17f699,_0x350a7d){var _0x5077a8={'raw':![],'where':{'id':_0x17f699[_0x02c8('0x3d')]['id']}},_0x294d60={};_0x294d60['model']=_['keys'](db[_0x02c8('0x33')]['rawAttributes']);_0x294d60[_0x02c8('0x3a')]=_['keys'](_0x17f699[_0x02c8('0x3a')]);_0x294d60[_0x02c8('0x3e')]=_[_0x02c8('0x3f')](_0x294d60[_0x02c8('0x40')],_0x294d60[_0x02c8('0x3a')]);_0x5077a8[_0x02c8('0x41')]=_[_0x02c8('0x3f')](_0x294d60[_0x02c8('0x40')],qs[_0x02c8('0x42')](_0x17f699[_0x02c8('0x3a')][_0x02c8('0x42')]));_0x5077a8[_0x02c8('0x41')]=_0x5077a8[_0x02c8('0x41')][_0x02c8('0x43')]?_0x5077a8[_0x02c8('0x41')]:_0x294d60[_0x02c8('0x40')];if(_0x17f699[_0x02c8('0x3a')][_0x02c8('0x44')]){_0x5077a8[_0x02c8('0x45')]=[{'all':!![]}];}_0x5077a8=_['merge']({},_0x5077a8,_0x17f699[_0x02c8('0x46')]);return db[_0x02c8('0x33')][_0x02c8('0x47')](_0x5077a8)[_0x02c8('0x29')](handleEntityNotFound(_0x350a7d,null))[_0x02c8('0x29')](respondWithResult(_0x350a7d,null))['catch'](handleError(_0x350a7d,null));};exports[_0x02c8('0x48')]=function(_0x3a9733,_0x3bcbf3){return db[_0x02c8('0x33')]['create'](_0x3a9733['body'],{})[_0x02c8('0x29')](respondWithResult(_0x3bcbf3,0xc9))[_0x02c8('0x1e')](handleError(_0x3bcbf3,null));};exports[_0x02c8('0x28')]=function(_0x32c652,_0x3330bf){if(_0x32c652[_0x02c8('0x49')]['id']){delete _0x32c652[_0x02c8('0x49')]['id'];}return db['ChatInteraction'][_0x02c8('0x47')]({'where':{'id':_0x32c652[_0x02c8('0x3d')]['id']}})[_0x02c8('0x29')](handleEntityNotFound(_0x3330bf,null))['then'](saveUpdates(_0x32c652[_0x02c8('0x49')],null))[_0x02c8('0x29')](respondWithResult(_0x3330bf,null))[_0x02c8('0x1e')](handleError(_0x3330bf,null));};exports[_0x02c8('0x2a')]=function(_0x4dacaf,_0x56d36f){return db['ChatInteraction']['find']({'where':{'id':_0x4dacaf[_0x02c8('0x3d')]['id']}})[_0x02c8('0x29')](handleEntityNotFound(_0x56d36f,null))['then'](removeEntity(_0x56d36f,null))[_0x02c8('0x1e')](handleError(_0x56d36f,null));};exports['describe']=function(_0x39d4b3,_0x45c6f3){return db['ChatInteraction']['describe']()[_0x02c8('0x29')](respondWithResult(_0x45c6f3,null))[_0x02c8('0x1e')](handleError(_0x45c6f3,null));};exports[_0x02c8('0x4a')]=function(_0x5dca2c,_0x399d16){var _0x21069a=_0x5dca2c[_0x02c8('0x3d')]['id'];var _0x3bf80d;var _0x3a8e15;var _0x5e71f9;return db['ChatInteraction'][_0x02c8('0x4b')]({'where':{'id':_0x21069a}})['then'](function(_0x2490d1){_0x3bf80d=_0x2490d1;return db['ChatWebsite']['findOne']({'where':{'id':_0x2490d1[_0x02c8('0x4c')]},'attributes':['id',_0x02c8('0x4d'),'vidaooEscalation',_0x02c8('0x4e'),_0x02c8('0x4f'),'vidaooMetadata'],'raw':!![]});})['then'](function(_0x2651c7){if(_0x2651c7&&_0x2651c7[_0x02c8('0x4d')]&&_0x2651c7[_0x02c8('0x50')]){_0x3a8e15=_0x2651c7;var _0x4fbf0d={'interaction':{'id':_0x21069a},'agent':{'id':_0x5dca2c[_0x02c8('0x3b')]['id'],'name':_0x5dca2c[_0x02c8('0x3b')][_0x02c8('0x2c')],'fullname':_0x5dca2c[_0x02c8('0x3b')][_0x02c8('0x51')],'email':_0x5dca2c[_0x02c8('0x3b')]['email']},'contact':_0x5dca2c[_0x02c8('0x49')][_0x02c8('0x52')],'account':_0x5dca2c['body']['account']};var _0x1bdce6={'rejectUnauthorized':![],'method':_0x02c8('0x53'),'url':_0x02c8('0x54'),'headers':{'X-APIKEY':_0x2651c7[_0x02c8('0x4d')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x5dca2c[_0x02c8('0x3b')][_0x02c8('0x55')]],'buttons':null,'topic':_0x3a8e15[_0x02c8('0x4e')],'note':_[_0x02c8('0x56')](_0x3a8e15[_0x02c8('0x4f')])?null:getMustacheRender(_0x3a8e15[_0x02c8('0x4f')],_0x4fbf0d),'metadata':null},'redirect':_0x02c8('0x57'),'json':!![]};try{if(!_[_0x02c8('0x56')](_0x3a8e15[_0x02c8('0x58')])){var _0x4ae87e=getMustacheRender(_0x3a8e15[_0x02c8('0x58')],_0x4fbf0d);var _0x1cf59e=JSON[_0x02c8('0x59')](_0x4ae87e);_0x1bdce6['body'][_0x02c8('0x5a')]=_0x1cf59e;}}catch(_0x53afe9){throw new db['Sequelize']['ValidationError'](_0x02c8('0x5b'));}return rp(_0x1bdce6);}else{throw new db[(_0x02c8('0x5c'))][(_0x02c8('0x5d'))]('Error\x20in\x20Vidaoo\x20configuration');}})[_0x02c8('0x29')](function(_0x3dc69b){_0x5e71f9=_0x3dc69b;if(_0x5e71f9['id']){var _0x1c0009={'body':_0x5e71f9[_0x02c8('0x5e')],'ChatWebsiteId':_0x3a8e15['id'],'ChatInteractionId':_0x3bf80d['id'],'direction':_0x02c8('0x5f'),'UserId':_0x5dca2c[_0x02c8('0x3b')]['id']};return db[_0x02c8('0x60')][_0x02c8('0x48')](_0x1c0009,{});}else{throw new db['Sequelize'][(_0x02c8('0x5d'))](_0x02c8('0x61'));}})[_0x02c8('0x29')](function(){return _0x3bf80d[_0x02c8('0x62')]({'vidaooSessionId':_0x5e71f9['id']});})[_0x02c8('0x29')](respondWithResult(_0x399d16,null))[_0x02c8('0x1e')](handleError(_0x399d16,null));};exports[_0x02c8('0x63')]=function(_0x3141ae,_0x2d9d32){if(_0x3141ae[_0x02c8('0x49')]['id']){delete _0x3141ae[_0x02c8('0x49')]['id'];}return db['ChatInteraction'][_0x02c8('0x47')]({'where':{'id':_0x3141ae[_0x02c8('0x3d')]['id']},'include':[{'model':db[_0x02c8('0x64')],'as':_0x02c8('0x65')}]})[_0x02c8('0x29')](handleEntityNotFound(_0x2d9d32,null))[_0x02c8('0x29')](saveUpdates(_0x3141ae[_0x02c8('0x49')],null))['then'](respondWithResult(_0x2d9d32,null))[_0x02c8('0x1e')](handleError(_0x2d9d32,null));};exports['abandon']=function(_0x20f73f,_0x2c2e9c){if(_0x20f73f[_0x02c8('0x49')]['id']){delete _0x20f73f[_0x02c8('0x49')]['id'];}return db[_0x02c8('0x33')][_0x02c8('0x47')]({'where':{'id':_0x20f73f[_0x02c8('0x3d')]['id']}})[_0x02c8('0x29')](function(_0xd757f5){if(!_0xd757f5){logger[_0x02c8('0x19')]('abandonInteraction,\x20%s,\x20%s,\x20%s','abandon',0x194,_0x02c8('0x66'));_0x2c2e9c[_0x02c8('0x67')](0x194);}else{if(_0xd757f5['UserId']){throw new db['Sequelize'][(_0x02c8('0x5d'))](_0x02c8('0x68'));}}return _0xd757f5;})[_0x02c8('0x29')](function(_0x396e04){if(_0x396e04){return _0x396e04[_0x02c8('0x28')]({'closed':_0x20f73f['body'][_0x02c8('0x69')],'disposition':_0x20f73f[_0x02c8('0x49')][_0x02c8('0x6a')]})[_0x02c8('0x29')](function(_0x1d9b76){return _0x1d9b76;});}})[_0x02c8('0x29')](function(){return respondWithRpcPromise(_0x02c8('0x6b'),_0x02c8('0x6c'),_0x20f73f['body'],client9004);})[_0x02c8('0x29')](respondWithResult(_0x2c2e9c,null))[_0x02c8('0x1e')](handleError(_0x2c2e9c,null));};exports[_0x02c8('0x6d')]=function(_0x12fb62,_0x4e3f6c){_0x12fb62[_0x02c8('0x49')][_0x02c8('0x2c')]=_0x12fb62[_0x02c8('0x6e')][_0x02c8('0x6f')];_0x12fb62[_0x02c8('0x49')][_0x02c8('0x70')]=_0x12fb62[_0x02c8('0x6e')][_0x02c8('0x71')];_0x12fb62[_0x02c8('0x49')][_0x02c8('0x36')]=_0x12fb62[_0x02c8('0x6e')][_0x02c8('0x72')];return db[_0x02c8('0x73')]['create'](_0x12fb62['body'])['then'](respondWithResult(_0x4e3f6c,0xc9))['catch'](handleError(_0x4e3f6c,null));};exports[_0x02c8('0x74')]=function(_0x24018b,_0x255b5d){return db[_0x02c8('0x33')][_0x02c8('0x4b')]({'where':{'id':_0x24018b[_0x02c8('0x3d')]['id']},'raw':!![]})[_0x02c8('0x29')](handleEntityNotFound(_0x255b5d,null))[_0x02c8('0x29')](function(_0x3fcc51){if(_0x3fcc51){if(_0x3fcc51['closed']){return _0x255b5d[_0x02c8('0x1f')](0x193)['json']({'status':0x193,'message':_0x02c8('0x75')});}return db['Attachment'][_0x02c8('0x4b')]({'where':{'id':_0x24018b[_0x02c8('0x3a')][_0x02c8('0x76')]},'raw':!![]})[_0x02c8('0x29')](handleEntityNotFound(_0x255b5d,null));}})['then'](function(_0x21e0e9){if(_0x21e0e9){var _0x590320=_0x21e0e9['ChatOfflineMessageId']!==null;var _0x43f856=path[_0x02c8('0x77')](config[_0x02c8('0x78')],_0x02c8('0x79'));if(_0x590320){_0x43f856=path[_0x02c8('0x77')](_0x43f856,_0x02c8('0x7a'));}var _0x5834e3=path[_0x02c8('0x77')](_0x43f856,_0x21e0e9[_0x02c8('0x70')]);return _0x255b5d[_0x02c8('0x7b')](_0x5834e3);}})[_0x02c8('0x1e')](handleError(_0x255b5d,null));};exports['close']=function(_0x3b3413,_0x246a49){var _0xad543b=null;var _0x91ddc0=null;var _0x2c11eb=null;if(_0x3b3413[_0x02c8('0x49')]['id']){delete _0x3b3413[_0x02c8('0x49')]['id'];}if(_0x3b3413[_0x02c8('0x49')]['mailTranscript']){_0x2c11eb=path[_0x02c8('0x77')](config[_0x02c8('0x78')],_0x02c8('0x7c'),util['format'](_0x02c8('0x7d'),Date['now']()));_0x3b3413[_0x02c8('0x49')][_0x02c8('0x7e')]=_0x2c11eb;}return db[_0x02c8('0x33')][_0x02c8('0x47')]({'where':{'id':_0x3b3413[_0x02c8('0x3d')]['id']},'include':[{'model':db[_0x02c8('0x60')],'as':_0x02c8('0x7f'),'include':[{'model':db[_0x02c8('0x80')],'as':_0x02c8('0x80')}]}]})[_0x02c8('0x29')](handleEntityNotFound(_0x246a49,null))[_0x02c8('0x29')](saveUpdates(_0x3b3413[_0x02c8('0x49')],null))[_0x02c8('0x29')](function(_0x1d9156){if(_0x1d9156){_0xad543b=_0x1d9156;return db[_0x02c8('0x81')][_0x02c8('0x47')]({'where':{'id':_0xad543b[_0x02c8('0x4c')]}});}})[_0x02c8('0x29')](function(_0x1973fc){if(_0x1973fc){_0x91ddc0=_0x1973fc;return db['CmContact'][_0x02c8('0x47')]({'where':{'id':_0xad543b[_0x02c8('0x82')]}});}})[_0x02c8('0x29')](function(_0xddd2b){if(_0xddd2b){if(_0x2c11eb){var _0x15d1c9=null;for(var _0x447ad9=0x1;_0x447ad9<_0xad543b[_0x02c8('0x7f')][_0x02c8('0x43')];++_0x447ad9){_0x15d1c9=_0xad543b['Messages'][_0x447ad9];var _0x2538a1=_0x15d1c9[_0x02c8('0x83')]?util[_0x02c8('0x84')](_0x02c8('0x85'),_0x91ddc0['agentAlias'],_0x15d1c9[_0x02c8('0x83')]):_0x02c8('0x86');var _0x5b4f92=_0x3b3413['body'][_0x02c8('0x87')]||util[_0x02c8('0x84')]('%s%d','Visitor',_0x15d1c9[_0x02c8('0x82')]);switch(_0x91ddc0[_0x02c8('0x88')]){case _0x02c8('0x89'):_0x2538a1=_0x15d1c9[_0x02c8('0x83')]?util['format'](_0x02c8('0x85'),_0x91ddc0['agentAlias'],_0x15d1c9[_0x02c8('0x83')]):_0x02c8('0x86');break;case _0x02c8('0x8a'):_0x2538a1=_0x15d1c9[_0x02c8('0x83')]?_0x15d1c9[_0x02c8('0x80')][_0x02c8('0x8b')]||_0x15d1c9[_0x02c8('0x80')][_0x02c8('0x51')]:_0x02c8('0x86');break;case'agent_fullname':_0x2538a1=_0x15d1c9[_0x02c8('0x83')]?_0x15d1c9[_0x02c8('0x80')][_0x02c8('0x51')]:_0x02c8('0x86');break;default:_0x2538a1=_0x15d1c9[_0x02c8('0x83')]?util[_0x02c8('0x84')](_0x02c8('0x85'),_0x91ddc0[_0x02c8('0x8c')],_0x15d1c9[_0x02c8('0x83')]):'System';}var _0x459c83=util[_0x02c8('0x84')]('[%s]\x20%s:\x20%s\x0a',moment(_0x15d1c9['createdAt'])['format'](_0x02c8('0x8d')),_0x15d1c9[_0x02c8('0x8e')]==='in'?_0x5b4f92:_0x2538a1,_0x15d1c9[_0x02c8('0x49')]);if(!_0x15d1c9[_0x02c8('0x8f')]){fs[_0x02c8('0x90')](_0x2c11eb,_0x459c83);}}return db[_0x02c8('0x91')][_0x02c8('0x4b')]({'where':{'service':!![]},'include':[{'model':db[_0x02c8('0x92')],'as':_0x02c8('0x93'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x02c8('0x94'),'raw':!![]}]}]});}}})[_0x02c8('0x29')](function(_0x2cb21a){if(!_0x2cb21a||!_0x2cb21a[_0x02c8('0x93')]||!_0x3b3413[_0x02c8('0x49')])return _0xad543b;var _0x1f9d58=_0x2cb21a[_0x02c8('0x95')]();return respondWithRpcPromise(_0x02c8('0x96'),_0x02c8('0x97'),{'account':_0x1f9d58,'message':{'from':util[_0x02c8('0x84')](_0x02c8('0x98'),_0x2cb21a[_0x02c8('0x2c')],_0x2cb21a[_0x02c8('0x55')]||_0x2cb21a['Smtp'][_0x02c8('0x3b')]),'to':_0x3b3413['body'][_0x02c8('0x99')],'subject':_0x02c8('0x9a'),'text':util[_0x02c8('0x84')](_0x02c8('0x9b'),_0x3b3413[_0x02c8('0x49')][_0x02c8('0x99')]),'attachments':[{'path':_0x2c11eb}]}})['then'](function(){return _0xad543b;})['catch'](function(_0x3412fe){logger[_0x02c8('0x19')](_0x3412fe);});})['then'](respondWithStatusCode(_0x246a49,0xc8))[_0x02c8('0x1e')](handleError(_0x246a49,null));};exports['addMessage']=function(_0x140166,_0x1ecb84){return db[_0x02c8('0x60')]['find']({'where':{'id':_0x140166[_0x02c8('0x3d')]['id']}})[_0x02c8('0x29')](handleEntityNotFound(_0x1ecb84,null))['then'](function(_0xb61fdc){if(_0xb61fdc){return _0xb61fdc[_0x02c8('0x9c')](_0x140166[_0x02c8('0x49')][_0x02c8('0x9d')],_[_0x02c8('0x9e')](_0x140166[_0x02c8('0x49')],[_0x02c8('0x9d'),'id'])||{});}})['then'](respondWithResult(_0x1ecb84,null))[_0x02c8('0x1e')](handleError(_0x1ecb84,null));};exports[_0x02c8('0x9f')]=function(_0x41b64d,_0x12ca69){var _0x539e65={'raw':![],'where':{}};var _0x32f533={};var _0x7e3ba7={'count':0x0,'rows':[]};return db['ChatInteraction']['findOne']({'where':{'id':_0x41b64d['params']['id']}})[_0x02c8('0x29')](handleEntityNotFound(_0x12ca69,null))[_0x02c8('0x29')](function(_0x268c69){if(_0x268c69){_0x32f533[_0x02c8('0x40')]=_[_0x02c8('0xa0')](db[_0x02c8('0x60')]['rawAttributes']);_0x32f533['query']=_[_0x02c8('0xa0')](_0x41b64d[_0x02c8('0x3a')]);_0x32f533[_0x02c8('0x3e')]=_[_0x02c8('0x3f')](_0x32f533['model'],_0x32f533[_0x02c8('0x3a')]);_0x539e65[_0x02c8('0x41')]=_[_0x02c8('0x3f')](_0x32f533['model'],qs[_0x02c8('0x42')](_0x41b64d[_0x02c8('0x3a')]['fields']));_0x539e65[_0x02c8('0x41')]=_0x539e65[_0x02c8('0x41')][_0x02c8('0x43')]?_0x539e65['attributes']:_0x32f533['model'];if(!_0x41b64d[_0x02c8('0x3a')]['hasOwnProperty'](_0x02c8('0xa1'))){_0x539e65['limit']=qs[_0x02c8('0x23')](_0x41b64d[_0x02c8('0x3a')][_0x02c8('0x23')]);_0x539e65['offset']=qs[_0x02c8('0x25')](_0x41b64d[_0x02c8('0x3a')][_0x02c8('0x25')]);}_0x539e65['order']=qs[_0x02c8('0xa2')](_0x41b64d['query']['sort']);_0x539e65[_0x02c8('0xa3')]=qs[_0x02c8('0x3e')](_[_0x02c8('0xa4')](_0x41b64d[_0x02c8('0x3a')],_0x32f533[_0x02c8('0x3e')]));_0x539e65[_0x02c8('0xa3')]['ChatInteractionId']=_0x268c69['id'];if(_0x41b64d[_0x02c8('0x3a')][_0x02c8('0xa5')]){_0x539e65[_0x02c8('0xa3')]=_['merge'](_0x539e65[_0x02c8('0xa3')],{'$or':_['map'](_0x539e65['attributes'],function(_0x258e66){var _0x3eeaf1={};_0x3eeaf1[_0x258e66]={'$like':'%'+_0x41b64d[_0x02c8('0x3a')][_0x02c8('0xa5')]+'%'};return _0x3eeaf1;})});}if(_0x41b64d[_0x02c8('0x3a')][_0x02c8('0xa6')]){var _0x5aee90=_0x41b64d[_0x02c8('0x3a')]['$gte'][_0x02c8('0xa7')](',');var _0x33a2cc={};_0x33a2cc[_0x5aee90[0x0]]={'$gte':moment(_0x5aee90[0x1])['format'](_0x02c8('0xa8'))};_0x539e65[_0x02c8('0xa3')]=_[_0x02c8('0xa9')](_0x539e65['where'],_0x33a2cc);}_0x539e65=_[_0x02c8('0xa9')]({},_0x539e65,_0x41b64d[_0x02c8('0x46')]);return db[_0x02c8('0x60')][_0x02c8('0x24')]({'where':_0x539e65['where']})['then'](function(_0x5702ae){_0x7e3ba7[_0x02c8('0x24')]=_0x5702ae;if(_0x41b64d[_0x02c8('0x3a')][_0x02c8('0x44')]){_0x539e65[_0x02c8('0x45')]=[{'all':!![]}];}return db[_0x02c8('0x60')][_0x02c8('0x38')](_0x539e65);})['then'](function(_0x2a001a){_0x7e3ba7['rows']=_0x2a001a;return _0x7e3ba7;});}})[_0x02c8('0x29')](respondWithFilteredResult(_0x12ca69,_0x539e65))['catch'](handleError(_0x12ca69,null));};exports[_0x02c8('0xaa')]=function(_0x51a179,_0x27a89a){var _0x4eb78a={'where':{}},_0x1549df={},_0x3cbae5={'count':0x0,'rows':[]};return db[_0x02c8('0x33')][_0x02c8('0x4b')]({'where':{'id':_0x51a179[_0x02c8('0x3d')]['id']}})[_0x02c8('0x29')](handleEntityNotFound(_0x27a89a,null))[_0x02c8('0x29')](function(_0x43ea25){if(_0x43ea25){_0x1549df['model']=_[_0x02c8('0xa0')](db[_0x02c8('0x60')][_0x02c8('0x34')]);_0x1549df[_0x02c8('0x3a')]=_[_0x02c8('0xa0')](_0x51a179['query']);_0x1549df[_0x02c8('0x3e')]=_[_0x02c8('0x3f')](_0x1549df['model'],_0x1549df[_0x02c8('0x3a')]);_0x4eb78a[_0x02c8('0x41')]=_[_0x02c8('0x3f')](_0x1549df['model'],qs['fields'](_0x51a179['query']['fields']));_0x4eb78a[_0x02c8('0x41')]=_0x4eb78a[_0x02c8('0x41')][_0x02c8('0x43')]?_0x4eb78a[_0x02c8('0x41')]:_0x1549df[_0x02c8('0x40')];if(!_0x51a179[_0x02c8('0x3a')][_0x02c8('0xab')](_0x02c8('0xa1'))){_0x4eb78a[_0x02c8('0x23')]=qs[_0x02c8('0x23')](_0x51a179[_0x02c8('0x3a')][_0x02c8('0x23')]);_0x4eb78a['offset']=qs[_0x02c8('0x25')](_0x51a179[_0x02c8('0x3a')][_0x02c8('0x25')]);}_0x4eb78a[_0x02c8('0xac')]=qs['sort'](_0x51a179['query']['sort']);_0x4eb78a[_0x02c8('0xa3')]=qs['filters'](_[_0x02c8('0xa4')](_0x51a179[_0x02c8('0x3a')],_0x1549df[_0x02c8('0x3e')]));_0x4eb78a['where']['ChatInteractionId']=_0x43ea25['id'];if(_0x51a179[_0x02c8('0x3a')][_0x02c8('0xa5')]){_0x4eb78a[_0x02c8('0xa3')]=_[_0x02c8('0xa9')](_0x4eb78a[_0x02c8('0xa3')],{'$or':_[_0x02c8('0x32')](_0x4eb78a[_0x02c8('0x41')],function(_0x1b9f79){var _0x32adf7={};_0x32adf7[_0x1b9f79]={'$like':'%'+_0x51a179['query'][_0x02c8('0xa5')]+'%'};return _0x32adf7;})});}_0x4eb78a[_0x02c8('0xa3')][_0x02c8('0x8f')]=![];if(_0x51a179['query']['id']){_0x4eb78a[_0x02c8('0xa3')]['id']={'$gt':_0x51a179[_0x02c8('0x3a')]['id']};}_0x4eb78a=_[_0x02c8('0xa9')]({},_0x4eb78a,_0x51a179[_0x02c8('0x46')]);return db['ChatMessage'][_0x02c8('0x24')]({'where':_0x4eb78a[_0x02c8('0xa3')]})[_0x02c8('0x29')](function(_0x44b1a4){_0x3cbae5[_0x02c8('0x24')]=_0x44b1a4;_0x4eb78a[_0x02c8('0x45')]=[];if(_0x51a179[_0x02c8('0x3a')][_0x02c8('0xad')]){_0x4eb78a[_0x02c8('0x45')]['push']({'model':db['User'],'as':'User','attributes':['id',_0x02c8('0x51'),_0x02c8('0x8b')]});}if(_0x51a179[_0x02c8('0x3a')][_0x02c8('0x44')]){_0x4eb78a[_0x02c8('0x45')]=[{'all':!![]}];}return db[_0x02c8('0x60')][_0x02c8('0x38')](_0x4eb78a);})[_0x02c8('0x29')](function(_0x1830d4){_0x3cbae5[_0x02c8('0xae')]=_0x1830d4;return _0x3cbae5;});}})[_0x02c8('0x29')](respondWithFilteredResult(_0x27a89a,_0x4eb78a))['catch'](handleError(_0x27a89a,null));};exports[_0x02c8('0xaf')]=function(_0x15bf68,_0x202d6c){return db['ChatInteraction']['find']({'where':{'id':_0x15bf68[_0x02c8('0x3d')]['id']}})[_0x02c8('0x29')](handleEntityNotFound(_0x202d6c,null))['then'](function(_0x57e522){if(_0x57e522){return _0x57e522['setTags'](_0x15bf68[_0x02c8('0x49')]['ids'],_[_0x02c8('0x9e')](_0x15bf68[_0x02c8('0x49')],[_0x02c8('0x9d'),'id'])||{})['spread'](function(){return db[_0x02c8('0xb0')][_0x02c8('0x38')]({'attributes':['id',_0x02c8('0x2c'),_0x02c8('0xb1')],'where':{'id':_0x15bf68[_0x02c8('0x49')][_0x02c8('0x9d')]}});})['then'](function(_0x78dfac){socket['emit']('chatInteractionTags:save',{'id':Number(_0x15bf68[_0x02c8('0x3d')]['id']),'tags':_0x78dfac||[]});return{'id':Number(_0x15bf68[_0x02c8('0x3d')]['id']),'tags':_0x78dfac||[]};});}})['then'](respondWithResult(_0x202d6c,null))[_0x02c8('0x1e')](handleError(_0x202d6c,null));};exports[_0x02c8('0xb2')]=function(_0x254488,_0x3d3eaa){return db[_0x02c8('0x33')][_0x02c8('0x47')]({'where':{'id':_0x254488[_0x02c8('0x3d')]['id']}})[_0x02c8('0x29')](handleEntityNotFound(_0x3d3eaa,null))['then'](function(_0xf3a712){if(_0xf3a712){return _0xf3a712[_0x02c8('0xb2')](_0x254488[_0x02c8('0x3a')][_0x02c8('0x9d')]);}})[_0x02c8('0x29')](respondWithStatusCode(_0x3d3eaa,null))[_0x02c8('0x1e')](handleError(_0x3d3eaa,null));};exports[_0x02c8('0x7b')]=function(_0x59fb07,_0x5ba876){var _0x2fceab=moment()['unix']()[_0x02c8('0xb3')]();var _0x254ca0=path[_0x02c8('0x77')](config['root'],_0x02c8('0xb4'),_0x02c8('0xb5'),_0x02c8('0xb6'));var _0x31b06f=path['join'](config[_0x02c8('0x78')],_0x02c8('0xb4'),_0x02c8('0xb5'),_0x02c8('0xb7'));var _0x5bf4d3=path['join'](_0x254ca0,_0x2fceab);var _0x1f81df=util[_0x02c8('0x84')]('transcript-%d-%s.zip',_0x59fb07['params']['id'],_0x2fceab);var _0x327444=path[_0x02c8('0x77')](_0x254ca0,_0x1f81df);var _0x34472b=[];_0x34472b[_0x02c8('0xb8')]({'model':db[_0x02c8('0x80')],'as':_0x02c8('0x80'),'attributes':['id',_0x02c8('0x51')],'raw':!![]});_0x34472b[_0x02c8('0xb8')]({'model':db['CmContact'],'as':_0x02c8('0x65'),'attributes':['id','firstName',_0x02c8('0xb9')],'raw':!![]});if(_0x59fb07[_0x02c8('0x3a')][_0x02c8('0xb7')]){_0x34472b[_0x02c8('0xb8')]({'model':db['Attachment'],'as':_0x02c8('0x73'),'raw':!![]});}var _0x8c5cd6=[{'model':db[_0x02c8('0x60')],'as':_0x02c8('0x7f'),'attributes':['id','body',_0x02c8('0xba'),'direction','secret',_0x02c8('0xbb')],'include':_0x34472b}];_0x8c5cd6[_0x02c8('0xb8')]({'model':db[_0x02c8('0x81')],'as':_0x02c8('0xbc'),'attributes':['id',_0x02c8('0x2c')]});_0x8c5cd6[_0x02c8('0xb8')]({'model':db[_0x02c8('0x80')],'as':'Owner','attributes':['id','fullname']});return db[_0x02c8('0x33')][_0x02c8('0x47')]({'where':{'id':_0x59fb07[_0x02c8('0x3d')]['id']},'include':_0x8c5cd6})[_0x02c8('0x29')](handleEntityNotFound(_0x5ba876,null))[_0x02c8('0x29')](function(_0x5c2e78){if(_0x5c2e78){var _0x48da13=_0x5c2e78[_0x02c8('0xbd')]({'plain':!![]});fs['mkdirSync'](_0x5bf4d3);var _0x2b5af1={'channel':_0x02c8('0xbe'),'account':_0x48da13[_0x02c8('0xbc')]['name'],'agent':_0x48da13[_0x02c8('0xbf')]?_0x48da13[_0x02c8('0xbf')][_0x02c8('0x51')]:_0x02c8('0xc0'),'createdAt':moment(_0x48da13['createdAt'])[_0x02c8('0x84')](_0x02c8('0xa8'))[_0x02c8('0xb3')](),'closedAt':_0x48da13[_0x02c8('0x69')]?moment(_0x48da13['closedAt'])[_0x02c8('0x84')](_0x02c8('0xa8'))[_0x02c8('0xb3')]():'','disposition':_0x48da13['disposition'],'chatInfo':{'browser':_0x48da13[_0x02c8('0xc1')],'os':_0x48da13[_0x02c8('0xc2')],'referer':_0x48da13[_0x02c8('0xc3')],'customerIp':_0x48da13[_0x02c8('0xc4')],'customerPort':_0x48da13[_0x02c8('0xc5')]?_0x48da13[_0x02c8('0xc5')]:_0x02c8('0xc0')},'messages':_(_0x48da13[_0x02c8('0x7f')])[_0x02c8('0xc6')]()['filter']({'secret':![]})['map'](function(_0x47f88d){if(_0x47f88d[_0x02c8('0x73')]){var _0x495cdc=path[_0x02c8('0x77')](_0x31b06f,_0x47f88d[_0x02c8('0x73')]['basename']);if(fs['existsSync'](_0x495cdc)){fs[_0x02c8('0xc7')](_0x495cdc)[_0x02c8('0xc8')](fs['createWriteStream'](path[_0x02c8('0x77')](_0x5bf4d3,_0x47f88d[_0x02c8('0x73')][_0x02c8('0x70')])));}}return{'date':moment(_0x47f88d[_0x02c8('0xba')])[_0x02c8('0x84')](_0x02c8('0xa8'))[_0x02c8('0xb3')](),'sender':_0x47f88d[_0x02c8('0x8e')]===_0x02c8('0x5f')?_0x47f88d[_0x02c8('0x80')]?_0x47f88d[_0x02c8('0x80')][_0x02c8('0x51')]:_0x02c8('0x86'):_0x47f88d[_0x02c8('0x65')][_0x02c8('0xc9')]+(_0x47f88d['Contact'][_0x02c8('0xb9')]?'\x20'+_0x47f88d[_0x02c8('0x65')][_0x02c8('0xb9')]:''),'body':_0x47f88d['Attachment']?_0x47f88d[_0x02c8('0x73')]['basename']:_0x47f88d[_0x02c8('0x49')],'direction':_0x47f88d[_0x02c8('0x8e')]==='out'?'A':'C','secret':_0x47f88d[_0x02c8('0x8f')],'read':_0x47f88d[_0x02c8('0xbb')],'attachment':_0x47f88d[_0x02c8('0x73')]};})[_0x02c8('0xca')]()};return ejs[_0x02c8('0xcb')](path[_0x02c8('0x77')](config['root'],_0x02c8('0xb4'),_0x02c8('0xcc'),_0x02c8('0xcd')),{'interaction':_0x2b5af1})['then'](function(_0x137913){var _0x4c3914=path[_0x02c8('0x77')](_0x5bf4d3,'transcript-'+_0x48da13['id']+'-'+_0x2fceab+_0x02c8('0xce'));var _0x1c9e8d={'path':_0x4c3914,'channel':'Chat','interactionId':_0x48da13['id']};return pdf[_0x02c8('0xcf')](_0x137913,_0x1c9e8d);})['then'](function(){return new Promise(function(_0x4588ff,_0x1d0c01){zipdir(_0x5bf4d3,{'saveTo':_0x327444},function(_0x3ce558,_0x1b284d){if(_0x3ce558)return _0x1d0c01(_0x3ce558);return _0x4588ff(_0x1b284d);});})['then'](function(){return new BPromise(function(_0x36ce48,_0x544f42){rimraf(_0x5bf4d3,function(_0x1780da){if(_0x1780da)_0x544f42(_0x1780da);return _0x36ce48();});});})[_0x02c8('0x29')](function(){return _0x5ba876[_0x02c8('0x7b')](_0x327444,_0x1f81df,function(_0x5dedbd){if(_0x5dedbd){logger[_0x02c8('0x19')]('err',_0x5dedbd);}else{fs[_0x02c8('0xd0')](_0x327444);}});});});}else{return _0x5ba876[_0x02c8('0x67')](0xc8);}})['catch'](handleError(_0x5ba876,null));}; \ No newline at end of file +var _0xf86d=['includeAgent','addTags','omit','spread','color','emit','removeTags','unix','server','files','tmp','attachments','push','firstName','lastName','direction','read','Account','get','mkdirSync','Chat','Owner','N.A.','toString','closedAt','browserName','osName','customerPort','tail','existsSync','createReadStream','createWriteStream','Contact','renderFile','transcript-','.pdf','createPdfFromHTML','err','unlinkSync','rimraf','request-promise','moment','mustache','path','ejs','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','client','http','request','then','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','code','message','info','result','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','update','stack','name','send','render','merge','contact','agent','interaction','account','index','map','ChatInteraction','fieldName','key','getOptions','findAll','query','catch','show','params','model','keys','filters','attributes','intersection','includeAll','options','find','create','body','destroy','describe','createVidaooSession','findOne','ChatWebsiteId','vidaooEscalation','vidaooNote','vidaooApiKey','user','fullname','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','vidaooTopic','isNull','follow','vidaooMetadata','parse','metadata','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','join_url','out','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','UserId','Interaction\x20already\x20assigned','disposition','attachmentUpload','file','originalname','basename','type','mimetype','Attachment','attachmentDownload','closed','json','ChatOfflineMessageId','join','server/files/attachments/','offline-chat/','download','mailTranscript','root','server/files/chat/upload/','format','transcript-%s.txt','now','ChatMessage','Messages','User','ChatWebsite','length','%s%d','System','ContactId','website_alias','agent_alias','alias','agent_fullname','agentAlias','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','secret','appendFileSync','MailAccount','Smtp','CloudProvider','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','addMessage','ids','rawAttributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','ChatInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','include','rows','getMyMessages'];(function(_0x40d731,_0x427072){var _0x48c44f=function(_0x3561e8){while(--_0x3561e8){_0x40d731['push'](_0x40d731['shift']());}};_0x48c44f(++_0x427072);}(_0xf86d,0xf9));var _0xdf86=function(_0x26462c,_0xd20a35){_0x26462c=_0x26462c-0x0;var _0x509a42=_0xf86d[_0x26462c];return _0x509a42;};'use strict';var rimraf=require(_0xdf86('0x0'));var zipdir=require('zip-dir');var rp=require(_0xdf86('0x1'));var moment=require(_0xdf86('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xdf86('0x3'));var util=require('util');var path=require(_0xdf86('0x4'));var ejs=require(_0xdf86('0x5'));var fs=require('fs');var _=require('lodash');var Redis=require('ioredis');var interaction=require(_0xdf86('0x6'));var qs=require(_0xdf86('0x7'));var pdf=require(_0xdf86('0x8'));var logger=require(_0xdf86('0x9'))(_0xdf86('0xa'));var config=require(_0xdf86('0xb'));var db=require(_0xdf86('0xc'))['db'];config['redis']=_[_0xdf86('0xd')](config['redis'],{'host':_0xdf86('0xe'),'port':0x18eb});var socket=require(_0xdf86('0xf'))(new Redis(config['redis']));require(_0xdf86('0x10'))[_0xdf86('0x11')](socket);var jayson=require(_0xdf86('0x12'));var client=jayson[_0xdf86('0x13')][_0xdf86('0x14')]({'port':0x232b});var client9004=jayson[_0xdf86('0x13')][_0xdf86('0x14')]({'port':0x232c});function respondWithRpcPromise(_0x59be07,_0x251db7,_0x10d5ee,_0x2ab2aa){return new BPromise(function(_0x3c824f,_0x984136){var _0x359455=_0x2ab2aa||client;return _0x359455[_0xdf86('0x15')](_0x59be07,_0x10d5ee)[_0xdf86('0x16')](function(_0x56cb31){logger['info'](_0xdf86('0x17'),_0x251db7,_0xdf86('0x18'));logger[_0xdf86('0x19')](_0xdf86('0x1a'),_0x251db7,_0xdf86('0x18'),JSON['stringify'](_0x56cb31));if(_0x56cb31[_0xdf86('0x1b')]){if(_0x56cb31[_0xdf86('0x1b')][_0xdf86('0x1c')]===0x1f4){logger['error'](_0xdf86('0x17'),_0x251db7,_0x56cb31[_0xdf86('0x1b')][_0xdf86('0x1d')]);return _0x984136(_0x56cb31[_0xdf86('0x1b')]['message']);}logger[_0xdf86('0x1b')](_0xdf86('0x17'),_0x251db7,_0x56cb31[_0xdf86('0x1b')][_0xdf86('0x1d')]);return _0x3c824f(_0x56cb31[_0xdf86('0x1b')][_0xdf86('0x1d')]);}else{logger[_0xdf86('0x1e')](_0xdf86('0x17'),_0x251db7,_0xdf86('0x18'));_0x3c824f(_0x56cb31[_0xdf86('0x1f')][_0xdf86('0x1d')]);}})['catch'](function(_0x56755e){logger[_0xdf86('0x1b')](_0xdf86('0x17'),_0x251db7,_0x56755e);_0x984136(_0x56755e);});});}function respondWithStatusCode(_0x49e80c,_0x3c8a6e){_0x3c8a6e=_0x3c8a6e||0xcc;return function(_0x2ae132){if(_0x2ae132){return _0x49e80c[_0xdf86('0x20')](_0x3c8a6e);}return _0x49e80c[_0xdf86('0x21')](_0x3c8a6e)[_0xdf86('0x22')]();};}function respondWithResult(_0x359dc2,_0x4ed798){_0x4ed798=_0x4ed798||0xc8;return function(_0x8129d1){if(_0x8129d1){return _0x359dc2['status'](_0x4ed798)['json'](_0x8129d1);}};}function respondWithFilteredResult(_0x1d9fa0,_0x520b70){return function(_0xde8311){if(_0xde8311){var _0x4d84dd=typeof _0x520b70[_0xdf86('0x23')]===_0xdf86('0x24')&&typeof _0x520b70['limit']==='undefined';var _0xb66ef5=_0xde8311[_0xdf86('0x25')];var _0xb0e7cc=_0x4d84dd?0x0:_0x520b70[_0xdf86('0x23')];var _0x5b62bd=_0x4d84dd?_0xde8311[_0xdf86('0x25')]:_0x520b70[_0xdf86('0x23')]+_0x520b70[_0xdf86('0x26')];var _0x389262;if(_0x5b62bd>=_0xb66ef5){_0x5b62bd=_0xb66ef5;_0x389262=0xc8;}else{_0x389262=0xce;}_0x1d9fa0[_0xdf86('0x21')](_0x389262);return _0x1d9fa0[_0xdf86('0x27')](_0xdf86('0x28'),_0xb0e7cc+'-'+_0x5b62bd+'/'+_0xb66ef5)['json'](_0xde8311);}return null;};}function saveUpdates(_0x58b2fb){return function(_0x20f1fc){if(_0x20f1fc){return _0x20f1fc[_0xdf86('0x29')](_0x58b2fb)[_0xdf86('0x16')](function(_0x59b90c){return _0x59b90c;});}return null;};}function removeEntity(_0x33f79d){return function(_0x4d5a76){if(_0x4d5a76){return _0x4d5a76['destroy']()[_0xdf86('0x16')](function(){_0x33f79d[_0xdf86('0x21')](0xcc)[_0xdf86('0x22')]();});}};}function handleEntityNotFound(_0x291e97){return function(_0x5ff316){if(!_0x5ff316){_0x291e97[_0xdf86('0x20')](0x194);}return _0x5ff316;};}function handleError(_0x109bcd,_0x157463){_0x157463=_0x157463||0x1f4;return function(_0x367c15){logger[_0xdf86('0x1b')](_0x367c15[_0xdf86('0x2a')]);if(_0x367c15[_0xdf86('0x2b')]){delete _0x367c15['name'];}_0x109bcd[_0xdf86('0x21')](_0x157463)[_0xdf86('0x2c')](_0x367c15);};}function getMustacheRender(_0x39ee40,_0x14350a){return Mustache[_0xdf86('0x2d')](_0x39ee40,_[_0xdf86('0x2e')](_0x14350a['body'],{'contact':_0x14350a[_0xdf86('0x2f')],'message':_0x14350a[_0xdf86('0x1d')],'agent':_0x14350a[_0xdf86('0x30')],'interaction':_0x14350a[_0xdf86('0x31')],'account':_0x14350a[_0xdf86('0x32')]}))||'';}exports[_0xdf86('0x33')]=function(_0x176199,_0x2fb4a0){var _0x3de585={};var _0x4158c8=_[_0xdf86('0x34')](db[_0xdf86('0x35')]['rawAttributes'],function(_0x305847){return{'name':_0x305847[_0xdf86('0x36')],'type':_0x305847['type'][_0xdf86('0x37')]};});_0x3de585=qs[_0xdf86('0x38')](_0x4158c8,_0x176199);return interaction[_0xdf86('0x39')]('chat',_0x176199[_0xdf86('0x3a')],_0x176199['user'],_0x3de585,_0x4158c8)[_0xdf86('0x16')](respondWithFilteredResult(_0x2fb4a0,_0x3de585))[_0xdf86('0x3b')](handleError(_0x2fb4a0,null));};exports[_0xdf86('0x3c')]=function(_0x3fb3ee,_0x4ddb15){var _0x3e6029={'raw':![],'where':{'id':_0x3fb3ee[_0xdf86('0x3d')]['id']}},_0x177fe2={};_0x177fe2[_0xdf86('0x3e')]=_[_0xdf86('0x3f')](db['ChatInteraction']['rawAttributes']);_0x177fe2['query']=_[_0xdf86('0x3f')](_0x3fb3ee[_0xdf86('0x3a')]);_0x177fe2[_0xdf86('0x40')]=_['intersection'](_0x177fe2[_0xdf86('0x3e')],_0x177fe2[_0xdf86('0x3a')]);_0x3e6029[_0xdf86('0x41')]=_[_0xdf86('0x42')](_0x177fe2[_0xdf86('0x3e')],qs['fields'](_0x3fb3ee[_0xdf86('0x3a')]['fields']));_0x3e6029[_0xdf86('0x41')]=_0x3e6029[_0xdf86('0x41')]['length']?_0x3e6029[_0xdf86('0x41')]:_0x177fe2[_0xdf86('0x3e')];if(_0x3fb3ee['query'][_0xdf86('0x43')]){_0x3e6029['include']=[{'all':!![]}];}_0x3e6029=_[_0xdf86('0x2e')]({},_0x3e6029,_0x3fb3ee[_0xdf86('0x44')]);return db['ChatInteraction'][_0xdf86('0x45')](_0x3e6029)[_0xdf86('0x16')](handleEntityNotFound(_0x4ddb15,null))[_0xdf86('0x16')](respondWithResult(_0x4ddb15,null))[_0xdf86('0x3b')](handleError(_0x4ddb15,null));};exports[_0xdf86('0x46')]=function(_0x2d1483,_0x275681){return db[_0xdf86('0x35')][_0xdf86('0x46')](_0x2d1483['body'],{})[_0xdf86('0x16')](respondWithResult(_0x275681,0xc9))[_0xdf86('0x3b')](handleError(_0x275681,null));};exports[_0xdf86('0x29')]=function(_0x25c69d,_0x318c81){if(_0x25c69d[_0xdf86('0x47')]['id']){delete _0x25c69d[_0xdf86('0x47')]['id'];}return db[_0xdf86('0x35')][_0xdf86('0x45')]({'where':{'id':_0x25c69d[_0xdf86('0x3d')]['id']}})[_0xdf86('0x16')](handleEntityNotFound(_0x318c81,null))['then'](saveUpdates(_0x25c69d[_0xdf86('0x47')],null))[_0xdf86('0x16')](respondWithResult(_0x318c81,null))['catch'](handleError(_0x318c81,null));};exports[_0xdf86('0x48')]=function(_0x1c2e94,_0x3d9c3b){return db[_0xdf86('0x35')][_0xdf86('0x45')]({'where':{'id':_0x1c2e94[_0xdf86('0x3d')]['id']}})['then'](handleEntityNotFound(_0x3d9c3b,null))[_0xdf86('0x16')](removeEntity(_0x3d9c3b,null))[_0xdf86('0x3b')](handleError(_0x3d9c3b,null));};exports[_0xdf86('0x49')]=function(_0x276977,_0x42f148){return db[_0xdf86('0x35')][_0xdf86('0x49')]()[_0xdf86('0x16')](respondWithResult(_0x42f148,null))['catch'](handleError(_0x42f148,null));};exports[_0xdf86('0x4a')]=function(_0x267d60,_0x591d15){var _0x287306=_0x267d60['params']['id'];var _0x5a1123;var _0x39e828;var _0x377bf1;return db[_0xdf86('0x35')][_0xdf86('0x4b')]({'where':{'id':_0x287306}})['then'](function(_0x48e952){_0x5a1123=_0x48e952;return db['ChatWebsite']['findOne']({'where':{'id':_0x48e952[_0xdf86('0x4c')]},'attributes':['id','vidaooApiKey',_0xdf86('0x4d'),'vidaooTopic',_0xdf86('0x4e'),'vidaooMetadata'],'raw':!![]});})[_0xdf86('0x16')](function(_0x2ac06c){if(_0x2ac06c&&_0x2ac06c[_0xdf86('0x4f')]&&_0x2ac06c['vidaooEscalation']){_0x39e828=_0x2ac06c;var _0x2c15cc={'interaction':{'id':_0x287306},'agent':{'id':_0x267d60[_0xdf86('0x50')]['id'],'name':_0x267d60['user'][_0xdf86('0x2b')],'fullname':_0x267d60[_0xdf86('0x50')][_0xdf86('0x51')],'email':_0x267d60[_0xdf86('0x50')][_0xdf86('0x52')]},'contact':_0x267d60[_0xdf86('0x47')][_0xdf86('0x2f')],'account':_0x267d60[_0xdf86('0x47')]['account']};var _0xd040f3={'rejectUnauthorized':![],'method':_0xdf86('0x53'),'url':_0xdf86('0x54'),'headers':{'X-APIKEY':_0x2ac06c['vidaooApiKey']},'body':{'duration':null,'scheduledAt':null,'participants':[_0x267d60['user'][_0xdf86('0x52')]],'buttons':null,'topic':_0x39e828[_0xdf86('0x55')],'note':_[_0xdf86('0x56')](_0x39e828[_0xdf86('0x4e')])?null:getMustacheRender(_0x39e828[_0xdf86('0x4e')],_0x2c15cc),'metadata':null},'redirect':_0xdf86('0x57'),'json':!![]};try{if(!_[_0xdf86('0x56')](_0x39e828[_0xdf86('0x58')])){var _0x5d3946=getMustacheRender(_0x39e828['vidaooMetadata'],_0x2c15cc);var _0x1768f1=JSON[_0xdf86('0x59')](_0x5d3946);_0xd040f3[_0xdf86('0x47')][_0xdf86('0x5a')]=_0x1768f1;}}catch(_0x37f717){throw new db[(_0xdf86('0x5b'))][(_0xdf86('0x5c'))](_0xdf86('0x5d'));}return rp(_0xd040f3);}else{throw new db['Sequelize']['ValidationError'](_0xdf86('0x5e'));}})[_0xdf86('0x16')](function(_0x489aad){_0x377bf1=_0x489aad;if(_0x377bf1['id']){var _0x4aa6a1={'body':_0x377bf1[_0xdf86('0x5f')],'ChatWebsiteId':_0x39e828['id'],'ChatInteractionId':_0x5a1123['id'],'direction':_0xdf86('0x60'),'UserId':_0x267d60['user']['id']};return db['ChatMessage']['create'](_0x4aa6a1,{});}else{throw new db[(_0xdf86('0x5b'))][(_0xdf86('0x5c'))](_0xdf86('0x61'));}})[_0xdf86('0x16')](function(){return _0x5a1123[_0xdf86('0x62')]({'vidaooSessionId':_0x377bf1['id']});})[_0xdf86('0x16')](respondWithResult(_0x591d15,null))[_0xdf86('0x3b')](handleError(_0x591d15,null));};exports[_0xdf86('0x63')]=function(_0x30ac8f,_0xf03839){if(_0x30ac8f[_0xdf86('0x47')]['id']){delete _0x30ac8f['body']['id'];}return db[_0xdf86('0x35')][_0xdf86('0x45')]({'where':{'id':_0x30ac8f[_0xdf86('0x3d')]['id']},'include':[{'model':db[_0xdf86('0x64')],'as':'Contact'}]})[_0xdf86('0x16')](handleEntityNotFound(_0xf03839,null))[_0xdf86('0x16')](saveUpdates(_0x30ac8f[_0xdf86('0x47')],null))[_0xdf86('0x16')](respondWithResult(_0xf03839,null))[_0xdf86('0x3b')](handleError(_0xf03839,null));};exports[_0xdf86('0x65')]=function(_0x26307f,_0xbd92b7){if(_0x26307f[_0xdf86('0x47')]['id']){delete _0x26307f[_0xdf86('0x47')]['id'];}return db['ChatInteraction'][_0xdf86('0x45')]({'where':{'id':_0x26307f[_0xdf86('0x3d')]['id']}})[_0xdf86('0x16')](function(_0x5f175f){if(!_0x5f175f){logger[_0xdf86('0x1b')](_0xdf86('0x66'),_0xdf86('0x65'),0x194,_0xdf86('0x67'));_0xbd92b7[_0xdf86('0x20')](0x194);}else{if(_0x5f175f[_0xdf86('0x68')]){throw new db[(_0xdf86('0x5b'))][(_0xdf86('0x5c'))](_0xdf86('0x69'));}}return _0x5f175f;})[_0xdf86('0x16')](function(_0x55d6f2){if(_0x55d6f2){return _0x55d6f2[_0xdf86('0x29')]({'closed':_0x26307f[_0xdf86('0x47')]['closed'],'disposition':_0x26307f[_0xdf86('0x47')][_0xdf86('0x6a')]})[_0xdf86('0x16')](function(_0x172029){return _0x172029;});}})[_0xdf86('0x16')](function(){return respondWithRpcPromise('AbandonInteraction','abandon',_0x26307f['body'],client9004);})['then'](respondWithResult(_0xbd92b7,null))[_0xdf86('0x3b')](handleError(_0xbd92b7,null));};exports[_0xdf86('0x6b')]=function(_0x43a162,_0x4c43cf){_0x43a162[_0xdf86('0x47')][_0xdf86('0x2b')]=_0x43a162[_0xdf86('0x6c')][_0xdf86('0x6d')];_0x43a162['body'][_0xdf86('0x6e')]=_0x43a162[_0xdf86('0x6c')]['filename'];_0x43a162['body'][_0xdf86('0x6f')]=_0x43a162[_0xdf86('0x6c')][_0xdf86('0x70')];return db[_0xdf86('0x71')][_0xdf86('0x46')](_0x43a162['body'])[_0xdf86('0x16')](respondWithResult(_0x4c43cf,0xc9))[_0xdf86('0x3b')](handleError(_0x4c43cf,null));};exports[_0xdf86('0x72')]=function(_0x544613,_0x46b593){return db[_0xdf86('0x35')][_0xdf86('0x4b')]({'where':{'id':_0x544613[_0xdf86('0x3d')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x46b593,null))[_0xdf86('0x16')](function(_0x36bb32){if(_0x36bb32){if(_0x36bb32[_0xdf86('0x73')]){return _0x46b593[_0xdf86('0x21')](0x193)[_0xdf86('0x74')]({'status':0x193,'message':'Unauthorized'});}return db[_0xdf86('0x71')][_0xdf86('0x4b')]({'where':{'id':_0x544613[_0xdf86('0x3a')]['attachId']},'raw':!![]})['then'](handleEntityNotFound(_0x46b593,null));}})[_0xdf86('0x16')](function(_0x3dd8b2){if(_0x3dd8b2){var _0x4e6773=_0x3dd8b2[_0xdf86('0x75')]!==null;var _0x8a2716=path[_0xdf86('0x76')](config['root'],_0xdf86('0x77'));if(_0x4e6773){_0x8a2716=path['join'](_0x8a2716,_0xdf86('0x78'));}var _0x1157a4=path[_0xdf86('0x76')](_0x8a2716,_0x3dd8b2[_0xdf86('0x6e')]);return _0x46b593[_0xdf86('0x79')](_0x1157a4);}})[_0xdf86('0x3b')](handleError(_0x46b593,null));};exports['close']=function(_0xc0490c,_0x4d43d4){var _0x301198=null;var _0x1454bf=null;var _0xa0d05=null;if(_0xc0490c[_0xdf86('0x47')]['id']){delete _0xc0490c['body']['id'];}if(_0xc0490c[_0xdf86('0x47')][_0xdf86('0x7a')]){_0xa0d05=path['join'](config[_0xdf86('0x7b')],_0xdf86('0x7c'),util[_0xdf86('0x7d')](_0xdf86('0x7e'),Date[_0xdf86('0x7f')]()));_0xc0490c[_0xdf86('0x47')]['pathTranscript']=_0xa0d05;}return db[_0xdf86('0x35')][_0xdf86('0x45')]({'where':{'id':_0xc0490c[_0xdf86('0x3d')]['id']},'include':[{'model':db[_0xdf86('0x80')],'as':_0xdf86('0x81'),'include':[{'model':db[_0xdf86('0x82')],'as':_0xdf86('0x82')}]}]})['then'](handleEntityNotFound(_0x4d43d4,null))[_0xdf86('0x16')](saveUpdates(_0xc0490c['body'],null))[_0xdf86('0x16')](function(_0x33e5e8){if(_0x33e5e8){_0x301198=_0x33e5e8;return db[_0xdf86('0x83')][_0xdf86('0x45')]({'where':{'id':_0x301198[_0xdf86('0x4c')]}});}})['then'](function(_0x3f54d8){if(_0x3f54d8){_0x1454bf=_0x3f54d8;return db[_0xdf86('0x64')][_0xdf86('0x45')]({'where':{'id':_0x301198['ContactId']}});}})[_0xdf86('0x16')](function(_0x52cdbf){if(_0x52cdbf){if(_0xa0d05){var _0x5b0454=null;for(var _0x251fa0=0x1;_0x251fa0<_0x301198[_0xdf86('0x81')][_0xdf86('0x84')];++_0x251fa0){_0x5b0454=_0x301198[_0xdf86('0x81')][_0x251fa0];var _0x4f9f20=_0x5b0454[_0xdf86('0x68')]?util[_0xdf86('0x7d')](_0xdf86('0x85'),_0x1454bf['agentAlias'],_0x5b0454['UserId']):_0xdf86('0x86');var _0x22ccfc=_0xc0490c[_0xdf86('0x47')]['customer']||util[_0xdf86('0x7d')](_0xdf86('0x85'),'Visitor',_0x5b0454[_0xdf86('0x87')]);switch(_0x1454bf['agentIdentifier']){case _0xdf86('0x88'):_0x4f9f20=_0x5b0454['UserId']?util[_0xdf86('0x7d')](_0xdf86('0x85'),_0x1454bf['agentAlias'],_0x5b0454[_0xdf86('0x68')]):_0xdf86('0x86');break;case _0xdf86('0x89'):_0x4f9f20=_0x5b0454['UserId']?_0x5b0454[_0xdf86('0x82')][_0xdf86('0x8a')]||_0x5b0454[_0xdf86('0x82')]['fullname']:_0xdf86('0x86');break;case _0xdf86('0x8b'):_0x4f9f20=_0x5b0454[_0xdf86('0x68')]?_0x5b0454['User'][_0xdf86('0x51')]:_0xdf86('0x86');break;default:_0x4f9f20=_0x5b0454[_0xdf86('0x68')]?util[_0xdf86('0x7d')](_0xdf86('0x85'),_0x1454bf[_0xdf86('0x8c')],_0x5b0454[_0xdf86('0x68')]):_0xdf86('0x86');}var _0x19be09=util['format'](_0xdf86('0x8d'),moment(_0x5b0454[_0xdf86('0x8e')])[_0xdf86('0x7d')](_0xdf86('0x8f')),_0x5b0454['direction']==='in'?_0x22ccfc:_0x4f9f20,_0x5b0454[_0xdf86('0x47')]);if(!_0x5b0454[_0xdf86('0x90')]){fs[_0xdf86('0x91')](_0xa0d05,_0x19be09);}}return db[_0xdf86('0x92')][_0xdf86('0x4b')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0xdf86('0x93'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0xdf86('0x94'),'raw':!![]}]}]});}}})['then'](function(_0x3c18d4){if(!_0x3c18d4||!_0x3c18d4[_0xdf86('0x93')]||!_0xc0490c[_0xdf86('0x47')])return _0x301198;var _0x1559f4=_0x3c18d4[_0xdf86('0x95')]();return respondWithRpcPromise(_0xdf86('0x96'),_0xdf86('0x97'),{'account':_0x1559f4,'message':{'from':util['format'](_0xdf86('0x98'),_0x3c18d4['name'],_0x3c18d4[_0xdf86('0x52')]||_0x3c18d4[_0xdf86('0x93')][_0xdf86('0x50')]),'to':_0xc0490c[_0xdf86('0x47')][_0xdf86('0x7a')],'subject':'Mail\x20Transcript','text':util[_0xdf86('0x7d')]('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0xc0490c[_0xdf86('0x47')][_0xdf86('0x7a')]),'attachments':[{'path':_0xa0d05}]}})[_0xdf86('0x16')](function(){return _0x301198;})['catch'](function(_0x38cfd3){logger[_0xdf86('0x1b')](_0x38cfd3);});})[_0xdf86('0x16')](respondWithStatusCode(_0x4d43d4,0xc8))[_0xdf86('0x3b')](handleError(_0x4d43d4,null));};exports[_0xdf86('0x99')]=function(_0x3f4e17,_0x1f2272){return db[_0xdf86('0x80')]['find']({'where':{'id':_0x3f4e17[_0xdf86('0x3d')]['id']}})[_0xdf86('0x16')](handleEntityNotFound(_0x1f2272,null))[_0xdf86('0x16')](function(_0x6fe5d2){if(_0x6fe5d2){return _0x6fe5d2[_0xdf86('0x99')](_0x3f4e17[_0xdf86('0x47')][_0xdf86('0x9a')],_['omit'](_0x3f4e17[_0xdf86('0x47')],[_0xdf86('0x9a'),'id'])||{});}})[_0xdf86('0x16')](respondWithResult(_0x1f2272,null))[_0xdf86('0x3b')](handleError(_0x1f2272,null));};exports['getMessages']=function(_0x50b4f3,_0x945410){var _0x5385ce={'raw':![],'where':{}};var _0x2f7468={};var _0x19ad33={'count':0x0,'rows':[]};return db[_0xdf86('0x35')][_0xdf86('0x4b')]({'where':{'id':_0x50b4f3[_0xdf86('0x3d')]['id']}})['then'](handleEntityNotFound(_0x945410,null))[_0xdf86('0x16')](function(_0x3c0689){if(_0x3c0689){_0x2f7468[_0xdf86('0x3e')]=_[_0xdf86('0x3f')](db['ChatMessage'][_0xdf86('0x9b')]);_0x2f7468[_0xdf86('0x3a')]=_[_0xdf86('0x3f')](_0x50b4f3[_0xdf86('0x3a')]);_0x2f7468[_0xdf86('0x40')]=_[_0xdf86('0x42')](_0x2f7468[_0xdf86('0x3e')],_0x2f7468[_0xdf86('0x3a')]);_0x5385ce[_0xdf86('0x41')]=_[_0xdf86('0x42')](_0x2f7468[_0xdf86('0x3e')],qs[_0xdf86('0x9c')](_0x50b4f3[_0xdf86('0x3a')]['fields']));_0x5385ce[_0xdf86('0x41')]=_0x5385ce[_0xdf86('0x41')][_0xdf86('0x84')]?_0x5385ce['attributes']:_0x2f7468[_0xdf86('0x3e')];if(!_0x50b4f3[_0xdf86('0x3a')][_0xdf86('0x9d')](_0xdf86('0x9e'))){_0x5385ce[_0xdf86('0x26')]=qs['limit'](_0x50b4f3[_0xdf86('0x3a')][_0xdf86('0x26')]);_0x5385ce[_0xdf86('0x23')]=qs['offset'](_0x50b4f3[_0xdf86('0x3a')][_0xdf86('0x23')]);}_0x5385ce[_0xdf86('0x9f')]=qs['sort'](_0x50b4f3[_0xdf86('0x3a')][_0xdf86('0xa0')]);_0x5385ce[_0xdf86('0xa1')]=qs[_0xdf86('0x40')](_[_0xdf86('0xa2')](_0x50b4f3[_0xdf86('0x3a')],_0x2f7468[_0xdf86('0x40')]));_0x5385ce[_0xdf86('0xa1')][_0xdf86('0xa3')]=_0x3c0689['id'];if(_0x50b4f3['query']['filter']){_0x5385ce[_0xdf86('0xa1')]=_[_0xdf86('0x2e')](_0x5385ce[_0xdf86('0xa1')],{'$or':_[_0xdf86('0x34')](_0x5385ce['attributes'],function(_0x5abc4b){var _0x3406b4={};_0x3406b4[_0x5abc4b]={'$like':'%'+_0x50b4f3[_0xdf86('0x3a')][_0xdf86('0xa4')]+'%'};return _0x3406b4;})});}if(_0x50b4f3['query'][_0xdf86('0xa5')]){var _0x2c2498=_0x50b4f3[_0xdf86('0x3a')][_0xdf86('0xa5')][_0xdf86('0xa6')](',');var _0x438706={};_0x438706[_0x2c2498[0x0]]={'$gte':moment(_0x2c2498[0x1])['format'](_0xdf86('0xa7'))};_0x5385ce[_0xdf86('0xa1')]=_[_0xdf86('0x2e')](_0x5385ce[_0xdf86('0xa1')],_0x438706);}_0x5385ce=_[_0xdf86('0x2e')]({},_0x5385ce,_0x50b4f3[_0xdf86('0x44')]);return db[_0xdf86('0x80')]['count']({'where':_0x5385ce[_0xdf86('0xa1')]})['then'](function(_0x17ba1d){_0x19ad33[_0xdf86('0x25')]=_0x17ba1d;if(_0x50b4f3[_0xdf86('0x3a')][_0xdf86('0x43')]){_0x5385ce[_0xdf86('0xa8')]=[{'all':!![]}];}return db['ChatMessage'][_0xdf86('0x39')](_0x5385ce);})[_0xdf86('0x16')](function(_0x42bc82){_0x19ad33[_0xdf86('0xa9')]=_0x42bc82;return _0x19ad33;});}})[_0xdf86('0x16')](respondWithFilteredResult(_0x945410,_0x5385ce))[_0xdf86('0x3b')](handleError(_0x945410,null));};exports[_0xdf86('0xaa')]=function(_0x16e48a,_0x7f67e3){var _0x1d0890={'where':{}},_0x9ca8a1={},_0xc65bd3={'count':0x0,'rows':[]};return db[_0xdf86('0x35')]['findOne']({'where':{'id':_0x16e48a[_0xdf86('0x3d')]['id']}})['then'](handleEntityNotFound(_0x7f67e3,null))['then'](function(_0x26e276){if(_0x26e276){_0x9ca8a1[_0xdf86('0x3e')]=_[_0xdf86('0x3f')](db[_0xdf86('0x80')]['rawAttributes']);_0x9ca8a1[_0xdf86('0x3a')]=_[_0xdf86('0x3f')](_0x16e48a[_0xdf86('0x3a')]);_0x9ca8a1[_0xdf86('0x40')]=_[_0xdf86('0x42')](_0x9ca8a1['model'],_0x9ca8a1[_0xdf86('0x3a')]);_0x1d0890['attributes']=_[_0xdf86('0x42')](_0x9ca8a1[_0xdf86('0x3e')],qs[_0xdf86('0x9c')](_0x16e48a[_0xdf86('0x3a')][_0xdf86('0x9c')]));_0x1d0890[_0xdf86('0x41')]=_0x1d0890[_0xdf86('0x41')][_0xdf86('0x84')]?_0x1d0890['attributes']:_0x9ca8a1[_0xdf86('0x3e')];if(!_0x16e48a['query'][_0xdf86('0x9d')](_0xdf86('0x9e'))){_0x1d0890[_0xdf86('0x26')]=qs[_0xdf86('0x26')](_0x16e48a['query'][_0xdf86('0x26')]);_0x1d0890[_0xdf86('0x23')]=qs[_0xdf86('0x23')](_0x16e48a[_0xdf86('0x3a')][_0xdf86('0x23')]);}_0x1d0890[_0xdf86('0x9f')]=qs[_0xdf86('0xa0')](_0x16e48a[_0xdf86('0x3a')][_0xdf86('0xa0')]);_0x1d0890[_0xdf86('0xa1')]=qs[_0xdf86('0x40')](_['pick'](_0x16e48a['query'],_0x9ca8a1[_0xdf86('0x40')]));_0x1d0890[_0xdf86('0xa1')][_0xdf86('0xa3')]=_0x26e276['id'];if(_0x16e48a['query'][_0xdf86('0xa4')]){_0x1d0890['where']=_[_0xdf86('0x2e')](_0x1d0890['where'],{'$or':_[_0xdf86('0x34')](_0x1d0890[_0xdf86('0x41')],function(_0xd2603f){var _0x3fd669={};_0x3fd669[_0xd2603f]={'$like':'%'+_0x16e48a[_0xdf86('0x3a')][_0xdf86('0xa4')]+'%'};return _0x3fd669;})});}_0x1d0890[_0xdf86('0xa1')][_0xdf86('0x90')]=![];if(_0x16e48a[_0xdf86('0x3a')]['id']){_0x1d0890[_0xdf86('0xa1')]['id']={'$gt':_0x16e48a[_0xdf86('0x3a')]['id']};}_0x1d0890=_['merge']({},_0x1d0890,_0x16e48a[_0xdf86('0x44')]);return db[_0xdf86('0x80')][_0xdf86('0x25')]({'where':_0x1d0890[_0xdf86('0xa1')]})[_0xdf86('0x16')](function(_0x20a98b){_0xc65bd3[_0xdf86('0x25')]=_0x20a98b;_0x1d0890[_0xdf86('0xa8')]=[];if(_0x16e48a[_0xdf86('0x3a')][_0xdf86('0xab')]){_0x1d0890[_0xdf86('0xa8')]['push']({'model':db[_0xdf86('0x82')],'as':_0xdf86('0x82'),'attributes':['id',_0xdf86('0x51'),'alias']});}if(_0x16e48a[_0xdf86('0x3a')][_0xdf86('0x43')]){_0x1d0890[_0xdf86('0xa8')]=[{'all':!![]}];}return db['ChatMessage'][_0xdf86('0x39')](_0x1d0890);})[_0xdf86('0x16')](function(_0x476b1a){_0xc65bd3[_0xdf86('0xa9')]=_0x476b1a;return _0xc65bd3;});}})[_0xdf86('0x16')](respondWithFilteredResult(_0x7f67e3,_0x1d0890))[_0xdf86('0x3b')](handleError(_0x7f67e3,null));};exports[_0xdf86('0xac')]=function(_0x310c9f,_0x259a9e){return db['ChatInteraction']['find']({'where':{'id':_0x310c9f[_0xdf86('0x3d')]['id']}})[_0xdf86('0x16')](handleEntityNotFound(_0x259a9e,null))[_0xdf86('0x16')](function(_0x5dab34){if(_0x5dab34){return _0x5dab34['setTags'](_0x310c9f[_0xdf86('0x47')]['ids'],_[_0xdf86('0xad')](_0x310c9f['body'],['ids','id'])||{})[_0xdf86('0xae')](function(){return db['Tag']['findAll']({'attributes':['id',_0xdf86('0x2b'),_0xdf86('0xaf')],'where':{'id':_0x310c9f[_0xdf86('0x47')]['ids']}});})[_0xdf86('0x16')](function(_0x15338a){socket[_0xdf86('0xb0')]('chatInteractionTags:save',{'id':Number(_0x310c9f[_0xdf86('0x3d')]['id']),'tags':_0x15338a||[]});return{'id':Number(_0x310c9f[_0xdf86('0x3d')]['id']),'tags':_0x15338a||[]};});}})[_0xdf86('0x16')](respondWithResult(_0x259a9e,null))[_0xdf86('0x3b')](handleError(_0x259a9e,null));};exports[_0xdf86('0xb1')]=function(_0x14eaf0,_0x37cbff){return db[_0xdf86('0x35')][_0xdf86('0x45')]({'where':{'id':_0x14eaf0[_0xdf86('0x3d')]['id']}})[_0xdf86('0x16')](handleEntityNotFound(_0x37cbff,null))[_0xdf86('0x16')](function(_0x5708c6){if(_0x5708c6){return _0x5708c6[_0xdf86('0xb1')](_0x14eaf0['query'][_0xdf86('0x9a')]);}})[_0xdf86('0x16')](respondWithStatusCode(_0x37cbff,null))[_0xdf86('0x3b')](handleError(_0x37cbff,null));};exports[_0xdf86('0x79')]=function(_0x3ca77f,_0x4cd725){var _0x4c77d2=moment()[_0xdf86('0xb2')]()['toString']();var _0x22313f=path['join'](config['root'],_0xdf86('0xb3'),_0xdf86('0xb4'),_0xdf86('0xb5'));var _0x3a5411=path[_0xdf86('0x76')](config[_0xdf86('0x7b')],'server',_0xdf86('0xb4'),_0xdf86('0xb6'));var _0x3274cb=path['join'](_0x22313f,_0x4c77d2);var _0x2a0903=util[_0xdf86('0x7d')]('transcript-%d-%s.zip',_0x3ca77f[_0xdf86('0x3d')]['id'],_0x4c77d2);var _0x50bf2e=path[_0xdf86('0x76')](_0x22313f,_0x2a0903);var _0x27bf07=[];_0x27bf07[_0xdf86('0xb7')]({'model':db[_0xdf86('0x82')],'as':_0xdf86('0x82'),'attributes':['id',_0xdf86('0x51')],'raw':!![]});_0x27bf07['push']({'model':db['CmContact'],'as':'Contact','attributes':['id',_0xdf86('0xb8'),_0xdf86('0xb9')],'raw':!![]});if(_0x3ca77f['query'][_0xdf86('0xb6')]){_0x27bf07[_0xdf86('0xb7')]({'model':db[_0xdf86('0x71')],'as':_0xdf86('0x71'),'raw':!![]});}var _0x3159c7=[{'model':db[_0xdf86('0x80')],'as':_0xdf86('0x81'),'attributes':['id',_0xdf86('0x47'),_0xdf86('0x8e'),_0xdf86('0xba'),_0xdf86('0x90'),_0xdf86('0xbb')],'include':_0x27bf07}];_0x3159c7[_0xdf86('0xb7')]({'model':db[_0xdf86('0x83')],'as':_0xdf86('0xbc'),'attributes':['id',_0xdf86('0x2b')]});_0x3159c7[_0xdf86('0xb7')]({'model':db[_0xdf86('0x82')],'as':'Owner','attributes':['id','fullname']});return db[_0xdf86('0x35')][_0xdf86('0x45')]({'where':{'id':_0x3ca77f[_0xdf86('0x3d')]['id']},'include':_0x3159c7})[_0xdf86('0x16')](handleEntityNotFound(_0x4cd725,null))[_0xdf86('0x16')](function(_0x330a67){if(_0x330a67){var _0x16066c=_0x330a67[_0xdf86('0xbd')]({'plain':!![]});fs[_0xdf86('0xbe')](_0x3274cb);var _0x32ae3f={'channel':_0xdf86('0xbf'),'account':_0x16066c['Account'][_0xdf86('0x2b')],'agent':_0x16066c[_0xdf86('0xc0')]?_0x16066c[_0xdf86('0xc0')][_0xdf86('0x51')]:_0xdf86('0xc1'),'createdAt':moment(_0x16066c[_0xdf86('0x8e')])['format'](_0xdf86('0xa7'))[_0xdf86('0xc2')](),'closedAt':_0x16066c[_0xdf86('0x73')]?moment(_0x16066c[_0xdf86('0xc3')])[_0xdf86('0x7d')](_0xdf86('0xa7'))['toString']():'','disposition':_0x16066c[_0xdf86('0x6a')],'chatInfo':{'browser':_0x16066c[_0xdf86('0xc4')],'os':_0x16066c[_0xdf86('0xc5')],'referer':_0x16066c['referer'],'customerIp':_0x16066c['customerIp'],'customerPort':_0x16066c[_0xdf86('0xc6')]?_0x16066c['customerPort']:_0xdf86('0xc1')},'messages':_(_0x16066c['Messages'])[_0xdf86('0xc7')]()['filter']({'secret':![]})[_0xdf86('0x34')](function(_0x4b46f9){if(_0x4b46f9[_0xdf86('0x71')]){var _0x3a1b0f=path['join'](_0x3a5411,_0x4b46f9[_0xdf86('0x71')][_0xdf86('0x6e')]);if(fs[_0xdf86('0xc8')](_0x3a1b0f)){fs[_0xdf86('0xc9')](_0x3a1b0f)['pipe'](fs[_0xdf86('0xca')](path[_0xdf86('0x76')](_0x3274cb,_0x4b46f9['Attachment']['basename'])));}}return{'date':moment(_0x4b46f9[_0xdf86('0x8e')])[_0xdf86('0x7d')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x4b46f9[_0xdf86('0xba')]===_0xdf86('0x60')?_0x4b46f9[_0xdf86('0x82')]?_0x4b46f9['User'][_0xdf86('0x51')]:_0xdf86('0x86'):_0x4b46f9[_0xdf86('0xcb')][_0xdf86('0xb8')]+(_0x4b46f9[_0xdf86('0xcb')][_0xdf86('0xb9')]?'\x20'+_0x4b46f9[_0xdf86('0xcb')][_0xdf86('0xb9')]:''),'body':_0x4b46f9['Attachment']?_0x4b46f9[_0xdf86('0x71')][_0xdf86('0x6e')]:_0x4b46f9[_0xdf86('0x47')],'direction':_0x4b46f9[_0xdf86('0xba')]===_0xdf86('0x60')?'A':'C','secret':_0x4b46f9['secret'],'read':_0x4b46f9[_0xdf86('0xbb')],'attachment':_0x4b46f9[_0xdf86('0x71')]};})['value']()};return ejs[_0xdf86('0xcc')](path[_0xdf86('0x76')](config[_0xdf86('0x7b')],'server','views','downloadInteraction.ejs'),{'interaction':_0x32ae3f})[_0xdf86('0x16')](function(_0x3592f9){var _0x987a47=path[_0xdf86('0x76')](_0x3274cb,_0xdf86('0xcd')+_0x16066c['id']+'-'+_0x4c77d2+_0xdf86('0xce'));var _0x176f79={'path':_0x987a47,'channel':_0xdf86('0xbf'),'interactionId':_0x16066c['id']};return pdf[_0xdf86('0xcf')](_0x3592f9,_0x176f79);})[_0xdf86('0x16')](function(){return new Promise(function(_0x1603f1,_0x5a8e9a){zipdir(_0x3274cb,{'saveTo':_0x50bf2e},function(_0x4da59d,_0x5cd446){if(_0x4da59d)return _0x5a8e9a(_0x4da59d);return _0x1603f1(_0x5cd446);});})[_0xdf86('0x16')](function(){return new BPromise(function(_0x2f3b10,_0x22ed73){rimraf(_0x3274cb,function(_0x57007c){if(_0x57007c)_0x22ed73(_0x57007c);return _0x2f3b10();});});})[_0xdf86('0x16')](function(){return _0x4cd725[_0xdf86('0x79')](_0x50bf2e,_0x2a0903,function(_0xe570b8){if(_0xe570b8){logger[_0xdf86('0x1b')](_0xdf86('0xd0'),_0xe570b8);}else{fs[_0xdf86('0xd1')](_0x50bf2e);}});});});}else{return _0x4cd725['sendStatus'](0xc8);}})[_0xdf86('0x3b')](handleError(_0x4cd725,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 541c633..5817c3f 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 _0x73c3=['exports','events','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','save','update','remove','getUsers','then','Users','findAll','setDataValue','unreadMessages','length','emit','hasOwnProperty','hook'];(function(_0x2c7d9d,_0x36c98d){var _0x3a0f83=function(_0x4fc50a){while(--_0x4fc50a){_0x2c7d9d['push'](_0x2c7d9d['shift']());}};_0x3a0f83(++_0x36c98d);}(_0x73c3,0xac));var _0x373c=function(_0x5329d2,_0x268198){_0x5329d2=_0x5329d2-0x0;var _0x28218d=_0x73c3[_0x5329d2];return _0x28218d;};'use strict';var EventEmitter=require(_0x373c('0x0'));var ChatInteraction=require(_0x373c('0x1'))['db'][_0x373c('0x2')];var ChatMessage=require(_0x373c('0x1'))['db'][_0x373c('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x373c('0x4')](0x0);var events={'afterCreate':_0x373c('0x5'),'afterUpdate':_0x373c('0x6'),'afterDestroy':_0x373c('0x7')};function emitEvent(_0x5f450a){return function(_0x2173b9,_0x1bd5b7,_0x313691){_0x2173b9[_0x373c('0x8')]({'attributes':['id'],'raw':!![]})[_0x373c('0x9')](function(_0x5ab596){_0x2173b9['setDataValue'](_0x373c('0xa'),_0x5ab596['map'](function(_0x528c63){return{'id':_0x528c63['id']};}));return ChatMessage[_0x373c('0xb')]({'where':{'ChatInteractionId':_0x2173b9['id'],'direction':'in','read':![]},'raw':!![]});})[_0x373c('0x9')](function(_0x429af3){_0x2173b9[_0x373c('0xc')](_0x373c('0xd'),_0x429af3[_0x373c('0xe')]);ChatInteractionEvents[_0x373c('0xf')](_0x5f450a+':'+_0x2173b9['id'],_0x2173b9);ChatInteractionEvents['emit'](_0x5f450a,_0x2173b9);_0x313691(null);})['catch'](_0x313691(null));};}for(var e in events){if(events[_0x373c('0x10')](e)){var event=events[e];ChatInteraction[_0x373c('0x11')](e,emitEvent(event));}}module[_0x373c('0x12')]=ChatInteractionEvents; \ No newline at end of file +var _0x271c=['events','../../mysqldb','ChatInteraction','setMaxListeners','save','update','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports'];(function(_0x477a72,_0x1d5877){var _0xac9856=function(_0x37b5ae){while(--_0x37b5ae){_0x477a72['push'](_0x477a72['shift']());}};_0xac9856(++_0x1d5877);}(_0x271c,0xbe));var _0xc271=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x271c[_0x122ef9];return _0x42fba0;};'use strict';var EventEmitter=require(_0xc271('0x0'));var ChatInteraction=require(_0xc271('0x1'))['db'][_0xc271('0x2')];var ChatMessage=require(_0xc271('0x1'))['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xc271('0x3')](0x0);var events={'afterCreate':_0xc271('0x4'),'afterUpdate':_0xc271('0x5'),'afterDestroy':'remove'};function emitEvent(_0x5a0612){return function(_0x111e2d,_0x560aa7,_0x5641b4){_0x111e2d[_0xc271('0x6')]({'attributes':['id'],'raw':!![]})[_0xc271('0x7')](function(_0x40261c){_0x111e2d[_0xc271('0x8')](_0xc271('0x9'),_0x40261c[_0xc271('0xa')](function(_0x56d610){return{'id':_0x56d610['id']};}));return ChatMessage[_0xc271('0xb')]({'where':{'ChatInteractionId':_0x111e2d['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x246646){_0x111e2d[_0xc271('0x8')](_0xc271('0xc'),_0x246646[_0xc271('0xd')]);ChatInteractionEvents['emit'](_0x5a0612+':'+_0x111e2d['id'],_0x111e2d);ChatInteractionEvents[_0xc271('0xe')](_0x5a0612,_0x111e2d);_0x5641b4(null);})[_0xc271('0xf')](_0x5641b4(null));};}for(var e in events){if(events[_0xc271('0x10')](e)){var event=events[e];ChatInteraction[_0xc271('0x11')](e,emitEvent(event));}}module[_0xc271('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 619f7b6..862b86d 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 _0x5245=['rimraf','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','chat_interactions','closedAt','format','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x5245,0x160));var _0x5524=function(_0x4b6ccc,_0x146dc3){_0x4b6ccc=_0x4b6ccc-0x0;var _0x15e250=_0x5245[_0x4b6ccc];return _0x15e250;};'use strict';var _=require(_0x5524('0x0'));var util=require(_0x5524('0x1'));var logger=require(_0x5524('0x2'))(_0x5524('0x3'));var moment=require(_0x5524('0x4'));var BPromise=require(_0x5524('0x5'));var rp=require(_0x5524('0x6'));var fs=require('fs');var path=require(_0x5524('0x7'));var rimraf=require(_0x5524('0x8'));var config=require(_0x5524('0x9'));var attributes=require(_0x5524('0xa'));module[_0x5524('0xb')]=function(_0x3a8d21,_0x3d30c4){return _0x3a8d21[_0x5524('0xc')](_0x5524('0xd'),attributes,{'tableName':_0x5524('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3be439,_0x45e438,_0x57d971){if(_0x3be439['changed']('closed')){_0x3be439[_0x5524('0xf')]=moment()[_0x5524('0x10')]('YYYY-MM-DD\x20HH:mm:ss');}_0x57d971(null,_0x3be439);}},'charset':_0x5524('0x11'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xa918=['lodash','util','../../config/logger','api','moment','path','rimraf','./chatInteraction.attributes','exports','define','chat_interactions','format','utf8mb4','utf8mb4_unicode_ci'];(function(_0x24aa4c,_0x135ba2){var _0x2c9832=function(_0x271408){while(--_0x271408){_0x24aa4c['push'](_0x24aa4c['shift']());}};_0x2c9832(++_0x135ba2);}(_0xa918,0x188));var _0x8a91=function(_0x2c6f44,_0x5e19fb){_0x2c6f44=_0x2c6f44-0x0;var _0x510930=_0xa918[_0x2c6f44];return _0x510930;};'use strict';var _=require(_0x8a91('0x0'));var util=require(_0x8a91('0x1'));var logger=require(_0x8a91('0x2'))(_0x8a91('0x3'));var moment=require(_0x8a91('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8a91('0x5'));var rimraf=require(_0x8a91('0x6'));var config=require('../../config/environment');var attributes=require(_0x8a91('0x7'));module[_0x8a91('0x8')]=function(_0x1f58ce,_0x2191a3){return _0x1f58ce[_0x8a91('0x9')]('ChatInteraction',attributes,{'tableName':_0x8a91('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x13f22b,_0x8a1755,_0x3815b8){if(_0x13f22b['changed']('closed')){_0x13f22b['closedAt']=moment()[_0x8a91('0xb')]('YYYY-MM-DD\x20HH:mm:ss');}_0x3815b8(null,_0x13f22b);}},'charset':_0x8a91('0xc'),'collate':_0x8a91('0xd')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 60d1d9f..bc0b50d 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 _0x894f=['stringify','AddTagsToChatInteraction','find','then','addTags','ids','omit','AddTags','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','request','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','UpdateChatInteraction','ChatInteraction','update','body','options','raw','where','attributes','limit'];(function(_0x448c49,_0x27a873){var _0x2ae2f8=function(_0x6e8ed0){while(--_0x6e8ed0){_0x448c49['push'](_0x448c49['shift']());}};_0x2ae2f8(++_0x27a873);}(_0x894f,0xac));var _0xf894=function(_0x15158c,_0x3ea996){_0x15158c=_0x15158c-0x0;var _0x2bf7cc=_0x894f[_0x15158c];return _0x2bf7cc;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf894('0x0'));var BPromise=require(_0xf894('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf894('0x2'));var db=require(_0xf894('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xf894('0x4'))('rpc');var config=require(_0xf894('0x5'));var jayson=require(_0xf894('0x6'));var client=jayson[_0xf894('0x7')][_0xf894('0x8')]({'port':0x232a});config[_0xf894('0x9')]=_[_0xf894('0xa')](config[_0xf894('0x9')],{'host':_0xf894('0xb'),'port':0x18eb});var socket=require(_0xf894('0xc'))(new Redis(config['redis']));require(_0xf894('0xd'))['register'](socket);function respondWithRpcPromise(_0x5920a9,_0x58e2e2,_0x4a8787){return new BPromise(function(_0x5e777b,_0x37d56e){return client[_0xf894('0xe')](_0x5920a9,_0x4a8787)['then'](function(_0x36652c){logger[_0xf894('0xf')](_0xf894('0x10'),_0x58e2e2,_0xf894('0x11'));logger[_0xf894('0x12')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x58e2e2,'request\x20sent',JSON['stringify'](_0x36652c));if(_0x36652c['error']){if(_0x36652c[_0xf894('0x13')][_0xf894('0x14')]===0x1f4){logger[_0xf894('0x13')](_0xf894('0x10'),_0x58e2e2,_0x36652c['error']['message']);return _0x37d56e(_0x36652c[_0xf894('0x13')][_0xf894('0x15')]);}logger[_0xf894('0x13')]('ChatInteraction,\x20%s,\x20%s',_0x58e2e2,_0x36652c[_0xf894('0x13')]['message']);return _0x5e777b(_0x36652c[_0xf894('0x13')]['message']);}else{logger[_0xf894('0xf')](_0xf894('0x10'),_0x58e2e2,_0xf894('0x11'));_0x5e777b(_0x36652c[_0xf894('0x16')]['message']);}})[_0xf894('0x17')](function(_0x33f8dc){logger[_0xf894('0x13')]('ChatInteraction,\x20%s,\x20%s',_0x58e2e2,_0x33f8dc);_0x37d56e(_0x33f8dc);});});}exports[_0xf894('0x18')]=function(_0x18f4ce){var _0x48912f=this;return new Promise(function(_0x2275d6,_0x4193e6){return db[_0xf894('0x19')][_0xf894('0x1a')](_0x18f4ce[_0xf894('0x1b')],{'raw':_0x18f4ce['options']?_0x18f4ce[_0xf894('0x1c')][_0xf894('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x18f4ce[_0xf894('0x1c')]?_0x18f4ce['options'][_0xf894('0x1e')]||null:null,'attributes':_0x18f4ce['options']?_0x18f4ce[_0xf894('0x1c')][_0xf894('0x1f')]||null:null,'limit':_0x18f4ce['options']?_0x18f4ce[_0xf894('0x1c')][_0xf894('0x20')]||null:null})['then'](function(_0x248652){logger[_0xf894('0xf')](_0xf894('0x18'),_0x18f4ce);logger[_0xf894('0x12')]('UpdateChatInteraction',_0x18f4ce,JSON[_0xf894('0x21')](_0x248652));_0x2275d6(_0x248652);})[_0xf894('0x17')](function(_0x4fde64){logger['error'](_0xf894('0x18'),_0x4fde64[_0xf894('0x15')],_0x18f4ce);_0x4193e6(_0x48912f[_0xf894('0x13')](0x1f4,_0x4fde64['message']));});});};exports[_0xf894('0x22')]=function(_0x233781){return new Promise(function(_0x4d0276,_0x12f395){return db[_0xf894('0x19')][_0xf894('0x23')]({'where':_0x233781[_0xf894('0x1c')]?_0x233781['options']['where']||null:null})[_0xf894('0x24')](function(_0x1f17bb){if(_0x1f17bb){return _0x1f17bb[_0xf894('0x25')](_0x233781['body'][_0xf894('0x26')],_[_0xf894('0x27')](_0x233781['body'],[_0xf894('0x26'),'id'])||{});}})['spread'](function(_0x43a3f5){logger[_0xf894('0xf')](_0xf894('0x28'),_0x233781);logger[_0xf894('0x12')](_0xf894('0x28'),_0x233781,JSON[_0xf894('0x21')](_0x43a3f5));_0x4d0276(_0x43a3f5);})['catch'](function(_0x5862bf){logger[_0xf894('0x13')](_0xf894('0x28'),_0x5862bf[_0xf894('0x15')],_0x233781);_0x12f395(_this[_0xf894('0x13')](0x1f4,_0x5862bf['message']));});});}; \ No newline at end of file +var _0x34bb=['error','code','ChatInteraction,\x20%s,\x20%s','message','catch','UpdateChatInteraction','ChatInteraction','update','body','options','raw','where','attributes','then','find','addTags','ids','omit','spread','AddTags','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','info','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x54e631,_0x3b8396){var _0x3c6b6a=function(_0x48cea6){while(--_0x48cea6){_0x54e631['push'](_0x54e631['shift']());}};_0x3c6b6a(++_0x3b8396);}(_0x34bb,0xb4));var _0xb34b=function(_0x152c2b,_0x2c355c){_0x152c2b=_0x152c2b-0x0;var _0x20a98d=_0x34bb[_0x152c2b];return _0x20a98d;};'use strict';var _=require(_0xb34b('0x0'));var util=require(_0xb34b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb34b('0x2'));var fs=require('fs');var Redis=require(_0xb34b('0x3'));var db=require(_0xb34b('0x4'))['db'];var utils=require(_0xb34b('0x5'));var logger=require(_0xb34b('0x6'))(_0xb34b('0x7'));var config=require(_0xb34b('0x8'));var jayson=require(_0xb34b('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0xb34b('0xa')]=_['defaults'](config[_0xb34b('0xa')],{'host':_0xb34b('0xb'),'port':0x18eb});var socket=require(_0xb34b('0xc'))(new Redis(config[_0xb34b('0xa')]));require(_0xb34b('0xd'))[_0xb34b('0xe')](socket);function respondWithRpcPromise(_0x11d604,_0x208fae,_0x15c626){return new BPromise(function(_0x193bf7,_0x11cec0){return client['request'](_0x11d604,_0x15c626)['then'](function(_0x802398){logger[_0xb34b('0xf')]('ChatInteraction,\x20%s,\x20%s',_0x208fae,_0xb34b('0x10'));logger[_0xb34b('0x11')](_0xb34b('0x12'),_0x208fae,_0xb34b('0x10'),JSON[_0xb34b('0x13')](_0x802398));if(_0x802398['error']){if(_0x802398[_0xb34b('0x14')][_0xb34b('0x15')]===0x1f4){logger[_0xb34b('0x14')](_0xb34b('0x16'),_0x208fae,_0x802398['error'][_0xb34b('0x17')]);return _0x11cec0(_0x802398[_0xb34b('0x14')]['message']);}logger['error'](_0xb34b('0x16'),_0x208fae,_0x802398[_0xb34b('0x14')]['message']);return _0x193bf7(_0x802398[_0xb34b('0x14')][_0xb34b('0x17')]);}else{logger[_0xb34b('0xf')](_0xb34b('0x16'),_0x208fae,_0xb34b('0x10'));_0x193bf7(_0x802398['result']['message']);}})[_0xb34b('0x18')](function(_0x275550){logger[_0xb34b('0x14')](_0xb34b('0x16'),_0x208fae,_0x275550);_0x11cec0(_0x275550);});});}exports[_0xb34b('0x19')]=function(_0x3489ed){var _0x1efcae=this;return new Promise(function(_0x484e35,_0xabf0fa){return db[_0xb34b('0x1a')][_0xb34b('0x1b')](_0x3489ed[_0xb34b('0x1c')],{'raw':_0x3489ed[_0xb34b('0x1d')]?_0x3489ed[_0xb34b('0x1d')][_0xb34b('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3489ed[_0xb34b('0x1d')]?_0x3489ed[_0xb34b('0x1d')][_0xb34b('0x1f')]||null:null,'attributes':_0x3489ed[_0xb34b('0x1d')]?_0x3489ed['options'][_0xb34b('0x20')]||null:null,'limit':_0x3489ed[_0xb34b('0x1d')]?_0x3489ed[_0xb34b('0x1d')]['limit']||null:null})[_0xb34b('0x21')](function(_0x3c3f43){logger[_0xb34b('0xf')](_0xb34b('0x19'),_0x3489ed);logger[_0xb34b('0x11')](_0xb34b('0x19'),_0x3489ed,JSON[_0xb34b('0x13')](_0x3c3f43));_0x484e35(_0x3c3f43);})[_0xb34b('0x18')](function(_0x51f4b1){logger[_0xb34b('0x14')](_0xb34b('0x19'),_0x51f4b1[_0xb34b('0x17')],_0x3489ed);_0xabf0fa(_0x1efcae['error'](0x1f4,_0x51f4b1['message']));});});};exports['AddTagsToChatInteraction']=function(_0x3971ed){return new Promise(function(_0x479cb3,_0x3ad83c){return db['ChatInteraction'][_0xb34b('0x22')]({'where':_0x3971ed['options']?_0x3971ed['options']['where']||null:null})[_0xb34b('0x21')](function(_0x1848b0){if(_0x1848b0){return _0x1848b0[_0xb34b('0x23')](_0x3971ed[_0xb34b('0x1c')][_0xb34b('0x24')],_[_0xb34b('0x25')](_0x3971ed[_0xb34b('0x1c')],['ids','id'])||{});}})[_0xb34b('0x26')](function(_0x30e86c){logger[_0xb34b('0xf')]('AddTags',_0x3971ed);logger[_0xb34b('0x11')](_0xb34b('0x27'),_0x3971ed,JSON[_0xb34b('0x13')](_0x30e86c));_0x479cb3(_0x30e86c);})[_0xb34b('0x18')](function(_0x388063){logger[_0xb34b('0x14')](_0xb34b('0x27'),_0x388063[_0xb34b('0x17')],_0x3971ed);_0x3ad83c(_this['error'](0x1f4,_0x388063[_0xb34b('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 492c3a8..f1034b0 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 _0xd3fe=['length','chatInteraction:','save','remove','update','emit','removeListener','register'];(function(_0x263204,_0x19286b){var _0xed3987=function(_0x282bf1){while(--_0x282bf1){_0x263204['push'](_0x263204['shift']());}};_0xed3987(++_0x19286b);}(_0xd3fe,0xb2));var _0xed3f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd3fe[_0x14add3];return _0x4a174f;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=[_0xed3f('0x0'),_0xed3f('0x1'),_0xed3f('0x2')];function createListener(_0x12bb7c,_0x225607){return function(_0x31168c){_0x225607[_0xed3f('0x3')](_0x12bb7c,_0x31168c);};}function removeListener(_0x1d6d87,_0x131012){return function(){ChatInteractionEvents[_0xed3f('0x4')](_0x1d6d87,_0x131012);};}exports[_0xed3f('0x5')]=function(_0xe6f2d6){for(var _0x5b42ee=0x0,_0x2b5354=events[_0xed3f('0x6')];_0x5b42ee<_0x2b5354;_0x5b42ee++){var _0x154ac3=events[_0x5b42ee];var _0x12e634=createListener(_0xed3f('0x7')+_0x154ac3,_0xe6f2d6);ChatInteractionEvents['on'](_0x154ac3,_0x12e634);}}; \ No newline at end of file +var _0x7b12=['./chatInteraction.events','remove','update','emit','removeListener','register','length','chatInteraction:'];(function(_0x1fa6a0,_0x26671e){var _0x2cafe6=function(_0x4f6761){while(--_0x4f6761){_0x1fa6a0['push'](_0x1fa6a0['shift']());}};_0x2cafe6(++_0x26671e);}(_0x7b12,0x1e8));var _0x27b1=function(_0x12d44c,_0xf11296){_0x12d44c=_0x12d44c-0x0;var _0x4fde20=_0x7b12[_0x12d44c];return _0x4fde20;};'use strict';var ChatInteractionEvents=require(_0x27b1('0x0'));var events=['save',_0x27b1('0x1'),_0x27b1('0x2')];function createListener(_0x57859d,_0x4bba2e){return function(_0x3fd8ee){_0x4bba2e[_0x27b1('0x3')](_0x57859d,_0x3fd8ee);};}function removeListener(_0x446217,_0x1a9ff9){return function(){ChatInteractionEvents[_0x27b1('0x4')](_0x446217,_0x1a9ff9);};}exports[_0x27b1('0x5')]=function(_0x3ff813){for(var _0x2b3e8f=0x0,_0x1db2f6=events[_0x27b1('0x6')];_0x2b3e8f<_0x1db2f6;_0x2b3e8f++){var _0x35cee8=events[_0x2b3e8f];var _0xa44c41=createListener(_0x27b1('0x7')+_0x35cee8,_0x3ff813);ChatInteractionEvents['on'](_0x35cee8,_0xa44c41);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 7b20a9d..ad75a42 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 _0x871e=['/:id/messages','/:id/my_messages','getMyMessages','/:id/download','download','post','create','/:id/vidaoo','createVidaooSession','join','server/files/attachments/','format','now','originalname','replace','/:id/attachment_upload','file','attachmentUpload','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags','addTags','chatinteraction:update','update','put','/:id/custom_update','customUpdate','abandon','/:id/close','close','delete','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','/describe','describe','/:id','isChatInteractionAuthorized','/:id/attachment_download','attachmentDownload'];(function(_0xa7faf9,_0x12f4b5){var _0x260ded=function(_0x4c3e88){while(--_0x4c3e88){_0xa7faf9['push'](_0xa7faf9['shift']());}};_0x260ded(++_0x12f4b5);}(_0x871e,0xc6));var _0xe871=function(_0x31c171,_0x4db0e4){_0x31c171=_0x31c171-0x0;var _0x939252=_0x871e[_0x31c171];return _0x939252;};'use strict';var multer=require(_0xe871('0x0'));var util=require(_0xe871('0x1'));var path=require(_0xe871('0x2'));var timeout=require(_0xe871('0x3'));var express=require(_0xe871('0x4'));var router=express[_0xe871('0x5')]();var fs_extra=require(_0xe871('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xe871('0x7'));var config=require(_0xe871('0x8'));var controller=require(_0xe871('0x9'));router[_0xe871('0xa')]('/',auth[_0xe871('0xb')](),controller['index']);router[_0xe871('0xa')](_0xe871('0xc'),auth[_0xe871('0xb')](),controller[_0xe871('0xd')]);router[_0xe871('0xa')](_0xe871('0xe'),auth[_0xe871('0xf')](),controller['show']);router[_0xe871('0xa')](_0xe871('0x10'),auth[_0xe871('0xf')](),controller[_0xe871('0x11')]);router[_0xe871('0xa')](_0xe871('0x12'),auth[_0xe871('0xb')](),controller['getMessages']);router['get'](_0xe871('0x13'),auth[_0xe871('0xf')](),controller[_0xe871('0x14')]);router['get'](_0xe871('0x15'),auth['isAuthenticated'](),controller[_0xe871('0x16')]);router[_0xe871('0x17')]('/',auth['isAuthenticated'](),controller[_0xe871('0x18')]);router[_0xe871('0x17')](_0xe871('0x19'),auth[_0xe871('0xb')](),controller[_0xe871('0x1a')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5c708f,_0xb8dc30,_0x5d13f6){_0x5d13f6(null,path[_0xe871('0x1b')](config['root'],_0xe871('0x1c')));},'filename':function(_0x41008f,_0x4f000e,_0x5d4845){_0x5d4845(null,util[_0xe871('0x1d')]('%s-%s',Date[_0xe871('0x1e')](),_0x4f000e[_0xe871('0x1f')][_0xe871('0x20')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xe871('0x17')](_0xe871('0x21'),upload['single'](_0xe871('0x22')),controller[_0xe871('0x23')]);router['post']('/:id/messages',auth[_0xe871('0xf')](),controller[_0xe871('0x24')]);router['post'](_0xe871('0x25'),auth[_0xe871('0xb')](),interaction[_0xe871('0x26')](_0xe871('0x27'),_0xe871('0x28')),controller[_0xe871('0x29')]);router['put'](_0xe871('0xe'),auth[_0xe871('0xb')](),interaction[_0xe871('0x26')](_0xe871('0x27'),_0xe871('0x2a')),controller[_0xe871('0x2b')]);router[_0xe871('0x2c')](_0xe871('0x2d'),controller[_0xe871('0x2e')]);router[_0xe871('0x2c')]('/:id/abandon',auth[_0xe871('0xf')](),controller[_0xe871('0x2f')]);router[_0xe871('0x2c')](_0xe871('0x30'),controller[_0xe871('0x31')]);router[_0xe871('0x32')](_0xe871('0xe'),auth[_0xe871('0xb')](),interaction[_0xe871('0x26')](_0xe871('0x27'),'chatinteraction:destroy'),controller[_0xe871('0x33')]);router[_0xe871('0x32')](_0xe871('0x25'),auth[_0xe871('0xb')](),controller[_0xe871('0x34')]);module[_0xe871('0x35')]=router; \ No newline at end of file +var _0x8daa=['getMyMessages','/:id/download','download','create','post','/:id/vidaoo','join','root','server/files/attachments/','format','%s-%s','now','originalname','single','attachmentUpload','addMessage','/:id/tags','tracked','addTags','put','chat','chatinteraction:update','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','chatinteraction:destroy','destroy','delete','removeTags','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','/:id/messages','getMessages'];(function(_0x347fde,_0x12c9a9){var _0x2bf524=function(_0x58048b){while(--_0x58048b){_0x347fde['push'](_0x347fde['shift']());}};_0x2bf524(++_0x12c9a9);}(_0x8daa,0xe8));var _0xa8da=function(_0x5cab28,_0x307622){_0x5cab28=_0x5cab28-0x0;var _0xa3554d=_0x8daa[_0x5cab28];return _0xa3554d;};'use strict';var multer=require(_0xa8da('0x0'));var util=require(_0xa8da('0x1'));var path=require(_0xa8da('0x2'));var timeout=require(_0xa8da('0x3'));var express=require('express');var router=express[_0xa8da('0x4')]();var fs_extra=require(_0xa8da('0x5'));var auth=require(_0xa8da('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa8da('0x7'));var controller=require(_0xa8da('0x8'));router[_0xa8da('0x9')]('/',auth[_0xa8da('0xa')](),controller[_0xa8da('0xb')]);router['get']('/describe',auth[_0xa8da('0xa')](),controller['describe']);router[_0xa8da('0x9')](_0xa8da('0xc'),auth[_0xa8da('0xd')](),controller[_0xa8da('0xe')]);router[_0xa8da('0x9')](_0xa8da('0xf'),auth[_0xa8da('0xd')](),controller['attachmentDownload']);router[_0xa8da('0x9')](_0xa8da('0x10'),auth[_0xa8da('0xa')](),controller[_0xa8da('0x11')]);router[_0xa8da('0x9')]('/:id/my_messages',auth[_0xa8da('0xd')](),controller[_0xa8da('0x12')]);router[_0xa8da('0x9')](_0xa8da('0x13'),auth['isAuthenticated'](),controller[_0xa8da('0x14')]);router['post']('/',auth[_0xa8da('0xa')](),controller[_0xa8da('0x15')]);router[_0xa8da('0x16')](_0xa8da('0x17'),auth[_0xa8da('0xa')](),controller['createVidaooSession']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2d3f73,_0x257266,_0x259710){_0x259710(null,path[_0xa8da('0x18')](config[_0xa8da('0x19')],_0xa8da('0x1a')));},'filename':function(_0x164cb1,_0x188ad5,_0x2fbdb4){_0x2fbdb4(null,util[_0xa8da('0x1b')](_0xa8da('0x1c'),Date[_0xa8da('0x1d')](),_0x188ad5[_0xa8da('0x1e')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xa8da('0x16')]('/:id/attachment_upload',upload[_0xa8da('0x1f')]('file'),controller[_0xa8da('0x20')]);router[_0xa8da('0x16')](_0xa8da('0x10'),auth[_0xa8da('0xd')](),controller[_0xa8da('0x21')]);router[_0xa8da('0x16')](_0xa8da('0x22'),auth[_0xa8da('0xa')](),interaction[_0xa8da('0x23')]('chat','chatinteraction:addtags'),controller[_0xa8da('0x24')]);router[_0xa8da('0x25')](_0xa8da('0xc'),auth['isAuthenticated'](),interaction['tracked'](_0xa8da('0x26'),_0xa8da('0x27')),controller['update']);router[_0xa8da('0x25')](_0xa8da('0x28'),controller[_0xa8da('0x29')]);router[_0xa8da('0x25')](_0xa8da('0x2a'),auth['isChatInteractionAuthorized'](),controller[_0xa8da('0x2b')]);router[_0xa8da('0x25')](_0xa8da('0x2c'),controller['close']);router['delete']('/:id',auth[_0xa8da('0xa')](),interaction[_0xa8da('0x23')]('chat',_0xa8da('0x2d')),controller[_0xa8da('0x2e')]);router[_0xa8da('0x2f')](_0xa8da('0x22'),auth['isAuthenticated'](),controller[_0xa8da('0x30')]);module[_0xa8da('0x31')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 6932b8f..848e851 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 _0x9162=['medium','BOOLEAN','sequelize','exports','TEXT'];(function(_0x1e3dcd,_0x162eb6){var _0x804e1b=function(_0x34c733){while(--_0x34c733){_0x1e3dcd['push'](_0x1e3dcd['shift']());}};_0x804e1b(++_0x162eb6);}(_0x9162,0x1a6));var _0x2916=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0x9162[_0x2a6809];return _0x11c371;};'use strict';var Sequelize=require(_0x2916('0x0'));module[_0x2916('0x1')]={'body':{'type':Sequelize[_0x2916('0x2')](_0x2916('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x2916('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x436a=['medium','BOOLEAN','INTEGER','sequelize','exports','TEXT'];(function(_0x30ffc1,_0x556cd6){var _0x586b40=function(_0x2b0bed){while(--_0x2b0bed){_0x30ffc1['push'](_0x30ffc1['shift']());}};_0x586b40(++_0x556cd6);}(_0x436a,0x1e9));var _0xa436=function(_0x50faaa,_0x2f840a){_0x50faaa=_0x50faaa-0x0;var _0x1edd36=_0x436a[_0x50faaa];return _0x1edd36;};'use strict';var Sequelize=require(_0xa436('0x0'));module[_0xa436('0x1')]={'body':{'type':Sequelize[_0xa436('0x2')](_0xa436('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xa436('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xa436('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index f1ce68e..cf06845 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 _0xaa88=['request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','then','destroy','error','stack','name','send','index','rawAttributes','type','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','ChatInternalMessage','includeAll','include','findAll','rows','catch','params','options','find','create','body','update','describe','get','messages','lastMessageAt','createdAt','format','lastMessage','getUsers','User','user','fullname','role','userpic','internal','online','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','autoAssociation','UserProfileResource','isEmpty','agent','resourceId','push','FromId','ToId','-createdAt','all','eml-format','rimraf'];(function(_0x3a3758,_0x4dd8cf){var _0x1a9234=function(_0x3dda22){while(--_0x3dda22){_0x3a3758['push'](_0x3a3758['shift']());}};_0x1a9234(++_0x4dd8cf);}(_0xaa88,0x157));var _0x8aa8=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0xaa88[_0x36eaaa];return _0x461349;};'use strict';var emlformat=require(_0x8aa8('0x0'));var rimraf=require(_0x8aa8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8aa8('0x2'));var moment=require(_0x8aa8('0x3'));var BPromise=require(_0x8aa8('0x4'));var Mustache=require(_0x8aa8('0x5'));var util=require(_0x8aa8('0x6'));var path=require('path');var sox=require(_0x8aa8('0x7'));var csv=require('to-csv');var ejs=require(_0x8aa8('0x8'));var fs=require('fs');var fs_extra=require(_0x8aa8('0x9'));var _=require(_0x8aa8('0xa'));var squel=require(_0x8aa8('0xb'));var crypto=require(_0x8aa8('0xc'));var jsforce=require(_0x8aa8('0xd'));var deskjs=require(_0x8aa8('0xe'));var toCsv=require(_0x8aa8('0xf'));var querystring=require('querystring');var Papa=require(_0x8aa8('0x10'));var Redis=require(_0x8aa8('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8aa8('0x12'));var hardwareService=require(_0x8aa8('0x13'));var logger=require(_0x8aa8('0x14'))(_0x8aa8('0x15'));var utils=require(_0x8aa8('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x8aa8('0x17'));var db=require(_0x8aa8('0x18'))['db'];config[_0x8aa8('0x19')]=_[_0x8aa8('0x1a')](config['redis'],{'host':_0x8aa8('0x1b'),'port':0x18eb});var socket=require(_0x8aa8('0x1c'))(new Redis(config[_0x8aa8('0x19')]));require(_0x8aa8('0x1d'))['register'](socket);function respondWithStatusCode(_0x1b77fe,_0x3e1d6f){_0x3e1d6f=_0x3e1d6f||0xcc;return function(_0x4e4161){if(_0x4e4161){return _0x1b77fe[_0x8aa8('0x1e')](_0x3e1d6f);}return _0x1b77fe[_0x8aa8('0x1f')](_0x3e1d6f)[_0x8aa8('0x20')]();};}function respondWithResult(_0x3a8070,_0x52cbda){_0x52cbda=_0x52cbda||0xc8;return function(_0xf6ac4d){if(_0xf6ac4d){return _0x3a8070['status'](_0x52cbda)[_0x8aa8('0x21')](_0xf6ac4d);}};}function respondWithFilteredResult(_0x55439a,_0xef4e4){return function(_0x42109a){if(_0x42109a){var _0x5c77e5=typeof _0xef4e4[_0x8aa8('0x22')]===_0x8aa8('0x23')&&typeof _0xef4e4['limit']===_0x8aa8('0x23');var _0x459442=_0x42109a[_0x8aa8('0x24')];var _0x20fa19=_0x5c77e5?0x0:_0xef4e4[_0x8aa8('0x22')];var _0x13abe7=_0x5c77e5?_0x42109a['count']:_0xef4e4[_0x8aa8('0x22')]+_0xef4e4[_0x8aa8('0x25')];var _0x14547f;if(_0x13abe7>=_0x459442){_0x13abe7=_0x459442;_0x14547f=0xc8;}else{_0x14547f=0xce;}_0x55439a[_0x8aa8('0x1f')](_0x14547f);return _0x55439a[_0x8aa8('0x26')](_0x8aa8('0x27'),_0x20fa19+'-'+_0x13abe7+'/'+_0x459442)[_0x8aa8('0x21')](_0x42109a);}return null;};}function patchUpdates(_0x5d7fd8){return function(_0x43e0e1){try{jsonpatch[_0x8aa8('0x28')](_0x43e0e1,_0x5d7fd8,!![]);}catch(_0x4ad697){return BPromise[_0x8aa8('0x29')](_0x4ad697);}return _0x43e0e1['save']();};}function saveUpdates(_0x5770c5,_0x3c2d78){return function(_0x3470b7){if(_0x3470b7){return _0x3470b7['update'](_0x5770c5)[_0x8aa8('0x2a')](function(_0x21a65c){return _0x21a65c;});}return null;};}function removeEntity(_0x44498c,_0x6f0f3b){return function(_0xa0e9c9){if(_0xa0e9c9){return _0xa0e9c9[_0x8aa8('0x2b')]()[_0x8aa8('0x2a')](function(){_0x44498c[_0x8aa8('0x1f')](0xcc)[_0x8aa8('0x20')]();});}};}function handleEntityNotFound(_0x54e24b,_0x4b5b31){return function(_0x41bf2f){if(!_0x41bf2f){_0x54e24b[_0x8aa8('0x1e')](0x194);}return _0x41bf2f;};}function handleError(_0x550027,_0x1130be){_0x1130be=_0x1130be||0x1f4;return function(_0x1411f0){logger[_0x8aa8('0x2c')](_0x1411f0[_0x8aa8('0x2d')]);if(_0x1411f0[_0x8aa8('0x2e')]){delete _0x1411f0[_0x8aa8('0x2e')];}_0x550027['status'](_0x1130be)[_0x8aa8('0x2f')](_0x1411f0);};}exports[_0x8aa8('0x30')]=function(_0x5c72f6,_0x40bf69){var _0x44290a={},_0x4f81f4={},_0x425c34={'count':0x0,'rows':[]};var _0x206e7e=_['map'](db['ChatInternalMessage'][_0x8aa8('0x31')],function(_0x506adc){return{'name':_0x506adc['fieldName'],'type':_0x506adc[_0x8aa8('0x32')]['key']};});_0x4f81f4[_0x8aa8('0x33')]=_[_0x8aa8('0x34')](_0x206e7e,_0x8aa8('0x2e'));_0x4f81f4[_0x8aa8('0x35')]=_[_0x8aa8('0x36')](_0x5c72f6[_0x8aa8('0x35')]);_0x4f81f4['filters']=_[_0x8aa8('0x37')](_0x4f81f4[_0x8aa8('0x33')],_0x4f81f4[_0x8aa8('0x35')]);_0x44290a[_0x8aa8('0x38')]=_[_0x8aa8('0x37')](_0x4f81f4[_0x8aa8('0x33')],qs[_0x8aa8('0x39')](_0x5c72f6[_0x8aa8('0x35')]['fields']));_0x44290a['attributes']=_0x44290a[_0x8aa8('0x38')][_0x8aa8('0x3a')]?_0x44290a[_0x8aa8('0x38')]:_0x4f81f4[_0x8aa8('0x33')];if(!_0x5c72f6[_0x8aa8('0x35')][_0x8aa8('0x3b')](_0x8aa8('0x3c'))){_0x44290a[_0x8aa8('0x25')]=qs[_0x8aa8('0x25')](_0x5c72f6[_0x8aa8('0x35')][_0x8aa8('0x25')]);_0x44290a['offset']=qs[_0x8aa8('0x22')](_0x5c72f6['query'][_0x8aa8('0x22')]);}_0x44290a[_0x8aa8('0x3d')]=qs[_0x8aa8('0x3e')](_0x5c72f6[_0x8aa8('0x35')][_0x8aa8('0x3e')]);_0x44290a[_0x8aa8('0x3f')]=qs[_0x8aa8('0x40')](_[_0x8aa8('0x41')](_0x5c72f6[_0x8aa8('0x35')],_0x4f81f4[_0x8aa8('0x40')]),_0x206e7e);if(_0x5c72f6[_0x8aa8('0x35')][_0x8aa8('0x42')]){_0x44290a[_0x8aa8('0x3f')]=_[_0x8aa8('0x43')](_0x44290a[_0x8aa8('0x3f')],{'$or':_['map'](_0x206e7e,function(_0x240338){if(_0x240338[_0x8aa8('0x32')]!==_0x8aa8('0x44')){var _0xe01bbf={};_0xe01bbf[_0x240338[_0x8aa8('0x2e')]]={'$like':'%'+_0x5c72f6[_0x8aa8('0x35')][_0x8aa8('0x42')]+'%'};return _0xe01bbf;}})});}_0x44290a=_['merge']({},_0x44290a,_0x5c72f6['options']);var _0x548ac2={'where':_0x44290a['where']};return db[_0x8aa8('0x45')][_0x8aa8('0x24')](_0x548ac2)[_0x8aa8('0x2a')](function(_0x2149bd){_0x425c34['count']=_0x2149bd;if(_0x5c72f6[_0x8aa8('0x35')][_0x8aa8('0x46')]){_0x44290a[_0x8aa8('0x47')]=[{'all':!![]}];}return db[_0x8aa8('0x45')][_0x8aa8('0x48')](_0x44290a);})[_0x8aa8('0x2a')](function(_0x3be3a9){_0x425c34[_0x8aa8('0x49')]=_0x3be3a9;return _0x425c34;})[_0x8aa8('0x2a')](respondWithFilteredResult(_0x40bf69,_0x44290a))[_0x8aa8('0x4a')](handleError(_0x40bf69,null));};exports['show']=function(_0x2c5f57,_0x1c41ed){var _0x1ef578={'raw':!![],'where':{'id':_0x2c5f57[_0x8aa8('0x4b')]['id']}},_0x313233={};_0x313233[_0x8aa8('0x33')]=_[_0x8aa8('0x36')](db[_0x8aa8('0x45')][_0x8aa8('0x31')]);_0x313233[_0x8aa8('0x35')]=_[_0x8aa8('0x36')](_0x2c5f57[_0x8aa8('0x35')]);_0x313233[_0x8aa8('0x40')]=_[_0x8aa8('0x37')](_0x313233[_0x8aa8('0x33')],_0x313233[_0x8aa8('0x35')]);_0x1ef578['attributes']=_[_0x8aa8('0x37')](_0x313233[_0x8aa8('0x33')],qs[_0x8aa8('0x39')](_0x2c5f57[_0x8aa8('0x35')][_0x8aa8('0x39')]));_0x1ef578[_0x8aa8('0x38')]=_0x1ef578['attributes'][_0x8aa8('0x3a')]?_0x1ef578[_0x8aa8('0x38')]:_0x313233[_0x8aa8('0x33')];if(_0x2c5f57[_0x8aa8('0x35')][_0x8aa8('0x46')]){_0x1ef578[_0x8aa8('0x47')]=[{'all':!![]}];}_0x1ef578=_[_0x8aa8('0x43')]({},_0x1ef578,_0x2c5f57[_0x8aa8('0x4c')]);return db['ChatInternalMessage'][_0x8aa8('0x4d')](_0x1ef578)[_0x8aa8('0x2a')](handleEntityNotFound(_0x1c41ed,null))[_0x8aa8('0x2a')](respondWithResult(_0x1c41ed,null))[_0x8aa8('0x4a')](handleError(_0x1c41ed,null));};exports[_0x8aa8('0x4e')]=function(_0x291c71,_0x1bc250){return db[_0x8aa8('0x45')]['create'](_0x291c71[_0x8aa8('0x4f')],{})[_0x8aa8('0x2a')](respondWithResult(_0x1bc250,0xc9))[_0x8aa8('0x4a')](handleError(_0x1bc250,null));};exports[_0x8aa8('0x50')]=function(_0x5cd9d5,_0x173678){if(_0x5cd9d5['body']['id']){delete _0x5cd9d5[_0x8aa8('0x4f')]['id'];}return db[_0x8aa8('0x45')]['find']({'where':{'id':_0x5cd9d5[_0x8aa8('0x4b')]['id']}})[_0x8aa8('0x2a')](handleEntityNotFound(_0x173678,null))[_0x8aa8('0x2a')](saveUpdates(_0x5cd9d5[_0x8aa8('0x4f')],null))[_0x8aa8('0x2a')](respondWithResult(_0x173678,null))[_0x8aa8('0x4a')](handleError(_0x173678,null));};exports[_0x8aa8('0x2b')]=function(_0x516565,_0x7c040e){return db['ChatInternalMessage']['find']({'where':{'id':_0x516565['params']['id']}})[_0x8aa8('0x2a')](handleEntityNotFound(_0x7c040e,null))[_0x8aa8('0x2a')](removeEntity(_0x7c040e,null))[_0x8aa8('0x4a')](handleError(_0x7c040e,null));};exports[_0x8aa8('0x51')]=function(_0xc04954,_0x2f406f){return db['ChatInternalMessage']['describe']()[_0x8aa8('0x2a')](respondWithResult(_0x2f406f,null))[_0x8aa8('0x4a')](handleError(_0x2f406f,null));};function wrapUser(_0x44ba5e){return function(_0x386898){var _0xabb7=_0x44ba5e[_0x8aa8('0x52')]({'plain':!![]});_0xabb7[_0x8aa8('0x53')]=[];if(_0x386898){_0xabb7[_0x8aa8('0x54')]=_0x386898[_0x8aa8('0x55')];_0xabb7['lastMessage']=_0x386898;}else{_0xabb7[_0x8aa8('0x54')]=moment(0x0)[_0x8aa8('0x56')]('YYYY-MM-DD\x20HH:mm:ss');_0xabb7[_0x8aa8('0x57')]={};}return _0xabb7;};}exports[_0x8aa8('0x58')]=function(_0x32990a,_0x107008,_0x8669fc){var _0x50a322=[];return db[_0x8aa8('0x59')][_0x8aa8('0x48')]({'where':{'role':['agent','admin',_0x8aa8('0x5a')]},'attributes':['id',_0x8aa8('0x5b'),'name',_0x8aa8('0x5c'),_0x8aa8('0x5d'),_0x8aa8('0x5e'),_0x8aa8('0x5f'),_0x8aa8('0x60'),_0x8aa8('0x61'),_0x8aa8('0x62')],'order':qs[_0x8aa8('0x3e')](_0x8aa8('0x63')),'include':[{'model':db[_0x8aa8('0x64')],'as':_0x8aa8('0x65'),'attributes':['id',_0x8aa8('0x2e'),_0x8aa8('0x32')],'through':{'attributes':[]}}]})[_0x8aa8('0x2a')](function(_0x2079cd){if(_0x2079cd){var _0x3a941b=_0x32990a[_0x8aa8('0x5a')][_0x8aa8('0x52')]({'plain':!![]});if(!_0x3a941b)throw new Error(_0x8aa8('0x66'));if(_0x3a941b[_0x8aa8('0x5c')]==='user'){return db[_0x8aa8('0x67')][_0x8aa8('0x4d')]({'where':{'name':_0x8aa8('0x68'),'userProfileId':_0x3a941b['userProfileId']},'raw':!![]})[_0x8aa8('0x2a')](function(_0x22034d){if(_0x22034d){if(_0x22034d[_0x8aa8('0x69')]===0x0){return db[_0x8aa8('0x6a')]['findAll']({'where':{'sectionId':_0x22034d['id']},'raw':!![]})['then'](function(_0x3a28e0){var _0x48d761=[];if(_[_0x8aa8('0x6b')](_0x3a28e0)){_0x48d761=_[_0x8aa8('0x42')](_0x2079cd,function(_0x44cab6){if(_0x44cab6[_0x8aa8('0x5c')]!=='agent'){return _0x44cab6;}});return _0x48d761;}else{for(var _0x31dec1=0x0;_0x31dec1<_0x2079cd[_0x8aa8('0x3a')];_0x31dec1++){var _0x3e11fa=_0x2079cd[_0x31dec1];if(_0x3e11fa[_0x8aa8('0x5c')]===_0x8aa8('0x6c')){var _0x42d343=_[_0x8aa8('0x4d')](_0x3a28e0,function(_0x34d20a){return _0x34d20a[_0x8aa8('0x6d')]===_0x3e11fa['id'];});if(_0x42d343)_0x48d761['push'](_0x3e11fa);}else{_0x48d761[_0x8aa8('0x6e')](_0x3e11fa);}}return _0x48d761;}});}else{return _0x2079cd;}}else{var _0x871b2f=_[_0x8aa8('0x42')](_0x2079cd,function(_0x3c672b){if(_0x3c672b['role']!=='agent'){return _0x3c672b;}});return _0x871b2f;}});}else{return _0x2079cd;}}})[_0x8aa8('0x2a')](function(_0x2756da){var _0xa23a3f=[];if(_0x2756da){_0x50a322=_0x2756da;for(var _0x39447a=0x0;_0x39447a<_0x2756da[_0x8aa8('0x3a')];_0x39447a+=0x1){_0x50a322[_0x39447a][_0x8aa8('0x53')]=[];_0xa23a3f[_0x8aa8('0x6e')](db[_0x8aa8('0x45')][_0x8aa8('0x4d')]({'where':{'FromId':[_0x32990a[_0x8aa8('0x5a')]['id'],_0x2756da[_0x39447a]['id']],'ToId':[_0x32990a[_0x8aa8('0x5a')]['id'],_0x2756da[_0x39447a]['id']],'ChatGroupId':null},'attributes':['id','createdAt',_0x8aa8('0x6f'),_0x8aa8('0x70'),'read',_0x8aa8('0x4f')],'order':qs[_0x8aa8('0x3e')](_0x8aa8('0x71')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x8aa8('0x2a')](wrapUser(_0x2756da[_0x39447a])));}return BPromise[_0x8aa8('0x72')](_0xa23a3f);}return[];})[_0x8aa8('0x2a')](function(_0x5ac00e){return{'rows':_0x5ac00e,'count':_0x5ac00e[_0x8aa8('0x3a')]};})[_0x8aa8('0x2a')](respondWithResult(_0x107008,null))[_0x8aa8('0x4a')](handleError(_0x107008,null));}; \ No newline at end of file +var _0x2f21=['querystring','../../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','./chatInternalMessage.socket','register','status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','sendStatus','error','name','send','index','map','ChatInternalMessage','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','params','model','includeAll','create','body','find','describe','get','messages','createdAt','lastMessage','lastMessageAt','format','YYYY-MM-DD\x20HH:mm:ss','User','agent','admin','user','fullname','role','userpic','online','lastLoginAt','allowmessenger','showWebBar','VoiceQueue','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','FromId','ToId','read','all','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','jsforce','desk.js'];(function(_0x418b0f,_0xfc41a2){var _0x59c1e6=function(_0x51fdb9){while(--_0x51fdb9){_0x418b0f['push'](_0x418b0f['shift']());}};_0x59c1e6(++_0xfc41a2);}(_0x2f21,0x1b4));var _0x12f2=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x2f21[_0xefd519];return _0x4bb882;};'use strict';var emlformat=require(_0x12f2('0x0'));var rimraf=require(_0x12f2('0x1'));var zipdir=require(_0x12f2('0x2'));var jsonpatch=require(_0x12f2('0x3'));var rp=require(_0x12f2('0x4'));var moment=require(_0x12f2('0x5'));var BPromise=require(_0x12f2('0x6'));var Mustache=require(_0x12f2('0x7'));var util=require(_0x12f2('0x8'));var path=require(_0x12f2('0x9'));var sox=require('sox');var csv=require(_0x12f2('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x12f2('0xb'));var _=require(_0x12f2('0xc'));var squel=require(_0x12f2('0xd'));var crypto=require('crypto');var jsforce=require(_0x12f2('0xe'));var deskjs=require(_0x12f2('0xf'));var toCsv=require('to-csv');var querystring=require(_0x12f2('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x12f2('0x11'));var qs=require(_0x12f2('0x12'));var as=require(_0x12f2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x12f2('0x14'))(_0x12f2('0x15'));var utils=require(_0x12f2('0x16'));var config=require(_0x12f2('0x17'));var licenseUtil=require(_0x12f2('0x18'));var db=require(_0x12f2('0x19'))['db'];config[_0x12f2('0x1a')]=_[_0x12f2('0x1b')](config[_0x12f2('0x1a')],{'host':_0x12f2('0x1c'),'port':0x18eb});var socket=require(_0x12f2('0x1d'))(new Redis(config['redis']));require(_0x12f2('0x1e'))[_0x12f2('0x1f')](socket);function respondWithStatusCode(_0x2081ad,_0x4c9769){_0x4c9769=_0x4c9769||0xcc;return function(_0x8de63a){if(_0x8de63a){return _0x2081ad['sendStatus'](_0x4c9769);}return _0x2081ad[_0x12f2('0x20')](_0x4c9769)[_0x12f2('0x21')]();};}function respondWithResult(_0x32d82b,_0x4b6a77){_0x4b6a77=_0x4b6a77||0xc8;return function(_0x347f9d){if(_0x347f9d){return _0x32d82b[_0x12f2('0x20')](_0x4b6a77)[_0x12f2('0x22')](_0x347f9d);}};}function respondWithFilteredResult(_0x2452bd,_0x4575ba){return function(_0x34f03f){if(_0x34f03f){var _0x3c1b04=typeof _0x4575ba[_0x12f2('0x23')]==='undefined'&&typeof _0x4575ba[_0x12f2('0x24')]===_0x12f2('0x25');var _0x5b2ca3=_0x34f03f[_0x12f2('0x26')];var _0x1c0581=_0x3c1b04?0x0:_0x4575ba[_0x12f2('0x23')];var _0x5dce1a=_0x3c1b04?_0x34f03f['count']:_0x4575ba['offset']+_0x4575ba[_0x12f2('0x24')];var _0x61ceff;if(_0x5dce1a>=_0x5b2ca3){_0x5dce1a=_0x5b2ca3;_0x61ceff=0xc8;}else{_0x61ceff=0xce;}_0x2452bd[_0x12f2('0x20')](_0x61ceff);return _0x2452bd[_0x12f2('0x27')]('Content-Range',_0x1c0581+'-'+_0x5dce1a+'/'+_0x5b2ca3)['json'](_0x34f03f);}return null;};}function patchUpdates(_0x407863){return function(_0x2bb766){try{jsonpatch[_0x12f2('0x28')](_0x2bb766,_0x407863,!![]);}catch(_0x5af436){return BPromise[_0x12f2('0x29')](_0x5af436);}return _0x2bb766[_0x12f2('0x2a')]();};}function saveUpdates(_0x42bb74,_0x584f45){return function(_0x97d6f3){if(_0x97d6f3){return _0x97d6f3[_0x12f2('0x2b')](_0x42bb74)[_0x12f2('0x2c')](function(_0x53f267){return _0x53f267;});}return null;};}function removeEntity(_0x5c9898,_0x462dbe){return function(_0x10b895){if(_0x10b895){return _0x10b895[_0x12f2('0x2d')]()[_0x12f2('0x2c')](function(){_0x5c9898[_0x12f2('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x37487f,_0x47a20c){return function(_0x4f6d5d){if(!_0x4f6d5d){_0x37487f[_0x12f2('0x2e')](0x194);}return _0x4f6d5d;};}function handleError(_0x56b867,_0x2652e3){_0x2652e3=_0x2652e3||0x1f4;return function(_0xe904ec){logger[_0x12f2('0x2f')](_0xe904ec['stack']);if(_0xe904ec[_0x12f2('0x30')]){delete _0xe904ec[_0x12f2('0x30')];}_0x56b867[_0x12f2('0x20')](_0x2652e3)[_0x12f2('0x31')](_0xe904ec);};}exports[_0x12f2('0x32')]=function(_0x37ad1d,_0x47d017){var _0x5a5ba7={},_0x47c3d8={},_0x2d12c0={'count':0x0,'rows':[]};var _0x4bf462=_[_0x12f2('0x33')](db[_0x12f2('0x34')][_0x12f2('0x35')],function(_0x57d995){return{'name':_0x57d995[_0x12f2('0x36')],'type':_0x57d995[_0x12f2('0x37')][_0x12f2('0x38')]};});_0x47c3d8['model']=_[_0x12f2('0x33')](_0x4bf462,_0x12f2('0x30'));_0x47c3d8[_0x12f2('0x39')]=_[_0x12f2('0x3a')](_0x37ad1d[_0x12f2('0x39')]);_0x47c3d8[_0x12f2('0x3b')]=_[_0x12f2('0x3c')](_0x47c3d8['model'],_0x47c3d8[_0x12f2('0x39')]);_0x5a5ba7[_0x12f2('0x3d')]=_[_0x12f2('0x3c')](_0x47c3d8['model'],qs[_0x12f2('0x3e')](_0x37ad1d[_0x12f2('0x39')][_0x12f2('0x3e')]));_0x5a5ba7['attributes']=_0x5a5ba7['attributes'][_0x12f2('0x3f')]?_0x5a5ba7[_0x12f2('0x3d')]:_0x47c3d8['model'];if(!_0x37ad1d['query']['hasOwnProperty'](_0x12f2('0x40'))){_0x5a5ba7[_0x12f2('0x24')]=qs[_0x12f2('0x24')](_0x37ad1d[_0x12f2('0x39')][_0x12f2('0x24')]);_0x5a5ba7[_0x12f2('0x23')]=qs['offset'](_0x37ad1d[_0x12f2('0x39')]['offset']);}_0x5a5ba7[_0x12f2('0x41')]=qs[_0x12f2('0x42')](_0x37ad1d[_0x12f2('0x39')]['sort']);_0x5a5ba7[_0x12f2('0x43')]=qs[_0x12f2('0x3b')](_[_0x12f2('0x44')](_0x37ad1d[_0x12f2('0x39')],_0x47c3d8['filters']),_0x4bf462);if(_0x37ad1d[_0x12f2('0x39')][_0x12f2('0x45')]){_0x5a5ba7[_0x12f2('0x43')]=_[_0x12f2('0x46')](_0x5a5ba7[_0x12f2('0x43')],{'$or':_[_0x12f2('0x33')](_0x4bf462,function(_0x1c9e32){if(_0x1c9e32[_0x12f2('0x37')]!==_0x12f2('0x47')){var _0x3139d7={};_0x3139d7[_0x1c9e32[_0x12f2('0x30')]]={'$like':'%'+_0x37ad1d[_0x12f2('0x39')][_0x12f2('0x45')]+'%'};return _0x3139d7;}})});}_0x5a5ba7=_[_0x12f2('0x46')]({},_0x5a5ba7,_0x37ad1d[_0x12f2('0x48')]);var _0x580ec2={'where':_0x5a5ba7['where']};return db[_0x12f2('0x34')][_0x12f2('0x26')](_0x580ec2)[_0x12f2('0x2c')](function(_0x589a57){_0x2d12c0['count']=_0x589a57;if(_0x37ad1d[_0x12f2('0x39')]['includeAll']){_0x5a5ba7[_0x12f2('0x49')]=[{'all':!![]}];}return db['ChatInternalMessage'][_0x12f2('0x4a')](_0x5a5ba7);})[_0x12f2('0x2c')](function(_0xe7b56f){_0x2d12c0[_0x12f2('0x4b')]=_0xe7b56f;return _0x2d12c0;})['then'](respondWithFilteredResult(_0x47d017,_0x5a5ba7))[_0x12f2('0x4c')](handleError(_0x47d017,null));};exports['show']=function(_0x2d039d,_0x3f2253){var _0x1331e5={'raw':!![],'where':{'id':_0x2d039d[_0x12f2('0x4d')]['id']}},_0x5690d1={};_0x5690d1['model']=_[_0x12f2('0x3a')](db[_0x12f2('0x34')]['rawAttributes']);_0x5690d1[_0x12f2('0x39')]=_['keys'](_0x2d039d[_0x12f2('0x39')]);_0x5690d1[_0x12f2('0x3b')]=_[_0x12f2('0x3c')](_0x5690d1[_0x12f2('0x4e')],_0x5690d1[_0x12f2('0x39')]);_0x1331e5['attributes']=_[_0x12f2('0x3c')](_0x5690d1['model'],qs[_0x12f2('0x3e')](_0x2d039d[_0x12f2('0x39')][_0x12f2('0x3e')]));_0x1331e5[_0x12f2('0x3d')]=_0x1331e5[_0x12f2('0x3d')][_0x12f2('0x3f')]?_0x1331e5[_0x12f2('0x3d')]:_0x5690d1['model'];if(_0x2d039d[_0x12f2('0x39')][_0x12f2('0x4f')]){_0x1331e5[_0x12f2('0x49')]=[{'all':!![]}];}_0x1331e5=_[_0x12f2('0x46')]({},_0x1331e5,_0x2d039d[_0x12f2('0x48')]);return db[_0x12f2('0x34')]['find'](_0x1331e5)[_0x12f2('0x2c')](handleEntityNotFound(_0x3f2253,null))[_0x12f2('0x2c')](respondWithResult(_0x3f2253,null))['catch'](handleError(_0x3f2253,null));};exports['create']=function(_0x753bd8,_0x13e0c0){return db[_0x12f2('0x34')][_0x12f2('0x50')](_0x753bd8[_0x12f2('0x51')],{})[_0x12f2('0x2c')](respondWithResult(_0x13e0c0,0xc9))[_0x12f2('0x4c')](handleError(_0x13e0c0,null));};exports[_0x12f2('0x2b')]=function(_0x16d8d7,_0x4e78f7){if(_0x16d8d7['body']['id']){delete _0x16d8d7['body']['id'];}return db[_0x12f2('0x34')][_0x12f2('0x52')]({'where':{'id':_0x16d8d7['params']['id']}})[_0x12f2('0x2c')](handleEntityNotFound(_0x4e78f7,null))[_0x12f2('0x2c')](saveUpdates(_0x16d8d7[_0x12f2('0x51')],null))['then'](respondWithResult(_0x4e78f7,null))[_0x12f2('0x4c')](handleError(_0x4e78f7,null));};exports[_0x12f2('0x2d')]=function(_0x506b7e,_0x418667){return db['ChatInternalMessage'][_0x12f2('0x52')]({'where':{'id':_0x506b7e[_0x12f2('0x4d')]['id']}})['then'](handleEntityNotFound(_0x418667,null))['then'](removeEntity(_0x418667,null))[_0x12f2('0x4c')](handleError(_0x418667,null));};exports[_0x12f2('0x53')]=function(_0x501279,_0x2bc9e2){return db[_0x12f2('0x34')][_0x12f2('0x53')]()[_0x12f2('0x2c')](respondWithResult(_0x2bc9e2,null))[_0x12f2('0x4c')](handleError(_0x2bc9e2,null));};function wrapUser(_0x3a60a6){return function(_0xdb19a6){var _0x594b5e=_0x3a60a6[_0x12f2('0x54')]({'plain':!![]});_0x594b5e[_0x12f2('0x55')]=[];if(_0xdb19a6){_0x594b5e['lastMessageAt']=_0xdb19a6[_0x12f2('0x56')];_0x594b5e[_0x12f2('0x57')]=_0xdb19a6;}else{_0x594b5e[_0x12f2('0x58')]=moment(0x0)[_0x12f2('0x59')](_0x12f2('0x5a'));_0x594b5e[_0x12f2('0x57')]={};}return _0x594b5e;};}exports['getUsers']=function(_0x350c24,_0x3e2476,_0x344d71){var _0x828e2b=[];return db[_0x12f2('0x5b')][_0x12f2('0x4a')]({'where':{'role':[_0x12f2('0x5c'),_0x12f2('0x5d'),_0x12f2('0x5e')]},'attributes':['id',_0x12f2('0x5f'),'name',_0x12f2('0x60'),_0x12f2('0x61'),'internal',_0x12f2('0x62'),_0x12f2('0x63'),_0x12f2('0x64'),_0x12f2('0x65')],'order':qs[_0x12f2('0x42')]('-online'),'include':[{'model':db[_0x12f2('0x66')],'as':'VoiceQueues','attributes':['id','name',_0x12f2('0x37')],'through':{'attributes':[]}}]})[_0x12f2('0x2c')](function(_0x41d4ed){if(_0x41d4ed){var _0x1aeb1f=_0x350c24[_0x12f2('0x5e')][_0x12f2('0x54')]({'plain':!![]});if(!_0x1aeb1f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1aeb1f[_0x12f2('0x60')]===_0x12f2('0x5e')){return db[_0x12f2('0x67')]['find']({'where':{'name':_0x12f2('0x68'),'userProfileId':_0x1aeb1f[_0x12f2('0x69')]},'raw':!![]})['then'](function(_0x16d496){if(_0x16d496){if(_0x16d496[_0x12f2('0x6a')]===0x0){return db[_0x12f2('0x6b')][_0x12f2('0x4a')]({'where':{'sectionId':_0x16d496['id']},'raw':!![]})['then'](function(_0x8e157a){var _0x4f05bc=[];if(_[_0x12f2('0x6c')](_0x8e157a)){_0x4f05bc=_['filter'](_0x41d4ed,function(_0x6caf50){if(_0x6caf50['role']!==_0x12f2('0x5c')){return _0x6caf50;}});return _0x4f05bc;}else{for(var _0x300f78=0x0;_0x300f78<_0x41d4ed[_0x12f2('0x3f')];_0x300f78++){var _0x574ed3=_0x41d4ed[_0x300f78];if(_0x574ed3[_0x12f2('0x60')]===_0x12f2('0x5c')){var _0x1a7be4=_[_0x12f2('0x52')](_0x8e157a,function(_0x847779){return _0x847779['resourceId']===_0x574ed3['id'];});if(_0x1a7be4)_0x4f05bc['push'](_0x574ed3);}else{_0x4f05bc['push'](_0x574ed3);}}return _0x4f05bc;}});}else{return _0x41d4ed;}}else{var _0x5dd158=_[_0x12f2('0x45')](_0x41d4ed,function(_0x1db243){if(_0x1db243['role']!==_0x12f2('0x5c')){return _0x1db243;}});return _0x5dd158;}});}else{return _0x41d4ed;}}})[_0x12f2('0x2c')](function(_0x313c43){var _0x5e3621=[];if(_0x313c43){_0x828e2b=_0x313c43;for(var _0x1a8367=0x0;_0x1a8367<_0x313c43[_0x12f2('0x3f')];_0x1a8367+=0x1){_0x828e2b[_0x1a8367][_0x12f2('0x55')]=[];_0x5e3621['push'](db[_0x12f2('0x34')][_0x12f2('0x52')]({'where':{'FromId':[_0x350c24[_0x12f2('0x5e')]['id'],_0x313c43[_0x1a8367]['id']],'ToId':[_0x350c24[_0x12f2('0x5e')]['id'],_0x313c43[_0x1a8367]['id']],'ChatGroupId':null},'attributes':['id',_0x12f2('0x56'),_0x12f2('0x6d'),_0x12f2('0x6e'),_0x12f2('0x6f'),_0x12f2('0x51')],'order':qs['sort']('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x313c43[_0x1a8367])));}return BPromise[_0x12f2('0x70')](_0x5e3621);}return[];})[_0x12f2('0x2c')](function(_0x28f3f4){return{'rows':_0x28f3f4,'count':_0x28f3f4[_0x12f2('0x3f')]};})[_0x12f2('0x2c')](respondWithResult(_0x3e2476,null))['catch'](handleError(_0x3e2476,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index d2ebb78..91cc5c2 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 _0xfa21=['setMaxListeners','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x5c9546,_0x37bb11){var _0x34a88a=function(_0x5947e0){while(--_0x5947e0){_0x5c9546['push'](_0x5c9546['shift']());}};_0x34a88a(++_0x37bb11);}(_0xfa21,0x136));var _0x1fa2=function(_0x12029e,_0x5e91c0){_0x12029e=_0x12029e-0x0;var _0x2e1d1e=_0xfa21[_0x12029e];return _0x2e1d1e;};'use strict';var EventEmitter=require(_0x1fa2('0x0'));var ChatInternalMessage=require(_0x1fa2('0x1'))['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x1fa2('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1fa2('0x3'),'afterDestroy':'remove'};function emitEvent(_0x5b5923){return function(_0x2ef677,_0xb5424b,_0x957cc8){ChatInternalMessageEvents[_0x1fa2('0x4')](_0x5b5923+':'+_0x2ef677['id'],_0x2ef677);ChatInternalMessageEvents[_0x1fa2('0x4')](_0x5b5923,_0x2ef677);_0x957cc8(null);};}for(var e in events){if(events[_0x1fa2('0x5')](e)){var event=events[e];ChatInternalMessage[_0x1fa2('0x6')](e,emitEvent(event));}}module[_0x1fa2('0x7')]=ChatInternalMessageEvents; \ No newline at end of file +var _0x76fe=['ChatInternalMessage','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x5317b5,_0x4dfd6e){var _0x3b7ce2=function(_0xc146d6){while(--_0xc146d6){_0x5317b5['push'](_0x5317b5['shift']());}};_0x3b7ce2(++_0x4dfd6e);}(_0x76fe,0x179));var _0xe76f=function(_0x5352aa,_0x13fbee){_0x5352aa=_0x5352aa-0x0;var _0x19b8ad=_0x76fe[_0x5352aa];return _0x19b8ad;};'use strict';var EventEmitter=require(_0xe76f('0x0'));var ChatInternalMessage=require('../../mysqldb')['db'][_0xe76f('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xe76f('0x2')](0x0);var events={'afterCreate':_0xe76f('0x3'),'afterUpdate':_0xe76f('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5368b9){return function(_0x5d1267,_0x536669,_0x7e5335){ChatInternalMessageEvents['emit'](_0x5368b9+':'+_0x5d1267['id'],_0x5d1267);ChatInternalMessageEvents[_0xe76f('0x5')](_0x5368b9,_0x5d1267);_0x7e5335(null);};}for(var e in events){if(events[_0xe76f('0x6')](e)){var event=events[e];ChatInternalMessage[_0xe76f('0x7')](e,emitEvent(event));}}module[_0xe76f('0x8')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index b8b23de..32d610e 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 _0xb5b0=['utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./chatInternalMessage.attributes','ChatInternalMessage','chat_internal_messages'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0xb5b0,0x1bd));var _0x0b5b=function(_0xc2722e,_0x4c43c2){_0xc2722e=_0xc2722e-0x0;var _0x2d5fb1=_0xb5b0[_0xc2722e];return _0x2d5fb1;};'use strict';var _=require(_0x0b5b('0x0'));var util=require(_0x0b5b('0x1'));var logger=require(_0x0b5b('0x2'))(_0x0b5b('0x3'));var moment=require('moment');var BPromise=require(_0x0b5b('0x4'));var rp=require(_0x0b5b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0b5b('0x6'));var config=require(_0x0b5b('0x7'));var attributes=require(_0x0b5b('0x8'));module['exports']=function(_0x3019c3,_0x484df6){return _0x3019c3['define'](_0x0b5b('0x9'),attributes,{'tableName':_0x0b5b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0b5b('0xb')});}; \ No newline at end of file +var _0xcac1=['chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','ChatInternalMessage'];(function(_0x2c99e2,_0x3d806f){var _0x5bb938=function(_0x408228){while(--_0x408228){_0x2c99e2['push'](_0x2c99e2['shift']());}};_0x5bb938(++_0x3d806f);}(_0xcac1,0x120));var _0x1cac=function(_0x819ce,_0xf25f51){_0x819ce=_0x819ce-0x0;var _0x1edcf0=_0xcac1[_0x819ce];return _0x1edcf0;};'use strict';var _=require(_0x1cac('0x0'));var util=require(_0x1cac('0x1'));var logger=require(_0x1cac('0x2'))(_0x1cac('0x3'));var moment=require(_0x1cac('0x4'));var BPromise=require(_0x1cac('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cac('0x6'));var rimraf=require(_0x1cac('0x7'));var config=require(_0x1cac('0x8'));var attributes=require('./chatInternalMessage.attributes');module[_0x1cac('0x9')]=function(_0x3ab947,_0x243b33){return _0x3ab947[_0x1cac('0xa')](_0x1cac('0xb'),attributes,{'tableName':_0x1cac('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1cac('0xd'),'collate':_0x1cac('0xe')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 562bbf8..4d026fc 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 _0x8ee5=['register','request','then','info','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','ChatInternalMessage,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./chatInternalMessage.socket'];(function(_0x11c6b8,_0x5b2d7b){var _0x38b38f=function(_0x641ad0){while(--_0x641ad0){_0x11c6b8['push'](_0x11c6b8['shift']());}};_0x38b38f(++_0x5b2d7b);}(_0x8ee5,0x179));var _0x58ee=function(_0x37a5fd,_0x53ecc3){_0x37a5fd=_0x37a5fd-0x0;var _0x155c83=_0x8ee5[_0x37a5fd];return _0x155c83;};'use strict';var _=require('lodash');var util=require(_0x58ee('0x0'));var moment=require(_0x58ee('0x1'));var BPromise=require(_0x58ee('0x2'));var rs=require(_0x58ee('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x58ee('0x4'));var logger=require(_0x58ee('0x5'))('rpc');var config=require(_0x58ee('0x6'));var jayson=require(_0x58ee('0x7'));var client=jayson[_0x58ee('0x8')]['http']({'port':0x232a});config[_0x58ee('0x9')]=_['defaults'](config[_0x58ee('0x9')],{'host':_0x58ee('0xa'),'port':0x18eb});var socket=require(_0x58ee('0xb'))(new Redis(config[_0x58ee('0x9')]));require(_0x58ee('0xc'))[_0x58ee('0xd')](socket);function respondWithRpcPromise(_0x1d2d1d,_0x6bde7b,_0x14c6d0){return new BPromise(function(_0x5f240d,_0x5ade96){return client[_0x58ee('0xe')](_0x1d2d1d,_0x14c6d0)[_0x58ee('0xf')](function(_0x2a777e){logger[_0x58ee('0x10')]('ChatInternalMessage,\x20%s,\x20%s',_0x6bde7b,_0x58ee('0x11'));logger[_0x58ee('0x12')](_0x58ee('0x13'),_0x6bde7b,_0x58ee('0x11'),JSON[_0x58ee('0x14')](_0x2a777e));if(_0x2a777e[_0x58ee('0x15')]){if(_0x2a777e['error']['code']===0x1f4){logger[_0x58ee('0x15')](_0x58ee('0x16'),_0x6bde7b,_0x2a777e[_0x58ee('0x15')][_0x58ee('0x17')]);return _0x5ade96(_0x2a777e[_0x58ee('0x15')][_0x58ee('0x17')]);}logger['error'](_0x58ee('0x16'),_0x6bde7b,_0x2a777e[_0x58ee('0x15')]['message']);return _0x5f240d(_0x2a777e[_0x58ee('0x15')]['message']);}else{logger['info'](_0x58ee('0x16'),_0x6bde7b,_0x58ee('0x11'));_0x5f240d(_0x2a777e[_0x58ee('0x18')][_0x58ee('0x17')]);}})[_0x58ee('0x19')](function(_0x41efec){logger['error'](_0x58ee('0x16'),_0x6bde7b,_0x41efec);_0x5ade96(_0x41efec);});});} \ No newline at end of file +var _0xa8f0=['stringify','error','code','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','request','info','ChatInternalMessage,\x20%s,\x20%s','ChatInternalMessage,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa8f0,0x123));var _0x0a8f=function(_0x9d9d58,_0x7bf873){_0x9d9d58=_0x9d9d58-0x0;var _0x51d4d3=_0xa8f0[_0x9d9d58];return _0x51d4d3;};'use strict';var _=require(_0x0a8f('0x0'));var util=require(_0x0a8f('0x1'));var moment=require(_0x0a8f('0x2'));var BPromise=require('bluebird');var rs=require(_0x0a8f('0x3'));var fs=require('fs');var Redis=require(_0x0a8f('0x4'));var db=require(_0x0a8f('0x5'))['db'];var utils=require(_0x0a8f('0x6'));var logger=require(_0x0a8f('0x7'))(_0x0a8f('0x8'));var config=require(_0x0a8f('0x9'));var jayson=require(_0x0a8f('0xa'));var client=jayson[_0x0a8f('0xb')]['http']({'port':0x232a});config[_0x0a8f('0xc')]=_['defaults'](config[_0x0a8f('0xc')],{'host':_0x0a8f('0xd'),'port':0x18eb});var socket=require(_0x0a8f('0xe'))(new Redis(config[_0x0a8f('0xc')]));require(_0x0a8f('0xf'))['register'](socket);function respondWithRpcPromise(_0x4a416d,_0x443d5b,_0x115e68){return new BPromise(function(_0x359377,_0x1921e1){return client[_0x0a8f('0x10')](_0x4a416d,_0x115e68)['then'](function(_0x273a40){logger[_0x0a8f('0x11')](_0x0a8f('0x12'),_0x443d5b,'request\x20sent');logger['debug'](_0x0a8f('0x13'),_0x443d5b,_0x0a8f('0x14'),JSON[_0x0a8f('0x15')](_0x273a40));if(_0x273a40[_0x0a8f('0x16')]){if(_0x273a40[_0x0a8f('0x16')][_0x0a8f('0x17')]===0x1f4){logger[_0x0a8f('0x16')](_0x0a8f('0x12'),_0x443d5b,_0x273a40[_0x0a8f('0x16')]['message']);return _0x1921e1(_0x273a40[_0x0a8f('0x16')][_0x0a8f('0x18')]);}logger[_0x0a8f('0x16')](_0x0a8f('0x12'),_0x443d5b,_0x273a40[_0x0a8f('0x16')][_0x0a8f('0x18')]);return _0x359377(_0x273a40[_0x0a8f('0x16')][_0x0a8f('0x18')]);}else{logger['info'](_0x0a8f('0x12'),_0x443d5b,_0x0a8f('0x14'));_0x359377(_0x273a40[_0x0a8f('0x19')][_0x0a8f('0x18')]);}})['catch'](function(_0x57b00e){logger['error']('ChatInternalMessage,\x20%s,\x20%s',_0x443d5b,_0x57b00e);_0x1921e1(_0x57b00e);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index cace413..ecc3911 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 _0x380f=['remove','update','emit','removeListener','register','length','chatInternalMessage:','./chatInternalMessage.events','save'];(function(_0x4232d8,_0x13fd09){var _0x324de2=function(_0x167ad5){while(--_0x167ad5){_0x4232d8['push'](_0x4232d8['shift']());}};_0x324de2(++_0x13fd09);}(_0x380f,0x1e4));var _0xf380=function(_0x3785e7,_0x57f098){_0x3785e7=_0x3785e7-0x0;var _0x1b82af=_0x380f[_0x3785e7];return _0x1b82af;};'use strict';var ChatInternalMessageEvents=require(_0xf380('0x0'));var events=[_0xf380('0x1'),_0xf380('0x2'),_0xf380('0x3')];function createListener(_0x7dfc6e,_0x5e8041){return function(_0x4ac802){_0x5e8041[_0xf380('0x4')](_0x7dfc6e,_0x4ac802);};}function removeListener(_0x5d322f,_0x3af577){return function(){ChatInternalMessageEvents[_0xf380('0x5')](_0x5d322f,_0x3af577);};}exports[_0xf380('0x6')]=function(_0x1d114a){for(var _0x18818e=0x0,_0x467910=events[_0xf380('0x7')];_0x18818e<_0x467910;_0x18818e++){var _0x27db8b=events[_0x18818e];var _0x55199a=createListener(_0xf380('0x8')+_0x27db8b,_0x1d114a);ChatInternalMessageEvents['on'](_0x27db8b,_0x55199a);}}; \ No newline at end of file +var _0xa823=['save','remove','update','emit','removeListener','register','length','chatInternalMessage:','./chatInternalMessage.events'];(function(_0x1ee43f,_0x4686d8){var _0x1cb212=function(_0x3a8bc6){while(--_0x3a8bc6){_0x1ee43f['push'](_0x1ee43f['shift']());}};_0x1cb212(++_0x4686d8);}(_0xa823,0x170));var _0x3a82=function(_0x160c0d,_0x48a5fe){_0x160c0d=_0x160c0d-0x0;var _0x57c5a9=_0xa823[_0x160c0d];return _0x57c5a9;};'use strict';var ChatInternalMessageEvents=require(_0x3a82('0x0'));var events=[_0x3a82('0x1'),_0x3a82('0x2'),_0x3a82('0x3')];function createListener(_0x2bc24a,_0x385688){return function(_0x1d496){_0x385688[_0x3a82('0x4')](_0x2bc24a,_0x1d496);};}function removeListener(_0x41d761,_0x2d2e39){return function(){ChatInternalMessageEvents[_0x3a82('0x5')](_0x41d761,_0x2d2e39);};}exports[_0x3a82('0x6')]=function(_0x1df626){for(var _0x291811=0x0,_0x1cf742=events[_0x3a82('0x7')];_0x291811<_0x1cf742;_0x291811++){var _0x2f7d4a=events[_0x291811];var _0x5737ed=createListener(_0x3a82('0x8')+_0x2f7d4a,_0x1df626);ChatInternalMessageEvents['on'](_0x2f7d4a,_0x5737ed);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index af7922b..9a3f78e 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 _0x3b26=['destroy','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/describe','describe','getUsers','/:id','show','create','put','update','delete'];(function(_0x398e59,_0x183560){var _0x409032=function(_0x31ad91){while(--_0x31ad91){_0x398e59['push'](_0x398e59['shift']());}};_0x409032(++_0x183560);}(_0x3b26,0x131));var _0x63b2=function(_0x316ad6,_0x759044){_0x316ad6=_0x316ad6-0x0;var _0x437453=_0x3b26[_0x316ad6];return _0x437453;};'use strict';var multer=require(_0x63b2('0x0'));var util=require(_0x63b2('0x1'));var path=require('path');var timeout=require(_0x63b2('0x2'));var express=require('express');var router=express[_0x63b2('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x63b2('0x4'));var interaction=require(_0x63b2('0x5'));var config=require(_0x63b2('0x6'));var controller=require('./chatInternalMessage.controller');router['get']('/',auth[_0x63b2('0x7')](),controller['index']);router[_0x63b2('0x8')](_0x63b2('0x9'),auth['isAuthenticated'](),controller[_0x63b2('0xa')]);router[_0x63b2('0x8')]('/users',auth[_0x63b2('0x7')](),controller[_0x63b2('0xb')]);router[_0x63b2('0x8')](_0x63b2('0xc'),auth[_0x63b2('0x7')](),controller[_0x63b2('0xd')]);router['post']('/',auth[_0x63b2('0x7')](),controller[_0x63b2('0xe')]);router[_0x63b2('0xf')]('/:id',controller[_0x63b2('0x10')]);router[_0x63b2('0x11')]('/:id',auth[_0x63b2('0x7')](),controller[_0x63b2('0x12')]);module['exports']=router; \ No newline at end of file +var _0x6480=['delete','destroy','exports','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./chatInternalMessage.controller','get','isAuthenticated','index','/describe','describe','/users','getUsers','/:id','show','post','create','put','update'];(function(_0x136628,_0x44d91b){var _0x9032b5=function(_0x4c0d1b){while(--_0x4c0d1b){_0x136628['push'](_0x136628['shift']());}};_0x9032b5(++_0x44d91b);}(_0x6480,0x1e7));var _0x0648=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6480[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x0648('0x0'));var express=require(_0x0648('0x1'));var router=express[_0x0648('0x2')]();var fs_extra=require(_0x0648('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x0648('0x4'));var config=require('../../config/environment');var controller=require(_0x0648('0x5'));router[_0x0648('0x6')]('/',auth[_0x0648('0x7')](),controller[_0x0648('0x8')]);router['get'](_0x0648('0x9'),auth[_0x0648('0x7')](),controller[_0x0648('0xa')]);router[_0x0648('0x6')](_0x0648('0xb'),auth[_0x0648('0x7')](),controller[_0x0648('0xc')]);router[_0x0648('0x6')](_0x0648('0xd'),auth[_0x0648('0x7')](),controller[_0x0648('0xe')]);router[_0x0648('0xf')]('/',auth[_0x0648('0x7')](),controller[_0x0648('0x10')]);router[_0x0648('0x11')](_0x0648('0xd'),controller[_0x0648('0x12')]);router[_0x0648('0x13')]('/:id',auth[_0x0648('0x7')](),controller[_0x0648('0x14')]);module[_0x0648('0x15')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 4328b29..eb22c58 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 _0x3e22=['exports','medium','BOOLEAN','ENUM','DATE','STRING'];(function(_0x28a245,_0x1d817a){var _0x1bfce6=function(_0x41558a){while(--_0x41558a){_0x28a245['push'](_0x28a245['shift']());}};_0x1bfce6(++_0x1d817a);}(_0x3e22,0xa8));var _0x23e2=function(_0x42f5bc,_0x49f3b5){_0x42f5bc=_0x42f5bc-0x0;var _0x23ab80=_0x3e22[_0x42f5bc];return _0x23ab80;};'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 +var _0x0abf=['STRING','sequelize','TEXT','medium','ENUM','out','DATE'];(function(_0x18e933,_0x48aae6){var _0x196c22=function(_0x6d42ba){while(--_0x6d42ba){_0x18e933['push'](_0x18e933['shift']());}};_0x196c22(++_0x48aae6);}(_0x0abf,0xe8));var _0xf0ab=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x0abf[_0x465028];return _0xb783d4;};'use strict';var Sequelize=require(_0xf0ab('0x0'));module['exports']={'body':{'type':Sequelize[_0xf0ab('0x1')](_0xf0ab('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xf0ab('0x3')]('in','out'),'defaultValue':_0xf0ab('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0xf0ab('0x5')]},'providerName':{'type':Sequelize[_0xf0ab('0x6')]},'providerResponse':{'type':Sequelize[_0xf0ab('0x1')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index a881915..23fc87a 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 _0x2317=['moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','./chatMessage.socket','client','http','request','then','info','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatMessage,\x20%s,\x20%s','message','catch','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','stack','index','map','ChatMessage','rawAttributes','fieldName','type','key','model','name','filters','intersection','query','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','show','params','keys','find','create','body','describe','chat-interactions','chat','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','ChatInteractionId','isNil','read1stAt','get','role','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','contact','User','fullname','email','internal','manual','interface','channel','motionChannel','event','parse','formData','ChatInteraction','rejectMessage','sequelize','SELECT','EventManager','rejectmessage','eml-format','zip-dir','fast-json-patch','request-promise'];(function(_0x12f03e,_0x320adb){var _0x5690bb=function(_0x510d61){while(--_0x510d61){_0x12f03e['push'](_0x12f03e['shift']());}};_0x5690bb(++_0x320adb);}(_0x2317,0x83));var _0x7231=function(_0x54f41a,_0x543be0){_0x54f41a=_0x54f41a-0x0;var _0xd36715=_0x2317[_0x54f41a];return _0xd36715;};'use strict';var emlformat=require(_0x7231('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7231('0x1'));var jsonpatch=require(_0x7231('0x2'));var rp=require(_0x7231('0x3'));var moment=require(_0x7231('0x4'));var BPromise=require(_0x7231('0x5'));var Mustache=require(_0x7231('0x6'));var util=require(_0x7231('0x7'));var path=require(_0x7231('0x8'));var sox=require(_0x7231('0x9'));var csv=require('to-csv');var ejs=require(_0x7231('0xa'));var fs=require('fs');var fs_extra=require(_0x7231('0xb'));var _=require(_0x7231('0xc'));var squel=require('squel');var crypto=require(_0x7231('0xd'));var jsforce=require(_0x7231('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x7231('0xf'));var querystring=require(_0x7231('0x10'));var Papa=require(_0x7231('0x11'));var Redis=require(_0x7231('0x12'));var authService=require(_0x7231('0x13'));var qs=require(_0x7231('0x14'));var as=require(_0x7231('0x15'));var hardwareService=require(_0x7231('0x16'));var logger=require(_0x7231('0x17'))(_0x7231('0x18'));var utils=require(_0x7231('0x19'));var config=require(_0x7231('0x1a'));var licenseUtil=require(_0x7231('0x1b'));var db=require('../../mysqldb')['db'];config[_0x7231('0x1c')]=_[_0x7231('0x1d')](config[_0x7231('0x1c')],{'host':_0x7231('0x1e'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7231('0x1c')]));require(_0x7231('0x1f'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x7231('0x20')][_0x7231('0x21')]({'port':0x232c});var client9002=jayson[_0x7231('0x20')][_0x7231('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x4fcc48,_0x199243,_0x3d4397,_0x1bc48b){return new BPromise(function(_0x7c0b31,_0x12647c){var _0x131622=_0x1bc48b||client;return _0x131622[_0x7231('0x22')](_0x4fcc48,_0x3d4397)[_0x7231('0x23')](function(_0x3da298){logger[_0x7231('0x24')]('ChatMessage,\x20%s,\x20%s',_0x199243,_0x7231('0x25'));logger[_0x7231('0x26')](_0x7231('0x27'),_0x199243,_0x7231('0x25'),JSON[_0x7231('0x28')](_0x3da298));if(_0x3da298['error']){if(_0x3da298[_0x7231('0x29')][_0x7231('0x2a')]===0x1f4){logger[_0x7231('0x29')](_0x7231('0x2b'),_0x199243,_0x3da298[_0x7231('0x29')][_0x7231('0x2c')]);return _0x12647c(_0x3da298[_0x7231('0x29')][_0x7231('0x2c')]);}logger['error'](_0x7231('0x2b'),_0x199243,_0x3da298[_0x7231('0x29')][_0x7231('0x2c')]);return _0x7c0b31(_0x3da298['error'][_0x7231('0x2c')]);}else{logger[_0x7231('0x24')](_0x7231('0x2b'),_0x199243,_0x7231('0x25'));_0x7c0b31(_0x3da298['result'][_0x7231('0x2c')]);}})[_0x7231('0x2d')](function(_0x53f983){logger[_0x7231('0x29')](_0x7231('0x2b'),_0x199243,_0x53f983);_0x12647c(_0x53f983);});});}function respondWithStatusCode(_0x4ec734,_0x2acfdb){_0x2acfdb=_0x2acfdb||0xcc;return function(_0x15f4f2){if(_0x15f4f2){return _0x4ec734[_0x7231('0x2e')](_0x2acfdb);}return _0x4ec734[_0x7231('0x2f')](_0x2acfdb)[_0x7231('0x30')]();};}function respondWithResult(_0x20ea51,_0x5aff51){_0x5aff51=_0x5aff51||0xc8;return function(_0x5a6646){if(_0x5a6646){return _0x20ea51[_0x7231('0x2f')](_0x5aff51)[_0x7231('0x31')](_0x5a6646);}};}function respondWithFilteredResult(_0x2a92c0,_0x1d62d3){return function(_0x2c4158){if(_0x2c4158){var _0xd54dfa=typeof _0x1d62d3['offset']===_0x7231('0x32')&&typeof _0x1d62d3[_0x7231('0x33')]===_0x7231('0x32');var _0x2bcd62=_0x2c4158[_0x7231('0x34')];var _0x9d5e33=_0xd54dfa?0x0:_0x1d62d3[_0x7231('0x35')];var _0x35255c=_0xd54dfa?_0x2c4158[_0x7231('0x34')]:_0x1d62d3['offset']+_0x1d62d3[_0x7231('0x33')];var _0x5010ea;if(_0x35255c>=_0x2bcd62){_0x35255c=_0x2bcd62;_0x5010ea=0xc8;}else{_0x5010ea=0xce;}_0x2a92c0[_0x7231('0x2f')](_0x5010ea);return _0x2a92c0[_0x7231('0x36')](_0x7231('0x37'),_0x9d5e33+'-'+_0x35255c+'/'+_0x2bcd62)[_0x7231('0x31')](_0x2c4158);}return null;};}function patchUpdates(_0x3e639d){return function(_0x7c5134){try{jsonpatch[_0x7231('0x38')](_0x7c5134,_0x3e639d,!![]);}catch(_0x1a541a){return BPromise[_0x7231('0x39')](_0x1a541a);}return _0x7c5134[_0x7231('0x3a')]();};}function saveUpdates(_0x470daf,_0xd009ff){return function(_0x492dd4){if(_0x492dd4){return _0x492dd4[_0x7231('0x3b')](_0x470daf)[_0x7231('0x23')](function(_0x651944){return _0x651944;});}return null;};}function removeEntity(_0x36caaa,_0xf54ba4){return function(_0x22f97a){if(_0x22f97a){return _0x22f97a[_0x7231('0x3c')]()[_0x7231('0x23')](function(){_0x36caaa[_0x7231('0x2f')](0xcc)[_0x7231('0x30')]();});}};}function handleEntityNotFound(_0x32a038,_0x276afc){return function(_0x5e505b){if(!_0x5e505b){_0x32a038['sendStatus'](0x194);}return _0x5e505b;};}function handleError(_0x39176e,_0x347add){_0x347add=_0x347add||0x1f4;return function(_0x20864d){logger['error'](_0x20864d[_0x7231('0x3d')]);if(_0x20864d['name']){delete _0x20864d['name'];}_0x39176e['status'](_0x347add)['send'](_0x20864d);};}exports[_0x7231('0x3e')]=function(_0x397288,_0x33384e){var _0x1a9d1d={},_0x55dce0={},_0x42223b={'count':0x0,'rows':[]};var _0x374934=_[_0x7231('0x3f')](db[_0x7231('0x40')][_0x7231('0x41')],function(_0x4efc08){return{'name':_0x4efc08[_0x7231('0x42')],'type':_0x4efc08[_0x7231('0x43')][_0x7231('0x44')]};});_0x55dce0[_0x7231('0x45')]=_['map'](_0x374934,_0x7231('0x46'));_0x55dce0['query']=_['keys'](_0x397288['query']);_0x55dce0[_0x7231('0x47')]=_[_0x7231('0x48')](_0x55dce0[_0x7231('0x45')],_0x55dce0[_0x7231('0x49')]);_0x1a9d1d[_0x7231('0x4a')]=_[_0x7231('0x48')](_0x55dce0['model'],qs[_0x7231('0x4b')](_0x397288['query'][_0x7231('0x4b')]));_0x1a9d1d[_0x7231('0x4a')]=_0x1a9d1d[_0x7231('0x4a')][_0x7231('0x4c')]?_0x1a9d1d[_0x7231('0x4a')]:_0x55dce0[_0x7231('0x45')];if(!_0x397288[_0x7231('0x49')][_0x7231('0x4d')]('nolimit')){_0x1a9d1d[_0x7231('0x33')]=qs[_0x7231('0x33')](_0x397288[_0x7231('0x49')][_0x7231('0x33')]);_0x1a9d1d['offset']=qs[_0x7231('0x35')](_0x397288[_0x7231('0x49')][_0x7231('0x35')]);}_0x1a9d1d[_0x7231('0x4e')]=qs[_0x7231('0x4f')](_0x397288[_0x7231('0x49')]['sort']);_0x1a9d1d[_0x7231('0x50')]=qs[_0x7231('0x47')](_[_0x7231('0x51')](_0x397288[_0x7231('0x49')],_0x55dce0[_0x7231('0x47')]),_0x374934);if(_0x397288[_0x7231('0x49')][_0x7231('0x52')]){_0x1a9d1d[_0x7231('0x50')]=_['merge'](_0x1a9d1d[_0x7231('0x50')],{'$or':_[_0x7231('0x3f')](_0x374934,function(_0x3e2062){if(_0x3e2062[_0x7231('0x43')]!==_0x7231('0x53')){var _0x4fefbc={};_0x4fefbc[_0x3e2062[_0x7231('0x46')]]={'$like':'%'+_0x397288[_0x7231('0x49')][_0x7231('0x52')]+'%'};return _0x4fefbc;}})});}_0x1a9d1d=_[_0x7231('0x54')]({},_0x1a9d1d,_0x397288[_0x7231('0x55')]);var _0x173181={'where':_0x1a9d1d['where']};return db[_0x7231('0x40')]['count'](_0x173181)[_0x7231('0x23')](function(_0x566617){_0x42223b[_0x7231('0x34')]=_0x566617;if(_0x397288[_0x7231('0x49')][_0x7231('0x56')]){_0x1a9d1d[_0x7231('0x57')]=[{'all':!![]}];}return db[_0x7231('0x40')][_0x7231('0x58')](_0x1a9d1d);})[_0x7231('0x23')](function(_0x5dd99f){_0x42223b['rows']=_0x5dd99f;return _0x42223b;})['then'](respondWithFilteredResult(_0x33384e,_0x1a9d1d))[_0x7231('0x2d')](handleError(_0x33384e,null));};exports[_0x7231('0x59')]=function(_0x321ae2,_0x2d482f){var _0x3a9374={'raw':!![],'where':{'id':_0x321ae2[_0x7231('0x5a')]['id']}},_0x3caaad={};_0x3caaad[_0x7231('0x45')]=_[_0x7231('0x5b')](db[_0x7231('0x40')][_0x7231('0x41')]);_0x3caaad['query']=_[_0x7231('0x5b')](_0x321ae2['query']);_0x3caaad[_0x7231('0x47')]=_[_0x7231('0x48')](_0x3caaad['model'],_0x3caaad[_0x7231('0x49')]);_0x3a9374[_0x7231('0x4a')]=_[_0x7231('0x48')](_0x3caaad[_0x7231('0x45')],qs['fields'](_0x321ae2[_0x7231('0x49')][_0x7231('0x4b')]));_0x3a9374[_0x7231('0x4a')]=_0x3a9374[_0x7231('0x4a')][_0x7231('0x4c')]?_0x3a9374[_0x7231('0x4a')]:_0x3caaad[_0x7231('0x45')];if(_0x321ae2['query'][_0x7231('0x56')]){_0x3a9374['include']=[{'all':!![]}];}_0x3a9374=_['merge']({},_0x3a9374,_0x321ae2['options']);return db['ChatMessage'][_0x7231('0x5c')](_0x3a9374)[_0x7231('0x23')](handleEntityNotFound(_0x2d482f,null))[_0x7231('0x23')](respondWithResult(_0x2d482f,null))[_0x7231('0x2d')](handleError(_0x2d482f,null));};exports['create']=function(_0x4bf2ff,_0x43f558){return db['ChatMessage'][_0x7231('0x5d')](_0x4bf2ff['body'],{})[_0x7231('0x23')](respondWithResult(_0x43f558,0xc9))[_0x7231('0x2d')](handleError(_0x43f558,null));};exports[_0x7231('0x3b')]=function(_0x56858a,_0x2ed818){if(_0x56858a[_0x7231('0x5e')]['id']){delete _0x56858a[_0x7231('0x5e')]['id'];}return db[_0x7231('0x40')]['find']({'where':{'id':_0x56858a[_0x7231('0x5a')]['id']}})[_0x7231('0x23')](handleEntityNotFound(_0x2ed818,null))['then'](saveUpdates(_0x56858a[_0x7231('0x5e')],null))['then'](respondWithResult(_0x2ed818,null))[_0x7231('0x2d')](handleError(_0x2ed818,null));};exports['destroy']=function(_0x179847,_0x514a52){return db[_0x7231('0x40')][_0x7231('0x5c')]({'where':{'id':_0x179847[_0x7231('0x5a')]['id']}})[_0x7231('0x23')](handleEntityNotFound(_0x514a52,null))['then'](removeEntity(_0x514a52,null))['catch'](handleError(_0x514a52,null));};exports[_0x7231('0x5f')]=function(_0x257b1c,_0xe515d8){return db['ChatMessage'][_0x7231('0x5f')]()['then'](respondWithResult(_0xe515d8,null))[_0x7231('0x2d')](handleError(_0xe515d8,null));};var interaction_log=require(_0x7231('0x17'))(_0x7231('0x60'));exports['accept']=function(_0x46c3a1,_0x3a7f4f,_0x3613e5){var _0x2d0f05={'agent':{},'channel':_0x7231('0x61')};if(_0x46c3a1['body']['id']){delete _0x46c3a1[_0x7231('0x5e')]['id'];}_0x46c3a1[_0x7231('0x5e')][_0x7231('0x62')]=!![];_0x46c3a1[_0x7231('0x5e')]['readAt']=moment()[_0x7231('0x63')](_0x7231('0x64'));_0x46c3a1[_0x7231('0x5e')]['UserId']=_0x46c3a1[_0x7231('0x5e')][_0x7231('0x65')]||_0x46c3a1[_0x7231('0x66')]['id'];_0x2d0f05[_0x7231('0x67')]['id']=_0x46c3a1[_0x7231('0x5e')][_0x7231('0x65')];return db[_0x7231('0x40')][_0x7231('0x5c')]({'where':{'id':_0x46c3a1[_0x7231('0x5a')]['id'],'UserId':null}})[_0x7231('0x23')](handleEntityNotFound(_0x3a7f4f,null))['then'](saveUpdates(_0x46c3a1[_0x7231('0x5e')],null))['then'](function(_0x1b26a1){if(_0x1b26a1){_0x2d0f05[_0x7231('0x2c')]=_0x1b26a1['get']({'plain':!![]});return db['ChatInteraction']['find']({'where':{'id':_0x1b26a1[_0x7231('0x68')]}});}return null;})['then'](handleEntityNotFound(_0x3a7f4f,null))['then'](function(_0x29b4cd){if(_0x29b4cd){return _0x29b4cd[_0x7231('0x3b')]({'UserId':_0x46c3a1[_0x7231('0x5e')]['UserId'],'read1stAt':_[_0x7231('0x69')](_0x29b4cd[_0x7231('0x6a')])?moment()['format'](_0x7231('0x64')):undefined});}return null;})[_0x7231('0x23')](function(_0x10ef0b){if(_0x10ef0b){_0x2d0f05['interaction']=_0x10ef0b[_0x7231('0x6b')]({'plain':!![]});interaction_log[_0x7231('0x24')]('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x46c3a1[_0x7231('0x66')]['id'],_0x46c3a1[_0x7231('0x66')][_0x7231('0x46')],_0x46c3a1[_0x7231('0x66')][_0x7231('0x6c')],_0x2d0f05[_0x7231('0x6d')]['id'],_0x46c3a1[_0x7231('0x5e')]?JSON[_0x7231('0x28')](_0x46c3a1[_0x7231('0x5e')]):_0x7231('0x6e'));return respondWithRpcPromise(_0x7231('0x6f'),_0x7231('0x70'),_0x2d0f05);}return null;})['then'](function(_0x5d2e86){var _0xd64156=_0x7231('0x71')+_0x5d2e86['message'][_0x7231('0x72')];return db['sequelize'][_0x7231('0x49')](_0xd64156,{'type':db[_0x7231('0x73')][_0x7231('0x74')]['SELECT'],'raw':!![]})[_0x7231('0x23')](function(_0x528e41){return _0x528e41;});})['then'](function(_0x10860c){if(_0x10860c){_0x2d0f05[_0x7231('0x2c')][_0x7231('0x75')]=_0x10860c[0x0];if(!_0x46c3a1[_0x7231('0x5e')][_0x7231('0x65')])return;return db[_0x7231('0x76')]['find']({'where':{'id':_0x46c3a1[_0x7231('0x5e')][_0x7231('0x65')],'role':_0x7231('0x67')},'attributes':['id',_0x7231('0x46'),_0x7231('0x77'),_0x7231('0x78'),_0x7231('0x79')],'raw':!![]});}return null;})[_0x7231('0x23')](function(_0x352ee9){if(!_0x352ee9)return null;_0x2d0f05[_0x7231('0x2c')][_0x7231('0x67')]=_0x352ee9;return _0x2d0f05;})[_0x7231('0x23')](function(_0xbd8caf){if(_0xbd8caf){if(_0x46c3a1[_0x7231('0x5e')][_0x7231('0x7a')]){_0x2d0f05['message'][_0x7231('0x7b')]=util['format']('SIP/%s',_0x46c3a1['user'][_0x7231('0x46')]);_0x2d0f05[_0x7231('0x2c')][_0x7231('0x7c')]=_0x2d0f05[_0x7231('0x7c')];_0x2d0f05['message'][_0x7231('0x7d')]=_0x2d0f05[_0x7231('0x7c')];_0x2d0f05[_0x7231('0x2c')][_0x7231('0x7e')]='accept';return respondWithRpcPromise('EventManager','EventManager',{'event':'acceptmessage','message':_[_0x7231('0x54')](_0x2d0f05[_0x7231('0x2c')],JSON[_0x7231('0x7f')](_0x2d0f05[_0x7231('0x6d')][_0x7231('0x80')]))},client9002)[_0x7231('0x23')](function(){return _0x2d0f05;});}return _0x2d0f05;}return null;})[_0x7231('0x23')](respondWithResult(_0x3a7f4f,null))[_0x7231('0x2d')](handleError(_0x3a7f4f,null));};var interaction_log=require(_0x7231('0x17'))(_0x7231('0x60'));exports[_0x7231('0x39')]=function(_0x461918,_0x528b03,_0x46affd){var _0x3c5343={'agent':{},'channel':_0x7231('0x61')};if(_0x461918['body']['id']){delete _0x461918[_0x7231('0x5e')]['id'];}_0x461918[_0x7231('0x5e')][_0x7231('0x65')]=_0x461918[_0x7231('0x5e')][_0x7231('0x65')]||_0x461918[_0x7231('0x66')]['id'];_0x3c5343['agent']['id']=_0x461918[_0x7231('0x5e')][_0x7231('0x65')];return db[_0x7231('0x40')][_0x7231('0x5c')]({'where':{'id':_0x461918[_0x7231('0x5a')]['id'],'UserId':null}})[_0x7231('0x23')](handleEntityNotFound(_0x528b03,null))[_0x7231('0x23')](function(_0x222f77){if(_0x222f77){_0x3c5343[_0x7231('0x2c')]=_0x222f77[_0x7231('0x6b')]({'plain':!![]});return db[_0x7231('0x81')][_0x7231('0x5c')]({'where':{'id':_0x222f77['ChatInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x528b03,null))['then'](function(_0x41a096){if(_0x41a096){_0x3c5343['interaction']=_0x41a096['get']({'plain':!![]});interaction_log[_0x7231('0x24')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x461918[_0x7231('0x66')]['id'],_0x461918[_0x7231('0x66')]['name'],_0x461918['user'][_0x7231('0x6c')],_0x3c5343[_0x7231('0x6d')]['id'],_0x461918[_0x7231('0x5e')]?JSON['stringify'](_0x461918[_0x7231('0x5e')]):_0x7231('0x6e'));return respondWithRpcPromise('RejectMessage',_0x7231('0x82'),_0x3c5343);}return null;})[_0x7231('0x23')](function(_0x57d3fb){var _0xe15087=_0x7231('0x71')+_0x57d3fb['message'][_0x7231('0x72')];return db[_0x7231('0x83')][_0x7231('0x49')](_0xe15087,{'type':db[_0x7231('0x73')][_0x7231('0x74')][_0x7231('0x84')],'raw':!![]})[_0x7231('0x23')](function(_0x5f4905){return _0x5f4905;});})['then'](function(_0x153c1a){if(_0x153c1a){_0x3c5343['message']['contact']=_0x153c1a[0x0];if(!_0x461918[_0x7231('0x5e')]['UserId'])return;return db['User']['find']({'where':{'id':_0x461918[_0x7231('0x5e')][_0x7231('0x65')],'role':_0x7231('0x67')},'attributes':['id',_0x7231('0x46'),_0x7231('0x77'),'email',_0x7231('0x79')],'raw':!![]});}return null;})[_0x7231('0x23')](function(_0x17a8bd){if(!_0x17a8bd)return null;_0x3c5343[_0x7231('0x2c')][_0x7231('0x67')]=_0x17a8bd;return _0x3c5343;})[_0x7231('0x23')](function(_0x52bbcf){if(_0x52bbcf){_0x52bbcf[_0x7231('0x2c')]['interface']=util[_0x7231('0x63')]('SIP/%s',_0x461918[_0x7231('0x66')][_0x7231('0x46')]);_0x52bbcf[_0x7231('0x2c')][_0x7231('0x7c')]=_0x3c5343[_0x7231('0x7c')];_0x52bbcf[_0x7231('0x2c')][_0x7231('0x7d')]=_0x3c5343['channel'];_0x52bbcf['message']['event']=_0x7231('0x39');respondWithRpcPromise(_0x7231('0x85'),_0x7231('0x85'),{'event':_0x7231('0x86'),'message':_[_0x7231('0x54')](_0x3c5343[_0x7231('0x2c')],JSON['parse'](_0x3c5343['interaction'][_0x7231('0x80')]))},client9002);return _0x3c5343;}return null;})[_0x7231('0x23')](respondWithResult(_0x528b03,null))[_0x7231('0x2d')](handleError(_0x528b03,null));}; \ No newline at end of file +var _0xc583=['ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','fieldName','key','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','where','merge','VIRTUAL','filter','options','ChatMessage','includeAll','include','findAll','show','params','rawAttributes','find','create','body','describe','chat-interactions','chat','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','ChatInteraction','ChatInteractionId','isNil','read1stAt','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','null','AcceptMessage','acceptMessage','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','accept','EventManager','acceptmessage','formData','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv'];(function(_0x35454e,_0x271147){var _0x5ce4a0=function(_0x1d171f){while(--_0x1d171f){_0x35454e['push'](_0x35454e['shift']());}};_0x5ce4a0(++_0x271147);}(_0xc583,0x108));var _0x3c58=function(_0x23370f,_0x573adb){_0x23370f=_0x23370f-0x0;var _0x444943=_0xc583[_0x23370f];return _0x444943;};'use strict';var emlformat=require(_0x3c58('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3c58('0x1'));var jsonpatch=require(_0x3c58('0x2'));var rp=require(_0x3c58('0x3'));var moment=require(_0x3c58('0x4'));var BPromise=require(_0x3c58('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x3c58('0x6'));var csv=require(_0x3c58('0x7'));var ejs=require(_0x3c58('0x8'));var fs=require('fs');var fs_extra=require(_0x3c58('0x9'));var _=require(_0x3c58('0xa'));var squel=require(_0x3c58('0xb'));var crypto=require(_0x3c58('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3c58('0x7'));var querystring=require(_0x3c58('0xd'));var Papa=require(_0x3c58('0xe'));var Redis=require(_0x3c58('0xf'));var authService=require(_0x3c58('0x10'));var qs=require(_0x3c58('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3c58('0x12'));var logger=require(_0x3c58('0x13'))(_0x3c58('0x14'));var utils=require(_0x3c58('0x15'));var config=require(_0x3c58('0x16'));var licenseUtil=require(_0x3c58('0x17'));var db=require(_0x3c58('0x18'))['db'];config['redis']=_[_0x3c58('0x19')](config[_0x3c58('0x1a')],{'host':_0x3c58('0x1b'),'port':0x18eb});var socket=require(_0x3c58('0x1c'))(new Redis(config[_0x3c58('0x1a')]));require(_0x3c58('0x1d'))[_0x3c58('0x1e')](socket);var jayson=require(_0x3c58('0x1f'));var client=jayson[_0x3c58('0x20')][_0x3c58('0x21')]({'port':0x232c});var client9002=jayson[_0x3c58('0x20')][_0x3c58('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x5f2fa2,_0x25f1c4,_0x1d4468,_0x3c25ba){return new BPromise(function(_0x3d547b,_0x4ab8a4){var _0xce7495=_0x3c25ba||client;return _0xce7495[_0x3c58('0x22')](_0x5f2fa2,_0x1d4468)[_0x3c58('0x23')](function(_0x208604){logger[_0x3c58('0x24')](_0x3c58('0x25'),_0x25f1c4,_0x3c58('0x26'));logger['debug'](_0x3c58('0x27'),_0x25f1c4,_0x3c58('0x26'),JSON['stringify'](_0x208604));if(_0x208604['error']){if(_0x208604[_0x3c58('0x28')][_0x3c58('0x29')]===0x1f4){logger[_0x3c58('0x28')]('ChatMessage,\x20%s,\x20%s',_0x25f1c4,_0x208604[_0x3c58('0x28')][_0x3c58('0x2a')]);return _0x4ab8a4(_0x208604['error'][_0x3c58('0x2a')]);}logger[_0x3c58('0x28')](_0x3c58('0x25'),_0x25f1c4,_0x208604[_0x3c58('0x28')][_0x3c58('0x2a')]);return _0x3d547b(_0x208604[_0x3c58('0x28')]['message']);}else{logger['info'](_0x3c58('0x25'),_0x25f1c4,_0x3c58('0x26'));_0x3d547b(_0x208604[_0x3c58('0x2b')]['message']);}})[_0x3c58('0x2c')](function(_0x9fdd70){logger[_0x3c58('0x28')](_0x3c58('0x25'),_0x25f1c4,_0x9fdd70);_0x4ab8a4(_0x9fdd70);});});}function respondWithStatusCode(_0x1a8bc1,_0xfa45b2){_0xfa45b2=_0xfa45b2||0xcc;return function(_0x2ec15c){if(_0x2ec15c){return _0x1a8bc1[_0x3c58('0x2d')](_0xfa45b2);}return _0x1a8bc1['status'](_0xfa45b2)[_0x3c58('0x2e')]();};}function respondWithResult(_0x26ef31,_0x3aa05c){_0x3aa05c=_0x3aa05c||0xc8;return function(_0x8d0dcd){if(_0x8d0dcd){return _0x26ef31[_0x3c58('0x2f')](_0x3aa05c)[_0x3c58('0x30')](_0x8d0dcd);}};}function respondWithFilteredResult(_0x58c40e,_0x4344e2){return function(_0x441b44){if(_0x441b44){var _0x456c30=typeof _0x4344e2[_0x3c58('0x31')]===_0x3c58('0x32')&&typeof _0x4344e2[_0x3c58('0x33')]==='undefined';var _0xe68378=_0x441b44[_0x3c58('0x34')];var _0x3ffe32=_0x456c30?0x0:_0x4344e2[_0x3c58('0x31')];var _0x46fed0=_0x456c30?_0x441b44[_0x3c58('0x34')]:_0x4344e2['offset']+_0x4344e2[_0x3c58('0x33')];var _0x47a842;if(_0x46fed0>=_0xe68378){_0x46fed0=_0xe68378;_0x47a842=0xc8;}else{_0x47a842=0xce;}_0x58c40e[_0x3c58('0x2f')](_0x47a842);return _0x58c40e[_0x3c58('0x35')](_0x3c58('0x36'),_0x3ffe32+'-'+_0x46fed0+'/'+_0xe68378)['json'](_0x441b44);}return null;};}function patchUpdates(_0x5b89e1){return function(_0x339000){try{jsonpatch[_0x3c58('0x37')](_0x339000,_0x5b89e1,!![]);}catch(_0xa2d57d){return BPromise[_0x3c58('0x38')](_0xa2d57d);}return _0x339000[_0x3c58('0x39')]();};}function saveUpdates(_0x1f7d3e,_0x3c95c1){return function(_0x3915fd){if(_0x3915fd){return _0x3915fd[_0x3c58('0x3a')](_0x1f7d3e)[_0x3c58('0x23')](function(_0x28d5b6){return _0x28d5b6;});}return null;};}function removeEntity(_0x4e1dd8,_0x106f38){return function(_0x437022){if(_0x437022){return _0x437022[_0x3c58('0x3b')]()['then'](function(){_0x4e1dd8[_0x3c58('0x2f')](0xcc)[_0x3c58('0x2e')]();});}};}function handleEntityNotFound(_0xf6f250,_0x2f2fda){return function(_0x13c701){if(!_0x13c701){_0xf6f250[_0x3c58('0x2d')](0x194);}return _0x13c701;};}function handleError(_0x188668,_0x312859){_0x312859=_0x312859||0x1f4;return function(_0x81b9df){logger['error'](_0x81b9df[_0x3c58('0x3c')]);if(_0x81b9df[_0x3c58('0x3d')]){delete _0x81b9df[_0x3c58('0x3d')];}_0x188668[_0x3c58('0x2f')](_0x312859)[_0x3c58('0x3e')](_0x81b9df);};}exports[_0x3c58('0x3f')]=function(_0x5981cf,_0x5c9742){var _0xa718b0={},_0x3a1750={},_0x2b4c63={'count':0x0,'rows':[]};var _0x590b88=_[_0x3c58('0x40')](db['ChatMessage']['rawAttributes'],function(_0x3669ee){return{'name':_0x3669ee[_0x3c58('0x41')],'type':_0x3669ee['type'][_0x3c58('0x42')]};});_0x3a1750['model']=_[_0x3c58('0x40')](_0x590b88,_0x3c58('0x3d'));_0x3a1750[_0x3c58('0x43')]=_[_0x3c58('0x44')](_0x5981cf['query']);_0x3a1750[_0x3c58('0x45')]=_[_0x3c58('0x46')](_0x3a1750[_0x3c58('0x47')],_0x3a1750[_0x3c58('0x43')]);_0xa718b0['attributes']=_[_0x3c58('0x46')](_0x3a1750[_0x3c58('0x47')],qs[_0x3c58('0x48')](_0x5981cf[_0x3c58('0x43')][_0x3c58('0x48')]));_0xa718b0[_0x3c58('0x49')]=_0xa718b0[_0x3c58('0x49')][_0x3c58('0x4a')]?_0xa718b0['attributes']:_0x3a1750[_0x3c58('0x47')];if(!_0x5981cf[_0x3c58('0x43')]['hasOwnProperty'](_0x3c58('0x4b'))){_0xa718b0['limit']=qs[_0x3c58('0x33')](_0x5981cf['query'][_0x3c58('0x33')]);_0xa718b0[_0x3c58('0x31')]=qs[_0x3c58('0x31')](_0x5981cf[_0x3c58('0x43')]['offset']);}_0xa718b0[_0x3c58('0x4c')]=qs['sort'](_0x5981cf[_0x3c58('0x43')]['sort']);_0xa718b0[_0x3c58('0x4d')]=qs['filters'](_['pick'](_0x5981cf[_0x3c58('0x43')],_0x3a1750[_0x3c58('0x45')]),_0x590b88);if(_0x5981cf[_0x3c58('0x43')]['filter']){_0xa718b0[_0x3c58('0x4d')]=_[_0x3c58('0x4e')](_0xa718b0[_0x3c58('0x4d')],{'$or':_['map'](_0x590b88,function(_0x4a0cf8){if(_0x4a0cf8['type']!==_0x3c58('0x4f')){var _0x38e017={};_0x38e017[_0x4a0cf8[_0x3c58('0x3d')]]={'$like':'%'+_0x5981cf[_0x3c58('0x43')][_0x3c58('0x50')]+'%'};return _0x38e017;}})});}_0xa718b0=_[_0x3c58('0x4e')]({},_0xa718b0,_0x5981cf[_0x3c58('0x51')]);var _0x265bbc={'where':_0xa718b0[_0x3c58('0x4d')]};return db[_0x3c58('0x52')][_0x3c58('0x34')](_0x265bbc)[_0x3c58('0x23')](function(_0x5f1a08){_0x2b4c63[_0x3c58('0x34')]=_0x5f1a08;if(_0x5981cf[_0x3c58('0x43')][_0x3c58('0x53')]){_0xa718b0[_0x3c58('0x54')]=[{'all':!![]}];}return db[_0x3c58('0x52')][_0x3c58('0x55')](_0xa718b0);})[_0x3c58('0x23')](function(_0x5c0af3){_0x2b4c63['rows']=_0x5c0af3;return _0x2b4c63;})[_0x3c58('0x23')](respondWithFilteredResult(_0x5c9742,_0xa718b0))[_0x3c58('0x2c')](handleError(_0x5c9742,null));};exports[_0x3c58('0x56')]=function(_0x729b37,_0x387041){var _0x9a2df3={'raw':!![],'where':{'id':_0x729b37[_0x3c58('0x57')]['id']}},_0x1e98ef={};_0x1e98ef[_0x3c58('0x47')]=_[_0x3c58('0x44')](db[_0x3c58('0x52')][_0x3c58('0x58')]);_0x1e98ef[_0x3c58('0x43')]=_['keys'](_0x729b37['query']);_0x1e98ef[_0x3c58('0x45')]=_[_0x3c58('0x46')](_0x1e98ef['model'],_0x1e98ef[_0x3c58('0x43')]);_0x9a2df3[_0x3c58('0x49')]=_[_0x3c58('0x46')](_0x1e98ef[_0x3c58('0x47')],qs[_0x3c58('0x48')](_0x729b37[_0x3c58('0x43')]['fields']));_0x9a2df3['attributes']=_0x9a2df3[_0x3c58('0x49')][_0x3c58('0x4a')]?_0x9a2df3['attributes']:_0x1e98ef[_0x3c58('0x47')];if(_0x729b37[_0x3c58('0x43')][_0x3c58('0x53')]){_0x9a2df3['include']=[{'all':!![]}];}_0x9a2df3=_[_0x3c58('0x4e')]({},_0x9a2df3,_0x729b37[_0x3c58('0x51')]);return db['ChatMessage'][_0x3c58('0x59')](_0x9a2df3)[_0x3c58('0x23')](handleEntityNotFound(_0x387041,null))[_0x3c58('0x23')](respondWithResult(_0x387041,null))['catch'](handleError(_0x387041,null));};exports[_0x3c58('0x5a')]=function(_0x1a8d13,_0x3cc15d){return db[_0x3c58('0x52')]['create'](_0x1a8d13[_0x3c58('0x5b')],{})['then'](respondWithResult(_0x3cc15d,0xc9))['catch'](handleError(_0x3cc15d,null));};exports[_0x3c58('0x3a')]=function(_0x23b96b,_0x5d4db8){if(_0x23b96b[_0x3c58('0x5b')]['id']){delete _0x23b96b['body']['id'];}return db[_0x3c58('0x52')]['find']({'where':{'id':_0x23b96b['params']['id']}})[_0x3c58('0x23')](handleEntityNotFound(_0x5d4db8,null))['then'](saveUpdates(_0x23b96b[_0x3c58('0x5b')],null))[_0x3c58('0x23')](respondWithResult(_0x5d4db8,null))[_0x3c58('0x2c')](handleError(_0x5d4db8,null));};exports[_0x3c58('0x3b')]=function(_0x58f8cc,_0x11c29a){return db[_0x3c58('0x52')]['find']({'where':{'id':_0x58f8cc[_0x3c58('0x57')]['id']}})[_0x3c58('0x23')](handleEntityNotFound(_0x11c29a,null))[_0x3c58('0x23')](removeEntity(_0x11c29a,null))[_0x3c58('0x2c')](handleError(_0x11c29a,null));};exports[_0x3c58('0x5c')]=function(_0x45dbf8,_0x6cea20){return db[_0x3c58('0x52')][_0x3c58('0x5c')]()[_0x3c58('0x23')](respondWithResult(_0x6cea20,null))[_0x3c58('0x2c')](handleError(_0x6cea20,null));};var interaction_log=require(_0x3c58('0x13'))(_0x3c58('0x5d'));exports['accept']=function(_0x327fe9,_0x4a118b,_0x3d6bad){var _0x22c875={'agent':{},'channel':_0x3c58('0x5e')};if(_0x327fe9[_0x3c58('0x5b')]['id']){delete _0x327fe9[_0x3c58('0x5b')]['id'];}_0x327fe9[_0x3c58('0x5b')][_0x3c58('0x5f')]=!![];_0x327fe9[_0x3c58('0x5b')][_0x3c58('0x60')]=moment()[_0x3c58('0x61')](_0x3c58('0x62'));_0x327fe9[_0x3c58('0x5b')][_0x3c58('0x63')]=_0x327fe9[_0x3c58('0x5b')][_0x3c58('0x63')]||_0x327fe9[_0x3c58('0x64')]['id'];_0x22c875[_0x3c58('0x65')]['id']=_0x327fe9[_0x3c58('0x5b')][_0x3c58('0x63')];return db[_0x3c58('0x52')][_0x3c58('0x59')]({'where':{'id':_0x327fe9[_0x3c58('0x57')]['id'],'UserId':null}})[_0x3c58('0x23')](handleEntityNotFound(_0x4a118b,null))[_0x3c58('0x23')](saveUpdates(_0x327fe9[_0x3c58('0x5b')],null))[_0x3c58('0x23')](function(_0x1016b7){if(_0x1016b7){_0x22c875['message']=_0x1016b7[_0x3c58('0x66')]({'plain':!![]});return db[_0x3c58('0x67')][_0x3c58('0x59')]({'where':{'id':_0x1016b7[_0x3c58('0x68')]}});}return null;})[_0x3c58('0x23')](handleEntityNotFound(_0x4a118b,null))[_0x3c58('0x23')](function(_0x349ab0){if(_0x349ab0){return _0x349ab0[_0x3c58('0x3a')]({'UserId':_0x327fe9[_0x3c58('0x5b')][_0x3c58('0x63')],'read1stAt':_[_0x3c58('0x69')](_0x349ab0[_0x3c58('0x6a')])?moment()[_0x3c58('0x61')](_0x3c58('0x62')):undefined});}return null;})[_0x3c58('0x23')](function(_0x31c475){if(_0x31c475){_0x22c875[_0x3c58('0x6b')]=_0x31c475[_0x3c58('0x66')]({'plain':!![]});interaction_log['info'](_0x3c58('0x6c'),_0x327fe9['user']['id'],_0x327fe9['user'][_0x3c58('0x3d')],_0x327fe9[_0x3c58('0x64')]['role'],_0x22c875[_0x3c58('0x6b')]['id'],_0x327fe9[_0x3c58('0x5b')]?JSON[_0x3c58('0x6d')](_0x327fe9[_0x3c58('0x5b')]):_0x3c58('0x6e'));return respondWithRpcPromise(_0x3c58('0x6f'),_0x3c58('0x70'),_0x22c875);}return null;})[_0x3c58('0x23')](function(_0x3cf3e5){var _0x20e0fb='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x3cf3e5['message']['ContactId'];return db['sequelize'][_0x3c58('0x43')](_0x20e0fb,{'type':db['Sequelize'][_0x3c58('0x71')][_0x3c58('0x72')],'raw':!![]})[_0x3c58('0x23')](function(_0x9bf7d3){return _0x9bf7d3;});})[_0x3c58('0x23')](function(_0x2a8c96){if(_0x2a8c96){_0x22c875['message'][_0x3c58('0x73')]=_0x2a8c96[0x0];if(!_0x327fe9[_0x3c58('0x5b')]['UserId'])return;return db[_0x3c58('0x74')][_0x3c58('0x59')]({'where':{'id':_0x327fe9[_0x3c58('0x5b')][_0x3c58('0x63')],'role':'agent'},'attributes':['id',_0x3c58('0x3d'),_0x3c58('0x75'),_0x3c58('0x76'),_0x3c58('0x77')],'raw':!![]});}return null;})[_0x3c58('0x23')](function(_0x53ecd1){if(!_0x53ecd1)return null;_0x22c875[_0x3c58('0x2a')]['agent']=_0x53ecd1;return _0x22c875;})[_0x3c58('0x23')](function(_0x34056a){if(_0x34056a){if(_0x327fe9[_0x3c58('0x5b')][_0x3c58('0x78')]){_0x22c875[_0x3c58('0x2a')][_0x3c58('0x79')]=util['format'](_0x3c58('0x7a'),_0x327fe9['user'][_0x3c58('0x3d')]);_0x22c875[_0x3c58('0x2a')][_0x3c58('0x7b')]=_0x22c875['channel'];_0x22c875[_0x3c58('0x2a')][_0x3c58('0x7c')]=_0x22c875[_0x3c58('0x7b')];_0x22c875['message'][_0x3c58('0x7d')]=_0x3c58('0x7e');return respondWithRpcPromise(_0x3c58('0x7f'),_0x3c58('0x7f'),{'event':_0x3c58('0x80'),'message':_[_0x3c58('0x4e')](_0x22c875[_0x3c58('0x2a')],JSON['parse'](_0x22c875[_0x3c58('0x6b')][_0x3c58('0x81')]))},client9002)[_0x3c58('0x23')](function(){return _0x22c875;});}return _0x22c875;}return null;})[_0x3c58('0x23')](respondWithResult(_0x4a118b,null))['catch'](handleError(_0x4a118b,null));};var interaction_log=require(_0x3c58('0x13'))(_0x3c58('0x5d'));exports[_0x3c58('0x38')]=function(_0x466782,_0x5d2580,_0x29676f){var _0x50cc78={'agent':{},'channel':_0x3c58('0x5e')};if(_0x466782[_0x3c58('0x5b')]['id']){delete _0x466782[_0x3c58('0x5b')]['id'];}_0x466782[_0x3c58('0x5b')][_0x3c58('0x63')]=_0x466782[_0x3c58('0x5b')][_0x3c58('0x63')]||_0x466782['user']['id'];_0x50cc78[_0x3c58('0x65')]['id']=_0x466782[_0x3c58('0x5b')][_0x3c58('0x63')];return db[_0x3c58('0x52')][_0x3c58('0x59')]({'where':{'id':_0x466782[_0x3c58('0x57')]['id'],'UserId':null}})[_0x3c58('0x23')](handleEntityNotFound(_0x5d2580,null))['then'](function(_0x1803cc){if(_0x1803cc){_0x50cc78['message']=_0x1803cc[_0x3c58('0x66')]({'plain':!![]});return db['ChatInteraction']['find']({'where':{'id':_0x1803cc['ChatInteractionId']}});}return null;})[_0x3c58('0x23')](handleEntityNotFound(_0x5d2580,null))['then'](function(_0x386074){if(_0x386074){_0x50cc78['interaction']=_0x386074[_0x3c58('0x66')]({'plain':!![]});interaction_log[_0x3c58('0x24')](_0x3c58('0x82'),_0x466782[_0x3c58('0x64')]['id'],_0x466782[_0x3c58('0x64')][_0x3c58('0x3d')],_0x466782[_0x3c58('0x64')]['role'],_0x50cc78['interaction']['id'],_0x466782[_0x3c58('0x5b')]?JSON[_0x3c58('0x6d')](_0x466782['body']):'null');return respondWithRpcPromise(_0x3c58('0x83'),_0x3c58('0x84'),_0x50cc78);}return null;})[_0x3c58('0x23')](function(_0x5910bf){var _0x3ebe32=_0x3c58('0x85')+_0x5910bf['message']['ContactId'];return db[_0x3c58('0x86')]['query'](_0x3ebe32,{'type':db[_0x3c58('0x87')]['QueryTypes'][_0x3c58('0x72')],'raw':!![]})[_0x3c58('0x23')](function(_0x4a7b47){return _0x4a7b47;});})[_0x3c58('0x23')](function(_0x66333a){if(_0x66333a){_0x50cc78[_0x3c58('0x2a')][_0x3c58('0x73')]=_0x66333a[0x0];if(!_0x466782[_0x3c58('0x5b')]['UserId'])return;return db['User'][_0x3c58('0x59')]({'where':{'id':_0x466782[_0x3c58('0x5b')][_0x3c58('0x63')],'role':'agent'},'attributes':['id',_0x3c58('0x3d'),_0x3c58('0x75'),_0x3c58('0x76'),_0x3c58('0x77')],'raw':!![]});}return null;})[_0x3c58('0x23')](function(_0x562ed4){if(!_0x562ed4)return null;_0x50cc78[_0x3c58('0x2a')][_0x3c58('0x65')]=_0x562ed4;return _0x50cc78;})[_0x3c58('0x23')](function(_0x2069e5){if(_0x2069e5){_0x2069e5[_0x3c58('0x2a')][_0x3c58('0x79')]=util[_0x3c58('0x61')]('SIP/%s',_0x466782[_0x3c58('0x64')]['name']);_0x2069e5[_0x3c58('0x2a')][_0x3c58('0x7b')]=_0x50cc78[_0x3c58('0x7b')];_0x2069e5['message'][_0x3c58('0x7c')]=_0x50cc78[_0x3c58('0x7b')];_0x2069e5[_0x3c58('0x2a')][_0x3c58('0x7d')]=_0x3c58('0x38');respondWithRpcPromise(_0x3c58('0x7f'),_0x3c58('0x7f'),{'event':'rejectmessage','message':_[_0x3c58('0x4e')](_0x50cc78['message'],JSON['parse'](_0x50cc78[_0x3c58('0x6b')]['formData']))},client9002);return _0x50cc78;}return null;})['then'](respondWithResult(_0x5d2580,null))[_0x3c58('0x2c')](handleError(_0x5d2580,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 1648894..e9adcc8 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 _0xfecb=['setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x3e8929,_0x13a44d){var _0xdd74ce=function(_0x19061c){while(--_0x19061c){_0x3e8929['push'](_0x3e8929['shift']());}};_0xdd74ce(++_0x13a44d);}(_0xfecb,0x177));var _0xbfec=function(_0x46bfaa,_0x17b931){_0x46bfaa=_0x46bfaa-0x0;var _0xd64a61=_0xfecb[_0x46bfaa];return _0xd64a61;};'use strict';var EventEmitter=require(_0xbfec('0x0'));var ChatMessage=require('../../mysqldb')['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xbfec('0x1')](0x0);var events={'afterCreate':_0xbfec('0x2'),'afterUpdate':_0xbfec('0x3'),'afterDestroy':'remove'};function emitEvent(_0x3f9989){return function(_0x3821e4,_0x1592a9,_0x2994af){ChatMessageEvents[_0xbfec('0x4')](_0x3f9989+':'+_0x3821e4['id'],_0x3821e4);ChatMessageEvents[_0xbfec('0x4')](_0x3f9989,_0x3821e4);_0x2994af(null);};}for(var e in events){if(events[_0xbfec('0x5')](e)){var event=events[e];ChatMessage[_0xbfec('0x6')](e,emitEvent(event));}}module[_0xbfec('0x7')]=ChatMessageEvents; \ No newline at end of file +var _0x3a6f=['emit','hasOwnProperty','events','../../mysqldb','ChatMessage','save','update','remove'];(function(_0x41179d,_0x432ce6){var _0x31b871=function(_0x44c449){while(--_0x44c449){_0x41179d['push'](_0x41179d['shift']());}};_0x31b871(++_0x432ce6);}(_0x3a6f,0x6a));var _0xf3a6=function(_0x6c871c,_0x5e968b){_0x6c871c=_0x6c871c-0x0;var _0xbaff51=_0x3a6f[_0x6c871c];return _0xbaff51;};'use strict';var EventEmitter=require(_0xf3a6('0x0'));var ChatMessage=require(_0xf3a6('0x1'))['db'][_0xf3a6('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf3a6('0x3'),'afterUpdate':_0xf3a6('0x4'),'afterDestroy':_0xf3a6('0x5')};function emitEvent(_0x111139){return function(_0xad4da5,_0x350fc6,_0x54eec8){ChatMessageEvents[_0xf3a6('0x6')](_0x111139+':'+_0xad4da5['id'],_0xad4da5);ChatMessageEvents[_0xf3a6('0x6')](_0x111139,_0xad4da5);_0x54eec8(null);};}for(var e in events){if(events[_0xf3a6('0x7')](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 55e3b99..e19892f 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 _0x39d5=['update','createdAt','catch','error','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatMessage.attributes','exports','define','chat_messages','fti_chat_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','UserId','ChatInteraction'];(function(_0x5baed9,_0x409757){var _0x43aad3=function(_0x4e6713){while(--_0x4e6713){_0x5baed9['push'](_0x5baed9['shift']());}};_0x43aad3(++_0x409757);}(_0x39d5,0x11c));var _0x539d=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0x39d5[_0x47a7d0];return _0xb9bd08;};'use strict';var _=require(_0x539d('0x0'));var util=require(_0x539d('0x1'));var logger=require(_0x539d('0x2'))(_0x539d('0x3'));var moment=require(_0x539d('0x4'));var BPromise=require('bluebird');var rp=require(_0x539d('0x5'));var fs=require('fs');var path=require(_0x539d('0x6'));var rimraf=require(_0x539d('0x7'));var config=require(_0x539d('0x8'));var attributes=require(_0x539d('0x9'));module[_0x539d('0xa')]=function(_0x1f86e4,_0x4f7097){return _0x1f86e4[_0x539d('0xb')]('ChatMessage',attributes,{'tableName':_0x539d('0xc'),'paranoid':![],'indexes':[{'name':_0x539d('0xd'),'fields':[_0x539d('0xe')],'type':_0x539d('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x57d6a8,_0x4abb66,_0x226144){var _0x31b577=_0x1f86e4[_0x539d('0x10')];var _0x548f93=_0x57d6a8[_0x539d('0x11')]({'plain':!![]});if(_0x548f93[_0x539d('0x12')][_0x539d('0x13')]()==='in'||_0x548f93[_0x539d('0x12')]['toLowerCase']()===_0x539d('0x14')&&!_0x548f93[_0x539d('0x15')]&&!_['isNil'](_0x548f93[_0x539d('0x16')])){_0x31b577[_0x539d('0x17')]['findOne']({'where':{'id':_0x548f93['ChatInteractionId']}})['then'](function(_0x559b1c){if(_0x559b1c){_0x559b1c[_0x539d('0x18')]({'lastMsgAt':_0x548f93[_0x539d('0x19')],'lastMsgDirection':_0x548f93[_0x539d('0x12')]['toLowerCase']()});}})[_0x539d('0x1a')](function(_0x2c77c4){console[_0x539d('0x1b')](_0x2c77c4);});}_0x226144();}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x4871=['FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','ChatInteraction','findOne','ChatInteractionId','then','update','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','exports','define','chat_messages','fti_chat_messages','body'];(function(_0x187718,_0x427383){var _0x29ddf4=function(_0x2ec62a){while(--_0x2ec62a){_0x187718['push'](_0x187718['shift']());}};_0x29ddf4(++_0x427383);}(_0x4871,0xa8));var _0x1487=function(_0x2d8556,_0x19637e){_0x2d8556=_0x2d8556-0x0;var _0xfe76c2=_0x4871[_0x2d8556];return _0xfe76c2;};'use strict';var _=require(_0x1487('0x0'));var util=require('util');var logger=require(_0x1487('0x1'))(_0x1487('0x2'));var moment=require(_0x1487('0x3'));var BPromise=require(_0x1487('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1487('0x5'));var config=require(_0x1487('0x6'));var attributes=require('./chatMessage.attributes');module[_0x1487('0x7')]=function(_0x325f40,_0x58e6d2){return _0x325f40[_0x1487('0x8')]('ChatMessage',attributes,{'tableName':_0x1487('0x9'),'paranoid':![],'indexes':[{'name':_0x1487('0xa'),'fields':[_0x1487('0xb')],'type':_0x1487('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x424cdc,_0x3a827a,_0x1df004){var _0x1a8d65=_0x325f40[_0x1487('0xd')];var _0xaa6b58=_0x424cdc[_0x1487('0xe')]({'plain':!![]});if(_0xaa6b58[_0x1487('0xf')][_0x1487('0x10')]()==='in'||_0xaa6b58[_0x1487('0xf')][_0x1487('0x10')]()===_0x1487('0x11')&&!_0xaa6b58[_0x1487('0x12')]&&!_[_0x1487('0x13')](_0xaa6b58[_0x1487('0x14')])){_0x1a8d65[_0x1487('0x15')][_0x1487('0x16')]({'where':{'id':_0xaa6b58[_0x1487('0x17')]}})[_0x1487('0x18')](function(_0x37ea4b){if(_0x37ea4b){_0x37ea4b[_0x1487('0x19')]({'lastMsgAt':_0xaa6b58['createdAt'],'lastMsgDirection':_0xaa6b58['direction'][_0x1487('0x10')]()});}})[_0x1487('0x1a')](function(_0x3a749c){console[_0x1487('0x1b')](_0x3a749c);});}_0x1df004();}},'charset':_0x1487('0x1c'),'collate':_0x1487('0x1d')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index aeedc40..02b1195 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 _0x3eea=['code','message','result','catch','CreateChatMessage','body','options','info','stringify','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','redis','socket.io-emitter','request','then','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error'];(function(_0x1ca46f,_0x272633){var _0x1f1278=function(_0xc0c7c8){while(--_0xc0c7c8){_0x1ca46f['push'](_0x1ca46f['shift']());}};_0x1f1278(++_0x272633);}(_0x3eea,0x1ad));var _0xa3ee=function(_0x4b091c,_0xfd9361){_0x4b091c=_0x4b091c-0x0;var _0x20a0e3=_0x3eea[_0x4b091c];return _0x20a0e3;};'use strict';var _=require('lodash');var util=require(_0xa3ee('0x0'));var moment=require(_0xa3ee('0x1'));var BPromise=require(_0xa3ee('0x2'));var rs=require(_0xa3ee('0x3'));var fs=require('fs');var Redis=require(_0xa3ee('0x4'));var db=require(_0xa3ee('0x5'))['db'];var utils=require(_0xa3ee('0x6'));var logger=require(_0xa3ee('0x7'))('rpc');var config=require(_0xa3ee('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa3ee('0x9')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0xa3ee('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xa3ee('0xb'))(new Redis(config['redis']));require('./chatMessage.socket')['register'](socket);function respondWithRpcPromise(_0x554f91,_0x424882,_0x4a3bc5){return new BPromise(function(_0x271043,_0xc2d9be){return client[_0xa3ee('0xc')](_0x554f91,_0x4a3bc5)[_0xa3ee('0xd')](function(_0x28f0a8){logger['info'](_0xa3ee('0xe'),_0x424882,_0xa3ee('0xf'));logger[_0xa3ee('0x10')](_0xa3ee('0x11'),_0x424882,'request\x20sent',JSON['stringify'](_0x28f0a8));if(_0x28f0a8[_0xa3ee('0x12')]){if(_0x28f0a8[_0xa3ee('0x12')][_0xa3ee('0x13')]===0x1f4){logger[_0xa3ee('0x12')](_0xa3ee('0xe'),_0x424882,_0x28f0a8['error'][_0xa3ee('0x14')]);return _0xc2d9be(_0x28f0a8[_0xa3ee('0x12')]['message']);}logger[_0xa3ee('0x12')]('ChatMessage,\x20%s,\x20%s',_0x424882,_0x28f0a8[_0xa3ee('0x12')][_0xa3ee('0x14')]);return _0x271043(_0x28f0a8[_0xa3ee('0x12')]['message']);}else{logger['info'](_0xa3ee('0xe'),_0x424882,_0xa3ee('0xf'));_0x271043(_0x28f0a8[_0xa3ee('0x15')][_0xa3ee('0x14')]);}})[_0xa3ee('0x16')](function(_0x3d4408){logger[_0xa3ee('0x12')](_0xa3ee('0xe'),_0x424882,_0x3d4408);_0xc2d9be(_0x3d4408);});});}exports[_0xa3ee('0x17')]=function(_0x324919){var _0x4ea505=this;return new Promise(function(_0x9fa13c,_0x571a81){return db['ChatMessage']['create'](_0x324919[_0xa3ee('0x18')],{'raw':_0x324919[_0xa3ee('0x19')]?_0x324919['options']['raw']===undefined?!![]:![]:!![]})[_0xa3ee('0xd')](function(_0x4e6fbc){logger[_0xa3ee('0x1a')]('CreateChatMessage',_0x324919);logger['debug'](_0xa3ee('0x17'),_0x324919,JSON[_0xa3ee('0x1b')](_0x4e6fbc));_0x9fa13c(_0x4e6fbc);})[_0xa3ee('0x16')](function(_0x471d60){logger[_0xa3ee('0x12')](_0xa3ee('0x17'),_0x471d60[_0xa3ee('0x14')],_0x324919);_0x571a81(_0x4ea505[_0xa3ee('0x12')](0x1f4,_0x471d60[_0xa3ee('0x14')]));});});}; \ No newline at end of file +var _0x03f6=['./chatMessage.socket','register','request','then','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatMessage','body','options','raw','info','CreateChatMessage','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost'];(function(_0xda3f86,_0x32c86c){var _0x1bcc40=function(_0x47a384){while(--_0x47a384){_0xda3f86['push'](_0xda3f86['shift']());}};_0x1bcc40(++_0x32c86c);}(_0x03f6,0x1e1));var _0x603f=function(_0x2f7731,_0x28e47b){_0x2f7731=_0x2f7731-0x0;var _0x257d6a=_0x03f6[_0x2f7731];return _0x257d6a;};'use strict';var _=require('lodash');var util=require(_0x603f('0x0'));var moment=require(_0x603f('0x1'));var BPromise=require('bluebird');var rs=require(_0x603f('0x2'));var fs=require('fs');var Redis=require(_0x603f('0x3'));var db=require(_0x603f('0x4'))['db'];var utils=require(_0x603f('0x5'));var logger=require(_0x603f('0x6'))(_0x603f('0x7'));var config=require(_0x603f('0x8'));var jayson=require(_0x603f('0x9'));var client=jayson['client'][_0x603f('0xa')]({'port':0x232a});config[_0x603f('0xb')]=_[_0x603f('0xc')](config[_0x603f('0xb')],{'host':_0x603f('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x603f('0xb')]));require(_0x603f('0xe'))[_0x603f('0xf')](socket);function respondWithRpcPromise(_0x46b6fd,_0x42eddc,_0x42413e){return new BPromise(function(_0x188d92,_0x30e0f7){return client[_0x603f('0x10')](_0x46b6fd,_0x42413e)[_0x603f('0x11')](function(_0x57bf69){logger['info'](_0x603f('0x12'),_0x42eddc,_0x603f('0x13'));logger[_0x603f('0x14')](_0x603f('0x15'),_0x42eddc,_0x603f('0x13'),JSON[_0x603f('0x16')](_0x57bf69));if(_0x57bf69[_0x603f('0x17')]){if(_0x57bf69['error'][_0x603f('0x18')]===0x1f4){logger['error'](_0x603f('0x12'),_0x42eddc,_0x57bf69['error'][_0x603f('0x19')]);return _0x30e0f7(_0x57bf69[_0x603f('0x17')][_0x603f('0x19')]);}logger[_0x603f('0x17')](_0x603f('0x12'),_0x42eddc,_0x57bf69['error']['message']);return _0x188d92(_0x57bf69[_0x603f('0x17')][_0x603f('0x19')]);}else{logger['info'](_0x603f('0x12'),_0x42eddc,_0x603f('0x13'));_0x188d92(_0x57bf69['result'][_0x603f('0x19')]);}})['catch'](function(_0x485a2a){logger[_0x603f('0x17')]('ChatMessage,\x20%s,\x20%s',_0x42eddc,_0x485a2a);_0x30e0f7(_0x485a2a);});});}exports['CreateChatMessage']=function(_0x570c20){var _0x2c0226=this;return new Promise(function(_0x27400f,_0x394e0b){return db[_0x603f('0x1a')]['create'](_0x570c20[_0x603f('0x1b')],{'raw':_0x570c20[_0x603f('0x1c')]?_0x570c20['options'][_0x603f('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x26e2e0){logger[_0x603f('0x1e')](_0x603f('0x1f'),_0x570c20);logger[_0x603f('0x14')]('CreateChatMessage',_0x570c20,JSON[_0x603f('0x16')](_0x26e2e0));_0x27400f(_0x26e2e0);})[_0x603f('0x20')](function(_0x1bd0e8){logger[_0x603f('0x17')](_0x603f('0x1f'),_0x1bd0e8[_0x603f('0x19')],_0x570c20);_0x394e0b(_0x2c0226[_0x603f('0x17')](0x1f4,_0x1bd0e8[_0x603f('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index f3d0f06..c7847af 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 _0x5292=['length','chatMessage:','./chatMessage.events','save','update','emit','removeListener'];(function(_0x19f3b9,_0x294474){var _0x51c638=function(_0x58eace){while(--_0x58eace){_0x19f3b9['push'](_0x19f3b9['shift']());}};_0x51c638(++_0x294474);}(_0x5292,0xf7));var _0x2529=function(_0x15716a,_0x3e6958){_0x15716a=_0x15716a-0x0;var _0x548da0=_0x5292[_0x15716a];return _0x548da0;};'use strict';var ChatMessageEvents=require(_0x2529('0x0'));var events=[_0x2529('0x1'),'remove',_0x2529('0x2')];function createListener(_0x522ab4,_0x1540a9){return function(_0x2b088){_0x1540a9[_0x2529('0x3')](_0x522ab4,_0x2b088);};}function removeListener(_0x228165,_0x5d25dc){return function(){ChatMessageEvents[_0x2529('0x4')](_0x228165,_0x5d25dc);};}exports['register']=function(_0x4c9b4c){for(var _0x4e7a9e=0x0,_0x407277=events[_0x2529('0x5')];_0x4e7a9e<_0x407277;_0x4e7a9e++){var _0x5bb8a1=events[_0x4e7a9e];var _0x5c3355=createListener(_0x2529('0x6')+_0x5bb8a1,_0x4c9b4c);ChatMessageEvents['on'](_0x5bb8a1,_0x5c3355);}}; \ No newline at end of file +var _0xb194=['remove','update','register','length','./chatMessage.events'];(function(_0x11c573,_0x9e7c6e){var _0x6b72de=function(_0x2e8a61){while(--_0x2e8a61){_0x11c573['push'](_0x11c573['shift']());}};_0x6b72de(++_0x9e7c6e);}(_0xb194,0x1b2));var _0x4b19=function(_0x375521,_0x413159){_0x375521=_0x375521-0x0;var _0x1fb976=_0xb194[_0x375521];return _0x1fb976;};'use strict';var ChatMessageEvents=require(_0x4b19('0x0'));var events=['save',_0x4b19('0x1'),_0x4b19('0x2')];function createListener(_0x10bd69,_0x2e77f6){return function(_0x3ba6e4){_0x2e77f6['emit'](_0x10bd69,_0x3ba6e4);};}function removeListener(_0x46faa3,_0x3a4700){return function(){ChatMessageEvents['removeListener'](_0x46faa3,_0x3a4700);};}exports[_0x4b19('0x3')]=function(_0x570374){for(var _0x22033b=0x0,_0x5070da=events[_0x4b19('0x4')];_0x22033b<_0x5070da;_0x22033b++){var _0x3fb52e=events[_0x22033b];var _0x1dae50=createListener('chatMessage:'+_0x3fb52e,_0x570374);ChatMessageEvents['on'](_0x3fb52e,_0x1dae50);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index c15646f..435da8b 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 _0x75a1=['get','isAuthenticated','/describe','describe','post','tracked','chat','create','put','/:id','update','accept','/:id/reject','reject','delete','destroy','exports','multer','util','connect-timeout','express','../../components/interaction/service','../../config/environment','./chatMessage.controller'];(function(_0x34a6e9,_0x25cabe){var _0x11015c=function(_0x5c2ced){while(--_0x5c2ced){_0x34a6e9['push'](_0x34a6e9['shift']());}};_0x11015c(++_0x25cabe);}(_0x75a1,0x161));var _0x175a=function(_0x3e3b90,_0x5f3af4){_0x3e3b90=_0x3e3b90-0x0;var _0x51c451=_0x75a1[_0x3e3b90];return _0x51c451;};'use strict';var multer=require(_0x175a('0x0'));var util=require(_0x175a('0x1'));var path=require('path');var timeout=require(_0x175a('0x2'));var express=require(_0x175a('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x175a('0x4'));var config=require(_0x175a('0x5'));var controller=require(_0x175a('0x6'));router[_0x175a('0x7')]('/',auth[_0x175a('0x8')](),controller['index']);router[_0x175a('0x7')](_0x175a('0x9'),auth[_0x175a('0x8')](),controller[_0x175a('0xa')]);router[_0x175a('0x7')]('/:id',auth[_0x175a('0x8')](),controller['show']);router[_0x175a('0xb')]('/',auth['isAuthenticated'](),interaction[_0x175a('0xc')](_0x175a('0xd'),'chatmessage:create'),controller[_0x175a('0xe')]);router[_0x175a('0xf')](_0x175a('0x10'),controller[_0x175a('0x11')]);router[_0x175a('0xf')]('/:id/accept',auth[_0x175a('0x8')](),controller[_0x175a('0x12')]);router['put'](_0x175a('0x13'),auth[_0x175a('0x8')](),controller[_0x175a('0x14')]);router[_0x175a('0x15')](_0x175a('0x10'),auth[_0x175a('0x8')](),controller[_0x175a('0x16')]);module[_0x175a('0x17')]=router; \ No newline at end of file +var _0x92c5=['tracked','chat','chatmessage:create','create','put','update','accept','/:id/reject','reject','delete','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','post'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x92c5,0xca));var _0x592c=function(_0x19ec21,_0x45e0d4){_0x19ec21=_0x19ec21-0x0;var _0x423b07=_0x92c5[_0x19ec21];return _0x423b07;};'use strict';var multer=require(_0x592c('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x592c('0x1'));var express=require('express');var router=express[_0x592c('0x2')]();var fs_extra=require(_0x592c('0x3'));var auth=require(_0x592c('0x4'));var interaction=require(_0x592c('0x5'));var config=require('../../config/environment');var controller=require(_0x592c('0x6'));router[_0x592c('0x7')]('/',auth[_0x592c('0x8')](),controller[_0x592c('0x9')]);router[_0x592c('0x7')](_0x592c('0xa'),auth[_0x592c('0x8')](),controller[_0x592c('0xb')]);router['get'](_0x592c('0xc'),auth[_0x592c('0x8')](),controller['show']);router[_0x592c('0xd')]('/',auth[_0x592c('0x8')](),interaction[_0x592c('0xe')](_0x592c('0xf'),_0x592c('0x10')),controller[_0x592c('0x11')]);router[_0x592c('0x12')](_0x592c('0xc'),controller[_0x592c('0x13')]);router[_0x592c('0x12')]('/:id/accept',auth[_0x592c('0x8')](),controller[_0x592c('0x14')]);router['put'](_0x592c('0x15'),auth[_0x592c('0x8')](),controller[_0x592c('0x16')]);router[_0x592c('0x17')]('/:id',auth[_0x592c('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index a15bee6..da9612d 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 _0xb10b=['medium','sequelize','TEXT'];(function(_0x540c83,_0x3ff26f){var _0x171a3a=function(_0x477d5f){while(--_0x477d5f){_0x540c83['push'](_0x540c83['shift']());}};_0x171a3a(++_0x3ff26f);}(_0xb10b,0x12a));var _0xbb10=function(_0x1e99bc,_0x3a0006){_0x1e99bc=_0x1e99bc-0x0;var _0x281232=_0xb10b[_0x1e99bc];return _0x281232;};'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 +var _0xadb5=['medium','TEXT','exports'];(function(_0x2c2f22,_0x3d4ee9){var _0x37e93b=function(_0x3469de){while(--_0x3469de){_0x2c2f22['push'](_0x2c2f22['shift']());}};_0x37e93b(++_0x3d4ee9);}(_0xadb5,0xad));var _0x5adb=function(_0x16f578,_0x4f8ab8){_0x16f578=_0x16f578-0x0;var _0x3a10c6=_0xadb5[_0x16f578];return _0x3a10c6;};'use strict';var Sequelize=require('sequelize');module[_0x5adb('0x0')]={'body':{'type':Sequelize['TEXT'](_0x5adb('0x1')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x5adb('0x2')](_0x5adb('0x1')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 9879bd6..d05892a 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(_0x25bea7,_0x49ab45){var _0x175952=function(_0x56a0b5){while(--_0x56a0b5){_0x25bea7['push'](_0x25bea7['shift']());}};_0x175952(++_0x49ab45);}(_0x7a54,0x106));var _0x47a5=function(_0x477d16,_0x4448d2){_0x477d16=_0x477d16-0x0;var _0x3c252b=_0x7a54[_0x477d16];return _0x3c252b;};'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(_0xa879af,_0x51514d){var _0x1b02db=function(_0x33c4b3){while(--_0x33c4b3){_0xa879af['push'](_0xa879af['shift']());}};_0x1b02db(++_0x51514d);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'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 1f7c2d4..fa0e701 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 _0x8466=['exports','events','../../mysqldb','save','remove','emit','hasOwnProperty','hook'];(function(_0x210ebe,_0x57ac00){var _0x14184a=function(_0x24696f){while(--_0x24696f){_0x210ebe['push'](_0x210ebe['shift']());}};_0x14184a(++_0x57ac00);}(_0x8466,0x139));var _0x6846=function(_0x4c73b9,_0x2837ed){_0x4c73b9=_0x4c73b9-0x0;var _0x45bba0=_0x8466[_0x4c73b9];return _0x45bba0;};'use strict';var EventEmitter=require(_0x6846('0x0'));var ChatOfflineMessage=require(_0x6846('0x1'))['db']['ChatOfflineMessage'];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6846('0x2'),'afterUpdate':'update','afterDestroy':_0x6846('0x3')};function emitEvent(_0x1c6d5e){return function(_0x5b4b48,_0x4a667f,_0x505881){ChatOfflineMessageEvents[_0x6846('0x4')](_0x1c6d5e+':'+_0x5b4b48['id'],_0x5b4b48);ChatOfflineMessageEvents[_0x6846('0x4')](_0x1c6d5e,_0x5b4b48);_0x505881(null);};}for(var e in events){if(events[_0x6846('0x5')](e)){var event=events[e];ChatOfflineMessage[_0x6846('0x6')](e,emitEvent(event));}}module[_0x6846('0x7')]=ChatOfflineMessageEvents; \ No newline at end of file +var _0xee20=['update','remove','emit','events','../../mysqldb','setMaxListeners','save'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xee20,0x1c3));var _0x0ee2=function(_0x106759,_0x445275){_0x106759=_0x106759-0x0;var _0x4977e2=_0xee20[_0x106759];return _0x4977e2;};'use strict';var EventEmitter=require(_0x0ee2('0x0'));var ChatOfflineMessage=require(_0x0ee2('0x1'))['db']['ChatOfflineMessage'];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x0ee2('0x2')](0x0);var events={'afterCreate':_0x0ee2('0x3'),'afterUpdate':_0x0ee2('0x4'),'afterDestroy':_0x0ee2('0x5')};function emitEvent(_0x4cf4f5){return function(_0x104fba,_0x5bb8d8,_0x543963){ChatOfflineMessageEvents['emit'](_0x4cf4f5+':'+_0x104fba['id'],_0x104fba);ChatOfflineMessageEvents[_0x0ee2('0x6')](_0x4cf4f5,_0x104fba);_0x543963(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatOfflineMessage['hook'](e,emitEvent(event));}}module['exports']=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 2c7f1a9..dcc5180 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 _0x6dc8=['chat_offline_messages','utf8mb4','./chatOfflineMessage.attributes','define','ChatOfflineMessage'];(function(_0x450ebf,_0x1bb812){var _0x267e13=function(_0x50033b){while(--_0x50033b){_0x450ebf['push'](_0x450ebf['shift']());}};_0x267e13(++_0x1bb812);}(_0x6dc8,0xf2));var _0x86dc=function(_0x132d12,_0x2c9799){_0x132d12=_0x132d12-0x0;var _0x1c3163=_0x6dc8[_0x132d12];return _0x1c3163;};'use strict';var attributes=require(_0x86dc('0x0'));module['exports']=function(_0x6a7a0e){return _0x6a7a0e[_0x86dc('0x1')](_0x86dc('0x2'),attributes,{'tableName':_0x86dc('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x86dc('0x4'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x8c05=['define','ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','./chatOfflineMessage.attributes'];(function(_0x22cc16,_0x1f4fa2){var _0x399b70=function(_0x34d464){while(--_0x34d464){_0x22cc16['push'](_0x22cc16['shift']());}};_0x399b70(++_0x1f4fa2);}(_0x8c05,0x15b));var _0x58c0=function(_0x11cdfb,_0x571760){_0x11cdfb=_0x11cdfb-0x0;var _0x327566=_0x8c05[_0x11cdfb];return _0x327566;};'use strict';var attributes=require(_0x58c0('0x0'));module['exports']=function(_0x327dfd){return _0x327dfd[_0x58c0('0x1')](_0x58c0('0x2'),attributes,{'tableName':_0x58c0('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x58c0('0x4'),'collate':_0x58c0('0x5')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index c017095..0c14d3f 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 _0xc44b=['client','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','error','message','result','catch','lodash','util','moment','randomstring','../../config/logger','rpc','jayson/promise'];(function(_0xdd6a15,_0x3ef1a8){var _0x283f7a=function(_0x1e389b){while(--_0x1e389b){_0xdd6a15['push'](_0xdd6a15['shift']());}};_0x283f7a(++_0x3ef1a8);}(_0xc44b,0xad));var _0xbc44=function(_0x2f6233,_0x90172){_0x2f6233=_0x2f6233-0x0;var _0x1c9c36=_0xc44b[_0x2f6233];return _0x1c9c36;};'use strict';var _=require(_0xbc44('0x0'));var util=require(_0xbc44('0x1'));var moment=require(_0xbc44('0x2'));var BPromise=require('bluebird');var rs=require(_0xbc44('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbc44('0x4'))(_0xbc44('0x5'));var config=require('../../config/environment');var jayson=require(_0xbc44('0x6'));var client=jayson[_0xbc44('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x584de6,_0x4d2e69,_0x23890a){return new BPromise(function(_0x2ee207,_0x2192b1){return client['request'](_0x584de6,_0x23890a)['then'](function(_0x59fbb1){logger[_0xbc44('0x8')](_0xbc44('0x9'),_0x4d2e69,_0xbc44('0xa'));logger['debug']('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x4d2e69,'request\x20sent',JSON['stringify'](_0x59fbb1));if(_0x59fbb1[_0xbc44('0xb')]){if(_0x59fbb1[_0xbc44('0xb')]['code']===0x1f4){logger[_0xbc44('0xb')](_0xbc44('0x9'),_0x4d2e69,_0x59fbb1['error'][_0xbc44('0xc')]);return _0x2192b1(_0x59fbb1['error'][_0xbc44('0xc')]);}logger[_0xbc44('0xb')](_0xbc44('0x9'),_0x4d2e69,_0x59fbb1[_0xbc44('0xb')]['message']);return _0x2ee207(_0x59fbb1['error']['message']);}else{logger[_0xbc44('0x8')](_0xbc44('0x9'),_0x4d2e69,'request\x20sent');_0x2ee207(_0x59fbb1[_0xbc44('0xd')][_0xbc44('0xc')]);}})[_0xbc44('0xe')](function(_0x515513){logger['error'](_0xbc44('0x9'),_0x4d2e69,_0x515513);_0x2192b1(_0x515513);});});} \ No newline at end of file +var _0x11cf=['stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s'];(function(_0x38f2dd,_0x5e5200){var _0x1f8dd7=function(_0x4d87fc){while(--_0x4d87fc){_0x38f2dd['push'](_0x38f2dd['shift']());}};_0x1f8dd7(++_0x5e5200);}(_0x11cf,0x10b));var _0xf11c=function(_0x20368b,_0x290bbb){_0x20368b=_0x20368b-0x0;var _0x7c6c4=_0x11cf[_0x20368b];return _0x7c6c4;};'use strict';var _=require(_0xf11c('0x0'));var util=require(_0xf11c('0x1'));var moment=require(_0xf11c('0x2'));var BPromise=require(_0xf11c('0x3'));var rs=require(_0xf11c('0x4'));var fs=require('fs');var Redis=require(_0xf11c('0x5'));var db=require(_0xf11c('0x6'))['db'];var utils=require(_0xf11c('0x7'));var logger=require(_0xf11c('0x8'))(_0xf11c('0x9'));var config=require(_0xf11c('0xa'));var jayson=require(_0xf11c('0xb'));var client=jayson[_0xf11c('0xc')][_0xf11c('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x403b89,_0x56a3f1,_0x2150af){return new BPromise(function(_0x515b71,_0x3f0683){return client[_0xf11c('0xe')](_0x403b89,_0x2150af)['then'](function(_0x4ab461){logger['info'](_0xf11c('0xf'),_0x56a3f1,_0xf11c('0x10'));logger[_0xf11c('0x11')](_0xf11c('0x12'),_0x56a3f1,_0xf11c('0x10'),JSON[_0xf11c('0x13')](_0x4ab461));if(_0x4ab461[_0xf11c('0x14')]){if(_0x4ab461[_0xf11c('0x14')][_0xf11c('0x15')]===0x1f4){logger[_0xf11c('0x14')](_0xf11c('0xf'),_0x56a3f1,_0x4ab461[_0xf11c('0x14')]['message']);return _0x3f0683(_0x4ab461['error']['message']);}logger['error'](_0xf11c('0xf'),_0x56a3f1,_0x4ab461[_0xf11c('0x14')][_0xf11c('0x16')]);return _0x515b71(_0x4ab461[_0xf11c('0x14')][_0xf11c('0x16')]);}else{logger[_0xf11c('0x17')](_0xf11c('0xf'),_0x56a3f1,_0xf11c('0x10'));_0x515b71(_0x4ab461[_0xf11c('0x18')]['message']);}})[_0xf11c('0x19')](function(_0xeb5dbc){logger[_0xf11c('0x14')]('ChatOfflineMessage,\x20%s,\x20%s',_0x56a3f1,_0xeb5dbc);_0x3f0683(_0xeb5dbc);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index beb44d5..848b24e 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 _0x379f=['/:id','show','post','create','put','destroy','exports','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','isAuthenticated','index','/describe','describe','get'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x379f,0x183));var _0xf379=function(_0x177472,_0x20cfb5){_0x177472=_0x177472-0x0;var _0x1c1c26=_0x379f[_0x177472];return _0x1c1c26;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf379('0x0'));var timeout=require(_0xf379('0x1'));var express=require('express');var router=express[_0xf379('0x2')]();var fs_extra=require(_0xf379('0x3'));var auth=require(_0xf379('0x4'));var interaction=require(_0xf379('0x5'));var config=require(_0xf379('0x6'));var controller=require(_0xf379('0x7'));router['get']('/',auth[_0xf379('0x8')](),controller[_0xf379('0x9')]);router['get'](_0xf379('0xa'),auth[_0xf379('0x8')](),controller[_0xf379('0xb')]);router[_0xf379('0xc')](_0xf379('0xd'),auth[_0xf379('0x8')](),controller[_0xf379('0xe')]);router[_0xf379('0xf')]('/',auth[_0xf379('0x8')](),controller[_0xf379('0x10')]);router[_0xf379('0x11')](_0xf379('0xd'),auth[_0xf379('0x8')](),controller['update']);router['delete'](_0xf379('0xd'),auth[_0xf379('0x8')](),controller[_0xf379('0x12')]);module[_0xf379('0x13')]=router; \ No newline at end of file +var _0x7d05=['exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','/describe','create','put','/:id','update','delete','destroy'];(function(_0x3caae0,_0x2a5646){var _0x34e8bc=function(_0xc3429a){while(--_0xc3429a){_0x3caae0['push'](_0x3caae0['shift']());}};_0x34e8bc(++_0x2a5646);}(_0x7d05,0x17d));var _0x57d0=function(_0xa3f428,_0x547269){_0xa3f428=_0xa3f428-0x0;var _0x116e10=_0x7d05[_0xa3f428];return _0x116e10;};'use strict';var multer=require(_0x57d0('0x0'));var util=require(_0x57d0('0x1'));var path=require(_0x57d0('0x2'));var timeout=require('connect-timeout');var express=require(_0x57d0('0x3'));var router=express[_0x57d0('0x4')]();var fs_extra=require(_0x57d0('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x57d0('0x6'));var config=require(_0x57d0('0x7'));var controller=require(_0x57d0('0x8'));router[_0x57d0('0x9')]('/',auth[_0x57d0('0xa')](),controller[_0x57d0('0xb')]);router[_0x57d0('0x9')](_0x57d0('0xc'),auth[_0x57d0('0xa')](),controller['describe']);router[_0x57d0('0x9')]('/:id',auth[_0x57d0('0xa')](),controller['show']);router['post']('/',auth[_0x57d0('0xa')](),controller[_0x57d0('0xd')]);router[_0x57d0('0xe')](_0x57d0('0xf'),auth[_0x57d0('0xa')](),controller[_0x57d0('0x10')]);router[_0x57d0('0x11')]('/:id',auth[_0x57d0('0xa')](),controller[_0x57d0('0x12')]);module[_0x57d0('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 151ce45..c88efa0 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 _0x5f7d=['STRING','ENUM','mouseOver','timeout','exports'];(function(_0x3382ed,_0x72f6f0){var _0x57baee=function(_0x381eaf){while(--_0x381eaf){_0x3382ed['push'](_0x3382ed['shift']());}};_0x57baee(++_0x72f6f0);}(_0x5f7d,0x68));var _0xd5f7=function(_0x4ad355,_0x433598){_0x4ad355=_0x4ad355-0x0;var _0x40acfd=_0x5f7d[_0x4ad355];return _0x40acfd;};'use strict';var Sequelize=require('sequelize');module[_0xd5f7('0x0')]={'name':{'type':Sequelize[_0xd5f7('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xd5f7('0x2')](_0xd5f7('0x3'),_0xd5f7('0x4')),'defaultValue':_0xd5f7('0x3')},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x61a7=['timeout','STRING','ENUM','mouseOver'];(function(_0xe41759,_0x198955){var _0xf1c8bf=function(_0x3b64b3){while(--_0x3b64b3){_0xe41759['push'](_0xe41759['shift']());}};_0xf1c8bf(++_0x198955);}(_0x61a7,0x1c9));var _0x761a=function(_0x5687e5,_0xe37f9d){_0x5687e5=_0x5687e5-0x0;var _0x3acd32=_0x61a7[_0x5687e5];return _0x3acd32;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x761a('0x0')],'allowNull':![]},'type':{'type':Sequelize[_0x761a('0x1')](_0x761a('0x2'),_0x761a('0x3')),'defaultValue':'mouseOver'},'selector':{'type':Sequelize[_0x761a('0x0')]},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 6109920..bb1419b 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 _0xe4b8=['sox','to-csv','fs-extra','squel','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','offset','set','Content-Range','apply','reject','update','then','destroy','end','name','send','params','model','keys','ChatProactiveAction','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path'];(function(_0x364cf8,_0x146b9b){var _0x6a59ee=function(_0x3d81eb){while(--_0x3d81eb){_0x364cf8['push'](_0x364cf8['shift']());}};_0x6a59ee(++_0x146b9b);}(_0xe4b8,0x179));var _0x8e4b=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0xe4b8[_0x29d915];return _0x160f86;};'use strict';var emlformat=require(_0x8e4b('0x0'));var rimraf=require(_0x8e4b('0x1'));var zipdir=require(_0x8e4b('0x2'));var jsonpatch=require(_0x8e4b('0x3'));var rp=require(_0x8e4b('0x4'));var moment=require(_0x8e4b('0x5'));var BPromise=require(_0x8e4b('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x8e4b('0x7'));var sox=require(_0x8e4b('0x8'));var csv=require(_0x8e4b('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8e4b('0xa'));var _=require('lodash');var squel=require(_0x8e4b('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8e4b('0xc'));var Redis=require('ioredis');var authService=require(_0x8e4b('0xd'));var qs=require(_0x8e4b('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8e4b('0xf'));var logger=require(_0x8e4b('0x10'))(_0x8e4b('0x11'));var utils=require('../../config/utils');var config=require(_0x8e4b('0x12'));var licenseUtil=require(_0x8e4b('0x13'));var db=require(_0x8e4b('0x14'))['db'];function respondWithStatusCode(_0x13f8a6,_0x30b1c8){_0x30b1c8=_0x30b1c8||0xcc;return function(_0x30d9d1){if(_0x30d9d1){return _0x13f8a6[_0x8e4b('0x15')](_0x30b1c8);}return _0x13f8a6[_0x8e4b('0x16')](_0x30b1c8)['end']();};}function respondWithResult(_0x5f56fb,_0x2e8e71){_0x2e8e71=_0x2e8e71||0xc8;return function(_0x261e76){if(_0x261e76){return _0x5f56fb[_0x8e4b('0x16')](_0x2e8e71)[_0x8e4b('0x17')](_0x261e76);}};}function respondWithFilteredResult(_0x276d96,_0x4d10fd){return function(_0x4b0197){if(_0x4b0197){var _0xfff6b=typeof _0x4d10fd['offset']==='undefined'&&typeof _0x4d10fd[_0x8e4b('0x18')]==='undefined';var _0x38cbf5=_0x4b0197['count'];var _0x444c19=_0xfff6b?0x0:_0x4d10fd[_0x8e4b('0x19')];var _0x4b2458=_0xfff6b?_0x4b0197['count']:_0x4d10fd[_0x8e4b('0x19')]+_0x4d10fd[_0x8e4b('0x18')];var _0x38d4a7;if(_0x4b2458>=_0x38cbf5){_0x4b2458=_0x38cbf5;_0x38d4a7=0xc8;}else{_0x38d4a7=0xce;}_0x276d96[_0x8e4b('0x16')](_0x38d4a7);return _0x276d96[_0x8e4b('0x1a')](_0x8e4b('0x1b'),_0x444c19+'-'+_0x4b2458+'/'+_0x38cbf5)[_0x8e4b('0x17')](_0x4b0197);}return null;};}function patchUpdates(_0x27f816){return function(_0x9eeb68){try{jsonpatch[_0x8e4b('0x1c')](_0x9eeb68,_0x27f816,!![]);}catch(_0x123017){return BPromise[_0x8e4b('0x1d')](_0x123017);}return _0x9eeb68['save']();};}function saveUpdates(_0xa4c5ad,_0x16ff18){return function(_0x5f3043){if(_0x5f3043){return _0x5f3043[_0x8e4b('0x1e')](_0xa4c5ad)[_0x8e4b('0x1f')](function(_0x54b17e){return _0x54b17e;});}return null;};}function removeEntity(_0x2bd4e7,_0x719300){return function(_0x5e8915){if(_0x5e8915){return _0x5e8915[_0x8e4b('0x20')]()[_0x8e4b('0x1f')](function(){_0x2bd4e7['status'](0xcc)[_0x8e4b('0x21')]();});}};}function handleEntityNotFound(_0x2b29a4,_0xbd7008){return function(_0x376202){if(!_0x376202){_0x2b29a4[_0x8e4b('0x15')](0x194);}return _0x376202;};}function handleError(_0x43a92d,_0x535f71){_0x535f71=_0x535f71||0x1f4;return function(_0x395927){logger['error'](_0x395927['stack']);if(_0x395927[_0x8e4b('0x22')]){delete _0x395927[_0x8e4b('0x22')];}_0x43a92d['status'](_0x535f71)[_0x8e4b('0x23')](_0x395927);};}exports['show']=function(_0x6d7fbd,_0x5c5c34){var _0x2fd8da={'raw':!![],'where':{'id':_0x6d7fbd[_0x8e4b('0x24')]['id']}},_0xe991c2={};_0xe991c2[_0x8e4b('0x25')]=_[_0x8e4b('0x26')](db[_0x8e4b('0x27')][_0x8e4b('0x28')]);_0xe991c2[_0x8e4b('0x29')]=_['keys'](_0x6d7fbd['query']);_0xe991c2[_0x8e4b('0x2a')]=_[_0x8e4b('0x2b')](_0xe991c2[_0x8e4b('0x25')],_0xe991c2[_0x8e4b('0x29')]);_0x2fd8da[_0x8e4b('0x2c')]=_[_0x8e4b('0x2b')](_0xe991c2[_0x8e4b('0x25')],qs[_0x8e4b('0x2d')](_0x6d7fbd['query'][_0x8e4b('0x2d')]));_0x2fd8da[_0x8e4b('0x2c')]=_0x2fd8da[_0x8e4b('0x2c')][_0x8e4b('0x2e')]?_0x2fd8da[_0x8e4b('0x2c')]:_0xe991c2['model'];if(_0x6d7fbd[_0x8e4b('0x29')][_0x8e4b('0x2f')]){_0x2fd8da[_0x8e4b('0x30')]=[{'all':!![]}];}_0x2fd8da=_[_0x8e4b('0x31')]({},_0x2fd8da,_0x6d7fbd[_0x8e4b('0x32')]);return db[_0x8e4b('0x27')][_0x8e4b('0x33')](_0x2fd8da)[_0x8e4b('0x1f')](handleEntityNotFound(_0x5c5c34,null))['then'](respondWithResult(_0x5c5c34,null))[_0x8e4b('0x34')](handleError(_0x5c5c34,null));};exports[_0x8e4b('0x35')]=function(_0x1451ed,_0xe5eecf){return db[_0x8e4b('0x27')][_0x8e4b('0x35')](_0x1451ed[_0x8e4b('0x36')],{})[_0x8e4b('0x1f')](respondWithResult(_0xe5eecf,0xc9))[_0x8e4b('0x34')](handleError(_0xe5eecf,null));};exports[_0x8e4b('0x1e')]=function(_0x29c967,_0xe9e112){if(_0x29c967[_0x8e4b('0x36')]['id']){delete _0x29c967['body']['id'];}return db[_0x8e4b('0x27')]['find']({'where':{'id':_0x29c967[_0x8e4b('0x24')]['id']}})[_0x8e4b('0x1f')](handleEntityNotFound(_0xe9e112,null))['then'](saveUpdates(_0x29c967[_0x8e4b('0x36')],null))['then'](respondWithResult(_0xe9e112,null))[_0x8e4b('0x34')](handleError(_0xe9e112,null));};exports[_0x8e4b('0x20')]=function(_0xd466d,_0x15a82f){return db[_0x8e4b('0x27')]['find']({'where':{'id':_0xd466d['params']['id']}})[_0x8e4b('0x1f')](handleEntityNotFound(_0x15a82f,null))[_0x8e4b('0x1f')](removeEntity(_0x15a82f,null))[_0x8e4b('0x34')](handleError(_0x15a82f,null));}; \ No newline at end of file +var _0x864a=['set','Content-Range','reject','update','then','destroy','stack','name','send','model','ChatProactiveAction','rawAttributes','keys','query','filters','attributes','intersection','fields','length','includeAll','options','find','create','body','catch','params','eml-format','rimraf','zip-dir','fast-json-patch','mustache','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','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','limit','count'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x864a,0x8a));var _0xa864=function(_0x167c6e,_0x4d5a47){_0x167c6e=_0x167c6e-0x0;var _0x4745d8=_0x864a[_0x167c6e];return _0x4745d8;};'use strict';var emlformat=require(_0xa864('0x0'));var rimraf=require(_0xa864('0x1'));var zipdir=require(_0xa864('0x2'));var jsonpatch=require(_0xa864('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa864('0x4'));var util=require('util');var path=require('path');var sox=require(_0xa864('0x5'));var csv=require(_0xa864('0x6'));var ejs=require(_0xa864('0x7'));var fs=require('fs');var fs_extra=require(_0xa864('0x8'));var _=require(_0xa864('0x9'));var squel=require('squel');var crypto=require(_0xa864('0xa'));var jsforce=require(_0xa864('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xa864('0x6'));var querystring=require(_0xa864('0xc'));var Papa=require(_0xa864('0xd'));var Redis=require(_0xa864('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa864('0xf'));var hardwareService=require(_0xa864('0x10'));var logger=require(_0xa864('0x11'))(_0xa864('0x12'));var utils=require(_0xa864('0x13'));var config=require(_0xa864('0x14'));var licenseUtil=require(_0xa864('0x15'));var db=require(_0xa864('0x16'))['db'];function respondWithStatusCode(_0x44a6b7,_0x1c4242){_0x1c4242=_0x1c4242||0xcc;return function(_0x5f3cc2){if(_0x5f3cc2){return _0x44a6b7[_0xa864('0x17')](_0x1c4242);}return _0x44a6b7[_0xa864('0x18')](_0x1c4242)['end']();};}function respondWithResult(_0x9e3d5a,_0x6e0430){_0x6e0430=_0x6e0430||0xc8;return function(_0x2d82d1){if(_0x2d82d1){return _0x9e3d5a[_0xa864('0x18')](_0x6e0430)[_0xa864('0x19')](_0x2d82d1);}};}function respondWithFilteredResult(_0x2aeed5,_0x4a3055){return function(_0x43a1f7){if(_0x43a1f7){var _0x212513=typeof _0x4a3055[_0xa864('0x1a')]===_0xa864('0x1b')&&typeof _0x4a3055[_0xa864('0x1c')]===_0xa864('0x1b');var _0x2e8336=_0x43a1f7[_0xa864('0x1d')];var _0x5e7d59=_0x212513?0x0:_0x4a3055[_0xa864('0x1a')];var _0x40cc6a=_0x212513?_0x43a1f7['count']:_0x4a3055[_0xa864('0x1a')]+_0x4a3055[_0xa864('0x1c')];var _0x1b3941;if(_0x40cc6a>=_0x2e8336){_0x40cc6a=_0x2e8336;_0x1b3941=0xc8;}else{_0x1b3941=0xce;}_0x2aeed5[_0xa864('0x18')](_0x1b3941);return _0x2aeed5[_0xa864('0x1e')](_0xa864('0x1f'),_0x5e7d59+'-'+_0x40cc6a+'/'+_0x2e8336)[_0xa864('0x19')](_0x43a1f7);}return null;};}function patchUpdates(_0x91b2dc){return function(_0x7e9cab){try{jsonpatch['apply'](_0x7e9cab,_0x91b2dc,!![]);}catch(_0xc4c6ce){return BPromise[_0xa864('0x20')](_0xc4c6ce);}return _0x7e9cab['save']();};}function saveUpdates(_0x14873a,_0x37dc42){return function(_0x31d019){if(_0x31d019){return _0x31d019[_0xa864('0x21')](_0x14873a)[_0xa864('0x22')](function(_0x3b6bd5){return _0x3b6bd5;});}return null;};}function removeEntity(_0x452be5,_0x544415){return function(_0x282b12){if(_0x282b12){return _0x282b12[_0xa864('0x23')]()['then'](function(){_0x452be5[_0xa864('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f2068,_0x7beb66){return function(_0x2e7123){if(!_0x2e7123){_0x3f2068['sendStatus'](0x194);}return _0x2e7123;};}function handleError(_0x4ec4e4,_0xa77740){_0xa77740=_0xa77740||0x1f4;return function(_0x474872){logger['error'](_0x474872[_0xa864('0x24')]);if(_0x474872[_0xa864('0x25')]){delete _0x474872[_0xa864('0x25')];}_0x4ec4e4[_0xa864('0x18')](_0xa77740)[_0xa864('0x26')](_0x474872);};}exports['show']=function(_0x4235e8,_0x1b3e9f){var _0x4e519b={'raw':!![],'where':{'id':_0x4235e8['params']['id']}},_0x18da54={};_0x18da54[_0xa864('0x27')]=_['keys'](db[_0xa864('0x28')][_0xa864('0x29')]);_0x18da54['query']=_[_0xa864('0x2a')](_0x4235e8[_0xa864('0x2b')]);_0x18da54[_0xa864('0x2c')]=_['intersection'](_0x18da54[_0xa864('0x27')],_0x18da54['query']);_0x4e519b[_0xa864('0x2d')]=_[_0xa864('0x2e')](_0x18da54[_0xa864('0x27')],qs['fields'](_0x4235e8[_0xa864('0x2b')][_0xa864('0x2f')]));_0x4e519b['attributes']=_0x4e519b['attributes'][_0xa864('0x30')]?_0x4e519b[_0xa864('0x2d')]:_0x18da54['model'];if(_0x4235e8[_0xa864('0x2b')][_0xa864('0x31')]){_0x4e519b['include']=[{'all':!![]}];}_0x4e519b=_['merge']({},_0x4e519b,_0x4235e8[_0xa864('0x32')]);return db[_0xa864('0x28')][_0xa864('0x33')](_0x4e519b)[_0xa864('0x22')](handleEntityNotFound(_0x1b3e9f,null))[_0xa864('0x22')](respondWithResult(_0x1b3e9f,null))['catch'](handleError(_0x1b3e9f,null));};exports[_0xa864('0x34')]=function(_0x23b518,_0x59b186){return db['ChatProactiveAction']['create'](_0x23b518[_0xa864('0x35')],{})[_0xa864('0x22')](respondWithResult(_0x59b186,0xc9))[_0xa864('0x36')](handleError(_0x59b186,null));};exports['update']=function(_0x319842,_0x2bfcdc){if(_0x319842['body']['id']){delete _0x319842['body']['id'];}return db[_0xa864('0x28')][_0xa864('0x33')]({'where':{'id':_0x319842[_0xa864('0x37')]['id']}})[_0xa864('0x22')](handleEntityNotFound(_0x2bfcdc,null))[_0xa864('0x22')](saveUpdates(_0x319842[_0xa864('0x35')],null))[_0xa864('0x22')](respondWithResult(_0x2bfcdc,null))[_0xa864('0x36')](handleError(_0x2bfcdc,null));};exports[_0xa864('0x23')]=function(_0x136185,_0x9cba3b){return db[_0xa864('0x28')][_0xa864('0x33')]({'where':{'id':_0x136185[_0xa864('0x37')]['id']}})[_0xa864('0x22')](handleEntityNotFound(_0x9cba3b,null))['then'](removeEntity(_0x9cba3b,null))['catch'](handleError(_0x9cba3b,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 2d69ef6..86a6163 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 _0x67ef=['./chatProactiveAction.attributes','exports','lodash','util','api','bluebird','request-promise','path','rimraf'];(function(_0x19c57a,_0x5c9c7c){var _0x576a08=function(_0x929c62){while(--_0x929c62){_0x19c57a['push'](_0x19c57a['shift']());}};_0x576a08(++_0x5c9c7c);}(_0x67ef,0x158));var _0xf67e=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0x67ef[_0x5f3f88];return _0xd08119;};'use strict';var _=require(_0xf67e('0x0'));var util=require(_0xf67e('0x1'));var logger=require('../../config/logger')(_0xf67e('0x2'));var moment=require('moment');var BPromise=require(_0xf67e('0x3'));var rp=require(_0xf67e('0x4'));var fs=require('fs');var path=require(_0xf67e('0x5'));var rimraf=require(_0xf67e('0x6'));var config=require('../../config/environment');var attributes=require(_0xf67e('0x7'));module[_0xf67e('0x8')]=function(_0x575044,_0x585639){return _0x575044['define']('ChatProactiveAction',attributes,{'tableName':'chat_proactive_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7753=['ChatProactiveAction','chat_proactive_actions','lodash','util','moment','bluebird','rimraf','../../config/environment','exports','define'];(function(_0x42184d,_0x264f92){var _0x144722=function(_0x4926d8){while(--_0x4926d8){_0x42184d['push'](_0x42184d['shift']());}};_0x144722(++_0x264f92);}(_0x7753,0x17e));var _0x3775=function(_0xd7b0a4,_0x53c7d3){_0xd7b0a4=_0xd7b0a4-0x0;var _0x184e9e=_0x7753[_0xd7b0a4];return _0x184e9e;};'use strict';var _=require(_0x3775('0x0'));var util=require(_0x3775('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x3775('0x2'));var BPromise=require(_0x3775('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3775('0x4'));var config=require(_0x3775('0x5'));var attributes=require('./chatProactiveAction.attributes');module[_0x3775('0x6')]=function(_0x4e81db,_0x542e1b){return _0x4e81db[_0x3775('0x7')](_0x3775('0x8'),attributes,{'tableName':_0x3775('0x9'),'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 37839b9..6b7343f 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 _0xd509=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','moment'];(function(_0x5a51e2,_0x4d3194){var _0x5549b8=function(_0x365dff){while(--_0x365dff){_0x5a51e2['push'](_0x5a51e2['shift']());}};_0x5549b8(++_0x4d3194);}(_0xd509,0x19c));var _0x9d50=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd509[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9d50('0x0'));var util=require('util');var moment=require(_0x9d50('0x1'));var BPromise=require(_0x9d50('0x2'));var rs=require(_0x9d50('0x3'));var fs=require('fs');var Redis=require(_0x9d50('0x4'));var db=require(_0x9d50('0x5'))['db'];var utils=require(_0x9d50('0x6'));var logger=require(_0x9d50('0x7'))(_0x9d50('0x8'));var config=require(_0x9d50('0x9'));var jayson=require(_0x9d50('0xa'));var client=jayson[_0x9d50('0xb')][_0x9d50('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2dc95c,_0x3b2776,_0x56c5d5){return new BPromise(function(_0x22c3c5,_0x349002){return client[_0x9d50('0xd')](_0x2dc95c,_0x56c5d5)['then'](function(_0x42a2b7){logger[_0x9d50('0xe')](_0x9d50('0xf'),_0x3b2776,_0x9d50('0x10'));logger[_0x9d50('0x11')](_0x9d50('0x12'),_0x3b2776,_0x9d50('0x10'),JSON['stringify'](_0x42a2b7));if(_0x42a2b7['error']){if(_0x42a2b7[_0x9d50('0x13')][_0x9d50('0x14')]===0x1f4){logger[_0x9d50('0x13')](_0x9d50('0xf'),_0x3b2776,_0x42a2b7[_0x9d50('0x13')][_0x9d50('0x15')]);return _0x349002(_0x42a2b7[_0x9d50('0x13')][_0x9d50('0x15')]);}logger[_0x9d50('0x13')]('ChatProactiveAction,\x20%s,\x20%s',_0x3b2776,_0x42a2b7[_0x9d50('0x13')][_0x9d50('0x15')]);return _0x22c3c5(_0x42a2b7[_0x9d50('0x13')][_0x9d50('0x15')]);}else{logger['info'](_0x9d50('0xf'),_0x3b2776,'request\x20sent');_0x22c3c5(_0x42a2b7[_0x9d50('0x16')][_0x9d50('0x15')]);}})['catch'](function(_0x6405ef){logger[_0x9d50('0x13')](_0x9d50('0xf'),_0x3b2776,_0x6405ef);_0x349002(_0x6405ef);});});} \ No newline at end of file +var _0x60ab=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x111452,_0x2aae91){var _0x3a9588=function(_0x2ac7e3){while(--_0x2ac7e3){_0x111452['push'](_0x111452['shift']());}};_0x3a9588(++_0x2aae91);}(_0x60ab,0x72));var _0xb60a=function(_0x35b18a,_0x6b2fbe){_0x35b18a=_0x35b18a-0x0;var _0x4db1bd=_0x60ab[_0x35b18a];return _0x4db1bd;};'use strict';var _=require('lodash');var util=require(_0xb60a('0x0'));var moment=require(_0xb60a('0x1'));var BPromise=require(_0xb60a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb60a('0x3'));var db=require(_0xb60a('0x4'))['db'];var utils=require(_0xb60a('0x5'));var logger=require(_0xb60a('0x6'))(_0xb60a('0x7'));var config=require(_0xb60a('0x8'));var jayson=require(_0xb60a('0x9'));var client=jayson[_0xb60a('0xa')][_0xb60a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x56c70f,_0x5ec31b,_0x5877f4){return new BPromise(function(_0x25bdea,_0xe4327a){return client[_0xb60a('0xc')](_0x56c70f,_0x5877f4)[_0xb60a('0xd')](function(_0x420193){logger[_0xb60a('0xe')](_0xb60a('0xf'),_0x5ec31b,_0xb60a('0x10'));logger[_0xb60a('0x11')](_0xb60a('0x12'),_0x5ec31b,_0xb60a('0x10'),JSON['stringify'](_0x420193));if(_0x420193[_0xb60a('0x13')]){if(_0x420193[_0xb60a('0x13')][_0xb60a('0x14')]===0x1f4){logger[_0xb60a('0x13')](_0xb60a('0xf'),_0x5ec31b,_0x420193[_0xb60a('0x13')][_0xb60a('0x15')]);return _0xe4327a(_0x420193[_0xb60a('0x13')][_0xb60a('0x15')]);}logger['error'](_0xb60a('0xf'),_0x5ec31b,_0x420193[_0xb60a('0x13')][_0xb60a('0x15')]);return _0x25bdea(_0x420193[_0xb60a('0x13')][_0xb60a('0x15')]);}else{logger[_0xb60a('0xe')](_0xb60a('0xf'),_0x5ec31b,_0xb60a('0x10'));_0x25bdea(_0x420193[_0xb60a('0x16')][_0xb60a('0x15')]);}})[_0xb60a('0x17')](function(_0x22f723){logger[_0xb60a('0x13')](_0xb60a('0xf'),_0x5ec31b,_0x22f723);_0xe4327a(_0x22f723);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 57ddb96..934f711 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 _0xf494=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated','show','create','put','update','delete','exports','multer','util'];(function(_0x5f02a6,_0x2ecf26){var _0x2a0b8f=function(_0x5bb998){while(--_0x5bb998){_0x5f02a6['push'](_0x5f02a6['shift']());}};_0x2a0b8f(++_0x2ecf26);}(_0xf494,0x1c6));var _0x4f49=function(_0x3a6c70,_0x637f13){_0x3a6c70=_0x3a6c70-0x0;var _0xe51d3b=_0xf494[_0x3a6c70];return _0xe51d3b;};'use strict';var multer=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var path=require(_0x4f49('0x2'));var timeout=require('connect-timeout');var express=require(_0x4f49('0x3'));var router=express[_0x4f49('0x4')]();var fs_extra=require(_0x4f49('0x5'));var auth=require(_0x4f49('0x6'));var interaction=require(_0x4f49('0x7'));var config=require(_0x4f49('0x8'));var controller=require(_0x4f49('0x9'));router[_0x4f49('0xa')](_0x4f49('0xb'),auth[_0x4f49('0xc')](),controller[_0x4f49('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x4f49('0xe')]);router[_0x4f49('0xf')](_0x4f49('0xb'),auth[_0x4f49('0xc')](),controller[_0x4f49('0x10')]);router[_0x4f49('0x11')](_0x4f49('0xb'),auth[_0x4f49('0xc')](),controller['destroy']);module[_0x4f49('0x12')]=router; \ No newline at end of file +var _0x7da7=['util','path','Router','fs-extra','../../components/interaction/service','../../config/environment','get','/:id','show','isAuthenticated','create','put','delete','exports','multer'];(function(_0x295314,_0x17b250){var _0x584b0c=function(_0x51cc84){while(--_0x51cc84){_0x295314['push'](_0x295314['shift']());}};_0x584b0c(++_0x17b250);}(_0x7da7,0x10d));var _0x77da=function(_0x2fe689,_0x5794e5){_0x2fe689=_0x2fe689-0x0;var _0x35ea44=_0x7da7[_0x2fe689];return _0x35ea44;};'use strict';var multer=require(_0x77da('0x0'));var util=require(_0x77da('0x1'));var path=require(_0x77da('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x77da('0x3')]();var fs_extra=require(_0x77da('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x77da('0x5'));var config=require(_0x77da('0x6'));var controller=require('./chatProactiveAction.controller');router[_0x77da('0x7')](_0x77da('0x8'),auth['isAuthenticated'](),controller[_0x77da('0x9')]);router['post']('/',auth[_0x77da('0xa')](),controller[_0x77da('0xb')]);router[_0x77da('0xc')](_0x77da('0x8'),auth[_0x77da('0xa')](),controller['update']);router[_0x77da('0xd')](_0x77da('0x8'),auth[_0x77da('0xa')](),controller['destroy']);module[_0x77da('0xe')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 0567bd3..6ca7f31 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 _0x2857=['name','rrmemory','beepall','roundrobin','STRING'];(function(_0x2c21ab,_0x4b295c){var _0x37c8a0=function(_0x1ba4e8){while(--_0x1ba4e8){_0x2c21ab['push'](_0x2c21ab['shift']());}};_0x37c8a0(++_0x4b295c);}(_0x2857,0x126));var _0x7285=function(_0x57d4b2,_0x43236a){_0x57d4b2=_0x57d4b2-0x0;var _0x57fc1c=_0x2857[_0x57d4b2];return _0x57fc1c;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x7285('0x0')],'unique':_0x7285('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x7285('0x0')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x7285('0x2'),_0x7285('0x3'),_0x7285('0x4'))}}; \ No newline at end of file +var _0x6804=['STRING','name','INTEGER','ENUM','rrmemory','beepall','sequelize','exports'];(function(_0x1c928a,_0x4d73db){var _0x21de33=function(_0x382b56){while(--_0x382b56){_0x1c928a['push'](_0x1c928a['shift']());}};_0x21de33(++_0x4d73db);}(_0x6804,0x146));var _0x4680=function(_0x43358b,_0x3d6868){_0x43358b=_0x43358b-0x0;var _0x642efd=_0x6804[_0x43358b];return _0x642efd;};'use strict';var Sequelize=require(_0x4680('0x0'));module[_0x4680('0x1')]={'name':{'type':Sequelize[_0x4680('0x2')],'unique':_0x4680('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x4680('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x4680('0x5')](_0x4680('0x6'),_0x4680('0x7'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index c6ea1a7..a6a7155 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 _0xd6db=['getAgents','util','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','set','update','then','destroy','get','ChatQueues','name','send','index','map','ChatQueue','rawAttributes','fieldName','type','key','getOptions','where','count','include','query','findAll','rows','catch','show','params','model','keys','filters','intersection','fields','attributes','length','includeAll','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserChatQueue','hasOwnProperty','nolimit','order','sort','pick','ChatQueueId','filter','User','agent','chatPause','updatedAt','createdAt','format','SIP','Team','merge','addTeams','ids','voicePause','interface','flatMap','Agents','sequelize','transaction','each','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','select','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','compact','value','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit','spread'];(function(_0x5618dc,_0x2200dc){var _0x14ac2f=function(_0x300f6f){while(--_0x300f6f){_0x5618dc['push'](_0x5618dc['shift']());}};_0x14ac2f(++_0x2200dc);}(_0xd6db,0x178));var _0xbd6d=function(_0x18e427,_0x98940e){_0x18e427=_0x18e427-0x0;var _0xeeec86=_0xd6db[_0x18e427];return _0xeeec86;};'use strict';var BPromise=require('bluebird');var util=require(_0xbd6d('0x0'));var _=require('lodash');var squel=require('squel');var Redis=require(_0xbd6d('0x1'));var qs=require(_0xbd6d('0x2'));var logger=require(_0xbd6d('0x3'))(_0xbd6d('0x4'));var config=require(_0xbd6d('0x5'));var db=require(_0xbd6d('0x6'))['db'];config[_0xbd6d('0x7')]=_[_0xbd6d('0x8')](config['redis'],{'host':_0xbd6d('0x9'),'port':0x18eb});var socket=require(_0xbd6d('0xa'))(new Redis(config['redis']));require(_0xbd6d('0xb'))[_0xbd6d('0xc')](socket);function respondWithStatusCode(_0x52b080,_0x2f9f4e){_0x2f9f4e=_0x2f9f4e||0xcc;return function(_0x103220){if(_0x103220){return _0x52b080[_0xbd6d('0xd')](_0x2f9f4e);}return _0x52b080[_0xbd6d('0xe')](_0x2f9f4e)[_0xbd6d('0xf')]();};}function respondWithResult(_0x1d5c12,_0x269c19){_0x269c19=_0x269c19||0xc8;return function(_0xf9830){if(_0xf9830){return _0x1d5c12['status'](_0x269c19)[_0xbd6d('0x10')](_0xf9830);}};}function respondWithFilteredResult(_0x393793,_0x427a70){return function(_0x5c6685){if(_0x5c6685){var _0x4cc96a=typeof _0x427a70[_0xbd6d('0x11')]===_0xbd6d('0x12')&&typeof _0x427a70[_0xbd6d('0x13')]===_0xbd6d('0x12');var _0x3f31a2=_0x5c6685['count'];var _0x3b7cb4=_0x4cc96a?0x0:_0x427a70[_0xbd6d('0x11')];var _0xe60d5e=_0x4cc96a?_0x5c6685['count']:_0x427a70[_0xbd6d('0x11')]+_0x427a70[_0xbd6d('0x13')];var _0x2106f4;if(_0xe60d5e>=_0x3f31a2){_0xe60d5e=_0x3f31a2;_0x2106f4=0xc8;}else{_0x2106f4=0xce;}_0x393793[_0xbd6d('0xe')](_0x2106f4);return _0x393793[_0xbd6d('0x14')]('Content-Range',_0x3b7cb4+'-'+_0xe60d5e+'/'+_0x3f31a2)[_0xbd6d('0x10')](_0x5c6685);}return null;};}function saveUpdates(_0x5f3edf){return function(_0x122112){if(_0x122112){return _0x122112[_0xbd6d('0x15')](_0x5f3edf)[_0xbd6d('0x16')](function(_0xb6a1e8){return _0xb6a1e8;});}return null;};}function removeEntity(_0x24972f){return function(_0x62f0){if(_0x62f0){return _0x62f0[_0xbd6d('0x17')]()[_0xbd6d('0x16')](function(){var _0x361f03=_0x62f0[_0xbd6d('0x18')]({'plain':!![]});var _0x2afb16=_0xbd6d('0x19');return db['UserProfileResource'][_0xbd6d('0x17')]({'where':{'type':_0x2afb16,'resourceId':_0x361f03['id']}})[_0xbd6d('0x16')](function(){return _0x62f0;});})[_0xbd6d('0x16')](function(){_0x24972f[_0xbd6d('0xe')](0xcc)['end']();});}};}function handleEntityNotFound(_0x171f43){return function(_0x4aba28){if(!_0x4aba28){_0x171f43['sendStatus'](0x194);}return _0x4aba28;};}function handleError(_0xfe1fc6,_0x35c19d){_0x35c19d=_0x35c19d||0x1f4;return function(_0x1e8c0e){logger['error'](_0x1e8c0e['stack']);if(_0x1e8c0e[_0xbd6d('0x1a')]){delete _0x1e8c0e[_0xbd6d('0x1a')];}_0xfe1fc6[_0xbd6d('0xe')](_0x35c19d)[_0xbd6d('0x1b')](_0x1e8c0e);};}exports[_0xbd6d('0x1c')]=function(_0x2aea5c,_0x460f18){var _0x4656fd={};var _0x547381={'count':0x0,'rows':[]};var _0x325096=_[_0xbd6d('0x1d')](db[_0xbd6d('0x1e')][_0xbd6d('0x1f')],function(_0x15aaf4){return{'name':_0x15aaf4[_0xbd6d('0x20')],'type':_0x15aaf4[_0xbd6d('0x21')][_0xbd6d('0x22')]};});_0x4656fd=qs[_0xbd6d('0x23')](_0x325096,_0x2aea5c);var _0x12bef8={'where':_0x4656fd[_0xbd6d('0x24')]};return db[_0xbd6d('0x1e')][_0xbd6d('0x25')](_0x12bef8)['then'](function(_0xfaf7d2){_0x547381['count']=_0xfaf7d2;_0x4656fd['include']=qs[_0xbd6d('0x26')](_0x2aea5c[_0xbd6d('0x27')]);return db[_0xbd6d('0x1e')][_0xbd6d('0x28')](_0x4656fd);})[_0xbd6d('0x16')](function(_0x3de84c){_0x547381[_0xbd6d('0x29')]=_0x3de84c;return _0x547381;})[_0xbd6d('0x16')](respondWithFilteredResult(_0x460f18,_0x4656fd))[_0xbd6d('0x2a')](handleError(_0x460f18,null));};exports[_0xbd6d('0x2b')]=function(_0xa3d365,_0x27f602){var _0x4e5366={'raw':!![],'where':{'id':_0xa3d365[_0xbd6d('0x2c')]['id']}},_0x535715={};_0x535715[_0xbd6d('0x2d')]=_[_0xbd6d('0x2e')](db[_0xbd6d('0x1e')][_0xbd6d('0x1f')]);_0x535715[_0xbd6d('0x27')]=_[_0xbd6d('0x2e')](_0xa3d365[_0xbd6d('0x27')]);_0x535715[_0xbd6d('0x2f')]=_['intersection'](_0x535715[_0xbd6d('0x2d')],_0x535715['query']);_0x4e5366['attributes']=_[_0xbd6d('0x30')](_0x535715[_0xbd6d('0x2d')],qs[_0xbd6d('0x31')](_0xa3d365[_0xbd6d('0x27')]['fields']));_0x4e5366[_0xbd6d('0x32')]=_0x4e5366[_0xbd6d('0x32')][_0xbd6d('0x33')]?_0x4e5366['attributes']:_0x535715[_0xbd6d('0x2d')];if(_0xa3d365[_0xbd6d('0x27')][_0xbd6d('0x34')]){_0x4e5366[_0xbd6d('0x26')]=[{'all':!![]}];}_0x4e5366=_['merge']({},_0x4e5366,_0xa3d365[_0xbd6d('0x35')]);return db['ChatQueue'][_0xbd6d('0x36')](_0x4e5366)[_0xbd6d('0x16')](handleEntityNotFound(_0x27f602,null))[_0xbd6d('0x16')](respondWithResult(_0x27f602,null))[_0xbd6d('0x2a')](handleError(_0x27f602,null));};exports[_0xbd6d('0x37')]=function(_0x1a87dc,_0x35f9ee){return db[_0xbd6d('0x1e')][_0xbd6d('0x37')](_0x1a87dc[_0xbd6d('0x38')],{})[_0xbd6d('0x16')](function(_0x3cfa57){var _0x3679d1=_0x1a87dc['user'][_0xbd6d('0x18')]({'plain':!![]});if(!_0x3679d1)throw new Error(_0xbd6d('0x39'));if(_0x3679d1['role']==='user'){var _0x3f5ac5=_0x3cfa57['get']({'plain':!![]});var _0x2e721d=_0xbd6d('0x19');return db[_0xbd6d('0x3a')][_0xbd6d('0x36')]({'where':{'name':_0x2e721d,'userProfileId':_0x3679d1[_0xbd6d('0x3b')]},'raw':!![]})[_0xbd6d('0x16')](function(_0x154a76){if(_0x154a76&&_0x154a76[_0xbd6d('0x3c')]===0x0){return db[_0xbd6d('0x3d')][_0xbd6d('0x37')]({'name':_0x3f5ac5[_0xbd6d('0x1a')],'resourceId':_0x3f5ac5['id'],'type':_0x154a76[_0xbd6d('0x1a')],'sectionId':_0x154a76['id']},{})['then'](function(){return _0x3cfa57;});}else{return _0x3cfa57;}})[_0xbd6d('0x2a')](function(_0x5effae){logger[_0xbd6d('0x3e')](_0xbd6d('0x3f'),_0x5effae);throw _0x5effae;});}return _0x3cfa57;})[_0xbd6d('0x16')](respondWithResult(_0x35f9ee,0xc9))[_0xbd6d('0x2a')](handleError(_0x35f9ee,null));};exports[_0xbd6d('0x15')]=function(_0x4175b2,_0x511289){if(_0x4175b2['body']['id']){delete _0x4175b2[_0xbd6d('0x38')]['id'];}return db[_0xbd6d('0x1e')][_0xbd6d('0x36')]({'where':{'id':_0x4175b2[_0xbd6d('0x2c')]['id']}})[_0xbd6d('0x16')](handleEntityNotFound(_0x511289,null))[_0xbd6d('0x16')](saveUpdates(_0x4175b2['body'],null))[_0xbd6d('0x16')](respondWithResult(_0x511289,null))[_0xbd6d('0x2a')](handleError(_0x511289,null));};exports[_0xbd6d('0x17')]=function(_0x2efa01,_0x53c968){return db[_0xbd6d('0x1e')][_0xbd6d('0x36')]({'where':{'id':_0x2efa01[_0xbd6d('0x2c')]['id']}})[_0xbd6d('0x16')](handleEntityNotFound(_0x53c968,null))[_0xbd6d('0x16')](removeEntity(_0x53c968,null))['catch'](handleError(_0x53c968,null));};exports['describe']=function(_0x50a8ff,_0x5e0ca8){return db['ChatQueue'][_0xbd6d('0x40')]()[_0xbd6d('0x16')](respondWithResult(_0x5e0ca8,null))[_0xbd6d('0x2a')](handleError(_0x5e0ca8,null));};exports[_0xbd6d('0x41')]=function(_0x3f5538,_0x3c95bc){var _0x3d70f8={'raw':!![],'where':{}},_0x1e47d1={},_0xd03576;return db[_0xbd6d('0x1e')][_0xbd6d('0x42')]({'where':{'id':_0x3f5538[_0xbd6d('0x2c')]['id']}})[_0xbd6d('0x16')](handleEntityNotFound(_0x3c95bc,null))[_0xbd6d('0x16')](function(_0x2901a8){if(_0x2901a8){_0xd03576=_0x2901a8[_0xbd6d('0x18')]({'plain':!![]});_0x1e47d1[_0xbd6d('0x2d')]=_['keys'](db[_0xbd6d('0x43')][_0xbd6d('0x1f')]);_0x1e47d1['query']=_[_0xbd6d('0x2e')](_0x3f5538['query']);_0x1e47d1[_0xbd6d('0x2f')]=_['intersection'](_0x1e47d1[_0xbd6d('0x2d')],_0x1e47d1[_0xbd6d('0x27')]);_0x3d70f8[_0xbd6d('0x32')]=_[_0xbd6d('0x30')](_0x1e47d1['model'],qs[_0xbd6d('0x31')](_0x3f5538['query'][_0xbd6d('0x31')]));_0x3d70f8[_0xbd6d('0x32')]=_0x3d70f8[_0xbd6d('0x32')][_0xbd6d('0x33')]?_0x3d70f8['attributes']:_0x1e47d1['model'];if(!_0x3f5538[_0xbd6d('0x27')][_0xbd6d('0x44')](_0xbd6d('0x45'))){_0x3d70f8[_0xbd6d('0x13')]=qs[_0xbd6d('0x13')](_0x3f5538[_0xbd6d('0x27')][_0xbd6d('0x13')]);_0x3d70f8[_0xbd6d('0x11')]=qs[_0xbd6d('0x11')](_0x3f5538[_0xbd6d('0x27')][_0xbd6d('0x11')]);}_0x3d70f8[_0xbd6d('0x46')]=qs[_0xbd6d('0x47')](_0x3f5538[_0xbd6d('0x27')]['sort']);_0x3d70f8['where']=qs['filters'](_[_0xbd6d('0x48')](_0x3f5538[_0xbd6d('0x27')],_0x1e47d1[_0xbd6d('0x2f')]));_0x3d70f8[_0xbd6d('0x24')][_0xbd6d('0x49')]=_0x2901a8['id'];if(_0x3f5538[_0xbd6d('0x27')][_0xbd6d('0x4a')]){_0x3d70f8[_0xbd6d('0x24')]=_['merge'](_0x3d70f8[_0xbd6d('0x24')],{'$or':_['map'](_0x3d70f8[_0xbd6d('0x32')],function(_0x139931){var _0x563819={};_0x563819[_0x139931]={'$like':'%'+_0x3f5538[_0xbd6d('0x27')]['filter']+'%'};return _0x563819;})});}_0x3d70f8=_['merge']({},_0x3d70f8,_0x3f5538[_0xbd6d('0x35')]);return db[_0xbd6d('0x43')][_0xbd6d('0x28')](_0x3d70f8);}})['then'](function(_0x5d98ee){if(_0x5d98ee){return db[_0xbd6d('0x4b')]['findAndCountAll']({'where':{'id':_[_0xbd6d('0x1d')](_0x5d98ee,'UserId'),'role':_0xbd6d('0x4c')},'attributes':['id',_0xbd6d('0x1a'),_0xbd6d('0x4d'),_0xbd6d('0x4e'),_0xbd6d('0x4f')]});}})[_0xbd6d('0x16')](function(_0x3dcf04){if(_0x3dcf04){return{'count':_0x3dcf04['count'],'rows':_['map'](_0x3dcf04[_0xbd6d('0x29')],function(_0x580c15){return{'membername':_0x580c15['name'],'UserId':_0x580c15['id'],'queue_name':_0xd03576[_0xbd6d('0x1a')],'ChatQueueId':_0xd03576['id'],'interface':util[_0xbd6d('0x50')]('%s/%s',_0xbd6d('0x51'),_0x580c15['name']),'penalty':0x0,'paused':_0x580c15[_0xbd6d('0x4d')],'createdAt':_0x580c15[_0xbd6d('0x4f')],'updatedAt':_0x580c15[_0xbd6d('0x4e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xbd6d('0x16')](respondWithFilteredResult(_0x3c95bc,_0x3d70f8))[_0xbd6d('0x2a')](handleError(_0x3c95bc,null));};exports['getTeams']=function(_0x31845d,_0x1cb228){var _0x2b18fe={};var _0x3d16d8={};var _0x14b674;var _0x4eb6f4;return db[_0xbd6d('0x1e')][_0xbd6d('0x42')]({'where':{'id':_0x31845d[_0xbd6d('0x2c')]['id']}})[_0xbd6d('0x16')](handleEntityNotFound(_0x1cb228,null))[_0xbd6d('0x16')](function(_0x43ce5a){if(_0x43ce5a){_0x14b674=_0x43ce5a;_0x3d16d8[_0xbd6d('0x2d')]=_[_0xbd6d('0x2e')](db[_0xbd6d('0x52')][_0xbd6d('0x1f')]);_0x3d16d8[_0xbd6d('0x27')]=_[_0xbd6d('0x2e')](_0x31845d[_0xbd6d('0x27')]);_0x3d16d8[_0xbd6d('0x2f')]=_[_0xbd6d('0x30')](_0x3d16d8[_0xbd6d('0x2d')],_0x3d16d8[_0xbd6d('0x27')]);_0x2b18fe[_0xbd6d('0x32')]=_[_0xbd6d('0x30')](_0x3d16d8[_0xbd6d('0x2d')],qs[_0xbd6d('0x31')](_0x31845d[_0xbd6d('0x27')][_0xbd6d('0x31')]));_0x2b18fe['attributes']=_0x2b18fe['attributes'][_0xbd6d('0x33')]?_0x2b18fe[_0xbd6d('0x32')]:_0x3d16d8[_0xbd6d('0x2d')];_0x2b18fe[_0xbd6d('0x46')]=qs['sort'](_0x31845d[_0xbd6d('0x27')][_0xbd6d('0x47')]);_0x2b18fe[_0xbd6d('0x24')]=qs[_0xbd6d('0x2f')](_['pick'](_0x31845d['query'],_0x3d16d8[_0xbd6d('0x2f')]));if(_0x31845d[_0xbd6d('0x27')][_0xbd6d('0x4a')]){_0x2b18fe[_0xbd6d('0x24')]=_[_0xbd6d('0x53')](_0x2b18fe[_0xbd6d('0x24')],{'$or':_['map'](_0x2b18fe['attributes'],function(_0x1745fa){var _0xc4320b={};_0xc4320b[_0x1745fa]={'$like':'%'+_0x31845d[_0xbd6d('0x27')][_0xbd6d('0x4a')]+'%'};return _0xc4320b;})});}_0x2b18fe=_[_0xbd6d('0x53')]({},_0x2b18fe,_0x31845d[_0xbd6d('0x35')]);return _0x14b674['getTeams'](_0x2b18fe);}})[_0xbd6d('0x16')](function(_0x595321){if(_0x595321){_0x4eb6f4=_0x595321[_0xbd6d('0x33')];if(!_0x31845d['query'][_0xbd6d('0x44')](_0xbd6d('0x45'))){_0x2b18fe[_0xbd6d('0x13')]=qs[_0xbd6d('0x13')](_0x31845d[_0xbd6d('0x27')][_0xbd6d('0x13')]);_0x2b18fe['offset']=qs[_0xbd6d('0x11')](_0x31845d['query'][_0xbd6d('0x11')]);}return _0x14b674['getTeams'](_0x2b18fe);}})[_0xbd6d('0x16')](function(_0x192235){if(_0x192235){return _0x192235?{'count':_0x4eb6f4,'rows':_0x192235}:null;}})['then'](respondWithResult(_0x1cb228,null))[_0xbd6d('0x2a')](handleError(_0x1cb228,null));};exports[_0xbd6d('0x54')]=function(_0x1fcc63,_0x448765){var _0x25ee85=_0x1fcc63[_0xbd6d('0x38')][_0xbd6d('0x55')];return db[_0xbd6d('0x52')][_0xbd6d('0x28')]({'where':{'id':_0x25ee85},'attributes':['id'],'include':[{'model':db[_0xbd6d('0x4b')],'as':'Agents','attributes':['id',_0xbd6d('0x1a'),'online',_0xbd6d('0x56'),_0xbd6d('0x57')],'raw':!![]}]})[_0xbd6d('0x16')](function(_0x5cacd7){if(_0x5cacd7){var _0x3393b1=_[_0xbd6d('0x58')](_0x5cacd7,function(_0x524f44){var _0x57b814=_0x524f44[_0xbd6d('0x18')]({'plain':!![]});return _0x57b814[_0xbd6d('0x59')];});return db[_0xbd6d('0x1e')][_0xbd6d('0x36')]({'where':{'id':_0x1fcc63[_0xbd6d('0x2c')]['id']}})[_0xbd6d('0x16')](function(_0x532c43){return db[_0xbd6d('0x5a')][_0xbd6d('0x5b')](function(_0x12d8be){return _0x532c43[_0xbd6d('0x54')](_0x25ee85,{'transaction':_0x12d8be})['then'](function(){return BPromise[_0xbd6d('0x5c')](_0x3393b1,function(_0x333b2d){return db[_0xbd6d('0x43')][_0xbd6d('0x5d')]({'where':{'UserId':_0x333b2d['id'],'ChatQueueId':_0x1fcc63['params']['id']},'transaction':_0x12d8be});});})[_0xbd6d('0x16')](function(){_0x3393b1[_0xbd6d('0x5e')](function(_0x3e45d8){socket[_0xbd6d('0x5f')](_0xbd6d('0x60'),{'UserId':_0x3e45d8['id'],'ChatQueueId':_0x532c43['id']});});});});});}})[_0xbd6d('0x16')](respondWithStatusCode(_0x448765,null))[_0xbd6d('0x2a')](handleError(_0x448765,null));};exports[_0xbd6d('0x61')]=function(_0x4ba9ba,_0x2b782c){return db[_0xbd6d('0x52')][_0xbd6d('0x28')]({'where':{'id':_0x4ba9ba[_0xbd6d('0x27')][_0xbd6d('0x55')]},'attributes':['id'],'include':[{'model':db[_0xbd6d('0x4b')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xbd6d('0x16')](handleEntityNotFound(_0x2b782c,null))[_0xbd6d('0x16')](function(_0x3cd0d2){var _0x264cfd=_['map'](_0x3cd0d2,'id');var _0x14f28a=[];var _0x491947=[];var _0x3903e9=squel[_0xbd6d('0x62')]();_0x3903e9['field'](_0xbd6d('0x63'))[_0xbd6d('0x64')](_0xbd6d('0x65'),'tq')[_0xbd6d('0x66')](_0xbd6d('0x67'),'ut',_0xbd6d('0x68'))['where'](_0xbd6d('0x69'),_0x4ba9ba[_0xbd6d('0x2c')]['id']);for(var _0x1f16be=0x0;_0x1f16be<_0x3cd0d2[_0xbd6d('0x33')];_0x1f16be+=0x1){let _0x5494c7=_0x3cd0d2[_0x1f16be];for(var _0xd9a2f6=0x0;_0xd9a2f6<_0x5494c7['Agents'][_0xbd6d('0x33')];_0xd9a2f6+=0x1){let _0x464b41=_0x5494c7[_0xbd6d('0x59')][_0xd9a2f6];var _0x468797=_0x3903e9[_0xbd6d('0x6a')]();_0x468797[_0xbd6d('0x24')](_0xbd6d('0x6b'),_0x464b41['id']);_0x491947[_0xbd6d('0x6c')](db[_0xbd6d('0x5a')][_0xbd6d('0x27')](_0x468797[_0xbd6d('0x6d')](),{'type':db[_0xbd6d('0x5a')][_0xbd6d('0x6e')][_0xbd6d('0x6f')]})[_0xbd6d('0x16')](function(_0x521d73){if(_0x521d73[_0xbd6d('0x33')]===0x1){return _0x464b41['id'];}else{var _0x29ce34=_[_0xbd6d('0x70')](_[_0xbd6d('0x1d')](_0x521d73,_0xbd6d('0x71')),function(_0x2a4004){return _[_0xbd6d('0x72')](_0x264cfd,_0x2a4004);});if(_0x29ce34){return _0x464b41['id'];}}}));}}return BPromise[_0xbd6d('0x73')](_0x491947)['then'](function(_0x174981){_0x14f28a=_(_0x14f28a)['union'](_0x174981)[_0xbd6d('0x74')]()[_0xbd6d('0x75')]();return db[_0xbd6d('0x1e')][_0xbd6d('0x36')]({'where':{'id':_0x4ba9ba[_0xbd6d('0x2c')]['id']}})['then'](function(_0x30151d){return db[_0xbd6d('0x5a')][_0xbd6d('0x5b')](function(_0x184347){return _0x30151d[_0xbd6d('0x61')](_0x4ba9ba[_0xbd6d('0x27')]['ids'],{'transaction':_0x184347})[_0xbd6d('0x16')](function(){if(!_[_0xbd6d('0x76')](_0x14f28a)){return _0x30151d[_0xbd6d('0x77')](_0x14f28a,{'transaction':_0x184347});}})['then'](function(){_0x14f28a[_0xbd6d('0x5e')](function(_0x54d0ce){socket[_0xbd6d('0x5f')](_0xbd6d('0x78'),{'UserId':_0x54d0ce,'ChatQueueId':_0x30151d['id']});});});});});});})[_0xbd6d('0x16')](respondWithStatusCode(_0x2b782c,null))['catch'](handleError(_0x2b782c,null));};exports['addAgents']=function(_0x445d1c,_0x42603c){return db[_0xbd6d('0x1e')][_0xbd6d('0x36')]({'where':{'id':_0x445d1c[_0xbd6d('0x2c')]['id']}})['then'](handleEntityNotFound(_0x42603c,null))[_0xbd6d('0x16')](function(_0x55fb4d){if(_0x55fb4d){return _0x55fb4d[_0xbd6d('0x79')](_0x445d1c[_0xbd6d('0x38')][_0xbd6d('0x55')],_[_0xbd6d('0x7a')](_0x445d1c[_0xbd6d('0x38')],[_0xbd6d('0x55'),'id'])||{})[_0xbd6d('0x7b')](function(_0x966233){for(var _0x5d12aa=0x0;_0x5d12aa<_0x445d1c[_0xbd6d('0x38')][_0xbd6d('0x55')]['length'];_0x5d12aa+=0x1){socket[_0xbd6d('0x5f')]('userChatQueue:save',{'UserId':Number(_0x445d1c[_0xbd6d('0x38')][_0xbd6d('0x55')][_0x5d12aa]),'ChatQueueId':Number(_0x445d1c[_0xbd6d('0x2c')]['id'])});}return _0x966233;});}})['then'](respondWithResult(_0x42603c,null))['catch'](handleError(_0x42603c,null));};exports[_0xbd6d('0x77')]=function(_0x34923c,_0x17babd){return db[_0xbd6d('0x1e')][_0xbd6d('0x36')]({'where':{'id':_0x34923c[_0xbd6d('0x2c')]['id']}})[_0xbd6d('0x16')](handleEntityNotFound(_0x17babd,null))[_0xbd6d('0x16')](function(_0x1f9c29){if(_0x1f9c29){return _0x1f9c29[_0xbd6d('0x77')](_0x34923c[_0xbd6d('0x27')][_0xbd6d('0x55')])['then'](function(){if(_['isArray'](_0x34923c[_0xbd6d('0x27')]['ids'])){for(var _0x20db3b=0x0;_0x20db3b<_0x34923c[_0xbd6d('0x27')][_0xbd6d('0x55')][_0xbd6d('0x33')];_0x20db3b+=0x1){socket[_0xbd6d('0x5f')](_0xbd6d('0x78'),{'UserId':Number(_0x34923c[_0xbd6d('0x27')]['ids'][_0x20db3b]),'ChatQueueId':Number(_0x34923c[_0xbd6d('0x2c')]['id'])});}}else{socket[_0xbd6d('0x5f')](_0xbd6d('0x78'),{'UserId':Number(_0x34923c[_0xbd6d('0x27')][_0xbd6d('0x55')]),'ChatQueueId':Number(_0x34923c[_0xbd6d('0x2c')]['id'])});}});}})[_0xbd6d('0x16')](respondWithStatusCode(_0x17babd,null))['catch'](handleError(_0x17babd,null));};exports['getAgents']=function(_0x321b0e,_0x5957c7){var _0x437228={};var _0x2d2844={};var _0x31aace;var _0x1e886b;return db['ChatQueue'][_0xbd6d('0x42')]({'where':{'id':_0x321b0e[_0xbd6d('0x2c')]['id']}})[_0xbd6d('0x16')](handleEntityNotFound(_0x5957c7,null))['then'](function(_0x45d60b){if(_0x45d60b){_0x31aace=_0x45d60b;_0x2d2844[_0xbd6d('0x2d')]=_[_0xbd6d('0x2e')](db[_0xbd6d('0x4b')][_0xbd6d('0x1f')]);_0x2d2844[_0xbd6d('0x27')]=_['keys'](_0x321b0e['query']);_0x2d2844[_0xbd6d('0x2f')]=_[_0xbd6d('0x30')](_0x2d2844[_0xbd6d('0x2d')],_0x2d2844[_0xbd6d('0x27')]);_0x437228[_0xbd6d('0x32')]=_['intersection'](_0x2d2844[_0xbd6d('0x2d')],qs['fields'](_0x321b0e[_0xbd6d('0x27')][_0xbd6d('0x31')]));_0x437228[_0xbd6d('0x32')]=_0x437228['attributes'][_0xbd6d('0x33')]?_0x437228[_0xbd6d('0x32')]:_0x2d2844['model'];_0x437228[_0xbd6d('0x46')]=qs['sort'](_0x321b0e[_0xbd6d('0x27')]['sort']);_0x437228[_0xbd6d('0x24')]=qs[_0xbd6d('0x2f')](_[_0xbd6d('0x48')](_0x321b0e[_0xbd6d('0x27')],_0x2d2844['filters']));if(_0x321b0e['query'][_0xbd6d('0x4a')]){_0x437228[_0xbd6d('0x24')]=_['merge'](_0x437228[_0xbd6d('0x24')],{'$or':_[_0xbd6d('0x1d')](_0x437228[_0xbd6d('0x32')],function(_0x3477f0){var _0x126ed7={};_0x126ed7[_0x3477f0]={'$like':'%'+_0x321b0e[_0xbd6d('0x27')]['filter']+'%'};return _0x126ed7;})});}_0x437228=_[_0xbd6d('0x53')]({},_0x437228,_0x321b0e[_0xbd6d('0x35')]);return _0x31aace[_0xbd6d('0x7c')](_0x437228);}})['then'](function(_0x3843de){if(_0x3843de){_0x1e886b=_0x3843de[_0xbd6d('0x33')];if(!_0x321b0e[_0xbd6d('0x27')][_0xbd6d('0x44')](_0xbd6d('0x45'))){_0x437228[_0xbd6d('0x13')]=qs['limit'](_0x321b0e[_0xbd6d('0x27')][_0xbd6d('0x13')]);_0x437228[_0xbd6d('0x11')]=qs[_0xbd6d('0x11')](_0x321b0e[_0xbd6d('0x27')]['offset']);}return _0x31aace[_0xbd6d('0x7c')](_0x437228);}})[_0xbd6d('0x16')](function(_0x43331f){if(_0x43331f){return _0x43331f?{'count':_0x1e886b,'rows':_0x43331f}:null;}})[_0xbd6d('0x16')](respondWithResult(_0x5957c7,null))[_0xbd6d('0x2a')](handleError(_0x5957c7,null));}; \ No newline at end of file +var _0x40a6=['bluebird','util','lodash','squel','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','status','end','json','offset','count','Content-Range','update','then','destroy','get','ChatQueues','error','stack','name','send','index','map','ChatQueue','rawAttributes','fieldName','type','where','include','query','findAll','rows','catch','params','intersection','attributes','model','fields','includeAll','options','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','keys','UserChatQueue','length','hasOwnProperty','nolimit','limit','order','sort','filters','pick','ChatQueueId','filter','merge','User','findAndCountAll','UserId','chatPause','format','%s/%s','createdAt','getTeams','Team','ids','Agents','online','voicePause','interface','flatMap','transaction','addTeams','each','findOrCreate','userChatQueue:save','select','field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','sequelize','toString','SELECT','every','TeamId','includes','all','compact','value','removeTeams','removeAgents','forEach','addAgents','omit','spread','emit','isArray','userChatQueue:remove','getAgents'];(function(_0x8e3fc7,_0x4e7478){var _0x15a9ac=function(_0x2ec8d5){while(--_0x2ec8d5){_0x8e3fc7['push'](_0x8e3fc7['shift']());}};_0x15a9ac(++_0x4e7478);}(_0x40a6,0xf8));var _0x640a=function(_0xa3095d,_0x4ff047){_0xa3095d=_0xa3095d-0x0;var _0x493b33=_0x40a6[_0xa3095d];return _0x493b33;};'use strict';var BPromise=require(_0x640a('0x0'));var util=require(_0x640a('0x1'));var _=require(_0x640a('0x2'));var squel=require(_0x640a('0x3'));var Redis=require(_0x640a('0x4'));var qs=require('../../components/parsers/qs');var logger=require(_0x640a('0x5'))(_0x640a('0x6'));var config=require(_0x640a('0x7'));var db=require(_0x640a('0x8'))['db'];config[_0x640a('0x9')]=_[_0x640a('0xa')](config['redis'],{'host':_0x640a('0xb'),'port':0x18eb});var socket=require(_0x640a('0xc'))(new Redis(config[_0x640a('0x9')]));require(_0x640a('0xd'))['register'](socket);function respondWithStatusCode(_0x3c1592,_0x5227a8){_0x5227a8=_0x5227a8||0xcc;return function(_0x301b51){if(_0x301b51){return _0x3c1592['sendStatus'](_0x5227a8);}return _0x3c1592[_0x640a('0xe')](_0x5227a8)[_0x640a('0xf')]();};}function respondWithResult(_0x29648b,_0x41f668){_0x41f668=_0x41f668||0xc8;return function(_0x5749f0){if(_0x5749f0){return _0x29648b[_0x640a('0xe')](_0x41f668)[_0x640a('0x10')](_0x5749f0);}};}function respondWithFilteredResult(_0x219299,_0x9a1c36){return function(_0x4f646b){if(_0x4f646b){var _0x3f4177=typeof _0x9a1c36[_0x640a('0x11')]==='undefined'&&typeof _0x9a1c36['limit']==='undefined';var _0x47ca1b=_0x4f646b[_0x640a('0x12')];var _0x249dad=_0x3f4177?0x0:_0x9a1c36[_0x640a('0x11')];var _0x2d9203=_0x3f4177?_0x4f646b['count']:_0x9a1c36[_0x640a('0x11')]+_0x9a1c36['limit'];var _0x82e57e;if(_0x2d9203>=_0x47ca1b){_0x2d9203=_0x47ca1b;_0x82e57e=0xc8;}else{_0x82e57e=0xce;}_0x219299[_0x640a('0xe')](_0x82e57e);return _0x219299['set'](_0x640a('0x13'),_0x249dad+'-'+_0x2d9203+'/'+_0x47ca1b)[_0x640a('0x10')](_0x4f646b);}return null;};}function saveUpdates(_0x3762e1){return function(_0x31a438){if(_0x31a438){return _0x31a438[_0x640a('0x14')](_0x3762e1)[_0x640a('0x15')](function(_0x2e4e9a){return _0x2e4e9a;});}return null;};}function removeEntity(_0x40c297){return function(_0x30621c){if(_0x30621c){return _0x30621c[_0x640a('0x16')]()[_0x640a('0x15')](function(){var _0x349f85=_0x30621c[_0x640a('0x17')]({'plain':!![]});var _0x326cb6=_0x640a('0x18');return db['UserProfileResource'][_0x640a('0x16')]({'where':{'type':_0x326cb6,'resourceId':_0x349f85['id']}})[_0x640a('0x15')](function(){return _0x30621c;});})[_0x640a('0x15')](function(){_0x40c297[_0x640a('0xe')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ddfbc){return function(_0x324db9){if(!_0x324db9){_0x1ddfbc['sendStatus'](0x194);}return _0x324db9;};}function handleError(_0x31711e,_0x554b77){_0x554b77=_0x554b77||0x1f4;return function(_0x48fd4b){logger[_0x640a('0x19')](_0x48fd4b[_0x640a('0x1a')]);if(_0x48fd4b[_0x640a('0x1b')]){delete _0x48fd4b[_0x640a('0x1b')];}_0x31711e[_0x640a('0xe')](_0x554b77)[_0x640a('0x1c')](_0x48fd4b);};}exports[_0x640a('0x1d')]=function(_0x2577b1,_0xcdd311){var _0x4dda32={};var _0x47ecd0={'count':0x0,'rows':[]};var _0xc72048=_[_0x640a('0x1e')](db[_0x640a('0x1f')][_0x640a('0x20')],function(_0x481e84){return{'name':_0x481e84[_0x640a('0x21')],'type':_0x481e84[_0x640a('0x22')]['key']};});_0x4dda32=qs['getOptions'](_0xc72048,_0x2577b1);var _0x16429a={'where':_0x4dda32[_0x640a('0x23')]};return db[_0x640a('0x1f')][_0x640a('0x12')](_0x16429a)[_0x640a('0x15')](function(_0x384a60){_0x47ecd0[_0x640a('0x12')]=_0x384a60;_0x4dda32['include']=qs[_0x640a('0x24')](_0x2577b1[_0x640a('0x25')]);return db['ChatQueue'][_0x640a('0x26')](_0x4dda32);})['then'](function(_0xb1bcea){_0x47ecd0[_0x640a('0x27')]=_0xb1bcea;return _0x47ecd0;})[_0x640a('0x15')](respondWithFilteredResult(_0xcdd311,_0x4dda32))[_0x640a('0x28')](handleError(_0xcdd311,null));};exports['show']=function(_0x48b84a,_0x54c2f8){var _0x4f8b04={'raw':!![],'where':{'id':_0x48b84a[_0x640a('0x29')]['id']}},_0x1da4ea={};_0x1da4ea['model']=_['keys'](db[_0x640a('0x1f')][_0x640a('0x20')]);_0x1da4ea[_0x640a('0x25')]=_['keys'](_0x48b84a[_0x640a('0x25')]);_0x1da4ea['filters']=_[_0x640a('0x2a')](_0x1da4ea['model'],_0x1da4ea[_0x640a('0x25')]);_0x4f8b04[_0x640a('0x2b')]=_['intersection'](_0x1da4ea[_0x640a('0x2c')],qs[_0x640a('0x2d')](_0x48b84a[_0x640a('0x25')]['fields']));_0x4f8b04[_0x640a('0x2b')]=_0x4f8b04[_0x640a('0x2b')]['length']?_0x4f8b04[_0x640a('0x2b')]:_0x1da4ea[_0x640a('0x2c')];if(_0x48b84a[_0x640a('0x25')][_0x640a('0x2e')]){_0x4f8b04[_0x640a('0x24')]=[{'all':!![]}];}_0x4f8b04=_['merge']({},_0x4f8b04,_0x48b84a[_0x640a('0x2f')]);return db['ChatQueue']['find'](_0x4f8b04)[_0x640a('0x15')](handleEntityNotFound(_0x54c2f8,null))[_0x640a('0x15')](respondWithResult(_0x54c2f8,null))['catch'](handleError(_0x54c2f8,null));};exports['create']=function(_0x16c7c1,_0x31dc97){return db[_0x640a('0x1f')][_0x640a('0x30')](_0x16c7c1['body'],{})[_0x640a('0x15')](function(_0x4ff1cd){var _0x2e1e12=_0x16c7c1[_0x640a('0x31')]['get']({'plain':!![]});if(!_0x2e1e12)throw new Error(_0x640a('0x32'));if(_0x2e1e12[_0x640a('0x33')]===_0x640a('0x31')){var _0x36bc57=_0x4ff1cd[_0x640a('0x17')]({'plain':!![]});var _0x5983d1=_0x640a('0x18');return db[_0x640a('0x34')][_0x640a('0x35')]({'where':{'name':_0x5983d1,'userProfileId':_0x2e1e12[_0x640a('0x36')]},'raw':!![]})[_0x640a('0x15')](function(_0x1e55bb){if(_0x1e55bb&&_0x1e55bb['autoAssociation']===0x0){return db[_0x640a('0x37')][_0x640a('0x30')]({'name':_0x36bc57[_0x640a('0x1b')],'resourceId':_0x36bc57['id'],'type':_0x1e55bb['name'],'sectionId':_0x1e55bb['id']},{})['then'](function(){return _0x4ff1cd;});}else{return _0x4ff1cd;}})[_0x640a('0x28')](function(_0x16ba49){logger[_0x640a('0x19')](_0x640a('0x38'),_0x16ba49);throw _0x16ba49;});}return _0x4ff1cd;})[_0x640a('0x15')](respondWithResult(_0x31dc97,0xc9))[_0x640a('0x28')](handleError(_0x31dc97,null));};exports[_0x640a('0x14')]=function(_0x4708c3,_0x57a1a5){if(_0x4708c3['body']['id']){delete _0x4708c3[_0x640a('0x39')]['id'];}return db[_0x640a('0x1f')][_0x640a('0x35')]({'where':{'id':_0x4708c3[_0x640a('0x29')]['id']}})[_0x640a('0x15')](handleEntityNotFound(_0x57a1a5,null))[_0x640a('0x15')](saveUpdates(_0x4708c3[_0x640a('0x39')],null))[_0x640a('0x15')](respondWithResult(_0x57a1a5,null))['catch'](handleError(_0x57a1a5,null));};exports[_0x640a('0x16')]=function(_0x4409cd,_0x3d090b){return db['ChatQueue'][_0x640a('0x35')]({'where':{'id':_0x4409cd[_0x640a('0x29')]['id']}})['then'](handleEntityNotFound(_0x3d090b,null))['then'](removeEntity(_0x3d090b,null))[_0x640a('0x28')](handleError(_0x3d090b,null));};exports['describe']=function(_0x452a89,_0x37fd02){return db['ChatQueue'][_0x640a('0x3a')]()[_0x640a('0x15')](respondWithResult(_0x37fd02,null))['catch'](handleError(_0x37fd02,null));};exports[_0x640a('0x3b')]=function(_0x1f20dd,_0x4673c2){var _0x413621={'raw':!![],'where':{}},_0x31c669={},_0x4486cd;return db[_0x640a('0x1f')][_0x640a('0x3c')]({'where':{'id':_0x1f20dd[_0x640a('0x29')]['id']}})['then'](handleEntityNotFound(_0x4673c2,null))[_0x640a('0x15')](function(_0x539fd0){if(_0x539fd0){_0x4486cd=_0x539fd0[_0x640a('0x17')]({'plain':!![]});_0x31c669[_0x640a('0x2c')]=_[_0x640a('0x3d')](db[_0x640a('0x3e')][_0x640a('0x20')]);_0x31c669['query']=_[_0x640a('0x3d')](_0x1f20dd[_0x640a('0x25')]);_0x31c669['filters']=_[_0x640a('0x2a')](_0x31c669['model'],_0x31c669[_0x640a('0x25')]);_0x413621[_0x640a('0x2b')]=_[_0x640a('0x2a')](_0x31c669[_0x640a('0x2c')],qs[_0x640a('0x2d')](_0x1f20dd[_0x640a('0x25')][_0x640a('0x2d')]));_0x413621[_0x640a('0x2b')]=_0x413621['attributes'][_0x640a('0x3f')]?_0x413621[_0x640a('0x2b')]:_0x31c669[_0x640a('0x2c')];if(!_0x1f20dd[_0x640a('0x25')][_0x640a('0x40')](_0x640a('0x41'))){_0x413621[_0x640a('0x42')]=qs[_0x640a('0x42')](_0x1f20dd['query'][_0x640a('0x42')]);_0x413621['offset']=qs['offset'](_0x1f20dd[_0x640a('0x25')]['offset']);}_0x413621[_0x640a('0x43')]=qs['sort'](_0x1f20dd['query'][_0x640a('0x44')]);_0x413621[_0x640a('0x23')]=qs[_0x640a('0x45')](_[_0x640a('0x46')](_0x1f20dd['query'],_0x31c669[_0x640a('0x45')]));_0x413621[_0x640a('0x23')][_0x640a('0x47')]=_0x539fd0['id'];if(_0x1f20dd[_0x640a('0x25')][_0x640a('0x48')]){_0x413621[_0x640a('0x23')]=_[_0x640a('0x49')](_0x413621['where'],{'$or':_[_0x640a('0x1e')](_0x413621['attributes'],function(_0x33f797){var _0x2c650d={};_0x2c650d[_0x33f797]={'$like':'%'+_0x1f20dd[_0x640a('0x25')]['filter']+'%'};return _0x2c650d;})});}_0x413621=_['merge']({},_0x413621,_0x1f20dd[_0x640a('0x2f')]);return db[_0x640a('0x3e')][_0x640a('0x26')](_0x413621);}})[_0x640a('0x15')](function(_0x43cee5){if(_0x43cee5){return db[_0x640a('0x4a')][_0x640a('0x4b')]({'where':{'id':_[_0x640a('0x1e')](_0x43cee5,_0x640a('0x4c')),'role':'agent'},'attributes':['id',_0x640a('0x1b'),_0x640a('0x4d'),'updatedAt','createdAt']});}})[_0x640a('0x15')](function(_0x702d05){if(_0x702d05){return{'count':_0x702d05['count'],'rows':_[_0x640a('0x1e')](_0x702d05[_0x640a('0x27')],function(_0x4c8a5b){return{'membername':_0x4c8a5b[_0x640a('0x1b')],'UserId':_0x4c8a5b['id'],'queue_name':_0x4486cd[_0x640a('0x1b')],'ChatQueueId':_0x4486cd['id'],'interface':util[_0x640a('0x4e')](_0x640a('0x4f'),'SIP',_0x4c8a5b['name']),'penalty':0x0,'paused':_0x4c8a5b[_0x640a('0x4d')],'createdAt':_0x4c8a5b[_0x640a('0x50')],'updatedAt':_0x4c8a5b['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x640a('0x15')](respondWithFilteredResult(_0x4673c2,_0x413621))[_0x640a('0x28')](handleError(_0x4673c2,null));};exports[_0x640a('0x51')]=function(_0x30dc53,_0x50ecb0){var _0x21b395={};var _0x3c1628={};var _0x2fa873;var _0x2f0b05;return db[_0x640a('0x1f')][_0x640a('0x3c')]({'where':{'id':_0x30dc53[_0x640a('0x29')]['id']}})[_0x640a('0x15')](handleEntityNotFound(_0x50ecb0,null))[_0x640a('0x15')](function(_0x3fee7e){if(_0x3fee7e){_0x2fa873=_0x3fee7e;_0x3c1628[_0x640a('0x2c')]=_['keys'](db[_0x640a('0x52')][_0x640a('0x20')]);_0x3c1628[_0x640a('0x25')]=_['keys'](_0x30dc53[_0x640a('0x25')]);_0x3c1628['filters']=_['intersection'](_0x3c1628[_0x640a('0x2c')],_0x3c1628['query']);_0x21b395['attributes']=_[_0x640a('0x2a')](_0x3c1628[_0x640a('0x2c')],qs[_0x640a('0x2d')](_0x30dc53['query'][_0x640a('0x2d')]));_0x21b395[_0x640a('0x2b')]=_0x21b395['attributes'][_0x640a('0x3f')]?_0x21b395['attributes']:_0x3c1628[_0x640a('0x2c')];_0x21b395[_0x640a('0x43')]=qs[_0x640a('0x44')](_0x30dc53[_0x640a('0x25')][_0x640a('0x44')]);_0x21b395[_0x640a('0x23')]=qs[_0x640a('0x45')](_[_0x640a('0x46')](_0x30dc53[_0x640a('0x25')],_0x3c1628[_0x640a('0x45')]));if(_0x30dc53['query']['filter']){_0x21b395[_0x640a('0x23')]=_[_0x640a('0x49')](_0x21b395[_0x640a('0x23')],{'$or':_['map'](_0x21b395['attributes'],function(_0x8f2315){var _0xa3c6d={};_0xa3c6d[_0x8f2315]={'$like':'%'+_0x30dc53[_0x640a('0x25')][_0x640a('0x48')]+'%'};return _0xa3c6d;})});}_0x21b395=_[_0x640a('0x49')]({},_0x21b395,_0x30dc53[_0x640a('0x2f')]);return _0x2fa873[_0x640a('0x51')](_0x21b395);}})[_0x640a('0x15')](function(_0x43bea6){if(_0x43bea6){_0x2f0b05=_0x43bea6['length'];if(!_0x30dc53['query']['hasOwnProperty'](_0x640a('0x41'))){_0x21b395[_0x640a('0x42')]=qs['limit'](_0x30dc53['query'][_0x640a('0x42')]);_0x21b395[_0x640a('0x11')]=qs[_0x640a('0x11')](_0x30dc53[_0x640a('0x25')]['offset']);}return _0x2fa873[_0x640a('0x51')](_0x21b395);}})[_0x640a('0x15')](function(_0x467373){if(_0x467373){return _0x467373?{'count':_0x2f0b05,'rows':_0x467373}:null;}})[_0x640a('0x15')](respondWithResult(_0x50ecb0,null))[_0x640a('0x28')](handleError(_0x50ecb0,null));};exports['addTeams']=function(_0x53da17,_0x3e7b99){var _0x4c8835=_0x53da17[_0x640a('0x39')][_0x640a('0x53')];return db[_0x640a('0x52')][_0x640a('0x26')]({'where':{'id':_0x4c8835},'attributes':['id'],'include':[{'model':db[_0x640a('0x4a')],'as':_0x640a('0x54'),'attributes':['id','name',_0x640a('0x55'),_0x640a('0x56'),_0x640a('0x57')],'raw':!![]}]})[_0x640a('0x15')](function(_0x3fdc7c){if(_0x3fdc7c){var _0x4b335b=_[_0x640a('0x58')](_0x3fdc7c,function(_0x589bf0){var _0x397dcf=_0x589bf0[_0x640a('0x17')]({'plain':!![]});return _0x397dcf[_0x640a('0x54')];});return db[_0x640a('0x1f')][_0x640a('0x35')]({'where':{'id':_0x53da17[_0x640a('0x29')]['id']}})['then'](function(_0x2ebd56){return db['sequelize'][_0x640a('0x59')](function(_0x5e9186){return _0x2ebd56[_0x640a('0x5a')](_0x4c8835,{'transaction':_0x5e9186})[_0x640a('0x15')](function(){return BPromise[_0x640a('0x5b')](_0x4b335b,function(_0x14e9b5){return db[_0x640a('0x3e')][_0x640a('0x5c')]({'where':{'UserId':_0x14e9b5['id'],'ChatQueueId':_0x53da17[_0x640a('0x29')]['id']},'transaction':_0x5e9186});});})['then'](function(){_0x4b335b['forEach'](function(_0x5c2d8e){socket['emit'](_0x640a('0x5d'),{'UserId':_0x5c2d8e['id'],'ChatQueueId':_0x2ebd56['id']});});});});});}})[_0x640a('0x15')](respondWithStatusCode(_0x3e7b99,null))['catch'](handleError(_0x3e7b99,null));};exports['removeTeams']=function(_0x68a734,_0x3ffea6){return db[_0x640a('0x52')][_0x640a('0x26')]({'where':{'id':_0x68a734[_0x640a('0x25')][_0x640a('0x53')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x640a('0x15')](handleEntityNotFound(_0x3ffea6,null))[_0x640a('0x15')](function(_0x24ce88){var _0x17f747=_[_0x640a('0x1e')](_0x24ce88,'id');var _0x5d0cdd=[];var _0x5e965d=[];var _0x32214b=squel[_0x640a('0x5e')]();_0x32214b[_0x640a('0x5f')](_0x640a('0x60'))[_0x640a('0x61')](_0x640a('0x62'),'tq')[_0x640a('0x63')](_0x640a('0x64'),'ut',_0x640a('0x65'))['where']('ChatQueueId\x20=\x20?',_0x68a734[_0x640a('0x29')]['id']);for(var _0x14c7f1=0x0;_0x14c7f1<_0x24ce88[_0x640a('0x3f')];_0x14c7f1+=0x1){let _0x3daf5a=_0x24ce88[_0x14c7f1];for(var _0x571fd4=0x0;_0x571fd4<_0x3daf5a[_0x640a('0x54')]['length'];_0x571fd4+=0x1){let _0x1fd9f7=_0x3daf5a[_0x640a('0x54')][_0x571fd4];var _0x5a520d=_0x32214b[_0x640a('0x66')]();_0x5a520d[_0x640a('0x23')](_0x640a('0x67'),_0x1fd9f7['id']);_0x5e965d[_0x640a('0x68')](db[_0x640a('0x69')][_0x640a('0x25')](_0x5a520d[_0x640a('0x6a')](),{'type':db[_0x640a('0x69')]['QueryTypes'][_0x640a('0x6b')]})[_0x640a('0x15')](function(_0x28d9d6){if(_0x28d9d6[_0x640a('0x3f')]===0x1){return _0x1fd9f7['id'];}else{var _0x2340e8=_[_0x640a('0x6c')](_[_0x640a('0x1e')](_0x28d9d6,_0x640a('0x6d')),function(_0x424717){return _[_0x640a('0x6e')](_0x17f747,_0x424717);});if(_0x2340e8){return _0x1fd9f7['id'];}}}));}}return BPromise[_0x640a('0x6f')](_0x5e965d)[_0x640a('0x15')](function(_0xa39134){_0x5d0cdd=_(_0x5d0cdd)['union'](_0xa39134)[_0x640a('0x70')]()[_0x640a('0x71')]();return db['ChatQueue'][_0x640a('0x35')]({'where':{'id':_0x68a734[_0x640a('0x29')]['id']}})[_0x640a('0x15')](function(_0x1b649c){return db['sequelize'][_0x640a('0x59')](function(_0x54a352){return _0x1b649c[_0x640a('0x72')](_0x68a734['query'][_0x640a('0x53')],{'transaction':_0x54a352})[_0x640a('0x15')](function(){if(!_['isEmpty'](_0x5d0cdd)){return _0x1b649c[_0x640a('0x73')](_0x5d0cdd,{'transaction':_0x54a352});}})[_0x640a('0x15')](function(){_0x5d0cdd[_0x640a('0x74')](function(_0x1757dc){socket['emit']('userChatQueue:remove',{'UserId':_0x1757dc,'ChatQueueId':_0x1b649c['id']});});});});});});})['then'](respondWithStatusCode(_0x3ffea6,null))['catch'](handleError(_0x3ffea6,null));};exports[_0x640a('0x75')]=function(_0x5a8005,_0x204ef0){return db['ChatQueue'][_0x640a('0x35')]({'where':{'id':_0x5a8005[_0x640a('0x29')]['id']}})[_0x640a('0x15')](handleEntityNotFound(_0x204ef0,null))['then'](function(_0x1f8bcf){if(_0x1f8bcf){return _0x1f8bcf['addAgents'](_0x5a8005[_0x640a('0x39')][_0x640a('0x53')],_[_0x640a('0x76')](_0x5a8005['body'],[_0x640a('0x53'),'id'])||{})[_0x640a('0x77')](function(_0x2e2fdc){for(var _0x5a701d=0x0;_0x5a701d<_0x5a8005[_0x640a('0x39')][_0x640a('0x53')][_0x640a('0x3f')];_0x5a701d+=0x1){socket[_0x640a('0x78')](_0x640a('0x5d'),{'UserId':Number(_0x5a8005[_0x640a('0x39')][_0x640a('0x53')][_0x5a701d]),'ChatQueueId':Number(_0x5a8005['params']['id'])});}return _0x2e2fdc;});}})[_0x640a('0x15')](respondWithResult(_0x204ef0,null))['catch'](handleError(_0x204ef0,null));};exports[_0x640a('0x73')]=function(_0x6ce141,_0xa8eb2a){return db[_0x640a('0x1f')]['find']({'where':{'id':_0x6ce141['params']['id']}})['then'](handleEntityNotFound(_0xa8eb2a,null))[_0x640a('0x15')](function(_0x5360df){if(_0x5360df){return _0x5360df[_0x640a('0x73')](_0x6ce141['query'][_0x640a('0x53')])[_0x640a('0x15')](function(){if(_[_0x640a('0x79')](_0x6ce141[_0x640a('0x25')][_0x640a('0x53')])){for(var _0x7438ed=0x0;_0x7438ed<_0x6ce141[_0x640a('0x25')][_0x640a('0x53')]['length'];_0x7438ed+=0x1){socket['emit'](_0x640a('0x7a'),{'UserId':Number(_0x6ce141['query'][_0x640a('0x53')][_0x7438ed]),'ChatQueueId':Number(_0x6ce141[_0x640a('0x29')]['id'])});}}else{socket[_0x640a('0x78')](_0x640a('0x7a'),{'UserId':Number(_0x6ce141[_0x640a('0x25')][_0x640a('0x53')]),'ChatQueueId':Number(_0x6ce141[_0x640a('0x29')]['id'])});}});}})[_0x640a('0x15')](respondWithStatusCode(_0xa8eb2a,null))[_0x640a('0x28')](handleError(_0xa8eb2a,null));};exports[_0x640a('0x7b')]=function(_0x4869dd,_0x1fae9a){var _0x3f486c={};var _0x544eea={};var _0x548eed;var _0x4ad7b5;return db['ChatQueue'][_0x640a('0x3c')]({'where':{'id':_0x4869dd[_0x640a('0x29')]['id']}})['then'](handleEntityNotFound(_0x1fae9a,null))[_0x640a('0x15')](function(_0x499b42){if(_0x499b42){_0x548eed=_0x499b42;_0x544eea[_0x640a('0x2c')]=_[_0x640a('0x3d')](db[_0x640a('0x4a')][_0x640a('0x20')]);_0x544eea['query']=_[_0x640a('0x3d')](_0x4869dd[_0x640a('0x25')]);_0x544eea['filters']=_[_0x640a('0x2a')](_0x544eea[_0x640a('0x2c')],_0x544eea[_0x640a('0x25')]);_0x3f486c[_0x640a('0x2b')]=_[_0x640a('0x2a')](_0x544eea[_0x640a('0x2c')],qs[_0x640a('0x2d')](_0x4869dd['query']['fields']));_0x3f486c[_0x640a('0x2b')]=_0x3f486c[_0x640a('0x2b')][_0x640a('0x3f')]?_0x3f486c[_0x640a('0x2b')]:_0x544eea[_0x640a('0x2c')];_0x3f486c['order']=qs[_0x640a('0x44')](_0x4869dd[_0x640a('0x25')]['sort']);_0x3f486c[_0x640a('0x23')]=qs[_0x640a('0x45')](_[_0x640a('0x46')](_0x4869dd['query'],_0x544eea[_0x640a('0x45')]));if(_0x4869dd[_0x640a('0x25')]['filter']){_0x3f486c[_0x640a('0x23')]=_[_0x640a('0x49')](_0x3f486c[_0x640a('0x23')],{'$or':_[_0x640a('0x1e')](_0x3f486c[_0x640a('0x2b')],function(_0x71edbf){var _0x3a2a9f={};_0x3a2a9f[_0x71edbf]={'$like':'%'+_0x4869dd[_0x640a('0x25')][_0x640a('0x48')]+'%'};return _0x3a2a9f;})});}_0x3f486c=_[_0x640a('0x49')]({},_0x3f486c,_0x4869dd[_0x640a('0x2f')]);return _0x548eed[_0x640a('0x7b')](_0x3f486c);}})[_0x640a('0x15')](function(_0xb0ac77){if(_0xb0ac77){_0x4ad7b5=_0xb0ac77[_0x640a('0x3f')];if(!_0x4869dd['query'][_0x640a('0x40')](_0x640a('0x41'))){_0x3f486c['limit']=qs[_0x640a('0x42')](_0x4869dd[_0x640a('0x25')][_0x640a('0x42')]);_0x3f486c[_0x640a('0x11')]=qs[_0x640a('0x11')](_0x4869dd[_0x640a('0x25')][_0x640a('0x11')]);}return _0x548eed[_0x640a('0x7b')](_0x3f486c);}})[_0x640a('0x15')](function(_0x151e4f){if(_0x151e4f){return _0x151e4f?{'count':_0x4ad7b5,'rows':_0x151e4f}:null;}})[_0x640a('0x15')](respondWithResult(_0x1fae9a,null))['catch'](handleError(_0x1fae9a,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 07ce63c..2e4b8b2 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 _0x2c58=['remove','emit','hasOwnProperty','hook','../../mysqldb','setMaxListeners','update'];(function(_0x1da5b4,_0x5ca014){var _0x5a4009=function(_0x1036fe){while(--_0x1036fe){_0x1da5b4['push'](_0x1da5b4['shift']());}};_0x5a4009(++_0x5ca014);}(_0x2c58,0x1e0));var _0x82c5=function(_0x1e33e3,_0x1d9401){_0x1e33e3=_0x1e33e3-0x0;var _0x25885a=_0x2c58[_0x1e33e3];return _0x25885a;};'use strict';var EventEmitter=require('events');var ChatQueue=require(_0x82c5('0x0'))['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x82c5('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x82c5('0x2'),'afterDestroy':_0x82c5('0x3')};function emitEvent(_0x32ff54){return function(_0x2ecde6,_0xcd940b,_0x5d7f92){ChatQueueEvents[_0x82c5('0x4')](_0x32ff54+':'+_0x2ecde6['id'],_0x2ecde6);ChatQueueEvents['emit'](_0x32ff54,_0x2ecde6);_0x5d7f92(null);};}for(var e in events){if(events[_0x82c5('0x5')](e)){var event=events[e];ChatQueue[_0x82c5('0x6')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file +var _0xf0fb=['hook','ChatQueue','setMaxListeners','save','remove','emit'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xf0fb,0x97));var _0xbf0f=function(_0x1f647d,_0x517668){_0x1f647d=_0x1f647d-0x0;var _0x3de573=_0xf0fb[_0x1f647d];return _0x3de573;};'use strict';var EventEmitter=require('events');var ChatQueue=require('../../mysqldb')['db'][_0xbf0f('0x0')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xbf0f('0x1')](0x0);var events={'afterCreate':_0xbf0f('0x2'),'afterUpdate':'update','afterDestroy':_0xbf0f('0x3')};function emitEvent(_0x2a7e30){return function(_0x100684,_0x442703,_0x4e126b){ChatQueueEvents['emit'](_0x2a7e30+':'+_0x100684['id'],_0x100684);ChatQueueEvents[_0xbf0f('0x4')](_0x2a7e30,_0x100684);_0x4e126b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatQueue[_0xbf0f('0x5')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 8b2107a..f0a6967 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 _0xd1e8=['../../config/logger','api','bluebird','request-promise','path','../../config/environment','chat_queues','util'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xd1e8,0xef));var _0x8d1e=function(_0x4f4c11,_0xdb6add){_0x4f4c11=_0x4f4c11-0x0;var _0x4dfd33=_0xd1e8[_0x4f4c11];return _0x4dfd33;};'use strict';var _=require('lodash');var util=require(_0x8d1e('0x0'));var logger=require(_0x8d1e('0x1'))(_0x8d1e('0x2'));var moment=require('moment');var BPromise=require(_0x8d1e('0x3'));var rp=require(_0x8d1e('0x4'));var fs=require('fs');var path=require(_0x8d1e('0x5'));var rimraf=require('rimraf');var config=require(_0x8d1e('0x6'));var attributes=require('./chatQueue.attributes');module['exports']=function(_0xab8fdb,_0x2c6a8d){return _0xab8fdb['define']('ChatQueue',attributes,{'tableName':_0x8d1e('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x377b=['../../config/logger','api','moment','bluebird','rimraf','./chatQueue.attributes','define','lodash'];(function(_0x3e50a5,_0x25c83b){var _0x1c4649=function(_0x4f66af){while(--_0x4f66af){_0x3e50a5['push'](_0x3e50a5['shift']());}};_0x1c4649(++_0x25c83b);}(_0x377b,0x87));var _0xb377=function(_0x2f1cc4,_0x24e35b){_0x2f1cc4=_0x2f1cc4-0x0;var _0x39dc74=_0x377b[_0x2f1cc4];return _0x39dc74;};'use strict';var _=require(_0xb377('0x0'));var util=require('util');var logger=require(_0xb377('0x1'))(_0xb377('0x2'));var moment=require(_0xb377('0x3'));var BPromise=require(_0xb377('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb377('0x5'));var config=require('../../config/environment');var attributes=require(_0xb377('0x6'));module['exports']=function(_0x52ea94,_0x4cfea5){return _0x52ea94[_0xb377('0x7')]('ChatQueue',attributes,{'tableName':'chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index 049745d..cd8b42e 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 _0xaa7c=['request\x20sent','debug','error','message','info','catch','GetChatQueue','findAll','options','raw','where','limit','include','map','model','attributes','stringify','ShowChatQueue','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','./chatQueue.socket','register','request','then','ChatQueue,\x20%s,\x20%s'];(function(_0x2cb282,_0x153209){var _0x49d14b=function(_0x6a91bc){while(--_0x6a91bc){_0x2cb282['push'](_0x2cb282['shift']());}};_0x49d14b(++_0x153209);}(_0xaa7c,0x18e));var _0xcaa7=function(_0x3dd00d,_0x4f109f){_0x3dd00d=_0x3dd00d-0x0;var _0x30e255=_0xaa7c[_0x3dd00d];return _0x30e255;};'use strict';var _=require(_0xcaa7('0x0'));var util=require(_0xcaa7('0x1'));var moment=require(_0xcaa7('0x2'));var BPromise=require(_0xcaa7('0x3'));var rs=require(_0xcaa7('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcaa7('0x5'))['db'];var utils=require(_0xcaa7('0x6'));var logger=require(_0xcaa7('0x7'))(_0xcaa7('0x8'));var config=require(_0xcaa7('0x9'));var jayson=require(_0xcaa7('0xa'));var client=jayson['client'][_0xcaa7('0xb')]({'port':0x232a});config['redis']=_[_0xcaa7('0xc')](config[_0xcaa7('0xd')],{'host':_0xcaa7('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcaa7('0xd')]));require(_0xcaa7('0xf'))[_0xcaa7('0x10')](socket);function respondWithRpcPromise(_0x371585,_0x2542bb,_0x223732){return new BPromise(function(_0x618453,_0x4f7d89){return client[_0xcaa7('0x11')](_0x371585,_0x223732)[_0xcaa7('0x12')](function(_0x4b452f){logger['info'](_0xcaa7('0x13'),_0x2542bb,_0xcaa7('0x14'));logger[_0xcaa7('0x15')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x2542bb,_0xcaa7('0x14'),JSON['stringify'](_0x4b452f));if(_0x4b452f['error']){if(_0x4b452f['error']['code']===0x1f4){logger[_0xcaa7('0x16')](_0xcaa7('0x13'),_0x2542bb,_0x4b452f[_0xcaa7('0x16')][_0xcaa7('0x17')]);return _0x4f7d89(_0x4b452f[_0xcaa7('0x16')][_0xcaa7('0x17')]);}logger[_0xcaa7('0x16')](_0xcaa7('0x13'),_0x2542bb,_0x4b452f['error'][_0xcaa7('0x17')]);return _0x618453(_0x4b452f[_0xcaa7('0x16')][_0xcaa7('0x17')]);}else{logger[_0xcaa7('0x18')](_0xcaa7('0x13'),_0x2542bb,_0xcaa7('0x14'));_0x618453(_0x4b452f['result'][_0xcaa7('0x17')]);}})[_0xcaa7('0x19')](function(_0x91c46d){logger[_0xcaa7('0x16')](_0xcaa7('0x13'),_0x2542bb,_0x91c46d);_0x4f7d89(_0x91c46d);});});}exports[_0xcaa7('0x1a')]=function(_0x14e6a6){var _0x476ccd=this;return new Promise(function(_0x4eb6c6,_0x123ef4){return db['ChatQueue'][_0xcaa7('0x1b')]({'raw':_0x14e6a6[_0xcaa7('0x1c')]?_0x14e6a6[_0xcaa7('0x1c')][_0xcaa7('0x1d')]===undefined?!![]:![]:!![],'where':_0x14e6a6['options']?_0x14e6a6[_0xcaa7('0x1c')][_0xcaa7('0x1e')]||null:null,'attributes':_0x14e6a6[_0xcaa7('0x1c')]?_0x14e6a6[_0xcaa7('0x1c')]['attributes']||null:null,'limit':_0x14e6a6[_0xcaa7('0x1c')]?_0x14e6a6[_0xcaa7('0x1c')][_0xcaa7('0x1f')]||null:null,'include':_0x14e6a6[_0xcaa7('0x1c')]?_0x14e6a6[_0xcaa7('0x1c')][_0xcaa7('0x20')]?_[_0xcaa7('0x21')](_0x14e6a6[_0xcaa7('0x1c')][_0xcaa7('0x20')],function(_0x4ba754){return{'model':db[_0x4ba754[_0xcaa7('0x22')]],'as':_0x4ba754['as'],'attributes':_0x4ba754[_0xcaa7('0x23')],'include':_0x4ba754[_0xcaa7('0x20')]?_[_0xcaa7('0x21')](_0x4ba754[_0xcaa7('0x20')],function(_0xe46152){return{'model':db[_0xe46152[_0xcaa7('0x22')]],'as':_0xe46152['as'],'attributes':_0xe46152[_0xcaa7('0x23')],'include':_0xe46152[_0xcaa7('0x20')]?_[_0xcaa7('0x21')](_0xe46152[_0xcaa7('0x20')],function(_0x56e9c4){return{'model':db[_0x56e9c4[_0xcaa7('0x22')]],'as':_0x56e9c4['as'],'attributes':_0x56e9c4[_0xcaa7('0x23')]};}):[]};}):[]};}):[]:[]})[_0xcaa7('0x12')](function(_0x523270){logger['info'](_0xcaa7('0x1a'),_0x14e6a6);logger['debug'](_0xcaa7('0x1a'),_0x14e6a6,JSON[_0xcaa7('0x24')](_0x523270));_0x4eb6c6(_0x523270);})[_0xcaa7('0x19')](function(_0x1626ce){logger[_0xcaa7('0x16')](_0xcaa7('0x1a'),_0x1626ce[_0xcaa7('0x17')],_0x14e6a6);_0x123ef4(_0x476ccd[_0xcaa7('0x16')](0x1f4,_0x1626ce[_0xcaa7('0x17')]));});});};exports[_0xcaa7('0x25')]=function(_0x1d00cf){var _0x1e7606=this;return new Promise(function(_0x44d129,_0x6ddb2e){return db['ChatQueue']['find']({'raw':_0x1d00cf[_0xcaa7('0x1c')]?_0x1d00cf[_0xcaa7('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x1d00cf['options']?_0x1d00cf[_0xcaa7('0x1c')]['where']||null:null,'attributes':_0x1d00cf[_0xcaa7('0x1c')]?_0x1d00cf[_0xcaa7('0x1c')]['attributes']||null:null,'include':_0x1d00cf['options']?_0x1d00cf[_0xcaa7('0x1c')]['include']?_[_0xcaa7('0x21')](_0x1d00cf[_0xcaa7('0x1c')][_0xcaa7('0x20')],function(_0x358fac){return{'model':db[_0x358fac[_0xcaa7('0x22')]],'as':_0x358fac['as'],'attributes':_0x358fac['attributes'],'include':_0x358fac[_0xcaa7('0x20')]?_[_0xcaa7('0x21')](_0x358fac[_0xcaa7('0x20')],function(_0x5d5598){return{'model':db[_0x5d5598[_0xcaa7('0x22')]],'as':_0x5d5598['as'],'attributes':_0x5d5598['attributes'],'include':_0x5d5598[_0xcaa7('0x20')]?_['map'](_0x5d5598['include'],function(_0x5422d9){return{'model':db[_0x5422d9[_0xcaa7('0x22')]],'as':_0x5422d9['as'],'attributes':_0x5422d9[_0xcaa7('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45c0b4){logger[_0xcaa7('0x18')](_0xcaa7('0x25'),_0x1d00cf);logger[_0xcaa7('0x15')]('ShowChatQueue',_0x1d00cf,JSON[_0xcaa7('0x24')](_0x45c0b4));_0x44d129(_0x45c0b4);})[_0xcaa7('0x19')](function(_0x53015){logger[_0xcaa7('0x16')](_0xcaa7('0x25'),_0x53015['message'],_0x1d00cf);_0x6ddb2e(_0x1e7606[_0xcaa7('0x16')](0x1f4,_0x53015[_0xcaa7('0x17')]));});});}; \ No newline at end of file +var _0xe6da=['register','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetChatQueue','findAll','options','where','attributes','limit','include','map','model','ShowChatQueue','ChatQueue','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','redis','defaults','localhost','./chatQueue.socket'];(function(_0x5549d9,_0xf8dc19){var _0x27dcdf=function(_0x6c9bcc){while(--_0x6c9bcc){_0x5549d9['push'](_0x5549d9['shift']());}};_0x27dcdf(++_0xf8dc19);}(_0xe6da,0x1ee));var _0xae6d=function(_0x27cf59,_0x396f76){_0x27cf59=_0x27cf59-0x0;var _0x5f3f46=_0xe6da[_0x27cf59];return _0x5f3f46;};'use strict';var _=require('lodash');var util=require(_0xae6d('0x0'));var moment=require(_0xae6d('0x1'));var BPromise=require(_0xae6d('0x2'));var rs=require(_0xae6d('0x3'));var fs=require('fs');var Redis=require(_0xae6d('0x4'));var db=require(_0xae6d('0x5'))['db'];var utils=require(_0xae6d('0x6'));var logger=require('../../config/logger')(_0xae6d('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xae6d('0x8')]['http']({'port':0x232a});config[_0xae6d('0x9')]=_[_0xae6d('0xa')](config['redis'],{'host':_0xae6d('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xae6d('0x9')]));require(_0xae6d('0xc'))[_0xae6d('0xd')](socket);function respondWithRpcPromise(_0x2fb460,_0x5e0f3e,_0x11108d){return new BPromise(function(_0x5bac2a,_0x411ef3){return client[_0xae6d('0xe')](_0x2fb460,_0x11108d)[_0xae6d('0xf')](function(_0x88a7c4){logger[_0xae6d('0x10')](_0xae6d('0x11'),_0x5e0f3e,_0xae6d('0x12'));logger[_0xae6d('0x13')](_0xae6d('0x14'),_0x5e0f3e,_0xae6d('0x12'),JSON[_0xae6d('0x15')](_0x88a7c4));if(_0x88a7c4[_0xae6d('0x16')]){if(_0x88a7c4['error'][_0xae6d('0x17')]===0x1f4){logger[_0xae6d('0x16')](_0xae6d('0x11'),_0x5e0f3e,_0x88a7c4['error'][_0xae6d('0x18')]);return _0x411ef3(_0x88a7c4[_0xae6d('0x16')][_0xae6d('0x18')]);}logger[_0xae6d('0x16')]('ChatQueue,\x20%s,\x20%s',_0x5e0f3e,_0x88a7c4[_0xae6d('0x16')][_0xae6d('0x18')]);return _0x5bac2a(_0x88a7c4['error'][_0xae6d('0x18')]);}else{logger[_0xae6d('0x10')](_0xae6d('0x11'),_0x5e0f3e,_0xae6d('0x12'));_0x5bac2a(_0x88a7c4[_0xae6d('0x19')][_0xae6d('0x18')]);}})[_0xae6d('0x1a')](function(_0x226cbe){logger['error'](_0xae6d('0x11'),_0x5e0f3e,_0x226cbe);_0x411ef3(_0x226cbe);});});}exports[_0xae6d('0x1b')]=function(_0x174cde){var _0x27d43a=this;return new Promise(function(_0x52d9a3,_0x5c4ed0){return db['ChatQueue'][_0xae6d('0x1c')]({'raw':_0x174cde[_0xae6d('0x1d')]?_0x174cde[_0xae6d('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x174cde[_0xae6d('0x1d')]?_0x174cde[_0xae6d('0x1d')][_0xae6d('0x1e')]||null:null,'attributes':_0x174cde[_0xae6d('0x1d')]?_0x174cde[_0xae6d('0x1d')][_0xae6d('0x1f')]||null:null,'limit':_0x174cde[_0xae6d('0x1d')]?_0x174cde[_0xae6d('0x1d')][_0xae6d('0x20')]||null:null,'include':_0x174cde['options']?_0x174cde[_0xae6d('0x1d')][_0xae6d('0x21')]?_[_0xae6d('0x22')](_0x174cde[_0xae6d('0x1d')][_0xae6d('0x21')],function(_0x57b62e){return{'model':db[_0x57b62e[_0xae6d('0x23')]],'as':_0x57b62e['as'],'attributes':_0x57b62e[_0xae6d('0x1f')],'include':_0x57b62e[_0xae6d('0x21')]?_[_0xae6d('0x22')](_0x57b62e['include'],function(_0x1ca9f8){return{'model':db[_0x1ca9f8[_0xae6d('0x23')]],'as':_0x1ca9f8['as'],'attributes':_0x1ca9f8[_0xae6d('0x1f')],'include':_0x1ca9f8[_0xae6d('0x21')]?_['map'](_0x1ca9f8[_0xae6d('0x21')],function(_0x4655d7){return{'model':db[_0x4655d7[_0xae6d('0x23')]],'as':_0x4655d7['as'],'attributes':_0x4655d7[_0xae6d('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xae6d('0xf')](function(_0x9f0ba5){logger[_0xae6d('0x10')](_0xae6d('0x1b'),_0x174cde);logger['debug'](_0xae6d('0x1b'),_0x174cde,JSON['stringify'](_0x9f0ba5));_0x52d9a3(_0x9f0ba5);})['catch'](function(_0x3e8f5b){logger['error'](_0xae6d('0x1b'),_0x3e8f5b[_0xae6d('0x18')],_0x174cde);_0x5c4ed0(_0x27d43a[_0xae6d('0x16')](0x1f4,_0x3e8f5b['message']));});});};exports[_0xae6d('0x24')]=function(_0x2156a8){var _0x5410d9=this;return new Promise(function(_0x16ad0c,_0x1a5259){return db[_0xae6d('0x25')]['find']({'raw':_0x2156a8[_0xae6d('0x1d')]?_0x2156a8[_0xae6d('0x1d')][_0xae6d('0x26')]===undefined?!![]:![]:!![],'where':_0x2156a8[_0xae6d('0x1d')]?_0x2156a8[_0xae6d('0x1d')][_0xae6d('0x1e')]||null:null,'attributes':_0x2156a8['options']?_0x2156a8[_0xae6d('0x1d')][_0xae6d('0x1f')]||null:null,'include':_0x2156a8[_0xae6d('0x1d')]?_0x2156a8[_0xae6d('0x1d')][_0xae6d('0x21')]?_[_0xae6d('0x22')](_0x2156a8['options'][_0xae6d('0x21')],function(_0x143411){return{'model':db[_0x143411['model']],'as':_0x143411['as'],'attributes':_0x143411[_0xae6d('0x1f')],'include':_0x143411['include']?_[_0xae6d('0x22')](_0x143411['include'],function(_0x1d0388){return{'model':db[_0x1d0388[_0xae6d('0x23')]],'as':_0x1d0388['as'],'attributes':_0x1d0388[_0xae6d('0x1f')],'include':_0x1d0388['include']?_[_0xae6d('0x22')](_0x1d0388[_0xae6d('0x21')],function(_0x2abcdb){return{'model':db[_0x2abcdb['model']],'as':_0x2abcdb['as'],'attributes':_0x2abcdb[_0xae6d('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xae6d('0xf')](function(_0x52324f){logger[_0xae6d('0x10')](_0xae6d('0x24'),_0x2156a8);logger[_0xae6d('0x13')](_0xae6d('0x24'),_0x2156a8,JSON['stringify'](_0x52324f));_0x16ad0c(_0x52324f);})[_0xae6d('0x1a')](function(_0xbe5f1c){logger['error'](_0xae6d('0x24'),_0xbe5f1c[_0xae6d('0x18')],_0x2156a8);_0x1a5259(_0x5410d9[_0xae6d('0x16')](0x1f4,_0xbe5f1c['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index a565467..bbc3914 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 _0xf3cd=['remove','update','emit','register','length','chatQueue:','./chatQueue.events','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x229a9d,_0x4d3229){_0x229a9d=_0x229a9d-0x0;var _0x5bd600=_0xf3cd[_0x229a9d];return _0x5bd600;};'use strict';var ChatQueueEvents=require(_0xdf3c('0x0'));var events=[_0xdf3c('0x1'),_0xdf3c('0x2'),_0xdf3c('0x3')];function createListener(_0x1839ec,_0x433a7f){return function(_0x54db05){_0x433a7f[_0xdf3c('0x4')](_0x1839ec,_0x54db05);};}function removeListener(_0x71b446,_0x9f71cb){return function(){ChatQueueEvents['removeListener'](_0x71b446,_0x9f71cb);};}exports[_0xdf3c('0x5')]=function(_0x17d42a){for(var _0x1313d5=0x0,_0x1f0601=events[_0xdf3c('0x6')];_0x1313d5<_0x1f0601;_0x1313d5++){var _0x28edae=events[_0x1313d5];var _0x52c073=createListener(_0xdf3c('0x7')+_0x28edae,_0x17d42a);ChatQueueEvents['on'](_0x28edae,_0x52c073);}}; \ No newline at end of file +var _0xec56=['removeListener','register','length','chatQueue:','./chatQueue.events','update','emit'];(function(_0x250cc6,_0x838094){var _0x2e3f01=function(_0x3dd162){while(--_0x3dd162){_0x250cc6['push'](_0x250cc6['shift']());}};_0x2e3f01(++_0x838094);}(_0xec56,0x1bd));var _0x6ec5=function(_0x17d06d,_0xac062c){_0x17d06d=_0x17d06d-0x0;var _0x1790c4=_0xec56[_0x17d06d];return _0x1790c4;};'use strict';var ChatQueueEvents=require(_0x6ec5('0x0'));var events=['save','remove',_0x6ec5('0x1')];function createListener(_0x3b8a3f,_0x26a5af){return function(_0x240ccf){_0x26a5af[_0x6ec5('0x2')](_0x3b8a3f,_0x240ccf);};}function removeListener(_0x399441,_0x469679){return function(){ChatQueueEvents[_0x6ec5('0x3')](_0x399441,_0x469679);};}exports[_0x6ec5('0x4')]=function(_0x28b12b){for(var _0x2d0a93=0x0,_0x3bb683=events[_0x6ec5('0x5')];_0x2d0a93<_0x3bb683;_0x2d0a93++){var _0x1f59cd=events[_0x2d0a93];var _0x3dd891=createListener(_0x6ec5('0x6')+_0x1f59cd,_0x28b12b);ChatQueueEvents['on'](_0x1f59cd,_0x3dd891);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 0a571d3..9531e83 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 _0x3e74=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','/:id/teams','getTeams','getAgents','post','addTeams','addAgents','put','delete','removeTeams','/:id/users','removeAgents','exports','multer','path','connect-timeout','express','../../components/auth/service'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x3e74,0x175));var _0x43e7=function(_0x18f891,_0x145f60){_0x18f891=_0x18f891-0x0;var _0xd36fc6=_0x3e74[_0x18f891];return _0xd36fc6;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0x7')](_0x43e7('0xc'),auth['isAuthenticated'](),controller[_0x43e7('0xd')]);router['get']('/:id/members',auth[_0x43e7('0x8')](),controller[_0x43e7('0xe')]);router['get'](_0x43e7('0xf'),auth['isAuthenticated'](),controller[_0x43e7('0x10')]);router[_0x43e7('0x7')]('/:id/users',auth[_0x43e7('0x8')](),controller[_0x43e7('0x11')]);router[_0x43e7('0x12')]('/',auth[_0x43e7('0x8')](),controller['create']);router['post'](_0x43e7('0xf'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x13')]);router['post']('/:id/users',auth[_0x43e7('0x8')](),controller[_0x43e7('0x14')]);router[_0x43e7('0x15')](_0x43e7('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x43e7('0x16')](_0x43e7('0xc'),auth[_0x43e7('0x8')](),controller['destroy']);router['delete'](_0x43e7('0xf'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x17')]);router[_0x43e7('0x16')](_0x43e7('0x18'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x19')]);module[_0x43e7('0x1a')]=router; \ No newline at end of file +var _0x7217=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','addTeams','update','delete','destroy','removeTeams','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x5a482b,_0x760fe4){var _0x1ab16a=function(_0x31426b){while(--_0x31426b){_0x5a482b['push'](_0x5a482b['shift']());}};_0x1ab16a(++_0x760fe4);}(_0x7217,0x19e));var _0x7721=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0x7217[_0x4c7fb5];return _0x2e10ac;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var fs_extra=require(_0x7721('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xa')]);router[_0x7721('0x8')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0xc')]);router[_0x7721('0x8')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0x8')](_0x7721('0xf'),auth['isAuthenticated'](),controller[_0x7721('0x10')]);router[_0x7721('0x8')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x12')]);router[_0x7721('0x8')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller['getAgents']);router[_0x7721('0x14')]('/',auth[_0x7721('0x9')](),controller['create']);router[_0x7721('0x14')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x15')]);router['post'](_0x7721('0x13'),auth[_0x7721('0x9')](),controller['addAgents']);router['put']('/:id',auth[_0x7721('0x9')](),controller[_0x7721('0x16')]);router[_0x7721('0x17')](_0x7721('0xd'),auth['isAuthenticated'](),controller[_0x7721('0x18')]);router['delete'](_0x7721('0x11'),auth['isAuthenticated'](),controller[_0x7721('0x19')]);router[_0x7721('0x17')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller[_0x7721('0x1a')]);module[_0x7721('0x1b')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 534c29a..e646fb9 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 _0x784f=['STRING','DATE','sequelize','exports'];(function(_0x19213a,_0x246ac2){var _0xeaba49=function(_0x4a0a9c){while(--_0x4a0a9c){_0x19213a['push'](_0x19213a['shift']());}};_0xeaba49(++_0x246ac2);}(_0x784f,0x1ee));var _0xf784=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x784f[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require('moment');var Sequelize=require(_0xf784('0x0'));module[_0xf784('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xf784('0x2')]},'joinAt':{'type':Sequelize[_0xf784('0x3')]},'leaveAt':{'type':Sequelize[_0xf784('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1a7a=['DATE','sequelize','exports','STRING'];(function(_0x44b88f,_0x13bbda){var _0x50cab6=function(_0x11e4bd){while(--_0x11e4bd){_0x44b88f['push'](_0x44b88f['shift']());}};_0x50cab6(++_0x13bbda);}(_0x1a7a,0x1e5));var _0xa1a7=function(_0x2c87dc,_0x139292){_0x2c87dc=_0x2c87dc-0x0;var _0x2b78ec=_0x1a7a[_0x2c87dc];return _0x2b78ec;};'use strict';var moment=require('moment');var Sequelize=require(_0xa1a7('0x0'));module[_0xa1a7('0x1')]={'uniqueid':{'type':Sequelize[_0xa1a7('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xa1a7('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xa1a7('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xa1a7('0x3')]},'reason':{'type':Sequelize[_0xa1a7('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 784e270..446c3f0 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 _0x53ec=['then','sendStatus','name','send','map','ChatQueueReport','rawAttributes','fieldName','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','rows','show','params','include','find','catch','create','update','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save'];(function(_0x4c6c3c,_0x24878d){var _0x3789f3=function(_0x1b4d52){while(--_0x1b4d52){_0x4c6c3c['push'](_0x4c6c3c['shift']());}};_0x3789f3(++_0x24878d);}(_0x53ec,0x192));var _0xc53e=function(_0x4b980d,_0x32fc6a){_0x4b980d=_0x4b980d-0x0;var _0x5c7974=_0x53ec[_0x4b980d];return _0x5c7974;};'use strict';var emlformat=require(_0xc53e('0x0'));var rimraf=require(_0xc53e('0x1'));var zipdir=require(_0xc53e('0x2'));var jsonpatch=require(_0xc53e('0x3'));var rp=require(_0xc53e('0x4'));var moment=require(_0xc53e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc53e('0x6'));var util=require('util');var path=require(_0xc53e('0x7'));var sox=require(_0xc53e('0x8'));var csv=require('to-csv');var ejs=require(_0xc53e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc53e('0xa'));var squel=require(_0xc53e('0xb'));var crypto=require('crypto');var jsforce=require(_0xc53e('0xc'));var deskjs=require(_0xc53e('0xd'));var toCsv=require(_0xc53e('0xe'));var querystring=require(_0xc53e('0xf'));var Papa=require(_0xc53e('0x10'));var Redis=require(_0xc53e('0x11'));var authService=require(_0xc53e('0x12'));var qs=require(_0xc53e('0x13'));var as=require(_0xc53e('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc53e('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc53e('0x16'));var db=require(_0xc53e('0x17'))['db'];function respondWithStatusCode(_0x863fa,_0x4203aa){_0x4203aa=_0x4203aa||0xcc;return function(_0x56f0e5){if(_0x56f0e5){return _0x863fa['sendStatus'](_0x4203aa);}return _0x863fa[_0xc53e('0x18')](_0x4203aa)[_0xc53e('0x19')]();};}function respondWithResult(_0x7cd798,_0x3d2e17){_0x3d2e17=_0x3d2e17||0xc8;return function(_0x358ef3){if(_0x358ef3){return _0x7cd798[_0xc53e('0x18')](_0x3d2e17)[_0xc53e('0x1a')](_0x358ef3);}};}function respondWithFilteredResult(_0x19c0d1,_0x455e4d){return function(_0x2ad6eb){if(_0x2ad6eb){var _0x5b0a88=typeof _0x455e4d[_0xc53e('0x1b')]===_0xc53e('0x1c')&&typeof _0x455e4d[_0xc53e('0x1d')]===_0xc53e('0x1c');var _0x15333b=_0x2ad6eb[_0xc53e('0x1e')];var _0x164016=_0x5b0a88?0x0:_0x455e4d[_0xc53e('0x1b')];var _0x3b550e=_0x5b0a88?_0x2ad6eb['count']:_0x455e4d['offset']+_0x455e4d[_0xc53e('0x1d')];var _0x2a5bac;if(_0x3b550e>=_0x15333b){_0x3b550e=_0x15333b;_0x2a5bac=0xc8;}else{_0x2a5bac=0xce;}_0x19c0d1[_0xc53e('0x18')](_0x2a5bac);return _0x19c0d1[_0xc53e('0x1f')](_0xc53e('0x20'),_0x164016+'-'+_0x3b550e+'/'+_0x15333b)[_0xc53e('0x1a')](_0x2ad6eb);}return null;};}function patchUpdates(_0x15a015){return function(_0x25702b){try{jsonpatch[_0xc53e('0x21')](_0x25702b,_0x15a015,!![]);}catch(_0x401af6){return BPromise[_0xc53e('0x22')](_0x401af6);}return _0x25702b[_0xc53e('0x23')]();};}function saveUpdates(_0x426467,_0x4fb695){return function(_0x47cfdd){if(_0x47cfdd){return _0x47cfdd['update'](_0x426467)[_0xc53e('0x24')](function(_0x384218){return _0x384218;});}return null;};}function removeEntity(_0x7591c1,_0x4015c8){return function(_0x180811){if(_0x180811){return _0x180811['destroy']()['then'](function(){_0x7591c1[_0xc53e('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ae55e,_0x3a5ce8){return function(_0x443179){if(!_0x443179){_0x1ae55e[_0xc53e('0x25')](0x194);}return _0x443179;};}function handleError(_0x63c5dc,_0x4df8cf){_0x4df8cf=_0x4df8cf||0x1f4;return function(_0x398e7a){logger['error'](_0x398e7a['stack']);if(_0x398e7a['name']){delete _0x398e7a[_0xc53e('0x26')];}_0x63c5dc['status'](_0x4df8cf)[_0xc53e('0x27')](_0x398e7a);};}exports['index']=function(_0x24a77e,_0x5112d2){var _0x5ce216={},_0x8f0ee6={},_0x6a62b0={'count':0x0,'rows':[]};var _0x42dec1=_[_0xc53e('0x28')](db[_0xc53e('0x29')][_0xc53e('0x2a')],function(_0x3280fe){return{'name':_0x3280fe[_0xc53e('0x2b')],'type':_0x3280fe['type'][_0xc53e('0x2c')]};});_0x8f0ee6[_0xc53e('0x2d')]=_[_0xc53e('0x28')](_0x42dec1,'name');_0x8f0ee6[_0xc53e('0x2e')]=_['keys'](_0x24a77e[_0xc53e('0x2e')]);_0x8f0ee6[_0xc53e('0x2f')]=_['intersection'](_0x8f0ee6['model'],_0x8f0ee6[_0xc53e('0x2e')]);_0x5ce216[_0xc53e('0x30')]=_[_0xc53e('0x31')](_0x8f0ee6[_0xc53e('0x2d')],qs[_0xc53e('0x32')](_0x24a77e[_0xc53e('0x2e')][_0xc53e('0x32')]));_0x5ce216[_0xc53e('0x30')]=_0x5ce216['attributes'][_0xc53e('0x33')]?_0x5ce216[_0xc53e('0x30')]:_0x8f0ee6[_0xc53e('0x2d')];if(!_0x24a77e[_0xc53e('0x2e')][_0xc53e('0x34')](_0xc53e('0x35'))){_0x5ce216[_0xc53e('0x1d')]=qs[_0xc53e('0x1d')](_0x24a77e[_0xc53e('0x2e')]['limit']);_0x5ce216[_0xc53e('0x1b')]=qs['offset'](_0x24a77e[_0xc53e('0x2e')][_0xc53e('0x1b')]);}_0x5ce216['order']=qs[_0xc53e('0x36')](_0x24a77e[_0xc53e('0x2e')][_0xc53e('0x36')]);_0x5ce216['where']=qs[_0xc53e('0x2f')](_[_0xc53e('0x37')](_0x24a77e[_0xc53e('0x2e')],_0x8f0ee6[_0xc53e('0x2f')]),_0x42dec1);if(_0x24a77e[_0xc53e('0x2e')][_0xc53e('0x38')]){_0x5ce216[_0xc53e('0x39')]=_['merge'](_0x5ce216[_0xc53e('0x39')],{'$or':_[_0xc53e('0x28')](_0x42dec1,function(_0x2db711){if(_0x2db711['type']!==_0xc53e('0x3a')){var _0x5e8ab7={};_0x5e8ab7[_0x2db711[_0xc53e('0x26')]]={'$like':'%'+_0x24a77e[_0xc53e('0x2e')][_0xc53e('0x38')]+'%'};return _0x5e8ab7;}})});}_0x5ce216=_[_0xc53e('0x3b')]({},_0x5ce216,_0x24a77e[_0xc53e('0x3c')]);var _0x5507d0={'where':_0x5ce216[_0xc53e('0x39')]};return db[_0xc53e('0x29')]['count'](_0x5507d0)['then'](function(_0x5e9e15){_0x6a62b0['count']=_0x5e9e15;if(_0x24a77e[_0xc53e('0x2e')][_0xc53e('0x3d')]){_0x5ce216['include']=[{'all':!![]}];}return db[_0xc53e('0x29')]['findAll'](_0x5ce216);})['then'](function(_0x53447e){_0x6a62b0[_0xc53e('0x3e')]=_0x53447e;return _0x6a62b0;})['then'](respondWithFilteredResult(_0x5112d2,_0x5ce216))['catch'](handleError(_0x5112d2,null));};exports[_0xc53e('0x3f')]=function(_0x53a82f,_0x422088){var _0x360af9={'raw':!![],'where':{'id':_0x53a82f[_0xc53e('0x40')]['id']}},_0x49f204={};_0x49f204[_0xc53e('0x2d')]=_['keys'](db[_0xc53e('0x29')]['rawAttributes']);_0x49f204['query']=_['keys'](_0x53a82f['query']);_0x49f204[_0xc53e('0x2f')]=_[_0xc53e('0x31')](_0x49f204[_0xc53e('0x2d')],_0x49f204['query']);_0x360af9[_0xc53e('0x30')]=_[_0xc53e('0x31')](_0x49f204['model'],qs['fields'](_0x53a82f[_0xc53e('0x2e')][_0xc53e('0x32')]));_0x360af9[_0xc53e('0x30')]=_0x360af9['attributes'][_0xc53e('0x33')]?_0x360af9[_0xc53e('0x30')]:_0x49f204[_0xc53e('0x2d')];if(_0x53a82f[_0xc53e('0x2e')][_0xc53e('0x3d')]){_0x360af9[_0xc53e('0x41')]=[{'all':!![]}];}_0x360af9=_[_0xc53e('0x3b')]({},_0x360af9,_0x53a82f['options']);return db[_0xc53e('0x29')][_0xc53e('0x42')](_0x360af9)[_0xc53e('0x24')](handleEntityNotFound(_0x422088,null))['then'](respondWithResult(_0x422088,null))[_0xc53e('0x43')](handleError(_0x422088,null));};exports[_0xc53e('0x44')]=function(_0x4458c8,_0x15e744){return db[_0xc53e('0x29')][_0xc53e('0x44')](_0x4458c8['body'],{})[_0xc53e('0x24')](respondWithResult(_0x15e744,0xc9))[_0xc53e('0x43')](handleError(_0x15e744,null));};exports[_0xc53e('0x45')]=function(_0x5a6e41,_0x33d45c){if(_0x5a6e41[_0xc53e('0x46')]['id']){delete _0x5a6e41[_0xc53e('0x46')]['id'];}return db[_0xc53e('0x29')][_0xc53e('0x42')]({'where':{'id':_0x5a6e41[_0xc53e('0x40')]['id']}})[_0xc53e('0x24')](handleEntityNotFound(_0x33d45c,null))[_0xc53e('0x24')](saveUpdates(_0x5a6e41[_0xc53e('0x46')],null))[_0xc53e('0x24')](respondWithResult(_0x33d45c,null))['catch'](handleError(_0x33d45c,null));};exports[_0xc53e('0x47')]=function(_0x17cf13,_0x38520c){return db[_0xc53e('0x29')][_0xc53e('0x42')]({'where':{'id':_0x17cf13['params']['id']}})['then'](handleEntityNotFound(_0x38520c,null))[_0xc53e('0x24')](removeEntity(_0x38520c,null))['catch'](handleError(_0x38520c,null));};exports[_0xc53e('0x48')]=function(_0x575a13,_0x3a49a4){return db[_0xc53e('0x29')][_0xc53e('0x48')]()['then'](respondWithResult(_0x3a49a4,null))[_0xc53e('0x43')](handleError(_0x3a49a4,null));}; \ No newline at end of file +var _0x2aa3=['sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','map','ChatQueueReport','rawAttributes','fieldName','type','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x131ff5,_0x55445f){var _0x11c1c1=function(_0x361006){while(--_0x361006){_0x131ff5['push'](_0x131ff5['shift']());}};_0x11c1c1(++_0x55445f);}(_0x2aa3,0x83));var _0x32aa=function(_0x36a897,_0x1f7f8c){_0x36a897=_0x36a897-0x0;var _0xf21fe8=_0x2aa3[_0x36a897];return _0xf21fe8;};'use strict';var emlformat=require(_0x32aa('0x0'));var rimraf=require(_0x32aa('0x1'));var zipdir=require(_0x32aa('0x2'));var jsonpatch=require(_0x32aa('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x32aa('0x4'));var Mustache=require(_0x32aa('0x5'));var util=require(_0x32aa('0x6'));var path=require(_0x32aa('0x7'));var sox=require(_0x32aa('0x8'));var csv=require(_0x32aa('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x32aa('0xa'));var _=require(_0x32aa('0xb'));var squel=require(_0x32aa('0xc'));var crypto=require(_0x32aa('0xd'));var jsforce=require(_0x32aa('0xe'));var deskjs=require(_0x32aa('0xf'));var toCsv=require(_0x32aa('0x9'));var querystring=require(_0x32aa('0x10'));var Papa=require('papaparse');var Redis=require(_0x32aa('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x32aa('0x12'));var as=require(_0x32aa('0x13'));var hardwareService=require(_0x32aa('0x14'));var logger=require(_0x32aa('0x15'))('api');var utils=require(_0x32aa('0x16'));var config=require(_0x32aa('0x17'));var licenseUtil=require(_0x32aa('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3d341f,_0x32aca0){_0x32aca0=_0x32aca0||0xcc;return function(_0x3640f9){if(_0x3640f9){return _0x3d341f[_0x32aa('0x19')](_0x32aca0);}return _0x3d341f[_0x32aa('0x1a')](_0x32aca0)[_0x32aa('0x1b')]();};}function respondWithResult(_0x5e96e3,_0x46758f){_0x46758f=_0x46758f||0xc8;return function(_0x58d625){if(_0x58d625){return _0x5e96e3[_0x32aa('0x1a')](_0x46758f)[_0x32aa('0x1c')](_0x58d625);}};}function respondWithFilteredResult(_0x1140a6,_0x2cc92d){return function(_0x211278){if(_0x211278){var _0x47eadd=typeof _0x2cc92d[_0x32aa('0x1d')]===_0x32aa('0x1e')&&typeof _0x2cc92d[_0x32aa('0x1f')]===_0x32aa('0x1e');var _0x29c1c4=_0x211278['count'];var _0x5196c0=_0x47eadd?0x0:_0x2cc92d[_0x32aa('0x1d')];var _0x34dcaf=_0x47eadd?_0x211278[_0x32aa('0x20')]:_0x2cc92d['offset']+_0x2cc92d['limit'];var _0x1a0262;if(_0x34dcaf>=_0x29c1c4){_0x34dcaf=_0x29c1c4;_0x1a0262=0xc8;}else{_0x1a0262=0xce;}_0x1140a6[_0x32aa('0x1a')](_0x1a0262);return _0x1140a6[_0x32aa('0x21')](_0x32aa('0x22'),_0x5196c0+'-'+_0x34dcaf+'/'+_0x29c1c4)[_0x32aa('0x1c')](_0x211278);}return null;};}function patchUpdates(_0x1cb0eb){return function(_0x5729af){try{jsonpatch[_0x32aa('0x23')](_0x5729af,_0x1cb0eb,!![]);}catch(_0x327831){return BPromise[_0x32aa('0x24')](_0x327831);}return _0x5729af[_0x32aa('0x25')]();};}function saveUpdates(_0x2aa421,_0x90d165){return function(_0x1ce405){if(_0x1ce405){return _0x1ce405[_0x32aa('0x26')](_0x2aa421)[_0x32aa('0x27')](function(_0x53c65a){return _0x53c65a;});}return null;};}function removeEntity(_0x4e66e6,_0x5c82d2){return function(_0x6766da){if(_0x6766da){return _0x6766da[_0x32aa('0x28')]()['then'](function(){_0x4e66e6['status'](0xcc)[_0x32aa('0x1b')]();});}};}function handleEntityNotFound(_0x313930,_0x3ba6b2){return function(_0x13d610){if(!_0x13d610){_0x313930[_0x32aa('0x19')](0x194);}return _0x13d610;};}function handleError(_0x3606ae,_0x27df0e){_0x27df0e=_0x27df0e||0x1f4;return function(_0x405b03){logger[_0x32aa('0x29')](_0x405b03['stack']);if(_0x405b03[_0x32aa('0x2a')]){delete _0x405b03[_0x32aa('0x2a')];}_0x3606ae['status'](_0x27df0e)[_0x32aa('0x2b')](_0x405b03);};}exports['index']=function(_0x4f73d1,_0x21d730){var _0x212ee4={},_0x1d1c80={},_0x11c818={'count':0x0,'rows':[]};var _0x5903b8=_[_0x32aa('0x2c')](db[_0x32aa('0x2d')][_0x32aa('0x2e')],function(_0x29706e){return{'name':_0x29706e[_0x32aa('0x2f')],'type':_0x29706e[_0x32aa('0x30')]['key']};});_0x1d1c80['model']=_[_0x32aa('0x2c')](_0x5903b8,_0x32aa('0x2a'));_0x1d1c80[_0x32aa('0x31')]=_[_0x32aa('0x32')](_0x4f73d1['query']);_0x1d1c80['filters']=_[_0x32aa('0x33')](_0x1d1c80['model'],_0x1d1c80[_0x32aa('0x31')]);_0x212ee4[_0x32aa('0x34')]=_['intersection'](_0x1d1c80[_0x32aa('0x35')],qs[_0x32aa('0x36')](_0x4f73d1['query'][_0x32aa('0x36')]));_0x212ee4[_0x32aa('0x34')]=_0x212ee4[_0x32aa('0x34')][_0x32aa('0x37')]?_0x212ee4[_0x32aa('0x34')]:_0x1d1c80[_0x32aa('0x35')];if(!_0x4f73d1[_0x32aa('0x31')][_0x32aa('0x38')](_0x32aa('0x39'))){_0x212ee4[_0x32aa('0x1f')]=qs[_0x32aa('0x1f')](_0x4f73d1[_0x32aa('0x31')][_0x32aa('0x1f')]);_0x212ee4[_0x32aa('0x1d')]=qs['offset'](_0x4f73d1[_0x32aa('0x31')][_0x32aa('0x1d')]);}_0x212ee4[_0x32aa('0x3a')]=qs[_0x32aa('0x3b')](_0x4f73d1[_0x32aa('0x31')]['sort']);_0x212ee4[_0x32aa('0x3c')]=qs[_0x32aa('0x3d')](_[_0x32aa('0x3e')](_0x4f73d1[_0x32aa('0x31')],_0x1d1c80[_0x32aa('0x3d')]),_0x5903b8);if(_0x4f73d1[_0x32aa('0x31')][_0x32aa('0x3f')]){_0x212ee4[_0x32aa('0x3c')]=_[_0x32aa('0x40')](_0x212ee4[_0x32aa('0x3c')],{'$or':_[_0x32aa('0x2c')](_0x5903b8,function(_0x563a74){if(_0x563a74['type']!==_0x32aa('0x41')){var _0x3c4fb6={};_0x3c4fb6[_0x563a74[_0x32aa('0x2a')]]={'$like':'%'+_0x4f73d1[_0x32aa('0x31')][_0x32aa('0x3f')]+'%'};return _0x3c4fb6;}})});}_0x212ee4=_[_0x32aa('0x40')]({},_0x212ee4,_0x4f73d1[_0x32aa('0x42')]);var _0x555a83={'where':_0x212ee4[_0x32aa('0x3c')]};return db[_0x32aa('0x2d')][_0x32aa('0x20')](_0x555a83)[_0x32aa('0x27')](function(_0x517614){_0x11c818[_0x32aa('0x20')]=_0x517614;if(_0x4f73d1['query'][_0x32aa('0x43')]){_0x212ee4[_0x32aa('0x44')]=[{'all':!![]}];}return db[_0x32aa('0x2d')][_0x32aa('0x45')](_0x212ee4);})[_0x32aa('0x27')](function(_0x5c4052){_0x11c818[_0x32aa('0x46')]=_0x5c4052;return _0x11c818;})[_0x32aa('0x27')](respondWithFilteredResult(_0x21d730,_0x212ee4))[_0x32aa('0x47')](handleError(_0x21d730,null));};exports[_0x32aa('0x48')]=function(_0x4fb0f4,_0x142572){var _0x483a04={'raw':!![],'where':{'id':_0x4fb0f4[_0x32aa('0x49')]['id']}},_0x1640f3={};_0x1640f3['model']=_[_0x32aa('0x32')](db[_0x32aa('0x2d')][_0x32aa('0x2e')]);_0x1640f3[_0x32aa('0x31')]=_[_0x32aa('0x32')](_0x4fb0f4[_0x32aa('0x31')]);_0x1640f3[_0x32aa('0x3d')]=_[_0x32aa('0x33')](_0x1640f3['model'],_0x1640f3['query']);_0x483a04[_0x32aa('0x34')]=_[_0x32aa('0x33')](_0x1640f3[_0x32aa('0x35')],qs[_0x32aa('0x36')](_0x4fb0f4[_0x32aa('0x31')]['fields']));_0x483a04[_0x32aa('0x34')]=_0x483a04[_0x32aa('0x34')][_0x32aa('0x37')]?_0x483a04['attributes']:_0x1640f3[_0x32aa('0x35')];if(_0x4fb0f4['query']['includeAll']){_0x483a04[_0x32aa('0x44')]=[{'all':!![]}];}_0x483a04=_[_0x32aa('0x40')]({},_0x483a04,_0x4fb0f4[_0x32aa('0x42')]);return db['ChatQueueReport']['find'](_0x483a04)[_0x32aa('0x27')](handleEntityNotFound(_0x142572,null))[_0x32aa('0x27')](respondWithResult(_0x142572,null))[_0x32aa('0x47')](handleError(_0x142572,null));};exports[_0x32aa('0x4a')]=function(_0x10078d,_0x1bb782){return db[_0x32aa('0x2d')][_0x32aa('0x4a')](_0x10078d[_0x32aa('0x4b')],{})[_0x32aa('0x27')](respondWithResult(_0x1bb782,0xc9))[_0x32aa('0x47')](handleError(_0x1bb782,null));};exports[_0x32aa('0x26')]=function(_0x75bd4,_0x1955dc){if(_0x75bd4['body']['id']){delete _0x75bd4['body']['id'];}return db[_0x32aa('0x2d')][_0x32aa('0x4c')]({'where':{'id':_0x75bd4[_0x32aa('0x49')]['id']}})[_0x32aa('0x27')](handleEntityNotFound(_0x1955dc,null))[_0x32aa('0x27')](saveUpdates(_0x75bd4[_0x32aa('0x4b')],null))[_0x32aa('0x27')](respondWithResult(_0x1955dc,null))[_0x32aa('0x47')](handleError(_0x1955dc,null));};exports['destroy']=function(_0x5573f7,_0x7115ef){return db['ChatQueueReport']['find']({'where':{'id':_0x5573f7[_0x32aa('0x49')]['id']}})[_0x32aa('0x27')](handleEntityNotFound(_0x7115ef,null))[_0x32aa('0x27')](removeEntity(_0x7115ef,null))[_0x32aa('0x47')](handleError(_0x7115ef,null));};exports[_0x32aa('0x4d')]=function(_0xb219b0,_0x5eb111){return db[_0x32aa('0x2d')]['describe']()[_0x32aa('0x27')](respondWithResult(_0x5eb111,null))[_0x32aa('0x47')](handleError(_0x5eb111,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index fa225dc..f940e60 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 _0xb10b=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','report_chat_queue','uniqueid','lodash'];(function(_0x2c3a47,_0x170687){var _0x1c04de=function(_0x367deb){while(--_0x367deb){_0x2c3a47['push'](_0x2c3a47['shift']());}};_0x1c04de(++_0x170687);}(_0xb10b,0x12a));var _0xbb10=function(_0x27c25f,_0x4ff5fe){_0x27c25f=_0x27c25f-0x0;var _0x2da4c4=_0xb10b[_0x27c25f];return _0x2da4c4;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var logger=require(_0xbb10('0x1'))(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var BPromise=require('bluebird');var rp=require(_0xbb10('0x4'));var fs=require('fs');var path=require(_0xbb10('0x5'));var rimraf=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var attributes=require(_0xbb10('0x8'));module[_0xbb10('0x9')]=function(_0x481979,_0x328583){return _0x481979[_0xbb10('0xa')]('ChatQueueReport',attributes,{'tableName':_0xbb10('0xb'),'paranoid':![],'indexes':[{'name':_0xbb10('0xc'),'fields':[_0xbb10('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb7e7=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','define','ChatQueueReport','uniqueid','lodash'];(function(_0x533781,_0x50026e){var _0x472993=function(_0x2e159a){while(--_0x2e159a){_0x533781['push'](_0x533781['shift']());}};_0x472993(++_0x50026e);}(_0xb7e7,0x121));var _0x7b7e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xb7e7[_0x187ee1];return _0x388160;};'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 d0ff4ca..d3c91f8 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 _0x5df3=['ChatQueueReport','create','body','options','UpdateChatQueueReport','update','raw','where','attributes','limit','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','CreateChatQueueReport'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5df3,0x15f));var _0x35df=function(_0xf394a,_0x20d1dd){_0xf394a=_0xf394a-0x0;var _0xde580f=_0x5df3[_0xf394a];return _0xde580f;};'use strict';var _=require(_0x35df('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x35df('0x1'));var rs=require(_0x35df('0x2'));var fs=require('fs');var Redis=require(_0x35df('0x3'));var db=require(_0x35df('0x4'))['db'];var utils=require(_0x35df('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x35df('0x6'));var jayson=require(_0x35df('0x7'));var client=jayson[_0x35df('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x246b7b,_0x5032e,_0x35d9d4){return new BPromise(function(_0x43e40b,_0x1c93d4){return client[_0x35df('0x9')](_0x246b7b,_0x35d9d4)[_0x35df('0xa')](function(_0x18941f){logger[_0x35df('0xb')](_0x35df('0xc'),_0x5032e,_0x35df('0xd'));logger[_0x35df('0xe')]('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x5032e,_0x35df('0xd'),JSON[_0x35df('0xf')](_0x18941f));if(_0x18941f[_0x35df('0x10')]){if(_0x18941f[_0x35df('0x10')][_0x35df('0x11')]===0x1f4){logger['error'](_0x35df('0xc'),_0x5032e,_0x18941f[_0x35df('0x10')][_0x35df('0x12')]);return _0x1c93d4(_0x18941f[_0x35df('0x10')][_0x35df('0x12')]);}logger[_0x35df('0x10')](_0x35df('0xc'),_0x5032e,_0x18941f[_0x35df('0x10')]['message']);return _0x43e40b(_0x18941f[_0x35df('0x10')][_0x35df('0x12')]);}else{logger[_0x35df('0xb')](_0x35df('0xc'),_0x5032e,'request\x20sent');_0x43e40b(_0x18941f['result'][_0x35df('0x12')]);}})[_0x35df('0x13')](function(_0x51182d){logger[_0x35df('0x10')](_0x35df('0xc'),_0x5032e,_0x51182d);_0x1c93d4(_0x51182d);});});}exports[_0x35df('0x14')]=function(_0x40d61c){var _0x44fcd4=this;return new Promise(function(_0x20c4ab,_0x3ceacf){return db[_0x35df('0x15')][_0x35df('0x16')](_0x40d61c[_0x35df('0x17')],{'raw':_0x40d61c['options']?_0x40d61c[_0x35df('0x18')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x3d7c4c){logger['info']('CreateChatQueueReport',_0x40d61c);logger[_0x35df('0xe')](_0x35df('0x14'),_0x40d61c,JSON[_0x35df('0xf')](_0x3d7c4c));_0x20c4ab(_0x3d7c4c);})[_0x35df('0x13')](function(_0x47b575){logger[_0x35df('0x10')](_0x35df('0x14'),_0x47b575['message'],_0x40d61c);_0x3ceacf(_0x44fcd4[_0x35df('0x10')](0x1f4,_0x47b575[_0x35df('0x12')]));});});};exports[_0x35df('0x19')]=function(_0x1546cb){var _0x1c5f2a=this;return new Promise(function(_0x774389,_0x2d1009){return db[_0x35df('0x15')][_0x35df('0x1a')](_0x1546cb[_0x35df('0x17')],{'raw':_0x1546cb[_0x35df('0x18')]?_0x1546cb[_0x35df('0x18')][_0x35df('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1546cb[_0x35df('0x18')]?_0x1546cb[_0x35df('0x18')][_0x35df('0x1c')]||null:null,'attributes':_0x1546cb['options']?_0x1546cb[_0x35df('0x18')][_0x35df('0x1d')]||null:null,'limit':_0x1546cb[_0x35df('0x18')]?_0x1546cb['options'][_0x35df('0x1e')]||null:null})['then'](function(_0x2012d8){logger[_0x35df('0xb')](_0x35df('0x19'),_0x1546cb);logger['debug'](_0x35df('0x19'),_0x1546cb,JSON[_0x35df('0xf')](_0x2012d8));_0x774389(_0x2012d8);})[_0x35df('0x13')](function(_0x51cd66){logger[_0x35df('0x10')](_0x35df('0x19'),_0x51cd66[_0x35df('0x12')],_0x1546cb);_0x2d1009(_0x1c5f2a['error'](0x1f4,_0x51cd66[_0x35df('0x12')]));});});}; \ No newline at end of file +var _0xbc8b=['debug','stringify','error','message','result','ChatQueueReport','raw','then','catch','CreateChatQueueReport','UpdateChatQueueReport','update','body','options','attributes','lodash','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbc8b,0x1bf));var _0xbbc8=function(_0x5c2e5e,_0x2bc00e){_0x5c2e5e=_0x5c2e5e-0x0;var _0x46a5da=_0xbc8b[_0x5c2e5e];return _0x46a5da;};'use strict';var _=require(_0xbbc8('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbbc8('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xbbc8('0x2'));var logger=require(_0xbbc8('0x3'))(_0xbbc8('0x4'));var config=require('../../config/environment');var jayson=require(_0xbbc8('0x5'));var client=jayson[_0xbbc8('0x6')][_0xbbc8('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1e9eec,_0x1ac9f6,_0x58777f){return new BPromise(function(_0x4bdca6,_0x4bb3bb){return client[_0xbbc8('0x8')](_0x1e9eec,_0x58777f)['then'](function(_0x13a7fe){logger[_0xbbc8('0x9')](_0xbbc8('0xa'),_0x1ac9f6,_0xbbc8('0xb'));logger[_0xbbc8('0xc')]('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x1ac9f6,_0xbbc8('0xb'),JSON[_0xbbc8('0xd')](_0x13a7fe));if(_0x13a7fe[_0xbbc8('0xe')]){if(_0x13a7fe[_0xbbc8('0xe')]['code']===0x1f4){logger[_0xbbc8('0xe')]('ChatQueueReport,\x20%s,\x20%s',_0x1ac9f6,_0x13a7fe[_0xbbc8('0xe')][_0xbbc8('0xf')]);return _0x4bb3bb(_0x13a7fe['error'][_0xbbc8('0xf')]);}logger[_0xbbc8('0xe')](_0xbbc8('0xa'),_0x1ac9f6,_0x13a7fe[_0xbbc8('0xe')][_0xbbc8('0xf')]);return _0x4bdca6(_0x13a7fe['error'][_0xbbc8('0xf')]);}else{logger[_0xbbc8('0x9')]('ChatQueueReport,\x20%s,\x20%s',_0x1ac9f6,_0xbbc8('0xb'));_0x4bdca6(_0x13a7fe[_0xbbc8('0x10')][_0xbbc8('0xf')]);}})['catch'](function(_0x5d894f){logger[_0xbbc8('0xe')](_0xbbc8('0xa'),_0x1ac9f6,_0x5d894f);_0x4bb3bb(_0x5d894f);});});}exports['CreateChatQueueReport']=function(_0xeabb55){var _0x1df093=this;return new Promise(function(_0x41edb5,_0x5c46e4){return db[_0xbbc8('0x11')]['create'](_0xeabb55['body'],{'raw':_0xeabb55['options']?_0xeabb55['options'][_0xbbc8('0x12')]===undefined?!![]:![]:!![]})[_0xbbc8('0x13')](function(_0x8015b2){logger[_0xbbc8('0x9')]('CreateChatQueueReport',_0xeabb55);logger['debug']('CreateChatQueueReport',_0xeabb55,JSON[_0xbbc8('0xd')](_0x8015b2));_0x41edb5(_0x8015b2);})[_0xbbc8('0x14')](function(_0x3b58ab){logger[_0xbbc8('0xe')](_0xbbc8('0x15'),_0x3b58ab['message'],_0xeabb55);_0x5c46e4(_0x1df093[_0xbbc8('0xe')](0x1f4,_0x3b58ab['message']));});});};exports[_0xbbc8('0x16')]=function(_0x17561b){var _0x11399b=this;return new Promise(function(_0x133c1f,_0x8193d4){return db['ChatQueueReport'][_0xbbc8('0x17')](_0x17561b[_0xbbc8('0x18')],{'raw':_0x17561b[_0xbbc8('0x19')]?_0x17561b[_0xbbc8('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x17561b[_0xbbc8('0x19')]?_0x17561b[_0xbbc8('0x19')]['where']||null:null,'attributes':_0x17561b[_0xbbc8('0x19')]?_0x17561b['options'][_0xbbc8('0x1a')]||null:null,'limit':_0x17561b[_0xbbc8('0x19')]?_0x17561b['options']['limit']||null:null})['then'](function(_0x5d96fb){logger['info']('UpdateChatQueueReport',_0x17561b);logger[_0xbbc8('0xc')](_0xbbc8('0x16'),_0x17561b,JSON[_0xbbc8('0xd')](_0x5d96fb));_0x133c1f(_0x5d96fb);})['catch'](function(_0x1af959){logger[_0xbbc8('0xe')](_0xbbc8('0x16'),_0x1af959['message'],_0x17561b);_0x8193d4(_0x11399b[_0xbbc8('0xe')](0x1f4,_0x1af959[_0xbbc8('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 9ab22e8..ac995d6 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 _0x34f5=['put','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create'];(function(_0x3f560e,_0x289aa8){var _0x5bf213=function(_0xcc2f71){while(--_0xcc2f71){_0x3f560e['push'](_0x3f560e['shift']());}};_0x5bf213(++_0x289aa8);}(_0x34f5,0xac));var _0x534f=function(_0x3baad4,_0x1b8cb8){_0x3baad4=_0x3baad4-0x0;var _0x44f278=_0x34f5[_0x3baad4];return _0x44f278;};'use strict';var multer=require(_0x534f('0x0'));var util=require(_0x534f('0x1'));var path=require('path');var timeout=require(_0x534f('0x2'));var express=require(_0x534f('0x3'));var router=express[_0x534f('0x4')]();var fs_extra=require(_0x534f('0x5'));var auth=require(_0x534f('0x6'));var interaction=require(_0x534f('0x7'));var config=require(_0x534f('0x8'));var controller=require('./chatQueueReport.controller');router['get']('/',auth[_0x534f('0x9')](),controller[_0x534f('0xa')]);router[_0x534f('0xb')]('/describe',auth[_0x534f('0x9')](),controller[_0x534f('0xc')]);router[_0x534f('0xb')](_0x534f('0xd'),auth['isAuthenticated'](),controller[_0x534f('0xe')]);router[_0x534f('0xf')]('/',auth[_0x534f('0x9')](),controller[_0x534f('0x10')]);router[_0x534f('0x11')]('/:id',auth[_0x534f('0x9')](),controller[_0x534f('0x12')]);router['delete'](_0x534f('0xd'),auth[_0x534f('0x9')](),controller[_0x534f('0x13')]);module[_0x534f('0x14')]=router; \ No newline at end of file +var _0x86aa=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','index','/describe','show','post','create','/:id','update','delete','destroy','multer','util'];(function(_0x36efc0,_0x3d1187){var _0x1e8fb3=function(_0x200284){while(--_0x200284){_0x36efc0['push'](_0x36efc0['shift']());}};_0x1e8fb3(++_0x3d1187);}(_0x86aa,0x124));var _0xa86a=function(_0x41b393,_0x46eaf5){_0x41b393=_0x41b393-0x0;var _0x5c1f4f=_0x86aa[_0x41b393];return _0x5c1f4f;};'use strict';var multer=require(_0xa86a('0x0'));var util=require(_0xa86a('0x1'));var path=require(_0xa86a('0x2'));var timeout=require(_0xa86a('0x3'));var express=require(_0xa86a('0x4'));var router=express[_0xa86a('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xa86a('0x6'));var interaction=require(_0xa86a('0x7'));var config=require(_0xa86a('0x8'));var controller=require(_0xa86a('0x9'));router[_0xa86a('0xa')]('/',auth[_0xa86a('0xb')](),controller[_0xa86a('0xc')]);router['get'](_0xa86a('0xd'),auth[_0xa86a('0xb')](),controller['describe']);router['get']('/:id',auth['isAuthenticated'](),controller[_0xa86a('0xe')]);router[_0xa86a('0xf')]('/',auth[_0xa86a('0xb')](),controller[_0xa86a('0x10')]);router['put'](_0xa86a('0x11'),auth[_0xa86a('0xb')](),controller[_0xa86a('0x12')]);router[_0xa86a('0x13')](_0xa86a('0x11'),auth[_0xa86a('0xb')](),controller[_0xa86a('0x14')]);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 fd89690..2c0ab14 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 _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0x31af70,_0x120140){var _0x32819b=function(_0xd08931){while(--_0xd08931){_0x31af70['push'](_0x31af70['shift']());}};_0x32819b(++_0x120140);}(_0xf3cd,0xfe));var _0xdf3c=function(_0xce93c,_0x555be5){_0xce93c=_0xce93c-0x0;var _0x230720=_0xf3cd[_0xce93c];return _0x230720;};'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 +var _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0xd256a1,_0x2aae80){var _0x2a11a4=function(_0x4a74f3){while(--_0x4a74f3){_0xd256a1['push'](_0xd256a1['shift']());}};_0x2a11a4(++_0x2aae80);}(_0x54ef,0x112));var _0xf54e=function(_0x6da777,_0x1b21ee){_0x6da777=_0x6da777-0x0;var _0x163d5c=_0x54ef[_0x6da777];return _0x163d5c;};'use strict';var moment=require(_0xf54e('0x0'));var Sequelize=require(_0xf54e('0x1'));module[_0xf54e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf54e('0x3')](_0xf54e('0x4'),_0xf54e('0x5'),_0xf54e('0x6')),'allowNull':![],'defaultValue':_0xf54e('0x6')},'transferredAt':{'type':Sequelize[_0xf54e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xf54e('0x8')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 0572f5f..5aa490c 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 _0x7961=['destroy','describe','eml-format','rimraf','request-promise','bluebird','mustache','util','sox','to-csv','ejs','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','sendStatus','status','json','limit','undefined','count','offset','apply','reject','update','then','end','error','stack','name','send','map','ChatTransferReport','rawAttributes','fieldName','type','key','query','keys','filters','model','fields','attributes','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','findAll','rows','catch','show','params','intersection','length','includeAll','find','create','body'];(function(_0x347707,_0x52b9a0){var _0x584cd2=function(_0x5e290b){while(--_0x5e290b){_0x347707['push'](_0x347707['shift']());}};_0x584cd2(++_0x52b9a0);}(_0x7961,0xc2));var _0x1796=function(_0x4a9a1b,_0x2abd10){_0x4a9a1b=_0x4a9a1b-0x0;var _0x351223=_0x7961[_0x4a9a1b];return _0x351223;};'use strict';var emlformat=require(_0x1796('0x0'));var rimraf=require(_0x1796('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1796('0x2'));var moment=require('moment');var BPromise=require(_0x1796('0x3'));var Mustache=require(_0x1796('0x4'));var util=require(_0x1796('0x5'));var path=require('path');var sox=require(_0x1796('0x6'));var csv=require(_0x1796('0x7'));var ejs=require(_0x1796('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x1796('0x9'));var toCsv=require(_0x1796('0x7'));var querystring=require(_0x1796('0xa'));var Papa=require('papaparse');var Redis=require(_0x1796('0xb'));var authService=require(_0x1796('0xc'));var qs=require(_0x1796('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x1796('0xe'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x268b5b,_0xc86016){_0xc86016=_0xc86016||0xcc;return function(_0x52c943){if(_0x52c943){return _0x268b5b[_0x1796('0xf')](_0xc86016);}return _0x268b5b[_0x1796('0x10')](_0xc86016)['end']();};}function respondWithResult(_0xc743b1,_0x5642f2){_0x5642f2=_0x5642f2||0xc8;return function(_0x313251){if(_0x313251){return _0xc743b1[_0x1796('0x10')](_0x5642f2)[_0x1796('0x11')](_0x313251);}};}function respondWithFilteredResult(_0x19b297,_0x257e09){return function(_0x170507){if(_0x170507){var _0xe6e32f=typeof _0x257e09['offset']==='undefined'&&typeof _0x257e09[_0x1796('0x12')]===_0x1796('0x13');var _0x13f367=_0x170507[_0x1796('0x14')];var _0x56f284=_0xe6e32f?0x0:_0x257e09[_0x1796('0x15')];var _0x5370a2=_0xe6e32f?_0x170507[_0x1796('0x14')]:_0x257e09[_0x1796('0x15')]+_0x257e09['limit'];var _0x24cd04;if(_0x5370a2>=_0x13f367){_0x5370a2=_0x13f367;_0x24cd04=0xc8;}else{_0x24cd04=0xce;}_0x19b297['status'](_0x24cd04);return _0x19b297['set']('Content-Range',_0x56f284+'-'+_0x5370a2+'/'+_0x13f367)[_0x1796('0x11')](_0x170507);}return null;};}function patchUpdates(_0x4a3cb5){return function(_0x5a8670){try{jsonpatch[_0x1796('0x16')](_0x5a8670,_0x4a3cb5,!![]);}catch(_0x4ff733){return BPromise[_0x1796('0x17')](_0x4ff733);}return _0x5a8670['save']();};}function saveUpdates(_0x4c9618,_0x3debb1){return function(_0x599b52){if(_0x599b52){return _0x599b52[_0x1796('0x18')](_0x4c9618)['then'](function(_0xdc24da){return _0xdc24da;});}return null;};}function removeEntity(_0x378503,_0x1d93e4){return function(_0x518dee){if(_0x518dee){return _0x518dee['destroy']()[_0x1796('0x19')](function(){_0x378503[_0x1796('0x10')](0xcc)[_0x1796('0x1a')]();});}};}function handleEntityNotFound(_0x247c69,_0x11d12f){return function(_0x78530a){if(!_0x78530a){_0x247c69[_0x1796('0xf')](0x194);}return _0x78530a;};}function handleError(_0x58448a,_0x407a43){_0x407a43=_0x407a43||0x1f4;return function(_0x3debda){logger[_0x1796('0x1b')](_0x3debda[_0x1796('0x1c')]);if(_0x3debda[_0x1796('0x1d')]){delete _0x3debda[_0x1796('0x1d')];}_0x58448a[_0x1796('0x10')](_0x407a43)[_0x1796('0x1e')](_0x3debda);};}exports['index']=function(_0x19db7f,_0xc717fc){var _0x5be478={},_0x180d49={},_0x547fda={'count':0x0,'rows':[]};var _0xe94354=_[_0x1796('0x1f')](db[_0x1796('0x20')][_0x1796('0x21')],function(_0x245728){return{'name':_0x245728[_0x1796('0x22')],'type':_0x245728[_0x1796('0x23')][_0x1796('0x24')]};});_0x180d49['model']=_[_0x1796('0x1f')](_0xe94354,_0x1796('0x1d'));_0x180d49[_0x1796('0x25')]=_[_0x1796('0x26')](_0x19db7f[_0x1796('0x25')]);_0x180d49[_0x1796('0x27')]=_['intersection'](_0x180d49[_0x1796('0x28')],_0x180d49[_0x1796('0x25')]);_0x5be478['attributes']=_['intersection'](_0x180d49['model'],qs[_0x1796('0x29')](_0x19db7f[_0x1796('0x25')]['fields']));_0x5be478['attributes']=_0x5be478[_0x1796('0x2a')]['length']?_0x5be478[_0x1796('0x2a')]:_0x180d49[_0x1796('0x28')];if(!_0x19db7f[_0x1796('0x25')]['hasOwnProperty'](_0x1796('0x2b'))){_0x5be478['limit']=qs[_0x1796('0x12')](_0x19db7f[_0x1796('0x25')][_0x1796('0x12')]);_0x5be478[_0x1796('0x15')]=qs[_0x1796('0x15')](_0x19db7f[_0x1796('0x25')][_0x1796('0x15')]);}_0x5be478['order']=qs[_0x1796('0x2c')](_0x19db7f[_0x1796('0x25')][_0x1796('0x2c')]);_0x5be478['where']=qs[_0x1796('0x27')](_[_0x1796('0x2d')](_0x19db7f[_0x1796('0x25')],_0x180d49['filters']),_0xe94354);if(_0x19db7f[_0x1796('0x25')][_0x1796('0x2e')]){_0x5be478[_0x1796('0x2f')]=_[_0x1796('0x30')](_0x5be478[_0x1796('0x2f')],{'$or':_[_0x1796('0x1f')](_0xe94354,function(_0x5884f6){if(_0x5884f6['type']!==_0x1796('0x31')){var _0x22de0b={};_0x22de0b[_0x5884f6[_0x1796('0x1d')]]={'$like':'%'+_0x19db7f['query'][_0x1796('0x2e')]+'%'};return _0x22de0b;}})});}_0x5be478=_[_0x1796('0x30')]({},_0x5be478,_0x19db7f[_0x1796('0x32')]);var _0x7062d0={'where':_0x5be478[_0x1796('0x2f')]};return db[_0x1796('0x20')][_0x1796('0x14')](_0x7062d0)[_0x1796('0x19')](function(_0x393793){_0x547fda[_0x1796('0x14')]=_0x393793;if(_0x19db7f[_0x1796('0x25')]['includeAll']){_0x5be478['include']=[{'all':!![]}];}return db['ChatTransferReport'][_0x1796('0x33')](_0x5be478);})[_0x1796('0x19')](function(_0x447e43){_0x547fda[_0x1796('0x34')]=_0x447e43;return _0x547fda;})[_0x1796('0x19')](respondWithFilteredResult(_0xc717fc,_0x5be478))[_0x1796('0x35')](handleError(_0xc717fc,null));};exports[_0x1796('0x36')]=function(_0x5730ec,_0x45af20){var _0x10dea3={'raw':!![],'where':{'id':_0x5730ec[_0x1796('0x37')]['id']}},_0xeb3de1={};_0xeb3de1[_0x1796('0x28')]=_[_0x1796('0x26')](db[_0x1796('0x20')]['rawAttributes']);_0xeb3de1[_0x1796('0x25')]=_[_0x1796('0x26')](_0x5730ec['query']);_0xeb3de1['filters']=_[_0x1796('0x38')](_0xeb3de1[_0x1796('0x28')],_0xeb3de1[_0x1796('0x25')]);_0x10dea3[_0x1796('0x2a')]=_[_0x1796('0x38')](_0xeb3de1[_0x1796('0x28')],qs[_0x1796('0x29')](_0x5730ec['query'][_0x1796('0x29')]));_0x10dea3[_0x1796('0x2a')]=_0x10dea3['attributes'][_0x1796('0x39')]?_0x10dea3['attributes']:_0xeb3de1[_0x1796('0x28')];if(_0x5730ec['query'][_0x1796('0x3a')]){_0x10dea3['include']=[{'all':!![]}];}_0x10dea3=_['merge']({},_0x10dea3,_0x5730ec[_0x1796('0x32')]);return db['ChatTransferReport'][_0x1796('0x3b')](_0x10dea3)[_0x1796('0x19')](handleEntityNotFound(_0x45af20,null))['then'](respondWithResult(_0x45af20,null))[_0x1796('0x35')](handleError(_0x45af20,null));};exports[_0x1796('0x3c')]=function(_0x55b7eb,_0x1eb81c){return db['ChatTransferReport']['create'](_0x55b7eb[_0x1796('0x3d')],{})[_0x1796('0x19')](respondWithResult(_0x1eb81c,0xc9))[_0x1796('0x35')](handleError(_0x1eb81c,null));};exports[_0x1796('0x18')]=function(_0x409550,_0x56abdd){if(_0x409550['body']['id']){delete _0x409550['body']['id'];}return db[_0x1796('0x20')]['find']({'where':{'id':_0x409550['params']['id']}})[_0x1796('0x19')](handleEntityNotFound(_0x56abdd,null))[_0x1796('0x19')](saveUpdates(_0x409550[_0x1796('0x3d')],null))[_0x1796('0x19')](respondWithResult(_0x56abdd,null))[_0x1796('0x35')](handleError(_0x56abdd,null));};exports[_0x1796('0x3e')]=function(_0x470e00,_0x4a6d84){return db[_0x1796('0x20')][_0x1796('0x3b')]({'where':{'id':_0x470e00[_0x1796('0x37')]['id']}})[_0x1796('0x19')](handleEntityNotFound(_0x4a6d84,null))[_0x1796('0x19')](removeEntity(_0x4a6d84,null))[_0x1796('0x35')](handleError(_0x4a6d84,null));};exports[_0x1796('0x3f')]=function(_0x5cee8b,_0x22534a){return db[_0x1796('0x20')][_0x1796('0x3f')]()[_0x1796('0x19')](respondWithResult(_0x22534a,null))[_0x1796('0x35')](handleError(_0x22534a,null));}; \ No newline at end of file +var _0xada7=['catch','show','params','keys','rawAttributes','options','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','json','apply','reject','update','then','destroy','stack','name','map','ChatTransferReport','fieldName','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows'];(function(_0x2b0dd6,_0x193396){var _0xe26d06=function(_0x40db51){while(--_0x40db51){_0x2b0dd6['push'](_0x2b0dd6['shift']());}};_0xe26d06(++_0x193396);}(_0xada7,0xe8));var _0x7ada=function(_0x787d1d,_0x345a02){_0x787d1d=_0x787d1d-0x0;var _0x1e56b5=_0xada7[_0x787d1d];return _0x1e56b5;};'use strict';var emlformat=require(_0x7ada('0x0'));var rimraf=require(_0x7ada('0x1'));var zipdir=require(_0x7ada('0x2'));var jsonpatch=require(_0x7ada('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7ada('0x4'));var Mustache=require(_0x7ada('0x5'));var util=require(_0x7ada('0x6'));var path=require(_0x7ada('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7ada('0x8'));var fs=require('fs');var fs_extra=require(_0x7ada('0x9'));var _=require(_0x7ada('0xa'));var squel=require(_0x7ada('0xb'));var crypto=require(_0x7ada('0xc'));var jsforce=require(_0x7ada('0xd'));var deskjs=require(_0x7ada('0xe'));var toCsv=require(_0x7ada('0xf'));var querystring=require(_0x7ada('0x10'));var Papa=require(_0x7ada('0x11'));var Redis=require(_0x7ada('0x12'));var authService=require(_0x7ada('0x13'));var qs=require(_0x7ada('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7ada('0x15'));var logger=require('../../config/logger')(_0x7ada('0x16'));var utils=require(_0x7ada('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7ada('0x18'))['db'];function respondWithStatusCode(_0xbd3c0a,_0x482e48){_0x482e48=_0x482e48||0xcc;return function(_0x2f0706){if(_0x2f0706){return _0xbd3c0a[_0x7ada('0x19')](_0x482e48);}return _0xbd3c0a[_0x7ada('0x1a')](_0x482e48)[_0x7ada('0x1b')]();};}function respondWithResult(_0x463787,_0x1d9168){_0x1d9168=_0x1d9168||0xc8;return function(_0x41f9d4){if(_0x41f9d4){return _0x463787[_0x7ada('0x1a')](_0x1d9168)['json'](_0x41f9d4);}};}function respondWithFilteredResult(_0x1ed1e8,_0x16acdb){return function(_0x3a81fe){if(_0x3a81fe){var _0x4110f4=typeof _0x16acdb['offset']==='undefined'&&typeof _0x16acdb['limit']===_0x7ada('0x1c');var _0x431fb0=_0x3a81fe['count'];var _0x45cd44=_0x4110f4?0x0:_0x16acdb['offset'];var _0x51e519=_0x4110f4?_0x3a81fe[_0x7ada('0x1d')]:_0x16acdb[_0x7ada('0x1e')]+_0x16acdb[_0x7ada('0x1f')];var _0x12ef78;if(_0x51e519>=_0x431fb0){_0x51e519=_0x431fb0;_0x12ef78=0xc8;}else{_0x12ef78=0xce;}_0x1ed1e8['status'](_0x12ef78);return _0x1ed1e8[_0x7ada('0x20')](_0x7ada('0x21'),_0x45cd44+'-'+_0x51e519+'/'+_0x431fb0)[_0x7ada('0x22')](_0x3a81fe);}return null;};}function patchUpdates(_0x5b3e7c){return function(_0x535133){try{jsonpatch[_0x7ada('0x23')](_0x535133,_0x5b3e7c,!![]);}catch(_0x504c26){return BPromise[_0x7ada('0x24')](_0x504c26);}return _0x535133['save']();};}function saveUpdates(_0x1d40ac,_0x225c87){return function(_0x3c709b){if(_0x3c709b){return _0x3c709b[_0x7ada('0x25')](_0x1d40ac)[_0x7ada('0x26')](function(_0x5aa962){return _0x5aa962;});}return null;};}function removeEntity(_0x1c7fd2,_0x18399c){return function(_0x41c657){if(_0x41c657){return _0x41c657[_0x7ada('0x27')]()[_0x7ada('0x26')](function(){_0x1c7fd2[_0x7ada('0x1a')](0xcc)[_0x7ada('0x1b')]();});}};}function handleEntityNotFound(_0x1f6d80,_0x3ac337){return function(_0x597a26){if(!_0x597a26){_0x1f6d80[_0x7ada('0x19')](0x194);}return _0x597a26;};}function handleError(_0x404f35,_0x3c97ef){_0x3c97ef=_0x3c97ef||0x1f4;return function(_0x225c52){logger['error'](_0x225c52[_0x7ada('0x28')]);if(_0x225c52[_0x7ada('0x29')]){delete _0x225c52[_0x7ada('0x29')];}_0x404f35[_0x7ada('0x1a')](_0x3c97ef)['send'](_0x225c52);};}exports['index']=function(_0x4376e0,_0x29b889){var _0x553202={},_0x5290c6={},_0xa699fe={'count':0x0,'rows':[]};var _0x33f32c=_[_0x7ada('0x2a')](db[_0x7ada('0x2b')]['rawAttributes'],function(_0x1e9de5){return{'name':_0x1e9de5[_0x7ada('0x2c')],'type':_0x1e9de5['type'][_0x7ada('0x2d')]};});_0x5290c6[_0x7ada('0x2e')]=_[_0x7ada('0x2a')](_0x33f32c,_0x7ada('0x29'));_0x5290c6[_0x7ada('0x2f')]=_['keys'](_0x4376e0[_0x7ada('0x2f')]);_0x5290c6[_0x7ada('0x30')]=_[_0x7ada('0x31')](_0x5290c6[_0x7ada('0x2e')],_0x5290c6[_0x7ada('0x2f')]);_0x553202[_0x7ada('0x32')]=_[_0x7ada('0x31')](_0x5290c6[_0x7ada('0x2e')],qs[_0x7ada('0x33')](_0x4376e0[_0x7ada('0x2f')][_0x7ada('0x33')]));_0x553202['attributes']=_0x553202['attributes'][_0x7ada('0x34')]?_0x553202[_0x7ada('0x32')]:_0x5290c6[_0x7ada('0x2e')];if(!_0x4376e0[_0x7ada('0x2f')]['hasOwnProperty'](_0x7ada('0x35'))){_0x553202[_0x7ada('0x1f')]=qs['limit'](_0x4376e0[_0x7ada('0x2f')][_0x7ada('0x1f')]);_0x553202['offset']=qs[_0x7ada('0x1e')](_0x4376e0[_0x7ada('0x2f')][_0x7ada('0x1e')]);}_0x553202[_0x7ada('0x36')]=qs['sort'](_0x4376e0['query'][_0x7ada('0x37')]);_0x553202[_0x7ada('0x38')]=qs['filters'](_[_0x7ada('0x39')](_0x4376e0[_0x7ada('0x2f')],_0x5290c6['filters']),_0x33f32c);if(_0x4376e0['query'][_0x7ada('0x3a')]){_0x553202[_0x7ada('0x38')]=_[_0x7ada('0x3b')](_0x553202[_0x7ada('0x38')],{'$or':_['map'](_0x33f32c,function(_0x218e09){if(_0x218e09['type']!==_0x7ada('0x3c')){var _0x4c89d7={};_0x4c89d7[_0x218e09['name']]={'$like':'%'+_0x4376e0[_0x7ada('0x2f')][_0x7ada('0x3a')]+'%'};return _0x4c89d7;}})});}_0x553202=_[_0x7ada('0x3b')]({},_0x553202,_0x4376e0['options']);var _0x506e04={'where':_0x553202[_0x7ada('0x38')]};return db[_0x7ada('0x2b')][_0x7ada('0x1d')](_0x506e04)[_0x7ada('0x26')](function(_0x4011bb){_0xa699fe[_0x7ada('0x1d')]=_0x4011bb;if(_0x4376e0[_0x7ada('0x2f')][_0x7ada('0x3d')]){_0x553202['include']=[{'all':!![]}];}return db[_0x7ada('0x2b')][_0x7ada('0x3e')](_0x553202);})['then'](function(_0x33c413){_0xa699fe[_0x7ada('0x3f')]=_0x33c413;return _0xa699fe;})[_0x7ada('0x26')](respondWithFilteredResult(_0x29b889,_0x553202))[_0x7ada('0x40')](handleError(_0x29b889,null));};exports[_0x7ada('0x41')]=function(_0x500fc9,_0x338cb3){var _0x258890={'raw':!![],'where':{'id':_0x500fc9[_0x7ada('0x42')]['id']}},_0x385d1d={};_0x385d1d[_0x7ada('0x2e')]=_[_0x7ada('0x43')](db[_0x7ada('0x2b')][_0x7ada('0x44')]);_0x385d1d[_0x7ada('0x2f')]=_[_0x7ada('0x43')](_0x500fc9[_0x7ada('0x2f')]);_0x385d1d[_0x7ada('0x30')]=_[_0x7ada('0x31')](_0x385d1d[_0x7ada('0x2e')],_0x385d1d[_0x7ada('0x2f')]);_0x258890['attributes']=_['intersection'](_0x385d1d[_0x7ada('0x2e')],qs['fields'](_0x500fc9[_0x7ada('0x2f')][_0x7ada('0x33')]));_0x258890[_0x7ada('0x32')]=_0x258890['attributes'][_0x7ada('0x34')]?_0x258890[_0x7ada('0x32')]:_0x385d1d['model'];if(_0x500fc9[_0x7ada('0x2f')][_0x7ada('0x3d')]){_0x258890['include']=[{'all':!![]}];}_0x258890=_['merge']({},_0x258890,_0x500fc9[_0x7ada('0x45')]);return db['ChatTransferReport']['find'](_0x258890)['then'](handleEntityNotFound(_0x338cb3,null))[_0x7ada('0x26')](respondWithResult(_0x338cb3,null))['catch'](handleError(_0x338cb3,null));};exports['create']=function(_0x261c9c,_0x51f335){return db[_0x7ada('0x2b')][_0x7ada('0x46')](_0x261c9c['body'],{})[_0x7ada('0x26')](respondWithResult(_0x51f335,0xc9))[_0x7ada('0x40')](handleError(_0x51f335,null));};exports['update']=function(_0x3be730,_0x360747){if(_0x3be730[_0x7ada('0x47')]['id']){delete _0x3be730[_0x7ada('0x47')]['id'];}return db[_0x7ada('0x2b')]['find']({'where':{'id':_0x3be730[_0x7ada('0x42')]['id']}})[_0x7ada('0x26')](handleEntityNotFound(_0x360747,null))['then'](saveUpdates(_0x3be730['body'],null))[_0x7ada('0x26')](respondWithResult(_0x360747,null))[_0x7ada('0x40')](handleError(_0x360747,null));};exports[_0x7ada('0x27')]=function(_0x1aa81a,_0xdc6750){return db[_0x7ada('0x2b')][_0x7ada('0x48')]({'where':{'id':_0x1aa81a['params']['id']}})[_0x7ada('0x26')](handleEntityNotFound(_0xdc6750,null))[_0x7ada('0x26')](removeEntity(_0xdc6750,null))[_0x7ada('0x40')](handleError(_0xdc6750,null));};exports['describe']=function(_0x451b6f,_0xe61fc5){return db['ChatTransferReport'][_0x7ada('0x49')]()[_0x7ada('0x26')](respondWithResult(_0xe61fc5,null))[_0x7ada('0x40')](handleError(_0xe61fc5,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 3ba1010..55ca6c9 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 _0x9834=['api','moment','bluebird','request-promise','rimraf','../../config/environment','define','ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','../../config/logger'];(function(_0x383339,_0x3d185b){var _0x1f5132=function(_0x4dfa59){while(--_0x4dfa59){_0x383339['push'](_0x383339['shift']());}};_0x1f5132(++_0x3d185b);}(_0x9834,0xa6));var _0x4983=function(_0x42abad,_0x301cd9){_0x42abad=_0x42abad-0x0;var _0x54b1f9=_0x9834[_0x42abad];return _0x54b1f9;};'use strict';var _=require(_0x4983('0x0'));var util=require(_0x4983('0x1'));var logger=require(_0x4983('0x2'))(_0x4983('0x3'));var moment=require(_0x4983('0x4'));var BPromise=require(_0x4983('0x5'));var rp=require(_0x4983('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4983('0x7'));var config=require(_0x4983('0x8'));var attributes=require('./chatTransferReport.attributes');module['exports']=function(_0x341634,_0x108eef){return _0x341634[_0x4983('0x9')](_0x4983('0xa'),attributes,{'tableName':_0x4983('0xb'),'paranoid':![],'indexes':[{'name':_0x4983('0xc'),'fields':[_0x4983('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x29df=['ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','api','moment','request-promise','rimraf','../../config/environment','./chatTransferReport.attributes','exports'];(function(_0x227051,_0x266310){var _0x4852e1=function(_0xdb39d4){while(--_0xdb39d4){_0x227051['push'](_0x227051['shift']());}};_0x4852e1(++_0x266310);}(_0x29df,0x1d7));var _0xf29d=function(_0x11ea5f,_0x2fd42a){_0x11ea5f=_0x11ea5f-0x0;var _0x1bc6c8=_0x29df[_0x11ea5f];return _0x1bc6c8;};'use strict';var _=require(_0xf29d('0x0'));var util=require(_0xf29d('0x1'));var logger=require('../../config/logger')(_0xf29d('0x2'));var moment=require(_0xf29d('0x3'));var BPromise=require('bluebird');var rp=require(_0xf29d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf29d('0x5'));var config=require(_0xf29d('0x6'));var attributes=require(_0xf29d('0x7'));module[_0xf29d('0x8')]=function(_0x914cfd,_0x36641d){return _0x914cfd['define'](_0xf29d('0x9'),attributes,{'tableName':_0xf29d('0xa'),'paranoid':![],'indexes':[{'name':_0xf29d('0xb'),'fields':[_0xf29d('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 0cf4411..2f76dd4 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 _0xca99=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','lodash','moment','ioredis','../../mysqldb'];(function(_0x11095b,_0x187357){var _0x4879d9=function(_0x401e5a){while(--_0x401e5a){_0x11095b['push'](_0x11095b['shift']());}};_0x4879d9(++_0x187357);}(_0xca99,0xee));var _0x9ca9=function(_0x756af5,_0x35834c){_0x756af5=_0x756af5-0x0;var _0x1e8aff=_0xca99[_0x756af5];return _0x1e8aff;};'use strict';var _=require(_0x9ca9('0x0'));var util=require('util');var moment=require(_0x9ca9('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9ca9('0x2'));var db=require(_0x9ca9('0x3'))['db'];var utils=require(_0x9ca9('0x4'));var logger=require(_0x9ca9('0x5'))(_0x9ca9('0x6'));var config=require(_0x9ca9('0x7'));var jayson=require(_0x9ca9('0x8'));var client=jayson[_0x9ca9('0x9')][_0x9ca9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5b2073,_0x5c3bd0,_0xff2871){return new BPromise(function(_0x5e21af,_0x470672){return client[_0x9ca9('0xb')](_0x5b2073,_0xff2871)[_0x9ca9('0xc')](function(_0x336d4a){logger['info'](_0x9ca9('0xd'),_0x5c3bd0,_0x9ca9('0xe'));logger[_0x9ca9('0xf')](_0x9ca9('0x10'),_0x5c3bd0,_0x9ca9('0xe'),JSON['stringify'](_0x336d4a));if(_0x336d4a['error']){if(_0x336d4a[_0x9ca9('0x11')]['code']===0x1f4){logger[_0x9ca9('0x11')](_0x9ca9('0xd'),_0x5c3bd0,_0x336d4a[_0x9ca9('0x11')]['message']);return _0x470672(_0x336d4a[_0x9ca9('0x11')][_0x9ca9('0x12')]);}logger['error']('ChatTransferReport,\x20%s,\x20%s',_0x5c3bd0,_0x336d4a[_0x9ca9('0x11')][_0x9ca9('0x12')]);return _0x5e21af(_0x336d4a['error'][_0x9ca9('0x12')]);}else{logger[_0x9ca9('0x13')](_0x9ca9('0xd'),_0x5c3bd0,'request\x20sent');_0x5e21af(_0x336d4a[_0x9ca9('0x14')][_0x9ca9('0x12')]);}})[_0x9ca9('0x15')](function(_0x3f20d3){logger[_0x9ca9('0x11')](_0x9ca9('0xd'),_0x5c3bd0,_0x3f20d3);_0x470672(_0x3f20d3);});});} \ No newline at end of file +var _0x99a9=['error','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x50977c,_0x728c3d){var _0x56b1c3=function(_0x4c2692){while(--_0x4c2692){_0x50977c['push'](_0x50977c['shift']());}};_0x56b1c3(++_0x728c3d);}(_0x99a9,0x18b));var _0x999a=function(_0x376613,_0x5aa7b3){_0x376613=_0x376613-0x0;var _0x24f4c5=_0x99a9[_0x376613];return _0x24f4c5;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x999a('0x0'));var BPromise=require(_0x999a('0x1'));var rs=require(_0x999a('0x2'));var fs=require('fs');var Redis=require(_0x999a('0x3'));var db=require(_0x999a('0x4'))['db'];var utils=require(_0x999a('0x5'));var logger=require(_0x999a('0x6'))(_0x999a('0x7'));var config=require(_0x999a('0x8'));var jayson=require(_0x999a('0x9'));var client=jayson[_0x999a('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x55145f,_0x4e59c5,_0x3070b0){return new BPromise(function(_0x5f15e5,_0x39b203){return client[_0x999a('0xb')](_0x55145f,_0x3070b0)[_0x999a('0xc')](function(_0x38f1f3){logger[_0x999a('0xd')](_0x999a('0xe'),_0x4e59c5,_0x999a('0xf'));logger[_0x999a('0x10')](_0x999a('0x11'),_0x4e59c5,_0x999a('0xf'),JSON[_0x999a('0x12')](_0x38f1f3));if(_0x38f1f3[_0x999a('0x13')]){if(_0x38f1f3['error']['code']===0x1f4){logger[_0x999a('0x13')](_0x999a('0xe'),_0x4e59c5,_0x38f1f3[_0x999a('0x13')][_0x999a('0x14')]);return _0x39b203(_0x38f1f3['error']['message']);}logger['error'](_0x999a('0xe'),_0x4e59c5,_0x38f1f3[_0x999a('0x13')]['message']);return _0x5f15e5(_0x38f1f3['error']['message']);}else{logger['info'](_0x999a('0xe'),_0x4e59c5,'request\x20sent');_0x5f15e5(_0x38f1f3[_0x999a('0x15')][_0x999a('0x14')]);}})[_0x999a('0x16')](function(_0x22d267){logger[_0x999a('0x13')](_0x999a('0xe'),_0x4e59c5,_0x22d267);_0x39b203(_0x22d267);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 37d7d09..7d97083 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 _0x4ac4=['Router','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','destroy','exports','util','path','connect-timeout','express'];(function(_0x3644a2,_0x2c7588){var _0x5e62ef=function(_0x356aac){while(--_0x356aac){_0x3644a2['push'](_0x3644a2['shift']());}};_0x5e62ef(++_0x2c7588);}(_0x4ac4,0x18b));var _0x44ac=function(_0x2e0da3,_0x3492f3){_0x2e0da3=_0x2e0da3-0x0;var _0x1ec9f1=_0x4ac4[_0x2e0da3];return _0x1ec9f1;};'use strict';var multer=require('multer');var util=require(_0x44ac('0x0'));var path=require(_0x44ac('0x1'));var timeout=require(_0x44ac('0x2'));var express=require(_0x44ac('0x3'));var router=express[_0x44ac('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x44ac('0x5'));var controller=require(_0x44ac('0x6'));router[_0x44ac('0x7')]('/',auth[_0x44ac('0x8')](),controller[_0x44ac('0x9')]);router[_0x44ac('0x7')](_0x44ac('0xa'),auth['isAuthenticated'](),controller[_0x44ac('0xb')]);router[_0x44ac('0x7')](_0x44ac('0xc'),auth[_0x44ac('0x8')](),controller[_0x44ac('0xd')]);router[_0x44ac('0xe')]('/',auth[_0x44ac('0x8')](),controller[_0x44ac('0xf')]);router['put'](_0x44ac('0xc'),auth[_0x44ac('0x8')](),controller[_0x44ac('0x10')]);router['delete'](_0x44ac('0xc'),auth['isAuthenticated'](),controller[_0x44ac('0x11')]);module[_0x44ac('0x12')]=router; \ No newline at end of file +var _0x944f=['post','isAuthenticated','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','/describe','describe','/:id','show'];(function(_0x3e7e96,_0x5683ca){var _0x13f6f0=function(_0x320767){while(--_0x320767){_0x3e7e96['push'](_0x3e7e96['shift']());}};_0x13f6f0(++_0x5683ca);}(_0x944f,0xe3));var _0xf944=function(_0x58b3ca,_0x4183bc){_0x58b3ca=_0x58b3ca-0x0;var _0x1dfab9=_0x944f[_0x58b3ca];return _0x1dfab9;};'use strict';var multer=require(_0xf944('0x0'));var util=require(_0xf944('0x1'));var path=require(_0xf944('0x2'));var timeout=require(_0xf944('0x3'));var express=require(_0xf944('0x4'));var router=express['Router']();var fs_extra=require(_0xf944('0x5'));var auth=require(_0xf944('0x6'));var interaction=require(_0xf944('0x7'));var config=require(_0xf944('0x8'));var controller=require(_0xf944('0x9'));router[_0xf944('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xf944('0xa')](_0xf944('0xb'),auth['isAuthenticated'](),controller[_0xf944('0xc')]);router['get'](_0xf944('0xd'),auth['isAuthenticated'](),controller[_0xf944('0xe')]);router[_0xf944('0xf')]('/',auth[_0xf944('0x10')](),controller['create']);router[_0xf944('0x11')]('/:id',auth[_0xf944('0x10')](),controller[_0xf944('0x12')]);router[_0xf944('0x13')](_0xf944('0xd'),auth[_0xf944('0x10')](),controller[_0xf944('0x14')]);module[_0xf944('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 c724c01..732e28b 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 _0xee39=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','exports','STRING','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','Chat','Send','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','star','thumb','stringify','input','name','getDataValue','onlineForm','setDataValue','Comments','Leave\x20your\x20comments','offlineForm','parse','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','CHAT','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x63b08a,_0x11cc57){var _0x45b548=function(_0x5e33c1){while(--_0x5e33c1){_0x63b08a['push'](_0x63b08a['shift']());}};_0x45b548(++_0x11cc57);}(_0xee39,0x130));var _0x9ee3=function(_0x2b8d5f,_0x28b968){_0x2b8d5f=_0x2b8d5f-0x0;var _0x4476bd=_0xee39[_0x2b8d5f];return _0x4476bd;};'use strict';var Sequelize=require(_0x9ee3('0x0'));var rs=require(_0x9ee3('0x1'));module[_0x9ee3('0x2')]={'name':{'type':Sequelize[_0x9ee3('0x3')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':'address'},'description':{'type':Sequelize[_0x9ee3('0x3')]},'mapKey':{'type':Sequelize[_0x9ee3('0x3')],'defaultValue':_0x9ee3('0x4')},'mapKeyOffline':{'type':Sequelize[_0x9ee3('0x3')],'defaultValue':_0x9ee3('0x4')},'key':{'type':Sequelize[_0x9ee3('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0x9ee3('0x5')},'customerAlias':{'type':Sequelize[_0x9ee3('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x9ee3('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x9ee3('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x9ee3('0x3')],'allowNull':![],'defaultValue':_0x9ee3('0x7'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x9ee3('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x9ee3('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize[_0x9ee3('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x9ee3('0xa')](_0x9ee3('0xb'),'squared'),'defaultValue':_0x9ee3('0xb')},'header_online':{'type':Sequelize['STRING'],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize[_0x9ee3('0x3')],'defaultValue':_0x9ee3('0xc')},'offline_chat_button':{'type':Sequelize[_0x9ee3('0x3')],'defaultValue':_0x9ee3('0xd')},'header_offline':{'type':Sequelize[_0x9ee3('0x3')],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize[_0x9ee3('0x9')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x9ee3('0x8')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x9ee3('0x3')],'defaultValue':_0x9ee3('0xe')},'defaultWhiteLabel':{'type':Sequelize[_0x9ee3('0x9')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x9ee3('0xf')]},'closingQuestion':{'type':Sequelize[_0x9ee3('0x3')],'defaultValue':_0x9ee3('0x10')},'formSubmitSuccessMessage':{'type':Sequelize[_0x9ee3('0x3')],'defaultValue':_0x9ee3('0x11')},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':_0x9ee3('0x12')},'noteTitle':{'type':Sequelize[_0x9ee3('0x3')],'defaultValue':_0x9ee3('0x13')},'placeholderMessage':{'type':Sequelize[_0x9ee3('0x3')],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0x9ee3('0x3')],'defaultValue':_0x9ee3('0x14')},'closingMessageButton':{'type':Sequelize[_0x9ee3('0x3')],'defaultValue':_0x9ee3('0xd')},'skipMessageButton':{'type':Sequelize[_0x9ee3('0x3')],'defaultValue':_0x9ee3('0x15')},'conditionAgreement':{'type':Sequelize[_0x9ee3('0x9')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x9ee3('0x9')],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x9ee3('0x9')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x9ee3('0x3')],'defaultValue':_0x9ee3('0x16')},'ratingType':{'type':Sequelize['ENUM'](_0x9ee3('0x17'),_0x9ee3('0x18')),'defaultValue':_0x9ee3('0x17')},'ratingStarsNumber':{'type':Sequelize[_0x9ee3('0x8')],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x9ee3('0x19')]({'items':[{'type':_0x9ee3('0x1a'),'variable':null,'config':{'placeholder':_0x9ee3('0x1b'),'type':'text','required':!![]},'props':{'title':'name','helpText':''}},{'type':_0x9ee3('0x1a'),'props':{'title':_0x9ee3('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x9ee3('0x4'),'type':_0x9ee3('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x9ee3('0x1c')](_0x9ee3('0x1d'))?JSON['parse'](this['getDataValue'](_0x9ee3('0x1d'))):{};},'set':function(_0x2bc408){return this[_0x9ee3('0x1e')](_0x9ee3('0x1d'),JSON[_0x9ee3('0x19')](_0x2bc408));}},'offlineForm':{'type':Sequelize[_0x9ee3('0xf')],'defaultValue':function(){return JSON[_0x9ee3('0x19')]({'items':[{'type':'input','props':{'title':_0x9ee3('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x9ee3('0x4'),'type':'email'},'variable':null},{'type':'textarea','config':{'placeholder':_0x9ee3('0x1f')},'props':{'title':_0x9ee3('0x1f'),'helpText':_0x9ee3('0x20')}}],'fromKey':0x0});},'get':function(){return this[_0x9ee3('0x1c')](_0x9ee3('0x21'))?JSON[_0x9ee3('0x22')](this[_0x9ee3('0x1c')](_0x9ee3('0x21'))):{};},'set':function(_0xf02be){return this['setDataValue']('offlineForm',JSON[_0x9ee3('0x19')](_0xf02be));}},'token':{'type':Sequelize[_0x9ee3('0x3')],'defaultValue':function(){return rs[_0x9ee3('0x23')]();}},'autoclose':{'type':Sequelize[_0x9ee3('0x9')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x9ee3('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x9ee3('0x9')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x9ee3('0x3')]},'forwardOffline':{'type':Sequelize[_0x9ee3('0x9')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x9ee3('0x3')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':_0x9ee3('0x24')},'waitingMessage':{'type':Sequelize[_0x9ee3('0x3')],'defaultValue':_0x9ee3('0x25')},'offlineMessageSubject':{'type':Sequelize[_0x9ee3('0x3')],'defaultValue':_0x9ee3('0x26')},'offlineMessageBody':{'type':Sequelize[_0x9ee3('0x3')],'defaultValue':_0x9ee3('0x27')},'enableUnmanagedNote':{'type':Sequelize[_0x9ee3('0x9')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x9ee3('0x3')],'defaultValue':_0x9ee3('0x28')},'skipUnmanaged':{'type':Sequelize[_0x9ee3('0x3')],'defaultValue':_0x9ee3('0x15')},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize[_0x9ee3('0x9')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x9ee3('0x9')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x9ee3('0xf')]},'showAgentAvatar':{'type':Sequelize[_0x9ee3('0x9')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x9ee3('0x3')]},'notificationTemplate':{'type':Sequelize[_0x9ee3('0xf')],'defaultValue':function(){return _0x9ee3('0x29');}},'notificationSound':{'type':Sequelize[_0x9ee3('0x9')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x9ee3('0x9')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize[_0x9ee3('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize[_0x9ee3('0x8')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x9ee3('0x3')],'defaultValue':_0x9ee3('0x2a')},'messagesAlignment':{'type':Sequelize[_0x9ee3('0x3')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0x9ee3('0x3')]},'customerAvatar':{'type':Sequelize[_0x9ee3('0xf')]},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x9ee3('0x8')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x9ee3('0x3')],'allowNull':![],'defaultValue':_0x9ee3('0x2b'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x9ee3('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x9ee3('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x9ee3('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x9ee3('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x9ee3('0x3')],'defaultValue':_0x9ee3('0x2c')},'systemAvatar':{'type':Sequelize[_0x9ee3('0xf')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x9ee3('0x8')],'comment':_0x9ee3('0x2d')},'mandatoryDisposition':{'type':Sequelize[_0x9ee3('0x9')],'defaultValue':![],'comment':_0x9ee3('0x2e'),'set':function(_0x5d7af6){if(!_0x5d7af6)this[_0x9ee3('0x1e')](_0x9ee3('0x2f'),null);this[_0x9ee3('0x1e')]('mandatoryDisposition',_0x5d7af6);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x9ee3('0x3')]},'vidaooTopic':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x9ee3('0x30')},'vidaooNote':{'type':Sequelize[_0x9ee3('0x3')],'defaultValue':function(){return _0x9ee3('0x31');}},'vidaooMetadata':{'type':Sequelize[_0x9ee3('0xf')],'defaultValue':null},'openNewInteraction':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xf0c9=['setDataValue','stringify','textarea','Comments','Leave\x20your\x20comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Send','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','CHAT','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','Generated\x20by\x20XCALLY\x20Motion','sequelize','randomstring','exports','STRING','address','Agent','#011F6A','#ffffff','INTEGER','ENUM','rounded','We\x20are\x20here!','Contact\x20us','BOOLEAN','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20submission\x20error','Note','Skip','Feedback','star','thumb','input','name','text','email','getDataValue','parse','onlineForm'];(function(_0x20aae1,_0x51efd4){var _0x510601=function(_0x20895f){while(--_0x20895f){_0x20aae1['push'](_0x20aae1['shift']());}};_0x510601(++_0x51efd4);}(_0xf0c9,0x11a));var _0x9f0c=function(_0xe7ba9,_0x2ff262){_0xe7ba9=_0xe7ba9-0x0;var _0x34e6bd=_0xf0c9[_0xe7ba9];return _0x34e6bd;};'use strict';var Sequelize=require(_0x9f0c('0x0'));var rs=require(_0x9f0c('0x1'));module[_0x9f0c('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize[_0x9f0c('0x3')],'allowNull':![],'unique':_0x9f0c('0x4')},'description':{'type':Sequelize[_0x9f0c('0x3')]},'mapKey':{'type':Sequelize[_0x9f0c('0x3')],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':'email'},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x9f0c('0x3')],'defaultValue':_0x9f0c('0x5')},'customerAlias':{'type':Sequelize[_0x9f0c('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x9f0c('0x3')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x9f0c('0x3')],'allowNull':![],'defaultValue':_0x9f0c('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x9f0c('0x7'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x9f0c('0x3')],'allowNull':![],'defaultValue':_0x9f0c('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x9f0c('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x9f0c('0x3')]},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x9f0c('0x9')](_0x9f0c('0xa'),'squared'),'defaultValue':'rounded'},'header_online':{'type':Sequelize[_0x9f0c('0x3')],'defaultValue':_0x9f0c('0xb')},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':'Send'},'header_offline':{'type':Sequelize[_0x9f0c('0x3')],'defaultValue':_0x9f0c('0xc')},'download_transcript':{'type':Sequelize[_0x9f0c('0xd')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x9f0c('0x8')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x9f0c('0x3')],'defaultValue':_0x9f0c('0xe')},'defaultWhiteLabel':{'type':Sequelize[_0x9f0c('0xd')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x9f0c('0xf')]},'closingQuestion':{'type':Sequelize[_0x9f0c('0x3')],'defaultValue':_0x9f0c('0x10')},'formSubmitSuccessMessage':{'type':Sequelize[_0x9f0c('0x3')],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0x9f0c('0x3')],'defaultValue':_0x9f0c('0x11')},'noteTitle':{'type':Sequelize[_0x9f0c('0x3')],'defaultValue':_0x9f0c('0x12')},'placeholderMessage':{'type':Sequelize[_0x9f0c('0x3')],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0x9f0c('0x3')],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0x9f0c('0x3')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize[_0x9f0c('0x3')],'defaultValue':_0x9f0c('0x13')},'conditionAgreement':{'type':Sequelize[_0x9f0c('0xd')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x9f0c('0xd')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x9f0c('0xd')],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x9f0c('0x3')],'defaultValue':_0x9f0c('0x14')},'ratingType':{'type':Sequelize[_0x9f0c('0x9')](_0x9f0c('0x15'),_0x9f0c('0x16')),'defaultValue':_0x9f0c('0x15')},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x9f0c('0xf')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x9f0c('0x17'),'variable':null,'config':{'placeholder':_0x9f0c('0x18'),'type':_0x9f0c('0x19'),'required':!![]},'props':{'title':_0x9f0c('0x18'),'helpText':''}},{'type':_0x9f0c('0x17'),'props':{'title':_0x9f0c('0x1a'),'helpText':''},'config':{'required':!![],'placeholder':_0x9f0c('0x1a'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x9f0c('0x1b')]('onlineForm')?JSON[_0x9f0c('0x1c')](this[_0x9f0c('0x1b')](_0x9f0c('0x1d'))):{};},'set':function(_0x30f84d){return this[_0x9f0c('0x1e')](_0x9f0c('0x1d'),JSON[_0x9f0c('0x1f')](_0x30f84d));}},'offlineForm':{'type':Sequelize[_0x9f0c('0xf')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x9f0c('0x17'),'props':{'title':_0x9f0c('0x1a'),'helpText':''},'config':{'required':!![],'placeholder':_0x9f0c('0x1a'),'type':_0x9f0c('0x1a')},'variable':null},{'type':_0x9f0c('0x20'),'config':{'placeholder':_0x9f0c('0x21')},'props':{'title':'Comments','helpText':_0x9f0c('0x22')}}],'fromKey':0x0});},'get':function(){return this[_0x9f0c('0x1b')](_0x9f0c('0x23'))?JSON['parse'](this[_0x9f0c('0x1b')](_0x9f0c('0x23'))):{};},'set':function(_0x2347b8){return this['setDataValue'](_0x9f0c('0x23'),JSON[_0x9f0c('0x1f')](_0x2347b8));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x9f0c('0x24')]();}},'autoclose':{'type':Sequelize[_0x9f0c('0xd')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x9f0c('0xd')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x9f0c('0x3')]},'forwardOffline':{'type':Sequelize[_0x9f0c('0xd')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x9f0c('0x3')]},'waitingTitle':{'type':Sequelize[_0x9f0c('0x3')],'defaultValue':_0x9f0c('0x25')},'waitingMessage':{'type':Sequelize[_0x9f0c('0x3')],'defaultValue':_0x9f0c('0x26')},'offlineMessageSubject':{'type':Sequelize[_0x9f0c('0x3')],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0x9f0c('0x3')],'defaultValue':_0x9f0c('0x27')},'enableUnmanagedNote':{'type':Sequelize[_0x9f0c('0xd')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x9f0c('0x3')],'defaultValue':_0x9f0c('0x28')},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x9f0c('0x13')},'sendUnmanaged':{'type':Sequelize[_0x9f0c('0x3')],'defaultValue':_0x9f0c('0x29')},'enableCustomerAttachment':{'type':Sequelize[_0x9f0c('0xd')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x9f0c('0xf')]},'showAgentAvatar':{'type':Sequelize[_0x9f0c('0xd')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x9f0c('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x9f0c('0x2a');}},'notificationSound':{'type':Sequelize[_0x9f0c('0xd')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x9f0c('0xd')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x9f0c('0xd')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x9f0c('0x3')],'defaultValue':_0x9f0c('0x2b')},'waitForTheAssignedAgent':{'type':Sequelize[_0x9f0c('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x9f0c('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x9f0c('0x3')],'defaultValue':_0x9f0c('0x2c')},'verticalAlignment':{'type':Sequelize[_0x9f0c('0x8')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x9f0c('0x3')],'defaultValue':_0x9f0c('0x2d')},'messagesAlignment':{'type':Sequelize[_0x9f0c('0x3')],'defaultValue':_0x9f0c('0x2e')},'defaultTitle':{'type':Sequelize[_0x9f0c('0x3')]},'customerAvatar':{'type':Sequelize[_0x9f0c('0xf')]},'showCustomerAvatar':{'type':Sequelize[_0x9f0c('0xd')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x9f0c('0x8')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x9f0c('0x3')],'allowNull':![],'defaultValue':_0x9f0c('0x2f'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x9f0c('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x9f0c('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x9f0c('0x3')],'defaultValue':_0x9f0c('0x30')},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x9f0c('0x8')],'comment':_0x9f0c('0x31')},'mandatoryDisposition':{'type':Sequelize[_0x9f0c('0xd')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x21a336){if(!_0x21a336)this[_0x9f0c('0x1e')](_0x9f0c('0x32'),null);this[_0x9f0c('0x1e')]('mandatoryDisposition',_0x21a336);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x9f0c('0x3')]},'vidaooTopic':{'type':Sequelize[_0x9f0c('0x3')],'allowNull':![],'defaultValue':_0x9f0c('0x33')},'vidaooNote':{'type':Sequelize[_0x9f0c('0x3')],'defaultValue':function(){return'Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}';}},'vidaooMetadata':{'type':Sequelize['TEXT'],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x9f0c('0xd')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 86dd74c..26721b3 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 _0x738a=['startRouting','EventManager','offline','files','no\x20available\x20attributes','difference','CompanyId','Sequelize','from\x20is\x20mandatory','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','mimetype','server','attachments','basename','openNewInteraction','sequelize','Attachment','bulkCreate','MailAccount','MailServerOut','CloudProvider','Smtp','forwardOffline','forwardOfflineAddress','\x22%s\x22\x20<%s>','email','offlineMessageSubject','MailAccountId','originalname','subjectOffline','Chat','NotifyMailAccount','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Owner','fullname','internal','Tag','Tags','tag','getSnippet','Intervals','getProactiveActions','License','increment','timezone','readFileSync','server/files/chat/iframe.ejs','origin','http://localhost:9000','testWebsiteWithWildcard','remote','connection','remoteAddress','virtual','replace','verticalAlignment','color','textButtonColor','color_button','hideWhenOffline','IntervalId','addApplications','transaction','finally','sendStatus','getApplications','addProactiveActions','ChatProactiveAction','getFields','online','offlineForm','fromKey','getOfflineMessages','Contact','addAgents','emit','userChatWebsite:save','userChatWebsite:remove','getAgents','path','fs-extra','lodash','querystring','html-to-text','ioredis','jayson/promise','../../components/parsers/qs','../../config/environment','../../errors/api','APIBadRequestError','APINotFoundError','APIOutOfIntervalError','APIConflictError','./helpers/wildcard-expressions','url','URL','../../mysqldb','redis','./chatWebsite.socket','register','client','http','request','info','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','ChatWebsite,\x20%s,\x20%s','message','result','catch','status','end','json','offset','undefined','count','limit','set','update','then','destroy','get','UserProfileResource','stack','name','send','user-agent-parser','setUA','user-agent','customerIp','cf-connecting-ip','x-forwarded-for','first','split','firstName','lastName','x-real-port','referer','browser','format','version','unknown','%s\x20%s','device','model','vendor','type','index','Pause','map','rawAttributes','fieldName','key','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','ChatWebsite','findAll','show','params','mandatoryDispositionPause','fields','include','find','body','address','forEach','trim','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','ChatWebsites','UserProfileSection','autoAssociation','testWildcardValidity','\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression','describe','addDisposition','ChatWebsiteId','getDispositions','Disposition','includeAll','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','filename','addAvatar','agentAvatar','file','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','join','server/files/images/logos/default_logo.svg','sitepic','../../config/license/util','getLicense','custom','isNil','existsSync','root','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','server/files/images/avatars/system_avatar.png','resolve','ifTime','notify','chat','from','From\x20is\x20mandatory','mapKey','MapKey\x20is\x20mandatory','isEmpty','Body\x20is\x20mandatory','CmContact','No\x20available\x20attributes','updatedAt','createdAt','ListId','includes','CmList','List','Contacts','ChatApplication','Applications','Interval','interval','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','account','applications','priority','asc','list','defaults','contact','headers','threadId','closed','ChatInteraction','Writing\x20on\x20closed\x20interaction','ContactId','interaction','messageId','created','push','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','forcedOwnership','ChatQueue','queueId','queue','Start'];(function(_0x13c19c,_0x1d4a84){var _0x594ee4=function(_0x326bb8){while(--_0x326bb8){_0x13c19c['push'](_0x13c19c['shift']());}};_0x594ee4(++_0x1d4a84);}(_0x738a,0x187));var _0xa738=function(_0x35ce13,_0x12d22b){_0x35ce13=_0x35ce13-0x0;var _0x2addc6=_0x738a[_0x35ce13];return _0x2addc6;};'use strict';var Mustache=require('mustache');var util=require('util');var path=require(_0xa738('0x0'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa738('0x1'));var _=require(_0xa738('0x2'));var querystring=require(_0xa738('0x3'));var htmlToText=require(_0xa738('0x4'));var Redis=require(_0xa738('0x5'));var jayson=require(_0xa738('0x6'));var qs=require(_0xa738('0x7'));var logger=require('../../config/logger')('api');var config=require(_0xa738('0x8'));var APIBadRequestError=require(_0xa738('0x9'))[_0xa738('0xa')];var APINotFoundError=require(_0xa738('0x9'))[_0xa738('0xb')];var APIOutOfIntervalError=require(_0xa738('0x9'))[_0xa738('0xc')];var APIHandleError=require(_0xa738('0x9'))['handleError'];var APIConflictError=require('../../errors/api')[_0xa738('0xd')];var wildcardUtils=require(_0xa738('0xe'));var URL=require(_0xa738('0xf'))[_0xa738('0x10')];var db=require(_0xa738('0x11'))['db'];config['redis']=_['defaults'](config[_0xa738('0x12')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa738('0x12')]));require(_0xa738('0x13'))[_0xa738('0x14')](socket);var client=jayson[_0xa738('0x15')][_0xa738('0x16')]({'port':0x232c});var client9002=jayson['client'][_0xa738('0x16')]({'port':0x232a});var client9003=jayson[_0xa738('0x15')][_0xa738('0x16')]({'port':0x232b});var client9001=jayson[_0xa738('0x15')][_0xa738('0x16')]({'port':0x2329});function respondWithRpcPromise(_0x98a064,_0x35d4e4,_0x4057dd,_0x439238){return new Promise(function(_0x260c1c,_0x5aace1){var _0x5227fc=_0x439238||client;return _0x5227fc[_0xa738('0x17')](_0x98a064,_0x4057dd)['then'](function(_0x40d107){logger[_0xa738('0x18')]('ChatWebsite,\x20%s,\x20%s',_0x35d4e4,_0xa738('0x19'));logger['debug'](_0xa738('0x1a'),_0x35d4e4,_0xa738('0x19'),JSON[_0xa738('0x1b')](_0x40d107));if(_0x40d107[_0xa738('0x1c')]){if(_0x40d107[_0xa738('0x1c')]['code']===0x1f4){logger[_0xa738('0x1c')](_0xa738('0x1d'),_0x35d4e4,_0x40d107[_0xa738('0x1c')]['message']);return _0x5aace1(_0x40d107[_0xa738('0x1c')][_0xa738('0x1e')]);}logger[_0xa738('0x1c')]('ChatWebsite,\x20%s,\x20%s',_0x35d4e4,_0x40d107['error']['message']);return _0x260c1c(_0x40d107[_0xa738('0x1c')][_0xa738('0x1e')]);}else{logger[_0xa738('0x18')](_0xa738('0x1d'),_0x35d4e4,_0xa738('0x19'));_0x260c1c(_0x40d107[_0xa738('0x1f')][_0xa738('0x1e')]);}})[_0xa738('0x20')](function(_0x339e00){logger['error'](_0xa738('0x1d'),_0x35d4e4,_0x339e00);_0x5aace1(_0x339e00);});});}function respondWithStatusCode(_0xa1025a,_0x4cb218){_0x4cb218=_0x4cb218||0xcc;return function(_0x5d5ffc){if(_0x5d5ffc){return _0xa1025a['sendStatus'](_0x4cb218);}return _0xa1025a[_0xa738('0x21')](_0x4cb218)[_0xa738('0x22')]();};}function respondWithResult(_0x25edf5,_0x59300f){_0x59300f=_0x59300f||0xc8;return function(_0xbb8dc5){if(_0xbb8dc5){return _0x25edf5[_0xa738('0x21')](_0x59300f)[_0xa738('0x23')](_0xbb8dc5);}};}function respondWithFilteredResult(_0x17a442,_0x42b28b){return function(_0x22f67c){if(_0x22f67c){var _0x1c0e66=typeof _0x42b28b[_0xa738('0x24')]===_0xa738('0x25')&&typeof _0x42b28b['limit']==='undefined';var _0x15078=_0x22f67c[_0xa738('0x26')];var _0x1fdd7e=_0x1c0e66?0x0:_0x42b28b[_0xa738('0x24')];var _0x262385=_0x1c0e66?_0x22f67c['count']:_0x42b28b['offset']+_0x42b28b[_0xa738('0x27')];var _0x5f246d;if(_0x262385>=_0x15078){_0x262385=_0x15078;_0x5f246d=0xc8;}else{_0x5f246d=0xce;}_0x17a442[_0xa738('0x21')](_0x5f246d);return _0x17a442[_0xa738('0x28')]('Content-Range',_0x1fdd7e+'-'+_0x262385+'/'+_0x15078)[_0xa738('0x23')](_0x22f67c);}return null;};}function saveUpdates(_0x68cf7b){return function(_0x501c65){if(_0x501c65){return _0x501c65[_0xa738('0x29')](_0x68cf7b)[_0xa738('0x2a')](function(_0x5639b8){return _0x5639b8;});}return null;};}function removeEntity(_0x471af9){return function(_0xff38a9){if(_0xff38a9){return _0xff38a9[_0xa738('0x2b')]()['then'](function(){var _0x3ba73a=_0xff38a9[_0xa738('0x2c')]({'plain':!![]});var _0x4b427d='ChatWebsites';return db[_0xa738('0x2d')][_0xa738('0x2b')]({'where':{'type':_0x4b427d,'resourceId':_0x3ba73a['id']}})['then'](function(){return _0xff38a9;});})['then'](function(){_0x471af9['status'](0xcc)[_0xa738('0x22')]();});}};}function handleEntityNotFound(_0x221391){return function(_0x1569dd){if(!_0x1569dd){_0x221391['sendStatus'](0x194);}return _0x1569dd;};}function handleError(_0x40cf82,_0x3499c4){_0x3499c4=_0x3499c4||0x1f4;return function(_0x1820e6){logger[_0xa738('0x1c')](_0x1820e6[_0xa738('0x2e')]);if(_0x1820e6[_0xa738('0x2f')]){delete _0x1820e6['name'];}_0x40cf82[_0xa738('0x21')](_0x3499c4)[_0xa738('0x30')](_0x1820e6);};}function createInteractionObject(_0x52dc69,_0x3acc6,_0xa07520,_0x5c7722){var _0x57d29b=require(_0xa738('0x31'));var _0x2d7554=new _0x57d29b();var _0x202c7c=_0x2d7554[_0xa738('0x32')](_0xa07520[_0xa738('0x33')])['getResult']();var _0x342a0e=_0x3acc6[_0xa738('0x34')];if(_0xa07520[_0xa738('0x35')]){_0x342a0e=_0xa07520[_0xa738('0x35')];}else if(_0xa07520[_0xa738('0x36')]){_0x342a0e=_[_0xa738('0x37')](_0xa07520['x-forwarded-for'][_0xa738('0x38')](','));}return{'ContactId':_0x5c7722['id'],'ChatWebsiteId':_0x52dc69,'from':(_0x5c7722[_0xa738('0x39')]||'')+'\x20'+(_0x5c7722[_0xa738('0x3a')]||''),'customerIp':_0x342a0e,'customerPort':_0xa07520[_0xa738('0x3b')]?_0xa07520[_0xa738('0x3b')]:null,'referer':_0x3acc6[_0xa738('0x3c')],'browserName':_0x202c7c[_0xa738('0x3d')][_0xa738('0x2f')]&&_0x202c7c[_0xa738('0x3d')]['version']?util[_0xa738('0x3e')]('%s\x20%s',_0x202c7c[_0xa738('0x3d')][_0xa738('0x2f')],_0x202c7c[_0xa738('0x3d')]['version']):'unknown','browserVersion':_0x202c7c[_0xa738('0x3d')][_0xa738('0x3f')]||_0xa738('0x40'),'osName':util[_0xa738('0x3e')](_0xa738('0x41'),_0x202c7c['os'][_0xa738('0x2f')],_0x202c7c['os'][_0xa738('0x3f')]),'osVersion':_0x202c7c['os'][_0xa738('0x3f')],'deviceModel':_0x202c7c[_0xa738('0x42')][_0xa738('0x43')]&&_0x202c7c[_0xa738('0x42')][_0xa738('0x44')]?util[_0xa738('0x3e')]('%s\x20%s\x20%s',_0x202c7c[_0xa738('0x42')]['model'],_0x202c7c[_0xa738('0x42')][_0xa738('0x44')],_0x202c7c['device'][_0xa738('0x45')]):null,'deviceVendor':_0x202c7c[_0xa738('0x42')][_0xa738('0x44')],'deviceType':_0x202c7c[_0xa738('0x42')][_0xa738('0x45')],'formData':JSON['stringify'](_0x3acc6)};}exports[_0xa738('0x46')]=function(_0x342f35,_0x5ae1a7){var _0x2ed7c7={'include':[{'model':db[_0xa738('0x47')],'as':'mandatoryDispositionPause'}]},_0x4ade82={},_0x2b5bda={'count':0x0,'rows':[]};var _0x167420=_[_0xa738('0x48')](db['ChatWebsite'][_0xa738('0x49')],function(_0x39d05d){return{'name':_0x39d05d[_0xa738('0x4a')],'type':_0x39d05d[_0xa738('0x45')][_0xa738('0x4b')]};});_0x4ade82[_0xa738('0x43')]=_[_0xa738('0x48')](_0x167420,_0xa738('0x2f'));_0x4ade82['query']=_[_0xa738('0x4c')](_0x342f35[_0xa738('0x4d')]);_0x4ade82[_0xa738('0x4e')]=_[_0xa738('0x4f')](_0x4ade82[_0xa738('0x43')],_0x4ade82[_0xa738('0x4d')]);_0x2ed7c7[_0xa738('0x50')]=_[_0xa738('0x4f')](_0x4ade82[_0xa738('0x43')],qs['fields'](_0x342f35[_0xa738('0x4d')]['fields']));_0x2ed7c7['attributes']=_0x2ed7c7[_0xa738('0x50')][_0xa738('0x51')]?_0x2ed7c7[_0xa738('0x50')]:_0x4ade82[_0xa738('0x43')];if(!_0x342f35[_0xa738('0x4d')][_0xa738('0x52')](_0xa738('0x53'))){_0x2ed7c7[_0xa738('0x27')]=qs[_0xa738('0x27')](_0x342f35[_0xa738('0x4d')][_0xa738('0x27')]);_0x2ed7c7[_0xa738('0x24')]=qs[_0xa738('0x24')](_0x342f35['query'][_0xa738('0x24')]);}_0x2ed7c7[_0xa738('0x54')]=qs[_0xa738('0x55')](_0x342f35[_0xa738('0x4d')][_0xa738('0x55')]);_0x2ed7c7['where']=qs['filters'](_[_0xa738('0x56')](_0x342f35['query'],_0x4ade82[_0xa738('0x4e')]),_0x167420);if(_0x342f35[_0xa738('0x4d')]['filter']){_0x2ed7c7[_0xa738('0x57')]=_[_0xa738('0x58')](_0x2ed7c7['where'],{'$or':_[_0xa738('0x48')](_0x167420,function(_0x4d44d8){if(_0x4d44d8[_0xa738('0x45')]!==_0xa738('0x59')){var _0x50d5e7={};_0x50d5e7[_0x4d44d8['name']]={'$like':'%'+_0x342f35[_0xa738('0x4d')][_0xa738('0x5a')]+'%'};return _0x50d5e7;}})});}_0x2ed7c7=_[_0xa738('0x58')]({},_0x2ed7c7,_0x342f35[_0xa738('0x5b')]);var _0x477c00={'where':_0x2ed7c7[_0xa738('0x57')]};return db['ChatWebsite'][_0xa738('0x26')](_0x477c00)['then'](function(_0x333bc6){_0x2b5bda['count']=_0x333bc6;if(_0x342f35[_0xa738('0x4d')]['includeAll']){_0x2ed7c7['include']=[{'all':!![]}];}return db[_0xa738('0x5c')][_0xa738('0x5d')](_0x2ed7c7);})[_0xa738('0x2a')](function(_0x2340d7){_0x2b5bda['rows']=_0x2340d7;return _0x2b5bda;})['then'](respondWithFilteredResult(_0x5ae1a7,_0x2ed7c7))['catch'](handleError(_0x5ae1a7,null));};exports[_0xa738('0x5e')]=function(_0x52f54c,_0x46c143){var _0x2dd1d6={'raw':![],'where':{'id':_0x52f54c[_0xa738('0x5f')]['id']},'include':[{'model':db['Pause'],'as':_0xa738('0x60')}]},_0x26a2f9={};_0x26a2f9['model']=_[_0xa738('0x4c')](db[_0xa738('0x5c')][_0xa738('0x49')]);_0x26a2f9[_0xa738('0x4d')]=_[_0xa738('0x4c')](_0x52f54c[_0xa738('0x4d')]);_0x26a2f9[_0xa738('0x4e')]=_['intersection'](_0x26a2f9[_0xa738('0x43')],_0x26a2f9[_0xa738('0x4d')]);_0x2dd1d6[_0xa738('0x50')]=_['intersection'](_0x26a2f9[_0xa738('0x43')],qs[_0xa738('0x61')](_0x52f54c[_0xa738('0x4d')][_0xa738('0x61')]));_0x2dd1d6[_0xa738('0x50')]=_0x2dd1d6[_0xa738('0x50')]['length']?_0x2dd1d6[_0xa738('0x50')]:_0x26a2f9['model'];if(_0x52f54c[_0xa738('0x4d')]['includeAll']){_0x2dd1d6[_0xa738('0x62')]=[{'all':!![]}];}_0x2dd1d6=_[_0xa738('0x58')]({},_0x2dd1d6,_0x52f54c['options']);return db[_0xa738('0x5c')][_0xa738('0x63')](_0x2dd1d6)[_0xa738('0x2a')](handleEntityNotFound(_0x46c143,null))[_0xa738('0x2a')](respondWithResult(_0x46c143,null))[_0xa738('0x20')](handleError(_0x46c143,null));};exports['create']=function(_0x1f06a8,_0x18794d){var _0x4f0a30=null;_0x1f06a8[_0xa738('0x64')][_0xa738('0x65')][_0xa738('0x38')](',')[_0xa738('0x66')](_0x47eb5e=>{if(_0x47eb5e[_0xa738('0x67')]()!==''&&!wildcardUtils['testWildcardValidity'](_0x47eb5e[_0xa738('0x67')]())){_0x4f0a30=new APIBadRequestError('\x22'+_0x47eb5e[_0xa738('0x67')]()+'\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression');}});if(_0x4f0a30){return handleError(_0x18794d,null)(_0x4f0a30);}return db[_0xa738('0x5c')][_0xa738('0x68')](_0x1f06a8[_0xa738('0x64')],{})['then'](function(_0x5dbccf){var _0x3ac535=_0x1f06a8['user'][_0xa738('0x2c')]({'plain':!![]});if(!_0x3ac535)throw new Error(_0xa738('0x69'));if(_0x3ac535['role']===_0xa738('0x6a')){var _0x5ceb6d=_0x5dbccf[_0xa738('0x2c')]({'plain':!![]});var _0x476308=_0xa738('0x6b');return db[_0xa738('0x6c')]['find']({'where':{'name':_0x476308,'userProfileId':_0x3ac535['userProfileId']},'raw':!![]})[_0xa738('0x2a')](function(_0x492a16){if(_0x492a16&&_0x492a16[_0xa738('0x6d')]===0x0){return db['UserProfileResource'][_0xa738('0x68')]({'name':_0x5ceb6d[_0xa738('0x2f')],'resourceId':_0x5ceb6d['id'],'type':_0x492a16['name'],'sectionId':_0x492a16['id']},{})[_0xa738('0x2a')](function(){return _0x5dbccf;});}else{return _0x5dbccf;}})[_0xa738('0x20')](function(_0x33109d){logger[_0xa738('0x1c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x33109d);throw _0x33109d;});}return _0x5dbccf;})[_0xa738('0x2a')](respondWithResult(_0x18794d,0xc9))[_0xa738('0x20')](handleError(_0x18794d,null));};exports[_0xa738('0x29')]=function(_0x18a7af,_0x449dd0){var _0x30f887=null;_0x18a7af[_0xa738('0x64')][_0xa738('0x65')][_0xa738('0x38')](',')[_0xa738('0x66')](_0x4e82f0=>{if(_0x4e82f0[_0xa738('0x67')]()!==''&&!wildcardUtils[_0xa738('0x6e')](_0x4e82f0['trim']())){_0x30f887=new APIBadRequestError('\x22'+_0x4e82f0[_0xa738('0x67')]()+_0xa738('0x6f'));}});if(_0x30f887){return handleError(_0x449dd0,null)(_0x30f887);}if(_0x18a7af[_0xa738('0x64')]['id']){delete _0x18a7af[_0xa738('0x64')]['id'];}return db[_0xa738('0x5c')]['find']({'where':{'id':_0x18a7af[_0xa738('0x5f')]['id']},'include':[{'model':db['Pause'],'as':_0xa738('0x60')}]})[_0xa738('0x2a')](handleEntityNotFound(_0x449dd0,null))[_0xa738('0x2a')](saveUpdates(_0x18a7af[_0xa738('0x64')],null))['then'](respondWithResult(_0x449dd0,null))['catch'](handleError(_0x449dd0,null));};exports[_0xa738('0x2b')]=function(_0x4725c6,_0x130502){return db[_0xa738('0x5c')]['find']({'where':{'id':_0x4725c6[_0xa738('0x5f')]['id']}})[_0xa738('0x2a')](handleEntityNotFound(_0x130502,null))[_0xa738('0x2a')](removeEntity(_0x130502,null))[_0xa738('0x20')](handleError(_0x130502,null));};exports[_0xa738('0x70')]=function(_0x584b5c,_0x1bb6cd){return db[_0xa738('0x5c')]['describe']()[_0xa738('0x2a')](respondWithResult(_0x1bb6cd,null))[_0xa738('0x20')](handleError(_0x1bb6cd,null));};exports[_0xa738('0x71')]=function(_0x502a27,_0x413fb8){if(_0x502a27[_0xa738('0x64')]['id']){delete _0x502a27[_0xa738('0x64')]['id'];}return db[_0xa738('0x5c')][_0xa738('0x63')]({'where':{'id':_0x502a27[_0xa738('0x5f')]['id']}})[_0xa738('0x2a')](handleEntityNotFound(_0x413fb8,null))['then'](function(_0x47a76b){if(_0x47a76b){_0x502a27['body'][_0xa738('0x72')]=_0x47a76b['id'];return db['Disposition'][_0xa738('0x68')](_0x502a27[_0xa738('0x64')]);}})[_0xa738('0x2a')](respondWithResult(_0x413fb8,null))['catch'](handleError(_0x413fb8,null));};exports[_0xa738('0x73')]=function(_0x55c0f6,_0x31c817){var _0x548b46={'raw':![],'where':{}};var _0x5b5524={};var _0x848e62={'count':0x0,'rows':[]};return db[_0xa738('0x5c')]['findOne']({'where':{'id':_0x55c0f6['params']['id']}})['then'](handleEntityNotFound(_0x31c817,null))['then'](function(_0x577f68){if(_0x577f68){_0x5b5524[_0xa738('0x43')]=_[_0xa738('0x4c')](db['Disposition'][_0xa738('0x49')]);_0x5b5524[_0xa738('0x4d')]=_['keys'](_0x55c0f6[_0xa738('0x4d')]);_0x5b5524['filters']=_['intersection'](_0x5b5524[_0xa738('0x43')],_0x5b5524[_0xa738('0x4d')]);_0x548b46['attributes']=_[_0xa738('0x4f')](_0x5b5524['model'],qs['fields'](_0x55c0f6[_0xa738('0x4d')]['fields']));_0x548b46[_0xa738('0x50')]=_0x548b46[_0xa738('0x50')]['length']?_0x548b46[_0xa738('0x50')]:_0x5b5524[_0xa738('0x43')];if(!_0x55c0f6[_0xa738('0x4d')][_0xa738('0x52')](_0xa738('0x53'))){_0x548b46[_0xa738('0x27')]=qs['limit'](_0x55c0f6[_0xa738('0x4d')][_0xa738('0x27')]);_0x548b46[_0xa738('0x24')]=qs[_0xa738('0x24')](_0x55c0f6[_0xa738('0x4d')][_0xa738('0x24')]);}_0x548b46[_0xa738('0x54')]=qs[_0xa738('0x55')](_0x55c0f6['query']['sort']);_0x548b46[_0xa738('0x57')]=qs[_0xa738('0x4e')](_['pick'](_0x55c0f6[_0xa738('0x4d')],_0x5b5524['filters']));_0x548b46['where']['ChatWebsiteId']=_0x577f68['id'];if(_0x55c0f6['query'][_0xa738('0x5a')]){_0x548b46[_0xa738('0x57')]=_[_0xa738('0x58')](_0x548b46['where'],{'$or':_[_0xa738('0x48')](_0x548b46[_0xa738('0x50')],function(_0x50c8ea){var _0x3db418={};_0x3db418[_0x50c8ea]={'$like':'%'+_0x55c0f6[_0xa738('0x4d')][_0xa738('0x5a')]+'%'};return _0x3db418;})});}_0x548b46=_['merge']({},_0x548b46,_0x55c0f6[_0xa738('0x5b')]);return db[_0xa738('0x74')][_0xa738('0x26')]({'where':_0x548b46[_0xa738('0x57')]})[_0xa738('0x2a')](function(_0x4bcce0){_0x848e62[_0xa738('0x26')]=_0x4bcce0;if(_0x55c0f6['query'][_0xa738('0x75')]){_0x548b46[_0xa738('0x62')]=[{'all':!![]}];}return db[_0xa738('0x74')]['findAll'](_0x548b46);})[_0xa738('0x2a')](function(_0x412022){_0x848e62[_0xa738('0x76')]=_0x412022;return _0x848e62;});}})['then'](respondWithFilteredResult(_0x31c817,_0x548b46))[_0xa738('0x20')](handleError(_0x31c817,null));};exports[_0xa738('0x77')]=function(_0x230275,_0x395c4d){return db[_0xa738('0x5c')][_0xa738('0x63')]({'where':{'id':_0x230275[_0xa738('0x5f')]['id']}})[_0xa738('0x2a')](handleEntityNotFound(_0x395c4d,null))[_0xa738('0x2a')](function(_0xa8451e){if(_0xa8451e){return _0xa8451e[_0xa738('0x77')](_0x230275[_0xa738('0x4d')][_0xa738('0x78')]);}})['then'](respondWithStatusCode(_0x395c4d,null))['catch'](handleError(_0x395c4d,null));};exports[_0xa738('0x79')]=function(_0x235d37,_0x58527){if(_0x235d37[_0xa738('0x64')]['id']){delete _0x235d37[_0xa738('0x64')]['id'];}return db[_0xa738('0x5c')][_0xa738('0x63')]({'where':{'id':_0x235d37[_0xa738('0x5f')]['id']}})[_0xa738('0x2a')](handleEntityNotFound(_0x58527,null))['then'](function(_0x5dc5de){if(_0x5dc5de){_0x235d37[_0xa738('0x64')][_0xa738('0x72')]=_0x5dc5de['id'];return db[_0xa738('0x7a')]['create'](_0x235d37[_0xa738('0x64')]);}})[_0xa738('0x2a')](respondWithResult(_0x58527,null))['catch'](handleError(_0x58527,null));};exports[_0xa738('0x7b')]=function(_0x638599,_0x49b80d){var _0x256f71={'raw':![],'where':{}};var _0x2424a8={};var _0x3ed0bd={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xa738('0x7c')]({'where':{'id':_0x638599[_0xa738('0x5f')]['id']}})['then'](handleEntityNotFound(_0x49b80d,null))[_0xa738('0x2a')](function(_0x11647f){if(_0x11647f){_0x2424a8[_0xa738('0x43')]=_[_0xa738('0x4c')](db[_0xa738('0x7a')][_0xa738('0x49')]);_0x2424a8['query']=_[_0xa738('0x4c')](_0x638599[_0xa738('0x4d')]);_0x2424a8[_0xa738('0x4e')]=_[_0xa738('0x4f')](_0x2424a8[_0xa738('0x43')],_0x2424a8[_0xa738('0x4d')]);_0x256f71[_0xa738('0x50')]=_[_0xa738('0x4f')](_0x2424a8[_0xa738('0x43')],qs[_0xa738('0x61')](_0x638599[_0xa738('0x4d')][_0xa738('0x61')]));_0x256f71[_0xa738('0x50')]=_0x256f71[_0xa738('0x50')][_0xa738('0x51')]?_0x256f71[_0xa738('0x50')]:_0x2424a8[_0xa738('0x43')];if(!_0x638599[_0xa738('0x4d')][_0xa738('0x52')](_0xa738('0x53'))){_0x256f71[_0xa738('0x27')]=qs['limit'](_0x638599['query']['limit']);_0x256f71['offset']=qs[_0xa738('0x24')](_0x638599['query'][_0xa738('0x24')]);}_0x256f71[_0xa738('0x54')]=qs['sort'](_0x638599['query']['sort']);_0x256f71[_0xa738('0x57')]=qs[_0xa738('0x4e')](_[_0xa738('0x56')](_0x638599['query'],_0x2424a8[_0xa738('0x4e')]));_0x256f71[_0xa738('0x57')][_0xa738('0x72')]=_0x11647f['id'];if(_0x638599[_0xa738('0x4d')]['filter']){_0x256f71[_0xa738('0x57')]=_['merge'](_0x256f71[_0xa738('0x57')],{'$or':_[_0xa738('0x48')](_0x256f71[_0xa738('0x50')],function(_0x187f12){var _0x36d91c={};_0x36d91c[_0x187f12]={'$like':'%'+_0x638599[_0xa738('0x4d')][_0xa738('0x5a')]+'%'};return _0x36d91c;})});}_0x256f71=_[_0xa738('0x58')]({},_0x256f71,_0x638599[_0xa738('0x5b')]);return db[_0xa738('0x7a')][_0xa738('0x26')]({'where':_0x256f71[_0xa738('0x57')]})['then'](function(_0x1199ab){_0x3ed0bd[_0xa738('0x26')]=_0x1199ab;if(_0x638599['query'][_0xa738('0x75')]){_0x256f71[_0xa738('0x62')]=[{'all':!![]}];}return db[_0xa738('0x7a')][_0xa738('0x5d')](_0x256f71);})['then'](function(_0x4068a2){_0x3ed0bd[_0xa738('0x76')]=_0x4068a2;return _0x3ed0bd;});}})['then'](respondWithFilteredResult(_0x49b80d,_0x256f71))[_0xa738('0x20')](handleError(_0x49b80d,null));};exports['removeAnswers']=function(_0x500815,_0x11adf4){return db[_0xa738('0x5c')][_0xa738('0x63')]({'where':{'id':_0x500815[_0xa738('0x5f')]['id']}})[_0xa738('0x2a')](handleEntityNotFound(_0x11adf4,null))[_0xa738('0x2a')](function(_0x1ac955){if(_0x1ac955){return _0x1ac955[_0xa738('0x7d')](_0x500815['query']['ids']);}})[_0xa738('0x2a')](respondWithStatusCode(_0x11adf4,null))[_0xa738('0x20')](handleError(_0x11adf4,null));};exports['addLogo']=function(_0x362247,_0x4d49c2){_0x362247[_0xa738('0x64')]['sitepic']=_0x362247['file'][_0xa738('0x7e')];return db['ChatWebsite']['find']({'where':{'id':_0x362247[_0xa738('0x5f')]['id']}})['then'](handleEntityNotFound(_0x4d49c2,null))[_0xa738('0x2a')](saveUpdates(_0x362247[_0xa738('0x64')],null))[_0xa738('0x2a')](respondWithResult(_0x4d49c2,null))['catch'](handleError(_0x4d49c2,null));};exports[_0xa738('0x7f')]=function(_0x11eb5a,_0x5354b9){_0x11eb5a[_0xa738('0x64')][_0xa738('0x80')]=_0x11eb5a[_0xa738('0x81')]['filename'];return db[_0xa738('0x5c')][_0xa738('0x63')]({'where':{'id':_0x11eb5a[_0xa738('0x5f')]['id']}})[_0xa738('0x2a')](handleEntityNotFound(_0x5354b9,null))['then'](saveUpdates(_0x11eb5a[_0xa738('0x64')],null))['then'](respondWithResult(_0x5354b9,null))['catch'](handleError(_0x5354b9,null));};exports[_0xa738('0x82')]=function(_0x3c3cd6,_0x500f8e){_0x3c3cd6[_0xa738('0x64')][_0xa738('0x83')]=_0x3c3cd6[_0xa738('0x81')]['filename'];return db[_0xa738('0x5c')][_0xa738('0x63')]({'where':{'id':_0x3c3cd6[_0xa738('0x5f')]['id']}})[_0xa738('0x2a')](handleEntityNotFound(_0x500f8e,null))[_0xa738('0x2a')](saveUpdates(_0x3c3cd6['body'],null))['then'](respondWithResult(_0x500f8e,null))[_0xa738('0x20')](handleError(_0x500f8e,null));};exports[_0xa738('0x84')]=function(_0x59ca47,_0x5ac49a){_0x59ca47[_0xa738('0x64')][_0xa738('0x85')]=_0x59ca47[_0xa738('0x81')][_0xa738('0x7e')];return db[_0xa738('0x5c')]['find']({'where':{'id':_0x59ca47['params']['id']}})[_0xa738('0x2a')](handleEntityNotFound(_0x5ac49a,null))[_0xa738('0x2a')](saveUpdates(_0x59ca47[_0xa738('0x64')],null))[_0xa738('0x2a')](respondWithResult(_0x5ac49a,null))[_0xa738('0x20')](handleError(_0x5ac49a,null));};exports['getLogo']=function(_0x1bd635,_0x9ff0dc){var _0x2d8c92=path[_0xa738('0x86')](config['root'],_0xa738('0x87'));var _0x3163d1={'where':{'id':_0x1bd635[_0xa738('0x5f')]['id']},'attributes':['id',_0xa738('0x88')],'raw':!![]};var _0x1be434=![];return require(_0xa738('0x89'))[_0xa738('0x8a')]()[_0xa738('0x2a')](function(_0xa4d5a4){if(_0xa4d5a4){_0x1be434=_0xa4d5a4[_0xa738('0x8b')];}})[_0xa738('0x2a')](function(){return db[_0xa738('0x5c')][_0xa738('0x63')](_0x3163d1);})[_0xa738('0x2a')](handleEntityNotFound(_0x9ff0dc,null))['then'](function(_0x7023da){if(_0x7023da){if(!_[_0xa738('0x8c')](_0x7023da[_0xa738('0x88')])){if(fs[_0xa738('0x8d')](path[_0xa738('0x86')](config[_0xa738('0x8e')],_0xa738('0x8f'),_0x7023da[_0xa738('0x88')]))&&_0x1be434){_0x2d8c92=path[_0xa738('0x86')](config[_0xa738('0x8e')],'server/files/images/logos/',_0x7023da[_0xa738('0x88')]);}}return _0x9ff0dc[_0xa738('0x90')](_0x2d8c92);}})[_0xa738('0x20')](handleError(_0x9ff0dc,null));};exports[_0xa738('0x91')]=function(_0x52fd64,_0x1961f0){var _0xd8e68c=path['join'](config[_0xa738('0x8e')],_0xa738('0x92'));var _0x533a2d={'where':{'id':_0x52fd64[_0xa738('0x5f')]['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db[_0xa738('0x5c')]['find'](_0x533a2d)['then'](handleEntityNotFound(_0x1961f0,null))[_0xa738('0x2a')](function(_0x46637a){if(_0x46637a){if(!_['isNil'](_0x46637a[_0xa738('0x80')])){if(fs[_0xa738('0x8d')](path['join'](config[_0xa738('0x8e')],_0xa738('0x93'),_0x46637a[_0xa738('0x80')]))){_0xd8e68c=path[_0xa738('0x86')](config[_0xa738('0x8e')],'server/files/images/avatars/',_0x46637a[_0xa738('0x80')]);}}return _0x1961f0[_0xa738('0x90')](_0xd8e68c);}})[_0xa738('0x20')](handleError(_0x1961f0,null));};exports[_0xa738('0x94')]=function(_0x2f05c8,_0x93fcb){var _0x1bda4d=path[_0xa738('0x86')](config[_0xa738('0x8e')],_0xa738('0x95'));var _0x1c2f9d={'where':{'id':_0x2f05c8[_0xa738('0x5f')]['id']},'attributes':['id','customerAvatar','showCustomerAvatar'],'raw':!![]};return db[_0xa738('0x5c')][_0xa738('0x63')](_0x1c2f9d)[_0xa738('0x2a')](handleEntityNotFound(_0x93fcb,null))[_0xa738('0x2a')](function(_0x569649){if(_0x569649){if(!_['isNil'](_0x569649[_0xa738('0x83')])){if(fs['existsSync'](path['join'](config[_0xa738('0x8e')],'server/files/images/avatars/',_0x569649[_0xa738('0x83')]))&&_0x569649[_0xa738('0x96')]){_0x1bda4d=path[_0xa738('0x86')](config[_0xa738('0x8e')],_0xa738('0x93'),_0x569649[_0xa738('0x83')]);}}return _0x93fcb[_0xa738('0x90')](_0x1bda4d);}})[_0xa738('0x20')](handleError(_0x93fcb,null));};exports['getSystemAvatar']=function(_0x32998e,_0xd52ddc){var _0x105efc=path[_0xa738('0x86')](config[_0xa738('0x8e')],_0xa738('0x97'));var _0x170703={'where':{'id':_0x32998e[_0xa738('0x5f')]['id']},'attributes':['id',_0xa738('0x85')],'raw':!![]};return db[_0xa738('0x5c')][_0xa738('0x63')](_0x170703)[_0xa738('0x2a')](handleEntityNotFound(_0xd52ddc,null))[_0xa738('0x2a')](function(_0x1c73d8){if(_0x1c73d8){if(!_['isNil'](_0x1c73d8['systemAvatar'])){if(fs[_0xa738('0x8d')](path[_0xa738('0x86')](config['root'],_0xa738('0x93'),_0x1c73d8[_0xa738('0x85')]))){_0x105efc=path[_0xa738('0x86')](config[_0xa738('0x8e')],_0xa738('0x93'),_0x1c73d8[_0xa738('0x85')]);}}return _0xd52ddc[_0xa738('0x90')](_0x105efc);}})[_0xa738('0x20')](handleError(_0xd52ddc,null));};function checkWebsiteInterval(_0x2ce441){var _0x2d621f=_0x2ce441['Interval'];if(!_0x2d621f){return Promise[_0xa738('0x98')](_0x2ce441);}var _0x54a58e=_0x2ce441['timezone']||undefined;return _0x2d621f[_0xa738('0x99')](_0x54a58e)[_0xa738('0x2a')](function(_0x53054a){if(!_0x53054a){throw new APIOutOfIntervalError();}return _0x2ce441;});}exports[_0xa738('0x9a')]=function(_0x3bd773,_0x2f98c7){var _0x46d974={'body':_0x3bd773[_0xa738('0x64')],'channel':_0xa738('0x9b')};var _0x456ce9=[];var _0x56c213=[];var _0x5f1588={};var _0x51c603=![];if(_0x3bd773['body']['id']){delete _0x3bd773[_0xa738('0x64')]['id'];}if(_[_0xa738('0x8c')](_0x3bd773[_0xa738('0x64')][_0xa738('0x9c')])){throw new APIBadRequestError(_0xa738('0x9d'));}if(_[_0xa738('0x8c')](_0x3bd773['body'][_0xa738('0x9e')])){throw new APIBadRequestError(_0xa738('0x9f'));}if(_[_0xa738('0xa0')](_0x3bd773[_0xa738('0x64')][_0xa738('0x64')])){throw new APIBadRequestError(_0xa738('0xa1'));}var _0xae46c8=_0x3bd773['body'][_0xa738('0x34')]&&_0x3bd773[_0xa738('0x64')][_0xa738('0x3c')];return db[_0xa738('0xa2')][_0xa738('0x70')]()[_0xa738('0x2a')](function(_0x34e023){if(!_0x34e023){throw new Error(_0xa738('0xa3'));}_0x456ce9=Object[_0xa738('0x4c')](_0x34e023)[_0xa738('0x5a')](function(_0x624a84){return!['createdAt',_0xa738('0xa4')]['includes'](_0x624a84);});_0x56c213=Object[_0xa738('0x4c')](_0x34e023)[_0xa738('0x5a')](function(_0x44f067){return![_0xa738('0xa5'),_0xa738('0xa4'),'CompanyId',_0xa738('0xa6')]['includes'](_0x44f067);});if(!_[_0xa738('0xa7')](_0x56c213,_0x3bd773[_0xa738('0x64')][_0xa738('0x9e')])){throw new APIBadRequestError('Invalid\x20MapKey\x20parameter.\x20Allowed\x20values:\x20'+_0x56c213[_0xa738('0x86')](',\x20'));}_0x5f1588[_0x3bd773['body']['mapKey']]=_0x3bd773['body']['from'];})['then'](function(){return db[_0xa738('0x5c')][_0xa738('0x63')]({'where':{'id':_0x3bd773[_0xa738('0x5f')]['id']},'include':[{'model':db[_0xa738('0xa8')],'as':_0xa738('0xa9'),'include':[{'model':db[_0xa738('0xa2')],'as':_0xa738('0xaa'),'where':_0x5f1588,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0xa738('0xab')],'as':_0xa738('0xac')},{'model':db[_0xa738('0xad')],'as':'Interval','include':[{'model':db['Interval'],'as':'Intervals','attributes':['id',_0xa738('0xae')],'raw':!![]}]}]});})['then'](function(_0xced2f8){if(!_0xced2f8){throw new APINotFoundError(util[_0xa738('0x3e')](_0xa738('0xaf'),_0x3bd773[_0xa738('0x5f')]['id']));}if(_0xae46c8){return checkWebsiteInterval(_0xced2f8);}return _0xced2f8;})['then'](function(_0x2c4c94){_0x46d974[_0xa738('0xb0')]=_0x2c4c94;_0x46d974[_0xa738('0xb1')]=_['orderBy'](_0x2c4c94['Applications'],[_0xa738('0xb2')],[_0xa738('0xb3')]);if(_0x46d974[_0xa738('0xb0')][_0xa738('0xac')]){delete _0x46d974[_0xa738('0xb0')][_0xa738('0xac')];}_0x46d974['list']=_0x2c4c94[_0xa738('0xa9')]||{'id':_0x2c4c94[_0xa738('0xa6')]};if(_0x46d974['list']&&_0x46d974[_0xa738('0xb4')][_0xa738('0xaa')]['length']){return _0x46d974['list'][_0xa738('0xaa')][0x0];}var _0x59d585=_[_0xa738('0xb5')](_0x3bd773[_0xa738('0x64')],{'firstName':_0x3bd773[_0xa738('0x64')][_0xa738('0x9c')],'ListId':_0x2c4c94[_0xa738('0xa6')]});_0x59d585[_0x3bd773[_0xa738('0x64')][_0xa738('0x9e')]]=_0x3bd773[_0xa738('0x64')]['from'];return db['CmContact'][_0xa738('0x68')](_0x59d585,{'fields':_0x456ce9,'raw':!![]});})[_0xa738('0x2a')](function(_0x36e06d){_0x46d974[_0xa738('0xb6')]=_0x36e06d;var _0x1cb5b3=createInteractionObject(_0x3bd773[_0xa738('0x5f')]['id'],_0x3bd773['body'],_0x3bd773[_0xa738('0xb7')],_0x36e06d);var _0x43d741={'ChatWebsiteId':_0x3bd773[_0xa738('0x5f')]['id']};if(_0x3bd773[_0xa738('0x64')][_0xa738('0xb8')]){_0x43d741['threadId']=_0x3bd773[_0xa738('0x64')][_0xa738('0xb8')];_0x43d741[_0xa738('0xb9')]=![];return db[_0xa738('0xba')]['find']({'where':_0x43d741})[_0xa738('0x2a')](function(_0x18f1ba){var _0x36edf4=_0x3bd773[_0xa738('0x64')]['customerIp']&&_0x3bd773['body'][_0xa738('0x3c')];if(_0x18f1ba){_0x51c603=!![];return _0x18f1ba;}else if(!_0x36edf4&&_0x18f1ba&&_0x18f1ba[_0xa738('0xb9')]){throw new APIConflictError(_0xa738('0xbb'));}_0x1cb5b3[_0xa738('0xb8')]=_0x3bd773[_0xa738('0x64')][_0xa738('0xb8')];_0x1cb5b3['externalUrl']=_0x3bd773[_0xa738('0x64')]['externalUrl'];return db[_0xa738('0xba')]['create'](_0x1cb5b3);});}_0x43d741[_0xa738('0xbc')]=_0x36e06d['id'];if(_0x3bd773[_0xa738('0x64')][_0xa738('0xbd')]&&_0x3bd773[_0xa738('0x64')][_0xa738('0xbd')]['id']){_0x43d741['id']=_0x3bd773['body'][_0xa738('0xbd')]['id'];return db[_0xa738('0xba')]['find']({'where':_0x43d741})[_0xa738('0x2a')](function(_0x4cbb34){var _0x1932d7=_0x3bd773[_0xa738('0x64')][_0xa738('0x34')]&&_0x3bd773[_0xa738('0x64')][_0xa738('0x3c')];if(!_0x1932d7&&_0x4cbb34&&_0x4cbb34[_0xa738('0xb9')]){throw new APIConflictError('Writing\x20on\x20closed\x20interaction');}else if(_0x4cbb34){_0x51c603=!![];return _0x4cbb34;}else{return db[_0xa738('0xba')]['create'](_0x1cb5b3);}});}return db['ChatInteraction'][_0xa738('0x68')](_0x1cb5b3);})[_0xa738('0x2a')](function(_0x13295e){if(!_0x51c603){return _0x13295e;}var _0x2be5c6={'from':(_0x46d974[_0xa738('0xb6')][_0xa738('0x39')]||'')+'\x20'+(_0x46d974[_0xa738('0xb6')]['lastName']||'')};if(_0x3bd773[_0xa738('0x64')][_0xa738('0xb8')]&&_0x3bd773['body']['messageId']&&_0x3bd773[_0xa738('0x64')][_0xa738('0xb8')]!=_0x3bd773['body'][_0xa738('0xbe')]){_0x2be5c6[_0xa738('0xb8')]=_0x3bd773[_0xa738('0x64')][_0xa738('0xbe')];}return _0x13295e[_0xa738('0x29')](_0x2be5c6);})[_0xa738('0x2a')](function(_0x20b1cd){_0x46d974[_0xa738('0xbd')]=_0x20b1cd['get']({'plain':!![]});_0x46d974[_0xa738('0xbd')][_0xa738('0xbf')]=!_0x51c603;if(_0x46d974['interaction']['created']){if(_0x46d974['account']['autoclose']){_0x46d974[_0xa738('0xb1')][_0xa738('0xc0')]({'id':0x0,'priority':_0x46d974[_0xa738('0xb1')][_0xa738('0x51')]+0x1,'app':_0xa738('0xc1'),'appdata':_0xa738('0xc2'),'interval':_0xa738('0xc3')});}}return db[_0xa738('0xc4')][_0xa738('0x68')]({'body':_0x3bd773['body'][_0xa738('0x64')],'ChatWebsiteId':_0x3bd773[_0xa738('0x5f')]['id'],'ChatInteractionId':_0x20b1cd['id'],'direction':'in','ContactId':_0x46d974[_0xa738('0xb6')]['id'],'AttachmentId':_0x3bd773[_0xa738('0x64')][_0xa738('0xc5')]});})['then'](function(_0x418c37){_0x46d974['message']=_0x418c37;if(!_0x46d974['interaction'][_0xa738('0xc6')]){return;}return db[_0xa738('0xc7')][_0xa738('0x63')]({'attributes':['id',_0xa738('0x2f')],'where':{'id':_0x46d974[_0xa738('0xbd')][_0xa738('0xc6')]}});})[_0xa738('0x2a')](function(_0x104dad){if(_0x104dad){_0x46d974[_0xa738('0xb1')][_0xa738('0xc8')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x104dad[_0xa738('0x2f')]+','+(_0x46d974[_0xa738('0xb0')][_0xa738('0xc9')]||0xa),'interval':_0xa738('0xc3')});_0x46d974[_0xa738('0xca')]=!![];}if(!_0x46d974['interaction']['queueId']){return;}return db[_0xa738('0xcb')]['find']({'attributes':['id','name'],'where':{'id':_0x46d974[_0xa738('0xbd')][_0xa738('0xcc')]}});})[_0xa738('0x2a')](function(_0x2aad11){if(_0x2aad11){_0x46d974[_0xa738('0xb1')]['unshift']({'id':0x0,'priority':0x1,'app':_0xa738('0xcd'),'appdata':_0x2aad11['name']+','+(_0x46d974[_0xa738('0xb0')]['waitForTheAssignedQueue']||0x12c),'interval':_0xa738('0xc3')});}return respondWithRpcPromise(_0xa738('0xce'),_0xa738('0xcf'),_0x46d974);})[_0xa738('0x2a')](function(_0x3e4987){respondWithRpcPromise(_0xa738('0xd0'),_0xa738('0xd0'),{'event':_0xa738('0x9a'),'message':_0x3e4987},client9002);return _0x3e4987;})['then'](respondWithResult(_0x2f98c7,null))[_0xa738('0x20')](APIHandleError(_0x2f98c7));};exports[_0xa738('0xd1')]=function(_0x4234a4,_0x1e8285){var _0x4aab17,_0x6c3f3,_0x552de9;var _0x5c0e8d=[];var _0x5eb57c={};var _0x568b21=_0x4234a4[_0xa738('0xd2')]||[];var _0x4a0102=[];var _0x1444d8;return db[_0xa738('0xa2')][_0xa738('0x70')]()[_0xa738('0x2a')](function(_0x16460b){if(!_0x16460b){throw new db['Sequelize']['ValidationError'](_0xa738('0xd3'));}_0x5c0e8d=_[_0xa738('0xd4')](_[_0xa738('0x4c')](_0x16460b),[_0xa738('0xa5'),'updatedAt',_0xa738('0xd5'),_0xa738('0xa6')]);if(_0x4234a4['body']['id']){delete _0x4234a4[_0xa738('0x64')]['id'];}if(_[_0xa738('0x8c')](_0x4234a4[_0xa738('0x64')][_0xa738('0x9c')])){throw _0x1e8285[_0xa738('0x21')](0x1f4)[_0xa738('0x30')](new db[(_0xa738('0xd6'))]['ValidationError'](_0xa738('0xd7')));}if(_[_0xa738('0x8c')](_0x4234a4[_0xa738('0x64')]['body'])||_0x4234a4[_0xa738('0x64')][_0xa738('0x64')]===''){throw _0x1e8285[_0xa738('0x21')](0x1f4)['send'](new db[(_0xa738('0xd6'))][(_0xa738('0xd8'))](_0xa738('0xd9')));}if(_['isNil'](_0x4234a4[_0xa738('0x64')]['mapKeyOffline'])){throw _0x1e8285['status'](0x1f4)[_0xa738('0x30')](new db['Sequelize'][(_0xa738('0xd8'))]('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5c0e8d));}if(!_[_0xa738('0xa7')](_0x5c0e8d,_0x4234a4[_0xa738('0x64')]['mapKeyOffline'])){throw _0x1e8285['status'](0x1f4)[_0xa738('0x30')](new db[(_0xa738('0xd6'))][(_0xa738('0xd8'))]('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5c0e8d));}_0x5eb57c[_0x4234a4['body'][_0xa738('0xda')]]=_0x4234a4[_0xa738('0x64')]['from'];})[_0xa738('0x2a')](function(){return db[_0xa738('0x5c')]['find']({'where':{'id':_0x4234a4[_0xa738('0x5f')]['id']},'include':[{'model':db['CmList'],'as':_0xa738('0xa9')},{'model':db['MailAccount'],'as':'MailAccount'}]});})[_0xa738('0x2a')](handleEntityNotFound(_0x1e8285,null))[_0xa738('0x2a')](function(_0x10ee27){if(_0x10ee27&&_0x10ee27['List']){_0x6c3f3=_0x10ee27;var _0x4136c1=_[_0xa738('0xb5')](_0x4234a4[_0xa738('0x64')],{'firstName':_0x4234a4[_0xa738('0x64')][_0xa738('0x9c')],'phone':_0x4234a4['body']['from'],'ListId':_0x10ee27['ListId']});_0x4136c1[_0x4234a4['body'][_0xa738('0xda')]]=_0x4234a4['body'][_0xa738('0x9c')];return db[_0xa738('0xa2')]['findOrCreate']({'where':_0x5eb57c,'defaults':_0x4136c1});}})['spread'](function(_0x47d6f6){if(_0x47d6f6){_0x552de9=_0x47d6f6;var _0x51de34=fs['readFileSync'](path[_0xa738('0x86')](config[_0xa738('0x8e')],_0xa738('0xdb')),_0xa738('0xdc'));var _0x407b15=ejs[_0xa738('0xdd')](_0x51de34,{'body':_[_0xa738('0xde')](_0x4234a4[_0xa738('0x64')][_0xa738('0x64')]),'bodyTitle':_0x6c3f3[_0xa738('0xdf')]});return db[_0xa738('0xe0')][_0xa738('0x68')]({'body':_0x407b15,'plainBody':htmlToText[_0xa738('0xe1')](_0x407b15),'ContactId':_0x47d6f6['id'],'ChatWebsiteId':_0x6c3f3['id']});}})['then'](function(_0x4af59c){_0x1444d8=_0x4af59c;if(_0x568b21[_0xa738('0x51')]){var _0x533410=_0x568b21[_0xa738('0x48')](function(_0x4f1c19){return{'name':_0x4f1c19['originalname'],'basename':_0x4f1c19[_0xa738('0x7e')],'type':_0x4f1c19[_0xa738('0xe2')],'ChatOfflineMessageId':_0x4af59c['id']};});_0x4a0102=_0x533410['map'](_0x5336eb=>{var _0x5457c1={'filename':_0x5336eb[_0xa738('0x2f')],'path':path[_0xa738('0x86')](config[_0xa738('0x8e')],_0xa738('0xe3'),_0xa738('0xd2'),_0xa738('0xe4'),'offline-chat',_0x5336eb[_0xa738('0xe5')])};return _0x5457c1;});if(!_0x6c3f3[_0xa738('0xe6')]){return db[_0xa738('0xe7')]['transaction'](function(_0x198f58){return db[_0xa738('0xe8')][_0xa738('0xe9')](_0x533410,{'transaction':_0x198f58});});}}})[_0xa738('0x2a')](function(){if(_0x1444d8){_0x4aab17=_0x1444d8;return db[_0xa738('0xea')][_0xa738('0x7c')]({'where':{'service':!![]},'include':[{'model':db[_0xa738('0xeb')],'as':'Smtp','raw':!![],'include':[{'model':db[_0xa738('0xec')],'as':_0xa738('0xec'),'raw':!![]}]}]});}})['then'](function(_0x5bd2ff){if(_0x5bd2ff&&_0x5bd2ff[_0xa738('0xed')]&&_0x6c3f3[_0xa738('0xee')]&&_0x6c3f3[_0xa738('0xef')]){var _0x40ef4f=_0x5bd2ff['getSmtpOptions']();return respondWithRpcPromise('SendMail','sendMail',{'account':_0x40ef4f,'message':{'from':util['format'](_0xa738('0xf0'),_0x5bd2ff['name'],_0x5bd2ff[_0xa738('0xf1')]||_0x5bd2ff[_0xa738('0xed')][_0xa738('0x6a')]),'to':_0x6c3f3[_0xa738('0xef')],'subject':_0x6c3f3[_0xa738('0xf2')],'html':_0x4aab17[_0xa738('0x64')],'attachments':_0x4a0102}},client9003)[_0xa738('0x2a')](function(){return _0x4aab17;})[_0xa738('0x20')](function(_0x35d77c){logger['error'](_0x35d77c);});}})['then'](function(){if(_0x6c3f3&&_0x6c3f3[_0xa738('0xe6')]&&_0x6c3f3[_0xa738('0xf3')]){var _0x59139e=[];if(_0x568b21['length']){_0x59139e=_0x568b21[_0xa738('0x48')](function(_0x1e475a){return{'name':_0x1e475a[_0xa738('0xf4')],'basename':_0x1e475a['filename'],'type':_0x1e475a[_0xa738('0xe2')],'ChatOfflineMessageId':_0x1444d8['id']};});}var _0x5ddad1;if(!_[_0xa738('0x8c')](_0x6c3f3[_0xa738('0xf5')])){var _0x5caf1c=_[_0xa738('0x48')](_0x4234a4['body'],function(_0x47a832){return _0x47a832;});var _0xe975d6=_['toPairsIn'](_0x5caf1c)[0x0];var _0x3c313c=_['mapValues'](_0xe975d6,function(_0x29f585){return _0x29f585;});_0x5ddad1=_0x3c313c[0x1][_0x6c3f3[_0xa738('0xf5')]];}var _0x10e626={'from':_0x552de9[_0xa738('0xf1')],'firstName':_0x552de9['firstName'],'lastName':_0x552de9[_0xa738('0x3a')],'mapKey':'email','message':{'from':_0x552de9['email'],'to':_0x6c3f3[_0xa738('0xea')]['email'],'cc':'','subject':_[_0xa738('0x8c')](_0x5ddad1)?_0x6c3f3[_0xa738('0xf2')]:_0x5ddad1,'messageId':'','sentAt':new Date(),'attach':_0x59139e[_0xa738('0x51')],'attachments':_0x59139e,'originChannel':_0xa738('0xf6'),'ChatWebsiteId':_0x6c3f3['id'],'ChatOfflineMessageId':_0x4aab17['id'],'originTo':_0x6c3f3[_0xa738('0xea')][_0xa738('0xf1')]},'body':_0x4aab17[_0xa738('0x64')]};var _0x243473={'account':{'id':_0x6c3f3['MailAccountId']},'body':_0x10e626,'log':_0xa738('0xf7')};return respondWithRpcPromise('NotifyMailAccount','notifyMail',_0x243473,client9001)['then'](function(){return _0x4aab17;})['catch'](function(_0x1ee467){logger[_0xa738('0x1c')](_0x1ee467);});}return;})[_0xa738('0x2a')](function(){if(_0x4aab17){return _0x4aab17;}})[_0xa738('0x2a')](respondWithResult(_0x1e8285,null))[_0xa738('0x20')](function(){for(var _0x2057e3 of _0x568b21){var _0x1514d1=path['join'](config[_0xa738('0x8e')],_0xa738('0xe3'),'files',_0xa738('0xe4'),'offline-chat',_0x2057e3[_0xa738('0x7e')]);fs_extra[_0xa738('0xf8')](_0x1514d1)[_0xa738('0x20')](function(_0x11af62){logger['error'](_0xa738('0xf9'),_0x1514d1,_0x11af62);});}});};exports[_0xa738('0xfa')]=function(_0xf8ffbb,_0x289b4d){return db[_0xa738('0xba')][_0xa738('0x63')]({'where':{'id':_0xf8ffbb[_0xa738('0x5f')]['id']}})['then'](handleEntityNotFound(_0x289b4d,null))[_0xa738('0x2a')](function(_0x216119){if(_0x216119){return _0x216119[_0xa738('0xfa')](_0xf8ffbb[_0xa738('0x64')][_0xa738('0x78')],_[_0xa738('0xfb')](_0xf8ffbb['body'],[_0xa738('0x78'),'id'])||{});}})[_0xa738('0x2a')](respondWithResult(_0x289b4d,null))[_0xa738('0x20')](handleError(_0x289b4d,null));};exports[_0xa738('0xfc')]=function(_0x4b12b6,_0x34dea2){var _0x46c95e={'raw':![],'where':{}};var _0x3a5d05={};var _0x23a6d2={'count':0x0,'rows':[]};return db[_0xa738('0x5c')][_0xa738('0x7c')]({'where':{'id':_0x4b12b6['params']['id']}})[_0xa738('0x2a')](handleEntityNotFound(_0x34dea2,null))[_0xa738('0x2a')](function(_0x2563ea){if(_0x2563ea){_0x3a5d05[_0xa738('0x43')]=_[_0xa738('0x4c')](db['ChatInteraction']['rawAttributes']);_0x3a5d05['query']=_['keys'](_0x4b12b6[_0xa738('0x4d')]);_0x3a5d05[_0xa738('0x4e')]=_['intersection'](_0x3a5d05[_0xa738('0x43')],_0x3a5d05['query']);_0x46c95e[_0xa738('0x50')]=_['intersection'](_0x3a5d05[_0xa738('0x43')],qs[_0xa738('0x61')](_0x4b12b6[_0xa738('0x4d')][_0xa738('0x61')]));_0x46c95e[_0xa738('0x50')]=_0x46c95e[_0xa738('0x50')][_0xa738('0x51')]?_0x46c95e['attributes']:_0x3a5d05['model'];if(!_0x4b12b6['query'][_0xa738('0x52')](_0xa738('0x53'))){_0x46c95e[_0xa738('0x27')]=qs['limit'](_0x4b12b6[_0xa738('0x4d')][_0xa738('0x27')]);_0x46c95e['offset']=qs['offset'](_0x4b12b6['query']['offset']);}_0x46c95e[_0xa738('0x54')]=qs[_0xa738('0x55')](_0x4b12b6[_0xa738('0x4d')][_0xa738('0x55')]);_0x46c95e[_0xa738('0x57')]=qs['filters'](_[_0xa738('0x56')](_0x4b12b6['query'],_0x3a5d05[_0xa738('0x4e')]));_0x46c95e[_0xa738('0x57')][_0xa738('0x72')]=_0x2563ea['id'];if(_0x4b12b6[_0xa738('0x4d')][_0xa738('0x5a')]){_0x46c95e[_0xa738('0x57')]=_[_0xa738('0x58')](_0x46c95e[_0xa738('0x57')],{'$or':_[_0xa738('0x48')](_0x46c95e[_0xa738('0x50')],function(_0x327e86){var _0x52e50d={};_0x52e50d[_0x327e86]={'$like':'%'+_0x4b12b6[_0xa738('0x4d')][_0xa738('0x5a')]+'%'};return _0x52e50d;})});}_0x46c95e=_[_0xa738('0x58')]({},_0x46c95e,_0x4b12b6['options']);return db[_0xa738('0xba')][_0xa738('0x26')]({'where':_0x46c95e[_0xa738('0x57')]})[_0xa738('0x2a')](function(_0x476150){_0x23a6d2['count']=_0x476150;if(_0x4b12b6[_0xa738('0x4d')][_0xa738('0x75')]){_0x46c95e[_0xa738('0x62')]=[{'model':db[_0xa738('0xa2')],'as':'Contact','required':![]},{'model':db['User'],'as':_0xa738('0xfd'),'attributes':[_0xa738('0x2f'),_0xa738('0xfe'),_0xa738('0xff')],'required':![]},{'model':db[_0xa738('0x100')],'as':_0xa738('0x101'),'attributes':['id',_0xa738('0x2f'),'color'],'where':_0x4b12b6[_0xa738('0x4d')]['tag']?{'id':_0x4b12b6[_0xa738('0x4d')]['tag']}:undefined,'required':_0x4b12b6[_0xa738('0x4d')][_0xa738('0x102')]?!![]:![]}];}return db['ChatInteraction'][_0xa738('0x5d')](_0x46c95e);})[_0xa738('0x2a')](function(_0x3aae6b){_0x23a6d2[_0xa738('0x76')]=_0x3aae6b;return _0x23a6d2;});}})[_0xa738('0x2a')](respondWithFilteredResult(_0x34dea2,_0x46c95e))[_0xa738('0x20')](handleError(_0x34dea2,null));};exports[_0xa738('0x103')]=function(_0x40692c,_0x5635cb){var _0xd50f9c=0x0;var _0x3eb35b=0x0;var _0x41b3b3=![];var _0x562acc;var _0x56e764;return db[_0xa738('0x5c')][_0xa738('0x63')]({'where':{'id':_0x40692c[_0xa738('0x5f')]['id']},'include':[{'model':db[_0xa738('0xad')],'as':'Interval','include':[{'model':db['Interval'],'as':_0xa738('0x104'),'attributes':['id','interval']}]}]})['then'](handleEntityNotFound(_0x5635cb,null))['then'](function(_0x52f298){if(_0x52f298){_0x562acc=_0x52f298;return _0x52f298[_0xa738('0x105')]({'raw':!![]});}})[_0xa738('0x2a')](function(_0x4d9f6f){if(_0x562acc){if(_0x4d9f6f){_0x56e764=_0x4d9f6f;}}return require(_0xa738('0x89'))[_0xa738('0x8a')]();})[_0xa738('0x2a')](function(_0x1abca4){if(_0x1abca4){_0x3eb35b=_0x1abca4['virtual'];_0x41b3b3=_0x1abca4[_0xa738('0x8b')];}})[_0xa738('0x2a')](function(){return db[_0xa738('0xba')][_0xa738('0x26')]({'where':{'closed':![]}});})[_0xa738('0x2a')](function(_0x263b8e){_0xd50f9c=_0x263b8e;if(_0x3eb35b&&_0x263b8e>_0x3eb35b){return db[_0xa738('0x106')][_0xa738('0x7c')]({'where':{'id':0x1}})[_0xa738('0x2a')](function(_0x2fec6b){if(_0x2fec6b){_0x2fec6b[_0xa738('0x107')]('chatLicenseExceeded');}});}})[_0xa738('0x2a')](function(){var _0x6cc08c=_0x562acc[_0xa738('0xad')];var _0x525713=_0x562acc[_0xa738('0x108')]||undefined;return _0x6cc08c?_0x6cc08c[_0xa738('0x99')](_0x525713):!![];})[_0xa738('0x2a')](function(_0x455727){var _0x255066=fs[_0xa738('0x109')](path[_0xa738('0x86')](config['root'],_0xa738('0x10a')),'utf8');var _0x2d2e4f='3.9.0';var _0x31e62c=![];var _0xccd7ea,_0x2b8659;if(_0x40692c[_0xa738('0xb7')][_0xa738('0x3c')]){_0xccd7ea=new URL(_0x40692c[_0xa738('0xb7')][_0xa738('0x3c')])[_0xa738('0x10b')];}else if(_0x40692c[_0xa738('0xb7')]['origin']){_0xccd7ea=new URL(_0x40692c[_0xa738('0xb7')]['origin'])['origin'];}else{_0xccd7ea=_0xa738('0x10c');}_0x2b8659=typeof _0x562acc[_0xa738('0x65')][_0xa738('0x38')](',')[_0xa738('0x63')](function(_0x5ed53e){return wildcardUtils[_0xa738('0x10d')](_0x5ed53e,_0xccd7ea);})!=='undefined';var _0x428f51={'chatVersion':_0x2d2e4f,'chatWebsiteAddressOrigin':_0x2b8659?_0xccd7ea:_0x562acc[_0xa738('0x65')],'remote':_0x562acc[_0xa738('0x10e')],'query':querystring[_0xa738('0x1b')](_[_0xa738('0x58')](_0x562acc[_0xa738('0x2c')]({'plain':!![]}),{'customerIp':_0x40692c[_0xa738('0xb7')][_0xa738('0x36')]||_0x40692c[_0xa738('0xb7')]['x-real-ip']||_0x40692c[_0xa738('0x10f')][_0xa738('0x110')]||_0x40692c['ip'],'referer':_0x40692c[_0xa738('0xb7')][_0xa738('0x3c')],'openedInteractions':_0xd50f9c,'maxInteractions':_0x3eb35b,'virtual':_0x41b3b3[_0xa738('0x111')],'online':_0x455727,'custom':_0x41b3b3,'address':_0x2b8659?_0xccd7ea:null}))[_0xa738('0x112')](/'/g,'\x5c\x27')};_0x5635cb['send'](ejs[_0xa738('0xdd')](Mustache[_0xa738('0xdd')](_0x255066,_0x428f51),{'proactiveActions':_0x56e764,'alignment':_0x562acc['alignment'],'verticalAlignment':_0x562acc[_0xa738('0x113')],'div_color':_0x562acc[_0xa738('0x114')],'labelText':_0x562acc['labelText'],'text_color':_0x562acc['textColor'],'text_button_color':_0x562acc[_0xa738('0x115')],'button_color':_0x562acc[_0xa738('0x116')],'background_color':_0x562acc['backgroundColor'],'hideWhenOffline':_0x562acc[_0xa738('0x117')],'intervalId':_0x562acc[_0xa738('0x118')],'isDevelopment':_0x31e62c,'chatVersion':_0x2d2e4f}));})[_0xa738('0x20')](handleError(_0x5635cb,null));};exports[_0xa738('0x119')]=function(_0x336c09,_0x31487f){var _0x343051=_0x336c09['params']['id'];var _0x357fe4=_0x336c09[_0xa738('0x64')];var _0x3e7fab=0xc8;var _0x587224=null;return db[_0xa738('0xe7')][_0xa738('0x11a')]({'isolationLevel':db[_0xa738('0xe7')]['Transaction']['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x207e29){return db[_0xa738('0x5c')]['findOne']({'where':{'id':_0x343051},'transaction':_0x207e29})[_0xa738('0x2a')](function(_0x592b68){if(_0x592b68){return db[_0xa738('0xab')]['destroy']({'where':{'ChatWebsiteId':_0x343051},'transaction':_0x207e29})['then'](function(){var _0x423cc8=_[_0xa738('0x48')](_0x357fe4,function(_0x33ea58){_0x33ea58['ChatWebsiteId']=_0x343051;return _0x33ea58;});return db[_0xa738('0xab')][_0xa738('0xe9')](_0x423cc8,{'transaction':_0x207e29});});}else{_0x3e7fab=0x194;_0x587224=[];}});})[_0xa738('0x2a')](function(){if(_0x3e7fab!==0x194){return db[_0xa738('0xab')]['findAndCountAll']({'where':{'ChatWebsiteId':_0x343051},'order':_0xa738('0xb2')})['then'](function(_0x34e2b2){_0x587224=_0x34e2b2;});}})['catch'](function(_0x3befce){_0x3e7fab=0x1f4;logger[_0xa738('0x1c')](_0x3befce[_0xa738('0x2e')]);if(_0x3befce[_0xa738('0x2f')]){delete _0x3befce[_0xa738('0x2f')];}_0x587224=_0x3befce;})[_0xa738('0x11b')](function(){if(_0x587224===null){_0x31487f[_0xa738('0x11c')](_0x3e7fab);}else{if(_0x3e7fab===0x1f4){_0x31487f[_0xa738('0x21')](_0x3e7fab)['send'](_0x587224);}else{_0x31487f['status'](_0x3e7fab)[_0xa738('0x23')](_0x587224);}}});};exports[_0xa738('0x11d')]=function(_0x46935c,_0x3f540e){var _0x944a81={};var _0x474864={};var _0x1e59e7;var _0x5ccf9a;return db['ChatWebsite']['findOne']({'where':{'id':_0x46935c[_0xa738('0x5f')]['id']}})[_0xa738('0x2a')](handleEntityNotFound(_0x3f540e,null))[_0xa738('0x2a')](function(_0x276ade){if(_0x276ade){_0x1e59e7=_0x276ade;_0x474864[_0xa738('0x43')]=_[_0xa738('0x4c')](db[_0xa738('0xab')][_0xa738('0x49')]);_0x474864[_0xa738('0x4d')]=_[_0xa738('0x4c')](_0x46935c[_0xa738('0x4d')]);_0x474864[_0xa738('0x4e')]=_[_0xa738('0x4f')](_0x474864[_0xa738('0x43')],_0x474864[_0xa738('0x4d')]);_0x944a81[_0xa738('0x50')]=_['intersection'](_0x474864[_0xa738('0x43')],qs[_0xa738('0x61')](_0x46935c[_0xa738('0x4d')][_0xa738('0x61')]));_0x944a81[_0xa738('0x50')]=_0x944a81[_0xa738('0x50')][_0xa738('0x51')]?_0x944a81[_0xa738('0x50')]:_0x474864[_0xa738('0x43')];_0x944a81['order']=qs[_0xa738('0x55')](_0x46935c[_0xa738('0x4d')]['sort']);_0x944a81[_0xa738('0x57')]=qs[_0xa738('0x4e')](_[_0xa738('0x56')](_0x46935c['query'],_0x474864[_0xa738('0x4e')]));if(_0x46935c[_0xa738('0x4d')][_0xa738('0x5a')]){_0x944a81[_0xa738('0x57')]=_[_0xa738('0x58')](_0x944a81[_0xa738('0x57')],{'$or':_[_0xa738('0x48')](_0x944a81[_0xa738('0x50')],function(_0x1bfb6f){var _0xae3099={};_0xae3099[_0x1bfb6f]={'$like':'%'+_0x46935c[_0xa738('0x4d')][_0xa738('0x5a')]+'%'};return _0xae3099;})});}_0x944a81=_[_0xa738('0x58')]({},_0x944a81,_0x46935c[_0xa738('0x5b')]);return _0x1e59e7[_0xa738('0x11d')](_0x944a81);}})[_0xa738('0x2a')](function(_0x221ba4){if(_0x221ba4){_0x5ccf9a=_0x221ba4['length'];if(!_0x46935c[_0xa738('0x4d')]['hasOwnProperty'](_0xa738('0x53'))){_0x944a81[_0xa738('0x27')]=qs['limit'](_0x46935c[_0xa738('0x4d')][_0xa738('0x27')]);_0x944a81['offset']=qs[_0xa738('0x24')](_0x46935c[_0xa738('0x4d')][_0xa738('0x24')]);}return _0x1e59e7[_0xa738('0x11d')](_0x944a81);}})[_0xa738('0x2a')](function(_0x2e2898){if(_0x2e2898){return _0x2e2898?{'count':_0x5ccf9a,'rows':_0x2e2898}:null;}})[_0xa738('0x2a')](respondWithResult(_0x3f540e,null))[_0xa738('0x20')](handleError(_0x3f540e,null));};exports[_0xa738('0x11e')]=function(_0x40e2bc,_0x209140){return db['chatProactiveAction'][_0xa738('0x63')]({'where':{'id':_0x40e2bc[_0xa738('0x5f')]['id']}})[_0xa738('0x2a')](handleEntityNotFound(_0x209140,null))[_0xa738('0x2a')](function(_0x5d3bda){if(_0x5d3bda){return _0x5d3bda['addProactiveActions'](_0x40e2bc[_0xa738('0x64')]['ids'],_[_0xa738('0xfb')](_0x40e2bc[_0xa738('0x64')],['ids','id'])||{});}})[_0xa738('0x2a')](respondWithResult(_0x209140,null))[_0xa738('0x20')](handleError(_0x209140,null));};exports[_0xa738('0x105')]=function(_0x51b40e,_0x349eda){var _0x58a33f={};var _0x5729c0={};var _0x24efef;var _0x171957;return db['ChatWebsite'][_0xa738('0x7c')]({'where':{'id':_0x51b40e[_0xa738('0x5f')]['id']}})[_0xa738('0x2a')](handleEntityNotFound(_0x349eda,null))[_0xa738('0x2a')](function(_0x38d5ef){if(_0x38d5ef){_0x24efef=_0x38d5ef;_0x5729c0[_0xa738('0x43')]=_[_0xa738('0x4c')](db[_0xa738('0x11f')][_0xa738('0x49')]);_0x5729c0[_0xa738('0x4d')]=_[_0xa738('0x4c')](_0x51b40e[_0xa738('0x4d')]);_0x5729c0[_0xa738('0x4e')]=_['intersection'](_0x5729c0[_0xa738('0x43')],_0x5729c0[_0xa738('0x4d')]);_0x58a33f[_0xa738('0x50')]=_[_0xa738('0x4f')](_0x5729c0[_0xa738('0x43')],qs['fields'](_0x51b40e[_0xa738('0x4d')][_0xa738('0x61')]));_0x58a33f['attributes']=_0x58a33f[_0xa738('0x50')]['length']?_0x58a33f['attributes']:_0x5729c0[_0xa738('0x43')];_0x58a33f['order']=qs['sort'](_0x51b40e[_0xa738('0x4d')][_0xa738('0x55')]);_0x58a33f['where']=qs['filters'](_[_0xa738('0x56')](_0x51b40e[_0xa738('0x4d')],_0x5729c0['filters']));if(_0x51b40e[_0xa738('0x4d')][_0xa738('0x5a')]){_0x58a33f[_0xa738('0x57')]=_[_0xa738('0x58')](_0x58a33f[_0xa738('0x57')],{'$or':_[_0xa738('0x48')](_0x58a33f[_0xa738('0x50')],function(_0xeaf069){var _0x1a539f={};_0x1a539f[_0xeaf069]={'$like':'%'+_0x51b40e[_0xa738('0x4d')][_0xa738('0x5a')]+'%'};return _0x1a539f;})});}_0x58a33f=_[_0xa738('0x58')]({},_0x58a33f,_0x51b40e['options']);return _0x24efef[_0xa738('0x105')](_0x58a33f);}})[_0xa738('0x2a')](function(_0x1cee7a){if(_0x1cee7a){_0x171957=_0x1cee7a['length'];if(!_0x51b40e[_0xa738('0x4d')][_0xa738('0x52')](_0xa738('0x53'))){_0x58a33f[_0xa738('0x27')]=qs['limit'](_0x51b40e['query'][_0xa738('0x27')]);_0x58a33f[_0xa738('0x24')]=qs[_0xa738('0x24')](_0x51b40e[_0xa738('0x4d')]['offset']);}return _0x24efef[_0xa738('0x105')](_0x58a33f);}})[_0xa738('0x2a')](function(_0x18d957){if(_0x18d957){return _0x18d957?{'count':_0x171957,'rows':_0x18d957}:null;}})[_0xa738('0x2a')](respondWithResult(_0x349eda,null))[_0xa738('0x20')](handleError(_0x349eda,null));};exports[_0xa738('0x120')]=function(_0x3e71c3,_0x55f22f){var _0x530d3e=_0x3e71c3[_0xa738('0x4d')][_0xa738('0x121')]==='false'?_0xa738('0x122'):'onlineForm';return db['ChatWebsite'][_0xa738('0x63')]({'attributes':['id',_0x530d3e],'where':{'id':_0x3e71c3[_0xa738('0x5f')]['id']}})[_0xa738('0x2a')](handleEntityNotFound(_0x55f22f,null))[_0xa738('0x2a')](function(_0xf36401){if(_0xf36401){var _0x5bf84b=_0xf36401[_0x530d3e];var _0x387903=_0x5bf84b&&_0x5bf84b['items']?_0x5bf84b['items']:[];_0x55f22f['send']({'fromKey':_['isNil'](_0x5bf84b[_0xa738('0x123')])?undefined:_0x5bf84b[_0xa738('0x123')],'count':_0x387903[_0xa738('0x51')],'rows':_0x387903});}})['catch'](handleError(_0x55f22f,null));};exports[_0xa738('0x124')]=function(_0x5f2383,_0x32f4fd){var _0x69f37b={'raw':![],'where':{}};var _0x4ee317={};var _0x3f34f1={'count':0x0,'rows':[]};return db[_0xa738('0x5c')]['findOne']({'where':{'id':_0x5f2383[_0xa738('0x5f')]['id']}})[_0xa738('0x2a')](handleEntityNotFound(_0x32f4fd,null))['then'](function(_0x59ee28){if(_0x59ee28){_0x4ee317[_0xa738('0x43')]=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x4ee317[_0xa738('0x4d')]=_['keys'](_0x5f2383['query']);_0x4ee317[_0xa738('0x4e')]=_['intersection'](_0x4ee317[_0xa738('0x43')],_0x4ee317[_0xa738('0x4d')]);_0x69f37b[_0xa738('0x50')]=_[_0xa738('0x4f')](_0x4ee317[_0xa738('0x43')],qs[_0xa738('0x61')](_0x5f2383[_0xa738('0x4d')][_0xa738('0x61')]));_0x69f37b[_0xa738('0x50')]=_0x69f37b['attributes'][_0xa738('0x51')]?_0x69f37b[_0xa738('0x50')]:_0x4ee317[_0xa738('0x43')];if(!_0x5f2383[_0xa738('0x4d')][_0xa738('0x52')]('nolimit')){_0x69f37b[_0xa738('0x27')]=qs[_0xa738('0x27')](_0x5f2383[_0xa738('0x4d')]['limit']);_0x69f37b[_0xa738('0x24')]=qs['offset'](_0x5f2383[_0xa738('0x4d')]['offset']);}_0x69f37b[_0xa738('0x54')]=qs['sort'](_0x5f2383[_0xa738('0x4d')][_0xa738('0x55')]);_0x69f37b['where']=qs[_0xa738('0x4e')](_[_0xa738('0x56')](_0x5f2383[_0xa738('0x4d')],_0x4ee317[_0xa738('0x4e')]));_0x69f37b[_0xa738('0x57')]['ChatWebsiteId']=_0x59ee28['id'];if(_0x5f2383[_0xa738('0x4d')][_0xa738('0x5a')]){_0x69f37b[_0xa738('0x57')]=_[_0xa738('0x58')](_0x69f37b[_0xa738('0x57')],{'$or':_['map'](_0x69f37b[_0xa738('0x50')],function(_0x4c2dc4){var _0x2f960b={};_0x2f960b[_0x4c2dc4]={'$like':'%'+_0x5f2383[_0xa738('0x4d')][_0xa738('0x5a')]+'%'};return _0x2f960b;})});}_0x69f37b=_[_0xa738('0x58')]({},_0x69f37b,_0x5f2383[_0xa738('0x5b')]);return db[_0xa738('0xe0')]['count']({'where':_0x69f37b['where']})[_0xa738('0x2a')](function(_0x1e0e18){_0x3f34f1[_0xa738('0x26')]=_0x1e0e18;if(_0x5f2383[_0xa738('0x4d')]['includeAll']){_0x69f37b[_0xa738('0x62')]=[{'all':!![]}];}else{_0x69f37b[_0xa738('0x62')]=[{'model':db[_0xa738('0xa2')],'as':_0xa738('0x125'),'required':![]},{'model':db[_0xa738('0xe8')],'as':'Attachments','required':![]}];}return db[_0xa738('0xe0')][_0xa738('0x5d')](_0x69f37b);})[_0xa738('0x2a')](function(_0x4361f9){_0x3f34f1['rows']=_0x4361f9;return _0x3f34f1;});}})[_0xa738('0x2a')](respondWithFilteredResult(_0x32f4fd,_0x69f37b))[_0xa738('0x20')](handleError(_0x32f4fd,null));};exports[_0xa738('0x126')]=function(_0x3f79eb,_0x44fccf){return db[_0xa738('0x5c')][_0xa738('0x63')]({'where':{'id':_0x3f79eb[_0xa738('0x5f')]['id']}})[_0xa738('0x2a')](handleEntityNotFound(_0x44fccf,null))[_0xa738('0x2a')](function(_0x4fe21b){if(_0x4fe21b){return _0x4fe21b[_0xa738('0x126')](_0x3f79eb[_0xa738('0x64')][_0xa738('0x78')],_[_0xa738('0xfb')](_0x3f79eb['body'],['ids','id'])||{})['spread'](function(_0x577b8f){for(var _0x20a400=0x0;_0x20a400<_0x3f79eb[_0xa738('0x64')]['ids'][_0xa738('0x51')];_0x20a400+=0x1){socket[_0xa738('0x127')](_0xa738('0x128'),{'UserId':Number(_0x3f79eb[_0xa738('0x64')]['ids'][_0x20a400]),'ChatWebsiteId':Number(_0x3f79eb['params']['id'])});}return _0x577b8f;});}})[_0xa738('0x2a')](respondWithResult(_0x44fccf,null))[_0xa738('0x20')](handleError(_0x44fccf,null));};exports['removeAgents']=function(_0x176ccb,_0x3f182b){return db[_0xa738('0x5c')]['find']({'where':{'id':_0x176ccb[_0xa738('0x5f')]['id']}})['then'](handleEntityNotFound(_0x3f182b,null))[_0xa738('0x2a')](function(_0x530b1b){if(_0x530b1b){return _0x530b1b['removeAgents'](_0x176ccb[_0xa738('0x4d')][_0xa738('0x78')])[_0xa738('0x2a')](function(){if(_['isArray'](_0x176ccb[_0xa738('0x4d')][_0xa738('0x78')])){for(var _0x17107c=0x0;_0x17107c<_0x176ccb[_0xa738('0x4d')]['ids']['length'];_0x17107c+=0x1){socket[_0xa738('0x127')](_0xa738('0x129'),{'UserId':Number(_0x176ccb[_0xa738('0x4d')]['ids'][_0x17107c]),'ChatWebsiteId':Number(_0x176ccb[_0xa738('0x5f')]['id'])});}}else{socket['emit'](_0xa738('0x129'),{'UserId':Number(_0x176ccb[_0xa738('0x4d')][_0xa738('0x78')]),'ChatWebsiteId':Number(_0x176ccb['params']['id'])});}});}})[_0xa738('0x2a')](respondWithStatusCode(_0x3f182b,null))[_0xa738('0x20')](handleError(_0x3f182b,null));};exports[_0xa738('0x12a')]=function(_0x48b4f0,_0x48be2d){var _0x1a7c16={};var _0x1c1609={};var _0x3b7f9f;var _0x46aa39;return db[_0xa738('0x5c')][_0xa738('0x7c')]({'where':{'id':_0x48b4f0[_0xa738('0x5f')]['id']}})[_0xa738('0x2a')](handleEntityNotFound(_0x48be2d,null))[_0xa738('0x2a')](function(_0x25360b){if(_0x25360b){_0x3b7f9f=_0x25360b;_0x1c1609[_0xa738('0x43')]=_[_0xa738('0x4c')](db['User'][_0xa738('0x49')]);_0x1c1609[_0xa738('0x4d')]=_[_0xa738('0x4c')](_0x48b4f0[_0xa738('0x4d')]);_0x1c1609[_0xa738('0x4e')]=_['intersection'](_0x1c1609['model'],_0x1c1609['query']);_0x1a7c16[_0xa738('0x50')]=_[_0xa738('0x4f')](_0x1c1609[_0xa738('0x43')],qs[_0xa738('0x61')](_0x48b4f0[_0xa738('0x4d')][_0xa738('0x61')]));_0x1a7c16[_0xa738('0x50')]=_0x1a7c16[_0xa738('0x50')]['length']?_0x1a7c16[_0xa738('0x50')]:_0x1c1609['model'];_0x1a7c16[_0xa738('0x54')]=qs['sort'](_0x48b4f0[_0xa738('0x4d')]['sort']);_0x1a7c16[_0xa738('0x57')]=qs[_0xa738('0x4e')](_['pick'](_0x48b4f0[_0xa738('0x4d')],_0x1c1609[_0xa738('0x4e')]));if(_0x48b4f0[_0xa738('0x4d')][_0xa738('0x5a')]){_0x1a7c16[_0xa738('0x57')]=_[_0xa738('0x58')](_0x1a7c16[_0xa738('0x57')],{'$or':_[_0xa738('0x48')](_0x1a7c16['attributes'],function(_0xabd33d){var _0x3eac3b={};_0x3eac3b[_0xabd33d]={'$like':'%'+_0x48b4f0['query'][_0xa738('0x5a')]+'%'};return _0x3eac3b;})});}_0x1a7c16=_[_0xa738('0x58')]({},_0x1a7c16,_0x48b4f0[_0xa738('0x5b')]);return _0x3b7f9f[_0xa738('0x12a')](_0x1a7c16);}})[_0xa738('0x2a')](function(_0x260f8c){if(_0x260f8c){_0x46aa39=_0x260f8c[_0xa738('0x51')];if(!_0x48b4f0['query']['hasOwnProperty'](_0xa738('0x53'))){_0x1a7c16[_0xa738('0x27')]=qs['limit'](_0x48b4f0[_0xa738('0x4d')][_0xa738('0x27')]);_0x1a7c16[_0xa738('0x24')]=qs[_0xa738('0x24')](_0x48b4f0[_0xa738('0x4d')][_0xa738('0x24')]);}return _0x3b7f9f[_0xa738('0x12a')](_0x1a7c16);}})[_0xa738('0x2a')](function(_0x223f47){if(_0x223f47){return _0x223f47?{'count':_0x46aa39,'rows':_0x223f47}:null;}})['then'](respondWithResult(_0x48be2d,null))['catch'](handleError(_0x48be2d,null));}; \ No newline at end of file +var _0x12c4=['server/files/images/avatars/system_avatar.png','Interval','resolve','ifTime','chat','from','From\x20is\x20mandatory','isEmpty','Body\x20is\x20mandatory','customerIp','CmContact','No\x20available\x20attributes','createdAt','updatedAt','includes','CompanyId','CmList','Contacts','ChatApplication','Applications','Intervals','interval','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','account','applications','orderBy','priority','list','List','ListId','defaults','mapKey','contact','headers','threadId','closed','Writing\x20on\x20closed\x20interaction','externalUrl','ChatInteraction','ContactId','interaction','messageId','created','push','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','agent','waitForTheAssignedAgent','forcedOwnership','queueId','ChatQueue','unshift','queue','Start','startRouting','EventManager','offline','files','Sequelize','no\x20available\x20attributes','difference','send','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','spread','readFileSync','utf8','offlineMessageBody','ChatOfflineMessage','fromString','originalname','mimetype','server','attachments','offline-chat','openNewInteraction','sequelize','Attachment','Smtp','CloudProvider','forwardOffline','SendMail','sendMail','email','forwardOfflineAddress','offlineMessageSubject','toPairsIn','mapValues','subjectOffline','Chat','MailAccountId','NotifyMailAccount','notifyMail','Could\x20not\x20remove\x20attachment\x20file','omit','getInteractions','Contact','User','internal','Tags','color','tag','getProactiveActions','virtual','custom','License','increment','timezone','server/files/chat/iframe.ejs','3.9.0','origin','http://localhost:9000','testWebsiteWithWildcard','remote','x-real-ip','connection','remoteAddress','alignment','labelText','textButtonColor','color_button','backgroundColor','hideWhenOffline','IntervalId','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','finally','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getFields','online','false','offlineForm','onlineForm','items','fromKey','Attachments','addAgents','userChatWebsite:save','removeAgents','emit','userChatWebsite:remove','getAgents','mustache','util','path','ejs','fs-extra','lodash','querystring','ioredis','jayson/promise','../../components/parsers/qs','api','../../config/environment','../../errors/api','APINotFoundError','handleError','./helpers/wildcard-expressions','url','URL','../../mysqldb','redis','localhost','./chatWebsite.socket','register','client','http','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','destroy','get','ChatWebsites','UserProfileResource','stack','name','user-agent-parser','setUA','user-agent','getResult','cf-connecting-ip','x-forwarded-for','first','split','firstName','lastName','x-real-port','referer','browser','version','%s\x20%s','unknown','device','vendor','format','%s\x20%s\x20%s','model','type','index','mandatoryDispositionPause','rawAttributes','key','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','includeAll','include','ChatWebsite','findAll','catch','params','Pause','keys','options','find','create','body','trim','testWildcardValidity','\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','address','forEach','describe','ChatWebsiteId','Disposition','getDispositions','findOne','nolimit','order','rows','ids','CannedAnswer','getAnswers','removeAnswers','addLogo','sitepic','file','agentAvatar','filename','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','isNil','existsSync','server/files/images/logos/','download','getAvatar','server/files/images/avatars/','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar'];(function(_0xfcbcb8,_0x35bf6b){var _0x1b1f97=function(_0x51e11d){while(--_0x51e11d){_0xfcbcb8['push'](_0xfcbcb8['shift']());}};_0x1b1f97(++_0x35bf6b);}(_0x12c4,0x9e));var _0x412c=function(_0x5123bb,_0x1c87f7){_0x5123bb=_0x5123bb-0x0;var _0x58305f=_0x12c4[_0x5123bb];return _0x58305f;};'use strict';var Mustache=require(_0x412c('0x0'));var util=require(_0x412c('0x1'));var path=require(_0x412c('0x2'));var ejs=require(_0x412c('0x3'));var fs=require('fs');var fs_extra=require(_0x412c('0x4'));var _=require(_0x412c('0x5'));var querystring=require(_0x412c('0x6'));var htmlToText=require('html-to-text');var Redis=require(_0x412c('0x7'));var jayson=require(_0x412c('0x8'));var qs=require(_0x412c('0x9'));var logger=require('../../config/logger')(_0x412c('0xa'));var config=require(_0x412c('0xb'));var APIBadRequestError=require('../../errors/api')['APIBadRequestError'];var APINotFoundError=require(_0x412c('0xc'))[_0x412c('0xd')];var APIOutOfIntervalError=require(_0x412c('0xc'))['APIOutOfIntervalError'];var APIHandleError=require(_0x412c('0xc'))[_0x412c('0xe')];var APIConflictError=require(_0x412c('0xc'))['APIConflictError'];var wildcardUtils=require(_0x412c('0xf'));var URL=require(_0x412c('0x10'))[_0x412c('0x11')];var db=require(_0x412c('0x12'))['db'];config[_0x412c('0x13')]=_['defaults'](config[_0x412c('0x13')],{'host':_0x412c('0x14'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x412c('0x13')]));require(_0x412c('0x15'))[_0x412c('0x16')](socket);var client=jayson[_0x412c('0x17')][_0x412c('0x18')]({'port':0x232c});var client9002=jayson[_0x412c('0x17')][_0x412c('0x18')]({'port':0x232a});var client9003=jayson[_0x412c('0x17')][_0x412c('0x18')]({'port':0x232b});var client9001=jayson[_0x412c('0x17')][_0x412c('0x18')]({'port':0x2329});function respondWithRpcPromise(_0x401e21,_0x5f0e15,_0x4af34f,_0x164eef){return new Promise(function(_0x5e904e,_0x2baced){var _0x5936a4=_0x164eef||client;return _0x5936a4['request'](_0x401e21,_0x4af34f)[_0x412c('0x19')](function(_0xf3134f){logger['info'](_0x412c('0x1a'),_0x5f0e15,_0x412c('0x1b'));logger['debug']('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x5f0e15,_0x412c('0x1b'),JSON[_0x412c('0x1c')](_0xf3134f));if(_0xf3134f[_0x412c('0x1d')]){if(_0xf3134f[_0x412c('0x1d')][_0x412c('0x1e')]===0x1f4){logger[_0x412c('0x1d')]('ChatWebsite,\x20%s,\x20%s',_0x5f0e15,_0xf3134f['error'][_0x412c('0x1f')]);return _0x2baced(_0xf3134f[_0x412c('0x1d')]['message']);}logger[_0x412c('0x1d')]('ChatWebsite,\x20%s,\x20%s',_0x5f0e15,_0xf3134f[_0x412c('0x1d')][_0x412c('0x1f')]);return _0x5e904e(_0xf3134f[_0x412c('0x1d')][_0x412c('0x1f')]);}else{logger[_0x412c('0x20')](_0x412c('0x1a'),_0x5f0e15,_0x412c('0x1b'));_0x5e904e(_0xf3134f[_0x412c('0x21')][_0x412c('0x1f')]);}})['catch'](function(_0x560a6e){logger['error'](_0x412c('0x1a'),_0x5f0e15,_0x560a6e);_0x2baced(_0x560a6e);});});}function respondWithStatusCode(_0xfb1d0c,_0x275fd8){_0x275fd8=_0x275fd8||0xcc;return function(_0x5ad768){if(_0x5ad768){return _0xfb1d0c[_0x412c('0x22')](_0x275fd8);}return _0xfb1d0c[_0x412c('0x23')](_0x275fd8)[_0x412c('0x24')]();};}function respondWithResult(_0x33f7d1,_0x159e62){_0x159e62=_0x159e62||0xc8;return function(_0x137b41){if(_0x137b41){return _0x33f7d1[_0x412c('0x23')](_0x159e62)[_0x412c('0x25')](_0x137b41);}};}function respondWithFilteredResult(_0x65c844,_0x3f0244){return function(_0x431683){if(_0x431683){var _0x4094cc=typeof _0x3f0244[_0x412c('0x26')]===_0x412c('0x27')&&typeof _0x3f0244[_0x412c('0x28')]===_0x412c('0x27');var _0x178358=_0x431683[_0x412c('0x29')];var _0xf97d44=_0x4094cc?0x0:_0x3f0244[_0x412c('0x26')];var _0x23fc03=_0x4094cc?_0x431683['count']:_0x3f0244['offset']+_0x3f0244['limit'];var _0x3e16bd;if(_0x23fc03>=_0x178358){_0x23fc03=_0x178358;_0x3e16bd=0xc8;}else{_0x3e16bd=0xce;}_0x65c844[_0x412c('0x23')](_0x3e16bd);return _0x65c844[_0x412c('0x2a')](_0x412c('0x2b'),_0xf97d44+'-'+_0x23fc03+'/'+_0x178358)['json'](_0x431683);}return null;};}function saveUpdates(_0x2ab033){return function(_0x266451){if(_0x266451){return _0x266451['update'](_0x2ab033)[_0x412c('0x19')](function(_0x14ff2f){return _0x14ff2f;});}return null;};}function removeEntity(_0x12ee66){return function(_0x5b2a67){if(_0x5b2a67){return _0x5b2a67[_0x412c('0x2c')]()[_0x412c('0x19')](function(){var _0x5279c5=_0x5b2a67[_0x412c('0x2d')]({'plain':!![]});var _0xf63503=_0x412c('0x2e');return db[_0x412c('0x2f')][_0x412c('0x2c')]({'where':{'type':_0xf63503,'resourceId':_0x5279c5['id']}})[_0x412c('0x19')](function(){return _0x5b2a67;});})[_0x412c('0x19')](function(){_0x12ee66[_0x412c('0x23')](0xcc)[_0x412c('0x24')]();});}};}function handleEntityNotFound(_0x2b7018){return function(_0x307774){if(!_0x307774){_0x2b7018[_0x412c('0x22')](0x194);}return _0x307774;};}function handleError(_0x13790a,_0x1ba76f){_0x1ba76f=_0x1ba76f||0x1f4;return function(_0x3d3b73){logger[_0x412c('0x1d')](_0x3d3b73[_0x412c('0x30')]);if(_0x3d3b73[_0x412c('0x31')]){delete _0x3d3b73[_0x412c('0x31')];}_0x13790a[_0x412c('0x23')](_0x1ba76f)['send'](_0x3d3b73);};}function createInteractionObject(_0x7eb13e,_0x5ede4c,_0xa7f149,_0x5a7a3b){var _0x4f9f6c=require(_0x412c('0x32'));var _0x400e2c=new _0x4f9f6c();var _0x5bb8b8=_0x400e2c[_0x412c('0x33')](_0xa7f149[_0x412c('0x34')])[_0x412c('0x35')]();var _0x2fce65=_0x5ede4c['customerIp'];if(_0xa7f149[_0x412c('0x36')]){_0x2fce65=_0xa7f149[_0x412c('0x36')];}else if(_0xa7f149[_0x412c('0x37')]){_0x2fce65=_[_0x412c('0x38')](_0xa7f149[_0x412c('0x37')][_0x412c('0x39')](','));}return{'ContactId':_0x5a7a3b['id'],'ChatWebsiteId':_0x7eb13e,'from':(_0x5a7a3b[_0x412c('0x3a')]||'')+'\x20'+(_0x5a7a3b[_0x412c('0x3b')]||''),'customerIp':_0x2fce65,'customerPort':_0xa7f149[_0x412c('0x3c')]?_0xa7f149[_0x412c('0x3c')]:null,'referer':_0x5ede4c[_0x412c('0x3d')],'browserName':_0x5bb8b8[_0x412c('0x3e')][_0x412c('0x31')]&&_0x5bb8b8[_0x412c('0x3e')][_0x412c('0x3f')]?util['format'](_0x412c('0x40'),_0x5bb8b8[_0x412c('0x3e')][_0x412c('0x31')],_0x5bb8b8[_0x412c('0x3e')][_0x412c('0x3f')]):'unknown','browserVersion':_0x5bb8b8[_0x412c('0x3e')][_0x412c('0x3f')]||_0x412c('0x41'),'osName':util['format'](_0x412c('0x40'),_0x5bb8b8['os'][_0x412c('0x31')],_0x5bb8b8['os']['version']),'osVersion':_0x5bb8b8['os'][_0x412c('0x3f')],'deviceModel':_0x5bb8b8[_0x412c('0x42')]['model']&&_0x5bb8b8[_0x412c('0x42')][_0x412c('0x43')]?util[_0x412c('0x44')](_0x412c('0x45'),_0x5bb8b8[_0x412c('0x42')][_0x412c('0x46')],_0x5bb8b8[_0x412c('0x42')][_0x412c('0x43')],_0x5bb8b8[_0x412c('0x42')][_0x412c('0x47')]):null,'deviceVendor':_0x5bb8b8['device'][_0x412c('0x43')],'deviceType':_0x5bb8b8['device'][_0x412c('0x47')],'formData':JSON['stringify'](_0x5ede4c)};}exports[_0x412c('0x48')]=function(_0x4fbb47,_0x1488bf){var _0x164518={'include':[{'model':db['Pause'],'as':_0x412c('0x49')}]},_0x2479db={},_0x3857dc={'count':0x0,'rows':[]};var _0x4f6031=_['map'](db['ChatWebsite'][_0x412c('0x4a')],function(_0x589ca2){return{'name':_0x589ca2['fieldName'],'type':_0x589ca2['type'][_0x412c('0x4b')]};});_0x2479db['model']=_[_0x412c('0x4c')](_0x4f6031,'name');_0x2479db[_0x412c('0x4d')]=_['keys'](_0x4fbb47[_0x412c('0x4d')]);_0x2479db[_0x412c('0x4e')]=_[_0x412c('0x4f')](_0x2479db[_0x412c('0x46')],_0x2479db[_0x412c('0x4d')]);_0x164518[_0x412c('0x50')]=_[_0x412c('0x4f')](_0x2479db['model'],qs['fields'](_0x4fbb47[_0x412c('0x4d')][_0x412c('0x51')]));_0x164518[_0x412c('0x50')]=_0x164518[_0x412c('0x50')][_0x412c('0x52')]?_0x164518['attributes']:_0x2479db[_0x412c('0x46')];if(!_0x4fbb47[_0x412c('0x4d')][_0x412c('0x53')]('nolimit')){_0x164518[_0x412c('0x28')]=qs[_0x412c('0x28')](_0x4fbb47[_0x412c('0x4d')][_0x412c('0x28')]);_0x164518['offset']=qs['offset'](_0x4fbb47['query'][_0x412c('0x26')]);}_0x164518['order']=qs[_0x412c('0x54')](_0x4fbb47[_0x412c('0x4d')][_0x412c('0x54')]);_0x164518[_0x412c('0x55')]=qs['filters'](_[_0x412c('0x56')](_0x4fbb47[_0x412c('0x4d')],_0x2479db[_0x412c('0x4e')]),_0x4f6031);if(_0x4fbb47[_0x412c('0x4d')][_0x412c('0x57')]){_0x164518[_0x412c('0x55')]=_[_0x412c('0x58')](_0x164518[_0x412c('0x55')],{'$or':_[_0x412c('0x4c')](_0x4f6031,function(_0x2f878c){if(_0x2f878c['type']!=='VIRTUAL'){var _0x4f545d={};_0x4f545d[_0x2f878c[_0x412c('0x31')]]={'$like':'%'+_0x4fbb47[_0x412c('0x4d')]['filter']+'%'};return _0x4f545d;}})});}_0x164518=_[_0x412c('0x58')]({},_0x164518,_0x4fbb47['options']);var _0x17f0e2={'where':_0x164518[_0x412c('0x55')]};return db['ChatWebsite'][_0x412c('0x29')](_0x17f0e2)['then'](function(_0x5d9032){_0x3857dc[_0x412c('0x29')]=_0x5d9032;if(_0x4fbb47[_0x412c('0x4d')][_0x412c('0x59')]){_0x164518[_0x412c('0x5a')]=[{'all':!![]}];}return db[_0x412c('0x5b')][_0x412c('0x5c')](_0x164518);})[_0x412c('0x19')](function(_0x17b1f0){_0x3857dc['rows']=_0x17b1f0;return _0x3857dc;})[_0x412c('0x19')](respondWithFilteredResult(_0x1488bf,_0x164518))[_0x412c('0x5d')](handleError(_0x1488bf,null));};exports['show']=function(_0x48918c,_0x5a9610){var _0x2b45c0={'raw':![],'where':{'id':_0x48918c[_0x412c('0x5e')]['id']},'include':[{'model':db[_0x412c('0x5f')],'as':_0x412c('0x49')}]},_0x4e02c4={};_0x4e02c4[_0x412c('0x46')]=_['keys'](db[_0x412c('0x5b')][_0x412c('0x4a')]);_0x4e02c4[_0x412c('0x4d')]=_[_0x412c('0x60')](_0x48918c[_0x412c('0x4d')]);_0x4e02c4[_0x412c('0x4e')]=_['intersection'](_0x4e02c4[_0x412c('0x46')],_0x4e02c4[_0x412c('0x4d')]);_0x2b45c0[_0x412c('0x50')]=_[_0x412c('0x4f')](_0x4e02c4['model'],qs[_0x412c('0x51')](_0x48918c[_0x412c('0x4d')][_0x412c('0x51')]));_0x2b45c0[_0x412c('0x50')]=_0x2b45c0[_0x412c('0x50')][_0x412c('0x52')]?_0x2b45c0['attributes']:_0x4e02c4[_0x412c('0x46')];if(_0x48918c[_0x412c('0x4d')][_0x412c('0x59')]){_0x2b45c0[_0x412c('0x5a')]=[{'all':!![]}];}_0x2b45c0=_[_0x412c('0x58')]({},_0x2b45c0,_0x48918c[_0x412c('0x61')]);return db[_0x412c('0x5b')][_0x412c('0x62')](_0x2b45c0)['then'](handleEntityNotFound(_0x5a9610,null))['then'](respondWithResult(_0x5a9610,null))['catch'](handleError(_0x5a9610,null));};exports[_0x412c('0x63')]=function(_0xccae8a,_0x105a09){var _0x3e03e1=null;_0xccae8a[_0x412c('0x64')]['address']['split'](',')['forEach'](_0x2cc7dc=>{if(_0x2cc7dc[_0x412c('0x65')]()!==''&&!wildcardUtils[_0x412c('0x66')](_0x2cc7dc[_0x412c('0x65')]())){_0x3e03e1=new APIBadRequestError('\x22'+_0x2cc7dc['trim']()+_0x412c('0x67'));}});if(_0x3e03e1){return handleError(_0x105a09,null)(_0x3e03e1);}return db[_0x412c('0x5b')][_0x412c('0x63')](_0xccae8a[_0x412c('0x64')],{})[_0x412c('0x19')](function(_0x4f6670){var _0x18175b=_0xccae8a[_0x412c('0x68')][_0x412c('0x2d')]({'plain':!![]});if(!_0x18175b)throw new Error(_0x412c('0x69'));if(_0x18175b[_0x412c('0x6a')]===_0x412c('0x68')){var _0x91aa25=_0x4f6670[_0x412c('0x2d')]({'plain':!![]});var _0x1536a0=_0x412c('0x2e');return db[_0x412c('0x6b')][_0x412c('0x62')]({'where':{'name':_0x1536a0,'userProfileId':_0x18175b[_0x412c('0x6c')]},'raw':!![]})['then'](function(_0x254414){if(_0x254414&&_0x254414[_0x412c('0x6d')]===0x0){return db[_0x412c('0x2f')][_0x412c('0x63')]({'name':_0x91aa25['name'],'resourceId':_0x91aa25['id'],'type':_0x254414['name'],'sectionId':_0x254414['id']},{})[_0x412c('0x19')](function(){return _0x4f6670;});}else{return _0x4f6670;}})[_0x412c('0x5d')](function(_0x1acc4e){logger[_0x412c('0x1d')](_0x412c('0x6e'),_0x1acc4e);throw _0x1acc4e;});}return _0x4f6670;})[_0x412c('0x19')](respondWithResult(_0x105a09,0xc9))[_0x412c('0x5d')](handleError(_0x105a09,null));};exports[_0x412c('0x6f')]=function(_0x5b498d,_0x5ca107){var _0x17ffff=null;_0x5b498d[_0x412c('0x64')][_0x412c('0x70')]['split'](',')[_0x412c('0x71')](_0x24af73=>{if(_0x24af73['trim']()!==''&&!wildcardUtils[_0x412c('0x66')](_0x24af73['trim']())){_0x17ffff=new APIBadRequestError('\x22'+_0x24af73[_0x412c('0x65')]()+_0x412c('0x67'));}});if(_0x17ffff){return handleError(_0x5ca107,null)(_0x17ffff);}if(_0x5b498d[_0x412c('0x64')]['id']){delete _0x5b498d[_0x412c('0x64')]['id'];}return db[_0x412c('0x5b')][_0x412c('0x62')]({'where':{'id':_0x5b498d[_0x412c('0x5e')]['id']},'include':[{'model':db[_0x412c('0x5f')],'as':_0x412c('0x49')}]})[_0x412c('0x19')](handleEntityNotFound(_0x5ca107,null))[_0x412c('0x19')](saveUpdates(_0x5b498d[_0x412c('0x64')],null))[_0x412c('0x19')](respondWithResult(_0x5ca107,null))[_0x412c('0x5d')](handleError(_0x5ca107,null));};exports[_0x412c('0x2c')]=function(_0x38a696,_0x378b93){return db['ChatWebsite'][_0x412c('0x62')]({'where':{'id':_0x38a696[_0x412c('0x5e')]['id']}})[_0x412c('0x19')](handleEntityNotFound(_0x378b93,null))[_0x412c('0x19')](removeEntity(_0x378b93,null))['catch'](handleError(_0x378b93,null));};exports['describe']=function(_0x197ca8,_0x1dde49){return db['ChatWebsite'][_0x412c('0x72')]()[_0x412c('0x19')](respondWithResult(_0x1dde49,null))[_0x412c('0x5d')](handleError(_0x1dde49,null));};exports['addDisposition']=function(_0x41ead0,_0x1ca519){if(_0x41ead0[_0x412c('0x64')]['id']){delete _0x41ead0[_0x412c('0x64')]['id'];}return db[_0x412c('0x5b')][_0x412c('0x62')]({'where':{'id':_0x41ead0[_0x412c('0x5e')]['id']}})[_0x412c('0x19')](handleEntityNotFound(_0x1ca519,null))['then'](function(_0x579c05){if(_0x579c05){_0x41ead0[_0x412c('0x64')][_0x412c('0x73')]=_0x579c05['id'];return db[_0x412c('0x74')][_0x412c('0x63')](_0x41ead0[_0x412c('0x64')]);}})['then'](respondWithResult(_0x1ca519,null))['catch'](handleError(_0x1ca519,null));};exports[_0x412c('0x75')]=function(_0x48f841,_0x22dcd2){var _0x986aba={'raw':![],'where':{}};var _0x5f286b={};var _0x33f402={'count':0x0,'rows':[]};return db[_0x412c('0x5b')][_0x412c('0x76')]({'where':{'id':_0x48f841[_0x412c('0x5e')]['id']}})[_0x412c('0x19')](handleEntityNotFound(_0x22dcd2,null))['then'](function(_0x1e3c65){if(_0x1e3c65){_0x5f286b['model']=_[_0x412c('0x60')](db[_0x412c('0x74')]['rawAttributes']);_0x5f286b[_0x412c('0x4d')]=_['keys'](_0x48f841[_0x412c('0x4d')]);_0x5f286b[_0x412c('0x4e')]=_[_0x412c('0x4f')](_0x5f286b[_0x412c('0x46')],_0x5f286b[_0x412c('0x4d')]);_0x986aba[_0x412c('0x50')]=_['intersection'](_0x5f286b[_0x412c('0x46')],qs['fields'](_0x48f841[_0x412c('0x4d')][_0x412c('0x51')]));_0x986aba[_0x412c('0x50')]=_0x986aba[_0x412c('0x50')]['length']?_0x986aba[_0x412c('0x50')]:_0x5f286b[_0x412c('0x46')];if(!_0x48f841[_0x412c('0x4d')][_0x412c('0x53')](_0x412c('0x77'))){_0x986aba['limit']=qs[_0x412c('0x28')](_0x48f841[_0x412c('0x4d')][_0x412c('0x28')]);_0x986aba['offset']=qs[_0x412c('0x26')](_0x48f841[_0x412c('0x4d')][_0x412c('0x26')]);}_0x986aba[_0x412c('0x78')]=qs[_0x412c('0x54')](_0x48f841[_0x412c('0x4d')]['sort']);_0x986aba['where']=qs['filters'](_[_0x412c('0x56')](_0x48f841[_0x412c('0x4d')],_0x5f286b['filters']));_0x986aba[_0x412c('0x55')][_0x412c('0x73')]=_0x1e3c65['id'];if(_0x48f841[_0x412c('0x4d')][_0x412c('0x57')]){_0x986aba[_0x412c('0x55')]=_[_0x412c('0x58')](_0x986aba[_0x412c('0x55')],{'$or':_[_0x412c('0x4c')](_0x986aba[_0x412c('0x50')],function(_0x8d286f){var _0x22180b={};_0x22180b[_0x8d286f]={'$like':'%'+_0x48f841['query'][_0x412c('0x57')]+'%'};return _0x22180b;})});}_0x986aba=_[_0x412c('0x58')]({},_0x986aba,_0x48f841['options']);return db[_0x412c('0x74')][_0x412c('0x29')]({'where':_0x986aba[_0x412c('0x55')]})['then'](function(_0x47b3c3){_0x33f402[_0x412c('0x29')]=_0x47b3c3;if(_0x48f841[_0x412c('0x4d')]['includeAll']){_0x986aba['include']=[{'all':!![]}];}return db['Disposition']['findAll'](_0x986aba);})[_0x412c('0x19')](function(_0x36c5af){_0x33f402[_0x412c('0x79')]=_0x36c5af;return _0x33f402;});}})[_0x412c('0x19')](respondWithFilteredResult(_0x22dcd2,_0x986aba))[_0x412c('0x5d')](handleError(_0x22dcd2,null));};exports['removeDispositions']=function(_0x16dd08,_0x1b3dfd){return db[_0x412c('0x5b')]['find']({'where':{'id':_0x16dd08[_0x412c('0x5e')]['id']}})[_0x412c('0x19')](handleEntityNotFound(_0x1b3dfd,null))['then'](function(_0xaade9e){if(_0xaade9e){return _0xaade9e['removeDispositions'](_0x16dd08[_0x412c('0x4d')][_0x412c('0x7a')]);}})[_0x412c('0x19')](respondWithStatusCode(_0x1b3dfd,null))[_0x412c('0x5d')](handleError(_0x1b3dfd,null));};exports['addAnswer']=function(_0x3f60bd,_0x187f35){if(_0x3f60bd[_0x412c('0x64')]['id']){delete _0x3f60bd[_0x412c('0x64')]['id'];}return db['ChatWebsite'][_0x412c('0x62')]({'where':{'id':_0x3f60bd[_0x412c('0x5e')]['id']}})[_0x412c('0x19')](handleEntityNotFound(_0x187f35,null))[_0x412c('0x19')](function(_0x1b2fe8){if(_0x1b2fe8){_0x3f60bd[_0x412c('0x64')][_0x412c('0x73')]=_0x1b2fe8['id'];return db[_0x412c('0x7b')][_0x412c('0x63')](_0x3f60bd[_0x412c('0x64')]);}})[_0x412c('0x19')](respondWithResult(_0x187f35,null))[_0x412c('0x5d')](handleError(_0x187f35,null));};exports[_0x412c('0x7c')]=function(_0x2b1d21,_0x20a3ce){var _0x2db297={'raw':![],'where':{}};var _0x571cd7={};var _0x349555={'count':0x0,'rows':[]};return db[_0x412c('0x5b')][_0x412c('0x76')]({'where':{'id':_0x2b1d21[_0x412c('0x5e')]['id']}})[_0x412c('0x19')](handleEntityNotFound(_0x20a3ce,null))[_0x412c('0x19')](function(_0x39333b){if(_0x39333b){_0x571cd7['model']=_[_0x412c('0x60')](db[_0x412c('0x7b')]['rawAttributes']);_0x571cd7['query']=_[_0x412c('0x60')](_0x2b1d21[_0x412c('0x4d')]);_0x571cd7[_0x412c('0x4e')]=_[_0x412c('0x4f')](_0x571cd7[_0x412c('0x46')],_0x571cd7['query']);_0x2db297[_0x412c('0x50')]=_[_0x412c('0x4f')](_0x571cd7[_0x412c('0x46')],qs[_0x412c('0x51')](_0x2b1d21[_0x412c('0x4d')]['fields']));_0x2db297[_0x412c('0x50')]=_0x2db297[_0x412c('0x50')]['length']?_0x2db297[_0x412c('0x50')]:_0x571cd7[_0x412c('0x46')];if(!_0x2b1d21[_0x412c('0x4d')][_0x412c('0x53')](_0x412c('0x77'))){_0x2db297[_0x412c('0x28')]=qs[_0x412c('0x28')](_0x2b1d21[_0x412c('0x4d')][_0x412c('0x28')]);_0x2db297[_0x412c('0x26')]=qs[_0x412c('0x26')](_0x2b1d21[_0x412c('0x4d')][_0x412c('0x26')]);}_0x2db297[_0x412c('0x78')]=qs[_0x412c('0x54')](_0x2b1d21[_0x412c('0x4d')][_0x412c('0x54')]);_0x2db297[_0x412c('0x55')]=qs[_0x412c('0x4e')](_['pick'](_0x2b1d21[_0x412c('0x4d')],_0x571cd7['filters']));_0x2db297[_0x412c('0x55')][_0x412c('0x73')]=_0x39333b['id'];if(_0x2b1d21['query'][_0x412c('0x57')]){_0x2db297[_0x412c('0x55')]=_[_0x412c('0x58')](_0x2db297[_0x412c('0x55')],{'$or':_[_0x412c('0x4c')](_0x2db297[_0x412c('0x50')],function(_0x59266e){var _0x4a350={};_0x4a350[_0x59266e]={'$like':'%'+_0x2b1d21[_0x412c('0x4d')][_0x412c('0x57')]+'%'};return _0x4a350;})});}_0x2db297=_['merge']({},_0x2db297,_0x2b1d21[_0x412c('0x61')]);return db[_0x412c('0x7b')][_0x412c('0x29')]({'where':_0x2db297['where']})[_0x412c('0x19')](function(_0x350b97){_0x349555[_0x412c('0x29')]=_0x350b97;if(_0x2b1d21[_0x412c('0x4d')][_0x412c('0x59')]){_0x2db297[_0x412c('0x5a')]=[{'all':!![]}];}return db[_0x412c('0x7b')][_0x412c('0x5c')](_0x2db297);})[_0x412c('0x19')](function(_0x4d5c61){_0x349555[_0x412c('0x79')]=_0x4d5c61;return _0x349555;});}})[_0x412c('0x19')](respondWithFilteredResult(_0x20a3ce,_0x2db297))[_0x412c('0x5d')](handleError(_0x20a3ce,null));};exports[_0x412c('0x7d')]=function(_0x76f372,_0x3fbdcb){return db['ChatWebsite'][_0x412c('0x62')]({'where':{'id':_0x76f372[_0x412c('0x5e')]['id']}})[_0x412c('0x19')](handleEntityNotFound(_0x3fbdcb,null))[_0x412c('0x19')](function(_0x20a17b){if(_0x20a17b){return _0x20a17b[_0x412c('0x7d')](_0x76f372[_0x412c('0x4d')][_0x412c('0x7a')]);}})[_0x412c('0x19')](respondWithStatusCode(_0x3fbdcb,null))[_0x412c('0x5d')](handleError(_0x3fbdcb,null));};exports[_0x412c('0x7e')]=function(_0x29fb19,_0x43f079){_0x29fb19[_0x412c('0x64')][_0x412c('0x7f')]=_0x29fb19[_0x412c('0x80')]['filename'];return db[_0x412c('0x5b')]['find']({'where':{'id':_0x29fb19['params']['id']}})['then'](handleEntityNotFound(_0x43f079,null))['then'](saveUpdates(_0x29fb19[_0x412c('0x64')],null))[_0x412c('0x19')](respondWithResult(_0x43f079,null))['catch'](handleError(_0x43f079,null));};exports['addAvatar']=function(_0x4ee4f9,_0x24c909){_0x4ee4f9[_0x412c('0x64')][_0x412c('0x81')]=_0x4ee4f9[_0x412c('0x80')][_0x412c('0x82')];return db[_0x412c('0x5b')][_0x412c('0x62')]({'where':{'id':_0x4ee4f9[_0x412c('0x5e')]['id']}})[_0x412c('0x19')](handleEntityNotFound(_0x24c909,null))[_0x412c('0x19')](saveUpdates(_0x4ee4f9[_0x412c('0x64')],null))[_0x412c('0x19')](respondWithResult(_0x24c909,null))[_0x412c('0x5d')](handleError(_0x24c909,null));};exports['addCustomerAvatar']=function(_0x805d58,_0x355b9a){_0x805d58[_0x412c('0x64')][_0x412c('0x83')]=_0x805d58[_0x412c('0x80')][_0x412c('0x82')];return db[_0x412c('0x5b')][_0x412c('0x62')]({'where':{'id':_0x805d58[_0x412c('0x5e')]['id']}})[_0x412c('0x19')](handleEntityNotFound(_0x355b9a,null))['then'](saveUpdates(_0x805d58['body'],null))[_0x412c('0x19')](respondWithResult(_0x355b9a,null))[_0x412c('0x5d')](handleError(_0x355b9a,null));};exports[_0x412c('0x84')]=function(_0x59686c,_0x5d78c2){_0x59686c['body'][_0x412c('0x85')]=_0x59686c[_0x412c('0x80')][_0x412c('0x82')];return db['ChatWebsite'][_0x412c('0x62')]({'where':{'id':_0x59686c['params']['id']}})['then'](handleEntityNotFound(_0x5d78c2,null))[_0x412c('0x19')](saveUpdates(_0x59686c[_0x412c('0x64')],null))['then'](respondWithResult(_0x5d78c2,null))[_0x412c('0x5d')](handleError(_0x5d78c2,null));};exports[_0x412c('0x86')]=function(_0x41bf83,_0x12d938){var _0x5ab1d7=path[_0x412c('0x87')](config[_0x412c('0x88')],_0x412c('0x89'));var _0x46b734={'where':{'id':_0x41bf83[_0x412c('0x5e')]['id']},'attributes':['id',_0x412c('0x7f')],'raw':!![]};var _0x2fd86d=![];return require(_0x412c('0x8a'))[_0x412c('0x8b')]()[_0x412c('0x19')](function(_0x2c62d0){if(_0x2c62d0){_0x2fd86d=_0x2c62d0['custom'];}})[_0x412c('0x19')](function(){return db['ChatWebsite']['find'](_0x46b734);})['then'](handleEntityNotFound(_0x12d938,null))[_0x412c('0x19')](function(_0x37c540){if(_0x37c540){if(!_[_0x412c('0x8c')](_0x37c540['sitepic'])){if(fs[_0x412c('0x8d')](path[_0x412c('0x87')](config[_0x412c('0x88')],'server/files/images/logos/',_0x37c540['sitepic']))&&_0x2fd86d){_0x5ab1d7=path['join'](config[_0x412c('0x88')],_0x412c('0x8e'),_0x37c540['sitepic']);}}return _0x12d938[_0x412c('0x8f')](_0x5ab1d7);}})[_0x412c('0x5d')](handleError(_0x12d938,null));};exports[_0x412c('0x90')]=function(_0x7fa9f2,_0x2f2390){var _0x22dfec=path['join'](config[_0x412c('0x88')],'server/files/images/avatars/default_avatar.png');var _0xa1a42={'where':{'id':_0x7fa9f2[_0x412c('0x5e')]['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db[_0x412c('0x5b')][_0x412c('0x62')](_0xa1a42)[_0x412c('0x19')](handleEntityNotFound(_0x2f2390,null))[_0x412c('0x19')](function(_0x1fd1fd){if(_0x1fd1fd){if(!_[_0x412c('0x8c')](_0x1fd1fd['agentAvatar'])){if(fs[_0x412c('0x8d')](path[_0x412c('0x87')](config[_0x412c('0x88')],_0x412c('0x91'),_0x1fd1fd[_0x412c('0x81')]))){_0x22dfec=path[_0x412c('0x87')](config['root'],'server/files/images/avatars/',_0x1fd1fd['agentAvatar']);}}return _0x2f2390[_0x412c('0x8f')](_0x22dfec);}})[_0x412c('0x5d')](handleError(_0x2f2390,null));};exports['getCustomerAvatar']=function(_0x590e12,_0x5095ce){var _0x3f5130=path[_0x412c('0x87')](config[_0x412c('0x88')],_0x412c('0x92'));var _0x291549={'where':{'id':_0x590e12[_0x412c('0x5e')]['id']},'attributes':['id','customerAvatar',_0x412c('0x93')],'raw':!![]};return db[_0x412c('0x5b')][_0x412c('0x62')](_0x291549)[_0x412c('0x19')](handleEntityNotFound(_0x5095ce,null))['then'](function(_0x16d515){if(_0x16d515){if(!_[_0x412c('0x8c')](_0x16d515[_0x412c('0x83')])){if(fs[_0x412c('0x8d')](path[_0x412c('0x87')](config[_0x412c('0x88')],_0x412c('0x91'),_0x16d515[_0x412c('0x83')]))&&_0x16d515[_0x412c('0x93')]){_0x3f5130=path[_0x412c('0x87')](config[_0x412c('0x88')],'server/files/images/avatars/',_0x16d515[_0x412c('0x83')]);}}return _0x5095ce[_0x412c('0x8f')](_0x3f5130);}})[_0x412c('0x5d')](handleError(_0x5095ce,null));};exports[_0x412c('0x94')]=function(_0x1cfc68,_0x480662){var _0xf5d22a=path[_0x412c('0x87')](config[_0x412c('0x88')],_0x412c('0x95'));var _0x2f94ba={'where':{'id':_0x1cfc68[_0x412c('0x5e')]['id']},'attributes':['id',_0x412c('0x85')],'raw':!![]};return db[_0x412c('0x5b')][_0x412c('0x62')](_0x2f94ba)[_0x412c('0x19')](handleEntityNotFound(_0x480662,null))['then'](function(_0x55342d){if(_0x55342d){if(!_['isNil'](_0x55342d[_0x412c('0x85')])){if(fs[_0x412c('0x8d')](path[_0x412c('0x87')](config['root'],_0x412c('0x91'),_0x55342d['systemAvatar']))){_0xf5d22a=path[_0x412c('0x87')](config['root'],'server/files/images/avatars/',_0x55342d[_0x412c('0x85')]);}}return _0x480662[_0x412c('0x8f')](_0xf5d22a);}})[_0x412c('0x5d')](handleError(_0x480662,null));};function checkWebsiteInterval(_0x1e982d){var _0x304ed0=_0x1e982d[_0x412c('0x96')];if(!_0x304ed0){return Promise[_0x412c('0x97')](_0x1e982d);}var _0x3f8a44=_0x1e982d['timezone']||undefined;return _0x304ed0[_0x412c('0x98')](_0x3f8a44)[_0x412c('0x19')](function(_0x36423e){if(!_0x36423e){throw new APIOutOfIntervalError();}return _0x1e982d;});}exports['notify']=function(_0x465a62,_0x53c1b8){var _0x1971fa={'body':_0x465a62[_0x412c('0x64')],'channel':_0x412c('0x99')};var _0x3848ac=[];var _0x4b47b9=[];var _0x57ea8f={};var _0xdb0f98=![];if(_0x465a62[_0x412c('0x64')]['id']){delete _0x465a62[_0x412c('0x64')]['id'];}if(_[_0x412c('0x8c')](_0x465a62[_0x412c('0x64')][_0x412c('0x9a')])){throw new APIBadRequestError(_0x412c('0x9b'));}if(_[_0x412c('0x8c')](_0x465a62[_0x412c('0x64')]['mapKey'])){throw new APIBadRequestError('MapKey\x20is\x20mandatory');}if(_[_0x412c('0x9c')](_0x465a62['body'][_0x412c('0x64')])){throw new APIBadRequestError(_0x412c('0x9d'));}var _0x37a9d9=_0x465a62[_0x412c('0x64')][_0x412c('0x9e')]&&_0x465a62[_0x412c('0x64')][_0x412c('0x3d')];return db[_0x412c('0x9f')]['describe']()['then'](function(_0x20de63){if(!_0x20de63){throw new Error(_0x412c('0xa0'));}_0x3848ac=Object[_0x412c('0x60')](_0x20de63)['filter'](function(_0x2089ee){return![_0x412c('0xa1'),_0x412c('0xa2')][_0x412c('0xa3')](_0x2089ee);});_0x4b47b9=Object[_0x412c('0x60')](_0x20de63)[_0x412c('0x57')](function(_0x49efe4){return!['createdAt',_0x412c('0xa2'),_0x412c('0xa4'),'ListId'][_0x412c('0xa3')](_0x49efe4);});if(!_[_0x412c('0xa3')](_0x4b47b9,_0x465a62[_0x412c('0x64')]['mapKey'])){throw new APIBadRequestError('Invalid\x20MapKey\x20parameter.\x20Allowed\x20values:\x20'+_0x4b47b9[_0x412c('0x87')](',\x20'));}_0x57ea8f[_0x465a62[_0x412c('0x64')]['mapKey']]=_0x465a62[_0x412c('0x64')][_0x412c('0x9a')];})[_0x412c('0x19')](function(){return db[_0x412c('0x5b')][_0x412c('0x62')]({'where':{'id':_0x465a62[_0x412c('0x5e')]['id']},'include':[{'model':db[_0x412c('0xa5')],'as':'List','include':[{'model':db[_0x412c('0x9f')],'as':_0x412c('0xa6'),'where':_0x57ea8f,'limit':0x1,'order':[[_0x412c('0xa2'),'DESC']]}]},{'model':db[_0x412c('0xa7')],'as':_0x412c('0xa8')},{'model':db[_0x412c('0x96')],'as':_0x412c('0x96'),'include':[{'model':db[_0x412c('0x96')],'as':_0x412c('0xa9'),'attributes':['id',_0x412c('0xaa')],'raw':!![]}]}]});})[_0x412c('0x19')](function(_0x3f882e){if(!_0x3f882e){throw new APINotFoundError(util[_0x412c('0x44')](_0x412c('0xab'),_0x465a62['params']['id']));}if(_0x37a9d9){return checkWebsiteInterval(_0x3f882e);}return _0x3f882e;})['then'](function(_0x2d73ab){_0x1971fa[_0x412c('0xac')]=_0x2d73ab;_0x1971fa[_0x412c('0xad')]=_[_0x412c('0xae')](_0x2d73ab['Applications'],[_0x412c('0xaf')],['asc']);if(_0x1971fa[_0x412c('0xac')][_0x412c('0xa8')]){delete _0x1971fa[_0x412c('0xac')][_0x412c('0xa8')];}_0x1971fa[_0x412c('0xb0')]=_0x2d73ab[_0x412c('0xb1')]||{'id':_0x2d73ab[_0x412c('0xb2')]};if(_0x1971fa['list']&&_0x1971fa['list'][_0x412c('0xa6')]['length']){return _0x1971fa['list']['Contacts'][0x0];}var _0x21decb=_[_0x412c('0xb3')](_0x465a62[_0x412c('0x64')],{'firstName':_0x465a62[_0x412c('0x64')][_0x412c('0x9a')],'ListId':_0x2d73ab[_0x412c('0xb2')]});_0x21decb[_0x465a62[_0x412c('0x64')][_0x412c('0xb4')]]=_0x465a62[_0x412c('0x64')][_0x412c('0x9a')];return db[_0x412c('0x9f')]['create'](_0x21decb,{'fields':_0x3848ac,'raw':!![]});})[_0x412c('0x19')](function(_0x1156d5){_0x1971fa[_0x412c('0xb5')]=_0x1156d5;var _0x37cd9e=createInteractionObject(_0x465a62[_0x412c('0x5e')]['id'],_0x465a62['body'],_0x465a62[_0x412c('0xb6')],_0x1156d5);var _0x421112={'ChatWebsiteId':_0x465a62[_0x412c('0x5e')]['id']};if(_0x465a62[_0x412c('0x64')]['threadId']){_0x421112[_0x412c('0xb7')]=_0x465a62[_0x412c('0x64')][_0x412c('0xb7')];_0x421112[_0x412c('0xb8')]=![];return db['ChatInteraction'][_0x412c('0x62')]({'where':_0x421112})['then'](function(_0x5c592d){var _0x294fcb=_0x465a62['body'][_0x412c('0x9e')]&&_0x465a62[_0x412c('0x64')]['referer'];if(_0x5c592d){_0xdb0f98=!![];return _0x5c592d;}else if(!_0x294fcb&&_0x5c592d&&_0x5c592d[_0x412c('0xb8')]){throw new APIConflictError(_0x412c('0xb9'));}_0x37cd9e[_0x412c('0xb7')]=_0x465a62['body']['threadId'];_0x37cd9e[_0x412c('0xba')]=_0x465a62[_0x412c('0x64')]['externalUrl'];return db[_0x412c('0xbb')][_0x412c('0x63')](_0x37cd9e);});}_0x421112[_0x412c('0xbc')]=_0x1156d5['id'];if(_0x465a62[_0x412c('0x64')]['interaction']&&_0x465a62['body'][_0x412c('0xbd')]['id']){_0x421112['id']=_0x465a62[_0x412c('0x64')]['interaction']['id'];return db[_0x412c('0xbb')]['find']({'where':_0x421112})['then'](function(_0x217778){var _0x1fd1f8=_0x465a62[_0x412c('0x64')]['customerIp']&&_0x465a62[_0x412c('0x64')][_0x412c('0x3d')];if(!_0x1fd1f8&&_0x217778&&_0x217778[_0x412c('0xb8')]){throw new APIConflictError(_0x412c('0xb9'));}else if(_0x217778){_0xdb0f98=!![];return _0x217778;}else{return db[_0x412c('0xbb')][_0x412c('0x63')](_0x37cd9e);}});}return db[_0x412c('0xbb')]['create'](_0x37cd9e);})[_0x412c('0x19')](function(_0x55dd0c){if(!_0xdb0f98){return _0x55dd0c;}var _0x596c98={'from':(_0x1971fa[_0x412c('0xb5')][_0x412c('0x3a')]||'')+'\x20'+(_0x1971fa[_0x412c('0xb5')][_0x412c('0x3b')]||'')};if(_0x465a62[_0x412c('0x64')][_0x412c('0xb7')]&&_0x465a62[_0x412c('0x64')][_0x412c('0xbe')]&&_0x465a62[_0x412c('0x64')][_0x412c('0xb7')]!=_0x465a62[_0x412c('0x64')][_0x412c('0xbe')]){_0x596c98[_0x412c('0xb7')]=_0x465a62[_0x412c('0x64')][_0x412c('0xbe')];}return _0x55dd0c[_0x412c('0x6f')](_0x596c98);})[_0x412c('0x19')](function(_0x57f62f){_0x1971fa[_0x412c('0xbd')]=_0x57f62f[_0x412c('0x2d')]({'plain':!![]});_0x1971fa[_0x412c('0xbd')][_0x412c('0xbf')]=!_0xdb0f98;if(_0x1971fa['interaction'][_0x412c('0xbf')]){if(_0x1971fa[_0x412c('0xac')]['autoclose']){_0x1971fa['applications'][_0x412c('0xc0')]({'id':0x0,'priority':_0x1971fa['applications'][_0x412c('0x52')]+0x1,'app':'close','appdata':_0x412c('0xc1'),'interval':_0x412c('0xc2')});}}return db[_0x412c('0xc3')][_0x412c('0x63')]({'body':_0x465a62['body']['body'],'ChatWebsiteId':_0x465a62[_0x412c('0x5e')]['id'],'ChatInteractionId':_0x57f62f['id'],'direction':'in','ContactId':_0x1971fa[_0x412c('0xb5')]['id'],'AttachmentId':_0x465a62[_0x412c('0x64')][_0x412c('0xc4')]});})[_0x412c('0x19')](function(_0x4bc988){_0x1971fa[_0x412c('0x1f')]=_0x4bc988;if(!_0x1971fa[_0x412c('0xbd')]['UserId']){return;}return db['User'][_0x412c('0x62')]({'attributes':['id','name'],'where':{'id':_0x1971fa[_0x412c('0xbd')][_0x412c('0xc5')]}});})['then'](function(_0x8258fe){if(_0x8258fe){_0x1971fa['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0x412c('0xc6'),'appdata':_0x8258fe['name']+','+(_0x1971fa[_0x412c('0xac')][_0x412c('0xc7')]||0xa),'interval':_0x412c('0xc2')});_0x1971fa[_0x412c('0xc8')]=!![];}if(!_0x1971fa[_0x412c('0xbd')][_0x412c('0xc9')]){return;}return db[_0x412c('0xca')]['find']({'attributes':['id','name'],'where':{'id':_0x1971fa['interaction'][_0x412c('0xc9')]}});})[_0x412c('0x19')](function(_0x396215){if(_0x396215){_0x1971fa[_0x412c('0xad')][_0x412c('0xcb')]({'id':0x0,'priority':0x1,'app':_0x412c('0xcc'),'appdata':_0x396215[_0x412c('0x31')]+','+(_0x1971fa[_0x412c('0xac')]['waitForTheAssignedQueue']||0x12c),'interval':_0x412c('0xc2')});}return respondWithRpcPromise(_0x412c('0xcd'),_0x412c('0xce'),_0x1971fa);})[_0x412c('0x19')](function(_0x5b5550){respondWithRpcPromise(_0x412c('0xcf'),'EventManager',{'event':'notify','message':_0x5b5550},client9002);return _0x5b5550;})['then'](respondWithResult(_0x53c1b8,null))['catch'](APIHandleError(_0x53c1b8));};exports[_0x412c('0xd0')]=function(_0x58fcca,_0x1e29f7){var _0x3e3e05,_0x543c7e,_0x9a3b07;var _0x4e9748=[];var _0x1fcae4={};var _0x45c956=_0x58fcca[_0x412c('0xd1')]||[];var _0x4f345d=[];var _0x513750;return db[_0x412c('0x9f')][_0x412c('0x72')]()[_0x412c('0x19')](function(_0x5a144e){if(!_0x5a144e){throw new db[(_0x412c('0xd2'))]['ValidationError'](_0x412c('0xd3'));}_0x4e9748=_[_0x412c('0xd4')](_[_0x412c('0x60')](_0x5a144e),['createdAt',_0x412c('0xa2'),_0x412c('0xa4'),_0x412c('0xb2')]);if(_0x58fcca['body']['id']){delete _0x58fcca[_0x412c('0x64')]['id'];}if(_[_0x412c('0x8c')](_0x58fcca[_0x412c('0x64')][_0x412c('0x9a')])){throw _0x1e29f7['status'](0x1f4)[_0x412c('0xd5')](new db['Sequelize'][(_0x412c('0xd6'))](_0x412c('0xd7')));}if(_[_0x412c('0x8c')](_0x58fcca[_0x412c('0x64')][_0x412c('0x64')])||_0x58fcca['body'][_0x412c('0x64')]===''){throw _0x1e29f7[_0x412c('0x23')](0x1f4)['send'](new db[(_0x412c('0xd2'))][(_0x412c('0xd6'))](_0x412c('0xd8')));}if(_[_0x412c('0x8c')](_0x58fcca['body']['mapKeyOffline'])){throw _0x1e29f7[_0x412c('0x23')](0x1f4)[_0x412c('0xd5')](new db[(_0x412c('0xd2'))][(_0x412c('0xd6'))](_0x412c('0xd9')+_0x4e9748));}if(!_['includes'](_0x4e9748,_0x58fcca[_0x412c('0x64')][_0x412c('0xda')])){throw _0x1e29f7[_0x412c('0x23')](0x1f4)[_0x412c('0xd5')](new db['Sequelize'][(_0x412c('0xd6'))](_0x412c('0xdb')+_0x4e9748));}_0x1fcae4[_0x58fcca[_0x412c('0x64')][_0x412c('0xda')]]=_0x58fcca[_0x412c('0x64')]['from'];})[_0x412c('0x19')](function(){return db[_0x412c('0x5b')][_0x412c('0x62')]({'where':{'id':_0x58fcca['params']['id']},'include':[{'model':db[_0x412c('0xa5')],'as':_0x412c('0xb1')},{'model':db['MailAccount'],'as':_0x412c('0xdc')}]});})[_0x412c('0x19')](handleEntityNotFound(_0x1e29f7,null))[_0x412c('0x19')](function(_0x5de3ac){if(_0x5de3ac&&_0x5de3ac[_0x412c('0xb1')]){_0x543c7e=_0x5de3ac;var _0x513141=_[_0x412c('0xb3')](_0x58fcca[_0x412c('0x64')],{'firstName':_0x58fcca[_0x412c('0x64')][_0x412c('0x9a')],'phone':_0x58fcca[_0x412c('0x64')][_0x412c('0x9a')],'ListId':_0x5de3ac[_0x412c('0xb2')]});_0x513141[_0x58fcca['body']['mapKeyOffline']]=_0x58fcca[_0x412c('0x64')][_0x412c('0x9a')];return db['CmContact'][_0x412c('0xdd')]({'where':_0x1fcae4,'defaults':_0x513141});}})[_0x412c('0xde')](function(_0x43bd7a){if(_0x43bd7a){_0x9a3b07=_0x43bd7a;var _0x273ee2=fs[_0x412c('0xdf')](path['join'](config['root'],'server/files/templates/chatOfflineMessage.ejs'),_0x412c('0xe0'));var _0x24da91=ejs['render'](_0x273ee2,{'body':_['toPairs'](_0x58fcca[_0x412c('0x64')][_0x412c('0x64')]),'bodyTitle':_0x543c7e[_0x412c('0xe1')]});return db[_0x412c('0xe2')]['create']({'body':_0x24da91,'plainBody':htmlToText[_0x412c('0xe3')](_0x24da91),'ContactId':_0x43bd7a['id'],'ChatWebsiteId':_0x543c7e['id']});}})['then'](function(_0x300449){_0x513750=_0x300449;if(_0x45c956['length']){var _0xfbf661=_0x45c956[_0x412c('0x4c')](function(_0x28d6eb){return{'name':_0x28d6eb[_0x412c('0xe4')],'basename':_0x28d6eb[_0x412c('0x82')],'type':_0x28d6eb[_0x412c('0xe5')],'ChatOfflineMessageId':_0x300449['id']};});_0x4f345d=_0xfbf661[_0x412c('0x4c')](_0x57bf67=>{var _0x4432c5={'filename':_0x57bf67['name'],'path':path[_0x412c('0x87')](config[_0x412c('0x88')],_0x412c('0xe6'),_0x412c('0xd1'),_0x412c('0xe7'),_0x412c('0xe8'),_0x57bf67['basename'])};return _0x4432c5;});if(!_0x543c7e[_0x412c('0xe9')]){return db[_0x412c('0xea')]['transaction'](function(_0x57b3b7){return db[_0x412c('0xeb')]['bulkCreate'](_0xfbf661,{'transaction':_0x57b3b7});});}}})[_0x412c('0x19')](function(){if(_0x513750){_0x3e3e05=_0x513750;return db[_0x412c('0xdc')][_0x412c('0x76')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0x412c('0xec'),'raw':!![],'include':[{'model':db[_0x412c('0xed')],'as':_0x412c('0xed'),'raw':!![]}]}]});}})[_0x412c('0x19')](function(_0x54ea65){if(_0x54ea65&&_0x54ea65[_0x412c('0xec')]&&_0x543c7e[_0x412c('0xee')]&&_0x543c7e['forwardOfflineAddress']){var _0xac89db=_0x54ea65['getSmtpOptions']();return respondWithRpcPromise(_0x412c('0xef'),_0x412c('0xf0'),{'account':_0xac89db,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x54ea65[_0x412c('0x31')],_0x54ea65[_0x412c('0xf1')]||_0x54ea65[_0x412c('0xec')][_0x412c('0x68')]),'to':_0x543c7e[_0x412c('0xf2')],'subject':_0x543c7e[_0x412c('0xf3')],'html':_0x3e3e05[_0x412c('0x64')],'attachments':_0x4f345d}},client9003)['then'](function(){return _0x3e3e05;})[_0x412c('0x5d')](function(_0x29f092){logger['error'](_0x29f092);});}})[_0x412c('0x19')](function(){if(_0x543c7e&&_0x543c7e['openNewInteraction']&&_0x543c7e['MailAccountId']){var _0x1daa26=[];if(_0x45c956['length']){_0x1daa26=_0x45c956[_0x412c('0x4c')](function(_0x4d28f4){return{'name':_0x4d28f4[_0x412c('0xe4')],'basename':_0x4d28f4[_0x412c('0x82')],'type':_0x4d28f4[_0x412c('0xe5')],'ChatOfflineMessageId':_0x513750['id']};});}var _0x2b51c6;if(!_[_0x412c('0x8c')](_0x543c7e['subjectOffline'])){var _0x32de39=_[_0x412c('0x4c')](_0x58fcca['body'],function(_0x58514a){return _0x58514a;});var _0x5d6e33=_[_0x412c('0xf4')](_0x32de39)[0x0];var _0x5b1a76=_[_0x412c('0xf5')](_0x5d6e33,function(_0x3c5e46){return _0x3c5e46;});_0x2b51c6=_0x5b1a76[0x1][_0x543c7e[_0x412c('0xf6')]];}var _0x42d7b7={'from':_0x9a3b07[_0x412c('0xf1')],'firstName':_0x9a3b07[_0x412c('0x3a')],'lastName':_0x9a3b07[_0x412c('0x3b')],'mapKey':_0x412c('0xf1'),'message':{'from':_0x9a3b07['email'],'to':_0x543c7e[_0x412c('0xdc')][_0x412c('0xf1')],'cc':'','subject':_['isNil'](_0x2b51c6)?_0x543c7e[_0x412c('0xf3')]:_0x2b51c6,'messageId':'','sentAt':new Date(),'attach':_0x1daa26[_0x412c('0x52')],'attachments':_0x1daa26,'originChannel':_0x412c('0xf7'),'ChatWebsiteId':_0x543c7e['id'],'ChatOfflineMessageId':_0x3e3e05['id'],'originTo':_0x543c7e['MailAccount'][_0x412c('0xf1')]},'body':_0x3e3e05[_0x412c('0x64')]};var _0x4d03d7={'account':{'id':_0x543c7e[_0x412c('0xf8')]},'body':_0x42d7b7,'log':_0x412c('0xf9')};return respondWithRpcPromise(_0x412c('0xf9'),_0x412c('0xfa'),_0x4d03d7,client9001)['then'](function(){return _0x3e3e05;})[_0x412c('0x5d')](function(_0x13996a){logger['error'](_0x13996a);});}return;})[_0x412c('0x19')](function(){if(_0x3e3e05){return _0x3e3e05;}})[_0x412c('0x19')](respondWithResult(_0x1e29f7,null))[_0x412c('0x5d')](function(){for(var _0x4de503 of _0x45c956){var _0x1c6b3e=path['join'](config[_0x412c('0x88')],_0x412c('0xe6'),'files',_0x412c('0xe7'),_0x412c('0xe8'),_0x4de503['filename']);fs_extra['remove'](_0x1c6b3e)['catch'](function(_0x1a110c){logger['error'](_0x412c('0xfb'),_0x1c6b3e,_0x1a110c);});}});};exports['addInteraction']=function(_0x48f1c5,_0x1db89f){return db['ChatInteraction'][_0x412c('0x62')]({'where':{'id':_0x48f1c5[_0x412c('0x5e')]['id']}})[_0x412c('0x19')](handleEntityNotFound(_0x1db89f,null))[_0x412c('0x19')](function(_0x2b86b8){if(_0x2b86b8){return _0x2b86b8['addInteraction'](_0x48f1c5['body'][_0x412c('0x7a')],_[_0x412c('0xfc')](_0x48f1c5[_0x412c('0x64')],[_0x412c('0x7a'),'id'])||{});}})[_0x412c('0x19')](respondWithResult(_0x1db89f,null))[_0x412c('0x5d')](handleError(_0x1db89f,null));};exports[_0x412c('0xfd')]=function(_0x3aa291,_0x2ecb4f){var _0x231b4e={'raw':![],'where':{}};var _0x423f6c={};var _0x35b0ed={'count':0x0,'rows':[]};return db[_0x412c('0x5b')][_0x412c('0x76')]({'where':{'id':_0x3aa291[_0x412c('0x5e')]['id']}})[_0x412c('0x19')](handleEntityNotFound(_0x2ecb4f,null))[_0x412c('0x19')](function(_0x41e546){if(_0x41e546){_0x423f6c['model']=_['keys'](db[_0x412c('0xbb')]['rawAttributes']);_0x423f6c[_0x412c('0x4d')]=_[_0x412c('0x60')](_0x3aa291[_0x412c('0x4d')]);_0x423f6c[_0x412c('0x4e')]=_['intersection'](_0x423f6c[_0x412c('0x46')],_0x423f6c['query']);_0x231b4e[_0x412c('0x50')]=_[_0x412c('0x4f')](_0x423f6c[_0x412c('0x46')],qs[_0x412c('0x51')](_0x3aa291['query'][_0x412c('0x51')]));_0x231b4e[_0x412c('0x50')]=_0x231b4e['attributes'][_0x412c('0x52')]?_0x231b4e['attributes']:_0x423f6c[_0x412c('0x46')];if(!_0x3aa291[_0x412c('0x4d')][_0x412c('0x53')](_0x412c('0x77'))){_0x231b4e[_0x412c('0x28')]=qs[_0x412c('0x28')](_0x3aa291[_0x412c('0x4d')][_0x412c('0x28')]);_0x231b4e[_0x412c('0x26')]=qs['offset'](_0x3aa291[_0x412c('0x4d')][_0x412c('0x26')]);}_0x231b4e['order']=qs['sort'](_0x3aa291[_0x412c('0x4d')]['sort']);_0x231b4e['where']=qs[_0x412c('0x4e')](_[_0x412c('0x56')](_0x3aa291[_0x412c('0x4d')],_0x423f6c['filters']));_0x231b4e[_0x412c('0x55')][_0x412c('0x73')]=_0x41e546['id'];if(_0x3aa291[_0x412c('0x4d')][_0x412c('0x57')]){_0x231b4e[_0x412c('0x55')]=_[_0x412c('0x58')](_0x231b4e['where'],{'$or':_['map'](_0x231b4e[_0x412c('0x50')],function(_0x141f5f){var _0xb12f1={};_0xb12f1[_0x141f5f]={'$like':'%'+_0x3aa291[_0x412c('0x4d')]['filter']+'%'};return _0xb12f1;})});}_0x231b4e=_['merge']({},_0x231b4e,_0x3aa291[_0x412c('0x61')]);return db['ChatInteraction'][_0x412c('0x29')]({'where':_0x231b4e['where']})['then'](function(_0x22abcd){_0x35b0ed[_0x412c('0x29')]=_0x22abcd;if(_0x3aa291['query']['includeAll']){_0x231b4e[_0x412c('0x5a')]=[{'model':db[_0x412c('0x9f')],'as':_0x412c('0xfe'),'required':![]},{'model':db[_0x412c('0xff')],'as':'Owner','attributes':[_0x412c('0x31'),'fullname',_0x412c('0x100')],'required':![]},{'model':db['Tag'],'as':_0x412c('0x101'),'attributes':['id',_0x412c('0x31'),_0x412c('0x102')],'where':_0x3aa291[_0x412c('0x4d')][_0x412c('0x103')]?{'id':_0x3aa291[_0x412c('0x4d')][_0x412c('0x103')]}:undefined,'required':_0x3aa291[_0x412c('0x4d')][_0x412c('0x103')]?!![]:![]}];}return db[_0x412c('0xbb')][_0x412c('0x5c')](_0x231b4e);})[_0x412c('0x19')](function(_0x53f655){_0x35b0ed[_0x412c('0x79')]=_0x53f655;return _0x35b0ed;});}})['then'](respondWithFilteredResult(_0x2ecb4f,_0x231b4e))['catch'](handleError(_0x2ecb4f,null));};exports['getSnippet']=function(_0xde3bf1,_0x11401b){var _0x3d5b90=0x0;var _0x106b58=0x0;var _0x267038=![];var _0x1ef14d;var _0x5c27a4;return db[_0x412c('0x5b')][_0x412c('0x62')]({'where':{'id':_0xde3bf1[_0x412c('0x5e')]['id']},'include':[{'model':db[_0x412c('0x96')],'as':_0x412c('0x96'),'include':[{'model':db[_0x412c('0x96')],'as':_0x412c('0xa9'),'attributes':['id',_0x412c('0xaa')]}]}]})[_0x412c('0x19')](handleEntityNotFound(_0x11401b,null))['then'](function(_0x57bf4b){if(_0x57bf4b){_0x1ef14d=_0x57bf4b;return _0x57bf4b[_0x412c('0x104')]({'raw':!![]});}})['then'](function(_0x5e54c3){if(_0x1ef14d){if(_0x5e54c3){_0x5c27a4=_0x5e54c3;}}return require('../../config/license/util')[_0x412c('0x8b')]();})[_0x412c('0x19')](function(_0x33fad6){if(_0x33fad6){_0x106b58=_0x33fad6[_0x412c('0x105')];_0x267038=_0x33fad6[_0x412c('0x106')];}})[_0x412c('0x19')](function(){return db[_0x412c('0xbb')][_0x412c('0x29')]({'where':{'closed':![]}});})['then'](function(_0x67ecf2){_0x3d5b90=_0x67ecf2;if(_0x106b58&&_0x67ecf2>_0x106b58){return db[_0x412c('0x107')]['findOne']({'where':{'id':0x1}})[_0x412c('0x19')](function(_0x55a4a6){if(_0x55a4a6){_0x55a4a6[_0x412c('0x108')]('chatLicenseExceeded');}});}})[_0x412c('0x19')](function(){var _0x3e01d9=_0x1ef14d['Interval'];var _0x49ebcd=_0x1ef14d[_0x412c('0x109')]||undefined;return _0x3e01d9?_0x3e01d9[_0x412c('0x98')](_0x49ebcd):!![];})['then'](function(_0x459ec5){var _0x364e20=fs[_0x412c('0xdf')](path[_0x412c('0x87')](config[_0x412c('0x88')],_0x412c('0x10a')),_0x412c('0xe0'));var _0xa752e1=_0x412c('0x10b');var _0x56af4b=![];var _0xbef213,_0x32bfa6;if(_0xde3bf1[_0x412c('0xb6')][_0x412c('0x3d')]){_0xbef213=new URL(_0xde3bf1['headers'][_0x412c('0x3d')])[_0x412c('0x10c')];}else if(_0xde3bf1[_0x412c('0xb6')][_0x412c('0x10c')]){_0xbef213=new URL(_0xde3bf1[_0x412c('0xb6')][_0x412c('0x10c')])['origin'];}else{_0xbef213=_0x412c('0x10d');}_0x32bfa6=typeof _0x1ef14d[_0x412c('0x70')]['split'](',')[_0x412c('0x62')](function(_0x1f764c){return wildcardUtils[_0x412c('0x10e')](_0x1f764c,_0xbef213);})!==_0x412c('0x27');var _0x3690c7={'chatVersion':_0xa752e1,'chatWebsiteAddressOrigin':_0x32bfa6?_0xbef213:_0x1ef14d[_0x412c('0x70')],'remote':_0x1ef14d[_0x412c('0x10f')],'query':querystring[_0x412c('0x1c')](_['merge'](_0x1ef14d[_0x412c('0x2d')]({'plain':!![]}),{'customerIp':_0xde3bf1[_0x412c('0xb6')][_0x412c('0x37')]||_0xde3bf1[_0x412c('0xb6')][_0x412c('0x110')]||_0xde3bf1[_0x412c('0x111')][_0x412c('0x112')]||_0xde3bf1['ip'],'referer':_0xde3bf1[_0x412c('0xb6')][_0x412c('0x3d')],'openedInteractions':_0x3d5b90,'maxInteractions':_0x106b58,'virtual':_0x267038[_0x412c('0x105')],'online':_0x459ec5,'custom':_0x267038,'address':_0x32bfa6?_0xbef213:null}))['replace'](/'/g,'\x5c\x27')};_0x11401b['send'](ejs['render'](Mustache['render'](_0x364e20,_0x3690c7),{'proactiveActions':_0x5c27a4,'alignment':_0x1ef14d[_0x412c('0x113')],'verticalAlignment':_0x1ef14d['verticalAlignment'],'div_color':_0x1ef14d[_0x412c('0x102')],'labelText':_0x1ef14d[_0x412c('0x114')],'text_color':_0x1ef14d['textColor'],'text_button_color':_0x1ef14d[_0x412c('0x115')],'button_color':_0x1ef14d[_0x412c('0x116')],'background_color':_0x1ef14d[_0x412c('0x117')],'hideWhenOffline':_0x1ef14d[_0x412c('0x118')],'intervalId':_0x1ef14d[_0x412c('0x119')],'isDevelopment':_0x56af4b,'chatVersion':_0xa752e1}));})[_0x412c('0x5d')](handleError(_0x11401b,null));};exports['addApplications']=function(_0xbe70e1,_0x5f1e19){var _0x3bc4c7=_0xbe70e1[_0x412c('0x5e')]['id'];var _0x4a61ac=_0xbe70e1[_0x412c('0x64')];var _0x428a47=0xc8;var _0x490fcf=null;return db['sequelize'][_0x412c('0x11a')]({'isolationLevel':db[_0x412c('0xea')][_0x412c('0x11b')][_0x412c('0x11c')][_0x412c('0x11d')]},function(_0x214819){return db['ChatWebsite'][_0x412c('0x76')]({'where':{'id':_0x3bc4c7},'transaction':_0x214819})[_0x412c('0x19')](function(_0x368004){if(_0x368004){return db['ChatApplication'][_0x412c('0x2c')]({'where':{'ChatWebsiteId':_0x3bc4c7},'transaction':_0x214819})[_0x412c('0x19')](function(){var _0x3b0f7e=_[_0x412c('0x4c')](_0x4a61ac,function(_0x2742f7){_0x2742f7[_0x412c('0x73')]=_0x3bc4c7;return _0x2742f7;});return db['ChatApplication'][_0x412c('0x11e')](_0x3b0f7e,{'transaction':_0x214819});});}else{_0x428a47=0x194;_0x490fcf=[];}});})['then'](function(){if(_0x428a47!==0x194){return db['ChatApplication'][_0x412c('0x11f')]({'where':{'ChatWebsiteId':_0x3bc4c7},'order':_0x412c('0xaf')})['then'](function(_0x404fe2){_0x490fcf=_0x404fe2;});}})[_0x412c('0x5d')](function(_0x27bb32){_0x428a47=0x1f4;logger[_0x412c('0x1d')](_0x27bb32['stack']);if(_0x27bb32[_0x412c('0x31')]){delete _0x27bb32[_0x412c('0x31')];}_0x490fcf=_0x27bb32;})[_0x412c('0x120')](function(){if(_0x490fcf===null){_0x5f1e19[_0x412c('0x22')](_0x428a47);}else{if(_0x428a47===0x1f4){_0x5f1e19[_0x412c('0x23')](_0x428a47)[_0x412c('0xd5')](_0x490fcf);}else{_0x5f1e19[_0x412c('0x23')](_0x428a47)[_0x412c('0x25')](_0x490fcf);}}});};exports[_0x412c('0x121')]=function(_0x10c2d3,_0x4b93ea){var _0x5b033a={};var _0x5d7c19={};var _0x56a1ee;var _0x21ed28;return db[_0x412c('0x5b')][_0x412c('0x76')]({'where':{'id':_0x10c2d3[_0x412c('0x5e')]['id']}})[_0x412c('0x19')](handleEntityNotFound(_0x4b93ea,null))['then'](function(_0x819cf1){if(_0x819cf1){_0x56a1ee=_0x819cf1;_0x5d7c19['model']=_[_0x412c('0x60')](db[_0x412c('0xa7')][_0x412c('0x4a')]);_0x5d7c19[_0x412c('0x4d')]=_[_0x412c('0x60')](_0x10c2d3[_0x412c('0x4d')]);_0x5d7c19['filters']=_[_0x412c('0x4f')](_0x5d7c19[_0x412c('0x46')],_0x5d7c19['query']);_0x5b033a['attributes']=_['intersection'](_0x5d7c19[_0x412c('0x46')],qs[_0x412c('0x51')](_0x10c2d3[_0x412c('0x4d')][_0x412c('0x51')]));_0x5b033a[_0x412c('0x50')]=_0x5b033a[_0x412c('0x50')][_0x412c('0x52')]?_0x5b033a[_0x412c('0x50')]:_0x5d7c19[_0x412c('0x46')];_0x5b033a[_0x412c('0x78')]=qs[_0x412c('0x54')](_0x10c2d3['query'][_0x412c('0x54')]);_0x5b033a[_0x412c('0x55')]=qs[_0x412c('0x4e')](_[_0x412c('0x56')](_0x10c2d3['query'],_0x5d7c19[_0x412c('0x4e')]));if(_0x10c2d3['query'][_0x412c('0x57')]){_0x5b033a[_0x412c('0x55')]=_[_0x412c('0x58')](_0x5b033a['where'],{'$or':_[_0x412c('0x4c')](_0x5b033a[_0x412c('0x50')],function(_0x51cbe4){var _0x31afcb={};_0x31afcb[_0x51cbe4]={'$like':'%'+_0x10c2d3[_0x412c('0x4d')][_0x412c('0x57')]+'%'};return _0x31afcb;})});}_0x5b033a=_['merge']({},_0x5b033a,_0x10c2d3[_0x412c('0x61')]);return _0x56a1ee[_0x412c('0x121')](_0x5b033a);}})[_0x412c('0x19')](function(_0xc0f4aa){if(_0xc0f4aa){_0x21ed28=_0xc0f4aa[_0x412c('0x52')];if(!_0x10c2d3[_0x412c('0x4d')][_0x412c('0x53')](_0x412c('0x77'))){_0x5b033a[_0x412c('0x28')]=qs[_0x412c('0x28')](_0x10c2d3[_0x412c('0x4d')]['limit']);_0x5b033a[_0x412c('0x26')]=qs[_0x412c('0x26')](_0x10c2d3['query']['offset']);}return _0x56a1ee[_0x412c('0x121')](_0x5b033a);}})['then'](function(_0xbcfdc6){if(_0xbcfdc6){return _0xbcfdc6?{'count':_0x21ed28,'rows':_0xbcfdc6}:null;}})[_0x412c('0x19')](respondWithResult(_0x4b93ea,null))[_0x412c('0x5d')](handleError(_0x4b93ea,null));};exports[_0x412c('0x122')]=function(_0x2eedce,_0x432e4f){return db[_0x412c('0x123')][_0x412c('0x62')]({'where':{'id':_0x2eedce[_0x412c('0x5e')]['id']}})[_0x412c('0x19')](handleEntityNotFound(_0x432e4f,null))[_0x412c('0x19')](function(_0x1be24e){if(_0x1be24e){return _0x1be24e['addProactiveActions'](_0x2eedce[_0x412c('0x64')][_0x412c('0x7a')],_['omit'](_0x2eedce['body'],['ids','id'])||{});}})[_0x412c('0x19')](respondWithResult(_0x432e4f,null))['catch'](handleError(_0x432e4f,null));};exports[_0x412c('0x104')]=function(_0x14a85f,_0x4baa68){var _0x35331a={};var _0x2d44dd={};var _0x17a04c;var _0x3ec910;return db['ChatWebsite'][_0x412c('0x76')]({'where':{'id':_0x14a85f[_0x412c('0x5e')]['id']}})['then'](handleEntityNotFound(_0x4baa68,null))[_0x412c('0x19')](function(_0x246e55){if(_0x246e55){_0x17a04c=_0x246e55;_0x2d44dd[_0x412c('0x46')]=_[_0x412c('0x60')](db[_0x412c('0x124')]['rawAttributes']);_0x2d44dd[_0x412c('0x4d')]=_[_0x412c('0x60')](_0x14a85f[_0x412c('0x4d')]);_0x2d44dd[_0x412c('0x4e')]=_[_0x412c('0x4f')](_0x2d44dd[_0x412c('0x46')],_0x2d44dd['query']);_0x35331a['attributes']=_[_0x412c('0x4f')](_0x2d44dd[_0x412c('0x46')],qs[_0x412c('0x51')](_0x14a85f['query'][_0x412c('0x51')]));_0x35331a[_0x412c('0x50')]=_0x35331a[_0x412c('0x50')][_0x412c('0x52')]?_0x35331a['attributes']:_0x2d44dd[_0x412c('0x46')];_0x35331a[_0x412c('0x78')]=qs[_0x412c('0x54')](_0x14a85f[_0x412c('0x4d')][_0x412c('0x54')]);_0x35331a[_0x412c('0x55')]=qs[_0x412c('0x4e')](_[_0x412c('0x56')](_0x14a85f[_0x412c('0x4d')],_0x2d44dd[_0x412c('0x4e')]));if(_0x14a85f[_0x412c('0x4d')][_0x412c('0x57')]){_0x35331a[_0x412c('0x55')]=_['merge'](_0x35331a['where'],{'$or':_[_0x412c('0x4c')](_0x35331a[_0x412c('0x50')],function(_0x368d93){var _0x1121f7={};_0x1121f7[_0x368d93]={'$like':'%'+_0x14a85f[_0x412c('0x4d')][_0x412c('0x57')]+'%'};return _0x1121f7;})});}_0x35331a=_[_0x412c('0x58')]({},_0x35331a,_0x14a85f['options']);return _0x17a04c[_0x412c('0x104')](_0x35331a);}})['then'](function(_0x2e4ce4){if(_0x2e4ce4){_0x3ec910=_0x2e4ce4['length'];if(!_0x14a85f['query'][_0x412c('0x53')](_0x412c('0x77'))){_0x35331a[_0x412c('0x28')]=qs[_0x412c('0x28')](_0x14a85f['query']['limit']);_0x35331a[_0x412c('0x26')]=qs[_0x412c('0x26')](_0x14a85f[_0x412c('0x4d')]['offset']);}return _0x17a04c[_0x412c('0x104')](_0x35331a);}})['then'](function(_0x7c6a6b){if(_0x7c6a6b){return _0x7c6a6b?{'count':_0x3ec910,'rows':_0x7c6a6b}:null;}})[_0x412c('0x19')](respondWithResult(_0x4baa68,null))[_0x412c('0x5d')](handleError(_0x4baa68,null));};exports[_0x412c('0x125')]=function(_0x469561,_0x28766d){var _0x21568a=_0x469561[_0x412c('0x4d')][_0x412c('0x126')]===_0x412c('0x127')?_0x412c('0x128'):_0x412c('0x129');return db[_0x412c('0x5b')]['find']({'attributes':['id',_0x21568a],'where':{'id':_0x469561['params']['id']}})['then'](handleEntityNotFound(_0x28766d,null))[_0x412c('0x19')](function(_0x582e32){if(_0x582e32){var _0x50a20a=_0x582e32[_0x21568a];var _0x4a9a9a=_0x50a20a&&_0x50a20a[_0x412c('0x12a')]?_0x50a20a[_0x412c('0x12a')]:[];_0x28766d['send']({'fromKey':_[_0x412c('0x8c')](_0x50a20a[_0x412c('0x12b')])?undefined:_0x50a20a[_0x412c('0x12b')],'count':_0x4a9a9a['length'],'rows':_0x4a9a9a});}})[_0x412c('0x5d')](handleError(_0x28766d,null));};exports['getOfflineMessages']=function(_0x540fbe,_0x40f73c){var _0x3850f7={'raw':![],'where':{}};var _0x4e39ee={};var _0x85f099={'count':0x0,'rows':[]};return db[_0x412c('0x5b')]['findOne']({'where':{'id':_0x540fbe[_0x412c('0x5e')]['id']}})['then'](handleEntityNotFound(_0x40f73c,null))[_0x412c('0x19')](function(_0x566e74){if(_0x566e74){_0x4e39ee[_0x412c('0x46')]=_[_0x412c('0x60')](db[_0x412c('0xe2')][_0x412c('0x4a')]);_0x4e39ee[_0x412c('0x4d')]=_[_0x412c('0x60')](_0x540fbe[_0x412c('0x4d')]);_0x4e39ee['filters']=_[_0x412c('0x4f')](_0x4e39ee[_0x412c('0x46')],_0x4e39ee[_0x412c('0x4d')]);_0x3850f7[_0x412c('0x50')]=_[_0x412c('0x4f')](_0x4e39ee['model'],qs[_0x412c('0x51')](_0x540fbe['query'][_0x412c('0x51')]));_0x3850f7['attributes']=_0x3850f7[_0x412c('0x50')]['length']?_0x3850f7['attributes']:_0x4e39ee[_0x412c('0x46')];if(!_0x540fbe['query'][_0x412c('0x53')](_0x412c('0x77'))){_0x3850f7[_0x412c('0x28')]=qs[_0x412c('0x28')](_0x540fbe[_0x412c('0x4d')][_0x412c('0x28')]);_0x3850f7['offset']=qs[_0x412c('0x26')](_0x540fbe[_0x412c('0x4d')]['offset']);}_0x3850f7[_0x412c('0x78')]=qs['sort'](_0x540fbe['query'][_0x412c('0x54')]);_0x3850f7[_0x412c('0x55')]=qs[_0x412c('0x4e')](_[_0x412c('0x56')](_0x540fbe[_0x412c('0x4d')],_0x4e39ee[_0x412c('0x4e')]));_0x3850f7[_0x412c('0x55')][_0x412c('0x73')]=_0x566e74['id'];if(_0x540fbe['query'][_0x412c('0x57')]){_0x3850f7[_0x412c('0x55')]=_[_0x412c('0x58')](_0x3850f7[_0x412c('0x55')],{'$or':_['map'](_0x3850f7[_0x412c('0x50')],function(_0x2e4a44){var _0x482a4f={};_0x482a4f[_0x2e4a44]={'$like':'%'+_0x540fbe[_0x412c('0x4d')]['filter']+'%'};return _0x482a4f;})});}_0x3850f7=_[_0x412c('0x58')]({},_0x3850f7,_0x540fbe['options']);return db[_0x412c('0xe2')]['count']({'where':_0x3850f7['where']})['then'](function(_0x58d056){_0x85f099[_0x412c('0x29')]=_0x58d056;if(_0x540fbe['query'][_0x412c('0x59')]){_0x3850f7[_0x412c('0x5a')]=[{'all':!![]}];}else{_0x3850f7[_0x412c('0x5a')]=[{'model':db[_0x412c('0x9f')],'as':_0x412c('0xfe'),'required':![]},{'model':db[_0x412c('0xeb')],'as':_0x412c('0x12c'),'required':![]}];}return db[_0x412c('0xe2')][_0x412c('0x5c')](_0x3850f7);})[_0x412c('0x19')](function(_0x2fa432){_0x85f099[_0x412c('0x79')]=_0x2fa432;return _0x85f099;});}})[_0x412c('0x19')](respondWithFilteredResult(_0x40f73c,_0x3850f7))[_0x412c('0x5d')](handleError(_0x40f73c,null));};exports[_0x412c('0x12d')]=function(_0x287aee,_0x4a719b){return db[_0x412c('0x5b')][_0x412c('0x62')]({'where':{'id':_0x287aee['params']['id']}})['then'](handleEntityNotFound(_0x4a719b,null))[_0x412c('0x19')](function(_0x33e161){if(_0x33e161){return _0x33e161[_0x412c('0x12d')](_0x287aee[_0x412c('0x64')][_0x412c('0x7a')],_[_0x412c('0xfc')](_0x287aee[_0x412c('0x64')],[_0x412c('0x7a'),'id'])||{})['spread'](function(_0x441d2c){for(var _0x9a9e3e=0x0;_0x9a9e3e<_0x287aee[_0x412c('0x64')]['ids'][_0x412c('0x52')];_0x9a9e3e+=0x1){socket['emit'](_0x412c('0x12e'),{'UserId':Number(_0x287aee[_0x412c('0x64')][_0x412c('0x7a')][_0x9a9e3e]),'ChatWebsiteId':Number(_0x287aee[_0x412c('0x5e')]['id'])});}return _0x441d2c;});}})['then'](respondWithResult(_0x4a719b,null))['catch'](handleError(_0x4a719b,null));};exports[_0x412c('0x12f')]=function(_0x5d3b15,_0x28a7ff){return db[_0x412c('0x5b')][_0x412c('0x62')]({'where':{'id':_0x5d3b15['params']['id']}})[_0x412c('0x19')](handleEntityNotFound(_0x28a7ff,null))['then'](function(_0x4107c0){if(_0x4107c0){return _0x4107c0['removeAgents'](_0x5d3b15[_0x412c('0x4d')]['ids'])[_0x412c('0x19')](function(){if(_['isArray'](_0x5d3b15['query']['ids'])){for(var _0x16c2ff=0x0;_0x16c2ff<_0x5d3b15[_0x412c('0x4d')][_0x412c('0x7a')][_0x412c('0x52')];_0x16c2ff+=0x1){socket[_0x412c('0x130')](_0x412c('0x131'),{'UserId':Number(_0x5d3b15[_0x412c('0x4d')][_0x412c('0x7a')][_0x16c2ff]),'ChatWebsiteId':Number(_0x5d3b15[_0x412c('0x5e')]['id'])});}}else{socket[_0x412c('0x130')]('userChatWebsite:remove',{'UserId':Number(_0x5d3b15[_0x412c('0x4d')]['ids']),'ChatWebsiteId':Number(_0x5d3b15[_0x412c('0x5e')]['id'])});}});}})[_0x412c('0x19')](respondWithStatusCode(_0x28a7ff,null))[_0x412c('0x5d')](handleError(_0x28a7ff,null));};exports[_0x412c('0x132')]=function(_0x4a1ca9,_0x419364){var _0x5c2942={};var _0x24370f={};var _0x442a8e;var _0x590f87;return db[_0x412c('0x5b')]['findOne']({'where':{'id':_0x4a1ca9[_0x412c('0x5e')]['id']}})[_0x412c('0x19')](handleEntityNotFound(_0x419364,null))[_0x412c('0x19')](function(_0x42887f){if(_0x42887f){_0x442a8e=_0x42887f;_0x24370f[_0x412c('0x46')]=_[_0x412c('0x60')](db[_0x412c('0xff')]['rawAttributes']);_0x24370f['query']=_['keys'](_0x4a1ca9['query']);_0x24370f[_0x412c('0x4e')]=_[_0x412c('0x4f')](_0x24370f[_0x412c('0x46')],_0x24370f['query']);_0x5c2942[_0x412c('0x50')]=_[_0x412c('0x4f')](_0x24370f[_0x412c('0x46')],qs['fields'](_0x4a1ca9['query'][_0x412c('0x51')]));_0x5c2942['attributes']=_0x5c2942[_0x412c('0x50')][_0x412c('0x52')]?_0x5c2942[_0x412c('0x50')]:_0x24370f['model'];_0x5c2942[_0x412c('0x78')]=qs[_0x412c('0x54')](_0x4a1ca9[_0x412c('0x4d')][_0x412c('0x54')]);_0x5c2942['where']=qs[_0x412c('0x4e')](_[_0x412c('0x56')](_0x4a1ca9[_0x412c('0x4d')],_0x24370f[_0x412c('0x4e')]));if(_0x4a1ca9['query'][_0x412c('0x57')]){_0x5c2942[_0x412c('0x55')]=_[_0x412c('0x58')](_0x5c2942['where'],{'$or':_[_0x412c('0x4c')](_0x5c2942['attributes'],function(_0xe3b413){var _0x5eb5e4={};_0x5eb5e4[_0xe3b413]={'$like':'%'+_0x4a1ca9[_0x412c('0x4d')]['filter']+'%'};return _0x5eb5e4;})});}_0x5c2942=_[_0x412c('0x58')]({},_0x5c2942,_0x4a1ca9[_0x412c('0x61')]);return _0x442a8e[_0x412c('0x132')](_0x5c2942);}})[_0x412c('0x19')](function(_0x40cb8a){if(_0x40cb8a){_0x590f87=_0x40cb8a[_0x412c('0x52')];if(!_0x4a1ca9[_0x412c('0x4d')][_0x412c('0x53')](_0x412c('0x77'))){_0x5c2942['limit']=qs[_0x412c('0x28')](_0x4a1ca9['query'][_0x412c('0x28')]);_0x5c2942['offset']=qs[_0x412c('0x26')](_0x4a1ca9[_0x412c('0x4d')][_0x412c('0x26')]);}return _0x442a8e[_0x412c('0x132')](_0x5c2942);}})['then'](function(_0x50631a){if(_0x50631a){return _0x50631a?{'count':_0x590f87,'rows':_0x50631a}:null;}})[_0x412c('0x19')](respondWithResult(_0x419364,null))[_0x412c('0x5d')](handleError(_0x419364,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 60a096f..bb34c8c 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 _0x7da7=['remove','emit','hook','events','../../mysqldb','ChatWebsite','update'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x7da7,0x10d));var _0x77da=function(_0x44606e,_0x2bf244){_0x44606e=_0x44606e-0x0;var _0xe68388=_0x7da7[_0x44606e];return _0xe68388;};'use strict';var EventEmitter=require(_0x77da('0x0'));var ChatWebsite=require(_0x77da('0x1'))['db'][_0x77da('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x77da('0x3'),'afterDestroy':_0x77da('0x4')};function emitEvent(_0x4f60c3){return function(_0x3a9fa6,_0x37b3d9,_0x56458c){ChatWebsiteEvents[_0x77da('0x5')](_0x4f60c3+':'+_0x3a9fa6['id'],_0x3a9fa6);ChatWebsiteEvents[_0x77da('0x5')](_0x4f60c3,_0x3a9fa6);_0x56458c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite[_0x77da('0x6')](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file +var _0xcf1c=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x15dea8,_0x1e570d){var _0x24dc85=function(_0x111931){while(--_0x111931){_0x15dea8['push'](_0x15dea8['shift']());}};_0x24dc85(++_0x1e570d);}(_0xcf1c,0x18d));var _0xccf1=function(_0x41f5ba,_0xd0ffa8){_0x41f5ba=_0x41f5ba-0x0;var _0x535e03=_0xcf1c[_0x41f5ba];return _0x535e03;};'use strict';var EventEmitter=require(_0xccf1('0x0'));var ChatWebsite=require(_0xccf1('0x1'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xccf1('0x2')](0x0);var events={'afterCreate':_0xccf1('0x3'),'afterUpdate':_0xccf1('0x4'),'afterDestroy':_0xccf1('0x5')};function emitEvent(_0x5670d0){return function(_0x5d3e85,_0x509c8d,_0x301b38){ChatWebsiteEvents['emit'](_0x5670d0+':'+_0x5d3e85['id'],_0x5d3e85);ChatWebsiteEvents[_0xccf1('0x6')](_0x5670d0,_0x5d3e85);_0x301b38(null);};}for(var e in events){if(events[_0xccf1('0x7')](e)){var event=events[e];ChatWebsite[_0xccf1('0x8')](e,emitEvent(event));}}module[_0xccf1('0x9')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 65e8a2a..c8dabc1 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 _0xa750=['../../config/environment','./chatWebsite.attributes','exports','ChatWebsite','chat_websites','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x36d7a8,_0x270a23){var _0xa58c1e=function(_0x38bec2){while(--_0x38bec2){_0x36d7a8['push'](_0x36d7a8['shift']());}};_0xa58c1e(++_0x270a23);}(_0xa750,0xfc));var _0x0a75=function(_0x1ade98,_0x2aa285){_0x1ade98=_0x1ade98-0x0;var _0xe96d64=_0xa750[_0x1ade98];return _0xe96d64;};'use strict';var _=require(_0x0a75('0x0'));var util=require('util');var logger=require(_0x0a75('0x1'))(_0x0a75('0x2'));var moment=require(_0x0a75('0x3'));var BPromise=require(_0x0a75('0x4'));var rp=require(_0x0a75('0x5'));var fs=require('fs');var path=require(_0x0a75('0x6'));var rimraf=require(_0x0a75('0x7'));var config=require(_0x0a75('0x8'));var attributes=require(_0x0a75('0x9'));module[_0x0a75('0xa')]=function(_0x5a86de,_0x37f0c9){return _0x5a86de['define'](_0x0a75('0xb'),attributes,{'tableName':_0x0a75('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x16a1=['bluebird','request-promise','path','rimraf','../../config/environment','exports','ChatWebsite','chat_websites','lodash','util','api','moment'];(function(_0x2b0879,_0x37dfac){var _0x6ab698=function(_0x4d81ac){while(--_0x4d81ac){_0x2b0879['push'](_0x2b0879['shift']());}};_0x6ab698(++_0x37dfac);}(_0x16a1,0xbc));var _0x116a=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x16a1[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x116a('0x0'));var util=require(_0x116a('0x1'));var logger=require('../../config/logger')(_0x116a('0x2'));var moment=require(_0x116a('0x3'));var BPromise=require(_0x116a('0x4'));var rp=require(_0x116a('0x5'));var fs=require('fs');var path=require(_0x116a('0x6'));var rimraf=require(_0x116a('0x7'));var config=require(_0x116a('0x8'));var attributes=require('./chatWebsite.attributes');module[_0x116a('0x9')]=function(_0x3fcde3,_0x3f5bc3){return _0x3fcde3['define'](_0x116a('0xa'),attributes,{'tableName':_0x116a('0xb'),'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 81cdf92..c80e2b0 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 _0xa28a=['error','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','request','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s'];(function(_0x260859,_0x3cfcff){var _0x4b77f8=function(_0x2e48f8){while(--_0x2e48f8){_0x260859['push'](_0x260859['shift']());}};_0x4b77f8(++_0x3cfcff);}(_0xa28a,0xd0));var _0xaa28=function(_0x4cb1f7,_0xba51a){_0x4cb1f7=_0x4cb1f7-0x0;var _0x570298=_0xa28a[_0x4cb1f7];return _0x570298;};'use strict';var _=require(_0xaa28('0x0'));var util=require(_0xaa28('0x1'));var moment=require(_0xaa28('0x2'));var BPromise=require(_0xaa28('0x3'));var rs=require(_0xaa28('0x4'));var fs=require('fs');var Redis=require(_0xaa28('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xaa28('0x6'));var logger=require('../../config/logger')(_0xaa28('0x7'));var config=require(_0xaa28('0x8'));var jayson=require(_0xaa28('0x9'));var client=jayson[_0xaa28('0xa')][_0xaa28('0xb')]({'port':0x232a});config[_0xaa28('0xc')]=_[_0xaa28('0xd')](config[_0xaa28('0xc')],{'host':_0xaa28('0xe'),'port':0x18eb});var socket=require(_0xaa28('0xf'))(new Redis(config['redis']));require(_0xaa28('0x10'))[_0xaa28('0x11')](socket);function respondWithRpcPromise(_0x46c4c9,_0x14697c,_0x48bd9){return new BPromise(function(_0x248985,_0x5ca2d3){return client[_0xaa28('0x12')](_0x46c4c9,_0x48bd9)[_0xaa28('0x13')](function(_0x48c89e){logger['info'](_0xaa28('0x14'),_0x14697c,_0xaa28('0x15'));logger[_0xaa28('0x16')](_0xaa28('0x17'),_0x14697c,_0xaa28('0x15'),JSON['stringify'](_0x48c89e));if(_0x48c89e[_0xaa28('0x18')]){if(_0x48c89e['error']['code']===0x1f4){logger['error'](_0xaa28('0x14'),_0x14697c,_0x48c89e[_0xaa28('0x18')][_0xaa28('0x19')]);return _0x5ca2d3(_0x48c89e['error']['message']);}logger['error']('ChatWebsite,\x20%s,\x20%s',_0x14697c,_0x48c89e[_0xaa28('0x18')][_0xaa28('0x19')]);return _0x248985(_0x48c89e[_0xaa28('0x18')][_0xaa28('0x19')]);}else{logger[_0xaa28('0x1a')](_0xaa28('0x14'),_0x14697c,'request\x20sent');_0x248985(_0x48c89e[_0xaa28('0x1b')]['message']);}})[_0xaa28('0x1c')](function(_0x5b6f84){logger['error'](_0xaa28('0x14'),_0x14697c,_0x5b6f84);_0x5ca2d3(_0x5b6f84);});});} \ No newline at end of file +var _0x0b7b=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','bluebird','randomstring'];(function(_0x4d539e,_0x27e15f){var _0x394c6e=function(_0x366ebc){while(--_0x366ebc){_0x4d539e['push'](_0x4d539e['shift']());}};_0x394c6e(++_0x27e15f);}(_0x0b7b,0xc0));var _0xb0b7=function(_0x4aeca6,_0x2a8453){_0x4aeca6=_0x4aeca6-0x0;var _0x2fbe77=_0x0b7b[_0x4aeca6];return _0x2fbe77;};'use strict';var _=require(_0xb0b7('0x0'));var util=require(_0xb0b7('0x1'));var moment=require('moment');var BPromise=require(_0xb0b7('0x2'));var rs=require(_0xb0b7('0x3'));var fs=require('fs');var Redis=require(_0xb0b7('0x4'));var db=require(_0xb0b7('0x5'))['db'];var utils=require(_0xb0b7('0x6'));var logger=require(_0xb0b7('0x7'))('rpc');var config=require(_0xb0b7('0x8'));var jayson=require(_0xb0b7('0x9'));var client=jayson[_0xb0b7('0xa')][_0xb0b7('0xb')]({'port':0x232a});config[_0xb0b7('0xc')]=_[_0xb0b7('0xd')](config[_0xb0b7('0xc')],{'host':_0xb0b7('0xe'),'port':0x18eb});var socket=require(_0xb0b7('0xf'))(new Redis(config[_0xb0b7('0xc')]));require(_0xb0b7('0x10'))['register'](socket);function respondWithRpcPromise(_0xa31f72,_0xe15bb6,_0x19b9c0){return new BPromise(function(_0x31ba2a,_0x23f718){return client['request'](_0xa31f72,_0x19b9c0)[_0xb0b7('0x11')](function(_0x3becdc){logger[_0xb0b7('0x12')](_0xb0b7('0x13'),_0xe15bb6,_0xb0b7('0x14'));logger[_0xb0b7('0x15')](_0xb0b7('0x16'),_0xe15bb6,_0xb0b7('0x14'),JSON[_0xb0b7('0x17')](_0x3becdc));if(_0x3becdc['error']){if(_0x3becdc['error']['code']===0x1f4){logger[_0xb0b7('0x18')]('ChatWebsite,\x20%s,\x20%s',_0xe15bb6,_0x3becdc[_0xb0b7('0x18')][_0xb0b7('0x19')]);return _0x23f718(_0x3becdc['error'][_0xb0b7('0x19')]);}logger['error'](_0xb0b7('0x13'),_0xe15bb6,_0x3becdc[_0xb0b7('0x18')][_0xb0b7('0x19')]);return _0x31ba2a(_0x3becdc[_0xb0b7('0x18')][_0xb0b7('0x19')]);}else{logger['info']('ChatWebsite,\x20%s,\x20%s',_0xe15bb6,'request\x20sent');_0x31ba2a(_0x3becdc[_0xb0b7('0x1a')][_0xb0b7('0x19')]);}})[_0xb0b7('0x1b')](function(_0x17853a){logger[_0xb0b7('0x18')](_0xb0b7('0x13'),_0xe15bb6,_0x17853a);_0x23f718(_0x17853a);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 45f7662..3ac3276 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 _0x2ac7=['removeListener','register','length','chatWebsite:','./chatWebsite.events','save','remove','update','emit'];(function(_0xf61c79,_0x43c6fa){var _0x127d26=function(_0x598bf6){while(--_0x598bf6){_0xf61c79['push'](_0xf61c79['shift']());}};_0x127d26(++_0x43c6fa);}(_0x2ac7,0x1d8));var _0x72ac=function(_0x119940,_0x265a3f){_0x119940=_0x119940-0x0;var _0x59af49=_0x2ac7[_0x119940];return _0x59af49;};'use strict';var ChatWebsiteEvents=require(_0x72ac('0x0'));var events=[_0x72ac('0x1'),_0x72ac('0x2'),_0x72ac('0x3')];function createListener(_0x5e5786,_0x24712f){return function(_0x32d5f9){_0x24712f[_0x72ac('0x4')](_0x5e5786,_0x32d5f9);};}function removeListener(_0x4b54c3,_0x47a88d){return function(){ChatWebsiteEvents[_0x72ac('0x5')](_0x4b54c3,_0x47a88d);};}exports[_0x72ac('0x6')]=function(_0x2ef0f5){for(var _0x5b8dd6=0x0,_0x47b767=events[_0x72ac('0x7')];_0x5b8dd6<_0x47b767;_0x5b8dd6++){var _0x15f8fc=events[_0x5b8dd6];var _0x192659=createListener(_0x72ac('0x8')+_0x15f8fc,_0x2ef0f5);ChatWebsiteEvents['on'](_0x15f8fc,_0x192659);}}; \ No newline at end of file +var _0x2e5c=['save','remove','emit','removeListener','register','length','./chatWebsite.events'];(function(_0x15695b,_0x5d307d){var _0x591375=function(_0x409dfd){while(--_0x409dfd){_0x15695b['push'](_0x15695b['shift']());}};_0x591375(++_0x5d307d);}(_0x2e5c,0x6f));var _0xc2e5=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0x2e5c[_0x11005e];return _0x29338f;};'use strict';var ChatWebsiteEvents=require(_0xc2e5('0x0'));var events=[_0xc2e5('0x1'),_0xc2e5('0x2'),'update'];function createListener(_0x776309,_0x93ca87){return function(_0x4816cc){_0x93ca87[_0xc2e5('0x3')](_0x776309,_0x4816cc);};}function removeListener(_0x489b20,_0x1b0a7d){return function(){ChatWebsiteEvents[_0xc2e5('0x4')](_0x489b20,_0x1b0a7d);};}exports[_0xc2e5('0x5')]=function(_0x4d4378){for(var _0x3f684e=0x0,_0x27a7b5=events[_0xc2e5('0x6')];_0x3f684e<_0x27a7b5;_0x3f684e++){var _0x2b2d23=events[_0x3f684e];var _0x174d6e=createListener('chatWebsite:'+_0x2b2d23,_0x4d4378);ChatWebsiteEvents['on'](_0x2b2d23,_0x174d6e);}}; \ 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 dd943f3..ed5f6fd 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 _0x8814=['URL','replace','localhost','([\x5cw]+)','test','exports','../../../utils/misc'];(function(_0x2c46ad,_0x272a6b){var _0x1c33a1=function(_0x5fe954){while(--_0x5fe954){_0x2c46ad['push'](_0x2c46ad['shift']());}};_0x1c33a1(++_0x272a6b);}(_0x8814,0x1b8));var _0x4881=function(_0x178856,_0x41f045){_0x178856=_0x178856-0x0;var _0x3c7fe7=_0x8814[_0x178856];return _0x3c7fe7;};var escapeRegExp=require(_0x4881('0x0'))['escapeRegExp'];var URL=require('url')[_0x4881('0x1')];function testWildcardValidity(_0x4dcd6f){var _0x3c988d=!![];try{new URL(_0x4dcd6f[_0x4881('0x2')]('*',_0x4881('0x3')));}catch(_0xc37014){_0x3c988d=![];}return _0x3c988d&&new RegExp(/(http(s)?):\/\/(\*|(((\*\.)+)?([a-zA-Z0-9\-_]+\.){0,}([a-zA-Z0-9\-_]+)))(:[\d]+)?\/?$/)['test'](_0x4dcd6f);}function testWebsiteWithWildcard(_0x419475,_0x37bab3){var _0x20bc6c;var _0x1f292f=escapeRegExp(_0x419475['trim']()[_0x4881('0x2')](/\/$/,''))['replace']('\x5c*',_0x4881('0x4'));try{new URL(_0x419475[_0x4881('0x2')]('\x5c*',_0x4881('0x3')));_0x20bc6c=new RegExp(_0x1f292f)[_0x4881('0x5')](_0x37bab3);}catch(_0x5baef8){_0x20bc6c=![];}return _0x20bc6c;}module[_0x4881('0x6')]={'testWebsiteWithWildcard':testWebsiteWithWildcard,'testWildcardValidity':testWildcardValidity}; \ No newline at end of file +var _0x073d=['([\x5cw]+)','test','exports','escapeRegExp','url','URL','localhost','trim','replace'];(function(_0x25e7de,_0x24b676){var _0x5cd6b8=function(_0x38526c){while(--_0x38526c){_0x25e7de['push'](_0x25e7de['shift']());}};_0x5cd6b8(++_0x24b676);}(_0x073d,0xd2));var _0xd073=function(_0x22b0cb,_0x5a764a){_0x22b0cb=_0x22b0cb-0x0;var _0x444178=_0x073d[_0x22b0cb];return _0x444178;};var escapeRegExp=require('../../../utils/misc')[_0xd073('0x0')];var URL=require(_0xd073('0x1'))[_0xd073('0x2')];function testWildcardValidity(_0x4aa6fc){var _0x3da883=!![];try{new URL(_0x4aa6fc['replace']('*',_0xd073('0x3')));}catch(_0x423dc8){_0x3da883=![];}return _0x3da883&&new RegExp(/(http(s)?):\/\/(\*|(((\*\.)+)?([a-zA-Z0-9\-_]+\.){0,}([a-zA-Z0-9\-_]+)))(:[\d]+)?\/?$/)['test'](_0x4aa6fc);}function testWebsiteWithWildcard(_0x11bd94,_0x37cb71){var _0x1799b8;var _0x1fdaeb=escapeRegExp(_0x11bd94[_0xd073('0x4')]()[_0xd073('0x5')](/\/$/,''))[_0xd073('0x5')]('\x5c*',_0xd073('0x6'));try{new URL(_0x11bd94[_0xd073('0x5')]('\x5c*',_0xd073('0x3')));_0x1799b8=new RegExp(_0x1fdaeb)[_0xd073('0x7')](_0x37cb71);}catch(_0x1c9295){_0x1799b8=![];}return _0x1799b8;}module[_0xd073('0x8')]={'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 ffa3d5a..b6fc2aa 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 _0xbd02=['single','server/files/images/avatars/','/:id/avatar','addAvatar','file','addCustomerAvatar','addSystemAvatar','/:id/notify','replace','extname','/:id/offline','any','offline','addInteraction','addApplications','/:id/proactive_actions','put','update','delete','destroy','removeDispositions','removeAnswers','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/logo','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','create','post','addDisposition','diskStorage','join','root','format','%s-%s','now','originalname'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbd02,0x174));var _0x2bd0=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0xbd02[_0x68c979];return _0x4f0001;};'use strict';var multer=require('multer');var util=require(_0x2bd0('0x0'));var path=require(_0x2bd0('0x1'));var timeout=require(_0x2bd0('0x2'));var express=require(_0x2bd0('0x3'));var router=express[_0x2bd0('0x4')]();var fs_extra=require(_0x2bd0('0x5'));var auth=require(_0x2bd0('0x6'));var interaction=require(_0x2bd0('0x7'));var config=require(_0x2bd0('0x8'));var controller=require(_0x2bd0('0x9'));router[_0x2bd0('0xa')]('/',auth['isAuthenticated'](),controller[_0x2bd0('0xb')]);router[_0x2bd0('0xa')](_0x2bd0('0xc'),auth[_0x2bd0('0xd')](),controller[_0x2bd0('0xe')]);router[_0x2bd0('0xa')](_0x2bd0('0xf'),auth['isAuthenticated'](),controller[_0x2bd0('0x10')]);router[_0x2bd0('0xa')](_0x2bd0('0x11'),auth['isAuthenticated'](),controller[_0x2bd0('0x12')]);router[_0x2bd0('0xa')](_0x2bd0('0x13'),auth[_0x2bd0('0xd')](),controller['getAnswers']);router['get'](_0x2bd0('0x14'),controller['getLogo']);router[_0x2bd0('0xa')]('/:id/avatar',controller[_0x2bd0('0x15')]);router[_0x2bd0('0xa')](_0x2bd0('0x16'),controller[_0x2bd0('0x17')]);router['get'](_0x2bd0('0x18'),controller[_0x2bd0('0x19')]);router[_0x2bd0('0xa')](_0x2bd0('0x1a'),auth[_0x2bd0('0xd')](),controller[_0x2bd0('0x1b')]);router[_0x2bd0('0xa')](_0x2bd0('0x1c'),controller[_0x2bd0('0x1d')]);router[_0x2bd0('0xa')](_0x2bd0('0x1e'),auth[_0x2bd0('0xd')](),controller[_0x2bd0('0x1f')]);router['get']('/:id/proactive_actions',auth['isAuthenticated'](),controller['getProactiveActions']);router['get'](_0x2bd0('0x20'),controller[_0x2bd0('0x21')]);router[_0x2bd0('0xa')](_0x2bd0('0x22'),auth[_0x2bd0('0xd')](),controller[_0x2bd0('0x23')]);router[_0x2bd0('0xa')](_0x2bd0('0x24'),auth['isAuthenticated'](),controller[_0x2bd0('0x25')]);router['post']('/',auth[_0x2bd0('0xd')](),controller[_0x2bd0('0x26')]);router[_0x2bd0('0x27')](_0x2bd0('0x11'),auth[_0x2bd0('0xd')](),controller[_0x2bd0('0x28')]);router['post'](_0x2bd0('0x13'),auth['isAuthenticated'](),controller['addAnswer']);var upload=multer({'storage':multer[_0x2bd0('0x29')]({'destination':function(_0x3500c8,_0x447a4e,_0x1ae10e){_0x1ae10e(null,path[_0x2bd0('0x2a')](config[_0x2bd0('0x2b')],'server/files/images/logos/'));},'filename':function(_0x296e17,_0xdc24b6,_0x35f58f){_0x35f58f(null,util[_0x2bd0('0x2c')](_0x2bd0('0x2d'),Date[_0x2bd0('0x2e')](),_0xdc24b6[_0x2bd0('0x2f')]));}})});router[_0x2bd0('0x27')](_0x2bd0('0x14'),upload[_0x2bd0('0x30')]('file'),controller['addLogo']);var upload=multer({'storage':multer[_0x2bd0('0x29')]({'destination':function(_0x45e1c1,_0x50104a,_0x2b19b1){_0x2b19b1(null,path['join'](config[_0x2bd0('0x2b')],_0x2bd0('0x31')));},'filename':function(_0x1b099e,_0x429a57,_0x4e7ace){_0x4e7ace(null,util['format'](_0x2bd0('0x2d'),Date[_0x2bd0('0x2e')](),_0x429a57[_0x2bd0('0x2f')]));}})});router[_0x2bd0('0x27')](_0x2bd0('0x32'),upload['single']('file'),controller[_0x2bd0('0x33')]);var upload=multer({'storage':multer[_0x2bd0('0x29')]({'destination':function(_0x21251c,_0x481150,_0x207445){_0x207445(null,path[_0x2bd0('0x2a')](config[_0x2bd0('0x2b')],_0x2bd0('0x31')));},'filename':function(_0x3ba703,_0x10a3de,_0x22778d){_0x22778d(null,util[_0x2bd0('0x2c')]('%s-%s',Date[_0x2bd0('0x2e')](),_0x10a3de[_0x2bd0('0x2f')]));}})});router[_0x2bd0('0x27')]('/:id/customer_avatar',upload[_0x2bd0('0x30')](_0x2bd0('0x34')),controller[_0x2bd0('0x35')]);var upload=multer({'storage':multer[_0x2bd0('0x29')]({'destination':function(_0x19453f,_0x129c74,_0x16e24a){_0x16e24a(null,path[_0x2bd0('0x2a')](config[_0x2bd0('0x2b')],_0x2bd0('0x31')));},'filename':function(_0x4aaffb,_0x367860,_0x205962){_0x205962(null,util[_0x2bd0('0x2c')]('%s-%s',Date[_0x2bd0('0x2e')](),_0x367860[_0x2bd0('0x2f')]));}})});router[_0x2bd0('0x27')](_0x2bd0('0x18'),upload['single'](_0x2bd0('0x34')),controller[_0x2bd0('0x36')]);router[_0x2bd0('0x27')](_0x2bd0('0x37'),controller['notify']);const offlineUploadMulter=multer({'storage':multer[_0x2bd0('0x29')]({'destination':function(_0x32e1cf,_0x4abeba,_0x359996){const _0x57e02e=path['join'](config[_0x2bd0('0x2b')],'server/files','attachments','offline-chat');fs_extra['ensureDir'](_0x57e02e,function(){_0x359996(null,_0x57e02e);});},'filename':function(_0x5cb16e,_0x300222,_0x17a117){const _0x324d20=_0x300222[_0x2bd0('0x2f')][_0x2bd0('0x38')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x1b48bd=path[_0x2bd0('0x39')](_0x324d20);const _0x25ec50=Date[_0x2bd0('0x2e')]()+'-'+_0x324d20[_0x2bd0('0x38')](_0x1b48bd,'')+_0x1b48bd;_0x17a117(null,_0x25ec50);}})});router[_0x2bd0('0x27')](_0x2bd0('0x3a'),offlineUploadMulter[_0x2bd0('0x3b')](),controller[_0x2bd0('0x3c')]);router['post'](_0x2bd0('0x1a'),auth['isAuthenticated'](),controller[_0x2bd0('0x3d')]);router['post'](_0x2bd0('0x1e'),auth[_0x2bd0('0xd')](),controller[_0x2bd0('0x3e')]);router[_0x2bd0('0x27')](_0x2bd0('0x3f'),auth[_0x2bd0('0xd')](),controller['addProactiveActions']);router[_0x2bd0('0x27')]('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0x2bd0('0x40')](_0x2bd0('0xf'),auth[_0x2bd0('0xd')](),controller[_0x2bd0('0x41')]);router[_0x2bd0('0x42')](_0x2bd0('0xf'),auth['isAuthenticated'](),controller[_0x2bd0('0x43')]);router[_0x2bd0('0x42')](_0x2bd0('0x11'),auth[_0x2bd0('0xd')](),controller[_0x2bd0('0x44')]);router['delete'](_0x2bd0('0x13'),auth['isAuthenticated'](),controller[_0x2bd0('0x45')]);router[_0x2bd0('0x42')]('/:id/users',auth[_0x2bd0('0xd')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x093c=['addAnswer','diskStorage','join','root','format','%s-%s','now','originalname','/:id/logo','single','addLogo','file','addAvatar','server/files/images/avatars/','addSystemAvatar','/:id/notify','notify','server/files','attachments','offline-chat','ensureDir','replace','extname','/:id/offline','any','offline','addInteraction','addApplications','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatWebsite.controller','get','index','/describe','isAuthenticated','/:id','show','/:id/dispositions','getAnswers','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','getInteractions','/:id/snippet','getSnippet','/:id/applications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','create','post','addDisposition','/:id/canned_answers'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x093c,0x18f));var _0xc093=function(_0x2923a6,_0x197060){_0x2923a6=_0x2923a6-0x0;var _0x340da3=_0x093c[_0x2923a6];return _0x340da3;};'use strict';var multer=require('multer');var util=require(_0xc093('0x0'));var path=require(_0xc093('0x1'));var timeout=require(_0xc093('0x2'));var express=require(_0xc093('0x3'));var router=express[_0xc093('0x4')]();var fs_extra=require(_0xc093('0x5'));var auth=require(_0xc093('0x6'));var interaction=require(_0xc093('0x7'));var config=require('../../config/environment');var controller=require(_0xc093('0x8'));router[_0xc093('0x9')]('/',auth['isAuthenticated'](),controller[_0xc093('0xa')]);router[_0xc093('0x9')](_0xc093('0xb'),auth[_0xc093('0xc')](),controller['describe']);router[_0xc093('0x9')](_0xc093('0xd'),auth['isAuthenticated'](),controller[_0xc093('0xe')]);router[_0xc093('0x9')](_0xc093('0xf'),auth[_0xc093('0xc')](),controller['getDispositions']);router[_0xc093('0x9')]('/:id/canned_answers',auth[_0xc093('0xc')](),controller[_0xc093('0x10')]);router['get']('/:id/logo',controller['getLogo']);router[_0xc093('0x9')](_0xc093('0x11'),controller[_0xc093('0x12')]);router[_0xc093('0x9')](_0xc093('0x13'),controller[_0xc093('0x14')]);router[_0xc093('0x9')](_0xc093('0x15'),controller[_0xc093('0x16')]);router[_0xc093('0x9')]('/:id/interactions',auth[_0xc093('0xc')](),controller[_0xc093('0x17')]);router['get'](_0xc093('0x18'),controller[_0xc093('0x19')]);router[_0xc093('0x9')](_0xc093('0x1a'),auth[_0xc093('0xc')](),controller['getApplications']);router[_0xc093('0x9')](_0xc093('0x1b'),auth[_0xc093('0xc')](),controller[_0xc093('0x1c')]);router['get'](_0xc093('0x1d'),controller[_0xc093('0x1e')]);router[_0xc093('0x9')](_0xc093('0x1f'),auth[_0xc093('0xc')](),controller[_0xc093('0x20')]);router[_0xc093('0x9')](_0xc093('0x21'),auth[_0xc093('0xc')](),controller[_0xc093('0x22')]);router['post']('/',auth[_0xc093('0xc')](),controller[_0xc093('0x23')]);router[_0xc093('0x24')](_0xc093('0xf'),auth[_0xc093('0xc')](),controller[_0xc093('0x25')]);router[_0xc093('0x24')](_0xc093('0x26'),auth[_0xc093('0xc')](),controller[_0xc093('0x27')]);var upload=multer({'storage':multer[_0xc093('0x28')]({'destination':function(_0x37439c,_0x2acbac,_0x587586){_0x587586(null,path[_0xc093('0x29')](config[_0xc093('0x2a')],'server/files/images/logos/'));},'filename':function(_0x4a3c09,_0x5ec99c,_0x1a0510){_0x1a0510(null,util[_0xc093('0x2b')](_0xc093('0x2c'),Date[_0xc093('0x2d')](),_0x5ec99c[_0xc093('0x2e')]));}})});router[_0xc093('0x24')](_0xc093('0x2f'),upload[_0xc093('0x30')]('file'),controller[_0xc093('0x31')]);var upload=multer({'storage':multer[_0xc093('0x28')]({'destination':function(_0x3b6388,_0x252ff7,_0x49e8b5){_0x49e8b5(null,path['join'](config['root'],'server/files/images/avatars/'));},'filename':function(_0x4389f2,_0x5f563d,_0x3c097a){_0x3c097a(null,util['format'](_0xc093('0x2c'),Date['now'](),_0x5f563d[_0xc093('0x2e')]));}})});router[_0xc093('0x24')](_0xc093('0x11'),upload[_0xc093('0x30')](_0xc093('0x32')),controller[_0xc093('0x33')]);var upload=multer({'storage':multer[_0xc093('0x28')]({'destination':function(_0x1ea6e0,_0x21f4c8,_0x4a73ab){_0x4a73ab(null,path['join'](config[_0xc093('0x2a')],_0xc093('0x34')));},'filename':function(_0x5291bb,_0x141f79,_0x26b9ce){_0x26b9ce(null,util[_0xc093('0x2b')]('%s-%s',Date[_0xc093('0x2d')](),_0x141f79[_0xc093('0x2e')]));}})});router[_0xc093('0x24')](_0xc093('0x13'),upload['single']('file'),controller['addCustomerAvatar']);var upload=multer({'storage':multer[_0xc093('0x28')]({'destination':function(_0x50332f,_0x1e76f3,_0x3b1237){_0x3b1237(null,path['join'](config[_0xc093('0x2a')],_0xc093('0x34')));},'filename':function(_0x301f57,_0x1bddf9,_0x532974){_0x532974(null,util[_0xc093('0x2b')](_0xc093('0x2c'),Date[_0xc093('0x2d')](),_0x1bddf9[_0xc093('0x2e')]));}})});router[_0xc093('0x24')]('/:id/system_avatar',upload[_0xc093('0x30')](_0xc093('0x32')),controller[_0xc093('0x35')]);router[_0xc093('0x24')](_0xc093('0x36'),controller[_0xc093('0x37')]);const offlineUploadMulter=multer({'storage':multer[_0xc093('0x28')]({'destination':function(_0x540755,_0xe01003,_0xc8311c){const _0x584843=path[_0xc093('0x29')](config['root'],_0xc093('0x38'),_0xc093('0x39'),_0xc093('0x3a'));fs_extra[_0xc093('0x3b')](_0x584843,function(){_0xc8311c(null,_0x584843);});},'filename':function(_0x3dedbb,_0x3f7ddc,_0x154080){const _0x1bb203=_0x3f7ddc['originalname'][_0xc093('0x3c')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x2ad5f5=path[_0xc093('0x3d')](_0x1bb203);const _0x50ca93=Date[_0xc093('0x2d')]()+'-'+_0x1bb203['replace'](_0x2ad5f5,'')+_0x2ad5f5;_0x154080(null,_0x50ca93);}})});router[_0xc093('0x24')](_0xc093('0x3e'),offlineUploadMulter[_0xc093('0x3f')](),controller[_0xc093('0x40')]);router[_0xc093('0x24')]('/:id/interactions',auth[_0xc093('0xc')](),controller[_0xc093('0x41')]);router[_0xc093('0x24')]('/:id/applications',auth[_0xc093('0xc')](),controller[_0xc093('0x42')]);router[_0xc093('0x24')]('/:id/proactive_actions',auth[_0xc093('0xc')](),controller['addProactiveActions']);router['post'](_0xc093('0x21'),auth[_0xc093('0xc')](),controller['addAgents']);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0xc093('0xd'),auth[_0xc093('0xc')](),controller[_0xc093('0x43')]);router[_0xc093('0x44')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xc093('0x45')]);router[_0xc093('0x44')](_0xc093('0x26'),auth[_0xc093('0xc')](),controller[_0xc093('0x46')]);router[_0xc093('0x44')]('/:id/users',auth[_0xc093('0xc')](),controller[_0xc093('0x47')]);module[_0xc093('0x48')]=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index bc0fe01..9c43d56 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 _0x0943=['production','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint','/client-logs','use','isAuthenticated','exports','beaver-logger/server','express','../components/auth/service','../config/environment'];(function(_0x2e407d,_0x15f491){var _0x590459=function(_0x311935){while(--_0x311935){_0x2e407d['push'](_0x2e407d['shift']());}};_0x590459(++_0x15f491);}(_0x0943,0x164));var _0x3094=function(_0x50317b,_0x3c288f){_0x50317b=_0x50317b-0x0;var _0x26dd1f=_0x0943[_0x50317b];return _0x26dd1f;};var beaverLogger=require(_0x3094('0x0'));var express=require(_0x3094('0x1'));var auth=require(_0x3094('0x2'));var config=require(_0x3094('0x3'));var router=express['Router']();var isProduction=config['env']===_0x3094('0x4')||![];function clientSideLogs(_0x32c408,_0xb69b02,_0x419c99){var _0x3b3336=_0x32c408['app']['get'](_0x3094('0x5'));if(!_0x3b3336){throw new Error(_0x3094('0x6'));}return beaverLogger[_0x3094('0x7')]({'uri':_0x3094('0x8'),'logger':_0x3b3336,'enableCors':!isProduction})(_0x32c408,_0xb69b02,_0x419c99);}router[_0x3094('0x9')](auth[_0x3094('0xa')](),clientSideLogs);module[_0x3094('0xb')]=router; \ No newline at end of file +var _0x97da=['Client-Side\x20logger\x20not\x20found!','expressEndpoint','/client-logs','use','isAuthenticated','exports','beaver-logger/server','express','../components/auth/service','Router','env','production','app','client-side-logger'];(function(_0x20a9fe,_0x42e27a){var _0x376572=function(_0x3bdc7c){while(--_0x3bdc7c){_0x20a9fe['push'](_0x20a9fe['shift']());}};_0x376572(++_0x42e27a);}(_0x97da,0x164));var _0xa97d=function(_0x339772,_0x415d04){_0x339772=_0x339772-0x0;var _0x35cb03=_0x97da[_0x339772];return _0x35cb03;};var beaverLogger=require(_0xa97d('0x0'));var express=require(_0xa97d('0x1'));var auth=require(_0xa97d('0x2'));var config=require('../config/environment');var router=express[_0xa97d('0x3')]();var isProduction=config[_0xa97d('0x4')]===_0xa97d('0x5')||![];function clientSideLogs(_0x2112b3,_0x12166b,_0x4bdda3){var _0x2dabc4=_0x2112b3[_0xa97d('0x6')]['get'](_0xa97d('0x7'));if(!_0x2dabc4){throw new Error(_0xa97d('0x8'));}return beaverLogger[_0xa97d('0x9')]({'uri':_0xa97d('0xa'),'logger':_0x2dabc4,'enableCors':!isProduction})(_0x2112b3,_0x12166b,_0x4bdda3);}router[_0xa97d('0xb')](auth[_0xa97d('0xc')](),clientSideLogs);module[_0xa97d('0xd')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 701c75a..39bf1e0 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 _0x37b8=['MicrosoftAzure\x20=>\x20access_token','TEXT','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','STRING','ENUM','AmazonAWS','Google','MicrosoftAzure','Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x37b8,0x1d1));var _0x837b=function(_0x159152,_0x174251){_0x159152=_0x159152-0x0;var _0x50a4aa=_0x37b8[_0x159152];return _0x50a4aa;};'use strict';var Sequelize=require(_0x837b('0x0'));module[_0x837b('0x1')]={'name':{'type':Sequelize[_0x837b('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x837b('0x3')](_0x837b('0x4'),_0x837b('0x5'),_0x837b('0x6')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x837b('0x3')](_0x837b('0x7'),_0x837b('0x8'))},'data1':{'type':Sequelize[_0x837b('0x2')],'comment':_0x837b('0x9')},'data2':{'type':Sequelize['STRING'],'comment':_0x837b('0xa')},'data3':{'type':Sequelize[_0x837b('0x2')],'comment':'MicrosoftAzure\x20=>\x20client_secret'},'data4':{'type':Sequelize['STRING'],'comment':'MicrosoftAzure\x20=>\x20redirect_uri'},'data5':{'type':Sequelize['TEXT'],'comment':_0x837b('0xb')},'data6':{'type':Sequelize[_0x837b('0xc')],'comment':'MicrosoftAzure\x20=>\x20refresh_token'},'data7':{'type':Sequelize[_0x837b('0xc')],'comment':_0x837b('0xd')}}; \ No newline at end of file +var _0x6842=['Dynamics365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20access_token','TEXT','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','exports','STRING','ENUM','AmazonAWS','Google'];(function(_0x143c39,_0x332547){var _0x23cca6=function(_0x119ac8){while(--_0x119ac8){_0x143c39['push'](_0x143c39['shift']());}};_0x23cca6(++_0x332547);}(_0x6842,0x13f));var _0x2684=function(_0x346787,_0x5dbfe7){_0x346787=_0x346787-0x0;var _0x3958aa=_0x6842[_0x346787];return _0x3958aa;};'use strict';var Sequelize=require('sequelize');module[_0x2684('0x0')]={'name':{'type':Sequelize[_0x2684('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x2684('0x2')](_0x2684('0x3'),_0x2684('0x4'),'MicrosoftAzure'),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x2684('0x2')]('Outlook365',_0x2684('0x5'))},'data1':{'type':Sequelize[_0x2684('0x1')],'comment':_0x2684('0x6')},'data2':{'type':Sequelize[_0x2684('0x1')],'comment':_0x2684('0x7')},'data3':{'type':Sequelize[_0x2684('0x1')],'comment':_0x2684('0x8')},'data4':{'type':Sequelize[_0x2684('0x1')],'comment':'MicrosoftAzure\x20=>\x20redirect_uri'},'data5':{'type':Sequelize['TEXT'],'comment':_0x2684('0x9')},'data6':{'type':Sequelize[_0x2684('0xa')],'comment':'MicrosoftAzure\x20=>\x20refresh_token'},'data7':{'type':Sequelize[_0x2684('0xa')],'comment':_0x2684('0xb')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index e45dd65..664b1d8 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 _0x05ab=['../../config/logger','api','../../mysqldb','redis','defaults','localhost','status','json','offset','undefined','count','set','Content-Range','update','destroy','end','sendStatus','stack','name','slice','index','CloudProvider','rawAttributes','fieldName','type','key','model','map','query','filters','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','then','includeAll','findAll','rows','service','catch','show','keys','intersection','include','options','decryptString','data3','body','Service\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','MicrosoftAzure','encryptString','find','params','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','error','get','state','Invalid\x20state\x20parameter','from','base64','toString','ascii','parse','isValidIdToken','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','access_token','data6','refresh_token','data5','startRefreshInterval','emit','microsoftAuthorization:success','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','send','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','lodash','../../components/encryptor','../../config/environment'];(function(_0x1bd0c4,_0x2405e0){var _0x13a3af=function(_0xe18df9){while(--_0xe18df9){_0x1bd0c4['push'](_0x1bd0c4['shift']());}};_0x13a3af(++_0x2405e0);}(_0x05ab,0x120));var _0xb05a=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0x05ab[_0x24061a];return _0x82054e;};'use strict';var _=require(_0xb05a('0x0'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var encryptor=require(_0xb05a('0x1'));var config=require(_0xb05a('0x2'));var logger=require(_0xb05a('0x3'))(_0xb05a('0x4'));var db=require(_0xb05a('0x5'))['db'];var oauth=require('./cloudProvider.oauth');config[_0xb05a('0x6')]=_[_0xb05a('0x7')](config['redis'],{'host':_0xb05a('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb05a('0x6')]));var redis=new Redis(config['redis']);function respondWithStatusCode(_0xed189b,_0xea5d17){_0xea5d17=_0xea5d17||0xcc;return function(_0x2e8961){if(_0x2e8961){return _0xed189b['sendStatus'](_0xea5d17);}return _0xed189b[_0xb05a('0x9')](_0xea5d17)['end']();};}function respondWithResult(_0x11a786,_0x18985b){_0x18985b=_0x18985b||0xc8;return function(_0x218606){if(_0x218606){return _0x11a786['status'](_0x18985b)[_0xb05a('0xa')](_0x218606);}};}function respondWithFilteredResult(_0x430096,_0x40e0b4){return function(_0x45f58e){if(_0x45f58e){var _0x3ff021=typeof _0x40e0b4[_0xb05a('0xb')]===_0xb05a('0xc')&&typeof _0x40e0b4['limit']===_0xb05a('0xc');var _0x535c17=_0x45f58e['count'];var _0x266656=_0x3ff021?0x0:_0x40e0b4['offset'];var _0xa0dee1=_0x3ff021?_0x45f58e[_0xb05a('0xd')]:_0x40e0b4[_0xb05a('0xb')]+_0x40e0b4['limit'];var _0x5841de;if(_0xa0dee1>=_0x535c17){_0xa0dee1=_0x535c17;_0x5841de=0xc8;}else{_0x5841de=0xce;}_0x430096[_0xb05a('0x9')](_0x5841de);return _0x430096[_0xb05a('0xe')](_0xb05a('0xf'),_0x266656+'-'+_0xa0dee1+'/'+_0x535c17)[_0xb05a('0xa')](_0x45f58e);}return null;};}function saveUpdates(_0x1795a9){return function(_0x51ba0d){if(_0x51ba0d){return _0x51ba0d[_0xb05a('0x10')](_0x1795a9)['then'](function(_0x38f548){return _0x38f548;});}return null;};}function removeEntity(_0x46de75){return function(_0x51e85b){if(_0x51e85b){return _0x51e85b[_0xb05a('0x11')]()['then'](function(){_0x46de75[_0xb05a('0x9')](0xcc)[_0xb05a('0x12')]();});}};}function handleEntityNotFound(_0x4f2fd7){return function(_0x30fa10){if(!_0x30fa10){_0x4f2fd7[_0xb05a('0x13')](0x194);}return _0x30fa10;};}function handleError(_0x30a787,_0x2007f5){_0x2007f5=_0x2007f5||0x1f4;return function(_0x34c733){logger['error'](_0x34c733[_0xb05a('0x14')]);if(_0x34c733[_0xb05a('0x15')]){delete _0x34c733[_0xb05a('0x15')];}_0x30a787[_0xb05a('0x9')](_0x2007f5)['send'](_0x34c733);};}function maskClientSecret(_0x90cece){return _['padEnd'](_0x90cece[_0xb05a('0x16')](0x0,0x3),0x14,'*');}exports[_0xb05a('0x17')]=function(_0x16ea36,_0x187f69){var _0x59c74f={},_0x354e5b={},_0x36749a={'count':0x0,'rows':[]};var _0x337723=_['map'](db[_0xb05a('0x18')][_0xb05a('0x19')],function(_0x5b0657){return{'name':_0x5b0657[_0xb05a('0x1a')],'type':_0x5b0657[_0xb05a('0x1b')][_0xb05a('0x1c')]};});_0x354e5b[_0xb05a('0x1d')]=_[_0xb05a('0x1e')](_0x337723,'name');_0x354e5b[_0xb05a('0x1f')]=_['keys'](_0x16ea36[_0xb05a('0x1f')]);_0x354e5b[_0xb05a('0x20')]=_['intersection'](_0x354e5b[_0xb05a('0x1d')],_0x354e5b[_0xb05a('0x1f')]);_0x59c74f['attributes']=_['intersection'](_0x354e5b[_0xb05a('0x1d')],qs['fields'](_0x16ea36[_0xb05a('0x1f')][_0xb05a('0x21')]));_0x59c74f[_0xb05a('0x22')]=_0x59c74f[_0xb05a('0x22')][_0xb05a('0x23')]?_0x59c74f[_0xb05a('0x22')]:_0x354e5b[_0xb05a('0x1d')];if(!_0x16ea36[_0xb05a('0x1f')][_0xb05a('0x24')](_0xb05a('0x25'))){_0x59c74f['limit']=qs[_0xb05a('0x26')](_0x16ea36['query'][_0xb05a('0x26')]);_0x59c74f[_0xb05a('0xb')]=qs['offset'](_0x16ea36[_0xb05a('0x1f')][_0xb05a('0xb')]);}_0x59c74f[_0xb05a('0x27')]=qs['sort'](_0x16ea36[_0xb05a('0x1f')][_0xb05a('0x28')]);_0x59c74f[_0xb05a('0x29')]=qs[_0xb05a('0x20')](_['pick'](_0x16ea36[_0xb05a('0x1f')],_0x354e5b[_0xb05a('0x20')]),_0x337723);if(_0x16ea36[_0xb05a('0x1f')][_0xb05a('0x2a')]){_0x59c74f[_0xb05a('0x29')]=_[_0xb05a('0x2b')](_0x59c74f['where'],{'$or':_[_0xb05a('0x1e')](_0x337723,function(_0x16792d){if(_0x16792d[_0xb05a('0x1b')]!==_0xb05a('0x2c')){var _0x91e068={};_0x91e068[_0x16792d['name']]={'$like':'%'+_0x16ea36[_0xb05a('0x1f')][_0xb05a('0x2a')]+'%'};return _0x91e068;}})});}_0x59c74f=_['merge']({},_0x59c74f,_0x16ea36['options']);var _0x5ac8f8={'where':_0x59c74f[_0xb05a('0x29')]};return db[_0xb05a('0x18')][_0xb05a('0xd')](_0x5ac8f8)[_0xb05a('0x2d')](function(_0x1bffd5){_0x36749a[_0xb05a('0xd')]=_0x1bffd5;if(_0x16ea36[_0xb05a('0x1f')][_0xb05a('0x2e')]){_0x59c74f['include']=[{'all':!![]}];}return db[_0xb05a('0x18')][_0xb05a('0x2f')](_0x59c74f);})[_0xb05a('0x2d')](function(_0x58a2ed){_0x36749a[_0xb05a('0x30')]=_[_0xb05a('0x1e')](_0x58a2ed,function(_0xc2acae){if(_0xc2acae[_0xb05a('0x31')]==='MicrosoftAzure'){var _0x529a2c=encryptor['decryptString'](_0xc2acae['data3']);_0xc2acae['data3']=maskClientSecret(_0x529a2c);}return _0xc2acae;});return _0x36749a;})[_0xb05a('0x2d')](respondWithFilteredResult(_0x187f69,_0x59c74f))[_0xb05a('0x32')](handleError(_0x187f69,null));};exports[_0xb05a('0x33')]=function(_0x39fc58,_0x3faff3){var _0xca6337={'raw':!![],'where':{'id':_0x39fc58['params']['id']}},_0x4898d8={};_0x4898d8[_0xb05a('0x1d')]=_[_0xb05a('0x34')](db[_0xb05a('0x18')][_0xb05a('0x19')]);_0x4898d8['query']=_[_0xb05a('0x34')](_0x39fc58[_0xb05a('0x1f')]);_0x4898d8[_0xb05a('0x20')]=_['intersection'](_0x4898d8[_0xb05a('0x1d')],_0x4898d8['query']);_0xca6337[_0xb05a('0x22')]=_[_0xb05a('0x35')](_0x4898d8[_0xb05a('0x1d')],qs[_0xb05a('0x21')](_0x39fc58[_0xb05a('0x1f')][_0xb05a('0x21')]));_0xca6337[_0xb05a('0x22')]=_0xca6337[_0xb05a('0x22')][_0xb05a('0x23')]?_0xca6337[_0xb05a('0x22')]:_0x4898d8[_0xb05a('0x1d')];if(_0x39fc58[_0xb05a('0x1f')][_0xb05a('0x2e')]){_0xca6337[_0xb05a('0x36')]=[{'all':!![]}];}_0xca6337=_[_0xb05a('0x2b')]({},_0xca6337,_0x39fc58[_0xb05a('0x37')]);return db[_0xb05a('0x18')]['find'](_0xca6337)[_0xb05a('0x2d')](handleEntityNotFound(_0x3faff3,null))[_0xb05a('0x2d')](function(_0x214f17){if(_0x214f17[_0xb05a('0x31')]==='MicrosoftAzure'){var _0x132b28=encryptor[_0xb05a('0x38')](_0x214f17[_0xb05a('0x39')]);_0x214f17[_0xb05a('0x39')]=maskClientSecret(_0x132b28);}return _0x214f17;})[_0xb05a('0x2d')](respondWithResult(_0x3faff3,null))[_0xb05a('0x32')](handleError(_0x3faff3,null));};exports['create']=function(_0x5b6e0a,_0x2b84d4){if(!_0x5b6e0a['body'][_0xb05a('0x15')])throw new Error('Name\x20parameter\x20not\x20specified');if(!_0x5b6e0a[_0xb05a('0x3a')]['service'])throw new Error(_0xb05a('0x3b'));var _0x2f119f=db[_0xb05a('0x18')]['rawAttributes'][_0xb05a('0x31')][_0xb05a('0x3c')];if(!_0x2f119f[_0xb05a('0x3d')](_0x5b6e0a['body'][_0xb05a('0x31')]))throw new Error(_0xb05a('0x3e')+_0x2f119f[_0xb05a('0x3f')](',\x20'));if(_0x5b6e0a[_0xb05a('0x3a')][_0xb05a('0x31')]===_0xb05a('0x40')&&_0x5b6e0a['body'][_0xb05a('0x39')]){_0x5b6e0a[_0xb05a('0x3a')]['data3']=encryptor[_0xb05a('0x41')](_0x5b6e0a['body'][_0xb05a('0x39')]);}return db[_0xb05a('0x18')]['create'](_0x5b6e0a[_0xb05a('0x3a')],{})['then'](respondWithResult(_0x2b84d4,0xc9))[_0xb05a('0x32')](handleError(_0x2b84d4,null));};exports[_0xb05a('0x10')]=function(_0x2c76fe,_0x2cb35a){if(_0x2c76fe[_0xb05a('0x3a')]['id']){delete _0x2c76fe['body']['id'];}return db[_0xb05a('0x18')][_0xb05a('0x42')]({'where':{'id':_0x2c76fe[_0xb05a('0x43')]['id']}})[_0xb05a('0x2d')](handleEntityNotFound(_0x2cb35a,null))[_0xb05a('0x2d')](function(_0x1f1030){if(_0x1f1030['service']===_0xb05a('0x40')&&_0x2c76fe[_0xb05a('0x3a')][_0xb05a('0x39')]){_0x2c76fe['body']['data3']=encryptor[_0xb05a('0x41')](_0x2c76fe[_0xb05a('0x3a')][_0xb05a('0x39')]);}return _0x1f1030;})['then'](saveUpdates(_0x2c76fe[_0xb05a('0x3a')],null))['then'](respondWithResult(_0x2cb35a,null))[_0xb05a('0x32')](handleError(_0x2cb35a,null));};exports[_0xb05a('0x11')]=function(_0x31a4d6,_0x13091d){return db[_0xb05a('0x18')][_0xb05a('0x42')]({'where':{'id':_0x31a4d6[_0xb05a('0x43')]['id']}})[_0xb05a('0x2d')](handleEntityNotFound(_0x13091d,null))[_0xb05a('0x2d')](removeEntity(_0x13091d,null))['catch'](handleError(_0x13091d,null));};exports[_0xb05a('0x44')]=function(_0xa9eecb,_0x106bfa){return db[_0xb05a('0x18')][_0xb05a('0x45')]({'where':{'id':_0xa9eecb[_0xb05a('0x43')]['id']},'raw':!![]})[_0xb05a('0x2d')](function(_0x32ce7d){if(!_0x32ce7d)return _0x106bfa['sendStatus'](0x194);return{'url':oauth[_0xb05a('0x46')](_0x32ce7d,_0xa9eecb[_0xb05a('0x47')]['id'])};})[_0xb05a('0x2d')](respondWithResult(_0x106bfa,null))[_0xb05a('0x32')](handleError(_0x106bfa,null));};exports[_0xb05a('0x48')]=function(_0x50667a,_0x536d8f){var _0x4ac058=_0x50667a[_0xb05a('0x3a')];var _0x356b4f;var _0x51e448;if(_0x4ac058[_0xb05a('0x49')])throw _0x4ac058;redis[_0xb05a('0x4a')](_0x4ac058[_0xb05a('0x4b')])[_0xb05a('0x2d')](function(_0xde1010){if(!_0xde1010)throw new Error(_0xb05a('0x4c'));_0x356b4f=JSON['parse'](_0xde1010);var _0x54ee5c=Buffer[_0xb05a('0x4d')](_0x4ac058[_0xb05a('0x4b')],_0xb05a('0x4e'))[_0xb05a('0x4f')](_0xb05a('0x50'));_0x51e448=JSON[_0xb05a('0x51')](_0x54ee5c);if(!oauth[_0xb05a('0x52')](_0x4ac058['id_token'],_0x356b4f[_0xb05a('0x53')]))throw new Error(_0xb05a('0x54'));redis[_0xb05a('0x55')](_0x4ac058[_0xb05a('0x4b')]);return oauth['getOauth2MicrosoftAccessToken'](_0x4ac058['code'],_0x356b4f);})[_0xb05a('0x2d')](function(_0x31c03b){_0x356b4f['data5']=_0x31c03b[_0xb05a('0x56')];_0x356b4f[_0xb05a('0x57')]=_0x31c03b[_0xb05a('0x58')];return db[_0xb05a('0x18')][_0xb05a('0x10')]({'data5':_0x356b4f[_0xb05a('0x59')],'data6':_0x356b4f[_0xb05a('0x57')]},{'where':{'id':_0x356b4f['id']}});})[_0xb05a('0x2d')](function(){oauth[_0xb05a('0x5a')](_0x356b4f);socket[_0xb05a('0x5b')](_0xb05a('0x5c'),{'id':_0x51e448['id']});return;})[_0xb05a('0x2d')](respondWithStatusCode(_0x536d8f,null))[_0xb05a('0x32')](function(_0x57e9ff){if(_0x51e448){socket['emit'](_0xb05a('0x5d'),{'id':_0x51e448['id']});}if(!_0x356b4f){logger[_0xb05a('0x49')](_0xb05a('0x5e'),_0x57e9ff);return _0x536d8f[_0xb05a('0x9')](0x1f4)[_0xb05a('0x5f')](_0x57e9ff['message']);}logger['error'](_0xb05a('0x60'),_0x356b4f['id'],JSON['stringify'](_0x57e9ff));});}; \ No newline at end of file +var _0x5295=['filter','where','merge','then','includeAll','findAll','rows','service','MicrosoftAzure','data3','catch','params','include','find','decryptString','create','Service\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','body','update','encryptString','oauth2MicrosoftAuthorize','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','error','get','Invalid\x20state\x20parameter','parse','from','state','base64','ascii','isValidIdToken','oauth2Claims','del','getOauth2MicrosoftAccessToken','code','refresh_token','data6','startRefreshInterval','emit','microsoftAuthorization:success','microsoftAuthorization:error','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/environment','../../config/logger','api','../../mysqldb','redis','defaults','socket.io-emitter','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','destroy','stack','name','send','padEnd','slice','index','map','CloudProvider','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x5295,0x1a2));var _0x5529=function(_0x41c866,_0x5dd8fa){_0x41c866=_0x41c866-0x0;var _0x2a484c=_0x5295[_0x41c866];return _0x2a484c;};'use strict';var _=require('lodash');var Redis=require(_0x5529('0x0'));var qs=require(_0x5529('0x1'));var encryptor=require(_0x5529('0x2'));var config=require(_0x5529('0x3'));var logger=require(_0x5529('0x4'))(_0x5529('0x5'));var db=require(_0x5529('0x6'))['db'];var oauth=require('./cloudProvider.oauth');config[_0x5529('0x7')]=_[_0x5529('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x5529('0x9'))(new Redis(config[_0x5529('0x7')]));var redis=new Redis(config['redis']);function respondWithStatusCode(_0x264dd6,_0x8ab5c9){_0x8ab5c9=_0x8ab5c9||0xcc;return function(_0x55a1fc){if(_0x55a1fc){return _0x264dd6[_0x5529('0xa')](_0x8ab5c9);}return _0x264dd6[_0x5529('0xb')](_0x8ab5c9)[_0x5529('0xc')]();};}function respondWithResult(_0x54af3b,_0x3e4f60){_0x3e4f60=_0x3e4f60||0xc8;return function(_0x132cdb){if(_0x132cdb){return _0x54af3b['status'](_0x3e4f60)[_0x5529('0xd')](_0x132cdb);}};}function respondWithFilteredResult(_0x1954cc,_0x51caba){return function(_0x3294c6){if(_0x3294c6){var _0x7575d=typeof _0x51caba[_0x5529('0xe')]===_0x5529('0xf')&&typeof _0x51caba[_0x5529('0x10')]===_0x5529('0xf');var _0x42c5e7=_0x3294c6['count'];var _0x1ca01=_0x7575d?0x0:_0x51caba[_0x5529('0xe')];var _0x4edabf=_0x7575d?_0x3294c6[_0x5529('0x11')]:_0x51caba[_0x5529('0xe')]+_0x51caba['limit'];var _0x23f581;if(_0x4edabf>=_0x42c5e7){_0x4edabf=_0x42c5e7;_0x23f581=0xc8;}else{_0x23f581=0xce;}_0x1954cc['status'](_0x23f581);return _0x1954cc[_0x5529('0x12')](_0x5529('0x13'),_0x1ca01+'-'+_0x4edabf+'/'+_0x42c5e7)['json'](_0x3294c6);}return null;};}function saveUpdates(_0x35f3e0){return function(_0x3ba9f4){if(_0x3ba9f4){return _0x3ba9f4['update'](_0x35f3e0)['then'](function(_0x18f44b){return _0x18f44b;});}return null;};}function removeEntity(_0x2044ec){return function(_0xb05c48){if(_0xb05c48){return _0xb05c48[_0x5529('0x14')]()['then'](function(){_0x2044ec[_0x5529('0xb')](0xcc)[_0x5529('0xc')]();});}};}function handleEntityNotFound(_0x46c728){return function(_0x3c9e28){if(!_0x3c9e28){_0x46c728[_0x5529('0xa')](0x194);}return _0x3c9e28;};}function handleError(_0x24c12a,_0x50d48f){_0x50d48f=_0x50d48f||0x1f4;return function(_0x192d06){logger['error'](_0x192d06[_0x5529('0x15')]);if(_0x192d06[_0x5529('0x16')]){delete _0x192d06['name'];}_0x24c12a[_0x5529('0xb')](_0x50d48f)[_0x5529('0x17')](_0x192d06);};}function maskClientSecret(_0x3b1c41){return _[_0x5529('0x18')](_0x3b1c41[_0x5529('0x19')](0x0,0x3),0x14,'*');}exports[_0x5529('0x1a')]=function(_0x130205,_0x16bc01){var _0x235a52={},_0x4c5c21={},_0x3956a3={'count':0x0,'rows':[]};var _0x200a6f=_[_0x5529('0x1b')](db[_0x5529('0x1c')][_0x5529('0x1d')],function(_0x4593f1){return{'name':_0x4593f1['fieldName'],'type':_0x4593f1[_0x5529('0x1e')]['key']};});_0x4c5c21[_0x5529('0x1f')]=_[_0x5529('0x1b')](_0x200a6f,_0x5529('0x16'));_0x4c5c21[_0x5529('0x20')]=_[_0x5529('0x21')](_0x130205[_0x5529('0x20')]);_0x4c5c21[_0x5529('0x22')]=_[_0x5529('0x23')](_0x4c5c21[_0x5529('0x1f')],_0x4c5c21[_0x5529('0x20')]);_0x235a52[_0x5529('0x24')]=_[_0x5529('0x23')](_0x4c5c21[_0x5529('0x1f')],qs[_0x5529('0x25')](_0x130205[_0x5529('0x20')]['fields']));_0x235a52[_0x5529('0x24')]=_0x235a52[_0x5529('0x24')][_0x5529('0x26')]?_0x235a52[_0x5529('0x24')]:_0x4c5c21[_0x5529('0x1f')];if(!_0x130205['query'][_0x5529('0x27')](_0x5529('0x28'))){_0x235a52[_0x5529('0x10')]=qs[_0x5529('0x10')](_0x130205[_0x5529('0x20')][_0x5529('0x10')]);_0x235a52[_0x5529('0xe')]=qs[_0x5529('0xe')](_0x130205['query'][_0x5529('0xe')]);}_0x235a52['order']=qs[_0x5529('0x29')](_0x130205[_0x5529('0x20')]['sort']);_0x235a52['where']=qs[_0x5529('0x22')](_['pick'](_0x130205[_0x5529('0x20')],_0x4c5c21[_0x5529('0x22')]),_0x200a6f);if(_0x130205[_0x5529('0x20')][_0x5529('0x2a')]){_0x235a52[_0x5529('0x2b')]=_[_0x5529('0x2c')](_0x235a52[_0x5529('0x2b')],{'$or':_[_0x5529('0x1b')](_0x200a6f,function(_0x13c802){if(_0x13c802[_0x5529('0x1e')]!=='VIRTUAL'){var _0x19503f={};_0x19503f[_0x13c802['name']]={'$like':'%'+_0x130205[_0x5529('0x20')][_0x5529('0x2a')]+'%'};return _0x19503f;}})});}_0x235a52=_[_0x5529('0x2c')]({},_0x235a52,_0x130205['options']);var _0x2376e3={'where':_0x235a52[_0x5529('0x2b')]};return db[_0x5529('0x1c')][_0x5529('0x11')](_0x2376e3)[_0x5529('0x2d')](function(_0x55e069){_0x3956a3[_0x5529('0x11')]=_0x55e069;if(_0x130205[_0x5529('0x20')][_0x5529('0x2e')]){_0x235a52['include']=[{'all':!![]}];}return db['CloudProvider'][_0x5529('0x2f')](_0x235a52);})[_0x5529('0x2d')](function(_0x5da1a2){_0x3956a3[_0x5529('0x30')]=_[_0x5529('0x1b')](_0x5da1a2,function(_0x4135b6){if(_0x4135b6[_0x5529('0x31')]===_0x5529('0x32')){var _0xff9571=encryptor['decryptString'](_0x4135b6['data3']);_0x4135b6[_0x5529('0x33')]=maskClientSecret(_0xff9571);}return _0x4135b6;});return _0x3956a3;})[_0x5529('0x2d')](respondWithFilteredResult(_0x16bc01,_0x235a52))[_0x5529('0x34')](handleError(_0x16bc01,null));};exports['show']=function(_0x31846a,_0x6ad7b0){var _0x5087f6={'raw':!![],'where':{'id':_0x31846a[_0x5529('0x35')]['id']}},_0x218548={};_0x218548[_0x5529('0x1f')]=_['keys'](db[_0x5529('0x1c')][_0x5529('0x1d')]);_0x218548[_0x5529('0x20')]=_[_0x5529('0x21')](_0x31846a[_0x5529('0x20')]);_0x218548[_0x5529('0x22')]=_[_0x5529('0x23')](_0x218548['model'],_0x218548['query']);_0x5087f6[_0x5529('0x24')]=_[_0x5529('0x23')](_0x218548['model'],qs['fields'](_0x31846a['query'][_0x5529('0x25')]));_0x5087f6[_0x5529('0x24')]=_0x5087f6[_0x5529('0x24')][_0x5529('0x26')]?_0x5087f6[_0x5529('0x24')]:_0x218548[_0x5529('0x1f')];if(_0x31846a['query'][_0x5529('0x2e')]){_0x5087f6[_0x5529('0x36')]=[{'all':!![]}];}_0x5087f6=_[_0x5529('0x2c')]({},_0x5087f6,_0x31846a['options']);return db[_0x5529('0x1c')][_0x5529('0x37')](_0x5087f6)[_0x5529('0x2d')](handleEntityNotFound(_0x6ad7b0,null))[_0x5529('0x2d')](function(_0x42ce4c){if(_0x42ce4c[_0x5529('0x31')]==='MicrosoftAzure'){var _0x26526c=encryptor[_0x5529('0x38')](_0x42ce4c[_0x5529('0x33')]);_0x42ce4c[_0x5529('0x33')]=maskClientSecret(_0x26526c);}return _0x42ce4c;})[_0x5529('0x2d')](respondWithResult(_0x6ad7b0,null))[_0x5529('0x34')](handleError(_0x6ad7b0,null));};exports[_0x5529('0x39')]=function(_0x4d94d7,_0xb7d3b0){if(!_0x4d94d7['body']['name'])throw new Error('Name\x20parameter\x20not\x20specified');if(!_0x4d94d7['body'][_0x5529('0x31')])throw new Error(_0x5529('0x3a'));var _0x2b0710=db[_0x5529('0x1c')]['rawAttributes'][_0x5529('0x31')][_0x5529('0x3b')];if(!_0x2b0710[_0x5529('0x3c')](_0x4d94d7['body'][_0x5529('0x31')]))throw new Error(_0x5529('0x3d')+_0x2b0710[_0x5529('0x3e')](',\x20'));if(_0x4d94d7[_0x5529('0x3f')][_0x5529('0x31')]===_0x5529('0x32')&&_0x4d94d7[_0x5529('0x3f')][_0x5529('0x33')]){_0x4d94d7['body'][_0x5529('0x33')]=encryptor['encryptString'](_0x4d94d7[_0x5529('0x3f')][_0x5529('0x33')]);}return db[_0x5529('0x1c')][_0x5529('0x39')](_0x4d94d7[_0x5529('0x3f')],{})[_0x5529('0x2d')](respondWithResult(_0xb7d3b0,0xc9))['catch'](handleError(_0xb7d3b0,null));};exports[_0x5529('0x40')]=function(_0x3d5cb8,_0x5ba8d4){if(_0x3d5cb8['body']['id']){delete _0x3d5cb8[_0x5529('0x3f')]['id'];}return db[_0x5529('0x1c')]['find']({'where':{'id':_0x3d5cb8['params']['id']}})[_0x5529('0x2d')](handleEntityNotFound(_0x5ba8d4,null))[_0x5529('0x2d')](function(_0x1f3b35){if(_0x1f3b35[_0x5529('0x31')]===_0x5529('0x32')&&_0x3d5cb8[_0x5529('0x3f')][_0x5529('0x33')]){_0x3d5cb8['body'][_0x5529('0x33')]=encryptor[_0x5529('0x41')](_0x3d5cb8[_0x5529('0x3f')]['data3']);}return _0x1f3b35;})[_0x5529('0x2d')](saveUpdates(_0x3d5cb8[_0x5529('0x3f')],null))[_0x5529('0x2d')](respondWithResult(_0x5ba8d4,null))[_0x5529('0x34')](handleError(_0x5ba8d4,null));};exports[_0x5529('0x14')]=function(_0x148990,_0x410100){return db['CloudProvider']['find']({'where':{'id':_0x148990[_0x5529('0x35')]['id']}})['then'](handleEntityNotFound(_0x410100,null))[_0x5529('0x2d')](removeEntity(_0x410100,null))['catch'](handleError(_0x410100,null));};exports[_0x5529('0x42')]=function(_0x3053ee,_0x1c8e4e){return db[_0x5529('0x1c')]['findOne']({'where':{'id':_0x3053ee[_0x5529('0x35')]['id']},'raw':!![]})[_0x5529('0x2d')](function(_0x3b3a7b){if(!_0x3b3a7b)return _0x1c8e4e[_0x5529('0xa')](0x194);return{'url':oauth[_0x5529('0x43')](_0x3b3a7b,_0x3053ee[_0x5529('0x44')]['id'])};})[_0x5529('0x2d')](respondWithResult(_0x1c8e4e,null))[_0x5529('0x34')](handleError(_0x1c8e4e,null));};exports[_0x5529('0x45')]=function(_0x59d3d2,_0x3eebab){var _0xc18b11=_0x59d3d2[_0x5529('0x3f')];var _0x187ab1;var _0x535472;if(_0xc18b11[_0x5529('0x46')])throw _0xc18b11;redis[_0x5529('0x47')](_0xc18b11['state'])['then'](function(_0x1d5ef0){if(!_0x1d5ef0)throw new Error(_0x5529('0x48'));_0x187ab1=JSON[_0x5529('0x49')](_0x1d5ef0);var _0x39663e=Buffer[_0x5529('0x4a')](_0xc18b11[_0x5529('0x4b')],_0x5529('0x4c'))['toString'](_0x5529('0x4d'));_0x535472=JSON[_0x5529('0x49')](_0x39663e);if(!oauth[_0x5529('0x4e')](_0xc18b11['id_token'],_0x187ab1[_0x5529('0x4f')]))throw new Error('Unable\x20to\x20validate\x20id_token');redis[_0x5529('0x50')](_0xc18b11['state']);return oauth[_0x5529('0x51')](_0xc18b11[_0x5529('0x52')],_0x187ab1);})[_0x5529('0x2d')](function(_0x22fb40){_0x187ab1['data5']=_0x22fb40['access_token'];_0x187ab1['data6']=_0x22fb40[_0x5529('0x53')];return db[_0x5529('0x1c')][_0x5529('0x40')]({'data5':_0x187ab1['data5'],'data6':_0x187ab1[_0x5529('0x54')]},{'where':{'id':_0x187ab1['id']}});})[_0x5529('0x2d')](function(){oauth[_0x5529('0x55')](_0x187ab1);socket[_0x5529('0x56')](_0x5529('0x57'),{'id':_0x535472['id']});return;})['then'](respondWithStatusCode(_0x3eebab,null))[_0x5529('0x34')](function(_0x4f8529){if(_0x535472){socket[_0x5529('0x56')](_0x5529('0x58'),{'id':_0x535472['id']});}if(!_0x187ab1){logger[_0x5529('0x46')]('Invalid\x20authentication\x20state\x20parameter',_0x4f8529);return _0x3eebab[_0x5529('0xb')](0x1f4)[_0x5529('0x17')](_0x4f8529[_0x5529('0x59')]);}logger[_0x5529('0x46')](_0x5529('0x5a'),_0x187ab1['id'],JSON[_0x5529('0x5b')](_0x4f8529));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 9389a72..0ccb341 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 _0x5316=['define','cloud_providers','util','moment','request-promise','rimraf','../../config/environment','./cloudProvider.attributes'];(function(_0x1762b4,_0x33d836){var _0x29beda=function(_0x31c2fa){while(--_0x31c2fa){_0x1762b4['push'](_0x1762b4['shift']());}};_0x29beda(++_0x33d836);}(_0x5316,0x10a));var _0x6531=function(_0x883d7,_0x28edb8){_0x883d7=_0x883d7-0x0;var _0x1559d6=_0x5316[_0x883d7];return _0x1559d6;};'use strict';var _=require('lodash');var util=require(_0x6531('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x6531('0x1'));var BPromise=require('bluebird');var rp=require(_0x6531('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6531('0x3'));var config=require(_0x6531('0x4'));var attributes=require(_0x6531('0x5'));module['exports']=function(_0x461bac,_0x8ff71e){return _0x461bac[_0x6531('0x6')]('CloudProvider',attributes,{'tableName':_0x6531('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfb7f=['define','CloudProvider','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1a0367,_0x26d5c7){var _0x12fe44=function(_0x294b69){while(--_0x294b69){_0x1a0367['push'](_0x1a0367['shift']());}};_0x12fe44(++_0x26d5c7);}(_0xfb7f,0xd4));var _0xffb7=function(_0x42eeb5,_0x5a1f7c){_0x42eeb5=_0x42eeb5-0x0;var _0xec1629=_0xfb7f[_0x42eeb5];return _0xec1629;};'use strict';var _=require('lodash');var util=require(_0xffb7('0x0'));var logger=require('../../config/logger')(_0xffb7('0x1'));var moment=require(_0xffb7('0x2'));var BPromise=require(_0xffb7('0x3'));var rp=require(_0xffb7('0x4'));var fs=require('fs');var path=require(_0xffb7('0x5'));var rimraf=require(_0xffb7('0x6'));var config=require(_0xffb7('0x7'));var attributes=require('./cloudProvider.attributes');module['exports']=function(_0x3045b3,_0x33b9a0){return _0x3045b3[_0xffb7('0x8')](_0xffb7('0x9'),attributes,{'tableName':'cloud_providers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.oauth.js b/server/api/cloudProvider/cloudProvider.oauth.js index 1ff8254..619761d 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 _0x5562=['data2','code','id_token','from','stringify','toString','randomBytes','data1','response_type','redirect_uri','response_mode','form_post','state','nonce','prompt','login','map','value','oauth2Claims','set','decode','payload','iss','aud','audience','isAfter','unix','exp','then','CloudProvider','refresh_token','data6','decryptString','data3','POST','data5','update','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','data4','intervals','bind','all','catch','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','crypto','jsonwebtoken','moment','request-promise','util','../../config/logger','api','../../config/schedule/cloud-provider','redis','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','profile','email','https://outlook.office.com/SMTP.Send','openid','/token','type','Dynamics365','push','data7','/.default','join','Outlook365','https://outlook.office365.com/IMAP.AccessAsUser.All','replace','{TENANT_ID}'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5562,0x197));var _0x2556=function(_0x3ee1fe,_0x59f2a1){_0x3ee1fe=_0x3ee1fe-0x0;var _0x1ae57a=_0x5562[_0x3ee1fe];return _0x1ae57a;};'use strict';var _=require('lodash');var crypto=require(_0x2556('0x0'));var jwt=require(_0x2556('0x1'));var moment=require(_0x2556('0x2'));var Redis=require('ioredis');var rp=require(_0x2556('0x3'));var util=require(_0x2556('0x4'));var encryptor=require('../../components/encryptor');var config=require('../../config/environment');var logger=require(_0x2556('0x5'))(_0x2556('0x6'));var schedule=require(_0x2556('0x7'));var db=require('../../mysqldb')['db'];config[_0x2556('0x8')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var redis=new Redis(config[_0x2556('0x8')]);var MICROSOFT_AUTH_URL=_0x2556('0x9');var AZURE_AUTH_SCOPES={'Outlook365':['openid',_0x2556('0xa'),_0x2556('0xb'),'offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All',_0x2556('0xc')],'Dynamics365':[_0x2556('0xd'),'offline_access']};var MICROSOFT_AUTH_ENDPOINT='/authorize';var MICROSOFT_TOKEN_ENDPOINT=_0x2556('0xe');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x4408db){var _0x5b5a7=_['map'](AZURE_AUTH_SCOPES[_0x4408db[_0x2556('0xf')]]);if(_0x4408db[_0x2556('0xf')]===_0x2556('0x10'))_0x5b5a7[_0x2556('0x11')](_0x4408db[_0x2556('0x12')]+_0x2556('0x13'));return _0x5b5a7[_0x2556('0x14')]('\x20');}function getAccessTokenScope(_0x1c4af8){if(_0x1c4af8[_0x2556('0xf')]===_0x2556('0x15'))return _0x2556('0x16');if(_0x1c4af8[_0x2556('0xf')]===_0x2556('0x10'))return _0x1c4af8['data7']+'/.default';}function generateMicrosoftAuthorizationUrl(_0x4f94d7,_0x4f197b){var _0x4bd562=MICROSOFT_AUTH_URL[_0x2556('0x17')](_0x2556('0x18'),_0x4f94d7[_0x2556('0x19')]);var _0x24dc9b=[_0x2556('0x1a'),_0x2556('0x1b')];var _0x401025=Buffer[_0x2556('0x1c')](JSON[_0x2556('0x1d')]({'id':_0x4f197b}))[_0x2556('0x1e')]('base64');var _0x4d7454=crypto[_0x2556('0x1f')](0x10)['toString']('hex');var _0xfae957=getAuthorizationScopes(_0x4f94d7);var _0x3c674e=[{'key':'client_id','value':_0x4f94d7[_0x2556('0x20')]},{'key':_0x2556('0x21'),'value':encodeURIComponent(_0x24dc9b[_0x2556('0x14')]('\x20'))},{'key':_0x2556('0x22'),'value':_0x4f94d7['data4']},{'key':_0x2556('0x23'),'value':_0x2556('0x24')},{'key':'scope','value':encodeURIComponent(_0xfae957)},{'key':_0x2556('0x25'),'value':_0x401025},{'key':_0x2556('0x26'),'value':_0x4d7454},{'key':_0x2556('0x27'),'value':_0x2556('0x28')}];var _0x245031=_0x4bd562+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x2556('0x29')](_0x3c674e,function(_0x1a4493){return _0x1a4493['key']+'='+_0x1a4493[_0x2556('0x2a')];})['join']('&');_0x4f94d7[_0x2556('0x2b')]={'issuer':_0x4bd562['replace']('oauth2/',''),'audience':_0x4f94d7[_0x2556('0x20')],'state':_0x401025,'nonce':_0x4d7454};redis[_0x2556('0x2c')](_0x401025,JSON[_0x2556('0x1d')](_0x4f94d7));return _0x245031;}function isValidIdToken(_0x2897e4,_0x501c0a){try{var _0x516642=jwt[_0x2556('0x2d')](_0x2897e4,{'complete':!![]});var _0x48e60f=_0x516642[_0x2556('0x2e')];if(_0x48e60f[_0x2556('0x2f')]!==_0x501c0a['issuer'])return![];if(_0x48e60f[_0x2556('0x30')]!==_0x501c0a[_0x2556('0x31')])return![];if(_0x48e60f['nonce']!==_0x501c0a[_0x2556('0x26')])return![];if(moment()[_0x2556('0x32')](moment[_0x2556('0x33')](_0x48e60f[_0x2556('0x34')])))return![];return!![];}catch(_0x5640b8){throw _0x5640b8;}}function refreshOauth2MicrosoftAccessToken(_0x580a27){return Promise['resolve']()[_0x2556('0x35')](function(){if(_0x580a27['data3'])return _0x580a27;return db[_0x2556('0x36')]['findOne']({'where':{'id':_0x580a27['id']},'raw':!![]});})[_0x2556('0x35')](function(_0xcfb5ca){var _0x289f8e={'grant_type':_0x2556('0x37'),'refresh_token':_0xcfb5ca[_0x2556('0x38')],'scope':getAccessTokenScope(_0xcfb5ca),'redirect_uri':_0xcfb5ca['data4'],'client_id':_0xcfb5ca[_0x2556('0x20')],'client_secret':encryptor[_0x2556('0x39')](_0xcfb5ca[_0x2556('0x3a')])};var _0x3d6fd1={'method':_0x2556('0x3b'),'uri':MICROSOFT_AUTH_URL[_0x2556('0x17')](_0x2556('0x18'),_0xcfb5ca['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x289f8e,'json':!![]};return rp(_0x3d6fd1);})[_0x2556('0x35')](function(_0x54b521){_0x580a27[_0x2556('0x3c')]=_0x54b521['access_token'];_0x580a27[_0x2556('0x38')]=_0x54b521['refresh_token'];return db['CloudProvider'][_0x2556('0x3d')]({'data5':_0x580a27[_0x2556('0x3c')],'data6':_0x580a27[_0x2556('0x38')]},{'where':{'id':_0x580a27['id']}});})[_0x2556('0x35')](function(){return _0x580a27;})['catch'](function(_0x2a8c64){logger[_0x2556('0x3e')](_0x2556('0x3f'),_0x580a27['id'],_0x2a8c64);});}function getOauth2MicrosoftAccessToken(_0x4ddf00,_0x3eb8cf){var _0x2f3fec={'grant_type':_0x2556('0x40'),'code':_0x4ddf00,'scope':getAccessTokenScope(_0x3eb8cf),'redirect_uri':_0x3eb8cf[_0x2556('0x41')],'client_id':_0x3eb8cf[_0x2556('0x20')],'client_secret':encryptor[_0x2556('0x39')](_0x3eb8cf[_0x2556('0x3a')])};var _0x586315={'method':_0x2556('0x3b'),'uri':MICROSOFT_AUTH_URL['replace'](_0x2556('0x18'),_0x3eb8cf[_0x2556('0x19')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x2f3fec,'json':!![]};return rp(_0x586315);}function startRefreshInterval(_0x352da1){var _0x44b2b9=schedule[_0x2556('0x42')];if(_0x44b2b9[_0x352da1['id']])clearInterval(_0x44b2b9[_0x352da1['id']]);_0x44b2b9[_0x352da1['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x2556('0x43')](this,{'id':_0x352da1['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x2556('0x42')]=_0x44b2b9;}function startAllRefreshIntervals(){return db[_0x2556('0x36')]['findAll']({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x2556('0x35')](function(_0x3f5d36){var _0x53eba3=_0x3f5d36[_0x2556('0x29')](function(_0xfaa585){return refreshOauth2MicrosoftAccessToken(_0xfaa585)['then'](function(_0xc7345d){startRefreshInterval(_0xc7345d);});});return Promise[_0x2556('0x44')](_0x53eba3);})[_0x2556('0x45')](function(_0x46c222){var _0x3de84e=_0x46c222?util['inspect'](_0x46c222,{'showHidden':![],'depth':null}):'';logger[_0x2556('0x3e')](_0x2556('0x46'),_0x3de84e);});}module[_0x2556('0x47')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0x292b=['[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','lodash','crypto','moment','ioredis','request-promise','../../config/environment','../../config/logger','api','../../config/schedule/cloud-provider','../../mysqldb','redis','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/authorize','/token','map','type','Dynamics365','push','data7','/.default','Outlook365','replace','{TENANT_ID}','data2','id_token','from','base64','toString','hex','client_id','response_type','join','redirect_uri','data4','form_post','scope','state','nonce','prompt','login','key','oauth2Claims','oauth2/','data1','set','stringify','decode','payload','aud','audience','isAfter','exp','resolve','then','data3','CloudProvider','findOne','refresh_token','data6','data5','access_token','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','decryptString','POST','intervals','bind','findAll','all','inspect'];(function(_0x2dd62d,_0x128ccd){var _0x18e1a5=function(_0x3de31){while(--_0x3de31){_0x2dd62d['push'](_0x2dd62d['shift']());}};_0x18e1a5(++_0x128ccd);}(_0x292b,0x13d));var _0xb292=function(_0x290694,_0x281935){_0x290694=_0x290694-0x0;var _0x5a0f2e=_0x292b[_0x290694];return _0x5a0f2e;};'use strict';var _=require(_0xb292('0x0'));var crypto=require(_0xb292('0x1'));var jwt=require('jsonwebtoken');var moment=require(_0xb292('0x2'));var Redis=require(_0xb292('0x3'));var rp=require(_0xb292('0x4'));var util=require('util');var encryptor=require('../../components/encryptor');var config=require(_0xb292('0x5'));var logger=require(_0xb292('0x6'))(_0xb292('0x7'));var schedule=require(_0xb292('0x8'));var db=require(_0xb292('0x9'))['db'];config[_0xb292('0xa')]=_['defaults'](config[_0xb292('0xa')],{'host':_0xb292('0xb'),'port':0x18eb});var redis=new Redis(config[_0xb292('0xa')]);var MICROSOFT_AUTH_URL=_0xb292('0xc');var AZURE_AUTH_SCOPES={'Outlook365':[_0xb292('0xd'),_0xb292('0xe'),_0xb292('0xf'),_0xb292('0x10'),_0xb292('0x11'),'https://outlook.office.com/POP.AccessAsUser.All',_0xb292('0x12')],'Dynamics365':[_0xb292('0xd'),_0xb292('0x10')]};var MICROSOFT_AUTH_ENDPOINT=_0xb292('0x13');var MICROSOFT_TOKEN_ENDPOINT=_0xb292('0x14');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x42a016){var _0x5b4674=_[_0xb292('0x15')](AZURE_AUTH_SCOPES[_0x42a016[_0xb292('0x16')]]);if(_0x42a016['type']===_0xb292('0x17'))_0x5b4674[_0xb292('0x18')](_0x42a016[_0xb292('0x19')]+_0xb292('0x1a'));return _0x5b4674['join']('\x20');}function getAccessTokenScope(_0x1e2628){if(_0x1e2628[_0xb292('0x16')]===_0xb292('0x1b'))return'https://outlook.office365.com/IMAP.AccessAsUser.All';if(_0x1e2628[_0xb292('0x16')]===_0xb292('0x17'))return _0x1e2628['data7']+_0xb292('0x1a');}function generateMicrosoftAuthorizationUrl(_0x6e507d,_0x45f8b3){var _0x1e8aef=MICROSOFT_AUTH_URL[_0xb292('0x1c')](_0xb292('0x1d'),_0x6e507d[_0xb292('0x1e')]);var _0x45b6d9=['code',_0xb292('0x1f')];var _0x48edf0=Buffer[_0xb292('0x20')](JSON['stringify']({'id':_0x45f8b3}))['toString'](_0xb292('0x21'));var _0x4b541e=crypto['randomBytes'](0x10)[_0xb292('0x22')](_0xb292('0x23'));var _0xf709d7=getAuthorizationScopes(_0x6e507d);var _0x3907b4=[{'key':_0xb292('0x24'),'value':_0x6e507d['data1']},{'key':_0xb292('0x25'),'value':encodeURIComponent(_0x45b6d9[_0xb292('0x26')]('\x20'))},{'key':_0xb292('0x27'),'value':_0x6e507d[_0xb292('0x28')]},{'key':'response_mode','value':_0xb292('0x29')},{'key':_0xb292('0x2a'),'value':encodeURIComponent(_0xf709d7)},{'key':_0xb292('0x2b'),'value':_0x48edf0},{'key':_0xb292('0x2c'),'value':_0x4b541e},{'key':_0xb292('0x2d'),'value':_0xb292('0x2e')}];var _0x2a706e=_0x1e8aef+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0xb292('0x15')](_0x3907b4,function(_0x2c96cc){return _0x2c96cc[_0xb292('0x2f')]+'='+_0x2c96cc['value'];})[_0xb292('0x26')]('&');_0x6e507d[_0xb292('0x30')]={'issuer':_0x1e8aef[_0xb292('0x1c')](_0xb292('0x31'),''),'audience':_0x6e507d[_0xb292('0x32')],'state':_0x48edf0,'nonce':_0x4b541e};redis[_0xb292('0x33')](_0x48edf0,JSON[_0xb292('0x34')](_0x6e507d));return _0x2a706e;}function isValidIdToken(_0x4c73bb,_0x3c4857){try{var _0x5c9d92=jwt[_0xb292('0x35')](_0x4c73bb,{'complete':!![]});var _0x1e747d=_0x5c9d92[_0xb292('0x36')];if(_0x1e747d['iss']!==_0x3c4857['issuer'])return![];if(_0x1e747d[_0xb292('0x37')]!==_0x3c4857[_0xb292('0x38')])return![];if(_0x1e747d[_0xb292('0x2c')]!==_0x3c4857[_0xb292('0x2c')])return![];if(moment()[_0xb292('0x39')](moment['unix'](_0x1e747d[_0xb292('0x3a')])))return![];return!![];}catch(_0x4b4e60){throw _0x4b4e60;}}function refreshOauth2MicrosoftAccessToken(_0x228bea){return Promise[_0xb292('0x3b')]()[_0xb292('0x3c')](function(){if(_0x228bea[_0xb292('0x3d')])return _0x228bea;return db[_0xb292('0x3e')][_0xb292('0x3f')]({'where':{'id':_0x228bea['id']},'raw':!![]});})['then'](function(_0x2e22d9){var _0x57c688={'grant_type':_0xb292('0x40'),'refresh_token':_0x2e22d9[_0xb292('0x41')],'scope':getAccessTokenScope(_0x2e22d9),'redirect_uri':_0x2e22d9['data4'],'client_id':_0x2e22d9[_0xb292('0x32')],'client_secret':encryptor['decryptString'](_0x2e22d9[_0xb292('0x3d')])};var _0x2a2ab8={'method':'POST','uri':MICROSOFT_AUTH_URL[_0xb292('0x1c')](_0xb292('0x1d'),_0x2e22d9['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x57c688,'json':!![]};return rp(_0x2a2ab8);})[_0xb292('0x3c')](function(_0x520086){_0x228bea[_0xb292('0x42')]=_0x520086[_0xb292('0x43')];_0x228bea[_0xb292('0x41')]=_0x520086['refresh_token'];return db[_0xb292('0x3e')]['update']({'data5':_0x228bea[_0xb292('0x42')],'data6':_0x228bea[_0xb292('0x41')]},{'where':{'id':_0x228bea['id']}});})[_0xb292('0x3c')](function(){return _0x228bea;})[_0xb292('0x44')](function(_0x238159){logger[_0xb292('0x45')](_0xb292('0x46'),_0x228bea['id'],_0x238159);});}function getOauth2MicrosoftAccessToken(_0x17d9e9,_0x24f4d9){var _0x45ed14={'grant_type':'authorization_code','code':_0x17d9e9,'scope':getAccessTokenScope(_0x24f4d9),'redirect_uri':_0x24f4d9[_0xb292('0x28')],'client_id':_0x24f4d9[_0xb292('0x32')],'client_secret':encryptor[_0xb292('0x47')](_0x24f4d9[_0xb292('0x3d')])};var _0x106a9b={'method':_0xb292('0x48'),'uri':MICROSOFT_AUTH_URL[_0xb292('0x1c')]('{TENANT_ID}',_0x24f4d9[_0xb292('0x1e')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x45ed14,'json':!![]};return rp(_0x106a9b);}function startRefreshInterval(_0x3ff2f8){var _0x1c4cc7=schedule[_0xb292('0x49')];if(_0x1c4cc7[_0x3ff2f8['id']])clearInterval(_0x1c4cc7[_0x3ff2f8['id']]);_0x1c4cc7[_0x3ff2f8['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0xb292('0x4a')](this,{'id':_0x3ff2f8['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0xb292('0x49')]=_0x1c4cc7;}function startAllRefreshIntervals(){return db[_0xb292('0x3e')][_0xb292('0x4b')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0xb292('0x3c')](function(_0x1aec05){var _0x54de48=_0x1aec05['map'](function(_0x378e6f){return refreshOauth2MicrosoftAccessToken(_0x378e6f)[_0xb292('0x3c')](function(_0x589a82){startRefreshInterval(_0x589a82);});});return Promise[_0xb292('0x4c')](_0x54de48);})[_0xb292('0x44')](function(_0x4a0747){var _0x2ad683=_0x4a0747?util[_0xb292('0x4d')](_0x4a0747,{'showHidden':![],'depth':null}):'';logger[_0xb292('0x45')](_0xb292('0x4e'),_0x2ad683);});}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 383a456..30fe82c 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 _0xa6ea=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','CloudProvider,\x20%s,\x20%s','CloudProvider,\x20%s,\x20%s,\x20%s','error','message','info','request\x20sent','catch','lodash','util','moment','bluebird'];(function(_0x2f0c19,_0xe0aeca){var _0x3b3f4b=function(_0x1ad4bf){while(--_0x1ad4bf){_0x2f0c19['push'](_0x2f0c19['shift']());}};_0x3b3f4b(++_0xe0aeca);}(_0xa6ea,0x122));var _0xaa6e=function(_0x545c6b,_0x4f53de){_0x545c6b=_0x545c6b-0x0;var _0x38195e=_0xa6ea[_0x545c6b];return _0x38195e;};'use strict';var _=require(_0xaa6e('0x0'));var util=require(_0xaa6e('0x1'));var moment=require(_0xaa6e('0x2'));var BPromise=require(_0xaa6e('0x3'));var rs=require(_0xaa6e('0x4'));var fs=require('fs');var Redis=require(_0xaa6e('0x5'));var db=require(_0xaa6e('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xaa6e('0x7'))(_0xaa6e('0x8'));var config=require(_0xaa6e('0x9'));var jayson=require(_0xaa6e('0xa'));var client=jayson[_0xaa6e('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x543fc1,_0x582240,_0x1e3706){return new BPromise(function(_0x22d3e4,_0x2c9dcd){return client[_0xaa6e('0xc')](_0x543fc1,_0x1e3706)[_0xaa6e('0xd')](function(_0x139806){logger['info'](_0xaa6e('0xe'),_0x582240,'request\x20sent');logger['debug'](_0xaa6e('0xf'),_0x582240,'request\x20sent',JSON['stringify'](_0x139806));if(_0x139806[_0xaa6e('0x10')]){if(_0x139806[_0xaa6e('0x10')]['code']===0x1f4){logger[_0xaa6e('0x10')]('CloudProvider,\x20%s,\x20%s',_0x582240,_0x139806[_0xaa6e('0x10')][_0xaa6e('0x11')]);return _0x2c9dcd(_0x139806[_0xaa6e('0x10')][_0xaa6e('0x11')]);}logger[_0xaa6e('0x10')](_0xaa6e('0xe'),_0x582240,_0x139806[_0xaa6e('0x10')][_0xaa6e('0x11')]);return _0x22d3e4(_0x139806[_0xaa6e('0x10')]['message']);}else{logger[_0xaa6e('0x12')](_0xaa6e('0xe'),_0x582240,_0xaa6e('0x13'));_0x22d3e4(_0x139806['result'][_0xaa6e('0x11')]);}})[_0xaa6e('0x14')](function(_0x475b7d){logger[_0xaa6e('0x10')]('CloudProvider,\x20%s,\x20%s',_0x582240,_0x475b7d);_0x2c9dcd(_0x475b7d);});});} \ No newline at end of file +var _0x02a7=['CloudProvider,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','info','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x02a7,0x1a6));var _0x702a=function(_0x57b104,_0x4e5a5){_0x57b104=_0x57b104-0x0;var _0x3f19ac=_0x02a7[_0x57b104];return _0x3f19ac;};'use strict';var _=require('lodash');var util=require(_0x702a('0x0'));var moment=require(_0x702a('0x1'));var BPromise=require(_0x702a('0x2'));var rs=require(_0x702a('0x3'));var fs=require('fs');var Redis=require(_0x702a('0x4'));var db=require(_0x702a('0x5'))['db'];var utils=require(_0x702a('0x6'));var logger=require(_0x702a('0x7'))(_0x702a('0x8'));var config=require(_0x702a('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x702a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b6736,_0x27bfc7,_0x3f5ff8){return new BPromise(function(_0x51bf52,_0x562fdb){return client['request'](_0x4b6736,_0x3f5ff8)['then'](function(_0x3cb569){logger[_0x702a('0xb')]('CloudProvider,\x20%s,\x20%s',_0x27bfc7,_0x702a('0xc'));logger[_0x702a('0xd')](_0x702a('0xe'),_0x27bfc7,_0x702a('0xc'),JSON[_0x702a('0xf')](_0x3cb569));if(_0x3cb569[_0x702a('0x10')]){if(_0x3cb569[_0x702a('0x10')][_0x702a('0x11')]===0x1f4){logger['error'](_0x702a('0x12'),_0x27bfc7,_0x3cb569[_0x702a('0x10')][_0x702a('0x13')]);return _0x562fdb(_0x3cb569[_0x702a('0x10')]['message']);}logger[_0x702a('0x10')](_0x702a('0x12'),_0x27bfc7,_0x3cb569[_0x702a('0x10')][_0x702a('0x13')]);return _0x51bf52(_0x3cb569[_0x702a('0x10')]['message']);}else{logger[_0x702a('0xb')](_0x702a('0x12'),_0x27bfc7,_0x702a('0xc'));_0x51bf52(_0x3cb569[_0x702a('0x14')][_0x702a('0x13')]);}})[_0x702a('0x15')](function(_0x451881){logger['error']('CloudProvider,\x20%s,\x20%s',_0x27bfc7,_0x451881);_0x562fdb(_0x451881);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 6080ed6..46b6ad9 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 _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(_0x5655fb,_0x4991cb){var _0x554cd6=function(_0x3cb616){while(--_0x3cb616){_0x5655fb['push'](_0x5655fb['shift']());}};_0x554cd6(++_0x4991cb);}(_0x2ef3,0xba));var _0x32ef=function(_0x2238ea,_0x40d952){_0x2238ea=_0x2238ea-0x0;var _0x1369f1=_0x2ef3[_0x2238ea];return _0x1369f1;};'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 +var _0x1261=['/:id','show','create','put','update','delete','/:id/oauth2/microsoft/authorize/','post','exports','Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','index'];(function(_0x529abc,_0x17b97e){var _0x453afa=function(_0x536263){while(--_0x536263){_0x529abc['push'](_0x529abc['shift']());}};_0x453afa(++_0x17b97e);}(_0x1261,0x144));var _0x1126=function(_0x5428f5,_0x363285){_0x5428f5=_0x5428f5-0x0;var _0xf745ce=_0x1261[_0x5428f5];return _0xf745ce;};'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 diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 8c0c79a..28e5213 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 _0xce35=['STRING','name','exports'];(function(_0x5d0798,_0x14cd0e){var _0x5de46=function(_0xf5dc68){while(--_0xf5dc68){_0x5d0798['push'](_0x5d0798['shift']());}};_0x5de46(++_0x14cd0e);}(_0xce35,0xbf));var _0x5ce3=function(_0x3012ec,_0x3d8afe){_0x3012ec=_0x3012ec-0x0;var _0x436947=_0xce35[_0x3012ec];return _0x436947;};'use strict';var Sequelize=require('sequelize');module[_0x5ce3('0x0')]={'name':{'type':Sequelize[_0x5ce3('0x1')],'unique':_0x5ce3('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize[_0x5ce3('0x1')]},'website':{'type':Sequelize[_0x5ce3('0x1')]},'phone':{'type':Sequelize[_0x5ce3('0x1')]},'fax':{'type':Sequelize[_0x5ce3('0x1')]},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0x5ce3('0x1')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x5ce3('0x1')]},'country':{'type':Sequelize[_0x5ce3('0x1')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x5ce3('0x1')]},'sStreet':{'type':Sequelize[_0x5ce3('0x1')]},'sPostalCode':{'type':Sequelize[_0x5ce3('0x1')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0x5ce3('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x61ca=['sequelize','exports','STRING','name'];(function(_0x2fdf82,_0x322e7c){var _0x2382f5=function(_0x4d6951){while(--_0x4d6951){_0x2fdf82['push'](_0x2fdf82['shift']());}};_0x2382f5(++_0x322e7c);}(_0x61ca,0x1b0));var _0xa61c=function(_0x1d8679,_0x32a98f){_0x1d8679=_0x1d8679-0x0;var _0x427125=_0x61ca[_0x1d8679];return _0x427125;};'use strict';var Sequelize=require(_0xa61c('0x0'));module[_0xa61c('0x1')]={'name':{'type':Sequelize[_0xa61c('0x2')],'unique':_0xa61c('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize[_0xa61c('0x2')]},'website':{'type':Sequelize[_0xa61c('0x2')]},'phone':{'type':Sequelize[_0xa61c('0x2')]},'fax':{'type':Sequelize[_0xa61c('0x2')]},'type':{'type':Sequelize[_0xa61c('0x2')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0xa61c('0x2')]},'city':{'type':Sequelize[_0xa61c('0x2')]},'country':{'type':Sequelize[_0xa61c('0x2')]},'email':{'type':Sequelize[_0xa61c('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xa61c('0x2')]},'sStreet':{'type':Sequelize[_0xa61c('0x2')]},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0xa61c('0x2')]},'description':{'type':Sequelize[_0xa61c('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 5039ac8..38a81fa 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 _0xc6f7=['CmContact','ids','omit','findOne','getContacts','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','count','set','Content-Range','json','reject','save','update','then','destroy','get','Companies','UserProfileResource','error','stack','name','send','index','CmCompany','describe','model','keys','query','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','filter','where','merge','map','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addContacts'];(function(_0x220b08,_0x515a10){var _0x2a7a82=function(_0x346265){while(--_0x346265){_0x220b08['push'](_0x220b08['shift']());}};_0x2a7a82(++_0x515a10);}(_0xc6f7,0xbf));var _0x7c6f=function(_0x266bfa,_0x2ff541){_0x266bfa=_0x266bfa-0x0;var _0x3bb897=_0xc6f7[_0x266bfa];return _0x3bb897;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7c6f('0x0'));var zipdir=require(_0x7c6f('0x1'));var jsonpatch=require(_0x7c6f('0x2'));var rp=require(_0x7c6f('0x3'));var moment=require(_0x7c6f('0x4'));var BPromise=require(_0x7c6f('0x5'));var Mustache=require(_0x7c6f('0x6'));var util=require(_0x7c6f('0x7'));var path=require(_0x7c6f('0x8'));var sox=require(_0x7c6f('0x9'));var csv=require(_0x7c6f('0xa'));var ejs=require(_0x7c6f('0xb'));var fs=require('fs');var fs_extra=require(_0x7c6f('0xc'));var _=require(_0x7c6f('0xd'));var squel=require(_0x7c6f('0xe'));var crypto=require(_0x7c6f('0xf'));var jsforce=require(_0x7c6f('0x10'));var deskjs=require(_0x7c6f('0x11'));var toCsv=require(_0x7c6f('0xa'));var querystring=require(_0x7c6f('0x12'));var Papa=require(_0x7c6f('0x13'));var Redis=require(_0x7c6f('0x14'));var authService=require(_0x7c6f('0x15'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7c6f('0x16'));var logger=require(_0x7c6f('0x17'))(_0x7c6f('0x18'));var utils=require(_0x7c6f('0x19'));var config=require(_0x7c6f('0x1a'));var licenseUtil=require(_0x7c6f('0x1b'));var db=require(_0x7c6f('0x1c'))['db'];function respondWithStatusCode(_0x26a145,_0x469301){_0x469301=_0x469301||0xcc;return function(_0x302941){if(_0x302941){return _0x26a145[_0x7c6f('0x1d')](_0x469301);}return _0x26a145[_0x7c6f('0x1e')](_0x469301)[_0x7c6f('0x1f')]();};}function respondWithResult(_0x2f725a,_0x2e5388){_0x2e5388=_0x2e5388||0xc8;return function(_0x794a45){if(_0x794a45){return _0x2f725a['status'](_0x2e5388)['json'](_0x794a45);}};}function respondWithFilteredResult(_0x43ffa8,_0x978e1f){return function(_0x30e951){if(_0x30e951){var _0x5c2718=typeof _0x978e1f[_0x7c6f('0x20')]==='undefined'&&typeof _0x978e1f[_0x7c6f('0x21')]==='undefined';var _0x468d2b=_0x30e951[_0x7c6f('0x22')];var _0x568e95=_0x5c2718?0x0:_0x978e1f[_0x7c6f('0x20')];var _0x548ddf=_0x5c2718?_0x30e951[_0x7c6f('0x22')]:_0x978e1f['offset']+_0x978e1f[_0x7c6f('0x21')];var _0x2b2cc4;if(_0x548ddf>=_0x468d2b){_0x548ddf=_0x468d2b;_0x2b2cc4=0xc8;}else{_0x2b2cc4=0xce;}_0x43ffa8[_0x7c6f('0x1e')](_0x2b2cc4);return _0x43ffa8[_0x7c6f('0x23')](_0x7c6f('0x24'),_0x568e95+'-'+_0x548ddf+'/'+_0x468d2b)[_0x7c6f('0x25')](_0x30e951);}return null;};}function patchUpdates(_0x24aefb){return function(_0xce7654){try{jsonpatch['apply'](_0xce7654,_0x24aefb,!![]);}catch(_0x38cba5){return BPromise[_0x7c6f('0x26')](_0x38cba5);}return _0xce7654[_0x7c6f('0x27')]();};}function saveUpdates(_0x1ca100,_0x2d0e20){return function(_0x69fb96){if(_0x69fb96){return _0x69fb96[_0x7c6f('0x28')](_0x1ca100)[_0x7c6f('0x29')](function(_0x5cd6c7){return _0x5cd6c7;});}return null;};}function removeEntity(_0x2ddcee,_0x347f1a){return function(_0x594248){if(_0x594248){return _0x594248[_0x7c6f('0x2a')]()['then'](function(){var _0xfc5b2a=_0x594248[_0x7c6f('0x2b')]({'plain':!![]});var _0x5bc3bd=_0x7c6f('0x2c');return db[_0x7c6f('0x2d')]['destroy']({'where':{'type':_0x5bc3bd,'resourceId':_0xfc5b2a['id']}})[_0x7c6f('0x29')](function(){return _0x594248;});})[_0x7c6f('0x29')](function(){_0x2ddcee['status'](0xcc)[_0x7c6f('0x1f')]();});}};}function handleEntityNotFound(_0x3fabc4,_0x121b80){return function(_0x138560){if(!_0x138560){_0x3fabc4['sendStatus'](0x194);}return _0x138560;};}function handleError(_0x14940a,_0xe6c37e){_0xe6c37e=_0xe6c37e||0x1f4;return function(_0x13c764){logger[_0x7c6f('0x2e')](_0x13c764[_0x7c6f('0x2f')]);if(_0x13c764[_0x7c6f('0x30')]){delete _0x13c764[_0x7c6f('0x30')];}_0x14940a['status'](_0xe6c37e)[_0x7c6f('0x31')](_0x13c764);};}exports[_0x7c6f('0x32')]=function(_0x139469,_0x124a4b){var _0x3c3efb={},_0x100bd2={},_0x220d26={'count':0x0,'rows':[]};return db[_0x7c6f('0x33')][_0x7c6f('0x34')]()[_0x7c6f('0x29')](function(_0x35f20e){_0x100bd2[_0x7c6f('0x35')]=_[_0x7c6f('0x36')](_0x35f20e);_0x100bd2['query']=_[_0x7c6f('0x36')](_0x139469[_0x7c6f('0x37')]);_0x100bd2[_0x7c6f('0x38')]=_[_0x7c6f('0x39')](_0x100bd2['model'],_0x100bd2['query']);_0x3c3efb['attributes']=_[_0x7c6f('0x39')](_0x100bd2[_0x7c6f('0x35')],qs['fields'](_0x139469[_0x7c6f('0x37')][_0x7c6f('0x3a')]));_0x3c3efb[_0x7c6f('0x3b')]=_0x3c3efb[_0x7c6f('0x3b')][_0x7c6f('0x3c')]?_0x3c3efb[_0x7c6f('0x3b')]:_0x100bd2['model'];if(!_0x139469[_0x7c6f('0x37')]['hasOwnProperty'](_0x7c6f('0x3d'))){_0x3c3efb[_0x7c6f('0x21')]=qs[_0x7c6f('0x21')](_0x139469['query'][_0x7c6f('0x21')]);_0x3c3efb[_0x7c6f('0x20')]=qs[_0x7c6f('0x20')](_0x139469[_0x7c6f('0x37')][_0x7c6f('0x20')]);}_0x3c3efb[_0x7c6f('0x3e')]=qs[_0x7c6f('0x3f')](_0x139469[_0x7c6f('0x37')][_0x7c6f('0x3f')]);_0x3c3efb['where']=qs[_0x7c6f('0x38')](_[_0x7c6f('0x40')](_0x139469['query'],_0x100bd2[_0x7c6f('0x38')]),_0x35f20e);if(_0x139469[_0x7c6f('0x37')][_0x7c6f('0x41')]){_0x3c3efb[_0x7c6f('0x42')]=_[_0x7c6f('0x43')](_0x3c3efb['where'],{'$or':_[_0x7c6f('0x44')](_0x3c3efb['attributes'],function(_0x128e13){var _0x59c79b={};_0x59c79b[_0x128e13]={'$like':'%'+_0x139469[_0x7c6f('0x37')]['filter']+'%'};return _0x59c79b;})});}_0x3c3efb=_['merge']({},_0x3c3efb,_0x139469[_0x7c6f('0x45')]);var _0x367f8e={'where':_0x3c3efb[_0x7c6f('0x42')]};return db[_0x7c6f('0x33')][_0x7c6f('0x22')](_0x367f8e)['then'](function(_0x38a1e8){_0x220d26[_0x7c6f('0x22')]=_0x38a1e8;if(_0x139469['query']['includeAll']){_0x3c3efb[_0x7c6f('0x46')]=[{'all':!![]}];}return db[_0x7c6f('0x33')][_0x7c6f('0x47')](_0x3c3efb);})['then'](function(_0x4d5cdc){_0x220d26[_0x7c6f('0x48')]=_0x4d5cdc;return _0x220d26;})[_0x7c6f('0x29')](respondWithFilteredResult(_0x124a4b,_0x3c3efb))[_0x7c6f('0x49')](handleError(_0x124a4b,null));})[_0x7c6f('0x49')](handleError(_0x124a4b,null));};exports[_0x7c6f('0x4a')]=function(_0x54fc3c,_0x2f6999){var _0x2d8f43={'raw':![],'where':{'id':_0x54fc3c[_0x7c6f('0x4b')]['id']}},_0x2d2c0d={};_0x2d2c0d[_0x7c6f('0x35')]=_[_0x7c6f('0x36')](db[_0x7c6f('0x33')]['rawAttributes']);_0x2d2c0d[_0x7c6f('0x37')]=_[_0x7c6f('0x36')](_0x54fc3c[_0x7c6f('0x37')]);_0x2d2c0d['filters']=_['intersection'](_0x2d2c0d[_0x7c6f('0x35')],_0x2d2c0d[_0x7c6f('0x37')]);_0x2d8f43[_0x7c6f('0x3b')]=_['intersection'](_0x2d2c0d[_0x7c6f('0x35')],qs['fields'](_0x54fc3c[_0x7c6f('0x37')][_0x7c6f('0x3a')]));_0x2d8f43[_0x7c6f('0x3b')]=_0x2d8f43[_0x7c6f('0x3b')][_0x7c6f('0x3c')]?_0x2d8f43[_0x7c6f('0x3b')]:_0x2d2c0d['model'];if(_0x54fc3c[_0x7c6f('0x37')][_0x7c6f('0x4c')]){_0x2d8f43[_0x7c6f('0x46')]=[{'all':!![]}];}_0x2d8f43=_[_0x7c6f('0x43')]({},_0x2d8f43,_0x54fc3c[_0x7c6f('0x45')]);return db['CmCompany'][_0x7c6f('0x4d')](_0x2d8f43)[_0x7c6f('0x29')](handleEntityNotFound(_0x2f6999,null))['then'](respondWithResult(_0x2f6999,null))[_0x7c6f('0x49')](handleError(_0x2f6999,null));};exports[_0x7c6f('0x4e')]=function(_0x168baf,_0x5ca061){return db[_0x7c6f('0x33')][_0x7c6f('0x4e')](_0x168baf[_0x7c6f('0x4f')],{})[_0x7c6f('0x29')](function(_0x3b02ab){var _0x179292=_0x168baf[_0x7c6f('0x50')][_0x7c6f('0x2b')]({'plain':!![]});if(!_0x179292)throw new Error(_0x7c6f('0x51'));if(_0x179292[_0x7c6f('0x52')]===_0x7c6f('0x50')){var _0x50d968=_0x3b02ab[_0x7c6f('0x2b')]({'plain':!![]});var _0x4ebc34=_0x7c6f('0x2c');return db[_0x7c6f('0x53')][_0x7c6f('0x4d')]({'where':{'name':_0x4ebc34,'userProfileId':_0x179292[_0x7c6f('0x54')]},'raw':!![]})['then'](function(_0x2b0110){if(_0x2b0110&&_0x2b0110[_0x7c6f('0x55')]===0x0){return db['UserProfileResource'][_0x7c6f('0x4e')]({'name':_0x50d968[_0x7c6f('0x30')],'resourceId':_0x50d968['id'],'type':_0x2b0110['name'],'sectionId':_0x2b0110['id']},{})['then'](function(){return _0x3b02ab;});}else{return _0x3b02ab;}})['catch'](function(_0x583c5a){logger[_0x7c6f('0x2e')](_0x7c6f('0x56'),_0x583c5a);throw _0x583c5a;});}return _0x3b02ab;})[_0x7c6f('0x29')](respondWithResult(_0x5ca061,0xc9))['catch'](handleError(_0x5ca061,null));};exports[_0x7c6f('0x28')]=function(_0x1dd6cd,_0x4f5711){if(_0x1dd6cd[_0x7c6f('0x4f')]['id']){delete _0x1dd6cd[_0x7c6f('0x4f')]['id'];}return db[_0x7c6f('0x33')][_0x7c6f('0x4d')]({'where':{'id':_0x1dd6cd[_0x7c6f('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4f5711,null))['then'](saveUpdates(_0x1dd6cd[_0x7c6f('0x4f')],null))['then'](respondWithResult(_0x4f5711,null))['catch'](handleError(_0x4f5711,null));};exports['destroy']=function(_0x61c140,_0xe5a874){return db['CmCompany'][_0x7c6f('0x4d')]({'where':{'id':_0x61c140['params']['id']}})['then'](handleEntityNotFound(_0xe5a874,null))[_0x7c6f('0x29')](removeEntity(_0xe5a874,null))[_0x7c6f('0x49')](handleError(_0xe5a874,null));};exports[_0x7c6f('0x34')]=function(_0x38a9c3,_0x41fb5d){return db['CmCompany'][_0x7c6f('0x34')]()[_0x7c6f('0x29')](respondWithResult(_0x41fb5d,null))[_0x7c6f('0x49')](handleError(_0x41fb5d,null));};exports[_0x7c6f('0x57')]=function(_0x17aeca,_0x593481,_0x11a1ed){return db[_0x7c6f('0x58')][_0x7c6f('0x4d')]({'where':{'id':_0x17aeca['params']['id']}})[_0x7c6f('0x29')](handleEntityNotFound(_0x593481,null))['then'](function(_0x293d0f){if(_0x293d0f){return _0x293d0f[_0x7c6f('0x57')](_0x17aeca['body'][_0x7c6f('0x59')],_[_0x7c6f('0x5a')](_0x17aeca[_0x7c6f('0x4f')],['ids','id'])||{});}})[_0x7c6f('0x29')](respondWithResult(_0x593481,null))[_0x7c6f('0x49')](handleError(_0x593481,null));};exports['getContacts']=function(_0x418cd6,_0x228466,_0x2b9e6c){var _0x51aa07={};var _0x33eecd={};var _0x2dce55;var _0xa4f3dc;return db[_0x7c6f('0x33')][_0x7c6f('0x5b')]({'where':{'id':_0x418cd6[_0x7c6f('0x4b')]['id']}})['then'](handleEntityNotFound(_0x228466,null))[_0x7c6f('0x29')](function(_0x8dacbe){if(_0x8dacbe){_0x2dce55=_0x8dacbe;_0x33eecd[_0x7c6f('0x35')]=_[_0x7c6f('0x36')](db[_0x7c6f('0x58')]['rawAttributes']);_0x33eecd[_0x7c6f('0x37')]=_[_0x7c6f('0x36')](_0x418cd6[_0x7c6f('0x37')]);_0x33eecd[_0x7c6f('0x38')]=_[_0x7c6f('0x39')](_0x33eecd[_0x7c6f('0x35')],_0x33eecd[_0x7c6f('0x37')]);_0x51aa07[_0x7c6f('0x3b')]=_[_0x7c6f('0x39')](_0x33eecd[_0x7c6f('0x35')],qs[_0x7c6f('0x3a')](_0x418cd6[_0x7c6f('0x37')][_0x7c6f('0x3a')]));_0x51aa07[_0x7c6f('0x3b')]=_0x51aa07[_0x7c6f('0x3b')][_0x7c6f('0x3c')]?_0x51aa07[_0x7c6f('0x3b')]:_0x33eecd[_0x7c6f('0x35')];_0x51aa07['order']=qs[_0x7c6f('0x3f')](_0x418cd6[_0x7c6f('0x37')][_0x7c6f('0x3f')]);_0x51aa07[_0x7c6f('0x42')]=qs[_0x7c6f('0x38')](_[_0x7c6f('0x40')](_0x418cd6[_0x7c6f('0x37')],_0x33eecd['filters']));if(_0x418cd6['query']['filter']){_0x51aa07[_0x7c6f('0x42')]=_[_0x7c6f('0x43')](_0x51aa07['where'],{'$or':_['map'](_0x51aa07['attributes'],function(_0x33d554){var _0x41ad13={};_0x41ad13[_0x33d554]={'$like':'%'+_0x418cd6[_0x7c6f('0x37')][_0x7c6f('0x41')]+'%'};return _0x41ad13;})});}_0x51aa07=_[_0x7c6f('0x43')]({},_0x51aa07,_0x418cd6[_0x7c6f('0x45')]);return _0x2dce55['getContacts'](_0x51aa07);}})[_0x7c6f('0x29')](function(_0x302cdf){if(_0x302cdf){_0xa4f3dc=_0x302cdf['length'];if(!_0x418cd6[_0x7c6f('0x37')]['hasOwnProperty']('nolimit')){_0x51aa07[_0x7c6f('0x21')]=qs['limit'](_0x418cd6[_0x7c6f('0x37')][_0x7c6f('0x21')]);_0x51aa07[_0x7c6f('0x20')]=qs['offset'](_0x418cd6[_0x7c6f('0x37')]['offset']);}return _0x2dce55[_0x7c6f('0x5c')](_0x51aa07);}})[_0x7c6f('0x29')](function(_0x2063fd){if(_0x2063fd){return _0x2063fd?{'count':_0xa4f3dc,'rows':_0x2063fd}:null;}})[_0x7c6f('0x29')](respondWithResult(_0x228466,null))['catch'](handleError(_0x228466,null));}; \ No newline at end of file +var _0x90c7=['../../mysqldb','json','undefined','limit','count','offset','status','set','Content-Range','reject','save','update','then','destroy','get','Companies','error','stack','name','send','index','describe','model','query','keys','attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter','merge','map','options','CmCompany','includeAll','findAll','rows','catch','params','rawAttributes','intersection','include','find','create','body','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addContacts','ids','omit','findOne','CmContact','pick','getContacts','eml-format','rimraf','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment'];(function(_0x355c9b,_0x53dffe){var _0x1b904e=function(_0x31f744){while(--_0x31f744){_0x355c9b['push'](_0x355c9b['shift']());}};_0x1b904e(++_0x53dffe);}(_0x90c7,0xe5));var _0x790c=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x90c7[_0x501510];return _0x1e6ee5;};'use strict';var emlformat=require(_0x790c('0x0'));var rimraf=require(_0x790c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x790c('0x2'));var rp=require(_0x790c('0x3'));var moment=require(_0x790c('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x790c('0x5'));var path=require(_0x790c('0x6'));var sox=require(_0x790c('0x7'));var csv=require(_0x790c('0x8'));var ejs=require(_0x790c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x790c('0xa'));var squel=require('squel');var crypto=require(_0x790c('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x790c('0xc'));var toCsv=require(_0x790c('0x8'));var querystring=require(_0x790c('0xd'));var Papa=require(_0x790c('0xe'));var Redis=require(_0x790c('0xf'));var authService=require(_0x790c('0x10'));var qs=require(_0x790c('0x11'));var as=require(_0x790c('0x12'));var hardwareService=require(_0x790c('0x13'));var logger=require(_0x790c('0x14'))(_0x790c('0x15'));var utils=require('../../config/utils');var config=require(_0x790c('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x790c('0x17'))['db'];function respondWithStatusCode(_0x4334ba,_0x38135e){_0x38135e=_0x38135e||0xcc;return function(_0x3f6dd3){if(_0x3f6dd3){return _0x4334ba['sendStatus'](_0x38135e);}return _0x4334ba['status'](_0x38135e)['end']();};}function respondWithResult(_0x3d25e1,_0x3833d1){_0x3833d1=_0x3833d1||0xc8;return function(_0xc770f4){if(_0xc770f4){return _0x3d25e1['status'](_0x3833d1)[_0x790c('0x18')](_0xc770f4);}};}function respondWithFilteredResult(_0x2d634d,_0x24830d){return function(_0x3be3c5){if(_0x3be3c5){var _0x2a26e7=typeof _0x24830d['offset']===_0x790c('0x19')&&typeof _0x24830d[_0x790c('0x1a')]===_0x790c('0x19');var _0x22f4eb=_0x3be3c5[_0x790c('0x1b')];var _0x31a4e1=_0x2a26e7?0x0:_0x24830d[_0x790c('0x1c')];var _0xcc0361=_0x2a26e7?_0x3be3c5[_0x790c('0x1b')]:_0x24830d[_0x790c('0x1c')]+_0x24830d[_0x790c('0x1a')];var _0x10628f;if(_0xcc0361>=_0x22f4eb){_0xcc0361=_0x22f4eb;_0x10628f=0xc8;}else{_0x10628f=0xce;}_0x2d634d[_0x790c('0x1d')](_0x10628f);return _0x2d634d[_0x790c('0x1e')](_0x790c('0x1f'),_0x31a4e1+'-'+_0xcc0361+'/'+_0x22f4eb)[_0x790c('0x18')](_0x3be3c5);}return null;};}function patchUpdates(_0x150e9c){return function(_0x45c310){try{jsonpatch['apply'](_0x45c310,_0x150e9c,!![]);}catch(_0x128e24){return BPromise[_0x790c('0x20')](_0x128e24);}return _0x45c310[_0x790c('0x21')]();};}function saveUpdates(_0x5a42a7,_0x2b0c14){return function(_0x17fc75){if(_0x17fc75){return _0x17fc75[_0x790c('0x22')](_0x5a42a7)[_0x790c('0x23')](function(_0x3ba7c9){return _0x3ba7c9;});}return null;};}function removeEntity(_0xe1eef8,_0x47d518){return function(_0x4b500a){if(_0x4b500a){return _0x4b500a[_0x790c('0x24')]()['then'](function(){var _0x10a1e1=_0x4b500a[_0x790c('0x25')]({'plain':!![]});var _0x1d3b84=_0x790c('0x26');return db['UserProfileResource']['destroy']({'where':{'type':_0x1d3b84,'resourceId':_0x10a1e1['id']}})[_0x790c('0x23')](function(){return _0x4b500a;});})[_0x790c('0x23')](function(){_0xe1eef8[_0x790c('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x342bad,_0x29fa3e){return function(_0x4f00e2){if(!_0x4f00e2){_0x342bad['sendStatus'](0x194);}return _0x4f00e2;};}function handleError(_0x1a1693,_0x211aca){_0x211aca=_0x211aca||0x1f4;return function(_0x1ab186){logger[_0x790c('0x27')](_0x1ab186[_0x790c('0x28')]);if(_0x1ab186[_0x790c('0x29')]){delete _0x1ab186['name'];}_0x1a1693[_0x790c('0x1d')](_0x211aca)[_0x790c('0x2a')](_0x1ab186);};}exports[_0x790c('0x2b')]=function(_0x347f79,_0xd860f4){var _0x4608f5={},_0x3713bc={},_0x3a3fbb={'count':0x0,'rows':[]};return db['CmCompany'][_0x790c('0x2c')]()[_0x790c('0x23')](function(_0x562c34){_0x3713bc[_0x790c('0x2d')]=_['keys'](_0x562c34);_0x3713bc[_0x790c('0x2e')]=_[_0x790c('0x2f')](_0x347f79['query']);_0x3713bc['filters']=_['intersection'](_0x3713bc['model'],_0x3713bc['query']);_0x4608f5[_0x790c('0x30')]=_['intersection'](_0x3713bc[_0x790c('0x2d')],qs['fields'](_0x347f79[_0x790c('0x2e')][_0x790c('0x31')]));_0x4608f5[_0x790c('0x30')]=_0x4608f5['attributes'][_0x790c('0x32')]?_0x4608f5['attributes']:_0x3713bc['model'];if(!_0x347f79[_0x790c('0x2e')][_0x790c('0x33')]('nolimit')){_0x4608f5[_0x790c('0x1a')]=qs[_0x790c('0x1a')](_0x347f79[_0x790c('0x2e')][_0x790c('0x1a')]);_0x4608f5[_0x790c('0x1c')]=qs[_0x790c('0x1c')](_0x347f79[_0x790c('0x2e')][_0x790c('0x1c')]);}_0x4608f5[_0x790c('0x34')]=qs[_0x790c('0x35')](_0x347f79[_0x790c('0x2e')][_0x790c('0x35')]);_0x4608f5[_0x790c('0x36')]=qs['filters'](_['pick'](_0x347f79[_0x790c('0x2e')],_0x3713bc[_0x790c('0x37')]),_0x562c34);if(_0x347f79[_0x790c('0x2e')][_0x790c('0x38')]){_0x4608f5['where']=_[_0x790c('0x39')](_0x4608f5[_0x790c('0x36')],{'$or':_[_0x790c('0x3a')](_0x4608f5[_0x790c('0x30')],function(_0x49a1ae){var _0x11a0ec={};_0x11a0ec[_0x49a1ae]={'$like':'%'+_0x347f79['query'][_0x790c('0x38')]+'%'};return _0x11a0ec;})});}_0x4608f5=_[_0x790c('0x39')]({},_0x4608f5,_0x347f79[_0x790c('0x3b')]);var _0x3fa620={'where':_0x4608f5[_0x790c('0x36')]};return db[_0x790c('0x3c')][_0x790c('0x1b')](_0x3fa620)[_0x790c('0x23')](function(_0x4a2dc1){_0x3a3fbb[_0x790c('0x1b')]=_0x4a2dc1;if(_0x347f79['query'][_0x790c('0x3d')]){_0x4608f5['include']=[{'all':!![]}];}return db[_0x790c('0x3c')][_0x790c('0x3e')](_0x4608f5);})[_0x790c('0x23')](function(_0x261c5d){_0x3a3fbb[_0x790c('0x3f')]=_0x261c5d;return _0x3a3fbb;})['then'](respondWithFilteredResult(_0xd860f4,_0x4608f5))[_0x790c('0x40')](handleError(_0xd860f4,null));})[_0x790c('0x40')](handleError(_0xd860f4,null));};exports['show']=function(_0x4166b2,_0x30d4e6){var _0x3e0f08={'raw':![],'where':{'id':_0x4166b2[_0x790c('0x41')]['id']}},_0x258051={};_0x258051[_0x790c('0x2d')]=_[_0x790c('0x2f')](db['CmCompany'][_0x790c('0x42')]);_0x258051[_0x790c('0x2e')]=_[_0x790c('0x2f')](_0x4166b2[_0x790c('0x2e')]);_0x258051[_0x790c('0x37')]=_[_0x790c('0x43')](_0x258051[_0x790c('0x2d')],_0x258051[_0x790c('0x2e')]);_0x3e0f08[_0x790c('0x30')]=_['intersection'](_0x258051['model'],qs[_0x790c('0x31')](_0x4166b2[_0x790c('0x2e')][_0x790c('0x31')]));_0x3e0f08['attributes']=_0x3e0f08[_0x790c('0x30')][_0x790c('0x32')]?_0x3e0f08[_0x790c('0x30')]:_0x258051[_0x790c('0x2d')];if(_0x4166b2[_0x790c('0x2e')][_0x790c('0x3d')]){_0x3e0f08[_0x790c('0x44')]=[{'all':!![]}];}_0x3e0f08=_[_0x790c('0x39')]({},_0x3e0f08,_0x4166b2[_0x790c('0x3b')]);return db[_0x790c('0x3c')][_0x790c('0x45')](_0x3e0f08)[_0x790c('0x23')](handleEntityNotFound(_0x30d4e6,null))[_0x790c('0x23')](respondWithResult(_0x30d4e6,null))[_0x790c('0x40')](handleError(_0x30d4e6,null));};exports[_0x790c('0x46')]=function(_0x2bac49,_0x5e84fb){return db[_0x790c('0x3c')]['create'](_0x2bac49[_0x790c('0x47')],{})[_0x790c('0x23')](function(_0x507ed5){var _0x2a0a1b=_0x2bac49['user'][_0x790c('0x25')]({'plain':!![]});if(!_0x2a0a1b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2a0a1b[_0x790c('0x48')]==='user'){var _0x5180d3=_0x507ed5[_0x790c('0x25')]({'plain':!![]});var _0x13efa1=_0x790c('0x26');return db[_0x790c('0x49')][_0x790c('0x45')]({'where':{'name':_0x13efa1,'userProfileId':_0x2a0a1b[_0x790c('0x4a')]},'raw':!![]})[_0x790c('0x23')](function(_0x4120c7){if(_0x4120c7&&_0x4120c7[_0x790c('0x4b')]===0x0){return db['UserProfileResource'][_0x790c('0x46')]({'name':_0x5180d3[_0x790c('0x29')],'resourceId':_0x5180d3['id'],'type':_0x4120c7[_0x790c('0x29')],'sectionId':_0x4120c7['id']},{})[_0x790c('0x23')](function(){return _0x507ed5;});}else{return _0x507ed5;}})[_0x790c('0x40')](function(_0x35d617){logger[_0x790c('0x27')](_0x790c('0x4c'),_0x35d617);throw _0x35d617;});}return _0x507ed5;})[_0x790c('0x23')](respondWithResult(_0x5e84fb,0xc9))[_0x790c('0x40')](handleError(_0x5e84fb,null));};exports['update']=function(_0x2b91f5,_0x5f4ca8){if(_0x2b91f5[_0x790c('0x47')]['id']){delete _0x2b91f5['body']['id'];}return db[_0x790c('0x3c')]['find']({'where':{'id':_0x2b91f5[_0x790c('0x41')]['id']}})['then'](handleEntityNotFound(_0x5f4ca8,null))[_0x790c('0x23')](saveUpdates(_0x2b91f5['body'],null))[_0x790c('0x23')](respondWithResult(_0x5f4ca8,null))['catch'](handleError(_0x5f4ca8,null));};exports[_0x790c('0x24')]=function(_0x33d468,_0x3a0ea4){return db['CmCompany'][_0x790c('0x45')]({'where':{'id':_0x33d468['params']['id']}})[_0x790c('0x23')](handleEntityNotFound(_0x3a0ea4,null))[_0x790c('0x23')](removeEntity(_0x3a0ea4,null))[_0x790c('0x40')](handleError(_0x3a0ea4,null));};exports['describe']=function(_0x3d1d27,_0x4dd197){return db[_0x790c('0x3c')][_0x790c('0x2c')]()[_0x790c('0x23')](respondWithResult(_0x4dd197,null))[_0x790c('0x40')](handleError(_0x4dd197,null));};exports['addContacts']=function(_0x1df2ae,_0x175c1,_0x36b711){return db['CmContact']['find']({'where':{'id':_0x1df2ae['params']['id']}})['then'](handleEntityNotFound(_0x175c1,null))['then'](function(_0x419bb5){if(_0x419bb5){return _0x419bb5[_0x790c('0x4d')](_0x1df2ae[_0x790c('0x47')][_0x790c('0x4e')],_[_0x790c('0x4f')](_0x1df2ae[_0x790c('0x47')],[_0x790c('0x4e'),'id'])||{});}})[_0x790c('0x23')](respondWithResult(_0x175c1,null))['catch'](handleError(_0x175c1,null));};exports['getContacts']=function(_0x515034,_0x439d97,_0x38a352){var _0x4e8d0d={};var _0xb11b29={};var _0x52d5c9;var _0x174138;return db[_0x790c('0x3c')][_0x790c('0x50')]({'where':{'id':_0x515034[_0x790c('0x41')]['id']}})[_0x790c('0x23')](handleEntityNotFound(_0x439d97,null))[_0x790c('0x23')](function(_0x59a14f){if(_0x59a14f){_0x52d5c9=_0x59a14f;_0xb11b29[_0x790c('0x2d')]=_[_0x790c('0x2f')](db[_0x790c('0x51')][_0x790c('0x42')]);_0xb11b29[_0x790c('0x2e')]=_['keys'](_0x515034[_0x790c('0x2e')]);_0xb11b29[_0x790c('0x37')]=_[_0x790c('0x43')](_0xb11b29[_0x790c('0x2d')],_0xb11b29[_0x790c('0x2e')]);_0x4e8d0d[_0x790c('0x30')]=_[_0x790c('0x43')](_0xb11b29[_0x790c('0x2d')],qs[_0x790c('0x31')](_0x515034[_0x790c('0x2e')]['fields']));_0x4e8d0d[_0x790c('0x30')]=_0x4e8d0d[_0x790c('0x30')]['length']?_0x4e8d0d['attributes']:_0xb11b29['model'];_0x4e8d0d[_0x790c('0x34')]=qs[_0x790c('0x35')](_0x515034['query']['sort']);_0x4e8d0d['where']=qs[_0x790c('0x37')](_[_0x790c('0x52')](_0x515034[_0x790c('0x2e')],_0xb11b29[_0x790c('0x37')]));if(_0x515034[_0x790c('0x2e')][_0x790c('0x38')]){_0x4e8d0d[_0x790c('0x36')]=_[_0x790c('0x39')](_0x4e8d0d['where'],{'$or':_[_0x790c('0x3a')](_0x4e8d0d[_0x790c('0x30')],function(_0x2cf82e){var _0x5b5787={};_0x5b5787[_0x2cf82e]={'$like':'%'+_0x515034['query'][_0x790c('0x38')]+'%'};return _0x5b5787;})});}_0x4e8d0d=_['merge']({},_0x4e8d0d,_0x515034[_0x790c('0x3b')]);return _0x52d5c9[_0x790c('0x53')](_0x4e8d0d);}})[_0x790c('0x23')](function(_0x35c753){if(_0x35c753){_0x174138=_0x35c753[_0x790c('0x32')];if(!_0x515034[_0x790c('0x2e')]['hasOwnProperty']('nolimit')){_0x4e8d0d[_0x790c('0x1a')]=qs[_0x790c('0x1a')](_0x515034[_0x790c('0x2e')][_0x790c('0x1a')]);_0x4e8d0d['offset']=qs[_0x790c('0x1c')](_0x515034[_0x790c('0x2e')][_0x790c('0x1c')]);}return _0x52d5c9[_0x790c('0x53')](_0x4e8d0d);}})[_0x790c('0x23')](function(_0x58f162){if(_0x58f162){return _0x58f162?{'count':_0x174138,'rows':_0x58f162}:null;}})[_0x790c('0x23')](respondWithResult(_0x439d97,null))[_0x790c('0x40')](handleError(_0x439d97,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index d49079a..2dfcf3f 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 _0xbb5e=['CmCompany','cm_companies','lodash','util','../../config/logger','moment','request-promise','rimraf','../../config/environment','./cmCompany.attributes','exports'];(function(_0x26f35f,_0x435e65){var _0x3c0389=function(_0x10ff3a){while(--_0x10ff3a){_0x26f35f['push'](_0x26f35f['shift']());}};_0x3c0389(++_0x435e65);}(_0xbb5e,0xbd));var _0xebb5=function(_0x233b87,_0x29f44a){_0x233b87=_0x233b87-0x0;var _0x3a2f42=_0xbb5e[_0x233b87];return _0x3a2f42;};'use strict';var _=require(_0xebb5('0x0'));var util=require(_0xebb5('0x1'));var logger=require(_0xebb5('0x2'))('api');var moment=require(_0xebb5('0x3'));var BPromise=require('bluebird');var rp=require(_0xebb5('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xebb5('0x5'));var config=require(_0xebb5('0x6'));var attributes=require(_0xebb5('0x7'));module[_0xebb5('0x8')]=function(_0x4bb43b,_0x1c3372){return _0x4bb43b['define'](_0xebb5('0x9'),attributes,{'tableName':_0xebb5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x320c=['exports','define','CmCompany','cm_companies','lodash','util','api','moment','bluebird','request-promise','path','rimraf','./cmCompany.attributes'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x320c,0x6c));var _0xc320=function(_0x4d7d57,_0x1d4878){_0x4d7d57=_0x4d7d57-0x0;var _0x5e9812=_0x320c[_0x4d7d57];return _0x5e9812;};'use strict';var _=require(_0xc320('0x0'));var util=require(_0xc320('0x1'));var logger=require('../../config/logger')(_0xc320('0x2'));var moment=require(_0xc320('0x3'));var BPromise=require(_0xc320('0x4'));var rp=require(_0xc320('0x5'));var fs=require('fs');var path=require(_0xc320('0x6'));var rimraf=require(_0xc320('0x7'));var config=require('../../config/environment');var attributes=require(_0xc320('0x8'));module[_0xc320('0x9')]=function(_0x1bdc1e,_0x3f5ca){return _0x1bdc1e[_0xc320('0xa')](_0xc320('0xb'),attributes,{'tableName':_0xc320('0xc'),'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 6828b84..dfcd8f5 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 _0xa27b=['CmCompany,\x20%s,\x20%s','message','catch','util','bluebird','../../mysqldb','../../config/utils','rpc','jayson/promise','request','then','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x469ae2,_0x24cd30){var _0x5e33e4=function(_0x1aaeb1){while(--_0x1aaeb1){_0x469ae2['push'](_0x469ae2['shift']());}};_0x5e33e4(++_0x24cd30);}(_0xa27b,0x153));var _0xba27=function(_0x3f4166,_0x55fcea){_0x3f4166=_0x3f4166-0x0;var _0x2cad5e=_0xa27b[_0x3f4166];return _0x2cad5e;};'use strict';var _=require('lodash');var util=require(_0xba27('0x0'));var moment=require('moment');var BPromise=require(_0xba27('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xba27('0x2'))['db'];var utils=require(_0xba27('0x3'));var logger=require('../../config/logger')(_0xba27('0x4'));var config=require('../../config/environment');var jayson=require(_0xba27('0x5'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5945ec,_0xbb0178,_0x40cfe6){return new BPromise(function(_0x546d18,_0x3c1812){return client[_0xba27('0x6')](_0x5945ec,_0x40cfe6)[_0xba27('0x7')](function(_0x1073ec){logger['info']('CmCompany,\x20%s,\x20%s',_0xbb0178,'request\x20sent');logger[_0xba27('0x8')](_0xba27('0x9'),_0xbb0178,'request\x20sent',JSON[_0xba27('0xa')](_0x1073ec));if(_0x1073ec[_0xba27('0xb')]){if(_0x1073ec[_0xba27('0xb')][_0xba27('0xc')]===0x1f4){logger[_0xba27('0xb')](_0xba27('0xd'),_0xbb0178,_0x1073ec['error'][_0xba27('0xe')]);return _0x3c1812(_0x1073ec[_0xba27('0xb')][_0xba27('0xe')]);}logger[_0xba27('0xb')](_0xba27('0xd'),_0xbb0178,_0x1073ec[_0xba27('0xb')][_0xba27('0xe')]);return _0x546d18(_0x1073ec['error'][_0xba27('0xe')]);}else{logger['info'](_0xba27('0xd'),_0xbb0178,'request\x20sent');_0x546d18(_0x1073ec['result']['message']);}})[_0xba27('0xf')](function(_0x3b19b3){logger[_0xba27('0xb')]('CmCompany,\x20%s,\x20%s',_0xbb0178,_0x3b19b3);_0x3c1812(_0x3b19b3);});});} \ No newline at end of file +var _0xd57f=['request','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x11c843,_0x5f21e2){var _0x4f61a0=function(_0xfeedbb){while(--_0xfeedbb){_0x11c843['push'](_0x11c843['shift']());}};_0x4f61a0(++_0x5f21e2);}(_0xd57f,0x6d));var _0xfd57=function(_0x1cd6c1,_0x5a7426){_0x1cd6c1=_0x1cd6c1-0x0;var _0x385984=_0xd57f[_0x1cd6c1];return _0x385984;};'use strict';var _=require('lodash');var util=require(_0xfd57('0x0'));var moment=require('moment');var BPromise=require(_0xfd57('0x1'));var rs=require(_0xfd57('0x2'));var fs=require('fs');var Redis=require(_0xfd57('0x3'));var db=require(_0xfd57('0x4'))['db'];var utils=require(_0xfd57('0x5'));var logger=require('../../config/logger')(_0xfd57('0x6'));var config=require(_0xfd57('0x7'));var jayson=require(_0xfd57('0x8'));var client=jayson[_0xfd57('0x9')][_0xfd57('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1f553a,_0x310a7e,_0x13e81c){return new BPromise(function(_0x494f9d,_0x4dedba){return client[_0xfd57('0xb')](_0x1f553a,_0x13e81c)[_0xfd57('0xc')](function(_0x1fc6f2){logger[_0xfd57('0xd')](_0xfd57('0xe'),_0x310a7e,_0xfd57('0xf'));logger[_0xfd57('0x10')](_0xfd57('0x11'),_0x310a7e,_0xfd57('0xf'),JSON[_0xfd57('0x12')](_0x1fc6f2));if(_0x1fc6f2[_0xfd57('0x13')]){if(_0x1fc6f2[_0xfd57('0x13')][_0xfd57('0x14')]===0x1f4){logger[_0xfd57('0x13')](_0xfd57('0xe'),_0x310a7e,_0x1fc6f2[_0xfd57('0x13')]['message']);return _0x4dedba(_0x1fc6f2[_0xfd57('0x13')][_0xfd57('0x15')]);}logger[_0xfd57('0x13')](_0xfd57('0xe'),_0x310a7e,_0x1fc6f2[_0xfd57('0x13')][_0xfd57('0x15')]);return _0x494f9d(_0x1fc6f2['error'][_0xfd57('0x15')]);}else{logger[_0xfd57('0xd')](_0xfd57('0xe'),_0x310a7e,_0xfd57('0xf'));_0x494f9d(_0x1fc6f2[_0xfd57('0x16')][_0xfd57('0x15')]);}})[_0xfd57('0x17')](function(_0x1c8499){logger[_0xfd57('0x13')](_0xfd57('0xe'),_0x310a7e,_0x1c8499);_0x4dedba(_0x1c8499);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 4e45802..defad43 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 _0x4faa=['multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cmCompany.controller','get','index','/describe','describe','/:id','show','/:id/contacts','getContacts','post','isAuthenticated','put','update','delete','destroy','exports'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x4faa,0x198));var _0xa4fa=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x4faa[_0x13e741];return _0x3f8bb3;};'use strict';var multer=require(_0xa4fa('0x0'));var util=require(_0xa4fa('0x1'));var path=require(_0xa4fa('0x2'));var timeout=require('connect-timeout');var express=require(_0xa4fa('0x3'));var router=express[_0xa4fa('0x4')]();var fs_extra=require(_0xa4fa('0x5'));var auth=require(_0xa4fa('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa4fa('0x7'));var controller=require(_0xa4fa('0x8'));router[_0xa4fa('0x9')]('/',auth['isAuthenticated'](),controller[_0xa4fa('0xa')]);router[_0xa4fa('0x9')](_0xa4fa('0xb'),auth['isAuthenticated'](),controller[_0xa4fa('0xc')]);router[_0xa4fa('0x9')](_0xa4fa('0xd'),auth['isAuthenticated'](),controller[_0xa4fa('0xe')]);router['get'](_0xa4fa('0xf'),auth['isAuthenticated'](),controller[_0xa4fa('0x10')]);router[_0xa4fa('0x11')]('/',auth[_0xa4fa('0x12')](),controller['create']);router['post'](_0xa4fa('0xf'),auth[_0xa4fa('0x12')](),controller['addContacts']);router[_0xa4fa('0x13')](_0xa4fa('0xd'),auth[_0xa4fa('0x12')](),controller[_0xa4fa('0x14')]);router[_0xa4fa('0x15')](_0xa4fa('0xd'),auth[_0xa4fa('0x12')](),controller[_0xa4fa('0x16')]);module[_0xa4fa('0x17')]=router; \ No newline at end of file +var _0x5177=['./cmCompany.controller','get','isAuthenticated','index','describe','/:id','/:id/contacts','getContacts','addContacts','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x553586,_0x4bf028){var _0x2229bb=function(_0xcb29ce){while(--_0xcb29ce){_0x553586['push'](_0x553586['shift']());}};_0x2229bb(++_0x4bf028);}(_0x5177,0xd4));var _0x7517=function(_0x506b6e,_0x2f9648){_0x506b6e=_0x506b6e-0x0;var _0xd76c91=_0x5177[_0x506b6e];return _0xd76c91;};'use strict';var multer=require(_0x7517('0x0'));var util=require(_0x7517('0x1'));var path=require('path');var timeout=require(_0x7517('0x2'));var express=require(_0x7517('0x3'));var router=express[_0x7517('0x4')]();var fs_extra=require(_0x7517('0x5'));var auth=require(_0x7517('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7517('0x7'));var controller=require(_0x7517('0x8'));router[_0x7517('0x9')]('/',auth[_0x7517('0xa')](),controller[_0x7517('0xb')]);router['get']('/describe',auth[_0x7517('0xa')](),controller[_0x7517('0xc')]);router[_0x7517('0x9')](_0x7517('0xd'),auth[_0x7517('0xa')](),controller['show']);router['get'](_0x7517('0xe'),auth[_0x7517('0xa')](),controller[_0x7517('0xf')]);router['post']('/',auth[_0x7517('0xa')](),controller['create']);router['post'](_0x7517('0xe'),auth[_0x7517('0xa')](),controller[_0x7517('0x10')]);router[_0x7517('0x11')](_0x7517('0xd'),auth[_0x7517('0xa')](),controller[_0x7517('0x12')]);router[_0x7517('0x13')](_0x7517('0xd'),auth[_0x7517('0xa')](),controller[_0x7517('0x14')]);module[_0x7517('0x15')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index e0bb036..3a22e17 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 _0x1832=['INTEGER','UNSIGNED','NOW','sequelize','exports','STRING','TEXT'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x1832,0x1e6));var _0x2183=function(_0x4d0036,_0xdd4f30){_0x4d0036=_0x4d0036-0x0;var _0x20bb58=_0x1832[_0x4d0036];return _0x20bb58;};'use strict';var _=require('lodash');var Sequelize=require(_0x2183('0x0'));module[_0x2183('0x1')]={'firstName':{'type':Sequelize[_0x2183('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0x2183('0x2')]},'street':{'type':Sequelize[_0x2183('0x2')]},'postalCode':{'type':Sequelize[_0x2183('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x2183('0x3')]},'phone':{'type':Sequelize[_0x2183('0x2')]},'mobile':{'type':Sequelize[_0x2183('0x2')]},'fax':{'type':Sequelize[_0x2183('0x2')]},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize[_0x2183('0x2')]},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0x2183('0x2')]},'skype':{'type':Sequelize[_0x2183('0x2')]},'teams':{'type':Sequelize[_0x2183('0x2')]},'viber':{'type':Sequelize[_0x2183('0x2')]},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0x2183('0x2')]},'telegram':{'type':Sequelize[_0x2183('0x2')]},'UserId':{'type':Sequelize[_0x2183('0x4')]},'AdditionalPhones':{'type':Sequelize[_0x2183('0x2')]},'priority':{'type':Sequelize[_0x2183('0x4')](0x2)[_0x2183('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize[_0x2183('0x6')]},'dialTimezone':{'type':Sequelize[_0x2183('0x2')]},'utcOffset':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x7e27=['INTEGER','DATE','NOW','lodash','sequelize','exports','STRING','TEXT'];(function(_0x56bca4,_0x15b1cc){var _0x3ef5a2=function(_0x1d7168){while(--_0x1d7168){_0x56bca4['push'](_0x56bca4['shift']());}};_0x3ef5a2(++_0x15b1cc);}(_0x7e27,0xcb));var _0x77e2=function(_0x1c05d6,_0x501219){_0x1c05d6=_0x1c05d6-0x0;var _0x4e6250=_0x7e27[_0x1c05d6];return _0x4e6250;};'use strict';var _=require(_0x77e2('0x0'));var Sequelize=require(_0x77e2('0x1'));module[_0x77e2('0x2')]={'firstName':{'type':Sequelize[_0x77e2('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0x77e2('0x3')]},'street':{'type':Sequelize[_0x77e2('0x3')]},'postalCode':{'type':Sequelize[_0x77e2('0x3')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x77e2('0x3')]},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x77e2('0x4')]},'phone':{'type':Sequelize[_0x77e2('0x3')]},'mobile':{'type':Sequelize[_0x77e2('0x3')]},'fax':{'type':Sequelize[_0x77e2('0x3')]},'email':{'type':Sequelize[_0x77e2('0x3')]},'url':{'type':Sequelize[_0x77e2('0x3')]},'facebook':{'type':Sequelize[_0x77e2('0x3')]},'fb_data':{'type':Sequelize[_0x77e2('0x3')]},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize[_0x77e2('0x3')]},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize[_0x77e2('0x3')]},'line':{'type':Sequelize[_0x77e2('0x3')]},'wechat':{'type':Sequelize[_0x77e2('0x3')]},'telegram':{'type':Sequelize[_0x77e2('0x3')]},'UserId':{'type':Sequelize[_0x77e2('0x5')]},'AdditionalPhones':{'type':Sequelize[_0x77e2('0x3')]},'priority':{'type':Sequelize[_0x77e2('0x5')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x77e2('0x6')],'defaultValue':Sequelize[_0x77e2('0x7')]},'dialTimezone':{'type':Sequelize[_0x77e2('0x3')]},'utcOffset':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index a026e7a..510c272 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 _0x0ac7=['FaxMessage','CmContactHasItem','CmHopperFinal','CmHopperHistory','ReportAgentPreview','ChatQueueReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','isArray','isNil','dialTimezone','timezones','utcOffset','additionalPhones','bulkCreate','duplicates','where','push','ListId','spread','contact','show','find','Tag','Tags','color','Phones','ItemType','sequelize','$and','omit','map','cf_%d','pickBy','isEmpty','table','cm_contacts','setFields','id\x20=\x20?','values','phone','findOne','rawAttributes','filters','intersection','attributes','model','fields','order','sort','pick','merge','options','getTags','setTags','ids','setAdditionalPhones','all','ContactItemType','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','PHONE','CmHopperAdditionalPhone','item','CmHopperId','ItemType.OrderBy','getAdditionalPhones','literal','`ItemType`.OrderBy','toContactId','hopperId','getHoppers','nolimit','filter','includeAll','include','rows','getHopperHistories','ContactId','getHopperFinals','JscriptySessionReport','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','No\x20firstName\x20column\x20specified','root','server/files/tmp','filename','0777','child_process','../../components/import/cm/csv','CompanyId','File\x20uploaded\x20correctly!','pid','createReadStream','parse','file','meta','import','User','agent','firstName','fork','stringify','message','start\x20child\x20process\x20correctly!','error\x20child\x20process','importUpdates','binding','../../components/import/cm/csvUpdates','exit','getJourney','mail','chat','sms','openchannel','fax','voice','-createdAt','includes','channel','toLowerCase','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','source','starttime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','DESC','VoiceCallReport','fullname','startCase','Website','Account','closed','closedAt','disposition','secondDisposition','key','Owner','browserName','customerIp','customerPort','deviceModel','osName','ratingMessage','ratingType','ratingValue','referer','subject','substatus','externalUrl','threadId','Interaction','findAndCountAll','flatten','sortBy','reverse','value','slice','bluebird','path','lodash','squel','papaparse','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','register','status','json','undefined','limit','count','offset','set','Content-Range','update','then','destroy','end','error','stack','name','send','index','describe','findAll','query','user','CmContact','params','catch','tags','length','keys','startsWith','cf_','columnName','displayName','analytics','CmCustomField','alias','custom','info','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','forEach','hasOwnProperty','body','from','get','mergeWith','join','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0ac7,0x1ba));var _0x70ac=function(_0x340437,_0xb81fb0){_0x340437=_0x340437-0x0;var _0x2f49e2=_0x0ac7[_0x340437];return _0x2f49e2;};'use strict';var moment=require('moment');var BPromise=require(_0x70ac('0x0'));var util=require('util');var path=require(_0x70ac('0x1'));var fs=require('fs');var _=require(_0x70ac('0x2'));var squel=require(_0x70ac('0x3'));var Papa=require(_0x70ac('0x4'));var Redis=require('ioredis');var contacts=require(_0x70ac('0x5'));var qs=require(_0x70ac('0x6'));var logger=require(_0x70ac('0x7'))(_0x70ac('0x8'));var config=require(_0x70ac('0x9'));var shared=require('../../config/environment/shared');var db=require(_0x70ac('0xa'))['db'];config[_0x70ac('0xb')]=_[_0x70ac('0xc')](config[_0x70ac('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x70ac('0xd'))(new Redis(config[_0x70ac('0xb')]));require('./cmContact.socket')[_0x70ac('0xe')](socket);function respondWithResult(_0xab74b5,_0x4967a4){_0x4967a4=_0x4967a4||0xc8;return function(_0x1c44e1){if(_0x1c44e1){return _0xab74b5[_0x70ac('0xf')](_0x4967a4)[_0x70ac('0x10')](_0x1c44e1);}};}function respondWithFilteredResult(_0xc91cd3,_0x527093){return function(_0x201048){if(_0x201048){var _0x40b16c=typeof _0x527093['offset']===_0x70ac('0x11')&&typeof _0x527093[_0x70ac('0x12')]==='undefined';var _0x43f8ab=_0x201048[_0x70ac('0x13')];var _0xdd84ab=_0x40b16c?0x0:_0x527093['offset'];var _0x2b911a=_0x40b16c?_0x201048[_0x70ac('0x13')]:_0x527093[_0x70ac('0x14')]+_0x527093[_0x70ac('0x12')];var _0x4298e8;if(_0x2b911a>=_0x43f8ab){_0x2b911a=_0x43f8ab;_0x4298e8=0xc8;}else{_0x4298e8=0xce;}_0xc91cd3[_0x70ac('0xf')](_0x4298e8);return _0xc91cd3[_0x70ac('0x15')](_0x70ac('0x16'),_0xdd84ab+'-'+_0x2b911a+'/'+_0x43f8ab)[_0x70ac('0x10')](_0x201048);}return null;};}function saveUpdates(_0x4c00dc){return function(_0x1c4e75){if(_0x1c4e75){return _0x1c4e75[_0x70ac('0x17')](_0x4c00dc)[_0x70ac('0x18')](function(_0x50b69e){return _0x50b69e;});}return null;};}function removeEntity(_0x57c1ec){return function(_0x174f75){if(_0x174f75){return _0x174f75[_0x70ac('0x19')]()[_0x70ac('0x18')](function(){_0x57c1ec[_0x70ac('0xf')](0xcc)[_0x70ac('0x1a')]();});}};}function handleEntityNotFound(_0x551e04){return function(_0x384de9){if(!_0x384de9){_0x551e04['sendStatus'](0x194);}return _0x384de9;};}function handleError(_0x313173,_0x4c4935){_0x4c4935=_0x4c4935||0x1f4;return function(_0x2bc677){logger[_0x70ac('0x1b')](_0x2bc677[_0x70ac('0x1c')]);if(_0x2bc677['name']){delete _0x2bc677[_0x70ac('0x1d')];}_0x313173[_0x70ac('0xf')](_0x4c4935)[_0x70ac('0x1e')](_0x2bc677);};}exports[_0x70ac('0x1f')]=function(_0x42c557,_0x9c3b55){var _0x43bebe={};return contacts[_0x70ac('0x20')]()[_0x70ac('0x18')](function(_0x1b7b1e){_0x43bebe=qs['getOptions'](_0x1b7b1e,_0x42c557);return contacts[_0x70ac('0x21')](_0x42c557[_0x70ac('0x22')],_0x42c557[_0x70ac('0x23')],_0x43bebe,_0x1b7b1e);})[_0x70ac('0x18')](respondWithFilteredResult(_0x9c3b55,_0x43bebe))['catch'](handleError(_0x9c3b55,null));};exports['destroy']=function(_0x5f5022,_0x3d5d09){return db[_0x70ac('0x24')]['find']({'where':{'id':_0x5f5022[_0x70ac('0x25')]['id']}})[_0x70ac('0x18')](handleEntityNotFound(_0x3d5d09,null))[_0x70ac('0x18')](removeEntity(_0x3d5d09,null))[_0x70ac('0x26')](handleError(_0x3d5d09,null));};exports['describe']=function(_0x47366a,_0x192277){return db['CmContact'][_0x70ac('0x20')]()['then'](function(_0x4ccf40){delete _0x4ccf40[_0x70ac('0x27')];for(var _0xf3a2cc=0x0;_0xf3a2cc0x0){return new Promise(function(_0x3f6585){var _0xc39e4=[];for(var _0x2d0a04=0x0;_0x2d0a04<_0x1c42dd[_0x70ac('0x28')];_0x2d0a04++){_0xc39e4[_0x70ac('0x5c')](insertAdditionalPhones(_0x1c42dd[_0x2d0a04][_0x70ac('0x5f')],_0x1c42dd[_0x2d0a04][_0x70ac('0x58')]));}Promise['all'](_0xc39e4)['then'](function(){_0x3f6585(0x1);});})[_0x70ac('0x18')](function(){return{'success':_0x8a8d12,'failure':_0x38ab5a,'duplicates':_0x279110};});}else{return{'success':_0x8a8d12,'failure':_0x38ab5a,'duplicates':_0x279110};}}})[_0x70ac('0x18')](respondWithResult(_0x5b8e53,0xc9))[_0x70ac('0x26')](handleError(_0x5b8e53,null));};exports[_0x70ac('0x60')]=function(_0x3a8399,_0x2123ac){var _0x1148c2;return db[_0x70ac('0x24')][_0x70ac('0x20')]()[_0x70ac('0x18')](function(_0x1cf37c){return db[_0x70ac('0x24')][_0x70ac('0x61')]({'where':{'id':_0x3a8399[_0x70ac('0x25')]['id']},'include':[{'model':db[_0x70ac('0x62')],'as':_0x70ac('0x63'),'attributes':['id',_0x70ac('0x1d'),_0x70ac('0x64')],'required':_0x3a8399['query']['tag']?!![]:![]},{'model':db[_0x70ac('0x47')],'as':_0x70ac('0x65'),'where':{'CmContactId':_0x3a8399[_0x70ac('0x25')]['id']},'required':![],'include':[{'model':db['ContactItemType'],'as':_0x70ac('0x66')}]}],'order':[db[_0x70ac('0x67')]['literal']('Phones.OrderBy')],'attributes':_[_0x70ac('0x29')](_0x1cf37c)});})[_0x70ac('0x18')](function(_0x315b8e){if(!_[_0x70ac('0x54')](_0x315b8e)){_0x1148c2=_0x315b8e[_0x70ac('0x38')]({'plain':!![]});var _0x47d47b={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x315b8e&&_0x315b8e[_0x70ac('0x5d')]){if(_0x315b8e[_0x70ac('0x5d')]){_0x47d47b[_0x70ac('0x5b')][_0x70ac('0x68')][_0x70ac('0x5c')]({'ListId':{'$ne':_0x315b8e[_0x70ac('0x5d')]}});}}return db[_0x70ac('0x2f')]['findAll'](_0x47d47b);}})[_0x70ac('0x18')](function(_0x236144){if(!_[_0x70ac('0x54')](_0x236144)){return _[_0x70ac('0x69')](_0x1148c2,_[_0x70ac('0x6a')](_0x236144,function(_0x115bd9){return util['format'](_0x70ac('0x6b'),_0x115bd9['id']);}));}})['then'](handleEntityNotFound(_0x2123ac,null))[_0x70ac('0x18')](respondWithResult(_0x2123ac,null))[_0x70ac('0x26')](handleError(_0x2123ac,null));};exports[_0x70ac('0x17')]=function(_0x19cb21,_0x539daa){var _0x302b30;if(_0x19cb21[_0x70ac('0x36')]['id']){delete _0x19cb21['body']['id'];}if(!_[_0x70ac('0x54')](_0x19cb21[_0x70ac('0x36')][_0x70ac('0x55')])){var _0x397f29=_0x19cb21[_0x70ac('0x36')][_0x70ac('0x55')];if(!_[_0x70ac('0x54')](shared[_0x70ac('0x56')][_0x397f29]))_0x19cb21[_0x70ac('0x36')][_0x70ac('0x57')]=shared['timezones'][_0x397f29][_0x70ac('0x57')];}return db['CmContact'][_0x70ac('0x61')]({'where':{'id':_0x19cb21['params']['id']}})[_0x70ac('0x18')](handleEntityNotFound(_0x539daa,null))['then'](saveUpdates(_0x19cb21[_0x70ac('0x36')],null))[_0x70ac('0x18')](function(_0x149f3d){_0x302b30=_0x149f3d;var _0x2c7452={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x149f3d&&_0x149f3d[_0x70ac('0x5d')]){if(_0x149f3d[_0x70ac('0x5d')]){_0x2c7452[_0x70ac('0x5b')]['$and']['push']({'ListId':{'$ne':_0x149f3d[_0x70ac('0x5d')]}});}}return db['CmCustomField'][_0x70ac('0x21')](_0x2c7452);})[_0x70ac('0x18')](function(_0x2a78d7){if(_0x2a78d7){return _[_0x70ac('0x69')](_[_0x70ac('0x6c')](_0x19cb21[_0x70ac('0x36')],function(_0x274486,_0x48e8d9){return _[_0x70ac('0x2a')](_0x48e8d9,_0x70ac('0x2b'));}),_[_0x70ac('0x6a')](_0x2a78d7,function(_0x13004c){return util['format']('cf_%d',_0x13004c['id']);}));}})['then'](function(_0x49bfa1){if(_0x49bfa1&&!_[_0x70ac('0x6d')](_0x49bfa1)){var _0x1fdcaf=squel[_0x70ac('0x17')]()[_0x70ac('0x6e')](_0x70ac('0x6f'))[_0x70ac('0x70')](_0x49bfa1)[_0x70ac('0x5b')](_0x70ac('0x71'),_0x19cb21[_0x70ac('0x25')]['id'])['toParam']();return db[_0x70ac('0x67')][_0x70ac('0x22')](_0x1fdcaf['text'],{'replacements':_0x1fdcaf[_0x70ac('0x72')]});}})['then'](function(){if(_0x19cb21['body'][_0x70ac('0x73')]&&_0x302b30){return db[_0x70ac('0x3b')][_0x70ac('0x17')]({'phone':_0x19cb21['body'][_0x70ac('0x73')],'OrderBy':0x0},{'where':{'ContactId':_0x302b30['id']}});}})['then'](function(){return _0x302b30;})[_0x70ac('0x18')](respondWithResult(_0x539daa,null))[_0x70ac('0x26')](handleError(_0x539daa,null));};exports['getTags']=function(_0x390711,_0x508e11){var _0x518f0e={};var _0x4cb5e9={};var _0x31c152;var _0x55c8ce;return db[_0x70ac('0x24')][_0x70ac('0x74')]({'where':{'id':_0x390711['params']['id']}})[_0x70ac('0x18')](handleEntityNotFound(_0x508e11,null))[_0x70ac('0x18')](function(_0x416b98){if(_0x416b98){_0x31c152=_0x416b98;_0x4cb5e9['model']=_[_0x70ac('0x29')](db[_0x70ac('0x62')][_0x70ac('0x75')]);_0x4cb5e9['query']=_[_0x70ac('0x29')](_0x390711[_0x70ac('0x22')]);_0x4cb5e9[_0x70ac('0x76')]=_[_0x70ac('0x77')](_0x4cb5e9['model'],_0x4cb5e9[_0x70ac('0x22')]);_0x518f0e[_0x70ac('0x78')]=_[_0x70ac('0x77')](_0x4cb5e9[_0x70ac('0x79')],qs[_0x70ac('0x7a')](_0x390711[_0x70ac('0x22')][_0x70ac('0x7a')]));_0x518f0e[_0x70ac('0x78')]=_0x518f0e[_0x70ac('0x78')][_0x70ac('0x28')]?_0x518f0e[_0x70ac('0x78')]:_0x4cb5e9[_0x70ac('0x79')];_0x518f0e[_0x70ac('0x7b')]=qs[_0x70ac('0x7c')](_0x390711[_0x70ac('0x22')]['sort']);_0x518f0e[_0x70ac('0x5b')]=qs['filters'](_[_0x70ac('0x7d')](_0x390711['query'],_0x4cb5e9[_0x70ac('0x76')]));if(_0x390711[_0x70ac('0x22')]['filter']){_0x518f0e[_0x70ac('0x5b')]=_[_0x70ac('0x7e')](_0x518f0e[_0x70ac('0x5b')],{'$or':_[_0x70ac('0x6a')](_0x518f0e[_0x70ac('0x78')],function(_0x46face){var _0x164302={};_0x164302[_0x46face]={'$like':'%'+_0x390711[_0x70ac('0x22')]['filter']+'%'};return _0x164302;})});}_0x518f0e=_['merge']({},_0x518f0e,_0x390711[_0x70ac('0x7f')]);return _0x31c152[_0x70ac('0x80')](_0x518f0e);}})[_0x70ac('0x18')](function(_0x30fc29){if(_0x30fc29){_0x55c8ce=_0x30fc29[_0x70ac('0x28')];if(!_0x390711[_0x70ac('0x22')][_0x70ac('0x35')]('nolimit')){_0x518f0e[_0x70ac('0x12')]=qs[_0x70ac('0x12')](_0x390711['query']['limit']);_0x518f0e['offset']=qs[_0x70ac('0x14')](_0x390711[_0x70ac('0x22')]['offset']);}return _0x31c152[_0x70ac('0x80')](_0x518f0e);}})[_0x70ac('0x18')](function(_0x28ab7a){if(_0x28ab7a){return _0x28ab7a?{'count':_0x55c8ce,'rows':_0x28ab7a}:null;}})[_0x70ac('0x18')](respondWithResult(_0x508e11,null))['catch'](handleError(_0x508e11,null));};exports[_0x70ac('0x81')]=function(_0x19a820,_0x3128fb){if(_0x19a820['body']['id']){delete _0x19a820['body']['id'];}return db[_0x70ac('0x24')]['findOne']({'where':{'id':_0x19a820['params']['id']}})['then'](handleEntityNotFound(_0x3128fb,null))[_0x70ac('0x18')](function(_0x31da31){if(_0x31da31){return _0x31da31[_0x70ac('0x81')](_0x19a820[_0x70ac('0x36')][_0x70ac('0x82')]||[]);}return null;})[_0x70ac('0x18')](respondWithResult(_0x3128fb,null))[_0x70ac('0x26')](handleError(_0x3128fb,null));};exports[_0x70ac('0x83')]=function(_0x25cd78,_0x4542a6){var _0x3859e4=[];_0x3859e4['push'](addAdditionalPhones(_0x25cd78[_0x70ac('0x36')]));Promise[_0x70ac('0x84')](_0x3859e4)[_0x70ac('0x18')](function(){_0x3859e4=[];_0x3859e4[_0x70ac('0x5c')](deleteCmHopperPhones(_0x25cd78['body']['id']));_0x3859e4[_0x70ac('0x5c')](addCmHopperPhones(_0x25cd78[_0x70ac('0x36')]['id']));Promise[_0x70ac('0x84')](_0x3859e4)[_0x70ac('0x18')](function(){return[0x1];})[_0x70ac('0x18')](respondWithResult(_0x4542a6,null));});};function addAdditionalPhones(_0x3b199f){var _0x5b67e5;return new Promise(function(_0x1856ce){return db['CmContactHasItem']['destroy']({'where':{'CmContactId':_0x3b199f['id']}})[_0x70ac('0x18')](function(){db[_0x70ac('0x85')][_0x70ac('0x21')]({'raw':!![],'attributes':['id',_0x70ac('0x86')]})[_0x70ac('0x18')](function(_0x268334){var _0x2f5882=[];for(var _0xdd58e0=0x0;_0xdd58e0<_0x3b199f[_0x70ac('0x87')]['length'];_0xdd58e0++){var _0x2b1ad7=_0x3b199f[_0x70ac('0x88')]?_['isNil'](_0x3b199f[_0x70ac('0x88')][_0xdd58e0])?'':_0x3b199f[_0x70ac('0x88')][_0xdd58e0]:_0x3b199f[_0x70ac('0x87')][_0xdd58e0][_0x70ac('0x89')]?_0x3b199f[_0x70ac('0x87')][_0xdd58e0]['ItemTypeId']:'';var _0x81685e=_[_0x70ac('0x54')](_0x3b199f['items'][_0xdd58e0][_0x70ac('0x8a')])?'':_0x3b199f[_0x70ac('0x87')][_0xdd58e0][_0x70ac('0x8a')];var _0x4aeeb6=_0x2b1ad7+':'+_0x3b199f['items'][_0xdd58e0][_0x70ac('0x73')]+'§'+_0x81685e;if(_[_0x70ac('0x54')](_0x5b67e5))_0x5b67e5=_0x4aeeb6;else _0x5b67e5+=';'+_0x4aeeb6;var _0x34f4e8=null;var _0x50c936=null;if(_0x3b199f[_0x70ac('0x88')]){if(!_['isNil'](_0x3b199f[_0x70ac('0x88')][_0xdd58e0])){_0x50c936=_[_0x70ac('0x61')](_0x268334,function(_0x58ff7f){return _0x58ff7f['id']===_0x3b199f[_0x70ac('0x88')][_0xdd58e0];});if(!_['isNil'](_0x50c936)){_0x34f4e8=_0x50c936[_0x70ac('0x86')];}}}else{if(!_[_0x70ac('0x54')](_0x3b199f[_0x70ac('0x87')][_0xdd58e0])){_0x50c936=_[_0x70ac('0x61')](_0x268334,function(_0x54ccec){return _0x54ccec['id']===_0x3b199f[_0x70ac('0x87')][_0xdd58e0][_0x70ac('0x89')];});if(!_[_0x70ac('0x54')](_0x50c936)){_0x34f4e8=_0xdd58e0;}}}if(_[_0x70ac('0x54')](_0x34f4e8)){_0x34f4e8=0x64;}_0x2f5882[_0x70ac('0x5c')](addAdditionalPhone(_0x3b199f['id'],_0x3b199f[_0x70ac('0x87')][_0xdd58e0]['phone'],_0x3b199f[_0x70ac('0x88')]?_[_0x70ac('0x54')](_0x3b199f['item_types'][_0xdd58e0])?null:_0x3b199f['item_types'][_0xdd58e0]:_0x3b199f[_0x70ac('0x87')][_0xdd58e0]['ItemTypeId']?_0x3b199f['items'][_0xdd58e0]['ItemTypeId']:null,_0x34f4e8,_0x81685e));}Promise[_0x70ac('0x84')](_0x2f5882)[_0x70ac('0x18')](function(){db[_0x70ac('0x24')][_0x70ac('0x17')]({'AdditionalPhones':_0x5b67e5},{'where':{'id':_0x3b199f['id']}})[_0x70ac('0x18')](function(){_0x1856ce(0x1);});});});});});}function addAdditionalPhone(_0xd581d0,_0x218d16,_0x4706ba,_0x23b56a,_0x187754){return db[_0x70ac('0x47')][_0x70ac('0x61')]({'where':{'CmContactId':_0xd581d0,'item':_0x218d16}})[_0x70ac('0x18')](function(_0x1f7578){if(_0x1f7578)logger[_0x70ac('0x32')](_0x70ac('0x8b'),_0x1f7578);else{db[_0x70ac('0x47')][_0x70ac('0x3e')]({'CmContactId':_0xd581d0,'item':_0x218d16,'ItemTypeId':_0x4706ba,'OrderBy':_0x23b56a,'ItemClass':_0x70ac('0x8c'),'description':_0x187754});}});}function deleteCmHopperPhones(_0x16f008){return new Promise(function(_0x198d18){return db[_0x70ac('0x3b')][_0x70ac('0x21')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x16f008}})['then'](function(_0x20af8e){db[_0x70ac('0x8d')][_0x70ac('0x19')]({'where':{'CmHopperId':{'$in':_['map'](_0x20af8e,'id')}}});})['then'](function(){_0x198d18(0x1);});});}function addCmHopperPhones(_0x191201){return new Promise(function(_0x51e19b){return db['CmHopper'][_0x70ac('0x21')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x191201}})['then'](function(_0x48a9b5){var _0x51c439=[];_[_0x70ac('0x6a')](_0x48a9b5,function(_0x285a93){_0x51c439[_0x70ac('0x5c')](createCmHopperPhone(_0x191201,_0x285a93['id']));});Promise['all'](_0x51c439)[_0x70ac('0x18')](function(){_0x51e19b(0x1);});});});}function createCmHopperPhone(_0x4a2822,_0x2555fe){return new Promise(function(_0x31952f){db[_0x70ac('0x47')]['findAll']({'raw':!![],'attributes':[_0x70ac('0x8e'),_0x70ac('0x86')],'where':{'CmContactId':_0x4a2822,'ItemClass':_0x70ac('0x8c')},'include':[{'model':db[_0x70ac('0x85')],'attributes':[_0x70ac('0x86')],'as':_0x70ac('0x66')}],'order':[_0x70ac('0x86'),db[_0x70ac('0x67')]['literal']('`ItemType`.OrderBy')]})[_0x70ac('0x18')](function(_0x1ff81c){var _0x1154be=0x1;var _0x3da3f5=_[_0x70ac('0x6a')](_0x1ff81c,function(_0x21a1a2){_0x21a1a2[_0x70ac('0x8f')]=_0x2555fe;_0x21a1a2[_0x70ac('0x73')]=_0x21a1a2[_0x70ac('0x8e')];_0x21a1a2['OrderBy']=_0x1154be;delete _0x21a1a2[_0x70ac('0x90')];_0x1154be=_0x1154be+0x1;return _0x21a1a2;});return db[_0x70ac('0x8d')][_0x70ac('0x59')](_0x3da3f5,{});})[_0x70ac('0x18')](function(){_0x31952f(0x1);});});}function insertAdditionalPhones(_0x2ebfbf,_0x3f1d83){return new Promise(function(_0x13e0cb){var _0x1db37a=[];for(var _0x13bb53=0x0;_0x13bb53<_0x3f1d83[_0x70ac('0x28')];_0x13bb53++){var _0x11525b=_0x3f1d83[_0x13bb53];_0x1db37a[_0x70ac('0x5c')](parseContactItemType(_0x11525b));}Promise['all'](_0x1db37a)[_0x70ac('0x18')](function(){var _0x1eb3cc={'id':_0x2ebfbf['id'],'items':_0x3f1d83};return addAdditionalPhones(_0x1eb3cc)['then'](function(){return addCmHopperPhones(_0x2ebfbf['id']);});})['then'](function(){_0x13e0cb(_0x2ebfbf);});});}function parseContactItemType(_0x5b1d92){return new Promise(function(_0x17ef80){if(_0x5b1d92[_0x70ac('0x35')](_0x70ac('0x89'))){_0x17ef80(_0x5b1d92);}else{return db[_0x70ac('0x85')][_0x70ac('0x61')]({'where':{'name':_0x5b1d92[_0x70ac('0x66')]}})[_0x70ac('0x18')](function(_0x54d290){if(_[_0x70ac('0x54')](_0x54d290))_0x5b1d92['ItemTypeId']=null;else _0x5b1d92['ItemTypeId']=_0x54d290['id'];_0x17ef80(_0x5b1d92);});}});}exports[_0x70ac('0x91')]=function(_0x4872ef,_0x4a3969){return db[_0x70ac('0x47')][_0x70ac('0x21')]({'raw':!![],'where':{'CmContactId':_0x4872ef[_0x70ac('0x25')]['id'],'ItemClass':_0x70ac('0x8c')},'include':[{'model':db[_0x70ac('0x85')],'as':_0x70ac('0x66')}],'order':[[_0x70ac('0x86')],[db[_0x70ac('0x67')][_0x70ac('0x92')](_0x70ac('0x93'))]]})[_0x70ac('0x18')](function(_0x314592){return _0x314592;})[_0x70ac('0x18')](respondWithResult(_0x4a3969,null))['catch'](handleError(_0x4a3969,null));};exports['duplicateAdditionalPhones']=function(_0x1ac4a6,_0x2b5825){return db[_0x70ac('0x47')][_0x70ac('0x21')]({'raw':!![],'where':{'CmContactId':_0x1ac4a6[_0x70ac('0x36')]['fromContactId']}})[_0x70ac('0x18')](function(_0x41891c){var _0xe5546b=_['map'](_0x41891c,function(_0x5a5b58){_0x5a5b58['CmContactId']=_0x1ac4a6[_0x70ac('0x36')][_0x70ac('0x94')];return _0x5a5b58;});return db[_0x70ac('0x47')][_0x70ac('0x59')](_0xe5546b,{});})[_0x70ac('0x18')](function(){return addCmHopperPhones(_0x1ac4a6[_0x70ac('0x36')][_0x70ac('0x94')]);})['then'](function(){return['ok'];})['then'](respondWithResult(_0x2b5825,null))[_0x70ac('0x26')](handleError(_0x2b5825,null));};exports['rescheduleAdditionalPhones']=function(_0x33057c,_0x1eaf4b){var _0x4e6857=[];_0x4e6857[_0x70ac('0x5c')](createCmHopperPhone(_0x33057c[_0x70ac('0x36')]['id'],_0x33057c[_0x70ac('0x36')][_0x70ac('0x95')]));Promise[_0x70ac('0x84')](_0x4e6857)[_0x70ac('0x18')](function(){return[0x1];})[_0x70ac('0x18')](respondWithResult(_0x1eaf4b,null));};exports[_0x70ac('0x96')]=function(_0x564db3,_0x4719b4){var _0x27eecf={'raw':![],'where':{}};var _0x6e7e88={};var _0x4f6117={'count':0x0,'rows':[]};return db[_0x70ac('0x24')][_0x70ac('0x74')]({'where':{'id':_0x564db3[_0x70ac('0x25')]['id']}})[_0x70ac('0x18')](handleEntityNotFound(_0x4719b4,null))[_0x70ac('0x18')](function(_0x4e1b44){if(_0x4e1b44){_0x6e7e88['model']=_[_0x70ac('0x29')](db[_0x70ac('0x3b')][_0x70ac('0x75')]);_0x6e7e88[_0x70ac('0x22')]=_[_0x70ac('0x29')](_0x564db3[_0x70ac('0x22')]);_0x6e7e88[_0x70ac('0x76')]=_[_0x70ac('0x77')](_0x6e7e88[_0x70ac('0x79')],_0x6e7e88[_0x70ac('0x22')]);_0x27eecf['attributes']=_[_0x70ac('0x77')](_0x6e7e88['model'],qs['fields'](_0x564db3['query'][_0x70ac('0x7a')]));_0x27eecf['attributes']=_0x27eecf[_0x70ac('0x78')]['length']?_0x27eecf[_0x70ac('0x78')]:_0x6e7e88[_0x70ac('0x79')];if(!_0x564db3[_0x70ac('0x22')][_0x70ac('0x35')](_0x70ac('0x97'))){_0x27eecf[_0x70ac('0x12')]=qs[_0x70ac('0x12')](_0x564db3['query'][_0x70ac('0x12')]);_0x27eecf[_0x70ac('0x14')]=qs[_0x70ac('0x14')](_0x564db3[_0x70ac('0x22')][_0x70ac('0x14')]);}_0x27eecf[_0x70ac('0x7b')]=qs['sort'](_0x564db3['query'][_0x70ac('0x7c')]);_0x27eecf[_0x70ac('0x5b')]=qs['filters'](_[_0x70ac('0x7d')](_0x564db3[_0x70ac('0x22')],_0x6e7e88[_0x70ac('0x76')]));_0x27eecf[_0x70ac('0x5b')]['ContactId']=_0x4e1b44['id'];if(_0x564db3[_0x70ac('0x22')][_0x70ac('0x98')]){_0x27eecf[_0x70ac('0x5b')]=_[_0x70ac('0x7e')](_0x27eecf['where'],{'$or':_['map'](_0x27eecf[_0x70ac('0x78')],function(_0x15e990){var _0x27d8cd={};_0x27d8cd[_0x15e990]={'$like':'%'+_0x564db3[_0x70ac('0x22')][_0x70ac('0x98')]+'%'};return _0x27d8cd;})});}_0x27eecf=_[_0x70ac('0x7e')]({},_0x27eecf,_0x564db3[_0x70ac('0x7f')]);return db[_0x70ac('0x3b')][_0x70ac('0x13')]({'where':_0x27eecf['where']})[_0x70ac('0x18')](function(_0x17f289){_0x4f6117[_0x70ac('0x13')]=_0x17f289;if(_0x564db3[_0x70ac('0x22')][_0x70ac('0x99')]){_0x27eecf[_0x70ac('0x9a')]=[{'all':!![]}];}return db[_0x70ac('0x3b')][_0x70ac('0x21')](_0x27eecf);})['then'](function(_0x2bce67){_0x4f6117[_0x70ac('0x9b')]=_0x2bce67;return _0x4f6117;});}})[_0x70ac('0x18')](respondWithFilteredResult(_0x4719b4,_0x27eecf))[_0x70ac('0x26')](handleError(_0x4719b4,null));};exports[_0x70ac('0x9c')]=function(_0x3b3be2,_0xeb5bec){var _0x31b789={'raw':!![],'where':{}};var _0x2ebda0={};var _0x59cb21={'count':0x0,'rows':[]};return db[_0x70ac('0x24')][_0x70ac('0x74')]({'where':{'id':_0x3b3be2[_0x70ac('0x25')]['id']}})['then'](handleEntityNotFound(_0xeb5bec,null))['then'](function(_0x5d2321){if(_0x5d2321){_0x2ebda0[_0x70ac('0x79')]=_[_0x70ac('0x29')](db[_0x70ac('0x49')][_0x70ac('0x75')]);_0x2ebda0[_0x70ac('0x22')]=_[_0x70ac('0x29')](_0x3b3be2['query']);_0x2ebda0[_0x70ac('0x76')]=_['intersection'](_0x2ebda0['model'],_0x2ebda0['query']);_0x31b789[_0x70ac('0x78')]=_[_0x70ac('0x77')](_0x2ebda0[_0x70ac('0x79')],qs[_0x70ac('0x7a')](_0x3b3be2[_0x70ac('0x22')][_0x70ac('0x7a')]));_0x31b789[_0x70ac('0x78')]=_0x31b789['attributes'][_0x70ac('0x28')]?_0x31b789['attributes']:_0x2ebda0[_0x70ac('0x79')];if(!_0x3b3be2[_0x70ac('0x22')][_0x70ac('0x35')]('nolimit')){_0x31b789['limit']=qs[_0x70ac('0x12')](_0x3b3be2[_0x70ac('0x22')]['limit']);_0x31b789['offset']=qs[_0x70ac('0x14')](_0x3b3be2['query'][_0x70ac('0x14')]);}_0x31b789[_0x70ac('0x7b')]=qs['sort'](_0x3b3be2[_0x70ac('0x22')][_0x70ac('0x7c')]);_0x31b789[_0x70ac('0x5b')]=qs[_0x70ac('0x76')](_['pick'](_0x3b3be2['query'],_0x2ebda0[_0x70ac('0x76')]));_0x31b789['where'][_0x70ac('0x9d')]=_0x5d2321['id'];if(_0x3b3be2[_0x70ac('0x22')]['filter']){_0x31b789[_0x70ac('0x5b')]=_[_0x70ac('0x7e')](_0x31b789[_0x70ac('0x5b')],{'$or':_[_0x70ac('0x6a')](_0x31b789['attributes'],function(_0x19c8df){var _0x430b9c={};_0x430b9c[_0x19c8df]={'$like':'%'+_0x3b3be2['query'][_0x70ac('0x98')]+'%'};return _0x430b9c;})});}_0x31b789=_[_0x70ac('0x7e')]({},_0x31b789,_0x3b3be2[_0x70ac('0x7f')]);return db[_0x70ac('0x49')][_0x70ac('0x13')]({'where':_0x31b789['where']})[_0x70ac('0x18')](function(_0x30c6f3){_0x59cb21[_0x70ac('0x13')]=_0x30c6f3;if(_0x3b3be2['query'][_0x70ac('0x99')]){_0x31b789[_0x70ac('0x9a')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x70ac('0x21')](_0x31b789);})['then'](function(_0x29fa4a){_0x59cb21[_0x70ac('0x9b')]=_0x29fa4a;return _0x59cb21;});}})[_0x70ac('0x18')](respondWithFilteredResult(_0xeb5bec,_0x31b789))[_0x70ac('0x26')](handleError(_0xeb5bec,null));};exports[_0x70ac('0x9e')]=function(_0x52eb93,_0x39638d){var _0x71208d={'raw':!![],'where':{}};var _0x19ddb1={};var _0x5d1bda={'count':0x0,'rows':[]};return db['CmContact']['findOne']({'where':{'id':_0x52eb93[_0x70ac('0x25')]['id']}})['then'](handleEntityNotFound(_0x39638d,null))['then'](function(_0x3e3cc3){if(_0x3e3cc3){_0x19ddb1[_0x70ac('0x79')]=_['keys'](db[_0x70ac('0x48')][_0x70ac('0x75')]);_0x19ddb1['query']=_[_0x70ac('0x29')](_0x52eb93[_0x70ac('0x22')]);_0x19ddb1['filters']=_['intersection'](_0x19ddb1[_0x70ac('0x79')],_0x19ddb1[_0x70ac('0x22')]);_0x71208d[_0x70ac('0x78')]=_[_0x70ac('0x77')](_0x19ddb1[_0x70ac('0x79')],qs['fields'](_0x52eb93[_0x70ac('0x22')][_0x70ac('0x7a')]));_0x71208d[_0x70ac('0x78')]=_0x71208d['attributes']['length']?_0x71208d[_0x70ac('0x78')]:_0x19ddb1[_0x70ac('0x79')];if(!_0x52eb93['query']['hasOwnProperty'](_0x70ac('0x97'))){_0x71208d['limit']=qs[_0x70ac('0x12')](_0x52eb93[_0x70ac('0x22')][_0x70ac('0x12')]);_0x71208d[_0x70ac('0x14')]=qs['offset'](_0x52eb93[_0x70ac('0x22')][_0x70ac('0x14')]);}_0x71208d[_0x70ac('0x7b')]=qs[_0x70ac('0x7c')](_0x52eb93[_0x70ac('0x22')][_0x70ac('0x7c')]);_0x71208d[_0x70ac('0x5b')]=qs[_0x70ac('0x76')](_['pick'](_0x52eb93[_0x70ac('0x22')],_0x19ddb1['filters']));_0x71208d[_0x70ac('0x5b')][_0x70ac('0x9d')]=_0x3e3cc3['id'];if(_0x52eb93[_0x70ac('0x22')]['filter']){_0x71208d['where']=_['merge'](_0x71208d['where'],{'$or':_['map'](_0x71208d[_0x70ac('0x78')],function(_0x5c7fd2){var _0x1bbdb2={};_0x1bbdb2[_0x5c7fd2]={'$like':'%'+_0x52eb93['query']['filter']+'%'};return _0x1bbdb2;})});}_0x71208d=_['merge']({},_0x71208d,_0x52eb93['options']);return db[_0x70ac('0x48')]['count']({'where':_0x71208d[_0x70ac('0x5b')]})[_0x70ac('0x18')](function(_0x209cb0){_0x5d1bda[_0x70ac('0x13')]=_0x209cb0;if(_0x52eb93[_0x70ac('0x22')][_0x70ac('0x99')]){_0x71208d['include']=[{'all':!![]}];}return db[_0x70ac('0x48')][_0x70ac('0x21')](_0x71208d);})[_0x70ac('0x18')](function(_0x5cec47){_0x5d1bda['rows']=_0x5cec47;return _0x5d1bda;});}})['then'](respondWithFilteredResult(_0x39638d,_0x71208d))[_0x70ac('0x26')](handleError(_0x39638d,null));};exports['getJscriptySessions']=function(_0x2afd79,_0x47491f){var _0x4bfd1e={'raw':!![],'where':{}};var _0x1a7940={};var _0x1e2e90={'count':0x0,'rows':[]};return db['CmContact'][_0x70ac('0x74')]({'where':{'id':_0x2afd79[_0x70ac('0x25')]['id']}})[_0x70ac('0x18')](handleEntityNotFound(_0x47491f,null))[_0x70ac('0x18')](function(_0x55cea8){if(_0x55cea8){_0x1a7940[_0x70ac('0x79')]=_[_0x70ac('0x29')](db[_0x70ac('0x9f')][_0x70ac('0x75')]);_0x1a7940[_0x70ac('0x22')]=_[_0x70ac('0x29')](_0x2afd79[_0x70ac('0x22')]);_0x1a7940['filters']=_[_0x70ac('0x77')](_0x1a7940[_0x70ac('0x79')],_0x1a7940[_0x70ac('0x22')]);_0x4bfd1e['attributes']=_[_0x70ac('0x77')](_0x1a7940[_0x70ac('0x79')],qs[_0x70ac('0x7a')](_0x2afd79[_0x70ac('0x22')][_0x70ac('0x7a')]));_0x4bfd1e[_0x70ac('0x78')]=_0x4bfd1e[_0x70ac('0x78')]['length']?_0x4bfd1e['attributes']:_0x1a7940['model'];if(!_0x2afd79[_0x70ac('0x22')]['hasOwnProperty']('nolimit')){_0x4bfd1e[_0x70ac('0x12')]=qs['limit'](_0x2afd79[_0x70ac('0x22')][_0x70ac('0x12')]);_0x4bfd1e[_0x70ac('0x14')]=qs['offset'](_0x2afd79[_0x70ac('0x22')]['offset']);}_0x4bfd1e[_0x70ac('0x7b')]=qs[_0x70ac('0x7c')](_0x2afd79[_0x70ac('0x22')][_0x70ac('0x7c')]);_0x4bfd1e[_0x70ac('0x5b')]=qs['filters'](_[_0x70ac('0x7d')](_0x2afd79[_0x70ac('0x22')],_0x1a7940['filters']));_0x4bfd1e['where']['ContactId']=_0x55cea8['id'];if(_0x2afd79[_0x70ac('0x22')][_0x70ac('0x98')]){_0x4bfd1e['where']=_['merge'](_0x4bfd1e[_0x70ac('0x5b')],{'$or':_[_0x70ac('0x6a')](_0x4bfd1e[_0x70ac('0x78')],function(_0x467bd6){var _0x493c0b={};_0x493c0b[_0x467bd6]={'$like':'%'+_0x2afd79['query'][_0x70ac('0x98')]+'%'};return _0x493c0b;})});}_0x4bfd1e=_['merge']({},_0x4bfd1e,_0x2afd79['options']);return db[_0x70ac('0x9f')]['count']({'where':_0x4bfd1e['where']})[_0x70ac('0x18')](function(_0x8cd859){_0x1e2e90[_0x70ac('0x13')]=_0x8cd859;if(_0x2afd79[_0x70ac('0x22')]['includeAll']){_0x4bfd1e[_0x70ac('0x9a')]=[{'all':!![]}];}return db[_0x70ac('0x9f')]['findAll'](_0x4bfd1e);})['then'](function(_0x5c7bff){_0x1e2e90[_0x70ac('0x9b')]=_0x5c7bff;return _0x1e2e90;});}})[_0x70ac('0x18')](respondWithFilteredResult(_0x47491f,_0x4bfd1e))[_0x70ac('0x26')](handleError(_0x47491f,null));};exports[_0x70ac('0xa0')]=function(_0x2c3e75,_0x10afaf){try{if(!_0x2c3e75[_0x70ac('0x36')][_0x70ac('0x5d')]){throw new Error(_0x70ac('0xa1'));}if(!_0x2c3e75['body'][_0x70ac('0xa2')]){throw new Error(_0x70ac('0xa3'));}if(!_0x2c3e75['body'][_0x70ac('0xa4')]){throw new Error(_0x70ac('0xa5'));}if(!_0x2c3e75[_0x70ac('0x36')][_0x70ac('0xa6')]){throw new Error(_0x70ac('0xa7'));}var _0x1dca11=_0x2c3e75[_0x70ac('0x36')][_0x70ac('0xa2')][_0x70ac('0xa8')](',');var _0x1d2033=_0x2c3e75[_0x70ac('0x36')][_0x70ac('0xa4')][_0x70ac('0xa8')](',');if(!_0x1dca11[_0x70ac('0x28')]||!_0x1d2033[_0x70ac('0x28')]||_0x1dca11[_0x70ac('0x28')]!==_0x1d2033[_0x70ac('0x28')]){throw new Error(_0x70ac('0xa9'));}_0x2c3e75[_0x70ac('0x36')]['fields']=_[_0x70ac('0xaa')](_0x1dca11,_0x1d2033);if(!_0x2c3e75['body']['fields'][_0x70ac('0x73')]){throw new Error(_0x70ac('0xab'));}if(!_0x2c3e75[_0x70ac('0x36')][_0x70ac('0x7a')]['firstName']){throw new Error(_0x70ac('0xac'));}var _0x20667f=path[_0x70ac('0x3a')](config[_0x70ac('0xad')],_0x70ac('0xae'),_0x2c3e75['file'][_0x70ac('0xaf')]);fs['chmodSync'](_0x20667f,parseInt(_0x70ac('0xb0'),0x8));var _0x198594=require(_0x70ac('0xb1'))['fork'](path['join'](__dirname,_0x70ac('0xb2')),[_0x20667f,_0x2c3e75[_0x70ac('0x36')][_0x70ac('0xa2')],_0x2c3e75[_0x70ac('0x36')][_0x70ac('0xa4')],_0x2c3e75['body'][_0x70ac('0x5d')],_0x2c3e75[_0x70ac('0x36')][_0x70ac('0xb3')],_0x2c3e75[_0x70ac('0x36')][_0x70ac('0x5a')],_0x2c3e75['body'][_0x70ac('0xa6')]]);return _0x10afaf[_0x70ac('0xf')](0xc8)[_0x70ac('0x10')]({'message':_0x70ac('0xb4'),'pid':_0x198594[_0x70ac('0xb5')]});}catch(_0x599019){return _0x10afaf[_0x70ac('0xf')](0x1f4)[_0x70ac('0x1e')](_0x599019);}};exports['upload']=function(_0xf7f4c5,_0x404f1b){var _0x5d8471=fs[_0x70ac('0xb6')](_0xf7f4c5['file'][_0x70ac('0x1')]);Papa[_0x70ac('0xb7')](_0x5d8471,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x5a26ee){return _0x404f1b[_0x70ac('0xf')](0xc8)[_0x70ac('0x10')]({'file':_0xf7f4c5[_0x70ac('0xb8')],'fields':_0x5a26ee[_0x70ac('0xb9')]['fields']});}});};exports[_0x70ac('0xba')]=function(_0x41c9f6,_0x50c372){return db[_0x70ac('0xbb')][_0x70ac('0x21')]({'raw':!![],'attributes':['id'],'where':{'role':_0x70ac('0xbc')}})[_0x70ac('0x18')](function(_0x286766){var _0x21be76=![];if(!_0x41c9f6[_0x70ac('0x36')][_0x70ac('0x5d')]){throw new Error(_0x70ac('0xa1'));}if(!_0x41c9f6[_0x70ac('0x36')]['binding'][_0x70ac('0x73')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x41c9f6[_0x70ac('0x36')]['binding'][_0x70ac('0xbd')]){throw new Error(_0x70ac('0xac'));}if(!_0x41c9f6[_0x70ac('0x36')][_0x70ac('0xa6')]){throw new Error(_0x70ac('0xa7'));}var _0x5c2202=require(_0x70ac('0xb1'))[_0x70ac('0xbe')](path['join'](__dirname,'../../components/import/cm/csv2'),[_0x41c9f6[_0x70ac('0x25')]['id'],JSON[_0x70ac('0xbf')](_0x41c9f6[_0x70ac('0x36')]),JSON['stringify'](_0x286766)]);_0x5c2202['on'](_0x70ac('0xc0'),function(){_0x21be76=!![];return _0x50c372[_0x70ac('0xf')](0xc8)[_0x70ac('0x10')]({'message':_0x70ac('0xc1'),'pid':_0x5c2202[_0x70ac('0xb5')]});});_0x5c2202['on']('exit',function(_0x71bf47){if(_0x71bf47&&!_0x21be76){return _0x50c372['status'](0x1f4)[_0x70ac('0x10')]({'message':_0x70ac('0xc2'),'pid':_0x5c2202[_0x70ac('0xb5')]});}});})['catch'](handleError(_0x50c372,null));};exports[_0x70ac('0xc3')]=function(_0x457851,_0xdc10){return db[_0x70ac('0xbb')][_0x70ac('0x21')]({'raw':!![],'attributes':['id'],'where':{'role':'agent'}})[_0x70ac('0x18')](function(_0x54c2e0){var _0x505c27=![];if(!_0x457851[_0x70ac('0x36')][_0x70ac('0x5d')]){throw new Error(_0x70ac('0xa1'));}if(!_0x457851['body'][_0x70ac('0xc4')][_0x70ac('0x73')]){throw new Error(_0x70ac('0xab'));}if(!_0x457851[_0x70ac('0x36')][_0x70ac('0xc4')]['firstName']){throw new Error(_0x70ac('0xac'));}if(!_0x457851[_0x70ac('0x36')][_0x70ac('0xa6')]){throw new Error(_0x70ac('0xa7'));}var _0x51e1bb=require(_0x70ac('0xb1'))[_0x70ac('0xbe')](path[_0x70ac('0x3a')](__dirname,_0x70ac('0xc5')),[_0x457851[_0x70ac('0x25')]['id'],JSON['stringify'](_0x457851[_0x70ac('0x36')]),JSON[_0x70ac('0xbf')](_0x54c2e0)]);_0x51e1bb['on'](_0x70ac('0xc0'),function(){_0x505c27=!![];return _0xdc10['status'](0xc8)[_0x70ac('0x10')]({'message':_0x70ac('0xc1'),'pid':_0x51e1bb[_0x70ac('0xb5')]});});_0x51e1bb['on'](_0x70ac('0xc6'),function(_0x5ee7a8){if(_0x5ee7a8&&!_0x505c27){return _0xdc10[_0x70ac('0xf')](0x1f4)['json']({'message':_0x70ac('0xc2'),'pid':_0x51e1bb['pid']});}});})[_0x70ac('0x26')](handleError(_0xdc10,null));};exports[_0x70ac('0xc7')]=function(_0x51a5df,_0x5de270){var _0x599d3e=[_0x70ac('0xc8'),_0x70ac('0xc9'),_0x70ac('0xca'),_0x70ac('0xcb'),_0x70ac('0xcc'),'whatsapp',_0x70ac('0xcd')];var _0x4fd364={'offset':0x0,'order':qs[_0x70ac('0x7c')](_0x70ac('0xce'))},_0x9ecd5d={'count':0x0,'rows':[]};Promise['resolve']()[_0x70ac('0x18')](function(){if(_0x51a5df['query']['channel']){if(!_[_0x70ac('0xcf')](_0x599d3e,_0x51a5df[_0x70ac('0x22')][_0x70ac('0xd0')][_0x70ac('0xd1')]())){throw new Error('Invalid\x20channel');}_0x599d3e=[_0x51a5df[_0x70ac('0x22')][_0x70ac('0xd0')][_0x70ac('0xd1')]()];}if(_0x51a5df['query'][_0x70ac('0xd2')]){try{var _0x43f7a8=JSON[_0x70ac('0xb7')](_0x51a5df[_0x70ac('0x22')][_0x70ac('0xd2')]);if(!moment(_0x43f7a8[_0x70ac('0x37')])[_0x70ac('0xd3')]()){throw new Error(_0x70ac('0xd4'));}if(!moment(_0x43f7a8['to'])[_0x70ac('0xd3')]()){throw new Error(_0x70ac('0xd5'));}}catch(_0xa8ee3f){throw new Error(_0x70ac('0xd6'));}}if(!_0x51a5df[_0x70ac('0x22')][_0x70ac('0x35')](_0x70ac('0x97'))){_0x4fd364['limit']=qs[_0x70ac('0x12')](_0x51a5df[_0x70ac('0x22')][_0x70ac('0x12')]||0xa);_0x4fd364[_0x70ac('0x14')]=qs[_0x70ac('0x14')](_0x51a5df['query'][_0x70ac('0x14')]);}var _0x27287=_0x599d3e[_0x70ac('0x6a')](function(_0x10b4b7){if(_0x10b4b7===_0x70ac('0xcd')){var _0x4f09f3={'attributes':['id','uniqueid','type',_0x70ac('0xd7'),'destination','callerid',_0x70ac('0xd8'),'endtime',_0x70ac('0xd9'),_0x70ac('0xda'),_0x70ac('0xdb'),_0x70ac('0xdc'),_0x70ac('0xdd'),_0x70ac('0xde'),_0x70ac('0xdf')],'where':{'ContactId':_0x51a5df[_0x70ac('0x25')]['id']},'include':[{'model':db[_0x70ac('0xbb')],'as':_0x70ac('0xbb'),'attributes':['id',_0x70ac('0x1d'),'fullname',_0x70ac('0x30')]}],'order':[[_0x70ac('0xdb'),_0x70ac('0xe0')]]};if(_0x51a5df[_0x70ac('0x22')][_0x70ac('0xd2')]){_0x4f09f3[_0x70ac('0x5b')][_0x70ac('0xdb')]={'$gte':_0x43f7a8[_0x70ac('0x37')],'$lte':_0x43f7a8['to']};}return db[_0x70ac('0xe1')]['findAndCountAll'](_0x4f09f3)[_0x70ac('0x18')](function(_0x1d1d05){_0x9ecd5d[_0x70ac('0x13')]+=_0x1d1d05[_0x70ac('0x13')];return _[_0x70ac('0x6a')](_0x1d1d05['rows'],function(_0x3382c2){var _0x44bb89=_0x3382c2[_0x70ac('0x38')]({'plain':!![]});_0x44bb89['channel']=_0x10b4b7;if(_0x44bb89[_0x70ac('0xbb')]){_0x44bb89['User']={'id':_0x44bb89[_0x70ac('0xbb')]['id'],'name':_0x44bb89[_0x70ac('0xbb')]['name'],'fullname':_0x44bb89['User'][_0x70ac('0xe2')],'alias':_0x44bb89[_0x70ac('0xbb')][_0x70ac('0x30')]};}return _0x44bb89;});});}else{var _0x2ee8d9=_[_0x70ac('0xe3')](_0x10b4b7)+(_0x10b4b7==='chat'?_0x70ac('0xe4'):_0x70ac('0xe5'));var _0x4ab19f={'attributes':['id',_0x70ac('0xe6'),_0x70ac('0xe7'),_0x70ac('0xdb'),_0x70ac('0xda'),_0x70ac('0xe8'),_0x70ac('0xe9'),'thirdDisposition','UserId',_0x2ee8d9+'Id'],'where':{'ContactId':_0x51a5df['params']['id']},'include':[{'model':db[_0x2ee8d9],'as':_0x70ac('0xe5'),'attributes':['id',_0x70ac('0x1d'),_0x70ac('0xea')]},{'model':db[_0x70ac('0xbb')],'as':_0x70ac('0xeb'),'attributes':['id','name',_0x70ac('0xe2')]},{'model':db['Tag'],'as':_0x70ac('0x63'),'attributes':['id',_0x70ac('0x1d'),_0x70ac('0x64')],'through':{'attributes':[]}}],'order':[[_0x70ac('0xdb'),_0x70ac('0xe0')]]};if(_0x51a5df[_0x70ac('0x22')][_0x70ac('0xd2')]){_0x4ab19f[_0x70ac('0x5b')][_0x70ac('0xdb')]={'$gte':_0x43f7a8[_0x70ac('0x37')],'$lte':_0x43f7a8['to']};}switch(_0x10b4b7){case _0x70ac('0xc9'):_0x4ab19f[_0x70ac('0x78')]['push'](_0x70ac('0xec'),_0x70ac('0xed'),_0x70ac('0xee'),_0x70ac('0xef'),_0x70ac('0xf0'),_0x70ac('0xf1'),_0x70ac('0xf2'),_0x70ac('0xf3'),_0x70ac('0xf4'));break;case _0x70ac('0xc8'):_0x4ab19f[_0x70ac('0x78')][_0x70ac('0x5c')](_0x70ac('0xf5'),_0x70ac('0xf6'));break;case'openchannel':_0x4ab19f[_0x70ac('0x78')][_0x70ac('0x5c')](_0x70ac('0xf7'),_0x70ac('0xf8'));break;}return db[_[_0x70ac('0xe3')](_0x10b4b7)+_0x70ac('0xf9')][_0x70ac('0xfa')](_0x4ab19f)[_0x70ac('0x18')](function(_0x2bffd5){_0x9ecd5d[_0x70ac('0x13')]+=_0x2bffd5[_0x70ac('0x13')];return _[_0x70ac('0x6a')](_0x2bffd5['rows'],function(_0x35c3df){var _0x35b843=_0x35c3df[_0x70ac('0x38')]({'plain':!![]});_0x35b843[_0x70ac('0xd0')]=_0x10b4b7;if(_0x35b843['Owner']){_0x35b843[_0x70ac('0xeb')]={'id':_0x35b843[_0x70ac('0xeb')]['id'],'name':_0x35b843[_0x70ac('0xeb')][_0x70ac('0x1d')],'fullname':_0x35b843[_0x70ac('0xeb')][_0x70ac('0xe2')]};}return _0x35b843;});});}});return Promise['all'](_0x27287);})[_0x70ac('0x18')](function(_0x24921e){return _(_0x24921e)[_0x70ac('0xfb')]()[_0x70ac('0xfc')]('createdAt')[_0x70ac('0xfd')]()[_0x70ac('0xfe')]();})[_0x70ac('0x18')](function(_0x5b513b){_0x9ecd5d[_0x70ac('0x9b')]=_0x4fd364[_0x70ac('0x12')]?_0x5b513b[_0x70ac('0xff')](_0x4fd364[_0x70ac('0x14')],_0x4fd364[_0x70ac('0x14')]+_0x4fd364[_0x70ac('0x12')]):_0x5b513b;return _0x9ecd5d;})[_0x70ac('0x18')](respondWithFilteredResult(_0x5de270,_0x4fd364))['catch'](handleError(_0x5de270,null));}; \ No newline at end of file +var _0xe847=['params','tags','keys','startsWith','cf_','columnName','CmCustomField','length','alias','type','values','info','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','hasOwnProperty','merge','body','from','get','mergeWith','isArray','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','destroy','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','create','ChatInteraction','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','CmHopperHistory','VoiceCallReport','FaxQueueReport','OpenchannelQueueReport','SmsQueueReport','join','isNil','dialTimezone','timezones','utcOffset','additionalPhones','bulkCreate','duplicates','where','$or','push','ListId','spread','contact','all','show','Tag','Tags','tag','CmContactHasItem','Phones','ContactItemType','ItemType','sequelize','$and','omit','map','format','cf_%d','pickBy','isEmpty','table','cm_contacts','setFields','id\x20=\x20?','toParam','text','phone','getTags','findOne','model','rawAttributes','filters','intersection','attributes','fields','order','sort','pick','filter','nolimit','setTags','ids','setAdditionalPhones','OrderBy','item_types','items','description','ItemTypeId','contact\x20phone\x20exists','`ItemType`.OrderBy','CmHopperId','item','CmHopperAdditionalPhone','getAdditionalPhones','PHONE','duplicateAdditionalPhones','fromContactId','toContactId','hopperId','getHoppers','ContactId','include','rows','getHopperHistories','includeAll','getHopperFinals','options','CmHopperFinal','getJscriptySessions','JscriptySessionReport','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','filename','chmodSync','0777','fork','../../components/import/cm/csv','File\x20uploaded\x20correctly!','pid','send','upload','parse','file','meta','import','agent','binding','child_process','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','error\x20child\x20process','importUpdates','../../components/import/cm/csvUpdates','exit','getJourney','mail','chat','sms','fax','whatsapp','voice','-createdAt','resolve','channel','includes','toLowerCase','Invalid\x20channel','range','isValid','Invalid\x20createdAt\x20filter','uniqueid','destination','callerid','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','User','DESC','findAndCountAll','fullname','Website','Account','closed','closedAt','secondDisposition','thirdDisposition','key','browserName','customerPort','deviceModel','osName','ratingMessage','ratingType','ratingValue','referer','openchannel','externalUrl','threadId','startCase','Interaction','Owner','flatten','sortBy','reverse','value','moment','bluebird','util','path','lodash','papaparse','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmContact.socket','status','json','offset','undefined','limit','count','set','Content-Range','update','then','end','sendStatus','error','stack','name','index','describe','findAll','query','catch','CmContact','find'];(function(_0x41c1c2,_0x489715){var _0x5b8907=function(_0x8a7621){while(--_0x8a7621){_0x41c1c2['push'](_0x41c1c2['shift']());}};_0x5b8907(++_0x489715);}(_0xe847,0xd8));var _0x7e84=function(_0xfcedb8,_0x36442d){_0xfcedb8=_0xfcedb8-0x0;var _0x8b284=_0xe847[_0xfcedb8];return _0x8b284;};'use strict';var moment=require(_0x7e84('0x0'));var BPromise=require(_0x7e84('0x1'));var util=require(_0x7e84('0x2'));var path=require(_0x7e84('0x3'));var fs=require('fs');var _=require(_0x7e84('0x4'));var squel=require('squel');var Papa=require(_0x7e84('0x5'));var Redis=require('ioredis');var contacts=require(_0x7e84('0x6'));var qs=require(_0x7e84('0x7'));var logger=require(_0x7e84('0x8'))(_0x7e84('0x9'));var config=require(_0x7e84('0xa'));var shared=require('../../config/environment/shared');var db=require(_0x7e84('0xb'))['db'];config[_0x7e84('0xc')]=_[_0x7e84('0xd')](config['redis'],{'host':_0x7e84('0xe'),'port':0x18eb});var socket=require(_0x7e84('0xf'))(new Redis(config[_0x7e84('0xc')]));require(_0x7e84('0x10'))['register'](socket);function respondWithResult(_0x21f420,_0x398ce9){_0x398ce9=_0x398ce9||0xc8;return function(_0x25df42){if(_0x25df42){return _0x21f420[_0x7e84('0x11')](_0x398ce9)[_0x7e84('0x12')](_0x25df42);}};}function respondWithFilteredResult(_0x1b209b,_0x25d230){return function(_0x238ee5){if(_0x238ee5){var _0x4daa7c=typeof _0x25d230[_0x7e84('0x13')]===_0x7e84('0x14')&&typeof _0x25d230[_0x7e84('0x15')]==='undefined';var _0x3203f5=_0x238ee5[_0x7e84('0x16')];var _0x3e1168=_0x4daa7c?0x0:_0x25d230[_0x7e84('0x13')];var _0x443fdf=_0x4daa7c?_0x238ee5[_0x7e84('0x16')]:_0x25d230[_0x7e84('0x13')]+_0x25d230[_0x7e84('0x15')];var _0x7e7809;if(_0x443fdf>=_0x3203f5){_0x443fdf=_0x3203f5;_0x7e7809=0xc8;}else{_0x7e7809=0xce;}_0x1b209b[_0x7e84('0x11')](_0x7e7809);return _0x1b209b[_0x7e84('0x17')](_0x7e84('0x18'),_0x3e1168+'-'+_0x443fdf+'/'+_0x3203f5)['json'](_0x238ee5);}return null;};}function saveUpdates(_0x2b1819){return function(_0x5a69e9){if(_0x5a69e9){return _0x5a69e9[_0x7e84('0x19')](_0x2b1819)[_0x7e84('0x1a')](function(_0x1b0bdb){return _0x1b0bdb;});}return null;};}function removeEntity(_0x70b844){return function(_0x4bcea8){if(_0x4bcea8){return _0x4bcea8['destroy']()[_0x7e84('0x1a')](function(){_0x70b844[_0x7e84('0x11')](0xcc)[_0x7e84('0x1b')]();});}};}function handleEntityNotFound(_0x2aea9e){return function(_0x28301d){if(!_0x28301d){_0x2aea9e[_0x7e84('0x1c')](0x194);}return _0x28301d;};}function handleError(_0x5f0610,_0x589796){_0x589796=_0x589796||0x1f4;return function(_0x403d4d){logger[_0x7e84('0x1d')](_0x403d4d[_0x7e84('0x1e')]);if(_0x403d4d[_0x7e84('0x1f')]){delete _0x403d4d[_0x7e84('0x1f')];}_0x5f0610[_0x7e84('0x11')](_0x589796)['send'](_0x403d4d);};}exports[_0x7e84('0x20')]=function(_0x3f26e4,_0x4eb62f){var _0x56c20f={};return contacts[_0x7e84('0x21')]()[_0x7e84('0x1a')](function(_0xa4e395){_0x56c20f=qs['getOptions'](_0xa4e395,_0x3f26e4);return contacts[_0x7e84('0x22')](_0x3f26e4[_0x7e84('0x23')],_0x3f26e4['user'],_0x56c20f,_0xa4e395);})['then'](respondWithFilteredResult(_0x4eb62f,_0x56c20f))[_0x7e84('0x24')](handleError(_0x4eb62f,null));};exports['destroy']=function(_0x213d64,_0x48dfd4){return db[_0x7e84('0x25')][_0x7e84('0x26')]({'where':{'id':_0x213d64[_0x7e84('0x27')]['id']}})[_0x7e84('0x1a')](handleEntityNotFound(_0x48dfd4,null))['then'](removeEntity(_0x48dfd4,null))[_0x7e84('0x24')](handleError(_0x48dfd4,null));};exports[_0x7e84('0x21')]=function(_0x567736,_0x5ce5c8){return db[_0x7e84('0x25')]['describe']()[_0x7e84('0x1a')](function(_0x15dd68){delete _0x15dd68[_0x7e84('0x28')];for(var _0x3565ee=0x0;_0x3565ee0x0){return new Promise(function(_0xcd83b){var _0x46dbf2=[];for(var _0x446370=0x0;_0x446370<_0x49b4bf[_0x7e84('0x2e')];_0x446370++){_0x46dbf2[_0x7e84('0x59')](insertAdditionalPhones(_0x49b4bf[_0x446370][_0x7e84('0x5c')],_0x49b4bf[_0x446370][_0x7e84('0x54')]));}Promise[_0x7e84('0x5d')](_0x46dbf2)[_0x7e84('0x1a')](function(){_0xcd83b(0x1);});})[_0x7e84('0x1a')](function(){return{'success':_0x4c55b8,'failure':_0x5c2da3,'duplicates':_0x268c1f};});}else{return{'success':_0x4c55b8,'failure':_0x5c2da3,'duplicates':_0x268c1f};}}})['then'](respondWithResult(_0x13cbcf,0xc9))[_0x7e84('0x24')](handleError(_0x13cbcf,null));};exports[_0x7e84('0x5e')]=function(_0x2a5593,_0x369f93){var _0x37832c;return db['CmContact'][_0x7e84('0x21')]()['then'](function(_0x5d45f6){return db['CmContact'][_0x7e84('0x26')]({'where':{'id':_0x2a5593[_0x7e84('0x27')]['id']},'include':[{'model':db[_0x7e84('0x5f')],'as':_0x7e84('0x60'),'attributes':['id',_0x7e84('0x1f'),'color'],'required':_0x2a5593[_0x7e84('0x23')][_0x7e84('0x61')]?!![]:![]},{'model':db[_0x7e84('0x62')],'as':_0x7e84('0x63'),'where':{'CmContactId':_0x2a5593[_0x7e84('0x27')]['id']},'required':![],'include':[{'model':db[_0x7e84('0x64')],'as':_0x7e84('0x65')}]}],'order':[db[_0x7e84('0x66')]['literal']('Phones.OrderBy')],'attributes':_['keys'](_0x5d45f6)});})[_0x7e84('0x1a')](function(_0x4fd9f3){if(!_['isNil'](_0x4fd9f3)){_0x37832c=_0x4fd9f3[_0x7e84('0x38')]({'plain':!![]});var _0x503438={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x4fd9f3&&_0x4fd9f3['ListId']){if(_0x4fd9f3[_0x7e84('0x5a')]){_0x503438[_0x7e84('0x57')][_0x7e84('0x67')][_0x7e84('0x59')]({'ListId':{'$ne':_0x4fd9f3[_0x7e84('0x5a')]}});}}return db[_0x7e84('0x2d')][_0x7e84('0x22')](_0x503438);}})[_0x7e84('0x1a')](function(_0x418d58){if(!_[_0x7e84('0x50')](_0x418d58)){return _[_0x7e84('0x68')](_0x37832c,_[_0x7e84('0x69')](_0x418d58,function(_0x862e3c){return util[_0x7e84('0x6a')](_0x7e84('0x6b'),_0x862e3c['id']);}));}})['then'](handleEntityNotFound(_0x369f93,null))['then'](respondWithResult(_0x369f93,null))['catch'](handleError(_0x369f93,null));};exports['update']=function(_0x3996a5,_0x4c4083){var _0x16d9c5;if(_0x3996a5[_0x7e84('0x36')]['id']){delete _0x3996a5[_0x7e84('0x36')]['id'];}if(!_[_0x7e84('0x50')](_0x3996a5['body'][_0x7e84('0x51')])){var _0x81c8ac=_0x3996a5[_0x7e84('0x36')][_0x7e84('0x51')];if(!_[_0x7e84('0x50')](shared[_0x7e84('0x52')][_0x81c8ac]))_0x3996a5[_0x7e84('0x36')][_0x7e84('0x53')]=shared[_0x7e84('0x52')][_0x81c8ac]['utcOffset'];}return db[_0x7e84('0x25')][_0x7e84('0x26')]({'where':{'id':_0x3996a5[_0x7e84('0x27')]['id']}})[_0x7e84('0x1a')](handleEntityNotFound(_0x4c4083,null))[_0x7e84('0x1a')](saveUpdates(_0x3996a5[_0x7e84('0x36')],null))[_0x7e84('0x1a')](function(_0x2653b2){_0x16d9c5=_0x2653b2;var _0x4c4983={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x2653b2&&_0x2653b2[_0x7e84('0x5a')]){if(_0x2653b2['ListId']){_0x4c4983['where'][_0x7e84('0x67')][_0x7e84('0x59')]({'ListId':{'$ne':_0x2653b2['ListId']}});}}return db['CmCustomField'][_0x7e84('0x22')](_0x4c4983);})[_0x7e84('0x1a')](function(_0x2cb65f){if(_0x2cb65f){return _[_0x7e84('0x68')](_[_0x7e84('0x6c')](_0x3996a5['body'],function(_0x42ea76,_0x33cacd){return _[_0x7e84('0x2a')](_0x33cacd,_0x7e84('0x2b'));}),_[_0x7e84('0x69')](_0x2cb65f,function(_0x5cabb2){return util[_0x7e84('0x6a')](_0x7e84('0x6b'),_0x5cabb2['id']);}));}})[_0x7e84('0x1a')](function(_0x8e36ec){if(_0x8e36ec&&!_[_0x7e84('0x6d')](_0x8e36ec)){var _0x558e3a=squel[_0x7e84('0x19')]()[_0x7e84('0x6e')](_0x7e84('0x6f'))[_0x7e84('0x70')](_0x8e36ec)[_0x7e84('0x57')](_0x7e84('0x71'),_0x3996a5['params']['id'])[_0x7e84('0x72')]();return db['sequelize']['query'](_0x558e3a[_0x7e84('0x73')],{'replacements':_0x558e3a[_0x7e84('0x31')]});}})['then'](function(){if(_0x3996a5[_0x7e84('0x36')][_0x7e84('0x74')]&&_0x16d9c5){return db[_0x7e84('0x3c')][_0x7e84('0x19')]({'phone':_0x3996a5[_0x7e84('0x36')]['phone'],'OrderBy':0x0},{'where':{'ContactId':_0x16d9c5['id']}});}})[_0x7e84('0x1a')](function(){return _0x16d9c5;})['then'](respondWithResult(_0x4c4083,null))[_0x7e84('0x24')](handleError(_0x4c4083,null));};exports[_0x7e84('0x75')]=function(_0x5a396a,_0x2a1a90){var _0x41c3a8={};var _0x531f30={};var _0x15f7b6;var _0x34d4ab;return db[_0x7e84('0x25')][_0x7e84('0x76')]({'where':{'id':_0x5a396a[_0x7e84('0x27')]['id']}})[_0x7e84('0x1a')](handleEntityNotFound(_0x2a1a90,null))[_0x7e84('0x1a')](function(_0x1d36c4){if(_0x1d36c4){_0x15f7b6=_0x1d36c4;_0x531f30[_0x7e84('0x77')]=_['keys'](db['Tag'][_0x7e84('0x78')]);_0x531f30[_0x7e84('0x23')]=_['keys'](_0x5a396a[_0x7e84('0x23')]);_0x531f30[_0x7e84('0x79')]=_[_0x7e84('0x7a')](_0x531f30[_0x7e84('0x77')],_0x531f30[_0x7e84('0x23')]);_0x41c3a8[_0x7e84('0x7b')]=_['intersection'](_0x531f30[_0x7e84('0x77')],qs[_0x7e84('0x7c')](_0x5a396a[_0x7e84('0x23')]['fields']));_0x41c3a8[_0x7e84('0x7b')]=_0x41c3a8[_0x7e84('0x7b')][_0x7e84('0x2e')]?_0x41c3a8[_0x7e84('0x7b')]:_0x531f30['model'];_0x41c3a8[_0x7e84('0x7d')]=qs[_0x7e84('0x7e')](_0x5a396a[_0x7e84('0x23')]['sort']);_0x41c3a8[_0x7e84('0x57')]=qs[_0x7e84('0x79')](_[_0x7e84('0x7f')](_0x5a396a[_0x7e84('0x23')],_0x531f30[_0x7e84('0x79')]));if(_0x5a396a[_0x7e84('0x23')][_0x7e84('0x80')]){_0x41c3a8[_0x7e84('0x57')]=_[_0x7e84('0x35')](_0x41c3a8[_0x7e84('0x57')],{'$or':_[_0x7e84('0x69')](_0x41c3a8[_0x7e84('0x7b')],function(_0x446b46){var _0x126066={};_0x126066[_0x446b46]={'$like':'%'+_0x5a396a[_0x7e84('0x23')][_0x7e84('0x80')]+'%'};return _0x126066;})});}_0x41c3a8=_[_0x7e84('0x35')]({},_0x41c3a8,_0x5a396a['options']);return _0x15f7b6['getTags'](_0x41c3a8);}})['then'](function(_0x18a0da){if(_0x18a0da){_0x34d4ab=_0x18a0da['length'];if(!_0x5a396a[_0x7e84('0x23')][_0x7e84('0x34')](_0x7e84('0x81'))){_0x41c3a8[_0x7e84('0x15')]=qs[_0x7e84('0x15')](_0x5a396a[_0x7e84('0x23')][_0x7e84('0x15')]);_0x41c3a8[_0x7e84('0x13')]=qs[_0x7e84('0x13')](_0x5a396a[_0x7e84('0x23')]['offset']);}return _0x15f7b6[_0x7e84('0x75')](_0x41c3a8);}})[_0x7e84('0x1a')](function(_0x447ea9){if(_0x447ea9){return _0x447ea9?{'count':_0x34d4ab,'rows':_0x447ea9}:null;}})[_0x7e84('0x1a')](respondWithResult(_0x2a1a90,null))[_0x7e84('0x24')](handleError(_0x2a1a90,null));};exports[_0x7e84('0x82')]=function(_0x47f5bf,_0x585521){if(_0x47f5bf[_0x7e84('0x36')]['id']){delete _0x47f5bf[_0x7e84('0x36')]['id'];}return db[_0x7e84('0x25')][_0x7e84('0x76')]({'where':{'id':_0x47f5bf[_0x7e84('0x27')]['id']}})[_0x7e84('0x1a')](handleEntityNotFound(_0x585521,null))['then'](function(_0x4b6fa5){if(_0x4b6fa5){return _0x4b6fa5['setTags'](_0x47f5bf[_0x7e84('0x36')][_0x7e84('0x83')]||[]);}return null;})[_0x7e84('0x1a')](respondWithResult(_0x585521,null))[_0x7e84('0x24')](handleError(_0x585521,null));};exports[_0x7e84('0x84')]=function(_0x5cf035,_0x5a6ea7){var _0x19df19=[];_0x19df19[_0x7e84('0x59')](addAdditionalPhones(_0x5cf035[_0x7e84('0x36')]));Promise[_0x7e84('0x5d')](_0x19df19)[_0x7e84('0x1a')](function(){_0x19df19=[];_0x19df19[_0x7e84('0x59')](deleteCmHopperPhones(_0x5cf035[_0x7e84('0x36')]['id']));_0x19df19['push'](addCmHopperPhones(_0x5cf035[_0x7e84('0x36')]['id']));Promise[_0x7e84('0x5d')](_0x19df19)[_0x7e84('0x1a')](function(){return[0x1];})[_0x7e84('0x1a')](respondWithResult(_0x5a6ea7,null));});};function addAdditionalPhones(_0x1bb744){var _0x2e6739;return new Promise(function(_0x1c450b){return db[_0x7e84('0x62')]['destroy']({'where':{'CmContactId':_0x1bb744['id']}})[_0x7e84('0x1a')](function(){db[_0x7e84('0x64')][_0x7e84('0x22')]({'raw':!![],'attributes':['id',_0x7e84('0x85')]})[_0x7e84('0x1a')](function(_0x2bee48){var _0x58107b=[];for(var _0x25e1f6=0x0;_0x25e1f6<_0x1bb744['items'][_0x7e84('0x2e')];_0x25e1f6++){var _0x312e21=_0x1bb744[_0x7e84('0x86')]?_[_0x7e84('0x50')](_0x1bb744[_0x7e84('0x86')][_0x25e1f6])?'':_0x1bb744['item_types'][_0x25e1f6]:_0x1bb744[_0x7e84('0x87')][_0x25e1f6]['ItemTypeId']?_0x1bb744[_0x7e84('0x87')][_0x25e1f6]['ItemTypeId']:'';var _0x25644b=_[_0x7e84('0x50')](_0x1bb744[_0x7e84('0x87')][_0x25e1f6]['description'])?'':_0x1bb744[_0x7e84('0x87')][_0x25e1f6][_0x7e84('0x88')];var _0x4bbb01=_0x312e21+':'+_0x1bb744[_0x7e84('0x87')][_0x25e1f6][_0x7e84('0x74')]+'§'+_0x25644b;if(_['isNil'](_0x2e6739))_0x2e6739=_0x4bbb01;else _0x2e6739+=';'+_0x4bbb01;var _0x59d5eb=null;var _0x4fd122=null;if(_0x1bb744[_0x7e84('0x86')]){if(!_[_0x7e84('0x50')](_0x1bb744[_0x7e84('0x86')][_0x25e1f6])){_0x4fd122=_[_0x7e84('0x26')](_0x2bee48,function(_0x37659e){return _0x37659e['id']===_0x1bb744[_0x7e84('0x86')][_0x25e1f6];});if(!_[_0x7e84('0x50')](_0x4fd122)){_0x59d5eb=_0x4fd122['OrderBy'];}}}else{if(!_[_0x7e84('0x50')](_0x1bb744[_0x7e84('0x87')][_0x25e1f6])){_0x4fd122=_[_0x7e84('0x26')](_0x2bee48,function(_0x126de4){return _0x126de4['id']===_0x1bb744[_0x7e84('0x87')][_0x25e1f6][_0x7e84('0x89')];});if(!_[_0x7e84('0x50')](_0x4fd122)){_0x59d5eb=_0x25e1f6;}}}if(_['isNil'](_0x59d5eb)){_0x59d5eb=0x64;}_0x58107b[_0x7e84('0x59')](addAdditionalPhone(_0x1bb744['id'],_0x1bb744['items'][_0x25e1f6][_0x7e84('0x74')],_0x1bb744[_0x7e84('0x86')]?_[_0x7e84('0x50')](_0x1bb744[_0x7e84('0x86')][_0x25e1f6])?null:_0x1bb744[_0x7e84('0x86')][_0x25e1f6]:_0x1bb744[_0x7e84('0x87')][_0x25e1f6][_0x7e84('0x89')]?_0x1bb744[_0x7e84('0x87')][_0x25e1f6][_0x7e84('0x89')]:null,_0x59d5eb,_0x25644b));}Promise['all'](_0x58107b)[_0x7e84('0x1a')](function(){db[_0x7e84('0x25')][_0x7e84('0x19')]({'AdditionalPhones':_0x2e6739},{'where':{'id':_0x1bb744['id']}})[_0x7e84('0x1a')](function(){_0x1c450b(0x1);});});});});});}function addAdditionalPhone(_0x3a43d8,_0x21abab,_0x3ceed6,_0x4562f6,_0x3dc43f){return db['CmContactHasItem'][_0x7e84('0x26')]({'where':{'CmContactId':_0x3a43d8,'item':_0x21abab}})[_0x7e84('0x1a')](function(_0x5d42da){if(_0x5d42da)logger[_0x7e84('0x32')](_0x7e84('0x8a'),_0x5d42da);else{db[_0x7e84('0x62')]['create']({'CmContactId':_0x3a43d8,'item':_0x21abab,'ItemTypeId':_0x3ceed6,'OrderBy':_0x4562f6,'ItemClass':'PHONE','description':_0x3dc43f});}});}function deleteCmHopperPhones(_0x314a11){return new Promise(function(_0x2665a7){return db[_0x7e84('0x3c')][_0x7e84('0x22')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x314a11}})['then'](function(_0x3ac579){db['CmHopperAdditionalPhone'][_0x7e84('0x3d')]({'where':{'CmHopperId':{'$in':_[_0x7e84('0x69')](_0x3ac579,'id')}}});})[_0x7e84('0x1a')](function(){_0x2665a7(0x1);});});}function addCmHopperPhones(_0x531c99){return new Promise(function(_0x5d2c3b){return db['CmHopper'][_0x7e84('0x22')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x531c99}})['then'](function(_0x1e50a9){var _0x11e9e8=[];_[_0x7e84('0x69')](_0x1e50a9,function(_0x400db7){_0x11e9e8[_0x7e84('0x59')](createCmHopperPhone(_0x531c99,_0x400db7['id']));});Promise[_0x7e84('0x5d')](_0x11e9e8)[_0x7e84('0x1a')](function(){_0x5d2c3b(0x1);});});});}function createCmHopperPhone(_0xf01930,_0x5b72e1){return new Promise(function(_0xce5a99){db['CmContactHasItem']['findAll']({'raw':!![],'attributes':['item','OrderBy'],'where':{'CmContactId':_0xf01930,'ItemClass':'PHONE'},'include':[{'model':db[_0x7e84('0x64')],'attributes':[_0x7e84('0x85')],'as':_0x7e84('0x65')}],'order':[_0x7e84('0x85'),db[_0x7e84('0x66')]['literal'](_0x7e84('0x8b'))]})[_0x7e84('0x1a')](function(_0x2312ad){var _0x2ddf43=0x1;var _0x145b17=_['map'](_0x2312ad,function(_0x310cb9){_0x310cb9[_0x7e84('0x8c')]=_0x5b72e1;_0x310cb9[_0x7e84('0x74')]=_0x310cb9[_0x7e84('0x8d')];_0x310cb9['OrderBy']=_0x2ddf43;delete _0x310cb9['ItemType.OrderBy'];_0x2ddf43=_0x2ddf43+0x1;return _0x310cb9;});return db[_0x7e84('0x8e')][_0x7e84('0x55')](_0x145b17,{});})[_0x7e84('0x1a')](function(){_0xce5a99(0x1);});});}function insertAdditionalPhones(_0x5c8f78,_0xd3dd39){return new Promise(function(_0x13f4d5){var _0x32d0df=[];for(var _0x595149=0x0;_0x595149<_0xd3dd39[_0x7e84('0x2e')];_0x595149++){var _0x5cef49=_0xd3dd39[_0x595149];_0x32d0df[_0x7e84('0x59')](parseContactItemType(_0x5cef49));}Promise[_0x7e84('0x5d')](_0x32d0df)['then'](function(){var _0x4c88e8={'id':_0x5c8f78['id'],'items':_0xd3dd39};return addAdditionalPhones(_0x4c88e8)[_0x7e84('0x1a')](function(){return addCmHopperPhones(_0x5c8f78['id']);});})[_0x7e84('0x1a')](function(){_0x13f4d5(_0x5c8f78);});});}function parseContactItemType(_0xa3b318){return new Promise(function(_0x161440){if(_0xa3b318[_0x7e84('0x34')](_0x7e84('0x89'))){_0x161440(_0xa3b318);}else{return db[_0x7e84('0x64')][_0x7e84('0x26')]({'where':{'name':_0xa3b318[_0x7e84('0x65')]}})[_0x7e84('0x1a')](function(_0x2c42b2){if(_[_0x7e84('0x50')](_0x2c42b2))_0xa3b318['ItemTypeId']=null;else _0xa3b318[_0x7e84('0x89')]=_0x2c42b2['id'];_0x161440(_0xa3b318);});}});}exports[_0x7e84('0x8f')]=function(_0x424220,_0x23e26f){return db['CmContactHasItem'][_0x7e84('0x22')]({'raw':!![],'where':{'CmContactId':_0x424220[_0x7e84('0x27')]['id'],'ItemClass':_0x7e84('0x90')},'include':[{'model':db[_0x7e84('0x64')],'as':_0x7e84('0x65')}],'order':[[_0x7e84('0x85')],[db[_0x7e84('0x66')]['literal'](_0x7e84('0x8b'))]]})['then'](function(_0x46cd95){return _0x46cd95;})[_0x7e84('0x1a')](respondWithResult(_0x23e26f,null))['catch'](handleError(_0x23e26f,null));};exports[_0x7e84('0x91')]=function(_0x1532f2,_0x1e906f){return db['CmContactHasItem'][_0x7e84('0x22')]({'raw':!![],'where':{'CmContactId':_0x1532f2[_0x7e84('0x36')][_0x7e84('0x92')]}})[_0x7e84('0x1a')](function(_0x5b850b){var _0x1335a3=_[_0x7e84('0x69')](_0x5b850b,function(_0x42cc1d){_0x42cc1d['CmContactId']=_0x1532f2['body'][_0x7e84('0x93')];return _0x42cc1d;});return db[_0x7e84('0x62')][_0x7e84('0x55')](_0x1335a3,{});})['then'](function(){return addCmHopperPhones(_0x1532f2[_0x7e84('0x36')]['toContactId']);})['then'](function(){return['ok'];})[_0x7e84('0x1a')](respondWithResult(_0x1e906f,null))[_0x7e84('0x24')](handleError(_0x1e906f,null));};exports['rescheduleAdditionalPhones']=function(_0x261cf7,_0x1e7341){var _0x3ee1d7=[];_0x3ee1d7[_0x7e84('0x59')](createCmHopperPhone(_0x261cf7['body']['id'],_0x261cf7[_0x7e84('0x36')][_0x7e84('0x94')]));Promise[_0x7e84('0x5d')](_0x3ee1d7)['then'](function(){return[0x1];})[_0x7e84('0x1a')](respondWithResult(_0x1e7341,null));};exports[_0x7e84('0x95')]=function(_0x3fc063,_0x2b8a40){var _0x37ee21={'raw':![],'where':{}};var _0x29dbad={};var _0x2fa135={'count':0x0,'rows':[]};return db['CmContact'][_0x7e84('0x76')]({'where':{'id':_0x3fc063[_0x7e84('0x27')]['id']}})[_0x7e84('0x1a')](handleEntityNotFound(_0x2b8a40,null))[_0x7e84('0x1a')](function(_0x2fcdb7){if(_0x2fcdb7){_0x29dbad[_0x7e84('0x77')]=_[_0x7e84('0x29')](db[_0x7e84('0x3c')][_0x7e84('0x78')]);_0x29dbad[_0x7e84('0x23')]=_['keys'](_0x3fc063[_0x7e84('0x23')]);_0x29dbad['filters']=_[_0x7e84('0x7a')](_0x29dbad[_0x7e84('0x77')],_0x29dbad[_0x7e84('0x23')]);_0x37ee21['attributes']=_[_0x7e84('0x7a')](_0x29dbad[_0x7e84('0x77')],qs[_0x7e84('0x7c')](_0x3fc063['query']['fields']));_0x37ee21['attributes']=_0x37ee21[_0x7e84('0x7b')][_0x7e84('0x2e')]?_0x37ee21[_0x7e84('0x7b')]:_0x29dbad[_0x7e84('0x77')];if(!_0x3fc063['query'][_0x7e84('0x34')](_0x7e84('0x81'))){_0x37ee21[_0x7e84('0x15')]=qs[_0x7e84('0x15')](_0x3fc063[_0x7e84('0x23')]['limit']);_0x37ee21[_0x7e84('0x13')]=qs[_0x7e84('0x13')](_0x3fc063[_0x7e84('0x23')][_0x7e84('0x13')]);}_0x37ee21['order']=qs[_0x7e84('0x7e')](_0x3fc063[_0x7e84('0x23')]['sort']);_0x37ee21[_0x7e84('0x57')]=qs[_0x7e84('0x79')](_[_0x7e84('0x7f')](_0x3fc063[_0x7e84('0x23')],_0x29dbad[_0x7e84('0x79')]));_0x37ee21['where'][_0x7e84('0x96')]=_0x2fcdb7['id'];if(_0x3fc063[_0x7e84('0x23')][_0x7e84('0x80')]){_0x37ee21['where']=_[_0x7e84('0x35')](_0x37ee21[_0x7e84('0x57')],{'$or':_[_0x7e84('0x69')](_0x37ee21['attributes'],function(_0x99a9ed){var _0x425391={};_0x425391[_0x99a9ed]={'$like':'%'+_0x3fc063['query'][_0x7e84('0x80')]+'%'};return _0x425391;})});}_0x37ee21=_['merge']({},_0x37ee21,_0x3fc063['options']);return db[_0x7e84('0x3c')][_0x7e84('0x16')]({'where':_0x37ee21[_0x7e84('0x57')]})['then'](function(_0x53300c){_0x2fa135[_0x7e84('0x16')]=_0x53300c;if(_0x3fc063['query']['includeAll']){_0x37ee21[_0x7e84('0x97')]=[{'all':!![]}];}return db['CmHopper'][_0x7e84('0x22')](_0x37ee21);})[_0x7e84('0x1a')](function(_0xcd4a6c){_0x2fa135[_0x7e84('0x98')]=_0xcd4a6c;return _0x2fa135;});}})['then'](respondWithFilteredResult(_0x2b8a40,_0x37ee21))[_0x7e84('0x24')](handleError(_0x2b8a40,null));};exports[_0x7e84('0x99')]=function(_0x19083b,_0x3c8d19){var _0x3efe2e={'raw':!![],'where':{}};var _0x443b22={};var _0xe4622b={'count':0x0,'rows':[]};return db[_0x7e84('0x25')][_0x7e84('0x76')]({'where':{'id':_0x19083b[_0x7e84('0x27')]['id']}})[_0x7e84('0x1a')](handleEntityNotFound(_0x3c8d19,null))['then'](function(_0xf5e7c){if(_0xf5e7c){_0x443b22[_0x7e84('0x77')]=_[_0x7e84('0x29')](db[_0x7e84('0x4a')][_0x7e84('0x78')]);_0x443b22['query']=_[_0x7e84('0x29')](_0x19083b['query']);_0x443b22['filters']=_[_0x7e84('0x7a')](_0x443b22['model'],_0x443b22[_0x7e84('0x23')]);_0x3efe2e[_0x7e84('0x7b')]=_['intersection'](_0x443b22[_0x7e84('0x77')],qs['fields'](_0x19083b[_0x7e84('0x23')][_0x7e84('0x7c')]));_0x3efe2e[_0x7e84('0x7b')]=_0x3efe2e['attributes'][_0x7e84('0x2e')]?_0x3efe2e[_0x7e84('0x7b')]:_0x443b22[_0x7e84('0x77')];if(!_0x19083b[_0x7e84('0x23')][_0x7e84('0x34')](_0x7e84('0x81'))){_0x3efe2e[_0x7e84('0x15')]=qs['limit'](_0x19083b[_0x7e84('0x23')][_0x7e84('0x15')]);_0x3efe2e[_0x7e84('0x13')]=qs[_0x7e84('0x13')](_0x19083b[_0x7e84('0x23')][_0x7e84('0x13')]);}_0x3efe2e[_0x7e84('0x7d')]=qs[_0x7e84('0x7e')](_0x19083b[_0x7e84('0x23')][_0x7e84('0x7e')]);_0x3efe2e[_0x7e84('0x57')]=qs[_0x7e84('0x79')](_[_0x7e84('0x7f')](_0x19083b[_0x7e84('0x23')],_0x443b22[_0x7e84('0x79')]));_0x3efe2e[_0x7e84('0x57')]['ContactId']=_0xf5e7c['id'];if(_0x19083b[_0x7e84('0x23')][_0x7e84('0x80')]){_0x3efe2e['where']=_[_0x7e84('0x35')](_0x3efe2e[_0x7e84('0x57')],{'$or':_[_0x7e84('0x69')](_0x3efe2e['attributes'],function(_0x13a206){var _0x4fccd3={};_0x4fccd3[_0x13a206]={'$like':'%'+_0x19083b[_0x7e84('0x23')][_0x7e84('0x80')]+'%'};return _0x4fccd3;})});}_0x3efe2e=_['merge']({},_0x3efe2e,_0x19083b['options']);return db['CmHopperHistory'][_0x7e84('0x16')]({'where':_0x3efe2e[_0x7e84('0x57')]})['then'](function(_0x16b219){_0xe4622b['count']=_0x16b219;if(_0x19083b[_0x7e84('0x23')][_0x7e84('0x9a')]){_0x3efe2e[_0x7e84('0x97')]=[{'all':!![]}];}return db[_0x7e84('0x4a')]['findAll'](_0x3efe2e);})['then'](function(_0x4a046e){_0xe4622b[_0x7e84('0x98')]=_0x4a046e;return _0xe4622b;});}})[_0x7e84('0x1a')](respondWithFilteredResult(_0x3c8d19,_0x3efe2e))[_0x7e84('0x24')](handleError(_0x3c8d19,null));};exports[_0x7e84('0x9b')]=function(_0x4e036d,_0x429bd8){var _0x52cddd={'raw':!![],'where':{}};var _0x5657be={};var _0x61439c={'count':0x0,'rows':[]};return db[_0x7e84('0x25')][_0x7e84('0x76')]({'where':{'id':_0x4e036d[_0x7e84('0x27')]['id']}})[_0x7e84('0x1a')](handleEntityNotFound(_0x429bd8,null))[_0x7e84('0x1a')](function(_0x3fbdeb){if(_0x3fbdeb){_0x5657be[_0x7e84('0x77')]=_['keys'](db['CmHopperFinal']['rawAttributes']);_0x5657be[_0x7e84('0x23')]=_['keys'](_0x4e036d[_0x7e84('0x23')]);_0x5657be[_0x7e84('0x79')]=_['intersection'](_0x5657be[_0x7e84('0x77')],_0x5657be['query']);_0x52cddd[_0x7e84('0x7b')]=_[_0x7e84('0x7a')](_0x5657be[_0x7e84('0x77')],qs['fields'](_0x4e036d[_0x7e84('0x23')][_0x7e84('0x7c')]));_0x52cddd[_0x7e84('0x7b')]=_0x52cddd[_0x7e84('0x7b')]['length']?_0x52cddd[_0x7e84('0x7b')]:_0x5657be[_0x7e84('0x77')];if(!_0x4e036d[_0x7e84('0x23')]['hasOwnProperty'](_0x7e84('0x81'))){_0x52cddd['limit']=qs[_0x7e84('0x15')](_0x4e036d['query'][_0x7e84('0x15')]);_0x52cddd[_0x7e84('0x13')]=qs[_0x7e84('0x13')](_0x4e036d[_0x7e84('0x23')][_0x7e84('0x13')]);}_0x52cddd[_0x7e84('0x7d')]=qs[_0x7e84('0x7e')](_0x4e036d[_0x7e84('0x23')][_0x7e84('0x7e')]);_0x52cddd[_0x7e84('0x57')]=qs[_0x7e84('0x79')](_[_0x7e84('0x7f')](_0x4e036d[_0x7e84('0x23')],_0x5657be[_0x7e84('0x79')]));_0x52cddd['where']['ContactId']=_0x3fbdeb['id'];if(_0x4e036d[_0x7e84('0x23')][_0x7e84('0x80')]){_0x52cddd[_0x7e84('0x57')]=_[_0x7e84('0x35')](_0x52cddd[_0x7e84('0x57')],{'$or':_[_0x7e84('0x69')](_0x52cddd[_0x7e84('0x7b')],function(_0x1286d8){var _0x1e6dd1={};_0x1e6dd1[_0x1286d8]={'$like':'%'+_0x4e036d[_0x7e84('0x23')][_0x7e84('0x80')]+'%'};return _0x1e6dd1;})});}_0x52cddd=_['merge']({},_0x52cddd,_0x4e036d[_0x7e84('0x9c')]);return db[_0x7e84('0x9d')][_0x7e84('0x16')]({'where':_0x52cddd[_0x7e84('0x57')]})[_0x7e84('0x1a')](function(_0x57b83a){_0x61439c[_0x7e84('0x16')]=_0x57b83a;if(_0x4e036d[_0x7e84('0x23')][_0x7e84('0x9a')]){_0x52cddd['include']=[{'all':!![]}];}return db[_0x7e84('0x9d')][_0x7e84('0x22')](_0x52cddd);})['then'](function(_0x520e45){_0x61439c[_0x7e84('0x98')]=_0x520e45;return _0x61439c;});}})[_0x7e84('0x1a')](respondWithFilteredResult(_0x429bd8,_0x52cddd))[_0x7e84('0x24')](handleError(_0x429bd8,null));};exports[_0x7e84('0x9e')]=function(_0x415189,_0x3c76e9){var _0x2c2357={'raw':!![],'where':{}};var _0x574c35={};var _0x4786b7={'count':0x0,'rows':[]};return db[_0x7e84('0x25')]['findOne']({'where':{'id':_0x415189[_0x7e84('0x27')]['id']}})[_0x7e84('0x1a')](handleEntityNotFound(_0x3c76e9,null))[_0x7e84('0x1a')](function(_0x1f379f){if(_0x1f379f){_0x574c35[_0x7e84('0x77')]=_[_0x7e84('0x29')](db['JscriptySessionReport']['rawAttributes']);_0x574c35[_0x7e84('0x23')]=_[_0x7e84('0x29')](_0x415189['query']);_0x574c35[_0x7e84('0x79')]=_[_0x7e84('0x7a')](_0x574c35[_0x7e84('0x77')],_0x574c35['query']);_0x2c2357[_0x7e84('0x7b')]=_['intersection'](_0x574c35[_0x7e84('0x77')],qs[_0x7e84('0x7c')](_0x415189[_0x7e84('0x23')][_0x7e84('0x7c')]));_0x2c2357[_0x7e84('0x7b')]=_0x2c2357['attributes'][_0x7e84('0x2e')]?_0x2c2357[_0x7e84('0x7b')]:_0x574c35[_0x7e84('0x77')];if(!_0x415189[_0x7e84('0x23')][_0x7e84('0x34')](_0x7e84('0x81'))){_0x2c2357['limit']=qs[_0x7e84('0x15')](_0x415189[_0x7e84('0x23')][_0x7e84('0x15')]);_0x2c2357[_0x7e84('0x13')]=qs[_0x7e84('0x13')](_0x415189['query'][_0x7e84('0x13')]);}_0x2c2357['order']=qs['sort'](_0x415189['query'][_0x7e84('0x7e')]);_0x2c2357[_0x7e84('0x57')]=qs[_0x7e84('0x79')](_[_0x7e84('0x7f')](_0x415189[_0x7e84('0x23')],_0x574c35['filters']));_0x2c2357[_0x7e84('0x57')][_0x7e84('0x96')]=_0x1f379f['id'];if(_0x415189[_0x7e84('0x23')][_0x7e84('0x80')]){_0x2c2357['where']=_['merge'](_0x2c2357['where'],{'$or':_['map'](_0x2c2357[_0x7e84('0x7b')],function(_0x29abe1){var _0x87caee={};_0x87caee[_0x29abe1]={'$like':'%'+_0x415189[_0x7e84('0x23')]['filter']+'%'};return _0x87caee;})});}_0x2c2357=_[_0x7e84('0x35')]({},_0x2c2357,_0x415189[_0x7e84('0x9c')]);return db[_0x7e84('0x9f')][_0x7e84('0x16')]({'where':_0x2c2357[_0x7e84('0x57')]})[_0x7e84('0x1a')](function(_0x19a447){_0x4786b7[_0x7e84('0x16')]=_0x19a447;if(_0x415189['query'][_0x7e84('0x9a')]){_0x2c2357['include']=[{'all':!![]}];}return db[_0x7e84('0x9f')]['findAll'](_0x2c2357);})[_0x7e84('0x1a')](function(_0x1d7a5a){_0x4786b7['rows']=_0x1d7a5a;return _0x4786b7;});}})[_0x7e84('0x1a')](respondWithFilteredResult(_0x3c76e9,_0x2c2357))[_0x7e84('0x24')](handleError(_0x3c76e9,null));};exports[_0x7e84('0xa0')]=function(_0x477f32,_0x25495e){try{if(!_0x477f32[_0x7e84('0x36')][_0x7e84('0x5a')]){throw new Error(_0x7e84('0xa1'));}if(!_0x477f32['body'][_0x7e84('0xa2')]){throw new Error(_0x7e84('0xa3'));}if(!_0x477f32[_0x7e84('0x36')][_0x7e84('0xa4')]){throw new Error(_0x7e84('0xa5'));}if(!_0x477f32['body'][_0x7e84('0xa6')]){throw new Error(_0x7e84('0xa7'));}var _0x3e617f=_0x477f32['body'][_0x7e84('0xa2')][_0x7e84('0xa8')](',');var _0x1d8dc6=_0x477f32[_0x7e84('0x36')][_0x7e84('0xa4')][_0x7e84('0xa8')](',');if(!_0x3e617f[_0x7e84('0x2e')]||!_0x1d8dc6[_0x7e84('0x2e')]||_0x3e617f[_0x7e84('0x2e')]!==_0x1d8dc6['length']){throw new Error(_0x7e84('0xa9'));}_0x477f32['body'][_0x7e84('0x7c')]=_[_0x7e84('0xaa')](_0x3e617f,_0x1d8dc6);if(!_0x477f32[_0x7e84('0x36')][_0x7e84('0x7c')][_0x7e84('0x74')]){throw new Error(_0x7e84('0xab'));}if(!_0x477f32[_0x7e84('0x36')][_0x7e84('0x7c')][_0x7e84('0xac')]){throw new Error(_0x7e84('0xad'));}var _0x31603b=path[_0x7e84('0x4f')](config[_0x7e84('0xae')],'server/files/tmp',_0x477f32['file'][_0x7e84('0xaf')]);fs[_0x7e84('0xb0')](_0x31603b,parseInt(_0x7e84('0xb1'),0x8));var _0x4f4744=require('child_process')[_0x7e84('0xb2')](path[_0x7e84('0x4f')](__dirname,_0x7e84('0xb3')),[_0x31603b,_0x477f32[_0x7e84('0x36')][_0x7e84('0xa2')],_0x477f32[_0x7e84('0x36')]['binding_values'],_0x477f32[_0x7e84('0x36')]['ListId'],_0x477f32[_0x7e84('0x36')]['CompanyId'],_0x477f32[_0x7e84('0x36')][_0x7e84('0x56')],_0x477f32[_0x7e84('0x36')][_0x7e84('0xa6')]]);return _0x25495e['status'](0xc8)[_0x7e84('0x12')]({'message':_0x7e84('0xb4'),'pid':_0x4f4744[_0x7e84('0xb5')]});}catch(_0x38759e){return _0x25495e[_0x7e84('0x11')](0x1f4)[_0x7e84('0xb6')](_0x38759e);}};exports[_0x7e84('0xb7')]=function(_0x50128b,_0x329b80){var _0x972463=fs['createReadStream'](_0x50128b['file'][_0x7e84('0x3')]);Papa[_0x7e84('0xb8')](_0x972463,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x2f66e1){return _0x329b80[_0x7e84('0x11')](0xc8)[_0x7e84('0x12')]({'file':_0x50128b[_0x7e84('0xb9')],'fields':_0x2f66e1[_0x7e84('0xba')][_0x7e84('0x7c')]});}});};exports[_0x7e84('0xbb')]=function(_0x41dc9c,_0x3d464b){return db['User'][_0x7e84('0x22')]({'raw':!![],'attributes':['id'],'where':{'role':_0x7e84('0xbc')}})[_0x7e84('0x1a')](function(_0x5a0e5d){var _0x304176=![];if(!_0x41dc9c[_0x7e84('0x36')][_0x7e84('0x5a')]){throw new Error(_0x7e84('0xa1'));}if(!_0x41dc9c[_0x7e84('0x36')]['binding'][_0x7e84('0x74')]){throw new Error(_0x7e84('0xab'));}if(!_0x41dc9c[_0x7e84('0x36')][_0x7e84('0xbd')]['firstName']){throw new Error(_0x7e84('0xad'));}if(!_0x41dc9c['body'][_0x7e84('0xa6')]){throw new Error(_0x7e84('0xa7'));}var _0x320fcf=require(_0x7e84('0xbe'))[_0x7e84('0xb2')](path['join'](__dirname,_0x7e84('0xbf')),[_0x41dc9c['params']['id'],JSON[_0x7e84('0xc0')](_0x41dc9c['body']),JSON[_0x7e84('0xc0')](_0x5a0e5d)]);_0x320fcf['on'](_0x7e84('0xc1'),function(){_0x304176=!![];return _0x3d464b[_0x7e84('0x11')](0xc8)[_0x7e84('0x12')]({'message':_0x7e84('0xc2'),'pid':_0x320fcf['pid']});});_0x320fcf['on']('exit',function(_0x22e2e8){if(_0x22e2e8&&!_0x304176){return _0x3d464b['status'](0x1f4)[_0x7e84('0x12')]({'message':_0x7e84('0xc3'),'pid':_0x320fcf[_0x7e84('0xb5')]});}});})['catch'](handleError(_0x3d464b,null));};exports[_0x7e84('0xc4')]=function(_0x26fb46,_0x48f239){return db['User'][_0x7e84('0x22')]({'raw':!![],'attributes':['id'],'where':{'role':_0x7e84('0xbc')}})[_0x7e84('0x1a')](function(_0x22496f){var _0x239b54=![];if(!_0x26fb46[_0x7e84('0x36')][_0x7e84('0x5a')]){throw new Error(_0x7e84('0xa1'));}if(!_0x26fb46[_0x7e84('0x36')]['binding'][_0x7e84('0x74')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x26fb46[_0x7e84('0x36')][_0x7e84('0xbd')][_0x7e84('0xac')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x26fb46[_0x7e84('0x36')]['socket_timestamp']){throw new Error(_0x7e84('0xa7'));}var _0x572098=require('child_process')[_0x7e84('0xb2')](path[_0x7e84('0x4f')](__dirname,_0x7e84('0xc5')),[_0x26fb46[_0x7e84('0x27')]['id'],JSON[_0x7e84('0xc0')](_0x26fb46[_0x7e84('0x36')]),JSON[_0x7e84('0xc0')](_0x22496f)]);_0x572098['on']('message',function(){_0x239b54=!![];return _0x48f239[_0x7e84('0x11')](0xc8)[_0x7e84('0x12')]({'message':_0x7e84('0xc2'),'pid':_0x572098[_0x7e84('0xb5')]});});_0x572098['on'](_0x7e84('0xc6'),function(_0x58383b){if(_0x58383b&&!_0x239b54){return _0x48f239[_0x7e84('0x11')](0x1f4)[_0x7e84('0x12')]({'message':_0x7e84('0xc3'),'pid':_0x572098['pid']});}});})[_0x7e84('0x24')](handleError(_0x48f239,null));};exports[_0x7e84('0xc7')]=function(_0x2a016c,_0x48ceed){var _0x42d747=[_0x7e84('0xc8'),_0x7e84('0xc9'),_0x7e84('0xca'),'openchannel',_0x7e84('0xcb'),_0x7e84('0xcc'),_0x7e84('0xcd')];var _0x1778e2={'offset':0x0,'order':qs['sort'](_0x7e84('0xce'))},_0x59f9a1={'count':0x0,'rows':[]};Promise[_0x7e84('0xcf')]()['then'](function(){if(_0x2a016c[_0x7e84('0x23')][_0x7e84('0xd0')]){if(!_[_0x7e84('0xd1')](_0x42d747,_0x2a016c[_0x7e84('0x23')][_0x7e84('0xd0')][_0x7e84('0xd2')]())){throw new Error(_0x7e84('0xd3'));}_0x42d747=[_0x2a016c[_0x7e84('0x23')][_0x7e84('0xd0')]['toLowerCase']()];}if(_0x2a016c[_0x7e84('0x23')]['range']){try{var _0x2ff5c6=JSON[_0x7e84('0xb8')](_0x2a016c['query'][_0x7e84('0xd4')]);if(!moment(_0x2ff5c6[_0x7e84('0x37')])[_0x7e84('0xd5')]()){throw new Error('Invalid\x20date\x20for\x20range\x20from\x20filter');}if(!moment(_0x2ff5c6['to'])[_0x7e84('0xd5')]()){throw new Error('Invalid\x20date\x20for\x20range\x20to\x20filter');}}catch(_0x18f04f){throw new Error(_0x7e84('0xd6'));}}if(!_0x2a016c[_0x7e84('0x23')][_0x7e84('0x34')](_0x7e84('0x81'))){_0x1778e2[_0x7e84('0x15')]=qs[_0x7e84('0x15')](_0x2a016c[_0x7e84('0x23')][_0x7e84('0x15')]||0xa);_0x1778e2[_0x7e84('0x13')]=qs[_0x7e84('0x13')](_0x2a016c[_0x7e84('0x23')][_0x7e84('0x13')]);}var _0x3ac8f3=_0x42d747[_0x7e84('0x69')](function(_0x92a2b){if(_0x92a2b===_0x7e84('0xcd')){var _0x8c9ece={'attributes':['id',_0x7e84('0xd7'),_0x7e84('0x30'),'source',_0x7e84('0xd8'),_0x7e84('0xd9'),'starttime',_0x7e84('0xda'),_0x7e84('0xdb'),_0x7e84('0xdc'),_0x7e84('0xdd'),_0x7e84('0xde'),_0x7e84('0xdf'),_0x7e84('0xe0'),_0x7e84('0xe1')],'where':{'ContactId':_0x2a016c['params']['id']},'include':[{'model':db[_0x7e84('0xe2')],'as':'User','attributes':['id',_0x7e84('0x1f'),'fullname',_0x7e84('0x2f')]}],'order':[[_0x7e84('0xdd'),_0x7e84('0xe3')]]};if(_0x2a016c[_0x7e84('0x23')][_0x7e84('0xd4')]){_0x8c9ece['where'][_0x7e84('0xdd')]={'$gte':_0x2ff5c6[_0x7e84('0x37')],'$lte':_0x2ff5c6['to']};}return db[_0x7e84('0x4b')][_0x7e84('0xe4')](_0x8c9ece)[_0x7e84('0x1a')](function(_0x6a73d){_0x59f9a1['count']+=_0x6a73d[_0x7e84('0x16')];return _[_0x7e84('0x69')](_0x6a73d[_0x7e84('0x98')],function(_0x284d38){var _0x4b25aa=_0x284d38[_0x7e84('0x38')]({'plain':!![]});_0x4b25aa['channel']=_0x92a2b;if(_0x4b25aa['User']){_0x4b25aa[_0x7e84('0xe2')]={'id':_0x4b25aa[_0x7e84('0xe2')]['id'],'name':_0x4b25aa[_0x7e84('0xe2')][_0x7e84('0x1f')],'fullname':_0x4b25aa['User'][_0x7e84('0xe5')],'alias':_0x4b25aa[_0x7e84('0xe2')][_0x7e84('0x2f')]};}return _0x4b25aa;});});}else{var _0x1c78c0=_['startCase'](_0x92a2b)+(_0x92a2b===_0x7e84('0xc9')?_0x7e84('0xe6'):_0x7e84('0xe7'));var _0x52b477={'attributes':['id',_0x7e84('0xe8'),_0x7e84('0xe9'),'createdAt',_0x7e84('0xdc'),'disposition',_0x7e84('0xea'),_0x7e84('0xeb'),_0x7e84('0xe1'),_0x1c78c0+'Id'],'where':{'ContactId':_0x2a016c[_0x7e84('0x27')]['id']},'include':[{'model':db[_0x1c78c0],'as':_0x7e84('0xe7'),'attributes':['id',_0x7e84('0x1f'),_0x7e84('0xec')]},{'model':db[_0x7e84('0xe2')],'as':'Owner','attributes':['id',_0x7e84('0x1f'),_0x7e84('0xe5')]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x7e84('0x1f'),'color'],'through':{'attributes':[]}}],'order':[['createdAt',_0x7e84('0xe3')]]};if(_0x2a016c[_0x7e84('0x23')]['range']){_0x52b477[_0x7e84('0x57')][_0x7e84('0xdd')]={'$gte':_0x2ff5c6[_0x7e84('0x37')],'$lte':_0x2ff5c6['to']};}switch(_0x92a2b){case _0x7e84('0xc9'):_0x52b477[_0x7e84('0x7b')][_0x7e84('0x59')](_0x7e84('0xed'),'customerIp',_0x7e84('0xee'),_0x7e84('0xef'),_0x7e84('0xf0'),_0x7e84('0xf1'),_0x7e84('0xf2'),_0x7e84('0xf3'),_0x7e84('0xf4'));break;case _0x7e84('0xc8'):_0x52b477[_0x7e84('0x7b')][_0x7e84('0x59')]('subject','substatus');break;case _0x7e84('0xf5'):_0x52b477['attributes'][_0x7e84('0x59')](_0x7e84('0xf6'),_0x7e84('0xf7'));break;}return db[_[_0x7e84('0xf8')](_0x92a2b)+_0x7e84('0xf9')][_0x7e84('0xe4')](_0x52b477)['then'](function(_0x36ecac){_0x59f9a1[_0x7e84('0x16')]+=_0x36ecac[_0x7e84('0x16')];return _[_0x7e84('0x69')](_0x36ecac[_0x7e84('0x98')],function(_0x566b56){var _0x50c480=_0x566b56[_0x7e84('0x38')]({'plain':!![]});_0x50c480[_0x7e84('0xd0')]=_0x92a2b;if(_0x50c480[_0x7e84('0xfa')]){_0x50c480[_0x7e84('0xfa')]={'id':_0x50c480[_0x7e84('0xfa')]['id'],'name':_0x50c480[_0x7e84('0xfa')][_0x7e84('0x1f')],'fullname':_0x50c480['Owner'][_0x7e84('0xe5')]};}return _0x50c480;});});}});return Promise[_0x7e84('0x5d')](_0x3ac8f3);})[_0x7e84('0x1a')](function(_0x18bd92){return _(_0x18bd92)[_0x7e84('0xfb')]()[_0x7e84('0xfc')](_0x7e84('0xdd'))[_0x7e84('0xfd')]()[_0x7e84('0xfe')]();})[_0x7e84('0x1a')](function(_0x1dd183){_0x59f9a1[_0x7e84('0x98')]=_0x1778e2['limit']?_0x1dd183['slice'](_0x1778e2[_0x7e84('0x13')],_0x1778e2[_0x7e84('0x13')]+_0x1778e2[_0x7e84('0x15')]):_0x1dd183;return _0x59f9a1;})[_0x7e84('0x1a')](respondWithFilteredResult(_0x48ceed,_0x1778e2))['catch'](handleError(_0x48ceed,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index e794e93..0b39494 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 _0x5445=['../../mysqldb','CmContact','setMaxListeners','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x2ddc4a,_0xdcf87){var _0x44bd44=function(_0x3e8b79){while(--_0x3e8b79){_0x2ddc4a['push'](_0x2ddc4a['shift']());}};_0x44bd44(++_0xdcf87);}(_0x5445,0x170));var _0x5544=function(_0x12eb50,_0x45879d){_0x12eb50=_0x12eb50-0x0;var _0x8682f6=_0x5445[_0x12eb50];return _0x8682f6;};'use strict';var EventEmitter=require(_0x5544('0x0'));var CmContact=require(_0x5544('0x1'))['db'][_0x5544('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x5544('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x5544('0x4')};function emitEvent(_0xd81c65){return function(_0x3dd503,_0x208efa,_0x404f73){CmContactEvents[_0x5544('0x5')](_0xd81c65+':'+_0x3dd503['id'],_0x3dd503);CmContactEvents[_0x5544('0x5')](_0xd81c65,_0x3dd503);_0x404f73(null);};}for(var e in events){if(events[_0x5544('0x6')](e)){var event=events[e];CmContact[_0x5544('0x7')](e,emitEvent(event));}}module[_0x5544('0x8')]=CmContactEvents; \ No newline at end of file +var _0x0d56=['../../mysqldb','save','update','remove','emit','events'];(function(_0x5c9307,_0x5b97e4){var _0x373e29=function(_0xefebbd){while(--_0xefebbd){_0x5c9307['push'](_0x5c9307['shift']());}};_0x373e29(++_0x5b97e4);}(_0x0d56,0x197));var _0x60d5=function(_0x396e90,_0x4c7718){_0x396e90=_0x396e90-0x0;var _0xaf7e4c=_0x0d56[_0x396e90];return _0xaf7e4c;};'use strict';var EventEmitter=require(_0x60d5('0x0'));var CmContact=require(_0x60d5('0x1'))['db']['CmContact'];var CmContactEvents=new EventEmitter();CmContactEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x60d5('0x2'),'afterUpdate':_0x60d5('0x3'),'afterDestroy':_0x60d5('0x4')};function emitEvent(_0x3bfbe8){return function(_0x4b3120,_0x3783c5,_0x2e83b2){CmContactEvents[_0x60d5('0x5')](_0x3bfbe8+':'+_0x4b3120['id'],_0x4b3120);CmContactEvents[_0x60d5('0x5')](_0x3bfbe8,_0x4b3120);_0x2e83b2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmContact['hook'](e,emitEvent(event));}}module['exports']=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index 0e5d1b9..6a75ffd 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 _0x05e8=['\x20in\x20Campaign\x20with\x20id\x20','CmHopperFinal','[Always]\x20Hopper\x20Final\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','CampaignId','create','[OnlyIfOpen]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','VoiceQueueId','dialCheckDuplicateType','always','onlyIfOpen','Lists','map','findAll','CmList','all','outbound','BlackLists','CmHopperBlack','Campaign','exports','define','cm_contacts','firstName','lastName','mobile','email','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','models','get','error','[cmContact][afterCreate]\x20List\x20not\x20found\x20for\x20contact\x20with\x20id\x20','[cmContact][afterCreate]','message','isEmpty','length','destroy','push','inspect','catch','[CmContact][afterDestroy][Error]','lodash','util','api','../../config/environment/shared','VoiceQueue','scheduledat','YYYY-MM-DD\x20HH:mm:ss','dialTimezone','resolve','findOne','then','isNil','timezones','utcOffset','minutes','format','phone','ListId','priority','callbackUniqueid','assign','CmHopper','[Always]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20'];(function(_0x457235,_0x42f181){var _0x510727=function(_0x482434){while(--_0x482434){_0x457235['push'](_0x457235['shift']());}};_0x510727(++_0x42f181);}(_0x05e8,0xed));var _0x805e=function(_0x1010c9,_0x217801){_0x1010c9=_0x1010c9-0x0;var _0xf19a04=_0x05e8[_0x1010c9];return _0xf19a04;};'use strict';var _=require(_0x805e('0x0'));var util=require(_0x805e('0x1'));var logger=require('../../config/logger')(_0x805e('0x2'));var moment=require('moment');var shared=require(_0x805e('0x3'));var attributes=require('./cmContact.attributes');function getTimezoneCallbackAt(_0x4fdac9,_0x51d2ee,_0x253bbe,_0x2c7b77){var _0x485b14=_0x2c7b77?'Campaign':_0x805e('0x4');var _0x186a84=_0x253bbe[_0x805e('0x5')]?_0x253bbe[_0x805e('0x5')]:moment()['format'](_0x805e('0x6'));if(_['isNil'](_0x253bbe[_0x805e('0x7')])){return Promise[_0x805e('0x8')](_0x186a84);}return _0x4fdac9[_0x485b14][_0x805e('0x9')]({'where':{'id':_0x51d2ee}})[_0x805e('0xa')](function(_0x4f2a86){if(_[_0x805e('0xb')](_0x4f2a86)||_[_0x805e('0xb')](_0x4f2a86[_0x805e('0x7')])){return Promise[_0x805e('0x8')](_0x186a84);}var _0x21f4bb=shared[_0x805e('0xc')];var _0x15050b=_0x21f4bb[_0x4f2a86[_0x805e('0x7')]];var _0x124d59=_0x21f4bb[_0x253bbe['dialTimezone']];if(_[_0x805e('0xb')](_0x15050b)&&_[_0x805e('0xb')](_0x124d59)){return Promise['resolve'](_0x186a84);}var _0x893ed=_0x15050b[_0x805e('0xd')]-_0x124d59[_0x805e('0xd')];var _0x5b8426=_0x253bbe[_0x805e('0x5')]?_0x253bbe[_0x805e('0x5')]:moment();_0x186a84=moment(_0x5b8426)['add'](_0x893ed,_0x805e('0xe'))[_0x805e('0xf')](_0x805e('0x6'));return Promise[_0x805e('0x8')](_0x186a84);});}function getNewHopperPayload(_0x50e773){return{'phone':_0x50e773[_0x805e('0x10')],'ContactId':_0x50e773['id'],'ListId':_0x50e773[_0x805e('0x11')],'scheduledat':_0x50e773['scheduledat']?_0x50e773[_0x805e('0x5')]:moment()[_0x805e('0xf')](_0x805e('0x6')),'priority':_0x50e773[_0x805e('0x12')]?_0x50e773[_0x805e('0x12')]:0x2,'callback':_0x50e773[_0x805e('0x13')]?!![]:![],'callbackuniqueid':_0x50e773['callbackUniqueid']?_0x50e773[_0x805e('0x13')]:undefined,'callbackat':_0x50e773[_0x805e('0x13')]?moment()[_0x805e('0xf')]('YYYY-MM-DD\x20HH:mm:ss'):undefined};}function handleAlwaysCheckDuplicate(_0x54c323,_0x2ed5e7,_0x2bbcff,_0xd46a9b){var _0x46b3d7={'phone':_0x2bbcff[_0x805e('0x10')]};var _0x2020bc={'calleridnum':_0x2bbcff[_0x805e('0x10')]};if(_0xd46a9b){Object[_0x805e('0x14')](_0x46b3d7,{'CampaignId':_0x2ed5e7['id']});Object[_0x805e('0x14')](_0x2020bc,{'CampaignId':_0x2ed5e7['id']});}else{Object[_0x805e('0x14')](_0x46b3d7,{'VoiceQueueId':_0x2ed5e7['id']});Object['assign'](_0x2020bc,{'VoiceQueueId':_0x2ed5e7['id']});}return _0x54c323[_0x805e('0x15')]['findOne']({'where':_0x46b3d7})[_0x805e('0xa')](function(_0x4c60c1){if(_0x4c60c1){throw new Error(_0x805e('0x16')+_0x2bbcff[_0x805e('0x10')]+_0x805e('0x17')+_0x2ed5e7['id']);}return _0x54c323[_0x805e('0x18')][_0x805e('0x9')]({'where':_0x2020bc});})[_0x805e('0xa')](function(_0xb1951d){if(_0xb1951d){throw new Error(_0x805e('0x19')+_0x2bbcff[_0x805e('0x10')]+_0x805e('0x17')+_0x2ed5e7['id']);}var _0x321423=getNewHopperPayload(_0x2bbcff);if(_0xd46a9b){_0x321423[_0x805e('0x1a')]=_0x2ed5e7['id'];}else{_0x321423['VoiceQueueId']=_0x2ed5e7['id'];}return _0x54c323['CmHopper'][_0x805e('0x1b')](_0x321423);});}function handleOnlyIfOpenCheckDuplicate(_0x42390a,_0x49c0c3,_0x5e1c70,_0x15e1f7){var _0x505f45={'phone':_0x5e1c70[_0x805e('0x10')]};if(_0x15e1f7){Object['assign'](_0x505f45,{'CampaignId':_0x49c0c3['id']});}else{Object['assign'](_0x505f45,{'VoiceQueueId':_0x49c0c3['id']});}return _0x42390a[_0x805e('0x15')][_0x805e('0x9')]({'where':_0x505f45})['then'](function(_0x514f64){if(_0x514f64){throw new Error(_0x805e('0x1c')+_0x5e1c70[_0x805e('0x10')]+_0x805e('0x17')+_0x49c0c3['id']);}var _0x3b30dd=getNewHopperPayload(_0x5e1c70);if(_0x15e1f7){_0x3b30dd[_0x805e('0x1a')]=_0x49c0c3['id'];}else{_0x3b30dd[_0x805e('0x1d')]=_0x49c0c3['id'];}return _0x42390a[_0x805e('0x15')]['create'](_0x3b30dd);});}function handleNeverCheckDuplicate(_0xecffe9,_0x160a00,_0x588990){var _0x1514b9=getNewHopperPayload(_0x588990);_0x1514b9[_0x805e('0x1d')]=_0x160a00['id'];return _0xecffe9[_0x805e('0x15')][_0x805e('0x1b')](_0x1514b9);}function handleCheckDuplicate(_0x22ae6a,_0x51c0ed,_0x14a1af,_0x268e50){return getTimezoneCallbackAt(_0x22ae6a,_0x51c0ed,_0x14a1af,_0x268e50)[_0x805e('0xa')](function(_0x2423fc){_0x14a1af[_0x805e('0x5')]=_0x2423fc;switch(_0x51c0ed[_0x805e('0x1e')]){case _0x805e('0x1f'):return handleAlwaysCheckDuplicate(_0x22ae6a,_0x51c0ed,_0x14a1af,_0x268e50);case _0x805e('0x20'):return handleOnlyIfOpenCheckDuplicate(_0x22ae6a,_0x51c0ed,_0x14a1af,_0x268e50);default:return handleNeverCheckDuplicate(_0x22ae6a,_0x51c0ed,_0x14a1af);}});}function createHopperForVoiceQueues(_0x270ec7,_0x23aaa7){return _0x270ec7[_0x805e('0x4')]['findAll']({'where':{'type':'outbound'},'attributes':['id',_0x805e('0x1e'),'dialTimezone'],'include':[{'model':_0x270ec7['CmList'],'as':_0x805e('0x21'),'where':{'id':_0x23aaa7[_0x805e('0x11')]}}],'raw':!![]})['then'](function(_0x58fecb){var _0x140f53=_0x58fecb[_0x805e('0x22')](function(_0xfc119f){return handleCheckDuplicate(_0x270ec7,_0xfc119f,_0x23aaa7,![]);});return Promise['all'](_0x140f53);});}function createHopperForCampaigns(_0x57dbfa,_0x361aaa){return _0x57dbfa['Campaign'][_0x805e('0x23')]({'attributes':['id',_0x805e('0x1e'),_0x805e('0x7')],'include':[{'model':_0x57dbfa[_0x805e('0x24')],'as':_0x805e('0x21'),'where':{'id':_0x361aaa[_0x805e('0x11')]}}],'raw':!![]})[_0x805e('0xa')](function(_0x3d166f){var _0x1abfb2=_0x3d166f[_0x805e('0x22')](function(_0x169ffc){return handleCheckDuplicate(_0x57dbfa,_0x169ffc,_0x361aaa,!![]);});return Promise[_0x805e('0x25')](_0x1abfb2);});}function createHopperBlackForVoiceQueues(_0x1a47f8,_0x406bb9){return _0x1a47f8[_0x805e('0x4')]['findAll']({'where':{'type':_0x805e('0x26')},'attributes':['id'],'include':[{'model':_0x1a47f8['CmList'],'as':_0x805e('0x27'),'where':{'id':_0x406bb9[_0x805e('0x11')]}}],'raw':!![]})[_0x805e('0xa')](function(_0x1aea1a){var _0x480f99=_0x1aea1a[_0x805e('0x22')](function(_0x63ef60){return _0x1a47f8[_0x805e('0x28')]['create']({'phone':_0x406bb9[_0x805e('0x10')],'ContactId':_0x406bb9['id'],'ListId':_0x406bb9[_0x805e('0x11')],'VoiceQueueId':_0x63ef60['id']});});return Promise[_0x805e('0x25')](_0x480f99);});}function createHopperBlackForCampaigns(_0x3ab6d1,_0x89ddd3){return _0x3ab6d1[_0x805e('0x29')]['findAll']({'attributes':['id'],'include':[{'model':_0x3ab6d1[_0x805e('0x24')],'as':_0x805e('0x27'),'where':{'id':_0x89ddd3['ListId']}}],'raw':!![]})[_0x805e('0xa')](function(_0x11927a){var _0x2c8343=_0x11927a[_0x805e('0x22')](function(_0x3268ec){return _0x3ab6d1['CmHopperBlack'][_0x805e('0x1b')]({'phone':_0x89ddd3[_0x805e('0x10')],'ContactId':_0x89ddd3['id'],'ListId':_0x89ddd3[_0x805e('0x11')],'CampaignId':_0x3268ec['id']});});return Promise['all'](_0x2c8343);});}module[_0x805e('0x2a')]=function(_0x2b94d5){return _0x2b94d5[_0x805e('0x2b')]('CmContact',attributes,{'tableName':_0x805e('0x2c'),'paranoid':!![],'indexes':[{'name':_0x805e('0x10'),'fields':[_0x805e('0x10')]},{'name':'fti_cm_contacts','fields':[_0x805e('0x2d'),_0x805e('0x2e'),'phone',_0x805e('0x2f'),'fax',_0x805e('0x30')],'type':_0x805e('0x31')}],'timestamps':!![],'charset':_0x805e('0x32'),'collate':_0x805e('0x33'),'hooks':{'afterCreate':function(_0x5cc1b8,_0x45405b,_0x520638){var _0x3184a3=_0x2b94d5[_0x805e('0x34')];var _0xd4d229=_0x5cc1b8[_0x805e('0x35')]({'plain':!![]});if(!_0xd4d229[_0x805e('0x11')]){logger[_0x805e('0x36')](_0x805e('0x37')+_0xd4d229['id']);return _0x520638();}if(!_0xd4d229[_0x805e('0x10')]){return _0x520638();}return createHopperForVoiceQueues(_0x3184a3,_0xd4d229)[_0x805e('0xa')](function(){return createHopperBlackForVoiceQueues(_0x3184a3,_0xd4d229);})[_0x805e('0xa')](function(){return createHopperForCampaigns(_0x3184a3,_0xd4d229);})[_0x805e('0xa')](function(){return createHopperBlackForCampaigns(_0x3184a3,_0xd4d229);})['then'](function(){return _0x520638();})['catch'](function(_0x107bc7){logger[_0x805e('0x36')](_0x805e('0x38'),_0x107bc7[_0x805e('0x39')]);_0x520638();});},'afterDestroy':function(_0x52395f,_0x5d7210,_0x4e93f9){var _0x24ae59=_0x2b94d5[_0x805e('0x34')];var _0x5014a5=_0x52395f[_0x805e('0x35')]({'plain':!![]});return _0x24ae59['CmHopper'][_0x805e('0x23')]({'raw':!![],'where':{'ListId':_0x5014a5[_0x805e('0x11')],'ContactId':_0x5014a5['id']}})['then'](function(_0x2295c4){if(!_[_0x805e('0x3a')](_0x2295c4)){var _0x41369c=[];for(var _0x573922=0x0;_0x573922<_0x2295c4[_0x805e('0x3b')];_0x573922+=0x1){var _0x37653f=_0x24ae59['CmHopper'][_0x805e('0x3c')]({'where':{'ListId':_0x2295c4[_0x573922][_0x805e('0x11')],'ContactId':_0x2295c4[_0x573922]['ContactId'],'VoiceQueueId':_0x2295c4[_0x573922][_0x805e('0x1d')],'CampaignId':_0x2295c4[_0x573922][_0x805e('0x1a')]}});_0x41369c[_0x805e('0x3d')](_0x37653f);}return Promise[_0x805e('0x25')](_0x41369c);}})['then'](function(_0x1f6fda){logger['info']('[CmContact][afterDestroy][Succesfull]',util[_0x805e('0x3e')](_0x1f6fda,{'showHidden':![],'depth':null}));_0x4e93f9();})[_0x805e('0x3f')](function(_0x18e84e){logger[_0x805e('0x36')](_0x805e('0x40'),util['inspect'](_0x18e84e,{'showHidden':![],'depth':null}));_0x4e93f9(_0x18e84e);});}}});}; \ No newline at end of file +var _0x1189=['utcOffset','add','minutes','format','phone','priority','callbackUniqueid','assign','CmHopper','[Always]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','CmHopperFinal','[Always]\x20Hopper\x20Final\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','\x20in\x20Campaign\x20with\x20id\x20','CampaignId','VoiceQueueId','create','dialCheckDuplicateType','always','findAll','outbound','ListId','Lists','map','all','CmList','BlackLists','CmHopperBlack','exports','define','CmContact','cm_contacts','fti_cm_contacts','firstName','mobile','fax','email','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','models','error','[cmContact][afterCreate]\x20List\x20not\x20found\x20for\x20contact\x20with\x20id\x20','catch','[cmContact][afterCreate]','get','isEmpty','destroy','ContactId','info','inspect','[CmContact][afterDestroy][Error]','util','../../config/logger','api','../../config/environment/shared','Campaign','VoiceQueue','scheduledat','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone','findOne','then','timezones','resolve'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1189,0xb5));var _0x9118=function(_0x3bcbc9,_0x4f1ec2){_0x3bcbc9=_0x3bcbc9-0x0;var _0x46afb8=_0x1189[_0x3bcbc9];return _0x46afb8;};'use strict';var _=require('lodash');var util=require(_0x9118('0x0'));var logger=require(_0x9118('0x1'))(_0x9118('0x2'));var moment=require('moment');var shared=require(_0x9118('0x3'));var attributes=require('./cmContact.attributes');function getTimezoneCallbackAt(_0x1c3212,_0x84d646,_0x585d25,_0x5d6bd4){var _0x4c3654=_0x5d6bd4?_0x9118('0x4'):_0x9118('0x5');var _0x883101=_0x585d25[_0x9118('0x6')]?_0x585d25[_0x9118('0x6')]:moment()['format'](_0x9118('0x7'));if(_[_0x9118('0x8')](_0x585d25[_0x9118('0x9')])){return Promise['resolve'](_0x883101);}return _0x1c3212[_0x4c3654][_0x9118('0xa')]({'where':{'id':_0x84d646}})[_0x9118('0xb')](function(_0x355657){if(_['isNil'](_0x355657)||_[_0x9118('0x8')](_0x355657[_0x9118('0x9')])){return Promise['resolve'](_0x883101);}var _0x5003a4=shared[_0x9118('0xc')];var _0x1c1967=_0x5003a4[_0x355657[_0x9118('0x9')]];var _0x3d6336=_0x5003a4[_0x585d25[_0x9118('0x9')]];if(_[_0x9118('0x8')](_0x1c1967)&&_[_0x9118('0x8')](_0x3d6336)){return Promise[_0x9118('0xd')](_0x883101);}var _0x1ca7db=_0x1c1967[_0x9118('0xe')]-_0x3d6336[_0x9118('0xe')];var _0x4ef65c=_0x585d25['scheduledat']?_0x585d25['scheduledat']:moment();_0x883101=moment(_0x4ef65c)[_0x9118('0xf')](_0x1ca7db,_0x9118('0x10'))[_0x9118('0x11')](_0x9118('0x7'));return Promise[_0x9118('0xd')](_0x883101);});}function getNewHopperPayload(_0x159d60){return{'phone':_0x159d60[_0x9118('0x12')],'ContactId':_0x159d60['id'],'ListId':_0x159d60['ListId'],'scheduledat':_0x159d60[_0x9118('0x6')]?_0x159d60[_0x9118('0x6')]:moment()[_0x9118('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x159d60[_0x9118('0x13')]?_0x159d60['priority']:0x2,'callback':_0x159d60[_0x9118('0x14')]?!![]:![],'callbackuniqueid':_0x159d60[_0x9118('0x14')]?_0x159d60[_0x9118('0x14')]:undefined,'callbackat':_0x159d60[_0x9118('0x14')]?moment()[_0x9118('0x11')]('YYYY-MM-DD\x20HH:mm:ss'):undefined};}function handleAlwaysCheckDuplicate(_0x274e9c,_0x4622db,_0x21b62c,_0x3f5957){var _0x211170={'phone':_0x21b62c['phone']};var _0x1cc12e={'calleridnum':_0x21b62c[_0x9118('0x12')]};if(_0x3f5957){Object[_0x9118('0x15')](_0x211170,{'CampaignId':_0x4622db['id']});Object[_0x9118('0x15')](_0x1cc12e,{'CampaignId':_0x4622db['id']});}else{Object['assign'](_0x211170,{'VoiceQueueId':_0x4622db['id']});Object[_0x9118('0x15')](_0x1cc12e,{'VoiceQueueId':_0x4622db['id']});}return _0x274e9c[_0x9118('0x16')][_0x9118('0xa')]({'where':_0x211170})[_0x9118('0xb')](function(_0x1306fc){if(_0x1306fc){throw new Error(_0x9118('0x17')+_0x21b62c[_0x9118('0x12')]+'\x20in\x20Campaign\x20with\x20id\x20'+_0x4622db['id']);}return _0x274e9c[_0x9118('0x18')]['findOne']({'where':_0x1cc12e});})[_0x9118('0xb')](function(_0x2469bb){if(_0x2469bb){throw new Error(_0x9118('0x19')+_0x21b62c['phone']+_0x9118('0x1a')+_0x4622db['id']);}var _0x6e26ba=getNewHopperPayload(_0x21b62c);if(_0x3f5957){_0x6e26ba[_0x9118('0x1b')]=_0x4622db['id'];}else{_0x6e26ba[_0x9118('0x1c')]=_0x4622db['id'];}return _0x274e9c['CmHopper'][_0x9118('0x1d')](_0x6e26ba);});}function handleOnlyIfOpenCheckDuplicate(_0x58f38f,_0x179f1d,_0x235631,_0x3a2c44){var _0x18f8f2={'phone':_0x235631[_0x9118('0x12')]};if(_0x3a2c44){Object['assign'](_0x18f8f2,{'CampaignId':_0x179f1d['id']});}else{Object[_0x9118('0x15')](_0x18f8f2,{'VoiceQueueId':_0x179f1d['id']});}return _0x58f38f[_0x9118('0x16')]['findOne']({'where':_0x18f8f2})['then'](function(_0x5c1cf7){if(_0x5c1cf7){throw new Error('[OnlyIfOpen]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20'+_0x235631[_0x9118('0x12')]+_0x9118('0x1a')+_0x179f1d['id']);}var _0x9e7080=getNewHopperPayload(_0x235631);if(_0x3a2c44){_0x9e7080[_0x9118('0x1b')]=_0x179f1d['id'];}else{_0x9e7080[_0x9118('0x1c')]=_0x179f1d['id'];}return _0x58f38f[_0x9118('0x16')]['create'](_0x9e7080);});}function handleNeverCheckDuplicate(_0x5f67dc,_0x5e17a8,_0x53fae0){var _0x4dddfe=getNewHopperPayload(_0x53fae0);_0x4dddfe[_0x9118('0x1c')]=_0x5e17a8['id'];return _0x5f67dc[_0x9118('0x16')][_0x9118('0x1d')](_0x4dddfe);}function handleCheckDuplicate(_0x12e806,_0x20cb94,_0x1ca335,_0x2791a8){return getTimezoneCallbackAt(_0x12e806,_0x20cb94,_0x1ca335,_0x2791a8)[_0x9118('0xb')](function(_0x2be701){_0x1ca335[_0x9118('0x6')]=_0x2be701;switch(_0x20cb94[_0x9118('0x1e')]){case _0x9118('0x1f'):return handleAlwaysCheckDuplicate(_0x12e806,_0x20cb94,_0x1ca335,_0x2791a8);case'onlyIfOpen':return handleOnlyIfOpenCheckDuplicate(_0x12e806,_0x20cb94,_0x1ca335,_0x2791a8);default:return handleNeverCheckDuplicate(_0x12e806,_0x20cb94,_0x1ca335);}});}function createHopperForVoiceQueues(_0x2101c3,_0x3497fe){return _0x2101c3['VoiceQueue'][_0x9118('0x20')]({'where':{'type':_0x9118('0x21')},'attributes':['id',_0x9118('0x1e'),'dialTimezone'],'include':[{'model':_0x2101c3['CmList'],'as':'Lists','where':{'id':_0x3497fe[_0x9118('0x22')]}}],'raw':!![]})[_0x9118('0xb')](function(_0x27a528){var _0x4a23a5=_0x27a528['map'](function(_0x3d1a5b){return handleCheckDuplicate(_0x2101c3,_0x3d1a5b,_0x3497fe,![]);});return Promise['all'](_0x4a23a5);});}function createHopperForCampaigns(_0x5a6f91,_0x4948ce){return _0x5a6f91[_0x9118('0x4')][_0x9118('0x20')]({'attributes':['id','dialCheckDuplicateType',_0x9118('0x9')],'include':[{'model':_0x5a6f91['CmList'],'as':_0x9118('0x23'),'where':{'id':_0x4948ce['ListId']}}],'raw':!![]})[_0x9118('0xb')](function(_0x5cad27){var _0x100a94=_0x5cad27[_0x9118('0x24')](function(_0x377291){return handleCheckDuplicate(_0x5a6f91,_0x377291,_0x4948ce,!![]);});return Promise[_0x9118('0x25')](_0x100a94);});}function createHopperBlackForVoiceQueues(_0x4d52c7,_0x91dff3){return _0x4d52c7[_0x9118('0x5')]['findAll']({'where':{'type':_0x9118('0x21')},'attributes':['id'],'include':[{'model':_0x4d52c7[_0x9118('0x26')],'as':_0x9118('0x27'),'where':{'id':_0x91dff3[_0x9118('0x22')]}}],'raw':!![]})['then'](function(_0xa2bf7e){var _0x1c23c3=_0xa2bf7e[_0x9118('0x24')](function(_0x59c4fe){return _0x4d52c7[_0x9118('0x28')][_0x9118('0x1d')]({'phone':_0x91dff3['phone'],'ContactId':_0x91dff3['id'],'ListId':_0x91dff3['ListId'],'VoiceQueueId':_0x59c4fe['id']});});return Promise[_0x9118('0x25')](_0x1c23c3);});}function createHopperBlackForCampaigns(_0x2b8e8e,_0x5a65a5){return _0x2b8e8e[_0x9118('0x4')][_0x9118('0x20')]({'attributes':['id'],'include':[{'model':_0x2b8e8e[_0x9118('0x26')],'as':_0x9118('0x27'),'where':{'id':_0x5a65a5[_0x9118('0x22')]}}],'raw':!![]})[_0x9118('0xb')](function(_0x2d3477){var _0x41ec52=_0x2d3477[_0x9118('0x24')](function(_0x100f1e){return _0x2b8e8e[_0x9118('0x28')][_0x9118('0x1d')]({'phone':_0x5a65a5[_0x9118('0x12')],'ContactId':_0x5a65a5['id'],'ListId':_0x5a65a5[_0x9118('0x22')],'CampaignId':_0x100f1e['id']});});return Promise[_0x9118('0x25')](_0x41ec52);});}module[_0x9118('0x29')]=function(_0x3a0307){return _0x3a0307[_0x9118('0x2a')](_0x9118('0x2b'),attributes,{'tableName':_0x9118('0x2c'),'paranoid':!![],'indexes':[{'name':'phone','fields':[_0x9118('0x12')]},{'name':_0x9118('0x2d'),'fields':[_0x9118('0x2e'),'lastName',_0x9118('0x12'),_0x9118('0x2f'),_0x9118('0x30'),_0x9118('0x31')],'type':_0x9118('0x32')}],'timestamps':!![],'charset':_0x9118('0x33'),'collate':_0x9118('0x34'),'hooks':{'afterCreate':function(_0x35ebe8,_0x53792c,_0x1da6b5){var _0x326433=_0x3a0307[_0x9118('0x35')];var _0x32b706=_0x35ebe8['get']({'plain':!![]});if(!_0x32b706['ListId']){logger[_0x9118('0x36')](_0x9118('0x37')+_0x32b706['id']);return _0x1da6b5();}if(!_0x32b706[_0x9118('0x12')]){return _0x1da6b5();}return createHopperForVoiceQueues(_0x326433,_0x32b706)[_0x9118('0xb')](function(){return createHopperBlackForVoiceQueues(_0x326433,_0x32b706);})['then'](function(){return createHopperForCampaigns(_0x326433,_0x32b706);})[_0x9118('0xb')](function(){return createHopperBlackForCampaigns(_0x326433,_0x32b706);})['then'](function(){return _0x1da6b5();})[_0x9118('0x38')](function(_0x1d8af1){logger[_0x9118('0x36')](_0x9118('0x39'),_0x1d8af1['message']);_0x1da6b5();});},'afterDestroy':function(_0x444e1a,_0x1cc720,_0x1fe374){var _0xfe262c=_0x3a0307[_0x9118('0x35')];var _0x2c6a2d=_0x444e1a[_0x9118('0x3a')]({'plain':!![]});return _0xfe262c['CmHopper'][_0x9118('0x20')]({'raw':!![],'where':{'ListId':_0x2c6a2d[_0x9118('0x22')],'ContactId':_0x2c6a2d['id']}})['then'](function(_0x39bd43){if(!_[_0x9118('0x3b')](_0x39bd43)){var _0x31c40d=[];for(var _0x30a851=0x0;_0x30a851<_0x39bd43['length'];_0x30a851+=0x1){var _0x778576=_0xfe262c[_0x9118('0x16')][_0x9118('0x3c')]({'where':{'ListId':_0x39bd43[_0x30a851][_0x9118('0x22')],'ContactId':_0x39bd43[_0x30a851][_0x9118('0x3d')],'VoiceQueueId':_0x39bd43[_0x30a851][_0x9118('0x1c')],'CampaignId':_0x39bd43[_0x30a851]['CampaignId']}});_0x31c40d['push'](_0x778576);}return Promise[_0x9118('0x25')](_0x31c40d);}})[_0x9118('0xb')](function(_0x12ade4){logger[_0x9118('0x3e')]('[CmContact][afterDestroy][Succesfull]',util[_0x9118('0x3f')](_0x12ade4,{'showHidden':![],'depth':null}));_0x1fe374();})['catch'](function(_0x2061e8){logger['error'](_0x9118('0x40'),util[_0x9118('0x3f')](_0x2061e8,{'showHidden':![],'depth':null}));_0x1fe374(_0x2061e8);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index 8234817..3a9ebad 100644 --- a/server/api/cmContact/cmContact.rpc.js +++ b/server/api/cmContact/cmContact.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['phone','ListId','Contact','CmContactId','create','body','keys','length','startsWith','update','table','cm_contacts','id\x20=\x20?','sequelize','query','CreateCmContact','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','./cmContact.socket','register','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetCmContact','CmContact','findAll','options','where','limit','include','map','model','attributes','then','stringify','CmContactHasItem','find'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'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(_0x3c21af,_0x261966){var _0x58d4eb=function(_0x4de47a){while(--_0x4de47a){_0x3c21af['push'](_0x3c21af['shift']());}};_0x58d4eb(++_0x261966);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));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 058b973..881006e 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 _0x07c3=['STRING','PHONE','sequelize','exports','INTEGER'];(function(_0x1cb18a,_0x33167a){var _0x22442e=function(_0x46c611){while(--_0x46c611){_0x1cb18a['push'](_0x1cb18a['shift']());}};_0x22442e(++_0x33167a);}(_0x07c3,0x1bf));var _0x307c=function(_0x4de586,_0x183427){_0x4de586=_0x4de586-0x0;var _0x46baf5=_0x07c3[_0x4de586];return _0x46baf5;};'use strict';var Sequelize=require(_0x307c('0x0'));module[_0x307c('0x1')]={'CmContactId':{'type':Sequelize[_0x307c('0x2')],'primaryKey':!![]},'item':{'type':Sequelize[_0x307c('0x3')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x307c('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x307c('0x3')],'defaultValue':_0x307c('0x4')},'OrderBy':{'type':Sequelize[_0x307c('0x2')],'defaultValue':null},'description':{'type':Sequelize['STRING'],'defaultValue':null}}; \ No newline at end of file +var _0x5620=['INTEGER','STRING','sequelize'];(function(_0x1d5400,_0x567e3c){var _0x21d9fe=function(_0x23fb75){while(--_0x23fb75){_0x1d5400['push'](_0x1d5400['shift']());}};_0x21d9fe(++_0x567e3c);}(_0x5620,0xbf));var _0x0562=function(_0xcf7d1e,_0x1b00ad){_0xcf7d1e=_0xcf7d1e-0x0;var _0x42b2cb=_0x5620[_0xcf7d1e];return _0x42b2cb;};'use strict';var Sequelize=require(_0x0562('0x0'));module['exports']={'CmContactId':{'type':Sequelize[_0x0562('0x1')],'primaryKey':!![]},'item':{'type':Sequelize[_0x0562('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize['INTEGER'],'defaultValue':null},'ItemClass':{'type':Sequelize['STRING'],'defaultValue':'PHONE'},'OrderBy':{'type':Sequelize[_0x0562('0x1')],'defaultValue':null},'description':{'type':Sequelize['STRING'],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.controller.js b/server/api/cmContactHasItem/cmContactHasItem.controller.js index 3c0b99b..e7ddefe 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 _0x9ae1=['query','keys','filters','intersection','fields','attributes','length','nolimit','limit','order','sort','where','pick','filter','merge','map','type','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CmContactHasItems','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','UserProfileResource','destroy','sendStatus','stack','name','send','index','CmContactHasItem','rawAttributes','fieldName','key','model'];(function(_0xdd7ef3,_0x4cd117){var _0x1148fc=function(_0x307b24){while(--_0x307b24){_0xdd7ef3['push'](_0xdd7ef3['shift']());}};_0x1148fc(++_0x4cd117);}(_0x9ae1,0x1dc));var _0x19ae=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0x9ae1[_0x24061a];return _0x82054e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x19ae('0x0'));var zipdir=require(_0x19ae('0x1'));var jsonpatch=require(_0x19ae('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x19ae('0x3'));var Mustache=require(_0x19ae('0x4'));var util=require(_0x19ae('0x5'));var path=require(_0x19ae('0x6'));var sox=require(_0x19ae('0x7'));var csv=require('to-csv');var ejs=require(_0x19ae('0x8'));var fs=require('fs');var fs_extra=require(_0x19ae('0x9'));var _=require(_0x19ae('0xa'));var squel=require(_0x19ae('0xb'));var crypto=require(_0x19ae('0xc'));var jsforce=require(_0x19ae('0xd'));var deskjs=require(_0x19ae('0xe'));var toCsv=require('to-csv');var querystring=require(_0x19ae('0xf'));var Papa=require(_0x19ae('0x10'));var Redis=require(_0x19ae('0x11'));var authService=require(_0x19ae('0x12'));var qs=require(_0x19ae('0x13'));var as=require(_0x19ae('0x14'));var hardwareService=require(_0x19ae('0x15'));var logger=require(_0x19ae('0x16'))(_0x19ae('0x17'));var utils=require('../../config/utils');var config=require(_0x19ae('0x18'));var licenseUtil=require(_0x19ae('0x19'));var db=require(_0x19ae('0x1a'))['db'];function respondWithStatusCode(_0x354064,_0x7aa57b){_0x7aa57b=_0x7aa57b||0xcc;return function(_0xa03974){if(_0xa03974){return _0x354064['sendStatus'](_0x7aa57b);}return _0x354064[_0x19ae('0x1b')](_0x7aa57b)[_0x19ae('0x1c')]();};}function respondWithResult(_0x281a7c,_0x3ce738){_0x3ce738=_0x3ce738||0xc8;return function(_0x5a378d){if(_0x5a378d){return _0x281a7c[_0x19ae('0x1b')](_0x3ce738)[_0x19ae('0x1d')](_0x5a378d);}};}function respondWithFilteredResult(_0x2617cd,_0x11642e){return function(_0x862084){if(_0x862084){var _0x1e25e1=typeof _0x11642e[_0x19ae('0x1e')]===_0x19ae('0x1f')&&typeof _0x11642e['limit']===_0x19ae('0x1f');var _0x1d31cf=_0x862084[_0x19ae('0x20')];var _0x24714c=_0x1e25e1?0x0:_0x11642e[_0x19ae('0x1e')];var _0x39bc73=_0x1e25e1?_0x862084[_0x19ae('0x20')]:_0x11642e['offset']+_0x11642e['limit'];var _0x162dc2;if(_0x39bc73>=_0x1d31cf){_0x39bc73=_0x1d31cf;_0x162dc2=0xc8;}else{_0x162dc2=0xce;}_0x2617cd[_0x19ae('0x1b')](_0x162dc2);return _0x2617cd[_0x19ae('0x21')](_0x19ae('0x22'),_0x24714c+'-'+_0x39bc73+'/'+_0x1d31cf)['json'](_0x862084);}return null;};}function patchUpdates(_0x471847){return function(_0x1000ec){try{jsonpatch[_0x19ae('0x23')](_0x1000ec,_0x471847,!![]);}catch(_0x49297b){return BPromise[_0x19ae('0x24')](_0x49297b);}return _0x1000ec[_0x19ae('0x25')]();};}function saveUpdates(_0x37cd66,_0x39c653){return function(_0x579cdb){if(_0x579cdb){return _0x579cdb[_0x19ae('0x26')](_0x37cd66)[_0x19ae('0x27')](function(_0x52ba8c){return _0x52ba8c;});}return null;};}function removeEntity(_0x2c5e5d,_0x5c3519){return function(_0x1b07bf){if(_0x1b07bf){return _0x1b07bf['destroy']()[_0x19ae('0x27')](function(){var _0x3c7f30=_0x1b07bf['get']({'plain':!![]});var _0x345c47='CmContactHasItems';return db[_0x19ae('0x28')][_0x19ae('0x29')]({'where':{'type':_0x345c47,'resourceId':_0x3c7f30['id']}})[_0x19ae('0x27')](function(){return _0x1b07bf;});})['then'](function(){_0x2c5e5d[_0x19ae('0x1b')](0xcc)[_0x19ae('0x1c')]();});}};}function handleEntityNotFound(_0x450d34,_0x3f7a59){return function(_0x161062){if(!_0x161062){_0x450d34[_0x19ae('0x2a')](0x194);}return _0x161062;};}function handleError(_0x4bb37b,_0x10deb4){_0x10deb4=_0x10deb4||0x1f4;return function(_0x1b3a8b){logger['error'](_0x1b3a8b[_0x19ae('0x2b')]);if(_0x1b3a8b[_0x19ae('0x2c')]){delete _0x1b3a8b[_0x19ae('0x2c')];}_0x4bb37b[_0x19ae('0x1b')](_0x10deb4)[_0x19ae('0x2d')](_0x1b3a8b);};}exports[_0x19ae('0x2e')]=function(_0x5dfccb,_0x38e025){var _0x25527c={},_0x5780a7={},_0x1a0962={'count':0x0,'rows':[]};var _0x4b4f13=_['map'](db[_0x19ae('0x2f')][_0x19ae('0x30')],function(_0x26be78){return{'name':_0x26be78[_0x19ae('0x31')],'type':_0x26be78['type'][_0x19ae('0x32')]};});_0x5780a7[_0x19ae('0x33')]=_['map'](_0x4b4f13,'name');_0x5780a7[_0x19ae('0x34')]=_[_0x19ae('0x35')](_0x5dfccb['query']);_0x5780a7[_0x19ae('0x36')]=_[_0x19ae('0x37')](_0x5780a7[_0x19ae('0x33')],_0x5780a7[_0x19ae('0x34')]);_0x25527c['attributes']=_['intersection'](_0x5780a7[_0x19ae('0x33')],qs[_0x19ae('0x38')](_0x5dfccb[_0x19ae('0x34')][_0x19ae('0x38')]));_0x25527c[_0x19ae('0x39')]=_0x25527c['attributes'][_0x19ae('0x3a')]?_0x25527c[_0x19ae('0x39')]:_0x5780a7['model'];if(!_0x5dfccb[_0x19ae('0x34')]['hasOwnProperty'](_0x19ae('0x3b'))){_0x25527c[_0x19ae('0x3c')]=qs[_0x19ae('0x3c')](_0x5dfccb[_0x19ae('0x34')][_0x19ae('0x3c')]);_0x25527c[_0x19ae('0x1e')]=qs[_0x19ae('0x1e')](_0x5dfccb[_0x19ae('0x34')][_0x19ae('0x1e')]);}_0x25527c[_0x19ae('0x3d')]=qs[_0x19ae('0x3e')](_0x5dfccb[_0x19ae('0x34')][_0x19ae('0x3e')]);_0x25527c[_0x19ae('0x3f')]=qs[_0x19ae('0x36')](_[_0x19ae('0x40')](_0x5dfccb['query'],_0x5780a7[_0x19ae('0x36')]),_0x4b4f13);if(_0x5dfccb[_0x19ae('0x34')][_0x19ae('0x41')]){_0x25527c['where']=_[_0x19ae('0x42')](_0x25527c[_0x19ae('0x3f')],{'$or':_[_0x19ae('0x43')](_0x4b4f13,function(_0x3bd968){if(_0x3bd968[_0x19ae('0x44')]!=='VIRTUAL'){var _0x2f318f={};_0x2f318f[_0x3bd968['name']]={'$like':'%'+_0x5dfccb[_0x19ae('0x34')][_0x19ae('0x41')]+'%'};return _0x2f318f;}})});}_0x25527c=_['merge']({},_0x25527c,_0x5dfccb['options']);var _0x2b3402={'where':_0x25527c[_0x19ae('0x3f')]};return db[_0x19ae('0x2f')]['count'](_0x2b3402)[_0x19ae('0x27')](function(_0x2d7117){_0x1a0962[_0x19ae('0x20')]=_0x2d7117;if(_0x5dfccb[_0x19ae('0x34')][_0x19ae('0x45')]){_0x25527c[_0x19ae('0x46')]=[{'all':!![]}];}return db[_0x19ae('0x2f')][_0x19ae('0x47')](_0x25527c);})['then'](function(_0x211785){_0x1a0962[_0x19ae('0x48')]=_0x211785;return _0x1a0962;})[_0x19ae('0x27')](respondWithFilteredResult(_0x38e025,_0x25527c))[_0x19ae('0x49')](handleError(_0x38e025,null));};exports[_0x19ae('0x4a')]=function(_0x3c9138,_0x5d61b3){var _0x579249={'raw':!![],'where':{'id':_0x3c9138[_0x19ae('0x4b')]['id']}},_0x9d5c75={};_0x9d5c75[_0x19ae('0x33')]=_[_0x19ae('0x35')](db[_0x19ae('0x2f')]['rawAttributes']);_0x9d5c75[_0x19ae('0x34')]=_['keys'](_0x3c9138[_0x19ae('0x34')]);_0x9d5c75['filters']=_['intersection'](_0x9d5c75[_0x19ae('0x33')],_0x9d5c75[_0x19ae('0x34')]);_0x579249[_0x19ae('0x39')]=_[_0x19ae('0x37')](_0x9d5c75['model'],qs[_0x19ae('0x38')](_0x3c9138[_0x19ae('0x34')][_0x19ae('0x38')]));_0x579249[_0x19ae('0x39')]=_0x579249[_0x19ae('0x39')][_0x19ae('0x3a')]?_0x579249['attributes']:_0x9d5c75['model'];if(_0x3c9138[_0x19ae('0x34')]['includeAll']){_0x579249['include']=[{'all':!![]}];}_0x579249=_[_0x19ae('0x42')]({},_0x579249,_0x3c9138[_0x19ae('0x4c')]);return db['CmContactHasItem'][_0x19ae('0x4d')](_0x579249)[_0x19ae('0x27')](handleEntityNotFound(_0x5d61b3,null))[_0x19ae('0x27')](respondWithResult(_0x5d61b3,null))[_0x19ae('0x49')](handleError(_0x5d61b3,null));};exports[_0x19ae('0x4e')]=function(_0x493a82,_0x6670fa){return db['CmContactHasItem'][_0x19ae('0x4e')](_0x493a82[_0x19ae('0x4f')],{})[_0x19ae('0x27')](function(_0x5c055b){var _0x48b102=_0x493a82[_0x19ae('0x50')]['get']({'plain':!![]});if(!_0x48b102)throw new Error(_0x19ae('0x51'));if(_0x48b102[_0x19ae('0x52')]==='user'){var _0x21b2bb=_0x5c055b['get']({'plain':!![]});var _0x14499a=_0x19ae('0x53');return db[_0x19ae('0x54')][_0x19ae('0x4d')]({'where':{'name':_0x14499a,'userProfileId':_0x48b102['userProfileId']},'raw':!![]})[_0x19ae('0x27')](function(_0x419250){if(_0x419250&&_0x419250[_0x19ae('0x55')]===0x0){return db['UserProfileResource'][_0x19ae('0x4e')]({'name':_0x21b2bb['name'],'resourceId':_0x21b2bb['id'],'type':_0x419250['name'],'sectionId':_0x419250['id']},{})[_0x19ae('0x27')](function(){return _0x5c055b;});}else{return _0x5c055b;}})['catch'](function(_0x380188){logger[_0x19ae('0x56')](_0x19ae('0x57'),_0x380188);throw _0x380188;});}return _0x5c055b;})[_0x19ae('0x27')](respondWithResult(_0x6670fa,0xc9))[_0x19ae('0x49')](handleError(_0x6670fa,null));};exports['update']=function(_0x342968,_0x2dd5ba){if(_0x342968[_0x19ae('0x4f')]['id']){delete _0x342968[_0x19ae('0x4f')]['id'];}return db[_0x19ae('0x2f')][_0x19ae('0x4d')]({'where':{'id':_0x342968[_0x19ae('0x4b')]['id']}})[_0x19ae('0x27')](handleEntityNotFound(_0x2dd5ba,null))[_0x19ae('0x27')](saveUpdates(_0x342968[_0x19ae('0x4f')],null))[_0x19ae('0x27')](respondWithResult(_0x2dd5ba,null))['catch'](handleError(_0x2dd5ba,null));};exports[_0x19ae('0x29')]=function(_0x49ccef,_0x3e1cc7){return db['CmContactHasItem']['find']({'where':{'id':_0x49ccef[_0x19ae('0x4b')]['id']}})[_0x19ae('0x27')](handleEntityNotFound(_0x3e1cc7,null))[_0x19ae('0x27')](removeEntity(_0x3e1cc7,null))[_0x19ae('0x49')](handleError(_0x3e1cc7,null));}; \ No newline at end of file +var _0x4a66=['bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','limit','undefined','count','offset','json','apply','save','update','then','get','CmContactHasItems','UserProfileResource','stack','name','send','index','map','CmContactHasItem','rawAttributes','fieldName','query','filters','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','options','find','create','user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0xc47dbb,_0x25cd85){var _0x152bb7=function(_0x2a21cd){while(--_0x2a21cd){_0xc47dbb['push'](_0xc47dbb['shift']());}};_0x152bb7(++_0x25cd85);}(_0x4a66,0x13a));var _0x64a6=function(_0x23c73d,_0x357b21){_0x23c73d=_0x23c73d-0x0;var _0x36ba47=_0x4a66[_0x23c73d];return _0x36ba47;};'use strict';var emlformat=require(_0x64a6('0x0'));var rimraf=require(_0x64a6('0x1'));var zipdir=require(_0x64a6('0x2'));var jsonpatch=require(_0x64a6('0x3'));var rp=require(_0x64a6('0x4'));var moment=require(_0x64a6('0x5'));var BPromise=require(_0x64a6('0x6'));var Mustache=require(_0x64a6('0x7'));var util=require(_0x64a6('0x8'));var path=require(_0x64a6('0x9'));var sox=require(_0x64a6('0xa'));var csv=require(_0x64a6('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x64a6('0xc'));var _=require(_0x64a6('0xd'));var squel=require(_0x64a6('0xe'));var crypto=require(_0x64a6('0xf'));var jsforce=require(_0x64a6('0x10'));var deskjs=require(_0x64a6('0x11'));var toCsv=require(_0x64a6('0xb'));var querystring=require(_0x64a6('0x12'));var Papa=require(_0x64a6('0x13'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x64a6('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x64a6('0x15'));var utils=require(_0x64a6('0x16'));var config=require(_0x64a6('0x17'));var licenseUtil=require(_0x64a6('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x216c52,_0x4c749e){_0x4c749e=_0x4c749e||0xcc;return function(_0x304bed){if(_0x304bed){return _0x216c52[_0x64a6('0x19')](_0x4c749e);}return _0x216c52['status'](_0x4c749e)[_0x64a6('0x1a')]();};}function respondWithResult(_0x5e7fdf,_0x15326b){_0x15326b=_0x15326b||0xc8;return function(_0x5821ee){if(_0x5821ee){return _0x5e7fdf[_0x64a6('0x1b')](_0x15326b)['json'](_0x5821ee);}};}function respondWithFilteredResult(_0x49aad9,_0x378324){return function(_0x301c70){if(_0x301c70){var _0xbaec2e=typeof _0x378324['offset']==='undefined'&&typeof _0x378324[_0x64a6('0x1c')]===_0x64a6('0x1d');var _0xda0196=_0x301c70[_0x64a6('0x1e')];var _0x4ee0f9=_0xbaec2e?0x0:_0x378324['offset'];var _0x596ce7=_0xbaec2e?_0x301c70['count']:_0x378324[_0x64a6('0x1f')]+_0x378324[_0x64a6('0x1c')];var _0x8bef4a;if(_0x596ce7>=_0xda0196){_0x596ce7=_0xda0196;_0x8bef4a=0xc8;}else{_0x8bef4a=0xce;}_0x49aad9[_0x64a6('0x1b')](_0x8bef4a);return _0x49aad9['set']('Content-Range',_0x4ee0f9+'-'+_0x596ce7+'/'+_0xda0196)[_0x64a6('0x20')](_0x301c70);}return null;};}function patchUpdates(_0x4f4a3e){return function(_0x282357){try{jsonpatch[_0x64a6('0x21')](_0x282357,_0x4f4a3e,!![]);}catch(_0x4aa879){return BPromise['reject'](_0x4aa879);}return _0x282357[_0x64a6('0x22')]();};}function saveUpdates(_0x5027a1,_0x1a3e5d){return function(_0x277425){if(_0x277425){return _0x277425[_0x64a6('0x23')](_0x5027a1)[_0x64a6('0x24')](function(_0x3ba6ed){return _0x3ba6ed;});}return null;};}function removeEntity(_0x3e7019,_0x371148){return function(_0x98d586){if(_0x98d586){return _0x98d586['destroy']()[_0x64a6('0x24')](function(){var _0x291a6b=_0x98d586[_0x64a6('0x25')]({'plain':!![]});var _0x9c7f6d=_0x64a6('0x26');return db[_0x64a6('0x27')]['destroy']({'where':{'type':_0x9c7f6d,'resourceId':_0x291a6b['id']}})['then'](function(){return _0x98d586;});})[_0x64a6('0x24')](function(){_0x3e7019['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x38a889,_0x1beec0){return function(_0x3e9a87){if(!_0x3e9a87){_0x38a889[_0x64a6('0x19')](0x194);}return _0x3e9a87;};}function handleError(_0x334294,_0x3c317b){_0x3c317b=_0x3c317b||0x1f4;return function(_0x4be892){logger['error'](_0x4be892[_0x64a6('0x28')]);if(_0x4be892[_0x64a6('0x29')]){delete _0x4be892[_0x64a6('0x29')];}_0x334294[_0x64a6('0x1b')](_0x3c317b)[_0x64a6('0x2a')](_0x4be892);};}exports[_0x64a6('0x2b')]=function(_0x3c1ca9,_0x124ebe){var _0x555e73={},_0x1b0f33={},_0x5ef754={'count':0x0,'rows':[]};var _0x21d71d=_[_0x64a6('0x2c')](db[_0x64a6('0x2d')][_0x64a6('0x2e')],function(_0x429410){return{'name':_0x429410[_0x64a6('0x2f')],'type':_0x429410['type']['key']};});_0x1b0f33['model']=_[_0x64a6('0x2c')](_0x21d71d,_0x64a6('0x29'));_0x1b0f33['query']=_['keys'](_0x3c1ca9[_0x64a6('0x30')]);_0x1b0f33[_0x64a6('0x31')]=_['intersection'](_0x1b0f33[_0x64a6('0x32')],_0x1b0f33[_0x64a6('0x30')]);_0x555e73[_0x64a6('0x33')]=_['intersection'](_0x1b0f33[_0x64a6('0x32')],qs['fields'](_0x3c1ca9[_0x64a6('0x30')][_0x64a6('0x34')]));_0x555e73['attributes']=_0x555e73[_0x64a6('0x33')][_0x64a6('0x35')]?_0x555e73['attributes']:_0x1b0f33[_0x64a6('0x32')];if(!_0x3c1ca9[_0x64a6('0x30')][_0x64a6('0x36')](_0x64a6('0x37'))){_0x555e73[_0x64a6('0x1c')]=qs['limit'](_0x3c1ca9[_0x64a6('0x30')][_0x64a6('0x1c')]);_0x555e73[_0x64a6('0x1f')]=qs[_0x64a6('0x1f')](_0x3c1ca9[_0x64a6('0x30')]['offset']);}_0x555e73['order']=qs['sort'](_0x3c1ca9['query'][_0x64a6('0x38')]);_0x555e73[_0x64a6('0x39')]=qs[_0x64a6('0x31')](_['pick'](_0x3c1ca9[_0x64a6('0x30')],_0x1b0f33['filters']),_0x21d71d);if(_0x3c1ca9[_0x64a6('0x30')]['filter']){_0x555e73[_0x64a6('0x39')]=_[_0x64a6('0x3a')](_0x555e73[_0x64a6('0x39')],{'$or':_['map'](_0x21d71d,function(_0xa2d740){if(_0xa2d740[_0x64a6('0x3b')]!==_0x64a6('0x3c')){var _0x4631de={};_0x4631de[_0xa2d740[_0x64a6('0x29')]]={'$like':'%'+_0x3c1ca9[_0x64a6('0x30')]['filter']+'%'};return _0x4631de;}})});}_0x555e73=_[_0x64a6('0x3a')]({},_0x555e73,_0x3c1ca9['options']);var _0x4c644a={'where':_0x555e73['where']};return db[_0x64a6('0x2d')][_0x64a6('0x1e')](_0x4c644a)[_0x64a6('0x24')](function(_0x5c4f9c){_0x5ef754[_0x64a6('0x1e')]=_0x5c4f9c;if(_0x3c1ca9[_0x64a6('0x30')][_0x64a6('0x3d')]){_0x555e73[_0x64a6('0x3e')]=[{'all':!![]}];}return db[_0x64a6('0x2d')][_0x64a6('0x3f')](_0x555e73);})['then'](function(_0x538fa6){_0x5ef754[_0x64a6('0x40')]=_0x538fa6;return _0x5ef754;})[_0x64a6('0x24')](respondWithFilteredResult(_0x124ebe,_0x555e73))[_0x64a6('0x41')](handleError(_0x124ebe,null));};exports[_0x64a6('0x42')]=function(_0x8d66d2,_0x14e401){var _0x167b73={'raw':!![],'where':{'id':_0x8d66d2[_0x64a6('0x43')]['id']}},_0x78634f={};_0x78634f['model']=_[_0x64a6('0x44')](db[_0x64a6('0x2d')][_0x64a6('0x2e')]);_0x78634f[_0x64a6('0x30')]=_[_0x64a6('0x44')](_0x8d66d2[_0x64a6('0x30')]);_0x78634f[_0x64a6('0x31')]=_['intersection'](_0x78634f['model'],_0x78634f[_0x64a6('0x30')]);_0x167b73[_0x64a6('0x33')]=_['intersection'](_0x78634f['model'],qs[_0x64a6('0x34')](_0x8d66d2[_0x64a6('0x30')][_0x64a6('0x34')]));_0x167b73['attributes']=_0x167b73['attributes'][_0x64a6('0x35')]?_0x167b73[_0x64a6('0x33')]:_0x78634f[_0x64a6('0x32')];if(_0x8d66d2['query']['includeAll']){_0x167b73[_0x64a6('0x3e')]=[{'all':!![]}];}_0x167b73=_[_0x64a6('0x3a')]({},_0x167b73,_0x8d66d2[_0x64a6('0x45')]);return db[_0x64a6('0x2d')][_0x64a6('0x46')](_0x167b73)[_0x64a6('0x24')](handleEntityNotFound(_0x14e401,null))[_0x64a6('0x24')](respondWithResult(_0x14e401,null))['catch'](handleError(_0x14e401,null));};exports[_0x64a6('0x47')]=function(_0xccc54a,_0x13c957){return db['CmContactHasItem'][_0x64a6('0x47')](_0xccc54a['body'],{})[_0x64a6('0x24')](function(_0x592093){var _0x28d906=_0xccc54a[_0x64a6('0x48')][_0x64a6('0x25')]({'plain':!![]});if(!_0x28d906)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x28d906['role']===_0x64a6('0x48')){var _0x4eaed2=_0x592093[_0x64a6('0x25')]({'plain':!![]});var _0x35c6ce='CmContactHasItems';return db[_0x64a6('0x49')][_0x64a6('0x46')]({'where':{'name':_0x35c6ce,'userProfileId':_0x28d906[_0x64a6('0x4a')]},'raw':!![]})['then'](function(_0x49883f){if(_0x49883f&&_0x49883f[_0x64a6('0x4b')]===0x0){return db['UserProfileResource'][_0x64a6('0x47')]({'name':_0x4eaed2['name'],'resourceId':_0x4eaed2['id'],'type':_0x49883f[_0x64a6('0x29')],'sectionId':_0x49883f['id']},{})[_0x64a6('0x24')](function(){return _0x592093;});}else{return _0x592093;}})['catch'](function(_0xfcacb9){logger[_0x64a6('0x4c')](_0x64a6('0x4d'),_0xfcacb9);throw _0xfcacb9;});}return _0x592093;})[_0x64a6('0x24')](respondWithResult(_0x13c957,0xc9))['catch'](handleError(_0x13c957,null));};exports[_0x64a6('0x23')]=function(_0x3c00a1,_0x1a3511){if(_0x3c00a1[_0x64a6('0x4e')]['id']){delete _0x3c00a1[_0x64a6('0x4e')]['id'];}return db[_0x64a6('0x2d')][_0x64a6('0x46')]({'where':{'id':_0x3c00a1[_0x64a6('0x43')]['id']}})[_0x64a6('0x24')](handleEntityNotFound(_0x1a3511,null))[_0x64a6('0x24')](saveUpdates(_0x3c00a1[_0x64a6('0x4e')],null))[_0x64a6('0x24')](respondWithResult(_0x1a3511,null))[_0x64a6('0x41')](handleError(_0x1a3511,null));};exports[_0x64a6('0x4f')]=function(_0x5e93f0,_0x53ee77){return db[_0x64a6('0x2d')][_0x64a6('0x46')]({'where':{'id':_0x5e93f0['params']['id']}})[_0x64a6('0x24')](handleEntityNotFound(_0x53ee77,null))[_0x64a6('0x24')](removeEntity(_0x53ee77,null))[_0x64a6('0x41')](handleError(_0x53ee77,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index aa5f58a..b506069 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 _0x8040=['../../config/environment','./cmContactHasItem.attributes','define','CmContactHasItem','lodash','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x3ad0ef,_0x4e82cd){var _0x3902cd=function(_0x235ac8){while(--_0x235ac8){_0x3ad0ef['push'](_0x3ad0ef['shift']());}};_0x3902cd(++_0x4e82cd);}(_0x8040,0x12d));var _0x0804=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x8040[_0x31e29a];return _0x32d892;};'use strict';var _=require(_0x0804('0x0'));var util=require('util');var logger=require(_0x0804('0x1'))(_0x0804('0x2'));var moment=require(_0x0804('0x3'));var BPromise=require('bluebird');var rp=require(_0x0804('0x4'));var fs=require('fs');var path=require(_0x0804('0x5'));var rimraf=require(_0x0804('0x6'));var config=require(_0x0804('0x7'));var attributes=require(_0x0804('0x8'));module['exports']=function(_0x7eedde,_0x3c094f){return _0x7eedde[_0x0804('0x9')](_0x0804('0xa'),attributes,{'tableName':'cm_contact_has_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x19ec=['api','request-promise','path','../../config/environment','exports','define','CmContactHasItem','cm_contact_has_items','lodash','util','../../config/logger'];(function(_0x461a6b,_0x3ce902){var _0x3688a7=function(_0x1ee930){while(--_0x1ee930){_0x461a6b['push'](_0x461a6b['shift']());}};_0x3688a7(++_0x3ce902);}(_0x19ec,0x1d6));var _0xc19e=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0x19ec[_0x1caf6a];return _0x1bf493;};'use strict';var _=require(_0xc19e('0x0'));var util=require(_0xc19e('0x1'));var logger=require(_0xc19e('0x2'))(_0xc19e('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc19e('0x4'));var fs=require('fs');var path=require(_0xc19e('0x5'));var rimraf=require('rimraf');var config=require(_0xc19e('0x6'));var attributes=require('./cmContactHasItem.attributes');module[_0xc19e('0x7')]=function(_0x4240c3,_0x48bfda){return _0x4240c3[_0xc19e('0x8')](_0xc19e('0x9'),attributes,{'tableName':_0xc19e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.rpc.js b/server/api/cmContactHasItem/cmContactHasItem.rpc.js index 3fa3a15..4bb5491 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 _0x3e18=['result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3e18,0x189));var _0x83e1=function(_0x22df27,_0x317f8c){_0x22df27=_0x22df27-0x0;var _0x4ed788=_0x3e18[_0x22df27];return _0x4ed788;};'use strict';var _=require(_0x83e1('0x0'));var util=require(_0x83e1('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x83e1('0x2'));var fs=require('fs');var Redis=require(_0x83e1('0x3'));var db=require(_0x83e1('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x83e1('0x5'))(_0x83e1('0x6'));var config=require(_0x83e1('0x7'));var jayson=require(_0x83e1('0x8'));var client=jayson[_0x83e1('0x9')][_0x83e1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x27c7b5,_0x2f3b2c,_0x1ae5cb){return new BPromise(function(_0x4f7288,_0x1b6473){return client['request'](_0x27c7b5,_0x1ae5cb)[_0x83e1('0xb')](function(_0xd2ea43){logger['info'](_0x83e1('0xc'),_0x2f3b2c,_0x83e1('0xd'));logger[_0x83e1('0xe')](_0x83e1('0xf'),_0x2f3b2c,_0x83e1('0xd'),JSON[_0x83e1('0x10')](_0xd2ea43));if(_0xd2ea43[_0x83e1('0x11')]){if(_0xd2ea43[_0x83e1('0x11')][_0x83e1('0x12')]===0x1f4){logger[_0x83e1('0x11')](_0x83e1('0xc'),_0x2f3b2c,_0xd2ea43['error']['message']);return _0x1b6473(_0xd2ea43[_0x83e1('0x11')][_0x83e1('0x13')]);}logger[_0x83e1('0x11')](_0x83e1('0xc'),_0x2f3b2c,_0xd2ea43['error'][_0x83e1('0x13')]);return _0x4f7288(_0xd2ea43[_0x83e1('0x11')][_0x83e1('0x13')]);}else{logger[_0x83e1('0x14')](_0x83e1('0xc'),_0x2f3b2c,'request\x20sent');_0x4f7288(_0xd2ea43[_0x83e1('0x15')]['message']);}})[_0x83e1('0x16')](function(_0x2539df){logger[_0x83e1('0x11')]('CmContactHasItem,\x20%s,\x20%s',_0x2f3b2c,_0x2539df);_0x1b6473(_0x2539df);});});} \ No newline at end of file +var _0xcf65=['bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','moment'];(function(_0x20ef64,_0x4a8fe9){var _0x3707d8=function(_0x5b9a88){while(--_0x5b9a88){_0x20ef64['push'](_0x20ef64['shift']());}};_0x3707d8(++_0x4a8fe9);}(_0xcf65,0x139));var _0x5cf6=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xcf65[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0x5cf6('0x0'));var util=require('util');var moment=require(_0x5cf6('0x1'));var BPromise=require(_0x5cf6('0x2'));var rs=require(_0x5cf6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5cf6('0x4'));var logger=require(_0x5cf6('0x5'))(_0x5cf6('0x6'));var config=require(_0x5cf6('0x7'));var jayson=require(_0x5cf6('0x8'));var client=jayson[_0x5cf6('0x9')][_0x5cf6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x231e28,_0x44ca08,_0x7c3024){return new BPromise(function(_0x3885a1,_0x592e84){return client['request'](_0x231e28,_0x7c3024)[_0x5cf6('0xb')](function(_0x551374){logger[_0x5cf6('0xc')](_0x5cf6('0xd'),_0x44ca08,_0x5cf6('0xe'));logger[_0x5cf6('0xf')](_0x5cf6('0x10'),_0x44ca08,'request\x20sent',JSON['stringify'](_0x551374));if(_0x551374[_0x5cf6('0x11')]){if(_0x551374['error']['code']===0x1f4){logger[_0x5cf6('0x11')](_0x5cf6('0xd'),_0x44ca08,_0x551374[_0x5cf6('0x11')][_0x5cf6('0x12')]);return _0x592e84(_0x551374[_0x5cf6('0x11')]['message']);}logger[_0x5cf6('0x11')]('CmContactHasItem,\x20%s,\x20%s',_0x44ca08,_0x551374[_0x5cf6('0x11')][_0x5cf6('0x12')]);return _0x3885a1(_0x551374[_0x5cf6('0x11')][_0x5cf6('0x12')]);}else{logger['info'](_0x5cf6('0xd'),_0x44ca08,_0x5cf6('0xe'));_0x3885a1(_0x551374[_0x5cf6('0x13')]['message']);}})[_0x5cf6('0x14')](function(_0x28f9fe){logger['error'](_0x5cf6('0xd'),_0x44ca08,_0x28f9fe);_0x592e84(_0x28f9fe);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 3a1d312..9c73493 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 _0x86bc=['isAuthenticated','show','create','/:id','update','delete','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','get'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x86bc,0x19f));var _0xc86b=function(_0x1fcd9a,_0x564a1a){_0x1fcd9a=_0x1fcd9a-0x0;var _0x76238c=_0x86bc[_0x1fcd9a];return _0x76238c;};'use strict';var multer=require(_0xc86b('0x0'));var util=require('util');var path=require(_0xc86b('0x1'));var timeout=require(_0xc86b('0x2'));var express=require('express');var router=express[_0xc86b('0x3')]();var fs_extra=require(_0xc86b('0x4'));var auth=require(_0xc86b('0x5'));var interaction=require(_0xc86b('0x6'));var config=require(_0xc86b('0x7'));var controller=require(_0xc86b('0x8'));router[_0xc86b('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xc86b('0x9')]('/:id',auth[_0xc86b('0xa')](),controller[_0xc86b('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xc86b('0xc')]);router['put'](_0xc86b('0xd'),auth[_0xc86b('0xa')](),controller[_0xc86b('0xe')]);router[_0xc86b('0xf')](_0xc86b('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0xc86b('0x10')]=router; \ No newline at end of file +var _0x2af3=['isAuthenticated','show','create','put','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cmContactHasItem.controller','get','index','/:id'];(function(_0x593cef,_0x27e60b){var _0x3c50c2=function(_0x1fc7ed){while(--_0x1fc7ed){_0x593cef['push'](_0x593cef['shift']());}};_0x3c50c2(++_0x27e60b);}(_0x2af3,0x1a4));var _0x32af=function(_0x12663e,_0x2e8f3a){_0x12663e=_0x12663e-0x0;var _0x88f979=_0x2af3[_0x12663e];return _0x88f979;};'use strict';var multer=require('multer');var util=require(_0x32af('0x0'));var path=require(_0x32af('0x1'));var timeout=require(_0x32af('0x2'));var express=require(_0x32af('0x3'));var router=express[_0x32af('0x4')]();var fs_extra=require(_0x32af('0x5'));var auth=require(_0x32af('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x32af('0x7'));var controller=require(_0x32af('0x8'));router[_0x32af('0x9')]('/',auth['isAuthenticated'](),controller[_0x32af('0xa')]);router[_0x32af('0x9')](_0x32af('0xb'),auth[_0x32af('0xc')](),controller[_0x32af('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x32af('0xe')]);router[_0x32af('0xf')](_0x32af('0xb'),auth[_0x32af('0xc')](),controller['update']);router[_0x32af('0x10')](_0x32af('0xb'),auth[_0x32af('0xc')](),controller['destroy']);module[_0x32af('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index efbb91c..15378e7 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 _0x64f6=['setDataValue','alias','getDataValue','name','TEXT','type','select','parse','values','BOOLEAN','ENUM','voice','lodash','STRING'];(function(_0x3d2eb5,_0x4faee0){var _0x243930=function(_0x4adfcc){while(--_0x4adfcc){_0x3d2eb5['push'](_0x3d2eb5['shift']());}};_0x243930(++_0x4faee0);}(_0x64f6,0x1e8));var _0x664f=function(_0x29df9a,_0x42aff3){_0x29df9a=_0x29df9a-0x0;var _0x3a8e96=_0x64f6[_0x29df9a];return _0x3a8e96;};'use strict';var Sequelize=require('sequelize');var _=require(_0x664f('0x0'));module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x4d13bf){return this['getDataValue']('alias');}},'alias':{'type':Sequelize[_0x664f('0x1')],'allowNull':![],'set':function(_0x24eec4){this[_0x664f('0x2')](_0x664f('0x3'),_0x24eec4?_0x24eec4:this[_0x664f('0x4')](_0x664f('0x5')));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize[_0x664f('0x6')]('long'),'get':function(){if(this[_0x664f('0x4')](_0x664f('0x7'))===_0x664f('0x8')){return JSON[_0x664f('0x9')](this[_0x664f('0x4')](_0x664f('0xa')));}else{return this[_0x664f('0x4')](_0x664f('0xa'));}},'set':function(_0xd4ea1c){if(Array['isArray'](_0xd4ea1c)){this[_0x664f('0x2')]('values',JSON['stringify'](_0xd4ea1c));}else{this[_0x664f('0x2')](_0x664f('0xa'),_0xd4ea1c);}}},'required':{'type':Sequelize[_0x664f('0xb')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x664f('0xb')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x664f('0xc')](_0x664f('0xd'))}}; \ No newline at end of file +var _0x22b2=['ENUM','voice','sequelize','exports','getDataValue','alias','name','STRING','TEXT','long','select','parse','values','isArray','setDataValue','stringify','BOOLEAN'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x22b2,0x178));var _0x222b=function(_0x4775fe,_0x23728e){_0x4775fe=_0x4775fe-0x0;var _0x5cfa77=_0x22b2[_0x4775fe];return _0x5cfa77;};'use strict';var Sequelize=require(_0x222b('0x0'));var _=require('lodash');module[_0x222b('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x1de1c3){return this[_0x222b('0x2')]('alias');}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x2d8168){this['setDataValue'](_0x222b('0x3'),_0x2d8168?_0x2d8168:this[_0x222b('0x2')](_0x222b('0x4')));}},'type':{'type':Sequelize[_0x222b('0x5')],'allowNull':![]},'values':{'type':Sequelize[_0x222b('0x6')](_0x222b('0x7')),'get':function(){if(this[_0x222b('0x2')]('type')===_0x222b('0x8')){return JSON[_0x222b('0x9')](this['getDataValue'](_0x222b('0xa')));}else{return this[_0x222b('0x2')]('values');}},'set':function(_0x11bdd6){if(Array[_0x222b('0xb')](_0x11bdd6)){this[_0x222b('0xc')]('values',JSON[_0x222b('0xd')](_0x11bdd6));}else{this[_0x222b('0xc')]('values',_0x11bdd6);}}},'required':{'type':Sequelize[_0x222b('0xe')],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize[_0x222b('0xf')](_0x222b('0x10'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 35b9af2..605de9a 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 _0x27a6=['to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','destroy','then','error','stack','name','send','index','map','CmCustomField','rawAttributes','fieldName','type','key','differenceBy','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filters','filter','merge','where','VIRTUAL','options','includeAll','include','catch','show','keys','body','params','sequelize','transaction','Sequelize','TEXT','number','INTEGER','BOOLEAN','queryInterface','addColumn','format','cf_%d','rimraf','request-promise','bluebird','path','sox'];(function(_0x28e74e,_0x53fdf1){var _0xb45ac1=function(_0x311a7a){while(--_0x311a7a){_0x28e74e['push'](_0x28e74e['shift']());}};_0xb45ac1(++_0x53fdf1);}(_0x27a6,0x9b));var _0x627a=function(_0x302325,_0x51c70c){_0x302325=_0x302325-0x0;var _0x3d0e32=_0x27a6[_0x302325];return _0x3d0e32;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x627a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x627a('0x1'));var moment=require('moment');var BPromise=require(_0x627a('0x2'));var Mustache=require('mustache');var util=require('util');var path=require(_0x627a('0x3'));var sox=require(_0x627a('0x4'));var csv=require(_0x627a('0x5'));var ejs=require(_0x627a('0x6'));var fs=require('fs');var fs_extra=require(_0x627a('0x7'));var _=require(_0x627a('0x8'));var squel=require('squel');var crypto=require(_0x627a('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x627a('0xa'));var toCsv=require(_0x627a('0x5'));var querystring=require(_0x627a('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x627a('0xc'));var qs=require(_0x627a('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x627a('0xe'));var logger=require('../../config/logger')(_0x627a('0xf'));var utils=require('../../config/utils');var config=require(_0x627a('0x10'));var licenseUtil=require(_0x627a('0x11'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x59d0ce,_0x2efb41){_0x2efb41=_0x2efb41||0xcc;return function(_0x103d7b){if(_0x103d7b){return _0x59d0ce[_0x627a('0x12')](_0x2efb41);}return _0x59d0ce['status'](_0x2efb41)[_0x627a('0x13')]();};}function respondWithResult(_0xee4629,_0x42e98c){_0x42e98c=_0x42e98c||0xc8;return function(_0x47aa8a){if(_0x47aa8a){return _0xee4629[_0x627a('0x14')](_0x42e98c)['json'](_0x47aa8a);}};}function respondWithFilteredResult(_0x576925,_0x1e4edd){return function(_0x14629e){if(_0x14629e){var _0x1703d2=typeof _0x1e4edd[_0x627a('0x15')]===_0x627a('0x16')&&typeof _0x1e4edd[_0x627a('0x17')]===_0x627a('0x16');var _0x39eda5=_0x14629e['count'];var _0x42170e=_0x1703d2?0x0:_0x1e4edd[_0x627a('0x15')];var _0x344835=_0x1703d2?_0x14629e[_0x627a('0x18')]:_0x1e4edd[_0x627a('0x15')]+_0x1e4edd[_0x627a('0x17')];var _0x29fbaa;if(_0x344835>=_0x39eda5){_0x344835=_0x39eda5;_0x29fbaa=0xc8;}else{_0x29fbaa=0xce;}_0x576925[_0x627a('0x14')](_0x29fbaa);return _0x576925[_0x627a('0x19')](_0x627a('0x1a'),_0x42170e+'-'+_0x344835+'/'+_0x39eda5)[_0x627a('0x1b')](_0x14629e);}return null;};}function patchUpdates(_0x15a82a){return function(_0x83deae){try{jsonpatch['apply'](_0x83deae,_0x15a82a,!![]);}catch(_0x18c774){return BPromise[_0x627a('0x1c')](_0x18c774);}return _0x83deae[_0x627a('0x1d')]();};}function saveUpdates(_0x381afa,_0x5c0f45){return function(_0x583d18){if(_0x583d18){return _0x583d18[_0x627a('0x1e')](_0x381afa)['then'](function(_0x31d105){return _0x31d105;});}return null;};}function removeEntity(_0x5656e1,_0x56e641){return function(_0x1c4cac){if(_0x1c4cac){return _0x1c4cac[_0x627a('0x1f')]()[_0x627a('0x20')](function(){_0x5656e1[_0x627a('0x14')](0xcc)[_0x627a('0x13')]();});}};}function handleEntityNotFound(_0x2ad136,_0xc12150){return function(_0x478b6e){if(!_0x478b6e){_0x2ad136[_0x627a('0x12')](0x194);}return _0x478b6e;};}function handleError(_0x4ff4b0,_0x471e82){_0x471e82=_0x471e82||0x1f4;return function(_0x436e43){logger[_0x627a('0x21')](_0x436e43[_0x627a('0x22')]);if(_0x436e43[_0x627a('0x23')]){delete _0x436e43[_0x627a('0x23')];}_0x4ff4b0[_0x627a('0x14')](_0x471e82)[_0x627a('0x24')](_0x436e43);};}exports[_0x627a('0x25')]=function(_0x2adde6,_0x426712){var _0x3229a8={},_0x4f00ae={},_0x42529d={'count':0x0,'rows':[]};var _0x31bed4=_[_0x627a('0x26')](db[_0x627a('0x27')][_0x627a('0x28')],function(_0x1a389d){return{'name':_0x1a389d[_0x627a('0x29')],'type':_0x1a389d[_0x627a('0x2a')][_0x627a('0x2b')]};});_0x4f00ae['model']=_[_0x627a('0x2c')](_[_0x627a('0x26')](_0x31bed4,'name'),[_0x627a('0x23')]);_0x4f00ae[_0x627a('0x2d')]=_['keys'](_0x2adde6[_0x627a('0x2d')]);_0x4f00ae['filters']=_[_0x627a('0x2e')](_0x4f00ae['model'],_0x4f00ae[_0x627a('0x2d')]);_0x3229a8['attributes']=_[_0x627a('0x2e')](_0x4f00ae[_0x627a('0x2f')],qs[_0x627a('0x30')](_0x2adde6[_0x627a('0x2d')][_0x627a('0x30')]));_0x3229a8[_0x627a('0x31')]=_0x3229a8[_0x627a('0x31')][_0x627a('0x32')]?_0x3229a8[_0x627a('0x31')]:_0x4f00ae[_0x627a('0x2f')];if(!_0x2adde6[_0x627a('0x2d')][_0x627a('0x33')](_0x627a('0x34'))){_0x3229a8['limit']=qs[_0x627a('0x17')](_0x2adde6['query'][_0x627a('0x17')]);_0x3229a8[_0x627a('0x15')]=qs[_0x627a('0x15')](_0x2adde6['query'][_0x627a('0x15')]);}_0x3229a8[_0x627a('0x35')]=qs[_0x627a('0x36')](_0x2adde6['query'][_0x627a('0x36')]);_0x3229a8['where']=qs['filters'](_[_0x627a('0x37')](_0x2adde6[_0x627a('0x2d')],_0x4f00ae[_0x627a('0x38')]),_0x31bed4);if(_0x2adde6['query'][_0x627a('0x39')]){_0x3229a8['where']=_[_0x627a('0x3a')](_0x3229a8[_0x627a('0x3b')],{'$or':_[_0x627a('0x26')](_0x31bed4,function(_0x1f2e83){if(_0x1f2e83[_0x627a('0x2a')]!==_0x627a('0x3c')){var _0x574468={};_0x574468[_0x1f2e83['name']]={'$like':'%'+_0x2adde6[_0x627a('0x2d')][_0x627a('0x39')]+'%'};return _0x574468;}})});}_0x3229a8=_['merge']({},_0x3229a8,_0x2adde6[_0x627a('0x3d')]);var _0x4fc011={'where':_0x3229a8[_0x627a('0x3b')]};return db[_0x627a('0x27')]['count'](_0x4fc011)[_0x627a('0x20')](function(_0x3c172f){_0x42529d[_0x627a('0x18')]=_0x3c172f;if(_0x2adde6[_0x627a('0x2d')][_0x627a('0x3e')]){_0x3229a8[_0x627a('0x3f')]=[{'all':!![]}];}return db['CmCustomField']['findAll'](_0x3229a8);})[_0x627a('0x20')](function(_0x12fabc){_0x42529d['rows']=_0x12fabc;return _0x42529d;})[_0x627a('0x20')](respondWithFilteredResult(_0x426712,_0x3229a8))[_0x627a('0x40')](handleError(_0x426712,null));};exports[_0x627a('0x41')]=function(_0x4947a9,_0x11bf92){var _0x5d4f27={'raw':!![],'where':{'id':_0x4947a9['params']['id']}},_0x3a7f6d={};_0x3a7f6d[_0x627a('0x2f')]=_['keys'](db['CmCustomField'][_0x627a('0x28')]);_0x3a7f6d[_0x627a('0x2d')]=_[_0x627a('0x42')](_0x4947a9['query']);_0x3a7f6d[_0x627a('0x38')]=_[_0x627a('0x2e')](_0x3a7f6d[_0x627a('0x2f')],_0x3a7f6d['query']);_0x5d4f27[_0x627a('0x31')]=_[_0x627a('0x2e')](_0x3a7f6d[_0x627a('0x2f')],qs[_0x627a('0x30')](_0x4947a9['query'][_0x627a('0x30')]));_0x5d4f27[_0x627a('0x31')]=_0x5d4f27[_0x627a('0x31')][_0x627a('0x32')]?_0x5d4f27['attributes']:_0x3a7f6d['model'];if(_0x4947a9[_0x627a('0x2d')][_0x627a('0x3e')]){_0x5d4f27[_0x627a('0x3f')]=[{'all':!![]}];}_0x5d4f27=_[_0x627a('0x3a')]({},_0x5d4f27,_0x4947a9[_0x627a('0x3d')]);return db[_0x627a('0x27')]['find'](_0x5d4f27)['then'](handleEntityNotFound(_0x11bf92,null))[_0x627a('0x20')](respondWithResult(_0x11bf92,null))['catch'](handleError(_0x11bf92,null));};exports[_0x627a('0x1e')]=function(_0xf01b21,_0x25160a){if(_0xf01b21['body']['id']){delete _0xf01b21[_0x627a('0x43')]['id'];}return db[_0x627a('0x27')]['find']({'where':{'id':_0xf01b21['params']['id']}})[_0x627a('0x20')](handleEntityNotFound(_0x25160a,null))[_0x627a('0x20')](saveUpdates(_0xf01b21[_0x627a('0x43')],null))['then'](respondWithResult(_0x25160a,null))[_0x627a('0x40')](handleError(_0x25160a,null));};exports[_0x627a('0x1f')]=function(_0x54ffce,_0x4bbd13){return db[_0x627a('0x27')]['find']({'where':{'id':_0x54ffce[_0x627a('0x44')]['id']}})['then'](handleEntityNotFound(_0x4bbd13,null))[_0x627a('0x20')](removeEntity(_0x4bbd13,null))[_0x627a('0x40')](handleError(_0x4bbd13,null));};exports['create']=function(_0x3d2fd6,_0x2701e9){var _0x3cb951;return db[_0x627a('0x45')][_0x627a('0x46')](function(_0xa753c6){return db[_0x627a('0x27')]['create'](_0x3d2fd6[_0x627a('0x43')],{'transaction':_0xa753c6})[_0x627a('0x20')](function(_0x190ca0){_0x3cb951=_0x190ca0;var _0x5c58b0={'type':db[_0x627a('0x47')][_0x627a('0x48')],'transaction':_0xa753c6};switch(_0x3d2fd6[_0x627a('0x43')]['type']){case'text':_0x5c58b0[_0x627a('0x2a')]=db['Sequelize']['TEXT'];break;case _0x627a('0x49'):_0x5c58b0['type']=db[_0x627a('0x47')][_0x627a('0x4a')];break;case'switch':_0x5c58b0[_0x627a('0x2a')]=db[_0x627a('0x47')][_0x627a('0x4b')];_0x5c58b0['defaultValue']=![];break;default:}return db['sequelize'][_0x627a('0x4c')][_0x627a('0x4d')]('cm_contacts',util[_0x627a('0x4e')](_0x627a('0x4f'),_0x3cb951['id']),_0x5c58b0);})[_0x627a('0x20')](function(){return _0x3cb951;});})[_0x627a('0x20')](respondWithResult(_0x2701e9,0xc9))[_0x627a('0x40')](handleError(_0x2701e9,null));}; \ No newline at end of file +var _0x3c7b=['path','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../mysqldb','status','end','offset','undefined','count','set','Content-Range','json','apply','reject','update','destroy','then','sendStatus','error','stack','name','send','index','map','CmCustomField','key','differenceBy','intersection','query','attributes','model','fields','hasOwnProperty','limit','order','where','filters','pick','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','keys','length','options','find','body','sequelize','transaction','create','Sequelize','TEXT','type','text','number','INTEGER','BOOLEAN','defaultValue','queryInterface','cm_contacts','format','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util'];(function(_0x263540,_0x56058a){var _0x450a0d=function(_0x5b2e57){while(--_0x5b2e57){_0x263540['push'](_0x263540['shift']());}};_0x450a0d(++_0x56058a);}(_0x3c7b,0xef));var _0xb3c7=function(_0x3cd3c8,_0x2566a2){_0x3cd3c8=_0x3cd3c8-0x0;var _0x525afe=_0x3c7b[_0x3cd3c8];return _0x525afe;};'use strict';var emlformat=require(_0xb3c7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb3c7('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb3c7('0x2'));var moment=require(_0xb3c7('0x3'));var BPromise=require(_0xb3c7('0x4'));var Mustache=require(_0xb3c7('0x5'));var util=require(_0xb3c7('0x6'));var path=require(_0xb3c7('0x7'));var sox=require('sox');var csv=require(_0xb3c7('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb3c7('0x9'));var crypto=require(_0xb3c7('0xa'));var jsforce=require(_0xb3c7('0xb'));var deskjs=require(_0xb3c7('0xc'));var toCsv=require('to-csv');var querystring=require(_0xb3c7('0xd'));var Papa=require(_0xb3c7('0xe'));var Redis=require('ioredis');var authService=require(_0xb3c7('0xf'));var qs=require(_0xb3c7('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb3c7('0x11'));var logger=require('../../config/logger')(_0xb3c7('0x12'));var utils=require('../../config/utils');var config=require(_0xb3c7('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xb3c7('0x14'))['db'];function respondWithStatusCode(_0x5443c1,_0x4472f0){_0x4472f0=_0x4472f0||0xcc;return function(_0xdbe876){if(_0xdbe876){return _0x5443c1['sendStatus'](_0x4472f0);}return _0x5443c1[_0xb3c7('0x15')](_0x4472f0)[_0xb3c7('0x16')]();};}function respondWithResult(_0x5a6b9b,_0x4ed42f){_0x4ed42f=_0x4ed42f||0xc8;return function(_0x5a40b4){if(_0x5a40b4){return _0x5a6b9b[_0xb3c7('0x15')](_0x4ed42f)['json'](_0x5a40b4);}};}function respondWithFilteredResult(_0x2dc01f,_0x434ebd){return function(_0x4a9e3d){if(_0x4a9e3d){var _0x495c94=typeof _0x434ebd[_0xb3c7('0x17')]===_0xb3c7('0x18')&&typeof _0x434ebd['limit']===_0xb3c7('0x18');var _0x4931a3=_0x4a9e3d[_0xb3c7('0x19')];var _0x1458ad=_0x495c94?0x0:_0x434ebd['offset'];var _0x70d68=_0x495c94?_0x4a9e3d['count']:_0x434ebd[_0xb3c7('0x17')]+_0x434ebd['limit'];var _0x2011e9;if(_0x70d68>=_0x4931a3){_0x70d68=_0x4931a3;_0x2011e9=0xc8;}else{_0x2011e9=0xce;}_0x2dc01f[_0xb3c7('0x15')](_0x2011e9);return _0x2dc01f[_0xb3c7('0x1a')](_0xb3c7('0x1b'),_0x1458ad+'-'+_0x70d68+'/'+_0x4931a3)[_0xb3c7('0x1c')](_0x4a9e3d);}return null;};}function patchUpdates(_0x3f2c33){return function(_0x82dc0){try{jsonpatch[_0xb3c7('0x1d')](_0x82dc0,_0x3f2c33,!![]);}catch(_0x5d92cf){return BPromise[_0xb3c7('0x1e')](_0x5d92cf);}return _0x82dc0['save']();};}function saveUpdates(_0x24cdbb,_0x2f9046){return function(_0x10560d){if(_0x10560d){return _0x10560d[_0xb3c7('0x1f')](_0x24cdbb)['then'](function(_0x3849ae){return _0x3849ae;});}return null;};}function removeEntity(_0xab1d40,_0x348a8d){return function(_0x2e87fc){if(_0x2e87fc){return _0x2e87fc[_0xb3c7('0x20')]()[_0xb3c7('0x21')](function(){_0xab1d40['status'](0xcc)[_0xb3c7('0x16')]();});}};}function handleEntityNotFound(_0x5ed557,_0x3f12ef){return function(_0x5ee3ec){if(!_0x5ee3ec){_0x5ed557[_0xb3c7('0x22')](0x194);}return _0x5ee3ec;};}function handleError(_0xc762c0,_0xea7366){_0xea7366=_0xea7366||0x1f4;return function(_0x2b88d9){logger[_0xb3c7('0x23')](_0x2b88d9[_0xb3c7('0x24')]);if(_0x2b88d9[_0xb3c7('0x25')]){delete _0x2b88d9[_0xb3c7('0x25')];}_0xc762c0[_0xb3c7('0x15')](_0xea7366)[_0xb3c7('0x26')](_0x2b88d9);};}exports[_0xb3c7('0x27')]=function(_0x78bbaf,_0x3be01d){var _0x25336a={},_0x4f0d91={},_0x3e071b={'count':0x0,'rows':[]};var _0x5ba91a=_[_0xb3c7('0x28')](db[_0xb3c7('0x29')]['rawAttributes'],function(_0x4e59eb){return{'name':_0x4e59eb['fieldName'],'type':_0x4e59eb['type'][_0xb3c7('0x2a')]};});_0x4f0d91['model']=_[_0xb3c7('0x2b')](_[_0xb3c7('0x28')](_0x5ba91a,_0xb3c7('0x25')),['name']);_0x4f0d91['query']=_['keys'](_0x78bbaf['query']);_0x4f0d91['filters']=_[_0xb3c7('0x2c')](_0x4f0d91['model'],_0x4f0d91[_0xb3c7('0x2d')]);_0x25336a[_0xb3c7('0x2e')]=_[_0xb3c7('0x2c')](_0x4f0d91[_0xb3c7('0x2f')],qs[_0xb3c7('0x30')](_0x78bbaf['query'][_0xb3c7('0x30')]));_0x25336a[_0xb3c7('0x2e')]=_0x25336a[_0xb3c7('0x2e')]['length']?_0x25336a[_0xb3c7('0x2e')]:_0x4f0d91[_0xb3c7('0x2f')];if(!_0x78bbaf[_0xb3c7('0x2d')][_0xb3c7('0x31')]('nolimit')){_0x25336a[_0xb3c7('0x32')]=qs[_0xb3c7('0x32')](_0x78bbaf[_0xb3c7('0x2d')][_0xb3c7('0x32')]);_0x25336a['offset']=qs[_0xb3c7('0x17')](_0x78bbaf[_0xb3c7('0x2d')][_0xb3c7('0x17')]);}_0x25336a[_0xb3c7('0x33')]=qs['sort'](_0x78bbaf[_0xb3c7('0x2d')]['sort']);_0x25336a[_0xb3c7('0x34')]=qs[_0xb3c7('0x35')](_[_0xb3c7('0x36')](_0x78bbaf[_0xb3c7('0x2d')],_0x4f0d91[_0xb3c7('0x35')]),_0x5ba91a);if(_0x78bbaf[_0xb3c7('0x2d')]['filter']){_0x25336a[_0xb3c7('0x34')]=_[_0xb3c7('0x37')](_0x25336a['where'],{'$or':_['map'](_0x5ba91a,function(_0x16bcbc){if(_0x16bcbc['type']!==_0xb3c7('0x38')){var _0x177008={};_0x177008[_0x16bcbc[_0xb3c7('0x25')]]={'$like':'%'+_0x78bbaf['query']['filter']+'%'};return _0x177008;}})});}_0x25336a=_[_0xb3c7('0x37')]({},_0x25336a,_0x78bbaf['options']);var _0x465791={'where':_0x25336a[_0xb3c7('0x34')]};return db['CmCustomField']['count'](_0x465791)[_0xb3c7('0x21')](function(_0x420e7b){_0x3e071b[_0xb3c7('0x19')]=_0x420e7b;if(_0x78bbaf[_0xb3c7('0x2d')][_0xb3c7('0x39')]){_0x25336a[_0xb3c7('0x3a')]=[{'all':!![]}];}return db[_0xb3c7('0x29')][_0xb3c7('0x3b')](_0x25336a);})[_0xb3c7('0x21')](function(_0x1023ba){_0x3e071b['rows']=_0x1023ba;return _0x3e071b;})[_0xb3c7('0x21')](respondWithFilteredResult(_0x3be01d,_0x25336a))[_0xb3c7('0x3c')](handleError(_0x3be01d,null));};exports[_0xb3c7('0x3d')]=function(_0x54d285,_0x5bbf3c){var _0xeac43c={'raw':!![],'where':{'id':_0x54d285[_0xb3c7('0x3e')]['id']}},_0x49c526={};_0x49c526['model']=_['keys'](db[_0xb3c7('0x29')]['rawAttributes']);_0x49c526[_0xb3c7('0x2d')]=_[_0xb3c7('0x3f')](_0x54d285['query']);_0x49c526[_0xb3c7('0x35')]=_[_0xb3c7('0x2c')](_0x49c526[_0xb3c7('0x2f')],_0x49c526[_0xb3c7('0x2d')]);_0xeac43c[_0xb3c7('0x2e')]=_['intersection'](_0x49c526['model'],qs[_0xb3c7('0x30')](_0x54d285[_0xb3c7('0x2d')][_0xb3c7('0x30')]));_0xeac43c[_0xb3c7('0x2e')]=_0xeac43c[_0xb3c7('0x2e')][_0xb3c7('0x40')]?_0xeac43c[_0xb3c7('0x2e')]:_0x49c526[_0xb3c7('0x2f')];if(_0x54d285[_0xb3c7('0x2d')][_0xb3c7('0x39')]){_0xeac43c['include']=[{'all':!![]}];}_0xeac43c=_[_0xb3c7('0x37')]({},_0xeac43c,_0x54d285[_0xb3c7('0x41')]);return db[_0xb3c7('0x29')][_0xb3c7('0x42')](_0xeac43c)[_0xb3c7('0x21')](handleEntityNotFound(_0x5bbf3c,null))[_0xb3c7('0x21')](respondWithResult(_0x5bbf3c,null))[_0xb3c7('0x3c')](handleError(_0x5bbf3c,null));};exports[_0xb3c7('0x1f')]=function(_0x12eefd,_0x454a4c){if(_0x12eefd['body']['id']){delete _0x12eefd[_0xb3c7('0x43')]['id'];}return db['CmCustomField']['find']({'where':{'id':_0x12eefd['params']['id']}})[_0xb3c7('0x21')](handleEntityNotFound(_0x454a4c,null))[_0xb3c7('0x21')](saveUpdates(_0x12eefd[_0xb3c7('0x43')],null))[_0xb3c7('0x21')](respondWithResult(_0x454a4c,null))[_0xb3c7('0x3c')](handleError(_0x454a4c,null));};exports['destroy']=function(_0x34acb6,_0x3b6608){return db['CmCustomField']['find']({'where':{'id':_0x34acb6[_0xb3c7('0x3e')]['id']}})[_0xb3c7('0x21')](handleEntityNotFound(_0x3b6608,null))['then'](removeEntity(_0x3b6608,null))['catch'](handleError(_0x3b6608,null));};exports['create']=function(_0x50da94,_0x17faa2){var _0x53ffab;return db[_0xb3c7('0x44')][_0xb3c7('0x45')](function(_0x1844ac){return db[_0xb3c7('0x29')][_0xb3c7('0x46')](_0x50da94[_0xb3c7('0x43')],{'transaction':_0x1844ac})['then'](function(_0x4edf03){_0x53ffab=_0x4edf03;var _0x2cf35f={'type':db[_0xb3c7('0x47')][_0xb3c7('0x48')],'transaction':_0x1844ac};switch(_0x50da94['body'][_0xb3c7('0x49')]){case _0xb3c7('0x4a'):_0x2cf35f['type']=db[_0xb3c7('0x47')][_0xb3c7('0x48')];break;case _0xb3c7('0x4b'):_0x2cf35f[_0xb3c7('0x49')]=db[_0xb3c7('0x47')][_0xb3c7('0x4c')];break;case'switch':_0x2cf35f[_0xb3c7('0x49')]=db[_0xb3c7('0x47')][_0xb3c7('0x4d')];_0x2cf35f[_0xb3c7('0x4e')]=![];break;default:}return db[_0xb3c7('0x44')][_0xb3c7('0x4f')]['addColumn'](_0xb3c7('0x50'),util[_0xb3c7('0x51')]('cf_%d',_0x53ffab['id']),_0x2cf35f);})['then'](function(){return _0x53ffab;});})[_0xb3c7('0x21')](respondWithResult(_0x17faa2,0xc9))[_0xb3c7('0x3c')](handleError(_0x17faa2,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index ce74e8a..1b9996d 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 _0xe32d=['./cmCustomField.attributes','exports','define','CmCustomField','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x304178,_0x113315){var _0x561094=function(_0x43d62b){while(--_0x43d62b){_0x304178['push'](_0x304178['shift']());}};_0x561094(++_0x113315);}(_0xe32d,0x1bc));var _0xde32=function(_0x292db9,_0x3ccf84){_0x292db9=_0x292db9-0x0;var _0x2cd9f5=_0xe32d[_0x292db9];return _0x2cd9f5;};'use strict';var _=require('lodash');var util=require(_0xde32('0x0'));var logger=require(_0xde32('0x1'))('api');var moment=require(_0xde32('0x2'));var BPromise=require(_0xde32('0x3'));var rp=require(_0xde32('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xde32('0x5'));var config=require(_0xde32('0x6'));var attributes=require(_0xde32('0x7'));module[_0xde32('0x8')]=function(_0x13fc62,_0x55e8c1){return _0x13fc62[_0xde32('0x9')](_0xde32('0xa'),attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x94ca=['cm_custom_fields','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmCustomField.attributes','define','CmCustomField'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x94ca,0x71));var _0xa94c=function(_0x46bc72,_0x1ffb8e){_0x46bc72=_0x46bc72-0x0;var _0x9b9800=_0x94ca[_0x46bc72];return _0x9b9800;};'use strict';var _=require(_0xa94c('0x0'));var util=require(_0xa94c('0x1'));var logger=require(_0xa94c('0x2'))(_0xa94c('0x3'));var moment=require(_0xa94c('0x4'));var BPromise=require(_0xa94c('0x5'));var rp=require(_0xa94c('0x6'));var fs=require('fs');var path=require(_0xa94c('0x7'));var rimraf=require(_0xa94c('0x8'));var config=require(_0xa94c('0x9'));var attributes=require(_0xa94c('0xa'));module['exports']=function(_0x582a5e,_0x5e84dc){return _0x582a5e[_0xa94c('0xb')](_0xa94c('0xc'),attributes,{'tableName':_0xa94c('0xd'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index 0717229..825c15d 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 _0x23fc=['../../config/logger','rpc','../../config/environment','client','request','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','bluebird','randomstring','ioredis'];(function(_0x4a85a6,_0x2bda1c){var _0x5b7080=function(_0xc4b84e){while(--_0xc4b84e){_0x4a85a6['push'](_0x4a85a6['shift']());}};_0x5b7080(++_0x2bda1c);}(_0x23fc,0x10d));var _0xc23f=function(_0x38af48,_0x400460){_0x38af48=_0x38af48-0x0;var _0x445384=_0x23fc[_0x38af48];return _0x445384;};'use strict';var _=require('lodash');var util=require(_0xc23f('0x0'));var moment=require('moment');var BPromise=require(_0xc23f('0x1'));var rs=require(_0xc23f('0x2'));var fs=require('fs');var Redis=require(_0xc23f('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc23f('0x4'))(_0xc23f('0x5'));var config=require(_0xc23f('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xc23f('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1dc3f3,_0x578f0d,_0x4b0daa){return new BPromise(function(_0x517b73,_0x5ec239){return client[_0xc23f('0x8')](_0x1dc3f3,_0x4b0daa)[_0xc23f('0x9')](function(_0x3986e5){logger[_0xc23f('0xa')](_0xc23f('0xb'),_0x578f0d,_0xc23f('0xc'));logger[_0xc23f('0xd')](_0xc23f('0xe'),_0x578f0d,_0xc23f('0xc'),JSON[_0xc23f('0xf')](_0x3986e5));if(_0x3986e5[_0xc23f('0x10')]){if(_0x3986e5['error'][_0xc23f('0x11')]===0x1f4){logger[_0xc23f('0x10')]('CmCustomField,\x20%s,\x20%s',_0x578f0d,_0x3986e5['error']['message']);return _0x5ec239(_0x3986e5['error']['message']);}logger[_0xc23f('0x10')](_0xc23f('0xb'),_0x578f0d,_0x3986e5['error'][_0xc23f('0x12')]);return _0x517b73(_0x3986e5[_0xc23f('0x10')][_0xc23f('0x12')]);}else{logger['info'](_0xc23f('0xb'),_0x578f0d,_0xc23f('0xc'));_0x517b73(_0x3986e5[_0xc23f('0x13')][_0xc23f('0x12')]);}})[_0xc23f('0x14')](function(_0x1ca79d){logger[_0xc23f('0x10')](_0xc23f('0xb'),_0x578f0d,_0x1ca79d);_0x5ec239(_0x1ca79d);});});} \ No newline at end of file +var _0x8fcf=['lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','request','then','info','CmCustomField,\x20%s,\x20%s','debug','CmCustomField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x1a7f88,_0x286a16){var _0x4b91ac=function(_0x1e57d6){while(--_0x1e57d6){_0x1a7f88['push'](_0x1a7f88['shift']());}};_0x4b91ac(++_0x286a16);}(_0x8fcf,0xe7));var _0xf8fc=function(_0x3fd93e,_0x5b1d47){_0x3fd93e=_0x3fd93e-0x0;var _0x2e42eb=_0x8fcf[_0x3fd93e];return _0x2e42eb;};'use strict';var _=require(_0xf8fc('0x0'));var util=require(_0xf8fc('0x1'));var moment=require(_0xf8fc('0x2'));var BPromise=require(_0xf8fc('0x3'));var rs=require(_0xf8fc('0x4'));var fs=require('fs');var Redis=require(_0xf8fc('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf8fc('0x6'));var config=require(_0xf8fc('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x388961,_0x1de2f4,_0x37e5bd){return new BPromise(function(_0xcf3396,_0x45183f){return client[_0xf8fc('0x8')](_0x388961,_0x37e5bd)[_0xf8fc('0x9')](function(_0x760ae){logger[_0xf8fc('0xa')](_0xf8fc('0xb'),_0x1de2f4,'request\x20sent');logger[_0xf8fc('0xc')](_0xf8fc('0xd'),_0x1de2f4,_0xf8fc('0xe'),JSON[_0xf8fc('0xf')](_0x760ae));if(_0x760ae['error']){if(_0x760ae[_0xf8fc('0x10')][_0xf8fc('0x11')]===0x1f4){logger['error'](_0xf8fc('0xb'),_0x1de2f4,_0x760ae[_0xf8fc('0x10')]['message']);return _0x45183f(_0x760ae[_0xf8fc('0x10')][_0xf8fc('0x12')]);}logger['error'](_0xf8fc('0xb'),_0x1de2f4,_0x760ae[_0xf8fc('0x10')][_0xf8fc('0x12')]);return _0xcf3396(_0x760ae['error'][_0xf8fc('0x12')]);}else{logger[_0xf8fc('0xa')]('CmCustomField,\x20%s,\x20%s',_0x1de2f4,_0xf8fc('0xe'));_0xcf3396(_0x760ae[_0xf8fc('0x13')][_0xf8fc('0x12')]);}})[_0xf8fc('0x14')](function(_0x4a1b5c){logger['error'](_0xf8fc('0xb'),_0x1de2f4,_0x4a1b5c);_0x45183f(_0x4a1b5c);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 6eab36b..f4e8289 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 _0x2353=['create','update','destroy','multer','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','/:id','show','post'];(function(_0x28fb87,_0x5494dd){var _0x59ffd0=function(_0x1b818d){while(--_0x1b818d){_0x28fb87['push'](_0x28fb87['shift']());}};_0x59ffd0(++_0x5494dd);}(_0x2353,0xe3));var _0x3235=function(_0x430e0f,_0x329590){_0x430e0f=_0x430e0f-0x0;var _0x3a5954=_0x2353[_0x430e0f];return _0x3a5954;};'use strict';var multer=require(_0x3235('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3235('0x1'));var express=require(_0x3235('0x2'));var router=express[_0x3235('0x3')]();var fs_extra=require(_0x3235('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3235('0x5'));var config=require(_0x3235('0x6'));var controller=require(_0x3235('0x7'));router[_0x3235('0x8')]('/',auth[_0x3235('0x9')](),controller['index']);router[_0x3235('0x8')](_0x3235('0xa'),auth[_0x3235('0x9')](),controller[_0x3235('0xb')]);router[_0x3235('0xc')]('/',auth[_0x3235('0x9')](),controller[_0x3235('0xd')]);router['put'](_0x3235('0xa'),auth[_0x3235('0x9')](),controller[_0x3235('0xe')]);router['delete'](_0x3235('0xa'),auth['isAuthenticated'](),controller[_0x3235('0xf')]);module['exports']=router; \ No newline at end of file +var _0x9c50=['delete','destroy','connect-timeout','Router','../../components/interaction/service','../../config/environment','get','index','/:id','show','post','isAuthenticated','create'];(function(_0x3a20d7,_0x412b18){var _0x19e781=function(_0x466382){while(--_0x466382){_0x3a20d7['push'](_0x3a20d7['shift']());}};_0x19e781(++_0x412b18);}(_0x9c50,0xec));var _0x09c5=function(_0x215206,_0xa91400){_0x215206=_0x215206-0x0;var _0x2f906b=_0x9c50[_0x215206];return _0x2f906b;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x09c5('0x0'));var express=require('express');var router=express[_0x09c5('0x1')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x09c5('0x2'));var config=require(_0x09c5('0x3'));var controller=require('./cmCustomField.controller');router[_0x09c5('0x4')]('/',auth['isAuthenticated'](),controller[_0x09c5('0x5')]);router[_0x09c5('0x4')](_0x09c5('0x6'),auth['isAuthenticated'](),controller[_0x09c5('0x7')]);router[_0x09c5('0x8')]('/',auth[_0x09c5('0x9')](),controller[_0x09c5('0xa')]);router['put'](_0x09c5('0x6'),auth['isAuthenticated'](),controller['update']);router[_0x09c5('0xb')](_0x09c5('0x6'),auth[_0x09c5('0x9')](),controller[_0x09c5('0xc')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 3f9466c..b6f1b03 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 _0xc02b=['DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue','moment','exports','STRING','BOOLEAN'];(function(_0x5a2e5d,_0x255e5e){var _0x1e4d51=function(_0x5b245b){while(--_0x5b245b){_0x5a2e5d['push'](_0x5a2e5d['shift']());}};_0x1e4d51(++_0x255e5e);}(_0xc02b,0x92));var _0xbc02=function(_0x837dad,_0x1d9098){_0x837dad=_0x837dad-0x0;var _0x1d62d3=_0xc02b[_0x837dad];return _0x1d62d3;};'use strict';var moment=require(_0xbc02('0x0'));var Sequelize=require('sequelize');module[_0xbc02('0x1')]={'phone':{'type':Sequelize[_0xbc02('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0xbc02('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xbc02('0x4')],'defaultValue':moment()[_0xbc02('0x5')](_0xbc02('0x6'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xbc02('0x7')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xbc02('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xbc02('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xbc02('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xbc02('0x4')]},'priority':{'type':Sequelize[_0xbc02('0x7')](0x2)[_0xbc02('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xbc02('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xbc02('0x7')],'unique':_0xbc02('0x9')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0xbc02('0x9')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize[_0xbc02('0x7')],'unique':_0xbc02('0x9')},'CampaignId':{'type':Sequelize[_0xbc02('0x7')]},'countnosuchnumberretry':{'type':Sequelize[_0xbc02('0x7')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xbc02('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xbc02('0x7')],'defaultValue':0x0},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xbc02('0x2')]},'recallmeNotifiedDate':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0x1aa1=['moment','sequelize','exports','BOOLEAN','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','STRING','DATE','contactListQueue'];(function(_0x52f1e6,_0xf70489){var _0x21f104=function(_0xb89f9e){while(--_0xb89f9e){_0x52f1e6['push'](_0x52f1e6['shift']());}};_0x21f104(++_0xf70489);}(_0x1aa1,0x172));var _0x11aa=function(_0xd4b6a4,_0x35ceb3){_0xd4b6a4=_0xd4b6a4-0x0;var _0x399f2c=_0x1aa1[_0xd4b6a4];return _0x399f2c;};'use strict';var moment=require(_0x11aa('0x0'));var Sequelize=require(_0x11aa('0x1'));module[_0x11aa('0x2')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize[_0x11aa('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0x11aa('0x4')](_0x11aa('0x5'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x11aa('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x11aa('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x11aa('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x11aa('0x7')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x11aa('0x8')]},'priority':{'type':Sequelize[_0x11aa('0x6')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x11aa('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x11aa('0x9')},'ListId':{'type':Sequelize[_0x11aa('0x6')],'unique':'contactListQueue'},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x11aa('0x9')},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize[_0x11aa('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x11aa('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x11aa('0x6')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x11aa('0x7')]},'recallmeNotifiedDate':{'type':Sequelize[_0x11aa('0x8')],'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 bfa4b50..f36e297 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 _0xfa2b=['COALESCE(CmHopper.UserId,\x200)\x20DESC','CmCompany','Company','CmList','List','Queue','dialActive','getPreviewRecall','findOne','scheduledat','recallme','LOCK','UPDATE','Contact','getOpenContacts','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','getTimezones','utcOffset','getTimezone','timezones','moment','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','status','json','undefined','count','offset','limit','Content-Range','update','sendStatus','stack','send','map','rawAttributes','fieldName','key','model','name','query','filters','intersection','concat','$or','$gte','$lte','$ne','$eq','$not','$between','$in','$notIn','$notLike','$iLike','$like','$contains','$any','attributes','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','CmHopper','then','includeAll','include','rows','show','params','keys','fields','find','catch','create','body','describe','destroy','CampaignId','VoiceQueueId','VoiceQueue','Campaign','omit','createdAt','updatedAt','statedesc','deleted','membername','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','ivr','CmContact','ContactId','firstName','isNil','calleridname','lastName','finally','CmHopperFinal','CmHopperAdditionalPhone','end','getPreview','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','transaction','user','value','direction','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC'];(function(_0x27f2c8,_0x35cd7f){var _0x4f79ec=function(_0x45a435){while(--_0x45a435){_0x27f2c8['push'](_0x27f2c8['shift']());}};_0x4f79ec(++_0x35cd7f);}(_0xfa2b,0x1b7));var _0xbfa2=function(_0xe56fe,_0x24697b){_0xe56fe=_0xe56fe-0x0;var _0x3dc5a9=_0xfa2b[_0xe56fe];return _0x3dc5a9;};'use strict';var moment=require(_0xbfa2('0x0'));var _=require(_0xbfa2('0x1'));var qs=require(_0xbfa2('0x2'));var logger=require(_0xbfa2('0x3'))(_0xbfa2('0x4'));var shared=require(_0xbfa2('0x5'));var db=require(_0xbfa2('0x6'))['db'];function respondWithResult(_0x1103cf,_0x116ab4){_0x116ab4=_0x116ab4||0xc8;return function(_0x43f8d9){if(_0x43f8d9){return _0x1103cf[_0xbfa2('0x7')](_0x116ab4)[_0xbfa2('0x8')](_0x43f8d9);}};}function respondWithFilteredResult(_0x12d71e,_0x237a99){return function(_0x26ed93){if(_0x26ed93){var _0x26e9bf=typeof _0x237a99['offset']===_0xbfa2('0x9')&&typeof _0x237a99['limit']===_0xbfa2('0x9');var _0x22e6fe=_0x26ed93[_0xbfa2('0xa')];var _0x1b990a=_0x26e9bf?0x0:_0x237a99[_0xbfa2('0xb')];var _0xbea357=_0x26e9bf?_0x26ed93[_0xbfa2('0xa')]:_0x237a99[_0xbfa2('0xb')]+_0x237a99[_0xbfa2('0xc')];var _0x4e0f1e;if(_0xbea357>=_0x22e6fe){_0xbea357=_0x22e6fe;_0x4e0f1e=0xc8;}else{_0x4e0f1e=0xce;}_0x12d71e['status'](_0x4e0f1e);return _0x12d71e['set'](_0xbfa2('0xd'),_0x1b990a+'-'+_0xbea357+'/'+_0x22e6fe)[_0xbfa2('0x8')](_0x26ed93);}return null;};}function saveUpdates(_0x62b1e9,_0x829a72){return function(_0x137e0d){if(_0x137e0d){return _0x137e0d[_0xbfa2('0xe')](_0x62b1e9)['then'](function(_0x324930){return _0x324930;});}return null;};}function handleEntityNotFound(_0xaf815f,_0x458653){return function(_0x445598){if(!_0x445598){_0xaf815f[_0xbfa2('0xf')](0x194);}return _0x445598;};}function handleError(_0x4e799a,_0xa988cc){_0xa988cc=_0xa988cc||0x1f4;return function(_0x47db68){logger['error'](_0x47db68[_0xbfa2('0x10')]);if(_0x47db68['name']){delete _0x47db68['name'];}_0x4e799a[_0xbfa2('0x7')](_0xa988cc)[_0xbfa2('0x11')](_0x47db68);};}exports['index']=function(_0xb9b6a3,_0x12627a){var _0x28fe6f={},_0x4088c5={},_0x37aed6={'count':0x0,'rows':[]};var _0xea9286=_[_0xbfa2('0x12')](db['CmHopper'][_0xbfa2('0x13')],function(_0x100bfa){return{'name':_0x100bfa[_0xbfa2('0x14')],'type':_0x100bfa['type'][_0xbfa2('0x15')]};});_0x4088c5[_0xbfa2('0x16')]=_['map'](_0xea9286,_0xbfa2('0x17'));_0x4088c5['query']=_['keys'](_0xb9b6a3[_0xbfa2('0x18')]);_0x4088c5[_0xbfa2('0x19')]=_[_0xbfa2('0x1a')](_0x4088c5[_0xbfa2('0x16')],_0x4088c5['query']);_0x4088c5['filters']=_[_0xbfa2('0x1b')](_0x4088c5[_0xbfa2('0x19')],['$and',_0xbfa2('0x1c'),'$gt',_0xbfa2('0x1d'),'$lt',_0xbfa2('0x1e'),_0xbfa2('0x1f'),_0xbfa2('0x20'),_0xbfa2('0x21'),_0xbfa2('0x22'),'$notBetween',_0xbfa2('0x23'),_0xbfa2('0x24'),'$like',_0xbfa2('0x25'),_0xbfa2('0x26'),'$notILike',_0xbfa2('0x27'),'$overlap',_0xbfa2('0x28'),'$contained',_0xbfa2('0x29')]);_0x28fe6f[_0xbfa2('0x2a')]=_[_0xbfa2('0x1a')](_0x4088c5[_0xbfa2('0x16')],qs['fields'](_0xb9b6a3[_0xbfa2('0x18')]['fields']));_0x28fe6f[_0xbfa2('0x2a')]=_0x28fe6f[_0xbfa2('0x2a')][_0xbfa2('0x2b')]?_0x28fe6f['attributes']:_0x4088c5[_0xbfa2('0x16')];if(!_0xb9b6a3[_0xbfa2('0x18')][_0xbfa2('0x2c')]('nolimit')){_0x28fe6f['limit']=qs['limit'](_0xb9b6a3[_0xbfa2('0x18')][_0xbfa2('0xc')]);_0x28fe6f['offset']=qs[_0xbfa2('0xb')](_0xb9b6a3[_0xbfa2('0x18')][_0xbfa2('0xb')]);}_0x28fe6f[_0xbfa2('0x2d')]=qs['sort'](_0xb9b6a3[_0xbfa2('0x18')][_0xbfa2('0x2e')]);_0x28fe6f['where']=qs[_0xbfa2('0x19')](_[_0xbfa2('0x2f')](_0xb9b6a3[_0xbfa2('0x18')],_0x4088c5[_0xbfa2('0x19')]),_0xea9286);if(_0xb9b6a3[_0xbfa2('0x18')][_0xbfa2('0x30')]){_0x28fe6f[_0xbfa2('0x31')]=_[_0xbfa2('0x32')](_0x28fe6f[_0xbfa2('0x31')],{'$or':_['map'](_0xea9286,function(_0x79c2bd){if(_0x79c2bd['type']!==_0xbfa2('0x33')){var _0x57c93c={};_0x57c93c[_0x79c2bd[_0xbfa2('0x17')]]={'$like':'%'+_0xb9b6a3[_0xbfa2('0x18')][_0xbfa2('0x30')]+'%'};return _0x57c93c;}})});}_0x28fe6f=_[_0xbfa2('0x32')]({},_0x28fe6f,_0xb9b6a3[_0xbfa2('0x34')]);var _0x4fa12c={'where':_0x28fe6f[_0xbfa2('0x31')]};return db[_0xbfa2('0x35')][_0xbfa2('0xa')](_0x4fa12c)[_0xbfa2('0x36')](function(_0xa6f846){_0x37aed6['count']=_0xa6f846;if(_0xb9b6a3['query'][_0xbfa2('0x37')]){_0x28fe6f[_0xbfa2('0x38')]=[{'all':!![]}];}return db[_0xbfa2('0x35')]['findAll'](_0x28fe6f);})['then'](function(_0x44da05){_0x37aed6[_0xbfa2('0x39')]=_0x44da05;return _0x37aed6;})['then'](respondWithFilteredResult(_0x12627a,_0x28fe6f))['catch'](handleError(_0x12627a,null));};exports[_0xbfa2('0x3a')]=function(_0x1fd877,_0x5af87e){var _0x3708ea={'raw':!![],'where':{'id':_0x1fd877[_0xbfa2('0x3b')]['id']}},_0x2803b6={};_0x2803b6[_0xbfa2('0x16')]=_[_0xbfa2('0x3c')](db[_0xbfa2('0x35')][_0xbfa2('0x13')]);_0x2803b6[_0xbfa2('0x18')]=_[_0xbfa2('0x3c')](_0x1fd877[_0xbfa2('0x18')]);_0x2803b6[_0xbfa2('0x19')]=_[_0xbfa2('0x1a')](_0x2803b6[_0xbfa2('0x16')],_0x2803b6[_0xbfa2('0x18')]);_0x3708ea[_0xbfa2('0x2a')]=_[_0xbfa2('0x1a')](_0x2803b6[_0xbfa2('0x16')],qs['fields'](_0x1fd877[_0xbfa2('0x18')][_0xbfa2('0x3d')]));_0x3708ea[_0xbfa2('0x2a')]=_0x3708ea[_0xbfa2('0x2a')][_0xbfa2('0x2b')]?_0x3708ea[_0xbfa2('0x2a')]:_0x2803b6['model'];if(_0x1fd877[_0xbfa2('0x18')]['includeAll']){_0x3708ea[_0xbfa2('0x38')]=[{'all':!![]}];}_0x3708ea=_[_0xbfa2('0x32')]({},_0x3708ea,_0x1fd877['options']);return db[_0xbfa2('0x35')][_0xbfa2('0x3e')](_0x3708ea)[_0xbfa2('0x36')](handleEntityNotFound(_0x5af87e,null))[_0xbfa2('0x36')](respondWithResult(_0x5af87e,null))[_0xbfa2('0x3f')](handleError(_0x5af87e,null));};exports['create']=function(_0x44d0a6,_0x76bc9f){return db[_0xbfa2('0x35')][_0xbfa2('0x40')](_0x44d0a6[_0xbfa2('0x41')],{})[_0xbfa2('0x36')](respondWithResult(_0x76bc9f,0xc9))[_0xbfa2('0x3f')](handleError(_0x76bc9f,null));};exports[_0xbfa2('0xe')]=function(_0x4a43f8,_0x20eb6e){if(_0x4a43f8[_0xbfa2('0x41')]['id']){delete _0x4a43f8['body']['id'];}return db[_0xbfa2('0x35')][_0xbfa2('0x3e')]({'where':{'id':_0x4a43f8[_0xbfa2('0x3b')]['id']}})[_0xbfa2('0x36')](handleEntityNotFound(_0x20eb6e,null))[_0xbfa2('0x36')](saveUpdates(_0x4a43f8[_0xbfa2('0x41')],null))[_0xbfa2('0x36')](respondWithResult(_0x20eb6e,null))[_0xbfa2('0x3f')](handleError(_0x20eb6e,null));};exports[_0xbfa2('0x42')]=function(_0x59d61b,_0x3d98d4){return db[_0xbfa2('0x35')][_0xbfa2('0x42')]()['then'](respondWithResult(_0x3d98d4,null))['catch'](handleError(_0x3d98d4,null));};exports[_0xbfa2('0x43')]=function(_0x51fd07,_0x457a15){var _0x29f0ef;var _0x4ef203=_0x51fd07[_0xbfa2('0x3b')]['id'];return db[_0xbfa2('0x35')][_0xbfa2('0x3e')]({'where':{'id':_0x51fd07['params']['id']}})[_0xbfa2('0x36')](handleEntityNotFound(_0x457a15,null))['then'](function(_0x378b18){if(_0x378b18){return _0x378b18[_0xbfa2('0x43')]()['then'](function(_0x3f8e7c){return _0x3f8e7c;});}})['then'](function(_0x40eba9){_0x29f0ef=_0x40eba9;if(_0x40eba9){if(_0x40eba9['VoiceQueueId']||_0x40eba9[_0xbfa2('0x44')]){return db[_0x40eba9[_0xbfa2('0x45')]?_0xbfa2('0x46'):_0xbfa2('0x47')][_0xbfa2('0x3e')]({'where':{'id':_0x40eba9['VoiceQueueId']?_0x40eba9['VoiceQueueId']:_0x40eba9['CampaignId']},'attributes':['id',_0xbfa2('0x17')],'raw':!![]});}}})[_0xbfa2('0x36')](function(_0x221f5a){var _0x4d5271={};if(_0x221f5a){_[_0xbfa2('0x32')](_0x4d5271,_[_0xbfa2('0x48')](_0x29f0ef['dataValues'],[_0xbfa2('0x49'),_0xbfa2('0x4a'),'id']));_0x4d5271['state']=0x15;_0x4d5271[_0xbfa2('0x4b')]=_0xbfa2('0x4c');_0x4d5271['campaign']=_0x221f5a['name'];_0x4d5271[_0xbfa2('0x4d')]=_0x51fd07['user'][_0xbfa2('0x17')];_0x4d5271[_0xbfa2('0x4e')]=_0x51fd07['user']['id'];_0x4d5271[_0xbfa2('0x4c')]=!![];_0x4d5271[_0xbfa2('0x4f')]=moment()[_0xbfa2('0x50')](_0xbfa2('0x51'));_0x4d5271[_0xbfa2('0x52')]=_0x29f0ef[_0xbfa2('0x53')];_0x4d5271[_0xbfa2('0x54')]=_0x29f0ef[_0xbfa2('0x45')]?_0xbfa2('0x55'):_0xbfa2('0x56');return db[_0xbfa2('0x57')][_0xbfa2('0x3e')]({'where':{'id':_0x4d5271[_0xbfa2('0x58')]},'attributes':[_0xbfa2('0x59'),'lastName']})[_0xbfa2('0x36')](function(_0x4e43c7){if(!_[_0xbfa2('0x5a')](_0x457a15)&&!_[_0xbfa2('0x5a')](_0x4e43c7[_0xbfa2('0x59')])){_0x4d5271[_0xbfa2('0x5b')]=_0x4e43c7[_0xbfa2('0x59')];if(!_[_0xbfa2('0x5a')](_0x4e43c7[_0xbfa2('0x5c')])){_0x4d5271[_0xbfa2('0x5b')]+='\x20'+_0x4e43c7[_0xbfa2('0x5c')];}}})[_0xbfa2('0x5d')](function(){return db[_0xbfa2('0x5e')]['create'](_0x4d5271);});}})[_0xbfa2('0x36')](function(_0x44e433){return db[_0xbfa2('0x5f')][_0xbfa2('0x43')]({'where':{'CmHopperId':_0x4ef203}});})['then'](function(){return _0x457a15[_0xbfa2('0x7')](0xcc)[_0xbfa2('0x60')]();})[_0xbfa2('0x3f')](handleError(_0x457a15,null));};exports[_0xbfa2('0x61')]=function(_0x2f7666,_0x49f224){var _0x3a7fc7=[];return db[_0xbfa2('0x57')][_0xbfa2('0x42')]()[_0xbfa2('0x36')](function(_0x3b8c77){_0x3a7fc7=_[_0xbfa2('0x3c')](_0x3b8c77);return _0x2f7666['user'][_0xbfa2('0x62')]({'where':{'type':_0xbfa2('0x63'),'dialActive':!![],'dialMethod':_0xbfa2('0x64')},'attributes':['id',_0xbfa2('0x65'),_0xbfa2('0x66')],'raw':!![]});})['then'](function(_0x5d0b6e){if(_0x5d0b6e&&_0x5d0b6e['length']){return db[_0xbfa2('0x67')][_0xbfa2('0x68')](function(_0x3c337d){var _0x12e182={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0xbfa2('0x12')](_0x5d0b6e,'id')},'$or':[{'UserId':null},{'UserId':_0x2f7666[_0xbfa2('0x69')]['id']}]};var _0x15c172={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x5d0b6e)['filter']([_0xbfa2('0x66'),0x0])[_0xbfa2('0x12')]('id')[_0xbfa2('0x6a')]()},'$or':[{'UserId':null},{'UserId':_0x2f7666[_0xbfa2('0x69')]['id']}]};var _0x5019c7={'$or':[_0x12e182,_0x15c172]};var _0x433448=[];if(_0x2f7666[_0xbfa2('0x41')]['direction']&&_0x2f7666[_0xbfa2('0x41')][_0xbfa2('0x6b')]===_0xbfa2('0x6c')){if(!_[_0xbfa2('0x6d')](_0x2f7666['body']['hopperIds'])){_0x5019c7['id']={'$in':_0x2f7666[_0xbfa2('0x41')][_0xbfa2('0x6e')]};}_0x433448=[[_0xbfa2('0x6f'),_0xbfa2('0x70')],[_0xbfa2('0x71'),_0x5d0b6e[0x0]['dialOrderByScheduledAt']===_0xbfa2('0x70')?_0xbfa2('0x72'):_0xbfa2('0x70')],db['sequelize'][_0xbfa2('0x73')](_0xbfa2('0x74')),['id',_0xbfa2('0x72')]];}else{if(!_[_0xbfa2('0x6d')](_0x2f7666['body']['hopperIds'])){_0x5019c7['id']={'$notIn':_0x2f7666[_0xbfa2('0x41')]['hopperIds']};}_0x433448=[[_0xbfa2('0x6f'),_0xbfa2('0x72')],[_0xbfa2('0x71'),_0x5d0b6e[0x0][_0xbfa2('0x65')]],db[_0xbfa2('0x67')]['literal'](_0xbfa2('0x75')),['id',_0xbfa2('0x70')]];}return db[_0xbfa2('0x35')]['findOne']({'attributes':['id','scheduledat',_0xbfa2('0x53'),'recallme'],'where':_0x5019c7,'order':_0x433448,'transaction':_0x3c337d,'lock':_0x3c337d['LOCK']['UPDATE'],'include':[{'model':db[_0xbfa2('0x57')],'as':'Contact','attributes':_0x3a7fc7,'include':[{'model':db[_0xbfa2('0x76')],'as':_0xbfa2('0x77'),'attributes':['id',_0xbfa2('0x17')]}]},{'model':db[_0xbfa2('0x78')],'as':_0xbfa2('0x79'),'attributes':['id',_0xbfa2('0x17')]},{'model':db[_0xbfa2('0x46')],'as':_0xbfa2('0x7a'),'attributes':['id',_0xbfa2('0x17'),_0xbfa2('0x7b')]}]})[_0xbfa2('0x36')](function(_0x46636f){if(_0x46636f){return _0x46636f[_0xbfa2('0xe')]({'UserId':_0x2f7666[_0xbfa2('0x69')]['id']},{'transaction':_0x3c337d});}});});}})[_0xbfa2('0x36')](handleEntityNotFound(_0x49f224,null))[_0xbfa2('0x36')](respondWithResult(_0x49f224,null))[_0xbfa2('0x3f')](handleError(_0x49f224,null));};exports[_0xbfa2('0x7c')]=function(_0x3ddd98,_0x2279c9,_0x40a162){var _0x31bab8=[];var _0x4d94a4=_0x3ddd98['params']['id'];var _0x3f2bd3=_0x3ddd98[_0xbfa2('0x69')]['id'];return db[_0xbfa2('0x57')][_0xbfa2('0x42')]()[_0xbfa2('0x36')](function(_0x5d384c){_0x31bab8=_[_0xbfa2('0x3c')](_0x5d384c);return db[_0xbfa2('0x67')]['transaction'](function(_0x320fbc){const _0x52a7f0={'id':_0x4d94a4};return db[_0xbfa2('0x35')][_0xbfa2('0x7d')]({'attributes':['id',_0xbfa2('0x7e'),_0xbfa2('0x7f')],'where':_0x52a7f0,'transaction':_0x320fbc,'lock':_0x320fbc[_0xbfa2('0x80')][_0xbfa2('0x81')],'include':[{'model':db[_0xbfa2('0x57')],'as':_0xbfa2('0x82'),'attributes':_0x31bab8,'include':[{'model':db[_0xbfa2('0x76')],'as':'Company','attributes':['id',_0xbfa2('0x17')]}]},{'model':db[_0xbfa2('0x78')],'as':'List','attributes':['id',_0xbfa2('0x17')]},{'model':db['VoiceQueue'],'as':'Queue','attributes':['id',_0xbfa2('0x17'),_0xbfa2('0x7b')]}]})[_0xbfa2('0x36')](function(_0x44e251){if(_0x44e251){return _0x44e251['update']({'UserId':_0x3f2bd3},{'transaction':_0x320fbc});}});});})[_0xbfa2('0x36')](handleEntityNotFound(_0x2279c9,null))['then'](respondWithResult(_0x2279c9,null))[_0xbfa2('0x3f')](handleError(_0x2279c9,null));};exports[_0xbfa2('0x83')]=function(_0x205243,_0x269cf4){return _0x205243[_0xbfa2('0x69')][_0xbfa2('0x62')]({'where':{'type':_0xbfa2('0x63'),'dialActive':!![],'dialMethod':_0xbfa2('0x64')},'attributes':['id'],'raw':!![]})[_0xbfa2('0x36')](function(_0xa4df7f){if(_0xa4df7f&&_0xa4df7f['length']){return db[_0xbfa2('0x35')][_0xbfa2('0xa')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xbfa2('0x50')](_0xbfa2('0x51'))},'VoiceQueueId':{'$in':_[_0xbfa2('0x12')](_0xa4df7f,'id')},'$or':[{'UserId':null},{'UserId':_0x205243[_0xbfa2('0x69')]['id']}]}});}return 0x0;})['then'](function(_0xa4feb9){if(!_[_0xbfa2('0x5a')](_0xa4feb9)&&_[_0xbfa2('0x84')](_0xa4feb9)){return _0x269cf4[_0xbfa2('0x7')](0xc8)['json']({'contacts':_0xa4feb9});}else{logger['error'](_0xbfa2('0x85'),_0xbfa2('0x83'),0x194,_0xbfa2('0x86'));_0x269cf4[_0xbfa2('0xf')](0x194);}})[_0xbfa2('0x3f')](handleError(_0x269cf4,null));};exports[_0xbfa2('0x87')]=function(_0x138df1,_0x27d898){var _0x1743fc=shared['timezones'];var _0x5a6d77=[];_[_0xbfa2('0x12')](_0x1743fc,function(_0x391002){_0x5a6d77['push']({'id':_0x391002[_0xbfa2('0x17')],'name':_0x391002['name'],'utcOffset':_0x391002[_0xbfa2('0x88')]});});return _0x27d898[_0xbfa2('0x7')](0xc8)[_0xbfa2('0x8')]({'tz':_0x5a6d77});};exports[_0xbfa2('0x89')]=function(_0x3a4a44,_0x4b1422){var _0x509677=shared[_0xbfa2('0x8a')];var _0x51c5b2={};if(!_[_0xbfa2('0x5a')](_0x509677[_0x3a4a44[_0xbfa2('0x41')]['id']]))_0x51c5b2=_0x509677[_0x3a4a44['body']['id']];return _0x4b1422[_0xbfa2('0x7')](0xc8)['json'](_0x51c5b2);}; \ No newline at end of file +var _0xf873=['campaigntype','ContactId','lastName','isNil','firstName','calleridname','CmHopperFinal','CmHopperAdditionalPhone','end','CmContact','user','getVoiceQueues','outbound','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','transaction','direction','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','DESC','COALESCE(CmHopper.UserId,\x200)\x20ASC','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','LOCK','UPDATE','CmCompany','CmList','List','Queue','dialActive','getPreviewRecall','recallme','Contact','Company','getOpenContacts','CmHopper,\x20%s,\x20%s,\x20%s','timezones','utcOffset','getTimezone','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','json','offset','undefined','limit','count','status','set','Content-Range','then','sendStatus','error','stack','name','send','map','rawAttributes','fieldName','type','query','keys','filters','intersection','model','concat','$and','$or','$gt','$gte','$lt','$ne','$eq','$not','$in','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contains','$contained','$any','attributes','fields','length','nolimit','order','sort','where','filter','merge','options','CmHopper','include','findAll','rows','catch','params','includeAll','find','create','update','body','describe','destroy','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','dataValues','createdAt','updatedAt','state','statedesc','deleted','campaign','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','phone'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xf873,0xb2));var _0x3f87=function(_0x5140a0,_0x32bd6e){_0x5140a0=_0x5140a0-0x0;var _0x1b573e=_0xf873[_0x5140a0];return _0x1b573e;};'use strict';var moment=require('moment');var _=require(_0x3f87('0x0'));var qs=require(_0x3f87('0x1'));var logger=require(_0x3f87('0x2'))(_0x3f87('0x3'));var shared=require(_0x3f87('0x4'));var db=require(_0x3f87('0x5'))['db'];function respondWithResult(_0x2fbb4f,_0x1d68dd){_0x1d68dd=_0x1d68dd||0xc8;return function(_0x3c80d6){if(_0x3c80d6){return _0x2fbb4f['status'](_0x1d68dd)[_0x3f87('0x6')](_0x3c80d6);}};}function respondWithFilteredResult(_0x43c8e4,_0x27c03e){return function(_0x5a5e37){if(_0x5a5e37){var _0x8bf89b=typeof _0x27c03e[_0x3f87('0x7')]===_0x3f87('0x8')&&typeof _0x27c03e[_0x3f87('0x9')]===_0x3f87('0x8');var _0xf9513e=_0x5a5e37['count'];var _0x1405ca=_0x8bf89b?0x0:_0x27c03e[_0x3f87('0x7')];var _0x32e236=_0x8bf89b?_0x5a5e37[_0x3f87('0xa')]:_0x27c03e[_0x3f87('0x7')]+_0x27c03e[_0x3f87('0x9')];var _0x2aa592;if(_0x32e236>=_0xf9513e){_0x32e236=_0xf9513e;_0x2aa592=0xc8;}else{_0x2aa592=0xce;}_0x43c8e4[_0x3f87('0xb')](_0x2aa592);return _0x43c8e4[_0x3f87('0xc')](_0x3f87('0xd'),_0x1405ca+'-'+_0x32e236+'/'+_0xf9513e)[_0x3f87('0x6')](_0x5a5e37);}return null;};}function saveUpdates(_0x593e9,_0xfd5b65){return function(_0x160861){if(_0x160861){return _0x160861['update'](_0x593e9)[_0x3f87('0xe')](function(_0x1da47f){return _0x1da47f;});}return null;};}function handleEntityNotFound(_0x4ea5c1,_0x1cfba3){return function(_0x14324f){if(!_0x14324f){_0x4ea5c1[_0x3f87('0xf')](0x194);}return _0x14324f;};}function handleError(_0x28cb47,_0x3f192a){_0x3f192a=_0x3f192a||0x1f4;return function(_0x1c8fb0){logger[_0x3f87('0x10')](_0x1c8fb0[_0x3f87('0x11')]);if(_0x1c8fb0['name']){delete _0x1c8fb0[_0x3f87('0x12')];}_0x28cb47[_0x3f87('0xb')](_0x3f192a)[_0x3f87('0x13')](_0x1c8fb0);};}exports['index']=function(_0x3c6fbe,_0x56d79e){var _0x190d7d={},_0x13550c={},_0x285b2c={'count':0x0,'rows':[]};var _0x279eba=_[_0x3f87('0x14')](db['CmHopper'][_0x3f87('0x15')],function(_0x2372d3){return{'name':_0x2372d3[_0x3f87('0x16')],'type':_0x2372d3[_0x3f87('0x17')]['key']};});_0x13550c['model']=_['map'](_0x279eba,_0x3f87('0x12'));_0x13550c[_0x3f87('0x18')]=_[_0x3f87('0x19')](_0x3c6fbe['query']);_0x13550c[_0x3f87('0x1a')]=_[_0x3f87('0x1b')](_0x13550c[_0x3f87('0x1c')],_0x13550c[_0x3f87('0x18')]);_0x13550c[_0x3f87('0x1a')]=_[_0x3f87('0x1d')](_0x13550c[_0x3f87('0x1a')],[_0x3f87('0x1e'),_0x3f87('0x1f'),_0x3f87('0x20'),_0x3f87('0x21'),_0x3f87('0x22'),'$lte',_0x3f87('0x23'),_0x3f87('0x24'),_0x3f87('0x25'),'$between','$notBetween',_0x3f87('0x26'),_0x3f87('0x27'),_0x3f87('0x28'),_0x3f87('0x29'),_0x3f87('0x2a'),_0x3f87('0x2b'),_0x3f87('0x28'),_0x3f87('0x2c'),_0x3f87('0x2d'),_0x3f87('0x2e'),_0x3f87('0x2f')]);_0x190d7d[_0x3f87('0x30')]=_[_0x3f87('0x1b')](_0x13550c[_0x3f87('0x1c')],qs[_0x3f87('0x31')](_0x3c6fbe[_0x3f87('0x18')]['fields']));_0x190d7d[_0x3f87('0x30')]=_0x190d7d[_0x3f87('0x30')][_0x3f87('0x32')]?_0x190d7d[_0x3f87('0x30')]:_0x13550c['model'];if(!_0x3c6fbe['query']['hasOwnProperty'](_0x3f87('0x33'))){_0x190d7d[_0x3f87('0x9')]=qs[_0x3f87('0x9')](_0x3c6fbe[_0x3f87('0x18')][_0x3f87('0x9')]);_0x190d7d['offset']=qs[_0x3f87('0x7')](_0x3c6fbe['query'][_0x3f87('0x7')]);}_0x190d7d[_0x3f87('0x34')]=qs[_0x3f87('0x35')](_0x3c6fbe[_0x3f87('0x18')][_0x3f87('0x35')]);_0x190d7d[_0x3f87('0x36')]=qs[_0x3f87('0x1a')](_['pick'](_0x3c6fbe['query'],_0x13550c[_0x3f87('0x1a')]),_0x279eba);if(_0x3c6fbe[_0x3f87('0x18')][_0x3f87('0x37')]){_0x190d7d[_0x3f87('0x36')]=_[_0x3f87('0x38')](_0x190d7d[_0x3f87('0x36')],{'$or':_[_0x3f87('0x14')](_0x279eba,function(_0x4bc0bf){if(_0x4bc0bf[_0x3f87('0x17')]!=='VIRTUAL'){var _0x328946={};_0x328946[_0x4bc0bf[_0x3f87('0x12')]]={'$like':'%'+_0x3c6fbe[_0x3f87('0x18')][_0x3f87('0x37')]+'%'};return _0x328946;}})});}_0x190d7d=_['merge']({},_0x190d7d,_0x3c6fbe[_0x3f87('0x39')]);var _0x54fe61={'where':_0x190d7d[_0x3f87('0x36')]};return db[_0x3f87('0x3a')][_0x3f87('0xa')](_0x54fe61)[_0x3f87('0xe')](function(_0x116900){_0x285b2c['count']=_0x116900;if(_0x3c6fbe['query']['includeAll']){_0x190d7d[_0x3f87('0x3b')]=[{'all':!![]}];}return db[_0x3f87('0x3a')][_0x3f87('0x3c')](_0x190d7d);})[_0x3f87('0xe')](function(_0x11352f){_0x285b2c[_0x3f87('0x3d')]=_0x11352f;return _0x285b2c;})['then'](respondWithFilteredResult(_0x56d79e,_0x190d7d))[_0x3f87('0x3e')](handleError(_0x56d79e,null));};exports['show']=function(_0x46a806,_0xe66e09){var _0x4cd683={'raw':!![],'where':{'id':_0x46a806[_0x3f87('0x3f')]['id']}},_0x456b22={};_0x456b22[_0x3f87('0x1c')]=_['keys'](db[_0x3f87('0x3a')]['rawAttributes']);_0x456b22['query']=_[_0x3f87('0x19')](_0x46a806[_0x3f87('0x18')]);_0x456b22[_0x3f87('0x1a')]=_[_0x3f87('0x1b')](_0x456b22[_0x3f87('0x1c')],_0x456b22['query']);_0x4cd683[_0x3f87('0x30')]=_[_0x3f87('0x1b')](_0x456b22[_0x3f87('0x1c')],qs[_0x3f87('0x31')](_0x46a806['query'][_0x3f87('0x31')]));_0x4cd683[_0x3f87('0x30')]=_0x4cd683[_0x3f87('0x30')][_0x3f87('0x32')]?_0x4cd683[_0x3f87('0x30')]:_0x456b22[_0x3f87('0x1c')];if(_0x46a806[_0x3f87('0x18')][_0x3f87('0x40')]){_0x4cd683['include']=[{'all':!![]}];}_0x4cd683=_['merge']({},_0x4cd683,_0x46a806[_0x3f87('0x39')]);return db[_0x3f87('0x3a')][_0x3f87('0x41')](_0x4cd683)[_0x3f87('0xe')](handleEntityNotFound(_0xe66e09,null))[_0x3f87('0xe')](respondWithResult(_0xe66e09,null))[_0x3f87('0x3e')](handleError(_0xe66e09,null));};exports[_0x3f87('0x42')]=function(_0x4334fa,_0x3f3a0f){return db[_0x3f87('0x3a')][_0x3f87('0x42')](_0x4334fa['body'],{})[_0x3f87('0xe')](respondWithResult(_0x3f3a0f,0xc9))[_0x3f87('0x3e')](handleError(_0x3f3a0f,null));};exports[_0x3f87('0x43')]=function(_0x2fec6b,_0x2bec12){if(_0x2fec6b[_0x3f87('0x44')]['id']){delete _0x2fec6b[_0x3f87('0x44')]['id'];}return db[_0x3f87('0x3a')][_0x3f87('0x41')]({'where':{'id':_0x2fec6b[_0x3f87('0x3f')]['id']}})[_0x3f87('0xe')](handleEntityNotFound(_0x2bec12,null))['then'](saveUpdates(_0x2fec6b[_0x3f87('0x44')],null))[_0x3f87('0xe')](respondWithResult(_0x2bec12,null))[_0x3f87('0x3e')](handleError(_0x2bec12,null));};exports['describe']=function(_0x19d928,_0x3b55f4){return db[_0x3f87('0x3a')][_0x3f87('0x45')]()[_0x3f87('0xe')](respondWithResult(_0x3b55f4,null))[_0x3f87('0x3e')](handleError(_0x3b55f4,null));};exports[_0x3f87('0x46')]=function(_0x5799eb,_0x163ebf){var _0x5e1240;var _0x1b8ea3=_0x5799eb[_0x3f87('0x3f')]['id'];return db[_0x3f87('0x3a')][_0x3f87('0x41')]({'where':{'id':_0x5799eb[_0x3f87('0x3f')]['id']}})[_0x3f87('0xe')](handleEntityNotFound(_0x163ebf,null))[_0x3f87('0xe')](function(_0x2c9647){if(_0x2c9647){return _0x2c9647[_0x3f87('0x46')]()[_0x3f87('0xe')](function(_0x53783f){return _0x53783f;});}})[_0x3f87('0xe')](function(_0x5d3df0){_0x5e1240=_0x5d3df0;if(_0x5d3df0){if(_0x5d3df0[_0x3f87('0x47')]||_0x5d3df0[_0x3f87('0x48')]){return db[_0x5d3df0[_0x3f87('0x47')]?_0x3f87('0x49'):_0x3f87('0x4a')][_0x3f87('0x41')]({'where':{'id':_0x5d3df0['VoiceQueueId']?_0x5d3df0[_0x3f87('0x47')]:_0x5d3df0[_0x3f87('0x48')]},'attributes':['id',_0x3f87('0x12')],'raw':!![]});}}})[_0x3f87('0xe')](function(_0x331ce9){var _0x46377d={};if(_0x331ce9){_[_0x3f87('0x38')](_0x46377d,_[_0x3f87('0x4b')](_0x5e1240[_0x3f87('0x4c')],[_0x3f87('0x4d'),_0x3f87('0x4e'),'id']));_0x46377d[_0x3f87('0x4f')]=0x15;_0x46377d[_0x3f87('0x50')]=_0x3f87('0x51');_0x46377d[_0x3f87('0x52')]=_0x331ce9[_0x3f87('0x12')];_0x46377d['membername']=_0x5799eb['user']['name'];_0x46377d[_0x3f87('0x53')]=_0x5799eb['user']['id'];_0x46377d[_0x3f87('0x51')]=!![];_0x46377d[_0x3f87('0x54')]=moment()[_0x3f87('0x55')](_0x3f87('0x56'));_0x46377d['calleridnum']=_0x5e1240[_0x3f87('0x57')];_0x46377d[_0x3f87('0x58')]=_0x5e1240[_0x3f87('0x47')]?'queue':'ivr';return db['CmContact'][_0x3f87('0x41')]({'where':{'id':_0x46377d[_0x3f87('0x59')]},'attributes':['firstName',_0x3f87('0x5a')]})[_0x3f87('0xe')](function(_0x18e3bd){if(!_[_0x3f87('0x5b')](_0x163ebf)&&!_[_0x3f87('0x5b')](_0x18e3bd[_0x3f87('0x5c')])){_0x46377d[_0x3f87('0x5d')]=_0x18e3bd[_0x3f87('0x5c')];if(!_[_0x3f87('0x5b')](_0x18e3bd[_0x3f87('0x5a')])){_0x46377d[_0x3f87('0x5d')]+='\x20'+_0x18e3bd[_0x3f87('0x5a')];}}})['finally'](function(){return db[_0x3f87('0x5e')][_0x3f87('0x42')](_0x46377d);});}})[_0x3f87('0xe')](function(_0x1d1156){return db[_0x3f87('0x5f')][_0x3f87('0x46')]({'where':{'CmHopperId':_0x1b8ea3}});})[_0x3f87('0xe')](function(){return _0x163ebf[_0x3f87('0xb')](0xcc)[_0x3f87('0x60')]();})[_0x3f87('0x3e')](handleError(_0x163ebf,null));};exports['getPreview']=function(_0x415766,_0x55a797){var _0x32b0f5=[];return db[_0x3f87('0x61')][_0x3f87('0x45')]()[_0x3f87('0xe')](function(_0x4b2960){_0x32b0f5=_['keys'](_0x4b2960);return _0x415766[_0x3f87('0x62')][_0x3f87('0x63')]({'where':{'type':_0x3f87('0x64'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0x3f87('0x65'),_0x3f87('0x66')],'raw':!![]});})[_0x3f87('0xe')](function(_0x4b3573){if(_0x4b3573&&_0x4b3573[_0x3f87('0x32')]){return db[_0x3f87('0x67')][_0x3f87('0x68')](function(_0x4bd24a){var _0x54241d={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x3f87('0x55')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x3f87('0x14')](_0x4b3573,'id')},'$or':[{'UserId':null},{'UserId':_0x415766[_0x3f87('0x62')]['id']}]};var _0x5a48b9={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x4b3573)[_0x3f87('0x37')]([_0x3f87('0x66'),0x0])['map']('id')['value']()},'$or':[{'UserId':null},{'UserId':_0x415766[_0x3f87('0x62')]['id']}]};var _0x4631e7={'$or':[_0x54241d,_0x5a48b9]};var _0x1415a9=[];if(_0x415766[_0x3f87('0x44')][_0x3f87('0x69')]&&_0x415766[_0x3f87('0x44')][_0x3f87('0x69')]===_0x3f87('0x6a')){if(!_[_0x3f87('0x6b')](_0x415766[_0x3f87('0x44')][_0x3f87('0x6c')])){_0x4631e7['id']={'$in':_0x415766[_0x3f87('0x44')][_0x3f87('0x6c')]};}_0x1415a9=[[_0x3f87('0x6d'),_0x3f87('0x6e')],[_0x3f87('0x6f'),_0x4b3573[0x0]['dialOrderByScheduledAt']===_0x3f87('0x6e')?_0x3f87('0x70'):_0x3f87('0x6e')],db[_0x3f87('0x67')]['literal'](_0x3f87('0x71')),['id',_0x3f87('0x70')]];}else{if(!_[_0x3f87('0x6b')](_0x415766[_0x3f87('0x44')][_0x3f87('0x6c')])){_0x4631e7['id']={'$notIn':_0x415766[_0x3f87('0x44')][_0x3f87('0x6c')]};}_0x1415a9=[['priority','DESC'],[_0x3f87('0x6f'),_0x4b3573[0x0][_0x3f87('0x65')]],db['sequelize']['literal'](_0x3f87('0x72')),['id',_0x3f87('0x6e')]];}return db['CmHopper'][_0x3f87('0x73')]({'attributes':['id',_0x3f87('0x74'),'phone','recallme'],'where':_0x4631e7,'order':_0x1415a9,'transaction':_0x4bd24a,'lock':_0x4bd24a[_0x3f87('0x75')][_0x3f87('0x76')],'include':[{'model':db[_0x3f87('0x61')],'as':'Contact','attributes':_0x32b0f5,'include':[{'model':db[_0x3f87('0x77')],'as':'Company','attributes':['id',_0x3f87('0x12')]}]},{'model':db[_0x3f87('0x78')],'as':_0x3f87('0x79'),'attributes':['id',_0x3f87('0x12')]},{'model':db[_0x3f87('0x49')],'as':_0x3f87('0x7a'),'attributes':['id','name',_0x3f87('0x7b')]}]})[_0x3f87('0xe')](function(_0x374007){if(_0x374007){return _0x374007[_0x3f87('0x43')]({'UserId':_0x415766[_0x3f87('0x62')]['id']},{'transaction':_0x4bd24a});}});});}})[_0x3f87('0xe')](handleEntityNotFound(_0x55a797,null))[_0x3f87('0xe')](respondWithResult(_0x55a797,null))['catch'](handleError(_0x55a797,null));};exports[_0x3f87('0x7c')]=function(_0x23569b,_0x35faf7,_0x14392d){var _0x5e23d8=[];var _0x3e8390=_0x23569b[_0x3f87('0x3f')]['id'];var _0x19158e=_0x23569b[_0x3f87('0x62')]['id'];return db[_0x3f87('0x61')]['describe']()['then'](function(_0x32ea0c){_0x5e23d8=_['keys'](_0x32ea0c);return db[_0x3f87('0x67')][_0x3f87('0x68')](function(_0x475a4d){const _0xd38b40={'id':_0x3e8390};return db[_0x3f87('0x3a')][_0x3f87('0x73')]({'attributes':['id',_0x3f87('0x74'),_0x3f87('0x7d')],'where':_0xd38b40,'transaction':_0x475a4d,'lock':_0x475a4d[_0x3f87('0x75')]['UPDATE'],'include':[{'model':db[_0x3f87('0x61')],'as':_0x3f87('0x7e'),'attributes':_0x5e23d8,'include':[{'model':db['CmCompany'],'as':_0x3f87('0x7f'),'attributes':['id',_0x3f87('0x12')]}]},{'model':db['CmList'],'as':'List','attributes':['id',_0x3f87('0x12')]},{'model':db[_0x3f87('0x49')],'as':_0x3f87('0x7a'),'attributes':['id',_0x3f87('0x12'),_0x3f87('0x7b')]}]})[_0x3f87('0xe')](function(_0x112634){if(_0x112634){return _0x112634[_0x3f87('0x43')]({'UserId':_0x19158e},{'transaction':_0x475a4d});}});});})[_0x3f87('0xe')](handleEntityNotFound(_0x35faf7,null))[_0x3f87('0xe')](respondWithResult(_0x35faf7,null))[_0x3f87('0x3e')](handleError(_0x35faf7,null));};exports[_0x3f87('0x80')]=function(_0x175e8c,_0x580919){return _0x175e8c[_0x3f87('0x62')][_0x3f87('0x63')]({'where':{'type':_0x3f87('0x64'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})[_0x3f87('0xe')](function(_0x41b5d0){if(_0x41b5d0&&_0x41b5d0['length']){return db[_0x3f87('0x3a')][_0x3f87('0xa')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x3f87('0x55')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x3f87('0x14')](_0x41b5d0,'id')},'$or':[{'UserId':null},{'UserId':_0x175e8c[_0x3f87('0x62')]['id']}]}});}return 0x0;})['then'](function(_0x182484){if(!_[_0x3f87('0x5b')](_0x182484)&&_['isNumber'](_0x182484)){return _0x580919[_0x3f87('0xb')](0xc8)[_0x3f87('0x6')]({'contacts':_0x182484});}else{logger[_0x3f87('0x10')](_0x3f87('0x81'),_0x3f87('0x80'),0x194,'entity\x20not\x20found');_0x580919['sendStatus'](0x194);}})[_0x3f87('0x3e')](handleError(_0x580919,null));};exports['getTimezones']=function(_0x4dae45,_0x46dd17){var _0x49c4c1=shared[_0x3f87('0x82')];var _0x3d037c=[];_['map'](_0x49c4c1,function(_0x39c7f2){_0x3d037c['push']({'id':_0x39c7f2[_0x3f87('0x12')],'name':_0x39c7f2['name'],'utcOffset':_0x39c7f2[_0x3f87('0x83')]});});return _0x46dd17[_0x3f87('0xb')](0xc8)[_0x3f87('0x6')]({'tz':_0x3d037c});};exports[_0x3f87('0x84')]=function(_0x3e6185,_0x1d217b){var _0x2b5d8a=shared[_0x3f87('0x82')];var _0x3d8846={};if(!_[_0x3f87('0x5b')](_0x2b5d8a[_0x3e6185[_0x3f87('0x44')]['id']]))_0x3d8846=_0x2b5d8a[_0x3e6185[_0x3f87('0x44')]['id']];return _0x1d217b[_0x3f87('0xb')](0xc8)['json'](_0x3d8846);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index f503a2d..b7a83f9 100644 --- a/server/api/cmHopper/cmHopper.model.js +++ b/server/api/cmHopper/cmHopper.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4819=['request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','CmHopper','cm_hopper','scheduledat','phone','priority','util','../../config/logger','api','moment','bluebird'];(function(_0x3003f0,_0x313fc9){var _0x243901=function(_0x204ee1){while(--_0x204ee1){_0x3003f0['push'](_0x3003f0['shift']());}};_0x243901(++_0x313fc9);}(_0x4819,0xcd));var _0x9481=function(_0x26a815,_0xcde2b9){_0x26a815=_0x26a815-0x0;var _0x539ed1=_0x4819[_0x26a815];return _0x539ed1;};'use strict';var _=require('lodash');var util=require(_0x9481('0x0'));var logger=require(_0x9481('0x1'))(_0x9481('0x2'));var moment=require(_0x9481('0x3'));var BPromise=require(_0x9481('0x4'));var rp=require(_0x9481('0x5'));var fs=require('fs');var path=require(_0x9481('0x6'));var rimraf=require(_0x9481('0x7'));var config=require(_0x9481('0x8'));var attributes=require(_0x9481('0x9'));module['exports']=function(_0x4d9e3a,_0x5def07){return _0x4d9e3a['define'](_0x9481('0xa'),attributes,{'tableName':_0x9481('0xb'),'paranoid':![],'indexes':[{'name':_0x9481('0xc'),'fields':[_0x9481('0xc')]},{'name':_0x9481('0xd'),'fields':['phone']},{'name':_0x9481('0xe'),'fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file +var _0x2542=['../../config/environment','./cmHopper.attributes','exports','define','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','util','../../config/logger','api','bluebird','path','rimraf'];(function(_0x502b33,_0x656070){var _0x3129c0=function(_0x10eb4d){while(--_0x10eb4d){_0x502b33['push'](_0x502b33['shift']());}};_0x3129c0(++_0x656070);}(_0x2542,0x169));var _0x2254=function(_0x10bb3b,_0x4ca6bc){_0x10bb3b=_0x10bb3b-0x0;var _0x50e5d2=_0x2542[_0x10bb3b];return _0x50e5d2;};'use strict';var _=require(_0x2254('0x0'));var util=require(_0x2254('0x1'));var logger=require(_0x2254('0x2'))(_0x2254('0x3'));var moment=require('moment');var BPromise=require(_0x2254('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2254('0x5'));var rimraf=require(_0x2254('0x6'));var config=require(_0x2254('0x7'));var attributes=require(_0x2254('0x8'));module[_0x2254('0x9')]=function(_0x508183,_0x19ad3c){return _0x508183[_0x2254('0xa')](_0x2254('0xb'),attributes,{'tableName':_0x2254('0xc'),'paranoid':![],'indexes':[{'name':_0x2254('0xd'),'fields':[_0x2254('0xd')]},{'name':_0x2254('0xe'),'fields':[_0x2254('0xe')]},{'name':_0x2254('0xf'),'fields':[_0x2254('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index b3d556e..81aed2f 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 _0xaad5=['options','raw','where','attributes','limit','include','map','model','then','GetCmHopper','catch','message','error','ShowCmHopper','info','debug','stringify','CmHopper','create','CreateCmHopper','UpdateCmHopper','update','body','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','describe','sequelize','transaction','order','LOCK','UPDATE','CmContact','Contact','keys','Agent','name','length','UserId','push','includes','all','GetContactDialer','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','destroy','MoveContactManagedDialer','COUNT','literal','format','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','CountReScheduled','GetContactRecallMe','GetCmHopperPreview','GetContactByPhone','findOne','dialTimezone','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','interval','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()','voicePause','lodash','util','moment','../../config/logger','findAll'];(function(_0x26fdac,_0xefd766){var _0xa448e8=function(_0x4418b0){while(--_0x4418b0){_0x26fdac['push'](_0x26fdac['shift']());}};_0xa448e8(++_0xefd766);}(_0xaad5,0x177));var _0x5aad=function(_0x209fcd,_0x1ecccc){_0x209fcd=_0x209fcd-0x0;var _0x501d5e=_0xaad5[_0x209fcd];return _0x501d5e;};'use strict';var _=require(_0x5aad('0x0'));var util=require(_0x5aad('0x1'));var moment=require(_0x5aad('0x2'));var BPromise=require('bluebird');var db=require('../../mysqldb')['db'];var logger=require(_0x5aad('0x3'))('rpc');exports['GetCmHopper']=function(_0x2dafe4){var _0x57e910=this;return new Promise(function(_0x46882a,_0x593650){return db['CmHopper'][_0x5aad('0x4')]({'raw':_0x2dafe4[_0x5aad('0x5')]?_0x2dafe4['options'][_0x5aad('0x6')]===undefined?!![]:![]:!![],'where':_0x2dafe4[_0x5aad('0x5')]?_0x2dafe4[_0x5aad('0x5')][_0x5aad('0x7')]||null:null,'attributes':_0x2dafe4[_0x5aad('0x5')]?_0x2dafe4['options'][_0x5aad('0x8')]||null:null,'limit':_0x2dafe4[_0x5aad('0x5')]?_0x2dafe4[_0x5aad('0x5')][_0x5aad('0x9')]||null:null,'include':_0x2dafe4['options']?_0x2dafe4[_0x5aad('0x5')][_0x5aad('0xa')]?_[_0x5aad('0xb')](_0x2dafe4[_0x5aad('0x5')][_0x5aad('0xa')],function(_0x3a117f){return{'model':db[_0x3a117f['model']],'as':_0x3a117f['as'],'attributes':_0x3a117f['attributes'],'include':_0x3a117f[_0x5aad('0xa')]?_[_0x5aad('0xb')](_0x3a117f[_0x5aad('0xa')],function(_0x357326){return{'model':db[_0x357326[_0x5aad('0xc')]],'as':_0x357326['as'],'attributes':_0x357326[_0x5aad('0x8')],'include':_0x357326['include']?_[_0x5aad('0xb')](_0x357326[_0x5aad('0xa')],function(_0xfc32f7){return{'model':db[_0xfc32f7['model']],'as':_0xfc32f7['as'],'attributes':_0xfc32f7['attributes']};}):[]};}):[]};}):[]:[]})[_0x5aad('0xd')](function(_0x10448b){logger['info'](_0x5aad('0xe'),_0x2dafe4);logger['debug'](_0x5aad('0xe'),_0x2dafe4,JSON['stringify'](_0x10448b));_0x46882a(_0x10448b);})[_0x5aad('0xf')](function(_0x194b2c){logger['error'](_0x5aad('0xe'),_0x194b2c[_0x5aad('0x10')],_0x2dafe4);_0x593650(_0x57e910[_0x5aad('0x11')](0x1f4,_0x194b2c['message']));});});};exports[_0x5aad('0x12')]=function(_0x41461d){var _0x454b13=this;return new Promise(function(_0x3cf495,_0x42a98b){return db['CmHopper']['find']({'raw':_0x41461d[_0x5aad('0x5')]?_0x41461d['options'][_0x5aad('0x6')]===undefined?!![]:![]:!![],'where':_0x41461d[_0x5aad('0x5')]?_0x41461d[_0x5aad('0x5')][_0x5aad('0x7')]||null:null,'attributes':_0x41461d[_0x5aad('0x5')]?_0x41461d['options'][_0x5aad('0x8')]||null:null,'include':_0x41461d[_0x5aad('0x5')]?_0x41461d[_0x5aad('0x5')][_0x5aad('0xa')]?_[_0x5aad('0xb')](_0x41461d['options'][_0x5aad('0xa')],function(_0x2cec11){return{'model':db[_0x2cec11[_0x5aad('0xc')]],'as':_0x2cec11['as'],'attributes':_0x2cec11[_0x5aad('0x8')],'include':_0x2cec11[_0x5aad('0xa')]?_[_0x5aad('0xb')](_0x2cec11[_0x5aad('0xa')],function(_0x2e0095){return{'model':db[_0x2e0095[_0x5aad('0xc')]],'as':_0x2e0095['as'],'attributes':_0x2e0095['attributes'],'include':_0x2e0095[_0x5aad('0xa')]?_[_0x5aad('0xb')](_0x2e0095[_0x5aad('0xa')],function(_0x3154c5){return{'model':db[_0x3154c5[_0x5aad('0xc')]],'as':_0x3154c5['as'],'attributes':_0x3154c5[_0x5aad('0x8')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x29a9e9){logger[_0x5aad('0x13')](_0x5aad('0x12'),_0x41461d);logger[_0x5aad('0x14')](_0x5aad('0x12'),_0x41461d,JSON[_0x5aad('0x15')](_0x29a9e9));_0x3cf495(_0x29a9e9);})['catch'](function(_0x59e7c6){logger[_0x5aad('0x11')]('ShowCmHopper',_0x59e7c6[_0x5aad('0x10')],_0x41461d);_0x42a98b(_0x454b13[_0x5aad('0x11')](0x1f4,_0x59e7c6[_0x5aad('0x10')]));});});};exports['CreateCmHopper']=function(_0x44e2c1){var _0x29ea12=this;return new Promise(function(_0xd009a1,_0x3b2d3b){return db[_0x5aad('0x16')][_0x5aad('0x17')](_0x44e2c1['body'],{'raw':_0x44e2c1[_0x5aad('0x5')]?_0x44e2c1['options'][_0x5aad('0x6')]===undefined?!![]:![]:!![]})['then'](function(_0x1e1729){logger[_0x5aad('0x13')](_0x5aad('0x18'),_0x44e2c1);logger[_0x5aad('0x14')](_0x5aad('0x18'),_0x44e2c1,JSON[_0x5aad('0x15')](_0x1e1729));_0xd009a1(_0x1e1729);})[_0x5aad('0xf')](function(_0x46b443){logger[_0x5aad('0x11')](_0x5aad('0x18'),_0x46b443[_0x5aad('0x10')],_0x44e2c1);_0x3b2d3b(_0x29ea12[_0x5aad('0x11')](0x1f4,_0x46b443['message']));});});};exports[_0x5aad('0x19')]=function(_0x422c25){var _0x55242d=this;return new Promise(function(_0x29fab8,_0xcce4e1){return db[_0x5aad('0x16')][_0x5aad('0x1a')](_0x422c25[_0x5aad('0x1b')],{'raw':_0x422c25[_0x5aad('0x5')]?_0x422c25[_0x5aad('0x5')][_0x5aad('0x6')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x422c25[_0x5aad('0x5')]?_0x422c25[_0x5aad('0x5')][_0x5aad('0x7')]||null:null,'attributes':_0x422c25[_0x5aad('0x5')]?_0x422c25['options'][_0x5aad('0x8')]||null:null,'limit':_0x422c25[_0x5aad('0x5')]?_0x422c25[_0x5aad('0x5')]['limit']||null:null})[_0x5aad('0xd')](function(_0xa4e105){logger['info'](_0x5aad('0x19'),_0x422c25);logger[_0x5aad('0x13')](_0x5aad('0x1c'),JSON[_0x5aad('0x15')](_0x422c25[_0x5aad('0x5')][_0x5aad('0x7')]),_0x422c25[_0x5aad('0x1b')][_0x5aad('0x1d')]);logger['debug'](_0x5aad('0x19'),_0x422c25,JSON[_0x5aad('0x15')](_0xa4e105));_0x29fab8(_0xa4e105);})[_0x5aad('0xf')](function(_0x4e82ea){logger['error'](_0x5aad('0x19'),_0x4e82ea[_0x5aad('0x10')],_0x422c25);_0xcce4e1(_0x55242d[_0x5aad('0x11')](0x1f4,_0x4e82ea[_0x5aad('0x10')]));});});};exports[_0x5aad('0x1e')]=function(_0x167762){var _0x45731e=this;return new Promise(function(_0x4df854,_0x541c46){return db[_0x5aad('0x16')]['destroy']({'where':_0x167762['options']?_0x167762[_0x5aad('0x5')][_0x5aad('0x7')]||null:null})[_0x5aad('0xd')](function(_0x32b4b6){logger[_0x5aad('0x13')]('DestroyCmHopper',_0x167762);logger[_0x5aad('0x14')](_0x5aad('0x1e'),_0x167762,JSON[_0x5aad('0x15')](_0x32b4b6));_0x4df854(_0x32b4b6);})[_0x5aad('0xf')](function(_0x31a065){logger['error'](_0x5aad('0x1e'),_0x31a065[_0x5aad('0x10')],_0x167762);_0x541c46(_0x45731e[_0x5aad('0x11')](0x1f4,_0x31a065[_0x5aad('0x10')]));});});};exports['GetContactDialer']=function(_0x3f7ff6){var _0x237db2=this;return new Promise(function(_0x4f598d,_0xdff65a){return db['CmContact'][_0x5aad('0x1f')]()[_0x5aad('0xd')](function(_0x4b8d34){return db[_0x5aad('0x20')][_0x5aad('0x21')](function(_0x1959d6){return db[_0x5aad('0x16')]['findAll']({'where':_0x3f7ff6[_0x5aad('0x5')]?_0x3f7ff6['options'][_0x5aad('0x7')]||null:null,'attributes':_0x3f7ff6[_0x5aad('0x5')]?_0x3f7ff6[_0x5aad('0x5')][_0x5aad('0x8')]||null:null,'limit':_0x3f7ff6[_0x5aad('0x5')]?_0x3f7ff6[_0x5aad('0x5')][_0x5aad('0x9')]||null:null,'order':_0x3f7ff6[_0x5aad('0x5')]?_0x3f7ff6[_0x5aad('0x5')][_0x5aad('0x22')]||null:null,'transaction':_0x1959d6,'lock':_0x1959d6[_0x5aad('0x23')][_0x5aad('0x24')],'include':[{'model':db[_0x5aad('0x25')],'as':_0x5aad('0x26'),'attributes':_[_0x5aad('0x27')](_0x4b8d34)},{'model':db['User'],'as':_0x5aad('0x28'),'attributes':['id',_0x5aad('0x29'),'voicePause']}]})[_0x5aad('0xd')](function(_0x10b3d8){var _0x3afa86=[];var _0x2866bf=[];for(var _0x434cd0=0x0;_0x434cd0<_0x10b3d8[_0x5aad('0x2a')];_0x434cd0+=0x1){var _0xe3ddc4=_0x10b3d8[_0x434cd0][_0x5aad('0x2b')];if(_0xe3ddc4===null){_0x3afa86[_0x5aad('0x2c')](_0x10b3d8[_0x434cd0][_0x5aad('0x1a')](_0x3f7ff6[_0x5aad('0x1b')],{'transaction':_0x1959d6}));}else if(!_0x2866bf[_0x5aad('0x2d')](_0xe3ddc4)){_0x2866bf[_0x5aad('0x2c')](_0xe3ddc4);_0x3afa86[_0x5aad('0x2c')](_0x10b3d8[_0x434cd0][_0x5aad('0x1a')](_0x3f7ff6['body'],{'transaction':_0x1959d6}));}}return BPromise[_0x5aad('0x2e')](_0x3afa86);});})[_0x5aad('0xd')](function(_0x3e2693){logger[_0x5aad('0x13')](_0x5aad('0x2f'),_0x3f7ff6);if(_0x3e2693[_0x5aad('0x2a')]>0x0){logger['info'](_0x5aad('0x30'),_0x3e2693[0x0][_0x5aad('0x31')]['id'],_0x3e2693[0x0][_0x5aad('0x31')][_0x5aad('0x32')],_0x3e2693[0x0][_0x5aad('0x31')][_0x5aad('0x1d')]);}logger[_0x5aad('0x14')](_0x5aad('0x2f'),_0x3f7ff6,JSON['stringify'](_0x3e2693));_0x4f598d(_0x3e2693);})['catch'](function(_0x5a42f3){logger['error'](_0x5aad('0x2f'),_0x5a42f3[_0x5aad('0x10')],_0x3f7ff6);_0xdff65a(_0x237db2[_0x5aad('0x11')](0x1f4,_0x5a42f3['message']));});});});};exports['MoveContactManagedDialer']=function(_0xfe768e){var _0x514822=this;return new Promise(function(_0x5bf3d1,_0x1eafcc){return db['sequelize']['transaction'](function(_0x34c41d){return db[_0x5aad('0x33')][_0x5aad('0x17')](_0xfe768e['body'],{'raw':_0xfe768e['options']?_0xfe768e[_0x5aad('0x5')][_0x5aad('0x6')]===undefined?!![]:![]:!![],'transaction':_0x34c41d})[_0x5aad('0xd')](function(){logger[_0x5aad('0x13')](_0x5aad('0x34'),JSON['stringify'](_0xfe768e[_0x5aad('0x5')][_0x5aad('0x7')]),_0xfe768e[_0x5aad('0x5')][_0x5aad('0x7')][_0x5aad('0x1d')]);return db['CmHopper'][_0x5aad('0x35')]({'where':_0xfe768e[_0x5aad('0x5')]?_0xfe768e['options']['where']||null:null,'transaction':_0x34c41d});});})[_0x5aad('0xd')](function(_0x4599d0){logger[_0x5aad('0x13')]('MoveContactManagedDialer',_0xfe768e);logger[_0x5aad('0x14')](_0x5aad('0x36'),_0xfe768e,JSON[_0x5aad('0x15')](_0x4599d0));_0x5bf3d1(_0x4599d0);})[_0x5aad('0xf')](function(_0x45e41b){logger[_0x5aad('0x11')](_0x5aad('0x36'),_0x45e41b[_0x5aad('0x10')],_0xfe768e);_0x1eafcc(_0x514822[_0x5aad('0x11')](0x1f4,_0x45e41b[_0x5aad('0x10')]));});});};exports['CountReScheduled']=function(_0x3dacbf){var _0x3bdd4b=this;return new Promise(function(_0x3922d3,_0x690ef8){return db['CmHopper']['findAll']({'raw':_0x3dacbf[_0x5aad('0x5')]?_0x3dacbf[_0x5aad('0x5')]['raw']===undefined?!![]:![]:!![],'where':_0x3dacbf['options']?_0x3dacbf[_0x5aad('0x5')]['where']||null:null,'attributes':[[db[_0x5aad('0x20')]['fn'](_0x5aad('0x37'),db['sequelize']['fn']('IF',db['sequelize'][_0x5aad('0x38')]('`scheduledat`\x20>=\x20'+util[_0x5aad('0x39')]('\x22%s\x22',moment()['format'](_0x5aad('0x3a')))+_0x5aad('0x3b')))),_0x5aad('0x3c')]]})['then'](function(_0x69504e){logger['info'](_0x5aad('0x3d'),_0x3dacbf);logger['debug'](_0x5aad('0x3d'),_0x3dacbf,JSON['stringify'](_0x69504e));_0x3922d3(_0x69504e);})['catch'](function(_0x4636db){logger[_0x5aad('0x11')](_0x5aad('0x3d'),_0x4636db[_0x5aad('0x10')],_0x3dacbf);_0x690ef8(_0x3bdd4b[_0x5aad('0x11')](0x1f4,_0x4636db['message']));});});};exports[_0x5aad('0x3e')]=function(_0x75be21){var _0x24a402=this;return new Promise(function(_0x3d0ae0,_0x3042c2){return db[_0x5aad('0x25')][_0x5aad('0x1f')]()[_0x5aad('0xd')](function(){return db[_0x5aad('0x20')][_0x5aad('0x21')](function(_0x497811){return db[_0x5aad('0x16')][_0x5aad('0x4')]({'where':_0x75be21[_0x5aad('0x5')]?_0x75be21[_0x5aad('0x5')][_0x5aad('0x7')]||null:null,'attributes':_0x75be21['options']?_0x75be21['options'][_0x5aad('0x8')]||null:null,'limit':0x1,'order':_0x75be21[_0x5aad('0x5')]?_0x75be21[_0x5aad('0x5')][_0x5aad('0x22')]||null:null,'group':db[_0x5aad('0x16')][_0x5aad('0x2b')],'transaction':_0x497811,'lock':_0x497811['LOCK'][_0x5aad('0x24')],'include':_0x75be21['options']?_0x75be21[_0x5aad('0x5')][_0x5aad('0xa')]?_[_0x5aad('0xb')](_0x75be21[_0x5aad('0x5')][_0x5aad('0xa')],function(_0x592b82){return{'model':db[_0x592b82[_0x5aad('0xc')]],'as':_0x592b82['as'],'attributes':_0x592b82[_0x5aad('0x8')],'include':_0x592b82[_0x5aad('0xa')]?_[_0x5aad('0xb')](_0x592b82['include'],function(_0x4a6889){return{'model':db[_0x4a6889[_0x5aad('0xc')]],'as':_0x4a6889['as'],'attributes':_0x4a6889[_0x5aad('0x8')],'include':_0x4a6889[_0x5aad('0xa')]?_['map'](_0x4a6889[_0x5aad('0xa')],function(_0x5c3cfb){return{'model':db[_0x5c3cfb['model']],'as':_0x5c3cfb['as'],'attributes':_0x5c3cfb[_0x5aad('0x8')]};}):[]};}):[]};}):[]:[]})[_0x5aad('0xd')](function(_0x1aff23){var _0x2cc949=[];for(var _0xd75cac=0x0;_0xd75cac<_0x1aff23['length'];_0xd75cac+=0x1){_0x2cc949[_0x5aad('0x2c')](_0x1aff23[_0xd75cac][_0x5aad('0x1a')](_0x75be21['body'],{'transaction':_0x497811}));}return BPromise[_0x5aad('0x2e')](_0x2cc949);});})[_0x5aad('0xd')](function(_0x144c1b){logger[_0x5aad('0x13')](_0x5aad('0x3e'),_0x75be21);logger[_0x5aad('0x14')](_0x5aad('0x3e'),_0x75be21,JSON[_0x5aad('0x15')](_0x144c1b));_0x3d0ae0(_0x144c1b);})['catch'](function(_0x5c44e8){logger[_0x5aad('0x11')]('GetContactRecallMe',_0x5c44e8[_0x5aad('0x10')],_0x75be21);_0x3042c2(_0x24a402[_0x5aad('0x11')](0x1f4,_0x5c44e8[_0x5aad('0x10')]));});});});};exports[_0x5aad('0x3f')]=function(_0xaa83c6){var _0x5614c3=this;return new Promise(function(_0x38998d,_0x48380f){db[_0x5aad('0x25')][_0x5aad('0x1f')]()[_0x5aad('0xd')](function(_0x157636){return db[_0x5aad('0x16')][_0x5aad('0x4')]({'raw':_0xaa83c6[_0x5aad('0x5')]?_0xaa83c6[_0x5aad('0x5')][_0x5aad('0x6')]===undefined?!![]:![]:!![],'where':_0xaa83c6[_0x5aad('0x5')]?_0xaa83c6[_0x5aad('0x5')]['where']||null:null,'attributes':_0xaa83c6['options']?_0xaa83c6[_0x5aad('0x5')][_0x5aad('0x8')]||null:null,'limit':_0xaa83c6[_0x5aad('0x5')]?_0xaa83c6[_0x5aad('0x5')]['limit']||null:null,'include':_0xaa83c6[_0x5aad('0x5')]?_0xaa83c6[_0x5aad('0x5')][_0x5aad('0xa')]?_[_0x5aad('0xb')](_0xaa83c6[_0x5aad('0x5')][_0x5aad('0xa')],function(_0xdff7a3){return{'model':db[_0xdff7a3['model']],'as':_0xdff7a3['as'],'attributes':_0xdff7a3['as']===_0x5aad('0x26')?_['keys'](_0x157636):_0xdff7a3[_0x5aad('0x8')],'include':_0xdff7a3[_0x5aad('0xa')]?_['map'](_0xdff7a3[_0x5aad('0xa')],function(_0x58720a){return{'model':db[_0x58720a[_0x5aad('0xc')]],'as':_0x58720a['as'],'attributes':_0x58720a[_0x5aad('0x8')],'include':_0x58720a[_0x5aad('0xa')]?_[_0x5aad('0xb')](_0x58720a[_0x5aad('0xa')],function(_0x4efc7b){return{'model':db[_0x4efc7b['model']],'as':_0x4efc7b['as'],'attributes':_0x4efc7b['attributes']};}):[]};}):[]};}):[]:[]})[_0x5aad('0xd')](function(_0x369829){logger[_0x5aad('0x13')](_0x5aad('0xe'),_0xaa83c6);logger[_0x5aad('0x14')](_0x5aad('0xe'),_0xaa83c6,JSON[_0x5aad('0x15')](_0x369829));_0x38998d(_0x369829);})[_0x5aad('0xf')](function(_0x2ba3b0){logger[_0x5aad('0x11')](_0x5aad('0xe'),_0x2ba3b0[_0x5aad('0x10')],_0xaa83c6);_0x48380f(_0x5614c3[_0x5aad('0x11')](0x1f4,_0x2ba3b0[_0x5aad('0x10')]));});});});};exports[_0x5aad('0x40')]=function(_0x45754f){var _0x328823=this;return new Promise(function(_0x11e1fc,_0x17a4cf){return db[_0x5aad('0x25')][_0x5aad('0x41')]({'raw':!![],'where':{'phone':_0x45754f[_0x5aad('0x5')][_0x5aad('0x7')]['phone']},'attributes':['id',_0x5aad('0x42')],'order':[['id','DESC']]})['then'](function(_0x3ff5fa){logger[_0x5aad('0x13')](_0x5aad('0x43'),_0x45754f);logger[_0x5aad('0x14')](_0x5aad('0x43'),_0x45754f,JSON[_0x5aad('0x15')](_0x3ff5fa));_0x11e1fc(_0x3ff5fa);})[_0x5aad('0xf')](function(_0x5218b4){logger[_0x5aad('0x11')](_0x5aad('0x43'),_0x5218b4[_0x5aad('0x10')],_0x45754f);_0x17a4cf(_0x328823[_0x5aad('0x11')](0x1f4,_0x5218b4[_0x5aad('0x10')]));});});};exports[_0x5aad('0x44')]=function(_0x574fc3){var _0x422ad7=this;return new Promise(function(_0x95c523,_0x247e00){return db[_0x5aad('0x20')][_0x5aad('0x21')](function(_0x2cdc0e){var _0x274d95=_0x574fc3['options']&&_0x574fc3[_0x5aad('0x5')]['where']?_0x574fc3[_0x5aad('0x5')][_0x5aad('0x7')]:{};return db[_0x5aad('0x16')]['update'](_0x574fc3[_0x5aad('0x1b')],{'where':_0x274d95,'transaction':_0x2cdc0e})['then'](function(_0x270de3){logger[_0x5aad('0x13')]('ResetActiveCalls',_0x574fc3);logger[_0x5aad('0x14')](_0x5aad('0x44'),_0x574fc3,JSON['stringify'](_0x270de3));_0x95c523(_0x270de3);})['catch'](function(_0x31e1a7){logger['error'](_0x5aad('0x44'),_0x31e1a7[_0x5aad('0x10')],_0x574fc3);_0x247e00(_0x422ad7['error'](0x1f4,_0x31e1a7[_0x5aad('0x10')]));});});});};exports[_0x5aad('0x45')]=function(_0x173f71){var _0x5910b4=this;var _0x3528df=_0x173f71[_0x5aad('0x1b')][_0x5aad('0x7')]['voiceQueueIds'];var _0x5904f9=_0x173f71['body'][_0x5aad('0x7')][_0x5aad('0x46')];var _0x2651f4=_0x173f71[_0x5aad('0x1b')]['where'][_0x5aad('0x47')];return new Promise(function(_0x14a8ab,_0x5c778e){return db['CmHopper'][_0x5aad('0x4')]({'where':{'voiceQueueId':{'$in':_0x3528df},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x5aad('0x20')][_0x5aad('0x38')](_0x5aad('0x48')+_0x5904f9+_0x5aad('0x49')),'$gt':db[_0x5aad('0x20')][_0x5aad('0x38')](_0x5aad('0x4a'))}},'UserId':{'$in':_0x2651f4}},'include':[{'model':db['CmContact'],'as':_0x5aad('0x26')},{'model':db['User'],'as':_0x5aad('0x28'),'attributes':['id',_0x5aad('0x29'),_0x5aad('0x4b')]},{'model':db['CmList'],'as':'List'}]})['then'](function(_0x9ff4aa){if(_0x9ff4aa[_0x5aad('0x2a')]>0x0){return db['sequelize'][_0x5aad('0x21')](function(_0x17b3a9){return db[_0x5aad('0x16')][_0x5aad('0x1a')]({'recallmeNotifiedDate':db[_0x5aad('0x20')][_0x5aad('0x38')]('NOW()')},{'where':{'id':{'$in':_[_0x5aad('0xb')](_0x9ff4aa,'id')}},'transaction':_0x17b3a9})[_0x5aad('0xd')](function(){_0x14a8ab(_0x9ff4aa);})['catch'](function(_0x3351f3){logger[_0x5aad('0x11')](_0x5aad('0x45'),_0x3351f3[_0x5aad('0x10')],_0x173f71);_0x5c778e(_0x5910b4[_0x5aad('0x11')](0x1f4,_0x3351f3['message']));});})[_0x5aad('0xf')](function(_0x320e4a){logger[_0x5aad('0x11')](_0x5aad('0x45'),_0x320e4a['message'],_0x173f71);_0x5c778e(_0x5910b4[_0x5aad('0x11')](0x1f4,_0x320e4a['message']));});}else{_0x14a8ab(_0x9ff4aa);}});});}; \ No newline at end of file +var _0xa354=['getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','interval','availableAgentsIds','\x20MINUTE','NOW()','Contact','List','lodash','util','../../config/logger','rpc','options','raw','where','include','model','attributes','map','then','info','GetCmHopper','stringify','catch','error','message','CmHopper','find','ShowCmHopper','CreateCmHopper','create','body','UpdateCmHopper','update','limit','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','debug','DestroyCmHopper','destroy','CmContact','sequelize','findAll','order','LOCK','keys','User','Agent','name','voicePause','length','UserId','push','all','GetContactDialer','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','MoveContactManagedDialer','transaction','CmHopperFinal','CountReScheduled','COUNT','literal','\x20,\x201,\x20null','GetContactRecallMe','describe','UPDATE','GetContactByPhone','phone','dialTimezone','DESC'];(function(_0x363c0b,_0x14038d){var _0x14d500=function(_0x294df9){while(--_0x294df9){_0x363c0b['push'](_0x363c0b['shift']());}};_0x14d500(++_0x14038d);}(_0xa354,0x1bf));var _0x4a35=function(_0xa1be1e,_0x54a26d){_0xa1be1e=_0xa1be1e-0x0;var _0x5e7bc5=_0xa354[_0xa1be1e];return _0x5e7bc5;};'use strict';var _=require(_0x4a35('0x0'));var util=require(_0x4a35('0x1'));var moment=require('moment');var BPromise=require('bluebird');var db=require('../../mysqldb')['db'];var logger=require(_0x4a35('0x2'))(_0x4a35('0x3'));exports['GetCmHopper']=function(_0x4b6380){var _0x2fa873=this;return new Promise(function(_0x4e6f08,_0x386047){return db['CmHopper']['findAll']({'raw':_0x4b6380[_0x4a35('0x4')]?_0x4b6380[_0x4a35('0x4')][_0x4a35('0x5')]===undefined?!![]:![]:!![],'where':_0x4b6380[_0x4a35('0x4')]?_0x4b6380[_0x4a35('0x4')][_0x4a35('0x6')]||null:null,'attributes':_0x4b6380['options']?_0x4b6380['options']['attributes']||null:null,'limit':_0x4b6380[_0x4a35('0x4')]?_0x4b6380['options']['limit']||null:null,'include':_0x4b6380[_0x4a35('0x4')]?_0x4b6380['options']['include']?_['map'](_0x4b6380['options'][_0x4a35('0x7')],function(_0x1b06e8){return{'model':db[_0x1b06e8[_0x4a35('0x8')]],'as':_0x1b06e8['as'],'attributes':_0x1b06e8[_0x4a35('0x9')],'include':_0x1b06e8[_0x4a35('0x7')]?_[_0x4a35('0xa')](_0x1b06e8[_0x4a35('0x7')],function(_0x25609e){return{'model':db[_0x25609e[_0x4a35('0x8')]],'as':_0x25609e['as'],'attributes':_0x25609e['attributes'],'include':_0x25609e['include']?_[_0x4a35('0xa')](_0x25609e[_0x4a35('0x7')],function(_0x43e647){return{'model':db[_0x43e647[_0x4a35('0x8')]],'as':_0x43e647['as'],'attributes':_0x43e647['attributes']};}):[]};}):[]};}):[]:[]})[_0x4a35('0xb')](function(_0x173fb4){logger[_0x4a35('0xc')](_0x4a35('0xd'),_0x4b6380);logger['debug']('GetCmHopper',_0x4b6380,JSON[_0x4a35('0xe')](_0x173fb4));_0x4e6f08(_0x173fb4);})[_0x4a35('0xf')](function(_0xdf175d){logger[_0x4a35('0x10')]('GetCmHopper',_0xdf175d['message'],_0x4b6380);_0x386047(_0x2fa873[_0x4a35('0x10')](0x1f4,_0xdf175d[_0x4a35('0x11')]));});});};exports['ShowCmHopper']=function(_0x187ee0){var _0x468bf1=this;return new Promise(function(_0x484060,_0x4e2452){return db[_0x4a35('0x12')][_0x4a35('0x13')]({'raw':_0x187ee0[_0x4a35('0x4')]?_0x187ee0['options'][_0x4a35('0x5')]===undefined?!![]:![]:!![],'where':_0x187ee0[_0x4a35('0x4')]?_0x187ee0[_0x4a35('0x4')][_0x4a35('0x6')]||null:null,'attributes':_0x187ee0['options']?_0x187ee0['options']['attributes']||null:null,'include':_0x187ee0[_0x4a35('0x4')]?_0x187ee0[_0x4a35('0x4')][_0x4a35('0x7')]?_[_0x4a35('0xa')](_0x187ee0[_0x4a35('0x4')]['include'],function(_0x2cf577){return{'model':db[_0x2cf577[_0x4a35('0x8')]],'as':_0x2cf577['as'],'attributes':_0x2cf577['attributes'],'include':_0x2cf577[_0x4a35('0x7')]?_[_0x4a35('0xa')](_0x2cf577['include'],function(_0x1ff90c){return{'model':db[_0x1ff90c['model']],'as':_0x1ff90c['as'],'attributes':_0x1ff90c['attributes'],'include':_0x1ff90c['include']?_['map'](_0x1ff90c[_0x4a35('0x7')],function(_0xb5b920){return{'model':db[_0xb5b920['model']],'as':_0xb5b920['as'],'attributes':_0xb5b920['attributes']};}):[]};}):[]};}):[]:[]})[_0x4a35('0xb')](function(_0x68ab31){logger[_0x4a35('0xc')]('ShowCmHopper',_0x187ee0);logger['debug'](_0x4a35('0x14'),_0x187ee0,JSON['stringify'](_0x68ab31));_0x484060(_0x68ab31);})['catch'](function(_0xbf8d51){logger[_0x4a35('0x10')](_0x4a35('0x14'),_0xbf8d51[_0x4a35('0x11')],_0x187ee0);_0x4e2452(_0x468bf1[_0x4a35('0x10')](0x1f4,_0xbf8d51[_0x4a35('0x11')]));});});};exports[_0x4a35('0x15')]=function(_0x416905){var _0x38248a=this;return new Promise(function(_0x2ffb5b,_0x2f4948){return db[_0x4a35('0x12')][_0x4a35('0x16')](_0x416905[_0x4a35('0x17')],{'raw':_0x416905[_0x4a35('0x4')]?_0x416905[_0x4a35('0x4')][_0x4a35('0x5')]===undefined?!![]:![]:!![]})[_0x4a35('0xb')](function(_0x2ba044){logger[_0x4a35('0xc')](_0x4a35('0x15'),_0x416905);logger['debug'](_0x4a35('0x15'),_0x416905,JSON[_0x4a35('0xe')](_0x2ba044));_0x2ffb5b(_0x2ba044);})[_0x4a35('0xf')](function(_0x417e51){logger[_0x4a35('0x10')]('CreateCmHopper',_0x417e51[_0x4a35('0x11')],_0x416905);_0x2f4948(_0x38248a['error'](0x1f4,_0x417e51[_0x4a35('0x11')]));});});};exports[_0x4a35('0x18')]=function(_0x45af67){var _0x14de6a=this;return new Promise(function(_0x1a0615,_0x287737){return db[_0x4a35('0x12')][_0x4a35('0x19')](_0x45af67[_0x4a35('0x17')],{'raw':_0x45af67[_0x4a35('0x4')]?_0x45af67['options'][_0x4a35('0x5')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x45af67[_0x4a35('0x4')]?_0x45af67['options'][_0x4a35('0x6')]||null:null,'attributes':_0x45af67['options']?_0x45af67['options'][_0x4a35('0x9')]||null:null,'limit':_0x45af67[_0x4a35('0x4')]?_0x45af67[_0x4a35('0x4')][_0x4a35('0x1a')]||null:null})['then'](function(_0x56cd12){logger[_0x4a35('0xc')](_0x4a35('0x18'),_0x45af67);logger[_0x4a35('0xc')](_0x4a35('0x1b'),JSON[_0x4a35('0xe')](_0x45af67[_0x4a35('0x4')]['where']),_0x45af67['body'][_0x4a35('0x1c')]);logger[_0x4a35('0x1d')](_0x4a35('0x18'),_0x45af67,JSON[_0x4a35('0xe')](_0x56cd12));_0x1a0615(_0x56cd12);})[_0x4a35('0xf')](function(_0x40f496){logger[_0x4a35('0x10')](_0x4a35('0x18'),_0x40f496[_0x4a35('0x11')],_0x45af67);_0x287737(_0x14de6a[_0x4a35('0x10')](0x1f4,_0x40f496[_0x4a35('0x11')]));});});};exports[_0x4a35('0x1e')]=function(_0x20685d){var _0x350e20=this;return new Promise(function(_0x5f2ac,_0x3502a2){return db[_0x4a35('0x12')][_0x4a35('0x1f')]({'where':_0x20685d[_0x4a35('0x4')]?_0x20685d[_0x4a35('0x4')]['where']||null:null})[_0x4a35('0xb')](function(_0x22cefb){logger[_0x4a35('0xc')]('DestroyCmHopper',_0x20685d);logger[_0x4a35('0x1d')]('DestroyCmHopper',_0x20685d,JSON[_0x4a35('0xe')](_0x22cefb));_0x5f2ac(_0x22cefb);})[_0x4a35('0xf')](function(_0x23cc8a){logger[_0x4a35('0x10')](_0x4a35('0x1e'),_0x23cc8a['message'],_0x20685d);_0x3502a2(_0x350e20[_0x4a35('0x10')](0x1f4,_0x23cc8a[_0x4a35('0x11')]));});});};exports['GetContactDialer']=function(_0x2aeb90){var _0x1d0e4d=this;return new Promise(function(_0x1a341c,_0x138658){return db[_0x4a35('0x20')]['describe']()[_0x4a35('0xb')](function(_0x4e0993){return db[_0x4a35('0x21')]['transaction'](function(_0x432055){return db['CmHopper'][_0x4a35('0x22')]({'where':_0x2aeb90[_0x4a35('0x4')]?_0x2aeb90[_0x4a35('0x4')][_0x4a35('0x6')]||null:null,'attributes':_0x2aeb90[_0x4a35('0x4')]?_0x2aeb90['options']['attributes']||null:null,'limit':_0x2aeb90[_0x4a35('0x4')]?_0x2aeb90['options'][_0x4a35('0x1a')]||null:null,'order':_0x2aeb90[_0x4a35('0x4')]?_0x2aeb90['options'][_0x4a35('0x23')]||null:null,'transaction':_0x432055,'lock':_0x432055[_0x4a35('0x24')]['UPDATE'],'include':[{'model':db[_0x4a35('0x20')],'as':'Contact','attributes':_[_0x4a35('0x25')](_0x4e0993)},{'model':db[_0x4a35('0x26')],'as':_0x4a35('0x27'),'attributes':['id',_0x4a35('0x28'),_0x4a35('0x29')]}]})[_0x4a35('0xb')](function(_0x3e280){var _0x295960=[];var _0x1bbe00=[];for(var _0x59938c=0x0;_0x59938c<_0x3e280[_0x4a35('0x2a')];_0x59938c+=0x1){var _0x26bb9c=_0x3e280[_0x59938c][_0x4a35('0x2b')];if(_0x26bb9c===null){_0x295960[_0x4a35('0x2c')](_0x3e280[_0x59938c][_0x4a35('0x19')](_0x2aeb90['body'],{'transaction':_0x432055}));}else if(!_0x1bbe00['includes'](_0x26bb9c)){_0x1bbe00[_0x4a35('0x2c')](_0x26bb9c);_0x295960['push'](_0x3e280[_0x59938c][_0x4a35('0x19')](_0x2aeb90[_0x4a35('0x17')],{'transaction':_0x432055}));}}return BPromise[_0x4a35('0x2d')](_0x295960);});})['then'](function(_0x3b52f1){logger['info'](_0x4a35('0x2e'),_0x2aeb90);if(_0x3b52f1[_0x4a35('0x2a')]>0x0){logger['info'](_0x4a35('0x2f'),_0x3b52f1[0x0][_0x4a35('0x30')]['id'],_0x3b52f1[0x0][_0x4a35('0x30')][_0x4a35('0x31')],_0x3b52f1[0x0][_0x4a35('0x30')][_0x4a35('0x1c')]);}logger[_0x4a35('0x1d')](_0x4a35('0x2e'),_0x2aeb90,JSON['stringify'](_0x3b52f1));_0x1a341c(_0x3b52f1);})[_0x4a35('0xf')](function(_0x58d006){logger['error']('GetContactDialer',_0x58d006['message'],_0x2aeb90);_0x138658(_0x1d0e4d[_0x4a35('0x10')](0x1f4,_0x58d006[_0x4a35('0x11')]));});});});};exports[_0x4a35('0x32')]=function(_0x34ea3b){var _0x91058c=this;return new Promise(function(_0x1e8c48,_0x49da9d){return db[_0x4a35('0x21')][_0x4a35('0x33')](function(_0xf68343){return db[_0x4a35('0x34')][_0x4a35('0x16')](_0x34ea3b[_0x4a35('0x17')],{'raw':_0x34ea3b[_0x4a35('0x4')]?_0x34ea3b[_0x4a35('0x4')][_0x4a35('0x5')]===undefined?!![]:![]:!![],'transaction':_0xf68343})[_0x4a35('0xb')](function(){logger[_0x4a35('0xc')]('MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON['stringify'](_0x34ea3b[_0x4a35('0x4')][_0x4a35('0x6')]),_0x34ea3b[_0x4a35('0x4')][_0x4a35('0x6')][_0x4a35('0x1c')]);return db['CmHopper'][_0x4a35('0x1f')]({'where':_0x34ea3b[_0x4a35('0x4')]?_0x34ea3b[_0x4a35('0x4')][_0x4a35('0x6')]||null:null,'transaction':_0xf68343});});})['then'](function(_0x4d3ac1){logger[_0x4a35('0xc')](_0x4a35('0x32'),_0x34ea3b);logger[_0x4a35('0x1d')](_0x4a35('0x32'),_0x34ea3b,JSON[_0x4a35('0xe')](_0x4d3ac1));_0x1e8c48(_0x4d3ac1);})[_0x4a35('0xf')](function(_0x5af495){logger[_0x4a35('0x10')](_0x4a35('0x32'),_0x5af495[_0x4a35('0x11')],_0x34ea3b);_0x49da9d(_0x91058c[_0x4a35('0x10')](0x1f4,_0x5af495[_0x4a35('0x11')]));});});};exports[_0x4a35('0x35')]=function(_0x19fbff){var _0x7745fb=this;return new Promise(function(_0xf19c2b,_0x4c0e6a){return db[_0x4a35('0x12')][_0x4a35('0x22')]({'raw':_0x19fbff['options']?_0x19fbff[_0x4a35('0x4')]['raw']===undefined?!![]:![]:!![],'where':_0x19fbff[_0x4a35('0x4')]?_0x19fbff['options'][_0x4a35('0x6')]||null:null,'attributes':[[db[_0x4a35('0x21')]['fn'](_0x4a35('0x36'),db[_0x4a35('0x21')]['fn']('IF',db[_0x4a35('0x21')][_0x4a35('0x37')]('`scheduledat`\x20>=\x20'+util['format']('\x22%s\x22',moment()['format']('YYYY-MM-DD\x20HH:mm:ss'))+_0x4a35('0x38')))),'contactsRescheduled']]})[_0x4a35('0xb')](function(_0x1f1fca){logger[_0x4a35('0xc')](_0x4a35('0x35'),_0x19fbff);logger['debug'](_0x4a35('0x35'),_0x19fbff,JSON[_0x4a35('0xe')](_0x1f1fca));_0xf19c2b(_0x1f1fca);})[_0x4a35('0xf')](function(_0x572630){logger[_0x4a35('0x10')](_0x4a35('0x35'),_0x572630[_0x4a35('0x11')],_0x19fbff);_0x4c0e6a(_0x7745fb[_0x4a35('0x10')](0x1f4,_0x572630[_0x4a35('0x11')]));});});};exports[_0x4a35('0x39')]=function(_0xf67d88){var _0x4fcdfc=this;return new Promise(function(_0x375a54,_0x4e7474){return db[_0x4a35('0x20')][_0x4a35('0x3a')]()[_0x4a35('0xb')](function(){return db['sequelize'][_0x4a35('0x33')](function(_0x2a9199){return db['CmHopper'][_0x4a35('0x22')]({'where':_0xf67d88[_0x4a35('0x4')]?_0xf67d88['options'][_0x4a35('0x6')]||null:null,'attributes':_0xf67d88[_0x4a35('0x4')]?_0xf67d88[_0x4a35('0x4')][_0x4a35('0x9')]||null:null,'limit':0x1,'order':_0xf67d88[_0x4a35('0x4')]?_0xf67d88[_0x4a35('0x4')][_0x4a35('0x23')]||null:null,'group':db[_0x4a35('0x12')][_0x4a35('0x2b')],'transaction':_0x2a9199,'lock':_0x2a9199['LOCK'][_0x4a35('0x3b')],'include':_0xf67d88[_0x4a35('0x4')]?_0xf67d88[_0x4a35('0x4')][_0x4a35('0x7')]?_[_0x4a35('0xa')](_0xf67d88[_0x4a35('0x4')][_0x4a35('0x7')],function(_0x247351){return{'model':db[_0x247351['model']],'as':_0x247351['as'],'attributes':_0x247351['attributes'],'include':_0x247351['include']?_[_0x4a35('0xa')](_0x247351['include'],function(_0xef060e){return{'model':db[_0xef060e['model']],'as':_0xef060e['as'],'attributes':_0xef060e[_0x4a35('0x9')],'include':_0xef060e[_0x4a35('0x7')]?_[_0x4a35('0xa')](_0xef060e[_0x4a35('0x7')],function(_0x2a54c5){return{'model':db[_0x2a54c5[_0x4a35('0x8')]],'as':_0x2a54c5['as'],'attributes':_0x2a54c5[_0x4a35('0x9')]};}):[]};}):[]};}):[]:[]})[_0x4a35('0xb')](function(_0x124a55){var _0x28c9d8=[];for(var _0x55ddbe=0x0;_0x55ddbe<_0x124a55['length'];_0x55ddbe+=0x1){_0x28c9d8['push'](_0x124a55[_0x55ddbe][_0x4a35('0x19')](_0xf67d88[_0x4a35('0x17')],{'transaction':_0x2a9199}));}return BPromise[_0x4a35('0x2d')](_0x28c9d8);});})[_0x4a35('0xb')](function(_0x2e62b){logger['info']('GetContactRecallMe',_0xf67d88);logger[_0x4a35('0x1d')]('GetContactRecallMe',_0xf67d88,JSON[_0x4a35('0xe')](_0x2e62b));_0x375a54(_0x2e62b);})[_0x4a35('0xf')](function(_0x4fc313){logger['error'](_0x4a35('0x39'),_0x4fc313[_0x4a35('0x11')],_0xf67d88);_0x4e7474(_0x4fcdfc[_0x4a35('0x10')](0x1f4,_0x4fc313[_0x4a35('0x11')]));});});});};exports['GetCmHopperPreview']=function(_0x1284b8){var _0x2189db=this;return new Promise(function(_0xd7812c,_0x1601b7){db[_0x4a35('0x20')]['describe']()['then'](function(_0x2e8530){return db['CmHopper'][_0x4a35('0x22')]({'raw':_0x1284b8[_0x4a35('0x4')]?_0x1284b8[_0x4a35('0x4')][_0x4a35('0x5')]===undefined?!![]:![]:!![],'where':_0x1284b8[_0x4a35('0x4')]?_0x1284b8[_0x4a35('0x4')]['where']||null:null,'attributes':_0x1284b8[_0x4a35('0x4')]?_0x1284b8['options'][_0x4a35('0x9')]||null:null,'limit':_0x1284b8[_0x4a35('0x4')]?_0x1284b8[_0x4a35('0x4')][_0x4a35('0x1a')]||null:null,'include':_0x1284b8[_0x4a35('0x4')]?_0x1284b8['options'][_0x4a35('0x7')]?_[_0x4a35('0xa')](_0x1284b8['options']['include'],function(_0x2edaa4){return{'model':db[_0x2edaa4[_0x4a35('0x8')]],'as':_0x2edaa4['as'],'attributes':_0x2edaa4['as']==='Contact'?_[_0x4a35('0x25')](_0x2e8530):_0x2edaa4[_0x4a35('0x9')],'include':_0x2edaa4[_0x4a35('0x7')]?_[_0x4a35('0xa')](_0x2edaa4[_0x4a35('0x7')],function(_0x11be1a){return{'model':db[_0x11be1a[_0x4a35('0x8')]],'as':_0x11be1a['as'],'attributes':_0x11be1a['attributes'],'include':_0x11be1a[_0x4a35('0x7')]?_[_0x4a35('0xa')](_0x11be1a[_0x4a35('0x7')],function(_0x43014d){return{'model':db[_0x43014d[_0x4a35('0x8')]],'as':_0x43014d['as'],'attributes':_0x43014d[_0x4a35('0x9')]};}):[]};}):[]};}):[]:[]})[_0x4a35('0xb')](function(_0x5f42b4){logger['info'](_0x4a35('0xd'),_0x1284b8);logger['debug'](_0x4a35('0xd'),_0x1284b8,JSON['stringify'](_0x5f42b4));_0xd7812c(_0x5f42b4);})[_0x4a35('0xf')](function(_0x4baa42){logger[_0x4a35('0x10')](_0x4a35('0xd'),_0x4baa42[_0x4a35('0x11')],_0x1284b8);_0x1601b7(_0x2189db[_0x4a35('0x10')](0x1f4,_0x4baa42['message']));});});});};exports[_0x4a35('0x3c')]=function(_0x328100){var _0x33c3c4=this;return new Promise(function(_0x1ee8ee,_0x25e817){return db[_0x4a35('0x20')]['findOne']({'raw':!![],'where':{'phone':_0x328100[_0x4a35('0x4')][_0x4a35('0x6')][_0x4a35('0x3d')]},'attributes':['id',_0x4a35('0x3e')],'order':[['id',_0x4a35('0x3f')]]})[_0x4a35('0xb')](function(_0x1526b9){logger['info'](_0x4a35('0x40'),_0x328100);logger[_0x4a35('0x1d')](_0x4a35('0x40'),_0x328100,JSON[_0x4a35('0xe')](_0x1526b9));_0x1ee8ee(_0x1526b9);})[_0x4a35('0xf')](function(_0x4ee800){logger[_0x4a35('0x10')](_0x4a35('0x40'),_0x4ee800[_0x4a35('0x11')],_0x328100);_0x25e817(_0x33c3c4[_0x4a35('0x10')](0x1f4,_0x4ee800['message']));});});};exports[_0x4a35('0x41')]=function(_0xe6b81f){var _0x5c068f=this;return new Promise(function(_0x472634,_0x188e5e){return db[_0x4a35('0x21')]['transaction'](function(_0x149f4b){var _0x12bcce=_0xe6b81f[_0x4a35('0x4')]&&_0xe6b81f['options']['where']?_0xe6b81f[_0x4a35('0x4')]['where']:{};return db[_0x4a35('0x12')][_0x4a35('0x19')](_0xe6b81f['body'],{'where':_0x12bcce,'transaction':_0x149f4b})['then'](function(_0x28c65c){logger[_0x4a35('0xc')](_0x4a35('0x41'),_0xe6b81f);logger[_0x4a35('0x1d')](_0x4a35('0x41'),_0xe6b81f,JSON[_0x4a35('0xe')](_0x28c65c));_0x472634(_0x28c65c);})[_0x4a35('0xf')](function(_0x2bdfa4){logger[_0x4a35('0x10')](_0x4a35('0x41'),_0x2bdfa4['message'],_0xe6b81f);_0x188e5e(_0x5c068f[_0x4a35('0x10')](0x1f4,_0x2bdfa4[_0x4a35('0x11')]));});});});};exports[_0x4a35('0x42')]=function(_0x436ee7){var _0x4854f6=this;var _0x1f6995=_0x436ee7[_0x4a35('0x17')][_0x4a35('0x6')]['voiceQueueIds'];var _0x52c7bf=_0x436ee7[_0x4a35('0x17')][_0x4a35('0x6')][_0x4a35('0x43')];var _0x2109b8=_0x436ee7[_0x4a35('0x17')][_0x4a35('0x6')][_0x4a35('0x44')];return new Promise(function(_0x419f98,_0x5e891b){return db[_0x4a35('0x12')][_0x4a35('0x22')]({'where':{'voiceQueueId':{'$in':_0x1f6995},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x4a35('0x21')][_0x4a35('0x37')]('NOW()\x20+\x20INTERVAL\x20'+_0x52c7bf+_0x4a35('0x45')),'$gt':db[_0x4a35('0x21')]['literal'](_0x4a35('0x46'))}},'UserId':{'$in':_0x2109b8}},'include':[{'model':db['CmContact'],'as':_0x4a35('0x47')},{'model':db[_0x4a35('0x26')],'as':_0x4a35('0x27'),'attributes':['id',_0x4a35('0x28'),_0x4a35('0x29')]},{'model':db['CmList'],'as':_0x4a35('0x48')}]})['then'](function(_0x130356){if(_0x130356[_0x4a35('0x2a')]>0x0){return db[_0x4a35('0x21')][_0x4a35('0x33')](function(_0x1f5e11){return db[_0x4a35('0x12')][_0x4a35('0x19')]({'recallmeNotifiedDate':db[_0x4a35('0x21')][_0x4a35('0x37')](_0x4a35('0x46'))},{'where':{'id':{'$in':_[_0x4a35('0xa')](_0x130356,'id')}},'transaction':_0x1f5e11})[_0x4a35('0xb')](function(){_0x419f98(_0x130356);})[_0x4a35('0xf')](function(_0x49da7e){logger[_0x4a35('0x10')](_0x4a35('0x42'),_0x49da7e[_0x4a35('0x11')],_0x436ee7);_0x5e891b(_0x4854f6['error'](0x1f4,_0x49da7e[_0x4a35('0x11')]));});})['catch'](function(_0x362fb9){logger['error']('CmHopperHandlePreviewRecallNotifications',_0x362fb9[_0x4a35('0x11')],_0x436ee7);_0x5e891b(_0x4854f6[_0x4a35('0x10')](0x1f4,_0x362fb9[_0x4a35('0x11')]));});}else{_0x419f98(_0x130356);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index be4fbf8..009d60f 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 _0xa326=['isAuthenticated','/opencontacts','getOpenContacts','/timezones','getTimezones','/:id','show','/:id/previewrecall','getPreviewRecall','post','create','/preview','getPreview','/timezone','getTimezone','update','delete','destroy','express','Router','../../components/auth/service','./cmHopper.controller','get'];(function(_0x538016,_0x3e0520){var _0x7e3ee8=function(_0x36698b){while(--_0x36698b){_0x538016['push'](_0x538016['shift']());}};_0x7e3ee8(++_0x3e0520);}(_0xa326,0xf8));var _0x6a32=function(_0x265abe,_0x2f8efa){_0x265abe=_0x265abe-0x0;var _0x32313a=_0xa326[_0x265abe];return _0x32313a;};'use strict';var express=require(_0x6a32('0x0'));var router=express[_0x6a32('0x1')]();var auth=require(_0x6a32('0x2'));var controller=require(_0x6a32('0x3'));router[_0x6a32('0x4')]('/',auth[_0x6a32('0x5')](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x6a32('0x4')](_0x6a32('0x6'),auth[_0x6a32('0x5')](),controller[_0x6a32('0x7')]);router[_0x6a32('0x4')](_0x6a32('0x8'),auth[_0x6a32('0x5')](),controller[_0x6a32('0x9')]);router[_0x6a32('0x4')](_0x6a32('0xa'),auth[_0x6a32('0x5')](),controller[_0x6a32('0xb')]);router[_0x6a32('0x4')](_0x6a32('0xc'),auth['isAuthenticated'](),controller[_0x6a32('0xd')]);router[_0x6a32('0xe')]('/',auth[_0x6a32('0x5')](),controller[_0x6a32('0xf')]);router[_0x6a32('0xe')](_0x6a32('0x10'),auth['isAuthenticated'](),controller[_0x6a32('0x11')]);router[_0x6a32('0xe')](_0x6a32('0x12'),auth[_0x6a32('0x5')](),controller[_0x6a32('0x13')]);router['put']('/:id',auth[_0x6a32('0x5')](),controller[_0x6a32('0x14')]);router[_0x6a32('0x15')](_0x6a32('0xa'),auth[_0x6a32('0x5')](),controller[_0x6a32('0x16')]);module['exports']=router; \ No newline at end of file +var _0xaa74=['show','/:id/previewrecall','getPreviewRecall','post','create','/preview','getPreview','/timezone','getTimezone','delete','destroy','exports','express','Router','../../components/auth/service','./cmHopper.controller','get','isAuthenticated','index','/describe','describe','/opencontacts','getOpenContacts','/timezones','getTimezones','/:id'];(function(_0x325f3b,_0x2076dd){var _0x5b3c22=function(_0x560dbc){while(--_0x560dbc){_0x325f3b['push'](_0x325f3b['shift']());}};_0x5b3c22(++_0x2076dd);}(_0xaa74,0x1ac));var _0x4aa7=function(_0x4e26e6,_0x1a076f){_0x4e26e6=_0x4e26e6-0x0;var _0x4179f9=_0xaa74[_0x4e26e6];return _0x4179f9;};'use strict';var express=require(_0x4aa7('0x0'));var router=express[_0x4aa7('0x1')]();var auth=require(_0x4aa7('0x2'));var controller=require(_0x4aa7('0x3'));router[_0x4aa7('0x4')]('/',auth[_0x4aa7('0x5')](),controller[_0x4aa7('0x6')]);router['get'](_0x4aa7('0x7'),auth[_0x4aa7('0x5')](),controller[_0x4aa7('0x8')]);router[_0x4aa7('0x4')](_0x4aa7('0x9'),auth['isAuthenticated'](),controller[_0x4aa7('0xa')]);router['get'](_0x4aa7('0xb'),auth[_0x4aa7('0x5')](),controller[_0x4aa7('0xc')]);router['get'](_0x4aa7('0xd'),auth[_0x4aa7('0x5')](),controller[_0x4aa7('0xe')]);router[_0x4aa7('0x4')](_0x4aa7('0xf'),auth[_0x4aa7('0x5')](),controller[_0x4aa7('0x10')]);router[_0x4aa7('0x11')]('/',auth[_0x4aa7('0x5')](),controller[_0x4aa7('0x12')]);router[_0x4aa7('0x11')](_0x4aa7('0x13'),auth[_0x4aa7('0x5')](),controller[_0x4aa7('0x14')]);router[_0x4aa7('0x11')](_0x4aa7('0x15'),auth['isAuthenticated'](),controller[_0x4aa7('0x16')]);router['put'](_0x4aa7('0xd'),auth[_0x4aa7('0x5')](),controller['update']);router[_0x4aa7('0x17')]('/:id',auth['isAuthenticated'](),controller[_0x4aa7('0x18')]);module[_0x4aa7('0x19')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index 43ba08d..7e705b4 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 _0x9748=['STRING','DATE','YYYY-MM-DD\x20HH:mm:ss','sequelize','exports','INTEGER'];(function(_0x3f8647,_0x39c233){var _0x39d095=function(_0x367490){while(--_0x367490){_0x3f8647['push'](_0x3f8647['shift']());}};_0x39d095(++_0x39c233);}(_0x9748,0x123));var _0x8974=function(_0x43bb57,_0xaa00c8){_0x43bb57=_0x43bb57-0x0;var _0x576b77=_0x9748[_0x43bb57];return _0x576b77;};'use strict';var moment=require('moment');var Sequelize=require(_0x8974('0x0'));module[_0x8974('0x1')]={'CmHopperId':{'type':Sequelize[_0x8974('0x2')]},'phone':{'type':Sequelize[_0x8974('0x3')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x8974('0x2')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x8974('0x4')],'defaultValue':moment()['format'](_0x8974('0x5'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x8974('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x8974('0x2')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x8974('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xaec2=['STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','moment','sequelize','exports'];(function(_0x31df6f,_0x380e73){var _0x31e353=function(_0x3a434b){while(--_0x3a434b){_0x31df6f['push'](_0x31df6f['shift']());}};_0x31e353(++_0x380e73);}(_0xaec2,0x105));var _0x2aec=function(_0x7c9f16,_0x1a5b08){_0x7c9f16=_0x7c9f16-0x0;var _0x5a9326=_0xaec2[_0x7c9f16];return _0x5a9326;};'use strict';var moment=require(_0x2aec('0x0'));var Sequelize=require(_0x2aec('0x1'));module[_0x2aec('0x2')]={'CmHopperId':{'type':Sequelize['INTEGER']},'phone':{'type':Sequelize[_0x2aec('0x3')],'allowNull':![]},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x2aec('0x4')],'defaultValue':moment()[_0x2aec('0x5')](_0x2aec('0x6'))},'countbusyretry':{'type':Sequelize[_0x2aec('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x2aec('0x7')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x2aec('0x7')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x2aec('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x2aec('0x7')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x2aec('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js index 2ce9d10..4319bba 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 _0x7b76=['lodash','squel','crypto','jsforce','to-csv','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','update','destroy','then','CmHopperAdditionalPhones','UserProfileResource','error','name','send','map','rawAttributes','fieldName','type','key','model','keys','query','attributes','intersection','fields','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','options','CmHopperAdditionalPhone','include','findAll','show','params','includeAll','find','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','create','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra'];(function(_0x486f4a,_0x478dc7){var _0x135d99=function(_0x434008){while(--_0x434008){_0x486f4a['push'](_0x486f4a['shift']());}};_0x135d99(++_0x478dc7);}(_0x7b76,0xdc));var _0x67b7=function(_0x897476,_0x4d98be){_0x897476=_0x897476-0x0;var _0x1390da=_0x7b76[_0x897476];return _0x1390da;};'use strict';var emlformat=require(_0x67b7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x67b7('0x1'));var jsonpatch=require(_0x67b7('0x2'));var rp=require(_0x67b7('0x3'));var moment=require(_0x67b7('0x4'));var BPromise=require(_0x67b7('0x5'));var Mustache=require('mustache');var util=require(_0x67b7('0x6'));var path=require(_0x67b7('0x7'));var sox=require(_0x67b7('0x8'));var csv=require('to-csv');var ejs=require(_0x67b7('0x9'));var fs=require('fs');var fs_extra=require(_0x67b7('0xa'));var _=require(_0x67b7('0xb'));var squel=require(_0x67b7('0xc'));var crypto=require(_0x67b7('0xd'));var jsforce=require(_0x67b7('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x67b7('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x67b7('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x67b7('0x11'));var as=require(_0x67b7('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x67b7('0x13'))(_0x67b7('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x67b7('0x15'))['db'];function respondWithStatusCode(_0x5ed15d,_0xf93e30){_0xf93e30=_0xf93e30||0xcc;return function(_0x56862d){if(_0x56862d){return _0x5ed15d[_0x67b7('0x16')](_0xf93e30);}return _0x5ed15d[_0x67b7('0x17')](_0xf93e30)[_0x67b7('0x18')]();};}function respondWithResult(_0x700db5,_0x5ca0d2){_0x5ca0d2=_0x5ca0d2||0xc8;return function(_0x3dfa08){if(_0x3dfa08){return _0x700db5[_0x67b7('0x17')](_0x5ca0d2)[_0x67b7('0x19')](_0x3dfa08);}};}function respondWithFilteredResult(_0x4fc336,_0x30d53f){return function(_0x217f4c){if(_0x217f4c){var _0x5d03a1=typeof _0x30d53f[_0x67b7('0x1a')]===_0x67b7('0x1b')&&typeof _0x30d53f[_0x67b7('0x1c')]===_0x67b7('0x1b');var _0x1ba101=_0x217f4c[_0x67b7('0x1d')];var _0x551d55=_0x5d03a1?0x0:_0x30d53f[_0x67b7('0x1a')];var _0x64f0f7=_0x5d03a1?_0x217f4c[_0x67b7('0x1d')]:_0x30d53f[_0x67b7('0x1a')]+_0x30d53f[_0x67b7('0x1c')];var _0x33f9bb;if(_0x64f0f7>=_0x1ba101){_0x64f0f7=_0x1ba101;_0x33f9bb=0xc8;}else{_0x33f9bb=0xce;}_0x4fc336[_0x67b7('0x17')](_0x33f9bb);return _0x4fc336['set'](_0x67b7('0x1e'),_0x551d55+'-'+_0x64f0f7+'/'+_0x1ba101)[_0x67b7('0x19')](_0x217f4c);}return null;};}function patchUpdates(_0x3c8e68){return function(_0x35d794){try{jsonpatch[_0x67b7('0x1f')](_0x35d794,_0x3c8e68,!![]);}catch(_0x637645){return BPromise['reject'](_0x637645);}return _0x35d794['save']();};}function saveUpdates(_0x5e5ba3,_0x184c94){return function(_0x4dfc99){if(_0x4dfc99){return _0x4dfc99[_0x67b7('0x20')](_0x5e5ba3)['then'](function(_0x4eeabf){return _0x4eeabf;});}return null;};}function removeEntity(_0x25c9e0,_0x38cc38){return function(_0x4679fd){if(_0x4679fd){return _0x4679fd[_0x67b7('0x21')]()[_0x67b7('0x22')](function(){var _0x12050a=_0x4679fd['get']({'plain':!![]});var _0x5d9019=_0x67b7('0x23');return db[_0x67b7('0x24')][_0x67b7('0x21')]({'where':{'type':_0x5d9019,'resourceId':_0x12050a['id']}})[_0x67b7('0x22')](function(){return _0x4679fd;});})[_0x67b7('0x22')](function(){_0x25c9e0[_0x67b7('0x17')](0xcc)[_0x67b7('0x18')]();});}};}function handleEntityNotFound(_0x3880bb,_0x27e176){return function(_0x393f46){if(!_0x393f46){_0x3880bb[_0x67b7('0x16')](0x194);}return _0x393f46;};}function handleError(_0x268c43,_0x14bfc7){_0x14bfc7=_0x14bfc7||0x1f4;return function(_0x3ae24c){logger[_0x67b7('0x25')](_0x3ae24c['stack']);if(_0x3ae24c[_0x67b7('0x26')]){delete _0x3ae24c[_0x67b7('0x26')];}_0x268c43[_0x67b7('0x17')](_0x14bfc7)[_0x67b7('0x27')](_0x3ae24c);};}exports['index']=function(_0x39f458,_0x1928b3){var _0xac7846={},_0x347d19={},_0xda5a88={'count':0x0,'rows':[]};var _0x4791b2=_[_0x67b7('0x28')](db['CmHopperAdditionalPhone'][_0x67b7('0x29')],function(_0x256e4b){return{'name':_0x256e4b[_0x67b7('0x2a')],'type':_0x256e4b[_0x67b7('0x2b')][_0x67b7('0x2c')]};});_0x347d19[_0x67b7('0x2d')]=_[_0x67b7('0x28')](_0x4791b2,'name');_0x347d19['query']=_[_0x67b7('0x2e')](_0x39f458[_0x67b7('0x2f')]);_0x347d19['filters']=_['intersection'](_0x347d19[_0x67b7('0x2d')],_0x347d19[_0x67b7('0x2f')]);_0xac7846[_0x67b7('0x30')]=_[_0x67b7('0x31')](_0x347d19[_0x67b7('0x2d')],qs[_0x67b7('0x32')](_0x39f458[_0x67b7('0x2f')]['fields']));_0xac7846[_0x67b7('0x30')]=_0xac7846[_0x67b7('0x30')]['length']?_0xac7846['attributes']:_0x347d19[_0x67b7('0x2d')];if(!_0x39f458[_0x67b7('0x2f')]['hasOwnProperty'](_0x67b7('0x33'))){_0xac7846[_0x67b7('0x1c')]=qs[_0x67b7('0x1c')](_0x39f458[_0x67b7('0x2f')]['limit']);_0xac7846[_0x67b7('0x1a')]=qs[_0x67b7('0x1a')](_0x39f458['query'][_0x67b7('0x1a')]);}_0xac7846[_0x67b7('0x34')]=qs[_0x67b7('0x35')](_0x39f458[_0x67b7('0x2f')][_0x67b7('0x35')]);_0xac7846[_0x67b7('0x36')]=qs['filters'](_['pick'](_0x39f458[_0x67b7('0x2f')],_0x347d19[_0x67b7('0x37')]),_0x4791b2);if(_0x39f458[_0x67b7('0x2f')]['filter']){_0xac7846[_0x67b7('0x36')]=_[_0x67b7('0x38')](_0xac7846['where'],{'$or':_[_0x67b7('0x28')](_0x4791b2,function(_0x233dda){if(_0x233dda['type']!==_0x67b7('0x39')){var _0x2aab9b={};_0x2aab9b[_0x233dda[_0x67b7('0x26')]]={'$like':'%'+_0x39f458[_0x67b7('0x2f')][_0x67b7('0x3a')]+'%'};return _0x2aab9b;}})});}_0xac7846=_[_0x67b7('0x38')]({},_0xac7846,_0x39f458[_0x67b7('0x3b')]);var _0xef4b2b={'where':_0xac7846[_0x67b7('0x36')]};return db[_0x67b7('0x3c')]['count'](_0xef4b2b)[_0x67b7('0x22')](function(_0x13f3f0){_0xda5a88['count']=_0x13f3f0;if(_0x39f458['query']['includeAll']){_0xac7846[_0x67b7('0x3d')]=[{'all':!![]}];}return db['CmHopperAdditionalPhone'][_0x67b7('0x3e')](_0xac7846);})[_0x67b7('0x22')](function(_0x5e423a){_0xda5a88['rows']=_0x5e423a;return _0xda5a88;})[_0x67b7('0x22')](respondWithFilteredResult(_0x1928b3,_0xac7846))['catch'](handleError(_0x1928b3,null));};exports[_0x67b7('0x3f')]=function(_0x9cd97f,_0x207222){var _0x246167={'raw':!![],'where':{'id':_0x9cd97f[_0x67b7('0x40')]['id']}},_0x584432={};_0x584432[_0x67b7('0x2d')]=_[_0x67b7('0x2e')](db[_0x67b7('0x3c')][_0x67b7('0x29')]);_0x584432['query']=_[_0x67b7('0x2e')](_0x9cd97f['query']);_0x584432[_0x67b7('0x37')]=_[_0x67b7('0x31')](_0x584432[_0x67b7('0x2d')],_0x584432[_0x67b7('0x2f')]);_0x246167['attributes']=_[_0x67b7('0x31')](_0x584432['model'],qs['fields'](_0x9cd97f['query'][_0x67b7('0x32')]));_0x246167[_0x67b7('0x30')]=_0x246167[_0x67b7('0x30')]['length']?_0x246167[_0x67b7('0x30')]:_0x584432['model'];if(_0x9cd97f[_0x67b7('0x2f')][_0x67b7('0x41')]){_0x246167[_0x67b7('0x3d')]=[{'all':!![]}];}_0x246167=_['merge']({},_0x246167,_0x9cd97f[_0x67b7('0x3b')]);return db[_0x67b7('0x3c')][_0x67b7('0x42')](_0x246167)[_0x67b7('0x22')](handleEntityNotFound(_0x207222,null))[_0x67b7('0x22')](respondWithResult(_0x207222,null))['catch'](handleError(_0x207222,null));};exports['create']=function(_0x30650a,_0x16f7e5){return db[_0x67b7('0x3c')]['create'](_0x30650a['body'],{})['then'](function(_0x2c2439){var _0x105761=_0x30650a[_0x67b7('0x43')][_0x67b7('0x44')]({'plain':!![]});if(!_0x105761)throw new Error(_0x67b7('0x45'));if(_0x105761[_0x67b7('0x46')]===_0x67b7('0x43')){var _0x458356=_0x2c2439[_0x67b7('0x44')]({'plain':!![]});var _0x3b2321=_0x67b7('0x23');return db[_0x67b7('0x47')]['find']({'where':{'name':_0x3b2321,'userProfileId':_0x105761[_0x67b7('0x48')]},'raw':!![]})[_0x67b7('0x22')](function(_0x853d49){if(_0x853d49&&_0x853d49['autoAssociation']===0x0){return db[_0x67b7('0x24')][_0x67b7('0x49')]({'name':_0x458356[_0x67b7('0x26')],'resourceId':_0x458356['id'],'type':_0x853d49[_0x67b7('0x26')],'sectionId':_0x853d49['id']},{})['then'](function(){return _0x2c2439;});}else{return _0x2c2439;}})[_0x67b7('0x4a')](function(_0x1b76cf){logger[_0x67b7('0x25')](_0x67b7('0x4b'),_0x1b76cf);throw _0x1b76cf;});}return _0x2c2439;})[_0x67b7('0x22')](respondWithResult(_0x16f7e5,0xc9))[_0x67b7('0x4a')](handleError(_0x16f7e5,null));};exports['update']=function(_0x5af0a6,_0x4db86c){if(_0x5af0a6['body']['id']){delete _0x5af0a6[_0x67b7('0x4c')]['id'];}return db['CmHopperAdditionalPhone'][_0x67b7('0x42')]({'where':{'id':_0x5af0a6[_0x67b7('0x40')]['id']}})[_0x67b7('0x22')](handleEntityNotFound(_0x4db86c,null))[_0x67b7('0x22')](saveUpdates(_0x5af0a6[_0x67b7('0x4c')],null))['then'](respondWithResult(_0x4db86c,null))[_0x67b7('0x4a')](handleError(_0x4db86c,null));};exports['destroy']=function(_0x2b43e5,_0x447f79){return db[_0x67b7('0x3c')][_0x67b7('0x42')]({'where':{'id':_0x2b43e5[_0x67b7('0x40')]['id']}})[_0x67b7('0x22')](handleEntityNotFound(_0x447f79,null))[_0x67b7('0x22')](removeEntity(_0x447f79,null))[_0x67b7('0x4a')](handleError(_0x447f79,null));}; \ No newline at end of file +var _0x1084=['sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','get','CmHopperAdditionalPhones','UserProfileResource','error','stack','name','send','index','map','CmHopperAdditionalPhone','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','keys','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path'];(function(_0xd83404,_0x3c925d){var _0x3f76b7=function(_0x205a10){while(--_0x205a10){_0xd83404['push'](_0xd83404['shift']());}};_0x3f76b7(++_0x3c925d);}(_0x1084,0x151));var _0x4108=function(_0xae3bf6,_0x362633){_0xae3bf6=_0xae3bf6-0x0;var _0x247f11=_0x1084[_0xae3bf6];return _0x247f11;};'use strict';var emlformat=require(_0x4108('0x0'));var rimraf=require(_0x4108('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4108('0x2'));var rp=require(_0x4108('0x3'));var moment=require('moment');var BPromise=require(_0x4108('0x4'));var Mustache=require(_0x4108('0x5'));var util=require('util');var path=require(_0x4108('0x6'));var sox=require(_0x4108('0x7'));var csv=require(_0x4108('0x8'));var ejs=require(_0x4108('0x9'));var fs=require('fs');var fs_extra=require(_0x4108('0xa'));var _=require(_0x4108('0xb'));var squel=require('squel');var crypto=require(_0x4108('0xc'));var jsforce=require(_0x4108('0xd'));var deskjs=require(_0x4108('0xe'));var toCsv=require('to-csv');var querystring=require(_0x4108('0xf'));var Papa=require(_0x4108('0x10'));var Redis=require(_0x4108('0x11'));var authService=require(_0x4108('0x12'));var qs=require(_0x4108('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4108('0x14'));var logger=require(_0x4108('0x15'))(_0x4108('0x16'));var utils=require(_0x4108('0x17'));var config=require(_0x4108('0x18'));var licenseUtil=require(_0x4108('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3d7ce9,_0x3e2d7c){_0x3e2d7c=_0x3e2d7c||0xcc;return function(_0x2fa6c4){if(_0x2fa6c4){return _0x3d7ce9[_0x4108('0x1a')](_0x3e2d7c);}return _0x3d7ce9[_0x4108('0x1b')](_0x3e2d7c)[_0x4108('0x1c')]();};}function respondWithResult(_0x6feb7b,_0x291d4f){_0x291d4f=_0x291d4f||0xc8;return function(_0x1ef9d6){if(_0x1ef9d6){return _0x6feb7b['status'](_0x291d4f)['json'](_0x1ef9d6);}};}function respondWithFilteredResult(_0xde5430,_0x3944be){return function(_0x46af45){if(_0x46af45){var _0x473b73=typeof _0x3944be[_0x4108('0x1d')]==='undefined'&&typeof _0x3944be[_0x4108('0x1e')]===_0x4108('0x1f');var _0x4c6005=_0x46af45[_0x4108('0x20')];var _0x1dd0f1=_0x473b73?0x0:_0x3944be[_0x4108('0x1d')];var _0x5bbc53=_0x473b73?_0x46af45[_0x4108('0x20')]:_0x3944be['offset']+_0x3944be[_0x4108('0x1e')];var _0x2a850b;if(_0x5bbc53>=_0x4c6005){_0x5bbc53=_0x4c6005;_0x2a850b=0xc8;}else{_0x2a850b=0xce;}_0xde5430[_0x4108('0x1b')](_0x2a850b);return _0xde5430[_0x4108('0x21')](_0x4108('0x22'),_0x1dd0f1+'-'+_0x5bbc53+'/'+_0x4c6005)['json'](_0x46af45);}return null;};}function patchUpdates(_0x53c3cc){return function(_0x7961b1){try{jsonpatch[_0x4108('0x23')](_0x7961b1,_0x53c3cc,!![]);}catch(_0x27fc63){return BPromise[_0x4108('0x24')](_0x27fc63);}return _0x7961b1[_0x4108('0x25')]();};}function saveUpdates(_0xdd42d6,_0x4e0bac){return function(_0x532882){if(_0x532882){return _0x532882['update'](_0xdd42d6)[_0x4108('0x26')](function(_0x247e70){return _0x247e70;});}return null;};}function removeEntity(_0x180530,_0x39e6f1){return function(_0x17d49f){if(_0x17d49f){return _0x17d49f[_0x4108('0x27')]()[_0x4108('0x26')](function(){var _0x2a549c=_0x17d49f[_0x4108('0x28')]({'plain':!![]});var _0x199bc2=_0x4108('0x29');return db[_0x4108('0x2a')][_0x4108('0x27')]({'where':{'type':_0x199bc2,'resourceId':_0x2a549c['id']}})[_0x4108('0x26')](function(){return _0x17d49f;});})['then'](function(){_0x180530[_0x4108('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4dc092,_0x1fd600){return function(_0x232265){if(!_0x232265){_0x4dc092[_0x4108('0x1a')](0x194);}return _0x232265;};}function handleError(_0x518aa7,_0x3e684d){_0x3e684d=_0x3e684d||0x1f4;return function(_0x26d1e5){logger[_0x4108('0x2b')](_0x26d1e5[_0x4108('0x2c')]);if(_0x26d1e5[_0x4108('0x2d')]){delete _0x26d1e5[_0x4108('0x2d')];}_0x518aa7[_0x4108('0x1b')](_0x3e684d)[_0x4108('0x2e')](_0x26d1e5);};}exports[_0x4108('0x2f')]=function(_0x39f0bb,_0x1f3af2){var _0x5d742d={},_0x32df17={},_0x3d9986={'count':0x0,'rows':[]};var _0x314c0a=_[_0x4108('0x30')](db[_0x4108('0x31')][_0x4108('0x32')],function(_0x53339f){return{'name':_0x53339f[_0x4108('0x33')],'type':_0x53339f[_0x4108('0x34')][_0x4108('0x35')]};});_0x32df17[_0x4108('0x36')]=_['map'](_0x314c0a,_0x4108('0x2d'));_0x32df17['query']=_['keys'](_0x39f0bb[_0x4108('0x37')]);_0x32df17[_0x4108('0x38')]=_['intersection'](_0x32df17[_0x4108('0x36')],_0x32df17[_0x4108('0x37')]);_0x5d742d[_0x4108('0x39')]=_[_0x4108('0x3a')](_0x32df17[_0x4108('0x36')],qs[_0x4108('0x3b')](_0x39f0bb[_0x4108('0x37')][_0x4108('0x3b')]));_0x5d742d[_0x4108('0x39')]=_0x5d742d[_0x4108('0x39')][_0x4108('0x3c')]?_0x5d742d[_0x4108('0x39')]:_0x32df17[_0x4108('0x36')];if(!_0x39f0bb['query']['hasOwnProperty'](_0x4108('0x3d'))){_0x5d742d[_0x4108('0x1e')]=qs[_0x4108('0x1e')](_0x39f0bb[_0x4108('0x37')][_0x4108('0x1e')]);_0x5d742d['offset']=qs['offset'](_0x39f0bb[_0x4108('0x37')][_0x4108('0x1d')]);}_0x5d742d['order']=qs[_0x4108('0x3e')](_0x39f0bb['query'][_0x4108('0x3e')]);_0x5d742d[_0x4108('0x3f')]=qs['filters'](_[_0x4108('0x40')](_0x39f0bb[_0x4108('0x37')],_0x32df17[_0x4108('0x38')]),_0x314c0a);if(_0x39f0bb[_0x4108('0x37')][_0x4108('0x41')]){_0x5d742d[_0x4108('0x3f')]=_['merge'](_0x5d742d[_0x4108('0x3f')],{'$or':_[_0x4108('0x30')](_0x314c0a,function(_0x42951b){if(_0x42951b[_0x4108('0x34')]!==_0x4108('0x42')){var _0xa1f324={};_0xa1f324[_0x42951b[_0x4108('0x2d')]]={'$like':'%'+_0x39f0bb[_0x4108('0x37')][_0x4108('0x41')]+'%'};return _0xa1f324;}})});}_0x5d742d=_[_0x4108('0x43')]({},_0x5d742d,_0x39f0bb[_0x4108('0x44')]);var _0x36c1a1={'where':_0x5d742d[_0x4108('0x3f')]};return db['CmHopperAdditionalPhone'][_0x4108('0x20')](_0x36c1a1)[_0x4108('0x26')](function(_0x11577c){_0x3d9986[_0x4108('0x20')]=_0x11577c;if(_0x39f0bb[_0x4108('0x37')][_0x4108('0x45')]){_0x5d742d[_0x4108('0x46')]=[{'all':!![]}];}return db[_0x4108('0x31')][_0x4108('0x47')](_0x5d742d);})[_0x4108('0x26')](function(_0xba7940){_0x3d9986['rows']=_0xba7940;return _0x3d9986;})[_0x4108('0x26')](respondWithFilteredResult(_0x1f3af2,_0x5d742d))[_0x4108('0x48')](handleError(_0x1f3af2,null));};exports[_0x4108('0x49')]=function(_0x143b80,_0x3406cc){var _0x1ba9be={'raw':!![],'where':{'id':_0x143b80[_0x4108('0x4a')]['id']}},_0xe341dc={};_0xe341dc[_0x4108('0x36')]=_[_0x4108('0x4b')](db[_0x4108('0x31')][_0x4108('0x32')]);_0xe341dc['query']=_['keys'](_0x143b80[_0x4108('0x37')]);_0xe341dc[_0x4108('0x38')]=_[_0x4108('0x3a')](_0xe341dc[_0x4108('0x36')],_0xe341dc[_0x4108('0x37')]);_0x1ba9be['attributes']=_['intersection'](_0xe341dc[_0x4108('0x36')],qs['fields'](_0x143b80['query'][_0x4108('0x3b')]));_0x1ba9be[_0x4108('0x39')]=_0x1ba9be[_0x4108('0x39')][_0x4108('0x3c')]?_0x1ba9be['attributes']:_0xe341dc[_0x4108('0x36')];if(_0x143b80['query'][_0x4108('0x45')]){_0x1ba9be[_0x4108('0x46')]=[{'all':!![]}];}_0x1ba9be=_[_0x4108('0x43')]({},_0x1ba9be,_0x143b80[_0x4108('0x44')]);return db['CmHopperAdditionalPhone'][_0x4108('0x4c')](_0x1ba9be)[_0x4108('0x26')](handleEntityNotFound(_0x3406cc,null))['then'](respondWithResult(_0x3406cc,null))['catch'](handleError(_0x3406cc,null));};exports['create']=function(_0x52428d,_0x11b91d){return db[_0x4108('0x31')][_0x4108('0x4d')](_0x52428d[_0x4108('0x4e')],{})['then'](function(_0x509480){var _0x243b90=_0x52428d[_0x4108('0x4f')][_0x4108('0x28')]({'plain':!![]});if(!_0x243b90)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x243b90[_0x4108('0x50')]===_0x4108('0x4f')){var _0x2adc47=_0x509480[_0x4108('0x28')]({'plain':!![]});var _0x5445e8='CmHopperAdditionalPhones';return db[_0x4108('0x51')][_0x4108('0x4c')]({'where':{'name':_0x5445e8,'userProfileId':_0x243b90[_0x4108('0x52')]},'raw':!![]})[_0x4108('0x26')](function(_0x2b983a){if(_0x2b983a&&_0x2b983a[_0x4108('0x53')]===0x0){return db[_0x4108('0x2a')][_0x4108('0x4d')]({'name':_0x2adc47['name'],'resourceId':_0x2adc47['id'],'type':_0x2b983a[_0x4108('0x2d')],'sectionId':_0x2b983a['id']},{})[_0x4108('0x26')](function(){return _0x509480;});}else{return _0x509480;}})[_0x4108('0x48')](function(_0x33326d){logger['error'](_0x4108('0x54'),_0x33326d);throw _0x33326d;});}return _0x509480;})['then'](respondWithResult(_0x11b91d,0xc9))['catch'](handleError(_0x11b91d,null));};exports[_0x4108('0x55')]=function(_0x5450cd,_0x1902bb){if(_0x5450cd[_0x4108('0x4e')]['id']){delete _0x5450cd[_0x4108('0x4e')]['id'];}return db[_0x4108('0x31')]['find']({'where':{'id':_0x5450cd[_0x4108('0x4a')]['id']}})[_0x4108('0x26')](handleEntityNotFound(_0x1902bb,null))[_0x4108('0x26')](saveUpdates(_0x5450cd[_0x4108('0x4e')],null))[_0x4108('0x26')](respondWithResult(_0x1902bb,null))[_0x4108('0x48')](handleError(_0x1902bb,null));};exports['destroy']=function(_0x28cf85,_0x2ce23e){return db[_0x4108('0x31')][_0x4108('0x4c')]({'where':{'id':_0x28cf85[_0x4108('0x4a')]['id']}})[_0x4108('0x26')](handleEntityNotFound(_0x2ce23e,null))[_0x4108('0x26')](removeEntity(_0x2ce23e,null))['catch'](handleError(_0x2ce23e,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index 062430b..4235f8f 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 _0xa6a9=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','exports','define','cm_hopper_additional_phones'];(function(_0x1bd5e2,_0x1c1c16){var _0x18bf66=function(_0x7f3bc8){while(--_0x7f3bc8){_0x1bd5e2['push'](_0x1bd5e2['shift']());}};_0x18bf66(++_0x1c1c16);}(_0xa6a9,0x6e));var _0x9a6a=function(_0x19d7bf,_0x265436){_0x19d7bf=_0x19d7bf-0x0;var _0x46494c=_0xa6a9[_0x19d7bf];return _0x46494c;};'use strict';var _=require(_0x9a6a('0x0'));var util=require(_0x9a6a('0x1'));var logger=require(_0x9a6a('0x2'))('api');var moment=require(_0x9a6a('0x3'));var BPromise=require(_0x9a6a('0x4'));var rp=require(_0x9a6a('0x5'));var fs=require('fs');var path=require(_0x9a6a('0x6'));var rimraf=require('rimraf');var config=require(_0x9a6a('0x7'));var attributes=require('./cmHopperAdditionalPhone.attributes');module[_0x9a6a('0x8')]=function(_0x439bc9,_0x1f3c8b){return _0x439bc9[_0x9a6a('0x9')]('CmHopperAdditionalPhone',attributes,{'tableName':_0x9a6a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfb6e=['api','bluebird','request-promise','path','../../config/environment','./cmHopperAdditionalPhone.attributes','exports','define','CmHopperAdditionalPhone','util','../../config/logger'];(function(_0x2158cf,_0x47d13b){var _0x29af91=function(_0x405260){while(--_0x405260){_0x2158cf['push'](_0x2158cf['shift']());}};_0x29af91(++_0x47d13b);}(_0xfb6e,0x1a0));var _0xefb6=function(_0x6a3163,_0x130abe){_0x6a3163=_0x6a3163-0x0;var _0x1826f1=_0xfb6e[_0x6a3163];return _0x1826f1;};'use strict';var _=require('lodash');var util=require(_0xefb6('0x0'));var logger=require(_0xefb6('0x1'))(_0xefb6('0x2'));var moment=require('moment');var BPromise=require(_0xefb6('0x3'));var rp=require(_0xefb6('0x4'));var fs=require('fs');var path=require(_0xefb6('0x5'));var rimraf=require('rimraf');var config=require(_0xefb6('0x6'));var attributes=require(_0xefb6('0x7'));module[_0xefb6('0x8')]=function(_0x441bf4,_0x398bc9){return _0x441bf4[_0xefb6('0x9')](_0xefb6('0xa'),attributes,{'tableName':'cm_hopper_additional_phones','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 3bb8e70..fbfcff2 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 _0x7560=['request','then','info','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopperAdditionalPhone,\x20%s,\x20%s','message','result','VerifyAdditionalPhones','CmHopper','findOne','body','ListId','CampaignId','CmHopperAdditionalPhone','OrderBy','ASC','countbusyretry','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','entity','dialGlobalMaxRetry','countnoanswerretry','countagentrejectretry','catch','SwapAdditionalPhones','ContactId','VoiceQueueId','duration','waitTime','isNil','scheduledat','add','minutes','createdAt','updatedAt','transaction','update','phone','activateAdditionalPhone','IncrementPreviewCounters','field','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0x7560,0x6e));var _0x0756=function(_0x11e9e6,_0x40b63c){_0x11e9e6=_0x11e9e6-0x0;var _0x5ebe60=_0x7560[_0x11e9e6];return _0x5ebe60;};'use strict';var _=require(_0x0756('0x0'));var util=require(_0x0756('0x1'));var moment=require(_0x0756('0x2'));var BPromise=require(_0x0756('0x3'));var rs=require(_0x0756('0x4'));var fs=require('fs');var Redis=require(_0x0756('0x5'));var db=require(_0x0756('0x6'))['db'];var utils=require(_0x0756('0x7'));var logger=require(_0x0756('0x8'))(_0x0756('0x9'));var config=require('../../config/environment');var jayson=require(_0x0756('0xa'));var client=jayson['client'][_0x0756('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x521098,_0x3d499e,_0x5607fb){return new BPromise(function(_0x4b5a91,_0x372483){return client[_0x0756('0xc')](_0x521098,_0x5607fb)[_0x0756('0xd')](function(_0x248258){logger[_0x0756('0xe')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x3d499e,_0x0756('0xf'));logger[_0x0756('0x10')](_0x0756('0x11'),_0x3d499e,_0x0756('0xf'),JSON[_0x0756('0x12')](_0x248258));if(_0x248258[_0x0756('0x13')]){if(_0x248258[_0x0756('0x13')][_0x0756('0x14')]===0x1f4){logger[_0x0756('0x13')](_0x0756('0x15'),_0x3d499e,_0x248258[_0x0756('0x13')][_0x0756('0x16')]);return _0x372483(_0x248258[_0x0756('0x13')][_0x0756('0x16')]);}logger[_0x0756('0x13')](_0x0756('0x15'),_0x3d499e,_0x248258['error'][_0x0756('0x16')]);return _0x4b5a91(_0x248258[_0x0756('0x13')]['message']);}else{logger[_0x0756('0xe')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x3d499e,_0x0756('0xf'));_0x4b5a91(_0x248258[_0x0756('0x17')]['message']);}})['catch'](function(_0x5d0c54){logger[_0x0756('0x13')](_0x0756('0x15'),_0x3d499e,_0x5d0c54);_0x372483(_0x5d0c54);});});}exports[_0x0756('0x18')]=function(_0x2681cf){var _0x3d5d0d=this;return new Promise(function(_0x1420b4,_0x1be0a2){return db[_0x0756('0x19')][_0x0756('0x1a')]({'raw':!![],'where':{'ContactId':_0x2681cf[_0x0756('0x1b')]['ContactId'],'ListId':_0x2681cf[_0x0756('0x1b')][_0x0756('0x1c')],'VoiceQueueId':_0x2681cf[_0x0756('0x1b')]['VoiceQueueId']===undefined?null:_0x2681cf[_0x0756('0x1b')]['VoiceQueueId'],'CampaignId':_0x2681cf[_0x0756('0x1b')][_0x0756('0x1d')]===undefined?null:_0x2681cf[_0x0756('0x1b')]['CampaignId']}})[_0x0756('0xd')](function(_0x106bf7){if(_0x106bf7!=null){return db[_0x0756('0x1e')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x106bf7['id'],'OrderBy':{'$gt':_0x106bf7[_0x0756('0x1f')]}},'order':[[_0x0756('0x1f'),_0x0756('0x20')]]})['then'](function(_0x19ddb6){var _0x51a367=0x0;if(_0x19ddb6){if(_0x19ddb6[_0x0756('0x21')]+_0x19ddb6[_0x0756('0x22')]+_0x19ddb6['countnoanswerretry']+_0x19ddb6[_0x0756('0x23')]+_0x19ddb6[_0x0756('0x24')]+_0x19ddb6[_0x0756('0x25')]+_0x19ddb6[_0x0756('0x26')]+_0x19ddb6['countagentrejectretry']<_0x2681cf[_0x0756('0x27')][_0x0756('0x28')])_0x51a367=0x1;_0x1420b4({'additional':_0x51a367});}else{return db[_0x0756('0x1e')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x106bf7['id']},'order':[[_0x0756('0x1f'),'ASC']]})[_0x0756('0xd')](function(_0x2f1268){var _0x33cbcd=0x0;if(_0x2f1268){if(_0x2f1268['countbusyretry']+_0x2f1268[_0x0756('0x22')]+_0x2f1268[_0x0756('0x29')]+_0x2f1268['countnosuchnumberretry']+_0x2f1268['countdropretry']+_0x2f1268[_0x0756('0x25')]+_0x2f1268[_0x0756('0x26')]+_0x2f1268[_0x0756('0x2a')]<_0x2681cf[_0x0756('0x27')][_0x0756('0x28')])_0x33cbcd=0x1;_0x1420b4({'additional':_0x33cbcd});}else{_0x1420b4({'additional':0x0});}})[_0x0756('0x2b')](function(_0x38e2d2){logger['error'](_0x0756('0x18'),_0x38e2d2['message']);_0x1be0a2(_0x3d5d0d[_0x0756('0x13')](0x1f4,_0x38e2d2[_0x0756('0x16')]));});}})['catch'](function(_0x3edf95){logger[_0x0756('0x13')](_0x0756('0x18'),_0x3edf95[_0x0756('0x16')]);_0x1be0a2(_0x3d5d0d[_0x0756('0x13')](0x1f4,_0x3edf95['message']));});}else _0x1420b4({'additional':0x0});});});};exports[_0x0756('0x2c')]=function(_0x584500){var _0x15f32c=this;return new Promise(function(_0x2f4992,_0x33ee46){return db[_0x0756('0x19')][_0x0756('0x1a')]({'raw':!![],'where':{'ContactId':_0x584500[_0x0756('0x1b')][_0x0756('0x2d')],'ListId':_0x584500[_0x0756('0x1b')][_0x0756('0x1c')],'VoiceQueueId':_0x584500[_0x0756('0x1b')][_0x0756('0x2e')]===undefined?null:_0x584500[_0x0756('0x1b')][_0x0756('0x2e')],'CampaignId':_0x584500[_0x0756('0x1b')][_0x0756('0x1d')]===undefined?null:_0x584500[_0x0756('0x1b')]['CampaignId']}})['then'](function(_0x46c5f7){if(_0x46c5f7!=null){return db[_0x0756('0x1e')][_0x0756('0x1a')]({'raw':!![],'where':{'CmHopperId':_0x46c5f7['id'],'OrderBy':{'$gte':_0x46c5f7[_0x0756('0x1f')]}},'order':[[_0x0756('0x1f'),_0x0756('0x20')]]})[_0x0756('0xd')](function(_0x42cef1){if(_0x42cef1)return activateAdditionalPhone(_0x46c5f7,_0x584500['body'],_0x42cef1,_0x584500[_0x0756('0x2f')],_0x584500['waitTime'])[_0x0756('0xd')](function(_0x5a6705){_0x2f4992(_0x5a6705);});else{return db[_0x0756('0x1e')][_0x0756('0x1a')]({'raw':!![],'where':{'CmHopperId':_0x46c5f7['id']},'order':[[_0x0756('0x1f'),_0x0756('0x20')]]})['then'](function(_0x188470){if(_0x188470)return activateAdditionalPhone(_0x46c5f7,_0x584500['body'],_0x188470,_0x584500[_0x0756('0x2f')],_0x584500[_0x0756('0x30')])[_0x0756('0xd')](function(_0x307f9d){_0x2f4992(_0x307f9d);});else{_0x2f4992({'id':_0x46c5f7['id'],'phone':''});}})[_0x0756('0x2b')](function(_0x4784f1){logger[_0x0756('0x13')]('VerifyAdditionalPhones',_0x4784f1['message']);_0x33ee46(_0x15f32c[_0x0756('0x13')](0x1f4,_0x4784f1[_0x0756('0x16')]));});}})[_0x0756('0x2b')](function(_0xf0db7){logger['error']('VerifyAdditionalPhones',_0xf0db7['message']);_0x33ee46(_0x15f32c[_0x0756('0x13')](0x1f4,_0xf0db7[_0x0756('0x16')]));});}else _0x2f4992(0x1);});});};function activateAdditionalPhone(_0x5622e1,_0x5ae081,_0x3fcd84,_0x1bcf38,_0x5d87ce){return new Promise(function(_0x5cdf93,_0x148c12){var _0x5600f8;if(_[_0x0756('0x31')](_0x3fcd84[_0x0756('0x32')])){_0x3fcd84['scheduledat']=moment();}if(moment()>moment(_0x3fcd84[_0x0756('0x32')])){_0x5600f8=moment()[_0x0756('0x33')](_0x5d87ce||0x3,_0x0756('0x34'));}else{if(_0x3fcd84[_0x0756('0x1f')]==0x0){_0x5600f8=moment(_0x3fcd84[_0x0756('0x32')]);}else{_0x5600f8=moment()[_0x0756('0x33')](_0x5d87ce||0x3,_0x0756('0x34'));}}if(_[_0x0756('0x31')](_0x5600f8)){_0x5600f8=moment()[_0x0756('0x33')](_0x5d87ce||0x3,_0x0756('0x34'));}var _0xaeaee0={'phone':_0x5622e1['phone'],'active':0x0,'OrderBy':_[_0x0756('0x31')](_0x5622e1['OrderBy'])?0x0:_0x5622e1[_0x0756('0x1f')],'scheduledat':moment()[_0x0756('0x33')](_0x1bcf38||0x1,'minutes'),'countbusyretry':_0x5ae081[_0x0756('0x21')],'countcongestionretry':_0x5ae081['countcongestionretry'],'countnoanswerretry':_0x5ae081['countnoanswerretry'],'countnosuchnumberretry':_0x5ae081[_0x0756('0x23')],'countdropretry':_0x5ae081[_0x0756('0x24')],'countabandonedretry':_0x5ae081[_0x0756('0x25')],'countmachineretry':_0x5ae081[_0x0756('0x26')],'countagentrejectretry':_0x5ae081['countagentrejectretry'],'createdAt':_0x5ae081[_0x0756('0x35')],'updatedAt':_0x5ae081[_0x0756('0x36')]};var _0x122585={'CmHopperId':_0x5622e1['id'],'phone':_0x3fcd84['phone'],'active':0x0,'OrderBy':_[_0x0756('0x31')](_0x3fcd84[_0x0756('0x1f')])?0x0:_0x3fcd84[_0x0756('0x1f')],'scheduledat':_0x5600f8,'countbusyretry':_0x3fcd84[_0x0756('0x21')],'countcongestionretry':_0x3fcd84[_0x0756('0x22')],'countnoanswerretry':_0x3fcd84[_0x0756('0x29')],'countnosuchnumberretry':_0x3fcd84[_0x0756('0x23')],'countdropretry':_0x3fcd84[_0x0756('0x24')],'countabandonedretry':_0x3fcd84[_0x0756('0x25')],'countmachineretry':_0x3fcd84[_0x0756('0x26')],'countagentrejectretry':_0x3fcd84[_0x0756('0x2a')],'createdAt':_0x3fcd84[_0x0756('0x35')],'updatedAt':_0x3fcd84[_0x0756('0x36')]};return db['sequelize'][_0x0756('0x37')](function(_0x4a4d85){return db['CmHopperAdditionalPhone'][_0x0756('0x38')](_0xaeaee0,{'where':{'id':_0x3fcd84['id']}},{'transaction':_0x4a4d85})['then'](function(){return db[_0x0756('0x19')][_0x0756('0x38')](_0x122585,{'where':{'id':_0x5622e1['id']}},{'transaction':_0x4a4d85});});})[_0x0756('0xd')](function(_0x9987a5){_0x5cdf93({'id':_0x5622e1['id'],'phone':_0x3fcd84[_0x0756('0x39')]});})['catch'](function(_0x4bc507){logger[_0x0756('0x13')](_0x0756('0x3a'),_0x4bc507['message']);_0x148c12({'error':_0x4bc507['message']});});});}exports[_0x0756('0x3b')]=function(_0x2dcab5){var _0xc8767c=this;return new Promise(function(_0x5df495,_0x49d767){return db[_0x0756('0x19')][_0x0756('0x38')](_0x2dcab5['body'][_0x0756('0x3c')],{'where':{'id':_0x2dcab5[_0x0756('0x1b')]['id']}})['then'](function(_0x2abf79){_0x5df495(_0x2abf79);})[_0x0756('0x2b')](function(_0x2dfcba){logger[_0x0756('0x13')](_0x0756('0x3b'),_0x2dfcba[_0x0756('0x16')]);_0x49d767(_0xc8767c[_0x0756('0x13')](0x1f4,_0x2dfcba['message']));});});}; \ No newline at end of file +var _0x3e87=['updatedAt','countmachineretry','sequelize','transaction','update','activateAdditionalPhone','IncrementPreviewCounters','field','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','VerifyAdditionalPhones','CmHopper','body','ContactId','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','ASC','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','dialGlobalMaxRetry','countbusyretry','countagentrejectretry','SwapAdditionalPhones','duration','waitTime','findOne','isNil','scheduledat','add','minutes','phone','createdAt'];(function(_0x519379,_0x4596d2){var _0x1a0145=function(_0x1eaed4){while(--_0x1eaed4){_0x519379['push'](_0x519379['shift']());}};_0x1a0145(++_0x4596d2);}(_0x3e87,0xbc));var _0x73e8=function(_0x10e6d1,_0x4bfaef){_0x10e6d1=_0x10e6d1-0x0;var _0x4fe73c=_0x3e87[_0x10e6d1];return _0x4fe73c;};'use strict';var _=require(_0x73e8('0x0'));var util=require('util');var moment=require(_0x73e8('0x1'));var BPromise=require(_0x73e8('0x2'));var rs=require(_0x73e8('0x3'));var fs=require('fs');var Redis=require(_0x73e8('0x4'));var db=require(_0x73e8('0x5'))['db'];var utils=require(_0x73e8('0x6'));var logger=require(_0x73e8('0x7'))(_0x73e8('0x8'));var config=require(_0x73e8('0x9'));var jayson=require(_0x73e8('0xa'));var client=jayson[_0x73e8('0xb')][_0x73e8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2341d0,_0x314f78,_0x1b3cd0){return new BPromise(function(_0x386611,_0x17057a){return client['request'](_0x2341d0,_0x1b3cd0)[_0x73e8('0xd')](function(_0x1963c6){logger[_0x73e8('0xe')](_0x73e8('0xf'),_0x314f78,'request\x20sent');logger[_0x73e8('0x10')](_0x73e8('0x11'),_0x314f78,_0x73e8('0x12'),JSON[_0x73e8('0x13')](_0x1963c6));if(_0x1963c6['error']){if(_0x1963c6[_0x73e8('0x14')][_0x73e8('0x15')]===0x1f4){logger[_0x73e8('0x14')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x314f78,_0x1963c6['error'][_0x73e8('0x16')]);return _0x17057a(_0x1963c6[_0x73e8('0x14')][_0x73e8('0x16')]);}logger['error'](_0x73e8('0xf'),_0x314f78,_0x1963c6[_0x73e8('0x14')][_0x73e8('0x16')]);return _0x386611(_0x1963c6[_0x73e8('0x14')][_0x73e8('0x16')]);}else{logger['info'](_0x73e8('0xf'),_0x314f78,'request\x20sent');_0x386611(_0x1963c6['result'][_0x73e8('0x16')]);}})[_0x73e8('0x17')](function(_0x2e9b11){logger[_0x73e8('0x14')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x314f78,_0x2e9b11);_0x17057a(_0x2e9b11);});});}exports[_0x73e8('0x18')]=function(_0x18d825){var _0xcfceb2=this;return new Promise(function(_0x37eb97,_0x2ce8d3){return db[_0x73e8('0x19')]['findOne']({'raw':!![],'where':{'ContactId':_0x18d825[_0x73e8('0x1a')][_0x73e8('0x1b')],'ListId':_0x18d825[_0x73e8('0x1a')][_0x73e8('0x1c')],'VoiceQueueId':_0x18d825[_0x73e8('0x1a')][_0x73e8('0x1d')]===undefined?null:_0x18d825[_0x73e8('0x1a')][_0x73e8('0x1d')],'CampaignId':_0x18d825[_0x73e8('0x1a')][_0x73e8('0x1e')]===undefined?null:_0x18d825[_0x73e8('0x1a')][_0x73e8('0x1e')]}})[_0x73e8('0xd')](function(_0x1d0d66){if(_0x1d0d66!=null){return db[_0x73e8('0x1f')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x1d0d66['id'],'OrderBy':{'$gt':_0x1d0d66[_0x73e8('0x20')]}},'order':[[_0x73e8('0x20'),_0x73e8('0x21')]]})['then'](function(_0x48bdb0){var _0x50fdc6=0x0;if(_0x48bdb0){if(_0x48bdb0['countbusyretry']+_0x48bdb0[_0x73e8('0x22')]+_0x48bdb0[_0x73e8('0x23')]+_0x48bdb0[_0x73e8('0x24')]+_0x48bdb0[_0x73e8('0x25')]+_0x48bdb0[_0x73e8('0x26')]+_0x48bdb0['countmachineretry']+_0x48bdb0['countagentrejectretry']<_0x18d825['entity'][_0x73e8('0x27')])_0x50fdc6=0x1;_0x37eb97({'additional':_0x50fdc6});}else{return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x1d0d66['id']},'order':[[_0x73e8('0x20'),_0x73e8('0x21')]]})[_0x73e8('0xd')](function(_0x41c57b){var _0x38b219=0x0;if(_0x41c57b){if(_0x41c57b[_0x73e8('0x28')]+_0x41c57b[_0x73e8('0x22')]+_0x41c57b[_0x73e8('0x23')]+_0x41c57b[_0x73e8('0x24')]+_0x41c57b[_0x73e8('0x25')]+_0x41c57b['countabandonedretry']+_0x41c57b['countmachineretry']+_0x41c57b[_0x73e8('0x29')]<_0x18d825['entity']['dialGlobalMaxRetry'])_0x38b219=0x1;_0x37eb97({'additional':_0x38b219});}else{_0x37eb97({'additional':0x0});}})[_0x73e8('0x17')](function(_0x2d90ad){logger[_0x73e8('0x14')](_0x73e8('0x18'),_0x2d90ad[_0x73e8('0x16')]);_0x2ce8d3(_0xcfceb2[_0x73e8('0x14')](0x1f4,_0x2d90ad[_0x73e8('0x16')]));});}})['catch'](function(_0x299ad3){logger[_0x73e8('0x14')](_0x73e8('0x18'),_0x299ad3[_0x73e8('0x16')]);_0x2ce8d3(_0xcfceb2[_0x73e8('0x14')](0x1f4,_0x299ad3['message']));});}else _0x37eb97({'additional':0x0});});});};exports[_0x73e8('0x2a')]=function(_0x389d5d){var _0x466d1b=this;return new Promise(function(_0x49d860,_0x2f927a){return db[_0x73e8('0x19')]['findOne']({'raw':!![],'where':{'ContactId':_0x389d5d[_0x73e8('0x1a')][_0x73e8('0x1b')],'ListId':_0x389d5d[_0x73e8('0x1a')][_0x73e8('0x1c')],'VoiceQueueId':_0x389d5d[_0x73e8('0x1a')][_0x73e8('0x1d')]===undefined?null:_0x389d5d[_0x73e8('0x1a')][_0x73e8('0x1d')],'CampaignId':_0x389d5d[_0x73e8('0x1a')][_0x73e8('0x1e')]===undefined?null:_0x389d5d[_0x73e8('0x1a')]['CampaignId']}})[_0x73e8('0xd')](function(_0x4484be){if(_0x4484be!=null){return db[_0x73e8('0x1f')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x4484be['id'],'OrderBy':{'$gte':_0x4484be[_0x73e8('0x20')]}},'order':[[_0x73e8('0x20'),_0x73e8('0x21')]]})[_0x73e8('0xd')](function(_0xe5fc6b){if(_0xe5fc6b)return activateAdditionalPhone(_0x4484be,_0x389d5d['body'],_0xe5fc6b,_0x389d5d[_0x73e8('0x2b')],_0x389d5d[_0x73e8('0x2c')])[_0x73e8('0xd')](function(_0x5b4542){_0x49d860(_0x5b4542);});else{return db[_0x73e8('0x1f')][_0x73e8('0x2d')]({'raw':!![],'where':{'CmHopperId':_0x4484be['id']},'order':[['OrderBy',_0x73e8('0x21')]]})[_0x73e8('0xd')](function(_0x1ba32e){if(_0x1ba32e)return activateAdditionalPhone(_0x4484be,_0x389d5d[_0x73e8('0x1a')],_0x1ba32e,_0x389d5d[_0x73e8('0x2b')],_0x389d5d[_0x73e8('0x2c')])[_0x73e8('0xd')](function(_0x39173a){_0x49d860(_0x39173a);});else{_0x49d860({'id':_0x4484be['id'],'phone':''});}})[_0x73e8('0x17')](function(_0x1a1fba){logger['error']('VerifyAdditionalPhones',_0x1a1fba[_0x73e8('0x16')]);_0x2f927a(_0x466d1b[_0x73e8('0x14')](0x1f4,_0x1a1fba[_0x73e8('0x16')]));});}})['catch'](function(_0x1a1f29){logger['error'](_0x73e8('0x18'),_0x1a1f29[_0x73e8('0x16')]);_0x2f927a(_0x466d1b[_0x73e8('0x14')](0x1f4,_0x1a1f29[_0x73e8('0x16')]));});}else _0x49d860(0x1);});});};function activateAdditionalPhone(_0x3710e3,_0x32cd4e,_0x1784c6,_0x215fcd,_0x311478){return new Promise(function(_0x474f41,_0x1c0fc0){var _0x3dbd7a;if(_[_0x73e8('0x2e')](_0x1784c6[_0x73e8('0x2f')])){_0x1784c6[_0x73e8('0x2f')]=moment();}if(moment()>moment(_0x1784c6['scheduledat'])){_0x3dbd7a=moment()[_0x73e8('0x30')](_0x311478||0x3,_0x73e8('0x31'));}else{if(_0x1784c6['OrderBy']==0x0){_0x3dbd7a=moment(_0x1784c6[_0x73e8('0x2f')]);}else{_0x3dbd7a=moment()[_0x73e8('0x30')](_0x311478||0x3,'minutes');}}if(_[_0x73e8('0x2e')](_0x3dbd7a)){_0x3dbd7a=moment()[_0x73e8('0x30')](_0x311478||0x3,'minutes');}var _0x328927={'phone':_0x3710e3[_0x73e8('0x32')],'active':0x0,'OrderBy':_[_0x73e8('0x2e')](_0x3710e3[_0x73e8('0x20')])?0x0:_0x3710e3[_0x73e8('0x20')],'scheduledat':moment()[_0x73e8('0x30')](_0x215fcd||0x1,'minutes'),'countbusyretry':_0x32cd4e[_0x73e8('0x28')],'countcongestionretry':_0x32cd4e[_0x73e8('0x22')],'countnoanswerretry':_0x32cd4e[_0x73e8('0x23')],'countnosuchnumberretry':_0x32cd4e[_0x73e8('0x24')],'countdropretry':_0x32cd4e['countdropretry'],'countabandonedretry':_0x32cd4e['countabandonedretry'],'countmachineretry':_0x32cd4e['countmachineretry'],'countagentrejectretry':_0x32cd4e[_0x73e8('0x29')],'createdAt':_0x32cd4e[_0x73e8('0x33')],'updatedAt':_0x32cd4e[_0x73e8('0x34')]};var _0x5781d7={'CmHopperId':_0x3710e3['id'],'phone':_0x1784c6[_0x73e8('0x32')],'active':0x0,'OrderBy':_['isNil'](_0x1784c6[_0x73e8('0x20')])?0x0:_0x1784c6['OrderBy'],'scheduledat':_0x3dbd7a,'countbusyretry':_0x1784c6[_0x73e8('0x28')],'countcongestionretry':_0x1784c6[_0x73e8('0x22')],'countnoanswerretry':_0x1784c6['countnoanswerretry'],'countnosuchnumberretry':_0x1784c6[_0x73e8('0x24')],'countdropretry':_0x1784c6['countdropretry'],'countabandonedretry':_0x1784c6['countabandonedretry'],'countmachineretry':_0x1784c6[_0x73e8('0x35')],'countagentrejectretry':_0x1784c6['countagentrejectretry'],'createdAt':_0x1784c6[_0x73e8('0x33')],'updatedAt':_0x1784c6[_0x73e8('0x34')]};return db[_0x73e8('0x36')][_0x73e8('0x37')](function(_0x26bbf2){return db['CmHopperAdditionalPhone'][_0x73e8('0x38')](_0x328927,{'where':{'id':_0x1784c6['id']}},{'transaction':_0x26bbf2})[_0x73e8('0xd')](function(){return db[_0x73e8('0x19')][_0x73e8('0x38')](_0x5781d7,{'where':{'id':_0x3710e3['id']}},{'transaction':_0x26bbf2});});})[_0x73e8('0xd')](function(_0x2a4339){_0x474f41({'id':_0x3710e3['id'],'phone':_0x1784c6[_0x73e8('0x32')]});})[_0x73e8('0x17')](function(_0x19333f){logger[_0x73e8('0x14')](_0x73e8('0x39'),_0x19333f[_0x73e8('0x16')]);_0x1c0fc0({'error':_0x19333f[_0x73e8('0x16')]});});});}exports[_0x73e8('0x3a')]=function(_0x59ec4c){var _0x493484=this;return new Promise(function(_0x5c5285,_0x3e2664){return db['CmHopper'][_0x73e8('0x38')](_0x59ec4c[_0x73e8('0x1a')][_0x73e8('0x3b')],{'where':{'id':_0x59ec4c[_0x73e8('0x1a')]['id']}})[_0x73e8('0xd')](function(_0x2100e9){_0x5c5285(_0x2100e9);})[_0x73e8('0x17')](function(_0x2d9f72){logger[_0x73e8('0x14')]('IncrementPreviewCounters',_0x2d9f72[_0x73e8('0x16')]);_0x3e2664(_0x493484['error'](0x1f4,_0x2d9f72[_0x73e8('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index 8774eb6..fa60f2d 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 _0xdeab=['multer','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','get','isAuthenticated','index','/:id','show','post','create','put','update'];(function(_0x3ec1c0,_0x28c6e4){var _0x91d784=function(_0x4d0d19){while(--_0x4d0d19){_0x3ec1c0['push'](_0x3ec1c0['shift']());}};_0x91d784(++_0x28c6e4);}(_0xdeab,0x154));var _0xbdea=function(_0x475389,_0x2deda6){_0x475389=_0x475389-0x0;var _0x5aa36d=_0xdeab[_0x475389];return _0x5aa36d;};'use strict';var multer=require(_0xbdea('0x0'));var util=require(_0xbdea('0x1'));var path=require(_0xbdea('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xbdea('0x3'));var auth=require(_0xbdea('0x4'));var interaction=require(_0xbdea('0x5'));var config=require(_0xbdea('0x6'));var controller=require(_0xbdea('0x7'));router[_0xbdea('0x8')]('/',auth[_0xbdea('0x9')](),controller[_0xbdea('0xa')]);router[_0xbdea('0x8')](_0xbdea('0xb'),auth[_0xbdea('0x9')](),controller[_0xbdea('0xc')]);router[_0xbdea('0xd')]('/',auth['isAuthenticated'](),controller[_0xbdea('0xe')]);router[_0xbdea('0xf')](_0xbdea('0xb'),auth[_0xbdea('0x9')](),controller[_0xbdea('0x10')]);router['delete'](_0xbdea('0xb'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x93d3=['isAuthenticated','create','/:id','delete','exports','multer','path','../../components/auth/service','../../components/interaction/service','../../config/environment','show'];(function(_0xe8ae7d,_0x15b843){var _0x1bc0a9=function(_0x1d546d){while(--_0x1d546d){_0xe8ae7d['push'](_0xe8ae7d['shift']());}};_0x1bc0a9(++_0x15b843);}(_0x93d3,0x1e9));var _0x393d=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x93d3[_0x1d1779];return _0x2377e9;};'use strict';var multer=require(_0x393d('0x0'));var util=require('util');var path=require(_0x393d('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x393d('0x2'));var interaction=require(_0x393d('0x3'));var config=require(_0x393d('0x4'));var controller=require('./cmHopperAdditionalPhone.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x393d('0x5')]);router['post']('/',auth[_0x393d('0x6')](),controller[_0x393d('0x7')]);router['put'](_0x393d('0x8'),auth['isAuthenticated'](),controller['update']);router[_0x393d('0x9')](_0x393d('0x8'),auth[_0x393d('0x6')](),controller['destroy']);module[_0x393d('0xa')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index b062538..3bdb88f 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 _0x573a=['INTEGER','contactListQueue','moment','sequelize','STRING'];(function(_0x31172e,_0xa59e5){var _0x414ada=function(_0x37ede4){while(--_0x37ede4){_0x31172e['push'](_0x31172e['shift']());}};_0x414ada(++_0xa59e5);}(_0x573a,0x124));var _0xa573=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0x573a[_0x37c22c];return _0x119d79;};'use strict';var moment=require(_0xa573('0x0'));var Sequelize=require(_0xa573('0x1'));module['exports']={'phone':{'type':Sequelize[_0xa573('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xa573('0x3')],'unique':_0xa573('0x4')},'ListId':{'type':Sequelize[_0xa573('0x3')],'unique':_0xa573('0x4')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0xa573('0x4')}}; \ No newline at end of file +var _0x90d2=['exports','STRING','contactListQueue','INTEGER','moment','sequelize'];(function(_0x354871,_0x2e1491){var _0x4c3d9a=function(_0x1451a0){while(--_0x1451a0){_0x354871['push'](_0x354871['shift']());}};_0x4c3d9a(++_0x2e1491);}(_0x90d2,0x64));var _0x290d=function(_0x38d887,_0x261d68){_0x38d887=_0x38d887-0x0;var _0x84c717=_0x90d2[_0x38d887];return _0x84c717;};'use strict';var moment=require(_0x290d('0x0'));var Sequelize=require(_0x290d('0x1'));module[_0x290d('0x2')]={'phone':{'type':Sequelize[_0x290d('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x290d('0x4')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x290d('0x4')},'VoiceQueueId':{'type':Sequelize[_0x290d('0x5')],'unique':_0x290d('0x4')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 7d98d73..e08ffba 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 _0xd7e3=['includeAll','include','findAll','rows','catch','show','params','options','body','find','describe','fast-json-patch','moment','bluebird','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','CmHopperBlack','rawAttributes','fieldName','key','query','keys','filters','intersection','attributes','model','fields','length','order','sort','where','pick','filter','merge','type','VIRTUAL'];(function(_0x39e651,_0x56324b){var _0xcb524d=function(_0x514c7d){while(--_0x514c7d){_0x39e651['push'](_0x39e651['shift']());}};_0xcb524d(++_0x56324b);}(_0xd7e3,0xec));var _0x3d7e=function(_0x273f92,_0x5e6ea2){_0x273f92=_0x273f92-0x0;var _0x38b53c=_0xd7e3[_0x273f92];return _0x38b53c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3d7e('0x0'));var rp=require('request-promise');var moment=require(_0x3d7e('0x1'));var BPromise=require(_0x3d7e('0x2'));var Mustache=require(_0x3d7e('0x3'));var util=require(_0x3d7e('0x4'));var path=require(_0x3d7e('0x5'));var sox=require(_0x3d7e('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3d7e('0x7'));var _=require('lodash');var squel=require(_0x3d7e('0x8'));var crypto=require(_0x3d7e('0x9'));var jsforce=require(_0x3d7e('0xa'));var deskjs=require(_0x3d7e('0xb'));var toCsv=require('to-csv');var querystring=require(_0x3d7e('0xc'));var Papa=require(_0x3d7e('0xd'));var Redis=require(_0x3d7e('0xe'));var authService=require(_0x3d7e('0xf'));var qs=require(_0x3d7e('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3d7e('0x11'));var logger=require(_0x3d7e('0x12'))(_0x3d7e('0x13'));var utils=require('../../config/utils');var config=require(_0x3d7e('0x14'));var licenseUtil=require(_0x3d7e('0x15'));var db=require(_0x3d7e('0x16'))['db'];function respondWithStatusCode(_0x32a7dc,_0xb3cef5){_0xb3cef5=_0xb3cef5||0xcc;return function(_0x4ae8b2){if(_0x4ae8b2){return _0x32a7dc[_0x3d7e('0x17')](_0xb3cef5);}return _0x32a7dc[_0x3d7e('0x18')](_0xb3cef5)[_0x3d7e('0x19')]();};}function respondWithResult(_0x2ba39f,_0x2fb42e){_0x2fb42e=_0x2fb42e||0xc8;return function(_0x5629c5){if(_0x5629c5){return _0x2ba39f['status'](_0x2fb42e)[_0x3d7e('0x1a')](_0x5629c5);}};}function respondWithFilteredResult(_0x18871f,_0xafb01){return function(_0x4ed64b){if(_0x4ed64b){var _0x52b0ad=typeof _0xafb01['offset']===_0x3d7e('0x1b')&&typeof _0xafb01['limit']===_0x3d7e('0x1b');var _0x422c9d=_0x4ed64b[_0x3d7e('0x1c')];var _0x4c725a=_0x52b0ad?0x0:_0xafb01['offset'];var _0x4873bb=_0x52b0ad?_0x4ed64b[_0x3d7e('0x1c')]:_0xafb01[_0x3d7e('0x1d')]+_0xafb01[_0x3d7e('0x1e')];var _0x4dc510;if(_0x4873bb>=_0x422c9d){_0x4873bb=_0x422c9d;_0x4dc510=0xc8;}else{_0x4dc510=0xce;}_0x18871f[_0x3d7e('0x18')](_0x4dc510);return _0x18871f[_0x3d7e('0x1f')]('Content-Range',_0x4c725a+'-'+_0x4873bb+'/'+_0x422c9d)[_0x3d7e('0x1a')](_0x4ed64b);}return null;};}function patchUpdates(_0x2d8d72){return function(_0xce784c){try{jsonpatch[_0x3d7e('0x20')](_0xce784c,_0x2d8d72,!![]);}catch(_0x30c4e3){return BPromise[_0x3d7e('0x21')](_0x30c4e3);}return _0xce784c[_0x3d7e('0x22')]();};}function saveUpdates(_0x316eb6,_0x2f9f27){return function(_0x2ec63d){if(_0x2ec63d){return _0x2ec63d[_0x3d7e('0x23')](_0x316eb6)[_0x3d7e('0x24')](function(_0x996271){return _0x996271;});}return null;};}function removeEntity(_0x4abbfa,_0x4336f9){return function(_0x1b658e){if(_0x1b658e){return _0x1b658e[_0x3d7e('0x25')]()[_0x3d7e('0x24')](function(){_0x4abbfa[_0x3d7e('0x18')](0xcc)[_0x3d7e('0x19')]();});}};}function handleEntityNotFound(_0x40aee6,_0x1e0018){return function(_0x5dac30){if(!_0x5dac30){_0x40aee6[_0x3d7e('0x17')](0x194);}return _0x5dac30;};}function handleError(_0x1a68fe,_0x3d81db){_0x3d81db=_0x3d81db||0x1f4;return function(_0x1c0881){logger[_0x3d7e('0x26')](_0x1c0881[_0x3d7e('0x27')]);if(_0x1c0881[_0x3d7e('0x28')]){delete _0x1c0881[_0x3d7e('0x28')];}_0x1a68fe[_0x3d7e('0x18')](_0x3d81db)[_0x3d7e('0x29')](_0x1c0881);};}exports[_0x3d7e('0x2a')]=function(_0x4f5712,_0x22fb3b){var _0x4cc3d1={},_0x168682={},_0x5db19a={'count':0x0,'rows':[]};var _0x189ef7=_[_0x3d7e('0x2b')](db[_0x3d7e('0x2c')][_0x3d7e('0x2d')],function(_0x394683){return{'name':_0x394683[_0x3d7e('0x2e')],'type':_0x394683['type'][_0x3d7e('0x2f')]};});_0x168682['model']=_['map'](_0x189ef7,_0x3d7e('0x28'));_0x168682[_0x3d7e('0x30')]=_[_0x3d7e('0x31')](_0x4f5712['query']);_0x168682[_0x3d7e('0x32')]=_[_0x3d7e('0x33')](_0x168682['model'],_0x168682['query']);_0x4cc3d1[_0x3d7e('0x34')]=_[_0x3d7e('0x33')](_0x168682[_0x3d7e('0x35')],qs[_0x3d7e('0x36')](_0x4f5712[_0x3d7e('0x30')][_0x3d7e('0x36')]));_0x4cc3d1[_0x3d7e('0x34')]=_0x4cc3d1[_0x3d7e('0x34')][_0x3d7e('0x37')]?_0x4cc3d1['attributes']:_0x168682[_0x3d7e('0x35')];if(!_0x4f5712[_0x3d7e('0x30')]['hasOwnProperty']('nolimit')){_0x4cc3d1['limit']=qs[_0x3d7e('0x1e')](_0x4f5712[_0x3d7e('0x30')][_0x3d7e('0x1e')]);_0x4cc3d1[_0x3d7e('0x1d')]=qs[_0x3d7e('0x1d')](_0x4f5712[_0x3d7e('0x30')]['offset']);}_0x4cc3d1[_0x3d7e('0x38')]=qs[_0x3d7e('0x39')](_0x4f5712[_0x3d7e('0x30')][_0x3d7e('0x39')]);_0x4cc3d1[_0x3d7e('0x3a')]=qs[_0x3d7e('0x32')](_[_0x3d7e('0x3b')](_0x4f5712[_0x3d7e('0x30')],_0x168682[_0x3d7e('0x32')]),_0x189ef7);if(_0x4f5712[_0x3d7e('0x30')][_0x3d7e('0x3c')]){_0x4cc3d1[_0x3d7e('0x3a')]=_[_0x3d7e('0x3d')](_0x4cc3d1[_0x3d7e('0x3a')],{'$or':_['map'](_0x189ef7,function(_0x3d75bf){if(_0x3d75bf[_0x3d7e('0x3e')]!==_0x3d7e('0x3f')){var _0x4fdb62={};_0x4fdb62[_0x3d75bf[_0x3d7e('0x28')]]={'$like':'%'+_0x4f5712[_0x3d7e('0x30')][_0x3d7e('0x3c')]+'%'};return _0x4fdb62;}})});}_0x4cc3d1=_[_0x3d7e('0x3d')]({},_0x4cc3d1,_0x4f5712['options']);var _0x4a9587={'where':_0x4cc3d1[_0x3d7e('0x3a')]};return db[_0x3d7e('0x2c')][_0x3d7e('0x1c')](_0x4a9587)[_0x3d7e('0x24')](function(_0x4064d1){_0x5db19a[_0x3d7e('0x1c')]=_0x4064d1;if(_0x4f5712[_0x3d7e('0x30')][_0x3d7e('0x40')]){_0x4cc3d1[_0x3d7e('0x41')]=[{'all':!![]}];}return db[_0x3d7e('0x2c')][_0x3d7e('0x42')](_0x4cc3d1);})[_0x3d7e('0x24')](function(_0x93a345){_0x5db19a[_0x3d7e('0x43')]=_0x93a345;return _0x5db19a;})[_0x3d7e('0x24')](respondWithFilteredResult(_0x22fb3b,_0x4cc3d1))[_0x3d7e('0x44')](handleError(_0x22fb3b,null));};exports[_0x3d7e('0x45')]=function(_0x31a28b,_0x3e5917){var _0x482542={'raw':!![],'where':{'id':_0x31a28b[_0x3d7e('0x46')]['id']}},_0x3eacdd={};_0x3eacdd[_0x3d7e('0x35')]=_[_0x3d7e('0x31')](db[_0x3d7e('0x2c')][_0x3d7e('0x2d')]);_0x3eacdd[_0x3d7e('0x30')]=_[_0x3d7e('0x31')](_0x31a28b['query']);_0x3eacdd[_0x3d7e('0x32')]=_[_0x3d7e('0x33')](_0x3eacdd[_0x3d7e('0x35')],_0x3eacdd[_0x3d7e('0x30')]);_0x482542[_0x3d7e('0x34')]=_[_0x3d7e('0x33')](_0x3eacdd[_0x3d7e('0x35')],qs['fields'](_0x31a28b[_0x3d7e('0x30')][_0x3d7e('0x36')]));_0x482542[_0x3d7e('0x34')]=_0x482542['attributes'][_0x3d7e('0x37')]?_0x482542[_0x3d7e('0x34')]:_0x3eacdd[_0x3d7e('0x35')];if(_0x31a28b[_0x3d7e('0x30')][_0x3d7e('0x40')]){_0x482542[_0x3d7e('0x41')]=[{'all':!![]}];}_0x482542=_[_0x3d7e('0x3d')]({},_0x482542,_0x31a28b[_0x3d7e('0x47')]);return db['CmHopperBlack']['find'](_0x482542)[_0x3d7e('0x24')](handleEntityNotFound(_0x3e5917,null))['then'](respondWithResult(_0x3e5917,null))[_0x3d7e('0x44')](handleError(_0x3e5917,null));};exports[_0x3d7e('0x23')]=function(_0x31f39b,_0x1e0873){if(_0x31f39b[_0x3d7e('0x48')]['id']){delete _0x31f39b[_0x3d7e('0x48')]['id'];}return db[_0x3d7e('0x2c')][_0x3d7e('0x49')]({'where':{'id':_0x31f39b[_0x3d7e('0x46')]['id']}})[_0x3d7e('0x24')](handleEntityNotFound(_0x1e0873,null))[_0x3d7e('0x24')](saveUpdates(_0x31f39b[_0x3d7e('0x48')],null))[_0x3d7e('0x24')](respondWithResult(_0x1e0873,null))[_0x3d7e('0x44')](handleError(_0x1e0873,null));};exports[_0x3d7e('0x25')]=function(_0x321ed8,_0xfcbef8){return db[_0x3d7e('0x2c')][_0x3d7e('0x49')]({'where':{'id':_0x321ed8[_0x3d7e('0x46')]['id']}})[_0x3d7e('0x24')](handleEntityNotFound(_0xfcbef8,null))[_0x3d7e('0x24')](removeEntity(_0xfcbef8,null))['catch'](handleError(_0xfcbef8,null));};exports['describe']=function(_0x4be1c6,_0xe3137c){return db[_0x3d7e('0x2c')][_0x3d7e('0x4a')]()[_0x3d7e('0x24')](respondWithResult(_0xe3137c,null))[_0x3d7e('0x44')](handleError(_0xe3137c,null));}; \ No newline at end of file +var _0x581a=['findAll','rows','catch','show','params','include','find','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','reject','update','destroy','stack','name','send','index','map','CmHopperBlack','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','type','VIRTUAL','options','then','includeAll'];(function(_0x8a969d,_0x339d9f){var _0x1d8dc7=function(_0x283ec0){while(--_0x283ec0){_0x8a969d['push'](_0x8a969d['shift']());}};_0x1d8dc7(++_0x339d9f);}(_0x581a,0x9d));var _0xa581=function(_0x2e13f4,_0x49db9c){_0x2e13f4=_0x2e13f4-0x0;var _0x418cdd=_0x581a[_0x2e13f4];return _0x418cdd;};'use strict';var emlformat=require(_0xa581('0x0'));var rimraf=require(_0xa581('0x1'));var zipdir=require(_0xa581('0x2'));var jsonpatch=require(_0xa581('0x3'));var rp=require(_0xa581('0x4'));var moment=require(_0xa581('0x5'));var BPromise=require(_0xa581('0x6'));var Mustache=require(_0xa581('0x7'));var util=require('util');var path=require(_0xa581('0x8'));var sox=require(_0xa581('0x9'));var csv=require(_0xa581('0xa'));var ejs=require(_0xa581('0xb'));var fs=require('fs');var fs_extra=require(_0xa581('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa581('0xd'));var toCsv=require('to-csv');var querystring=require(_0xa581('0xe'));var Papa=require(_0xa581('0xf'));var Redis=require(_0xa581('0x10'));var authService=require(_0xa581('0x11'));var qs=require(_0xa581('0x12'));var as=require(_0xa581('0x13'));var hardwareService=require(_0xa581('0x14'));var logger=require(_0xa581('0x15'))(_0xa581('0x16'));var utils=require(_0xa581('0x17'));var config=require(_0xa581('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xa581('0x19'))['db'];function respondWithStatusCode(_0x1ab5b2,_0x36ed5c){_0x36ed5c=_0x36ed5c||0xcc;return function(_0x1b42de){if(_0x1b42de){return _0x1ab5b2[_0xa581('0x1a')](_0x36ed5c);}return _0x1ab5b2['status'](_0x36ed5c)[_0xa581('0x1b')]();};}function respondWithResult(_0x3646d1,_0x2ffdc3){_0x2ffdc3=_0x2ffdc3||0xc8;return function(_0x1c5a9a){if(_0x1c5a9a){return _0x3646d1[_0xa581('0x1c')](_0x2ffdc3)[_0xa581('0x1d')](_0x1c5a9a);}};}function respondWithFilteredResult(_0x5d4eb3,_0x570d86){return function(_0x1a7c6f){if(_0x1a7c6f){var _0x4c877c=typeof _0x570d86[_0xa581('0x1e')]==='undefined'&&typeof _0x570d86[_0xa581('0x1f')]===_0xa581('0x20');var _0x3af35b=_0x1a7c6f[_0xa581('0x21')];var _0x1bc7a5=_0x4c877c?0x0:_0x570d86['offset'];var _0x577cd3=_0x4c877c?_0x1a7c6f[_0xa581('0x21')]:_0x570d86['offset']+_0x570d86[_0xa581('0x1f')];var _0x5741f1;if(_0x577cd3>=_0x3af35b){_0x577cd3=_0x3af35b;_0x5741f1=0xc8;}else{_0x5741f1=0xce;}_0x5d4eb3[_0xa581('0x1c')](_0x5741f1);return _0x5d4eb3['set']('Content-Range',_0x1bc7a5+'-'+_0x577cd3+'/'+_0x3af35b)[_0xa581('0x1d')](_0x1a7c6f);}return null;};}function patchUpdates(_0x3c5a96){return function(_0x162e96){try{jsonpatch['apply'](_0x162e96,_0x3c5a96,!![]);}catch(_0x36f9d7){return BPromise[_0xa581('0x22')](_0x36f9d7);}return _0x162e96['save']();};}function saveUpdates(_0xa1236a,_0x13d55f){return function(_0x5e529b){if(_0x5e529b){return _0x5e529b[_0xa581('0x23')](_0xa1236a)['then'](function(_0x1588d4){return _0x1588d4;});}return null;};}function removeEntity(_0x4d2fa1,_0x21f9b8){return function(_0x3d7879){if(_0x3d7879){return _0x3d7879[_0xa581('0x24')]()['then'](function(){_0x4d2fa1[_0xa581('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x240511,_0x3edef8){return function(_0x2b3230){if(!_0x2b3230){_0x240511[_0xa581('0x1a')](0x194);}return _0x2b3230;};}function handleError(_0xa5d818,_0x22040){_0x22040=_0x22040||0x1f4;return function(_0x480c52){logger['error'](_0x480c52[_0xa581('0x25')]);if(_0x480c52[_0xa581('0x26')]){delete _0x480c52[_0xa581('0x26')];}_0xa5d818[_0xa581('0x1c')](_0x22040)[_0xa581('0x27')](_0x480c52);};}exports[_0xa581('0x28')]=function(_0x30c82c,_0x2b9830){var _0xf0a4cf={},_0x25fba3={},_0xa0a5a8={'count':0x0,'rows':[]};var _0x5406ed=_[_0xa581('0x29')](db[_0xa581('0x2a')][_0xa581('0x2b')],function(_0x21d4a9){return{'name':_0x21d4a9[_0xa581('0x2c')],'type':_0x21d4a9['type'][_0xa581('0x2d')]};});_0x25fba3['model']=_[_0xa581('0x29')](_0x5406ed,_0xa581('0x26'));_0x25fba3[_0xa581('0x2e')]=_[_0xa581('0x2f')](_0x30c82c[_0xa581('0x2e')]);_0x25fba3['filters']=_[_0xa581('0x30')](_0x25fba3[_0xa581('0x31')],_0x25fba3[_0xa581('0x2e')]);_0xf0a4cf[_0xa581('0x32')]=_[_0xa581('0x30')](_0x25fba3['model'],qs[_0xa581('0x33')](_0x30c82c[_0xa581('0x2e')]['fields']));_0xf0a4cf[_0xa581('0x32')]=_0xf0a4cf[_0xa581('0x32')][_0xa581('0x34')]?_0xf0a4cf[_0xa581('0x32')]:_0x25fba3[_0xa581('0x31')];if(!_0x30c82c[_0xa581('0x2e')][_0xa581('0x35')](_0xa581('0x36'))){_0xf0a4cf[_0xa581('0x1f')]=qs[_0xa581('0x1f')](_0x30c82c[_0xa581('0x2e')][_0xa581('0x1f')]);_0xf0a4cf[_0xa581('0x1e')]=qs[_0xa581('0x1e')](_0x30c82c[_0xa581('0x2e')][_0xa581('0x1e')]);}_0xf0a4cf['order']=qs[_0xa581('0x37')](_0x30c82c[_0xa581('0x2e')][_0xa581('0x37')]);_0xf0a4cf[_0xa581('0x38')]=qs[_0xa581('0x39')](_['pick'](_0x30c82c[_0xa581('0x2e')],_0x25fba3[_0xa581('0x39')]),_0x5406ed);if(_0x30c82c['query'][_0xa581('0x3a')]){_0xf0a4cf[_0xa581('0x38')]=_[_0xa581('0x3b')](_0xf0a4cf[_0xa581('0x38')],{'$or':_[_0xa581('0x29')](_0x5406ed,function(_0x57cb72){if(_0x57cb72[_0xa581('0x3c')]!==_0xa581('0x3d')){var _0x59a0af={};_0x59a0af[_0x57cb72[_0xa581('0x26')]]={'$like':'%'+_0x30c82c['query'][_0xa581('0x3a')]+'%'};return _0x59a0af;}})});}_0xf0a4cf=_[_0xa581('0x3b')]({},_0xf0a4cf,_0x30c82c[_0xa581('0x3e')]);var _0x1f8a61={'where':_0xf0a4cf[_0xa581('0x38')]};return db[_0xa581('0x2a')][_0xa581('0x21')](_0x1f8a61)[_0xa581('0x3f')](function(_0x4e373b){_0xa0a5a8[_0xa581('0x21')]=_0x4e373b;if(_0x30c82c['query'][_0xa581('0x40')]){_0xf0a4cf['include']=[{'all':!![]}];}return db['CmHopperBlack'][_0xa581('0x41')](_0xf0a4cf);})[_0xa581('0x3f')](function(_0x2ea079){_0xa0a5a8[_0xa581('0x42')]=_0x2ea079;return _0xa0a5a8;})[_0xa581('0x3f')](respondWithFilteredResult(_0x2b9830,_0xf0a4cf))[_0xa581('0x43')](handleError(_0x2b9830,null));};exports[_0xa581('0x44')]=function(_0x3e06da,_0x34da79){var _0x60b5e={'raw':!![],'where':{'id':_0x3e06da[_0xa581('0x45')]['id']}},_0x49d078={};_0x49d078[_0xa581('0x31')]=_['keys'](db[_0xa581('0x2a')]['rawAttributes']);_0x49d078[_0xa581('0x2e')]=_['keys'](_0x3e06da[_0xa581('0x2e')]);_0x49d078[_0xa581('0x39')]=_[_0xa581('0x30')](_0x49d078['model'],_0x49d078[_0xa581('0x2e')]);_0x60b5e[_0xa581('0x32')]=_[_0xa581('0x30')](_0x49d078[_0xa581('0x31')],qs['fields'](_0x3e06da[_0xa581('0x2e')][_0xa581('0x33')]));_0x60b5e[_0xa581('0x32')]=_0x60b5e[_0xa581('0x32')][_0xa581('0x34')]?_0x60b5e[_0xa581('0x32')]:_0x49d078[_0xa581('0x31')];if(_0x3e06da[_0xa581('0x2e')][_0xa581('0x40')]){_0x60b5e[_0xa581('0x46')]=[{'all':!![]}];}_0x60b5e=_['merge']({},_0x60b5e,_0x3e06da[_0xa581('0x3e')]);return db[_0xa581('0x2a')][_0xa581('0x47')](_0x60b5e)[_0xa581('0x3f')](handleEntityNotFound(_0x34da79,null))[_0xa581('0x3f')](respondWithResult(_0x34da79,null))[_0xa581('0x43')](handleError(_0x34da79,null));};exports['update']=function(_0x28e942,_0x35f452){if(_0x28e942[_0xa581('0x48')]['id']){delete _0x28e942[_0xa581('0x48')]['id'];}return db['CmHopperBlack']['find']({'where':{'id':_0x28e942[_0xa581('0x45')]['id']}})[_0xa581('0x3f')](handleEntityNotFound(_0x35f452,null))['then'](saveUpdates(_0x28e942['body'],null))[_0xa581('0x3f')](respondWithResult(_0x35f452,null))[_0xa581('0x43')](handleError(_0x35f452,null));};exports['destroy']=function(_0x3479eb,_0x416a55){return db[_0xa581('0x2a')][_0xa581('0x47')]({'where':{'id':_0x3479eb[_0xa581('0x45')]['id']}})['then'](handleEntityNotFound(_0x416a55,null))['then'](removeEntity(_0x416a55,null))[_0xa581('0x43')](handleError(_0x416a55,null));};exports[_0xa581('0x49')]=function(_0x2c2464,_0x4f5b91){return db[_0xa581('0x2a')]['describe']()[_0xa581('0x3f')](respondWithResult(_0x4f5b91,null))[_0xa581('0x43')](handleError(_0x4f5b91,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 8f35d58..59b1983 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 _0x6892=['request-promise','path','rimraf','../../config/environment','./cmHopperBlack.attributes','CmHopperBlack','../../config/logger','api','moment','bluebird'];(function(_0x4e4ce5,_0x35e628){var _0x1a167c=function(_0x5953a9){while(--_0x5953a9){_0x4e4ce5['push'](_0x4e4ce5['shift']());}};_0x1a167c(++_0x35e628);}(_0x6892,0x74));var _0x2689=function(_0x2b0850,_0x6b27a5){_0x2b0850=_0x2b0850-0x0;var _0x57e5ab=_0x6892[_0x2b0850];return _0x57e5ab;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2689('0x0'))(_0x2689('0x1'));var moment=require(_0x2689('0x2'));var BPromise=require(_0x2689('0x3'));var rp=require(_0x2689('0x4'));var fs=require('fs');var path=require(_0x2689('0x5'));var rimraf=require(_0x2689('0x6'));var config=require(_0x2689('0x7'));var attributes=require(_0x2689('0x8'));module['exports']=function(_0x116785,_0x2fbed6){return _0x116785['define'](_0x2689('0x9'),attributes,{'tableName':'cm_hopper_black','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3723=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','CmHopperBlack','cm_hopper_black'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x3723,0x179));var _0x3372=function(_0x2ddcce,_0x26ed97){_0x2ddcce=_0x2ddcce-0x0;var _0x11cb13=_0x3723[_0x2ddcce];return _0x11cb13;};'use strict';var _=require(_0x3372('0x0'));var util=require(_0x3372('0x1'));var logger=require(_0x3372('0x2'))('api');var moment=require(_0x3372('0x3'));var BPromise=require(_0x3372('0x4'));var rp=require(_0x3372('0x5'));var fs=require('fs');var path=require(_0x3372('0x6'));var rimraf=require(_0x3372('0x7'));var config=require(_0x3372('0x8'));var attributes=require('./cmHopperBlack.attributes');module[_0x3372('0x9')]=function(_0x22a59a,_0xf71e9d){return _0x22a59a[_0x3372('0xa')](_0x3372('0xb'),attributes,{'tableName':_0x3372('0xc'),'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 bc68b55..e03fbeb 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 _0xba4e=['DestroyCmHopperBlack','destroy','util','bluebird','randomstring','rpc','jayson/promise','client','request','then','info','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopperBlack,\x20%s,\x20%s','message','result','catch','CmHopperBlack','findAll','options','raw','where','attributes','limit','include','map','model','GetCmHopperBlack','body','UpdateCmHopperBlack'];(function(_0x11ceea,_0x4a4987){var _0x424b36=function(_0x5de92b){while(--_0x5de92b){_0x11ceea['push'](_0x11ceea['shift']());}};_0x424b36(++_0x4a4987);}(_0xba4e,0x156));var _0xeba4=function(_0x374c4a,_0x5afa32){_0x374c4a=_0x374c4a-0x0;var _0x103f4a=_0xba4e[_0x374c4a];return _0x103f4a;};'use strict';var _=require('lodash');var util=require(_0xeba4('0x0'));var moment=require('moment');var BPromise=require(_0xeba4('0x1'));var rs=require(_0xeba4('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xeba4('0x3'));var config=require('../../config/environment');var jayson=require(_0xeba4('0x4'));var client=jayson[_0xeba4('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x50a811,_0x596cbc,_0x3a11b9){return new BPromise(function(_0x4357b2,_0x4ca5a4){return client[_0xeba4('0x6')](_0x50a811,_0x3a11b9)[_0xeba4('0x7')](function(_0x318ead){logger[_0xeba4('0x8')]('CmHopperBlack,\x20%s,\x20%s',_0x596cbc,_0xeba4('0x9'));logger[_0xeba4('0xa')](_0xeba4('0xb'),_0x596cbc,_0xeba4('0x9'),JSON[_0xeba4('0xc')](_0x318ead));if(_0x318ead[_0xeba4('0xd')]){if(_0x318ead[_0xeba4('0xd')][_0xeba4('0xe')]===0x1f4){logger[_0xeba4('0xd')](_0xeba4('0xf'),_0x596cbc,_0x318ead['error'][_0xeba4('0x10')]);return _0x4ca5a4(_0x318ead[_0xeba4('0xd')][_0xeba4('0x10')]);}logger['error']('CmHopperBlack,\x20%s,\x20%s',_0x596cbc,_0x318ead[_0xeba4('0xd')]['message']);return _0x4357b2(_0x318ead[_0xeba4('0xd')]['message']);}else{logger[_0xeba4('0x8')](_0xeba4('0xf'),_0x596cbc,_0xeba4('0x9'));_0x4357b2(_0x318ead[_0xeba4('0x11')][_0xeba4('0x10')]);}})[_0xeba4('0x12')](function(_0xdb8df5){logger[_0xeba4('0xd')](_0xeba4('0xf'),_0x596cbc,_0xdb8df5);_0x4ca5a4(_0xdb8df5);});});}exports['GetCmHopperBlack']=function(_0x432b02){var _0x3d012c=this;return new Promise(function(_0x18843c,_0x759ff0){return db[_0xeba4('0x13')][_0xeba4('0x14')]({'raw':_0x432b02[_0xeba4('0x15')]?_0x432b02[_0xeba4('0x15')][_0xeba4('0x16')]===undefined?!![]:![]:!![],'where':_0x432b02[_0xeba4('0x15')]?_0x432b02[_0xeba4('0x15')][_0xeba4('0x17')]||null:null,'attributes':_0x432b02['options']?_0x432b02[_0xeba4('0x15')][_0xeba4('0x18')]||null:null,'limit':_0x432b02[_0xeba4('0x15')]?_0x432b02[_0xeba4('0x15')][_0xeba4('0x19')]||null:null,'include':_0x432b02['options']?_0x432b02[_0xeba4('0x15')][_0xeba4('0x1a')]?_[_0xeba4('0x1b')](_0x432b02['options']['include'],function(_0x34ebb0){return{'model':db[_0x34ebb0[_0xeba4('0x1c')]],'as':_0x34ebb0['as'],'attributes':_0x34ebb0['attributes'],'include':_0x34ebb0[_0xeba4('0x1a')]?_[_0xeba4('0x1b')](_0x34ebb0['include'],function(_0x42df78){return{'model':db[_0x42df78['model']],'as':_0x42df78['as'],'attributes':_0x42df78[_0xeba4('0x18')],'include':_0x42df78[_0xeba4('0x1a')]?_[_0xeba4('0x1b')](_0x42df78[_0xeba4('0x1a')],function(_0xae7ea2){return{'model':db[_0xae7ea2[_0xeba4('0x1c')]],'as':_0xae7ea2['as'],'attributes':_0xae7ea2[_0xeba4('0x18')]};}):[]};}):[]};}):[]:[]})[_0xeba4('0x7')](function(_0x3f3e9c){logger[_0xeba4('0x8')](_0xeba4('0x1d'),_0x432b02);logger[_0xeba4('0xa')](_0xeba4('0x1d'),_0x432b02,JSON[_0xeba4('0xc')](_0x3f3e9c));_0x18843c(_0x3f3e9c);})[_0xeba4('0x12')](function(_0x4d4cec){logger[_0xeba4('0xd')](_0xeba4('0x1d'),_0x4d4cec[_0xeba4('0x10')],_0x432b02);_0x759ff0(_0x3d012c[_0xeba4('0xd')](0x1f4,_0x4d4cec[_0xeba4('0x10')]));});});};exports['UpdateCmHopperBlack']=function(_0x150342){var _0x15c522=this;return new Promise(function(_0xa05d23,_0x653505){return db['CmHopperBlack']['update'](_0x150342[_0xeba4('0x1e')],{'raw':_0x150342[_0xeba4('0x15')]?_0x150342[_0xeba4('0x15')][_0xeba4('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x150342['options']?_0x150342[_0xeba4('0x15')][_0xeba4('0x17')]||null:null,'attributes':_0x150342[_0xeba4('0x15')]?_0x150342[_0xeba4('0x15')]['attributes']||null:null,'limit':_0x150342['options']?_0x150342['options'][_0xeba4('0x19')]||null:null})[_0xeba4('0x7')](function(_0x1e61fd){logger[_0xeba4('0x8')]('UpdateCmHopperBlack',_0x150342);logger[_0xeba4('0xa')](_0xeba4('0x1f'),_0x150342,JSON[_0xeba4('0xc')](_0x1e61fd));_0xa05d23(_0x1e61fd);})[_0xeba4('0x12')](function(_0x26f7c6){logger[_0xeba4('0xd')](_0xeba4('0x1f'),_0x26f7c6[_0xeba4('0x10')],_0x150342);_0x653505(_0x15c522[_0xeba4('0xd')](0x1f4,_0x26f7c6[_0xeba4('0x10')]));});});};exports[_0xeba4('0x20')]=function(_0x33984b){var _0x32f98e=this;return new Promise(function(_0x26fed0,_0x2a1bb1){return db[_0xeba4('0x13')][_0xeba4('0x21')]({'where':_0x33984b[_0xeba4('0x15')]?_0x33984b[_0xeba4('0x15')]['where']||null:null})[_0xeba4('0x7')](function(_0x2b5b4f){logger[_0xeba4('0x8')](_0xeba4('0x20'),_0x33984b);logger[_0xeba4('0xa')](_0xeba4('0x20'),_0x33984b,JSON[_0xeba4('0xc')](_0x2b5b4f));_0x26fed0(_0x2b5b4f);})[_0xeba4('0x12')](function(_0x51f3fc){logger[_0xeba4('0xd')](_0xeba4('0x20'),_0x51f3fc[_0xeba4('0x10')],_0x33984b);_0x2a1bb1(_0x32f98e[_0xeba4('0xd')](0x1f4,_0x51f3fc[_0xeba4('0x10')]));});});}; \ No newline at end of file +var _0x5fad=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','CmHopperBlack,\x20%s,\x20%s','message','result','catch','GetCmHopperBlack','findAll','options','raw','where','attributes','limit','include','map','model','then','UpdateCmHopperBlack','CmHopperBlack','body','DestroyCmHopperBlack','destroy','lodash'];(function(_0x3e5bc8,_0x457d89){var _0xfd84bc=function(_0x1a766c){while(--_0x1a766c){_0x3e5bc8['push'](_0x3e5bc8['shift']());}};_0xfd84bc(++_0x457d89);}(_0x5fad,0x1c7));var _0xd5fa=function(_0xcfc88f,_0x239d01){_0xcfc88f=_0xcfc88f-0x0;var _0x20cfc0=_0x5fad[_0xcfc88f];return _0x20cfc0;};'use strict';var _=require(_0xd5fa('0x0'));var util=require('util');var moment=require(_0xd5fa('0x1'));var BPromise=require('bluebird');var rs=require(_0xd5fa('0x2'));var fs=require('fs');var Redis=require(_0xd5fa('0x3'));var db=require(_0xd5fa('0x4'))['db'];var utils=require(_0xd5fa('0x5'));var logger=require(_0xd5fa('0x6'))(_0xd5fa('0x7'));var config=require(_0xd5fa('0x8'));var jayson=require(_0xd5fa('0x9'));var client=jayson['client'][_0xd5fa('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x7ea21f,_0xab33e7,_0x2dc9c9){return new BPromise(function(_0x40c1ae,_0x167456){return client[_0xd5fa('0xb')](_0x7ea21f,_0x2dc9c9)['then'](function(_0x194f85){logger[_0xd5fa('0xc')]('CmHopperBlack,\x20%s,\x20%s',_0xab33e7,'request\x20sent');logger[_0xd5fa('0xd')](_0xd5fa('0xe'),_0xab33e7,_0xd5fa('0xf'),JSON[_0xd5fa('0x10')](_0x194f85));if(_0x194f85['error']){if(_0x194f85[_0xd5fa('0x11')]['code']===0x1f4){logger[_0xd5fa('0x11')](_0xd5fa('0x12'),_0xab33e7,_0x194f85['error']['message']);return _0x167456(_0x194f85[_0xd5fa('0x11')][_0xd5fa('0x13')]);}logger[_0xd5fa('0x11')](_0xd5fa('0x12'),_0xab33e7,_0x194f85['error'][_0xd5fa('0x13')]);return _0x40c1ae(_0x194f85['error'][_0xd5fa('0x13')]);}else{logger[_0xd5fa('0xc')](_0xd5fa('0x12'),_0xab33e7,_0xd5fa('0xf'));_0x40c1ae(_0x194f85[_0xd5fa('0x14')][_0xd5fa('0x13')]);}})[_0xd5fa('0x15')](function(_0x7dbdb6){logger[_0xd5fa('0x11')](_0xd5fa('0x12'),_0xab33e7,_0x7dbdb6);_0x167456(_0x7dbdb6);});});}exports[_0xd5fa('0x16')]=function(_0x6bdc57){var _0x99ac87=this;return new Promise(function(_0x2dfd77,_0x3fb809){return db['CmHopperBlack'][_0xd5fa('0x17')]({'raw':_0x6bdc57[_0xd5fa('0x18')]?_0x6bdc57['options'][_0xd5fa('0x19')]===undefined?!![]:![]:!![],'where':_0x6bdc57[_0xd5fa('0x18')]?_0x6bdc57[_0xd5fa('0x18')][_0xd5fa('0x1a')]||null:null,'attributes':_0x6bdc57['options']?_0x6bdc57[_0xd5fa('0x18')][_0xd5fa('0x1b')]||null:null,'limit':_0x6bdc57[_0xd5fa('0x18')]?_0x6bdc57[_0xd5fa('0x18')][_0xd5fa('0x1c')]||null:null,'include':_0x6bdc57[_0xd5fa('0x18')]?_0x6bdc57[_0xd5fa('0x18')][_0xd5fa('0x1d')]?_[_0xd5fa('0x1e')](_0x6bdc57[_0xd5fa('0x18')][_0xd5fa('0x1d')],function(_0x4d8c5f){return{'model':db[_0x4d8c5f['model']],'as':_0x4d8c5f['as'],'attributes':_0x4d8c5f[_0xd5fa('0x1b')],'include':_0x4d8c5f[_0xd5fa('0x1d')]?_[_0xd5fa('0x1e')](_0x4d8c5f['include'],function(_0x107ee0){return{'model':db[_0x107ee0[_0xd5fa('0x1f')]],'as':_0x107ee0['as'],'attributes':_0x107ee0[_0xd5fa('0x1b')],'include':_0x107ee0['include']?_[_0xd5fa('0x1e')](_0x107ee0['include'],function(_0x7409b8){return{'model':db[_0x7409b8[_0xd5fa('0x1f')]],'as':_0x7409b8['as'],'attributes':_0x7409b8[_0xd5fa('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xd5fa('0x20')](function(_0x349669){logger['info'](_0xd5fa('0x16'),_0x6bdc57);logger[_0xd5fa('0xd')]('GetCmHopperBlack',_0x6bdc57,JSON[_0xd5fa('0x10')](_0x349669));_0x2dfd77(_0x349669);})['catch'](function(_0x4e8280){logger[_0xd5fa('0x11')](_0xd5fa('0x16'),_0x4e8280[_0xd5fa('0x13')],_0x6bdc57);_0x3fb809(_0x99ac87[_0xd5fa('0x11')](0x1f4,_0x4e8280[_0xd5fa('0x13')]));});});};exports[_0xd5fa('0x21')]=function(_0x5aa855){var _0x323ddf=this;return new Promise(function(_0x39dfe6,_0x40cf18){return db[_0xd5fa('0x22')]['update'](_0x5aa855[_0xd5fa('0x23')],{'raw':_0x5aa855[_0xd5fa('0x18')]?_0x5aa855['options'][_0xd5fa('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5aa855[_0xd5fa('0x18')]?_0x5aa855[_0xd5fa('0x18')][_0xd5fa('0x1a')]||null:null,'attributes':_0x5aa855[_0xd5fa('0x18')]?_0x5aa855[_0xd5fa('0x18')]['attributes']||null:null,'limit':_0x5aa855['options']?_0x5aa855['options'][_0xd5fa('0x1c')]||null:null})['then'](function(_0x585ed9){logger['info'](_0xd5fa('0x21'),_0x5aa855);logger[_0xd5fa('0xd')](_0xd5fa('0x21'),_0x5aa855,JSON[_0xd5fa('0x10')](_0x585ed9));_0x39dfe6(_0x585ed9);})['catch'](function(_0x601c1e){logger['error'](_0xd5fa('0x21'),_0x601c1e['message'],_0x5aa855);_0x40cf18(_0x323ddf['error'](0x1f4,_0x601c1e[_0xd5fa('0x13')]));});});};exports[_0xd5fa('0x24')]=function(_0x4370d9){var _0x380fb0=this;return new Promise(function(_0x23bfd6,_0x25c205){return db[_0xd5fa('0x22')][_0xd5fa('0x25')]({'where':_0x4370d9[_0xd5fa('0x18')]?_0x4370d9[_0xd5fa('0x18')]['where']||null:null})[_0xd5fa('0x20')](function(_0x43cb8e){logger['info'](_0xd5fa('0x24'),_0x4370d9);logger['debug'](_0xd5fa('0x24'),_0x4370d9,JSON[_0xd5fa('0x10')](_0x43cb8e));_0x23bfd6(_0x43cb8e);})[_0xd5fa('0x15')](function(_0x3cd399){logger[_0xd5fa('0x11')]('DestroyCmHopperBlack',_0x3cd399[_0xd5fa('0x13')],_0x4370d9);_0x25c205(_0x380fb0['error'](0x1f4,_0x3cd399['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 5870fbe..c088820 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 _0x33af=['isAuthenticated','describe','show','put','/:id','update','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmHopperBlack.controller','get','index','/describe'];(function(_0x5931aa,_0x2c8a5c){var _0x39ed1c=function(_0x30c43c){while(--_0x30c43c){_0x5931aa['push'](_0x5931aa['shift']());}};_0x39ed1c(++_0x2c8a5c);}(_0x33af,0xec));var _0xf33a=function(_0x54af0d,_0x3e5db0){_0x54af0d=_0x54af0d-0x0;var _0x57b08d=_0x33af[_0x54af0d];return _0x57b08d;};'use strict';var multer=require('multer');var util=require(_0xf33a('0x0'));var path=require('path');var timeout=require(_0xf33a('0x1'));var express=require(_0xf33a('0x2'));var router=express[_0xf33a('0x3')]();var fs_extra=require(_0xf33a('0x4'));var auth=require(_0xf33a('0x5'));var interaction=require(_0xf33a('0x6'));var config=require('../../config/environment');var controller=require(_0xf33a('0x7'));router[_0xf33a('0x8')]('/',auth['isAuthenticated'](),controller[_0xf33a('0x9')]);router[_0xf33a('0x8')](_0xf33a('0xa'),auth[_0xf33a('0xb')](),controller[_0xf33a('0xc')]);router[_0xf33a('0x8')]('/:id',auth[_0xf33a('0xb')](),controller[_0xf33a('0xd')]);router[_0xf33a('0xe')](_0xf33a('0xf'),auth[_0xf33a('0xb')](),controller[_0xf33a('0x10')]);router['delete']('/:id',auth[_0xf33a('0xb')](),controller[_0xf33a('0x11')]);module[_0xf33a('0x12')]=router; \ No newline at end of file +var _0xfb65=['put','update','destroy','exports','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','/describe','isAuthenticated','describe','/:id','show'];(function(_0x59413e,_0x250fd4){var _0x44ab07=function(_0x57b05c){while(--_0x57b05c){_0x59413e['push'](_0x59413e['shift']());}};_0x44ab07(++_0x250fd4);}(_0xfb65,0x82));var _0x5fb6=function(_0x24050a,_0x1ce736){_0x24050a=_0x24050a-0x0;var _0x4d27aa=_0xfb65[_0x24050a];return _0x4d27aa;};'use strict';var multer=require('multer');var util=require(_0x5fb6('0x0'));var path=require(_0x5fb6('0x1'));var timeout=require('connect-timeout');var express=require(_0x5fb6('0x2'));var router=express['Router']();var fs_extra=require(_0x5fb6('0x3'));var auth=require(_0x5fb6('0x4'));var interaction=require(_0x5fb6('0x5'));var config=require(_0x5fb6('0x6'));var controller=require(_0x5fb6('0x7'));router[_0x5fb6('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x5fb6('0x8')](_0x5fb6('0x9'),auth[_0x5fb6('0xa')](),controller[_0x5fb6('0xb')]);router['get'](_0x5fb6('0xc'),auth[_0x5fb6('0xa')](),controller[_0x5fb6('0xd')]);router[_0x5fb6('0xe')]('/:id',auth[_0x5fb6('0xa')](),controller[_0x5fb6('0xf')]);router['delete'](_0x5fb6('0xc'),auth[_0x5fb6('0xa')](),controller[_0x5fb6('0x10')]);module[_0x5fb6('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 6bbeb99..2819013 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 _0x7576=['STRING','getDataValue','endtime','setDataValue','diff','BOOLEAN','sequelize','moment','exports','INTEGER','DATE'];(function(_0x85948c,_0x5cc1c0){var _0x24f542=function(_0x5a1050){while(--_0x5a1050){_0x85948c['push'](_0x85948c['shift']());}};_0x24f542(++_0x5cc1c0);}(_0x7576,0xe2));var _0x6757=function(_0x14a64d,_0x4e0614){_0x14a64d=_0x14a64d-0x0;var _0x1ffd33=_0x7576[_0x14a64d];return _0x1ffd33;};'use strict';var Sequelize=require(_0x6757('0x0'));var moment=require(_0x6757('0x1'));module[_0x6757('0x2')]={'state':{'type':Sequelize[_0x6757('0x3')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x6757('0x4')]},'countbusyretry':{'type':Sequelize[_0x6757('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x6757('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x6757('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x6757('0x5')]},'originatecalleridnum':{'type':Sequelize[_0x6757('0x5')]},'originatecalleridname':{'type':Sequelize[_0x6757('0x5')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x6757('0x5')]},'starttime':{'type':Sequelize[_0x6757('0x4')]},'responsetime':{'type':Sequelize[_0x6757('0x4')]},'answertime':{'type':Sequelize[_0x6757('0x4')]},'droptime':{'type':Sequelize[_0x6757('0x4')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x6757('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x6757('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x6757('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x6757('0x5')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x6757('0x5')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x6757('0x5')]},'secondDisposition':{'type':Sequelize[_0x6757('0x5')]},'thirdDisposition':{'type':Sequelize[_0x6757('0x5')]},'dispositionat':{'type':Sequelize[_0x6757('0x4')],'set':function(_0x5f16f1){var _0x4a6f4b=this[_0x6757('0x6')](_0x6757('0x7'));if(_0x4a6f4b&&_0x5f16f1){this[_0x6757('0x8')]('followuptime',moment(_0x5f16f1)[_0x6757('0x9')](moment(_0x4a6f4b),'seconds'));}}},'amd':{'type':Sequelize[_0x6757('0xa')],'defaultValue':![]},'fax':{'type':Sequelize[_0x6757('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x6757('0x4')]},'callback':{'type':Sequelize[_0x6757('0xa')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x6757('0x5')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0x6757('0x5')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x6757('0x4')]},'recallme':{'type':Sequelize[_0x6757('0xa')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x6757('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x6757('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x6757('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x33d9=['getDataValue','endtime','setDataValue','followuptime','seconds','BOOLEAN','sequelize','exports','STRING','DATE','INTEGER'];(function(_0xa56191,_0x383c9a){var _0x19ad89=function(_0x3249da){while(--_0x3249da){_0xa56191['push'](_0xa56191['shift']());}};_0x19ad89(++_0x383c9a);}(_0x33d9,0x10e));var _0x933d=function(_0x24d957,_0x45fd49){_0x24d957=_0x24d957-0x0;var _0x264229=_0x33d9[_0x24d957];return _0x264229;};'use strict';var Sequelize=require(_0x933d('0x0'));var moment=require('moment');module[_0x933d('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x933d('0x2')]},'scheduledat':{'type':Sequelize[_0x933d('0x3')]},'countbusyretry':{'type':Sequelize[_0x933d('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x933d('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x933d('0x4')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x933d('0x4')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x933d('0x2')]},'originatecalleridnum':{'type':Sequelize[_0x933d('0x2')]},'originatecalleridname':{'type':Sequelize[_0x933d('0x2')]},'calleridnum':{'type':Sequelize[_0x933d('0x2')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x933d('0x3')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x933d('0x3')]},'ringtime':{'type':Sequelize[_0x933d('0x4')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x933d('0x4')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x933d('0x4')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x933d('0x4')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x933d('0x2')]},'campaign':{'type':Sequelize[_0x933d('0x2')]},'campaigntype':{'type':Sequelize[_0x933d('0x2')]},'membername':{'type':Sequelize[_0x933d('0x2')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x933d('0x2')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x933d('0x2')]},'dispositionat':{'type':Sequelize[_0x933d('0x3')],'set':function(_0x167b4e){var _0x1e513f=this[_0x933d('0x5')](_0x933d('0x6'));if(_0x1e513f&&_0x167b4e){this[_0x933d('0x7')](_0x933d('0x8'),moment(_0x167b4e)['diff'](moment(_0x1e513f),_0x933d('0x9')));}}},'amd':{'type':Sequelize[_0x933d('0xa')],'defaultValue':![]},'fax':{'type':Sequelize[_0x933d('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x933d('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x933d('0x3')]},'callback':{'type':Sequelize[_0x933d('0xa')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0x933d('0x2')],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x933d('0xa')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x933d('0x3')]},'countnosuchnumberretry':{'type':Sequelize[_0x933d('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x933d('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x933d('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x933d('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x933d('0x4')],'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 8d41c93..7c8fb70 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 _0x187d=['state\x20=\x20?','calleridnum\x20NOT\x20IN\x20(?)','select','from','cm_hopper','calleridnum','cm_hopper_final','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','insert','into','CampaignId','CampaignId\x20=\x20?','state','checkContactHopper','CmHopper','findOne','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','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','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','update','destroy','error','stack','name','index','map','CmHopperFinal','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','where','filter','merge','includeAll','include','findAll','then','rows','catch','show','params','fields','options','find','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','COUNT','sequelize','literal','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x200,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2022,\x201,\x20null','moveContactsQueueCampaignHopperFinal','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','VoiceQueueId\x20=\x20?','toString'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0x187d,0x93));var _0xd187=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0x187d[_0x4dbaad];return _0x226c72;};'use strict';var emlformat=require(_0xd187('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd187('0x1'));var jsonpatch=require(_0xd187('0x2'));var rp=require(_0xd187('0x3'));var moment=require(_0xd187('0x4'));var BPromise=require(_0xd187('0x5'));var Mustache=require(_0xd187('0x6'));var util=require('util');var path=require(_0xd187('0x7'));var sox=require(_0xd187('0x8'));var csv=require('to-csv');var ejs=require(_0xd187('0x9'));var fs=require('fs');var fs_extra=require(_0xd187('0xa'));var _=require(_0xd187('0xb'));var squel=require(_0xd187('0xc'));var crypto=require(_0xd187('0xd'));var jsforce=require(_0xd187('0xe'));var deskjs=require(_0xd187('0xf'));var toCsv=require(_0xd187('0x10'));var querystring=require('querystring');var Papa=require(_0xd187('0x11'));var Redis=require(_0xd187('0x12'));var authService=require(_0xd187('0x13'));var qs=require(_0xd187('0x14'));var as=require(_0xd187('0x15'));var hardwareService=require(_0xd187('0x16'));var logger=require('../../config/logger')(_0xd187('0x17'));var utils=require(_0xd187('0x18'));var config=require(_0xd187('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xd187('0x1a'))['db'];function respondWithStatusCode(_0x4545cf,_0x32ba07){_0x32ba07=_0x32ba07||0xcc;return function(_0x59ee4a){if(_0x59ee4a){return _0x4545cf[_0xd187('0x1b')](_0x32ba07);}return _0x4545cf[_0xd187('0x1c')](_0x32ba07)[_0xd187('0x1d')]();};}function respondWithResult(_0x126d1a,_0x517b25){_0x517b25=_0x517b25||0xc8;return function(_0x39a927){if(_0x39a927){return _0x126d1a[_0xd187('0x1c')](_0x517b25)[_0xd187('0x1e')](_0x39a927);}};}function respondWithFilteredResult(_0x188cfe,_0x4c8f68){return function(_0x245d3e){if(_0x245d3e){var _0x52a208=typeof _0x4c8f68['offset']===_0xd187('0x1f')&&typeof _0x4c8f68['limit']==='undefined';var _0x207b36=_0x245d3e[_0xd187('0x20')];var _0x374fe0=_0x52a208?0x0:_0x4c8f68[_0xd187('0x21')];var _0x21df74=_0x52a208?_0x245d3e[_0xd187('0x20')]:_0x4c8f68[_0xd187('0x21')]+_0x4c8f68[_0xd187('0x22')];var _0x4f2f88;if(_0x21df74>=_0x207b36){_0x21df74=_0x207b36;_0x4f2f88=0xc8;}else{_0x4f2f88=0xce;}_0x188cfe[_0xd187('0x1c')](_0x4f2f88);return _0x188cfe[_0xd187('0x23')](_0xd187('0x24'),_0x374fe0+'-'+_0x21df74+'/'+_0x207b36)[_0xd187('0x1e')](_0x245d3e);}return null;};}function patchUpdates(_0x5204ee){return function(_0x2f7fb3){try{jsonpatch[_0xd187('0x25')](_0x2f7fb3,_0x5204ee,!![]);}catch(_0xc5bba5){return BPromise['reject'](_0xc5bba5);}return _0x2f7fb3['save']();};}function saveUpdates(_0x57cf1d,_0x435d94){return function(_0x33741d){if(_0x33741d){return _0x33741d[_0xd187('0x26')](_0x57cf1d)['then'](function(_0x2c07c8){return _0x2c07c8;});}return null;};}function removeEntity(_0x57186b,_0x145771){return function(_0x5a7a23){if(_0x5a7a23){return _0x5a7a23[_0xd187('0x27')]()['then'](function(){_0x57186b['status'](0xcc)[_0xd187('0x1d')]();});}};}function handleEntityNotFound(_0x4d992b,_0x12da33){return function(_0x598aa4){if(!_0x598aa4){_0x4d992b['sendStatus'](0x194);}return _0x598aa4;};}function handleError(_0x4eac6a,_0x848ddd){_0x848ddd=_0x848ddd||0x1f4;return function(_0xeff822){logger[_0xd187('0x28')](_0xeff822[_0xd187('0x29')]);if(_0xeff822['name']){delete _0xeff822[_0xd187('0x2a')];}_0x4eac6a[_0xd187('0x1c')](_0x848ddd)['send'](_0xeff822);};}exports[_0xd187('0x2b')]=function(_0x1c87ee,_0x34febe){var _0x4c50a5={},_0x15e2e8={},_0x56e292={'count':0x0,'rows':[]};var _0x263e31=_[_0xd187('0x2c')](db[_0xd187('0x2d')][_0xd187('0x2e')],function(_0x489f2e){return{'name':_0x489f2e[_0xd187('0x2f')],'type':_0x489f2e[_0xd187('0x30')]['key']};});_0x15e2e8['model']=_[_0xd187('0x2c')](_0x263e31,_0xd187('0x2a'));_0x15e2e8[_0xd187('0x31')]=_[_0xd187('0x32')](_0x1c87ee[_0xd187('0x31')]);_0x15e2e8[_0xd187('0x33')]=_[_0xd187('0x34')](_0x15e2e8[_0xd187('0x35')],_0x15e2e8['query']);_0x4c50a5[_0xd187('0x36')]=_[_0xd187('0x34')](_0x15e2e8[_0xd187('0x35')],qs['fields'](_0x1c87ee[_0xd187('0x31')]['fields']));_0x4c50a5[_0xd187('0x36')]=_0x4c50a5[_0xd187('0x36')][_0xd187('0x37')]?_0x4c50a5['attributes']:_0x15e2e8['model'];if(!_0x1c87ee[_0xd187('0x31')][_0xd187('0x38')]('nolimit')){_0x4c50a5[_0xd187('0x22')]=qs[_0xd187('0x22')](_0x1c87ee[_0xd187('0x31')]['limit']);_0x4c50a5['offset']=qs[_0xd187('0x21')](_0x1c87ee[_0xd187('0x31')]['offset']);}_0x4c50a5['order']=qs['sort'](_0x1c87ee[_0xd187('0x31')]['sort']);_0x4c50a5[_0xd187('0x39')]=qs[_0xd187('0x33')](_['pick'](_0x1c87ee[_0xd187('0x31')],_0x15e2e8['filters']),_0x263e31);if(_0x1c87ee[_0xd187('0x31')][_0xd187('0x3a')]){_0x4c50a5['where']=_[_0xd187('0x3b')](_0x4c50a5[_0xd187('0x39')],{'$or':_['map'](_0x263e31,function(_0x4399a5){if(_0x4399a5['type']!=='VIRTUAL'){var _0x26b06d={};_0x26b06d[_0x4399a5[_0xd187('0x2a')]]={'$like':'%'+_0x1c87ee[_0xd187('0x31')][_0xd187('0x3a')]+'%'};return _0x26b06d;}})});}_0x4c50a5=_[_0xd187('0x3b')]({},_0x4c50a5,_0x1c87ee['options']);var _0x8860c={'where':_0x4c50a5[_0xd187('0x39')]};return db[_0xd187('0x2d')]['count'](_0x8860c)['then'](function(_0x538c05){_0x56e292['count']=_0x538c05;if(_0x1c87ee[_0xd187('0x31')][_0xd187('0x3c')]){_0x4c50a5[_0xd187('0x3d')]=[{'all':!![]}];}return db[_0xd187('0x2d')][_0xd187('0x3e')](_0x4c50a5);})[_0xd187('0x3f')](function(_0x4699e1){_0x56e292[_0xd187('0x40')]=_0x4699e1;return _0x56e292;})['then'](respondWithFilteredResult(_0x34febe,_0x4c50a5))[_0xd187('0x41')](handleError(_0x34febe,null));};exports[_0xd187('0x42')]=function(_0x31d9d2,_0x51c7fc){var _0x21cbf6={'raw':!![],'where':{'id':_0x31d9d2[_0xd187('0x43')]['id']}},_0x48c100={};_0x48c100[_0xd187('0x35')]=_[_0xd187('0x32')](db[_0xd187('0x2d')][_0xd187('0x2e')]);_0x48c100['query']=_[_0xd187('0x32')](_0x31d9d2[_0xd187('0x31')]);_0x48c100[_0xd187('0x33')]=_[_0xd187('0x34')](_0x48c100['model'],_0x48c100[_0xd187('0x31')]);_0x21cbf6[_0xd187('0x36')]=_['intersection'](_0x48c100[_0xd187('0x35')],qs[_0xd187('0x44')](_0x31d9d2['query']['fields']));_0x21cbf6[_0xd187('0x36')]=_0x21cbf6[_0xd187('0x36')]['length']?_0x21cbf6['attributes']:_0x48c100['model'];if(_0x31d9d2[_0xd187('0x31')][_0xd187('0x3c')]){_0x21cbf6[_0xd187('0x3d')]=[{'all':!![]}];}_0x21cbf6=_[_0xd187('0x3b')]({},_0x21cbf6,_0x31d9d2[_0xd187('0x45')]);return db[_0xd187('0x2d')][_0xd187('0x46')](_0x21cbf6)['then'](handleEntityNotFound(_0x51c7fc,null))[_0xd187('0x3f')](respondWithResult(_0x51c7fc,null))[_0xd187('0x41')](handleError(_0x51c7fc,null));};exports[_0xd187('0x47')]=function(_0x3ce4a1,_0x3f5def){return db[_0xd187('0x2d')][_0xd187('0x47')]()[_0xd187('0x3f')](respondWithResult(_0x3f5def,null))['catch'](handleError(_0x3f5def,null));};exports[_0xd187('0x26')]=function(_0x2657be,_0x4523c8){if(_0x2657be[_0xd187('0x48')][_0xd187('0x49')]){delete _0x2657be['body'][_0xd187('0x49')];}return db[_0xd187('0x2d')]['find']({'where':{'uniqueid':_0x2657be[_0xd187('0x43')]['id']}})[_0xd187('0x3f')](handleEntityNotFound(_0x4523c8,null))['then'](saveUpdates(_0x2657be['body'],null))['then'](respondWithResult(_0x4523c8,null))['catch'](handleError(_0x4523c8,null));};exports[_0xd187('0x4a')]=function(_0x22f432,_0x12d448,_0x1bcc3a){return db[_0xd187('0x2d')][_0xd187('0x3e')]({'raw':![],'where':{'VoiceQueueId':_0x22f432[_0xd187('0x43')]['id']},'attributes':[[db['sequelize']['fn'](_0xd187('0x4b'),db[_0xd187('0x4c')]['fn']('IF',db[_0xd187('0x4c')][_0xd187('0x4d')]('`state`\x20=\x200,\x201,\x20null'))),_0xd187('0x4e')],[db['sequelize']['fn']('COUNT',db[_0xd187('0x4c')]['fn']('IF',db['sequelize'][_0xd187('0x4d')](_0xd187('0x4f')))),_0xd187('0x50')],[db[_0xd187('0x4c')]['fn'](_0xd187('0x4b'),db[_0xd187('0x4c')]['fn']('IF',db[_0xd187('0x4c')][_0xd187('0x4d')](_0xd187('0x51')))),'busyContacts'],[db[_0xd187('0x4c')]['fn'](_0xd187('0x4b'),db['sequelize']['fn']('IF',db[_0xd187('0x4c')][_0xd187('0x4d')](_0xd187('0x52')))),'congestionContacts'],[db[_0xd187('0x4c')]['fn'](_0xd187('0x4b'),db['sequelize']['fn']('IF',db[_0xd187('0x4c')][_0xd187('0x4d')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0xd187('0x53')],[db['sequelize']['fn'](_0xd187('0x4b'),db[_0xd187('0x4c')]['fn']('IF',db[_0xd187('0x4c')][_0xd187('0x4d')](_0xd187('0x54')))),_0xd187('0x55')],[db[_0xd187('0x4c')]['fn']('COUNT',db[_0xd187('0x4c')]['fn']('IF',db[_0xd187('0x4c')][_0xd187('0x4d')]('`state`\x20=\x2022,\x201,\x20null'))),_0xd187('0x56')],[db[_0xd187('0x4c')]['fn'](_0xd187('0x4b'),db[_0xd187('0x4c')]['fn']('IF',db[_0xd187('0x4c')][_0xd187('0x4d')](_0xd187('0x57')))),_0xd187('0x58')]]})[_0xd187('0x3f')](handleEntityNotFound(_0x12d448,null))[_0xd187('0x3f')](respondWithResult(_0x12d448,null))[_0xd187('0x41')](handleError(_0x12d448,null));};exports[_0xd187('0x59')]=function(_0x23271b,_0x288a04,_0x39934c){return db[_0xd187('0x2d')][_0xd187('0x3e')]({'raw':![],'where':{'CampaignId':_0x23271b[_0xd187('0x43')]['id']},'attributes':[[db[_0xd187('0x4c')]['fn'](_0xd187('0x4b'),db['sequelize']['fn']('IF',db[_0xd187('0x4c')]['literal'](_0xd187('0x5a')))),_0xd187('0x4e')],[db[_0xd187('0x4c')]['fn'](_0xd187('0x4b'),db['sequelize']['fn']('IF',db[_0xd187('0x4c')][_0xd187('0x4d')]('`state`\x20=\x203,\x201,\x20null'))),'noAnswerContacts'],[db[_0xd187('0x4c')]['fn'](_0xd187('0x4b'),db[_0xd187('0x4c')]['fn']('IF',db[_0xd187('0x4c')]['literal'](_0xd187('0x51')))),'busyContacts'],[db[_0xd187('0x4c')]['fn'](_0xd187('0x4b'),db[_0xd187('0x4c')]['fn']('IF',db[_0xd187('0x4c')]['literal'](_0xd187('0x52')))),_0xd187('0x5b')],[db[_0xd187('0x4c')]['fn'](_0xd187('0x4b'),db[_0xd187('0x4c')]['fn']('IF',db['sequelize']['literal'](_0xd187('0x5c')))),_0xd187('0x53')],[db[_0xd187('0x4c')]['fn'](_0xd187('0x4b'),db[_0xd187('0x4c')]['fn']('IF',db[_0xd187('0x4c')][_0xd187('0x4d')](_0xd187('0x54')))),_0xd187('0x55')],[db[_0xd187('0x4c')]['fn'](_0xd187('0x4b'),db[_0xd187('0x4c')]['fn']('IF',db['sequelize'][_0xd187('0x4d')](_0xd187('0x5d')))),'reCallContacts'],[db[_0xd187('0x4c')]['fn'](_0xd187('0x4b'),db['sequelize']['fn']('IF',db['sequelize'][_0xd187('0x4d')](_0xd187('0x57')))),_0xd187('0x58')]]})[_0xd187('0x3f')](handleEntityNotFound(_0x288a04,null))['then'](respondWithResult(_0x288a04,null))[_0xd187('0x41')](handleError(_0x288a04,null));};exports[_0xd187('0x5e')]=function(_0x52e364,_0x569959,_0x3bca83){return db['VoiceQueue'][_0xd187('0x46')]({'where':{'id':_0x52e364[_0xd187('0x43')]['id']}})['then'](handleEntityNotFound(_0x569959,null))[_0xd187('0x3f')](function(_0x570c1c){var _0x317bc3;if(_0x570c1c){_0x317bc3=squel['insert']()['into']('cm_hopper')[_0xd187('0x5f')]([_0xd187('0x60'),_0xd187('0x61'),_0xd187('0x62'),_0xd187('0x63'),_0xd187('0x64'),_0xd187('0x65'),_0xd187('0x66')],squel['select']()[_0xd187('0x67')](_0xd187('0x68'),_0xd187('0x60'))['field'](_0xd187('0x69'),_0xd187('0x61'))[_0xd187('0x67')](_0xd187('0x6a'),'ContactId')[_0xd187('0x67')](_0xd187('0x6b'),'ListId')[_0xd187('0x67')](_0xd187('0x6c'),_0xd187('0x64'))[_0xd187('0x67')]('NOW()',_0xd187('0x65'))[_0xd187('0x67')]('NOW()',_0xd187('0x66'))['from']('cm_hopper_final')['where'](_0xd187('0x6d'),_0x52e364[_0xd187('0x43')]['id'][_0xd187('0x6e')]())[_0xd187('0x39')](_0xd187('0x6f'),_0x52e364[_0xd187('0x48')]['state'][_0xd187('0x6e')]())[_0xd187('0x39')]('calleridnum\x20IS\x20NOT\x20NULL')['where'](_0xd187('0x70'),squel[_0xd187('0x71')]()[_0xd187('0x67')](_0xd187('0x60'))[_0xd187('0x72')](_0xd187('0x73'))['where'](_0xd187('0x6d'),_0x52e364[_0xd187('0x43')]['id'][_0xd187('0x6e')]()))[_0xd187('0x39')](_0xd187('0x70'),squel[_0xd187('0x71')]()[_0xd187('0x67')](_0xd187('0x74'))[_0xd187('0x72')](_0xd187('0x75'))[_0xd187('0x39')](_0xd187('0x6d'),_0x52e364['params']['id']['toString']())[_0xd187('0x39')](_0xd187('0x76')))[_0xd187('0x77')](_0xd187('0x62')))[_0xd187('0x6e')]();return db[_0xd187('0x4c')]['query'](_0x317bc3);}return[];})[_0xd187('0x3f')](respondWithResult(_0x569959,null))['catch'](handleError(_0x569959,null));};exports[_0xd187('0x78')]=function(_0x520f86,_0x5cbfa6,_0x304117){return db['Campaign'][_0xd187('0x46')]({'where':{'id':_0x520f86[_0xd187('0x43')]['id']}})[_0xd187('0x3f')](handleEntityNotFound(_0x5cbfa6,null))[_0xd187('0x3f')](function(_0x1b93db){var _0x13a362;if(_0x1b93db){_0x13a362=squel[_0xd187('0x79')]()[_0xd187('0x7a')](_0xd187('0x73'))[_0xd187('0x5f')]([_0xd187('0x60'),_0xd187('0x61'),_0xd187('0x62'),_0xd187('0x63'),_0xd187('0x7b'),'createdAt',_0xd187('0x66')],squel[_0xd187('0x71')]()[_0xd187('0x67')](_0xd187('0x68'),'phone')[_0xd187('0x67')](_0xd187('0x69'),'scheduledAt')['field'](_0xd187('0x6a'),_0xd187('0x62'))[_0xd187('0x67')](_0xd187('0x6b'),_0xd187('0x63'))[_0xd187('0x67')]('ANY_VALUE(CampaignId)',_0xd187('0x7b'))[_0xd187('0x67')]('NOW()',_0xd187('0x65'))[_0xd187('0x67')](_0xd187('0x69'),_0xd187('0x66'))['from']('cm_hopper_final')[_0xd187('0x39')](_0xd187('0x7c'),_0x520f86[_0xd187('0x43')]['id']['toString']())[_0xd187('0x39')](_0xd187('0x6f'),_0x520f86[_0xd187('0x48')][_0xd187('0x7d')]['toString']())[_0xd187('0x39')]('calleridnum\x20IS\x20NOT\x20NULL')['where']('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()['field']('phone')['from'](_0xd187('0x73'))[_0xd187('0x39')]('CampaignId\x20=\x20?',_0x520f86[_0xd187('0x43')]['id'][_0xd187('0x6e')]()))[_0xd187('0x39')](_0xd187('0x70'),squel[_0xd187('0x71')]()['field'](_0xd187('0x74'))['from'](_0xd187('0x75'))[_0xd187('0x39')](_0xd187('0x7c'),_0x520f86[_0xd187('0x43')]['id'][_0xd187('0x6e')]())[_0xd187('0x39')](_0xd187('0x76')))['group'](_0xd187('0x62')))[_0xd187('0x6e')]();return db['sequelize'][_0xd187('0x31')](_0x13a362);}return[];})[_0xd187('0x3f')](respondWithResult(_0x5cbfa6,null))['catch'](handleError(_0x5cbfa6,null));};exports[_0xd187('0x7e')]=function(_0x3bd1d8,_0x224312,_0x45b522){return db[_0xd187('0x7f')][_0xd187('0x80')]({'where':{'VoiceQueueId':_0x3bd1d8[_0xd187('0x48')][_0xd187('0x64')],'CampaignId':_0x3bd1d8['body'][_0xd187('0x7b')],'ContactId':_0x3bd1d8[_0xd187('0x48')][_0xd187('0x62')]}})[_0xd187('0x3f')](handleEntityNotFound(_0x224312,null))[_0xd187('0x3f')](function(_0x400a9){if(_0x400a9){return _0x400a9;}return null;})['then'](respondWithResult(_0x224312,null))['catch'](handleError(_0x224312,null));}; \ No newline at end of file +var _0x2542=['Content-Range','apply','update','then','error','stack','name','index','map','CmHopperFinal','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','find','describe','body','uniqueid','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','noSuchContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','abandonedContacts','VoiceQueue','into','fromQuery','phone','ListId','VoiceQueueId','createdAt','updatedAt','field','ANY_VALUE(calleridnum)','scheduledAt','ContactId','ANY_VALUE(ListId)','NOW()','from','cm_hopper_final','VoiceQueueId\x20=\x20?','state\x20=\x20?','state','toString','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','select','calleridnum','group','moveContactsIvrCampaignHopperFinal','Campaign','CampaignId','ANY_VALUE(ContactId)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','cm_hopper','state\x20=\x204','checkContactHopper','CmHopper','findOne','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set'];(function(_0x21c650,_0x4d9492){var _0x19bbc3=function(_0x359b2b){while(--_0x359b2b){_0x21c650['push'](_0x21c650['shift']());}};_0x19bbc3(++_0x4d9492);}(_0x2542,0x169));var _0x2254=function(_0x21acd6,_0x3c980d){_0x21acd6=_0x21acd6-0x0;var _0x21545b=_0x2542[_0x21acd6];return _0x21545b;};'use strict';var emlformat=require(_0x2254('0x0'));var rimraf=require(_0x2254('0x1'));var zipdir=require(_0x2254('0x2'));var jsonpatch=require(_0x2254('0x3'));var rp=require('request-promise');var moment=require(_0x2254('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2254('0x5'));var util=require(_0x2254('0x6'));var path=require(_0x2254('0x7'));var sox=require(_0x2254('0x8'));var csv=require(_0x2254('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2254('0xa'));var _=require(_0x2254('0xb'));var squel=require(_0x2254('0xc'));var crypto=require(_0x2254('0xd'));var jsforce=require(_0x2254('0xe'));var deskjs=require(_0x2254('0xf'));var toCsv=require(_0x2254('0x9'));var querystring=require(_0x2254('0x10'));var Papa=require(_0x2254('0x11'));var Redis=require(_0x2254('0x12'));var authService=require(_0x2254('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x2254('0x14'));var hardwareService=require(_0x2254('0x15'));var logger=require(_0x2254('0x16'))(_0x2254('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2254('0x18'));var db=require(_0x2254('0x19'))['db'];function respondWithStatusCode(_0x116b70,_0xdcb670){_0xdcb670=_0xdcb670||0xcc;return function(_0x3c326b){if(_0x3c326b){return _0x116b70[_0x2254('0x1a')](_0xdcb670);}return _0x116b70['status'](_0xdcb670)[_0x2254('0x1b')]();};}function respondWithResult(_0x7c7ab0,_0x504749){_0x504749=_0x504749||0xc8;return function(_0x2f4de){if(_0x2f4de){return _0x7c7ab0[_0x2254('0x1c')](_0x504749)[_0x2254('0x1d')](_0x2f4de);}};}function respondWithFilteredResult(_0x145272,_0x26285a){return function(_0xbc5548){if(_0xbc5548){var _0x50f137=typeof _0x26285a[_0x2254('0x1e')]==='undefined'&&typeof _0x26285a[_0x2254('0x1f')]===_0x2254('0x20');var _0x170ffa=_0xbc5548[_0x2254('0x21')];var _0x1ae11e=_0x50f137?0x0:_0x26285a[_0x2254('0x1e')];var _0x497724=_0x50f137?_0xbc5548['count']:_0x26285a['offset']+_0x26285a[_0x2254('0x1f')];var _0x3a79f8;if(_0x497724>=_0x170ffa){_0x497724=_0x170ffa;_0x3a79f8=0xc8;}else{_0x3a79f8=0xce;}_0x145272[_0x2254('0x1c')](_0x3a79f8);return _0x145272[_0x2254('0x22')](_0x2254('0x23'),_0x1ae11e+'-'+_0x497724+'/'+_0x170ffa)[_0x2254('0x1d')](_0xbc5548);}return null;};}function patchUpdates(_0x487f72){return function(_0x28381e){try{jsonpatch[_0x2254('0x24')](_0x28381e,_0x487f72,!![]);}catch(_0x906cde){return BPromise['reject'](_0x906cde);}return _0x28381e['save']();};}function saveUpdates(_0x5bd982,_0x1e8a98){return function(_0x559af4){if(_0x559af4){return _0x559af4[_0x2254('0x25')](_0x5bd982)['then'](function(_0x5713e4){return _0x5713e4;});}return null;};}function removeEntity(_0x4d8faf,_0x540020){return function(_0x5e5edb){if(_0x5e5edb){return _0x5e5edb['destroy']()[_0x2254('0x26')](function(){_0x4d8faf[_0x2254('0x1c')](0xcc)[_0x2254('0x1b')]();});}};}function handleEntityNotFound(_0x265467,_0x13522d){return function(_0x1349c9){if(!_0x1349c9){_0x265467['sendStatus'](0x194);}return _0x1349c9;};}function handleError(_0x4a8274,_0x1ada42){_0x1ada42=_0x1ada42||0x1f4;return function(_0x4f6877){logger[_0x2254('0x27')](_0x4f6877[_0x2254('0x28')]);if(_0x4f6877[_0x2254('0x29')]){delete _0x4f6877[_0x2254('0x29')];}_0x4a8274[_0x2254('0x1c')](_0x1ada42)['send'](_0x4f6877);};}exports[_0x2254('0x2a')]=function(_0x2a789b,_0x21285d){var _0x37af8b={},_0x13366a={},_0x377c41={'count':0x0,'rows':[]};var _0x3214a7=_[_0x2254('0x2b')](db[_0x2254('0x2c')][_0x2254('0x2d')],function(_0x21c641){return{'name':_0x21c641[_0x2254('0x2e')],'type':_0x21c641[_0x2254('0x2f')][_0x2254('0x30')]};});_0x13366a[_0x2254('0x31')]=_[_0x2254('0x2b')](_0x3214a7,_0x2254('0x29'));_0x13366a[_0x2254('0x32')]=_[_0x2254('0x33')](_0x2a789b['query']);_0x13366a[_0x2254('0x34')]=_[_0x2254('0x35')](_0x13366a[_0x2254('0x31')],_0x13366a[_0x2254('0x32')]);_0x37af8b[_0x2254('0x36')]=_[_0x2254('0x35')](_0x13366a[_0x2254('0x31')],qs[_0x2254('0x37')](_0x2a789b[_0x2254('0x32')]['fields']));_0x37af8b[_0x2254('0x36')]=_0x37af8b[_0x2254('0x36')]['length']?_0x37af8b[_0x2254('0x36')]:_0x13366a[_0x2254('0x31')];if(!_0x2a789b[_0x2254('0x32')][_0x2254('0x38')]('nolimit')){_0x37af8b['limit']=qs[_0x2254('0x1f')](_0x2a789b['query'][_0x2254('0x1f')]);_0x37af8b[_0x2254('0x1e')]=qs[_0x2254('0x1e')](_0x2a789b[_0x2254('0x32')][_0x2254('0x1e')]);}_0x37af8b[_0x2254('0x39')]=qs[_0x2254('0x3a')](_0x2a789b['query'][_0x2254('0x3a')]);_0x37af8b[_0x2254('0x3b')]=qs[_0x2254('0x34')](_[_0x2254('0x3c')](_0x2a789b[_0x2254('0x32')],_0x13366a[_0x2254('0x34')]),_0x3214a7);if(_0x2a789b[_0x2254('0x32')][_0x2254('0x3d')]){_0x37af8b[_0x2254('0x3b')]=_[_0x2254('0x3e')](_0x37af8b['where'],{'$or':_[_0x2254('0x2b')](_0x3214a7,function(_0xde3e4a){if(_0xde3e4a[_0x2254('0x2f')]!==_0x2254('0x3f')){var _0x4c7cc3={};_0x4c7cc3[_0xde3e4a[_0x2254('0x29')]]={'$like':'%'+_0x2a789b[_0x2254('0x32')][_0x2254('0x3d')]+'%'};return _0x4c7cc3;}})});}_0x37af8b=_[_0x2254('0x3e')]({},_0x37af8b,_0x2a789b[_0x2254('0x40')]);var _0x2602db={'where':_0x37af8b[_0x2254('0x3b')]};return db[_0x2254('0x2c')]['count'](_0x2602db)[_0x2254('0x26')](function(_0x5c15d7){_0x377c41[_0x2254('0x21')]=_0x5c15d7;if(_0x2a789b[_0x2254('0x32')][_0x2254('0x41')]){_0x37af8b[_0x2254('0x42')]=[{'all':!![]}];}return db[_0x2254('0x2c')][_0x2254('0x43')](_0x37af8b);})[_0x2254('0x26')](function(_0x568ec9){_0x377c41[_0x2254('0x44')]=_0x568ec9;return _0x377c41;})[_0x2254('0x26')](respondWithFilteredResult(_0x21285d,_0x37af8b))[_0x2254('0x45')](handleError(_0x21285d,null));};exports[_0x2254('0x46')]=function(_0x40d4da,_0x57cda2){var _0x22bb98={'raw':!![],'where':{'id':_0x40d4da[_0x2254('0x47')]['id']}},_0x1dec43={};_0x1dec43[_0x2254('0x31')]=_[_0x2254('0x33')](db['CmHopperFinal'][_0x2254('0x2d')]);_0x1dec43['query']=_[_0x2254('0x33')](_0x40d4da[_0x2254('0x32')]);_0x1dec43[_0x2254('0x34')]=_[_0x2254('0x35')](_0x1dec43[_0x2254('0x31')],_0x1dec43[_0x2254('0x32')]);_0x22bb98[_0x2254('0x36')]=_[_0x2254('0x35')](_0x1dec43[_0x2254('0x31')],qs[_0x2254('0x37')](_0x40d4da[_0x2254('0x32')][_0x2254('0x37')]));_0x22bb98[_0x2254('0x36')]=_0x22bb98['attributes'][_0x2254('0x48')]?_0x22bb98[_0x2254('0x36')]:_0x1dec43[_0x2254('0x31')];if(_0x40d4da['query'][_0x2254('0x41')]){_0x22bb98[_0x2254('0x42')]=[{'all':!![]}];}_0x22bb98=_[_0x2254('0x3e')]({},_0x22bb98,_0x40d4da[_0x2254('0x40')]);return db[_0x2254('0x2c')][_0x2254('0x49')](_0x22bb98)[_0x2254('0x26')](handleEntityNotFound(_0x57cda2,null))[_0x2254('0x26')](respondWithResult(_0x57cda2,null))[_0x2254('0x45')](handleError(_0x57cda2,null));};exports['describe']=function(_0x239ba0,_0x405eb2){return db[_0x2254('0x2c')][_0x2254('0x4a')]()[_0x2254('0x26')](respondWithResult(_0x405eb2,null))[_0x2254('0x45')](handleError(_0x405eb2,null));};exports[_0x2254('0x25')]=function(_0x438922,_0x3ac691){if(_0x438922[_0x2254('0x4b')]['uniqueid']){delete _0x438922[_0x2254('0x4b')][_0x2254('0x4c')];}return db['CmHopperFinal'][_0x2254('0x49')]({'where':{'uniqueid':_0x438922[_0x2254('0x47')]['id']}})[_0x2254('0x26')](handleEntityNotFound(_0x3ac691,null))[_0x2254('0x26')](saveUpdates(_0x438922['body'],null))[_0x2254('0x26')](respondWithResult(_0x3ac691,null))[_0x2254('0x45')](handleError(_0x3ac691,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0x26d01a,_0x3f0670,_0x23014b){return db[_0x2254('0x2c')]['findAll']({'raw':![],'where':{'VoiceQueueId':_0x26d01a[_0x2254('0x47')]['id']},'attributes':[[db[_0x2254('0x4d')]['fn'](_0x2254('0x4e'),db['sequelize']['fn']('IF',db['sequelize'][_0x2254('0x4f')](_0x2254('0x50')))),'noSuchContacts'],[db[_0x2254('0x4d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x2254('0x4d')][_0x2254('0x4f')](_0x2254('0x51')))),_0x2254('0x52')],[db[_0x2254('0x4d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x2254('0x4d')]['literal'](_0x2254('0x53')))),_0x2254('0x54')],[db[_0x2254('0x4d')]['fn'](_0x2254('0x4e'),db['sequelize']['fn']('IF',db[_0x2254('0x4d')][_0x2254('0x4f')]('`state`\x20=\x208,\x201,\x20null'))),'congestionContacts'],[db[_0x2254('0x4d')]['fn']('COUNT',db[_0x2254('0x4d')]['fn']('IF',db[_0x2254('0x4d')][_0x2254('0x4f')](_0x2254('0x55')))),_0x2254('0x56')],[db['sequelize']['fn']('COUNT',db[_0x2254('0x4d')]['fn']('IF',db['sequelize'][_0x2254('0x4f')]('`state`\x20=\x2011\x20,\x201,\x20null'))),'abandonedContacts'],[db['sequelize']['fn'](_0x2254('0x4e'),db[_0x2254('0x4d')]['fn']('IF',db[_0x2254('0x4d')][_0x2254('0x4f')](_0x2254('0x57')))),_0x2254('0x58')],[db[_0x2254('0x4d')]['fn'](_0x2254('0x4e'),db[_0x2254('0x4d')]['fn']('IF',db[_0x2254('0x4d')][_0x2254('0x4f')](_0x2254('0x59')))),_0x2254('0x5a')]]})[_0x2254('0x26')](handleEntityNotFound(_0x3f0670,null))[_0x2254('0x26')](respondWithResult(_0x3f0670,null))[_0x2254('0x45')](handleError(_0x3f0670,null));};exports[_0x2254('0x5b')]=function(_0x399ba2,_0x179cf1,_0x5b8909){return db[_0x2254('0x2c')][_0x2254('0x43')]({'raw':![],'where':{'CampaignId':_0x399ba2[_0x2254('0x47')]['id']},'attributes':[[db[_0x2254('0x4d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x2254('0x4d')][_0x2254('0x4f')](_0x2254('0x50')))),_0x2254('0x5c')],[db[_0x2254('0x4d')]['fn']('COUNT',db[_0x2254('0x4d')]['fn']('IF',db[_0x2254('0x4d')][_0x2254('0x4f')]('`state`\x20=\x203,\x201,\x20null'))),'noAnswerContacts'],[db[_0x2254('0x4d')]['fn']('COUNT',db[_0x2254('0x4d')]['fn']('IF',db[_0x2254('0x4d')]['literal'](_0x2254('0x53')))),_0x2254('0x54')],[db['sequelize']['fn'](_0x2254('0x4e'),db[_0x2254('0x4d')]['fn']('IF',db['sequelize']['literal'](_0x2254('0x5d')))),_0x2254('0x5e')],[db['sequelize']['fn']('COUNT',db[_0x2254('0x4d')]['fn']('IF',db['sequelize'][_0x2254('0x4f')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x2254('0x56')],[db[_0x2254('0x4d')]['fn'](_0x2254('0x4e'),db[_0x2254('0x4d')]['fn']('IF',db['sequelize'][_0x2254('0x4f')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x2254('0x5f')],[db[_0x2254('0x4d')]['fn']('COUNT',db[_0x2254('0x4d')]['fn']('IF',db[_0x2254('0x4d')]['literal'](_0x2254('0x57')))),_0x2254('0x58')],[db[_0x2254('0x4d')]['fn'](_0x2254('0x4e'),db['sequelize']['fn']('IF',db[_0x2254('0x4d')][_0x2254('0x4f')]('`state`\x20=\x2019,\x201,\x20null'))),_0x2254('0x5a')]]})[_0x2254('0x26')](handleEntityNotFound(_0x179cf1,null))['then'](respondWithResult(_0x179cf1,null))[_0x2254('0x45')](handleError(_0x179cf1,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x7075b1,_0x516595,_0x3cbd35){return db[_0x2254('0x60')]['find']({'where':{'id':_0x7075b1[_0x2254('0x47')]['id']}})['then'](handleEntityNotFound(_0x516595,null))[_0x2254('0x26')](function(_0x3e6070){var _0x38294d;if(_0x3e6070){_0x38294d=squel['insert']()[_0x2254('0x61')]('cm_hopper')[_0x2254('0x62')]([_0x2254('0x63'),'scheduledAt','ContactId',_0x2254('0x64'),_0x2254('0x65'),_0x2254('0x66'),_0x2254('0x67')],squel['select']()[_0x2254('0x68')](_0x2254('0x69'),_0x2254('0x63'))[_0x2254('0x68')]('NOW()',_0x2254('0x6a'))[_0x2254('0x68')]('ANY_VALUE(ContactId)',_0x2254('0x6b'))['field'](_0x2254('0x6c'),'ListId')['field']('ANY_VALUE(VoiceQueueId)',_0x2254('0x65'))['field'](_0x2254('0x6d'),_0x2254('0x66'))['field'](_0x2254('0x6d'),_0x2254('0x67'))[_0x2254('0x6e')](_0x2254('0x6f'))[_0x2254('0x3b')](_0x2254('0x70'),_0x7075b1['params']['id']['toString']())[_0x2254('0x3b')](_0x2254('0x71'),_0x7075b1[_0x2254('0x4b')][_0x2254('0x72')][_0x2254('0x73')]())[_0x2254('0x3b')](_0x2254('0x74'))[_0x2254('0x3b')](_0x2254('0x75'),squel[_0x2254('0x76')]()['field'](_0x2254('0x63'))[_0x2254('0x6e')]('cm_hopper')[_0x2254('0x3b')]('VoiceQueueId\x20=\x20?',_0x7075b1[_0x2254('0x47')]['id'][_0x2254('0x73')]()))['where'](_0x2254('0x75'),squel['select']()[_0x2254('0x68')](_0x2254('0x77'))[_0x2254('0x6e')](_0x2254('0x6f'))['where'](_0x2254('0x70'),_0x7075b1[_0x2254('0x47')]['id'][_0x2254('0x73')]())[_0x2254('0x3b')]('state\x20=\x204'))[_0x2254('0x78')](_0x2254('0x6b')))['toString']();return db[_0x2254('0x4d')][_0x2254('0x32')](_0x38294d);}return[];})['then'](respondWithResult(_0x516595,null))['catch'](handleError(_0x516595,null));};exports[_0x2254('0x79')]=function(_0x2f3650,_0x1a3fd9,_0x3058d9){return db[_0x2254('0x7a')][_0x2254('0x49')]({'where':{'id':_0x2f3650[_0x2254('0x47')]['id']}})[_0x2254('0x26')](handleEntityNotFound(_0x1a3fd9,null))[_0x2254('0x26')](function(_0x5df20f){var _0x10c44;if(_0x5df20f){_0x10c44=squel['insert']()[_0x2254('0x61')]('cm_hopper')[_0x2254('0x62')]([_0x2254('0x63'),_0x2254('0x6a'),'ContactId',_0x2254('0x64'),_0x2254('0x7b'),_0x2254('0x66'),_0x2254('0x67')],squel[_0x2254('0x76')]()[_0x2254('0x68')](_0x2254('0x69'),_0x2254('0x63'))[_0x2254('0x68')](_0x2254('0x6d'),_0x2254('0x6a'))[_0x2254('0x68')](_0x2254('0x7c'),'ContactId')[_0x2254('0x68')]('ANY_VALUE(ListId)',_0x2254('0x64'))[_0x2254('0x68')](_0x2254('0x7d'),_0x2254('0x7b'))[_0x2254('0x68')](_0x2254('0x6d'),_0x2254('0x66'))['field'](_0x2254('0x6d'),'updatedAt')[_0x2254('0x6e')]('cm_hopper_final')[_0x2254('0x3b')](_0x2254('0x7e'),_0x2f3650[_0x2254('0x47')]['id']['toString']())[_0x2254('0x3b')](_0x2254('0x71'),_0x2f3650[_0x2254('0x4b')][_0x2254('0x72')][_0x2254('0x73')]())[_0x2254('0x3b')](_0x2254('0x74'))[_0x2254('0x3b')]('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()[_0x2254('0x68')]('phone')[_0x2254('0x6e')](_0x2254('0x7f'))[_0x2254('0x3b')](_0x2254('0x7e'),_0x2f3650[_0x2254('0x47')]['id'][_0x2254('0x73')]()))[_0x2254('0x3b')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x2254('0x76')]()[_0x2254('0x68')](_0x2254('0x77'))['from'](_0x2254('0x6f'))[_0x2254('0x3b')](_0x2254('0x7e'),_0x2f3650[_0x2254('0x47')]['id'][_0x2254('0x73')]())[_0x2254('0x3b')](_0x2254('0x80')))[_0x2254('0x78')](_0x2254('0x6b')))['toString']();return db[_0x2254('0x4d')][_0x2254('0x32')](_0x10c44);}return[];})['then'](respondWithResult(_0x1a3fd9,null))['catch'](handleError(_0x1a3fd9,null));};exports[_0x2254('0x81')]=function(_0x54339e,_0x226c19,_0x10645f){return db[_0x2254('0x82')][_0x2254('0x83')]({'where':{'VoiceQueueId':_0x54339e[_0x2254('0x4b')][_0x2254('0x65')],'CampaignId':_0x54339e[_0x2254('0x4b')][_0x2254('0x7b')],'ContactId':_0x54339e['body']['ContactId']}})[_0x2254('0x26')](handleEntityNotFound(_0x226c19,null))[_0x2254('0x26')](function(_0x1e8617){if(_0x1e8617){return _0x1e8617;}return null;})[_0x2254('0x26')](respondWithResult(_0x226c19,null))[_0x2254('0x45')](handleError(_0x226c19,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index d5f15a2..3aa9fcc 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 _0x6698=['cm_hopper_final','calleridnum','uniqueid','util','moment','request-promise','path','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','CmHopperFinal'];(function(_0x282412,_0x9d9517){var _0x35a149=function(_0x47f699){while(--_0x47f699){_0x282412['push'](_0x282412['shift']());}};_0x35a149(++_0x9d9517);}(_0x6698,0x6f));var _0x8669=function(_0x2dbf18,_0x433638){_0x2dbf18=_0x2dbf18-0x0;var _0xf78904=_0x6698[_0x2dbf18];return _0xf78904;};'use strict';var _=require('lodash');var util=require(_0x8669('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x8669('0x1'));var BPromise=require('bluebird');var rp=require(_0x8669('0x2'));var fs=require('fs');var path=require(_0x8669('0x3'));var rimraf=require(_0x8669('0x4'));var config=require(_0x8669('0x5'));var attributes=require(_0x8669('0x6'));module[_0x8669('0x7')]=function(_0x18999d,_0xdcbce1){return _0x18999d['define'](_0x8669('0x8'),attributes,{'tableName':_0x8669('0x9'),'paranoid':![],'indexes':[{'name':_0x8669('0xa'),'fields':[_0x8669('0xa')]},{'name':_0x8669('0xb'),'fields':[_0x8669('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfee0=['rimraf','../../config/environment','./cmHopperFinal.attributes','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','moment','bluebird','request-promise','path'];(function(_0x3a9635,_0x1ab817){var _0x10d08c=function(_0x222242){while(--_0x222242){_0x3a9635['push'](_0x3a9635['shift']());}};_0x10d08c(++_0x1ab817);}(_0xfee0,0x70));var _0x0fee=function(_0x555b2f,_0x43b622){_0x555b2f=_0x555b2f-0x0;var _0x81c0a6=_0xfee0[_0x555b2f];return _0x81c0a6;};'use strict';var _=require(_0x0fee('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x0fee('0x1'));var BPromise=require(_0x0fee('0x2'));var rp=require(_0x0fee('0x3'));var fs=require('fs');var path=require(_0x0fee('0x4'));var rimraf=require(_0x0fee('0x5'));var config=require(_0x0fee('0x6'));var attributes=require(_0x0fee('0x7'));module['exports']=function(_0x20cadc,_0x2105c7){return _0x20cadc[_0x0fee('0x8')](_0x0fee('0x9'),attributes,{'tableName':_0x0fee('0xa'),'paranoid':![],'indexes':[{'name':'calleridnum','fields':[_0x0fee('0xb')]},{'name':_0x0fee('0xc'),'fields':[_0x0fee('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 d31a6bb..95eeba1 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.rpc.js +++ b/server/api/cmHopperFinal/cmHopperFinal.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x421d96,_0x49d690){var _0x14d8b0=function(_0x1ab345){while(--_0x1ab345){_0x421d96['push'](_0x421d96['shift']());}};_0x14d8b0(++_0x49d690);}(_0x7a54,0x106));var _0x47a5=function(_0x4706d1,_0x148519){_0x4706d1=_0x4706d1-0x0;var _0xd7f3a0=_0x7a54[_0x4706d1];return _0xd7f3a0;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _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(_0x1ed131,_0x22aeee){var _0x2acb5f=function(_0x283136){while(--_0x283136){_0x1ed131['push'](_0x1ed131['shift']());}};_0x2acb5f(++_0x22aeee);}(_0xb10b,0x12a));var _0xbb10=function(_0x4dd909,_0x407b30){_0x4dd909=_0x4dd909-0x0;var _0x73872=_0xb10b[_0x4dd909];return _0x73872;};'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 bf8cc64..d5abfe7 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 _0x1d10=['/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','update','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','isAuthenticated','index','get','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','countContactsIvrCampaignHopperFinal','post'];(function(_0x4eaece,_0x159c2d){var _0xabf709=function(_0x1dea4c){while(--_0x1dea4c){_0x4eaece['push'](_0x4eaece['shift']());}};_0xabf709(++_0x159c2d);}(_0x1d10,0x1dc));var _0x01d1=function(_0x1e90ff,_0x537841){_0x1e90ff=_0x1e90ff-0x0;var _0x42fd9e=_0x1d10[_0x1e90ff];return _0x42fd9e;};'use strict';var multer=require(_0x01d1('0x0'));var util=require(_0x01d1('0x1'));var path=require(_0x01d1('0x2'));var timeout=require(_0x01d1('0x3'));var express=require(_0x01d1('0x4'));var router=express[_0x01d1('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x01d1('0x6'));var config=require(_0x01d1('0x7'));var controller=require(_0x01d1('0x8'));router['get']('/',auth[_0x01d1('0x9')](),controller[_0x01d1('0xa')]);router[_0x01d1('0xb')]('/describe',auth[_0x01d1('0x9')](),controller['describe']);router[_0x01d1('0xb')](_0x01d1('0xc'),auth[_0x01d1('0x9')](),controller[_0x01d1('0xd')]);router[_0x01d1('0xb')](_0x01d1('0xe'),auth[_0x01d1('0x9')](),controller[_0x01d1('0xf')]);router['get']('/campaign/countAttributes/:id',auth[_0x01d1('0x9')](),controller[_0x01d1('0x10')]);router[_0x01d1('0x11')](_0x01d1('0x12'),auth['isAuthenticated'](),controller[_0x01d1('0x13')]);router['post'](_0x01d1('0x14'),auth[_0x01d1('0x9')](),controller[_0x01d1('0x15')]);router['post'](_0x01d1('0x16'),auth[_0x01d1('0x9')](),controller[_0x01d1('0x17')]);router[_0x01d1('0x18')](_0x01d1('0xc'),auth['isAuthenticated'](),controller[_0x01d1('0x19')]);module['exports']=router; \ No newline at end of file +var _0x7948=['/voice/queue/countAttributes/:id','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','update','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','/:id','show'];(function(_0x54819a,_0x294e7f){var _0x169eb2=function(_0x16d896){while(--_0x16d896){_0x54819a['push'](_0x54819a['shift']());}};_0x169eb2(++_0x294e7f);}(_0x7948,0x144));var _0x8794=function(_0x28509b,_0x5831ff){_0x28509b=_0x28509b-0x0;var _0x1e0b6=_0x7948[_0x28509b];return _0x1e0b6;};'use strict';var multer=require(_0x8794('0x0'));var util=require(_0x8794('0x1'));var path=require(_0x8794('0x2'));var timeout=require(_0x8794('0x3'));var express=require(_0x8794('0x4'));var router=express[_0x8794('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x8794('0x6'));var interaction=require(_0x8794('0x7'));var config=require('../../config/environment');var controller=require('./cmHopperFinal.controller');router[_0x8794('0x8')]('/',auth[_0x8794('0x9')](),controller[_0x8794('0xa')]);router[_0x8794('0x8')](_0x8794('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x8794('0x8')](_0x8794('0xc'),auth[_0x8794('0x9')](),controller[_0x8794('0xd')]);router['get'](_0x8794('0xe'),auth[_0x8794('0x9')](),controller['countContactsQueueCampaignHopperFinal']);router[_0x8794('0x8')](_0x8794('0xf'),auth['isAuthenticated'](),controller[_0x8794('0x10')]);router[_0x8794('0x11')](_0x8794('0x12'),auth['isAuthenticated'](),controller[_0x8794('0x13')]);router['post'](_0x8794('0x14'),auth[_0x8794('0x9')](),controller[_0x8794('0x15')]);router[_0x8794('0x11')](_0x8794('0x16'),auth['isAuthenticated'](),controller[_0x8794('0x17')]);router['put'](_0x8794('0xc'),auth[_0x8794('0x9')](),controller[_0x8794('0x18')]);module[_0x8794('0x19')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 6557249..0df738a 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 _0xc1ec=['STRING','DATE','BOOLEAN','exports','INTEGER'];(function(_0x228641,_0x25d636){var _0x5d5d78=function(_0x4d5c6c){while(--_0x4d5c6c){_0x228641['push'](_0x228641['shift']());}};_0x5d5d78(++_0x25d636);}(_0xc1ec,0x161));var _0xcc1e=function(_0x180285,_0x5af103){_0x180285=_0x180285-0x0;var _0x145704=_0xc1ec[_0x180285];return _0x145704;};'use strict';var Sequelize=require('sequelize');module[_0xcc1e('0x0')]={'state':{'type':Sequelize[_0xcc1e('0x1')](0x2)},'statedesc':{'type':Sequelize[_0xcc1e('0x2')]},'scheduledat':{'type':Sequelize[_0xcc1e('0x3')]},'countbusyretry':{'type':Sequelize[_0xcc1e('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xcc1e('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xcc1e('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xcc1e('0x2')]},'originatecalleridnum':{'type':Sequelize[_0xcc1e('0x2')]},'originatecalleridname':{'type':Sequelize[_0xcc1e('0x2')]},'calleridnum':{'type':Sequelize[_0xcc1e('0x2')]},'calleridname':{'type':Sequelize[_0xcc1e('0x2')]},'starttime':{'type':Sequelize[_0xcc1e('0x3')]},'responsetime':{'type':Sequelize[_0xcc1e('0x3')]},'answertime':{'type':Sequelize[_0xcc1e('0x3')]},'droptime':{'type':Sequelize[_0xcc1e('0x3')]},'endtime':{'type':Sequelize[_0xcc1e('0x3')]},'ringtime':{'type':Sequelize[_0xcc1e('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xcc1e('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xcc1e('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xcc1e('0x2')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xcc1e('0x2')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0xcc1e('0x2')]},'amd':{'type':Sequelize[_0xcc1e('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0xcc1e('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0xcc1e('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xcc1e('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xcc1e('0x3')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize[_0xcc1e('0x3')]},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xcc1e('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xcc1e('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xcc1e('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xcc1e('0x1')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xcc1e('0x2')]}}; \ No newline at end of file +var _0x1799=['STRING','DATE','BOOLEAN','sequelize','INTEGER'];(function(_0xfb0cfd,_0x500179){var _0x2fd8aa=function(_0xccb501){while(--_0xccb501){_0xfb0cfd['push'](_0xfb0cfd['shift']());}};_0x2fd8aa(++_0x500179);}(_0x1799,0x161));var _0x9179=function(_0x15d698,_0x15bc18){_0x15d698=_0x15d698-0x0;var _0x1d7b91=_0x1799[_0x15d698];return _0x1d7b91;};'use strict';var Sequelize=require(_0x9179('0x0'));module['exports']={'state':{'type':Sequelize[_0x9179('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x9179('0x2')]},'scheduledat':{'type':Sequelize[_0x9179('0x3')]},'countbusyretry':{'type':Sequelize[_0x9179('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x9179('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x9179('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x9179('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x9179('0x2')]},'calleridnum':{'type':Sequelize[_0x9179('0x2')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x9179('0x3')]},'responsetime':{'type':Sequelize[_0x9179('0x3')]},'answertime':{'type':Sequelize[_0x9179('0x3')]},'droptime':{'type':Sequelize[_0x9179('0x3')]},'endtime':{'type':Sequelize[_0x9179('0x3')]},'ringtime':{'type':Sequelize[_0x9179('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x9179('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x9179('0x2')]},'campaign':{'type':Sequelize[_0x9179('0x2')]},'campaigntype':{'type':Sequelize[_0x9179('0x2')]},'membername':{'type':Sequelize[_0x9179('0x2')]},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize[_0x9179('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0x9179('0x4')],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x9179('0x3')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize[_0x9179('0x3')]},'edited':{'type':Sequelize[_0x9179('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x9179('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x9179('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x9179('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x9179('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x9179('0x1')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x9179('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 3020cfe..68eda9b 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 _0x3c1b=['destroy','error','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','pick','filter','where','merge','VIRTUAL','options','CmHopperHistory','includeAll','findAll','rows','show','params','include','find','create','body','catch','describe','uniqueid','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3c1b,0x76));var _0xb3c1=function(_0x30266f,_0x5739bc){_0x30266f=_0x30266f-0x0;var _0x51c3d8=_0x3c1b[_0x30266f];return _0x51c3d8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb3c1('0x0'));var zipdir=require(_0xb3c1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb3c1('0x2'));var moment=require(_0xb3c1('0x3'));var BPromise=require(_0xb3c1('0x4'));var Mustache=require('mustache');var util=require(_0xb3c1('0x5'));var path=require('path');var sox=require(_0xb3c1('0x6'));var csv=require('to-csv');var ejs=require(_0xb3c1('0x7'));var fs=require('fs');var fs_extra=require(_0xb3c1('0x8'));var _=require(_0xb3c1('0x9'));var squel=require(_0xb3c1('0xa'));var crypto=require(_0xb3c1('0xb'));var jsforce=require(_0xb3c1('0xc'));var deskjs=require(_0xb3c1('0xd'));var toCsv=require(_0xb3c1('0xe'));var querystring=require(_0xb3c1('0xf'));var Papa=require(_0xb3c1('0x10'));var Redis=require(_0xb3c1('0x11'));var authService=require(_0xb3c1('0x12'));var qs=require(_0xb3c1('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb3c1('0x14'));var logger=require('../../config/logger')(_0xb3c1('0x15'));var utils=require('../../config/utils');var config=require(_0xb3c1('0x16'));var licenseUtil=require(_0xb3c1('0x17'));var db=require(_0xb3c1('0x18'))['db'];function respondWithStatusCode(_0x3bdaab,_0x9e31d2){_0x9e31d2=_0x9e31d2||0xcc;return function(_0x13553c){if(_0x13553c){return _0x3bdaab[_0xb3c1('0x19')](_0x9e31d2);}return _0x3bdaab[_0xb3c1('0x1a')](_0x9e31d2)[_0xb3c1('0x1b')]();};}function respondWithResult(_0x5e7fa1,_0x55ebe5){_0x55ebe5=_0x55ebe5||0xc8;return function(_0xace0fe){if(_0xace0fe){return _0x5e7fa1['status'](_0x55ebe5)['json'](_0xace0fe);}};}function respondWithFilteredResult(_0x560e33,_0x1f1355){return function(_0x45d31b){if(_0x45d31b){var _0x764c9e=typeof _0x1f1355[_0xb3c1('0x1c')]==='undefined'&&typeof _0x1f1355[_0xb3c1('0x1d')]===_0xb3c1('0x1e');var _0x1b2b52=_0x45d31b['count'];var _0x11d13e=_0x764c9e?0x0:_0x1f1355[_0xb3c1('0x1c')];var _0x303a43=_0x764c9e?_0x45d31b[_0xb3c1('0x1f')]:_0x1f1355[_0xb3c1('0x1c')]+_0x1f1355[_0xb3c1('0x1d')];var _0xbbaaee;if(_0x303a43>=_0x1b2b52){_0x303a43=_0x1b2b52;_0xbbaaee=0xc8;}else{_0xbbaaee=0xce;}_0x560e33[_0xb3c1('0x1a')](_0xbbaaee);return _0x560e33[_0xb3c1('0x20')](_0xb3c1('0x21'),_0x11d13e+'-'+_0x303a43+'/'+_0x1b2b52)[_0xb3c1('0x22')](_0x45d31b);}return null;};}function patchUpdates(_0x3d4cd8){return function(_0x267ab9){try{jsonpatch[_0xb3c1('0x23')](_0x267ab9,_0x3d4cd8,!![]);}catch(_0x20040c){return BPromise[_0xb3c1('0x24')](_0x20040c);}return _0x267ab9[_0xb3c1('0x25')]();};}function saveUpdates(_0xe05c4b,_0x4042ac){return function(_0x96d0e8){if(_0x96d0e8){return _0x96d0e8[_0xb3c1('0x26')](_0xe05c4b)[_0xb3c1('0x27')](function(_0x3a1e64){return _0x3a1e64;});}return null;};}function removeEntity(_0x14ce0c,_0x43ebe4){return function(_0x995826){if(_0x995826){return _0x995826[_0xb3c1('0x28')]()[_0xb3c1('0x27')](function(){_0x14ce0c[_0xb3c1('0x1a')](0xcc)[_0xb3c1('0x1b')]();});}};}function handleEntityNotFound(_0x16af32,_0x2df441){return function(_0x22973e){if(!_0x22973e){_0x16af32[_0xb3c1('0x19')](0x194);}return _0x22973e;};}function handleError(_0x2391f7,_0x3912f8){_0x3912f8=_0x3912f8||0x1f4;return function(_0x33a572){logger[_0xb3c1('0x29')](_0x33a572['stack']);if(_0x33a572[_0xb3c1('0x2a')]){delete _0x33a572[_0xb3c1('0x2a')];}_0x2391f7[_0xb3c1('0x1a')](_0x3912f8)[_0xb3c1('0x2b')](_0x33a572);};}exports[_0xb3c1('0x2c')]=function(_0x1b4486,_0xae5e07){var _0x5db253={},_0x2cf1f0={},_0x24dc54={'count':0x0,'rows':[]};var _0x25586d=_[_0xb3c1('0x2d')](db['CmHopperHistory'][_0xb3c1('0x2e')],function(_0x204f17){return{'name':_0x204f17['fieldName'],'type':_0x204f17[_0xb3c1('0x2f')][_0xb3c1('0x30')]};});_0x2cf1f0[_0xb3c1('0x31')]=_[_0xb3c1('0x2d')](_0x25586d,'name');_0x2cf1f0[_0xb3c1('0x32')]=_[_0xb3c1('0x33')](_0x1b4486[_0xb3c1('0x32')]);_0x2cf1f0[_0xb3c1('0x34')]=_[_0xb3c1('0x35')](_0x2cf1f0[_0xb3c1('0x31')],_0x2cf1f0[_0xb3c1('0x32')]);_0x5db253[_0xb3c1('0x36')]=_[_0xb3c1('0x35')](_0x2cf1f0[_0xb3c1('0x31')],qs[_0xb3c1('0x37')](_0x1b4486[_0xb3c1('0x32')][_0xb3c1('0x37')]));_0x5db253[_0xb3c1('0x36')]=_0x5db253[_0xb3c1('0x36')][_0xb3c1('0x38')]?_0x5db253[_0xb3c1('0x36')]:_0x2cf1f0['model'];if(!_0x1b4486[_0xb3c1('0x32')][_0xb3c1('0x39')](_0xb3c1('0x3a'))){_0x5db253[_0xb3c1('0x1d')]=qs[_0xb3c1('0x1d')](_0x1b4486[_0xb3c1('0x32')][_0xb3c1('0x1d')]);_0x5db253[_0xb3c1('0x1c')]=qs[_0xb3c1('0x1c')](_0x1b4486[_0xb3c1('0x32')][_0xb3c1('0x1c')]);}_0x5db253[_0xb3c1('0x3b')]=qs['sort'](_0x1b4486[_0xb3c1('0x32')]['sort']);_0x5db253['where']=qs[_0xb3c1('0x34')](_[_0xb3c1('0x3c')](_0x1b4486[_0xb3c1('0x32')],_0x2cf1f0['filters']),_0x25586d);if(_0x1b4486[_0xb3c1('0x32')][_0xb3c1('0x3d')]){_0x5db253[_0xb3c1('0x3e')]=_[_0xb3c1('0x3f')](_0x5db253[_0xb3c1('0x3e')],{'$or':_['map'](_0x25586d,function(_0x56d2fa){if(_0x56d2fa[_0xb3c1('0x2f')]!==_0xb3c1('0x40')){var _0x6ae6a5={};_0x6ae6a5[_0x56d2fa['name']]={'$like':'%'+_0x1b4486['query'][_0xb3c1('0x3d')]+'%'};return _0x6ae6a5;}})});}_0x5db253=_['merge']({},_0x5db253,_0x1b4486[_0xb3c1('0x41')]);var _0x3fe6c4={'where':_0x5db253[_0xb3c1('0x3e')]};return db[_0xb3c1('0x42')][_0xb3c1('0x1f')](_0x3fe6c4)['then'](function(_0x4d0601){_0x24dc54['count']=_0x4d0601;if(_0x1b4486[_0xb3c1('0x32')][_0xb3c1('0x43')]){_0x5db253['include']=[{'all':!![]}];}return db[_0xb3c1('0x42')][_0xb3c1('0x44')](_0x5db253);})['then'](function(_0x5b2e6d){_0x24dc54[_0xb3c1('0x45')]=_0x5b2e6d;return _0x24dc54;})[_0xb3c1('0x27')](respondWithFilteredResult(_0xae5e07,_0x5db253))['catch'](handleError(_0xae5e07,null));};exports[_0xb3c1('0x46')]=function(_0x46527d,_0x28dd22){var _0x1e615b={'raw':!![],'where':{'id':_0x46527d[_0xb3c1('0x47')]['id']}},_0x1199b1={};_0x1199b1[_0xb3c1('0x31')]=_[_0xb3c1('0x33')](db[_0xb3c1('0x42')][_0xb3c1('0x2e')]);_0x1199b1['query']=_[_0xb3c1('0x33')](_0x46527d['query']);_0x1199b1['filters']=_[_0xb3c1('0x35')](_0x1199b1[_0xb3c1('0x31')],_0x1199b1[_0xb3c1('0x32')]);_0x1e615b['attributes']=_[_0xb3c1('0x35')](_0x1199b1[_0xb3c1('0x31')],qs['fields'](_0x46527d[_0xb3c1('0x32')]['fields']));_0x1e615b[_0xb3c1('0x36')]=_0x1e615b[_0xb3c1('0x36')][_0xb3c1('0x38')]?_0x1e615b['attributes']:_0x1199b1['model'];if(_0x46527d[_0xb3c1('0x32')][_0xb3c1('0x43')]){_0x1e615b[_0xb3c1('0x48')]=[{'all':!![]}];}_0x1e615b=_[_0xb3c1('0x3f')]({},_0x1e615b,_0x46527d[_0xb3c1('0x41')]);return db[_0xb3c1('0x42')][_0xb3c1('0x49')](_0x1e615b)[_0xb3c1('0x27')](handleEntityNotFound(_0x28dd22,null))[_0xb3c1('0x27')](respondWithResult(_0x28dd22,null))['catch'](handleError(_0x28dd22,null));};exports[_0xb3c1('0x4a')]=function(_0x1b1f64,_0x1af941){return db[_0xb3c1('0x42')][_0xb3c1('0x4a')](_0x1b1f64[_0xb3c1('0x4b')],{})[_0xb3c1('0x27')](respondWithResult(_0x1af941,0xc9))[_0xb3c1('0x4c')](handleError(_0x1af941,null));};exports[_0xb3c1('0x4d')]=function(_0x4bd2b4,_0x3db646){return db[_0xb3c1('0x42')][_0xb3c1('0x4d')]()[_0xb3c1('0x27')](respondWithResult(_0x3db646,null))[_0xb3c1('0x4c')](handleError(_0x3db646,null));};exports[_0xb3c1('0x26')]=function(_0x302ed2,_0x2161c2){if(_0x302ed2[_0xb3c1('0x4b')][_0xb3c1('0x4e')]){delete _0x302ed2[_0xb3c1('0x4b')][_0xb3c1('0x4e')];}return db[_0xb3c1('0x42')][_0xb3c1('0x49')]({'where':{'uniqueid':_0x302ed2[_0xb3c1('0x47')]['id']}})['then'](handleEntityNotFound(_0x2161c2,null))['then'](saveUpdates(_0x302ed2[_0xb3c1('0x4b')],null))[_0xb3c1('0x27')](respondWithResult(_0x2161c2,null))[_0xb3c1('0x4c')](handleError(_0x2161c2,null));}; \ No newline at end of file +var _0x1aac=['merge','options','includeAll','include','rows','params','rawAttributes','find','catch','create','describe','uniqueid','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','send','index','map','CmHopperHistory','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filter','type','VIRTUAL'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1aac,0x193));var _0xc1aa=function(_0x1e83d0,_0x625559){_0x1e83d0=_0x1e83d0-0x0;var _0x3d9197=_0x1aac[_0x1e83d0];return _0x3d9197;};'use strict';var emlformat=require(_0xc1aa('0x0'));var rimraf=require(_0xc1aa('0x1'));var zipdir=require(_0xc1aa('0x2'));var jsonpatch=require(_0xc1aa('0x3'));var rp=require('request-promise');var moment=require(_0xc1aa('0x4'));var BPromise=require(_0xc1aa('0x5'));var Mustache=require(_0xc1aa('0x6'));var util=require(_0xc1aa('0x7'));var path=require('path');var sox=require(_0xc1aa('0x8'));var csv=require(_0xc1aa('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc1aa('0xa'));var squel=require(_0xc1aa('0xb'));var crypto=require(_0xc1aa('0xc'));var jsforce=require(_0xc1aa('0xd'));var deskjs=require(_0xc1aa('0xe'));var toCsv=require(_0xc1aa('0x9'));var querystring=require(_0xc1aa('0xf'));var Papa=require('papaparse');var Redis=require(_0xc1aa('0x10'));var authService=require(_0xc1aa('0x11'));var qs=require(_0xc1aa('0x12'));var as=require(_0xc1aa('0x13'));var hardwareService=require(_0xc1aa('0x14'));var logger=require(_0xc1aa('0x15'))(_0xc1aa('0x16'));var utils=require(_0xc1aa('0x17'));var config=require(_0xc1aa('0x18'));var licenseUtil=require(_0xc1aa('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1f564b,_0x1b9bdb){_0x1b9bdb=_0x1b9bdb||0xcc;return function(_0x716514){if(_0x716514){return _0x1f564b[_0xc1aa('0x1a')](_0x1b9bdb);}return _0x1f564b[_0xc1aa('0x1b')](_0x1b9bdb)[_0xc1aa('0x1c')]();};}function respondWithResult(_0x63e7b4,_0x15f30f){_0x15f30f=_0x15f30f||0xc8;return function(_0x15e16d){if(_0x15e16d){return _0x63e7b4[_0xc1aa('0x1b')](_0x15f30f)[_0xc1aa('0x1d')](_0x15e16d);}};}function respondWithFilteredResult(_0xf84ea9,_0x3d7512){return function(_0x19081c){if(_0x19081c){var _0x11fdce=typeof _0x3d7512['offset']===_0xc1aa('0x1e')&&typeof _0x3d7512[_0xc1aa('0x1f')]===_0xc1aa('0x1e');var _0xaf2de4=_0x19081c['count'];var _0x2c1dc4=_0x11fdce?0x0:_0x3d7512['offset'];var _0x53e7ed=_0x11fdce?_0x19081c[_0xc1aa('0x20')]:_0x3d7512[_0xc1aa('0x21')]+_0x3d7512[_0xc1aa('0x1f')];var _0x5ad97c;if(_0x53e7ed>=_0xaf2de4){_0x53e7ed=_0xaf2de4;_0x5ad97c=0xc8;}else{_0x5ad97c=0xce;}_0xf84ea9[_0xc1aa('0x1b')](_0x5ad97c);return _0xf84ea9[_0xc1aa('0x22')](_0xc1aa('0x23'),_0x2c1dc4+'-'+_0x53e7ed+'/'+_0xaf2de4)['json'](_0x19081c);}return null;};}function patchUpdates(_0x1a7a3e){return function(_0x172e0b){try{jsonpatch[_0xc1aa('0x24')](_0x172e0b,_0x1a7a3e,!![]);}catch(_0x301484){return BPromise[_0xc1aa('0x25')](_0x301484);}return _0x172e0b[_0xc1aa('0x26')]();};}function saveUpdates(_0x219c2d,_0x45a397){return function(_0x1193fe){if(_0x1193fe){return _0x1193fe[_0xc1aa('0x27')](_0x219c2d)['then'](function(_0x3e45a6){return _0x3e45a6;});}return null;};}function removeEntity(_0x2b8c17,_0x5dfcef){return function(_0x29a4f0){if(_0x29a4f0){return _0x29a4f0[_0xc1aa('0x28')]()[_0xc1aa('0x29')](function(){_0x2b8c17[_0xc1aa('0x1b')](0xcc)[_0xc1aa('0x1c')]();});}};}function handleEntityNotFound(_0x4c3a1f,_0x3f23a9){return function(_0x42c1ef){if(!_0x42c1ef){_0x4c3a1f[_0xc1aa('0x1a')](0x194);}return _0x42c1ef;};}function handleError(_0x4d2bf0,_0x29e798){_0x29e798=_0x29e798||0x1f4;return function(_0x14d4df){logger['error'](_0x14d4df[_0xc1aa('0x2a')]);if(_0x14d4df[_0xc1aa('0x2b')]){delete _0x14d4df[_0xc1aa('0x2b')];}_0x4d2bf0[_0xc1aa('0x1b')](_0x29e798)[_0xc1aa('0x2c')](_0x14d4df);};}exports[_0xc1aa('0x2d')]=function(_0x229f05,_0x1e8dc5){var _0x21006e={},_0x2c2863={},_0x5442b3={'count':0x0,'rows':[]};var _0x3fe6a3=_[_0xc1aa('0x2e')](db[_0xc1aa('0x2f')]['rawAttributes'],function(_0x424df7){return{'name':_0x424df7[_0xc1aa('0x30')],'type':_0x424df7['type'][_0xc1aa('0x31')]};});_0x2c2863[_0xc1aa('0x32')]=_[_0xc1aa('0x2e')](_0x3fe6a3,_0xc1aa('0x2b'));_0x2c2863[_0xc1aa('0x33')]=_[_0xc1aa('0x34')](_0x229f05['query']);_0x2c2863[_0xc1aa('0x35')]=_['intersection'](_0x2c2863['model'],_0x2c2863[_0xc1aa('0x33')]);_0x21006e[_0xc1aa('0x36')]=_[_0xc1aa('0x37')](_0x2c2863[_0xc1aa('0x32')],qs['fields'](_0x229f05['query'][_0xc1aa('0x38')]));_0x21006e['attributes']=_0x21006e[_0xc1aa('0x36')][_0xc1aa('0x39')]?_0x21006e['attributes']:_0x2c2863['model'];if(!_0x229f05[_0xc1aa('0x33')][_0xc1aa('0x3a')]('nolimit')){_0x21006e[_0xc1aa('0x1f')]=qs[_0xc1aa('0x1f')](_0x229f05[_0xc1aa('0x33')]['limit']);_0x21006e['offset']=qs[_0xc1aa('0x21')](_0x229f05['query'][_0xc1aa('0x21')]);}_0x21006e[_0xc1aa('0x3b')]=qs[_0xc1aa('0x3c')](_0x229f05[_0xc1aa('0x33')][_0xc1aa('0x3c')]);_0x21006e[_0xc1aa('0x3d')]=qs[_0xc1aa('0x35')](_['pick'](_0x229f05[_0xc1aa('0x33')],_0x2c2863[_0xc1aa('0x35')]),_0x3fe6a3);if(_0x229f05['query'][_0xc1aa('0x3e')]){_0x21006e[_0xc1aa('0x3d')]=_['merge'](_0x21006e[_0xc1aa('0x3d')],{'$or':_[_0xc1aa('0x2e')](_0x3fe6a3,function(_0x5cb536){if(_0x5cb536[_0xc1aa('0x3f')]!==_0xc1aa('0x40')){var _0x46ef06={};_0x46ef06[_0x5cb536[_0xc1aa('0x2b')]]={'$like':'%'+_0x229f05[_0xc1aa('0x33')]['filter']+'%'};return _0x46ef06;}})});}_0x21006e=_[_0xc1aa('0x41')]({},_0x21006e,_0x229f05[_0xc1aa('0x42')]);var _0x53836c={'where':_0x21006e[_0xc1aa('0x3d')]};return db[_0xc1aa('0x2f')]['count'](_0x53836c)['then'](function(_0x3a97d2){_0x5442b3[_0xc1aa('0x20')]=_0x3a97d2;if(_0x229f05[_0xc1aa('0x33')][_0xc1aa('0x43')]){_0x21006e[_0xc1aa('0x44')]=[{'all':!![]}];}return db[_0xc1aa('0x2f')]['findAll'](_0x21006e);})[_0xc1aa('0x29')](function(_0x33c6a6){_0x5442b3[_0xc1aa('0x45')]=_0x33c6a6;return _0x5442b3;})[_0xc1aa('0x29')](respondWithFilteredResult(_0x1e8dc5,_0x21006e))['catch'](handleError(_0x1e8dc5,null));};exports['show']=function(_0x5dbafb,_0x88fcf2){var _0x513d27={'raw':!![],'where':{'id':_0x5dbafb[_0xc1aa('0x46')]['id']}},_0x47ea62={};_0x47ea62[_0xc1aa('0x32')]=_[_0xc1aa('0x34')](db[_0xc1aa('0x2f')][_0xc1aa('0x47')]);_0x47ea62[_0xc1aa('0x33')]=_[_0xc1aa('0x34')](_0x5dbafb['query']);_0x47ea62[_0xc1aa('0x35')]=_[_0xc1aa('0x37')](_0x47ea62[_0xc1aa('0x32')],_0x47ea62[_0xc1aa('0x33')]);_0x513d27[_0xc1aa('0x36')]=_[_0xc1aa('0x37')](_0x47ea62[_0xc1aa('0x32')],qs[_0xc1aa('0x38')](_0x5dbafb[_0xc1aa('0x33')][_0xc1aa('0x38')]));_0x513d27['attributes']=_0x513d27[_0xc1aa('0x36')][_0xc1aa('0x39')]?_0x513d27[_0xc1aa('0x36')]:_0x47ea62[_0xc1aa('0x32')];if(_0x5dbafb[_0xc1aa('0x33')]['includeAll']){_0x513d27[_0xc1aa('0x44')]=[{'all':!![]}];}_0x513d27=_['merge']({},_0x513d27,_0x5dbafb[_0xc1aa('0x42')]);return db[_0xc1aa('0x2f')][_0xc1aa('0x48')](_0x513d27)[_0xc1aa('0x29')](handleEntityNotFound(_0x88fcf2,null))['then'](respondWithResult(_0x88fcf2,null))[_0xc1aa('0x49')](handleError(_0x88fcf2,null));};exports[_0xc1aa('0x4a')]=function(_0x511677,_0x4485f9){return db[_0xc1aa('0x2f')][_0xc1aa('0x4a')](_0x511677['body'],{})[_0xc1aa('0x29')](respondWithResult(_0x4485f9,0xc9))[_0xc1aa('0x49')](handleError(_0x4485f9,null));};exports[_0xc1aa('0x4b')]=function(_0x4c2121,_0x1eed12){return db[_0xc1aa('0x2f')][_0xc1aa('0x4b')]()[_0xc1aa('0x29')](respondWithResult(_0x1eed12,null))[_0xc1aa('0x49')](handleError(_0x1eed12,null));};exports[_0xc1aa('0x27')]=function(_0x3fd9b6,_0xe4f971){if(_0x3fd9b6['body'][_0xc1aa('0x4c')]){delete _0x3fd9b6['body'][_0xc1aa('0x4c')];}return db[_0xc1aa('0x2f')][_0xc1aa('0x48')]({'where':{'uniqueid':_0x3fd9b6['params']['id']}})[_0xc1aa('0x29')](handleEntityNotFound(_0xe4f971,null))[_0xc1aa('0x29')](saveUpdates(_0x3fd9b6[_0xc1aa('0x4d')],null))[_0xc1aa('0x29')](respondWithResult(_0xe4f971,null))[_0xc1aa('0x49')](handleError(_0xe4f971,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 7a698f9..31c7941 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 _0xce62=['exports','define','CmHopperHistory','endtime','uniqueid','lodash','util','api','moment','bluebird','request-promise','path','rimraf','./cmHopperHistory.attributes'];(function(_0x252699,_0x134b4e){var _0x56d0c6=function(_0x5551a8){while(--_0x5551a8){_0x252699['push'](_0x252699['shift']());}};_0x56d0c6(++_0x134b4e);}(_0xce62,0x83));var _0x2ce6=function(_0x5ebfd7,_0x13dce9){_0x5ebfd7=_0x5ebfd7-0x0;var _0x579bde=_0xce62[_0x5ebfd7];return _0x579bde;};'use strict';var _=require(_0x2ce6('0x0'));var util=require(_0x2ce6('0x1'));var logger=require('../../config/logger')(_0x2ce6('0x2'));var moment=require(_0x2ce6('0x3'));var BPromise=require(_0x2ce6('0x4'));var rp=require(_0x2ce6('0x5'));var fs=require('fs');var path=require(_0x2ce6('0x6'));var rimraf=require(_0x2ce6('0x7'));var config=require('../../config/environment');var attributes=require(_0x2ce6('0x8'));module[_0x2ce6('0x9')]=function(_0x422f72,_0x9bbac8){return _0x422f72[_0x2ce6('0xa')](_0x2ce6('0xb'),attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':_0x2ce6('0xc'),'fields':[_0x2ce6('0xc')]},{'name':'uniqueid','fields':[_0x2ce6('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x97ce=['util','../../config/logger','api','bluebird','path','../../config/environment','./cmHopperHistory.attributes','exports','define','cm_hopper_history','endtime','uniqueid','lodash'];(function(_0x2cf61e,_0x139542){var _0x73872b=function(_0x72a6b1){while(--_0x72a6b1){_0x2cf61e['push'](_0x2cf61e['shift']());}};_0x73872b(++_0x139542);}(_0x97ce,0x151));var _0xe97c=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0x97ce[_0x50007c];return _0x5c1ec7;};'use strict';var _=require(_0xe97c('0x0'));var util=require(_0xe97c('0x1'));var logger=require(_0xe97c('0x2'))(_0xe97c('0x3'));var moment=require('moment');var BPromise=require(_0xe97c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe97c('0x5'));var rimraf=require('rimraf');var config=require(_0xe97c('0x6'));var attributes=require(_0xe97c('0x7'));module[_0xe97c('0x8')]=function(_0x447030,_0x29184f){return _0x447030[_0xe97c('0x9')]('CmHopperHistory',attributes,{'tableName':_0xe97c('0xa'),'paranoid':![],'indexes':[{'name':_0xe97c('0xb'),'fields':[_0xe97c('0xb')]},{'name':'uniqueid','fields':[_0xe97c('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index cc2cd57..889a0c3 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 _0x906c=['create','options','raw','CreateCmHopperHistory','AvgHandleTime','findAll','where','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CmHopperHistory'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x906c,0x195));var _0xc906=function(_0x20b447,_0x357f11){_0x20b447=_0x20b447-0x0;var _0x18ebb3=_0x906c[_0x20b447];return _0x18ebb3;};'use strict';var _=require(_0xc906('0x0'));var util=require(_0xc906('0x1'));var moment=require(_0xc906('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc906('0x3'));var db=require(_0xc906('0x4'))['db'];var utils=require(_0xc906('0x5'));var logger=require(_0xc906('0x6'))('rpc');var config=require(_0xc906('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xc906('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x62ff11,_0x3b8256,_0x541b60){return new BPromise(function(_0x56e837,_0x2ecf55){return client['request'](_0x62ff11,_0x541b60)[_0xc906('0x9')](function(_0x10d187){logger[_0xc906('0xa')](_0xc906('0xb'),_0x3b8256,_0xc906('0xc'));logger[_0xc906('0xd')](_0xc906('0xe'),_0x3b8256,_0xc906('0xc'),JSON[_0xc906('0xf')](_0x10d187));if(_0x10d187[_0xc906('0x10')]){if(_0x10d187[_0xc906('0x10')]['code']===0x1f4){logger[_0xc906('0x10')](_0xc906('0xb'),_0x3b8256,_0x10d187[_0xc906('0x10')][_0xc906('0x11')]);return _0x2ecf55(_0x10d187[_0xc906('0x10')][_0xc906('0x11')]);}logger[_0xc906('0x10')](_0xc906('0xb'),_0x3b8256,_0x10d187['error']['message']);return _0x56e837(_0x10d187[_0xc906('0x10')][_0xc906('0x11')]);}else{logger['info'](_0xc906('0xb'),_0x3b8256,'request\x20sent');_0x56e837(_0x10d187[_0xc906('0x12')]['message']);}})[_0xc906('0x13')](function(_0x3bbcfb){logger['error'](_0xc906('0xb'),_0x3b8256,_0x3bbcfb);_0x2ecf55(_0x3bbcfb);});});}exports['CreateCmHopperHistory']=function(_0x18c65d){var _0x5ac489=this;return new Promise(function(_0x1bd41e,_0x2e1f51){return db[_0xc906('0x14')][_0xc906('0x15')](_0x18c65d['body'],{'raw':_0x18c65d[_0xc906('0x16')]?_0x18c65d['options'][_0xc906('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x5d045d){logger[_0xc906('0xa')](_0xc906('0x18'),_0x18c65d);logger['debug'](_0xc906('0x18'),_0x18c65d,JSON[_0xc906('0xf')](_0x5d045d));_0x1bd41e(_0x5d045d);})[_0xc906('0x13')](function(_0x41ab46){logger['error'](_0xc906('0x18'),_0x41ab46[_0xc906('0x11')],_0x18c65d);_0x2e1f51(_0x5ac489[_0xc906('0x10')](0x1f4,_0x41ab46[_0xc906('0x11')]));});});};exports[_0xc906('0x19')]=function(_0x5bc2b5){var _0x253a11=this;return new Promise(function(_0x287e1c,_0x40245e){return db[_0xc906('0x14')][_0xc906('0x1a')]({'raw':_0x5bc2b5[_0xc906('0x16')]?_0x5bc2b5[_0xc906('0x16')][_0xc906('0x17')]===undefined?!![]:![]:!![],'where':_0x5bc2b5['options']?_0x5bc2b5[_0xc906('0x16')][_0xc906('0x1b')]||null:null,'attributes':[[db[_0xc906('0x1c')]['fn'](_0xc906('0x1d'),db['sequelize'][_0xc906('0x1e')]('id')),_0xc906('0x1f')],[db[_0xc906('0x1c')]['fn'](_0xc906('0x1d'),db[_0xc906('0x1c')]['fn']('IF',db['sequelize'][_0xc906('0x20')](_0xc906('0x21')))),_0xc906('0x22')],[db['sequelize']['fn']('COUNT',db[_0xc906('0x1c')]['fn']('IF',db[_0xc906('0x1c')][_0xc906('0x20')](_0xc906('0x23')))),_0xc906('0x24')],[db[_0xc906('0x1c')]['fn'](_0xc906('0x1d'),db[_0xc906('0x1c')]['fn']('IF',db['sequelize'][_0xc906('0x20')](_0xc906('0x25')))),_0xc906('0x26')],[db[_0xc906('0x1c')]['fn'](_0xc906('0x27'),db[_0xc906('0x1c')]['fn']('IF',db[_0xc906('0x1c')][_0xc906('0x20')](_0xc906('0x28')))),'predictiveIntervalAvgHoldtime'],[db[_0xc906('0x1c')]['fn'](_0xc906('0x27'),db[_0xc906('0x1c')]['fn']('IF',db['sequelize'][_0xc906('0x20')](_0xc906('0x29')))),_0xc906('0x2a')]]})[_0xc906('0x9')](function(_0x5ef599){logger[_0xc906('0xa')](_0xc906('0x19'),_0x5bc2b5);logger[_0xc906('0xd')]('AvgHandleTime',_0x5bc2b5,JSON[_0xc906('0xf')](_0x5ef599));_0x287e1c(_0x5ef599);})['catch'](function(_0x3d8e03){logger[_0xc906('0x10')]('AvgHandleTime',_0x3d8e03[_0xc906('0x11')],_0x5bc2b5);_0x40245e(_0x253a11[_0xc906('0x10')](0x1f4,_0x3d8e03[_0xc906('0x11')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x3eeed9){var _0x2e2af8=this;return new Promise(function(_0x2e8627,_0x52d1ac){return db[_0xc906('0x14')][_0xc906('0x1a')]({'raw':_0x3eeed9[_0xc906('0x16')]?_0x3eeed9['options'][_0xc906('0x17')]===undefined?!![]:![]:!![],'where':_0x3eeed9[_0xc906('0x16')]?_0x3eeed9['options'][_0xc906('0x1b')]||null:null,'attributes':[[_0xc906('0x2b'),_0xc906('0x2c')],[db[_0xc906('0x1c')]['fn'](_0xc906('0x1d'),db['sequelize']['fn']('IF',db[_0xc906('0x1c')]['literal'](_0xc906('0x2d')))),_0xc906('0x2e')],[db[_0xc906('0x1c')]['fn'](_0xc906('0x1d'),db[_0xc906('0x1c')]['fn']('IF',db[_0xc906('0x1c')][_0xc906('0x20')]('`state`\x20=\x203,\x201,\x20null'))),_0xc906('0x2f')],[db['sequelize']['fn'](_0xc906('0x1d'),db['sequelize']['fn']('IF',db[_0xc906('0x1c')][_0xc906('0x20')](_0xc906('0x21')))),_0xc906('0x30')],[db[_0xc906('0x1c')]['fn']('COUNT',db[_0xc906('0x1c')]['fn']('IF',db[_0xc906('0x1c')][_0xc906('0x20')](_0xc906('0x31')))),_0xc906('0x32')],[db['sequelize']['fn'](_0xc906('0x1d'),db['sequelize']['fn']('IF',db['sequelize'][_0xc906('0x20')]('`state`\x20=\x208,\x201,\x20null'))),_0xc906('0x33')],[db['sequelize']['fn'](_0xc906('0x1d'),db[_0xc906('0x1c')]['fn']('IF',db['sequelize']['literal'](_0xc906('0x34')))),_0xc906('0x35')],[db[_0xc906('0x1c')]['fn'](_0xc906('0x1d'),db[_0xc906('0x1c')]['fn']('IF',db[_0xc906('0x1c')][_0xc906('0x20')](_0xc906('0x36')))),_0xc906('0x37')],[db[_0xc906('0x1c')]['fn'](_0xc906('0x1d'),db['sequelize']['fn']('IF',db[_0xc906('0x1c')][_0xc906('0x20')](_0xc906('0x38')))),_0xc906('0x39')],[db[_0xc906('0x1c')]['fn'](_0xc906('0x1d'),db[_0xc906('0x1c')]['fn']('IF',db[_0xc906('0x1c')]['literal'](_0xc906('0x3a')))),'outboundBlacklistCallsDay'],[db['sequelize']['fn']('COUNT',db[_0xc906('0x1c')]['fn']('IF',db[_0xc906('0x1c')]['literal'](_0xc906('0x3b')))),_0xc906('0x3c')],[db[_0xc906('0x1c')]['fn'](_0xc906('0x1d'),db['sequelize']['fn']('IF',db[_0xc906('0x1c')][_0xc906('0x20')]('`state`\x20=\x2018,\x201,\x20null'))),_0xc906('0x3d')],[db[_0xc906('0x1c')]['fn']('COUNT',db[_0xc906('0x1c')]['fn']('IF',db[_0xc906('0x1c')]['literal'](_0xc906('0x3e')))),_0xc906('0x3f')],[db[_0xc906('0x1c')]['fn'](_0xc906('0x1d'),db['sequelize']['fn']('IF',db['sequelize'][_0xc906('0x20')](_0xc906('0x40')))),_0xc906('0x3d')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xc906('0x1c')][_0xc906('0x20')](_0xc906('0x41')))),_0xc906('0x42')]],'group':[_0xc906('0x2b')]})[_0xc906('0x9')](function(_0x1be092){logger[_0xc906('0xa')]('GetVoiceQueueHopperHistory',_0x3eeed9);logger[_0xc906('0xd')](_0xc906('0x43'),_0x3eeed9,JSON[_0xc906('0xf')](_0x1be092));_0x2e8627(_0x1be092);})[_0xc906('0x13')](function(_0x561ac9){logger[_0xc906('0x10')](_0xc906('0x43'),_0x561ac9['message'],_0x3eeed9);_0x52d1ac(_0x2e2af8['error'](0x1f4,_0x561ac9['message']));});});};exports[_0xc906('0x44')]=function(_0x1d64f3){var _0x209d18=this;return new Promise(function(_0x39a54b,_0x1041ea){return db[_0xc906('0x14')][_0xc906('0x1a')]({'raw':_0x1d64f3[_0xc906('0x16')]?_0x1d64f3[_0xc906('0x16')][_0xc906('0x17')]===undefined?!![]:![]:!![],'where':_0x1d64f3[_0xc906('0x16')]?_0x1d64f3[_0xc906('0x16')]['where']||null:null,'attributes':[[_0xc906('0x2b'),'name'],[db[_0xc906('0x1c')]['fn'](_0xc906('0x1d'),db[_0xc906('0x1c')][_0xc906('0x1e')]('id')),_0xc906('0x45')],[db[_0xc906('0x1c')]['fn'](_0xc906('0x1d'),db[_0xc906('0x1c')]['fn']('IF',db[_0xc906('0x1c')]['literal'](_0xc906('0x21')))),_0xc906('0x46')]],'group':[_0xc906('0x2b')]})[_0xc906('0x9')](function(_0x55f12b){logger[_0xc906('0xa')](_0xc906('0x44'),_0x1d64f3);logger[_0xc906('0xd')](_0xc906('0x44'),_0x1d64f3,JSON[_0xc906('0xf')](_0x55f12b));_0x39a54b(_0x55f12b);})[_0xc906('0x13')](function(_0x448481){logger[_0xc906('0x10')]('GetCampaignHopperHistory',_0x448481[_0xc906('0x11')],_0x1d64f3);_0x1041ea(_0x209d18[_0xc906('0x10')](0x1f4,_0x448481[_0xc906('0x11')]));});});}; \ No newline at end of file +var _0xa101=['client','http','request','then','info','CmHopperHistory,\x20%s,\x20%s','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','stringify','AvgHandleTime','findAll','where','sequelize','COUNT','literal','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','campaign','name','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','outboundReCallsDay','GetCampaignHopperHistory','col','ivrTotalCallsDays','`state`\x20=\x204,\x201,\x20null','ivrAnswerCallsDay','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x2f1026,_0x3d013d){var _0x2e0112=function(_0x561de9){while(--_0x561de9){_0x2f1026['push'](_0x2f1026['shift']());}};_0x2e0112(++_0x3d013d);}(_0xa101,0x15f));var _0x1a10=function(_0x2d4421,_0x15a84f){_0x2d4421=_0x2d4421-0x0;var _0x2d3b01=_0xa101[_0x2d4421];return _0x2d3b01;};'use strict';var _=require(_0x1a10('0x0'));var util=require(_0x1a10('0x1'));var moment=require('moment');var BPromise=require(_0x1a10('0x2'));var rs=require(_0x1a10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1a10('0x4'))['db'];var utils=require(_0x1a10('0x5'));var logger=require('../../config/logger')(_0x1a10('0x6'));var config=require(_0x1a10('0x7'));var jayson=require(_0x1a10('0x8'));var client=jayson[_0x1a10('0x9')][_0x1a10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2b95f3,_0x5eea77,_0x4f0cd4){return new BPromise(function(_0x3c90fa,_0x2df5ef){return client[_0x1a10('0xb')](_0x2b95f3,_0x4f0cd4)[_0x1a10('0xc')](function(_0x7c7a8a){logger[_0x1a10('0xd')](_0x1a10('0xe'),_0x5eea77,'request\x20sent');logger[_0x1a10('0xf')](_0x1a10('0x10'),_0x5eea77,_0x1a10('0x11'),JSON['stringify'](_0x7c7a8a));if(_0x7c7a8a[_0x1a10('0x12')]){if(_0x7c7a8a[_0x1a10('0x12')][_0x1a10('0x13')]===0x1f4){logger['error'](_0x1a10('0xe'),_0x5eea77,_0x7c7a8a[_0x1a10('0x12')][_0x1a10('0x14')]);return _0x2df5ef(_0x7c7a8a[_0x1a10('0x12')][_0x1a10('0x14')]);}logger['error'](_0x1a10('0xe'),_0x5eea77,_0x7c7a8a['error']['message']);return _0x3c90fa(_0x7c7a8a['error'][_0x1a10('0x14')]);}else{logger[_0x1a10('0xd')](_0x1a10('0xe'),_0x5eea77,_0x1a10('0x11'));_0x3c90fa(_0x7c7a8a['result'][_0x1a10('0x14')]);}})[_0x1a10('0x15')](function(_0x5395b4){logger[_0x1a10('0x12')](_0x1a10('0xe'),_0x5eea77,_0x5395b4);_0x2df5ef(_0x5395b4);});});}exports[_0x1a10('0x16')]=function(_0x457e2f){var _0x4a3813=this;return new Promise(function(_0x169cf2,_0x1b394c){return db[_0x1a10('0x17')][_0x1a10('0x18')](_0x457e2f[_0x1a10('0x19')],{'raw':_0x457e2f[_0x1a10('0x1a')]?_0x457e2f[_0x1a10('0x1a')][_0x1a10('0x1b')]===undefined?!![]:![]:!![]})[_0x1a10('0xc')](function(_0x203561){logger[_0x1a10('0xd')](_0x1a10('0x16'),_0x457e2f);logger[_0x1a10('0xf')](_0x1a10('0x16'),_0x457e2f,JSON[_0x1a10('0x1c')](_0x203561));_0x169cf2(_0x203561);})['catch'](function(_0x70ae18){logger['error'](_0x1a10('0x16'),_0x70ae18['message'],_0x457e2f);_0x1b394c(_0x4a3813[_0x1a10('0x12')](0x1f4,_0x70ae18['message']));});});};exports[_0x1a10('0x1d')]=function(_0x74c06a){var _0x5f2d2d=this;return new Promise(function(_0x3b3aee,_0x2e618a){return db[_0x1a10('0x17')][_0x1a10('0x1e')]({'raw':_0x74c06a['options']?_0x74c06a[_0x1a10('0x1a')][_0x1a10('0x1b')]===undefined?!![]:![]:!![],'where':_0x74c06a[_0x1a10('0x1a')]?_0x74c06a[_0x1a10('0x1a')][_0x1a10('0x1f')]||null:null,'attributes':[[db[_0x1a10('0x20')]['fn'](_0x1a10('0x21'),db[_0x1a10('0x20')]['col']('id')),'predictiveIntervalTotalCalls'],[db['sequelize']['fn'](_0x1a10('0x21'),db[_0x1a10('0x20')]['fn']('IF',db[_0x1a10('0x20')][_0x1a10('0x22')]('`state`\x20=\x204,\x201,\x20null'))),_0x1a10('0x23')],[db[_0x1a10('0x20')]['fn']('COUNT',db[_0x1a10('0x20')]['fn']('IF',db[_0x1a10('0x20')][_0x1a10('0x22')]('`state`\x20=\x2010,\x201,\x20null'))),_0x1a10('0x24')],[db[_0x1a10('0x20')]['fn'](_0x1a10('0x21'),db[_0x1a10('0x20')]['fn']('IF',db[_0x1a10('0x20')]['literal'](_0x1a10('0x25')))),'predictiveIntervalDroppedCallsCallersExit'],[db[_0x1a10('0x20')]['fn'](_0x1a10('0x26'),db['sequelize']['fn']('IF',db[_0x1a10('0x20')][_0x1a10('0x22')](_0x1a10('0x27')))),'predictiveIntervalAvgHoldtime'],[db['sequelize']['fn'](_0x1a10('0x26'),db[_0x1a10('0x20')]['fn']('IF',db[_0x1a10('0x20')][_0x1a10('0x22')](_0x1a10('0x28')))),_0x1a10('0x29')]]})[_0x1a10('0xc')](function(_0x3ab2ce){logger['info'](_0x1a10('0x1d'),_0x74c06a);logger[_0x1a10('0xf')](_0x1a10('0x1d'),_0x74c06a,JSON[_0x1a10('0x1c')](_0x3ab2ce));_0x3b3aee(_0x3ab2ce);})[_0x1a10('0x15')](function(_0x404025){logger['error'](_0x1a10('0x1d'),_0x404025[_0x1a10('0x14')],_0x74c06a);_0x2e618a(_0x5f2d2d[_0x1a10('0x12')](0x1f4,_0x404025[_0x1a10('0x14')]));});});};exports[_0x1a10('0x2a')]=function(_0x816f92){var _0x2f1c48=this;return new Promise(function(_0x567e29,_0x4efdc3){return db[_0x1a10('0x17')][_0x1a10('0x1e')]({'raw':_0x816f92[_0x1a10('0x1a')]?_0x816f92[_0x1a10('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x816f92[_0x1a10('0x1a')]?_0x816f92['options'][_0x1a10('0x1f')]||null:null,'attributes':[[_0x1a10('0x2b'),_0x1a10('0x2c')],[db[_0x1a10('0x20')]['fn'](_0x1a10('0x21'),db[_0x1a10('0x20')]['fn']('IF',db[_0x1a10('0x20')][_0x1a10('0x22')]('`state`\x20=\x200,\x201,\x20null'))),_0x1a10('0x2d')],[db[_0x1a10('0x20')]['fn'](_0x1a10('0x21'),db[_0x1a10('0x20')]['fn']('IF',db['sequelize'][_0x1a10('0x22')](_0x1a10('0x2e')))),_0x1a10('0x2f')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x1a10('0x20')]['literal']('`state`\x20=\x204,\x201,\x20null'))),_0x1a10('0x30')],[db[_0x1a10('0x20')]['fn'](_0x1a10('0x21'),db[_0x1a10('0x20')]['fn']('IF',db[_0x1a10('0x20')]['literal'](_0x1a10('0x31')))),_0x1a10('0x32')],[db[_0x1a10('0x20')]['fn'](_0x1a10('0x21'),db[_0x1a10('0x20')]['fn']('IF',db[_0x1a10('0x20')]['literal'](_0x1a10('0x33')))),_0x1a10('0x34')],[db[_0x1a10('0x20')]['fn']('COUNT',db[_0x1a10('0x20')]['fn']('IF',db[_0x1a10('0x20')][_0x1a10('0x22')](_0x1a10('0x35')))),'outboundDropCallsDayTimeout'],[db[_0x1a10('0x20')]['fn'](_0x1a10('0x21'),db['sequelize']['fn']('IF',db['sequelize'][_0x1a10('0x22')](_0x1a10('0x36')))),_0x1a10('0x37')],[db['sequelize']['fn'](_0x1a10('0x21'),db[_0x1a10('0x20')]['fn']('IF',db[_0x1a10('0x20')][_0x1a10('0x22')](_0x1a10('0x38')))),_0x1a10('0x39')],[db[_0x1a10('0x20')]['fn'](_0x1a10('0x21'),db[_0x1a10('0x20')]['fn']('IF',db[_0x1a10('0x20')][_0x1a10('0x22')](_0x1a10('0x3a')))),_0x1a10('0x3b')],[db[_0x1a10('0x20')]['fn'](_0x1a10('0x21'),db[_0x1a10('0x20')]['fn']('IF',db[_0x1a10('0x20')]['literal'](_0x1a10('0x3c')))),_0x1a10('0x3d')],[db[_0x1a10('0x20')]['fn']('COUNT',db[_0x1a10('0x20')]['fn']('IF',db[_0x1a10('0x20')][_0x1a10('0x22')](_0x1a10('0x3e')))),_0x1a10('0x3f')],[db['sequelize']['fn'](_0x1a10('0x21'),db[_0x1a10('0x20')]['fn']('IF',db['sequelize'][_0x1a10('0x22')](_0x1a10('0x40')))),_0x1a10('0x41')],[db['sequelize']['fn'](_0x1a10('0x21'),db[_0x1a10('0x20')]['fn']('IF',db[_0x1a10('0x20')]['literal']('`state`\x20=\x2020,\x201,\x20null'))),'outboundRejectCallsDay'],[db[_0x1a10('0x20')]['fn'](_0x1a10('0x21'),db[_0x1a10('0x20')]['fn']('IF',db[_0x1a10('0x20')]['literal']('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),_0x1a10('0x42')]],'group':['campaign']})[_0x1a10('0xc')](function(_0xe4c55d){logger[_0x1a10('0xd')]('GetVoiceQueueHopperHistory',_0x816f92);logger[_0x1a10('0xf')](_0x1a10('0x2a'),_0x816f92,JSON[_0x1a10('0x1c')](_0xe4c55d));_0x567e29(_0xe4c55d);})[_0x1a10('0x15')](function(_0x5ca1a2){logger[_0x1a10('0x12')](_0x1a10('0x2a'),_0x5ca1a2[_0x1a10('0x14')],_0x816f92);_0x4efdc3(_0x2f1c48[_0x1a10('0x12')](0x1f4,_0x5ca1a2[_0x1a10('0x14')]));});});};exports[_0x1a10('0x43')]=function(_0x2920e9){var _0x1a3e67=this;return new Promise(function(_0x377f08,_0x497a8e){return db[_0x1a10('0x17')][_0x1a10('0x1e')]({'raw':_0x2920e9[_0x1a10('0x1a')]?_0x2920e9[_0x1a10('0x1a')][_0x1a10('0x1b')]===undefined?!![]:![]:!![],'where':_0x2920e9[_0x1a10('0x1a')]?_0x2920e9['options'][_0x1a10('0x1f')]||null:null,'attributes':[[_0x1a10('0x2b'),_0x1a10('0x2c')],[db[_0x1a10('0x20')]['fn'](_0x1a10('0x21'),db[_0x1a10('0x20')][_0x1a10('0x44')]('id')),_0x1a10('0x45')],[db['sequelize']['fn'](_0x1a10('0x21'),db[_0x1a10('0x20')]['fn']('IF',db['sequelize']['literal'](_0x1a10('0x46')))),_0x1a10('0x47')]],'group':['campaign']})['then'](function(_0x2df349){logger['info']('GetCampaignHopperHistory',_0x2920e9);logger[_0x1a10('0xf')](_0x1a10('0x43'),_0x2920e9,JSON[_0x1a10('0x1c')](_0x2df349));_0x377f08(_0x2df349);})[_0x1a10('0x15')](function(_0x3dc312){logger[_0x1a10('0x12')]('GetCampaignHopperHistory',_0x3dc312[_0x1a10('0x14')],_0x2920e9);_0x497a8e(_0x1a3e67['error'](0x1f4,_0x3dc312[_0x1a10('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 69857cd..a0ed302 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 _0x2371=['create','put','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./cmHopperHistory.controller','get','isAuthenticated','/describe','/:id','show'];(function(_0x225a75,_0x10a71b){var _0x13281a=function(_0x264de2){while(--_0x264de2){_0x225a75['push'](_0x225a75['shift']());}};_0x13281a(++_0x10a71b);}(_0x2371,0xa7));var _0x1237=function(_0x1bb6aa,_0x40fe82){_0x1bb6aa=_0x1bb6aa-0x0;var _0x2ef28e=_0x2371[_0x1bb6aa];return _0x2ef28e;};'use strict';var multer=require('multer');var util=require(_0x1237('0x0'));var path=require(_0x1237('0x1'));var timeout=require(_0x1237('0x2'));var express=require(_0x1237('0x3'));var router=express[_0x1237('0x4')]();var fs_extra=require(_0x1237('0x5'));var auth=require(_0x1237('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1237('0x7'));router[_0x1237('0x8')]('/',auth[_0x1237('0x9')](),controller['index']);router[_0x1237('0x8')](_0x1237('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x1237('0x8')](_0x1237('0xb'),auth['isAuthenticated'](),controller[_0x1237('0xc')]);router['post']('/',auth[_0x1237('0x9')](),controller[_0x1237('0xd')]);router[_0x1237('0xe')]('/:id',auth['isAuthenticated'](),controller['update']);module['exports']=router; \ No newline at end of file +var _0x6b87=['index','/describe','describe','/:id','post','create','put','update','exports','multer','util','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x5145d6,_0x586d45){var _0x3daa24=function(_0x26442c){while(--_0x26442c){_0x5145d6['push'](_0x5145d6['shift']());}};_0x3daa24(++_0x586d45);}(_0x6b87,0x190));var _0x76b8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6b87[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x76b8('0x0'));var util=require(_0x76b8('0x1'));var path=require('path');var timeout=require(_0x76b8('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x76b8('0x3'));var interaction=require(_0x76b8('0x4'));var config=require(_0x76b8('0x5'));var controller=require('./cmHopperHistory.controller');router[_0x76b8('0x6')]('/',auth[_0x76b8('0x7')](),controller[_0x76b8('0x8')]);router[_0x76b8('0x6')](_0x76b8('0x9'),auth[_0x76b8('0x7')](),controller[_0x76b8('0xa')]);router[_0x76b8('0x6')](_0x76b8('0xb'),auth[_0x76b8('0x7')](),controller['show']);router[_0x76b8('0xc')]('/',auth['isAuthenticated'](),controller[_0x76b8('0xd')]);router[_0x76b8('0xe')](_0x76b8('0xb'),auth[_0x76b8('0x7')](),controller[_0x76b8('0xf')]);module[_0x76b8('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 68fb185..aa042a1 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 _0x19da=['exports','name','STRING'];(function(_0x412ad0,_0x1fdf45){var _0x3104be=function(_0x983a56){while(--_0x983a56){_0x412ad0['push'](_0x412ad0['shift']());}};_0x3104be(++_0x1fdf45);}(_0x19da,0x9f));var _0xa19d=function(_0x4f431d,_0xd51a3b){_0x4f431d=_0x4f431d-0x0;var _0x4f31e1=_0x19da[_0x4f431d];return _0x4f31e1;};'use strict';var Sequelize=require('sequelize');module[_0xa19d('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xa19d('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize[_0xa19d('0x2')]}}; \ No newline at end of file +var _0x68f5=['sequelize','exports','STRING'];(function(_0x58dc25,_0x49b9d5){var _0x21b0a7=function(_0x38a186){while(--_0x38a186){_0x58dc25['push'](_0x58dc25['shift']());}};_0x21b0a7(++_0x49b9d5);}(_0x68f5,0x11a));var _0x568f=function(_0x477253,_0x475ce7){_0x477253=_0x477253-0x0;var _0x32e970=_0x68f5[_0x477253];return _0x32e970;};'use strict';var Sequelize=require(_0x568f('0x0'));module[_0x568f('0x1')]={'name':{'type':Sequelize[_0x568f('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x568f('0x2')]},'dialPrefix':{'type':Sequelize[_0x568f('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 8abf9c0..0511cc3 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 _0x0ef8=['sequelize','transaction','Sequelize','TEXT','number','INTEGER','addColumn','getCustomFields','findAndCountAll','getGlobalCustomFields','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','info','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','redis','socket.io-emitter','./cmList.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','destroy','then','Lists','error','name','send','CmList','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','includeAll','findAll','rows','catch','show','options','find','create','body','user','get','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','update','params','describe','addDisposition','ListId','Disposition','getDispositions','findOne','order','include','removeDispositions','ids','addContacts','CmContact','tags','isArray','join','each','omit','success','dataValues','errors','push','message','CmCustomField','CustomFields','concat','format','cf_%d','getContacts','getContactsCsv','ContactItemType','OrderBy','select','cm_contacts','c.ListId\x20=\x20?','distinct','field','c.cf_','customField_','alias','item','from','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','description','cm_contact_has_items','description_additionalPhone_','toString','isEmpty','now','writeFileSync','setHeader','Content-disposition','attachment;\x20filename=','text/csv','download','/tmp/list_%d_%s.csv'];(function(_0x1e6e4e,_0x2b1b09){var _0x3d746b=function(_0x4483dd){while(--_0x4483dd){_0x1e6e4e['push'](_0x1e6e4e['shift']());}};_0x3d746b(++_0x2b1b09);}(_0x0ef8,0x151));var _0x80ef=function(_0x4f93e7,_0x542c51){_0x4f93e7=_0x4f93e7-0x0;var _0x1eeb52=_0x0ef8[_0x4f93e7];return _0x1eeb52;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x80ef('0x0'));var zipdir=require(_0x80ef('0x1'));var jsonpatch=require(_0x80ef('0x2'));var rp=require(_0x80ef('0x3'));var moment=require(_0x80ef('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x80ef('0x5'));var util=require(_0x80ef('0x6'));var path=require(_0x80ef('0x7'));var sox=require(_0x80ef('0x8'));var csv=require(_0x80ef('0x9'));var ejs=require(_0x80ef('0xa'));var fs=require('fs');var fs_extra=require(_0x80ef('0xb'));var _=require('lodash');var squel=require(_0x80ef('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x80ef('0xd'));var toCsv=require(_0x80ef('0x9'));var querystring=require('querystring');var Papa=require(_0x80ef('0xe'));var Redis=require(_0x80ef('0xf'));var authService=require(_0x80ef('0x10'));var qs=require(_0x80ef('0x11'));var as=require(_0x80ef('0x12'));var hardwareService=require(_0x80ef('0x13'));var logger=require(_0x80ef('0x14'))(_0x80ef('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x80ef('0x16'));var db=require('../../mysqldb')['db'];var csv_results;config[_0x80ef('0x17')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x80ef('0x18'))(new Redis(config[_0x80ef('0x17')]));require(_0x80ef('0x19'))[_0x80ef('0x1a')](socket);function respondWithStatusCode(_0x43591a,_0xe10a61){_0xe10a61=_0xe10a61||0xcc;return function(_0x17558d){if(_0x17558d){return _0x43591a[_0x80ef('0x1b')](_0xe10a61);}return _0x43591a['status'](_0xe10a61)[_0x80ef('0x1c')]();};}function respondWithResult(_0x27612b,_0x169a3f){_0x169a3f=_0x169a3f||0xc8;return function(_0x2eb8a8){if(_0x2eb8a8){return _0x27612b[_0x80ef('0x1d')](_0x169a3f)[_0x80ef('0x1e')](_0x2eb8a8);}};}function respondWithFilteredResult(_0x3ebb9d,_0x37fdc9){return function(_0x13acc1){if(_0x13acc1){var _0x577597=typeof _0x37fdc9[_0x80ef('0x1f')]===_0x80ef('0x20')&&typeof _0x37fdc9[_0x80ef('0x21')]===_0x80ef('0x20');var _0x85fd98=_0x13acc1['count'];var _0x1ed731=_0x577597?0x0:_0x37fdc9[_0x80ef('0x1f')];var _0x371789=_0x577597?_0x13acc1[_0x80ef('0x22')]:_0x37fdc9[_0x80ef('0x1f')]+_0x37fdc9[_0x80ef('0x21')];var _0x4a7e09;if(_0x371789>=_0x85fd98){_0x371789=_0x85fd98;_0x4a7e09=0xc8;}else{_0x4a7e09=0xce;}_0x3ebb9d[_0x80ef('0x1d')](_0x4a7e09);return _0x3ebb9d[_0x80ef('0x23')]('Content-Range',_0x1ed731+'-'+_0x371789+'/'+_0x85fd98)[_0x80ef('0x1e')](_0x13acc1);}return null;};}function patchUpdates(_0x4ca403){return function(_0x456af6){try{jsonpatch[_0x80ef('0x24')](_0x456af6,_0x4ca403,!![]);}catch(_0x3df6d4){return BPromise[_0x80ef('0x25')](_0x3df6d4);}return _0x456af6[_0x80ef('0x26')]();};}function saveUpdates(_0xb0a162,_0x237708){return function(_0x35f1e9){if(_0x35f1e9){return _0x35f1e9['update'](_0xb0a162)['then'](function(_0x283329){return _0x283329;});}return null;};}function removeEntity(_0x5614cc,_0x5b2ff5){return function(_0x21e9bc){if(_0x21e9bc){return _0x21e9bc[_0x80ef('0x27')]()[_0x80ef('0x28')](function(){var _0x50d3c5=_0x21e9bc['get']({'plain':!![]});var _0x1d5fff=_0x80ef('0x29');return db['UserProfileResource'][_0x80ef('0x27')]({'where':{'type':_0x1d5fff,'resourceId':_0x50d3c5['id']}})[_0x80ef('0x28')](function(){return _0x21e9bc;});})[_0x80ef('0x28')](function(){_0x5614cc[_0x80ef('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x57db16,_0x23dd98){return function(_0x1eccb8){if(!_0x1eccb8){_0x57db16[_0x80ef('0x1b')](0x194);}return _0x1eccb8;};}function handleError(_0xc66f51,_0x277ece){_0x277ece=_0x277ece||0x1f4;return function(_0x3727f7){logger[_0x80ef('0x2a')](_0x3727f7['stack']);if(_0x3727f7[_0x80ef('0x2b')]){delete _0x3727f7[_0x80ef('0x2b')];}_0xc66f51['status'](_0x277ece)[_0x80ef('0x2c')](_0x3727f7);};}exports['index']=function(_0x3aac9f,_0x542fbf){var _0x3d497d={},_0x4723e9={},_0x473c7a={'count':0x0,'rows':[]};var _0x475e35=_['map'](db[_0x80ef('0x2d')][_0x80ef('0x2e')],function(_0xad9b8){return{'name':_0xad9b8[_0x80ef('0x2f')],'type':_0xad9b8[_0x80ef('0x30')][_0x80ef('0x31')]};});_0x4723e9[_0x80ef('0x32')]=_[_0x80ef('0x33')](_0x475e35,_0x80ef('0x2b'));_0x4723e9[_0x80ef('0x34')]=_[_0x80ef('0x35')](_0x3aac9f[_0x80ef('0x34')]);_0x4723e9[_0x80ef('0x36')]=_[_0x80ef('0x37')](_0x4723e9[_0x80ef('0x32')],_0x4723e9['query']);_0x3d497d[_0x80ef('0x38')]=_[_0x80ef('0x37')](_0x4723e9[_0x80ef('0x32')],qs['fields'](_0x3aac9f[_0x80ef('0x34')][_0x80ef('0x39')]));_0x3d497d['attributes']=_0x3d497d['attributes'][_0x80ef('0x3a')]?_0x3d497d[_0x80ef('0x38')]:_0x4723e9[_0x80ef('0x32')];if(!_0x3aac9f['query'][_0x80ef('0x3b')](_0x80ef('0x3c'))){_0x3d497d[_0x80ef('0x21')]=qs[_0x80ef('0x21')](_0x3aac9f[_0x80ef('0x34')][_0x80ef('0x21')]);_0x3d497d['offset']=qs[_0x80ef('0x1f')](_0x3aac9f[_0x80ef('0x34')][_0x80ef('0x1f')]);}_0x3d497d['order']=qs[_0x80ef('0x3d')](_0x3aac9f[_0x80ef('0x34')][_0x80ef('0x3d')]);_0x3d497d[_0x80ef('0x3e')]=qs[_0x80ef('0x36')](_[_0x80ef('0x3f')](_0x3aac9f['query'],_0x4723e9[_0x80ef('0x36')]),_0x475e35);if(_0x3aac9f[_0x80ef('0x34')][_0x80ef('0x40')]){_0x3d497d['where']=_['merge'](_0x3d497d[_0x80ef('0x3e')],{'$or':_[_0x80ef('0x33')](_0x475e35,function(_0x1baad2){if(_0x1baad2[_0x80ef('0x30')]!==_0x80ef('0x41')){var _0x32544e={};_0x32544e[_0x1baad2[_0x80ef('0x2b')]]={'$like':'%'+_0x3aac9f[_0x80ef('0x34')][_0x80ef('0x40')]+'%'};return _0x32544e;}})});}_0x3d497d=_[_0x80ef('0x42')]({},_0x3d497d,_0x3aac9f['options']);var _0x448d35={'where':_0x3d497d[_0x80ef('0x3e')]};return db['CmList']['count'](_0x448d35)[_0x80ef('0x28')](function(_0x43a296){_0x473c7a[_0x80ef('0x22')]=_0x43a296;if(_0x3aac9f[_0x80ef('0x34')][_0x80ef('0x43')]){_0x3d497d['include']=[{'all':!![]}];}return db['CmList'][_0x80ef('0x44')](_0x3d497d);})[_0x80ef('0x28')](function(_0x3cf9f5){_0x473c7a[_0x80ef('0x45')]=_0x3cf9f5;return _0x473c7a;})['then'](respondWithFilteredResult(_0x542fbf,_0x3d497d))[_0x80ef('0x46')](handleError(_0x542fbf,null));};exports[_0x80ef('0x47')]=function(_0x297e8e,_0xf4e421){var _0x3e060e={'raw':![],'where':{'id':_0x297e8e['params']['id']}},_0x10e2b0={};_0x10e2b0[_0x80ef('0x32')]=_[_0x80ef('0x35')](db[_0x80ef('0x2d')]['rawAttributes']);_0x10e2b0[_0x80ef('0x34')]=_[_0x80ef('0x35')](_0x297e8e[_0x80ef('0x34')]);_0x10e2b0['filters']=_[_0x80ef('0x37')](_0x10e2b0[_0x80ef('0x32')],_0x10e2b0[_0x80ef('0x34')]);_0x3e060e[_0x80ef('0x38')]=_[_0x80ef('0x37')](_0x10e2b0['model'],qs[_0x80ef('0x39')](_0x297e8e[_0x80ef('0x34')][_0x80ef('0x39')]));_0x3e060e[_0x80ef('0x38')]=_0x3e060e[_0x80ef('0x38')][_0x80ef('0x3a')]?_0x3e060e[_0x80ef('0x38')]:_0x10e2b0[_0x80ef('0x32')];if(_0x297e8e['query']['includeAll']){_0x3e060e['include']=[{'all':!![]}];}_0x3e060e=_[_0x80ef('0x42')]({},_0x3e060e,_0x297e8e[_0x80ef('0x48')]);return db[_0x80ef('0x2d')][_0x80ef('0x49')](_0x3e060e)['then'](handleEntityNotFound(_0xf4e421,null))['then'](respondWithResult(_0xf4e421,null))[_0x80ef('0x46')](handleError(_0xf4e421,null));};exports['create']=function(_0x5557db,_0x4d6c92){return db[_0x80ef('0x2d')][_0x80ef('0x4a')](_0x5557db[_0x80ef('0x4b')],{})['then'](function(_0x2db262){var _0x122e1e=_0x5557db[_0x80ef('0x4c')]['get']({'plain':!![]});if(!_0x122e1e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x122e1e['role']===_0x80ef('0x4c')){var _0x3a1c9c=_0x2db262[_0x80ef('0x4d')]({'plain':!![]});var _0x3dfa8a='Lists';return db[_0x80ef('0x4e')]['find']({'where':{'name':_0x3dfa8a,'userProfileId':_0x122e1e[_0x80ef('0x4f')]},'raw':!![]})['then'](function(_0x5870ea){if(_0x5870ea&&_0x5870ea[_0x80ef('0x50')]===0x0){return db[_0x80ef('0x51')][_0x80ef('0x4a')]({'name':_0x3a1c9c[_0x80ef('0x2b')],'resourceId':_0x3a1c9c['id'],'type':_0x5870ea[_0x80ef('0x2b')],'sectionId':_0x5870ea['id']},{})[_0x80ef('0x28')](function(){return _0x2db262;});}else{return _0x2db262;}})[_0x80ef('0x46')](function(_0x217ad9){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x217ad9);throw _0x217ad9;});}return _0x2db262;})['then'](respondWithResult(_0x4d6c92,0xc9))[_0x80ef('0x46')](handleError(_0x4d6c92,null));};exports[_0x80ef('0x52')]=function(_0x1298df,_0x7b557){if(_0x1298df[_0x80ef('0x4b')]['id']){delete _0x1298df[_0x80ef('0x4b')]['id'];}return db['CmList'][_0x80ef('0x49')]({'where':{'id':_0x1298df[_0x80ef('0x53')]['id']}})[_0x80ef('0x28')](handleEntityNotFound(_0x7b557,null))[_0x80ef('0x28')](saveUpdates(_0x1298df[_0x80ef('0x4b')],null))[_0x80ef('0x28')](respondWithResult(_0x7b557,null))[_0x80ef('0x46')](handleError(_0x7b557,null));};exports[_0x80ef('0x27')]=function(_0x18c333,_0x3b9aab){return db[_0x80ef('0x2d')][_0x80ef('0x49')]({'where':{'id':_0x18c333[_0x80ef('0x53')]['id']}})[_0x80ef('0x28')](handleEntityNotFound(_0x3b9aab,null))[_0x80ef('0x28')](removeEntity(_0x3b9aab,null))['catch'](handleError(_0x3b9aab,null));};exports[_0x80ef('0x54')]=function(_0xc0a91e,_0x44ac82){return db[_0x80ef('0x2d')][_0x80ef('0x54')]()[_0x80ef('0x28')](respondWithResult(_0x44ac82,null))[_0x80ef('0x46')](handleError(_0x44ac82,null));};exports[_0x80ef('0x55')]=function(_0x59e731,_0x1fa852,_0x5bfa33){if(_0x59e731[_0x80ef('0x4b')]['id']){delete _0x59e731[_0x80ef('0x4b')]['id'];}return db[_0x80ef('0x2d')]['find']({'where':{'id':_0x59e731[_0x80ef('0x53')]['id']}})[_0x80ef('0x28')](handleEntityNotFound(_0x1fa852,null))[_0x80ef('0x28')](function(_0x57dba4){if(_0x57dba4){_0x59e731[_0x80ef('0x4b')][_0x80ef('0x56')]=_0x57dba4['id'];return db[_0x80ef('0x57')][_0x80ef('0x4a')](_0x59e731[_0x80ef('0x4b')]);}})[_0x80ef('0x28')](respondWithResult(_0x1fa852,null))[_0x80ef('0x46')](handleError(_0x1fa852,null));};exports[_0x80ef('0x58')]=function(_0x314424,_0x3d7030,_0x565934){var _0xc333bf={'raw':![],'where':{}};var _0x4f46dd={};var _0x2567b9={'count':0x0,'rows':[]};return db[_0x80ef('0x2d')][_0x80ef('0x59')]({'where':{'id':_0x314424[_0x80ef('0x53')]['id']}})['then'](handleEntityNotFound(_0x3d7030,null))[_0x80ef('0x28')](function(_0x16e00c){if(_0x16e00c){_0x4f46dd[_0x80ef('0x32')]=_[_0x80ef('0x35')](db[_0x80ef('0x57')][_0x80ef('0x2e')]);_0x4f46dd[_0x80ef('0x34')]=_['keys'](_0x314424[_0x80ef('0x34')]);_0x4f46dd['filters']=_[_0x80ef('0x37')](_0x4f46dd[_0x80ef('0x32')],_0x4f46dd[_0x80ef('0x34')]);_0xc333bf['attributes']=_[_0x80ef('0x37')](_0x4f46dd[_0x80ef('0x32')],qs['fields'](_0x314424[_0x80ef('0x34')]['fields']));_0xc333bf[_0x80ef('0x38')]=_0xc333bf[_0x80ef('0x38')][_0x80ef('0x3a')]?_0xc333bf[_0x80ef('0x38')]:_0x4f46dd['model'];if(!_0x314424[_0x80ef('0x34')]['hasOwnProperty'](_0x80ef('0x3c'))){_0xc333bf[_0x80ef('0x21')]=qs['limit'](_0x314424[_0x80ef('0x34')][_0x80ef('0x21')]);_0xc333bf['offset']=qs['offset'](_0x314424['query'][_0x80ef('0x1f')]);}_0xc333bf[_0x80ef('0x5a')]=qs[_0x80ef('0x3d')](_0x314424[_0x80ef('0x34')][_0x80ef('0x3d')]);_0xc333bf[_0x80ef('0x3e')]=qs[_0x80ef('0x36')](_[_0x80ef('0x3f')](_0x314424['query'],_0x4f46dd[_0x80ef('0x36')]));_0xc333bf[_0x80ef('0x3e')]['ListId']=_0x16e00c['id'];if(_0x314424[_0x80ef('0x34')][_0x80ef('0x40')]){_0xc333bf[_0x80ef('0x3e')]=_[_0x80ef('0x42')](_0xc333bf[_0x80ef('0x3e')],{'$or':_['map'](_0xc333bf['attributes'],function(_0x3bcd09){var _0x1bc5f6={};_0x1bc5f6[_0x3bcd09]={'$like':'%'+_0x314424[_0x80ef('0x34')][_0x80ef('0x40')]+'%'};return _0x1bc5f6;})});}_0xc333bf=_[_0x80ef('0x42')]({},_0xc333bf,_0x314424[_0x80ef('0x48')]);return db['Disposition'][_0x80ef('0x22')]({'where':_0xc333bf['where']})[_0x80ef('0x28')](function(_0x24d6c9){_0x2567b9['count']=_0x24d6c9;if(_0x314424['query'][_0x80ef('0x43')]){_0xc333bf[_0x80ef('0x5b')]=[{'all':!![]}];}return db[_0x80ef('0x57')][_0x80ef('0x44')](_0xc333bf);})[_0x80ef('0x28')](function(_0x240c00){_0x2567b9[_0x80ef('0x45')]=_0x240c00;return _0x2567b9;});}})[_0x80ef('0x28')](respondWithFilteredResult(_0x3d7030,_0xc333bf))[_0x80ef('0x46')](handleError(_0x3d7030,null));};exports[_0x80ef('0x5c')]=function(_0x1a4a14,_0x40ca1e,_0x9283df){return db[_0x80ef('0x2d')][_0x80ef('0x49')]({'where':{'id':_0x1a4a14[_0x80ef('0x53')]['id']}})[_0x80ef('0x28')](handleEntityNotFound(_0x40ca1e,null))[_0x80ef('0x28')](function(_0x2e32ac){if(_0x2e32ac){return _0x2e32ac[_0x80ef('0x5c')](_0x1a4a14[_0x80ef('0x34')][_0x80ef('0x5d')]);}})[_0x80ef('0x28')](respondWithStatusCode(_0x40ca1e,null))[_0x80ef('0x46')](handleError(_0x40ca1e,null));};exports[_0x80ef('0x5e')]=function(_0x4dcd85,_0x375e6b,_0x427f77){return db['CmList'][_0x80ef('0x49')]({'where':{'id':_0x4dcd85['params']['id']}})['then'](handleEntityNotFound(_0x375e6b,null))[_0x80ef('0x28')](function(_0x2e0656){if(_0x2e0656){var _0x4961d3=[];var _0x564e97={'success':[],'errors':[]};return db[_0x80ef('0x5f')]['describe']()[_0x80ef('0x28')](function(_0x4acd58){if(_0x4dcd85[_0x80ef('0x4b')][_0x80ef('0x60')]&&_[_0x80ef('0x61')](_0x4dcd85[_0x80ef('0x4b')]['tags'])){if(_0x4dcd85[_0x80ef('0x4b')][_0x80ef('0x60')][_0x80ef('0x3a')]){_0x4dcd85[_0x80ef('0x4b')][_0x80ef('0x60')]=_0x4dcd85[_0x80ef('0x4b')][_0x80ef('0x60')][_0x80ef('0x62')](';')+';';}else{_0x4dcd85['body'][_0x80ef('0x60')]=null;}}else{_0x4dcd85['body'][_0x80ef('0x60')]=null;}if(_0x4dcd85[_0x80ef('0x4b')]&&_[_0x80ef('0x61')](_0x4dcd85[_0x80ef('0x4b')])){for(var _0x569ff0=0x0;_0x569ff0<_0x4dcd85[_0x80ef('0x4b')]['length'];_0x569ff0+=0x1){_0x4dcd85['body'][_0x569ff0][_0x80ef('0x56')]=_0x4dcd85[_0x80ef('0x53')]['id'];_0x4961d3['push'](_0x4dcd85[_0x80ef('0x4b')][_0x569ff0]);}return BPromise[_0x80ef('0x63')](_0x4961d3,function(_0x26ab6f){return db[_0x80ef('0x5f')][_0x80ef('0x4a')](_[_0x80ef('0x64')](_0x26ab6f,[_0x80ef('0x5d'),'id'])||{},{'fields':_[_0x80ef('0x35')](_0x4acd58),'raw':!![]})[_0x80ef('0x28')](function(_0x3cad09){_0x564e97[_0x80ef('0x65')]['push'](_0x3cad09[_0x80ef('0x66')]);})['catch'](function(_0x127b01){_0x564e97[_0x80ef('0x67')][_0x80ef('0x68')]({'data':_0x26ab6f,'error':_0x127b01[_0x80ef('0x69')]});});})['then'](function(_0x2def9f){return _0x564e97;})['catch'](function(_0x1e86fa){return _0x1e86fa;});}else{_0x375e6b[_0x80ef('0x1d')](0x190)['json']({'message':'Malformed\x20request\x20syntax'});}});}})[_0x80ef('0x28')](respondWithResult(_0x375e6b,null))[_0x80ef('0x46')](handleError(_0x375e6b,null));};exports['getContacts']=function(_0x391245,_0x2c5872,_0x1563d0){var _0x5cb661;return db[_0x80ef('0x2d')][_0x80ef('0x49')]({'where':{'id':_0x391245[_0x80ef('0x53')]['id']},'include':[{'model':db[_0x80ef('0x6a')],'as':_0x80ef('0x6b')}]})[_0x80ef('0x28')](handleEntityNotFound(_0x2c5872,null))[_0x80ef('0x28')](function(_0x3c99de){if(_0x3c99de){_0x5cb661=_0x3c99de;return db[_0x80ef('0x5f')][_0x80ef('0x2e')];}})['then'](function(_0x19c8e3){if(_0x19c8e3){var _0x502d63={};var _0x23af5e={};_0x23af5e[_0x80ef('0x32')]=_[_0x80ef('0x6c')](_[_0x80ef('0x35')](_0x19c8e3),_[_0x80ef('0x33')](_0x5cb661[_0x80ef('0x6b')],function(_0x3e2acb){return util[_0x80ef('0x6d')](_0x80ef('0x6e'),_0x3e2acb['id']);}));_0x23af5e[_0x80ef('0x34')]=_[_0x80ef('0x35')](_0x391245['query']);_0x23af5e[_0x80ef('0x36')]=_['intersection'](_0x23af5e[_0x80ef('0x32')],_0x23af5e[_0x80ef('0x34')]);_0x502d63[_0x80ef('0x38')]=_['intersection'](_0x23af5e[_0x80ef('0x32')],qs[_0x80ef('0x39')](_0x391245[_0x80ef('0x34')]['fields']));_0x502d63[_0x80ef('0x38')]=_0x502d63[_0x80ef('0x38')]['length']?_0x502d63[_0x80ef('0x38')]:_0x23af5e['model'];if(!_0x391245[_0x80ef('0x34')]['hasOwnProperty'](_0x80ef('0x3c'))){_0x502d63[_0x80ef('0x21')]=qs[_0x80ef('0x21')](_0x391245[_0x80ef('0x34')][_0x80ef('0x21')]);_0x502d63[_0x80ef('0x1f')]=qs[_0x80ef('0x1f')](_0x391245[_0x80ef('0x34')][_0x80ef('0x1f')]);}_0x502d63[_0x80ef('0x5a')]=qs[_0x80ef('0x3d')](_0x391245['query'][_0x80ef('0x3d')]);_0x502d63[_0x80ef('0x3e')]=qs[_0x80ef('0x36')](_['pick'](_0x391245[_0x80ef('0x34')],_0x23af5e['filters']));_0x502d63['raw']=!![];if(_0x391245['query'][_0x80ef('0x40')]){_0x502d63['where']=_[_0x80ef('0x42')](_0x502d63[_0x80ef('0x3e')],{'$or':_['map'](_0x502d63[_0x80ef('0x38')],function(_0x3da0cf){var _0x1373f8={};_0x1373f8[_0x3da0cf]={'$like':'%'+_0x391245[_0x80ef('0x34')]['filter']+'%'};return _0x1373f8;})});}_0x502d63=_['merge']({},_0x502d63,_0x391245['options']);return _0x5cb661[_0x80ef('0x6f')](_0x502d63);}})[_0x80ef('0x28')](respondWithResult(_0x2c5872,null))[_0x80ef('0x46')](handleError(_0x2c5872,null));};exports[_0x80ef('0x70')]=function(_0x33e28d,_0x4852dd,_0x381939){var _0x35e7a8;var _0x371e5e;var _0x3b1e25;var _0x590c7a=_0x33e28d['params']['id'];csv_results=[];return db[_0x80ef('0x71')][_0x80ef('0x44')]({'attributes':['id',_0x80ef('0x2b')],'raw':!![],'order':[_0x80ef('0x72')]})[_0x80ef('0x28')](function(_0x3dd087){_0x35e7a8=_0x3dd087;var _0x5063c4=_[_0x80ef('0x35')](db[_0x80ef('0x5f')][_0x80ef('0x2e')]);return db[_0x80ef('0x6a')][_0x80ef('0x44')]({'raw':!![],'attributes':['id','alias']})[_0x80ef('0x28')](function(_0x390c53){_0x371e5e=_0x390c53;var _0x4d4026=squel[_0x80ef('0x73')]()[_0x80ef('0x39')](_0x5063c4)['from'](_0x80ef('0x74'),'c')[_0x80ef('0x3e')](_0x80ef('0x75'),_0x590c7a)[_0x80ef('0x3e')]('c.deletedAt\x20is\x20null')[_0x80ef('0x76')]();for(var _0x4dbcbd=0x0;_0x4dbcbd<_0x371e5e[_0x80ef('0x3a')];_0x4dbcbd++){_0x4d4026[_0x80ef('0x77')](_0x80ef('0x78')+_0x371e5e[_0x4dbcbd]['id'],_0x80ef('0x79')+_0x371e5e[_0x4dbcbd][_0x80ef('0x7a')]);}for(var _0x4dbcbd=0x0;_0x4dbcbd<_0x35e7a8['length'];_0x4dbcbd++){_0x4d4026[_0x80ef('0x77')](squel[_0x80ef('0x73')]()[_0x80ef('0x77')](_0x80ef('0x7b'))[_0x80ef('0x7c')]('cm_contact_has_items')[_0x80ef('0x3e')](_0x80ef('0x7d'),_0x35e7a8[_0x4dbcbd]['id'])[_0x80ef('0x3e')](_0x80ef('0x7e')),'additionalPhone_'+_0x35e7a8[_0x4dbcbd]['name']);_0x4d4026[_0x80ef('0x77')](squel[_0x80ef('0x73')]()[_0x80ef('0x77')](_0x80ef('0x7f'))['from'](_0x80ef('0x80'))[_0x80ef('0x3e')]('ItemTypeId\x20=\x20?',_0x35e7a8[_0x4dbcbd]['id'])[_0x80ef('0x3e')]('CmContactId\x20=\x20c.id'),_0x80ef('0x81')+_0x35e7a8[_0x4dbcbd][_0x80ef('0x2b')]);}var _0x1c6d4f=[];_0x1c6d4f[_0x80ef('0x68')](_0x4d4026[_0x80ef('0x82')]());BPromise[_0x80ef('0x63')](_0x1c6d4f,handleQuery)[_0x80ef('0x28')](function(_0x4ad776){handleQuery(_0x4d4026[_0x80ef('0x82')]());var _0x7820df=csv_results[0x0];if(!_[_0x80ef('0x83')](_0x7820df)){var _0x25ad9b=toCsv(_0x7820df);var _0x1d6080=Date[_0x80ef('0x84')]();fs[_0x80ef('0x85')](util[_0x80ef('0x6d')]('/tmp/list_%d_%s.csv',_0x590c7a,_0x1d6080),_0x25ad9b);_0x4852dd[_0x80ef('0x86')](_0x80ef('0x87'),_0x80ef('0x88')+util[_0x80ef('0x6d')]('list_%d_%s.csv',_0x590c7a,_0x1d6080));_0x4852dd[_0x80ef('0x86')]('Content-type',_0x80ef('0x89'));return _0x4852dd[_0x80ef('0x8a')](util[_0x80ef('0x6d')](_0x80ef('0x8b'),_0x590c7a,_0x1d6080));}else{return _0x4852dd[_0x80ef('0x1b')](0xcc);}});});});};exports['addCustomField']=function(_0x1623b3,_0x4345e3,_0x46fe51){var _0x4799a3;delete _0x1623b3[_0x80ef('0x4b')]['id'];return db['CmList']['findOne']({'where':{'id':_0x1623b3[_0x80ef('0x53')]['id']}})[_0x80ef('0x28')](handleEntityNotFound(_0x4345e3,null))['then'](function(_0x374301){if(_0x374301){return db[_0x80ef('0x8c')][_0x80ef('0x8d')](function(_0x39dc76){return db['CmCustomField'][_0x80ef('0x4a')](_0x1623b3['body'],{'transaction':_0x39dc76})[_0x80ef('0x28')](function(_0x2ffedc){_0x4799a3=_0x2ffedc;return _0x374301['addCustomFields'](_0x2ffedc,{'transaction':_0x39dc76});})[_0x80ef('0x28')](function(){var _0x520aff={'type':db[_0x80ef('0x8e')][_0x80ef('0x8f')],'transaction':_0x39dc76};switch(_0x1623b3[_0x80ef('0x4b')][_0x80ef('0x30')]){case'text':_0x520aff[_0x80ef('0x30')]=db['Sequelize'][_0x80ef('0x8f')];break;case _0x80ef('0x90'):_0x520aff['type']=db[_0x80ef('0x8e')][_0x80ef('0x91')];break;case'switch':_0x520aff[_0x80ef('0x30')]=db[_0x80ef('0x8e')]['BOOLEAN'];_0x520aff['defaultValue']=![];break;default:}return db[_0x80ef('0x8c')]['queryInterface'][_0x80ef('0x92')]('cm_contacts',util['format']('cf_%s',_0x4799a3['id']),_0x520aff);})[_0x80ef('0x28')](function(){return _0x4799a3;});});}})[_0x80ef('0x28')](respondWithResult(_0x4345e3,null))[_0x80ef('0x46')](handleError(_0x4345e3,null));};exports[_0x80ef('0x93')]=function(_0x3cb48b,_0x1c2e03,_0x17c45f){var _0x2cafc9={};var _0x5240e1={};var _0x209c0a;var _0x116f32;return db[_0x80ef('0x2d')][_0x80ef('0x59')]({'where':{'id':_0x3cb48b[_0x80ef('0x53')]['id']}})[_0x80ef('0x28')](handleEntityNotFound(_0x1c2e03,null))[_0x80ef('0x28')](function(_0x127202){if(_0x127202){_0x209c0a=_0x127202;_0x5240e1['model']=_['keys'](db[_0x80ef('0x6a')][_0x80ef('0x2e')]);_0x5240e1[_0x80ef('0x34')]=_[_0x80ef('0x35')](_0x3cb48b[_0x80ef('0x34')]);_0x5240e1['filters']=_[_0x80ef('0x37')](_0x5240e1['model'],_0x5240e1[_0x80ef('0x34')]);_0x2cafc9['attributes']=_[_0x80ef('0x37')](_0x5240e1['model'],qs[_0x80ef('0x39')](_0x3cb48b[_0x80ef('0x34')][_0x80ef('0x39')]));_0x2cafc9[_0x80ef('0x38')]=_0x2cafc9[_0x80ef('0x38')][_0x80ef('0x3a')]?_0x2cafc9['attributes']:_0x5240e1[_0x80ef('0x32')];_0x2cafc9[_0x80ef('0x5a')]=qs[_0x80ef('0x3d')](_0x3cb48b[_0x80ef('0x34')][_0x80ef('0x3d')]);_0x2cafc9[_0x80ef('0x3e')]=qs['filters'](_[_0x80ef('0x3f')](_0x3cb48b[_0x80ef('0x34')],_0x5240e1[_0x80ef('0x36')]));_0x2cafc9[_0x80ef('0x3e')]=_[_0x80ef('0x42')](_0x2cafc9['where'],{'$or':[{'ListId':_0x127202['id']},{'ListId':null}]});if(_0x3cb48b['query'][_0x80ef('0x40')]){_0x2cafc9['where']=_[_0x80ef('0x42')](_0x2cafc9[_0x80ef('0x3e')],{'$or':_[_0x80ef('0x33')](_0x2cafc9[_0x80ef('0x38')],function(_0x36c063){var _0x3be32d={};_0x3be32d[_0x36c063]={'$like':'%'+_0x3cb48b[_0x80ef('0x34')]['filter']+'%'};return _0x3be32d;})});}_0x2cafc9=_[_0x80ef('0x42')]({},_0x2cafc9,_0x3cb48b[_0x80ef('0x48')]);return db[_0x80ef('0x6a')][_0x80ef('0x94')](_0x2cafc9);}})[_0x80ef('0x28')](respondWithResult(_0x1c2e03,null))[_0x80ef('0x46')](handleError(_0x1c2e03,null));};exports[_0x80ef('0x95')]=function(_0x587e5e,_0x4fcdaf){return db['CmCustomField'][_0x80ef('0x94')]({'where':{'ListId':null}})[_0x80ef('0x28')](handleEntityNotFound(_0x4fcdaf,null))['then'](function(_0x5c815e){return _0x5c815e;})[_0x80ef('0x28')](respondWithResult(_0x4fcdaf,null))[_0x80ef('0x46')](handleError(_0x4fcdaf,null));};exports[_0x80ef('0x96')]=function(_0x983ad9,_0x431037,_0x39f2f1){return db[_0x80ef('0x2d')][_0x80ef('0x49')]({'where':{'id':_0x983ad9['params']['id']}})[_0x80ef('0x28')](handleEntityNotFound(_0x431037,null))['then'](function(_0x4daad7){if(_0x4daad7){return _0x4daad7['addAgents'](_0x983ad9['body']['ids'],_[_0x80ef('0x64')](_0x983ad9[_0x80ef('0x4b')],['ids','id'])||{})[_0x80ef('0x97')](function(_0x2c4be4){for(var _0x617d6e=0x0;_0x617d6e<_0x983ad9[_0x80ef('0x4b')]['ids'][_0x80ef('0x3a')];_0x617d6e+=0x1){socket[_0x80ef('0x98')](_0x80ef('0x99'),{'UserId':Number(_0x983ad9[_0x80ef('0x4b')][_0x80ef('0x5d')][_0x617d6e]),'CmListId':Number(_0x983ad9[_0x80ef('0x53')]['id'])});}return _0x2c4be4;});}})[_0x80ef('0x28')](respondWithResult(_0x431037,null))['catch'](handleError(_0x431037,null));};exports[_0x80ef('0x9a')]=function(_0xfa634f,_0x4b0c07,_0x191cee){return db[_0x80ef('0x2d')]['find']({'where':{'id':_0xfa634f['params']['id']}})['then'](handleEntityNotFound(_0x4b0c07,null))[_0x80ef('0x28')](function(_0x5168be){if(_0x5168be){return _0x5168be[_0x80ef('0x9a')](_0xfa634f[_0x80ef('0x34')]['ids'])[_0x80ef('0x28')](function(){if(_[_0x80ef('0x61')](_0xfa634f[_0x80ef('0x34')]['ids'])){for(var _0x2192f6=0x0;_0x2192f6<_0xfa634f['query'][_0x80ef('0x5d')][_0x80ef('0x3a')];_0x2192f6+=0x1){socket[_0x80ef('0x98')](_0x80ef('0x9b'),{'UserId':Number(_0xfa634f[_0x80ef('0x34')][_0x80ef('0x5d')][_0x2192f6]),'CmListId':Number(_0xfa634f[_0x80ef('0x53')]['id'])});}}else{socket[_0x80ef('0x98')]('userCmList:remove',{'UserId':Number(_0xfa634f[_0x80ef('0x34')][_0x80ef('0x5d')]),'CmListId':Number(_0xfa634f[_0x80ef('0x53')]['id'])});}});}})[_0x80ef('0x28')](respondWithStatusCode(_0x4b0c07,null))['catch'](handleError(_0x4b0c07,null));};exports[_0x80ef('0x9c')]=function(_0x41797a,_0x4daf28,_0x3dd0d1){var _0x4f9a3a={};var _0x21176e={};var _0x2e2d72;var _0x535ea2;return db[_0x80ef('0x2d')][_0x80ef('0x59')]({'where':{'id':_0x41797a['params']['id']}})[_0x80ef('0x28')](handleEntityNotFound(_0x4daf28,null))[_0x80ef('0x28')](function(_0x223a8b){if(_0x223a8b){_0x2e2d72=_0x223a8b;_0x21176e[_0x80ef('0x32')]=_[_0x80ef('0x35')](db[_0x80ef('0x9d')][_0x80ef('0x2e')]);_0x21176e[_0x80ef('0x34')]=_[_0x80ef('0x35')](_0x41797a[_0x80ef('0x34')]);_0x21176e['filters']=_[_0x80ef('0x37')](_0x21176e[_0x80ef('0x32')],_0x21176e['query']);_0x4f9a3a[_0x80ef('0x38')]=_[_0x80ef('0x37')](_0x21176e[_0x80ef('0x32')],qs['fields'](_0x41797a[_0x80ef('0x34')]['fields']));_0x4f9a3a['attributes']=_0x4f9a3a['attributes'][_0x80ef('0x3a')]?_0x4f9a3a[_0x80ef('0x38')]:_0x21176e[_0x80ef('0x32')];_0x4f9a3a[_0x80ef('0x5a')]=qs[_0x80ef('0x3d')](_0x41797a['query'][_0x80ef('0x3d')]);_0x4f9a3a[_0x80ef('0x3e')]=qs['filters'](_[_0x80ef('0x3f')](_0x41797a[_0x80ef('0x34')],_0x21176e[_0x80ef('0x36')]));if(_0x41797a[_0x80ef('0x34')][_0x80ef('0x40')]){_0x4f9a3a['where']=_['merge'](_0x4f9a3a[_0x80ef('0x3e')],{'$or':_[_0x80ef('0x33')](_0x4f9a3a[_0x80ef('0x38')],function(_0x47bef0){var _0x21a7bd={};_0x21a7bd[_0x47bef0]={'$like':'%'+_0x41797a[_0x80ef('0x34')][_0x80ef('0x40')]+'%'};return _0x21a7bd;})});}_0x4f9a3a=_[_0x80ef('0x42')]({},_0x4f9a3a,_0x41797a[_0x80ef('0x48')]);return _0x2e2d72[_0x80ef('0x9c')](_0x4f9a3a);}})[_0x80ef('0x28')](function(_0x4ee2a1){if(_0x4ee2a1){_0x535ea2=_0x4ee2a1['length'];if(!_0x41797a[_0x80ef('0x34')][_0x80ef('0x3b')](_0x80ef('0x3c'))){_0x4f9a3a[_0x80ef('0x21')]=qs[_0x80ef('0x21')](_0x41797a[_0x80ef('0x34')][_0x80ef('0x21')]);_0x4f9a3a[_0x80ef('0x1f')]=qs[_0x80ef('0x1f')](_0x41797a[_0x80ef('0x34')]['offset']);}return _0x2e2d72['getAgents'](_0x4f9a3a);}})['then'](function(_0x411040){if(_0x411040){return _0x411040?{'count':_0x535ea2,'rows':_0x411040}:null;}})['then'](respondWithResult(_0x4daf28,null))[_0x80ef('0x46')](handleError(_0x4daf28,null));};function handleQuery(_0x46571c){logger[_0x80ef('0x9e')](_0x46571c);return db[_0x80ef('0x8c')][_0x80ef('0x34')](_0x46571c)[_0x80ef('0x97')](function(_0x4e1e56){csv_results[_0x80ef('0x68')](_0x4e1e56);})[_0x80ef('0x46')](function(_0x1f5f98){logger[_0x80ef('0x2a')](_0x1f5f98[_0x80ef('0x69')]);});} \ No newline at end of file +var _0x732f=['fast-json-patch','moment','bluebird','mustache','util','path','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','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','get','stack','name','send','index','map','fieldName','type','key','model','filters','query','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','filter','merge','CmList','include','rows','catch','show','params','rawAttributes','intersection','length','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','describe','ListId','Disposition','findOne','keys','findAll','removeDispositions','addContacts','CmContact','tags','isArray','join','each','ids','success','push','dataValues','message','getContacts','CmCustomField','CustomFields','format','cf_%d','raw','getContactsCsv','ContactItemType','alias','select','from','cm_contacts','c.deletedAt\x20is\x20null','field','c.cf_','customField_','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','description','toString','isEmpty','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','text/csv','addCustomField','transaction','addCustomFields','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','defaultValue','sequelize','queryInterface','getCustomFields','findAndCountAll','getGlobalCustomFields','addAgents','omit','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','info','error','rimraf','zip-dir'];(function(_0x4bc65f,_0x39ec43){var _0x44f85f=function(_0x175343){while(--_0x175343){_0x4bc65f['push'](_0x4bc65f['shift']());}};_0x44f85f(++_0x39ec43);}(_0x732f,0x9e));var _0xf732=function(_0x375efe,_0x27df2d){_0x375efe=_0x375efe-0x0;var _0x1d5db6=_0x732f[_0x375efe];return _0x1d5db6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf732('0x0'));var zipdir=require(_0xf732('0x1'));var jsonpatch=require(_0xf732('0x2'));var rp=require('request-promise');var moment=require(_0xf732('0x3'));var BPromise=require(_0xf732('0x4'));var Mustache=require(_0xf732('0x5'));var util=require(_0xf732('0x6'));var path=require(_0xf732('0x7'));var sox=require(_0xf732('0x8'));var csv=require(_0xf732('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf732('0xa'));var _=require('lodash');var squel=require(_0xf732('0xb'));var crypto=require(_0xf732('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xf732('0xd'));var toCsv=require(_0xf732('0x9'));var querystring=require(_0xf732('0xe'));var Papa=require('papaparse');var Redis=require(_0xf732('0xf'));var authService=require(_0xf732('0x10'));var qs=require(_0xf732('0x11'));var as=require(_0xf732('0x12'));var hardwareService=require(_0xf732('0x13'));var logger=require(_0xf732('0x14'))(_0xf732('0x15'));var utils=require(_0xf732('0x16'));var config=require(_0xf732('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xf732('0x18'))['db'];var csv_results;config[_0xf732('0x19')]=_[_0xf732('0x1a')](config[_0xf732('0x19')],{'host':_0xf732('0x1b'),'port':0x18eb});var socket=require(_0xf732('0x1c'))(new Redis(config[_0xf732('0x19')]));require('./cmList.socket')[_0xf732('0x1d')](socket);function respondWithStatusCode(_0x2f7834,_0x4828a2){_0x4828a2=_0x4828a2||0xcc;return function(_0x223b0d){if(_0x223b0d){return _0x2f7834[_0xf732('0x1e')](_0x4828a2);}return _0x2f7834[_0xf732('0x1f')](_0x4828a2)[_0xf732('0x20')]();};}function respondWithResult(_0x246452,_0x2a5de0){_0x2a5de0=_0x2a5de0||0xc8;return function(_0x4ba329){if(_0x4ba329){return _0x246452['status'](_0x2a5de0)[_0xf732('0x21')](_0x4ba329);}};}function respondWithFilteredResult(_0x32b2e7,_0x3cb5a0){return function(_0x4b9359){if(_0x4b9359){var _0x10fcb6=typeof _0x3cb5a0[_0xf732('0x22')]===_0xf732('0x23')&&typeof _0x3cb5a0[_0xf732('0x24')]===_0xf732('0x23');var _0x8fe1bf=_0x4b9359[_0xf732('0x25')];var _0x2b869a=_0x10fcb6?0x0:_0x3cb5a0['offset'];var _0x4c86b3=_0x10fcb6?_0x4b9359[_0xf732('0x25')]:_0x3cb5a0[_0xf732('0x22')]+_0x3cb5a0[_0xf732('0x24')];var _0x558f09;if(_0x4c86b3>=_0x8fe1bf){_0x4c86b3=_0x8fe1bf;_0x558f09=0xc8;}else{_0x558f09=0xce;}_0x32b2e7[_0xf732('0x1f')](_0x558f09);return _0x32b2e7[_0xf732('0x26')](_0xf732('0x27'),_0x2b869a+'-'+_0x4c86b3+'/'+_0x8fe1bf)[_0xf732('0x21')](_0x4b9359);}return null;};}function patchUpdates(_0x296f8e){return function(_0x1c8d52){try{jsonpatch['apply'](_0x1c8d52,_0x296f8e,!![]);}catch(_0x32801f){return BPromise[_0xf732('0x28')](_0x32801f);}return _0x1c8d52[_0xf732('0x29')]();};}function saveUpdates(_0x5294a7,_0xfd6910){return function(_0x18846c){if(_0x18846c){return _0x18846c[_0xf732('0x2a')](_0x5294a7)[_0xf732('0x2b')](function(_0x1bbf84){return _0x1bbf84;});}return null;};}function removeEntity(_0x5d2903,_0x593f01){return function(_0x48279f){if(_0x48279f){return _0x48279f[_0xf732('0x2c')]()[_0xf732('0x2b')](function(){var _0x4ef874=_0x48279f[_0xf732('0x2d')]({'plain':!![]});var _0x3c8a77='Lists';return db['UserProfileResource'][_0xf732('0x2c')]({'where':{'type':_0x3c8a77,'resourceId':_0x4ef874['id']}})['then'](function(){return _0x48279f;});})[_0xf732('0x2b')](function(){_0x5d2903[_0xf732('0x1f')](0xcc)[_0xf732('0x20')]();});}};}function handleEntityNotFound(_0x29da44,_0x1eaa9f){return function(_0x5ec115){if(!_0x5ec115){_0x29da44[_0xf732('0x1e')](0x194);}return _0x5ec115;};}function handleError(_0x1823d8,_0x19a1d7){_0x19a1d7=_0x19a1d7||0x1f4;return function(_0x50c0ef){logger['error'](_0x50c0ef[_0xf732('0x2e')]);if(_0x50c0ef[_0xf732('0x2f')]){delete _0x50c0ef[_0xf732('0x2f')];}_0x1823d8[_0xf732('0x1f')](_0x19a1d7)[_0xf732('0x30')](_0x50c0ef);};}exports[_0xf732('0x31')]=function(_0x6bd54c,_0x50d636){var _0x2e9730={},_0x4d6bcd={},_0x5ab2f4={'count':0x0,'rows':[]};var _0x3ed2c0=_[_0xf732('0x32')](db['CmList']['rawAttributes'],function(_0x125541){return{'name':_0x125541[_0xf732('0x33')],'type':_0x125541[_0xf732('0x34')][_0xf732('0x35')]};});_0x4d6bcd[_0xf732('0x36')]=_[_0xf732('0x32')](_0x3ed2c0,_0xf732('0x2f'));_0x4d6bcd['query']=_['keys'](_0x6bd54c['query']);_0x4d6bcd[_0xf732('0x37')]=_['intersection'](_0x4d6bcd['model'],_0x4d6bcd[_0xf732('0x38')]);_0x2e9730[_0xf732('0x39')]=_['intersection'](_0x4d6bcd[_0xf732('0x36')],qs[_0xf732('0x3a')](_0x6bd54c[_0xf732('0x38')]['fields']));_0x2e9730[_0xf732('0x39')]=_0x2e9730['attributes']['length']?_0x2e9730[_0xf732('0x39')]:_0x4d6bcd[_0xf732('0x36')];if(!_0x6bd54c[_0xf732('0x38')][_0xf732('0x3b')](_0xf732('0x3c'))){_0x2e9730[_0xf732('0x24')]=qs[_0xf732('0x24')](_0x6bd54c[_0xf732('0x38')][_0xf732('0x24')]);_0x2e9730[_0xf732('0x22')]=qs[_0xf732('0x22')](_0x6bd54c['query'][_0xf732('0x22')]);}_0x2e9730[_0xf732('0x3d')]=qs[_0xf732('0x3e')](_0x6bd54c[_0xf732('0x38')][_0xf732('0x3e')]);_0x2e9730['where']=qs[_0xf732('0x37')](_[_0xf732('0x3f')](_0x6bd54c[_0xf732('0x38')],_0x4d6bcd[_0xf732('0x37')]),_0x3ed2c0);if(_0x6bd54c[_0xf732('0x38')]['filter']){_0x2e9730[_0xf732('0x40')]=_['merge'](_0x2e9730['where'],{'$or':_[_0xf732('0x32')](_0x3ed2c0,function(_0x3b7a6e){if(_0x3b7a6e[_0xf732('0x34')]!==_0xf732('0x41')){var _0x49b4cf={};_0x49b4cf[_0x3b7a6e[_0xf732('0x2f')]]={'$like':'%'+_0x6bd54c[_0xf732('0x38')][_0xf732('0x42')]+'%'};return _0x49b4cf;}})});}_0x2e9730=_[_0xf732('0x43')]({},_0x2e9730,_0x6bd54c['options']);var _0x3b38a7={'where':_0x2e9730[_0xf732('0x40')]};return db[_0xf732('0x44')]['count'](_0x3b38a7)[_0xf732('0x2b')](function(_0x2417a1){_0x5ab2f4[_0xf732('0x25')]=_0x2417a1;if(_0x6bd54c[_0xf732('0x38')]['includeAll']){_0x2e9730[_0xf732('0x45')]=[{'all':!![]}];}return db[_0xf732('0x44')]['findAll'](_0x2e9730);})[_0xf732('0x2b')](function(_0x40614e){_0x5ab2f4[_0xf732('0x46')]=_0x40614e;return _0x5ab2f4;})[_0xf732('0x2b')](respondWithFilteredResult(_0x50d636,_0x2e9730))[_0xf732('0x47')](handleError(_0x50d636,null));};exports[_0xf732('0x48')]=function(_0x989f22,_0x2b094c){var _0x4541b2={'raw':![],'where':{'id':_0x989f22[_0xf732('0x49')]['id']}},_0x2c8a2f={};_0x2c8a2f[_0xf732('0x36')]=_['keys'](db[_0xf732('0x44')][_0xf732('0x4a')]);_0x2c8a2f[_0xf732('0x38')]=_['keys'](_0x989f22[_0xf732('0x38')]);_0x2c8a2f['filters']=_['intersection'](_0x2c8a2f[_0xf732('0x36')],_0x2c8a2f[_0xf732('0x38')]);_0x4541b2[_0xf732('0x39')]=_[_0xf732('0x4b')](_0x2c8a2f[_0xf732('0x36')],qs[_0xf732('0x3a')](_0x989f22[_0xf732('0x38')][_0xf732('0x3a')]));_0x4541b2[_0xf732('0x39')]=_0x4541b2[_0xf732('0x39')][_0xf732('0x4c')]?_0x4541b2[_0xf732('0x39')]:_0x2c8a2f[_0xf732('0x36')];if(_0x989f22[_0xf732('0x38')][_0xf732('0x4d')]){_0x4541b2[_0xf732('0x45')]=[{'all':!![]}];}_0x4541b2=_[_0xf732('0x43')]({},_0x4541b2,_0x989f22[_0xf732('0x4e')]);return db[_0xf732('0x44')][_0xf732('0x4f')](_0x4541b2)['then'](handleEntityNotFound(_0x2b094c,null))[_0xf732('0x2b')](respondWithResult(_0x2b094c,null))[_0xf732('0x47')](handleError(_0x2b094c,null));};exports['create']=function(_0x619458,_0x549085){return db[_0xf732('0x44')][_0xf732('0x50')](_0x619458[_0xf732('0x51')],{})[_0xf732('0x2b')](function(_0x340ea7){var _0x1caba9=_0x619458[_0xf732('0x52')]['get']({'plain':!![]});if(!_0x1caba9)throw new Error(_0xf732('0x53'));if(_0x1caba9[_0xf732('0x54')]===_0xf732('0x52')){var _0x145118=_0x340ea7['get']({'plain':!![]});var _0x37aeb1='Lists';return db['UserProfileSection'][_0xf732('0x4f')]({'where':{'name':_0x37aeb1,'userProfileId':_0x1caba9[_0xf732('0x55')]},'raw':!![]})[_0xf732('0x2b')](function(_0x42256f){if(_0x42256f&&_0x42256f[_0xf732('0x56')]===0x0){return db[_0xf732('0x57')][_0xf732('0x50')]({'name':_0x145118[_0xf732('0x2f')],'resourceId':_0x145118['id'],'type':_0x42256f['name'],'sectionId':_0x42256f['id']},{})['then'](function(){return _0x340ea7;});}else{return _0x340ea7;}})[_0xf732('0x47')](function(_0x599eb3){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x599eb3);throw _0x599eb3;});}return _0x340ea7;})[_0xf732('0x2b')](respondWithResult(_0x549085,0xc9))[_0xf732('0x47')](handleError(_0x549085,null));};exports[_0xf732('0x2a')]=function(_0x5010fb,_0xc6560c){if(_0x5010fb[_0xf732('0x51')]['id']){delete _0x5010fb[_0xf732('0x51')]['id'];}return db[_0xf732('0x44')][_0xf732('0x4f')]({'where':{'id':_0x5010fb[_0xf732('0x49')]['id']}})[_0xf732('0x2b')](handleEntityNotFound(_0xc6560c,null))[_0xf732('0x2b')](saveUpdates(_0x5010fb[_0xf732('0x51')],null))['then'](respondWithResult(_0xc6560c,null))[_0xf732('0x47')](handleError(_0xc6560c,null));};exports[_0xf732('0x2c')]=function(_0x2e0b97,_0x457fcd){return db[_0xf732('0x44')][_0xf732('0x4f')]({'where':{'id':_0x2e0b97[_0xf732('0x49')]['id']}})[_0xf732('0x2b')](handleEntityNotFound(_0x457fcd,null))[_0xf732('0x2b')](removeEntity(_0x457fcd,null))[_0xf732('0x47')](handleError(_0x457fcd,null));};exports[_0xf732('0x58')]=function(_0x16aa2d,_0x123f2e){return db[_0xf732('0x44')][_0xf732('0x58')]()[_0xf732('0x2b')](respondWithResult(_0x123f2e,null))[_0xf732('0x47')](handleError(_0x123f2e,null));};exports['addDisposition']=function(_0x582447,_0x41243d,_0x1db011){if(_0x582447[_0xf732('0x51')]['id']){delete _0x582447['body']['id'];}return db[_0xf732('0x44')][_0xf732('0x4f')]({'where':{'id':_0x582447['params']['id']}})[_0xf732('0x2b')](handleEntityNotFound(_0x41243d,null))['then'](function(_0x3668dc){if(_0x3668dc){_0x582447[_0xf732('0x51')][_0xf732('0x59')]=_0x3668dc['id'];return db[_0xf732('0x5a')][_0xf732('0x50')](_0x582447['body']);}})[_0xf732('0x2b')](respondWithResult(_0x41243d,null))[_0xf732('0x47')](handleError(_0x41243d,null));};exports['getDispositions']=function(_0x4706a6,_0x32d978,_0x38d272){var _0x276aa8={'raw':![],'where':{}};var _0x5654d9={};var _0x2be68c={'count':0x0,'rows':[]};return db[_0xf732('0x44')][_0xf732('0x5b')]({'where':{'id':_0x4706a6[_0xf732('0x49')]['id']}})[_0xf732('0x2b')](handleEntityNotFound(_0x32d978,null))[_0xf732('0x2b')](function(_0x11ab68){if(_0x11ab68){_0x5654d9['model']=_[_0xf732('0x5c')](db[_0xf732('0x5a')][_0xf732('0x4a')]);_0x5654d9[_0xf732('0x38')]=_[_0xf732('0x5c')](_0x4706a6[_0xf732('0x38')]);_0x5654d9[_0xf732('0x37')]=_[_0xf732('0x4b')](_0x5654d9[_0xf732('0x36')],_0x5654d9[_0xf732('0x38')]);_0x276aa8[_0xf732('0x39')]=_[_0xf732('0x4b')](_0x5654d9[_0xf732('0x36')],qs[_0xf732('0x3a')](_0x4706a6[_0xf732('0x38')][_0xf732('0x3a')]));_0x276aa8[_0xf732('0x39')]=_0x276aa8['attributes'][_0xf732('0x4c')]?_0x276aa8['attributes']:_0x5654d9[_0xf732('0x36')];if(!_0x4706a6[_0xf732('0x38')][_0xf732('0x3b')](_0xf732('0x3c'))){_0x276aa8['limit']=qs[_0xf732('0x24')](_0x4706a6[_0xf732('0x38')]['limit']);_0x276aa8['offset']=qs[_0xf732('0x22')](_0x4706a6[_0xf732('0x38')][_0xf732('0x22')]);}_0x276aa8[_0xf732('0x3d')]=qs['sort'](_0x4706a6[_0xf732('0x38')][_0xf732('0x3e')]);_0x276aa8[_0xf732('0x40')]=qs['filters'](_['pick'](_0x4706a6[_0xf732('0x38')],_0x5654d9[_0xf732('0x37')]));_0x276aa8[_0xf732('0x40')]['ListId']=_0x11ab68['id'];if(_0x4706a6[_0xf732('0x38')][_0xf732('0x42')]){_0x276aa8[_0xf732('0x40')]=_[_0xf732('0x43')](_0x276aa8[_0xf732('0x40')],{'$or':_[_0xf732('0x32')](_0x276aa8[_0xf732('0x39')],function(_0x531a53){var _0x320005={};_0x320005[_0x531a53]={'$like':'%'+_0x4706a6[_0xf732('0x38')][_0xf732('0x42')]+'%'};return _0x320005;})});}_0x276aa8=_['merge']({},_0x276aa8,_0x4706a6[_0xf732('0x4e')]);return db[_0xf732('0x5a')][_0xf732('0x25')]({'where':_0x276aa8[_0xf732('0x40')]})['then'](function(_0x479f2e){_0x2be68c[_0xf732('0x25')]=_0x479f2e;if(_0x4706a6[_0xf732('0x38')]['includeAll']){_0x276aa8['include']=[{'all':!![]}];}return db[_0xf732('0x5a')][_0xf732('0x5d')](_0x276aa8);})[_0xf732('0x2b')](function(_0x557977){_0x2be68c[_0xf732('0x46')]=_0x557977;return _0x2be68c;});}})['then'](respondWithFilteredResult(_0x32d978,_0x276aa8))[_0xf732('0x47')](handleError(_0x32d978,null));};exports[_0xf732('0x5e')]=function(_0x5984cd,_0x1418e6,_0x23c18b){return db['CmList'][_0xf732('0x4f')]({'where':{'id':_0x5984cd['params']['id']}})[_0xf732('0x2b')](handleEntityNotFound(_0x1418e6,null))[_0xf732('0x2b')](function(_0x110b0e){if(_0x110b0e){return _0x110b0e['removeDispositions'](_0x5984cd['query']['ids']);}})[_0xf732('0x2b')](respondWithStatusCode(_0x1418e6,null))['catch'](handleError(_0x1418e6,null));};exports[_0xf732('0x5f')]=function(_0xa8f925,_0x103d82,_0x2b64b2){return db[_0xf732('0x44')]['find']({'where':{'id':_0xa8f925[_0xf732('0x49')]['id']}})[_0xf732('0x2b')](handleEntityNotFound(_0x103d82,null))[_0xf732('0x2b')](function(_0x2b46a9){if(_0x2b46a9){var _0x564934=[];var _0x297c7c={'success':[],'errors':[]};return db[_0xf732('0x60')][_0xf732('0x58')]()[_0xf732('0x2b')](function(_0x3d935f){if(_0xa8f925['body'][_0xf732('0x61')]&&_[_0xf732('0x62')](_0xa8f925[_0xf732('0x51')][_0xf732('0x61')])){if(_0xa8f925[_0xf732('0x51')][_0xf732('0x61')][_0xf732('0x4c')]){_0xa8f925['body']['tags']=_0xa8f925[_0xf732('0x51')][_0xf732('0x61')][_0xf732('0x63')](';')+';';}else{_0xa8f925[_0xf732('0x51')][_0xf732('0x61')]=null;}}else{_0xa8f925[_0xf732('0x51')][_0xf732('0x61')]=null;}if(_0xa8f925[_0xf732('0x51')]&&_[_0xf732('0x62')](_0xa8f925[_0xf732('0x51')])){for(var _0x2e6250=0x0;_0x2e6250<_0xa8f925[_0xf732('0x51')][_0xf732('0x4c')];_0x2e6250+=0x1){_0xa8f925[_0xf732('0x51')][_0x2e6250][_0xf732('0x59')]=_0xa8f925[_0xf732('0x49')]['id'];_0x564934['push'](_0xa8f925['body'][_0x2e6250]);}return BPromise[_0xf732('0x64')](_0x564934,function(_0x1c04a2){return db[_0xf732('0x60')]['create'](_['omit'](_0x1c04a2,[_0xf732('0x65'),'id'])||{},{'fields':_['keys'](_0x3d935f),'raw':!![]})[_0xf732('0x2b')](function(_0x1991aa){_0x297c7c[_0xf732('0x66')][_0xf732('0x67')](_0x1991aa[_0xf732('0x68')]);})[_0xf732('0x47')](function(_0x6862c){_0x297c7c['errors'][_0xf732('0x67')]({'data':_0x1c04a2,'error':_0x6862c[_0xf732('0x69')]});});})['then'](function(_0x379026){return _0x297c7c;})[_0xf732('0x47')](function(_0x27b33c){return _0x27b33c;});}else{_0x103d82[_0xf732('0x1f')](0x190)[_0xf732('0x21')]({'message':'Malformed\x20request\x20syntax'});}});}})[_0xf732('0x2b')](respondWithResult(_0x103d82,null))['catch'](handleError(_0x103d82,null));};exports[_0xf732('0x6a')]=function(_0x55d8b9,_0x34d722,_0x574ad7){var _0x1ae97b;return db['CmList'][_0xf732('0x4f')]({'where':{'id':_0x55d8b9['params']['id']},'include':[{'model':db[_0xf732('0x6b')],'as':_0xf732('0x6c')}]})[_0xf732('0x2b')](handleEntityNotFound(_0x34d722,null))['then'](function(_0x5834a8){if(_0x5834a8){_0x1ae97b=_0x5834a8;return db[_0xf732('0x60')]['rawAttributes'];}})[_0xf732('0x2b')](function(_0x1658a2){if(_0x1658a2){var _0x7f5b9={};var _0x5a992f={};_0x5a992f[_0xf732('0x36')]=_['concat'](_[_0xf732('0x5c')](_0x1658a2),_[_0xf732('0x32')](_0x1ae97b[_0xf732('0x6c')],function(_0x33e16a){return util[_0xf732('0x6d')](_0xf732('0x6e'),_0x33e16a['id']);}));_0x5a992f[_0xf732('0x38')]=_['keys'](_0x55d8b9[_0xf732('0x38')]);_0x5a992f[_0xf732('0x37')]=_[_0xf732('0x4b')](_0x5a992f['model'],_0x5a992f[_0xf732('0x38')]);_0x7f5b9[_0xf732('0x39')]=_[_0xf732('0x4b')](_0x5a992f[_0xf732('0x36')],qs['fields'](_0x55d8b9[_0xf732('0x38')]['fields']));_0x7f5b9[_0xf732('0x39')]=_0x7f5b9[_0xf732('0x39')][_0xf732('0x4c')]?_0x7f5b9[_0xf732('0x39')]:_0x5a992f[_0xf732('0x36')];if(!_0x55d8b9['query'][_0xf732('0x3b')]('nolimit')){_0x7f5b9[_0xf732('0x24')]=qs[_0xf732('0x24')](_0x55d8b9[_0xf732('0x38')][_0xf732('0x24')]);_0x7f5b9[_0xf732('0x22')]=qs['offset'](_0x55d8b9[_0xf732('0x38')]['offset']);}_0x7f5b9[_0xf732('0x3d')]=qs[_0xf732('0x3e')](_0x55d8b9[_0xf732('0x38')]['sort']);_0x7f5b9[_0xf732('0x40')]=qs[_0xf732('0x37')](_[_0xf732('0x3f')](_0x55d8b9['query'],_0x5a992f[_0xf732('0x37')]));_0x7f5b9[_0xf732('0x6f')]=!![];if(_0x55d8b9[_0xf732('0x38')][_0xf732('0x42')]){_0x7f5b9['where']=_['merge'](_0x7f5b9[_0xf732('0x40')],{'$or':_[_0xf732('0x32')](_0x7f5b9[_0xf732('0x39')],function(_0x5288f6){var _0x5b7250={};_0x5b7250[_0x5288f6]={'$like':'%'+_0x55d8b9[_0xf732('0x38')][_0xf732('0x42')]+'%'};return _0x5b7250;})});}_0x7f5b9=_[_0xf732('0x43')]({},_0x7f5b9,_0x55d8b9['options']);return _0x1ae97b[_0xf732('0x6a')](_0x7f5b9);}})[_0xf732('0x2b')](respondWithResult(_0x34d722,null))[_0xf732('0x47')](handleError(_0x34d722,null));};exports[_0xf732('0x70')]=function(_0x338a5c,_0x15586b,_0x2ecf78){var _0x44fac5;var _0x156323;var _0x515e6d;var _0x17aaf1=_0x338a5c['params']['id'];csv_results=[];return db[_0xf732('0x71')][_0xf732('0x5d')]({'attributes':['id','name'],'raw':!![],'order':['OrderBy']})['then'](function(_0x203ea8){_0x44fac5=_0x203ea8;var _0x5a53be=_[_0xf732('0x5c')](db[_0xf732('0x60')][_0xf732('0x4a')]);return db['CmCustomField'][_0xf732('0x5d')]({'raw':!![],'attributes':['id',_0xf732('0x72')]})[_0xf732('0x2b')](function(_0x1f3f1e){_0x156323=_0x1f3f1e;var _0xd0138b=squel[_0xf732('0x73')]()['fields'](_0x5a53be)[_0xf732('0x74')](_0xf732('0x75'),'c')['where']('c.ListId\x20=\x20?',_0x17aaf1)[_0xf732('0x40')](_0xf732('0x76'))['distinct']();for(var _0x2645fe=0x0;_0x2645fe<_0x156323[_0xf732('0x4c')];_0x2645fe++){_0xd0138b[_0xf732('0x77')](_0xf732('0x78')+_0x156323[_0x2645fe]['id'],_0xf732('0x79')+_0x156323[_0x2645fe][_0xf732('0x72')]);}for(var _0x2645fe=0x0;_0x2645fe<_0x44fac5[_0xf732('0x4c')];_0x2645fe++){_0xd0138b[_0xf732('0x77')](squel[_0xf732('0x73')]()[_0xf732('0x77')]('item')[_0xf732('0x74')](_0xf732('0x7a'))[_0xf732('0x40')](_0xf732('0x7b'),_0x44fac5[_0x2645fe]['id'])[_0xf732('0x40')](_0xf732('0x7c')),'additionalPhone_'+_0x44fac5[_0x2645fe]['name']);_0xd0138b[_0xf732('0x77')](squel['select']()[_0xf732('0x77')](_0xf732('0x7d'))[_0xf732('0x74')](_0xf732('0x7a'))[_0xf732('0x40')](_0xf732('0x7b'),_0x44fac5[_0x2645fe]['id'])[_0xf732('0x40')](_0xf732('0x7c')),'description_additionalPhone_'+_0x44fac5[_0x2645fe][_0xf732('0x2f')]);}var _0x30795c=[];_0x30795c[_0xf732('0x67')](_0xd0138b[_0xf732('0x7e')]());BPromise[_0xf732('0x64')](_0x30795c,handleQuery)[_0xf732('0x2b')](function(_0x1cd3da){handleQuery(_0xd0138b[_0xf732('0x7e')]());var _0x1c28b1=csv_results[0x0];if(!_[_0xf732('0x7f')](_0x1c28b1)){var _0x42e5e0=toCsv(_0x1c28b1);var _0x4a1176=Date['now']();fs[_0xf732('0x80')](util['format'](_0xf732('0x81'),_0x17aaf1,_0x4a1176),_0x42e5e0);_0x15586b[_0xf732('0x82')](_0xf732('0x83'),'attachment;\x20filename='+util[_0xf732('0x6d')]('list_%d_%s.csv',_0x17aaf1,_0x4a1176));_0x15586b[_0xf732('0x82')]('Content-type',_0xf732('0x84'));return _0x15586b['download'](util[_0xf732('0x6d')](_0xf732('0x81'),_0x17aaf1,_0x4a1176));}else{return _0x15586b[_0xf732('0x1e')](0xcc);}});});});};exports[_0xf732('0x85')]=function(_0x4d274f,_0x33eab0,_0x29f5a4){var _0x230ddc;delete _0x4d274f[_0xf732('0x51')]['id'];return db[_0xf732('0x44')][_0xf732('0x5b')]({'where':{'id':_0x4d274f[_0xf732('0x49')]['id']}})[_0xf732('0x2b')](handleEntityNotFound(_0x33eab0,null))[_0xf732('0x2b')](function(_0x1500bd){if(_0x1500bd){return db['sequelize'][_0xf732('0x86')](function(_0x1b01ff){return db[_0xf732('0x6b')][_0xf732('0x50')](_0x4d274f[_0xf732('0x51')],{'transaction':_0x1b01ff})[_0xf732('0x2b')](function(_0x395fbb){_0x230ddc=_0x395fbb;return _0x1500bd[_0xf732('0x87')](_0x395fbb,{'transaction':_0x1b01ff});})['then'](function(){var _0xda48ec={'type':db[_0xf732('0x88')][_0xf732('0x89')],'transaction':_0x1b01ff};switch(_0x4d274f[_0xf732('0x51')][_0xf732('0x34')]){case _0xf732('0x8a'):_0xda48ec['type']=db[_0xf732('0x88')][_0xf732('0x89')];break;case _0xf732('0x8b'):_0xda48ec[_0xf732('0x34')]=db[_0xf732('0x88')][_0xf732('0x8c')];break;case _0xf732('0x8d'):_0xda48ec[_0xf732('0x34')]=db[_0xf732('0x88')][_0xf732('0x8e')];_0xda48ec[_0xf732('0x8f')]=![];break;default:}return db[_0xf732('0x90')][_0xf732('0x91')]['addColumn'](_0xf732('0x75'),util[_0xf732('0x6d')]('cf_%s',_0x230ddc['id']),_0xda48ec);})[_0xf732('0x2b')](function(){return _0x230ddc;});});}})[_0xf732('0x2b')](respondWithResult(_0x33eab0,null))['catch'](handleError(_0x33eab0,null));};exports[_0xf732('0x92')]=function(_0x2a5ec8,_0x5a99e3,_0x1479c3){var _0x24bc85={};var _0x50e9dd={};var _0x5a035f;var _0x285a75;return db['CmList'][_0xf732('0x5b')]({'where':{'id':_0x2a5ec8['params']['id']}})[_0xf732('0x2b')](handleEntityNotFound(_0x5a99e3,null))[_0xf732('0x2b')](function(_0x3c5b4e){if(_0x3c5b4e){_0x5a035f=_0x3c5b4e;_0x50e9dd[_0xf732('0x36')]=_['keys'](db[_0xf732('0x6b')][_0xf732('0x4a')]);_0x50e9dd['query']=_[_0xf732('0x5c')](_0x2a5ec8[_0xf732('0x38')]);_0x50e9dd[_0xf732('0x37')]=_['intersection'](_0x50e9dd['model'],_0x50e9dd[_0xf732('0x38')]);_0x24bc85[_0xf732('0x39')]=_[_0xf732('0x4b')](_0x50e9dd['model'],qs['fields'](_0x2a5ec8['query'][_0xf732('0x3a')]));_0x24bc85[_0xf732('0x39')]=_0x24bc85[_0xf732('0x39')][_0xf732('0x4c')]?_0x24bc85[_0xf732('0x39')]:_0x50e9dd[_0xf732('0x36')];_0x24bc85[_0xf732('0x3d')]=qs[_0xf732('0x3e')](_0x2a5ec8['query'][_0xf732('0x3e')]);_0x24bc85[_0xf732('0x40')]=qs[_0xf732('0x37')](_['pick'](_0x2a5ec8[_0xf732('0x38')],_0x50e9dd[_0xf732('0x37')]));_0x24bc85['where']=_[_0xf732('0x43')](_0x24bc85[_0xf732('0x40')],{'$or':[{'ListId':_0x3c5b4e['id']},{'ListId':null}]});if(_0x2a5ec8['query'][_0xf732('0x42')]){_0x24bc85['where']=_['merge'](_0x24bc85[_0xf732('0x40')],{'$or':_['map'](_0x24bc85[_0xf732('0x39')],function(_0x32714a){var _0x39ca92={};_0x39ca92[_0x32714a]={'$like':'%'+_0x2a5ec8[_0xf732('0x38')][_0xf732('0x42')]+'%'};return _0x39ca92;})});}_0x24bc85=_['merge']({},_0x24bc85,_0x2a5ec8[_0xf732('0x4e')]);return db[_0xf732('0x6b')][_0xf732('0x93')](_0x24bc85);}})[_0xf732('0x2b')](respondWithResult(_0x5a99e3,null))[_0xf732('0x47')](handleError(_0x5a99e3,null));};exports[_0xf732('0x94')]=function(_0x1637bc,_0x37d89a){return db['CmCustomField'][_0xf732('0x93')]({'where':{'ListId':null}})[_0xf732('0x2b')](handleEntityNotFound(_0x37d89a,null))[_0xf732('0x2b')](function(_0x461837){return _0x461837;})[_0xf732('0x2b')](respondWithResult(_0x37d89a,null))[_0xf732('0x47')](handleError(_0x37d89a,null));};exports[_0xf732('0x95')]=function(_0x954924,_0x187ab8,_0x2dc4ad){return db[_0xf732('0x44')][_0xf732('0x4f')]({'where':{'id':_0x954924[_0xf732('0x49')]['id']}})['then'](handleEntityNotFound(_0x187ab8,null))['then'](function(_0xa63b20){if(_0xa63b20){return _0xa63b20[_0xf732('0x95')](_0x954924[_0xf732('0x51')][_0xf732('0x65')],_[_0xf732('0x96')](_0x954924['body'],[_0xf732('0x65'),'id'])||{})[_0xf732('0x97')](function(_0x38d854){for(var _0x3e613d=0x0;_0x3e613d<_0x954924[_0xf732('0x51')][_0xf732('0x65')][_0xf732('0x4c')];_0x3e613d+=0x1){socket[_0xf732('0x98')](_0xf732('0x99'),{'UserId':Number(_0x954924[_0xf732('0x51')][_0xf732('0x65')][_0x3e613d]),'CmListId':Number(_0x954924['params']['id'])});}return _0x38d854;});}})[_0xf732('0x2b')](respondWithResult(_0x187ab8,null))[_0xf732('0x47')](handleError(_0x187ab8,null));};exports[_0xf732('0x9a')]=function(_0x3bef40,_0x507c50,_0x474a99){return db[_0xf732('0x44')][_0xf732('0x4f')]({'where':{'id':_0x3bef40[_0xf732('0x49')]['id']}})[_0xf732('0x2b')](handleEntityNotFound(_0x507c50,null))['then'](function(_0x47ba51){if(_0x47ba51){return _0x47ba51[_0xf732('0x9a')](_0x3bef40[_0xf732('0x38')][_0xf732('0x65')])[_0xf732('0x2b')](function(){if(_[_0xf732('0x62')](_0x3bef40[_0xf732('0x38')]['ids'])){for(var _0x51de38=0x0;_0x51de38<_0x3bef40[_0xf732('0x38')][_0xf732('0x65')][_0xf732('0x4c')];_0x51de38+=0x1){socket[_0xf732('0x98')](_0xf732('0x9b'),{'UserId':Number(_0x3bef40[_0xf732('0x38')]['ids'][_0x51de38]),'CmListId':Number(_0x3bef40[_0xf732('0x49')]['id'])});}}else{socket[_0xf732('0x98')]('userCmList:remove',{'UserId':Number(_0x3bef40[_0xf732('0x38')][_0xf732('0x65')]),'CmListId':Number(_0x3bef40[_0xf732('0x49')]['id'])});}});}})[_0xf732('0x2b')](respondWithStatusCode(_0x507c50,null))[_0xf732('0x47')](handleError(_0x507c50,null));};exports[_0xf732('0x9c')]=function(_0xf1d393,_0xcc2431,_0x3e794c){var _0x44b89c={};var _0x9a1477={};var _0x3e6390;var _0x30411b;return db[_0xf732('0x44')][_0xf732('0x5b')]({'where':{'id':_0xf1d393[_0xf732('0x49')]['id']}})[_0xf732('0x2b')](handleEntityNotFound(_0xcc2431,null))[_0xf732('0x2b')](function(_0x27ef14){if(_0x27ef14){_0x3e6390=_0x27ef14;_0x9a1477[_0xf732('0x36')]=_[_0xf732('0x5c')](db[_0xf732('0x9d')][_0xf732('0x4a')]);_0x9a1477[_0xf732('0x38')]=_[_0xf732('0x5c')](_0xf1d393['query']);_0x9a1477[_0xf732('0x37')]=_['intersection'](_0x9a1477['model'],_0x9a1477[_0xf732('0x38')]);_0x44b89c['attributes']=_['intersection'](_0x9a1477[_0xf732('0x36')],qs[_0xf732('0x3a')](_0xf1d393[_0xf732('0x38')][_0xf732('0x3a')]));_0x44b89c[_0xf732('0x39')]=_0x44b89c[_0xf732('0x39')][_0xf732('0x4c')]?_0x44b89c[_0xf732('0x39')]:_0x9a1477[_0xf732('0x36')];_0x44b89c['order']=qs[_0xf732('0x3e')](_0xf1d393[_0xf732('0x38')][_0xf732('0x3e')]);_0x44b89c[_0xf732('0x40')]=qs[_0xf732('0x37')](_['pick'](_0xf1d393[_0xf732('0x38')],_0x9a1477['filters']));if(_0xf1d393['query'][_0xf732('0x42')]){_0x44b89c[_0xf732('0x40')]=_[_0xf732('0x43')](_0x44b89c[_0xf732('0x40')],{'$or':_[_0xf732('0x32')](_0x44b89c[_0xf732('0x39')],function(_0x12f1d7){var _0x92f014={};_0x92f014[_0x12f1d7]={'$like':'%'+_0xf1d393[_0xf732('0x38')]['filter']+'%'};return _0x92f014;})});}_0x44b89c=_[_0xf732('0x43')]({},_0x44b89c,_0xf1d393[_0xf732('0x4e')]);return _0x3e6390[_0xf732('0x9c')](_0x44b89c);}})['then'](function(_0x2be636){if(_0x2be636){_0x30411b=_0x2be636[_0xf732('0x4c')];if(!_0xf1d393['query'][_0xf732('0x3b')](_0xf732('0x3c'))){_0x44b89c['limit']=qs['limit'](_0xf1d393[_0xf732('0x38')][_0xf732('0x24')]);_0x44b89c[_0xf732('0x22')]=qs[_0xf732('0x22')](_0xf1d393[_0xf732('0x38')][_0xf732('0x22')]);}return _0x3e6390[_0xf732('0x9c')](_0x44b89c);}})['then'](function(_0x42dec1){if(_0x42dec1){return _0x42dec1?{'count':_0x30411b,'rows':_0x42dec1}:null;}})[_0xf732('0x2b')](respondWithResult(_0xcc2431,null))[_0xf732('0x47')](handleError(_0xcc2431,null));};function handleQuery(_0x383aef){logger[_0xf732('0x9e')](_0x383aef);return db[_0xf732('0x90')]['query'](_0x383aef)[_0xf732('0x97')](function(_0x1ea6e2){csv_results[_0xf732('0x67')](_0x1ea6e2);})[_0xf732('0x47')](function(_0x5225f5){logger[_0xf732('0x9f')](_0x5225f5[_0xf732('0x69')]);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index fec6919..1b7e143 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 _0x5fc3=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hook'];(function(_0x4b26b5,_0x4f71fd){var _0x4dec71=function(_0x184329){while(--_0x184329){_0x4b26b5['push'](_0x4b26b5['shift']());}};_0x4dec71(++_0x4f71fd);}(_0x5fc3,0xa8));var _0x35fc=function(_0x56740a,_0x568894){_0x56740a=_0x56740a-0x0;var _0x257144=_0x5fc3[_0x56740a];return _0x257144;};'use strict';var EventEmitter=require(_0x35fc('0x0'));var CmList=require(_0x35fc('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents[_0x35fc('0x2')](0x0);var events={'afterCreate':_0x35fc('0x3'),'afterUpdate':_0x35fc('0x4'),'afterDestroy':_0x35fc('0x5')};function emitEvent(_0xb4f9ce){return function(_0x5e75e6,_0x2d1404,_0x1d5fec){CmListEvents[_0x35fc('0x6')](_0xb4f9ce+':'+_0x5e75e6['id'],_0x5e75e6);CmListEvents['emit'](_0xb4f9ce,_0x5e75e6);_0x1d5fec(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0x35fc('0x7')](e,emitEvent(event));}}module['exports']=CmListEvents; \ No newline at end of file +var _0x7217=['emit','hasOwnProperty','hook','exports','events','CmList','setMaxListeners','save','update','remove'];(function(_0x17e69b,_0x512806){var _0x55eea8=function(_0x510384){while(--_0x510384){_0x17e69b['push'](_0x17e69b['shift']());}};_0x55eea8(++_0x512806);}(_0x7217,0x19e));var _0x7721=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x7217[_0x56482c];return _0x5aae7a;};'use strict';var EventEmitter=require(_0x7721('0x0'));var CmList=require('../../mysqldb')['db'][_0x7721('0x1')];var CmListEvents=new EventEmitter();CmListEvents[_0x7721('0x2')](0x0);var events={'afterCreate':_0x7721('0x3'),'afterUpdate':_0x7721('0x4'),'afterDestroy':_0x7721('0x5')};function emitEvent(_0x4d6446){return function(_0x5bf160,_0x472a96,_0xce17f9){CmListEvents[_0x7721('0x6')](_0x4d6446+':'+_0x5bf160['id'],_0x5bf160);CmListEvents[_0x7721('0x6')](_0x4d6446,_0x5bf160);_0xce17f9(null);};}for(var e in events){if(events[_0x7721('0x7')](e)){var event=events[e];CmList[_0x7721('0x8')](e,emitEvent(event));}}module[_0x7721('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 189384e..8e96c0d 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 _0xb903=['rimraf','../../config/environment','./cmList.attributes','exports','cm_lists','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x11e05d,_0x3a4491){var _0x335588=function(_0x35ec3f){while(--_0x35ec3f){_0x11e05d['push'](_0x11e05d['shift']());}};_0x335588(++_0x3a4491);}(_0xb903,0x185));var _0x3b90=function(_0x5a51c6,_0x5159b3){_0x5a51c6=_0x5a51c6-0x0;var _0x216136=_0xb903[_0x5a51c6];return _0x216136;};'use strict';var _=require(_0x3b90('0x0'));var util=require(_0x3b90('0x1'));var logger=require(_0x3b90('0x2'))(_0x3b90('0x3'));var moment=require('moment');var BPromise=require(_0x3b90('0x4'));var rp=require(_0x3b90('0x5'));var fs=require('fs');var path=require(_0x3b90('0x6'));var rimraf=require(_0x3b90('0x7'));var config=require(_0x3b90('0x8'));var attributes=require(_0x3b90('0x9'));module[_0x3b90('0xa')]=function(_0x5acd76,_0x15b68f){return _0x5acd76['define']('CmList',attributes,{'tableName':_0x3b90('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x41bb=['bluebird','request-promise','path','rimraf','./cmList.attributes','exports','cm_lists','lodash','util','api'];(function(_0x4d4ea9,_0x4788ae){var _0x3d6f3a=function(_0x14ecb8){while(--_0x14ecb8){_0x4d4ea9['push'](_0x4d4ea9['shift']());}};_0x3d6f3a(++_0x4788ae);}(_0x41bb,0xc5));var _0xb41b=function(_0xadc969,_0x8917ba){_0xadc969=_0xadc969-0x0;var _0x321546=_0x41bb[_0xadc969];return _0x321546;};'use strict';var _=require(_0xb41b('0x0'));var util=require(_0xb41b('0x1'));var logger=require('../../config/logger')(_0xb41b('0x2'));var moment=require('moment');var BPromise=require(_0xb41b('0x3'));var rp=require(_0xb41b('0x4'));var fs=require('fs');var path=require(_0xb41b('0x5'));var rimraf=require(_0xb41b('0x6'));var config=require('../../config/environment');var attributes=require(_0xb41b('0x7'));module[_0xb41b('0x8')]=function(_0x2dbaa3,_0x50bc62){return _0x2dbaa3['define']('CmList',attributes,{'tableName':_0xb41b('0x9'),'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 76bbac1..8bf2ab9 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 _0x6382=['moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./cmList.socket','register','request','info','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CmList,\x20%s,\x20%s','catch','lodash','util'];(function(_0x3ddda7,_0x39eaf3){var _0x38f5b4=function(_0x49be31){while(--_0x49be31){_0x3ddda7['push'](_0x3ddda7['shift']());}};_0x38f5b4(++_0x39eaf3);}(_0x6382,0xc9));var _0x2638=function(_0x2ad13a,_0x25723a){_0x2ad13a=_0x2ad13a-0x0;var _0x579db9=_0x6382[_0x2ad13a];return _0x579db9;};'use strict';var _=require(_0x2638('0x0'));var util=require(_0x2638('0x1'));var moment=require(_0x2638('0x2'));var BPromise=require(_0x2638('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2638('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2638('0x5'));var logger=require(_0x2638('0x6'))(_0x2638('0x7'));var config=require(_0x2638('0x8'));var jayson=require(_0x2638('0x9'));var client=jayson[_0x2638('0xa')][_0x2638('0xb')]({'port':0x232a});config['redis']=_[_0x2638('0xc')](config[_0x2638('0xd')],{'host':_0x2638('0xe'),'port':0x18eb});var socket=require(_0x2638('0xf'))(new Redis(config[_0x2638('0xd')]));require(_0x2638('0x10'))[_0x2638('0x11')](socket);function respondWithRpcPromise(_0x394b95,_0x1726d3,_0x5e6b4a){return new BPromise(function(_0x31f5f5,_0x62c937){return client[_0x2638('0x12')](_0x394b95,_0x5e6b4a)['then'](function(_0x3d6069){logger[_0x2638('0x13')]('CmList,\x20%s,\x20%s',_0x1726d3,_0x2638('0x14'));logger[_0x2638('0x15')](_0x2638('0x16'),_0x1726d3,'request\x20sent',JSON[_0x2638('0x17')](_0x3d6069));if(_0x3d6069['error']){if(_0x3d6069[_0x2638('0x18')][_0x2638('0x19')]===0x1f4){logger['error']('CmList,\x20%s,\x20%s',_0x1726d3,_0x3d6069[_0x2638('0x18')][_0x2638('0x1a')]);return _0x62c937(_0x3d6069[_0x2638('0x18')]['message']);}logger[_0x2638('0x18')](_0x2638('0x1b'),_0x1726d3,_0x3d6069[_0x2638('0x18')][_0x2638('0x1a')]);return _0x31f5f5(_0x3d6069[_0x2638('0x18')][_0x2638('0x1a')]);}else{logger['info']('CmList,\x20%s,\x20%s',_0x1726d3,_0x2638('0x14'));_0x31f5f5(_0x3d6069['result'][_0x2638('0x1a')]);}})[_0x2638('0x1c')](function(_0x256189){logger[_0x2638('0x18')](_0x2638('0x1b'),_0x1726d3,_0x256189);_0x62c937(_0x256189);});});} \ No newline at end of file +var _0x878c=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','request','then','info','CmList,\x20%s,\x20%s','debug','CmList,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x878c,0x172));var _0xc878=function(_0xd9d48b,_0x5389be){_0xd9d48b=_0xd9d48b-0x0;var _0x44973c=_0x878c[_0xd9d48b];return _0x44973c;};'use strict';var _=require(_0xc878('0x0'));var util=require(_0xc878('0x1'));var moment=require(_0xc878('0x2'));var BPromise=require('bluebird');var rs=require(_0xc878('0x3'));var fs=require('fs');var Redis=require(_0xc878('0x4'));var db=require(_0xc878('0x5'))['db'];var utils=require(_0xc878('0x6'));var logger=require(_0xc878('0x7'))(_0xc878('0x8'));var config=require(_0xc878('0x9'));var jayson=require(_0xc878('0xa'));var client=jayson[_0xc878('0xb')]['http']({'port':0x232a});config[_0xc878('0xc')]=_[_0xc878('0xd')](config[_0xc878('0xc')],{'host':_0xc878('0xe'),'port':0x18eb});var socket=require(_0xc878('0xf'))(new Redis(config[_0xc878('0xc')]));require(_0xc878('0x10'))[_0xc878('0x11')](socket);function respondWithRpcPromise(_0x568a6d,_0x378d25,_0x3d1924){return new BPromise(function(_0x27172c,_0x972936){return client[_0xc878('0x12')](_0x568a6d,_0x3d1924)[_0xc878('0x13')](function(_0x19a5e0){logger[_0xc878('0x14')](_0xc878('0x15'),_0x378d25,'request\x20sent');logger[_0xc878('0x16')](_0xc878('0x17'),_0x378d25,_0xc878('0x18'),JSON[_0xc878('0x19')](_0x19a5e0));if(_0x19a5e0[_0xc878('0x1a')]){if(_0x19a5e0[_0xc878('0x1a')][_0xc878('0x1b')]===0x1f4){logger[_0xc878('0x1a')](_0xc878('0x15'),_0x378d25,_0x19a5e0[_0xc878('0x1a')][_0xc878('0x1c')]);return _0x972936(_0x19a5e0[_0xc878('0x1a')]['message']);}logger[_0xc878('0x1a')](_0xc878('0x15'),_0x378d25,_0x19a5e0[_0xc878('0x1a')]['message']);return _0x27172c(_0x19a5e0[_0xc878('0x1a')]['message']);}else{logger[_0xc878('0x14')](_0xc878('0x15'),_0x378d25,_0xc878('0x18'));_0x27172c(_0x19a5e0[_0xc878('0x1d')][_0xc878('0x1c')]);}})[_0xc878('0x1e')](function(_0x3b0fb7){logger[_0xc878('0x1a')]('CmList,\x20%s,\x20%s',_0x378d25,_0x3b0fb7);_0x972936(_0x3b0fb7);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index a995dbe..912910e 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 _0xbd1f=['cmList:','./cmList.events','save','remove','update','emit','removeListener','register','length'];(function(_0x54b481,_0x34633c){var _0x165987=function(_0x2a4e77){while(--_0x2a4e77){_0x54b481['push'](_0x54b481['shift']());}};_0x165987(++_0x34633c);}(_0xbd1f,0x145));var _0xfbd1=function(_0x15a099,_0x4eb0c1){_0x15a099=_0x15a099-0x0;var _0x8f248c=_0xbd1f[_0x15a099];return _0x8f248c;};'use strict';var CmListEvents=require(_0xfbd1('0x0'));var events=[_0xfbd1('0x1'),_0xfbd1('0x2'),_0xfbd1('0x3')];function createListener(_0x24ccd5,_0x401ac5){return function(_0x52077d){_0x401ac5[_0xfbd1('0x4')](_0x24ccd5,_0x52077d);};}function removeListener(_0x1a11f9,_0x2ee304){return function(){CmListEvents[_0xfbd1('0x5')](_0x1a11f9,_0x2ee304);};}exports[_0xfbd1('0x6')]=function(_0x33ce33){for(var _0x492785=0x0,_0x25cc49=events[_0xfbd1('0x7')];_0x492785<_0x25cc49;_0x492785++){var _0x2b6396=events[_0x492785];var _0x1274bd=createListener(_0xfbd1('0x8')+_0x2b6396,_0x33ce33);CmListEvents['on'](_0x2b6396,_0x1274bd);}}; \ No newline at end of file +var _0x421f=['./cmList.events','save','remove','update','removeListener','register','length','cmList:'];(function(_0x17d7da,_0x5a0efa){var _0x3f5fea=function(_0xd552ce){while(--_0xd552ce){_0x17d7da['push'](_0x17d7da['shift']());}};_0x3f5fea(++_0x5a0efa);}(_0x421f,0x160));var _0xf421=function(_0x3c27df,_0xc6d32b){_0x3c27df=_0x3c27df-0x0;var _0x56f1f0=_0x421f[_0x3c27df];return _0x56f1f0;};'use strict';var CmListEvents=require(_0xf421('0x0'));var events=[_0xf421('0x1'),_0xf421('0x2'),_0xf421('0x3')];function createListener(_0x1060ab,_0xddf443){return function(_0x4f5951){_0xddf443['emit'](_0x1060ab,_0x4f5951);};}function removeListener(_0x507168,_0xe92454){return function(){CmListEvents[_0xf421('0x4')](_0x507168,_0xe92454);};}exports[_0xf421('0x5')]=function(_0x1daaa4){for(var _0x49c082=0x0,_0x3a2a31=events[_0xf421('0x6')];_0x49c082<_0x3a2a31;_0x49c082++){var _0x2f0299=events[_0x49c082];var _0x1521fa=createListener(_0xf421('0x7')+_0x2f0299,_0x1daaa4);CmListEvents['on'](_0x2f0299,_0x1521fa);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index c02b29c..30fa5c5 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 _0x5a01=['isAuthenticated','getGlobalCustomFields','show','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','/:id/fields','getCustomFields','/:id/users','getAgents','post','create','addDisposition','addCustomField','addAgents','put','/:id','update','destroy','delete','removeDispositions','removeAgents','multer','util','path','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmList.controller','index','get','/describe','describe','/global_fields'];(function(_0x33d71b,_0x56da1){var _0x1ad6e4=function(_0x58f338){while(--_0x58f338){_0x33d71b['push'](_0x33d71b['shift']());}};_0x1ad6e4(++_0x56da1);}(_0x5a01,0x1af));var _0x15a0=function(_0x30121e,_0x240c86){_0x30121e=_0x30121e-0x0;var _0x4ba328=_0x5a01[_0x30121e];return _0x4ba328;};'use strict';var multer=require(_0x15a0('0x0'));var util=require(_0x15a0('0x1'));var path=require(_0x15a0('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x15a0('0x3')]();var fs_extra=require(_0x15a0('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x15a0('0x5'));var config=require(_0x15a0('0x6'));var controller=require(_0x15a0('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x15a0('0x8')]);router[_0x15a0('0x9')](_0x15a0('0xa'),auth['isAuthenticated'](),controller[_0x15a0('0xb')]);router[_0x15a0('0x9')](_0x15a0('0xc'),auth[_0x15a0('0xd')](),controller[_0x15a0('0xe')]);router['get']('/:id',auth[_0x15a0('0xd')](),controller[_0x15a0('0xf')]);router[_0x15a0('0x9')](_0x15a0('0x10'),auth[_0x15a0('0xd')](),controller[_0x15a0('0x11')]);router[_0x15a0('0x9')](_0x15a0('0x12'),auth[_0x15a0('0xd')](),controller[_0x15a0('0x13')]);router[_0x15a0('0x9')](_0x15a0('0x14'),auth['isAuthenticated'](),controller['getContactsCsv']);router[_0x15a0('0x9')](_0x15a0('0x15'),auth[_0x15a0('0xd')](),controller[_0x15a0('0x16')]);router[_0x15a0('0x9')](_0x15a0('0x17'),auth[_0x15a0('0xd')](),controller[_0x15a0('0x18')]);router[_0x15a0('0x19')]('/',auth['isAuthenticated'](),controller[_0x15a0('0x1a')]);router['post']('/:id/dispositions',auth[_0x15a0('0xd')](),controller[_0x15a0('0x1b')]);router[_0x15a0('0x19')](_0x15a0('0x12'),auth['isAuthenticated'](),controller['addContacts']);router[_0x15a0('0x19')](_0x15a0('0x15'),auth['isAuthenticated'](),controller[_0x15a0('0x1c')]);router['post'](_0x15a0('0x17'),auth[_0x15a0('0xd')](),controller[_0x15a0('0x1d')]);router[_0x15a0('0x1e')](_0x15a0('0x1f'),auth[_0x15a0('0xd')](),controller[_0x15a0('0x20')]);router['delete']('/:id',auth[_0x15a0('0xd')](),controller[_0x15a0('0x21')]);router[_0x15a0('0x22')](_0x15a0('0x10'),auth[_0x15a0('0xd')](),controller[_0x15a0('0x23')]);router[_0x15a0('0x22')]('/:id/users',auth['isAuthenticated'](),controller[_0x15a0('0x24')]);module['exports']=router; \ No newline at end of file +var _0x9d3e=['removeDispositions','removeAgents','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','/describe','isAuthenticated','describe','/global_fields','getGlobalCustomFields','/:id','show','/:id/dispositions','getDispositions','getContacts','getContactsCsv','/:id/fields','getCustomFields','/:id/users','create','post','addDisposition','addCustomField','addAgents','put','destroy','delete'];(function(_0x83f8c4,_0x450c4b){var _0x1cf945=function(_0xc16423){while(--_0xc16423){_0x83f8c4['push'](_0x83f8c4['shift']());}};_0x1cf945(++_0x450c4b);}(_0x9d3e,0xd5));var _0xe9d3=function(_0x5f1bc8,_0x51cf54){_0x5f1bc8=_0x5f1bc8-0x0;var _0x4390cd=_0x9d3e[_0x5f1bc8];return _0x4390cd;};'use strict';var multer=require(_0xe9d3('0x0'));var util=require('util');var path=require(_0xe9d3('0x1'));var timeout=require('connect-timeout');var express=require(_0xe9d3('0x2'));var router=express[_0xe9d3('0x3')]();var fs_extra=require(_0xe9d3('0x4'));var auth=require(_0xe9d3('0x5'));var interaction=require(_0xe9d3('0x6'));var config=require(_0xe9d3('0x7'));var controller=require(_0xe9d3('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xe9d3('0x9')](_0xe9d3('0xa'),auth[_0xe9d3('0xb')](),controller[_0xe9d3('0xc')]);router[_0xe9d3('0x9')](_0xe9d3('0xd'),auth[_0xe9d3('0xb')](),controller[_0xe9d3('0xe')]);router[_0xe9d3('0x9')](_0xe9d3('0xf'),auth['isAuthenticated'](),controller[_0xe9d3('0x10')]);router['get'](_0xe9d3('0x11'),auth[_0xe9d3('0xb')](),controller[_0xe9d3('0x12')]);router[_0xe9d3('0x9')]('/:id/contacts',auth[_0xe9d3('0xb')](),controller[_0xe9d3('0x13')]);router[_0xe9d3('0x9')]('/:id/contacts/csv',auth[_0xe9d3('0xb')](),controller[_0xe9d3('0x14')]);router[_0xe9d3('0x9')](_0xe9d3('0x15'),auth[_0xe9d3('0xb')](),controller[_0xe9d3('0x16')]);router[_0xe9d3('0x9')](_0xe9d3('0x17'),auth[_0xe9d3('0xb')](),controller['getAgents']);router['post']('/',auth[_0xe9d3('0xb')](),controller[_0xe9d3('0x18')]);router[_0xe9d3('0x19')](_0xe9d3('0x11'),auth['isAuthenticated'](),controller[_0xe9d3('0x1a')]);router[_0xe9d3('0x19')]('/:id/contacts',auth['isAuthenticated'](),controller['addContacts']);router[_0xe9d3('0x19')]('/:id/fields',auth[_0xe9d3('0xb')](),controller[_0xe9d3('0x1b')]);router['post'](_0xe9d3('0x17'),auth['isAuthenticated'](),controller[_0xe9d3('0x1c')]);router[_0xe9d3('0x1d')](_0xe9d3('0xf'),auth[_0xe9d3('0xb')](),controller['update']);router['delete'](_0xe9d3('0xf'),auth['isAuthenticated'](),controller[_0xe9d3('0x1e')]);router[_0xe9d3('0x1f')]('/:id/dispositions',auth[_0xe9d3('0xb')](),controller[_0xe9d3('0x20')]);router[_0xe9d3('0x1f')](_0xe9d3('0x17'),auth[_0xe9d3('0xb')](),controller[_0xe9d3('0x21')]);module[_0xe9d3('0x22')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index db1b2f9..3cbc7a4 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 _0x69b6=['STRING','sequelize','getDataValue','field'];(function(_0x41285b,_0x1c6830){var _0x103ee7=function(_0x4ccea5){while(--_0x4ccea5){_0x41285b['push'](_0x41285b['shift']());}};_0x103ee7(++_0x1c6830);}(_0x69b6,0x99));var _0x669b=function(_0x468db0,_0x207e60){_0x468db0=_0x468db0-0x0;var _0x2246bf=_0x69b6[_0x468db0];return _0x2246bf;};'use strict';var Sequelize=require(_0x669b('0x0'));module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x32ea96){return this[_0x669b('0x1')](_0x669b('0x2'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x669b('0x3')],'allowNull':![]},'value':{'type':Sequelize[_0x669b('0x3')],'allowNull':![]}}; \ No newline at end of file +var _0x1552=['field','STRING','exports'];(function(_0x6ae66b,_0x3ba914){var _0x465cef=function(_0x547b10){while(--_0x547b10){_0x6ae66b['push'](_0x6ae66b['shift']());}};_0x465cef(++_0x3ba914);}(_0x1552,0xad));var _0x2155=function(_0x5a2cca,_0x287e30){_0x5a2cca=_0x5a2cca-0x0;var _0x1619a8=_0x1552[_0x5a2cca];return _0x1619a8;};'use strict';var Sequelize=require('sequelize');module[_0x2155('0x0')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x1cabe4){return this['getDataValue'](_0x2155('0x1'));}},'field':{'type':Sequelize[_0x2155('0x2')],'allowNull':![]},'operator':{'type':Sequelize[_0x2155('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x2155('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 3a86f5c..bfaac2f 100644 --- a/server/api/condition/condition.controller.js +++ b/server/api/condition/condition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x3afabc,_0x3c4cbe){var _0x2ec781=function(_0x2c5cdd){while(--_0x2c5cdd){_0x3afabc['push'](_0x3afabc['shift']());}};_0x2ec781(++_0x3c4cbe);}(_0x7a54,0x106));var _0x47a5=function(_0x4f2ac8,_0x49fe31){_0x4f2ac8=_0x4f2ac8-0x0;var _0x41ca30=_0x7a54[_0x4f2ac8];return _0x41ca30;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file +var _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x58da03,_0x245fd3){var _0x57c10d=function(_0x4b91bf){while(--_0x4b91bf){_0x58da03['push'](_0x58da03['shift']());}};_0x57c10d(++_0x245fd3);}(_0x7a54,0x106));var _0x47a5=function(_0x4d2a7f,_0x569f79){_0x4d2a7f=_0x4d2a7f-0x0;var _0x56c245=_0x7a54[_0x4d2a7f];return _0x56c245;};'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 3983133..82e0d8b 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 _0x41f0=['request-promise','rimraf','../../config/environment','tools_conditions','lodash','util','../../config/logger','moment','bluebird'];(function(_0x467350,_0x36844d){var _0x17bb00=function(_0x2c5a22){while(--_0x2c5a22){_0x467350['push'](_0x467350['shift']());}};_0x17bb00(++_0x36844d);}(_0x41f0,0xaf));var _0x041f=function(_0x5f5aa2,_0x26ccb2){_0x5f5aa2=_0x5f5aa2-0x0;var _0x172cc1=_0x41f0[_0x5f5aa2];return _0x172cc1;};'use strict';var _=require(_0x041f('0x0'));var util=require(_0x041f('0x1'));var logger=require(_0x041f('0x2'))('api');var moment=require(_0x041f('0x3'));var BPromise=require(_0x041f('0x4'));var rp=require(_0x041f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x041f('0x6'));var config=require(_0x041f('0x7'));var attributes=require('./condition.attributes');module['exports']=function(_0x3d9ea2,_0x49cc45){return _0x3d9ea2['define']('Condition',attributes,{'tableName':_0x041f('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1344=['tools_conditions','lodash','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./condition.attributes','define','Condition'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x1344,0xc7));var _0x4134=function(_0x503cd5,_0x57774a){_0x503cd5=_0x503cd5-0x0;var _0x1fdf1e=_0x1344[_0x503cd5];return _0x1fdf1e;};'use strict';var _=require(_0x4134('0x0'));var util=require('util');var logger=require(_0x4134('0x1'))(_0x4134('0x2'));var moment=require(_0x4134('0x3'));var BPromise=require(_0x4134('0x4'));var rp=require(_0x4134('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4134('0x6'));var attributes=require(_0x4134('0x7'));module['exports']=function(_0x20b58a,_0x595896){return _0x20b58a[_0x4134('0x8')](_0x4134('0x9'),attributes,{'tableName':_0x4134('0xa'),'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 cb5d479..478305c 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 _0xdcf5=['moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util'];(function(_0x4ee2a3,_0x5a3694){var _0x5566b6=function(_0x3739c7){while(--_0x3739c7){_0x4ee2a3['push'](_0x4ee2a3['shift']());}};_0x5566b6(++_0x5a3694);}(_0xdcf5,0x132));var _0x5dcf=function(_0x11ce46,_0x177a85){_0x11ce46=_0x11ce46-0x0;var _0x368a1e=_0xdcf5[_0x11ce46];return _0x368a1e;};'use strict';var _=require(_0x5dcf('0x0'));var util=require(_0x5dcf('0x1'));var moment=require(_0x5dcf('0x2'));var BPromise=require('bluebird');var rs=require(_0x5dcf('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5dcf('0x4'));var logger=require(_0x5dcf('0x5'))(_0x5dcf('0x6'));var config=require(_0x5dcf('0x7'));var jayson=require(_0x5dcf('0x8'));var client=jayson['client'][_0x5dcf('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x6012a8,_0xa8d23,_0x300099){return new BPromise(function(_0x5c9fee,_0x19ded2){return client[_0x5dcf('0xa')](_0x6012a8,_0x300099)[_0x5dcf('0xb')](function(_0x40c1cd){logger[_0x5dcf('0xc')](_0x5dcf('0xd'),_0xa8d23,_0x5dcf('0xe'));logger[_0x5dcf('0xf')]('Condition,\x20%s,\x20%s,\x20%s',_0xa8d23,_0x5dcf('0xe'),JSON[_0x5dcf('0x10')](_0x40c1cd));if(_0x40c1cd[_0x5dcf('0x11')]){if(_0x40c1cd[_0x5dcf('0x11')][_0x5dcf('0x12')]===0x1f4){logger['error'](_0x5dcf('0xd'),_0xa8d23,_0x40c1cd[_0x5dcf('0x11')][_0x5dcf('0x13')]);return _0x19ded2(_0x40c1cd[_0x5dcf('0x11')][_0x5dcf('0x13')]);}logger[_0x5dcf('0x11')]('Condition,\x20%s,\x20%s',_0xa8d23,_0x40c1cd[_0x5dcf('0x11')]['message']);return _0x5c9fee(_0x40c1cd[_0x5dcf('0x11')][_0x5dcf('0x13')]);}else{logger[_0x5dcf('0xc')](_0x5dcf('0xd'),_0xa8d23,_0x5dcf('0xe'));_0x5c9fee(_0x40c1cd[_0x5dcf('0x14')][_0x5dcf('0x13')]);}})[_0x5dcf('0x15')](function(_0x296386){logger['error'](_0x5dcf('0xd'),_0xa8d23,_0x296386);_0x19ded2(_0x296386);});});} \ No newline at end of file +var _0x8ef7=['request','then','Condition,\x20%s,\x20%s','request\x20sent','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','lodash','util','moment','ioredis','../../mysqldb','rpc','jayson/promise','client','http'];(function(_0x2babb2,_0x269b7e){var _0x42dac1=function(_0x126a9f){while(--_0x126a9f){_0x2babb2['push'](_0x2babb2['shift']());}};_0x42dac1(++_0x269b7e);}(_0x8ef7,0xee));var _0x78ef=function(_0x273bc0,_0x59b6fc){_0x273bc0=_0x273bc0-0x0;var _0x22ea06=_0x8ef7[_0x273bc0];return _0x22ea06;};'use strict';var _=require(_0x78ef('0x0'));var util=require(_0x78ef('0x1'));var moment=require(_0x78ef('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x78ef('0x3'));var db=require(_0x78ef('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x78ef('0x5'));var config=require('../../config/environment');var jayson=require(_0x78ef('0x6'));var client=jayson[_0x78ef('0x7')][_0x78ef('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x27a7fd,_0x30d1e6,_0x5ccbb3){return new BPromise(function(_0x4d591e,_0xccfe5b){return client[_0x78ef('0x9')](_0x27a7fd,_0x5ccbb3)[_0x78ef('0xa')](function(_0x463d73){logger['info'](_0x78ef('0xb'),_0x30d1e6,_0x78ef('0xc'));logger['debug'](_0x78ef('0xd'),_0x30d1e6,_0x78ef('0xc'),JSON[_0x78ef('0xe')](_0x463d73));if(_0x463d73[_0x78ef('0xf')]){if(_0x463d73[_0x78ef('0xf')][_0x78ef('0x10')]===0x1f4){logger[_0x78ef('0xf')](_0x78ef('0xb'),_0x30d1e6,_0x463d73[_0x78ef('0xf')][_0x78ef('0x11')]);return _0xccfe5b(_0x463d73[_0x78ef('0xf')][_0x78ef('0x11')]);}logger[_0x78ef('0xf')](_0x78ef('0xb'),_0x30d1e6,_0x463d73[_0x78ef('0xf')][_0x78ef('0x11')]);return _0x4d591e(_0x463d73[_0x78ef('0xf')][_0x78ef('0x11')]);}else{logger[_0x78ef('0x12')](_0x78ef('0xb'),_0x30d1e6,_0x78ef('0xc'));_0x4d591e(_0x463d73['result'][_0x78ef('0x11')]);}})['catch'](function(_0x46688c){logger[_0x78ef('0xf')]('Condition,\x20%s,\x20%s',_0x30d1e6,_0x46688c);_0xccfe5b(_0x46688c);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 714466e..9e08eb2 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 _0x25f0=['connect-timeout','Router','fs-extra','../../components/auth/service','./condition.controller','put','isAuthenticated','update','delete','/:id','multer','util','path'];(function(_0x95ce1a,_0x287978){var _0x1b562f=function(_0x5a260a){while(--_0x5a260a){_0x95ce1a['push'](_0x95ce1a['shift']());}};_0x1b562f(++_0x287978);}(_0x25f0,0x1de));var _0x025f=function(_0x3a9508,_0x565630){_0x3a9508=_0x3a9508-0x0;var _0x4ee4ee=_0x25f0[_0x3a9508];return _0x4ee4ee;};'use strict';var multer=require(_0x025f('0x0'));var util=require(_0x025f('0x1'));var path=require(_0x025f('0x2'));var timeout=require(_0x025f('0x3'));var express=require('express');var router=express[_0x025f('0x4')]();var fs_extra=require(_0x025f('0x5'));var auth=require(_0x025f('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x025f('0x7'));router[_0x025f('0x8')]('/:id',auth[_0x025f('0x9')](),controller[_0x025f('0xa')]);router[_0x025f('0xb')](_0x025f('0xc'),auth[_0x025f('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x2988=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','put','/:id','update','delete','isAuthenticated','exports','multer'];(function(_0x55abd9,_0x1148af){var _0x3e5669=function(_0x6f2105){while(--_0x6f2105){_0x55abd9['push'](_0x55abd9['shift']());}};_0x3e5669(++_0x1148af);}(_0x2988,0xef));var _0x8298=function(_0x353c22,_0x28cd10){_0x353c22=_0x353c22-0x0;var _0x3cb724=_0x2988[_0x353c22];return _0x3cb724;};'use strict';var multer=require(_0x8298('0x0'));var util=require(_0x8298('0x1'));var path=require(_0x8298('0x2'));var timeout=require(_0x8298('0x3'));var express=require(_0x8298('0x4'));var router=express[_0x8298('0x5')]();var fs_extra=require(_0x8298('0x6'));var auth=require(_0x8298('0x7'));var interaction=require(_0x8298('0x8'));var config=require(_0x8298('0x9'));var controller=require('./condition.controller');router[_0x8298('0xa')](_0x8298('0xb'),auth['isAuthenticated'](),controller[_0x8298('0xc')]);router[_0x8298('0xd')](_0x8298('0xb'),auth[_0x8298('0xe')](),controller['destroy']);module[_0x8298('0xf')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index d926ce6..0457872 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 _0x8d3c=['STRING','name','sequelize','exports'];(function(_0x49c699,_0x314403){var _0x2853ea=function(_0x68ceb9){while(--_0x68ceb9){_0x49c699['push'](_0x49c699['shift']());}};_0x2853ea(++_0x314403);}(_0x8d3c,0x19a));var _0xc8d3=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x8d3c[_0x3ab51d];return _0x29a04e;};'use strict';var Sequelize=require(_0xc8d3('0x0'));module[_0xc8d3('0x1')]={'name':{'type':Sequelize[_0xc8d3('0x2')],'allowNull':![],'unique':_0xc8d3('0x3')},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0xc8d3('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0xd780=['name','INTEGER','sequelize','exports','STRING'];(function(_0x50a004,_0x193d84){var _0x5e9992=function(_0x3c8c37){while(--_0x3c8c37){_0x50a004['push'](_0x50a004['shift']());}};_0x5e9992(++_0x193d84);}(_0xd780,0x1e7));var _0x0d78=function(_0x1043b7,_0x70b926){_0x1043b7=_0x1043b7-0x0;var _0x27ef46=_0xd780[_0x1043b7];return _0x27ef46;};'use strict';var Sequelize=require(_0x0d78('0x0'));module[_0x0d78('0x1')]={'name':{'type':Sequelize[_0x0d78('0x2')],'allowNull':![],'unique':_0x0d78('0x3')},'OrderBy':{'type':Sequelize[_0x0d78('0x4')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x0d78('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 7596cd6..09477a3 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 _0x7880=['pick','filter','merge','includeAll','include','rows','params','options','find','catch','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','UserProfileResource','error','rimraf','zip-dir','fast-json-patch','request-promise','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','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','limit','set','json','apply','reject','save','update','then','destroy','ContactItemTypes','sendStatus','name','index','map','ContactItemType','rawAttributes','fieldName','type','key','model','query','keys','filters','fields','attributes','length','hasOwnProperty','order','where'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x7880,0x1f4));var _0x0788=function(_0x66ef11,_0x42f78b){_0x66ef11=_0x66ef11-0x0;var _0x318579=_0x7880[_0x66ef11];return _0x318579;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0788('0x0'));var zipdir=require(_0x0788('0x1'));var jsonpatch=require(_0x0788('0x2'));var rp=require(_0x0788('0x3'));var moment=require(_0x0788('0x4'));var BPromise=require(_0x0788('0x5'));var Mustache=require('mustache');var util=require(_0x0788('0x6'));var path=require(_0x0788('0x7'));var sox=require(_0x0788('0x8'));var csv=require(_0x0788('0x9'));var ejs=require(_0x0788('0xa'));var fs=require('fs');var fs_extra=require(_0x0788('0xb'));var _=require(_0x0788('0xc'));var squel=require(_0x0788('0xd'));var crypto=require(_0x0788('0xe'));var jsforce=require(_0x0788('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x0788('0x9'));var querystring=require('querystring');var Papa=require(_0x0788('0x10'));var Redis=require('ioredis');var authService=require(_0x0788('0x11'));var qs=require(_0x0788('0x12'));var as=require(_0x0788('0x13'));var hardwareService=require(_0x0788('0x14'));var logger=require(_0x0788('0x15'))('api');var utils=require(_0x0788('0x16'));var config=require(_0x0788('0x17'));var licenseUtil=require(_0x0788('0x18'));var db=require(_0x0788('0x19'))['db'];function respondWithStatusCode(_0x311729,_0xce4342){_0xce4342=_0xce4342||0xcc;return function(_0x261ebc){if(_0x261ebc){return _0x311729['sendStatus'](_0xce4342);}return _0x311729[_0x0788('0x1a')](_0xce4342)[_0x0788('0x1b')]();};}function respondWithResult(_0x3bdcdf,_0x13cf07){_0x13cf07=_0x13cf07||0xc8;return function(_0x51e5d3){if(_0x51e5d3){return _0x3bdcdf[_0x0788('0x1a')](_0x13cf07)['json'](_0x51e5d3);}};}function respondWithFilteredResult(_0x195f14,_0x170d56){return function(_0x3fd1e4){if(_0x3fd1e4){var _0xb406fb=typeof _0x170d56[_0x0788('0x1c')]===_0x0788('0x1d')&&typeof _0x170d56['limit']==='undefined';var _0x17d805=_0x3fd1e4[_0x0788('0x1e')];var _0x5b2bdc=_0xb406fb?0x0:_0x170d56[_0x0788('0x1c')];var _0x415f19=_0xb406fb?_0x3fd1e4[_0x0788('0x1e')]:_0x170d56['offset']+_0x170d56[_0x0788('0x1f')];var _0x3fb723;if(_0x415f19>=_0x17d805){_0x415f19=_0x17d805;_0x3fb723=0xc8;}else{_0x3fb723=0xce;}_0x195f14['status'](_0x3fb723);return _0x195f14[_0x0788('0x20')]('Content-Range',_0x5b2bdc+'-'+_0x415f19+'/'+_0x17d805)[_0x0788('0x21')](_0x3fd1e4);}return null;};}function patchUpdates(_0x48bc5f){return function(_0x17cca3){try{jsonpatch[_0x0788('0x22')](_0x17cca3,_0x48bc5f,!![]);}catch(_0x18ff22){return BPromise[_0x0788('0x23')](_0x18ff22);}return _0x17cca3[_0x0788('0x24')]();};}function saveUpdates(_0x4f0005,_0x48ec43){return function(_0x2270d4){if(_0x2270d4){return _0x2270d4[_0x0788('0x25')](_0x4f0005)[_0x0788('0x26')](function(_0x7a99a1){return _0x7a99a1;});}return null;};}function removeEntity(_0x5ba1da,_0x4d5c93){return function(_0x79204e){if(_0x79204e){return _0x79204e[_0x0788('0x27')]()[_0x0788('0x26')](function(){var _0x50b65c=_0x79204e['get']({'plain':!![]});var _0x240459=_0x0788('0x28');return db['UserProfileResource']['destroy']({'where':{'type':_0x240459,'resourceId':_0x50b65c['id']}})[_0x0788('0x26')](function(){return _0x79204e;});})[_0x0788('0x26')](function(){_0x5ba1da['status'](0xcc)[_0x0788('0x1b')]();});}};}function handleEntityNotFound(_0x40e7a6,_0x467d52){return function(_0x18fc0e){if(!_0x18fc0e){_0x40e7a6[_0x0788('0x29')](0x194);}return _0x18fc0e;};}function handleError(_0xb2f4a5,_0x6bf651){_0x6bf651=_0x6bf651||0x1f4;return function(_0x3ffe4f){logger['error'](_0x3ffe4f['stack']);if(_0x3ffe4f[_0x0788('0x2a')]){delete _0x3ffe4f[_0x0788('0x2a')];}_0xb2f4a5['status'](_0x6bf651)['send'](_0x3ffe4f);};}exports[_0x0788('0x2b')]=function(_0x68658a,_0x20fcd8){var _0x436031={},_0x44cbfb={},_0x44bff2={'count':0x0,'rows':[]};var _0x327d67=_[_0x0788('0x2c')](db[_0x0788('0x2d')][_0x0788('0x2e')],function(_0x5ec0ed){return{'name':_0x5ec0ed[_0x0788('0x2f')],'type':_0x5ec0ed[_0x0788('0x30')][_0x0788('0x31')]};});_0x44cbfb[_0x0788('0x32')]=_[_0x0788('0x2c')](_0x327d67,_0x0788('0x2a'));_0x44cbfb[_0x0788('0x33')]=_[_0x0788('0x34')](_0x68658a[_0x0788('0x33')]);_0x44cbfb[_0x0788('0x35')]=_['intersection'](_0x44cbfb['model'],_0x44cbfb['query']);_0x436031['attributes']=_['intersection'](_0x44cbfb['model'],qs[_0x0788('0x36')](_0x68658a[_0x0788('0x33')][_0x0788('0x36')]));_0x436031['attributes']=_0x436031[_0x0788('0x37')][_0x0788('0x38')]?_0x436031[_0x0788('0x37')]:_0x44cbfb[_0x0788('0x32')];if(!_0x68658a['query'][_0x0788('0x39')]('nolimit')){_0x436031[_0x0788('0x1f')]=qs['limit'](_0x68658a[_0x0788('0x33')][_0x0788('0x1f')]);_0x436031['offset']=qs[_0x0788('0x1c')](_0x68658a[_0x0788('0x33')]['offset']);}_0x436031[_0x0788('0x3a')]=qs['sort'](_0x68658a[_0x0788('0x33')]['sort']);_0x436031[_0x0788('0x3b')]=qs['filters'](_[_0x0788('0x3c')](_0x68658a['query'],_0x44cbfb['filters']),_0x327d67);if(_0x68658a[_0x0788('0x33')][_0x0788('0x3d')]){_0x436031[_0x0788('0x3b')]=_[_0x0788('0x3e')](_0x436031[_0x0788('0x3b')],{'$or':_['map'](_0x327d67,function(_0x530c5a){if(_0x530c5a['type']!=='VIRTUAL'){var _0x501dd5={};_0x501dd5[_0x530c5a[_0x0788('0x2a')]]={'$like':'%'+_0x68658a[_0x0788('0x33')][_0x0788('0x3d')]+'%'};return _0x501dd5;}})});}_0x436031=_[_0x0788('0x3e')]({},_0x436031,_0x68658a['options']);var _0x4c7833={'where':_0x436031[_0x0788('0x3b')]};return db[_0x0788('0x2d')][_0x0788('0x1e')](_0x4c7833)[_0x0788('0x26')](function(_0x236b63){_0x44bff2[_0x0788('0x1e')]=_0x236b63;if(_0x68658a[_0x0788('0x33')][_0x0788('0x3f')]){_0x436031[_0x0788('0x40')]=[{'all':!![]}];}return db['ContactItemType']['findAll'](_0x436031);})[_0x0788('0x26')](function(_0x1d579d){_0x44bff2[_0x0788('0x41')]=_0x1d579d;return _0x44bff2;})['then'](respondWithFilteredResult(_0x20fcd8,_0x436031))['catch'](handleError(_0x20fcd8,null));};exports['show']=function(_0x172424,_0x150c1e){var _0x25501b={'raw':!![],'where':{'id':_0x172424[_0x0788('0x42')]['id']}},_0x189d33={};_0x189d33[_0x0788('0x32')]=_[_0x0788('0x34')](db[_0x0788('0x2d')]['rawAttributes']);_0x189d33[_0x0788('0x33')]=_[_0x0788('0x34')](_0x172424[_0x0788('0x33')]);_0x189d33[_0x0788('0x35')]=_['intersection'](_0x189d33[_0x0788('0x32')],_0x189d33[_0x0788('0x33')]);_0x25501b['attributes']=_['intersection'](_0x189d33['model'],qs[_0x0788('0x36')](_0x172424['query'][_0x0788('0x36')]));_0x25501b[_0x0788('0x37')]=_0x25501b[_0x0788('0x37')][_0x0788('0x38')]?_0x25501b[_0x0788('0x37')]:_0x189d33[_0x0788('0x32')];if(_0x172424[_0x0788('0x33')][_0x0788('0x3f')]){_0x25501b['include']=[{'all':!![]}];}_0x25501b=_['merge']({},_0x25501b,_0x172424[_0x0788('0x43')]);return db[_0x0788('0x2d')][_0x0788('0x44')](_0x25501b)['then'](handleEntityNotFound(_0x150c1e,null))[_0x0788('0x26')](respondWithResult(_0x150c1e,null))[_0x0788('0x45')](handleError(_0x150c1e,null));};exports[_0x0788('0x46')]=function(_0x4563cd,_0x2395ad){return db['ContactItemType']['create'](_0x4563cd[_0x0788('0x47')],{})[_0x0788('0x26')](function(_0x5f1542){var _0x2b1479=_0x4563cd['user'][_0x0788('0x48')]({'plain':!![]});if(!_0x2b1479)throw new Error(_0x0788('0x49'));if(_0x2b1479[_0x0788('0x4a')]===_0x0788('0x4b')){var _0x3c757a=_0x5f1542[_0x0788('0x48')]({'plain':!![]});var _0x1722d4=_0x0788('0x28');return db['UserProfileSection'][_0x0788('0x44')]({'where':{'name':_0x1722d4,'userProfileId':_0x2b1479[_0x0788('0x4c')]},'raw':!![]})[_0x0788('0x26')](function(_0x5ef557){if(_0x5ef557&&_0x5ef557[_0x0788('0x4d')]===0x0){return db[_0x0788('0x4e')]['create']({'name':_0x3c757a[_0x0788('0x2a')],'resourceId':_0x3c757a['id'],'type':_0x5ef557[_0x0788('0x2a')],'sectionId':_0x5ef557['id']},{})[_0x0788('0x26')](function(){return _0x5f1542;});}else{return _0x5f1542;}})[_0x0788('0x45')](function(_0x137e24){logger[_0x0788('0x4f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x137e24);throw _0x137e24;});}return _0x5f1542;})['then'](respondWithResult(_0x2395ad,0xc9))[_0x0788('0x45')](handleError(_0x2395ad,null));};exports[_0x0788('0x25')]=function(_0x4b345d,_0x17d9fc){if(_0x4b345d[_0x0788('0x47')]['id']){delete _0x4b345d[_0x0788('0x47')]['id'];}return db[_0x0788('0x2d')][_0x0788('0x44')]({'where':{'id':_0x4b345d[_0x0788('0x42')]['id']}})[_0x0788('0x26')](handleEntityNotFound(_0x17d9fc,null))[_0x0788('0x26')](saveUpdates(_0x4b345d[_0x0788('0x47')],null))[_0x0788('0x26')](respondWithResult(_0x17d9fc,null))[_0x0788('0x45')](handleError(_0x17d9fc,null));};exports[_0x0788('0x27')]=function(_0x55481c,_0x1c8be0){return db[_0x0788('0x2d')][_0x0788('0x44')]({'where':{'id':_0x55481c['params']['id']}})[_0x0788('0x26')](handleEntityNotFound(_0x1c8be0,null))[_0x0788('0x26')](db['CmContactHasItem']['update']({'ItemTypeId':null},{'where':{'ItemTypeId':_0x55481c[_0x0788('0x42')]['id']}}))[_0x0788('0x26')](removeEntity(_0x1c8be0,null))[_0x0788('0x45')](handleError(_0x1c8be0,null));}; \ No newline at end of file +var _0xfff0=['json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','sendStatus','error','stack','name','send','ContactItemType','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end'];(function(_0x4fcd39,_0x2037f3){var _0x3c5722=function(_0x389b5a){while(--_0x389b5a){_0x4fcd39['push'](_0x4fcd39['shift']());}};_0x3c5722(++_0x2037f3);}(_0xfff0,0x139));var _0x0fff=function(_0x4844b5,_0x40e2dc){_0x4844b5=_0x4844b5-0x0;var _0x2ad48a=_0xfff0[_0x4844b5];return _0x2ad48a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0fff('0x0'));var zipdir=require(_0x0fff('0x1'));var jsonpatch=require(_0x0fff('0x2'));var rp=require('request-promise');var moment=require(_0x0fff('0x3'));var BPromise=require(_0x0fff('0x4'));var Mustache=require(_0x0fff('0x5'));var util=require('util');var path=require(_0x0fff('0x6'));var sox=require(_0x0fff('0x7'));var csv=require('to-csv');var ejs=require(_0x0fff('0x8'));var fs=require('fs');var fs_extra=require(_0x0fff('0x9'));var _=require(_0x0fff('0xa'));var squel=require('squel');var crypto=require(_0x0fff('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x0fff('0xc'));var toCsv=require('to-csv');var querystring=require(_0x0fff('0xd'));var Papa=require(_0x0fff('0xe'));var Redis=require('ioredis');var authService=require(_0x0fff('0xf'));var qs=require(_0x0fff('0x10'));var as=require(_0x0fff('0x11'));var hardwareService=require(_0x0fff('0x12'));var logger=require(_0x0fff('0x13'))(_0x0fff('0x14'));var utils=require(_0x0fff('0x15'));var config=require(_0x0fff('0x16'));var licenseUtil=require(_0x0fff('0x17'));var db=require(_0x0fff('0x18'))['db'];function respondWithStatusCode(_0x13f768,_0x5abecd){_0x5abecd=_0x5abecd||0xcc;return function(_0x1fb243){if(_0x1fb243){return _0x13f768['sendStatus'](_0x5abecd);}return _0x13f768[_0x0fff('0x19')](_0x5abecd)[_0x0fff('0x1a')]();};}function respondWithResult(_0x38fc82,_0x2c0322){_0x2c0322=_0x2c0322||0xc8;return function(_0x55e5fa){if(_0x55e5fa){return _0x38fc82['status'](_0x2c0322)[_0x0fff('0x1b')](_0x55e5fa);}};}function respondWithFilteredResult(_0x50a9e4,_0x5636fd){return function(_0x51ceea){if(_0x51ceea){var _0x1fb430=typeof _0x5636fd[_0x0fff('0x1c')]==='undefined'&&typeof _0x5636fd[_0x0fff('0x1d')]===_0x0fff('0x1e');var _0x540a67=_0x51ceea['count'];var _0x48f36d=_0x1fb430?0x0:_0x5636fd[_0x0fff('0x1c')];var _0x606792=_0x1fb430?_0x51ceea[_0x0fff('0x1f')]:_0x5636fd[_0x0fff('0x1c')]+_0x5636fd[_0x0fff('0x1d')];var _0xe89b4a;if(_0x606792>=_0x540a67){_0x606792=_0x540a67;_0xe89b4a=0xc8;}else{_0xe89b4a=0xce;}_0x50a9e4['status'](_0xe89b4a);return _0x50a9e4[_0x0fff('0x20')](_0x0fff('0x21'),_0x48f36d+'-'+_0x606792+'/'+_0x540a67)[_0x0fff('0x1b')](_0x51ceea);}return null;};}function patchUpdates(_0x49d211){return function(_0x5e27df){try{jsonpatch[_0x0fff('0x22')](_0x5e27df,_0x49d211,!![]);}catch(_0x330e29){return BPromise[_0x0fff('0x23')](_0x330e29);}return _0x5e27df[_0x0fff('0x24')]();};}function saveUpdates(_0x502393,_0x155132){return function(_0x2f8665){if(_0x2f8665){return _0x2f8665[_0x0fff('0x25')](_0x502393)[_0x0fff('0x26')](function(_0x16e7f4){return _0x16e7f4;});}return null;};}function removeEntity(_0x17fba6,_0x580b8e){return function(_0x6a116c){if(_0x6a116c){return _0x6a116c[_0x0fff('0x27')]()[_0x0fff('0x26')](function(){var _0x24cd18=_0x6a116c[_0x0fff('0x28')]({'plain':!![]});var _0x23d9f8='ContactItemTypes';return db[_0x0fff('0x29')][_0x0fff('0x27')]({'where':{'type':_0x23d9f8,'resourceId':_0x24cd18['id']}})[_0x0fff('0x26')](function(){return _0x6a116c;});})[_0x0fff('0x26')](function(){_0x17fba6[_0x0fff('0x19')](0xcc)[_0x0fff('0x1a')]();});}};}function handleEntityNotFound(_0x27bd76,_0x3e6fef){return function(_0x44e54a){if(!_0x44e54a){_0x27bd76[_0x0fff('0x2a')](0x194);}return _0x44e54a;};}function handleError(_0x40651c,_0x2c39e3){_0x2c39e3=_0x2c39e3||0x1f4;return function(_0x495734){logger[_0x0fff('0x2b')](_0x495734[_0x0fff('0x2c')]);if(_0x495734[_0x0fff('0x2d')]){delete _0x495734[_0x0fff('0x2d')];}_0x40651c[_0x0fff('0x19')](_0x2c39e3)[_0x0fff('0x2e')](_0x495734);};}exports['index']=function(_0x31f9a4,_0xa16c29){var _0x351102={},_0x48f1d1={},_0x1016fa={'count':0x0,'rows':[]};var _0x3fa6fc=_['map'](db[_0x0fff('0x2f')][_0x0fff('0x30')],function(_0x15bb46){return{'name':_0x15bb46[_0x0fff('0x31')],'type':_0x15bb46[_0x0fff('0x32')][_0x0fff('0x33')]};});_0x48f1d1[_0x0fff('0x34')]=_[_0x0fff('0x35')](_0x3fa6fc,_0x0fff('0x2d'));_0x48f1d1[_0x0fff('0x36')]=_['keys'](_0x31f9a4[_0x0fff('0x36')]);_0x48f1d1[_0x0fff('0x37')]=_[_0x0fff('0x38')](_0x48f1d1[_0x0fff('0x34')],_0x48f1d1[_0x0fff('0x36')]);_0x351102['attributes']=_['intersection'](_0x48f1d1[_0x0fff('0x34')],qs[_0x0fff('0x39')](_0x31f9a4[_0x0fff('0x36')][_0x0fff('0x39')]));_0x351102['attributes']=_0x351102[_0x0fff('0x3a')][_0x0fff('0x3b')]?_0x351102[_0x0fff('0x3a')]:_0x48f1d1[_0x0fff('0x34')];if(!_0x31f9a4['query'][_0x0fff('0x3c')](_0x0fff('0x3d'))){_0x351102[_0x0fff('0x1d')]=qs[_0x0fff('0x1d')](_0x31f9a4[_0x0fff('0x36')][_0x0fff('0x1d')]);_0x351102[_0x0fff('0x1c')]=qs[_0x0fff('0x1c')](_0x31f9a4[_0x0fff('0x36')][_0x0fff('0x1c')]);}_0x351102[_0x0fff('0x3e')]=qs[_0x0fff('0x3f')](_0x31f9a4['query'][_0x0fff('0x3f')]);_0x351102[_0x0fff('0x40')]=qs[_0x0fff('0x37')](_[_0x0fff('0x41')](_0x31f9a4[_0x0fff('0x36')],_0x48f1d1[_0x0fff('0x37')]),_0x3fa6fc);if(_0x31f9a4['query'][_0x0fff('0x42')]){_0x351102[_0x0fff('0x40')]=_[_0x0fff('0x43')](_0x351102[_0x0fff('0x40')],{'$or':_[_0x0fff('0x35')](_0x3fa6fc,function(_0x101151){if(_0x101151[_0x0fff('0x32')]!==_0x0fff('0x44')){var _0x28e0aa={};_0x28e0aa[_0x101151['name']]={'$like':'%'+_0x31f9a4[_0x0fff('0x36')]['filter']+'%'};return _0x28e0aa;}})});}_0x351102=_[_0x0fff('0x43')]({},_0x351102,_0x31f9a4[_0x0fff('0x45')]);var _0x126f6a={'where':_0x351102['where']};return db['ContactItemType'][_0x0fff('0x1f')](_0x126f6a)[_0x0fff('0x26')](function(_0x311348){_0x1016fa['count']=_0x311348;if(_0x31f9a4['query'][_0x0fff('0x46')]){_0x351102['include']=[{'all':!![]}];}return db[_0x0fff('0x2f')][_0x0fff('0x47')](_0x351102);})[_0x0fff('0x26')](function(_0x309d75){_0x1016fa[_0x0fff('0x48')]=_0x309d75;return _0x1016fa;})[_0x0fff('0x26')](respondWithFilteredResult(_0xa16c29,_0x351102))['catch'](handleError(_0xa16c29,null));};exports[_0x0fff('0x49')]=function(_0x39b829,_0x2a8c5e){var _0x41b4d5={'raw':!![],'where':{'id':_0x39b829[_0x0fff('0x4a')]['id']}},_0x7157e5={};_0x7157e5[_0x0fff('0x34')]=_['keys'](db[_0x0fff('0x2f')][_0x0fff('0x30')]);_0x7157e5[_0x0fff('0x36')]=_['keys'](_0x39b829[_0x0fff('0x36')]);_0x7157e5[_0x0fff('0x37')]=_[_0x0fff('0x38')](_0x7157e5[_0x0fff('0x34')],_0x7157e5[_0x0fff('0x36')]);_0x41b4d5[_0x0fff('0x3a')]=_[_0x0fff('0x38')](_0x7157e5[_0x0fff('0x34')],qs[_0x0fff('0x39')](_0x39b829[_0x0fff('0x36')][_0x0fff('0x39')]));_0x41b4d5['attributes']=_0x41b4d5[_0x0fff('0x3a')][_0x0fff('0x3b')]?_0x41b4d5['attributes']:_0x7157e5[_0x0fff('0x34')];if(_0x39b829[_0x0fff('0x36')][_0x0fff('0x46')]){_0x41b4d5['include']=[{'all':!![]}];}_0x41b4d5=_['merge']({},_0x41b4d5,_0x39b829[_0x0fff('0x45')]);return db['ContactItemType']['find'](_0x41b4d5)[_0x0fff('0x26')](handleEntityNotFound(_0x2a8c5e,null))[_0x0fff('0x26')](respondWithResult(_0x2a8c5e,null))[_0x0fff('0x4b')](handleError(_0x2a8c5e,null));};exports[_0x0fff('0x4c')]=function(_0x3b4b8e,_0x1a7677){return db['ContactItemType'][_0x0fff('0x4c')](_0x3b4b8e[_0x0fff('0x4d')],{})[_0x0fff('0x26')](function(_0x32568a){var _0x30c4d6=_0x3b4b8e[_0x0fff('0x4e')]['get']({'plain':!![]});if(!_0x30c4d6)throw new Error(_0x0fff('0x4f'));if(_0x30c4d6[_0x0fff('0x50')]==='user'){var _0x1fc872=_0x32568a['get']({'plain':!![]});var _0x5f1943='ContactItemTypes';return db[_0x0fff('0x51')][_0x0fff('0x52')]({'where':{'name':_0x5f1943,'userProfileId':_0x30c4d6[_0x0fff('0x53')]},'raw':!![]})[_0x0fff('0x26')](function(_0x579291){if(_0x579291&&_0x579291['autoAssociation']===0x0){return db[_0x0fff('0x29')][_0x0fff('0x4c')]({'name':_0x1fc872[_0x0fff('0x2d')],'resourceId':_0x1fc872['id'],'type':_0x579291[_0x0fff('0x2d')],'sectionId':_0x579291['id']},{})[_0x0fff('0x26')](function(){return _0x32568a;});}else{return _0x32568a;}})['catch'](function(_0x3b401c){logger[_0x0fff('0x2b')](_0x0fff('0x54'),_0x3b401c);throw _0x3b401c;});}return _0x32568a;})[_0x0fff('0x26')](respondWithResult(_0x1a7677,0xc9))[_0x0fff('0x4b')](handleError(_0x1a7677,null));};exports[_0x0fff('0x25')]=function(_0x1af59f,_0x236da3){if(_0x1af59f[_0x0fff('0x4d')]['id']){delete _0x1af59f[_0x0fff('0x4d')]['id'];}return db[_0x0fff('0x2f')][_0x0fff('0x52')]({'where':{'id':_0x1af59f[_0x0fff('0x4a')]['id']}})[_0x0fff('0x26')](handleEntityNotFound(_0x236da3,null))[_0x0fff('0x26')](saveUpdates(_0x1af59f[_0x0fff('0x4d')],null))[_0x0fff('0x26')](respondWithResult(_0x236da3,null))[_0x0fff('0x4b')](handleError(_0x236da3,null));};exports[_0x0fff('0x27')]=function(_0x398513,_0x18c853){return db['ContactItemType'][_0x0fff('0x52')]({'where':{'id':_0x398513[_0x0fff('0x4a')]['id']}})[_0x0fff('0x26')](handleEntityNotFound(_0x18c853,null))[_0x0fff('0x26')](db['CmContactHasItem'][_0x0fff('0x25')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x398513['params']['id']}}))[_0x0fff('0x26')](removeEntity(_0x18c853,null))[_0x0fff('0x4b')](handleError(_0x18c853,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 6e8fb32..f528087 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 _0x76d4=['path','rimraf','./contactItemType.attributes','define','ContactItemType','lodash','util','../../config/logger','api','moment'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x76d4,0x163));var _0x476d=function(_0x137e7a,_0x304cb8){_0x137e7a=_0x137e7a-0x0;var _0x47c3be=_0x76d4[_0x137e7a];return _0x47c3be;};'use strict';var _=require(_0x476d('0x0'));var util=require(_0x476d('0x1'));var logger=require(_0x476d('0x2'))(_0x476d('0x3'));var moment=require(_0x476d('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x476d('0x5'));var rimraf=require(_0x476d('0x6'));var config=require('../../config/environment');var attributes=require(_0x476d('0x7'));module['exports']=function(_0x33f917,_0x14514f){return _0x33f917[_0x476d('0x8')](_0x476d('0x9'),attributes,{'tableName':'tools_contact_item_types','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x66c7=['path','rimraf','../../config/environment','./contactItemType.attributes','define','tools_contact_item_types','lodash','../../config/logger','moment','request-promise'];(function(_0x268a56,_0x3f1b88){var _0x54a565=function(_0x22f88f){while(--_0x22f88f){_0x268a56['push'](_0x268a56['shift']());}};_0x54a565(++_0x3f1b88);}(_0x66c7,0x164));var _0x766c=function(_0x23f2df,_0x370261){_0x23f2df=_0x23f2df-0x0;var _0x29ceeb=_0x66c7[_0x23f2df];return _0x29ceeb;};'use strict';var _=require(_0x766c('0x0'));var util=require('util');var logger=require(_0x766c('0x1'))('api');var moment=require(_0x766c('0x2'));var BPromise=require('bluebird');var rp=require(_0x766c('0x3'));var fs=require('fs');var path=require(_0x766c('0x4'));var rimraf=require(_0x766c('0x5'));var config=require(_0x766c('0x6'));var attributes=require(_0x766c('0x7'));module['exports']=function(_0x48654f,_0x260751){return _0x48654f[_0x766c('0x8')]('ContactItemType',attributes,{'tableName':_0x766c('0x9'),'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 646ea1f..0c9eb8e 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 _0x1ff8=['ContactItemType,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','bluebird','../../config/utils','../../config/logger','rpc','client','http','request','info'];(function(_0x504474,_0x2c47c2){var _0x1a3f98=function(_0x421226){while(--_0x421226){_0x504474['push'](_0x504474['shift']());}};_0x1a3f98(++_0x2c47c2);}(_0x1ff8,0x17e));var _0x81ff=function(_0x479f17,_0x3ddb13){_0x479f17=_0x479f17-0x0;var _0xba4508=_0x1ff8[_0x479f17];return _0xba4508;};'use strict';var _=require(_0x81ff('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x81ff('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x81ff('0x2'));var logger=require(_0x81ff('0x3'))(_0x81ff('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x81ff('0x5')][_0x81ff('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x32d503,_0x8c1339,_0x1ee0f9){return new BPromise(function(_0x5a7ce8,_0xc45621){return client[_0x81ff('0x7')](_0x32d503,_0x1ee0f9)['then'](function(_0x4a105f){logger[_0x81ff('0x8')](_0x81ff('0x9'),_0x8c1339,_0x81ff('0xa'));logger[_0x81ff('0xb')]('ContactItemType,\x20%s,\x20%s,\x20%s',_0x8c1339,_0x81ff('0xa'),JSON[_0x81ff('0xc')](_0x4a105f));if(_0x4a105f[_0x81ff('0xd')]){if(_0x4a105f[_0x81ff('0xd')][_0x81ff('0xe')]===0x1f4){logger['error'](_0x81ff('0x9'),_0x8c1339,_0x4a105f['error'][_0x81ff('0xf')]);return _0xc45621(_0x4a105f['error'][_0x81ff('0xf')]);}logger[_0x81ff('0xd')](_0x81ff('0x9'),_0x8c1339,_0x4a105f[_0x81ff('0xd')]['message']);return _0x5a7ce8(_0x4a105f[_0x81ff('0xd')][_0x81ff('0xf')]);}else{logger[_0x81ff('0x8')](_0x81ff('0x9'),_0x8c1339,_0x81ff('0xa'));_0x5a7ce8(_0x4a105f[_0x81ff('0x10')][_0x81ff('0xf')]);}})['catch'](function(_0x1771ad){logger['error'](_0x81ff('0x9'),_0x8c1339,_0x1771ad);_0xc45621(_0x1771ad);});});} \ No newline at end of file +var _0xf609=['info','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x48a94c,_0x4bfa19){var _0x5d533a=function(_0x4c423a){while(--_0x4c423a){_0x48a94c['push'](_0x48a94c['shift']());}};_0x5d533a(++_0x4bfa19);}(_0xf609,0x18b));var _0x9f60=function(_0x208572,_0x287705){_0x208572=_0x208572-0x0;var _0x242ffb=_0xf609[_0x208572];return _0x242ffb;};'use strict';var _=require('lodash');var util=require(_0x9f60('0x0'));var moment=require(_0x9f60('0x1'));var BPromise=require(_0x9f60('0x2'));var rs=require(_0x9f60('0x3'));var fs=require('fs');var Redis=require(_0x9f60('0x4'));var db=require(_0x9f60('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9f60('0x6'));var config=require(_0x9f60('0x7'));var jayson=require(_0x9f60('0x8'));var client=jayson[_0x9f60('0x9')][_0x9f60('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xda67d0,_0x8fb51c,_0x12d850){return new BPromise(function(_0x169b6c,_0x21ee61){return client[_0x9f60('0xb')](_0xda67d0,_0x12d850)[_0x9f60('0xc')](function(_0x528963){logger[_0x9f60('0xd')](_0x9f60('0xe'),_0x8fb51c,_0x9f60('0xf'));logger[_0x9f60('0x10')](_0x9f60('0x11'),_0x8fb51c,'request\x20sent',JSON[_0x9f60('0x12')](_0x528963));if(_0x528963[_0x9f60('0x13')]){if(_0x528963[_0x9f60('0x13')][_0x9f60('0x14')]===0x1f4){logger['error']('ContactItemType,\x20%s,\x20%s',_0x8fb51c,_0x528963['error'][_0x9f60('0x15')]);return _0x21ee61(_0x528963['error'][_0x9f60('0x15')]);}logger[_0x9f60('0x13')]('ContactItemType,\x20%s,\x20%s',_0x8fb51c,_0x528963[_0x9f60('0x13')][_0x9f60('0x15')]);return _0x169b6c(_0x528963[_0x9f60('0x13')]['message']);}else{logger[_0x9f60('0xd')]('ContactItemType,\x20%s,\x20%s',_0x8fb51c,_0x9f60('0xf'));_0x169b6c(_0x528963[_0x9f60('0x16')][_0x9f60('0x15')]);}})[_0x9f60('0x17')](function(_0x456c49){logger['error']('ContactItemType,\x20%s,\x20%s',_0x8fb51c,_0x456c49);_0x21ee61(_0x456c49);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index be44b0b..9a26ecd 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 _0x5838=['path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./contactItemType.controller','get','isAuthenticated','index','/:id','post','create','update','delete','destroy','exports','util'];(function(_0x305ae8,_0x202c06){var _0x2451fd=function(_0x44bdbb){while(--_0x44bdbb){_0x305ae8['push'](_0x305ae8['shift']());}};_0x2451fd(++_0x202c06);}(_0x5838,0xa9));var _0x8583=function(_0xe80ea,_0x5cbe58){_0xe80ea=_0xe80ea-0x0;var _0x3be2a2=_0x5838[_0xe80ea];return _0x3be2a2;};'use strict';var multer=require('multer');var util=require(_0x8583('0x0'));var path=require(_0x8583('0x1'));var timeout=require(_0x8583('0x2'));var express=require('express');var router=express[_0x8583('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x8583('0x4'));var interaction=require(_0x8583('0x5'));var config=require('../../config/environment');var controller=require(_0x8583('0x6'));router[_0x8583('0x7')]('/',auth[_0x8583('0x8')](),controller[_0x8583('0x9')]);router[_0x8583('0x7')](_0x8583('0xa'),auth[_0x8583('0x8')](),controller['show']);router[_0x8583('0xb')]('/',auth[_0x8583('0x8')](),controller[_0x8583('0xc')]);router['put']('/:id',auth[_0x8583('0x8')](),controller[_0x8583('0xd')]);router[_0x8583('0xe')]('/:id',auth[_0x8583('0x8')](),controller[_0x8583('0xf')]);module[_0x8583('0x10')]=router; \ No newline at end of file +var _0x2704=['/:id','update','delete','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./contactItemType.controller','get','index','show','post','isAuthenticated','create','put'];(function(_0x3b70a9,_0x41225e){var _0xae819a=function(_0x5dd15c){while(--_0x5dd15c){_0x3b70a9['push'](_0x3b70a9['shift']());}};_0xae819a(++_0x41225e);}(_0x2704,0x101));var _0x4270=function(_0x1aed80,_0x3ca6f6){_0x1aed80=_0x1aed80-0x0;var _0x43961e=_0x2704[_0x1aed80];return _0x43961e;};'use strict';var multer=require(_0x4270('0x0'));var util=require(_0x4270('0x1'));var path=require(_0x4270('0x2'));var timeout=require('connect-timeout');var express=require(_0x4270('0x3'));var router=express['Router']();var fs_extra=require(_0x4270('0x4'));var auth=require(_0x4270('0x5'));var interaction=require(_0x4270('0x6'));var config=require(_0x4270('0x7'));var controller=require(_0x4270('0x8'));router[_0x4270('0x9')]('/',auth['isAuthenticated'](),controller[_0x4270('0xa')]);router[_0x4270('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x4270('0xb')]);router[_0x4270('0xc')]('/',auth[_0x4270('0xd')](),controller[_0x4270('0xe')]);router[_0x4270('0xf')](_0x4270('0x10'),auth[_0x4270('0xd')](),controller[_0x4270('0x11')]);router[_0x4270('0x12')](_0x4270('0x10'),auth['isAuthenticated'](),controller[_0x4270('0x13')]);module[_0x4270('0x14')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index d0e5f2f..7c46320 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 _0x0713=['STRING','name'];(function(_0x1b8a63,_0x16d7cd){var _0x16d6e4=function(_0x583c5d){while(--_0x583c5d){_0x1b8a63['push'](_0x1b8a63['shift']());}};_0x16d6e4(++_0x16d7cd);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1')},'description':{'type':Sequelize[_0x3071('0x0')]}}; \ No newline at end of file +var _0xbaf0=['name','exports','STRING'];(function(_0x154983,_0xc29edf){var _0x3d1243=function(_0x5cb7a4){while(--_0x5cb7a4){_0x154983['push'](_0x154983['shift']());}};_0x3d1243(++_0xc29edf);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xbaf0[_0x6c993a];return _0x27f547;};'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 diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index b2255f0..0194436 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 _0x671b=['userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','updatedAt','createdAt','role','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','getItems','findOne','sort','pick','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','CustomDashboards','UserProfileResource','error','stack','name','send','index','Dashboard','rawAttributes','fieldName','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection'];(function(_0x49934e,_0x3c2c35){var _0x3d6ba8=function(_0x7ee7de){while(--_0x7ee7de){_0x49934e['push'](_0x49934e['shift']());}};_0x3d6ba8(++_0x3c2c35);}(_0x671b,0x13c));var _0xb671=function(_0x10070c,_0x2228c5){_0x10070c=_0x10070c-0x0;var _0xe4f14b=_0x671b[_0x10070c];return _0xe4f14b;};'use strict';var emlformat=require(_0xb671('0x0'));var rimraf=require(_0xb671('0x1'));var zipdir=require(_0xb671('0x2'));var jsonpatch=require(_0xb671('0x3'));var rp=require(_0xb671('0x4'));var moment=require(_0xb671('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb671('0x6'));var util=require(_0xb671('0x7'));var path=require(_0xb671('0x8'));var sox=require(_0xb671('0x9'));var csv=require('to-csv');var ejs=require(_0xb671('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb671('0xb'));var squel=require(_0xb671('0xc'));var crypto=require(_0xb671('0xd'));var jsforce=require(_0xb671('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb671('0xf'));var Papa=require(_0xb671('0x10'));var Redis=require(_0xb671('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xb671('0x12'));var hardwareService=require(_0xb671('0x13'));var logger=require('../../config/logger')(_0xb671('0x14'));var utils=require(_0xb671('0x15'));var config=require(_0xb671('0x16'));var licenseUtil=require(_0xb671('0x17'));var db=require(_0xb671('0x18'))['db'];config['redis']=_['defaults'](config[_0xb671('0x19')],{'host':_0xb671('0x1a'),'port':0x18eb});var socket=require(_0xb671('0x1b'))(new Redis(config['redis']));require('./dashboard.socket')[_0xb671('0x1c')](socket);function respondWithStatusCode(_0x3da466,_0x1a290c){_0x1a290c=_0x1a290c||0xcc;return function(_0x26d802){if(_0x26d802){return _0x3da466[_0xb671('0x1d')](_0x1a290c);}return _0x3da466[_0xb671('0x1e')](_0x1a290c)[_0xb671('0x1f')]();};}function respondWithResult(_0x14ec7f,_0x11502d){_0x11502d=_0x11502d||0xc8;return function(_0x86aea3){if(_0x86aea3){return _0x14ec7f[_0xb671('0x1e')](_0x11502d)[_0xb671('0x20')](_0x86aea3);}};}function respondWithFilteredResult(_0x5984a8,_0x4fe7a1){return function(_0x3010bc){if(_0x3010bc){var _0x2aca59=typeof _0x4fe7a1[_0xb671('0x21')]===_0xb671('0x22')&&typeof _0x4fe7a1[_0xb671('0x23')]===_0xb671('0x22');var _0x2973f0=_0x3010bc[_0xb671('0x24')];var _0x5be48f=_0x2aca59?0x0:_0x4fe7a1[_0xb671('0x21')];var _0x83b76=_0x2aca59?_0x3010bc[_0xb671('0x24')]:_0x4fe7a1[_0xb671('0x21')]+_0x4fe7a1[_0xb671('0x23')];var _0x10142d;if(_0x83b76>=_0x2973f0){_0x83b76=_0x2973f0;_0x10142d=0xc8;}else{_0x10142d=0xce;}_0x5984a8['status'](_0x10142d);return _0x5984a8[_0xb671('0x25')](_0xb671('0x26'),_0x5be48f+'-'+_0x83b76+'/'+_0x2973f0)[_0xb671('0x20')](_0x3010bc);}return null;};}function patchUpdates(_0x46118d){return function(_0x176102){try{jsonpatch[_0xb671('0x27')](_0x176102,_0x46118d,!![]);}catch(_0x4fd5bb){return BPromise[_0xb671('0x28')](_0x4fd5bb);}return _0x176102[_0xb671('0x29')]();};}function saveUpdates(_0x78b161,_0x26f2ab){return function(_0x1b84e2){if(_0x1b84e2){return _0x1b84e2[_0xb671('0x2a')](_0x78b161)[_0xb671('0x2b')](function(_0x4eb2ad){return _0x4eb2ad;});}return null;};}function removeEntity(_0x49d930,_0x5a81a9){return function(_0x47bad3){if(_0x47bad3){return _0x47bad3[_0xb671('0x2c')]()[_0xb671('0x2b')](function(){var _0x958c5a=_0x47bad3[_0xb671('0x2d')]({'plain':!![]});var _0x25359c=_0xb671('0x2e');return db[_0xb671('0x2f')][_0xb671('0x2c')]({'where':{'type':_0x25359c,'resourceId':_0x958c5a['id']}})[_0xb671('0x2b')](function(){return _0x47bad3;});})['then'](function(){_0x49d930[_0xb671('0x1e')](0xcc)[_0xb671('0x1f')]();});}};}function handleEntityNotFound(_0x46ce10,_0x221b2c){return function(_0x2cc3d2){if(!_0x2cc3d2){_0x46ce10['sendStatus'](0x194);}return _0x2cc3d2;};}function handleError(_0x1df2dc,_0x332886){_0x332886=_0x332886||0x1f4;return function(_0x44f15a){logger[_0xb671('0x30')](_0x44f15a[_0xb671('0x31')]);if(_0x44f15a[_0xb671('0x32')]){delete _0x44f15a['name'];}_0x1df2dc[_0xb671('0x1e')](_0x332886)[_0xb671('0x33')](_0x44f15a);};}exports[_0xb671('0x34')]=function(_0x3de96a,_0x4b7db4){var _0x19ee8b={},_0x3f84ab={},_0xd37045={'count':0x0,'rows':[]};var _0x16a3c3=_['map'](db[_0xb671('0x35')][_0xb671('0x36')],function(_0x2c730b){return{'name':_0x2c730b[_0xb671('0x37')],'type':_0x2c730b['type']['key']};});_0x3f84ab[_0xb671('0x38')]=_[_0xb671('0x39')](_0x16a3c3,_0xb671('0x32'));_0x3f84ab[_0xb671('0x3a')]=_[_0xb671('0x3b')](_0x3de96a[_0xb671('0x3a')]);_0x3f84ab[_0xb671('0x3c')]=_[_0xb671('0x3d')](_0x3f84ab[_0xb671('0x38')],_0x3f84ab[_0xb671('0x3a')]);_0x19ee8b[_0xb671('0x3e')]=_['intersection'](_0x3f84ab[_0xb671('0x38')],qs[_0xb671('0x3f')](_0x3de96a[_0xb671('0x3a')]['fields']));_0x19ee8b[_0xb671('0x3e')]=_0x19ee8b[_0xb671('0x3e')][_0xb671('0x40')]?_0x19ee8b[_0xb671('0x3e')]:_0x3f84ab[_0xb671('0x38')];if(!_0x3de96a['query'][_0xb671('0x41')](_0xb671('0x42'))){_0x19ee8b[_0xb671('0x23')]=qs[_0xb671('0x23')](_0x3de96a['query'][_0xb671('0x23')]);_0x19ee8b[_0xb671('0x21')]=qs['offset'](_0x3de96a[_0xb671('0x3a')][_0xb671('0x21')]);}_0x19ee8b[_0xb671('0x43')]=qs['sort'](_0x3de96a[_0xb671('0x3a')]['sort']);_0x19ee8b[_0xb671('0x44')]=qs[_0xb671('0x3c')](_['pick'](_0x3de96a['query'],_0x3f84ab[_0xb671('0x3c')]),_0x16a3c3);if(_0x3de96a[_0xb671('0x3a')][_0xb671('0x45')]){_0x19ee8b[_0xb671('0x44')]=_[_0xb671('0x46')](_0x19ee8b['where'],{'$or':_[_0xb671('0x39')](_0x16a3c3,function(_0x3fc718){if(_0x3fc718[_0xb671('0x47')]!==_0xb671('0x48')){var _0x4206da={};_0x4206da[_0x3fc718['name']]={'$like':'%'+_0x3de96a[_0xb671('0x3a')][_0xb671('0x45')]+'%'};return _0x4206da;}})});}_0x19ee8b=_['merge']({},_0x19ee8b,_0x3de96a[_0xb671('0x49')]);var _0x25768a={'where':_0x19ee8b[_0xb671('0x44')]};return db[_0xb671('0x35')]['count'](_0x25768a)[_0xb671('0x2b')](function(_0x101da8){_0xd37045[_0xb671('0x24')]=_0x101da8;if(_0x3de96a[_0xb671('0x3a')][_0xb671('0x4a')]){_0x19ee8b[_0xb671('0x4b')]=[{'all':!![]}];}return db[_0xb671('0x35')][_0xb671('0x4c')](_0x19ee8b);})[_0xb671('0x2b')](function(_0x548f1a){_0xd37045[_0xb671('0x4d')]=_0x548f1a;return _0xd37045;})[_0xb671('0x2b')](respondWithFilteredResult(_0x4b7db4,_0x19ee8b))[_0xb671('0x4e')](handleError(_0x4b7db4,null));};exports[_0xb671('0x4f')]=function(_0x5ed740,_0x3f118a){var _0xb0b3a0={'raw':![],'where':{'id':_0x5ed740['params']['id']}},_0x3c0bbc={};_0x3c0bbc[_0xb671('0x38')]=_[_0xb671('0x3b')](db[_0xb671('0x35')][_0xb671('0x36')]);_0x3c0bbc[_0xb671('0x3a')]=_[_0xb671('0x3b')](_0x5ed740[_0xb671('0x3a')]);_0x3c0bbc[_0xb671('0x3c')]=_[_0xb671('0x3d')](_0x3c0bbc[_0xb671('0x38')],_0x3c0bbc[_0xb671('0x3a')]);_0xb0b3a0[_0xb671('0x3e')]=_[_0xb671('0x3d')](_0x3c0bbc['model'],qs[_0xb671('0x3f')](_0x5ed740[_0xb671('0x3a')][_0xb671('0x3f')]));_0xb0b3a0['attributes']=_0xb0b3a0[_0xb671('0x3e')][_0xb671('0x40')]?_0xb0b3a0[_0xb671('0x3e')]:_0x3c0bbc[_0xb671('0x38')];if(_0x5ed740[_0xb671('0x3a')]['includeAll']){_0xb0b3a0[_0xb671('0x4b')]=[{'all':!![]}];}_0xb0b3a0=_[_0xb671('0x46')]({},_0xb0b3a0,_0x5ed740[_0xb671('0x49')]);return db[_0xb671('0x35')][_0xb671('0x50')](_0xb0b3a0)[_0xb671('0x2b')](handleEntityNotFound(_0x3f118a,null))[_0xb671('0x2b')](respondWithResult(_0x3f118a,null))['catch'](handleError(_0x3f118a,null));};exports['create']=function(_0x5422f6,_0x96473b){return db[_0xb671('0x35')][_0xb671('0x51')](_0x5422f6[_0xb671('0x52')],{})['then'](function(_0x36abac){var _0x4a38bc=_0x5422f6['user']['get']({'plain':!![]});if(!_0x4a38bc)throw new Error(_0xb671('0x53'));if(_0x4a38bc['role']===_0xb671('0x54')){var _0x416b56=_0x36abac[_0xb671('0x2d')]({'plain':!![]});var _0x340f98=_0xb671('0x2e');return db[_0xb671('0x55')]['find']({'where':{'name':_0x340f98,'userProfileId':_0x4a38bc[_0xb671('0x56')]},'raw':!![]})['then'](function(_0x194de2){if(_0x194de2&&_0x194de2[_0xb671('0x57')]===0x0){return db['UserProfileResource']['create']({'name':_0x416b56[_0xb671('0x32')],'resourceId':_0x416b56['id'],'type':_0x194de2[_0xb671('0x32')],'sectionId':_0x194de2['id']},{})[_0xb671('0x2b')](function(){return _0x36abac;});}else{return _0x36abac;}})[_0xb671('0x4e')](function(_0x3b0bb0){logger['error'](_0xb671('0x58'),_0x3b0bb0);throw _0x3b0bb0;});}return _0x36abac;})[_0xb671('0x2b')](respondWithResult(_0x96473b,0xc9))[_0xb671('0x4e')](handleError(_0x96473b,null));};exports['clone']=function(_0x4c402a,_0x3f070c){var _0x20a5d9={'where':{'id':_0x4c402a[_0xb671('0x59')]['id']}},_0x3b327e={};_0x3b327e[_0xb671('0x38')]=_['keys'](db['Dashboard'][_0xb671('0x36')]);_0x20a5d9[_0xb671('0x3e')]=_[_0xb671('0x3d')](_0x3b327e['model'],qs[_0xb671('0x3f')](_0x4c402a[_0xb671('0x3a')][_0xb671('0x3f')]));_0x20a5d9['attributes']=_0x20a5d9[_0xb671('0x3e')]['length']?_0x20a5d9[_0xb671('0x3e')]:_0x3b327e[_0xb671('0x38')];if(_0x4c402a[_0xb671('0x3a')][_0xb671('0x4a')]){_0x20a5d9[_0xb671('0x4b')]=[{'all':!![]}];}_0x20a5d9=_[_0xb671('0x46')]({},_0x20a5d9,_0x4c402a[_0xb671('0x49')]);return db[_0xb671('0x35')][_0xb671('0x50')](_0x20a5d9)[_0xb671('0x2b')](handleEntityNotFound(_0x3f070c,null))[_0xb671('0x2b')](function(_0x1cfeb4){if(_0x1cfeb4){var _0x5cd6bc=_0x1cfeb4[_0xb671('0x2d')]({'plain':!![]});_0x5cd6bc=qs['omit'](_0x5cd6bc,['id','createdAt',_0xb671('0x5a')]);_0x4c402a[_0xb671('0x52')]=_['omit'](_0x4c402a[_0xb671('0x52')],['id',_0xb671('0x5b'),_0xb671('0x5a')]);return db[_0xb671('0x35')][_0xb671('0x51')](_[_0xb671('0x46')](_0x5cd6bc,_0x4c402a[_0xb671('0x52')]),{'include':_0x4c402a['query']['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x36a64a){var _0x8ae50=_0x4c402a['user'][_0xb671('0x2d')]({'plain':!![]});if(!_0x8ae50)throw new Error(_0xb671('0x53'));if(_0x8ae50[_0xb671('0x5c')]===_0xb671('0x54')){var _0x4b6896=_0x36a64a[_0xb671('0x2d')]({'plain':!![]});var _0x51eccb=_0xb671('0x2e');return db[_0xb671('0x55')]['find']({'where':{'name':_0x51eccb,'userProfileId':_0x8ae50[_0xb671('0x56')]},'raw':!![]})[_0xb671('0x2b')](function(_0x3abb4f){if(_0x3abb4f&&_0x3abb4f[_0xb671('0x57')]===0x0){return db[_0xb671('0x2f')][_0xb671('0x51')]({'name':_0x4b6896[_0xb671('0x32')],'resourceId':_0x4b6896['id'],'type':_0x3abb4f[_0xb671('0x32')],'sectionId':_0x3abb4f['id']},{})[_0xb671('0x2b')](function(){return _0x36a64a;});}else{return _0x36a64a;}})[_0xb671('0x4e')](function(_0x58f271){logger['error'](_0xb671('0x58'),_0x58f271);throw _0x58f271;});}return _0x36a64a;});}})['then'](respondWithResult(_0x3f070c,0xc9))[_0xb671('0x4e')](handleError(_0x3f070c,null));};exports['update']=function(_0x54cad6,_0x301746){if(_0x54cad6['body']['id']){delete _0x54cad6[_0xb671('0x52')]['id'];}return db[_0xb671('0x35')][_0xb671('0x50')]({'where':{'id':_0x54cad6[_0xb671('0x59')]['id']}})[_0xb671('0x2b')](handleEntityNotFound(_0x301746,null))[_0xb671('0x2b')](saveUpdates(_0x54cad6['body'],null))[_0xb671('0x2b')](respondWithResult(_0x301746,null))[_0xb671('0x4e')](handleError(_0x301746,null));};exports[_0xb671('0x2c')]=function(_0x33c01d,_0x5bb9c7){return db[_0xb671('0x35')][_0xb671('0x50')]({'where':{'id':_0x33c01d['params']['id']}})[_0xb671('0x2b')](handleEntityNotFound(_0x5bb9c7,null))['then'](removeEntity(_0x5bb9c7,null))['catch'](handleError(_0x5bb9c7,null));};function widgetAttributes(_0x81d341){try{switch(_0x81d341[_0xb671('0x47')]){case _0xb671('0x5d'):return[{'name':_0xb671('0x5e'),'value':_0x81d341[_0xb671('0x5e')]||(_0x81d341[_0xb671('0x5f')]&&_0x81d341['attrs'][0x0]?_0x81d341[_0xb671('0x5f')][0x0][_0xb671('0x60')]:undefined)||_0xb671('0x61')}];case _0xb671('0x62'):return[{'name':_0xb671('0x63'),'value':_0x81d341[_0xb671('0x63')]||(_0x81d341['attrs']&&_0x81d341[_0xb671('0x5f')][0x0]?_0x81d341['attrs'][0x0][_0xb671('0x60')]:undefined)||''}];case _0xb671('0x64'):return[{'name':_0xb671('0x65'),'value':_0x81d341[_0xb671('0x65')]||(_0x81d341[_0xb671('0x5f')]&&_0x81d341[_0xb671('0x5f')][0x0]?_0x81d341[_0xb671('0x5f')][0x0][_0xb671('0x60')]:undefined)||'HH:mm:ss'},{'name':_0xb671('0x66'),'value':_0x81d341['attrTimezone']||(_0x81d341[_0xb671('0x5f')]&&_0x81d341['attrs'][0x1]?_0x81d341[_0xb671('0x5f')][0x1]['value']:undefined)||_0xb671('0x67')},{'name':_0xb671('0x68'),'value':_0x81d341[_0xb671('0x68')]||(_0x81d341[_0xb671('0x5f')]&&_0x81d341[_0xb671('0x5f')][0x2]?_0x81d341[_0xb671('0x5f')][0x2][_0xb671('0x60')]:undefined)||0xc}];case _0xb671('0x69'):return[{'name':_0xb671('0x6a'),'value':_0x81d341[_0xb671('0x6a')]||(_0x81d341[_0xb671('0x5f')]&&_0x81d341[_0xb671('0x5f')][0x0]?_0x81d341[_0xb671('0x5f')][0x0][_0xb671('0x60')]:undefined)||_0xb671('0x6b')},{'name':_0xb671('0x6c'),'value':_0x81d341['attrVoiceQueues']||(_0x81d341[_0xb671('0x5f')]&&_0x81d341['attrs'][0x1]?_0x81d341[_0xb671('0x5f')][0x1][_0xb671('0x60')]:undefined)||[]},{'name':_0xb671('0x68'),'value':_0x81d341[_0xb671('0x68')]||(_0x81d341[_0xb671('0x5f')]&&_0x81d341[_0xb671('0x5f')][0x2]?_0x81d341[_0xb671('0x5f')][0x2][_0xb671('0x60')]:undefined)||0x14},{'name':_0xb671('0x6d'),'value':_0x81d341['attrChannel']||(_0x81d341['attrs']&&_0x81d341[_0xb671('0x5f')][0x3]?_0x81d341[_0xb671('0x5f')][0x3][_0xb671('0x60')]:undefined)||_0xb671('0x6e')},{'name':_0xb671('0x6f'),'value':_0x81d341['attrEmailAccounts']||(_0x81d341[_0xb671('0x5f')]&&_0x81d341[_0xb671('0x5f')][0x4]?_0x81d341[_0xb671('0x5f')][0x4][_0xb671('0x60')]:undefined)||''},{'name':_0xb671('0x70'),'value':_0x81d341[_0xb671('0x70')]||(_0x81d341[_0xb671('0x5f')]&&_0x81d341[_0xb671('0x5f')][0x5]?_0x81d341[_0xb671('0x5f')][0x5][_0xb671('0x60')]:undefined)||''},{'name':_0xb671('0x71'),'value':_0x81d341[_0xb671('0x71')]||(_0x81d341['attrs']&&_0x81d341[_0xb671('0x5f')][0x6]?_0x81d341[_0xb671('0x5f')][0x6][_0xb671('0x60')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x81d341[_0xb671('0x72')]||(_0x81d341[_0xb671('0x5f')]&&_0x81d341[_0xb671('0x5f')][0x7]?_0x81d341[_0xb671('0x5f')][0x7]['value']:undefined)||''},{'name':_0xb671('0x73'),'value':_0x81d341[_0xb671('0x73')]||(_0x81d341[_0xb671('0x5f')]&&_0x81d341['attrs'][0x8]?_0x81d341[_0xb671('0x5f')][0x8][_0xb671('0x60')]:undefined)||''},{'name':_0xb671('0x74'),'value':_0x81d341[_0xb671('0x74')]||(_0x81d341[_0xb671('0x5f')]&&_0x81d341[_0xb671('0x5f')][0x9]?_0x81d341['attrs'][0x9][_0xb671('0x60')]:undefined)||''}];case _0xb671('0x75'):case _0xb671('0x76'):return[{'name':_0xb671('0x77'),'value':_0x81d341[_0xb671('0x77')]||(_0x81d341[_0xb671('0x5f')]&&_0x81d341[_0xb671('0x5f')][0x0]?_0x81d341[_0xb671('0x5f')][0x0][_0xb671('0x60')]:undefined)||'total'},{'name':_0xb671('0x78'),'value':_0x81d341[_0xb671('0x78')]||(_0x81d341[_0xb671('0x5f')]&&_0x81d341[_0xb671('0x5f')][0x1]?_0x81d341[_0xb671('0x5f')][0x1][_0xb671('0x60')]:undefined)||null},{'name':'attrSerie3','value':_0x81d341['attrSerie3']||(_0x81d341[_0xb671('0x5f')]&&_0x81d341[_0xb671('0x5f')][0x2]?_0x81d341['attrs'][0x2]['value']:undefined)||null},{'name':_0xb671('0x6c'),'value':_0x81d341[_0xb671('0x6c')]||(_0x81d341[_0xb671('0x5f')]&&_0x81d341[_0xb671('0x5f')][0x3]?_0x81d341[_0xb671('0x5f')][0x3][_0xb671('0x60')]:undefined)||[]},{'name':_0xb671('0x6d'),'value':_0x81d341[_0xb671('0x6d')]||(_0x81d341['attrs']&&_0x81d341[_0xb671('0x5f')][0x4]?_0x81d341[_0xb671('0x5f')][0x4]['value']:undefined)||_0xb671('0x6e')},{'name':_0xb671('0x6f'),'value':_0x81d341[_0xb671('0x6f')]||(_0x81d341[_0xb671('0x5f')]&&_0x81d341[_0xb671('0x5f')][0x5]?_0x81d341['attrs'][0x5][_0xb671('0x60')]:undefined)||''},{'name':_0xb671('0x70'),'value':_0x81d341['attrFaxAccounts']||(_0x81d341[_0xb671('0x5f')]&&_0x81d341['attrs'][0x6]?_0x81d341[_0xb671('0x5f')][0x6][_0xb671('0x60')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x81d341[_0xb671('0x71')]||(_0x81d341[_0xb671('0x5f')]&&_0x81d341[_0xb671('0x5f')][0x7]?_0x81d341[_0xb671('0x5f')][0x7][_0xb671('0x60')]:undefined)||''},{'name':_0xb671('0x72'),'value':_0x81d341[_0xb671('0x72')]||(_0x81d341['attrs']&&_0x81d341['attrs'][0x8]?_0x81d341[_0xb671('0x5f')][0x8][_0xb671('0x60')]:undefined)||''},{'name':_0xb671('0x73'),'value':_0x81d341[_0xb671('0x73')]||(_0x81d341['attrs']&&_0x81d341[_0xb671('0x5f')][0x9]?_0x81d341[_0xb671('0x5f')][0x9][_0xb671('0x60')]:undefined)||''},{'name':_0xb671('0x74'),'value':_0x81d341[_0xb671('0x74')]||(_0x81d341[_0xb671('0x5f')]&&_0x81d341[_0xb671('0x5f')][0xa]?_0x81d341['attrs'][0xa][_0xb671('0x60')]:undefined)||''}];case _0xb671('0x79'):return[{'name':_0xb671('0x7a'),'type':_0x81d341[_0xb671('0x7b')]||(_0x81d341['attrs']&&_0x81d341[_0xb671('0x5f')][0x0]?_0x81d341[_0xb671('0x5f')][0x0][_0xb671('0x47')]:undefined)||null,'value':_0x81d341[_0xb671('0x7a')]||(_0x81d341[_0xb671('0x5f')]&&_0x81d341[_0xb671('0x5f')][0x0]?_0x81d341[_0xb671('0x5f')][0x0][_0xb671('0x60')]:undefined)||null},{'name':'attrRefresh','value':_0x81d341[_0xb671('0x7c')]||(_0x81d341[_0xb671('0x5f')]&&_0x81d341[_0xb671('0x5f')][0x1]?_0x81d341['attrs'][0x1][_0xb671('0x60')]:undefined)||0x0}];default:return[];}}catch(_0x488aff){logger[_0xb671('0x30')](_0xb671('0x7d'),JSON[_0xb671('0x7e')](_0x488aff));return[];}}exports[_0xb671('0x7f')]=function(_0x4d5afc,_0x493c31,_0x451d9e){if(_0x4d5afc[_0xb671('0x52')]['id']){delete _0x4d5afc[_0xb671('0x52')]['id'];}return db[_0xb671('0x35')][_0xb671('0x50')]({'where':{'id':_0x4d5afc[_0xb671('0x59')]['id']}})[_0xb671('0x2b')](handleEntityNotFound(_0x493c31,null))[_0xb671('0x2b')](function(_0x51a392){if(_0x51a392){_0x4d5afc[_0xb671('0x52')][_0xb671('0x80')]=_0x51a392['id'];_0x4d5afc[_0xb671('0x52')]['attrs']=widgetAttributes(_0x4d5afc[_0xb671('0x52')]);return db[_0xb671('0x81')][_0xb671('0x51')](_0x4d5afc[_0xb671('0x52')]);}})['then'](respondWithResult(_0x493c31,null))[_0xb671('0x4e')](handleError(_0x493c31,null));};exports[_0xb671('0x82')]=function(_0x52db46,_0x301899,_0x12d359){var _0x43c8b2={};var _0x489fbf={};var _0x2428b8;var _0x536488;return db[_0xb671('0x35')][_0xb671('0x83')]({'where':{'id':_0x52db46['params']['id']}})[_0xb671('0x2b')](handleEntityNotFound(_0x301899,null))[_0xb671('0x2b')](function(_0x3a9c0f){if(_0x3a9c0f){_0x2428b8=_0x3a9c0f;_0x489fbf['model']=_[_0xb671('0x3b')](db['DashboardItem'][_0xb671('0x36')]);_0x489fbf[_0xb671('0x3a')]=_[_0xb671('0x3b')](_0x52db46[_0xb671('0x3a')]);_0x489fbf['filters']=_[_0xb671('0x3d')](_0x489fbf[_0xb671('0x38')],_0x489fbf[_0xb671('0x3a')]);_0x43c8b2['attributes']=_[_0xb671('0x3d')](_0x489fbf[_0xb671('0x38')],qs[_0xb671('0x3f')](_0x52db46[_0xb671('0x3a')][_0xb671('0x3f')]));_0x43c8b2[_0xb671('0x3e')]=_0x43c8b2[_0xb671('0x3e')][_0xb671('0x40')]?_0x43c8b2[_0xb671('0x3e')]:_0x489fbf[_0xb671('0x38')];_0x43c8b2['order']=qs[_0xb671('0x84')](_0x52db46[_0xb671('0x3a')][_0xb671('0x84')]);_0x43c8b2['where']=qs[_0xb671('0x3c')](_[_0xb671('0x85')](_0x52db46[_0xb671('0x3a')],_0x489fbf['filters']));if(_0x52db46[_0xb671('0x3a')]['filter']){_0x43c8b2[_0xb671('0x44')]=_[_0xb671('0x46')](_0x43c8b2[_0xb671('0x44')],{'$or':_['map'](_0x43c8b2[_0xb671('0x3e')],function(_0x3143bb){var _0x1e1970={};_0x1e1970[_0x3143bb]={'$like':'%'+_0x52db46[_0xb671('0x3a')][_0xb671('0x45')]+'%'};return _0x1e1970;})});}_0x43c8b2=_[_0xb671('0x46')]({},_0x43c8b2,_0x52db46[_0xb671('0x49')]);return _0x2428b8[_0xb671('0x82')](_0x43c8b2);}})[_0xb671('0x2b')](function(_0x2f8427){if(_0x2f8427){_0x536488=_0x2f8427[_0xb671('0x40')];if(!_0x52db46['query'][_0xb671('0x41')]('nolimit')){_0x43c8b2[_0xb671('0x23')]=qs['limit'](_0x52db46['query'][_0xb671('0x23')]);_0x43c8b2[_0xb671('0x21')]=qs[_0xb671('0x21')](_0x52db46['query'][_0xb671('0x21')]);}return _0x2428b8['getItems'](_0x43c8b2);}})[_0xb671('0x2b')](function(_0x4fc201){if(_0x4fc201){return _0x4fc201?{'count':_0x536488,'rows':_0x4fc201}:null;}})[_0xb671('0x2b')](respondWithResult(_0x301899,null))[_0xb671('0x4e')](handleError(_0x301899,null));}; \ No newline at end of file +var _0x0b73=['rimraf','zip-dir','fast-json-patch','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','socket.io-emitter','./dashboard.socket','end','json','offset','undefined','count','limit','status','Content-Range','apply','reject','save','update','destroy','get','CustomDashboards','UserProfileResource','then','sendStatus','error','name','send','index','map','Dashboard','fieldName','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','includeAll','findAll','rows','catch','show','params','keys','rawAttributes','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','include','createdAt','omit','updatedAt','role','iframe','attrUrl','attrs','https://','custom','attrPath','value','attrHourFormat','attrTimezone','0.00','attrFontSize','attrMetric','total','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','attrSerie1','attrSerie2','attrSerie3','attrVoiceQueues','attrOpenchannelAccounts','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','DashboardId','DashboardItem','getItems','findOne','filters','nolimit','eml-format'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0b73,0xff));var _0x30b7=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0x0b73[_0x5f309e];return _0x487b5e;};'use strict';var emlformat=require(_0x30b7('0x0'));var rimraf=require(_0x30b7('0x1'));var zipdir=require(_0x30b7('0x2'));var jsonpatch=require(_0x30b7('0x3'));var rp=require('request-promise');var moment=require(_0x30b7('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x30b7('0x5'));var util=require('util');var path=require('path');var sox=require(_0x30b7('0x6'));var csv=require(_0x30b7('0x7'));var ejs=require(_0x30b7('0x8'));var fs=require('fs');var fs_extra=require(_0x30b7('0x9'));var _=require(_0x30b7('0xa'));var squel=require(_0x30b7('0xb'));var crypto=require(_0x30b7('0xc'));var jsforce=require(_0x30b7('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x30b7('0x7'));var querystring=require(_0x30b7('0xe'));var Papa=require(_0x30b7('0xf'));var Redis=require(_0x30b7('0x10'));var authService=require(_0x30b7('0x11'));var qs=require(_0x30b7('0x12'));var as=require(_0x30b7('0x13'));var hardwareService=require(_0x30b7('0x14'));var logger=require(_0x30b7('0x15'))('api');var utils=require(_0x30b7('0x16'));var config=require(_0x30b7('0x17'));var licenseUtil=require(_0x30b7('0x18'));var db=require('../../mysqldb')['db'];config[_0x30b7('0x19')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x30b7('0x1a'))(new Redis(config['redis']));require(_0x30b7('0x1b'))['register'](socket);function respondWithStatusCode(_0x31fa25,_0x130038){_0x130038=_0x130038||0xcc;return function(_0x212703){if(_0x212703){return _0x31fa25['sendStatus'](_0x130038);}return _0x31fa25['status'](_0x130038)[_0x30b7('0x1c')]();};}function respondWithResult(_0x3aecf3,_0x12cdaf){_0x12cdaf=_0x12cdaf||0xc8;return function(_0x234053){if(_0x234053){return _0x3aecf3['status'](_0x12cdaf)[_0x30b7('0x1d')](_0x234053);}};}function respondWithFilteredResult(_0x100dba,_0x2f64fe){return function(_0x2e366b){if(_0x2e366b){var _0x5918c0=typeof _0x2f64fe[_0x30b7('0x1e')]===_0x30b7('0x1f')&&typeof _0x2f64fe['limit']===_0x30b7('0x1f');var _0x3cc07a=_0x2e366b[_0x30b7('0x20')];var _0x23a378=_0x5918c0?0x0:_0x2f64fe[_0x30b7('0x1e')];var _0x252b85=_0x5918c0?_0x2e366b['count']:_0x2f64fe[_0x30b7('0x1e')]+_0x2f64fe[_0x30b7('0x21')];var _0x358469;if(_0x252b85>=_0x3cc07a){_0x252b85=_0x3cc07a;_0x358469=0xc8;}else{_0x358469=0xce;}_0x100dba[_0x30b7('0x22')](_0x358469);return _0x100dba['set'](_0x30b7('0x23'),_0x23a378+'-'+_0x252b85+'/'+_0x3cc07a)[_0x30b7('0x1d')](_0x2e366b);}return null;};}function patchUpdates(_0x29b37f){return function(_0x1976e2){try{jsonpatch[_0x30b7('0x24')](_0x1976e2,_0x29b37f,!![]);}catch(_0x235c4c){return BPromise[_0x30b7('0x25')](_0x235c4c);}return _0x1976e2[_0x30b7('0x26')]();};}function saveUpdates(_0x5c9663,_0x1cf736){return function(_0x515c0d){if(_0x515c0d){return _0x515c0d[_0x30b7('0x27')](_0x5c9663)['then'](function(_0x1700ed){return _0x1700ed;});}return null;};}function removeEntity(_0x376c4a,_0x389de0){return function(_0x180b60){if(_0x180b60){return _0x180b60[_0x30b7('0x28')]()['then'](function(){var _0x35562c=_0x180b60[_0x30b7('0x29')]({'plain':!![]});var _0x4e7c07=_0x30b7('0x2a');return db[_0x30b7('0x2b')]['destroy']({'where':{'type':_0x4e7c07,'resourceId':_0x35562c['id']}})[_0x30b7('0x2c')](function(){return _0x180b60;});})[_0x30b7('0x2c')](function(){_0x376c4a[_0x30b7('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4cbdf5,_0x1e3258){return function(_0x44f4bc){if(!_0x44f4bc){_0x4cbdf5[_0x30b7('0x2d')](0x194);}return _0x44f4bc;};}function handleError(_0x9372a0,_0x17b72b){_0x17b72b=_0x17b72b||0x1f4;return function(_0x1325e3){logger[_0x30b7('0x2e')](_0x1325e3['stack']);if(_0x1325e3['name']){delete _0x1325e3[_0x30b7('0x2f')];}_0x9372a0[_0x30b7('0x22')](_0x17b72b)[_0x30b7('0x30')](_0x1325e3);};}exports[_0x30b7('0x31')]=function(_0x346a40,_0x4e9bd0){var _0x38cc83={},_0x2fde6d={},_0x24a2b5={'count':0x0,'rows':[]};var _0x5ec1c2=_[_0x30b7('0x32')](db[_0x30b7('0x33')]['rawAttributes'],function(_0x57ddf7){return{'name':_0x57ddf7[_0x30b7('0x34')],'type':_0x57ddf7[_0x30b7('0x35')][_0x30b7('0x36')]};});_0x2fde6d[_0x30b7('0x37')]=_[_0x30b7('0x32')](_0x5ec1c2,'name');_0x2fde6d[_0x30b7('0x38')]=_['keys'](_0x346a40['query']);_0x2fde6d['filters']=_[_0x30b7('0x39')](_0x2fde6d[_0x30b7('0x37')],_0x2fde6d['query']);_0x38cc83['attributes']=_[_0x30b7('0x39')](_0x2fde6d[_0x30b7('0x37')],qs[_0x30b7('0x3a')](_0x346a40[_0x30b7('0x38')][_0x30b7('0x3a')]));_0x38cc83[_0x30b7('0x3b')]=_0x38cc83['attributes'][_0x30b7('0x3c')]?_0x38cc83['attributes']:_0x2fde6d[_0x30b7('0x37')];if(!_0x346a40['query'][_0x30b7('0x3d')]('nolimit')){_0x38cc83[_0x30b7('0x21')]=qs[_0x30b7('0x21')](_0x346a40[_0x30b7('0x38')][_0x30b7('0x21')]);_0x38cc83[_0x30b7('0x1e')]=qs[_0x30b7('0x1e')](_0x346a40[_0x30b7('0x38')]['offset']);}_0x38cc83[_0x30b7('0x3e')]=qs['sort'](_0x346a40[_0x30b7('0x38')][_0x30b7('0x3f')]);_0x38cc83[_0x30b7('0x40')]=qs['filters'](_[_0x30b7('0x41')](_0x346a40[_0x30b7('0x38')],_0x2fde6d['filters']),_0x5ec1c2);if(_0x346a40[_0x30b7('0x38')]['filter']){_0x38cc83[_0x30b7('0x40')]=_['merge'](_0x38cc83[_0x30b7('0x40')],{'$or':_['map'](_0x5ec1c2,function(_0x385dbe){if(_0x385dbe[_0x30b7('0x35')]!=='VIRTUAL'){var _0x4104d9={};_0x4104d9[_0x385dbe['name']]={'$like':'%'+_0x346a40[_0x30b7('0x38')][_0x30b7('0x42')]+'%'};return _0x4104d9;}})});}_0x38cc83=_[_0x30b7('0x43')]({},_0x38cc83,_0x346a40['options']);var _0x2095a5={'where':_0x38cc83['where']};return db[_0x30b7('0x33')][_0x30b7('0x20')](_0x2095a5)['then'](function(_0x4ade8b){_0x24a2b5[_0x30b7('0x20')]=_0x4ade8b;if(_0x346a40['query'][_0x30b7('0x44')]){_0x38cc83['include']=[{'all':!![]}];}return db[_0x30b7('0x33')][_0x30b7('0x45')](_0x38cc83);})['then'](function(_0x79b2ac){_0x24a2b5[_0x30b7('0x46')]=_0x79b2ac;return _0x24a2b5;})['then'](respondWithFilteredResult(_0x4e9bd0,_0x38cc83))[_0x30b7('0x47')](handleError(_0x4e9bd0,null));};exports[_0x30b7('0x48')]=function(_0x1cdc22,_0x29e5a2){var _0x3e4c67={'raw':![],'where':{'id':_0x1cdc22[_0x30b7('0x49')]['id']}},_0x2f7ebd={};_0x2f7ebd[_0x30b7('0x37')]=_[_0x30b7('0x4a')](db[_0x30b7('0x33')][_0x30b7('0x4b')]);_0x2f7ebd[_0x30b7('0x38')]=_[_0x30b7('0x4a')](_0x1cdc22[_0x30b7('0x38')]);_0x2f7ebd['filters']=_[_0x30b7('0x39')](_0x2f7ebd[_0x30b7('0x37')],_0x2f7ebd[_0x30b7('0x38')]);_0x3e4c67[_0x30b7('0x3b')]=_[_0x30b7('0x39')](_0x2f7ebd[_0x30b7('0x37')],qs[_0x30b7('0x3a')](_0x1cdc22[_0x30b7('0x38')][_0x30b7('0x3a')]));_0x3e4c67['attributes']=_0x3e4c67[_0x30b7('0x3b')][_0x30b7('0x3c')]?_0x3e4c67[_0x30b7('0x3b')]:_0x2f7ebd[_0x30b7('0x37')];if(_0x1cdc22['query']['includeAll']){_0x3e4c67['include']=[{'all':!![]}];}_0x3e4c67=_[_0x30b7('0x43')]({},_0x3e4c67,_0x1cdc22[_0x30b7('0x4c')]);return db[_0x30b7('0x33')][_0x30b7('0x4d')](_0x3e4c67)[_0x30b7('0x2c')](handleEntityNotFound(_0x29e5a2,null))['then'](respondWithResult(_0x29e5a2,null))[_0x30b7('0x47')](handleError(_0x29e5a2,null));};exports['create']=function(_0xab52ed,_0x12f054){return db[_0x30b7('0x33')][_0x30b7('0x4e')](_0xab52ed[_0x30b7('0x4f')],{})[_0x30b7('0x2c')](function(_0x50239a){var _0x1a1821=_0xab52ed[_0x30b7('0x50')]['get']({'plain':!![]});if(!_0x1a1821)throw new Error(_0x30b7('0x51'));if(_0x1a1821['role']===_0x30b7('0x50')){var _0x202273=_0x50239a[_0x30b7('0x29')]({'plain':!![]});var _0x44e4f1=_0x30b7('0x2a');return db[_0x30b7('0x52')][_0x30b7('0x4d')]({'where':{'name':_0x44e4f1,'userProfileId':_0x1a1821[_0x30b7('0x53')]},'raw':!![]})['then'](function(_0xb75900){if(_0xb75900&&_0xb75900[_0x30b7('0x54')]===0x0){return db[_0x30b7('0x2b')][_0x30b7('0x4e')]({'name':_0x202273[_0x30b7('0x2f')],'resourceId':_0x202273['id'],'type':_0xb75900['name'],'sectionId':_0xb75900['id']},{})[_0x30b7('0x2c')](function(){return _0x50239a;});}else{return _0x50239a;}})['catch'](function(_0x1e712a){logger['error'](_0x30b7('0x55'),_0x1e712a);throw _0x1e712a;});}return _0x50239a;})[_0x30b7('0x2c')](respondWithResult(_0x12f054,0xc9))[_0x30b7('0x47')](handleError(_0x12f054,null));};exports['clone']=function(_0x5aed85,_0x517fca){var _0x29c7dc={'where':{'id':_0x5aed85[_0x30b7('0x49')]['id']}},_0x29cc7f={};_0x29cc7f['model']=_[_0x30b7('0x4a')](db[_0x30b7('0x33')]['rawAttributes']);_0x29c7dc[_0x30b7('0x3b')]=_['intersection'](_0x29cc7f[_0x30b7('0x37')],qs[_0x30b7('0x3a')](_0x5aed85[_0x30b7('0x38')][_0x30b7('0x3a')]));_0x29c7dc['attributes']=_0x29c7dc[_0x30b7('0x3b')][_0x30b7('0x3c')]?_0x29c7dc[_0x30b7('0x3b')]:_0x29cc7f[_0x30b7('0x37')];if(_0x5aed85[_0x30b7('0x38')][_0x30b7('0x44')]){_0x29c7dc[_0x30b7('0x56')]=[{'all':!![]}];}_0x29c7dc=_[_0x30b7('0x43')]({},_0x29c7dc,_0x5aed85[_0x30b7('0x4c')]);return db[_0x30b7('0x33')]['find'](_0x29c7dc)[_0x30b7('0x2c')](handleEntityNotFound(_0x517fca,null))[_0x30b7('0x2c')](function(_0x51d47f){if(_0x51d47f){var _0x4a8933=_0x51d47f[_0x30b7('0x29')]({'plain':!![]});_0x4a8933=qs['omit'](_0x4a8933,['id',_0x30b7('0x57'),'updatedAt']);_0x5aed85[_0x30b7('0x4f')]=_[_0x30b7('0x58')](_0x5aed85[_0x30b7('0x4f')],['id','createdAt',_0x30b7('0x59')]);return db[_0x30b7('0x33')][_0x30b7('0x4e')](_[_0x30b7('0x43')](_0x4a8933,_0x5aed85[_0x30b7('0x4f')]),{'include':_0x5aed85[_0x30b7('0x38')][_0x30b7('0x44')]?[{'all':!![]}]:undefined})[_0x30b7('0x2c')](function(_0x480e7d){var _0x27f1d8=_0x5aed85[_0x30b7('0x50')][_0x30b7('0x29')]({'plain':!![]});if(!_0x27f1d8)throw new Error(_0x30b7('0x51'));if(_0x27f1d8[_0x30b7('0x5a')]===_0x30b7('0x50')){var _0x3bca5a=_0x480e7d[_0x30b7('0x29')]({'plain':!![]});var _0x26d410=_0x30b7('0x2a');return db[_0x30b7('0x52')][_0x30b7('0x4d')]({'where':{'name':_0x26d410,'userProfileId':_0x27f1d8[_0x30b7('0x53')]},'raw':!![]})[_0x30b7('0x2c')](function(_0x383c3d){if(_0x383c3d&&_0x383c3d[_0x30b7('0x54')]===0x0){return db[_0x30b7('0x2b')][_0x30b7('0x4e')]({'name':_0x3bca5a[_0x30b7('0x2f')],'resourceId':_0x3bca5a['id'],'type':_0x383c3d['name'],'sectionId':_0x383c3d['id']},{})[_0x30b7('0x2c')](function(){return _0x480e7d;});}else{return _0x480e7d;}})[_0x30b7('0x47')](function(_0x3a9d25){logger[_0x30b7('0x2e')](_0x30b7('0x55'),_0x3a9d25);throw _0x3a9d25;});}return _0x480e7d;});}})[_0x30b7('0x2c')](respondWithResult(_0x517fca,0xc9))[_0x30b7('0x47')](handleError(_0x517fca,null));};exports['update']=function(_0x565b95,_0x3d96eb){if(_0x565b95[_0x30b7('0x4f')]['id']){delete _0x565b95[_0x30b7('0x4f')]['id'];}return db[_0x30b7('0x33')]['find']({'where':{'id':_0x565b95[_0x30b7('0x49')]['id']}})[_0x30b7('0x2c')](handleEntityNotFound(_0x3d96eb,null))[_0x30b7('0x2c')](saveUpdates(_0x565b95['body'],null))['then'](respondWithResult(_0x3d96eb,null))['catch'](handleError(_0x3d96eb,null));};exports[_0x30b7('0x28')]=function(_0x4445bd,_0x55a172){return db['Dashboard']['find']({'where':{'id':_0x4445bd[_0x30b7('0x49')]['id']}})[_0x30b7('0x2c')](handleEntityNotFound(_0x55a172,null))['then'](removeEntity(_0x55a172,null))[_0x30b7('0x47')](handleError(_0x55a172,null));};function widgetAttributes(_0x1e9ced){try{switch(_0x1e9ced[_0x30b7('0x35')]){case _0x30b7('0x5b'):return[{'name':_0x30b7('0x5c'),'value':_0x1e9ced[_0x30b7('0x5c')]||(_0x1e9ced[_0x30b7('0x5d')]&&_0x1e9ced[_0x30b7('0x5d')][0x0]?_0x1e9ced[_0x30b7('0x5d')][0x0]['value']:undefined)||_0x30b7('0x5e')}];case _0x30b7('0x5f'):return[{'name':_0x30b7('0x60'),'value':_0x1e9ced[_0x30b7('0x60')]||(_0x1e9ced['attrs']&&_0x1e9ced[_0x30b7('0x5d')][0x0]?_0x1e9ced[_0x30b7('0x5d')][0x0][_0x30b7('0x61')]:undefined)||''}];case'clock':return[{'name':'attrHourFormat','value':_0x1e9ced[_0x30b7('0x62')]||(_0x1e9ced[_0x30b7('0x5d')]&&_0x1e9ced['attrs'][0x0]?_0x1e9ced['attrs'][0x0][_0x30b7('0x61')]:undefined)||'HH:mm:ss'},{'name':_0x30b7('0x63'),'value':_0x1e9ced[_0x30b7('0x63')]||(_0x1e9ced[_0x30b7('0x5d')]&&_0x1e9ced[_0x30b7('0x5d')][0x1]?_0x1e9ced[_0x30b7('0x5d')][0x1][_0x30b7('0x61')]:undefined)||_0x30b7('0x64')},{'name':_0x30b7('0x65'),'value':_0x1e9ced[_0x30b7('0x65')]||(_0x1e9ced[_0x30b7('0x5d')]&&_0x1e9ced['attrs'][0x2]?_0x1e9ced['attrs'][0x2]['value']:undefined)||0xc}];case'counter':return[{'name':_0x30b7('0x66'),'value':_0x1e9ced[_0x30b7('0x66')]||(_0x1e9ced[_0x30b7('0x5d')]&&_0x1e9ced[_0x30b7('0x5d')][0x0]?_0x1e9ced['attrs'][0x0][_0x30b7('0x61')]:undefined)||_0x30b7('0x67')},{'name':'attrVoiceQueues','value':_0x1e9ced['attrVoiceQueues']||(_0x1e9ced[_0x30b7('0x5d')]&&_0x1e9ced['attrs'][0x1]?_0x1e9ced[_0x30b7('0x5d')][0x1][_0x30b7('0x61')]:undefined)||[]},{'name':_0x30b7('0x65'),'value':_0x1e9ced[_0x30b7('0x65')]||(_0x1e9ced['attrs']&&_0x1e9ced[_0x30b7('0x5d')][0x2]?_0x1e9ced['attrs'][0x2][_0x30b7('0x61')]:undefined)||0x14},{'name':_0x30b7('0x68'),'value':_0x1e9ced[_0x30b7('0x68')]||(_0x1e9ced[_0x30b7('0x5d')]&&_0x1e9ced[_0x30b7('0x5d')][0x3]?_0x1e9ced[_0x30b7('0x5d')][0x3]['value']:undefined)||'voice'},{'name':'attrEmailAccounts','value':_0x1e9ced[_0x30b7('0x69')]||(_0x1e9ced[_0x30b7('0x5d')]&&_0x1e9ced[_0x30b7('0x5d')][0x4]?_0x1e9ced[_0x30b7('0x5d')][0x4][_0x30b7('0x61')]:undefined)||''},{'name':_0x30b7('0x6a'),'value':_0x1e9ced[_0x30b7('0x6a')]||(_0x1e9ced[_0x30b7('0x5d')]&&_0x1e9ced[_0x30b7('0x5d')][0x5]?_0x1e9ced[_0x30b7('0x5d')][0x5][_0x30b7('0x61')]:undefined)||''},{'name':_0x30b7('0x6b'),'value':_0x1e9ced[_0x30b7('0x6b')]||(_0x1e9ced[_0x30b7('0x5d')]&&_0x1e9ced[_0x30b7('0x5d')][0x6]?_0x1e9ced[_0x30b7('0x5d')][0x6][_0x30b7('0x61')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x1e9ced['attrOpenchannelAccounts']||(_0x1e9ced[_0x30b7('0x5d')]&&_0x1e9ced['attrs'][0x7]?_0x1e9ced[_0x30b7('0x5d')][0x7][_0x30b7('0x61')]:undefined)||''},{'name':_0x30b7('0x6c'),'value':_0x1e9ced[_0x30b7('0x6c')]||(_0x1e9ced['attrs']&&_0x1e9ced['attrs'][0x8]?_0x1e9ced[_0x30b7('0x5d')][0x8]['value']:undefined)||''},{'name':_0x30b7('0x6d'),'value':_0x1e9ced['attrChatWebsites']||(_0x1e9ced[_0x30b7('0x5d')]&&_0x1e9ced[_0x30b7('0x5d')][0x9]?_0x1e9ced[_0x30b7('0x5d')][0x9][_0x30b7('0x61')]:undefined)||''}];case _0x30b7('0x6e'):case'pie-chart':return[{'name':'attrSerie1','value':_0x1e9ced[_0x30b7('0x6f')]||(_0x1e9ced['attrs']&&_0x1e9ced[_0x30b7('0x5d')][0x0]?_0x1e9ced[_0x30b7('0x5d')][0x0][_0x30b7('0x61')]:undefined)||_0x30b7('0x67')},{'name':'attrSerie2','value':_0x1e9ced[_0x30b7('0x70')]||(_0x1e9ced[_0x30b7('0x5d')]&&_0x1e9ced[_0x30b7('0x5d')][0x1]?_0x1e9ced[_0x30b7('0x5d')][0x1][_0x30b7('0x61')]:undefined)||null},{'name':_0x30b7('0x71'),'value':_0x1e9ced['attrSerie3']||(_0x1e9ced[_0x30b7('0x5d')]&&_0x1e9ced[_0x30b7('0x5d')][0x2]?_0x1e9ced[_0x30b7('0x5d')][0x2]['value']:undefined)||null},{'name':_0x30b7('0x72'),'value':_0x1e9ced[_0x30b7('0x72')]||(_0x1e9ced['attrs']&&_0x1e9ced[_0x30b7('0x5d')][0x3]?_0x1e9ced[_0x30b7('0x5d')][0x3][_0x30b7('0x61')]:undefined)||[]},{'name':_0x30b7('0x68'),'value':_0x1e9ced['attrChannel']||(_0x1e9ced[_0x30b7('0x5d')]&&_0x1e9ced[_0x30b7('0x5d')][0x4]?_0x1e9ced[_0x30b7('0x5d')][0x4][_0x30b7('0x61')]:undefined)||'voice'},{'name':_0x30b7('0x69'),'value':_0x1e9ced[_0x30b7('0x69')]||(_0x1e9ced[_0x30b7('0x5d')]&&_0x1e9ced[_0x30b7('0x5d')][0x5]?_0x1e9ced[_0x30b7('0x5d')][0x5][_0x30b7('0x61')]:undefined)||''},{'name':_0x30b7('0x6a'),'value':_0x1e9ced['attrFaxAccounts']||(_0x1e9ced[_0x30b7('0x5d')]&&_0x1e9ced['attrs'][0x6]?_0x1e9ced[_0x30b7('0x5d')][0x6][_0x30b7('0x61')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x1e9ced[_0x30b7('0x6b')]||(_0x1e9ced[_0x30b7('0x5d')]&&_0x1e9ced['attrs'][0x7]?_0x1e9ced[_0x30b7('0x5d')][0x7][_0x30b7('0x61')]:undefined)||''},{'name':_0x30b7('0x73'),'value':_0x1e9ced[_0x30b7('0x73')]||(_0x1e9ced['attrs']&&_0x1e9ced[_0x30b7('0x5d')][0x8]?_0x1e9ced[_0x30b7('0x5d')][0x8][_0x30b7('0x61')]:undefined)||''},{'name':_0x30b7('0x6c'),'value':_0x1e9ced[_0x30b7('0x6c')]||(_0x1e9ced[_0x30b7('0x5d')]&&_0x1e9ced[_0x30b7('0x5d')][0x9]?_0x1e9ced[_0x30b7('0x5d')][0x9][_0x30b7('0x61')]:undefined)||''},{'name':_0x30b7('0x6d'),'value':_0x1e9ced[_0x30b7('0x6d')]||(_0x1e9ced[_0x30b7('0x5d')]&&_0x1e9ced[_0x30b7('0x5d')][0xa]?_0x1e9ced[_0x30b7('0x5d')][0xa][_0x30b7('0x61')]:undefined)||''}];case _0x30b7('0x74'):return[{'name':_0x30b7('0x75'),'type':_0x1e9ced[_0x30b7('0x76')]||(_0x1e9ced[_0x30b7('0x5d')]&&_0x1e9ced[_0x30b7('0x5d')][0x0]?_0x1e9ced[_0x30b7('0x5d')][0x0]['type']:undefined)||null,'value':_0x1e9ced[_0x30b7('0x75')]||(_0x1e9ced[_0x30b7('0x5d')]&&_0x1e9ced[_0x30b7('0x5d')][0x0]?_0x1e9ced[_0x30b7('0x5d')][0x0][_0x30b7('0x61')]:undefined)||null},{'name':_0x30b7('0x77'),'value':_0x1e9ced[_0x30b7('0x77')]||(_0x1e9ced['attrs']&&_0x1e9ced[_0x30b7('0x5d')][0x1]?_0x1e9ced['attrs'][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x38aff2){logger['error'](_0x30b7('0x78'),JSON[_0x30b7('0x79')](_0x38aff2));return[];}}exports['addItem']=function(_0x10ad4d,_0x22ce04,_0x1aef41){if(_0x10ad4d[_0x30b7('0x4f')]['id']){delete _0x10ad4d[_0x30b7('0x4f')]['id'];}return db[_0x30b7('0x33')][_0x30b7('0x4d')]({'where':{'id':_0x10ad4d['params']['id']}})[_0x30b7('0x2c')](handleEntityNotFound(_0x22ce04,null))[_0x30b7('0x2c')](function(_0x3da2b0){if(_0x3da2b0){_0x10ad4d['body'][_0x30b7('0x7a')]=_0x3da2b0['id'];_0x10ad4d[_0x30b7('0x4f')]['attrs']=widgetAttributes(_0x10ad4d[_0x30b7('0x4f')]);return db[_0x30b7('0x7b')][_0x30b7('0x4e')](_0x10ad4d[_0x30b7('0x4f')]);}})[_0x30b7('0x2c')](respondWithResult(_0x22ce04,null))['catch'](handleError(_0x22ce04,null));};exports[_0x30b7('0x7c')]=function(_0x187141,_0x28eeb3,_0x45ab2c){var _0x2c5790={};var _0x4e7c3e={};var _0x11bba1;var _0x3a188a;return db[_0x30b7('0x33')][_0x30b7('0x7d')]({'where':{'id':_0x187141[_0x30b7('0x49')]['id']}})[_0x30b7('0x2c')](handleEntityNotFound(_0x28eeb3,null))['then'](function(_0x3e2a76){if(_0x3e2a76){_0x11bba1=_0x3e2a76;_0x4e7c3e['model']=_[_0x30b7('0x4a')](db[_0x30b7('0x7b')][_0x30b7('0x4b')]);_0x4e7c3e[_0x30b7('0x38')]=_[_0x30b7('0x4a')](_0x187141[_0x30b7('0x38')]);_0x4e7c3e[_0x30b7('0x7e')]=_['intersection'](_0x4e7c3e['model'],_0x4e7c3e[_0x30b7('0x38')]);_0x2c5790[_0x30b7('0x3b')]=_[_0x30b7('0x39')](_0x4e7c3e[_0x30b7('0x37')],qs['fields'](_0x187141[_0x30b7('0x38')][_0x30b7('0x3a')]));_0x2c5790[_0x30b7('0x3b')]=_0x2c5790[_0x30b7('0x3b')][_0x30b7('0x3c')]?_0x2c5790['attributes']:_0x4e7c3e[_0x30b7('0x37')];_0x2c5790[_0x30b7('0x3e')]=qs[_0x30b7('0x3f')](_0x187141[_0x30b7('0x38')][_0x30b7('0x3f')]);_0x2c5790[_0x30b7('0x40')]=qs[_0x30b7('0x7e')](_[_0x30b7('0x41')](_0x187141[_0x30b7('0x38')],_0x4e7c3e[_0x30b7('0x7e')]));if(_0x187141[_0x30b7('0x38')][_0x30b7('0x42')]){_0x2c5790[_0x30b7('0x40')]=_['merge'](_0x2c5790[_0x30b7('0x40')],{'$or':_[_0x30b7('0x32')](_0x2c5790[_0x30b7('0x3b')],function(_0x568b76){var _0x22ee04={};_0x22ee04[_0x568b76]={'$like':'%'+_0x187141[_0x30b7('0x38')][_0x30b7('0x42')]+'%'};return _0x22ee04;})});}_0x2c5790=_[_0x30b7('0x43')]({},_0x2c5790,_0x187141[_0x30b7('0x4c')]);return _0x11bba1[_0x30b7('0x7c')](_0x2c5790);}})[_0x30b7('0x2c')](function(_0x14ba8c){if(_0x14ba8c){_0x3a188a=_0x14ba8c['length'];if(!_0x187141[_0x30b7('0x38')]['hasOwnProperty'](_0x30b7('0x7f'))){_0x2c5790[_0x30b7('0x21')]=qs[_0x30b7('0x21')](_0x187141[_0x30b7('0x38')][_0x30b7('0x21')]);_0x2c5790[_0x30b7('0x1e')]=qs[_0x30b7('0x1e')](_0x187141[_0x30b7('0x38')]['offset']);}return _0x11bba1[_0x30b7('0x7c')](_0x2c5790);}})[_0x30b7('0x2c')](function(_0x541853){if(_0x541853){return _0x541853?{'count':_0x3a188a,'rows':_0x541853}:null;}})['then'](respondWithResult(_0x28eeb3,null))[_0x30b7('0x47')](handleError(_0x28eeb3,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index c92edcb..d23bb2d 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 _0x7e1a=['setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x57e8a6,_0x4e54e3){var _0x17f9c6=function(_0x289871){while(--_0x289871){_0x57e8a6['push'](_0x57e8a6['shift']());}};_0x17f9c6(++_0x4e54e3);}(_0x7e1a,0x1b7));var _0xa7e1=function(_0x291e2d,_0x2bec7c){_0x291e2d=_0x291e2d-0x0;var _0x5a00a=_0x7e1a[_0x291e2d];return _0x5a00a;};'use strict';var EventEmitter=require(_0xa7e1('0x0'));var Dashboard=require('../../mysqldb')['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0xa7e1('0x1')](0x0);var events={'afterCreate':_0xa7e1('0x2'),'afterUpdate':_0xa7e1('0x3'),'afterDestroy':'remove'};function emitEvent(_0x5581cb){return function(_0x5af714,_0x4f5c96,_0x4e4aa2){DashboardEvents[_0xa7e1('0x4')](_0x5581cb+':'+_0x5af714['id'],_0x5af714);DashboardEvents[_0xa7e1('0x4')](_0x5581cb,_0x5af714);_0x4e4aa2(null);};}for(var e in events){if(events[_0xa7e1('0x5')](e)){var event=events[e];Dashboard[_0xa7e1('0x6')](e,emitEvent(event));}}module[_0xa7e1('0x7')]=DashboardEvents; \ No newline at end of file +var _0x9a43=['../../mysqldb','Dashboard','setMaxListeners','save','update','remove','emit','exports','events'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0x9a43,0x143));var _0x39a4=function(_0x101dce,_0x3b887c){_0x101dce=_0x101dce-0x0;var _0x5a92bb=_0x9a43[_0x101dce];return _0x5a92bb;};'use strict';var EventEmitter=require(_0x39a4('0x0'));var Dashboard=require(_0x39a4('0x1'))['db'][_0x39a4('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x39a4('0x3')](0x0);var events={'afterCreate':_0x39a4('0x4'),'afterUpdate':_0x39a4('0x5'),'afterDestroy':_0x39a4('0x6')};function emitEvent(_0x59cd6b){return function(_0x1f4dc0,_0x74b8c0,_0x252ba5){DashboardEvents[_0x39a4('0x7')](_0x59cd6b+':'+_0x1f4dc0['id'],_0x1f4dc0);DashboardEvents[_0x39a4('0x7')](_0x59cd6b,_0x1f4dc0);_0x252ba5(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module[_0x39a4('0x8')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 6d9d815..e78e751 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 _0xf330=['dashboards','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./dashboard.attributes','exports','define','Dashboard'];(function(_0x2440fe,_0x281a11){var _0x5cf734=function(_0x38e12b){while(--_0x38e12b){_0x2440fe['push'](_0x2440fe['shift']());}};_0x5cf734(++_0x281a11);}(_0xf330,0x160));var _0x0f33=function(_0x235619,_0x24f8a5){_0x235619=_0x235619-0x0;var _0x1e477e=_0xf330[_0x235619];return _0x1e477e;};'use strict';var _=require(_0x0f33('0x0'));var util=require(_0x0f33('0x1'));var logger=require(_0x0f33('0x2'))('api');var moment=require(_0x0f33('0x3'));var BPromise=require(_0x0f33('0x4'));var rp=require(_0x0f33('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0f33('0x6'));var config=require(_0x0f33('0x7'));var attributes=require(_0x0f33('0x8'));module[_0x0f33('0x9')]=function(_0x568a18,_0x470e19){return _0x568a18[_0x0f33('0xa')](_0x0f33('0xb'),attributes,{'tableName':_0x0f33('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x24ed=['define','Dashboard','dashboards','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./dashboard.attributes','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x24ed,0x1e4));var _0xd24e=function(_0x820d3d,_0x35eda9){_0x820d3d=_0x820d3d-0x0;var _0x31203c=_0x24ed[_0x820d3d];return _0x31203c;};'use strict';var _=require(_0xd24e('0x0'));var util=require('util');var logger=require(_0xd24e('0x1'))(_0xd24e('0x2'));var moment=require(_0xd24e('0x3'));var BPromise=require(_0xd24e('0x4'));var rp=require(_0xd24e('0x5'));var fs=require('fs');var path=require(_0xd24e('0x6'));var rimraf=require(_0xd24e('0x7'));var config=require('../../config/environment');var attributes=require(_0xd24e('0x8'));module[_0xd24e('0x9')]=function(_0x49a499,_0x3363f1){return _0x49a499[_0xd24e('0xa')](_0xd24e('0xb'),attributes,{'tableName':_0xd24e('0xc'),'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 3139de1..eb314cf 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 _0x27c8=['rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x27c8,0x190));var _0x827c=function(_0x5e6d99,_0x407f5d){_0x5e6d99=_0x5e6d99-0x0;var _0x4905ab=_0x27c8[_0x5e6d99];return _0x4905ab;};'use strict';var _=require(_0x827c('0x0'));var util=require(_0x827c('0x1'));var moment=require('moment');var BPromise=require(_0x827c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x827c('0x3'));var db=require(_0x827c('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x827c('0x5'));var config=require(_0x827c('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x827c('0x7')][_0x827c('0x8')]({'port':0x232a});config[_0x827c('0x9')]=_[_0x827c('0xa')](config[_0x827c('0x9')],{'host':_0x827c('0xb'),'port':0x18eb});var socket=require(_0x827c('0xc'))(new Redis(config[_0x827c('0x9')]));require(_0x827c('0xd'))[_0x827c('0xe')](socket);function respondWithRpcPromise(_0x558691,_0x2756e4,_0x4890fa){return new BPromise(function(_0x188855,_0xab0c2f){return client[_0x827c('0xf')](_0x558691,_0x4890fa)[_0x827c('0x10')](function(_0x10f03f){logger[_0x827c('0x11')](_0x827c('0x12'),_0x2756e4,_0x827c('0x13'));logger[_0x827c('0x14')](_0x827c('0x15'),_0x2756e4,_0x827c('0x13'),JSON[_0x827c('0x16')](_0x10f03f));if(_0x10f03f['error']){if(_0x10f03f[_0x827c('0x17')]['code']===0x1f4){logger[_0x827c('0x17')](_0x827c('0x12'),_0x2756e4,_0x10f03f[_0x827c('0x17')]['message']);return _0xab0c2f(_0x10f03f[_0x827c('0x17')][_0x827c('0x18')]);}logger['error'](_0x827c('0x12'),_0x2756e4,_0x10f03f['error']['message']);return _0x188855(_0x10f03f[_0x827c('0x17')][_0x827c('0x18')]);}else{logger['info'](_0x827c('0x12'),_0x2756e4,'request\x20sent');_0x188855(_0x10f03f[_0x827c('0x19')][_0x827c('0x18')]);}})[_0x827c('0x1a')](function(_0x418763){logger[_0x827c('0x17')](_0x827c('0x12'),_0x2756e4,_0x418763);_0xab0c2f(_0x418763);});});} \ No newline at end of file +var _0x728d=['randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x25638c,_0x156685){var _0xa4016a=function(_0x436fb8){while(--_0x436fb8){_0x25638c['push'](_0x25638c['shift']());}};_0xa4016a(++_0x156685);}(_0x728d,0xf0));var _0xd728=function(_0x32f6b9,_0x2d4aa9){_0x32f6b9=_0x32f6b9-0x0;var _0x267d52=_0x728d[_0x32f6b9];return _0x267d52;};'use strict';var _=require(_0xd728('0x0'));var util=require(_0xd728('0x1'));var moment=require(_0xd728('0x2'));var BPromise=require('bluebird');var rs=require(_0xd728('0x3'));var fs=require('fs');var Redis=require(_0xd728('0x4'));var db=require(_0xd728('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd728('0x6'))('rpc');var config=require(_0xd728('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0xd728('0x8')]=_[_0xd728('0x9')](config[_0xd728('0x8')],{'host':_0xd728('0xa'),'port':0x18eb});var socket=require(_0xd728('0xb'))(new Redis(config[_0xd728('0x8')]));require(_0xd728('0xc'))[_0xd728('0xd')](socket);function respondWithRpcPromise(_0x417eb9,_0x1fa96c,_0x3f41ef){return new BPromise(function(_0x22f52d,_0xbbdd5a){return client[_0xd728('0xe')](_0x417eb9,_0x3f41ef)[_0xd728('0xf')](function(_0x1cfb7e){logger[_0xd728('0x10')](_0xd728('0x11'),_0x1fa96c,_0xd728('0x12'));logger[_0xd728('0x13')](_0xd728('0x14'),_0x1fa96c,_0xd728('0x12'),JSON[_0xd728('0x15')](_0x1cfb7e));if(_0x1cfb7e[_0xd728('0x16')]){if(_0x1cfb7e[_0xd728('0x16')][_0xd728('0x17')]===0x1f4){logger['error'](_0xd728('0x11'),_0x1fa96c,_0x1cfb7e[_0xd728('0x16')][_0xd728('0x18')]);return _0xbbdd5a(_0x1cfb7e[_0xd728('0x16')][_0xd728('0x18')]);}logger[_0xd728('0x16')](_0xd728('0x11'),_0x1fa96c,_0x1cfb7e[_0xd728('0x16')]['message']);return _0x22f52d(_0x1cfb7e[_0xd728('0x16')][_0xd728('0x18')]);}else{logger[_0xd728('0x10')]('Dashboard,\x20%s,\x20%s',_0x1fa96c,'request\x20sent');_0x22f52d(_0x1cfb7e[_0xd728('0x19')][_0xd728('0x18')]);}})[_0xd728('0x1a')](function(_0x3c5fec){logger[_0xd728('0x16')](_0xd728('0x11'),_0x1fa96c,_0x3c5fec);_0xbbdd5a(_0x3c5fec);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 68e03b7..f6c3493 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 _0xc90b=['dashboard:','./dashboard.events','save','remove','update','emit','removeListener','register','length'];(function(_0x5d2821,_0x557c59){var _0x7588b5=function(_0x5dc756){while(--_0x5dc756){_0x5d2821['push'](_0x5d2821['shift']());}};_0x7588b5(++_0x557c59);}(_0xc90b,0x1f0));var _0xbc90=function(_0x54fbf2,_0x262878){_0x54fbf2=_0x54fbf2-0x0;var _0x19426f=_0xc90b[_0x54fbf2];return _0x19426f;};'use strict';var DashboardEvents=require(_0xbc90('0x0'));var events=[_0xbc90('0x1'),_0xbc90('0x2'),_0xbc90('0x3')];function createListener(_0xb6b093,_0x583060){return function(_0x19f49d){_0x583060[_0xbc90('0x4')](_0xb6b093,_0x19f49d);};}function removeListener(_0x3d57e5,_0x37b9f6){return function(){DashboardEvents[_0xbc90('0x5')](_0x3d57e5,_0x37b9f6);};}exports[_0xbc90('0x6')]=function(_0x26fa6d){for(var _0x1ed2ec=0x0,_0x581c3b=events[_0xbc90('0x7')];_0x1ed2ec<_0x581c3b;_0x1ed2ec++){var _0x32524d=events[_0x1ed2ec];var _0x2d8575=createListener(_0xbc90('0x8')+_0x32524d,_0x26fa6d);DashboardEvents['on'](_0x32524d,_0x2d8575);}}; \ No newline at end of file +var _0x7c26=['register','length','remove','removeListener'];(function(_0x455bd2,_0x5b746f){var _0x25bdc8=function(_0x5b2647){while(--_0x5b2647){_0x455bd2['push'](_0x455bd2['shift']());}};_0x25bdc8(++_0x5b746f);}(_0x7c26,0xde));var _0x67c2=function(_0x313d24,_0x1a3221){_0x313d24=_0x313d24-0x0;var _0x3bef0d=_0x7c26[_0x313d24];return _0x3bef0d;};'use strict';var DashboardEvents=require('./dashboard.events');var events=['save',_0x67c2('0x0'),'update'];function createListener(_0x4b11ca,_0x136a6d){return function(_0x4fe3fc){_0x136a6d['emit'](_0x4b11ca,_0x4fe3fc);};}function removeListener(_0x44376a,_0x415833){return function(){DashboardEvents[_0x67c2('0x1')](_0x44376a,_0x415833);};}exports[_0x67c2('0x2')]=function(_0x5efbb8){for(var _0xead015=0x0,_0x519cb6=events[_0x67c2('0x3')];_0xead015<_0x519cb6;_0xead015++){var _0x3c16ea=events[_0xead015];var _0x5663e8=createListener('dashboard:'+_0x3c16ea,_0x5efbb8);DashboardEvents['on'](_0x3c16ea,_0x5663e8);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 0666f6e..305550e 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 _0xbc9e=['update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./dashboard.controller','get','index','/:id','show','/:id/items','getItems','post','isAuthenticated','create','clone','addItem'];(function(_0x4c2f20,_0x186fee){var _0x3e67c1=function(_0x443238){while(--_0x443238){_0x4c2f20['push'](_0x4c2f20['shift']());}};_0x3e67c1(++_0x186fee);}(_0xbc9e,0x8d));var _0xebc9=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0xbc9e[_0x2d2c16];return _0x53f2fb;};'use strict';var multer=require(_0xebc9('0x0'));var util=require(_0xebc9('0x1'));var path=require('path');var timeout=require(_0xebc9('0x2'));var express=require(_0xebc9('0x3'));var router=express[_0xebc9('0x4')]();var fs_extra=require(_0xebc9('0x5'));var auth=require(_0xebc9('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xebc9('0x7'));var controller=require(_0xebc9('0x8'));router[_0xebc9('0x9')]('/',auth['isAuthenticated'](),controller[_0xebc9('0xa')]);router[_0xebc9('0x9')](_0xebc9('0xb'),auth['isAuthenticated'](),controller[_0xebc9('0xc')]);router[_0xebc9('0x9')](_0xebc9('0xd'),auth['isAuthenticated'](),controller[_0xebc9('0xe')]);router[_0xebc9('0xf')]('/',auth[_0xebc9('0x10')](),controller[_0xebc9('0x11')]);router[_0xebc9('0xf')]('/:id/clone',auth[_0xebc9('0x10')](),controller[_0xebc9('0x12')]);router[_0xebc9('0xf')](_0xebc9('0xd'),auth[_0xebc9('0x10')](),controller[_0xebc9('0x13')]);router['put'](_0xebc9('0xb'),auth[_0xebc9('0x10')](),controller[_0xebc9('0x14')]);router[_0xebc9('0x15')](_0xebc9('0xb'),auth[_0xebc9('0x10')](),controller['destroy']);module[_0xebc9('0x16')]=router; \ No newline at end of file +var _0xf4a6=['get','/:id','isAuthenticated','show','/:id/items','getItems','create','post','addItem','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./dashboard.controller'];(function(_0x2211ed,_0x1bca0b){var _0x4d78cc=function(_0x467b59){while(--_0x467b59){_0x2211ed['push'](_0x2211ed['shift']());}};_0x4d78cc(++_0x1bca0b);}(_0xf4a6,0xf4));var _0x6f4a=function(_0x2d2b52,_0x49e61d){_0x2d2b52=_0x2d2b52-0x0;var _0x1421b1=_0xf4a6[_0x2d2b52];return _0x1421b1;};'use strict';var multer=require(_0x6f4a('0x0'));var util=require(_0x6f4a('0x1'));var path=require(_0x6f4a('0x2'));var timeout=require('connect-timeout');var express=require(_0x6f4a('0x3'));var router=express[_0x6f4a('0x4')]();var fs_extra=require(_0x6f4a('0x5'));var auth=require(_0x6f4a('0x6'));var interaction=require(_0x6f4a('0x7'));var config=require('../../config/environment');var controller=require(_0x6f4a('0x8'));router[_0x6f4a('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x6f4a('0xa'),auth[_0x6f4a('0xb')](),controller[_0x6f4a('0xc')]);router[_0x6f4a('0x9')](_0x6f4a('0xd'),auth['isAuthenticated'](),controller[_0x6f4a('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x6f4a('0xf')]);router[_0x6f4a('0x10')]('/:id/clone',auth[_0x6f4a('0xb')](),controller['clone']);router[_0x6f4a('0x10')](_0x6f4a('0xd'),auth[_0x6f4a('0xb')](),controller[_0x6f4a('0x11')]);router[_0x6f4a('0x12')]('/:id',auth[_0x6f4a('0xb')](),controller[_0x6f4a('0x13')]);router[_0x6f4a('0x14')](_0x6f4a('0xa'),auth['isAuthenticated'](),controller[_0x6f4a('0x15')]);module[_0x6f4a('0x16')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 96cb075..203055a 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 _0x2bd8=['TEXT','long','parse','attrs','stringify','setDataValue','INTEGER','sequelize','lodash','exports','STRING'];(function(_0x248403,_0x16fa23){var _0x50e997=function(_0x366bcb){while(--_0x366bcb){_0x248403['push'](_0x248403['shift']());}};_0x50e997(++_0x16fa23);}(_0x2bd8,0x130));var _0x82bd=function(_0x4c2b13,_0x5b2aab){_0x4c2b13=_0x4c2b13-0x0;var _0x43c477=_0x2bd8[_0x4c2b13];return _0x43c477;};'use strict';var Sequelize=require(_0x82bd('0x0'));var squel=require('squel');var _=require(_0x82bd('0x1'));module[_0x82bd('0x2')]={'title':{'type':Sequelize[_0x82bd('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x82bd('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x82bd('0x4')](_0x82bd('0x5')),'get':function(){try{return JSON[_0x82bd('0x6')](this['getDataValue'](_0x82bd('0x7')));}catch(_0x2e1a98){return[];}},'set':function(_0x3bf810){try{this['setDataValue'](_0x82bd('0x7'),JSON[_0x82bd('0x8')](_0x3bf810));}catch(_0x226f60){this[_0x82bd('0x9')]('attrs',JSON[_0x82bd('0x8')]([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize[_0x82bd('0xa')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x82bd('0x3')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']},'titleFontSize':{'type':Sequelize[_0x82bd('0xa')],'defaultValue':0xc}}; \ No newline at end of file +var _0x33af=['attrs','setDataValue','stringify','INTEGER','#ffffff','squel','exports','STRING','TEXT','long','parse'];(function(_0x48ebc0,_0x2e415b){var _0xc25077=function(_0x5d4f33){while(--_0x5d4f33){_0x48ebc0['push'](_0x48ebc0['shift']());}};_0xc25077(++_0x2e415b);}(_0x33af,0xec));var _0xf33a=function(_0x900a8d,_0x1f009a){_0x900a8d=_0x900a8d-0x0;var _0x5b80fc=_0x33af[_0x900a8d];return _0x5b80fc;};'use strict';var Sequelize=require('sequelize');var squel=require(_0xf33a('0x0'));var _=require('lodash');module[_0xf33a('0x1')]={'title':{'type':Sequelize[_0xf33a('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xf33a('0x2')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xf33a('0x3')](_0xf33a('0x4')),'get':function(){try{return JSON[_0xf33a('0x5')](this['getDataValue'](_0xf33a('0x6')));}catch(_0x44cfa5){return[];}},'set':function(_0x583e54){try{this[_0xf33a('0x7')](_0xf33a('0x6'),JSON[_0xf33a('0x8')](_0x583e54));}catch(_0x2f3730){this[_0xf33a('0x7')](_0xf33a('0x6'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0xf33a('0x9')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xf33a('0x9')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xf33a('0x9')]},'col':{'type':Sequelize[_0xf33a('0x9')]},'background':{'type':Sequelize[_0xf33a('0x2')],'allowNull':![],'defaultValue':_0xf33a('0xa'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xf33a('0x2')]},'titleFontSize':{'type':Sequelize[_0xf33a('0x9')],'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 f252887..3a5fde6 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 _0x254a=['attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','attrSmsAccounts','web-report','attrReport','reportType','attrRefresh','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','crypto','jsforce','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','defaults','redis','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','reject','save','update','then','destroy','error','stack','name','send','show','params','model','keys','DashboardItem','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','catch','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric'];(function(_0x3be7a7,_0x42cdd4){var _0xdf2d4e=function(_0x559da7){while(--_0x559da7){_0x3be7a7['push'](_0x3be7a7['shift']());}};_0xdf2d4e(++_0x42cdd4);}(_0x254a,0x138));var _0xa254=function(_0x4fba44,_0x10e53c){_0x4fba44=_0x4fba44-0x0;var _0x1b87ec=_0x254a[_0x4fba44];return _0x1b87ec;};'use strict';var emlformat=require(_0xa254('0x0'));var rimraf=require(_0xa254('0x1'));var zipdir=require(_0xa254('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa254('0x3'));var moment=require(_0xa254('0x4'));var BPromise=require(_0xa254('0x5'));var Mustache=require(_0xa254('0x6'));var util=require('util');var path=require(_0xa254('0x7'));var sox=require('sox');var csv=require(_0xa254('0x8'));var ejs=require(_0xa254('0x9'));var fs=require('fs');var fs_extra=require(_0xa254('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xa254('0xb'));var jsforce=require(_0xa254('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa254('0x8'));var querystring=require('querystring');var Papa=require(_0xa254('0xd'));var Redis=require(_0xa254('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa254('0xf'));var hardwareService=require(_0xa254('0x10'));var logger=require(_0xa254('0x11'))(_0xa254('0x12'));var utils=require(_0xa254('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xa254('0x14'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xa254('0x15')](config[_0xa254('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0xa254('0x17'))(new Redis(config[_0xa254('0x16')]));require(_0xa254('0x18'))[_0xa254('0x19')](socket);function respondWithStatusCode(_0x276480,_0x50cbb8){_0x50cbb8=_0x50cbb8||0xcc;return function(_0x217467){if(_0x217467){return _0x276480[_0xa254('0x1a')](_0x50cbb8);}return _0x276480[_0xa254('0x1b')](_0x50cbb8)[_0xa254('0x1c')]();};}function respondWithResult(_0x37586e,_0x341aea){_0x341aea=_0x341aea||0xc8;return function(_0x42af14){if(_0x42af14){return _0x37586e[_0xa254('0x1b')](_0x341aea)[_0xa254('0x1d')](_0x42af14);}};}function respondWithFilteredResult(_0x5b5de4,_0x547205){return function(_0x4a249f){if(_0x4a249f){var _0x34c9fe=typeof _0x547205[_0xa254('0x1e')]===_0xa254('0x1f')&&typeof _0x547205[_0xa254('0x20')]===_0xa254('0x1f');var _0x1b7773=_0x4a249f[_0xa254('0x21')];var _0x4d82f9=_0x34c9fe?0x0:_0x547205[_0xa254('0x1e')];var _0x521a34=_0x34c9fe?_0x4a249f[_0xa254('0x21')]:_0x547205[_0xa254('0x1e')]+_0x547205['limit'];var _0x3a1927;if(_0x521a34>=_0x1b7773){_0x521a34=_0x1b7773;_0x3a1927=0xc8;}else{_0x3a1927=0xce;}_0x5b5de4[_0xa254('0x1b')](_0x3a1927);return _0x5b5de4['set']('Content-Range',_0x4d82f9+'-'+_0x521a34+'/'+_0x1b7773)[_0xa254('0x1d')](_0x4a249f);}return null;};}function patchUpdates(_0xba5a72){return function(_0x317a82){try{jsonpatch['apply'](_0x317a82,_0xba5a72,!![]);}catch(_0x2ab840){return BPromise[_0xa254('0x22')](_0x2ab840);}return _0x317a82[_0xa254('0x23')]();};}function saveUpdates(_0x597291,_0x4bd012){return function(_0xe734d5){if(_0xe734d5){return _0xe734d5[_0xa254('0x24')](_0x597291)[_0xa254('0x25')](function(_0x413016){return _0x413016;});}return null;};}function removeEntity(_0x54356f,_0x3672c2){return function(_0xdd8c94){if(_0xdd8c94){return _0xdd8c94[_0xa254('0x26')]()[_0xa254('0x25')](function(){_0x54356f[_0xa254('0x1b')](0xcc)[_0xa254('0x1c')]();});}};}function handleEntityNotFound(_0x105bb0,_0xbdef22){return function(_0x336d55){if(!_0x336d55){_0x105bb0['sendStatus'](0x194);}return _0x336d55;};}function handleError(_0x32a595,_0x449167){_0x449167=_0x449167||0x1f4;return function(_0x1c9a9b){logger[_0xa254('0x27')](_0x1c9a9b[_0xa254('0x28')]);if(_0x1c9a9b['name']){delete _0x1c9a9b[_0xa254('0x29')];}_0x32a595[_0xa254('0x1b')](_0x449167)[_0xa254('0x2a')](_0x1c9a9b);};}exports[_0xa254('0x2b')]=function(_0x5c7836,_0x384224){var _0x3c8f5a={'raw':![],'where':{'id':_0x5c7836[_0xa254('0x2c')]['id']}},_0x22246b={};_0x22246b[_0xa254('0x2d')]=_[_0xa254('0x2e')](db[_0xa254('0x2f')][_0xa254('0x30')]);_0x22246b['query']=_[_0xa254('0x2e')](_0x5c7836[_0xa254('0x31')]);_0x22246b[_0xa254('0x32')]=_[_0xa254('0x33')](_0x22246b['model'],_0x22246b[_0xa254('0x31')]);_0x3c8f5a[_0xa254('0x34')]=_[_0xa254('0x33')](_0x22246b['model'],qs[_0xa254('0x35')](_0x5c7836[_0xa254('0x31')][_0xa254('0x35')]));_0x3c8f5a['attributes']=_0x3c8f5a[_0xa254('0x34')][_0xa254('0x36')]?_0x3c8f5a[_0xa254('0x34')]:_0x22246b[_0xa254('0x2d')];if(_0x5c7836[_0xa254('0x31')][_0xa254('0x37')]){_0x3c8f5a[_0xa254('0x38')]=[{'all':!![]}];}_0x3c8f5a=_[_0xa254('0x39')]({},_0x3c8f5a,_0x5c7836[_0xa254('0x3a')]);return db['DashboardItem']['find'](_0x3c8f5a)[_0xa254('0x25')](handleEntityNotFound(_0x384224,null))[_0xa254('0x25')](respondWithResult(_0x384224,null))['catch'](handleError(_0x384224,null));};exports[_0xa254('0x26')]=function(_0x49c956,_0x5d1cd0){return db[_0xa254('0x2f')][_0xa254('0x3b')]({'where':{'id':_0x49c956[_0xa254('0x2c')]['id']}})[_0xa254('0x25')](handleEntityNotFound(_0x5d1cd0,null))['then'](removeEntity(_0x5d1cd0,null))[_0xa254('0x3c')](handleError(_0x5d1cd0,null));};function widgetAttributes(_0xd97269){try{switch(_0xd97269[_0xa254('0x3d')]){case _0xa254('0x3e'):return[{'name':_0xa254('0x3f'),'value':_0xd97269[_0xa254('0x3f')]||(_0xd97269[_0xa254('0x40')]&&_0xd97269[_0xa254('0x40')][0x0]?_0xd97269[_0xa254('0x40')][0x0][_0xa254('0x41')]:undefined)||_0xa254('0x42')}];case _0xa254('0x43'):return[{'name':_0xa254('0x44'),'value':_0xd97269['attrPath']||(_0xd97269['attrs']&&_0xd97269[_0xa254('0x40')][0x0]?_0xd97269[_0xa254('0x40')][0x0]['value']:undefined)||''}];case'clock':return[{'name':_0xa254('0x45'),'value':_0xd97269[_0xa254('0x45')]||(_0xd97269[_0xa254('0x40')]&&_0xd97269[_0xa254('0x40')][0x0]?_0xd97269[_0xa254('0x40')][0x0][_0xa254('0x41')]:undefined)||_0xa254('0x46')},{'name':'attrTimezone','value':_0xd97269[_0xa254('0x47')]||(_0xd97269[_0xa254('0x40')]&&_0xd97269[_0xa254('0x40')][0x1]?_0xd97269[_0xa254('0x40')][0x1][_0xa254('0x41')]:undefined)||_0xa254('0x48')},{'name':'attrFontSize','value':_0xd97269[_0xa254('0x49')]||(_0xd97269[_0xa254('0x40')]&&_0xd97269[_0xa254('0x40')][0x2]?_0xd97269[_0xa254('0x40')][0x2][_0xa254('0x41')]:undefined)||0xc}];case _0xa254('0x4a'):return[{'name':_0xa254('0x4b'),'value':_0xd97269[_0xa254('0x4b')]||(_0xd97269[_0xa254('0x40')]&&_0xd97269[_0xa254('0x40')][0x0]?_0xd97269[_0xa254('0x40')][0x0]['value']:undefined)||'total'},{'name':_0xa254('0x4c'),'value':_0xd97269[_0xa254('0x4c')]||(_0xd97269[_0xa254('0x40')]&&_0xd97269['attrs'][0x1]?_0xd97269[_0xa254('0x40')][0x1]['value']:undefined)||[]},{'name':_0xa254('0x49'),'value':_0xd97269[_0xa254('0x49')]||(_0xd97269[_0xa254('0x40')]&&_0xd97269['attrs'][0x2]?_0xd97269[_0xa254('0x40')][0x2]['value']:undefined)||0x14},{'name':_0xa254('0x4d'),'value':_0xd97269[_0xa254('0x4d')]||(_0xd97269[_0xa254('0x40')]&&_0xd97269[_0xa254('0x40')][0x3]?_0xd97269[_0xa254('0x40')][0x3]['value']:undefined)||_0xa254('0x4e')},{'name':'attrEmailAccounts','value':_0xd97269[_0xa254('0x4f')]||(_0xd97269[_0xa254('0x40')]&&_0xd97269['attrs'][0x4]?_0xd97269[_0xa254('0x40')][0x4][_0xa254('0x41')]:undefined)||''},{'name':_0xa254('0x50'),'value':_0xd97269[_0xa254('0x50')]||(_0xd97269[_0xa254('0x40')]&&_0xd97269[_0xa254('0x40')][0x5]?_0xd97269[_0xa254('0x40')][0x5][_0xa254('0x41')]:undefined)||''},{'name':'attrSmsAccounts','value':_0xd97269['attrSmsAccounts']||(_0xd97269['attrs']&&_0xd97269[_0xa254('0x40')][0x6]?_0xd97269['attrs'][0x6][_0xa254('0x41')]:undefined)||''},{'name':_0xa254('0x51'),'value':_0xd97269['attrOpenchannelAccounts']||(_0xd97269[_0xa254('0x40')]&&_0xd97269['attrs'][0x7]?_0xd97269[_0xa254('0x40')][0x7][_0xa254('0x41')]:undefined)||''},{'name':_0xa254('0x52'),'value':_0xd97269[_0xa254('0x52')]||(_0xd97269[_0xa254('0x40')]&&_0xd97269[_0xa254('0x40')][0x8]?_0xd97269[_0xa254('0x40')][0x8][_0xa254('0x41')]:undefined)||''},{'name':_0xa254('0x53'),'value':_0xd97269[_0xa254('0x53')]||(_0xd97269[_0xa254('0x40')]&&_0xd97269['attrs'][0x9]?_0xd97269[_0xa254('0x40')][0x9][_0xa254('0x41')]:undefined)||''}];case _0xa254('0x54'):case _0xa254('0x55'):return[{'name':_0xa254('0x56'),'value':_0xd97269[_0xa254('0x56')]||(_0xd97269['attrs']&&_0xd97269[_0xa254('0x40')][0x0]?_0xd97269['attrs'][0x0]['value']:undefined)||_0xa254('0x57')},{'name':_0xa254('0x58'),'value':_0xd97269[_0xa254('0x58')]||(_0xd97269['attrs']&&_0xd97269[_0xa254('0x40')][0x1]?_0xd97269['attrs'][0x1][_0xa254('0x41')]:undefined)||null},{'name':_0xa254('0x59'),'value':_0xd97269[_0xa254('0x59')]||(_0xd97269[_0xa254('0x40')]&&_0xd97269[_0xa254('0x40')][0x2]?_0xd97269['attrs'][0x2][_0xa254('0x41')]:undefined)||null},{'name':_0xa254('0x4c'),'value':_0xd97269[_0xa254('0x4c')]||(_0xd97269[_0xa254('0x40')]&&_0xd97269[_0xa254('0x40')][0x3]?_0xd97269[_0xa254('0x40')][0x3][_0xa254('0x41')]:undefined)||[]},{'name':_0xa254('0x4d'),'value':_0xd97269['attrChannel']||(_0xd97269[_0xa254('0x40')]&&_0xd97269[_0xa254('0x40')][0x4]?_0xd97269['attrs'][0x4][_0xa254('0x41')]:undefined)||_0xa254('0x4e')},{'name':_0xa254('0x4f'),'value':_0xd97269['attrEmailAccounts']||(_0xd97269['attrs']&&_0xd97269[_0xa254('0x40')][0x5]?_0xd97269[_0xa254('0x40')][0x5][_0xa254('0x41')]:undefined)||''},{'name':_0xa254('0x50'),'value':_0xd97269['attrFaxAccounts']||(_0xd97269[_0xa254('0x40')]&&_0xd97269[_0xa254('0x40')][0x6]?_0xd97269[_0xa254('0x40')][0x6][_0xa254('0x41')]:undefined)||''},{'name':'attrSmsAccounts','value':_0xd97269[_0xa254('0x5a')]||(_0xd97269[_0xa254('0x40')]&&_0xd97269[_0xa254('0x40')][0x7]?_0xd97269['attrs'][0x7][_0xa254('0x41')]:undefined)||''},{'name':_0xa254('0x51'),'value':_0xd97269[_0xa254('0x51')]||(_0xd97269['attrs']&&_0xd97269[_0xa254('0x40')][0x8]?_0xd97269[_0xa254('0x40')][0x8][_0xa254('0x41')]:undefined)||''},{'name':_0xa254('0x52'),'value':_0xd97269[_0xa254('0x52')]||(_0xd97269['attrs']&&_0xd97269['attrs'][0x9]?_0xd97269[_0xa254('0x40')][0x9][_0xa254('0x41')]:undefined)||''},{'name':_0xa254('0x53'),'value':_0xd97269['attrChatWebsites']||(_0xd97269[_0xa254('0x40')]&&_0xd97269[_0xa254('0x40')][0xa]?_0xd97269['attrs'][0xa][_0xa254('0x41')]:undefined)||''}];case _0xa254('0x5b'):return[{'name':_0xa254('0x5c'),'type':_0xd97269[_0xa254('0x5d')]||(_0xd97269[_0xa254('0x40')]&&_0xd97269[_0xa254('0x40')][0x0]?_0xd97269[_0xa254('0x40')][0x0][_0xa254('0x3d')]:undefined)||null,'value':_0xd97269['attrReport']||(_0xd97269[_0xa254('0x40')]&&_0xd97269[_0xa254('0x40')][0x0]?_0xd97269['attrs'][0x0][_0xa254('0x41')]:undefined)||null},{'name':_0xa254('0x5e'),'value':_0xd97269[_0xa254('0x5e')]||(_0xd97269[_0xa254('0x40')]&&_0xd97269[_0xa254('0x40')][0x1]?_0xd97269[_0xa254('0x40')][0x1][_0xa254('0x41')]:undefined)||0x0}];default:return[];}}catch(_0x294d2b){logger[_0xa254('0x27')]('widgetAttributes:\x20%s',JSON['stringify'](_0x294d2b));return[];}}exports[_0xa254('0x5f')]=function(_0x50da2b,_0x30a58f){if(_0x50da2b[_0xa254('0x60')]){_0x50da2b['body'][_0xa254('0x40')]=widgetAttributes(_0x50da2b[_0xa254('0x60')]);}return db[_0xa254('0x2f')][_0xa254('0x5f')](_0x50da2b[_0xa254('0x60')],{})['then'](respondWithResult(_0x30a58f,0xc9))[_0xa254('0x3c')](handleError(_0x30a58f,null));};exports[_0xa254('0x24')]=function(_0x1ed280,_0x25a58f){if(_0x1ed280['body']['id']){delete _0x1ed280[_0xa254('0x60')]['id'];}_0x1ed280[_0xa254('0x60')][_0xa254('0x40')]=widgetAttributes(_0x1ed280['body']);return db[_0xa254('0x2f')][_0xa254('0x3b')]({'where':{'id':_0x1ed280[_0xa254('0x2c')]['id']}})['then'](handleEntityNotFound(_0x25a58f,null))['then'](saveUpdates(_0x1ed280[_0xa254('0x60')],null))[_0xa254('0x25')](respondWithResult(_0x25a58f,null))[_0xa254('0x3c')](handleError(_0x25a58f,null));}; \ No newline at end of file +var _0xe5e0=['../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','offset','undefined','limit','set','Content-Range','apply','save','update','then','destroy','end','error','name','send','show','params','model','keys','query','intersection','fields','attributes','length','includeAll','include','merge','options','DashboardItem','find','catch','type','iframe','attrUrl','attrs','value','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrWhatsappAccounts','attrChatWebsites','attrSerie1','total','attrSerie2','attrSerie3','attrOpenchannelAccounts','web-report','attrReport','body','create','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs'];(function(_0x760e41,_0x3c0b38){var _0xac848c=function(_0x37ac84){while(--_0x37ac84){_0x760e41['push'](_0x760e41['shift']());}};_0xac848c(++_0x3c0b38);}(_0xe5e0,0x1be));var _0x0e5e=function(_0x3c9257,_0x4d6655){_0x3c9257=_0x3c9257-0x0;var _0x91712a=_0xe5e0[_0x3c9257];return _0x91712a;};'use strict';var emlformat=require(_0x0e5e('0x0'));var rimraf=require(_0x0e5e('0x1'));var zipdir=require(_0x0e5e('0x2'));var jsonpatch=require(_0x0e5e('0x3'));var rp=require(_0x0e5e('0x4'));var moment=require(_0x0e5e('0x5'));var BPromise=require(_0x0e5e('0x6'));var Mustache=require(_0x0e5e('0x7'));var util=require(_0x0e5e('0x8'));var path=require('path');var sox=require(_0x0e5e('0x9'));var csv=require(_0x0e5e('0xa'));var ejs=require(_0x0e5e('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0e5e('0xc'));var squel=require(_0x0e5e('0xd'));var crypto=require(_0x0e5e('0xe'));var jsforce=require(_0x0e5e('0xf'));var deskjs=require(_0x0e5e('0x10'));var toCsv=require(_0x0e5e('0xa'));var querystring=require(_0x0e5e('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x0e5e('0x12'));var as=require(_0x0e5e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0e5e('0x14'));var utils=require(_0x0e5e('0x15'));var config=require(_0x0e5e('0x16'));var licenseUtil=require(_0x0e5e('0x17'));var db=require('../../mysqldb')['db'];config[_0x0e5e('0x18')]=_[_0x0e5e('0x19')](config['redis'],{'host':_0x0e5e('0x1a'),'port':0x18eb});var socket=require(_0x0e5e('0x1b'))(new Redis(config[_0x0e5e('0x18')]));require('./dashboardItem.socket')[_0x0e5e('0x1c')](socket);function respondWithStatusCode(_0x2353b3,_0x187d39){_0x187d39=_0x187d39||0xcc;return function(_0x3d13a0){if(_0x3d13a0){return _0x2353b3[_0x0e5e('0x1d')](_0x187d39);}return _0x2353b3[_0x0e5e('0x1e')](_0x187d39)['end']();};}function respondWithResult(_0x20a35f,_0x3e5104){_0x3e5104=_0x3e5104||0xc8;return function(_0x1ce55f){if(_0x1ce55f){return _0x20a35f[_0x0e5e('0x1e')](_0x3e5104)[_0x0e5e('0x1f')](_0x1ce55f);}};}function respondWithFilteredResult(_0x550dda,_0x11aef2){return function(_0x2efa7f){if(_0x2efa7f){var _0x4bfc60=typeof _0x11aef2[_0x0e5e('0x20')]===_0x0e5e('0x21')&&typeof _0x11aef2['limit']===_0x0e5e('0x21');var _0x3b80f8=_0x2efa7f['count'];var _0x422c08=_0x4bfc60?0x0:_0x11aef2[_0x0e5e('0x20')];var _0x3659d9=_0x4bfc60?_0x2efa7f['count']:_0x11aef2['offset']+_0x11aef2[_0x0e5e('0x22')];var _0x1b0588;if(_0x3659d9>=_0x3b80f8){_0x3659d9=_0x3b80f8;_0x1b0588=0xc8;}else{_0x1b0588=0xce;}_0x550dda[_0x0e5e('0x1e')](_0x1b0588);return _0x550dda[_0x0e5e('0x23')](_0x0e5e('0x24'),_0x422c08+'-'+_0x3659d9+'/'+_0x3b80f8)[_0x0e5e('0x1f')](_0x2efa7f);}return null;};}function patchUpdates(_0x2588fa){return function(_0x3f5512){try{jsonpatch[_0x0e5e('0x25')](_0x3f5512,_0x2588fa,!![]);}catch(_0x33b27e){return BPromise['reject'](_0x33b27e);}return _0x3f5512[_0x0e5e('0x26')]();};}function saveUpdates(_0x2321f9,_0xfff15b){return function(_0xcab633){if(_0xcab633){return _0xcab633[_0x0e5e('0x27')](_0x2321f9)[_0x0e5e('0x28')](function(_0x46cbd7){return _0x46cbd7;});}return null;};}function removeEntity(_0x4b53ca,_0x1b19f0){return function(_0x5ed110){if(_0x5ed110){return _0x5ed110[_0x0e5e('0x29')]()[_0x0e5e('0x28')](function(){_0x4b53ca['status'](0xcc)[_0x0e5e('0x2a')]();});}};}function handleEntityNotFound(_0x471834,_0x952141){return function(_0x563870){if(!_0x563870){_0x471834[_0x0e5e('0x1d')](0x194);}return _0x563870;};}function handleError(_0x57b970,_0x343eb2){_0x343eb2=_0x343eb2||0x1f4;return function(_0x2d5cc0){logger[_0x0e5e('0x2b')](_0x2d5cc0['stack']);if(_0x2d5cc0[_0x0e5e('0x2c')]){delete _0x2d5cc0[_0x0e5e('0x2c')];}_0x57b970[_0x0e5e('0x1e')](_0x343eb2)[_0x0e5e('0x2d')](_0x2d5cc0);};}exports[_0x0e5e('0x2e')]=function(_0x3a0984,_0x3ea522){var _0x4ca32e={'raw':![],'where':{'id':_0x3a0984[_0x0e5e('0x2f')]['id']}},_0x34455b={};_0x34455b[_0x0e5e('0x30')]=_[_0x0e5e('0x31')](db['DashboardItem']['rawAttributes']);_0x34455b['query']=_['keys'](_0x3a0984[_0x0e5e('0x32')]);_0x34455b['filters']=_[_0x0e5e('0x33')](_0x34455b[_0x0e5e('0x30')],_0x34455b[_0x0e5e('0x32')]);_0x4ca32e['attributes']=_[_0x0e5e('0x33')](_0x34455b['model'],qs['fields'](_0x3a0984[_0x0e5e('0x32')][_0x0e5e('0x34')]));_0x4ca32e[_0x0e5e('0x35')]=_0x4ca32e[_0x0e5e('0x35')][_0x0e5e('0x36')]?_0x4ca32e['attributes']:_0x34455b[_0x0e5e('0x30')];if(_0x3a0984[_0x0e5e('0x32')][_0x0e5e('0x37')]){_0x4ca32e[_0x0e5e('0x38')]=[{'all':!![]}];}_0x4ca32e=_[_0x0e5e('0x39')]({},_0x4ca32e,_0x3a0984[_0x0e5e('0x3a')]);return db[_0x0e5e('0x3b')][_0x0e5e('0x3c')](_0x4ca32e)[_0x0e5e('0x28')](handleEntityNotFound(_0x3ea522,null))['then'](respondWithResult(_0x3ea522,null))[_0x0e5e('0x3d')](handleError(_0x3ea522,null));};exports[_0x0e5e('0x29')]=function(_0x3f7067,_0x32958a){return db['DashboardItem'][_0x0e5e('0x3c')]({'where':{'id':_0x3f7067['params']['id']}})[_0x0e5e('0x28')](handleEntityNotFound(_0x32958a,null))[_0x0e5e('0x28')](removeEntity(_0x32958a,null))[_0x0e5e('0x3d')](handleError(_0x32958a,null));};function widgetAttributes(_0x4bf916){try{switch(_0x4bf916[_0x0e5e('0x3e')]){case _0x0e5e('0x3f'):return[{'name':_0x0e5e('0x40'),'value':_0x4bf916['attrUrl']||(_0x4bf916['attrs']&&_0x4bf916[_0x0e5e('0x41')][0x0]?_0x4bf916[_0x0e5e('0x41')][0x0][_0x0e5e('0x42')]:undefined)||'https://'}];case _0x0e5e('0x43'):return[{'name':_0x0e5e('0x44'),'value':_0x4bf916[_0x0e5e('0x44')]||(_0x4bf916[_0x0e5e('0x41')]&&_0x4bf916[_0x0e5e('0x41')][0x0]?_0x4bf916['attrs'][0x0][_0x0e5e('0x42')]:undefined)||''}];case _0x0e5e('0x45'):return[{'name':_0x0e5e('0x46'),'value':_0x4bf916[_0x0e5e('0x46')]||(_0x4bf916[_0x0e5e('0x41')]&&_0x4bf916[_0x0e5e('0x41')][0x0]?_0x4bf916['attrs'][0x0][_0x0e5e('0x42')]:undefined)||_0x0e5e('0x47')},{'name':'attrTimezone','value':_0x4bf916[_0x0e5e('0x48')]||(_0x4bf916[_0x0e5e('0x41')]&&_0x4bf916['attrs'][0x1]?_0x4bf916[_0x0e5e('0x41')][0x1][_0x0e5e('0x42')]:undefined)||'0.00'},{'name':_0x0e5e('0x49'),'value':_0x4bf916['attrFontSize']||(_0x4bf916[_0x0e5e('0x41')]&&_0x4bf916[_0x0e5e('0x41')][0x2]?_0x4bf916[_0x0e5e('0x41')][0x2][_0x0e5e('0x42')]:undefined)||0xc}];case _0x0e5e('0x4a'):return[{'name':_0x0e5e('0x4b'),'value':_0x4bf916[_0x0e5e('0x4b')]||(_0x4bf916[_0x0e5e('0x41')]&&_0x4bf916[_0x0e5e('0x41')][0x0]?_0x4bf916[_0x0e5e('0x41')][0x0][_0x0e5e('0x42')]:undefined)||'total'},{'name':_0x0e5e('0x4c'),'value':_0x4bf916['attrVoiceQueues']||(_0x4bf916['attrs']&&_0x4bf916[_0x0e5e('0x41')][0x1]?_0x4bf916[_0x0e5e('0x41')][0x1][_0x0e5e('0x42')]:undefined)||[]},{'name':_0x0e5e('0x49'),'value':_0x4bf916[_0x0e5e('0x49')]||(_0x4bf916[_0x0e5e('0x41')]&&_0x4bf916[_0x0e5e('0x41')][0x2]?_0x4bf916['attrs'][0x2][_0x0e5e('0x42')]:undefined)||0x14},{'name':_0x0e5e('0x4d'),'value':_0x4bf916[_0x0e5e('0x4d')]||(_0x4bf916[_0x0e5e('0x41')]&&_0x4bf916['attrs'][0x3]?_0x4bf916[_0x0e5e('0x41')][0x3][_0x0e5e('0x42')]:undefined)||_0x0e5e('0x4e')},{'name':_0x0e5e('0x4f'),'value':_0x4bf916['attrEmailAccounts']||(_0x4bf916['attrs']&&_0x4bf916['attrs'][0x4]?_0x4bf916[_0x0e5e('0x41')][0x4]['value']:undefined)||''},{'name':_0x0e5e('0x50'),'value':_0x4bf916[_0x0e5e('0x50')]||(_0x4bf916['attrs']&&_0x4bf916[_0x0e5e('0x41')][0x5]?_0x4bf916[_0x0e5e('0x41')][0x5][_0x0e5e('0x42')]:undefined)||''},{'name':_0x0e5e('0x51'),'value':_0x4bf916[_0x0e5e('0x51')]||(_0x4bf916[_0x0e5e('0x41')]&&_0x4bf916[_0x0e5e('0x41')][0x6]?_0x4bf916[_0x0e5e('0x41')][0x6][_0x0e5e('0x42')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x4bf916['attrOpenchannelAccounts']||(_0x4bf916[_0x0e5e('0x41')]&&_0x4bf916[_0x0e5e('0x41')][0x7]?_0x4bf916[_0x0e5e('0x41')][0x7][_0x0e5e('0x42')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x4bf916[_0x0e5e('0x52')]||(_0x4bf916[_0x0e5e('0x41')]&&_0x4bf916['attrs'][0x8]?_0x4bf916[_0x0e5e('0x41')][0x8][_0x0e5e('0x42')]:undefined)||''},{'name':_0x0e5e('0x53'),'value':_0x4bf916[_0x0e5e('0x53')]||(_0x4bf916['attrs']&&_0x4bf916[_0x0e5e('0x41')][0x9]?_0x4bf916['attrs'][0x9][_0x0e5e('0x42')]:undefined)||''}];case'multibar-chart':case'pie-chart':return[{'name':_0x0e5e('0x54'),'value':_0x4bf916[_0x0e5e('0x54')]||(_0x4bf916[_0x0e5e('0x41')]&&_0x4bf916['attrs'][0x0]?_0x4bf916[_0x0e5e('0x41')][0x0][_0x0e5e('0x42')]:undefined)||_0x0e5e('0x55')},{'name':'attrSerie2','value':_0x4bf916[_0x0e5e('0x56')]||(_0x4bf916[_0x0e5e('0x41')]&&_0x4bf916[_0x0e5e('0x41')][0x1]?_0x4bf916['attrs'][0x1][_0x0e5e('0x42')]:undefined)||null},{'name':_0x0e5e('0x57'),'value':_0x4bf916[_0x0e5e('0x57')]||(_0x4bf916[_0x0e5e('0x41')]&&_0x4bf916['attrs'][0x2]?_0x4bf916[_0x0e5e('0x41')][0x2][_0x0e5e('0x42')]:undefined)||null},{'name':_0x0e5e('0x4c'),'value':_0x4bf916[_0x0e5e('0x4c')]||(_0x4bf916[_0x0e5e('0x41')]&&_0x4bf916[_0x0e5e('0x41')][0x3]?_0x4bf916[_0x0e5e('0x41')][0x3][_0x0e5e('0x42')]:undefined)||[]},{'name':_0x0e5e('0x4d'),'value':_0x4bf916[_0x0e5e('0x4d')]||(_0x4bf916[_0x0e5e('0x41')]&&_0x4bf916[_0x0e5e('0x41')][0x4]?_0x4bf916[_0x0e5e('0x41')][0x4]['value']:undefined)||_0x0e5e('0x4e')},{'name':'attrEmailAccounts','value':_0x4bf916[_0x0e5e('0x4f')]||(_0x4bf916['attrs']&&_0x4bf916[_0x0e5e('0x41')][0x5]?_0x4bf916['attrs'][0x5][_0x0e5e('0x42')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x4bf916[_0x0e5e('0x50')]||(_0x4bf916[_0x0e5e('0x41')]&&_0x4bf916[_0x0e5e('0x41')][0x6]?_0x4bf916['attrs'][0x6][_0x0e5e('0x42')]:undefined)||''},{'name':_0x0e5e('0x51'),'value':_0x4bf916['attrSmsAccounts']||(_0x4bf916[_0x0e5e('0x41')]&&_0x4bf916[_0x0e5e('0x41')][0x7]?_0x4bf916[_0x0e5e('0x41')][0x7]['value']:undefined)||''},{'name':_0x0e5e('0x58'),'value':_0x4bf916[_0x0e5e('0x58')]||(_0x4bf916[_0x0e5e('0x41')]&&_0x4bf916['attrs'][0x8]?_0x4bf916[_0x0e5e('0x41')][0x8][_0x0e5e('0x42')]:undefined)||''},{'name':_0x0e5e('0x52'),'value':_0x4bf916[_0x0e5e('0x52')]||(_0x4bf916[_0x0e5e('0x41')]&&_0x4bf916[_0x0e5e('0x41')][0x9]?_0x4bf916['attrs'][0x9][_0x0e5e('0x42')]:undefined)||''},{'name':_0x0e5e('0x53'),'value':_0x4bf916[_0x0e5e('0x53')]||(_0x4bf916[_0x0e5e('0x41')]&&_0x4bf916['attrs'][0xa]?_0x4bf916[_0x0e5e('0x41')][0xa][_0x0e5e('0x42')]:undefined)||''}];case _0x0e5e('0x59'):return[{'name':_0x0e5e('0x5a'),'type':_0x4bf916['reportType']||(_0x4bf916[_0x0e5e('0x41')]&&_0x4bf916[_0x0e5e('0x41')][0x0]?_0x4bf916[_0x0e5e('0x41')][0x0][_0x0e5e('0x3e')]:undefined)||null,'value':_0x4bf916['attrReport']||(_0x4bf916[_0x0e5e('0x41')]&&_0x4bf916[_0x0e5e('0x41')][0x0]?_0x4bf916[_0x0e5e('0x41')][0x0][_0x0e5e('0x42')]:undefined)||null},{'name':'attrRefresh','value':_0x4bf916['attrRefresh']||(_0x4bf916['attrs']&&_0x4bf916[_0x0e5e('0x41')][0x1]?_0x4bf916[_0x0e5e('0x41')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x499d14){logger[_0x0e5e('0x2b')]('widgetAttributes:\x20%s',JSON['stringify'](_0x499d14));return[];}}exports['create']=function(_0x5af553,_0x2d5b5a){if(_0x5af553[_0x0e5e('0x5b')]){_0x5af553[_0x0e5e('0x5b')][_0x0e5e('0x41')]=widgetAttributes(_0x5af553[_0x0e5e('0x5b')]);}return db[_0x0e5e('0x3b')][_0x0e5e('0x5c')](_0x5af553[_0x0e5e('0x5b')],{})[_0x0e5e('0x28')](respondWithResult(_0x2d5b5a,0xc9))['catch'](handleError(_0x2d5b5a,null));};exports[_0x0e5e('0x27')]=function(_0x45191c,_0x1b8188){if(_0x45191c[_0x0e5e('0x5b')]['id']){delete _0x45191c['body']['id'];}_0x45191c[_0x0e5e('0x5b')][_0x0e5e('0x41')]=widgetAttributes(_0x45191c[_0x0e5e('0x5b')]);return db[_0x0e5e('0x3b')][_0x0e5e('0x3c')]({'where':{'id':_0x45191c[_0x0e5e('0x2f')]['id']}})[_0x0e5e('0x28')](handleEntityNotFound(_0x1b8188,null))[_0x0e5e('0x28')](saveUpdates(_0x45191c[_0x0e5e('0x5b')],null))[_0x0e5e('0x28')](respondWithResult(_0x1b8188,null))[_0x0e5e('0x3d')](handleError(_0x1b8188,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 1da99f0..9f9b816 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 _0x6dad=['save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x39609a,_0x28a563){var _0xecd92=function(_0x57241a){while(--_0x57241a){_0x39609a['push'](_0x39609a['shift']());}};_0xecd92(++_0x28a563);}(_0x6dad,0x77));var _0xd6da=function(_0x15a080,_0x4fe13a){_0x15a080=_0x15a080-0x0;var _0x3e5f81=_0x6dad[_0x15a080];return _0x3e5f81;};'use strict';var EventEmitter=require(_0xd6da('0x0'));var DashboardItem=require('../../mysqldb')['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd6da('0x1'),'afterUpdate':_0xd6da('0x2'),'afterDestroy':_0xd6da('0x3')};function emitEvent(_0x68d591){return function(_0x4f1f58,_0x21b59c,_0x30dc10){DashboardItemEvents[_0xd6da('0x4')](_0x68d591+':'+_0x4f1f58['id'],_0x4f1f58);DashboardItemEvents[_0xd6da('0x4')](_0x68d591,_0x4f1f58);_0x30dc10(null);};}for(var e in events){if(events[_0xd6da('0x5')](e)){var event=events[e];DashboardItem[_0xd6da('0x6')](e,emitEvent(event));}}module[_0xd6da('0x7')]=DashboardItemEvents; \ No newline at end of file +var _0x5b9c=['emit','hasOwnProperty','hook','setMaxListeners','save','remove'];(function(_0x52a6e2,_0x9abdde){var _0x5b9a68=function(_0x53f233){while(--_0x53f233){_0x52a6e2['push'](_0x52a6e2['shift']());}};_0x5b9a68(++_0x9abdde);}(_0x5b9c,0x1ad));var _0xc5b9=function(_0x129de3,_0x3fd911){_0x129de3=_0x129de3-0x0;var _0x5c8184=_0x5b9c[_0x129de3];return _0x5c8184;};'use strict';var EventEmitter=require('events');var DashboardItem=require('../../mysqldb')['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xc5b9('0x0')](0x0);var events={'afterCreate':_0xc5b9('0x1'),'afterUpdate':'update','afterDestroy':_0xc5b9('0x2')};function emitEvent(_0x558335){return function(_0x23cb6e,_0x55cb10,_0x1c6dad){DashboardItemEvents[_0xc5b9('0x3')](_0x558335+':'+_0x23cb6e['id'],_0x23cb6e);DashboardItemEvents[_0xc5b9('0x3')](_0x558335,_0x23cb6e);_0x1c6dad(null);};}for(var e in events){if(events[_0xc5b9('0x4')](e)){var event=events[e];DashboardItem[_0xc5b9('0x5')](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 61a4347..7717830 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 _0xdf71=['api','moment','bluebird','request-promise','path','rimraf','./dashboardItem.attributes','exports','define','DashboardItem','lodash','../../config/logger'];(function(_0x1eb7b7,_0x3cc652){var _0x509dba=function(_0x38a458){while(--_0x38a458){_0x1eb7b7['push'](_0x1eb7b7['shift']());}};_0x509dba(++_0x3cc652);}(_0xdf71,0x1d2));var _0x1df7=function(_0x28fde4,_0x4fbc40){_0x28fde4=_0x28fde4-0x0;var _0xdc3f1b=_0xdf71[_0x28fde4];return _0xdc3f1b;};'use strict';var _=require(_0x1df7('0x0'));var util=require('util');var logger=require(_0x1df7('0x1'))(_0x1df7('0x2'));var moment=require(_0x1df7('0x3'));var BPromise=require(_0x1df7('0x4'));var rp=require(_0x1df7('0x5'));var fs=require('fs');var path=require(_0x1df7('0x6'));var rimraf=require(_0x1df7('0x7'));var config=require('../../config/environment');var attributes=require(_0x1df7('0x8'));module[_0x1df7('0x9')]=function(_0x4bc4a8,_0x508a68){return _0x4bc4a8[_0x1df7('0xa')](_0x1df7('0xb'),attributes,{'tableName':'dashboard_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x30e7=['lodash','util','api','moment','../../config/environment','exports','define','DashboardItem','dashboard_items'];(function(_0x2283e1,_0x560558){var _0x57a1ab=function(_0x576d55){while(--_0x576d55){_0x2283e1['push'](_0x2283e1['shift']());}};_0x57a1ab(++_0x560558);}(_0x30e7,0x144));var _0x730e=function(_0x24248e,_0xa55aab){_0x24248e=_0x24248e-0x0;var _0x2089d2=_0x30e7[_0x24248e];return _0x2089d2;};'use strict';var _=require(_0x730e('0x0'));var util=require(_0x730e('0x1'));var logger=require('../../config/logger')(_0x730e('0x2'));var moment=require(_0x730e('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x730e('0x4'));var attributes=require('./dashboardItem.attributes');module[_0x730e('0x5')]=function(_0x25f408,_0x2befaa){return _0x25f408[_0x730e('0x6')](_0x730e('0x7'),attributes,{'tableName':_0x730e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index 3fea867..0161239 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 _0xfc47=['client','redis','./dashboardItem.socket','register','request','info','debug','DashboardItem,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','DashboardItem,\x20%s,\x20%s','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x30932b,_0xe42956){var _0x471379=function(_0x4047b6){while(--_0x4047b6){_0x30932b['push'](_0x30932b['shift']());}};_0x471379(++_0xe42956);}(_0xfc47,0x12f));var _0x7fc4=function(_0x3c083b,_0x549e68){_0x3c083b=_0x3c083b-0x0;var _0x1c4f50=_0xfc47[_0x3c083b];return _0x1c4f50;};'use strict';var _=require(_0x7fc4('0x0'));var util=require('util');var moment=require(_0x7fc4('0x1'));var BPromise=require(_0x7fc4('0x2'));var rs=require(_0x7fc4('0x3'));var fs=require('fs');var Redis=require(_0x7fc4('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7fc4('0x5'));var logger=require(_0x7fc4('0x6'))('rpc');var config=require(_0x7fc4('0x7'));var jayson=require(_0x7fc4('0x8'));var client=jayson[_0x7fc4('0x9')]['http']({'port':0x232a});config[_0x7fc4('0xa')]=_['defaults'](config[_0x7fc4('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7fc4('0xa')]));require(_0x7fc4('0xb'))[_0x7fc4('0xc')](socket);function respondWithRpcPromise(_0x4ed2c4,_0x56fc5b,_0x2514bf){return new BPromise(function(_0x332b25,_0x4f474f){return client[_0x7fc4('0xd')](_0x4ed2c4,_0x2514bf)['then'](function(_0x187ad5){logger[_0x7fc4('0xe')]('DashboardItem,\x20%s,\x20%s',_0x56fc5b,'request\x20sent');logger[_0x7fc4('0xf')](_0x7fc4('0x10'),_0x56fc5b,_0x7fc4('0x11'),JSON[_0x7fc4('0x12')](_0x187ad5));if(_0x187ad5[_0x7fc4('0x13')]){if(_0x187ad5['error'][_0x7fc4('0x14')]===0x1f4){logger[_0x7fc4('0x13')](_0x7fc4('0x15'),_0x56fc5b,_0x187ad5[_0x7fc4('0x13')][_0x7fc4('0x16')]);return _0x4f474f(_0x187ad5[_0x7fc4('0x13')][_0x7fc4('0x16')]);}logger[_0x7fc4('0x13')](_0x7fc4('0x15'),_0x56fc5b,_0x187ad5['error'][_0x7fc4('0x16')]);return _0x332b25(_0x187ad5[_0x7fc4('0x13')][_0x7fc4('0x16')]);}else{logger['info'](_0x7fc4('0x15'),_0x56fc5b,_0x7fc4('0x11'));_0x332b25(_0x187ad5['result'][_0x7fc4('0x16')]);}})[_0x7fc4('0x17')](function(_0x2a7707){logger[_0x7fc4('0x13')]('DashboardItem,\x20%s,\x20%s',_0x56fc5b,_0x2a7707);_0x4f474f(_0x2a7707);});});} \ No newline at end of file +var _0x962b=['then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./dashboardItem.socket','register'];(function(_0x530853,_0x589c20){var _0x4688a1=function(_0x1dcee0){while(--_0x1dcee0){_0x530853['push'](_0x530853['shift']());}};_0x4688a1(++_0x589c20);}(_0x962b,0x168));var _0xb962=function(_0x49a39a,_0x56d16c){_0x49a39a=_0x49a39a-0x0;var _0x40ccbe=_0x962b[_0x49a39a];return _0x40ccbe;};'use strict';var _=require(_0xb962('0x0'));var util=require(_0xb962('0x1'));var moment=require('moment');var BPromise=require(_0xb962('0x2'));var rs=require(_0xb962('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb962('0x4'));var logger=require(_0xb962('0x5'))(_0xb962('0x6'));var config=require(_0xb962('0x7'));var jayson=require(_0xb962('0x8'));var client=jayson[_0xb962('0x9')][_0xb962('0xa')]({'port':0x232a});config[_0xb962('0xb')]=_['defaults'](config[_0xb962('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xb962('0xc'))(new Redis(config[_0xb962('0xb')]));require(_0xb962('0xd'))[_0xb962('0xe')](socket);function respondWithRpcPromise(_0x1ca722,_0x3613b6,_0x11885d){return new BPromise(function(_0x3ac157,_0x24fd43){return client['request'](_0x1ca722,_0x11885d)[_0xb962('0xf')](function(_0x3ebe87){logger[_0xb962('0x10')](_0xb962('0x11'),_0x3613b6,_0xb962('0x12'));logger[_0xb962('0x13')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0x3613b6,_0xb962('0x12'),JSON['stringify'](_0x3ebe87));if(_0x3ebe87[_0xb962('0x14')]){if(_0x3ebe87[_0xb962('0x14')][_0xb962('0x15')]===0x1f4){logger[_0xb962('0x14')](_0xb962('0x11'),_0x3613b6,_0x3ebe87[_0xb962('0x14')][_0xb962('0x16')]);return _0x24fd43(_0x3ebe87['error']['message']);}logger[_0xb962('0x14')](_0xb962('0x11'),_0x3613b6,_0x3ebe87[_0xb962('0x14')][_0xb962('0x16')]);return _0x3ac157(_0x3ebe87['error'][_0xb962('0x16')]);}else{logger[_0xb962('0x10')](_0xb962('0x11'),_0x3613b6,_0xb962('0x12'));_0x3ac157(_0x3ebe87[_0xb962('0x17')][_0xb962('0x16')]);}})[_0xb962('0x18')](function(_0x3d959f){logger[_0xb962('0x14')](_0xb962('0x11'),_0x3613b6,_0x3d959f);_0x24fd43(_0x3d959f);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index f224e3b..5daa7c7 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 _0x076f=['length','dashboardItem:','./dashboardItem.events','save','remove','update','emit','removeListener','register'];(function(_0x4d1f78,_0x49137a){var _0x2afa0a=function(_0x52b65b){while(--_0x52b65b){_0x4d1f78['push'](_0x4d1f78['shift']());}};_0x2afa0a(++_0x49137a);}(_0x076f,0xc8));var _0xf076=function(_0x1eebd1,_0x5960dd){_0x1eebd1=_0x1eebd1-0x0;var _0x3f49e9=_0x076f[_0x1eebd1];return _0x3f49e9;};'use strict';var DashboardItemEvents=require(_0xf076('0x0'));var events=[_0xf076('0x1'),_0xf076('0x2'),_0xf076('0x3')];function createListener(_0x15cc10,_0x2445b5){return function(_0x1b7c4e){_0x2445b5[_0xf076('0x4')](_0x15cc10,_0x1b7c4e);};}function removeListener(_0x8c7a69,_0x1dcffe){return function(){DashboardItemEvents[_0xf076('0x5')](_0x8c7a69,_0x1dcffe);};}exports[_0xf076('0x6')]=function(_0x4c491e){for(var _0x1de0f0=0x0,_0x392157=events[_0xf076('0x7')];_0x1de0f0<_0x392157;_0x1de0f0++){var _0x3b0ce5=events[_0x1de0f0];var _0x1902fa=createListener(_0xf076('0x8')+_0x3b0ce5,_0x4c491e);DashboardItemEvents['on'](_0x3b0ce5,_0x1902fa);}}; \ No newline at end of file +var _0xb208=['removeListener','dashboardItem:','./dashboardItem.events','save','remove','update'];(function(_0x1a892a,_0x35b89b){var _0x5f2a3c=function(_0x486b07){while(--_0x486b07){_0x1a892a['push'](_0x1a892a['shift']());}};_0x5f2a3c(++_0x35b89b);}(_0xb208,0xb0));var _0x8b20=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xb208[_0x432682];return _0x463d05;};'use strict';var DashboardItemEvents=require(_0x8b20('0x0'));var events=[_0x8b20('0x1'),_0x8b20('0x2'),_0x8b20('0x3')];function createListener(_0x4c0bcf,_0x16ec63){return function(_0x4bf5cf){_0x16ec63['emit'](_0x4c0bcf,_0x4bf5cf);};}function removeListener(_0x4ae5c7,_0x153bf0){return function(){DashboardItemEvents[_0x8b20('0x4')](_0x4ae5c7,_0x153bf0);};}exports['register']=function(_0x1df65a){for(var _0xbe53a4=0x0,_0x4e2ff3=events['length'];_0xbe53a4<_0x4e2ff3;_0xbe53a4++){var _0x275e8e=events[_0xbe53a4];var _0xfafc79=createListener(_0x8b20('0x5')+_0x275e8e,_0x1df65a);DashboardItemEvents['on'](_0x275e8e,_0xfafc79);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index e0eeeca..fd19fd0 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 _0xf120=['fs-extra','../../components/auth/service','../../config/environment','./dashboardItem.controller','get','/:id','isAuthenticated','show','create','update','delete','destroy','exports','util','connect-timeout','Router'];(function(_0x16bb1c,_0x58f468){var _0xace56c=function(_0x216f59){while(--_0x216f59){_0x16bb1c['push'](_0x16bb1c['shift']());}};_0xace56c(++_0x58f468);}(_0xf120,0xbd));var _0x0f12=function(_0x333cba,_0x438dfe){_0x333cba=_0x333cba-0x0;var _0x55f776=_0xf120[_0x333cba];return _0x55f776;};'use strict';var multer=require('multer');var util=require(_0x0f12('0x0'));var path=require('path');var timeout=require(_0x0f12('0x1'));var express=require('express');var router=express[_0x0f12('0x2')]();var fs_extra=require(_0x0f12('0x3'));var auth=require(_0x0f12('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x0f12('0x5'));var controller=require(_0x0f12('0x6'));router[_0x0f12('0x7')](_0x0f12('0x8'),auth[_0x0f12('0x9')](),controller[_0x0f12('0xa')]);router['post']('/',auth[_0x0f12('0x9')](),controller[_0x0f12('0xb')]);router['put'](_0x0f12('0x8'),auth[_0x0f12('0x9')](),controller[_0x0f12('0xc')]);router[_0x0f12('0xd')](_0x0f12('0x8'),auth[_0x0f12('0x9')](),controller[_0x0f12('0xe')]);module[_0x0f12('0xf')]=router; \ No newline at end of file +var _0x46d5=['multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','/:id','isAuthenticated','show','post','put','delete','exports'];(function(_0x3d5f84,_0x569548){var _0x1981b8=function(_0x3bf9f3){while(--_0x3bf9f3){_0x3d5f84['push'](_0x3d5f84['shift']());}};_0x1981b8(++_0x569548);}(_0x46d5,0x99));var _0x546d=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x46d5[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0x546d('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x546d('0x1'));var express=require(_0x546d('0x2'));var router=express[_0x546d('0x3')]();var fs_extra=require(_0x546d('0x4'));var auth=require(_0x546d('0x5'));var interaction=require(_0x546d('0x6'));var config=require(_0x546d('0x7'));var controller=require(_0x546d('0x8'));router[_0x546d('0x9')](_0x546d('0xa'),auth[_0x546d('0xb')](),controller[_0x546d('0xc')]);router[_0x546d('0xd')]('/',auth[_0x546d('0xb')](),controller['create']);router[_0x546d('0xe')]('/:id',auth[_0x546d('0xb')](),controller['update']);router[_0x546d('0xf')](_0x546d('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x546d('0x10')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index d4080b9..791f2cd 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 _0xa750=['second','third','sequelize','exports','STRING','ENUM','first'];(function(_0x42ec50,_0x13563d){var _0x35e7c0=function(_0x57f2f1){while(--_0x57f2f1){_0x42ec50['push'](_0x42ec50['shift']());}};_0x35e7c0(++_0x13563d);}(_0xa750,0x1f3));var _0x0a75=function(_0x2b039e,_0x49007b){_0x2b039e=_0x2b039e-0x0;var _0x32d1dd=_0xa750[_0x2b039e];return _0x32d1dd;};'use strict';var Sequelize=require(_0x0a75('0x0'));module[_0x0a75('0x1')]={'name':{'type':Sequelize[_0x0a75('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0x0a75('0x3')](_0x0a75('0x4'),_0x0a75('0x5'),_0x0a75('0x6')),'allowNull':![],'defaultValue':_0x0a75('0x4')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x70e2=['exports','STRING','ENUM','first','third'];(function(_0x4aea4d,_0x266f5f){var _0x54ad86=function(_0x4d0734){while(--_0x4d0734){_0x4aea4d['push'](_0x4aea4d['shift']());}};_0x54ad86(++_0x266f5f);}(_0x70e2,0x1f4));var _0x270e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x70e2[_0x1ac595];return _0x455fff;};'use strict';var Sequelize=require('sequelize');module[_0x270e('0x0')]={'name':{'type':Sequelize[_0x270e('0x1')],'allowNull':![]},'level':{'type':Sequelize[_0x270e('0x2')](_0x270e('0x3'),'second',_0x270e('0x4')),'allowNull':![],'defaultValue':_0x270e('0x3')},'description':{'type':Sequelize[_0x270e('0x1')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index b0f37bd..6266587 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 _0x2ce0=['set','apply','reject','save','update','then','destroy','Dispositions','error','stack','name','send','index','Disposition','rawAttributes','type','key','model','map','keys','query','filters','intersection','attributes','length','nolimit','order','sort','where','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','params','fields','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','desk.js','papaparse','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count'];(function(_0x52f1e6,_0xf70489){var _0x21f104=function(_0xb89f9e){while(--_0xb89f9e){_0x52f1e6['push'](_0x52f1e6['shift']());}};_0x21f104(++_0xf70489);}(_0x2ce0,0x82));var _0x02ce=function(_0x264645,_0x35e18a){_0x264645=_0x264645-0x0;var _0x5e72f2=_0x2ce0[_0x264645];return _0x5e72f2;};'use strict';var emlformat=require(_0x02ce('0x0'));var rimraf=require(_0x02ce('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x02ce('0x2'));var rp=require(_0x02ce('0x3'));var moment=require(_0x02ce('0x4'));var BPromise=require(_0x02ce('0x5'));var Mustache=require('mustache');var util=require(_0x02ce('0x6'));var path=require(_0x02ce('0x7'));var sox=require(_0x02ce('0x8'));var csv=require(_0x02ce('0x9'));var ejs=require(_0x02ce('0xa'));var fs=require('fs');var fs_extra=require(_0x02ce('0xb'));var _=require('lodash');var squel=require(_0x02ce('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x02ce('0xd'));var toCsv=require(_0x02ce('0x9'));var querystring=require('querystring');var Papa=require(_0x02ce('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x02ce('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x02ce('0x10'));var logger=require('../../config/logger')(_0x02ce('0x11'));var utils=require(_0x02ce('0x12'));var config=require(_0x02ce('0x13'));var licenseUtil=require(_0x02ce('0x14'));var db=require(_0x02ce('0x15'))['db'];function respondWithStatusCode(_0x54b951,_0x1f609d){_0x1f609d=_0x1f609d||0xcc;return function(_0x1607c8){if(_0x1607c8){return _0x54b951[_0x02ce('0x16')](_0x1f609d);}return _0x54b951[_0x02ce('0x17')](_0x1f609d)[_0x02ce('0x18')]();};}function respondWithResult(_0x4e6a84,_0x6a5390){_0x6a5390=_0x6a5390||0xc8;return function(_0x18bc55){if(_0x18bc55){return _0x4e6a84['status'](_0x6a5390)[_0x02ce('0x19')](_0x18bc55);}};}function respondWithFilteredResult(_0x35985c,_0x4008c0){return function(_0x411b59){if(_0x411b59){var _0x198f25=typeof _0x4008c0[_0x02ce('0x1a')]===_0x02ce('0x1b')&&typeof _0x4008c0[_0x02ce('0x1c')]==='undefined';var _0x40af2c=_0x411b59[_0x02ce('0x1d')];var _0xbc2c3d=_0x198f25?0x0:_0x4008c0['offset'];var _0x5c065d=_0x198f25?_0x411b59['count']:_0x4008c0[_0x02ce('0x1a')]+_0x4008c0[_0x02ce('0x1c')];var _0x4a0e1c;if(_0x5c065d>=_0x40af2c){_0x5c065d=_0x40af2c;_0x4a0e1c=0xc8;}else{_0x4a0e1c=0xce;}_0x35985c[_0x02ce('0x17')](_0x4a0e1c);return _0x35985c[_0x02ce('0x1e')]('Content-Range',_0xbc2c3d+'-'+_0x5c065d+'/'+_0x40af2c)['json'](_0x411b59);}return null;};}function patchUpdates(_0x2943fa){return function(_0x3df87e){try{jsonpatch[_0x02ce('0x1f')](_0x3df87e,_0x2943fa,!![]);}catch(_0x2e59ec){return BPromise[_0x02ce('0x20')](_0x2e59ec);}return _0x3df87e[_0x02ce('0x21')]();};}function saveUpdates(_0x20cb09,_0x4933b7){return function(_0x2ac14a){if(_0x2ac14a){return _0x2ac14a[_0x02ce('0x22')](_0x20cb09)[_0x02ce('0x23')](function(_0x52a771){return _0x52a771;});}return null;};}function removeEntity(_0x41a26a,_0x1544ba){return function(_0x1fb4c9){if(_0x1fb4c9){return _0x1fb4c9[_0x02ce('0x24')]()['then'](function(){var _0x58d338=_0x1fb4c9['get']({'plain':!![]});var _0x120fb7=_0x02ce('0x25');return db['UserProfileResource'][_0x02ce('0x24')]({'where':{'type':_0x120fb7,'resourceId':_0x58d338['id']}})[_0x02ce('0x23')](function(){return _0x1fb4c9;});})[_0x02ce('0x23')](function(){_0x41a26a['status'](0xcc)[_0x02ce('0x18')]();});}};}function handleEntityNotFound(_0x2289c0,_0x39f1b1){return function(_0x4ef67b){if(!_0x4ef67b){_0x2289c0[_0x02ce('0x16')](0x194);}return _0x4ef67b;};}function handleError(_0x34c1f0,_0xba64fe){_0xba64fe=_0xba64fe||0x1f4;return function(_0x2eb860){logger[_0x02ce('0x26')](_0x2eb860[_0x02ce('0x27')]);if(_0x2eb860[_0x02ce('0x28')]){delete _0x2eb860[_0x02ce('0x28')];}_0x34c1f0['status'](_0xba64fe)[_0x02ce('0x29')](_0x2eb860);};}exports[_0x02ce('0x2a')]=function(_0x2831ca,_0x28cfe9){var _0x8dac4e={},_0x28bf1e={},_0x1c66dd={'count':0x0,'rows':[]};var _0x122976=_['map'](db[_0x02ce('0x2b')][_0x02ce('0x2c')],function(_0x57227e){return{'name':_0x57227e['fieldName'],'type':_0x57227e[_0x02ce('0x2d')][_0x02ce('0x2e')]};});_0x28bf1e[_0x02ce('0x2f')]=_[_0x02ce('0x30')](_0x122976,'name');_0x28bf1e['query']=_[_0x02ce('0x31')](_0x2831ca[_0x02ce('0x32')]);_0x28bf1e[_0x02ce('0x33')]=_[_0x02ce('0x34')](_0x28bf1e[_0x02ce('0x2f')],_0x28bf1e[_0x02ce('0x32')]);_0x8dac4e['attributes']=_[_0x02ce('0x34')](_0x28bf1e[_0x02ce('0x2f')],qs['fields'](_0x2831ca[_0x02ce('0x32')]['fields']));_0x8dac4e[_0x02ce('0x35')]=_0x8dac4e[_0x02ce('0x35')][_0x02ce('0x36')]?_0x8dac4e[_0x02ce('0x35')]:_0x28bf1e[_0x02ce('0x2f')];if(!_0x2831ca[_0x02ce('0x32')]['hasOwnProperty'](_0x02ce('0x37'))){_0x8dac4e[_0x02ce('0x1c')]=qs[_0x02ce('0x1c')](_0x2831ca[_0x02ce('0x32')][_0x02ce('0x1c')]);_0x8dac4e[_0x02ce('0x1a')]=qs[_0x02ce('0x1a')](_0x2831ca[_0x02ce('0x32')]['offset']);}_0x8dac4e[_0x02ce('0x38')]=qs[_0x02ce('0x39')](_0x2831ca[_0x02ce('0x32')]['sort']);_0x8dac4e[_0x02ce('0x3a')]=qs[_0x02ce('0x33')](_['pick'](_0x2831ca[_0x02ce('0x32')],_0x28bf1e[_0x02ce('0x33')]),_0x122976);if(_0x2831ca[_0x02ce('0x32')][_0x02ce('0x3b')]){_0x8dac4e['where']=_['merge'](_0x8dac4e[_0x02ce('0x3a')],{'$or':_[_0x02ce('0x30')](_0x122976,function(_0x467ef3){if(_0x467ef3['type']!==_0x02ce('0x3c')){var _0x146fc0={};_0x146fc0[_0x467ef3[_0x02ce('0x28')]]={'$like':'%'+_0x2831ca[_0x02ce('0x32')][_0x02ce('0x3b')]+'%'};return _0x146fc0;}})});}_0x8dac4e=_[_0x02ce('0x3d')]({},_0x8dac4e,_0x2831ca['options']);var _0x1c85ae={'where':_0x8dac4e[_0x02ce('0x3a')]};return db[_0x02ce('0x2b')][_0x02ce('0x1d')](_0x1c85ae)[_0x02ce('0x23')](function(_0x2534ac){_0x1c66dd[_0x02ce('0x1d')]=_0x2534ac;if(_0x2831ca[_0x02ce('0x32')][_0x02ce('0x3e')]){_0x8dac4e[_0x02ce('0x3f')]=[{'all':!![]}];}return db['Disposition'][_0x02ce('0x40')](_0x8dac4e);})[_0x02ce('0x23')](function(_0x33469f){_0x1c66dd[_0x02ce('0x41')]=_0x33469f;return _0x1c66dd;})[_0x02ce('0x23')](respondWithFilteredResult(_0x28cfe9,_0x8dac4e))[_0x02ce('0x42')](handleError(_0x28cfe9,null));};exports['show']=function(_0x56c626,_0x8c2429){var _0x4313f3={'raw':!![],'where':{'id':_0x56c626[_0x02ce('0x43')]['id']}},_0x386f76={};_0x386f76[_0x02ce('0x2f')]=_['keys'](db['Disposition'][_0x02ce('0x2c')]);_0x386f76[_0x02ce('0x32')]=_[_0x02ce('0x31')](_0x56c626[_0x02ce('0x32')]);_0x386f76[_0x02ce('0x33')]=_[_0x02ce('0x34')](_0x386f76[_0x02ce('0x2f')],_0x386f76[_0x02ce('0x32')]);_0x4313f3[_0x02ce('0x35')]=_[_0x02ce('0x34')](_0x386f76[_0x02ce('0x2f')],qs[_0x02ce('0x44')](_0x56c626[_0x02ce('0x32')][_0x02ce('0x44')]));_0x4313f3[_0x02ce('0x35')]=_0x4313f3[_0x02ce('0x35')]['length']?_0x4313f3[_0x02ce('0x35')]:_0x386f76['model'];if(_0x56c626[_0x02ce('0x32')][_0x02ce('0x3e')]){_0x4313f3[_0x02ce('0x3f')]=[{'all':!![]}];}_0x4313f3=_[_0x02ce('0x3d')]({},_0x4313f3,_0x56c626['options']);return db['Disposition']['find'](_0x4313f3)[_0x02ce('0x23')](handleEntityNotFound(_0x8c2429,null))[_0x02ce('0x23')](respondWithResult(_0x8c2429,null))[_0x02ce('0x42')](handleError(_0x8c2429,null));};exports[_0x02ce('0x45')]=function(_0x5942f1,_0x3bc813){return db['Disposition']['create'](_0x5942f1[_0x02ce('0x46')],{})['then'](function(_0x1709da){var _0x386b76=_0x5942f1[_0x02ce('0x47')]['get']({'plain':!![]});if(!_0x386b76)throw new Error(_0x02ce('0x48'));if(_0x386b76[_0x02ce('0x49')]===_0x02ce('0x47')){var _0x47a837=_0x1709da[_0x02ce('0x4a')]({'plain':!![]});var _0x4c2a4d=_0x02ce('0x25');return db[_0x02ce('0x4b')][_0x02ce('0x4c')]({'where':{'name':_0x4c2a4d,'userProfileId':_0x386b76[_0x02ce('0x4d')]},'raw':!![]})[_0x02ce('0x23')](function(_0x188d91){if(_0x188d91&&_0x188d91[_0x02ce('0x4e')]===0x0){return db['UserProfileResource'][_0x02ce('0x45')]({'name':_0x47a837[_0x02ce('0x28')],'resourceId':_0x47a837['id'],'type':_0x188d91[_0x02ce('0x28')],'sectionId':_0x188d91['id']},{})[_0x02ce('0x23')](function(){return _0x1709da;});}else{return _0x1709da;}})[_0x02ce('0x42')](function(_0x5050a8){logger[_0x02ce('0x26')](_0x02ce('0x4f'),_0x5050a8);throw _0x5050a8;});}return _0x1709da;})['then'](respondWithResult(_0x3bc813,0xc9))[_0x02ce('0x42')](handleError(_0x3bc813,null));};exports['update']=function(_0x111861,_0x41f339){if(_0x111861[_0x02ce('0x46')]['id']){delete _0x111861[_0x02ce('0x46')]['id'];}return db[_0x02ce('0x2b')][_0x02ce('0x4c')]({'where':{'id':_0x111861[_0x02ce('0x43')]['id']}})['then'](handleEntityNotFound(_0x41f339,null))['then'](saveUpdates(_0x111861[_0x02ce('0x46')],null))[_0x02ce('0x23')](respondWithResult(_0x41f339,null))[_0x02ce('0x42')](handleError(_0x41f339,null));};exports[_0x02ce('0x24')]=function(_0x51db7a,_0x904d4e){return db['Disposition'][_0x02ce('0x4c')]({'where':{'id':_0x51db7a[_0x02ce('0x43')]['id']}})[_0x02ce('0x23')](handleEntityNotFound(_0x904d4e,null))[_0x02ce('0x23')](removeEntity(_0x904d4e,null))['catch'](handleError(_0x904d4e,null));}; \ No newline at end of file +var _0x724d=['../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','Dispositions','UserProfileResource','destroy','stack','name','send','index','map','Disposition','rawAttributes','fieldName','type','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','catch','show','params','length','includeAll','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','error','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x724d,0xe5));var _0xd724=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x724d[_0x465028];return _0xb783d4;};'use strict';var emlformat=require(_0xd724('0x0'));var rimraf=require(_0xd724('0x1'));var zipdir=require(_0xd724('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd724('0x3'));var moment=require(_0xd724('0x4'));var BPromise=require(_0xd724('0x5'));var Mustache=require(_0xd724('0x6'));var util=require(_0xd724('0x7'));var path=require(_0xd724('0x8'));var sox=require(_0xd724('0x9'));var csv=require(_0xd724('0xa'));var ejs=require(_0xd724('0xb'));var fs=require('fs');var fs_extra=require(_0xd724('0xc'));var _=require(_0xd724('0xd'));var squel=require(_0xd724('0xe'));var crypto=require(_0xd724('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xd724('0x10'));var toCsv=require(_0xd724('0xa'));var querystring=require(_0xd724('0x11'));var Papa=require(_0xd724('0x12'));var Redis=require(_0xd724('0x13'));var authService=require(_0xd724('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xd724('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd724('0x16'));var utils=require(_0xd724('0x17'));var config=require(_0xd724('0x18'));var licenseUtil=require(_0xd724('0x19'));var db=require(_0xd724('0x1a'))['db'];function respondWithStatusCode(_0x3628a4,_0x4438ca){_0x4438ca=_0x4438ca||0xcc;return function(_0x17e1ea){if(_0x17e1ea){return _0x3628a4[_0xd724('0x1b')](_0x4438ca);}return _0x3628a4[_0xd724('0x1c')](_0x4438ca)[_0xd724('0x1d')]();};}function respondWithResult(_0x1a20c9,_0x3a9867){_0x3a9867=_0x3a9867||0xc8;return function(_0x1017d6){if(_0x1017d6){return _0x1a20c9[_0xd724('0x1c')](_0x3a9867)[_0xd724('0x1e')](_0x1017d6);}};}function respondWithFilteredResult(_0x48f9f7,_0x24a95d){return function(_0x29f82c){if(_0x29f82c){var _0x394ffc=typeof _0x24a95d[_0xd724('0x1f')]===_0xd724('0x20')&&typeof _0x24a95d[_0xd724('0x21')]===_0xd724('0x20');var _0x4572a9=_0x29f82c[_0xd724('0x22')];var _0x734b54=_0x394ffc?0x0:_0x24a95d[_0xd724('0x1f')];var _0x32985b=_0x394ffc?_0x29f82c[_0xd724('0x22')]:_0x24a95d[_0xd724('0x1f')]+_0x24a95d[_0xd724('0x21')];var _0x50d5ea;if(_0x32985b>=_0x4572a9){_0x32985b=_0x4572a9;_0x50d5ea=0xc8;}else{_0x50d5ea=0xce;}_0x48f9f7['status'](_0x50d5ea);return _0x48f9f7[_0xd724('0x23')](_0xd724('0x24'),_0x734b54+'-'+_0x32985b+'/'+_0x4572a9)[_0xd724('0x1e')](_0x29f82c);}return null;};}function patchUpdates(_0x180411){return function(_0x1bc827){try{jsonpatch[_0xd724('0x25')](_0x1bc827,_0x180411,!![]);}catch(_0x24d90a){return BPromise[_0xd724('0x26')](_0x24d90a);}return _0x1bc827[_0xd724('0x27')]();};}function saveUpdates(_0x379d26,_0x588079){return function(_0x135955){if(_0x135955){return _0x135955[_0xd724('0x28')](_0x379d26)['then'](function(_0x9b0f81){return _0x9b0f81;});}return null;};}function removeEntity(_0x4a4a0c,_0x8fa74){return function(_0x1522d2){if(_0x1522d2){return _0x1522d2['destroy']()[_0xd724('0x29')](function(){var _0x40ce02=_0x1522d2['get']({'plain':!![]});var _0x2af376=_0xd724('0x2a');return db[_0xd724('0x2b')][_0xd724('0x2c')]({'where':{'type':_0x2af376,'resourceId':_0x40ce02['id']}})[_0xd724('0x29')](function(){return _0x1522d2;});})[_0xd724('0x29')](function(){_0x4a4a0c[_0xd724('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3efb1d,_0x40ee07){return function(_0x1bd735){if(!_0x1bd735){_0x3efb1d[_0xd724('0x1b')](0x194);}return _0x1bd735;};}function handleError(_0x425d74,_0x3dfb89){_0x3dfb89=_0x3dfb89||0x1f4;return function(_0x26b09a){logger['error'](_0x26b09a[_0xd724('0x2d')]);if(_0x26b09a[_0xd724('0x2e')]){delete _0x26b09a[_0xd724('0x2e')];}_0x425d74['status'](_0x3dfb89)[_0xd724('0x2f')](_0x26b09a);};}exports[_0xd724('0x30')]=function(_0x1ccb4b,_0x32fa73){var _0x398d77={},_0x133152={},_0x40f4e4={'count':0x0,'rows':[]};var _0x4e4b18=_[_0xd724('0x31')](db[_0xd724('0x32')][_0xd724('0x33')],function(_0x4dd410){return{'name':_0x4dd410[_0xd724('0x34')],'type':_0x4dd410[_0xd724('0x35')]['key']};});_0x133152['model']=_[_0xd724('0x31')](_0x4e4b18,_0xd724('0x2e'));_0x133152[_0xd724('0x36')]=_[_0xd724('0x37')](_0x1ccb4b['query']);_0x133152[_0xd724('0x38')]=_['intersection'](_0x133152[_0xd724('0x39')],_0x133152[_0xd724('0x36')]);_0x398d77[_0xd724('0x3a')]=_[_0xd724('0x3b')](_0x133152[_0xd724('0x39')],qs[_0xd724('0x3c')](_0x1ccb4b['query']['fields']));_0x398d77[_0xd724('0x3a')]=_0x398d77['attributes']['length']?_0x398d77['attributes']:_0x133152[_0xd724('0x39')];if(!_0x1ccb4b[_0xd724('0x36')][_0xd724('0x3d')](_0xd724('0x3e'))){_0x398d77[_0xd724('0x21')]=qs['limit'](_0x1ccb4b[_0xd724('0x36')][_0xd724('0x21')]);_0x398d77['offset']=qs[_0xd724('0x1f')](_0x1ccb4b[_0xd724('0x36')][_0xd724('0x1f')]);}_0x398d77[_0xd724('0x3f')]=qs[_0xd724('0x40')](_0x1ccb4b[_0xd724('0x36')][_0xd724('0x40')]);_0x398d77[_0xd724('0x41')]=qs['filters'](_['pick'](_0x1ccb4b[_0xd724('0x36')],_0x133152[_0xd724('0x38')]),_0x4e4b18);if(_0x1ccb4b[_0xd724('0x36')][_0xd724('0x42')]){_0x398d77[_0xd724('0x41')]=_[_0xd724('0x43')](_0x398d77[_0xd724('0x41')],{'$or':_['map'](_0x4e4b18,function(_0x1ad11d){if(_0x1ad11d[_0xd724('0x35')]!==_0xd724('0x44')){var _0x1829b2={};_0x1829b2[_0x1ad11d['name']]={'$like':'%'+_0x1ccb4b[_0xd724('0x36')][_0xd724('0x42')]+'%'};return _0x1829b2;}})});}_0x398d77=_[_0xd724('0x43')]({},_0x398d77,_0x1ccb4b[_0xd724('0x45')]);var _0x441839={'where':_0x398d77[_0xd724('0x41')]};return db['Disposition']['count'](_0x441839)[_0xd724('0x29')](function(_0x9bdf3d){_0x40f4e4[_0xd724('0x22')]=_0x9bdf3d;if(_0x1ccb4b['query']['includeAll']){_0x398d77['include']=[{'all':!![]}];}return db[_0xd724('0x32')]['findAll'](_0x398d77);})[_0xd724('0x29')](function(_0x2487d4){_0x40f4e4['rows']=_0x2487d4;return _0x40f4e4;})['then'](respondWithFilteredResult(_0x32fa73,_0x398d77))[_0xd724('0x46')](handleError(_0x32fa73,null));};exports[_0xd724('0x47')]=function(_0x499034,_0x512be9){var _0xd92041={'raw':!![],'where':{'id':_0x499034[_0xd724('0x48')]['id']}},_0x5a9da0={};_0x5a9da0[_0xd724('0x39')]=_[_0xd724('0x37')](db[_0xd724('0x32')][_0xd724('0x33')]);_0x5a9da0[_0xd724('0x36')]=_[_0xd724('0x37')](_0x499034[_0xd724('0x36')]);_0x5a9da0[_0xd724('0x38')]=_[_0xd724('0x3b')](_0x5a9da0[_0xd724('0x39')],_0x5a9da0[_0xd724('0x36')]);_0xd92041[_0xd724('0x3a')]=_[_0xd724('0x3b')](_0x5a9da0['model'],qs['fields'](_0x499034[_0xd724('0x36')]['fields']));_0xd92041[_0xd724('0x3a')]=_0xd92041['attributes'][_0xd724('0x49')]?_0xd92041['attributes']:_0x5a9da0['model'];if(_0x499034[_0xd724('0x36')][_0xd724('0x4a')]){_0xd92041['include']=[{'all':!![]}];}_0xd92041=_[_0xd724('0x43')]({},_0xd92041,_0x499034[_0xd724('0x45')]);return db[_0xd724('0x32')]['find'](_0xd92041)[_0xd724('0x29')](handleEntityNotFound(_0x512be9,null))[_0xd724('0x29')](respondWithResult(_0x512be9,null))[_0xd724('0x46')](handleError(_0x512be9,null));};exports[_0xd724('0x4b')]=function(_0x334295,_0xbc3b0f){return db[_0xd724('0x32')][_0xd724('0x4b')](_0x334295[_0xd724('0x4c')],{})[_0xd724('0x29')](function(_0xa8c823){var _0x1b90f1=_0x334295[_0xd724('0x4d')][_0xd724('0x4e')]({'plain':!![]});if(!_0x1b90f1)throw new Error(_0xd724('0x4f'));if(_0x1b90f1['role']===_0xd724('0x4d')){var _0x1acf63=_0xa8c823['get']({'plain':!![]});var _0x2ce650=_0xd724('0x2a');return db[_0xd724('0x50')][_0xd724('0x51')]({'where':{'name':_0x2ce650,'userProfileId':_0x1b90f1[_0xd724('0x52')]},'raw':!![]})[_0xd724('0x29')](function(_0x2d5a7a){if(_0x2d5a7a&&_0x2d5a7a[_0xd724('0x53')]===0x0){return db[_0xd724('0x2b')][_0xd724('0x4b')]({'name':_0x1acf63[_0xd724('0x2e')],'resourceId':_0x1acf63['id'],'type':_0x2d5a7a[_0xd724('0x2e')],'sectionId':_0x2d5a7a['id']},{})[_0xd724('0x29')](function(){return _0xa8c823;});}else{return _0xa8c823;}})[_0xd724('0x46')](function(_0x27f4cb){logger[_0xd724('0x54')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x27f4cb);throw _0x27f4cb;});}return _0xa8c823;})[_0xd724('0x29')](respondWithResult(_0xbc3b0f,0xc9))[_0xd724('0x46')](handleError(_0xbc3b0f,null));};exports[_0xd724('0x28')]=function(_0x5ec3e3,_0x1c4cff){if(_0x5ec3e3['body']['id']){delete _0x5ec3e3[_0xd724('0x4c')]['id'];}return db[_0xd724('0x32')][_0xd724('0x51')]({'where':{'id':_0x5ec3e3[_0xd724('0x48')]['id']}})[_0xd724('0x29')](handleEntityNotFound(_0x1c4cff,null))[_0xd724('0x29')](saveUpdates(_0x5ec3e3[_0xd724('0x4c')],null))[_0xd724('0x29')](respondWithResult(_0x1c4cff,null))['catch'](handleError(_0x1c4cff,null));};exports[_0xd724('0x2c')]=function(_0x66883d,_0x91ed45){return db[_0xd724('0x32')][_0xd724('0x51')]({'where':{'id':_0x66883d['params']['id']}})['then'](handleEntityNotFound(_0x91ed45,null))[_0xd724('0x29')](removeEntity(_0x91ed45,null))[_0xd724('0x46')](handleError(_0x91ed45,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 7574c8d..4c9af4e 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 _0xb45e=['define','Disposition','name_voice','name','ChatWebsiteId','name_mail','name_sms','SmsAccountId','name_fax','FaxAccountId','WhatsappAccountId','lodash','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','exports'];(function(_0xb21d1e,_0xa1080){var _0x10d11e=function(_0x3be91e){while(--_0x3be91e){_0xb21d1e['push'](_0xb21d1e['shift']());}};_0x10d11e(++_0xa1080);}(_0xb45e,0x90));var _0xeb45=function(_0x420048,_0x2c2393){_0x420048=_0x420048-0x0;var _0x4d4c73=_0xb45e[_0x420048];return _0x4d4c73;};'use strict';var _=require(_0xeb45('0x0'));var util=require('util');var logger=require(_0xeb45('0x1'))(_0xeb45('0x2'));var moment=require(_0xeb45('0x3'));var BPromise=require('bluebird');var rp=require(_0xeb45('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xeb45('0x5'));var config=require(_0xeb45('0x6'));var attributes=require('./disposition.attributes');module[_0xeb45('0x7')]=function(_0x26c885,_0x4c6dac){return _0x26c885[_0xeb45('0x8')](_0xeb45('0x9'),attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':_0xeb45('0xa'),'fields':[_0xeb45('0xb'),'ListId']},{'unique':!![],'name':'name_chat','fields':['name',_0xeb45('0xc')]},{'unique':!![],'name':_0xeb45('0xd'),'fields':['name','MailAccountId']},{'unique':!![],'name':_0xeb45('0xe'),'fields':[_0xeb45('0xb'),_0xeb45('0xf')]},{'unique':!![],'name':_0xeb45('0x10'),'fields':[_0xeb45('0xb'),_0xeb45('0x11')]},{'unique':!![],'name':'name_openchannel','fields':[_0xeb45('0xb'),'OpenchannelAccountId']},{'unique':!![],'name':'name_whatsapp','fields':[_0xeb45('0xb'),_0xeb45('0x12')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf651=['name_fax','FaxAccountId','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','define','Disposition','name_voice','name','ListId','ChatWebsiteId','name_sms','SmsAccountId'];(function(_0x4201fe,_0x1948fe){var _0x581b60=function(_0x1dce96){while(--_0x1dce96){_0x4201fe['push'](_0x4201fe['shift']());}};_0x581b60(++_0x1948fe);}(_0xf651,0xec));var _0x1f65=function(_0x2261ce,_0x9ed8b6){_0x2261ce=_0x2261ce-0x0;var _0x524640=_0xf651[_0x2261ce];return _0x524640;};'use strict';var _=require(_0x1f65('0x0'));var util=require(_0x1f65('0x1'));var logger=require(_0x1f65('0x2'))(_0x1f65('0x3'));var moment=require('moment');var BPromise=require(_0x1f65('0x4'));var rp=require(_0x1f65('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1f65('0x6'));var config=require(_0x1f65('0x7'));var attributes=require('./disposition.attributes');module['exports']=function(_0x495bd8,_0x5ec9da){return _0x495bd8[_0x1f65('0x8')](_0x1f65('0x9'),attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':_0x1f65('0xa'),'fields':[_0x1f65('0xb'),_0x1f65('0xc')]},{'unique':!![],'name':'name_chat','fields':['name',_0x1f65('0xd')]},{'unique':!![],'name':'name_mail','fields':['name','MailAccountId']},{'unique':!![],'name':_0x1f65('0xe'),'fields':['name',_0x1f65('0xf')]},{'unique':!![],'name':_0x1f65('0x10'),'fields':[_0x1f65('0xb'),_0x1f65('0x11')]},{'unique':!![],'name':'name_openchannel','fields':[_0x1f65('0xb'),_0x1f65('0x12')]},{'unique':!![],'name':_0x1f65('0x13'),'fields':[_0x1f65('0xb'),_0x1f65('0x14')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index abdf237..0953618 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(_0x746aca,_0x414da5){var _0x2fad74=function(_0x519d3c){while(--_0x519d3c){_0x746aca['push'](_0x746aca['shift']());}};_0x2fad74(++_0x414da5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +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(_0x50d101,_0x29b3f7){var _0x731b77=function(_0x2f5a55){while(--_0x2f5a55){_0x50d101['push'](_0x50d101['shift']());}};_0x731b77(++_0x29b3f7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0xa9e0[_0x1da04e];return _0xdd8c41;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index 71e1a75..a5d56df 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 _0xd946=['util','express','Router','fs-extra','../../components/auth/service','./disposition.controller','get','isAuthenticated','/:id','create','put','update','destroy'];(function(_0x470302,_0x54d2fd){var _0x42164f=function(_0x15db54){while(--_0x15db54){_0x470302['push'](_0x470302['shift']());}};_0x42164f(++_0x54d2fd);}(_0xd946,0x16c));var _0x6d94=function(_0x4efedd,_0x4b2260){_0x4efedd=_0x4efedd-0x0;var _0x31062c=_0xd946[_0x4efedd];return _0x31062c;};'use strict';var multer=require('multer');var util=require(_0x6d94('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6d94('0x1'));var router=express[_0x6d94('0x2')]();var fs_extra=require(_0x6d94('0x3'));var auth=require(_0x6d94('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6d94('0x5'));router[_0x6d94('0x6')]('/',auth[_0x6d94('0x7')](),controller['index']);router['get'](_0x6d94('0x8'),auth[_0x6d94('0x7')](),controller['show']);router['post']('/',auth[_0x6d94('0x7')](),controller[_0x6d94('0x9')]);router[_0x6d94('0xa')](_0x6d94('0x8'),auth['isAuthenticated'](),controller[_0x6d94('0xb')]);router['delete'](_0x6d94('0x8'),auth[_0x6d94('0x7')](),controller[_0x6d94('0xc')]);module['exports']=router; \ No newline at end of file +var _0x0e91=['post','create','put','update','destroy','exports','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','isAuthenticated','index','get','/:id','show'];(function(_0x3e9be1,_0x2fac9c){var _0x41518b=function(_0x5f19ed){while(--_0x5f19ed){_0x3e9be1['push'](_0x3e9be1['shift']());}};_0x41518b(++_0x2fac9c);}(_0x0e91,0x1a8));var _0x10e9=function(_0x18b5e8,_0x51e875){_0x18b5e8=_0x18b5e8-0x0;var _0x25baed=_0x0e91[_0x18b5e8];return _0x25baed;};'use strict';var multer=require(_0x10e9('0x0'));var util=require('util');var path=require(_0x10e9('0x1'));var timeout=require(_0x10e9('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x10e9('0x3'));var auth=require(_0x10e9('0x4'));var interaction=require(_0x10e9('0x5'));var config=require(_0x10e9('0x6'));var controller=require(_0x10e9('0x7'));router['get']('/',auth[_0x10e9('0x8')](),controller[_0x10e9('0x9')]);router[_0x10e9('0xa')](_0x10e9('0xb'),auth[_0x10e9('0x8')](),controller[_0x10e9('0xc')]);router[_0x10e9('0xd')]('/',auth[_0x10e9('0x8')](),controller[_0x10e9('0xe')]);router[_0x10e9('0xf')](_0x10e9('0xb'),auth[_0x10e9('0x8')](),controller[_0x10e9('0x10')]);router['delete'](_0x10e9('0xb'),auth[_0x10e9('0x8')](),controller[_0x10e9('0x11')]);module[_0x10e9('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 b3f20b9..8e6cb56 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 _0x1224=['2400','4800','7200','9600','12000','14400','v17,v27,v29','INTEGER','SIP','IAX','DADHI','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax'];(function(_0x51e79c,_0x51485e){var _0x2467be=function(_0xbf70f0){while(--_0xbf70f0){_0x51e79c['push'](_0x51e79c['shift']());}};_0x2467be(++_0x51485e);}(_0x1224,0x10d));var _0x4122=function(_0x5024cf,_0x27a833){_0x5024cf=_0x5024cf-0x0;var _0x4b6827=_0x1224[_0x5024cf];return _0x4b6827;};'use strict';var Sequelize=require(_0x4122('0x0'));module[_0x4122('0x1')]={'name':{'type':Sequelize[_0x4122('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x4122('0x2')]},'ecm':{'type':Sequelize[_0x4122('0x3')](_0x4122('0x4'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0x4122('0x2')],'defaultValue':_0x4122('0x5')},'localstationid':{'type':Sequelize[_0x4122('0x2')],'unique':'localstationid'},'minrate':{'type':Sequelize[_0x4122('0x3')](_0x4122('0x6'),_0x4122('0x7'),_0x4122('0x8'),_0x4122('0x9'),_0x4122('0xa'),_0x4122('0xb')),'defaultValue':_0x4122('0x7')},'maxrate':{'type':Sequelize[_0x4122('0x3')](_0x4122('0x6'),_0x4122('0x7'),_0x4122('0x8'),_0x4122('0x9'),_0x4122('0xa'),_0x4122('0xb')),'defaultValue':_0x4122('0xb')},'modem':{'type':Sequelize[_0x4122('0x2')],'defaultValue':_0x4122('0xc')},'gateway':{'type':Sequelize[_0x4122('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x4122('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x4122('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x4122('0x3')](_0x4122('0xe'),_0x4122('0xf'),_0x4122('0x10'),_0x4122('0x11')),'defaultValue':_0x4122('0xe')},'key':{'type':Sequelize[_0x4122('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x4122('0x12')],'defaultValue':function(){return _0x4122('0x13');}},'notificationSound':{'type':Sequelize[_0x4122('0x14')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x4122('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x4122('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x4122('0x14')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x4122('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x4122('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x4122('0xd')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x4122('0x14')],'defaultValue':![],'comment':_0x4122('0x15'),'set':function(_0x399003){if(!_0x399003)this[_0x4122('0x16')](_0x4122('0x17'),null);this[_0x4122('0x16')](_0x4122('0x18'),_0x399003);}}}; \ No newline at end of file +var _0x6050=['BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','4800','14400','2400','9600','12000','v17,v27,v29','INTEGER','SIP','IAX','DADHI','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6050,0x196));var _0x0605=function(_0x37eb61,_0x50ee65){_0x37eb61=_0x37eb61-0x0;var _0x595569=_0x6050[_0x37eb61];return _0x595569;};'use strict';var Sequelize=require(_0x0605('0x0'));module[_0x0605('0x1')]={'name':{'type':Sequelize[_0x0605('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x0605('0x2')]},'ecm':{'type':Sequelize[_0x0605('0x3')](_0x0605('0x4'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0x0605('0x2')],'defaultValue':_0x0605('0x5')},'localstationid':{'type':Sequelize[_0x0605('0x2')],'unique':'localstationid'},'minrate':{'type':Sequelize['ENUM']('2400',_0x0605('0x6'),'7200','9600','12000',_0x0605('0x7')),'defaultValue':_0x0605('0x6')},'maxrate':{'type':Sequelize[_0x0605('0x3')](_0x0605('0x8'),_0x0605('0x6'),'7200',_0x0605('0x9'),_0x0605('0xa'),_0x0605('0x7')),'defaultValue':_0x0605('0x7')},'modem':{'type':Sequelize[_0x0605('0x2')],'defaultValue':_0x0605('0xb')},'gateway':{'type':Sequelize[_0x0605('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x0605('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x0605('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x0605('0x3')](_0x0605('0xd'),_0x0605('0xe'),_0x0605('0xf'),_0x0605('0x10')),'defaultValue':_0x0605('0xd')},'key':{'type':Sequelize[_0x0605('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x0605('0x11')],'defaultValue':function(){return _0x0605('0x12');}},'notificationSound':{'type':Sequelize[_0x0605('0x13')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x0605('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x0605('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x0605('0x13')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x0605('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0605('0xc')],'allowNull':!![],'defaultValue':null,'comment':_0x0605('0x14')},'mandatoryDisposition':{'type':Sequelize[_0x0605('0x13')],'defaultValue':![],'comment':_0x0605('0x15'),'set':function(_0x351dbd){if(!_0x351dbd)this[_0x0605('0x16')](_0x0605('0x17'),null);this[_0x0605('0x16')](_0x0605('0x18'),_0x351dbd);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 2fd32c6..425b8c5 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 _0x0cee=['status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','get','FaxAccounts','UserProfileResource','end','send','index','Pause','mandatoryDispositionPause','FaxAccount','rawAttributes','key','model','map','name','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','show','keys','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','params','body','describe','addDisposition','getDispositions','Disposition','nolimit','include','removeDispositions','addAnswer','FaxAccountId','CannedAnswer','getAnswers','findOne','removeAnswers','ids','addInteraction','omit','getInteractions','FaxInteraction','CmContact','Contact','User','Owner','fullname','Tag','Tags','color','tag','addApplications','transaction','sequelize','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','priority','stack','finally','getApplications','context','from-voip-provider','localstationid','type','system','description','appdata','push','Answer','Set','gateway','faxdetect','headerinfo','maxrate','t38timeout','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','updateAccountApplications','VoiceExtension','tech','createdAt','TrunkId','ListId','findById','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','updatedAt','DESC','attachments','join','root','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','spread','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','message','FaxAccount,\x20%s,\x20%s','result','catch','sendStatus'];(function(_0xc74b85,_0x2238e2){var _0x221465=function(_0x1df87a){while(--_0x1df87a){_0xc74b85['push'](_0xc74b85['shift']());}};_0x221465(++_0x2238e2);}(_0x0cee,0x165));var _0xe0ce=function(_0x22caf7,_0x107218){_0x22caf7=_0x22caf7-0x0;var _0x3a843a=_0x0cee[_0x22caf7];return _0x3a843a;};'use strict';var emlformat=require(_0xe0ce('0x0'));var rimraf=require(_0xe0ce('0x1'));var zipdir=require(_0xe0ce('0x2'));var jsonpatch=require(_0xe0ce('0x3'));var rp=require('request-promise');var moment=require(_0xe0ce('0x4'));var BPromise=require(_0xe0ce('0x5'));var Mustache=require(_0xe0ce('0x6'));var util=require(_0xe0ce('0x7'));var path=require(_0xe0ce('0x8'));var sox=require(_0xe0ce('0x9'));var csv=require(_0xe0ce('0xa'));var ejs=require(_0xe0ce('0xb'));var fs=require('fs');var fs_extra=require(_0xe0ce('0xc'));var _=require('lodash');var squel=require(_0xe0ce('0xd'));var crypto=require(_0xe0ce('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe0ce('0xa'));var querystring=require('querystring');var Papa=require(_0xe0ce('0xf'));var Redis=require(_0xe0ce('0x10'));var authService=require(_0xe0ce('0x11'));var qs=require(_0xe0ce('0x12'));var as=require(_0xe0ce('0x13'));var hardwareService=require(_0xe0ce('0x14'));var logger=require(_0xe0ce('0x15'))(_0xe0ce('0x16'));var utils=require(_0xe0ce('0x17'));var config=require(_0xe0ce('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xe0ce('0x19'))['db'];config[_0xe0ce('0x1a')]=_[_0xe0ce('0x1b')](config['redis'],{'host':_0xe0ce('0x1c'),'port':0x18eb});var socket=require(_0xe0ce('0x1d'))(new Redis(config[_0xe0ce('0x1a')]));require(_0xe0ce('0x1e'))[_0xe0ce('0x1f')](socket);var jayson=require(_0xe0ce('0x20'));var client=jayson[_0xe0ce('0x21')][_0xe0ce('0x22')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x31faa2,_0x6a24e7,_0x405535,_0x41498a){return new BPromise(function(_0x183e43,_0x42a68f){var _0x4d4711=_0x41498a||client;return _0x4d4711[_0xe0ce('0x23')](_0x31faa2,_0x405535)[_0xe0ce('0x24')](function(_0x1da59f){logger[_0xe0ce('0x25')]('FaxAccount,\x20%s,\x20%s',_0x6a24e7,_0xe0ce('0x26'));logger[_0xe0ce('0x27')](_0xe0ce('0x28'),_0x6a24e7,_0xe0ce('0x26'),JSON['stringify'](_0x1da59f));if(_0x1da59f[_0xe0ce('0x29')]){if(_0x1da59f[_0xe0ce('0x29')]['code']===0x1f4){logger[_0xe0ce('0x29')]('FaxAccount,\x20%s,\x20%s',_0x6a24e7,_0x1da59f[_0xe0ce('0x29')]['message']);return _0x42a68f(_0x1da59f['error'][_0xe0ce('0x2a')]);}logger[_0xe0ce('0x29')]('FaxAccount,\x20%s,\x20%s',_0x6a24e7,_0x1da59f[_0xe0ce('0x29')]['message']);return _0x183e43(_0x1da59f[_0xe0ce('0x29')]['message']);}else{logger[_0xe0ce('0x25')](_0xe0ce('0x2b'),_0x6a24e7,_0xe0ce('0x26'));_0x183e43(_0x1da59f[_0xe0ce('0x2c')][_0xe0ce('0x2a')]);}})[_0xe0ce('0x2d')](function(_0x2ab98f){logger[_0xe0ce('0x29')](_0xe0ce('0x2b'),_0x6a24e7,_0x2ab98f);_0x42a68f(_0x2ab98f);});});}function respondWithStatusCode(_0x3151fa,_0x5479c7){_0x5479c7=_0x5479c7||0xcc;return function(_0x8ec838){if(_0x8ec838){return _0x3151fa[_0xe0ce('0x2e')](_0x5479c7);}return _0x3151fa[_0xe0ce('0x2f')](_0x5479c7)['end']();};}function respondWithResult(_0x3c8539,_0x13feb3){_0x13feb3=_0x13feb3||0xc8;return function(_0x19b0f9){if(_0x19b0f9){return _0x3c8539[_0xe0ce('0x2f')](_0x13feb3)['json'](_0x19b0f9);}};}function respondWithFilteredResult(_0x497b77,_0xae805){return function(_0x586bc2){if(_0x586bc2){var _0x369c77=typeof _0xae805[_0xe0ce('0x30')]===_0xe0ce('0x31')&&typeof _0xae805[_0xe0ce('0x32')]===_0xe0ce('0x31');var _0x3c4997=_0x586bc2['count'];var _0x24fb66=_0x369c77?0x0:_0xae805[_0xe0ce('0x30')];var _0x3beb5a=_0x369c77?_0x586bc2[_0xe0ce('0x33')]:_0xae805[_0xe0ce('0x30')]+_0xae805[_0xe0ce('0x32')];var _0x339444;if(_0x3beb5a>=_0x3c4997){_0x3beb5a=_0x3c4997;_0x339444=0xc8;}else{_0x339444=0xce;}_0x497b77[_0xe0ce('0x2f')](_0x339444);return _0x497b77[_0xe0ce('0x34')](_0xe0ce('0x35'),_0x24fb66+'-'+_0x3beb5a+'/'+_0x3c4997)['json'](_0x586bc2);}return null;};}function patchUpdates(_0x13d2fd){return function(_0x1ad953){try{jsonpatch[_0xe0ce('0x36')](_0x1ad953,_0x13d2fd,!![]);}catch(_0x2f941){return BPromise[_0xe0ce('0x37')](_0x2f941);}return _0x1ad953[_0xe0ce('0x38')]();};}function saveUpdates(_0x5255d9,_0x5721ba){return function(_0x1c9751){if(_0x1c9751){return _0x1c9751['update'](_0x5255d9)[_0xe0ce('0x24')](function(_0x53249e){return _0x53249e;});}return null;};}function removeEntity(_0x52b421,_0x38f59e){return function(_0x24cea5){if(_0x24cea5){return _0x24cea5[_0xe0ce('0x39')]()[_0xe0ce('0x24')](function(){var _0x46d1e9=_0x24cea5[_0xe0ce('0x3a')]({'plain':!![]});var _0x4c1814=_0xe0ce('0x3b');return db[_0xe0ce('0x3c')][_0xe0ce('0x39')]({'where':{'type':_0x4c1814,'resourceId':_0x46d1e9['id']}})['then'](function(){return _0x24cea5;});})[_0xe0ce('0x24')](function(){_0x52b421['status'](0xcc)[_0xe0ce('0x3d')]();});}};}function handleEntityNotFound(_0x588d74,_0x30677a){return function(_0x394a60){if(!_0x394a60){_0x588d74['sendStatus'](0x194);}return _0x394a60;};}function handleError(_0x3c145c,_0x8af44){_0x8af44=_0x8af44||0x1f4;return function(_0x14b1d4){logger[_0xe0ce('0x29')](_0x14b1d4['stack']);if(_0x14b1d4['name']){delete _0x14b1d4['name'];}_0x3c145c[_0xe0ce('0x2f')](_0x8af44)[_0xe0ce('0x3e')](_0x14b1d4);};}exports[_0xe0ce('0x3f')]=function(_0x3c27a5,_0x3088a5){var _0x40ff8d={'include':[{'model':db[_0xe0ce('0x40')],'as':_0xe0ce('0x41')}]},_0x95306={},_0x5e5dbe={'count':0x0,'rows':[]};var _0x2590cc=_['map'](db[_0xe0ce('0x42')][_0xe0ce('0x43')],function(_0x299196){return{'name':_0x299196['fieldName'],'type':_0x299196['type'][_0xe0ce('0x44')]};});_0x95306[_0xe0ce('0x45')]=_[_0xe0ce('0x46')](_0x2590cc,_0xe0ce('0x47'));_0x95306[_0xe0ce('0x48')]=_['keys'](_0x3c27a5[_0xe0ce('0x48')]);_0x95306[_0xe0ce('0x49')]=_[_0xe0ce('0x4a')](_0x95306[_0xe0ce('0x45')],_0x95306[_0xe0ce('0x48')]);_0x40ff8d[_0xe0ce('0x4b')]=_[_0xe0ce('0x4a')](_0x95306['model'],qs['fields'](_0x3c27a5[_0xe0ce('0x48')][_0xe0ce('0x4c')]));_0x40ff8d[_0xe0ce('0x4b')]=_0x40ff8d[_0xe0ce('0x4b')][_0xe0ce('0x4d')]?_0x40ff8d['attributes']:_0x95306[_0xe0ce('0x45')];if(!_0x3c27a5['query'][_0xe0ce('0x4e')]('nolimit')){_0x40ff8d['limit']=qs['limit'](_0x3c27a5[_0xe0ce('0x48')][_0xe0ce('0x32')]);_0x40ff8d['offset']=qs['offset'](_0x3c27a5[_0xe0ce('0x48')]['offset']);}_0x40ff8d[_0xe0ce('0x4f')]=qs[_0xe0ce('0x50')](_0x3c27a5[_0xe0ce('0x48')][_0xe0ce('0x50')]);_0x40ff8d[_0xe0ce('0x51')]=qs[_0xe0ce('0x49')](_[_0xe0ce('0x52')](_0x3c27a5['query'],_0x95306[_0xe0ce('0x49')]),_0x2590cc);if(_0x3c27a5[_0xe0ce('0x48')][_0xe0ce('0x53')]){_0x40ff8d[_0xe0ce('0x51')]=_['merge'](_0x40ff8d[_0xe0ce('0x51')],{'$or':_[_0xe0ce('0x46')](_0x2590cc,function(_0x43c87d){if(_0x43c87d['type']!==_0xe0ce('0x54')){var _0x2d7714={};_0x2d7714[_0x43c87d[_0xe0ce('0x47')]]={'$like':'%'+_0x3c27a5[_0xe0ce('0x48')][_0xe0ce('0x53')]+'%'};return _0x2d7714;}})});}_0x40ff8d=_[_0xe0ce('0x55')]({},_0x40ff8d,_0x3c27a5[_0xe0ce('0x56')]);var _0x38f34b={'where':_0x40ff8d['where']};return db[_0xe0ce('0x42')]['count'](_0x38f34b)[_0xe0ce('0x24')](function(_0xf7af7e){_0x5e5dbe['count']=_0xf7af7e;if(_0x3c27a5['query'][_0xe0ce('0x57')]){_0x40ff8d['include']=[{'all':!![]}];}return db[_0xe0ce('0x42')][_0xe0ce('0x58')](_0x40ff8d);})[_0xe0ce('0x24')](function(_0x449a72){_0x5e5dbe[_0xe0ce('0x59')]=_0x449a72;return _0x5e5dbe;})[_0xe0ce('0x24')](respondWithFilteredResult(_0x3088a5,_0x40ff8d))['catch'](handleError(_0x3088a5,null));};exports[_0xe0ce('0x5a')]=function(_0x3ba19b,_0x198a54){var _0x316b4b={'raw':![],'where':{'id':_0x3ba19b['params']['id']},'include':[{'model':db['Pause'],'as':_0xe0ce('0x41')}]},_0x16156e={};_0x16156e[_0xe0ce('0x45')]=_[_0xe0ce('0x5b')](db[_0xe0ce('0x42')][_0xe0ce('0x43')]);_0x16156e[_0xe0ce('0x48')]=_[_0xe0ce('0x5b')](_0x3ba19b[_0xe0ce('0x48')]);_0x16156e[_0xe0ce('0x49')]=_[_0xe0ce('0x4a')](_0x16156e[_0xe0ce('0x45')],_0x16156e[_0xe0ce('0x48')]);_0x316b4b['attributes']=_[_0xe0ce('0x4a')](_0x16156e['model'],qs[_0xe0ce('0x4c')](_0x3ba19b[_0xe0ce('0x48')]['fields']));_0x316b4b[_0xe0ce('0x4b')]=_0x316b4b[_0xe0ce('0x4b')][_0xe0ce('0x4d')]?_0x316b4b[_0xe0ce('0x4b')]:_0x16156e[_0xe0ce('0x45')];if(_0x3ba19b[_0xe0ce('0x48')][_0xe0ce('0x57')]){_0x316b4b['include']=[{'all':!![]}];}_0x316b4b=_[_0xe0ce('0x55')]({},_0x316b4b,_0x3ba19b[_0xe0ce('0x56')]);return db[_0xe0ce('0x42')][_0xe0ce('0x5c')](_0x316b4b)['then'](handleEntityNotFound(_0x198a54,null))[_0xe0ce('0x24')](respondWithResult(_0x198a54,null))[_0xe0ce('0x2d')](handleError(_0x198a54,null));};exports[_0xe0ce('0x5d')]=function(_0x42c23f,_0xef8964){return db[_0xe0ce('0x42')][_0xe0ce('0x5d')](_0x42c23f['body'],{})[_0xe0ce('0x24')](function(_0x507d65){var _0x186ed6=_0x42c23f[_0xe0ce('0x5e')][_0xe0ce('0x3a')]({'plain':!![]});if(!_0x186ed6)throw new Error(_0xe0ce('0x5f'));if(_0x186ed6[_0xe0ce('0x60')]===_0xe0ce('0x5e')){var _0x283590=_0x507d65[_0xe0ce('0x3a')]({'plain':!![]});var _0x1fc25b=_0xe0ce('0x3b');return db[_0xe0ce('0x61')]['find']({'where':{'name':_0x1fc25b,'userProfileId':_0x186ed6[_0xe0ce('0x62')]},'raw':!![]})['then'](function(_0x4e5f7e){if(_0x4e5f7e&&_0x4e5f7e[_0xe0ce('0x63')]===0x0){return db[_0xe0ce('0x3c')]['create']({'name':_0x283590[_0xe0ce('0x47')],'resourceId':_0x283590['id'],'type':_0x4e5f7e[_0xe0ce('0x47')],'sectionId':_0x4e5f7e['id']},{})[_0xe0ce('0x24')](function(){return _0x507d65;});}else{return _0x507d65;}})[_0xe0ce('0x2d')](function(_0x573634){logger[_0xe0ce('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x573634);throw _0x573634;});}return _0x507d65;})[_0xe0ce('0x24')](respondWithResult(_0xef8964,0xc9))['catch'](handleError(_0xef8964,null));};exports['update']=function(_0x444899,_0x1d1adf){if(_0x444899['body']['id']){delete _0x444899['body']['id'];}return db[_0xe0ce('0x42')][_0xe0ce('0x5c')]({'where':{'id':_0x444899[_0xe0ce('0x64')]['id']},'include':[{'model':db[_0xe0ce('0x40')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x1d1adf,null))[_0xe0ce('0x24')](saveUpdates(_0x444899[_0xe0ce('0x65')],null))[_0xe0ce('0x24')](respondWithResult(_0x1d1adf,null))['catch'](handleError(_0x1d1adf,null));};exports[_0xe0ce('0x39')]=function(_0x33ae93,_0x2d5b92){return db[_0xe0ce('0x42')]['find']({'where':{'id':_0x33ae93['params']['id']}})[_0xe0ce('0x24')](handleEntityNotFound(_0x2d5b92,null))['then'](removeEntity(_0x2d5b92,null))[_0xe0ce('0x2d')](handleError(_0x2d5b92,null));};exports['describe']=function(_0x884a01,_0x493eb7){return db['FaxAccount'][_0xe0ce('0x66')]()[_0xe0ce('0x24')](respondWithResult(_0x493eb7,null))[_0xe0ce('0x2d')](handleError(_0x493eb7,null));};exports[_0xe0ce('0x67')]=function(_0x555f84,_0x41b9fa,_0x568c23){if(_0x555f84[_0xe0ce('0x65')]['id']){delete _0x555f84[_0xe0ce('0x65')]['id'];}return db[_0xe0ce('0x42')][_0xe0ce('0x5c')]({'where':{'id':_0x555f84[_0xe0ce('0x64')]['id']}})['then'](handleEntityNotFound(_0x41b9fa,null))['then'](function(_0x5c898c){if(_0x5c898c){_0x555f84[_0xe0ce('0x65')]['FaxAccountId']=_0x5c898c['id'];return db['Disposition']['create'](_0x555f84[_0xe0ce('0x65')]);}})['then'](respondWithResult(_0x41b9fa,null))[_0xe0ce('0x2d')](handleError(_0x41b9fa,null));};exports[_0xe0ce('0x68')]=function(_0x3c1fa8,_0x4e0d5c,_0x36c887){var _0x3c8bbb={'raw':![],'where':{}};var _0x32c9ff={};var _0x1cebcc={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x3c1fa8[_0xe0ce('0x64')]['id']}})[_0xe0ce('0x24')](handleEntityNotFound(_0x4e0d5c,null))[_0xe0ce('0x24')](function(_0x3eda5a){if(_0x3eda5a){_0x32c9ff[_0xe0ce('0x45')]=_[_0xe0ce('0x5b')](db[_0xe0ce('0x69')][_0xe0ce('0x43')]);_0x32c9ff[_0xe0ce('0x48')]=_['keys'](_0x3c1fa8[_0xe0ce('0x48')]);_0x32c9ff[_0xe0ce('0x49')]=_['intersection'](_0x32c9ff[_0xe0ce('0x45')],_0x32c9ff[_0xe0ce('0x48')]);_0x3c8bbb['attributes']=_['intersection'](_0x32c9ff[_0xe0ce('0x45')],qs[_0xe0ce('0x4c')](_0x3c1fa8[_0xe0ce('0x48')][_0xe0ce('0x4c')]));_0x3c8bbb[_0xe0ce('0x4b')]=_0x3c8bbb['attributes'][_0xe0ce('0x4d')]?_0x3c8bbb[_0xe0ce('0x4b')]:_0x32c9ff[_0xe0ce('0x45')];if(!_0x3c1fa8[_0xe0ce('0x48')][_0xe0ce('0x4e')](_0xe0ce('0x6a'))){_0x3c8bbb[_0xe0ce('0x32')]=qs['limit'](_0x3c1fa8[_0xe0ce('0x48')]['limit']);_0x3c8bbb[_0xe0ce('0x30')]=qs[_0xe0ce('0x30')](_0x3c1fa8['query'][_0xe0ce('0x30')]);}_0x3c8bbb[_0xe0ce('0x4f')]=qs['sort'](_0x3c1fa8[_0xe0ce('0x48')]['sort']);_0x3c8bbb['where']=qs['filters'](_[_0xe0ce('0x52')](_0x3c1fa8['query'],_0x32c9ff[_0xe0ce('0x49')]));_0x3c8bbb[_0xe0ce('0x51')]['FaxAccountId']=_0x3eda5a['id'];if(_0x3c1fa8[_0xe0ce('0x48')][_0xe0ce('0x53')]){_0x3c8bbb[_0xe0ce('0x51')]=_[_0xe0ce('0x55')](_0x3c8bbb[_0xe0ce('0x51')],{'$or':_[_0xe0ce('0x46')](_0x3c8bbb[_0xe0ce('0x4b')],function(_0x2b33f9){var _0x121ddd={};_0x121ddd[_0x2b33f9]={'$like':'%'+_0x3c1fa8[_0xe0ce('0x48')]['filter']+'%'};return _0x121ddd;})});}_0x3c8bbb=_[_0xe0ce('0x55')]({},_0x3c8bbb,_0x3c1fa8[_0xe0ce('0x56')]);return db['Disposition']['count']({'where':_0x3c8bbb['where']})['then'](function(_0x50b8c8){_0x1cebcc[_0xe0ce('0x33')]=_0x50b8c8;if(_0x3c1fa8[_0xe0ce('0x48')][_0xe0ce('0x57')]){_0x3c8bbb[_0xe0ce('0x6b')]=[{'all':!![]}];}return db[_0xe0ce('0x69')][_0xe0ce('0x58')](_0x3c8bbb);})['then'](function(_0x51fa9f){_0x1cebcc['rows']=_0x51fa9f;return _0x1cebcc;});}})['then'](respondWithFilteredResult(_0x4e0d5c,_0x3c8bbb))['catch'](handleError(_0x4e0d5c,null));};exports[_0xe0ce('0x6c')]=function(_0xcc9b1a,_0x1578b1,_0x2af62f){return db[_0xe0ce('0x42')][_0xe0ce('0x5c')]({'where':{'id':_0xcc9b1a[_0xe0ce('0x64')]['id']}})[_0xe0ce('0x24')](handleEntityNotFound(_0x1578b1,null))[_0xe0ce('0x24')](function(_0x19fb10){if(_0x19fb10){return _0x19fb10[_0xe0ce('0x6c')](_0xcc9b1a['query']['ids']);}})[_0xe0ce('0x24')](respondWithStatusCode(_0x1578b1,null))[_0xe0ce('0x2d')](handleError(_0x1578b1,null));};exports[_0xe0ce('0x6d')]=function(_0x5996a6,_0x1e6c5d,_0x4e2107){if(_0x5996a6[_0xe0ce('0x65')]['id']){delete _0x5996a6[_0xe0ce('0x65')]['id'];}return db[_0xe0ce('0x42')][_0xe0ce('0x5c')]({'where':{'id':_0x5996a6[_0xe0ce('0x64')]['id']}})['then'](handleEntityNotFound(_0x1e6c5d,null))[_0xe0ce('0x24')](function(_0x1cf2ef){if(_0x1cf2ef){_0x5996a6[_0xe0ce('0x65')][_0xe0ce('0x6e')]=_0x1cf2ef['id'];return db[_0xe0ce('0x6f')][_0xe0ce('0x5d')](_0x5996a6[_0xe0ce('0x65')]);}})[_0xe0ce('0x24')](respondWithResult(_0x1e6c5d,null))[_0xe0ce('0x2d')](handleError(_0x1e6c5d,null));};exports[_0xe0ce('0x70')]=function(_0x4e2d35,_0x2112bf,_0x39ea54){var _0x1096e1={'raw':![],'where':{}};var _0xdab2dd={};var _0xc85c4a={'count':0x0,'rows':[]};return db[_0xe0ce('0x42')][_0xe0ce('0x71')]({'where':{'id':_0x4e2d35['params']['id']}})[_0xe0ce('0x24')](handleEntityNotFound(_0x2112bf,null))[_0xe0ce('0x24')](function(_0x4f644e){if(_0x4f644e){_0xdab2dd[_0xe0ce('0x45')]=_[_0xe0ce('0x5b')](db['CannedAnswer']['rawAttributes']);_0xdab2dd[_0xe0ce('0x48')]=_[_0xe0ce('0x5b')](_0x4e2d35[_0xe0ce('0x48')]);_0xdab2dd[_0xe0ce('0x49')]=_['intersection'](_0xdab2dd[_0xe0ce('0x45')],_0xdab2dd['query']);_0x1096e1[_0xe0ce('0x4b')]=_[_0xe0ce('0x4a')](_0xdab2dd['model'],qs['fields'](_0x4e2d35[_0xe0ce('0x48')]['fields']));_0x1096e1[_0xe0ce('0x4b')]=_0x1096e1[_0xe0ce('0x4b')][_0xe0ce('0x4d')]?_0x1096e1[_0xe0ce('0x4b')]:_0xdab2dd[_0xe0ce('0x45')];if(!_0x4e2d35[_0xe0ce('0x48')][_0xe0ce('0x4e')](_0xe0ce('0x6a'))){_0x1096e1[_0xe0ce('0x32')]=qs[_0xe0ce('0x32')](_0x4e2d35['query'][_0xe0ce('0x32')]);_0x1096e1['offset']=qs['offset'](_0x4e2d35[_0xe0ce('0x48')][_0xe0ce('0x30')]);}_0x1096e1['order']=qs[_0xe0ce('0x50')](_0x4e2d35[_0xe0ce('0x48')]['sort']);_0x1096e1['where']=qs[_0xe0ce('0x49')](_[_0xe0ce('0x52')](_0x4e2d35[_0xe0ce('0x48')],_0xdab2dd['filters']));_0x1096e1[_0xe0ce('0x51')][_0xe0ce('0x6e')]=_0x4f644e['id'];if(_0x4e2d35[_0xe0ce('0x48')][_0xe0ce('0x53')]){_0x1096e1[_0xe0ce('0x51')]=_[_0xe0ce('0x55')](_0x1096e1['where'],{'$or':_[_0xe0ce('0x46')](_0x1096e1[_0xe0ce('0x4b')],function(_0x382f93){var _0x17959d={};_0x17959d[_0x382f93]={'$like':'%'+_0x4e2d35['query']['filter']+'%'};return _0x17959d;})});}_0x1096e1=_[_0xe0ce('0x55')]({},_0x1096e1,_0x4e2d35['options']);return db[_0xe0ce('0x6f')][_0xe0ce('0x33')]({'where':_0x1096e1['where']})[_0xe0ce('0x24')](function(_0x54b391){_0xc85c4a[_0xe0ce('0x33')]=_0x54b391;if(_0x4e2d35[_0xe0ce('0x48')][_0xe0ce('0x57')]){_0x1096e1[_0xe0ce('0x6b')]=[{'all':!![]}];}return db[_0xe0ce('0x6f')][_0xe0ce('0x58')](_0x1096e1);})[_0xe0ce('0x24')](function(_0x4e4b1e){_0xc85c4a[_0xe0ce('0x59')]=_0x4e4b1e;return _0xc85c4a;});}})[_0xe0ce('0x24')](respondWithFilteredResult(_0x2112bf,_0x1096e1))['catch'](handleError(_0x2112bf,null));};exports[_0xe0ce('0x72')]=function(_0x230c7d,_0x20781b,_0xe47021){return db['FaxAccount']['find']({'where':{'id':_0x230c7d['params']['id']}})[_0xe0ce('0x24')](handleEntityNotFound(_0x20781b,null))[_0xe0ce('0x24')](function(_0x13c227){if(_0x13c227){return _0x13c227[_0xe0ce('0x72')](_0x230c7d['query'][_0xe0ce('0x73')]);}})[_0xe0ce('0x24')](respondWithStatusCode(_0x20781b,null))[_0xe0ce('0x2d')](handleError(_0x20781b,null));};exports['addInteraction']=function(_0x5469b0,_0x3b6d67,_0x24874e){return db['FaxInteraction'][_0xe0ce('0x5c')]({'where':{'id':_0x5469b0[_0xe0ce('0x64')]['id']}})[_0xe0ce('0x24')](handleEntityNotFound(_0x3b6d67,null))['then'](function(_0x308524){if(_0x308524){return _0x308524[_0xe0ce('0x74')](_0x5469b0[_0xe0ce('0x65')][_0xe0ce('0x73')],_[_0xe0ce('0x75')](_0x5469b0[_0xe0ce('0x65')],[_0xe0ce('0x73'),'id'])||{});}})['then'](respondWithResult(_0x3b6d67,null))[_0xe0ce('0x2d')](handleError(_0x3b6d67,null));};exports[_0xe0ce('0x76')]=function(_0x2db7de,_0x9b83ba,_0x363966){var _0x83acda={'raw':![],'where':{}};var _0x201159={};var _0x283399={'count':0x0,'rows':[]};return db[_0xe0ce('0x42')][_0xe0ce('0x71')]({'where':{'id':_0x2db7de['params']['id']}})[_0xe0ce('0x24')](handleEntityNotFound(_0x9b83ba,null))[_0xe0ce('0x24')](function(_0x43d55e){if(_0x43d55e){_0x201159[_0xe0ce('0x45')]=_[_0xe0ce('0x5b')](db[_0xe0ce('0x77')][_0xe0ce('0x43')]);_0x201159['query']=_[_0xe0ce('0x5b')](_0x2db7de['query']);_0x201159['filters']=_[_0xe0ce('0x4a')](_0x201159['model'],_0x201159['query']);_0x83acda['attributes']=_[_0xe0ce('0x4a')](_0x201159[_0xe0ce('0x45')],qs['fields'](_0x2db7de[_0xe0ce('0x48')][_0xe0ce('0x4c')]));_0x83acda[_0xe0ce('0x4b')]=_0x83acda[_0xe0ce('0x4b')]['length']?_0x83acda[_0xe0ce('0x4b')]:_0x201159[_0xe0ce('0x45')];if(!_0x2db7de[_0xe0ce('0x48')]['hasOwnProperty'](_0xe0ce('0x6a'))){_0x83acda['limit']=qs[_0xe0ce('0x32')](_0x2db7de[_0xe0ce('0x48')][_0xe0ce('0x32')]);_0x83acda[_0xe0ce('0x30')]=qs[_0xe0ce('0x30')](_0x2db7de[_0xe0ce('0x48')][_0xe0ce('0x30')]);}_0x83acda[_0xe0ce('0x4f')]=qs[_0xe0ce('0x50')](_0x2db7de[_0xe0ce('0x48')][_0xe0ce('0x50')]);_0x83acda[_0xe0ce('0x51')]=qs[_0xe0ce('0x49')](_[_0xe0ce('0x52')](_0x2db7de['query'],_0x201159[_0xe0ce('0x49')]));_0x83acda[_0xe0ce('0x51')][_0xe0ce('0x6e')]=_0x43d55e['id'];if(_0x2db7de[_0xe0ce('0x48')][_0xe0ce('0x53')]){_0x83acda[_0xe0ce('0x51')]=_[_0xe0ce('0x55')](_0x83acda[_0xe0ce('0x51')],{'$or':_['map'](_0x83acda[_0xe0ce('0x4b')],function(_0x1cf217){var _0x1842a7={};_0x1842a7[_0x1cf217]={'$like':'%'+_0x2db7de[_0xe0ce('0x48')][_0xe0ce('0x53')]+'%'};return _0x1842a7;})});}_0x83acda=_['merge']({},_0x83acda,_0x2db7de[_0xe0ce('0x56')]);return db[_0xe0ce('0x77')][_0xe0ce('0x33')]({'where':_0x83acda[_0xe0ce('0x51')]})[_0xe0ce('0x24')](function(_0x29c74b){_0x283399[_0xe0ce('0x33')]=_0x29c74b;if(_0x2db7de['query'][_0xe0ce('0x57')]){_0x83acda[_0xe0ce('0x6b')]=[{'model':db[_0xe0ce('0x78')],'as':_0xe0ce('0x79'),'required':![]},{'model':db[_0xe0ce('0x7a')],'as':_0xe0ce('0x7b'),'attributes':['name',_0xe0ce('0x7c'),'internal'],'required':![]},{'model':db[_0xe0ce('0x7d')],'as':_0xe0ce('0x7e'),'attributes':['id','name',_0xe0ce('0x7f')],'where':_0x2db7de[_0xe0ce('0x48')][_0xe0ce('0x80')]?{'id':_0x2db7de[_0xe0ce('0x48')]['tag']}:undefined,'required':_0x2db7de['query']['tag']?!![]:![]}];}return db[_0xe0ce('0x77')][_0xe0ce('0x58')](_0x83acda);})[_0xe0ce('0x24')](function(_0x403299){_0x283399[_0xe0ce('0x59')]=_0x403299;return _0x283399;});}})[_0xe0ce('0x24')](respondWithFilteredResult(_0x9b83ba,_0x83acda))[_0xe0ce('0x2d')](handleError(_0x9b83ba,null));};exports[_0xe0ce('0x81')]=function(_0x2056a0,_0x3f4756){var _0x435900=_0x2056a0[_0xe0ce('0x64')]['id'];var _0x2483a7=_0x2056a0[_0xe0ce('0x65')];var _0x40ac13=0xc8;var _0x539359=null;return db['sequelize'][_0xe0ce('0x82')]({'isolationLevel':db[_0xe0ce('0x83')]['Transaction'][_0xe0ce('0x84')][_0xe0ce('0x85')]},function(_0x2f4708){return db[_0xe0ce('0x42')][_0xe0ce('0x71')]({'where':{'id':_0x435900},'transaction':_0x2f4708})[_0xe0ce('0x24')](function(_0x3c71ef){if(_0x3c71ef){return db[_0xe0ce('0x86')][_0xe0ce('0x39')]({'where':{'FaxAccountId':_0x435900},'transaction':_0x2f4708})['then'](function(){var _0x571867=_[_0xe0ce('0x46')](_0x2483a7,function(_0x23d57f){_0x23d57f[_0xe0ce('0x6e')]=_0x435900;return _0x23d57f;});return db[_0xe0ce('0x86')][_0xe0ce('0x87')](_0x571867,{'transaction':_0x2f4708});});}else{_0x40ac13=0x194;_0x539359=[];}});})['then'](function(){if(_0x40ac13!==0x194){return db[_0xe0ce('0x86')][_0xe0ce('0x88')]({'where':{'FaxAccountId':_0x435900},'order':_0xe0ce('0x89')})['then'](function(_0x32277c){_0x539359=_0x32277c;});}})[_0xe0ce('0x2d')](function(_0x1f3a32){_0x40ac13=0x1f4;logger[_0xe0ce('0x29')](_0x1f3a32[_0xe0ce('0x8a')]);if(_0x1f3a32[_0xe0ce('0x47')]){delete _0x1f3a32['name'];}_0x539359=_0x1f3a32;})[_0xe0ce('0x8b')](function(){if(_0x539359===null){_0x3f4756[_0xe0ce('0x2e')](_0x40ac13);}else{if(_0x40ac13===0x1f4){_0x3f4756[_0xe0ce('0x2f')](_0x40ac13)['send'](_0x539359);}else{_0x3f4756[_0xe0ce('0x2f')](_0x40ac13)['json'](_0x539359);}}});};exports[_0xe0ce('0x8c')]=function(_0x15a783,_0x4df541,_0x4db6b3){var _0x4fa4e7={};var _0xcc8f9e={};var _0x744fa7;var _0x47b8bf;return db[_0xe0ce('0x42')][_0xe0ce('0x71')]({'where':{'id':_0x15a783[_0xe0ce('0x64')]['id']}})[_0xe0ce('0x24')](handleEntityNotFound(_0x4df541,null))[_0xe0ce('0x24')](function(_0x45d0e2){if(_0x45d0e2){_0x744fa7=_0x45d0e2;_0xcc8f9e['model']=_[_0xe0ce('0x5b')](db['FaxApplication'][_0xe0ce('0x43')]);_0xcc8f9e['query']=_['keys'](_0x15a783[_0xe0ce('0x48')]);_0xcc8f9e[_0xe0ce('0x49')]=_[_0xe0ce('0x4a')](_0xcc8f9e[_0xe0ce('0x45')],_0xcc8f9e['query']);_0x4fa4e7[_0xe0ce('0x4b')]=_[_0xe0ce('0x4a')](_0xcc8f9e[_0xe0ce('0x45')],qs[_0xe0ce('0x4c')](_0x15a783[_0xe0ce('0x48')][_0xe0ce('0x4c')]));_0x4fa4e7[_0xe0ce('0x4b')]=_0x4fa4e7[_0xe0ce('0x4b')][_0xe0ce('0x4d')]?_0x4fa4e7[_0xe0ce('0x4b')]:_0xcc8f9e[_0xe0ce('0x45')];_0x4fa4e7[_0xe0ce('0x4f')]=qs[_0xe0ce('0x50')](_0x15a783[_0xe0ce('0x48')][_0xe0ce('0x50')]);_0x4fa4e7[_0xe0ce('0x51')]=qs[_0xe0ce('0x49')](_[_0xe0ce('0x52')](_0x15a783[_0xe0ce('0x48')],_0xcc8f9e[_0xe0ce('0x49')]));if(_0x15a783[_0xe0ce('0x48')][_0xe0ce('0x53')]){_0x4fa4e7[_0xe0ce('0x51')]=_[_0xe0ce('0x55')](_0x4fa4e7['where'],{'$or':_[_0xe0ce('0x46')](_0x4fa4e7[_0xe0ce('0x4b')],function(_0x5f3c2e){var _0x2b4791={};_0x2b4791[_0x5f3c2e]={'$like':'%'+_0x15a783[_0xe0ce('0x48')][_0xe0ce('0x53')]+'%'};return _0x2b4791;})});}_0x4fa4e7=_[_0xe0ce('0x55')]({},_0x4fa4e7,_0x15a783[_0xe0ce('0x56')]);return _0x744fa7['getApplications'](_0x4fa4e7);}})[_0xe0ce('0x24')](function(_0x148d59){if(_0x148d59){_0x47b8bf=_0x148d59['length'];if(!_0x15a783['query'][_0xe0ce('0x4e')](_0xe0ce('0x6a'))){_0x4fa4e7[_0xe0ce('0x32')]=qs[_0xe0ce('0x32')](_0x15a783[_0xe0ce('0x48')][_0xe0ce('0x32')]);_0x4fa4e7[_0xe0ce('0x30')]=qs[_0xe0ce('0x30')](_0x15a783[_0xe0ce('0x48')]['offset']);}return _0x744fa7['getApplications'](_0x4fa4e7);}})['then'](function(_0xf0863e){if(_0xf0863e){return _0xf0863e?{'count':_0x47b8bf,'rows':_0xf0863e}:null;}})[_0xe0ce('0x24')](respondWithResult(_0x4df541,null))['catch'](handleError(_0x4df541,null));};function Extension(_0x438ff6,_0x66ce6a,_0x21eb24,_0x19064e){this[_0xe0ce('0x8d')]=_0xe0ce('0x8e');this['exten']=_0x438ff6[_0xe0ce('0x8f')];this['app']=_0x19064e;this[_0xe0ce('0x90')]=_0xe0ce('0x91');this[_0xe0ce('0x92')]='Fax\x20Extension';this[_0xe0ce('0x6e')]=_0x438ff6['id'];this[_0xe0ce('0x89')]=_0x66ce6a;this[_0xe0ce('0x93')]=_0x21eb24;}function createExtensionsReciveFax(_0x466250){var _0x4039f4=0x1;var _0x419f81=[];_0x419f81[_0xe0ce('0x94')](new Extension(_0x466250,_0x4039f4,'',_0xe0ce('0x95')));_0x4039f4+=0x1;_0x419f81[_0xe0ce('0x94')](new Extension(_0x466250,_0x4039f4,'CDR(type)=inbound-fax',_0xe0ce('0x96')));_0x4039f4+=0x1;for(var _0x27f888 in _0x466250){if(_0x466250[_0xe0ce('0x4e')](_0x27f888)&&(_0x27f888==='ecm'||_0x27f888===_0xe0ce('0x8f')||_0x27f888===_0xe0ce('0x97')||_0x27f888===_0xe0ce('0x98')||_0x27f888===_0xe0ce('0x99')||_0x27f888===_0xe0ce('0x9a')||_0x27f888==='minrate'||_0x27f888==='modem'||_0x27f888===_0xe0ce('0x9b'))){_0x419f81[_0xe0ce('0x94')](new Extension(_0x466250,_0x4039f4,'FAXOPT('+_0x27f888+')='+_0x466250[_0x27f888],_0xe0ce('0x96')));_0x4039f4+=0x1;}}_0x419f81['push'](new Extension(_0x466250,_0x4039f4,'6','Wait'));_0x4039f4+=0x1;_0x419f81[_0xe0ce('0x94')](new Extension(_0x466250,_0x4039f4,_0xe0ce('0x9c'),_0xe0ce('0x9d')));_0x4039f4=0x0;return _0x419f81;}exports[_0xe0ce('0x9e')]=function(_0x489732,_0x17f561,_0x909be6){var _0x31d17e;return db['sequelize'][_0xe0ce('0x82')](function(_0xc2e962){return db[_0xe0ce('0x42')][_0xe0ce('0x5d')](_0x489732[_0xe0ce('0x65')],{'transaction':_0xc2e962})[_0xe0ce('0x24')](function(_0x5c44a4){_0x31d17e=_0x5c44a4[_0xe0ce('0x3a')]({'plain':!![]});return db['VoiceExtension']['bulkCreate'](createExtensionsReciveFax(_0x31d17e),{'transaction':_0xc2e962});});})[_0xe0ce('0x24')](function(){return _0x31d17e;})[_0xe0ce('0x24')](respondWithResult(_0x17f561,null))[_0xe0ce('0x2d')](handleError(_0x17f561,null));};exports[_0xe0ce('0x9f')]=function(_0x5d4a89,_0x29c460,_0x529ddf){var _0x2c8bc8;return db[_0xe0ce('0x83')][_0xe0ce('0x82')](function(_0x5b1ef9){return db[_0xe0ce('0x42')]['update'](_0x5d4a89['body'],{'where':{'id':_0x5d4a89[_0xe0ce('0x65')]['id']},'transaction':_0x5b1ef9})[_0xe0ce('0x24')](function(_0xda4a76){return db[_0xe0ce('0xa0')][_0xe0ce('0x39')]({'where':{'FaxAccountId':_0x5d4a89[_0xe0ce('0x65')]['id']},'transaction':_0x5b1ef9})[_0xe0ce('0x24')](function(_0x5b0213){return db['VoiceExtension'][_0xe0ce('0x87')](createExtensionsReciveFax(_['omit'](_0x5d4a89[_0xe0ce('0x65')],[_0xe0ce('0xa1'),'key',_0xe0ce('0xa2'),'updatedAt',_0xe0ce('0xa3'),_0xe0ce('0xa4')])),{'transaction':_0x5b1ef9});});});})['then'](function(){return db[_0xe0ce('0x42')][_0xe0ce('0xa5')](_0x5d4a89[_0xe0ce('0x65')]['id']);})['then'](respondWithResult(_0x29c460,null))[_0xe0ce('0x2d')](handleError(_0x29c460,null));};exports['getMessages']=function(_0x328279,_0x498356,_0x3769f9){var _0x59e53e={'raw':!![],'where':{}};var _0x34398d={};var _0x2f83d1={'count':0x0,'rows':[]};return db[_0xe0ce('0x42')][_0xe0ce('0x71')]({'where':{'id':_0x328279[_0xe0ce('0x64')]['id']}})[_0xe0ce('0x24')](handleEntityNotFound(_0x498356,null))[_0xe0ce('0x24')](function(_0x3b7503){if(_0x3b7503){_0x34398d['model']=_[_0xe0ce('0x5b')](db[_0xe0ce('0xa6')][_0xe0ce('0x43')]);_0x34398d['query']=_[_0xe0ce('0x5b')](_0x328279['query']);_0x34398d[_0xe0ce('0x49')]=_[_0xe0ce('0x4a')](_0x34398d[_0xe0ce('0x45')],_0x34398d['query']);_0x59e53e['attributes']=_[_0xe0ce('0x4a')](_0x34398d['model'],qs[_0xe0ce('0x4c')](_0x328279['query'][_0xe0ce('0x4c')]));_0x59e53e[_0xe0ce('0x4b')]=_0x59e53e[_0xe0ce('0x4b')]['length']?_0x59e53e[_0xe0ce('0x4b')]:_0x34398d['model'];if(!_0x328279['query']['hasOwnProperty'](_0xe0ce('0x6a'))){_0x59e53e[_0xe0ce('0x32')]=qs[_0xe0ce('0x32')](_0x328279[_0xe0ce('0x48')][_0xe0ce('0x32')]);_0x59e53e[_0xe0ce('0x30')]=qs[_0xe0ce('0x30')](_0x328279[_0xe0ce('0x48')][_0xe0ce('0x30')]);}_0x59e53e['order']=qs[_0xe0ce('0x50')](_0x328279[_0xe0ce('0x48')][_0xe0ce('0x50')]);_0x59e53e[_0xe0ce('0x51')]=qs[_0xe0ce('0x49')](_['pick'](_0x328279[_0xe0ce('0x48')],_0x34398d[_0xe0ce('0x49')]));_0x59e53e['where'][_0xe0ce('0x6e')]=_0x3b7503['id'];if(_0x328279['query'][_0xe0ce('0x53')]){_0x59e53e[_0xe0ce('0x51')]=_[_0xe0ce('0x55')](_0x59e53e[_0xe0ce('0x51')],{'$or':_[_0xe0ce('0x46')](_0x59e53e['attributes'],function(_0x1bf8a4){var _0x11a82b={};_0x11a82b[_0x1bf8a4]={'$like':'%'+_0x328279[_0xe0ce('0x48')][_0xe0ce('0x53')]+'%'};return _0x11a82b;})});}if(_0x328279[_0xe0ce('0x48')][_0xe0ce('0xa7')]){var _0x5b5e1c=_0x328279['query'][_0xe0ce('0xa7')][_0xe0ce('0xa8')](',');var _0x34f29b={};_0x34f29b[_0x5b5e1c[0x0]]={'$gte':moment(_0x5b5e1c[0x1])[_0xe0ce('0xa9')](_0xe0ce('0xaa'))};_0x59e53e[_0xe0ce('0x51')]=_[_0xe0ce('0x55')](_0x59e53e[_0xe0ce('0x51')],_0x34f29b);}_0x59e53e=_[_0xe0ce('0x55')]({},_0x59e53e,_0x328279['options']);return db[_0xe0ce('0xa6')][_0xe0ce('0x33')]({'where':_0x59e53e['where']})[_0xe0ce('0x24')](function(_0x190ad6){_0x2f83d1[_0xe0ce('0x33')]=_0x190ad6;if(_0x328279[_0xe0ce('0x48')][_0xe0ce('0x57')]){_0x59e53e[_0xe0ce('0x6b')]=[{'all':!![]}];}return db[_0xe0ce('0xa6')][_0xe0ce('0x58')](_0x59e53e);})[_0xe0ce('0x24')](function(_0x4e10fd){_0x2f83d1[_0xe0ce('0x59')]=_0x4e10fd;return _0x2f83d1;});}})['then'](respondWithFilteredResult(_0x498356,_0x59e53e))[_0xe0ce('0x2d')](handleError(_0x498356,null));};exports['send']=function(_0x461683,_0x3fdca3,_0x2feaee){var _0x415817,_0x21c250={},_0x10dbf0;if(_0x461683[_0xe0ce('0x65')]['to']){_0x10dbf0=_0x461683[_0xe0ce('0x65')]['to'][0x0];}return db[_0xe0ce('0x42')][_0xe0ce('0x5c')]({'where':{'id':_0x461683[_0xe0ce('0x64')]['id']},'include':[{'model':db[_0xe0ce('0xab')],'as':_0xe0ce('0xac'),'include':[{'model':db[_0xe0ce('0x78')],'as':_0xe0ce('0xad'),'where':{'fax':_0x10dbf0},'limit':0x1,'order':[[_0xe0ce('0xae'),_0xe0ce('0xaf')]]}]}]})[_0xe0ce('0x24')](handleEntityNotFound(_0x3fdca3,null))[_0xe0ce('0x24')](function(_0x1a287d){_0x415817=_0x1a287d;if(_0x461683[_0xe0ce('0x65')][_0xe0ce('0xb0')]&&_0x461683[_0xe0ce('0x65')]['attachments']['length']){for(var _0x1ecf4c=0x0;_0x1ecf4c<_0x461683[_0xe0ce('0x65')][_0xe0ce('0xb0')][_0xe0ce('0x4d')];_0x1ecf4c+=0x1){_0x461683['body'][_0xe0ce('0xb0')][_0x1ecf4c]={'filename':_0x461683[_0xe0ce('0x65')]['attachments'][_0x1ecf4c][_0xe0ce('0x47')],'id':_0x461683['body'][_0xe0ce('0xb0')][_0x1ecf4c]['id'],'path':path[_0xe0ce('0xb1')](config[_0xe0ce('0xb2')],'server/files/attachments',_0x461683[_0xe0ce('0x65')]['attachments'][_0x1ecf4c][_0xe0ce('0xb3')])};}}return respondWithRpcPromise(_0xe0ce('0xb4'),'CheckAfterSend',{'FaxAccountId':_['isNil'](_0x461683[_0xe0ce('0x64')]['id'])?undefined:_0x461683[_0xe0ce('0x64')]['id'],'path':_[_0xe0ce('0xb5')](_0x461683[_0xe0ce('0x65')][_0xe0ce('0xb0')][0x0][_0xe0ce('0x8')])?undefined:_0x461683[_0xe0ce('0x65')][_0xe0ce('0xb0')][0x0][_0xe0ce('0x8')],'fax':_[_0xe0ce('0xb5')](_0x461683[_0xe0ce('0x65')]['to'][0x0])?undefined:_0x461683[_0xe0ce('0x65')]['to'][0x0]},client9002);})[_0xe0ce('0x24')](function(){if(_0x415817){if(_[_0xe0ce('0xb5')](_0x461683[_0xe0ce('0x65')][_0xe0ce('0xb6')])){_0x461683['body'][_0xe0ce('0xb6')]=util[_0xe0ce('0xa9')](_0xe0ce('0xb7'),_0x415817[_0xe0ce('0x47')],_0x415817['fax']);}if(_0x415817['List']){if(_0x415817[_0xe0ce('0xac')]['Contacts'][_0xe0ce('0x4d')]){return _0x415817['List'][_0xe0ce('0xad')][0x0];}else{return db[_0xe0ce('0x78')][_0xe0ce('0x5d')](_[_0xe0ce('0x1b')](_0x461683[_0xe0ce('0x65')],{'firstName':_0x461683[_0xe0ce('0x65')]['to'][0x0],'phone':_0x461683[_0xe0ce('0x65')]['to'][0x0],'fax':_0x461683['body']['to'][0x0],'ListId':_0x415817['ListId']}));}}else{throw new Error(_0xe0ce('0xb8'));}}else{throw new Error(_0xe0ce('0xb9'));}})[_0xe0ce('0x24')](function(_0x1c7bd4){if(_0x1c7bd4){return db[_0xe0ce('0x77')][_0xe0ce('0x5c')]({'where':{'ContactId':_0x1c7bd4['id'],'closed':![],'FaxAccountId':_0x415817['id']}})[_0xe0ce('0x24')](function(_0xaa9c2d){if(_0xaa9c2d){return[_0xaa9c2d,![]];}return db[_0xe0ce('0x77')]['create']({'UserId':_0x461683['user']['id'],'ContactId':_0x1c7bd4['id'],'FaxAccountId':_0x415817['id'],'fax':_0x461683[_0xe0ce('0x65')]['to'][0x0],'firstMsgDirection':_0xe0ce('0xba'),'Messages':[_[_0xe0ce('0x55')](_0x461683['body'],{'read':![],'body':_0x461683[_0xe0ce('0x65')][_0xe0ce('0xb0')][0x0][_0xe0ce('0xbb')],'FaxAccountId':_0x415817['id'],'UserId':_0x461683['user']['id'],'ContactId':_0x1c7bd4['id'],'AttachmentId':_0x461683[_0xe0ce('0x65')][_0xe0ce('0xb0')][0x0]['id']})]},{'include':[{'model':db[_0xe0ce('0xa6')],'as':_0xe0ce('0xbc')}]})[_0xe0ce('0x24')](function(_0x474d5e){return[_0x474d5e,!![]];});});}else{throw new Error(_0xe0ce('0xbd'));}})['spread'](function(_0x5ee08f,_0x18ea09){if(_0x18ea09){return _0x5ee08f;}return db[_0xe0ce('0xa6')][_0xe0ce('0x5d')]({'direction':_0xe0ce('0xba'),'read':![],'body':_0x461683[_0xe0ce('0x65')][_0xe0ce('0xb0')][0x0][_0xe0ce('0xbb')],'FaxAccountId':_0x415817['id'],'FaxInteractionId':_0x5ee08f['id'],'UserId':_0x461683[_0xe0ce('0x5e')]['id'],'ContactId':_0x5ee08f[_0xe0ce('0xbe')],'AttachmentId':_0x461683[_0xe0ce('0x65')][_0xe0ce('0xb0')][0x0]['id']})[_0xe0ce('0x24')](function(_0x4fdd31){_0x5ee08f[_0xe0ce('0xbf')]['Messages']=[];_0x5ee08f['dataValues'][_0xe0ce('0xbc')][_0xe0ce('0x94')](_0x4fdd31['dataValues']);return _0x5ee08f;});})['then'](function(_0x25aafc){respondWithRpcPromise(_0xe0ce('0xc0'),_0xe0ce('0xc0'),{'FaxAccountId':_[_0xe0ce('0xb5')](_0x461683['params']['id'])?undefined:_0x461683[_0xe0ce('0x64')]['id'],'path':_['isNil'](_0x461683['body'][_0xe0ce('0xb0')][0x0][_0xe0ce('0x8')])?undefined:_0x461683['body'][_0xe0ce('0xb0')][0x0]['path'],'fax':_[_0xe0ce('0xb5')](_0x461683[_0xe0ce('0x65')]['to'][0x0])?undefined:_0x461683['body']['to'][0x0],'AttachmentId':_0x461683[_0xe0ce('0x65')][_0xe0ce('0xb0')][0x0]['id']},client9002)['then'](function(_0x225592){logger[_0xe0ce('0x25')](_0xe0ce('0xc1'),_0x225592);})['catch'](function(_0x49dec6){logger[_0xe0ce('0x25')]('SendFaxRpc,\x20%s',_0x49dec6);});return _0x25aafc;})['then'](respondWithResult(_0x3fdca3,null))['catch'](handleError(_0x3fdca3,null));};exports[_0xe0ce('0xc2')]=function(_0x364feb,_0x1ed342,_0x1e337d){return db[_0xe0ce('0x42')]['find']({'where':{'id':_0x364feb[_0xe0ce('0x64')]['id']}})[_0xe0ce('0x24')](handleEntityNotFound(_0x1ed342,null))['then'](function(_0x2f9efa){if(_0x2f9efa){return _0x2f9efa[_0xe0ce('0xc2')](_0x364feb['body']['ids'],_[_0xe0ce('0x75')](_0x364feb[_0xe0ce('0x65')],[_0xe0ce('0x73'),'id'])||{})[_0xe0ce('0xc3')](function(_0x34ad49){for(var _0x486d28=0x0;_0x486d28<_0x364feb[_0xe0ce('0x65')]['ids'][_0xe0ce('0x4d')];_0x486d28+=0x1){socket[_0xe0ce('0xc4')](_0xe0ce('0xc5'),{'UserId':Number(_0x364feb[_0xe0ce('0x65')]['ids'][_0x486d28]),'FaxAccountId':Number(_0x364feb[_0xe0ce('0x64')]['id'])});}return _0x34ad49;});}})[_0xe0ce('0x24')](respondWithResult(_0x1ed342,null))[_0xe0ce('0x2d')](handleError(_0x1ed342,null));};exports['removeAgents']=function(_0x5a1dfe,_0x49f8e6,_0x4c7ff2){return db[_0xe0ce('0x42')][_0xe0ce('0x5c')]({'where':{'id':_0x5a1dfe[_0xe0ce('0x64')]['id']}})[_0xe0ce('0x24')](handleEntityNotFound(_0x49f8e6,null))[_0xe0ce('0x24')](function(_0x384f33){if(_0x384f33){return _0x384f33[_0xe0ce('0xc6')](_0x5a1dfe[_0xe0ce('0x48')][_0xe0ce('0x73')])['then'](function(){if(_[_0xe0ce('0xc7')](_0x5a1dfe[_0xe0ce('0x48')]['ids'])){for(var _0x4c1734=0x0;_0x4c1734<_0x5a1dfe[_0xe0ce('0x48')]['ids'][_0xe0ce('0x4d')];_0x4c1734+=0x1){socket[_0xe0ce('0xc4')](_0xe0ce('0xc8'),{'UserId':Number(_0x5a1dfe[_0xe0ce('0x48')][_0xe0ce('0x73')][_0x4c1734]),'FaxAccountId':Number(_0x5a1dfe[_0xe0ce('0x64')]['id'])});}}else{socket[_0xe0ce('0xc4')](_0xe0ce('0xc8'),{'UserId':Number(_0x5a1dfe['query'][_0xe0ce('0x73')]),'FaxAccountId':Number(_0x5a1dfe[_0xe0ce('0x64')]['id'])});}});}})[_0xe0ce('0x24')](respondWithStatusCode(_0x49f8e6,null))[_0xe0ce('0x2d')](handleError(_0x49f8e6,null));};exports[_0xe0ce('0xc9')]=function(_0x1d2aa6,_0x5709a5,_0x2e4072){var _0x298570={};var _0x593034={};var _0x4a6d52;var _0x17e374;return db[_0xe0ce('0x42')][_0xe0ce('0x71')]({'where':{'id':_0x1d2aa6[_0xe0ce('0x64')]['id']}})[_0xe0ce('0x24')](handleEntityNotFound(_0x5709a5,null))[_0xe0ce('0x24')](function(_0x361a76){if(_0x361a76){_0x4a6d52=_0x361a76;_0x593034[_0xe0ce('0x45')]=_[_0xe0ce('0x5b')](db[_0xe0ce('0x7a')][_0xe0ce('0x43')]);_0x593034[_0xe0ce('0x48')]=_['keys'](_0x1d2aa6[_0xe0ce('0x48')]);_0x593034['filters']=_[_0xe0ce('0x4a')](_0x593034[_0xe0ce('0x45')],_0x593034['query']);_0x298570['attributes']=_[_0xe0ce('0x4a')](_0x593034['model'],qs[_0xe0ce('0x4c')](_0x1d2aa6[_0xe0ce('0x48')][_0xe0ce('0x4c')]));_0x298570[_0xe0ce('0x4b')]=_0x298570[_0xe0ce('0x4b')]['length']?_0x298570[_0xe0ce('0x4b')]:_0x593034[_0xe0ce('0x45')];_0x298570['order']=qs['sort'](_0x1d2aa6['query'][_0xe0ce('0x50')]);_0x298570['where']=qs[_0xe0ce('0x49')](_[_0xe0ce('0x52')](_0x1d2aa6['query'],_0x593034['filters']));if(_0x1d2aa6['query'][_0xe0ce('0x53')]){_0x298570['where']=_[_0xe0ce('0x55')](_0x298570[_0xe0ce('0x51')],{'$or':_['map'](_0x298570[_0xe0ce('0x4b')],function(_0x191bde){var _0xd0bbd1={};_0xd0bbd1[_0x191bde]={'$like':'%'+_0x1d2aa6[_0xe0ce('0x48')][_0xe0ce('0x53')]+'%'};return _0xd0bbd1;})});}_0x298570=_[_0xe0ce('0x55')]({},_0x298570,_0x1d2aa6[_0xe0ce('0x56')]);return _0x4a6d52[_0xe0ce('0xc9')](_0x298570);}})['then'](function(_0x5502b8){if(_0x5502b8){_0x17e374=_0x5502b8[_0xe0ce('0x4d')];if(!_0x1d2aa6[_0xe0ce('0x48')][_0xe0ce('0x4e')](_0xe0ce('0x6a'))){_0x298570[_0xe0ce('0x32')]=qs[_0xe0ce('0x32')](_0x1d2aa6[_0xe0ce('0x48')][_0xe0ce('0x32')]);_0x298570[_0xe0ce('0x30')]=qs[_0xe0ce('0x30')](_0x1d2aa6[_0xe0ce('0x48')][_0xe0ce('0x30')]);}return _0x4a6d52[_0xe0ce('0xc9')](_0x298570);}})[_0xe0ce('0x24')](function(_0x1f8e4f){if(_0x1f8e4f){return _0x1f8e4f?{'count':_0x17e374,'rows':_0x1f8e4f}:null;}})[_0xe0ce('0x24')](respondWithResult(_0x5709a5,null))[_0xe0ce('0x2d')](handleError(_0x5709a5,null));}; \ No newline at end of file +var _0xd4b6=['../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','./faxAccount.socket','register','client','http','request','then','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','get','FaxAccounts','UserProfileResource','destroy','stack','name','send','index','mandatoryDispositionPause','map','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','FaxAccount','rows','rawAttributes','options','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','filters','findAll','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','addInteraction','FaxInteraction','getInteractions','CmContact','User','Owner','fullname','internal','Tag','color','tag','sequelize','READ_COMMITTED','FaxApplication','priority','finally','getApplications','from-voip-provider','exten','localstationid','system','description','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','Set','ecm','gateway','faxdetect','headerinfo','modem','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','addAccountApplications','transaction','VoiceExtension','updateAccountApplications','omit','updatedAt','TrunkId','findById','FaxMessage','$gte','split','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','ListId','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','ContactId','Messages','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','spread','userFaxAccount:save','removeAgents','isArray','emit','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x191078,_0x5a4335){var _0x56d104=function(_0x482388){while(--_0x482388){_0x191078['push'](_0x191078['shift']());}};_0x56d104(++_0x5a4335);}(_0xd4b6,0x167));var _0x6d4b=function(_0x9fc958,_0x258894){_0x9fc958=_0x9fc958-0x0;var _0x338cca=_0xd4b6[_0x9fc958];return _0x338cca;};'use strict';var emlformat=require(_0x6d4b('0x0'));var rimraf=require(_0x6d4b('0x1'));var zipdir=require(_0x6d4b('0x2'));var jsonpatch=require(_0x6d4b('0x3'));var rp=require(_0x6d4b('0x4'));var moment=require(_0x6d4b('0x5'));var BPromise=require(_0x6d4b('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x6d4b('0x7'));var sox=require('sox');var csv=require(_0x6d4b('0x8'));var ejs=require(_0x6d4b('0x9'));var fs=require('fs');var fs_extra=require(_0x6d4b('0xa'));var _=require('lodash');var squel=require(_0x6d4b('0xb'));var crypto=require(_0x6d4b('0xc'));var jsforce=require(_0x6d4b('0xd'));var deskjs=require(_0x6d4b('0xe'));var toCsv=require(_0x6d4b('0x8'));var querystring=require('querystring');var Papa=require(_0x6d4b('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6d4b('0x10'));var as=require(_0x6d4b('0x11'));var hardwareService=require(_0x6d4b('0x12'));var logger=require(_0x6d4b('0x13'))(_0x6d4b('0x14'));var utils=require('../../config/utils');var config=require(_0x6d4b('0x15'));var licenseUtil=require(_0x6d4b('0x16'));var db=require('../../mysqldb')['db'];config[_0x6d4b('0x17')]=_[_0x6d4b('0x18')](config[_0x6d4b('0x17')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6d4b('0x17')]));require(_0x6d4b('0x19'))[_0x6d4b('0x1a')](socket);var jayson=require('jayson/promise');var client=jayson[_0x6d4b('0x1b')][_0x6d4b('0x1c')]({'port':0x232c});var client9002=jayson[_0x6d4b('0x1b')][_0x6d4b('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x59ff2f,_0x5a15e1,_0x262989,_0x42884a){return new BPromise(function(_0x238287,_0x49775c){var _0x1d3ee4=_0x42884a||client;return _0x1d3ee4[_0x6d4b('0x1d')](_0x59ff2f,_0x262989)[_0x6d4b('0x1e')](function(_0x3cd74c){logger['info'](_0x6d4b('0x1f'),_0x5a15e1,_0x6d4b('0x20'));logger[_0x6d4b('0x21')](_0x6d4b('0x22'),_0x5a15e1,_0x6d4b('0x20'),JSON[_0x6d4b('0x23')](_0x3cd74c));if(_0x3cd74c['error']){if(_0x3cd74c[_0x6d4b('0x24')][_0x6d4b('0x25')]===0x1f4){logger[_0x6d4b('0x24')](_0x6d4b('0x1f'),_0x5a15e1,_0x3cd74c['error'][_0x6d4b('0x26')]);return _0x49775c(_0x3cd74c[_0x6d4b('0x24')][_0x6d4b('0x26')]);}logger[_0x6d4b('0x24')](_0x6d4b('0x1f'),_0x5a15e1,_0x3cd74c[_0x6d4b('0x24')][_0x6d4b('0x26')]);return _0x238287(_0x3cd74c['error'][_0x6d4b('0x26')]);}else{logger[_0x6d4b('0x27')](_0x6d4b('0x1f'),_0x5a15e1,_0x6d4b('0x20'));_0x238287(_0x3cd74c[_0x6d4b('0x28')][_0x6d4b('0x26')]);}})[_0x6d4b('0x29')](function(_0x5aa486){logger[_0x6d4b('0x24')](_0x6d4b('0x1f'),_0x5a15e1,_0x5aa486);_0x49775c(_0x5aa486);});});}function respondWithStatusCode(_0x4f400b,_0x1d12c3){_0x1d12c3=_0x1d12c3||0xcc;return function(_0x3876fe){if(_0x3876fe){return _0x4f400b[_0x6d4b('0x2a')](_0x1d12c3);}return _0x4f400b[_0x6d4b('0x2b')](_0x1d12c3)[_0x6d4b('0x2c')]();};}function respondWithResult(_0xffd7c1,_0x111d89){_0x111d89=_0x111d89||0xc8;return function(_0x247354){if(_0x247354){return _0xffd7c1[_0x6d4b('0x2b')](_0x111d89)[_0x6d4b('0x2d')](_0x247354);}};}function respondWithFilteredResult(_0x32f19f,_0x5dbf18){return function(_0x3059cf){if(_0x3059cf){var _0x516463=typeof _0x5dbf18[_0x6d4b('0x2e')]===_0x6d4b('0x2f')&&typeof _0x5dbf18[_0x6d4b('0x30')]===_0x6d4b('0x2f');var _0x493c57=_0x3059cf[_0x6d4b('0x31')];var _0xd2d45f=_0x516463?0x0:_0x5dbf18[_0x6d4b('0x2e')];var _0x345f8c=_0x516463?_0x3059cf[_0x6d4b('0x31')]:_0x5dbf18[_0x6d4b('0x2e')]+_0x5dbf18['limit'];var _0x3d3d8d;if(_0x345f8c>=_0x493c57){_0x345f8c=_0x493c57;_0x3d3d8d=0xc8;}else{_0x3d3d8d=0xce;}_0x32f19f[_0x6d4b('0x2b')](_0x3d3d8d);return _0x32f19f[_0x6d4b('0x32')](_0x6d4b('0x33'),_0xd2d45f+'-'+_0x345f8c+'/'+_0x493c57)['json'](_0x3059cf);}return null;};}function patchUpdates(_0x5bae4a){return function(_0xe374d9){try{jsonpatch[_0x6d4b('0x34')](_0xe374d9,_0x5bae4a,!![]);}catch(_0x7ea5d){return BPromise['reject'](_0x7ea5d);}return _0xe374d9[_0x6d4b('0x35')]();};}function saveUpdates(_0x1faec5,_0x326748){return function(_0x58baca){if(_0x58baca){return _0x58baca[_0x6d4b('0x36')](_0x1faec5)['then'](function(_0x3de403){return _0x3de403;});}return null;};}function removeEntity(_0x465376,_0x481681){return function(_0x549478){if(_0x549478){return _0x549478['destroy']()[_0x6d4b('0x1e')](function(){var _0x2c9b42=_0x549478[_0x6d4b('0x37')]({'plain':!![]});var _0x2349d6=_0x6d4b('0x38');return db[_0x6d4b('0x39')][_0x6d4b('0x3a')]({'where':{'type':_0x2349d6,'resourceId':_0x2c9b42['id']}})[_0x6d4b('0x1e')](function(){return _0x549478;});})[_0x6d4b('0x1e')](function(){_0x465376['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4506bd,_0x596c2a){return function(_0x4fea0a){if(!_0x4fea0a){_0x4506bd[_0x6d4b('0x2a')](0x194);}return _0x4fea0a;};}function handleError(_0x268a2d,_0xd8efee){_0xd8efee=_0xd8efee||0x1f4;return function(_0x489c72){logger[_0x6d4b('0x24')](_0x489c72[_0x6d4b('0x3b')]);if(_0x489c72[_0x6d4b('0x3c')]){delete _0x489c72[_0x6d4b('0x3c')];}_0x268a2d['status'](_0xd8efee)[_0x6d4b('0x3d')](_0x489c72);};}exports[_0x6d4b('0x3e')]=function(_0x36d094,_0x20f448){var _0x1f0237={'include':[{'model':db['Pause'],'as':_0x6d4b('0x3f')}]},_0x3272d9={},_0x56b0d6={'count':0x0,'rows':[]};var _0x202854=_[_0x6d4b('0x40')](db['FaxAccount']['rawAttributes'],function(_0x29403f){return{'name':_0x29403f[_0x6d4b('0x41')],'type':_0x29403f[_0x6d4b('0x42')]['key']};});_0x3272d9[_0x6d4b('0x43')]=_[_0x6d4b('0x40')](_0x202854,_0x6d4b('0x3c'));_0x3272d9[_0x6d4b('0x44')]=_[_0x6d4b('0x45')](_0x36d094[_0x6d4b('0x44')]);_0x3272d9['filters']=_[_0x6d4b('0x46')](_0x3272d9[_0x6d4b('0x43')],_0x3272d9[_0x6d4b('0x44')]);_0x1f0237[_0x6d4b('0x47')]=_[_0x6d4b('0x46')](_0x3272d9[_0x6d4b('0x43')],qs[_0x6d4b('0x48')](_0x36d094[_0x6d4b('0x44')][_0x6d4b('0x48')]));_0x1f0237[_0x6d4b('0x47')]=_0x1f0237['attributes'][_0x6d4b('0x49')]?_0x1f0237[_0x6d4b('0x47')]:_0x3272d9[_0x6d4b('0x43')];if(!_0x36d094[_0x6d4b('0x44')][_0x6d4b('0x4a')](_0x6d4b('0x4b'))){_0x1f0237['limit']=qs[_0x6d4b('0x30')](_0x36d094[_0x6d4b('0x44')]['limit']);_0x1f0237[_0x6d4b('0x2e')]=qs[_0x6d4b('0x2e')](_0x36d094[_0x6d4b('0x44')][_0x6d4b('0x2e')]);}_0x1f0237[_0x6d4b('0x4c')]=qs[_0x6d4b('0x4d')](_0x36d094[_0x6d4b('0x44')][_0x6d4b('0x4d')]);_0x1f0237[_0x6d4b('0x4e')]=qs['filters'](_[_0x6d4b('0x4f')](_0x36d094[_0x6d4b('0x44')],_0x3272d9['filters']),_0x202854);if(_0x36d094[_0x6d4b('0x44')][_0x6d4b('0x50')]){_0x1f0237[_0x6d4b('0x4e')]=_[_0x6d4b('0x51')](_0x1f0237[_0x6d4b('0x4e')],{'$or':_['map'](_0x202854,function(_0x53f4b7){if(_0x53f4b7[_0x6d4b('0x42')]!==_0x6d4b('0x52')){var _0x7ce238={};_0x7ce238[_0x53f4b7[_0x6d4b('0x3c')]]={'$like':'%'+_0x36d094[_0x6d4b('0x44')]['filter']+'%'};return _0x7ce238;}})});}_0x1f0237=_[_0x6d4b('0x51')]({},_0x1f0237,_0x36d094['options']);var _0x102963={'where':_0x1f0237[_0x6d4b('0x4e')]};return db['FaxAccount'][_0x6d4b('0x31')](_0x102963)[_0x6d4b('0x1e')](function(_0x27171d){_0x56b0d6[_0x6d4b('0x31')]=_0x27171d;if(_0x36d094[_0x6d4b('0x44')][_0x6d4b('0x53')]){_0x1f0237[_0x6d4b('0x54')]=[{'all':!![]}];}return db[_0x6d4b('0x55')]['findAll'](_0x1f0237);})[_0x6d4b('0x1e')](function(_0x46adb6){_0x56b0d6[_0x6d4b('0x56')]=_0x46adb6;return _0x56b0d6;})[_0x6d4b('0x1e')](respondWithFilteredResult(_0x20f448,_0x1f0237))[_0x6d4b('0x29')](handleError(_0x20f448,null));};exports['show']=function(_0x3df2aa,_0x6736f4){var _0x3e46b5={'raw':![],'where':{'id':_0x3df2aa['params']['id']},'include':[{'model':db['Pause'],'as':_0x6d4b('0x3f')}]},_0x50c073={};_0x50c073['model']=_[_0x6d4b('0x45')](db[_0x6d4b('0x55')][_0x6d4b('0x57')]);_0x50c073[_0x6d4b('0x44')]=_[_0x6d4b('0x45')](_0x3df2aa[_0x6d4b('0x44')]);_0x50c073['filters']=_[_0x6d4b('0x46')](_0x50c073[_0x6d4b('0x43')],_0x50c073[_0x6d4b('0x44')]);_0x3e46b5[_0x6d4b('0x47')]=_[_0x6d4b('0x46')](_0x50c073[_0x6d4b('0x43')],qs[_0x6d4b('0x48')](_0x3df2aa[_0x6d4b('0x44')][_0x6d4b('0x48')]));_0x3e46b5[_0x6d4b('0x47')]=_0x3e46b5['attributes'][_0x6d4b('0x49')]?_0x3e46b5['attributes']:_0x50c073[_0x6d4b('0x43')];if(_0x3df2aa[_0x6d4b('0x44')]['includeAll']){_0x3e46b5[_0x6d4b('0x54')]=[{'all':!![]}];}_0x3e46b5=_[_0x6d4b('0x51')]({},_0x3e46b5,_0x3df2aa[_0x6d4b('0x58')]);return db[_0x6d4b('0x55')]['find'](_0x3e46b5)[_0x6d4b('0x1e')](handleEntityNotFound(_0x6736f4,null))[_0x6d4b('0x1e')](respondWithResult(_0x6736f4,null))[_0x6d4b('0x29')](handleError(_0x6736f4,null));};exports[_0x6d4b('0x59')]=function(_0x21d512,_0x5746f5){return db[_0x6d4b('0x55')][_0x6d4b('0x59')](_0x21d512['body'],{})[_0x6d4b('0x1e')](function(_0x1edfb4){var _0x328d6a=_0x21d512[_0x6d4b('0x5a')][_0x6d4b('0x37')]({'plain':!![]});if(!_0x328d6a)throw new Error(_0x6d4b('0x5b'));if(_0x328d6a['role']===_0x6d4b('0x5a')){var _0x110530=_0x1edfb4[_0x6d4b('0x37')]({'plain':!![]});var _0x3d57c0=_0x6d4b('0x38');return db[_0x6d4b('0x5c')][_0x6d4b('0x5d')]({'where':{'name':_0x3d57c0,'userProfileId':_0x328d6a['userProfileId']},'raw':!![]})[_0x6d4b('0x1e')](function(_0x4b8295){if(_0x4b8295&&_0x4b8295['autoAssociation']===0x0){return db[_0x6d4b('0x39')][_0x6d4b('0x59')]({'name':_0x110530[_0x6d4b('0x3c')],'resourceId':_0x110530['id'],'type':_0x4b8295[_0x6d4b('0x3c')],'sectionId':_0x4b8295['id']},{})[_0x6d4b('0x1e')](function(){return _0x1edfb4;});}else{return _0x1edfb4;}})[_0x6d4b('0x29')](function(_0x45d6fb){logger['error'](_0x6d4b('0x5e'),_0x45d6fb);throw _0x45d6fb;});}return _0x1edfb4;})['then'](respondWithResult(_0x5746f5,0xc9))[_0x6d4b('0x29')](handleError(_0x5746f5,null));};exports[_0x6d4b('0x36')]=function(_0x13ed07,_0x490b77){if(_0x13ed07[_0x6d4b('0x5f')]['id']){delete _0x13ed07[_0x6d4b('0x5f')]['id'];}return db[_0x6d4b('0x55')][_0x6d4b('0x5d')]({'where':{'id':_0x13ed07[_0x6d4b('0x60')]['id']},'include':[{'model':db['Pause'],'as':_0x6d4b('0x3f')}]})[_0x6d4b('0x1e')](handleEntityNotFound(_0x490b77,null))['then'](saveUpdates(_0x13ed07[_0x6d4b('0x5f')],null))[_0x6d4b('0x1e')](respondWithResult(_0x490b77,null))[_0x6d4b('0x29')](handleError(_0x490b77,null));};exports['destroy']=function(_0x2b0d08,_0x298261){return db[_0x6d4b('0x55')][_0x6d4b('0x5d')]({'where':{'id':_0x2b0d08[_0x6d4b('0x60')]['id']}})[_0x6d4b('0x1e')](handleEntityNotFound(_0x298261,null))[_0x6d4b('0x1e')](removeEntity(_0x298261,null))[_0x6d4b('0x29')](handleError(_0x298261,null));};exports[_0x6d4b('0x61')]=function(_0x4092c5,_0x5602a2){return db[_0x6d4b('0x55')][_0x6d4b('0x61')]()[_0x6d4b('0x1e')](respondWithResult(_0x5602a2,null))['catch'](handleError(_0x5602a2,null));};exports[_0x6d4b('0x62')]=function(_0x1e8281,_0x4aeb39,_0x59f482){if(_0x1e8281[_0x6d4b('0x5f')]['id']){delete _0x1e8281[_0x6d4b('0x5f')]['id'];}return db[_0x6d4b('0x55')][_0x6d4b('0x5d')]({'where':{'id':_0x1e8281['params']['id']}})[_0x6d4b('0x1e')](handleEntityNotFound(_0x4aeb39,null))[_0x6d4b('0x1e')](function(_0x585270){if(_0x585270){_0x1e8281['body'][_0x6d4b('0x63')]=_0x585270['id'];return db[_0x6d4b('0x64')][_0x6d4b('0x59')](_0x1e8281[_0x6d4b('0x5f')]);}})['then'](respondWithResult(_0x4aeb39,null))[_0x6d4b('0x29')](handleError(_0x4aeb39,null));};exports[_0x6d4b('0x65')]=function(_0x4d32cd,_0x3f6d86,_0x2ab2e0){var _0x44fdc3={'raw':![],'where':{}};var _0x25e9e4={};var _0x56bc26={'count':0x0,'rows':[]};return db[_0x6d4b('0x55')][_0x6d4b('0x66')]({'where':{'id':_0x4d32cd[_0x6d4b('0x60')]['id']}})[_0x6d4b('0x1e')](handleEntityNotFound(_0x3f6d86,null))[_0x6d4b('0x1e')](function(_0x50ad86){if(_0x50ad86){_0x25e9e4['model']=_[_0x6d4b('0x45')](db[_0x6d4b('0x64')][_0x6d4b('0x57')]);_0x25e9e4[_0x6d4b('0x44')]=_[_0x6d4b('0x45')](_0x4d32cd[_0x6d4b('0x44')]);_0x25e9e4[_0x6d4b('0x67')]=_['intersection'](_0x25e9e4[_0x6d4b('0x43')],_0x25e9e4[_0x6d4b('0x44')]);_0x44fdc3[_0x6d4b('0x47')]=_[_0x6d4b('0x46')](_0x25e9e4[_0x6d4b('0x43')],qs[_0x6d4b('0x48')](_0x4d32cd['query'][_0x6d4b('0x48')]));_0x44fdc3['attributes']=_0x44fdc3[_0x6d4b('0x47')][_0x6d4b('0x49')]?_0x44fdc3['attributes']:_0x25e9e4[_0x6d4b('0x43')];if(!_0x4d32cd['query']['hasOwnProperty'](_0x6d4b('0x4b'))){_0x44fdc3['limit']=qs[_0x6d4b('0x30')](_0x4d32cd[_0x6d4b('0x44')][_0x6d4b('0x30')]);_0x44fdc3[_0x6d4b('0x2e')]=qs[_0x6d4b('0x2e')](_0x4d32cd[_0x6d4b('0x44')]['offset']);}_0x44fdc3[_0x6d4b('0x4c')]=qs[_0x6d4b('0x4d')](_0x4d32cd[_0x6d4b('0x44')][_0x6d4b('0x4d')]);_0x44fdc3[_0x6d4b('0x4e')]=qs[_0x6d4b('0x67')](_[_0x6d4b('0x4f')](_0x4d32cd['query'],_0x25e9e4[_0x6d4b('0x67')]));_0x44fdc3[_0x6d4b('0x4e')][_0x6d4b('0x63')]=_0x50ad86['id'];if(_0x4d32cd['query']['filter']){_0x44fdc3[_0x6d4b('0x4e')]=_['merge'](_0x44fdc3[_0x6d4b('0x4e')],{'$or':_['map'](_0x44fdc3[_0x6d4b('0x47')],function(_0x4601dd){var _0xe693aa={};_0xe693aa[_0x4601dd]={'$like':'%'+_0x4d32cd['query'][_0x6d4b('0x50')]+'%'};return _0xe693aa;})});}_0x44fdc3=_['merge']({},_0x44fdc3,_0x4d32cd[_0x6d4b('0x58')]);return db['Disposition'][_0x6d4b('0x31')]({'where':_0x44fdc3['where']})[_0x6d4b('0x1e')](function(_0x5e2127){_0x56bc26['count']=_0x5e2127;if(_0x4d32cd[_0x6d4b('0x44')][_0x6d4b('0x53')]){_0x44fdc3['include']=[{'all':!![]}];}return db[_0x6d4b('0x64')][_0x6d4b('0x68')](_0x44fdc3);})[_0x6d4b('0x1e')](function(_0x55dc49){_0x56bc26['rows']=_0x55dc49;return _0x56bc26;});}})[_0x6d4b('0x1e')](respondWithFilteredResult(_0x3f6d86,_0x44fdc3))[_0x6d4b('0x29')](handleError(_0x3f6d86,null));};exports[_0x6d4b('0x69')]=function(_0x18cc73,_0x10556e,_0x809d24){return db[_0x6d4b('0x55')]['find']({'where':{'id':_0x18cc73[_0x6d4b('0x60')]['id']}})[_0x6d4b('0x1e')](handleEntityNotFound(_0x10556e,null))[_0x6d4b('0x1e')](function(_0x1567dc){if(_0x1567dc){return _0x1567dc[_0x6d4b('0x69')](_0x18cc73[_0x6d4b('0x44')][_0x6d4b('0x6a')]);}})['then'](respondWithStatusCode(_0x10556e,null))[_0x6d4b('0x29')](handleError(_0x10556e,null));};exports['addAnswer']=function(_0x15e77c,_0x21efe3,_0x2c9222){if(_0x15e77c[_0x6d4b('0x5f')]['id']){delete _0x15e77c['body']['id'];}return db[_0x6d4b('0x55')][_0x6d4b('0x5d')]({'where':{'id':_0x15e77c[_0x6d4b('0x60')]['id']}})[_0x6d4b('0x1e')](handleEntityNotFound(_0x21efe3,null))['then'](function(_0x37db59){if(_0x37db59){_0x15e77c[_0x6d4b('0x5f')][_0x6d4b('0x63')]=_0x37db59['id'];return db[_0x6d4b('0x6b')][_0x6d4b('0x59')](_0x15e77c[_0x6d4b('0x5f')]);}})[_0x6d4b('0x1e')](respondWithResult(_0x21efe3,null))['catch'](handleError(_0x21efe3,null));};exports[_0x6d4b('0x6c')]=function(_0x589192,_0xd860d7,_0xa95dd5){var _0x8191ec={'raw':![],'where':{}};var _0x366c2b={};var _0x51c6b2={'count':0x0,'rows':[]};return db['FaxAccount'][_0x6d4b('0x66')]({'where':{'id':_0x589192[_0x6d4b('0x60')]['id']}})['then'](handleEntityNotFound(_0xd860d7,null))[_0x6d4b('0x1e')](function(_0x24150c){if(_0x24150c){_0x366c2b[_0x6d4b('0x43')]=_[_0x6d4b('0x45')](db[_0x6d4b('0x6b')]['rawAttributes']);_0x366c2b['query']=_[_0x6d4b('0x45')](_0x589192['query']);_0x366c2b[_0x6d4b('0x67')]=_[_0x6d4b('0x46')](_0x366c2b[_0x6d4b('0x43')],_0x366c2b[_0x6d4b('0x44')]);_0x8191ec[_0x6d4b('0x47')]=_['intersection'](_0x366c2b[_0x6d4b('0x43')],qs[_0x6d4b('0x48')](_0x589192[_0x6d4b('0x44')][_0x6d4b('0x48')]));_0x8191ec[_0x6d4b('0x47')]=_0x8191ec[_0x6d4b('0x47')][_0x6d4b('0x49')]?_0x8191ec[_0x6d4b('0x47')]:_0x366c2b[_0x6d4b('0x43')];if(!_0x589192[_0x6d4b('0x44')][_0x6d4b('0x4a')]('nolimit')){_0x8191ec[_0x6d4b('0x30')]=qs[_0x6d4b('0x30')](_0x589192[_0x6d4b('0x44')][_0x6d4b('0x30')]);_0x8191ec[_0x6d4b('0x2e')]=qs[_0x6d4b('0x2e')](_0x589192['query'][_0x6d4b('0x2e')]);}_0x8191ec[_0x6d4b('0x4c')]=qs['sort'](_0x589192['query'][_0x6d4b('0x4d')]);_0x8191ec[_0x6d4b('0x4e')]=qs[_0x6d4b('0x67')](_[_0x6d4b('0x4f')](_0x589192[_0x6d4b('0x44')],_0x366c2b[_0x6d4b('0x67')]));_0x8191ec[_0x6d4b('0x4e')][_0x6d4b('0x63')]=_0x24150c['id'];if(_0x589192['query'][_0x6d4b('0x50')]){_0x8191ec[_0x6d4b('0x4e')]=_[_0x6d4b('0x51')](_0x8191ec['where'],{'$or':_['map'](_0x8191ec[_0x6d4b('0x47')],function(_0x5c3221){var _0x2b1022={};_0x2b1022[_0x5c3221]={'$like':'%'+_0x589192[_0x6d4b('0x44')][_0x6d4b('0x50')]+'%'};return _0x2b1022;})});}_0x8191ec=_[_0x6d4b('0x51')]({},_0x8191ec,_0x589192[_0x6d4b('0x58')]);return db[_0x6d4b('0x6b')]['count']({'where':_0x8191ec['where']})[_0x6d4b('0x1e')](function(_0x2ce54b){_0x51c6b2[_0x6d4b('0x31')]=_0x2ce54b;if(_0x589192[_0x6d4b('0x44')][_0x6d4b('0x53')]){_0x8191ec[_0x6d4b('0x54')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x8191ec);})['then'](function(_0x28f6aa){_0x51c6b2[_0x6d4b('0x56')]=_0x28f6aa;return _0x51c6b2;});}})[_0x6d4b('0x1e')](respondWithFilteredResult(_0xd860d7,_0x8191ec))[_0x6d4b('0x29')](handleError(_0xd860d7,null));};exports[_0x6d4b('0x6d')]=function(_0xcb356b,_0x31ffb5,_0x22d24b){return db[_0x6d4b('0x55')][_0x6d4b('0x5d')]({'where':{'id':_0xcb356b['params']['id']}})[_0x6d4b('0x1e')](handleEntityNotFound(_0x31ffb5,null))[_0x6d4b('0x1e')](function(_0x36b26f){if(_0x36b26f){return _0x36b26f[_0x6d4b('0x6d')](_0xcb356b[_0x6d4b('0x44')][_0x6d4b('0x6a')]);}})['then'](respondWithStatusCode(_0x31ffb5,null))['catch'](handleError(_0x31ffb5,null));};exports[_0x6d4b('0x6e')]=function(_0x45a7f2,_0x35dca8,_0x3c7917){return db[_0x6d4b('0x6f')][_0x6d4b('0x5d')]({'where':{'id':_0x45a7f2['params']['id']}})['then'](handleEntityNotFound(_0x35dca8,null))['then'](function(_0x3aa841){if(_0x3aa841){return _0x3aa841[_0x6d4b('0x6e')](_0x45a7f2[_0x6d4b('0x5f')][_0x6d4b('0x6a')],_['omit'](_0x45a7f2[_0x6d4b('0x5f')],[_0x6d4b('0x6a'),'id'])||{});}})[_0x6d4b('0x1e')](respondWithResult(_0x35dca8,null))[_0x6d4b('0x29')](handleError(_0x35dca8,null));};exports[_0x6d4b('0x70')]=function(_0x11ec77,_0x222d1d,_0x4f25c6){var _0x32601a={'raw':![],'where':{}};var _0x2605fe={};var _0x22c2f9={'count':0x0,'rows':[]};return db[_0x6d4b('0x55')][_0x6d4b('0x66')]({'where':{'id':_0x11ec77['params']['id']}})[_0x6d4b('0x1e')](handleEntityNotFound(_0x222d1d,null))['then'](function(_0x1f9e33){if(_0x1f9e33){_0x2605fe[_0x6d4b('0x43')]=_['keys'](db['FaxInteraction'][_0x6d4b('0x57')]);_0x2605fe[_0x6d4b('0x44')]=_[_0x6d4b('0x45')](_0x11ec77[_0x6d4b('0x44')]);_0x2605fe[_0x6d4b('0x67')]=_[_0x6d4b('0x46')](_0x2605fe[_0x6d4b('0x43')],_0x2605fe[_0x6d4b('0x44')]);_0x32601a[_0x6d4b('0x47')]=_[_0x6d4b('0x46')](_0x2605fe[_0x6d4b('0x43')],qs[_0x6d4b('0x48')](_0x11ec77[_0x6d4b('0x44')][_0x6d4b('0x48')]));_0x32601a[_0x6d4b('0x47')]=_0x32601a[_0x6d4b('0x47')][_0x6d4b('0x49')]?_0x32601a[_0x6d4b('0x47')]:_0x2605fe[_0x6d4b('0x43')];if(!_0x11ec77[_0x6d4b('0x44')][_0x6d4b('0x4a')](_0x6d4b('0x4b'))){_0x32601a['limit']=qs[_0x6d4b('0x30')](_0x11ec77[_0x6d4b('0x44')][_0x6d4b('0x30')]);_0x32601a[_0x6d4b('0x2e')]=qs[_0x6d4b('0x2e')](_0x11ec77[_0x6d4b('0x44')][_0x6d4b('0x2e')]);}_0x32601a[_0x6d4b('0x4c')]=qs[_0x6d4b('0x4d')](_0x11ec77[_0x6d4b('0x44')]['sort']);_0x32601a['where']=qs['filters'](_['pick'](_0x11ec77[_0x6d4b('0x44')],_0x2605fe[_0x6d4b('0x67')]));_0x32601a['where']['FaxAccountId']=_0x1f9e33['id'];if(_0x11ec77['query']['filter']){_0x32601a[_0x6d4b('0x4e')]=_[_0x6d4b('0x51')](_0x32601a[_0x6d4b('0x4e')],{'$or':_[_0x6d4b('0x40')](_0x32601a[_0x6d4b('0x47')],function(_0x4656be){var _0x55f64c={};_0x55f64c[_0x4656be]={'$like':'%'+_0x11ec77[_0x6d4b('0x44')][_0x6d4b('0x50')]+'%'};return _0x55f64c;})});}_0x32601a=_[_0x6d4b('0x51')]({},_0x32601a,_0x11ec77[_0x6d4b('0x58')]);return db[_0x6d4b('0x6f')]['count']({'where':_0x32601a[_0x6d4b('0x4e')]})[_0x6d4b('0x1e')](function(_0x5f4992){_0x22c2f9['count']=_0x5f4992;if(_0x11ec77['query'][_0x6d4b('0x53')]){_0x32601a[_0x6d4b('0x54')]=[{'model':db[_0x6d4b('0x71')],'as':'Contact','required':![]},{'model':db[_0x6d4b('0x72')],'as':_0x6d4b('0x73'),'attributes':[_0x6d4b('0x3c'),_0x6d4b('0x74'),_0x6d4b('0x75')],'required':![]},{'model':db[_0x6d4b('0x76')],'as':'Tags','attributes':['id','name',_0x6d4b('0x77')],'where':_0x11ec77['query'][_0x6d4b('0x78')]?{'id':_0x11ec77[_0x6d4b('0x44')][_0x6d4b('0x78')]}:undefined,'required':_0x11ec77[_0x6d4b('0x44')][_0x6d4b('0x78')]?!![]:![]}];}return db[_0x6d4b('0x6f')]['findAll'](_0x32601a);})[_0x6d4b('0x1e')](function(_0x19dfcf){_0x22c2f9['rows']=_0x19dfcf;return _0x22c2f9;});}})[_0x6d4b('0x1e')](respondWithFilteredResult(_0x222d1d,_0x32601a))[_0x6d4b('0x29')](handleError(_0x222d1d,null));};exports['addApplications']=function(_0x14c853,_0x5e62b6){var _0xf51989=_0x14c853[_0x6d4b('0x60')]['id'];var _0x1c7798=_0x14c853['body'];var _0x43fee2=0xc8;var _0x49e0cc=null;return db[_0x6d4b('0x79')]['transaction']({'isolationLevel':db[_0x6d4b('0x79')]['Transaction']['ISOLATION_LEVELS'][_0x6d4b('0x7a')]},function(_0x4dc780){return db[_0x6d4b('0x55')][_0x6d4b('0x66')]({'where':{'id':_0xf51989},'transaction':_0x4dc780})['then'](function(_0x41bbbc){if(_0x41bbbc){return db[_0x6d4b('0x7b')][_0x6d4b('0x3a')]({'where':{'FaxAccountId':_0xf51989},'transaction':_0x4dc780})[_0x6d4b('0x1e')](function(){var _0x19ef56=_[_0x6d4b('0x40')](_0x1c7798,function(_0x286fb8){_0x286fb8[_0x6d4b('0x63')]=_0xf51989;return _0x286fb8;});return db['FaxApplication']['bulkCreate'](_0x19ef56,{'transaction':_0x4dc780});});}else{_0x43fee2=0x194;_0x49e0cc=[];}});})['then'](function(){if(_0x43fee2!==0x194){return db[_0x6d4b('0x7b')]['findAndCountAll']({'where':{'FaxAccountId':_0xf51989},'order':_0x6d4b('0x7c')})[_0x6d4b('0x1e')](function(_0x2727f7){_0x49e0cc=_0x2727f7;});}})[_0x6d4b('0x29')](function(_0xb1a8c){_0x43fee2=0x1f4;logger['error'](_0xb1a8c[_0x6d4b('0x3b')]);if(_0xb1a8c['name']){delete _0xb1a8c['name'];}_0x49e0cc=_0xb1a8c;})[_0x6d4b('0x7d')](function(){if(_0x49e0cc===null){_0x5e62b6['sendStatus'](_0x43fee2);}else{if(_0x43fee2===0x1f4){_0x5e62b6['status'](_0x43fee2)['send'](_0x49e0cc);}else{_0x5e62b6['status'](_0x43fee2)[_0x6d4b('0x2d')](_0x49e0cc);}}});};exports[_0x6d4b('0x7e')]=function(_0x3030da,_0x3d070e,_0x4de13d){var _0x595a6a={};var _0x14034b={};var _0x48d55f;var _0x2425ad;return db[_0x6d4b('0x55')][_0x6d4b('0x66')]({'where':{'id':_0x3030da['params']['id']}})[_0x6d4b('0x1e')](handleEntityNotFound(_0x3d070e,null))[_0x6d4b('0x1e')](function(_0x483ad8){if(_0x483ad8){_0x48d55f=_0x483ad8;_0x14034b[_0x6d4b('0x43')]=_[_0x6d4b('0x45')](db['FaxApplication'][_0x6d4b('0x57')]);_0x14034b[_0x6d4b('0x44')]=_['keys'](_0x3030da[_0x6d4b('0x44')]);_0x14034b[_0x6d4b('0x67')]=_[_0x6d4b('0x46')](_0x14034b[_0x6d4b('0x43')],_0x14034b[_0x6d4b('0x44')]);_0x595a6a[_0x6d4b('0x47')]=_[_0x6d4b('0x46')](_0x14034b[_0x6d4b('0x43')],qs[_0x6d4b('0x48')](_0x3030da['query']['fields']));_0x595a6a[_0x6d4b('0x47')]=_0x595a6a[_0x6d4b('0x47')][_0x6d4b('0x49')]?_0x595a6a[_0x6d4b('0x47')]:_0x14034b[_0x6d4b('0x43')];_0x595a6a[_0x6d4b('0x4c')]=qs[_0x6d4b('0x4d')](_0x3030da[_0x6d4b('0x44')][_0x6d4b('0x4d')]);_0x595a6a['where']=qs['filters'](_[_0x6d4b('0x4f')](_0x3030da[_0x6d4b('0x44')],_0x14034b[_0x6d4b('0x67')]));if(_0x3030da[_0x6d4b('0x44')]['filter']){_0x595a6a[_0x6d4b('0x4e')]=_[_0x6d4b('0x51')](_0x595a6a[_0x6d4b('0x4e')],{'$or':_['map'](_0x595a6a[_0x6d4b('0x47')],function(_0x473d53){var _0x2ab9ed={};_0x2ab9ed[_0x473d53]={'$like':'%'+_0x3030da[_0x6d4b('0x44')]['filter']+'%'};return _0x2ab9ed;})});}_0x595a6a=_[_0x6d4b('0x51')]({},_0x595a6a,_0x3030da[_0x6d4b('0x58')]);return _0x48d55f[_0x6d4b('0x7e')](_0x595a6a);}})[_0x6d4b('0x1e')](function(_0xed779a){if(_0xed779a){_0x2425ad=_0xed779a[_0x6d4b('0x49')];if(!_0x3030da[_0x6d4b('0x44')][_0x6d4b('0x4a')](_0x6d4b('0x4b'))){_0x595a6a['limit']=qs[_0x6d4b('0x30')](_0x3030da['query'][_0x6d4b('0x30')]);_0x595a6a['offset']=qs['offset'](_0x3030da[_0x6d4b('0x44')][_0x6d4b('0x2e')]);}return _0x48d55f[_0x6d4b('0x7e')](_0x595a6a);}})[_0x6d4b('0x1e')](function(_0x28267a){if(_0x28267a){return _0x28267a?{'count':_0x2425ad,'rows':_0x28267a}:null;}})[_0x6d4b('0x1e')](respondWithResult(_0x3d070e,null))[_0x6d4b('0x29')](handleError(_0x3d070e,null));};function Extension(_0x53f3c2,_0x34658b,_0x598877,_0x4acd3b){this['context']=_0x6d4b('0x7f');this[_0x6d4b('0x80')]=_0x53f3c2[_0x6d4b('0x81')];this['app']=_0x4acd3b;this[_0x6d4b('0x42')]=_0x6d4b('0x82');this[_0x6d4b('0x83')]=_0x6d4b('0x84');this[_0x6d4b('0x63')]=_0x53f3c2['id'];this[_0x6d4b('0x7c')]=_0x34658b;this[_0x6d4b('0x85')]=_0x598877;}function createExtensionsReciveFax(_0x552d68){var _0x4b81db=0x1;var _0x4578b8=[];_0x4578b8[_0x6d4b('0x86')](new Extension(_0x552d68,_0x4b81db,'',_0x6d4b('0x87')));_0x4b81db+=0x1;_0x4578b8['push'](new Extension(_0x552d68,_0x4b81db,_0x6d4b('0x88'),_0x6d4b('0x89')));_0x4b81db+=0x1;for(var _0x25dfd5 in _0x552d68){if(_0x552d68[_0x6d4b('0x4a')](_0x25dfd5)&&(_0x25dfd5===_0x6d4b('0x8a')||_0x25dfd5===_0x6d4b('0x81')||_0x25dfd5===_0x6d4b('0x8b')||_0x25dfd5===_0x6d4b('0x8c')||_0x25dfd5===_0x6d4b('0x8d')||_0x25dfd5==='maxrate'||_0x25dfd5==='minrate'||_0x25dfd5===_0x6d4b('0x8e')||_0x25dfd5==='t38timeout')){_0x4578b8[_0x6d4b('0x86')](new Extension(_0x552d68,_0x4b81db,_0x6d4b('0x8f')+_0x25dfd5+')='+_0x552d68[_0x25dfd5],_0x6d4b('0x89')));_0x4b81db+=0x1;}}_0x4578b8[_0x6d4b('0x86')](new Extension(_0x552d68,_0x4b81db,'6',_0x6d4b('0x90')));_0x4b81db+=0x1;_0x4578b8['push'](new Extension(_0x552d68,_0x4b81db,_0x6d4b('0x91'),'ReceiveFax'));_0x4b81db=0x0;return _0x4578b8;}exports[_0x6d4b('0x92')]=function(_0xcb7d8d,_0x286173,_0x58211b){var _0x197051;return db[_0x6d4b('0x79')][_0x6d4b('0x93')](function(_0x69ee05){return db['FaxAccount']['create'](_0xcb7d8d[_0x6d4b('0x5f')],{'transaction':_0x69ee05})[_0x6d4b('0x1e')](function(_0x417e0b){_0x197051=_0x417e0b['get']({'plain':!![]});return db[_0x6d4b('0x94')]['bulkCreate'](createExtensionsReciveFax(_0x197051),{'transaction':_0x69ee05});});})[_0x6d4b('0x1e')](function(){return _0x197051;})[_0x6d4b('0x1e')](respondWithResult(_0x286173,null))[_0x6d4b('0x29')](handleError(_0x286173,null));};exports[_0x6d4b('0x95')]=function(_0x29f107,_0x594d22,_0x419198){var _0x42c88c;return db[_0x6d4b('0x79')]['transaction'](function(_0x2e8d96){return db[_0x6d4b('0x55')]['update'](_0x29f107[_0x6d4b('0x5f')],{'where':{'id':_0x29f107[_0x6d4b('0x5f')]['id']},'transaction':_0x2e8d96})['then'](function(_0x341c8f){return db['VoiceExtension'][_0x6d4b('0x3a')]({'where':{'FaxAccountId':_0x29f107['body']['id']},'transaction':_0x2e8d96})[_0x6d4b('0x1e')](function(_0x4eed11){return db['VoiceExtension']['bulkCreate'](createExtensionsReciveFax(_[_0x6d4b('0x96')](_0x29f107[_0x6d4b('0x5f')],['tech','key','createdAt',_0x6d4b('0x97'),_0x6d4b('0x98'),'ListId'])),{'transaction':_0x2e8d96});});});})[_0x6d4b('0x1e')](function(){return db[_0x6d4b('0x55')][_0x6d4b('0x99')](_0x29f107[_0x6d4b('0x5f')]['id']);})['then'](respondWithResult(_0x594d22,null))['catch'](handleError(_0x594d22,null));};exports['getMessages']=function(_0x37fd93,_0x47437a,_0x3ba0d2){var _0x49afc7={'raw':!![],'where':{}};var _0x5b8f99={};var _0x160009={'count':0x0,'rows':[]};return db[_0x6d4b('0x55')]['findOne']({'where':{'id':_0x37fd93[_0x6d4b('0x60')]['id']}})['then'](handleEntityNotFound(_0x47437a,null))[_0x6d4b('0x1e')](function(_0x193eb0){if(_0x193eb0){_0x5b8f99[_0x6d4b('0x43')]=_[_0x6d4b('0x45')](db[_0x6d4b('0x9a')]['rawAttributes']);_0x5b8f99[_0x6d4b('0x44')]=_['keys'](_0x37fd93[_0x6d4b('0x44')]);_0x5b8f99[_0x6d4b('0x67')]=_[_0x6d4b('0x46')](_0x5b8f99[_0x6d4b('0x43')],_0x5b8f99['query']);_0x49afc7[_0x6d4b('0x47')]=_[_0x6d4b('0x46')](_0x5b8f99[_0x6d4b('0x43')],qs[_0x6d4b('0x48')](_0x37fd93[_0x6d4b('0x44')][_0x6d4b('0x48')]));_0x49afc7[_0x6d4b('0x47')]=_0x49afc7['attributes'][_0x6d4b('0x49')]?_0x49afc7[_0x6d4b('0x47')]:_0x5b8f99['model'];if(!_0x37fd93['query']['hasOwnProperty']('nolimit')){_0x49afc7['limit']=qs[_0x6d4b('0x30')](_0x37fd93[_0x6d4b('0x44')][_0x6d4b('0x30')]);_0x49afc7[_0x6d4b('0x2e')]=qs[_0x6d4b('0x2e')](_0x37fd93[_0x6d4b('0x44')][_0x6d4b('0x2e')]);}_0x49afc7[_0x6d4b('0x4c')]=qs[_0x6d4b('0x4d')](_0x37fd93['query'][_0x6d4b('0x4d')]);_0x49afc7[_0x6d4b('0x4e')]=qs[_0x6d4b('0x67')](_['pick'](_0x37fd93['query'],_0x5b8f99['filters']));_0x49afc7[_0x6d4b('0x4e')][_0x6d4b('0x63')]=_0x193eb0['id'];if(_0x37fd93[_0x6d4b('0x44')][_0x6d4b('0x50')]){_0x49afc7[_0x6d4b('0x4e')]=_['merge'](_0x49afc7['where'],{'$or':_['map'](_0x49afc7[_0x6d4b('0x47')],function(_0x2add8a){var _0x2e47aa={};_0x2e47aa[_0x2add8a]={'$like':'%'+_0x37fd93[_0x6d4b('0x44')][_0x6d4b('0x50')]+'%'};return _0x2e47aa;})});}if(_0x37fd93['query']['$gte']){var _0x505437=_0x37fd93[_0x6d4b('0x44')][_0x6d4b('0x9b')][_0x6d4b('0x9c')](',');var _0x4248ef={};_0x4248ef[_0x505437[0x0]]={'$gte':moment(_0x505437[0x1])['format'](_0x6d4b('0x9d'))};_0x49afc7[_0x6d4b('0x4e')]=_[_0x6d4b('0x51')](_0x49afc7[_0x6d4b('0x4e')],_0x4248ef);}_0x49afc7=_[_0x6d4b('0x51')]({},_0x49afc7,_0x37fd93[_0x6d4b('0x58')]);return db[_0x6d4b('0x9a')][_0x6d4b('0x31')]({'where':_0x49afc7['where']})[_0x6d4b('0x1e')](function(_0x24d43d){_0x160009[_0x6d4b('0x31')]=_0x24d43d;if(_0x37fd93[_0x6d4b('0x44')][_0x6d4b('0x53')]){_0x49afc7[_0x6d4b('0x54')]=[{'all':!![]}];}return db['FaxMessage'][_0x6d4b('0x68')](_0x49afc7);})[_0x6d4b('0x1e')](function(_0x490a74){_0x160009['rows']=_0x490a74;return _0x160009;});}})[_0x6d4b('0x1e')](respondWithFilteredResult(_0x47437a,_0x49afc7))['catch'](handleError(_0x47437a,null));};exports[_0x6d4b('0x3d')]=function(_0x4b7d88,_0x19005b,_0x4be59a){var _0x37bdf8,_0xadc30e={},_0x5b5ba7;if(_0x4b7d88[_0x6d4b('0x5f')]['to']){_0x5b5ba7=_0x4b7d88[_0x6d4b('0x5f')]['to'][0x0];}return db[_0x6d4b('0x55')][_0x6d4b('0x5d')]({'where':{'id':_0x4b7d88['params']['id']},'include':[{'model':db[_0x6d4b('0x9e')],'as':_0x6d4b('0x9f'),'include':[{'model':db[_0x6d4b('0x71')],'as':_0x6d4b('0xa0'),'where':{'fax':_0x5b5ba7},'limit':0x1,'order':[[_0x6d4b('0x97'),_0x6d4b('0xa1')]]}]}]})[_0x6d4b('0x1e')](handleEntityNotFound(_0x19005b,null))['then'](function(_0x3d3e1d){_0x37bdf8=_0x3d3e1d;if(_0x4b7d88[_0x6d4b('0x5f')][_0x6d4b('0xa2')]&&_0x4b7d88[_0x6d4b('0x5f')][_0x6d4b('0xa2')][_0x6d4b('0x49')]){for(var _0xd53357=0x0;_0xd53357<_0x4b7d88[_0x6d4b('0x5f')][_0x6d4b('0xa2')][_0x6d4b('0x49')];_0xd53357+=0x1){_0x4b7d88['body'][_0x6d4b('0xa2')][_0xd53357]={'filename':_0x4b7d88['body'][_0x6d4b('0xa2')][_0xd53357]['name'],'id':_0x4b7d88[_0x6d4b('0x5f')]['attachments'][_0xd53357]['id'],'path':path[_0x6d4b('0xa3')](config[_0x6d4b('0xa4')],_0x6d4b('0xa5'),_0x4b7d88[_0x6d4b('0x5f')]['attachments'][_0xd53357][_0x6d4b('0xa6')])};}}return respondWithRpcPromise(_0x6d4b('0xa7'),_0x6d4b('0xa7'),{'FaxAccountId':_[_0x6d4b('0xa8')](_0x4b7d88[_0x6d4b('0x60')]['id'])?undefined:_0x4b7d88[_0x6d4b('0x60')]['id'],'path':_[_0x6d4b('0xa8')](_0x4b7d88[_0x6d4b('0x5f')][_0x6d4b('0xa2')][0x0][_0x6d4b('0x7')])?undefined:_0x4b7d88[_0x6d4b('0x5f')]['attachments'][0x0][_0x6d4b('0x7')],'fax':_['isNil'](_0x4b7d88[_0x6d4b('0x5f')]['to'][0x0])?undefined:_0x4b7d88[_0x6d4b('0x5f')]['to'][0x0]},client9002);})['then'](function(){if(_0x37bdf8){if(_[_0x6d4b('0xa8')](_0x4b7d88[_0x6d4b('0x5f')][_0x6d4b('0xa9')])){_0x4b7d88[_0x6d4b('0x5f')][_0x6d4b('0xa9')]=util['format'](_0x6d4b('0xaa'),_0x37bdf8[_0x6d4b('0x3c')],_0x37bdf8['fax']);}if(_0x37bdf8[_0x6d4b('0x9f')]){if(_0x37bdf8[_0x6d4b('0x9f')][_0x6d4b('0xa0')]['length']){return _0x37bdf8[_0x6d4b('0x9f')][_0x6d4b('0xa0')][0x0];}else{return db['CmContact'][_0x6d4b('0x59')](_[_0x6d4b('0x18')](_0x4b7d88[_0x6d4b('0x5f')],{'firstName':_0x4b7d88[_0x6d4b('0x5f')]['to'][0x0],'phone':_0x4b7d88[_0x6d4b('0x5f')]['to'][0x0],'fax':_0x4b7d88[_0x6d4b('0x5f')]['to'][0x0],'ListId':_0x37bdf8[_0x6d4b('0xab')]}));}}else{throw new Error(_0x6d4b('0xac'));}}else{throw new Error(_0x6d4b('0xad'));}})[_0x6d4b('0x1e')](function(_0x28f435){if(_0x28f435){return db[_0x6d4b('0x6f')][_0x6d4b('0x5d')]({'where':{'ContactId':_0x28f435['id'],'closed':![],'FaxAccountId':_0x37bdf8['id']}})[_0x6d4b('0x1e')](function(_0x3c4835){if(_0x3c4835){return[_0x3c4835,![]];}return db['FaxInteraction']['create']({'UserId':_0x4b7d88[_0x6d4b('0x5a')]['id'],'ContactId':_0x28f435['id'],'FaxAccountId':_0x37bdf8['id'],'fax':_0x4b7d88[_0x6d4b('0x5f')]['to'][0x0],'firstMsgDirection':_0x6d4b('0xae'),'Messages':[_[_0x6d4b('0x51')](_0x4b7d88[_0x6d4b('0x5f')],{'read':![],'body':_0x4b7d88[_0x6d4b('0x5f')][_0x6d4b('0xa2')][0x0][_0x6d4b('0xaf')],'FaxAccountId':_0x37bdf8['id'],'UserId':_0x4b7d88[_0x6d4b('0x5a')]['id'],'ContactId':_0x28f435['id'],'AttachmentId':_0x4b7d88[_0x6d4b('0x5f')][_0x6d4b('0xa2')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':'Messages'}]})['then'](function(_0x1b5b51){return[_0x1b5b51,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})['spread'](function(_0x50b092,_0x42e20b){if(_0x42e20b){return _0x50b092;}return db[_0x6d4b('0x9a')][_0x6d4b('0x59')]({'direction':_0x6d4b('0xae'),'read':![],'body':_0x4b7d88[_0x6d4b('0x5f')][_0x6d4b('0xa2')][0x0][_0x6d4b('0xaf')],'FaxAccountId':_0x37bdf8['id'],'FaxInteractionId':_0x50b092['id'],'UserId':_0x4b7d88[_0x6d4b('0x5a')]['id'],'ContactId':_0x50b092[_0x6d4b('0xb0')],'AttachmentId':_0x4b7d88[_0x6d4b('0x5f')][_0x6d4b('0xa2')][0x0]['id']})[_0x6d4b('0x1e')](function(_0x2658d4){_0x50b092['dataValues'][_0x6d4b('0xb1')]=[];_0x50b092[_0x6d4b('0xb2')]['Messages']['push'](_0x2658d4[_0x6d4b('0xb2')]);return _0x50b092;});})['then'](function(_0x25cf75){respondWithRpcPromise(_0x6d4b('0xb3'),_0x6d4b('0xb3'),{'FaxAccountId':_[_0x6d4b('0xa8')](_0x4b7d88[_0x6d4b('0x60')]['id'])?undefined:_0x4b7d88['params']['id'],'path':_[_0x6d4b('0xa8')](_0x4b7d88[_0x6d4b('0x5f')][_0x6d4b('0xa2')][0x0]['path'])?undefined:_0x4b7d88[_0x6d4b('0x5f')]['attachments'][0x0]['path'],'fax':_[_0x6d4b('0xa8')](_0x4b7d88[_0x6d4b('0x5f')]['to'][0x0])?undefined:_0x4b7d88[_0x6d4b('0x5f')]['to'][0x0],'AttachmentId':_0x4b7d88[_0x6d4b('0x5f')]['attachments'][0x0]['id']},client9002)[_0x6d4b('0x1e')](function(_0x32fe8c){logger['info']('SendFaxRpc,\x20%s',_0x32fe8c);})[_0x6d4b('0x29')](function(_0x364a0d){logger['info'](_0x6d4b('0xb4'),_0x364a0d);});return _0x25cf75;})[_0x6d4b('0x1e')](respondWithResult(_0x19005b,null))[_0x6d4b('0x29')](handleError(_0x19005b,null));};exports[_0x6d4b('0xb5')]=function(_0x4db05c,_0x58a578,_0x19f6ee){return db[_0x6d4b('0x55')]['find']({'where':{'id':_0x4db05c['params']['id']}})[_0x6d4b('0x1e')](handleEntityNotFound(_0x58a578,null))[_0x6d4b('0x1e')](function(_0x5d0bfd){if(_0x5d0bfd){return _0x5d0bfd[_0x6d4b('0xb5')](_0x4db05c[_0x6d4b('0x5f')]['ids'],_[_0x6d4b('0x96')](_0x4db05c['body'],[_0x6d4b('0x6a'),'id'])||{})[_0x6d4b('0xb6')](function(_0x1ef854){for(var _0x3eda3b=0x0;_0x3eda3b<_0x4db05c[_0x6d4b('0x5f')][_0x6d4b('0x6a')][_0x6d4b('0x49')];_0x3eda3b+=0x1){socket['emit'](_0x6d4b('0xb7'),{'UserId':Number(_0x4db05c[_0x6d4b('0x5f')][_0x6d4b('0x6a')][_0x3eda3b]),'FaxAccountId':Number(_0x4db05c['params']['id'])});}return _0x1ef854;});}})['then'](respondWithResult(_0x58a578,null))['catch'](handleError(_0x58a578,null));};exports[_0x6d4b('0xb8')]=function(_0x3a9ad8,_0x308d2a,_0x1d75d1){return db[_0x6d4b('0x55')][_0x6d4b('0x5d')]({'where':{'id':_0x3a9ad8['params']['id']}})[_0x6d4b('0x1e')](handleEntityNotFound(_0x308d2a,null))['then'](function(_0x4c30f5){if(_0x4c30f5){return _0x4c30f5[_0x6d4b('0xb8')](_0x3a9ad8['query']['ids'])[_0x6d4b('0x1e')](function(){if(_[_0x6d4b('0xb9')](_0x3a9ad8[_0x6d4b('0x44')][_0x6d4b('0x6a')])){for(var _0x398de8=0x0;_0x398de8<_0x3a9ad8[_0x6d4b('0x44')][_0x6d4b('0x6a')]['length'];_0x398de8+=0x1){socket[_0x6d4b('0xba')](_0x6d4b('0xbb'),{'UserId':Number(_0x3a9ad8['query'][_0x6d4b('0x6a')][_0x398de8]),'FaxAccountId':Number(_0x3a9ad8[_0x6d4b('0x60')]['id'])});}}else{socket[_0x6d4b('0xba')](_0x6d4b('0xbb'),{'UserId':Number(_0x3a9ad8[_0x6d4b('0x44')][_0x6d4b('0x6a')]),'FaxAccountId':Number(_0x3a9ad8[_0x6d4b('0x60')]['id'])});}});}})[_0x6d4b('0x1e')](respondWithStatusCode(_0x308d2a,null))[_0x6d4b('0x29')](handleError(_0x308d2a,null));};exports[_0x6d4b('0xbc')]=function(_0x12a057,_0x15e8f8,_0xe56384){var _0x4cdf84={};var _0x59cab7={};var _0x15ce42;var _0x53eb1a;return db[_0x6d4b('0x55')][_0x6d4b('0x66')]({'where':{'id':_0x12a057[_0x6d4b('0x60')]['id']}})[_0x6d4b('0x1e')](handleEntityNotFound(_0x15e8f8,null))[_0x6d4b('0x1e')](function(_0xfeea2c){if(_0xfeea2c){_0x15ce42=_0xfeea2c;_0x59cab7['model']=_[_0x6d4b('0x45')](db[_0x6d4b('0x72')]['rawAttributes']);_0x59cab7[_0x6d4b('0x44')]=_[_0x6d4b('0x45')](_0x12a057[_0x6d4b('0x44')]);_0x59cab7[_0x6d4b('0x67')]=_[_0x6d4b('0x46')](_0x59cab7[_0x6d4b('0x43')],_0x59cab7['query']);_0x4cdf84[_0x6d4b('0x47')]=_[_0x6d4b('0x46')](_0x59cab7['model'],qs[_0x6d4b('0x48')](_0x12a057[_0x6d4b('0x44')][_0x6d4b('0x48')]));_0x4cdf84[_0x6d4b('0x47')]=_0x4cdf84[_0x6d4b('0x47')]['length']?_0x4cdf84[_0x6d4b('0x47')]:_0x59cab7[_0x6d4b('0x43')];_0x4cdf84['order']=qs[_0x6d4b('0x4d')](_0x12a057[_0x6d4b('0x44')][_0x6d4b('0x4d')]);_0x4cdf84[_0x6d4b('0x4e')]=qs[_0x6d4b('0x67')](_[_0x6d4b('0x4f')](_0x12a057[_0x6d4b('0x44')],_0x59cab7['filters']));if(_0x12a057[_0x6d4b('0x44')][_0x6d4b('0x50')]){_0x4cdf84[_0x6d4b('0x4e')]=_['merge'](_0x4cdf84[_0x6d4b('0x4e')],{'$or':_[_0x6d4b('0x40')](_0x4cdf84['attributes'],function(_0x11bf60){var _0x5cb5cb={};_0x5cb5cb[_0x11bf60]={'$like':'%'+_0x12a057[_0x6d4b('0x44')][_0x6d4b('0x50')]+'%'};return _0x5cb5cb;})});}_0x4cdf84=_[_0x6d4b('0x51')]({},_0x4cdf84,_0x12a057['options']);return _0x15ce42[_0x6d4b('0xbc')](_0x4cdf84);}})[_0x6d4b('0x1e')](function(_0x2d2f77){if(_0x2d2f77){_0x53eb1a=_0x2d2f77[_0x6d4b('0x49')];if(!_0x12a057[_0x6d4b('0x44')][_0x6d4b('0x4a')](_0x6d4b('0x4b'))){_0x4cdf84[_0x6d4b('0x30')]=qs[_0x6d4b('0x30')](_0x12a057['query'][_0x6d4b('0x30')]);_0x4cdf84['offset']=qs['offset'](_0x12a057['query'][_0x6d4b('0x2e')]);}return _0x15ce42[_0x6d4b('0xbc')](_0x4cdf84);}})[_0x6d4b('0x1e')](function(_0xe57cd8){if(_0xe57cd8){return _0xe57cd8?{'count':_0x53eb1a,'rows':_0xe57cd8}:null;}})[_0x6d4b('0x1e')](respondWithResult(_0x15e8f8,null))['catch'](handleError(_0x15e8f8,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 27238aa..ac0e944 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 _0x9d6c=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x9d6c,0x1ef));var _0xc9d6=function(_0x5de895,_0x202442){_0x5de895=_0x5de895-0x0;var _0xefc7e7=_0x9d6c[_0x5de895];return _0xefc7e7;};'use strict';var EventEmitter=require(_0xc9d6('0x0'));var FaxAccount=require(_0xc9d6('0x1'))['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xc9d6('0x2')](0x0);var events={'afterCreate':_0xc9d6('0x3'),'afterUpdate':_0xc9d6('0x4'),'afterDestroy':_0xc9d6('0x5')};function emitEvent(_0x29e2be){return function(_0x464a7d,_0x1b9a1f,_0x1b1d6a){FaxAccountEvents['emit'](_0x29e2be+':'+_0x464a7d['id'],_0x464a7d);FaxAccountEvents[_0xc9d6('0x6')](_0x29e2be,_0x464a7d);_0x1b1d6a(null);};}for(var e in events){if(events[_0xc9d6('0x7')](e)){var event=events[e];FaxAccount[_0xc9d6('0x8')](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file +var _0x2ebd=['events','../../mysqldb','FaxAccount','update','remove','hasOwnProperty','hook','exports'];(function(_0x538237,_0x3b20d2){var _0x141491=function(_0x4bfab7){while(--_0x4bfab7){_0x538237['push'](_0x538237['shift']());}};_0x141491(++_0x3b20d2);}(_0x2ebd,0x1c8));var _0xd2eb=function(_0x1df257,_0x27a0be){_0x1df257=_0x1df257-0x0;var _0xb1d536=_0x2ebd[_0x1df257];return _0xb1d536;};'use strict';var EventEmitter=require(_0xd2eb('0x0'));var FaxAccount=require(_0xd2eb('0x1'))['db'][_0xd2eb('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xd2eb('0x3'),'afterDestroy':_0xd2eb('0x4')};function emitEvent(_0x22adaa){return function(_0x8ee6a1,_0x2a4769,_0x430d8c){FaxAccountEvents['emit'](_0x22adaa+':'+_0x8ee6a1['id'],_0x8ee6a1);FaxAccountEvents['emit'](_0x22adaa,_0x8ee6a1);_0x430d8c(null);};}for(var e in events){if(events[_0xd2eb('0x5')](e)){var event=events[e];FaxAccount[_0xd2eb('0x6')](e,emitEvent(event));}}module[_0xd2eb('0x7')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 9a5e20d..2baf390 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 _0x21d0=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./faxAccount.attributes','exports','define','FaxAccount','fax_accounts','util'];(function(_0x262531,_0x5f3eeb){var _0x8e52b5=function(_0x5e2f5b){while(--_0x5e2f5b){_0x262531['push'](_0x262531['shift']());}};_0x8e52b5(++_0x5f3eeb);}(_0x21d0,0x137));var _0x021d=function(_0x34064a,_0xe97180){_0x34064a=_0x34064a-0x0;var _0x28d10d=_0x21d0[_0x34064a];return _0x28d10d;};'use strict';var _=require('lodash');var util=require(_0x021d('0x0'));var logger=require('../../config/logger')(_0x021d('0x1'));var moment=require(_0x021d('0x2'));var BPromise=require(_0x021d('0x3'));var rp=require(_0x021d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x021d('0x5'));var config=require(_0x021d('0x6'));var attributes=require(_0x021d('0x7'));module[_0x021d('0x8')]=function(_0x1c7bdb,_0x5191b8){return _0x1c7bdb[_0x021d('0x9')](_0x021d('0xa'),attributes,{'tableName':_0x021d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x974e=['util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxAccount.attributes','exports','define','FaxAccount','fax_accounts'];(function(_0x30eab3,_0x5abc1c){var _0x1ef923=function(_0x21967c){while(--_0x21967c){_0x30eab3['push'](_0x30eab3['shift']());}};_0x1ef923(++_0x5abc1c);}(_0x974e,0xd8));var _0xe974=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x974e[_0x17d9e3];return _0x14192d;};'use strict';var _=require('lodash');var util=require(_0xe974('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xe974('0x1'));var BPromise=require(_0xe974('0x2'));var rp=require(_0xe974('0x3'));var fs=require('fs');var path=require(_0xe974('0x4'));var rimraf=require(_0xe974('0x5'));var config=require(_0xe974('0x6'));var attributes=require(_0xe974('0x7'));module[_0xe974('0x8')]=function(_0x2da2a4,_0x3f4436){return _0x2da2a4[_0xe974('0x9')](_0xe974('0xa'),attributes,{'tableName':_0xe974('0xb'),'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 ef03b1d..671936d 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 _0x7e80=['catch','GetFaxAccount','FaxAccount','options','raw','where','attributes','limit','include','model','map','stringify','NotifyFaxAccount','body','fax','CmContact','describe','Sequelize','no\x20available\x20attributes','difference','keys','updatedAt','ListId','ValidationError','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','find','account','CmList','List','Contacts','DESC','FaxApplication','Applications','get','list','applications','priority','asc','create','contact','FaxInteraction','Contact\x20not\x20found','autoclose','push','length','close','*,*,*,*','created','interaction','ContactId','AttachmentId','UserId','User','unshift','agent','FaxQueue','name','queueId','queue','Start','startRouting','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','./faxAccount.socket','request','then','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','message','info','result'];(function(_0x9f65b6,_0x4cdd39){var _0x402242=function(_0x534db4){while(--_0x534db4){_0x9f65b6['push'](_0x9f65b6['shift']());}};_0x402242(++_0x4cdd39);}(_0x7e80,0x157));var _0x07e8=function(_0x1d90cd,_0x1d2745){_0x1d90cd=_0x1d90cd-0x0;var _0x81bbac=_0x7e80[_0x1d90cd];return _0x81bbac;};'use strict';var _=require('lodash');var util=require(_0x07e8('0x0'));var moment=require(_0x07e8('0x1'));var BPromise=require(_0x07e8('0x2'));var rs=require(_0x07e8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x07e8('0x4'))['db'];var utils=require(_0x07e8('0x5'));var logger=require(_0x07e8('0x6'))(_0x07e8('0x7'));var config=require(_0x07e8('0x8'));var jayson=require(_0x07e8('0x9'));var client=jayson['client'][_0x07e8('0xa')]({'port':0x232c});config[_0x07e8('0xb')]=_[_0x07e8('0xc')](config[_0x07e8('0xb')],{'host':_0x07e8('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x07e8('0xe'))['register'](socket);function respondWithRpcPromise(_0x41b3dc,_0x29a7b1,_0x26c8a7){return new BPromise(function(_0x3838c7,_0x3e0cfc){return client[_0x07e8('0xf')](_0x41b3dc,_0x26c8a7)[_0x07e8('0x10')](function(_0x2d07e2){logger['info'](_0x07e8('0x11'),_0x29a7b1,_0x07e8('0x12'));logger[_0x07e8('0x13')](_0x07e8('0x14'),_0x29a7b1,_0x07e8('0x12'),JSON['stringify'](_0x2d07e2));if(_0x2d07e2['error']){if(_0x2d07e2[_0x07e8('0x15')]['code']===0x1f4){logger[_0x07e8('0x15')](_0x07e8('0x11'),_0x29a7b1,_0x2d07e2[_0x07e8('0x15')]['message']);return _0x3e0cfc(_0x2d07e2['error'][_0x07e8('0x16')]);}logger['error'](_0x07e8('0x11'),_0x29a7b1,_0x2d07e2[_0x07e8('0x15')][_0x07e8('0x16')]);return _0x3838c7(_0x2d07e2[_0x07e8('0x15')][_0x07e8('0x16')]);}else{logger[_0x07e8('0x17')](_0x07e8('0x11'),_0x29a7b1,_0x07e8('0x12'));_0x3838c7(_0x2d07e2[_0x07e8('0x18')]['message']);}})[_0x07e8('0x19')](function(_0x3e3a4b){logger[_0x07e8('0x15')]('FaxAccount,\x20%s,\x20%s',_0x29a7b1,_0x3e3a4b);_0x3e0cfc(_0x3e3a4b);});});}exports[_0x07e8('0x1a')]=function(_0xec40a8){var _0x53bae2=this;return new Promise(function(_0xa694de,_0x2eb007){return db[_0x07e8('0x1b')]['findAll']({'raw':_0xec40a8[_0x07e8('0x1c')]?_0xec40a8[_0x07e8('0x1c')][_0x07e8('0x1d')]===undefined?!![]:![]:!![],'where':_0xec40a8['options']?_0xec40a8[_0x07e8('0x1c')][_0x07e8('0x1e')]||null:null,'attributes':_0xec40a8[_0x07e8('0x1c')]?_0xec40a8['options'][_0x07e8('0x1f')]||null:null,'limit':_0xec40a8[_0x07e8('0x1c')]?_0xec40a8[_0x07e8('0x1c')][_0x07e8('0x20')]||null:null,'include':_0xec40a8[_0x07e8('0x1c')]?_0xec40a8['options'][_0x07e8('0x21')]?_['map'](_0xec40a8[_0x07e8('0x1c')][_0x07e8('0x21')],function(_0x444cd7){return{'model':db[_0x444cd7[_0x07e8('0x22')]],'as':_0x444cd7['as'],'attributes':_0x444cd7[_0x07e8('0x1f')],'include':_0x444cd7[_0x07e8('0x21')]?_[_0x07e8('0x23')](_0x444cd7[_0x07e8('0x21')],function(_0x2e9202){return{'model':db[_0x2e9202['model']],'as':_0x2e9202['as'],'attributes':_0x2e9202['attributes'],'include':_0x2e9202[_0x07e8('0x21')]?_[_0x07e8('0x23')](_0x2e9202['include'],function(_0x2110b1){return{'model':db[_0x2110b1[_0x07e8('0x22')]],'as':_0x2110b1['as'],'attributes':_0x2110b1['attributes']};}):[]};}):[]};}):[]:[]})[_0x07e8('0x10')](function(_0x4bc7b1){logger[_0x07e8('0x17')](_0x07e8('0x1a'),_0xec40a8);logger['debug'](_0x07e8('0x1a'),_0xec40a8,JSON[_0x07e8('0x24')](_0x4bc7b1));_0xa694de(_0x4bc7b1);})[_0x07e8('0x19')](function(_0x5c6d07){logger[_0x07e8('0x15')](_0x07e8('0x1a'),_0x5c6d07[_0x07e8('0x16')],_0xec40a8);_0x2eb007(_0x53bae2[_0x07e8('0x15')](0x1f4,_0x5c6d07['message']));});});};exports[_0x07e8('0x25')]=function(_0x2e6483,_0x10c0a7,_0x3e903d){var _0x5d1b77=this;return new Promise(function(_0x82f6f7,_0x11d9d9){var _0x113917={'body':_0x2e6483[_0x07e8('0x26')],'channel':_0x07e8('0x27')};var _0x32cce6=[];var _0xb54dc=[];var _0x1271f7={};return db[_0x07e8('0x28')][_0x07e8('0x29')]()[_0x07e8('0x10')](function(_0x431adf){if(!_0x431adf){throw new db[(_0x07e8('0x2a'))]['ValidationError'](_0x07e8('0x2b'));}_0x32cce6=_[_0x07e8('0x2c')](_[_0x07e8('0x2d')](_0x431adf),['createdAt','updatedAt']);_0xb54dc=_[_0x07e8('0x2c')](_['keys'](_0x431adf),['createdAt',_0x07e8('0x2e'),'CompanyId',_0x07e8('0x2f')]);if(_0x2e6483[_0x07e8('0x26')]['id']){delete _0x2e6483[_0x07e8('0x26')]['id'];}if(_['isNil'](_0x2e6483[_0x07e8('0x26')]['from'])){throw new db[(_0x07e8('0x2a'))][(_0x07e8('0x30'))](_0x07e8('0x31'));}if(_[_0x07e8('0x32')](_0x2e6483['body']['body'])||_0x2e6483['body'][_0x07e8('0x26')]===''){throw new db[(_0x07e8('0x2a'))][(_0x07e8('0x30'))](_0x07e8('0x33'));}if(_['isNil'](_0x2e6483[_0x07e8('0x26')][_0x07e8('0x34')])){throw new db[(_0x07e8('0x2a'))][(_0x07e8('0x30'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xb54dc);}if(!_[_0x07e8('0x35')](_0xb54dc,_0x2e6483[_0x07e8('0x26')]['mapKey'])){throw new db[(_0x07e8('0x2a'))]['ValidationError'](_0x07e8('0x36')+_0xb54dc);}_0x1271f7[_0x2e6483[_0x07e8('0x26')][_0x07e8('0x34')]]=_0x2e6483['body'][_0x07e8('0x37')];})[_0x07e8('0x10')](function(){return db[_0x07e8('0x1b')][_0x07e8('0x38')]({'where':{'id':_0x2e6483[_0x07e8('0x39')]['id']},'include':[{'model':db[_0x07e8('0x3a')],'as':_0x07e8('0x3b'),'include':[{'model':db['CmContact'],'as':_0x07e8('0x3c'),'where':_0x1271f7,'limit':0x1,'order':[[_0x07e8('0x2e'),_0x07e8('0x3d')]]}]},{'model':db[_0x07e8('0x3e')],'as':_0x07e8('0x3f')}]});})['then'](function(_0x269885){if(_0x269885&&_0x269885[_0x07e8('0x3b')]){var _0x417a2d=_0x269885[_0x07e8('0x40')]({'plain':!![]});_0x113917[_0x07e8('0x39')]=_0x417a2d;_0x113917['applications']=_0x417a2d[_0x07e8('0x3f')];_0x113917[_0x07e8('0x41')]=_0x417a2d[_0x07e8('0x3b')];_0x113917[_0x07e8('0x42')]=_['orderBy'](_0x113917[_0x07e8('0x42')],[_0x07e8('0x43')],[_0x07e8('0x44')]);if(_0x113917[_0x07e8('0x39')]['Applications']){delete _0x113917[_0x07e8('0x39')][_0x07e8('0x3f')];}if(_0x113917[_0x07e8('0x39')][_0x07e8('0x3b')]&&_0x113917[_0x07e8('0x39')][_0x07e8('0x3b')][_0x07e8('0x3c')]['length']){return _0x113917[_0x07e8('0x39')][_0x07e8('0x3b')][_0x07e8('0x3c')][0x0];}var _0x136a05=_[_0x07e8('0xc')](_0x2e6483[_0x07e8('0x26')],{'firstName':_0x2e6483['body'][_0x07e8('0x37')],'ListId':_0x417a2d[_0x07e8('0x2f')]});_0x136a05[_0x2e6483[_0x07e8('0x26')][_0x07e8('0x34')]]=_0x2e6483[_0x07e8('0x26')][_0x07e8('0x37')];return db['CmContact'][_0x07e8('0x45')](_0x136a05,{'fields':_0x32cce6,'raw':!![]});}})['then'](function(_0x1b9e60){_0x113917[_0x07e8('0x46')]=_0x1b9e60;if(_0x1b9e60){var _0x2f8351={'ContactId':_0x1b9e60['id'],'FaxAccountId':_0x2e6483[_0x07e8('0x39')]['id'],'fax':_0x1b9e60[_0x07e8('0x27')]};return db[_0x07e8('0x47')][_0x07e8('0x38')]({'where':{'ContactId':_0x1b9e60['id'],'closed':![],'FaxAccountId':_0x2e6483[_0x07e8('0x39')]['id']}})[_0x07e8('0x10')](function(_0x527ff4){if(_0x527ff4){return[_0x527ff4,![]];}return db[_0x07e8('0x47')][_0x07e8('0x45')](_0x2f8351)['then'](function(_0x6bb35b){return[_0x6bb35b,!![]];});});}else{throw new Error(_0x07e8('0x48'));}})['spread'](function(_0x413dbb,_0x3c3d77){var _0x3811d3=_0x413dbb[_0x07e8('0x40')]({'plain':!![]});if(_0x3c3d77){if(_0x113917[_0x07e8('0x39')][_0x07e8('0x49')]){_0x113917[_0x07e8('0x42')][_0x07e8('0x4a')]({'id':0x0,'priority':_0x113917[_0x07e8('0x42')][_0x07e8('0x4b')]+0x1,'app':_0x07e8('0x4c'),'appdata':'unmanaged','interval':_0x07e8('0x4d')});}_0x3811d3[_0x07e8('0x4e')]=!![];}else{_0x3811d3[_0x07e8('0x4e')]=![];}_0x113917[_0x07e8('0x4f')]=_0x3811d3;return db['FaxMessage'][_0x07e8('0x45')]({'body':_0x2e6483[_0x07e8('0x26')][_0x07e8('0x26')],'FaxAccountId':_0x2e6483[_0x07e8('0x39')]['id'],'FaxInteractionId':_0x413dbb['id'],'direction':'in','ContactId':_0x413dbb[_0x07e8('0x50')],'AttachmentId':_0x2e6483[_0x07e8('0x26')][_0x07e8('0x51')]});})[_0x07e8('0x10')](function(_0xa842c0){_0x113917[_0x07e8('0x16')]=_0xa842c0;if(!_0x113917[_0x07e8('0x4f')][_0x07e8('0x52')])return;return db[_0x07e8('0x53')][_0x07e8('0x38')]({'attributes':['id','name'],'where':{'id':_0x113917['interaction'][_0x07e8('0x52')]}});})[_0x07e8('0x10')](function(_0x22c39b){if(_0x22c39b){_0x113917[_0x07e8('0x42')][_0x07e8('0x54')]({'id':0x0,'priority':0x0,'app':_0x07e8('0x55'),'appdata':_0x22c39b['name']+','+(_0x113917['account']['waitForTheAssignedAgent']||0xa),'interval':_0x07e8('0x4d')});}if(!_0x113917[_0x07e8('0x4f')]['queueId'])return;return db[_0x07e8('0x56')][_0x07e8('0x38')]({'attributes':['id',_0x07e8('0x57')],'where':{'id':_0x113917['interaction'][_0x07e8('0x58')]}});})['then'](function(_0xb00aef){if(_0xb00aef){_0x113917[_0x07e8('0x42')][_0x07e8('0x54')]({'id':0x0,'priority':0x1,'app':_0x07e8('0x59'),'appdata':_0xb00aef[_0x07e8('0x57')]+','+(_0x113917[_0x07e8('0x39')]['waitForTheAssignedQueue']||0x12c),'interval':_0x07e8('0x4d')});}return respondWithRpcPromise(_0x07e8('0x5a'),_0x07e8('0x5b'),_0x113917);})[_0x07e8('0x10')](function(_0x54d775){_0x82f6f7(_0x54d775);})[_0x07e8('0x19')](function(_0x1294e9){_0x11d9d9(_0x5d1b77[_0x07e8('0x15')](0x1f4,_0x1294e9[_0x07e8('0x16')]));});});}; \ No newline at end of file +var _0x58ea=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','defaults','redis','./faxAccount.socket','request','then','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','FaxAccount','options','raw','attributes','limit','include','map','model','GetFaxAccount','body','fax','describe','ValidationError','no\x20available\x20attributes','difference','updatedAt','keys','createdAt','CompanyId','ListId','from','Sequelize','from\x20is\x20mandatory','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmContact','Contacts','DESC','Applications','get','applications','list','List','orderBy','priority','length','create','contact','FaxInteraction','spread','autoclose','close','*,*,*,*','created','interaction','FaxMessage','ContactId','AttachmentId','UserId','User','name','unshift','agent','waitForTheAssignedAgent','queueId','queue','waitForTheAssignedQueue','Start','startRouting','lodash','util','moment','bluebird','randomstring'];(function(_0x32cf96,_0x7502d5){var _0x125cc1=function(_0x376987){while(--_0x376987){_0x32cf96['push'](_0x32cf96['shift']());}};_0x125cc1(++_0x7502d5);}(_0x58ea,0x1b8));var _0xa58e=function(_0x4d8c82,_0x10e2f3){_0x4d8c82=_0x4d8c82-0x0;var _0x46bbd2=_0x58ea[_0x4d8c82];return _0x46bbd2;};'use strict';var _=require(_0xa58e('0x0'));var util=require(_0xa58e('0x1'));var moment=require(_0xa58e('0x2'));var BPromise=require(_0xa58e('0x3'));var rs=require(_0xa58e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa58e('0x5'))['db'];var utils=require(_0xa58e('0x6'));var logger=require('../../config/logger')(_0xa58e('0x7'));var config=require(_0xa58e('0x8'));var jayson=require(_0xa58e('0x9'));var client=jayson['client'][_0xa58e('0xa')]({'port':0x232c});config['redis']=_[_0xa58e('0xb')](config[_0xa58e('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xa58e('0xd'))['register'](socket);function respondWithRpcPromise(_0x14f6c6,_0x3009cf,_0x675203){return new BPromise(function(_0x275915,_0x278a71){return client[_0xa58e('0xe')](_0x14f6c6,_0x675203)[_0xa58e('0xf')](function(_0x145792){logger['info'](_0xa58e('0x10'),_0x3009cf,_0xa58e('0x11'));logger[_0xa58e('0x12')](_0xa58e('0x13'),_0x3009cf,_0xa58e('0x11'),JSON[_0xa58e('0x14')](_0x145792));if(_0x145792[_0xa58e('0x15')]){if(_0x145792[_0xa58e('0x15')][_0xa58e('0x16')]===0x1f4){logger[_0xa58e('0x15')](_0xa58e('0x10'),_0x3009cf,_0x145792['error']['message']);return _0x278a71(_0x145792[_0xa58e('0x15')][_0xa58e('0x17')]);}logger[_0xa58e('0x15')](_0xa58e('0x10'),_0x3009cf,_0x145792[_0xa58e('0x15')][_0xa58e('0x17')]);return _0x275915(_0x145792[_0xa58e('0x15')][_0xa58e('0x17')]);}else{logger[_0xa58e('0x18')](_0xa58e('0x10'),_0x3009cf,_0xa58e('0x11'));_0x275915(_0x145792[_0xa58e('0x19')][_0xa58e('0x17')]);}})[_0xa58e('0x1a')](function(_0x4425a5){logger[_0xa58e('0x15')](_0xa58e('0x10'),_0x3009cf,_0x4425a5);_0x278a71(_0x4425a5);});});}exports['GetFaxAccount']=function(_0x44fcf4){var _0x244a72=this;return new Promise(function(_0xfd2e2f,_0x2ccb77){return db[_0xa58e('0x1b')]['findAll']({'raw':_0x44fcf4[_0xa58e('0x1c')]?_0x44fcf4[_0xa58e('0x1c')][_0xa58e('0x1d')]===undefined?!![]:![]:!![],'where':_0x44fcf4['options']?_0x44fcf4[_0xa58e('0x1c')]['where']||null:null,'attributes':_0x44fcf4[_0xa58e('0x1c')]?_0x44fcf4['options'][_0xa58e('0x1e')]||null:null,'limit':_0x44fcf4['options']?_0x44fcf4[_0xa58e('0x1c')][_0xa58e('0x1f')]||null:null,'include':_0x44fcf4[_0xa58e('0x1c')]?_0x44fcf4[_0xa58e('0x1c')][_0xa58e('0x20')]?_[_0xa58e('0x21')](_0x44fcf4['options'][_0xa58e('0x20')],function(_0x10a406){return{'model':db[_0x10a406[_0xa58e('0x22')]],'as':_0x10a406['as'],'attributes':_0x10a406[_0xa58e('0x1e')],'include':_0x10a406[_0xa58e('0x20')]?_[_0xa58e('0x21')](_0x10a406[_0xa58e('0x20')],function(_0x2e022f){return{'model':db[_0x2e022f[_0xa58e('0x22')]],'as':_0x2e022f['as'],'attributes':_0x2e022f[_0xa58e('0x1e')],'include':_0x2e022f[_0xa58e('0x20')]?_[_0xa58e('0x21')](_0x2e022f['include'],function(_0x126037){return{'model':db[_0x126037['model']],'as':_0x126037['as'],'attributes':_0x126037[_0xa58e('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xa58e('0xf')](function(_0x5365c0){logger[_0xa58e('0x18')](_0xa58e('0x23'),_0x44fcf4);logger[_0xa58e('0x12')](_0xa58e('0x23'),_0x44fcf4,JSON[_0xa58e('0x14')](_0x5365c0));_0xfd2e2f(_0x5365c0);})[_0xa58e('0x1a')](function(_0x4d7892){logger['error'](_0xa58e('0x23'),_0x4d7892['message'],_0x44fcf4);_0x2ccb77(_0x244a72[_0xa58e('0x15')](0x1f4,_0x4d7892[_0xa58e('0x17')]));});});};exports['NotifyFaxAccount']=function(_0x1d77d8,_0x32ecb6,_0x845036){var _0x37050a=this;return new Promise(function(_0x13bc36,_0x13c7cd){var _0xe30a87={'body':_0x1d77d8[_0xa58e('0x24')],'channel':_0xa58e('0x25')};var _0x1dc4c8=[];var _0x1b0fb3=[];var _0x4d2b95={};return db['CmContact'][_0xa58e('0x26')]()[_0xa58e('0xf')](function(_0x3dd82e){if(!_0x3dd82e){throw new db['Sequelize'][(_0xa58e('0x27'))](_0xa58e('0x28'));}_0x1dc4c8=_[_0xa58e('0x29')](_['keys'](_0x3dd82e),['createdAt',_0xa58e('0x2a')]);_0x1b0fb3=_[_0xa58e('0x29')](_[_0xa58e('0x2b')](_0x3dd82e),[_0xa58e('0x2c'),_0xa58e('0x2a'),_0xa58e('0x2d'),_0xa58e('0x2e')]);if(_0x1d77d8['body']['id']){delete _0x1d77d8['body']['id'];}if(_['isNil'](_0x1d77d8[_0xa58e('0x24')][_0xa58e('0x2f')])){throw new db[(_0xa58e('0x30'))][(_0xa58e('0x27'))](_0xa58e('0x31'));}if(_['isNil'](_0x1d77d8[_0xa58e('0x24')][_0xa58e('0x24')])||_0x1d77d8[_0xa58e('0x24')][_0xa58e('0x24')]===''){throw new db[(_0xa58e('0x30'))][(_0xa58e('0x27'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xa58e('0x32')](_0x1d77d8[_0xa58e('0x24')][_0xa58e('0x33')])){throw new db[(_0xa58e('0x30'))][(_0xa58e('0x27'))](_0xa58e('0x34')+_0x1b0fb3);}if(!_['includes'](_0x1b0fb3,_0x1d77d8[_0xa58e('0x24')][_0xa58e('0x33')])){throw new db['Sequelize']['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1b0fb3);}_0x4d2b95[_0x1d77d8['body'][_0xa58e('0x33')]]=_0x1d77d8[_0xa58e('0x24')][_0xa58e('0x2f')];})[_0xa58e('0xf')](function(){return db['FaxAccount'][_0xa58e('0x35')]({'where':{'id':_0x1d77d8[_0xa58e('0x36')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0xa58e('0x37')],'as':_0xa58e('0x38'),'where':_0x4d2b95,'limit':0x1,'order':[[_0xa58e('0x2a'),_0xa58e('0x39')]]}]},{'model':db['FaxApplication'],'as':_0xa58e('0x3a')}]});})[_0xa58e('0xf')](function(_0x405c20){if(_0x405c20&&_0x405c20['List']){var _0x5b6df0=_0x405c20[_0xa58e('0x3b')]({'plain':!![]});_0xe30a87[_0xa58e('0x36')]=_0x5b6df0;_0xe30a87[_0xa58e('0x3c')]=_0x5b6df0['Applications'];_0xe30a87[_0xa58e('0x3d')]=_0x5b6df0[_0xa58e('0x3e')];_0xe30a87['applications']=_[_0xa58e('0x3f')](_0xe30a87[_0xa58e('0x3c')],[_0xa58e('0x40')],['asc']);if(_0xe30a87[_0xa58e('0x36')][_0xa58e('0x3a')]){delete _0xe30a87[_0xa58e('0x36')][_0xa58e('0x3a')];}if(_0xe30a87[_0xa58e('0x36')]['List']&&_0xe30a87[_0xa58e('0x36')]['List'][_0xa58e('0x38')][_0xa58e('0x41')]){return _0xe30a87[_0xa58e('0x36')][_0xa58e('0x3e')][_0xa58e('0x38')][0x0];}var _0x189188=_[_0xa58e('0xb')](_0x1d77d8['body'],{'firstName':_0x1d77d8[_0xa58e('0x24')][_0xa58e('0x2f')],'ListId':_0x5b6df0[_0xa58e('0x2e')]});_0x189188[_0x1d77d8[_0xa58e('0x24')][_0xa58e('0x33')]]=_0x1d77d8[_0xa58e('0x24')]['from'];return db['CmContact'][_0xa58e('0x42')](_0x189188,{'fields':_0x1dc4c8,'raw':!![]});}})[_0xa58e('0xf')](function(_0x286ef4){_0xe30a87[_0xa58e('0x43')]=_0x286ef4;if(_0x286ef4){var _0x5df306={'ContactId':_0x286ef4['id'],'FaxAccountId':_0x1d77d8['account']['id'],'fax':_0x286ef4[_0xa58e('0x25')]};return db['FaxInteraction'][_0xa58e('0x35')]({'where':{'ContactId':_0x286ef4['id'],'closed':![],'FaxAccountId':_0x1d77d8['account']['id']}})['then'](function(_0x2b27e9){if(_0x2b27e9){return[_0x2b27e9,![]];}return db[_0xa58e('0x44')][_0xa58e('0x42')](_0x5df306)['then'](function(_0x2a6f87){return[_0x2a6f87,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xa58e('0x45')](function(_0x37baad,_0x50d5c4){var _0x5a48f3=_0x37baad[_0xa58e('0x3b')]({'plain':!![]});if(_0x50d5c4){if(_0xe30a87[_0xa58e('0x36')][_0xa58e('0x46')]){_0xe30a87['applications']['push']({'id':0x0,'priority':_0xe30a87[_0xa58e('0x3c')][_0xa58e('0x41')]+0x1,'app':_0xa58e('0x47'),'appdata':'unmanaged','interval':_0xa58e('0x48')});}_0x5a48f3[_0xa58e('0x49')]=!![];}else{_0x5a48f3[_0xa58e('0x49')]=![];}_0xe30a87[_0xa58e('0x4a')]=_0x5a48f3;return db[_0xa58e('0x4b')][_0xa58e('0x42')]({'body':_0x1d77d8[_0xa58e('0x24')][_0xa58e('0x24')],'FaxAccountId':_0x1d77d8[_0xa58e('0x36')]['id'],'FaxInteractionId':_0x37baad['id'],'direction':'in','ContactId':_0x37baad[_0xa58e('0x4c')],'AttachmentId':_0x1d77d8['body'][_0xa58e('0x4d')]});})[_0xa58e('0xf')](function(_0x10d2bb){_0xe30a87['message']=_0x10d2bb;if(!_0xe30a87[_0xa58e('0x4a')][_0xa58e('0x4e')])return;return db[_0xa58e('0x4f')][_0xa58e('0x35')]({'attributes':['id',_0xa58e('0x50')],'where':{'id':_0xe30a87[_0xa58e('0x4a')][_0xa58e('0x4e')]}});})['then'](function(_0x2e4352){if(_0x2e4352){_0xe30a87[_0xa58e('0x3c')][_0xa58e('0x51')]({'id':0x0,'priority':0x0,'app':_0xa58e('0x52'),'appdata':_0x2e4352[_0xa58e('0x50')]+','+(_0xe30a87[_0xa58e('0x36')][_0xa58e('0x53')]||0xa),'interval':'*,*,*,*'});}if(!_0xe30a87[_0xa58e('0x4a')][_0xa58e('0x54')])return;return db['FaxQueue']['find']({'attributes':['id',_0xa58e('0x50')],'where':{'id':_0xe30a87[_0xa58e('0x4a')][_0xa58e('0x54')]}});})[_0xa58e('0xf')](function(_0x30f87d){if(_0x30f87d){_0xe30a87[_0xa58e('0x3c')][_0xa58e('0x51')]({'id':0x0,'priority':0x1,'app':_0xa58e('0x55'),'appdata':_0x30f87d[_0xa58e('0x50')]+','+(_0xe30a87[_0xa58e('0x36')][_0xa58e('0x56')]||0x12c),'interval':_0xa58e('0x48')});}return respondWithRpcPromise(_0xa58e('0x57'),_0xa58e('0x58'),_0xe30a87);})['then'](function(_0x50ce1f){_0x13bc36(_0x50ce1f);})[_0xa58e('0x1a')](function(_0x3113fd){_0x13c7cd(_0x37050a[_0xa58e('0x15')](0x1f4,_0x3113fd['message']));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 1f092f5..8cb4608 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 _0x588e=['save','remove','update','emit','register','length','faxAccount:'];(function(_0x2aff77,_0x44dac8){var _0x2e78c2=function(_0x2fc420){while(--_0x2fc420){_0x2aff77['push'](_0x2aff77['shift']());}};_0x2e78c2(++_0x44dac8);}(_0x588e,0xb6));var _0xe588=function(_0x547800,_0x24b54a){_0x547800=_0x547800-0x0;var _0x57fe7e=_0x588e[_0x547800];return _0x57fe7e;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=[_0xe588('0x0'),_0xe588('0x1'),_0xe588('0x2')];function createListener(_0x18abd1,_0x3b9dd7){return function(_0x451c7d){_0x3b9dd7[_0xe588('0x3')](_0x18abd1,_0x451c7d);};}function removeListener(_0x4f1f3b,_0x5b4b4f){return function(){FaxAccountEvents['removeListener'](_0x4f1f3b,_0x5b4b4f);};}exports[_0xe588('0x4')]=function(_0x444d63){for(var _0x2817a5=0x0,_0x4b5304=events[_0xe588('0x5')];_0x2817a5<_0x4b5304;_0x2817a5++){var _0x19fa95=events[_0x2817a5];var _0x3f402a=createListener(_0xe588('0x6')+_0x19fa95,_0x444d63);FaxAccountEvents['on'](_0x19fa95,_0x3f402a);}}; \ No newline at end of file +var _0x2786=['faxAccount:','save','remove','update','emit','length'];(function(_0x3a568c,_0xc5f075){var _0x10a470=function(_0x14b686){while(--_0x14b686){_0x3a568c['push'](_0x3a568c['shift']());}};_0x10a470(++_0xc5f075);}(_0x2786,0x10f));var _0x6278=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x2786[_0x501510];return _0x1e6ee5;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=[_0x6278('0x0'),_0x6278('0x1'),_0x6278('0x2')];function createListener(_0x1fcf81,_0x370878){return function(_0x57feb9){_0x370878[_0x6278('0x3')](_0x1fcf81,_0x57feb9);};}function removeListener(_0x360a4b,_0x1f2850){return function(){FaxAccountEvents['removeListener'](_0x360a4b,_0x1f2850);};}exports['register']=function(_0x27a5c6){for(var _0x4f139e=0x0,_0x453794=events[_0x6278('0x4')];_0x4f139e<_0x453794;_0x4f139e++){var _0x1f32b2=events[_0x4f139e];var _0x13ec52=createListener(_0x6278('0x5')+_0x1f32b2,_0x27a5c6);FaxAccountEvents['on'](_0x1f32b2,_0x13ec52);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 22ef705..267706f 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 _0x2a0b=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxAccount.controller','get','index','isAuthenticated','/:id','show','getDispositions','/:id/canned_answers','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','getAgents','post','create','/:id/dispositions','addDisposition','addAnswer','addInteraction','addApplications','/updateaccountapplications','/:id/send','/:id/users','addAgents','put','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util'];(function(_0x1d425e,_0x3616eb){var _0x181438=function(_0x25333a){while(--_0x25333a){_0x1d425e['push'](_0x1d425e['shift']());}};_0x181438(++_0x3616eb);}(_0x2a0b,0x9e));var _0xb2a0=function(_0x463ce9,_0x460fe2){_0x463ce9=_0x463ce9-0x0;var _0xb9944e=_0x2a0b[_0x463ce9];return _0xb9944e;};'use strict';var multer=require(_0xb2a0('0x0'));var util=require(_0xb2a0('0x1'));var path=require(_0xb2a0('0x2'));var timeout=require('connect-timeout');var express=require(_0xb2a0('0x3'));var router=express[_0xb2a0('0x4')]();var fs_extra=require(_0xb2a0('0x5'));var auth=require(_0xb2a0('0x6'));var interaction=require(_0xb2a0('0x7'));var config=require('../../config/environment');var controller=require(_0xb2a0('0x8'));router[_0xb2a0('0x9')]('/',auth['isAuthenticated'](),controller[_0xb2a0('0xa')]);router[_0xb2a0('0x9')]('/describe',auth[_0xb2a0('0xb')](),controller['describe']);router[_0xb2a0('0x9')](_0xb2a0('0xc'),auth['isAuthenticated'](),controller[_0xb2a0('0xd')]);router[_0xb2a0('0x9')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xb2a0('0xe')]);router[_0xb2a0('0x9')](_0xb2a0('0xf'),auth[_0xb2a0('0xb')](),controller['getAnswers']);router[_0xb2a0('0x9')](_0xb2a0('0x10'),auth['isAuthenticated'](),controller[_0xb2a0('0x11')]);router[_0xb2a0('0x9')](_0xb2a0('0x12'),auth[_0xb2a0('0xb')](),controller['getApplications']);router[_0xb2a0('0x9')](_0xb2a0('0x13'),auth[_0xb2a0('0xb')](),controller[_0xb2a0('0x14')]);router[_0xb2a0('0x9')]('/:id/users',auth[_0xb2a0('0xb')](),controller[_0xb2a0('0x15')]);router[_0xb2a0('0x16')]('/',auth[_0xb2a0('0xb')](),controller[_0xb2a0('0x17')]);router[_0xb2a0('0x16')](_0xb2a0('0x18'),auth[_0xb2a0('0xb')](),controller[_0xb2a0('0x19')]);router[_0xb2a0('0x16')](_0xb2a0('0xf'),auth[_0xb2a0('0xb')](),controller[_0xb2a0('0x1a')]);router[_0xb2a0('0x16')](_0xb2a0('0x10'),auth[_0xb2a0('0xb')](),controller[_0xb2a0('0x1b')]);router[_0xb2a0('0x16')]('/:id/applications',auth['isAuthenticated'](),controller[_0xb2a0('0x1c')]);router[_0xb2a0('0x16')]('/addaccountapplications',auth[_0xb2a0('0xb')](),controller['addAccountApplications']);router[_0xb2a0('0x16')](_0xb2a0('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router['post'](_0xb2a0('0x1e'),auth[_0xb2a0('0xb')](),controller['send']);router[_0xb2a0('0x16')](_0xb2a0('0x1f'),auth[_0xb2a0('0xb')](),controller[_0xb2a0('0x20')]);router[_0xb2a0('0x21')](_0xb2a0('0xc'),auth[_0xb2a0('0xb')](),controller['update']);router[_0xb2a0('0x22')](_0xb2a0('0xc'),auth['isAuthenticated'](),controller[_0xb2a0('0x23')]);router[_0xb2a0('0x22')](_0xb2a0('0x18'),auth[_0xb2a0('0xb')](),controller[_0xb2a0('0x24')]);router[_0xb2a0('0x22')](_0xb2a0('0xf'),auth['isAuthenticated'](),controller[_0xb2a0('0x25')]);router[_0xb2a0('0x22')](_0xb2a0('0x1f'),auth[_0xb2a0('0xb')](),controller[_0xb2a0('0x26')]);module[_0xb2a0('0x27')]=router; \ No newline at end of file +var _0x089a=['/:id/users','post','create','addInteraction','addApplications','/addaccountapplications','addAccountApplications','/updateaccountapplications','updateAccountApplications','/:id/send','send','addAgents','put','update','delete','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/interactions','/:id/applications','getApplications','/:id/messages','getMessages'];(function(_0x3e44d6,_0xffc209){var _0x3dbebd=function(_0xc7d70f){while(--_0xc7d70f){_0x3e44d6['push'](_0x3e44d6['shift']());}};_0x3dbebd(++_0xffc209);}(_0x089a,0x162));var _0xa089=function(_0x4541c8,_0x1ab415){_0x4541c8=_0x4541c8-0x0;var _0x514ddb=_0x089a[_0x4541c8];return _0x514ddb;};'use strict';var multer=require(_0xa089('0x0'));var util=require(_0xa089('0x1'));var path=require(_0xa089('0x2'));var timeout=require(_0xa089('0x3'));var express=require(_0xa089('0x4'));var router=express['Router']();var fs_extra=require(_0xa089('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa089('0x6'));var config=require(_0xa089('0x7'));var controller=require(_0xa089('0x8'));router[_0xa089('0x9')]('/',auth[_0xa089('0xa')](),controller[_0xa089('0xb')]);router[_0xa089('0x9')](_0xa089('0xc'),auth[_0xa089('0xa')](),controller[_0xa089('0xd')]);router[_0xa089('0x9')](_0xa089('0xe'),auth[_0xa089('0xa')](),controller[_0xa089('0xf')]);router['get'](_0xa089('0x10'),auth[_0xa089('0xa')](),controller['getDispositions']);router[_0xa089('0x9')](_0xa089('0x11'),auth['isAuthenticated'](),controller[_0xa089('0x12')]);router[_0xa089('0x9')](_0xa089('0x13'),auth[_0xa089('0xa')](),controller['getInteractions']);router[_0xa089('0x9')](_0xa089('0x14'),auth[_0xa089('0xa')](),controller[_0xa089('0x15')]);router[_0xa089('0x9')](_0xa089('0x16'),auth[_0xa089('0xa')](),controller[_0xa089('0x17')]);router[_0xa089('0x9')](_0xa089('0x18'),auth['isAuthenticated'](),controller['getAgents']);router[_0xa089('0x19')]('/',auth[_0xa089('0xa')](),controller[_0xa089('0x1a')]);router[_0xa089('0x19')]('/:id/dispositions',auth['isAuthenticated'](),controller['addDisposition']);router[_0xa089('0x19')]('/:id/canned_answers',auth[_0xa089('0xa')](),controller['addAnswer']);router[_0xa089('0x19')](_0xa089('0x13'),auth[_0xa089('0xa')](),controller[_0xa089('0x1b')]);router[_0xa089('0x19')](_0xa089('0x14'),auth[_0xa089('0xa')](),controller[_0xa089('0x1c')]);router[_0xa089('0x19')](_0xa089('0x1d'),auth[_0xa089('0xa')](),controller[_0xa089('0x1e')]);router['post'](_0xa089('0x1f'),auth['isAuthenticated'](),controller[_0xa089('0x20')]);router[_0xa089('0x19')](_0xa089('0x21'),auth[_0xa089('0xa')](),controller[_0xa089('0x22')]);router[_0xa089('0x19')](_0xa089('0x18'),auth['isAuthenticated'](),controller[_0xa089('0x23')]);router[_0xa089('0x24')]('/:id',auth[_0xa089('0xa')](),controller[_0xa089('0x25')]);router[_0xa089('0x26')](_0xa089('0xe'),auth[_0xa089('0xa')](),controller['destroy']);router[_0xa089('0x26')](_0xa089('0x10'),auth[_0xa089('0xa')](),controller['removeDispositions']);router[_0xa089('0x26')](_0xa089('0x11'),auth[_0xa089('0xa')](),controller[_0xa089('0x27')]);router[_0xa089('0x26')](_0xa089('0x18'),auth[_0xa089('0xa')](),controller[_0xa089('0x28')]);module[_0xa089('0x29')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 7639da3..e37fa01 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 _0x62db=['INTEGER','noop','TEXT','STRING','*,*,*,*','sequelize'];(function(_0x5e5b5e,_0x1d4bde){var _0x296489=function(_0x55af5c){while(--_0x55af5c){_0x5e5b5e['push'](_0x5e5b5e['shift']());}};_0x296489(++_0x1d4bde);}(_0x62db,0x167));var _0xb62d=function(_0x8a45fc,_0x3393d7){_0x8a45fc=_0x8a45fc-0x0;var _0x4d65ae=_0x62db[_0x8a45fc];return _0x4d65ae;};'use strict';var Sequelize=require(_0xb62d('0x0'));module['exports']={'priority':{'type':Sequelize[_0xb62d('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xb62d('0x2')},'appdata':{'type':Sequelize[_0xb62d('0x3')]()},'description':{'type':Sequelize[_0xb62d('0x4')]},'interval':{'type':Sequelize[_0xb62d('0x4')],'defaultValue':_0xb62d('0x5')}}; \ No newline at end of file +var _0x2423=['INTEGER','STRING','noop','TEXT','*,*,*,*','exports'];(function(_0x2fe8e1,_0x3552bf){var _0x89bd52=function(_0x357bfc){while(--_0x357bfc){_0x2fe8e1['push'](_0x2fe8e1['shift']());}};_0x89bd52(++_0x3552bf);}(_0x2423,0x9b));var _0x3242=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2423[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');module[_0x3242('0x0')]={'priority':{'type':Sequelize[_0x3242('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x3242('0x2')],'allowNull':![],'defaultValue':_0x3242('0x3')},'appdata':{'type':Sequelize[_0x3242('0x4')]()},'description':{'type':Sequelize[_0x3242('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x3242('0x5')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 2331001..7f8d572 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 _0x8f39=['name','index','FaxApplication','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','options','includeAll','include','rows','catch','show','params','length','find','create','body','update','destroy','eml-format','zip-dir','request-promise','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','reject','save','then','error','stack'];(function(_0x2d7611,_0x141d7f){var _0xc91544=function(_0x65b2cf){while(--_0x65b2cf){_0x2d7611['push'](_0x2d7611['shift']());}};_0xc91544(++_0x141d7f);}(_0x8f39,0x1e5));var _0x98f3=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0x8f39[_0x4792c8];return _0x35edb1;};'use strict';var emlformat=require(_0x98f3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x98f3('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x98f3('0x2'));var moment=require('moment');var BPromise=require(_0x98f3('0x3'));var Mustache=require('mustache');var util=require(_0x98f3('0x4'));var path=require(_0x98f3('0x5'));var sox=require(_0x98f3('0x6'));var csv=require(_0x98f3('0x7'));var ejs=require(_0x98f3('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x98f3('0x9'));var crypto=require(_0x98f3('0xa'));var jsforce=require(_0x98f3('0xb'));var deskjs=require(_0x98f3('0xc'));var toCsv=require(_0x98f3('0x7'));var querystring=require(_0x98f3('0xd'));var Papa=require(_0x98f3('0xe'));var Redis=require(_0x98f3('0xf'));var authService=require(_0x98f3('0x10'));var qs=require(_0x98f3('0x11'));var as=require(_0x98f3('0x12'));var hardwareService=require(_0x98f3('0x13'));var logger=require(_0x98f3('0x14'))(_0x98f3('0x15'));var utils=require(_0x98f3('0x16'));var config=require(_0x98f3('0x17'));var licenseUtil=require(_0x98f3('0x18'));var db=require(_0x98f3('0x19'))['db'];function respondWithStatusCode(_0xc4b1ec,_0x288732){_0x288732=_0x288732||0xcc;return function(_0x171fef){if(_0x171fef){return _0xc4b1ec[_0x98f3('0x1a')](_0x288732);}return _0xc4b1ec[_0x98f3('0x1b')](_0x288732)[_0x98f3('0x1c')]();};}function respondWithResult(_0x4c7f79,_0x242d65){_0x242d65=_0x242d65||0xc8;return function(_0x5d5ada){if(_0x5d5ada){return _0x4c7f79['status'](_0x242d65)[_0x98f3('0x1d')](_0x5d5ada);}};}function respondWithFilteredResult(_0x17892e,_0x24bab1){return function(_0x49b364){if(_0x49b364){var _0xe1516a=typeof _0x24bab1['offset']==='undefined'&&typeof _0x24bab1['limit']===_0x98f3('0x1e');var _0x419e89=_0x49b364[_0x98f3('0x1f')];var _0x192fb4=_0xe1516a?0x0:_0x24bab1[_0x98f3('0x20')];var _0x2df132=_0xe1516a?_0x49b364[_0x98f3('0x1f')]:_0x24bab1[_0x98f3('0x20')]+_0x24bab1[_0x98f3('0x21')];var _0x4eb577;if(_0x2df132>=_0x419e89){_0x2df132=_0x419e89;_0x4eb577=0xc8;}else{_0x4eb577=0xce;}_0x17892e[_0x98f3('0x1b')](_0x4eb577);return _0x17892e['set'](_0x98f3('0x22'),_0x192fb4+'-'+_0x2df132+'/'+_0x419e89)[_0x98f3('0x1d')](_0x49b364);}return null;};}function patchUpdates(_0x16fd9d){return function(_0x120ab1){try{jsonpatch['apply'](_0x120ab1,_0x16fd9d,!![]);}catch(_0x128906){return BPromise[_0x98f3('0x23')](_0x128906);}return _0x120ab1[_0x98f3('0x24')]();};}function saveUpdates(_0x2e8e58,_0x359364){return function(_0x2f3e48){if(_0x2f3e48){return _0x2f3e48['update'](_0x2e8e58)['then'](function(_0x5b2682){return _0x5b2682;});}return null;};}function removeEntity(_0x87ce48,_0x489ebf){return function(_0x4f7b60){if(_0x4f7b60){return _0x4f7b60['destroy']()[_0x98f3('0x25')](function(){_0x87ce48['status'](0xcc)[_0x98f3('0x1c')]();});}};}function handleEntityNotFound(_0x31fc53,_0x55b43b){return function(_0x51b198){if(!_0x51b198){_0x31fc53[_0x98f3('0x1a')](0x194);}return _0x51b198;};}function handleError(_0x30fd66,_0x4c52fc){_0x4c52fc=_0x4c52fc||0x1f4;return function(_0x1ca4bb){logger[_0x98f3('0x26')](_0x1ca4bb[_0x98f3('0x27')]);if(_0x1ca4bb[_0x98f3('0x28')]){delete _0x1ca4bb['name'];}_0x30fd66['status'](_0x4c52fc)['send'](_0x1ca4bb);};}exports[_0x98f3('0x29')]=function(_0xfb3594,_0x17a3be){var _0x17464b={},_0x276f0a={},_0x4fafa7={'count':0x0,'rows':[]};var _0x1e1eb9=_['map'](db[_0x98f3('0x2a')][_0x98f3('0x2b')],function(_0x1bb76a){return{'name':_0x1bb76a[_0x98f3('0x2c')],'type':_0x1bb76a[_0x98f3('0x2d')][_0x98f3('0x2e')]};});_0x276f0a[_0x98f3('0x2f')]=_[_0x98f3('0x30')](_0x1e1eb9,_0x98f3('0x28'));_0x276f0a[_0x98f3('0x31')]=_[_0x98f3('0x32')](_0xfb3594[_0x98f3('0x31')]);_0x276f0a[_0x98f3('0x33')]=_['intersection'](_0x276f0a[_0x98f3('0x2f')],_0x276f0a['query']);_0x17464b[_0x98f3('0x34')]=_[_0x98f3('0x35')](_0x276f0a[_0x98f3('0x2f')],qs[_0x98f3('0x36')](_0xfb3594[_0x98f3('0x31')][_0x98f3('0x36')]));_0x17464b['attributes']=_0x17464b['attributes']['length']?_0x17464b[_0x98f3('0x34')]:_0x276f0a[_0x98f3('0x2f')];if(!_0xfb3594[_0x98f3('0x31')][_0x98f3('0x37')](_0x98f3('0x38'))){_0x17464b[_0x98f3('0x21')]=qs[_0x98f3('0x21')](_0xfb3594[_0x98f3('0x31')][_0x98f3('0x21')]);_0x17464b[_0x98f3('0x20')]=qs[_0x98f3('0x20')](_0xfb3594[_0x98f3('0x31')][_0x98f3('0x20')]);}_0x17464b[_0x98f3('0x39')]=qs['sort'](_0xfb3594[_0x98f3('0x31')][_0x98f3('0x3a')]);_0x17464b[_0x98f3('0x3b')]=qs[_0x98f3('0x33')](_[_0x98f3('0x3c')](_0xfb3594[_0x98f3('0x31')],_0x276f0a[_0x98f3('0x33')]),_0x1e1eb9);if(_0xfb3594['query']['filter']){_0x17464b['where']=_[_0x98f3('0x3d')](_0x17464b[_0x98f3('0x3b')],{'$or':_[_0x98f3('0x30')](_0x1e1eb9,function(_0x5a48b9){if(_0x5a48b9[_0x98f3('0x2d')]!=='VIRTUAL'){var _0x1f485f={};_0x1f485f[_0x5a48b9[_0x98f3('0x28')]]={'$like':'%'+_0xfb3594[_0x98f3('0x31')]['filter']+'%'};return _0x1f485f;}})});}_0x17464b=_[_0x98f3('0x3d')]({},_0x17464b,_0xfb3594[_0x98f3('0x3e')]);var _0x5ab742={'where':_0x17464b[_0x98f3('0x3b')]};return db[_0x98f3('0x2a')][_0x98f3('0x1f')](_0x5ab742)[_0x98f3('0x25')](function(_0xa1f81f){_0x4fafa7['count']=_0xa1f81f;if(_0xfb3594['query'][_0x98f3('0x3f')]){_0x17464b[_0x98f3('0x40')]=[{'all':!![]}];}return db['FaxApplication']['findAll'](_0x17464b);})['then'](function(_0x1208ed){_0x4fafa7[_0x98f3('0x41')]=_0x1208ed;return _0x4fafa7;})[_0x98f3('0x25')](respondWithFilteredResult(_0x17a3be,_0x17464b))[_0x98f3('0x42')](handleError(_0x17a3be,null));};exports[_0x98f3('0x43')]=function(_0x59ce32,_0x41c694){var _0x1e964e={'raw':!![],'where':{'id':_0x59ce32[_0x98f3('0x44')]['id']}},_0x4dfd77={};_0x4dfd77[_0x98f3('0x2f')]=_[_0x98f3('0x32')](db[_0x98f3('0x2a')]['rawAttributes']);_0x4dfd77[_0x98f3('0x31')]=_[_0x98f3('0x32')](_0x59ce32[_0x98f3('0x31')]);_0x4dfd77[_0x98f3('0x33')]=_['intersection'](_0x4dfd77['model'],_0x4dfd77['query']);_0x1e964e[_0x98f3('0x34')]=_[_0x98f3('0x35')](_0x4dfd77['model'],qs['fields'](_0x59ce32['query'][_0x98f3('0x36')]));_0x1e964e[_0x98f3('0x34')]=_0x1e964e[_0x98f3('0x34')][_0x98f3('0x45')]?_0x1e964e['attributes']:_0x4dfd77[_0x98f3('0x2f')];if(_0x59ce32[_0x98f3('0x31')][_0x98f3('0x3f')]){_0x1e964e[_0x98f3('0x40')]=[{'all':!![]}];}_0x1e964e=_['merge']({},_0x1e964e,_0x59ce32[_0x98f3('0x3e')]);return db[_0x98f3('0x2a')][_0x98f3('0x46')](_0x1e964e)[_0x98f3('0x25')](handleEntityNotFound(_0x41c694,null))['then'](respondWithResult(_0x41c694,null))[_0x98f3('0x42')](handleError(_0x41c694,null));};exports[_0x98f3('0x47')]=function(_0x72d3a9,_0x385a9d){return db[_0x98f3('0x2a')][_0x98f3('0x47')](_0x72d3a9[_0x98f3('0x48')],{})['then'](respondWithResult(_0x385a9d,0xc9))['catch'](handleError(_0x385a9d,null));};exports[_0x98f3('0x49')]=function(_0x462b5f,_0x15c40a){if(_0x462b5f[_0x98f3('0x48')]['id']){delete _0x462b5f[_0x98f3('0x48')]['id'];}return db[_0x98f3('0x2a')][_0x98f3('0x46')]({'where':{'id':_0x462b5f['params']['id']}})[_0x98f3('0x25')](handleEntityNotFound(_0x15c40a,null))[_0x98f3('0x25')](saveUpdates(_0x462b5f[_0x98f3('0x48')],null))[_0x98f3('0x25')](respondWithResult(_0x15c40a,null))['catch'](handleError(_0x15c40a,null));};exports[_0x98f3('0x4a')]=function(_0x1ede60,_0x30e969){return db[_0x98f3('0x2a')]['find']({'where':{'id':_0x1ede60[_0x98f3('0x44')]['id']}})[_0x98f3('0x25')](handleEntityNotFound(_0x30e969,null))[_0x98f3('0x25')](removeEntity(_0x30e969,null))['catch'](handleError(_0x30e969,null));}; \ No newline at end of file +var _0xb896=['moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','end','stack','name','send','index','map','rawAttributes','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','FaxApplication','includeAll','include','findAll','catch','keys','find','create','body','params','eml-format','zip-dir','fast-json-patch','request-promise'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0xb896,0x10c));var _0x6b89=function(_0x3b5ad9,_0x223867){_0x3b5ad9=_0x3b5ad9-0x0;var _0x611ae9=_0xb896[_0x3b5ad9];return _0x611ae9;};'use strict';var emlformat=require(_0x6b89('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6b89('0x1'));var jsonpatch=require(_0x6b89('0x2'));var rp=require(_0x6b89('0x3'));var moment=require(_0x6b89('0x4'));var BPromise=require(_0x6b89('0x5'));var Mustache=require(_0x6b89('0x6'));var util=require('util');var path=require('path');var sox=require(_0x6b89('0x7'));var csv=require(_0x6b89('0x8'));var ejs=require(_0x6b89('0x9'));var fs=require('fs');var fs_extra=require(_0x6b89('0xa'));var _=require(_0x6b89('0xb'));var squel=require(_0x6b89('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6b89('0xd'));var toCsv=require(_0x6b89('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6b89('0xe'));var qs=require(_0x6b89('0xf'));var as=require(_0x6b89('0x10'));var hardwareService=require(_0x6b89('0x11'));var logger=require(_0x6b89('0x12'))('api');var utils=require(_0x6b89('0x13'));var config=require(_0x6b89('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x259c81,_0x3675f1){_0x3675f1=_0x3675f1||0xcc;return function(_0x4551a2){if(_0x4551a2){return _0x259c81['sendStatus'](_0x3675f1);}return _0x259c81['status'](_0x3675f1)['end']();};}function respondWithResult(_0x5a74c2,_0x4b5036){_0x4b5036=_0x4b5036||0xc8;return function(_0x10556a){if(_0x10556a){return _0x5a74c2[_0x6b89('0x15')](_0x4b5036)[_0x6b89('0x16')](_0x10556a);}};}function respondWithFilteredResult(_0x364609,_0x11461b){return function(_0x2424a1){if(_0x2424a1){var _0x2b20e2=typeof _0x11461b[_0x6b89('0x17')]===_0x6b89('0x18')&&typeof _0x11461b[_0x6b89('0x19')]===_0x6b89('0x18');var _0x37f872=_0x2424a1['count'];var _0x5c78e2=_0x2b20e2?0x0:_0x11461b[_0x6b89('0x17')];var _0x1984bb=_0x2b20e2?_0x2424a1[_0x6b89('0x1a')]:_0x11461b[_0x6b89('0x17')]+_0x11461b['limit'];var _0x4926f2;if(_0x1984bb>=_0x37f872){_0x1984bb=_0x37f872;_0x4926f2=0xc8;}else{_0x4926f2=0xce;}_0x364609['status'](_0x4926f2);return _0x364609[_0x6b89('0x1b')](_0x6b89('0x1c'),_0x5c78e2+'-'+_0x1984bb+'/'+_0x37f872)[_0x6b89('0x16')](_0x2424a1);}return null;};}function patchUpdates(_0x32631a){return function(_0x4b3346){try{jsonpatch['apply'](_0x4b3346,_0x32631a,!![]);}catch(_0x556e5c){return BPromise[_0x6b89('0x1d')](_0x556e5c);}return _0x4b3346[_0x6b89('0x1e')]();};}function saveUpdates(_0x1a8c69,_0xa85506){return function(_0x1214e8){if(_0x1214e8){return _0x1214e8[_0x6b89('0x1f')](_0x1a8c69)[_0x6b89('0x20')](function(_0x257274){return _0x257274;});}return null;};}function removeEntity(_0x3b4629,_0xd20fe1){return function(_0x47585c){if(_0x47585c){return _0x47585c[_0x6b89('0x21')]()[_0x6b89('0x20')](function(){_0x3b4629['status'](0xcc)[_0x6b89('0x22')]();});}};}function handleEntityNotFound(_0x15a1b9,_0x34092c){return function(_0x1dcbad){if(!_0x1dcbad){_0x15a1b9['sendStatus'](0x194);}return _0x1dcbad;};}function handleError(_0x3c32c0,_0x2b14bc){_0x2b14bc=_0x2b14bc||0x1f4;return function(_0x4eef5d){logger['error'](_0x4eef5d[_0x6b89('0x23')]);if(_0x4eef5d['name']){delete _0x4eef5d[_0x6b89('0x24')];}_0x3c32c0[_0x6b89('0x15')](_0x2b14bc)[_0x6b89('0x25')](_0x4eef5d);};}exports[_0x6b89('0x26')]=function(_0x39122c,_0x2165a4){var _0x355712={},_0x47f62b={},_0xb796c9={'count':0x0,'rows':[]};var _0x1dd4f5=_[_0x6b89('0x27')](db['FaxApplication'][_0x6b89('0x28')],function(_0x3b1ea3){return{'name':_0x3b1ea3['fieldName'],'type':_0x3b1ea3[_0x6b89('0x29')]['key']};});_0x47f62b[_0x6b89('0x2a')]=_[_0x6b89('0x27')](_0x1dd4f5,_0x6b89('0x24'));_0x47f62b[_0x6b89('0x2b')]=_['keys'](_0x39122c[_0x6b89('0x2b')]);_0x47f62b[_0x6b89('0x2c')]=_[_0x6b89('0x2d')](_0x47f62b[_0x6b89('0x2a')],_0x47f62b[_0x6b89('0x2b')]);_0x355712[_0x6b89('0x2e')]=_['intersection'](_0x47f62b['model'],qs[_0x6b89('0x2f')](_0x39122c['query']['fields']));_0x355712[_0x6b89('0x2e')]=_0x355712['attributes'][_0x6b89('0x30')]?_0x355712[_0x6b89('0x2e')]:_0x47f62b[_0x6b89('0x2a')];if(!_0x39122c[_0x6b89('0x2b')]['hasOwnProperty'](_0x6b89('0x31'))){_0x355712['limit']=qs[_0x6b89('0x19')](_0x39122c[_0x6b89('0x2b')][_0x6b89('0x19')]);_0x355712[_0x6b89('0x17')]=qs[_0x6b89('0x17')](_0x39122c['query'][_0x6b89('0x17')]);}_0x355712[_0x6b89('0x32')]=qs[_0x6b89('0x33')](_0x39122c[_0x6b89('0x2b')][_0x6b89('0x33')]);_0x355712[_0x6b89('0x34')]=qs[_0x6b89('0x2c')](_[_0x6b89('0x35')](_0x39122c[_0x6b89('0x2b')],_0x47f62b[_0x6b89('0x2c')]),_0x1dd4f5);if(_0x39122c[_0x6b89('0x2b')][_0x6b89('0x36')]){_0x355712['where']=_['merge'](_0x355712['where'],{'$or':_['map'](_0x1dd4f5,function(_0x1b7c8d){if(_0x1b7c8d[_0x6b89('0x29')]!==_0x6b89('0x37')){var _0x22a305={};_0x22a305[_0x1b7c8d['name']]={'$like':'%'+_0x39122c['query']['filter']+'%'};return _0x22a305;}})});}_0x355712=_[_0x6b89('0x38')]({},_0x355712,_0x39122c[_0x6b89('0x39')]);var _0x4a575a={'where':_0x355712['where']};return db[_0x6b89('0x3a')][_0x6b89('0x1a')](_0x4a575a)[_0x6b89('0x20')](function(_0x28734d){_0xb796c9[_0x6b89('0x1a')]=_0x28734d;if(_0x39122c[_0x6b89('0x2b')][_0x6b89('0x3b')]){_0x355712[_0x6b89('0x3c')]=[{'all':!![]}];}return db['FaxApplication'][_0x6b89('0x3d')](_0x355712);})[_0x6b89('0x20')](function(_0x595b69){_0xb796c9['rows']=_0x595b69;return _0xb796c9;})[_0x6b89('0x20')](respondWithFilteredResult(_0x2165a4,_0x355712))[_0x6b89('0x3e')](handleError(_0x2165a4,null));};exports['show']=function(_0x186360,_0x240aeb){var _0x475d57={'raw':!![],'where':{'id':_0x186360['params']['id']}},_0x235614={};_0x235614[_0x6b89('0x2a')]=_[_0x6b89('0x3f')](db[_0x6b89('0x3a')][_0x6b89('0x28')]);_0x235614['query']=_[_0x6b89('0x3f')](_0x186360['query']);_0x235614[_0x6b89('0x2c')]=_[_0x6b89('0x2d')](_0x235614[_0x6b89('0x2a')],_0x235614[_0x6b89('0x2b')]);_0x475d57[_0x6b89('0x2e')]=_[_0x6b89('0x2d')](_0x235614[_0x6b89('0x2a')],qs['fields'](_0x186360['query'][_0x6b89('0x2f')]));_0x475d57[_0x6b89('0x2e')]=_0x475d57[_0x6b89('0x2e')][_0x6b89('0x30')]?_0x475d57[_0x6b89('0x2e')]:_0x235614['model'];if(_0x186360[_0x6b89('0x2b')]['includeAll']){_0x475d57[_0x6b89('0x3c')]=[{'all':!![]}];}_0x475d57=_[_0x6b89('0x38')]({},_0x475d57,_0x186360['options']);return db[_0x6b89('0x3a')][_0x6b89('0x40')](_0x475d57)['then'](handleEntityNotFound(_0x240aeb,null))[_0x6b89('0x20')](respondWithResult(_0x240aeb,null))[_0x6b89('0x3e')](handleError(_0x240aeb,null));};exports[_0x6b89('0x41')]=function(_0x4d8320,_0x5a46ae){return db[_0x6b89('0x3a')][_0x6b89('0x41')](_0x4d8320['body'],{})[_0x6b89('0x20')](respondWithResult(_0x5a46ae,0xc9))[_0x6b89('0x3e')](handleError(_0x5a46ae,null));};exports[_0x6b89('0x1f')]=function(_0x214df4,_0x5caa37){if(_0x214df4[_0x6b89('0x42')]['id']){delete _0x214df4[_0x6b89('0x42')]['id'];}return db['FaxApplication']['find']({'where':{'id':_0x214df4[_0x6b89('0x43')]['id']}})['then'](handleEntityNotFound(_0x5caa37,null))[_0x6b89('0x20')](saveUpdates(_0x214df4[_0x6b89('0x42')],null))[_0x6b89('0x20')](respondWithResult(_0x5caa37,null))[_0x6b89('0x3e')](handleError(_0x5caa37,null));};exports[_0x6b89('0x21')]=function(_0x49c52f,_0x3c1d19){return db[_0x6b89('0x3a')][_0x6b89('0x40')]({'where':{'id':_0x49c52f[_0x6b89('0x43')]['id']}})['then'](handleEntityNotFound(_0x3c1d19,null))['then'](removeEntity(_0x3c1d19,null))[_0x6b89('0x3e')](handleError(_0x3c1d19,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 46e87d7..450b538 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 _0x1d54=['util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./faxApplication.attributes','exports','define','utf8mb4','lodash'];(function(_0x36fe2a,_0x40f21a){var _0x54566f=function(_0x29bda7){while(--_0x29bda7){_0x36fe2a['push'](_0x36fe2a['shift']());}};_0x54566f(++_0x40f21a);}(_0x1d54,0x1df));var _0x41d5=function(_0x58a4fe,_0x11d439){_0x58a4fe=_0x58a4fe-0x0;var _0x697de2=_0x1d54[_0x58a4fe];return _0x697de2;};'use strict';var _=require(_0x41d5('0x0'));var util=require(_0x41d5('0x1'));var logger=require(_0x41d5('0x2'))(_0x41d5('0x3'));var moment=require('moment');var BPromise=require(_0x41d5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x41d5('0x5'));var rimraf=require(_0x41d5('0x6'));var config=require(_0x41d5('0x7'));var attributes=require(_0x41d5('0x8'));module[_0x41d5('0x9')]=function(_0x266d48,_0x500925){return _0x266d48[_0x41d5('0xa')]('FaxApplication',attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x41d5('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xc15f=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','utf8mb4','lodash','util'];(function(_0x4cf3b2,_0x47a498){var _0x4214c3=function(_0x3cfce2){while(--_0x3cfce2){_0x4cf3b2['push'](_0x4cf3b2['shift']());}};_0x4214c3(++_0x47a498);}(_0xc15f,0xe2));var _0xfc15=function(_0x3653c7,_0xadb356){_0x3653c7=_0x3653c7-0x0;var _0x58a021=_0xc15f[_0x3653c7];return _0x58a021;};'use strict';var _=require(_0xfc15('0x0'));var util=require(_0xfc15('0x1'));var logger=require(_0xfc15('0x2'))(_0xfc15('0x3'));var moment=require(_0xfc15('0x4'));var BPromise=require(_0xfc15('0x5'));var rp=require(_0xfc15('0x6'));var fs=require('fs');var path=require(_0xfc15('0x7'));var rimraf=require(_0xfc15('0x8'));var config=require(_0xfc15('0x9'));var attributes=require('./faxApplication.attributes');module[_0xfc15('0xa')]=function(_0x1cfd8d,_0x2b9174){return _0x1cfd8d['define']('FaxApplication',attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xfc15('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index a078175..9617c08 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 _0x60d4=['update','body','options','raw','where','attributes','limit','UpdateFaxApplication','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','then','info','FaxApplication,\x20%s,\x20%s','FaxApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x16e3dc,_0x35770a){var _0x2f1001=function(_0x516ef7){while(--_0x516ef7){_0x16e3dc['push'](_0x16e3dc['shift']());}};_0x2f1001(++_0x35770a);}(_0x60d4,0xa4));var _0x460d=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x60d4[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0x460d('0x0'));var util=require(_0x460d('0x1'));var moment=require(_0x460d('0x2'));var BPromise=require(_0x460d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x460d('0x4'));var db=require(_0x460d('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x460d('0x6'));var config=require(_0x460d('0x7'));var jayson=require(_0x460d('0x8'));var client=jayson[_0x460d('0x9')][_0x460d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4a4f3f,_0x4997de,_0x3ce4c1){return new BPromise(function(_0x5a9b45,_0x2f61c5){return client['request'](_0x4a4f3f,_0x3ce4c1)[_0x460d('0xb')](function(_0xb06549){logger[_0x460d('0xc')](_0x460d('0xd'),_0x4997de,'request\x20sent');logger['debug'](_0x460d('0xe'),_0x4997de,_0x460d('0xf'),JSON[_0x460d('0x10')](_0xb06549));if(_0xb06549['error']){if(_0xb06549[_0x460d('0x11')][_0x460d('0x12')]===0x1f4){logger[_0x460d('0x11')](_0x460d('0xd'),_0x4997de,_0xb06549[_0x460d('0x11')][_0x460d('0x13')]);return _0x2f61c5(_0xb06549[_0x460d('0x11')][_0x460d('0x13')]);}logger[_0x460d('0x11')]('FaxApplication,\x20%s,\x20%s',_0x4997de,_0xb06549['error']['message']);return _0x5a9b45(_0xb06549[_0x460d('0x11')][_0x460d('0x13')]);}else{logger[_0x460d('0xc')]('FaxApplication,\x20%s,\x20%s',_0x4997de,_0x460d('0xf'));_0x5a9b45(_0xb06549[_0x460d('0x14')][_0x460d('0x13')]);}})[_0x460d('0x15')](function(_0x5175d5){logger[_0x460d('0x11')](_0x460d('0xd'),_0x4997de,_0x5175d5);_0x2f61c5(_0x5175d5);});});}exports['UpdateFaxApplication']=function(_0x155365){var _0x5c2ddf=this;return new Promise(function(_0x43a5f5,_0x247320){return db['FaxApplication'][_0x460d('0x16')](_0x155365[_0x460d('0x17')],{'raw':_0x155365[_0x460d('0x18')]?_0x155365['options'][_0x460d('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x155365['options']?_0x155365[_0x460d('0x18')][_0x460d('0x1a')]||null:null,'attributes':_0x155365[_0x460d('0x18')]?_0x155365[_0x460d('0x18')][_0x460d('0x1b')]||null:null,'limit':_0x155365[_0x460d('0x18')]?_0x155365['options'][_0x460d('0x1c')]||null:null})[_0x460d('0xb')](function(_0x2fd1a){logger[_0x460d('0xc')](_0x460d('0x1d'),_0x155365);logger[_0x460d('0x1e')](_0x460d('0x1d'),_0x155365,JSON[_0x460d('0x10')](_0x2fd1a));_0x43a5f5(_0x2fd1a);})[_0x460d('0x15')](function(_0x1a96ac){logger[_0x460d('0x11')]('UpdateFaxApplication',_0x1a96ac[_0x460d('0x13')],_0x155365);_0x247320(_0x5c2ddf['error'](0x1f4,_0x1a96ac[_0x460d('0x13')]));});});}; \ No newline at end of file +var _0x141d=['body','options','raw','where','UpdateFaxApplication','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','FaxApplication,\x20%s,\x20%s','debug','FaxApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','FaxApplication','update'];(function(_0x34ef17,_0x5ac39d){var _0x3e2033=function(_0xa927e5){while(--_0xa927e5){_0x34ef17['push'](_0x34ef17['shift']());}};_0x3e2033(++_0x5ac39d);}(_0x141d,0xe5));var _0xd141=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0x141d[_0xea8947];return _0x2455e9;};'use strict';var _=require(_0xd141('0x0'));var util=require(_0xd141('0x1'));var moment=require(_0xd141('0x2'));var BPromise=require(_0xd141('0x3'));var rs=require(_0xd141('0x4'));var fs=require('fs');var Redis=require(_0xd141('0x5'));var db=require(_0xd141('0x6'))['db'];var utils=require(_0xd141('0x7'));var logger=require('../../config/logger')(_0xd141('0x8'));var config=require(_0xd141('0x9'));var jayson=require(_0xd141('0xa'));var client=jayson[_0xd141('0xb')][_0xd141('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5b2081,_0x9ef701,_0x22b389){return new BPromise(function(_0x2b3288,_0x1cff60){return client[_0xd141('0xd')](_0x5b2081,_0x22b389)[_0xd141('0xe')](function(_0x10b934){logger['info'](_0xd141('0xf'),_0x9ef701,'request\x20sent');logger[_0xd141('0x10')](_0xd141('0x11'),_0x9ef701,_0xd141('0x12'),JSON[_0xd141('0x13')](_0x10b934));if(_0x10b934[_0xd141('0x14')]){if(_0x10b934[_0xd141('0x14')]['code']===0x1f4){logger[_0xd141('0x14')]('FaxApplication,\x20%s,\x20%s',_0x9ef701,_0x10b934[_0xd141('0x14')]['message']);return _0x1cff60(_0x10b934[_0xd141('0x14')][_0xd141('0x15')]);}logger[_0xd141('0x14')](_0xd141('0xf'),_0x9ef701,_0x10b934['error']['message']);return _0x2b3288(_0x10b934[_0xd141('0x14')][_0xd141('0x15')]);}else{logger[_0xd141('0x16')](_0xd141('0xf'),_0x9ef701,'request\x20sent');_0x2b3288(_0x10b934[_0xd141('0x17')][_0xd141('0x15')]);}})[_0xd141('0x18')](function(_0x264c65){logger['error'](_0xd141('0xf'),_0x9ef701,_0x264c65);_0x1cff60(_0x264c65);});});}exports['UpdateFaxApplication']=function(_0x483664){var _0x1e7f0f=this;return new Promise(function(_0x13ca9c,_0xcd1fce){return db[_0xd141('0x19')][_0xd141('0x1a')](_0x483664[_0xd141('0x1b')],{'raw':_0x483664[_0xd141('0x1c')]?_0x483664[_0xd141('0x1c')][_0xd141('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x483664['options']?_0x483664['options'][_0xd141('0x1e')]||null:null,'attributes':_0x483664[_0xd141('0x1c')]?_0x483664[_0xd141('0x1c')]['attributes']||null:null,'limit':_0x483664['options']?_0x483664[_0xd141('0x1c')]['limit']||null:null})['then'](function(_0x264cd6){logger[_0xd141('0x16')](_0xd141('0x1f'),_0x483664);logger[_0xd141('0x10')](_0xd141('0x1f'),_0x483664,JSON[_0xd141('0x13')](_0x264cd6));_0x13ca9c(_0x264cd6);})[_0xd141('0x18')](function(_0x1024b0){logger['error']('UpdateFaxApplication',_0x1024b0[_0xd141('0x15')],_0x483664);_0xcd1fce(_0x1e7f0f[_0xd141('0x14')](0x1f4,_0x1024b0[_0xd141('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index accddc3..ec69e4f 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 _0x5c00=['delete','destroy','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','post','create','put','/:id','update'];(function(_0x87bf5e,_0x592161){var _0xee894d=function(_0x12d599){while(--_0x12d599){_0x87bf5e['push'](_0x87bf5e['shift']());}};_0xee894d(++_0x592161);}(_0x5c00,0x17e));var _0x05c0=function(_0x23b655,_0x4feb2b){_0x23b655=_0x23b655-0x0;var _0x364b32=_0x5c00[_0x23b655];return _0x364b32;};'use strict';var multer=require(_0x05c0('0x0'));var util=require(_0x05c0('0x1'));var path=require(_0x05c0('0x2'));var timeout=require('connect-timeout');var express=require(_0x05c0('0x3'));var router=express['Router']();var fs_extra=require(_0x05c0('0x4'));var auth=require(_0x05c0('0x5'));var interaction=require(_0x05c0('0x6'));var config=require(_0x05c0('0x7'));var controller=require('./faxApplication.controller');router[_0x05c0('0x8')]('/',auth[_0x05c0('0x9')](),controller[_0x05c0('0xa')]);router[_0x05c0('0x8')]('/:id',auth[_0x05c0('0x9')](),controller[_0x05c0('0xb')]);router[_0x05c0('0xc')]('/',auth['isAuthenticated'](),controller[_0x05c0('0xd')]);router[_0x05c0('0xe')](_0x05c0('0xf'),auth[_0x05c0('0x9')](),controller[_0x05c0('0x10')]);router[_0x05c0('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x05c0('0x12')]);module['exports']=router; \ No newline at end of file +var _0x5eb8=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id','show','put','update','delete','exports','path','connect-timeout','express','Router'];(function(_0x390b06,_0xa16dfa){var _0x23f2ce=function(_0x328dd6){while(--_0x328dd6){_0x390b06['push'](_0x390b06['shift']());}};_0x23f2ce(++_0xa16dfa);}(_0x5eb8,0xb0));var _0x85eb=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0x5eb8[_0x4d613c];return _0x301fe3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x85eb('0x0'));var timeout=require(_0x85eb('0x1'));var express=require(_0x85eb('0x2'));var router=express[_0x85eb('0x3')]();var fs_extra=require(_0x85eb('0x4'));var auth=require(_0x85eb('0x5'));var interaction=require(_0x85eb('0x6'));var config=require(_0x85eb('0x7'));var controller=require(_0x85eb('0x8'));router[_0x85eb('0x9')]('/',auth[_0x85eb('0xa')](),controller[_0x85eb('0xb')]);router['get'](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller[_0x85eb('0xd')]);router['post']('/',auth[_0x85eb('0xa')](),controller['create']);router[_0x85eb('0xe')](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller[_0x85eb('0xf')]);router[_0x85eb('0x10')](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller['destroy']);module[_0x85eb('0x11')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 960b94b..f8ede13 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 _0xdf55=['DATE','STRING','ENUM','out','INTEGER','sequelize','exports'];(function(_0x4a77a3,_0x392c9d){var _0x48d405=function(_0x1f8536){while(--_0x1f8536){_0x4a77a3['push'](_0x4a77a3['shift']());}};_0x48d405(++_0x392c9d);}(_0xdf55,0x83));var _0x5df5=function(_0x3b4922,_0x2fa365){_0x3b4922=_0x3b4922-0x0;var _0x239729=_0xdf55[_0x3b4922];return _0x239729;};'use strict';var Sequelize=require(_0x5df5('0x0'));module[_0x5df5('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x5df5('0x2')]},'disposition':{'type':Sequelize[_0x5df5('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x5df5('0x3')]},'note':{'type':Sequelize[_0x5df5('0x3')]},'read1stAt':{'type':Sequelize[_0x5df5('0x2')]},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0x5df5('0x4')]('in',_0x5df5('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x5df5('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x5df5('0x4')]('in',_0x5df5('0x5')),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0x5df5('0x6')]}}; \ No newline at end of file +var _0x2a07=['STRING','ENUM','out','INTEGER','sequelize','exports','BOOLEAN','DATE'];(function(_0x6564b5,_0x505c1d){var _0x142587=function(_0x2986d0){while(--_0x2986d0){_0x6564b5['push'](_0x6564b5['shift']());}};_0x142587(++_0x505c1d);}(_0x2a07,0x74));var _0x72a0=function(_0x236ed6,_0x562e24){_0x236ed6=_0x236ed6-0x0;var _0x2507e4=_0x2a07[_0x236ed6];return _0x2507e4;};'use strict';var Sequelize=require(_0x72a0('0x0'));module[_0x72a0('0x1')]={'closed':{'type':Sequelize[_0x72a0('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x72a0('0x3')]},'disposition':{'type':Sequelize[_0x72a0('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x72a0('0x4')]},'note':{'type':Sequelize[_0x72a0('0x4')]},'read1stAt':{'type':Sequelize[_0x72a0('0x3')]},'fax':{'type':Sequelize[_0x72a0('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x72a0('0x5')]('in',_0x72a0('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x72a0('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x72a0('0x5')]('in',_0x72a0('0x6')),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0x72a0('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index dcec1c4..192a4f2 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 _0xbad1=['query','user','catch','show','params','model','keys','filters','intersection','attributes','fields','includeAll','include','merge','options','find','create','body','describe','addMessage','FaxMessage','ids','getMessages','findOne','length','hasOwnProperty','nolimit','order','pick','where','FaxInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','omit','spread','Tag','color','emit','faxInteractionTags:save','removeTags','download','toString','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','push','Attachment','Messages','mkdirSync','basename','existsSync','createReadStream','resolve','log','unlinkSync','rimraf','zip-dir','moment','util','lodash','ioredis','../../components/interaction/service','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','status','end','offset','undefined','limit','count','set','Content-Range','json','update','then','destroy','sendStatus','error','name','send','index','map','FaxInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','fax'];(function(_0x1d8495,_0x4a09fa){var _0x513a8b=function(_0x286e79){while(--_0x286e79){_0x1d8495['push'](_0x1d8495['shift']());}};_0x513a8b(++_0x4a09fa);}(_0xbad1,0x115));var _0x1bad=function(_0x544f22,_0x4d4ad8){_0x544f22=_0x544f22-0x0;var _0x47090b=_0xbad1[_0x544f22];return _0x47090b;};'use strict';var rimraf=require(_0x1bad('0x0'));var zipdir=require(_0x1bad('0x1'));var moment=require(_0x1bad('0x2'));var BPromise=require('bluebird');var util=require(_0x1bad('0x3'));var path=require('path');var fs=require('fs');var _=require(_0x1bad('0x4'));var Redis=require(_0x1bad('0x5'));var interaction=require(_0x1bad('0x6'));var qs=require('../../components/parsers/qs');var logger=require(_0x1bad('0x7'))(_0x1bad('0x8'));var config=require(_0x1bad('0x9'));var db=require(_0x1bad('0xa'))['db'];config[_0x1bad('0xb')]=_['defaults'](config['redis'],{'host':_0x1bad('0xc'),'port':0x18eb});var socket=require(_0x1bad('0xd'))(new Redis(config[_0x1bad('0xb')]));require('./faxInteraction.socket')[_0x1bad('0xe')](socket);function respondWithStatusCode(_0x46005e,_0x158eb9){_0x158eb9=_0x158eb9||0xcc;return function(_0x24f97b){if(_0x24f97b){return _0x46005e['sendStatus'](_0x158eb9);}return _0x46005e[_0x1bad('0xf')](_0x158eb9)[_0x1bad('0x10')]();};}function respondWithResult(_0x42de37,_0x231dae){_0x231dae=_0x231dae||0xc8;return function(_0x49feca){if(_0x49feca){return _0x42de37['status'](_0x231dae)['json'](_0x49feca);}};}function respondWithFilteredResult(_0x4edc78,_0x106213){return function(_0x297303){if(_0x297303){var _0x1d03e8=typeof _0x106213[_0x1bad('0x11')]===_0x1bad('0x12')&&typeof _0x106213[_0x1bad('0x13')]===_0x1bad('0x12');var _0x1e46fe=_0x297303[_0x1bad('0x14')];var _0x1d38eb=_0x1d03e8?0x0:_0x106213[_0x1bad('0x11')];var _0xef259f=_0x1d03e8?_0x297303[_0x1bad('0x14')]:_0x106213[_0x1bad('0x11')]+_0x106213[_0x1bad('0x13')];var _0x4830f0;if(_0xef259f>=_0x1e46fe){_0xef259f=_0x1e46fe;_0x4830f0=0xc8;}else{_0x4830f0=0xce;}_0x4edc78[_0x1bad('0xf')](_0x4830f0);return _0x4edc78[_0x1bad('0x15')](_0x1bad('0x16'),_0x1d38eb+'-'+_0xef259f+'/'+_0x1e46fe)[_0x1bad('0x17')](_0x297303);}return null;};}function saveUpdates(_0x38ab72){return function(_0x595135){if(_0x595135){return _0x595135[_0x1bad('0x18')](_0x38ab72)[_0x1bad('0x19')](function(_0x4f2343){return _0x4f2343;});}return null;};}function removeEntity(_0x3f9daf){return function(_0x2c489d){if(_0x2c489d){return _0x2c489d[_0x1bad('0x1a')]()['then'](function(){_0x3f9daf[_0x1bad('0xf')](0xcc)[_0x1bad('0x10')]();});}};}function handleEntityNotFound(_0x267b08){return function(_0x30f04c){if(!_0x30f04c){_0x267b08[_0x1bad('0x1b')](0x194);}return _0x30f04c;};}function handleError(_0x2ff3f1,_0x3b7269){_0x3b7269=_0x3b7269||0x1f4;return function(_0x217ee2){logger[_0x1bad('0x1c')](_0x217ee2['stack']);if(_0x217ee2[_0x1bad('0x1d')]){delete _0x217ee2[_0x1bad('0x1d')];}_0x2ff3f1[_0x1bad('0xf')](_0x3b7269)[_0x1bad('0x1e')](_0x217ee2);};}exports[_0x1bad('0x1f')]=function(_0x2d1c27,_0x32a7bd){var _0x126027={};var _0x1fbe36=_[_0x1bad('0x20')](db[_0x1bad('0x21')][_0x1bad('0x22')],function(_0x5e4bb1){return{'name':_0x5e4bb1[_0x1bad('0x23')],'type':_0x5e4bb1[_0x1bad('0x24')][_0x1bad('0x25')]};});_0x126027=qs[_0x1bad('0x26')](_0x1fbe36,_0x2d1c27);return interaction[_0x1bad('0x27')](_0x1bad('0x28'),_0x2d1c27[_0x1bad('0x29')],_0x2d1c27[_0x1bad('0x2a')],_0x126027,_0x1fbe36)[_0x1bad('0x19')](respondWithFilteredResult(_0x32a7bd,_0x126027))[_0x1bad('0x2b')](handleError(_0x32a7bd,null));};exports[_0x1bad('0x2c')]=function(_0x12546c,_0x35a7a9){var _0x26a581={'raw':![],'where':{'id':_0x12546c[_0x1bad('0x2d')]['id']}},_0x583f02={};_0x583f02[_0x1bad('0x2e')]=_['keys'](db['FaxInteraction'][_0x1bad('0x22')]);_0x583f02[_0x1bad('0x29')]=_[_0x1bad('0x2f')](_0x12546c[_0x1bad('0x29')]);_0x583f02[_0x1bad('0x30')]=_[_0x1bad('0x31')](_0x583f02[_0x1bad('0x2e')],_0x583f02[_0x1bad('0x29')]);_0x26a581[_0x1bad('0x32')]=_[_0x1bad('0x31')](_0x583f02[_0x1bad('0x2e')],qs[_0x1bad('0x33')](_0x12546c['query'][_0x1bad('0x33')]));_0x26a581['attributes']=_0x26a581[_0x1bad('0x32')]['length']?_0x26a581[_0x1bad('0x32')]:_0x583f02[_0x1bad('0x2e')];if(_0x12546c[_0x1bad('0x29')][_0x1bad('0x34')]){_0x26a581[_0x1bad('0x35')]=[{'all':!![]}];}_0x26a581=_[_0x1bad('0x36')]({},_0x26a581,_0x12546c[_0x1bad('0x37')]);return db['FaxInteraction'][_0x1bad('0x38')](_0x26a581)['then'](handleEntityNotFound(_0x35a7a9,null))[_0x1bad('0x19')](respondWithResult(_0x35a7a9,null))[_0x1bad('0x2b')](handleError(_0x35a7a9,null));};exports[_0x1bad('0x39')]=function(_0x984711,_0x19c2dc){return db[_0x1bad('0x21')][_0x1bad('0x39')](_0x984711[_0x1bad('0x3a')],{})['then'](respondWithResult(_0x19c2dc,0xc9))['catch'](handleError(_0x19c2dc,null));};exports[_0x1bad('0x18')]=function(_0x2189e6,_0x423bf1){if(_0x2189e6[_0x1bad('0x3a')]['id']){delete _0x2189e6[_0x1bad('0x3a')]['id'];}return db[_0x1bad('0x21')][_0x1bad('0x38')]({'where':{'id':_0x2189e6['params']['id']}})[_0x1bad('0x19')](handleEntityNotFound(_0x423bf1,null))[_0x1bad('0x19')](saveUpdates(_0x2189e6[_0x1bad('0x3a')],null))[_0x1bad('0x19')](respondWithResult(_0x423bf1,null))[_0x1bad('0x2b')](handleError(_0x423bf1,null));};exports[_0x1bad('0x1a')]=function(_0x1caad9,_0x493343){return db[_0x1bad('0x21')]['find']({'where':{'id':_0x1caad9['params']['id']}})[_0x1bad('0x19')](handleEntityNotFound(_0x493343,null))['then'](removeEntity(_0x493343,null))[_0x1bad('0x2b')](handleError(_0x493343,null));};exports[_0x1bad('0x3b')]=function(_0x1d971e,_0x558523){return db[_0x1bad('0x21')][_0x1bad('0x3b')]()[_0x1bad('0x19')](respondWithResult(_0x558523,null))[_0x1bad('0x2b')](handleError(_0x558523,null));};exports[_0x1bad('0x3c')]=function(_0x2723c1,_0x165495){return db[_0x1bad('0x3d')][_0x1bad('0x38')]({'where':{'id':_0x2723c1['params']['id']}})[_0x1bad('0x19')](handleEntityNotFound(_0x165495,null))[_0x1bad('0x19')](function(_0x336dd6){if(_0x336dd6){return _0x336dd6['addMessage'](_0x2723c1[_0x1bad('0x3a')][_0x1bad('0x3e')],_['omit'](_0x2723c1[_0x1bad('0x3a')],[_0x1bad('0x3e'),'id'])||{});}})[_0x1bad('0x19')](respondWithResult(_0x165495,null))['catch'](handleError(_0x165495,null));};exports[_0x1bad('0x3f')]=function(_0x3edeca,_0x1df2ee){var _0x297d25={'raw':![],'where':{}};var _0x4ac498={};var _0x40ebbb={'count':0x0,'rows':[]};return db[_0x1bad('0x21')][_0x1bad('0x40')]({'where':{'id':_0x3edeca['params']['id']}})[_0x1bad('0x19')](handleEntityNotFound(_0x1df2ee,null))['then'](function(_0x561097){if(_0x561097){_0x4ac498[_0x1bad('0x2e')]=_['keys'](db[_0x1bad('0x3d')]['rawAttributes']);_0x4ac498[_0x1bad('0x29')]=_[_0x1bad('0x2f')](_0x3edeca[_0x1bad('0x29')]);_0x4ac498[_0x1bad('0x30')]=_[_0x1bad('0x31')](_0x4ac498['model'],_0x4ac498[_0x1bad('0x29')]);_0x297d25[_0x1bad('0x32')]=_[_0x1bad('0x31')](_0x4ac498[_0x1bad('0x2e')],qs[_0x1bad('0x33')](_0x3edeca[_0x1bad('0x29')][_0x1bad('0x33')]));_0x297d25['attributes']=_0x297d25['attributes'][_0x1bad('0x41')]?_0x297d25['attributes']:_0x4ac498['model'];if(!_0x3edeca[_0x1bad('0x29')][_0x1bad('0x42')](_0x1bad('0x43'))){_0x297d25['limit']=qs['limit'](_0x3edeca[_0x1bad('0x29')]['limit']);_0x297d25[_0x1bad('0x11')]=qs[_0x1bad('0x11')](_0x3edeca[_0x1bad('0x29')][_0x1bad('0x11')]);}_0x297d25[_0x1bad('0x44')]=qs['sort'](_0x3edeca[_0x1bad('0x29')]['sort']);_0x297d25['where']=qs[_0x1bad('0x30')](_[_0x1bad('0x45')](_0x3edeca[_0x1bad('0x29')],_0x4ac498[_0x1bad('0x30')]));_0x297d25[_0x1bad('0x46')][_0x1bad('0x47')]=_0x561097['id'];if(_0x3edeca[_0x1bad('0x29')]['filter']){_0x297d25[_0x1bad('0x46')]=_[_0x1bad('0x36')](_0x297d25[_0x1bad('0x46')],{'$or':_[_0x1bad('0x20')](_0x297d25['attributes'],function(_0x5a43e9){var _0x22bc31={};_0x22bc31[_0x5a43e9]={'$like':'%'+_0x3edeca['query'][_0x1bad('0x48')]+'%'};return _0x22bc31;})});}if(_0x3edeca['query']['$gte']){var _0x4acb97=_0x3edeca[_0x1bad('0x29')][_0x1bad('0x49')][_0x1bad('0x4a')](',');var _0x56535e={};_0x56535e[_0x4acb97[0x0]]={'$gte':moment(_0x4acb97[0x1])[_0x1bad('0x4b')](_0x1bad('0x4c'))};_0x297d25[_0x1bad('0x46')]=_[_0x1bad('0x36')](_0x297d25['where'],_0x56535e);}_0x297d25=_[_0x1bad('0x36')]({},_0x297d25,_0x3edeca['options']);return db[_0x1bad('0x3d')][_0x1bad('0x14')]({'where':_0x297d25[_0x1bad('0x46')]})['then'](function(_0x39282c){_0x40ebbb[_0x1bad('0x14')]=_0x39282c;if(_0x3edeca[_0x1bad('0x29')]['includeAll']){_0x297d25[_0x1bad('0x35')]=[{'all':!![]}];}return db['FaxMessage'][_0x1bad('0x27')](_0x297d25);})[_0x1bad('0x19')](function(_0x1f3333){_0x40ebbb[_0x1bad('0x4d')]=_0x1f3333;return _0x40ebbb;});}})[_0x1bad('0x19')](respondWithFilteredResult(_0x1df2ee,_0x297d25))[_0x1bad('0x2b')](handleError(_0x1df2ee,null));};exports[_0x1bad('0x4e')]=function(_0x1b3bca,_0x3aee63){return db[_0x1bad('0x21')]['find']({'where':{'id':_0x1b3bca['params']['id']}})[_0x1bad('0x19')](handleEntityNotFound(_0x3aee63,null))['then'](function(_0x459a3a){if(_0x459a3a){return _0x459a3a[_0x1bad('0x4f')](_0x1b3bca[_0x1bad('0x3a')]['ids'],_[_0x1bad('0x50')](_0x1b3bca[_0x1bad('0x3a')],[_0x1bad('0x3e'),'id'])||{})[_0x1bad('0x51')](function(){return db[_0x1bad('0x52')][_0x1bad('0x27')]({'attributes':['id',_0x1bad('0x1d'),_0x1bad('0x53')],'where':{'id':_0x1b3bca[_0x1bad('0x3a')]['ids']}});})[_0x1bad('0x19')](function(_0x11c231){socket[_0x1bad('0x54')](_0x1bad('0x55'),{'id':Number(_0x1b3bca[_0x1bad('0x2d')]['id']),'tags':_0x11c231||[]});return{'id':Number(_0x1b3bca[_0x1bad('0x2d')]['id']),'tags':_0x11c231||[]};});}})[_0x1bad('0x19')](respondWithResult(_0x3aee63,null))[_0x1bad('0x2b')](handleError(_0x3aee63,null));};exports[_0x1bad('0x56')]=function(_0x1efdb4,_0x50ca12){return db[_0x1bad('0x21')]['find']({'where':{'id':_0x1efdb4[_0x1bad('0x2d')]['id']}})['then'](handleEntityNotFound(_0x50ca12,null))[_0x1bad('0x19')](function(_0x7ef6d5){if(_0x7ef6d5){return _0x7ef6d5['removeTags'](_0x1efdb4['query'][_0x1bad('0x3e')]);}})[_0x1bad('0x19')](respondWithStatusCode(_0x50ca12,null))[_0x1bad('0x2b')](handleError(_0x50ca12,null));};exports[_0x1bad('0x57')]=function(_0xd8930e,_0x48829b){var _0x404524=moment()['unix']()[_0x1bad('0x58')]();var _0xf044ae=path[_0x1bad('0x59')](config[_0x1bad('0x5a')],_0x1bad('0x5b'),_0x1bad('0x5c'),_0x1bad('0x5d'));var _0x519804=path[_0x1bad('0x59')](config[_0x1bad('0x5a')],_0x1bad('0x5b'),_0x1bad('0x5c'),_0x1bad('0x5e'));var _0x4f3a01=path[_0x1bad('0x59')](_0xf044ae,_0x404524);var _0x583420=util['format'](_0x1bad('0x5f'),_0xd8930e[_0x1bad('0x2d')]['id'],_0x404524);var _0x50d82a=path['join'](_0xf044ae,_0x583420);var _0x7b544b=[];_0x7b544b[_0x1bad('0x60')]({'model':db[_0x1bad('0x61')],'as':'Attachment','raw':!![]});var _0x5b12ab=[{'model':db[_0x1bad('0x3d')],'as':_0x1bad('0x62'),'attributes':['id',_0x1bad('0x3a'),'createdAt'],'include':_0x7b544b}];return db[_0x1bad('0x21')][_0x1bad('0x38')]({'where':{'id':_0xd8930e['params']['id']},'include':_0x5b12ab})[_0x1bad('0x19')](handleEntityNotFound(_0x48829b,null))[_0x1bad('0x19')](function(_0x1507b1){if(_0x1507b1&&_0x1507b1[_0x1bad('0x62')]){var _0x4ddcdf=_0x1507b1['get']({'plain':!![]});fs[_0x1bad('0x63')](_0x4f3a01);for(var _0x3e8ad5=0x0;_0x3e8ad5<_0x4ddcdf[_0x1bad('0x62')][_0x1bad('0x41')];_0x3e8ad5++){var _0x1d1a21=_0x4ddcdf[_0x1bad('0x62')][_0x3e8ad5][_0x1bad('0x61')];if(_0x1d1a21){var _0x332ff3=path[_0x1bad('0x59')](_0x519804,_0x1d1a21[_0x1bad('0x64')]);if(fs[_0x1bad('0x65')](_0x332ff3)){fs[_0x1bad('0x66')](_0x332ff3)['pipe'](fs['createWriteStream'](path[_0x1bad('0x59')](_0x4f3a01,_0x1d1a21[_0x1bad('0x64')])));}}}return BPromise[_0x1bad('0x67')]()[_0x1bad('0x19')](function(){return new BPromise(function(_0x4f899e,_0x467630){zipdir(_0x4f3a01,{'saveTo':_0x50d82a},function(_0x513682,_0x33ec2d){if(_0x513682)return _0x467630(_0x513682);return _0x4f899e(_0x33ec2d);});})[_0x1bad('0x19')](function(){return new BPromise(function(_0x5536af,_0x424c5d){rimraf(_0x4f3a01,function(_0x4c2912){if(_0x4c2912)_0x424c5d(_0x4c2912);return _0x5536af();});});})[_0x1bad('0x19')](function(){return _0x48829b[_0x1bad('0x57')](_0x50d82a,_0x583420,function(_0x1702de){if(_0x1702de){console[_0x1bad('0x68')]('err',_0x1702de);}else{fs[_0x1bad('0x69')](_0x50d82a);}});});});}else{return _0x48829b[_0x1bad('0x1b')](0xc8);}})['catch'](handleError(_0x48829b,null));}; \ No newline at end of file +var _0xbf23=['fieldName','key','getOptions','findAll','fax','query','catch','show','params','model','keys','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','create','body','describe','addMessage','ids','omit','findOne','hasOwnProperty','nolimit','limit','sort','where','pick','FaxInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','rows','addTags','setTags','spread','color','emit','removeTags','toString','join','root','files','server','attachments','transcript-%d-%s.zip','push','Attachment','Messages','get','existsSync','createReadStream','pipe','createWriteStream','basename','resolve','log','unlinkSync','rimraf','zip-dir','moment','bluebird','util','path','lodash','../../components/interaction/service','api','../../mysqldb','redis','defaults','localhost','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','update','then','destroy','error','stack','name','send','map','FaxInteraction','rawAttributes'];(function(_0x6c0123,_0x4c8d3b){var _0x5a87d2=function(_0x1ff614){while(--_0x1ff614){_0x6c0123['push'](_0x6c0123['shift']());}};_0x5a87d2(++_0x4c8d3b);}(_0xbf23,0xa6));var _0x3bf2=function(_0x2d7c67,_0x358a79){_0x2d7c67=_0x2d7c67-0x0;var _0x523bd4=_0xbf23[_0x2d7c67];return _0x523bd4;};'use strict';var rimraf=require(_0x3bf2('0x0'));var zipdir=require(_0x3bf2('0x1'));var moment=require(_0x3bf2('0x2'));var BPromise=require(_0x3bf2('0x3'));var util=require(_0x3bf2('0x4'));var path=require(_0x3bf2('0x5'));var fs=require('fs');var _=require(_0x3bf2('0x6'));var Redis=require('ioredis');var interaction=require(_0x3bf2('0x7'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x3bf2('0x8'));var config=require('../../config/environment');var db=require(_0x3bf2('0x9'))['db'];config[_0x3bf2('0xa')]=_[_0x3bf2('0xb')](config[_0x3bf2('0xa')],{'host':_0x3bf2('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3bf2('0xa')]));require('./faxInteraction.socket')['register'](socket);function respondWithStatusCode(_0x3479b7,_0x46dd81){_0x46dd81=_0x46dd81||0xcc;return function(_0x3fb83c){if(_0x3fb83c){return _0x3479b7[_0x3bf2('0xd')](_0x46dd81);}return _0x3479b7[_0x3bf2('0xe')](_0x46dd81)[_0x3bf2('0xf')]();};}function respondWithResult(_0x22431f,_0x27e121){_0x27e121=_0x27e121||0xc8;return function(_0x4979bf){if(_0x4979bf){return _0x22431f[_0x3bf2('0xe')](_0x27e121)[_0x3bf2('0x10')](_0x4979bf);}};}function respondWithFilteredResult(_0x2c8a06,_0x3c0471){return function(_0x4f42b0){if(_0x4f42b0){var _0x389af2=typeof _0x3c0471[_0x3bf2('0x11')]===_0x3bf2('0x12')&&typeof _0x3c0471['limit']===_0x3bf2('0x12');var _0x251a14=_0x4f42b0[_0x3bf2('0x13')];var _0x38bef1=_0x389af2?0x0:_0x3c0471[_0x3bf2('0x11')];var _0x41c72b=_0x389af2?_0x4f42b0[_0x3bf2('0x13')]:_0x3c0471[_0x3bf2('0x11')]+_0x3c0471['limit'];var _0x2b8ce6;if(_0x41c72b>=_0x251a14){_0x41c72b=_0x251a14;_0x2b8ce6=0xc8;}else{_0x2b8ce6=0xce;}_0x2c8a06['status'](_0x2b8ce6);return _0x2c8a06[_0x3bf2('0x14')](_0x3bf2('0x15'),_0x38bef1+'-'+_0x41c72b+'/'+_0x251a14)[_0x3bf2('0x10')](_0x4f42b0);}return null;};}function saveUpdates(_0x1650de){return function(_0x4d0613){if(_0x4d0613){return _0x4d0613[_0x3bf2('0x16')](_0x1650de)[_0x3bf2('0x17')](function(_0x5bf6f7){return _0x5bf6f7;});}return null;};}function removeEntity(_0x2e62f2){return function(_0x1d3d4f){if(_0x1d3d4f){return _0x1d3d4f[_0x3bf2('0x18')]()[_0x3bf2('0x17')](function(){_0x2e62f2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3288b6){return function(_0x3f214f){if(!_0x3f214f){_0x3288b6['sendStatus'](0x194);}return _0x3f214f;};}function handleError(_0x466a34,_0x545396){_0x545396=_0x545396||0x1f4;return function(_0x9ffe34){logger[_0x3bf2('0x19')](_0x9ffe34[_0x3bf2('0x1a')]);if(_0x9ffe34['name']){delete _0x9ffe34[_0x3bf2('0x1b')];}_0x466a34[_0x3bf2('0xe')](_0x545396)[_0x3bf2('0x1c')](_0x9ffe34);};}exports['index']=function(_0x4b7377,_0x55891e){var _0x318987={};var _0x474557=_[_0x3bf2('0x1d')](db[_0x3bf2('0x1e')][_0x3bf2('0x1f')],function(_0x55b98e){return{'name':_0x55b98e[_0x3bf2('0x20')],'type':_0x55b98e['type'][_0x3bf2('0x21')]};});_0x318987=qs[_0x3bf2('0x22')](_0x474557,_0x4b7377);return interaction[_0x3bf2('0x23')](_0x3bf2('0x24'),_0x4b7377[_0x3bf2('0x25')],_0x4b7377['user'],_0x318987,_0x474557)[_0x3bf2('0x17')](respondWithFilteredResult(_0x55891e,_0x318987))[_0x3bf2('0x26')](handleError(_0x55891e,null));};exports[_0x3bf2('0x27')]=function(_0x2d9343,_0x2dd980){var _0x4f100f={'raw':![],'where':{'id':_0x2d9343[_0x3bf2('0x28')]['id']}},_0x41b4e9={};_0x41b4e9[_0x3bf2('0x29')]=_[_0x3bf2('0x2a')](db[_0x3bf2('0x1e')][_0x3bf2('0x1f')]);_0x41b4e9[_0x3bf2('0x25')]=_[_0x3bf2('0x2a')](_0x2d9343[_0x3bf2('0x25')]);_0x41b4e9[_0x3bf2('0x2b')]=_[_0x3bf2('0x2c')](_0x41b4e9['model'],_0x41b4e9[_0x3bf2('0x25')]);_0x4f100f[_0x3bf2('0x2d')]=_[_0x3bf2('0x2c')](_0x41b4e9[_0x3bf2('0x29')],qs[_0x3bf2('0x2e')](_0x2d9343['query'][_0x3bf2('0x2e')]));_0x4f100f[_0x3bf2('0x2d')]=_0x4f100f[_0x3bf2('0x2d')][_0x3bf2('0x2f')]?_0x4f100f[_0x3bf2('0x2d')]:_0x41b4e9[_0x3bf2('0x29')];if(_0x2d9343['query'][_0x3bf2('0x30')]){_0x4f100f[_0x3bf2('0x31')]=[{'all':!![]}];}_0x4f100f=_[_0x3bf2('0x32')]({},_0x4f100f,_0x2d9343[_0x3bf2('0x33')]);return db[_0x3bf2('0x1e')][_0x3bf2('0x34')](_0x4f100f)['then'](handleEntityNotFound(_0x2dd980,null))[_0x3bf2('0x17')](respondWithResult(_0x2dd980,null))[_0x3bf2('0x26')](handleError(_0x2dd980,null));};exports['create']=function(_0x5ed969,_0x55ce50){return db[_0x3bf2('0x1e')][_0x3bf2('0x35')](_0x5ed969[_0x3bf2('0x36')],{})[_0x3bf2('0x17')](respondWithResult(_0x55ce50,0xc9))[_0x3bf2('0x26')](handleError(_0x55ce50,null));};exports[_0x3bf2('0x16')]=function(_0xd92e49,_0x5a5131){if(_0xd92e49[_0x3bf2('0x36')]['id']){delete _0xd92e49[_0x3bf2('0x36')]['id'];}return db[_0x3bf2('0x1e')][_0x3bf2('0x34')]({'where':{'id':_0xd92e49[_0x3bf2('0x28')]['id']}})[_0x3bf2('0x17')](handleEntityNotFound(_0x5a5131,null))[_0x3bf2('0x17')](saveUpdates(_0xd92e49['body'],null))[_0x3bf2('0x17')](respondWithResult(_0x5a5131,null))[_0x3bf2('0x26')](handleError(_0x5a5131,null));};exports['destroy']=function(_0x164b6b,_0x41cdf2){return db[_0x3bf2('0x1e')][_0x3bf2('0x34')]({'where':{'id':_0x164b6b['params']['id']}})[_0x3bf2('0x17')](handleEntityNotFound(_0x41cdf2,null))[_0x3bf2('0x17')](removeEntity(_0x41cdf2,null))['catch'](handleError(_0x41cdf2,null));};exports['describe']=function(_0x5d5516,_0x11364f){return db[_0x3bf2('0x1e')][_0x3bf2('0x37')]()['then'](respondWithResult(_0x11364f,null))[_0x3bf2('0x26')](handleError(_0x11364f,null));};exports[_0x3bf2('0x38')]=function(_0x54c4fd,_0x478c47){return db['FaxMessage'][_0x3bf2('0x34')]({'where':{'id':_0x54c4fd[_0x3bf2('0x28')]['id']}})[_0x3bf2('0x17')](handleEntityNotFound(_0x478c47,null))[_0x3bf2('0x17')](function(_0x3a7d14){if(_0x3a7d14){return _0x3a7d14[_0x3bf2('0x38')](_0x54c4fd['body'][_0x3bf2('0x39')],_[_0x3bf2('0x3a')](_0x54c4fd['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x478c47,null))[_0x3bf2('0x26')](handleError(_0x478c47,null));};exports['getMessages']=function(_0x395840,_0x4654d9){var _0x24a26f={'raw':![],'where':{}};var _0x40554e={};var _0x2d1b73={'count':0x0,'rows':[]};return db[_0x3bf2('0x1e')][_0x3bf2('0x3b')]({'where':{'id':_0x395840['params']['id']}})['then'](handleEntityNotFound(_0x4654d9,null))[_0x3bf2('0x17')](function(_0x88eb9b){if(_0x88eb9b){_0x40554e[_0x3bf2('0x29')]=_[_0x3bf2('0x2a')](db['FaxMessage'][_0x3bf2('0x1f')]);_0x40554e[_0x3bf2('0x25')]=_['keys'](_0x395840[_0x3bf2('0x25')]);_0x40554e[_0x3bf2('0x2b')]=_[_0x3bf2('0x2c')](_0x40554e[_0x3bf2('0x29')],_0x40554e['query']);_0x24a26f[_0x3bf2('0x2d')]=_[_0x3bf2('0x2c')](_0x40554e[_0x3bf2('0x29')],qs['fields'](_0x395840[_0x3bf2('0x25')][_0x3bf2('0x2e')]));_0x24a26f['attributes']=_0x24a26f[_0x3bf2('0x2d')][_0x3bf2('0x2f')]?_0x24a26f['attributes']:_0x40554e['model'];if(!_0x395840['query'][_0x3bf2('0x3c')](_0x3bf2('0x3d'))){_0x24a26f[_0x3bf2('0x3e')]=qs['limit'](_0x395840[_0x3bf2('0x25')][_0x3bf2('0x3e')]);_0x24a26f[_0x3bf2('0x11')]=qs[_0x3bf2('0x11')](_0x395840[_0x3bf2('0x25')][_0x3bf2('0x11')]);}_0x24a26f['order']=qs[_0x3bf2('0x3f')](_0x395840[_0x3bf2('0x25')][_0x3bf2('0x3f')]);_0x24a26f[_0x3bf2('0x40')]=qs[_0x3bf2('0x2b')](_[_0x3bf2('0x41')](_0x395840['query'],_0x40554e[_0x3bf2('0x2b')]));_0x24a26f[_0x3bf2('0x40')][_0x3bf2('0x42')]=_0x88eb9b['id'];if(_0x395840[_0x3bf2('0x25')][_0x3bf2('0x43')]){_0x24a26f[_0x3bf2('0x40')]=_[_0x3bf2('0x32')](_0x24a26f['where'],{'$or':_['map'](_0x24a26f[_0x3bf2('0x2d')],function(_0x2b41cd){var _0x5b5e7c={};_0x5b5e7c[_0x2b41cd]={'$like':'%'+_0x395840[_0x3bf2('0x25')]['filter']+'%'};return _0x5b5e7c;})});}if(_0x395840[_0x3bf2('0x25')][_0x3bf2('0x44')]){var _0x159d51=_0x395840[_0x3bf2('0x25')]['$gte'][_0x3bf2('0x45')](',');var _0x25aedf={};_0x25aedf[_0x159d51[0x0]]={'$gte':moment(_0x159d51[0x1])[_0x3bf2('0x46')](_0x3bf2('0x47'))};_0x24a26f[_0x3bf2('0x40')]=_[_0x3bf2('0x32')](_0x24a26f[_0x3bf2('0x40')],_0x25aedf);}_0x24a26f=_[_0x3bf2('0x32')]({},_0x24a26f,_0x395840[_0x3bf2('0x33')]);return db[_0x3bf2('0x48')][_0x3bf2('0x13')]({'where':_0x24a26f['where']})[_0x3bf2('0x17')](function(_0x3ee7aa){_0x2d1b73[_0x3bf2('0x13')]=_0x3ee7aa;if(_0x395840[_0x3bf2('0x25')][_0x3bf2('0x30')]){_0x24a26f[_0x3bf2('0x31')]=[{'all':!![]}];}return db['FaxMessage'][_0x3bf2('0x23')](_0x24a26f);})[_0x3bf2('0x17')](function(_0x414314){_0x2d1b73[_0x3bf2('0x49')]=_0x414314;return _0x2d1b73;});}})[_0x3bf2('0x17')](respondWithFilteredResult(_0x4654d9,_0x24a26f))[_0x3bf2('0x26')](handleError(_0x4654d9,null));};exports[_0x3bf2('0x4a')]=function(_0x5ec941,_0x3852b9){return db['FaxInteraction'][_0x3bf2('0x34')]({'where':{'id':_0x5ec941[_0x3bf2('0x28')]['id']}})[_0x3bf2('0x17')](handleEntityNotFound(_0x3852b9,null))[_0x3bf2('0x17')](function(_0x2a54d2){if(_0x2a54d2){return _0x2a54d2[_0x3bf2('0x4b')](_0x5ec941[_0x3bf2('0x36')][_0x3bf2('0x39')],_[_0x3bf2('0x3a')](_0x5ec941['body'],[_0x3bf2('0x39'),'id'])||{})[_0x3bf2('0x4c')](function(){return db['Tag']['findAll']({'attributes':['id',_0x3bf2('0x1b'),_0x3bf2('0x4d')],'where':{'id':_0x5ec941[_0x3bf2('0x36')][_0x3bf2('0x39')]}});})[_0x3bf2('0x17')](function(_0x3b00a9){socket[_0x3bf2('0x4e')]('faxInteractionTags:save',{'id':Number(_0x5ec941[_0x3bf2('0x28')]['id']),'tags':_0x3b00a9||[]});return{'id':Number(_0x5ec941[_0x3bf2('0x28')]['id']),'tags':_0x3b00a9||[]};});}})['then'](respondWithResult(_0x3852b9,null))['catch'](handleError(_0x3852b9,null));};exports[_0x3bf2('0x4f')]=function(_0x35462f,_0x5ae063){return db[_0x3bf2('0x1e')]['find']({'where':{'id':_0x35462f[_0x3bf2('0x28')]['id']}})[_0x3bf2('0x17')](handleEntityNotFound(_0x5ae063,null))[_0x3bf2('0x17')](function(_0x434203){if(_0x434203){return _0x434203[_0x3bf2('0x4f')](_0x35462f[_0x3bf2('0x25')]['ids']);}})[_0x3bf2('0x17')](respondWithStatusCode(_0x5ae063,null))[_0x3bf2('0x26')](handleError(_0x5ae063,null));};exports['download']=function(_0xa16a42,_0x255cee){var _0x883dfa=moment()['unix']()[_0x3bf2('0x50')]();var _0x1782f1=path[_0x3bf2('0x51')](config[_0x3bf2('0x52')],'server',_0x3bf2('0x53'),'tmp');var _0x3ad592=path['join'](config['root'],_0x3bf2('0x54'),_0x3bf2('0x53'),_0x3bf2('0x55'));var _0x539ef1=path[_0x3bf2('0x51')](_0x1782f1,_0x883dfa);var _0x3be519=util[_0x3bf2('0x46')](_0x3bf2('0x56'),_0xa16a42[_0x3bf2('0x28')]['id'],_0x883dfa);var _0x21934a=path[_0x3bf2('0x51')](_0x1782f1,_0x3be519);var _0x85ebac=[];_0x85ebac[_0x3bf2('0x57')]({'model':db[_0x3bf2('0x58')],'as':'Attachment','raw':!![]});var _0x5c466f=[{'model':db['FaxMessage'],'as':_0x3bf2('0x59'),'attributes':['id',_0x3bf2('0x36'),'createdAt'],'include':_0x85ebac}];return db[_0x3bf2('0x1e')]['find']({'where':{'id':_0xa16a42['params']['id']},'include':_0x5c466f})[_0x3bf2('0x17')](handleEntityNotFound(_0x255cee,null))[_0x3bf2('0x17')](function(_0x429c15){if(_0x429c15&&_0x429c15[_0x3bf2('0x59')]){var _0x3a23db=_0x429c15[_0x3bf2('0x5a')]({'plain':!![]});fs['mkdirSync'](_0x539ef1);for(var _0x1dad86=0x0;_0x1dad86<_0x3a23db[_0x3bf2('0x59')]['length'];_0x1dad86++){var _0x23cc5e=_0x3a23db[_0x3bf2('0x59')][_0x1dad86][_0x3bf2('0x58')];if(_0x23cc5e){var _0x50725b=path[_0x3bf2('0x51')](_0x3ad592,_0x23cc5e['basename']);if(fs[_0x3bf2('0x5b')](_0x50725b)){fs[_0x3bf2('0x5c')](_0x50725b)[_0x3bf2('0x5d')](fs[_0x3bf2('0x5e')](path['join'](_0x539ef1,_0x23cc5e[_0x3bf2('0x5f')])));}}}return BPromise[_0x3bf2('0x60')]()[_0x3bf2('0x17')](function(){return new BPromise(function(_0x14ed18,_0x12f9e3){zipdir(_0x539ef1,{'saveTo':_0x21934a},function(_0x26f0b4,_0x4d3e94){if(_0x26f0b4)return _0x12f9e3(_0x26f0b4);return _0x14ed18(_0x4d3e94);});})[_0x3bf2('0x17')](function(){return new BPromise(function(_0x1ef5fa,_0x108f49){rimraf(_0x539ef1,function(_0x588a91){if(_0x588a91)_0x108f49(_0x588a91);return _0x1ef5fa();});});})['then'](function(){return _0x255cee['download'](_0x21934a,_0x3be519,function(_0x4b9078){if(_0x4b9078){console[_0x3bf2('0x61')]('err',_0x4b9078);}else{fs[_0x3bf2('0x62')](_0x21934a);}});});});}else{return _0x255cee[_0x3bf2('0xd')](0xc8);}})[_0x3bf2('0x26')](handleError(_0x255cee,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 6776b6a..3e5cee4 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 _0x313e=['setDataValue','length','emit','catch','hook','exports','events','../../mysqldb','FaxMessage','setMaxListeners','save','update','remove','getUsers','then','Users','map'];(function(_0x10a622,_0x1804be){var _0x707210=function(_0x557c30){while(--_0x557c30){_0x10a622['push'](_0x10a622['shift']());}};_0x707210(++_0x1804be);}(_0x313e,0x9f));var _0xe313=function(_0x193e28,_0x3dac1d){_0x193e28=_0x193e28-0x0;var _0x20ef59=_0x313e[_0x193e28];return _0x20ef59;};'use strict';var EventEmitter=require(_0xe313('0x0'));var FaxInteraction=require(_0xe313('0x1'))['db']['FaxInteraction'];var FaxMessage=require('../../mysqldb')['db'][_0xe313('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xe313('0x3')](0x0);var events={'afterCreate':_0xe313('0x4'),'afterUpdate':_0xe313('0x5'),'afterDestroy':_0xe313('0x6')};function emitEvent(_0xac89a1){return function(_0xd453be,_0x1679db,_0x5d90e4){_0xd453be[_0xe313('0x7')]({'attributes':['id'],'raw':!![]})[_0xe313('0x8')](function(_0x4e6149){_0xd453be['setDataValue'](_0xe313('0x9'),_0x4e6149[_0xe313('0xa')](function(_0xd672c){return{'id':_0xd672c['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0xd453be['id'],'direction':'in','read':![]},'raw':!![]});})[_0xe313('0x8')](function(_0x257840){_0xd453be[_0xe313('0xb')]('unreadMessages',_0x257840[_0xe313('0xc')]);FaxInteractionEvents[_0xe313('0xd')](_0xac89a1+':'+_0xd453be['id'],_0xd453be);FaxInteractionEvents[_0xe313('0xd')](_0xac89a1,_0xd453be);_0x5d90e4(null);})[_0xe313('0xe')](_0x5d90e4(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxInteraction[_0xe313('0xf')](e,emitEvent(event));}}module[_0xe313('0x10')]=FaxInteractionEvents; \ No newline at end of file +var _0x2bd7=['setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','exports','events','../../mysqldb','FaxInteraction','FaxMessage','save','update','remove','then'];(function(_0x13cab1,_0x3f1cb9){var _0x13b2c1=function(_0x5520da){while(--_0x5520da){_0x13cab1['push'](_0x13cab1['shift']());}};_0x13b2c1(++_0x3f1cb9);}(_0x2bd7,0x1e5));var _0x72bd=function(_0x4e5db2,_0x339ead){_0x4e5db2=_0x4e5db2-0x0;var _0x239ddb=_0x2bd7[_0x4e5db2];return _0x239ddb;};'use strict';var EventEmitter=require(_0x72bd('0x0'));var FaxInteraction=require(_0x72bd('0x1'))['db'][_0x72bd('0x2')];var FaxMessage=require(_0x72bd('0x1'))['db'][_0x72bd('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x72bd('0x4'),'afterUpdate':_0x72bd('0x5'),'afterDestroy':_0x72bd('0x6')};function emitEvent(_0x26f0e6){return function(_0x4b340e,_0x2a99f8,_0x52caa7){_0x4b340e['getUsers']({'attributes':['id'],'raw':!![]})[_0x72bd('0x7')](function(_0x2d5692){_0x4b340e[_0x72bd('0x8')](_0x72bd('0x9'),_0x2d5692[_0x72bd('0xa')](function(_0x5ed670){return{'id':_0x5ed670['id']};}));return FaxMessage[_0x72bd('0xb')]({'where':{'FaxInteractionId':_0x4b340e['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x6b8de1){_0x4b340e[_0x72bd('0x8')](_0x72bd('0xc'),_0x6b8de1[_0x72bd('0xd')]);FaxInteractionEvents[_0x72bd('0xe')](_0x26f0e6+':'+_0x4b340e['id'],_0x4b340e);FaxInteractionEvents[_0x72bd('0xe')](_0x26f0e6,_0x4b340e);_0x52caa7(null);})[_0x72bd('0xf')](_0x52caa7(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0x72bd('0x10')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index fb7dc17..a106d22 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 _0x28bf=['request-promise','path','rimraf','../../config/environment','./faxInteraction.attributes','exports','define','FaxInteraction','closed','closedAt','format','../../config/logger','moment','bluebird'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0x28bf,0xc1));var _0xf28b=function(_0x291fc4,_0x39bf93){_0x291fc4=_0x291fc4-0x0;var _0x6f8a72=_0x28bf[_0x291fc4];return _0x6f8a72;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf28b('0x0'))('api');var moment=require(_0xf28b('0x1'));var BPromise=require(_0xf28b('0x2'));var rp=require(_0xf28b('0x3'));var fs=require('fs');var path=require(_0xf28b('0x4'));var rimraf=require(_0xf28b('0x5'));var config=require(_0xf28b('0x6'));var attributes=require(_0xf28b('0x7'));module[_0xf28b('0x8')]=function(_0xce3a63,_0x1547b9){return _0xce3a63[_0xf28b('0x9')](_0xf28b('0xa'),attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x643ce1,_0x1313e1,_0x13632e){if(_0x643ce1['changed'](_0xf28b('0xb'))){_0x643ce1[_0xf28b('0xc')]=moment()[_0xf28b('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0x13632e(null,_0x643ce1);}}});}; \ No newline at end of file +var _0xdeb3=['closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./faxInteraction.attributes','define','fax_interactions','changed','closed'];(function(_0x1c22ae,_0xc77fcd){var _0x25d4c8=function(_0x40a76d){while(--_0x40a76d){_0x1c22ae['push'](_0x1c22ae['shift']());}};_0x25d4c8(++_0xc77fcd);}(_0xdeb3,0xb7));var _0x3deb=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xdeb3[_0x42cae2];return _0x5f256f;};'use strict';var _=require('lodash');var util=require(_0x3deb('0x0'));var logger=require(_0x3deb('0x1'))(_0x3deb('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3deb('0x3'));var fs=require('fs');var path=require(_0x3deb('0x4'));var rimraf=require(_0x3deb('0x5'));var config=require(_0x3deb('0x6'));var attributes=require(_0x3deb('0x7'));module['exports']=function(_0x193700,_0x47d2d4){return _0x193700[_0x3deb('0x8')]('FaxInteraction',attributes,{'tableName':_0x3deb('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1bf486,_0x3e983a,_0xacb749){if(_0x1bf486[_0x3deb('0xa')](_0x3deb('0xb'))){_0x1bf486[_0x3deb('0xc')]=moment()[_0x3deb('0xd')](_0x3deb('0xe'));}_0xacb749(null,_0x1bf486);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index c7cd207..6dd2f98 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 _0x4038=['addTags','ids','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./faxInteraction.socket','register','request','then','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateFaxInteraction','FaxInteraction','update','body','options','raw','where','attributes','limit','info','AddTagsToFaxInteraction'];(function(_0x513835,_0x93de04){var _0x567b24=function(_0x19dde6){while(--_0x19dde6){_0x513835['push'](_0x513835['shift']());}};_0x567b24(++_0x93de04);}(_0x4038,0x1c6));var _0x8403=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x4038[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x8403('0x0'));var util=require(_0x8403('0x1'));var moment=require(_0x8403('0x2'));var BPromise=require(_0x8403('0x3'));var rs=require(_0x8403('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8403('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8403('0x6'));var config=require('../../config/environment');var jayson=require(_0x8403('0x7'));var client=jayson[_0x8403('0x8')][_0x8403('0x9')]({'port':0x232a});config[_0x8403('0xa')]=_[_0x8403('0xb')](config[_0x8403('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x8403('0xc'))(new Redis(config[_0x8403('0xa')]));require(_0x8403('0xd'))[_0x8403('0xe')](socket);function respondWithRpcPromise(_0x4b2614,_0x2f3db2,_0x4f2c85){return new BPromise(function(_0x5b1fcf,_0x2fa21e){return client[_0x8403('0xf')](_0x4b2614,_0x4f2c85)[_0x8403('0x10')](function(_0x3eac38){logger['info'](_0x8403('0x11'),_0x2f3db2,_0x8403('0x12'));logger[_0x8403('0x13')](_0x8403('0x14'),_0x2f3db2,_0x8403('0x12'),JSON[_0x8403('0x15')](_0x3eac38));if(_0x3eac38[_0x8403('0x16')]){if(_0x3eac38['error'][_0x8403('0x17')]===0x1f4){logger[_0x8403('0x16')](_0x8403('0x11'),_0x2f3db2,_0x3eac38[_0x8403('0x16')]['message']);return _0x2fa21e(_0x3eac38['error'][_0x8403('0x18')]);}logger[_0x8403('0x16')](_0x8403('0x11'),_0x2f3db2,_0x3eac38[_0x8403('0x16')]['message']);return _0x5b1fcf(_0x3eac38[_0x8403('0x16')][_0x8403('0x18')]);}else{logger['info'](_0x8403('0x11'),_0x2f3db2,_0x8403('0x12'));_0x5b1fcf(_0x3eac38[_0x8403('0x19')][_0x8403('0x18')]);}})[_0x8403('0x1a')](function(_0x33fbef){logger['error'](_0x8403('0x11'),_0x2f3db2,_0x33fbef);_0x2fa21e(_0x33fbef);});});}exports[_0x8403('0x1b')]=function(_0x51af7d){var _0x23dfba=this;return new Promise(function(_0xbdea02,_0x3da737){return db[_0x8403('0x1c')][_0x8403('0x1d')](_0x51af7d[_0x8403('0x1e')],{'raw':_0x51af7d[_0x8403('0x1f')]?_0x51af7d[_0x8403('0x1f')][_0x8403('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x51af7d[_0x8403('0x1f')]?_0x51af7d['options'][_0x8403('0x21')]||null:null,'attributes':_0x51af7d[_0x8403('0x1f')]?_0x51af7d[_0x8403('0x1f')][_0x8403('0x22')]||null:null,'limit':_0x51af7d[_0x8403('0x1f')]?_0x51af7d[_0x8403('0x1f')][_0x8403('0x23')]||null:null})[_0x8403('0x10')](function(_0x3de022){logger[_0x8403('0x24')]('UpdateFaxInteraction',_0x51af7d);logger[_0x8403('0x13')](_0x8403('0x1b'),_0x51af7d,JSON[_0x8403('0x15')](_0x3de022));_0xbdea02(_0x3de022);})[_0x8403('0x1a')](function(_0x38976a){logger[_0x8403('0x16')](_0x8403('0x1b'),_0x38976a[_0x8403('0x18')],_0x51af7d);_0x3da737(_0x23dfba[_0x8403('0x16')](0x1f4,_0x38976a['message']));});});};exports[_0x8403('0x25')]=function(_0x57e278){return new Promise(function(_0x557950,_0x546c9e){return db[_0x8403('0x1c')]['find']({'where':_0x57e278['options']?_0x57e278[_0x8403('0x1f')][_0x8403('0x21')]||null:null})[_0x8403('0x10')](function(_0xbfa8ee){if(_0xbfa8ee){return _0xbfa8ee[_0x8403('0x26')](_0x57e278[_0x8403('0x1e')][_0x8403('0x27')],_['omit'](_0x57e278[_0x8403('0x1e')],['ids','id'])||{});}})['spread'](function(_0x51a575){logger['info'](_0x8403('0x28'),_0x57e278);logger['debug'](_0x8403('0x28'),_0x57e278,JSON[_0x8403('0x15')](_0x51a575));_0x557950(_0x51a575);})['catch'](function(_0x14a890){logger[_0x8403('0x16')](_0x8403('0x28'),_0x14a890[_0x8403('0x18')],_0x57e278);_0x546c9e(_this[_0x8403('0x16')](0x1f4,_0x14a890[_0x8403('0x18')]));});});}; \ No newline at end of file +var _0x49f8=['ids','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','client','http','redis','socket.io-emitter','./faxInteraction.socket','register','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','UpdateFaxInteraction','body','options','where','attributes','limit','debug','FaxInteraction','find','addTags','omit'];(function(_0x490412,_0x552f6f){var _0x59ffd7=function(_0x23b2a0){while(--_0x23b2a0){_0x490412['push'](_0x490412['shift']());}};_0x59ffd7(++_0x552f6f);}(_0x49f8,0x150));var _0x849f=function(_0x5457b6,_0x169776){_0x5457b6=_0x5457b6-0x0;var _0x5be4f8=_0x49f8[_0x5457b6];return _0x5be4f8;};'use strict';var _=require(_0x849f('0x0'));var util=require(_0x849f('0x1'));var moment=require(_0x849f('0x2'));var BPromise=require(_0x849f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x849f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x849f('0x5'));var logger=require('../../config/logger')(_0x849f('0x6'));var config=require(_0x849f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x849f('0x8')][_0x849f('0x9')]({'port':0x232a});config[_0x849f('0xa')]=_['defaults'](config[_0x849f('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x849f('0xb'))(new Redis(config[_0x849f('0xa')]));require(_0x849f('0xc'))[_0x849f('0xd')](socket);function respondWithRpcPromise(_0x5ae53b,_0x2c0839,_0x49d1a3){return new BPromise(function(_0x2081e0,_0x217eb6){return client['request'](_0x5ae53b,_0x49d1a3)[_0x849f('0xe')](function(_0x3dafd0){logger[_0x849f('0xf')](_0x849f('0x10'),_0x2c0839,_0x849f('0x11'));logger['debug'](_0x849f('0x12'),_0x2c0839,'request\x20sent',JSON[_0x849f('0x13')](_0x3dafd0));if(_0x3dafd0['error']){if(_0x3dafd0[_0x849f('0x14')]['code']===0x1f4){logger[_0x849f('0x14')](_0x849f('0x10'),_0x2c0839,_0x3dafd0[_0x849f('0x14')][_0x849f('0x15')]);return _0x217eb6(_0x3dafd0[_0x849f('0x14')][_0x849f('0x15')]);}logger[_0x849f('0x14')](_0x849f('0x10'),_0x2c0839,_0x3dafd0[_0x849f('0x14')][_0x849f('0x15')]);return _0x2081e0(_0x3dafd0[_0x849f('0x14')]['message']);}else{logger['info']('FaxInteraction,\x20%s,\x20%s',_0x2c0839,'request\x20sent');_0x2081e0(_0x3dafd0['result'][_0x849f('0x15')]);}})[_0x849f('0x16')](function(_0x3c9c97){logger[_0x849f('0x14')](_0x849f('0x10'),_0x2c0839,_0x3c9c97);_0x217eb6(_0x3c9c97);});});}exports[_0x849f('0x17')]=function(_0x3f95a0){var _0x5abc81=this;return new Promise(function(_0x37a6ff,_0x2aac8a){return db['FaxInteraction']['update'](_0x3f95a0[_0x849f('0x18')],{'raw':_0x3f95a0['options']?_0x3f95a0[_0x849f('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f95a0[_0x849f('0x19')]?_0x3f95a0[_0x849f('0x19')][_0x849f('0x1a')]||null:null,'attributes':_0x3f95a0[_0x849f('0x19')]?_0x3f95a0['options'][_0x849f('0x1b')]||null:null,'limit':_0x3f95a0[_0x849f('0x19')]?_0x3f95a0[_0x849f('0x19')][_0x849f('0x1c')]||null:null})[_0x849f('0xe')](function(_0x36e5af){logger[_0x849f('0xf')](_0x849f('0x17'),_0x3f95a0);logger[_0x849f('0x1d')](_0x849f('0x17'),_0x3f95a0,JSON[_0x849f('0x13')](_0x36e5af));_0x37a6ff(_0x36e5af);})['catch'](function(_0x49419b){logger[_0x849f('0x14')](_0x849f('0x17'),_0x49419b[_0x849f('0x15')],_0x3f95a0);_0x2aac8a(_0x5abc81[_0x849f('0x14')](0x1f4,_0x49419b[_0x849f('0x15')]));});});};exports['AddTagsToFaxInteraction']=function(_0x3552d7){return new Promise(function(_0x8c1341,_0x500d0d){return db[_0x849f('0x1e')][_0x849f('0x1f')]({'where':_0x3552d7[_0x849f('0x19')]?_0x3552d7[_0x849f('0x19')][_0x849f('0x1a')]||null:null})[_0x849f('0xe')](function(_0x329bca){if(_0x329bca){return _0x329bca[_0x849f('0x20')](_0x3552d7[_0x849f('0x18')]['ids'],_[_0x849f('0x21')](_0x3552d7['body'],[_0x849f('0x22'),'id'])||{});}})[_0x849f('0x23')](function(_0x259108){logger[_0x849f('0xf')](_0x849f('0x24'),_0x3552d7);logger[_0x849f('0x1d')]('AddTags',_0x3552d7,JSON['stringify'](_0x259108));_0x8c1341(_0x259108);})[_0x849f('0x16')](function(_0x308770){logger['error'](_0x849f('0x24'),_0x308770['message'],_0x3552d7);_0x500d0d(_this['error'](0x1f4,_0x308770['message']));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 25fd922..7d43ca3 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 _0x87a5=['save','remove','update','emit','removeListener','register','length','faxInteraction:','./faxInteraction.events'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x87a5,0x13a));var _0x587a=function(_0x217ff6,_0x36f75d){_0x217ff6=_0x217ff6-0x0;var _0x417c93=_0x87a5[_0x217ff6];return _0x417c93;};'use strict';var FaxInteractionEvents=require(_0x587a('0x0'));var events=[_0x587a('0x1'),_0x587a('0x2'),_0x587a('0x3')];function createListener(_0xefb228,_0x40bb47){return function(_0x5f2de8){_0x40bb47[_0x587a('0x4')](_0xefb228,_0x5f2de8);};}function removeListener(_0x34290e,_0x2be63d){return function(){FaxInteractionEvents[_0x587a('0x5')](_0x34290e,_0x2be63d);};}exports[_0x587a('0x6')]=function(_0x3f87c5){for(var _0x12e3be=0x0,_0x268486=events[_0x587a('0x7')];_0x12e3be<_0x268486;_0x12e3be++){var _0x4f8bfe=events[_0x12e3be];var _0x4d5d84=createListener(_0x587a('0x8')+_0x4f8bfe,_0x3f87c5);FaxInteractionEvents['on'](_0x4f8bfe,_0x4d5d84);}}; \ No newline at end of file +var _0xbafb=['removeListener','register','length','faxInteraction:','save','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbafb,0x190));var _0xbbaf=function(_0x3d9cf4,_0x46ccdb){_0x3d9cf4=_0x3d9cf4-0x0;var _0x201508=_0xbafb[_0x3d9cf4];return _0x201508;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=[_0xbbaf('0x0'),'remove',_0xbbaf('0x1')];function createListener(_0x3e1dba,_0x31316f){return function(_0x5ee757){_0x31316f['emit'](_0x3e1dba,_0x5ee757);};}function removeListener(_0x487f73,_0xfe0ef2){return function(){FaxInteractionEvents[_0xbbaf('0x2')](_0x487f73,_0xfe0ef2);};}exports[_0xbbaf('0x3')]=function(_0x32b146){for(var _0x8bb0aa=0x0,_0x3bdcc9=events[_0xbbaf('0x4')];_0x8bb0aa<_0x3bdcc9;_0x8bb0aa++){var _0x2e3bbe=events[_0x8bb0aa];var _0x5265d0=createListener(_0xbbaf('0x5')+_0x2e3bbe,_0x32b146);FaxInteractionEvents['on'](_0x2e3bbe,_0x5265d0);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 57f4012..4134511 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 _0x7a34=['post','create','/:id/messages','addMessage','/:id/tags','fax','faxinteraction:addtags','addTags','put','tracked','faxinteraction:update','delete','faxinteraction:destroy','destroy','removeTags','exports','path','connect-timeout','Router','fs-extra','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','getMessages','/:id/download'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7a34,0xa6));var _0x47a3=function(_0x589025,_0x1252b5){_0x589025=_0x589025-0x0;var _0x29f628=_0x7a34[_0x589025];return _0x29f628;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x47a3('0x0'));var timeout=require(_0x47a3('0x1'));var express=require('express');var router=express[_0x47a3('0x2')]();var fs_extra=require(_0x47a3('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x47a3('0x4'));var controller=require('./faxInteraction.controller');router['get']('/',auth[_0x47a3('0x5')](),controller[_0x47a3('0x6')]);router[_0x47a3('0x7')](_0x47a3('0x8'),auth['isAuthenticated'](),controller[_0x47a3('0x9')]);router['get'](_0x47a3('0xa'),auth[_0x47a3('0x5')](),controller[_0x47a3('0xb')]);router[_0x47a3('0x7')]('/:id/messages',auth[_0x47a3('0x5')](),controller[_0x47a3('0xc')]);router['get'](_0x47a3('0xd'),auth[_0x47a3('0x5')](),controller['download']);router[_0x47a3('0xe')]('/',auth[_0x47a3('0x5')](),controller[_0x47a3('0xf')]);router[_0x47a3('0xe')](_0x47a3('0x10'),auth[_0x47a3('0x5')](),controller[_0x47a3('0x11')]);router[_0x47a3('0xe')](_0x47a3('0x12'),auth[_0x47a3('0x5')](),interaction['tracked'](_0x47a3('0x13'),_0x47a3('0x14')),controller[_0x47a3('0x15')]);router[_0x47a3('0x16')](_0x47a3('0xa'),auth['isAuthenticated'](),interaction[_0x47a3('0x17')](_0x47a3('0x13'),_0x47a3('0x18')),controller['update']);router[_0x47a3('0x19')](_0x47a3('0xa'),auth['isAuthenticated'](),interaction[_0x47a3('0x17')](_0x47a3('0x13'),_0x47a3('0x1a')),controller[_0x47a3('0x1b')]);router['delete']('/:id/tags',auth[_0x47a3('0x5')](),controller[_0x47a3('0x1c')]);module[_0x47a3('0x1d')]=router; \ No newline at end of file +var _0xdaba=['/:id','/:id/messages','/:id/download','download','post','addMessage','/:id/tags','fax','addTags','put','tracked','faxinteraction:update','update','faxinteraction:destroy','destroy','delete','removeTags','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','isAuthenticated','index','get','/describe','describe'];(function(_0x102789,_0x24217f){var _0x4aeb4f=function(_0x48bbcb){while(--_0x48bbcb){_0x102789['push'](_0x102789['shift']());}};_0x4aeb4f(++_0x24217f);}(_0xdaba,0x1d4));var _0xadab=function(_0x3d913d,_0x48a3b4){_0x3d913d=_0x3d913d-0x0;var _0x4e92de=_0xdaba[_0x3d913d];return _0x4e92de;};'use strict';var multer=require('multer');var util=require(_0xadab('0x0'));var path=require(_0xadab('0x1'));var timeout=require(_0xadab('0x2'));var express=require(_0xadab('0x3'));var router=express[_0xadab('0x4')]();var fs_extra=require(_0xadab('0x5'));var auth=require(_0xadab('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./faxInteraction.controller');router['get']('/',auth[_0xadab('0x7')](),controller[_0xadab('0x8')]);router[_0xadab('0x9')](_0xadab('0xa'),auth[_0xadab('0x7')](),controller[_0xadab('0xb')]);router[_0xadab('0x9')](_0xadab('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xadab('0x9')](_0xadab('0xd'),auth[_0xadab('0x7')](),controller['getMessages']);router[_0xadab('0x9')](_0xadab('0xe'),auth['isAuthenticated'](),controller[_0xadab('0xf')]);router[_0xadab('0x10')]('/',auth[_0xadab('0x7')](),controller['create']);router['post'](_0xadab('0xd'),auth['isAuthenticated'](),controller[_0xadab('0x11')]);router['post'](_0xadab('0x12'),auth[_0xadab('0x7')](),interaction['tracked'](_0xadab('0x13'),'faxinteraction:addtags'),controller[_0xadab('0x14')]);router[_0xadab('0x15')](_0xadab('0xc'),auth[_0xadab('0x7')](),interaction[_0xadab('0x16')](_0xadab('0x13'),_0xadab('0x17')),controller[_0xadab('0x18')]);router['delete'](_0xadab('0xc'),auth['isAuthenticated'](),interaction['tracked']('fax',_0xadab('0x19')),controller[_0xadab('0x1a')]);router[_0xadab('0x1b')]('/:id/tags',auth[_0xadab('0x7')](),controller[_0xadab('0x1c')]);module[_0xadab('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 cf9fc62..421e7ca 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 _0x54f3=['exports','TEXT','medium','BOOLEAN','ENUM','DATE'];(function(_0x31a16a,_0x1d60e3){var _0x21c892=function(_0x5b25f6){while(--_0x5b25f6){_0x31a16a['push'](_0x31a16a['shift']());}};_0x21c892(++_0x1d60e3);}(_0x54f3,0x120));var _0x354f=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x54f3[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require('sequelize');module[_0x354f('0x0')]={'body':{'type':Sequelize[_0x354f('0x1')](_0x354f('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x354f('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x354f('0x4')]('in','out'),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0x354f('0x1')],'defaultValue':null},'readAt':{'type':Sequelize[_0x354f('0x5')]}}; \ No newline at end of file +var _0xe57e=['out','DATE','sequelize','TEXT','medium','BOOLEAN'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe57e,0xf2));var _0xee57=function(_0x7f2414,_0x3f9fd5){_0x7f2414=_0x7f2414-0x0;var _0x37652c=_0xe57e[_0x7f2414];return _0x37652c;};'use strict';var Sequelize=require(_0xee57('0x0'));module['exports']={'body':{'type':Sequelize[_0xee57('0x1')](_0xee57('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xee57('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0xee57('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize[_0xee57('0x5')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 8c9bb29..87bab60 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 _0x442e=['rows','catch','show','keys','options','find','body','params','describe','fax-interactions','accept','fax','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','FaxInteraction','FaxInteractionId','isNil','read1stAt','interaction','role','null','acceptMessage','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','interface','channel','motionChannel','event','EventManager','acceptmessage','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','SIP/%s','create','CmContact','Attachment','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download','join','files','attachments','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','jayson/promise','client','request','then','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','update','destroy','stack','name','send','index','map','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','FaxMessage','includeAll','include','findAll'];(function(_0xbb14db,_0x3ee8c6){var _0x36bed7=function(_0x16c478){while(--_0x16c478){_0xbb14db['push'](_0xbb14db['shift']());}};_0x36bed7(++_0x3ee8c6);}(_0x442e,0x1ec));var _0xe442=function(_0x4a7e63,_0xca62b5){_0x4a7e63=_0x4a7e63-0x0;var _0x496ef3=_0x442e[_0x4a7e63];return _0x496ef3;};'use strict';var emlformat=require(_0xe442('0x0'));var rimraf=require(_0xe442('0x1'));var zipdir=require(_0xe442('0x2'));var jsonpatch=require(_0xe442('0x3'));var rp=require('request-promise');var moment=require(_0xe442('0x4'));var BPromise=require(_0xe442('0x5'));var Mustache=require(_0xe442('0x6'));var util=require('util');var path=require(_0xe442('0x7'));var sox=require(_0xe442('0x8'));var csv=require(_0xe442('0x9'));var ejs=require(_0xe442('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe442('0xb'));var squel=require(_0xe442('0xc'));var crypto=require(_0xe442('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xe442('0xe'));var toCsv=require('to-csv');var querystring=require(_0xe442('0xf'));var Papa=require(_0xe442('0x10'));var Redis=require(_0xe442('0x11'));var authService=require(_0xe442('0x12'));var qs=require(_0xe442('0x13'));var as=require(_0xe442('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe442('0x15'))(_0xe442('0x16'));var utils=require('../../config/utils');var config=require(_0xe442('0x17'));var licenseUtil=require(_0xe442('0x18'));var db=require(_0xe442('0x19'))['db'];config[_0xe442('0x1a')]=_[_0xe442('0x1b')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xe442('0x1c'))(new Redis(config[_0xe442('0x1a')]));require('./faxMessage.socket')[_0xe442('0x1d')](socket);var jayson=require(_0xe442('0x1e'));var client=jayson[_0xe442('0x1f')]['http']({'port':0x232c});var client9002=jayson[_0xe442('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0x49a62b,_0x3d71ad,_0x4f55f4,_0x2d74c3){return new BPromise(function(_0x1fd54c,_0x751a4a){var _0x5ab345=_0x2d74c3||client;return _0x5ab345[_0xe442('0x20')](_0x49a62b,_0x4f55f4)[_0xe442('0x21')](function(_0x25a28d){logger['info'](_0xe442('0x22'),_0x3d71ad,_0xe442('0x23'));logger[_0xe442('0x24')](_0xe442('0x25'),_0x3d71ad,_0xe442('0x23'),JSON[_0xe442('0x26')](_0x25a28d));if(_0x25a28d['error']){if(_0x25a28d[_0xe442('0x27')]['code']===0x1f4){logger[_0xe442('0x27')](_0xe442('0x22'),_0x3d71ad,_0x25a28d[_0xe442('0x27')][_0xe442('0x28')]);return _0x751a4a(_0x25a28d[_0xe442('0x27')][_0xe442('0x28')]);}logger[_0xe442('0x27')](_0xe442('0x22'),_0x3d71ad,_0x25a28d[_0xe442('0x27')][_0xe442('0x28')]);return _0x1fd54c(_0x25a28d[_0xe442('0x27')][_0xe442('0x28')]);}else{logger[_0xe442('0x29')]('FaxMessage,\x20%s,\x20%s',_0x3d71ad,_0xe442('0x23'));_0x1fd54c(_0x25a28d[_0xe442('0x2a')][_0xe442('0x28')]);}})['catch'](function(_0x2ea7c2){logger[_0xe442('0x27')](_0xe442('0x22'),_0x3d71ad,_0x2ea7c2);_0x751a4a(_0x2ea7c2);});});}function respondWithStatusCode(_0x17b637,_0x343155){_0x343155=_0x343155||0xcc;return function(_0x412828){if(_0x412828){return _0x17b637[_0xe442('0x2b')](_0x343155);}return _0x17b637[_0xe442('0x2c')](_0x343155)[_0xe442('0x2d')]();};}function respondWithResult(_0x43b275,_0x4e4f29){_0x4e4f29=_0x4e4f29||0xc8;return function(_0x1a4bbf){if(_0x1a4bbf){return _0x43b275[_0xe442('0x2c')](_0x4e4f29)[_0xe442('0x2e')](_0x1a4bbf);}};}function respondWithFilteredResult(_0x411265,_0x3441c9){return function(_0x1b7118){if(_0x1b7118){var _0x56692e=typeof _0x3441c9[_0xe442('0x2f')]===_0xe442('0x30')&&typeof _0x3441c9[_0xe442('0x31')]===_0xe442('0x30');var _0x229754=_0x1b7118[_0xe442('0x32')];var _0x300bce=_0x56692e?0x0:_0x3441c9[_0xe442('0x2f')];var _0x2755a9=_0x56692e?_0x1b7118[_0xe442('0x32')]:_0x3441c9[_0xe442('0x2f')]+_0x3441c9[_0xe442('0x31')];var _0x315b53;if(_0x2755a9>=_0x229754){_0x2755a9=_0x229754;_0x315b53=0xc8;}else{_0x315b53=0xce;}_0x411265['status'](_0x315b53);return _0x411265[_0xe442('0x33')]('Content-Range',_0x300bce+'-'+_0x2755a9+'/'+_0x229754)['json'](_0x1b7118);}return null;};}function patchUpdates(_0x345115){return function(_0x3d419a){try{jsonpatch[_0xe442('0x34')](_0x3d419a,_0x345115,!![]);}catch(_0x56c56d){return BPromise[_0xe442('0x35')](_0x56c56d);}return _0x3d419a['save']();};}function saveUpdates(_0x22a010,_0x47b6ac){return function(_0x4b5fa0){if(_0x4b5fa0){return _0x4b5fa0[_0xe442('0x36')](_0x22a010)[_0xe442('0x21')](function(_0x11d7f1){return _0x11d7f1;});}return null;};}function removeEntity(_0x464031,_0x4d3556){return function(_0x2bb61f){if(_0x2bb61f){return _0x2bb61f[_0xe442('0x37')]()[_0xe442('0x21')](function(){_0x464031[_0xe442('0x2c')](0xcc)[_0xe442('0x2d')]();});}};}function handleEntityNotFound(_0x10a520,_0x533b7c){return function(_0x57cde5){if(!_0x57cde5){_0x10a520['sendStatus'](0x194);}return _0x57cde5;};}function handleError(_0x2ceb53,_0x53e3c6){_0x53e3c6=_0x53e3c6||0x1f4;return function(_0x4ddd3b){logger[_0xe442('0x27')](_0x4ddd3b[_0xe442('0x38')]);if(_0x4ddd3b[_0xe442('0x39')]){delete _0x4ddd3b[_0xe442('0x39')];}_0x2ceb53[_0xe442('0x2c')](_0x53e3c6)[_0xe442('0x3a')](_0x4ddd3b);};}exports[_0xe442('0x3b')]=function(_0x413893,_0x39ef33){var _0x8f72ab={},_0x2e67fd={},_0x1ebfe2={'count':0x0,'rows':[]};var _0x20138f=_[_0xe442('0x3c')](db['FaxMessage']['rawAttributes'],function(_0x534e57){return{'name':_0x534e57[_0xe442('0x3d')],'type':_0x534e57[_0xe442('0x3e')][_0xe442('0x3f')]};});_0x2e67fd['model']=_[_0xe442('0x3c')](_0x20138f,_0xe442('0x39'));_0x2e67fd[_0xe442('0x40')]=_['keys'](_0x413893[_0xe442('0x40')]);_0x2e67fd[_0xe442('0x41')]=_[_0xe442('0x42')](_0x2e67fd[_0xe442('0x43')],_0x2e67fd[_0xe442('0x40')]);_0x8f72ab[_0xe442('0x44')]=_[_0xe442('0x42')](_0x2e67fd[_0xe442('0x43')],qs['fields'](_0x413893[_0xe442('0x40')][_0xe442('0x45')]));_0x8f72ab[_0xe442('0x44')]=_0x8f72ab[_0xe442('0x44')][_0xe442('0x46')]?_0x8f72ab[_0xe442('0x44')]:_0x2e67fd[_0xe442('0x43')];if(!_0x413893['query'][_0xe442('0x47')](_0xe442('0x48'))){_0x8f72ab[_0xe442('0x31')]=qs[_0xe442('0x31')](_0x413893[_0xe442('0x40')][_0xe442('0x31')]);_0x8f72ab[_0xe442('0x2f')]=qs[_0xe442('0x2f')](_0x413893[_0xe442('0x40')][_0xe442('0x2f')]);}_0x8f72ab[_0xe442('0x49')]=qs['sort'](_0x413893[_0xe442('0x40')][_0xe442('0x4a')]);_0x8f72ab[_0xe442('0x4b')]=qs['filters'](_[_0xe442('0x4c')](_0x413893['query'],_0x2e67fd[_0xe442('0x41')]),_0x20138f);if(_0x413893['query'][_0xe442('0x4d')]){_0x8f72ab[_0xe442('0x4b')]=_[_0xe442('0x4e')](_0x8f72ab[_0xe442('0x4b')],{'$or':_[_0xe442('0x3c')](_0x20138f,function(_0x4c738c){if(_0x4c738c[_0xe442('0x3e')]!==_0xe442('0x4f')){var _0x184831={};_0x184831[_0x4c738c[_0xe442('0x39')]]={'$like':'%'+_0x413893[_0xe442('0x40')][_0xe442('0x4d')]+'%'};return _0x184831;}})});}_0x8f72ab=_[_0xe442('0x4e')]({},_0x8f72ab,_0x413893['options']);var _0x583ef2={'where':_0x8f72ab[_0xe442('0x4b')]};return db[_0xe442('0x50')][_0xe442('0x32')](_0x583ef2)['then'](function(_0x553ff3){_0x1ebfe2['count']=_0x553ff3;if(_0x413893[_0xe442('0x40')][_0xe442('0x51')]){_0x8f72ab[_0xe442('0x52')]=[{'all':!![]}];}return db[_0xe442('0x50')][_0xe442('0x53')](_0x8f72ab);})[_0xe442('0x21')](function(_0x39e47d){_0x1ebfe2[_0xe442('0x54')]=_0x39e47d;return _0x1ebfe2;})[_0xe442('0x21')](respondWithFilteredResult(_0x39ef33,_0x8f72ab))[_0xe442('0x55')](handleError(_0x39ef33,null));};exports[_0xe442('0x56')]=function(_0x144097,_0x51fb25){var _0x7bb2e7={'raw':!![],'where':{'id':_0x144097['params']['id']}},_0x255e13={};_0x255e13[_0xe442('0x43')]=_[_0xe442('0x57')](db['FaxMessage']['rawAttributes']);_0x255e13[_0xe442('0x40')]=_[_0xe442('0x57')](_0x144097['query']);_0x255e13['filters']=_[_0xe442('0x42')](_0x255e13['model'],_0x255e13[_0xe442('0x40')]);_0x7bb2e7[_0xe442('0x44')]=_['intersection'](_0x255e13[_0xe442('0x43')],qs[_0xe442('0x45')](_0x144097['query'][_0xe442('0x45')]));_0x7bb2e7['attributes']=_0x7bb2e7[_0xe442('0x44')][_0xe442('0x46')]?_0x7bb2e7[_0xe442('0x44')]:_0x255e13[_0xe442('0x43')];if(_0x144097['query'][_0xe442('0x51')]){_0x7bb2e7['include']=[{'all':!![]}];}_0x7bb2e7=_['merge']({},_0x7bb2e7,_0x144097[_0xe442('0x58')]);return db[_0xe442('0x50')][_0xe442('0x59')](_0x7bb2e7)[_0xe442('0x21')](handleEntityNotFound(_0x51fb25,null))['then'](respondWithResult(_0x51fb25,null))[_0xe442('0x55')](handleError(_0x51fb25,null));};exports['update']=function(_0x2ec153,_0x1f2631){if(_0x2ec153[_0xe442('0x5a')]['id']){delete _0x2ec153[_0xe442('0x5a')]['id'];}return db[_0xe442('0x50')][_0xe442('0x59')]({'where':{'id':_0x2ec153[_0xe442('0x5b')]['id']}})[_0xe442('0x21')](handleEntityNotFound(_0x1f2631,null))[_0xe442('0x21')](saveUpdates(_0x2ec153[_0xe442('0x5a')],null))[_0xe442('0x21')](respondWithResult(_0x1f2631,null))[_0xe442('0x55')](handleError(_0x1f2631,null));};exports[_0xe442('0x37')]=function(_0x1f033f,_0x530161){return db[_0xe442('0x50')]['find']({'where':{'id':_0x1f033f[_0xe442('0x5b')]['id']}})['then'](handleEntityNotFound(_0x530161,null))['then'](removeEntity(_0x530161,null))[_0xe442('0x55')](handleError(_0x530161,null));};exports[_0xe442('0x5c')]=function(_0x4519b3,_0x30204f){return db[_0xe442('0x50')][_0xe442('0x5c')]()['then'](respondWithResult(_0x30204f,null))[_0xe442('0x55')](handleError(_0x30204f,null));};var interaction_log=require(_0xe442('0x15'))(_0xe442('0x5d'));exports[_0xe442('0x5e')]=function(_0x388359,_0x4f2400,_0x2874f3){var _0x474357={'agent':{},'channel':_0xe442('0x5f')};if(_0x388359[_0xe442('0x5a')]['id']){delete _0x388359[_0xe442('0x5a')]['id'];}_0x388359['body'][_0xe442('0x60')]=!![];_0x388359[_0xe442('0x5a')][_0xe442('0x61')]=moment()[_0xe442('0x62')](_0xe442('0x63'));_0x388359['body']['UserId']=_0x388359[_0xe442('0x5a')][_0xe442('0x64')]||_0x388359[_0xe442('0x65')]['id'];_0x474357[_0xe442('0x66')]['id']=_0x388359[_0xe442('0x5a')][_0xe442('0x64')];return db[_0xe442('0x50')][_0xe442('0x59')]({'where':{'id':_0x388359['params']['id'],'UserId':null}})[_0xe442('0x21')](handleEntityNotFound(_0x4f2400,null))[_0xe442('0x21')](saveUpdates(_0x388359[_0xe442('0x5a')],null))['then'](function(_0x3d5b4c){if(_0x3d5b4c){_0x474357['message']=_0x3d5b4c[_0xe442('0x67')]({'plain':!![]});return db[_0xe442('0x68')]['find']({'where':{'id':_0x3d5b4c[_0xe442('0x69')]}});}return null;})[_0xe442('0x21')](handleEntityNotFound(_0x4f2400,null))[_0xe442('0x21')](function(_0x387142){if(_0x387142){return _0x387142[_0xe442('0x36')]({'UserId':_0x388359[_0xe442('0x5a')][_0xe442('0x64')],'read1stAt':_[_0xe442('0x6a')](_0x387142[_0xe442('0x6b')])?moment()[_0xe442('0x62')](_0xe442('0x63')):undefined});}return null;})[_0xe442('0x21')](function(_0x2d0d3e){if(_0x2d0d3e){_0x474357[_0xe442('0x6c')]=_0x2d0d3e[_0xe442('0x67')]({'plain':!![]});interaction_log['info']('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x388359[_0xe442('0x65')]['id'],_0x388359[_0xe442('0x65')][_0xe442('0x39')],_0x388359[_0xe442('0x65')][_0xe442('0x6d')],_0x474357[_0xe442('0x6c')]['id'],_0x388359[_0xe442('0x5a')]?JSON['stringify'](_0x388359[_0xe442('0x5a')]):_0xe442('0x6e'));return respondWithRpcPromise('AcceptMessage',_0xe442('0x6f'),_0x474357);}return null;})[_0xe442('0x21')](function(_0x5c9736){var _0x1f8dcb='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5c9736[_0xe442('0x28')]['ContactId'];return db['sequelize'][_0xe442('0x40')](_0x1f8dcb,{'type':db[_0xe442('0x70')][_0xe442('0x71')][_0xe442('0x72')],'raw':!![]})[_0xe442('0x21')](function(_0x9e26df){return _0x9e26df;});})['then'](function(_0x212699){if(_0x212699){_0x474357[_0xe442('0x28')][_0xe442('0x73')]=_0x212699[0x0];if(!_0x388359['body']['UserId'])return;return db[_0xe442('0x74')][_0xe442('0x59')]({'where':{'id':_0x388359[_0xe442('0x5a')][_0xe442('0x64')],'role':'agent'},'attributes':['id',_0xe442('0x39'),_0xe442('0x75'),_0xe442('0x76'),_0xe442('0x77')],'raw':!![]});}return null;})[_0xe442('0x21')](function(_0x2fdcd9){if(!_0x2fdcd9)return null;_0x474357[_0xe442('0x28')][_0xe442('0x66')]=_0x2fdcd9;return _0x474357;})[_0xe442('0x21')](function(_0x22544f){if(_0x22544f){if(_0x388359[_0xe442('0x5a')]['manual']){_0x474357[_0xe442('0x28')][_0xe442('0x78')]=util[_0xe442('0x62')]('SIP/%s',_0x388359[_0xe442('0x65')][_0xe442('0x39')]);_0x474357[_0xe442('0x28')]['channel']=_0x474357[_0xe442('0x79')];_0x474357['message'][_0xe442('0x7a')]=_0x474357[_0xe442('0x79')];_0x474357[_0xe442('0x28')][_0xe442('0x7b')]=_0xe442('0x5e');return respondWithRpcPromise(_0xe442('0x7c'),_0xe442('0x7c'),{'event':_0xe442('0x7d'),'message':_0x474357[_0xe442('0x28')]},client9002)[_0xe442('0x21')](function(){return _0x474357;});}return _0x474357;}return null;})[_0xe442('0x21')](respondWithResult(_0x4f2400,null))['catch'](handleError(_0x4f2400,null));};var interaction_log=require(_0xe442('0x15'))('fax-interactions');exports['reject']=function(_0x3d0a05,_0x4a15d9,_0x53f4ab){var _0x2f7ffe={'agent':{},'channel':_0xe442('0x5f')};if(_0x3d0a05[_0xe442('0x5a')]['id']){delete _0x3d0a05[_0xe442('0x5a')]['id'];}_0x3d0a05['body'][_0xe442('0x64')]=_0x3d0a05['body'][_0xe442('0x64')]||_0x3d0a05[_0xe442('0x65')]['id'];_0x2f7ffe[_0xe442('0x66')]['id']=_0x3d0a05['body'][_0xe442('0x64')];return db[_0xe442('0x50')][_0xe442('0x59')]({'where':{'id':_0x3d0a05[_0xe442('0x5b')]['id'],'UserId':null}})[_0xe442('0x21')](handleEntityNotFound(_0x4a15d9,null))[_0xe442('0x21')](function(_0x3625ab){if(_0x3625ab){_0x2f7ffe[_0xe442('0x28')]=_0x3625ab[_0xe442('0x67')]({'plain':!![]});return db[_0xe442('0x68')][_0xe442('0x59')]({'where':{'id':_0x3625ab[_0xe442('0x69')]}});}return null;})[_0xe442('0x21')](handleEntityNotFound(_0x4a15d9,null))[_0xe442('0x21')](function(_0x231623){if(_0x231623){_0x2f7ffe[_0xe442('0x6c')]=_0x231623['get']({'plain':!![]});interaction_log[_0xe442('0x29')](_0xe442('0x7e'),_0x3d0a05[_0xe442('0x65')]['id'],_0x3d0a05[_0xe442('0x65')][_0xe442('0x39')],_0x3d0a05[_0xe442('0x65')][_0xe442('0x6d')],_0x2f7ffe[_0xe442('0x6c')]['id'],_0x3d0a05[_0xe442('0x5a')]?JSON[_0xe442('0x26')](_0x3d0a05[_0xe442('0x5a')]):_0xe442('0x6e'));return respondWithRpcPromise('RejectMessage',_0xe442('0x7f'),_0x2f7ffe);}return null;})['then'](function(_0xc8a0d1){var _0x2fb385=_0xe442('0x80')+_0xc8a0d1[_0xe442('0x28')][_0xe442('0x81')];return db[_0xe442('0x82')][_0xe442('0x40')](_0x2fb385,{'type':db[_0xe442('0x70')][_0xe442('0x71')]['SELECT'],'raw':!![]})[_0xe442('0x21')](function(_0x4fd867){return _0x4fd867;});})['then'](function(_0xa53e40){if(_0xa53e40){_0x2f7ffe['message'][_0xe442('0x73')]=_0xa53e40[0x0];if(!_0x3d0a05[_0xe442('0x5a')][_0xe442('0x64')])return;return db[_0xe442('0x74')]['find']({'where':{'id':_0x3d0a05[_0xe442('0x5a')]['UserId'],'role':_0xe442('0x66')},'attributes':['id','name','fullname','email','internal'],'raw':!![]});}return null;})[_0xe442('0x21')](function(_0x2188fc){if(!_0x2188fc)return null;_0x2f7ffe[_0xe442('0x28')]['agent']=_0x2188fc;return _0x2f7ffe;})[_0xe442('0x21')](function(_0x192c6e){if(_0x192c6e){_0x192c6e['message'][_0xe442('0x78')]=util[_0xe442('0x62')](_0xe442('0x83'),_0x3d0a05['user'][_0xe442('0x39')]);_0x192c6e[_0xe442('0x28')][_0xe442('0x79')]=_0x2f7ffe[_0xe442('0x79')];_0x192c6e[_0xe442('0x28')][_0xe442('0x7a')]=_0x2f7ffe['channel'];_0x192c6e['message'][_0xe442('0x7b')]=_0xe442('0x35');respondWithRpcPromise(_0xe442('0x7c'),'EventManager',{'event':'rejectmessage','message':_0x192c6e[_0xe442('0x28')]},client9002);return _0x2f7ffe;}return null;})['then'](respondWithResult(_0x4a15d9,null))[_0xe442('0x55')](handleError(_0x4a15d9,null));};exports[_0xe442('0x84')]=function(_0x1f401b,_0x11364b){var _0xdfd479;return db[_0xe442('0x50')][_0xe442('0x84')](_0x1f401b['body'],{})[_0xe442('0x21')](function(_0x568ffa){_0xdfd479=_0x568ffa;return db[_0xe442('0x85')]['findOne']({'where':{'id':_0xdfd479[_0xe442('0x81')]}});})['then'](function(_0x3ec703){if(_[_0xe442('0x6a')](_0x3ec703)){return;}else{_0xdfd479[_0xe442('0x5f')]=_0x3ec703[_0xe442('0x5f')];return db[_0xe442('0x86')]['findOne']({'where':{'id':_0xdfd479[_0xe442('0x87')]}});}})[_0xe442('0x21')](function(_0x38d4d4){return respondWithRpcPromise(_0xe442('0x88'),_0xe442('0x88'),{'FaxAccountId':_['isNil'](_0x1f401b[_0xe442('0x5a')])?undefined:_0x1f401b[_0xe442('0x5a')][_0xe442('0x89')],'path':_[_0xe442('0x6a')](_0x38d4d4)?undefined:util[_0xe442('0x62')](_0xe442('0x8a'),_0x38d4d4[_0xe442('0x8b')]),'fax':_[_0xe442('0x6a')](_0xdfd479[_0xe442('0x5f')])?undefined:_0xdfd479[_0xe442('0x5f')],'AttachmentId':_0xdfd479[_0xe442('0x87')]},client9002);})[_0xe442('0x21')](respondWithResult(_0x11364b,0xc9))['catch'](handleError(_0x11364b,null));};exports[_0xe442('0x8c')]=function(_0x21a167,_0x500a2d){var _0x22bcad=path[_0xe442('0x8d')](config['root'],'server',_0xe442('0x8e'),_0xe442('0x8f'));return db['FaxMessage'][_0xe442('0x59')]({'where':{'id':_0x21a167[_0xe442('0x5b')]['id']},'include':[{'model':db['Attachment'],'as':'Attachment'}]})[_0xe442('0x21')](handleEntityNotFound(_0x500a2d,null))['then'](function(_0x3374e6){if(_0x3374e6){return _0x500a2d['download'](path['join'](_0x22bcad,_0x3374e6[_0xe442('0x86')][_0xe442('0x8b')]));}})['catch'](handleError(_0x500a2d,null));}; \ No newline at end of file +var _0x6136=['squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./faxMessage.socket','register','jayson/promise','http','client','request','info','request\x20sent','debug','stringify','error','code','message','FaxMessage,\x20%s,\x20%s','result','catch','sendStatus','status','end','json','offset','undefined','limit','set','apply','reject','save','then','destroy','stack','name','send','index','map','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','FaxMessage','count','findAll','rows','show','params','includeAll','include','find','update','body','fax-interactions','accept','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','FaxInteraction','FaxInteractionId','isNil','read1stAt','get','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','interaction','null','AcceptMessage','ContactId','Sequelize','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','SELECT','motionChannel','rejectmessage','create','CmContact','findOne','fax','Attachment','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','AttachmentId','join','root','server','files','attachments','basename','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x867b0a,_0x587ccf){var _0x137438=function(_0xbeafa6){while(--_0xbeafa6){_0x867b0a['push'](_0x867b0a['shift']());}};_0x137438(++_0x587ccf);}(_0x6136,0x11a));var _0x6613=function(_0x197766,_0xa459b7){_0x197766=_0x197766-0x0;var _0xb939f=_0x6136[_0x197766];return _0xb939f;};'use strict';var emlformat=require(_0x6613('0x0'));var rimraf=require(_0x6613('0x1'));var zipdir=require(_0x6613('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6613('0x3'));var moment=require(_0x6613('0x4'));var BPromise=require(_0x6613('0x5'));var Mustache=require(_0x6613('0x6'));var util=require(_0x6613('0x7'));var path=require(_0x6613('0x8'));var sox=require(_0x6613('0x9'));var csv=require(_0x6613('0xa'));var ejs=require(_0x6613('0xb'));var fs=require('fs');var fs_extra=require(_0x6613('0xc'));var _=require(_0x6613('0xd'));var squel=require(_0x6613('0xe'));var crypto=require('crypto');var jsforce=require(_0x6613('0xf'));var deskjs=require(_0x6613('0x10'));var toCsv=require(_0x6613('0xa'));var querystring=require(_0x6613('0x11'));var Papa=require('papaparse');var Redis=require(_0x6613('0x12'));var authService=require(_0x6613('0x13'));var qs=require(_0x6613('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6613('0x15'));var logger=require(_0x6613('0x16'))(_0x6613('0x17'));var utils=require('../../config/utils');var config=require(_0x6613('0x18'));var licenseUtil=require(_0x6613('0x19'));var db=require(_0x6613('0x1a'))['db'];config['redis']=_[_0x6613('0x1b')](config[_0x6613('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0x6613('0x1d'))(new Redis(config[_0x6613('0x1c')]));require(_0x6613('0x1e'))[_0x6613('0x1f')](socket);var jayson=require(_0x6613('0x20'));var client=jayson['client'][_0x6613('0x21')]({'port':0x232c});var client9002=jayson[_0x6613('0x22')][_0x6613('0x21')]({'port':0x232a});function respondWithRpcPromise(_0xe0f5ed,_0x323791,_0x4a8e79,_0x4f9ca4){return new BPromise(function(_0x8eb469,_0x309c97){var _0x580465=_0x4f9ca4||client;return _0x580465[_0x6613('0x23')](_0xe0f5ed,_0x4a8e79)['then'](function(_0x541217){logger[_0x6613('0x24')]('FaxMessage,\x20%s,\x20%s',_0x323791,_0x6613('0x25'));logger[_0x6613('0x26')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x323791,_0x6613('0x25'),JSON[_0x6613('0x27')](_0x541217));if(_0x541217[_0x6613('0x28')]){if(_0x541217[_0x6613('0x28')][_0x6613('0x29')]===0x1f4){logger[_0x6613('0x28')]('FaxMessage,\x20%s,\x20%s',_0x323791,_0x541217[_0x6613('0x28')][_0x6613('0x2a')]);return _0x309c97(_0x541217[_0x6613('0x28')][_0x6613('0x2a')]);}logger[_0x6613('0x28')](_0x6613('0x2b'),_0x323791,_0x541217[_0x6613('0x28')][_0x6613('0x2a')]);return _0x8eb469(_0x541217['error'][_0x6613('0x2a')]);}else{logger[_0x6613('0x24')]('FaxMessage,\x20%s,\x20%s',_0x323791,_0x6613('0x25'));_0x8eb469(_0x541217[_0x6613('0x2c')][_0x6613('0x2a')]);}})[_0x6613('0x2d')](function(_0x38997f){logger[_0x6613('0x28')](_0x6613('0x2b'),_0x323791,_0x38997f);_0x309c97(_0x38997f);});});}function respondWithStatusCode(_0x4a33e5,_0x34e2ce){_0x34e2ce=_0x34e2ce||0xcc;return function(_0x397161){if(_0x397161){return _0x4a33e5[_0x6613('0x2e')](_0x34e2ce);}return _0x4a33e5[_0x6613('0x2f')](_0x34e2ce)[_0x6613('0x30')]();};}function respondWithResult(_0x1af562,_0x9bd62e){_0x9bd62e=_0x9bd62e||0xc8;return function(_0x27ed49){if(_0x27ed49){return _0x1af562[_0x6613('0x2f')](_0x9bd62e)[_0x6613('0x31')](_0x27ed49);}};}function respondWithFilteredResult(_0x43dc98,_0x4634ac){return function(_0x28f910){if(_0x28f910){var _0x36e22c=typeof _0x4634ac[_0x6613('0x32')]===_0x6613('0x33')&&typeof _0x4634ac[_0x6613('0x34')]===_0x6613('0x33');var _0x1fe84b=_0x28f910['count'];var _0x3807c3=_0x36e22c?0x0:_0x4634ac['offset'];var _0x78ca11=_0x36e22c?_0x28f910['count']:_0x4634ac['offset']+_0x4634ac[_0x6613('0x34')];var _0x3499ee;if(_0x78ca11>=_0x1fe84b){_0x78ca11=_0x1fe84b;_0x3499ee=0xc8;}else{_0x3499ee=0xce;}_0x43dc98['status'](_0x3499ee);return _0x43dc98[_0x6613('0x35')]('Content-Range',_0x3807c3+'-'+_0x78ca11+'/'+_0x1fe84b)['json'](_0x28f910);}return null;};}function patchUpdates(_0x3c9af9){return function(_0x4721ca){try{jsonpatch[_0x6613('0x36')](_0x4721ca,_0x3c9af9,!![]);}catch(_0x4d72f5){return BPromise[_0x6613('0x37')](_0x4d72f5);}return _0x4721ca[_0x6613('0x38')]();};}function saveUpdates(_0xade70a,_0xdd9080){return function(_0x1207f0){if(_0x1207f0){return _0x1207f0['update'](_0xade70a)[_0x6613('0x39')](function(_0x492214){return _0x492214;});}return null;};}function removeEntity(_0x592f14,_0x5d9665){return function(_0xecdfcb){if(_0xecdfcb){return _0xecdfcb[_0x6613('0x3a')]()['then'](function(){_0x592f14[_0x6613('0x2f')](0xcc)[_0x6613('0x30')]();});}};}function handleEntityNotFound(_0x5c9b77,_0x3fd72b){return function(_0x4bf471){if(!_0x4bf471){_0x5c9b77[_0x6613('0x2e')](0x194);}return _0x4bf471;};}function handleError(_0x174892,_0x2a5fa6){_0x2a5fa6=_0x2a5fa6||0x1f4;return function(_0x1c77a5){logger['error'](_0x1c77a5[_0x6613('0x3b')]);if(_0x1c77a5['name']){delete _0x1c77a5[_0x6613('0x3c')];}_0x174892['status'](_0x2a5fa6)[_0x6613('0x3d')](_0x1c77a5);};}exports[_0x6613('0x3e')]=function(_0x2f9d24,_0x15b2ed){var _0x3b0252={},_0x3420e4={},_0x480b14={'count':0x0,'rows':[]};var _0x4a08c3=_[_0x6613('0x3f')](db['FaxMessage'][_0x6613('0x40')],function(_0x431629){return{'name':_0x431629['fieldName'],'type':_0x431629[_0x6613('0x41')]['key']};});_0x3420e4[_0x6613('0x42')]=_[_0x6613('0x3f')](_0x4a08c3,_0x6613('0x3c'));_0x3420e4[_0x6613('0x43')]=_[_0x6613('0x44')](_0x2f9d24[_0x6613('0x43')]);_0x3420e4['filters']=_[_0x6613('0x45')](_0x3420e4[_0x6613('0x42')],_0x3420e4['query']);_0x3b0252[_0x6613('0x46')]=_[_0x6613('0x45')](_0x3420e4[_0x6613('0x42')],qs[_0x6613('0x47')](_0x2f9d24[_0x6613('0x43')][_0x6613('0x47')]));_0x3b0252[_0x6613('0x46')]=_0x3b0252[_0x6613('0x46')][_0x6613('0x48')]?_0x3b0252['attributes']:_0x3420e4[_0x6613('0x42')];if(!_0x2f9d24[_0x6613('0x43')][_0x6613('0x49')](_0x6613('0x4a'))){_0x3b0252[_0x6613('0x34')]=qs[_0x6613('0x34')](_0x2f9d24[_0x6613('0x43')][_0x6613('0x34')]);_0x3b0252[_0x6613('0x32')]=qs[_0x6613('0x32')](_0x2f9d24[_0x6613('0x43')]['offset']);}_0x3b0252[_0x6613('0x4b')]=qs[_0x6613('0x4c')](_0x2f9d24[_0x6613('0x43')]['sort']);_0x3b0252[_0x6613('0x4d')]=qs['filters'](_[_0x6613('0x4e')](_0x2f9d24[_0x6613('0x43')],_0x3420e4[_0x6613('0x4f')]),_0x4a08c3);if(_0x2f9d24[_0x6613('0x43')][_0x6613('0x50')]){_0x3b0252[_0x6613('0x4d')]=_[_0x6613('0x51')](_0x3b0252[_0x6613('0x4d')],{'$or':_[_0x6613('0x3f')](_0x4a08c3,function(_0x22e30f){if(_0x22e30f[_0x6613('0x41')]!==_0x6613('0x52')){var _0x111856={};_0x111856[_0x22e30f[_0x6613('0x3c')]]={'$like':'%'+_0x2f9d24['query']['filter']+'%'};return _0x111856;}})});}_0x3b0252=_[_0x6613('0x51')]({},_0x3b0252,_0x2f9d24['options']);var _0x125095={'where':_0x3b0252[_0x6613('0x4d')]};return db[_0x6613('0x53')]['count'](_0x125095)['then'](function(_0x38cdca){_0x480b14[_0x6613('0x54')]=_0x38cdca;if(_0x2f9d24[_0x6613('0x43')]['includeAll']){_0x3b0252['include']=[{'all':!![]}];}return db[_0x6613('0x53')][_0x6613('0x55')](_0x3b0252);})['then'](function(_0x1e7732){_0x480b14[_0x6613('0x56')]=_0x1e7732;return _0x480b14;})[_0x6613('0x39')](respondWithFilteredResult(_0x15b2ed,_0x3b0252))['catch'](handleError(_0x15b2ed,null));};exports[_0x6613('0x57')]=function(_0x30b7bf,_0x5a64e9){var _0x54349b={'raw':!![],'where':{'id':_0x30b7bf[_0x6613('0x58')]['id']}},_0x5e9ef5={};_0x5e9ef5['model']=_[_0x6613('0x44')](db[_0x6613('0x53')][_0x6613('0x40')]);_0x5e9ef5[_0x6613('0x43')]=_[_0x6613('0x44')](_0x30b7bf[_0x6613('0x43')]);_0x5e9ef5[_0x6613('0x4f')]=_[_0x6613('0x45')](_0x5e9ef5['model'],_0x5e9ef5['query']);_0x54349b['attributes']=_[_0x6613('0x45')](_0x5e9ef5['model'],qs[_0x6613('0x47')](_0x30b7bf[_0x6613('0x43')][_0x6613('0x47')]));_0x54349b['attributes']=_0x54349b[_0x6613('0x46')]['length']?_0x54349b[_0x6613('0x46')]:_0x5e9ef5[_0x6613('0x42')];if(_0x30b7bf[_0x6613('0x43')][_0x6613('0x59')]){_0x54349b[_0x6613('0x5a')]=[{'all':!![]}];}_0x54349b=_[_0x6613('0x51')]({},_0x54349b,_0x30b7bf['options']);return db[_0x6613('0x53')][_0x6613('0x5b')](_0x54349b)['then'](handleEntityNotFound(_0x5a64e9,null))[_0x6613('0x39')](respondWithResult(_0x5a64e9,null))[_0x6613('0x2d')](handleError(_0x5a64e9,null));};exports[_0x6613('0x5c')]=function(_0x5674e7,_0x590cde){if(_0x5674e7[_0x6613('0x5d')]['id']){delete _0x5674e7[_0x6613('0x5d')]['id'];}return db[_0x6613('0x53')][_0x6613('0x5b')]({'where':{'id':_0x5674e7[_0x6613('0x58')]['id']}})['then'](handleEntityNotFound(_0x590cde,null))['then'](saveUpdates(_0x5674e7[_0x6613('0x5d')],null))[_0x6613('0x39')](respondWithResult(_0x590cde,null))['catch'](handleError(_0x590cde,null));};exports[_0x6613('0x3a')]=function(_0x3a968c,_0x57b690){return db[_0x6613('0x53')]['find']({'where':{'id':_0x3a968c[_0x6613('0x58')]['id']}})[_0x6613('0x39')](handleEntityNotFound(_0x57b690,null))['then'](removeEntity(_0x57b690,null))['catch'](handleError(_0x57b690,null));};exports['describe']=function(_0x4928b7,_0x4aa09e){return db['FaxMessage']['describe']()['then'](respondWithResult(_0x4aa09e,null))['catch'](handleError(_0x4aa09e,null));};var interaction_log=require(_0x6613('0x16'))(_0x6613('0x5e'));exports[_0x6613('0x5f')]=function(_0x42cd3d,_0x1bf010,_0x82e7e9){var _0x4dda79={'agent':{},'channel':'fax'};if(_0x42cd3d[_0x6613('0x5d')]['id']){delete _0x42cd3d[_0x6613('0x5d')]['id'];}_0x42cd3d['body']['read']=!![];_0x42cd3d['body']['readAt']=moment()[_0x6613('0x60')](_0x6613('0x61'));_0x42cd3d[_0x6613('0x5d')][_0x6613('0x62')]=_0x42cd3d[_0x6613('0x5d')][_0x6613('0x62')]||_0x42cd3d['user']['id'];_0x4dda79[_0x6613('0x63')]['id']=_0x42cd3d[_0x6613('0x5d')][_0x6613('0x62')];return db[_0x6613('0x53')][_0x6613('0x5b')]({'where':{'id':_0x42cd3d[_0x6613('0x58')]['id'],'UserId':null}})[_0x6613('0x39')](handleEntityNotFound(_0x1bf010,null))[_0x6613('0x39')](saveUpdates(_0x42cd3d[_0x6613('0x5d')],null))['then'](function(_0x23495a){if(_0x23495a){_0x4dda79[_0x6613('0x2a')]=_0x23495a['get']({'plain':!![]});return db[_0x6613('0x64')][_0x6613('0x5b')]({'where':{'id':_0x23495a[_0x6613('0x65')]}});}return null;})[_0x6613('0x39')](handleEntityNotFound(_0x1bf010,null))[_0x6613('0x39')](function(_0x1d4723){if(_0x1d4723){return _0x1d4723[_0x6613('0x5c')]({'UserId':_0x42cd3d['body'][_0x6613('0x62')],'read1stAt':_[_0x6613('0x66')](_0x1d4723[_0x6613('0x67')])?moment()[_0x6613('0x60')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x6613('0x39')](function(_0x2903c4){if(_0x2903c4){_0x4dda79['interaction']=_0x2903c4[_0x6613('0x68')]({'plain':!![]});interaction_log['info'](_0x6613('0x69'),_0x42cd3d[_0x6613('0x6a')]['id'],_0x42cd3d['user'][_0x6613('0x3c')],_0x42cd3d['user'][_0x6613('0x6b')],_0x4dda79[_0x6613('0x6c')]['id'],_0x42cd3d[_0x6613('0x5d')]?JSON[_0x6613('0x27')](_0x42cd3d[_0x6613('0x5d')]):_0x6613('0x6d'));return respondWithRpcPromise(_0x6613('0x6e'),'acceptMessage',_0x4dda79);}return null;})[_0x6613('0x39')](function(_0x187a24){var _0x316197='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x187a24[_0x6613('0x2a')][_0x6613('0x6f')];return db['sequelize']['query'](_0x316197,{'type':db[_0x6613('0x70')]['QueryTypes']['SELECT'],'raw':!![]})[_0x6613('0x39')](function(_0x106e9a){return _0x106e9a;});})[_0x6613('0x39')](function(_0x48d885){if(_0x48d885){_0x4dda79['message'][_0x6613('0x71')]=_0x48d885[0x0];if(!_0x42cd3d['body']['UserId'])return;return db[_0x6613('0x72')][_0x6613('0x5b')]({'where':{'id':_0x42cd3d[_0x6613('0x5d')][_0x6613('0x62')],'role':'agent'},'attributes':['id',_0x6613('0x3c'),_0x6613('0x73'),_0x6613('0x74'),_0x6613('0x75')],'raw':!![]});}return null;})[_0x6613('0x39')](function(_0x493530){if(!_0x493530)return null;_0x4dda79[_0x6613('0x2a')][_0x6613('0x63')]=_0x493530;return _0x4dda79;})[_0x6613('0x39')](function(_0x2022ad){if(_0x2022ad){if(_0x42cd3d[_0x6613('0x5d')][_0x6613('0x76')]){_0x4dda79[_0x6613('0x2a')][_0x6613('0x77')]=util['format'](_0x6613('0x78'),_0x42cd3d[_0x6613('0x6a')][_0x6613('0x3c')]);_0x4dda79[_0x6613('0x2a')][_0x6613('0x79')]=_0x4dda79[_0x6613('0x79')];_0x4dda79[_0x6613('0x2a')]['motionChannel']=_0x4dda79['channel'];_0x4dda79['message'][_0x6613('0x7a')]=_0x6613('0x5f');return respondWithRpcPromise('EventManager',_0x6613('0x7b'),{'event':_0x6613('0x7c'),'message':_0x4dda79[_0x6613('0x2a')]},client9002)[_0x6613('0x39')](function(){return _0x4dda79;});}return _0x4dda79;}return null;})[_0x6613('0x39')](respondWithResult(_0x1bf010,null))[_0x6613('0x2d')](handleError(_0x1bf010,null));};var interaction_log=require(_0x6613('0x16'))(_0x6613('0x5e'));exports[_0x6613('0x37')]=function(_0xe528aa,_0x1da05b,_0x25b7bf){var _0x1f0a9a={'agent':{},'channel':'fax'};if(_0xe528aa[_0x6613('0x5d')]['id']){delete _0xe528aa['body']['id'];}_0xe528aa[_0x6613('0x5d')][_0x6613('0x62')]=_0xe528aa[_0x6613('0x5d')]['UserId']||_0xe528aa[_0x6613('0x6a')]['id'];_0x1f0a9a[_0x6613('0x63')]['id']=_0xe528aa[_0x6613('0x5d')][_0x6613('0x62')];return db['FaxMessage'][_0x6613('0x5b')]({'where':{'id':_0xe528aa[_0x6613('0x58')]['id'],'UserId':null}})[_0x6613('0x39')](handleEntityNotFound(_0x1da05b,null))[_0x6613('0x39')](function(_0x35cc1c){if(_0x35cc1c){_0x1f0a9a[_0x6613('0x2a')]=_0x35cc1c['get']({'plain':!![]});return db[_0x6613('0x64')][_0x6613('0x5b')]({'where':{'id':_0x35cc1c['FaxInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x1da05b,null))[_0x6613('0x39')](function(_0x43e339){if(_0x43e339){_0x1f0a9a['interaction']=_0x43e339[_0x6613('0x68')]({'plain':!![]});interaction_log[_0x6613('0x24')](_0x6613('0x7d'),_0xe528aa['user']['id'],_0xe528aa[_0x6613('0x6a')][_0x6613('0x3c')],_0xe528aa[_0x6613('0x6a')]['role'],_0x1f0a9a[_0x6613('0x6c')]['id'],_0xe528aa[_0x6613('0x5d')]?JSON[_0x6613('0x27')](_0xe528aa[_0x6613('0x5d')]):_0x6613('0x6d'));return respondWithRpcPromise(_0x6613('0x7e'),_0x6613('0x7f'),_0x1f0a9a);}return null;})[_0x6613('0x39')](function(_0x547ca0){var _0x79a30d=_0x6613('0x80')+_0x547ca0[_0x6613('0x2a')]['ContactId'];return db[_0x6613('0x81')]['query'](_0x79a30d,{'type':db[_0x6613('0x70')]['QueryTypes'][_0x6613('0x82')],'raw':!![]})[_0x6613('0x39')](function(_0x3d313c){return _0x3d313c;});})[_0x6613('0x39')](function(_0x5760a1){if(_0x5760a1){_0x1f0a9a['message']['contact']=_0x5760a1[0x0];if(!_0xe528aa[_0x6613('0x5d')][_0x6613('0x62')])return;return db[_0x6613('0x72')][_0x6613('0x5b')]({'where':{'id':_0xe528aa[_0x6613('0x5d')][_0x6613('0x62')],'role':_0x6613('0x63')},'attributes':['id','name',_0x6613('0x73'),_0x6613('0x74'),_0x6613('0x75')],'raw':!![]});}return null;})['then'](function(_0x1a0c79){if(!_0x1a0c79)return null;_0x1f0a9a['message'][_0x6613('0x63')]=_0x1a0c79;return _0x1f0a9a;})[_0x6613('0x39')](function(_0x5cd6e5){if(_0x5cd6e5){_0x5cd6e5[_0x6613('0x2a')][_0x6613('0x77')]=util[_0x6613('0x60')]('SIP/%s',_0xe528aa[_0x6613('0x6a')][_0x6613('0x3c')]);_0x5cd6e5[_0x6613('0x2a')][_0x6613('0x79')]=_0x1f0a9a[_0x6613('0x79')];_0x5cd6e5[_0x6613('0x2a')][_0x6613('0x83')]=_0x1f0a9a[_0x6613('0x79')];_0x5cd6e5[_0x6613('0x2a')][_0x6613('0x7a')]=_0x6613('0x37');respondWithRpcPromise('EventManager',_0x6613('0x7b'),{'event':_0x6613('0x84'),'message':_0x5cd6e5[_0x6613('0x2a')]},client9002);return _0x1f0a9a;}return null;})['then'](respondWithResult(_0x1da05b,null))['catch'](handleError(_0x1da05b,null));};exports[_0x6613('0x85')]=function(_0x23b662,_0x1b9a79){var _0x49e4b7;return db[_0x6613('0x53')]['create'](_0x23b662[_0x6613('0x5d')],{})['then'](function(_0x15a7fc){_0x49e4b7=_0x15a7fc;return db[_0x6613('0x86')][_0x6613('0x87')]({'where':{'id':_0x49e4b7[_0x6613('0x6f')]}});})[_0x6613('0x39')](function(_0x56fe08){if(_['isNil'](_0x56fe08)){return;}else{_0x49e4b7[_0x6613('0x88')]=_0x56fe08['fax'];return db[_0x6613('0x89')][_0x6613('0x87')]({'where':{'id':_0x49e4b7['AttachmentId']}});}})['then'](function(_0x4d2fa5){return respondWithRpcPromise(_0x6613('0x8a'),_0x6613('0x8a'),{'FaxAccountId':_[_0x6613('0x66')](_0x23b662[_0x6613('0x5d')])?undefined:_0x23b662['body'][_0x6613('0x8b')],'path':_[_0x6613('0x66')](_0x4d2fa5)?undefined:util[_0x6613('0x60')](_0x6613('0x8c'),_0x4d2fa5['basename']),'fax':_[_0x6613('0x66')](_0x49e4b7['fax'])?undefined:_0x49e4b7[_0x6613('0x88')],'AttachmentId':_0x49e4b7[_0x6613('0x8d')]},client9002);})[_0x6613('0x39')](respondWithResult(_0x1b9a79,0xc9))[_0x6613('0x2d')](handleError(_0x1b9a79,null));};exports['download']=function(_0x2999c7,_0x369aa4){var _0x2c8d2a=path[_0x6613('0x8e')](config[_0x6613('0x8f')],_0x6613('0x90'),_0x6613('0x91'),_0x6613('0x92'));return db[_0x6613('0x53')]['find']({'where':{'id':_0x2999c7[_0x6613('0x58')]['id']},'include':[{'model':db['Attachment'],'as':_0x6613('0x89')}]})[_0x6613('0x39')](handleEntityNotFound(_0x369aa4,null))[_0x6613('0x39')](function(_0x354567){if(_0x354567){return _0x369aa4['download'](path[_0x6613('0x8e')](_0x2c8d2a,_0x354567[_0x6613('0x89')][_0x6613('0x93')]));}})[_0x6613('0x2d')](handleError(_0x369aa4,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index c9a153e..61d8d19 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 _0x6f44=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0x6f44,0x1ea));var _0x46f4=function(_0x28d178,_0x51bb33){_0x28d178=_0x28d178-0x0;var _0x1c5120=_0x6f44[_0x28d178];return _0x1c5120;};'use strict';var EventEmitter=require(_0x46f4('0x0'));var FaxMessage=require(_0x46f4('0x1'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x46f4('0x2')](0x0);var events={'afterCreate':_0x46f4('0x3'),'afterUpdate':_0x46f4('0x4'),'afterDestroy':_0x46f4('0x5')};function emitEvent(_0x4099a9){return function(_0x1e2554,_0x26f749,_0x200f8b){FaxMessageEvents[_0x46f4('0x6')](_0x4099a9+':'+_0x1e2554['id'],_0x1e2554);FaxMessageEvents['emit'](_0x4099a9,_0x1e2554);_0x200f8b(null);};}for(var e in events){if(events[_0x46f4('0x7')](e)){var event=events[e];FaxMessage[_0x46f4('0x8')](e,emitEvent(event));}}module[_0x46f4('0x9')]=FaxMessageEvents; \ No newline at end of file +var _0xa017=['exports','events','../../mysqldb','FaxMessage','update','remove','emit','hook'];(function(_0x1368cb,_0x39ec61){var _0xffca30=function(_0x55a8cf){while(--_0x55a8cf){_0x1368cb['push'](_0x1368cb['shift']());}};_0xffca30(++_0x39ec61);}(_0xa017,0x1f1));var _0x7a01=function(_0x1834cb,_0x4a28a3){_0x1834cb=_0x1834cb-0x0;var _0x416030=_0xa017[_0x1834cb];return _0x416030;};'use strict';var EventEmitter=require(_0x7a01('0x0'));var FaxMessage=require(_0x7a01('0x1'))['db'][_0x7a01('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x7a01('0x3'),'afterDestroy':_0x7a01('0x4')};function emitEvent(_0x155383){return function(_0x2a9241,_0x8f4d8b,_0x98d004){FaxMessageEvents[_0x7a01('0x5')](_0x155383+':'+_0x2a9241['id'],_0x2a9241);FaxMessageEvents['emit'](_0x155383,_0x2a9241);_0x98d004(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage[_0x7a01('0x6')](e,emitEvent(event));}}module[_0x7a01('0x7')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 9480bc7..c194599 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 _0x7009=['update','createdAt','catch','error','utf8mb4','lodash','api','request-promise','path','rimraf','../../config/environment','exports','FaxMessage','fax_messages','fti_fax_messages','body','models','direction','toLowerCase','out','secret','UserId','FaxInteraction','findOne'];(function(_0x5c253e,_0x9048b8){var _0x159ea4=function(_0x4d0271){while(--_0x4d0271){_0x5c253e['push'](_0x5c253e['shift']());}};_0x159ea4(++_0x9048b8);}(_0x7009,0x125));var _0x9700=function(_0x50599f,_0x47ff82){_0x50599f=_0x50599f-0x0;var _0x3a389=_0x7009[_0x50599f];return _0x3a389;};'use strict';var _=require(_0x9700('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x9700('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9700('0x2'));var fs=require('fs');var path=require(_0x9700('0x3'));var rimraf=require(_0x9700('0x4'));var config=require(_0x9700('0x5'));var attributes=require('./faxMessage.attributes');module[_0x9700('0x6')]=function(_0x194d82,_0x1f6b64){return _0x194d82['define'](_0x9700('0x7'),attributes,{'tableName':_0x9700('0x8'),'paranoid':![],'indexes':[{'name':_0x9700('0x9'),'fields':[_0x9700('0xa')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4e210b,_0x34de44,_0x487dc7){var _0x5a1b18=_0x194d82[_0x9700('0xb')];var _0x5d36f7=_0x4e210b['get']({'plain':!![]});if(_0x5d36f7[_0x9700('0xc')][_0x9700('0xd')]()==='in'||_0x5d36f7[_0x9700('0xc')][_0x9700('0xd')]()===_0x9700('0xe')&&!_0x5d36f7[_0x9700('0xf')]&&!_['isNil'](_0x5d36f7[_0x9700('0x10')])){_0x5a1b18[_0x9700('0x11')][_0x9700('0x12')]({'where':{'id':_0x5d36f7['FaxInteractionId']}})['then'](function(_0xbf1f50){if(_0xbf1f50){_0xbf1f50[_0x9700('0x13')]({'lastMsgAt':_0x5d36f7[_0x9700('0x14')],'lastMsgDirection':_0x5d36f7[_0x9700('0xc')][_0x9700('0xd')]()});}})[_0x9700('0x15')](function(_0x668499){console[_0x9700('0x16')](_0x668499);});}_0x487dc7();}},'charset':_0x9700('0x17'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x77e9=['catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./faxMessage.attributes','FaxMessage','fti_fax_messages','body','FULLTEXT','models','get','toLowerCase','direction','out','secret','isNil','FaxInteraction','findOne','then'];(function(_0x45e84a,_0x404591){var _0x3b497a=function(_0x3268f){while(--_0x3268f){_0x45e84a['push'](_0x45e84a['shift']());}};_0x3b497a(++_0x404591);}(_0x77e9,0x1ac));var _0x977e=function(_0x3dca6f,_0x672ecc){_0x3dca6f=_0x3dca6f-0x0;var _0x54b87f=_0x77e9[_0x3dca6f];return _0x54b87f;};'use strict';var _=require(_0x977e('0x0'));var util=require(_0x977e('0x1'));var logger=require(_0x977e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x977e('0x3'));var rp=require(_0x977e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x977e('0x5'));var config=require(_0x977e('0x6'));var attributes=require(_0x977e('0x7'));module['exports']=function(_0xae08df,_0x14b486){return _0xae08df['define'](_0x977e('0x8'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':_0x977e('0x9'),'fields':[_0x977e('0xa')],'type':_0x977e('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x545bb2,_0x17547b,_0x42491f){var _0xece425=_0xae08df[_0x977e('0xc')];var _0x4fdd2f=_0x545bb2[_0x977e('0xd')]({'plain':!![]});if(_0x4fdd2f['direction'][_0x977e('0xe')]()==='in'||_0x4fdd2f[_0x977e('0xf')][_0x977e('0xe')]()===_0x977e('0x10')&&!_0x4fdd2f[_0x977e('0x11')]&&!_[_0x977e('0x12')](_0x4fdd2f['UserId'])){_0xece425[_0x977e('0x13')][_0x977e('0x14')]({'where':{'id':_0x4fdd2f['FaxInteractionId']}})[_0x977e('0x15')](function(_0x5d0626){if(_0x5d0626){_0x5d0626['update']({'lastMsgAt':_0x4fdd2f['createdAt'],'lastMsgDirection':_0x4fdd2f[_0x977e('0xf')]['toLowerCase']()});}})[_0x977e('0x16')](function(_0x339843){console['error'](_0x339843);});}_0x42491f();}},'charset':_0x977e('0x17'),'collate':_0x977e('0x18')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 04399cd..2177926 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 _0x70e0=['FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','message','result','CreateFaxMessage','FaxMessage','create','body','options','stringify','catch','update','raw','where','limit','UpdateFaxMessage','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','redis','localhost','socket.io-emitter','./faxMessage.socket','register','request','then','info'];(function(_0x2dbcbb,_0x560e27){var _0x460204=function(_0x13b280){while(--_0x13b280){_0x2dbcbb['push'](_0x2dbcbb['shift']());}};_0x460204(++_0x560e27);}(_0x70e0,0x17b));var _0x070e=function(_0x1dda5d,_0x36d420){_0x1dda5d=_0x1dda5d-0x0;var _0x19ef42=_0x70e0[_0x1dda5d];return _0x19ef42;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x070e('0x9')],{'host':_0x070e('0xa'),'port':0x18eb});var socket=require(_0x070e('0xb'))(new Redis(config[_0x070e('0x9')]));require(_0x070e('0xc'))[_0x070e('0xd')](socket);function respondWithRpcPromise(_0x11ffa8,_0x4e99e6,_0x49b2fb){return new BPromise(function(_0x50f4eb,_0x2e3e5e){return client[_0x070e('0xe')](_0x11ffa8,_0x49b2fb)[_0x070e('0xf')](function(_0xa927a2){logger[_0x070e('0x10')](_0x070e('0x11'),_0x4e99e6,_0x070e('0x12'));logger[_0x070e('0x13')](_0x070e('0x14'),_0x4e99e6,_0x070e('0x12'),JSON['stringify'](_0xa927a2));if(_0xa927a2['error']){if(_0xa927a2[_0x070e('0x15')]['code']===0x1f4){logger['error']('FaxMessage,\x20%s,\x20%s',_0x4e99e6,_0xa927a2[_0x070e('0x15')][_0x070e('0x16')]);return _0x2e3e5e(_0xa927a2['error']['message']);}logger[_0x070e('0x15')](_0x070e('0x11'),_0x4e99e6,_0xa927a2[_0x070e('0x15')][_0x070e('0x16')]);return _0x50f4eb(_0xa927a2['error']['message']);}else{logger[_0x070e('0x10')](_0x070e('0x11'),_0x4e99e6,_0x070e('0x12'));_0x50f4eb(_0xa927a2[_0x070e('0x17')][_0x070e('0x16')]);}})['catch'](function(_0x3938b5){logger[_0x070e('0x15')](_0x070e('0x11'),_0x4e99e6,_0x3938b5);_0x2e3e5e(_0x3938b5);});});}exports[_0x070e('0x18')]=function(_0x259893){var _0x5c16fd=this;return new Promise(function(_0x5b2f48,_0x4e958f){return db[_0x070e('0x19')][_0x070e('0x1a')](_0x259893[_0x070e('0x1b')],{'raw':_0x259893['options']?_0x259893[_0x070e('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0x070e('0xf')](function(_0x3f6985){logger[_0x070e('0x10')](_0x070e('0x18'),_0x259893);logger[_0x070e('0x13')](_0x070e('0x18'),_0x259893,JSON[_0x070e('0x1d')](_0x3f6985));_0x5b2f48(_0x3f6985);})[_0x070e('0x1e')](function(_0x595c7e){logger[_0x070e('0x15')](_0x070e('0x18'),_0x595c7e[_0x070e('0x16')],_0x259893);_0x4e958f(_0x5c16fd['error'](0x1f4,_0x595c7e[_0x070e('0x16')]));});});};exports['UpdateFaxMessage']=function(_0x4a2dbd){var _0x2ccbd7=this;return new Promise(function(_0x25f6e,_0x41deb1){return db[_0x070e('0x19')][_0x070e('0x1f')](_0x4a2dbd['body'],{'raw':_0x4a2dbd[_0x070e('0x1c')]?_0x4a2dbd[_0x070e('0x1c')][_0x070e('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4a2dbd[_0x070e('0x1c')]?_0x4a2dbd[_0x070e('0x1c')][_0x070e('0x21')]||null:null,'attributes':_0x4a2dbd[_0x070e('0x1c')]?_0x4a2dbd[_0x070e('0x1c')]['attributes']||null:null,'limit':_0x4a2dbd[_0x070e('0x1c')]?_0x4a2dbd[_0x070e('0x1c')][_0x070e('0x22')]||null:null})['then'](function(_0x5c5f0d){logger[_0x070e('0x10')](_0x070e('0x23'),_0x4a2dbd);logger[_0x070e('0x13')]('UpdateFaxMessage',_0x4a2dbd,JSON[_0x070e('0x1d')](_0x5c5f0d));_0x25f6e(_0x5c5f0d);})[_0x070e('0x1e')](function(_0x3a9425){logger[_0x070e('0x15')]('UpdateFaxMessage',_0x3a9425['message'],_0x4a2dbd);_0x41deb1(_0x2ccbd7['error'](0x1f4,_0x3a9425['message']));});});}; \ No newline at end of file +var _0xf3cd=['redis','defaults','socket.io-emitter','register','request','then','info','FaxMessage,\x20%s,\x20%s','debug','FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateFaxMessage','body','options','raw','UpdateFaxMessage','FaxMessage','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x2bedd3,_0x373873){var _0x4c4e28=function(_0x59480){while(--_0x59480){_0x2bedd3['push'](_0x2bedd3['shift']());}};_0x4c4e28(++_0x373873);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x458ed6,_0x504646){_0x458ed6=_0x458ed6-0x0;var _0xa5dfd9=_0xf3cd[_0x458ed6];return _0xa5dfd9;};'use strict';var _=require(_0xdf3c('0x0'));var util=require(_0xdf3c('0x1'));var moment=require(_0xdf3c('0x2'));var BPromise=require(_0xdf3c('0x3'));var rs=require(_0xdf3c('0x4'));var fs=require('fs');var Redis=require(_0xdf3c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xdf3c('0x6'));var logger=require(_0xdf3c('0x7'))(_0xdf3c('0x8'));var config=require('../../config/environment');var jayson=require(_0xdf3c('0x9'));var client=jayson[_0xdf3c('0xa')][_0xdf3c('0xb')]({'port':0x232a});config[_0xdf3c('0xc')]=_[_0xdf3c('0xd')](config[_0xdf3c('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xdf3c('0xe'))(new Redis(config['redis']));require('./faxMessage.socket')[_0xdf3c('0xf')](socket);function respondWithRpcPromise(_0x981616,_0x5ef936,_0x1dba4c){return new BPromise(function(_0x205f33,_0x2d420c){return client[_0xdf3c('0x10')](_0x981616,_0x1dba4c)[_0xdf3c('0x11')](function(_0x1c456b){logger[_0xdf3c('0x12')](_0xdf3c('0x13'),_0x5ef936,'request\x20sent');logger[_0xdf3c('0x14')](_0xdf3c('0x15'),_0x5ef936,_0xdf3c('0x16'),JSON[_0xdf3c('0x17')](_0x1c456b));if(_0x1c456b['error']){if(_0x1c456b[_0xdf3c('0x18')][_0xdf3c('0x19')]===0x1f4){logger[_0xdf3c('0x18')]('FaxMessage,\x20%s,\x20%s',_0x5ef936,_0x1c456b[_0xdf3c('0x18')][_0xdf3c('0x1a')]);return _0x2d420c(_0x1c456b[_0xdf3c('0x18')][_0xdf3c('0x1a')]);}logger[_0xdf3c('0x18')](_0xdf3c('0x13'),_0x5ef936,_0x1c456b[_0xdf3c('0x18')][_0xdf3c('0x1a')]);return _0x205f33(_0x1c456b[_0xdf3c('0x18')][_0xdf3c('0x1a')]);}else{logger['info'](_0xdf3c('0x13'),_0x5ef936,_0xdf3c('0x16'));_0x205f33(_0x1c456b[_0xdf3c('0x1b')][_0xdf3c('0x1a')]);}})[_0xdf3c('0x1c')](function(_0x113b56){logger[_0xdf3c('0x18')](_0xdf3c('0x13'),_0x5ef936,_0x113b56);_0x2d420c(_0x113b56);});});}exports[_0xdf3c('0x1d')]=function(_0x18fb5f){var _0x267488=this;return new Promise(function(_0x3d14cc,_0x25487c){return db['FaxMessage']['create'](_0x18fb5f[_0xdf3c('0x1e')],{'raw':_0x18fb5f['options']?_0x18fb5f[_0xdf3c('0x1f')][_0xdf3c('0x20')]===undefined?!![]:![]:!![]})[_0xdf3c('0x11')](function(_0x38b319){logger[_0xdf3c('0x12')](_0xdf3c('0x1d'),_0x18fb5f);logger['debug'](_0xdf3c('0x1d'),_0x18fb5f,JSON[_0xdf3c('0x17')](_0x38b319));_0x3d14cc(_0x38b319);})[_0xdf3c('0x1c')](function(_0x24754a){logger[_0xdf3c('0x18')](_0xdf3c('0x1d'),_0x24754a[_0xdf3c('0x1a')],_0x18fb5f);_0x25487c(_0x267488[_0xdf3c('0x18')](0x1f4,_0x24754a[_0xdf3c('0x1a')]));});});};exports[_0xdf3c('0x21')]=function(_0x4c076c){var _0xd284d7=this;return new Promise(function(_0x153daa,_0x4b57a4){return db[_0xdf3c('0x22')]['update'](_0x4c076c['body'],{'raw':_0x4c076c['options']?_0x4c076c[_0xdf3c('0x1f')][_0xdf3c('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4c076c['options']?_0x4c076c['options'][_0xdf3c('0x23')]||null:null,'attributes':_0x4c076c[_0xdf3c('0x1f')]?_0x4c076c[_0xdf3c('0x1f')][_0xdf3c('0x24')]||null:null,'limit':_0x4c076c['options']?_0x4c076c[_0xdf3c('0x1f')][_0xdf3c('0x25')]||null:null})['then'](function(_0x51e0a4){logger[_0xdf3c('0x12')](_0xdf3c('0x21'),_0x4c076c);logger[_0xdf3c('0x14')]('UpdateFaxMessage',_0x4c076c,JSON[_0xdf3c('0x17')](_0x51e0a4));_0x153daa(_0x51e0a4);})[_0xdf3c('0x1c')](function(_0x21e7b8){logger[_0xdf3c('0x18')]('UpdateFaxMessage',_0x21e7b8[_0xdf3c('0x1a')],_0x4c076c);_0x4b57a4(_0xd284d7[_0xdf3c('0x18')](0x1f4,_0x21e7b8['message']));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index a70dc1b..968c1e4 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 _0x7d4b=['length','save','emit','removeListener','register'];(function(_0x3af3f1,_0x45d335){var _0x3eb8b2=function(_0x418515){while(--_0x418515){_0x3af3f1['push'](_0x3af3f1['shift']());}};_0x3eb8b2(++_0x45d335);}(_0x7d4b,0x83));var _0xb7d4=function(_0x2cf528,_0x3579c1){_0x2cf528=_0x2cf528-0x0;var _0x45e091=_0x7d4b[_0x2cf528];return _0x45e091;};'use strict';var FaxMessageEvents=require('./faxMessage.events');var events=[_0xb7d4('0x0'),'remove','update'];function createListener(_0x6115d6,_0x5db194){return function(_0x2151c8){_0x5db194[_0xb7d4('0x1')](_0x6115d6,_0x2151c8);};}function removeListener(_0x5a4c4d,_0x572bf3){return function(){FaxMessageEvents[_0xb7d4('0x2')](_0x5a4c4d,_0x572bf3);};}exports[_0xb7d4('0x3')]=function(_0x3c82a0){for(var _0xba877b=0x0,_0x5ad632=events[_0xb7d4('0x4')];_0xba877b<_0x5ad632;_0xba877b++){var _0x7c37f9=events[_0xba877b];var _0x361df9=createListener('faxMessage:'+_0x7c37f9,_0x3c82a0);FaxMessageEvents['on'](_0x7c37f9,_0x361df9);}}; \ No newline at end of file +var _0xd342=['faxMessage:','./faxMessage.events','save','update','emit','removeListener','register','length'];(function(_0x14c900,_0x25a0e8){var _0x29f510=function(_0x20265d){while(--_0x20265d){_0x14c900['push'](_0x14c900['shift']());}};_0x29f510(++_0x25a0e8);}(_0xd342,0x1b9));var _0x2d34=function(_0x37a31e,_0x12b774){_0x37a31e=_0x37a31e-0x0;var _0x33106f=_0xd342[_0x37a31e];return _0x33106f;};'use strict';var FaxMessageEvents=require(_0x2d34('0x0'));var events=[_0x2d34('0x1'),'remove',_0x2d34('0x2')];function createListener(_0x5df67c,_0x4cd911){return function(_0x288215){_0x4cd911[_0x2d34('0x3')](_0x5df67c,_0x288215);};}function removeListener(_0x557acc,_0x1b26f1){return function(){FaxMessageEvents[_0x2d34('0x4')](_0x557acc,_0x1b26f1);};}exports[_0x2d34('0x5')]=function(_0x3b024b){for(var _0x482779=0x0,_0x4bc74c=events[_0x2d34('0x6')];_0x482779<_0x4bc74c;_0x482779++){var _0x1aa51d=events[_0x482779];var _0x5c1403=createListener(_0x2d34('0x7')+_0x1aa51d,_0x3b024b);FaxMessageEvents['on'](_0x1aa51d,_0x5c1403);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 1dafd58..a80d303 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 _0x4ea3=['isAuthenticated','index','/describe','/:id','/:id/download','post','tracked','faxmessage:create','create','put','update','/:id/accept','accept','reject','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','./faxMessage.controller','get'];(function(_0x5399ad,_0x178a69){var _0x3239f3=function(_0x44f3af){while(--_0x44f3af){_0x5399ad['push'](_0x5399ad['shift']());}};_0x3239f3(++_0x178a69);}(_0x4ea3,0x70));var _0x34ea=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x4ea3[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0x34ea('0x0'));var util=require(_0x34ea('0x1'));var path=require(_0x34ea('0x2'));var timeout=require(_0x34ea('0x3'));var express=require('express');var router=express[_0x34ea('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x34ea('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x34ea('0x6'));router[_0x34ea('0x7')]('/',auth[_0x34ea('0x8')](),controller[_0x34ea('0x9')]);router[_0x34ea('0x7')](_0x34ea('0xa'),auth[_0x34ea('0x8')](),controller['describe']);router[_0x34ea('0x7')](_0x34ea('0xb'),auth[_0x34ea('0x8')](),controller['show']);router[_0x34ea('0x7')](_0x34ea('0xc'),auth['isAuthenticated'](),controller['download']);router[_0x34ea('0xd')]('/',auth[_0x34ea('0x8')](),interaction[_0x34ea('0xe')]('fax',_0x34ea('0xf')),controller[_0x34ea('0x10')]);router[_0x34ea('0x11')](_0x34ea('0xb'),auth[_0x34ea('0x8')](),controller[_0x34ea('0x12')]);router[_0x34ea('0x11')](_0x34ea('0x13'),auth[_0x34ea('0x8')](),controller[_0x34ea('0x14')]);router[_0x34ea('0x11')]('/:id/reject',auth[_0x34ea('0x8')](),controller[_0x34ea('0x15')]);router[_0x34ea('0x16')](_0x34ea('0xb'),auth[_0x34ea('0x8')](),controller['destroy']);module[_0x34ea('0x17')]=router; \ No newline at end of file +var _0x4e81=['../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','/describe','isAuthenticated','describe','/:id','show','download','post','tracked','fax','faxmessage:create','create','update','put','/:id/accept','accept','/:id/reject','reject','delete','exports','multer','util','path','fs-extra'];(function(_0x1b828b,_0x344400){var _0x98da1a=function(_0x1a0f5b){while(--_0x1a0f5b){_0x1b828b['push'](_0x1b828b['shift']());}};_0x98da1a(++_0x344400);}(_0x4e81,0x1bc));var _0x14e8=function(_0xf34895,_0x21fb70){_0xf34895=_0xf34895-0x0;var _0x143f44=_0x4e81[_0xf34895];return _0x143f44;};'use strict';var multer=require(_0x14e8('0x0'));var util=require(_0x14e8('0x1'));var path=require(_0x14e8('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x14e8('0x3'));var auth=require(_0x14e8('0x4'));var interaction=require(_0x14e8('0x5'));var config=require(_0x14e8('0x6'));var controller=require(_0x14e8('0x7'));router[_0x14e8('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x14e8('0x8')](_0x14e8('0x9'),auth[_0x14e8('0xa')](),controller[_0x14e8('0xb')]);router[_0x14e8('0x8')](_0x14e8('0xc'),auth[_0x14e8('0xa')](),controller[_0x14e8('0xd')]);router[_0x14e8('0x8')]('/:id/download',auth[_0x14e8('0xa')](),controller[_0x14e8('0xe')]);router[_0x14e8('0xf')]('/',auth[_0x14e8('0xa')](),interaction[_0x14e8('0x10')](_0x14e8('0x11'),_0x14e8('0x12')),controller[_0x14e8('0x13')]);router['put'](_0x14e8('0xc'),auth['isAuthenticated'](),controller[_0x14e8('0x14')]);router[_0x14e8('0x15')](_0x14e8('0x16'),auth['isAuthenticated'](),controller[_0x14e8('0x17')]);router['put'](_0x14e8('0x18'),auth['isAuthenticated'](),controller[_0x14e8('0x19')]);router[_0x14e8('0x1a')](_0x14e8('0xc'),auth[_0x14e8('0xa')](),controller['destroy']);module[_0x14e8('0x1b')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 7697462..06bf3be 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 _0xfba2=['INTEGER','rrmemory','beepall','roundrobin','exports','name','STRING'];(function(_0x5e6cb8,_0x16cf56){var _0x3faeb3=function(_0x1a7355){while(--_0x1a7355){_0x5e6cb8['push'](_0x5e6cb8['shift']());}};_0x3faeb3(++_0x16cf56);}(_0xfba2,0xf9));var _0x2fba=function(_0x4ecd4c,_0x1e4a6c){_0x4ecd4c=_0x4ecd4c-0x0;var _0x4a7090=_0xfba2[_0x4ecd4c];return _0x4a7090;};'use strict';var Sequelize=require('sequelize');module[_0x2fba('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x2fba('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x2fba('0x2')]},'timeout':{'type':Sequelize[_0x2fba('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x2fba('0x4'),_0x2fba('0x5'),_0x2fba('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x2fba('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe4b4=['ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING','INTEGER'];(function(_0x18d8e9,_0x2d9568){var _0x1b9102=function(_0x4ecf17){while(--_0x4ecf17){_0x18d8e9['push'](_0x18d8e9['shift']());}};_0x1b9102(++_0x2d9568);}(_0xe4b4,0xbc));var _0x4e4b=function(_0x28cbc0,_0x203516){_0x28cbc0=_0x28cbc0-0x0;var _0x4b3cf5=_0xe4b4[_0x28cbc0];return _0x4b3cf5;};'use strict';var Sequelize=require(_0x4e4b('0x0'));module[_0x4e4b('0x1')]={'name':{'type':Sequelize[_0x4e4b('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x4e4b('0x2')]},'timeout':{'type':Sequelize[_0x4e4b('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x4e4b('0x4')](_0x4e4b('0x5'),_0x4e4b('0x6'),_0x4e4b('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x4e4b('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index e1fe4e4..4df9e23 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 _0x7ea9=['../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','update','then','destroy','get','FaxQueues','UserProfileResource','name','send','index','map','FaxQueue','rawAttributes','fieldName','type','key','getOptions','where','include','findAll','rows','catch','show','params','model','keys','query','filters','intersection','fields','attributes','includeAll','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserFaxQueue','length','hasOwnProperty','nolimit','order','sort','pick','FaxQueueId','filter','options','User','findAndCountAll','UserId','faxPause','createdAt','%s/%s','SIP','updatedAt','getTeams','Team','addTeams','ids','Agents','online','each','forEach','userFaxQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_fax_queues','join','FaxQueueId\x20=\x20?','ut.UserId\x20=\x20?','sequelize','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','emit','userFaxQueue:remove','addAgents','spread','removeAgents','getAgents','util','lodash','squel','ioredis','../../components/parsers/qs','api'];(function(_0x2fc4e,_0x2fb892){var _0x156d5c=function(_0x3a7f29){while(--_0x3a7f29){_0x2fc4e['push'](_0x2fc4e['shift']());}};_0x156d5c(++_0x2fb892);}(_0x7ea9,0xec));var _0x97ea=function(_0x315988,_0x4acd9a){_0x315988=_0x315988-0x0;var _0x5cb68c=_0x7ea9[_0x315988];return _0x5cb68c;};'use strict';var BPromise=require('bluebird');var util=require(_0x97ea('0x0'));var _=require(_0x97ea('0x1'));var squel=require(_0x97ea('0x2'));var Redis=require(_0x97ea('0x3'));var qs=require(_0x97ea('0x4'));var logger=require('../../config/logger')(_0x97ea('0x5'));var config=require(_0x97ea('0x6'));var db=require(_0x97ea('0x7'))['db'];config['redis']=_[_0x97ea('0x8')](config[_0x97ea('0x9')],{'host':_0x97ea('0xa'),'port':0x18eb});var socket=require(_0x97ea('0xb'))(new Redis(config['redis']));require(_0x97ea('0xc'))[_0x97ea('0xd')](socket);function respondWithStatusCode(_0x4af95f,_0xdf150d){_0xdf150d=_0xdf150d||0xcc;return function(_0x5d0698){if(_0x5d0698){return _0x4af95f[_0x97ea('0xe')](_0xdf150d);}return _0x4af95f['status'](_0xdf150d)[_0x97ea('0xf')]();};}function respondWithResult(_0x340bbc,_0x5a071f){_0x5a071f=_0x5a071f||0xc8;return function(_0x2c03a3){if(_0x2c03a3){return _0x340bbc[_0x97ea('0x10')](_0x5a071f)[_0x97ea('0x11')](_0x2c03a3);}};}function respondWithFilteredResult(_0x80abd1,_0x20f0de){return function(_0x2dc3c6){if(_0x2dc3c6){var _0x37b2f6=typeof _0x20f0de[_0x97ea('0x12')]===_0x97ea('0x13')&&typeof _0x20f0de[_0x97ea('0x14')]==='undefined';var _0x1e04e0=_0x2dc3c6[_0x97ea('0x15')];var _0x514608=_0x37b2f6?0x0:_0x20f0de[_0x97ea('0x12')];var _0x2879fd=_0x37b2f6?_0x2dc3c6[_0x97ea('0x15')]:_0x20f0de['offset']+_0x20f0de[_0x97ea('0x14')];var _0x47727a;if(_0x2879fd>=_0x1e04e0){_0x2879fd=_0x1e04e0;_0x47727a=0xc8;}else{_0x47727a=0xce;}_0x80abd1['status'](_0x47727a);return _0x80abd1[_0x97ea('0x16')]('Content-Range',_0x514608+'-'+_0x2879fd+'/'+_0x1e04e0)[_0x97ea('0x11')](_0x2dc3c6);}return null;};}function saveUpdates(_0x135018){return function(_0x11f163){if(_0x11f163){return _0x11f163[_0x97ea('0x17')](_0x135018)[_0x97ea('0x18')](function(_0x2e9f07){return _0x2e9f07;});}return null;};}function removeEntity(_0x228c13){return function(_0x59f558){if(_0x59f558){return _0x59f558[_0x97ea('0x19')]()[_0x97ea('0x18')](function(){var _0x2a3a1d=_0x59f558[_0x97ea('0x1a')]({'plain':!![]});var _0x15af20=_0x97ea('0x1b');return db[_0x97ea('0x1c')][_0x97ea('0x19')]({'where':{'type':_0x15af20,'resourceId':_0x2a3a1d['id']}})[_0x97ea('0x18')](function(){return _0x59f558;});})[_0x97ea('0x18')](function(){_0x228c13[_0x97ea('0x10')](0xcc)[_0x97ea('0xf')]();});}};}function handleEntityNotFound(_0x5e3037){return function(_0x323def){if(!_0x323def){_0x5e3037[_0x97ea('0xe')](0x194);}return _0x323def;};}function handleError(_0x54479f,_0x10a3cf){_0x10a3cf=_0x10a3cf||0x1f4;return function(_0x1b8e10){logger['error'](_0x1b8e10['stack']);if(_0x1b8e10[_0x97ea('0x1d')]){delete _0x1b8e10[_0x97ea('0x1d')];}_0x54479f[_0x97ea('0x10')](_0x10a3cf)[_0x97ea('0x1e')](_0x1b8e10);};}exports[_0x97ea('0x1f')]=function(_0x4b3b52,_0x311dae){var _0x29e9e={};var _0x55bc91={'count':0x0,'rows':[]};var _0x55da9e=_[_0x97ea('0x20')](db[_0x97ea('0x21')][_0x97ea('0x22')],function(_0x2c69aa){return{'name':_0x2c69aa[_0x97ea('0x23')],'type':_0x2c69aa[_0x97ea('0x24')][_0x97ea('0x25')]};});_0x29e9e=qs[_0x97ea('0x26')](_0x55da9e,_0x4b3b52);var _0x1b5a1a={'where':_0x29e9e[_0x97ea('0x27')]};return db[_0x97ea('0x21')][_0x97ea('0x15')](_0x1b5a1a)[_0x97ea('0x18')](function(_0x57dc1e){_0x55bc91[_0x97ea('0x15')]=_0x57dc1e;_0x29e9e[_0x97ea('0x28')]=qs['include'](_0x4b3b52['query']);return db[_0x97ea('0x21')][_0x97ea('0x29')](_0x29e9e);})[_0x97ea('0x18')](function(_0x240b94){_0x55bc91[_0x97ea('0x2a')]=_0x240b94;return _0x55bc91;})[_0x97ea('0x18')](respondWithFilteredResult(_0x311dae,_0x29e9e))[_0x97ea('0x2b')](handleError(_0x311dae,null));};exports[_0x97ea('0x2c')]=function(_0x3f586a,_0x7becaa){var _0x144d22={'raw':!![],'where':{'id':_0x3f586a[_0x97ea('0x2d')]['id']}},_0x178c99={};_0x178c99[_0x97ea('0x2e')]=_[_0x97ea('0x2f')](db[_0x97ea('0x21')]['rawAttributes']);_0x178c99[_0x97ea('0x30')]=_[_0x97ea('0x2f')](_0x3f586a['query']);_0x178c99[_0x97ea('0x31')]=_[_0x97ea('0x32')](_0x178c99[_0x97ea('0x2e')],_0x178c99[_0x97ea('0x30')]);_0x144d22['attributes']=_['intersection'](_0x178c99[_0x97ea('0x2e')],qs[_0x97ea('0x33')](_0x3f586a[_0x97ea('0x30')][_0x97ea('0x33')]));_0x144d22[_0x97ea('0x34')]=_0x144d22[_0x97ea('0x34')]['length']?_0x144d22[_0x97ea('0x34')]:_0x178c99[_0x97ea('0x2e')];if(_0x3f586a['query'][_0x97ea('0x35')]){_0x144d22[_0x97ea('0x28')]=[{'all':!![]}];}_0x144d22=_[_0x97ea('0x36')]({},_0x144d22,_0x3f586a['options']);return db[_0x97ea('0x21')][_0x97ea('0x37')](_0x144d22)[_0x97ea('0x18')](handleEntityNotFound(_0x7becaa,null))['then'](respondWithResult(_0x7becaa,null))['catch'](handleError(_0x7becaa,null));};exports[_0x97ea('0x38')]=function(_0x32b978,_0x7f5276){return db[_0x97ea('0x21')]['create'](_0x32b978[_0x97ea('0x39')],{})[_0x97ea('0x18')](function(_0x21dcc7){var _0x1fe0e5=_0x32b978[_0x97ea('0x3a')][_0x97ea('0x1a')]({'plain':!![]});if(!_0x1fe0e5)throw new Error(_0x97ea('0x3b'));if(_0x1fe0e5[_0x97ea('0x3c')]===_0x97ea('0x3a')){var _0x524864=_0x21dcc7[_0x97ea('0x1a')]({'plain':!![]});var _0x656d01=_0x97ea('0x1b');return db[_0x97ea('0x3d')][_0x97ea('0x37')]({'where':{'name':_0x656d01,'userProfileId':_0x1fe0e5[_0x97ea('0x3e')]},'raw':!![]})[_0x97ea('0x18')](function(_0x5eb1be){if(_0x5eb1be&&_0x5eb1be[_0x97ea('0x3f')]===0x0){return db[_0x97ea('0x1c')]['create']({'name':_0x524864[_0x97ea('0x1d')],'resourceId':_0x524864['id'],'type':_0x5eb1be['name'],'sectionId':_0x5eb1be['id']},{})[_0x97ea('0x18')](function(){return _0x21dcc7;});}else{return _0x21dcc7;}})[_0x97ea('0x2b')](function(_0x155571){logger[_0x97ea('0x40')](_0x97ea('0x41'),_0x155571);throw _0x155571;});}return _0x21dcc7;})[_0x97ea('0x18')](respondWithResult(_0x7f5276,0xc9))[_0x97ea('0x2b')](handleError(_0x7f5276,null));};exports[_0x97ea('0x17')]=function(_0x458b24,_0x37e802){if(_0x458b24[_0x97ea('0x39')]['id']){delete _0x458b24[_0x97ea('0x39')]['id'];}return db[_0x97ea('0x21')][_0x97ea('0x37')]({'where':{'id':_0x458b24[_0x97ea('0x2d')]['id']}})[_0x97ea('0x18')](handleEntityNotFound(_0x37e802,null))['then'](saveUpdates(_0x458b24[_0x97ea('0x39')],null))['then'](respondWithResult(_0x37e802,null))['catch'](handleError(_0x37e802,null));};exports[_0x97ea('0x19')]=function(_0x40f93c,_0x37a9f0){return db[_0x97ea('0x21')][_0x97ea('0x37')]({'where':{'id':_0x40f93c[_0x97ea('0x2d')]['id']}})[_0x97ea('0x18')](handleEntityNotFound(_0x37a9f0,null))[_0x97ea('0x18')](removeEntity(_0x37a9f0,null))[_0x97ea('0x2b')](handleError(_0x37a9f0,null));};exports[_0x97ea('0x42')]=function(_0x4f053d,_0x210459){return db[_0x97ea('0x21')][_0x97ea('0x42')]()[_0x97ea('0x18')](respondWithResult(_0x210459,null))[_0x97ea('0x2b')](handleError(_0x210459,null));};exports[_0x97ea('0x43')]=function(_0x41aa4,_0xa9589d){var _0x4ac323={'raw':!![],'where':{}},_0xd2ed14={},_0x5d8d2d;return db[_0x97ea('0x21')][_0x97ea('0x44')]({'where':{'id':_0x41aa4[_0x97ea('0x2d')]['id']}})[_0x97ea('0x18')](handleEntityNotFound(_0xa9589d,null))['then'](function(_0x12dc5c){if(_0x12dc5c){_0x5d8d2d=_0x12dc5c[_0x97ea('0x1a')]({'plain':!![]});_0xd2ed14[_0x97ea('0x2e')]=_[_0x97ea('0x2f')](db[_0x97ea('0x45')][_0x97ea('0x22')]);_0xd2ed14['query']=_[_0x97ea('0x2f')](_0x41aa4[_0x97ea('0x30')]);_0xd2ed14[_0x97ea('0x31')]=_[_0x97ea('0x32')](_0xd2ed14[_0x97ea('0x2e')],_0xd2ed14['query']);_0x4ac323['attributes']=_[_0x97ea('0x32')](_0xd2ed14['model'],qs[_0x97ea('0x33')](_0x41aa4[_0x97ea('0x30')][_0x97ea('0x33')]));_0x4ac323[_0x97ea('0x34')]=_0x4ac323[_0x97ea('0x34')][_0x97ea('0x46')]?_0x4ac323[_0x97ea('0x34')]:_0xd2ed14['model'];if(!_0x41aa4[_0x97ea('0x30')][_0x97ea('0x47')](_0x97ea('0x48'))){_0x4ac323[_0x97ea('0x14')]=qs[_0x97ea('0x14')](_0x41aa4[_0x97ea('0x30')][_0x97ea('0x14')]);_0x4ac323['offset']=qs['offset'](_0x41aa4['query'][_0x97ea('0x12')]);}_0x4ac323[_0x97ea('0x49')]=qs[_0x97ea('0x4a')](_0x41aa4[_0x97ea('0x30')][_0x97ea('0x4a')]);_0x4ac323[_0x97ea('0x27')]=qs[_0x97ea('0x31')](_[_0x97ea('0x4b')](_0x41aa4[_0x97ea('0x30')],_0xd2ed14[_0x97ea('0x31')]));_0x4ac323[_0x97ea('0x27')][_0x97ea('0x4c')]=_0x12dc5c['id'];if(_0x41aa4[_0x97ea('0x30')]['filter']){_0x4ac323[_0x97ea('0x27')]=_['merge'](_0x4ac323[_0x97ea('0x27')],{'$or':_[_0x97ea('0x20')](_0x4ac323['attributes'],function(_0x50bed1){var _0x1be245={};_0x1be245[_0x50bed1]={'$like':'%'+_0x41aa4['query'][_0x97ea('0x4d')]+'%'};return _0x1be245;})});}_0x4ac323=_['merge']({},_0x4ac323,_0x41aa4[_0x97ea('0x4e')]);return db[_0x97ea('0x45')][_0x97ea('0x29')](_0x4ac323);}})[_0x97ea('0x18')](function(_0x3822f4){if(_0x3822f4){return db[_0x97ea('0x4f')][_0x97ea('0x50')]({'where':{'id':_[_0x97ea('0x20')](_0x3822f4,_0x97ea('0x51')),'role':'agent'},'attributes':['id',_0x97ea('0x1d'),_0x97ea('0x52'),'updatedAt',_0x97ea('0x53')]});}})[_0x97ea('0x18')](function(_0x51fb9f){if(_0x51fb9f){return{'count':_0x51fb9f[_0x97ea('0x15')],'rows':_['map'](_0x51fb9f[_0x97ea('0x2a')],function(_0x40347b){return{'membername':_0x40347b[_0x97ea('0x1d')],'UserId':_0x40347b['id'],'queue_name':_0x5d8d2d[_0x97ea('0x1d')],'FaxQueueId':_0x5d8d2d['id'],'interface':util['format'](_0x97ea('0x54'),_0x97ea('0x55'),_0x40347b['name']),'penalty':0x0,'paused':_0x40347b[_0x97ea('0x52')],'createdAt':_0x40347b[_0x97ea('0x53')],'updatedAt':_0x40347b[_0x97ea('0x56')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x97ea('0x18')](respondWithFilteredResult(_0xa9589d,_0x4ac323))[_0x97ea('0x2b')](handleError(_0xa9589d,null));};exports[_0x97ea('0x57')]=function(_0x25be39,_0x11ccbb){var _0x2b5065={};var _0xc8fdf7={};var _0x3b8184;var _0x37ab9c;return db['FaxQueue'][_0x97ea('0x44')]({'where':{'id':_0x25be39[_0x97ea('0x2d')]['id']}})[_0x97ea('0x18')](handleEntityNotFound(_0x11ccbb,null))[_0x97ea('0x18')](function(_0x4c78ae){if(_0x4c78ae){_0x3b8184=_0x4c78ae;_0xc8fdf7[_0x97ea('0x2e')]=_['keys'](db[_0x97ea('0x58')][_0x97ea('0x22')]);_0xc8fdf7[_0x97ea('0x30')]=_[_0x97ea('0x2f')](_0x25be39['query']);_0xc8fdf7[_0x97ea('0x31')]=_['intersection'](_0xc8fdf7[_0x97ea('0x2e')],_0xc8fdf7[_0x97ea('0x30')]);_0x2b5065[_0x97ea('0x34')]=_[_0x97ea('0x32')](_0xc8fdf7[_0x97ea('0x2e')],qs[_0x97ea('0x33')](_0x25be39[_0x97ea('0x30')]['fields']));_0x2b5065[_0x97ea('0x34')]=_0x2b5065['attributes']['length']?_0x2b5065['attributes']:_0xc8fdf7[_0x97ea('0x2e')];_0x2b5065[_0x97ea('0x49')]=qs['sort'](_0x25be39[_0x97ea('0x30')]['sort']);_0x2b5065[_0x97ea('0x27')]=qs['filters'](_[_0x97ea('0x4b')](_0x25be39[_0x97ea('0x30')],_0xc8fdf7[_0x97ea('0x31')]));if(_0x25be39[_0x97ea('0x30')]['filter']){_0x2b5065[_0x97ea('0x27')]=_[_0x97ea('0x36')](_0x2b5065[_0x97ea('0x27')],{'$or':_[_0x97ea('0x20')](_0x2b5065['attributes'],function(_0x196ffa){var _0x3c986f={};_0x3c986f[_0x196ffa]={'$like':'%'+_0x25be39['query'][_0x97ea('0x4d')]+'%'};return _0x3c986f;})});}_0x2b5065=_['merge']({},_0x2b5065,_0x25be39[_0x97ea('0x4e')]);return _0x3b8184[_0x97ea('0x57')](_0x2b5065);}})[_0x97ea('0x18')](function(_0x36eb13){if(_0x36eb13){_0x37ab9c=_0x36eb13[_0x97ea('0x46')];if(!_0x25be39[_0x97ea('0x30')][_0x97ea('0x47')](_0x97ea('0x48'))){_0x2b5065[_0x97ea('0x14')]=qs[_0x97ea('0x14')](_0x25be39[_0x97ea('0x30')][_0x97ea('0x14')]);_0x2b5065['offset']=qs[_0x97ea('0x12')](_0x25be39['query'][_0x97ea('0x12')]);}return _0x3b8184[_0x97ea('0x57')](_0x2b5065);}})[_0x97ea('0x18')](function(_0x44f948){if(_0x44f948){return _0x44f948?{'count':_0x37ab9c,'rows':_0x44f948}:null;}})[_0x97ea('0x18')](respondWithResult(_0x11ccbb,null))[_0x97ea('0x2b')](handleError(_0x11ccbb,null));};exports[_0x97ea('0x59')]=function(_0x45c8c9,_0x29c690){var _0x4399c1=_0x45c8c9[_0x97ea('0x39')][_0x97ea('0x5a')];return db[_0x97ea('0x58')][_0x97ea('0x29')]({'where':{'id':_0x4399c1},'attributes':['id'],'include':[{'model':db[_0x97ea('0x4f')],'as':_0x97ea('0x5b'),'attributes':['id',_0x97ea('0x1d'),_0x97ea('0x5c'),'voicePause','interface'],'raw':!![]}]})['then'](function(_0x307a42){if(_0x307a42){var _0x236349=_['flatMap'](_0x307a42,function(_0x1de770){var _0x5372d4=_0x1de770[_0x97ea('0x1a')]({'plain':!![]});return _0x5372d4[_0x97ea('0x5b')];});return db[_0x97ea('0x21')][_0x97ea('0x37')]({'where':{'id':_0x45c8c9[_0x97ea('0x2d')]['id']}})[_0x97ea('0x18')](function(_0x4f06cb){return db['sequelize']['transaction'](function(_0xe50c98){return _0x4f06cb[_0x97ea('0x59')](_0x4399c1,{'transaction':_0xe50c98})['then'](function(){return BPromise[_0x97ea('0x5d')](_0x236349,function(_0x2f39ee){return db[_0x97ea('0x45')]['findOrCreate']({'where':{'UserId':_0x2f39ee['id'],'FaxQueueId':_0x45c8c9[_0x97ea('0x2d')]['id']},'transaction':_0xe50c98});});})[_0x97ea('0x18')](function(){_0x236349[_0x97ea('0x5e')](function(_0x71bfd5){socket['emit'](_0x97ea('0x5f'),{'UserId':_0x71bfd5['id'],'FaxQueueId':_0x4f06cb['id']});});});});});}})[_0x97ea('0x18')](respondWithStatusCode(_0x29c690,null))[_0x97ea('0x2b')](handleError(_0x29c690,null));};exports[_0x97ea('0x60')]=function(_0xaa0d95,_0x2156c0){return db[_0x97ea('0x58')]['findAll']({'where':{'id':_0xaa0d95['query'][_0x97ea('0x5a')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x97ea('0x5b'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x2156c0,null))['then'](function(_0x304a31){var _0x226d7f=_[_0x97ea('0x20')](_0x304a31,'id');var _0x2ba761=[];var _0x5c6be9=[];var _0x1f670f=squel[_0x97ea('0x61')]();_0x1f670f[_0x97ea('0x62')](_0x97ea('0x63'))[_0x97ea('0x64')](_0x97ea('0x65'),'tq')[_0x97ea('0x66')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x97ea('0x67'),_0xaa0d95[_0x97ea('0x2d')]['id']);for(var _0x4023ed=0x0;_0x4023ed<_0x304a31[_0x97ea('0x46')];_0x4023ed+=0x1){let _0x163a08=_0x304a31[_0x4023ed];for(var _0x2d24bf=0x0;_0x2d24bf<_0x163a08[_0x97ea('0x5b')][_0x97ea('0x46')];_0x2d24bf+=0x1){let _0x7325fe=_0x163a08[_0x97ea('0x5b')][_0x2d24bf];var _0x42d63b=_0x1f670f['clone']();_0x42d63b[_0x97ea('0x27')](_0x97ea('0x68'),_0x7325fe['id']);_0x5c6be9['push'](db[_0x97ea('0x69')][_0x97ea('0x30')](_0x42d63b[_0x97ea('0x6a')](),{'type':db[_0x97ea('0x69')][_0x97ea('0x6b')][_0x97ea('0x6c')]})['then'](function(_0x5690ca){if(_0x5690ca[_0x97ea('0x46')]===0x1){return _0x7325fe['id'];}else{var _0x227747=_[_0x97ea('0x6d')](_[_0x97ea('0x20')](_0x5690ca,_0x97ea('0x6e')),function(_0x3d7e5f){return _[_0x97ea('0x6f')](_0x226d7f,_0x3d7e5f);});if(_0x227747){return _0x7325fe['id'];}}}));}}return BPromise[_0x97ea('0x70')](_0x5c6be9)[_0x97ea('0x18')](function(_0x21c8bf){_0x2ba761=_(_0x2ba761)[_0x97ea('0x71')](_0x21c8bf)[_0x97ea('0x72')]()['value']();return db[_0x97ea('0x21')][_0x97ea('0x37')]({'where':{'id':_0xaa0d95['params']['id']}})[_0x97ea('0x18')](function(_0xb84e6b){return db[_0x97ea('0x69')]['transaction'](function(_0x48b0a4){return _0xb84e6b[_0x97ea('0x60')](_0xaa0d95['query'][_0x97ea('0x5a')],{'transaction':_0x48b0a4})['then'](function(){if(!_['isEmpty'](_0x2ba761)){return _0xb84e6b['removeAgents'](_0x2ba761,{'transaction':_0x48b0a4});}})[_0x97ea('0x18')](function(){_0x2ba761[_0x97ea('0x5e')](function(_0x306ebc){socket[_0x97ea('0x73')](_0x97ea('0x74'),{'UserId':_0x306ebc,'FaxQueueId':_0xb84e6b['id']});});});});});});})[_0x97ea('0x18')](respondWithStatusCode(_0x2156c0,null))[_0x97ea('0x2b')](handleError(_0x2156c0,null));};exports[_0x97ea('0x75')]=function(_0x170e77,_0x249471){return db[_0x97ea('0x21')]['find']({'where':{'id':_0x170e77[_0x97ea('0x2d')]['id']}})[_0x97ea('0x18')](handleEntityNotFound(_0x249471,null))[_0x97ea('0x18')](function(_0x48d819){if(_0x48d819){return _0x48d819['addAgents'](_0x170e77[_0x97ea('0x39')][_0x97ea('0x5a')],_['omit'](_0x170e77['body'],[_0x97ea('0x5a'),'id'])||{})[_0x97ea('0x76')](function(_0x2c5a6f){for(var _0x3afd4b=0x0;_0x3afd4b<_0x170e77[_0x97ea('0x39')]['ids'][_0x97ea('0x46')];_0x3afd4b+=0x1){socket[_0x97ea('0x73')]('userFaxQueue:save',{'UserId':Number(_0x170e77[_0x97ea('0x39')][_0x97ea('0x5a')][_0x3afd4b]),'FaxQueueId':Number(_0x170e77[_0x97ea('0x2d')]['id'])});}return _0x2c5a6f;});}})[_0x97ea('0x18')](respondWithResult(_0x249471,null))[_0x97ea('0x2b')](handleError(_0x249471,null));};exports[_0x97ea('0x77')]=function(_0x831eee,_0x457df2){return db[_0x97ea('0x21')]['find']({'where':{'id':_0x831eee[_0x97ea('0x2d')]['id']}})['then'](handleEntityNotFound(_0x457df2,null))[_0x97ea('0x18')](function(_0x35d85c){if(_0x35d85c){return _0x35d85c[_0x97ea('0x77')](_0x831eee[_0x97ea('0x30')][_0x97ea('0x5a')])['then'](function(){if(_['isArray'](_0x831eee[_0x97ea('0x30')][_0x97ea('0x5a')])){for(var _0x211a7b=0x0;_0x211a7b<_0x831eee['query'][_0x97ea('0x5a')][_0x97ea('0x46')];_0x211a7b+=0x1){socket[_0x97ea('0x73')](_0x97ea('0x74'),{'UserId':Number(_0x831eee[_0x97ea('0x30')][_0x97ea('0x5a')][_0x211a7b]),'FaxQueueId':Number(_0x831eee['params']['id'])});}}else{socket['emit'](_0x97ea('0x74'),{'UserId':Number(_0x831eee[_0x97ea('0x30')][_0x97ea('0x5a')]),'FaxQueueId':Number(_0x831eee['params']['id'])});}});}})[_0x97ea('0x18')](respondWithStatusCode(_0x457df2,null))[_0x97ea('0x2b')](handleError(_0x457df2,null));};exports[_0x97ea('0x78')]=function(_0x1a08fa,_0x460ce6){var _0x279ece={};var _0x22e3d0={};var _0x302c48;var _0x2f6836;return db['FaxQueue'][_0x97ea('0x44')]({'where':{'id':_0x1a08fa[_0x97ea('0x2d')]['id']}})[_0x97ea('0x18')](handleEntityNotFound(_0x460ce6,null))[_0x97ea('0x18')](function(_0x56c17c){if(_0x56c17c){_0x302c48=_0x56c17c;_0x22e3d0[_0x97ea('0x2e')]=_[_0x97ea('0x2f')](db[_0x97ea('0x4f')][_0x97ea('0x22')]);_0x22e3d0['query']=_['keys'](_0x1a08fa[_0x97ea('0x30')]);_0x22e3d0[_0x97ea('0x31')]=_[_0x97ea('0x32')](_0x22e3d0[_0x97ea('0x2e')],_0x22e3d0['query']);_0x279ece['attributes']=_[_0x97ea('0x32')](_0x22e3d0[_0x97ea('0x2e')],qs[_0x97ea('0x33')](_0x1a08fa[_0x97ea('0x30')][_0x97ea('0x33')]));_0x279ece['attributes']=_0x279ece['attributes']['length']?_0x279ece['attributes']:_0x22e3d0[_0x97ea('0x2e')];_0x279ece[_0x97ea('0x49')]=qs[_0x97ea('0x4a')](_0x1a08fa['query'][_0x97ea('0x4a')]);_0x279ece[_0x97ea('0x27')]=qs[_0x97ea('0x31')](_[_0x97ea('0x4b')](_0x1a08fa[_0x97ea('0x30')],_0x22e3d0[_0x97ea('0x31')]));if(_0x1a08fa[_0x97ea('0x30')][_0x97ea('0x4d')]){_0x279ece['where']=_[_0x97ea('0x36')](_0x279ece[_0x97ea('0x27')],{'$or':_['map'](_0x279ece['attributes'],function(_0x1680fa){var _0x36b067={};_0x36b067[_0x1680fa]={'$like':'%'+_0x1a08fa[_0x97ea('0x30')][_0x97ea('0x4d')]+'%'};return _0x36b067;})});}_0x279ece=_['merge']({},_0x279ece,_0x1a08fa[_0x97ea('0x4e')]);return _0x302c48[_0x97ea('0x78')](_0x279ece);}})[_0x97ea('0x18')](function(_0x55815c){if(_0x55815c){_0x2f6836=_0x55815c[_0x97ea('0x46')];if(!_0x1a08fa[_0x97ea('0x30')][_0x97ea('0x47')](_0x97ea('0x48'))){_0x279ece['limit']=qs[_0x97ea('0x14')](_0x1a08fa[_0x97ea('0x30')][_0x97ea('0x14')]);_0x279ece['offset']=qs[_0x97ea('0x12')](_0x1a08fa['query'][_0x97ea('0x12')]);}return _0x302c48[_0x97ea('0x78')](_0x279ece);}})['then'](function(_0x2fd5d2){if(_0x2fd5d2){return _0x2fd5d2?{'count':_0x2f6836,'rows':_0x2fd5d2}:null;}})[_0x97ea('0x18')](respondWithResult(_0x460ce6,null))[_0x97ea('0x2b')](handleError(_0x460ce6,null));}; \ No newline at end of file +var _0x44fe=['spread','userFaxQueue:save','removeAgents','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./faxQueue.socket','register','status','end','json','offset','limit','undefined','count','set','Content-Range','update','then','get','FaxQueues','UserProfileResource','destroy','sendStatus','stack','name','index','map','FaxQueue','fieldName','type','key','query','rows','catch','show','params','model','keys','attributes','intersection','fields','includeAll','include','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserFaxQueue','rawAttributes','filters','hasOwnProperty','nolimit','order','sort','where','pick','FaxQueueId','filter','options','User','findAndCountAll','agent','faxPause','updatedAt','format','%s/%s','SIP','createdAt','getTeams','Team','length','addTeams','ids','findAll','Agents','online','voicePause','flatMap','transaction','each','forEach','emit','select','field','tq.TeamId','from','team_has_fax_queues','user_has_teams','ut.UserId\x20=\x20?','push','sequelize','QueryTypes','every','all','union','value','isEmpty','userFaxQueue:remove','omit'];(function(_0x18546c,_0x4daf94){var _0x46ef43=function(_0x559377){while(--_0x559377){_0x18546c['push'](_0x18546c['shift']());}};_0x46ef43(++_0x4daf94);}(_0x44fe,0x16f));var _0xe44f=function(_0x421edd,_0x3764ad){_0x421edd=_0x421edd-0x0;var _0x381d1e=_0x44fe[_0x421edd];return _0x381d1e;};'use strict';var BPromise=require(_0xe44f('0x0'));var util=require(_0xe44f('0x1'));var _=require(_0xe44f('0x2'));var squel=require(_0xe44f('0x3'));var Redis=require(_0xe44f('0x4'));var qs=require(_0xe44f('0x5'));var logger=require(_0xe44f('0x6'))(_0xe44f('0x7'));var config=require(_0xe44f('0x8'));var db=require(_0xe44f('0x9'))['db'];config[_0xe44f('0xa')]=_['defaults'](config['redis'],{'host':_0xe44f('0xb'),'port':0x18eb});var socket=require(_0xe44f('0xc'))(new Redis(config['redis']));require(_0xe44f('0xd'))[_0xe44f('0xe')](socket);function respondWithStatusCode(_0x110de4,_0xdad72b){_0xdad72b=_0xdad72b||0xcc;return function(_0x47726a){if(_0x47726a){return _0x110de4['sendStatus'](_0xdad72b);}return _0x110de4[_0xe44f('0xf')](_0xdad72b)[_0xe44f('0x10')]();};}function respondWithResult(_0x44b180,_0x447184){_0x447184=_0x447184||0xc8;return function(_0x2d6ec5){if(_0x2d6ec5){return _0x44b180[_0xe44f('0xf')](_0x447184)[_0xe44f('0x11')](_0x2d6ec5);}};}function respondWithFilteredResult(_0xdb9b6c,_0x3b41c3){return function(_0x4971ab){if(_0x4971ab){var _0x1972ce=typeof _0x3b41c3[_0xe44f('0x12')]==='undefined'&&typeof _0x3b41c3[_0xe44f('0x13')]===_0xe44f('0x14');var _0x12cdf1=_0x4971ab[_0xe44f('0x15')];var _0x3c78e1=_0x1972ce?0x0:_0x3b41c3[_0xe44f('0x12')];var _0x3ec218=_0x1972ce?_0x4971ab[_0xe44f('0x15')]:_0x3b41c3['offset']+_0x3b41c3[_0xe44f('0x13')];var _0x1fa09f;if(_0x3ec218>=_0x12cdf1){_0x3ec218=_0x12cdf1;_0x1fa09f=0xc8;}else{_0x1fa09f=0xce;}_0xdb9b6c[_0xe44f('0xf')](_0x1fa09f);return _0xdb9b6c[_0xe44f('0x16')](_0xe44f('0x17'),_0x3c78e1+'-'+_0x3ec218+'/'+_0x12cdf1)[_0xe44f('0x11')](_0x4971ab);}return null;};}function saveUpdates(_0x3ee3f9){return function(_0x4029fe){if(_0x4029fe){return _0x4029fe[_0xe44f('0x18')](_0x3ee3f9)[_0xe44f('0x19')](function(_0x163af0){return _0x163af0;});}return null;};}function removeEntity(_0x3e7d5e){return function(_0x4c70e5){if(_0x4c70e5){return _0x4c70e5['destroy']()[_0xe44f('0x19')](function(){var _0x309a28=_0x4c70e5[_0xe44f('0x1a')]({'plain':!![]});var _0x117a30=_0xe44f('0x1b');return db[_0xe44f('0x1c')][_0xe44f('0x1d')]({'where':{'type':_0x117a30,'resourceId':_0x309a28['id']}})[_0xe44f('0x19')](function(){return _0x4c70e5;});})[_0xe44f('0x19')](function(){_0x3e7d5e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2756e3){return function(_0x3fe450){if(!_0x3fe450){_0x2756e3[_0xe44f('0x1e')](0x194);}return _0x3fe450;};}function handleError(_0x3f7ef8,_0xf3c259){_0xf3c259=_0xf3c259||0x1f4;return function(_0x538a03){logger['error'](_0x538a03[_0xe44f('0x1f')]);if(_0x538a03[_0xe44f('0x20')]){delete _0x538a03[_0xe44f('0x20')];}_0x3f7ef8[_0xe44f('0xf')](_0xf3c259)['send'](_0x538a03);};}exports[_0xe44f('0x21')]=function(_0xb84f2d,_0x384c82){var _0x90d216={};var _0x59667c={'count':0x0,'rows':[]};var _0x45a632=_[_0xe44f('0x22')](db[_0xe44f('0x23')]['rawAttributes'],function(_0x4e3cce){return{'name':_0x4e3cce[_0xe44f('0x24')],'type':_0x4e3cce[_0xe44f('0x25')][_0xe44f('0x26')]};});_0x90d216=qs['getOptions'](_0x45a632,_0xb84f2d);var _0x460e67={'where':_0x90d216['where']};return db[_0xe44f('0x23')][_0xe44f('0x15')](_0x460e67)[_0xe44f('0x19')](function(_0x50eba5){_0x59667c['count']=_0x50eba5;_0x90d216['include']=qs['include'](_0xb84f2d[_0xe44f('0x27')]);return db[_0xe44f('0x23')]['findAll'](_0x90d216);})[_0xe44f('0x19')](function(_0x180047){_0x59667c[_0xe44f('0x28')]=_0x180047;return _0x59667c;})[_0xe44f('0x19')](respondWithFilteredResult(_0x384c82,_0x90d216))[_0xe44f('0x29')](handleError(_0x384c82,null));};exports[_0xe44f('0x2a')]=function(_0x59788c,_0x2f22d9){var _0x5af7ff={'raw':!![],'where':{'id':_0x59788c[_0xe44f('0x2b')]['id']}},_0x366f19={};_0x366f19[_0xe44f('0x2c')]=_['keys'](db[_0xe44f('0x23')]['rawAttributes']);_0x366f19[_0xe44f('0x27')]=_[_0xe44f('0x2d')](_0x59788c[_0xe44f('0x27')]);_0x366f19['filters']=_['intersection'](_0x366f19[_0xe44f('0x2c')],_0x366f19[_0xe44f('0x27')]);_0x5af7ff[_0xe44f('0x2e')]=_[_0xe44f('0x2f')](_0x366f19['model'],qs[_0xe44f('0x30')](_0x59788c[_0xe44f('0x27')]['fields']));_0x5af7ff[_0xe44f('0x2e')]=_0x5af7ff[_0xe44f('0x2e')]['length']?_0x5af7ff[_0xe44f('0x2e')]:_0x366f19[_0xe44f('0x2c')];if(_0x59788c[_0xe44f('0x27')][_0xe44f('0x31')]){_0x5af7ff[_0xe44f('0x32')]=[{'all':!![]}];}_0x5af7ff=_[_0xe44f('0x33')]({},_0x5af7ff,_0x59788c['options']);return db['FaxQueue'][_0xe44f('0x34')](_0x5af7ff)['then'](handleEntityNotFound(_0x2f22d9,null))[_0xe44f('0x19')](respondWithResult(_0x2f22d9,null))[_0xe44f('0x29')](handleError(_0x2f22d9,null));};exports['create']=function(_0x9e5556,_0x41ff84){return db[_0xe44f('0x23')][_0xe44f('0x35')](_0x9e5556[_0xe44f('0x36')],{})[_0xe44f('0x19')](function(_0x2fe610){var _0x135cc2=_0x9e5556[_0xe44f('0x37')][_0xe44f('0x1a')]({'plain':!![]});if(!_0x135cc2)throw new Error(_0xe44f('0x38'));if(_0x135cc2[_0xe44f('0x39')]===_0xe44f('0x37')){var _0x2a82ca=_0x2fe610[_0xe44f('0x1a')]({'plain':!![]});var _0x1df395=_0xe44f('0x1b');return db[_0xe44f('0x3a')][_0xe44f('0x34')]({'where':{'name':_0x1df395,'userProfileId':_0x135cc2['userProfileId']},'raw':!![]})['then'](function(_0x22d813){if(_0x22d813&&_0x22d813[_0xe44f('0x3b')]===0x0){return db['UserProfileResource']['create']({'name':_0x2a82ca[_0xe44f('0x20')],'resourceId':_0x2a82ca['id'],'type':_0x22d813[_0xe44f('0x20')],'sectionId':_0x22d813['id']},{})[_0xe44f('0x19')](function(){return _0x2fe610;});}else{return _0x2fe610;}})[_0xe44f('0x29')](function(_0x5b38ac){logger[_0xe44f('0x3c')](_0xe44f('0x3d'),_0x5b38ac);throw _0x5b38ac;});}return _0x2fe610;})[_0xe44f('0x19')](respondWithResult(_0x41ff84,0xc9))[_0xe44f('0x29')](handleError(_0x41ff84,null));};exports[_0xe44f('0x18')]=function(_0x3b85a9,_0x481d88){if(_0x3b85a9[_0xe44f('0x36')]['id']){delete _0x3b85a9['body']['id'];}return db[_0xe44f('0x23')][_0xe44f('0x34')]({'where':{'id':_0x3b85a9[_0xe44f('0x2b')]['id']}})[_0xe44f('0x19')](handleEntityNotFound(_0x481d88,null))['then'](saveUpdates(_0x3b85a9['body'],null))[_0xe44f('0x19')](respondWithResult(_0x481d88,null))[_0xe44f('0x29')](handleError(_0x481d88,null));};exports['destroy']=function(_0x5ea96c,_0x53252b){return db[_0xe44f('0x23')][_0xe44f('0x34')]({'where':{'id':_0x5ea96c['params']['id']}})[_0xe44f('0x19')](handleEntityNotFound(_0x53252b,null))['then'](removeEntity(_0x53252b,null))[_0xe44f('0x29')](handleError(_0x53252b,null));};exports['describe']=function(_0x492030,_0x42ee16){return db[_0xe44f('0x23')][_0xe44f('0x3e')]()[_0xe44f('0x19')](respondWithResult(_0x42ee16,null))[_0xe44f('0x29')](handleError(_0x42ee16,null));};exports[_0xe44f('0x3f')]=function(_0x553e10,_0x14d87a){var _0x4bcba8={'raw':!![],'where':{}},_0x1177f4={},_0x39fe4f;return db[_0xe44f('0x23')][_0xe44f('0x40')]({'where':{'id':_0x553e10[_0xe44f('0x2b')]['id']}})['then'](handleEntityNotFound(_0x14d87a,null))[_0xe44f('0x19')](function(_0x4c2259){if(_0x4c2259){_0x39fe4f=_0x4c2259['get']({'plain':!![]});_0x1177f4['model']=_[_0xe44f('0x2d')](db[_0xe44f('0x41')][_0xe44f('0x42')]);_0x1177f4[_0xe44f('0x27')]=_['keys'](_0x553e10[_0xe44f('0x27')]);_0x1177f4[_0xe44f('0x43')]=_['intersection'](_0x1177f4[_0xe44f('0x2c')],_0x1177f4[_0xe44f('0x27')]);_0x4bcba8[_0xe44f('0x2e')]=_[_0xe44f('0x2f')](_0x1177f4['model'],qs[_0xe44f('0x30')](_0x553e10[_0xe44f('0x27')][_0xe44f('0x30')]));_0x4bcba8[_0xe44f('0x2e')]=_0x4bcba8[_0xe44f('0x2e')]['length']?_0x4bcba8[_0xe44f('0x2e')]:_0x1177f4[_0xe44f('0x2c')];if(!_0x553e10[_0xe44f('0x27')][_0xe44f('0x44')](_0xe44f('0x45'))){_0x4bcba8[_0xe44f('0x13')]=qs[_0xe44f('0x13')](_0x553e10[_0xe44f('0x27')]['limit']);_0x4bcba8[_0xe44f('0x12')]=qs[_0xe44f('0x12')](_0x553e10[_0xe44f('0x27')][_0xe44f('0x12')]);}_0x4bcba8[_0xe44f('0x46')]=qs[_0xe44f('0x47')](_0x553e10[_0xe44f('0x27')][_0xe44f('0x47')]);_0x4bcba8[_0xe44f('0x48')]=qs[_0xe44f('0x43')](_[_0xe44f('0x49')](_0x553e10['query'],_0x1177f4[_0xe44f('0x43')]));_0x4bcba8[_0xe44f('0x48')][_0xe44f('0x4a')]=_0x4c2259['id'];if(_0x553e10[_0xe44f('0x27')][_0xe44f('0x4b')]){_0x4bcba8['where']=_[_0xe44f('0x33')](_0x4bcba8[_0xe44f('0x48')],{'$or':_[_0xe44f('0x22')](_0x4bcba8[_0xe44f('0x2e')],function(_0x3c9556){var _0x2a3055={};_0x2a3055[_0x3c9556]={'$like':'%'+_0x553e10[_0xe44f('0x27')][_0xe44f('0x4b')]+'%'};return _0x2a3055;})});}_0x4bcba8=_[_0xe44f('0x33')]({},_0x4bcba8,_0x553e10[_0xe44f('0x4c')]);return db[_0xe44f('0x41')]['findAll'](_0x4bcba8);}})[_0xe44f('0x19')](function(_0xb01d5f){if(_0xb01d5f){return db[_0xe44f('0x4d')][_0xe44f('0x4e')]({'where':{'id':_['map'](_0xb01d5f,'UserId'),'role':_0xe44f('0x4f')},'attributes':['id',_0xe44f('0x20'),_0xe44f('0x50'),_0xe44f('0x51'),'createdAt']});}})[_0xe44f('0x19')](function(_0x106e02){if(_0x106e02){return{'count':_0x106e02[_0xe44f('0x15')],'rows':_['map'](_0x106e02[_0xe44f('0x28')],function(_0x2a2090){return{'membername':_0x2a2090[_0xe44f('0x20')],'UserId':_0x2a2090['id'],'queue_name':_0x39fe4f[_0xe44f('0x20')],'FaxQueueId':_0x39fe4f['id'],'interface':util[_0xe44f('0x52')](_0xe44f('0x53'),_0xe44f('0x54'),_0x2a2090[_0xe44f('0x20')]),'penalty':0x0,'paused':_0x2a2090['faxPause'],'createdAt':_0x2a2090[_0xe44f('0x55')],'updatedAt':_0x2a2090['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x14d87a,_0x4bcba8))[_0xe44f('0x29')](handleError(_0x14d87a,null));};exports[_0xe44f('0x56')]=function(_0x6382e8,_0x4839c6){var _0x493cc0={};var _0x52f53e={};var _0x1eb147;var _0xb781c7;return db['FaxQueue']['findOne']({'where':{'id':_0x6382e8[_0xe44f('0x2b')]['id']}})[_0xe44f('0x19')](handleEntityNotFound(_0x4839c6,null))[_0xe44f('0x19')](function(_0x4335ca){if(_0x4335ca){_0x1eb147=_0x4335ca;_0x52f53e['model']=_[_0xe44f('0x2d')](db[_0xe44f('0x57')]['rawAttributes']);_0x52f53e['query']=_[_0xe44f('0x2d')](_0x6382e8['query']);_0x52f53e[_0xe44f('0x43')]=_['intersection'](_0x52f53e[_0xe44f('0x2c')],_0x52f53e[_0xe44f('0x27')]);_0x493cc0[_0xe44f('0x2e')]=_[_0xe44f('0x2f')](_0x52f53e['model'],qs[_0xe44f('0x30')](_0x6382e8['query'][_0xe44f('0x30')]));_0x493cc0['attributes']=_0x493cc0[_0xe44f('0x2e')][_0xe44f('0x58')]?_0x493cc0[_0xe44f('0x2e')]:_0x52f53e[_0xe44f('0x2c')];_0x493cc0[_0xe44f('0x46')]=qs[_0xe44f('0x47')](_0x6382e8[_0xe44f('0x27')][_0xe44f('0x47')]);_0x493cc0[_0xe44f('0x48')]=qs['filters'](_['pick'](_0x6382e8[_0xe44f('0x27')],_0x52f53e['filters']));if(_0x6382e8[_0xe44f('0x27')][_0xe44f('0x4b')]){_0x493cc0[_0xe44f('0x48')]=_['merge'](_0x493cc0['where'],{'$or':_['map'](_0x493cc0[_0xe44f('0x2e')],function(_0x1b80ec){var _0x573734={};_0x573734[_0x1b80ec]={'$like':'%'+_0x6382e8[_0xe44f('0x27')][_0xe44f('0x4b')]+'%'};return _0x573734;})});}_0x493cc0=_['merge']({},_0x493cc0,_0x6382e8[_0xe44f('0x4c')]);return _0x1eb147['getTeams'](_0x493cc0);}})[_0xe44f('0x19')](function(_0x5d9bb3){if(_0x5d9bb3){_0xb781c7=_0x5d9bb3['length'];if(!_0x6382e8[_0xe44f('0x27')][_0xe44f('0x44')](_0xe44f('0x45'))){_0x493cc0[_0xe44f('0x13')]=qs[_0xe44f('0x13')](_0x6382e8[_0xe44f('0x27')]['limit']);_0x493cc0[_0xe44f('0x12')]=qs[_0xe44f('0x12')](_0x6382e8[_0xe44f('0x27')][_0xe44f('0x12')]);}return _0x1eb147[_0xe44f('0x56')](_0x493cc0);}})[_0xe44f('0x19')](function(_0x5ac123){if(_0x5ac123){return _0x5ac123?{'count':_0xb781c7,'rows':_0x5ac123}:null;}})[_0xe44f('0x19')](respondWithResult(_0x4839c6,null))[_0xe44f('0x29')](handleError(_0x4839c6,null));};exports[_0xe44f('0x59')]=function(_0x21ab43,_0x977bce){var _0x150561=_0x21ab43['body'][_0xe44f('0x5a')];return db['Team'][_0xe44f('0x5b')]({'where':{'id':_0x150561},'attributes':['id'],'include':[{'model':db[_0xe44f('0x4d')],'as':_0xe44f('0x5c'),'attributes':['id',_0xe44f('0x20'),_0xe44f('0x5d'),_0xe44f('0x5e'),'interface'],'raw':!![]}]})[_0xe44f('0x19')](function(_0xf654c8){if(_0xf654c8){var _0x3dd3cd=_[_0xe44f('0x5f')](_0xf654c8,function(_0x3de607){var _0x36a9c8=_0x3de607[_0xe44f('0x1a')]({'plain':!![]});return _0x36a9c8[_0xe44f('0x5c')];});return db[_0xe44f('0x23')][_0xe44f('0x34')]({'where':{'id':_0x21ab43[_0xe44f('0x2b')]['id']}})[_0xe44f('0x19')](function(_0x39c48d){return db['sequelize'][_0xe44f('0x60')](function(_0x1da6ff){return _0x39c48d[_0xe44f('0x59')](_0x150561,{'transaction':_0x1da6ff})[_0xe44f('0x19')](function(){return BPromise[_0xe44f('0x61')](_0x3dd3cd,function(_0x174a12){return db[_0xe44f('0x41')]['findOrCreate']({'where':{'UserId':_0x174a12['id'],'FaxQueueId':_0x21ab43[_0xe44f('0x2b')]['id']},'transaction':_0x1da6ff});});})[_0xe44f('0x19')](function(){_0x3dd3cd[_0xe44f('0x62')](function(_0x2b1f60){socket[_0xe44f('0x63')]('userFaxQueue:save',{'UserId':_0x2b1f60['id'],'FaxQueueId':_0x39c48d['id']});});});});});}})['then'](respondWithStatusCode(_0x977bce,null))['catch'](handleError(_0x977bce,null));};exports['removeTeams']=function(_0x5f08f2,_0x132d0c){return db[_0xe44f('0x57')][_0xe44f('0x5b')]({'where':{'id':_0x5f08f2[_0xe44f('0x27')][_0xe44f('0x5a')]},'attributes':['id'],'include':[{'model':db[_0xe44f('0x4d')],'as':_0xe44f('0x5c'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x132d0c,null))[_0xe44f('0x19')](function(_0x7f9f9d){var _0x440ad9=_['map'](_0x7f9f9d,'id');var _0x5b22ae=[];var _0x22512b=[];var _0x417197=squel[_0xe44f('0x64')]();_0x417197[_0xe44f('0x65')](_0xe44f('0x66'))[_0xe44f('0x67')](_0xe44f('0x68'),'tq')['join'](_0xe44f('0x69'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xe44f('0x48')]('FaxQueueId\x20=\x20?',_0x5f08f2['params']['id']);for(var _0x37f52c=0x0;_0x37f52c<_0x7f9f9d['length'];_0x37f52c+=0x1){let _0x4c4a68=_0x7f9f9d[_0x37f52c];for(var _0x2aea58=0x0;_0x2aea58<_0x4c4a68[_0xe44f('0x5c')][_0xe44f('0x58')];_0x2aea58+=0x1){let _0x4f07ce=_0x4c4a68['Agents'][_0x2aea58];var _0x183dd1=_0x417197['clone']();_0x183dd1[_0xe44f('0x48')](_0xe44f('0x6a'),_0x4f07ce['id']);_0x22512b[_0xe44f('0x6b')](db[_0xe44f('0x6c')][_0xe44f('0x27')](_0x183dd1['toString'](),{'type':db['sequelize'][_0xe44f('0x6d')]['SELECT']})[_0xe44f('0x19')](function(_0x5ca74e){if(_0x5ca74e[_0xe44f('0x58')]===0x1){return _0x4f07ce['id'];}else{var _0x36eb20=_[_0xe44f('0x6e')](_[_0xe44f('0x22')](_0x5ca74e,'TeamId'),function(_0x304b91){return _['includes'](_0x440ad9,_0x304b91);});if(_0x36eb20){return _0x4f07ce['id'];}}}));}}return BPromise[_0xe44f('0x6f')](_0x22512b)[_0xe44f('0x19')](function(_0x107f16){_0x5b22ae=_(_0x5b22ae)[_0xe44f('0x70')](_0x107f16)['compact']()[_0xe44f('0x71')]();return db[_0xe44f('0x23')][_0xe44f('0x34')]({'where':{'id':_0x5f08f2[_0xe44f('0x2b')]['id']}})[_0xe44f('0x19')](function(_0x268486){return db[_0xe44f('0x6c')]['transaction'](function(_0x4e7f54){return _0x268486['removeTeams'](_0x5f08f2[_0xe44f('0x27')][_0xe44f('0x5a')],{'transaction':_0x4e7f54})['then'](function(){if(!_[_0xe44f('0x72')](_0x5b22ae)){return _0x268486['removeAgents'](_0x5b22ae,{'transaction':_0x4e7f54});}})['then'](function(){_0x5b22ae['forEach'](function(_0x3be1bd){socket['emit'](_0xe44f('0x73'),{'UserId':_0x3be1bd,'FaxQueueId':_0x268486['id']});});});});});});})[_0xe44f('0x19')](respondWithStatusCode(_0x132d0c,null))['catch'](handleError(_0x132d0c,null));};exports['addAgents']=function(_0x56c0c5,_0x50111c){return db[_0xe44f('0x23')][_0xe44f('0x34')]({'where':{'id':_0x56c0c5['params']['id']}})[_0xe44f('0x19')](handleEntityNotFound(_0x50111c,null))[_0xe44f('0x19')](function(_0x52cf4e){if(_0x52cf4e){return _0x52cf4e['addAgents'](_0x56c0c5['body'][_0xe44f('0x5a')],_[_0xe44f('0x74')](_0x56c0c5[_0xe44f('0x36')],['ids','id'])||{})[_0xe44f('0x75')](function(_0x1f87a5){for(var _0x122f4d=0x0;_0x122f4d<_0x56c0c5['body'][_0xe44f('0x5a')][_0xe44f('0x58')];_0x122f4d+=0x1){socket[_0xe44f('0x63')](_0xe44f('0x76'),{'UserId':Number(_0x56c0c5[_0xe44f('0x36')]['ids'][_0x122f4d]),'FaxQueueId':Number(_0x56c0c5[_0xe44f('0x2b')]['id'])});}return _0x1f87a5;});}})[_0xe44f('0x19')](respondWithResult(_0x50111c,null))[_0xe44f('0x29')](handleError(_0x50111c,null));};exports[_0xe44f('0x77')]=function(_0x4a4972,_0x14c855){return db[_0xe44f('0x23')]['find']({'where':{'id':_0x4a4972['params']['id']}})[_0xe44f('0x19')](handleEntityNotFound(_0x14c855,null))[_0xe44f('0x19')](function(_0xa5720a){if(_0xa5720a){return _0xa5720a['removeAgents'](_0x4a4972[_0xe44f('0x27')][_0xe44f('0x5a')])[_0xe44f('0x19')](function(){if(_['isArray'](_0x4a4972[_0xe44f('0x27')][_0xe44f('0x5a')])){for(var _0x42f17a=0x0;_0x42f17a<_0x4a4972['query'][_0xe44f('0x5a')][_0xe44f('0x58')];_0x42f17a+=0x1){socket['emit'](_0xe44f('0x73'),{'UserId':Number(_0x4a4972[_0xe44f('0x27')][_0xe44f('0x5a')][_0x42f17a]),'FaxQueueId':Number(_0x4a4972['params']['id'])});}}else{socket[_0xe44f('0x63')](_0xe44f('0x73'),{'UserId':Number(_0x4a4972[_0xe44f('0x27')][_0xe44f('0x5a')]),'FaxQueueId':Number(_0x4a4972['params']['id'])});}});}})[_0xe44f('0x19')](respondWithStatusCode(_0x14c855,null))[_0xe44f('0x29')](handleError(_0x14c855,null));};exports[_0xe44f('0x78')]=function(_0x42b38e,_0x1e7da6){var _0x51c2d8={};var _0x25d94b={};var _0x6c249c;var _0x3c1cb6;return db[_0xe44f('0x23')][_0xe44f('0x40')]({'where':{'id':_0x42b38e[_0xe44f('0x2b')]['id']}})[_0xe44f('0x19')](handleEntityNotFound(_0x1e7da6,null))[_0xe44f('0x19')](function(_0x36359c){if(_0x36359c){_0x6c249c=_0x36359c;_0x25d94b['model']=_[_0xe44f('0x2d')](db[_0xe44f('0x4d')][_0xe44f('0x42')]);_0x25d94b[_0xe44f('0x27')]=_[_0xe44f('0x2d')](_0x42b38e[_0xe44f('0x27')]);_0x25d94b[_0xe44f('0x43')]=_[_0xe44f('0x2f')](_0x25d94b[_0xe44f('0x2c')],_0x25d94b[_0xe44f('0x27')]);_0x51c2d8['attributes']=_['intersection'](_0x25d94b['model'],qs[_0xe44f('0x30')](_0x42b38e['query']['fields']));_0x51c2d8[_0xe44f('0x2e')]=_0x51c2d8['attributes'][_0xe44f('0x58')]?_0x51c2d8[_0xe44f('0x2e')]:_0x25d94b['model'];_0x51c2d8[_0xe44f('0x46')]=qs['sort'](_0x42b38e[_0xe44f('0x27')][_0xe44f('0x47')]);_0x51c2d8[_0xe44f('0x48')]=qs[_0xe44f('0x43')](_[_0xe44f('0x49')](_0x42b38e[_0xe44f('0x27')],_0x25d94b[_0xe44f('0x43')]));if(_0x42b38e['query'][_0xe44f('0x4b')]){_0x51c2d8[_0xe44f('0x48')]=_[_0xe44f('0x33')](_0x51c2d8['where'],{'$or':_[_0xe44f('0x22')](_0x51c2d8['attributes'],function(_0x2c4774){var _0x5b5476={};_0x5b5476[_0x2c4774]={'$like':'%'+_0x42b38e[_0xe44f('0x27')][_0xe44f('0x4b')]+'%'};return _0x5b5476;})});}_0x51c2d8=_[_0xe44f('0x33')]({},_0x51c2d8,_0x42b38e[_0xe44f('0x4c')]);return _0x6c249c[_0xe44f('0x78')](_0x51c2d8);}})[_0xe44f('0x19')](function(_0xe42016){if(_0xe42016){_0x3c1cb6=_0xe42016['length'];if(!_0x42b38e[_0xe44f('0x27')][_0xe44f('0x44')](_0xe44f('0x45'))){_0x51c2d8[_0xe44f('0x13')]=qs[_0xe44f('0x13')](_0x42b38e[_0xe44f('0x27')][_0xe44f('0x13')]);_0x51c2d8[_0xe44f('0x12')]=qs['offset'](_0x42b38e[_0xe44f('0x27')][_0xe44f('0x12')]);}return _0x6c249c[_0xe44f('0x78')](_0x51c2d8);}})['then'](function(_0x59ac0c){if(_0x59ac0c){return _0x59ac0c?{'count':_0x3c1cb6,'rows':_0x59ac0c}:null;}})[_0xe44f('0x19')](respondWithResult(_0x1e7da6,null))[_0xe44f('0x29')](handleError(_0x1e7da6,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 2b5ae7c..326af2d 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 _0xd555=['exports','events','../../mysqldb','FaxQueue','setMaxListeners','save','update','remove','emit','hook'];(function(_0x45fe84,_0xa0c882){var _0x2e7fba=function(_0x2f1b29){while(--_0x2f1b29){_0x45fe84['push'](_0x45fe84['shift']());}};_0x2e7fba(++_0xa0c882);}(_0xd555,0x79));var _0x5d55=function(_0x287eaf,_0x41d318){_0x287eaf=_0x287eaf-0x0;var _0x321683=_0xd555[_0x287eaf];return _0x321683;};'use strict';var EventEmitter=require(_0x5d55('0x0'));var FaxQueue=require(_0x5d55('0x1'))['db'][_0x5d55('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x5d55('0x3')](0x0);var events={'afterCreate':_0x5d55('0x4'),'afterUpdate':_0x5d55('0x5'),'afterDestroy':_0x5d55('0x6')};function emitEvent(_0xe0afa3){return function(_0x1f3eb0,_0x1b6486,_0x2ca855){FaxQueueEvents[_0x5d55('0x7')](_0xe0afa3+':'+_0x1f3eb0['id'],_0x1f3eb0);FaxQueueEvents['emit'](_0xe0afa3,_0x1f3eb0);_0x2ca855(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0x5d55('0x8')](e,emitEvent(event));}}module[_0x5d55('0x9')]=FaxQueueEvents; \ No newline at end of file +var _0xe0ed=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxQueue','setMaxListeners','update'];(function(_0x343f90,_0x45c683){var _0x1cb9d2=function(_0x1791e8){while(--_0x1791e8){_0x343f90['push'](_0x343f90['shift']());}};_0x1cb9d2(++_0x45c683);}(_0xe0ed,0x67));var _0xde0e=function(_0x398668,_0x1296d2){_0x398668=_0x398668-0x0;var _0x9de1a0=_0xe0ed[_0x398668];return _0x9de1a0;};'use strict';var EventEmitter=require(_0xde0e('0x0'));var FaxQueue=require(_0xde0e('0x1'))['db'][_0xde0e('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xde0e('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xde0e('0x4'),'afterDestroy':'remove'};function emitEvent(_0xb1863b){return function(_0x467cf8,_0x2797c2,_0x53b17b){FaxQueueEvents[_0xde0e('0x5')](_0xb1863b+':'+_0x467cf8['id'],_0x467cf8);FaxQueueEvents[_0xde0e('0x5')](_0xb1863b,_0x467cf8);_0x53b17b(null);};}for(var e in events){if(events[_0xde0e('0x6')](e)){var event=events[e];FaxQueue[_0xde0e('0x7')](e,emitEvent(event));}}module[_0xde0e('0x8')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 06bf192..7c193a2 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 _0x673d=['exports','define','FaxQueue','fax_queues','lodash','util','../../config/logger','moment','request-promise','path','rimraf','./faxQueue.attributes'];(function(_0x2fba8c,_0x481c79){var _0xb38404=function(_0x1adf97){while(--_0x1adf97){_0x2fba8c['push'](_0x2fba8c['shift']());}};_0xb38404(++_0x481c79);}(_0x673d,0x1e4));var _0xd673=function(_0x2035ef,_0x3f7d39){_0x2035ef=_0x2035ef-0x0;var _0x86c909=_0x673d[_0x2035ef];return _0x86c909;};'use strict';var _=require(_0xd673('0x0'));var util=require(_0xd673('0x1'));var logger=require(_0xd673('0x2'))('api');var moment=require(_0xd673('0x3'));var BPromise=require('bluebird');var rp=require(_0xd673('0x4'));var fs=require('fs');var path=require(_0xd673('0x5'));var rimraf=require(_0xd673('0x6'));var config=require('../../config/environment');var attributes=require(_0xd673('0x7'));module[_0xd673('0x8')]=function(_0x33f132,_0x15674f){return _0x33f132[_0xd673('0x9')](_0xd673('0xa'),attributes,{'tableName':_0xd673('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x597b=['bluebird','request-promise','path','rimraf','exports','fax_queues','lodash','util','api','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x597b,0x1e6));var _0xb597=function(_0x3be29b,_0x279376){_0x3be29b=_0x3be29b-0x0;var _0x1c2cf2=_0x597b[_0x3be29b];return _0x1c2cf2;};'use strict';var _=require(_0xb597('0x0'));var util=require(_0xb597('0x1'));var logger=require('../../config/logger')(_0xb597('0x2'));var moment=require(_0xb597('0x3'));var BPromise=require(_0xb597('0x4'));var rp=require(_0xb597('0x5'));var fs=require('fs');var path=require(_0xb597('0x6'));var rimraf=require(_0xb597('0x7'));var config=require('../../config/environment');var attributes=require('./faxQueue.attributes');module[_0xb597('0x8')]=function(_0x1d6a58,_0x20a565){return _0x1d6a58['define']('FaxQueue',attributes,{'tableName':_0xb597('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index 96fda0f..255ec6d 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 _0xfc68=['options','raw','where','attributes','limit','include','map','model','ShowFaxQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','request','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetFaxQueue','FaxQueue','findAll'];(function(_0x19115e,_0x507bab){var _0x45bbd4=function(_0x1308bf){while(--_0x1308bf){_0x19115e['push'](_0x19115e['shift']());}};_0x45bbd4(++_0x507bab);}(_0xfc68,0x8b));var _0x8fc6=function(_0x557081,_0x5e7589){_0x557081=_0x557081-0x0;var _0x373575=_0xfc68[_0x557081];return _0x373575;};'use strict';var _=require(_0x8fc6('0x0'));var util=require(_0x8fc6('0x1'));var moment=require(_0x8fc6('0x2'));var BPromise=require(_0x8fc6('0x3'));var rs=require(_0x8fc6('0x4'));var fs=require('fs');var Redis=require(_0x8fc6('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x8fc6('0x6'));var logger=require(_0x8fc6('0x7'))(_0x8fc6('0x8'));var config=require(_0x8fc6('0x9'));var jayson=require(_0x8fc6('0xa'));var client=jayson[_0x8fc6('0xb')][_0x8fc6('0xc')]({'port':0x232a});config[_0x8fc6('0xd')]=_[_0x8fc6('0xe')](config['redis'],{'host':_0x8fc6('0xf'),'port':0x18eb});var socket=require(_0x8fc6('0x10'))(new Redis(config[_0x8fc6('0xd')]));require(_0x8fc6('0x11'))[_0x8fc6('0x12')](socket);function respondWithRpcPromise(_0x4937d3,_0x54ff2f,_0x2df7df){return new BPromise(function(_0x304a47,_0x1a2ba0){return client[_0x8fc6('0x13')](_0x4937d3,_0x2df7df)[_0x8fc6('0x14')](function(_0x31fa4d){logger[_0x8fc6('0x15')](_0x8fc6('0x16'),_0x54ff2f,_0x8fc6('0x17'));logger[_0x8fc6('0x18')](_0x8fc6('0x19'),_0x54ff2f,_0x8fc6('0x17'),JSON[_0x8fc6('0x1a')](_0x31fa4d));if(_0x31fa4d['error']){if(_0x31fa4d[_0x8fc6('0x1b')]['code']===0x1f4){logger['error']('FaxQueue,\x20%s,\x20%s',_0x54ff2f,_0x31fa4d[_0x8fc6('0x1b')]['message']);return _0x1a2ba0(_0x31fa4d[_0x8fc6('0x1b')][_0x8fc6('0x1c')]);}logger[_0x8fc6('0x1b')](_0x8fc6('0x16'),_0x54ff2f,_0x31fa4d[_0x8fc6('0x1b')][_0x8fc6('0x1c')]);return _0x304a47(_0x31fa4d[_0x8fc6('0x1b')][_0x8fc6('0x1c')]);}else{logger['info'](_0x8fc6('0x16'),_0x54ff2f,_0x8fc6('0x17'));_0x304a47(_0x31fa4d['result'][_0x8fc6('0x1c')]);}})[_0x8fc6('0x1d')](function(_0x38484b){logger[_0x8fc6('0x1b')](_0x8fc6('0x16'),_0x54ff2f,_0x38484b);_0x1a2ba0(_0x38484b);});});}exports[_0x8fc6('0x1e')]=function(_0x5e68e3){var _0x20b948=this;return new Promise(function(_0x4198ef,_0x1724d5){return db[_0x8fc6('0x1f')][_0x8fc6('0x20')]({'raw':_0x5e68e3[_0x8fc6('0x21')]?_0x5e68e3['options'][_0x8fc6('0x22')]===undefined?!![]:![]:!![],'where':_0x5e68e3[_0x8fc6('0x21')]?_0x5e68e3[_0x8fc6('0x21')][_0x8fc6('0x23')]||null:null,'attributes':_0x5e68e3[_0x8fc6('0x21')]?_0x5e68e3[_0x8fc6('0x21')][_0x8fc6('0x24')]||null:null,'limit':_0x5e68e3[_0x8fc6('0x21')]?_0x5e68e3[_0x8fc6('0x21')][_0x8fc6('0x25')]||null:null,'include':_0x5e68e3[_0x8fc6('0x21')]?_0x5e68e3['options'][_0x8fc6('0x26')]?_[_0x8fc6('0x27')](_0x5e68e3[_0x8fc6('0x21')]['include'],function(_0x539e65){return{'model':db[_0x539e65[_0x8fc6('0x28')]],'as':_0x539e65['as'],'attributes':_0x539e65[_0x8fc6('0x24')],'include':_0x539e65['include']?_[_0x8fc6('0x27')](_0x539e65[_0x8fc6('0x26')],function(_0x1ee5a2){return{'model':db[_0x1ee5a2[_0x8fc6('0x28')]],'as':_0x1ee5a2['as'],'attributes':_0x1ee5a2[_0x8fc6('0x24')],'include':_0x1ee5a2[_0x8fc6('0x26')]?_[_0x8fc6('0x27')](_0x1ee5a2[_0x8fc6('0x26')],function(_0x391ae0){return{'model':db[_0x391ae0[_0x8fc6('0x28')]],'as':_0x391ae0['as'],'attributes':_0x391ae0['attributes']};}):[]};}):[]};}):[]:[]})[_0x8fc6('0x14')](function(_0x490043){logger['info']('GetFaxQueue',_0x5e68e3);logger['debug']('GetFaxQueue',_0x5e68e3,JSON['stringify'](_0x490043));_0x4198ef(_0x490043);})['catch'](function(_0x43cd43){logger[_0x8fc6('0x1b')](_0x8fc6('0x1e'),_0x43cd43[_0x8fc6('0x1c')],_0x5e68e3);_0x1724d5(_0x20b948[_0x8fc6('0x1b')](0x1f4,_0x43cd43[_0x8fc6('0x1c')]));});});};exports[_0x8fc6('0x29')]=function(_0x79d312){var _0xbe25f4=this;return new Promise(function(_0x2ef715,_0x123499){return db[_0x8fc6('0x1f')][_0x8fc6('0x2a')]({'raw':_0x79d312[_0x8fc6('0x21')]?_0x79d312[_0x8fc6('0x21')][_0x8fc6('0x22')]===undefined?!![]:![]:!![],'where':_0x79d312[_0x8fc6('0x21')]?_0x79d312[_0x8fc6('0x21')][_0x8fc6('0x23')]||null:null,'attributes':_0x79d312['options']?_0x79d312[_0x8fc6('0x21')]['attributes']||null:null,'include':_0x79d312[_0x8fc6('0x21')]?_0x79d312['options']['include']?_[_0x8fc6('0x27')](_0x79d312[_0x8fc6('0x21')]['include'],function(_0x446152){return{'model':db[_0x446152[_0x8fc6('0x28')]],'as':_0x446152['as'],'attributes':_0x446152[_0x8fc6('0x24')],'include':_0x446152[_0x8fc6('0x26')]?_['map'](_0x446152['include'],function(_0x574592){return{'model':db[_0x574592[_0x8fc6('0x28')]],'as':_0x574592['as'],'attributes':_0x574592[_0x8fc6('0x24')],'include':_0x574592[_0x8fc6('0x26')]?_[_0x8fc6('0x27')](_0x574592[_0x8fc6('0x26')],function(_0x1e56f7){return{'model':db[_0x1e56f7[_0x8fc6('0x28')]],'as':_0x1e56f7['as'],'attributes':_0x1e56f7['attributes']};}):[]};}):[]};}):[]:[]})[_0x8fc6('0x14')](function(_0x2762d0){logger[_0x8fc6('0x15')](_0x8fc6('0x29'),_0x79d312);logger['debug']('ShowFaxQueue',_0x79d312,JSON['stringify'](_0x2762d0));_0x2ef715(_0x2762d0);})[_0x8fc6('0x1d')](function(_0x241cd1){logger['error'](_0x8fc6('0x29'),_0x241cd1[_0x8fc6('0x1c')],_0x79d312);_0x123499(_0xbe25f4[_0x8fc6('0x1b')](0x1f4,_0x241cd1['message']));});});}; \ No newline at end of file +var _0xcbaa=['error','code','message','request\x20sent','GetFaxQueue','FaxQueue','findAll','options','where','attributes','limit','include','map','model','then','catch','ShowFaxQueue','find','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','defaults','redis','./faxQueue.socket','register','request','info','FaxQueue,\x20%s,\x20%s','debug','stringify'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcbaa,0x1e7));var _0xacba=function(_0x3ccdf8,_0x584ceb){_0x3ccdf8=_0x3ccdf8-0x0;var _0x243dab=_0xcbaa[_0x3ccdf8];return _0x243dab;};'use strict';var _=require(_0xacba('0x0'));var util=require(_0xacba('0x1'));var moment=require(_0xacba('0x2'));var BPromise=require(_0xacba('0x3'));var rs=require(_0xacba('0x4'));var fs=require('fs');var Redis=require(_0xacba('0x5'));var db=require(_0xacba('0x6'))['db'];var utils=require(_0xacba('0x7'));var logger=require('../../config/logger')(_0xacba('0x8'));var config=require(_0xacba('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xacba('0xa')]['http']({'port':0x232a});config['redis']=_[_0xacba('0xb')](config[_0xacba('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xacba('0xd'))[_0xacba('0xe')](socket);function respondWithRpcPromise(_0x6c7107,_0x2443cc,_0x4c698e){return new BPromise(function(_0x402402,_0x3c1d74){return client[_0xacba('0xf')](_0x6c7107,_0x4c698e)['then'](function(_0x195168){logger[_0xacba('0x10')](_0xacba('0x11'),_0x2443cc,'request\x20sent');logger[_0xacba('0x12')]('FaxQueue,\x20%s,\x20%s,\x20%s',_0x2443cc,'request\x20sent',JSON[_0xacba('0x13')](_0x195168));if(_0x195168[_0xacba('0x14')]){if(_0x195168[_0xacba('0x14')][_0xacba('0x15')]===0x1f4){logger[_0xacba('0x14')](_0xacba('0x11'),_0x2443cc,_0x195168['error'][_0xacba('0x16')]);return _0x3c1d74(_0x195168[_0xacba('0x14')][_0xacba('0x16')]);}logger['error'](_0xacba('0x11'),_0x2443cc,_0x195168['error'][_0xacba('0x16')]);return _0x402402(_0x195168[_0xacba('0x14')][_0xacba('0x16')]);}else{logger[_0xacba('0x10')]('FaxQueue,\x20%s,\x20%s',_0x2443cc,_0xacba('0x17'));_0x402402(_0x195168['result'][_0xacba('0x16')]);}})['catch'](function(_0x4b83c9){logger[_0xacba('0x14')](_0xacba('0x11'),_0x2443cc,_0x4b83c9);_0x3c1d74(_0x4b83c9);});});}exports[_0xacba('0x18')]=function(_0x41c525){var _0x21ab18=this;return new Promise(function(_0x5d1f88,_0xe131cf){return db[_0xacba('0x19')][_0xacba('0x1a')]({'raw':_0x41c525[_0xacba('0x1b')]?_0x41c525[_0xacba('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x41c525['options']?_0x41c525[_0xacba('0x1b')][_0xacba('0x1c')]||null:null,'attributes':_0x41c525[_0xacba('0x1b')]?_0x41c525[_0xacba('0x1b')][_0xacba('0x1d')]||null:null,'limit':_0x41c525[_0xacba('0x1b')]?_0x41c525[_0xacba('0x1b')][_0xacba('0x1e')]||null:null,'include':_0x41c525[_0xacba('0x1b')]?_0x41c525[_0xacba('0x1b')][_0xacba('0x1f')]?_[_0xacba('0x20')](_0x41c525[_0xacba('0x1b')][_0xacba('0x1f')],function(_0x4e7d2d){return{'model':db[_0x4e7d2d['model']],'as':_0x4e7d2d['as'],'attributes':_0x4e7d2d[_0xacba('0x1d')],'include':_0x4e7d2d['include']?_[_0xacba('0x20')](_0x4e7d2d[_0xacba('0x1f')],function(_0xfe878a){return{'model':db[_0xfe878a[_0xacba('0x21')]],'as':_0xfe878a['as'],'attributes':_0xfe878a[_0xacba('0x1d')],'include':_0xfe878a[_0xacba('0x1f')]?_[_0xacba('0x20')](_0xfe878a[_0xacba('0x1f')],function(_0x2f56e5){return{'model':db[_0x2f56e5[_0xacba('0x21')]],'as':_0x2f56e5['as'],'attributes':_0x2f56e5[_0xacba('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xacba('0x22')](function(_0x51cc8e){logger[_0xacba('0x10')](_0xacba('0x18'),_0x41c525);logger[_0xacba('0x12')](_0xacba('0x18'),_0x41c525,JSON[_0xacba('0x13')](_0x51cc8e));_0x5d1f88(_0x51cc8e);})[_0xacba('0x23')](function(_0x594a39){logger['error'](_0xacba('0x18'),_0x594a39[_0xacba('0x16')],_0x41c525);_0xe131cf(_0x21ab18[_0xacba('0x14')](0x1f4,_0x594a39[_0xacba('0x16')]));});});};exports[_0xacba('0x24')]=function(_0x320bbf){var _0x81cc15=this;return new Promise(function(_0xe09720,_0x532578){return db['FaxQueue'][_0xacba('0x25')]({'raw':_0x320bbf[_0xacba('0x1b')]?_0x320bbf[_0xacba('0x1b')][_0xacba('0x26')]===undefined?!![]:![]:!![],'where':_0x320bbf['options']?_0x320bbf[_0xacba('0x1b')]['where']||null:null,'attributes':_0x320bbf[_0xacba('0x1b')]?_0x320bbf['options'][_0xacba('0x1d')]||null:null,'include':_0x320bbf[_0xacba('0x1b')]?_0x320bbf[_0xacba('0x1b')]['include']?_[_0xacba('0x20')](_0x320bbf[_0xacba('0x1b')][_0xacba('0x1f')],function(_0xf51f18){return{'model':db[_0xf51f18[_0xacba('0x21')]],'as':_0xf51f18['as'],'attributes':_0xf51f18[_0xacba('0x1d')],'include':_0xf51f18[_0xacba('0x1f')]?_[_0xacba('0x20')](_0xf51f18[_0xacba('0x1f')],function(_0x65f34f){return{'model':db[_0x65f34f[_0xacba('0x21')]],'as':_0x65f34f['as'],'attributes':_0x65f34f['attributes'],'include':_0x65f34f[_0xacba('0x1f')]?_['map'](_0x65f34f[_0xacba('0x1f')],function(_0x639ccc){return{'model':db[_0x639ccc[_0xacba('0x21')]],'as':_0x639ccc['as'],'attributes':_0x639ccc[_0xacba('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xacba('0x22')](function(_0x48a176){logger[_0xacba('0x10')]('ShowFaxQueue',_0x320bbf);logger['debug'](_0xacba('0x24'),_0x320bbf,JSON[_0xacba('0x13')](_0x48a176));_0xe09720(_0x48a176);})[_0xacba('0x23')](function(_0x240750){logger[_0xacba('0x14')](_0xacba('0x24'),_0x240750['message'],_0x320bbf);_0x532578(_0x81cc15[_0xacba('0x14')](0x1f4,_0x240750[_0xacba('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 4343b8a..2f17786 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 _0x6d42=['faxQueue:','./faxQueue.events','removeListener','register','length'];(function(_0x26bf51,_0x5e261a){var _0x503415=function(_0x92b028){while(--_0x92b028){_0x26bf51['push'](_0x26bf51['shift']());}};_0x503415(++_0x5e261a);}(_0x6d42,0x1a0));var _0x26d4=function(_0x4fff57,_0x78c14e){_0x4fff57=_0x4fff57-0x0;var _0xcd11b9=_0x6d42[_0x4fff57];return _0xcd11b9;};'use strict';var FaxQueueEvents=require(_0x26d4('0x0'));var events=['save','remove','update'];function createListener(_0x5a4ea6,_0x4b5ab0){return function(_0x36f131){_0x4b5ab0['emit'](_0x5a4ea6,_0x36f131);};}function removeListener(_0x534050,_0xbc0956){return function(){FaxQueueEvents[_0x26d4('0x1')](_0x534050,_0xbc0956);};}exports[_0x26d4('0x2')]=function(_0x23f797){for(var _0x110107=0x0,_0x542e72=events[_0x26d4('0x3')];_0x110107<_0x542e72;_0x110107++){var _0x294563=events[_0x110107];var _0x5bcae1=createListener(_0x26d4('0x4')+_0x294563,_0x23f797);FaxQueueEvents['on'](_0x294563,_0x5bcae1);}}; \ No newline at end of file +var _0xa936=['save','remove','update','emit','removeListener','register','length','faxQueue:','./faxQueue.events'];(function(_0x16964c,_0x549a38){var _0x5fe6fe=function(_0x55cc2d){while(--_0x55cc2d){_0x16964c['push'](_0x16964c['shift']());}};_0x5fe6fe(++_0x549a38);}(_0xa936,0x15e));var _0x6a93=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0xa936[_0x8c43de];return _0xa6591b;};'use strict';var FaxQueueEvents=require(_0x6a93('0x0'));var events=[_0x6a93('0x1'),_0x6a93('0x2'),_0x6a93('0x3')];function createListener(_0x452dd3,_0x4e9e62){return function(_0x3bc88d){_0x4e9e62[_0x6a93('0x4')](_0x452dd3,_0x3bc88d);};}function removeListener(_0x19628f,_0x121b02){return function(){FaxQueueEvents[_0x6a93('0x5')](_0x19628f,_0x121b02);};}exports[_0x6a93('0x6')]=function(_0x3a9ac2){for(var _0x262b5a=0x0,_0x1b749a=events[_0x6a93('0x7')];_0x262b5a<_0x1b749a;_0x262b5a++){var _0x51fb63=events[_0x262b5a];var _0x16fe66=createListener(_0x6a93('0x8')+_0x51fb63,_0x3a9ac2);FaxQueueEvents['on'](_0x51fb63,_0x16fe66);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index f62e00b..9620f01 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 _0x7524=['express','Router','../../components/interaction/service','./faxQueue.controller','get','isAuthenticated','index','describe','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addAgents','put','/:id','delete','destroy','removeAgents','exports','util','path'];(function(_0x2aced8,_0x5369d0){var _0x98b8c=function(_0x26ced9){while(--_0x26ced9){_0x2aced8['push'](_0x2aced8['shift']());}};_0x98b8c(++_0x5369d0);}(_0x7524,0xce));var _0x4752=function(_0x2138b0,_0x4ca126){_0x2138b0=_0x2138b0-0x0;var _0x429e90=_0x7524[_0x2138b0];return _0x429e90;};'use strict';var multer=require('multer');var util=require(_0x4752('0x0'));var path=require(_0x4752('0x1'));var timeout=require('connect-timeout');var express=require(_0x4752('0x2'));var router=express[_0x4752('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4752('0x4'));var config=require('../../config/environment');var controller=require(_0x4752('0x5'));router[_0x4752('0x6')]('/',auth[_0x4752('0x7')](),controller[_0x4752('0x8')]);router[_0x4752('0x6')]('/describe',auth[_0x4752('0x7')](),controller[_0x4752('0x9')]);router['get']('/:id',auth[_0x4752('0x7')](),controller[_0x4752('0xa')]);router[_0x4752('0x6')](_0x4752('0xb'),auth['isAuthenticated'](),controller[_0x4752('0xc')]);router[_0x4752('0x6')](_0x4752('0xd'),auth[_0x4752('0x7')](),controller[_0x4752('0xe')]);router['get'](_0x4752('0xf'),auth[_0x4752('0x7')](),controller[_0x4752('0x10')]);router[_0x4752('0x11')]('/',auth[_0x4752('0x7')](),controller[_0x4752('0x12')]);router[_0x4752('0x11')]('/:id/teams',auth[_0x4752('0x7')](),controller['addTeams']);router[_0x4752('0x11')](_0x4752('0xf'),auth[_0x4752('0x7')](),controller[_0x4752('0x13')]);router[_0x4752('0x14')](_0x4752('0x15'),auth[_0x4752('0x7')](),controller['update']);router[_0x4752('0x16')](_0x4752('0x15'),auth['isAuthenticated'](),controller[_0x4752('0x17')]);router['delete'](_0x4752('0xd'),auth[_0x4752('0x7')](),controller['removeTeams']);router[_0x4752('0x16')]('/:id/users',auth['isAuthenticated'](),controller[_0x4752('0x18')]);module[_0x4752('0x19')]=router; \ No newline at end of file +var _0x6b1b=['../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','/:id/teams','getAgents','post','create','addTeams','/:id/users','addAgents','delete','/:id','destroy','removeAgents','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x6b1b,0x1e7));var _0xb6b1=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0x6b1b[_0x5783f4];return _0x28e380;};'use strict';var multer=require('multer');var util=require(_0xb6b1('0x0'));var path=require(_0xb6b1('0x1'));var timeout=require(_0xb6b1('0x2'));var express=require('express');var router=express[_0xb6b1('0x3')]();var fs_extra=require(_0xb6b1('0x4'));var auth=require(_0xb6b1('0x5'));var interaction=require(_0xb6b1('0x6'));var config=require(_0xb6b1('0x7'));var controller=require(_0xb6b1('0x8'));router[_0xb6b1('0x9')]('/',auth[_0xb6b1('0xa')](),controller[_0xb6b1('0xb')]);router[_0xb6b1('0x9')](_0xb6b1('0xc'),auth['isAuthenticated'](),controller[_0xb6b1('0xd')]);router['get']('/:id',auth[_0xb6b1('0xa')](),controller['show']);router[_0xb6b1('0x9')]('/:id/members',auth['isAuthenticated'](),controller['getMembers']);router['get'](_0xb6b1('0xe'),auth[_0xb6b1('0xa')](),controller['getTeams']);router[_0xb6b1('0x9')]('/:id/users',auth['isAuthenticated'](),controller[_0xb6b1('0xf')]);router[_0xb6b1('0x10')]('/',auth[_0xb6b1('0xa')](),controller[_0xb6b1('0x11')]);router[_0xb6b1('0x10')](_0xb6b1('0xe'),auth[_0xb6b1('0xa')](),controller[_0xb6b1('0x12')]);router[_0xb6b1('0x10')](_0xb6b1('0x13'),auth[_0xb6b1('0xa')](),controller[_0xb6b1('0x14')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0xb6b1('0x15')](_0xb6b1('0x16'),auth[_0xb6b1('0xa')](),controller[_0xb6b1('0x17')]);router[_0xb6b1('0x15')](_0xb6b1('0xe'),auth['isAuthenticated'](),controller['removeTeams']);router[_0xb6b1('0x15')](_0xb6b1('0x13'),auth[_0xb6b1('0xa')](),controller[_0xb6b1('0x18')]);module[_0xb6b1('0x19')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 54702bd..0a10a99 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 _0xa8fb=['DATE','moment','STRING'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xa8fb,0x172));var _0xba8f=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xa8fb[_0x1cc8fe];return _0x230054;};'use strict';var moment=require(_0xba8f('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xba8f('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0xba8f('0x1')]},'joinAt':{'type':Sequelize[_0xba8f('0x2')]},'leaveAt':{'type':Sequelize[_0xba8f('0x2')]},'acceptAt':{'type':Sequelize[_0xba8f('0x2')]},'exitAt':{'type':Sequelize[_0xba8f('0x2')]},'reason':{'type':Sequelize[_0xba8f('0x1')]}}; \ No newline at end of file +var _0x051e=['moment','exports','STRING','DATE'];(function(_0x48d933,_0x4eaabe){var _0x4caf07=function(_0x403c1f){while(--_0x403c1f){_0x48d933['push'](_0x48d933['shift']());}};_0x4caf07(++_0x4eaabe);}(_0x051e,0xb8));var _0xe051=function(_0x42ea07,_0x502951){_0x42ea07=_0x42ea07-0x0;var _0xd38b3f=_0x051e[_0x42ea07];return _0xd38b3f;};'use strict';var moment=require(_0xe051('0x0'));var Sequelize=require('sequelize');module[_0xe051('0x1')]={'uniqueid':{'type':Sequelize[_0xe051('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xe051('0x2')]},'joinAt':{'type':Sequelize[_0xe051('0x3')]},'leaveAt':{'type':Sequelize[_0xe051('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xe051('0x3')]},'reason':{'type':Sequelize[_0xe051('0x2')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 7dcc6ab..8bc582c 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 _0x9434=['includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','update','then','error','stack','name','send','index','map','FaxQueueReport','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options'];(function(_0x1ea50c,_0x3dd2e7){var _0x37e769=function(_0x2dcb20){while(--_0x2dcb20){_0x1ea50c['push'](_0x1ea50c['shift']());}};_0x37e769(++_0x3dd2e7);}(_0x9434,0x168));var _0x4943=function(_0x4cc945,_0x3b9280){_0x4cc945=_0x4cc945-0x0;var _0x94c7f0=_0x9434[_0x4cc945];return _0x94c7f0;};'use strict';var emlformat=require(_0x4943('0x0'));var rimraf=require(_0x4943('0x1'));var zipdir=require(_0x4943('0x2'));var jsonpatch=require(_0x4943('0x3'));var rp=require(_0x4943('0x4'));var moment=require(_0x4943('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x4943('0x6'));var util=require(_0x4943('0x7'));var path=require('path');var sox=require(_0x4943('0x8'));var csv=require(_0x4943('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4943('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x4943('0xb'));var jsforce=require(_0x4943('0xc'));var deskjs=require(_0x4943('0xd'));var toCsv=require(_0x4943('0x9'));var querystring=require(_0x4943('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4943('0xf'));var qs=require(_0x4943('0x10'));var as=require(_0x4943('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4943('0x12'))(_0x4943('0x13'));var utils=require('../../config/utils');var config=require(_0x4943('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x943461,_0x1e95be){_0x1e95be=_0x1e95be||0xcc;return function(_0x33fd73){if(_0x33fd73){return _0x943461[_0x4943('0x15')](_0x1e95be);}return _0x943461[_0x4943('0x16')](_0x1e95be)[_0x4943('0x17')]();};}function respondWithResult(_0x4077f1,_0x524c8a){_0x524c8a=_0x524c8a||0xc8;return function(_0x902712){if(_0x902712){return _0x4077f1[_0x4943('0x16')](_0x524c8a)[_0x4943('0x18')](_0x902712);}};}function respondWithFilteredResult(_0x13d758,_0x37c843){return function(_0x39b4e3){if(_0x39b4e3){var _0x4b075e=typeof _0x37c843[_0x4943('0x19')]===_0x4943('0x1a')&&typeof _0x37c843[_0x4943('0x1b')]==='undefined';var _0x53377c=_0x39b4e3[_0x4943('0x1c')];var _0x4cba96=_0x4b075e?0x0:_0x37c843[_0x4943('0x19')];var _0x33b2d0=_0x4b075e?_0x39b4e3['count']:_0x37c843[_0x4943('0x19')]+_0x37c843[_0x4943('0x1b')];var _0x38749b;if(_0x33b2d0>=_0x53377c){_0x33b2d0=_0x53377c;_0x38749b=0xc8;}else{_0x38749b=0xce;}_0x13d758['status'](_0x38749b);return _0x13d758[_0x4943('0x1d')]('Content-Range',_0x4cba96+'-'+_0x33b2d0+'/'+_0x53377c)[_0x4943('0x18')](_0x39b4e3);}return null;};}function patchUpdates(_0x52fa3b){return function(_0x258079){try{jsonpatch[_0x4943('0x1e')](_0x258079,_0x52fa3b,!![]);}catch(_0x278569){return BPromise[_0x4943('0x1f')](_0x278569);}return _0x258079['save']();};}function saveUpdates(_0x1ceb6f,_0x205eb2){return function(_0x34e322){if(_0x34e322){return _0x34e322[_0x4943('0x20')](_0x1ceb6f)[_0x4943('0x21')](function(_0xd88a73){return _0xd88a73;});}return null;};}function removeEntity(_0x793d18,_0x340077){return function(_0x5dd061){if(_0x5dd061){return _0x5dd061['destroy']()[_0x4943('0x21')](function(){_0x793d18[_0x4943('0x16')](0xcc)[_0x4943('0x17')]();});}};}function handleEntityNotFound(_0x5d8cbe,_0x41f98d){return function(_0xd49582){if(!_0xd49582){_0x5d8cbe['sendStatus'](0x194);}return _0xd49582;};}function handleError(_0x8a63cb,_0x1499c7){_0x1499c7=_0x1499c7||0x1f4;return function(_0x43cbfe){logger[_0x4943('0x22')](_0x43cbfe[_0x4943('0x23')]);if(_0x43cbfe[_0x4943('0x24')]){delete _0x43cbfe[_0x4943('0x24')];}_0x8a63cb[_0x4943('0x16')](_0x1499c7)[_0x4943('0x25')](_0x43cbfe);};}exports[_0x4943('0x26')]=function(_0x170e78,_0x3b733f){var _0xa71fec={},_0x83bbd8={},_0x38b0a0={'count':0x0,'rows':[]};var _0x1cbb1e=_[_0x4943('0x27')](db[_0x4943('0x28')]['rawAttributes'],function(_0x43b11f){return{'name':_0x43b11f['fieldName'],'type':_0x43b11f[_0x4943('0x29')][_0x4943('0x2a')]};});_0x83bbd8[_0x4943('0x2b')]=_[_0x4943('0x27')](_0x1cbb1e,_0x4943('0x24'));_0x83bbd8[_0x4943('0x2c')]=_[_0x4943('0x2d')](_0x170e78[_0x4943('0x2c')]);_0x83bbd8['filters']=_[_0x4943('0x2e')](_0x83bbd8[_0x4943('0x2b')],_0x83bbd8['query']);_0xa71fec[_0x4943('0x2f')]=_[_0x4943('0x2e')](_0x83bbd8['model'],qs[_0x4943('0x30')](_0x170e78[_0x4943('0x2c')][_0x4943('0x30')]));_0xa71fec['attributes']=_0xa71fec[_0x4943('0x2f')][_0x4943('0x31')]?_0xa71fec[_0x4943('0x2f')]:_0x83bbd8[_0x4943('0x2b')];if(!_0x170e78[_0x4943('0x2c')]['hasOwnProperty'](_0x4943('0x32'))){_0xa71fec[_0x4943('0x1b')]=qs[_0x4943('0x1b')](_0x170e78[_0x4943('0x2c')][_0x4943('0x1b')]);_0xa71fec[_0x4943('0x19')]=qs[_0x4943('0x19')](_0x170e78[_0x4943('0x2c')][_0x4943('0x19')]);}_0xa71fec[_0x4943('0x33')]=qs[_0x4943('0x34')](_0x170e78['query'][_0x4943('0x34')]);_0xa71fec[_0x4943('0x35')]=qs[_0x4943('0x36')](_[_0x4943('0x37')](_0x170e78[_0x4943('0x2c')],_0x83bbd8['filters']),_0x1cbb1e);if(_0x170e78['query']['filter']){_0xa71fec[_0x4943('0x35')]=_[_0x4943('0x38')](_0xa71fec['where'],{'$or':_[_0x4943('0x27')](_0x1cbb1e,function(_0x4e970c){if(_0x4e970c[_0x4943('0x29')]!==_0x4943('0x39')){var _0x2fb5a7={};_0x2fb5a7[_0x4e970c[_0x4943('0x24')]]={'$like':'%'+_0x170e78[_0x4943('0x2c')][_0x4943('0x3a')]+'%'};return _0x2fb5a7;}})});}_0xa71fec=_[_0x4943('0x38')]({},_0xa71fec,_0x170e78[_0x4943('0x3b')]);var _0x41eaff={'where':_0xa71fec[_0x4943('0x35')]};return db[_0x4943('0x28')][_0x4943('0x1c')](_0x41eaff)[_0x4943('0x21')](function(_0x1b78bc){_0x38b0a0[_0x4943('0x1c')]=_0x1b78bc;if(_0x170e78[_0x4943('0x2c')][_0x4943('0x3c')]){_0xa71fec[_0x4943('0x3d')]=[{'all':!![]}];}return db[_0x4943('0x28')][_0x4943('0x3e')](_0xa71fec);})[_0x4943('0x21')](function(_0x11ee4a){_0x38b0a0[_0x4943('0x3f')]=_0x11ee4a;return _0x38b0a0;})[_0x4943('0x21')](respondWithFilteredResult(_0x3b733f,_0xa71fec))[_0x4943('0x40')](handleError(_0x3b733f,null));};exports[_0x4943('0x41')]=function(_0xe27ab,_0x5c4702){var _0x11a362={'raw':!![],'where':{'id':_0xe27ab['params']['id']}},_0x147179={};_0x147179['model']=_[_0x4943('0x2d')](db['FaxQueueReport'][_0x4943('0x42')]);_0x147179['query']=_[_0x4943('0x2d')](_0xe27ab['query']);_0x147179[_0x4943('0x36')]=_['intersection'](_0x147179[_0x4943('0x2b')],_0x147179[_0x4943('0x2c')]);_0x11a362[_0x4943('0x2f')]=_['intersection'](_0x147179['model'],qs[_0x4943('0x30')](_0xe27ab['query'][_0x4943('0x30')]));_0x11a362['attributes']=_0x11a362[_0x4943('0x2f')][_0x4943('0x31')]?_0x11a362[_0x4943('0x2f')]:_0x147179[_0x4943('0x2b')];if(_0xe27ab['query']['includeAll']){_0x11a362[_0x4943('0x3d')]=[{'all':!![]}];}_0x11a362=_['merge']({},_0x11a362,_0xe27ab['options']);return db[_0x4943('0x28')][_0x4943('0x43')](_0x11a362)[_0x4943('0x21')](handleEntityNotFound(_0x5c4702,null))[_0x4943('0x21')](respondWithResult(_0x5c4702,null))[_0x4943('0x40')](handleError(_0x5c4702,null));};exports[_0x4943('0x44')]=function(_0x2c0287,_0x5c8e07){return db[_0x4943('0x28')][_0x4943('0x44')](_0x2c0287['body'],{})[_0x4943('0x21')](respondWithResult(_0x5c8e07,0xc9))[_0x4943('0x40')](handleError(_0x5c8e07,null));};exports[_0x4943('0x20')]=function(_0x4d1a31,_0x350f55){if(_0x4d1a31[_0x4943('0x45')]['id']){delete _0x4d1a31['body']['id'];}return db[_0x4943('0x28')][_0x4943('0x43')]({'where':{'id':_0x4d1a31['params']['id']}})[_0x4943('0x21')](handleEntityNotFound(_0x350f55,null))[_0x4943('0x21')](saveUpdates(_0x4d1a31[_0x4943('0x45')],null))['then'](respondWithResult(_0x350f55,null))[_0x4943('0x40')](handleError(_0x350f55,null));};exports['destroy']=function(_0x51636a,_0x1f4f57){return db[_0x4943('0x28')][_0x4943('0x43')]({'where':{'id':_0x51636a['params']['id']}})['then'](handleEntityNotFound(_0x1f4f57,null))['then'](removeEntity(_0x1f4f57,null))[_0x4943('0x40')](handleError(_0x1f4f57,null));};exports['describe']=function(_0x5ca090,_0x88b338){return db['FaxQueueReport']['describe']()['then'](respondWithResult(_0x88b338,null))[_0x4943('0x40')](handleError(_0x88b338,null));}; \ No newline at end of file +var _0x668b=['order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','catch','show','params','create','body','find','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','update','destroy','then','error','stack','name','send','map','FaxQueueReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0x668b,0x140));var _0xb668=function(_0x35a274,_0x98b399){_0x35a274=_0x35a274-0x0;var _0x40d905=_0x668b[_0x35a274];return _0x40d905;};'use strict';var emlformat=require(_0xb668('0x0'));var rimraf=require(_0xb668('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb668('0x2'));var rp=require(_0xb668('0x3'));var moment=require('moment');var BPromise=require(_0xb668('0x4'));var Mustache=require('mustache');var util=require(_0xb668('0x5'));var path=require(_0xb668('0x6'));var sox=require(_0xb668('0x7'));var csv=require('to-csv');var ejs=require(_0xb668('0x8'));var fs=require('fs');var fs_extra=require(_0xb668('0x9'));var _=require(_0xb668('0xa'));var squel=require(_0xb668('0xb'));var crypto=require(_0xb668('0xc'));var jsforce=require(_0xb668('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xb668('0xe'));var querystring=require(_0xb668('0xf'));var Papa=require(_0xb668('0x10'));var Redis=require(_0xb668('0x11'));var authService=require(_0xb668('0x12'));var qs=require(_0xb668('0x13'));var as=require(_0xb668('0x14'));var hardwareService=require(_0xb668('0x15'));var logger=require('../../config/logger')(_0xb668('0x16'));var utils=require(_0xb668('0x17'));var config=require(_0xb668('0x18'));var licenseUtil=require(_0xb668('0x19'));var db=require(_0xb668('0x1a'))['db'];function respondWithStatusCode(_0x167057,_0x1d111a){_0x1d111a=_0x1d111a||0xcc;return function(_0x10ed24){if(_0x10ed24){return _0x167057[_0xb668('0x1b')](_0x1d111a);}return _0x167057[_0xb668('0x1c')](_0x1d111a)[_0xb668('0x1d')]();};}function respondWithResult(_0x3b7556,_0x3aed25){_0x3aed25=_0x3aed25||0xc8;return function(_0xd0450f){if(_0xd0450f){return _0x3b7556[_0xb668('0x1c')](_0x3aed25)[_0xb668('0x1e')](_0xd0450f);}};}function respondWithFilteredResult(_0x1ca6e7,_0x222cad){return function(_0x4fa32a){if(_0x4fa32a){var _0x4a755b=typeof _0x222cad[_0xb668('0x1f')]===_0xb668('0x20')&&typeof _0x222cad['limit']===_0xb668('0x20');var _0x567ad7=_0x4fa32a[_0xb668('0x21')];var _0x89fe72=_0x4a755b?0x0:_0x222cad['offset'];var _0x38595d=_0x4a755b?_0x4fa32a[_0xb668('0x21')]:_0x222cad['offset']+_0x222cad[_0xb668('0x22')];var _0x5b31ab;if(_0x38595d>=_0x567ad7){_0x38595d=_0x567ad7;_0x5b31ab=0xc8;}else{_0x5b31ab=0xce;}_0x1ca6e7[_0xb668('0x1c')](_0x5b31ab);return _0x1ca6e7[_0xb668('0x23')](_0xb668('0x24'),_0x89fe72+'-'+_0x38595d+'/'+_0x567ad7)[_0xb668('0x1e')](_0x4fa32a);}return null;};}function patchUpdates(_0x5d33ae){return function(_0x2b7f96){try{jsonpatch[_0xb668('0x25')](_0x2b7f96,_0x5d33ae,!![]);}catch(_0x25e5be){return BPromise['reject'](_0x25e5be);}return _0x2b7f96['save']();};}function saveUpdates(_0x43a70b,_0x1e5620){return function(_0x517eee){if(_0x517eee){return _0x517eee[_0xb668('0x26')](_0x43a70b)['then'](function(_0x2f1394){return _0x2f1394;});}return null;};}function removeEntity(_0x4bd365,_0x3f4745){return function(_0x1e1c94){if(_0x1e1c94){return _0x1e1c94[_0xb668('0x27')]()[_0xb668('0x28')](function(){_0x4bd365[_0xb668('0x1c')](0xcc)[_0xb668('0x1d')]();});}};}function handleEntityNotFound(_0x4d4bf8,_0x23084d){return function(_0x10d767){if(!_0x10d767){_0x4d4bf8[_0xb668('0x1b')](0x194);}return _0x10d767;};}function handleError(_0x49abfd,_0x5e0cee){_0x5e0cee=_0x5e0cee||0x1f4;return function(_0xe62fce){logger[_0xb668('0x29')](_0xe62fce[_0xb668('0x2a')]);if(_0xe62fce['name']){delete _0xe62fce[_0xb668('0x2b')];}_0x49abfd[_0xb668('0x1c')](_0x5e0cee)[_0xb668('0x2c')](_0xe62fce);};}exports['index']=function(_0x5709e2,_0x12919c){var _0x2619a4={},_0x589c58={},_0x2e5857={'count':0x0,'rows':[]};var _0x1791ff=_[_0xb668('0x2d')](db[_0xb668('0x2e')][_0xb668('0x2f')],function(_0x5f36b5){return{'name':_0x5f36b5[_0xb668('0x30')],'type':_0x5f36b5[_0xb668('0x31')]['key']};});_0x589c58[_0xb668('0x32')]=_['map'](_0x1791ff,_0xb668('0x2b'));_0x589c58[_0xb668('0x33')]=_[_0xb668('0x34')](_0x5709e2[_0xb668('0x33')]);_0x589c58[_0xb668('0x35')]=_[_0xb668('0x36')](_0x589c58[_0xb668('0x32')],_0x589c58[_0xb668('0x33')]);_0x2619a4[_0xb668('0x37')]=_['intersection'](_0x589c58[_0xb668('0x32')],qs[_0xb668('0x38')](_0x5709e2[_0xb668('0x33')]['fields']));_0x2619a4[_0xb668('0x37')]=_0x2619a4[_0xb668('0x37')][_0xb668('0x39')]?_0x2619a4[_0xb668('0x37')]:_0x589c58['model'];if(!_0x5709e2[_0xb668('0x33')][_0xb668('0x3a')](_0xb668('0x3b'))){_0x2619a4[_0xb668('0x22')]=qs[_0xb668('0x22')](_0x5709e2[_0xb668('0x33')][_0xb668('0x22')]);_0x2619a4['offset']=qs[_0xb668('0x1f')](_0x5709e2[_0xb668('0x33')]['offset']);}_0x2619a4[_0xb668('0x3c')]=qs['sort'](_0x5709e2['query'][_0xb668('0x3d')]);_0x2619a4[_0xb668('0x3e')]=qs['filters'](_[_0xb668('0x3f')](_0x5709e2['query'],_0x589c58[_0xb668('0x35')]),_0x1791ff);if(_0x5709e2['query']['filter']){_0x2619a4[_0xb668('0x3e')]=_[_0xb668('0x40')](_0x2619a4['where'],{'$or':_['map'](_0x1791ff,function(_0x218c1c){if(_0x218c1c[_0xb668('0x31')]!==_0xb668('0x41')){var _0x187f4d={};_0x187f4d[_0x218c1c[_0xb668('0x2b')]]={'$like':'%'+_0x5709e2['query']['filter']+'%'};return _0x187f4d;}})});}_0x2619a4=_[_0xb668('0x40')]({},_0x2619a4,_0x5709e2[_0xb668('0x42')]);var _0xcdf6a8={'where':_0x2619a4[_0xb668('0x3e')]};return db[_0xb668('0x2e')][_0xb668('0x21')](_0xcdf6a8)['then'](function(_0x51a482){_0x2e5857[_0xb668('0x21')]=_0x51a482;if(_0x5709e2[_0xb668('0x33')][_0xb668('0x43')]){_0x2619a4[_0xb668('0x44')]=[{'all':!![]}];}return db[_0xb668('0x2e')]['findAll'](_0x2619a4);})[_0xb668('0x28')](function(_0x429b14){_0x2e5857['rows']=_0x429b14;return _0x2e5857;})[_0xb668('0x28')](respondWithFilteredResult(_0x12919c,_0x2619a4))[_0xb668('0x45')](handleError(_0x12919c,null));};exports[_0xb668('0x46')]=function(_0x54353,_0x5273e8){var _0x583a61={'raw':!![],'where':{'id':_0x54353[_0xb668('0x47')]['id']}},_0x4b7192={};_0x4b7192['model']=_['keys'](db['FaxQueueReport']['rawAttributes']);_0x4b7192[_0xb668('0x33')]=_['keys'](_0x54353[_0xb668('0x33')]);_0x4b7192[_0xb668('0x35')]=_[_0xb668('0x36')](_0x4b7192[_0xb668('0x32')],_0x4b7192[_0xb668('0x33')]);_0x583a61['attributes']=_[_0xb668('0x36')](_0x4b7192[_0xb668('0x32')],qs[_0xb668('0x38')](_0x54353[_0xb668('0x33')][_0xb668('0x38')]));_0x583a61[_0xb668('0x37')]=_0x583a61[_0xb668('0x37')][_0xb668('0x39')]?_0x583a61[_0xb668('0x37')]:_0x4b7192[_0xb668('0x32')];if(_0x54353[_0xb668('0x33')]['includeAll']){_0x583a61[_0xb668('0x44')]=[{'all':!![]}];}_0x583a61=_[_0xb668('0x40')]({},_0x583a61,_0x54353[_0xb668('0x42')]);return db['FaxQueueReport']['find'](_0x583a61)[_0xb668('0x28')](handleEntityNotFound(_0x5273e8,null))['then'](respondWithResult(_0x5273e8,null))[_0xb668('0x45')](handleError(_0x5273e8,null));};exports['create']=function(_0x55a656,_0x4e2853){return db[_0xb668('0x2e')][_0xb668('0x48')](_0x55a656['body'],{})[_0xb668('0x28')](respondWithResult(_0x4e2853,0xc9))[_0xb668('0x45')](handleError(_0x4e2853,null));};exports[_0xb668('0x26')]=function(_0x1b649f,_0x16d06f){if(_0x1b649f[_0xb668('0x49')]['id']){delete _0x1b649f[_0xb668('0x49')]['id'];}return db[_0xb668('0x2e')][_0xb668('0x4a')]({'where':{'id':_0x1b649f[_0xb668('0x47')]['id']}})['then'](handleEntityNotFound(_0x16d06f,null))[_0xb668('0x28')](saveUpdates(_0x1b649f[_0xb668('0x49')],null))[_0xb668('0x28')](respondWithResult(_0x16d06f,null))[_0xb668('0x45')](handleError(_0x16d06f,null));};exports[_0xb668('0x27')]=function(_0x3da9ba,_0x381694){return db[_0xb668('0x2e')][_0xb668('0x4a')]({'where':{'id':_0x3da9ba['params']['id']}})[_0xb668('0x28')](handleEntityNotFound(_0x381694,null))[_0xb668('0x28')](removeEntity(_0x381694,null))[_0xb668('0x45')](handleError(_0x381694,null));};exports['describe']=function(_0x5c4e1a,_0x25c2a0){return db[_0xb668('0x2e')][_0xb668('0x4b')]()['then'](respondWithResult(_0x25c2a0,null))[_0xb668('0x45')](handleError(_0x25c2a0,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 047ade4..b66d4d9 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 _0xc4aa=['bluebird','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','report_fax_queue','lodash','util','../../config/logger','api','moment'];(function(_0x1fe5bf,_0x1e9b1c){var _0x30c92d=function(_0x2e2238){while(--_0x2e2238){_0x1fe5bf['push'](_0x1fe5bf['shift']());}};_0x30c92d(++_0x1e9b1c);}(_0xc4aa,0x1b7));var _0xac4a=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0xc4aa[_0xaa1b3e];return _0x454d7d;};'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 +var _0xc4aa=['bluebird','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','report_fax_queue','lodash','util','../../config/logger','api','moment'];(function(_0xeb31f2,_0x455c4a){var _0x572f2b=function(_0x58b031){while(--_0x58b031){_0xeb31f2['push'](_0xeb31f2['shift']());}};_0x572f2b(++_0x455c4a);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0xc4aa[_0x5a776b];return _0xbbef59;};'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 eb138ab..3478c57 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 _0x4728=['attributes','limit','UpdateFaxQueueReport','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateFaxQueueReport','create','options','raw','update','body','where'];(function(_0x4a0d83,_0x24d31d){var _0x363325=function(_0x1fd979){while(--_0x1fd979){_0x4a0d83['push'](_0x4a0d83['shift']());}};_0x363325(++_0x24d31d);}(_0x4728,0x16e));var _0x8472=function(_0x342b84,_0x378c84){_0x342b84=_0x342b84-0x0;var _0x720468=_0x4728[_0x342b84];return _0x720468;};'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('../../config/logger')(_0x8472('0x7'));var config=require('../../config/environment');var jayson=require(_0x8472('0x8'));var client=jayson[_0x8472('0x9')][_0x8472('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5f165d,_0x5db4ab,_0x31b6be){return new BPromise(function(_0x46a695,_0x1c5414){return client['request'](_0x5f165d,_0x31b6be)[_0x8472('0xb')](function(_0x482352){logger[_0x8472('0xc')](_0x8472('0xd'),_0x5db4ab,_0x8472('0xe'));logger[_0x8472('0xf')](_0x8472('0x10'),_0x5db4ab,_0x8472('0xe'),JSON[_0x8472('0x11')](_0x482352));if(_0x482352[_0x8472('0x12')]){if(_0x482352['error'][_0x8472('0x13')]===0x1f4){logger['error'](_0x8472('0xd'),_0x5db4ab,_0x482352[_0x8472('0x12')][_0x8472('0x14')]);return _0x1c5414(_0x482352[_0x8472('0x12')][_0x8472('0x14')]);}logger[_0x8472('0x12')]('FaxQueueReport,\x20%s,\x20%s',_0x5db4ab,_0x482352[_0x8472('0x12')][_0x8472('0x14')]);return _0x46a695(_0x482352[_0x8472('0x12')][_0x8472('0x14')]);}else{logger['info'](_0x8472('0xd'),_0x5db4ab,_0x8472('0xe'));_0x46a695(_0x482352[_0x8472('0x15')][_0x8472('0x14')]);}})[_0x8472('0x16')](function(_0x53b25d){logger[_0x8472('0x12')](_0x8472('0xd'),_0x5db4ab,_0x53b25d);_0x1c5414(_0x53b25d);});});}exports[_0x8472('0x17')]=function(_0x321cdb){var _0x5289ec=this;return new Promise(function(_0x2a6990,_0x2910a5){return db['FaxQueueReport'][_0x8472('0x18')](_0x321cdb['body'],{'raw':_0x321cdb[_0x8472('0x19')]?_0x321cdb[_0x8472('0x19')][_0x8472('0x1a')]===undefined?!![]:![]:!![]})[_0x8472('0xb')](function(_0x5a0ecc){logger[_0x8472('0xc')](_0x8472('0x17'),_0x321cdb);logger[_0x8472('0xf')](_0x8472('0x17'),_0x321cdb,JSON[_0x8472('0x11')](_0x5a0ecc));_0x2a6990(_0x5a0ecc);})['catch'](function(_0x40ecc3){logger[_0x8472('0x12')](_0x8472('0x17'),_0x40ecc3[_0x8472('0x14')],_0x321cdb);_0x2910a5(_0x5289ec[_0x8472('0x12')](0x1f4,_0x40ecc3[_0x8472('0x14')]));});});};exports['UpdateFaxQueueReport']=function(_0x624162){var _0x4230f4=this;return new Promise(function(_0x6eefc6,_0xc5bc0a){return db['FaxQueueReport'][_0x8472('0x1b')](_0x624162[_0x8472('0x1c')],{'raw':_0x624162[_0x8472('0x19')]?_0x624162[_0x8472('0x19')][_0x8472('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x624162[_0x8472('0x19')]?_0x624162[_0x8472('0x19')][_0x8472('0x1d')]||null:null,'attributes':_0x624162[_0x8472('0x19')]?_0x624162[_0x8472('0x19')][_0x8472('0x1e')]||null:null,'limit':_0x624162[_0x8472('0x19')]?_0x624162[_0x8472('0x19')][_0x8472('0x1f')]||null:null})[_0x8472('0xb')](function(_0x5a687a){logger[_0x8472('0xc')](_0x8472('0x20'),_0x624162);logger['debug'](_0x8472('0x20'),_0x624162,JSON['stringify'](_0x5a687a));_0x6eefc6(_0x5a687a);})[_0x8472('0x16')](function(_0x21d1e9){logger[_0x8472('0x12')](_0x8472('0x20'),_0x21d1e9[_0x8472('0x14')],_0x624162);_0xc5bc0a(_0x4230f4[_0x8472('0x12')](0x1f4,_0x21d1e9[_0x8472('0x14')]));});});}; \ No newline at end of file +var _0xdeaa=['body','options','raw','UpdateFaxQueueReport','update','where','attributes','limit','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateFaxQueueReport','FaxQueueReport','create'];(function(_0x5d860f,_0x467498){var _0x236490=function(_0x5e045c){while(--_0x5e045c){_0x5d860f['push'](_0x5d860f['shift']());}};_0x236490(++_0x467498);}(_0xdeaa,0x1e4));var _0xadea=function(_0x1252c9,_0xf5552b){_0x1252c9=_0x1252c9-0x0;var _0xfd6b66=_0xdeaa[_0x1252c9];return _0xfd6b66;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xadea('0x0'));var rs=require(_0xadea('0x1'));var fs=require('fs');var Redis=require(_0xadea('0x2'));var db=require(_0xadea('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xadea('0x4'))(_0xadea('0x5'));var config=require(_0xadea('0x6'));var jayson=require(_0xadea('0x7'));var client=jayson[_0xadea('0x8')][_0xadea('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5de15c,_0x4f42cd,_0x4f88a3){return new BPromise(function(_0x4874b6,_0x2b95c9){return client[_0xadea('0xa')](_0x5de15c,_0x4f88a3)[_0xadea('0xb')](function(_0x150717){logger[_0xadea('0xc')](_0xadea('0xd'),_0x4f42cd,_0xadea('0xe'));logger[_0xadea('0xf')](_0xadea('0x10'),_0x4f42cd,_0xadea('0xe'),JSON[_0xadea('0x11')](_0x150717));if(_0x150717['error']){if(_0x150717[_0xadea('0x12')][_0xadea('0x13')]===0x1f4){logger[_0xadea('0x12')](_0xadea('0xd'),_0x4f42cd,_0x150717[_0xadea('0x12')][_0xadea('0x14')]);return _0x2b95c9(_0x150717['error']['message']);}logger[_0xadea('0x12')](_0xadea('0xd'),_0x4f42cd,_0x150717[_0xadea('0x12')][_0xadea('0x14')]);return _0x4874b6(_0x150717['error']['message']);}else{logger['info'](_0xadea('0xd'),_0x4f42cd,_0xadea('0xe'));_0x4874b6(_0x150717[_0xadea('0x15')]['message']);}})[_0xadea('0x16')](function(_0x5a7a27){logger[_0xadea('0x12')](_0xadea('0xd'),_0x4f42cd,_0x5a7a27);_0x2b95c9(_0x5a7a27);});});}exports[_0xadea('0x17')]=function(_0x528132){var _0x18c0c0=this;return new Promise(function(_0x1d95b9,_0x2c5526){return db[_0xadea('0x18')][_0xadea('0x19')](_0x528132[_0xadea('0x1a')],{'raw':_0x528132[_0xadea('0x1b')]?_0x528132[_0xadea('0x1b')][_0xadea('0x1c')]===undefined?!![]:![]:!![]})[_0xadea('0xb')](function(_0x9f697e){logger[_0xadea('0xc')](_0xadea('0x17'),_0x528132);logger[_0xadea('0xf')](_0xadea('0x17'),_0x528132,JSON[_0xadea('0x11')](_0x9f697e));_0x1d95b9(_0x9f697e);})[_0xadea('0x16')](function(_0x587b0b){logger[_0xadea('0x12')]('CreateFaxQueueReport',_0x587b0b[_0xadea('0x14')],_0x528132);_0x2c5526(_0x18c0c0['error'](0x1f4,_0x587b0b[_0xadea('0x14')]));});});};exports[_0xadea('0x1d')]=function(_0x5bf379){var _0x4928bc=this;return new Promise(function(_0x1c00e4,_0x4f5de5){return db[_0xadea('0x18')][_0xadea('0x1e')](_0x5bf379[_0xadea('0x1a')],{'raw':_0x5bf379[_0xadea('0x1b')]?_0x5bf379[_0xadea('0x1b')][_0xadea('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5bf379[_0xadea('0x1b')]?_0x5bf379[_0xadea('0x1b')][_0xadea('0x1f')]||null:null,'attributes':_0x5bf379[_0xadea('0x1b')]?_0x5bf379['options'][_0xadea('0x20')]||null:null,'limit':_0x5bf379[_0xadea('0x1b')]?_0x5bf379['options'][_0xadea('0x21')]||null:null})[_0xadea('0xb')](function(_0x411c0b){logger[_0xadea('0xc')](_0xadea('0x1d'),_0x5bf379);logger[_0xadea('0xf')](_0xadea('0x1d'),_0x5bf379,JSON[_0xadea('0x11')](_0x411c0b));_0x1c00e4(_0x411c0b);})['catch'](function(_0x19dced){logger[_0xadea('0x12')](_0xadea('0x1d'),_0x19dced[_0xadea('0x14')],_0x5bf379);_0x4f5de5(_0x4928bc[_0xadea('0x12')](0x1f4,_0x19dced[_0xadea('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 75ea8fa..82063b7 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 _0x2326=['Router','fs-extra','../../components/auth/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','/describe','describe','show','post','create','delete','/:id','destroy','exports','multer','util','connect-timeout','express'];(function(_0x3f7b73,_0x4ef305){var _0x4ea905=function(_0x285069){while(--_0x285069){_0x3f7b73['push'](_0x3f7b73['shift']());}};_0x4ea905(++_0x4ef305);}(_0x2326,0x150));var _0x6232=function(_0x290345,_0x2142a3){_0x290345=_0x290345-0x0;var _0x4ecbfd=_0x2326[_0x290345];return _0x4ecbfd;};'use strict';var multer=require(_0x6232('0x0'));var util=require(_0x6232('0x1'));var path=require('path');var timeout=require(_0x6232('0x2'));var express=require(_0x6232('0x3'));var router=express[_0x6232('0x4')]();var fs_extra=require(_0x6232('0x5'));var auth=require(_0x6232('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6232('0x7'));var controller=require(_0x6232('0x8'));router[_0x6232('0x9')]('/',auth[_0x6232('0xa')](),controller['index']);router[_0x6232('0x9')](_0x6232('0xb'),auth[_0x6232('0xa')](),controller[_0x6232('0xc')]);router[_0x6232('0x9')]('/:id',auth[_0x6232('0xa')](),controller[_0x6232('0xd')]);router[_0x6232('0xe')]('/',auth['isAuthenticated'](),controller[_0x6232('0xf')]);router['put']('/:id',auth[_0x6232('0xa')](),controller['update']);router[_0x6232('0x10')](_0x6232('0x11'),auth[_0x6232('0xa')](),controller[_0x6232('0x12')]);module[_0x6232('0x13')]=router; \ No newline at end of file +var _0x75e3=['isAuthenticated','index','describe','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./faxQueueReport.controller','get'];(function(_0x496520,_0x10d1dd){var _0x44571c=function(_0xb2fa60){while(--_0xb2fa60){_0x496520['push'](_0x496520['shift']());}};_0x44571c(++_0x10d1dd);}(_0x75e3,0x14b));var _0x375e=function(_0xc57bb3,_0x207191){_0xc57bb3=_0xc57bb3-0x0;var _0x166b25=_0x75e3[_0xc57bb3];return _0x166b25;};'use strict';var multer=require(_0x375e('0x0'));var util=require(_0x375e('0x1'));var path=require(_0x375e('0x2'));var timeout=require(_0x375e('0x3'));var express=require(_0x375e('0x4'));var router=express[_0x375e('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x375e('0x6'));var controller=require(_0x375e('0x7'));router[_0x375e('0x8')]('/',auth[_0x375e('0x9')](),controller[_0x375e('0xa')]);router[_0x375e('0x8')]('/describe',auth[_0x375e('0x9')](),controller[_0x375e('0xb')]);router['get'](_0x375e('0xc'),auth[_0x375e('0x9')](),controller[_0x375e('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x375e('0xe')]);router[_0x375e('0xf')](_0x375e('0xc'),auth[_0x375e('0x9')](),controller[_0x375e('0x10')]);router[_0x375e('0x11')]('/:id',auth[_0x375e('0x9')](),controller[_0x375e('0x12')]);module[_0x375e('0x13')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index a2ad205..b0374f5 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 _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0x23872e,_0x54a4d3){var _0x415aa2=function(_0x514187){while(--_0x514187){_0x23872e['push'](_0x23872e['shift']());}};_0x415aa2(++_0x54a4d3);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x305486,_0x24acd4){_0x305486=_0x305486-0x0;var _0xa04940=_0xcb91[_0x305486];return _0xa04940;};'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 _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x2b1068,_0x35582e){var _0x4a7468=function(_0x2a70f6){while(--_0x2a70f6){_0x2b1068['push'](_0x2b1068['shift']());}};_0x4a7468(++_0x35582e);}(_0x70e0,0x17b));var _0x070e=function(_0x3d180e,_0x580066){_0x3d180e=_0x3d180e-0x0;var _0xd43cfb=_0x70e0[_0x3d180e];return _0xd43cfb;};'use strict';var moment=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));module[_0x070e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'allowNull':![],'defaultValue':_0x070e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index fdde441..62af462 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 _0x7b60=['map','keys','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','params','intersection','options','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','error','name','FaxTransferReport','rawAttributes','fieldName','type','key','model'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7b60,0xb3));var _0x07b6=function(_0x39096d,_0x40291f){_0x39096d=_0x39096d-0x0;var _0x51050e=_0x7b60[_0x39096d];return _0x51050e;};'use strict';var emlformat=require(_0x07b6('0x0'));var rimraf=require(_0x07b6('0x1'));var zipdir=require(_0x07b6('0x2'));var jsonpatch=require(_0x07b6('0x3'));var rp=require(_0x07b6('0x4'));var moment=require(_0x07b6('0x5'));var BPromise=require(_0x07b6('0x6'));var Mustache=require(_0x07b6('0x7'));var util=require(_0x07b6('0x8'));var path=require('path');var sox=require(_0x07b6('0x9'));var csv=require(_0x07b6('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x07b6('0xb'));var squel=require('squel');var crypto=require(_0x07b6('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x07b6('0xd'));var toCsv=require(_0x07b6('0xa'));var querystring=require(_0x07b6('0xe'));var Papa=require(_0x07b6('0xf'));var Redis=require(_0x07b6('0x10'));var authService=require(_0x07b6('0x11'));var qs=require(_0x07b6('0x12'));var as=require(_0x07b6('0x13'));var hardwareService=require(_0x07b6('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x07b6('0x15'));var licenseUtil=require(_0x07b6('0x16'));var db=require(_0x07b6('0x17'))['db'];function respondWithStatusCode(_0x5c7e18,_0x1c8ac8){_0x1c8ac8=_0x1c8ac8||0xcc;return function(_0xff6175){if(_0xff6175){return _0x5c7e18[_0x07b6('0x18')](_0x1c8ac8);}return _0x5c7e18['status'](_0x1c8ac8)[_0x07b6('0x19')]();};}function respondWithResult(_0x1ec46b,_0x516ad1){_0x516ad1=_0x516ad1||0xc8;return function(_0x35627f){if(_0x35627f){return _0x1ec46b[_0x07b6('0x1a')](_0x516ad1)[_0x07b6('0x1b')](_0x35627f);}};}function respondWithFilteredResult(_0x58ed53,_0x2bdb7){return function(_0x1749d9){if(_0x1749d9){var _0x2bb8b9=typeof _0x2bdb7[_0x07b6('0x1c')]===_0x07b6('0x1d')&&typeof _0x2bdb7[_0x07b6('0x1e')]===_0x07b6('0x1d');var _0xa5375c=_0x1749d9['count'];var _0x4e4eab=_0x2bb8b9?0x0:_0x2bdb7['offset'];var _0x6d1e15=_0x2bb8b9?_0x1749d9[_0x07b6('0x1f')]:_0x2bdb7[_0x07b6('0x1c')]+_0x2bdb7[_0x07b6('0x1e')];var _0x10a4c2;if(_0x6d1e15>=_0xa5375c){_0x6d1e15=_0xa5375c;_0x10a4c2=0xc8;}else{_0x10a4c2=0xce;}_0x58ed53['status'](_0x10a4c2);return _0x58ed53[_0x07b6('0x20')]('Content-Range',_0x4e4eab+'-'+_0x6d1e15+'/'+_0xa5375c)['json'](_0x1749d9);}return null;};}function patchUpdates(_0x4d384a){return function(_0x237242){try{jsonpatch[_0x07b6('0x21')](_0x237242,_0x4d384a,!![]);}catch(_0x2ea6ca){return BPromise[_0x07b6('0x22')](_0x2ea6ca);}return _0x237242[_0x07b6('0x23')]();};}function saveUpdates(_0x3c729e,_0x1cfae0){return function(_0x3e98b0){if(_0x3e98b0){return _0x3e98b0['update'](_0x3c729e)[_0x07b6('0x24')](function(_0xd4567c){return _0xd4567c;});}return null;};}function removeEntity(_0x316d34,_0x28e42f){return function(_0x404c7c){if(_0x404c7c){return _0x404c7c[_0x07b6('0x25')]()[_0x07b6('0x24')](function(){_0x316d34[_0x07b6('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xdafd3c,_0x3ae110){return function(_0x50d98b){if(!_0x50d98b){_0xdafd3c[_0x07b6('0x18')](0x194);}return _0x50d98b;};}function handleError(_0x4cb39f,_0x7f2d38){_0x7f2d38=_0x7f2d38||0x1f4;return function(_0x32156a){logger[_0x07b6('0x26')](_0x32156a['stack']);if(_0x32156a[_0x07b6('0x27')]){delete _0x32156a[_0x07b6('0x27')];}_0x4cb39f['status'](_0x7f2d38)['send'](_0x32156a);};}exports['index']=function(_0xed7009,_0x2205b4){var _0x3eea09={},_0x5db9db={},_0x235127={'count':0x0,'rows':[]};var _0x4f35b8=_['map'](db[_0x07b6('0x28')][_0x07b6('0x29')],function(_0x518003){return{'name':_0x518003[_0x07b6('0x2a')],'type':_0x518003[_0x07b6('0x2b')][_0x07b6('0x2c')]};});_0x5db9db[_0x07b6('0x2d')]=_[_0x07b6('0x2e')](_0x4f35b8,_0x07b6('0x27'));_0x5db9db['query']=_[_0x07b6('0x2f')](_0xed7009[_0x07b6('0x30')]);_0x5db9db[_0x07b6('0x31')]=_['intersection'](_0x5db9db[_0x07b6('0x2d')],_0x5db9db[_0x07b6('0x30')]);_0x3eea09[_0x07b6('0x32')]=_['intersection'](_0x5db9db[_0x07b6('0x2d')],qs[_0x07b6('0x33')](_0xed7009[_0x07b6('0x30')][_0x07b6('0x33')]));_0x3eea09[_0x07b6('0x32')]=_0x3eea09[_0x07b6('0x32')][_0x07b6('0x34')]?_0x3eea09[_0x07b6('0x32')]:_0x5db9db[_0x07b6('0x2d')];if(!_0xed7009[_0x07b6('0x30')][_0x07b6('0x35')](_0x07b6('0x36'))){_0x3eea09['limit']=qs['limit'](_0xed7009[_0x07b6('0x30')][_0x07b6('0x1e')]);_0x3eea09[_0x07b6('0x1c')]=qs[_0x07b6('0x1c')](_0xed7009['query'][_0x07b6('0x1c')]);}_0x3eea09[_0x07b6('0x37')]=qs[_0x07b6('0x38')](_0xed7009[_0x07b6('0x30')][_0x07b6('0x38')]);_0x3eea09[_0x07b6('0x39')]=qs['filters'](_[_0x07b6('0x3a')](_0xed7009[_0x07b6('0x30')],_0x5db9db[_0x07b6('0x31')]),_0x4f35b8);if(_0xed7009[_0x07b6('0x30')][_0x07b6('0x3b')]){_0x3eea09[_0x07b6('0x39')]=_[_0x07b6('0x3c')](_0x3eea09[_0x07b6('0x39')],{'$or':_['map'](_0x4f35b8,function(_0x1f93e8){if(_0x1f93e8[_0x07b6('0x2b')]!==_0x07b6('0x3d')){var _0x3376aa={};_0x3376aa[_0x1f93e8['name']]={'$like':'%'+_0xed7009[_0x07b6('0x30')][_0x07b6('0x3b')]+'%'};return _0x3376aa;}})});}_0x3eea09=_[_0x07b6('0x3c')]({},_0x3eea09,_0xed7009['options']);var _0x23e1df={'where':_0x3eea09[_0x07b6('0x39')]};return db['FaxTransferReport']['count'](_0x23e1df)[_0x07b6('0x24')](function(_0x3ce92e){_0x235127[_0x07b6('0x1f')]=_0x3ce92e;if(_0xed7009[_0x07b6('0x30')][_0x07b6('0x3e')]){_0x3eea09[_0x07b6('0x3f')]=[{'all':!![]}];}return db[_0x07b6('0x28')]['findAll'](_0x3eea09);})['then'](function(_0x386956){_0x235127[_0x07b6('0x40')]=_0x386956;return _0x235127;})[_0x07b6('0x24')](respondWithFilteredResult(_0x2205b4,_0x3eea09))[_0x07b6('0x41')](handleError(_0x2205b4,null));};exports[_0x07b6('0x42')]=function(_0x9751fc,_0x4607f7){var _0x91dc62={'raw':!![],'where':{'id':_0x9751fc[_0x07b6('0x43')]['id']}},_0x39358f={};_0x39358f['model']=_[_0x07b6('0x2f')](db['FaxTransferReport']['rawAttributes']);_0x39358f[_0x07b6('0x30')]=_[_0x07b6('0x2f')](_0x9751fc[_0x07b6('0x30')]);_0x39358f['filters']=_[_0x07b6('0x44')](_0x39358f['model'],_0x39358f['query']);_0x91dc62[_0x07b6('0x32')]=_[_0x07b6('0x44')](_0x39358f[_0x07b6('0x2d')],qs['fields'](_0x9751fc[_0x07b6('0x30')][_0x07b6('0x33')]));_0x91dc62[_0x07b6('0x32')]=_0x91dc62['attributes']['length']?_0x91dc62['attributes']:_0x39358f['model'];if(_0x9751fc[_0x07b6('0x30')][_0x07b6('0x3e')]){_0x91dc62[_0x07b6('0x3f')]=[{'all':!![]}];}_0x91dc62=_['merge']({},_0x91dc62,_0x9751fc[_0x07b6('0x45')]);return db[_0x07b6('0x28')][_0x07b6('0x46')](_0x91dc62)[_0x07b6('0x24')](handleEntityNotFound(_0x4607f7,null))[_0x07b6('0x24')](respondWithResult(_0x4607f7,null))[_0x07b6('0x41')](handleError(_0x4607f7,null));};exports['create']=function(_0x574994,_0x447562){return db[_0x07b6('0x28')][_0x07b6('0x47')](_0x574994[_0x07b6('0x48')],{})[_0x07b6('0x24')](respondWithResult(_0x447562,0xc9))[_0x07b6('0x41')](handleError(_0x447562,null));};exports[_0x07b6('0x49')]=function(_0x4a7499,_0xf76e55){if(_0x4a7499[_0x07b6('0x48')]['id']){delete _0x4a7499['body']['id'];}return db['FaxTransferReport']['find']({'where':{'id':_0x4a7499[_0x07b6('0x43')]['id']}})[_0x07b6('0x24')](handleEntityNotFound(_0xf76e55,null))[_0x07b6('0x24')](saveUpdates(_0x4a7499[_0x07b6('0x48')],null))['then'](respondWithResult(_0xf76e55,null))['catch'](handleError(_0xf76e55,null));};exports[_0x07b6('0x25')]=function(_0x2bfb75,_0x1a0de9){return db[_0x07b6('0x28')][_0x07b6('0x46')]({'where':{'id':_0x2bfb75[_0x07b6('0x43')]['id']}})['then'](handleEntityNotFound(_0x1a0de9,null))[_0x07b6('0x24')](removeEntity(_0x1a0de9,null))[_0x07b6('0x41')](handleError(_0x1a0de9,null));};exports[_0x07b6('0x4a')]=function(_0x2af5f9,_0x395e88){return db[_0x07b6('0x28')][_0x07b6('0x4a')]()[_0x07b6('0x24')](respondWithResult(_0x395e88,null))[_0x07b6('0x41')](handleError(_0x395e88,null));}; \ No newline at end of file +var _0x2e99=['undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','error','stack','name','send','index','map','type','key','model','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','filter','VIRTUAL','merge','options','FaxTransferReport','includeAll','include','rows','catch','params','keys','rawAttributes','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset'];(function(_0x4ed64b,_0x4c7d47){var _0x2a7690=function(_0x35c60d){while(--_0x35c60d){_0x4ed64b['push'](_0x4ed64b['shift']());}};_0x2a7690(++_0x4c7d47);}(_0x2e99,0x1f4));var _0x92e9=function(_0x2384e3,_0x3bd154){_0x2384e3=_0x2384e3-0x0;var _0x24a573=_0x2e99[_0x2384e3];return _0x24a573;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x92e9('0x0'));var zipdir=require(_0x92e9('0x1'));var jsonpatch=require(_0x92e9('0x2'));var rp=require(_0x92e9('0x3'));var moment=require(_0x92e9('0x4'));var BPromise=require(_0x92e9('0x5'));var Mustache=require(_0x92e9('0x6'));var util=require(_0x92e9('0x7'));var path=require(_0x92e9('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x92e9('0x9'));var _=require(_0x92e9('0xa'));var squel=require(_0x92e9('0xb'));var crypto=require(_0x92e9('0xc'));var jsforce=require(_0x92e9('0xd'));var deskjs=require(_0x92e9('0xe'));var toCsv=require(_0x92e9('0xf'));var querystring=require(_0x92e9('0x10'));var Papa=require(_0x92e9('0x11'));var Redis=require(_0x92e9('0x12'));var authService=require(_0x92e9('0x13'));var qs=require(_0x92e9('0x14'));var as=require(_0x92e9('0x15'));var hardwareService=require(_0x92e9('0x16'));var logger=require(_0x92e9('0x17'))(_0x92e9('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x92e9('0x19'));var db=require(_0x92e9('0x1a'))['db'];function respondWithStatusCode(_0x3a29f3,_0x3341bb){_0x3341bb=_0x3341bb||0xcc;return function(_0x3cda92){if(_0x3cda92){return _0x3a29f3[_0x92e9('0x1b')](_0x3341bb);}return _0x3a29f3[_0x92e9('0x1c')](_0x3341bb)[_0x92e9('0x1d')]();};}function respondWithResult(_0x491cd3,_0x240ce9){_0x240ce9=_0x240ce9||0xc8;return function(_0x13611c){if(_0x13611c){return _0x491cd3['status'](_0x240ce9)[_0x92e9('0x1e')](_0x13611c);}};}function respondWithFilteredResult(_0xdfc932,_0x46e48d){return function(_0x37a977){if(_0x37a977){var _0x52617d=typeof _0x46e48d[_0x92e9('0x1f')]===_0x92e9('0x20')&&typeof _0x46e48d[_0x92e9('0x21')]===_0x92e9('0x20');var _0x2ee4c1=_0x37a977[_0x92e9('0x22')];var _0x55bf32=_0x52617d?0x0:_0x46e48d[_0x92e9('0x1f')];var _0x79795e=_0x52617d?_0x37a977[_0x92e9('0x22')]:_0x46e48d[_0x92e9('0x1f')]+_0x46e48d[_0x92e9('0x21')];var _0x366824;if(_0x79795e>=_0x2ee4c1){_0x79795e=_0x2ee4c1;_0x366824=0xc8;}else{_0x366824=0xce;}_0xdfc932[_0x92e9('0x1c')](_0x366824);return _0xdfc932[_0x92e9('0x23')](_0x92e9('0x24'),_0x55bf32+'-'+_0x79795e+'/'+_0x2ee4c1)[_0x92e9('0x1e')](_0x37a977);}return null;};}function patchUpdates(_0x4aba01){return function(_0x544c2d){try{jsonpatch[_0x92e9('0x25')](_0x544c2d,_0x4aba01,!![]);}catch(_0x2c0596){return BPromise[_0x92e9('0x26')](_0x2c0596);}return _0x544c2d[_0x92e9('0x27')]();};}function saveUpdates(_0x205cc1,_0x5882a1){return function(_0x456ae7){if(_0x456ae7){return _0x456ae7['update'](_0x205cc1)['then'](function(_0x25c921){return _0x25c921;});}return null;};}function removeEntity(_0x3142ab,_0x50c890){return function(_0x507a27){if(_0x507a27){return _0x507a27[_0x92e9('0x28')]()[_0x92e9('0x29')](function(){_0x3142ab[_0x92e9('0x1c')](0xcc)[_0x92e9('0x1d')]();});}};}function handleEntityNotFound(_0x1f8aa4,_0x5f2dbe){return function(_0x560c19){if(!_0x560c19){_0x1f8aa4[_0x92e9('0x1b')](0x194);}return _0x560c19;};}function handleError(_0x26bc33,_0x276e26){_0x276e26=_0x276e26||0x1f4;return function(_0x4b278b){logger[_0x92e9('0x2a')](_0x4b278b[_0x92e9('0x2b')]);if(_0x4b278b[_0x92e9('0x2c')]){delete _0x4b278b[_0x92e9('0x2c')];}_0x26bc33['status'](_0x276e26)[_0x92e9('0x2d')](_0x4b278b);};}exports[_0x92e9('0x2e')]=function(_0x387eec,_0x7f30a2){var _0x3f6d91={},_0x53832c={},_0x196ca5={'count':0x0,'rows':[]};var _0x54988d=_[_0x92e9('0x2f')](db['FaxTransferReport']['rawAttributes'],function(_0x5189db){return{'name':_0x5189db['fieldName'],'type':_0x5189db[_0x92e9('0x30')][_0x92e9('0x31')]};});_0x53832c[_0x92e9('0x32')]=_[_0x92e9('0x2f')](_0x54988d,_0x92e9('0x2c'));_0x53832c[_0x92e9('0x33')]=_['keys'](_0x387eec[_0x92e9('0x33')]);_0x53832c[_0x92e9('0x34')]=_[_0x92e9('0x35')](_0x53832c['model'],_0x53832c[_0x92e9('0x33')]);_0x3f6d91['attributes']=_['intersection'](_0x53832c[_0x92e9('0x32')],qs[_0x92e9('0x36')](_0x387eec[_0x92e9('0x33')]['fields']));_0x3f6d91[_0x92e9('0x37')]=_0x3f6d91[_0x92e9('0x37')][_0x92e9('0x38')]?_0x3f6d91[_0x92e9('0x37')]:_0x53832c['model'];if(!_0x387eec[_0x92e9('0x33')]['hasOwnProperty'](_0x92e9('0x39'))){_0x3f6d91['limit']=qs[_0x92e9('0x21')](_0x387eec[_0x92e9('0x33')][_0x92e9('0x21')]);_0x3f6d91[_0x92e9('0x1f')]=qs[_0x92e9('0x1f')](_0x387eec[_0x92e9('0x33')][_0x92e9('0x1f')]);}_0x3f6d91[_0x92e9('0x3a')]=qs[_0x92e9('0x3b')](_0x387eec['query'][_0x92e9('0x3b')]);_0x3f6d91[_0x92e9('0x3c')]=qs[_0x92e9('0x34')](_['pick'](_0x387eec[_0x92e9('0x33')],_0x53832c['filters']),_0x54988d);if(_0x387eec[_0x92e9('0x33')][_0x92e9('0x3d')]){_0x3f6d91['where']=_['merge'](_0x3f6d91[_0x92e9('0x3c')],{'$or':_[_0x92e9('0x2f')](_0x54988d,function(_0xe2394e){if(_0xe2394e[_0x92e9('0x30')]!==_0x92e9('0x3e')){var _0x1c4a99={};_0x1c4a99[_0xe2394e[_0x92e9('0x2c')]]={'$like':'%'+_0x387eec[_0x92e9('0x33')][_0x92e9('0x3d')]+'%'};return _0x1c4a99;}})});}_0x3f6d91=_[_0x92e9('0x3f')]({},_0x3f6d91,_0x387eec[_0x92e9('0x40')]);var _0x36595f={'where':_0x3f6d91[_0x92e9('0x3c')]};return db[_0x92e9('0x41')][_0x92e9('0x22')](_0x36595f)[_0x92e9('0x29')](function(_0x25f2dd){_0x196ca5['count']=_0x25f2dd;if(_0x387eec[_0x92e9('0x33')][_0x92e9('0x42')]){_0x3f6d91[_0x92e9('0x43')]=[{'all':!![]}];}return db[_0x92e9('0x41')]['findAll'](_0x3f6d91);})[_0x92e9('0x29')](function(_0xfe08df){_0x196ca5[_0x92e9('0x44')]=_0xfe08df;return _0x196ca5;})['then'](respondWithFilteredResult(_0x7f30a2,_0x3f6d91))[_0x92e9('0x45')](handleError(_0x7f30a2,null));};exports['show']=function(_0x5c24bf,_0x4101d6){var _0x217de8={'raw':!![],'where':{'id':_0x5c24bf[_0x92e9('0x46')]['id']}},_0x24a407={};_0x24a407[_0x92e9('0x32')]=_[_0x92e9('0x47')](db[_0x92e9('0x41')][_0x92e9('0x48')]);_0x24a407[_0x92e9('0x33')]=_[_0x92e9('0x47')](_0x5c24bf[_0x92e9('0x33')]);_0x24a407[_0x92e9('0x34')]=_[_0x92e9('0x35')](_0x24a407[_0x92e9('0x32')],_0x24a407[_0x92e9('0x33')]);_0x217de8[_0x92e9('0x37')]=_[_0x92e9('0x35')](_0x24a407[_0x92e9('0x32')],qs[_0x92e9('0x36')](_0x5c24bf[_0x92e9('0x33')][_0x92e9('0x36')]));_0x217de8[_0x92e9('0x37')]=_0x217de8['attributes']['length']?_0x217de8[_0x92e9('0x37')]:_0x24a407[_0x92e9('0x32')];if(_0x5c24bf[_0x92e9('0x33')]['includeAll']){_0x217de8[_0x92e9('0x43')]=[{'all':!![]}];}_0x217de8=_[_0x92e9('0x3f')]({},_0x217de8,_0x5c24bf[_0x92e9('0x40')]);return db[_0x92e9('0x41')][_0x92e9('0x49')](_0x217de8)[_0x92e9('0x29')](handleEntityNotFound(_0x4101d6,null))['then'](respondWithResult(_0x4101d6,null))['catch'](handleError(_0x4101d6,null));};exports[_0x92e9('0x4a')]=function(_0x4eb422,_0x10f46b){return db[_0x92e9('0x41')][_0x92e9('0x4a')](_0x4eb422['body'],{})[_0x92e9('0x29')](respondWithResult(_0x10f46b,0xc9))[_0x92e9('0x45')](handleError(_0x10f46b,null));};exports['update']=function(_0x59b2bb,_0x7b327c){if(_0x59b2bb[_0x92e9('0x4b')]['id']){delete _0x59b2bb['body']['id'];}return db['FaxTransferReport'][_0x92e9('0x49')]({'where':{'id':_0x59b2bb[_0x92e9('0x46')]['id']}})['then'](handleEntityNotFound(_0x7b327c,null))['then'](saveUpdates(_0x59b2bb['body'],null))[_0x92e9('0x29')](respondWithResult(_0x7b327c,null))['catch'](handleError(_0x7b327c,null));};exports[_0x92e9('0x28')]=function(_0xfd05d9,_0x48668d){return db[_0x92e9('0x41')][_0x92e9('0x49')]({'where':{'id':_0xfd05d9[_0x92e9('0x46')]['id']}})[_0x92e9('0x29')](handleEntityNotFound(_0x48668d,null))[_0x92e9('0x29')](removeEntity(_0x48668d,null))['catch'](handleError(_0x48668d,null));};exports['describe']=function(_0x1ac892,_0x49baf7){return db[_0x92e9('0x41')]['describe']()[_0x92e9('0x29')](respondWithResult(_0x49baf7,null))[_0x92e9('0x45')](handleError(_0x49baf7,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index e5d3721..dad25c2 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 _0x3991=['api','moment','bluebird','path','rimraf','../../config/environment','./faxTransferReport.attributes','exports','uniqueid','util','../../config/logger'];(function(_0x40a107,_0x5acc82){var _0x4beb59=function(_0x4bfb2a){while(--_0x4bfb2a){_0x40a107['push'](_0x40a107['shift']());}};_0x4beb59(++_0x5acc82);}(_0x3991,0x169));var _0x1399=function(_0x4a0a2e,_0x3897b1){_0x4a0a2e=_0x4a0a2e-0x0;var _0x20d54c=_0x3991[_0x4a0a2e];return _0x20d54c;};'use strict';var _=require('lodash');var util=require(_0x1399('0x0'));var logger=require(_0x1399('0x1'))(_0x1399('0x2'));var moment=require(_0x1399('0x3'));var BPromise=require(_0x1399('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1399('0x5'));var rimraf=require(_0x1399('0x6'));var config=require(_0x1399('0x7'));var attributes=require(_0x1399('0x8'));module[_0x1399('0x9')]=function(_0x4f1908,_0x50bcf6){return _0x4f1908['define']('FaxTransferReport',attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x1399('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4d08=['uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./faxTransferReport.attributes','exports','define','FaxTransferReport','report_fax_transfer'];(function(_0x461eff,_0x283cd4){var _0x4fa4e5=function(_0x199915){while(--_0x199915){_0x461eff['push'](_0x461eff['shift']());}};_0x4fa4e5(++_0x283cd4);}(_0x4d08,0x1a5));var _0x84d0=function(_0x279368,_0x41c002){_0x279368=_0x279368-0x0;var _0x40b6d0=_0x4d08[_0x279368];return _0x40b6d0;};'use strict';var _=require(_0x84d0('0x0'));var util=require('util');var logger=require(_0x84d0('0x1'))(_0x84d0('0x2'));var moment=require(_0x84d0('0x3'));var BPromise=require(_0x84d0('0x4'));var rp=require(_0x84d0('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x84d0('0x6'));var config=require(_0x84d0('0x7'));var attributes=require(_0x84d0('0x8'));module[_0x84d0('0x9')]=function(_0x845791,_0x161c3f){return _0x845791[_0x84d0('0xa')](_0x84d0('0xb'),attributes,{'tableName':_0x84d0('0xc'),'paranoid':![],'indexes':[{'name':_0x84d0('0xd'),'fields':[_0x84d0('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index f2e7a9a..a8507d4 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 _0x61a8=['request','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x61a8,0xf1));var _0x861a=function(_0xca8958,_0x25eed8){_0xca8958=_0xca8958-0x0;var _0x3d7165=_0x61a8[_0xca8958];return _0x3d7165;};'use strict';var _=require(_0x861a('0x0'));var util=require(_0x861a('0x1'));var moment=require(_0x861a('0x2'));var BPromise=require(_0x861a('0x3'));var rs=require(_0x861a('0x4'));var fs=require('fs');var Redis=require(_0x861a('0x5'));var db=require(_0x861a('0x6'))['db'];var utils=require(_0x861a('0x7'));var logger=require(_0x861a('0x8'))(_0x861a('0x9'));var config=require(_0x861a('0xa'));var jayson=require(_0x861a('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3e7b6b,_0x42883c,_0x57959b){return new BPromise(function(_0x95ae90,_0x5ec031){return client[_0x861a('0xc')](_0x3e7b6b,_0x57959b)['then'](function(_0x500c0e){logger[_0x861a('0xd')](_0x861a('0xe'),_0x42883c,_0x861a('0xf'));logger[_0x861a('0x10')](_0x861a('0x11'),_0x42883c,_0x861a('0xf'),JSON[_0x861a('0x12')](_0x500c0e));if(_0x500c0e[_0x861a('0x13')]){if(_0x500c0e[_0x861a('0x13')]['code']===0x1f4){logger[_0x861a('0x13')](_0x861a('0xe'),_0x42883c,_0x500c0e['error']['message']);return _0x5ec031(_0x500c0e[_0x861a('0x13')][_0x861a('0x14')]);}logger[_0x861a('0x13')]('FaxTransferReport,\x20%s,\x20%s',_0x42883c,_0x500c0e[_0x861a('0x13')][_0x861a('0x14')]);return _0x95ae90(_0x500c0e[_0x861a('0x13')][_0x861a('0x14')]);}else{logger[_0x861a('0xd')](_0x861a('0xe'),_0x42883c,_0x861a('0xf'));_0x95ae90(_0x500c0e[_0x861a('0x15')][_0x861a('0x14')]);}})[_0x861a('0x16')](function(_0x1d718f){logger[_0x861a('0x13')](_0x861a('0xe'),_0x42883c,_0x1d718f);_0x5ec031(_0x1d718f);});});} \ No newline at end of file +var _0x3aae=['util','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxTransferReport,\x20%s,\x20%s','message','catch','lodash'];(function(_0x576170,_0x1712ae){var _0x397c70=function(_0x2eb9de){while(--_0x2eb9de){_0x576170['push'](_0x576170['shift']());}};_0x397c70(++_0x1712ae);}(_0x3aae,0x17b));var _0xe3aa=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x3aae[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0xe3aa('0x0'));var util=require(_0xe3aa('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe3aa('0x2'))['db'];var utils=require(_0xe3aa('0x3'));var logger=require('../../config/logger')(_0xe3aa('0x4'));var config=require('../../config/environment');var jayson=require(_0xe3aa('0x5'));var client=jayson[_0xe3aa('0x6')][_0xe3aa('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4cc14b,_0x2d37f5,_0x322809){return new BPromise(function(_0x39b22a,_0x2ce41e){return client[_0xe3aa('0x8')](_0x4cc14b,_0x322809)[_0xe3aa('0x9')](function(_0x424dcd){logger[_0xe3aa('0xa')]('FaxTransferReport,\x20%s,\x20%s',_0x2d37f5,_0xe3aa('0xb'));logger[_0xe3aa('0xc')](_0xe3aa('0xd'),_0x2d37f5,_0xe3aa('0xb'),JSON[_0xe3aa('0xe')](_0x424dcd));if(_0x424dcd[_0xe3aa('0xf')]){if(_0x424dcd[_0xe3aa('0xf')][_0xe3aa('0x10')]===0x1f4){logger[_0xe3aa('0xf')](_0xe3aa('0x11'),_0x2d37f5,_0x424dcd[_0xe3aa('0xf')][_0xe3aa('0x12')]);return _0x2ce41e(_0x424dcd['error'][_0xe3aa('0x12')]);}logger['error'](_0xe3aa('0x11'),_0x2d37f5,_0x424dcd[_0xe3aa('0xf')][_0xe3aa('0x12')]);return _0x39b22a(_0x424dcd[_0xe3aa('0xf')]['message']);}else{logger['info'](_0xe3aa('0x11'),_0x2d37f5,_0xe3aa('0xb'));_0x39b22a(_0x424dcd['result'][_0xe3aa('0x12')]);}})[_0xe3aa('0x13')](function(_0x1efc04){logger[_0xe3aa('0xf')](_0xe3aa('0x11'),_0x2d37f5,_0x1efc04);_0x2ce41e(_0x1efc04);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 5e8237d..53e651f 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 _0x62a3=['connect-timeout','express','Router','fs-extra','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','index','/describe','/:id','show','put','delete','destroy','util'];(function(_0x342042,_0x2de023){var _0x58ec5d=function(_0x51dbdc){while(--_0x51dbdc){_0x342042['push'](_0x342042['shift']());}};_0x58ec5d(++_0x2de023);}(_0x62a3,0x1ef));var _0x362a=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x62a3[_0x21a9d9];return _0x46adce;};'use strict';var multer=require('multer');var util=require(_0x362a('0x0'));var path=require('path');var timeout=require(_0x362a('0x1'));var express=require(_0x362a('0x2'));var router=express[_0x362a('0x3')]();var fs_extra=require(_0x362a('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x362a('0x5'));var controller=require(_0x362a('0x6'));router[_0x362a('0x7')]('/',auth[_0x362a('0x8')](),controller[_0x362a('0x9')]);router[_0x362a('0x7')](_0x362a('0xa'),auth[_0x362a('0x8')](),controller['describe']);router[_0x362a('0x7')](_0x362a('0xb'),auth[_0x362a('0x8')](),controller[_0x362a('0xc')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x362a('0xd')](_0x362a('0xb'),auth[_0x362a('0x8')](),controller['update']);router[_0x362a('0xe')](_0x362a('0xb'),auth[_0x362a('0x8')](),controller[_0x362a('0xf')]);module['exports']=router; \ No newline at end of file +var _0x581b=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','show','post','create','update','delete','/:id','destroy','exports','multer','path','connect-timeout'];(function(_0x40a825,_0x3bac79){var _0x273a54=function(_0x5628d8){while(--_0x5628d8){_0x40a825['push'](_0x40a825['shift']());}};_0x273a54(++_0x3bac79);}(_0x581b,0x101));var _0xb581=function(_0x49c057,_0xc808ed){_0x49c057=_0x49c057-0x0;var _0xd8f0e6=_0x581b[_0x49c057];return _0xd8f0e6;};'use strict';var multer=require(_0xb581('0x0'));var util=require('util');var path=require(_0xb581('0x1'));var timeout=require(_0xb581('0x2'));var express=require('express');var router=express[_0xb581('0x3')]();var fs_extra=require(_0xb581('0x4'));var auth=require(_0xb581('0x5'));var interaction=require(_0xb581('0x6'));var config=require('../../config/environment');var controller=require('./faxTransferReport.controller');router[_0xb581('0x7')]('/',auth[_0xb581('0x8')](),controller[_0xb581('0x9')]);router['get'](_0xb581('0xa'),auth[_0xb581('0x8')](),controller[_0xb581('0xb')]);router[_0xb581('0x7')]('/:id',auth[_0xb581('0x8')](),controller[_0xb581('0xc')]);router[_0xb581('0xd')]('/',auth[_0xb581('0x8')](),controller[_0xb581('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xb581('0xf')]);router[_0xb581('0x10')](_0xb581('0x11'),auth[_0xb581('0x8')](),controller[_0xb581('0x12')]);module[_0xb581('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 3f7c98e..41c20d8 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 _0x1c57=['getConfigurations','/:id/fields','getFields','post','put','/:id','update','delete','destroy','multer','util','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intDeskAccount.controller','isAuthenticated','show','get','/:id/configurations'];(function(_0x1fa759,_0x4ecdce){var _0x2da9f4=function(_0x463e2a){while(--_0x463e2a){_0x1fa759['push'](_0x1fa759['shift']());}};_0x2da9f4(++_0x4ecdce);}(_0x1c57,0x144));var _0x71c5=function(_0x3a521a,_0x11c6ca){_0x3a521a=_0x3a521a-0x0;var _0x3ef0a3=_0x1c57[_0x3a521a];return _0x3ef0a3;};'use strict';var multer=require(_0x71c5('0x0'));var util=require(_0x71c5('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x71c5('0x2'));var router=express[_0x71c5('0x3')]();var fs_extra=require(_0x71c5('0x4'));var auth=require(_0x71c5('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x71c5('0x6'));var controller=require(_0x71c5('0x7'));router['get']('/',auth[_0x71c5('0x8')](),controller['index']);router['get']('/:id',auth[_0x71c5('0x8')](),controller[_0x71c5('0x9')]);router[_0x71c5('0xa')](_0x71c5('0xb'),auth[_0x71c5('0x8')](),controller[_0x71c5('0xc')]);router['get'](_0x71c5('0xd'),auth[_0x71c5('0x8')](),controller[_0x71c5('0xe')]);router[_0x71c5('0xf')]('/',auth[_0x71c5('0x8')](),controller['create']);router[_0x71c5('0xf')](_0x71c5('0xb'),auth[_0x71c5('0x8')](),controller['addConfiguration']);router[_0x71c5('0x10')](_0x71c5('0x11'),auth[_0x71c5('0x8')](),controller[_0x71c5('0x12')]);router[_0x71c5('0x13')](_0x71c5('0x11'),auth['isAuthenticated'](),controller[_0x71c5('0x14')]);module['exports']=router; \ No newline at end of file +var _0x77bc=['/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','index'];(function(_0x51bbd7,_0x343434){var _0x2462d2=function(_0x5b0d0c){while(--_0x5b0d0c){_0x51bbd7['push'](_0x51bbd7['shift']());}};_0x2462d2(++_0x343434);}(_0x77bc,0xbc));var _0xc77b=function(_0x598dd3,_0x174900){_0x598dd3=_0x598dd3-0x0;var _0x51ab1b=_0x77bc[_0x598dd3];return _0x51ab1b;};'use strict';var multer=require(_0xc77b('0x0'));var util=require(_0xc77b('0x1'));var path=require('path');var timeout=require(_0xc77b('0x2'));var express=require(_0xc77b('0x3'));var router=express[_0xc77b('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xc77b('0x5'));var interaction=require(_0xc77b('0x6'));var config=require(_0xc77b('0x7'));var controller=require(_0xc77b('0x8'));router[_0xc77b('0x9')]('/',auth[_0xc77b('0xa')](),controller[_0xc77b('0xb')]);router[_0xc77b('0x9')](_0xc77b('0xc'),auth[_0xc77b('0xa')](),controller[_0xc77b('0xd')]);router[_0xc77b('0x9')](_0xc77b('0xe'),auth[_0xc77b('0xa')](),controller[_0xc77b('0xf')]);router[_0xc77b('0x9')](_0xc77b('0x10'),auth['isAuthenticated'](),controller[_0xc77b('0x11')]);router[_0xc77b('0x12')]('/',auth[_0xc77b('0xa')](),controller['create']);router['post'](_0xc77b('0xe'),auth['isAuthenticated'](),controller[_0xc77b('0x13')]);router[_0xc77b('0x14')](_0xc77b('0xc'),auth[_0xc77b('0xa')](),controller[_0xc77b('0x15')]);router[_0xc77b('0x16')](_0xc77b('0xc'),auth[_0xc77b('0xa')](),controller[_0xc77b('0x17')]);module[_0xc77b('0x18')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 5408395..3cff6e0 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 _0x7040=['exports','STRING','basic','ENUM','integrationTab','newTab','sequelize'];(function(_0x4fbe6f,_0x491413){var _0x22438c=function(_0x111df1){while(--_0x111df1){_0x4fbe6f['push'](_0x4fbe6f['shift']());}};_0x22438c(++_0x491413);}(_0x7040,0x1cd));var _0x0704=function(_0x330cb0,_0x2618b2){_0x330cb0=_0x330cb0-0x0;var _0x38fc0f=_0x7040[_0x330cb0];return _0x38fc0f;};'use strict';var Sequelize=require(_0x0704('0x0'));module[_0x0704('0x1')]={'name':{'type':Sequelize[_0x0704('0x2')]},'description':{'type':Sequelize[_0x0704('0x2')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x0704('0x2')]},'authType':{'type':Sequelize['ENUM']('basic'),'defaultValue':_0x0704('0x3')},'password':{'type':Sequelize[_0x0704('0x2')]},'consumerKey':{'type':Sequelize[_0x0704('0x2')]},'consumerSecret':{'type':Sequelize[_0x0704('0x2')]},'token':{'type':Sequelize[_0x0704('0x2')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x0704('0x4')](_0x0704('0x5'),_0x0704('0x6')),'defaultValue':_0x0704('0x5')}}; \ No newline at end of file +var _0x8687=['sequelize','STRING','ENUM','basic','integrationTab'];(function(_0x4166e3,_0x21a82f){var _0x49135d=function(_0x4236e8){while(--_0x4236e8){_0x4166e3['push'](_0x4166e3['shift']());}};_0x49135d(++_0x21a82f);}(_0x8687,0xe1));var _0x7868=function(_0x539667,_0x1a67dd){_0x539667=_0x539667-0x0;var _0x4643db=_0x8687[_0x539667];return _0x4643db;};'use strict';var Sequelize=require(_0x7868('0x0'));module['exports']={'name':{'type':Sequelize[_0x7868('0x1')]},'description':{'type':Sequelize[_0x7868('0x1')]},'username':{'type':Sequelize[_0x7868('0x1')]},'remoteUri':{'type':Sequelize[_0x7868('0x1')]},'authType':{'type':Sequelize[_0x7868('0x2')](_0x7868('0x3')),'defaultValue':_0x7868('0x3')},'password':{'type':Sequelize[_0x7868('0x1')]},'consumerKey':{'type':Sequelize[_0x7868('0x1')]},'consumerSecret':{'type':Sequelize[_0x7868('0x1')]},'token':{'type':Sequelize[_0x7868('0x1')]},'tokenSecret':{'type':Sequelize[_0x7868('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x7868('0x2')](_0x7868('0x4'),'newTab'),'defaultValue':_0x7868('0x4')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 938ffbd..306cfee 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 _0x8b54=['Basic\x20%s','%s:%s','toString','base64','_embedded','entries','active','label','test','statusCode','error','stringify','Wrong\x20credentials','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','destroy','then','end','name','send','index','map','DeskAccount','rawAttributes','fieldName','key','model','keys','query','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','fields','options','create','update','body','find','getConfigurations','findOne','addConfiguration','Subjects','getSubjects','channel','type','getDescriptions','DeskConfiguration','DeskField','priority','remoteUri','authType','username','password','consumerKey','consumerSecret','token','tokenSecret','slice','substring','format','%s/custom_fields','application/json','basic','headers'];(function(_0x13594e,_0x6f0ed0){var _0x1a4f42=function(_0x30b064){while(--_0x30b064){_0x13594e['push'](_0x13594e['shift']());}};_0x1a4f42(++_0x6f0ed0);}(_0x8b54,0xef));var _0x48b5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8b54[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x48b5('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x48b5('0x1'));var rp=require(_0x48b5('0x2'));var moment=require(_0x48b5('0x3'));var BPromise=require(_0x48b5('0x4'));var Mustache=require(_0x48b5('0x5'));var util=require(_0x48b5('0x6'));var path=require(_0x48b5('0x7'));var sox=require(_0x48b5('0x8'));var csv=require(_0x48b5('0x9'));var ejs=require(_0x48b5('0xa'));var fs=require('fs');var fs_extra=require(_0x48b5('0xb'));var _=require(_0x48b5('0xc'));var squel=require('squel');var crypto=require(_0x48b5('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x48b5('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x48b5('0xf'));var hardwareService=require(_0x48b5('0x10'));var logger=require(_0x48b5('0x11'))(_0x48b5('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x48b5('0x13'));var db=require(_0x48b5('0x14'))['db'];var integrations=require(_0x48b5('0x15'));function respondWithStatusCode(_0x45f6f0,_0xc9d337){_0xc9d337=_0xc9d337||0xcc;return function(_0x4e57c7){if(_0x4e57c7){return _0x45f6f0[_0x48b5('0x16')](_0xc9d337);}return _0x45f6f0[_0x48b5('0x17')](_0xc9d337)['end']();};}function respondWithResult(_0x192f53,_0x22e9bf){_0x22e9bf=_0x22e9bf||0xc8;return function(_0x341425){if(_0x341425){return _0x192f53[_0x48b5('0x17')](_0x22e9bf)['json'](_0x341425);}};}function respondWithFilteredResult(_0x213e28,_0x308683){return function(_0x1c6546){if(_0x1c6546){var _0x25ac09=typeof _0x308683[_0x48b5('0x18')]===_0x48b5('0x19')&&typeof _0x308683['limit']===_0x48b5('0x19');var _0x36d376=_0x1c6546[_0x48b5('0x1a')];var _0x419ae4=_0x25ac09?0x0:_0x308683[_0x48b5('0x18')];var _0x474e06=_0x25ac09?_0x1c6546[_0x48b5('0x1a')]:_0x308683[_0x48b5('0x18')]+_0x308683[_0x48b5('0x1b')];var _0x1e17fe;if(_0x474e06>=_0x36d376){_0x474e06=_0x36d376;_0x1e17fe=0xc8;}else{_0x1e17fe=0xce;}_0x213e28['status'](_0x1e17fe);return _0x213e28[_0x48b5('0x1c')](_0x48b5('0x1d'),_0x419ae4+'-'+_0x474e06+'/'+_0x36d376)[_0x48b5('0x1e')](_0x1c6546);}return null;};}function patchUpdates(_0x4b8276){return function(_0x30e52b){try{jsonpatch[_0x48b5('0x1f')](_0x30e52b,_0x4b8276,!![]);}catch(_0x3271c4){return BPromise[_0x48b5('0x20')](_0x3271c4);}return _0x30e52b[_0x48b5('0x21')]();};}function saveUpdates(_0x3165c0,_0x195340){return function(_0x3b909d){if(_0x3b909d){return _0x3b909d['update'](_0x3165c0)['then'](function(_0x8e23f1){return _0x8e23f1;});}return null;};}function removeEntity(_0x5e55a1,_0x4eccda){return function(_0x3cdb4c){if(_0x3cdb4c){return _0x3cdb4c[_0x48b5('0x22')]()[_0x48b5('0x23')](function(){_0x5e55a1['status'](0xcc)[_0x48b5('0x24')]();});}};}function handleEntityNotFound(_0x30a105,_0x215375){return function(_0x1ce4b8){if(!_0x1ce4b8){_0x30a105[_0x48b5('0x16')](0x194);}return _0x1ce4b8;};}function handleError(_0xb736a,_0x16251a){_0x16251a=_0x16251a||0x1f4;return function(_0x4676be){logger['error'](_0x4676be['stack']);if(_0x4676be['name']){delete _0x4676be[_0x48b5('0x25')];}_0xb736a[_0x48b5('0x17')](_0x16251a)[_0x48b5('0x26')](_0x4676be);};}exports[_0x48b5('0x27')]=function(_0x3ca4,_0x179f90){var _0x31adfc={},_0x5dfca2={},_0x1f3c35={'count':0x0,'rows':[]};var _0xb6532c=_[_0x48b5('0x28')](db[_0x48b5('0x29')][_0x48b5('0x2a')],function(_0x3e66ed){return{'name':_0x3e66ed[_0x48b5('0x2b')],'type':_0x3e66ed['type'][_0x48b5('0x2c')]};});_0x5dfca2[_0x48b5('0x2d')]=_[_0x48b5('0x28')](_0xb6532c,_0x48b5('0x25'));_0x5dfca2['query']=_[_0x48b5('0x2e')](_0x3ca4[_0x48b5('0x2f')]);_0x5dfca2['filters']=_[_0x48b5('0x30')](_0x5dfca2[_0x48b5('0x2d')],_0x5dfca2[_0x48b5('0x2f')]);_0x31adfc[_0x48b5('0x31')]=_[_0x48b5('0x30')](_0x5dfca2[_0x48b5('0x2d')],qs['fields'](_0x3ca4[_0x48b5('0x2f')]['fields']));_0x31adfc[_0x48b5('0x31')]=_0x31adfc['attributes'][_0x48b5('0x32')]?_0x31adfc[_0x48b5('0x31')]:_0x5dfca2[_0x48b5('0x2d')];if(!_0x3ca4[_0x48b5('0x2f')][_0x48b5('0x33')](_0x48b5('0x34'))){_0x31adfc['limit']=qs['limit'](_0x3ca4['query'][_0x48b5('0x1b')]);_0x31adfc[_0x48b5('0x18')]=qs[_0x48b5('0x18')](_0x3ca4[_0x48b5('0x2f')][_0x48b5('0x18')]);}_0x31adfc[_0x48b5('0x35')]=qs['sort'](_0x3ca4['query'][_0x48b5('0x36')]);_0x31adfc['where']=qs[_0x48b5('0x37')](_[_0x48b5('0x38')](_0x3ca4[_0x48b5('0x2f')],_0x5dfca2[_0x48b5('0x37')]),_0xb6532c);if(_0x3ca4[_0x48b5('0x2f')]['filter']){_0x31adfc[_0x48b5('0x39')]=_[_0x48b5('0x3a')](_0x31adfc['where'],{'$or':_['map'](_0xb6532c,function(_0x49b95b){if(_0x49b95b['type']!==_0x48b5('0x3b')){var _0x1aa9e0={};_0x1aa9e0[_0x49b95b[_0x48b5('0x25')]]={'$like':'%'+_0x3ca4[_0x48b5('0x2f')][_0x48b5('0x3c')]+'%'};return _0x1aa9e0;}})});}_0x31adfc=_[_0x48b5('0x3a')]({},_0x31adfc,_0x3ca4['options']);var _0x33d3e7={'where':_0x31adfc[_0x48b5('0x39')]};return db['DeskAccount'][_0x48b5('0x1a')](_0x33d3e7)['then'](function(_0x3006b7){_0x1f3c35[_0x48b5('0x1a')]=_0x3006b7;if(_0x3ca4['query'][_0x48b5('0x3d')]){_0x31adfc[_0x48b5('0x3e')]=[{'all':!![]}];}return db[_0x48b5('0x29')][_0x48b5('0x3f')](_0x31adfc);})[_0x48b5('0x23')](function(_0x336cbf){_0x1f3c35[_0x48b5('0x40')]=_0x336cbf;return _0x1f3c35;})['then'](respondWithFilteredResult(_0x179f90,_0x31adfc))[_0x48b5('0x41')](handleError(_0x179f90,null));};exports[_0x48b5('0x42')]=function(_0x32b971,_0x4d0962){var _0x29d8e1={'raw':![],'where':{'id':_0x32b971[_0x48b5('0x43')]['id']}},_0xa38ef5={};_0xa38ef5[_0x48b5('0x2d')]=_[_0x48b5('0x2e')](db[_0x48b5('0x29')][_0x48b5('0x2a')]);_0xa38ef5[_0x48b5('0x2f')]=_[_0x48b5('0x2e')](_0x32b971[_0x48b5('0x2f')]);_0xa38ef5[_0x48b5('0x37')]=_['intersection'](_0xa38ef5[_0x48b5('0x2d')],_0xa38ef5[_0x48b5('0x2f')]);_0x29d8e1[_0x48b5('0x31')]=_[_0x48b5('0x30')](_0xa38ef5[_0x48b5('0x2d')],qs[_0x48b5('0x44')](_0x32b971[_0x48b5('0x2f')][_0x48b5('0x44')]));_0x29d8e1['attributes']=_0x29d8e1[_0x48b5('0x31')][_0x48b5('0x32')]?_0x29d8e1[_0x48b5('0x31')]:_0xa38ef5[_0x48b5('0x2d')];if(_0x32b971['query'][_0x48b5('0x3d')]){_0x29d8e1[_0x48b5('0x3e')]=[{'all':!![]}];}_0x29d8e1=_[_0x48b5('0x3a')]({},_0x29d8e1,_0x32b971[_0x48b5('0x45')]);return db[_0x48b5('0x29')]['find'](_0x29d8e1)['then'](handleEntityNotFound(_0x4d0962,null))['then'](respondWithResult(_0x4d0962,null))[_0x48b5('0x41')](handleError(_0x4d0962,null));};exports[_0x48b5('0x46')]=function(_0x256c1e,_0x1715d6){return db[_0x48b5('0x29')][_0x48b5('0x46')](_0x256c1e['body'],{})[_0x48b5('0x23')](respondWithResult(_0x1715d6,0xc9))[_0x48b5('0x41')](handleError(_0x1715d6,null));};exports[_0x48b5('0x47')]=function(_0x12db1c,_0x5cfca6){if(_0x12db1c['body']['id']){delete _0x12db1c[_0x48b5('0x48')]['id'];}return db[_0x48b5('0x29')][_0x48b5('0x49')]({'where':{'id':_0x12db1c[_0x48b5('0x43')]['id']}})[_0x48b5('0x23')](handleEntityNotFound(_0x5cfca6,null))[_0x48b5('0x23')](saveUpdates(_0x12db1c['body'],null))[_0x48b5('0x23')](respondWithResult(_0x5cfca6,null))['catch'](handleError(_0x5cfca6,null));};exports['destroy']=function(_0x5e8911,_0x4cfae1){return db[_0x48b5('0x29')][_0x48b5('0x49')]({'where':{'id':_0x5e8911[_0x48b5('0x43')]['id']}})[_0x48b5('0x23')](handleEntityNotFound(_0x4cfae1,null))[_0x48b5('0x23')](removeEntity(_0x4cfae1,null))[_0x48b5('0x41')](handleError(_0x4cfae1,null));};exports[_0x48b5('0x4a')]=function(_0x5b9e96,_0x3921f0,_0x5171b2){var _0x5bc58f={};var _0x514e5b={};var _0x3f08eb;var _0x46076c;return db[_0x48b5('0x29')][_0x48b5('0x4b')]({'where':{'id':_0x5b9e96[_0x48b5('0x43')]['id']}})['then'](handleEntityNotFound(_0x3921f0,null))[_0x48b5('0x23')](function(_0x4ebea0){if(_0x4ebea0){_0x3f08eb=_0x4ebea0;_0x514e5b[_0x48b5('0x2d')]=_['keys'](db['DeskConfiguration'][_0x48b5('0x2a')]);_0x514e5b[_0x48b5('0x2f')]=_[_0x48b5('0x2e')](_0x5b9e96['query']);_0x514e5b[_0x48b5('0x37')]=_[_0x48b5('0x30')](_0x514e5b[_0x48b5('0x2d')],_0x514e5b['query']);_0x5bc58f[_0x48b5('0x31')]=_[_0x48b5('0x30')](_0x514e5b['model'],qs['fields'](_0x5b9e96['query'][_0x48b5('0x44')]));_0x5bc58f[_0x48b5('0x31')]=_0x5bc58f[_0x48b5('0x31')][_0x48b5('0x32')]?_0x5bc58f['attributes']:_0x514e5b[_0x48b5('0x2d')];_0x5bc58f[_0x48b5('0x35')]=qs[_0x48b5('0x36')](_0x5b9e96[_0x48b5('0x2f')]['sort']);_0x5bc58f[_0x48b5('0x39')]=qs['filters'](_[_0x48b5('0x38')](_0x5b9e96[_0x48b5('0x2f')],_0x514e5b[_0x48b5('0x37')]));if(_0x5b9e96[_0x48b5('0x2f')][_0x48b5('0x3c')]){_0x5bc58f[_0x48b5('0x39')]=_[_0x48b5('0x3a')](_0x5bc58f[_0x48b5('0x39')],{'$or':_['map'](_0x5bc58f['attributes'],function(_0xd46e1c){var _0x4ea310={};_0x4ea310[_0xd46e1c]={'$like':'%'+_0x5b9e96[_0x48b5('0x2f')][_0x48b5('0x3c')]+'%'};return _0x4ea310;})});}_0x5bc58f=_['merge']({},_0x5bc58f,_0x5b9e96['options']);return _0x3f08eb[_0x48b5('0x4a')](_0x5bc58f);}})['then'](function(_0x5bef70){if(_0x5bef70){_0x46076c=_0x5bef70[_0x48b5('0x32')];if(!_0x5b9e96[_0x48b5('0x2f')]['hasOwnProperty']('nolimit')){_0x5bc58f[_0x48b5('0x1b')]=qs[_0x48b5('0x1b')](_0x5b9e96[_0x48b5('0x2f')][_0x48b5('0x1b')]);_0x5bc58f['offset']=qs[_0x48b5('0x18')](_0x5b9e96[_0x48b5('0x2f')][_0x48b5('0x18')]);}return _0x3f08eb[_0x48b5('0x4a')](_0x5bc58f);}})[_0x48b5('0x23')](function(_0x452512){if(_0x452512){return _0x452512?{'count':_0x46076c,'rows':_0x452512}:null;}})[_0x48b5('0x23')](respondWithResult(_0x3921f0,null))[_0x48b5('0x41')](handleError(_0x3921f0,null));};exports[_0x48b5('0x4c')]=function(_0x6fa89,_0x13fa01,_0x4092e3){if(_0x6fa89['body']['id']){delete _0x6fa89[_0x48b5('0x48')]['id'];}return db[_0x48b5('0x29')][_0x48b5('0x4b')]({'where':{'id':_0x6fa89[_0x48b5('0x43')]['id']}})[_0x48b5('0x23')](handleEntityNotFound(_0x13fa01,null))['then'](function(_0x1bebae){if(_0x1bebae){_0x6fa89[_0x48b5('0x48')]['AccountId']=_0x1bebae['id'];_0x6fa89[_0x48b5('0x48')][_0x48b5('0x4d')]=integrations[_0x48b5('0x4e')](_0x6fa89[_0x48b5('0x48')][_0x48b5('0x4f')],_0x6fa89['body'][_0x48b5('0x50')]);_0x6fa89['body']['Descriptions']=integrations[_0x48b5('0x51')](_0x6fa89[_0x48b5('0x48')]['channel'],_0x6fa89[_0x48b5('0x48')]['type']);return db[_0x48b5('0x52')][_0x48b5('0x46')](_0x6fa89['body'],{'include':[{'model':db['DeskField'],'as':_0x48b5('0x4d')},{'model':db[_0x48b5('0x53')],'as':'Descriptions'}]});}return null;})[_0x48b5('0x23')](respondWithResult(_0x13fa01,null))[_0x48b5('0x41')](handleError(_0x13fa01,null));};exports['getFields']=function(_0x449d96,_0x37b48c,_0x1bf67d){var _0x45bf0a=[{'name':_0x48b5('0x54'),'label':_0x48b5('0x54'),'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 _0x597ef4='';return db[_0x48b5('0x29')][_0x48b5('0x4b')]({'where':{'id':_0x449d96['params']['id']},'attributes':['id',_0x48b5('0x55'),_0x48b5('0x56'),_0x48b5('0x57'),_0x48b5('0x58'),_0x48b5('0x59'),_0x48b5('0x5a'),_0x48b5('0x5b'),_0x48b5('0x5c')]})['then'](handleEntityNotFound(_0x37b48c,null))[_0x48b5('0x23')](function(_0x3e4f94){if(_0x3e4f94){_0x597ef4=_0x3e4f94[_0x48b5('0x55')];var _0x1ae72d=_0x597ef4[_0x48b5('0x5d')](-0x1);if(_0x1ae72d==='/'){_0x597ef4=_0x597ef4[_0x48b5('0x5e')](0x0,_0x597ef4['lastIndexOf'](_0x1ae72d));}var _0x53916b={'method':'GET','uri':util[_0x48b5('0x5f')](_0x48b5('0x60'),_0x597ef4),'headers':{'Content-Type':_0x48b5('0x61'),'Accept':'application/json'},'json':!![]};if(_0x3e4f94['authType']===_0x48b5('0x62')){_0x53916b[_0x48b5('0x63')]['Authorization']=util[_0x48b5('0x5f')](_0x48b5('0x64'),new Buffer(util[_0x48b5('0x5f')](_0x48b5('0x65'),_0x3e4f94[_0x48b5('0x57')],_0x3e4f94[_0x48b5('0x58')]))[_0x48b5('0x66')](_0x48b5('0x67')));}return rp(_0x53916b)['then'](function(_0x25c680){return _0x45bf0a['concat'](_[_0x48b5('0x28')](_0x25c680[_0x48b5('0x68')][_0x48b5('0x69')],function(_0x180d76){return{'id':_0x180d76['name'],'name':_0x180d76[_0x48b5('0x25')],'type':_0x180d76[_0x48b5('0x50')],'active':_0x180d76[_0x48b5('0x6a')],'label':_0x180d76[_0x48b5('0x6b')],'custom':!![]};}));});}})[_0x48b5('0x23')](function(_0x4280f9){return{'count':_0x4280f9[_0x48b5('0x32')],'rows':_0x4280f9};})[_0x48b5('0x23')](respondWithResult(_0x37b48c,null))[_0x48b5('0x41')](function(_0x186b3e){var _0x52c9f1=_0x449d96[_0x48b5('0x2f')][_0x48b5('0x6c')]?0x1f4:_0x186b3e[_0x48b5('0x6d')]||0x1f4;logger[_0x48b5('0x6e')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x52c9f1,JSON[_0x48b5('0x6f')](_0x186b3e));delete _0x186b3e[_0x48b5('0x25')];if(_0x52c9f1===0x191){_0x52c9f1=0x190;}_0x37b48c[_0x48b5('0x17')](_0x52c9f1)[_0x48b5('0x26')](_0x449d96[_0x48b5('0x2f')][_0x48b5('0x6c')]?{'message':_0x48b5('0x70'),'statusCode':_0x186b3e[_0x48b5('0x6d')]}:_0x186b3e);});}; \ No newline at end of file +var _0x4015=['password','consumerSecret','token','tokenSecret','slice','substring','GET','format','application/json','basic','Authorization','Basic\x20%s','base64','concat','_embedded','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','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','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','end','status','json','offset','limit','undefined','count','Content-Range','reject','save','update','then','destroy','error','name','map','DeskAccount','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','show','params','find','catch','create','body','getConfigurations','hasOwnProperty','nolimit','AccountId','Subjects','getSubjects','channel','Descriptions','DeskConfiguration','DeskField','getFields','priority','findOne','remoteUri','username'];(function(_0x4b0d16,_0x29b6db){var _0x579e2a=function(_0x1d35cb){while(--_0x1d35cb){_0x4b0d16['push'](_0x4b0d16['shift']());}};_0x579e2a(++_0x29b6db);}(_0x4015,0x1c9));var _0x5401=function(_0x4450b1,_0x214ace){_0x4450b1=_0x4450b1-0x0;var _0x399b0b=_0x4015[_0x4450b1];return _0x399b0b;};'use strict';var emlformat=require(_0x5401('0x0'));var rimraf=require(_0x5401('0x1'));var zipdir=require(_0x5401('0x2'));var jsonpatch=require(_0x5401('0x3'));var rp=require(_0x5401('0x4'));var moment=require(_0x5401('0x5'));var BPromise=require(_0x5401('0x6'));var Mustache=require(_0x5401('0x7'));var util=require(_0x5401('0x8'));var path=require(_0x5401('0x9'));var sox=require('sox');var csv=require(_0x5401('0xa'));var ejs=require(_0x5401('0xb'));var fs=require('fs');var fs_extra=require(_0x5401('0xc'));var _=require(_0x5401('0xd'));var squel=require(_0x5401('0xe'));var crypto=require(_0x5401('0xf'));var jsforce=require(_0x5401('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x5401('0xa'));var querystring=require(_0x5401('0x11'));var Papa=require(_0x5401('0x12'));var Redis=require(_0x5401('0x13'));var authService=require(_0x5401('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x5401('0x15'));var hardwareService=require(_0x5401('0x16'));var logger=require(_0x5401('0x17'))('api');var utils=require(_0x5401('0x18'));var config=require(_0x5401('0x19'));var licenseUtil=require(_0x5401('0x1a'));var db=require('../../mysqldb')['db'];var integrations=require(_0x5401('0x1b'));function respondWithStatusCode(_0x40b270,_0x200ffd){_0x200ffd=_0x200ffd||0xcc;return function(_0x1f87ed){if(_0x1f87ed){return _0x40b270[_0x5401('0x1c')](_0x200ffd);}return _0x40b270['status'](_0x200ffd)[_0x5401('0x1d')]();};}function respondWithResult(_0x3a49ab,_0x37332b){_0x37332b=_0x37332b||0xc8;return function(_0x3d9dc9){if(_0x3d9dc9){return _0x3a49ab[_0x5401('0x1e')](_0x37332b)[_0x5401('0x1f')](_0x3d9dc9);}};}function respondWithFilteredResult(_0x3429b1,_0x596bff){return function(_0x1bcb4e){if(_0x1bcb4e){var _0x2b45f7=typeof _0x596bff[_0x5401('0x20')]==='undefined'&&typeof _0x596bff[_0x5401('0x21')]===_0x5401('0x22');var _0x3b2e54=_0x1bcb4e[_0x5401('0x23')];var _0x36a348=_0x2b45f7?0x0:_0x596bff[_0x5401('0x20')];var _0x4097c0=_0x2b45f7?_0x1bcb4e[_0x5401('0x23')]:_0x596bff[_0x5401('0x20')]+_0x596bff[_0x5401('0x21')];var _0x26b004;if(_0x4097c0>=_0x3b2e54){_0x4097c0=_0x3b2e54;_0x26b004=0xc8;}else{_0x26b004=0xce;}_0x3429b1[_0x5401('0x1e')](_0x26b004);return _0x3429b1['set'](_0x5401('0x24'),_0x36a348+'-'+_0x4097c0+'/'+_0x3b2e54)[_0x5401('0x1f')](_0x1bcb4e);}return null;};}function patchUpdates(_0x57cc23){return function(_0x310b87){try{jsonpatch['apply'](_0x310b87,_0x57cc23,!![]);}catch(_0x1fabf8){return BPromise[_0x5401('0x25')](_0x1fabf8);}return _0x310b87[_0x5401('0x26')]();};}function saveUpdates(_0x2f681d,_0xfa58b7){return function(_0x585e1e){if(_0x585e1e){return _0x585e1e[_0x5401('0x27')](_0x2f681d)[_0x5401('0x28')](function(_0x167ecf){return _0x167ecf;});}return null;};}function removeEntity(_0x3b9054,_0x180b49){return function(_0x2dd9c0){if(_0x2dd9c0){return _0x2dd9c0[_0x5401('0x29')]()['then'](function(){_0x3b9054[_0x5401('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b78fe,_0x505ca9){return function(_0x807c64){if(!_0x807c64){_0x2b78fe[_0x5401('0x1c')](0x194);}return _0x807c64;};}function handleError(_0x298449,_0x75a7b9){_0x75a7b9=_0x75a7b9||0x1f4;return function(_0x661251){logger[_0x5401('0x2a')](_0x661251['stack']);if(_0x661251[_0x5401('0x2b')]){delete _0x661251['name'];}_0x298449['status'](_0x75a7b9)['send'](_0x661251);};}exports['index']=function(_0x3d7203,_0x3909d8){var _0x3f7f55={},_0x34f58b={},_0x3b3d81={'count':0x0,'rows':[]};var _0x1e16df=_[_0x5401('0x2c')](db[_0x5401('0x2d')][_0x5401('0x2e')],function(_0x17c0cd){return{'name':_0x17c0cd['fieldName'],'type':_0x17c0cd[_0x5401('0x2f')][_0x5401('0x30')]};});_0x34f58b[_0x5401('0x31')]=_['map'](_0x1e16df,_0x5401('0x2b'));_0x34f58b[_0x5401('0x32')]=_[_0x5401('0x33')](_0x3d7203[_0x5401('0x32')]);_0x34f58b[_0x5401('0x34')]=_[_0x5401('0x35')](_0x34f58b[_0x5401('0x31')],_0x34f58b['query']);_0x3f7f55[_0x5401('0x36')]=_[_0x5401('0x35')](_0x34f58b['model'],qs[_0x5401('0x37')](_0x3d7203[_0x5401('0x32')][_0x5401('0x37')]));_0x3f7f55[_0x5401('0x36')]=_0x3f7f55[_0x5401('0x36')][_0x5401('0x38')]?_0x3f7f55[_0x5401('0x36')]:_0x34f58b[_0x5401('0x31')];if(!_0x3d7203['query']['hasOwnProperty']('nolimit')){_0x3f7f55[_0x5401('0x21')]=qs[_0x5401('0x21')](_0x3d7203[_0x5401('0x32')]['limit']);_0x3f7f55['offset']=qs[_0x5401('0x20')](_0x3d7203['query'][_0x5401('0x20')]);}_0x3f7f55[_0x5401('0x39')]=qs['sort'](_0x3d7203[_0x5401('0x32')][_0x5401('0x3a')]);_0x3f7f55[_0x5401('0x3b')]=qs['filters'](_[_0x5401('0x3c')](_0x3d7203[_0x5401('0x32')],_0x34f58b[_0x5401('0x34')]),_0x1e16df);if(_0x3d7203[_0x5401('0x32')][_0x5401('0x3d')]){_0x3f7f55[_0x5401('0x3b')]=_['merge'](_0x3f7f55[_0x5401('0x3b')],{'$or':_[_0x5401('0x2c')](_0x1e16df,function(_0x2e5058){if(_0x2e5058[_0x5401('0x2f')]!==_0x5401('0x3e')){var _0x398a76={};_0x398a76[_0x2e5058[_0x5401('0x2b')]]={'$like':'%'+_0x3d7203[_0x5401('0x32')][_0x5401('0x3d')]+'%'};return _0x398a76;}})});}_0x3f7f55=_[_0x5401('0x3f')]({},_0x3f7f55,_0x3d7203[_0x5401('0x40')]);var _0x19f85f={'where':_0x3f7f55[_0x5401('0x3b')]};return db['DeskAccount'][_0x5401('0x23')](_0x19f85f)['then'](function(_0x447462){_0x3b3d81[_0x5401('0x23')]=_0x447462;if(_0x3d7203[_0x5401('0x32')][_0x5401('0x41')]){_0x3f7f55[_0x5401('0x42')]=[{'all':!![]}];}return db[_0x5401('0x2d')]['findAll'](_0x3f7f55);})[_0x5401('0x28')](function(_0x484aee){_0x3b3d81['rows']=_0x484aee;return _0x3b3d81;})[_0x5401('0x28')](respondWithFilteredResult(_0x3909d8,_0x3f7f55))['catch'](handleError(_0x3909d8,null));};exports[_0x5401('0x43')]=function(_0x4a32be,_0x369dbe){var _0x311d45={'raw':![],'where':{'id':_0x4a32be[_0x5401('0x44')]['id']}},_0xcd19e0={};_0xcd19e0[_0x5401('0x31')]=_[_0x5401('0x33')](db[_0x5401('0x2d')][_0x5401('0x2e')]);_0xcd19e0['query']=_['keys'](_0x4a32be[_0x5401('0x32')]);_0xcd19e0[_0x5401('0x34')]=_[_0x5401('0x35')](_0xcd19e0['model'],_0xcd19e0[_0x5401('0x32')]);_0x311d45[_0x5401('0x36')]=_[_0x5401('0x35')](_0xcd19e0['model'],qs[_0x5401('0x37')](_0x4a32be[_0x5401('0x32')]['fields']));_0x311d45['attributes']=_0x311d45[_0x5401('0x36')]['length']?_0x311d45['attributes']:_0xcd19e0[_0x5401('0x31')];if(_0x4a32be[_0x5401('0x32')][_0x5401('0x41')]){_0x311d45[_0x5401('0x42')]=[{'all':!![]}];}_0x311d45=_[_0x5401('0x3f')]({},_0x311d45,_0x4a32be[_0x5401('0x40')]);return db[_0x5401('0x2d')][_0x5401('0x45')](_0x311d45)[_0x5401('0x28')](handleEntityNotFound(_0x369dbe,null))[_0x5401('0x28')](respondWithResult(_0x369dbe,null))[_0x5401('0x46')](handleError(_0x369dbe,null));};exports[_0x5401('0x47')]=function(_0x1630b4,_0x2e8ae5){return db[_0x5401('0x2d')][_0x5401('0x47')](_0x1630b4[_0x5401('0x48')],{})[_0x5401('0x28')](respondWithResult(_0x2e8ae5,0xc9))[_0x5401('0x46')](handleError(_0x2e8ae5,null));};exports[_0x5401('0x27')]=function(_0x51fb71,_0x368611){if(_0x51fb71[_0x5401('0x48')]['id']){delete _0x51fb71[_0x5401('0x48')]['id'];}return db[_0x5401('0x2d')][_0x5401('0x45')]({'where':{'id':_0x51fb71[_0x5401('0x44')]['id']}})[_0x5401('0x28')](handleEntityNotFound(_0x368611,null))['then'](saveUpdates(_0x51fb71[_0x5401('0x48')],null))[_0x5401('0x28')](respondWithResult(_0x368611,null))['catch'](handleError(_0x368611,null));};exports[_0x5401('0x29')]=function(_0x23c79b,_0x48d525){return db['DeskAccount']['find']({'where':{'id':_0x23c79b['params']['id']}})[_0x5401('0x28')](handleEntityNotFound(_0x48d525,null))[_0x5401('0x28')](removeEntity(_0x48d525,null))['catch'](handleError(_0x48d525,null));};exports[_0x5401('0x49')]=function(_0x581cc1,_0x28b197,_0x29f527){var _0xa990ea={};var _0x1fe71a={};var _0x5420e9;var _0x407bdd;return db[_0x5401('0x2d')]['findOne']({'where':{'id':_0x581cc1[_0x5401('0x44')]['id']}})[_0x5401('0x28')](handleEntityNotFound(_0x28b197,null))[_0x5401('0x28')](function(_0x196ef6){if(_0x196ef6){_0x5420e9=_0x196ef6;_0x1fe71a[_0x5401('0x31')]=_[_0x5401('0x33')](db['DeskConfiguration'][_0x5401('0x2e')]);_0x1fe71a[_0x5401('0x32')]=_['keys'](_0x581cc1[_0x5401('0x32')]);_0x1fe71a[_0x5401('0x34')]=_[_0x5401('0x35')](_0x1fe71a[_0x5401('0x31')],_0x1fe71a[_0x5401('0x32')]);_0xa990ea[_0x5401('0x36')]=_[_0x5401('0x35')](_0x1fe71a[_0x5401('0x31')],qs[_0x5401('0x37')](_0x581cc1['query'][_0x5401('0x37')]));_0xa990ea[_0x5401('0x36')]=_0xa990ea['attributes']['length']?_0xa990ea['attributes']:_0x1fe71a['model'];_0xa990ea[_0x5401('0x39')]=qs[_0x5401('0x3a')](_0x581cc1[_0x5401('0x32')][_0x5401('0x3a')]);_0xa990ea[_0x5401('0x3b')]=qs['filters'](_['pick'](_0x581cc1[_0x5401('0x32')],_0x1fe71a[_0x5401('0x34')]));if(_0x581cc1['query']['filter']){_0xa990ea[_0x5401('0x3b')]=_['merge'](_0xa990ea['where'],{'$or':_[_0x5401('0x2c')](_0xa990ea[_0x5401('0x36')],function(_0x323408){var _0x15687c={};_0x15687c[_0x323408]={'$like':'%'+_0x581cc1[_0x5401('0x32')][_0x5401('0x3d')]+'%'};return _0x15687c;})});}_0xa990ea=_[_0x5401('0x3f')]({},_0xa990ea,_0x581cc1[_0x5401('0x40')]);return _0x5420e9['getConfigurations'](_0xa990ea);}})[_0x5401('0x28')](function(_0x2ae6fc){if(_0x2ae6fc){_0x407bdd=_0x2ae6fc[_0x5401('0x38')];if(!_0x581cc1[_0x5401('0x32')][_0x5401('0x4a')](_0x5401('0x4b'))){_0xa990ea['limit']=qs['limit'](_0x581cc1[_0x5401('0x32')]['limit']);_0xa990ea['offset']=qs[_0x5401('0x20')](_0x581cc1[_0x5401('0x32')][_0x5401('0x20')]);}return _0x5420e9['getConfigurations'](_0xa990ea);}})['then'](function(_0x9fc5be){if(_0x9fc5be){return _0x9fc5be?{'count':_0x407bdd,'rows':_0x9fc5be}:null;}})[_0x5401('0x28')](respondWithResult(_0x28b197,null))[_0x5401('0x46')](handleError(_0x28b197,null));};exports['addConfiguration']=function(_0x2f1065,_0x9c8304,_0x31679a){if(_0x2f1065[_0x5401('0x48')]['id']){delete _0x2f1065['body']['id'];}return db[_0x5401('0x2d')]['findOne']({'where':{'id':_0x2f1065['params']['id']}})[_0x5401('0x28')](handleEntityNotFound(_0x9c8304,null))[_0x5401('0x28')](function(_0x561152){if(_0x561152){_0x2f1065['body'][_0x5401('0x4c')]=_0x561152['id'];_0x2f1065[_0x5401('0x48')][_0x5401('0x4d')]=integrations[_0x5401('0x4e')](_0x2f1065[_0x5401('0x48')][_0x5401('0x4f')],_0x2f1065['body']['type']);_0x2f1065[_0x5401('0x48')][_0x5401('0x50')]=integrations['getDescriptions'](_0x2f1065[_0x5401('0x48')][_0x5401('0x4f')],_0x2f1065[_0x5401('0x48')]['type']);return db[_0x5401('0x51')][_0x5401('0x47')](_0x2f1065['body'],{'include':[{'model':db[_0x5401('0x52')],'as':_0x5401('0x4d')},{'model':db[_0x5401('0x52')],'as':_0x5401('0x50')}]});}return null;})[_0x5401('0x28')](respondWithResult(_0x9c8304,null))['catch'](handleError(_0x9c8304,null));};exports[_0x5401('0x53')]=function(_0x500445,_0x33f2bc,_0x6bbf4b){var _0x476ef6=[{'name':_0x5401('0x54'),'label':_0x5401('0x54'),'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 _0x79ae1f='';return db[_0x5401('0x2d')][_0x5401('0x55')]({'where':{'id':_0x500445[_0x5401('0x44')]['id']},'attributes':['id',_0x5401('0x56'),'authType',_0x5401('0x57'),_0x5401('0x58'),'consumerKey',_0x5401('0x59'),_0x5401('0x5a'),_0x5401('0x5b')]})['then'](handleEntityNotFound(_0x33f2bc,null))[_0x5401('0x28')](function(_0x12ab28){if(_0x12ab28){_0x79ae1f=_0x12ab28[_0x5401('0x56')];var _0x17a588=_0x79ae1f[_0x5401('0x5c')](-0x1);if(_0x17a588==='/'){_0x79ae1f=_0x79ae1f[_0x5401('0x5d')](0x0,_0x79ae1f['lastIndexOf'](_0x17a588));}var _0x294cda={'method':_0x5401('0x5e'),'uri':util[_0x5401('0x5f')]('%s/custom_fields',_0x79ae1f),'headers':{'Content-Type':_0x5401('0x60'),'Accept':'application/json'},'json':!![]};if(_0x12ab28['authType']===_0x5401('0x61')){_0x294cda['headers'][_0x5401('0x62')]=util[_0x5401('0x5f')](_0x5401('0x63'),new Buffer(util['format']('%s:%s',_0x12ab28[_0x5401('0x57')],_0x12ab28['password']))['toString'](_0x5401('0x64')));}return rp(_0x294cda)[_0x5401('0x28')](function(_0x222880){return _0x476ef6[_0x5401('0x65')](_[_0x5401('0x2c')](_0x222880[_0x5401('0x66')]['entries'],function(_0x303f69){return{'id':_0x303f69[_0x5401('0x2b')],'name':_0x303f69[_0x5401('0x2b')],'type':_0x303f69[_0x5401('0x2f')],'active':_0x303f69['active'],'label':_0x303f69[_0x5401('0x67')],'custom':!![]};}));});}})['then'](function(_0x132c5e){return{'count':_0x132c5e[_0x5401('0x38')],'rows':_0x132c5e};})[_0x5401('0x28')](respondWithResult(_0x33f2bc,null))[_0x5401('0x46')](function(_0x4af5d7){var _0x47665c=_0x500445[_0x5401('0x32')][_0x5401('0x68')]?0x1f4:_0x4af5d7[_0x5401('0x69')]||0x1f4;logger[_0x5401('0x2a')](_0x5401('0x6a'),_0x5401('0x53'),_0x47665c,JSON[_0x5401('0x6b')](_0x4af5d7));delete _0x4af5d7[_0x5401('0x2b')];if(_0x47665c===0x191){_0x47665c=0x190;}_0x33f2bc[_0x5401('0x1e')](_0x47665c)[_0x5401('0x6c')](_0x500445['query'][_0x5401('0x68')]?{'message':'Wrong\x20credentials','statusCode':_0x4af5d7[_0x5401('0x69')]}:_0x4af5d7);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 4922a03..d45e12c 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 _0x9ba9=['path','../../config/environment','../../components/integrations/configuration','exports','int_desk_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5a79e2,_0x319b1a){var _0x266c45=function(_0x172478){while(--_0x172478){_0x5a79e2['push'](_0x5a79e2['shift']());}};_0x266c45(++_0x319b1a);}(_0x9ba9,0x1d9));var _0x99ba=function(_0x3fb487,_0x383652){_0x3fb487=_0x3fb487-0x0;var _0x4aca48=_0x9ba9[_0x3fb487];return _0x4aca48;};'use strict';var _=require(_0x99ba('0x0'));var util=require(_0x99ba('0x1'));var logger=require(_0x99ba('0x2'))(_0x99ba('0x3'));var moment=require(_0x99ba('0x4'));var BPromise=require(_0x99ba('0x5'));var rp=require(_0x99ba('0x6'));var fs=require('fs');var path=require(_0x99ba('0x7'));var rimraf=require('rimraf');var config=require(_0x99ba('0x8'));var attributes=require('./intDeskAccount.attributes');var integrations=require(_0x99ba('0x9'));module[_0x99ba('0xa')]=function(_0x508fd3,_0x1e94d8){return _0x508fd3['define']('DeskAccount',attributes,{'tableName':_0x99ba('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x57f6=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports','DeskAccount','int_desk_accounts','lodash'];(function(_0x17f1dc,_0x1868d1){var _0x590343=function(_0x558f4b){while(--_0x558f4b){_0x17f1dc['push'](_0x17f1dc['shift']());}};_0x590343(++_0x1868d1);}(_0x57f6,0x7d));var _0x657f=function(_0x461119,_0x28ce98){_0x461119=_0x461119-0x0;var _0x4b5ed3=_0x57f6[_0x461119];return _0x4b5ed3;};'use strict';var _=require(_0x657f('0x0'));var util=require('util');var logger=require(_0x657f('0x1'))(_0x657f('0x2'));var moment=require(_0x657f('0x3'));var BPromise=require(_0x657f('0x4'));var rp=require(_0x657f('0x5'));var fs=require('fs');var path=require(_0x657f('0x6'));var rimraf=require(_0x657f('0x7'));var config=require(_0x657f('0x8'));var attributes=require(_0x657f('0x9'));var integrations=require(_0x657f('0xa'));module[_0x657f('0xb')]=function(_0x1f1f29,_0xfc1f45){return _0x1f1f29['define'](_0x657f('0xc'),attributes,{'tableName':_0x657f('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index a4e4513..1165129 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 _0x39de=['where','limit','include','map','model','attributes','then','debug','stringify','catch','ShowDeskAccount','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','info','DeskAccount,\x20%s,\x20%s','request\x20sent','error','code','message','result','GetDeskAccount','DeskAccount','findAll','options','raw'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x39de,0xd7));var _0xe39d=function(_0x15185f,_0x2003a5){_0x15185f=_0x15185f-0x0;var _0x3c9c47=_0x39de[_0x15185f];return _0x3c9c47;};'use strict';var _=require('lodash');var util=require(_0xe39d('0x0'));var moment=require(_0xe39d('0x1'));var BPromise=require(_0xe39d('0x2'));var rs=require(_0xe39d('0x3'));var fs=require('fs');var Redis=require(_0xe39d('0x4'));var db=require(_0xe39d('0x5'))['db'];var utils=require(_0xe39d('0x6'));var logger=require(_0xe39d('0x7'))('rpc');var config=require(_0xe39d('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe39d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x176b31,_0x314c72,_0x2e05e7){return new BPromise(function(_0x24827f,_0x12c705){return client[_0xe39d('0xa')](_0x176b31,_0x2e05e7)['then'](function(_0x6012e4){logger[_0xe39d('0xb')](_0xe39d('0xc'),_0x314c72,'request\x20sent');logger['debug']('DeskAccount,\x20%s,\x20%s,\x20%s',_0x314c72,_0xe39d('0xd'),JSON['stringify'](_0x6012e4));if(_0x6012e4[_0xe39d('0xe')]){if(_0x6012e4[_0xe39d('0xe')][_0xe39d('0xf')]===0x1f4){logger[_0xe39d('0xe')]('DeskAccount,\x20%s,\x20%s',_0x314c72,_0x6012e4[_0xe39d('0xe')][_0xe39d('0x10')]);return _0x12c705(_0x6012e4[_0xe39d('0xe')][_0xe39d('0x10')]);}logger[_0xe39d('0xe')](_0xe39d('0xc'),_0x314c72,_0x6012e4['error'][_0xe39d('0x10')]);return _0x24827f(_0x6012e4[_0xe39d('0xe')][_0xe39d('0x10')]);}else{logger['info'](_0xe39d('0xc'),_0x314c72,_0xe39d('0xd'));_0x24827f(_0x6012e4[_0xe39d('0x11')]['message']);}})['catch'](function(_0x474d1a){logger[_0xe39d('0xe')](_0xe39d('0xc'),_0x314c72,_0x474d1a);_0x12c705(_0x474d1a);});});}exports[_0xe39d('0x12')]=function(_0x1ab097){var _0x51ea04=this;return new Promise(function(_0x20f406,_0x514780){return db[_0xe39d('0x13')][_0xe39d('0x14')]({'raw':_0x1ab097[_0xe39d('0x15')]?_0x1ab097[_0xe39d('0x15')][_0xe39d('0x16')]===undefined?!![]:![]:!![],'where':_0x1ab097[_0xe39d('0x15')]?_0x1ab097[_0xe39d('0x15')][_0xe39d('0x17')]||null:null,'attributes':_0x1ab097[_0xe39d('0x15')]?_0x1ab097['options']['attributes']||null:null,'limit':_0x1ab097[_0xe39d('0x15')]?_0x1ab097[_0xe39d('0x15')][_0xe39d('0x18')]||null:null,'include':_0x1ab097['options']?_0x1ab097[_0xe39d('0x15')][_0xe39d('0x19')]?_[_0xe39d('0x1a')](_0x1ab097[_0xe39d('0x15')][_0xe39d('0x19')],function(_0xfe3e8f){return{'model':db[_0xfe3e8f[_0xe39d('0x1b')]],'as':_0xfe3e8f['as'],'attributes':_0xfe3e8f[_0xe39d('0x1c')],'include':_0xfe3e8f['include']?_[_0xe39d('0x1a')](_0xfe3e8f['include'],function(_0x209bac){return{'model':db[_0x209bac[_0xe39d('0x1b')]],'as':_0x209bac['as'],'attributes':_0x209bac[_0xe39d('0x1c')],'include':_0x209bac[_0xe39d('0x19')]?_[_0xe39d('0x1a')](_0x209bac[_0xe39d('0x19')],function(_0x389330){return{'model':db[_0x389330[_0xe39d('0x1b')]],'as':_0x389330['as'],'attributes':_0x389330[_0xe39d('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xe39d('0x1d')](function(_0x19dfe1){logger[_0xe39d('0xb')](_0xe39d('0x12'),_0x1ab097);logger[_0xe39d('0x1e')](_0xe39d('0x12'),_0x1ab097,JSON[_0xe39d('0x1f')](_0x19dfe1));_0x20f406(_0x19dfe1);})[_0xe39d('0x20')](function(_0x1880cc){logger[_0xe39d('0xe')](_0xe39d('0x12'),_0x1880cc[_0xe39d('0x10')],_0x1ab097);_0x514780(_0x51ea04[_0xe39d('0xe')](0x1f4,_0x1880cc[_0xe39d('0x10')]));});});};exports['ShowDeskAccount']=function(_0x451944){var _0x1f8d30=this;return new Promise(function(_0x4dadc3,_0x40d299){return db[_0xe39d('0x13')]['find']({'raw':_0x451944['options']?_0x451944['options'][_0xe39d('0x16')]===undefined?!![]:![]:!![],'where':_0x451944[_0xe39d('0x15')]?_0x451944[_0xe39d('0x15')]['where']||null:null,'attributes':_0x451944[_0xe39d('0x15')]?_0x451944[_0xe39d('0x15')][_0xe39d('0x1c')]||null:null,'include':_0x451944[_0xe39d('0x15')]?_0x451944[_0xe39d('0x15')][_0xe39d('0x19')]?_[_0xe39d('0x1a')](_0x451944['options']['include'],function(_0x2a6ab4){return{'model':db[_0x2a6ab4[_0xe39d('0x1b')]],'as':_0x2a6ab4['as'],'attributes':_0x2a6ab4[_0xe39d('0x1c')],'include':_0x2a6ab4[_0xe39d('0x19')]?_[_0xe39d('0x1a')](_0x2a6ab4[_0xe39d('0x19')],function(_0x184aa4){return{'model':db[_0x184aa4[_0xe39d('0x1b')]],'as':_0x184aa4['as'],'attributes':_0x184aa4[_0xe39d('0x1c')],'include':_0x184aa4[_0xe39d('0x19')]?_[_0xe39d('0x1a')](_0x184aa4[_0xe39d('0x19')],function(_0xc04099){return{'model':db[_0xc04099[_0xe39d('0x1b')]],'as':_0xc04099['as'],'attributes':_0xc04099[_0xe39d('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xe39d('0x1d')](function(_0x1b114c){logger['info'](_0xe39d('0x21'),_0x451944);logger[_0xe39d('0x1e')](_0xe39d('0x21'),_0x451944,JSON[_0xe39d('0x1f')](_0x1b114c));_0x4dadc3(_0x1b114c);})[_0xe39d('0x20')](function(_0x20cfdd){logger[_0xe39d('0xe')]('ShowDeskAccount',_0x20cfdd[_0xe39d('0x10')],_0x451944);_0x40d299(_0x1f8d30[_0xe39d('0xe')](0x1f4,_0x20cfdd[_0xe39d('0x10')]));});});}; \ No newline at end of file +var _0x2440=['GetDeskAccount','DeskAccount','findAll','options','where','attributes','limit','include','model','map','ShowDeskAccount','raw','stringify','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x374401,_0x8d0054){var _0x19815d=function(_0x546762){while(--_0x546762){_0x374401['push'](_0x374401['shift']());}};_0x19815d(++_0x8d0054);}(_0x2440,0xf1));var _0x0244=function(_0x57d341,_0x3b65d3){_0x57d341=_0x57d341-0x0;var _0x2e627b=_0x2440[_0x57d341];return _0x2e627b;};'use strict';var _=require(_0x0244('0x0'));var util=require(_0x0244('0x1'));var moment=require(_0x0244('0x2'));var BPromise=require('bluebird');var rs=require(_0x0244('0x3'));var fs=require('fs');var Redis=require(_0x0244('0x4'));var db=require(_0x0244('0x5'))['db'];var utils=require(_0x0244('0x6'));var logger=require(_0x0244('0x7'))(_0x0244('0x8'));var config=require(_0x0244('0x9'));var jayson=require(_0x0244('0xa'));var client=jayson[_0x0244('0xb')][_0x0244('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1cd64c,_0x11800f,_0x18f534){return new BPromise(function(_0x5ab35a,_0x474c2e){return client[_0x0244('0xd')](_0x1cd64c,_0x18f534)[_0x0244('0xe')](function(_0x10797b){logger[_0x0244('0xf')](_0x0244('0x10'),_0x11800f,_0x0244('0x11'));logger[_0x0244('0x12')](_0x0244('0x13'),_0x11800f,_0x0244('0x11'),JSON['stringify'](_0x10797b));if(_0x10797b[_0x0244('0x14')]){if(_0x10797b[_0x0244('0x14')][_0x0244('0x15')]===0x1f4){logger['error'](_0x0244('0x10'),_0x11800f,_0x10797b[_0x0244('0x14')][_0x0244('0x16')]);return _0x474c2e(_0x10797b[_0x0244('0x14')]['message']);}logger[_0x0244('0x14')](_0x0244('0x10'),_0x11800f,_0x10797b[_0x0244('0x14')][_0x0244('0x16')]);return _0x5ab35a(_0x10797b[_0x0244('0x14')][_0x0244('0x16')]);}else{logger[_0x0244('0xf')](_0x0244('0x10'),_0x11800f,_0x0244('0x11'));_0x5ab35a(_0x10797b[_0x0244('0x17')]['message']);}})[_0x0244('0x18')](function(_0x42ba2a){logger[_0x0244('0x14')](_0x0244('0x10'),_0x11800f,_0x42ba2a);_0x474c2e(_0x42ba2a);});});}exports[_0x0244('0x19')]=function(_0x51edce){var _0xb9cb6d=this;return new Promise(function(_0x42abe1,_0x5aacdb){return db[_0x0244('0x1a')][_0x0244('0x1b')]({'raw':_0x51edce['options']?_0x51edce['options']['raw']===undefined?!![]:![]:!![],'where':_0x51edce[_0x0244('0x1c')]?_0x51edce['options'][_0x0244('0x1d')]||null:null,'attributes':_0x51edce[_0x0244('0x1c')]?_0x51edce[_0x0244('0x1c')][_0x0244('0x1e')]||null:null,'limit':_0x51edce[_0x0244('0x1c')]?_0x51edce[_0x0244('0x1c')][_0x0244('0x1f')]||null:null,'include':_0x51edce[_0x0244('0x1c')]?_0x51edce[_0x0244('0x1c')]['include']?_['map'](_0x51edce[_0x0244('0x1c')][_0x0244('0x20')],function(_0x19d119){return{'model':db[_0x19d119[_0x0244('0x21')]],'as':_0x19d119['as'],'attributes':_0x19d119[_0x0244('0x1e')],'include':_0x19d119[_0x0244('0x20')]?_[_0x0244('0x22')](_0x19d119[_0x0244('0x20')],function(_0x53cba4){return{'model':db[_0x53cba4[_0x0244('0x21')]],'as':_0x53cba4['as'],'attributes':_0x53cba4[_0x0244('0x1e')],'include':_0x53cba4[_0x0244('0x20')]?_[_0x0244('0x22')](_0x53cba4[_0x0244('0x20')],function(_0x5627e3){return{'model':db[_0x5627e3['model']],'as':_0x5627e3['as'],'attributes':_0x5627e3[_0x0244('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x0244('0xe')](function(_0x43c744){logger[_0x0244('0xf')]('GetDeskAccount',_0x51edce);logger[_0x0244('0x12')]('GetDeskAccount',_0x51edce,JSON['stringify'](_0x43c744));_0x42abe1(_0x43c744);})[_0x0244('0x18')](function(_0x162a6c){logger[_0x0244('0x14')](_0x0244('0x19'),_0x162a6c['message'],_0x51edce);_0x5aacdb(_0xb9cb6d['error'](0x1f4,_0x162a6c[_0x0244('0x16')]));});});};exports[_0x0244('0x23')]=function(_0x38a70d){var _0x4a42af=this;return new Promise(function(_0x6ba9f7,_0x71c2bf){return db[_0x0244('0x1a')]['find']({'raw':_0x38a70d['options']?_0x38a70d[_0x0244('0x1c')][_0x0244('0x24')]===undefined?!![]:![]:!![],'where':_0x38a70d['options']?_0x38a70d[_0x0244('0x1c')][_0x0244('0x1d')]||null:null,'attributes':_0x38a70d['options']?_0x38a70d[_0x0244('0x1c')][_0x0244('0x1e')]||null:null,'include':_0x38a70d[_0x0244('0x1c')]?_0x38a70d[_0x0244('0x1c')]['include']?_[_0x0244('0x22')](_0x38a70d[_0x0244('0x1c')][_0x0244('0x20')],function(_0x2c3758){return{'model':db[_0x2c3758[_0x0244('0x21')]],'as':_0x2c3758['as'],'attributes':_0x2c3758[_0x0244('0x1e')],'include':_0x2c3758[_0x0244('0x20')]?_[_0x0244('0x22')](_0x2c3758[_0x0244('0x20')],function(_0x5285e8){return{'model':db[_0x5285e8[_0x0244('0x21')]],'as':_0x5285e8['as'],'attributes':_0x5285e8['attributes'],'include':_0x5285e8[_0x0244('0x20')]?_['map'](_0x5285e8[_0x0244('0x20')],function(_0x2ff37d){return{'model':db[_0x2ff37d[_0x0244('0x21')]],'as':_0x2ff37d['as'],'attributes':_0x2ff37d[_0x0244('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x0244('0xe')](function(_0x39ab20){logger['info'](_0x0244('0x23'),_0x38a70d);logger['debug'](_0x0244('0x23'),_0x38a70d,JSON[_0x0244('0x25')](_0x39ab20));_0x6ba9f7(_0x39ab20);})[_0x0244('0x18')](function(_0x32220d){logger[_0x0244('0x14')](_0x0244('0x23'),_0x32220d[_0x0244('0x16')],_0x38a70d);_0x71c2bf(_0x4a42af[_0x0244('0x14')](0x1f4,_0x32220d[_0x0244('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index bc9c289..46ac79f 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 _0x9957=['/:id/subjects','getSubjects','getDescriptions','/:id/tags','getTags','post','create','setTags','put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields'];(function(_0x4030c2,_0x175e5a){var _0xf2df4e=function(_0x33fcea){while(--_0x33fcea){_0x4030c2['push'](_0x4030c2['shift']());}};_0xf2df4e(++_0x175e5a);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'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/fields',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/descriptions',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x14')]('/:id/tags',auth['isAuthenticated'](),controller[_0x7995('0x16')]);router[_0x7995('0x17')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller['destroy']);module[_0x7995('0x1a')]=router; \ No newline at end of file +var _0x9c44=['destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intDeskConfiguration.controller','isAuthenticated','index','get','/:id','/:id/fields','getFields','getSubjects','/:id/descriptions','/:id/tags','post','setTags','put','update'];(function(_0x1a8efd,_0x4bce4a){var _0x5e181b=function(_0x5d8fe2){while(--_0x5d8fe2){_0x1a8efd['push'](_0x1a8efd['shift']());}};_0x5e181b(++_0x4bce4a);}(_0x9c44,0x178));var _0x49c4=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0x9c44[_0x5608a3];return _0x1ed50a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x49c4('0x6'));router['get']('/',auth[_0x49c4('0x7')](),controller[_0x49c4('0x8')]);router[_0x49c4('0x9')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller['show']);router[_0x49c4('0x9')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0xc')]);router['get']('/:id/subjects',auth[_0x49c4('0x7')](),controller[_0x49c4('0xd')]);router['get'](_0x49c4('0xe'),auth[_0x49c4('0x7')](),controller['getDescriptions']);router['get'](_0x49c4('0xf'),auth[_0x49c4('0x7')](),controller['getTags']);router[_0x49c4('0x10')]('/',auth[_0x49c4('0x7')](),controller['create']);router[_0x49c4('0x10')](_0x49c4('0xf'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x11')]);router[_0x49c4('0x12')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x13')]);router['delete'](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x14')]);module[_0x49c4('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 7b85703..93c08b7 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 _0x6275=['sequelize','exports','STRING'];(function(_0x1fbd5d,_0x364faa){var _0x47c980=function(_0x2ce85d){while(--_0x2ce85d){_0x1fbd5d['push'](_0x1fbd5d['shift']());}};_0x47c980(++_0x364faa);}(_0x6275,0xd5));var _0x5627=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0x6275[_0x1d24eb];return _0x1dc576;};'use strict';var Sequelize=require(_0x5627('0x0'));module[_0x5627('0x1')]={'name':{'type':Sequelize[_0x5627('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9447=['sequelize','STRING'];(function(_0xe64d33,_0x10d5b0){var _0x9df101=function(_0x5b3582){while(--_0x5b3582){_0xe64d33['push'](_0xe64d33['shift']());}};_0x9df101(++_0x10d5b0);}(_0x9447,0x72));var _0x7944=function(_0x4182e1,_0x3e2840){_0x4182e1=_0x4182e1-0x0;var _0x1a3388=_0x9447[_0x4182e1];return _0x1a3388;};'use strict';var Sequelize=require(_0x7944('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x7944('0x1')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index aa80c66..1145ebf 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 _0x8f59=['length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','rawAttributes','options','find','create','body','params','getFields','findOne','DeskField','getSubjects','getDescriptions','Tag','getTags','setTags','ids','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','fs-extra','squel','to-csv','querystring','../../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','apply','save','update','then','destroy','error','stack','name','index','map','DeskConfiguration','fieldName','key','model','query','keys','filters','intersection','fields','attributes'];(function(_0x10bd30,_0x4abdce){var _0x542659=function(_0xca5b6a){while(--_0xca5b6a){_0x10bd30['push'](_0x10bd30['shift']());}};_0x542659(++_0x4abdce);}(_0x8f59,0x1b5));var _0x98f5=function(_0x13659a,_0x41453c){_0x13659a=_0x13659a-0x0;var _0x4b1c49=_0x8f59[_0x13659a];return _0x4b1c49;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x98f5('0x0'));var zipdir=require(_0x98f5('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x98f5('0x2'));var moment=require(_0x98f5('0x3'));var BPromise=require(_0x98f5('0x4'));var Mustache=require('mustache');var util=require(_0x98f5('0x5'));var path=require(_0x98f5('0x6'));var sox=require(_0x98f5('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x98f5('0x8'));var _=require('lodash');var squel=require(_0x98f5('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x98f5('0xa'));var querystring=require(_0x98f5('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x98f5('0xc'));var qs=require(_0x98f5('0xd'));var as=require(_0x98f5('0xe'));var hardwareService=require(_0x98f5('0xf'));var logger=require(_0x98f5('0x10'))(_0x98f5('0x11'));var utils=require(_0x98f5('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x98f5('0x13'));var db=require(_0x98f5('0x14'))['db'];function respondWithStatusCode(_0x49b4c1,_0x2c8667){_0x2c8667=_0x2c8667||0xcc;return function(_0x3ee47f){if(_0x3ee47f){return _0x49b4c1[_0x98f5('0x15')](_0x2c8667);}return _0x49b4c1[_0x98f5('0x16')](_0x2c8667)[_0x98f5('0x17')]();};}function respondWithResult(_0xbf5b97,_0x368de8){_0x368de8=_0x368de8||0xc8;return function(_0x25e70a){if(_0x25e70a){return _0xbf5b97[_0x98f5('0x16')](_0x368de8)[_0x98f5('0x18')](_0x25e70a);}};}function respondWithFilteredResult(_0x14f7e4,_0x3ef6f4){return function(_0x8ad6be){if(_0x8ad6be){var _0x5bdb19=typeof _0x3ef6f4['offset']===_0x98f5('0x19')&&typeof _0x3ef6f4[_0x98f5('0x1a')]===_0x98f5('0x19');var _0x54ffb1=_0x8ad6be[_0x98f5('0x1b')];var _0x196bd6=_0x5bdb19?0x0:_0x3ef6f4[_0x98f5('0x1c')];var _0x2498f7=_0x5bdb19?_0x8ad6be[_0x98f5('0x1b')]:_0x3ef6f4[_0x98f5('0x1c')]+_0x3ef6f4[_0x98f5('0x1a')];var _0x49349c;if(_0x2498f7>=_0x54ffb1){_0x2498f7=_0x54ffb1;_0x49349c=0xc8;}else{_0x49349c=0xce;}_0x14f7e4[_0x98f5('0x16')](_0x49349c);return _0x14f7e4['set']('Content-Range',_0x196bd6+'-'+_0x2498f7+'/'+_0x54ffb1)['json'](_0x8ad6be);}return null;};}function patchUpdates(_0x3f9eb3){return function(_0x541ec1){try{jsonpatch[_0x98f5('0x1d')](_0x541ec1,_0x3f9eb3,!![]);}catch(_0x55e8d2){return BPromise['reject'](_0x55e8d2);}return _0x541ec1[_0x98f5('0x1e')]();};}function saveUpdates(_0x17c098,_0x4aaba7){return function(_0x5e0e22){if(_0x5e0e22){return _0x5e0e22[_0x98f5('0x1f')](_0x17c098)[_0x98f5('0x20')](function(_0x53cd6d){return _0x53cd6d;});}return null;};}function removeEntity(_0xa93dcc,_0x1fa9e1){return function(_0x41b19a){if(_0x41b19a){return _0x41b19a[_0x98f5('0x21')]()[_0x98f5('0x20')](function(){_0xa93dcc['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b0d34,_0x15f701){return function(_0x4f00d5){if(!_0x4f00d5){_0x4b0d34[_0x98f5('0x15')](0x194);}return _0x4f00d5;};}function handleError(_0x260379,_0x334865){_0x334865=_0x334865||0x1f4;return function(_0x5c91ab){logger[_0x98f5('0x22')](_0x5c91ab[_0x98f5('0x23')]);if(_0x5c91ab['name']){delete _0x5c91ab[_0x98f5('0x24')];}_0x260379[_0x98f5('0x16')](_0x334865)['send'](_0x5c91ab);};}exports[_0x98f5('0x25')]=function(_0x4ba218,_0x158914){var _0x565582={},_0x134fda={},_0x5effe1={'count':0x0,'rows':[]};var _0x6095a9=_[_0x98f5('0x26')](db[_0x98f5('0x27')]['rawAttributes'],function(_0x2d9e37){return{'name':_0x2d9e37[_0x98f5('0x28')],'type':_0x2d9e37['type'][_0x98f5('0x29')]};});_0x134fda[_0x98f5('0x2a')]=_[_0x98f5('0x26')](_0x6095a9,_0x98f5('0x24'));_0x134fda[_0x98f5('0x2b')]=_[_0x98f5('0x2c')](_0x4ba218[_0x98f5('0x2b')]);_0x134fda[_0x98f5('0x2d')]=_[_0x98f5('0x2e')](_0x134fda[_0x98f5('0x2a')],_0x134fda[_0x98f5('0x2b')]);_0x565582['attributes']=_[_0x98f5('0x2e')](_0x134fda[_0x98f5('0x2a')],qs['fields'](_0x4ba218[_0x98f5('0x2b')][_0x98f5('0x2f')]));_0x565582[_0x98f5('0x30')]=_0x565582[_0x98f5('0x30')][_0x98f5('0x31')]?_0x565582[_0x98f5('0x30')]:_0x134fda[_0x98f5('0x2a')];if(!_0x4ba218[_0x98f5('0x2b')][_0x98f5('0x32')](_0x98f5('0x33'))){_0x565582[_0x98f5('0x1a')]=qs[_0x98f5('0x1a')](_0x4ba218[_0x98f5('0x2b')][_0x98f5('0x1a')]);_0x565582[_0x98f5('0x1c')]=qs[_0x98f5('0x1c')](_0x4ba218[_0x98f5('0x2b')][_0x98f5('0x1c')]);}_0x565582[_0x98f5('0x34')]=qs['sort'](_0x4ba218['query'][_0x98f5('0x35')]);_0x565582[_0x98f5('0x36')]=qs[_0x98f5('0x2d')](_[_0x98f5('0x37')](_0x4ba218[_0x98f5('0x2b')],_0x134fda['filters']),_0x6095a9);if(_0x4ba218[_0x98f5('0x2b')][_0x98f5('0x38')]){_0x565582[_0x98f5('0x36')]=_[_0x98f5('0x39')](_0x565582[_0x98f5('0x36')],{'$or':_['map'](_0x6095a9,function(_0x54a861){if(_0x54a861[_0x98f5('0x3a')]!==_0x98f5('0x3b')){var _0x5b7435={};_0x5b7435[_0x54a861[_0x98f5('0x24')]]={'$like':'%'+_0x4ba218['query'][_0x98f5('0x38')]+'%'};return _0x5b7435;}})});}_0x565582=_[_0x98f5('0x39')]({},_0x565582,_0x4ba218['options']);var _0xb87d4b={'where':_0x565582[_0x98f5('0x36')]};return db[_0x98f5('0x27')][_0x98f5('0x1b')](_0xb87d4b)[_0x98f5('0x20')](function(_0x2ac78d){_0x5effe1[_0x98f5('0x1b')]=_0x2ac78d;if(_0x4ba218[_0x98f5('0x2b')][_0x98f5('0x3c')]){_0x565582[_0x98f5('0x3d')]=[{'all':!![]}];}return db['DeskConfiguration'][_0x98f5('0x3e')](_0x565582);})['then'](function(_0x56ac38){_0x5effe1[_0x98f5('0x3f')]=_0x56ac38;return _0x5effe1;})['then'](respondWithFilteredResult(_0x158914,_0x565582))[_0x98f5('0x40')](handleError(_0x158914,null));};exports[_0x98f5('0x41')]=function(_0x41dbe0,_0xb00b77){var _0x53c1d6={'raw':![],'where':{'id':_0x41dbe0['params']['id']}},_0x463b6f={};_0x463b6f[_0x98f5('0x2a')]=_[_0x98f5('0x2c')](db['DeskConfiguration'][_0x98f5('0x42')]);_0x463b6f[_0x98f5('0x2b')]=_[_0x98f5('0x2c')](_0x41dbe0[_0x98f5('0x2b')]);_0x463b6f[_0x98f5('0x2d')]=_[_0x98f5('0x2e')](_0x463b6f[_0x98f5('0x2a')],_0x463b6f['query']);_0x53c1d6['attributes']=_[_0x98f5('0x2e')](_0x463b6f[_0x98f5('0x2a')],qs[_0x98f5('0x2f')](_0x41dbe0[_0x98f5('0x2b')][_0x98f5('0x2f')]));_0x53c1d6['attributes']=_0x53c1d6[_0x98f5('0x30')]['length']?_0x53c1d6[_0x98f5('0x30')]:_0x463b6f['model'];if(_0x41dbe0[_0x98f5('0x2b')]['includeAll']){_0x53c1d6['include']=[{'all':!![]}];}_0x53c1d6=_[_0x98f5('0x39')]({},_0x53c1d6,_0x41dbe0[_0x98f5('0x43')]);return db[_0x98f5('0x27')][_0x98f5('0x44')](_0x53c1d6)['then'](handleEntityNotFound(_0xb00b77,null))[_0x98f5('0x20')](respondWithResult(_0xb00b77,null))[_0x98f5('0x40')](handleError(_0xb00b77,null));};exports['create']=function(_0x510bc5,_0x3b59f4){return db['DeskConfiguration'][_0x98f5('0x45')](_0x510bc5[_0x98f5('0x46')],{})[_0x98f5('0x20')](respondWithResult(_0x3b59f4,0xc9))[_0x98f5('0x40')](handleError(_0x3b59f4,null));};exports[_0x98f5('0x1f')]=function(_0x506ee4,_0x54b6c3){if(_0x506ee4[_0x98f5('0x46')]['id']){delete _0x506ee4[_0x98f5('0x46')]['id'];}return db[_0x98f5('0x27')][_0x98f5('0x44')]({'where':{'id':_0x506ee4[_0x98f5('0x47')]['id']}})[_0x98f5('0x20')](handleEntityNotFound(_0x54b6c3,null))['then'](saveUpdates(_0x506ee4[_0x98f5('0x46')],null))[_0x98f5('0x20')](respondWithResult(_0x54b6c3,null))[_0x98f5('0x40')](handleError(_0x54b6c3,null));};exports[_0x98f5('0x21')]=function(_0x571caf,_0x3249ff){return db[_0x98f5('0x27')]['find']({'where':{'id':_0x571caf[_0x98f5('0x47')]['id']}})[_0x98f5('0x20')](handleEntityNotFound(_0x3249ff,null))['then'](removeEntity(_0x3249ff,null))[_0x98f5('0x40')](handleError(_0x3249ff,null));};exports[_0x98f5('0x48')]=function(_0x21b1ac,_0x1c69b2,_0x4746a2){var _0x4e9231={};var _0x51fc3e={};var _0x297a72;var _0x29b48d;return db[_0x98f5('0x27')][_0x98f5('0x49')]({'where':{'id':_0x21b1ac[_0x98f5('0x47')]['id']}})[_0x98f5('0x20')](handleEntityNotFound(_0x1c69b2,null))[_0x98f5('0x20')](function(_0x234918){if(_0x234918){_0x297a72=_0x234918;_0x51fc3e['model']=_[_0x98f5('0x2c')](db[_0x98f5('0x4a')]['rawAttributes']);_0x51fc3e[_0x98f5('0x2b')]=_[_0x98f5('0x2c')](_0x21b1ac[_0x98f5('0x2b')]);_0x51fc3e[_0x98f5('0x2d')]=_['intersection'](_0x51fc3e[_0x98f5('0x2a')],_0x51fc3e['query']);_0x4e9231['attributes']=_[_0x98f5('0x2e')](_0x51fc3e['model'],qs[_0x98f5('0x2f')](_0x21b1ac[_0x98f5('0x2b')][_0x98f5('0x2f')]));_0x4e9231[_0x98f5('0x30')]=_0x4e9231['attributes']['length']?_0x4e9231[_0x98f5('0x30')]:_0x51fc3e[_0x98f5('0x2a')];_0x4e9231[_0x98f5('0x34')]=qs[_0x98f5('0x35')](_0x21b1ac[_0x98f5('0x2b')]['sort']);_0x4e9231[_0x98f5('0x36')]=qs['filters'](_[_0x98f5('0x37')](_0x21b1ac['query'],_0x51fc3e[_0x98f5('0x2d')]));if(_0x21b1ac[_0x98f5('0x2b')]['filter']){_0x4e9231[_0x98f5('0x36')]=_[_0x98f5('0x39')](_0x4e9231[_0x98f5('0x36')],{'$or':_[_0x98f5('0x26')](_0x4e9231[_0x98f5('0x30')],function(_0x1c4738){var _0x25e7d7={};_0x25e7d7[_0x1c4738]={'$like':'%'+_0x21b1ac['query'][_0x98f5('0x38')]+'%'};return _0x25e7d7;})});}_0x4e9231=_[_0x98f5('0x39')]({},_0x4e9231,_0x21b1ac['options']);return _0x297a72[_0x98f5('0x48')](_0x4e9231);}})['then'](function(_0x1db441){if(_0x1db441){_0x29b48d=_0x1db441[_0x98f5('0x31')];if(!_0x21b1ac[_0x98f5('0x2b')][_0x98f5('0x32')](_0x98f5('0x33'))){_0x4e9231[_0x98f5('0x1a')]=qs['limit'](_0x21b1ac[_0x98f5('0x2b')][_0x98f5('0x1a')]);_0x4e9231[_0x98f5('0x1c')]=qs['offset'](_0x21b1ac[_0x98f5('0x2b')][_0x98f5('0x1c')]);}return _0x297a72[_0x98f5('0x48')](_0x4e9231);}})[_0x98f5('0x20')](function(_0x41ba3e){if(_0x41ba3e){return _0x41ba3e?{'count':_0x29b48d,'rows':_0x41ba3e}:null;}})[_0x98f5('0x20')](respondWithResult(_0x1c69b2,null))['catch'](handleError(_0x1c69b2,null));};exports[_0x98f5('0x4b')]=function(_0x299115,_0xb2ea99,_0x384598){var _0x42237d={};var _0x45ae9c={};var _0x5dfc3e;var _0x5b2885;return db[_0x98f5('0x27')][_0x98f5('0x49')]({'where':{'id':_0x299115[_0x98f5('0x47')]['id']}})[_0x98f5('0x20')](handleEntityNotFound(_0xb2ea99,null))[_0x98f5('0x20')](function(_0x4fa43d){if(_0x4fa43d){_0x5dfc3e=_0x4fa43d;_0x45ae9c[_0x98f5('0x2a')]=_['keys'](db['DeskField'][_0x98f5('0x42')]);_0x45ae9c[_0x98f5('0x2b')]=_[_0x98f5('0x2c')](_0x299115[_0x98f5('0x2b')]);_0x45ae9c[_0x98f5('0x2d')]=_[_0x98f5('0x2e')](_0x45ae9c[_0x98f5('0x2a')],_0x45ae9c[_0x98f5('0x2b')]);_0x42237d[_0x98f5('0x30')]=_[_0x98f5('0x2e')](_0x45ae9c[_0x98f5('0x2a')],qs[_0x98f5('0x2f')](_0x299115[_0x98f5('0x2b')][_0x98f5('0x2f')]));_0x42237d[_0x98f5('0x30')]=_0x42237d[_0x98f5('0x30')][_0x98f5('0x31')]?_0x42237d['attributes']:_0x45ae9c[_0x98f5('0x2a')];_0x42237d[_0x98f5('0x34')]=qs[_0x98f5('0x35')](_0x299115[_0x98f5('0x2b')][_0x98f5('0x35')]);_0x42237d[_0x98f5('0x36')]=qs[_0x98f5('0x2d')](_['pick'](_0x299115['query'],_0x45ae9c[_0x98f5('0x2d')]));if(_0x299115['query'][_0x98f5('0x38')]){_0x42237d[_0x98f5('0x36')]=_[_0x98f5('0x39')](_0x42237d[_0x98f5('0x36')],{'$or':_['map'](_0x42237d[_0x98f5('0x30')],function(_0x4e8a79){var _0x1f29af={};_0x1f29af[_0x4e8a79]={'$like':'%'+_0x299115['query'][_0x98f5('0x38')]+'%'};return _0x1f29af;})});}_0x42237d=_[_0x98f5('0x39')]({},_0x42237d,_0x299115[_0x98f5('0x43')]);return _0x5dfc3e['getSubjects'](_0x42237d);}})[_0x98f5('0x20')](function(_0x16df8a){if(_0x16df8a){_0x5b2885=_0x16df8a[_0x98f5('0x31')];if(!_0x299115[_0x98f5('0x2b')][_0x98f5('0x32')](_0x98f5('0x33'))){_0x42237d[_0x98f5('0x1a')]=qs['limit'](_0x299115[_0x98f5('0x2b')]['limit']);_0x42237d[_0x98f5('0x1c')]=qs[_0x98f5('0x1c')](_0x299115[_0x98f5('0x2b')][_0x98f5('0x1c')]);}return _0x5dfc3e[_0x98f5('0x4b')](_0x42237d);}})['then'](function(_0x3cfec6){if(_0x3cfec6){return _0x3cfec6?{'count':_0x5b2885,'rows':_0x3cfec6}:null;}})['then'](respondWithResult(_0xb2ea99,null))[_0x98f5('0x40')](handleError(_0xb2ea99,null));};exports[_0x98f5('0x4c')]=function(_0x362d14,_0x5d1fcd,_0x20760f){var _0xd873e={};var _0x55768c={};var _0x588ea3;var _0x13d2e8;return db[_0x98f5('0x27')][_0x98f5('0x49')]({'where':{'id':_0x362d14['params']['id']}})['then'](handleEntityNotFound(_0x5d1fcd,null))['then'](function(_0xd48e0e){if(_0xd48e0e){_0x588ea3=_0xd48e0e;_0x55768c[_0x98f5('0x2a')]=_['keys'](db[_0x98f5('0x4a')][_0x98f5('0x42')]);_0x55768c[_0x98f5('0x2b')]=_[_0x98f5('0x2c')](_0x362d14['query']);_0x55768c[_0x98f5('0x2d')]=_[_0x98f5('0x2e')](_0x55768c[_0x98f5('0x2a')],_0x55768c[_0x98f5('0x2b')]);_0xd873e[_0x98f5('0x30')]=_[_0x98f5('0x2e')](_0x55768c[_0x98f5('0x2a')],qs[_0x98f5('0x2f')](_0x362d14[_0x98f5('0x2b')][_0x98f5('0x2f')]));_0xd873e['attributes']=_0xd873e[_0x98f5('0x30')][_0x98f5('0x31')]?_0xd873e[_0x98f5('0x30')]:_0x55768c[_0x98f5('0x2a')];_0xd873e[_0x98f5('0x34')]=qs['sort'](_0x362d14[_0x98f5('0x2b')][_0x98f5('0x35')]);_0xd873e[_0x98f5('0x36')]=qs['filters'](_[_0x98f5('0x37')](_0x362d14[_0x98f5('0x2b')],_0x55768c[_0x98f5('0x2d')]));if(_0x362d14['query'][_0x98f5('0x38')]){_0xd873e[_0x98f5('0x36')]=_[_0x98f5('0x39')](_0xd873e[_0x98f5('0x36')],{'$or':_[_0x98f5('0x26')](_0xd873e[_0x98f5('0x30')],function(_0x2cfade){var _0x14ffa6={};_0x14ffa6[_0x2cfade]={'$like':'%'+_0x362d14[_0x98f5('0x2b')][_0x98f5('0x38')]+'%'};return _0x14ffa6;})});}_0xd873e=_[_0x98f5('0x39')]({},_0xd873e,_0x362d14[_0x98f5('0x43')]);return _0x588ea3[_0x98f5('0x4c')](_0xd873e);}})[_0x98f5('0x20')](function(_0xdc1aad){if(_0xdc1aad){_0x13d2e8=_0xdc1aad[_0x98f5('0x31')];if(!_0x362d14[_0x98f5('0x2b')][_0x98f5('0x32')](_0x98f5('0x33'))){_0xd873e[_0x98f5('0x1a')]=qs[_0x98f5('0x1a')](_0x362d14[_0x98f5('0x2b')][_0x98f5('0x1a')]);_0xd873e[_0x98f5('0x1c')]=qs[_0x98f5('0x1c')](_0x362d14[_0x98f5('0x2b')][_0x98f5('0x1c')]);}return _0x588ea3[_0x98f5('0x4c')](_0xd873e);}})[_0x98f5('0x20')](function(_0x775476){if(_0x775476){return _0x775476?{'count':_0x13d2e8,'rows':_0x775476}:null;}})[_0x98f5('0x20')](respondWithResult(_0x5d1fcd,null))[_0x98f5('0x40')](handleError(_0x5d1fcd,null));};exports['getTags']=function(_0x54b24c,_0x2842cb,_0x114d91){var _0x5d2c69={};var _0x7bb931={};var _0x122719;var _0x3dab25;return db['DeskConfiguration']['findOne']({'where':{'id':_0x54b24c[_0x98f5('0x47')]['id']}})[_0x98f5('0x20')](handleEntityNotFound(_0x2842cb,null))[_0x98f5('0x20')](function(_0x5a8a92){if(_0x5a8a92){_0x122719=_0x5a8a92;_0x7bb931['model']=_[_0x98f5('0x2c')](db[_0x98f5('0x4d')]['rawAttributes']);_0x7bb931[_0x98f5('0x2b')]=_['keys'](_0x54b24c[_0x98f5('0x2b')]);_0x7bb931[_0x98f5('0x2d')]=_[_0x98f5('0x2e')](_0x7bb931[_0x98f5('0x2a')],_0x7bb931['query']);_0x5d2c69['attributes']=_['intersection'](_0x7bb931[_0x98f5('0x2a')],qs[_0x98f5('0x2f')](_0x54b24c[_0x98f5('0x2b')]['fields']));_0x5d2c69[_0x98f5('0x30')]=_0x5d2c69[_0x98f5('0x30')][_0x98f5('0x31')]?_0x5d2c69[_0x98f5('0x30')]:_0x7bb931[_0x98f5('0x2a')];_0x5d2c69[_0x98f5('0x34')]=qs['sort'](_0x54b24c[_0x98f5('0x2b')][_0x98f5('0x35')]);_0x5d2c69[_0x98f5('0x36')]=qs['filters'](_[_0x98f5('0x37')](_0x54b24c['query'],_0x7bb931['filters']));if(_0x54b24c['query'][_0x98f5('0x38')]){_0x5d2c69[_0x98f5('0x36')]=_[_0x98f5('0x39')](_0x5d2c69[_0x98f5('0x36')],{'$or':_[_0x98f5('0x26')](_0x5d2c69['attributes'],function(_0x182d8b){var _0x31623f={};_0x31623f[_0x182d8b]={'$like':'%'+_0x54b24c[_0x98f5('0x2b')][_0x98f5('0x38')]+'%'};return _0x31623f;})});}_0x5d2c69=_[_0x98f5('0x39')]({},_0x5d2c69,_0x54b24c[_0x98f5('0x43')]);return _0x122719[_0x98f5('0x4e')](_0x5d2c69);}})[_0x98f5('0x20')](function(_0x43b67f){if(_0x43b67f){_0x3dab25=_0x43b67f[_0x98f5('0x31')];if(!_0x54b24c['query'][_0x98f5('0x32')](_0x98f5('0x33'))){_0x5d2c69['limit']=qs[_0x98f5('0x1a')](_0x54b24c['query'][_0x98f5('0x1a')]);_0x5d2c69[_0x98f5('0x1c')]=qs[_0x98f5('0x1c')](_0x54b24c[_0x98f5('0x2b')]['offset']);}return _0x122719[_0x98f5('0x4e')](_0x5d2c69);}})['then'](function(_0x158557){if(_0x158557){return _0x158557?{'count':_0x3dab25,'rows':_0x158557}:null;}})[_0x98f5('0x20')](respondWithResult(_0x2842cb,null))[_0x98f5('0x40')](handleError(_0x2842cb,null));};exports['setTags']=function(_0x11e542,_0x55f07c,_0x1b410e){if(_0x11e542[_0x98f5('0x46')]['id']){delete _0x11e542[_0x98f5('0x46')]['id'];}return db[_0x98f5('0x27')][_0x98f5('0x49')]({'where':{'id':_0x11e542['params']['id']}})[_0x98f5('0x20')](handleEntityNotFound(_0x55f07c,null))[_0x98f5('0x20')](function(_0x281d95){if(_0x281d95){return _0x281d95[_0x98f5('0x4f')](_0x11e542[_0x98f5('0x46')][_0x98f5('0x50')]||[]);}return null;})[_0x98f5('0x20')](respondWithResult(_0x55f07c,null))[_0x98f5('0x40')](handleError(_0x55f07c,null));}; \ No newline at end of file +var _0x08a9=['findAll','rows','catch','rawAttributes','find','create','body','getFields','findOne','params','DeskField','getSubjects','getDescriptions','Tag','setTags','ids','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','DeskConfiguration','fieldName','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filters','filter','where','merge','type','VIRTUAL','options','includeAll','include'];(function(_0x4a9ac9,_0x360fa5){var _0x187b69=function(_0x28f683){while(--_0x28f683){_0x4a9ac9['push'](_0x4a9ac9['shift']());}};_0x187b69(++_0x360fa5);}(_0x08a9,0xba));var _0x908a=function(_0x2c077b,_0x171aff){_0x2c077b=_0x2c077b-0x0;var _0x23105e=_0x08a9[_0x2c077b];return _0x23105e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x908a('0x0'));var zipdir=require(_0x908a('0x1'));var jsonpatch=require(_0x908a('0x2'));var rp=require(_0x908a('0x3'));var moment=require(_0x908a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x908a('0x5'));var util=require('util');var path=require(_0x908a('0x6'));var sox=require(_0x908a('0x7'));var csv=require(_0x908a('0x8'));var ejs=require(_0x908a('0x9'));var fs=require('fs');var fs_extra=require(_0x908a('0xa'));var _=require('lodash');var squel=require(_0x908a('0xb'));var crypto=require(_0x908a('0xc'));var jsforce=require(_0x908a('0xd'));var deskjs=require(_0x908a('0xe'));var toCsv=require(_0x908a('0x8'));var querystring=require('querystring');var Papa=require(_0x908a('0xf'));var Redis=require(_0x908a('0x10'));var authService=require(_0x908a('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x908a('0x12'));var logger=require(_0x908a('0x13'))(_0x908a('0x14'));var utils=require(_0x908a('0x15'));var config=require(_0x908a('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x908a('0x17'))['db'];function respondWithStatusCode(_0x296bad,_0x1d5566){_0x1d5566=_0x1d5566||0xcc;return function(_0x28c33c){if(_0x28c33c){return _0x296bad[_0x908a('0x18')](_0x1d5566);}return _0x296bad[_0x908a('0x19')](_0x1d5566)[_0x908a('0x1a')]();};}function respondWithResult(_0x26381c,_0x1bd8ca){_0x1bd8ca=_0x1bd8ca||0xc8;return function(_0x1ddddf){if(_0x1ddddf){return _0x26381c[_0x908a('0x19')](_0x1bd8ca)[_0x908a('0x1b')](_0x1ddddf);}};}function respondWithFilteredResult(_0x2c5867,_0x37a727){return function(_0x41f843){if(_0x41f843){var _0x1c56e7=typeof _0x37a727[_0x908a('0x1c')]==='undefined'&&typeof _0x37a727[_0x908a('0x1d')]===_0x908a('0x1e');var _0x321c4d=_0x41f843['count'];var _0xc8c4ef=_0x1c56e7?0x0:_0x37a727[_0x908a('0x1c')];var _0x2502c1=_0x1c56e7?_0x41f843[_0x908a('0x1f')]:_0x37a727[_0x908a('0x1c')]+_0x37a727[_0x908a('0x1d')];var _0x33dd1d;if(_0x2502c1>=_0x321c4d){_0x2502c1=_0x321c4d;_0x33dd1d=0xc8;}else{_0x33dd1d=0xce;}_0x2c5867[_0x908a('0x19')](_0x33dd1d);return _0x2c5867[_0x908a('0x20')](_0x908a('0x21'),_0xc8c4ef+'-'+_0x2502c1+'/'+_0x321c4d)[_0x908a('0x1b')](_0x41f843);}return null;};}function patchUpdates(_0x8454e5){return function(_0x58567c){try{jsonpatch[_0x908a('0x22')](_0x58567c,_0x8454e5,!![]);}catch(_0x3d1584){return BPromise[_0x908a('0x23')](_0x3d1584);}return _0x58567c[_0x908a('0x24')]();};}function saveUpdates(_0x4c8737,_0x296046){return function(_0x480ae7){if(_0x480ae7){return _0x480ae7[_0x908a('0x25')](_0x4c8737)[_0x908a('0x26')](function(_0x196a9b){return _0x196a9b;});}return null;};}function removeEntity(_0x11ca36,_0x712b5f){return function(_0x182f0f){if(_0x182f0f){return _0x182f0f[_0x908a('0x27')]()['then'](function(){_0x11ca36[_0x908a('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x33266c,_0x5543a5){return function(_0x2224c6){if(!_0x2224c6){_0x33266c[_0x908a('0x18')](0x194);}return _0x2224c6;};}function handleError(_0x1bcad6,_0x23e421){_0x23e421=_0x23e421||0x1f4;return function(_0x427b59){logger[_0x908a('0x28')](_0x427b59['stack']);if(_0x427b59[_0x908a('0x29')]){delete _0x427b59[_0x908a('0x29')];}_0x1bcad6[_0x908a('0x19')](_0x23e421)[_0x908a('0x2a')](_0x427b59);};}exports[_0x908a('0x2b')]=function(_0x554a08,_0xb938e3){var _0x3854c0={},_0x3b2820={},_0x329622={'count':0x0,'rows':[]};var _0x3d4e60=_[_0x908a('0x2c')](db[_0x908a('0x2d')]['rawAttributes'],function(_0x31966f){return{'name':_0x31966f[_0x908a('0x2e')],'type':_0x31966f['type'][_0x908a('0x2f')]};});_0x3b2820['model']=_[_0x908a('0x2c')](_0x3d4e60,_0x908a('0x29'));_0x3b2820[_0x908a('0x30')]=_[_0x908a('0x31')](_0x554a08['query']);_0x3b2820['filters']=_[_0x908a('0x32')](_0x3b2820['model'],_0x3b2820[_0x908a('0x30')]);_0x3854c0['attributes']=_['intersection'](_0x3b2820[_0x908a('0x33')],qs[_0x908a('0x34')](_0x554a08[_0x908a('0x30')][_0x908a('0x34')]));_0x3854c0[_0x908a('0x35')]=_0x3854c0[_0x908a('0x35')][_0x908a('0x36')]?_0x3854c0['attributes']:_0x3b2820[_0x908a('0x33')];if(!_0x554a08[_0x908a('0x30')][_0x908a('0x37')](_0x908a('0x38'))){_0x3854c0[_0x908a('0x1d')]=qs[_0x908a('0x1d')](_0x554a08[_0x908a('0x30')][_0x908a('0x1d')]);_0x3854c0[_0x908a('0x1c')]=qs[_0x908a('0x1c')](_0x554a08[_0x908a('0x30')]['offset']);}_0x3854c0[_0x908a('0x39')]=qs[_0x908a('0x3a')](_0x554a08[_0x908a('0x30')]['sort']);_0x3854c0['where']=qs['filters'](_[_0x908a('0x3b')](_0x554a08[_0x908a('0x30')],_0x3b2820[_0x908a('0x3c')]),_0x3d4e60);if(_0x554a08['query'][_0x908a('0x3d')]){_0x3854c0[_0x908a('0x3e')]=_[_0x908a('0x3f')](_0x3854c0[_0x908a('0x3e')],{'$or':_['map'](_0x3d4e60,function(_0x9e6a9a){if(_0x9e6a9a[_0x908a('0x40')]!==_0x908a('0x41')){var _0x32b61={};_0x32b61[_0x9e6a9a[_0x908a('0x29')]]={'$like':'%'+_0x554a08[_0x908a('0x30')]['filter']+'%'};return _0x32b61;}})});}_0x3854c0=_[_0x908a('0x3f')]({},_0x3854c0,_0x554a08[_0x908a('0x42')]);var _0x7443a6={'where':_0x3854c0[_0x908a('0x3e')]};return db['DeskConfiguration']['count'](_0x7443a6)['then'](function(_0x187587){_0x329622[_0x908a('0x1f')]=_0x187587;if(_0x554a08[_0x908a('0x30')][_0x908a('0x43')]){_0x3854c0[_0x908a('0x44')]=[{'all':!![]}];}return db[_0x908a('0x2d')][_0x908a('0x45')](_0x3854c0);})[_0x908a('0x26')](function(_0x106c4c){_0x329622[_0x908a('0x46')]=_0x106c4c;return _0x329622;})[_0x908a('0x26')](respondWithFilteredResult(_0xb938e3,_0x3854c0))[_0x908a('0x47')](handleError(_0xb938e3,null));};exports['show']=function(_0x1bdc7b,_0x2a474a){var _0x4dfd51={'raw':![],'where':{'id':_0x1bdc7b['params']['id']}},_0xadd811={};_0xadd811['model']=_['keys'](db[_0x908a('0x2d')][_0x908a('0x48')]);_0xadd811['query']=_[_0x908a('0x31')](_0x1bdc7b[_0x908a('0x30')]);_0xadd811[_0x908a('0x3c')]=_['intersection'](_0xadd811['model'],_0xadd811[_0x908a('0x30')]);_0x4dfd51[_0x908a('0x35')]=_[_0x908a('0x32')](_0xadd811[_0x908a('0x33')],qs[_0x908a('0x34')](_0x1bdc7b[_0x908a('0x30')][_0x908a('0x34')]));_0x4dfd51[_0x908a('0x35')]=_0x4dfd51['attributes']['length']?_0x4dfd51[_0x908a('0x35')]:_0xadd811[_0x908a('0x33')];if(_0x1bdc7b[_0x908a('0x30')][_0x908a('0x43')]){_0x4dfd51[_0x908a('0x44')]=[{'all':!![]}];}_0x4dfd51=_[_0x908a('0x3f')]({},_0x4dfd51,_0x1bdc7b[_0x908a('0x42')]);return db[_0x908a('0x2d')][_0x908a('0x49')](_0x4dfd51)['then'](handleEntityNotFound(_0x2a474a,null))[_0x908a('0x26')](respondWithResult(_0x2a474a,null))[_0x908a('0x47')](handleError(_0x2a474a,null));};exports[_0x908a('0x4a')]=function(_0x197684,_0x4178a2){return db[_0x908a('0x2d')]['create'](_0x197684[_0x908a('0x4b')],{})[_0x908a('0x26')](respondWithResult(_0x4178a2,0xc9))[_0x908a('0x47')](handleError(_0x4178a2,null));};exports['update']=function(_0x43941a,_0x4ee373){if(_0x43941a[_0x908a('0x4b')]['id']){delete _0x43941a[_0x908a('0x4b')]['id'];}return db[_0x908a('0x2d')][_0x908a('0x49')]({'where':{'id':_0x43941a['params']['id']}})[_0x908a('0x26')](handleEntityNotFound(_0x4ee373,null))[_0x908a('0x26')](saveUpdates(_0x43941a['body'],null))['then'](respondWithResult(_0x4ee373,null))[_0x908a('0x47')](handleError(_0x4ee373,null));};exports[_0x908a('0x27')]=function(_0x4a0eb4,_0x4ff0eb){return db[_0x908a('0x2d')][_0x908a('0x49')]({'where':{'id':_0x4a0eb4['params']['id']}})['then'](handleEntityNotFound(_0x4ff0eb,null))[_0x908a('0x26')](removeEntity(_0x4ff0eb,null))[_0x908a('0x47')](handleError(_0x4ff0eb,null));};exports[_0x908a('0x4c')]=function(_0x36ef6a,_0xe737d5,_0x1fdd96){var _0x3bc2d2={};var _0x9baf6b={};var _0x4f02ee;var _0x2879e9;return db[_0x908a('0x2d')][_0x908a('0x4d')]({'where':{'id':_0x36ef6a[_0x908a('0x4e')]['id']}})[_0x908a('0x26')](handleEntityNotFound(_0xe737d5,null))[_0x908a('0x26')](function(_0x5ebd47){if(_0x5ebd47){_0x4f02ee=_0x5ebd47;_0x9baf6b[_0x908a('0x33')]=_[_0x908a('0x31')](db[_0x908a('0x4f')][_0x908a('0x48')]);_0x9baf6b['query']=_[_0x908a('0x31')](_0x36ef6a[_0x908a('0x30')]);_0x9baf6b[_0x908a('0x3c')]=_[_0x908a('0x32')](_0x9baf6b[_0x908a('0x33')],_0x9baf6b['query']);_0x3bc2d2[_0x908a('0x35')]=_[_0x908a('0x32')](_0x9baf6b[_0x908a('0x33')],qs[_0x908a('0x34')](_0x36ef6a['query']['fields']));_0x3bc2d2[_0x908a('0x35')]=_0x3bc2d2[_0x908a('0x35')]['length']?_0x3bc2d2[_0x908a('0x35')]:_0x9baf6b[_0x908a('0x33')];_0x3bc2d2[_0x908a('0x39')]=qs['sort'](_0x36ef6a[_0x908a('0x30')][_0x908a('0x3a')]);_0x3bc2d2['where']=qs[_0x908a('0x3c')](_['pick'](_0x36ef6a[_0x908a('0x30')],_0x9baf6b['filters']));if(_0x36ef6a[_0x908a('0x30')]['filter']){_0x3bc2d2['where']=_['merge'](_0x3bc2d2[_0x908a('0x3e')],{'$or':_[_0x908a('0x2c')](_0x3bc2d2[_0x908a('0x35')],function(_0xb3caf3){var _0x3f3511={};_0x3f3511[_0xb3caf3]={'$like':'%'+_0x36ef6a[_0x908a('0x30')][_0x908a('0x3d')]+'%'};return _0x3f3511;})});}_0x3bc2d2=_[_0x908a('0x3f')]({},_0x3bc2d2,_0x36ef6a['options']);return _0x4f02ee['getFields'](_0x3bc2d2);}})['then'](function(_0x59f9ec){if(_0x59f9ec){_0x2879e9=_0x59f9ec[_0x908a('0x36')];if(!_0x36ef6a['query'][_0x908a('0x37')](_0x908a('0x38'))){_0x3bc2d2[_0x908a('0x1d')]=qs['limit'](_0x36ef6a[_0x908a('0x30')][_0x908a('0x1d')]);_0x3bc2d2[_0x908a('0x1c')]=qs['offset'](_0x36ef6a[_0x908a('0x30')]['offset']);}return _0x4f02ee[_0x908a('0x4c')](_0x3bc2d2);}})[_0x908a('0x26')](function(_0x39e333){if(_0x39e333){return _0x39e333?{'count':_0x2879e9,'rows':_0x39e333}:null;}})[_0x908a('0x26')](respondWithResult(_0xe737d5,null))[_0x908a('0x47')](handleError(_0xe737d5,null));};exports[_0x908a('0x50')]=function(_0x3dbd90,_0x565a01,_0x4b99fb){var _0x4e6f86={};var _0x4435fd={};var _0x32b70f;var _0x34d842;return db[_0x908a('0x2d')]['findOne']({'where':{'id':_0x3dbd90['params']['id']}})[_0x908a('0x26')](handleEntityNotFound(_0x565a01,null))[_0x908a('0x26')](function(_0x910913){if(_0x910913){_0x32b70f=_0x910913;_0x4435fd[_0x908a('0x33')]=_['keys'](db[_0x908a('0x4f')][_0x908a('0x48')]);_0x4435fd[_0x908a('0x30')]=_['keys'](_0x3dbd90[_0x908a('0x30')]);_0x4435fd['filters']=_['intersection'](_0x4435fd[_0x908a('0x33')],_0x4435fd[_0x908a('0x30')]);_0x4e6f86[_0x908a('0x35')]=_[_0x908a('0x32')](_0x4435fd[_0x908a('0x33')],qs[_0x908a('0x34')](_0x3dbd90[_0x908a('0x30')][_0x908a('0x34')]));_0x4e6f86[_0x908a('0x35')]=_0x4e6f86[_0x908a('0x35')][_0x908a('0x36')]?_0x4e6f86['attributes']:_0x4435fd[_0x908a('0x33')];_0x4e6f86[_0x908a('0x39')]=qs[_0x908a('0x3a')](_0x3dbd90[_0x908a('0x30')][_0x908a('0x3a')]);_0x4e6f86['where']=qs['filters'](_[_0x908a('0x3b')](_0x3dbd90[_0x908a('0x30')],_0x4435fd[_0x908a('0x3c')]));if(_0x3dbd90[_0x908a('0x30')][_0x908a('0x3d')]){_0x4e6f86[_0x908a('0x3e')]=_[_0x908a('0x3f')](_0x4e6f86[_0x908a('0x3e')],{'$or':_[_0x908a('0x2c')](_0x4e6f86[_0x908a('0x35')],function(_0x4292dc){var _0xf8d67b={};_0xf8d67b[_0x4292dc]={'$like':'%'+_0x3dbd90[_0x908a('0x30')][_0x908a('0x3d')]+'%'};return _0xf8d67b;})});}_0x4e6f86=_[_0x908a('0x3f')]({},_0x4e6f86,_0x3dbd90[_0x908a('0x42')]);return _0x32b70f['getSubjects'](_0x4e6f86);}})[_0x908a('0x26')](function(_0x3dd736){if(_0x3dd736){_0x34d842=_0x3dd736[_0x908a('0x36')];if(!_0x3dbd90[_0x908a('0x30')][_0x908a('0x37')](_0x908a('0x38'))){_0x4e6f86[_0x908a('0x1d')]=qs['limit'](_0x3dbd90[_0x908a('0x30')][_0x908a('0x1d')]);_0x4e6f86[_0x908a('0x1c')]=qs[_0x908a('0x1c')](_0x3dbd90['query'][_0x908a('0x1c')]);}return _0x32b70f[_0x908a('0x50')](_0x4e6f86);}})[_0x908a('0x26')](function(_0x360a85){if(_0x360a85){return _0x360a85?{'count':_0x34d842,'rows':_0x360a85}:null;}})['then'](respondWithResult(_0x565a01,null))[_0x908a('0x47')](handleError(_0x565a01,null));};exports[_0x908a('0x51')]=function(_0x23942b,_0x392ba4,_0x336392){var _0x58292f={};var _0x387f13={};var _0x3340c2;var _0x524f5d;return db['DeskConfiguration']['findOne']({'where':{'id':_0x23942b['params']['id']}})['then'](handleEntityNotFound(_0x392ba4,null))[_0x908a('0x26')](function(_0x7209b1){if(_0x7209b1){_0x3340c2=_0x7209b1;_0x387f13[_0x908a('0x33')]=_[_0x908a('0x31')](db['DeskField'][_0x908a('0x48')]);_0x387f13['query']=_[_0x908a('0x31')](_0x23942b[_0x908a('0x30')]);_0x387f13[_0x908a('0x3c')]=_[_0x908a('0x32')](_0x387f13[_0x908a('0x33')],_0x387f13[_0x908a('0x30')]);_0x58292f['attributes']=_['intersection'](_0x387f13[_0x908a('0x33')],qs[_0x908a('0x34')](_0x23942b[_0x908a('0x30')][_0x908a('0x34')]));_0x58292f['attributes']=_0x58292f['attributes'][_0x908a('0x36')]?_0x58292f[_0x908a('0x35')]:_0x387f13['model'];_0x58292f[_0x908a('0x39')]=qs[_0x908a('0x3a')](_0x23942b[_0x908a('0x30')]['sort']);_0x58292f['where']=qs[_0x908a('0x3c')](_['pick'](_0x23942b[_0x908a('0x30')],_0x387f13[_0x908a('0x3c')]));if(_0x23942b['query'][_0x908a('0x3d')]){_0x58292f[_0x908a('0x3e')]=_[_0x908a('0x3f')](_0x58292f[_0x908a('0x3e')],{'$or':_[_0x908a('0x2c')](_0x58292f[_0x908a('0x35')],function(_0x1dd48f){var _0x5d3e51={};_0x5d3e51[_0x1dd48f]={'$like':'%'+_0x23942b[_0x908a('0x30')]['filter']+'%'};return _0x5d3e51;})});}_0x58292f=_[_0x908a('0x3f')]({},_0x58292f,_0x23942b['options']);return _0x3340c2[_0x908a('0x51')](_0x58292f);}})[_0x908a('0x26')](function(_0x439d52){if(_0x439d52){_0x524f5d=_0x439d52[_0x908a('0x36')];if(!_0x23942b[_0x908a('0x30')][_0x908a('0x37')](_0x908a('0x38'))){_0x58292f[_0x908a('0x1d')]=qs[_0x908a('0x1d')](_0x23942b[_0x908a('0x30')][_0x908a('0x1d')]);_0x58292f[_0x908a('0x1c')]=qs[_0x908a('0x1c')](_0x23942b[_0x908a('0x30')][_0x908a('0x1c')]);}return _0x3340c2[_0x908a('0x51')](_0x58292f);}})[_0x908a('0x26')](function(_0x5aa4fe){if(_0x5aa4fe){return _0x5aa4fe?{'count':_0x524f5d,'rows':_0x5aa4fe}:null;}})[_0x908a('0x26')](respondWithResult(_0x392ba4,null))[_0x908a('0x47')](handleError(_0x392ba4,null));};exports['getTags']=function(_0x23bd1c,_0x35246b,_0x425129){var _0x3d6e5b={};var _0x20e15c={};var _0x3a9af4;var _0x53c92d;return db[_0x908a('0x2d')][_0x908a('0x4d')]({'where':{'id':_0x23bd1c['params']['id']}})[_0x908a('0x26')](handleEntityNotFound(_0x35246b,null))['then'](function(_0x1e9fe5){if(_0x1e9fe5){_0x3a9af4=_0x1e9fe5;_0x20e15c['model']=_[_0x908a('0x31')](db[_0x908a('0x52')][_0x908a('0x48')]);_0x20e15c['query']=_[_0x908a('0x31')](_0x23bd1c['query']);_0x20e15c[_0x908a('0x3c')]=_[_0x908a('0x32')](_0x20e15c['model'],_0x20e15c[_0x908a('0x30')]);_0x3d6e5b['attributes']=_[_0x908a('0x32')](_0x20e15c[_0x908a('0x33')],qs[_0x908a('0x34')](_0x23bd1c[_0x908a('0x30')][_0x908a('0x34')]));_0x3d6e5b[_0x908a('0x35')]=_0x3d6e5b[_0x908a('0x35')]['length']?_0x3d6e5b[_0x908a('0x35')]:_0x20e15c[_0x908a('0x33')];_0x3d6e5b[_0x908a('0x39')]=qs['sort'](_0x23bd1c['query'][_0x908a('0x3a')]);_0x3d6e5b[_0x908a('0x3e')]=qs[_0x908a('0x3c')](_[_0x908a('0x3b')](_0x23bd1c[_0x908a('0x30')],_0x20e15c['filters']));if(_0x23bd1c[_0x908a('0x30')][_0x908a('0x3d')]){_0x3d6e5b['where']=_[_0x908a('0x3f')](_0x3d6e5b[_0x908a('0x3e')],{'$or':_['map'](_0x3d6e5b[_0x908a('0x35')],function(_0x20bbbe){var _0xac3f62={};_0xac3f62[_0x20bbbe]={'$like':'%'+_0x23bd1c['query'][_0x908a('0x3d')]+'%'};return _0xac3f62;})});}_0x3d6e5b=_[_0x908a('0x3f')]({},_0x3d6e5b,_0x23bd1c[_0x908a('0x42')]);return _0x3a9af4['getTags'](_0x3d6e5b);}})[_0x908a('0x26')](function(_0x2932ac){if(_0x2932ac){_0x53c92d=_0x2932ac[_0x908a('0x36')];if(!_0x23bd1c[_0x908a('0x30')][_0x908a('0x37')](_0x908a('0x38'))){_0x3d6e5b[_0x908a('0x1d')]=qs['limit'](_0x23bd1c[_0x908a('0x30')][_0x908a('0x1d')]);_0x3d6e5b[_0x908a('0x1c')]=qs[_0x908a('0x1c')](_0x23bd1c[_0x908a('0x30')][_0x908a('0x1c')]);}return _0x3a9af4['getTags'](_0x3d6e5b);}})[_0x908a('0x26')](function(_0x4ea0cf){if(_0x4ea0cf){return _0x4ea0cf?{'count':_0x53c92d,'rows':_0x4ea0cf}:null;}})[_0x908a('0x26')](respondWithResult(_0x35246b,null))[_0x908a('0x47')](handleError(_0x35246b,null));};exports['setTags']=function(_0x1fde5b,_0x124c5e,_0x393ad2){if(_0x1fde5b[_0x908a('0x4b')]['id']){delete _0x1fde5b[_0x908a('0x4b')]['id'];}return db[_0x908a('0x2d')][_0x908a('0x4d')]({'where':{'id':_0x1fde5b[_0x908a('0x4e')]['id']}})['then'](handleEntityNotFound(_0x124c5e,null))['then'](function(_0x555f4b){if(_0x555f4b){return _0x555f4b[_0x908a('0x53')](_0x1fde5b[_0x908a('0x4b')][_0x908a('0x54')]||[]);}return null;})[_0x908a('0x26')](respondWithResult(_0x124c5e,null))[_0x908a('0x47')](handleError(_0x124c5e,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 417e156..a46ad59 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 _0x45d0=['define','DeskConfiguration','int_desk_configurations','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports'];(function(_0x43c3f9,_0x1861cb){var _0x4f4f54=function(_0x53ac81){while(--_0x53ac81){_0x43c3f9['push'](_0x43c3f9['shift']());}};_0x4f4f54(++_0x1861cb);}(_0x45d0,0x9d));var _0x045d=function(_0x5b5a54,_0x579610){_0x5b5a54=_0x5b5a54-0x0;var _0x1f3762=_0x45d0[_0x5b5a54];return _0x1f3762;};'use strict';var _=require(_0x045d('0x0'));var util=require(_0x045d('0x1'));var logger=require(_0x045d('0x2'))(_0x045d('0x3'));var moment=require(_0x045d('0x4'));var BPromise=require(_0x045d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x045d('0x6'));var rimraf=require(_0x045d('0x7'));var config=require(_0x045d('0x8'));var attributes=require(_0x045d('0x9'));module[_0x045d('0xa')]=function(_0x17d2c9,_0x216214){return _0x17d2c9[_0x045d('0xb')](_0x045d('0xc'),attributes,{'tableName':_0x045d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x15b3=['exports','define','DeskConfiguration','int_desk_configurations','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./intDeskConfiguration.attributes'];(function(_0x9d679d,_0x4dd38a){var _0x3ce1dc=function(_0x2cbc68){while(--_0x2cbc68){_0x9d679d['push'](_0x9d679d['shift']());}};_0x3ce1dc(++_0x4dd38a);}(_0x15b3,0x115));var _0x315b=function(_0x5b9be8,_0x4e492b){_0x5b9be8=_0x5b9be8-0x0;var _0x545a97=_0x15b3[_0x5b9be8];return _0x545a97;};'use strict';var _=require(_0x315b('0x0'));var util=require(_0x315b('0x1'));var logger=require(_0x315b('0x2'))(_0x315b('0x3'));var moment=require('moment');var BPromise=require(_0x315b('0x4'));var rp=require(_0x315b('0x5'));var fs=require('fs');var path=require(_0x315b('0x6'));var rimraf=require(_0x315b('0x7'));var config=require('../../config/environment');var attributes=require(_0x315b('0x8'));module[_0x315b('0x9')]=function(_0x243422,_0x406cbb){return _0x243422[_0x315b('0xa')](_0x315b('0xb'),attributes,{'tableName':_0x315b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js index 726a4e1..b30e984 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 _0xd824=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','randomstring','ioredis'];(function(_0x11a220,_0x4e470a){var _0x20d8fe=function(_0xbedfd){while(--_0xbedfd){_0x11a220['push'](_0x11a220['shift']());}};_0x20d8fe(++_0x4e470a);}(_0xd824,0xc2));var _0x4d82=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xd824[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0x4d82('0x0'));var util=require(_0x4d82('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4d82('0x2'));var fs=require('fs');var Redis=require(_0x4d82('0x3'));var db=require(_0x4d82('0x4'))['db'];var utils=require(_0x4d82('0x5'));var logger=require(_0x4d82('0x6'))(_0x4d82('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4d82('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4b842f,_0x464caf,_0xb54db2){return new BPromise(function(_0x13d624,_0x5cccb6){return client[_0x4d82('0x9')](_0x4b842f,_0xb54db2)['then'](function(_0x5356cd){logger[_0x4d82('0xa')](_0x4d82('0xb'),_0x464caf,_0x4d82('0xc'));logger['debug'](_0x4d82('0xd'),_0x464caf,'request\x20sent',JSON[_0x4d82('0xe')](_0x5356cd));if(_0x5356cd[_0x4d82('0xf')]){if(_0x5356cd[_0x4d82('0xf')]['code']===0x1f4){logger['error'](_0x4d82('0xb'),_0x464caf,_0x5356cd[_0x4d82('0xf')][_0x4d82('0x10')]);return _0x5cccb6(_0x5356cd[_0x4d82('0xf')]['message']);}logger[_0x4d82('0xf')](_0x4d82('0xb'),_0x464caf,_0x5356cd[_0x4d82('0xf')]['message']);return _0x13d624(_0x5356cd[_0x4d82('0xf')]['message']);}else{logger[_0x4d82('0xa')]('DeskConfiguration,\x20%s,\x20%s',_0x464caf,_0x4d82('0xc'));_0x13d624(_0x5356cd['result'][_0x4d82('0x10')]);}})[_0x4d82('0x11')](function(_0x461476){logger[_0x4d82('0xf')](_0x4d82('0xb'),_0x464caf,_0x461476);_0x5cccb6(_0x461476);});});} \ No newline at end of file +var _0x4baa=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','DeskConfiguration,\x20%s,\x20%s','result','catch','moment'];(function(_0x4db1d5,_0x7bb17a){var _0x3f316d=function(_0x4cd598){while(--_0x4cd598){_0x4db1d5['push'](_0x4db1d5['shift']());}};_0x3f316d(++_0x7bb17a);}(_0x4baa,0x14f));var _0xa4ba=function(_0x5b1b07,_0x119df6){_0x5b1b07=_0x5b1b07-0x0;var _0x59fbbc=_0x4baa[_0x5b1b07];return _0x59fbbc;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa4ba('0x0'));var BPromise=require('bluebird');var rs=require(_0xa4ba('0x1'));var fs=require('fs');var Redis=require(_0xa4ba('0x2'));var db=require(_0xa4ba('0x3'))['db'];var utils=require(_0xa4ba('0x4'));var logger=require('../../config/logger')(_0xa4ba('0x5'));var config=require(_0xa4ba('0x6'));var jayson=require(_0xa4ba('0x7'));var client=jayson[_0xa4ba('0x8')][_0xa4ba('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3a89ad,_0x12b5ce,_0x210c7c){return new BPromise(function(_0x7e0ed6,_0x4a83ac){return client[_0xa4ba('0xa')](_0x3a89ad,_0x210c7c)[_0xa4ba('0xb')](function(_0x5c930f){logger[_0xa4ba('0xc')]('DeskConfiguration,\x20%s,\x20%s',_0x12b5ce,_0xa4ba('0xd'));logger['debug'](_0xa4ba('0xe'),_0x12b5ce,_0xa4ba('0xd'),JSON[_0xa4ba('0xf')](_0x5c930f));if(_0x5c930f[_0xa4ba('0x10')]){if(_0x5c930f[_0xa4ba('0x10')]['code']===0x1f4){logger[_0xa4ba('0x10')]('DeskConfiguration,\x20%s,\x20%s',_0x12b5ce,_0x5c930f['error']['message']);return _0x4a83ac(_0x5c930f['error']['message']);}logger[_0xa4ba('0x10')]('DeskConfiguration,\x20%s,\x20%s',_0x12b5ce,_0x5c930f[_0xa4ba('0x10')][_0xa4ba('0x11')]);return _0x7e0ed6(_0x5c930f[_0xa4ba('0x10')][_0xa4ba('0x11')]);}else{logger[_0xa4ba('0xc')](_0xa4ba('0x12'),_0x12b5ce,_0xa4ba('0xd'));_0x7e0ed6(_0x5c930f[_0xa4ba('0x13')][_0xa4ba('0x11')]);}})[_0xa4ba('0x14')](function(_0x936482){logger[_0xa4ba('0x10')](_0xa4ba('0x12'),_0x12b5ce,_0x936482);_0x4a83ac(_0x936482);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 771218a..970b30f 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 _0x2719=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','index','/:id','show','create','put','delete','exports','util','connect-timeout','express','Router'];(function(_0x443b20,_0x1f7118){var _0x49a084=function(_0x595322){while(--_0x595322){_0x443b20['push'](_0x443b20['shift']());}};_0x49a084(++_0x1f7118);}(_0x2719,0x8c));var _0x9271=function(_0x5e81ea,_0x2c6893){_0x5e81ea=_0x5e81ea-0x0;var _0x4c19ed=_0x2719[_0x5e81ea];return _0x4c19ed;};'use strict';var multer=require('multer');var util=require(_0x9271('0x0'));var path=require('path');var timeout=require(_0x9271('0x1'));var express=require(_0x9271('0x2'));var router=express[_0x9271('0x3')]();var fs_extra=require(_0x9271('0x4'));var auth=require(_0x9271('0x5'));var interaction=require(_0x9271('0x6'));var config=require(_0x9271('0x7'));var controller=require(_0x9271('0x8'));router[_0x9271('0x9')]('/',auth[_0x9271('0xa')](),controller[_0x9271('0xb')]);router['get'](_0x9271('0xc'),auth[_0x9271('0xa')](),controller[_0x9271('0xd')]);router['post']('/',auth[_0x9271('0xa')](),controller[_0x9271('0xe')]);router[_0x9271('0xf')](_0x9271('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x9271('0x10')](_0x9271('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x9271('0x11')]=router; \ No newline at end of file +var _0x3599=['path','connect-timeout','express','../../components/interaction/service','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','exports','multer','util'];(function(_0x4e5cf6,_0x4442b8){var _0xe41b9=function(_0x1eaa49){while(--_0x1eaa49){_0x4e5cf6['push'](_0x4e5cf6['shift']());}};_0xe41b9(++_0x4442b8);}(_0x3599,0x185));var _0x9359=function(_0x23d255,_0x218613){_0x23d255=_0x23d255-0x0;var _0x539eda=_0x3599[_0x23d255];return _0x539eda;};'use strict';var multer=require(_0x9359('0x0'));var util=require(_0x9359('0x1'));var path=require(_0x9359('0x2'));var timeout=require(_0x9359('0x3'));var express=require(_0x9359('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x9359('0x5'));var config=require('../../config/environment');var controller=require('./intDeskField.controller');router[_0x9359('0x6')]('/',auth[_0x9359('0x7')](),controller[_0x9359('0x8')]);router[_0x9359('0x6')]('/:id',auth[_0x9359('0x7')](),controller[_0x9359('0x9')]);router[_0x9359('0xa')]('/',auth[_0x9359('0x7')](),controller[_0x9359('0xb')]);router[_0x9359('0xc')](_0x9359('0xd'),auth[_0x9359('0x7')](),controller[_0x9359('0xe')]);router[_0x9359('0xf')](_0x9359('0xd'),auth[_0x9359('0x7')](),controller['destroy']);module[_0x9359('0x10')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 3b9f0f9..0ed730d 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 _0x406b=['variable','customVariable','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x4dc72d,_0x10e747){var _0x319274=function(_0x48cef5){while(--_0x48cef5){_0x4dc72d['push'](_0x4dc72d['shift']());}};_0x319274(++_0x10e747);}(_0x406b,0x1d0));var _0xb406=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0x406b[_0x42245d];return _0x4b211a;};'use strict';var Sequelize=require(_0xb406('0x0'));module[_0xb406('0x1')]={'type':{'type':Sequelize[_0xb406('0x2')](_0xb406('0x3'),_0xb406('0x4'),_0xb406('0x5'),'keyValue',_0xb406('0x6')),'defaultValue':_0xb406('0x3')},'content':{'type':Sequelize[_0xb406('0x7')]},'key':{'type':Sequelize[_0xb406('0x7')]},'keyType':{'type':Sequelize[_0xb406('0x2')](_0xb406('0x3'),_0xb406('0x4'),_0xb406('0x5'))},'keyContent':{'type':Sequelize[_0xb406('0x7')]},'idField':{'type':Sequelize[_0xb406('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xb406('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb406('0x7')]}}; \ No newline at end of file +var _0xe74b=['BOOLEAN','exports','ENUM','string','variable','keyValue','picklist','STRING','customVariable'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0xe74b,0xc7));var _0xbe74=function(_0x588000,_0x97bae4){_0x588000=_0x588000-0x0;var _0x551d3a=_0xe74b[_0x588000];return _0x551d3a;};'use strict';var Sequelize=require('sequelize');module[_0xbe74('0x0')]={'type':{'type':Sequelize[_0xbe74('0x1')](_0xbe74('0x2'),_0xbe74('0x3'),'customVariable',_0xbe74('0x4'),_0xbe74('0x5')),'defaultValue':_0xbe74('0x2')},'content':{'type':Sequelize[_0xbe74('0x6')]},'key':{'type':Sequelize[_0xbe74('0x6')]},'keyType':{'type':Sequelize[_0xbe74('0x1')]('string',_0xbe74('0x3'),_0xbe74('0x7'))},'keyContent':{'type':Sequelize[_0xbe74('0x6')]},'idField':{'type':Sequelize[_0xbe74('0x6')]},'nameField':{'type':Sequelize[_0xbe74('0x6')]},'customField':{'type':Sequelize[_0xbe74('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xbe74('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 8fed0cf..afdd98d 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 _0xe98c=['path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','end','json','offset','undefined','limit','count','status','set','apply','save','update','destroy','then','sendStatus','error','stack','name','send','map','DeskField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','hasOwnProperty','order','sort','pick','filter','where','merge','options','includeAll','include','rows','catch','params','attributes','length','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util'];(function(_0x580238,_0x2adec2){var _0x3d5608=function(_0x281c35){while(--_0x281c35){_0x580238['push'](_0x580238['shift']());}};_0x3d5608(++_0x2adec2);}(_0xe98c,0xd3));var _0xce98=function(_0x4f828c,_0x2f6cac){_0x4f828c=_0x4f828c-0x0;var _0x1fea4d=_0xe98c[_0x4f828c];return _0x1fea4d;};'use strict';var emlformat=require(_0xce98('0x0'));var rimraf=require(_0xce98('0x1'));var zipdir=require(_0xce98('0x2'));var jsonpatch=require(_0xce98('0x3'));var rp=require(_0xce98('0x4'));var moment=require('moment');var BPromise=require(_0xce98('0x5'));var Mustache=require(_0xce98('0x6'));var util=require(_0xce98('0x7'));var path=require(_0xce98('0x8'));var sox=require(_0xce98('0x9'));var csv=require(_0xce98('0xa'));var ejs=require(_0xce98('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xce98('0xc'));var squel=require(_0xce98('0xd'));var crypto=require(_0xce98('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xce98('0xf'));var toCsv=require('to-csv');var querystring=require(_0xce98('0x10'));var Papa=require('papaparse');var Redis=require(_0xce98('0x11'));var authService=require(_0xce98('0x12'));var qs=require(_0xce98('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xce98('0x14'));var logger=require(_0xce98('0x15'))(_0xce98('0x16'));var utils=require('../../config/utils');var config=require(_0xce98('0x17'));var licenseUtil=require(_0xce98('0x18'));var db=require(_0xce98('0x19'))['db'];function respondWithStatusCode(_0x12897d,_0x48e087){_0x48e087=_0x48e087||0xcc;return function(_0x444441){if(_0x444441){return _0x12897d['sendStatus'](_0x48e087);}return _0x12897d['status'](_0x48e087)[_0xce98('0x1a')]();};}function respondWithResult(_0x5f44bb,_0x499e6b){_0x499e6b=_0x499e6b||0xc8;return function(_0x42483b){if(_0x42483b){return _0x5f44bb['status'](_0x499e6b)[_0xce98('0x1b')](_0x42483b);}};}function respondWithFilteredResult(_0x62a466,_0x2e0ba0){return function(_0xd68d7d){if(_0xd68d7d){var _0x176b15=typeof _0x2e0ba0[_0xce98('0x1c')]===_0xce98('0x1d')&&typeof _0x2e0ba0[_0xce98('0x1e')]===_0xce98('0x1d');var _0x4d69a1=_0xd68d7d[_0xce98('0x1f')];var _0x51744b=_0x176b15?0x0:_0x2e0ba0[_0xce98('0x1c')];var _0x44c0b6=_0x176b15?_0xd68d7d[_0xce98('0x1f')]:_0x2e0ba0['offset']+_0x2e0ba0[_0xce98('0x1e')];var _0x50a34e;if(_0x44c0b6>=_0x4d69a1){_0x44c0b6=_0x4d69a1;_0x50a34e=0xc8;}else{_0x50a34e=0xce;}_0x62a466[_0xce98('0x20')](_0x50a34e);return _0x62a466[_0xce98('0x21')]('Content-Range',_0x51744b+'-'+_0x44c0b6+'/'+_0x4d69a1)[_0xce98('0x1b')](_0xd68d7d);}return null;};}function patchUpdates(_0x113e89){return function(_0x2f743e){try{jsonpatch[_0xce98('0x22')](_0x2f743e,_0x113e89,!![]);}catch(_0x343114){return BPromise['reject'](_0x343114);}return _0x2f743e[_0xce98('0x23')]();};}function saveUpdates(_0x1c0c57,_0x2a00e8){return function(_0x41cb74){if(_0x41cb74){return _0x41cb74[_0xce98('0x24')](_0x1c0c57)['then'](function(_0x36dab5){return _0x36dab5;});}return null;};}function removeEntity(_0x113b29,_0x536fa1){return function(_0x5b832b){if(_0x5b832b){return _0x5b832b[_0xce98('0x25')]()[_0xce98('0x26')](function(){_0x113b29[_0xce98('0x20')](0xcc)[_0xce98('0x1a')]();});}};}function handleEntityNotFound(_0x21b681,_0x4a1b6e){return function(_0x849b1){if(!_0x849b1){_0x21b681[_0xce98('0x27')](0x194);}return _0x849b1;};}function handleError(_0x5ccc1f,_0x163eb6){_0x163eb6=_0x163eb6||0x1f4;return function(_0x53f583){logger[_0xce98('0x28')](_0x53f583[_0xce98('0x29')]);if(_0x53f583[_0xce98('0x2a')]){delete _0x53f583[_0xce98('0x2a')];}_0x5ccc1f[_0xce98('0x20')](_0x163eb6)[_0xce98('0x2b')](_0x53f583);};}exports['index']=function(_0x3849e8,_0x54132b){var _0x50a3c5={},_0x12f180={},_0x4f6590={'count':0x0,'rows':[]};var _0x2593f0=_[_0xce98('0x2c')](db[_0xce98('0x2d')][_0xce98('0x2e')],function(_0x133cbd){return{'name':_0x133cbd[_0xce98('0x2f')],'type':_0x133cbd[_0xce98('0x30')][_0xce98('0x31')]};});_0x12f180[_0xce98('0x32')]=_[_0xce98('0x2c')](_0x2593f0,_0xce98('0x2a'));_0x12f180[_0xce98('0x33')]=_[_0xce98('0x34')](_0x3849e8[_0xce98('0x33')]);_0x12f180[_0xce98('0x35')]=_[_0xce98('0x36')](_0x12f180[_0xce98('0x32')],_0x12f180[_0xce98('0x33')]);_0x50a3c5['attributes']=_[_0xce98('0x36')](_0x12f180[_0xce98('0x32')],qs['fields'](_0x3849e8[_0xce98('0x33')][_0xce98('0x37')]));_0x50a3c5['attributes']=_0x50a3c5['attributes']['length']?_0x50a3c5['attributes']:_0x12f180[_0xce98('0x32')];if(!_0x3849e8[_0xce98('0x33')][_0xce98('0x38')]('nolimit')){_0x50a3c5[_0xce98('0x1e')]=qs[_0xce98('0x1e')](_0x3849e8[_0xce98('0x33')][_0xce98('0x1e')]);_0x50a3c5[_0xce98('0x1c')]=qs[_0xce98('0x1c')](_0x3849e8['query'][_0xce98('0x1c')]);}_0x50a3c5[_0xce98('0x39')]=qs[_0xce98('0x3a')](_0x3849e8[_0xce98('0x33')][_0xce98('0x3a')]);_0x50a3c5['where']=qs[_0xce98('0x35')](_[_0xce98('0x3b')](_0x3849e8['query'],_0x12f180[_0xce98('0x35')]),_0x2593f0);if(_0x3849e8[_0xce98('0x33')][_0xce98('0x3c')]){_0x50a3c5[_0xce98('0x3d')]=_[_0xce98('0x3e')](_0x50a3c5['where'],{'$or':_[_0xce98('0x2c')](_0x2593f0,function(_0x5c1ee8){if(_0x5c1ee8[_0xce98('0x30')]!=='VIRTUAL'){var _0x530d0d={};_0x530d0d[_0x5c1ee8[_0xce98('0x2a')]]={'$like':'%'+_0x3849e8[_0xce98('0x33')][_0xce98('0x3c')]+'%'};return _0x530d0d;}})});}_0x50a3c5=_[_0xce98('0x3e')]({},_0x50a3c5,_0x3849e8[_0xce98('0x3f')]);var _0x2f9143={'where':_0x50a3c5['where']};return db[_0xce98('0x2d')][_0xce98('0x1f')](_0x2f9143)[_0xce98('0x26')](function(_0x33bcf2){_0x4f6590[_0xce98('0x1f')]=_0x33bcf2;if(_0x3849e8[_0xce98('0x33')][_0xce98('0x40')]){_0x50a3c5[_0xce98('0x41')]=[{'all':!![]}];}return db[_0xce98('0x2d')]['findAll'](_0x50a3c5);})[_0xce98('0x26')](function(_0x51c42b){_0x4f6590[_0xce98('0x42')]=_0x51c42b;return _0x4f6590;})[_0xce98('0x26')](respondWithFilteredResult(_0x54132b,_0x50a3c5))[_0xce98('0x43')](handleError(_0x54132b,null));};exports['show']=function(_0x4e8b54,_0x5e769e){var _0x3c1494={'raw':!![],'where':{'id':_0x4e8b54[_0xce98('0x44')]['id']}},_0x8fffd1={};_0x8fffd1['model']=_[_0xce98('0x34')](db[_0xce98('0x2d')]['rawAttributes']);_0x8fffd1['query']=_[_0xce98('0x34')](_0x4e8b54[_0xce98('0x33')]);_0x8fffd1[_0xce98('0x35')]=_[_0xce98('0x36')](_0x8fffd1[_0xce98('0x32')],_0x8fffd1[_0xce98('0x33')]);_0x3c1494['attributes']=_[_0xce98('0x36')](_0x8fffd1['model'],qs[_0xce98('0x37')](_0x4e8b54[_0xce98('0x33')]['fields']));_0x3c1494[_0xce98('0x45')]=_0x3c1494['attributes'][_0xce98('0x46')]?_0x3c1494[_0xce98('0x45')]:_0x8fffd1[_0xce98('0x32')];if(_0x4e8b54[_0xce98('0x33')][_0xce98('0x40')]){_0x3c1494[_0xce98('0x41')]=[{'all':!![]}];}_0x3c1494=_[_0xce98('0x3e')]({},_0x3c1494,_0x4e8b54['options']);return db[_0xce98('0x2d')]['find'](_0x3c1494)[_0xce98('0x26')](handleEntityNotFound(_0x5e769e,null))[_0xce98('0x26')](respondWithResult(_0x5e769e,null))[_0xce98('0x43')](handleError(_0x5e769e,null));};exports['create']=function(_0x2f74d0,_0x1bee32){return db[_0xce98('0x2d')]['create'](_0x2f74d0[_0xce98('0x47')],{})[_0xce98('0x26')](respondWithResult(_0x1bee32,0xc9))[_0xce98('0x43')](handleError(_0x1bee32,null));};exports[_0xce98('0x24')]=function(_0x2a279d,_0x15a389){if(_0x2a279d[_0xce98('0x47')]['id']){delete _0x2a279d[_0xce98('0x47')]['id'];}return db['DeskField'][_0xce98('0x48')]({'where':{'id':_0x2a279d['params']['id']}})[_0xce98('0x26')](handleEntityNotFound(_0x15a389,null))[_0xce98('0x26')](saveUpdates(_0x2a279d[_0xce98('0x47')],null))[_0xce98('0x26')](respondWithResult(_0x15a389,null))[_0xce98('0x43')](handleError(_0x15a389,null));};exports[_0xce98('0x25')]=function(_0x294115,_0x26dce5){return db['DeskField'][_0xce98('0x48')]({'where':{'id':_0x294115[_0xce98('0x44')]['id']}})[_0xce98('0x26')](handleEntityNotFound(_0x26dce5,null))[_0xce98('0x26')](removeEntity(_0x26dce5,null))[_0xce98('0x43')](handleError(_0x26dce5,null));}; \ No newline at end of file +var _0x5a99=['offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','DeskField','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','rows','show','params','length','create','body','catch','find','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json'];(function(_0xa041de,_0x3600e2){var _0x1d654c=function(_0x295d70){while(--_0x295d70){_0xa041de['push'](_0xa041de['shift']());}};_0x1d654c(++_0x3600e2);}(_0x5a99,0xc9));var _0x95a9=function(_0x11962c,_0x5c2f14){_0x11962c=_0x11962c-0x0;var _0x36dcfb=_0x5a99[_0x11962c];return _0x36dcfb;};'use strict';var emlformat=require(_0x95a9('0x0'));var rimraf=require(_0x95a9('0x1'));var zipdir=require(_0x95a9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x95a9('0x3'));var moment=require(_0x95a9('0x4'));var BPromise=require(_0x95a9('0x5'));var Mustache=require(_0x95a9('0x6'));var util=require('util');var path=require(_0x95a9('0x7'));var sox=require(_0x95a9('0x8'));var csv=require(_0x95a9('0x9'));var ejs=require(_0x95a9('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x95a9('0xb'));var squel=require(_0x95a9('0xc'));var crypto=require(_0x95a9('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x95a9('0xe'));var toCsv=require('to-csv');var querystring=require(_0x95a9('0xf'));var Papa=require(_0x95a9('0x10'));var Redis=require(_0x95a9('0x11'));var authService=require(_0x95a9('0x12'));var qs=require(_0x95a9('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x95a9('0x14'))(_0x95a9('0x15'));var utils=require('../../config/utils');var config=require(_0x95a9('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x95a9('0x17'))['db'];function respondWithStatusCode(_0x2cf403,_0x789d86){_0x789d86=_0x789d86||0xcc;return function(_0x1c7256){if(_0x1c7256){return _0x2cf403[_0x95a9('0x18')](_0x789d86);}return _0x2cf403['status'](_0x789d86)['end']();};}function respondWithResult(_0x5e9ad2,_0x39126b){_0x39126b=_0x39126b||0xc8;return function(_0x537c35){if(_0x537c35){return _0x5e9ad2[_0x95a9('0x19')](_0x39126b)[_0x95a9('0x1a')](_0x537c35);}};}function respondWithFilteredResult(_0x4644c4,_0x4aea93){return function(_0x9d0e15){if(_0x9d0e15){var _0x4900b3=typeof _0x4aea93[_0x95a9('0x1b')]===_0x95a9('0x1c')&&typeof _0x4aea93[_0x95a9('0x1d')]==='undefined';var _0x45d1d2=_0x9d0e15['count'];var _0x4bcec6=_0x4900b3?0x0:_0x4aea93[_0x95a9('0x1b')];var _0x3b6d30=_0x4900b3?_0x9d0e15[_0x95a9('0x1e')]:_0x4aea93[_0x95a9('0x1b')]+_0x4aea93[_0x95a9('0x1d')];var _0x2e1322;if(_0x3b6d30>=_0x45d1d2){_0x3b6d30=_0x45d1d2;_0x2e1322=0xc8;}else{_0x2e1322=0xce;}_0x4644c4[_0x95a9('0x19')](_0x2e1322);return _0x4644c4[_0x95a9('0x1f')](_0x95a9('0x20'),_0x4bcec6+'-'+_0x3b6d30+'/'+_0x45d1d2)[_0x95a9('0x1a')](_0x9d0e15);}return null;};}function patchUpdates(_0x4d48b4){return function(_0x56d23a){try{jsonpatch[_0x95a9('0x21')](_0x56d23a,_0x4d48b4,!![]);}catch(_0x261f2b){return BPromise[_0x95a9('0x22')](_0x261f2b);}return _0x56d23a[_0x95a9('0x23')]();};}function saveUpdates(_0x5a6034,_0x2f05a7){return function(_0x21b556){if(_0x21b556){return _0x21b556[_0x95a9('0x24')](_0x5a6034)[_0x95a9('0x25')](function(_0x465e5b){return _0x465e5b;});}return null;};}function removeEntity(_0x411ee3,_0x203c51){return function(_0x48de16){if(_0x48de16){return _0x48de16[_0x95a9('0x26')]()[_0x95a9('0x25')](function(){_0x411ee3[_0x95a9('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x493acf,_0x1672a6){return function(_0x49413f){if(!_0x49413f){_0x493acf['sendStatus'](0x194);}return _0x49413f;};}function handleError(_0xda089a,_0x5eb71e){_0x5eb71e=_0x5eb71e||0x1f4;return function(_0x19e04f){logger[_0x95a9('0x27')](_0x19e04f[_0x95a9('0x28')]);if(_0x19e04f[_0x95a9('0x29')]){delete _0x19e04f[_0x95a9('0x29')];}_0xda089a[_0x95a9('0x19')](_0x5eb71e)[_0x95a9('0x2a')](_0x19e04f);};}exports[_0x95a9('0x2b')]=function(_0x381672,_0x4de407){var _0x17fcb1={},_0xe64e70={},_0x3ae759={'count':0x0,'rows':[]};var _0x2718ff=_[_0x95a9('0x2c')](db[_0x95a9('0x2d')][_0x95a9('0x2e')],function(_0x499dc7){return{'name':_0x499dc7['fieldName'],'type':_0x499dc7['type'][_0x95a9('0x2f')]};});_0xe64e70[_0x95a9('0x30')]=_[_0x95a9('0x2c')](_0x2718ff,'name');_0xe64e70[_0x95a9('0x31')]=_[_0x95a9('0x32')](_0x381672[_0x95a9('0x31')]);_0xe64e70[_0x95a9('0x33')]=_[_0x95a9('0x34')](_0xe64e70[_0x95a9('0x30')],_0xe64e70[_0x95a9('0x31')]);_0x17fcb1[_0x95a9('0x35')]=_['intersection'](_0xe64e70['model'],qs['fields'](_0x381672[_0x95a9('0x31')][_0x95a9('0x36')]));_0x17fcb1[_0x95a9('0x35')]=_0x17fcb1[_0x95a9('0x35')]['length']?_0x17fcb1[_0x95a9('0x35')]:_0xe64e70[_0x95a9('0x30')];if(!_0x381672[_0x95a9('0x31')][_0x95a9('0x37')](_0x95a9('0x38'))){_0x17fcb1[_0x95a9('0x1d')]=qs[_0x95a9('0x1d')](_0x381672[_0x95a9('0x31')][_0x95a9('0x1d')]);_0x17fcb1[_0x95a9('0x1b')]=qs[_0x95a9('0x1b')](_0x381672['query'][_0x95a9('0x1b')]);}_0x17fcb1[_0x95a9('0x39')]=qs[_0x95a9('0x3a')](_0x381672[_0x95a9('0x31')][_0x95a9('0x3a')]);_0x17fcb1[_0x95a9('0x3b')]=qs['filters'](_[_0x95a9('0x3c')](_0x381672[_0x95a9('0x31')],_0xe64e70[_0x95a9('0x33')]),_0x2718ff);if(_0x381672[_0x95a9('0x31')][_0x95a9('0x3d')]){_0x17fcb1['where']=_[_0x95a9('0x3e')](_0x17fcb1[_0x95a9('0x3b')],{'$or':_['map'](_0x2718ff,function(_0xb00bfd){if(_0xb00bfd[_0x95a9('0x3f')]!=='VIRTUAL'){var _0x5a6030={};_0x5a6030[_0xb00bfd[_0x95a9('0x29')]]={'$like':'%'+_0x381672[_0x95a9('0x31')][_0x95a9('0x3d')]+'%'};return _0x5a6030;}})});}_0x17fcb1=_[_0x95a9('0x3e')]({},_0x17fcb1,_0x381672[_0x95a9('0x40')]);var _0x314938={'where':_0x17fcb1[_0x95a9('0x3b')]};return db[_0x95a9('0x2d')]['count'](_0x314938)[_0x95a9('0x25')](function(_0x1f7eb7){_0x3ae759[_0x95a9('0x1e')]=_0x1f7eb7;if(_0x381672[_0x95a9('0x31')][_0x95a9('0x41')]){_0x17fcb1[_0x95a9('0x42')]=[{'all':!![]}];}return db[_0x95a9('0x2d')][_0x95a9('0x43')](_0x17fcb1);})[_0x95a9('0x25')](function(_0x4699b1){_0x3ae759[_0x95a9('0x44')]=_0x4699b1;return _0x3ae759;})[_0x95a9('0x25')](respondWithFilteredResult(_0x4de407,_0x17fcb1))['catch'](handleError(_0x4de407,null));};exports[_0x95a9('0x45')]=function(_0x4b5978,_0x3ea287){var _0xc05ea1={'raw':!![],'where':{'id':_0x4b5978[_0x95a9('0x46')]['id']}},_0x5db9ae={};_0x5db9ae[_0x95a9('0x30')]=_[_0x95a9('0x32')](db[_0x95a9('0x2d')][_0x95a9('0x2e')]);_0x5db9ae[_0x95a9('0x31')]=_[_0x95a9('0x32')](_0x4b5978[_0x95a9('0x31')]);_0x5db9ae[_0x95a9('0x33')]=_[_0x95a9('0x34')](_0x5db9ae[_0x95a9('0x30')],_0x5db9ae[_0x95a9('0x31')]);_0xc05ea1[_0x95a9('0x35')]=_[_0x95a9('0x34')](_0x5db9ae[_0x95a9('0x30')],qs[_0x95a9('0x36')](_0x4b5978['query']['fields']));_0xc05ea1[_0x95a9('0x35')]=_0xc05ea1[_0x95a9('0x35')][_0x95a9('0x47')]?_0xc05ea1[_0x95a9('0x35')]:_0x5db9ae[_0x95a9('0x30')];if(_0x4b5978[_0x95a9('0x31')][_0x95a9('0x41')]){_0xc05ea1[_0x95a9('0x42')]=[{'all':!![]}];}_0xc05ea1=_[_0x95a9('0x3e')]({},_0xc05ea1,_0x4b5978[_0x95a9('0x40')]);return db[_0x95a9('0x2d')]['find'](_0xc05ea1)[_0x95a9('0x25')](handleEntityNotFound(_0x3ea287,null))[_0x95a9('0x25')](respondWithResult(_0x3ea287,null))['catch'](handleError(_0x3ea287,null));};exports[_0x95a9('0x48')]=function(_0xb019a6,_0x10a1b1){return db[_0x95a9('0x2d')][_0x95a9('0x48')](_0xb019a6[_0x95a9('0x49')],{})[_0x95a9('0x25')](respondWithResult(_0x10a1b1,0xc9))[_0x95a9('0x4a')](handleError(_0x10a1b1,null));};exports['update']=function(_0x12d733,_0x3cb6bb){if(_0x12d733[_0x95a9('0x49')]['id']){delete _0x12d733[_0x95a9('0x49')]['id'];}return db[_0x95a9('0x2d')][_0x95a9('0x4b')]({'where':{'id':_0x12d733[_0x95a9('0x46')]['id']}})[_0x95a9('0x25')](handleEntityNotFound(_0x3cb6bb,null))[_0x95a9('0x25')](saveUpdates(_0x12d733[_0x95a9('0x49')],null))[_0x95a9('0x25')](respondWithResult(_0x3cb6bb,null))['catch'](handleError(_0x3cb6bb,null));};exports['destroy']=function(_0x195a8e,_0x3e4f40){return db['DeskField'][_0x95a9('0x4b')]({'where':{'id':_0x195a8e['params']['id']}})[_0x95a9('0x25')](handleEntityNotFound(_0x3e4f40,null))[_0x95a9('0x25')](removeEntity(_0x3e4f40,null))[_0x95a9('0x4a')](handleError(_0x3e4f40,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 99a62e9..3aef336 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 _0x0bf6=['path','rimraf','exports','DeskField','int_desk_fields','desk_unique_index','idField','FieldId','util','moment'];(function(_0x2ef691,_0x1af14d){var _0x399d1a=function(_0x48ddbb){while(--_0x48ddbb){_0x2ef691['push'](_0x2ef691['shift']());}};_0x399d1a(++_0x1af14d);}(_0x0bf6,0x1ca));var _0x60bf=function(_0x23b2ce,_0x4e432b){_0x23b2ce=_0x23b2ce-0x0;var _0x176ca1=_0x0bf6[_0x23b2ce];return _0x176ca1;};'use strict';var _=require('lodash');var util=require(_0x60bf('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x60bf('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x60bf('0x2'));var rimraf=require(_0x60bf('0x3'));var config=require('../../config/environment');var attributes=require('./intDeskField.attributes');module[_0x60bf('0x4')]=function(_0x26f12e,_0x398877){return _0x26f12e['define'](_0x60bf('0x5'),attributes,{'tableName':_0x60bf('0x6'),'paranoid':![],'indexes':[{'name':_0x60bf('0x7'),'fields':[_0x60bf('0x8'),_0x60bf('0x9')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x238b=['exports','int_desk_fields','desk_unique_index','FieldId','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./intDeskField.attributes'];(function(_0x1038f0,_0x33ee28){var _0x1816e3=function(_0x24d744){while(--_0x24d744){_0x1038f0['push'](_0x1038f0['shift']());}};_0x1816e3(++_0x33ee28);}(_0x238b,0x1a4));var _0xb238=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x238b[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xb238('0x0'));var util=require(_0xb238('0x1'));var logger=require(_0xb238('0x2'))(_0xb238('0x3'));var moment=require(_0xb238('0x4'));var BPromise=require('bluebird');var rp=require(_0xb238('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb238('0x6'));var config=require(_0xb238('0x7'));var attributes=require(_0xb238('0x8'));module[_0xb238('0x9')]=function(_0x1d00bd,_0xbf7dc4){return _0x1d00bd['define']('DeskField',attributes,{'tableName':_0xb238('0xa'),'paranoid':![],'indexes':[{'name':_0xb238('0xb'),'fields':['idField',_0xb238('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index 4a77f44..92a4f28 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 _0xc81f=['http','request','then','info','request\x20sent','debug','stringify','error','message','DeskField,\x20%s,\x20%s','result','catch','util','moment','bluebird','rpc'];(function(_0x5ebe29,_0x4df2f1){var _0x5c9d2e=function(_0x31a790){while(--_0x31a790){_0x5ebe29['push'](_0x5ebe29['shift']());}};_0x5c9d2e(++_0x4df2f1);}(_0xc81f,0xcc));var _0xfc81=function(_0x1e3c02,_0x5c07a2){_0x1e3c02=_0x1e3c02-0x0;var _0x4d26d7=_0xc81f[_0x1e3c02];return _0x4d26d7;};'use strict';var _=require('lodash');var util=require(_0xfc81('0x0'));var moment=require(_0xfc81('0x1'));var BPromise=require(_0xfc81('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xfc81('0x3'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xfc81('0x4')]({'port':0x232a});function respondWithRpcPromise(_0x3ca77b,_0xa40dcf,_0x3ac827){return new BPromise(function(_0xfe6459,_0x337f3d){return client[_0xfc81('0x5')](_0x3ca77b,_0x3ac827)[_0xfc81('0x6')](function(_0x2885d1){logger[_0xfc81('0x7')]('DeskField,\x20%s,\x20%s',_0xa40dcf,_0xfc81('0x8'));logger[_0xfc81('0x9')]('DeskField,\x20%s,\x20%s,\x20%s',_0xa40dcf,_0xfc81('0x8'),JSON[_0xfc81('0xa')](_0x2885d1));if(_0x2885d1['error']){if(_0x2885d1['error']['code']===0x1f4){logger[_0xfc81('0xb')]('DeskField,\x20%s,\x20%s',_0xa40dcf,_0x2885d1[_0xfc81('0xb')][_0xfc81('0xc')]);return _0x337f3d(_0x2885d1[_0xfc81('0xb')][_0xfc81('0xc')]);}logger[_0xfc81('0xb')]('DeskField,\x20%s,\x20%s',_0xa40dcf,_0x2885d1['error']['message']);return _0xfe6459(_0x2885d1[_0xfc81('0xb')][_0xfc81('0xc')]);}else{logger['info'](_0xfc81('0xd'),_0xa40dcf,_0xfc81('0x8'));_0xfe6459(_0x2885d1[_0xfc81('0xe')]['message']);}})[_0xfc81('0xf')](function(_0x4b4796){logger[_0xfc81('0xb')]('DeskField,\x20%s,\x20%s',_0xa40dcf,_0x4b4796);_0x337f3d(_0x4b4796);});});} \ No newline at end of file +var _0x96a0=['message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x241b79,_0x54afb0){var _0x284b98=function(_0x27096a){while(--_0x27096a){_0x241b79['push'](_0x241b79['shift']());}};_0x284b98(++_0x54afb0);}(_0x96a0,0x7f));var _0x096a=function(_0x3f7111,_0x3c0988){_0x3f7111=_0x3f7111-0x0;var _0x216d7d=_0x96a0[_0x3f7111];return _0x216d7d;};'use strict';var _=require(_0x096a('0x0'));var util=require(_0x096a('0x1'));var moment=require(_0x096a('0x2'));var BPromise=require(_0x096a('0x3'));var rs=require(_0x096a('0x4'));var fs=require('fs');var Redis=require(_0x096a('0x5'));var db=require(_0x096a('0x6'))['db'];var utils=require(_0x096a('0x7'));var logger=require(_0x096a('0x8'))(_0x096a('0x9'));var config=require('../../config/environment');var jayson=require(_0x096a('0xa'));var client=jayson[_0x096a('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xb98f27,_0x49aba0,_0x49dc70){return new BPromise(function(_0x790048,_0x574dda){return client[_0x096a('0xc')](_0xb98f27,_0x49dc70)['then'](function(_0x581fbc){logger[_0x096a('0xd')](_0x096a('0xe'),_0x49aba0,_0x096a('0xf'));logger[_0x096a('0x10')]('DeskField,\x20%s,\x20%s,\x20%s',_0x49aba0,_0x096a('0xf'),JSON[_0x096a('0x11')](_0x581fbc));if(_0x581fbc[_0x096a('0x12')]){if(_0x581fbc['error'][_0x096a('0x13')]===0x1f4){logger[_0x096a('0x12')](_0x096a('0xe'),_0x49aba0,_0x581fbc[_0x096a('0x12')]['message']);return _0x574dda(_0x581fbc[_0x096a('0x12')]['message']);}logger[_0x096a('0x12')]('DeskField,\x20%s,\x20%s',_0x49aba0,_0x581fbc[_0x096a('0x12')][_0x096a('0x14')]);return _0x790048(_0x581fbc[_0x096a('0x12')][_0x096a('0x14')]);}else{logger[_0x096a('0xd')](_0x096a('0xe'),_0x49aba0,_0x096a('0xf'));_0x790048(_0x581fbc['result'][_0x096a('0x14')]);}})['catch'](function(_0x58c029){logger[_0x096a('0x12')](_0x096a('0xe'),_0x49aba0,_0x58c029);_0x574dda(_0x58c029);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index c31c535..cb4f9f4 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 _0x251c=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0x109d07,_0x493a0f){var _0x549773=function(_0x1010df){while(--_0x1010df){_0x109d07['push'](_0x109d07['shift']());}};_0x549773(++_0x493a0f);}(_0x251c,0xda));var _0xc251=function(_0x8aafef,_0x480732){_0x8aafef=_0x8aafef-0x0;var _0x4b363c=_0x251c[_0x8aafef];return _0x4b363c;};'use strict';var multer=require(_0xc251('0x0'));var util=require(_0xc251('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc251('0x2'));var router=express['Router']();var fs_extra=require(_0xc251('0x3'));var auth=require(_0xc251('0x4'));var interaction=require(_0xc251('0x5'));var config=require(_0xc251('0x6'));var controller=require('./intDynamics365Account.controller');router[_0xc251('0x7')]('/',auth[_0xc251('0x8')](),controller['index']);router[_0xc251('0x7')](_0xc251('0x9'),auth[_0xc251('0x8')](),controller[_0xc251('0xa')]);router[_0xc251('0x7')](_0xc251('0xb'),auth[_0xc251('0x8')](),controller[_0xc251('0xc')]);router[_0xc251('0x7')](_0xc251('0xd'),auth['isAuthenticated'](),controller[_0xc251('0xe')]);router[_0xc251('0xf')]('/',auth[_0xc251('0x8')](),controller[_0xc251('0x10')]);router[_0xc251('0xf')](_0xc251('0xb'),auth[_0xc251('0x8')](),controller['addConfiguration']);router[_0xc251('0x11')]('/:id',auth[_0xc251('0x8')](),controller[_0xc251('0x12')]);router[_0xc251('0x13')](_0xc251('0x9'),auth[_0xc251('0x8')](),controller[_0xc251('0x14')]);module[_0xc251('0x15')]=router; \ No newline at end of file +var _0xd664=['index','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','/:id','destroy','exports','multer','util','express','../../components/auth/service','../../components/interaction/service','get','isAuthenticated'];(function(_0x114555,_0x1a4dde){var _0x78193d=function(_0x1de3a0){while(--_0x1de3a0){_0x114555['push'](_0x114555['shift']());}};_0x78193d(++_0x1a4dde);}(_0xd664,0x99));var _0x4d66=function(_0x2f9a32,_0x23eeef){_0x2f9a32=_0x2f9a32-0x0;var _0x2be5ed=_0xd664[_0x2f9a32];return _0x2be5ed;};'use strict';var multer=require(_0x4d66('0x0'));var util=require(_0x4d66('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4d66('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4d66('0x3'));var interaction=require(_0x4d66('0x4'));var config=require('../../config/environment');var controller=require('./intDynamics365Account.controller');router[_0x4d66('0x5')]('/',auth[_0x4d66('0x6')](),controller[_0x4d66('0x7')]);router[_0x4d66('0x5')]('/:id',auth[_0x4d66('0x6')](),controller['show']);router[_0x4d66('0x5')](_0x4d66('0x8'),auth['isAuthenticated'](),controller[_0x4d66('0x9')]);router[_0x4d66('0x5')](_0x4d66('0xa'),auth[_0x4d66('0x6')](),controller[_0x4d66('0xb')]);router[_0x4d66('0xc')]('/',auth[_0x4d66('0x6')](),controller[_0x4d66('0xd')]);router[_0x4d66('0xc')](_0x4d66('0x8'),auth[_0x4d66('0x6')](),controller[_0x4d66('0xe')]);router[_0x4d66('0xf')]('/:id',auth[_0x4d66('0x6')](),controller[_0x4d66('0x10')]);router['delete'](_0x4d66('0x11'),auth[_0x4d66('0x6')](),controller[_0x4d66('0x12')]);module[_0x4d66('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 55a6a6a..0658d46 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 _0xa751=['BOOLEAN','sequelize','exports','STRING'];(function(_0x3d5351,_0x27bc80){var _0x1db4db=function(_0x3f572b){while(--_0x3f572b){_0x3d5351['push'](_0x3d5351['shift']());}};_0x1db4db(++_0x27bc80);}(_0xa751,0x175));var _0x1a75=function(_0x330a29,_0x560ed5){_0x330a29=_0x330a29-0x0;var _0x19789f=_0xa751[_0x330a29];return _0x19789f;};'use strict';var Sequelize=require(_0x1a75('0x0'));module[_0x1a75('0x1')]={'name':{'type':Sequelize[_0x1a75('0x2')]},'username':{'type':Sequelize[_0x1a75('0x2')]},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x1a75('0x2')]},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x1a75('0x2')]},'clientSecret':{'type':Sequelize[_0x1a75('0x2')]},'serverUrl':{'type':Sequelize[_0x1a75('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0x1a75('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x94ba=['STRING','sequelize','exports'];(function(_0x18a256,_0x348ac9){var _0xaf1b53=function(_0x540075){while(--_0x540075){_0x18a256['push'](_0x18a256['shift']());}};_0xaf1b53(++_0x348ac9);}(_0x94ba,0xbe));var _0xa94b=function(_0x4bbcc1,_0x594e19){_0x4bbcc1=_0x4bbcc1-0x0;var _0x34435b=_0x94ba[_0x4bbcc1];return _0x34435b;};'use strict';var Sequelize=require(_0xa94b('0x0'));module[_0xa94b('0x1')]={'name':{'type':Sequelize[_0xa94b('0x2')]},'username':{'type':Sequelize[_0xa94b('0x2')]},'password':{'type':Sequelize[_0xa94b('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize[_0xa94b('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0xa94b('0x2')]},'serverUrl':{'type':Sequelize[_0xa94b('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index c2b77bf..a5aef8a 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 _0x4559=['statusCode','Wrong\x20credentials','EntityDefinitions(',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','OptionSet','Options','Label','UserLocalizedLabel','Value','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true',')/Microsoft.Dynamics.CRM.','util','../../components/parsers/qs','../../config/logger','api','../../components/integrations/configuration','status','json','offset','undefined','limit','count','Content-Range','update','end','sendStatus','error','stack','name','send','index','Dynamics365Account','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','then','rows','catch','show','params','rawAttributes','include','create','body','find','destroy','getConfigurations','findOne','nolimit','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Field','lastIndexOf','format','ticketType','incident','Incident','PhoneCall','title','description','customerid','ownerid','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidyominame','billedserviceunits','contactidname','contractidname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','kbarticleidname','lastonholdtime','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','password','tenantId','clientId','clientSecret','modernAuthentication','CloudProvider','data5','remoteUri','POST','https://login.microsoftonline.com/','access_token','GET','Bearer\x20','value','MetadataId',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','4.0','remove','LogicalName','forEach','@odata.type','substring','PicklistAttributeMetadata','push','all','isNil','BooleanAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata'];(function(_0xd88919,_0x5b97c5){var _0x551634=function(_0x1b4116){while(--_0x1b4116){_0xd88919['push'](_0xd88919['shift']());}};_0x551634(++_0x5b97c5);}(_0x4559,0x18f));var _0x9455=function(_0x4e05d8,_0xab2ee9){_0x4e05d8=_0x4e05d8-0x0;var _0x356a48=_0x4559[_0x4e05d8];return _0x356a48;};'use strict';var rp=require('request-promise');var util=require(_0x9455('0x0'));var _=require('lodash');var qs=require(_0x9455('0x1'));var logger=require(_0x9455('0x2'))(_0x9455('0x3'));var db=require('../../mysqldb')['db'];var integrations=require(_0x9455('0x4'));function respondWithResult(_0x273a17,_0x591b2d){_0x591b2d=_0x591b2d||0xc8;return function(_0x488045){if(_0x488045){return _0x273a17[_0x9455('0x5')](_0x591b2d)[_0x9455('0x6')](_0x488045);}};}function respondWithFilteredResult(_0x374563,_0x1bfcab){return function(_0x516ba8){if(_0x516ba8){var _0x596ee9=typeof _0x1bfcab[_0x9455('0x7')]===_0x9455('0x8')&&typeof _0x1bfcab[_0x9455('0x9')]===_0x9455('0x8');var _0x1b3235=_0x516ba8[_0x9455('0xa')];var _0x50ede2=_0x596ee9?0x0:_0x1bfcab[_0x9455('0x7')];var _0x3e60d1=_0x596ee9?_0x516ba8['count']:_0x1bfcab['offset']+_0x1bfcab[_0x9455('0x9')];var _0x177334;if(_0x3e60d1>=_0x1b3235){_0x3e60d1=_0x1b3235;_0x177334=0xc8;}else{_0x177334=0xce;}_0x374563[_0x9455('0x5')](_0x177334);return _0x374563['set'](_0x9455('0xb'),_0x50ede2+'-'+_0x3e60d1+'/'+_0x1b3235)[_0x9455('0x6')](_0x516ba8);}return null;};}function saveUpdates(_0x55b7f6){return function(_0xec3dc4){if(_0xec3dc4){return _0xec3dc4[_0x9455('0xc')](_0x55b7f6)['then'](function(_0x1d2967){return _0x1d2967;});}return null;};}function removeEntity(_0x39108b){return function(_0x615f7){if(_0x615f7){return _0x615f7['destroy']()['then'](function(){_0x39108b['status'](0xcc)[_0x9455('0xd')]();});}};}function handleEntityNotFound(_0x5653ef){return function(_0x350d01){if(!_0x350d01){_0x5653ef[_0x9455('0xe')](0x194);}return _0x350d01;};}function handleError(_0x3bf457,_0x38f1e2){_0x38f1e2=_0x38f1e2||0x1f4;return function(_0x42099a){logger[_0x9455('0xf')](_0x42099a[_0x9455('0x10')]);if(_0x42099a[_0x9455('0x11')]){delete _0x42099a[_0x9455('0x11')];}_0x3bf457[_0x9455('0x5')](_0x38f1e2)[_0x9455('0x12')](_0x42099a);};}exports[_0x9455('0x13')]=function(_0x11e2cf,_0x51c416){var _0x192429={},_0x56076e={},_0x2990f4={'count':0x0,'rows':[]};var _0x10132a=_['map'](db[_0x9455('0x14')]['rawAttributes'],function(_0x156203){return{'name':_0x156203[_0x9455('0x15')],'type':_0x156203[_0x9455('0x16')][_0x9455('0x17')]};});_0x56076e['model']=_[_0x9455('0x18')](_0x10132a,_0x9455('0x11'));_0x56076e[_0x9455('0x19')]=_[_0x9455('0x1a')](_0x11e2cf[_0x9455('0x19')]);_0x56076e[_0x9455('0x1b')]=_[_0x9455('0x1c')](_0x56076e[_0x9455('0x1d')],_0x56076e['query']);_0x192429[_0x9455('0x1e')]=_[_0x9455('0x1c')](_0x56076e[_0x9455('0x1d')],qs[_0x9455('0x1f')](_0x11e2cf['query'][_0x9455('0x1f')]));_0x192429[_0x9455('0x1e')]=_0x192429[_0x9455('0x1e')][_0x9455('0x20')]?_0x192429[_0x9455('0x1e')]:_0x56076e['model'];if(!_0x11e2cf[_0x9455('0x19')][_0x9455('0x21')]('nolimit')){_0x192429['limit']=qs[_0x9455('0x9')](_0x11e2cf[_0x9455('0x19')][_0x9455('0x9')]);_0x192429[_0x9455('0x7')]=qs[_0x9455('0x7')](_0x11e2cf['query'][_0x9455('0x7')]);}_0x192429[_0x9455('0x22')]=qs[_0x9455('0x23')](_0x11e2cf['query'][_0x9455('0x23')]);_0x192429[_0x9455('0x24')]=qs[_0x9455('0x1b')](_[_0x9455('0x25')](_0x11e2cf[_0x9455('0x19')],_0x56076e[_0x9455('0x1b')]),_0x10132a);if(_0x11e2cf['query'][_0x9455('0x26')]){_0x192429[_0x9455('0x24')]=_[_0x9455('0x27')](_0x192429[_0x9455('0x24')],{'$or':_[_0x9455('0x18')](_0x10132a,function(_0x5572c9){if(_0x5572c9['type']!==_0x9455('0x28')){var _0x38258d={};_0x38258d[_0x5572c9['name']]={'$like':'%'+_0x11e2cf['query'][_0x9455('0x26')]+'%'};return _0x38258d;}})});}_0x192429=_[_0x9455('0x27')]({},_0x192429,_0x11e2cf[_0x9455('0x29')]);var _0x38c042={'where':_0x192429[_0x9455('0x24')]};return db[_0x9455('0x14')]['count'](_0x38c042)['then'](function(_0x2a16e4){_0x2990f4['count']=_0x2a16e4;if(_0x11e2cf['query'][_0x9455('0x2a')]){_0x192429['include']=[{'all':!![]}];}return db[_0x9455('0x14')][_0x9455('0x2b')](_0x192429);})[_0x9455('0x2c')](function(_0x3b73dc){_0x2990f4[_0x9455('0x2d')]=_0x3b73dc;return _0x2990f4;})[_0x9455('0x2c')](respondWithFilteredResult(_0x51c416,_0x192429))[_0x9455('0x2e')](handleError(_0x51c416,null));};exports[_0x9455('0x2f')]=function(_0x2ae192,_0x332ea9){var _0x54d704={'raw':![],'where':{'id':_0x2ae192[_0x9455('0x30')]['id']}},_0x1b7352={};_0x1b7352[_0x9455('0x1d')]=_[_0x9455('0x1a')](db[_0x9455('0x14')][_0x9455('0x31')]);_0x1b7352[_0x9455('0x19')]=_[_0x9455('0x1a')](_0x2ae192[_0x9455('0x19')]);_0x1b7352[_0x9455('0x1b')]=_[_0x9455('0x1c')](_0x1b7352[_0x9455('0x1d')],_0x1b7352[_0x9455('0x19')]);_0x54d704[_0x9455('0x1e')]=_['intersection'](_0x1b7352[_0x9455('0x1d')],qs[_0x9455('0x1f')](_0x2ae192[_0x9455('0x19')][_0x9455('0x1f')]));_0x54d704['attributes']=_0x54d704['attributes'][_0x9455('0x20')]?_0x54d704[_0x9455('0x1e')]:_0x1b7352[_0x9455('0x1d')];if(_0x2ae192[_0x9455('0x19')][_0x9455('0x2a')]){_0x54d704[_0x9455('0x32')]=[{'all':!![]}];}_0x54d704=_['merge']({},_0x54d704,_0x2ae192[_0x9455('0x29')]);return db[_0x9455('0x14')]['find'](_0x54d704)[_0x9455('0x2c')](handleEntityNotFound(_0x332ea9,null))[_0x9455('0x2c')](respondWithResult(_0x332ea9,null))[_0x9455('0x2e')](handleError(_0x332ea9,null));};exports[_0x9455('0x33')]=function(_0x41e22c,_0x1d24f5){return db[_0x9455('0x14')][_0x9455('0x33')](_0x41e22c[_0x9455('0x34')],{})[_0x9455('0x2c')](respondWithResult(_0x1d24f5,0xc9))[_0x9455('0x2e')](handleError(_0x1d24f5,null));};exports[_0x9455('0xc')]=function(_0x4d48a4,_0x39ea6b){if(_0x4d48a4[_0x9455('0x34')]['id']){delete _0x4d48a4[_0x9455('0x34')]['id'];}return db[_0x9455('0x14')][_0x9455('0x35')]({'where':{'id':_0x4d48a4[_0x9455('0x30')]['id']}})[_0x9455('0x2c')](handleEntityNotFound(_0x39ea6b,null))['then'](saveUpdates(_0x4d48a4[_0x9455('0x34')],null))[_0x9455('0x2c')](respondWithResult(_0x39ea6b,null))[_0x9455('0x2e')](handleError(_0x39ea6b,null));};exports[_0x9455('0x36')]=function(_0x7c0484,_0x5c5116){return db[_0x9455('0x14')][_0x9455('0x35')]({'where':{'id':_0x7c0484['params']['id']}})[_0x9455('0x2c')](handleEntityNotFound(_0x5c5116,null))[_0x9455('0x2c')](removeEntity(_0x5c5116,null))[_0x9455('0x2e')](handleError(_0x5c5116,null));};exports[_0x9455('0x37')]=function(_0x1a6a84,_0x3db93c){var _0x3afa93={};var _0x47aca3={};var _0x3b3cc1;var _0x2b6dd7;return db[_0x9455('0x14')][_0x9455('0x38')]({'where':{'id':_0x1a6a84['params']['id']}})['then'](handleEntityNotFound(_0x3db93c,null))[_0x9455('0x2c')](function(_0x80a348){if(_0x80a348){_0x3b3cc1=_0x80a348;_0x47aca3[_0x9455('0x1d')]=_[_0x9455('0x1a')](db['Dynamics365Configuration'][_0x9455('0x31')]);_0x47aca3['query']=_['keys'](_0x1a6a84['query']);_0x47aca3[_0x9455('0x1b')]=_[_0x9455('0x1c')](_0x47aca3['model'],_0x47aca3[_0x9455('0x19')]);_0x3afa93[_0x9455('0x1e')]=_[_0x9455('0x1c')](_0x47aca3[_0x9455('0x1d')],qs[_0x9455('0x1f')](_0x1a6a84['query'][_0x9455('0x1f')]));_0x3afa93[_0x9455('0x1e')]=_0x3afa93['attributes'][_0x9455('0x20')]?_0x3afa93[_0x9455('0x1e')]:_0x47aca3[_0x9455('0x1d')];_0x3afa93[_0x9455('0x22')]=qs[_0x9455('0x23')](_0x1a6a84[_0x9455('0x19')]['sort']);_0x3afa93[_0x9455('0x24')]=qs['filters'](_['pick'](_0x1a6a84[_0x9455('0x19')],_0x47aca3[_0x9455('0x1b')]));if(_0x1a6a84[_0x9455('0x19')][_0x9455('0x26')]){_0x3afa93['where']=_[_0x9455('0x27')](_0x3afa93['where'],{'$or':_['map'](_0x3afa93['attributes'],function(_0x37a5ff){var _0x524596={};_0x524596[_0x37a5ff]={'$like':'%'+_0x1a6a84['query'][_0x9455('0x26')]+'%'};return _0x524596;})});}_0x3afa93=_[_0x9455('0x27')]({},_0x3afa93,_0x1a6a84[_0x9455('0x29')]);return _0x3b3cc1[_0x9455('0x37')](_0x3afa93);}})[_0x9455('0x2c')](function(_0x2fcad9){if(_0x2fcad9){_0x2b6dd7=_0x2fcad9['length'];if(!_0x1a6a84[_0x9455('0x19')][_0x9455('0x21')](_0x9455('0x39'))){_0x3afa93[_0x9455('0x9')]=qs[_0x9455('0x9')](_0x1a6a84[_0x9455('0x19')][_0x9455('0x9')]);_0x3afa93[_0x9455('0x7')]=qs[_0x9455('0x7')](_0x1a6a84[_0x9455('0x19')][_0x9455('0x7')]);}return _0x3b3cc1['getConfigurations'](_0x3afa93);}})['then'](function(_0x3ac8af){if(_0x3ac8af){return _0x3ac8af?{'count':_0x2b6dd7,'rows':_0x3ac8af}:null;}})[_0x9455('0x2c')](respondWithResult(_0x3db93c,null))[_0x9455('0x2e')](handleError(_0x3db93c,null));};exports['addConfiguration']=function(_0xb75490,_0x4742de){if(_0xb75490[_0x9455('0x34')]['id']){delete _0xb75490[_0x9455('0x34')]['id'];}return db[_0x9455('0x14')][_0x9455('0x38')]({'where':{'id':_0xb75490[_0x9455('0x30')]['id']}})['then'](handleEntityNotFound(_0x4742de,null))['then'](function(_0x3503){if(_0x3503){_0xb75490['body'][_0x9455('0x3a')]=_0x3503['id'];_0xb75490[_0x9455('0x34')][_0x9455('0x3b')]=integrations[_0x9455('0x3c')](_0xb75490[_0x9455('0x34')][_0x9455('0x3d')],_0xb75490['body'][_0x9455('0x16')]);_0xb75490[_0x9455('0x34')][_0x9455('0x3e')]=integrations[_0x9455('0x3f')](_0xb75490[_0x9455('0x34')][_0x9455('0x3d')],_0xb75490[_0x9455('0x34')][_0x9455('0x16')]);return db['Dynamics365Configuration'][_0x9455('0x33')](_0xb75490[_0x9455('0x34')],{'include':[{'model':db[_0x9455('0x40')],'as':_0x9455('0x3b')},{'model':db[_0x9455('0x40')],'as':_0x9455('0x3e')}]});}return null;})[_0x9455('0x2c')](respondWithResult(_0x4742de,null))[_0x9455('0x2e')](handleError(_0x4742de,null));};function sanitizeRemoteUri(_0x1004b0){var _0x44f10a=_0x1004b0['slice'](-0x1);if(_0x44f10a==='/')return _0x1004b0['substring'](0x0,_0x1004b0[_0x9455('0x41')](_0x44f10a));return _0x1004b0;}function getWebApiUrl(_0x9e0ffe){return util[_0x9455('0x42')]('%s/api/data/v9.0/',_0x9e0ffe);}exports['getFields']=function(_0x16bddd,_0xb51ccb){var _0x3c614c=_0x16bddd['query'][_0x9455('0x43')];var _0x56a4bb=_0x3c614c===_0x9455('0x44')?_0x9455('0x45'):_0x9455('0x46');var _0x31aee0='';var _0x24fa3d='';var _0x246cbc='';var _0x22adc7='';var _0x4b7194='';var _0x1ff15c='';var _0x32d479='';var _0x162069='';var _0x3d6200=[_0x9455('0x47'),_0x9455('0x48'),_0x9455('0x49'),_0x9455('0x4a'),'caseorigincode',_0x9455('0x4b'),_0x9455('0x4c'),_0x9455('0x4d'),_0x9455('0x4e'),_0x9455('0x4f')];var _0x4fd26e=['accountidname',_0x9455('0x50'),'actualserviceunits',_0x9455('0x51'),_0x9455('0x52'),'contactidyominame','contractdetailidname',_0x9455('0x53'),'createdbyexternalpartyname',_0x9455('0x54'),_0x9455('0x55'),_0x9455('0x56'),_0x9455('0x57'),_0x9455('0x58'),'createdonbehalfbyyominame',_0x9455('0x59'),_0x9455('0x5a'),_0x9455('0x5b'),_0x9455('0x5c'),_0x9455('0x5d'),'entityimage_timestamp',_0x9455('0x5e'),_0x9455('0x5f'),_0x9455('0x60'),_0x9455('0x61'),_0x9455('0x62'),_0x9455('0x63'),'influencescore',_0x9455('0x64'),_0x9455('0x65'),'masteridname',_0x9455('0x66'),_0x9455('0x67'),'modifiedbyname',_0x9455('0x68'),_0x9455('0x69'),_0x9455('0x6a'),_0x9455('0x6b'),_0x9455('0x6c'),_0x9455('0x6d'),_0x9455('0x6e'),_0x9455('0x6f'),_0x9455('0x70'),_0x9455('0x71'),_0x9455('0x72'),_0x9455('0x73'),_0x9455('0x74'),_0x9455('0x75'),_0x9455('0x76'),_0x9455('0x77'),_0x9455('0x78'),_0x9455('0x79'),_0x9455('0x7a'),_0x9455('0x7b'),_0x9455('0x7c'),_0x9455('0x7d'),_0x9455('0x7e'),_0x9455('0x7f'),_0x9455('0x80'),_0x9455('0x81'),_0x9455('0x82'),'statecode',_0x9455('0x83'),_0x9455('0x84'),_0x9455('0x85'),_0x9455('0x86'),_0x9455('0x87'),_0x9455('0x88'),_0x9455('0x89'),_0x9455('0x8a')];var _0x50c2b3=_0x3d6200[_0x9455('0x8b')](_0x4fd26e);return db['Dynamics365Account']['findOne']({'where':{'id':_0x16bddd[_0x9455('0x30')]['id']},'attributes':['id',_0x9455('0x8c'),_0x9455('0x8d'),'remoteUri',_0x9455('0x8e'),_0x9455('0x8f'),_0x9455('0x90'),_0x9455('0x91')],'include':[{'model':db['CloudProvider'],'as':_0x9455('0x92'),'attributes':['id','data5','data7']}]})['then'](handleEntityNotFound(_0xb51ccb,null))[_0x9455('0x2c')](function(_0x5043de){if(_0x5043de){if(_0x5043de[_0x9455('0x91')]){_0x5043de['access_token']=_0x5043de[_0x9455('0x92')][_0x9455('0x93')];_0x162069=sanitizeRemoteUri(_0x5043de[_0x9455('0x92')]['data7']);_0x32d479=getWebApiUrl(_0x162069);return _0x5043de;}_0x162069=sanitizeRemoteUri(_0x5043de[_0x9455('0x94')]);_0x32d479=getWebApiUrl(_0x162069);var _0x59e58b={'method':_0x9455('0x95'),'uri':_0x9455('0x96')+_0x5043de[_0x9455('0x8e')]+'/oauth2/token','form':{'client_id':_0x5043de[_0x9455('0x8f')],'resource':_0x162069,'username':_0x5043de[_0x9455('0x8c')],'password':_0x5043de['password'],'grant_type':_0x9455('0x8d'),'client_secret':_0x5043de[_0x9455('0x90')]},'json':!![]};return rp(_0x59e58b);}})['then'](function(_0x247aa5){_0x1ff15c=_0x247aa5[_0x9455('0x97')];var _0x599f05={'method':_0x9455('0x98'),'uri':encodeURI(_0x32d479+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x56a4bb+'\x27'),'headers':{'Authorization':_0x9455('0x99')+_0x1ff15c,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x599f05);})['then'](function(_0xa15dd){var _0x1e9c65=_0xa15dd[_0x9455('0x9a')][0x0];var _0x5e656c=_0x1e9c65[_0x9455('0x9b')];var _0x59be8f={'method':_0x9455('0x98'),'uri':_0x32d479+'EntityDefinitions('+_0x5e656c+_0x9455('0x9c'),'headers':{'Authorization':_0x9455('0x99')+_0x1ff15c,'If-None-Match':null,'OData-Version':_0x9455('0x9d')},'json':!![]};return rp(_0x59be8f);})[_0x9455('0x2c')](function(_0x1f9042){_0x31aee0=_0x1f9042;_0x24fa3d=_0x31aee0['Attributes'];_0x24fa3d=_[_0x9455('0x9e')](_0x24fa3d,function(_0x2b6427){return!_0x50c2b3['includes'](_0x2b6427[_0x9455('0x9f')]);});var _0x53c12f=[];var _0x2da685=[];_0x24fa3d[_0x9455('0xa0')](function(_0x29eed7){if(_0x29eed7[_0x9455('0xa1')]){var _0x558f16=_0x29eed7[_0x9455('0xa1')][_0x9455('0xa2')](_0x29eed7[_0x9455('0xa1')][_0x9455('0x41')]('.')+0x1);if(_0x558f16===_0x9455('0xa3')){_0x53c12f[_0x9455('0xa4')](getSelectList(_0x32d479,_0x3c614c,_0x2da685,_0x31aee0['MetadataId'],_0x29eed7[_0x9455('0x9b')],_0x1ff15c));}}});return Promise[_0x9455('0xa5')](_0x53c12f);})[_0x9455('0x2c')](function(_0x185a8a){_0x246cbc=_0x185a8a[0x0];var _0x4d2b70=[];var _0x23afc7=[];_0x24fa3d[_0x9455('0xa0')](function(_0x1f22a3){if(!_[_0x9455('0xa6')](_0x1f22a3[_0x9455('0xa1')])){var _0x48181e=_0x1f22a3[_0x9455('0xa1')][_0x9455('0xa2')](_0x1f22a3[_0x9455('0xa1')][_0x9455('0x41')]('.')+0x1);if(_0x48181e===_0x9455('0xa7')){_0x4d2b70['push'](getBooleanList(_0x32d479,_0x3c614c,_0x23afc7,_0x31aee0['MetadataId'],_0x1f22a3[_0x9455('0x9b')],_0x1ff15c));}}});return Promise['all'](_0x4d2b70);})[_0x9455('0x2c')](function(_0x4e4cfa){_0x22adc7=_0x4e4cfa[0x0];var _0x111bdb=[];var _0x2eb5bb=[];_0x24fa3d[_0x9455('0xa0')](function(_0x249f1b){if(_0x249f1b[_0x9455('0xa1')]){var _0x4eebab=_0x249f1b[_0x9455('0xa1')][_0x9455('0xa2')](_0x249f1b[_0x9455('0xa1')][_0x9455('0x41')]('.')+0x1);if(_0x4eebab==='StringAttributeMetadata'||_0x4eebab===_0x9455('0xa8')||_0x4eebab===_0x9455('0xa9')||_0x4eebab===_0x9455('0xaa')||_0x4eebab===_0x9455('0xab')||_0x4eebab===_0x9455('0xac')||_0x4eebab===_0x9455('0xad')||_0x4eebab===_0x9455('0xae')||_0x4eebab===_0x9455('0xaf')||_0x4eebab===_0x9455('0xb0')){_0x111bdb[_0x9455('0xa4')](getInputList(_0x32d479,_0x3c614c,_0x4eebab,_0x2eb5bb,_0x31aee0[_0x9455('0x9b')],_0x249f1b[_0x9455('0x9b')],_0x1ff15c));}}});return Promise['all'](_0x111bdb);})[_0x9455('0x2c')](function(_0x4990ff){_0x4b7194=_0x4990ff[0x0];var _0x2189fe=_0x246cbc['concat'](_0x22adc7)[_0x9455('0x8b')](_0x4b7194);var _0x366026={'count':_0x2189fe['length'],'rows':_0x2189fe};return _0x366026;})['then'](respondWithResult(_0xb51ccb,null))['catch'](function(_0x20f504){var _0x2e7701=_0x16bddd[_0x9455('0x19')]['test']?0x1f4:_0x20f504[_0x9455('0xb1')]||0x1f4;logger[_0x9455('0xf')](_0x20f504[_0x9455('0x10')]);delete _0x20f504[_0x9455('0x11')];if(_0x2e7701===0x191){_0x2e7701=0x190;}_0xb51ccb[_0x9455('0x5')](_0x2e7701)['send'](_0x16bddd[_0x9455('0x19')]['test']?{'message':_0x9455('0xb2'),'statusCode':_0x20f504['statusCode']}:_0x20f504);});};function getSelectList(_0x468f25,_0x598130,_0x3b7d4f,_0x516799,_0x82ec04,_0x2100d4){var _0x2e2393={'method':_0x9455('0x98'),'uri':_0x468f25+_0x9455('0xb3')+_0x516799+_0x9455('0xb4')+_0x82ec04+_0x9455('0xb5')+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':'Bearer\x20'+_0x2100d4,'If-None-Match':null,'OData-Version':_0x9455('0x9d')},'json':!![]};return rp(_0x2e2393)[_0x9455('0x2c')](function(_0x192837){var _0x77d2f7=[];var _0x46f0b8=_0x192837[_0x9455('0xb6')][_0x9455('0xb7')];_0x46f0b8[_0x9455('0xa0')](function(_0x3ece36){_0x77d2f7[_0x9455('0xa4')]({'name':_0x3ece36[_0x9455('0xb8')][_0x9455('0xb9')][_0x9455('0xb8')],'value':String(_0x3ece36[_0x9455('0xba')])});});var _0x2d6d42={'id':_0x598130+'_'+_0x192837[_0x9455('0x9f')],'name':_0x192837[_0x9455('0xbb')]['UserLocalizedLabel'][_0x9455('0xb8')],'custom':![],'options':_0x77d2f7};_0x3b7d4f['push'](_0x2d6d42);return _0x3b7d4f;});}function getBooleanList(_0x15639b,_0x268bbc,_0x42b0bb,_0x30c3c5,_0xa9d15c,_0xce79a){var _0x5932f0={'method':'GET','uri':_0x15639b+_0x9455('0xb3')+_0x30c3c5+_0x9455('0xb4')+_0xa9d15c+_0x9455('0xbc'),'headers':{'Authorization':_0x9455('0x99')+_0xce79a,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x5932f0)['then'](function(_0x49c960){var _0x3b4dd5=[];_0x3b4dd5[_0x9455('0xa4')]({'name':_0x49c960[_0x9455('0xb6')][_0x9455('0xbd')][_0x9455('0xb8')][_0x9455('0xb9')][_0x9455('0xb8')],'value':_0x9455('0xbe')},{'name':_0x49c960[_0x9455('0xb6')]['FalseOption']['Label'][_0x9455('0xb9')]['Label'],'value':'false'});var _0x51eb39={'id':_0x268bbc+'_'+_0x49c960['LogicalName'],'name':_0x49c960['DisplayName'][_0x9455('0xb9')][_0x9455('0xb8')],'custom':![],'options':_0x3b4dd5};_0x42b0bb[_0x9455('0xa4')](_0x51eb39);return _0x42b0bb;});}function getInputList(_0xfcf668,_0x34282f,_0x2af322,_0x4ee9f6,_0x108cf5,_0x3dd364,_0x2d1e91){var _0x11e9cb={'method':_0x9455('0x98'),'uri':_0xfcf668+_0x9455('0xb3')+_0x108cf5+_0x9455('0xb4')+_0x3dd364+_0x9455('0xbf')+_0x2af322+'?$select=DisplayName,LogicalName','headers':{'Authorization':_0x9455('0x99')+_0x2d1e91,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x11e9cb)[_0x9455('0x2c')](function(_0x25cb96){var _0x257849={'id':_0x34282f+'_'+_0x25cb96[_0x9455('0x9f')],'name':_0x25cb96[_0x9455('0xbb')][_0x9455('0xb9')]?_0x25cb96['DisplayName']['UserLocalizedLabel'][_0x9455('0xb8')]:_0x25cb96['LogicalName'],'custom':![],'options':[]};_0x4ee9f6['push'](_0x257849);return _0x4ee9f6;});} \ No newline at end of file +var _0x5f7a=['catch','show','params','length','includeAll','find','create','destroy','findOne','Dynamics365Configuration','order','getConfigurations','addConfiguration','body','Subjects','getSubjects','getDescriptions','channel','Dynamics365Field','slice','substring','lastIndexOf','%s/api/data/v9.0/','getFields','ticketType','incident','Incident','PhoneCall','customerid','ownerid','subject','regardingobjectid','directioncode','phonecall_activity_parties','actualserviceunits','billedserviceunits','contactidname','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','modifiedbyexternalpartyyominame','modifiedbyyominame','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','parentcaseidname','primarycontactidname','productidname','productserialnumber','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','statecode','transactioncurrencyidname','utcconversiontimezonecode','versionnumber','username','password','clientSecret','modernAuthentication','CloudProvider','data7','access_token','data5','remoteUri','POST','https://login.microsoftonline.com/','tenantId','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','EntityDefinitions(','Attributes','remove','LogicalName','@odata.type','PicklistAttributeMetadata','push','MetadataId','all','forEach','StringAttributeMetadata','DoubleAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','DecimalAttributeMetadata','concat','statusCode','test','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','Value','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','util','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined','limit','count','Content-Range','update','then','end','sendStatus','error','stack','name','send','index','map','Dynamics365Account','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','pick','where','merge','VIRTUAL','filter','findAll','rows'];(function(_0x1d057f,_0x1b492e){var _0x2b697c=function(_0x3604fd){while(--_0x3604fd){_0x1d057f['push'](_0x1d057f['shift']());}};_0x2b697c(++_0x1b492e);}(_0x5f7a,0x88));var _0xa5f7=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x5f7a[_0x1035c1];return _0x308d67;};'use strict';var rp=require(_0xa5f7('0x0'));var util=require(_0xa5f7('0x1'));var _=require(_0xa5f7('0x2'));var qs=require(_0xa5f7('0x3'));var logger=require(_0xa5f7('0x4'))(_0xa5f7('0x5'));var db=require(_0xa5f7('0x6'))['db'];var integrations=require(_0xa5f7('0x7'));function respondWithResult(_0xb197a0,_0x3526dc){_0x3526dc=_0x3526dc||0xc8;return function(_0x58266b){if(_0x58266b){return _0xb197a0[_0xa5f7('0x8')](_0x3526dc)[_0xa5f7('0x9')](_0x58266b);}};}function respondWithFilteredResult(_0x314571,_0x2103e7){return function(_0x1cdab3){if(_0x1cdab3){var _0x520f9c=typeof _0x2103e7[_0xa5f7('0xa')]===_0xa5f7('0xb')&&typeof _0x2103e7[_0xa5f7('0xc')]===_0xa5f7('0xb');var _0x4849f9=_0x1cdab3['count'];var _0x543574=_0x520f9c?0x0:_0x2103e7['offset'];var _0x47c9b8=_0x520f9c?_0x1cdab3[_0xa5f7('0xd')]:_0x2103e7[_0xa5f7('0xa')]+_0x2103e7[_0xa5f7('0xc')];var _0x59625e;if(_0x47c9b8>=_0x4849f9){_0x47c9b8=_0x4849f9;_0x59625e=0xc8;}else{_0x59625e=0xce;}_0x314571['status'](_0x59625e);return _0x314571['set'](_0xa5f7('0xe'),_0x543574+'-'+_0x47c9b8+'/'+_0x4849f9)[_0xa5f7('0x9')](_0x1cdab3);}return null;};}function saveUpdates(_0x5c798e){return function(_0x401e6f){if(_0x401e6f){return _0x401e6f[_0xa5f7('0xf')](_0x5c798e)['then'](function(_0x531ffb){return _0x531ffb;});}return null;};}function removeEntity(_0x453166){return function(_0x5c80e2){if(_0x5c80e2){return _0x5c80e2['destroy']()[_0xa5f7('0x10')](function(){_0x453166[_0xa5f7('0x8')](0xcc)[_0xa5f7('0x11')]();});}};}function handleEntityNotFound(_0x4f2c58){return function(_0x4ed0c6){if(!_0x4ed0c6){_0x4f2c58[_0xa5f7('0x12')](0x194);}return _0x4ed0c6;};}function handleError(_0x31d703,_0xd18873){_0xd18873=_0xd18873||0x1f4;return function(_0x46c892){logger[_0xa5f7('0x13')](_0x46c892[_0xa5f7('0x14')]);if(_0x46c892[_0xa5f7('0x15')]){delete _0x46c892[_0xa5f7('0x15')];}_0x31d703[_0xa5f7('0x8')](_0xd18873)[_0xa5f7('0x16')](_0x46c892);};}exports[_0xa5f7('0x17')]=function(_0x22b8cf,_0x4a8a4b){var _0x8ac4b0={},_0x50250c={},_0x2d4dae={'count':0x0,'rows':[]};var _0x2df60e=_[_0xa5f7('0x18')](db[_0xa5f7('0x19')][_0xa5f7('0x1a')],function(_0x3457e8){return{'name':_0x3457e8['fieldName'],'type':_0x3457e8[_0xa5f7('0x1b')][_0xa5f7('0x1c')]};});_0x50250c['model']=_[_0xa5f7('0x18')](_0x2df60e,_0xa5f7('0x15'));_0x50250c[_0xa5f7('0x1d')]=_[_0xa5f7('0x1e')](_0x22b8cf[_0xa5f7('0x1d')]);_0x50250c[_0xa5f7('0x1f')]=_[_0xa5f7('0x20')](_0x50250c[_0xa5f7('0x21')],_0x50250c[_0xa5f7('0x1d')]);_0x8ac4b0[_0xa5f7('0x22')]=_['intersection'](_0x50250c[_0xa5f7('0x21')],qs[_0xa5f7('0x23')](_0x22b8cf[_0xa5f7('0x1d')]['fields']));_0x8ac4b0[_0xa5f7('0x22')]=_0x8ac4b0[_0xa5f7('0x22')]['length']?_0x8ac4b0[_0xa5f7('0x22')]:_0x50250c[_0xa5f7('0x21')];if(!_0x22b8cf['query'][_0xa5f7('0x24')](_0xa5f7('0x25'))){_0x8ac4b0[_0xa5f7('0xc')]=qs[_0xa5f7('0xc')](_0x22b8cf['query'][_0xa5f7('0xc')]);_0x8ac4b0[_0xa5f7('0xa')]=qs[_0xa5f7('0xa')](_0x22b8cf[_0xa5f7('0x1d')][_0xa5f7('0xa')]);}_0x8ac4b0['order']=qs[_0xa5f7('0x26')](_0x22b8cf['query']['sort']);_0x8ac4b0['where']=qs['filters'](_[_0xa5f7('0x27')](_0x22b8cf[_0xa5f7('0x1d')],_0x50250c[_0xa5f7('0x1f')]),_0x2df60e);if(_0x22b8cf[_0xa5f7('0x1d')]['filter']){_0x8ac4b0[_0xa5f7('0x28')]=_[_0xa5f7('0x29')](_0x8ac4b0[_0xa5f7('0x28')],{'$or':_[_0xa5f7('0x18')](_0x2df60e,function(_0x402ae7){if(_0x402ae7[_0xa5f7('0x1b')]!==_0xa5f7('0x2a')){var _0x3bcfb6={};_0x3bcfb6[_0x402ae7[_0xa5f7('0x15')]]={'$like':'%'+_0x22b8cf['query'][_0xa5f7('0x2b')]+'%'};return _0x3bcfb6;}})});}_0x8ac4b0=_[_0xa5f7('0x29')]({},_0x8ac4b0,_0x22b8cf['options']);var _0x12e66d={'where':_0x8ac4b0[_0xa5f7('0x28')]};return db['Dynamics365Account'][_0xa5f7('0xd')](_0x12e66d)[_0xa5f7('0x10')](function(_0x396737){_0x2d4dae[_0xa5f7('0xd')]=_0x396737;if(_0x22b8cf['query']['includeAll']){_0x8ac4b0['include']=[{'all':!![]}];}return db[_0xa5f7('0x19')][_0xa5f7('0x2c')](_0x8ac4b0);})[_0xa5f7('0x10')](function(_0x369451){_0x2d4dae[_0xa5f7('0x2d')]=_0x369451;return _0x2d4dae;})[_0xa5f7('0x10')](respondWithFilteredResult(_0x4a8a4b,_0x8ac4b0))[_0xa5f7('0x2e')](handleError(_0x4a8a4b,null));};exports[_0xa5f7('0x2f')]=function(_0x4ef320,_0x1260f2){var _0x51ea70={'raw':![],'where':{'id':_0x4ef320[_0xa5f7('0x30')]['id']}},_0x3b850e={};_0x3b850e[_0xa5f7('0x21')]=_[_0xa5f7('0x1e')](db[_0xa5f7('0x19')][_0xa5f7('0x1a')]);_0x3b850e['query']=_[_0xa5f7('0x1e')](_0x4ef320[_0xa5f7('0x1d')]);_0x3b850e[_0xa5f7('0x1f')]=_[_0xa5f7('0x20')](_0x3b850e[_0xa5f7('0x21')],_0x3b850e[_0xa5f7('0x1d')]);_0x51ea70[_0xa5f7('0x22')]=_['intersection'](_0x3b850e[_0xa5f7('0x21')],qs[_0xa5f7('0x23')](_0x4ef320[_0xa5f7('0x1d')][_0xa5f7('0x23')]));_0x51ea70['attributes']=_0x51ea70['attributes'][_0xa5f7('0x31')]?_0x51ea70['attributes']:_0x3b850e[_0xa5f7('0x21')];if(_0x4ef320['query'][_0xa5f7('0x32')]){_0x51ea70['include']=[{'all':!![]}];}_0x51ea70=_[_0xa5f7('0x29')]({},_0x51ea70,_0x4ef320['options']);return db[_0xa5f7('0x19')][_0xa5f7('0x33')](_0x51ea70)[_0xa5f7('0x10')](handleEntityNotFound(_0x1260f2,null))[_0xa5f7('0x10')](respondWithResult(_0x1260f2,null))[_0xa5f7('0x2e')](handleError(_0x1260f2,null));};exports[_0xa5f7('0x34')]=function(_0x1114b1,_0x3c7476){return db[_0xa5f7('0x19')]['create'](_0x1114b1['body'],{})[_0xa5f7('0x10')](respondWithResult(_0x3c7476,0xc9))[_0xa5f7('0x2e')](handleError(_0x3c7476,null));};exports[_0xa5f7('0xf')]=function(_0x1dbd45,_0x3236fa){if(_0x1dbd45['body']['id']){delete _0x1dbd45['body']['id'];}return db['Dynamics365Account'][_0xa5f7('0x33')]({'where':{'id':_0x1dbd45[_0xa5f7('0x30')]['id']}})[_0xa5f7('0x10')](handleEntityNotFound(_0x3236fa,null))[_0xa5f7('0x10')](saveUpdates(_0x1dbd45['body'],null))[_0xa5f7('0x10')](respondWithResult(_0x3236fa,null))[_0xa5f7('0x2e')](handleError(_0x3236fa,null));};exports[_0xa5f7('0x35')]=function(_0x4bd0c0,_0x376145){return db[_0xa5f7('0x19')][_0xa5f7('0x33')]({'where':{'id':_0x4bd0c0[_0xa5f7('0x30')]['id']}})[_0xa5f7('0x10')](handleEntityNotFound(_0x376145,null))[_0xa5f7('0x10')](removeEntity(_0x376145,null))[_0xa5f7('0x2e')](handleError(_0x376145,null));};exports['getConfigurations']=function(_0x9025ff,_0x458b15){var _0x642cb4={};var _0x3c843d={};var _0x4de65a;var _0x5ef215;return db['Dynamics365Account'][_0xa5f7('0x36')]({'where':{'id':_0x9025ff[_0xa5f7('0x30')]['id']}})[_0xa5f7('0x10')](handleEntityNotFound(_0x458b15,null))[_0xa5f7('0x10')](function(_0x430146){if(_0x430146){_0x4de65a=_0x430146;_0x3c843d[_0xa5f7('0x21')]=_[_0xa5f7('0x1e')](db[_0xa5f7('0x37')][_0xa5f7('0x1a')]);_0x3c843d[_0xa5f7('0x1d')]=_[_0xa5f7('0x1e')](_0x9025ff[_0xa5f7('0x1d')]);_0x3c843d[_0xa5f7('0x1f')]=_['intersection'](_0x3c843d[_0xa5f7('0x21')],_0x3c843d[_0xa5f7('0x1d')]);_0x642cb4[_0xa5f7('0x22')]=_[_0xa5f7('0x20')](_0x3c843d[_0xa5f7('0x21')],qs['fields'](_0x9025ff[_0xa5f7('0x1d')][_0xa5f7('0x23')]));_0x642cb4[_0xa5f7('0x22')]=_0x642cb4[_0xa5f7('0x22')][_0xa5f7('0x31')]?_0x642cb4['attributes']:_0x3c843d[_0xa5f7('0x21')];_0x642cb4[_0xa5f7('0x38')]=qs['sort'](_0x9025ff[_0xa5f7('0x1d')][_0xa5f7('0x26')]);_0x642cb4[_0xa5f7('0x28')]=qs[_0xa5f7('0x1f')](_['pick'](_0x9025ff[_0xa5f7('0x1d')],_0x3c843d[_0xa5f7('0x1f')]));if(_0x9025ff['query'][_0xa5f7('0x2b')]){_0x642cb4[_0xa5f7('0x28')]=_['merge'](_0x642cb4[_0xa5f7('0x28')],{'$or':_[_0xa5f7('0x18')](_0x642cb4[_0xa5f7('0x22')],function(_0x44cbd0){var _0x2600cd={};_0x2600cd[_0x44cbd0]={'$like':'%'+_0x9025ff[_0xa5f7('0x1d')][_0xa5f7('0x2b')]+'%'};return _0x2600cd;})});}_0x642cb4=_['merge']({},_0x642cb4,_0x9025ff['options']);return _0x4de65a[_0xa5f7('0x39')](_0x642cb4);}})[_0xa5f7('0x10')](function(_0x4229d6){if(_0x4229d6){_0x5ef215=_0x4229d6[_0xa5f7('0x31')];if(!_0x9025ff[_0xa5f7('0x1d')][_0xa5f7('0x24')](_0xa5f7('0x25'))){_0x642cb4[_0xa5f7('0xc')]=qs['limit'](_0x9025ff['query'][_0xa5f7('0xc')]);_0x642cb4['offset']=qs[_0xa5f7('0xa')](_0x9025ff[_0xa5f7('0x1d')][_0xa5f7('0xa')]);}return _0x4de65a['getConfigurations'](_0x642cb4);}})[_0xa5f7('0x10')](function(_0xe8553f){if(_0xe8553f){return _0xe8553f?{'count':_0x5ef215,'rows':_0xe8553f}:null;}})['then'](respondWithResult(_0x458b15,null))['catch'](handleError(_0x458b15,null));};exports[_0xa5f7('0x3a')]=function(_0x3add93,_0x45f0e8){if(_0x3add93['body']['id']){delete _0x3add93[_0xa5f7('0x3b')]['id'];}return db[_0xa5f7('0x19')][_0xa5f7('0x36')]({'where':{'id':_0x3add93[_0xa5f7('0x30')]['id']}})[_0xa5f7('0x10')](handleEntityNotFound(_0x45f0e8,null))[_0xa5f7('0x10')](function(_0x565062){if(_0x565062){_0x3add93[_0xa5f7('0x3b')]['AccountId']=_0x565062['id'];_0x3add93[_0xa5f7('0x3b')][_0xa5f7('0x3c')]=integrations[_0xa5f7('0x3d')](_0x3add93['body']['channel'],_0x3add93[_0xa5f7('0x3b')][_0xa5f7('0x1b')]);_0x3add93[_0xa5f7('0x3b')]['Descriptions']=integrations[_0xa5f7('0x3e')](_0x3add93['body'][_0xa5f7('0x3f')],_0x3add93[_0xa5f7('0x3b')][_0xa5f7('0x1b')]);return db[_0xa5f7('0x37')][_0xa5f7('0x34')](_0x3add93[_0xa5f7('0x3b')],{'include':[{'model':db[_0xa5f7('0x40')],'as':'Subjects'},{'model':db['Dynamics365Field'],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x45f0e8,null))[_0xa5f7('0x2e')](handleError(_0x45f0e8,null));};function sanitizeRemoteUri(_0x2eaa2c){var _0x5d0c80=_0x2eaa2c[_0xa5f7('0x41')](-0x1);if(_0x5d0c80==='/')return _0x2eaa2c[_0xa5f7('0x42')](0x0,_0x2eaa2c[_0xa5f7('0x43')](_0x5d0c80));return _0x2eaa2c;}function getWebApiUrl(_0x2b2d50){return util['format'](_0xa5f7('0x44'),_0x2b2d50);}exports[_0xa5f7('0x45')]=function(_0x35b928,_0x15bff9){var _0x55d4e4=_0x35b928[_0xa5f7('0x1d')][_0xa5f7('0x46')];var _0x275242=_0x55d4e4===_0xa5f7('0x47')?_0xa5f7('0x48'):_0xa5f7('0x49');var _0x1b5fcc='';var _0x79bf06='';var _0x124d99='';var _0x2e6a7c='';var _0xa72fe0='';var _0x5b558a='';var _0x183fc4='';var _0x37c22d='';var _0x37bbfd=['title','description',_0xa5f7('0x4a'),_0xa5f7('0x4b'),'caseorigincode',_0xa5f7('0x4c'),'phonenumber',_0xa5f7('0x4d'),_0xa5f7('0x4e'),_0xa5f7('0x4f')];var _0x4b34da=['accountidname','accountidyominame',_0xa5f7('0x50'),_0xa5f7('0x51'),_0xa5f7('0x52'),'contactidyominame',_0xa5f7('0x53'),_0xa5f7('0x54'),_0xa5f7('0x55'),_0xa5f7('0x56'),_0xa5f7('0x57'),_0xa5f7('0x58'),_0xa5f7('0x59'),'createdonbehalfbyname','createdonbehalfbyyominame',_0xa5f7('0x5a'),_0xa5f7('0x5b'),_0xa5f7('0x5c'),_0xa5f7('0x5d'),_0xa5f7('0x5e'),_0xa5f7('0x5f'),_0xa5f7('0x60'),'escalatedon',_0xa5f7('0x61'),_0xa5f7('0x62'),_0xa5f7('0x63'),_0xa5f7('0x64'),_0xa5f7('0x65'),_0xa5f7('0x66'),_0xa5f7('0x67'),'masteridname','modifiedbyexternalpartyname',_0xa5f7('0x68'),'modifiedbyname',_0xa5f7('0x69'),'modifiedon',_0xa5f7('0x6a'),_0xa5f7('0x6b'),_0xa5f7('0x6c'),_0xa5f7('0x6d'),_0xa5f7('0x6e'),_0xa5f7('0x6f'),_0xa5f7('0x70'),_0xa5f7('0x71'),_0xa5f7('0x72'),'owneridyominame',_0xa5f7('0x73'),_0xa5f7('0x74'),'primarycontactidyominame','prioritycodename',_0xa5f7('0x75'),_0xa5f7('0x76'),'resolveby',_0xa5f7('0x77'),_0xa5f7('0x78'),_0xa5f7('0x79'),_0xa5f7('0x7a'),_0xa5f7('0x7b'),_0xa5f7('0x7c'),_0xa5f7('0x7d'),'socialprofileidname',_0xa5f7('0x7e'),'statuscode','subjectidname','ticketnumber','timezoneruleversionnumber',_0xa5f7('0x7f'),'traversedpath',_0xa5f7('0x80'),_0xa5f7('0x81')];var _0x31362e=_0x37bbfd['concat'](_0x4b34da);return db[_0xa5f7('0x19')][_0xa5f7('0x36')]({'where':{'id':_0x35b928['params']['id']},'attributes':['id',_0xa5f7('0x82'),_0xa5f7('0x83'),'remoteUri','tenantId','clientId',_0xa5f7('0x84'),_0xa5f7('0x85')],'include':[{'model':db[_0xa5f7('0x86')],'as':_0xa5f7('0x86'),'attributes':['id','data5',_0xa5f7('0x87')]}]})['then'](handleEntityNotFound(_0x15bff9,null))[_0xa5f7('0x10')](function(_0x2e9f4c){if(_0x2e9f4c){if(_0x2e9f4c['modernAuthentication']){_0x2e9f4c[_0xa5f7('0x88')]=_0x2e9f4c[_0xa5f7('0x86')][_0xa5f7('0x89')];_0x37c22d=sanitizeRemoteUri(_0x2e9f4c[_0xa5f7('0x86')][_0xa5f7('0x87')]);_0x183fc4=getWebApiUrl(_0x37c22d);return _0x2e9f4c;}_0x37c22d=sanitizeRemoteUri(_0x2e9f4c[_0xa5f7('0x8a')]);_0x183fc4=getWebApiUrl(_0x37c22d);var _0x5e8a28={'method':_0xa5f7('0x8b'),'uri':_0xa5f7('0x8c')+_0x2e9f4c[_0xa5f7('0x8d')]+'/oauth2/token','form':{'client_id':_0x2e9f4c['clientId'],'resource':_0x37c22d,'username':_0x2e9f4c[_0xa5f7('0x82')],'password':_0x2e9f4c[_0xa5f7('0x83')],'grant_type':'password','client_secret':_0x2e9f4c['clientSecret']},'json':!![]};return rp(_0x5e8a28);}})[_0xa5f7('0x10')](function(_0xde39d9){_0x5b558a=_0xde39d9[_0xa5f7('0x88')];var _0xe5b315={'method':_0xa5f7('0x8e'),'uri':encodeURI(_0x183fc4+_0xa5f7('0x8f')+_0x275242+'\x27'),'headers':{'Authorization':_0xa5f7('0x90')+_0x5b558a,'If-None-Match':null,'OData-Version':_0xa5f7('0x91')},'json':!![]};return rp(_0xe5b315);})[_0xa5f7('0x10')](function(_0x3d5a18){var _0x536875=_0x3d5a18['value'][0x0];var _0x219492=_0x536875['MetadataId'];var _0x1abebc={'method':_0xa5f7('0x8e'),'uri':_0x183fc4+_0xa5f7('0x92')+_0x219492+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0xa5f7('0x90')+_0x5b558a,'If-None-Match':null,'OData-Version':_0xa5f7('0x91')},'json':!![]};return rp(_0x1abebc);})[_0xa5f7('0x10')](function(_0x18a3b5){_0x1b5fcc=_0x18a3b5;_0x79bf06=_0x1b5fcc[_0xa5f7('0x93')];_0x79bf06=_[_0xa5f7('0x94')](_0x79bf06,function(_0x3689d2){return!_0x31362e['includes'](_0x3689d2[_0xa5f7('0x95')]);});var _0x2c5dd4=[];var _0x1f7edc=[];_0x79bf06['forEach'](function(_0x4f0d4d){if(_0x4f0d4d[_0xa5f7('0x96')]){var _0x22102b=_0x4f0d4d['@odata.type'][_0xa5f7('0x42')](_0x4f0d4d['@odata.type']['lastIndexOf']('.')+0x1);if(_0x22102b===_0xa5f7('0x97')){_0x2c5dd4[_0xa5f7('0x98')](getSelectList(_0x183fc4,_0x55d4e4,_0x1f7edc,_0x1b5fcc['MetadataId'],_0x4f0d4d[_0xa5f7('0x99')],_0x5b558a));}}});return Promise[_0xa5f7('0x9a')](_0x2c5dd4);})['then'](function(_0x11c2f6){_0x124d99=_0x11c2f6[0x0];var _0x8b42ff=[];var _0x303372=[];_0x79bf06[_0xa5f7('0x9b')](function(_0x4f126e){if(!_['isNil'](_0x4f126e[_0xa5f7('0x96')])){var _0x328fa3=_0x4f126e['@odata.type'][_0xa5f7('0x42')](_0x4f126e['@odata.type'][_0xa5f7('0x43')]('.')+0x1);if(_0x328fa3==='BooleanAttributeMetadata'){_0x8b42ff[_0xa5f7('0x98')](getBooleanList(_0x183fc4,_0x55d4e4,_0x303372,_0x1b5fcc[_0xa5f7('0x99')],_0x4f126e['MetadataId'],_0x5b558a));}}});return Promise[_0xa5f7('0x9a')](_0x8b42ff);})[_0xa5f7('0x10')](function(_0x5b4816){_0x2e6a7c=_0x5b4816[0x0];var _0x4c332d=[];var _0x5b106b=[];_0x79bf06['forEach'](function(_0x1761e2){if(_0x1761e2['@odata.type']){var _0x148053=_0x1761e2[_0xa5f7('0x96')][_0xa5f7('0x42')](_0x1761e2[_0xa5f7('0x96')]['lastIndexOf']('.')+0x1);if(_0x148053===_0xa5f7('0x9c')||_0x148053===_0xa5f7('0x9d')||_0x148053==='BigIntAttributeMetadata'||_0x148053===_0xa5f7('0x9e')||_0x148053===_0xa5f7('0x9f')||_0x148053==='DateTimeAttributeMetadata'||_0x148053===_0xa5f7('0xa0')||_0x148053===_0xa5f7('0xa1')||_0x148053==='StateAttributeMetadata'||_0x148053===_0xa5f7('0xa2')){_0x4c332d[_0xa5f7('0x98')](getInputList(_0x183fc4,_0x55d4e4,_0x148053,_0x5b106b,_0x1b5fcc[_0xa5f7('0x99')],_0x1761e2[_0xa5f7('0x99')],_0x5b558a));}}});return Promise[_0xa5f7('0x9a')](_0x4c332d);})[_0xa5f7('0x10')](function(_0x179a59){_0xa72fe0=_0x179a59[0x0];var _0x6f0dfd=_0x124d99[_0xa5f7('0xa3')](_0x2e6a7c)[_0xa5f7('0xa3')](_0xa72fe0);var _0x5c1ec4={'count':_0x6f0dfd[_0xa5f7('0x31')],'rows':_0x6f0dfd};return _0x5c1ec4;})[_0xa5f7('0x10')](respondWithResult(_0x15bff9,null))['catch'](function(_0x34c126){var _0x5cee46=_0x35b928[_0xa5f7('0x1d')]['test']?0x1f4:_0x34c126[_0xa5f7('0xa4')]||0x1f4;logger[_0xa5f7('0x13')](_0x34c126[_0xa5f7('0x14')]);delete _0x34c126[_0xa5f7('0x15')];if(_0x5cee46===0x191){_0x5cee46=0x190;}_0x15bff9[_0xa5f7('0x8')](_0x5cee46)[_0xa5f7('0x16')](_0x35b928[_0xa5f7('0x1d')][_0xa5f7('0xa5')]?{'message':_0xa5f7('0xa6'),'statusCode':_0x34c126[_0xa5f7('0xa4')]}:_0x34c126);});};function getSelectList(_0xa83924,_0x25ce2f,_0x152c65,_0x2a356f,_0x219379,_0x5db64e){var _0x87fbb0={'method':_0xa5f7('0x8e'),'uri':_0xa83924+'EntityDefinitions('+_0x2a356f+_0xa5f7('0xa7')+_0x219379+_0xa5f7('0xa8')+_0xa5f7('0xa9'),'headers':{'Authorization':_0xa5f7('0x90')+_0x5db64e,'If-None-Match':null,'OData-Version':_0xa5f7('0x91')},'json':!![]};return rp(_0x87fbb0)[_0xa5f7('0x10')](function(_0x4be8c7){var _0x42b480=[];var _0x309dce=_0x4be8c7[_0xa5f7('0xaa')][_0xa5f7('0xab')];_0x309dce[_0xa5f7('0x9b')](function(_0x2e25b4){_0x42b480[_0xa5f7('0x98')]({'name':_0x2e25b4[_0xa5f7('0xac')][_0xa5f7('0xad')]['Label'],'value':String(_0x2e25b4[_0xa5f7('0xae')])});});var _0x5850b6={'id':_0x25ce2f+'_'+_0x4be8c7[_0xa5f7('0x95')],'name':_0x4be8c7[_0xa5f7('0xaf')][_0xa5f7('0xad')][_0xa5f7('0xac')],'custom':![],'options':_0x42b480};_0x152c65[_0xa5f7('0x98')](_0x5850b6);return _0x152c65;});}function getBooleanList(_0x5dc691,_0x451153,_0x1d7d26,_0x30366b,_0xe890bf,_0x50f9fe){var _0x2499b3={'method':_0xa5f7('0x8e'),'uri':_0x5dc691+_0xa5f7('0x92')+_0x30366b+_0xa5f7('0xa7')+_0xe890bf+_0xa5f7('0xb0'),'headers':{'Authorization':'Bearer\x20'+_0x50f9fe,'If-None-Match':null,'OData-Version':_0xa5f7('0x91')},'json':!![]};return rp(_0x2499b3)[_0xa5f7('0x10')](function(_0x6c1a09){var _0x17a387=[];_0x17a387[_0xa5f7('0x98')]({'name':_0x6c1a09['OptionSet'][_0xa5f7('0xb1')][_0xa5f7('0xac')][_0xa5f7('0xad')][_0xa5f7('0xac')],'value':_0xa5f7('0xb2')},{'name':_0x6c1a09['OptionSet']['FalseOption'][_0xa5f7('0xac')][_0xa5f7('0xad')][_0xa5f7('0xac')],'value':_0xa5f7('0xb3')});var _0x15f5ed={'id':_0x451153+'_'+_0x6c1a09[_0xa5f7('0x95')],'name':_0x6c1a09['DisplayName'][_0xa5f7('0xad')]['Label'],'custom':![],'options':_0x17a387};_0x1d7d26[_0xa5f7('0x98')](_0x15f5ed);return _0x1d7d26;});}function getInputList(_0x58446c,_0x1aa99c,_0x40af21,_0x3ac86a,_0x5ca8ab,_0x2da289,_0x5e955e){var _0x2a9b0b={'method':_0xa5f7('0x8e'),'uri':_0x58446c+_0xa5f7('0x92')+_0x5ca8ab+_0xa5f7('0xa7')+_0x2da289+_0xa5f7('0xb4')+_0x40af21+_0xa5f7('0xb5'),'headers':{'Authorization':'Bearer\x20'+_0x5e955e,'If-None-Match':null,'OData-Version':_0xa5f7('0x91')},'json':!![]};return rp(_0x2a9b0b)[_0xa5f7('0x10')](function(_0x4408c6){var _0x340dbd={'id':_0x1aa99c+'_'+_0x4408c6[_0xa5f7('0x95')],'name':_0x4408c6[_0xa5f7('0xaf')][_0xa5f7('0xad')]?_0x4408c6[_0xa5f7('0xaf')]['UserLocalizedLabel'][_0xa5f7('0xac')]:_0x4408c6['LogicalName'],'custom':![],'options':[]};_0x3ac86a['push'](_0x340dbd);return _0x3ac86a;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 2bd46d1..9131ce6 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.model.js +++ b/server/api/intDynamics365Account/intDynamics365Account.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts'];(function(_0x2984d0,_0x1a7211){var _0x2885f2=function(_0x42f3da){while(--_0x42f3da){_0x2984d0['push'](_0x2984d0['shift']());}};_0x2885f2(++_0x1a7211);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));var integrations=require(_0x3071('0x8'));module[_0x3071('0x9')]=function(_0x41cf76,_0x1d3dd6){return _0x41cf76[_0x3071('0xa')](_0x3071('0xb'),attributes,{'tableName':_0x3071('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x757a=['Dynamics365Account','int_dynamics365_accounts','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration'];(function(_0x3eca70,_0x33b935){var _0x21cb3f=function(_0x36e9b2){while(--_0x36e9b2){_0x3eca70['push'](_0x3eca70['shift']());}};_0x21cb3f(++_0x33b935);}(_0x757a,0xde));var _0xa757=function(_0xf1f1a0,_0xdd8799){_0xf1f1a0=_0xf1f1a0-0x0;var _0x3daad2=_0x757a[_0xf1f1a0];return _0x3daad2;};'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 c506751..0f13547 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 _0x5c63=['debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','error','code','Dynamics365Account,\x20%s,\x20%s','message','result','Dynamics365Account','findAll','options','raw','attributes','limit','map','model','include','catch','GetDynamics365Account','ShowDynamics365Account','find','where','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent'];(function(_0x502246,_0xf1a331){var _0x6aabec=function(_0x11c40e){while(--_0x11c40e){_0x502246['push'](_0x502246['shift']());}};_0x6aabec(++_0xf1a331);}(_0x5c63,0x17d));var _0x35c6=function(_0x435376,_0x399d5b){_0x435376=_0x435376-0x0;var _0x52a9a5=_0x5c63[_0x435376];return _0x52a9a5;};'use strict';var _=require(_0x35c6('0x0'));var util=require('util');var moment=require(_0x35c6('0x1'));var BPromise=require(_0x35c6('0x2'));var rs=require(_0x35c6('0x3'));var fs=require('fs');var Redis=require(_0x35c6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x35c6('0x5'));var logger=require(_0x35c6('0x6'))(_0x35c6('0x7'));var config=require(_0x35c6('0x8'));var jayson=require(_0x35c6('0x9'));var client=jayson['client'][_0x35c6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x310d2d,_0x526d96,_0x502c59){return new BPromise(function(_0x1753fe,_0x1439de){return client[_0x35c6('0xb')](_0x310d2d,_0x502c59)[_0x35c6('0xc')](function(_0x11a26a){logger[_0x35c6('0xd')]('Dynamics365Account,\x20%s,\x20%s',_0x526d96,_0x35c6('0xe'));logger[_0x35c6('0xf')](_0x35c6('0x10'),_0x526d96,_0x35c6('0xe'),JSON['stringify'](_0x11a26a));if(_0x11a26a[_0x35c6('0x11')]){if(_0x11a26a[_0x35c6('0x11')][_0x35c6('0x12')]===0x1f4){logger['error'](_0x35c6('0x13'),_0x526d96,_0x11a26a[_0x35c6('0x11')][_0x35c6('0x14')]);return _0x1439de(_0x11a26a[_0x35c6('0x11')][_0x35c6('0x14')]);}logger['error'](_0x35c6('0x13'),_0x526d96,_0x11a26a[_0x35c6('0x11')]['message']);return _0x1753fe(_0x11a26a[_0x35c6('0x11')]['message']);}else{logger[_0x35c6('0xd')]('Dynamics365Account,\x20%s,\x20%s',_0x526d96,'request\x20sent');_0x1753fe(_0x11a26a[_0x35c6('0x15')][_0x35c6('0x14')]);}})['catch'](function(_0x3fa074){logger[_0x35c6('0x11')](_0x35c6('0x13'),_0x526d96,_0x3fa074);_0x1439de(_0x3fa074);});});}exports['GetDynamics365Account']=function(_0x28b19e){var _0x46874c=this;return new Promise(function(_0x50a8ea,_0x920537){return db[_0x35c6('0x16')][_0x35c6('0x17')]({'raw':_0x28b19e[_0x35c6('0x18')]?_0x28b19e[_0x35c6('0x18')][_0x35c6('0x19')]===undefined?!![]:![]:!![],'where':_0x28b19e[_0x35c6('0x18')]?_0x28b19e[_0x35c6('0x18')]['where']||null:null,'attributes':_0x28b19e[_0x35c6('0x18')]?_0x28b19e[_0x35c6('0x18')][_0x35c6('0x1a')]||null:null,'limit':_0x28b19e[_0x35c6('0x18')]?_0x28b19e[_0x35c6('0x18')][_0x35c6('0x1b')]||null:null,'include':_0x28b19e['options']?_0x28b19e[_0x35c6('0x18')]['include']?_[_0x35c6('0x1c')](_0x28b19e[_0x35c6('0x18')]['include'],function(_0x4fbcfb){return{'model':db[_0x4fbcfb[_0x35c6('0x1d')]],'as':_0x4fbcfb['as'],'attributes':_0x4fbcfb['attributes'],'include':_0x4fbcfb[_0x35c6('0x1e')]?_[_0x35c6('0x1c')](_0x4fbcfb[_0x35c6('0x1e')],function(_0xbbb0c2){return{'model':db[_0xbbb0c2[_0x35c6('0x1d')]],'as':_0xbbb0c2['as'],'attributes':_0xbbb0c2[_0x35c6('0x1a')],'include':_0xbbb0c2['include']?_[_0x35c6('0x1c')](_0xbbb0c2['include'],function(_0x1efd32){return{'model':db[_0x1efd32['model']],'as':_0x1efd32['as'],'attributes':_0x1efd32['attributes']};}):[]};}):[]};}):[]:[]})[_0x35c6('0xc')](function(_0x47b70c){logger[_0x35c6('0xd')]('GetDynamics365Account',_0x28b19e);logger[_0x35c6('0xf')]('GetDynamics365Account',_0x28b19e,JSON['stringify'](_0x47b70c));_0x50a8ea(_0x47b70c);})[_0x35c6('0x1f')](function(_0x4b56d3){logger[_0x35c6('0x11')](_0x35c6('0x20'),_0x4b56d3[_0x35c6('0x14')],_0x28b19e);_0x920537(_0x46874c['error'](0x1f4,_0x4b56d3[_0x35c6('0x14')]));});});};exports[_0x35c6('0x21')]=function(_0x3bd431){var _0x106be5=this;return new Promise(function(_0x67d50e,_0x28405a){return db[_0x35c6('0x16')][_0x35c6('0x22')]({'raw':_0x3bd431[_0x35c6('0x18')]?_0x3bd431['options'][_0x35c6('0x19')]===undefined?!![]:![]:!![],'where':_0x3bd431[_0x35c6('0x18')]?_0x3bd431[_0x35c6('0x18')][_0x35c6('0x23')]||null:null,'attributes':_0x3bd431['options']?_0x3bd431['options']['attributes']||null:null,'include':_0x3bd431[_0x35c6('0x18')]?_0x3bd431[_0x35c6('0x18')][_0x35c6('0x1e')]?_['map'](_0x3bd431[_0x35c6('0x18')]['include'],function(_0x79f792){return{'model':db[_0x79f792['model']],'as':_0x79f792['as'],'attributes':_0x79f792[_0x35c6('0x1a')],'include':_0x79f792['include']?_['map'](_0x79f792[_0x35c6('0x1e')],function(_0x5c7a38){return{'model':db[_0x5c7a38[_0x35c6('0x1d')]],'as':_0x5c7a38['as'],'attributes':_0x5c7a38[_0x35c6('0x1a')],'include':_0x5c7a38['include']?_[_0x35c6('0x1c')](_0x5c7a38[_0x35c6('0x1e')],function(_0x274ec1){return{'model':db[_0x274ec1[_0x35c6('0x1d')]],'as':_0x274ec1['as'],'attributes':_0x274ec1[_0x35c6('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x35c6('0xc')](function(_0x663b2f){logger[_0x35c6('0xd')]('ShowDynamics365Account',_0x3bd431);logger[_0x35c6('0xf')](_0x35c6('0x21'),_0x3bd431,JSON['stringify'](_0x663b2f));_0x67d50e(_0x663b2f);})[_0x35c6('0x1f')](function(_0x8de4af){logger[_0x35c6('0x11')](_0x35c6('0x21'),_0x8de4af[_0x35c6('0x14')],_0x3bd431);_0x28405a(_0x106be5['error'](0x1f4,_0x8de4af[_0x35c6('0x14')]));});});}; \ No newline at end of file +var _0x8f35=['GetDynamics365Account','Dynamics365Account','options','raw','where','attributes','limit','include','map','model','ShowDynamics365Account','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch'];(function(_0x4a86d0,_0x3fa6ab){var _0x26dd24=function(_0x375512){while(--_0x375512){_0x4a86d0['push'](_0x4a86d0['shift']());}};_0x26dd24(++_0x3fa6ab);}(_0x8f35,0x107));var _0x58f3=function(_0x5ddaac,_0x2697a8){_0x5ddaac=_0x5ddaac-0x0;var _0x2a9c58=_0x8f35[_0x5ddaac];return _0x2a9c58;};'use strict';var _=require(_0x58f3('0x0'));var util=require(_0x58f3('0x1'));var moment=require('moment');var BPromise=require(_0x58f3('0x2'));var rs=require(_0x58f3('0x3'));var fs=require('fs');var Redis=require(_0x58f3('0x4'));var db=require(_0x58f3('0x5'))['db'];var utils=require(_0x58f3('0x6'));var logger=require(_0x58f3('0x7'))(_0x58f3('0x8'));var config=require(_0x58f3('0x9'));var jayson=require(_0x58f3('0xa'));var client=jayson[_0x58f3('0xb')][_0x58f3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4ccd9b,_0x1df835,_0x2052f1){return new BPromise(function(_0x4ab487,_0x4c941d){return client[_0x58f3('0xd')](_0x4ccd9b,_0x2052f1)[_0x58f3('0xe')](function(_0x1b4286){logger['info'](_0x58f3('0xf'),_0x1df835,_0x58f3('0x10'));logger[_0x58f3('0x11')](_0x58f3('0x12'),_0x1df835,'request\x20sent',JSON[_0x58f3('0x13')](_0x1b4286));if(_0x1b4286[_0x58f3('0x14')]){if(_0x1b4286[_0x58f3('0x14')]['code']===0x1f4){logger[_0x58f3('0x14')](_0x58f3('0xf'),_0x1df835,_0x1b4286[_0x58f3('0x14')]['message']);return _0x4c941d(_0x1b4286[_0x58f3('0x14')][_0x58f3('0x15')]);}logger[_0x58f3('0x14')](_0x58f3('0xf'),_0x1df835,_0x1b4286[_0x58f3('0x14')][_0x58f3('0x15')]);return _0x4ab487(_0x1b4286[_0x58f3('0x14')]['message']);}else{logger[_0x58f3('0x16')](_0x58f3('0xf'),_0x1df835,_0x58f3('0x10'));_0x4ab487(_0x1b4286[_0x58f3('0x17')]['message']);}})[_0x58f3('0x18')](function(_0xae31ec){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x1df835,_0xae31ec);_0x4c941d(_0xae31ec);});});}exports[_0x58f3('0x19')]=function(_0x510d44){var _0x391c4a=this;return new Promise(function(_0x51fc81,_0x186712){return db[_0x58f3('0x1a')]['findAll']({'raw':_0x510d44[_0x58f3('0x1b')]?_0x510d44[_0x58f3('0x1b')][_0x58f3('0x1c')]===undefined?!![]:![]:!![],'where':_0x510d44[_0x58f3('0x1b')]?_0x510d44['options'][_0x58f3('0x1d')]||null:null,'attributes':_0x510d44['options']?_0x510d44[_0x58f3('0x1b')][_0x58f3('0x1e')]||null:null,'limit':_0x510d44[_0x58f3('0x1b')]?_0x510d44[_0x58f3('0x1b')][_0x58f3('0x1f')]||null:null,'include':_0x510d44[_0x58f3('0x1b')]?_0x510d44[_0x58f3('0x1b')][_0x58f3('0x20')]?_[_0x58f3('0x21')](_0x510d44[_0x58f3('0x1b')][_0x58f3('0x20')],function(_0x2e8e4b){return{'model':db[_0x2e8e4b[_0x58f3('0x22')]],'as':_0x2e8e4b['as'],'attributes':_0x2e8e4b[_0x58f3('0x1e')],'include':_0x2e8e4b[_0x58f3('0x20')]?_[_0x58f3('0x21')](_0x2e8e4b[_0x58f3('0x20')],function(_0x4e95c0){return{'model':db[_0x4e95c0['model']],'as':_0x4e95c0['as'],'attributes':_0x4e95c0[_0x58f3('0x1e')],'include':_0x4e95c0[_0x58f3('0x20')]?_['map'](_0x4e95c0[_0x58f3('0x20')],function(_0xf92bcd){return{'model':db[_0xf92bcd['model']],'as':_0xf92bcd['as'],'attributes':_0xf92bcd[_0x58f3('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x58f3('0xe')](function(_0x420172){logger[_0x58f3('0x16')](_0x58f3('0x19'),_0x510d44);logger['debug'](_0x58f3('0x19'),_0x510d44,JSON[_0x58f3('0x13')](_0x420172));_0x51fc81(_0x420172);})[_0x58f3('0x18')](function(_0x4a3f3a){logger[_0x58f3('0x14')](_0x58f3('0x19'),_0x4a3f3a['message'],_0x510d44);_0x186712(_0x391c4a[_0x58f3('0x14')](0x1f4,_0x4a3f3a['message']));});});};exports['ShowDynamics365Account']=function(_0x46fb2f){var _0x23474b=this;return new Promise(function(_0x51399f,_0x123a07){return db[_0x58f3('0x1a')]['find']({'raw':_0x46fb2f[_0x58f3('0x1b')]?_0x46fb2f[_0x58f3('0x1b')][_0x58f3('0x1c')]===undefined?!![]:![]:!![],'where':_0x46fb2f[_0x58f3('0x1b')]?_0x46fb2f['options'][_0x58f3('0x1d')]||null:null,'attributes':_0x46fb2f[_0x58f3('0x1b')]?_0x46fb2f[_0x58f3('0x1b')][_0x58f3('0x1e')]||null:null,'include':_0x46fb2f['options']?_0x46fb2f[_0x58f3('0x1b')][_0x58f3('0x20')]?_[_0x58f3('0x21')](_0x46fb2f[_0x58f3('0x1b')][_0x58f3('0x20')],function(_0x4876d8){return{'model':db[_0x4876d8[_0x58f3('0x22')]],'as':_0x4876d8['as'],'attributes':_0x4876d8[_0x58f3('0x1e')],'include':_0x4876d8[_0x58f3('0x20')]?_[_0x58f3('0x21')](_0x4876d8[_0x58f3('0x20')],function(_0x2736b7){return{'model':db[_0x2736b7[_0x58f3('0x22')]],'as':_0x2736b7['as'],'attributes':_0x2736b7[_0x58f3('0x1e')],'include':_0x2736b7[_0x58f3('0x20')]?_[_0x58f3('0x21')](_0x2736b7[_0x58f3('0x20')],function(_0x5af5af){return{'model':db[_0x5af5af[_0x58f3('0x22')]],'as':_0x5af5af['as'],'attributes':_0x5af5af['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x543198){logger[_0x58f3('0x16')](_0x58f3('0x23'),_0x46fb2f);logger[_0x58f3('0x11')](_0x58f3('0x23'),_0x46fb2f,JSON['stringify'](_0x543198));_0x51399f(_0x543198);})[_0x58f3('0x18')](function(_0x4e62bf){logger[_0x58f3('0x14')]('ShowDynamics365Account',_0x4e62bf[_0x58f3('0x15')],_0x46fb2f);_0x123a07(_0x23474b[_0x58f3('0x14')](0x1f4,_0x4e62bf['message']));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 80b4c7b..771f116 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 _0xe29f=['create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intDynamics365Configuration.controller','isAuthenticated','index','/:id','show','get','getFields','getSubjects','/:id/descriptions','getDescriptions'];(function(_0x381c6a,_0x528a12){var _0x1cc439=function(_0x3e4ee3){while(--_0x3e4ee3){_0x381c6a['push'](_0x381c6a['shift']());}};_0x1cc439(++_0x528a12);}(_0xe29f,0x1a4));var _0xfe29=function(_0x324316,_0x4ad17a){_0x324316=_0x324316-0x0;var _0x2e17a7=_0xe29f[_0x324316];return _0x2e17a7;};'use strict';var multer=require(_0xfe29('0x0'));var util=require('util');var path=require(_0xfe29('0x1'));var timeout=require(_0xfe29('0x2'));var express=require(_0xfe29('0x3'));var router=express[_0xfe29('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xfe29('0x5'));var interaction=require(_0xfe29('0x6'));var config=require('../../config/environment');var controller=require(_0xfe29('0x7'));router['get']('/',auth[_0xfe29('0x8')](),controller[_0xfe29('0x9')]);router['get'](_0xfe29('0xa'),auth['isAuthenticated'](),controller[_0xfe29('0xb')]);router[_0xfe29('0xc')]('/:id/fields',auth[_0xfe29('0x8')](),controller[_0xfe29('0xd')]);router[_0xfe29('0xc')]('/:id/subjects',auth['isAuthenticated'](),controller[_0xfe29('0xe')]);router['get'](_0xfe29('0xf'),auth[_0xfe29('0x8')](),controller[_0xfe29('0x10')]);router['post']('/',auth[_0xfe29('0x8')](),controller[_0xfe29('0x11')]);router[_0xfe29('0x12')](_0xfe29('0xa'),auth[_0xfe29('0x8')](),controller[_0xfe29('0x13')]);router[_0xfe29('0x14')](_0xfe29('0xa'),auth[_0xfe29('0x8')](),controller[_0xfe29('0x15')]);module[_0xfe29('0x16')]=router; \ No newline at end of file +var _0x655c=['/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','index','/:id','show'];(function(_0x5ce59d,_0x51080a){var _0x469896=function(_0x4725f5){while(--_0x4725f5){_0x5ce59d['push'](_0x5ce59d['shift']());}};_0x469896(++_0x51080a);}(_0x655c,0x15e));var _0xc655=function(_0x17413b,_0x1d9e69){_0x17413b=_0x17413b-0x0;var _0x236593=_0x655c[_0x17413b];return _0x236593;};'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('0x9')](_0xc655('0xe'),auth[_0xc655('0xa')](),controller[_0xc655('0xf')]);router['get'](_0xc655('0x10'),auth[_0xc655('0xa')](),controller[_0xc655('0x11')]);router[_0xc655('0x9')](_0xc655('0x12'),auth[_0xc655('0xa')](),controller[_0xc655('0x13')]);router[_0xc655('0x14')]('/',auth[_0xc655('0xa')](),controller[_0xc655('0x15')]);router[_0xc655('0x16')](_0xc655('0xc'),auth[_0xc655('0xa')](),controller['update']);router[_0xc655('0x17')](_0xc655('0xc'),auth[_0xc655('0xa')](),controller[_0xc655('0x18')]);module[_0xc655('0x19')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index e1e15c8..4c98c53 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 _0xbfe5=['BOOLEAN','sequelize','exports','STRING','phonecall','contact','nothing'];(function(_0xda40ff,_0x2e30cb){var _0x35b3e0=function(_0x26b379){while(--_0x26b379){_0xda40ff['push'](_0xda40ff['shift']());}};_0x35b3e0(++_0x2e30cb);}(_0xbfe5,0x7f));var _0x5bfe=function(_0x13e1b3,_0x16f65a){_0x13e1b3=_0x13e1b3-0x0;var _0x82504e=_0xbfe5[_0x13e1b3];return _0x82504e;};'use strict';var Sequelize=require(_0x5bfe('0x0'));module[_0x5bfe('0x1')]={'name':{'type':Sequelize[_0x5bfe('0x2')]},'description':{'type':Sequelize[_0x5bfe('0x2')]},'ticketType':{'type':Sequelize['ENUM']('incident',_0x5bfe('0x3')),'defaultValue':'incident'},'moduleCreate':{'type':Sequelize['ENUM'](_0x5bfe('0x4'),_0x5bfe('0x5')),'defaultValue':_0x5bfe('0x4'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x5bfe('0x2')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x5bfe('0x6')],'defaultValue':!![]}}; \ No newline at end of file +var _0xe5a7=['phonecall','contact','nothing','exports','STRING','ENUM','incident'];(function(_0x1d04b5,_0x30792c){var _0x161342=function(_0x94ff92){while(--_0x94ff92){_0x1d04b5['push'](_0x1d04b5['shift']());}};_0x161342(++_0x30792c);}(_0xe5a7,0x9d));var _0x7e5a=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xe5a7[_0x484e36];return _0xafc85d;};'use strict';var Sequelize=require('sequelize');module[_0x7e5a('0x0')]={'name':{'type':Sequelize[_0x7e5a('0x1')]},'description':{'type':Sequelize[_0x7e5a('0x1')]},'ticketType':{'type':Sequelize[_0x7e5a('0x2')](_0x7e5a('0x3'),_0x7e5a('0x4')),'defaultValue':_0x7e5a('0x3')},'moduleCreate':{'type':Sequelize['ENUM'](_0x7e5a('0x5'),_0x7e5a('0x6')),'defaultValue':_0x7e5a('0x5'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x7e5a('0x1')],'allowNull':!![]},'openNewTab':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 66a0216..46994c5 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 _0xbbea=['show','params','create','body','find','pick','getFields','getSubjects','findOne','Dynamics365Field','getDescriptions','eml-format','rimraf','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','lodash','jsforce','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','json','apply','save','update','then','sendStatus','error','name','index','map','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','Dynamics365Configuration','findAll','rows','catch'];(function(_0x10985f,_0x5d2a76){var _0x4905ba=function(_0x14e7bd){while(--_0x14e7bd){_0x10985f['push'](_0x10985f['shift']());}};_0x4905ba(++_0x5d2a76);}(_0xbbea,0x16e));var _0xabbe=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xbbea[_0x3bf83f];return _0x22c4a9;};'use strict';var emlformat=require(_0xabbe('0x0'));var rimraf=require(_0xabbe('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xabbe('0x2'));var rp=require('request-promise');var moment=require(_0xabbe('0x3'));var BPromise=require(_0xabbe('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xabbe('0x5'));var sox=require(_0xabbe('0x6'));var csv=require(_0xabbe('0x7'));var ejs=require(_0xabbe('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xabbe('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xabbe('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xabbe('0xb'));var authService=require(_0xabbe('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0xabbe('0xd'));var hardwareService=require(_0xabbe('0xe'));var logger=require(_0xabbe('0xf'))('api');var utils=require(_0xabbe('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0xabbe('0x11'));var db=require(_0xabbe('0x12'))['db'];function respondWithStatusCode(_0x252cfd,_0x100770){_0x100770=_0x100770||0xcc;return function(_0x98f40){if(_0x98f40){return _0x252cfd['sendStatus'](_0x100770);}return _0x252cfd[_0xabbe('0x13')](_0x100770)[_0xabbe('0x14')]();};}function respondWithResult(_0x20ec21,_0x427f7e){_0x427f7e=_0x427f7e||0xc8;return function(_0x92ee90){if(_0x92ee90){return _0x20ec21[_0xabbe('0x13')](_0x427f7e)['json'](_0x92ee90);}};}function respondWithFilteredResult(_0xa67173,_0x1bd2bc){return function(_0x522e6e){if(_0x522e6e){var _0x3df610=typeof _0x1bd2bc[_0xabbe('0x15')]===_0xabbe('0x16')&&typeof _0x1bd2bc[_0xabbe('0x17')]===_0xabbe('0x16');var _0x3a01aa=_0x522e6e['count'];var _0x417aeb=_0x3df610?0x0:_0x1bd2bc[_0xabbe('0x15')];var _0x4221b9=_0x3df610?_0x522e6e[_0xabbe('0x18')]:_0x1bd2bc[_0xabbe('0x15')]+_0x1bd2bc[_0xabbe('0x17')];var _0x16dc32;if(_0x4221b9>=_0x3a01aa){_0x4221b9=_0x3a01aa;_0x16dc32=0xc8;}else{_0x16dc32=0xce;}_0xa67173[_0xabbe('0x13')](_0x16dc32);return _0xa67173[_0xabbe('0x19')]('Content-Range',_0x417aeb+'-'+_0x4221b9+'/'+_0x3a01aa)[_0xabbe('0x1a')](_0x522e6e);}return null;};}function patchUpdates(_0x3fc0ea){return function(_0xa0d534){try{jsonpatch[_0xabbe('0x1b')](_0xa0d534,_0x3fc0ea,!![]);}catch(_0x5361ef){return BPromise['reject'](_0x5361ef);}return _0xa0d534[_0xabbe('0x1c')]();};}function saveUpdates(_0xc0b022,_0x1ec91e){return function(_0x5ab402){if(_0x5ab402){return _0x5ab402[_0xabbe('0x1d')](_0xc0b022)[_0xabbe('0x1e')](function(_0x2325b3){return _0x2325b3;});}return null;};}function removeEntity(_0x4b9899,_0x2c2371){return function(_0x310b74){if(_0x310b74){return _0x310b74['destroy']()[_0xabbe('0x1e')](function(){_0x4b9899[_0xabbe('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x415ea0,_0x5a3235){return function(_0x201cd1){if(!_0x201cd1){_0x415ea0[_0xabbe('0x1f')](0x194);}return _0x201cd1;};}function handleError(_0x48fa46,_0x4a2322){_0x4a2322=_0x4a2322||0x1f4;return function(_0x15528e){logger[_0xabbe('0x20')](_0x15528e['stack']);if(_0x15528e[_0xabbe('0x21')]){delete _0x15528e[_0xabbe('0x21')];}_0x48fa46['status'](_0x4a2322)['send'](_0x15528e);};}exports[_0xabbe('0x22')]=function(_0xf75f59,_0x49a96d){var _0x5b5f97={},_0xbf8054={},_0x4a73ee={'count':0x0,'rows':[]};var _0x4eff43=_[_0xabbe('0x23')](db['Dynamics365Configuration'][_0xabbe('0x24')],function(_0x1f221a){return{'name':_0x1f221a['fieldName'],'type':_0x1f221a['type'][_0xabbe('0x25')]};});_0xbf8054[_0xabbe('0x26')]=_[_0xabbe('0x23')](_0x4eff43,_0xabbe('0x21'));_0xbf8054[_0xabbe('0x27')]=_[_0xabbe('0x28')](_0xf75f59[_0xabbe('0x27')]);_0xbf8054[_0xabbe('0x29')]=_[_0xabbe('0x2a')](_0xbf8054[_0xabbe('0x26')],_0xbf8054['query']);_0x5b5f97[_0xabbe('0x2b')]=_[_0xabbe('0x2a')](_0xbf8054[_0xabbe('0x26')],qs[_0xabbe('0x2c')](_0xf75f59[_0xabbe('0x27')]['fields']));_0x5b5f97[_0xabbe('0x2b')]=_0x5b5f97[_0xabbe('0x2b')][_0xabbe('0x2d')]?_0x5b5f97[_0xabbe('0x2b')]:_0xbf8054['model'];if(!_0xf75f59[_0xabbe('0x27')][_0xabbe('0x2e')](_0xabbe('0x2f'))){_0x5b5f97[_0xabbe('0x17')]=qs['limit'](_0xf75f59['query']['limit']);_0x5b5f97[_0xabbe('0x15')]=qs['offset'](_0xf75f59['query'][_0xabbe('0x15')]);}_0x5b5f97[_0xabbe('0x30')]=qs['sort'](_0xf75f59[_0xabbe('0x27')][_0xabbe('0x31')]);_0x5b5f97[_0xabbe('0x32')]=qs[_0xabbe('0x29')](_['pick'](_0xf75f59[_0xabbe('0x27')],_0xbf8054[_0xabbe('0x29')]),_0x4eff43);if(_0xf75f59['query'][_0xabbe('0x33')]){_0x5b5f97['where']=_[_0xabbe('0x34')](_0x5b5f97[_0xabbe('0x32')],{'$or':_[_0xabbe('0x23')](_0x4eff43,function(_0xb5fff4){if(_0xb5fff4['type']!==_0xabbe('0x35')){var _0x1b2bff={};_0x1b2bff[_0xb5fff4[_0xabbe('0x21')]]={'$like':'%'+_0xf75f59['query'][_0xabbe('0x33')]+'%'};return _0x1b2bff;}})});}_0x5b5f97=_[_0xabbe('0x34')]({},_0x5b5f97,_0xf75f59[_0xabbe('0x36')]);var _0x3b10d7={'where':_0x5b5f97['where']};return db['Dynamics365Configuration'][_0xabbe('0x18')](_0x3b10d7)[_0xabbe('0x1e')](function(_0x76d122){_0x4a73ee[_0xabbe('0x18')]=_0x76d122;if(_0xf75f59[_0xabbe('0x27')][_0xabbe('0x37')]){_0x5b5f97['include']=[{'all':!![]}];}return db[_0xabbe('0x38')][_0xabbe('0x39')](_0x5b5f97);})[_0xabbe('0x1e')](function(_0x472949){_0x4a73ee[_0xabbe('0x3a')]=_0x472949;return _0x4a73ee;})[_0xabbe('0x1e')](respondWithFilteredResult(_0x49a96d,_0x5b5f97))[_0xabbe('0x3b')](handleError(_0x49a96d,null));};exports[_0xabbe('0x3c')]=function(_0x2ed436,_0x549eeb){var _0x352cf0={'raw':![],'where':{'id':_0x2ed436[_0xabbe('0x3d')]['id']}},_0x4ee7de={};_0x4ee7de[_0xabbe('0x26')]=_['keys'](db[_0xabbe('0x38')][_0xabbe('0x24')]);_0x4ee7de[_0xabbe('0x27')]=_[_0xabbe('0x28')](_0x2ed436[_0xabbe('0x27')]);_0x4ee7de[_0xabbe('0x29')]=_['intersection'](_0x4ee7de[_0xabbe('0x26')],_0x4ee7de[_0xabbe('0x27')]);_0x352cf0[_0xabbe('0x2b')]=_[_0xabbe('0x2a')](_0x4ee7de[_0xabbe('0x26')],qs[_0xabbe('0x2c')](_0x2ed436['query'][_0xabbe('0x2c')]));_0x352cf0[_0xabbe('0x2b')]=_0x352cf0[_0xabbe('0x2b')][_0xabbe('0x2d')]?_0x352cf0['attributes']:_0x4ee7de['model'];if(_0x2ed436['query'][_0xabbe('0x37')]){_0x352cf0['include']=[{'all':!![]}];}_0x352cf0=_[_0xabbe('0x34')]({},_0x352cf0,_0x2ed436['options']);return db[_0xabbe('0x38')]['find'](_0x352cf0)['then'](handleEntityNotFound(_0x549eeb,null))[_0xabbe('0x1e')](respondWithResult(_0x549eeb,null))['catch'](handleError(_0x549eeb,null));};exports[_0xabbe('0x3e')]=function(_0x2b1824,_0x48bd29){return db['Dynamics365Configuration'][_0xabbe('0x3e')](_0x2b1824['body'],{})[_0xabbe('0x1e')](respondWithResult(_0x48bd29,0xc9))[_0xabbe('0x3b')](handleError(_0x48bd29,null));};exports['update']=function(_0x249fc8,_0x2305cc){if(_0x249fc8[_0xabbe('0x3f')]['id']){delete _0x249fc8[_0xabbe('0x3f')]['id'];}return db[_0xabbe('0x38')]['find']({'where':{'id':_0x249fc8[_0xabbe('0x3d')]['id']}})['then'](handleEntityNotFound(_0x2305cc,null))[_0xabbe('0x1e')](saveUpdates(_0x249fc8['body'],null))['then'](respondWithResult(_0x2305cc,null))[_0xabbe('0x3b')](handleError(_0x2305cc,null));};exports['destroy']=function(_0x2e28bd,_0x2b09a3){return db[_0xabbe('0x38')][_0xabbe('0x40')]({'where':{'id':_0x2e28bd['params']['id']}})[_0xabbe('0x1e')](handleEntityNotFound(_0x2b09a3,null))['then'](removeEntity(_0x2b09a3,null))[_0xabbe('0x3b')](handleError(_0x2b09a3,null));};exports['getFields']=function(_0x25f286,_0x1d3158,_0xe898b){var _0x2cf4d3={};var _0x23a0b3={};var _0x4df675;var _0x13738f;return db['Dynamics365Configuration']['findOne']({'where':{'id':_0x25f286[_0xabbe('0x3d')]['id']}})[_0xabbe('0x1e')](handleEntityNotFound(_0x1d3158,null))[_0xabbe('0x1e')](function(_0x3f383a){if(_0x3f383a){_0x4df675=_0x3f383a;_0x23a0b3[_0xabbe('0x26')]=_[_0xabbe('0x28')](db['Dynamics365Field'][_0xabbe('0x24')]);_0x23a0b3[_0xabbe('0x27')]=_[_0xabbe('0x28')](_0x25f286[_0xabbe('0x27')]);_0x23a0b3[_0xabbe('0x29')]=_[_0xabbe('0x2a')](_0x23a0b3[_0xabbe('0x26')],_0x23a0b3[_0xabbe('0x27')]);_0x2cf4d3[_0xabbe('0x2b')]=_[_0xabbe('0x2a')](_0x23a0b3[_0xabbe('0x26')],qs[_0xabbe('0x2c')](_0x25f286[_0xabbe('0x27')]['fields']));_0x2cf4d3[_0xabbe('0x2b')]=_0x2cf4d3[_0xabbe('0x2b')][_0xabbe('0x2d')]?_0x2cf4d3[_0xabbe('0x2b')]:_0x23a0b3[_0xabbe('0x26')];_0x2cf4d3['order']=qs[_0xabbe('0x31')](_0x25f286[_0xabbe('0x27')]['sort']);_0x2cf4d3[_0xabbe('0x32')]=qs['filters'](_[_0xabbe('0x41')](_0x25f286[_0xabbe('0x27')],_0x23a0b3['filters']));if(_0x25f286[_0xabbe('0x27')][_0xabbe('0x33')]){_0x2cf4d3['where']=_[_0xabbe('0x34')](_0x2cf4d3[_0xabbe('0x32')],{'$or':_['map'](_0x2cf4d3[_0xabbe('0x2b')],function(_0x4f9bcb){var _0x301ffc={};_0x301ffc[_0x4f9bcb]={'$like':'%'+_0x25f286[_0xabbe('0x27')][_0xabbe('0x33')]+'%'};return _0x301ffc;})});}_0x2cf4d3=_[_0xabbe('0x34')]({},_0x2cf4d3,_0x25f286[_0xabbe('0x36')]);return _0x4df675['getFields'](_0x2cf4d3);}})['then'](function(_0x1a8131){if(_0x1a8131){_0x13738f=_0x1a8131[_0xabbe('0x2d')];if(!_0x25f286[_0xabbe('0x27')]['hasOwnProperty'](_0xabbe('0x2f'))){_0x2cf4d3[_0xabbe('0x17')]=qs[_0xabbe('0x17')](_0x25f286[_0xabbe('0x27')][_0xabbe('0x17')]);_0x2cf4d3[_0xabbe('0x15')]=qs[_0xabbe('0x15')](_0x25f286['query'][_0xabbe('0x15')]);}return _0x4df675[_0xabbe('0x42')](_0x2cf4d3);}})[_0xabbe('0x1e')](function(_0x500a2e){if(_0x500a2e){return _0x500a2e?{'count':_0x13738f,'rows':_0x500a2e}:null;}})[_0xabbe('0x1e')](respondWithResult(_0x1d3158,null))[_0xabbe('0x3b')](handleError(_0x1d3158,null));};exports[_0xabbe('0x43')]=function(_0x406c42,_0x18581f,_0x471af3){var _0xc1e968={};var _0x49583b={};var _0x4a0d45;var _0x25348d;return db[_0xabbe('0x38')][_0xabbe('0x44')]({'where':{'id':_0x406c42[_0xabbe('0x3d')]['id']}})[_0xabbe('0x1e')](handleEntityNotFound(_0x18581f,null))[_0xabbe('0x1e')](function(_0x37c9d2){if(_0x37c9d2){_0x4a0d45=_0x37c9d2;_0x49583b['model']=_[_0xabbe('0x28')](db[_0xabbe('0x45')][_0xabbe('0x24')]);_0x49583b['query']=_[_0xabbe('0x28')](_0x406c42['query']);_0x49583b[_0xabbe('0x29')]=_['intersection'](_0x49583b['model'],_0x49583b[_0xabbe('0x27')]);_0xc1e968[_0xabbe('0x2b')]=_[_0xabbe('0x2a')](_0x49583b['model'],qs[_0xabbe('0x2c')](_0x406c42[_0xabbe('0x27')][_0xabbe('0x2c')]));_0xc1e968[_0xabbe('0x2b')]=_0xc1e968[_0xabbe('0x2b')]['length']?_0xc1e968[_0xabbe('0x2b')]:_0x49583b[_0xabbe('0x26')];_0xc1e968[_0xabbe('0x30')]=qs[_0xabbe('0x31')](_0x406c42[_0xabbe('0x27')][_0xabbe('0x31')]);_0xc1e968['where']=qs[_0xabbe('0x29')](_['pick'](_0x406c42['query'],_0x49583b['filters']));if(_0x406c42[_0xabbe('0x27')][_0xabbe('0x33')]){_0xc1e968[_0xabbe('0x32')]=_[_0xabbe('0x34')](_0xc1e968[_0xabbe('0x32')],{'$or':_[_0xabbe('0x23')](_0xc1e968[_0xabbe('0x2b')],function(_0x3e5c28){var _0x1e5420={};_0x1e5420[_0x3e5c28]={'$like':'%'+_0x406c42[_0xabbe('0x27')][_0xabbe('0x33')]+'%'};return _0x1e5420;})});}_0xc1e968=_[_0xabbe('0x34')]({},_0xc1e968,_0x406c42[_0xabbe('0x36')]);return _0x4a0d45[_0xabbe('0x43')](_0xc1e968);}})[_0xabbe('0x1e')](function(_0x31d3ee){if(_0x31d3ee){_0x25348d=_0x31d3ee['length'];if(!_0x406c42[_0xabbe('0x27')][_0xabbe('0x2e')](_0xabbe('0x2f'))){_0xc1e968[_0xabbe('0x17')]=qs[_0xabbe('0x17')](_0x406c42[_0xabbe('0x27')][_0xabbe('0x17')]);_0xc1e968[_0xabbe('0x15')]=qs[_0xabbe('0x15')](_0x406c42['query'][_0xabbe('0x15')]);}return _0x4a0d45[_0xabbe('0x43')](_0xc1e968);}})[_0xabbe('0x1e')](function(_0x5a50cc){if(_0x5a50cc){return _0x5a50cc?{'count':_0x25348d,'rows':_0x5a50cc}:null;}})[_0xabbe('0x1e')](respondWithResult(_0x18581f,null))[_0xabbe('0x3b')](handleError(_0x18581f,null));};exports[_0xabbe('0x46')]=function(_0x337b9d,_0x336d5f,_0x33b02d){var _0x73bbdd={};var _0x12e3cd={};var _0x7d6e91;var _0x11900b;return db[_0xabbe('0x38')][_0xabbe('0x44')]({'where':{'id':_0x337b9d[_0xabbe('0x3d')]['id']}})[_0xabbe('0x1e')](handleEntityNotFound(_0x336d5f,null))[_0xabbe('0x1e')](function(_0x4ff0f9){if(_0x4ff0f9){_0x7d6e91=_0x4ff0f9;_0x12e3cd[_0xabbe('0x26')]=_[_0xabbe('0x28')](db['Dynamics365Field'][_0xabbe('0x24')]);_0x12e3cd['query']=_[_0xabbe('0x28')](_0x337b9d[_0xabbe('0x27')]);_0x12e3cd[_0xabbe('0x29')]=_[_0xabbe('0x2a')](_0x12e3cd[_0xabbe('0x26')],_0x12e3cd[_0xabbe('0x27')]);_0x73bbdd['attributes']=_[_0xabbe('0x2a')](_0x12e3cd[_0xabbe('0x26')],qs[_0xabbe('0x2c')](_0x337b9d[_0xabbe('0x27')][_0xabbe('0x2c')]));_0x73bbdd[_0xabbe('0x2b')]=_0x73bbdd['attributes'][_0xabbe('0x2d')]?_0x73bbdd[_0xabbe('0x2b')]:_0x12e3cd[_0xabbe('0x26')];_0x73bbdd[_0xabbe('0x30')]=qs[_0xabbe('0x31')](_0x337b9d[_0xabbe('0x27')][_0xabbe('0x31')]);_0x73bbdd['where']=qs[_0xabbe('0x29')](_[_0xabbe('0x41')](_0x337b9d['query'],_0x12e3cd[_0xabbe('0x29')]));if(_0x337b9d[_0xabbe('0x27')][_0xabbe('0x33')]){_0x73bbdd['where']=_[_0xabbe('0x34')](_0x73bbdd['where'],{'$or':_['map'](_0x73bbdd['attributes'],function(_0x3e9b7b){var _0x4c6910={};_0x4c6910[_0x3e9b7b]={'$like':'%'+_0x337b9d[_0xabbe('0x27')]['filter']+'%'};return _0x4c6910;})});}_0x73bbdd=_[_0xabbe('0x34')]({},_0x73bbdd,_0x337b9d['options']);return _0x7d6e91[_0xabbe('0x46')](_0x73bbdd);}})[_0xabbe('0x1e')](function(_0x4baf1e){if(_0x4baf1e){_0x11900b=_0x4baf1e[_0xabbe('0x2d')];if(!_0x337b9d[_0xabbe('0x27')]['hasOwnProperty'](_0xabbe('0x2f'))){_0x73bbdd[_0xabbe('0x17')]=qs['limit'](_0x337b9d[_0xabbe('0x27')]['limit']);_0x73bbdd[_0xabbe('0x15')]=qs['offset'](_0x337b9d['query']['offset']);}return _0x7d6e91[_0xabbe('0x46')](_0x73bbdd);}})[_0xabbe('0x1e')](function(_0x412b75){if(_0x412b75){return _0x412b75?{'count':_0x11900b,'rows':_0x412b75}:null;}})['then'](respondWithResult(_0x336d5f,null))[_0xabbe('0x3b')](handleError(_0x336d5f,null));}; \ No newline at end of file +var _0x45a6=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count','json','reject','save','then','end','error','name','send','index','map','Dynamics365Configuration','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','type','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','create','body','update','find','getFields','findOne','Dynamics365Field','pick','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../config/license/hardware'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x45a6,0x8b));var _0x645a=function(_0x1e59b7,_0xa274ee){_0x1e59b7=_0x1e59b7-0x0;var _0x4f1758=_0x45a6[_0x1e59b7];return _0x4f1758;};'use strict';var emlformat=require(_0x645a('0x0'));var rimraf=require(_0x645a('0x1'));var zipdir=require(_0x645a('0x2'));var jsonpatch=require(_0x645a('0x3'));var rp=require(_0x645a('0x4'));var moment=require(_0x645a('0x5'));var BPromise=require(_0x645a('0x6'));var Mustache=require(_0x645a('0x7'));var util=require(_0x645a('0x8'));var path=require('path');var sox=require(_0x645a('0x9'));var csv=require(_0x645a('0xa'));var ejs=require(_0x645a('0xb'));var fs=require('fs');var fs_extra=require(_0x645a('0xc'));var _=require(_0x645a('0xd'));var squel=require(_0x645a('0xe'));var crypto=require(_0x645a('0xf'));var jsforce=require(_0x645a('0x10'));var deskjs=require(_0x645a('0x11'));var toCsv=require('to-csv');var querystring=require(_0x645a('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x645a('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x645a('0x14'));var logger=require(_0x645a('0x15'))(_0x645a('0x16'));var utils=require(_0x645a('0x17'));var config=require(_0x645a('0x18'));var licenseUtil=require(_0x645a('0x19'));var db=require(_0x645a('0x1a'))['db'];function respondWithStatusCode(_0x350065,_0x598973){_0x598973=_0x598973||0xcc;return function(_0x4989d5){if(_0x4989d5){return _0x350065['sendStatus'](_0x598973);}return _0x350065[_0x645a('0x1b')](_0x598973)['end']();};}function respondWithResult(_0x52c503,_0x4f10b5){_0x4f10b5=_0x4f10b5||0xc8;return function(_0x3bea73){if(_0x3bea73){return _0x52c503['status'](_0x4f10b5)['json'](_0x3bea73);}};}function respondWithFilteredResult(_0x28289f,_0x2fd041){return function(_0x2fede0){if(_0x2fede0){var _0x3a5c34=typeof _0x2fd041[_0x645a('0x1c')]===_0x645a('0x1d')&&typeof _0x2fd041[_0x645a('0x1e')]==='undefined';var _0x10978b=_0x2fede0[_0x645a('0x1f')];var _0x4e9144=_0x3a5c34?0x0:_0x2fd041[_0x645a('0x1c')];var _0x5c7a4e=_0x3a5c34?_0x2fede0[_0x645a('0x1f')]:_0x2fd041[_0x645a('0x1c')]+_0x2fd041['limit'];var _0xf51847;if(_0x5c7a4e>=_0x10978b){_0x5c7a4e=_0x10978b;_0xf51847=0xc8;}else{_0xf51847=0xce;}_0x28289f['status'](_0xf51847);return _0x28289f['set']('Content-Range',_0x4e9144+'-'+_0x5c7a4e+'/'+_0x10978b)[_0x645a('0x20')](_0x2fede0);}return null;};}function patchUpdates(_0x280391){return function(_0x5a21a6){try{jsonpatch['apply'](_0x5a21a6,_0x280391,!![]);}catch(_0x4f0760){return BPromise[_0x645a('0x21')](_0x4f0760);}return _0x5a21a6[_0x645a('0x22')]();};}function saveUpdates(_0x1c08c2,_0x6bf1ed){return function(_0x53c5f8){if(_0x53c5f8){return _0x53c5f8['update'](_0x1c08c2)[_0x645a('0x23')](function(_0x264ed2){return _0x264ed2;});}return null;};}function removeEntity(_0x4caeba,_0x42eea9){return function(_0x15737b){if(_0x15737b){return _0x15737b['destroy']()[_0x645a('0x23')](function(){_0x4caeba[_0x645a('0x1b')](0xcc)[_0x645a('0x24')]();});}};}function handleEntityNotFound(_0x2ad3c7,_0x20b138){return function(_0x4ec1a5){if(!_0x4ec1a5){_0x2ad3c7['sendStatus'](0x194);}return _0x4ec1a5;};}function handleError(_0x397215,_0x512611){_0x512611=_0x512611||0x1f4;return function(_0x311000){logger[_0x645a('0x25')](_0x311000['stack']);if(_0x311000['name']){delete _0x311000[_0x645a('0x26')];}_0x397215[_0x645a('0x1b')](_0x512611)[_0x645a('0x27')](_0x311000);};}exports[_0x645a('0x28')]=function(_0x3494dc,_0x8bb41){var _0x3daf9b={},_0x22b6cb={},_0xa858c4={'count':0x0,'rows':[]};var _0x210d5f=_[_0x645a('0x29')](db[_0x645a('0x2a')][_0x645a('0x2b')],function(_0xa25c9){return{'name':_0xa25c9[_0x645a('0x2c')],'type':_0xa25c9['type'][_0x645a('0x2d')]};});_0x22b6cb[_0x645a('0x2e')]=_[_0x645a('0x29')](_0x210d5f,_0x645a('0x26'));_0x22b6cb[_0x645a('0x2f')]=_[_0x645a('0x30')](_0x3494dc[_0x645a('0x2f')]);_0x22b6cb[_0x645a('0x31')]=_[_0x645a('0x32')](_0x22b6cb[_0x645a('0x2e')],_0x22b6cb[_0x645a('0x2f')]);_0x3daf9b[_0x645a('0x33')]=_[_0x645a('0x32')](_0x22b6cb[_0x645a('0x2e')],qs[_0x645a('0x34')](_0x3494dc[_0x645a('0x2f')][_0x645a('0x34')]));_0x3daf9b[_0x645a('0x33')]=_0x3daf9b[_0x645a('0x33')][_0x645a('0x35')]?_0x3daf9b['attributes']:_0x22b6cb[_0x645a('0x2e')];if(!_0x3494dc[_0x645a('0x2f')][_0x645a('0x36')](_0x645a('0x37'))){_0x3daf9b[_0x645a('0x1e')]=qs[_0x645a('0x1e')](_0x3494dc[_0x645a('0x2f')][_0x645a('0x1e')]);_0x3daf9b[_0x645a('0x1c')]=qs[_0x645a('0x1c')](_0x3494dc['query'][_0x645a('0x1c')]);}_0x3daf9b[_0x645a('0x38')]=qs[_0x645a('0x39')](_0x3494dc[_0x645a('0x2f')][_0x645a('0x39')]);_0x3daf9b[_0x645a('0x3a')]=qs[_0x645a('0x31')](_['pick'](_0x3494dc[_0x645a('0x2f')],_0x22b6cb[_0x645a('0x31')]),_0x210d5f);if(_0x3494dc[_0x645a('0x2f')][_0x645a('0x3b')]){_0x3daf9b[_0x645a('0x3a')]=_['merge'](_0x3daf9b[_0x645a('0x3a')],{'$or':_[_0x645a('0x29')](_0x210d5f,function(_0xb4cf83){if(_0xb4cf83[_0x645a('0x3c')]!==_0x645a('0x3d')){var _0x1364e0={};_0x1364e0[_0xb4cf83[_0x645a('0x26')]]={'$like':'%'+_0x3494dc[_0x645a('0x2f')][_0x645a('0x3b')]+'%'};return _0x1364e0;}})});}_0x3daf9b=_[_0x645a('0x3e')]({},_0x3daf9b,_0x3494dc[_0x645a('0x3f')]);var _0x3dde5e={'where':_0x3daf9b['where']};return db[_0x645a('0x2a')]['count'](_0x3dde5e)['then'](function(_0x3719d2){_0xa858c4[_0x645a('0x1f')]=_0x3719d2;if(_0x3494dc[_0x645a('0x2f')][_0x645a('0x40')]){_0x3daf9b[_0x645a('0x41')]=[{'all':!![]}];}return db[_0x645a('0x2a')]['findAll'](_0x3daf9b);})[_0x645a('0x23')](function(_0xa29de5){_0xa858c4[_0x645a('0x42')]=_0xa29de5;return _0xa858c4;})[_0x645a('0x23')](respondWithFilteredResult(_0x8bb41,_0x3daf9b))[_0x645a('0x43')](handleError(_0x8bb41,null));};exports[_0x645a('0x44')]=function(_0x1b2976,_0x4150f5){var _0x432a26={'raw':![],'where':{'id':_0x1b2976[_0x645a('0x45')]['id']}},_0x33aafd={};_0x33aafd[_0x645a('0x2e')]=_[_0x645a('0x30')](db['Dynamics365Configuration']['rawAttributes']);_0x33aafd[_0x645a('0x2f')]=_[_0x645a('0x30')](_0x1b2976['query']);_0x33aafd[_0x645a('0x31')]=_[_0x645a('0x32')](_0x33aafd[_0x645a('0x2e')],_0x33aafd[_0x645a('0x2f')]);_0x432a26[_0x645a('0x33')]=_[_0x645a('0x32')](_0x33aafd[_0x645a('0x2e')],qs['fields'](_0x1b2976[_0x645a('0x2f')][_0x645a('0x34')]));_0x432a26[_0x645a('0x33')]=_0x432a26[_0x645a('0x33')]['length']?_0x432a26[_0x645a('0x33')]:_0x33aafd['model'];if(_0x1b2976[_0x645a('0x2f')][_0x645a('0x40')]){_0x432a26[_0x645a('0x41')]=[{'all':!![]}];}_0x432a26=_[_0x645a('0x3e')]({},_0x432a26,_0x1b2976[_0x645a('0x3f')]);return db[_0x645a('0x2a')]['find'](_0x432a26)[_0x645a('0x23')](handleEntityNotFound(_0x4150f5,null))[_0x645a('0x23')](respondWithResult(_0x4150f5,null))[_0x645a('0x43')](handleError(_0x4150f5,null));};exports[_0x645a('0x46')]=function(_0x2cf7bc,_0x254e86){return db[_0x645a('0x2a')][_0x645a('0x46')](_0x2cf7bc[_0x645a('0x47')],{})['then'](respondWithResult(_0x254e86,0xc9))['catch'](handleError(_0x254e86,null));};exports[_0x645a('0x48')]=function(_0x13c786,_0x55b3fc){if(_0x13c786[_0x645a('0x47')]['id']){delete _0x13c786[_0x645a('0x47')]['id'];}return db[_0x645a('0x2a')][_0x645a('0x49')]({'where':{'id':_0x13c786[_0x645a('0x45')]['id']}})[_0x645a('0x23')](handleEntityNotFound(_0x55b3fc,null))[_0x645a('0x23')](saveUpdates(_0x13c786[_0x645a('0x47')],null))[_0x645a('0x23')](respondWithResult(_0x55b3fc,null))[_0x645a('0x43')](handleError(_0x55b3fc,null));};exports['destroy']=function(_0x2a124f,_0x261614){return db[_0x645a('0x2a')][_0x645a('0x49')]({'where':{'id':_0x2a124f[_0x645a('0x45')]['id']}})['then'](handleEntityNotFound(_0x261614,null))['then'](removeEntity(_0x261614,null))[_0x645a('0x43')](handleError(_0x261614,null));};exports[_0x645a('0x4a')]=function(_0x25d2d0,_0x27d13b,_0x4fd13e){var _0x199426={};var _0x89b413={};var _0x2b6030;var _0x619a80;return db[_0x645a('0x2a')][_0x645a('0x4b')]({'where':{'id':_0x25d2d0[_0x645a('0x45')]['id']}})['then'](handleEntityNotFound(_0x27d13b,null))[_0x645a('0x23')](function(_0x18e8a8){if(_0x18e8a8){_0x2b6030=_0x18e8a8;_0x89b413[_0x645a('0x2e')]=_[_0x645a('0x30')](db[_0x645a('0x4c')][_0x645a('0x2b')]);_0x89b413[_0x645a('0x2f')]=_[_0x645a('0x30')](_0x25d2d0['query']);_0x89b413[_0x645a('0x31')]=_[_0x645a('0x32')](_0x89b413[_0x645a('0x2e')],_0x89b413[_0x645a('0x2f')]);_0x199426[_0x645a('0x33')]=_[_0x645a('0x32')](_0x89b413['model'],qs[_0x645a('0x34')](_0x25d2d0[_0x645a('0x2f')][_0x645a('0x34')]));_0x199426[_0x645a('0x33')]=_0x199426[_0x645a('0x33')][_0x645a('0x35')]?_0x199426['attributes']:_0x89b413[_0x645a('0x2e')];_0x199426[_0x645a('0x38')]=qs[_0x645a('0x39')](_0x25d2d0[_0x645a('0x2f')][_0x645a('0x39')]);_0x199426[_0x645a('0x3a')]=qs['filters'](_[_0x645a('0x4d')](_0x25d2d0[_0x645a('0x2f')],_0x89b413['filters']));if(_0x25d2d0[_0x645a('0x2f')][_0x645a('0x3b')]){_0x199426[_0x645a('0x3a')]=_[_0x645a('0x3e')](_0x199426[_0x645a('0x3a')],{'$or':_['map'](_0x199426['attributes'],function(_0x161c2c){var _0x481d41={};_0x481d41[_0x161c2c]={'$like':'%'+_0x25d2d0[_0x645a('0x2f')][_0x645a('0x3b')]+'%'};return _0x481d41;})});}_0x199426=_[_0x645a('0x3e')]({},_0x199426,_0x25d2d0[_0x645a('0x3f')]);return _0x2b6030[_0x645a('0x4a')](_0x199426);}})['then'](function(_0x23f249){if(_0x23f249){_0x619a80=_0x23f249[_0x645a('0x35')];if(!_0x25d2d0[_0x645a('0x2f')]['hasOwnProperty'](_0x645a('0x37'))){_0x199426[_0x645a('0x1e')]=qs[_0x645a('0x1e')](_0x25d2d0[_0x645a('0x2f')][_0x645a('0x1e')]);_0x199426['offset']=qs[_0x645a('0x1c')](_0x25d2d0[_0x645a('0x2f')][_0x645a('0x1c')]);}return _0x2b6030['getFields'](_0x199426);}})['then'](function(_0x1df9f7){if(_0x1df9f7){return _0x1df9f7?{'count':_0x619a80,'rows':_0x1df9f7}:null;}})[_0x645a('0x23')](respondWithResult(_0x27d13b,null))[_0x645a('0x43')](handleError(_0x27d13b,null));};exports[_0x645a('0x4e')]=function(_0x1e7190,_0x3bfb37,_0x120ca9){var _0x11c6b6={};var _0x273067={};var _0x20cbf0;var _0x4b404c;return db[_0x645a('0x2a')][_0x645a('0x4b')]({'where':{'id':_0x1e7190[_0x645a('0x45')]['id']}})['then'](handleEntityNotFound(_0x3bfb37,null))['then'](function(_0x1c6a04){if(_0x1c6a04){_0x20cbf0=_0x1c6a04;_0x273067['model']=_[_0x645a('0x30')](db[_0x645a('0x4c')][_0x645a('0x2b')]);_0x273067[_0x645a('0x2f')]=_[_0x645a('0x30')](_0x1e7190[_0x645a('0x2f')]);_0x273067['filters']=_[_0x645a('0x32')](_0x273067['model'],_0x273067['query']);_0x11c6b6[_0x645a('0x33')]=_[_0x645a('0x32')](_0x273067[_0x645a('0x2e')],qs[_0x645a('0x34')](_0x1e7190[_0x645a('0x2f')][_0x645a('0x34')]));_0x11c6b6[_0x645a('0x33')]=_0x11c6b6[_0x645a('0x33')]['length']?_0x11c6b6[_0x645a('0x33')]:_0x273067['model'];_0x11c6b6[_0x645a('0x38')]=qs[_0x645a('0x39')](_0x1e7190['query'][_0x645a('0x39')]);_0x11c6b6[_0x645a('0x3a')]=qs[_0x645a('0x31')](_['pick'](_0x1e7190[_0x645a('0x2f')],_0x273067['filters']));if(_0x1e7190[_0x645a('0x2f')][_0x645a('0x3b')]){_0x11c6b6[_0x645a('0x3a')]=_['merge'](_0x11c6b6[_0x645a('0x3a')],{'$or':_[_0x645a('0x29')](_0x11c6b6[_0x645a('0x33')],function(_0x4dbf91){var _0x309037={};_0x309037[_0x4dbf91]={'$like':'%'+_0x1e7190[_0x645a('0x2f')][_0x645a('0x3b')]+'%'};return _0x309037;})});}_0x11c6b6=_[_0x645a('0x3e')]({},_0x11c6b6,_0x1e7190[_0x645a('0x3f')]);return _0x20cbf0['getSubjects'](_0x11c6b6);}})['then'](function(_0x58e3ea){if(_0x58e3ea){_0x4b404c=_0x58e3ea[_0x645a('0x35')];if(!_0x1e7190[_0x645a('0x2f')][_0x645a('0x36')](_0x645a('0x37'))){_0x11c6b6[_0x645a('0x1e')]=qs[_0x645a('0x1e')](_0x1e7190[_0x645a('0x2f')][_0x645a('0x1e')]);_0x11c6b6[_0x645a('0x1c')]=qs[_0x645a('0x1c')](_0x1e7190[_0x645a('0x2f')][_0x645a('0x1c')]);}return _0x20cbf0[_0x645a('0x4e')](_0x11c6b6);}})[_0x645a('0x23')](function(_0x5677f2){if(_0x5677f2){return _0x5677f2?{'count':_0x4b404c,'rows':_0x5677f2}:null;}})[_0x645a('0x23')](respondWithResult(_0x3bfb37,null))[_0x645a('0x43')](handleError(_0x3bfb37,null));};exports[_0x645a('0x4f')]=function(_0x5d658c,_0x17795b,_0x1038c6){var _0x3712ac={};var _0x2d6f0f={};var _0x512c7c;var _0x423581;return db[_0x645a('0x2a')][_0x645a('0x4b')]({'where':{'id':_0x5d658c[_0x645a('0x45')]['id']}})[_0x645a('0x23')](handleEntityNotFound(_0x17795b,null))['then'](function(_0x4d328e){if(_0x4d328e){_0x512c7c=_0x4d328e;_0x2d6f0f[_0x645a('0x2e')]=_[_0x645a('0x30')](db['Dynamics365Field'][_0x645a('0x2b')]);_0x2d6f0f['query']=_[_0x645a('0x30')](_0x5d658c['query']);_0x2d6f0f[_0x645a('0x31')]=_['intersection'](_0x2d6f0f['model'],_0x2d6f0f[_0x645a('0x2f')]);_0x3712ac[_0x645a('0x33')]=_['intersection'](_0x2d6f0f[_0x645a('0x2e')],qs[_0x645a('0x34')](_0x5d658c[_0x645a('0x2f')]['fields']));_0x3712ac[_0x645a('0x33')]=_0x3712ac[_0x645a('0x33')][_0x645a('0x35')]?_0x3712ac[_0x645a('0x33')]:_0x2d6f0f[_0x645a('0x2e')];_0x3712ac[_0x645a('0x38')]=qs[_0x645a('0x39')](_0x5d658c[_0x645a('0x2f')]['sort']);_0x3712ac[_0x645a('0x3a')]=qs['filters'](_['pick'](_0x5d658c[_0x645a('0x2f')],_0x2d6f0f['filters']));if(_0x5d658c[_0x645a('0x2f')]['filter']){_0x3712ac[_0x645a('0x3a')]=_[_0x645a('0x3e')](_0x3712ac[_0x645a('0x3a')],{'$or':_[_0x645a('0x29')](_0x3712ac[_0x645a('0x33')],function(_0x51644d){var _0x4d2079={};_0x4d2079[_0x51644d]={'$like':'%'+_0x5d658c[_0x645a('0x2f')][_0x645a('0x3b')]+'%'};return _0x4d2079;})});}_0x3712ac=_[_0x645a('0x3e')]({},_0x3712ac,_0x5d658c[_0x645a('0x3f')]);return _0x512c7c[_0x645a('0x4f')](_0x3712ac);}})[_0x645a('0x23')](function(_0x4b7203){if(_0x4b7203){_0x423581=_0x4b7203[_0x645a('0x35')];if(!_0x5d658c['query'][_0x645a('0x36')]('nolimit')){_0x3712ac[_0x645a('0x1e')]=qs[_0x645a('0x1e')](_0x5d658c[_0x645a('0x2f')][_0x645a('0x1e')]);_0x3712ac['offset']=qs['offset'](_0x5d658c['query'][_0x645a('0x1c')]);}return _0x512c7c['getDescriptions'](_0x3712ac);}})[_0x645a('0x23')](function(_0x1fa0ad){if(_0x1fa0ad){return _0x1fa0ad?{'count':_0x423581,'rows':_0x1fa0ad}:null;}})[_0x645a('0x23')](respondWithResult(_0x17795b,null))[_0x645a('0x43')](handleError(_0x17795b,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 3ef9d42..45c0965 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 _0x55ca=['./intDynamics365Configuration.attributes','exports','define','int_dynamics365_configurations','lodash','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x3a04ab,_0x31b9fd){var _0x4bff6d=function(_0x125f7e){while(--_0x125f7e){_0x3a04ab['push'](_0x3a04ab['shift']());}};_0x4bff6d(++_0x31b9fd);}(_0x55ca,0x126));var _0xa55c=function(_0x480843,_0x8121e6){_0x480843=_0x480843-0x0;var _0x1d5cd9=_0x55ca[_0x480843];return _0x1d5cd9;};'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')]('Dynamics365Configuration',attributes,{'tableName':_0xa55c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9f62=['api','moment','bluebird','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','int_dynamics365_configurations','util'];(function(_0x89fe46,_0x43b563){var _0x580657=function(_0x47c902){while(--_0x47c902){_0x89fe46['push'](_0x89fe46['shift']());}};_0x580657(++_0x43b563);}(_0x9f62,0x154));var _0x29f6=function(_0x235d51,_0x369d66){_0x235d51=_0x235d51-0x0;var _0x2faa25=_0x9f62[_0x235d51];return _0x2faa25;};'use strict';var _=require('lodash');var util=require(_0x29f6('0x0'));var logger=require('../../config/logger')(_0x29f6('0x1'));var moment=require(_0x29f6('0x2'));var BPromise=require(_0x29f6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x29f6('0x4'));var config=require(_0x29f6('0x5'));var attributes=require(_0x29f6('0x6'));module[_0x29f6('0x7')]=function(_0x595034,_0xf66137){return _0x595034[_0x29f6('0x8')](_0x29f6('0x9'),attributes,{'tableName':_0x29f6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index 454b8d5..9cf06ae 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 _0x0ae2=['http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x55cd17,_0x415c26){var _0x9a1dad=function(_0x25d601){while(--_0x25d601){_0x55cd17['push'](_0x55cd17['shift']());}};_0x9a1dad(++_0x415c26);}(_0x0ae2,0x1c4));var _0x20ae=function(_0x493a51,_0x45128c){_0x493a51=_0x493a51-0x0;var _0xc85756=_0x0ae2[_0x493a51];return _0xc85756;};'use strict';var _=require('lodash');var util=require(_0x20ae('0x0'));var moment=require(_0x20ae('0x1'));var BPromise=require(_0x20ae('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x20ae('0x3'));var db=require(_0x20ae('0x4'))['db'];var utils=require(_0x20ae('0x5'));var logger=require(_0x20ae('0x6'))('rpc');var config=require(_0x20ae('0x7'));var jayson=require(_0x20ae('0x8'));var client=jayson[_0x20ae('0x9')][_0x20ae('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4908bf,_0x32e7b5,_0x35adc4){return new BPromise(function(_0x3d8fe6,_0x1a6b01){return client[_0x20ae('0xb')](_0x4908bf,_0x35adc4)[_0x20ae('0xc')](function(_0x4a0824){logger[_0x20ae('0xd')](_0x20ae('0xe'),_0x32e7b5,_0x20ae('0xf'));logger[_0x20ae('0x10')](_0x20ae('0x11'),_0x32e7b5,_0x20ae('0xf'),JSON[_0x20ae('0x12')](_0x4a0824));if(_0x4a0824[_0x20ae('0x13')]){if(_0x4a0824[_0x20ae('0x13')][_0x20ae('0x14')]===0x1f4){logger[_0x20ae('0x13')](_0x20ae('0xe'),_0x32e7b5,_0x4a0824['error'][_0x20ae('0x15')]);return _0x1a6b01(_0x4a0824[_0x20ae('0x13')]['message']);}logger[_0x20ae('0x13')](_0x20ae('0xe'),_0x32e7b5,_0x4a0824[_0x20ae('0x13')][_0x20ae('0x15')]);return _0x3d8fe6(_0x4a0824['error'][_0x20ae('0x15')]);}else{logger['info'](_0x20ae('0xe'),_0x32e7b5,_0x20ae('0xf'));_0x3d8fe6(_0x4a0824['result'][_0x20ae('0x15')]);}})['catch'](function(_0x5d916e){logger[_0x20ae('0x13')](_0x20ae('0xe'),_0x32e7b5,_0x5d916e);_0x1a6b01(_0x5d916e);});});} \ No newline at end of file +var _0x1cf5=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','request\x20sent','debug','error','code','Dynamics365Configuration,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird'];(function(_0x168746,_0x6de357){var _0x17e44b=function(_0x429f30){while(--_0x429f30){_0x168746['push'](_0x168746['shift']());}};_0x17e44b(++_0x6de357);}(_0x1cf5,0x11a));var _0x51cf=function(_0x4fbdc0,_0x5bf025){_0x4fbdc0=_0x4fbdc0-0x0;var _0x2ed5b4=_0x1cf5[_0x4fbdc0];return _0x2ed5b4;};'use strict';var _=require(_0x51cf('0x0'));var util=require(_0x51cf('0x1'));var moment=require(_0x51cf('0x2'));var BPromise=require(_0x51cf('0x3'));var rs=require(_0x51cf('0x4'));var fs=require('fs');var Redis=require(_0x51cf('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x51cf('0x6'));var logger=require(_0x51cf('0x7'))(_0x51cf('0x8'));var config=require(_0x51cf('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x51cf('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x36222d,_0x350ba4,_0x4b2bb0){return new BPromise(function(_0x21d6d9,_0x5eeafc){return client[_0x51cf('0xb')](_0x36222d,_0x4b2bb0)[_0x51cf('0xc')](function(_0x544a8a){logger['info']('Dynamics365Configuration,\x20%s,\x20%s',_0x350ba4,_0x51cf('0xd'));logger[_0x51cf('0xe')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x350ba4,_0x51cf('0xd'),JSON['stringify'](_0x544a8a));if(_0x544a8a[_0x51cf('0xf')]){if(_0x544a8a[_0x51cf('0xf')][_0x51cf('0x10')]===0x1f4){logger['error'](_0x51cf('0x11'),_0x350ba4,_0x544a8a['error'][_0x51cf('0x12')]);return _0x5eeafc(_0x544a8a[_0x51cf('0xf')][_0x51cf('0x12')]);}logger[_0x51cf('0xf')](_0x51cf('0x11'),_0x350ba4,_0x544a8a[_0x51cf('0xf')][_0x51cf('0x12')]);return _0x21d6d9(_0x544a8a[_0x51cf('0xf')]['message']);}else{logger[_0x51cf('0x13')](_0x51cf('0x11'),_0x350ba4,_0x51cf('0xd'));_0x21d6d9(_0x544a8a[_0x51cf('0x14')][_0x51cf('0x12')]);}})[_0x51cf('0x15')](function(_0x349212){logger[_0x51cf('0xf')](_0x51cf('0x11'),_0x350ba4,_0x349212);_0x5eeafc(_0x349212);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index e4947da..021a42e 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 _0x48cb=['./intDynamics365Field.controller','index','get','isAuthenticated','show','post','create','put','/:id','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x362d6a,_0x253e0d){var _0x2af49e=function(_0x4a43f8){while(--_0x4a43f8){_0x362d6a['push'](_0x362d6a['shift']());}};_0x2af49e(++_0x253e0d);}(_0x48cb,0x1af));var _0xb48c=function(_0x5ad688,_0x701b42){_0x5ad688=_0x5ad688-0x0;var _0x4eb1e6=_0x48cb[_0x5ad688];return _0x4eb1e6;};'use strict';var multer=require('multer');var util=require(_0xb48c('0x0'));var path=require(_0xb48c('0x1'));var timeout=require(_0xb48c('0x2'));var express=require(_0xb48c('0x3'));var router=express[_0xb48c('0x4')]();var fs_extra=require(_0xb48c('0x5'));var auth=require(_0xb48c('0x6'));var interaction=require(_0xb48c('0x7'));var config=require(_0xb48c('0x8'));var controller=require(_0xb48c('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xb48c('0xa')]);router[_0xb48c('0xb')]('/:id',auth[_0xb48c('0xc')](),controller[_0xb48c('0xd')]);router[_0xb48c('0xe')]('/',auth[_0xb48c('0xc')](),controller[_0xb48c('0xf')]);router[_0xb48c('0x10')](_0xb48c('0x11'),auth[_0xb48c('0xc')](),controller['update']);router[_0xb48c('0x12')](_0xb48c('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0xb48c('0x13')]=router; \ No newline at end of file +var _0xa63e=['/:id','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','index','get','show','put','isAuthenticated','delete'];(function(_0x1176b2,_0x39c5d9){var _0x22beb6=function(_0x349129){while(--_0x349129){_0x1176b2['push'](_0x1176b2['shift']());}};_0x22beb6(++_0x39c5d9);}(_0xa63e,0x146));var _0xea63=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xa63e[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0xea63('0x0'));var util=require(_0xea63('0x1'));var path=require(_0xea63('0x2'));var timeout=require('connect-timeout');var express=require(_0xea63('0x3'));var router=express[_0xea63('0x4')]();var fs_extra=require(_0xea63('0x5'));var auth=require(_0xea63('0x6'));var interaction=require(_0xea63('0x7'));var config=require(_0xea63('0x8'));var controller=require(_0xea63('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xea63('0xa')]);router[_0xea63('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xea63('0xc')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xea63('0xd')]('/:id',auth[_0xea63('0xe')](),controller['update']);router[_0xea63('0xf')](_0xea63('0x10'),auth['isAuthenticated'](),controller[_0xea63('0x11')]);module[_0xea63('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index f476a23..95d05e5 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 _0x3f13=['picklist','STRING','BOOLEAN','exports','ENUM','string','variable','customVariable'];(function(_0x4d6bd4,_0x54a00d){var _0x446e40=function(_0x2f0613){while(--_0x2f0613){_0x4d6bd4['push'](_0x4d6bd4['shift']());}};_0x446e40(++_0x54a00d);}(_0x3f13,0x1d3));var _0x33f1=function(_0xbf34fd,_0xaa62df){_0xbf34fd=_0xbf34fd-0x0;var _0x4b6dfa=_0x3f13[_0xbf34fd];return _0x4b6dfa;};'use strict';var Sequelize=require('sequelize');module[_0x33f1('0x0')]={'type':{'type':Sequelize[_0x33f1('0x1')](_0x33f1('0x2'),_0x33f1('0x3'),_0x33f1('0x4'),'keyValue',_0x33f1('0x5')),'defaultValue':_0x33f1('0x2')},'content':{'type':Sequelize[_0x33f1('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x33f1('0x1')]('string',_0x33f1('0x3'),_0x33f1('0x4'))},'keyContent':{'type':Sequelize[_0x33f1('0x6')]},'idField':{'type':Sequelize[_0x33f1('0x6')]},'nameField':{'type':Sequelize[_0x33f1('0x6')]},'customField':{'type':Sequelize[_0x33f1('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xfb86=['ENUM','string','customVariable','picklist','STRING','variable','BOOLEAN','sequelize','exports'];(function(_0x4c01a9,_0x196844){var _0x1ef171=function(_0x34fd2a){while(--_0x34fd2a){_0x4c01a9['push'](_0x4c01a9['shift']());}};_0x1ef171(++_0x196844);}(_0xfb86,0x19c));var _0x6fb8=function(_0x41cda5,_0x3d62e8){_0x41cda5=_0x41cda5-0x0;var _0x5890a1=_0xfb86[_0x41cda5];return _0x5890a1;};'use strict';var Sequelize=require(_0x6fb8('0x0'));module[_0x6fb8('0x1')]={'type':{'type':Sequelize[_0x6fb8('0x2')](_0x6fb8('0x3'),'variable',_0x6fb8('0x4'),'keyValue',_0x6fb8('0x5')),'defaultValue':_0x6fb8('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x6fb8('0x6')]},'keyType':{'type':Sequelize[_0x6fb8('0x2')](_0x6fb8('0x3'),_0x6fb8('0x7'),_0x6fb8('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x6fb8('0x6')]},'nameField':{'type':Sequelize[_0x6fb8('0x6')]},'customField':{'type':Sequelize[_0x6fb8('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6fb8('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index bb3e825..da511d5 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 _0x721d=['squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','nolimit','sort','where','pick','filters','filter','VIRTUAL','merge','options','Dynamics365Field','includeAll','include','findAll','rows','catch','show','params','find','create','update','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','sox','to-csv'];(function(_0x27ff4d,_0x41a7d6){var _0x803d72=function(_0x4767cc){while(--_0x4767cc){_0x27ff4d['push'](_0x27ff4d['shift']());}};_0x803d72(++_0x41a7d6);}(_0x721d,0x190));var _0xd721=function(_0x4db561,_0x521d0d){_0x4db561=_0x4db561-0x0;var _0x299980=_0x721d[_0x4db561];return _0x299980;};'use strict';var emlformat=require(_0xd721('0x0'));var rimraf=require(_0xd721('0x1'));var zipdir=require(_0xd721('0x2'));var jsonpatch=require(_0xd721('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd721('0x4'));var Mustache=require(_0xd721('0x5'));var util=require('util');var path=require('path');var sox=require(_0xd721('0x6'));var csv=require(_0xd721('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xd721('0x8'));var crypto=require(_0xd721('0x9'));var jsforce=require(_0xd721('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xd721('0x7'));var querystring=require(_0xd721('0xb'));var Papa=require(_0xd721('0xc'));var Redis=require(_0xd721('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xd721('0xe'));var as=require(_0xd721('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xd721('0x10'));var config=require(_0xd721('0x11'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x194bd8,_0x501008){_0x501008=_0x501008||0xcc;return function(_0x4054d1){if(_0x4054d1){return _0x194bd8[_0xd721('0x12')](_0x501008);}return _0x194bd8[_0xd721('0x13')](_0x501008)[_0xd721('0x14')]();};}function respondWithResult(_0x294db4,_0x80ab05){_0x80ab05=_0x80ab05||0xc8;return function(_0x59a9d6){if(_0x59a9d6){return _0x294db4[_0xd721('0x13')](_0x80ab05)['json'](_0x59a9d6);}};}function respondWithFilteredResult(_0x1255e9,_0x49842c){return function(_0x2a9719){if(_0x2a9719){var _0x3c2c4c=typeof _0x49842c[_0xd721('0x15')]===_0xd721('0x16')&&typeof _0x49842c[_0xd721('0x17')]===_0xd721('0x16');var _0x19cb38=_0x2a9719['count'];var _0x527117=_0x3c2c4c?0x0:_0x49842c[_0xd721('0x15')];var _0x3eff8b=_0x3c2c4c?_0x2a9719[_0xd721('0x18')]:_0x49842c[_0xd721('0x15')]+_0x49842c['limit'];var _0xe15f8;if(_0x3eff8b>=_0x19cb38){_0x3eff8b=_0x19cb38;_0xe15f8=0xc8;}else{_0xe15f8=0xce;}_0x1255e9['status'](_0xe15f8);return _0x1255e9[_0xd721('0x19')](_0xd721('0x1a'),_0x527117+'-'+_0x3eff8b+'/'+_0x19cb38)['json'](_0x2a9719);}return null;};}function patchUpdates(_0x1e0411){return function(_0x5ef760){try{jsonpatch[_0xd721('0x1b')](_0x5ef760,_0x1e0411,!![]);}catch(_0x521f9b){return BPromise[_0xd721('0x1c')](_0x521f9b);}return _0x5ef760[_0xd721('0x1d')]();};}function saveUpdates(_0x47cd42,_0x26af89){return function(_0x277153){if(_0x277153){return _0x277153['update'](_0x47cd42)[_0xd721('0x1e')](function(_0x15c2ea){return _0x15c2ea;});}return null;};}function removeEntity(_0x1855d2,_0x52f860){return function(_0x3786f4){if(_0x3786f4){return _0x3786f4['destroy']()[_0xd721('0x1e')](function(){_0x1855d2[_0xd721('0x13')](0xcc)[_0xd721('0x14')]();});}};}function handleEntityNotFound(_0x36e147,_0x6a2543){return function(_0x55f39d){if(!_0x55f39d){_0x36e147['sendStatus'](0x194);}return _0x55f39d;};}function handleError(_0x2daf66,_0x57e1eb){_0x57e1eb=_0x57e1eb||0x1f4;return function(_0x2da3f6){logger[_0xd721('0x1f')](_0x2da3f6[_0xd721('0x20')]);if(_0x2da3f6[_0xd721('0x21')]){delete _0x2da3f6[_0xd721('0x21')];}_0x2daf66[_0xd721('0x13')](_0x57e1eb)['send'](_0x2da3f6);};}exports[_0xd721('0x22')]=function(_0x265eff,_0x4f0ea2){var _0x2488c0={},_0x28ec08={},_0x150127={'count':0x0,'rows':[]};var _0xf15460=_[_0xd721('0x23')](db['Dynamics365Field'][_0xd721('0x24')],function(_0xb076df){return{'name':_0xb076df[_0xd721('0x25')],'type':_0xb076df[_0xd721('0x26')][_0xd721('0x27')]};});_0x28ec08[_0xd721('0x28')]=_['map'](_0xf15460,_0xd721('0x21'));_0x28ec08['query']=_['keys'](_0x265eff['query']);_0x28ec08['filters']=_['intersection'](_0x28ec08[_0xd721('0x28')],_0x28ec08[_0xd721('0x29')]);_0x2488c0['attributes']=_[_0xd721('0x2a')](_0x28ec08[_0xd721('0x28')],qs[_0xd721('0x2b')](_0x265eff[_0xd721('0x29')][_0xd721('0x2b')]));_0x2488c0[_0xd721('0x2c')]=_0x2488c0[_0xd721('0x2c')][_0xd721('0x2d')]?_0x2488c0['attributes']:_0x28ec08[_0xd721('0x28')];if(!_0x265eff[_0xd721('0x29')]['hasOwnProperty'](_0xd721('0x2e'))){_0x2488c0[_0xd721('0x17')]=qs[_0xd721('0x17')](_0x265eff[_0xd721('0x29')][_0xd721('0x17')]);_0x2488c0[_0xd721('0x15')]=qs[_0xd721('0x15')](_0x265eff[_0xd721('0x29')]['offset']);}_0x2488c0['order']=qs[_0xd721('0x2f')](_0x265eff[_0xd721('0x29')][_0xd721('0x2f')]);_0x2488c0[_0xd721('0x30')]=qs['filters'](_[_0xd721('0x31')](_0x265eff[_0xd721('0x29')],_0x28ec08[_0xd721('0x32')]),_0xf15460);if(_0x265eff[_0xd721('0x29')][_0xd721('0x33')]){_0x2488c0[_0xd721('0x30')]=_['merge'](_0x2488c0[_0xd721('0x30')],{'$or':_[_0xd721('0x23')](_0xf15460,function(_0x4b1e4d){if(_0x4b1e4d[_0xd721('0x26')]!==_0xd721('0x34')){var _0x1020e7={};_0x1020e7[_0x4b1e4d['name']]={'$like':'%'+_0x265eff['query'][_0xd721('0x33')]+'%'};return _0x1020e7;}})});}_0x2488c0=_[_0xd721('0x35')]({},_0x2488c0,_0x265eff[_0xd721('0x36')]);var _0x17d5ce={'where':_0x2488c0[_0xd721('0x30')]};return db[_0xd721('0x37')]['count'](_0x17d5ce)['then'](function(_0x4456cf){_0x150127['count']=_0x4456cf;if(_0x265eff[_0xd721('0x29')][_0xd721('0x38')]){_0x2488c0[_0xd721('0x39')]=[{'all':!![]}];}return db['Dynamics365Field'][_0xd721('0x3a')](_0x2488c0);})[_0xd721('0x1e')](function(_0x438be0){_0x150127[_0xd721('0x3b')]=_0x438be0;return _0x150127;})[_0xd721('0x1e')](respondWithFilteredResult(_0x4f0ea2,_0x2488c0))[_0xd721('0x3c')](handleError(_0x4f0ea2,null));};exports[_0xd721('0x3d')]=function(_0x12bf32,_0x2475f1){var _0xb36a89={'raw':!![],'where':{'id':_0x12bf32[_0xd721('0x3e')]['id']}},_0xe7cf9f={};_0xe7cf9f[_0xd721('0x28')]=_['keys'](db[_0xd721('0x37')]['rawAttributes']);_0xe7cf9f[_0xd721('0x29')]=_['keys'](_0x12bf32[_0xd721('0x29')]);_0xe7cf9f[_0xd721('0x32')]=_[_0xd721('0x2a')](_0xe7cf9f[_0xd721('0x28')],_0xe7cf9f['query']);_0xb36a89[_0xd721('0x2c')]=_[_0xd721('0x2a')](_0xe7cf9f[_0xd721('0x28')],qs[_0xd721('0x2b')](_0x12bf32[_0xd721('0x29')][_0xd721('0x2b')]));_0xb36a89[_0xd721('0x2c')]=_0xb36a89[_0xd721('0x2c')][_0xd721('0x2d')]?_0xb36a89[_0xd721('0x2c')]:_0xe7cf9f[_0xd721('0x28')];if(_0x12bf32[_0xd721('0x29')][_0xd721('0x38')]){_0xb36a89[_0xd721('0x39')]=[{'all':!![]}];}_0xb36a89=_['merge']({},_0xb36a89,_0x12bf32[_0xd721('0x36')]);return db[_0xd721('0x37')][_0xd721('0x3f')](_0xb36a89)['then'](handleEntityNotFound(_0x2475f1,null))[_0xd721('0x1e')](respondWithResult(_0x2475f1,null))[_0xd721('0x3c')](handleError(_0x2475f1,null));};exports[_0xd721('0x40')]=function(_0x44ffea,_0x509dd1){return db['Dynamics365Field'][_0xd721('0x40')](_0x44ffea['body'],{})[_0xd721('0x1e')](respondWithResult(_0x509dd1,0xc9))[_0xd721('0x3c')](handleError(_0x509dd1,null));};exports[_0xd721('0x41')]=function(_0x10b771,_0x1ceda6){if(_0x10b771[_0xd721('0x42')]['id']){delete _0x10b771['body']['id'];}return db[_0xd721('0x37')][_0xd721('0x3f')]({'where':{'id':_0x10b771['params']['id']}})[_0xd721('0x1e')](handleEntityNotFound(_0x1ceda6,null))['then'](saveUpdates(_0x10b771[_0xd721('0x42')],null))[_0xd721('0x1e')](respondWithResult(_0x1ceda6,null))[_0xd721('0x3c')](handleError(_0x1ceda6,null));};exports[_0xd721('0x43')]=function(_0x765ad,_0x2c0a9a){return db[_0xd721('0x37')][_0xd721('0x3f')]({'where':{'id':_0x765ad['params']['id']}})[_0xd721('0x1e')](handleEntityNotFound(_0x2c0a9a,null))[_0xd721('0x1e')](removeEntity(_0x2c0a9a,null))[_0xd721('0x3c')](handleError(_0x2c0a9a,null));}; \ No newline at end of file +var _0x771f=['count','offset','set','Content-Range','apply','save','destroy','then','error','stack','name','send','index','map','Dynamics365Field','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','filter','where','merge','type','VIRTUAL','options','includeAll','include','rows','show','params','keys','find','catch','create','body','update','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','to-csv','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit'];(function(_0x1e6b59,_0x5eca5d){var _0x40d7c5=function(_0x2dd544){while(--_0x2dd544){_0x1e6b59['push'](_0x1e6b59['shift']());}};_0x40d7c5(++_0x5eca5d);}(_0x771f,0x148));var _0xf771=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0x771f[_0xbe200f];return _0x192597;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf771('0x0'));var zipdir=require(_0xf771('0x1'));var jsonpatch=require(_0xf771('0x2'));var rp=require(_0xf771('0x3'));var moment=require(_0xf771('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf771('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xf771('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf771('0x7'));var _=require('lodash');var squel=require(_0xf771('0x8'));var crypto=require(_0xf771('0x9'));var jsforce=require(_0xf771('0xa'));var deskjs=require(_0xf771('0xb'));var toCsv=require(_0xf771('0x6'));var querystring=require('querystring');var Papa=require(_0xf771('0xc'));var Redis=require(_0xf771('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xf771('0xe'));var as=require(_0xf771('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf771('0x10'))(_0xf771('0x11'));var utils=require(_0xf771('0x12'));var config=require(_0xf771('0x13'));var licenseUtil=require(_0xf771('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x53ce19,_0x31b1c3){_0x31b1c3=_0x31b1c3||0xcc;return function(_0xd085d3){if(_0xd085d3){return _0x53ce19[_0xf771('0x15')](_0x31b1c3);}return _0x53ce19[_0xf771('0x16')](_0x31b1c3)[_0xf771('0x17')]();};}function respondWithResult(_0x1a9a60,_0x519d48){_0x519d48=_0x519d48||0xc8;return function(_0x20d65b){if(_0x20d65b){return _0x1a9a60[_0xf771('0x16')](_0x519d48)[_0xf771('0x18')](_0x20d65b);}};}function respondWithFilteredResult(_0x432174,_0x42923c){return function(_0x1cef86){if(_0x1cef86){var _0xadddd1=typeof _0x42923c['offset']===_0xf771('0x19')&&typeof _0x42923c[_0xf771('0x1a')]===_0xf771('0x19');var _0x454653=_0x1cef86[_0xf771('0x1b')];var _0x87f4d9=_0xadddd1?0x0:_0x42923c[_0xf771('0x1c')];var _0x647289=_0xadddd1?_0x1cef86[_0xf771('0x1b')]:_0x42923c[_0xf771('0x1c')]+_0x42923c[_0xf771('0x1a')];var _0x1e9fb4;if(_0x647289>=_0x454653){_0x647289=_0x454653;_0x1e9fb4=0xc8;}else{_0x1e9fb4=0xce;}_0x432174[_0xf771('0x16')](_0x1e9fb4);return _0x432174[_0xf771('0x1d')](_0xf771('0x1e'),_0x87f4d9+'-'+_0x647289+'/'+_0x454653)[_0xf771('0x18')](_0x1cef86);}return null;};}function patchUpdates(_0x5144ac){return function(_0x12829d){try{jsonpatch[_0xf771('0x1f')](_0x12829d,_0x5144ac,!![]);}catch(_0x169fd6){return BPromise['reject'](_0x169fd6);}return _0x12829d[_0xf771('0x20')]();};}function saveUpdates(_0x280309,_0x238e4d){return function(_0xaa198c){if(_0xaa198c){return _0xaa198c['update'](_0x280309)['then'](function(_0x10bebd){return _0x10bebd;});}return null;};}function removeEntity(_0x32f2e8,_0x30029b){return function(_0x1ed9ff){if(_0x1ed9ff){return _0x1ed9ff[_0xf771('0x21')]()[_0xf771('0x22')](function(){_0x32f2e8['status'](0xcc)[_0xf771('0x17')]();});}};}function handleEntityNotFound(_0x2de9cb,_0x411325){return function(_0x24a07e){if(!_0x24a07e){_0x2de9cb[_0xf771('0x15')](0x194);}return _0x24a07e;};}function handleError(_0x47d9e7,_0x44d8fc){_0x44d8fc=_0x44d8fc||0x1f4;return function(_0x365041){logger[_0xf771('0x23')](_0x365041[_0xf771('0x24')]);if(_0x365041[_0xf771('0x25')]){delete _0x365041[_0xf771('0x25')];}_0x47d9e7[_0xf771('0x16')](_0x44d8fc)[_0xf771('0x26')](_0x365041);};}exports[_0xf771('0x27')]=function(_0x5d9cb4,_0x36710a){var _0x783b34={},_0x5c7d1d={},_0x48a6f2={'count':0x0,'rows':[]};var _0x2b45f6=_[_0xf771('0x28')](db[_0xf771('0x29')][_0xf771('0x2a')],function(_0x1d720b){return{'name':_0x1d720b[_0xf771('0x2b')],'type':_0x1d720b['type'][_0xf771('0x2c')]};});_0x5c7d1d[_0xf771('0x2d')]=_['map'](_0x2b45f6,_0xf771('0x25'));_0x5c7d1d[_0xf771('0x2e')]=_['keys'](_0x5d9cb4[_0xf771('0x2e')]);_0x5c7d1d[_0xf771('0x2f')]=_[_0xf771('0x30')](_0x5c7d1d[_0xf771('0x2d')],_0x5c7d1d[_0xf771('0x2e')]);_0x783b34['attributes']=_[_0xf771('0x30')](_0x5c7d1d[_0xf771('0x2d')],qs[_0xf771('0x31')](_0x5d9cb4[_0xf771('0x2e')]['fields']));_0x783b34[_0xf771('0x32')]=_0x783b34['attributes'][_0xf771('0x33')]?_0x783b34['attributes']:_0x5c7d1d[_0xf771('0x2d')];if(!_0x5d9cb4['query'][_0xf771('0x34')]('nolimit')){_0x783b34[_0xf771('0x1a')]=qs[_0xf771('0x1a')](_0x5d9cb4[_0xf771('0x2e')]['limit']);_0x783b34[_0xf771('0x1c')]=qs[_0xf771('0x1c')](_0x5d9cb4[_0xf771('0x2e')]['offset']);}_0x783b34[_0xf771('0x35')]=qs['sort'](_0x5d9cb4[_0xf771('0x2e')]['sort']);_0x783b34['where']=qs[_0xf771('0x2f')](_['pick'](_0x5d9cb4['query'],_0x5c7d1d[_0xf771('0x2f')]),_0x2b45f6);if(_0x5d9cb4[_0xf771('0x2e')][_0xf771('0x36')]){_0x783b34[_0xf771('0x37')]=_[_0xf771('0x38')](_0x783b34['where'],{'$or':_['map'](_0x2b45f6,function(_0x416c23){if(_0x416c23[_0xf771('0x39')]!==_0xf771('0x3a')){var _0x3b268e={};_0x3b268e[_0x416c23[_0xf771('0x25')]]={'$like':'%'+_0x5d9cb4['query'][_0xf771('0x36')]+'%'};return _0x3b268e;}})});}_0x783b34=_[_0xf771('0x38')]({},_0x783b34,_0x5d9cb4[_0xf771('0x3b')]);var _0x20106b={'where':_0x783b34[_0xf771('0x37')]};return db['Dynamics365Field'][_0xf771('0x1b')](_0x20106b)[_0xf771('0x22')](function(_0x370c86){_0x48a6f2[_0xf771('0x1b')]=_0x370c86;if(_0x5d9cb4[_0xf771('0x2e')][_0xf771('0x3c')]){_0x783b34[_0xf771('0x3d')]=[{'all':!![]}];}return db['Dynamics365Field']['findAll'](_0x783b34);})[_0xf771('0x22')](function(_0x2b054c){_0x48a6f2[_0xf771('0x3e')]=_0x2b054c;return _0x48a6f2;})[_0xf771('0x22')](respondWithFilteredResult(_0x36710a,_0x783b34))['catch'](handleError(_0x36710a,null));};exports[_0xf771('0x3f')]=function(_0x193c8a,_0x30cf53){var _0x1f9a0a={'raw':!![],'where':{'id':_0x193c8a[_0xf771('0x40')]['id']}},_0x2721af={};_0x2721af[_0xf771('0x2d')]=_['keys'](db[_0xf771('0x29')][_0xf771('0x2a')]);_0x2721af[_0xf771('0x2e')]=_[_0xf771('0x41')](_0x193c8a[_0xf771('0x2e')]);_0x2721af[_0xf771('0x2f')]=_[_0xf771('0x30')](_0x2721af[_0xf771('0x2d')],_0x2721af[_0xf771('0x2e')]);_0x1f9a0a['attributes']=_[_0xf771('0x30')](_0x2721af[_0xf771('0x2d')],qs[_0xf771('0x31')](_0x193c8a[_0xf771('0x2e')][_0xf771('0x31')]));_0x1f9a0a[_0xf771('0x32')]=_0x1f9a0a[_0xf771('0x32')]['length']?_0x1f9a0a[_0xf771('0x32')]:_0x2721af[_0xf771('0x2d')];if(_0x193c8a['query'][_0xf771('0x3c')]){_0x1f9a0a[_0xf771('0x3d')]=[{'all':!![]}];}_0x1f9a0a=_[_0xf771('0x38')]({},_0x1f9a0a,_0x193c8a['options']);return db[_0xf771('0x29')][_0xf771('0x42')](_0x1f9a0a)['then'](handleEntityNotFound(_0x30cf53,null))[_0xf771('0x22')](respondWithResult(_0x30cf53,null))[_0xf771('0x43')](handleError(_0x30cf53,null));};exports[_0xf771('0x44')]=function(_0x1cfa56,_0x1b9b43){return db['Dynamics365Field'][_0xf771('0x44')](_0x1cfa56[_0xf771('0x45')],{})[_0xf771('0x22')](respondWithResult(_0x1b9b43,0xc9))[_0xf771('0x43')](handleError(_0x1b9b43,null));};exports[_0xf771('0x46')]=function(_0x23b16f,_0x137764){if(_0x23b16f[_0xf771('0x45')]['id']){delete _0x23b16f[_0xf771('0x45')]['id'];}return db[_0xf771('0x29')]['find']({'where':{'id':_0x23b16f[_0xf771('0x40')]['id']}})[_0xf771('0x22')](handleEntityNotFound(_0x137764,null))[_0xf771('0x22')](saveUpdates(_0x23b16f[_0xf771('0x45')],null))[_0xf771('0x22')](respondWithResult(_0x137764,null))['catch'](handleError(_0x137764,null));};exports[_0xf771('0x21')]=function(_0x2edd58,_0x30f702){return db[_0xf771('0x29')]['find']({'where':{'id':_0x2edd58[_0xf771('0x40')]['id']}})[_0xf771('0x22')](handleEntityNotFound(_0x30f702,null))[_0xf771('0x22')](removeEntity(_0x30f702,null))[_0xf771('0x43')](handleError(_0x30f702,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index ed12e2b..ea45fc5 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 _0x0e78=['int_dynamics365_fields','dynamics365_unique_index','idField','moment','bluebird','rimraf','../../config/environment','define','Dynamics365Field'];(function(_0x35d128,_0x545e4e){var _0x416a2b=function(_0x1fb501){while(--_0x1fb501){_0x35d128['push'](_0x35d128['shift']());}};_0x416a2b(++_0x545e4e);}(_0x0e78,0x13e));var _0x80e7=function(_0xbeceef,_0x53887f){_0xbeceef=_0xbeceef-0x0;var _0x1293a8=_0x0e78[_0xbeceef];return _0x1293a8;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x80e7('0x0'));var BPromise=require(_0x80e7('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x80e7('0x2'));var config=require(_0x80e7('0x3'));var attributes=require('./intDynamics365Field.attributes');module['exports']=function(_0x365833,_0x5a8d33){return _0x365833[_0x80e7('0x4')](_0x80e7('0x5'),attributes,{'tableName':_0x80e7('0x6'),'paranoid':![],'indexes':[{'name':_0x80e7('0x7'),'fields':[_0x80e7('0x8'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb6d1=['int_dynamics365_fields','idField','FieldId','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intDynamics365Field.attributes','exports','define','Dynamics365Field'];(function(_0x31e958,_0x5cd548){var _0x44237d=function(_0x368bad){while(--_0x368bad){_0x31e958['push'](_0x31e958['shift']());}};_0x44237d(++_0x5cd548);}(_0xb6d1,0x193));var _0x1b6d=function(_0x54cef6,_0x146b0e){_0x54cef6=_0x54cef6-0x0;var _0x39aacf=_0xb6d1[_0x54cef6];return _0x39aacf;};'use strict';var _=require(_0x1b6d('0x0'));var util=require(_0x1b6d('0x1'));var logger=require(_0x1b6d('0x2'))(_0x1b6d('0x3'));var moment=require(_0x1b6d('0x4'));var BPromise=require('bluebird');var rp=require(_0x1b6d('0x5'));var fs=require('fs');var path=require(_0x1b6d('0x6'));var rimraf=require(_0x1b6d('0x7'));var config=require(_0x1b6d('0x8'));var attributes=require(_0x1b6d('0x9'));module[_0x1b6d('0xa')]=function(_0x1ed873,_0x12f950){return _0x1ed873[_0x1b6d('0xb')](_0x1b6d('0xc'),attributes,{'tableName':_0x1b6d('0xd'),'paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':[_0x1b6d('0xe'),_0x1b6d('0xf')],'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 4e7715a..0faa639 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 _0x43bb=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Field,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x1cfa0d,_0x4391f2){var _0xe33279=function(_0x3ce7c1){while(--_0x3ce7c1){_0x1cfa0d['push'](_0x1cfa0d['shift']());}};_0xe33279(++_0x4391f2);}(_0x43bb,0x116));var _0xb43b=function(_0x100e7d,_0x5bf12d){_0x100e7d=_0x100e7d-0x0;var _0x3b6e91=_0x43bb[_0x100e7d];return _0x3b6e91;};'use strict';var _=require(_0xb43b('0x0'));var util=require(_0xb43b('0x1'));var moment=require(_0xb43b('0x2'));var BPromise=require('bluebird');var rs=require(_0xb43b('0x3'));var fs=require('fs');var Redis=require(_0xb43b('0x4'));var db=require(_0xb43b('0x5'))['db'];var utils=require(_0xb43b('0x6'));var logger=require(_0xb43b('0x7'))(_0xb43b('0x8'));var config=require(_0xb43b('0x9'));var jayson=require(_0xb43b('0xa'));var client=jayson[_0xb43b('0xb')][_0xb43b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2f7ba7,_0x1c7087,_0x48a516){return new BPromise(function(_0x251000,_0x3cc5e5){return client[_0xb43b('0xd')](_0x2f7ba7,_0x48a516)[_0xb43b('0xe')](function(_0x3281fa){logger[_0xb43b('0xf')]('Dynamics365Field,\x20%s,\x20%s',_0x1c7087,_0xb43b('0x10'));logger[_0xb43b('0x11')](_0xb43b('0x12'),_0x1c7087,_0xb43b('0x10'),JSON[_0xb43b('0x13')](_0x3281fa));if(_0x3281fa[_0xb43b('0x14')]){if(_0x3281fa[_0xb43b('0x14')][_0xb43b('0x15')]===0x1f4){logger['error'](_0xb43b('0x16'),_0x1c7087,_0x3281fa[_0xb43b('0x14')]['message']);return _0x3cc5e5(_0x3281fa[_0xb43b('0x14')][_0xb43b('0x17')]);}logger[_0xb43b('0x14')](_0xb43b('0x16'),_0x1c7087,_0x3281fa[_0xb43b('0x14')]['message']);return _0x251000(_0x3281fa[_0xb43b('0x14')][_0xb43b('0x17')]);}else{logger[_0xb43b('0xf')](_0xb43b('0x16'),_0x1c7087,_0xb43b('0x10'));_0x251000(_0x3281fa[_0xb43b('0x18')]['message']);}})[_0xb43b('0x19')](function(_0x45eaee){logger[_0xb43b('0x14')]('Dynamics365Field,\x20%s,\x20%s',_0x1c7087,_0x45eaee);_0x3cc5e5(_0x45eaee);});});} \ No newline at end of file +var _0x260f=['info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x260f,0x94));var _0xf260=function(_0x4a6fb8,_0x1c0e0f){_0x4a6fb8=_0x4a6fb8-0x0;var _0xe92da=_0x260f[_0x4a6fb8];return _0xe92da;};'use strict';var _=require(_0xf260('0x0'));var util=require(_0xf260('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf260('0x2'));var fs=require('fs');var Redis=require(_0xf260('0x3'));var db=require(_0xf260('0x4'))['db'];var utils=require(_0xf260('0x5'));var logger=require(_0xf260('0x6'))(_0xf260('0x7'));var config=require(_0xf260('0x8'));var jayson=require(_0xf260('0x9'));var client=jayson[_0xf260('0xa')][_0xf260('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2ea9f8,_0x28f7b4,_0x5dfe70){return new BPromise(function(_0x16de41,_0x44fbdd){return client['request'](_0x2ea9f8,_0x5dfe70)[_0xf260('0xc')](function(_0x2f0151){logger[_0xf260('0xd')](_0xf260('0xe'),_0x28f7b4,_0xf260('0xf'));logger[_0xf260('0x10')](_0xf260('0x11'),_0x28f7b4,_0xf260('0xf'),JSON['stringify'](_0x2f0151));if(_0x2f0151['error']){if(_0x2f0151[_0xf260('0x12')][_0xf260('0x13')]===0x1f4){logger[_0xf260('0x12')](_0xf260('0xe'),_0x28f7b4,_0x2f0151[_0xf260('0x12')][_0xf260('0x14')]);return _0x44fbdd(_0x2f0151[_0xf260('0x12')][_0xf260('0x14')]);}logger[_0xf260('0x12')](_0xf260('0xe'),_0x28f7b4,_0x2f0151['error'][_0xf260('0x14')]);return _0x16de41(_0x2f0151['error']['message']);}else{logger[_0xf260('0xd')]('Dynamics365Field,\x20%s,\x20%s',_0x28f7b4,_0xf260('0xf'));_0x16de41(_0x2f0151[_0xf260('0x15')][_0xf260('0x14')]);}})[_0xf260('0x16')](function(_0x2b3781){logger['error'](_0xf260('0xe'),_0x28f7b4,_0x2b3781);_0x44fbdd(_0x2b3781);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index aebbca2..80bd8af 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 _0x6b02=['getConfigurations','/:id/fields','getFields','create','post','delete','destroy','exports','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','/:id','/:id/configurations'];(function(_0x116d85,_0x5323a7){var _0x18b9ec=function(_0x498356){while(--_0x498356){_0x116d85['push'](_0x116d85['shift']());}};_0x18b9ec(++_0x5323a7);}(_0x6b02,0x138));var _0x26b0=function(_0x2c90fd,_0x243deb){_0x2c90fd=_0x2c90fd-0x0;var _0x572106=_0x6b02[_0x2c90fd];return _0x572106;};'use strict';var multer=require('multer');var util=require(_0x26b0('0x0'));var path=require('path');var timeout=require(_0x26b0('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x26b0('0x2'));var auth=require(_0x26b0('0x3'));var interaction=require(_0x26b0('0x4'));var config=require(_0x26b0('0x5'));var controller=require(_0x26b0('0x6'));router[_0x26b0('0x7')]('/',auth[_0x26b0('0x8')](),controller['index']);router['get'](_0x26b0('0x9'),auth[_0x26b0('0x8')](),controller['show']);router[_0x26b0('0x7')](_0x26b0('0xa'),auth[_0x26b0('0x8')](),controller[_0x26b0('0xb')]);router[_0x26b0('0x7')](_0x26b0('0xc'),auth[_0x26b0('0x8')](),controller[_0x26b0('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x26b0('0xe')]);router[_0x26b0('0xf')]('/:id/configurations',auth['isAuthenticated'](),controller['addConfiguration']);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x26b0('0x10')]('/:id',auth[_0x26b0('0x8')](),controller[_0x26b0('0x11')]);module[_0x26b0('0x12')]=router; \ No newline at end of file +var _0x9422=['../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1ece15,_0x4dd117){var _0xdfb83=function(_0x276f53){while(--_0x276f53){_0x1ece15['push'](_0x1ece15['shift']());}};_0xdfb83(++_0x4dd117);}(_0x9422,0x156));var _0x2942=function(_0x2b5168,_0x187788){_0x2b5168=_0x2b5168-0x0;var _0x2924b3=_0x9422[_0x2b5168];return _0x2924b3;};'use strict';var multer=require(_0x2942('0x0'));var util=require('util');var path=require(_0x2942('0x1'));var timeout=require(_0x2942('0x2'));var express=require(_0x2942('0x3'));var router=express[_0x2942('0x4')]();var fs_extra=require(_0x2942('0x5'));var auth=require(_0x2942('0x6'));var interaction=require(_0x2942('0x7'));var config=require(_0x2942('0x8'));var controller=require(_0x2942('0x9'));router[_0x2942('0xa')]('/',auth[_0x2942('0xb')](),controller['index']);router[_0x2942('0xa')]('/:id',auth[_0x2942('0xb')](),controller[_0x2942('0xc')]);router['get'](_0x2942('0xd'),auth[_0x2942('0xb')](),controller[_0x2942('0xe')]);router['get'](_0x2942('0xf'),auth[_0x2942('0xb')](),controller['getFields']);router[_0x2942('0x10')]('/',auth[_0x2942('0xb')](),controller[_0x2942('0x11')]);router[_0x2942('0x10')]('/:id/configurations',auth[_0x2942('0xb')](),controller[_0x2942('0x12')]);router[_0x2942('0x13')](_0x2942('0x14'),auth[_0x2942('0xb')](),controller[_0x2942('0x15')]);router[_0x2942('0x16')]('/:id',auth[_0x2942('0xb')](),controller[_0x2942('0x17')]);module[_0x2942('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 adca953..c73a77d 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 _0xb145=['STRING','username','remoteUri','exports'];(function(_0x597c16,_0x2292fe){var _0x30cc2c=function(_0x26cb58){while(--_0x26cb58){_0x597c16['push'](_0x597c16['shift']());}};_0x30cc2c(++_0x2292fe);}(_0xb145,0xa3));var _0x5b14=function(_0x3c7ae3,_0x463d59){_0x3c7ae3=_0x3c7ae3-0x0;var _0x46c514=_0xb145[_0x3c7ae3];return _0x46c514;};'use strict';var Sequelize=require('sequelize');module[_0x5b14('0x0')]={'name':{'type':Sequelize[_0x5b14('0x1')]},'description':{'type':Sequelize[_0x5b14('0x1')]},'username':{'type':Sequelize[_0x5b14('0x1')],'unique':_0x5b14('0x2')},'apiKey':{'type':Sequelize[_0x5b14('0x1')]},'remoteUri':{'type':Sequelize[_0x5b14('0x1')],'unique':_0x5b14('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x68b3=['sequelize','exports','STRING','remoteUri'];(function(_0x47ad1a,_0x467d68){var _0x586211=function(_0x169364){while(--_0x169364){_0x47ad1a['push'](_0x47ad1a['shift']());}};_0x586211(++_0x467d68);}(_0x68b3,0x1d8));var _0x368b=function(_0x1d0b48,_0x1d1f49){_0x1d0b48=_0x1d0b48-0x0;var _0x3e959c=_0x68b3[_0x1d0b48];return _0x3e959c;};'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 diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index b82e840..9e4669d 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 _0x83e1=['lodash','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','update','then','destroy','error','name','send','index','map','FreshdeskAccount','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','where','filter','merge','type','VIRTUAL','include','rows','params','length','includeAll','options','find','create','body','catch','findOne','FreshdeskConfiguration','rawAttributes','sort','pick','getConfigurations','addConfiguration','Subjects','getSubjects','channel','getDescriptions','FreshdeskField','Descriptions','getFields','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','apiKey','base64','subject','agent','description','priority','group','source','company','remove','includes','default','custom_text','label','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','rimraf','fast-json-patch','moment','util','path','fs-extra'];(function(_0x26aed8,_0x54a5f4){var _0x49092c=function(_0x48799b){while(--_0x48799b){_0x26aed8['push'](_0x26aed8['shift']());}};_0x49092c(++_0x54a5f4);}(_0x83e1,0x1ad));var _0x183e=function(_0x237d67,_0x4ff2db){_0x237d67=_0x237d67-0x0;var _0x292dfb=_0x83e1[_0x237d67];return _0x292dfb;};'use strict';var emlformat=require(_0x183e('0x0'));var rimraf=require(_0x183e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x183e('0x2'));var rp=require('request-promise');var moment=require(_0x183e('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x183e('0x4'));var path=require(_0x183e('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x183e('0x6'));var _=require(_0x183e('0x7'));var squel=require(_0x183e('0x8'));var crypto=require('crypto');var jsforce=require(_0x183e('0x9'));var deskjs=require(_0x183e('0xa'));var toCsv=require(_0x183e('0xb'));var querystring=require('querystring');var Papa=require(_0x183e('0xc'));var Redis=require(_0x183e('0xd'));var authService=require(_0x183e('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x183e('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x183e('0x10'))(_0x183e('0x11'));var utils=require(_0x183e('0x12'));var config=require(_0x183e('0x13'));var licenseUtil=require(_0x183e('0x14'));var db=require(_0x183e('0x15'))['db'];var integrations=require(_0x183e('0x16'));function respondWithStatusCode(_0x5b86b3,_0x53e576){_0x53e576=_0x53e576||0xcc;return function(_0x579586){if(_0x579586){return _0x5b86b3[_0x183e('0x17')](_0x53e576);}return _0x5b86b3[_0x183e('0x18')](_0x53e576)[_0x183e('0x19')]();};}function respondWithResult(_0x5d4941,_0x140a70){_0x140a70=_0x140a70||0xc8;return function(_0x17d890){if(_0x17d890){return _0x5d4941[_0x183e('0x18')](_0x140a70)['json'](_0x17d890);}};}function respondWithFilteredResult(_0x8f4af8,_0x35badd){return function(_0x3faadf){if(_0x3faadf){var _0xdbea2c=typeof _0x35badd[_0x183e('0x1a')]===_0x183e('0x1b')&&typeof _0x35badd[_0x183e('0x1c')]===_0x183e('0x1b');var _0x56df78=_0x3faadf[_0x183e('0x1d')];var _0x3adea4=_0xdbea2c?0x0:_0x35badd[_0x183e('0x1a')];var _0x480ce8=_0xdbea2c?_0x3faadf[_0x183e('0x1d')]:_0x35badd[_0x183e('0x1a')]+_0x35badd['limit'];var _0x2a0c76;if(_0x480ce8>=_0x56df78){_0x480ce8=_0x56df78;_0x2a0c76=0xc8;}else{_0x2a0c76=0xce;}_0x8f4af8[_0x183e('0x18')](_0x2a0c76);return _0x8f4af8[_0x183e('0x1e')](_0x183e('0x1f'),_0x3adea4+'-'+_0x480ce8+'/'+_0x56df78)['json'](_0x3faadf);}return null;};}function patchUpdates(_0x4d8102){return function(_0x4a49cc){try{jsonpatch['apply'](_0x4a49cc,_0x4d8102,!![]);}catch(_0x26d29f){return BPromise['reject'](_0x26d29f);}return _0x4a49cc['save']();};}function saveUpdates(_0xc96e61,_0x34a128){return function(_0x455dab){if(_0x455dab){return _0x455dab[_0x183e('0x20')](_0xc96e61)[_0x183e('0x21')](function(_0x4ea291){return _0x4ea291;});}return null;};}function removeEntity(_0x223351,_0x5d6b29){return function(_0x41f74f){if(_0x41f74f){return _0x41f74f[_0x183e('0x22')]()[_0x183e('0x21')](function(){_0x223351[_0x183e('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5eda06,_0x7b9a98){return function(_0x11aace){if(!_0x11aace){_0x5eda06['sendStatus'](0x194);}return _0x11aace;};}function handleError(_0x5457ed,_0x14522f){_0x14522f=_0x14522f||0x1f4;return function(_0x267fff){logger[_0x183e('0x23')](_0x267fff['stack']);if(_0x267fff[_0x183e('0x24')]){delete _0x267fff[_0x183e('0x24')];}_0x5457ed[_0x183e('0x18')](_0x14522f)[_0x183e('0x25')](_0x267fff);};}exports[_0x183e('0x26')]=function(_0x1f8603,_0x2f9657){var _0x1bc636={},_0x4a1d9b={},_0x789776={'count':0x0,'rows':[]};var _0x57fef0=_[_0x183e('0x27')](db[_0x183e('0x28')]['rawAttributes'],function(_0x21db26){return{'name':_0x21db26['fieldName'],'type':_0x21db26['type'][_0x183e('0x29')]};});_0x4a1d9b['model']=_['map'](_0x57fef0,_0x183e('0x24'));_0x4a1d9b[_0x183e('0x2a')]=_[_0x183e('0x2b')](_0x1f8603[_0x183e('0x2a')]);_0x4a1d9b[_0x183e('0x2c')]=_[_0x183e('0x2d')](_0x4a1d9b[_0x183e('0x2e')],_0x4a1d9b['query']);_0x1bc636[_0x183e('0x2f')]=_['intersection'](_0x4a1d9b[_0x183e('0x2e')],qs[_0x183e('0x30')](_0x1f8603['query'][_0x183e('0x30')]));_0x1bc636[_0x183e('0x2f')]=_0x1bc636['attributes']['length']?_0x1bc636[_0x183e('0x2f')]:_0x4a1d9b[_0x183e('0x2e')];if(!_0x1f8603[_0x183e('0x2a')][_0x183e('0x31')](_0x183e('0x32'))){_0x1bc636[_0x183e('0x1c')]=qs['limit'](_0x1f8603[_0x183e('0x2a')]['limit']);_0x1bc636['offset']=qs[_0x183e('0x1a')](_0x1f8603[_0x183e('0x2a')][_0x183e('0x1a')]);}_0x1bc636['order']=qs['sort'](_0x1f8603[_0x183e('0x2a')]['sort']);_0x1bc636[_0x183e('0x33')]=qs[_0x183e('0x2c')](_['pick'](_0x1f8603[_0x183e('0x2a')],_0x4a1d9b[_0x183e('0x2c')]),_0x57fef0);if(_0x1f8603[_0x183e('0x2a')][_0x183e('0x34')]){_0x1bc636[_0x183e('0x33')]=_[_0x183e('0x35')](_0x1bc636[_0x183e('0x33')],{'$or':_[_0x183e('0x27')](_0x57fef0,function(_0x4a8d64){if(_0x4a8d64[_0x183e('0x36')]!==_0x183e('0x37')){var _0x5f2859={};_0x5f2859[_0x4a8d64['name']]={'$like':'%'+_0x1f8603[_0x183e('0x2a')][_0x183e('0x34')]+'%'};return _0x5f2859;}})});}_0x1bc636=_[_0x183e('0x35')]({},_0x1bc636,_0x1f8603['options']);var _0x46f16c={'where':_0x1bc636[_0x183e('0x33')]};return db['FreshdeskAccount'][_0x183e('0x1d')](_0x46f16c)[_0x183e('0x21')](function(_0xc91f94){_0x789776[_0x183e('0x1d')]=_0xc91f94;if(_0x1f8603[_0x183e('0x2a')]['includeAll']){_0x1bc636[_0x183e('0x38')]=[{'all':!![]}];}return db['FreshdeskAccount']['findAll'](_0x1bc636);})[_0x183e('0x21')](function(_0x32e693){_0x789776[_0x183e('0x39')]=_0x32e693;return _0x789776;})['then'](respondWithFilteredResult(_0x2f9657,_0x1bc636))['catch'](handleError(_0x2f9657,null));};exports['show']=function(_0x369abe,_0x347ba4){var _0x503c61={'raw':![],'where':{'id':_0x369abe[_0x183e('0x3a')]['id']}},_0x33547e={};_0x33547e[_0x183e('0x2e')]=_[_0x183e('0x2b')](db[_0x183e('0x28')]['rawAttributes']);_0x33547e[_0x183e('0x2a')]=_['keys'](_0x369abe[_0x183e('0x2a')]);_0x33547e[_0x183e('0x2c')]=_[_0x183e('0x2d')](_0x33547e[_0x183e('0x2e')],_0x33547e[_0x183e('0x2a')]);_0x503c61[_0x183e('0x2f')]=_[_0x183e('0x2d')](_0x33547e[_0x183e('0x2e')],qs[_0x183e('0x30')](_0x369abe[_0x183e('0x2a')][_0x183e('0x30')]));_0x503c61[_0x183e('0x2f')]=_0x503c61[_0x183e('0x2f')][_0x183e('0x3b')]?_0x503c61[_0x183e('0x2f')]:_0x33547e['model'];if(_0x369abe['query'][_0x183e('0x3c')]){_0x503c61[_0x183e('0x38')]=[{'all':!![]}];}_0x503c61=_[_0x183e('0x35')]({},_0x503c61,_0x369abe[_0x183e('0x3d')]);return db[_0x183e('0x28')][_0x183e('0x3e')](_0x503c61)[_0x183e('0x21')](handleEntityNotFound(_0x347ba4,null))[_0x183e('0x21')](respondWithResult(_0x347ba4,null))['catch'](handleError(_0x347ba4,null));};exports[_0x183e('0x3f')]=function(_0x5271ed,_0xb215ee){return db['FreshdeskAccount']['create'](_0x5271ed[_0x183e('0x40')],{})[_0x183e('0x21')](respondWithResult(_0xb215ee,0xc9))[_0x183e('0x41')](handleError(_0xb215ee,null));};exports[_0x183e('0x20')]=function(_0x12e072,_0x2ecc6d){if(_0x12e072[_0x183e('0x40')]['id']){delete _0x12e072[_0x183e('0x40')]['id'];}return db[_0x183e('0x28')][_0x183e('0x3e')]({'where':{'id':_0x12e072[_0x183e('0x3a')]['id']}})[_0x183e('0x21')](handleEntityNotFound(_0x2ecc6d,null))[_0x183e('0x21')](saveUpdates(_0x12e072[_0x183e('0x40')],null))[_0x183e('0x21')](respondWithResult(_0x2ecc6d,null))[_0x183e('0x41')](handleError(_0x2ecc6d,null));};exports[_0x183e('0x22')]=function(_0x4fb219,_0x4bf513){return db['FreshdeskAccount'][_0x183e('0x3e')]({'where':{'id':_0x4fb219['params']['id']}})[_0x183e('0x21')](handleEntityNotFound(_0x4bf513,null))['then'](removeEntity(_0x4bf513,null))[_0x183e('0x41')](handleError(_0x4bf513,null));};exports['getConfigurations']=function(_0x4744d6,_0x2c9068,_0x9d1ca5){var _0x34e60b={};var _0x3af772={};var _0x5b2cba;var _0x4012c2;return db[_0x183e('0x28')][_0x183e('0x42')]({'where':{'id':_0x4744d6[_0x183e('0x3a')]['id']}})[_0x183e('0x21')](handleEntityNotFound(_0x2c9068,null))[_0x183e('0x21')](function(_0x2218d0){if(_0x2218d0){_0x5b2cba=_0x2218d0;_0x3af772[_0x183e('0x2e')]=_['keys'](db[_0x183e('0x43')][_0x183e('0x44')]);_0x3af772[_0x183e('0x2a')]=_[_0x183e('0x2b')](_0x4744d6[_0x183e('0x2a')]);_0x3af772[_0x183e('0x2c')]=_[_0x183e('0x2d')](_0x3af772[_0x183e('0x2e')],_0x3af772[_0x183e('0x2a')]);_0x34e60b['attributes']=_[_0x183e('0x2d')](_0x3af772[_0x183e('0x2e')],qs[_0x183e('0x30')](_0x4744d6['query']['fields']));_0x34e60b['attributes']=_0x34e60b[_0x183e('0x2f')][_0x183e('0x3b')]?_0x34e60b[_0x183e('0x2f')]:_0x3af772['model'];_0x34e60b['order']=qs[_0x183e('0x45')](_0x4744d6[_0x183e('0x2a')][_0x183e('0x45')]);_0x34e60b[_0x183e('0x33')]=qs['filters'](_[_0x183e('0x46')](_0x4744d6[_0x183e('0x2a')],_0x3af772[_0x183e('0x2c')]));if(_0x4744d6[_0x183e('0x2a')]['filter']){_0x34e60b[_0x183e('0x33')]=_[_0x183e('0x35')](_0x34e60b[_0x183e('0x33')],{'$or':_[_0x183e('0x27')](_0x34e60b[_0x183e('0x2f')],function(_0x3952fa){var _0x44d5c6={};_0x44d5c6[_0x3952fa]={'$like':'%'+_0x4744d6[_0x183e('0x2a')][_0x183e('0x34')]+'%'};return _0x44d5c6;})});}_0x34e60b=_[_0x183e('0x35')]({},_0x34e60b,_0x4744d6[_0x183e('0x3d')]);return _0x5b2cba[_0x183e('0x47')](_0x34e60b);}})[_0x183e('0x21')](function(_0x24ad2c){if(_0x24ad2c){_0x4012c2=_0x24ad2c[_0x183e('0x3b')];if(!_0x4744d6[_0x183e('0x2a')]['hasOwnProperty'](_0x183e('0x32'))){_0x34e60b[_0x183e('0x1c')]=qs['limit'](_0x4744d6['query'][_0x183e('0x1c')]);_0x34e60b['offset']=qs[_0x183e('0x1a')](_0x4744d6[_0x183e('0x2a')][_0x183e('0x1a')]);}return _0x5b2cba[_0x183e('0x47')](_0x34e60b);}})[_0x183e('0x21')](function(_0x286e42){if(_0x286e42){return _0x286e42?{'count':_0x4012c2,'rows':_0x286e42}:null;}})[_0x183e('0x21')](respondWithResult(_0x2c9068,null))[_0x183e('0x41')](handleError(_0x2c9068,null));};exports[_0x183e('0x48')]=function(_0x581f80,_0x3d973a,_0x503b0a){if(_0x581f80['body']['id']){delete _0x581f80[_0x183e('0x40')]['id'];}return db[_0x183e('0x28')][_0x183e('0x42')]({'where':{'id':_0x581f80[_0x183e('0x3a')]['id']}})[_0x183e('0x21')](handleEntityNotFound(_0x3d973a,null))[_0x183e('0x21')](function(_0x5470d7){if(_0x5470d7){_0x581f80[_0x183e('0x40')]['AccountId']=_0x5470d7['id'];_0x581f80[_0x183e('0x40')][_0x183e('0x49')]=integrations[_0x183e('0x4a')](_0x581f80[_0x183e('0x40')][_0x183e('0x4b')],_0x581f80['body'][_0x183e('0x36')]);_0x581f80[_0x183e('0x40')]['Descriptions']=integrations[_0x183e('0x4c')](_0x581f80[_0x183e('0x40')][_0x183e('0x4b')],_0x581f80['body'][_0x183e('0x36')]);return db[_0x183e('0x43')][_0x183e('0x3f')](_0x581f80[_0x183e('0x40')],{'include':[{'model':db[_0x183e('0x4d')],'as':_0x183e('0x49')},{'model':db[_0x183e('0x4d')],'as':_0x183e('0x4e')}]});}return null;})[_0x183e('0x21')](respondWithResult(_0x3d973a,null))[_0x183e('0x41')](handleError(_0x3d973a,null));};exports[_0x183e('0x4f')]=function(_0x292645,_0x47e4ec,_0x226149){var _0x5b4ae5='';return db[_0x183e('0x28')][_0x183e('0x42')]({'where':{'id':_0x292645[_0x183e('0x3a')]['id']},'attributes':['id',_0x183e('0x50'),'apiKey']})[_0x183e('0x21')](handleEntityNotFound(_0x47e4ec,null))[_0x183e('0x21')](function(_0x1e66ed){if(_0x1e66ed){_0x5b4ae5=_0x1e66ed[_0x183e('0x50')];var _0x3b41c3=_0x5b4ae5[_0x183e('0x51')](-0x1);if(_0x3b41c3==='/'){_0x5b4ae5=_0x5b4ae5[_0x183e('0x52')](0x0,_0x5b4ae5[_0x183e('0x53')](_0x3b41c3));}return rp({'method':_0x183e('0x54'),'uri':util[_0x183e('0x55')](_0x183e('0x56'),_0x5b4ae5,_0x183e('0x57')),'headers':{'Authorization':util[_0x183e('0x55')](_0x183e('0x58'),new Buffer(util[_0x183e('0x55')]('%s:X',_0x1e66ed[_0x183e('0x59')]))['toString'](_0x183e('0x5a')))},'json':!![]});}})[_0x183e('0x21')](function(_0x1f18a7){if(_0x1f18a7){var _0x2de2ed=['requester',_0x183e('0x5b'),_0x183e('0x5c'),_0x183e('0x5d'),_0x183e('0x18'),_0x183e('0x5e'),_0x183e('0x5f'),_0x183e('0x60'),'ticket_type',_0x183e('0x5f'),_0x183e('0x61')];_[_0x183e('0x62')](_0x1f18a7,function(_0x42193e){return _0x2de2ed[_0x183e('0x63')](_0x42193e[_0x183e('0x24')])||!_0x42193e[_0x183e('0x64')]&&_0x42193e['type']!==_0x183e('0x65')&&_0x42193e[_0x183e('0x36')]!=='custom_dropdown';});return{'count':_0x1f18a7['length'],'rows':_[_0x183e('0x27')](_0x1f18a7,function(_0x2d77f3){return{'id':_0x2d77f3[_0x183e('0x24')],'name':_0x2d77f3[_0x183e('0x66')],'custom':!_0x2d77f3[_0x183e('0x64')],'options':_0x2d77f3['choices']?_['map'](_0x2d77f3[_0x183e('0x67')],function(_0x18ef05){return{'name':_[_0x183e('0x68')](_0x18ef05),'value':_0x18ef05};}):[]};})};}})[_0x183e('0x21')](respondWithResult(_0x47e4ec,null))[_0x183e('0x41')](function(_0x1be377){var _0x2d7d1e=_0x292645['query'][_0x183e('0x69')]?0x1f4:_0x1be377[_0x183e('0x6a')]||0x1f4;logger['error'](_0x183e('0x6b'),_0x183e('0x4f'),_0x2d7d1e,JSON[_0x183e('0x6c')](_0x1be377));delete _0x1be377[_0x183e('0x24')];if(_0x2d7d1e===0x191){_0x2d7d1e=0x190;}_0x47e4ec[_0x183e('0x18')](_0x2d7d1e)['send'](_0x292645[_0x183e('0x2a')][_0x183e('0x69')]?{'message':'Wrong\x20credentials','statusCode':_0x1be377[_0x183e('0x6a')]}:_0x1be377);});}; \ No newline at end of file +var _0xfecd=['keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','where','merge','VIRTUAL','include','findAll','catch','params','includeAll','options','create','body','find','findOne','FreshdeskConfiguration','pick','getConfigurations','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','getFields','remoteUri','apiKey','slice','substring','GET','format','api/v2/ticket_fields','Basic\x20%s','base64','agent','description','group','source','company','remove','includes','default','custom_text','custom_dropdown','label','choices','capitalize','statusCode','test','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','count','limit','reject','update','then','destroy','error','stack','name','index','map','FreshdeskAccount','rawAttributes','fieldName','type','key','model','query'];(function(_0x364948,_0x165b57){var _0x29159d=function(_0x3c33f4){while(--_0x3c33f4){_0x364948['push'](_0x364948['shift']());}};_0x29159d(++_0x165b57);}(_0xfecd,0x107));var _0xdfec=function(_0x9f705c,_0x2d7513){_0x9f705c=_0x9f705c-0x0;var _0x54cf02=_0xfecd[_0x9f705c];return _0x54cf02;};'use strict';var emlformat=require(_0xdfec('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdfec('0x1'));var jsonpatch=require(_0xdfec('0x2'));var rp=require('request-promise');var moment=require(_0xdfec('0x3'));var BPromise=require(_0xdfec('0x4'));var Mustache=require('mustache');var util=require(_0xdfec('0x5'));var path=require('path');var sox=require(_0xdfec('0x6'));var csv=require(_0xdfec('0x7'));var ejs=require(_0xdfec('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdfec('0x9'));var squel=require(_0xdfec('0xa'));var crypto=require(_0xdfec('0xb'));var jsforce=require(_0xdfec('0xc'));var deskjs=require(_0xdfec('0xd'));var toCsv=require('to-csv');var querystring=require(_0xdfec('0xe'));var Papa=require(_0xdfec('0xf'));var Redis=require(_0xdfec('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xdfec('0x11'));var hardwareService=require(_0xdfec('0x12'));var logger=require('../../config/logger')(_0xdfec('0x13'));var utils=require(_0xdfec('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xdfec('0x15'));var db=require('../../mysqldb')['db'];var integrations=require(_0xdfec('0x16'));function respondWithStatusCode(_0x367a3c,_0x2384f5){_0x2384f5=_0x2384f5||0xcc;return function(_0x40bba3){if(_0x40bba3){return _0x367a3c[_0xdfec('0x17')](_0x2384f5);}return _0x367a3c[_0xdfec('0x18')](_0x2384f5)[_0xdfec('0x19')]();};}function respondWithResult(_0x2ccc89,_0x4d7c6e){_0x4d7c6e=_0x4d7c6e||0xc8;return function(_0x299e43){if(_0x299e43){return _0x2ccc89[_0xdfec('0x18')](_0x4d7c6e)['json'](_0x299e43);}};}function respondWithFilteredResult(_0x420e3b,_0x53ef23){return function(_0x2fbbbb){if(_0x2fbbbb){var _0x101342=typeof _0x53ef23[_0xdfec('0x1a')]===_0xdfec('0x1b')&&typeof _0x53ef23['limit']===_0xdfec('0x1b');var _0x39a908=_0x2fbbbb[_0xdfec('0x1c')];var _0x144890=_0x101342?0x0:_0x53ef23[_0xdfec('0x1a')];var _0x5deea6=_0x101342?_0x2fbbbb['count']:_0x53ef23[_0xdfec('0x1a')]+_0x53ef23[_0xdfec('0x1d')];var _0x1d6def;if(_0x5deea6>=_0x39a908){_0x5deea6=_0x39a908;_0x1d6def=0xc8;}else{_0x1d6def=0xce;}_0x420e3b['status'](_0x1d6def);return _0x420e3b['set']('Content-Range',_0x144890+'-'+_0x5deea6+'/'+_0x39a908)['json'](_0x2fbbbb);}return null;};}function patchUpdates(_0xce9faf){return function(_0x42858f){try{jsonpatch['apply'](_0x42858f,_0xce9faf,!![]);}catch(_0xfd3f31){return BPromise[_0xdfec('0x1e')](_0xfd3f31);}return _0x42858f['save']();};}function saveUpdates(_0x23c8fd,_0x4fb633){return function(_0x2ede23){if(_0x2ede23){return _0x2ede23[_0xdfec('0x1f')](_0x23c8fd)[_0xdfec('0x20')](function(_0x1e1c81){return _0x1e1c81;});}return null;};}function removeEntity(_0x405aae,_0x3e29aa){return function(_0x412b26){if(_0x412b26){return _0x412b26[_0xdfec('0x21')]()[_0xdfec('0x20')](function(){_0x405aae[_0xdfec('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16c6a7,_0x511574){return function(_0x3500c6){if(!_0x3500c6){_0x16c6a7[_0xdfec('0x17')](0x194);}return _0x3500c6;};}function handleError(_0x314f98,_0x3b96f1){_0x3b96f1=_0x3b96f1||0x1f4;return function(_0xcf870a){logger[_0xdfec('0x22')](_0xcf870a[_0xdfec('0x23')]);if(_0xcf870a['name']){delete _0xcf870a[_0xdfec('0x24')];}_0x314f98[_0xdfec('0x18')](_0x3b96f1)['send'](_0xcf870a);};}exports[_0xdfec('0x25')]=function(_0x58c46b,_0x5051bd){var _0x71aeae={},_0x289b42={},_0x39b113={'count':0x0,'rows':[]};var _0x173e9b=_[_0xdfec('0x26')](db[_0xdfec('0x27')][_0xdfec('0x28')],function(_0x140bb7){return{'name':_0x140bb7[_0xdfec('0x29')],'type':_0x140bb7[_0xdfec('0x2a')][_0xdfec('0x2b')]};});_0x289b42[_0xdfec('0x2c')]=_['map'](_0x173e9b,_0xdfec('0x24'));_0x289b42[_0xdfec('0x2d')]=_[_0xdfec('0x2e')](_0x58c46b[_0xdfec('0x2d')]);_0x289b42[_0xdfec('0x2f')]=_[_0xdfec('0x30')](_0x289b42[_0xdfec('0x2c')],_0x289b42[_0xdfec('0x2d')]);_0x71aeae[_0xdfec('0x31')]=_['intersection'](_0x289b42['model'],qs[_0xdfec('0x32')](_0x58c46b[_0xdfec('0x2d')][_0xdfec('0x32')]));_0x71aeae[_0xdfec('0x31')]=_0x71aeae[_0xdfec('0x31')][_0xdfec('0x33')]?_0x71aeae['attributes']:_0x289b42['model'];if(!_0x58c46b[_0xdfec('0x2d')][_0xdfec('0x34')](_0xdfec('0x35'))){_0x71aeae[_0xdfec('0x1d')]=qs[_0xdfec('0x1d')](_0x58c46b[_0xdfec('0x2d')][_0xdfec('0x1d')]);_0x71aeae[_0xdfec('0x1a')]=qs[_0xdfec('0x1a')](_0x58c46b[_0xdfec('0x2d')][_0xdfec('0x1a')]);}_0x71aeae['order']=qs[_0xdfec('0x36')](_0x58c46b[_0xdfec('0x2d')][_0xdfec('0x36')]);_0x71aeae['where']=qs[_0xdfec('0x2f')](_['pick'](_0x58c46b[_0xdfec('0x2d')],_0x289b42[_0xdfec('0x2f')]),_0x173e9b);if(_0x58c46b['query'][_0xdfec('0x37')]){_0x71aeae[_0xdfec('0x38')]=_[_0xdfec('0x39')](_0x71aeae[_0xdfec('0x38')],{'$or':_[_0xdfec('0x26')](_0x173e9b,function(_0x2e33b4){if(_0x2e33b4[_0xdfec('0x2a')]!==_0xdfec('0x3a')){var _0x3a033f={};_0x3a033f[_0x2e33b4[_0xdfec('0x24')]]={'$like':'%'+_0x58c46b[_0xdfec('0x2d')][_0xdfec('0x37')]+'%'};return _0x3a033f;}})});}_0x71aeae=_[_0xdfec('0x39')]({},_0x71aeae,_0x58c46b['options']);var _0xd65b6b={'where':_0x71aeae[_0xdfec('0x38')]};return db[_0xdfec('0x27')]['count'](_0xd65b6b)[_0xdfec('0x20')](function(_0x1888d9){_0x39b113[_0xdfec('0x1c')]=_0x1888d9;if(_0x58c46b['query']['includeAll']){_0x71aeae[_0xdfec('0x3b')]=[{'all':!![]}];}return db[_0xdfec('0x27')][_0xdfec('0x3c')](_0x71aeae);})['then'](function(_0x76369b){_0x39b113['rows']=_0x76369b;return _0x39b113;})[_0xdfec('0x20')](respondWithFilteredResult(_0x5051bd,_0x71aeae))[_0xdfec('0x3d')](handleError(_0x5051bd,null));};exports['show']=function(_0x3b7dea,_0x3623bf){var _0x4bf045={'raw':![],'where':{'id':_0x3b7dea[_0xdfec('0x3e')]['id']}},_0x193a18={};_0x193a18[_0xdfec('0x2c')]=_[_0xdfec('0x2e')](db[_0xdfec('0x27')][_0xdfec('0x28')]);_0x193a18['query']=_[_0xdfec('0x2e')](_0x3b7dea[_0xdfec('0x2d')]);_0x193a18[_0xdfec('0x2f')]=_[_0xdfec('0x30')](_0x193a18[_0xdfec('0x2c')],_0x193a18[_0xdfec('0x2d')]);_0x4bf045[_0xdfec('0x31')]=_[_0xdfec('0x30')](_0x193a18[_0xdfec('0x2c')],qs[_0xdfec('0x32')](_0x3b7dea[_0xdfec('0x2d')][_0xdfec('0x32')]));_0x4bf045[_0xdfec('0x31')]=_0x4bf045[_0xdfec('0x31')]['length']?_0x4bf045[_0xdfec('0x31')]:_0x193a18[_0xdfec('0x2c')];if(_0x3b7dea['query'][_0xdfec('0x3f')]){_0x4bf045[_0xdfec('0x3b')]=[{'all':!![]}];}_0x4bf045=_[_0xdfec('0x39')]({},_0x4bf045,_0x3b7dea[_0xdfec('0x40')]);return db[_0xdfec('0x27')]['find'](_0x4bf045)[_0xdfec('0x20')](handleEntityNotFound(_0x3623bf,null))['then'](respondWithResult(_0x3623bf,null))[_0xdfec('0x3d')](handleError(_0x3623bf,null));};exports['create']=function(_0x44dfd,_0x1b6a5b){return db[_0xdfec('0x27')][_0xdfec('0x41')](_0x44dfd['body'],{})[_0xdfec('0x20')](respondWithResult(_0x1b6a5b,0xc9))[_0xdfec('0x3d')](handleError(_0x1b6a5b,null));};exports[_0xdfec('0x1f')]=function(_0x3eed23,_0x459372){if(_0x3eed23[_0xdfec('0x42')]['id']){delete _0x3eed23[_0xdfec('0x42')]['id'];}return db[_0xdfec('0x27')][_0xdfec('0x43')]({'where':{'id':_0x3eed23[_0xdfec('0x3e')]['id']}})[_0xdfec('0x20')](handleEntityNotFound(_0x459372,null))[_0xdfec('0x20')](saveUpdates(_0x3eed23[_0xdfec('0x42')],null))[_0xdfec('0x20')](respondWithResult(_0x459372,null))[_0xdfec('0x3d')](handleError(_0x459372,null));};exports['destroy']=function(_0x339330,_0x1988d3){return db[_0xdfec('0x27')][_0xdfec('0x43')]({'where':{'id':_0x339330['params']['id']}})[_0xdfec('0x20')](handleEntityNotFound(_0x1988d3,null))[_0xdfec('0x20')](removeEntity(_0x1988d3,null))[_0xdfec('0x3d')](handleError(_0x1988d3,null));};exports['getConfigurations']=function(_0x23c1f4,_0xd8543,_0x23679a){var _0x1c120d={};var _0x101695={};var _0xbee556;var _0x4ff22e;return db['FreshdeskAccount'][_0xdfec('0x44')]({'where':{'id':_0x23c1f4[_0xdfec('0x3e')]['id']}})[_0xdfec('0x20')](handleEntityNotFound(_0xd8543,null))['then'](function(_0x1e815e){if(_0x1e815e){_0xbee556=_0x1e815e;_0x101695[_0xdfec('0x2c')]=_[_0xdfec('0x2e')](db[_0xdfec('0x45')][_0xdfec('0x28')]);_0x101695[_0xdfec('0x2d')]=_['keys'](_0x23c1f4['query']);_0x101695[_0xdfec('0x2f')]=_[_0xdfec('0x30')](_0x101695['model'],_0x101695[_0xdfec('0x2d')]);_0x1c120d[_0xdfec('0x31')]=_[_0xdfec('0x30')](_0x101695[_0xdfec('0x2c')],qs[_0xdfec('0x32')](_0x23c1f4[_0xdfec('0x2d')][_0xdfec('0x32')]));_0x1c120d['attributes']=_0x1c120d[_0xdfec('0x31')][_0xdfec('0x33')]?_0x1c120d[_0xdfec('0x31')]:_0x101695['model'];_0x1c120d['order']=qs[_0xdfec('0x36')](_0x23c1f4[_0xdfec('0x2d')][_0xdfec('0x36')]);_0x1c120d[_0xdfec('0x38')]=qs['filters'](_[_0xdfec('0x46')](_0x23c1f4[_0xdfec('0x2d')],_0x101695['filters']));if(_0x23c1f4[_0xdfec('0x2d')][_0xdfec('0x37')]){_0x1c120d[_0xdfec('0x38')]=_['merge'](_0x1c120d[_0xdfec('0x38')],{'$or':_[_0xdfec('0x26')](_0x1c120d['attributes'],function(_0x8f4068){var _0x4c0c0e={};_0x4c0c0e[_0x8f4068]={'$like':'%'+_0x23c1f4[_0xdfec('0x2d')][_0xdfec('0x37')]+'%'};return _0x4c0c0e;})});}_0x1c120d=_[_0xdfec('0x39')]({},_0x1c120d,_0x23c1f4[_0xdfec('0x40')]);return _0xbee556['getConfigurations'](_0x1c120d);}})[_0xdfec('0x20')](function(_0x14f67e){if(_0x14f67e){_0x4ff22e=_0x14f67e[_0xdfec('0x33')];if(!_0x23c1f4[_0xdfec('0x2d')]['hasOwnProperty'](_0xdfec('0x35'))){_0x1c120d[_0xdfec('0x1d')]=qs[_0xdfec('0x1d')](_0x23c1f4[_0xdfec('0x2d')]['limit']);_0x1c120d[_0xdfec('0x1a')]=qs[_0xdfec('0x1a')](_0x23c1f4[_0xdfec('0x2d')][_0xdfec('0x1a')]);}return _0xbee556[_0xdfec('0x47')](_0x1c120d);}})['then'](function(_0x561e6a){if(_0x561e6a){return _0x561e6a?{'count':_0x4ff22e,'rows':_0x561e6a}:null;}})['then'](respondWithResult(_0xd8543,null))['catch'](handleError(_0xd8543,null));};exports['addConfiguration']=function(_0x1fcb5b,_0x1e035a,_0x185780){if(_0x1fcb5b[_0xdfec('0x42')]['id']){delete _0x1fcb5b['body']['id'];}return db['FreshdeskAccount'][_0xdfec('0x44')]({'where':{'id':_0x1fcb5b[_0xdfec('0x3e')]['id']}})[_0xdfec('0x20')](handleEntityNotFound(_0x1e035a,null))[_0xdfec('0x20')](function(_0x275380){if(_0x275380){_0x1fcb5b[_0xdfec('0x42')][_0xdfec('0x48')]=_0x275380['id'];_0x1fcb5b[_0xdfec('0x42')][_0xdfec('0x49')]=integrations[_0xdfec('0x4a')](_0x1fcb5b['body'][_0xdfec('0x4b')],_0x1fcb5b[_0xdfec('0x42')][_0xdfec('0x2a')]);_0x1fcb5b[_0xdfec('0x42')][_0xdfec('0x4c')]=integrations[_0xdfec('0x4d')](_0x1fcb5b['body']['channel'],_0x1fcb5b['body'][_0xdfec('0x2a')]);return db[_0xdfec('0x45')]['create'](_0x1fcb5b[_0xdfec('0x42')],{'include':[{'model':db['FreshdeskField'],'as':_0xdfec('0x49')},{'model':db['FreshdeskField'],'as':_0xdfec('0x4c')}]});}return null;})[_0xdfec('0x20')](respondWithResult(_0x1e035a,null))[_0xdfec('0x3d')](handleError(_0x1e035a,null));};exports[_0xdfec('0x4e')]=function(_0x442708,_0x58765f,_0x2fd12b){var _0x279e5d='';return db['FreshdeskAccount'][_0xdfec('0x44')]({'where':{'id':_0x442708['params']['id']},'attributes':['id',_0xdfec('0x4f'),_0xdfec('0x50')]})[_0xdfec('0x20')](handleEntityNotFound(_0x58765f,null))[_0xdfec('0x20')](function(_0x3cb925){if(_0x3cb925){_0x279e5d=_0x3cb925['remoteUri'];var _0x3aded3=_0x279e5d[_0xdfec('0x51')](-0x1);if(_0x3aded3==='/'){_0x279e5d=_0x279e5d[_0xdfec('0x52')](0x0,_0x279e5d['lastIndexOf'](_0x3aded3));}return rp({'method':_0xdfec('0x53'),'uri':util[_0xdfec('0x54')]('%s/%s',_0x279e5d,_0xdfec('0x55')),'headers':{'Authorization':util[_0xdfec('0x54')](_0xdfec('0x56'),new Buffer(util[_0xdfec('0x54')]('%s:X',_0x3cb925['apiKey']))['toString'](_0xdfec('0x57')))},'json':!![]});}})[_0xdfec('0x20')](function(_0x18ef90){if(_0x18ef90){var _0x5c76b7=['requester','subject',_0xdfec('0x58'),_0xdfec('0x59'),_0xdfec('0x18'),'priority',_0xdfec('0x5a'),_0xdfec('0x5b'),'ticket_type',_0xdfec('0x5a'),_0xdfec('0x5c')];_[_0xdfec('0x5d')](_0x18ef90,function(_0x1baa22){return _0x5c76b7[_0xdfec('0x5e')](_0x1baa22[_0xdfec('0x24')])||!_0x1baa22[_0xdfec('0x5f')]&&_0x1baa22[_0xdfec('0x2a')]!==_0xdfec('0x60')&&_0x1baa22[_0xdfec('0x2a')]!==_0xdfec('0x61');});return{'count':_0x18ef90[_0xdfec('0x33')],'rows':_[_0xdfec('0x26')](_0x18ef90,function(_0x50568d){return{'id':_0x50568d[_0xdfec('0x24')],'name':_0x50568d[_0xdfec('0x62')],'custom':!_0x50568d['default'],'options':_0x50568d['choices']?_[_0xdfec('0x26')](_0x50568d[_0xdfec('0x63')],function(_0xcbdf51){return{'name':_[_0xdfec('0x64')](_0xcbdf51),'value':_0xcbdf51};}):[]};})};}})[_0xdfec('0x20')](respondWithResult(_0x58765f,null))[_0xdfec('0x3d')](function(_0x2f0195){var _0x2b5397=_0x442708[_0xdfec('0x2d')]['test']?0x1f4:_0x2f0195[_0xdfec('0x65')]||0x1f4;logger[_0xdfec('0x22')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x2b5397,JSON['stringify'](_0x2f0195));delete _0x2f0195[_0xdfec('0x24')];if(_0x2b5397===0x191){_0x2b5397=0x190;}_0x58765f[_0xdfec('0x18')](_0x2b5397)['send'](_0x442708[_0xdfec('0x2d')][_0xdfec('0x66')]?{'message':'Wrong\x20credentials','statusCode':_0x2f0195['statusCode']}:_0x2f0195);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 0327cb1..342db37 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 _0x64ae=['../../config/environment','./intFreshdeskAccount.attributes','define','FreshdeskAccount','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x13af74,_0x14adec){var _0x213d2c=function(_0x59ba1c){while(--_0x59ba1c){_0x13af74['push'](_0x13af74['shift']());}};_0x213d2c(++_0x14adec);}(_0x64ae,0x9a));var _0xe64a=function(_0x4f1d7f,_0xe25fe3){_0x4f1d7f=_0x4f1d7f-0x0;var _0x179c8e=_0x64ae[_0x4f1d7f];return _0x179c8e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe64a('0x0'))(_0xe64a('0x1'));var moment=require(_0xe64a('0x2'));var BPromise=require(_0xe64a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe64a('0x4'));var rimraf=require(_0xe64a('0x5'));var config=require(_0xe64a('0x6'));var attributes=require(_0xe64a('0x7'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x39765c,_0x1ccafa){return _0x39765c[_0xe64a('0x8')](_0xe64a('0x9'),attributes,{'tableName':'int_freshdesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8de8=['../../config/logger','bluebird','request-promise','path','../../config/environment','./intFreshdeskAccount.attributes','exports','define','FreshdeskAccount','int_freshdesk_accounts','lodash','util'];(function(_0x4e5082,_0x174902){var _0x2a67de=function(_0x41ca7f){while(--_0x41ca7f){_0x4e5082['push'](_0x4e5082['shift']());}};_0x2a67de(++_0x174902);}(_0x8de8,0x196));var _0x88de=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8de8[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x88de('0x0'));var util=require(_0x88de('0x1'));var logger=require(_0x88de('0x2'))('api');var moment=require('moment');var BPromise=require(_0x88de('0x3'));var rp=require(_0x88de('0x4'));var fs=require('fs');var path=require(_0x88de('0x5'));var rimraf=require('rimraf');var config=require(_0x88de('0x6'));var attributes=require(_0x88de('0x7'));var integrations=require('../../components/integrations/configuration');module[_0x88de('0x8')]=function(_0x470375,_0x1f0627){return _0x470375[_0x88de('0x9')](_0x88de('0xa'),attributes,{'tableName':_0x88de('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index e199bbe..a0d969c 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 _0x46d7=['info','result','catch','GetFreshdeskAccount','FreshdeskAccount','options','raw','where','attributes','limit','include','map','model','ShowFreshdeskAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','FreshdeskAccount,\x20%s,\x20%s','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x42db82,_0x5d98f4){var _0x298bf4=function(_0x2303aa){while(--_0x2303aa){_0x42db82['push'](_0x42db82['shift']());}};_0x298bf4(++_0x5d98f4);}(_0x46d7,0x1b1));var _0x746d=function(_0xecef7b,_0x101e3a){_0xecef7b=_0xecef7b-0x0;var _0x136aa3=_0x46d7[_0xecef7b];return _0x136aa3;};'use strict';var _=require(_0x746d('0x0'));var util=require(_0x746d('0x1'));var moment=require(_0x746d('0x2'));var BPromise=require(_0x746d('0x3'));var rs=require(_0x746d('0x4'));var fs=require('fs');var Redis=require(_0x746d('0x5'));var db=require(_0x746d('0x6'))['db'];var utils=require(_0x746d('0x7'));var logger=require(_0x746d('0x8'))(_0x746d('0x9'));var config=require(_0x746d('0xa'));var jayson=require(_0x746d('0xb'));var client=jayson[_0x746d('0xc')][_0x746d('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x42b282,_0x54c3d5,_0x2c46de){return new BPromise(function(_0x1b7262,_0x3cc37a){return client['request'](_0x42b282,_0x2c46de)[_0x746d('0xe')](function(_0x5e60f1){logger['info'](_0x746d('0xf'),_0x54c3d5,'request\x20sent');logger[_0x746d('0x10')](_0x746d('0x11'),_0x54c3d5,_0x746d('0x12'),JSON[_0x746d('0x13')](_0x5e60f1));if(_0x5e60f1[_0x746d('0x14')]){if(_0x5e60f1[_0x746d('0x14')][_0x746d('0x15')]===0x1f4){logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0x54c3d5,_0x5e60f1[_0x746d('0x14')][_0x746d('0x16')]);return _0x3cc37a(_0x5e60f1['error'][_0x746d('0x16')]);}logger[_0x746d('0x14')](_0x746d('0xf'),_0x54c3d5,_0x5e60f1[_0x746d('0x14')][_0x746d('0x16')]);return _0x1b7262(_0x5e60f1['error']['message']);}else{logger[_0x746d('0x17')](_0x746d('0xf'),_0x54c3d5,_0x746d('0x12'));_0x1b7262(_0x5e60f1[_0x746d('0x18')][_0x746d('0x16')]);}})[_0x746d('0x19')](function(_0x1f1329){logger[_0x746d('0x14')]('FreshdeskAccount,\x20%s,\x20%s',_0x54c3d5,_0x1f1329);_0x3cc37a(_0x1f1329);});});}exports[_0x746d('0x1a')]=function(_0xf758f1){var _0x3a581b=this;return new Promise(function(_0x1907d7,_0x55085e){return db[_0x746d('0x1b')]['findAll']({'raw':_0xf758f1[_0x746d('0x1c')]?_0xf758f1[_0x746d('0x1c')][_0x746d('0x1d')]===undefined?!![]:![]:!![],'where':_0xf758f1[_0x746d('0x1c')]?_0xf758f1[_0x746d('0x1c')][_0x746d('0x1e')]||null:null,'attributes':_0xf758f1[_0x746d('0x1c')]?_0xf758f1['options'][_0x746d('0x1f')]||null:null,'limit':_0xf758f1[_0x746d('0x1c')]?_0xf758f1[_0x746d('0x1c')][_0x746d('0x20')]||null:null,'include':_0xf758f1[_0x746d('0x1c')]?_0xf758f1[_0x746d('0x1c')][_0x746d('0x21')]?_[_0x746d('0x22')](_0xf758f1[_0x746d('0x1c')]['include'],function(_0xe0e669){return{'model':db[_0xe0e669[_0x746d('0x23')]],'as':_0xe0e669['as'],'attributes':_0xe0e669['attributes'],'include':_0xe0e669['include']?_[_0x746d('0x22')](_0xe0e669['include'],function(_0xed2ddf){return{'model':db[_0xed2ddf[_0x746d('0x23')]],'as':_0xed2ddf['as'],'attributes':_0xed2ddf[_0x746d('0x1f')],'include':_0xed2ddf[_0x746d('0x21')]?_[_0x746d('0x22')](_0xed2ddf['include'],function(_0x368ee2){return{'model':db[_0x368ee2['model']],'as':_0x368ee2['as'],'attributes':_0x368ee2['attributes']};}):[]};}):[]};}):[]:[]})[_0x746d('0xe')](function(_0x4bd3dd){logger[_0x746d('0x17')]('GetFreshdeskAccount',_0xf758f1);logger['debug'](_0x746d('0x1a'),_0xf758f1,JSON[_0x746d('0x13')](_0x4bd3dd));_0x1907d7(_0x4bd3dd);})[_0x746d('0x19')](function(_0x312df9){logger[_0x746d('0x14')](_0x746d('0x1a'),_0x312df9[_0x746d('0x16')],_0xf758f1);_0x55085e(_0x3a581b[_0x746d('0x14')](0x1f4,_0x312df9[_0x746d('0x16')]));});});};exports[_0x746d('0x24')]=function(_0x9762b7){var _0x302914=this;return new Promise(function(_0x58f952,_0x7d0baa){return db[_0x746d('0x1b')][_0x746d('0x25')]({'raw':_0x9762b7[_0x746d('0x1c')]?_0x9762b7[_0x746d('0x1c')][_0x746d('0x1d')]===undefined?!![]:![]:!![],'where':_0x9762b7['options']?_0x9762b7[_0x746d('0x1c')][_0x746d('0x1e')]||null:null,'attributes':_0x9762b7['options']?_0x9762b7[_0x746d('0x1c')][_0x746d('0x1f')]||null:null,'include':_0x9762b7[_0x746d('0x1c')]?_0x9762b7[_0x746d('0x1c')][_0x746d('0x21')]?_['map'](_0x9762b7[_0x746d('0x1c')][_0x746d('0x21')],function(_0x46bd7e){return{'model':db[_0x46bd7e[_0x746d('0x23')]],'as':_0x46bd7e['as'],'attributes':_0x46bd7e[_0x746d('0x1f')],'include':_0x46bd7e[_0x746d('0x21')]?_['map'](_0x46bd7e['include'],function(_0x5f0849){return{'model':db[_0x5f0849[_0x746d('0x23')]],'as':_0x5f0849['as'],'attributes':_0x5f0849[_0x746d('0x1f')],'include':_0x5f0849[_0x746d('0x21')]?_[_0x746d('0x22')](_0x5f0849[_0x746d('0x21')],function(_0x5c8138){return{'model':db[_0x5c8138[_0x746d('0x23')]],'as':_0x5c8138['as'],'attributes':_0x5c8138[_0x746d('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3dd4f1){logger['info'](_0x746d('0x24'),_0x9762b7);logger[_0x746d('0x10')]('ShowFreshdeskAccount',_0x9762b7,JSON[_0x746d('0x13')](_0x3dd4f1));_0x58f952(_0x3dd4f1);})['catch'](function(_0x1efc2a){logger['error'](_0x746d('0x24'),_0x1efc2a[_0x746d('0x16')],_0x9762b7);_0x7d0baa(_0x302914[_0x746d('0x14')](0x1f4,_0x1efc2a[_0x746d('0x16')]));});});}; \ No newline at end of file +var _0x515f=['include','model','map','then','stringify','ShowFreshdeskAccount','find','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','where','attributes','limit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x515f,0x165));var _0xf515=function(_0x480a18,_0x285c08){_0x480a18=_0x480a18-0x0;var _0x1f72cb=_0x515f[_0x480a18];return _0x1f72cb;};'use strict';var _=require('lodash');var util=require(_0xf515('0x0'));var moment=require('moment');var BPromise=require(_0xf515('0x1'));var rs=require(_0xf515('0x2'));var fs=require('fs');var Redis=require(_0xf515('0x3'));var db=require(_0xf515('0x4'))['db'];var utils=require(_0xf515('0x5'));var logger=require(_0xf515('0x6'))(_0xf515('0x7'));var config=require(_0xf515('0x8'));var jayson=require(_0xf515('0x9'));var client=jayson['client'][_0xf515('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x8a42e1,_0xd2278e,_0x12719b){return new BPromise(function(_0x4623aa,_0xb4ff1d){return client[_0xf515('0xb')](_0x8a42e1,_0x12719b)['then'](function(_0x172348){logger[_0xf515('0xc')](_0xf515('0xd'),_0xd2278e,_0xf515('0xe'));logger[_0xf515('0xf')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0xd2278e,_0xf515('0xe'),JSON['stringify'](_0x172348));if(_0x172348['error']){if(_0x172348[_0xf515('0x10')][_0xf515('0x11')]===0x1f4){logger[_0xf515('0x10')](_0xf515('0xd'),_0xd2278e,_0x172348[_0xf515('0x10')][_0xf515('0x12')]);return _0xb4ff1d(_0x172348[_0xf515('0x10')][_0xf515('0x12')]);}logger['error'](_0xf515('0xd'),_0xd2278e,_0x172348[_0xf515('0x10')]['message']);return _0x4623aa(_0x172348[_0xf515('0x10')][_0xf515('0x12')]);}else{logger['info'](_0xf515('0xd'),_0xd2278e,_0xf515('0xe'));_0x4623aa(_0x172348['result']['message']);}})[_0xf515('0x13')](function(_0x4a07e2){logger[_0xf515('0x10')](_0xf515('0xd'),_0xd2278e,_0x4a07e2);_0xb4ff1d(_0x4a07e2);});});}exports[_0xf515('0x14')]=function(_0x4454c5){var _0x4f4a41=this;return new Promise(function(_0x1c1cae,_0x2ac930){return db[_0xf515('0x15')][_0xf515('0x16')]({'raw':_0x4454c5[_0xf515('0x17')]?_0x4454c5['options'][_0xf515('0x18')]===undefined?!![]:![]:!![],'where':_0x4454c5[_0xf515('0x17')]?_0x4454c5[_0xf515('0x17')][_0xf515('0x19')]||null:null,'attributes':_0x4454c5[_0xf515('0x17')]?_0x4454c5['options'][_0xf515('0x1a')]||null:null,'limit':_0x4454c5[_0xf515('0x17')]?_0x4454c5[_0xf515('0x17')][_0xf515('0x1b')]||null:null,'include':_0x4454c5[_0xf515('0x17')]?_0x4454c5[_0xf515('0x17')][_0xf515('0x1c')]?_['map'](_0x4454c5[_0xf515('0x17')][_0xf515('0x1c')],function(_0x3bd1d8){return{'model':db[_0x3bd1d8[_0xf515('0x1d')]],'as':_0x3bd1d8['as'],'attributes':_0x3bd1d8[_0xf515('0x1a')],'include':_0x3bd1d8['include']?_['map'](_0x3bd1d8[_0xf515('0x1c')],function(_0x572905){return{'model':db[_0x572905[_0xf515('0x1d')]],'as':_0x572905['as'],'attributes':_0x572905['attributes'],'include':_0x572905[_0xf515('0x1c')]?_[_0xf515('0x1e')](_0x572905[_0xf515('0x1c')],function(_0x42b124){return{'model':db[_0x42b124[_0xf515('0x1d')]],'as':_0x42b124['as'],'attributes':_0x42b124['attributes']};}):[]};}):[]};}):[]:[]})[_0xf515('0x1f')](function(_0x2475a0){logger[_0xf515('0xc')](_0xf515('0x14'),_0x4454c5);logger[_0xf515('0xf')](_0xf515('0x14'),_0x4454c5,JSON[_0xf515('0x20')](_0x2475a0));_0x1c1cae(_0x2475a0);})[_0xf515('0x13')](function(_0x49ea34){logger[_0xf515('0x10')](_0xf515('0x14'),_0x49ea34[_0xf515('0x12')],_0x4454c5);_0x2ac930(_0x4f4a41[_0xf515('0x10')](0x1f4,_0x49ea34[_0xf515('0x12')]));});});};exports[_0xf515('0x21')]=function(_0x104366){var _0x415c39=this;return new Promise(function(_0x126324,_0x1868b7){return db[_0xf515('0x15')][_0xf515('0x22')]({'raw':_0x104366[_0xf515('0x17')]?_0x104366[_0xf515('0x17')][_0xf515('0x18')]===undefined?!![]:![]:!![],'where':_0x104366[_0xf515('0x17')]?_0x104366[_0xf515('0x17')][_0xf515('0x19')]||null:null,'attributes':_0x104366['options']?_0x104366[_0xf515('0x17')][_0xf515('0x1a')]||null:null,'include':_0x104366['options']?_0x104366['options']['include']?_[_0xf515('0x1e')](_0x104366[_0xf515('0x17')]['include'],function(_0x9b0955){return{'model':db[_0x9b0955['model']],'as':_0x9b0955['as'],'attributes':_0x9b0955[_0xf515('0x1a')],'include':_0x9b0955[_0xf515('0x1c')]?_['map'](_0x9b0955[_0xf515('0x1c')],function(_0xa74a7f){return{'model':db[_0xa74a7f[_0xf515('0x1d')]],'as':_0xa74a7f['as'],'attributes':_0xa74a7f[_0xf515('0x1a')],'include':_0xa74a7f[_0xf515('0x1c')]?_[_0xf515('0x1e')](_0xa74a7f[_0xf515('0x1c')],function(_0x952fd3){return{'model':db[_0x952fd3[_0xf515('0x1d')]],'as':_0x952fd3['as'],'attributes':_0x952fd3[_0xf515('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5338c8){logger[_0xf515('0xc')]('ShowFreshdeskAccount',_0x104366);logger[_0xf515('0xf')]('ShowFreshdeskAccount',_0x104366,JSON[_0xf515('0x20')](_0x5338c8));_0x126324(_0x5338c8);})[_0xf515('0x13')](function(_0x5ee936){logger[_0xf515('0x10')](_0xf515('0x21'),_0x5ee936[_0xf515('0x12')],_0x104366);_0x1868b7(_0x415c39['error'](0x1f4,_0x5ee936[_0xf515('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index fd696f0..0762665 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 _0x54ad=['../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','isAuthenticated','index','get','show','/:id/subjects','/:id/tags','getTags','post','create','setTags','put','/:id','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x50ea12,_0x56ef76){var _0x30b82a=function(_0x909ba0){while(--_0x909ba0){_0x50ea12['push'](_0x50ea12['shift']());}};_0x30b82a(++_0x56ef76);}(_0x54ad,0xc1));var _0xd54a=function(_0x181f0e,_0x5bf8f2){_0x181f0e=_0x181f0e-0x0;var _0x467a9f=_0x54ad[_0x181f0e];return _0x467a9f;};'use strict';var multer=require(_0xd54a('0x0'));var util=require(_0xd54a('0x1'));var path=require(_0xd54a('0x2'));var timeout=require(_0xd54a('0x3'));var express=require(_0xd54a('0x4'));var router=express['Router']();var fs_extra=require(_0xd54a('0x5'));var auth=require(_0xd54a('0x6'));var interaction=require(_0xd54a('0x7'));var config=require(_0xd54a('0x8'));var controller=require(_0xd54a('0x9'));router['get']('/',auth[_0xd54a('0xa')](),controller[_0xd54a('0xb')]);router[_0xd54a('0xc')]('/:id',auth[_0xd54a('0xa')](),controller[_0xd54a('0xd')]);router[_0xd54a('0xc')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0xd54a('0xc')](_0xd54a('0xe'),auth[_0xd54a('0xa')](),controller['getSubjects']);router['get']('/:id/descriptions',auth[_0xd54a('0xa')](),controller['getDescriptions']);router[_0xd54a('0xc')](_0xd54a('0xf'),auth[_0xd54a('0xa')](),controller[_0xd54a('0x10')]);router[_0xd54a('0x11')]('/',auth[_0xd54a('0xa')](),controller[_0xd54a('0x12')]);router[_0xd54a('0x11')](_0xd54a('0xf'),auth['isAuthenticated'](),controller[_0xd54a('0x13')]);router[_0xd54a('0x14')](_0xd54a('0x15'),auth['isAuthenticated'](),controller[_0xd54a('0x16')]);router[_0xd54a('0x17')](_0xd54a('0x15'),auth['isAuthenticated'](),controller['destroy']);module[_0xd54a('0x18')]=router; \ No newline at end of file +var _0x5198=['delete','destroy','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','setTags','put','update'];(function(_0x52a659,_0x5e3c37){var _0xd10977=function(_0x5a2a8e){while(--_0x5a2a8e){_0x52a659['push'](_0x52a659['shift']());}};_0xd10977(++_0x5e3c37);}(_0x5198,0x155));var _0x8519=function(_0x26b4ac,_0x345e72){_0x26b4ac=_0x26b4ac-0x0;var _0x465955=_0x5198[_0x26b4ac];return _0x465955;};'use strict';var multer=require(_0x8519('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x8519('0x1'));var express=require('express');var router=express[_0x8519('0x2')]();var fs_extra=require(_0x8519('0x3'));var auth=require(_0x8519('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x8519('0x5'));var controller=require(_0x8519('0x6'));router[_0x8519('0x7')]('/',auth[_0x8519('0x8')](),controller[_0x8519('0x9')]);router[_0x8519('0x7')](_0x8519('0xa'),auth[_0x8519('0x8')](),controller['show']);router[_0x8519('0x7')](_0x8519('0xb'),auth[_0x8519('0x8')](),controller[_0x8519('0xc')]);router[_0x8519('0x7')]('/:id/subjects',auth['isAuthenticated'](),controller[_0x8519('0xd')]);router['get'](_0x8519('0xe'),auth[_0x8519('0x8')](),controller[_0x8519('0xf')]);router[_0x8519('0x7')](_0x8519('0x10'),auth['isAuthenticated'](),controller[_0x8519('0x11')]);router[_0x8519('0x12')]('/',auth[_0x8519('0x8')](),controller[_0x8519('0x13')]);router['post'](_0x8519('0x10'),auth[_0x8519('0x8')](),controller[_0x8519('0x14')]);router[_0x8519('0x15')](_0x8519('0xa'),auth['isAuthenticated'](),controller[_0x8519('0x16')]);router[_0x8519('0x17')](_0x8519('0xa'),auth[_0x8519('0x8')](),controller[_0x8519('0x18')]);module[_0x8519('0x19')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index d292154..ad85639 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 _0x7ae5=['STRING','exports'];(function(_0x1e7600,_0x11348d){var _0x80b052=function(_0x276413){while(--_0x276413){_0x1e7600['push'](_0x1e7600['shift']());}};_0x80b052(++_0x11348d);}(_0x7ae5,0x10f));var _0x57ae=function(_0x527372,_0x173b25){_0x527372=_0x527372-0x0;var _0x4f88b2=_0x7ae5[_0x527372];return _0x4f88b2;};'use strict';var Sequelize=require('sequelize');module[_0x57ae('0x0')]={'name':{'type':Sequelize[_0x57ae('0x1')]},'description':{'type':Sequelize[_0x57ae('0x1')]}}; \ No newline at end of file +var _0x2aaf=['exports','STRING'];(function(_0x5466ab,_0x227b13){var _0x40751a=function(_0x477f9e){while(--_0x477f9e){_0x5466ab['push'](_0x5466ab['shift']());}};_0x40751a(++_0x227b13);}(_0x2aaf,0x13e));var _0xf2aa=function(_0x11d92c,_0x503ae2){_0x11d92c=_0x11d92c-0x0;var _0x51aaf1=_0x2aaf[_0x11d92c];return _0x51aaf1;};'use strict';var Sequelize=require('sequelize');module[_0xf2aa('0x0')]={'name':{'type':Sequelize[_0xf2aa('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index edc5b24..6e9fd15 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 _0x6c13=['where','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','getFields','findOne','order','getSubjects','FreshdeskField','nolimit','getDescriptions','getTags','setTags','ids','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','limit','undefined','count','set','save','update','then','destroy','end','sendStatus','error','stack','send','index','map','FreshdeskConfiguration','rawAttributes','fieldName','key','model','name','query','filters','attributes','intersection','fields','length','hasOwnProperty','sort','pick'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x6c13,0xc9));var _0x36c1=function(_0x20d946,_0x5ae5b1){_0x20d946=_0x20d946-0x0;var _0x2f3cd8=_0x6c13[_0x20d946];return _0x2f3cd8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x36c1('0x0'));var zipdir=require(_0x36c1('0x1'));var jsonpatch=require(_0x36c1('0x2'));var rp=require(_0x36c1('0x3'));var moment=require(_0x36c1('0x4'));var BPromise=require(_0x36c1('0x5'));var Mustache=require(_0x36c1('0x6'));var util=require('util');var path=require(_0x36c1('0x7'));var sox=require(_0x36c1('0x8'));var csv=require(_0x36c1('0x9'));var ejs=require(_0x36c1('0xa'));var fs=require('fs');var fs_extra=require(_0x36c1('0xb'));var _=require(_0x36c1('0xc'));var squel=require(_0x36c1('0xd'));var crypto=require(_0x36c1('0xe'));var jsforce=require(_0x36c1('0xf'));var deskjs=require(_0x36c1('0x10'));var toCsv=require(_0x36c1('0x9'));var querystring=require(_0x36c1('0x11'));var Papa=require(_0x36c1('0x12'));var Redis=require('ioredis');var authService=require(_0x36c1('0x13'));var qs=require(_0x36c1('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x36c1('0x15'));var logger=require('../../config/logger')(_0x36c1('0x16'));var utils=require(_0x36c1('0x17'));var config=require(_0x36c1('0x18'));var licenseUtil=require(_0x36c1('0x19'));var db=require(_0x36c1('0x1a'))['db'];function respondWithStatusCode(_0x14719d,_0x449c7d){_0x449c7d=_0x449c7d||0xcc;return function(_0x280557){if(_0x280557){return _0x14719d['sendStatus'](_0x449c7d);}return _0x14719d[_0x36c1('0x1b')](_0x449c7d)['end']();};}function respondWithResult(_0x182f23,_0x25ef55){_0x25ef55=_0x25ef55||0xc8;return function(_0x463654){if(_0x463654){return _0x182f23[_0x36c1('0x1b')](_0x25ef55)[_0x36c1('0x1c')](_0x463654);}};}function respondWithFilteredResult(_0x2de4c2,_0x213c35){return function(_0x2c3647){if(_0x2c3647){var _0x52cf48=typeof _0x213c35[_0x36c1('0x1d')]==='undefined'&&typeof _0x213c35[_0x36c1('0x1e')]===_0x36c1('0x1f');var _0x3b31a6=_0x2c3647[_0x36c1('0x20')];var _0x5ea257=_0x52cf48?0x0:_0x213c35[_0x36c1('0x1d')];var _0x28703b=_0x52cf48?_0x2c3647[_0x36c1('0x20')]:_0x213c35['offset']+_0x213c35[_0x36c1('0x1e')];var _0x3fa460;if(_0x28703b>=_0x3b31a6){_0x28703b=_0x3b31a6;_0x3fa460=0xc8;}else{_0x3fa460=0xce;}_0x2de4c2[_0x36c1('0x1b')](_0x3fa460);return _0x2de4c2[_0x36c1('0x21')]('Content-Range',_0x5ea257+'-'+_0x28703b+'/'+_0x3b31a6)['json'](_0x2c3647);}return null;};}function patchUpdates(_0x58322f){return function(_0x3dcf8d){try{jsonpatch['apply'](_0x3dcf8d,_0x58322f,!![]);}catch(_0xdaec2){return BPromise['reject'](_0xdaec2);}return _0x3dcf8d[_0x36c1('0x22')]();};}function saveUpdates(_0x1606f9,_0x5c5aa8){return function(_0x579fc6){if(_0x579fc6){return _0x579fc6[_0x36c1('0x23')](_0x1606f9)[_0x36c1('0x24')](function(_0x53a0fb){return _0x53a0fb;});}return null;};}function removeEntity(_0x53f21c,_0x428a60){return function(_0x40c4bd){if(_0x40c4bd){return _0x40c4bd[_0x36c1('0x25')]()[_0x36c1('0x24')](function(){_0x53f21c[_0x36c1('0x1b')](0xcc)[_0x36c1('0x26')]();});}};}function handleEntityNotFound(_0x122ce7,_0x4ce828){return function(_0x5679b5){if(!_0x5679b5){_0x122ce7[_0x36c1('0x27')](0x194);}return _0x5679b5;};}function handleError(_0x3432ca,_0x56ff4f){_0x56ff4f=_0x56ff4f||0x1f4;return function(_0x4df10b){logger[_0x36c1('0x28')](_0x4df10b[_0x36c1('0x29')]);if(_0x4df10b['name']){delete _0x4df10b['name'];}_0x3432ca[_0x36c1('0x1b')](_0x56ff4f)[_0x36c1('0x2a')](_0x4df10b);};}exports[_0x36c1('0x2b')]=function(_0x48c321,_0x4a1394){var _0x52126c={},_0x5eb8ee={},_0x3b9150={'count':0x0,'rows':[]};var _0x5db06f=_[_0x36c1('0x2c')](db[_0x36c1('0x2d')][_0x36c1('0x2e')],function(_0x5b3b05){return{'name':_0x5b3b05[_0x36c1('0x2f')],'type':_0x5b3b05['type'][_0x36c1('0x30')]};});_0x5eb8ee[_0x36c1('0x31')]=_['map'](_0x5db06f,_0x36c1('0x32'));_0x5eb8ee[_0x36c1('0x33')]=_['keys'](_0x48c321[_0x36c1('0x33')]);_0x5eb8ee[_0x36c1('0x34')]=_['intersection'](_0x5eb8ee[_0x36c1('0x31')],_0x5eb8ee[_0x36c1('0x33')]);_0x52126c[_0x36c1('0x35')]=_[_0x36c1('0x36')](_0x5eb8ee[_0x36c1('0x31')],qs[_0x36c1('0x37')](_0x48c321[_0x36c1('0x33')][_0x36c1('0x37')]));_0x52126c[_0x36c1('0x35')]=_0x52126c['attributes'][_0x36c1('0x38')]?_0x52126c[_0x36c1('0x35')]:_0x5eb8ee[_0x36c1('0x31')];if(!_0x48c321[_0x36c1('0x33')][_0x36c1('0x39')]('nolimit')){_0x52126c['limit']=qs['limit'](_0x48c321[_0x36c1('0x33')][_0x36c1('0x1e')]);_0x52126c[_0x36c1('0x1d')]=qs[_0x36c1('0x1d')](_0x48c321[_0x36c1('0x33')][_0x36c1('0x1d')]);}_0x52126c['order']=qs['sort'](_0x48c321[_0x36c1('0x33')][_0x36c1('0x3a')]);_0x52126c['where']=qs['filters'](_[_0x36c1('0x3b')](_0x48c321['query'],_0x5eb8ee[_0x36c1('0x34')]),_0x5db06f);if(_0x48c321[_0x36c1('0x33')]['filter']){_0x52126c[_0x36c1('0x3c')]=_[_0x36c1('0x3d')](_0x52126c['where'],{'$or':_[_0x36c1('0x2c')](_0x5db06f,function(_0x54b19b){if(_0x54b19b[_0x36c1('0x3e')]!==_0x36c1('0x3f')){var _0x1d7b8c={};_0x1d7b8c[_0x54b19b[_0x36c1('0x32')]]={'$like':'%'+_0x48c321[_0x36c1('0x33')][_0x36c1('0x40')]+'%'};return _0x1d7b8c;}})});}_0x52126c=_[_0x36c1('0x3d')]({},_0x52126c,_0x48c321[_0x36c1('0x41')]);var _0x2b556a={'where':_0x52126c[_0x36c1('0x3c')]};return db[_0x36c1('0x2d')][_0x36c1('0x20')](_0x2b556a)['then'](function(_0x123869){_0x3b9150['count']=_0x123869;if(_0x48c321[_0x36c1('0x33')][_0x36c1('0x42')]){_0x52126c[_0x36c1('0x43')]=[{'all':!![]}];}return db[_0x36c1('0x2d')][_0x36c1('0x44')](_0x52126c);})[_0x36c1('0x24')](function(_0x15ed43){_0x3b9150[_0x36c1('0x45')]=_0x15ed43;return _0x3b9150;})[_0x36c1('0x24')](respondWithFilteredResult(_0x4a1394,_0x52126c))[_0x36c1('0x46')](handleError(_0x4a1394,null));};exports[_0x36c1('0x47')]=function(_0x5c781a,_0x15b2de){var _0xd3ae84={'raw':![],'where':{'id':_0x5c781a[_0x36c1('0x48')]['id']}},_0x5e9d9e={};_0x5e9d9e[_0x36c1('0x31')]=_[_0x36c1('0x49')](db[_0x36c1('0x2d')][_0x36c1('0x2e')]);_0x5e9d9e[_0x36c1('0x33')]=_[_0x36c1('0x49')](_0x5c781a['query']);_0x5e9d9e[_0x36c1('0x34')]=_[_0x36c1('0x36')](_0x5e9d9e[_0x36c1('0x31')],_0x5e9d9e['query']);_0xd3ae84[_0x36c1('0x35')]=_[_0x36c1('0x36')](_0x5e9d9e[_0x36c1('0x31')],qs[_0x36c1('0x37')](_0x5c781a[_0x36c1('0x33')][_0x36c1('0x37')]));_0xd3ae84[_0x36c1('0x35')]=_0xd3ae84['attributes'][_0x36c1('0x38')]?_0xd3ae84[_0x36c1('0x35')]:_0x5e9d9e[_0x36c1('0x31')];if(_0x5c781a['query'][_0x36c1('0x42')]){_0xd3ae84[_0x36c1('0x43')]=[{'all':!![]}];}_0xd3ae84=_[_0x36c1('0x3d')]({},_0xd3ae84,_0x5c781a[_0x36c1('0x41')]);return db[_0x36c1('0x2d')][_0x36c1('0x4a')](_0xd3ae84)['then'](handleEntityNotFound(_0x15b2de,null))[_0x36c1('0x24')](respondWithResult(_0x15b2de,null))[_0x36c1('0x46')](handleError(_0x15b2de,null));};exports[_0x36c1('0x4b')]=function(_0x4589fa,_0x21d4be){return db[_0x36c1('0x2d')][_0x36c1('0x4b')](_0x4589fa[_0x36c1('0x4c')],{})[_0x36c1('0x24')](respondWithResult(_0x21d4be,0xc9))[_0x36c1('0x46')](handleError(_0x21d4be,null));};exports['update']=function(_0x479232,_0x1dd7e0){if(_0x479232[_0x36c1('0x4c')]['id']){delete _0x479232[_0x36c1('0x4c')]['id'];}return db[_0x36c1('0x2d')][_0x36c1('0x4a')]({'where':{'id':_0x479232[_0x36c1('0x48')]['id']}})[_0x36c1('0x24')](handleEntityNotFound(_0x1dd7e0,null))['then'](saveUpdates(_0x479232['body'],null))[_0x36c1('0x24')](respondWithResult(_0x1dd7e0,null))[_0x36c1('0x46')](handleError(_0x1dd7e0,null));};exports[_0x36c1('0x25')]=function(_0x1d5b78,_0x22b034){return db[_0x36c1('0x2d')][_0x36c1('0x4a')]({'where':{'id':_0x1d5b78[_0x36c1('0x48')]['id']}})[_0x36c1('0x24')](handleEntityNotFound(_0x22b034,null))[_0x36c1('0x24')](removeEntity(_0x22b034,null))[_0x36c1('0x46')](handleError(_0x22b034,null));};exports[_0x36c1('0x4d')]=function(_0xb115ab,_0x233a20,_0x294c8d){var _0x212eb2={};var _0x2fcd7a={};var _0x3425a9;var _0x4b85d9;return db[_0x36c1('0x2d')][_0x36c1('0x4e')]({'where':{'id':_0xb115ab[_0x36c1('0x48')]['id']}})[_0x36c1('0x24')](handleEntityNotFound(_0x233a20,null))['then'](function(_0x3e0279){if(_0x3e0279){_0x3425a9=_0x3e0279;_0x2fcd7a['model']=_[_0x36c1('0x49')](db['FreshdeskField']['rawAttributes']);_0x2fcd7a[_0x36c1('0x33')]=_['keys'](_0xb115ab[_0x36c1('0x33')]);_0x2fcd7a[_0x36c1('0x34')]=_[_0x36c1('0x36')](_0x2fcd7a[_0x36c1('0x31')],_0x2fcd7a[_0x36c1('0x33')]);_0x212eb2['attributes']=_['intersection'](_0x2fcd7a['model'],qs[_0x36c1('0x37')](_0xb115ab[_0x36c1('0x33')][_0x36c1('0x37')]));_0x212eb2[_0x36c1('0x35')]=_0x212eb2['attributes']['length']?_0x212eb2[_0x36c1('0x35')]:_0x2fcd7a[_0x36c1('0x31')];_0x212eb2[_0x36c1('0x4f')]=qs[_0x36c1('0x3a')](_0xb115ab['query'][_0x36c1('0x3a')]);_0x212eb2[_0x36c1('0x3c')]=qs[_0x36c1('0x34')](_[_0x36c1('0x3b')](_0xb115ab[_0x36c1('0x33')],_0x2fcd7a['filters']));if(_0xb115ab[_0x36c1('0x33')]['filter']){_0x212eb2['where']=_[_0x36c1('0x3d')](_0x212eb2[_0x36c1('0x3c')],{'$or':_[_0x36c1('0x2c')](_0x212eb2[_0x36c1('0x35')],function(_0x31577b){var _0x18f34b={};_0x18f34b[_0x31577b]={'$like':'%'+_0xb115ab[_0x36c1('0x33')][_0x36c1('0x40')]+'%'};return _0x18f34b;})});}_0x212eb2=_[_0x36c1('0x3d')]({},_0x212eb2,_0xb115ab[_0x36c1('0x41')]);return _0x3425a9[_0x36c1('0x4d')](_0x212eb2);}})[_0x36c1('0x24')](function(_0x5b5b97){if(_0x5b5b97){_0x4b85d9=_0x5b5b97[_0x36c1('0x38')];if(!_0xb115ab[_0x36c1('0x33')]['hasOwnProperty']('nolimit')){_0x212eb2[_0x36c1('0x1e')]=qs[_0x36c1('0x1e')](_0xb115ab['query'][_0x36c1('0x1e')]);_0x212eb2[_0x36c1('0x1d')]=qs[_0x36c1('0x1d')](_0xb115ab[_0x36c1('0x33')]['offset']);}return _0x3425a9[_0x36c1('0x4d')](_0x212eb2);}})[_0x36c1('0x24')](function(_0x18212b){if(_0x18212b){return _0x18212b?{'count':_0x4b85d9,'rows':_0x18212b}:null;}})[_0x36c1('0x24')](respondWithResult(_0x233a20,null))[_0x36c1('0x46')](handleError(_0x233a20,null));};exports[_0x36c1('0x50')]=function(_0x1da9f2,_0x4bdfa1,_0x11f816){var _0x3d9eb4={};var _0x1c9336={};var _0x466f93;var _0x1f0d80;return db['FreshdeskConfiguration'][_0x36c1('0x4e')]({'where':{'id':_0x1da9f2['params']['id']}})[_0x36c1('0x24')](handleEntityNotFound(_0x4bdfa1,null))[_0x36c1('0x24')](function(_0x26e5de){if(_0x26e5de){_0x466f93=_0x26e5de;_0x1c9336['model']=_['keys'](db[_0x36c1('0x51')][_0x36c1('0x2e')]);_0x1c9336[_0x36c1('0x33')]=_[_0x36c1('0x49')](_0x1da9f2[_0x36c1('0x33')]);_0x1c9336[_0x36c1('0x34')]=_[_0x36c1('0x36')](_0x1c9336[_0x36c1('0x31')],_0x1c9336[_0x36c1('0x33')]);_0x3d9eb4[_0x36c1('0x35')]=_['intersection'](_0x1c9336[_0x36c1('0x31')],qs[_0x36c1('0x37')](_0x1da9f2[_0x36c1('0x33')][_0x36c1('0x37')]));_0x3d9eb4[_0x36c1('0x35')]=_0x3d9eb4[_0x36c1('0x35')][_0x36c1('0x38')]?_0x3d9eb4['attributes']:_0x1c9336[_0x36c1('0x31')];_0x3d9eb4[_0x36c1('0x4f')]=qs[_0x36c1('0x3a')](_0x1da9f2['query'][_0x36c1('0x3a')]);_0x3d9eb4[_0x36c1('0x3c')]=qs['filters'](_['pick'](_0x1da9f2[_0x36c1('0x33')],_0x1c9336[_0x36c1('0x34')]));if(_0x1da9f2[_0x36c1('0x33')][_0x36c1('0x40')]){_0x3d9eb4[_0x36c1('0x3c')]=_[_0x36c1('0x3d')](_0x3d9eb4[_0x36c1('0x3c')],{'$or':_[_0x36c1('0x2c')](_0x3d9eb4[_0x36c1('0x35')],function(_0x373f6f){var _0x66a2f2={};_0x66a2f2[_0x373f6f]={'$like':'%'+_0x1da9f2[_0x36c1('0x33')][_0x36c1('0x40')]+'%'};return _0x66a2f2;})});}_0x3d9eb4=_[_0x36c1('0x3d')]({},_0x3d9eb4,_0x1da9f2[_0x36c1('0x41')]);return _0x466f93[_0x36c1('0x50')](_0x3d9eb4);}})[_0x36c1('0x24')](function(_0x2e7840){if(_0x2e7840){_0x1f0d80=_0x2e7840[_0x36c1('0x38')];if(!_0x1da9f2['query'][_0x36c1('0x39')](_0x36c1('0x52'))){_0x3d9eb4[_0x36c1('0x1e')]=qs[_0x36c1('0x1e')](_0x1da9f2[_0x36c1('0x33')][_0x36c1('0x1e')]);_0x3d9eb4['offset']=qs[_0x36c1('0x1d')](_0x1da9f2['query'][_0x36c1('0x1d')]);}return _0x466f93[_0x36c1('0x50')](_0x3d9eb4);}})[_0x36c1('0x24')](function(_0x56b80d){if(_0x56b80d){return _0x56b80d?{'count':_0x1f0d80,'rows':_0x56b80d}:null;}})[_0x36c1('0x24')](respondWithResult(_0x4bdfa1,null))[_0x36c1('0x46')](handleError(_0x4bdfa1,null));};exports['getDescriptions']=function(_0x3a7cf6,_0x2f967a,_0x16e642){var _0x48dc53={};var _0x313c1c={};var _0x67cdb8;var _0x48c3da;return db[_0x36c1('0x2d')][_0x36c1('0x4e')]({'where':{'id':_0x3a7cf6['params']['id']}})['then'](handleEntityNotFound(_0x2f967a,null))[_0x36c1('0x24')](function(_0x3f08fa){if(_0x3f08fa){_0x67cdb8=_0x3f08fa;_0x313c1c[_0x36c1('0x31')]=_[_0x36c1('0x49')](db['FreshdeskField'][_0x36c1('0x2e')]);_0x313c1c[_0x36c1('0x33')]=_[_0x36c1('0x49')](_0x3a7cf6['query']);_0x313c1c[_0x36c1('0x34')]=_['intersection'](_0x313c1c[_0x36c1('0x31')],_0x313c1c[_0x36c1('0x33')]);_0x48dc53[_0x36c1('0x35')]=_[_0x36c1('0x36')](_0x313c1c['model'],qs[_0x36c1('0x37')](_0x3a7cf6[_0x36c1('0x33')][_0x36c1('0x37')]));_0x48dc53['attributes']=_0x48dc53[_0x36c1('0x35')][_0x36c1('0x38')]?_0x48dc53[_0x36c1('0x35')]:_0x313c1c[_0x36c1('0x31')];_0x48dc53[_0x36c1('0x4f')]=qs[_0x36c1('0x3a')](_0x3a7cf6[_0x36c1('0x33')][_0x36c1('0x3a')]);_0x48dc53[_0x36c1('0x3c')]=qs['filters'](_['pick'](_0x3a7cf6[_0x36c1('0x33')],_0x313c1c[_0x36c1('0x34')]));if(_0x3a7cf6[_0x36c1('0x33')][_0x36c1('0x40')]){_0x48dc53[_0x36c1('0x3c')]=_[_0x36c1('0x3d')](_0x48dc53['where'],{'$or':_[_0x36c1('0x2c')](_0x48dc53[_0x36c1('0x35')],function(_0x4a9ff7){var _0x3ccff0={};_0x3ccff0[_0x4a9ff7]={'$like':'%'+_0x3a7cf6['query'][_0x36c1('0x40')]+'%'};return _0x3ccff0;})});}_0x48dc53=_[_0x36c1('0x3d')]({},_0x48dc53,_0x3a7cf6[_0x36c1('0x41')]);return _0x67cdb8[_0x36c1('0x53')](_0x48dc53);}})[_0x36c1('0x24')](function(_0x45fb62){if(_0x45fb62){_0x48c3da=_0x45fb62[_0x36c1('0x38')];if(!_0x3a7cf6[_0x36c1('0x33')][_0x36c1('0x39')](_0x36c1('0x52'))){_0x48dc53['limit']=qs[_0x36c1('0x1e')](_0x3a7cf6[_0x36c1('0x33')][_0x36c1('0x1e')]);_0x48dc53[_0x36c1('0x1d')]=qs[_0x36c1('0x1d')](_0x3a7cf6['query'][_0x36c1('0x1d')]);}return _0x67cdb8['getDescriptions'](_0x48dc53);}})['then'](function(_0x25e9d0){if(_0x25e9d0){return _0x25e9d0?{'count':_0x48c3da,'rows':_0x25e9d0}:null;}})[_0x36c1('0x24')](respondWithResult(_0x2f967a,null))[_0x36c1('0x46')](handleError(_0x2f967a,null));};exports[_0x36c1('0x54')]=function(_0x3fbad3,_0xc91e8f,_0x35bdfd){var _0xc83a78={};var _0x165aaf={};var _0x4ed154;var _0x42697f;return db[_0x36c1('0x2d')][_0x36c1('0x4e')]({'where':{'id':_0x3fbad3[_0x36c1('0x48')]['id']}})['then'](handleEntityNotFound(_0xc91e8f,null))[_0x36c1('0x24')](function(_0x8a3d94){if(_0x8a3d94){_0x4ed154=_0x8a3d94;_0x165aaf['model']=_[_0x36c1('0x49')](db['Tag'][_0x36c1('0x2e')]);_0x165aaf[_0x36c1('0x33')]=_[_0x36c1('0x49')](_0x3fbad3[_0x36c1('0x33')]);_0x165aaf[_0x36c1('0x34')]=_[_0x36c1('0x36')](_0x165aaf[_0x36c1('0x31')],_0x165aaf['query']);_0xc83a78[_0x36c1('0x35')]=_[_0x36c1('0x36')](_0x165aaf[_0x36c1('0x31')],qs[_0x36c1('0x37')](_0x3fbad3[_0x36c1('0x33')][_0x36c1('0x37')]));_0xc83a78['attributes']=_0xc83a78['attributes'][_0x36c1('0x38')]?_0xc83a78['attributes']:_0x165aaf[_0x36c1('0x31')];_0xc83a78[_0x36c1('0x4f')]=qs['sort'](_0x3fbad3['query'][_0x36c1('0x3a')]);_0xc83a78[_0x36c1('0x3c')]=qs[_0x36c1('0x34')](_[_0x36c1('0x3b')](_0x3fbad3[_0x36c1('0x33')],_0x165aaf['filters']));if(_0x3fbad3['query'][_0x36c1('0x40')]){_0xc83a78[_0x36c1('0x3c')]=_['merge'](_0xc83a78[_0x36c1('0x3c')],{'$or':_['map'](_0xc83a78['attributes'],function(_0x57ce87){var _0x4c0ab5={};_0x4c0ab5[_0x57ce87]={'$like':'%'+_0x3fbad3[_0x36c1('0x33')][_0x36c1('0x40')]+'%'};return _0x4c0ab5;})});}_0xc83a78=_['merge']({},_0xc83a78,_0x3fbad3[_0x36c1('0x41')]);return _0x4ed154['getTags'](_0xc83a78);}})[_0x36c1('0x24')](function(_0x2ec801){if(_0x2ec801){_0x42697f=_0x2ec801[_0x36c1('0x38')];if(!_0x3fbad3[_0x36c1('0x33')][_0x36c1('0x39')](_0x36c1('0x52'))){_0xc83a78['limit']=qs['limit'](_0x3fbad3[_0x36c1('0x33')][_0x36c1('0x1e')]);_0xc83a78[_0x36c1('0x1d')]=qs['offset'](_0x3fbad3[_0x36c1('0x33')][_0x36c1('0x1d')]);}return _0x4ed154[_0x36c1('0x54')](_0xc83a78);}})['then'](function(_0x1afeb2){if(_0x1afeb2){return _0x1afeb2?{'count':_0x42697f,'rows':_0x1afeb2}:null;}})[_0x36c1('0x24')](respondWithResult(_0xc91e8f,null))[_0x36c1('0x46')](handleError(_0xc91e8f,null));};exports[_0x36c1('0x55')]=function(_0xbc5fa,_0x472230,_0x400b63){if(_0xbc5fa['body']['id']){delete _0xbc5fa['body']['id'];}return db[_0x36c1('0x2d')][_0x36c1('0x4e')]({'where':{'id':_0xbc5fa[_0x36c1('0x48')]['id']}})[_0x36c1('0x24')](handleEntityNotFound(_0x472230,null))[_0x36c1('0x24')](function(_0x44b721){if(_0x44b721){return _0x44b721['setTags'](_0xbc5fa[_0x36c1('0x4c')][_0x36c1('0x56')]||[]);}return null;})[_0x36c1('0x24')](respondWithResult(_0x472230,null))[_0x36c1('0x46')](handleError(_0x472230,null));}; \ No newline at end of file +var _0xe01b=['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','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','FreshdeskConfiguration','show','filters','find','create','body','catch','update','params','getFields','findOne','pick','hasOwnProperty','FreshdeskField','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','squel','crypto'];(function(_0x2e2591,_0x2e8d1b){var _0x40d5b0=function(_0x529867){while(--_0x529867){_0x2e2591['push'](_0x2e2591['shift']());}};_0x40d5b0(++_0x2e8d1b);}(_0xe01b,0xed));var _0xbe01=function(_0x1cd47d,_0x55bc75){_0x1cd47d=_0x1cd47d-0x0;var _0x29d52f=_0xe01b[_0x1cd47d];return _0x29d52f;};'use strict';var emlformat=require(_0xbe01('0x0'));var rimraf=require(_0xbe01('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbe01('0x2'));var rp=require(_0xbe01('0x3'));var moment=require(_0xbe01('0x4'));var BPromise=require(_0xbe01('0x5'));var Mustache=require('mustache');var util=require(_0xbe01('0x6'));var path=require(_0xbe01('0x7'));var sox=require(_0xbe01('0x8'));var csv=require(_0xbe01('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xbe01('0xa'));var crypto=require(_0xbe01('0xb'));var jsforce=require(_0xbe01('0xc'));var deskjs=require(_0xbe01('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xbe01('0xe'));var Redis=require(_0xbe01('0xf'));var authService=require(_0xbe01('0x10'));var qs=require(_0xbe01('0x11'));var as=require(_0xbe01('0x12'));var hardwareService=require(_0xbe01('0x13'));var logger=require(_0xbe01('0x14'))(_0xbe01('0x15'));var utils=require('../../config/utils');var config=require(_0xbe01('0x16'));var licenseUtil=require(_0xbe01('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x434c73,_0x2b3be9){_0x2b3be9=_0x2b3be9||0xcc;return function(_0x4bf782){if(_0x4bf782){return _0x434c73[_0xbe01('0x18')](_0x2b3be9);}return _0x434c73[_0xbe01('0x19')](_0x2b3be9)[_0xbe01('0x1a')]();};}function respondWithResult(_0x435d6a,_0x4cd450){_0x4cd450=_0x4cd450||0xc8;return function(_0x178e21){if(_0x178e21){return _0x435d6a['status'](_0x4cd450)[_0xbe01('0x1b')](_0x178e21);}};}function respondWithFilteredResult(_0x5d88df,_0x20572a){return function(_0x1f749e){if(_0x1f749e){var _0x178d82=typeof _0x20572a[_0xbe01('0x1c')]===_0xbe01('0x1d')&&typeof _0x20572a[_0xbe01('0x1e')]===_0xbe01('0x1d');var _0x1bb23c=_0x1f749e[_0xbe01('0x1f')];var _0x839f5=_0x178d82?0x0:_0x20572a[_0xbe01('0x1c')];var _0x3199b2=_0x178d82?_0x1f749e['count']:_0x20572a[_0xbe01('0x1c')]+_0x20572a[_0xbe01('0x1e')];var _0x5cbecc;if(_0x3199b2>=_0x1bb23c){_0x3199b2=_0x1bb23c;_0x5cbecc=0xc8;}else{_0x5cbecc=0xce;}_0x5d88df[_0xbe01('0x19')](_0x5cbecc);return _0x5d88df[_0xbe01('0x20')](_0xbe01('0x21'),_0x839f5+'-'+_0x3199b2+'/'+_0x1bb23c)[_0xbe01('0x1b')](_0x1f749e);}return null;};}function patchUpdates(_0x366f56){return function(_0x5297cc){try{jsonpatch[_0xbe01('0x22')](_0x5297cc,_0x366f56,!![]);}catch(_0x3d5a74){return BPromise['reject'](_0x3d5a74);}return _0x5297cc[_0xbe01('0x23')]();};}function saveUpdates(_0x24dd47,_0x4ac766){return function(_0x6ad965){if(_0x6ad965){return _0x6ad965['update'](_0x24dd47)[_0xbe01('0x24')](function(_0x1d595e){return _0x1d595e;});}return null;};}function removeEntity(_0x4393b9,_0xbefca7){return function(_0x328001){if(_0x328001){return _0x328001[_0xbe01('0x25')]()[_0xbe01('0x24')](function(){_0x4393b9[_0xbe01('0x19')](0xcc)[_0xbe01('0x1a')]();});}};}function handleEntityNotFound(_0x1d711d,_0xfc07d2){return function(_0xbce45a){if(!_0xbce45a){_0x1d711d[_0xbe01('0x18')](0x194);}return _0xbce45a;};}function handleError(_0x78cb1d,_0x161195){_0x161195=_0x161195||0x1f4;return function(_0x8fd917){logger['error'](_0x8fd917[_0xbe01('0x26')]);if(_0x8fd917[_0xbe01('0x27')]){delete _0x8fd917[_0xbe01('0x27')];}_0x78cb1d[_0xbe01('0x19')](_0x161195)[_0xbe01('0x28')](_0x8fd917);};}exports[_0xbe01('0x29')]=function(_0xe96ee2,_0x9ac3){var _0x5d33a1={},_0x2d1389={},_0xfb337e={'count':0x0,'rows':[]};var _0x50cdee=_[_0xbe01('0x2a')](db['FreshdeskConfiguration'][_0xbe01('0x2b')],function(_0x265f94){return{'name':_0x265f94[_0xbe01('0x2c')],'type':_0x265f94[_0xbe01('0x2d')]['key']};});_0x2d1389[_0xbe01('0x2e')]=_[_0xbe01('0x2a')](_0x50cdee,_0xbe01('0x27'));_0x2d1389[_0xbe01('0x2f')]=_[_0xbe01('0x30')](_0xe96ee2[_0xbe01('0x2f')]);_0x2d1389['filters']=_[_0xbe01('0x31')](_0x2d1389['model'],_0x2d1389[_0xbe01('0x2f')]);_0x5d33a1[_0xbe01('0x32')]=_[_0xbe01('0x31')](_0x2d1389[_0xbe01('0x2e')],qs[_0xbe01('0x33')](_0xe96ee2[_0xbe01('0x2f')]['fields']));_0x5d33a1[_0xbe01('0x32')]=_0x5d33a1[_0xbe01('0x32')][_0xbe01('0x34')]?_0x5d33a1[_0xbe01('0x32')]:_0x2d1389['model'];if(!_0xe96ee2['query']['hasOwnProperty'](_0xbe01('0x35'))){_0x5d33a1[_0xbe01('0x1e')]=qs[_0xbe01('0x1e')](_0xe96ee2['query'][_0xbe01('0x1e')]);_0x5d33a1[_0xbe01('0x1c')]=qs['offset'](_0xe96ee2['query'][_0xbe01('0x1c')]);}_0x5d33a1[_0xbe01('0x36')]=qs['sort'](_0xe96ee2[_0xbe01('0x2f')][_0xbe01('0x37')]);_0x5d33a1[_0xbe01('0x38')]=qs['filters'](_['pick'](_0xe96ee2['query'],_0x2d1389['filters']),_0x50cdee);if(_0xe96ee2[_0xbe01('0x2f')][_0xbe01('0x39')]){_0x5d33a1[_0xbe01('0x38')]=_[_0xbe01('0x3a')](_0x5d33a1[_0xbe01('0x38')],{'$or':_[_0xbe01('0x2a')](_0x50cdee,function(_0x13c612){if(_0x13c612[_0xbe01('0x2d')]!==_0xbe01('0x3b')){var _0x46e917={};_0x46e917[_0x13c612[_0xbe01('0x27')]]={'$like':'%'+_0xe96ee2[_0xbe01('0x2f')][_0xbe01('0x39')]+'%'};return _0x46e917;}})});}_0x5d33a1=_[_0xbe01('0x3a')]({},_0x5d33a1,_0xe96ee2[_0xbe01('0x3c')]);var _0x44a92e={'where':_0x5d33a1['where']};return db['FreshdeskConfiguration'][_0xbe01('0x1f')](_0x44a92e)['then'](function(_0x1fc7c1){_0xfb337e[_0xbe01('0x1f')]=_0x1fc7c1;if(_0xe96ee2[_0xbe01('0x2f')][_0xbe01('0x3d')]){_0x5d33a1[_0xbe01('0x3e')]=[{'all':!![]}];}return db[_0xbe01('0x3f')]['findAll'](_0x5d33a1);})[_0xbe01('0x24')](function(_0x21ad8e){_0xfb337e['rows']=_0x21ad8e;return _0xfb337e;})[_0xbe01('0x24')](respondWithFilteredResult(_0x9ac3,_0x5d33a1))['catch'](handleError(_0x9ac3,null));};exports[_0xbe01('0x40')]=function(_0x31257a,_0x558863){var _0x733349={'raw':![],'where':{'id':_0x31257a['params']['id']}},_0x31b909={};_0x31b909['model']=_[_0xbe01('0x30')](db[_0xbe01('0x3f')]['rawAttributes']);_0x31b909[_0xbe01('0x2f')]=_['keys'](_0x31257a[_0xbe01('0x2f')]);_0x31b909[_0xbe01('0x41')]=_[_0xbe01('0x31')](_0x31b909['model'],_0x31b909['query']);_0x733349[_0xbe01('0x32')]=_[_0xbe01('0x31')](_0x31b909[_0xbe01('0x2e')],qs['fields'](_0x31257a[_0xbe01('0x2f')]['fields']));_0x733349[_0xbe01('0x32')]=_0x733349[_0xbe01('0x32')][_0xbe01('0x34')]?_0x733349[_0xbe01('0x32')]:_0x31b909['model'];if(_0x31257a['query']['includeAll']){_0x733349[_0xbe01('0x3e')]=[{'all':!![]}];}_0x733349=_['merge']({},_0x733349,_0x31257a[_0xbe01('0x3c')]);return db['FreshdeskConfiguration'][_0xbe01('0x42')](_0x733349)[_0xbe01('0x24')](handleEntityNotFound(_0x558863,null))['then'](respondWithResult(_0x558863,null))['catch'](handleError(_0x558863,null));};exports[_0xbe01('0x43')]=function(_0x2c5e50,_0x482a9c){return db['FreshdeskConfiguration'][_0xbe01('0x43')](_0x2c5e50[_0xbe01('0x44')],{})[_0xbe01('0x24')](respondWithResult(_0x482a9c,0xc9))[_0xbe01('0x45')](handleError(_0x482a9c,null));};exports[_0xbe01('0x46')]=function(_0x5c8105,_0x2e15c5){if(_0x5c8105[_0xbe01('0x44')]['id']){delete _0x5c8105[_0xbe01('0x44')]['id'];}return db[_0xbe01('0x3f')]['find']({'where':{'id':_0x5c8105[_0xbe01('0x47')]['id']}})[_0xbe01('0x24')](handleEntityNotFound(_0x2e15c5,null))[_0xbe01('0x24')](saveUpdates(_0x5c8105[_0xbe01('0x44')],null))[_0xbe01('0x24')](respondWithResult(_0x2e15c5,null))[_0xbe01('0x45')](handleError(_0x2e15c5,null));};exports[_0xbe01('0x25')]=function(_0x4d6b63,_0x504815){return db[_0xbe01('0x3f')][_0xbe01('0x42')]({'where':{'id':_0x4d6b63[_0xbe01('0x47')]['id']}})[_0xbe01('0x24')](handleEntityNotFound(_0x504815,null))['then'](removeEntity(_0x504815,null))['catch'](handleError(_0x504815,null));};exports[_0xbe01('0x48')]=function(_0x1f5c01,_0x270648,_0x5ed82a){var _0x43962e={};var _0x487268={};var _0x4c7c57;var _0x48468b;return db[_0xbe01('0x3f')][_0xbe01('0x49')]({'where':{'id':_0x1f5c01['params']['id']}})[_0xbe01('0x24')](handleEntityNotFound(_0x270648,null))[_0xbe01('0x24')](function(_0x3640a4){if(_0x3640a4){_0x4c7c57=_0x3640a4;_0x487268['model']=_[_0xbe01('0x30')](db['FreshdeskField'][_0xbe01('0x2b')]);_0x487268[_0xbe01('0x2f')]=_[_0xbe01('0x30')](_0x1f5c01[_0xbe01('0x2f')]);_0x487268[_0xbe01('0x41')]=_[_0xbe01('0x31')](_0x487268[_0xbe01('0x2e')],_0x487268['query']);_0x43962e[_0xbe01('0x32')]=_[_0xbe01('0x31')](_0x487268[_0xbe01('0x2e')],qs['fields'](_0x1f5c01[_0xbe01('0x2f')][_0xbe01('0x33')]));_0x43962e[_0xbe01('0x32')]=_0x43962e[_0xbe01('0x32')][_0xbe01('0x34')]?_0x43962e[_0xbe01('0x32')]:_0x487268[_0xbe01('0x2e')];_0x43962e[_0xbe01('0x36')]=qs[_0xbe01('0x37')](_0x1f5c01[_0xbe01('0x2f')]['sort']);_0x43962e[_0xbe01('0x38')]=qs[_0xbe01('0x41')](_[_0xbe01('0x4a')](_0x1f5c01['query'],_0x487268[_0xbe01('0x41')]));if(_0x1f5c01[_0xbe01('0x2f')]['filter']){_0x43962e[_0xbe01('0x38')]=_['merge'](_0x43962e[_0xbe01('0x38')],{'$or':_[_0xbe01('0x2a')](_0x43962e[_0xbe01('0x32')],function(_0x40ea8f){var _0x78e9da={};_0x78e9da[_0x40ea8f]={'$like':'%'+_0x1f5c01[_0xbe01('0x2f')][_0xbe01('0x39')]+'%'};return _0x78e9da;})});}_0x43962e=_[_0xbe01('0x3a')]({},_0x43962e,_0x1f5c01['options']);return _0x4c7c57[_0xbe01('0x48')](_0x43962e);}})[_0xbe01('0x24')](function(_0x49503f){if(_0x49503f){_0x48468b=_0x49503f[_0xbe01('0x34')];if(!_0x1f5c01['query'][_0xbe01('0x4b')](_0xbe01('0x35'))){_0x43962e['limit']=qs['limit'](_0x1f5c01[_0xbe01('0x2f')][_0xbe01('0x1e')]);_0x43962e['offset']=qs[_0xbe01('0x1c')](_0x1f5c01[_0xbe01('0x2f')]['offset']);}return _0x4c7c57[_0xbe01('0x48')](_0x43962e);}})[_0xbe01('0x24')](function(_0xfdcbc5){if(_0xfdcbc5){return _0xfdcbc5?{'count':_0x48468b,'rows':_0xfdcbc5}:null;}})[_0xbe01('0x24')](respondWithResult(_0x270648,null))[_0xbe01('0x45')](handleError(_0x270648,null));};exports['getSubjects']=function(_0xfd6b78,_0xef42dd,_0x234151){var _0x37c9e4={};var _0x4adc7a={};var _0x352461;var _0x1c9c01;return db[_0xbe01('0x3f')][_0xbe01('0x49')]({'where':{'id':_0xfd6b78[_0xbe01('0x47')]['id']}})[_0xbe01('0x24')](handleEntityNotFound(_0xef42dd,null))[_0xbe01('0x24')](function(_0x34a251){if(_0x34a251){_0x352461=_0x34a251;_0x4adc7a[_0xbe01('0x2e')]=_['keys'](db[_0xbe01('0x4c')]['rawAttributes']);_0x4adc7a['query']=_[_0xbe01('0x30')](_0xfd6b78[_0xbe01('0x2f')]);_0x4adc7a[_0xbe01('0x41')]=_[_0xbe01('0x31')](_0x4adc7a['model'],_0x4adc7a[_0xbe01('0x2f')]);_0x37c9e4[_0xbe01('0x32')]=_[_0xbe01('0x31')](_0x4adc7a['model'],qs[_0xbe01('0x33')](_0xfd6b78['query'][_0xbe01('0x33')]));_0x37c9e4[_0xbe01('0x32')]=_0x37c9e4[_0xbe01('0x32')][_0xbe01('0x34')]?_0x37c9e4[_0xbe01('0x32')]:_0x4adc7a['model'];_0x37c9e4[_0xbe01('0x36')]=qs[_0xbe01('0x37')](_0xfd6b78[_0xbe01('0x2f')][_0xbe01('0x37')]);_0x37c9e4[_0xbe01('0x38')]=qs[_0xbe01('0x41')](_[_0xbe01('0x4a')](_0xfd6b78['query'],_0x4adc7a[_0xbe01('0x41')]));if(_0xfd6b78['query'][_0xbe01('0x39')]){_0x37c9e4['where']=_['merge'](_0x37c9e4['where'],{'$or':_[_0xbe01('0x2a')](_0x37c9e4['attributes'],function(_0x2020e){var _0x5b7d01={};_0x5b7d01[_0x2020e]={'$like':'%'+_0xfd6b78[_0xbe01('0x2f')]['filter']+'%'};return _0x5b7d01;})});}_0x37c9e4=_[_0xbe01('0x3a')]({},_0x37c9e4,_0xfd6b78[_0xbe01('0x3c')]);return _0x352461[_0xbe01('0x4d')](_0x37c9e4);}})[_0xbe01('0x24')](function(_0xef67ae){if(_0xef67ae){_0x1c9c01=_0xef67ae[_0xbe01('0x34')];if(!_0xfd6b78[_0xbe01('0x2f')]['hasOwnProperty'](_0xbe01('0x35'))){_0x37c9e4[_0xbe01('0x1e')]=qs[_0xbe01('0x1e')](_0xfd6b78['query'][_0xbe01('0x1e')]);_0x37c9e4[_0xbe01('0x1c')]=qs['offset'](_0xfd6b78['query'][_0xbe01('0x1c')]);}return _0x352461[_0xbe01('0x4d')](_0x37c9e4);}})[_0xbe01('0x24')](function(_0x440982){if(_0x440982){return _0x440982?{'count':_0x1c9c01,'rows':_0x440982}:null;}})[_0xbe01('0x24')](respondWithResult(_0xef42dd,null))['catch'](handleError(_0xef42dd,null));};exports['getDescriptions']=function(_0x219bea,_0x475b07,_0x20b5ad){var _0x30f1e1={};var _0x1d7253={};var _0x4c07f9;var _0x11e6c6;return db[_0xbe01('0x3f')][_0xbe01('0x49')]({'where':{'id':_0x219bea[_0xbe01('0x47')]['id']}})['then'](handleEntityNotFound(_0x475b07,null))[_0xbe01('0x24')](function(_0xb9d1c5){if(_0xb9d1c5){_0x4c07f9=_0xb9d1c5;_0x1d7253['model']=_['keys'](db[_0xbe01('0x4c')][_0xbe01('0x2b')]);_0x1d7253[_0xbe01('0x2f')]=_[_0xbe01('0x30')](_0x219bea[_0xbe01('0x2f')]);_0x1d7253[_0xbe01('0x41')]=_[_0xbe01('0x31')](_0x1d7253['model'],_0x1d7253[_0xbe01('0x2f')]);_0x30f1e1['attributes']=_[_0xbe01('0x31')](_0x1d7253[_0xbe01('0x2e')],qs[_0xbe01('0x33')](_0x219bea[_0xbe01('0x2f')][_0xbe01('0x33')]));_0x30f1e1['attributes']=_0x30f1e1[_0xbe01('0x32')][_0xbe01('0x34')]?_0x30f1e1[_0xbe01('0x32')]:_0x1d7253[_0xbe01('0x2e')];_0x30f1e1[_0xbe01('0x36')]=qs[_0xbe01('0x37')](_0x219bea[_0xbe01('0x2f')]['sort']);_0x30f1e1[_0xbe01('0x38')]=qs[_0xbe01('0x41')](_['pick'](_0x219bea['query'],_0x1d7253[_0xbe01('0x41')]));if(_0x219bea[_0xbe01('0x2f')]['filter']){_0x30f1e1[_0xbe01('0x38')]=_['merge'](_0x30f1e1['where'],{'$or':_[_0xbe01('0x2a')](_0x30f1e1[_0xbe01('0x32')],function(_0x4d1d3d){var _0x33c72b={};_0x33c72b[_0x4d1d3d]={'$like':'%'+_0x219bea[_0xbe01('0x2f')][_0xbe01('0x39')]+'%'};return _0x33c72b;})});}_0x30f1e1=_[_0xbe01('0x3a')]({},_0x30f1e1,_0x219bea[_0xbe01('0x3c')]);return _0x4c07f9['getDescriptions'](_0x30f1e1);}})[_0xbe01('0x24')](function(_0x18c4c2){if(_0x18c4c2){_0x11e6c6=_0x18c4c2[_0xbe01('0x34')];if(!_0x219bea['query'][_0xbe01('0x4b')]('nolimit')){_0x30f1e1[_0xbe01('0x1e')]=qs['limit'](_0x219bea['query'][_0xbe01('0x1e')]);_0x30f1e1['offset']=qs[_0xbe01('0x1c')](_0x219bea['query']['offset']);}return _0x4c07f9[_0xbe01('0x4e')](_0x30f1e1);}})['then'](function(_0x59d73d){if(_0x59d73d){return _0x59d73d?{'count':_0x11e6c6,'rows':_0x59d73d}:null;}})[_0xbe01('0x24')](respondWithResult(_0x475b07,null))['catch'](handleError(_0x475b07,null));};exports[_0xbe01('0x4f')]=function(_0x463fd3,_0x2d2dc9,_0x553bd7){var _0x5ce645={};var _0x5d9897={};var _0x39ea42;var _0x43c52c;return db[_0xbe01('0x3f')][_0xbe01('0x49')]({'where':{'id':_0x463fd3[_0xbe01('0x47')]['id']}})[_0xbe01('0x24')](handleEntityNotFound(_0x2d2dc9,null))[_0xbe01('0x24')](function(_0x96bf7a){if(_0x96bf7a){_0x39ea42=_0x96bf7a;_0x5d9897[_0xbe01('0x2e')]=_[_0xbe01('0x30')](db[_0xbe01('0x50')][_0xbe01('0x2b')]);_0x5d9897['query']=_[_0xbe01('0x30')](_0x463fd3[_0xbe01('0x2f')]);_0x5d9897[_0xbe01('0x41')]=_[_0xbe01('0x31')](_0x5d9897[_0xbe01('0x2e')],_0x5d9897[_0xbe01('0x2f')]);_0x5ce645[_0xbe01('0x32')]=_[_0xbe01('0x31')](_0x5d9897[_0xbe01('0x2e')],qs[_0xbe01('0x33')](_0x463fd3['query'][_0xbe01('0x33')]));_0x5ce645[_0xbe01('0x32')]=_0x5ce645[_0xbe01('0x32')][_0xbe01('0x34')]?_0x5ce645[_0xbe01('0x32')]:_0x5d9897[_0xbe01('0x2e')];_0x5ce645[_0xbe01('0x36')]=qs['sort'](_0x463fd3[_0xbe01('0x2f')][_0xbe01('0x37')]);_0x5ce645[_0xbe01('0x38')]=qs[_0xbe01('0x41')](_[_0xbe01('0x4a')](_0x463fd3[_0xbe01('0x2f')],_0x5d9897[_0xbe01('0x41')]));if(_0x463fd3['query']['filter']){_0x5ce645[_0xbe01('0x38')]=_[_0xbe01('0x3a')](_0x5ce645['where'],{'$or':_[_0xbe01('0x2a')](_0x5ce645['attributes'],function(_0x384660){var _0x7523af={};_0x7523af[_0x384660]={'$like':'%'+_0x463fd3[_0xbe01('0x2f')][_0xbe01('0x39')]+'%'};return _0x7523af;})});}_0x5ce645=_[_0xbe01('0x3a')]({},_0x5ce645,_0x463fd3[_0xbe01('0x3c')]);return _0x39ea42[_0xbe01('0x4f')](_0x5ce645);}})[_0xbe01('0x24')](function(_0x5e1b89){if(_0x5e1b89){_0x43c52c=_0x5e1b89[_0xbe01('0x34')];if(!_0x463fd3[_0xbe01('0x2f')][_0xbe01('0x4b')](_0xbe01('0x35'))){_0x5ce645[_0xbe01('0x1e')]=qs[_0xbe01('0x1e')](_0x463fd3[_0xbe01('0x2f')]['limit']);_0x5ce645[_0xbe01('0x1c')]=qs[_0xbe01('0x1c')](_0x463fd3[_0xbe01('0x2f')][_0xbe01('0x1c')]);}return _0x39ea42[_0xbe01('0x4f')](_0x5ce645);}})['then'](function(_0x202893){if(_0x202893){return _0x202893?{'count':_0x43c52c,'rows':_0x202893}:null;}})[_0xbe01('0x24')](respondWithResult(_0x2d2dc9,null))['catch'](handleError(_0x2d2dc9,null));};exports[_0xbe01('0x51')]=function(_0x40afe2,_0x509b23,_0x5b1aac){if(_0x40afe2[_0xbe01('0x44')]['id']){delete _0x40afe2['body']['id'];}return db[_0xbe01('0x3f')][_0xbe01('0x49')]({'where':{'id':_0x40afe2[_0xbe01('0x47')]['id']}})[_0xbe01('0x24')](handleEntityNotFound(_0x509b23,null))[_0xbe01('0x24')](function(_0x520a3b){if(_0x520a3b){return _0x520a3b['setTags'](_0x40afe2[_0xbe01('0x44')][_0xbe01('0x52')]||[]);}return null;})[_0xbe01('0x24')](respondWithResult(_0x509b23,null))['catch'](handleError(_0x509b23,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 57f4fd5..8a7ac2c 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 _0x0761=['bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','exports','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','../../config/logger','api','moment'];(function(_0x23ecd3,_0x26c857){var _0x5ce5af=function(_0x3ed126){while(--_0x3ed126){_0x23ecd3['push'](_0x23ecd3['shift']());}};_0x5ce5af(++_0x26c857);}(_0x0761,0x1f3));var _0x1076=function(_0x2bad53,_0x40f017){_0x2bad53=_0x2bad53-0x0;var _0x410876=_0x0761[_0x2bad53];return _0x410876;};'use strict';var _=require(_0x1076('0x0'));var util=require(_0x1076('0x1'));var logger=require(_0x1076('0x2'))(_0x1076('0x3'));var moment=require(_0x1076('0x4'));var BPromise=require(_0x1076('0x5'));var rp=require(_0x1076('0x6'));var fs=require('fs');var path=require(_0x1076('0x7'));var rimraf=require(_0x1076('0x8'));var config=require(_0x1076('0x9'));var attributes=require(_0x1076('0xa'));module[_0x1076('0xb')]=function(_0xeb9115,_0xb7c329){return _0xeb9115['define'](_0x1076('0xc'),attributes,{'tableName':_0x1076('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9a32=['../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x9a32,0x19c));var _0x29a3=function(_0x38b44d,_0x10859b){_0x38b44d=_0x38b44d-0x0;var _0x411757=_0x9a32[_0x38b44d];return _0x411757;};'use strict';var _=require(_0x29a3('0x0'));var util=require(_0x29a3('0x1'));var logger=require(_0x29a3('0x2'))('api');var moment=require(_0x29a3('0x3'));var BPromise=require(_0x29a3('0x4'));var rp=require(_0x29a3('0x5'));var fs=require('fs');var path=require(_0x29a3('0x6'));var rimraf=require(_0x29a3('0x7'));var config=require(_0x29a3('0x8'));var attributes=require(_0x29a3('0x9'));module[_0x29a3('0xa')]=function(_0x23524a,_0x10f6c9){return _0x23524a[_0x29a3('0xb')](_0x29a3('0xc'),attributes,{'tableName':_0x29a3('0xd'),'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 94df279..ce5d25c 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 _0xf0d6=['error','code','message','info','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x178ae5,_0x2711cc){var _0x374c27=function(_0x5b969c){while(--_0x5b969c){_0x178ae5['push'](_0x178ae5['shift']());}};_0x374c27(++_0x2711cc);}(_0xf0d6,0x6d));var _0x6f0d=function(_0x256812,_0x54ba24){_0x256812=_0x256812-0x0;var _0x23ceaf=_0xf0d6[_0x256812];return _0x23ceaf;};'use strict';var _=require(_0x6f0d('0x0'));var util=require(_0x6f0d('0x1'));var moment=require(_0x6f0d('0x2'));var BPromise=require(_0x6f0d('0x3'));var rs=require(_0x6f0d('0x4'));var fs=require('fs');var Redis=require(_0x6f0d('0x5'));var db=require(_0x6f0d('0x6'))['db'];var utils=require(_0x6f0d('0x7'));var logger=require('../../config/logger')(_0x6f0d('0x8'));var config=require(_0x6f0d('0x9'));var jayson=require(_0x6f0d('0xa'));var client=jayson[_0x6f0d('0xb')][_0x6f0d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x395ffd,_0x36e4b0,_0x4455c9){return new BPromise(function(_0x438648,_0x5f2f15){return client['request'](_0x395ffd,_0x4455c9)[_0x6f0d('0xd')](function(_0x2d67f3){logger['info'](_0x6f0d('0xe'),_0x36e4b0,_0x6f0d('0xf'));logger['debug']('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x36e4b0,_0x6f0d('0xf'),JSON[_0x6f0d('0x10')](_0x2d67f3));if(_0x2d67f3[_0x6f0d('0x11')]){if(_0x2d67f3[_0x6f0d('0x11')][_0x6f0d('0x12')]===0x1f4){logger[_0x6f0d('0x11')](_0x6f0d('0xe'),_0x36e4b0,_0x2d67f3[_0x6f0d('0x11')][_0x6f0d('0x13')]);return _0x5f2f15(_0x2d67f3['error'][_0x6f0d('0x13')]);}logger[_0x6f0d('0x11')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x36e4b0,_0x2d67f3[_0x6f0d('0x11')]['message']);return _0x438648(_0x2d67f3[_0x6f0d('0x11')][_0x6f0d('0x13')]);}else{logger[_0x6f0d('0x14')](_0x6f0d('0xe'),_0x36e4b0,_0x6f0d('0xf'));_0x438648(_0x2d67f3['result']['message']);}})['catch'](function(_0x448ccb){logger['error'](_0x6f0d('0xe'),_0x36e4b0,_0x448ccb);_0x5f2f15(_0x448ccb);});});} \ No newline at end of file +var _0x13b1=['FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1b5a5a,_0x1c3b75){var _0x42b32d=function(_0x3d35ab){while(--_0x3d35ab){_0x1b5a5a['push'](_0x1b5a5a['shift']());}};_0x42b32d(++_0x1c3b75);}(_0x13b1,0x17b));var _0x113b=function(_0x96f74c,_0xfc30a4){_0x96f74c=_0x96f74c-0x0;var _0x379222=_0x13b1[_0x96f74c];return _0x379222;};'use strict';var _=require('lodash');var util=require(_0x113b('0x0'));var moment=require(_0x113b('0x1'));var BPromise=require(_0x113b('0x2'));var rs=require(_0x113b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x113b('0x4'))['db'];var utils=require(_0x113b('0x5'));var logger=require(_0x113b('0x6'))(_0x113b('0x7'));var config=require(_0x113b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x113b('0x9')][_0x113b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x10ade5,_0x289366,_0x52a507){return new BPromise(function(_0x2c8905,_0x35793d){return client[_0x113b('0xb')](_0x10ade5,_0x52a507)[_0x113b('0xc')](function(_0x3ecfcf){logger[_0x113b('0xd')](_0x113b('0xe'),_0x289366,_0x113b('0xf'));logger[_0x113b('0x10')](_0x113b('0x11'),_0x289366,'request\x20sent',JSON[_0x113b('0x12')](_0x3ecfcf));if(_0x3ecfcf[_0x113b('0x13')]){if(_0x3ecfcf[_0x113b('0x13')][_0x113b('0x14')]===0x1f4){logger[_0x113b('0x13')](_0x113b('0xe'),_0x289366,_0x3ecfcf[_0x113b('0x13')][_0x113b('0x15')]);return _0x35793d(_0x3ecfcf[_0x113b('0x13')][_0x113b('0x15')]);}logger[_0x113b('0x13')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x289366,_0x3ecfcf[_0x113b('0x13')]['message']);return _0x2c8905(_0x3ecfcf[_0x113b('0x13')][_0x113b('0x15')]);}else{logger[_0x113b('0xd')](_0x113b('0xe'),_0x289366,'request\x20sent');_0x2c8905(_0x3ecfcf['result'][_0x113b('0x15')]);}})['catch'](function(_0x10c6fe){logger[_0x113b('0x13')](_0x113b('0xe'),_0x289366,_0x10c6fe);_0x35793d(_0x10c6fe);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 58d1099..bd4dcbd 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 _0x6480=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','post','create','put','delete','exports','multer','util','path','connect-timeout'];(function(_0x2b0039,_0x33ae69){var _0xcd703e=function(_0xe451dc){while(--_0xe451dc){_0x2b0039['push'](_0x2b0039['shift']());}};_0xcd703e(++_0x33ae69);}(_0x6480,0x81));var _0x0648=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6480[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x0648('0x0'));var util=require(_0x0648('0x1'));var path=require(_0x0648('0x2'));var timeout=require(_0x0648('0x3'));var express=require(_0x0648('0x4'));var router=express[_0x0648('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x0648('0x6'));var interaction=require(_0x0648('0x7'));var config=require(_0x0648('0x8'));var controller=require('./intFreshdeskField.controller');router['get']('/',auth[_0x0648('0x9')](),controller[_0x0648('0xa')]);router[_0x0648('0xb')](_0x0648('0xc'),auth[_0x0648('0x9')](),controller[_0x0648('0xd')]);router[_0x0648('0xe')]('/',auth[_0x0648('0x9')](),controller[_0x0648('0xf')]);router[_0x0648('0x10')](_0x0648('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x0648('0x11')](_0x0648('0xc'),auth[_0x0648('0x9')](),controller['destroy']);module[_0x0648('0x12')]=router; \ No newline at end of file +var _0x22b3=['util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./intFreshdeskField.controller','isAuthenticated','index','show','post','create','put','/:id','delete','destroy','exports','multer'];(function(_0x13e98d,_0x23eaaa){var _0x509973=function(_0x59ce43){while(--_0x59ce43){_0x13e98d['push'](_0x13e98d['shift']());}};_0x509973(++_0x23eaaa);}(_0x22b3,0x12f));var _0x322b=function(_0x490778,_0x8b2e1f){_0x490778=_0x490778-0x0;var _0x5b6785=_0x22b3[_0x490778];return _0x5b6785;};'use strict';var multer=require(_0x322b('0x0'));var util=require(_0x322b('0x1'));var path=require(_0x322b('0x2'));var timeout=require(_0x322b('0x3'));var express=require(_0x322b('0x4'));var router=express[_0x322b('0x5')]();var fs_extra=require(_0x322b('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x322b('0x7'));var config=require('../../config/environment');var controller=require(_0x322b('0x8'));router['get']('/',auth[_0x322b('0x9')](),controller[_0x322b('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x322b('0xb')]);router[_0x322b('0xc')]('/',auth[_0x322b('0x9')](),controller[_0x322b('0xd')]);router[_0x322b('0xe')](_0x322b('0xf'),auth[_0x322b('0x9')](),controller['update']);router[_0x322b('0x10')]('/:id',auth[_0x322b('0x9')](),controller[_0x322b('0x11')]);module[_0x322b('0x12')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 5d6633e..09fbcc7 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 _0xadb4=['variable','customVariable','keyValue','picklist','STRING','BOOLEAN','exports','ENUM','string'];(function(_0x3ff5df,_0x568349){var _0x3a8a2b=function(_0x496a26){while(--_0x496a26){_0x3ff5df['push'](_0x3ff5df['shift']());}};_0x3a8a2b(++_0x568349);}(_0xadb4,0x8d));var _0x4adb=function(_0x38a54c,_0xc9d148){_0x38a54c=_0x38a54c-0x0;var _0x40abbe=_0xadb4[_0x38a54c];return _0x40abbe;};'use strict';var Sequelize=require('sequelize');module[_0x4adb('0x0')]={'type':{'type':Sequelize[_0x4adb('0x1')](_0x4adb('0x2'),_0x4adb('0x3'),_0x4adb('0x4'),_0x4adb('0x5'),_0x4adb('0x6')),'defaultValue':_0x4adb('0x2')},'content':{'type':Sequelize[_0x4adb('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x4adb('0x1')](_0x4adb('0x2'),_0x4adb('0x3'),_0x4adb('0x4'))},'keyContent':{'type':Sequelize[_0x4adb('0x7')]},'idField':{'type':Sequelize[_0x4adb('0x7')]},'nameField':{'type':Sequelize[_0x4adb('0x7')]},'customField':{'type':Sequelize[_0x4adb('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4adb('0x7')]}}; \ No newline at end of file +var _0x2b53=['sequelize','ENUM','variable','customVariable','keyValue','STRING','string'];(function(_0x4f064a,_0x15ee7c){var _0x42da43=function(_0x3806ec){while(--_0x3806ec){_0x4f064a['push'](_0x4f064a['shift']());}};_0x42da43(++_0x15ee7c);}(_0x2b53,0xe7));var _0x32b5=function(_0x3055cc,_0x4f8c46){_0x3055cc=_0x3055cc-0x0;var _0x3f6270=_0x2b53[_0x3055cc];return _0x3f6270;};'use strict';var Sequelize=require(_0x32b5('0x0'));module['exports']={'type':{'type':Sequelize[_0x32b5('0x1')]('string',_0x32b5('0x2'),_0x32b5('0x3'),_0x32b5('0x4'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x32b5('0x5')]},'keyType':{'type':Sequelize[_0x32b5('0x1')](_0x32b5('0x6'),_0x32b5('0x2'),'customVariable')},'keyContent':{'type':Sequelize[_0x32b5('0x5')]},'idField':{'type':Sequelize[_0x32b5('0x5')]},'nameField':{'type':Sequelize[_0x32b5('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index c251d03..7e769ca 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 _0x780f=['FreshdeskField','rawAttributes','fieldName','key','map','name','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','options','includeAll','include','findAll','rows','catch','show','find','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','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','limit','undefined','count','Content-Range','apply','save','update','then','destroy','error','stack','send','index'];(function(_0x46d1f6,_0x1008b9){var _0x11ef0a=function(_0x500639){while(--_0x500639){_0x46d1f6['push'](_0x46d1f6['shift']());}};_0x11ef0a(++_0x1008b9);}(_0x780f,0x6c));var _0xf780=function(_0x56825b,_0x172b8d){_0x56825b=_0x56825b-0x0;var _0x69ce77=_0x780f[_0x56825b];return _0x69ce77;};'use strict';var emlformat=require(_0xf780('0x0'));var rimraf=require(_0xf780('0x1'));var zipdir=require(_0xf780('0x2'));var jsonpatch=require(_0xf780('0x3'));var rp=require(_0xf780('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf780('0x5'));var util=require(_0xf780('0x6'));var path=require(_0xf780('0x7'));var sox=require(_0xf780('0x8'));var csv=require('to-csv');var ejs=require(_0xf780('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf780('0xa'));var squel=require(_0xf780('0xb'));var crypto=require(_0xf780('0xc'));var jsforce=require(_0xf780('0xd'));var deskjs=require(_0xf780('0xe'));var toCsv=require(_0xf780('0xf'));var querystring=require('querystring');var Papa=require(_0xf780('0x10'));var Redis=require(_0xf780('0x11'));var authService=require(_0xf780('0x12'));var qs=require(_0xf780('0x13'));var as=require(_0xf780('0x14'));var hardwareService=require(_0xf780('0x15'));var logger=require(_0xf780('0x16'))('api');var utils=require('../../config/utils');var config=require(_0xf780('0x17'));var licenseUtil=require(_0xf780('0x18'));var db=require(_0xf780('0x19'))['db'];function respondWithStatusCode(_0x1a8520,_0x5f04e1){_0x5f04e1=_0x5f04e1||0xcc;return function(_0x24aa4f){if(_0x24aa4f){return _0x1a8520[_0xf780('0x1a')](_0x5f04e1);}return _0x1a8520[_0xf780('0x1b')](_0x5f04e1)[_0xf780('0x1c')]();};}function respondWithResult(_0x5c353b,_0x5a64bc){_0x5a64bc=_0x5a64bc||0xc8;return function(_0x4be599){if(_0x4be599){return _0x5c353b[_0xf780('0x1b')](_0x5a64bc)[_0xf780('0x1d')](_0x4be599);}};}function respondWithFilteredResult(_0xc1e872,_0x187b6d){return function(_0x206d34){if(_0x206d34){var _0x335ba6=typeof _0x187b6d[_0xf780('0x1e')]==='undefined'&&typeof _0x187b6d[_0xf780('0x1f')]===_0xf780('0x20');var _0xa78b1b=_0x206d34[_0xf780('0x21')];var _0x5d5a81=_0x335ba6?0x0:_0x187b6d[_0xf780('0x1e')];var _0x53dfee=_0x335ba6?_0x206d34[_0xf780('0x21')]:_0x187b6d[_0xf780('0x1e')]+_0x187b6d['limit'];var _0x29dae1;if(_0x53dfee>=_0xa78b1b){_0x53dfee=_0xa78b1b;_0x29dae1=0xc8;}else{_0x29dae1=0xce;}_0xc1e872[_0xf780('0x1b')](_0x29dae1);return _0xc1e872['set'](_0xf780('0x22'),_0x5d5a81+'-'+_0x53dfee+'/'+_0xa78b1b)[_0xf780('0x1d')](_0x206d34);}return null;};}function patchUpdates(_0x3c7054){return function(_0x4065bb){try{jsonpatch[_0xf780('0x23')](_0x4065bb,_0x3c7054,!![]);}catch(_0x147de9){return BPromise['reject'](_0x147de9);}return _0x4065bb[_0xf780('0x24')]();};}function saveUpdates(_0x4de546,_0x5853ea){return function(_0x45d80e){if(_0x45d80e){return _0x45d80e[_0xf780('0x25')](_0x4de546)[_0xf780('0x26')](function(_0x58bb66){return _0x58bb66;});}return null;};}function removeEntity(_0x2fcb2d,_0x373dce){return function(_0x4f59b1){if(_0x4f59b1){return _0x4f59b1[_0xf780('0x27')]()['then'](function(){_0x2fcb2d[_0xf780('0x1b')](0xcc)[_0xf780('0x1c')]();});}};}function handleEntityNotFound(_0x5d4053,_0x589208){return function(_0x3710bb){if(!_0x3710bb){_0x5d4053[_0xf780('0x1a')](0x194);}return _0x3710bb;};}function handleError(_0x462435,_0x40d9c9){_0x40d9c9=_0x40d9c9||0x1f4;return function(_0x458c76){logger[_0xf780('0x28')](_0x458c76[_0xf780('0x29')]);if(_0x458c76['name']){delete _0x458c76['name'];}_0x462435['status'](_0x40d9c9)[_0xf780('0x2a')](_0x458c76);};}exports[_0xf780('0x2b')]=function(_0x26452f,_0x4ef8c3){var _0x4ed256={},_0x36bc63={},_0x149190={'count':0x0,'rows':[]};var _0x2b832d=_['map'](db[_0xf780('0x2c')][_0xf780('0x2d')],function(_0x2368e3){return{'name':_0x2368e3[_0xf780('0x2e')],'type':_0x2368e3['type'][_0xf780('0x2f')]};});_0x36bc63['model']=_[_0xf780('0x30')](_0x2b832d,_0xf780('0x31'));_0x36bc63[_0xf780('0x32')]=_[_0xf780('0x33')](_0x26452f[_0xf780('0x32')]);_0x36bc63[_0xf780('0x34')]=_[_0xf780('0x35')](_0x36bc63[_0xf780('0x36')],_0x36bc63['query']);_0x4ed256[_0xf780('0x37')]=_[_0xf780('0x35')](_0x36bc63[_0xf780('0x36')],qs[_0xf780('0x38')](_0x26452f[_0xf780('0x32')]['fields']));_0x4ed256[_0xf780('0x37')]=_0x4ed256['attributes'][_0xf780('0x39')]?_0x4ed256[_0xf780('0x37')]:_0x36bc63[_0xf780('0x36')];if(!_0x26452f['query'][_0xf780('0x3a')](_0xf780('0x3b'))){_0x4ed256[_0xf780('0x1f')]=qs[_0xf780('0x1f')](_0x26452f['query'][_0xf780('0x1f')]);_0x4ed256['offset']=qs[_0xf780('0x1e')](_0x26452f['query']['offset']);}_0x4ed256[_0xf780('0x3c')]=qs['sort'](_0x26452f[_0xf780('0x32')][_0xf780('0x3d')]);_0x4ed256[_0xf780('0x3e')]=qs[_0xf780('0x34')](_['pick'](_0x26452f[_0xf780('0x32')],_0x36bc63[_0xf780('0x34')]),_0x2b832d);if(_0x26452f[_0xf780('0x32')][_0xf780('0x3f')]){_0x4ed256['where']=_[_0xf780('0x40')](_0x4ed256[_0xf780('0x3e')],{'$or':_[_0xf780('0x30')](_0x2b832d,function(_0xdac8ab){if(_0xdac8ab[_0xf780('0x41')]!=='VIRTUAL'){var _0x4b8a3c={};_0x4b8a3c[_0xdac8ab[_0xf780('0x31')]]={'$like':'%'+_0x26452f[_0xf780('0x32')][_0xf780('0x3f')]+'%'};return _0x4b8a3c;}})});}_0x4ed256=_[_0xf780('0x40')]({},_0x4ed256,_0x26452f[_0xf780('0x42')]);var _0x4a0efe={'where':_0x4ed256[_0xf780('0x3e')]};return db['FreshdeskField'][_0xf780('0x21')](_0x4a0efe)[_0xf780('0x26')](function(_0x28783f){_0x149190[_0xf780('0x21')]=_0x28783f;if(_0x26452f['query'][_0xf780('0x43')]){_0x4ed256[_0xf780('0x44')]=[{'all':!![]}];}return db[_0xf780('0x2c')][_0xf780('0x45')](_0x4ed256);})[_0xf780('0x26')](function(_0x12ae9a){_0x149190[_0xf780('0x46')]=_0x12ae9a;return _0x149190;})[_0xf780('0x26')](respondWithFilteredResult(_0x4ef8c3,_0x4ed256))[_0xf780('0x47')](handleError(_0x4ef8c3,null));};exports[_0xf780('0x48')]=function(_0x143118,_0x30a036){var _0x406a9e={'raw':!![],'where':{'id':_0x143118['params']['id']}},_0x42a710={};_0x42a710[_0xf780('0x36')]=_['keys'](db[_0xf780('0x2c')][_0xf780('0x2d')]);_0x42a710['query']=_['keys'](_0x143118['query']);_0x42a710['filters']=_[_0xf780('0x35')](_0x42a710['model'],_0x42a710[_0xf780('0x32')]);_0x406a9e[_0xf780('0x37')]=_[_0xf780('0x35')](_0x42a710[_0xf780('0x36')],qs[_0xf780('0x38')](_0x143118['query']['fields']));_0x406a9e['attributes']=_0x406a9e['attributes'][_0xf780('0x39')]?_0x406a9e[_0xf780('0x37')]:_0x42a710[_0xf780('0x36')];if(_0x143118[_0xf780('0x32')][_0xf780('0x43')]){_0x406a9e[_0xf780('0x44')]=[{'all':!![]}];}_0x406a9e=_['merge']({},_0x406a9e,_0x143118[_0xf780('0x42')]);return db[_0xf780('0x2c')][_0xf780('0x49')](_0x406a9e)[_0xf780('0x26')](handleEntityNotFound(_0x30a036,null))[_0xf780('0x26')](respondWithResult(_0x30a036,null))[_0xf780('0x47')](handleError(_0x30a036,null));};exports['create']=function(_0x26fe74,_0x5c4170){return db[_0xf780('0x2c')]['create'](_0x26fe74[_0xf780('0x4a')],{})['then'](respondWithResult(_0x5c4170,0xc9))['catch'](handleError(_0x5c4170,null));};exports[_0xf780('0x25')]=function(_0x72a225,_0x189717){if(_0x72a225[_0xf780('0x4a')]['id']){delete _0x72a225['body']['id'];}return db[_0xf780('0x2c')][_0xf780('0x49')]({'where':{'id':_0x72a225[_0xf780('0x4b')]['id']}})[_0xf780('0x26')](handleEntityNotFound(_0x189717,null))[_0xf780('0x26')](saveUpdates(_0x72a225['body'],null))[_0xf780('0x26')](respondWithResult(_0x189717,null))['catch'](handleError(_0x189717,null));};exports[_0xf780('0x27')]=function(_0x1b492a,_0x22c52d){return db[_0xf780('0x2c')][_0xf780('0x49')]({'where':{'id':_0x1b492a['params']['id']}})['then'](handleEntityNotFound(_0x22c52d,null))[_0xf780('0x26')](removeEntity(_0x22c52d,null))[_0xf780('0x47')](handleError(_0x22c52d,null));}; \ No newline at end of file +var _0x6b20=['../../components/auth/service','../../config/license/hardware','../../config/logger','../../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','index','FreshdeskField','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','includeAll','findAll','rows','catch','show','params','include','options','find','create','update','body','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse'];(function(_0x23c181,_0x17646b){var _0x88c01=function(_0x37658a){while(--_0x37658a){_0x23c181['push'](_0x23c181['shift']());}};_0x88c01(++_0x17646b);}(_0x6b20,0xd1));var _0x06b2=function(_0x767d24,_0x1d0368){_0x767d24=_0x767d24-0x0;var _0x4cc31f=_0x6b20[_0x767d24];return _0x4cc31f;};'use strict';var emlformat=require(_0x06b2('0x0'));var rimraf=require(_0x06b2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x06b2('0x2'));var rp=require('request-promise');var moment=require(_0x06b2('0x3'));var BPromise=require(_0x06b2('0x4'));var Mustache=require(_0x06b2('0x5'));var util=require('util');var path=require(_0x06b2('0x6'));var sox=require(_0x06b2('0x7'));var csv=require(_0x06b2('0x8'));var ejs=require(_0x06b2('0x9'));var fs=require('fs');var fs_extra=require(_0x06b2('0xa'));var _=require(_0x06b2('0xb'));var squel=require(_0x06b2('0xc'));var crypto=require('crypto');var jsforce=require(_0x06b2('0xd'));var deskjs=require(_0x06b2('0xe'));var toCsv=require(_0x06b2('0x8'));var querystring=require('querystring');var Papa=require(_0x06b2('0xf'));var Redis=require('ioredis');var authService=require(_0x06b2('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x06b2('0x11'));var logger=require(_0x06b2('0x12'))('api');var utils=require(_0x06b2('0x13'));var config=require(_0x06b2('0x14'));var licenseUtil=require(_0x06b2('0x15'));var db=require(_0x06b2('0x16'))['db'];function respondWithStatusCode(_0x44a9b4,_0x810a12){_0x810a12=_0x810a12||0xcc;return function(_0x3039c9){if(_0x3039c9){return _0x44a9b4[_0x06b2('0x17')](_0x810a12);}return _0x44a9b4[_0x06b2('0x18')](_0x810a12)[_0x06b2('0x19')]();};}function respondWithResult(_0xa81f11,_0x2822e9){_0x2822e9=_0x2822e9||0xc8;return function(_0x26faee){if(_0x26faee){return _0xa81f11['status'](_0x2822e9)[_0x06b2('0x1a')](_0x26faee);}};}function respondWithFilteredResult(_0xaee98c,_0x47496c){return function(_0x3830e9){if(_0x3830e9){var _0xef0466=typeof _0x47496c[_0x06b2('0x1b')]==='undefined'&&typeof _0x47496c[_0x06b2('0x1c')]===_0x06b2('0x1d');var _0x525945=_0x3830e9[_0x06b2('0x1e')];var _0x594b48=_0xef0466?0x0:_0x47496c['offset'];var _0x192270=_0xef0466?_0x3830e9[_0x06b2('0x1e')]:_0x47496c[_0x06b2('0x1b')]+_0x47496c[_0x06b2('0x1c')];var _0x4c4e21;if(_0x192270>=_0x525945){_0x192270=_0x525945;_0x4c4e21=0xc8;}else{_0x4c4e21=0xce;}_0xaee98c[_0x06b2('0x18')](_0x4c4e21);return _0xaee98c[_0x06b2('0x1f')](_0x06b2('0x20'),_0x594b48+'-'+_0x192270+'/'+_0x525945)[_0x06b2('0x1a')](_0x3830e9);}return null;};}function patchUpdates(_0xe28985){return function(_0x368ad8){try{jsonpatch[_0x06b2('0x21')](_0x368ad8,_0xe28985,!![]);}catch(_0x5ca622){return BPromise[_0x06b2('0x22')](_0x5ca622);}return _0x368ad8[_0x06b2('0x23')]();};}function saveUpdates(_0xb05f65,_0x208384){return function(_0x4e2a4c){if(_0x4e2a4c){return _0x4e2a4c['update'](_0xb05f65)[_0x06b2('0x24')](function(_0xb5231e){return _0xb5231e;});}return null;};}function removeEntity(_0x4fc95f,_0x39659f){return function(_0x5e40f2){if(_0x5e40f2){return _0x5e40f2[_0x06b2('0x25')]()[_0x06b2('0x24')](function(){_0x4fc95f[_0x06b2('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4382ce,_0x306ce){return function(_0xc65820){if(!_0xc65820){_0x4382ce[_0x06b2('0x17')](0x194);}return _0xc65820;};}function handleError(_0x1173fc,_0x4f5e90){_0x4f5e90=_0x4f5e90||0x1f4;return function(_0xbb00ea){logger[_0x06b2('0x26')](_0xbb00ea[_0x06b2('0x27')]);if(_0xbb00ea[_0x06b2('0x28')]){delete _0xbb00ea[_0x06b2('0x28')];}_0x1173fc[_0x06b2('0x18')](_0x4f5e90)['send'](_0xbb00ea);};}exports[_0x06b2('0x29')]=function(_0x2a3228,_0x2720fa){var _0x13c0eb={},_0x1f02d8={},_0x1bfaa9={'count':0x0,'rows':[]};var _0x3668bb=_['map'](db[_0x06b2('0x2a')][_0x06b2('0x2b')],function(_0x1637c2){return{'name':_0x1637c2[_0x06b2('0x2c')],'type':_0x1637c2[_0x06b2('0x2d')][_0x06b2('0x2e')]};});_0x1f02d8[_0x06b2('0x2f')]=_[_0x06b2('0x30')](_0x3668bb,'name');_0x1f02d8[_0x06b2('0x31')]=_[_0x06b2('0x32')](_0x2a3228[_0x06b2('0x31')]);_0x1f02d8[_0x06b2('0x33')]=_[_0x06b2('0x34')](_0x1f02d8[_0x06b2('0x2f')],_0x1f02d8[_0x06b2('0x31')]);_0x13c0eb['attributes']=_['intersection'](_0x1f02d8[_0x06b2('0x2f')],qs[_0x06b2('0x35')](_0x2a3228[_0x06b2('0x31')]['fields']));_0x13c0eb[_0x06b2('0x36')]=_0x13c0eb[_0x06b2('0x36')][_0x06b2('0x37')]?_0x13c0eb[_0x06b2('0x36')]:_0x1f02d8[_0x06b2('0x2f')];if(!_0x2a3228[_0x06b2('0x31')]['hasOwnProperty'](_0x06b2('0x38'))){_0x13c0eb[_0x06b2('0x1c')]=qs[_0x06b2('0x1c')](_0x2a3228['query'][_0x06b2('0x1c')]);_0x13c0eb[_0x06b2('0x1b')]=qs['offset'](_0x2a3228[_0x06b2('0x31')][_0x06b2('0x1b')]);}_0x13c0eb[_0x06b2('0x39')]=qs[_0x06b2('0x3a')](_0x2a3228[_0x06b2('0x31')][_0x06b2('0x3a')]);_0x13c0eb[_0x06b2('0x3b')]=qs[_0x06b2('0x33')](_[_0x06b2('0x3c')](_0x2a3228[_0x06b2('0x31')],_0x1f02d8[_0x06b2('0x33')]),_0x3668bb);if(_0x2a3228[_0x06b2('0x31')]['filter']){_0x13c0eb[_0x06b2('0x3b')]=_['merge'](_0x13c0eb['where'],{'$or':_[_0x06b2('0x30')](_0x3668bb,function(_0x4e92e0){if(_0x4e92e0[_0x06b2('0x2d')]!=='VIRTUAL'){var _0x35e29c={};_0x35e29c[_0x4e92e0[_0x06b2('0x28')]]={'$like':'%'+_0x2a3228[_0x06b2('0x31')][_0x06b2('0x3d')]+'%'};return _0x35e29c;}})});}_0x13c0eb=_[_0x06b2('0x3e')]({},_0x13c0eb,_0x2a3228['options']);var _0x404eab={'where':_0x13c0eb[_0x06b2('0x3b')]};return db[_0x06b2('0x2a')][_0x06b2('0x1e')](_0x404eab)[_0x06b2('0x24')](function(_0x39fd60){_0x1bfaa9['count']=_0x39fd60;if(_0x2a3228[_0x06b2('0x31')][_0x06b2('0x3f')]){_0x13c0eb['include']=[{'all':!![]}];}return db['FreshdeskField'][_0x06b2('0x40')](_0x13c0eb);})[_0x06b2('0x24')](function(_0x286c9b){_0x1bfaa9[_0x06b2('0x41')]=_0x286c9b;return _0x1bfaa9;})[_0x06b2('0x24')](respondWithFilteredResult(_0x2720fa,_0x13c0eb))[_0x06b2('0x42')](handleError(_0x2720fa,null));};exports[_0x06b2('0x43')]=function(_0x2ff968,_0x2e2a80){var _0x117bf4={'raw':!![],'where':{'id':_0x2ff968[_0x06b2('0x44')]['id']}},_0x1d7750={};_0x1d7750[_0x06b2('0x2f')]=_[_0x06b2('0x32')](db[_0x06b2('0x2a')][_0x06b2('0x2b')]);_0x1d7750[_0x06b2('0x31')]=_[_0x06b2('0x32')](_0x2ff968[_0x06b2('0x31')]);_0x1d7750['filters']=_[_0x06b2('0x34')](_0x1d7750[_0x06b2('0x2f')],_0x1d7750[_0x06b2('0x31')]);_0x117bf4[_0x06b2('0x36')]=_['intersection'](_0x1d7750[_0x06b2('0x2f')],qs[_0x06b2('0x35')](_0x2ff968['query'][_0x06b2('0x35')]));_0x117bf4[_0x06b2('0x36')]=_0x117bf4['attributes'][_0x06b2('0x37')]?_0x117bf4[_0x06b2('0x36')]:_0x1d7750['model'];if(_0x2ff968['query']['includeAll']){_0x117bf4[_0x06b2('0x45')]=[{'all':!![]}];}_0x117bf4=_[_0x06b2('0x3e')]({},_0x117bf4,_0x2ff968[_0x06b2('0x46')]);return db[_0x06b2('0x2a')][_0x06b2('0x47')](_0x117bf4)['then'](handleEntityNotFound(_0x2e2a80,null))['then'](respondWithResult(_0x2e2a80,null))[_0x06b2('0x42')](handleError(_0x2e2a80,null));};exports[_0x06b2('0x48')]=function(_0x979759,_0x1f4d89){return db[_0x06b2('0x2a')][_0x06b2('0x48')](_0x979759['body'],{})[_0x06b2('0x24')](respondWithResult(_0x1f4d89,0xc9))[_0x06b2('0x42')](handleError(_0x1f4d89,null));};exports[_0x06b2('0x49')]=function(_0x33f72e,_0x146c5c){if(_0x33f72e[_0x06b2('0x4a')]['id']){delete _0x33f72e['body']['id'];}return db[_0x06b2('0x2a')][_0x06b2('0x47')]({'where':{'id':_0x33f72e[_0x06b2('0x44')]['id']}})[_0x06b2('0x24')](handleEntityNotFound(_0x146c5c,null))['then'](saveUpdates(_0x33f72e[_0x06b2('0x4a')],null))[_0x06b2('0x24')](respondWithResult(_0x146c5c,null))[_0x06b2('0x42')](handleError(_0x146c5c,null));};exports[_0x06b2('0x25')]=function(_0x546c9e,_0x346f04){return db[_0x06b2('0x2a')][_0x06b2('0x47')]({'where':{'id':_0x546c9e[_0x06b2('0x44')]['id']}})[_0x06b2('0x24')](handleEntityNotFound(_0x346f04,null))[_0x06b2('0x24')](removeEntity(_0x346f04,null))[_0x06b2('0x42')](handleError(_0x346f04,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 48b6bc3..dda7c41 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 _0x39ff=['idField','FieldId','lodash','moment','request-promise','../../config/environment','./intFreshdeskField.attributes','define','FreshdeskField','int_freshdesk_fields'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x39ff,0x188));var _0xf39f=function(_0x54768a,_0xde3eb1){_0x54768a=_0x54768a-0x0;var _0x51bef6=_0x39ff[_0x54768a];return _0x51bef6;};'use strict';var _=require(_0xf39f('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xf39f('0x1'));var BPromise=require('bluebird');var rp=require(_0xf39f('0x2'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf39f('0x3'));var attributes=require(_0xf39f('0x4'));module['exports']=function(_0x5c44b6,_0x719383){return _0x5c44b6[_0xf39f('0x5')](_0xf39f('0x6'),attributes,{'tableName':_0xf39f('0x7'),'paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':[_0xf39f('0x8'),_0xf39f('0x9')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3b36=['FieldId','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField'];(function(_0x1c7889,_0x24cd26){var _0x2f14e5=function(_0x9ae1b1){while(--_0x9ae1b1){_0x1c7889['push'](_0x1c7889['shift']());}};_0x2f14e5(++_0x24cd26);}(_0x3b36,0x181));var _0x63b3=function(_0x394798,_0x14af05){_0x394798=_0x394798-0x0;var _0x80638c=_0x3b36[_0x394798];return _0x80638c;};'use strict';var _=require('lodash');var util=require(_0x63b3('0x0'));var logger=require('../../config/logger')(_0x63b3('0x1'));var moment=require(_0x63b3('0x2'));var BPromise=require(_0x63b3('0x3'));var rp=require(_0x63b3('0x4'));var fs=require('fs');var path=require(_0x63b3('0x5'));var rimraf=require(_0x63b3('0x6'));var config=require(_0x63b3('0x7'));var attributes=require(_0x63b3('0x8'));module[_0x63b3('0x9')]=function(_0x3866a5,_0x1f3731){return _0x3866a5[_0x63b3('0xa')](_0x63b3('0xb'),attributes,{'tableName':_0x63b3('0xc'),'paranoid':![],'indexes':[{'name':_0x63b3('0xd'),'fields':[_0x63b3('0xe'),_0x63b3('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index 35a5057..2ad3d2a 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 _0xd4e0=['then','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x481df5,_0x216652){var _0x32726e=function(_0x2133f4){while(--_0x2133f4){_0x481df5['push'](_0x481df5['shift']());}};_0x32726e(++_0x216652);}(_0xd4e0,0xf1));var _0x0d4e=function(_0x19a0c1,_0x17bdcf){_0x19a0c1=_0x19a0c1-0x0;var _0x454cf1=_0xd4e0[_0x19a0c1];return _0x454cf1;};'use strict';var _=require(_0x0d4e('0x0'));var util=require(_0x0d4e('0x1'));var moment=require(_0x0d4e('0x2'));var BPromise=require(_0x0d4e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d4e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0d4e('0x5'));var logger=require(_0x0d4e('0x6'))(_0x0d4e('0x7'));var config=require(_0x0d4e('0x8'));var jayson=require(_0x0d4e('0x9'));var client=jayson[_0x0d4e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x9bfe40,_0x2b3e82,_0x33ae37){return new BPromise(function(_0x98e4d0,_0xce3a81){return client['request'](_0x9bfe40,_0x33ae37)[_0x0d4e('0xb')](function(_0x29ed13){logger['info'](_0x0d4e('0xc'),_0x2b3e82,_0x0d4e('0xd'));logger[_0x0d4e('0xe')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x2b3e82,_0x0d4e('0xd'),JSON[_0x0d4e('0xf')](_0x29ed13));if(_0x29ed13[_0x0d4e('0x10')]){if(_0x29ed13[_0x0d4e('0x10')][_0x0d4e('0x11')]===0x1f4){logger[_0x0d4e('0x10')]('FreshdeskField,\x20%s,\x20%s',_0x2b3e82,_0x29ed13['error'][_0x0d4e('0x12')]);return _0xce3a81(_0x29ed13[_0x0d4e('0x10')][_0x0d4e('0x12')]);}logger[_0x0d4e('0x10')](_0x0d4e('0xc'),_0x2b3e82,_0x29ed13['error'][_0x0d4e('0x12')]);return _0x98e4d0(_0x29ed13[_0x0d4e('0x10')][_0x0d4e('0x12')]);}else{logger[_0x0d4e('0x13')](_0x0d4e('0xc'),_0x2b3e82,_0x0d4e('0xd'));_0x98e4d0(_0x29ed13[_0x0d4e('0x14')][_0x0d4e('0x12')]);}})['catch'](function(_0x5ade78){logger[_0x0d4e('0x10')](_0x0d4e('0xc'),_0x2b3e82,_0x5ade78);_0xce3a81(_0x5ade78);});});} \ No newline at end of file +var _0x941c=['code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x941c,0x19b));var _0xc941=function(_0x29a161,_0x2efac1){_0x29a161=_0x29a161-0x0;var _0x5733c7=_0x941c[_0x29a161];return _0x5733c7;};'use strict';var _=require(_0xc941('0x0'));var util=require(_0xc941('0x1'));var moment=require(_0xc941('0x2'));var BPromise=require(_0xc941('0x3'));var rs=require(_0xc941('0x4'));var fs=require('fs');var Redis=require(_0xc941('0x5'));var db=require(_0xc941('0x6'))['db'];var utils=require(_0xc941('0x7'));var logger=require(_0xc941('0x8'))('rpc');var config=require(_0xc941('0x9'));var jayson=require(_0xc941('0xa'));var client=jayson[_0xc941('0xb')][_0xc941('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2d7bdf,_0x4fd551,_0x551347){return new BPromise(function(_0x405204,_0x2f3ffd){return client[_0xc941('0xd')](_0x2d7bdf,_0x551347)['then'](function(_0x4a205a){logger[_0xc941('0xe')](_0xc941('0xf'),_0x4fd551,_0xc941('0x10'));logger[_0xc941('0x11')](_0xc941('0x12'),_0x4fd551,_0xc941('0x10'),JSON[_0xc941('0x13')](_0x4a205a));if(_0x4a205a[_0xc941('0x14')]){if(_0x4a205a[_0xc941('0x14')][_0xc941('0x15')]===0x1f4){logger[_0xc941('0x14')](_0xc941('0xf'),_0x4fd551,_0x4a205a[_0xc941('0x14')][_0xc941('0x16')]);return _0x2f3ffd(_0x4a205a[_0xc941('0x14')][_0xc941('0x16')]);}logger[_0xc941('0x14')](_0xc941('0xf'),_0x4fd551,_0x4a205a[_0xc941('0x14')][_0xc941('0x16')]);return _0x405204(_0x4a205a[_0xc941('0x14')][_0xc941('0x16')]);}else{logger[_0xc941('0xe')](_0xc941('0xf'),_0x4fd551,'request\x20sent');_0x405204(_0x4a205a['result'][_0xc941('0x16')]);}})[_0xc941('0x17')](function(_0x15a44f){logger['error'](_0xc941('0xf'),_0x4fd551,_0x15a44f);_0x2f3ffd(_0x15a44f);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index e881f8e..1e71ea1 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 _0x373d=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','getConfigurations','getFields','create','post','/:id/configurations','update','destroy','exports','multer'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x373d,0x1e2));var _0xd373=function(_0x2832a2,_0x1e34ea){_0x2832a2=_0x2832a2-0x0;var _0x2eb3c1=_0x373d[_0x2832a2];return _0x2eb3c1;};'use strict';var multer=require(_0xd373('0x0'));var util=require('util');var path=require(_0xd373('0x1'));var timeout=require(_0xd373('0x2'));var express=require(_0xd373('0x3'));var router=express[_0xd373('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd373('0x5'));var interaction=require(_0xd373('0x6'));var config=require(_0xd373('0x7'));var controller=require('./intFreshsalesAccount.controller');router['get']('/',auth[_0xd373('0x8')](),controller[_0xd373('0x9')]);router[_0xd373('0xa')](_0xd373('0xb'),auth['isAuthenticated'](),controller[_0xd373('0xc')]);router['get']('/:id/configurations',auth['isAuthenticated'](),controller[_0xd373('0xd')]);router[_0xd373('0xa')]('/:id/fields',auth[_0xd373('0x8')](),controller[_0xd373('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xd373('0xf')]);router[_0xd373('0x10')](_0xd373('0x11'),auth[_0xd373('0x8')](),controller['addConfiguration']);router['put']('/:id',auth[_0xd373('0x8')](),controller[_0xd373('0x12')]);router['delete'](_0xd373('0xb'),auth[_0xd373('0x8')](),controller[_0xd373('0x13')]);module[_0xd373('0x14')]=router; \ No newline at end of file +var _0xa75b=['post','create','/:id/configurations','addConfiguration','put','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','getConfigurations','/:id/fields','getFields'];(function(_0xae4d64,_0x7f4945){var _0x13cd8c=function(_0x33a897){while(--_0x33a897){_0xae4d64['push'](_0xae4d64['shift']());}};_0x13cd8c(++_0x7f4945);}(_0xa75b,0x170));var _0xba75=function(_0x20cc73,_0x1e7317){_0x20cc73=_0x20cc73-0x0;var _0xab30e5=_0xa75b[_0x20cc73];return _0xab30e5;};'use strict';var multer=require(_0xba75('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xba75('0x1'));var express=require(_0xba75('0x2'));var router=express[_0xba75('0x3')]();var fs_extra=require(_0xba75('0x4'));var auth=require(_0xba75('0x5'));var interaction=require(_0xba75('0x6'));var config=require(_0xba75('0x7'));var controller=require(_0xba75('0x8'));router[_0xba75('0x9')]('/',auth[_0xba75('0xa')](),controller[_0xba75('0xb')]);router[_0xba75('0x9')](_0xba75('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xba75('0x9')]('/:id/configurations',auth['isAuthenticated'](),controller[_0xba75('0xd')]);router['get'](_0xba75('0xe'),auth[_0xba75('0xa')](),controller[_0xba75('0xf')]);router[_0xba75('0x10')]('/',auth[_0xba75('0xa')](),controller[_0xba75('0x11')]);router[_0xba75('0x10')](_0xba75('0x12'),auth[_0xba75('0xa')](),controller[_0xba75('0x13')]);router[_0xba75('0x14')](_0xba75('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xba75('0x15')]('/:id',auth[_0xba75('0xa')](),controller[_0xba75('0x16')]);module[_0xba75('0x17')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 7db687d..3c78b03 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 _0x4bd3=['sequelize','STRING','remoteUri'];(function(_0x341c1f,_0x3a51bb){var _0x43e13e=function(_0x284998){while(--_0x284998){_0x341c1f['push'](_0x341c1f['shift']());}};_0x43e13e(++_0x3a51bb);}(_0x4bd3,0x174));var _0x34bd=function(_0x2abf35,_0x5b9f2f){_0x2abf35=_0x2abf35-0x0;var _0x1865f8=_0x4bd3[_0x2abf35];return _0x1865f8;};'use strict';var Sequelize=require(_0x34bd('0x0'));module['exports']={'name':{'type':Sequelize[_0x34bd('0x1')]},'description':{'type':Sequelize[_0x34bd('0x1')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x34bd('0x1')],'unique':_0x34bd('0x2')},'serverUrl':{'type':Sequelize[_0x34bd('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x6d11=['exports','STRING','sequelize'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x6d11,0xbf));var _0x16d1=function(_0x37fc07,_0x2ef518){_0x37fc07=_0x37fc07-0x0;var _0x226b5b=_0x6d11[_0x37fc07];return _0x226b5b;};'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 acac802..2f57fc7 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 _0x19d2=['desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','map','FreshsalesAccount','rawAttributes','fieldName','type','key','query','filters','model','attributes','intersection','length','order','sort','pick','where','merge','VIRTUAL','options','include','rows','catch','show','keys','fields','includeAll','find','create','body','params','getConfigurations','findOne','filter','hasOwnProperty','nolimit','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','FreshsalesConfiguration','FreshsalesField','getFields','username','apiKey','remoteUri','slice','substring','lastIndexOf','GET','format','%s%s','/api/selector/owners','Token\x20token=','users','email','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto'];(function(_0x1b8077,_0x2c1e02){var _0x5b003d=function(_0x3715b0){while(--_0x3715b0){_0x1b8077['push'](_0x1b8077['shift']());}};_0x5b003d(++_0x2c1e02);}(_0x19d2,0x18a));var _0x219d=function(_0x212809,_0x4046c0){_0x212809=_0x212809-0x0;var _0x381d69=_0x19d2[_0x212809];return _0x381d69;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x219d('0x0'));var zipdir=require(_0x219d('0x1'));var jsonpatch=require(_0x219d('0x2'));var rp=require('request-promise');var moment=require(_0x219d('0x3'));var BPromise=require(_0x219d('0x4'));var Mustache=require(_0x219d('0x5'));var util=require(_0x219d('0x6'));var path=require(_0x219d('0x7'));var sox=require('sox');var csv=require(_0x219d('0x8'));var ejs=require(_0x219d('0x9'));var fs=require('fs');var fs_extra=require(_0x219d('0xa'));var _=require(_0x219d('0xb'));var squel=require(_0x219d('0xc'));var crypto=require(_0x219d('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x219d('0xe'));var toCsv=require(_0x219d('0x8'));var querystring=require('querystring');var Papa=require(_0x219d('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x219d('0x10'));var as=require(_0x219d('0x11'));var hardwareService=require(_0x219d('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x219d('0x13'));var db=require(_0x219d('0x14'))['db'];var integrations=require(_0x219d('0x15'));function respondWithStatusCode(_0x3d1940,_0x1253d5){_0x1253d5=_0x1253d5||0xcc;return function(_0x323fc6){if(_0x323fc6){return _0x3d1940['sendStatus'](_0x1253d5);}return _0x3d1940[_0x219d('0x16')](_0x1253d5)[_0x219d('0x17')]();};}function respondWithResult(_0xe502a4,_0x30d054){_0x30d054=_0x30d054||0xc8;return function(_0x3177e9){if(_0x3177e9){return _0xe502a4[_0x219d('0x16')](_0x30d054)[_0x219d('0x18')](_0x3177e9);}};}function respondWithFilteredResult(_0x268207,_0x1b536b){return function(_0x1af0bc){if(_0x1af0bc){var _0xb60fdd=typeof _0x1b536b[_0x219d('0x19')]===_0x219d('0x1a')&&typeof _0x1b536b[_0x219d('0x1b')]===_0x219d('0x1a');var _0x36ca0c=_0x1af0bc['count'];var _0x49d6f3=_0xb60fdd?0x0:_0x1b536b[_0x219d('0x19')];var _0xa3364f=_0xb60fdd?_0x1af0bc[_0x219d('0x1c')]:_0x1b536b[_0x219d('0x19')]+_0x1b536b['limit'];var _0x475f33;if(_0xa3364f>=_0x36ca0c){_0xa3364f=_0x36ca0c;_0x475f33=0xc8;}else{_0x475f33=0xce;}_0x268207[_0x219d('0x16')](_0x475f33);return _0x268207[_0x219d('0x1d')]('Content-Range',_0x49d6f3+'-'+_0xa3364f+'/'+_0x36ca0c)['json'](_0x1af0bc);}return null;};}function patchUpdates(_0x31dac6){return function(_0x2acfad){try{jsonpatch[_0x219d('0x1e')](_0x2acfad,_0x31dac6,!![]);}catch(_0x87abaf){return BPromise[_0x219d('0x1f')](_0x87abaf);}return _0x2acfad[_0x219d('0x20')]();};}function saveUpdates(_0x591d6d,_0x4e6c8b){return function(_0x5585f6){if(_0x5585f6){return _0x5585f6[_0x219d('0x21')](_0x591d6d)[_0x219d('0x22')](function(_0x18439e){return _0x18439e;});}return null;};}function removeEntity(_0x473e9c,_0x41e2c0){return function(_0x325bb0){if(_0x325bb0){return _0x325bb0[_0x219d('0x23')]()[_0x219d('0x22')](function(){_0x473e9c[_0x219d('0x16')](0xcc)[_0x219d('0x17')]();});}};}function handleEntityNotFound(_0x30ae55,_0x37c733){return function(_0xf42017){if(!_0xf42017){_0x30ae55[_0x219d('0x24')](0x194);}return _0xf42017;};}function handleError(_0x4d4c5c,_0x3fbbe9){_0x3fbbe9=_0x3fbbe9||0x1f4;return function(_0x5ff709){logger[_0x219d('0x25')](_0x5ff709[_0x219d('0x26')]);if(_0x5ff709[_0x219d('0x27')]){delete _0x5ff709[_0x219d('0x27')];}_0x4d4c5c[_0x219d('0x16')](_0x3fbbe9)[_0x219d('0x28')](_0x5ff709);};}exports['index']=function(_0x3f2a1c,_0x5e172e){var _0xb50de7={},_0x5088d1={},_0x31e755={'count':0x0,'rows':[]};var _0x59f573=_[_0x219d('0x29')](db[_0x219d('0x2a')][_0x219d('0x2b')],function(_0x14276c){return{'name':_0x14276c[_0x219d('0x2c')],'type':_0x14276c[_0x219d('0x2d')][_0x219d('0x2e')]};});_0x5088d1['model']=_[_0x219d('0x29')](_0x59f573,_0x219d('0x27'));_0x5088d1[_0x219d('0x2f')]=_['keys'](_0x3f2a1c[_0x219d('0x2f')]);_0x5088d1[_0x219d('0x30')]=_['intersection'](_0x5088d1[_0x219d('0x31')],_0x5088d1[_0x219d('0x2f')]);_0xb50de7[_0x219d('0x32')]=_[_0x219d('0x33')](_0x5088d1[_0x219d('0x31')],qs['fields'](_0x3f2a1c[_0x219d('0x2f')]['fields']));_0xb50de7[_0x219d('0x32')]=_0xb50de7[_0x219d('0x32')][_0x219d('0x34')]?_0xb50de7[_0x219d('0x32')]:_0x5088d1['model'];if(!_0x3f2a1c[_0x219d('0x2f')]['hasOwnProperty']('nolimit')){_0xb50de7[_0x219d('0x1b')]=qs[_0x219d('0x1b')](_0x3f2a1c[_0x219d('0x2f')][_0x219d('0x1b')]);_0xb50de7['offset']=qs[_0x219d('0x19')](_0x3f2a1c[_0x219d('0x2f')][_0x219d('0x19')]);}_0xb50de7[_0x219d('0x35')]=qs[_0x219d('0x36')](_0x3f2a1c[_0x219d('0x2f')]['sort']);_0xb50de7['where']=qs[_0x219d('0x30')](_[_0x219d('0x37')](_0x3f2a1c[_0x219d('0x2f')],_0x5088d1[_0x219d('0x30')]),_0x59f573);if(_0x3f2a1c['query']['filter']){_0xb50de7[_0x219d('0x38')]=_[_0x219d('0x39')](_0xb50de7[_0x219d('0x38')],{'$or':_[_0x219d('0x29')](_0x59f573,function(_0x2f041d){if(_0x2f041d[_0x219d('0x2d')]!==_0x219d('0x3a')){var _0x37c103={};_0x37c103[_0x2f041d[_0x219d('0x27')]]={'$like':'%'+_0x3f2a1c[_0x219d('0x2f')]['filter']+'%'};return _0x37c103;}})});}_0xb50de7=_[_0x219d('0x39')]({},_0xb50de7,_0x3f2a1c[_0x219d('0x3b')]);var _0x266aab={'where':_0xb50de7['where']};return db[_0x219d('0x2a')][_0x219d('0x1c')](_0x266aab)['then'](function(_0x12a3a5){_0x31e755[_0x219d('0x1c')]=_0x12a3a5;if(_0x3f2a1c[_0x219d('0x2f')]['includeAll']){_0xb50de7[_0x219d('0x3c')]=[{'all':!![]}];}return db[_0x219d('0x2a')]['findAll'](_0xb50de7);})['then'](function(_0x371a07){_0x31e755[_0x219d('0x3d')]=_0x371a07;return _0x31e755;})[_0x219d('0x22')](respondWithFilteredResult(_0x5e172e,_0xb50de7))[_0x219d('0x3e')](handleError(_0x5e172e,null));};exports[_0x219d('0x3f')]=function(_0x40d97b,_0x4576b6){var _0x4fb47d={'raw':![],'where':{'id':_0x40d97b['params']['id']}},_0x5a9130={};_0x5a9130[_0x219d('0x31')]=_[_0x219d('0x40')](db[_0x219d('0x2a')]['rawAttributes']);_0x5a9130['query']=_[_0x219d('0x40')](_0x40d97b[_0x219d('0x2f')]);_0x5a9130[_0x219d('0x30')]=_['intersection'](_0x5a9130[_0x219d('0x31')],_0x5a9130['query']);_0x4fb47d[_0x219d('0x32')]=_[_0x219d('0x33')](_0x5a9130[_0x219d('0x31')],qs[_0x219d('0x41')](_0x40d97b[_0x219d('0x2f')][_0x219d('0x41')]));_0x4fb47d['attributes']=_0x4fb47d[_0x219d('0x32')]['length']?_0x4fb47d['attributes']:_0x5a9130[_0x219d('0x31')];if(_0x40d97b['query'][_0x219d('0x42')]){_0x4fb47d[_0x219d('0x3c')]=[{'all':!![]}];}_0x4fb47d=_[_0x219d('0x39')]({},_0x4fb47d,_0x40d97b[_0x219d('0x3b')]);return db[_0x219d('0x2a')][_0x219d('0x43')](_0x4fb47d)['then'](handleEntityNotFound(_0x4576b6,null))[_0x219d('0x22')](respondWithResult(_0x4576b6,null))[_0x219d('0x3e')](handleError(_0x4576b6,null));};exports[_0x219d('0x44')]=function(_0x1b51d5,_0x382921){return db['FreshsalesAccount'][_0x219d('0x44')](_0x1b51d5[_0x219d('0x45')],{})[_0x219d('0x22')](respondWithResult(_0x382921,0xc9))[_0x219d('0x3e')](handleError(_0x382921,null));};exports[_0x219d('0x21')]=function(_0x572326,_0x4ea11b){if(_0x572326[_0x219d('0x45')]['id']){delete _0x572326[_0x219d('0x45')]['id'];}return db['FreshsalesAccount']['find']({'where':{'id':_0x572326[_0x219d('0x46')]['id']}})[_0x219d('0x22')](handleEntityNotFound(_0x4ea11b,null))[_0x219d('0x22')](saveUpdates(_0x572326['body'],null))['then'](respondWithResult(_0x4ea11b,null))[_0x219d('0x3e')](handleError(_0x4ea11b,null));};exports[_0x219d('0x23')]=function(_0x467791,_0x198239){return db[_0x219d('0x2a')][_0x219d('0x43')]({'where':{'id':_0x467791[_0x219d('0x46')]['id']}})['then'](handleEntityNotFound(_0x198239,null))[_0x219d('0x22')](removeEntity(_0x198239,null))[_0x219d('0x3e')](handleError(_0x198239,null));};exports[_0x219d('0x47')]=function(_0x12b654,_0x26a77c,_0x40e676){var _0x3ff07f={};var _0x23aa33={};var _0x37ccd4;var _0x35bf9c;return db[_0x219d('0x2a')][_0x219d('0x48')]({'where':{'id':_0x12b654[_0x219d('0x46')]['id']}})['then'](handleEntityNotFound(_0x26a77c,null))[_0x219d('0x22')](function(_0x476496){if(_0x476496){_0x37ccd4=_0x476496;_0x23aa33['model']=_['keys'](db['FreshsalesConfiguration']['rawAttributes']);_0x23aa33[_0x219d('0x2f')]=_[_0x219d('0x40')](_0x12b654[_0x219d('0x2f')]);_0x23aa33[_0x219d('0x30')]=_[_0x219d('0x33')](_0x23aa33[_0x219d('0x31')],_0x23aa33[_0x219d('0x2f')]);_0x3ff07f['attributes']=_[_0x219d('0x33')](_0x23aa33[_0x219d('0x31')],qs[_0x219d('0x41')](_0x12b654['query'][_0x219d('0x41')]));_0x3ff07f[_0x219d('0x32')]=_0x3ff07f['attributes']['length']?_0x3ff07f['attributes']:_0x23aa33[_0x219d('0x31')];_0x3ff07f[_0x219d('0x35')]=qs[_0x219d('0x36')](_0x12b654[_0x219d('0x2f')][_0x219d('0x36')]);_0x3ff07f[_0x219d('0x38')]=qs[_0x219d('0x30')](_[_0x219d('0x37')](_0x12b654['query'],_0x23aa33[_0x219d('0x30')]));if(_0x12b654['query'][_0x219d('0x49')]){_0x3ff07f[_0x219d('0x38')]=_['merge'](_0x3ff07f[_0x219d('0x38')],{'$or':_[_0x219d('0x29')](_0x3ff07f[_0x219d('0x32')],function(_0x426603){var _0x1feb6c={};_0x1feb6c[_0x426603]={'$like':'%'+_0x12b654['query'][_0x219d('0x49')]+'%'};return _0x1feb6c;})});}_0x3ff07f=_[_0x219d('0x39')]({},_0x3ff07f,_0x12b654['options']);return _0x37ccd4[_0x219d('0x47')](_0x3ff07f);}})[_0x219d('0x22')](function(_0x7899d0){if(_0x7899d0){_0x35bf9c=_0x7899d0[_0x219d('0x34')];if(!_0x12b654[_0x219d('0x2f')][_0x219d('0x4a')](_0x219d('0x4b'))){_0x3ff07f[_0x219d('0x1b')]=qs[_0x219d('0x1b')](_0x12b654['query'][_0x219d('0x1b')]);_0x3ff07f[_0x219d('0x19')]=qs['offset'](_0x12b654[_0x219d('0x2f')]['offset']);}return _0x37ccd4[_0x219d('0x47')](_0x3ff07f);}})[_0x219d('0x22')](function(_0x44b835){if(_0x44b835){return _0x44b835?{'count':_0x35bf9c,'rows':_0x44b835}:null;}})[_0x219d('0x22')](respondWithResult(_0x26a77c,null))[_0x219d('0x3e')](handleError(_0x26a77c,null));};exports[_0x219d('0x4c')]=function(_0x4245a0,_0x560eeb,_0xd5927e){if(_0x4245a0[_0x219d('0x45')]['id']){delete _0x4245a0[_0x219d('0x45')]['id'];}return db[_0x219d('0x2a')][_0x219d('0x48')]({'where':{'id':_0x4245a0[_0x219d('0x46')]['id']}})['then'](handleEntityNotFound(_0x560eeb,null))[_0x219d('0x22')](function(_0x42e09c){if(_0x42e09c){_0x4245a0[_0x219d('0x45')][_0x219d('0x4d')]=_0x42e09c['id'];_0x4245a0['body'][_0x219d('0x4e')]=integrations['getSubjects'](_0x4245a0[_0x219d('0x45')][_0x219d('0x4f')],_0x4245a0[_0x219d('0x45')][_0x219d('0x2d')]);_0x4245a0[_0x219d('0x45')][_0x219d('0x50')]=integrations[_0x219d('0x51')](_0x4245a0[_0x219d('0x45')][_0x219d('0x4f')],_0x4245a0[_0x219d('0x45')]['type']);return db[_0x219d('0x52')][_0x219d('0x44')](_0x4245a0[_0x219d('0x45')],{'include':[{'model':db[_0x219d('0x53')],'as':_0x219d('0x4e')},{'model':db[_0x219d('0x53')],'as':_0x219d('0x50')}]});}return null;})[_0x219d('0x22')](respondWithResult(_0x560eeb,null))['catch'](handleError(_0x560eeb,null));};exports[_0x219d('0x54')]=function(_0x1cc7df,_0x436bde,_0x2b959c){var _0x5a0668='';var _0x572e64='';return db[_0x219d('0x2a')][_0x219d('0x48')]({'where':{'id':_0x1cc7df[_0x219d('0x46')]['id']},'attributes':['id',_0x219d('0x55'),'remoteUri',_0x219d('0x56')]})[_0x219d('0x22')](handleEntityNotFound(_0x436bde,null))['then'](function(_0x2fc364){if(_0x2fc364){_0x572e64=_0x2fc364[_0x219d('0x55')];_0x5a0668=_0x2fc364[_0x219d('0x57')];var _0x19e20b=_0x2fc364[_0x219d('0x57')][_0x219d('0x58')](-0x1);if(_0x19e20b==='/'){_0x5a0668=_0x5a0668[_0x219d('0x59')](0x0,_0x5a0668[_0x219d('0x5a')](_0x19e20b));}return rp({'method':_0x219d('0x5b'),'uri':util[_0x219d('0x5c')](_0x219d('0x5d'),_0x5a0668,_0x219d('0x5e')),'headers':{'Authorization':_0x219d('0x5f')+_0x2fc364[_0x219d('0x56')]},'json':!![]});}})['then'](function(_0x2d8de4){if(_0x2d8de4){var _0x442c0a=_0x2d8de4[_0x219d('0x60')];var _0x3d1304=![];var _0x546cde=null;for(_0x546cde=0x0;_0x546cde<_0x442c0a['length'];_0x546cde++){if(_0x442c0a[_0x546cde][_0x219d('0x61')]===_0x572e64){_0x3d1304=!![];}}if(_0x3d1304){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})['then'](respondWithResult(_0x436bde,null))[_0x219d('0x3e')](function(_0x21c71f){var _0x39962c=_0x1cc7df[_0x219d('0x2f')][_0x219d('0x62')]?0x1f4:_0x21c71f[_0x219d('0x63')]||0x1f4;logger[_0x219d('0x25')](_0x219d('0x64'),_0x219d('0x54'),_0x39962c,JSON[_0x219d('0x65')](_0x21c71f));delete _0x21c71f[_0x219d('0x27')];if(_0x39962c===0x191){_0x39962c=0x190;}_0x436bde['status'](_0x39962c)[_0x219d('0x28')](_0x1cc7df[_0x219d('0x2f')][_0x219d('0x62')]?{'message':'Wrong\x20credentials','statusCode':_0x21c71f[_0x219d('0x63')]}:_0x21c71f);});}; \ No newline at end of file +var _0x9288=['path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','index','map','FreshsalesAccount','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','findAll','rows','catch','show','params','keys','rawAttributes','length','includeAll','include','create','body','find','getConfigurations','findOne','FreshsalesConfiguration','addConfiguration','AccountId','channel','getDescriptions','FreshsalesField','Descriptions','getFields','username','remoteUri','apiKey','substring','lastIndexOf','GET','format','%s%s','/api/selector/owners','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util'];(function(_0x186950,_0x28827b){var _0x1d2d63=function(_0x496342){while(--_0x496342){_0x186950['push'](_0x186950['shift']());}};_0x1d2d63(++_0x28827b);}(_0x9288,0x1a0));var _0x8928=function(_0x17337b,_0x36028a){_0x17337b=_0x17337b-0x0;var _0x57d672=_0x9288[_0x17337b];return _0x57d672;};'use strict';var emlformat=require(_0x8928('0x0'));var rimraf=require(_0x8928('0x1'));var zipdir=require(_0x8928('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8928('0x3'));var moment=require(_0x8928('0x4'));var BPromise=require(_0x8928('0x5'));var Mustache=require(_0x8928('0x6'));var util=require(_0x8928('0x7'));var path=require(_0x8928('0x8'));var sox=require(_0x8928('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8928('0xa'));var _=require(_0x8928('0xb'));var squel=require(_0x8928('0xc'));var crypto=require(_0x8928('0xd'));var jsforce=require(_0x8928('0xe'));var deskjs=require(_0x8928('0xf'));var toCsv=require(_0x8928('0x10'));var querystring=require(_0x8928('0x11'));var Papa=require(_0x8928('0x12'));var Redis=require(_0x8928('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8928('0x14'));var hardwareService=require(_0x8928('0x15'));var logger=require(_0x8928('0x16'))(_0x8928('0x17'));var utils=require(_0x8928('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x8928('0x19'));var db=require(_0x8928('0x1a'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x327388,_0x326469){_0x326469=_0x326469||0xcc;return function(_0x22d147){if(_0x22d147){return _0x327388[_0x8928('0x1b')](_0x326469);}return _0x327388[_0x8928('0x1c')](_0x326469)['end']();};}function respondWithResult(_0x4988aa,_0x2a4b89){_0x2a4b89=_0x2a4b89||0xc8;return function(_0x38e5a7){if(_0x38e5a7){return _0x4988aa['status'](_0x2a4b89)[_0x8928('0x1d')](_0x38e5a7);}};}function respondWithFilteredResult(_0x1500d9,_0x346a2a){return function(_0x29d34f){if(_0x29d34f){var _0x2844b1=typeof _0x346a2a[_0x8928('0x1e')]===_0x8928('0x1f')&&typeof _0x346a2a[_0x8928('0x20')]===_0x8928('0x1f');var _0x1467c0=_0x29d34f[_0x8928('0x21')];var _0x322cdb=_0x2844b1?0x0:_0x346a2a[_0x8928('0x1e')];var _0x5d7458=_0x2844b1?_0x29d34f[_0x8928('0x21')]:_0x346a2a[_0x8928('0x1e')]+_0x346a2a[_0x8928('0x20')];var _0x2378f4;if(_0x5d7458>=_0x1467c0){_0x5d7458=_0x1467c0;_0x2378f4=0xc8;}else{_0x2378f4=0xce;}_0x1500d9[_0x8928('0x1c')](_0x2378f4);return _0x1500d9[_0x8928('0x22')]('Content-Range',_0x322cdb+'-'+_0x5d7458+'/'+_0x1467c0)[_0x8928('0x1d')](_0x29d34f);}return null;};}function patchUpdates(_0x2d3fbe){return function(_0x14f484){try{jsonpatch[_0x8928('0x23')](_0x14f484,_0x2d3fbe,!![]);}catch(_0x55892c){return BPromise[_0x8928('0x24')](_0x55892c);}return _0x14f484[_0x8928('0x25')]();};}function saveUpdates(_0x2db15b,_0x59f630){return function(_0x4703c9){if(_0x4703c9){return _0x4703c9[_0x8928('0x26')](_0x2db15b)[_0x8928('0x27')](function(_0x4fc0b5){return _0x4fc0b5;});}return null;};}function removeEntity(_0x3a3646,_0x290ae6){return function(_0x1f0ce5){if(_0x1f0ce5){return _0x1f0ce5[_0x8928('0x28')]()[_0x8928('0x27')](function(){_0x3a3646['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2e8f2f,_0x392284){return function(_0x245326){if(!_0x245326){_0x2e8f2f[_0x8928('0x1b')](0x194);}return _0x245326;};}function handleError(_0x2576fa,_0x4bcbbb){_0x4bcbbb=_0x4bcbbb||0x1f4;return function(_0x5964bd){logger[_0x8928('0x29')](_0x5964bd[_0x8928('0x2a')]);if(_0x5964bd[_0x8928('0x2b')]){delete _0x5964bd[_0x8928('0x2b')];}_0x2576fa[_0x8928('0x1c')](_0x4bcbbb)['send'](_0x5964bd);};}exports[_0x8928('0x2c')]=function(_0x3de7ee,_0x4a3437){var _0x541848={},_0x39ce0e={},_0x485bdb={'count':0x0,'rows':[]};var _0xfd3f2b=_[_0x8928('0x2d')](db[_0x8928('0x2e')]['rawAttributes'],function(_0x49eae0){return{'name':_0x49eae0[_0x8928('0x2f')],'type':_0x49eae0[_0x8928('0x30')][_0x8928('0x31')]};});_0x39ce0e[_0x8928('0x32')]=_[_0x8928('0x2d')](_0xfd3f2b,_0x8928('0x2b'));_0x39ce0e[_0x8928('0x33')]=_['keys'](_0x3de7ee[_0x8928('0x33')]);_0x39ce0e[_0x8928('0x34')]=_[_0x8928('0x35')](_0x39ce0e['model'],_0x39ce0e[_0x8928('0x33')]);_0x541848['attributes']=_[_0x8928('0x35')](_0x39ce0e[_0x8928('0x32')],qs['fields'](_0x3de7ee[_0x8928('0x33')][_0x8928('0x36')]));_0x541848[_0x8928('0x37')]=_0x541848[_0x8928('0x37')]['length']?_0x541848[_0x8928('0x37')]:_0x39ce0e[_0x8928('0x32')];if(!_0x3de7ee[_0x8928('0x33')][_0x8928('0x38')](_0x8928('0x39'))){_0x541848[_0x8928('0x20')]=qs['limit'](_0x3de7ee[_0x8928('0x33')][_0x8928('0x20')]);_0x541848[_0x8928('0x1e')]=qs[_0x8928('0x1e')](_0x3de7ee[_0x8928('0x33')][_0x8928('0x1e')]);}_0x541848['order']=qs[_0x8928('0x3a')](_0x3de7ee[_0x8928('0x33')][_0x8928('0x3a')]);_0x541848['where']=qs[_0x8928('0x34')](_[_0x8928('0x3b')](_0x3de7ee[_0x8928('0x33')],_0x39ce0e[_0x8928('0x34')]),_0xfd3f2b);if(_0x3de7ee[_0x8928('0x33')][_0x8928('0x3c')]){_0x541848[_0x8928('0x3d')]=_[_0x8928('0x3e')](_0x541848[_0x8928('0x3d')],{'$or':_[_0x8928('0x2d')](_0xfd3f2b,function(_0x271d07){if(_0x271d07['type']!==_0x8928('0x3f')){var _0x2a22dd={};_0x2a22dd[_0x271d07[_0x8928('0x2b')]]={'$like':'%'+_0x3de7ee[_0x8928('0x33')][_0x8928('0x3c')]+'%'};return _0x2a22dd;}})});}_0x541848=_[_0x8928('0x3e')]({},_0x541848,_0x3de7ee[_0x8928('0x40')]);var _0xbcbd09={'where':_0x541848['where']};return db[_0x8928('0x2e')][_0x8928('0x21')](_0xbcbd09)[_0x8928('0x27')](function(_0x3415e8){_0x485bdb[_0x8928('0x21')]=_0x3415e8;if(_0x3de7ee[_0x8928('0x33')]['includeAll']){_0x541848['include']=[{'all':!![]}];}return db[_0x8928('0x2e')][_0x8928('0x41')](_0x541848);})[_0x8928('0x27')](function(_0x10aa62){_0x485bdb[_0x8928('0x42')]=_0x10aa62;return _0x485bdb;})[_0x8928('0x27')](respondWithFilteredResult(_0x4a3437,_0x541848))[_0x8928('0x43')](handleError(_0x4a3437,null));};exports[_0x8928('0x44')]=function(_0x31c893,_0x1908c9){var _0x486366={'raw':![],'where':{'id':_0x31c893[_0x8928('0x45')]['id']}},_0x2eb4f1={};_0x2eb4f1['model']=_[_0x8928('0x46')](db[_0x8928('0x2e')][_0x8928('0x47')]);_0x2eb4f1[_0x8928('0x33')]=_[_0x8928('0x46')](_0x31c893['query']);_0x2eb4f1[_0x8928('0x34')]=_[_0x8928('0x35')](_0x2eb4f1[_0x8928('0x32')],_0x2eb4f1['query']);_0x486366[_0x8928('0x37')]=_[_0x8928('0x35')](_0x2eb4f1[_0x8928('0x32')],qs[_0x8928('0x36')](_0x31c893[_0x8928('0x33')][_0x8928('0x36')]));_0x486366['attributes']=_0x486366[_0x8928('0x37')][_0x8928('0x48')]?_0x486366[_0x8928('0x37')]:_0x2eb4f1[_0x8928('0x32')];if(_0x31c893[_0x8928('0x33')][_0x8928('0x49')]){_0x486366[_0x8928('0x4a')]=[{'all':!![]}];}_0x486366=_[_0x8928('0x3e')]({},_0x486366,_0x31c893['options']);return db[_0x8928('0x2e')]['find'](_0x486366)[_0x8928('0x27')](handleEntityNotFound(_0x1908c9,null))['then'](respondWithResult(_0x1908c9,null))[_0x8928('0x43')](handleError(_0x1908c9,null));};exports[_0x8928('0x4b')]=function(_0x2fad5b,_0x65ae32){return db[_0x8928('0x2e')][_0x8928('0x4b')](_0x2fad5b[_0x8928('0x4c')],{})[_0x8928('0x27')](respondWithResult(_0x65ae32,0xc9))['catch'](handleError(_0x65ae32,null));};exports[_0x8928('0x26')]=function(_0xa1ef24,_0x53b064){if(_0xa1ef24[_0x8928('0x4c')]['id']){delete _0xa1ef24[_0x8928('0x4c')]['id'];}return db['FreshsalesAccount'][_0x8928('0x4d')]({'where':{'id':_0xa1ef24[_0x8928('0x45')]['id']}})[_0x8928('0x27')](handleEntityNotFound(_0x53b064,null))[_0x8928('0x27')](saveUpdates(_0xa1ef24[_0x8928('0x4c')],null))[_0x8928('0x27')](respondWithResult(_0x53b064,null))[_0x8928('0x43')](handleError(_0x53b064,null));};exports['destroy']=function(_0xed5fa6,_0x517f9e){return db[_0x8928('0x2e')][_0x8928('0x4d')]({'where':{'id':_0xed5fa6[_0x8928('0x45')]['id']}})['then'](handleEntityNotFound(_0x517f9e,null))[_0x8928('0x27')](removeEntity(_0x517f9e,null))[_0x8928('0x43')](handleError(_0x517f9e,null));};exports[_0x8928('0x4e')]=function(_0x435655,_0xeade34,_0x4dd321){var _0x3b58f4={};var _0x1a61a5={};var _0x4e5d7c;var _0x150fdf;return db[_0x8928('0x2e')][_0x8928('0x4f')]({'where':{'id':_0x435655[_0x8928('0x45')]['id']}})[_0x8928('0x27')](handleEntityNotFound(_0xeade34,null))[_0x8928('0x27')](function(_0x286788){if(_0x286788){_0x4e5d7c=_0x286788;_0x1a61a5[_0x8928('0x32')]=_[_0x8928('0x46')](db[_0x8928('0x50')][_0x8928('0x47')]);_0x1a61a5[_0x8928('0x33')]=_['keys'](_0x435655['query']);_0x1a61a5['filters']=_[_0x8928('0x35')](_0x1a61a5[_0x8928('0x32')],_0x1a61a5[_0x8928('0x33')]);_0x3b58f4[_0x8928('0x37')]=_['intersection'](_0x1a61a5[_0x8928('0x32')],qs[_0x8928('0x36')](_0x435655[_0x8928('0x33')]['fields']));_0x3b58f4['attributes']=_0x3b58f4[_0x8928('0x37')][_0x8928('0x48')]?_0x3b58f4['attributes']:_0x1a61a5[_0x8928('0x32')];_0x3b58f4['order']=qs[_0x8928('0x3a')](_0x435655[_0x8928('0x33')][_0x8928('0x3a')]);_0x3b58f4[_0x8928('0x3d')]=qs[_0x8928('0x34')](_[_0x8928('0x3b')](_0x435655[_0x8928('0x33')],_0x1a61a5['filters']));if(_0x435655[_0x8928('0x33')][_0x8928('0x3c')]){_0x3b58f4[_0x8928('0x3d')]=_[_0x8928('0x3e')](_0x3b58f4[_0x8928('0x3d')],{'$or':_[_0x8928('0x2d')](_0x3b58f4[_0x8928('0x37')],function(_0x5568d){var _0x303279={};_0x303279[_0x5568d]={'$like':'%'+_0x435655['query'][_0x8928('0x3c')]+'%'};return _0x303279;})});}_0x3b58f4=_[_0x8928('0x3e')]({},_0x3b58f4,_0x435655[_0x8928('0x40')]);return _0x4e5d7c[_0x8928('0x4e')](_0x3b58f4);}})[_0x8928('0x27')](function(_0x532927){if(_0x532927){_0x150fdf=_0x532927[_0x8928('0x48')];if(!_0x435655[_0x8928('0x33')][_0x8928('0x38')](_0x8928('0x39'))){_0x3b58f4[_0x8928('0x20')]=qs[_0x8928('0x20')](_0x435655[_0x8928('0x33')][_0x8928('0x20')]);_0x3b58f4[_0x8928('0x1e')]=qs[_0x8928('0x1e')](_0x435655[_0x8928('0x33')][_0x8928('0x1e')]);}return _0x4e5d7c['getConfigurations'](_0x3b58f4);}})[_0x8928('0x27')](function(_0x114212){if(_0x114212){return _0x114212?{'count':_0x150fdf,'rows':_0x114212}:null;}})[_0x8928('0x27')](respondWithResult(_0xeade34,null))[_0x8928('0x43')](handleError(_0xeade34,null));};exports[_0x8928('0x51')]=function(_0x1a597e,_0x287182,_0xcfee74){if(_0x1a597e[_0x8928('0x4c')]['id']){delete _0x1a597e['body']['id'];}return db['FreshsalesAccount'][_0x8928('0x4f')]({'where':{'id':_0x1a597e['params']['id']}})[_0x8928('0x27')](handleEntityNotFound(_0x287182,null))[_0x8928('0x27')](function(_0x5e0f4c){if(_0x5e0f4c){_0x1a597e[_0x8928('0x4c')][_0x8928('0x52')]=_0x5e0f4c['id'];_0x1a597e[_0x8928('0x4c')]['Subjects']=integrations['getSubjects'](_0x1a597e[_0x8928('0x4c')][_0x8928('0x53')],_0x1a597e[_0x8928('0x4c')][_0x8928('0x30')]);_0x1a597e['body']['Descriptions']=integrations[_0x8928('0x54')](_0x1a597e[_0x8928('0x4c')][_0x8928('0x53')],_0x1a597e['body'][_0x8928('0x30')]);return db[_0x8928('0x50')][_0x8928('0x4b')](_0x1a597e[_0x8928('0x4c')],{'include':[{'model':db['FreshsalesField'],'as':'Subjects'},{'model':db[_0x8928('0x55')],'as':_0x8928('0x56')}]});}return null;})[_0x8928('0x27')](respondWithResult(_0x287182,null))[_0x8928('0x43')](handleError(_0x287182,null));};exports[_0x8928('0x57')]=function(_0x439630,_0x37b62c,_0x4b33ad){var _0x325523='';var _0x12b6d3='';return db['FreshsalesAccount'][_0x8928('0x4f')]({'where':{'id':_0x439630[_0x8928('0x45')]['id']},'attributes':['id',_0x8928('0x58'),_0x8928('0x59'),_0x8928('0x5a')]})['then'](handleEntityNotFound(_0x37b62c,null))[_0x8928('0x27')](function(_0x515ad4){if(_0x515ad4){_0x12b6d3=_0x515ad4['username'];_0x325523=_0x515ad4[_0x8928('0x59')];var _0x749338=_0x515ad4[_0x8928('0x59')]['slice'](-0x1);if(_0x749338==='/'){_0x325523=_0x325523[_0x8928('0x5b')](0x0,_0x325523[_0x8928('0x5c')](_0x749338));}return rp({'method':_0x8928('0x5d'),'uri':util[_0x8928('0x5e')](_0x8928('0x5f'),_0x325523,_0x8928('0x60')),'headers':{'Authorization':_0x8928('0x61')+_0x515ad4[_0x8928('0x5a')]},'json':!![]});}})[_0x8928('0x27')](function(_0x3f5422){if(_0x3f5422){var _0x5178ef=_0x3f5422[_0x8928('0x62')];var _0x3a22b0=![];var _0x54b4a2=null;for(_0x54b4a2=0x0;_0x54b4a2<_0x5178ef['length'];_0x54b4a2++){if(_0x5178ef[_0x54b4a2][_0x8928('0x63')]===_0x12b6d3){_0x3a22b0=!![];}}if(_0x3a22b0){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x8928('0x64')});}}})[_0x8928('0x27')](respondWithResult(_0x37b62c,null))[_0x8928('0x43')](function(_0x2ee8fc){var _0x163c9b=_0x439630[_0x8928('0x33')][_0x8928('0x65')]?0x1f4:_0x2ee8fc['statusCode']||0x1f4;logger[_0x8928('0x29')](_0x8928('0x66'),_0x8928('0x57'),_0x163c9b,JSON[_0x8928('0x67')](_0x2ee8fc));delete _0x2ee8fc[_0x8928('0x2b')];if(_0x163c9b===0x191){_0x163c9b=0x190;}_0x37b62c[_0x8928('0x1c')](_0x163c9b)['send'](_0x439630['query'][_0x8928('0x65')]?{'message':_0x8928('0x68'),'statusCode':_0x2ee8fc[_0x8928('0x69')]}:_0x2ee8fc);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 8ed3b4d..48206e4 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 _0xafc4=['path','../../components/integrations/configuration','exports','define','FreshsalesAccount','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x27d39d,_0x21d565){var _0x2b033a=function(_0x31eb6c){while(--_0x31eb6c){_0x27d39d['push'](_0x27d39d['shift']());}};_0x2b033a(++_0x21d565);}(_0xafc4,0x69));var _0x4afc=function(_0x3fb6b8,_0x44837a){_0x3fb6b8=_0x3fb6b8-0x0;var _0x2890ac=_0xafc4[_0x3fb6b8];return _0x2890ac;};'use strict';var _=require(_0x4afc('0x0'));var util=require('util');var logger=require(_0x4afc('0x1'))('api');var moment=require(_0x4afc('0x2'));var BPromise=require(_0x4afc('0x3'));var rp=require(_0x4afc('0x4'));var fs=require('fs');var path=require(_0x4afc('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intFreshsalesAccount.attributes');var integrations=require(_0x4afc('0x6'));module[_0x4afc('0x7')]=function(_0x16953b,_0x1bb281){return _0x16953b[_0x4afc('0x8')](_0x4afc('0x9'),attributes,{'tableName':'int_freshsales_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4c60=['exports','define','FreshsalesAccount','lodash','util','../../config/logger','api','bluebird','./intFreshsalesAccount.attributes','../../components/integrations/configuration'];(function(_0x5c528c,_0x237dbf){var _0x44146d=function(_0x2a7db7){while(--_0x2a7db7){_0x5c528c['push'](_0x5c528c['shift']());}};_0x44146d(++_0x237dbf);}(_0x4c60,0xc1));var _0x04c6=function(_0x242c76,_0x239a04){_0x242c76=_0x242c76-0x0;var _0x3fe648=_0x4c60[_0x242c76];return _0x3fe648;};'use strict';var _=require(_0x04c6('0x0'));var util=require(_0x04c6('0x1'));var logger=require(_0x04c6('0x2'))(_0x04c6('0x3'));var moment=require('moment');var BPromise=require(_0x04c6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x04c6('0x5'));var integrations=require(_0x04c6('0x6'));module[_0x04c6('0x7')]=function(_0x12bd5d,_0x2b9041){return _0x12bd5d[_0x04c6('0x8')](_0x04c6('0x9'),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 026b905..b5b9dcb 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 _0x5c3c=['find','raw','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','GetFreshsalesAccount','FreshsalesAccount','findAll','options','where','limit','include','map','model','attributes','debug','catch','ShowFreshsalesAccount'];(function(_0x506839,_0x48146f){var _0x4401a7=function(_0x519e76){while(--_0x519e76){_0x506839['push'](_0x506839['shift']());}};_0x4401a7(++_0x48146f);}(_0x5c3c,0x132));var _0xc5c3=function(_0x5c9307,_0x5b97e4){_0x5c9307=_0x5c9307-0x0;var _0x373e29=_0x5c3c[_0x5c9307];return _0x373e29;};'use strict';var _=require(_0xc5c3('0x0'));var util=require(_0xc5c3('0x1'));var moment=require(_0xc5c3('0x2'));var BPromise=require(_0xc5c3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc5c3('0x4'));var db=require(_0xc5c3('0x5'))['db'];var utils=require(_0xc5c3('0x6'));var logger=require(_0xc5c3('0x7'))(_0xc5c3('0x8'));var config=require(_0xc5c3('0x9'));var jayson=require(_0xc5c3('0xa'));var client=jayson[_0xc5c3('0xb')][_0xc5c3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5a392b,_0x4b8404,_0x591f7d){return new BPromise(function(_0x723c31,_0x522be1){return client['request'](_0x5a392b,_0x591f7d)[_0xc5c3('0xd')](function(_0x46e2c1){logger['info'](_0xc5c3('0xe'),_0x4b8404,_0xc5c3('0xf'));logger['debug'](_0xc5c3('0x10'),_0x4b8404,_0xc5c3('0xf'),JSON[_0xc5c3('0x11')](_0x46e2c1));if(_0x46e2c1['error']){if(_0x46e2c1[_0xc5c3('0x12')][_0xc5c3('0x13')]===0x1f4){logger['error'](_0xc5c3('0xe'),_0x4b8404,_0x46e2c1[_0xc5c3('0x12')][_0xc5c3('0x14')]);return _0x522be1(_0x46e2c1['error'][_0xc5c3('0x14')]);}logger[_0xc5c3('0x12')](_0xc5c3('0xe'),_0x4b8404,_0x46e2c1[_0xc5c3('0x12')][_0xc5c3('0x14')]);return _0x723c31(_0x46e2c1['error']['message']);}else{logger[_0xc5c3('0x15')](_0xc5c3('0xe'),_0x4b8404,_0xc5c3('0xf'));_0x723c31(_0x46e2c1[_0xc5c3('0x16')]['message']);}})['catch'](function(_0x467ba9){logger['error'](_0xc5c3('0xe'),_0x4b8404,_0x467ba9);_0x522be1(_0x467ba9);});});}exports[_0xc5c3('0x17')]=function(_0x2ff158){var _0x13c867=this;return new Promise(function(_0x28bae6,_0x5e11d5){return db[_0xc5c3('0x18')][_0xc5c3('0x19')]({'raw':_0x2ff158[_0xc5c3('0x1a')]?_0x2ff158[_0xc5c3('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x2ff158[_0xc5c3('0x1a')]?_0x2ff158[_0xc5c3('0x1a')][_0xc5c3('0x1b')]||null:null,'attributes':_0x2ff158[_0xc5c3('0x1a')]?_0x2ff158[_0xc5c3('0x1a')]['attributes']||null:null,'limit':_0x2ff158[_0xc5c3('0x1a')]?_0x2ff158[_0xc5c3('0x1a')][_0xc5c3('0x1c')]||null:null,'include':_0x2ff158[_0xc5c3('0x1a')]?_0x2ff158[_0xc5c3('0x1a')][_0xc5c3('0x1d')]?_[_0xc5c3('0x1e')](_0x2ff158['options']['include'],function(_0x45affe){return{'model':db[_0x45affe[_0xc5c3('0x1f')]],'as':_0x45affe['as'],'attributes':_0x45affe['attributes'],'include':_0x45affe['include']?_[_0xc5c3('0x1e')](_0x45affe[_0xc5c3('0x1d')],function(_0x38a3df){return{'model':db[_0x38a3df['model']],'as':_0x38a3df['as'],'attributes':_0x38a3df['attributes'],'include':_0x38a3df[_0xc5c3('0x1d')]?_[_0xc5c3('0x1e')](_0x38a3df[_0xc5c3('0x1d')],function(_0x29791c){return{'model':db[_0x29791c['model']],'as':_0x29791c['as'],'attributes':_0x29791c[_0xc5c3('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2eacec){logger['info'](_0xc5c3('0x17'),_0x2ff158);logger[_0xc5c3('0x21')](_0xc5c3('0x17'),_0x2ff158,JSON[_0xc5c3('0x11')](_0x2eacec));_0x28bae6(_0x2eacec);})[_0xc5c3('0x22')](function(_0x2d07e1){logger[_0xc5c3('0x12')]('GetFreshsalesAccount',_0x2d07e1[_0xc5c3('0x14')],_0x2ff158);_0x5e11d5(_0x13c867['error'](0x1f4,_0x2d07e1[_0xc5c3('0x14')]));});});};exports[_0xc5c3('0x23')]=function(_0x5b26e9){var _0x4daa8b=this;return new Promise(function(_0x2e648f,_0x46f149){return db[_0xc5c3('0x18')][_0xc5c3('0x24')]({'raw':_0x5b26e9['options']?_0x5b26e9[_0xc5c3('0x1a')][_0xc5c3('0x25')]===undefined?!![]:![]:!![],'where':_0x5b26e9[_0xc5c3('0x1a')]?_0x5b26e9[_0xc5c3('0x1a')][_0xc5c3('0x1b')]||null:null,'attributes':_0x5b26e9[_0xc5c3('0x1a')]?_0x5b26e9[_0xc5c3('0x1a')][_0xc5c3('0x20')]||null:null,'include':_0x5b26e9[_0xc5c3('0x1a')]?_0x5b26e9['options'][_0xc5c3('0x1d')]?_[_0xc5c3('0x1e')](_0x5b26e9[_0xc5c3('0x1a')][_0xc5c3('0x1d')],function(_0x330391){return{'model':db[_0x330391[_0xc5c3('0x1f')]],'as':_0x330391['as'],'attributes':_0x330391[_0xc5c3('0x20')],'include':_0x330391['include']?_['map'](_0x330391[_0xc5c3('0x1d')],function(_0x55fccf){return{'model':db[_0x55fccf[_0xc5c3('0x1f')]],'as':_0x55fccf['as'],'attributes':_0x55fccf[_0xc5c3('0x20')],'include':_0x55fccf[_0xc5c3('0x1d')]?_[_0xc5c3('0x1e')](_0x55fccf[_0xc5c3('0x1d')],function(_0x498677){return{'model':db[_0x498677[_0xc5c3('0x1f')]],'as':_0x498677['as'],'attributes':_0x498677[_0xc5c3('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x29f57d){logger[_0xc5c3('0x15')](_0xc5c3('0x23'),_0x5b26e9);logger[_0xc5c3('0x21')](_0xc5c3('0x23'),_0x5b26e9,JSON[_0xc5c3('0x11')](_0x29f57d));_0x2e648f(_0x29f57d);})[_0xc5c3('0x22')](function(_0x2ad440){logger[_0xc5c3('0x12')](_0xc5c3('0x23'),_0x2ad440['message'],_0x5b26e9);_0x46f149(_0x4daa8b[_0xc5c3('0x12')](0x1f4,_0x2ad440['message']));});});}; \ No newline at end of file +var _0x7a54=['http','info','FreshsalesAccount,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','FreshsalesAccount','findAll','options','raw','where','attributes','include','map','model','then','GetFreshsalesAccount','ShowFreshsalesAccount','find','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1ca330,_0x514c16){var _0x57251c=function(_0x6b6ec6){while(--_0x6b6ec6){_0x1ca330['push'](_0x1ca330['shift']());}};_0x57251c(++_0x514c16);}(_0x7a54,0x106));var _0x47a5=function(_0x53e09a,_0xffeb61){_0x53e09a=_0x53e09a-0x0;var _0x5cab53=_0x7a54[_0x53e09a];return _0x5cab53;};'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')]('FreshsalesAccount,\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['GetFreshsalesAccount']=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,'limit':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['limit']||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1b')]?_[_0x47a5('0x1c')](_0x5247fd['options'][_0x47a5('0x1b')],function(_0x385687){return{'model':db[_0x385687['model']],'as':_0x385687['as'],'attributes':_0x385687[_0x47a5('0x1a')],'include':_0x385687[_0x47a5('0x1b')]?_[_0x47a5('0x1c')](_0x385687[_0x47a5('0x1b')],function(_0x3abd6a){return{'model':db[_0x3abd6a['model']],'as':_0x3abd6a['as'],'attributes':_0x3abd6a['attributes'],'include':_0x3abd6a[_0x47a5('0x1b')]?_['map'](_0x3abd6a[_0x47a5('0x1b')],function(_0x5b6c4e){return{'model':db[_0x5b6c4e[_0x47a5('0x1d')]],'as':_0x5b6c4e['as'],'attributes':_0x5b6c4e[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x47a5('0x1e')](function(_0x1dac65){logger[_0x47a5('0xb')](_0x47a5('0x1f'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1f'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1dac65));_0xaf70a6(_0x1dac65);})[_0x47a5('0x14')](function(_0x1127f8){logger[_0x47a5('0xf')](_0x47a5('0x1f'),_0x1127f8['message'],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x1127f8['message']));});});};exports[_0x47a5('0x20')]=function(_0x9ac908){var _0x16901f=this;return new Promise(function(_0x4d6b57,_0x256650){return db[_0x47a5('0x15')][_0x47a5('0x21')]({'raw':_0x9ac908[_0x47a5('0x17')]?_0x9ac908['options']['raw']===undefined?!![]:![]:!![],'where':_0x9ac908[_0x47a5('0x17')]?_0x9ac908[_0x47a5('0x17')]['where']||null:null,'attributes':_0x9ac908['options']?_0x9ac908[_0x47a5('0x17')][_0x47a5('0x1a')]||null:null,'include':_0x9ac908['options']?_0x9ac908[_0x47a5('0x17')]['include']?_[_0x47a5('0x1c')](_0x9ac908[_0x47a5('0x17')]['include'],function(_0x4843c0){return{'model':db[_0x4843c0[_0x47a5('0x1d')]],'as':_0x4843c0['as'],'attributes':_0x4843c0['attributes'],'include':_0x4843c0[_0x47a5('0x1b')]?_[_0x47a5('0x1c')](_0x4843c0[_0x47a5('0x1b')],function(_0x52749b){return{'model':db[_0x52749b[_0x47a5('0x1d')]],'as':_0x52749b['as'],'attributes':_0x52749b['attributes'],'include':_0x52749b['include']?_[_0x47a5('0x1c')](_0x52749b['include'],function(_0x25cce0){return{'model':db[_0x25cce0['model']],'as':_0x25cce0['as'],'attributes':_0x25cce0[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x47a5('0x1e')](function(_0x38c8d4){logger[_0x47a5('0xb')](_0x47a5('0x20'),_0x9ac908);logger[_0x47a5('0xd')](_0x47a5('0x20'),_0x9ac908,JSON[_0x47a5('0xe')](_0x38c8d4));_0x4d6b57(_0x38c8d4);})[_0x47a5('0x14')](function(_0x4caed5){logger[_0x47a5('0xf')](_0x47a5('0x20'),_0x4caed5['message'],_0x9ac908);_0x256650(_0x16901f[_0x47a5('0xf')](0x1f4,_0x4caed5[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 8fc4b66..bd9564e 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 _0x0d80=['get','/:id','show','/:id/descriptions','/:id/fields','getFields','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','isAuthenticated','index'];(function(_0xd49fef,_0x23f01e){var _0x304be8=function(_0x59698b){while(--_0x59698b){_0xd49fef['push'](_0xd49fef['shift']());}};_0x304be8(++_0x23f01e);}(_0x0d80,0x145));var _0x00d8=function(_0xd1c39b,_0x16f0c6){_0xd1c39b=_0xd1c39b-0x0;var _0x58f5bc=_0x0d80[_0xd1c39b];return _0x58f5bc;};'use strict';var multer=require(_0x00d8('0x0'));var util=require(_0x00d8('0x1'));var path=require(_0x00d8('0x2'));var timeout=require(_0x00d8('0x3'));var express=require(_0x00d8('0x4'));var router=express[_0x00d8('0x5')]();var fs_extra=require(_0x00d8('0x6'));var auth=require(_0x00d8('0x7'));var interaction=require(_0x00d8('0x8'));var config=require(_0x00d8('0x9'));var controller=require(_0x00d8('0xa'));router['get']('/',auth[_0x00d8('0xb')](),controller[_0x00d8('0xc')]);router[_0x00d8('0xd')](_0x00d8('0xe'),auth[_0x00d8('0xb')](),controller[_0x00d8('0xf')]);router[_0x00d8('0xd')]('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router['get'](_0x00d8('0x10'),auth[_0x00d8('0xb')](),controller['getDescriptions']);router[_0x00d8('0xd')](_0x00d8('0x11'),auth[_0x00d8('0xb')](),controller[_0x00d8('0x12')]);router[_0x00d8('0x13')]('/',auth[_0x00d8('0xb')](),controller[_0x00d8('0x14')]);router[_0x00d8('0x15')](_0x00d8('0xe'),auth[_0x00d8('0xb')](),controller[_0x00d8('0x16')]);router[_0x00d8('0x17')](_0x00d8('0xe'),auth['isAuthenticated'](),controller[_0x00d8('0x18')]);module[_0x00d8('0x19')]=router; \ No newline at end of file +var _0xdf4e=['get','/:id','isAuthenticated','/:id/subjects','getSubjects','getDescriptions','/:id/fields','getFields','post','create','put','update','delete','exports','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','index'];(function(_0x20933d,_0x3b57c7){var _0x1b3146=function(_0x5cd15f){while(--_0x5cd15f){_0x20933d['push'](_0x20933d['shift']());}};_0x1b3146(++_0x3b57c7);}(_0xdf4e,0x17e));var _0xedf4=function(_0x1ae31c,_0x8dcd2d){_0x1ae31c=_0x1ae31c-0x0;var _0x19519d=_0xdf4e[_0x1ae31c];return _0x19519d;};'use strict';var multer=require(_0xedf4('0x0'));var util=require('util');var path=require(_0xedf4('0x1'));var timeout=require(_0xedf4('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xedf4('0x3'));var auth=require(_0xedf4('0x4'));var interaction=require(_0xedf4('0x5'));var config=require(_0xedf4('0x6'));var controller=require(_0xedf4('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xedf4('0x8')]);router[_0xedf4('0x9')](_0xedf4('0xa'),auth[_0xedf4('0xb')](),controller['show']);router[_0xedf4('0x9')](_0xedf4('0xc'),auth['isAuthenticated'](),controller[_0xedf4('0xd')]);router['get']('/:id/descriptions',auth[_0xedf4('0xb')](),controller[_0xedf4('0xe')]);router[_0xedf4('0x9')](_0xedf4('0xf'),auth[_0xedf4('0xb')](),controller[_0xedf4('0x10')]);router[_0xedf4('0x11')]('/',auth[_0xedf4('0xb')](),controller[_0xedf4('0x12')]);router[_0xedf4('0x13')]('/:id',auth[_0xedf4('0xb')](),controller[_0xedf4('0x14')]);router[_0xedf4('0x15')](_0xedf4('0xa'),auth[_0xedf4('0xb')](),controller['destroy']);module[_0xedf4('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 9a1106c..a936b1b 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 _0x6da4=['STRING','sequelize','exports'];(function(_0x445cac,_0xcfd812){var _0x74d624=function(_0x20e6af){while(--_0x20e6af){_0x445cac['push'](_0x445cac['shift']());}};_0x74d624(++_0xcfd812);}(_0x6da4,0x169));var _0x46da=function(_0x21d996,_0x157d88){_0x21d996=_0x21d996-0x0;var _0x34e366=_0x6da4[_0x21d996];return _0x34e366;};'use strict';var Sequelize=require(_0x46da('0x0'));module[_0x46da('0x1')]={'name':{'type':Sequelize[_0x46da('0x2')]},'description':{'type':Sequelize[_0x46da('0x2')]}}; \ No newline at end of file +var _0xf88a=['exports','STRING','sequelize'];(function(_0x2486f1,_0x8a8246){var _0x5ed809=function(_0x13c6f5){while(--_0x13c6f5){_0x2486f1['push'](_0x2486f1['shift']());}};_0x5ed809(++_0x8a8246);}(_0xf88a,0x146));var _0xaf88=function(_0x1b79fa,_0x209061){_0x1b79fa=_0x1b79fa-0x0;var _0x864a7c=_0xf88a[_0x1b79fa];return _0x864a7c;};'use strict';var Sequelize=require(_0xaf88('0x0'));module[_0xaf88('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xaf88('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index b721802..c3030dc 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 _0x884d=['sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','find','catch','body','params','destroy','getSubjects','findOne','FreshsalesField','getDescriptions','pick','getFields','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','stack','name','send','index','map','FreshsalesConfiguration','rawAttributes','fieldName','type','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order'];(function(_0x14eafa,_0x1f47c7){var _0x20cbd3=function(_0xf05716){while(--_0xf05716){_0x14eafa['push'](_0x14eafa['shift']());}};_0x20cbd3(++_0x1f47c7);}(_0x884d,0xb6));var _0xd884=function(_0x5131e0,_0x55c16b){_0x5131e0=_0x5131e0-0x0;var _0x1adbac=_0x884d[_0x5131e0];return _0x1adbac;};'use strict';var emlformat=require(_0xd884('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd884('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd884('0x2'));var moment=require(_0xd884('0x3'));var BPromise=require(_0xd884('0x4'));var Mustache=require(_0xd884('0x5'));var util=require(_0xd884('0x6'));var path=require(_0xd884('0x7'));var sox=require(_0xd884('0x8'));var csv=require(_0xd884('0x9'));var ejs=require(_0xd884('0xa'));var fs=require('fs');var fs_extra=require(_0xd884('0xb'));var _=require(_0xd884('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd884('0xd'));var deskjs=require(_0xd884('0xe'));var toCsv=require(_0xd884('0x9'));var querystring=require(_0xd884('0xf'));var Papa=require(_0xd884('0x10'));var Redis=require(_0xd884('0x11'));var authService=require(_0xd884('0x12'));var qs=require(_0xd884('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xd884('0x14'));var config=require(_0xd884('0x15'));var licenseUtil=require(_0xd884('0x16'));var db=require(_0xd884('0x17'))['db'];function respondWithStatusCode(_0x36725e,_0x508249){_0x508249=_0x508249||0xcc;return function(_0x35d564){if(_0x35d564){return _0x36725e[_0xd884('0x18')](_0x508249);}return _0x36725e[_0xd884('0x19')](_0x508249)[_0xd884('0x1a')]();};}function respondWithResult(_0x52e39e,_0x21667f){_0x21667f=_0x21667f||0xc8;return function(_0x4554f1){if(_0x4554f1){return _0x52e39e[_0xd884('0x19')](_0x21667f)[_0xd884('0x1b')](_0x4554f1);}};}function respondWithFilteredResult(_0x3f8aae,_0x137eab){return function(_0x35a1a7){if(_0x35a1a7){var _0x425ff7=typeof _0x137eab[_0xd884('0x1c')]===_0xd884('0x1d')&&typeof _0x137eab[_0xd884('0x1e')]==='undefined';var _0x318cec=_0x35a1a7['count'];var _0x108221=_0x425ff7?0x0:_0x137eab[_0xd884('0x1c')];var _0x2933f8=_0x425ff7?_0x35a1a7[_0xd884('0x1f')]:_0x137eab[_0xd884('0x1c')]+_0x137eab[_0xd884('0x1e')];var _0x3cea04;if(_0x2933f8>=_0x318cec){_0x2933f8=_0x318cec;_0x3cea04=0xc8;}else{_0x3cea04=0xce;}_0x3f8aae[_0xd884('0x19')](_0x3cea04);return _0x3f8aae['set'](_0xd884('0x20'),_0x108221+'-'+_0x2933f8+'/'+_0x318cec)[_0xd884('0x1b')](_0x35a1a7);}return null;};}function patchUpdates(_0x4d7d9f){return function(_0x160db3){try{jsonpatch[_0xd884('0x21')](_0x160db3,_0x4d7d9f,!![]);}catch(_0x57f827){return BPromise[_0xd884('0x22')](_0x57f827);}return _0x160db3[_0xd884('0x23')]();};}function saveUpdates(_0x4ce27a,_0x4d573a){return function(_0xe9a1bc){if(_0xe9a1bc){return _0xe9a1bc[_0xd884('0x24')](_0x4ce27a)[_0xd884('0x25')](function(_0x3b22de){return _0x3b22de;});}return null;};}function removeEntity(_0xadb553,_0x2fa1f1){return function(_0x50356e){if(_0x50356e){return _0x50356e['destroy']()[_0xd884('0x25')](function(){_0xadb553[_0xd884('0x19')](0xcc)[_0xd884('0x1a')]();});}};}function handleEntityNotFound(_0x240142,_0x45a019){return function(_0xb8a8c2){if(!_0xb8a8c2){_0x240142[_0xd884('0x18')](0x194);}return _0xb8a8c2;};}function handleError(_0x49f805,_0x3a372e){_0x3a372e=_0x3a372e||0x1f4;return function(_0x17e126){logger['error'](_0x17e126[_0xd884('0x26')]);if(_0x17e126['name']){delete _0x17e126[_0xd884('0x27')];}_0x49f805[_0xd884('0x19')](_0x3a372e)[_0xd884('0x28')](_0x17e126);};}exports[_0xd884('0x29')]=function(_0x319626,_0x72d8b9){var _0x50c610={},_0x3676e8={},_0x1c9fe9={'count':0x0,'rows':[]};var _0x564088=_[_0xd884('0x2a')](db[_0xd884('0x2b')][_0xd884('0x2c')],function(_0x458fd7){return{'name':_0x458fd7[_0xd884('0x2d')],'type':_0x458fd7[_0xd884('0x2e')]['key']};});_0x3676e8['model']=_[_0xd884('0x2a')](_0x564088,_0xd884('0x27'));_0x3676e8[_0xd884('0x2f')]=_[_0xd884('0x30')](_0x319626[_0xd884('0x2f')]);_0x3676e8[_0xd884('0x31')]=_['intersection'](_0x3676e8[_0xd884('0x32')],_0x3676e8['query']);_0x50c610[_0xd884('0x33')]=_[_0xd884('0x34')](_0x3676e8['model'],qs[_0xd884('0x35')](_0x319626[_0xd884('0x2f')]['fields']));_0x50c610[_0xd884('0x33')]=_0x50c610[_0xd884('0x33')][_0xd884('0x36')]?_0x50c610[_0xd884('0x33')]:_0x3676e8[_0xd884('0x32')];if(!_0x319626[_0xd884('0x2f')][_0xd884('0x37')](_0xd884('0x38'))){_0x50c610[_0xd884('0x1e')]=qs[_0xd884('0x1e')](_0x319626[_0xd884('0x2f')][_0xd884('0x1e')]);_0x50c610[_0xd884('0x1c')]=qs['offset'](_0x319626[_0xd884('0x2f')][_0xd884('0x1c')]);}_0x50c610[_0xd884('0x39')]=qs['sort'](_0x319626[_0xd884('0x2f')][_0xd884('0x3a')]);_0x50c610[_0xd884('0x3b')]=qs[_0xd884('0x31')](_['pick'](_0x319626[_0xd884('0x2f')],_0x3676e8[_0xd884('0x31')]),_0x564088);if(_0x319626[_0xd884('0x2f')][_0xd884('0x3c')]){_0x50c610[_0xd884('0x3b')]=_['merge'](_0x50c610[_0xd884('0x3b')],{'$or':_[_0xd884('0x2a')](_0x564088,function(_0x32ec57){if(_0x32ec57['type']!==_0xd884('0x3d')){var _0x20fe78={};_0x20fe78[_0x32ec57['name']]={'$like':'%'+_0x319626[_0xd884('0x2f')]['filter']+'%'};return _0x20fe78;}})});}_0x50c610=_[_0xd884('0x3e')]({},_0x50c610,_0x319626[_0xd884('0x3f')]);var _0x3dc24d={'where':_0x50c610[_0xd884('0x3b')]};return db['FreshsalesConfiguration'][_0xd884('0x1f')](_0x3dc24d)[_0xd884('0x25')](function(_0x2063f3){_0x1c9fe9['count']=_0x2063f3;if(_0x319626[_0xd884('0x2f')][_0xd884('0x40')]){_0x50c610[_0xd884('0x41')]=[{'all':!![]}];}return db[_0xd884('0x2b')][_0xd884('0x42')](_0x50c610);})[_0xd884('0x25')](function(_0x294fc5){_0x1c9fe9[_0xd884('0x43')]=_0x294fc5;return _0x1c9fe9;})[_0xd884('0x25')](respondWithFilteredResult(_0x72d8b9,_0x50c610))['catch'](handleError(_0x72d8b9,null));};exports[_0xd884('0x44')]=function(_0x5181c8,_0x3833e0){var _0x1bfe1f={'raw':![],'where':{'id':_0x5181c8['params']['id']}},_0x41098a={};_0x41098a['model']=_['keys'](db['FreshsalesConfiguration']['rawAttributes']);_0x41098a['query']=_[_0xd884('0x30')](_0x5181c8['query']);_0x41098a[_0xd884('0x31')]=_[_0xd884('0x34')](_0x41098a['model'],_0x41098a[_0xd884('0x2f')]);_0x1bfe1f['attributes']=_[_0xd884('0x34')](_0x41098a['model'],qs[_0xd884('0x35')](_0x5181c8[_0xd884('0x2f')][_0xd884('0x35')]));_0x1bfe1f['attributes']=_0x1bfe1f[_0xd884('0x33')][_0xd884('0x36')]?_0x1bfe1f[_0xd884('0x33')]:_0x41098a['model'];if(_0x5181c8[_0xd884('0x2f')][_0xd884('0x40')]){_0x1bfe1f['include']=[{'all':!![]}];}_0x1bfe1f=_[_0xd884('0x3e')]({},_0x1bfe1f,_0x5181c8[_0xd884('0x3f')]);return db[_0xd884('0x2b')][_0xd884('0x45')](_0x1bfe1f)[_0xd884('0x25')](handleEntityNotFound(_0x3833e0,null))[_0xd884('0x25')](respondWithResult(_0x3833e0,null))[_0xd884('0x46')](handleError(_0x3833e0,null));};exports['create']=function(_0x52f487,_0x247ecb){return db['FreshsalesConfiguration']['create'](_0x52f487[_0xd884('0x47')],{})[_0xd884('0x25')](respondWithResult(_0x247ecb,0xc9))[_0xd884('0x46')](handleError(_0x247ecb,null));};exports[_0xd884('0x24')]=function(_0x40c0eb,_0x2e5c17){if(_0x40c0eb['body']['id']){delete _0x40c0eb[_0xd884('0x47')]['id'];}return db[_0xd884('0x2b')][_0xd884('0x45')]({'where':{'id':_0x40c0eb[_0xd884('0x48')]['id']}})[_0xd884('0x25')](handleEntityNotFound(_0x2e5c17,null))[_0xd884('0x25')](saveUpdates(_0x40c0eb[_0xd884('0x47')],null))[_0xd884('0x25')](respondWithResult(_0x2e5c17,null))['catch'](handleError(_0x2e5c17,null));};exports[_0xd884('0x49')]=function(_0x34b50b,_0x4c7e7b){return db[_0xd884('0x2b')][_0xd884('0x45')]({'where':{'id':_0x34b50b[_0xd884('0x48')]['id']}})[_0xd884('0x25')](handleEntityNotFound(_0x4c7e7b,null))[_0xd884('0x25')](removeEntity(_0x4c7e7b,null))['catch'](handleError(_0x4c7e7b,null));};exports[_0xd884('0x4a')]=function(_0x1c3f9c,_0x4c322a,_0x1e04f9){var _0x1a74ac={};var _0x4ee9bf={};var _0x236bcb;var _0xbe953e;return db['FreshsalesConfiguration'][_0xd884('0x4b')]({'where':{'id':_0x1c3f9c[_0xd884('0x48')]['id']}})['then'](handleEntityNotFound(_0x4c322a,null))['then'](function(_0x143247){if(_0x143247){_0x236bcb=_0x143247;_0x4ee9bf[_0xd884('0x32')]=_[_0xd884('0x30')](db[_0xd884('0x4c')][_0xd884('0x2c')]);_0x4ee9bf[_0xd884('0x2f')]=_[_0xd884('0x30')](_0x1c3f9c[_0xd884('0x2f')]);_0x4ee9bf['filters']=_['intersection'](_0x4ee9bf['model'],_0x4ee9bf[_0xd884('0x2f')]);_0x1a74ac[_0xd884('0x33')]=_[_0xd884('0x34')](_0x4ee9bf[_0xd884('0x32')],qs['fields'](_0x1c3f9c[_0xd884('0x2f')]['fields']));_0x1a74ac[_0xd884('0x33')]=_0x1a74ac[_0xd884('0x33')][_0xd884('0x36')]?_0x1a74ac[_0xd884('0x33')]:_0x4ee9bf['model'];_0x1a74ac[_0xd884('0x39')]=qs['sort'](_0x1c3f9c[_0xd884('0x2f')][_0xd884('0x3a')]);_0x1a74ac[_0xd884('0x3b')]=qs[_0xd884('0x31')](_['pick'](_0x1c3f9c[_0xd884('0x2f')],_0x4ee9bf[_0xd884('0x31')]));if(_0x1c3f9c[_0xd884('0x2f')][_0xd884('0x3c')]){_0x1a74ac[_0xd884('0x3b')]=_[_0xd884('0x3e')](_0x1a74ac['where'],{'$or':_['map'](_0x1a74ac['attributes'],function(_0x5e87d1){var _0x1d5531={};_0x1d5531[_0x5e87d1]={'$like':'%'+_0x1c3f9c['query']['filter']+'%'};return _0x1d5531;})});}_0x1a74ac=_[_0xd884('0x3e')]({},_0x1a74ac,_0x1c3f9c[_0xd884('0x3f')]);return _0x236bcb['getSubjects'](_0x1a74ac);}})[_0xd884('0x25')](function(_0x15a34a){if(_0x15a34a){_0xbe953e=_0x15a34a['length'];if(!_0x1c3f9c[_0xd884('0x2f')]['hasOwnProperty']('nolimit')){_0x1a74ac[_0xd884('0x1e')]=qs[_0xd884('0x1e')](_0x1c3f9c[_0xd884('0x2f')][_0xd884('0x1e')]);_0x1a74ac[_0xd884('0x1c')]=qs[_0xd884('0x1c')](_0x1c3f9c[_0xd884('0x2f')][_0xd884('0x1c')]);}return _0x236bcb[_0xd884('0x4a')](_0x1a74ac);}})['then'](function(_0x1661e5){if(_0x1661e5){return _0x1661e5?{'count':_0xbe953e,'rows':_0x1661e5}:null;}})[_0xd884('0x25')](respondWithResult(_0x4c322a,null))[_0xd884('0x46')](handleError(_0x4c322a,null));};exports[_0xd884('0x4d')]=function(_0x384bc5,_0x11384f,_0x13ac7e){var _0x158afd={};var _0x1bb6a1={};var _0x5bc64e;var _0x2a0eb5;return db[_0xd884('0x2b')][_0xd884('0x4b')]({'where':{'id':_0x384bc5[_0xd884('0x48')]['id']}})['then'](handleEntityNotFound(_0x11384f,null))['then'](function(_0x4d6c53){if(_0x4d6c53){_0x5bc64e=_0x4d6c53;_0x1bb6a1[_0xd884('0x32')]=_[_0xd884('0x30')](db[_0xd884('0x4c')]['rawAttributes']);_0x1bb6a1['query']=_['keys'](_0x384bc5[_0xd884('0x2f')]);_0x1bb6a1['filters']=_['intersection'](_0x1bb6a1['model'],_0x1bb6a1[_0xd884('0x2f')]);_0x158afd[_0xd884('0x33')]=_[_0xd884('0x34')](_0x1bb6a1[_0xd884('0x32')],qs[_0xd884('0x35')](_0x384bc5[_0xd884('0x2f')]['fields']));_0x158afd[_0xd884('0x33')]=_0x158afd['attributes'][_0xd884('0x36')]?_0x158afd[_0xd884('0x33')]:_0x1bb6a1['model'];_0x158afd[_0xd884('0x39')]=qs[_0xd884('0x3a')](_0x384bc5['query']['sort']);_0x158afd[_0xd884('0x3b')]=qs[_0xd884('0x31')](_[_0xd884('0x4e')](_0x384bc5[_0xd884('0x2f')],_0x1bb6a1['filters']));if(_0x384bc5[_0xd884('0x2f')][_0xd884('0x3c')]){_0x158afd['where']=_[_0xd884('0x3e')](_0x158afd[_0xd884('0x3b')],{'$or':_['map'](_0x158afd[_0xd884('0x33')],function(_0x5a1c66){var _0x2238bc={};_0x2238bc[_0x5a1c66]={'$like':'%'+_0x384bc5['query'][_0xd884('0x3c')]+'%'};return _0x2238bc;})});}_0x158afd=_[_0xd884('0x3e')]({},_0x158afd,_0x384bc5[_0xd884('0x3f')]);return _0x5bc64e[_0xd884('0x4d')](_0x158afd);}})[_0xd884('0x25')](function(_0x3a4fe2){if(_0x3a4fe2){_0x2a0eb5=_0x3a4fe2['length'];if(!_0x384bc5[_0xd884('0x2f')][_0xd884('0x37')](_0xd884('0x38'))){_0x158afd[_0xd884('0x1e')]=qs[_0xd884('0x1e')](_0x384bc5[_0xd884('0x2f')][_0xd884('0x1e')]);_0x158afd[_0xd884('0x1c')]=qs[_0xd884('0x1c')](_0x384bc5[_0xd884('0x2f')][_0xd884('0x1c')]);}return _0x5bc64e[_0xd884('0x4d')](_0x158afd);}})[_0xd884('0x25')](function(_0x2a6462){if(_0x2a6462){return _0x2a6462?{'count':_0x2a0eb5,'rows':_0x2a6462}:null;}})['then'](respondWithResult(_0x11384f,null))[_0xd884('0x46')](handleError(_0x11384f,null));};exports[_0xd884('0x4f')]=function(_0x529b02,_0x3a2067,_0x48fd1d){var _0x2f8fde={};var _0x4eade6={};var _0x1f9f6e;var _0x27526b;return db[_0xd884('0x2b')][_0xd884('0x4b')]({'where':{'id':_0x529b02[_0xd884('0x48')]['id']}})[_0xd884('0x25')](handleEntityNotFound(_0x3a2067,null))[_0xd884('0x25')](function(_0x421be4){if(_0x421be4){_0x1f9f6e=_0x421be4;_0x4eade6['model']=_[_0xd884('0x30')](db[_0xd884('0x4c')]['rawAttributes']);_0x4eade6['query']=_[_0xd884('0x30')](_0x529b02[_0xd884('0x2f')]);_0x4eade6['filters']=_['intersection'](_0x4eade6[_0xd884('0x32')],_0x4eade6[_0xd884('0x2f')]);_0x2f8fde[_0xd884('0x33')]=_[_0xd884('0x34')](_0x4eade6['model'],qs[_0xd884('0x35')](_0x529b02[_0xd884('0x2f')][_0xd884('0x35')]));_0x2f8fde[_0xd884('0x33')]=_0x2f8fde[_0xd884('0x33')][_0xd884('0x36')]?_0x2f8fde[_0xd884('0x33')]:_0x4eade6[_0xd884('0x32')];_0x2f8fde[_0xd884('0x39')]=qs[_0xd884('0x3a')](_0x529b02[_0xd884('0x2f')][_0xd884('0x3a')]);_0x2f8fde[_0xd884('0x3b')]=qs['filters'](_[_0xd884('0x4e')](_0x529b02[_0xd884('0x2f')],_0x4eade6['filters']));if(_0x529b02[_0xd884('0x2f')]['filter']){_0x2f8fde[_0xd884('0x3b')]=_[_0xd884('0x3e')](_0x2f8fde[_0xd884('0x3b')],{'$or':_[_0xd884('0x2a')](_0x2f8fde[_0xd884('0x33')],function(_0x145ea4){var _0x2c3164={};_0x2c3164[_0x145ea4]={'$like':'%'+_0x529b02[_0xd884('0x2f')][_0xd884('0x3c')]+'%'};return _0x2c3164;})});}_0x2f8fde=_['merge']({},_0x2f8fde,_0x529b02['options']);return _0x1f9f6e[_0xd884('0x4f')](_0x2f8fde);}})['then'](function(_0x534da1){if(_0x534da1){_0x27526b=_0x534da1[_0xd884('0x36')];if(!_0x529b02['query'][_0xd884('0x37')](_0xd884('0x38'))){_0x2f8fde[_0xd884('0x1e')]=qs['limit'](_0x529b02[_0xd884('0x2f')][_0xd884('0x1e')]);_0x2f8fde[_0xd884('0x1c')]=qs[_0xd884('0x1c')](_0x529b02[_0xd884('0x2f')][_0xd884('0x1c')]);}return _0x1f9f6e[_0xd884('0x4f')](_0x2f8fde);}})[_0xd884('0x25')](function(_0x50a767){if(_0x50a767){return _0x50a767?{'count':_0x27526b,'rows':_0x50a767}:null;}})[_0xd884('0x25')](respondWithResult(_0x3a2067,null))[_0xd884('0x46')](handleError(_0x3a2067,null));}; \ No newline at end of file +var _0x251c=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','sendStatus','error','stack','name','send','index','FreshsalesConfiguration','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','destroy','getSubjects','hasOwnProperty','getDescriptions','findOne','FreshsalesField','getFields','eml-format','rimraf','zip-dir','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0x251c,0xe8));var _0xc251=function(_0x1827ae,_0x4715b4){_0x1827ae=_0x1827ae-0x0;var _0x2a504f=_0x251c[_0x1827ae];return _0x2a504f;};'use strict';var emlformat=require(_0xc251('0x0'));var rimraf=require(_0xc251('0x1'));var zipdir=require(_0xc251('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc251('0x3'));var moment=require(_0xc251('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc251('0x5'));var util=require('util');var path=require('path');var sox=require(_0xc251('0x6'));var csv=require(_0xc251('0x7'));var ejs=require(_0xc251('0x8'));var fs=require('fs');var fs_extra=require(_0xc251('0x9'));var _=require(_0xc251('0xa'));var squel=require(_0xc251('0xb'));var crypto=require(_0xc251('0xc'));var jsforce=require(_0xc251('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xc251('0x7'));var querystring=require(_0xc251('0xe'));var Papa=require(_0xc251('0xf'));var Redis=require(_0xc251('0x10'));var authService=require(_0xc251('0x11'));var qs=require(_0xc251('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc251('0x13'));var logger=require(_0xc251('0x14'))('api');var utils=require(_0xc251('0x15'));var config=require(_0xc251('0x16'));var licenseUtil=require(_0xc251('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x319bbd,_0x51ab38){_0x51ab38=_0x51ab38||0xcc;return function(_0x348806){if(_0x348806){return _0x319bbd['sendStatus'](_0x51ab38);}return _0x319bbd['status'](_0x51ab38)[_0xc251('0x18')]();};}function respondWithResult(_0x4ef3f0,_0x3325de){_0x3325de=_0x3325de||0xc8;return function(_0x2d9518){if(_0x2d9518){return _0x4ef3f0[_0xc251('0x19')](_0x3325de)[_0xc251('0x1a')](_0x2d9518);}};}function respondWithFilteredResult(_0x3cf913,_0x2f285e){return function(_0x361ec7){if(_0x361ec7){var _0x4ac045=typeof _0x2f285e[_0xc251('0x1b')]===_0xc251('0x1c')&&typeof _0x2f285e[_0xc251('0x1d')]===_0xc251('0x1c');var _0x116baa=_0x361ec7[_0xc251('0x1e')];var _0x232dc2=_0x4ac045?0x0:_0x2f285e[_0xc251('0x1b')];var _0x577b06=_0x4ac045?_0x361ec7[_0xc251('0x1e')]:_0x2f285e[_0xc251('0x1b')]+_0x2f285e[_0xc251('0x1d')];var _0x4d3d2a;if(_0x577b06>=_0x116baa){_0x577b06=_0x116baa;_0x4d3d2a=0xc8;}else{_0x4d3d2a=0xce;}_0x3cf913[_0xc251('0x19')](_0x4d3d2a);return _0x3cf913[_0xc251('0x1f')](_0xc251('0x20'),_0x232dc2+'-'+_0x577b06+'/'+_0x116baa)[_0xc251('0x1a')](_0x361ec7);}return null;};}function patchUpdates(_0x22cac9){return function(_0x242105){try{jsonpatch[_0xc251('0x21')](_0x242105,_0x22cac9,!![]);}catch(_0x13a5fe){return BPromise[_0xc251('0x22')](_0x13a5fe);}return _0x242105['save']();};}function saveUpdates(_0x1588f1,_0x4d9265){return function(_0xec5e96){if(_0xec5e96){return _0xec5e96[_0xc251('0x23')](_0x1588f1)['then'](function(_0x40175f){return _0x40175f;});}return null;};}function removeEntity(_0x5172a9,_0x42295e){return function(_0xd5cf49){if(_0xd5cf49){return _0xd5cf49['destroy']()[_0xc251('0x24')](function(){_0x5172a9[_0xc251('0x19')](0xcc)[_0xc251('0x18')]();});}};}function handleEntityNotFound(_0x256d67,_0x400095){return function(_0x562f22){if(!_0x562f22){_0x256d67[_0xc251('0x25')](0x194);}return _0x562f22;};}function handleError(_0x1cdc8f,_0x50f08a){_0x50f08a=_0x50f08a||0x1f4;return function(_0x2bccee){logger[_0xc251('0x26')](_0x2bccee[_0xc251('0x27')]);if(_0x2bccee[_0xc251('0x28')]){delete _0x2bccee[_0xc251('0x28')];}_0x1cdc8f[_0xc251('0x19')](_0x50f08a)[_0xc251('0x29')](_0x2bccee);};}exports[_0xc251('0x2a')]=function(_0x335419,_0x1bf9ab){var _0x4a7fbb={},_0x408ccb={},_0x4ec39d={'count':0x0,'rows':[]};var _0x30b09e=_['map'](db[_0xc251('0x2b')][_0xc251('0x2c')],function(_0x174642){return{'name':_0x174642['fieldName'],'type':_0x174642[_0xc251('0x2d')][_0xc251('0x2e')]};});_0x408ccb[_0xc251('0x2f')]=_[_0xc251('0x30')](_0x30b09e,'name');_0x408ccb[_0xc251('0x31')]=_[_0xc251('0x32')](_0x335419['query']);_0x408ccb[_0xc251('0x33')]=_[_0xc251('0x34')](_0x408ccb[_0xc251('0x2f')],_0x408ccb['query']);_0x4a7fbb[_0xc251('0x35')]=_['intersection'](_0x408ccb['model'],qs[_0xc251('0x36')](_0x335419['query']['fields']));_0x4a7fbb[_0xc251('0x35')]=_0x4a7fbb['attributes'][_0xc251('0x37')]?_0x4a7fbb['attributes']:_0x408ccb['model'];if(!_0x335419[_0xc251('0x31')]['hasOwnProperty'](_0xc251('0x38'))){_0x4a7fbb[_0xc251('0x1d')]=qs[_0xc251('0x1d')](_0x335419[_0xc251('0x31')][_0xc251('0x1d')]);_0x4a7fbb[_0xc251('0x1b')]=qs[_0xc251('0x1b')](_0x335419[_0xc251('0x31')]['offset']);}_0x4a7fbb[_0xc251('0x39')]=qs['sort'](_0x335419['query'][_0xc251('0x3a')]);_0x4a7fbb[_0xc251('0x3b')]=qs[_0xc251('0x33')](_[_0xc251('0x3c')](_0x335419[_0xc251('0x31')],_0x408ccb['filters']),_0x30b09e);if(_0x335419[_0xc251('0x31')][_0xc251('0x3d')]){_0x4a7fbb[_0xc251('0x3b')]=_[_0xc251('0x3e')](_0x4a7fbb[_0xc251('0x3b')],{'$or':_['map'](_0x30b09e,function(_0x1c17f9){if(_0x1c17f9[_0xc251('0x2d')]!==_0xc251('0x3f')){var _0x2098be={};_0x2098be[_0x1c17f9['name']]={'$like':'%'+_0x335419['query'][_0xc251('0x3d')]+'%'};return _0x2098be;}})});}_0x4a7fbb=_['merge']({},_0x4a7fbb,_0x335419['options']);var _0x4be039={'where':_0x4a7fbb['where']};return db[_0xc251('0x2b')][_0xc251('0x1e')](_0x4be039)['then'](function(_0x16ccf1){_0x4ec39d[_0xc251('0x1e')]=_0x16ccf1;if(_0x335419[_0xc251('0x31')][_0xc251('0x40')]){_0x4a7fbb[_0xc251('0x41')]=[{'all':!![]}];}return db[_0xc251('0x2b')][_0xc251('0x42')](_0x4a7fbb);})[_0xc251('0x24')](function(_0x3d7782){_0x4ec39d[_0xc251('0x43')]=_0x3d7782;return _0x4ec39d;})[_0xc251('0x24')](respondWithFilteredResult(_0x1bf9ab,_0x4a7fbb))[_0xc251('0x44')](handleError(_0x1bf9ab,null));};exports[_0xc251('0x45')]=function(_0x36e662,_0x300ada){var _0x522569={'raw':![],'where':{'id':_0x36e662[_0xc251('0x46')]['id']}},_0x5b885a={};_0x5b885a[_0xc251('0x2f')]=_[_0xc251('0x32')](db[_0xc251('0x2b')]['rawAttributes']);_0x5b885a[_0xc251('0x31')]=_[_0xc251('0x32')](_0x36e662[_0xc251('0x31')]);_0x5b885a['filters']=_[_0xc251('0x34')](_0x5b885a[_0xc251('0x2f')],_0x5b885a[_0xc251('0x31')]);_0x522569[_0xc251('0x35')]=_['intersection'](_0x5b885a[_0xc251('0x2f')],qs[_0xc251('0x36')](_0x36e662['query'][_0xc251('0x36')]));_0x522569['attributes']=_0x522569[_0xc251('0x35')][_0xc251('0x37')]?_0x522569[_0xc251('0x35')]:_0x5b885a['model'];if(_0x36e662[_0xc251('0x31')][_0xc251('0x40')]){_0x522569['include']=[{'all':!![]}];}_0x522569=_['merge']({},_0x522569,_0x36e662[_0xc251('0x47')]);return db['FreshsalesConfiguration'][_0xc251('0x48')](_0x522569)[_0xc251('0x24')](handleEntityNotFound(_0x300ada,null))[_0xc251('0x24')](respondWithResult(_0x300ada,null))[_0xc251('0x44')](handleError(_0x300ada,null));};exports[_0xc251('0x49')]=function(_0x522eef,_0x2a932a){return db[_0xc251('0x2b')][_0xc251('0x49')](_0x522eef[_0xc251('0x4a')],{})[_0xc251('0x24')](respondWithResult(_0x2a932a,0xc9))[_0xc251('0x44')](handleError(_0x2a932a,null));};exports[_0xc251('0x23')]=function(_0x19d8e1,_0x23e0f7){if(_0x19d8e1['body']['id']){delete _0x19d8e1[_0xc251('0x4a')]['id'];}return db[_0xc251('0x2b')][_0xc251('0x48')]({'where':{'id':_0x19d8e1[_0xc251('0x46')]['id']}})[_0xc251('0x24')](handleEntityNotFound(_0x23e0f7,null))[_0xc251('0x24')](saveUpdates(_0x19d8e1[_0xc251('0x4a')],null))[_0xc251('0x24')](respondWithResult(_0x23e0f7,null))['catch'](handleError(_0x23e0f7,null));};exports[_0xc251('0x4b')]=function(_0x1adab6,_0x4a000e){return db[_0xc251('0x2b')][_0xc251('0x48')]({'where':{'id':_0x1adab6[_0xc251('0x46')]['id']}})[_0xc251('0x24')](handleEntityNotFound(_0x4a000e,null))['then'](removeEntity(_0x4a000e,null))[_0xc251('0x44')](handleError(_0x4a000e,null));};exports['getSubjects']=function(_0x4ebd60,_0x584469,_0x4f4b22){var _0x15ceb5={};var _0x2716ac={};var _0x317a37;var _0x5e6bd6;return db[_0xc251('0x2b')]['findOne']({'where':{'id':_0x4ebd60[_0xc251('0x46')]['id']}})[_0xc251('0x24')](handleEntityNotFound(_0x584469,null))['then'](function(_0xf9ba67){if(_0xf9ba67){_0x317a37=_0xf9ba67;_0x2716ac[_0xc251('0x2f')]=_[_0xc251('0x32')](db['FreshsalesField'][_0xc251('0x2c')]);_0x2716ac[_0xc251('0x31')]=_[_0xc251('0x32')](_0x4ebd60[_0xc251('0x31')]);_0x2716ac[_0xc251('0x33')]=_[_0xc251('0x34')](_0x2716ac[_0xc251('0x2f')],_0x2716ac[_0xc251('0x31')]);_0x15ceb5[_0xc251('0x35')]=_[_0xc251('0x34')](_0x2716ac[_0xc251('0x2f')],qs[_0xc251('0x36')](_0x4ebd60[_0xc251('0x31')][_0xc251('0x36')]));_0x15ceb5[_0xc251('0x35')]=_0x15ceb5[_0xc251('0x35')][_0xc251('0x37')]?_0x15ceb5[_0xc251('0x35')]:_0x2716ac['model'];_0x15ceb5[_0xc251('0x39')]=qs['sort'](_0x4ebd60[_0xc251('0x31')][_0xc251('0x3a')]);_0x15ceb5[_0xc251('0x3b')]=qs[_0xc251('0x33')](_[_0xc251('0x3c')](_0x4ebd60[_0xc251('0x31')],_0x2716ac[_0xc251('0x33')]));if(_0x4ebd60['query'][_0xc251('0x3d')]){_0x15ceb5[_0xc251('0x3b')]=_['merge'](_0x15ceb5[_0xc251('0x3b')],{'$or':_[_0xc251('0x30')](_0x15ceb5[_0xc251('0x35')],function(_0x27a64c){var _0xd9db51={};_0xd9db51[_0x27a64c]={'$like':'%'+_0x4ebd60[_0xc251('0x31')]['filter']+'%'};return _0xd9db51;})});}_0x15ceb5=_[_0xc251('0x3e')]({},_0x15ceb5,_0x4ebd60['options']);return _0x317a37[_0xc251('0x4c')](_0x15ceb5);}})['then'](function(_0xcf0acd){if(_0xcf0acd){_0x5e6bd6=_0xcf0acd['length'];if(!_0x4ebd60[_0xc251('0x31')][_0xc251('0x4d')](_0xc251('0x38'))){_0x15ceb5[_0xc251('0x1d')]=qs['limit'](_0x4ebd60[_0xc251('0x31')][_0xc251('0x1d')]);_0x15ceb5[_0xc251('0x1b')]=qs[_0xc251('0x1b')](_0x4ebd60[_0xc251('0x31')][_0xc251('0x1b')]);}return _0x317a37[_0xc251('0x4c')](_0x15ceb5);}})[_0xc251('0x24')](function(_0x29664c){if(_0x29664c){return _0x29664c?{'count':_0x5e6bd6,'rows':_0x29664c}:null;}})[_0xc251('0x24')](respondWithResult(_0x584469,null))['catch'](handleError(_0x584469,null));};exports[_0xc251('0x4e')]=function(_0xb07805,_0x487f97,_0x18d1ee){var _0x1b538={};var _0x31ede8={};var _0x281278;var _0x1912cc;return db[_0xc251('0x2b')][_0xc251('0x4f')]({'where':{'id':_0xb07805[_0xc251('0x46')]['id']}})['then'](handleEntityNotFound(_0x487f97,null))[_0xc251('0x24')](function(_0x17a5fa){if(_0x17a5fa){_0x281278=_0x17a5fa;_0x31ede8[_0xc251('0x2f')]=_[_0xc251('0x32')](db[_0xc251('0x50')][_0xc251('0x2c')]);_0x31ede8[_0xc251('0x31')]=_['keys'](_0xb07805[_0xc251('0x31')]);_0x31ede8[_0xc251('0x33')]=_[_0xc251('0x34')](_0x31ede8[_0xc251('0x2f')],_0x31ede8[_0xc251('0x31')]);_0x1b538[_0xc251('0x35')]=_[_0xc251('0x34')](_0x31ede8[_0xc251('0x2f')],qs[_0xc251('0x36')](_0xb07805[_0xc251('0x31')][_0xc251('0x36')]));_0x1b538[_0xc251('0x35')]=_0x1b538[_0xc251('0x35')][_0xc251('0x37')]?_0x1b538[_0xc251('0x35')]:_0x31ede8[_0xc251('0x2f')];_0x1b538[_0xc251('0x39')]=qs[_0xc251('0x3a')](_0xb07805[_0xc251('0x31')][_0xc251('0x3a')]);_0x1b538[_0xc251('0x3b')]=qs[_0xc251('0x33')](_[_0xc251('0x3c')](_0xb07805[_0xc251('0x31')],_0x31ede8['filters']));if(_0xb07805['query'][_0xc251('0x3d')]){_0x1b538['where']=_[_0xc251('0x3e')](_0x1b538[_0xc251('0x3b')],{'$or':_[_0xc251('0x30')](_0x1b538[_0xc251('0x35')],function(_0x4d07c5){var _0x1da57b={};_0x1da57b[_0x4d07c5]={'$like':'%'+_0xb07805['query'][_0xc251('0x3d')]+'%'};return _0x1da57b;})});}_0x1b538=_[_0xc251('0x3e')]({},_0x1b538,_0xb07805[_0xc251('0x47')]);return _0x281278['getDescriptions'](_0x1b538);}})[_0xc251('0x24')](function(_0x1e0cc9){if(_0x1e0cc9){_0x1912cc=_0x1e0cc9[_0xc251('0x37')];if(!_0xb07805['query']['hasOwnProperty'](_0xc251('0x38'))){_0x1b538[_0xc251('0x1d')]=qs[_0xc251('0x1d')](_0xb07805[_0xc251('0x31')]['limit']);_0x1b538[_0xc251('0x1b')]=qs['offset'](_0xb07805[_0xc251('0x31')][_0xc251('0x1b')]);}return _0x281278[_0xc251('0x4e')](_0x1b538);}})[_0xc251('0x24')](function(_0x37f6ad){if(_0x37f6ad){return _0x37f6ad?{'count':_0x1912cc,'rows':_0x37f6ad}:null;}})[_0xc251('0x24')](respondWithResult(_0x487f97,null))['catch'](handleError(_0x487f97,null));};exports[_0xc251('0x51')]=function(_0x1675c2,_0x384b5a,_0x221940){var _0xec6085={};var _0x4694c5={};var _0x3ae746;var _0xac6b97;return db[_0xc251('0x2b')][_0xc251('0x4f')]({'where':{'id':_0x1675c2[_0xc251('0x46')]['id']}})[_0xc251('0x24')](handleEntityNotFound(_0x384b5a,null))[_0xc251('0x24')](function(_0x5f1018){if(_0x5f1018){_0x3ae746=_0x5f1018;_0x4694c5[_0xc251('0x2f')]=_[_0xc251('0x32')](db[_0xc251('0x50')][_0xc251('0x2c')]);_0x4694c5['query']=_[_0xc251('0x32')](_0x1675c2['query']);_0x4694c5['filters']=_['intersection'](_0x4694c5[_0xc251('0x2f')],_0x4694c5['query']);_0xec6085['attributes']=_[_0xc251('0x34')](_0x4694c5['model'],qs[_0xc251('0x36')](_0x1675c2[_0xc251('0x31')][_0xc251('0x36')]));_0xec6085['attributes']=_0xec6085[_0xc251('0x35')][_0xc251('0x37')]?_0xec6085[_0xc251('0x35')]:_0x4694c5[_0xc251('0x2f')];_0xec6085['order']=qs[_0xc251('0x3a')](_0x1675c2[_0xc251('0x31')][_0xc251('0x3a')]);_0xec6085[_0xc251('0x3b')]=qs[_0xc251('0x33')](_[_0xc251('0x3c')](_0x1675c2[_0xc251('0x31')],_0x4694c5[_0xc251('0x33')]));if(_0x1675c2['query']['filter']){_0xec6085['where']=_[_0xc251('0x3e')](_0xec6085['where'],{'$or':_[_0xc251('0x30')](_0xec6085[_0xc251('0x35')],function(_0x48b665){var _0x277160={};_0x277160[_0x48b665]={'$like':'%'+_0x1675c2[_0xc251('0x31')][_0xc251('0x3d')]+'%'};return _0x277160;})});}_0xec6085=_['merge']({},_0xec6085,_0x1675c2[_0xc251('0x47')]);return _0x3ae746['getFields'](_0xec6085);}})['then'](function(_0x5522ff){if(_0x5522ff){_0xac6b97=_0x5522ff[_0xc251('0x37')];if(!_0x1675c2[_0xc251('0x31')]['hasOwnProperty']('nolimit')){_0xec6085[_0xc251('0x1d')]=qs[_0xc251('0x1d')](_0x1675c2['query']['limit']);_0xec6085['offset']=qs['offset'](_0x1675c2[_0xc251('0x31')][_0xc251('0x1b')]);}return _0x3ae746[_0xc251('0x51')](_0xec6085);}})[_0xc251('0x24')](function(_0x25f362){if(_0x25f362){return _0x25f362?{'count':_0xac6b97,'rows':_0x25f362}:null;}})[_0xc251('0x24')](respondWithResult(_0x384b5a,null))['catch'](handleError(_0x384b5a,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 28beed3..7cd0afb 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 _0xf28a=['define','int_freshsales_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports'];(function(_0xe6e78c,_0x582369){var _0x2a09c8=function(_0x470ccc){while(--_0x470ccc){_0xe6e78c['push'](_0xe6e78c['shift']());}};_0x2a09c8(++_0x582369);}(_0xf28a,0xb8));var _0xaf28=function(_0x3d5414,_0x1332b2){_0x3d5414=_0x3d5414-0x0;var _0x517aea=_0xf28a[_0x3d5414];return _0x517aea;};'use strict';var _=require(_0xaf28('0x0'));var util=require(_0xaf28('0x1'));var logger=require(_0xaf28('0x2'))(_0xaf28('0x3'));var moment=require(_0xaf28('0x4'));var BPromise=require(_0xaf28('0x5'));var rp=require(_0xaf28('0x6'));var fs=require('fs');var path=require(_0xaf28('0x7'));var rimraf=require(_0xaf28('0x8'));var config=require(_0xaf28('0x9'));var attributes=require(_0xaf28('0xa'));module[_0xaf28('0xb')]=function(_0x236d0d,_0x55e92b){return _0x236d0d[_0xaf28('0xc')]('FreshsalesConfiguration',attributes,{'tableName':_0xaf28('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x77a9=['../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','lodash','../../config/logger','api','request-promise','path'];(function(_0x3f0607,_0x2fa043){var _0x1817d1=function(_0x47097a){while(--_0x47097a){_0x3f0607['push'](_0x3f0607['shift']());}};_0x1817d1(++_0x2fa043);}(_0x77a9,0x124));var _0x977a=function(_0xf3c3f8,_0x275cec){_0xf3c3f8=_0xf3c3f8-0x0;var _0x38c047=_0x77a9[_0xf3c3f8];return _0x38c047;};'use strict';var _=require(_0x977a('0x0'));var util=require('util');var logger=require(_0x977a('0x1'))(_0x977a('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x977a('0x3'));var fs=require('fs');var path=require(_0x977a('0x4'));var rimraf=require('rimraf');var config=require(_0x977a('0x5'));var attributes=require(_0x977a('0x6'));module[_0x977a('0x7')]=function(_0x54f2e7,_0x633008){return _0x54f2e7[_0x977a('0x8')]('FreshsalesConfiguration',attributes,{'tableName':'int_freshsales_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js index 5874e7a..4aa7d0c 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 _0x29e5=['error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x365a27,_0x3680e1){var _0xadda73=function(_0x2b14af){while(--_0x2b14af){_0x365a27['push'](_0x365a27['shift']());}};_0xadda73(++_0x3680e1);}(_0x29e5,0x1e8));var _0x529e=function(_0x1c1b1e,_0x2fa65b){_0x1c1b1e=_0x1c1b1e-0x0;var _0x71f1b0=_0x29e5[_0x1c1b1e];return _0x71f1b0;};'use strict';var _=require(_0x529e('0x0'));var util=require(_0x529e('0x1'));var moment=require('moment');var BPromise=require(_0x529e('0x2'));var rs=require(_0x529e('0x3'));var fs=require('fs');var Redis=require(_0x529e('0x4'));var db=require(_0x529e('0x5'))['db'];var utils=require(_0x529e('0x6'));var logger=require(_0x529e('0x7'))(_0x529e('0x8'));var config=require(_0x529e('0x9'));var jayson=require(_0x529e('0xa'));var client=jayson[_0x529e('0xb')][_0x529e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x39d49a,_0x2d0991,_0x33ea36){return new BPromise(function(_0xc0efea,_0x565575){return client[_0x529e('0xd')](_0x39d49a,_0x33ea36)[_0x529e('0xe')](function(_0x2f604c){logger['info'](_0x529e('0xf'),_0x2d0991,_0x529e('0x10'));logger['debug']('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x2d0991,_0x529e('0x10'),JSON[_0x529e('0x11')](_0x2f604c));if(_0x2f604c[_0x529e('0x12')]){if(_0x2f604c[_0x529e('0x12')][_0x529e('0x13')]===0x1f4){logger[_0x529e('0x12')](_0x529e('0xf'),_0x2d0991,_0x2f604c[_0x529e('0x12')][_0x529e('0x14')]);return _0x565575(_0x2f604c['error'][_0x529e('0x14')]);}logger[_0x529e('0x12')](_0x529e('0xf'),_0x2d0991,_0x2f604c[_0x529e('0x12')][_0x529e('0x14')]);return _0xc0efea(_0x2f604c['error'][_0x529e('0x14')]);}else{logger['info'](_0x529e('0xf'),_0x2d0991,_0x529e('0x10'));_0xc0efea(_0x2f604c[_0x529e('0x15')]['message']);}})[_0x529e('0x16')](function(_0x862ffb){logger[_0x529e('0x12')](_0x529e('0xf'),_0x2d0991,_0x862ffb);_0x565575(_0x862ffb);});});} \ No newline at end of file +var _0x94a7=['FreshsalesConfiguration,\x20%s,\x20%s','result','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x55ff3e,_0x41077f){var _0x2709eb=function(_0x45563a){while(--_0x45563a){_0x55ff3e['push'](_0x55ff3e['shift']());}};_0x2709eb(++_0x41077f);}(_0x94a7,0x1e6));var _0x794a=function(_0x1a9386,_0xcf7985){_0x1a9386=_0x1a9386-0x0;var _0x4707e6=_0x94a7[_0x1a9386];return _0x4707e6;};'use strict';var _=require(_0x794a('0x0'));var util=require(_0x794a('0x1'));var moment=require(_0x794a('0x2'));var BPromise=require('bluebird');var rs=require(_0x794a('0x3'));var fs=require('fs');var Redis=require(_0x794a('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x794a('0x5'))(_0x794a('0x6'));var config=require(_0x794a('0x7'));var jayson=require(_0x794a('0x8'));var client=jayson[_0x794a('0x9')][_0x794a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4580a5,_0x486f01,_0x2c7ad9){return new BPromise(function(_0x48c05b,_0x16f662){return client[_0x794a('0xb')](_0x4580a5,_0x2c7ad9)[_0x794a('0xc')](function(_0x1c423d){logger[_0x794a('0xd')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x486f01,'request\x20sent');logger['debug'](_0x794a('0xe'),_0x486f01,_0x794a('0xf'),JSON[_0x794a('0x10')](_0x1c423d));if(_0x1c423d[_0x794a('0x11')]){if(_0x1c423d[_0x794a('0x11')][_0x794a('0x12')]===0x1f4){logger[_0x794a('0x11')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x486f01,_0x1c423d[_0x794a('0x11')]['message']);return _0x16f662(_0x1c423d['error'][_0x794a('0x13')]);}logger[_0x794a('0x11')](_0x794a('0x14'),_0x486f01,_0x1c423d[_0x794a('0x11')][_0x794a('0x13')]);return _0x48c05b(_0x1c423d[_0x794a('0x11')][_0x794a('0x13')]);}else{logger[_0x794a('0xd')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x486f01,_0x794a('0xf'));_0x48c05b(_0x1c423d[_0x794a('0x15')][_0x794a('0x13')]);}})['catch'](function(_0x26673c){logger[_0x794a('0x11')](_0x794a('0x14'),_0x486f01,_0x26673c);_0x16f662(_0x26673c);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 4f95d02..c054ca7 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 _0x636f=['fs-extra','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','/:id','show','post','create','put','delete','destroy','exports','path','connect-timeout','express','Router'];(function(_0x462710,_0x3e3688){var _0x2e7a16=function(_0x51071f){while(--_0x51071f){_0x462710['push'](_0x462710['shift']());}};_0x2e7a16(++_0x3e3688);}(_0x636f,0x188));var _0xf636=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x636f[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf636('0x0'));var timeout=require(_0xf636('0x1'));var express=require(_0xf636('0x2'));var router=express[_0xf636('0x3')]();var fs_extra=require(_0xf636('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xf636('0x5'));var config=require(_0xf636('0x6'));var controller=require(_0xf636('0x7'));router[_0xf636('0x8')]('/',auth[_0xf636('0x9')](),controller['index']);router[_0xf636('0x8')](_0xf636('0xa'),auth[_0xf636('0x9')](),controller[_0xf636('0xb')]);router[_0xf636('0xc')]('/',auth[_0xf636('0x9')](),controller[_0xf636('0xd')]);router[_0xf636('0xe')](_0xf636('0xa'),auth[_0xf636('0x9')](),controller['update']);router[_0xf636('0xf')](_0xf636('0xa'),auth['isAuthenticated'](),controller[_0xf636('0x10')]);module[_0xf636('0x11')]=router; \ No newline at end of file +var _0xcee0=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshsalesField.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','exports','multer','util'];(function(_0x3f0b03,_0x34d361){var _0x32aa32=function(_0x4db05e){while(--_0x4db05e){_0x3f0b03['push'](_0x3f0b03['shift']());}};_0x32aa32(++_0x34d361);}(_0xcee0,0x1e1));var _0x0cee=function(_0x4bacb6,_0x2b299d){_0x4bacb6=_0x4bacb6-0x0;var _0x58c029=_0xcee0[_0x4bacb6];return _0x58c029;};'use strict';var multer=require(_0x0cee('0x0'));var util=require(_0x0cee('0x1'));var path=require(_0x0cee('0x2'));var timeout=require(_0x0cee('0x3'));var express=require(_0x0cee('0x4'));var router=express[_0x0cee('0x5')]();var fs_extra=require(_0x0cee('0x6'));var auth=require(_0x0cee('0x7'));var interaction=require(_0x0cee('0x8'));var config=require('../../config/environment');var controller=require(_0x0cee('0x9'));router[_0x0cee('0xa')]('/',auth[_0x0cee('0xb')](),controller[_0x0cee('0xc')]);router[_0x0cee('0xa')]('/:id',auth[_0x0cee('0xb')](),controller[_0x0cee('0xd')]);router[_0x0cee('0xe')]('/',auth[_0x0cee('0xb')](),controller[_0x0cee('0xf')]);router[_0x0cee('0x10')](_0x0cee('0x11'),auth[_0x0cee('0xb')](),controller[_0x0cee('0x12')]);router[_0x0cee('0x13')](_0x0cee('0x11'),auth[_0x0cee('0xb')](),controller['destroy']);module[_0x0cee('0x14')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 790c087..bca35e0 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 _0x2aaa=['variable','customVariable','keyValue','picklist','string','STRING','ENUM','BOOLEAN','sequelize','exports'];(function(_0x4fc4e7,_0x16bfc4){var _0x297133=function(_0x5d1eb6){while(--_0x5d1eb6){_0x4fc4e7['push'](_0x4fc4e7['shift']());}};_0x297133(++_0x16bfc4);}(_0x2aaa,0x18e));var _0xa2aa=function(_0x190e4f,_0x3d07b4){_0x190e4f=_0x190e4f-0x0;var _0x4c937a=_0x2aaa[_0x190e4f];return _0x4c937a;};'use strict';var Sequelize=require(_0xa2aa('0x0'));module[_0xa2aa('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0xa2aa('0x2'),_0xa2aa('0x3'),_0xa2aa('0x4'),_0xa2aa('0x5')),'defaultValue':_0xa2aa('0x6')},'content':{'type':Sequelize[_0xa2aa('0x7')]},'key':{'type':Sequelize[_0xa2aa('0x7')]},'keyType':{'type':Sequelize[_0xa2aa('0x8')]('string',_0xa2aa('0x2'),_0xa2aa('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xa2aa('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xa2aa('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa2aa('0x7')]}}; \ No newline at end of file +var _0xe7ac=['sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN'];(function(_0xe57a8e,_0x51ff2d){var _0x343949=function(_0xb1c770){while(--_0xb1c770){_0xe57a8e['push'](_0xe57a8e['shift']());}};_0x343949(++_0x51ff2d);}(_0xe7ac,0xe6));var _0xce7a=function(_0x1f45e3,_0x121eed){_0x1f45e3=_0x1f45e3-0x0;var _0x503b36=_0xe7ac[_0x1f45e3];return _0x503b36;};'use strict';var Sequelize=require(_0xce7a('0x0'));module[_0xce7a('0x1')]={'type':{'type':Sequelize[_0xce7a('0x2')](_0xce7a('0x3'),_0xce7a('0x4'),_0xce7a('0x5'),_0xce7a('0x6'),_0xce7a('0x7')),'defaultValue':_0xce7a('0x3')},'content':{'type':Sequelize[_0xce7a('0x8')]},'key':{'type':Sequelize[_0xce7a('0x8')]},'keyType':{'type':Sequelize[_0xce7a('0x2')](_0xce7a('0x3'),'variable',_0xce7a('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xce7a('0x8')]},'nameField':{'type':Sequelize[_0xce7a('0x8')]},'customField':{'type':Sequelize[_0xce7a('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xce7a('0x8')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 256b569..14ae1b5 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 _0x54e9=['../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','undefined','limit','count','offset','set','json','apply','reject','save','update','then','error','name','send','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','where','merge','map','options','FreshsalesField','findAll','show','params','keys','length','includeAll','include','catch','create','body','find','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x5471ec,_0x1ce81a){var _0x121d4c=function(_0xefb655){while(--_0xefb655){_0x5471ec['push'](_0x5471ec['shift']());}};_0x121d4c(++_0x1ce81a);}(_0x54e9,0x19b));var _0x954e=function(_0x5d57f5,_0x32637a){_0x5d57f5=_0x5d57f5-0x0;var _0x8dd8d=_0x54e9[_0x5d57f5];return _0x8dd8d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x954e('0x0'));var zipdir=require(_0x954e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x954e('0x2'));var moment=require(_0x954e('0x3'));var BPromise=require(_0x954e('0x4'));var Mustache=require(_0x954e('0x5'));var util=require(_0x954e('0x6'));var path=require('path');var sox=require(_0x954e('0x7'));var csv=require(_0x954e('0x8'));var ejs=require(_0x954e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x954e('0xa'));var deskjs=require(_0x954e('0xb'));var toCsv=require('to-csv');var querystring=require(_0x954e('0xc'));var Papa=require(_0x954e('0xd'));var Redis=require(_0x954e('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x954e('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x954e('0x10'));var logger=require(_0x954e('0x11'))(_0x954e('0x12'));var utils=require(_0x954e('0x13'));var config=require(_0x954e('0x14'));var licenseUtil=require(_0x954e('0x15'));var db=require(_0x954e('0x16'))['db'];function respondWithStatusCode(_0x5a08a1,_0x3aaaf5){_0x3aaaf5=_0x3aaaf5||0xcc;return function(_0x1f5296){if(_0x1f5296){return _0x5a08a1[_0x954e('0x17')](_0x3aaaf5);}return _0x5a08a1['status'](_0x3aaaf5)[_0x954e('0x18')]();};}function respondWithResult(_0x43912f,_0x415e8d){_0x415e8d=_0x415e8d||0xc8;return function(_0x193ef8){if(_0x193ef8){return _0x43912f[_0x954e('0x19')](_0x415e8d)['json'](_0x193ef8);}};}function respondWithFilteredResult(_0x189110,_0x29a8f3){return function(_0x1868e0){if(_0x1868e0){var _0x3535bb=typeof _0x29a8f3['offset']===_0x954e('0x1a')&&typeof _0x29a8f3[_0x954e('0x1b')]===_0x954e('0x1a');var _0x5b7141=_0x1868e0[_0x954e('0x1c')];var _0x350dd8=_0x3535bb?0x0:_0x29a8f3[_0x954e('0x1d')];var _0x1636fb=_0x3535bb?_0x1868e0[_0x954e('0x1c')]:_0x29a8f3['offset']+_0x29a8f3['limit'];var _0x1f5b34;if(_0x1636fb>=_0x5b7141){_0x1636fb=_0x5b7141;_0x1f5b34=0xc8;}else{_0x1f5b34=0xce;}_0x189110[_0x954e('0x19')](_0x1f5b34);return _0x189110[_0x954e('0x1e')]('Content-Range',_0x350dd8+'-'+_0x1636fb+'/'+_0x5b7141)[_0x954e('0x1f')](_0x1868e0);}return null;};}function patchUpdates(_0x536ae2){return function(_0x5661f5){try{jsonpatch[_0x954e('0x20')](_0x5661f5,_0x536ae2,!![]);}catch(_0x19d676){return BPromise[_0x954e('0x21')](_0x19d676);}return _0x5661f5[_0x954e('0x22')]();};}function saveUpdates(_0x384252,_0xf99ada){return function(_0x386255){if(_0x386255){return _0x386255[_0x954e('0x23')](_0x384252)[_0x954e('0x24')](function(_0x225d0d){return _0x225d0d;});}return null;};}function removeEntity(_0xa550d9,_0x550336){return function(_0x54898f){if(_0x54898f){return _0x54898f['destroy']()['then'](function(){_0xa550d9[_0x954e('0x19')](0xcc)[_0x954e('0x18')]();});}};}function handleEntityNotFound(_0x1b7870,_0x259c53){return function(_0x3be842){if(!_0x3be842){_0x1b7870[_0x954e('0x17')](0x194);}return _0x3be842;};}function handleError(_0x1ceb4f,_0x4610c1){_0x4610c1=_0x4610c1||0x1f4;return function(_0x5d0121){logger[_0x954e('0x25')](_0x5d0121['stack']);if(_0x5d0121[_0x954e('0x26')]){delete _0x5d0121[_0x954e('0x26')];}_0x1ceb4f['status'](_0x4610c1)[_0x954e('0x27')](_0x5d0121);};}exports['index']=function(_0x269aa6,_0x57b507){var _0x515a12={},_0x422d0e={},_0x129fc6={'count':0x0,'rows':[]};var _0x42d964=_['map'](db['FreshsalesField'][_0x954e('0x28')],function(_0x1cf8f){return{'name':_0x1cf8f[_0x954e('0x29')],'type':_0x1cf8f[_0x954e('0x2a')][_0x954e('0x2b')]};});_0x422d0e[_0x954e('0x2c')]=_['map'](_0x42d964,_0x954e('0x26'));_0x422d0e[_0x954e('0x2d')]=_['keys'](_0x269aa6[_0x954e('0x2d')]);_0x422d0e[_0x954e('0x2e')]=_[_0x954e('0x2f')](_0x422d0e[_0x954e('0x2c')],_0x422d0e[_0x954e('0x2d')]);_0x515a12[_0x954e('0x30')]=_[_0x954e('0x2f')](_0x422d0e[_0x954e('0x2c')],qs[_0x954e('0x31')](_0x269aa6[_0x954e('0x2d')]['fields']));_0x515a12[_0x954e('0x30')]=_0x515a12[_0x954e('0x30')]['length']?_0x515a12[_0x954e('0x30')]:_0x422d0e[_0x954e('0x2c')];if(!_0x269aa6[_0x954e('0x2d')][_0x954e('0x32')](_0x954e('0x33'))){_0x515a12['limit']=qs[_0x954e('0x1b')](_0x269aa6[_0x954e('0x2d')][_0x954e('0x1b')]);_0x515a12[_0x954e('0x1d')]=qs[_0x954e('0x1d')](_0x269aa6[_0x954e('0x2d')][_0x954e('0x1d')]);}_0x515a12[_0x954e('0x34')]=qs[_0x954e('0x35')](_0x269aa6['query'][_0x954e('0x35')]);_0x515a12['where']=qs[_0x954e('0x2e')](_['pick'](_0x269aa6['query'],_0x422d0e['filters']),_0x42d964);if(_0x269aa6[_0x954e('0x2d')][_0x954e('0x36')]){_0x515a12[_0x954e('0x37')]=_[_0x954e('0x38')](_0x515a12[_0x954e('0x37')],{'$or':_[_0x954e('0x39')](_0x42d964,function(_0x54c9eb){if(_0x54c9eb[_0x954e('0x2a')]!=='VIRTUAL'){var _0x1a8fe1={};_0x1a8fe1[_0x54c9eb[_0x954e('0x26')]]={'$like':'%'+_0x269aa6[_0x954e('0x2d')][_0x954e('0x36')]+'%'};return _0x1a8fe1;}})});}_0x515a12=_[_0x954e('0x38')]({},_0x515a12,_0x269aa6[_0x954e('0x3a')]);var _0x29bdac={'where':_0x515a12['where']};return db['FreshsalesField'][_0x954e('0x1c')](_0x29bdac)[_0x954e('0x24')](function(_0x5dd0e4){_0x129fc6[_0x954e('0x1c')]=_0x5dd0e4;if(_0x269aa6[_0x954e('0x2d')]['includeAll']){_0x515a12['include']=[{'all':!![]}];}return db[_0x954e('0x3b')][_0x954e('0x3c')](_0x515a12);})['then'](function(_0x26ae3a){_0x129fc6['rows']=_0x26ae3a;return _0x129fc6;})[_0x954e('0x24')](respondWithFilteredResult(_0x57b507,_0x515a12))['catch'](handleError(_0x57b507,null));};exports[_0x954e('0x3d')]=function(_0x5ee563,_0x573218){var _0x4ed95f={'raw':!![],'where':{'id':_0x5ee563[_0x954e('0x3e')]['id']}},_0x4687f3={};_0x4687f3[_0x954e('0x2c')]=_[_0x954e('0x3f')](db[_0x954e('0x3b')][_0x954e('0x28')]);_0x4687f3[_0x954e('0x2d')]=_['keys'](_0x5ee563[_0x954e('0x2d')]);_0x4687f3['filters']=_[_0x954e('0x2f')](_0x4687f3[_0x954e('0x2c')],_0x4687f3[_0x954e('0x2d')]);_0x4ed95f[_0x954e('0x30')]=_[_0x954e('0x2f')](_0x4687f3[_0x954e('0x2c')],qs[_0x954e('0x31')](_0x5ee563['query'][_0x954e('0x31')]));_0x4ed95f[_0x954e('0x30')]=_0x4ed95f[_0x954e('0x30')][_0x954e('0x40')]?_0x4ed95f[_0x954e('0x30')]:_0x4687f3[_0x954e('0x2c')];if(_0x5ee563[_0x954e('0x2d')][_0x954e('0x41')]){_0x4ed95f[_0x954e('0x42')]=[{'all':!![]}];}_0x4ed95f=_[_0x954e('0x38')]({},_0x4ed95f,_0x5ee563[_0x954e('0x3a')]);return db['FreshsalesField']['find'](_0x4ed95f)[_0x954e('0x24')](handleEntityNotFound(_0x573218,null))[_0x954e('0x24')](respondWithResult(_0x573218,null))[_0x954e('0x43')](handleError(_0x573218,null));};exports['create']=function(_0x567d5b,_0x2fe4e9){return db[_0x954e('0x3b')][_0x954e('0x44')](_0x567d5b[_0x954e('0x45')],{})['then'](respondWithResult(_0x2fe4e9,0xc9))['catch'](handleError(_0x2fe4e9,null));};exports[_0x954e('0x23')]=function(_0x259ff3,_0x7c3bc8){if(_0x259ff3[_0x954e('0x45')]['id']){delete _0x259ff3[_0x954e('0x45')]['id'];}return db[_0x954e('0x3b')][_0x954e('0x46')]({'where':{'id':_0x259ff3[_0x954e('0x3e')]['id']}})[_0x954e('0x24')](handleEntityNotFound(_0x7c3bc8,null))[_0x954e('0x24')](saveUpdates(_0x259ff3[_0x954e('0x45')],null))['then'](respondWithResult(_0x7c3bc8,null))['catch'](handleError(_0x7c3bc8,null));};exports['destroy']=function(_0x2e25de,_0x564398){return db[_0x954e('0x3b')][_0x954e('0x46')]({'where':{'id':_0x2e25de['params']['id']}})[_0x954e('0x24')](handleEntityNotFound(_0x564398,null))[_0x954e('0x24')](removeEntity(_0x564398,null))[_0x954e('0x43')](handleError(_0x564398,null));}; \ No newline at end of file +var _0x85e5=['fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','keys','intersection','find','create','body','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','error','stack','name','index','map','FreshsalesField','rawAttributes','fieldName','type','model','filters','query','attributes'];(function(_0x78699f,_0x9b5e13){var _0x26bfc7=function(_0x2fbc27){while(--_0x2fbc27){_0x78699f['push'](_0x78699f['shift']());}};_0x26bfc7(++_0x9b5e13);}(_0x85e5,0xac));var _0x585e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x85e5[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x585e('0x0'));var zipdir=require(_0x585e('0x1'));var jsonpatch=require(_0x585e('0x2'));var rp=require(_0x585e('0x3'));var moment=require(_0x585e('0x4'));var BPromise=require(_0x585e('0x5'));var Mustache=require(_0x585e('0x6'));var util=require(_0x585e('0x7'));var path=require(_0x585e('0x8'));var sox=require(_0x585e('0x9'));var csv=require(_0x585e('0xa'));var ejs=require(_0x585e('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x585e('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x585e('0xd'));var toCsv=require(_0x585e('0xa'));var querystring=require(_0x585e('0xe'));var Papa=require(_0x585e('0xf'));var Redis=require(_0x585e('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x585e('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x585e('0x12'))(_0x585e('0x13'));var utils=require('../../config/utils');var config=require(_0x585e('0x14'));var licenseUtil=require(_0x585e('0x15'));var db=require(_0x585e('0x16'))['db'];function respondWithStatusCode(_0x3f4d90,_0x220a4d){_0x220a4d=_0x220a4d||0xcc;return function(_0x425df3){if(_0x425df3){return _0x3f4d90[_0x585e('0x17')](_0x220a4d);}return _0x3f4d90['status'](_0x220a4d)['end']();};}function respondWithResult(_0x2b1fa1,_0x561510){_0x561510=_0x561510||0xc8;return function(_0x1d75a7){if(_0x1d75a7){return _0x2b1fa1[_0x585e('0x18')](_0x561510)[_0x585e('0x19')](_0x1d75a7);}};}function respondWithFilteredResult(_0x554194,_0x577ed1){return function(_0x2854ec){if(_0x2854ec){var _0x53448a=typeof _0x577ed1[_0x585e('0x1a')]===_0x585e('0x1b')&&typeof _0x577ed1[_0x585e('0x1c')]===_0x585e('0x1b');var _0x85f7df=_0x2854ec[_0x585e('0x1d')];var _0x517396=_0x53448a?0x0:_0x577ed1['offset'];var _0x241b57=_0x53448a?_0x2854ec['count']:_0x577ed1['offset']+_0x577ed1['limit'];var _0x38b84a;if(_0x241b57>=_0x85f7df){_0x241b57=_0x85f7df;_0x38b84a=0xc8;}else{_0x38b84a=0xce;}_0x554194[_0x585e('0x18')](_0x38b84a);return _0x554194[_0x585e('0x1e')]('Content-Range',_0x517396+'-'+_0x241b57+'/'+_0x85f7df)['json'](_0x2854ec);}return null;};}function patchUpdates(_0x352070){return function(_0x2545fa){try{jsonpatch[_0x585e('0x1f')](_0x2545fa,_0x352070,!![]);}catch(_0x6d5787){return BPromise[_0x585e('0x20')](_0x6d5787);}return _0x2545fa[_0x585e('0x21')]();};}function saveUpdates(_0x39313a,_0x33f191){return function(_0x5ed529){if(_0x5ed529){return _0x5ed529[_0x585e('0x22')](_0x39313a)['then'](function(_0xd62a2f){return _0xd62a2f;});}return null;};}function removeEntity(_0x8cb91c,_0x42cb5e){return function(_0x184cc0){if(_0x184cc0){return _0x184cc0[_0x585e('0x23')]()[_0x585e('0x24')](function(){_0x8cb91c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x34cc0f,_0x1fc7b1){return function(_0x2cf238){if(!_0x2cf238){_0x34cc0f['sendStatus'](0x194);}return _0x2cf238;};}function handleError(_0x1f04eb,_0x1ef1f2){_0x1ef1f2=_0x1ef1f2||0x1f4;return function(_0x48541f){logger[_0x585e('0x25')](_0x48541f[_0x585e('0x26')]);if(_0x48541f[_0x585e('0x27')]){delete _0x48541f['name'];}_0x1f04eb[_0x585e('0x18')](_0x1ef1f2)['send'](_0x48541f);};}exports[_0x585e('0x28')]=function(_0x35ac11,_0x4d9f12){var _0x3b9a01={},_0x4a7951={},_0x1d3f1e={'count':0x0,'rows':[]};var _0x2a8627=_[_0x585e('0x29')](db[_0x585e('0x2a')][_0x585e('0x2b')],function(_0x449da8){return{'name':_0x449da8[_0x585e('0x2c')],'type':_0x449da8[_0x585e('0x2d')]['key']};});_0x4a7951[_0x585e('0x2e')]=_['map'](_0x2a8627,_0x585e('0x27'));_0x4a7951['query']=_['keys'](_0x35ac11['query']);_0x4a7951[_0x585e('0x2f')]=_['intersection'](_0x4a7951['model'],_0x4a7951[_0x585e('0x30')]);_0x3b9a01[_0x585e('0x31')]=_['intersection'](_0x4a7951[_0x585e('0x2e')],qs[_0x585e('0x32')](_0x35ac11['query'][_0x585e('0x32')]));_0x3b9a01[_0x585e('0x31')]=_0x3b9a01[_0x585e('0x31')][_0x585e('0x33')]?_0x3b9a01[_0x585e('0x31')]:_0x4a7951[_0x585e('0x2e')];if(!_0x35ac11[_0x585e('0x30')][_0x585e('0x34')](_0x585e('0x35'))){_0x3b9a01[_0x585e('0x1c')]=qs['limit'](_0x35ac11[_0x585e('0x30')][_0x585e('0x1c')]);_0x3b9a01[_0x585e('0x1a')]=qs['offset'](_0x35ac11[_0x585e('0x30')][_0x585e('0x1a')]);}_0x3b9a01[_0x585e('0x36')]=qs[_0x585e('0x37')](_0x35ac11[_0x585e('0x30')]['sort']);_0x3b9a01[_0x585e('0x38')]=qs['filters'](_[_0x585e('0x39')](_0x35ac11[_0x585e('0x30')],_0x4a7951[_0x585e('0x2f')]),_0x2a8627);if(_0x35ac11[_0x585e('0x30')][_0x585e('0x3a')]){_0x3b9a01[_0x585e('0x38')]=_[_0x585e('0x3b')](_0x3b9a01[_0x585e('0x38')],{'$or':_['map'](_0x2a8627,function(_0x4025ea){if(_0x4025ea['type']!==_0x585e('0x3c')){var _0x21f93e={};_0x21f93e[_0x4025ea[_0x585e('0x27')]]={'$like':'%'+_0x35ac11['query'][_0x585e('0x3a')]+'%'};return _0x21f93e;}})});}_0x3b9a01=_['merge']({},_0x3b9a01,_0x35ac11[_0x585e('0x3d')]);var _0xfe9dce={'where':_0x3b9a01[_0x585e('0x38')]};return db[_0x585e('0x2a')]['count'](_0xfe9dce)[_0x585e('0x24')](function(_0x47c241){_0x1d3f1e[_0x585e('0x1d')]=_0x47c241;if(_0x35ac11[_0x585e('0x30')][_0x585e('0x3e')]){_0x3b9a01[_0x585e('0x3f')]=[{'all':!![]}];}return db[_0x585e('0x2a')][_0x585e('0x40')](_0x3b9a01);})[_0x585e('0x24')](function(_0x250e2e){_0x1d3f1e[_0x585e('0x41')]=_0x250e2e;return _0x1d3f1e;})[_0x585e('0x24')](respondWithFilteredResult(_0x4d9f12,_0x3b9a01))[_0x585e('0x42')](handleError(_0x4d9f12,null));};exports[_0x585e('0x43')]=function(_0x2f5265,_0x3b2c31){var _0x264900={'raw':!![],'where':{'id':_0x2f5265['params']['id']}},_0x1a511c={};_0x1a511c[_0x585e('0x2e')]=_[_0x585e('0x44')](db[_0x585e('0x2a')]['rawAttributes']);_0x1a511c[_0x585e('0x30')]=_[_0x585e('0x44')](_0x2f5265['query']);_0x1a511c['filters']=_[_0x585e('0x45')](_0x1a511c[_0x585e('0x2e')],_0x1a511c[_0x585e('0x30')]);_0x264900[_0x585e('0x31')]=_[_0x585e('0x45')](_0x1a511c[_0x585e('0x2e')],qs[_0x585e('0x32')](_0x2f5265[_0x585e('0x30')]['fields']));_0x264900['attributes']=_0x264900['attributes'][_0x585e('0x33')]?_0x264900[_0x585e('0x31')]:_0x1a511c['model'];if(_0x2f5265[_0x585e('0x30')]['includeAll']){_0x264900[_0x585e('0x3f')]=[{'all':!![]}];}_0x264900=_['merge']({},_0x264900,_0x2f5265['options']);return db['FreshsalesField'][_0x585e('0x46')](_0x264900)['then'](handleEntityNotFound(_0x3b2c31,null))[_0x585e('0x24')](respondWithResult(_0x3b2c31,null))[_0x585e('0x42')](handleError(_0x3b2c31,null));};exports[_0x585e('0x47')]=function(_0xe1be9b,_0x56d9d6){return db[_0x585e('0x2a')]['create'](_0xe1be9b[_0x585e('0x48')],{})[_0x585e('0x24')](respondWithResult(_0x56d9d6,0xc9))[_0x585e('0x42')](handleError(_0x56d9d6,null));};exports[_0x585e('0x22')]=function(_0x4b1c1b,_0x30490a){if(_0x4b1c1b[_0x585e('0x48')]['id']){delete _0x4b1c1b['body']['id'];}return db['FreshsalesField'][_0x585e('0x46')]({'where':{'id':_0x4b1c1b[_0x585e('0x49')]['id']}})[_0x585e('0x24')](handleEntityNotFound(_0x30490a,null))[_0x585e('0x24')](saveUpdates(_0x4b1c1b['body'],null))['then'](respondWithResult(_0x30490a,null))[_0x585e('0x42')](handleError(_0x30490a,null));};exports[_0x585e('0x23')]=function(_0x14e0fc,_0x32b2eb){return db[_0x585e('0x2a')][_0x585e('0x46')]({'where':{'id':_0x14e0fc['params']['id']}})['then'](handleEntityNotFound(_0x32b2eb,null))[_0x585e('0x24')](removeEntity(_0x32b2eb,null))[_0x585e('0x42')](handleError(_0x32b2eb,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index e73d07f..ba10efa 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 _0x757a=['FieldId','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./intFreshsalesField.attributes','exports','define','int_freshsales_fields','freshsales_unique_index','idField'];(function(_0x245bd0,_0x478377){var _0x31fd41=function(_0x2654ce){while(--_0x2654ce){_0x245bd0['push'](_0x245bd0['shift']());}};_0x31fd41(++_0x478377);}(_0x757a,0xde));var _0xa757=function(_0x3e02b7,_0x21fea3){_0x3e02b7=_0x3e02b7-0x0;var _0x2832fa=_0x757a[_0x3e02b7];return _0x2832fa;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));module[_0xa757('0x7')]=function(_0x5edca8,_0xae0e7c){return _0x5edca8[_0xa757('0x8')]('FreshsalesField',attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[{'name':_0xa757('0xa'),'fields':[_0xa757('0xb'),_0xa757('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1280=['FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intFreshsalesField.attributes','exports'];(function(_0x21e0a9,_0x5edd42){var _0x2a12f5=function(_0x3c53a4){while(--_0x3c53a4){_0x21e0a9['push'](_0x21e0a9['shift']());}};_0x2a12f5(++_0x5edd42);}(_0x1280,0xac));var _0x0128=function(_0x1305e3,_0x43a724){_0x1305e3=_0x1305e3-0x0;var _0x1068e9=_0x1280[_0x1305e3];return _0x1068e9;};'use strict';var _=require(_0x0128('0x0'));var util=require('util');var logger=require(_0x0128('0x1'))(_0x0128('0x2'));var moment=require(_0x0128('0x3'));var BPromise=require(_0x0128('0x4'));var rp=require(_0x0128('0x5'));var fs=require('fs');var path=require(_0x0128('0x6'));var rimraf=require('rimraf');var config=require(_0x0128('0x7'));var attributes=require(_0x0128('0x8'));module[_0x0128('0x9')]=function(_0x2631a2,_0x4aa391){return _0x2631a2['define'](_0x0128('0xa'),attributes,{'tableName':_0x0128('0xb'),'paranoid':![],'indexes':[{'name':_0x0128('0xc'),'fields':[_0x0128('0xd'),'FieldId'],'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 90e1ccd..07b58dd 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 _0x2eb2=['request','then','info','request\x20sent','error','FreshsalesField,\x20%s,\x20%s','message','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http'];(function(_0x12cb65,_0x4e783e){var _0x366529=function(_0x5251ce){while(--_0x5251ce){_0x12cb65['push'](_0x12cb65['shift']());}};_0x366529(++_0x4e783e);}(_0x2eb2,0x19f));var _0x22eb=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0x2eb2[_0x47b58b];return _0x46bebe;};'use strict';var _=require('lodash');var util=require(_0x22eb('0x0'));var moment=require(_0x22eb('0x1'));var BPromise=require(_0x22eb('0x2'));var rs=require(_0x22eb('0x3'));var fs=require('fs');var Redis=require(_0x22eb('0x4'));var db=require(_0x22eb('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x22eb('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x22eb('0x7'));var client=jayson[_0x22eb('0x8')][_0x22eb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2a9850,_0x4539d0,_0x396806){return new BPromise(function(_0x33ddef,_0x3375d6){return client[_0x22eb('0xa')](_0x2a9850,_0x396806)[_0x22eb('0xb')](function(_0xb9c8a4){logger[_0x22eb('0xc')]('FreshsalesField,\x20%s,\x20%s',_0x4539d0,_0x22eb('0xd'));logger['debug']('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x4539d0,_0x22eb('0xd'),JSON['stringify'](_0xb9c8a4));if(_0xb9c8a4[_0x22eb('0xe')]){if(_0xb9c8a4[_0x22eb('0xe')]['code']===0x1f4){logger['error'](_0x22eb('0xf'),_0x4539d0,_0xb9c8a4[_0x22eb('0xe')][_0x22eb('0x10')]);return _0x3375d6(_0xb9c8a4[_0x22eb('0xe')][_0x22eb('0x10')]);}logger['error'](_0x22eb('0xf'),_0x4539d0,_0xb9c8a4['error'][_0x22eb('0x10')]);return _0x33ddef(_0xb9c8a4['error'][_0x22eb('0x10')]);}else{logger[_0x22eb('0xc')]('FreshsalesField,\x20%s,\x20%s',_0x4539d0,'request\x20sent');_0x33ddef(_0xb9c8a4['result'][_0x22eb('0x10')]);}})['catch'](function(_0x50176d){logger[_0x22eb('0xe')]('FreshsalesField,\x20%s,\x20%s',_0x4539d0,_0x50176d);_0x3375d6(_0x50176d);});});} \ No newline at end of file +var _0x5fab=['../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FreshsalesField,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x3db5a3,_0x55994c){var _0x1afffe=function(_0x4b491c){while(--_0x4b491c){_0x3db5a3['push'](_0x3db5a3['shift']());}};_0x1afffe(++_0x55994c);}(_0x5fab,0x177));var _0xb5fa=function(_0x4109e7,_0x2c8158){_0x4109e7=_0x4109e7-0x0;var _0x28d807=_0x5fab[_0x4109e7];return _0x28d807;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var moment=require('moment');var BPromise=require(_0xb5fa('0x2'));var rs=require(_0xb5fa('0x3'));var fs=require('fs');var Redis=require(_0xb5fa('0x4'));var db=require(_0xb5fa('0x5'))['db'];var utils=require(_0xb5fa('0x6'));var logger=require(_0xb5fa('0x7'))(_0xb5fa('0x8'));var config=require(_0xb5fa('0x9'));var jayson=require(_0xb5fa('0xa'));var client=jayson[_0xb5fa('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d70f6,_0x2e3804,_0x1aec3e){return new BPromise(function(_0x9c7bce,_0x56d018){return client[_0xb5fa('0xc')](_0x5d70f6,_0x1aec3e)[_0xb5fa('0xd')](function(_0x2cf4a5){logger['info']('FreshsalesField,\x20%s,\x20%s',_0x2e3804,_0xb5fa('0xe'));logger[_0xb5fa('0xf')](_0xb5fa('0x10'),_0x2e3804,_0xb5fa('0xe'),JSON[_0xb5fa('0x11')](_0x2cf4a5));if(_0x2cf4a5[_0xb5fa('0x12')]){if(_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x13')]===0x1f4){logger[_0xb5fa('0x12')]('FreshsalesField,\x20%s,\x20%s',_0x2e3804,_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);return _0x56d018(_0x2cf4a5['error'][_0xb5fa('0x14')]);}logger['error'](_0xb5fa('0x15'),_0x2e3804,_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);return _0x9c7bce(_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);}else{logger['info']('FreshsalesField,\x20%s,\x20%s',_0x2e3804,_0xb5fa('0xe'));_0x9c7bce(_0x2cf4a5[_0xb5fa('0x16')][_0xb5fa('0x14')]);}})[_0xb5fa('0x17')](function(_0x56fe10){logger['error'](_0xb5fa('0x15'),_0x2e3804,_0x56fe10);_0x56d018(_0x56fe10);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index abb35dd..e7ac066 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(_0x1e13f3,_0x21cf2d){var _0x1618fb=function(_0xa7f04d){while(--_0xa7f04d){_0x1e13f3['push'](_0x1e13f3['shift']());}};_0x1618fb(++_0x21cf2d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa9e0[_0x5c351c];return _0x26f3b3;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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(_0x1f7db6,_0x96a954){var _0x482bc8=function(_0x40491d){while(--_0x40491d){_0x1f7db6['push'](_0x1f7db6['shift']());}};_0x482bc8(++_0x96a954);}(_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 3b8f2ce..7e20e4f 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 _0x0d78=['ENUM','integrationTab','newTab','STRING','username'];(function(_0x58e469,_0x95ee3e){var _0x4c01c5=function(_0x1ef7ae){while(--_0x1ef7ae){_0x58e469['push'](_0x58e469['shift']());}};_0x4c01c5(++_0x95ee3e);}(_0x0d78,0x134));var _0x80d7=function(_0x55754e,_0x286388){_0x55754e=_0x55754e-0x0;var _0x2e9948=_0x0d78[_0x55754e];return _0x2e9948;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x80d7('0x0')]},'username':{'type':Sequelize['STRING'],'unique':_0x80d7('0x1')},'remoteUri':{'type':Sequelize[_0x80d7('0x0')]},'password':{'type':Sequelize[_0x80d7('0x0')]},'clientId':{'type':Sequelize[_0x80d7('0x0')]},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0x80d7('0x0')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x80d7('0x2')](_0x80d7('0x3'),_0x80d7('0x4')),'defaultValue':_0x80d7('0x3')}}; \ No newline at end of file +var _0xb94c=['newTab','integrationTab','sequelize','exports','STRING','ENUM'];(function(_0x539029,_0x85fd4d){var _0x4c798d=function(_0x16f9a4){while(--_0x16f9a4){_0x539029['push'](_0x539029['shift']());}};_0x4c798d(++_0x85fd4d);}(_0xb94c,0x176));var _0xcb94=function(_0x1e35fd,_0x2205bd){_0x1e35fd=_0x1e35fd-0x0;var _0xdf57bd=_0xb94c[_0x1e35fd];return _0xdf57bd;};'use strict';var Sequelize=require(_0xcb94('0x0'));module[_0xcb94('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xcb94('0x2')]},'username':{'type':Sequelize[_0xcb94('0x2')],'unique':'username'},'remoteUri':{'type':Sequelize[_0xcb94('0x2')]},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xcb94('0x2')]},'clientSecret':{'type':Sequelize[_0xcb94('0x2')]},'securityToken':{'type':Sequelize[_0xcb94('0x2')]},'serverUrl':{'type':Sequelize[_0xcb94('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xcb94('0x3')]('integrationTab',_0xcb94('0x4')),'defaultValue':_0xcb94('0x5')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 742d51a..18d3359 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 _0x9fad=['request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','destroy','error','name','send','SalesforceAccount','fieldName','key','model','map','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params','rawAttributes','fields','options','create','body','update','find','getConfigurations','findOne','SalesforceConfiguration','addConfiguration','Subjects','getSubjects','type','Descriptions','getDescriptions','channel','SalesforceField','getFields','Task','remoteUri','username','password','securityToken','slice','substring','lastIndexOf','Connection','clientId','clientSecret','concat','ticketType','sobject','describe','IsReminderSet','IsRecurrence','Subject','Description','string','boolean','email','textarea','phone','includes','label','custom','picklistValues','value','True','true','False','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','rimraf','fast-json-patch'];(function(_0x452ac2,_0x45f034){var _0x5a589a=function(_0x3c3fe8){while(--_0x3c3fe8){_0x452ac2['push'](_0x452ac2['shift']());}};_0x5a589a(++_0x45f034);}(_0x9fad,0x7b));var _0xd9fa=function(_0x5556fd,_0x428c97){_0x5556fd=_0x5556fd-0x0;var _0x29a874=_0x9fad[_0x5556fd];return _0x29a874;};'use strict';var emlformat=require(_0xd9fa('0x0'));var rimraf=require(_0xd9fa('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd9fa('0x2'));var rp=require(_0xd9fa('0x3'));var moment=require(_0xd9fa('0x4'));var BPromise=require(_0xd9fa('0x5'));var Mustache=require('mustache');var util=require(_0xd9fa('0x6'));var path=require(_0xd9fa('0x7'));var sox=require(_0xd9fa('0x8'));var csv=require(_0xd9fa('0x9'));var ejs=require(_0xd9fa('0xa'));var fs=require('fs');var fs_extra=require(_0xd9fa('0xb'));var _=require(_0xd9fa('0xc'));var squel=require(_0xd9fa('0xd'));var crypto=require(_0xd9fa('0xe'));var jsforce=require(_0xd9fa('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xd9fa('0x9'));var querystring=require(_0xd9fa('0x10'));var Papa=require(_0xd9fa('0x11'));var Redis=require('ioredis');var authService=require(_0xd9fa('0x12'));var qs=require(_0xd9fa('0x13'));var as=require(_0xd9fa('0x14'));var hardwareService=require(_0xd9fa('0x15'));var logger=require(_0xd9fa('0x16'))('api');var utils=require('../../config/utils');var config=require(_0xd9fa('0x17'));var licenseUtil=require(_0xd9fa('0x18'));var db=require(_0xd9fa('0x19'))['db'];var integrations=require(_0xd9fa('0x1a'));function respondWithStatusCode(_0x41d763,_0x3c1cb7){_0x3c1cb7=_0x3c1cb7||0xcc;return function(_0x40ba1d){if(_0x40ba1d){return _0x41d763[_0xd9fa('0x1b')](_0x3c1cb7);}return _0x41d763[_0xd9fa('0x1c')](_0x3c1cb7)[_0xd9fa('0x1d')]();};}function respondWithResult(_0x68528a,_0x53db77){_0x53db77=_0x53db77||0xc8;return function(_0x432a6a){if(_0x432a6a){return _0x68528a[_0xd9fa('0x1c')](_0x53db77)['json'](_0x432a6a);}};}function respondWithFilteredResult(_0x3e6029,_0x14330b){return function(_0x346377){if(_0x346377){var _0x28b009=typeof _0x14330b[_0xd9fa('0x1e')]===_0xd9fa('0x1f')&&typeof _0x14330b[_0xd9fa('0x20')]===_0xd9fa('0x1f');var _0x59a887=_0x346377[_0xd9fa('0x21')];var _0x216f2b=_0x28b009?0x0:_0x14330b[_0xd9fa('0x1e')];var _0x1c8a4a=_0x28b009?_0x346377[_0xd9fa('0x21')]:_0x14330b[_0xd9fa('0x1e')]+_0x14330b['limit'];var _0x41f961;if(_0x1c8a4a>=_0x59a887){_0x1c8a4a=_0x59a887;_0x41f961=0xc8;}else{_0x41f961=0xce;}_0x3e6029[_0xd9fa('0x1c')](_0x41f961);return _0x3e6029[_0xd9fa('0x22')](_0xd9fa('0x23'),_0x216f2b+'-'+_0x1c8a4a+'/'+_0x59a887)[_0xd9fa('0x24')](_0x346377);}return null;};}function patchUpdates(_0x3e1efc){return function(_0x427a74){try{jsonpatch[_0xd9fa('0x25')](_0x427a74,_0x3e1efc,!![]);}catch(_0x1ba809){return BPromise[_0xd9fa('0x26')](_0x1ba809);}return _0x427a74[_0xd9fa('0x27')]();};}function saveUpdates(_0x46fc70,_0x1275aa){return function(_0x46b1c0){if(_0x46b1c0){return _0x46b1c0['update'](_0x46fc70)[_0xd9fa('0x28')](function(_0x28caf1){return _0x28caf1;});}return null;};}function removeEntity(_0x39a1a6,_0x34f5a7){return function(_0x1cb354){if(_0x1cb354){return _0x1cb354[_0xd9fa('0x29')]()[_0xd9fa('0x28')](function(){_0x39a1a6['status'](0xcc)[_0xd9fa('0x1d')]();});}};}function handleEntityNotFound(_0x343d40,_0x155885){return function(_0x5e7df4){if(!_0x5e7df4){_0x343d40[_0xd9fa('0x1b')](0x194);}return _0x5e7df4;};}function handleError(_0x55eeb1,_0x5d95e8){_0x5d95e8=_0x5d95e8||0x1f4;return function(_0x28808e){logger[_0xd9fa('0x2a')](_0x28808e['stack']);if(_0x28808e[_0xd9fa('0x2b')]){delete _0x28808e[_0xd9fa('0x2b')];}_0x55eeb1[_0xd9fa('0x1c')](_0x5d95e8)[_0xd9fa('0x2c')](_0x28808e);};}exports['index']=function(_0x373011,_0x5c187b){var _0x3dc6d2={},_0x5cd82d={},_0x1b2889={'count':0x0,'rows':[]};var _0x11b2ae=_['map'](db[_0xd9fa('0x2d')]['rawAttributes'],function(_0x2c2757){return{'name':_0x2c2757[_0xd9fa('0x2e')],'type':_0x2c2757['type'][_0xd9fa('0x2f')]};});_0x5cd82d[_0xd9fa('0x30')]=_[_0xd9fa('0x31')](_0x11b2ae,_0xd9fa('0x2b'));_0x5cd82d[_0xd9fa('0x32')]=_[_0xd9fa('0x33')](_0x373011['query']);_0x5cd82d[_0xd9fa('0x34')]=_[_0xd9fa('0x35')](_0x5cd82d[_0xd9fa('0x30')],_0x5cd82d['query']);_0x3dc6d2[_0xd9fa('0x36')]=_[_0xd9fa('0x35')](_0x5cd82d[_0xd9fa('0x30')],qs['fields'](_0x373011['query']['fields']));_0x3dc6d2['attributes']=_0x3dc6d2['attributes'][_0xd9fa('0x37')]?_0x3dc6d2[_0xd9fa('0x36')]:_0x5cd82d[_0xd9fa('0x30')];if(!_0x373011['query'][_0xd9fa('0x38')](_0xd9fa('0x39'))){_0x3dc6d2[_0xd9fa('0x20')]=qs[_0xd9fa('0x20')](_0x373011[_0xd9fa('0x32')]['limit']);_0x3dc6d2[_0xd9fa('0x1e')]=qs['offset'](_0x373011['query'][_0xd9fa('0x1e')]);}_0x3dc6d2[_0xd9fa('0x3a')]=qs[_0xd9fa('0x3b')](_0x373011[_0xd9fa('0x32')][_0xd9fa('0x3b')]);_0x3dc6d2[_0xd9fa('0x3c')]=qs[_0xd9fa('0x34')](_[_0xd9fa('0x3d')](_0x373011[_0xd9fa('0x32')],_0x5cd82d['filters']),_0x11b2ae);if(_0x373011['query'][_0xd9fa('0x3e')]){_0x3dc6d2[_0xd9fa('0x3c')]=_[_0xd9fa('0x3f')](_0x3dc6d2[_0xd9fa('0x3c')],{'$or':_[_0xd9fa('0x31')](_0x11b2ae,function(_0x6cabda){if(_0x6cabda['type']!==_0xd9fa('0x40')){var _0x457377={};_0x457377[_0x6cabda[_0xd9fa('0x2b')]]={'$like':'%'+_0x373011[_0xd9fa('0x32')]['filter']+'%'};return _0x457377;}})});}_0x3dc6d2=_[_0xd9fa('0x3f')]({},_0x3dc6d2,_0x373011['options']);var _0x248fa4={'where':_0x3dc6d2['where']};return db[_0xd9fa('0x2d')]['count'](_0x248fa4)[_0xd9fa('0x28')](function(_0x4264e8){_0x1b2889[_0xd9fa('0x21')]=_0x4264e8;if(_0x373011['query'][_0xd9fa('0x41')]){_0x3dc6d2[_0xd9fa('0x42')]=[{'all':!![]}];}return db[_0xd9fa('0x2d')][_0xd9fa('0x43')](_0x3dc6d2);})[_0xd9fa('0x28')](function(_0x2a638c){_0x1b2889[_0xd9fa('0x44')]=_0x2a638c;return _0x1b2889;})['then'](respondWithFilteredResult(_0x5c187b,_0x3dc6d2))[_0xd9fa('0x45')](handleError(_0x5c187b,null));};exports['show']=function(_0x34c03f,_0x2f9e3e){var _0x4bc33a={'raw':![],'where':{'id':_0x34c03f[_0xd9fa('0x46')]['id']}},_0x5b208a={};_0x5b208a[_0xd9fa('0x30')]=_[_0xd9fa('0x33')](db[_0xd9fa('0x2d')][_0xd9fa('0x47')]);_0x5b208a[_0xd9fa('0x32')]=_[_0xd9fa('0x33')](_0x34c03f['query']);_0x5b208a[_0xd9fa('0x34')]=_[_0xd9fa('0x35')](_0x5b208a['model'],_0x5b208a[_0xd9fa('0x32')]);_0x4bc33a[_0xd9fa('0x36')]=_[_0xd9fa('0x35')](_0x5b208a[_0xd9fa('0x30')],qs[_0xd9fa('0x48')](_0x34c03f[_0xd9fa('0x32')][_0xd9fa('0x48')]));_0x4bc33a['attributes']=_0x4bc33a[_0xd9fa('0x36')]['length']?_0x4bc33a[_0xd9fa('0x36')]:_0x5b208a[_0xd9fa('0x30')];if(_0x34c03f[_0xd9fa('0x32')][_0xd9fa('0x41')]){_0x4bc33a[_0xd9fa('0x42')]=[{'all':!![]}];}_0x4bc33a=_[_0xd9fa('0x3f')]({},_0x4bc33a,_0x34c03f[_0xd9fa('0x49')]);return db[_0xd9fa('0x2d')]['find'](_0x4bc33a)[_0xd9fa('0x28')](handleEntityNotFound(_0x2f9e3e,null))[_0xd9fa('0x28')](respondWithResult(_0x2f9e3e,null))[_0xd9fa('0x45')](handleError(_0x2f9e3e,null));};exports[_0xd9fa('0x4a')]=function(_0x722001,_0x1db8b5){return db[_0xd9fa('0x2d')][_0xd9fa('0x4a')](_0x722001[_0xd9fa('0x4b')],{})[_0xd9fa('0x28')](respondWithResult(_0x1db8b5,0xc9))[_0xd9fa('0x45')](handleError(_0x1db8b5,null));};exports[_0xd9fa('0x4c')]=function(_0x5206c2,_0x50d5c0){if(_0x5206c2[_0xd9fa('0x4b')]['id']){delete _0x5206c2[_0xd9fa('0x4b')]['id'];}return db[_0xd9fa('0x2d')][_0xd9fa('0x4d')]({'where':{'id':_0x5206c2[_0xd9fa('0x46')]['id']}})[_0xd9fa('0x28')](handleEntityNotFound(_0x50d5c0,null))['then'](saveUpdates(_0x5206c2['body'],null))[_0xd9fa('0x28')](respondWithResult(_0x50d5c0,null))['catch'](handleError(_0x50d5c0,null));};exports[_0xd9fa('0x29')]=function(_0xc184e5,_0x9d4dd9){return db[_0xd9fa('0x2d')][_0xd9fa('0x4d')]({'where':{'id':_0xc184e5['params']['id']}})['then'](handleEntityNotFound(_0x9d4dd9,null))['then'](removeEntity(_0x9d4dd9,null))['catch'](handleError(_0x9d4dd9,null));};exports[_0xd9fa('0x4e')]=function(_0x228957,_0x1cd452,_0x4b7bed){var _0x2cf8e8={};var _0x248720={};var _0x99db1b;var _0x5bceb3;return db['SalesforceAccount'][_0xd9fa('0x4f')]({'where':{'id':_0x228957[_0xd9fa('0x46')]['id']}})[_0xd9fa('0x28')](handleEntityNotFound(_0x1cd452,null))[_0xd9fa('0x28')](function(_0x5c1b15){if(_0x5c1b15){_0x99db1b=_0x5c1b15;_0x248720['model']=_[_0xd9fa('0x33')](db[_0xd9fa('0x50')][_0xd9fa('0x47')]);_0x248720[_0xd9fa('0x32')]=_[_0xd9fa('0x33')](_0x228957[_0xd9fa('0x32')]);_0x248720[_0xd9fa('0x34')]=_[_0xd9fa('0x35')](_0x248720[_0xd9fa('0x30')],_0x248720[_0xd9fa('0x32')]);_0x2cf8e8['attributes']=_['intersection'](_0x248720[_0xd9fa('0x30')],qs[_0xd9fa('0x48')](_0x228957['query']['fields']));_0x2cf8e8[_0xd9fa('0x36')]=_0x2cf8e8[_0xd9fa('0x36')]['length']?_0x2cf8e8[_0xd9fa('0x36')]:_0x248720[_0xd9fa('0x30')];_0x2cf8e8[_0xd9fa('0x3a')]=qs[_0xd9fa('0x3b')](_0x228957[_0xd9fa('0x32')]['sort']);_0x2cf8e8[_0xd9fa('0x3c')]=qs[_0xd9fa('0x34')](_[_0xd9fa('0x3d')](_0x228957['query'],_0x248720[_0xd9fa('0x34')]));if(_0x228957['query'][_0xd9fa('0x3e')]){_0x2cf8e8[_0xd9fa('0x3c')]=_[_0xd9fa('0x3f')](_0x2cf8e8[_0xd9fa('0x3c')],{'$or':_['map'](_0x2cf8e8[_0xd9fa('0x36')],function(_0x2ba826){var _0x130232={};_0x130232[_0x2ba826]={'$like':'%'+_0x228957[_0xd9fa('0x32')][_0xd9fa('0x3e')]+'%'};return _0x130232;})});}_0x2cf8e8=_[_0xd9fa('0x3f')]({},_0x2cf8e8,_0x228957[_0xd9fa('0x49')]);return _0x99db1b[_0xd9fa('0x4e')](_0x2cf8e8);}})['then'](function(_0x210d61){if(_0x210d61){_0x5bceb3=_0x210d61['length'];if(!_0x228957[_0xd9fa('0x32')]['hasOwnProperty'](_0xd9fa('0x39'))){_0x2cf8e8[_0xd9fa('0x20')]=qs[_0xd9fa('0x20')](_0x228957[_0xd9fa('0x32')]['limit']);_0x2cf8e8[_0xd9fa('0x1e')]=qs['offset'](_0x228957['query'][_0xd9fa('0x1e')]);}return _0x99db1b[_0xd9fa('0x4e')](_0x2cf8e8);}})[_0xd9fa('0x28')](function(_0x3d87c4){if(_0x3d87c4){return _0x3d87c4?{'count':_0x5bceb3,'rows':_0x3d87c4}:null;}})[_0xd9fa('0x28')](respondWithResult(_0x1cd452,null))[_0xd9fa('0x45')](handleError(_0x1cd452,null));};exports[_0xd9fa('0x51')]=function(_0x372df5,_0x1f28e5,_0x14e313){if(_0x372df5['body']['id']){delete _0x372df5[_0xd9fa('0x4b')]['id'];}return db[_0xd9fa('0x2d')]['findOne']({'where':{'id':_0x372df5['params']['id']}})[_0xd9fa('0x28')](handleEntityNotFound(_0x1f28e5,null))[_0xd9fa('0x28')](function(_0x353b60){if(_0x353b60){_0x372df5[_0xd9fa('0x4b')]['AccountId']=_0x353b60['id'];_0x372df5[_0xd9fa('0x4b')][_0xd9fa('0x52')]=integrations[_0xd9fa('0x53')](_0x372df5[_0xd9fa('0x4b')]['channel'],_0x372df5[_0xd9fa('0x4b')][_0xd9fa('0x54')]);_0x372df5[_0xd9fa('0x4b')][_0xd9fa('0x55')]=integrations[_0xd9fa('0x56')](_0x372df5[_0xd9fa('0x4b')][_0xd9fa('0x57')],_0x372df5['body'][_0xd9fa('0x54')]);return db[_0xd9fa('0x50')][_0xd9fa('0x4a')](_0x372df5['body'],{'include':[{'model':db[_0xd9fa('0x58')],'as':_0xd9fa('0x52')},{'model':db['SalesforceField'],'as':_0xd9fa('0x55')}]});}return null;})['then'](respondWithResult(_0x1f28e5,null))[_0xd9fa('0x45')](handleError(_0x1f28e5,null));};exports[_0xd9fa('0x59')]=function(_0x3f7417,_0x12dc39,_0x2fe721){var _0x5fd3f3;var _0x1d97ba='';var _0x104d82=_0xd9fa('0x5a');return db[_0xd9fa('0x2d')][_0xd9fa('0x4f')]({'where':{'id':_0x3f7417['params']['id']},'attributes':['id',_0xd9fa('0x5b'),'clientId','clientSecret',_0xd9fa('0x5c'),_0xd9fa('0x5d'),_0xd9fa('0x5e')]})[_0xd9fa('0x28')](handleEntityNotFound(_0x12dc39,null))[_0xd9fa('0x28')](function(_0x35fbc6){if(_0x35fbc6){_0x1d97ba=_0x35fbc6[_0xd9fa('0x5b')];var _0x4fd2b0=_0x1d97ba[_0xd9fa('0x5f')](-0x1);if(_0x4fd2b0==='/'){_0x1d97ba=_0x1d97ba[_0xd9fa('0x60')](0x0,_0x1d97ba[_0xd9fa('0x61')](_0x4fd2b0));}_0x5fd3f3=new jsforce[(_0xd9fa('0x62'))]({'oauth2':{'loginUrl':_0x1d97ba,'clientId':_0x35fbc6[_0xd9fa('0x63')],'clientSecret':_0x35fbc6[_0xd9fa('0x64')]}});return _0x5fd3f3['login'](_0x35fbc6[_0xd9fa('0x5c')],_0x35fbc6[_0xd9fa('0x5d')][_0xd9fa('0x65')](_0x35fbc6['securityToken']));}})[_0xd9fa('0x28')](function(_0x1bee59){if(_0x1bee59){if(!_['isNil'](_0x3f7417[_0xd9fa('0x32')]['ticketType'])){_0x104d82=_0x3f7417[_0xd9fa('0x32')][_0xd9fa('0x66')];}return _0x5fd3f3[_0xd9fa('0x67')](_0x104d82)[_0xd9fa('0x68')]();}})[_0xd9fa('0x28')](function(_0x164792){var _0x281b24=['OwnerId','ActivityDate',_0xd9fa('0x69'),_0xd9fa('0x6a'),_0xd9fa('0x6b'),_0xd9fa('0x6c')];var _0x5bac7a=[_0xd9fa('0x6d'),'int','picklist',_0xd9fa('0x6e'),_0xd9fa('0x6f'),_0xd9fa('0x70'),_0xd9fa('0x71')];if(_0x164792){_['remove'](_0x164792[_0xd9fa('0x48')],function(_0x52f641){return _0x281b24[_0xd9fa('0x72')](_0x52f641['name'])||!_0x5bac7a[_0xd9fa('0x72')](_0x52f641[_0xd9fa('0x54')]);});return{'count':_0x164792[_0xd9fa('0x48')][_0xd9fa('0x37')],'rows':_[_0xd9fa('0x31')](_0x164792[_0xd9fa('0x48')],function(_0x6b4de3){return{'id':_0x6b4de3['name'],'name':_0x6b4de3[_0xd9fa('0x73')],'custom':_0x6b4de3[_0xd9fa('0x74')],'options':_0x6b4de3[_0xd9fa('0x75')][_0xd9fa('0x37')]>0x0?_[_0xd9fa('0x31')](_0x6b4de3[_0xd9fa('0x75')],function(_0x38d027){return{'name':_0x38d027[_0xd9fa('0x73')],'value':_0x38d027[_0xd9fa('0x76')]};}):_0x6b4de3[_0xd9fa('0x54')]==_0xd9fa('0x6e')?[{'name':_0xd9fa('0x77'),'value':_0xd9fa('0x78')},{'name':_0xd9fa('0x79'),'value':'false'}]:[]};})};}})[_0xd9fa('0x28')](respondWithResult(_0x12dc39,null))[_0xd9fa('0x45')](function(_0x292cf4){var _0x376a01=_0x3f7417[_0xd9fa('0x32')][_0xd9fa('0x7a')]?0x1f4:_0x292cf4[_0xd9fa('0x7b')]||0x1f4;logger[_0xd9fa('0x2a')](_0xd9fa('0x7c'),'getFields',_0x376a01,JSON[_0xd9fa('0x7d')](_0x292cf4));delete _0x292cf4[_0xd9fa('0x2b')];if(_0x376a01===0x191){_0x376a01=0x190;}_0x12dc39['status'](_0x376a01)[_0xd9fa('0x2c')](_0x3f7417[_0xd9fa('0x32')][_0xd9fa('0x7a')]?{'message':'Wrong\x20credentials','statusCode':_0x292cf4[_0xd9fa('0x7b')]}:_0x292cf4);});}; \ No newline at end of file +var _0x1ce5=['substring','lastIndexOf','Connection','login','concat','isNil','ticketType','sobject','describe','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','string','picklist','boolean','email','textarea','phone','remove','includes','label','custom','picklistValues','value','true','False','false','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','send','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','then','destroy','stack','name','index','SalesforceAccount','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','find','create','body','getConfigurations','findOne','SalesforceConfiguration','order','pick','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','Task','remoteUri','clientId','clientSecret','username','password','securityToken','slice'];(function(_0x4d0f12,_0x35e426){var _0x9ec1b1=function(_0x330222){while(--_0x330222){_0x4d0f12['push'](_0x4d0f12['shift']());}};_0x9ec1b1(++_0x35e426);}(_0x1ce5,0xa8));var _0x51ce=function(_0x5a3cf0,_0x160a68){_0x5a3cf0=_0x5a3cf0-0x0;var _0x5a64ee=_0x1ce5[_0x5a3cf0];return _0x5a64ee;};'use strict';var emlformat=require(_0x51ce('0x0'));var rimraf=require(_0x51ce('0x1'));var zipdir=require(_0x51ce('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x51ce('0x3'));var moment=require(_0x51ce('0x4'));var BPromise=require(_0x51ce('0x5'));var Mustache=require(_0x51ce('0x6'));var util=require(_0x51ce('0x7'));var path=require(_0x51ce('0x8'));var sox=require(_0x51ce('0x9'));var csv=require(_0x51ce('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x51ce('0xb'));var _=require(_0x51ce('0xc'));var squel=require(_0x51ce('0xd'));var crypto=require('crypto');var jsforce=require(_0x51ce('0xe'));var deskjs=require(_0x51ce('0xf'));var toCsv=require(_0x51ce('0xa'));var querystring=require(_0x51ce('0x10'));var Papa=require(_0x51ce('0x11'));var Redis=require(_0x51ce('0x12'));var authService=require(_0x51ce('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x51ce('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x51ce('0x15'))(_0x51ce('0x16'));var utils=require(_0x51ce('0x17'));var config=require(_0x51ce('0x18'));var licenseUtil=require(_0x51ce('0x19'));var db=require(_0x51ce('0x1a'))['db'];var integrations=require(_0x51ce('0x1b'));function respondWithStatusCode(_0xf6b89b,_0x3a670c){_0x3a670c=_0x3a670c||0xcc;return function(_0x1b4a48){if(_0x1b4a48){return _0xf6b89b[_0x51ce('0x1c')](_0x3a670c);}return _0xf6b89b[_0x51ce('0x1d')](_0x3a670c)[_0x51ce('0x1e')]();};}function respondWithResult(_0x3a189a,_0x56ad35){_0x56ad35=_0x56ad35||0xc8;return function(_0x377b89){if(_0x377b89){return _0x3a189a['status'](_0x56ad35)['json'](_0x377b89);}};}function respondWithFilteredResult(_0xc2a048,_0x21b35f){return function(_0x2f0e32){if(_0x2f0e32){var _0x13507d=typeof _0x21b35f[_0x51ce('0x1f')]===_0x51ce('0x20')&&typeof _0x21b35f[_0x51ce('0x21')]==='undefined';var _0x5d8b92=_0x2f0e32[_0x51ce('0x22')];var _0x49a268=_0x13507d?0x0:_0x21b35f[_0x51ce('0x1f')];var _0x57544e=_0x13507d?_0x2f0e32['count']:_0x21b35f['offset']+_0x21b35f[_0x51ce('0x21')];var _0x57d24c;if(_0x57544e>=_0x5d8b92){_0x57544e=_0x5d8b92;_0x57d24c=0xc8;}else{_0x57d24c=0xce;}_0xc2a048[_0x51ce('0x1d')](_0x57d24c);return _0xc2a048[_0x51ce('0x23')]('Content-Range',_0x49a268+'-'+_0x57544e+'/'+_0x5d8b92)[_0x51ce('0x24')](_0x2f0e32);}return null;};}function patchUpdates(_0x180e0d){return function(_0x516974){try{jsonpatch[_0x51ce('0x25')](_0x516974,_0x180e0d,!![]);}catch(_0x5585c9){return BPromise[_0x51ce('0x26')](_0x5585c9);}return _0x516974[_0x51ce('0x27')]();};}function saveUpdates(_0x4298a2,_0x17ed4e){return function(_0x4fe262){if(_0x4fe262){return _0x4fe262['update'](_0x4298a2)[_0x51ce('0x28')](function(_0x29ec11){return _0x29ec11;});}return null;};}function removeEntity(_0x3fd3af,_0x368619){return function(_0x34b075){if(_0x34b075){return _0x34b075[_0x51ce('0x29')]()[_0x51ce('0x28')](function(){_0x3fd3af[_0x51ce('0x1d')](0xcc)[_0x51ce('0x1e')]();});}};}function handleEntityNotFound(_0x27c8ad,_0x2787ee){return function(_0x5f42aa){if(!_0x5f42aa){_0x27c8ad['sendStatus'](0x194);}return _0x5f42aa;};}function handleError(_0x4176ca,_0x4af334){_0x4af334=_0x4af334||0x1f4;return function(_0x3abd6e){logger['error'](_0x3abd6e[_0x51ce('0x2a')]);if(_0x3abd6e['name']){delete _0x3abd6e[_0x51ce('0x2b')];}_0x4176ca[_0x51ce('0x1d')](_0x4af334)['send'](_0x3abd6e);};}exports[_0x51ce('0x2c')]=function(_0x4451a7,_0x19577b){var _0x49d59b={},_0x58952a={},_0x143928={'count':0x0,'rows':[]};var _0x12f077=_['map'](db[_0x51ce('0x2d')][_0x51ce('0x2e')],function(_0x9954eb){return{'name':_0x9954eb[_0x51ce('0x2f')],'type':_0x9954eb[_0x51ce('0x30')][_0x51ce('0x31')]};});_0x58952a[_0x51ce('0x32')]=_[_0x51ce('0x33')](_0x12f077,'name');_0x58952a['query']=_['keys'](_0x4451a7[_0x51ce('0x34')]);_0x58952a[_0x51ce('0x35')]=_[_0x51ce('0x36')](_0x58952a[_0x51ce('0x32')],_0x58952a[_0x51ce('0x34')]);_0x49d59b[_0x51ce('0x37')]=_[_0x51ce('0x36')](_0x58952a[_0x51ce('0x32')],qs[_0x51ce('0x38')](_0x4451a7[_0x51ce('0x34')][_0x51ce('0x38')]));_0x49d59b[_0x51ce('0x37')]=_0x49d59b['attributes'][_0x51ce('0x39')]?_0x49d59b[_0x51ce('0x37')]:_0x58952a[_0x51ce('0x32')];if(!_0x4451a7[_0x51ce('0x34')][_0x51ce('0x3a')](_0x51ce('0x3b'))){_0x49d59b['limit']=qs[_0x51ce('0x21')](_0x4451a7[_0x51ce('0x34')][_0x51ce('0x21')]);_0x49d59b['offset']=qs[_0x51ce('0x1f')](_0x4451a7[_0x51ce('0x34')]['offset']);}_0x49d59b['order']=qs[_0x51ce('0x3c')](_0x4451a7[_0x51ce('0x34')][_0x51ce('0x3c')]);_0x49d59b[_0x51ce('0x3d')]=qs[_0x51ce('0x35')](_['pick'](_0x4451a7[_0x51ce('0x34')],_0x58952a[_0x51ce('0x35')]),_0x12f077);if(_0x4451a7[_0x51ce('0x34')][_0x51ce('0x3e')]){_0x49d59b[_0x51ce('0x3d')]=_[_0x51ce('0x3f')](_0x49d59b['where'],{'$or':_[_0x51ce('0x33')](_0x12f077,function(_0x157c89){if(_0x157c89[_0x51ce('0x30')]!==_0x51ce('0x40')){var _0x41c4c9={};_0x41c4c9[_0x157c89[_0x51ce('0x2b')]]={'$like':'%'+_0x4451a7[_0x51ce('0x34')]['filter']+'%'};return _0x41c4c9;}})});}_0x49d59b=_[_0x51ce('0x3f')]({},_0x49d59b,_0x4451a7[_0x51ce('0x41')]);var _0x4c5417={'where':_0x49d59b[_0x51ce('0x3d')]};return db[_0x51ce('0x2d')][_0x51ce('0x22')](_0x4c5417)['then'](function(_0x3c01ed){_0x143928[_0x51ce('0x22')]=_0x3c01ed;if(_0x4451a7['query'][_0x51ce('0x42')]){_0x49d59b[_0x51ce('0x43')]=[{'all':!![]}];}return db[_0x51ce('0x2d')][_0x51ce('0x44')](_0x49d59b);})[_0x51ce('0x28')](function(_0xde7431){_0x143928[_0x51ce('0x45')]=_0xde7431;return _0x143928;})[_0x51ce('0x28')](respondWithFilteredResult(_0x19577b,_0x49d59b))[_0x51ce('0x46')](handleError(_0x19577b,null));};exports['show']=function(_0x381ae1,_0x4c120e){var _0x22a2bb={'raw':![],'where':{'id':_0x381ae1[_0x51ce('0x47')]['id']}},_0x1becd0={};_0x1becd0[_0x51ce('0x32')]=_[_0x51ce('0x48')](db[_0x51ce('0x2d')]['rawAttributes']);_0x1becd0[_0x51ce('0x34')]=_[_0x51ce('0x48')](_0x381ae1[_0x51ce('0x34')]);_0x1becd0[_0x51ce('0x35')]=_[_0x51ce('0x36')](_0x1becd0[_0x51ce('0x32')],_0x1becd0[_0x51ce('0x34')]);_0x22a2bb['attributes']=_[_0x51ce('0x36')](_0x1becd0[_0x51ce('0x32')],qs[_0x51ce('0x38')](_0x381ae1[_0x51ce('0x34')]['fields']));_0x22a2bb[_0x51ce('0x37')]=_0x22a2bb[_0x51ce('0x37')][_0x51ce('0x39')]?_0x22a2bb['attributes']:_0x1becd0[_0x51ce('0x32')];if(_0x381ae1['query'][_0x51ce('0x42')]){_0x22a2bb[_0x51ce('0x43')]=[{'all':!![]}];}_0x22a2bb=_[_0x51ce('0x3f')]({},_0x22a2bb,_0x381ae1[_0x51ce('0x41')]);return db[_0x51ce('0x2d')][_0x51ce('0x49')](_0x22a2bb)[_0x51ce('0x28')](handleEntityNotFound(_0x4c120e,null))[_0x51ce('0x28')](respondWithResult(_0x4c120e,null))[_0x51ce('0x46')](handleError(_0x4c120e,null));};exports[_0x51ce('0x4a')]=function(_0x2411fb,_0x222057){return db[_0x51ce('0x2d')][_0x51ce('0x4a')](_0x2411fb[_0x51ce('0x4b')],{})[_0x51ce('0x28')](respondWithResult(_0x222057,0xc9))[_0x51ce('0x46')](handleError(_0x222057,null));};exports['update']=function(_0x153b32,_0x479c88){if(_0x153b32[_0x51ce('0x4b')]['id']){delete _0x153b32['body']['id'];}return db[_0x51ce('0x2d')][_0x51ce('0x49')]({'where':{'id':_0x153b32[_0x51ce('0x47')]['id']}})[_0x51ce('0x28')](handleEntityNotFound(_0x479c88,null))['then'](saveUpdates(_0x153b32[_0x51ce('0x4b')],null))[_0x51ce('0x28')](respondWithResult(_0x479c88,null))[_0x51ce('0x46')](handleError(_0x479c88,null));};exports[_0x51ce('0x29')]=function(_0x21ebc2,_0x563f1b){return db[_0x51ce('0x2d')]['find']({'where':{'id':_0x21ebc2['params']['id']}})[_0x51ce('0x28')](handleEntityNotFound(_0x563f1b,null))[_0x51ce('0x28')](removeEntity(_0x563f1b,null))[_0x51ce('0x46')](handleError(_0x563f1b,null));};exports[_0x51ce('0x4c')]=function(_0x88a2aa,_0x3522e4,_0x4e1114){var _0x34c1b3={};var _0x37f050={};var _0x28a7c7;var _0x3ae4c3;return db[_0x51ce('0x2d')][_0x51ce('0x4d')]({'where':{'id':_0x88a2aa[_0x51ce('0x47')]['id']}})[_0x51ce('0x28')](handleEntityNotFound(_0x3522e4,null))[_0x51ce('0x28')](function(_0x496b7b){if(_0x496b7b){_0x28a7c7=_0x496b7b;_0x37f050[_0x51ce('0x32')]=_[_0x51ce('0x48')](db[_0x51ce('0x4e')][_0x51ce('0x2e')]);_0x37f050[_0x51ce('0x34')]=_[_0x51ce('0x48')](_0x88a2aa[_0x51ce('0x34')]);_0x37f050[_0x51ce('0x35')]=_[_0x51ce('0x36')](_0x37f050[_0x51ce('0x32')],_0x37f050[_0x51ce('0x34')]);_0x34c1b3[_0x51ce('0x37')]=_[_0x51ce('0x36')](_0x37f050[_0x51ce('0x32')],qs[_0x51ce('0x38')](_0x88a2aa['query'][_0x51ce('0x38')]));_0x34c1b3[_0x51ce('0x37')]=_0x34c1b3[_0x51ce('0x37')][_0x51ce('0x39')]?_0x34c1b3[_0x51ce('0x37')]:_0x37f050[_0x51ce('0x32')];_0x34c1b3[_0x51ce('0x4f')]=qs['sort'](_0x88a2aa[_0x51ce('0x34')][_0x51ce('0x3c')]);_0x34c1b3[_0x51ce('0x3d')]=qs[_0x51ce('0x35')](_[_0x51ce('0x50')](_0x88a2aa['query'],_0x37f050[_0x51ce('0x35')]));if(_0x88a2aa[_0x51ce('0x34')]['filter']){_0x34c1b3[_0x51ce('0x3d')]=_[_0x51ce('0x3f')](_0x34c1b3[_0x51ce('0x3d')],{'$or':_['map'](_0x34c1b3[_0x51ce('0x37')],function(_0x2b38ab){var _0x1406e3={};_0x1406e3[_0x2b38ab]={'$like':'%'+_0x88a2aa['query'][_0x51ce('0x3e')]+'%'};return _0x1406e3;})});}_0x34c1b3=_[_0x51ce('0x3f')]({},_0x34c1b3,_0x88a2aa[_0x51ce('0x41')]);return _0x28a7c7[_0x51ce('0x4c')](_0x34c1b3);}})['then'](function(_0x10ac9d){if(_0x10ac9d){_0x3ae4c3=_0x10ac9d[_0x51ce('0x39')];if(!_0x88a2aa['query']['hasOwnProperty'](_0x51ce('0x3b'))){_0x34c1b3['limit']=qs[_0x51ce('0x21')](_0x88a2aa[_0x51ce('0x34')][_0x51ce('0x21')]);_0x34c1b3[_0x51ce('0x1f')]=qs[_0x51ce('0x1f')](_0x88a2aa[_0x51ce('0x34')][_0x51ce('0x1f')]);}return _0x28a7c7[_0x51ce('0x4c')](_0x34c1b3);}})[_0x51ce('0x28')](function(_0x305d4c){if(_0x305d4c){return _0x305d4c?{'count':_0x3ae4c3,'rows':_0x305d4c}:null;}})[_0x51ce('0x28')](respondWithResult(_0x3522e4,null))[_0x51ce('0x46')](handleError(_0x3522e4,null));};exports['addConfiguration']=function(_0x2c30cf,_0x302578,_0xfbb5b){if(_0x2c30cf[_0x51ce('0x4b')]['id']){delete _0x2c30cf[_0x51ce('0x4b')]['id'];}return db[_0x51ce('0x2d')][_0x51ce('0x4d')]({'where':{'id':_0x2c30cf[_0x51ce('0x47')]['id']}})[_0x51ce('0x28')](handleEntityNotFound(_0x302578,null))[_0x51ce('0x28')](function(_0x591443){if(_0x591443){_0x2c30cf[_0x51ce('0x4b')][_0x51ce('0x51')]=_0x591443['id'];_0x2c30cf['body'][_0x51ce('0x52')]=integrations[_0x51ce('0x53')](_0x2c30cf[_0x51ce('0x4b')][_0x51ce('0x54')],_0x2c30cf[_0x51ce('0x4b')][_0x51ce('0x30')]);_0x2c30cf[_0x51ce('0x4b')][_0x51ce('0x55')]=integrations[_0x51ce('0x56')](_0x2c30cf[_0x51ce('0x4b')][_0x51ce('0x54')],_0x2c30cf[_0x51ce('0x4b')]['type']);return db[_0x51ce('0x4e')][_0x51ce('0x4a')](_0x2c30cf[_0x51ce('0x4b')],{'include':[{'model':db[_0x51ce('0x57')],'as':_0x51ce('0x52')},{'model':db[_0x51ce('0x57')],'as':_0x51ce('0x55')}]});}return null;})['then'](respondWithResult(_0x302578,null))['catch'](handleError(_0x302578,null));};exports['getFields']=function(_0x42a0f1,_0x340a8f,_0x5ab4fd){var _0x5a28a6;var _0x17570e='';var _0x4732d2=_0x51ce('0x58');return db[_0x51ce('0x2d')][_0x51ce('0x4d')]({'where':{'id':_0x42a0f1['params']['id']},'attributes':['id',_0x51ce('0x59'),_0x51ce('0x5a'),_0x51ce('0x5b'),_0x51ce('0x5c'),_0x51ce('0x5d'),_0x51ce('0x5e')]})[_0x51ce('0x28')](handleEntityNotFound(_0x340a8f,null))[_0x51ce('0x28')](function(_0x9232ec){if(_0x9232ec){_0x17570e=_0x9232ec[_0x51ce('0x59')];var _0x5263b5=_0x17570e[_0x51ce('0x5f')](-0x1);if(_0x5263b5==='/'){_0x17570e=_0x17570e[_0x51ce('0x60')](0x0,_0x17570e[_0x51ce('0x61')](_0x5263b5));}_0x5a28a6=new jsforce[(_0x51ce('0x62'))]({'oauth2':{'loginUrl':_0x17570e,'clientId':_0x9232ec[_0x51ce('0x5a')],'clientSecret':_0x9232ec[_0x51ce('0x5b')]}});return _0x5a28a6[_0x51ce('0x63')](_0x9232ec[_0x51ce('0x5c')],_0x9232ec[_0x51ce('0x5d')][_0x51ce('0x64')](_0x9232ec[_0x51ce('0x5e')]));}})[_0x51ce('0x28')](function(_0x56e81e){if(_0x56e81e){if(!_[_0x51ce('0x65')](_0x42a0f1[_0x51ce('0x34')][_0x51ce('0x66')])){_0x4732d2=_0x42a0f1[_0x51ce('0x34')][_0x51ce('0x66')];}return _0x5a28a6[_0x51ce('0x67')](_0x4732d2)[_0x51ce('0x68')]();}})['then'](function(_0x2a0e3b){var _0x416c5e=[_0x51ce('0x69'),_0x51ce('0x6a'),_0x51ce('0x6b'),_0x51ce('0x6c'),_0x51ce('0x6d'),'Description'];var _0x31c1ba=[_0x51ce('0x6e'),'int',_0x51ce('0x6f'),_0x51ce('0x70'),_0x51ce('0x71'),_0x51ce('0x72'),_0x51ce('0x73')];if(_0x2a0e3b){_[_0x51ce('0x74')](_0x2a0e3b[_0x51ce('0x38')],function(_0x3d88c7){return _0x416c5e[_0x51ce('0x75')](_0x3d88c7[_0x51ce('0x2b')])||!_0x31c1ba[_0x51ce('0x75')](_0x3d88c7[_0x51ce('0x30')]);});return{'count':_0x2a0e3b[_0x51ce('0x38')][_0x51ce('0x39')],'rows':_[_0x51ce('0x33')](_0x2a0e3b[_0x51ce('0x38')],function(_0x57911a){return{'id':_0x57911a[_0x51ce('0x2b')],'name':_0x57911a[_0x51ce('0x76')],'custom':_0x57911a[_0x51ce('0x77')],'options':_0x57911a['picklistValues'][_0x51ce('0x39')]>0x0?_[_0x51ce('0x33')](_0x57911a[_0x51ce('0x78')],function(_0x34d631){return{'name':_0x34d631[_0x51ce('0x76')],'value':_0x34d631[_0x51ce('0x79')]};}):_0x57911a['type']==_0x51ce('0x70')?[{'name':'True','value':_0x51ce('0x7a')},{'name':_0x51ce('0x7b'),'value':_0x51ce('0x7c')}]:[]};})};}})['then'](respondWithResult(_0x340a8f,null))[_0x51ce('0x46')](function(_0x552022){var _0x1ae5a2=_0x42a0f1[_0x51ce('0x34')][_0x51ce('0x7d')]?0x1f4:_0x552022[_0x51ce('0x7e')]||0x1f4;logger[_0x51ce('0x7f')](_0x51ce('0x80'),_0x51ce('0x81'),_0x1ae5a2,JSON[_0x51ce('0x82')](_0x552022));delete _0x552022[_0x51ce('0x2b')];if(_0x1ae5a2===0x191){_0x1ae5a2=0x190;}_0x340a8f[_0x51ce('0x1d')](_0x1ae5a2)[_0x51ce('0x83')](_0x42a0f1['query']['test']?{'message':'Wrong\x20credentials','statusCode':_0x552022['statusCode']}:_0x552022);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 3f2c425..27f8de6 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 _0x3238=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','define','int_salesforce_accounts','lodash'];(function(_0xea8947,_0x1b573d){var _0x2455e9=function(_0x18771e){while(--_0x18771e){_0xea8947['push'](_0xea8947['shift']());}};_0x2455e9(++_0x1b573d);}(_0x3238,0x13e));var _0x8323=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3238[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x8323('0x0'));var util=require('util');var logger=require(_0x8323('0x1'))(_0x8323('0x2'));var moment=require(_0x8323('0x3'));var BPromise=require('bluebird');var rp=require(_0x8323('0x4'));var fs=require('fs');var path=require(_0x8323('0x5'));var rimraf=require(_0x8323('0x6'));var config=require(_0x8323('0x7'));var attributes=require('./intSalesforceAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x8323('0x8')]=function(_0x5544f9,_0x40b1f0){return _0x5544f9[_0x8323('0x9')]('SalesforceAccount',attributes,{'tableName':_0x8323('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa1a2=['SalesforceAccount','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define'];(function(_0xcdc0f5,_0x2d744d){var _0x5ace3c=function(_0x1b33be){while(--_0x1b33be){_0xcdc0f5['push'](_0xcdc0f5['shift']());}};_0x5ace3c(++_0x2d744d);}(_0xa1a2,0x76));var _0x2a1a=function(_0x40b99f,_0x1ed6b7){_0x40b99f=_0x40b99f-0x0;var _0x291296=_0xa1a2[_0x40b99f];return _0x291296;};'use strict';var _=require(_0x2a1a('0x0'));var util=require(_0x2a1a('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x2a1a('0x2'));var BPromise=require(_0x2a1a('0x3'));var rp=require(_0x2a1a('0x4'));var fs=require('fs');var path=require(_0x2a1a('0x5'));var rimraf=require(_0x2a1a('0x6'));var config=require(_0x2a1a('0x7'));var attributes=require(_0x2a1a('0x8'));var integrations=require(_0x2a1a('0x9'));module[_0x2a1a('0xa')]=function(_0x2cd28d,_0x16d1b0){return _0x2cd28d[_0x2a1a('0xb')](_0x2a1a('0xc'),attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index 0c54002..72b6815 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 _0x7f2d=['result','catch','GetSalesforceAccount','SalesforceAccount','options','where','limit','include','model','attributes','stringify','ShowSalesforceAccount','find','raw','map','then','util','moment','bluebird','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','error','code','message'];(function(_0x23177b,_0x153fa0){var _0x56d68a=function(_0x21d5d7){while(--_0x21d5d7){_0x23177b['push'](_0x23177b['shift']());}};_0x56d68a(++_0x153fa0);}(_0x7f2d,0x7c));var _0xd7f2=function(_0x58d3b7,_0x1dc98a){_0x58d3b7=_0x58d3b7-0x0;var _0x1603b1=_0x7f2d[_0x58d3b7];return _0x1603b1;};'use strict';var _=require('lodash');var util=require(_0xd7f2('0x0'));var moment=require(_0xd7f2('0x1'));var BPromise=require(_0xd7f2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd7f2('0x3'));var db=require(_0xd7f2('0x4'))['db'];var utils=require(_0xd7f2('0x5'));var logger=require(_0xd7f2('0x6'))(_0xd7f2('0x7'));var config=require(_0xd7f2('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd7f2('0x9')][_0xd7f2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4135fe,_0x3956f0,_0x3f0944){return new BPromise(function(_0x2a2c48,_0x4e7afd){return client[_0xd7f2('0xb')](_0x4135fe,_0x3f0944)['then'](function(_0xf572d1){logger[_0xd7f2('0xc')](_0xd7f2('0xd'),_0x3956f0,_0xd7f2('0xe'));logger[_0xd7f2('0xf')](_0xd7f2('0x10'),_0x3956f0,_0xd7f2('0xe'),JSON['stringify'](_0xf572d1));if(_0xf572d1[_0xd7f2('0x11')]){if(_0xf572d1[_0xd7f2('0x11')][_0xd7f2('0x12')]===0x1f4){logger[_0xd7f2('0x11')]('SalesforceAccount,\x20%s,\x20%s',_0x3956f0,_0xf572d1[_0xd7f2('0x11')][_0xd7f2('0x13')]);return _0x4e7afd(_0xf572d1[_0xd7f2('0x11')]['message']);}logger[_0xd7f2('0x11')]('SalesforceAccount,\x20%s,\x20%s',_0x3956f0,_0xf572d1[_0xd7f2('0x11')][_0xd7f2('0x13')]);return _0x2a2c48(_0xf572d1['error'][_0xd7f2('0x13')]);}else{logger['info'](_0xd7f2('0xd'),_0x3956f0,_0xd7f2('0xe'));_0x2a2c48(_0xf572d1[_0xd7f2('0x14')][_0xd7f2('0x13')]);}})[_0xd7f2('0x15')](function(_0x383585){logger[_0xd7f2('0x11')](_0xd7f2('0xd'),_0x3956f0,_0x383585);_0x4e7afd(_0x383585);});});}exports[_0xd7f2('0x16')]=function(_0x311652){var _0x22b608=this;return new Promise(function(_0x4144d5,_0x28a574){return db[_0xd7f2('0x17')]['findAll']({'raw':_0x311652[_0xd7f2('0x18')]?_0x311652[_0xd7f2('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x311652[_0xd7f2('0x18')]?_0x311652[_0xd7f2('0x18')][_0xd7f2('0x19')]||null:null,'attributes':_0x311652['options']?_0x311652[_0xd7f2('0x18')]['attributes']||null:null,'limit':_0x311652[_0xd7f2('0x18')]?_0x311652[_0xd7f2('0x18')][_0xd7f2('0x1a')]||null:null,'include':_0x311652[_0xd7f2('0x18')]?_0x311652['options'][_0xd7f2('0x1b')]?_['map'](_0x311652[_0xd7f2('0x18')][_0xd7f2('0x1b')],function(_0x4f1824){return{'model':db[_0x4f1824[_0xd7f2('0x1c')]],'as':_0x4f1824['as'],'attributes':_0x4f1824[_0xd7f2('0x1d')],'include':_0x4f1824[_0xd7f2('0x1b')]?_['map'](_0x4f1824[_0xd7f2('0x1b')],function(_0x5f1406){return{'model':db[_0x5f1406[_0xd7f2('0x1c')]],'as':_0x5f1406['as'],'attributes':_0x5f1406[_0xd7f2('0x1d')],'include':_0x5f1406[_0xd7f2('0x1b')]?_['map'](_0x5f1406[_0xd7f2('0x1b')],function(_0x144932){return{'model':db[_0x144932['model']],'as':_0x144932['as'],'attributes':_0x144932[_0xd7f2('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2d6864){logger[_0xd7f2('0xc')](_0xd7f2('0x16'),_0x311652);logger[_0xd7f2('0xf')]('GetSalesforceAccount',_0x311652,JSON[_0xd7f2('0x1e')](_0x2d6864));_0x4144d5(_0x2d6864);})['catch'](function(_0x1825c7){logger[_0xd7f2('0x11')](_0xd7f2('0x16'),_0x1825c7[_0xd7f2('0x13')],_0x311652);_0x28a574(_0x22b608['error'](0x1f4,_0x1825c7[_0xd7f2('0x13')]));});});};exports[_0xd7f2('0x1f')]=function(_0x5844d8){var _0x370a4e=this;return new Promise(function(_0xf49b60,_0x4bf47b){return db['SalesforceAccount'][_0xd7f2('0x20')]({'raw':_0x5844d8[_0xd7f2('0x18')]?_0x5844d8[_0xd7f2('0x18')][_0xd7f2('0x21')]===undefined?!![]:![]:!![],'where':_0x5844d8[_0xd7f2('0x18')]?_0x5844d8[_0xd7f2('0x18')]['where']||null:null,'attributes':_0x5844d8[_0xd7f2('0x18')]?_0x5844d8[_0xd7f2('0x18')][_0xd7f2('0x1d')]||null:null,'include':_0x5844d8['options']?_0x5844d8[_0xd7f2('0x18')][_0xd7f2('0x1b')]?_[_0xd7f2('0x22')](_0x5844d8[_0xd7f2('0x18')][_0xd7f2('0x1b')],function(_0x5c35fe){return{'model':db[_0x5c35fe['model']],'as':_0x5c35fe['as'],'attributes':_0x5c35fe[_0xd7f2('0x1d')],'include':_0x5c35fe[_0xd7f2('0x1b')]?_['map'](_0x5c35fe[_0xd7f2('0x1b')],function(_0x5a1637){return{'model':db[_0x5a1637[_0xd7f2('0x1c')]],'as':_0x5a1637['as'],'attributes':_0x5a1637['attributes'],'include':_0x5a1637[_0xd7f2('0x1b')]?_[_0xd7f2('0x22')](_0x5a1637[_0xd7f2('0x1b')],function(_0x2f46a2){return{'model':db[_0x2f46a2[_0xd7f2('0x1c')]],'as':_0x2f46a2['as'],'attributes':_0x2f46a2[_0xd7f2('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xd7f2('0x23')](function(_0x16bea5){logger[_0xd7f2('0xc')](_0xd7f2('0x1f'),_0x5844d8);logger[_0xd7f2('0xf')](_0xd7f2('0x1f'),_0x5844d8,JSON[_0xd7f2('0x1e')](_0x16bea5));_0xf49b60(_0x16bea5);})[_0xd7f2('0x15')](function(_0x5f5613){logger['error'](_0xd7f2('0x1f'),_0x5f5613[_0xd7f2('0x13')],_0x5844d8);_0x4bf47b(_0x370a4e['error'](0x1f4,_0x5f5613[_0xd7f2('0x13')]));});});}; \ No newline at end of file +var _0x65ec=['map','model','find','ShowSalesforceAccount','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceAccount,\x20%s,\x20%s','message','catch','GetSalesforceAccount','SalesforceAccount','options','raw','where','attributes','limit','include'];(function(_0x569d92,_0xc6e2bf){var _0x32feab=function(_0x5274f0){while(--_0x5274f0){_0x569d92['push'](_0x569d92['shift']());}};_0x32feab(++_0xc6e2bf);}(_0x65ec,0x16c));var _0xc65e=function(_0x180687,_0x30039b){_0x180687=_0x180687-0x0;var _0x11ff1e=_0x65ec[_0x180687];return _0x11ff1e;};'use strict';var _=require(_0xc65e('0x0'));var util=require(_0xc65e('0x1'));var moment=require(_0xc65e('0x2'));var BPromise=require('bluebird');var rs=require(_0xc65e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc65e('0x4'))['db'];var utils=require(_0xc65e('0x5'));var logger=require(_0xc65e('0x6'))(_0xc65e('0x7'));var config=require(_0xc65e('0x8'));var jayson=require(_0xc65e('0x9'));var client=jayson[_0xc65e('0xa')][_0xc65e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x94f94d,_0x5dc54a,_0x19bc74){return new BPromise(function(_0x2d44db,_0x55bfb5){return client[_0xc65e('0xc')](_0x94f94d,_0x19bc74)[_0xc65e('0xd')](function(_0x1c795d){logger[_0xc65e('0xe')]('SalesforceAccount,\x20%s,\x20%s',_0x5dc54a,_0xc65e('0xf'));logger[_0xc65e('0x10')](_0xc65e('0x11'),_0x5dc54a,'request\x20sent',JSON[_0xc65e('0x12')](_0x1c795d));if(_0x1c795d['error']){if(_0x1c795d[_0xc65e('0x13')][_0xc65e('0x14')]===0x1f4){logger[_0xc65e('0x13')](_0xc65e('0x15'),_0x5dc54a,_0x1c795d['error'][_0xc65e('0x16')]);return _0x55bfb5(_0x1c795d[_0xc65e('0x13')][_0xc65e('0x16')]);}logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x5dc54a,_0x1c795d[_0xc65e('0x13')][_0xc65e('0x16')]);return _0x2d44db(_0x1c795d[_0xc65e('0x13')][_0xc65e('0x16')]);}else{logger[_0xc65e('0xe')](_0xc65e('0x15'),_0x5dc54a,'request\x20sent');_0x2d44db(_0x1c795d['result'][_0xc65e('0x16')]);}})[_0xc65e('0x17')](function(_0x713f67){logger[_0xc65e('0x13')](_0xc65e('0x15'),_0x5dc54a,_0x713f67);_0x55bfb5(_0x713f67);});});}exports[_0xc65e('0x18')]=function(_0xfbd0c9){var _0x33e311=this;return new Promise(function(_0x558ef8,_0x22b3e3){return db[_0xc65e('0x19')]['findAll']({'raw':_0xfbd0c9[_0xc65e('0x1a')]?_0xfbd0c9[_0xc65e('0x1a')][_0xc65e('0x1b')]===undefined?!![]:![]:!![],'where':_0xfbd0c9[_0xc65e('0x1a')]?_0xfbd0c9[_0xc65e('0x1a')][_0xc65e('0x1c')]||null:null,'attributes':_0xfbd0c9['options']?_0xfbd0c9[_0xc65e('0x1a')][_0xc65e('0x1d')]||null:null,'limit':_0xfbd0c9[_0xc65e('0x1a')]?_0xfbd0c9[_0xc65e('0x1a')][_0xc65e('0x1e')]||null:null,'include':_0xfbd0c9[_0xc65e('0x1a')]?_0xfbd0c9[_0xc65e('0x1a')][_0xc65e('0x1f')]?_[_0xc65e('0x20')](_0xfbd0c9[_0xc65e('0x1a')]['include'],function(_0x3dd555){return{'model':db[_0x3dd555[_0xc65e('0x21')]],'as':_0x3dd555['as'],'attributes':_0x3dd555['attributes'],'include':_0x3dd555[_0xc65e('0x1f')]?_[_0xc65e('0x20')](_0x3dd555[_0xc65e('0x1f')],function(_0x53e9c1){return{'model':db[_0x53e9c1[_0xc65e('0x21')]],'as':_0x53e9c1['as'],'attributes':_0x53e9c1['attributes'],'include':_0x53e9c1[_0xc65e('0x1f')]?_[_0xc65e('0x20')](_0x53e9c1[_0xc65e('0x1f')],function(_0x31af75){return{'model':db[_0x31af75[_0xc65e('0x21')]],'as':_0x31af75['as'],'attributes':_0x31af75[_0xc65e('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x32f1ed){logger[_0xc65e('0xe')](_0xc65e('0x18'),_0xfbd0c9);logger['debug']('GetSalesforceAccount',_0xfbd0c9,JSON[_0xc65e('0x12')](_0x32f1ed));_0x558ef8(_0x32f1ed);})['catch'](function(_0x477b9f){logger['error'](_0xc65e('0x18'),_0x477b9f[_0xc65e('0x16')],_0xfbd0c9);_0x22b3e3(_0x33e311[_0xc65e('0x13')](0x1f4,_0x477b9f['message']));});});};exports['ShowSalesforceAccount']=function(_0x378136){var _0x50524e=this;return new Promise(function(_0x351439,_0x47b861){return db[_0xc65e('0x19')][_0xc65e('0x22')]({'raw':_0x378136[_0xc65e('0x1a')]?_0x378136[_0xc65e('0x1a')][_0xc65e('0x1b')]===undefined?!![]:![]:!![],'where':_0x378136[_0xc65e('0x1a')]?_0x378136[_0xc65e('0x1a')][_0xc65e('0x1c')]||null:null,'attributes':_0x378136['options']?_0x378136[_0xc65e('0x1a')][_0xc65e('0x1d')]||null:null,'include':_0x378136[_0xc65e('0x1a')]?_0x378136[_0xc65e('0x1a')][_0xc65e('0x1f')]?_[_0xc65e('0x20')](_0x378136['options']['include'],function(_0x3d143b){return{'model':db[_0x3d143b[_0xc65e('0x21')]],'as':_0x3d143b['as'],'attributes':_0x3d143b[_0xc65e('0x1d')],'include':_0x3d143b[_0xc65e('0x1f')]?_[_0xc65e('0x20')](_0x3d143b['include'],function(_0x3b4d3f){return{'model':db[_0x3b4d3f['model']],'as':_0x3b4d3f['as'],'attributes':_0x3b4d3f['attributes'],'include':_0x3b4d3f[_0xc65e('0x1f')]?_[_0xc65e('0x20')](_0x3b4d3f[_0xc65e('0x1f')],function(_0x4cc01c){return{'model':db[_0x4cc01c[_0xc65e('0x21')]],'as':_0x4cc01c['as'],'attributes':_0x4cc01c[_0xc65e('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x31ce84){logger['info']('ShowSalesforceAccount',_0x378136);logger[_0xc65e('0x10')](_0xc65e('0x23'),_0x378136,JSON[_0xc65e('0x12')](_0x31ce84));_0x351439(_0x31ce84);})[_0xc65e('0x17')](function(_0x6ecc8c){logger['error'](_0xc65e('0x23'),_0x6ecc8c['message'],_0x378136);_0x47b861(_0x50524e['error'](0x1f4,_0x6ecc8c['message']));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index b9dd8e7..c831a67 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(_0x6d223b,_0x5b9e06){var _0x4900a3=function(_0x128d1f){while(--_0x128d1f){_0x6d223b['push'](_0x6d223b['shift']());}};_0x4900a3(++_0x5b9e06);}(_0xadb5,0xad));var _0x5adb=function(_0x15ad54,_0x38cc4f){_0x15ad54=_0x15ad54-0x0;var _0x2ee851=_0xadb5[_0x15ad54];return _0x2ee851;};'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 _0x7a54=['getSubjects','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','index','/:id','isAuthenticated','/:id/subjects'];(function(_0x5b1ad9,_0x332928){var _0x1d7037=function(_0xbbd157){while(--_0xbbd157){_0x5b1ad9['push'](_0x5b1ad9['shift']());}};_0x1d7037(++_0x332928);}(_0x7a54,0x106));var _0x47a5=function(_0x5cb641,_0x3178fd){_0x5cb641=_0x5cb641-0x0;var _0x570639=_0x7a54[_0x5cb641];return _0x570639;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0x9')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0x47a5('0x9')](_0x47a5('0xd'),auth['isAuthenticated'](),controller[_0x47a5('0xe')]);router['get']('/:id/descriptions',auth[_0x47a5('0xc')](),controller[_0x47a5('0xf')]);router[_0x47a5('0x10')]('/',auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);router[_0x47a5('0x12')](_0x47a5('0xb'),auth['isAuthenticated'](),controller[_0x47a5('0x13')]);router[_0x47a5('0x14')](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x15')]);module[_0x47a5('0x16')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 612fbde..59fec0c 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 _0x65e6=['account','nothing','STRING','Task','Case','ENUM','contact_lead','contact','lead','account_contact_lead'];(function(_0x447268,_0x1b08cd){var _0x4cbc21=function(_0x116a05){while(--_0x116a05){_0x447268['push'](_0x447268['shift']());}};_0x4cbc21(++_0x1b08cd);}(_0x65e6,0x106));var _0x665e=function(_0x4f4a1e,_0x185239){_0x4f4a1e=_0x4f4a1e-0x0;var _0x27372=_0x65e6[_0x4f4a1e];return _0x27372;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x665e('0x0')]},'description':{'type':Sequelize[_0x665e('0x0')]},'ticketType':{'type':Sequelize['ENUM'](_0x665e('0x1'),_0x665e('0x2')),'defaultValue':_0x665e('0x1')},'moduleSearch':{'type':Sequelize[_0x665e('0x3')](_0x665e('0x4'),_0x665e('0x5'),_0x665e('0x6'),_0x665e('0x7'),_0x665e('0x8')),'defaultValue':_0x665e('0x4')},'moduleCreate':{'type':Sequelize[_0x665e('0x3')](_0x665e('0x9'),'contact','lead',_0x665e('0x8')),'defaultValue':'lead'},'leadId':{'type':Sequelize[_0x665e('0x0')]},'additionalSearchAccount':{'type':Sequelize['STRING']},'additionalSearchContact':{'type':Sequelize['STRING']},'additionalSearchLead':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x94bf=['exports','STRING','ENUM','Task','Case','contact_lead','contact','lead','account'];(function(_0x3f8261,_0x41aec1){var _0x2c2682=function(_0x385407){while(--_0x385407){_0x3f8261['push'](_0x3f8261['shift']());}};_0x2c2682(++_0x41aec1);}(_0x94bf,0x1c2));var _0xf94b=function(_0x15a370,_0x2caa86){_0x15a370=_0x15a370-0x0;var _0x112d2f=_0x94bf[_0x15a370];return _0x112d2f;};'use strict';var Sequelize=require('sequelize');module[_0xf94b('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf94b('0x1')]},'ticketType':{'type':Sequelize[_0xf94b('0x2')](_0xf94b('0x3'),_0xf94b('0x4')),'defaultValue':_0xf94b('0x3')},'moduleSearch':{'type':Sequelize[_0xf94b('0x2')](_0xf94b('0x5'),_0xf94b('0x6'),_0xf94b('0x7'),'account_contact_lead',_0xf94b('0x8')),'defaultValue':_0xf94b('0x5')},'moduleCreate':{'type':Sequelize[_0xf94b('0x2')]('nothing','contact',_0xf94b('0x7'),_0xf94b('0x8')),'defaultValue':_0xf94b('0x7')},'leadId':{'type':Sequelize['STRING']},'additionalSearchAccount':{'type':Sequelize[_0xf94b('0x1')]},'additionalSearchContact':{'type':Sequelize[_0xf94b('0x1')]},'additionalSearchLead':{'type':Sequelize[_0xf94b('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index e89053f..b69670b 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 _0xa1d0=['catch','show','params','rawAttributes','length','find','create','body','getFields','findOne','SalesforceField','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','limit','set','Content-Range','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','SalesforceConfiguration','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','rows'];(function(_0x460bac,_0x1f11b1){var _0x17b493=function(_0x3dee94){while(--_0x3dee94){_0x460bac['push'](_0x460bac['shift']());}};_0x17b493(++_0x1f11b1);}(_0xa1d0,0xfa));var _0x0a1d=function(_0x3116b4,_0x220908){_0x3116b4=_0x3116b4-0x0;var _0x426c98=_0xa1d0[_0x3116b4];return _0x426c98;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0a1d('0x0'));var zipdir=require(_0x0a1d('0x1'));var jsonpatch=require(_0x0a1d('0x2'));var rp=require('request-promise');var moment=require(_0x0a1d('0x3'));var BPromise=require(_0x0a1d('0x4'));var Mustache=require(_0x0a1d('0x5'));var util=require('util');var path=require(_0x0a1d('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a1d('0x7'));var _=require(_0x0a1d('0x8'));var squel=require(_0x0a1d('0x9'));var crypto=require(_0x0a1d('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x0a1d('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a1d('0xc'));var Redis=require(_0x0a1d('0xd'));var authService=require(_0x0a1d('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x0a1d('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0a1d('0x10'))(_0x0a1d('0x11'));var utils=require(_0x0a1d('0x12'));var config=require(_0x0a1d('0x13'));var licenseUtil=require(_0x0a1d('0x14'));var db=require(_0x0a1d('0x15'))['db'];function respondWithStatusCode(_0x536d73,_0x571108){_0x571108=_0x571108||0xcc;return function(_0x39bfdd){if(_0x39bfdd){return _0x536d73['sendStatus'](_0x571108);}return _0x536d73['status'](_0x571108)[_0x0a1d('0x16')]();};}function respondWithResult(_0x1c5b16,_0x139791){_0x139791=_0x139791||0xc8;return function(_0x3b39c5){if(_0x3b39c5){return _0x1c5b16[_0x0a1d('0x17')](_0x139791)[_0x0a1d('0x18')](_0x3b39c5);}};}function respondWithFilteredResult(_0xe22f54,_0x2dec5e){return function(_0x216757){if(_0x216757){var _0x2ae755=typeof _0x2dec5e[_0x0a1d('0x19')]===_0x0a1d('0x1a')&&typeof _0x2dec5e['limit']===_0x0a1d('0x1a');var _0x376b67=_0x216757[_0x0a1d('0x1b')];var _0x3e99c4=_0x2ae755?0x0:_0x2dec5e[_0x0a1d('0x19')];var _0x409633=_0x2ae755?_0x216757['count']:_0x2dec5e[_0x0a1d('0x19')]+_0x2dec5e[_0x0a1d('0x1c')];var _0x50563a;if(_0x409633>=_0x376b67){_0x409633=_0x376b67;_0x50563a=0xc8;}else{_0x50563a=0xce;}_0xe22f54[_0x0a1d('0x17')](_0x50563a);return _0xe22f54[_0x0a1d('0x1d')](_0x0a1d('0x1e'),_0x3e99c4+'-'+_0x409633+'/'+_0x376b67)[_0x0a1d('0x18')](_0x216757);}return null;};}function patchUpdates(_0x405787){return function(_0x128f9d){try{jsonpatch['apply'](_0x128f9d,_0x405787,!![]);}catch(_0x397569){return BPromise['reject'](_0x397569);}return _0x128f9d[_0x0a1d('0x1f')]();};}function saveUpdates(_0x64d40a,_0x2477fc){return function(_0xb026f6){if(_0xb026f6){return _0xb026f6[_0x0a1d('0x20')](_0x64d40a)[_0x0a1d('0x21')](function(_0x5a78b4){return _0x5a78b4;});}return null;};}function removeEntity(_0x4ad82c,_0x3dd2e4){return function(_0x4c7487){if(_0x4c7487){return _0x4c7487[_0x0a1d('0x22')]()[_0x0a1d('0x21')](function(){_0x4ad82c[_0x0a1d('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5dc265,_0x3f81a7){return function(_0x21bfbb){if(!_0x21bfbb){_0x5dc265[_0x0a1d('0x23')](0x194);}return _0x21bfbb;};}function handleError(_0xfd2a6a,_0x19ad63){_0x19ad63=_0x19ad63||0x1f4;return function(_0x7565eb){logger[_0x0a1d('0x24')](_0x7565eb[_0x0a1d('0x25')]);if(_0x7565eb[_0x0a1d('0x26')]){delete _0x7565eb[_0x0a1d('0x26')];}_0xfd2a6a[_0x0a1d('0x17')](_0x19ad63)[_0x0a1d('0x27')](_0x7565eb);};}exports[_0x0a1d('0x28')]=function(_0x7535a7,_0x314a64){var _0x54289f={},_0x287dca={},_0x1d7f01={'count':0x0,'rows':[]};var _0x2f59ff=_[_0x0a1d('0x29')](db[_0x0a1d('0x2a')]['rawAttributes'],function(_0x27b1e6){return{'name':_0x27b1e6[_0x0a1d('0x2b')],'type':_0x27b1e6[_0x0a1d('0x2c')][_0x0a1d('0x2d')]};});_0x287dca[_0x0a1d('0x2e')]=_[_0x0a1d('0x29')](_0x2f59ff,_0x0a1d('0x26'));_0x287dca[_0x0a1d('0x2f')]=_[_0x0a1d('0x30')](_0x7535a7[_0x0a1d('0x2f')]);_0x287dca['filters']=_[_0x0a1d('0x31')](_0x287dca[_0x0a1d('0x2e')],_0x287dca[_0x0a1d('0x2f')]);_0x54289f[_0x0a1d('0x32')]=_[_0x0a1d('0x31')](_0x287dca[_0x0a1d('0x2e')],qs['fields'](_0x7535a7[_0x0a1d('0x2f')][_0x0a1d('0x33')]));_0x54289f[_0x0a1d('0x32')]=_0x54289f[_0x0a1d('0x32')]['length']?_0x54289f[_0x0a1d('0x32')]:_0x287dca[_0x0a1d('0x2e')];if(!_0x7535a7[_0x0a1d('0x2f')][_0x0a1d('0x34')](_0x0a1d('0x35'))){_0x54289f['limit']=qs['limit'](_0x7535a7[_0x0a1d('0x2f')][_0x0a1d('0x1c')]);_0x54289f['offset']=qs[_0x0a1d('0x19')](_0x7535a7[_0x0a1d('0x2f')]['offset']);}_0x54289f[_0x0a1d('0x36')]=qs[_0x0a1d('0x37')](_0x7535a7[_0x0a1d('0x2f')][_0x0a1d('0x37')]);_0x54289f[_0x0a1d('0x38')]=qs[_0x0a1d('0x39')](_[_0x0a1d('0x3a')](_0x7535a7[_0x0a1d('0x2f')],_0x287dca[_0x0a1d('0x39')]),_0x2f59ff);if(_0x7535a7[_0x0a1d('0x2f')][_0x0a1d('0x3b')]){_0x54289f[_0x0a1d('0x38')]=_[_0x0a1d('0x3c')](_0x54289f['where'],{'$or':_[_0x0a1d('0x29')](_0x2f59ff,function(_0x2115ce){if(_0x2115ce[_0x0a1d('0x2c')]!==_0x0a1d('0x3d')){var _0x1e1e73={};_0x1e1e73[_0x2115ce[_0x0a1d('0x26')]]={'$like':'%'+_0x7535a7['query'][_0x0a1d('0x3b')]+'%'};return _0x1e1e73;}})});}_0x54289f=_[_0x0a1d('0x3c')]({},_0x54289f,_0x7535a7[_0x0a1d('0x3e')]);var _0x2f33fa={'where':_0x54289f[_0x0a1d('0x38')]};return db[_0x0a1d('0x2a')][_0x0a1d('0x1b')](_0x2f33fa)[_0x0a1d('0x21')](function(_0x504def){_0x1d7f01[_0x0a1d('0x1b')]=_0x504def;if(_0x7535a7[_0x0a1d('0x2f')][_0x0a1d('0x3f')]){_0x54289f[_0x0a1d('0x40')]=[{'all':!![]}];}return db['SalesforceConfiguration']['findAll'](_0x54289f);})[_0x0a1d('0x21')](function(_0x1676af){_0x1d7f01[_0x0a1d('0x41')]=_0x1676af;return _0x1d7f01;})['then'](respondWithFilteredResult(_0x314a64,_0x54289f))[_0x0a1d('0x42')](handleError(_0x314a64,null));};exports[_0x0a1d('0x43')]=function(_0x344786,_0x312d48){var _0x5b3983={'raw':![],'where':{'id':_0x344786[_0x0a1d('0x44')]['id']}},_0x1fbf6f={};_0x1fbf6f['model']=_[_0x0a1d('0x30')](db['SalesforceConfiguration'][_0x0a1d('0x45')]);_0x1fbf6f['query']=_['keys'](_0x344786[_0x0a1d('0x2f')]);_0x1fbf6f[_0x0a1d('0x39')]=_['intersection'](_0x1fbf6f['model'],_0x1fbf6f[_0x0a1d('0x2f')]);_0x5b3983[_0x0a1d('0x32')]=_['intersection'](_0x1fbf6f[_0x0a1d('0x2e')],qs[_0x0a1d('0x33')](_0x344786[_0x0a1d('0x2f')]['fields']));_0x5b3983[_0x0a1d('0x32')]=_0x5b3983[_0x0a1d('0x32')][_0x0a1d('0x46')]?_0x5b3983[_0x0a1d('0x32')]:_0x1fbf6f[_0x0a1d('0x2e')];if(_0x344786['query'][_0x0a1d('0x3f')]){_0x5b3983[_0x0a1d('0x40')]=[{'all':!![]}];}_0x5b3983=_['merge']({},_0x5b3983,_0x344786[_0x0a1d('0x3e')]);return db['SalesforceConfiguration'][_0x0a1d('0x47')](_0x5b3983)[_0x0a1d('0x21')](handleEntityNotFound(_0x312d48,null))[_0x0a1d('0x21')](respondWithResult(_0x312d48,null))['catch'](handleError(_0x312d48,null));};exports[_0x0a1d('0x48')]=function(_0x366199,_0x2e2ef3){return db['SalesforceConfiguration']['create'](_0x366199['body'],{})[_0x0a1d('0x21')](respondWithResult(_0x2e2ef3,0xc9))[_0x0a1d('0x42')](handleError(_0x2e2ef3,null));};exports['update']=function(_0xda34c7,_0x6c3aef){if(_0xda34c7[_0x0a1d('0x49')]['id']){delete _0xda34c7[_0x0a1d('0x49')]['id'];}return db['SalesforceConfiguration'][_0x0a1d('0x47')]({'where':{'id':_0xda34c7[_0x0a1d('0x44')]['id']}})[_0x0a1d('0x21')](handleEntityNotFound(_0x6c3aef,null))['then'](saveUpdates(_0xda34c7[_0x0a1d('0x49')],null))[_0x0a1d('0x21')](respondWithResult(_0x6c3aef,null))[_0x0a1d('0x42')](handleError(_0x6c3aef,null));};exports[_0x0a1d('0x22')]=function(_0x281e6d,_0x13524a){return db['SalesforceConfiguration'][_0x0a1d('0x47')]({'where':{'id':_0x281e6d[_0x0a1d('0x44')]['id']}})['then'](handleEntityNotFound(_0x13524a,null))[_0x0a1d('0x21')](removeEntity(_0x13524a,null))[_0x0a1d('0x42')](handleError(_0x13524a,null));};exports[_0x0a1d('0x4a')]=function(_0x488e4e,_0x1b2287,_0x57b06e){var _0x366803={};var _0xd06456={};var _0x243d0d;var _0x90afd7;return db['SalesforceConfiguration'][_0x0a1d('0x4b')]({'where':{'id':_0x488e4e['params']['id']}})[_0x0a1d('0x21')](handleEntityNotFound(_0x1b2287,null))[_0x0a1d('0x21')](function(_0x1079db){if(_0x1079db){_0x243d0d=_0x1079db;_0xd06456['model']=_['keys'](db[_0x0a1d('0x4c')][_0x0a1d('0x45')]);_0xd06456[_0x0a1d('0x2f')]=_['keys'](_0x488e4e[_0x0a1d('0x2f')]);_0xd06456[_0x0a1d('0x39')]=_[_0x0a1d('0x31')](_0xd06456[_0x0a1d('0x2e')],_0xd06456[_0x0a1d('0x2f')]);_0x366803[_0x0a1d('0x32')]=_['intersection'](_0xd06456[_0x0a1d('0x2e')],qs[_0x0a1d('0x33')](_0x488e4e[_0x0a1d('0x2f')][_0x0a1d('0x33')]));_0x366803[_0x0a1d('0x32')]=_0x366803[_0x0a1d('0x32')][_0x0a1d('0x46')]?_0x366803[_0x0a1d('0x32')]:_0xd06456[_0x0a1d('0x2e')];_0x366803['order']=qs[_0x0a1d('0x37')](_0x488e4e[_0x0a1d('0x2f')][_0x0a1d('0x37')]);_0x366803[_0x0a1d('0x38')]=qs[_0x0a1d('0x39')](_[_0x0a1d('0x3a')](_0x488e4e[_0x0a1d('0x2f')],_0xd06456[_0x0a1d('0x39')]));if(_0x488e4e['query'][_0x0a1d('0x3b')]){_0x366803[_0x0a1d('0x38')]=_['merge'](_0x366803[_0x0a1d('0x38')],{'$or':_[_0x0a1d('0x29')](_0x366803['attributes'],function(_0x2905ba){var _0x2ffeec={};_0x2ffeec[_0x2905ba]={'$like':'%'+_0x488e4e[_0x0a1d('0x2f')][_0x0a1d('0x3b')]+'%'};return _0x2ffeec;})});}_0x366803=_[_0x0a1d('0x3c')]({},_0x366803,_0x488e4e[_0x0a1d('0x3e')]);return _0x243d0d[_0x0a1d('0x4a')](_0x366803);}})[_0x0a1d('0x21')](function(_0x5c47b0){if(_0x5c47b0){_0x90afd7=_0x5c47b0[_0x0a1d('0x46')];if(!_0x488e4e[_0x0a1d('0x2f')][_0x0a1d('0x34')](_0x0a1d('0x35'))){_0x366803[_0x0a1d('0x1c')]=qs[_0x0a1d('0x1c')](_0x488e4e[_0x0a1d('0x2f')][_0x0a1d('0x1c')]);_0x366803['offset']=qs[_0x0a1d('0x19')](_0x488e4e[_0x0a1d('0x2f')][_0x0a1d('0x19')]);}return _0x243d0d[_0x0a1d('0x4a')](_0x366803);}})['then'](function(_0x59d128){if(_0x59d128){return _0x59d128?{'count':_0x90afd7,'rows':_0x59d128}:null;}})[_0x0a1d('0x21')](respondWithResult(_0x1b2287,null))['catch'](handleError(_0x1b2287,null));};exports[_0x0a1d('0x4d')]=function(_0x2ef30b,_0x4a76be,_0x2f88f0){var _0x251373={};var _0x77195f={};var _0x23fec6;var _0x438a61;return db[_0x0a1d('0x2a')][_0x0a1d('0x4b')]({'where':{'id':_0x2ef30b['params']['id']}})['then'](handleEntityNotFound(_0x4a76be,null))[_0x0a1d('0x21')](function(_0x3c1288){if(_0x3c1288){_0x23fec6=_0x3c1288;_0x77195f[_0x0a1d('0x2e')]=_[_0x0a1d('0x30')](db['SalesforceField'][_0x0a1d('0x45')]);_0x77195f[_0x0a1d('0x2f')]=_[_0x0a1d('0x30')](_0x2ef30b['query']);_0x77195f['filters']=_[_0x0a1d('0x31')](_0x77195f[_0x0a1d('0x2e')],_0x77195f[_0x0a1d('0x2f')]);_0x251373[_0x0a1d('0x32')]=_[_0x0a1d('0x31')](_0x77195f[_0x0a1d('0x2e')],qs[_0x0a1d('0x33')](_0x2ef30b[_0x0a1d('0x2f')][_0x0a1d('0x33')]));_0x251373['attributes']=_0x251373[_0x0a1d('0x32')]['length']?_0x251373[_0x0a1d('0x32')]:_0x77195f[_0x0a1d('0x2e')];_0x251373[_0x0a1d('0x36')]=qs[_0x0a1d('0x37')](_0x2ef30b[_0x0a1d('0x2f')][_0x0a1d('0x37')]);_0x251373[_0x0a1d('0x38')]=qs[_0x0a1d('0x39')](_['pick'](_0x2ef30b['query'],_0x77195f[_0x0a1d('0x39')]));if(_0x2ef30b[_0x0a1d('0x2f')][_0x0a1d('0x3b')]){_0x251373['where']=_[_0x0a1d('0x3c')](_0x251373[_0x0a1d('0x38')],{'$or':_[_0x0a1d('0x29')](_0x251373[_0x0a1d('0x32')],function(_0x5e4ae6){var _0x21fe14={};_0x21fe14[_0x5e4ae6]={'$like':'%'+_0x2ef30b[_0x0a1d('0x2f')][_0x0a1d('0x3b')]+'%'};return _0x21fe14;})});}_0x251373=_['merge']({},_0x251373,_0x2ef30b['options']);return _0x23fec6[_0x0a1d('0x4d')](_0x251373);}})['then'](function(_0x501e68){if(_0x501e68){_0x438a61=_0x501e68[_0x0a1d('0x46')];if(!_0x2ef30b[_0x0a1d('0x2f')][_0x0a1d('0x34')](_0x0a1d('0x35'))){_0x251373[_0x0a1d('0x1c')]=qs['limit'](_0x2ef30b[_0x0a1d('0x2f')]['limit']);_0x251373[_0x0a1d('0x19')]=qs['offset'](_0x2ef30b[_0x0a1d('0x2f')][_0x0a1d('0x19')]);}return _0x23fec6[_0x0a1d('0x4d')](_0x251373);}})[_0x0a1d('0x21')](function(_0x51d4d5){if(_0x51d4d5){return _0x51d4d5?{'count':_0x438a61,'rows':_0x51d4d5}:null;}})[_0x0a1d('0x21')](respondWithResult(_0x4a76be,null))[_0x0a1d('0x42')](handleError(_0x4a76be,null));};exports[_0x0a1d('0x4e')]=function(_0x25b587,_0x305123,_0x377287){var _0x57c21b={};var _0x1021ee={};var _0xe1a0cd;var _0x14fa41;return db[_0x0a1d('0x2a')][_0x0a1d('0x4b')]({'where':{'id':_0x25b587[_0x0a1d('0x44')]['id']}})['then'](handleEntityNotFound(_0x305123,null))[_0x0a1d('0x21')](function(_0x30e6b5){if(_0x30e6b5){_0xe1a0cd=_0x30e6b5;_0x1021ee['model']=_['keys'](db[_0x0a1d('0x4c')][_0x0a1d('0x45')]);_0x1021ee['query']=_['keys'](_0x25b587[_0x0a1d('0x2f')]);_0x1021ee[_0x0a1d('0x39')]=_[_0x0a1d('0x31')](_0x1021ee[_0x0a1d('0x2e')],_0x1021ee[_0x0a1d('0x2f')]);_0x57c21b[_0x0a1d('0x32')]=_[_0x0a1d('0x31')](_0x1021ee[_0x0a1d('0x2e')],qs[_0x0a1d('0x33')](_0x25b587['query'][_0x0a1d('0x33')]));_0x57c21b[_0x0a1d('0x32')]=_0x57c21b[_0x0a1d('0x32')][_0x0a1d('0x46')]?_0x57c21b[_0x0a1d('0x32')]:_0x1021ee[_0x0a1d('0x2e')];_0x57c21b[_0x0a1d('0x36')]=qs[_0x0a1d('0x37')](_0x25b587[_0x0a1d('0x2f')][_0x0a1d('0x37')]);_0x57c21b[_0x0a1d('0x38')]=qs[_0x0a1d('0x39')](_[_0x0a1d('0x3a')](_0x25b587[_0x0a1d('0x2f')],_0x1021ee['filters']));if(_0x25b587[_0x0a1d('0x2f')][_0x0a1d('0x3b')]){_0x57c21b['where']=_[_0x0a1d('0x3c')](_0x57c21b[_0x0a1d('0x38')],{'$or':_[_0x0a1d('0x29')](_0x57c21b['attributes'],function(_0x31a920){var _0x56dafa={};_0x56dafa[_0x31a920]={'$like':'%'+_0x25b587[_0x0a1d('0x2f')][_0x0a1d('0x3b')]+'%'};return _0x56dafa;})});}_0x57c21b=_['merge']({},_0x57c21b,_0x25b587[_0x0a1d('0x3e')]);return _0xe1a0cd[_0x0a1d('0x4e')](_0x57c21b);}})[_0x0a1d('0x21')](function(_0x4cd939){if(_0x4cd939){_0x14fa41=_0x4cd939[_0x0a1d('0x46')];if(!_0x25b587[_0x0a1d('0x2f')][_0x0a1d('0x34')](_0x0a1d('0x35'))){_0x57c21b['limit']=qs[_0x0a1d('0x1c')](_0x25b587[_0x0a1d('0x2f')][_0x0a1d('0x1c')]);_0x57c21b[_0x0a1d('0x19')]=qs[_0x0a1d('0x19')](_0x25b587[_0x0a1d('0x2f')]['offset']);}return _0xe1a0cd[_0x0a1d('0x4e')](_0x57c21b);}})[_0x0a1d('0x21')](function(_0x334d77){if(_0x334d77){return _0x334d77?{'count':_0x14fa41,'rows':_0x334d77}:null;}})[_0x0a1d('0x21')](respondWithResult(_0x305123,null))[_0x0a1d('0x42')](handleError(_0x305123,null));}; \ No newline at end of file +var _0xf46d=['sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','end','error','stack','name','send','index','map','SalesforceConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','params','options','find','catch','create','body','destroy','getFields','findOne','SalesforceField','getSubjects','getDescriptions','rimraf','fast-json-patch','request-promise','mustache','util'];(function(_0x13063d,_0x2508c7){var _0x2295a7=function(_0xaa623e){while(--_0xaa623e){_0x13063d['push'](_0x13063d['shift']());}};_0x2295a7(++_0x2508c7);}(_0xf46d,0x1c3));var _0xdf46=function(_0x5cb97e,_0x132a39){_0x5cb97e=_0x5cb97e-0x0;var _0x1714b4=_0xf46d[_0x5cb97e];return _0x1714b4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdf46('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdf46('0x1'));var rp=require(_0xdf46('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xdf46('0x3'));var util=require(_0xdf46('0x4'));var path=require('path');var sox=require(_0xdf46('0x5'));var csv=require(_0xdf46('0x6'));var ejs=require(_0xdf46('0x7'));var fs=require('fs');var fs_extra=require(_0xdf46('0x8'));var _=require('lodash');var squel=require(_0xdf46('0x9'));var crypto=require(_0xdf46('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xdf46('0xb'));var toCsv=require(_0xdf46('0x6'));var querystring=require(_0xdf46('0xc'));var Papa=require('papaparse');var Redis=require(_0xdf46('0xd'));var authService=require(_0xdf46('0xe'));var qs=require(_0xdf46('0xf'));var as=require(_0xdf46('0x10'));var hardwareService=require(_0xdf46('0x11'));var logger=require(_0xdf46('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xdf46('0x13'))['db'];function respondWithStatusCode(_0x4cdf43,_0x5e5a67){_0x5e5a67=_0x5e5a67||0xcc;return function(_0x37df88){if(_0x37df88){return _0x4cdf43[_0xdf46('0x14')](_0x5e5a67);}return _0x4cdf43[_0xdf46('0x15')](_0x5e5a67)['end']();};}function respondWithResult(_0x928b0f,_0x535cb7){_0x535cb7=_0x535cb7||0xc8;return function(_0x3389f8){if(_0x3389f8){return _0x928b0f[_0xdf46('0x15')](_0x535cb7)[_0xdf46('0x16')](_0x3389f8);}};}function respondWithFilteredResult(_0x534b32,_0x3c4586){return function(_0x150e58){if(_0x150e58){var _0x597be0=typeof _0x3c4586[_0xdf46('0x17')]===_0xdf46('0x18')&&typeof _0x3c4586[_0xdf46('0x19')]===_0xdf46('0x18');var _0x53c887=_0x150e58[_0xdf46('0x1a')];var _0x6a9120=_0x597be0?0x0:_0x3c4586['offset'];var _0x2d5838=_0x597be0?_0x150e58[_0xdf46('0x1a')]:_0x3c4586[_0xdf46('0x17')]+_0x3c4586[_0xdf46('0x19')];var _0x36e62c;if(_0x2d5838>=_0x53c887){_0x2d5838=_0x53c887;_0x36e62c=0xc8;}else{_0x36e62c=0xce;}_0x534b32[_0xdf46('0x15')](_0x36e62c);return _0x534b32[_0xdf46('0x1b')](_0xdf46('0x1c'),_0x6a9120+'-'+_0x2d5838+'/'+_0x53c887)[_0xdf46('0x16')](_0x150e58);}return null;};}function patchUpdates(_0x5f08c6){return function(_0x11cb42){try{jsonpatch['apply'](_0x11cb42,_0x5f08c6,!![]);}catch(_0x7ae7d9){return BPromise[_0xdf46('0x1d')](_0x7ae7d9);}return _0x11cb42['save']();};}function saveUpdates(_0x12a175,_0x483e86){return function(_0x3fb580){if(_0x3fb580){return _0x3fb580[_0xdf46('0x1e')](_0x12a175)[_0xdf46('0x1f')](function(_0x1d8d65){return _0x1d8d65;});}return null;};}function removeEntity(_0x21199f,_0x22f825){return function(_0x1ab63f){if(_0x1ab63f){return _0x1ab63f['destroy']()[_0xdf46('0x1f')](function(){_0x21199f[_0xdf46('0x15')](0xcc)[_0xdf46('0x20')]();});}};}function handleEntityNotFound(_0x2f634f,_0x5c3df1){return function(_0x5b4bf1){if(!_0x5b4bf1){_0x2f634f[_0xdf46('0x14')](0x194);}return _0x5b4bf1;};}function handleError(_0x61bf96,_0x48b454){_0x48b454=_0x48b454||0x1f4;return function(_0x3b38c9){logger[_0xdf46('0x21')](_0x3b38c9[_0xdf46('0x22')]);if(_0x3b38c9[_0xdf46('0x23')]){delete _0x3b38c9['name'];}_0x61bf96['status'](_0x48b454)[_0xdf46('0x24')](_0x3b38c9);};}exports[_0xdf46('0x25')]=function(_0x39a62a,_0x3dd8c7){var _0x1c3eec={},_0xd77fe3={},_0x356c92={'count':0x0,'rows':[]};var _0x86d904=_[_0xdf46('0x26')](db[_0xdf46('0x27')][_0xdf46('0x28')],function(_0xd24a05){return{'name':_0xd24a05[_0xdf46('0x29')],'type':_0xd24a05[_0xdf46('0x2a')][_0xdf46('0x2b')]};});_0xd77fe3[_0xdf46('0x2c')]=_[_0xdf46('0x26')](_0x86d904,'name');_0xd77fe3[_0xdf46('0x2d')]=_[_0xdf46('0x2e')](_0x39a62a['query']);_0xd77fe3[_0xdf46('0x2f')]=_[_0xdf46('0x30')](_0xd77fe3['model'],_0xd77fe3['query']);_0x1c3eec[_0xdf46('0x31')]=_[_0xdf46('0x30')](_0xd77fe3[_0xdf46('0x2c')],qs[_0xdf46('0x32')](_0x39a62a[_0xdf46('0x2d')][_0xdf46('0x32')]));_0x1c3eec[_0xdf46('0x31')]=_0x1c3eec[_0xdf46('0x31')][_0xdf46('0x33')]?_0x1c3eec['attributes']:_0xd77fe3[_0xdf46('0x2c')];if(!_0x39a62a[_0xdf46('0x2d')][_0xdf46('0x34')](_0xdf46('0x35'))){_0x1c3eec[_0xdf46('0x19')]=qs[_0xdf46('0x19')](_0x39a62a[_0xdf46('0x2d')][_0xdf46('0x19')]);_0x1c3eec[_0xdf46('0x17')]=qs['offset'](_0x39a62a[_0xdf46('0x2d')][_0xdf46('0x17')]);}_0x1c3eec[_0xdf46('0x36')]=qs[_0xdf46('0x37')](_0x39a62a[_0xdf46('0x2d')][_0xdf46('0x37')]);_0x1c3eec[_0xdf46('0x38')]=qs['filters'](_[_0xdf46('0x39')](_0x39a62a[_0xdf46('0x2d')],_0xd77fe3[_0xdf46('0x2f')]),_0x86d904);if(_0x39a62a[_0xdf46('0x2d')][_0xdf46('0x3a')]){_0x1c3eec[_0xdf46('0x38')]=_[_0xdf46('0x3b')](_0x1c3eec['where'],{'$or':_[_0xdf46('0x26')](_0x86d904,function(_0x9d2e6f){if(_0x9d2e6f['type']!==_0xdf46('0x3c')){var _0x47bc01={};_0x47bc01[_0x9d2e6f[_0xdf46('0x23')]]={'$like':'%'+_0x39a62a[_0xdf46('0x2d')]['filter']+'%'};return _0x47bc01;}})});}_0x1c3eec=_[_0xdf46('0x3b')]({},_0x1c3eec,_0x39a62a['options']);var _0x169f4d={'where':_0x1c3eec[_0xdf46('0x38')]};return db['SalesforceConfiguration'][_0xdf46('0x1a')](_0x169f4d)['then'](function(_0x44bc9f){_0x356c92[_0xdf46('0x1a')]=_0x44bc9f;if(_0x39a62a[_0xdf46('0x2d')][_0xdf46('0x3d')]){_0x1c3eec[_0xdf46('0x3e')]=[{'all':!![]}];}return db[_0xdf46('0x27')]['findAll'](_0x1c3eec);})['then'](function(_0x3f4c7a){_0x356c92[_0xdf46('0x3f')]=_0x3f4c7a;return _0x356c92;})[_0xdf46('0x1f')](respondWithFilteredResult(_0x3dd8c7,_0x1c3eec))['catch'](handleError(_0x3dd8c7,null));};exports['show']=function(_0x62c1fd,_0x48a4eb){var _0x299bec={'raw':![],'where':{'id':_0x62c1fd[_0xdf46('0x40')]['id']}},_0x1664f0={};_0x1664f0[_0xdf46('0x2c')]=_['keys'](db['SalesforceConfiguration'][_0xdf46('0x28')]);_0x1664f0[_0xdf46('0x2d')]=_[_0xdf46('0x2e')](_0x62c1fd[_0xdf46('0x2d')]);_0x1664f0[_0xdf46('0x2f')]=_[_0xdf46('0x30')](_0x1664f0[_0xdf46('0x2c')],_0x1664f0[_0xdf46('0x2d')]);_0x299bec[_0xdf46('0x31')]=_[_0xdf46('0x30')](_0x1664f0[_0xdf46('0x2c')],qs['fields'](_0x62c1fd['query']['fields']));_0x299bec[_0xdf46('0x31')]=_0x299bec[_0xdf46('0x31')][_0xdf46('0x33')]?_0x299bec[_0xdf46('0x31')]:_0x1664f0[_0xdf46('0x2c')];if(_0x62c1fd[_0xdf46('0x2d')][_0xdf46('0x3d')]){_0x299bec[_0xdf46('0x3e')]=[{'all':!![]}];}_0x299bec=_[_0xdf46('0x3b')]({},_0x299bec,_0x62c1fd[_0xdf46('0x41')]);return db[_0xdf46('0x27')][_0xdf46('0x42')](_0x299bec)['then'](handleEntityNotFound(_0x48a4eb,null))[_0xdf46('0x1f')](respondWithResult(_0x48a4eb,null))[_0xdf46('0x43')](handleError(_0x48a4eb,null));};exports[_0xdf46('0x44')]=function(_0x5d472b,_0xda4369){return db[_0xdf46('0x27')][_0xdf46('0x44')](_0x5d472b['body'],{})[_0xdf46('0x1f')](respondWithResult(_0xda4369,0xc9))[_0xdf46('0x43')](handleError(_0xda4369,null));};exports['update']=function(_0xd2e819,_0x563cc6){if(_0xd2e819['body']['id']){delete _0xd2e819[_0xdf46('0x45')]['id'];}return db[_0xdf46('0x27')][_0xdf46('0x42')]({'where':{'id':_0xd2e819['params']['id']}})[_0xdf46('0x1f')](handleEntityNotFound(_0x563cc6,null))['then'](saveUpdates(_0xd2e819['body'],null))[_0xdf46('0x1f')](respondWithResult(_0x563cc6,null))[_0xdf46('0x43')](handleError(_0x563cc6,null));};exports[_0xdf46('0x46')]=function(_0x2d35d2,_0x413a10){return db[_0xdf46('0x27')][_0xdf46('0x42')]({'where':{'id':_0x2d35d2['params']['id']}})[_0xdf46('0x1f')](handleEntityNotFound(_0x413a10,null))[_0xdf46('0x1f')](removeEntity(_0x413a10,null))[_0xdf46('0x43')](handleError(_0x413a10,null));};exports[_0xdf46('0x47')]=function(_0x2af6f4,_0x42f7b6,_0x5ab36d){var _0x4eaf85={};var _0x69a875={};var _0x20a370;var _0x38cc77;return db[_0xdf46('0x27')][_0xdf46('0x48')]({'where':{'id':_0x2af6f4[_0xdf46('0x40')]['id']}})[_0xdf46('0x1f')](handleEntityNotFound(_0x42f7b6,null))[_0xdf46('0x1f')](function(_0x485203){if(_0x485203){_0x20a370=_0x485203;_0x69a875[_0xdf46('0x2c')]=_[_0xdf46('0x2e')](db[_0xdf46('0x49')]['rawAttributes']);_0x69a875['query']=_['keys'](_0x2af6f4[_0xdf46('0x2d')]);_0x69a875['filters']=_[_0xdf46('0x30')](_0x69a875[_0xdf46('0x2c')],_0x69a875['query']);_0x4eaf85[_0xdf46('0x31')]=_['intersection'](_0x69a875['model'],qs['fields'](_0x2af6f4[_0xdf46('0x2d')][_0xdf46('0x32')]));_0x4eaf85[_0xdf46('0x31')]=_0x4eaf85[_0xdf46('0x31')][_0xdf46('0x33')]?_0x4eaf85[_0xdf46('0x31')]:_0x69a875[_0xdf46('0x2c')];_0x4eaf85['order']=qs[_0xdf46('0x37')](_0x2af6f4[_0xdf46('0x2d')][_0xdf46('0x37')]);_0x4eaf85[_0xdf46('0x38')]=qs[_0xdf46('0x2f')](_['pick'](_0x2af6f4[_0xdf46('0x2d')],_0x69a875[_0xdf46('0x2f')]));if(_0x2af6f4[_0xdf46('0x2d')][_0xdf46('0x3a')]){_0x4eaf85[_0xdf46('0x38')]=_[_0xdf46('0x3b')](_0x4eaf85[_0xdf46('0x38')],{'$or':_[_0xdf46('0x26')](_0x4eaf85[_0xdf46('0x31')],function(_0x224d89){var _0x473195={};_0x473195[_0x224d89]={'$like':'%'+_0x2af6f4[_0xdf46('0x2d')][_0xdf46('0x3a')]+'%'};return _0x473195;})});}_0x4eaf85=_['merge']({},_0x4eaf85,_0x2af6f4['options']);return _0x20a370[_0xdf46('0x47')](_0x4eaf85);}})[_0xdf46('0x1f')](function(_0x457c87){if(_0x457c87){_0x38cc77=_0x457c87[_0xdf46('0x33')];if(!_0x2af6f4[_0xdf46('0x2d')]['hasOwnProperty'](_0xdf46('0x35'))){_0x4eaf85['limit']=qs[_0xdf46('0x19')](_0x2af6f4['query'][_0xdf46('0x19')]);_0x4eaf85['offset']=qs[_0xdf46('0x17')](_0x2af6f4[_0xdf46('0x2d')][_0xdf46('0x17')]);}return _0x20a370[_0xdf46('0x47')](_0x4eaf85);}})['then'](function(_0x32743b){if(_0x32743b){return _0x32743b?{'count':_0x38cc77,'rows':_0x32743b}:null;}})[_0xdf46('0x1f')](respondWithResult(_0x42f7b6,null))['catch'](handleError(_0x42f7b6,null));};exports[_0xdf46('0x4a')]=function(_0x1fe5d9,_0x1c7ec3,_0x1f2f2f){var _0x381db7={};var _0x4c2633={};var _0x53052d;var _0x230191;return db[_0xdf46('0x27')][_0xdf46('0x48')]({'where':{'id':_0x1fe5d9['params']['id']}})[_0xdf46('0x1f')](handleEntityNotFound(_0x1c7ec3,null))[_0xdf46('0x1f')](function(_0x1ce52a){if(_0x1ce52a){_0x53052d=_0x1ce52a;_0x4c2633[_0xdf46('0x2c')]=_[_0xdf46('0x2e')](db[_0xdf46('0x49')][_0xdf46('0x28')]);_0x4c2633['query']=_[_0xdf46('0x2e')](_0x1fe5d9['query']);_0x4c2633[_0xdf46('0x2f')]=_[_0xdf46('0x30')](_0x4c2633[_0xdf46('0x2c')],_0x4c2633[_0xdf46('0x2d')]);_0x381db7[_0xdf46('0x31')]=_['intersection'](_0x4c2633[_0xdf46('0x2c')],qs[_0xdf46('0x32')](_0x1fe5d9[_0xdf46('0x2d')][_0xdf46('0x32')]));_0x381db7[_0xdf46('0x31')]=_0x381db7[_0xdf46('0x31')]['length']?_0x381db7[_0xdf46('0x31')]:_0x4c2633['model'];_0x381db7[_0xdf46('0x36')]=qs[_0xdf46('0x37')](_0x1fe5d9[_0xdf46('0x2d')][_0xdf46('0x37')]);_0x381db7[_0xdf46('0x38')]=qs[_0xdf46('0x2f')](_['pick'](_0x1fe5d9[_0xdf46('0x2d')],_0x4c2633['filters']));if(_0x1fe5d9['query']['filter']){_0x381db7['where']=_[_0xdf46('0x3b')](_0x381db7[_0xdf46('0x38')],{'$or':_[_0xdf46('0x26')](_0x381db7[_0xdf46('0x31')],function(_0x503b23){var _0x4f916f={};_0x4f916f[_0x503b23]={'$like':'%'+_0x1fe5d9[_0xdf46('0x2d')][_0xdf46('0x3a')]+'%'};return _0x4f916f;})});}_0x381db7=_[_0xdf46('0x3b')]({},_0x381db7,_0x1fe5d9[_0xdf46('0x41')]);return _0x53052d[_0xdf46('0x4a')](_0x381db7);}})[_0xdf46('0x1f')](function(_0x3e1439){if(_0x3e1439){_0x230191=_0x3e1439['length'];if(!_0x1fe5d9[_0xdf46('0x2d')][_0xdf46('0x34')](_0xdf46('0x35'))){_0x381db7[_0xdf46('0x19')]=qs[_0xdf46('0x19')](_0x1fe5d9[_0xdf46('0x2d')][_0xdf46('0x19')]);_0x381db7['offset']=qs['offset'](_0x1fe5d9[_0xdf46('0x2d')][_0xdf46('0x17')]);}return _0x53052d[_0xdf46('0x4a')](_0x381db7);}})[_0xdf46('0x1f')](function(_0xe3ab59){if(_0xe3ab59){return _0xe3ab59?{'count':_0x230191,'rows':_0xe3ab59}:null;}})[_0xdf46('0x1f')](respondWithResult(_0x1c7ec3,null))[_0xdf46('0x43')](handleError(_0x1c7ec3,null));};exports[_0xdf46('0x4b')]=function(_0x52945c,_0x3bd55b,_0x4d8d8d){var _0xa41995={};var _0x3873a8={};var _0x39dd33;var _0x6dcaf5;return db['SalesforceConfiguration'][_0xdf46('0x48')]({'where':{'id':_0x52945c['params']['id']}})[_0xdf46('0x1f')](handleEntityNotFound(_0x3bd55b,null))[_0xdf46('0x1f')](function(_0x28f2c8){if(_0x28f2c8){_0x39dd33=_0x28f2c8;_0x3873a8[_0xdf46('0x2c')]=_[_0xdf46('0x2e')](db[_0xdf46('0x49')]['rawAttributes']);_0x3873a8['query']=_[_0xdf46('0x2e')](_0x52945c['query']);_0x3873a8[_0xdf46('0x2f')]=_[_0xdf46('0x30')](_0x3873a8[_0xdf46('0x2c')],_0x3873a8['query']);_0xa41995[_0xdf46('0x31')]=_[_0xdf46('0x30')](_0x3873a8['model'],qs[_0xdf46('0x32')](_0x52945c[_0xdf46('0x2d')]['fields']));_0xa41995[_0xdf46('0x31')]=_0xa41995[_0xdf46('0x31')]['length']?_0xa41995['attributes']:_0x3873a8['model'];_0xa41995['order']=qs['sort'](_0x52945c[_0xdf46('0x2d')]['sort']);_0xa41995[_0xdf46('0x38')]=qs[_0xdf46('0x2f')](_['pick'](_0x52945c[_0xdf46('0x2d')],_0x3873a8[_0xdf46('0x2f')]));if(_0x52945c['query'][_0xdf46('0x3a')]){_0xa41995[_0xdf46('0x38')]=_[_0xdf46('0x3b')](_0xa41995[_0xdf46('0x38')],{'$or':_[_0xdf46('0x26')](_0xa41995[_0xdf46('0x31')],function(_0x2f8ff2){var _0x522c2b={};_0x522c2b[_0x2f8ff2]={'$like':'%'+_0x52945c['query'][_0xdf46('0x3a')]+'%'};return _0x522c2b;})});}_0xa41995=_[_0xdf46('0x3b')]({},_0xa41995,_0x52945c['options']);return _0x39dd33['getDescriptions'](_0xa41995);}})['then'](function(_0x5cc940){if(_0x5cc940){_0x6dcaf5=_0x5cc940[_0xdf46('0x33')];if(!_0x52945c[_0xdf46('0x2d')][_0xdf46('0x34')](_0xdf46('0x35'))){_0xa41995['limit']=qs[_0xdf46('0x19')](_0x52945c['query']['limit']);_0xa41995[_0xdf46('0x17')]=qs[_0xdf46('0x17')](_0x52945c[_0xdf46('0x2d')]['offset']);}return _0x39dd33['getDescriptions'](_0xa41995);}})[_0xdf46('0x1f')](function(_0x2c120b){if(_0x2c120b){return _0x2c120b?{'count':_0x6dcaf5,'rows':_0x2c120b}:null;}})[_0xdf46('0x1f')](respondWithResult(_0x3bd55b,null))[_0xdf46('0x43')](handleError(_0x3bd55b,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 2c2147b..da523ee 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 _0x7419=['request-promise','path','define','SalesforceConfiguration','int_salesforce_configurations','lodash','util','api','bluebird'];(function(_0x281033,_0x181341){var _0x1be153=function(_0x1f5274){while(--_0x1f5274){_0x281033['push'](_0x281033['shift']());}};_0x1be153(++_0x181341);}(_0x7419,0xd4));var _0x9741=function(_0x4f7978,_0xb24f7c){_0x4f7978=_0x4f7978-0x0;var _0x1eb8dc=_0x7419[_0x4f7978];return _0x1eb8dc;};'use strict';var _=require(_0x9741('0x0'));var util=require(_0x9741('0x1'));var logger=require('../../config/logger')(_0x9741('0x2'));var moment=require('moment');var BPromise=require(_0x9741('0x3'));var rp=require(_0x9741('0x4'));var fs=require('fs');var path=require(_0x9741('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intSalesforceConfiguration.attributes');module['exports']=function(_0x53c75a,_0x28d191){return _0x53c75a[_0x9741('0x6')](_0x9741('0x7'),attributes,{'tableName':_0x9741('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9161=['./intSalesforceConfiguration.attributes','exports','define','int_salesforce_configurations','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x864393,_0x1b9d2b){var _0x275730=function(_0x11f3c1){while(--_0x11f3c1){_0x864393['push'](_0x864393['shift']());}};_0x275730(++_0x1b9d2b);}(_0x9161,0x178));var _0x1916=function(_0x138bb8,_0x374b4b){_0x138bb8=_0x138bb8-0x0;var _0x2301ef=_0x9161[_0x138bb8];return _0x2301ef;};'use strict';var _=require('lodash');var util=require(_0x1916('0x0'));var logger=require(_0x1916('0x1'))(_0x1916('0x2'));var moment=require(_0x1916('0x3'));var BPromise=require(_0x1916('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1916('0x5'));var rimraf=require(_0x1916('0x6'));var config=require(_0x1916('0x7'));var attributes=require(_0x1916('0x8'));module[_0x1916('0x9')]=function(_0x2d1cd2,_0x5d3a29){return _0x2d1cd2[_0x1916('0xa')]('SalesforceConfiguration',attributes,{'tableName':_0x1916('0xb'),'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 fd976c9..adc3cbf 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 _0x4613=['../../config/logger','rpc','client','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x4ccd32,_0x3b11c9){var _0x30b693=function(_0x1b816f){while(--_0x1b816f){_0x4ccd32['push'](_0x4ccd32['shift']());}};_0x30b693(++_0x3b11c9);}(_0x4613,0x1ed));var _0x3461=function(_0x3683d7,_0x3efe81){_0x3683d7=_0x3683d7-0x0;var _0x38a0fd=_0x4613[_0x3683d7];return _0x38a0fd;};'use strict';var _=require('lodash');var util=require(_0x3461('0x0'));var moment=require(_0x3461('0x1'));var BPromise=require(_0x3461('0x2'));var rs=require(_0x3461('0x3'));var fs=require('fs');var Redis=require(_0x3461('0x4'));var db=require(_0x3461('0x5'))['db'];var utils=require(_0x3461('0x6'));var logger=require(_0x3461('0x7'))(_0x3461('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3461('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4f29a6,_0x599df3,_0x289079){return new BPromise(function(_0x5c0e66,_0x1b53dd){return client['request'](_0x4f29a6,_0x289079)[_0x3461('0xa')](function(_0x3cde8e){logger[_0x3461('0xb')](_0x3461('0xc'),_0x599df3,_0x3461('0xd'));logger[_0x3461('0xe')](_0x3461('0xf'),_0x599df3,'request\x20sent',JSON['stringify'](_0x3cde8e));if(_0x3cde8e['error']){if(_0x3cde8e['error']['code']===0x1f4){logger[_0x3461('0x10')](_0x3461('0xc'),_0x599df3,_0x3cde8e[_0x3461('0x10')][_0x3461('0x11')]);return _0x1b53dd(_0x3cde8e[_0x3461('0x10')][_0x3461('0x11')]);}logger[_0x3461('0x10')]('SalesforceConfiguration,\x20%s,\x20%s',_0x599df3,_0x3cde8e[_0x3461('0x10')][_0x3461('0x11')]);return _0x5c0e66(_0x3cde8e[_0x3461('0x10')]['message']);}else{logger[_0x3461('0xb')](_0x3461('0xc'),_0x599df3,_0x3461('0xd'));_0x5c0e66(_0x3cde8e[_0x3461('0x12')]['message']);}})[_0x3461('0x13')](function(_0x151d5d){logger[_0x3461('0x10')](_0x3461('0xc'),_0x599df3,_0x151d5d);_0x1b53dd(_0x151d5d);});});} \ No newline at end of file +var _0xbdcc=['request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','info','SalesforceConfiguration,\x20%s,\x20%s'];(function(_0x83c1c0,_0x5b615b){var _0xeb2ea5=function(_0x25b891){while(--_0x25b891){_0x83c1c0['push'](_0x83c1c0['shift']());}};_0xeb2ea5(++_0x5b615b);}(_0xbdcc,0x183));var _0xcbdc=function(_0x2bbfe9,_0x223ec2){_0x2bbfe9=_0x2bbfe9-0x0;var _0x13c1c3=_0xbdcc[_0x2bbfe9];return _0x13c1c3;};'use strict';var _=require(_0xcbdc('0x0'));var util=require(_0xcbdc('0x1'));var moment=require(_0xcbdc('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcbdc('0x3'));var db=require(_0xcbdc('0x4'))['db'];var utils=require(_0xcbdc('0x5'));var logger=require(_0xcbdc('0x6'))('rpc');var config=require(_0xcbdc('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xcbdc('0x8')][_0xcbdc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3fd50c,_0x311762,_0x460ed2){return new BPromise(function(_0x434cea,_0x9188ef){return client['request'](_0x3fd50c,_0x460ed2)['then'](function(_0x76f5b5){logger[_0xcbdc('0xa')](_0xcbdc('0xb'),_0x311762,_0xcbdc('0xc'));logger[_0xcbdc('0xd')](_0xcbdc('0xe'),_0x311762,_0xcbdc('0xc'),JSON[_0xcbdc('0xf')](_0x76f5b5));if(_0x76f5b5[_0xcbdc('0x10')]){if(_0x76f5b5[_0xcbdc('0x10')][_0xcbdc('0x11')]===0x1f4){logger[_0xcbdc('0x10')]('SalesforceConfiguration,\x20%s,\x20%s',_0x311762,_0x76f5b5[_0xcbdc('0x10')]['message']);return _0x9188ef(_0x76f5b5[_0xcbdc('0x10')]['message']);}logger[_0xcbdc('0x10')](_0xcbdc('0xb'),_0x311762,_0x76f5b5[_0xcbdc('0x10')][_0xcbdc('0x12')]);return _0x434cea(_0x76f5b5['error'][_0xcbdc('0x12')]);}else{logger[_0xcbdc('0xa')](_0xcbdc('0xb'),_0x311762,_0xcbdc('0xc'));_0x434cea(_0x76f5b5['result'][_0xcbdc('0x12')]);}})['catch'](function(_0x2f07c7){logger[_0xcbdc('0x10')](_0xcbdc('0xb'),_0x311762,_0x2f07c7);_0x9188ef(_0x2f07c7);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index f190e21..71eb472 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 _0x964e=['create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intSalesforceField.controller','isAuthenticated','get','/:id','show','post'];(function(_0x1c1b41,_0x126af6){var _0x1b079b=function(_0x48ae58){while(--_0x48ae58){_0x1c1b41['push'](_0x1c1b41['shift']());}};_0x1b079b(++_0x126af6);}(_0x964e,0x1d4));var _0xe964=function(_0x46c0c2,_0x2a9aba){_0x46c0c2=_0x46c0c2-0x0;var _0x3dcaf1=_0x964e[_0x46c0c2];return _0x3dcaf1;};'use strict';var multer=require(_0xe964('0x0'));var util=require(_0xe964('0x1'));var path=require(_0xe964('0x2'));var timeout=require(_0xe964('0x3'));var express=require(_0xe964('0x4'));var router=express[_0xe964('0x5')]();var fs_extra=require(_0xe964('0x6'));var auth=require(_0xe964('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xe964('0x8'));var controller=require(_0xe964('0x9'));router['get']('/',auth[_0xe964('0xa')](),controller['index']);router[_0xe964('0xb')](_0xe964('0xc'),auth[_0xe964('0xa')](),controller[_0xe964('0xd')]);router[_0xe964('0xe')]('/',auth[_0xe964('0xa')](),controller[_0xe964('0xf')]);router[_0xe964('0x10')](_0xe964('0xc'),auth['isAuthenticated'](),controller[_0xe964('0x11')]);router[_0xe964('0x12')](_0xe964('0xc'),auth[_0xe964('0xa')](),controller[_0xe964('0x13')]);module[_0xe964('0x14')]=router; \ No newline at end of file +var _0xc233=['../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x55c06b,_0x1ab2da){var _0x12eb36=function(_0x4acd90){while(--_0x4acd90){_0x55c06b['push'](_0x55c06b['shift']());}};_0x12eb36(++_0x1ab2da);}(_0xc233,0x150));var _0x3c23=function(_0x2eb5bc,_0x4634c6){_0x2eb5bc=_0x2eb5bc-0x0;var _0x51c7b1=_0xc233[_0x2eb5bc];return _0x51c7b1;};'use strict';var multer=require(_0x3c23('0x0'));var util=require(_0x3c23('0x1'));var path=require(_0x3c23('0x2'));var timeout=require(_0x3c23('0x3'));var express=require('express');var router=express[_0x3c23('0x4')]();var fs_extra=require(_0x3c23('0x5'));var auth=require(_0x3c23('0x6'));var interaction=require(_0x3c23('0x7'));var config=require(_0x3c23('0x8'));var controller=require('./intSalesforceField.controller');router['get']('/',auth[_0x3c23('0x9')](),controller['index']);router[_0x3c23('0xa')](_0x3c23('0xb'),auth[_0x3c23('0x9')](),controller[_0x3c23('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x3c23('0xd')]);router[_0x3c23('0xe')](_0x3c23('0xb'),auth[_0x3c23('0x9')](),controller[_0x3c23('0xf')]);router[_0x3c23('0x10')](_0x3c23('0xb'),auth[_0x3c23('0x9')](),controller[_0x3c23('0x11')]);module[_0x3c23('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 65af1a1..7f6af41 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 _0xf967=['STRING','sequelize','exports','ENUM','string','variable','customVariable','keyValue'];(function(_0x552e29,_0x27bb95){var _0x2baf3d=function(_0x30e750){while(--_0x30e750){_0x552e29['push'](_0x552e29['shift']());}};_0x2baf3d(++_0x27bb95);}(_0xf967,0x1e9));var _0x7f96=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xf967[_0x3bf83f];return _0x22c4a9;};'use strict';var Sequelize=require(_0x7f96('0x0'));module[_0x7f96('0x1')]={'type':{'type':Sequelize[_0x7f96('0x2')](_0x7f96('0x3'),_0x7f96('0x4'),_0x7f96('0x5'),_0x7f96('0x6'),'picklist'),'defaultValue':_0x7f96('0x3')},'content':{'type':Sequelize[_0x7f96('0x7')]},'key':{'type':Sequelize[_0x7f96('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x7f96('0x3'),_0x7f96('0x4'),_0x7f96('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x7f96('0x7')]},'variableName':{'type':Sequelize[_0x7f96('0x7')]}}; \ No newline at end of file +var _0x62a6=['picklist','STRING','sequelize','string','variable','customVariable','keyValue'];(function(_0x3ddbd4,_0x53e232){var _0x10065b=function(_0x14e60e){while(--_0x14e60e){_0x3ddbd4['push'](_0x3ddbd4['shift']());}};_0x10065b(++_0x53e232);}(_0x62a6,0x198));var _0x662a=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x62a6[_0x4b055c];return _0x4b62bb;};'use strict';var Sequelize=require(_0x662a('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x662a('0x1'),_0x662a('0x2'),_0x662a('0x3'),_0x662a('0x4'),_0x662a('0x5')),'defaultValue':_0x662a('0x1')},'content':{'type':Sequelize[_0x662a('0x6')]},'key':{'type':Sequelize[_0x662a('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x662a('0x1'),_0x662a('0x2'),_0x662a('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x662a('0x6')]},'variableName':{'type':Sequelize[_0x662a('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 9101f29..7504abf 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 _0xdc5b=['order','sort','where','pick','filter','merge','options','SalesforceField','includeAll','include','findAll','catch','show','rawAttributes','find','create','body','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','status','json','undefined','count','offset','Content-Range','reject','save','update','destroy','then','end','sendStatus','error','name','send','index','map','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit'];(function(_0x56eabf,_0x122249){var _0x5daa57=function(_0x35e6eb){while(--_0x35e6eb){_0x56eabf['push'](_0x56eabf['shift']());}};_0x5daa57(++_0x122249);}(_0xdc5b,0x17f));var _0xbdc5=function(_0x59c5ba,_0xc4c2f6){_0x59c5ba=_0x59c5ba-0x0;var _0x11be15=_0xdc5b[_0x59c5ba];return _0x11be15;};'use strict';var emlformat=require(_0xbdc5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbdc5('0x1'));var jsonpatch=require(_0xbdc5('0x2'));var rp=require(_0xbdc5('0x3'));var moment=require(_0xbdc5('0x4'));var BPromise=require(_0xbdc5('0x5'));var Mustache=require(_0xbdc5('0x6'));var util=require(_0xbdc5('0x7'));var path=require('path');var sox=require(_0xbdc5('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbdc5('0x9'));var _=require('lodash');var squel=require(_0xbdc5('0xa'));var crypto=require(_0xbdc5('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xbdc5('0xc'));var toCsv=require(_0xbdc5('0xd'));var querystring=require(_0xbdc5('0xe'));var Papa=require(_0xbdc5('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xbdc5('0x10'));var as=require(_0xbdc5('0x11'));var hardwareService=require(_0xbdc5('0x12'));var logger=require('../../config/logger')(_0xbdc5('0x13'));var utils=require(_0xbdc5('0x14'));var config=require(_0xbdc5('0x15'));var licenseUtil=require(_0xbdc5('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x50fc18,_0xbbd6f1){_0xbbd6f1=_0xbbd6f1||0xcc;return function(_0x37113b){if(_0x37113b){return _0x50fc18['sendStatus'](_0xbbd6f1);}return _0x50fc18[_0xbdc5('0x17')](_0xbbd6f1)['end']();};}function respondWithResult(_0x483aa9,_0x43e36a){_0x43e36a=_0x43e36a||0xc8;return function(_0x332017){if(_0x332017){return _0x483aa9[_0xbdc5('0x17')](_0x43e36a)[_0xbdc5('0x18')](_0x332017);}};}function respondWithFilteredResult(_0x422c62,_0x12167a){return function(_0xae66d0){if(_0xae66d0){var _0x82be2b=typeof _0x12167a['offset']===_0xbdc5('0x19')&&typeof _0x12167a['limit']===_0xbdc5('0x19');var _0x2c8e97=_0xae66d0[_0xbdc5('0x1a')];var _0x2b6e66=_0x82be2b?0x0:_0x12167a[_0xbdc5('0x1b')];var _0x42db38=_0x82be2b?_0xae66d0[_0xbdc5('0x1a')]:_0x12167a[_0xbdc5('0x1b')]+_0x12167a['limit'];var _0x3c9c20;if(_0x42db38>=_0x2c8e97){_0x42db38=_0x2c8e97;_0x3c9c20=0xc8;}else{_0x3c9c20=0xce;}_0x422c62[_0xbdc5('0x17')](_0x3c9c20);return _0x422c62['set'](_0xbdc5('0x1c'),_0x2b6e66+'-'+_0x42db38+'/'+_0x2c8e97)[_0xbdc5('0x18')](_0xae66d0);}return null;};}function patchUpdates(_0x2c8c6d){return function(_0x25f174){try{jsonpatch['apply'](_0x25f174,_0x2c8c6d,!![]);}catch(_0x342fb3){return BPromise[_0xbdc5('0x1d')](_0x342fb3);}return _0x25f174[_0xbdc5('0x1e')]();};}function saveUpdates(_0x5d96de,_0x31c7ca){return function(_0x24155f){if(_0x24155f){return _0x24155f[_0xbdc5('0x1f')](_0x5d96de)['then'](function(_0x2f3dfa){return _0x2f3dfa;});}return null;};}function removeEntity(_0x40b1e8,_0x242f2b){return function(_0x286f95){if(_0x286f95){return _0x286f95[_0xbdc5('0x20')]()[_0xbdc5('0x21')](function(){_0x40b1e8['status'](0xcc)[_0xbdc5('0x22')]();});}};}function handleEntityNotFound(_0x522a10,_0xcda861){return function(_0x442cda){if(!_0x442cda){_0x522a10[_0xbdc5('0x23')](0x194);}return _0x442cda;};}function handleError(_0x2542e8,_0x1cffae){_0x1cffae=_0x1cffae||0x1f4;return function(_0x3e8cc0){logger[_0xbdc5('0x24')](_0x3e8cc0['stack']);if(_0x3e8cc0[_0xbdc5('0x25')]){delete _0x3e8cc0[_0xbdc5('0x25')];}_0x2542e8[_0xbdc5('0x17')](_0x1cffae)[_0xbdc5('0x26')](_0x3e8cc0);};}exports[_0xbdc5('0x27')]=function(_0x2a6a7d,_0x3387bd){var _0x46e5d9={},_0xb2422={},_0x297eac={'count':0x0,'rows':[]};var _0x18c8d1=_[_0xbdc5('0x28')](db['SalesforceField']['rawAttributes'],function(_0x69885c){return{'name':_0x69885c[_0xbdc5('0x29')],'type':_0x69885c[_0xbdc5('0x2a')][_0xbdc5('0x2b')]};});_0xb2422[_0xbdc5('0x2c')]=_[_0xbdc5('0x28')](_0x18c8d1,_0xbdc5('0x25'));_0xb2422['query']=_[_0xbdc5('0x2d')](_0x2a6a7d[_0xbdc5('0x2e')]);_0xb2422[_0xbdc5('0x2f')]=_[_0xbdc5('0x30')](_0xb2422[_0xbdc5('0x2c')],_0xb2422[_0xbdc5('0x2e')]);_0x46e5d9[_0xbdc5('0x31')]=_[_0xbdc5('0x30')](_0xb2422[_0xbdc5('0x2c')],qs[_0xbdc5('0x32')](_0x2a6a7d[_0xbdc5('0x2e')][_0xbdc5('0x32')]));_0x46e5d9[_0xbdc5('0x31')]=_0x46e5d9['attributes'][_0xbdc5('0x33')]?_0x46e5d9[_0xbdc5('0x31')]:_0xb2422[_0xbdc5('0x2c')];if(!_0x2a6a7d['query'][_0xbdc5('0x34')](_0xbdc5('0x35'))){_0x46e5d9[_0xbdc5('0x36')]=qs[_0xbdc5('0x36')](_0x2a6a7d[_0xbdc5('0x2e')][_0xbdc5('0x36')]);_0x46e5d9[_0xbdc5('0x1b')]=qs[_0xbdc5('0x1b')](_0x2a6a7d['query'][_0xbdc5('0x1b')]);}_0x46e5d9[_0xbdc5('0x37')]=qs[_0xbdc5('0x38')](_0x2a6a7d[_0xbdc5('0x2e')][_0xbdc5('0x38')]);_0x46e5d9[_0xbdc5('0x39')]=qs[_0xbdc5('0x2f')](_[_0xbdc5('0x3a')](_0x2a6a7d[_0xbdc5('0x2e')],_0xb2422[_0xbdc5('0x2f')]),_0x18c8d1);if(_0x2a6a7d[_0xbdc5('0x2e')][_0xbdc5('0x3b')]){_0x46e5d9[_0xbdc5('0x39')]=_[_0xbdc5('0x3c')](_0x46e5d9[_0xbdc5('0x39')],{'$or':_[_0xbdc5('0x28')](_0x18c8d1,function(_0x2e1ee6){if(_0x2e1ee6[_0xbdc5('0x2a')]!=='VIRTUAL'){var _0x273681={};_0x273681[_0x2e1ee6[_0xbdc5('0x25')]]={'$like':'%'+_0x2a6a7d[_0xbdc5('0x2e')][_0xbdc5('0x3b')]+'%'};return _0x273681;}})});}_0x46e5d9=_[_0xbdc5('0x3c')]({},_0x46e5d9,_0x2a6a7d[_0xbdc5('0x3d')]);var _0x7a909e={'where':_0x46e5d9[_0xbdc5('0x39')]};return db[_0xbdc5('0x3e')]['count'](_0x7a909e)[_0xbdc5('0x21')](function(_0x1eecaa){_0x297eac[_0xbdc5('0x1a')]=_0x1eecaa;if(_0x2a6a7d[_0xbdc5('0x2e')][_0xbdc5('0x3f')]){_0x46e5d9[_0xbdc5('0x40')]=[{'all':!![]}];}return db[_0xbdc5('0x3e')][_0xbdc5('0x41')](_0x46e5d9);})['then'](function(_0x263a15){_0x297eac['rows']=_0x263a15;return _0x297eac;})[_0xbdc5('0x21')](respondWithFilteredResult(_0x3387bd,_0x46e5d9))[_0xbdc5('0x42')](handleError(_0x3387bd,null));};exports[_0xbdc5('0x43')]=function(_0x4fa0f9,_0x5bcdf3){var _0x1ca8dc={'raw':!![],'where':{'id':_0x4fa0f9['params']['id']}},_0x5c6443={};_0x5c6443[_0xbdc5('0x2c')]=_['keys'](db[_0xbdc5('0x3e')][_0xbdc5('0x44')]);_0x5c6443[_0xbdc5('0x2e')]=_[_0xbdc5('0x2d')](_0x4fa0f9[_0xbdc5('0x2e')]);_0x5c6443[_0xbdc5('0x2f')]=_[_0xbdc5('0x30')](_0x5c6443[_0xbdc5('0x2c')],_0x5c6443[_0xbdc5('0x2e')]);_0x1ca8dc[_0xbdc5('0x31')]=_['intersection'](_0x5c6443[_0xbdc5('0x2c')],qs[_0xbdc5('0x32')](_0x4fa0f9[_0xbdc5('0x2e')]['fields']));_0x1ca8dc[_0xbdc5('0x31')]=_0x1ca8dc[_0xbdc5('0x31')][_0xbdc5('0x33')]?_0x1ca8dc[_0xbdc5('0x31')]:_0x5c6443[_0xbdc5('0x2c')];if(_0x4fa0f9[_0xbdc5('0x2e')][_0xbdc5('0x3f')]){_0x1ca8dc[_0xbdc5('0x40')]=[{'all':!![]}];}_0x1ca8dc=_[_0xbdc5('0x3c')]({},_0x1ca8dc,_0x4fa0f9[_0xbdc5('0x3d')]);return db[_0xbdc5('0x3e')][_0xbdc5('0x45')](_0x1ca8dc)[_0xbdc5('0x21')](handleEntityNotFound(_0x5bcdf3,null))['then'](respondWithResult(_0x5bcdf3,null))[_0xbdc5('0x42')](handleError(_0x5bcdf3,null));};exports[_0xbdc5('0x46')]=function(_0x20649b,_0x151ca7){return db[_0xbdc5('0x3e')][_0xbdc5('0x46')](_0x20649b[_0xbdc5('0x47')],{})[_0xbdc5('0x21')](respondWithResult(_0x151ca7,0xc9))[_0xbdc5('0x42')](handleError(_0x151ca7,null));};exports[_0xbdc5('0x1f')]=function(_0x3b96dc,_0x35dd1e){if(_0x3b96dc[_0xbdc5('0x47')]['id']){delete _0x3b96dc[_0xbdc5('0x47')]['id'];}return db[_0xbdc5('0x3e')][_0xbdc5('0x45')]({'where':{'id':_0x3b96dc[_0xbdc5('0x48')]['id']}})[_0xbdc5('0x21')](handleEntityNotFound(_0x35dd1e,null))['then'](saveUpdates(_0x3b96dc[_0xbdc5('0x47')],null))['then'](respondWithResult(_0x35dd1e,null))[_0xbdc5('0x42')](handleError(_0x35dd1e,null));};exports[_0xbdc5('0x20')]=function(_0x379eb5,_0x44b1be){return db[_0xbdc5('0x3e')][_0xbdc5('0x45')]({'where':{'id':_0x379eb5[_0xbdc5('0x48')]['id']}})[_0xbdc5('0x21')](handleEntityNotFound(_0x44b1be,null))[_0xbdc5('0x21')](removeEntity(_0x44b1be,null))['catch'](handleError(_0x44b1be,null));}; \ No newline at end of file +var _0xbc4f=['findAll','rows','catch','SalesforceField','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','update','then','destroy','error','stack','name','index','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','nolimit','limit','order','sort','where','filters','merge','VIRTUAL','filter','options','includeAll','include'];(function(_0xe645a0,_0x159c18){var _0x12d478=function(_0x2d423e){while(--_0x2d423e){_0xe645a0['push'](_0xe645a0['shift']());}};_0x12d478(++_0x159c18);}(_0xbc4f,0x1be));var _0xfbc4=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xbc4f[_0x934425];return _0x31d596;};'use strict';var emlformat=require(_0xfbc4('0x0'));var rimraf=require(_0xfbc4('0x1'));var zipdir=require(_0xfbc4('0x2'));var jsonpatch=require(_0xfbc4('0x3'));var rp=require(_0xfbc4('0x4'));var moment=require(_0xfbc4('0x5'));var BPromise=require(_0xfbc4('0x6'));var Mustache=require(_0xfbc4('0x7'));var util=require(_0xfbc4('0x8'));var path=require(_0xfbc4('0x9'));var sox=require(_0xfbc4('0xa'));var csv=require(_0xfbc4('0xb'));var ejs=require(_0xfbc4('0xc'));var fs=require('fs');var fs_extra=require(_0xfbc4('0xd'));var _=require(_0xfbc4('0xe'));var squel=require(_0xfbc4('0xf'));var crypto=require(_0xfbc4('0x10'));var jsforce=require(_0xfbc4('0x11'));var deskjs=require('desk.js');var toCsv=require(_0xfbc4('0xb'));var querystring=require(_0xfbc4('0x12'));var Papa=require(_0xfbc4('0x13'));var Redis=require('ioredis');var authService=require(_0xfbc4('0x14'));var qs=require(_0xfbc4('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfbc4('0x16'));var logger=require('../../config/logger')(_0xfbc4('0x17'));var utils=require('../../config/utils');var config=require(_0xfbc4('0x18'));var licenseUtil=require(_0xfbc4('0x19'));var db=require(_0xfbc4('0x1a'))['db'];function respondWithStatusCode(_0x17206a,_0x4cab98){_0x4cab98=_0x4cab98||0xcc;return function(_0x3e1c4b){if(_0x3e1c4b){return _0x17206a[_0xfbc4('0x1b')](_0x4cab98);}return _0x17206a[_0xfbc4('0x1c')](_0x4cab98)[_0xfbc4('0x1d')]();};}function respondWithResult(_0x624c9d,_0x4939ed){_0x4939ed=_0x4939ed||0xc8;return function(_0x58bbb8){if(_0x58bbb8){return _0x624c9d[_0xfbc4('0x1c')](_0x4939ed)[_0xfbc4('0x1e')](_0x58bbb8);}};}function respondWithFilteredResult(_0x5b9114,_0x45ecc9){return function(_0x24e88f){if(_0x24e88f){var _0x19489c=typeof _0x45ecc9[_0xfbc4('0x1f')]==='undefined'&&typeof _0x45ecc9['limit']===_0xfbc4('0x20');var _0x136e09=_0x24e88f[_0xfbc4('0x21')];var _0x4dc577=_0x19489c?0x0:_0x45ecc9['offset'];var _0x4fc54f=_0x19489c?_0x24e88f[_0xfbc4('0x21')]:_0x45ecc9[_0xfbc4('0x1f')]+_0x45ecc9['limit'];var _0x2f8381;if(_0x4fc54f>=_0x136e09){_0x4fc54f=_0x136e09;_0x2f8381=0xc8;}else{_0x2f8381=0xce;}_0x5b9114[_0xfbc4('0x1c')](_0x2f8381);return _0x5b9114[_0xfbc4('0x22')]('Content-Range',_0x4dc577+'-'+_0x4fc54f+'/'+_0x136e09)[_0xfbc4('0x1e')](_0x24e88f);}return null;};}function patchUpdates(_0x41ddd8){return function(_0x479125){try{jsonpatch['apply'](_0x479125,_0x41ddd8,!![]);}catch(_0x323a74){return BPromise['reject'](_0x323a74);}return _0x479125['save']();};}function saveUpdates(_0x5ca3b3,_0x57a55b){return function(_0x329f66){if(_0x329f66){return _0x329f66[_0xfbc4('0x23')](_0x5ca3b3)[_0xfbc4('0x24')](function(_0x5b803b){return _0x5b803b;});}return null;};}function removeEntity(_0x25747e,_0x53b820){return function(_0x3ef9aa){if(_0x3ef9aa){return _0x3ef9aa[_0xfbc4('0x25')]()[_0xfbc4('0x24')](function(){_0x25747e[_0xfbc4('0x1c')](0xcc)[_0xfbc4('0x1d')]();});}};}function handleEntityNotFound(_0x294a93,_0x202298){return function(_0x112970){if(!_0x112970){_0x294a93[_0xfbc4('0x1b')](0x194);}return _0x112970;};}function handleError(_0x887573,_0x3f40a6){_0x3f40a6=_0x3f40a6||0x1f4;return function(_0x56a423){logger[_0xfbc4('0x26')](_0x56a423[_0xfbc4('0x27')]);if(_0x56a423[_0xfbc4('0x28')]){delete _0x56a423[_0xfbc4('0x28')];}_0x887573[_0xfbc4('0x1c')](_0x3f40a6)['send'](_0x56a423);};}exports[_0xfbc4('0x29')]=function(_0x32cc0c,_0x2bc1c7){var _0x5f13a3={},_0x5d9f87={},_0x2d6188={'count':0x0,'rows':[]};var _0x483f95=_['map'](db['SalesforceField']['rawAttributes'],function(_0x49bd5c){return{'name':_0x49bd5c[_0xfbc4('0x2a')],'type':_0x49bd5c[_0xfbc4('0x2b')][_0xfbc4('0x2c')]};});_0x5d9f87[_0xfbc4('0x2d')]=_[_0xfbc4('0x2e')](_0x483f95,_0xfbc4('0x28'));_0x5d9f87[_0xfbc4('0x2f')]=_[_0xfbc4('0x30')](_0x32cc0c[_0xfbc4('0x2f')]);_0x5d9f87['filters']=_[_0xfbc4('0x31')](_0x5d9f87['model'],_0x5d9f87[_0xfbc4('0x2f')]);_0x5f13a3[_0xfbc4('0x32')]=_[_0xfbc4('0x31')](_0x5d9f87[_0xfbc4('0x2d')],qs['fields'](_0x32cc0c[_0xfbc4('0x2f')][_0xfbc4('0x33')]));_0x5f13a3['attributes']=_0x5f13a3[_0xfbc4('0x32')][_0xfbc4('0x34')]?_0x5f13a3[_0xfbc4('0x32')]:_0x5d9f87[_0xfbc4('0x2d')];if(!_0x32cc0c[_0xfbc4('0x2f')]['hasOwnProperty'](_0xfbc4('0x35'))){_0x5f13a3[_0xfbc4('0x36')]=qs[_0xfbc4('0x36')](_0x32cc0c[_0xfbc4('0x2f')][_0xfbc4('0x36')]);_0x5f13a3['offset']=qs[_0xfbc4('0x1f')](_0x32cc0c[_0xfbc4('0x2f')][_0xfbc4('0x1f')]);}_0x5f13a3[_0xfbc4('0x37')]=qs[_0xfbc4('0x38')](_0x32cc0c[_0xfbc4('0x2f')][_0xfbc4('0x38')]);_0x5f13a3[_0xfbc4('0x39')]=qs[_0xfbc4('0x3a')](_['pick'](_0x32cc0c['query'],_0x5d9f87['filters']),_0x483f95);if(_0x32cc0c['query']['filter']){_0x5f13a3[_0xfbc4('0x39')]=_[_0xfbc4('0x3b')](_0x5f13a3[_0xfbc4('0x39')],{'$or':_[_0xfbc4('0x2e')](_0x483f95,function(_0x4d534f){if(_0x4d534f[_0xfbc4('0x2b')]!==_0xfbc4('0x3c')){var _0x141907={};_0x141907[_0x4d534f[_0xfbc4('0x28')]]={'$like':'%'+_0x32cc0c[_0xfbc4('0x2f')][_0xfbc4('0x3d')]+'%'};return _0x141907;}})});}_0x5f13a3=_['merge']({},_0x5f13a3,_0x32cc0c[_0xfbc4('0x3e')]);var _0x4734a9={'where':_0x5f13a3[_0xfbc4('0x39')]};return db['SalesforceField'][_0xfbc4('0x21')](_0x4734a9)[_0xfbc4('0x24')](function(_0xe0be2b){_0x2d6188['count']=_0xe0be2b;if(_0x32cc0c[_0xfbc4('0x2f')][_0xfbc4('0x3f')]){_0x5f13a3[_0xfbc4('0x40')]=[{'all':!![]}];}return db['SalesforceField'][_0xfbc4('0x41')](_0x5f13a3);})['then'](function(_0x20d8e3){_0x2d6188[_0xfbc4('0x42')]=_0x20d8e3;return _0x2d6188;})[_0xfbc4('0x24')](respondWithFilteredResult(_0x2bc1c7,_0x5f13a3))[_0xfbc4('0x43')](handleError(_0x2bc1c7,null));};exports['show']=function(_0x1e38b2,_0x3fa890){var _0x3cfbe3={'raw':!![],'where':{'id':_0x1e38b2['params']['id']}},_0x2720c6={};_0x2720c6[_0xfbc4('0x2d')]=_[_0xfbc4('0x30')](db[_0xfbc4('0x44')]['rawAttributes']);_0x2720c6[_0xfbc4('0x2f')]=_['keys'](_0x1e38b2[_0xfbc4('0x2f')]);_0x2720c6[_0xfbc4('0x3a')]=_[_0xfbc4('0x31')](_0x2720c6[_0xfbc4('0x2d')],_0x2720c6[_0xfbc4('0x2f')]);_0x3cfbe3['attributes']=_[_0xfbc4('0x31')](_0x2720c6['model'],qs[_0xfbc4('0x33')](_0x1e38b2['query'][_0xfbc4('0x33')]));_0x3cfbe3[_0xfbc4('0x32')]=_0x3cfbe3[_0xfbc4('0x32')][_0xfbc4('0x34')]?_0x3cfbe3[_0xfbc4('0x32')]:_0x2720c6[_0xfbc4('0x2d')];if(_0x1e38b2['query']['includeAll']){_0x3cfbe3[_0xfbc4('0x40')]=[{'all':!![]}];}_0x3cfbe3=_[_0xfbc4('0x3b')]({},_0x3cfbe3,_0x1e38b2[_0xfbc4('0x3e')]);return db[_0xfbc4('0x44')][_0xfbc4('0x45')](_0x3cfbe3)['then'](handleEntityNotFound(_0x3fa890,null))[_0xfbc4('0x24')](respondWithResult(_0x3fa890,null))['catch'](handleError(_0x3fa890,null));};exports['create']=function(_0x15839f,_0x1bee6a){return db[_0xfbc4('0x44')][_0xfbc4('0x46')](_0x15839f[_0xfbc4('0x47')],{})['then'](respondWithResult(_0x1bee6a,0xc9))['catch'](handleError(_0x1bee6a,null));};exports['update']=function(_0x581b85,_0x2d2364){if(_0x581b85['body']['id']){delete _0x581b85[_0xfbc4('0x47')]['id'];}return db[_0xfbc4('0x44')][_0xfbc4('0x45')]({'where':{'id':_0x581b85[_0xfbc4('0x48')]['id']}})[_0xfbc4('0x24')](handleEntityNotFound(_0x2d2364,null))['then'](saveUpdates(_0x581b85[_0xfbc4('0x47')],null))['then'](respondWithResult(_0x2d2364,null))[_0xfbc4('0x43')](handleError(_0x2d2364,null));};exports[_0xfbc4('0x25')]=function(_0x51de16,_0x3fc90a){return db['SalesforceField'][_0xfbc4('0x45')]({'where':{'id':_0x51de16['params']['id']}})['then'](handleEntityNotFound(_0x3fc90a,null))[_0xfbc4('0x24')](removeEntity(_0x3fc90a,null))['catch'](handleError(_0x3fc90a,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 78f2033..c190061 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 _0x3ddd=['idField','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index'];(function(_0xf7fbe2,_0xade0c6){var _0x49aa74=function(_0x2e21c0){while(--_0x2e21c0){_0xf7fbe2['push'](_0xf7fbe2['shift']());}};_0x49aa74(++_0xade0c6);}(_0x3ddd,0x1a5));var _0xd3dd=function(_0x2e3ce5,_0x5957b7){_0x2e3ce5=_0x2e3ce5-0x0;var _0x8e540b=_0x3ddd[_0x2e3ce5];return _0x8e540b;};'use strict';var _=require(_0xd3dd('0x0'));var util=require(_0xd3dd('0x1'));var logger=require(_0xd3dd('0x2'))('api');var moment=require(_0xd3dd('0x3'));var BPromise=require('bluebird');var rp=require(_0xd3dd('0x4'));var fs=require('fs');var path=require(_0xd3dd('0x5'));var rimraf=require(_0xd3dd('0x6'));var config=require(_0xd3dd('0x7'));var attributes=require(_0xd3dd('0x8'));module[_0xd3dd('0x9')]=function(_0x2025f2,_0x379f4f){return _0x2025f2[_0xd3dd('0xa')](_0xd3dd('0xb'),attributes,{'tableName':_0xd3dd('0xc'),'paranoid':![],'indexes':[{'name':_0xd3dd('0xd'),'fields':[_0xd3dd('0xe'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb1b2=['salesforce_unique_index','idField','FieldId','util','api','moment','request-promise','./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields'];(function(_0x336376,_0xe4b28d){var _0x1d2a8e=function(_0x3afe68){while(--_0x3afe68){_0x336376['push'](_0x336376['shift']());}};_0x1d2a8e(++_0xe4b28d);}(_0xb1b2,0x19b));var _0x2b1b=function(_0xd701c6,_0x20625a){_0xd701c6=_0xd701c6-0x0;var _0x44092b=_0xb1b2[_0xd701c6];return _0x44092b;};'use strict';var _=require('lodash');var util=require(_0x2b1b('0x0'));var logger=require('../../config/logger')(_0x2b1b('0x1'));var moment=require(_0x2b1b('0x2'));var BPromise=require('bluebird');var rp=require(_0x2b1b('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2b1b('0x4'));module[_0x2b1b('0x5')]=function(_0x12433e,_0x7f5775){return _0x12433e[_0x2b1b('0x6')](_0x2b1b('0x7'),attributes,{'tableName':_0x2b1b('0x8'),'paranoid':![],'indexes':[{'name':_0x2b1b('0x9'),'fields':[_0x2b1b('0xa'),_0x2b1b('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index 609c477..8b2674c 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 _0x061d=['error','message','result','catch','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x061d,0x108));var _0xd061=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0x061d[_0x1c546c];return _0x2cc384;};'use strict';var _=require(_0xd061('0x0'));var util=require(_0xd061('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd061('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd061('0x3'))['db'];var utils=require(_0xd061('0x4'));var logger=require(_0xd061('0x5'))('rpc');var config=require(_0xd061('0x6'));var jayson=require(_0xd061('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x9dba29,_0x3f188d,_0x4b5fe8){return new BPromise(function(_0x237c84,_0x2cea8d){return client[_0xd061('0x8')](_0x9dba29,_0x4b5fe8)[_0xd061('0x9')](function(_0x2f6545){logger[_0xd061('0xa')](_0xd061('0xb'),_0x3f188d,_0xd061('0xc'));logger[_0xd061('0xd')](_0xd061('0xe'),_0x3f188d,_0xd061('0xc'),JSON[_0xd061('0xf')](_0x2f6545));if(_0x2f6545[_0xd061('0x10')]){if(_0x2f6545[_0xd061('0x10')]['code']===0x1f4){logger[_0xd061('0x10')](_0xd061('0xb'),_0x3f188d,_0x2f6545['error'][_0xd061('0x11')]);return _0x2cea8d(_0x2f6545['error'][_0xd061('0x11')]);}logger['error'](_0xd061('0xb'),_0x3f188d,_0x2f6545['error'][_0xd061('0x11')]);return _0x237c84(_0x2f6545[_0xd061('0x10')][_0xd061('0x11')]);}else{logger[_0xd061('0xa')](_0xd061('0xb'),_0x3f188d,'request\x20sent');_0x237c84(_0x2f6545[_0xd061('0x12')][_0xd061('0x11')]);}})[_0xd061('0x13')](function(_0x324ed7){logger['error'](_0xd061('0xb'),_0x3f188d,_0x324ed7);_0x2cea8d(_0x324ed7);});});} \ No newline at end of file +var _0x71df=['code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','error'];(function(_0x575da1,_0x254942){var _0x1fa4ff=function(_0x5625dd){while(--_0x5625dd){_0x575da1['push'](_0x575da1['shift']());}};_0x1fa4ff(++_0x254942);}(_0x71df,0x8f));var _0xf71d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x71df[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xf71d('0x0'));var moment=require(_0xf71d('0x1'));var BPromise=require(_0xf71d('0x2'));var rs=require(_0xf71d('0x3'));var fs=require('fs');var Redis=require(_0xf71d('0x4'));var db=require(_0xf71d('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf71d('0x6'));var config=require(_0xf71d('0x7'));var jayson=require(_0xf71d('0x8'));var client=jayson['client'][_0xf71d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x233825,_0x57b709,_0x5e5416){return new BPromise(function(_0x1a6445,_0x49115){return client['request'](_0x233825,_0x5e5416)[_0xf71d('0xa')](function(_0x1524e8){logger[_0xf71d('0xb')](_0xf71d('0xc'),_0x57b709,_0xf71d('0xd'));logger[_0xf71d('0xe')](_0xf71d('0xf'),_0x57b709,'request\x20sent',JSON['stringify'](_0x1524e8));if(_0x1524e8[_0xf71d('0x10')]){if(_0x1524e8['error'][_0xf71d('0x11')]===0x1f4){logger[_0xf71d('0x10')](_0xf71d('0xc'),_0x57b709,_0x1524e8[_0xf71d('0x10')][_0xf71d('0x12')]);return _0x49115(_0x1524e8['error']['message']);}logger['error'](_0xf71d('0xc'),_0x57b709,_0x1524e8[_0xf71d('0x10')]['message']);return _0x1a6445(_0x1524e8['error']['message']);}else{logger[_0xf71d('0xb')](_0xf71d('0xc'),_0x57b709,_0xf71d('0xd'));_0x1a6445(_0x1524e8[_0xf71d('0x13')][_0xf71d('0x12')]);}})['catch'](function(_0x9e9ef0){logger['error'](_0xf71d('0xc'),_0x57b709,_0x9e9ef0);_0x49115(_0x9e9ef0);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index cb85573..a3efbc8 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 _0x93e7=['get','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index'];(function(_0x248da7,_0x12d25a){var _0x5d4df1=function(_0x775b2b){while(--_0x775b2b){_0x248da7['push'](_0x248da7['shift']());}};_0x5d4df1(++_0x12d25a);}(_0x93e7,0x13a));var _0x793e=function(_0xf4129c,_0x44fcf1){_0xf4129c=_0xf4129c-0x0;var _0x426611=_0x93e7[_0xf4129c];return _0x426611;};'use strict';var multer=require('multer');var util=require(_0x793e('0x0'));var path=require('path');var timeout=require(_0x793e('0x1'));var express=require(_0x793e('0x2'));var router=express['Router']();var fs_extra=require(_0x793e('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x793e('0x4'));var config=require(_0x793e('0x5'));var controller=require('./intServicenowAccount.controller');router['get']('/',auth[_0x793e('0x6')](),controller[_0x793e('0x7')]);router[_0x793e('0x8')](_0x793e('0x9'),auth[_0x793e('0x6')](),controller[_0x793e('0xa')]);router[_0x793e('0x8')](_0x793e('0xb'),auth['isAuthenticated'](),controller[_0x793e('0xc')]);router['get'](_0x793e('0xd'),auth[_0x793e('0x6')](),controller[_0x793e('0xe')]);router[_0x793e('0xf')]('/',auth[_0x793e('0x6')](),controller[_0x793e('0x10')]);router[_0x793e('0xf')](_0x793e('0xb'),auth['isAuthenticated'](),controller[_0x793e('0x11')]);router[_0x793e('0x12')](_0x793e('0x9'),auth[_0x793e('0x6')](),controller[_0x793e('0x13')]);router[_0x793e('0x14')]('/:id',auth[_0x793e('0x6')](),controller[_0x793e('0x15')]);module[_0x793e('0x16')]=router; \ No newline at end of file +var _0x72ee=['/:id','show','/:id/configurations','getConfigurations','post','create','addConfiguration','put','update','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intServicenowAccount.controller','isAuthenticated','index','get'];(function(_0x289a7b,_0x5d7291){var _0x3690a8=function(_0x14827f){while(--_0x14827f){_0x289a7b['push'](_0x289a7b['shift']());}};_0x3690a8(++_0x5d7291);}(_0x72ee,0x1ac));var _0xe72e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x72ee[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xe72e('0x0'));var util=require(_0xe72e('0x1'));var path=require(_0xe72e('0x2'));var timeout=require(_0xe72e('0x3'));var express=require(_0xe72e('0x4'));var router=express[_0xe72e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xe72e('0x6'));var interaction=require(_0xe72e('0x7'));var config=require('../../config/environment');var controller=require(_0xe72e('0x8'));router['get']('/',auth[_0xe72e('0x9')](),controller[_0xe72e('0xa')]);router[_0xe72e('0xb')](_0xe72e('0xc'),auth[_0xe72e('0x9')](),controller[_0xe72e('0xd')]);router['get'](_0xe72e('0xe'),auth[_0xe72e('0x9')](),controller[_0xe72e('0xf')]);router[_0xe72e('0xb')]('/:id/fields',auth[_0xe72e('0x9')](),controller['getFields']);router[_0xe72e('0x10')]('/',auth[_0xe72e('0x9')](),controller[_0xe72e('0x11')]);router['post'](_0xe72e('0xe'),auth[_0xe72e('0x9')](),controller[_0xe72e('0x12')]);router[_0xe72e('0x13')](_0xe72e('0xc'),auth[_0xe72e('0x9')](),controller[_0xe72e('0x14')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xe72e('0x15')]);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 622621e..3dc6957 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 _0x53ae=['sequelize','exports','STRING','username','remoteUri'];(function(_0x479f6f,_0x1c26c4){var _0x24e701=function(_0x5291dd){while(--_0x5291dd){_0x479f6f['push'](_0x479f6f['shift']());}};_0x24e701(++_0x1c26c4);}(_0x53ae,0x195));var _0xe53a=function(_0x1ac3a4,_0x2190f5){_0x1ac3a4=_0x1ac3a4-0x0;var _0x29b463=_0x53ae[_0x1ac3a4];return _0x29b463;};'use strict';var Sequelize=require(_0xe53a('0x0'));module[_0xe53a('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xe53a('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0xe53a('0x3')},'password':{'type':Sequelize[_0xe53a('0x2')]},'email':{'type':Sequelize[_0xe53a('0x2')]},'remoteUri':{'type':Sequelize[_0xe53a('0x2')],'unique':_0xe53a('0x4')},'serverUrl':{'type':Sequelize[_0xe53a('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xa7f8=['sequelize','STRING'];(function(_0x862a7,_0x2290ab){var _0x319b1a=function(_0x4c1424){while(--_0x4c1424){_0x862a7['push'](_0x862a7['shift']());}};_0x319b1a(++_0x2290ab);}(_0xa7f8,0x152));var _0x8a7f=function(_0xa03db6,_0x436e2c){_0xa03db6=_0xa03db6-0x0;var _0x1e7e80=_0xa7f8[_0xa03db6];return _0x1e7e80;};'use strict';var Sequelize=require(_0x8a7f('0x0'));module['exports']={'name':{'type':Sequelize[_0x8a7f('0x1')]},'description':{'type':Sequelize[_0x8a7f('0x1')]},'username':{'type':Sequelize[_0x8a7f('0x1')],'unique':'username'},'password':{'type':Sequelize[_0x8a7f('0x1')]},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x8a7f('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x8a7f('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 738b1bb..8fc269c 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 _0xeb5d=['undefined','limit','count','set','apply','reject','save','then','destroy','error','stack','name','send','index','map','fieldName','type','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','order','pick','filter','where','merge','options','ServicenowAccount','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','update','getConfigurations','findOne','sort','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','ServicenowConfiguration','ServicenowField','getFields','made_sla','hold_reason','subcategory','notify','incident_state','category','parent','caused_by','sys_updated_on','child_incidents','approval_history','resolved_by','sys_updated_by','user_input','sys_created_on','sys_domain','state','sys_created_by','knowledge','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','active','work_notes_list','business_service','priority','sys_domain_path','opened_at','business_duration','group_list','work_end','reopened_time','resolved_at','caller_id','approval_set','work_notes','close_code','correlation_display','delivery_task','work_start','assignment_group','business_stc','description','calendar_duration','sys_class_name','close_notes','follow_up','parent_incident','sys_id','contact_type','reopened_by','urgency','problem_id','reassignment_count','activity_due','assigned_to','severity','comments','comments_and_work_notes','due_date','sys_mod_count','reopen_count','escalation','upon_approval','location','username','password','email','remoteUri','serverUrl','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','remove','includes','internalType','label','push','all','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','concat','ServiceNow\x20error:\x20','test','statusCode','boolean','true','False','sys_choice?sysparm_query=name=incident^element=','inactive','value','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset'];(function(_0x5e5d9b,_0x5eee36){var _0x4bbadc=function(_0x54fdd3){while(--_0x54fdd3){_0x5e5d9b['push'](_0x5e5d9b['shift']());}};_0x4bbadc(++_0x5eee36);}(_0xeb5d,0x9e));var _0xdeb5=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xeb5d[_0x1cc8fe];return _0x230054;};'use strict';var emlformat=require(_0xdeb5('0x0'));var rimraf=require(_0xdeb5('0x1'));var zipdir=require(_0xdeb5('0x2'));var jsonpatch=require(_0xdeb5('0x3'));var rp=require(_0xdeb5('0x4'));var moment=require('moment');var BPromise=require(_0xdeb5('0x5'));var Mustache=require(_0xdeb5('0x6'));var util=require(_0xdeb5('0x7'));var path=require(_0xdeb5('0x8'));var sox=require(_0xdeb5('0x9'));var csv=require(_0xdeb5('0xa'));var ejs=require(_0xdeb5('0xb'));var fs=require('fs');var fs_extra=require(_0xdeb5('0xc'));var _=require('lodash');var squel=require(_0xdeb5('0xd'));var crypto=require(_0xdeb5('0xe'));var jsforce=require(_0xdeb5('0xf'));var deskjs=require(_0xdeb5('0x10'));var toCsv=require(_0xdeb5('0xa'));var querystring=require(_0xdeb5('0x11'));var Papa=require(_0xdeb5('0x12'));var Redis=require('ioredis');var authService=require(_0xdeb5('0x13'));var qs=require(_0xdeb5('0x14'));var as=require(_0xdeb5('0x15'));var hardwareService=require(_0xdeb5('0x16'));var logger=require(_0xdeb5('0x17'))('api');var utils=require(_0xdeb5('0x18'));var config=require(_0xdeb5('0x19'));var licenseUtil=require(_0xdeb5('0x1a'));var db=require(_0xdeb5('0x1b'))['db'];var integrations=require(_0xdeb5('0x1c'));function respondWithStatusCode(_0x1f5db0,_0xe2d742){_0xe2d742=_0xe2d742||0xcc;return function(_0x47ac4e){if(_0x47ac4e){return _0x1f5db0[_0xdeb5('0x1d')](_0xe2d742);}return _0x1f5db0[_0xdeb5('0x1e')](_0xe2d742)[_0xdeb5('0x1f')]();};}function respondWithResult(_0x5f4185,_0x218876){_0x218876=_0x218876||0xc8;return function(_0x3d3f53){if(_0x3d3f53){return _0x5f4185[_0xdeb5('0x1e')](_0x218876)['json'](_0x3d3f53);}};}function respondWithFilteredResult(_0x245120,_0x5139d0){return function(_0x2b962b){if(_0x2b962b){var _0x51079e=typeof _0x5139d0[_0xdeb5('0x20')]===_0xdeb5('0x21')&&typeof _0x5139d0[_0xdeb5('0x22')]===_0xdeb5('0x21');var _0x2a75d5=_0x2b962b[_0xdeb5('0x23')];var _0x219453=_0x51079e?0x0:_0x5139d0[_0xdeb5('0x20')];var _0x2cfed0=_0x51079e?_0x2b962b[_0xdeb5('0x23')]:_0x5139d0[_0xdeb5('0x20')]+_0x5139d0['limit'];var _0x4f58ac;if(_0x2cfed0>=_0x2a75d5){_0x2cfed0=_0x2a75d5;_0x4f58ac=0xc8;}else{_0x4f58ac=0xce;}_0x245120[_0xdeb5('0x1e')](_0x4f58ac);return _0x245120[_0xdeb5('0x24')]('Content-Range',_0x219453+'-'+_0x2cfed0+'/'+_0x2a75d5)['json'](_0x2b962b);}return null;};}function patchUpdates(_0x55994f){return function(_0x5b8b60){try{jsonpatch[_0xdeb5('0x25')](_0x5b8b60,_0x55994f,!![]);}catch(_0x4a7976){return BPromise[_0xdeb5('0x26')](_0x4a7976);}return _0x5b8b60[_0xdeb5('0x27')]();};}function saveUpdates(_0x467be2,_0x2b29c6){return function(_0x5aeadd){if(_0x5aeadd){return _0x5aeadd['update'](_0x467be2)[_0xdeb5('0x28')](function(_0x73270b){return _0x73270b;});}return null;};}function removeEntity(_0x443674,_0xad38b7){return function(_0x20b849){if(_0x20b849){return _0x20b849[_0xdeb5('0x29')]()['then'](function(){_0x443674[_0xdeb5('0x1e')](0xcc)[_0xdeb5('0x1f')]();});}};}function handleEntityNotFound(_0x4aad0,_0x27f854){return function(_0x1b7d50){if(!_0x1b7d50){_0x4aad0[_0xdeb5('0x1d')](0x194);}return _0x1b7d50;};}function handleError(_0x4280ef,_0x431549){_0x431549=_0x431549||0x1f4;return function(_0x3e97f7){logger[_0xdeb5('0x2a')](_0x3e97f7[_0xdeb5('0x2b')]);if(_0x3e97f7[_0xdeb5('0x2c')]){delete _0x3e97f7['name'];}_0x4280ef[_0xdeb5('0x1e')](_0x431549)[_0xdeb5('0x2d')](_0x3e97f7);};}exports[_0xdeb5('0x2e')]=function(_0xc454f8,_0x17f914){var _0x3f50d8={},_0xd25711={},_0x551b69={'count':0x0,'rows':[]};var _0x27b7ee=_[_0xdeb5('0x2f')](db['ServicenowAccount']['rawAttributes'],function(_0x2a540d){return{'name':_0x2a540d[_0xdeb5('0x30')],'type':_0x2a540d[_0xdeb5('0x31')]['key']};});_0xd25711[_0xdeb5('0x32')]=_[_0xdeb5('0x2f')](_0x27b7ee,_0xdeb5('0x2c'));_0xd25711['query']=_[_0xdeb5('0x33')](_0xc454f8['query']);_0xd25711[_0xdeb5('0x34')]=_[_0xdeb5('0x35')](_0xd25711['model'],_0xd25711[_0xdeb5('0x36')]);_0x3f50d8[_0xdeb5('0x37')]=_[_0xdeb5('0x35')](_0xd25711[_0xdeb5('0x32')],qs[_0xdeb5('0x38')](_0xc454f8[_0xdeb5('0x36')][_0xdeb5('0x38')]));_0x3f50d8[_0xdeb5('0x37')]=_0x3f50d8['attributes'][_0xdeb5('0x39')]?_0x3f50d8[_0xdeb5('0x37')]:_0xd25711[_0xdeb5('0x32')];if(!_0xc454f8['query'][_0xdeb5('0x3a')]('nolimit')){_0x3f50d8['limit']=qs['limit'](_0xc454f8['query'][_0xdeb5('0x22')]);_0x3f50d8['offset']=qs['offset'](_0xc454f8[_0xdeb5('0x36')][_0xdeb5('0x20')]);}_0x3f50d8[_0xdeb5('0x3b')]=qs['sort'](_0xc454f8['query']['sort']);_0x3f50d8['where']=qs['filters'](_[_0xdeb5('0x3c')](_0xc454f8[_0xdeb5('0x36')],_0xd25711['filters']),_0x27b7ee);if(_0xc454f8[_0xdeb5('0x36')][_0xdeb5('0x3d')]){_0x3f50d8[_0xdeb5('0x3e')]=_[_0xdeb5('0x3f')](_0x3f50d8['where'],{'$or':_[_0xdeb5('0x2f')](_0x27b7ee,function(_0xbd4e2d){if(_0xbd4e2d[_0xdeb5('0x31')]!=='VIRTUAL'){var _0x2f3d4d={};_0x2f3d4d[_0xbd4e2d[_0xdeb5('0x2c')]]={'$like':'%'+_0xc454f8[_0xdeb5('0x36')][_0xdeb5('0x3d')]+'%'};return _0x2f3d4d;}})});}_0x3f50d8=_[_0xdeb5('0x3f')]({},_0x3f50d8,_0xc454f8[_0xdeb5('0x40')]);var _0x38d36c={'where':_0x3f50d8[_0xdeb5('0x3e')]};return db[_0xdeb5('0x41')][_0xdeb5('0x23')](_0x38d36c)['then'](function(_0x2d225c){_0x551b69[_0xdeb5('0x23')]=_0x2d225c;if(_0xc454f8[_0xdeb5('0x36')][_0xdeb5('0x42')]){_0x3f50d8[_0xdeb5('0x43')]=[{'all':!![]}];}return db[_0xdeb5('0x41')][_0xdeb5('0x44')](_0x3f50d8);})['then'](function(_0x42b649){_0x551b69[_0xdeb5('0x45')]=_0x42b649;return _0x551b69;})[_0xdeb5('0x28')](respondWithFilteredResult(_0x17f914,_0x3f50d8))[_0xdeb5('0x46')](handleError(_0x17f914,null));};exports[_0xdeb5('0x47')]=function(_0x2ce0d2,_0x222fb4){var _0x20c6a2={'raw':![],'where':{'id':_0x2ce0d2[_0xdeb5('0x48')]['id']}},_0x1e2af5={};_0x1e2af5[_0xdeb5('0x32')]=_[_0xdeb5('0x33')](db[_0xdeb5('0x41')][_0xdeb5('0x49')]);_0x1e2af5[_0xdeb5('0x36')]=_[_0xdeb5('0x33')](_0x2ce0d2[_0xdeb5('0x36')]);_0x1e2af5[_0xdeb5('0x34')]=_['intersection'](_0x1e2af5[_0xdeb5('0x32')],_0x1e2af5[_0xdeb5('0x36')]);_0x20c6a2[_0xdeb5('0x37')]=_[_0xdeb5('0x35')](_0x1e2af5['model'],qs['fields'](_0x2ce0d2['query'][_0xdeb5('0x38')]));_0x20c6a2[_0xdeb5('0x37')]=_0x20c6a2[_0xdeb5('0x37')]['length']?_0x20c6a2['attributes']:_0x1e2af5['model'];if(_0x2ce0d2[_0xdeb5('0x36')]['includeAll']){_0x20c6a2[_0xdeb5('0x43')]=[{'all':!![]}];}_0x20c6a2=_[_0xdeb5('0x3f')]({},_0x20c6a2,_0x2ce0d2['options']);return db[_0xdeb5('0x41')][_0xdeb5('0x4a')](_0x20c6a2)[_0xdeb5('0x28')](handleEntityNotFound(_0x222fb4,null))[_0xdeb5('0x28')](respondWithResult(_0x222fb4,null))[_0xdeb5('0x46')](handleError(_0x222fb4,null));};exports['create']=function(_0x555e9e,_0x114387){return db[_0xdeb5('0x41')][_0xdeb5('0x4b')](_0x555e9e[_0xdeb5('0x4c')],{})[_0xdeb5('0x28')](respondWithResult(_0x114387,0xc9))[_0xdeb5('0x46')](handleError(_0x114387,null));};exports[_0xdeb5('0x4d')]=function(_0x5243ff,_0x2854d1){if(_0x5243ff[_0xdeb5('0x4c')]['id']){delete _0x5243ff[_0xdeb5('0x4c')]['id'];}return db[_0xdeb5('0x41')][_0xdeb5('0x4a')]({'where':{'id':_0x5243ff[_0xdeb5('0x48')]['id']}})['then'](handleEntityNotFound(_0x2854d1,null))['then'](saveUpdates(_0x5243ff['body'],null))['then'](respondWithResult(_0x2854d1,null))[_0xdeb5('0x46')](handleError(_0x2854d1,null));};exports[_0xdeb5('0x29')]=function(_0x2fc214,_0x46b4b0){return db[_0xdeb5('0x41')]['find']({'where':{'id':_0x2fc214['params']['id']}})[_0xdeb5('0x28')](handleEntityNotFound(_0x46b4b0,null))['then'](removeEntity(_0x46b4b0,null))[_0xdeb5('0x46')](handleError(_0x46b4b0,null));};exports[_0xdeb5('0x4e')]=function(_0x4e4e26,_0x3a7888,_0x228f0f){var _0xeeea15={};var _0x1de3b3={};var _0x52f426;var _0x25a2b4;return db['ServicenowAccount'][_0xdeb5('0x4f')]({'where':{'id':_0x4e4e26[_0xdeb5('0x48')]['id']}})[_0xdeb5('0x28')](handleEntityNotFound(_0x3a7888,null))[_0xdeb5('0x28')](function(_0x25a28c){if(_0x25a28c){_0x52f426=_0x25a28c;_0x1de3b3[_0xdeb5('0x32')]=_[_0xdeb5('0x33')](db['ServicenowConfiguration']['rawAttributes']);_0x1de3b3['query']=_[_0xdeb5('0x33')](_0x4e4e26[_0xdeb5('0x36')]);_0x1de3b3[_0xdeb5('0x34')]=_['intersection'](_0x1de3b3[_0xdeb5('0x32')],_0x1de3b3[_0xdeb5('0x36')]);_0xeeea15[_0xdeb5('0x37')]=_[_0xdeb5('0x35')](_0x1de3b3[_0xdeb5('0x32')],qs['fields'](_0x4e4e26[_0xdeb5('0x36')][_0xdeb5('0x38')]));_0xeeea15[_0xdeb5('0x37')]=_0xeeea15['attributes'][_0xdeb5('0x39')]?_0xeeea15[_0xdeb5('0x37')]:_0x1de3b3[_0xdeb5('0x32')];_0xeeea15[_0xdeb5('0x3b')]=qs[_0xdeb5('0x50')](_0x4e4e26[_0xdeb5('0x36')][_0xdeb5('0x50')]);_0xeeea15[_0xdeb5('0x3e')]=qs['filters'](_[_0xdeb5('0x3c')](_0x4e4e26[_0xdeb5('0x36')],_0x1de3b3[_0xdeb5('0x34')]));if(_0x4e4e26[_0xdeb5('0x36')][_0xdeb5('0x3d')]){_0xeeea15[_0xdeb5('0x3e')]=_[_0xdeb5('0x3f')](_0xeeea15[_0xdeb5('0x3e')],{'$or':_[_0xdeb5('0x2f')](_0xeeea15[_0xdeb5('0x37')],function(_0x2cb197){var _0x2d82f3={};_0x2d82f3[_0x2cb197]={'$like':'%'+_0x4e4e26[_0xdeb5('0x36')][_0xdeb5('0x3d')]+'%'};return _0x2d82f3;})});}_0xeeea15=_[_0xdeb5('0x3f')]({},_0xeeea15,_0x4e4e26[_0xdeb5('0x40')]);return _0x52f426[_0xdeb5('0x4e')](_0xeeea15);}})['then'](function(_0xfc7162){if(_0xfc7162){_0x25a2b4=_0xfc7162[_0xdeb5('0x39')];if(!_0x4e4e26['query'][_0xdeb5('0x3a')]('nolimit')){_0xeeea15[_0xdeb5('0x22')]=qs[_0xdeb5('0x22')](_0x4e4e26['query'][_0xdeb5('0x22')]);_0xeeea15[_0xdeb5('0x20')]=qs['offset'](_0x4e4e26[_0xdeb5('0x36')]['offset']);}return _0x52f426['getConfigurations'](_0xeeea15);}})[_0xdeb5('0x28')](function(_0x45031a){if(_0x45031a){return _0x45031a?{'count':_0x25a2b4,'rows':_0x45031a}:null;}})[_0xdeb5('0x28')](respondWithResult(_0x3a7888,null))[_0xdeb5('0x46')](handleError(_0x3a7888,null));};exports[_0xdeb5('0x51')]=function(_0x568f5f,_0xa334f0,_0x4c3fda){if(_0x568f5f['body']['id']){delete _0x568f5f[_0xdeb5('0x4c')]['id'];}return db[_0xdeb5('0x41')]['findOne']({'where':{'id':_0x568f5f[_0xdeb5('0x48')]['id']}})[_0xdeb5('0x28')](handleEntityNotFound(_0xa334f0,null))['then'](function(_0x18932e){if(_0x18932e){_0x568f5f[_0xdeb5('0x4c')][_0xdeb5('0x52')]=_0x18932e['id'];_0x568f5f[_0xdeb5('0x4c')][_0xdeb5('0x53')]=integrations['getSubjects'](_0x568f5f['body'][_0xdeb5('0x54')],_0x568f5f[_0xdeb5('0x4c')][_0xdeb5('0x31')]);_0x568f5f[_0xdeb5('0x4c')][_0xdeb5('0x55')]=integrations[_0xdeb5('0x56')](_0x568f5f['body'][_0xdeb5('0x54')],_0x568f5f[_0xdeb5('0x4c')][_0xdeb5('0x31')]);return db[_0xdeb5('0x57')][_0xdeb5('0x4b')](_0x568f5f['body'],{'include':[{'model':db[_0xdeb5('0x58')],'as':_0xdeb5('0x53')},{'model':db[_0xdeb5('0x58')],'as':'Descriptions'}]});}return null;})[_0xdeb5('0x28')](respondWithResult(_0xa334f0,null))['catch'](handleError(_0xa334f0,null));};exports[_0xdeb5('0x59')]=function(_0x4d1f1a,_0x3b90b8,_0x540249){var _0x3bd3d0=[_0xdeb5('0x5a'),_0xdeb5('0x5b'),'knowledge',_0xdeb5('0x5c'),'close_code',_0xdeb5('0x5d'),_0xdeb5('0x5e'),'severity',_0xdeb5('0x5f')];var _0x33406d=[_0xdeb5('0x60'),_0xdeb5('0x5a'),_0xdeb5('0x61'),'watch_list','upon_reject',_0xdeb5('0x62'),_0xdeb5('0x63'),_0xdeb5('0x5b'),_0xdeb5('0x64'),'number',_0xdeb5('0x65'),_0xdeb5('0x66'),'opened_by',_0xdeb5('0x67'),_0xdeb5('0x68'),_0xdeb5('0x69'),_0xdeb5('0x6a'),_0xdeb5('0x6b'),_0xdeb5('0x6c'),'order',_0xdeb5('0x6d'),_0xdeb5('0x6e'),_0xdeb5('0x6f'),_0xdeb5('0x70'),_0xdeb5('0x71'),_0xdeb5('0x72'),_0xdeb5('0x73'),_0xdeb5('0x74'),_0xdeb5('0x75'),_0xdeb5('0x76'),'rfc','time_worked','expected_start',_0xdeb5('0x77'),_0xdeb5('0x78'),_0xdeb5('0x79'),_0xdeb5('0x7a'),_0xdeb5('0x7b'),_0xdeb5('0x7c'),_0xdeb5('0x7d'),_0xdeb5('0x7e'),'subcategory',_0xdeb5('0x7f'),'short_description',_0xdeb5('0x80'),_0xdeb5('0x81'),_0xdeb5('0x82'),_0xdeb5('0x83'),_0xdeb5('0x84'),_0xdeb5('0x85'),'additional_assignee_list',_0xdeb5('0x86'),_0xdeb5('0x87'),'notify',_0xdeb5('0x88'),_0xdeb5('0x89'),'closed_by',_0xdeb5('0x8a'),_0xdeb5('0x8b'),_0xdeb5('0x8c'),_0xdeb5('0x8d'),_0xdeb5('0x8e'),'incident_state',_0xdeb5('0x8f'),_0xdeb5('0x90'),'company',_0xdeb5('0x91'),_0xdeb5('0x92'),_0xdeb5('0x93'),_0xdeb5('0x94'),_0xdeb5('0x95'),'sla_due','approval',_0xdeb5('0x96'),_0xdeb5('0x97'),_0xdeb5('0x98'),_0xdeb5('0x99'),'sys_tags',_0xdeb5('0x9a'),_0xdeb5('0x9b'),'correlation_id',_0xdeb5('0x9c'),_0xdeb5('0x5f')];var _0x229c10='';var _0x502db0='';var _0x5705e5=[];var _0x4f4129='';var _0x216da3='';var _0xf0a4e9=[];var _0x1eb972='';var _0x5c3510='';var _0x2421fd={};var _0x5a46aa='';return db[_0xdeb5('0x41')][_0xdeb5('0x4f')]({'where':{'id':_0x4d1f1a['params']['id']},'attributes':['id',_0xdeb5('0x9d'),_0xdeb5('0x9e'),_0xdeb5('0x9f'),_0xdeb5('0xa0'),_0xdeb5('0xa1')]})[_0xdeb5('0x28')](handleEntityNotFound(_0x3b90b8,null))[_0xdeb5('0x28')](function(_0x1951a3){if(_0x1951a3){_0x5a46aa=_0x1951a3['remoteUri'];var _0x213290=_0x5a46aa[_0xdeb5('0xa2')](-0x1);if(_0x213290==='/'){_0x5a46aa=_0x5a46aa[_0xdeb5('0xa3')](0x0,_0x5a46aa[_0xdeb5('0xa4')](_0x213290));}_0x5c3510=util[_0xdeb5('0xa5')](_0xdeb5('0xa6'),_0x5a46aa);_0x1eb972=util['format'](_0xdeb5('0xa7'),_0x5a46aa);_0x2421fd={'user':_0x1951a3[_0xdeb5('0x9d')],'pass':_0x1951a3[_0xdeb5('0x9e')]};var _0x69acbc={'method':_0xdeb5('0xa8'),'uri':_0x5c3510+_0xdeb5('0xa9'),'auth':_0x2421fd,'json':!![]};return rp(_0x69acbc);}})[_0xdeb5('0x28')](function(_0x42413d){if(_0x42413d[_0xdeb5('0xaa')][_0xdeb5('0x39')]>0x0){_0x229c10=_0x42413d[_0xdeb5('0xaa')];}console[_0xdeb5('0xab')](_0xdeb5('0xac'),_0x229c10);_0xf0a4e9=[];_0x502db0=Object[_0xdeb5('0xad')]([],_0x229c10);_[_0xdeb5('0xae')](_0x502db0,function(_0x31441d){return!_0x3bd3d0[_0xdeb5('0xaf')](_0x31441d[_0xdeb5('0x2c')]);});_0x502db0['forEach'](function(_0x97e0c){var _0x2fa022=createFieldObject(_0x1eb972,_0x2421fd,_0x97e0c[_0xdeb5('0xb0')],_0x97e0c['name'],_0x97e0c[_0xdeb5('0xb1')],![]);_0xf0a4e9[_0xdeb5('0xb2')](_0x2fa022);});return Promise[_0xdeb5('0xb3')](_0xf0a4e9);})[_0xdeb5('0x28')](function(_0x21a2c2){_0x5705e5=_0x21a2c2;_0x4f4129=Object['assign']([],_0x229c10);console[_0xdeb5('0xab')]('TCL:\x20_object',_0x229c10);_[_0xdeb5('0xae')](_0x4f4129,function(_0x431ac3){return _0x33406d[_0xdeb5('0xaf')](_0x431ac3[_0xdeb5('0x2c')]);});console[_0xdeb5('0xab')](_0xdeb5('0xb4'),_0x4f4129);_0xf0a4e9=[];_0x4f4129['forEach'](function(_0x273d98){var _0x6d87e0=createFieldObject(_0x1eb972,_0x2421fd,_0x273d98[_0xdeb5('0xb0')],_0x273d98[_0xdeb5('0x2c')],_0x273d98[_0xdeb5('0xb1')],!![]);_0xf0a4e9[_0xdeb5('0xb2')](_0x6d87e0);});return Promise[_0xdeb5('0xb3')](_0xf0a4e9);})[_0xdeb5('0x28')](function(_0xf81712){_0x216da3=_0xf81712;var _0x334441=_0x5705e5[_0xdeb5('0xb5')](_0x216da3);return{'count':_0x334441[_0xdeb5('0x39')],'rows':_0x334441};})[_0xdeb5('0x28')](respondWithResult(_0x3b90b8,null))['catch'](function(_0x16a5bb){console['log'](_0xdeb5('0xb6')+_0x16a5bb);var _0x9fb540=_0x4d1f1a[_0xdeb5('0x36')][_0xdeb5('0xb7')]?0x1f4:_0x16a5bb[_0xdeb5('0xb8')]||0x1f4;logger[_0xdeb5('0x2a')](_0x16a5bb[_0xdeb5('0x2b')]);delete _0x16a5bb[_0xdeb5('0x2c')];if(_0x9fb540===0x191){_0x9fb540=0x190;}_0x3b90b8[_0xdeb5('0x1e')](_0x9fb540)[_0xdeb5('0x2d')](_0x4d1f1a[_0xdeb5('0x36')][_0xdeb5('0xb7')]?{'message':'Wrong\x20credentials','statusCode':_0x16a5bb[_0xdeb5('0xb8')]}:_0x16a5bb);});};function createFieldObject(_0x47852c,_0x1af164,_0x3541b2,_0x1ca662,_0x5357c8,_0x45a5c0){return new Promise(function(_0x179637,_0x294e22){var _0x1533bf={'id':_0x1ca662,'name':_0x5357c8,'custom':_0x45a5c0};if(_0x3541b2===_0xdeb5('0xb9')){_0x1533bf['options']=[{'name':'True','value':_0xdeb5('0xba')},{'name':_0xdeb5('0xbb'),'value':'false'}];_0x179637(_0x1533bf);}else{var _0x774814={'method':_0xdeb5('0xa8'),'uri':_0x47852c+_0xdeb5('0xbc')+_0x1ca662,'auth':_0x1af164,'json':!![]};return rp(_0x774814)[_0xdeb5('0x28')](function(_0x5a07ba){var _0x41ead0=[];if(_0x5a07ba[_0xdeb5('0xaa')][_0xdeb5('0x39')]>0x0){_0x5a07ba[_0xdeb5('0xaa')]['forEach'](function(_0x4bfbf6){if(_0x4bfbf6[_0xdeb5('0xbd')]==='false'){var _0x22fcdc={'name':_0x4bfbf6['label'],'value':_0x4bfbf6[_0xdeb5('0xbe')]};_0x41ead0[_0xdeb5('0xb2')](_0x22fcdc);}});}_0x1533bf[_0xdeb5('0x40')]=_0x41ead0;if(_0x1533bf[_0xdeb5('0x40')][_0xdeb5('0x39')]>0x0){_0x179637(_0x1533bf);}else{if(_0x45a5c0==![]){_0x179637();}else{_0x179637(_0x1533bf);}}});}});} \ No newline at end of file +var _0x025f=['impact','active','work_notes_list','priority','sys_domain_path','rfc','expected_start','opened_at','group_list','work_end','resolved_at','work_notes','short_description','correlation_display','delivery_task','work_start','assignment_group','business_stc','additional_assignee_list','calendar_duration','notify','sys_class_name','close_notes','closed_by','follow_up','parent_incident','contact_type','reopened_by','incident_state','problem_id','company','activity_due','comments','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','correlation_id','username','password','email','remoteUri','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','incident?sysparm_display_value=all','result','log','assign','remove','includes','internalType','label','push','all','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','concat','ServiceNow\x20error:\x20','statusCode','error','Wrong\x20credentials','boolean','True','true','False','false','sys_choice?sysparm_query=name=incident^element=','forEach','inactive','value','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','limit','apply','reject','update','then','destroy','stack','name','send','map','ServicenowAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','find','catch','create','body','params','findOne','ServicenowConfiguration','options','getConfigurations','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ServicenowField','getFields','made_sla','hold_reason','knowledge','subcategory','close_code','severity','category','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','approval_history','number','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','sys_created_by','calendar_stc','closed_at'];(function(_0x3759ac,_0x6ce119){var _0x55ebda=function(_0x371a2f){while(--_0x371a2f){_0x3759ac['push'](_0x3759ac['shift']());}};_0x55ebda(++_0x6ce119);}(_0x025f,0x109));var _0xf025=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x025f[_0x59ee6f];return _0x4c0979;};'use strict';var emlformat=require(_0xf025('0x0'));var rimraf=require(_0xf025('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf025('0x2'));var rp=require(_0xf025('0x3'));var moment=require(_0xf025('0x4'));var BPromise=require(_0xf025('0x5'));var Mustache=require(_0xf025('0x6'));var util=require('util');var path=require(_0xf025('0x7'));var sox=require(_0xf025('0x8'));var csv=require(_0xf025('0x9'));var ejs=require(_0xf025('0xa'));var fs=require('fs');var fs_extra=require(_0xf025('0xb'));var _=require(_0xf025('0xc'));var squel=require(_0xf025('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf025('0x9'));var querystring=require(_0xf025('0xe'));var Papa=require(_0xf025('0xf'));var Redis=require(_0xf025('0x10'));var authService=require(_0xf025('0x11'));var qs=require(_0xf025('0x12'));var as=require(_0xf025('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf025('0x14'))(_0xf025('0x15'));var utils=require('../../config/utils');var config=require(_0xf025('0x16'));var licenseUtil=require(_0xf025('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0xf025('0x18'));function respondWithStatusCode(_0xdf3f42,_0x26f604){_0x26f604=_0x26f604||0xcc;return function(_0x3b457b){if(_0x3b457b){return _0xdf3f42[_0xf025('0x19')](_0x26f604);}return _0xdf3f42[_0xf025('0x1a')](_0x26f604)[_0xf025('0x1b')]();};}function respondWithResult(_0x563d3b,_0x52b9ba){_0x52b9ba=_0x52b9ba||0xc8;return function(_0x44363c){if(_0x44363c){return _0x563d3b[_0xf025('0x1a')](_0x52b9ba)[_0xf025('0x1c')](_0x44363c);}};}function respondWithFilteredResult(_0x46a326,_0x39d6e8){return function(_0x4c14af){if(_0x4c14af){var _0xb8dd23=typeof _0x39d6e8[_0xf025('0x1d')]===_0xf025('0x1e')&&typeof _0x39d6e8['limit']===_0xf025('0x1e');var _0x491bc1=_0x4c14af[_0xf025('0x1f')];var _0x1fc515=_0xb8dd23?0x0:_0x39d6e8[_0xf025('0x1d')];var _0xb8d32d=_0xb8dd23?_0x4c14af[_0xf025('0x1f')]:_0x39d6e8['offset']+_0x39d6e8[_0xf025('0x20')];var _0xd0e39e;if(_0xb8d32d>=_0x491bc1){_0xb8d32d=_0x491bc1;_0xd0e39e=0xc8;}else{_0xd0e39e=0xce;}_0x46a326[_0xf025('0x1a')](_0xd0e39e);return _0x46a326['set']('Content-Range',_0x1fc515+'-'+_0xb8d32d+'/'+_0x491bc1)['json'](_0x4c14af);}return null;};}function patchUpdates(_0x4b3d5d){return function(_0x55e391){try{jsonpatch[_0xf025('0x21')](_0x55e391,_0x4b3d5d,!![]);}catch(_0x4f07c5){return BPromise[_0xf025('0x22')](_0x4f07c5);}return _0x55e391['save']();};}function saveUpdates(_0x2f95ce,_0x3e298e){return function(_0x5a0b94){if(_0x5a0b94){return _0x5a0b94[_0xf025('0x23')](_0x2f95ce)[_0xf025('0x24')](function(_0xb60ba5){return _0xb60ba5;});}return null;};}function removeEntity(_0x5a8b5d,_0x4e40e0){return function(_0x3820e1){if(_0x3820e1){return _0x3820e1[_0xf025('0x25')]()[_0xf025('0x24')](function(){_0x5a8b5d['status'](0xcc)[_0xf025('0x1b')]();});}};}function handleEntityNotFound(_0x49e13a,_0x17c729){return function(_0x464940){if(!_0x464940){_0x49e13a['sendStatus'](0x194);}return _0x464940;};}function handleError(_0x487dbf,_0x5a7096){_0x5a7096=_0x5a7096||0x1f4;return function(_0x34decc){logger['error'](_0x34decc[_0xf025('0x26')]);if(_0x34decc[_0xf025('0x27')]){delete _0x34decc[_0xf025('0x27')];}_0x487dbf[_0xf025('0x1a')](_0x5a7096)[_0xf025('0x28')](_0x34decc);};}exports['index']=function(_0x339566,_0x3a9a98){var _0x4c645f={},_0x8e0dc6={},_0x15b13a={'count':0x0,'rows':[]};var _0xf70cc=_[_0xf025('0x29')](db[_0xf025('0x2a')][_0xf025('0x2b')],function(_0x277f57){return{'name':_0x277f57[_0xf025('0x2c')],'type':_0x277f57[_0xf025('0x2d')][_0xf025('0x2e')]};});_0x8e0dc6[_0xf025('0x2f')]=_['map'](_0xf70cc,_0xf025('0x27'));_0x8e0dc6[_0xf025('0x30')]=_[_0xf025('0x31')](_0x339566[_0xf025('0x30')]);_0x8e0dc6[_0xf025('0x32')]=_[_0xf025('0x33')](_0x8e0dc6['model'],_0x8e0dc6[_0xf025('0x30')]);_0x4c645f[_0xf025('0x34')]=_[_0xf025('0x33')](_0x8e0dc6[_0xf025('0x2f')],qs[_0xf025('0x35')](_0x339566['query']['fields']));_0x4c645f[_0xf025('0x34')]=_0x4c645f['attributes'][_0xf025('0x36')]?_0x4c645f['attributes']:_0x8e0dc6[_0xf025('0x2f')];if(!_0x339566[_0xf025('0x30')]['hasOwnProperty'](_0xf025('0x37'))){_0x4c645f['limit']=qs[_0xf025('0x20')](_0x339566['query'][_0xf025('0x20')]);_0x4c645f[_0xf025('0x1d')]=qs[_0xf025('0x1d')](_0x339566['query'][_0xf025('0x1d')]);}_0x4c645f[_0xf025('0x38')]=qs[_0xf025('0x39')](_0x339566[_0xf025('0x30')][_0xf025('0x39')]);_0x4c645f[_0xf025('0x3a')]=qs['filters'](_[_0xf025('0x3b')](_0x339566[_0xf025('0x30')],_0x8e0dc6['filters']),_0xf70cc);if(_0x339566[_0xf025('0x30')][_0xf025('0x3c')]){_0x4c645f[_0xf025('0x3a')]=_[_0xf025('0x3d')](_0x4c645f[_0xf025('0x3a')],{'$or':_[_0xf025('0x29')](_0xf70cc,function(_0x745fa6){if(_0x745fa6[_0xf025('0x2d')]!==_0xf025('0x3e')){var _0x2d66ee={};_0x2d66ee[_0x745fa6[_0xf025('0x27')]]={'$like':'%'+_0x339566[_0xf025('0x30')]['filter']+'%'};return _0x2d66ee;}})});}_0x4c645f=_[_0xf025('0x3d')]({},_0x4c645f,_0x339566['options']);var _0x8e65b7={'where':_0x4c645f[_0xf025('0x3a')]};return db[_0xf025('0x2a')]['count'](_0x8e65b7)[_0xf025('0x24')](function(_0x87482f){_0x15b13a[_0xf025('0x1f')]=_0x87482f;if(_0x339566['query'][_0xf025('0x3f')]){_0x4c645f[_0xf025('0x40')]=[{'all':!![]}];}return db[_0xf025('0x2a')][_0xf025('0x41')](_0x4c645f);})['then'](function(_0x31c122){_0x15b13a['rows']=_0x31c122;return _0x15b13a;})[_0xf025('0x24')](respondWithFilteredResult(_0x3a9a98,_0x4c645f))['catch'](handleError(_0x3a9a98,null));};exports['show']=function(_0x109e2a,_0x4b71cc){var _0x274560={'raw':![],'where':{'id':_0x109e2a['params']['id']}},_0x314a73={};_0x314a73['model']=_[_0xf025('0x31')](db['ServicenowAccount'][_0xf025('0x2b')]);_0x314a73[_0xf025('0x30')]=_[_0xf025('0x31')](_0x109e2a[_0xf025('0x30')]);_0x314a73[_0xf025('0x32')]=_[_0xf025('0x33')](_0x314a73['model'],_0x314a73[_0xf025('0x30')]);_0x274560['attributes']=_[_0xf025('0x33')](_0x314a73['model'],qs[_0xf025('0x35')](_0x109e2a[_0xf025('0x30')][_0xf025('0x35')]));_0x274560[_0xf025('0x34')]=_0x274560[_0xf025('0x34')][_0xf025('0x36')]?_0x274560['attributes']:_0x314a73[_0xf025('0x2f')];if(_0x109e2a[_0xf025('0x30')]['includeAll']){_0x274560[_0xf025('0x40')]=[{'all':!![]}];}_0x274560=_[_0xf025('0x3d')]({},_0x274560,_0x109e2a['options']);return db[_0xf025('0x2a')][_0xf025('0x42')](_0x274560)['then'](handleEntityNotFound(_0x4b71cc,null))['then'](respondWithResult(_0x4b71cc,null))[_0xf025('0x43')](handleError(_0x4b71cc,null));};exports[_0xf025('0x44')]=function(_0x215fbf,_0x4c61d0){return db[_0xf025('0x2a')][_0xf025('0x44')](_0x215fbf[_0xf025('0x45')],{})[_0xf025('0x24')](respondWithResult(_0x4c61d0,0xc9))[_0xf025('0x43')](handleError(_0x4c61d0,null));};exports[_0xf025('0x23')]=function(_0x56bee6,_0x58285e){if(_0x56bee6[_0xf025('0x45')]['id']){delete _0x56bee6['body']['id'];}return db[_0xf025('0x2a')]['find']({'where':{'id':_0x56bee6[_0xf025('0x46')]['id']}})[_0xf025('0x24')](handleEntityNotFound(_0x58285e,null))[_0xf025('0x24')](saveUpdates(_0x56bee6[_0xf025('0x45')],null))[_0xf025('0x24')](respondWithResult(_0x58285e,null))[_0xf025('0x43')](handleError(_0x58285e,null));};exports[_0xf025('0x25')]=function(_0x5bf562,_0x1a8143){return db[_0xf025('0x2a')][_0xf025('0x42')]({'where':{'id':_0x5bf562[_0xf025('0x46')]['id']}})['then'](handleEntityNotFound(_0x1a8143,null))[_0xf025('0x24')](removeEntity(_0x1a8143,null))[_0xf025('0x43')](handleError(_0x1a8143,null));};exports['getConfigurations']=function(_0x58608e,_0x1c7e87,_0x1e85ee){var _0x415f25={};var _0x38523f={};var _0x51e116;var _0x23ff65;return db['ServicenowAccount'][_0xf025('0x47')]({'where':{'id':_0x58608e[_0xf025('0x46')]['id']}})[_0xf025('0x24')](handleEntityNotFound(_0x1c7e87,null))[_0xf025('0x24')](function(_0x129c9c){if(_0x129c9c){_0x51e116=_0x129c9c;_0x38523f[_0xf025('0x2f')]=_[_0xf025('0x31')](db[_0xf025('0x48')][_0xf025('0x2b')]);_0x38523f[_0xf025('0x30')]=_[_0xf025('0x31')](_0x58608e[_0xf025('0x30')]);_0x38523f['filters']=_[_0xf025('0x33')](_0x38523f[_0xf025('0x2f')],_0x38523f[_0xf025('0x30')]);_0x415f25['attributes']=_[_0xf025('0x33')](_0x38523f[_0xf025('0x2f')],qs[_0xf025('0x35')](_0x58608e['query']['fields']));_0x415f25[_0xf025('0x34')]=_0x415f25[_0xf025('0x34')][_0xf025('0x36')]?_0x415f25[_0xf025('0x34')]:_0x38523f[_0xf025('0x2f')];_0x415f25[_0xf025('0x38')]=qs[_0xf025('0x39')](_0x58608e[_0xf025('0x30')][_0xf025('0x39')]);_0x415f25[_0xf025('0x3a')]=qs['filters'](_[_0xf025('0x3b')](_0x58608e[_0xf025('0x30')],_0x38523f[_0xf025('0x32')]));if(_0x58608e[_0xf025('0x30')][_0xf025('0x3c')]){_0x415f25[_0xf025('0x3a')]=_['merge'](_0x415f25[_0xf025('0x3a')],{'$or':_[_0xf025('0x29')](_0x415f25[_0xf025('0x34')],function(_0x2ff1f8){var _0x401c67={};_0x401c67[_0x2ff1f8]={'$like':'%'+_0x58608e[_0xf025('0x30')]['filter']+'%'};return _0x401c67;})});}_0x415f25=_[_0xf025('0x3d')]({},_0x415f25,_0x58608e[_0xf025('0x49')]);return _0x51e116[_0xf025('0x4a')](_0x415f25);}})[_0xf025('0x24')](function(_0x353788){if(_0x353788){_0x23ff65=_0x353788[_0xf025('0x36')];if(!_0x58608e[_0xf025('0x30')][_0xf025('0x4b')](_0xf025('0x37'))){_0x415f25[_0xf025('0x20')]=qs[_0xf025('0x20')](_0x58608e['query'][_0xf025('0x20')]);_0x415f25[_0xf025('0x1d')]=qs[_0xf025('0x1d')](_0x58608e['query'][_0xf025('0x1d')]);}return _0x51e116[_0xf025('0x4a')](_0x415f25);}})['then'](function(_0x56ee45){if(_0x56ee45){return _0x56ee45?{'count':_0x23ff65,'rows':_0x56ee45}:null;}})[_0xf025('0x24')](respondWithResult(_0x1c7e87,null))[_0xf025('0x43')](handleError(_0x1c7e87,null));};exports[_0xf025('0x4c')]=function(_0x3dc9e4,_0x56ccd2,_0x5e1561){if(_0x3dc9e4[_0xf025('0x45')]['id']){delete _0x3dc9e4[_0xf025('0x45')]['id'];}return db[_0xf025('0x2a')][_0xf025('0x47')]({'where':{'id':_0x3dc9e4[_0xf025('0x46')]['id']}})[_0xf025('0x24')](handleEntityNotFound(_0x56ccd2,null))[_0xf025('0x24')](function(_0x1d4cde){if(_0x1d4cde){_0x3dc9e4['body'][_0xf025('0x4d')]=_0x1d4cde['id'];_0x3dc9e4[_0xf025('0x45')][_0xf025('0x4e')]=integrations[_0xf025('0x4f')](_0x3dc9e4[_0xf025('0x45')][_0xf025('0x50')],_0x3dc9e4[_0xf025('0x45')][_0xf025('0x2d')]);_0x3dc9e4[_0xf025('0x45')][_0xf025('0x51')]=integrations[_0xf025('0x52')](_0x3dc9e4[_0xf025('0x45')][_0xf025('0x50')],_0x3dc9e4[_0xf025('0x45')][_0xf025('0x2d')]);return db[_0xf025('0x48')]['create'](_0x3dc9e4[_0xf025('0x45')],{'include':[{'model':db[_0xf025('0x53')],'as':_0xf025('0x4e')},{'model':db[_0xf025('0x53')],'as':_0xf025('0x51')}]});}return null;})[_0xf025('0x24')](respondWithResult(_0x56ccd2,null))[_0xf025('0x43')](handleError(_0x56ccd2,null));};exports[_0xf025('0x54')]=function(_0x58fa77,_0x370ba9,_0x34a894){var _0x515210=[_0xf025('0x55'),_0xf025('0x56'),_0xf025('0x57'),_0xf025('0x58'),_0xf025('0x59'),'notify','incident_state',_0xf025('0x5a'),_0xf025('0x5b')];var _0x15fee2=['parent',_0xf025('0x55'),_0xf025('0x5c'),_0xf025('0x5d'),_0xf025('0x5e'),_0xf025('0x5f'),_0xf025('0x60'),'hold_reason',_0xf025('0x61'),_0xf025('0x62'),'resolved_by',_0xf025('0x63'),_0xf025('0x64'),_0xf025('0x65'),_0xf025('0x66'),_0xf025('0x67'),'state',_0xf025('0x68'),_0xf025('0x57'),'order',_0xf025('0x69'),_0xf025('0x6a'),'cmdb_ci','delivery_plan',_0xf025('0x6b'),_0xf025('0x6c'),_0xf025('0x6d'),'business_service',_0xf025('0x6e'),_0xf025('0x6f'),_0xf025('0x70'),'time_worked',_0xf025('0x71'),_0xf025('0x72'),'business_duration',_0xf025('0x73'),_0xf025('0x74'),'reopened_time',_0xf025('0x75'),'caller_id','approval_set',_0xf025('0x58'),_0xf025('0x76'),_0xf025('0x77'),'close_code',_0xf025('0x78'),_0xf025('0x79'),_0xf025('0x7a'),_0xf025('0x7b'),_0xf025('0x7c'),_0xf025('0x7d'),'description',_0xf025('0x7e'),_0xf025('0x7f'),_0xf025('0x80'),_0xf025('0x81'),_0xf025('0x82'),_0xf025('0x83'),_0xf025('0x84'),'sys_id',_0xf025('0x85'),_0xf025('0x86'),_0xf025('0x87'),'urgency',_0xf025('0x88'),_0xf025('0x89'),'reassignment_count',_0xf025('0x8a'),'assigned_to',_0xf025('0x5a'),_0xf025('0x8b'),_0xf025('0x8c'),_0xf025('0x8d'),_0xf025('0x8e'),_0xf025('0x8f'),_0xf025('0x90'),_0xf025('0x91'),_0xf025('0x92'),_0xf025('0x93'),_0xf025('0x94'),_0xf025('0x95'),'location',_0xf025('0x5b')];var _0x5791fc='';var _0x169306='';var _0x4ef18d=[];var _0x2e7622='';var _0x25f588='';var _0x42e1f8=[];var _0x4a0fea='';var _0xf17a51='';var _0xb988f9={};var _0x2e92b3='';return db[_0xf025('0x2a')]['findOne']({'where':{'id':_0x58fa77['params']['id']},'attributes':['id',_0xf025('0x96'),_0xf025('0x97'),_0xf025('0x98'),_0xf025('0x99'),'serverUrl']})[_0xf025('0x24')](handleEntityNotFound(_0x370ba9,null))[_0xf025('0x24')](function(_0x319432){if(_0x319432){_0x2e92b3=_0x319432[_0xf025('0x99')];var _0xb3e56d=_0x2e92b3[_0xf025('0x9a')](-0x1);if(_0xb3e56d==='/'){_0x2e92b3=_0x2e92b3[_0xf025('0x9b')](0x0,_0x2e92b3[_0xf025('0x9c')](_0xb3e56d));}_0xf17a51=util[_0xf025('0x9d')](_0xf025('0x9e'),_0x2e92b3);_0x4a0fea=util[_0xf025('0x9d')](_0xf025('0x9f'),_0x2e92b3);_0xb988f9={'user':_0x319432[_0xf025('0x96')],'pass':_0x319432['password']};var _0x335802={'method':'GET','uri':_0xf17a51+_0xf025('0xa0'),'auth':_0xb988f9,'json':!![]};return rp(_0x335802);}})[_0xf025('0x24')](function(_0x309f2d){if(_0x309f2d[_0xf025('0xa1')]['length']>0x0){_0x5791fc=_0x309f2d['result'];}console[_0xf025('0xa2')]('incident\x20table\x20objects',_0x5791fc);_0x42e1f8=[];_0x169306=Object[_0xf025('0xa3')]([],_0x5791fc);_[_0xf025('0xa4')](_0x169306,function(_0x24e504){return!_0x515210[_0xf025('0xa5')](_0x24e504[_0xf025('0x27')]);});_0x169306['forEach'](function(_0x444bb3){var _0x5c97fd=createFieldObject(_0x4a0fea,_0xb988f9,_0x444bb3[_0xf025('0xa6')],_0x444bb3[_0xf025('0x27')],_0x444bb3[_0xf025('0xa7')],![]);_0x42e1f8[_0xf025('0xa8')](_0x5c97fd);});return Promise[_0xf025('0xa9')](_0x42e1f8);})[_0xf025('0x24')](function(_0x26efd5){_0x4ef18d=_0x26efd5;_0x2e7622=Object['assign']([],_0x5791fc);console[_0xf025('0xa2')](_0xf025('0xaa'),_0x5791fc);_['remove'](_0x2e7622,function(_0x2e2086){return _0x15fee2[_0xf025('0xa5')](_0x2e2086[_0xf025('0x27')]);});console[_0xf025('0xa2')](_0xf025('0xab'),_0x2e7622);_0x42e1f8=[];_0x2e7622['forEach'](function(_0x1e14c7){var _0x5d8e56=createFieldObject(_0x4a0fea,_0xb988f9,_0x1e14c7[_0xf025('0xa6')],_0x1e14c7[_0xf025('0x27')],_0x1e14c7['label'],!![]);_0x42e1f8[_0xf025('0xa8')](_0x5d8e56);});return Promise['all'](_0x42e1f8);})[_0xf025('0x24')](function(_0x29616f){_0x25f588=_0x29616f;var _0x33ccb2=_0x4ef18d[_0xf025('0xac')](_0x25f588);return{'count':_0x33ccb2[_0xf025('0x36')],'rows':_0x33ccb2};})['then'](respondWithResult(_0x370ba9,null))['catch'](function(_0x12124d){console[_0xf025('0xa2')](_0xf025('0xad')+_0x12124d);var _0x5b5579=_0x58fa77[_0xf025('0x30')]['test']?0x1f4:_0x12124d[_0xf025('0xae')]||0x1f4;logger[_0xf025('0xaf')](_0x12124d[_0xf025('0x26')]);delete _0x12124d[_0xf025('0x27')];if(_0x5b5579===0x191){_0x5b5579=0x190;}_0x370ba9[_0xf025('0x1a')](_0x5b5579)[_0xf025('0x28')](_0x58fa77['query']['test']?{'message':_0xf025('0xb0'),'statusCode':_0x12124d[_0xf025('0xae')]}:_0x12124d);});};function createFieldObject(_0x5ccb37,_0xf4e330,_0x5b9bbf,_0x2e6ffb,_0x2e92cd,_0x28c1b5){return new Promise(function(_0x309564,_0x276240){var _0x5e46ca={'id':_0x2e6ffb,'name':_0x2e92cd,'custom':_0x28c1b5};if(_0x5b9bbf===_0xf025('0xb1')){_0x5e46ca['options']=[{'name':_0xf025('0xb2'),'value':_0xf025('0xb3')},{'name':_0xf025('0xb4'),'value':_0xf025('0xb5')}];_0x309564(_0x5e46ca);}else{var _0x37122d={'method':'GET','uri':_0x5ccb37+_0xf025('0xb6')+_0x2e6ffb,'auth':_0xf4e330,'json':!![]};return rp(_0x37122d)[_0xf025('0x24')](function(_0xd8a58a){var _0x70cc92=[];if(_0xd8a58a[_0xf025('0xa1')]['length']>0x0){_0xd8a58a[_0xf025('0xa1')][_0xf025('0xb7')](function(_0x405e78){if(_0x405e78[_0xf025('0xb8')]===_0xf025('0xb5')){var _0x3081c7={'name':_0x405e78[_0xf025('0xa7')],'value':_0x405e78[_0xf025('0xb9')]};_0x70cc92['push'](_0x3081c7);}});}_0x5e46ca[_0xf025('0x49')]=_0x70cc92;if(_0x5e46ca['options'][_0xf025('0x36')]>0x0){_0x309564(_0x5e46ca);}else{if(_0x28c1b5==![]){_0x309564();}else{_0x309564(_0x5e46ca);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 078f436..a670df7 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 _0xba34=['./intServicenowAccount.attributes','../../components/integrations/configuration','exports','ServicenowAccount','int_servicenow_accounts','lodash','util','../../config/logger','api','moment','rimraf','../../config/environment'];(function(_0x48f836,_0x36683d){var _0x3e05e8=function(_0x3b5320){while(--_0x3b5320){_0x48f836['push'](_0x48f836['shift']());}};_0x3e05e8(++_0x36683d);}(_0xba34,0x119));var _0x4ba3=function(_0x54afdb,_0x38ebd5){_0x54afdb=_0x54afdb-0x0;var _0x38f321=_0xba34[_0x54afdb];return _0x38f321;};'use strict';var _=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var logger=require(_0x4ba3('0x2'))(_0x4ba3('0x3'));var moment=require(_0x4ba3('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4ba3('0x5'));var config=require(_0x4ba3('0x6'));var attributes=require(_0x4ba3('0x7'));var integrations=require(_0x4ba3('0x8'));module[_0x4ba3('0x9')]=function(_0xb88621,_0xe5f99a){return _0xb88621['define'](_0x4ba3('0xa'),attributes,{'tableName':_0x4ba3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7c09=['rimraf','../../config/environment','./intServicenowAccount.attributes','define','ServicenowAccount','int_servicenow_accounts','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x28da10,_0x29470c){var _0x298372=function(_0x4acba9){while(--_0x4acba9){_0x28da10['push'](_0x28da10['shift']());}};_0x298372(++_0x29470c);}(_0x7c09,0x102));var _0x97c0=function(_0x2faa4d,_0x27697b){_0x2faa4d=_0x2faa4d-0x0;var _0x33dc59=_0x7c09[_0x2faa4d];return _0x33dc59;};'use strict';var _=require('lodash');var util=require(_0x97c0('0x0'));var logger=require(_0x97c0('0x1'))('api');var moment=require(_0x97c0('0x2'));var BPromise=require(_0x97c0('0x3'));var rp=require(_0x97c0('0x4'));var fs=require('fs');var path=require(_0x97c0('0x5'));var rimraf=require(_0x97c0('0x6'));var config=require(_0x97c0('0x7'));var attributes=require(_0x97c0('0x8'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x590368,_0x46fdd9){return _0x590368[_0x97c0('0x9')](_0x97c0('0xa'),attributes,{'tableName':_0x97c0('0xb'),'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 7017993..a5c6d2b 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 _0x8489=['where','limit','include','map','model','GetServicenowAccount','ShowServicenowAccount','find','raw','attributes','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','ServicenowAccount','findAll','options'];(function(_0x4c6d19,_0x149f70){var _0x40b6c7=function(_0x258143){while(--_0x258143){_0x4c6d19['push'](_0x4c6d19['shift']());}};_0x40b6c7(++_0x149f70);}(_0x8489,0x92));var _0x9848=function(_0x5a1385,_0x529ce7){_0x5a1385=_0x5a1385-0x0;var _0x57221d=_0x8489[_0x5a1385];return _0x57221d;};'use strict';var _=require(_0x9848('0x0'));var util=require(_0x9848('0x1'));var moment=require(_0x9848('0x2'));var BPromise=require(_0x9848('0x3'));var rs=require(_0x9848('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9848('0x5'))['db'];var utils=require(_0x9848('0x6'));var logger=require(_0x9848('0x7'))(_0x9848('0x8'));var config=require(_0x9848('0x9'));var jayson=require(_0x9848('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3e8d31,_0x389086,_0x389066){return new BPromise(function(_0x5ca2d9,_0x4dcd64){return client['request'](_0x3e8d31,_0x389066)[_0x9848('0xb')](function(_0x1dcbae){logger[_0x9848('0xc')](_0x9848('0xd'),_0x389086,_0x9848('0xe'));logger[_0x9848('0xf')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x389086,_0x9848('0xe'),JSON[_0x9848('0x10')](_0x1dcbae));if(_0x1dcbae[_0x9848('0x11')]){if(_0x1dcbae[_0x9848('0x11')]['code']===0x1f4){logger[_0x9848('0x11')](_0x9848('0xd'),_0x389086,_0x1dcbae[_0x9848('0x11')][_0x9848('0x12')]);return _0x4dcd64(_0x1dcbae['error'][_0x9848('0x12')]);}logger[_0x9848('0x11')](_0x9848('0xd'),_0x389086,_0x1dcbae[_0x9848('0x11')][_0x9848('0x12')]);return _0x5ca2d9(_0x1dcbae['error']['message']);}else{logger[_0x9848('0xc')]('ServicenowAccount,\x20%s,\x20%s',_0x389086,_0x9848('0xe'));_0x5ca2d9(_0x1dcbae[_0x9848('0x13')]['message']);}})[_0x9848('0x14')](function(_0x3b8211){logger[_0x9848('0x11')](_0x9848('0xd'),_0x389086,_0x3b8211);_0x4dcd64(_0x3b8211);});});}exports['GetServicenowAccount']=function(_0x1a601a){var _0x3c7438=this;return new Promise(function(_0x4364e6,_0x2ec5f9){return db[_0x9848('0x15')][_0x9848('0x16')]({'raw':_0x1a601a['options']?_0x1a601a[_0x9848('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x1a601a[_0x9848('0x17')]?_0x1a601a[_0x9848('0x17')][_0x9848('0x18')]||null:null,'attributes':_0x1a601a[_0x9848('0x17')]?_0x1a601a[_0x9848('0x17')]['attributes']||null:null,'limit':_0x1a601a[_0x9848('0x17')]?_0x1a601a[_0x9848('0x17')][_0x9848('0x19')]||null:null,'include':_0x1a601a[_0x9848('0x17')]?_0x1a601a['options'][_0x9848('0x1a')]?_[_0x9848('0x1b')](_0x1a601a['options']['include'],function(_0x225df0){return{'model':db[_0x225df0[_0x9848('0x1c')]],'as':_0x225df0['as'],'attributes':_0x225df0['attributes'],'include':_0x225df0['include']?_[_0x9848('0x1b')](_0x225df0[_0x9848('0x1a')],function(_0xfcdd9c){return{'model':db[_0xfcdd9c[_0x9848('0x1c')]],'as':_0xfcdd9c['as'],'attributes':_0xfcdd9c['attributes'],'include':_0xfcdd9c[_0x9848('0x1a')]?_['map'](_0xfcdd9c[_0x9848('0x1a')],function(_0x1ce015){return{'model':db[_0x1ce015[_0x9848('0x1c')]],'as':_0x1ce015['as'],'attributes':_0x1ce015['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xe8d09d){logger[_0x9848('0xc')]('GetServicenowAccount',_0x1a601a);logger[_0x9848('0xf')](_0x9848('0x1d'),_0x1a601a,JSON['stringify'](_0xe8d09d));_0x4364e6(_0xe8d09d);})[_0x9848('0x14')](function(_0x5afcbf){logger['error'](_0x9848('0x1d'),_0x5afcbf[_0x9848('0x12')],_0x1a601a);_0x2ec5f9(_0x3c7438[_0x9848('0x11')](0x1f4,_0x5afcbf[_0x9848('0x12')]));});});};exports[_0x9848('0x1e')]=function(_0x29d012){var _0x2f8bae=this;return new Promise(function(_0x5480b0,_0x5c7b19){return db['ServicenowAccount'][_0x9848('0x1f')]({'raw':_0x29d012['options']?_0x29d012[_0x9848('0x17')][_0x9848('0x20')]===undefined?!![]:![]:!![],'where':_0x29d012[_0x9848('0x17')]?_0x29d012[_0x9848('0x17')][_0x9848('0x18')]||null:null,'attributes':_0x29d012['options']?_0x29d012[_0x9848('0x17')]['attributes']||null:null,'include':_0x29d012['options']?_0x29d012[_0x9848('0x17')][_0x9848('0x1a')]?_[_0x9848('0x1b')](_0x29d012['options']['include'],function(_0x3bf4bc){return{'model':db[_0x3bf4bc['model']],'as':_0x3bf4bc['as'],'attributes':_0x3bf4bc[_0x9848('0x21')],'include':_0x3bf4bc['include']?_[_0x9848('0x1b')](_0x3bf4bc[_0x9848('0x1a')],function(_0x3d986f){return{'model':db[_0x3d986f['model']],'as':_0x3d986f['as'],'attributes':_0x3d986f[_0x9848('0x21')],'include':_0x3d986f[_0x9848('0x1a')]?_[_0x9848('0x1b')](_0x3d986f['include'],function(_0x6915f4){return{'model':db[_0x6915f4[_0x9848('0x1c')]],'as':_0x6915f4['as'],'attributes':_0x6915f4[_0x9848('0x21')]};}):[]};}):[]};}):[]:[]})[_0x9848('0xb')](function(_0x556f8a){logger[_0x9848('0xc')](_0x9848('0x1e'),_0x29d012);logger[_0x9848('0xf')](_0x9848('0x1e'),_0x29d012,JSON[_0x9848('0x10')](_0x556f8a));_0x5480b0(_0x556f8a);})[_0x9848('0x14')](function(_0x1f1aaf){logger[_0x9848('0x11')](_0x9848('0x1e'),_0x1f1aaf['message'],_0x29d012);_0x5c7b19(_0x2f8bae['error'](0x1f4,_0x1f1aaf['message']));});});}; \ No newline at end of file +var _0x2b0b=['map','model','ShowServicenowAccount','ServicenowAccount','find','where','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ServicenowAccount,\x20%s,\x20%s','message','result','catch','GetServicenowAccount','findAll','options','raw','attributes','limit','include'];(function(_0x1f43be,_0x1906d1){var _0x24a829=function(_0x30215e){while(--_0x30215e){_0x1f43be['push'](_0x1f43be['shift']());}};_0x24a829(++_0x1906d1);}(_0x2b0b,0xde));var _0xb2b0=function(_0x3e9425,_0x3621ca){_0x3e9425=_0x3e9425-0x0;var _0x3db337=_0x2b0b[_0x3e9425];return _0x3db337;};'use strict';var _=require(_0xb2b0('0x0'));var util=require(_0xb2b0('0x1'));var moment=require('moment');var BPromise=require(_0xb2b0('0x2'));var rs=require(_0xb2b0('0x3'));var fs=require('fs');var Redis=require(_0xb2b0('0x4'));var db=require(_0xb2b0('0x5'))['db'];var utils=require(_0xb2b0('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xb2b0('0x7'));var jayson=require(_0xb2b0('0x8'));var client=jayson[_0xb2b0('0x9')][_0xb2b0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b99fd,_0x3275d4,_0x267004){return new BPromise(function(_0x1c766b,_0x4b5ea5){return client['request'](_0x4b99fd,_0x267004)[_0xb2b0('0xb')](function(_0x212320){logger[_0xb2b0('0xc')]('ServicenowAccount,\x20%s,\x20%s',_0x3275d4,_0xb2b0('0xd'));logger[_0xb2b0('0xe')](_0xb2b0('0xf'),_0x3275d4,'request\x20sent',JSON[_0xb2b0('0x10')](_0x212320));if(_0x212320[_0xb2b0('0x11')]){if(_0x212320[_0xb2b0('0x11')][_0xb2b0('0x12')]===0x1f4){logger[_0xb2b0('0x11')](_0xb2b0('0x13'),_0x3275d4,_0x212320[_0xb2b0('0x11')]['message']);return _0x4b5ea5(_0x212320[_0xb2b0('0x11')][_0xb2b0('0x14')]);}logger[_0xb2b0('0x11')](_0xb2b0('0x13'),_0x3275d4,_0x212320['error'][_0xb2b0('0x14')]);return _0x1c766b(_0x212320[_0xb2b0('0x11')][_0xb2b0('0x14')]);}else{logger['info']('ServicenowAccount,\x20%s,\x20%s',_0x3275d4,_0xb2b0('0xd'));_0x1c766b(_0x212320[_0xb2b0('0x15')]['message']);}})[_0xb2b0('0x16')](function(_0x2fa021){logger[_0xb2b0('0x11')](_0xb2b0('0x13'),_0x3275d4,_0x2fa021);_0x4b5ea5(_0x2fa021);});});}exports[_0xb2b0('0x17')]=function(_0x3ebf57){var _0x2299bd=this;return new Promise(function(_0x49c44b,_0xa39bb3){return db['ServicenowAccount'][_0xb2b0('0x18')]({'raw':_0x3ebf57[_0xb2b0('0x19')]?_0x3ebf57[_0xb2b0('0x19')][_0xb2b0('0x1a')]===undefined?!![]:![]:!![],'where':_0x3ebf57[_0xb2b0('0x19')]?_0x3ebf57[_0xb2b0('0x19')]['where']||null:null,'attributes':_0x3ebf57[_0xb2b0('0x19')]?_0x3ebf57['options'][_0xb2b0('0x1b')]||null:null,'limit':_0x3ebf57[_0xb2b0('0x19')]?_0x3ebf57[_0xb2b0('0x19')][_0xb2b0('0x1c')]||null:null,'include':_0x3ebf57[_0xb2b0('0x19')]?_0x3ebf57[_0xb2b0('0x19')][_0xb2b0('0x1d')]?_[_0xb2b0('0x1e')](_0x3ebf57['options']['include'],function(_0x2033b5){return{'model':db[_0x2033b5[_0xb2b0('0x1f')]],'as':_0x2033b5['as'],'attributes':_0x2033b5[_0xb2b0('0x1b')],'include':_0x2033b5[_0xb2b0('0x1d')]?_['map'](_0x2033b5[_0xb2b0('0x1d')],function(_0x271b8b){return{'model':db[_0x271b8b[_0xb2b0('0x1f')]],'as':_0x271b8b['as'],'attributes':_0x271b8b[_0xb2b0('0x1b')],'include':_0x271b8b['include']?_[_0xb2b0('0x1e')](_0x271b8b['include'],function(_0xe8cce3){return{'model':db[_0xe8cce3['model']],'as':_0xe8cce3['as'],'attributes':_0xe8cce3[_0xb2b0('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xb2b0('0xb')](function(_0x5cf62d){logger[_0xb2b0('0xc')](_0xb2b0('0x17'),_0x3ebf57);logger['debug'](_0xb2b0('0x17'),_0x3ebf57,JSON[_0xb2b0('0x10')](_0x5cf62d));_0x49c44b(_0x5cf62d);})[_0xb2b0('0x16')](function(_0x139083){logger[_0xb2b0('0x11')](_0xb2b0('0x17'),_0x139083[_0xb2b0('0x14')],_0x3ebf57);_0xa39bb3(_0x2299bd[_0xb2b0('0x11')](0x1f4,_0x139083[_0xb2b0('0x14')]));});});};exports[_0xb2b0('0x20')]=function(_0x1f3301){var _0x519f8a=this;return new Promise(function(_0x410894,_0x165d62){return db[_0xb2b0('0x21')][_0xb2b0('0x22')]({'raw':_0x1f3301[_0xb2b0('0x19')]?_0x1f3301['options'][_0xb2b0('0x1a')]===undefined?!![]:![]:!![],'where':_0x1f3301[_0xb2b0('0x19')]?_0x1f3301[_0xb2b0('0x19')][_0xb2b0('0x23')]||null:null,'attributes':_0x1f3301['options']?_0x1f3301[_0xb2b0('0x19')][_0xb2b0('0x1b')]||null:null,'include':_0x1f3301[_0xb2b0('0x19')]?_0x1f3301[_0xb2b0('0x19')][_0xb2b0('0x1d')]?_[_0xb2b0('0x1e')](_0x1f3301[_0xb2b0('0x19')][_0xb2b0('0x1d')],function(_0x11de30){return{'model':db[_0x11de30['model']],'as':_0x11de30['as'],'attributes':_0x11de30[_0xb2b0('0x1b')],'include':_0x11de30[_0xb2b0('0x1d')]?_[_0xb2b0('0x1e')](_0x11de30[_0xb2b0('0x1d')],function(_0x25fab7){return{'model':db[_0x25fab7['model']],'as':_0x25fab7['as'],'attributes':_0x25fab7['attributes'],'include':_0x25fab7[_0xb2b0('0x1d')]?_[_0xb2b0('0x1e')](_0x25fab7['include'],function(_0x6dba60){return{'model':db[_0x6dba60[_0xb2b0('0x1f')]],'as':_0x6dba60['as'],'attributes':_0x6dba60[_0xb2b0('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xb2b0('0xb')](function(_0xb9186){logger[_0xb2b0('0xc')](_0xb2b0('0x20'),_0x1f3301);logger[_0xb2b0('0xe')]('ShowServicenowAccount',_0x1f3301,JSON['stringify'](_0xb9186));_0x410894(_0xb9186);})['catch'](function(_0x373efb){logger[_0xb2b0('0x11')](_0xb2b0('0x20'),_0x373efb[_0xb2b0('0x14')],_0x1f3301);_0x165d62(_0x519f8a[_0xb2b0('0x11')](0x1f4,_0x373efb[_0xb2b0('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index b5b4a40..0ee1381 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 _0xbfd2=['multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./intServicenowConfiguration.controller','isAuthenticated','/:id','show','get','/:id/subjects','getSubjects','getDescriptions','post','put','update','destroy','exports'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0xbfd2,0x1b8));var _0x2bfd=function(_0x9c7adf,_0x30e40a){_0x9c7adf=_0x9c7adf-0x0;var _0xe82785=_0xbfd2[_0x9c7adf];return _0xe82785;};'use strict';var multer=require(_0x2bfd('0x0'));var util=require(_0x2bfd('0x1'));var path=require(_0x2bfd('0x2'));var timeout=require(_0x2bfd('0x3'));var express=require('express');var router=express[_0x2bfd('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2bfd('0x5'));var interaction=require(_0x2bfd('0x6'));var config=require('../../config/environment');var controller=require(_0x2bfd('0x7'));router['get']('/',auth[_0x2bfd('0x8')](),controller['index']);router['get'](_0x2bfd('0x9'),auth[_0x2bfd('0x8')](),controller[_0x2bfd('0xa')]);router[_0x2bfd('0xb')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0x2bfd('0xb')](_0x2bfd('0xc'),auth[_0x2bfd('0x8')](),controller[_0x2bfd('0xd')]);router[_0x2bfd('0xb')]('/:id/descriptions',auth[_0x2bfd('0x8')](),controller[_0x2bfd('0xe')]);router[_0x2bfd('0xf')]('/',auth[_0x2bfd('0x8')](),controller['create']);router[_0x2bfd('0x10')](_0x2bfd('0x9'),auth[_0x2bfd('0x8')](),controller[_0x2bfd('0x11')]);router['delete'](_0x2bfd('0x9'),auth[_0x2bfd('0x8')](),controller[_0x2bfd('0x12')]);module[_0x2bfd('0x13')]=router; \ No newline at end of file +var _0xa761=['../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','update','path','connect-timeout','express','Router'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa761,0xa7));var _0x1a76=function(_0x2a46c9,_0x1579b9){_0x2a46c9=_0x2a46c9-0x0;var _0x55ca8c=_0xa761[_0x2a46c9];return _0x55ca8c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1a76('0x0'));var timeout=require(_0x1a76('0x1'));var express=require(_0x1a76('0x2'));var router=express[_0x1a76('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1a76('0x4'));var controller=require(_0x1a76('0x5'));router[_0x1a76('0x6')]('/',auth[_0x1a76('0x7')](),controller[_0x1a76('0x8')]);router[_0x1a76('0x6')](_0x1a76('0x9'),auth[_0x1a76('0x7')](),controller['show']);router[_0x1a76('0x6')](_0x1a76('0xa'),auth[_0x1a76('0x7')](),controller[_0x1a76('0xb')]);router[_0x1a76('0x6')](_0x1a76('0xc'),auth['isAuthenticated'](),controller[_0x1a76('0xd')]);router[_0x1a76('0x6')](_0x1a76('0xe'),auth[_0x1a76('0x7')](),controller[_0x1a76('0xf')]);router[_0x1a76('0x10')]('/',auth[_0x1a76('0x7')](),controller[_0x1a76('0x11')]);router['put'](_0x1a76('0x9'),auth[_0x1a76('0x7')](),controller[_0x1a76('0x12')]);router['delete'](_0x1a76('0x9'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 5968429..432b3c1 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 _0xb39a=['STRING'];(function(_0x53543f,_0x247b32){var _0x7b2ce6=function(_0x359c79){while(--_0x359c79){_0x53543f['push'](_0x53543f['shift']());}};_0x7b2ce6(++_0x247b32);}(_0xb39a,0x15f));var _0xab39=function(_0x48f906,_0x24c8cc){_0x48f906=_0x48f906-0x0;var _0x4e05a9=_0xb39a[_0x48f906];return _0x4e05a9;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xab39('0x0')]},'description':{'type':Sequelize[_0xab39('0x0')]}}; \ No newline at end of file +var _0x4e3a=['exports','STRING','sequelize'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x4e3a,0x1d9));var _0xa4e3=function(_0x1711f8,_0x208f40){_0x1711f8=_0x1711f8-0x0;var _0x38ca74=_0x4e3a[_0x1711f8];return _0x38ca74;};'use strict';var Sequelize=require(_0xa4e3('0x0'));module[_0xa4e3('0x1')]={'name':{'type':Sequelize[_0xa4e3('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index f0f47b7..e95f867 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 _0xac99=['pick','merge','map','VIRTUAL','filter','ServicenowConfiguration','includeAll','include','findAll','rows','params','options','find','catch','body','destroy','getFields','hasOwnProperty','getSubjects','ServicenowField','getDescriptions','findOne','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','fs-extra','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../mysqldb','sendStatus','status','offset','limit','undefined','count','Content-Range','json','reject','save','update','then','end','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where'];(function(_0x5f1c4e,_0xf5d21d){var _0x3bc192=function(_0x50246b){while(--_0x50246b){_0x5f1c4e['push'](_0x5f1c4e['shift']());}};_0x3bc192(++_0xf5d21d);}(_0xac99,0x18d));var _0x9ac9=function(_0x2041a4,_0x55946d){_0x2041a4=_0x2041a4-0x0;var _0x5464b8=_0xac99[_0x2041a4];return _0x5464b8;};'use strict';var emlformat=require(_0x9ac9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9ac9('0x1'));var jsonpatch=require(_0x9ac9('0x2'));var rp=require(_0x9ac9('0x3'));var moment=require('moment');var BPromise=require(_0x9ac9('0x4'));var Mustache=require(_0x9ac9('0x5'));var util=require('util');var path=require(_0x9ac9('0x6'));var sox=require(_0x9ac9('0x7'));var csv=require(_0x9ac9('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9ac9('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9ac9('0xa'));var deskjs=require(_0x9ac9('0xb'));var toCsv=require(_0x9ac9('0x8'));var querystring=require(_0x9ac9('0xc'));var Papa=require(_0x9ac9('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9ac9('0xe'));var as=require(_0x9ac9('0xf'));var hardwareService=require(_0x9ac9('0x10'));var logger=require(_0x9ac9('0x11'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9ac9('0x12'))['db'];function respondWithStatusCode(_0x532737,_0x574b00){_0x574b00=_0x574b00||0xcc;return function(_0x36428c){if(_0x36428c){return _0x532737[_0x9ac9('0x13')](_0x574b00);}return _0x532737[_0x9ac9('0x14')](_0x574b00)['end']();};}function respondWithResult(_0x44e1aa,_0x2e10aa){_0x2e10aa=_0x2e10aa||0xc8;return function(_0x2ee61e){if(_0x2ee61e){return _0x44e1aa['status'](_0x2e10aa)['json'](_0x2ee61e);}};}function respondWithFilteredResult(_0x141c44,_0x2c8c28){return function(_0x2dfd34){if(_0x2dfd34){var _0x158ad8=typeof _0x2c8c28[_0x9ac9('0x15')]==='undefined'&&typeof _0x2c8c28[_0x9ac9('0x16')]===_0x9ac9('0x17');var _0x3a2dad=_0x2dfd34[_0x9ac9('0x18')];var _0x3b476f=_0x158ad8?0x0:_0x2c8c28['offset'];var _0x4cc42a=_0x158ad8?_0x2dfd34[_0x9ac9('0x18')]:_0x2c8c28[_0x9ac9('0x15')]+_0x2c8c28['limit'];var _0x5b883e;if(_0x4cc42a>=_0x3a2dad){_0x4cc42a=_0x3a2dad;_0x5b883e=0xc8;}else{_0x5b883e=0xce;}_0x141c44['status'](_0x5b883e);return _0x141c44['set'](_0x9ac9('0x19'),_0x3b476f+'-'+_0x4cc42a+'/'+_0x3a2dad)[_0x9ac9('0x1a')](_0x2dfd34);}return null;};}function patchUpdates(_0x4c8aef){return function(_0x2c38f8){try{jsonpatch['apply'](_0x2c38f8,_0x4c8aef,!![]);}catch(_0x34c230){return BPromise[_0x9ac9('0x1b')](_0x34c230);}return _0x2c38f8[_0x9ac9('0x1c')]();};}function saveUpdates(_0x9105bd,_0x4ecaf0){return function(_0x1195a0){if(_0x1195a0){return _0x1195a0[_0x9ac9('0x1d')](_0x9105bd)[_0x9ac9('0x1e')](function(_0x204e26){return _0x204e26;});}return null;};}function removeEntity(_0x4747cd,_0x5b976a){return function(_0x4fc706){if(_0x4fc706){return _0x4fc706['destroy']()[_0x9ac9('0x1e')](function(){_0x4747cd[_0x9ac9('0x14')](0xcc)[_0x9ac9('0x1f')]();});}};}function handleEntityNotFound(_0x17f05a,_0x3120f4){return function(_0x71afeb){if(!_0x71afeb){_0x17f05a[_0x9ac9('0x13')](0x194);}return _0x71afeb;};}function handleError(_0x4f6103,_0x34d1d5){_0x34d1d5=_0x34d1d5||0x1f4;return function(_0x53d4c9){logger[_0x9ac9('0x20')](_0x53d4c9[_0x9ac9('0x21')]);if(_0x53d4c9[_0x9ac9('0x22')]){delete _0x53d4c9[_0x9ac9('0x22')];}_0x4f6103[_0x9ac9('0x14')](_0x34d1d5)[_0x9ac9('0x23')](_0x53d4c9);};}exports[_0x9ac9('0x24')]=function(_0x2aaf66,_0x5d3875){var _0x2323c9={},_0x26ea11={},_0x7c4d9={'count':0x0,'rows':[]};var _0x14aa72=_['map'](db['ServicenowConfiguration'][_0x9ac9('0x25')],function(_0x8e6e0b){return{'name':_0x8e6e0b[_0x9ac9('0x26')],'type':_0x8e6e0b[_0x9ac9('0x27')][_0x9ac9('0x28')]};});_0x26ea11[_0x9ac9('0x29')]=_['map'](_0x14aa72,'name');_0x26ea11[_0x9ac9('0x2a')]=_[_0x9ac9('0x2b')](_0x2aaf66[_0x9ac9('0x2a')]);_0x26ea11[_0x9ac9('0x2c')]=_[_0x9ac9('0x2d')](_0x26ea11[_0x9ac9('0x29')],_0x26ea11[_0x9ac9('0x2a')]);_0x2323c9['attributes']=_['intersection'](_0x26ea11[_0x9ac9('0x29')],qs[_0x9ac9('0x2e')](_0x2aaf66[_0x9ac9('0x2a')][_0x9ac9('0x2e')]));_0x2323c9[_0x9ac9('0x2f')]=_0x2323c9['attributes'][_0x9ac9('0x30')]?_0x2323c9[_0x9ac9('0x2f')]:_0x26ea11[_0x9ac9('0x29')];if(!_0x2aaf66[_0x9ac9('0x2a')]['hasOwnProperty'](_0x9ac9('0x31'))){_0x2323c9[_0x9ac9('0x16')]=qs[_0x9ac9('0x16')](_0x2aaf66[_0x9ac9('0x2a')]['limit']);_0x2323c9[_0x9ac9('0x15')]=qs[_0x9ac9('0x15')](_0x2aaf66['query']['offset']);}_0x2323c9[_0x9ac9('0x32')]=qs[_0x9ac9('0x33')](_0x2aaf66[_0x9ac9('0x2a')][_0x9ac9('0x33')]);_0x2323c9[_0x9ac9('0x34')]=qs[_0x9ac9('0x2c')](_[_0x9ac9('0x35')](_0x2aaf66[_0x9ac9('0x2a')],_0x26ea11[_0x9ac9('0x2c')]),_0x14aa72);if(_0x2aaf66[_0x9ac9('0x2a')]['filter']){_0x2323c9[_0x9ac9('0x34')]=_[_0x9ac9('0x36')](_0x2323c9[_0x9ac9('0x34')],{'$or':_[_0x9ac9('0x37')](_0x14aa72,function(_0xc33acd){if(_0xc33acd[_0x9ac9('0x27')]!==_0x9ac9('0x38')){var _0x1aee24={};_0x1aee24[_0xc33acd[_0x9ac9('0x22')]]={'$like':'%'+_0x2aaf66[_0x9ac9('0x2a')][_0x9ac9('0x39')]+'%'};return _0x1aee24;}})});}_0x2323c9=_[_0x9ac9('0x36')]({},_0x2323c9,_0x2aaf66['options']);var _0x32b323={'where':_0x2323c9[_0x9ac9('0x34')]};return db[_0x9ac9('0x3a')]['count'](_0x32b323)[_0x9ac9('0x1e')](function(_0x51aa67){_0x7c4d9['count']=_0x51aa67;if(_0x2aaf66[_0x9ac9('0x2a')][_0x9ac9('0x3b')]){_0x2323c9[_0x9ac9('0x3c')]=[{'all':!![]}];}return db[_0x9ac9('0x3a')][_0x9ac9('0x3d')](_0x2323c9);})[_0x9ac9('0x1e')](function(_0x2b0084){_0x7c4d9[_0x9ac9('0x3e')]=_0x2b0084;return _0x7c4d9;})[_0x9ac9('0x1e')](respondWithFilteredResult(_0x5d3875,_0x2323c9))['catch'](handleError(_0x5d3875,null));};exports['show']=function(_0x55eae4,_0x241737){var _0x251891={'raw':![],'where':{'id':_0x55eae4[_0x9ac9('0x3f')]['id']}},_0x71522c={};_0x71522c[_0x9ac9('0x29')]=_[_0x9ac9('0x2b')](db[_0x9ac9('0x3a')]['rawAttributes']);_0x71522c[_0x9ac9('0x2a')]=_[_0x9ac9('0x2b')](_0x55eae4[_0x9ac9('0x2a')]);_0x71522c[_0x9ac9('0x2c')]=_[_0x9ac9('0x2d')](_0x71522c['model'],_0x71522c[_0x9ac9('0x2a')]);_0x251891['attributes']=_['intersection'](_0x71522c[_0x9ac9('0x29')],qs['fields'](_0x55eae4['query'][_0x9ac9('0x2e')]));_0x251891[_0x9ac9('0x2f')]=_0x251891[_0x9ac9('0x2f')]['length']?_0x251891[_0x9ac9('0x2f')]:_0x71522c[_0x9ac9('0x29')];if(_0x55eae4[_0x9ac9('0x2a')][_0x9ac9('0x3b')]){_0x251891[_0x9ac9('0x3c')]=[{'all':!![]}];}_0x251891=_[_0x9ac9('0x36')]({},_0x251891,_0x55eae4[_0x9ac9('0x40')]);return db[_0x9ac9('0x3a')][_0x9ac9('0x41')](_0x251891)['then'](handleEntityNotFound(_0x241737,null))[_0x9ac9('0x1e')](respondWithResult(_0x241737,null))[_0x9ac9('0x42')](handleError(_0x241737,null));};exports['create']=function(_0xde6ff6,_0x5b4da5){return db[_0x9ac9('0x3a')]['create'](_0xde6ff6[_0x9ac9('0x43')],{})[_0x9ac9('0x1e')](respondWithResult(_0x5b4da5,0xc9))[_0x9ac9('0x42')](handleError(_0x5b4da5,null));};exports[_0x9ac9('0x1d')]=function(_0x180ed6,_0x2b0846){if(_0x180ed6[_0x9ac9('0x43')]['id']){delete _0x180ed6['body']['id'];}return db['ServicenowConfiguration'][_0x9ac9('0x41')]({'where':{'id':_0x180ed6[_0x9ac9('0x3f')]['id']}})[_0x9ac9('0x1e')](handleEntityNotFound(_0x2b0846,null))[_0x9ac9('0x1e')](saveUpdates(_0x180ed6[_0x9ac9('0x43')],null))[_0x9ac9('0x1e')](respondWithResult(_0x2b0846,null))[_0x9ac9('0x42')](handleError(_0x2b0846,null));};exports[_0x9ac9('0x44')]=function(_0x126df8,_0x1e34f9){return db[_0x9ac9('0x3a')][_0x9ac9('0x41')]({'where':{'id':_0x126df8[_0x9ac9('0x3f')]['id']}})[_0x9ac9('0x1e')](handleEntityNotFound(_0x1e34f9,null))[_0x9ac9('0x1e')](removeEntity(_0x1e34f9,null))['catch'](handleError(_0x1e34f9,null));};exports[_0x9ac9('0x45')]=function(_0xfe8512,_0x50dd22,_0x56cb6f){var _0x3a7a99={};var _0x33ad3e={};var _0xf3ebea;var _0x49cef2;return db[_0x9ac9('0x3a')]['findOne']({'where':{'id':_0xfe8512['params']['id']}})[_0x9ac9('0x1e')](handleEntityNotFound(_0x50dd22,null))[_0x9ac9('0x1e')](function(_0x8dd2ea){if(_0x8dd2ea){_0xf3ebea=_0x8dd2ea;_0x33ad3e['model']=_['keys'](db['ServicenowField'][_0x9ac9('0x25')]);_0x33ad3e['query']=_[_0x9ac9('0x2b')](_0xfe8512['query']);_0x33ad3e[_0x9ac9('0x2c')]=_['intersection'](_0x33ad3e['model'],_0x33ad3e[_0x9ac9('0x2a')]);_0x3a7a99[_0x9ac9('0x2f')]=_[_0x9ac9('0x2d')](_0x33ad3e[_0x9ac9('0x29')],qs['fields'](_0xfe8512[_0x9ac9('0x2a')]['fields']));_0x3a7a99['attributes']=_0x3a7a99[_0x9ac9('0x2f')][_0x9ac9('0x30')]?_0x3a7a99[_0x9ac9('0x2f')]:_0x33ad3e['model'];_0x3a7a99[_0x9ac9('0x32')]=qs[_0x9ac9('0x33')](_0xfe8512['query'][_0x9ac9('0x33')]);_0x3a7a99[_0x9ac9('0x34')]=qs[_0x9ac9('0x2c')](_[_0x9ac9('0x35')](_0xfe8512[_0x9ac9('0x2a')],_0x33ad3e[_0x9ac9('0x2c')]));if(_0xfe8512['query'][_0x9ac9('0x39')]){_0x3a7a99[_0x9ac9('0x34')]=_[_0x9ac9('0x36')](_0x3a7a99['where'],{'$or':_[_0x9ac9('0x37')](_0x3a7a99[_0x9ac9('0x2f')],function(_0x36947d){var _0x35ba73={};_0x35ba73[_0x36947d]={'$like':'%'+_0xfe8512[_0x9ac9('0x2a')][_0x9ac9('0x39')]+'%'};return _0x35ba73;})});}_0x3a7a99=_[_0x9ac9('0x36')]({},_0x3a7a99,_0xfe8512[_0x9ac9('0x40')]);return _0xf3ebea[_0x9ac9('0x45')](_0x3a7a99);}})[_0x9ac9('0x1e')](function(_0x377301){if(_0x377301){_0x49cef2=_0x377301[_0x9ac9('0x30')];if(!_0xfe8512[_0x9ac9('0x2a')][_0x9ac9('0x46')](_0x9ac9('0x31'))){_0x3a7a99['limit']=qs[_0x9ac9('0x16')](_0xfe8512[_0x9ac9('0x2a')][_0x9ac9('0x16')]);_0x3a7a99[_0x9ac9('0x15')]=qs['offset'](_0xfe8512[_0x9ac9('0x2a')]['offset']);}return _0xf3ebea[_0x9ac9('0x45')](_0x3a7a99);}})[_0x9ac9('0x1e')](function(_0x2778e5){if(_0x2778e5){return _0x2778e5?{'count':_0x49cef2,'rows':_0x2778e5}:null;}})['then'](respondWithResult(_0x50dd22,null))['catch'](handleError(_0x50dd22,null));};exports[_0x9ac9('0x47')]=function(_0xec4321,_0x4229ef,_0x16a72a){var _0x5ebd17={};var _0x5976b4={};var _0x2ecc36;var _0x35fcee;return db[_0x9ac9('0x3a')]['findOne']({'where':{'id':_0xec4321[_0x9ac9('0x3f')]['id']}})['then'](handleEntityNotFound(_0x4229ef,null))[_0x9ac9('0x1e')](function(_0x98291f){if(_0x98291f){_0x2ecc36=_0x98291f;_0x5976b4[_0x9ac9('0x29')]=_['keys'](db[_0x9ac9('0x48')][_0x9ac9('0x25')]);_0x5976b4['query']=_['keys'](_0xec4321[_0x9ac9('0x2a')]);_0x5976b4[_0x9ac9('0x2c')]=_[_0x9ac9('0x2d')](_0x5976b4[_0x9ac9('0x29')],_0x5976b4[_0x9ac9('0x2a')]);_0x5ebd17['attributes']=_[_0x9ac9('0x2d')](_0x5976b4[_0x9ac9('0x29')],qs['fields'](_0xec4321['query'][_0x9ac9('0x2e')]));_0x5ebd17[_0x9ac9('0x2f')]=_0x5ebd17[_0x9ac9('0x2f')][_0x9ac9('0x30')]?_0x5ebd17['attributes']:_0x5976b4[_0x9ac9('0x29')];_0x5ebd17['order']=qs[_0x9ac9('0x33')](_0xec4321[_0x9ac9('0x2a')][_0x9ac9('0x33')]);_0x5ebd17[_0x9ac9('0x34')]=qs[_0x9ac9('0x2c')](_['pick'](_0xec4321[_0x9ac9('0x2a')],_0x5976b4[_0x9ac9('0x2c')]));if(_0xec4321[_0x9ac9('0x2a')]['filter']){_0x5ebd17[_0x9ac9('0x34')]=_[_0x9ac9('0x36')](_0x5ebd17[_0x9ac9('0x34')],{'$or':_[_0x9ac9('0x37')](_0x5ebd17[_0x9ac9('0x2f')],function(_0x4165ab){var _0x312de9={};_0x312de9[_0x4165ab]={'$like':'%'+_0xec4321[_0x9ac9('0x2a')]['filter']+'%'};return _0x312de9;})});}_0x5ebd17=_[_0x9ac9('0x36')]({},_0x5ebd17,_0xec4321[_0x9ac9('0x40')]);return _0x2ecc36[_0x9ac9('0x47')](_0x5ebd17);}})[_0x9ac9('0x1e')](function(_0x423a47){if(_0x423a47){_0x35fcee=_0x423a47[_0x9ac9('0x30')];if(!_0xec4321['query'][_0x9ac9('0x46')](_0x9ac9('0x31'))){_0x5ebd17[_0x9ac9('0x16')]=qs[_0x9ac9('0x16')](_0xec4321['query']['limit']);_0x5ebd17[_0x9ac9('0x15')]=qs['offset'](_0xec4321[_0x9ac9('0x2a')][_0x9ac9('0x15')]);}return _0x2ecc36['getSubjects'](_0x5ebd17);}})[_0x9ac9('0x1e')](function(_0x2b037a){if(_0x2b037a){return _0x2b037a?{'count':_0x35fcee,'rows':_0x2b037a}:null;}})[_0x9ac9('0x1e')](respondWithResult(_0x4229ef,null))[_0x9ac9('0x42')](handleError(_0x4229ef,null));};exports[_0x9ac9('0x49')]=function(_0x42bcfc,_0x15a55d,_0xdd497a){var _0x2b278b={};var _0x343f7b={};var _0x22dbfc;var _0x48a0fb;return db['ServicenowConfiguration'][_0x9ac9('0x4a')]({'where':{'id':_0x42bcfc['params']['id']}})[_0x9ac9('0x1e')](handleEntityNotFound(_0x15a55d,null))['then'](function(_0x3f9cbc){if(_0x3f9cbc){_0x22dbfc=_0x3f9cbc;_0x343f7b[_0x9ac9('0x29')]=_[_0x9ac9('0x2b')](db[_0x9ac9('0x48')][_0x9ac9('0x25')]);_0x343f7b['query']=_[_0x9ac9('0x2b')](_0x42bcfc[_0x9ac9('0x2a')]);_0x343f7b[_0x9ac9('0x2c')]=_[_0x9ac9('0x2d')](_0x343f7b[_0x9ac9('0x29')],_0x343f7b['query']);_0x2b278b[_0x9ac9('0x2f')]=_['intersection'](_0x343f7b['model'],qs['fields'](_0x42bcfc[_0x9ac9('0x2a')][_0x9ac9('0x2e')]));_0x2b278b['attributes']=_0x2b278b[_0x9ac9('0x2f')]['length']?_0x2b278b[_0x9ac9('0x2f')]:_0x343f7b[_0x9ac9('0x29')];_0x2b278b[_0x9ac9('0x32')]=qs[_0x9ac9('0x33')](_0x42bcfc[_0x9ac9('0x2a')][_0x9ac9('0x33')]);_0x2b278b['where']=qs['filters'](_[_0x9ac9('0x35')](_0x42bcfc[_0x9ac9('0x2a')],_0x343f7b[_0x9ac9('0x2c')]));if(_0x42bcfc['query'][_0x9ac9('0x39')]){_0x2b278b['where']=_[_0x9ac9('0x36')](_0x2b278b[_0x9ac9('0x34')],{'$or':_['map'](_0x2b278b['attributes'],function(_0x544253){var _0x161aa8={};_0x161aa8[_0x544253]={'$like':'%'+_0x42bcfc[_0x9ac9('0x2a')]['filter']+'%'};return _0x161aa8;})});}_0x2b278b=_[_0x9ac9('0x36')]({},_0x2b278b,_0x42bcfc[_0x9ac9('0x40')]);return _0x22dbfc[_0x9ac9('0x49')](_0x2b278b);}})[_0x9ac9('0x1e')](function(_0x3ffe56){if(_0x3ffe56){_0x48a0fb=_0x3ffe56['length'];if(!_0x42bcfc[_0x9ac9('0x2a')][_0x9ac9('0x46')]('nolimit')){_0x2b278b[_0x9ac9('0x16')]=qs['limit'](_0x42bcfc[_0x9ac9('0x2a')][_0x9ac9('0x16')]);_0x2b278b[_0x9ac9('0x15')]=qs['offset'](_0x42bcfc[_0x9ac9('0x2a')]['offset']);}return _0x22dbfc[_0x9ac9('0x49')](_0x2b278b);}})[_0x9ac9('0x1e')](function(_0x47c2a1){if(_0x47c2a1){return _0x47c2a1?{'count':_0x48a0fb,'rows':_0x47c2a1}:null;}})[_0x9ac9('0x1e')](respondWithResult(_0x15a55d,null))['catch'](handleError(_0x15a55d,null));}; \ No newline at end of file +var _0xbf40=['status','end','json','undefined','count','offset','apply','reject','update','then','destroy','sendStatus','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','limit','sort','where','pick','filter','merge','options','ServicenowConfiguration','includeAll','include','findAll','rows','catch','find','create','body','params','getFields','findOne','ServicenowField','order','hasOwnProperty','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x4cc799,_0x3411e7){var _0x2ed8fa=function(_0x27bc41){while(--_0x27bc41){_0x4cc799['push'](_0x4cc799['shift']());}};_0x2ed8fa(++_0x3411e7);}(_0xbf40,0x83));var _0x0bf4=function(_0xe73080,_0x24c56d){_0xe73080=_0xe73080-0x0;var _0x12cbc4=_0xbf40[_0xe73080];return _0x12cbc4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0bf4('0x0'));var zipdir=require(_0x0bf4('0x1'));var jsonpatch=require(_0x0bf4('0x2'));var rp=require('request-promise');var moment=require(_0x0bf4('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0bf4('0x4'));var util=require(_0x0bf4('0x5'));var path=require('path');var sox=require(_0x0bf4('0x6'));var csv=require(_0x0bf4('0x7'));var ejs=require(_0x0bf4('0x8'));var fs=require('fs');var fs_extra=require(_0x0bf4('0x9'));var _=require(_0x0bf4('0xa'));var squel=require(_0x0bf4('0xb'));var crypto=require(_0x0bf4('0xc'));var jsforce=require(_0x0bf4('0xd'));var deskjs=require(_0x0bf4('0xe'));var toCsv=require(_0x0bf4('0x7'));var querystring=require(_0x0bf4('0xf'));var Papa=require(_0x0bf4('0x10'));var Redis=require(_0x0bf4('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x0bf4('0x12'));var as=require(_0x0bf4('0x13'));var hardwareService=require(_0x0bf4('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x0bf4('0x15'));var config=require(_0x0bf4('0x16'));var licenseUtil=require(_0x0bf4('0x17'));var db=require(_0x0bf4('0x18'))['db'];function respondWithStatusCode(_0x1cf240,_0x2702bd){_0x2702bd=_0x2702bd||0xcc;return function(_0x27f531){if(_0x27f531){return _0x1cf240['sendStatus'](_0x2702bd);}return _0x1cf240[_0x0bf4('0x19')](_0x2702bd)[_0x0bf4('0x1a')]();};}function respondWithResult(_0x54da19,_0x403ee7){_0x403ee7=_0x403ee7||0xc8;return function(_0x18719f){if(_0x18719f){return _0x54da19[_0x0bf4('0x19')](_0x403ee7)[_0x0bf4('0x1b')](_0x18719f);}};}function respondWithFilteredResult(_0x1ec78f,_0x108ba9){return function(_0x4da893){if(_0x4da893){var _0x518686=typeof _0x108ba9['offset']===_0x0bf4('0x1c')&&typeof _0x108ba9['limit']===_0x0bf4('0x1c');var _0x460a4d=_0x4da893[_0x0bf4('0x1d')];var _0x90250e=_0x518686?0x0:_0x108ba9[_0x0bf4('0x1e')];var _0x27b3f2=_0x518686?_0x4da893['count']:_0x108ba9[_0x0bf4('0x1e')]+_0x108ba9['limit'];var _0x5512c4;if(_0x27b3f2>=_0x460a4d){_0x27b3f2=_0x460a4d;_0x5512c4=0xc8;}else{_0x5512c4=0xce;}_0x1ec78f[_0x0bf4('0x19')](_0x5512c4);return _0x1ec78f['set']('Content-Range',_0x90250e+'-'+_0x27b3f2+'/'+_0x460a4d)['json'](_0x4da893);}return null;};}function patchUpdates(_0x1d2fd4){return function(_0x5e5654){try{jsonpatch[_0x0bf4('0x1f')](_0x5e5654,_0x1d2fd4,!![]);}catch(_0xd187d1){return BPromise[_0x0bf4('0x20')](_0xd187d1);}return _0x5e5654['save']();};}function saveUpdates(_0x31eed7,_0xa56439){return function(_0x255445){if(_0x255445){return _0x255445[_0x0bf4('0x21')](_0x31eed7)[_0x0bf4('0x22')](function(_0x23f7f7){return _0x23f7f7;});}return null;};}function removeEntity(_0xefada,_0x33d352){return function(_0x25a959){if(_0x25a959){return _0x25a959[_0x0bf4('0x23')]()[_0x0bf4('0x22')](function(){_0xefada[_0x0bf4('0x19')](0xcc)[_0x0bf4('0x1a')]();});}};}function handleEntityNotFound(_0x1ae9a3,_0x5e614e){return function(_0x196927){if(!_0x196927){_0x1ae9a3[_0x0bf4('0x24')](0x194);}return _0x196927;};}function handleError(_0x8dab5,_0x102cef){_0x102cef=_0x102cef||0x1f4;return function(_0x175757){logger['error'](_0x175757['stack']);if(_0x175757['name']){delete _0x175757[_0x0bf4('0x25')];}_0x8dab5[_0x0bf4('0x19')](_0x102cef)[_0x0bf4('0x26')](_0x175757);};}exports[_0x0bf4('0x27')]=function(_0x330046,_0x142097){var _0x41fa1f={},_0x414e65={},_0x45922c={'count':0x0,'rows':[]};var _0x33b011=_[_0x0bf4('0x28')](db['ServicenowConfiguration'][_0x0bf4('0x29')],function(_0x500507){return{'name':_0x500507[_0x0bf4('0x2a')],'type':_0x500507[_0x0bf4('0x2b')][_0x0bf4('0x2c')]};});_0x414e65[_0x0bf4('0x2d')]=_['map'](_0x33b011,_0x0bf4('0x25'));_0x414e65['query']=_[_0x0bf4('0x2e')](_0x330046[_0x0bf4('0x2f')]);_0x414e65[_0x0bf4('0x30')]=_[_0x0bf4('0x31')](_0x414e65[_0x0bf4('0x2d')],_0x414e65[_0x0bf4('0x2f')]);_0x41fa1f[_0x0bf4('0x32')]=_[_0x0bf4('0x31')](_0x414e65[_0x0bf4('0x2d')],qs[_0x0bf4('0x33')](_0x330046['query'][_0x0bf4('0x33')]));_0x41fa1f[_0x0bf4('0x32')]=_0x41fa1f[_0x0bf4('0x32')][_0x0bf4('0x34')]?_0x41fa1f[_0x0bf4('0x32')]:_0x414e65[_0x0bf4('0x2d')];if(!_0x330046[_0x0bf4('0x2f')]['hasOwnProperty'](_0x0bf4('0x35'))){_0x41fa1f[_0x0bf4('0x36')]=qs[_0x0bf4('0x36')](_0x330046[_0x0bf4('0x2f')][_0x0bf4('0x36')]);_0x41fa1f['offset']=qs[_0x0bf4('0x1e')](_0x330046[_0x0bf4('0x2f')][_0x0bf4('0x1e')]);}_0x41fa1f['order']=qs[_0x0bf4('0x37')](_0x330046['query'][_0x0bf4('0x37')]);_0x41fa1f[_0x0bf4('0x38')]=qs[_0x0bf4('0x30')](_[_0x0bf4('0x39')](_0x330046[_0x0bf4('0x2f')],_0x414e65[_0x0bf4('0x30')]),_0x33b011);if(_0x330046[_0x0bf4('0x2f')][_0x0bf4('0x3a')]){_0x41fa1f[_0x0bf4('0x38')]=_[_0x0bf4('0x3b')](_0x41fa1f['where'],{'$or':_['map'](_0x33b011,function(_0x5b6757){if(_0x5b6757[_0x0bf4('0x2b')]!=='VIRTUAL'){var _0x19baae={};_0x19baae[_0x5b6757[_0x0bf4('0x25')]]={'$like':'%'+_0x330046[_0x0bf4('0x2f')][_0x0bf4('0x3a')]+'%'};return _0x19baae;}})});}_0x41fa1f=_[_0x0bf4('0x3b')]({},_0x41fa1f,_0x330046[_0x0bf4('0x3c')]);var _0x5bc515={'where':_0x41fa1f[_0x0bf4('0x38')]};return db[_0x0bf4('0x3d')][_0x0bf4('0x1d')](_0x5bc515)[_0x0bf4('0x22')](function(_0x443703){_0x45922c[_0x0bf4('0x1d')]=_0x443703;if(_0x330046[_0x0bf4('0x2f')][_0x0bf4('0x3e')]){_0x41fa1f[_0x0bf4('0x3f')]=[{'all':!![]}];}return db['ServicenowConfiguration'][_0x0bf4('0x40')](_0x41fa1f);})[_0x0bf4('0x22')](function(_0x11d6df){_0x45922c[_0x0bf4('0x41')]=_0x11d6df;return _0x45922c;})['then'](respondWithFilteredResult(_0x142097,_0x41fa1f))[_0x0bf4('0x42')](handleError(_0x142097,null));};exports['show']=function(_0x4c1cdd,_0x4ef049){var _0xbe6c42={'raw':![],'where':{'id':_0x4c1cdd['params']['id']}},_0x1fa8a0={};_0x1fa8a0[_0x0bf4('0x2d')]=_[_0x0bf4('0x2e')](db[_0x0bf4('0x3d')][_0x0bf4('0x29')]);_0x1fa8a0[_0x0bf4('0x2f')]=_[_0x0bf4('0x2e')](_0x4c1cdd['query']);_0x1fa8a0[_0x0bf4('0x30')]=_[_0x0bf4('0x31')](_0x1fa8a0[_0x0bf4('0x2d')],_0x1fa8a0[_0x0bf4('0x2f')]);_0xbe6c42[_0x0bf4('0x32')]=_[_0x0bf4('0x31')](_0x1fa8a0[_0x0bf4('0x2d')],qs[_0x0bf4('0x33')](_0x4c1cdd[_0x0bf4('0x2f')][_0x0bf4('0x33')]));_0xbe6c42['attributes']=_0xbe6c42['attributes'][_0x0bf4('0x34')]?_0xbe6c42[_0x0bf4('0x32')]:_0x1fa8a0[_0x0bf4('0x2d')];if(_0x4c1cdd[_0x0bf4('0x2f')][_0x0bf4('0x3e')]){_0xbe6c42[_0x0bf4('0x3f')]=[{'all':!![]}];}_0xbe6c42=_[_0x0bf4('0x3b')]({},_0xbe6c42,_0x4c1cdd['options']);return db[_0x0bf4('0x3d')][_0x0bf4('0x43')](_0xbe6c42)[_0x0bf4('0x22')](handleEntityNotFound(_0x4ef049,null))[_0x0bf4('0x22')](respondWithResult(_0x4ef049,null))[_0x0bf4('0x42')](handleError(_0x4ef049,null));};exports[_0x0bf4('0x44')]=function(_0x3d38de,_0x3e18f8){return db[_0x0bf4('0x3d')][_0x0bf4('0x44')](_0x3d38de[_0x0bf4('0x45')],{})['then'](respondWithResult(_0x3e18f8,0xc9))[_0x0bf4('0x42')](handleError(_0x3e18f8,null));};exports[_0x0bf4('0x21')]=function(_0x593edb,_0x57ae42){if(_0x593edb[_0x0bf4('0x45')]['id']){delete _0x593edb[_0x0bf4('0x45')]['id'];}return db[_0x0bf4('0x3d')][_0x0bf4('0x43')]({'where':{'id':_0x593edb[_0x0bf4('0x46')]['id']}})[_0x0bf4('0x22')](handleEntityNotFound(_0x57ae42,null))[_0x0bf4('0x22')](saveUpdates(_0x593edb[_0x0bf4('0x45')],null))[_0x0bf4('0x22')](respondWithResult(_0x57ae42,null))[_0x0bf4('0x42')](handleError(_0x57ae42,null));};exports[_0x0bf4('0x23')]=function(_0x3911e3,_0x320997){return db[_0x0bf4('0x3d')][_0x0bf4('0x43')]({'where':{'id':_0x3911e3[_0x0bf4('0x46')]['id']}})[_0x0bf4('0x22')](handleEntityNotFound(_0x320997,null))[_0x0bf4('0x22')](removeEntity(_0x320997,null))[_0x0bf4('0x42')](handleError(_0x320997,null));};exports[_0x0bf4('0x47')]=function(_0x56dc58,_0x2fe090,_0x1c58ee){var _0xd956={};var _0x36183e={};var _0x25fcf4;var _0x110ceb;return db[_0x0bf4('0x3d')][_0x0bf4('0x48')]({'where':{'id':_0x56dc58[_0x0bf4('0x46')]['id']}})['then'](handleEntityNotFound(_0x2fe090,null))[_0x0bf4('0x22')](function(_0x273447){if(_0x273447){_0x25fcf4=_0x273447;_0x36183e['model']=_[_0x0bf4('0x2e')](db[_0x0bf4('0x49')]['rawAttributes']);_0x36183e[_0x0bf4('0x2f')]=_[_0x0bf4('0x2e')](_0x56dc58[_0x0bf4('0x2f')]);_0x36183e[_0x0bf4('0x30')]=_[_0x0bf4('0x31')](_0x36183e[_0x0bf4('0x2d')],_0x36183e[_0x0bf4('0x2f')]);_0xd956[_0x0bf4('0x32')]=_[_0x0bf4('0x31')](_0x36183e['model'],qs['fields'](_0x56dc58[_0x0bf4('0x2f')][_0x0bf4('0x33')]));_0xd956[_0x0bf4('0x32')]=_0xd956[_0x0bf4('0x32')]['length']?_0xd956[_0x0bf4('0x32')]:_0x36183e[_0x0bf4('0x2d')];_0xd956[_0x0bf4('0x4a')]=qs[_0x0bf4('0x37')](_0x56dc58['query'][_0x0bf4('0x37')]);_0xd956[_0x0bf4('0x38')]=qs['filters'](_['pick'](_0x56dc58[_0x0bf4('0x2f')],_0x36183e[_0x0bf4('0x30')]));if(_0x56dc58['query'][_0x0bf4('0x3a')]){_0xd956[_0x0bf4('0x38')]=_[_0x0bf4('0x3b')](_0xd956[_0x0bf4('0x38')],{'$or':_[_0x0bf4('0x28')](_0xd956[_0x0bf4('0x32')],function(_0x4948e6){var _0x558340={};_0x558340[_0x4948e6]={'$like':'%'+_0x56dc58[_0x0bf4('0x2f')][_0x0bf4('0x3a')]+'%'};return _0x558340;})});}_0xd956=_[_0x0bf4('0x3b')]({},_0xd956,_0x56dc58['options']);return _0x25fcf4[_0x0bf4('0x47')](_0xd956);}})[_0x0bf4('0x22')](function(_0x4cd10b){if(_0x4cd10b){_0x110ceb=_0x4cd10b[_0x0bf4('0x34')];if(!_0x56dc58[_0x0bf4('0x2f')][_0x0bf4('0x4b')]('nolimit')){_0xd956[_0x0bf4('0x36')]=qs[_0x0bf4('0x36')](_0x56dc58[_0x0bf4('0x2f')][_0x0bf4('0x36')]);_0xd956['offset']=qs[_0x0bf4('0x1e')](_0x56dc58[_0x0bf4('0x2f')][_0x0bf4('0x1e')]);}return _0x25fcf4[_0x0bf4('0x47')](_0xd956);}})[_0x0bf4('0x22')](function(_0x57438d){if(_0x57438d){return _0x57438d?{'count':_0x110ceb,'rows':_0x57438d}:null;}})['then'](respondWithResult(_0x2fe090,null))['catch'](handleError(_0x2fe090,null));};exports[_0x0bf4('0x4c')]=function(_0x1569b4,_0x492660,_0x400f05){var _0x1c93b7={};var _0x541c50={};var _0x33d28e;var _0x1d3123;return db[_0x0bf4('0x3d')]['findOne']({'where':{'id':_0x1569b4[_0x0bf4('0x46')]['id']}})[_0x0bf4('0x22')](handleEntityNotFound(_0x492660,null))[_0x0bf4('0x22')](function(_0x3233f0){if(_0x3233f0){_0x33d28e=_0x3233f0;_0x541c50['model']=_[_0x0bf4('0x2e')](db[_0x0bf4('0x49')][_0x0bf4('0x29')]);_0x541c50[_0x0bf4('0x2f')]=_[_0x0bf4('0x2e')](_0x1569b4[_0x0bf4('0x2f')]);_0x541c50[_0x0bf4('0x30')]=_[_0x0bf4('0x31')](_0x541c50['model'],_0x541c50[_0x0bf4('0x2f')]);_0x1c93b7[_0x0bf4('0x32')]=_[_0x0bf4('0x31')](_0x541c50['model'],qs[_0x0bf4('0x33')](_0x1569b4[_0x0bf4('0x2f')]['fields']));_0x1c93b7[_0x0bf4('0x32')]=_0x1c93b7['attributes'][_0x0bf4('0x34')]?_0x1c93b7[_0x0bf4('0x32')]:_0x541c50['model'];_0x1c93b7['order']=qs['sort'](_0x1569b4[_0x0bf4('0x2f')][_0x0bf4('0x37')]);_0x1c93b7['where']=qs[_0x0bf4('0x30')](_[_0x0bf4('0x39')](_0x1569b4[_0x0bf4('0x2f')],_0x541c50[_0x0bf4('0x30')]));if(_0x1569b4[_0x0bf4('0x2f')]['filter']){_0x1c93b7[_0x0bf4('0x38')]=_['merge'](_0x1c93b7[_0x0bf4('0x38')],{'$or':_[_0x0bf4('0x28')](_0x1c93b7[_0x0bf4('0x32')],function(_0xf0311d){var _0xfae2ea={};_0xfae2ea[_0xf0311d]={'$like':'%'+_0x1569b4[_0x0bf4('0x2f')][_0x0bf4('0x3a')]+'%'};return _0xfae2ea;})});}_0x1c93b7=_[_0x0bf4('0x3b')]({},_0x1c93b7,_0x1569b4[_0x0bf4('0x3c')]);return _0x33d28e[_0x0bf4('0x4c')](_0x1c93b7);}})[_0x0bf4('0x22')](function(_0x12a73a){if(_0x12a73a){_0x1d3123=_0x12a73a[_0x0bf4('0x34')];if(!_0x1569b4[_0x0bf4('0x2f')][_0x0bf4('0x4b')](_0x0bf4('0x35'))){_0x1c93b7['limit']=qs['limit'](_0x1569b4[_0x0bf4('0x2f')][_0x0bf4('0x36')]);_0x1c93b7[_0x0bf4('0x1e')]=qs['offset'](_0x1569b4['query'][_0x0bf4('0x1e')]);}return _0x33d28e[_0x0bf4('0x4c')](_0x1c93b7);}})[_0x0bf4('0x22')](function(_0x3744bf){if(_0x3744bf){return _0x3744bf?{'count':_0x1d3123,'rows':_0x3744bf}:null;}})[_0x0bf4('0x22')](respondWithResult(_0x492660,null))[_0x0bf4('0x42')](handleError(_0x492660,null));};exports['getDescriptions']=function(_0xfc1708,_0x144756,_0x4f4cfe){var _0x1065a9={};var _0x33a9a3={};var _0x2f628e;var _0x284abb;return db[_0x0bf4('0x3d')][_0x0bf4('0x48')]({'where':{'id':_0xfc1708['params']['id']}})[_0x0bf4('0x22')](handleEntityNotFound(_0x144756,null))[_0x0bf4('0x22')](function(_0x478583){if(_0x478583){_0x2f628e=_0x478583;_0x33a9a3['model']=_[_0x0bf4('0x2e')](db[_0x0bf4('0x49')][_0x0bf4('0x29')]);_0x33a9a3[_0x0bf4('0x2f')]=_[_0x0bf4('0x2e')](_0xfc1708[_0x0bf4('0x2f')]);_0x33a9a3['filters']=_[_0x0bf4('0x31')](_0x33a9a3[_0x0bf4('0x2d')],_0x33a9a3['query']);_0x1065a9[_0x0bf4('0x32')]=_[_0x0bf4('0x31')](_0x33a9a3[_0x0bf4('0x2d')],qs[_0x0bf4('0x33')](_0xfc1708[_0x0bf4('0x2f')][_0x0bf4('0x33')]));_0x1065a9[_0x0bf4('0x32')]=_0x1065a9[_0x0bf4('0x32')][_0x0bf4('0x34')]?_0x1065a9['attributes']:_0x33a9a3[_0x0bf4('0x2d')];_0x1065a9[_0x0bf4('0x4a')]=qs['sort'](_0xfc1708[_0x0bf4('0x2f')][_0x0bf4('0x37')]);_0x1065a9[_0x0bf4('0x38')]=qs[_0x0bf4('0x30')](_[_0x0bf4('0x39')](_0xfc1708[_0x0bf4('0x2f')],_0x33a9a3['filters']));if(_0xfc1708[_0x0bf4('0x2f')][_0x0bf4('0x3a')]){_0x1065a9[_0x0bf4('0x38')]=_['merge'](_0x1065a9[_0x0bf4('0x38')],{'$or':_['map'](_0x1065a9[_0x0bf4('0x32')],function(_0x9ded9b){var _0x47e2f2={};_0x47e2f2[_0x9ded9b]={'$like':'%'+_0xfc1708['query'][_0x0bf4('0x3a')]+'%'};return _0x47e2f2;})});}_0x1065a9=_[_0x0bf4('0x3b')]({},_0x1065a9,_0xfc1708[_0x0bf4('0x3c')]);return _0x2f628e[_0x0bf4('0x4d')](_0x1065a9);}})['then'](function(_0x315d68){if(_0x315d68){_0x284abb=_0x315d68[_0x0bf4('0x34')];if(!_0xfc1708[_0x0bf4('0x2f')][_0x0bf4('0x4b')](_0x0bf4('0x35'))){_0x1065a9[_0x0bf4('0x36')]=qs['limit'](_0xfc1708[_0x0bf4('0x2f')][_0x0bf4('0x36')]);_0x1065a9['offset']=qs[_0x0bf4('0x1e')](_0xfc1708[_0x0bf4('0x2f')]['offset']);}return _0x2f628e[_0x0bf4('0x4d')](_0x1065a9);}})[_0x0bf4('0x22')](function(_0x51318c){if(_0x51318c){return _0x51318c?{'count':_0x284abb,'rows':_0x51318c}:null;}})[_0x0bf4('0x22')](respondWithResult(_0x144756,null))[_0x0bf4('0x42')](handleError(_0x144756,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index d639cdf..5cd6956 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 _0x8b1a=['ServicenowConfiguration','int_servicenow_configurations','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports'];(function(_0x34e424,_0x33bc6e){var _0x200103=function(_0x2c2575){while(--_0x2c2575){_0x34e424['push'](_0x34e424['shift']());}};_0x200103(++_0x33bc6e);}(_0x8b1a,0x152));var _0xa8b1=function(_0x4a745a,_0x3cbe64){_0x4a745a=_0x4a745a-0x0;var _0x57fe3a=_0x8b1a[_0x4a745a];return _0x57fe3a;};'use strict';var _=require(_0xa8b1('0x0'));var util=require(_0xa8b1('0x1'));var logger=require(_0xa8b1('0x2'))('api');var moment=require(_0xa8b1('0x3'));var BPromise=require(_0xa8b1('0x4'));var rp=require(_0xa8b1('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa8b1('0x6'));var config=require(_0xa8b1('0x7'));var attributes=require(_0xa8b1('0x8'));module[_0xa8b1('0x9')]=function(_0x493b8e,_0x90c588){return _0x493b8e['define'](_0xa8b1('0xa'),attributes,{'tableName':_0xa8b1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc5b3=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intServicenowConfiguration.attributes','define','ServicenowConfiguration','int_servicenow_configurations'];(function(_0x1c26b,_0x18ee79){var _0x212bc7=function(_0x1ad0df){while(--_0x1ad0df){_0x1c26b['push'](_0x1c26b['shift']());}};_0x212bc7(++_0x18ee79);}(_0xc5b3,0x1ee));var _0x3c5b=function(_0x4c73ac,_0x46b73c){_0x4c73ac=_0x4c73ac-0x0;var _0x9839ee=_0xc5b3[_0x4c73ac];return _0x9839ee;};'use strict';var _=require(_0x3c5b('0x0'));var util=require(_0x3c5b('0x1'));var logger=require(_0x3c5b('0x2'))(_0x3c5b('0x3'));var moment=require(_0x3c5b('0x4'));var BPromise=require(_0x3c5b('0x5'));var rp=require(_0x3c5b('0x6'));var fs=require('fs');var path=require(_0x3c5b('0x7'));var rimraf=require('rimraf');var config=require(_0x3c5b('0x8'));var attributes=require(_0x3c5b('0x9'));module['exports']=function(_0x320aa2,_0x56c93d){return _0x320aa2[_0x3c5b('0xa')](_0x3c5b('0xb'),attributes,{'tableName':_0x3c5b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index b80453f..f527bba 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 _0x971c=['result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x3ead55,_0x22bc51){var _0x3ea16d=function(_0x2a59e0){while(--_0x2a59e0){_0x3ead55['push'](_0x3ead55['shift']());}};_0x3ea16d(++_0x22bc51);}(_0x971c,0xbf));var _0xc971=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x971c[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0xc971('0x0'));var util=require('util');var moment=require(_0xc971('0x1'));var BPromise=require(_0xc971('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc971('0x3'));var db=require(_0xc971('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc971('0x5'))(_0xc971('0x6'));var config=require(_0xc971('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xc971('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x178449,_0x460b5d,_0x42156d){return new BPromise(function(_0x2fc2ec,_0x36be47){return client[_0xc971('0x9')](_0x178449,_0x42156d)['then'](function(_0x1b4ba6){logger[_0xc971('0xa')](_0xc971('0xb'),_0x460b5d,_0xc971('0xc'));logger[_0xc971('0xd')](_0xc971('0xe'),_0x460b5d,_0xc971('0xc'),JSON[_0xc971('0xf')](_0x1b4ba6));if(_0x1b4ba6[_0xc971('0x10')]){if(_0x1b4ba6[_0xc971('0x10')][_0xc971('0x11')]===0x1f4){logger[_0xc971('0x10')](_0xc971('0xb'),_0x460b5d,_0x1b4ba6['error'][_0xc971('0x12')]);return _0x36be47(_0x1b4ba6['error'][_0xc971('0x12')]);}logger[_0xc971('0x10')]('ServicenowConfiguration,\x20%s,\x20%s',_0x460b5d,_0x1b4ba6[_0xc971('0x10')][_0xc971('0x12')]);return _0x2fc2ec(_0x1b4ba6[_0xc971('0x10')][_0xc971('0x12')]);}else{logger[_0xc971('0xa')](_0xc971('0xb'),_0x460b5d,_0xc971('0xc'));_0x2fc2ec(_0x1b4ba6[_0xc971('0x13')]['message']);}})[_0xc971('0x14')](function(_0x3d37a2){logger['error'](_0xc971('0xb'),_0x460b5d,_0x3d37a2);_0x36be47(_0x3d37a2);});});} \ No newline at end of file +var _0x9fa3=['info','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ServicenowConfiguration,\x20%s,\x20%s','result','catch','util','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0xcecebf,_0x41df3d){var _0x4e7599=function(_0x2975f3){while(--_0x2975f3){_0xcecebf['push'](_0xcecebf['shift']());}};_0x4e7599(++_0x41df3d);}(_0x9fa3,0x67));var _0x39fa=function(_0x46167e,_0x17ff83){_0x46167e=_0x46167e-0x0;var _0x7ece7=_0x9fa3[_0x46167e];return _0x7ece7;};'use strict';var _=require('lodash');var util=require(_0x39fa('0x0'));var moment=require(_0x39fa('0x1'));var BPromise=require('bluebird');var rs=require(_0x39fa('0x2'));var fs=require('fs');var Redis=require(_0x39fa('0x3'));var db=require(_0x39fa('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x39fa('0x5'));var config=require(_0x39fa('0x6'));var jayson=require(_0x39fa('0x7'));var client=jayson[_0x39fa('0x8')][_0x39fa('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x751422,_0x59a8a9,_0x18bc07){return new BPromise(function(_0x3f7c45,_0x52b936){return client[_0x39fa('0xa')](_0x751422,_0x18bc07)[_0x39fa('0xb')](function(_0x254ef3){logger[_0x39fa('0xc')]('ServicenowConfiguration,\x20%s,\x20%s',_0x59a8a9,_0x39fa('0xd'));logger[_0x39fa('0xe')](_0x39fa('0xf'),_0x59a8a9,'request\x20sent',JSON[_0x39fa('0x10')](_0x254ef3));if(_0x254ef3[_0x39fa('0x11')]){if(_0x254ef3[_0x39fa('0x11')][_0x39fa('0x12')]===0x1f4){logger[_0x39fa('0x11')]('ServicenowConfiguration,\x20%s,\x20%s',_0x59a8a9,_0x254ef3[_0x39fa('0x11')]['message']);return _0x52b936(_0x254ef3[_0x39fa('0x11')][_0x39fa('0x13')]);}logger['error'](_0x39fa('0x14'),_0x59a8a9,_0x254ef3['error'][_0x39fa('0x13')]);return _0x3f7c45(_0x254ef3[_0x39fa('0x11')][_0x39fa('0x13')]);}else{logger[_0x39fa('0xc')](_0x39fa('0x14'),_0x59a8a9,_0x39fa('0xd'));_0x3f7c45(_0x254ef3[_0x39fa('0x15')][_0x39fa('0x13')]);}})[_0x39fa('0x16')](function(_0x48bcf5){logger['error'](_0x39fa('0x14'),_0x59a8a9,_0x48bcf5);_0x52b936(_0x48bcf5);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 583bbcd..bda3e8f 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 _0x7133=['put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','isAuthenticated','index','show','post'];(function(_0x582e04,_0x265b66){var _0xc6d7e0=function(_0x284c98){while(--_0x284c98){_0x582e04['push'](_0x582e04['shift']());}};_0xc6d7e0(++_0x265b66);}(_0x7133,0x181));var _0x3713=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0x7133[_0xf50820];return _0x2a9b10;};'use strict';var multer=require(_0x3713('0x0'));var util=require(_0x3713('0x1'));var path=require(_0x3713('0x2'));var timeout=require(_0x3713('0x3'));var express=require(_0x3713('0x4'));var router=express[_0x3713('0x5')]();var fs_extra=require(_0x3713('0x6'));var auth=require(_0x3713('0x7'));var interaction=require(_0x3713('0x8'));var config=require(_0x3713('0x9'));var controller=require(_0x3713('0xa'));router['get']('/',auth[_0x3713('0xb')](),controller[_0x3713('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x3713('0xd')]);router[_0x3713('0xe')]('/',auth[_0x3713('0xb')](),controller['create']);router[_0x3713('0xf')](_0x3713('0x10'),auth[_0x3713('0xb')](),controller[_0x3713('0x11')]);router['delete'](_0x3713('0x10'),auth[_0x3713('0xb')](),controller[_0x3713('0x12')]);module[_0x3713('0x13')]=router; \ No newline at end of file +var _0x86c6=['show','post','create','update','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../config/environment','get','isAuthenticated'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x86c6,0x114));var _0x686c=function(_0x54a2a6,_0x1f3f87){_0x54a2a6=_0x54a2a6-0x0;var _0x1f04a5=_0x86c6[_0x54a2a6];return _0x1f04a5;};'use strict';var multer=require(_0x686c('0x0'));var util=require('util');var path=require(_0x686c('0x1'));var timeout=require(_0x686c('0x2'));var express=require(_0x686c('0x3'));var router=express[_0x686c('0x4')]();var fs_extra=require(_0x686c('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x686c('0x6'));var controller=require('./intServicenowField.controller');router[_0x686c('0x7')]('/',auth[_0x686c('0x8')](),controller['index']);router[_0x686c('0x7')]('/:id',auth[_0x686c('0x8')](),controller[_0x686c('0x9')]);router[_0x686c('0xa')]('/',auth[_0x686c('0x8')](),controller[_0x686c('0xb')]);router['put']('/:id',auth[_0x686c('0x8')](),controller[_0x686c('0xc')]);router['delete']('/:id',auth[_0x686c('0x8')](),controller[_0x686c('0xd')]);module[_0x686c('0xe')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 0e62480..cfe0603 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 _0xdb91=['STRING','sequelize','exports','ENUM','string','variable','customVariable','keyValue'];(function(_0x35d572,_0x68bb6f){var _0x580eee=function(_0x242121){while(--_0x242121){_0x35d572['push'](_0x35d572['shift']());}};_0x580eee(++_0x68bb6f);}(_0xdb91,0xb9));var _0x1db9=function(_0x214b3a,_0x30ed2e){_0x214b3a=_0x214b3a-0x0;var _0x593d53=_0xdb91[_0x214b3a];return _0x593d53;};'use strict';var Sequelize=require(_0x1db9('0x0'));module[_0x1db9('0x1')]={'type':{'type':Sequelize[_0x1db9('0x2')](_0x1db9('0x3'),_0x1db9('0x4'),_0x1db9('0x5'),_0x1db9('0x6'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x1db9('0x7')]},'key':{'type':Sequelize[_0x1db9('0x7')]},'keyType':{'type':Sequelize[_0x1db9('0x2')](_0x1db9('0x3'),_0x1db9('0x4'),_0x1db9('0x5'))},'keyContent':{'type':Sequelize[_0x1db9('0x7')]},'idField':{'type':Sequelize[_0x1db9('0x7')]},'nameField':{'type':Sequelize[_0x1db9('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc2b7=['ENUM','sequelize','exports','variable','customVariable','keyValue','picklist','string','STRING'];(function(_0xa04515,_0x42c622){var _0x463655=function(_0x35e87c){while(--_0x35e87c){_0xa04515['push'](_0xa04515['shift']());}};_0x463655(++_0x42c622);}(_0xc2b7,0xe2));var _0x7c2b=function(_0x1d8b10,_0x9603a6){_0x1d8b10=_0x1d8b10-0x0;var _0x123f31=_0xc2b7[_0x1d8b10];return _0x123f31;};'use strict';var Sequelize=require(_0x7c2b('0x0'));module[_0x7c2b('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x7c2b('0x2'),_0x7c2b('0x3'),_0x7c2b('0x4'),_0x7c2b('0x5')),'defaultValue':_0x7c2b('0x6')},'content':{'type':Sequelize[_0x7c2b('0x7')]},'key':{'type':Sequelize[_0x7c2b('0x7')]},'keyType':{'type':Sequelize[_0x7c2b('0x8')]('string','variable',_0x7c2b('0x3'))},'keyContent':{'type':Sequelize[_0x7c2b('0x7')]},'idField':{'type':Sequelize[_0x7c2b('0x7')]},'nameField':{'type':Sequelize[_0x7c2b('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7c2b('0x7')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 9f170ab..8ae6d91 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 _0x6430=['keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','find','create','body','catch','destroy','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','sendStatus','stack','name','send','index','map','ServicenowField','rawAttributes','fieldName','model'];(function(_0x1408d4,_0x50e3da){var _0x115175=function(_0x42c4a0){while(--_0x42c4a0){_0x1408d4['push'](_0x1408d4['shift']());}};_0x115175(++_0x50e3da);}(_0x6430,0xfc));var _0x0643=function(_0x10dc01,_0x3d05b2){_0x10dc01=_0x10dc01-0x0;var _0x3e5dd0=_0x6430[_0x10dc01];return _0x3e5dd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0643('0x0'));var zipdir=require(_0x0643('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0643('0x2'));var moment=require(_0x0643('0x3'));var BPromise=require(_0x0643('0x4'));var Mustache=require(_0x0643('0x5'));var util=require('util');var path=require(_0x0643('0x6'));var sox=require(_0x0643('0x7'));var csv=require(_0x0643('0x8'));var ejs=require(_0x0643('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0643('0xa'));var squel=require('squel');var crypto=require(_0x0643('0xb'));var jsforce=require(_0x0643('0xc'));var deskjs=require(_0x0643('0xd'));var toCsv=require(_0x0643('0x8'));var querystring=require(_0x0643('0xe'));var Papa=require(_0x0643('0xf'));var Redis=require(_0x0643('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x0643('0x11'));var as=require(_0x0643('0x12'));var hardwareService=require(_0x0643('0x13'));var logger=require(_0x0643('0x14'))(_0x0643('0x15'));var utils=require(_0x0643('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x0643('0x17'));var db=require(_0x0643('0x18'))['db'];function respondWithStatusCode(_0x4c2576,_0x2c8331){_0x2c8331=_0x2c8331||0xcc;return function(_0x105a6f){if(_0x105a6f){return _0x4c2576['sendStatus'](_0x2c8331);}return _0x4c2576[_0x0643('0x19')](_0x2c8331)[_0x0643('0x1a')]();};}function respondWithResult(_0x4fcea4,_0x5ad12a){_0x5ad12a=_0x5ad12a||0xc8;return function(_0x18ef99){if(_0x18ef99){return _0x4fcea4[_0x0643('0x19')](_0x5ad12a)[_0x0643('0x1b')](_0x18ef99);}};}function respondWithFilteredResult(_0x149b93,_0x589e9a){return function(_0x4cae87){if(_0x4cae87){var _0x24300e=typeof _0x589e9a[_0x0643('0x1c')]===_0x0643('0x1d')&&typeof _0x589e9a['limit']===_0x0643('0x1d');var _0x3df414=_0x4cae87[_0x0643('0x1e')];var _0x146498=_0x24300e?0x0:_0x589e9a[_0x0643('0x1c')];var _0x116d1a=_0x24300e?_0x4cae87[_0x0643('0x1e')]:_0x589e9a[_0x0643('0x1c')]+_0x589e9a[_0x0643('0x1f')];var _0x3c9948;if(_0x116d1a>=_0x3df414){_0x116d1a=_0x3df414;_0x3c9948=0xc8;}else{_0x3c9948=0xce;}_0x149b93[_0x0643('0x19')](_0x3c9948);return _0x149b93[_0x0643('0x20')](_0x0643('0x21'),_0x146498+'-'+_0x116d1a+'/'+_0x3df414)[_0x0643('0x1b')](_0x4cae87);}return null;};}function patchUpdates(_0x4000ba){return function(_0x13d37f){try{jsonpatch['apply'](_0x13d37f,_0x4000ba,!![]);}catch(_0x1930ca){return BPromise[_0x0643('0x22')](_0x1930ca);}return _0x13d37f[_0x0643('0x23')]();};}function saveUpdates(_0x1d5159,_0x4525d6){return function(_0x24a79b){if(_0x24a79b){return _0x24a79b[_0x0643('0x24')](_0x1d5159)['then'](function(_0x805c14){return _0x805c14;});}return null;};}function removeEntity(_0x49d690,_0x210460){return function(_0x16b0fa){if(_0x16b0fa){return _0x16b0fa['destroy']()[_0x0643('0x25')](function(){_0x49d690[_0x0643('0x19')](0xcc)[_0x0643('0x1a')]();});}};}function handleEntityNotFound(_0x245be7,_0x2e2020){return function(_0x482162){if(!_0x482162){_0x245be7[_0x0643('0x26')](0x194);}return _0x482162;};}function handleError(_0xe11019,_0x5c6a0d){_0x5c6a0d=_0x5c6a0d||0x1f4;return function(_0x62ac49){logger['error'](_0x62ac49[_0x0643('0x27')]);if(_0x62ac49[_0x0643('0x28')]){delete _0x62ac49['name'];}_0xe11019[_0x0643('0x19')](_0x5c6a0d)[_0x0643('0x29')](_0x62ac49);};}exports[_0x0643('0x2a')]=function(_0x4fe5fd,_0x59ee0d){var _0x1ebbf3={},_0x30da4f={},_0x57fb4b={'count':0x0,'rows':[]};var _0x4b0dec=_[_0x0643('0x2b')](db[_0x0643('0x2c')][_0x0643('0x2d')],function(_0x5c94e1){return{'name':_0x5c94e1[_0x0643('0x2e')],'type':_0x5c94e1['type']['key']};});_0x30da4f[_0x0643('0x2f')]=_[_0x0643('0x2b')](_0x4b0dec,_0x0643('0x28'));_0x30da4f['query']=_[_0x0643('0x30')](_0x4fe5fd['query']);_0x30da4f['filters']=_[_0x0643('0x31')](_0x30da4f[_0x0643('0x2f')],_0x30da4f[_0x0643('0x32')]);_0x1ebbf3[_0x0643('0x33')]=_[_0x0643('0x31')](_0x30da4f[_0x0643('0x2f')],qs[_0x0643('0x34')](_0x4fe5fd[_0x0643('0x32')][_0x0643('0x34')]));_0x1ebbf3[_0x0643('0x33')]=_0x1ebbf3['attributes'][_0x0643('0x35')]?_0x1ebbf3['attributes']:_0x30da4f['model'];if(!_0x4fe5fd[_0x0643('0x32')][_0x0643('0x36')](_0x0643('0x37'))){_0x1ebbf3[_0x0643('0x1f')]=qs[_0x0643('0x1f')](_0x4fe5fd[_0x0643('0x32')][_0x0643('0x1f')]);_0x1ebbf3[_0x0643('0x1c')]=qs[_0x0643('0x1c')](_0x4fe5fd[_0x0643('0x32')][_0x0643('0x1c')]);}_0x1ebbf3[_0x0643('0x38')]=qs[_0x0643('0x39')](_0x4fe5fd['query']['sort']);_0x1ebbf3[_0x0643('0x3a')]=qs[_0x0643('0x3b')](_[_0x0643('0x3c')](_0x4fe5fd[_0x0643('0x32')],_0x30da4f[_0x0643('0x3b')]),_0x4b0dec);if(_0x4fe5fd[_0x0643('0x32')][_0x0643('0x3d')]){_0x1ebbf3['where']=_[_0x0643('0x3e')](_0x1ebbf3['where'],{'$or':_[_0x0643('0x2b')](_0x4b0dec,function(_0x17cfa4){if(_0x17cfa4['type']!=='VIRTUAL'){var _0xea67ff={};_0xea67ff[_0x17cfa4[_0x0643('0x28')]]={'$like':'%'+_0x4fe5fd[_0x0643('0x32')]['filter']+'%'};return _0xea67ff;}})});}_0x1ebbf3=_[_0x0643('0x3e')]({},_0x1ebbf3,_0x4fe5fd[_0x0643('0x3f')]);var _0x598f64={'where':_0x1ebbf3[_0x0643('0x3a')]};return db[_0x0643('0x2c')][_0x0643('0x1e')](_0x598f64)[_0x0643('0x25')](function(_0x290471){_0x57fb4b[_0x0643('0x1e')]=_0x290471;if(_0x4fe5fd[_0x0643('0x32')][_0x0643('0x40')]){_0x1ebbf3[_0x0643('0x41')]=[{'all':!![]}];}return db[_0x0643('0x2c')][_0x0643('0x42')](_0x1ebbf3);})[_0x0643('0x25')](function(_0x30b747){_0x57fb4b[_0x0643('0x43')]=_0x30b747;return _0x57fb4b;})[_0x0643('0x25')](respondWithFilteredResult(_0x59ee0d,_0x1ebbf3))['catch'](handleError(_0x59ee0d,null));};exports[_0x0643('0x44')]=function(_0x355050,_0x1ca090){var _0x56c1ff={'raw':!![],'where':{'id':_0x355050[_0x0643('0x45')]['id']}},_0x2db015={};_0x2db015[_0x0643('0x2f')]=_[_0x0643('0x30')](db[_0x0643('0x2c')][_0x0643('0x2d')]);_0x2db015['query']=_['keys'](_0x355050[_0x0643('0x32')]);_0x2db015['filters']=_[_0x0643('0x31')](_0x2db015[_0x0643('0x2f')],_0x2db015[_0x0643('0x32')]);_0x56c1ff[_0x0643('0x33')]=_[_0x0643('0x31')](_0x2db015['model'],qs[_0x0643('0x34')](_0x355050['query'][_0x0643('0x34')]));_0x56c1ff['attributes']=_0x56c1ff[_0x0643('0x33')][_0x0643('0x35')]?_0x56c1ff[_0x0643('0x33')]:_0x2db015[_0x0643('0x2f')];if(_0x355050[_0x0643('0x32')][_0x0643('0x40')]){_0x56c1ff[_0x0643('0x41')]=[{'all':!![]}];}_0x56c1ff=_[_0x0643('0x3e')]({},_0x56c1ff,_0x355050['options']);return db[_0x0643('0x2c')][_0x0643('0x46')](_0x56c1ff)[_0x0643('0x25')](handleEntityNotFound(_0x1ca090,null))[_0x0643('0x25')](respondWithResult(_0x1ca090,null))['catch'](handleError(_0x1ca090,null));};exports[_0x0643('0x47')]=function(_0x3a931a,_0x3f4cb2){return db['ServicenowField']['create'](_0x3a931a['body'],{})['then'](respondWithResult(_0x3f4cb2,0xc9))['catch'](handleError(_0x3f4cb2,null));};exports[_0x0643('0x24')]=function(_0x32c8b7,_0x12ac2a){if(_0x32c8b7['body']['id']){delete _0x32c8b7[_0x0643('0x48')]['id'];}return db[_0x0643('0x2c')][_0x0643('0x46')]({'where':{'id':_0x32c8b7[_0x0643('0x45')]['id']}})[_0x0643('0x25')](handleEntityNotFound(_0x12ac2a,null))[_0x0643('0x25')](saveUpdates(_0x32c8b7[_0x0643('0x48')],null))['then'](respondWithResult(_0x12ac2a,null))[_0x0643('0x49')](handleError(_0x12ac2a,null));};exports[_0x0643('0x4a')]=function(_0x58db28,_0x5dcb8c){return db[_0x0643('0x2c')][_0x0643('0x46')]({'where':{'id':_0x58db28['params']['id']}})['then'](handleEntityNotFound(_0x5dcb8c,null))[_0x0643('0x25')](removeEntity(_0x5dcb8c,null))[_0x0643('0x49')](handleError(_0x5dcb8c,null));}; \ No newline at end of file +var _0x4d52=['Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','name','send','map','ServicenowField','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','options','include','rows','catch','show','params','includeAll','merge','create','body','find','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','undefined','offset','count','limit','set'];(function(_0x400766,_0x368660){var _0x3ae58b=function(_0x4c6a6e){while(--_0x4c6a6e){_0x400766['push'](_0x400766['shift']());}};_0x3ae58b(++_0x368660);}(_0x4d52,0x168));var _0x24d5=function(_0x2ad2f5,_0x5ca655){_0x2ad2f5=_0x2ad2f5-0x0;var _0x59081a=_0x4d52[_0x2ad2f5];return _0x59081a;};'use strict';var emlformat=require(_0x24d5('0x0'));var rimraf=require(_0x24d5('0x1'));var zipdir=require(_0x24d5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x24d5('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x24d5('0x4'));var util=require(_0x24d5('0x5'));var path=require(_0x24d5('0x6'));var sox=require(_0x24d5('0x7'));var csv=require(_0x24d5('0x8'));var ejs=require(_0x24d5('0x9'));var fs=require('fs');var fs_extra=require(_0x24d5('0xa'));var _=require(_0x24d5('0xb'));var squel=require(_0x24d5('0xc'));var crypto=require(_0x24d5('0xd'));var jsforce=require(_0x24d5('0xe'));var deskjs=require(_0x24d5('0xf'));var toCsv=require(_0x24d5('0x8'));var querystring=require(_0x24d5('0x10'));var Papa=require(_0x24d5('0x11'));var Redis=require(_0x24d5('0x12'));var authService=require(_0x24d5('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x24d5('0x14'));var hardwareService=require(_0x24d5('0x15'));var logger=require(_0x24d5('0x16'))(_0x24d5('0x17'));var utils=require(_0x24d5('0x18'));var config=require(_0x24d5('0x19'));var licenseUtil=require(_0x24d5('0x1a'));var db=require(_0x24d5('0x1b'))['db'];function respondWithStatusCode(_0x28a849,_0xfb889b){_0xfb889b=_0xfb889b||0xcc;return function(_0x5c3743){if(_0x5c3743){return _0x28a849['sendStatus'](_0xfb889b);}return _0x28a849[_0x24d5('0x1c')](_0xfb889b)[_0x24d5('0x1d')]();};}function respondWithResult(_0x30705a,_0x7d4ef0){_0x7d4ef0=_0x7d4ef0||0xc8;return function(_0x16e20b){if(_0x16e20b){return _0x30705a['status'](_0x7d4ef0)['json'](_0x16e20b);}};}function respondWithFilteredResult(_0x4bfc6f,_0x5d480c){return function(_0xbf7f14){if(_0xbf7f14){var _0x547157=typeof _0x5d480c['offset']===_0x24d5('0x1e')&&typeof _0x5d480c['limit']===_0x24d5('0x1e');var _0x2cfaa1=_0xbf7f14['count'];var _0x5b2a49=_0x547157?0x0:_0x5d480c[_0x24d5('0x1f')];var _0x2aced1=_0x547157?_0xbf7f14[_0x24d5('0x20')]:_0x5d480c['offset']+_0x5d480c[_0x24d5('0x21')];var _0x4ee01f;if(_0x2aced1>=_0x2cfaa1){_0x2aced1=_0x2cfaa1;_0x4ee01f=0xc8;}else{_0x4ee01f=0xce;}_0x4bfc6f[_0x24d5('0x1c')](_0x4ee01f);return _0x4bfc6f[_0x24d5('0x22')](_0x24d5('0x23'),_0x5b2a49+'-'+_0x2aced1+'/'+_0x2cfaa1)[_0x24d5('0x24')](_0xbf7f14);}return null;};}function patchUpdates(_0x138b28){return function(_0x5dccf7){try{jsonpatch[_0x24d5('0x25')](_0x5dccf7,_0x138b28,!![]);}catch(_0x395c6c){return BPromise[_0x24d5('0x26')](_0x395c6c);}return _0x5dccf7[_0x24d5('0x27')]();};}function saveUpdates(_0x54d4c7,_0x463c1b){return function(_0x3509e4){if(_0x3509e4){return _0x3509e4[_0x24d5('0x28')](_0x54d4c7)[_0x24d5('0x29')](function(_0x1fff2a){return _0x1fff2a;});}return null;};}function removeEntity(_0x1537a4,_0x4e590b){return function(_0x47c843){if(_0x47c843){return _0x47c843[_0x24d5('0x2a')]()[_0x24d5('0x29')](function(){_0x1537a4[_0x24d5('0x1c')](0xcc)[_0x24d5('0x1d')]();});}};}function handleEntityNotFound(_0xd26f92,_0x9a624a){return function(_0xe0a381){if(!_0xe0a381){_0xd26f92[_0x24d5('0x2b')](0x194);}return _0xe0a381;};}function handleError(_0x3caa98,_0x224c10){_0x224c10=_0x224c10||0x1f4;return function(_0x5e0a35){logger[_0x24d5('0x2c')](_0x5e0a35['stack']);if(_0x5e0a35[_0x24d5('0x2d')]){delete _0x5e0a35['name'];}_0x3caa98[_0x24d5('0x1c')](_0x224c10)[_0x24d5('0x2e')](_0x5e0a35);};}exports['index']=function(_0x1168f7,_0x495283){var _0x2b2b71={},_0x163939={},_0x34be7a={'count':0x0,'rows':[]};var _0x2268de=_[_0x24d5('0x2f')](db[_0x24d5('0x30')][_0x24d5('0x31')],function(_0x137e20){return{'name':_0x137e20[_0x24d5('0x32')],'type':_0x137e20[_0x24d5('0x33')][_0x24d5('0x34')]};});_0x163939['model']=_['map'](_0x2268de,_0x24d5('0x2d'));_0x163939[_0x24d5('0x35')]=_[_0x24d5('0x36')](_0x1168f7['query']);_0x163939[_0x24d5('0x37')]=_[_0x24d5('0x38')](_0x163939[_0x24d5('0x39')],_0x163939[_0x24d5('0x35')]);_0x2b2b71[_0x24d5('0x3a')]=_[_0x24d5('0x38')](_0x163939[_0x24d5('0x39')],qs[_0x24d5('0x3b')](_0x1168f7[_0x24d5('0x35')][_0x24d5('0x3b')]));_0x2b2b71['attributes']=_0x2b2b71[_0x24d5('0x3a')][_0x24d5('0x3c')]?_0x2b2b71['attributes']:_0x163939[_0x24d5('0x39')];if(!_0x1168f7[_0x24d5('0x35')][_0x24d5('0x3d')](_0x24d5('0x3e'))){_0x2b2b71[_0x24d5('0x21')]=qs[_0x24d5('0x21')](_0x1168f7[_0x24d5('0x35')][_0x24d5('0x21')]);_0x2b2b71[_0x24d5('0x1f')]=qs[_0x24d5('0x1f')](_0x1168f7[_0x24d5('0x35')][_0x24d5('0x1f')]);}_0x2b2b71['order']=qs[_0x24d5('0x3f')](_0x1168f7[_0x24d5('0x35')][_0x24d5('0x3f')]);_0x2b2b71['where']=qs[_0x24d5('0x37')](_[_0x24d5('0x40')](_0x1168f7[_0x24d5('0x35')],_0x163939['filters']),_0x2268de);if(_0x1168f7['query'][_0x24d5('0x41')]){_0x2b2b71[_0x24d5('0x42')]=_['merge'](_0x2b2b71[_0x24d5('0x42')],{'$or':_[_0x24d5('0x2f')](_0x2268de,function(_0x14f861){if(_0x14f861[_0x24d5('0x33')]!==_0x24d5('0x43')){var _0x5ac216={};_0x5ac216[_0x14f861[_0x24d5('0x2d')]]={'$like':'%'+_0x1168f7[_0x24d5('0x35')][_0x24d5('0x41')]+'%'};return _0x5ac216;}})});}_0x2b2b71=_['merge']({},_0x2b2b71,_0x1168f7[_0x24d5('0x44')]);var _0x487e6f={'where':_0x2b2b71[_0x24d5('0x42')]};return db['ServicenowField'][_0x24d5('0x20')](_0x487e6f)[_0x24d5('0x29')](function(_0x4c23b5){_0x34be7a['count']=_0x4c23b5;if(_0x1168f7[_0x24d5('0x35')]['includeAll']){_0x2b2b71[_0x24d5('0x45')]=[{'all':!![]}];}return db[_0x24d5('0x30')]['findAll'](_0x2b2b71);})[_0x24d5('0x29')](function(_0x1f786b){_0x34be7a[_0x24d5('0x46')]=_0x1f786b;return _0x34be7a;})[_0x24d5('0x29')](respondWithFilteredResult(_0x495283,_0x2b2b71))[_0x24d5('0x47')](handleError(_0x495283,null));};exports[_0x24d5('0x48')]=function(_0x1a394a,_0x46ac2b){var _0x245765={'raw':!![],'where':{'id':_0x1a394a[_0x24d5('0x49')]['id']}},_0x5cfc9a={};_0x5cfc9a['model']=_[_0x24d5('0x36')](db[_0x24d5('0x30')]['rawAttributes']);_0x5cfc9a[_0x24d5('0x35')]=_[_0x24d5('0x36')](_0x1a394a[_0x24d5('0x35')]);_0x5cfc9a[_0x24d5('0x37')]=_[_0x24d5('0x38')](_0x5cfc9a['model'],_0x5cfc9a[_0x24d5('0x35')]);_0x245765[_0x24d5('0x3a')]=_['intersection'](_0x5cfc9a[_0x24d5('0x39')],qs['fields'](_0x1a394a[_0x24d5('0x35')][_0x24d5('0x3b')]));_0x245765[_0x24d5('0x3a')]=_0x245765[_0x24d5('0x3a')]['length']?_0x245765['attributes']:_0x5cfc9a['model'];if(_0x1a394a['query'][_0x24d5('0x4a')]){_0x245765['include']=[{'all':!![]}];}_0x245765=_[_0x24d5('0x4b')]({},_0x245765,_0x1a394a[_0x24d5('0x44')]);return db['ServicenowField']['find'](_0x245765)['then'](handleEntityNotFound(_0x46ac2b,null))[_0x24d5('0x29')](respondWithResult(_0x46ac2b,null))[_0x24d5('0x47')](handleError(_0x46ac2b,null));};exports[_0x24d5('0x4c')]=function(_0x2ab5e1,_0x31b20c){return db['ServicenowField']['create'](_0x2ab5e1[_0x24d5('0x4d')],{})[_0x24d5('0x29')](respondWithResult(_0x31b20c,0xc9))[_0x24d5('0x47')](handleError(_0x31b20c,null));};exports[_0x24d5('0x28')]=function(_0x3749bb,_0x31ad81){if(_0x3749bb[_0x24d5('0x4d')]['id']){delete _0x3749bb[_0x24d5('0x4d')]['id'];}return db[_0x24d5('0x30')][_0x24d5('0x4e')]({'where':{'id':_0x3749bb['params']['id']}})[_0x24d5('0x29')](handleEntityNotFound(_0x31ad81,null))[_0x24d5('0x29')](saveUpdates(_0x3749bb[_0x24d5('0x4d')],null))[_0x24d5('0x29')](respondWithResult(_0x31ad81,null))['catch'](handleError(_0x31ad81,null));};exports[_0x24d5('0x2a')]=function(_0xfda489,_0x64dbc1){return db[_0x24d5('0x30')][_0x24d5('0x4e')]({'where':{'id':_0xfda489[_0x24d5('0x49')]['id']}})[_0x24d5('0x29')](handleEntityNotFound(_0x64dbc1,null))['then'](removeEntity(_0x64dbc1,null))['catch'](handleError(_0x64dbc1,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 005a7b0..73ac70f 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 _0xc10f=['ServicenowField','servicenow_unique_index','idField','lodash','../../config/logger','api','bluebird','request-promise','path','./intServicenowField.attributes','exports','define'];(function(_0x49f8ed,_0x2f202c){var _0xa5d6d9=function(_0x4e72ce){while(--_0x4e72ce){_0x49f8ed['push'](_0x49f8ed['shift']());}};_0xa5d6d9(++_0x2f202c);}(_0xc10f,0x1ef));var _0xfc10=function(_0xc247e7,_0x1e0f7a){_0xc247e7=_0xc247e7-0x0;var _0x182dc0=_0xc10f[_0xc247e7];return _0x182dc0;};'use strict';var _=require(_0xfc10('0x0'));var util=require('util');var logger=require(_0xfc10('0x1'))(_0xfc10('0x2'));var moment=require('moment');var BPromise=require(_0xfc10('0x3'));var rp=require(_0xfc10('0x4'));var fs=require('fs');var path=require(_0xfc10('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xfc10('0x6'));module[_0xfc10('0x7')]=function(_0x5c8587,_0x206a14){return _0x5c8587[_0xfc10('0x8')](_0xfc10('0x9'),attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':_0xfc10('0xa'),'fields':[_0xfc10('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7ac9=['path','rimraf','ServicenowField','int_servicenow_fields','servicenow_unique_index','idField','FieldId','lodash','util','api','moment','bluebird','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7ac9,0x10b));var _0x97ac=function(_0xd49df8,_0x2349f4){_0xd49df8=_0xd49df8-0x0;var _0x849e7f=_0x7ac9[_0xd49df8];return _0x849e7f;};'use strict';var _=require(_0x97ac('0x0'));var util=require(_0x97ac('0x1'));var logger=require('../../config/logger')(_0x97ac('0x2'));var moment=require(_0x97ac('0x3'));var BPromise=require(_0x97ac('0x4'));var rp=require(_0x97ac('0x5'));var fs=require('fs');var path=require(_0x97ac('0x6'));var rimraf=require(_0x97ac('0x7'));var config=require('../../config/environment');var attributes=require('./intServicenowField.attributes');module['exports']=function(_0x5e39f5,_0x245de3){return _0x5e39f5['define'](_0x97ac('0x8'),attributes,{'tableName':_0x97ac('0x9'),'paranoid':![],'indexes':[{'name':_0x97ac('0xa'),'fields':[_0x97ac('0xb'),_0x97ac('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.rpc.js b/server/api/intServicenowField/intServicenowField.rpc.js index 82c3374..0b14b99 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 _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s'];(function(_0x146d27,_0x1bd22c){var _0x3e39df=function(_0x187982){while(--_0x187982){_0x146d27['push'](_0x146d27['shift']());}};_0x3e39df(++_0x1bd22c);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x100682,_0x11afec){_0x100682=_0x100682-0x0;var _0xcb6e87=_0xcb91[_0x100682];return _0xcb6e87;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('ServicenowField,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});} \ No newline at end of file +var _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s'];(function(_0x2297a8,_0x21001c){var _0x45d0a8=function(_0x23c408){while(--_0x23c408){_0x2297a8['push'](_0x2297a8['shift']());}};_0x45d0a8(++_0x21001c);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x383dbb,_0x17d41b){_0x383dbb=_0x383dbb-0x0;var _0x6e8bde=_0xcb91[_0x383dbb];return _0x6e8bde;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('ServicenowField,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index c157932..7c24d13 100644 --- a/server/api/intSugarcrmAccount/index.js +++ b/server/api/intSugarcrmAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x4e83ad,_0x5501a0){var _0x2e9bc6=function(_0xd25889){while(--_0xd25889){_0x4e83ad['push'](_0x4e83ad['shift']());}};_0x2e9bc6(++_0x5501a0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa9e0[_0x297fd3];return _0x2af381;};'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','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x8e7704,_0x5f4388){var _0x382ebb=function(_0x3b3cb3){while(--_0x3b3cb3){_0x8e7704['push'](_0x8e7704['shift']());}};_0x382ebb(++_0x5f4388);}(_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/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 b43729e..0c203b7 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(_0x295802,_0x578cf3){var _0x5a2d44=function(_0x38f8c8){while(--_0x38f8c8){_0x295802['push'](_0x295802['shift']());}};_0x5a2d44(++_0x578cf3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'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(_0x22c6c1,_0x1483a3){var _0x1d9c1a=function(_0x36666b){while(--_0x36666b){_0x22c6c1['push'](_0x22c6c1['shift']());}};_0x1d9c1a(++_0x1483a3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'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 6a05074..49a036a 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 _0x6ea5=['../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','SugarcrmAccount','include','findAll','rows','catch','params','find','create','body','getConfigurations','findOne','hasOwnProperty','Subjects','getSubjects','getDescriptions','channel','SugarcrmConfiguration','SugarcrmField','Descriptions','getFields','assigned_user_id','created_by','description','duration_minutes','parent_id','parent_type','direction','username','slice','substring','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','login','stringify','password','PLAIN','Invalid\x20Login','Password\x20Expired','get_module_fields','JSON','values','module_fields','remove','includes','endsWith','statusCode','test','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment'];(function(_0x1aafb3,_0x1654f4){var _0x4866fa=function(_0x5673ed){while(--_0x5673ed){_0x1aafb3['push'](_0x1aafb3['shift']());}};_0x4866fa(++_0x1654f4);}(_0x6ea5,0x14f));var _0x56ea=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6ea5[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x56ea('0x0'));var zipdir=require(_0x56ea('0x1'));var jsonpatch=require(_0x56ea('0x2'));var rp=require(_0x56ea('0x3'));var moment=require(_0x56ea('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x56ea('0x5'));var util=require(_0x56ea('0x6'));var path=require(_0x56ea('0x7'));var sox=require(_0x56ea('0x8'));var csv=require(_0x56ea('0x9'));var ejs=require(_0x56ea('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x56ea('0xb'));var squel=require(_0x56ea('0xc'));var crypto=require(_0x56ea('0xd'));var jsforce=require(_0x56ea('0xe'));var deskjs=require(_0x56ea('0xf'));var toCsv=require('to-csv');var querystring=require(_0x56ea('0x10'));var Papa=require(_0x56ea('0x11'));var Redis=require(_0x56ea('0x12'));var authService=require(_0x56ea('0x13'));var qs=require(_0x56ea('0x14'));var as=require(_0x56ea('0x15'));var hardwareService=require(_0x56ea('0x16'));var logger=require('../../config/logger')(_0x56ea('0x17'));var utils=require('../../config/utils');var config=require(_0x56ea('0x18'));var licenseUtil=require(_0x56ea('0x19'));var db=require(_0x56ea('0x1a'))['db'];var integrations=require(_0x56ea('0x1b'));function respondWithStatusCode(_0x3d357f,_0x45fc36){_0x45fc36=_0x45fc36||0xcc;return function(_0xfdcce5){if(_0xfdcce5){return _0x3d357f['sendStatus'](_0x45fc36);}return _0x3d357f[_0x56ea('0x1c')](_0x45fc36)[_0x56ea('0x1d')]();};}function respondWithResult(_0xfdc83e,_0x43f1a3){_0x43f1a3=_0x43f1a3||0xc8;return function(_0x55561b){if(_0x55561b){return _0xfdc83e[_0x56ea('0x1c')](_0x43f1a3)[_0x56ea('0x1e')](_0x55561b);}};}function respondWithFilteredResult(_0x14b07,_0x5c0e10){return function(_0x4680b9){if(_0x4680b9){var _0x36187a=typeof _0x5c0e10[_0x56ea('0x1f')]==='undefined'&&typeof _0x5c0e10[_0x56ea('0x20')]==='undefined';var _0x53ae4c=_0x4680b9[_0x56ea('0x21')];var _0x4bdb3b=_0x36187a?0x0:_0x5c0e10['offset'];var _0x3a3d71=_0x36187a?_0x4680b9['count']:_0x5c0e10[_0x56ea('0x1f')]+_0x5c0e10['limit'];var _0xf40ef1;if(_0x3a3d71>=_0x53ae4c){_0x3a3d71=_0x53ae4c;_0xf40ef1=0xc8;}else{_0xf40ef1=0xce;}_0x14b07['status'](_0xf40ef1);return _0x14b07[_0x56ea('0x22')](_0x56ea('0x23'),_0x4bdb3b+'-'+_0x3a3d71+'/'+_0x53ae4c)[_0x56ea('0x1e')](_0x4680b9);}return null;};}function patchUpdates(_0x20bc75){return function(_0x4f40c1){try{jsonpatch[_0x56ea('0x24')](_0x4f40c1,_0x20bc75,!![]);}catch(_0x22be2d){return BPromise[_0x56ea('0x25')](_0x22be2d);}return _0x4f40c1[_0x56ea('0x26')]();};}function saveUpdates(_0x4598e5,_0x1d1b38){return function(_0x176c8a){if(_0x176c8a){return _0x176c8a[_0x56ea('0x27')](_0x4598e5)[_0x56ea('0x28')](function(_0x40183f){return _0x40183f;});}return null;};}function removeEntity(_0x1846db,_0x578009){return function(_0x46619d){if(_0x46619d){return _0x46619d[_0x56ea('0x29')]()['then'](function(){_0x1846db[_0x56ea('0x1c')](0xcc)[_0x56ea('0x1d')]();});}};}function handleEntityNotFound(_0x43a5c8,_0x3ed30d){return function(_0x1c062d){if(!_0x1c062d){_0x43a5c8[_0x56ea('0x2a')](0x194);}return _0x1c062d;};}function handleError(_0x2d3199,_0x43555a){_0x43555a=_0x43555a||0x1f4;return function(_0x2427f5){logger[_0x56ea('0x2b')](_0x2427f5[_0x56ea('0x2c')]);if(_0x2427f5[_0x56ea('0x2d')]){delete _0x2427f5[_0x56ea('0x2d')];}_0x2d3199[_0x56ea('0x1c')](_0x43555a)[_0x56ea('0x2e')](_0x2427f5);};}exports[_0x56ea('0x2f')]=function(_0x448823,_0x3ffe51){var _0x3a153d={},_0x23bae7={},_0x3c75cb={'count':0x0,'rows':[]};var _0x49ce63=_[_0x56ea('0x30')](db['SugarcrmAccount'][_0x56ea('0x31')],function(_0x1dddd5){return{'name':_0x1dddd5['fieldName'],'type':_0x1dddd5['type'][_0x56ea('0x32')]};});_0x23bae7[_0x56ea('0x33')]=_[_0x56ea('0x30')](_0x49ce63,_0x56ea('0x2d'));_0x23bae7[_0x56ea('0x34')]=_[_0x56ea('0x35')](_0x448823[_0x56ea('0x34')]);_0x23bae7[_0x56ea('0x36')]=_[_0x56ea('0x37')](_0x23bae7[_0x56ea('0x33')],_0x23bae7[_0x56ea('0x34')]);_0x3a153d[_0x56ea('0x38')]=_[_0x56ea('0x37')](_0x23bae7['model'],qs['fields'](_0x448823['query'][_0x56ea('0x39')]));_0x3a153d['attributes']=_0x3a153d['attributes'][_0x56ea('0x3a')]?_0x3a153d['attributes']:_0x23bae7[_0x56ea('0x33')];if(!_0x448823[_0x56ea('0x34')]['hasOwnProperty'](_0x56ea('0x3b'))){_0x3a153d[_0x56ea('0x20')]=qs[_0x56ea('0x20')](_0x448823[_0x56ea('0x34')]['limit']);_0x3a153d[_0x56ea('0x1f')]=qs['offset'](_0x448823[_0x56ea('0x34')][_0x56ea('0x1f')]);}_0x3a153d[_0x56ea('0x3c')]=qs[_0x56ea('0x3d')](_0x448823[_0x56ea('0x34')][_0x56ea('0x3d')]);_0x3a153d[_0x56ea('0x3e')]=qs[_0x56ea('0x36')](_[_0x56ea('0x3f')](_0x448823[_0x56ea('0x34')],_0x23bae7['filters']),_0x49ce63);if(_0x448823[_0x56ea('0x34')][_0x56ea('0x40')]){_0x3a153d[_0x56ea('0x3e')]=_[_0x56ea('0x41')](_0x3a153d['where'],{'$or':_[_0x56ea('0x30')](_0x49ce63,function(_0x18a967){if(_0x18a967[_0x56ea('0x42')]!==_0x56ea('0x43')){var _0x4d2e00={};_0x4d2e00[_0x18a967[_0x56ea('0x2d')]]={'$like':'%'+_0x448823[_0x56ea('0x34')][_0x56ea('0x40')]+'%'};return _0x4d2e00;}})});}_0x3a153d=_[_0x56ea('0x41')]({},_0x3a153d,_0x448823[_0x56ea('0x44')]);var _0x3130ba={'where':_0x3a153d[_0x56ea('0x3e')]};return db[_0x56ea('0x45')][_0x56ea('0x21')](_0x3130ba)[_0x56ea('0x28')](function(_0x3dd12e){_0x3c75cb[_0x56ea('0x21')]=_0x3dd12e;if(_0x448823[_0x56ea('0x34')]['includeAll']){_0x3a153d[_0x56ea('0x46')]=[{'all':!![]}];}return db['SugarcrmAccount'][_0x56ea('0x47')](_0x3a153d);})[_0x56ea('0x28')](function(_0x997ad){_0x3c75cb[_0x56ea('0x48')]=_0x997ad;return _0x3c75cb;})[_0x56ea('0x28')](respondWithFilteredResult(_0x3ffe51,_0x3a153d))[_0x56ea('0x49')](handleError(_0x3ffe51,null));};exports['show']=function(_0x135712,_0x1b2409){var _0x3d7d28={'raw':![],'where':{'id':_0x135712[_0x56ea('0x4a')]['id']}},_0x4d8e6c={};_0x4d8e6c[_0x56ea('0x33')]=_[_0x56ea('0x35')](db['SugarcrmAccount']['rawAttributes']);_0x4d8e6c[_0x56ea('0x34')]=_[_0x56ea('0x35')](_0x135712[_0x56ea('0x34')]);_0x4d8e6c[_0x56ea('0x36')]=_[_0x56ea('0x37')](_0x4d8e6c[_0x56ea('0x33')],_0x4d8e6c[_0x56ea('0x34')]);_0x3d7d28[_0x56ea('0x38')]=_['intersection'](_0x4d8e6c['model'],qs['fields'](_0x135712['query'][_0x56ea('0x39')]));_0x3d7d28[_0x56ea('0x38')]=_0x3d7d28[_0x56ea('0x38')]['length']?_0x3d7d28['attributes']:_0x4d8e6c[_0x56ea('0x33')];if(_0x135712['query']['includeAll']){_0x3d7d28['include']=[{'all':!![]}];}_0x3d7d28=_['merge']({},_0x3d7d28,_0x135712['options']);return db[_0x56ea('0x45')][_0x56ea('0x4b')](_0x3d7d28)['then'](handleEntityNotFound(_0x1b2409,null))['then'](respondWithResult(_0x1b2409,null))[_0x56ea('0x49')](handleError(_0x1b2409,null));};exports[_0x56ea('0x4c')]=function(_0x287916,_0x3c48ae){return db['SugarcrmAccount'][_0x56ea('0x4c')](_0x287916[_0x56ea('0x4d')],{})[_0x56ea('0x28')](respondWithResult(_0x3c48ae,0xc9))[_0x56ea('0x49')](handleError(_0x3c48ae,null));};exports['update']=function(_0x1bcc94,_0x3eaf58){if(_0x1bcc94[_0x56ea('0x4d')]['id']){delete _0x1bcc94[_0x56ea('0x4d')]['id'];}return db[_0x56ea('0x45')][_0x56ea('0x4b')]({'where':{'id':_0x1bcc94[_0x56ea('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3eaf58,null))['then'](saveUpdates(_0x1bcc94['body'],null))[_0x56ea('0x28')](respondWithResult(_0x3eaf58,null))[_0x56ea('0x49')](handleError(_0x3eaf58,null));};exports['destroy']=function(_0xfb635f,_0x3a3b64){return db[_0x56ea('0x45')]['find']({'where':{'id':_0xfb635f['params']['id']}})[_0x56ea('0x28')](handleEntityNotFound(_0x3a3b64,null))['then'](removeEntity(_0x3a3b64,null))[_0x56ea('0x49')](handleError(_0x3a3b64,null));};exports[_0x56ea('0x4e')]=function(_0x1610d3,_0x13011a,_0x49fe01){var _0x5219ad={};var _0x37202c={};var _0x142b4c;var _0x3a8d15;return db[_0x56ea('0x45')][_0x56ea('0x4f')]({'where':{'id':_0x1610d3[_0x56ea('0x4a')]['id']}})[_0x56ea('0x28')](handleEntityNotFound(_0x13011a,null))[_0x56ea('0x28')](function(_0x123ba6){if(_0x123ba6){_0x142b4c=_0x123ba6;_0x37202c[_0x56ea('0x33')]=_[_0x56ea('0x35')](db['SugarcrmConfiguration'][_0x56ea('0x31')]);_0x37202c[_0x56ea('0x34')]=_['keys'](_0x1610d3[_0x56ea('0x34')]);_0x37202c['filters']=_['intersection'](_0x37202c[_0x56ea('0x33')],_0x37202c['query']);_0x5219ad[_0x56ea('0x38')]=_[_0x56ea('0x37')](_0x37202c['model'],qs['fields'](_0x1610d3[_0x56ea('0x34')][_0x56ea('0x39')]));_0x5219ad[_0x56ea('0x38')]=_0x5219ad[_0x56ea('0x38')][_0x56ea('0x3a')]?_0x5219ad[_0x56ea('0x38')]:_0x37202c[_0x56ea('0x33')];_0x5219ad[_0x56ea('0x3c')]=qs[_0x56ea('0x3d')](_0x1610d3[_0x56ea('0x34')][_0x56ea('0x3d')]);_0x5219ad[_0x56ea('0x3e')]=qs['filters'](_[_0x56ea('0x3f')](_0x1610d3[_0x56ea('0x34')],_0x37202c[_0x56ea('0x36')]));if(_0x1610d3[_0x56ea('0x34')][_0x56ea('0x40')]){_0x5219ad['where']=_[_0x56ea('0x41')](_0x5219ad['where'],{'$or':_[_0x56ea('0x30')](_0x5219ad[_0x56ea('0x38')],function(_0x3fa17b){var _0x562cfd={};_0x562cfd[_0x3fa17b]={'$like':'%'+_0x1610d3[_0x56ea('0x34')][_0x56ea('0x40')]+'%'};return _0x562cfd;})});}_0x5219ad=_[_0x56ea('0x41')]({},_0x5219ad,_0x1610d3[_0x56ea('0x44')]);return _0x142b4c[_0x56ea('0x4e')](_0x5219ad);}})['then'](function(_0x37cd39){if(_0x37cd39){_0x3a8d15=_0x37cd39[_0x56ea('0x3a')];if(!_0x1610d3[_0x56ea('0x34')][_0x56ea('0x50')](_0x56ea('0x3b'))){_0x5219ad[_0x56ea('0x20')]=qs[_0x56ea('0x20')](_0x1610d3[_0x56ea('0x34')][_0x56ea('0x20')]);_0x5219ad[_0x56ea('0x1f')]=qs[_0x56ea('0x1f')](_0x1610d3[_0x56ea('0x34')][_0x56ea('0x1f')]);}return _0x142b4c[_0x56ea('0x4e')](_0x5219ad);}})[_0x56ea('0x28')](function(_0x1389f1){if(_0x1389f1){return _0x1389f1?{'count':_0x3a8d15,'rows':_0x1389f1}:null;}})[_0x56ea('0x28')](respondWithResult(_0x13011a,null))[_0x56ea('0x49')](handleError(_0x13011a,null));};exports['addConfiguration']=function(_0x23eca6,_0x2a60ad,_0x11aec6){if(_0x23eca6[_0x56ea('0x4d')]['id']){delete _0x23eca6[_0x56ea('0x4d')]['id'];}return db['SugarcrmAccount']['findOne']({'where':{'id':_0x23eca6[_0x56ea('0x4a')]['id']}})[_0x56ea('0x28')](handleEntityNotFound(_0x2a60ad,null))[_0x56ea('0x28')](function(_0x378161){if(_0x378161){_0x23eca6[_0x56ea('0x4d')]['AccountId']=_0x378161['id'];_0x23eca6[_0x56ea('0x4d')][_0x56ea('0x51')]=integrations[_0x56ea('0x52')](_0x23eca6['body']['channel'],_0x23eca6[_0x56ea('0x4d')][_0x56ea('0x42')]);_0x23eca6[_0x56ea('0x4d')]['Descriptions']=integrations[_0x56ea('0x53')](_0x23eca6['body'][_0x56ea('0x54')],_0x23eca6[_0x56ea('0x4d')][_0x56ea('0x42')]);return db[_0x56ea('0x55')][_0x56ea('0x4c')](_0x23eca6[_0x56ea('0x4d')],{'include':[{'model':db['SugarcrmField'],'as':_0x56ea('0x51')},{'model':db[_0x56ea('0x56')],'as':_0x56ea('0x57')}]});}return null;})[_0x56ea('0x28')](respondWithResult(_0x2a60ad,null))[_0x56ea('0x49')](handleError(_0x2a60ad,null));};exports[_0x56ea('0x58')]=function(_0x74b7fc,_0x1c3eb9,_0x416a0c){var _0x5a27ce='';var _0x2d6420=['id',_0x56ea('0x2d'),_0x56ea('0x59'),_0x56ea('0x5a'),_0x56ea('0x5b'),'date_start','duration_hours',_0x56ea('0x5c'),_0x56ea('0x5d'),_0x56ea('0x5e'),'parent_name',_0x56ea('0x5f')];return db['SugarcrmAccount'][_0x56ea('0x4f')]({'where':{'id':_0x74b7fc[_0x56ea('0x4a')]['id']},'attributes':['id',_0x56ea('0x60'),'password','remoteUri']})['then'](handleEntityNotFound(_0x1c3eb9,null))[_0x56ea('0x28')](function(_0x35aaa5){if(_0x35aaa5){_0x5a27ce=_0x35aaa5['remoteUri'];var _0x131445=_0x5a27ce[_0x56ea('0x61')](-0x1);if(_0x131445==='/'){_0x5a27ce=_0x5a27ce[_0x56ea('0x62')](0x0,_0x5a27ce[_0x56ea('0x63')](_0x131445));}return rp({'method':_0x56ea('0x64'),'uri':util[_0x56ea('0x65')](_0x56ea('0x66'),_0x5a27ce,_0x56ea('0x67')),'json':!![],'form':{'method':_0x56ea('0x68'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x56ea('0x69')]({'user_auth':{'user_name':_0x35aaa5[_0x56ea('0x60')],'password':_0x35aaa5[_0x56ea('0x6a')],'encryption':_0x56ea('0x6b')},'application':'xCALLY\x20Motion\x20Integration'})}});}})[_0x56ea('0x28')](function(_0x9cb7d0){if(_0x9cb7d0&&_0x9cb7d0[_0x56ea('0x2d')]!==_0x56ea('0x6c')&&_0x9cb7d0[_0x56ea('0x2d')]!==_0x56ea('0x6d')){return rp({'method':_0x56ea('0x64'),'uri':util['format'](_0x56ea('0x66'),_0x5a27ce,_0x56ea('0x67')),'json':!![],'form':{'method':_0x56ea('0x6e'),'input_type':_0x56ea('0x6f'),'response_type':_0x56ea('0x6f'),'rest_data':JSON[_0x56ea('0x69')]({'session':_0x9cb7d0['id'],'module_name':'Calls'})}})['then'](function(_0x1a23ef){if(_0x1a23ef){var _0x1c01dd=_[_0x56ea('0x70')](_0x1a23ef[_0x56ea('0x71')]);_[_0x56ea('0x72')](_0x1c01dd,function(_0x527ca6){return _0x2d6420[_0x56ea('0x73')](_0x527ca6[_0x56ea('0x2d')]);});return{'count':_0x1c01dd['length'],'rows':_['map'](_0x1c01dd,function(_0x165ac6){return{'id':_0x165ac6['name'],'name':_0x165ac6['label'],'custom':_[_0x56ea('0x74')](_0x165ac6[_0x56ea('0x2d')],'_c')?!![]:![],'options':_0x165ac6['options']?_[_0x56ea('0x30')](_[_0x56ea('0x70')](_0x165ac6[_0x56ea('0x44')]),function(_0x14f34d){return{'name':_0x14f34d['value'],'value':_0x14f34d[_0x56ea('0x2d')]};}):[]};})};}})[_0x56ea('0x28')](respondWithResult(_0x1c3eb9,null))[_0x56ea('0x49')](function(_0x3927a2){var _0x5abb2c=_0x74b7fc[_0x56ea('0x34')]['test']?0x1f4:_0x3927a2[_0x56ea('0x75')]||0x1f4;logger[_0x56ea('0x2b')]('getFields,\x20%s,\x20%s,\x20%s',_0x56ea('0x58'),_0x5abb2c,JSON[_0x56ea('0x69')](_0x3927a2));delete _0x3927a2[_0x56ea('0x2d')];if(_0x5abb2c===0x191){_0x5abb2c=0x190;}_0x1c3eb9[_0x56ea('0x1c')](_0x5abb2c)[_0x56ea('0x2e')](_0x74b7fc[_0x56ea('0x34')][_0x56ea('0x76')]?{'message':_0x56ea('0x77'),'statusCode':_0x3927a2[_0x56ea('0x75')]}:_0x3927a2);});}else{var _0x219a51=0x1f4;_0x1c3eb9[_0x56ea('0x1c')](_0x219a51)['send']({'message':_0x56ea('0x77'),'statusCode':0x190});}});}; \ No newline at end of file +var _0xab62=['Calls','values','module_fields','remove','label','value','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','error','stack','name','send','map','SugarcrmAccount','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','find','create','body','params','destroy','getConfigurations','SugarcrmConfiguration','addConfiguration','findOne','AccountId','Subjects','getSubjects','Descriptions','SugarcrmField','getFields','assigned_user_id','description','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','password','remoteUri','slice','substring','lastIndexOf','POST','%s%s','/service/v4_1/rest.php','login','JSON','username','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','format','get_module_fields'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xab62,0x1e8));var _0x2ab6=function(_0x3b54ec,_0x148c02){_0x3b54ec=_0x3b54ec-0x0;var _0x3e40c4=_0xab62[_0x3b54ec];return _0x3e40c4;};'use strict';var emlformat=require(_0x2ab6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2ab6('0x1'));var jsonpatch=require(_0x2ab6('0x2'));var rp=require('request-promise');var moment=require(_0x2ab6('0x3'));var BPromise=require(_0x2ab6('0x4'));var Mustache=require(_0x2ab6('0x5'));var util=require('util');var path=require(_0x2ab6('0x6'));var sox=require(_0x2ab6('0x7'));var csv=require(_0x2ab6('0x8'));var ejs=require(_0x2ab6('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x2ab6('0xa'));var crypto=require(_0x2ab6('0xb'));var jsforce=require(_0x2ab6('0xc'));var deskjs=require(_0x2ab6('0xd'));var toCsv=require('to-csv');var querystring=require(_0x2ab6('0xe'));var Papa=require(_0x2ab6('0xf'));var Redis=require(_0x2ab6('0x10'));var authService=require(_0x2ab6('0x11'));var qs=require(_0x2ab6('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2ab6('0x13'));var logger=require(_0x2ab6('0x14'))(_0x2ab6('0x15'));var utils=require(_0x2ab6('0x16'));var config=require(_0x2ab6('0x17'));var licenseUtil=require(_0x2ab6('0x18'));var db=require(_0x2ab6('0x19'))['db'];var integrations=require(_0x2ab6('0x1a'));function respondWithStatusCode(_0x6c25a2,_0x4ee967){_0x4ee967=_0x4ee967||0xcc;return function(_0x3754b3){if(_0x3754b3){return _0x6c25a2[_0x2ab6('0x1b')](_0x4ee967);}return _0x6c25a2['status'](_0x4ee967)[_0x2ab6('0x1c')]();};}function respondWithResult(_0x2a37be,_0x5e22d0){_0x5e22d0=_0x5e22d0||0xc8;return function(_0x3b006c){if(_0x3b006c){return _0x2a37be[_0x2ab6('0x1d')](_0x5e22d0)[_0x2ab6('0x1e')](_0x3b006c);}};}function respondWithFilteredResult(_0x1aa018,_0x4b0e81){return function(_0x49f7ed){if(_0x49f7ed){var _0x10ea65=typeof _0x4b0e81['offset']===_0x2ab6('0x1f')&&typeof _0x4b0e81[_0x2ab6('0x20')]===_0x2ab6('0x1f');var _0x1e3694=_0x49f7ed[_0x2ab6('0x21')];var _0x1fcc8f=_0x10ea65?0x0:_0x4b0e81[_0x2ab6('0x22')];var _0x54c8cb=_0x10ea65?_0x49f7ed[_0x2ab6('0x21')]:_0x4b0e81[_0x2ab6('0x22')]+_0x4b0e81['limit'];var _0x4b774f;if(_0x54c8cb>=_0x1e3694){_0x54c8cb=_0x1e3694;_0x4b774f=0xc8;}else{_0x4b774f=0xce;}_0x1aa018[_0x2ab6('0x1d')](_0x4b774f);return _0x1aa018[_0x2ab6('0x23')](_0x2ab6('0x24'),_0x1fcc8f+'-'+_0x54c8cb+'/'+_0x1e3694)[_0x2ab6('0x1e')](_0x49f7ed);}return null;};}function patchUpdates(_0x2f7fe9){return function(_0x21281c){try{jsonpatch[_0x2ab6('0x25')](_0x21281c,_0x2f7fe9,!![]);}catch(_0xa31c02){return BPromise['reject'](_0xa31c02);}return _0x21281c[_0x2ab6('0x26')]();};}function saveUpdates(_0x316cc6,_0x347489){return function(_0x4f9d0a){if(_0x4f9d0a){return _0x4f9d0a[_0x2ab6('0x27')](_0x316cc6)[_0x2ab6('0x28')](function(_0x193ef8){return _0x193ef8;});}return null;};}function removeEntity(_0x2bc17b,_0x252125){return function(_0x3daba7){if(_0x3daba7){return _0x3daba7['destroy']()[_0x2ab6('0x28')](function(){_0x2bc17b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x484b7b,_0x58f21a){return function(_0x301caa){if(!_0x301caa){_0x484b7b[_0x2ab6('0x1b')](0x194);}return _0x301caa;};}function handleError(_0x56a691,_0x3a4178){_0x3a4178=_0x3a4178||0x1f4;return function(_0x5d6cd5){logger[_0x2ab6('0x29')](_0x5d6cd5[_0x2ab6('0x2a')]);if(_0x5d6cd5[_0x2ab6('0x2b')]){delete _0x5d6cd5[_0x2ab6('0x2b')];}_0x56a691['status'](_0x3a4178)[_0x2ab6('0x2c')](_0x5d6cd5);};}exports['index']=function(_0x3bad26,_0x3c758a){var _0x35598c={},_0xd5cb5c={},_0x5aa5fd={'count':0x0,'rows':[]};var _0x2cdd7b=_[_0x2ab6('0x2d')](db[_0x2ab6('0x2e')][_0x2ab6('0x2f')],function(_0x2aa8a0){return{'name':_0x2aa8a0[_0x2ab6('0x30')],'type':_0x2aa8a0[_0x2ab6('0x31')]['key']};});_0xd5cb5c[_0x2ab6('0x32')]=_['map'](_0x2cdd7b,_0x2ab6('0x2b'));_0xd5cb5c[_0x2ab6('0x33')]=_[_0x2ab6('0x34')](_0x3bad26[_0x2ab6('0x33')]);_0xd5cb5c[_0x2ab6('0x35')]=_['intersection'](_0xd5cb5c[_0x2ab6('0x32')],_0xd5cb5c['query']);_0x35598c[_0x2ab6('0x36')]=_[_0x2ab6('0x37')](_0xd5cb5c[_0x2ab6('0x32')],qs[_0x2ab6('0x38')](_0x3bad26[_0x2ab6('0x33')][_0x2ab6('0x38')]));_0x35598c[_0x2ab6('0x36')]=_0x35598c[_0x2ab6('0x36')][_0x2ab6('0x39')]?_0x35598c[_0x2ab6('0x36')]:_0xd5cb5c[_0x2ab6('0x32')];if(!_0x3bad26[_0x2ab6('0x33')][_0x2ab6('0x3a')](_0x2ab6('0x3b'))){_0x35598c[_0x2ab6('0x20')]=qs[_0x2ab6('0x20')](_0x3bad26[_0x2ab6('0x33')]['limit']);_0x35598c[_0x2ab6('0x22')]=qs['offset'](_0x3bad26[_0x2ab6('0x33')][_0x2ab6('0x22')]);}_0x35598c[_0x2ab6('0x3c')]=qs[_0x2ab6('0x3d')](_0x3bad26[_0x2ab6('0x33')][_0x2ab6('0x3d')]);_0x35598c[_0x2ab6('0x3e')]=qs[_0x2ab6('0x35')](_[_0x2ab6('0x3f')](_0x3bad26[_0x2ab6('0x33')],_0xd5cb5c[_0x2ab6('0x35')]),_0x2cdd7b);if(_0x3bad26[_0x2ab6('0x33')][_0x2ab6('0x40')]){_0x35598c[_0x2ab6('0x3e')]=_[_0x2ab6('0x41')](_0x35598c['where'],{'$or':_['map'](_0x2cdd7b,function(_0x3e90dd){if(_0x3e90dd[_0x2ab6('0x31')]!==_0x2ab6('0x42')){var _0x54fcb4={};_0x54fcb4[_0x3e90dd[_0x2ab6('0x2b')]]={'$like':'%'+_0x3bad26[_0x2ab6('0x33')]['filter']+'%'};return _0x54fcb4;}})});}_0x35598c=_[_0x2ab6('0x41')]({},_0x35598c,_0x3bad26[_0x2ab6('0x43')]);var _0x41ce5b={'where':_0x35598c['where']};return db['SugarcrmAccount'][_0x2ab6('0x21')](_0x41ce5b)[_0x2ab6('0x28')](function(_0x5f2c10){_0x5aa5fd[_0x2ab6('0x21')]=_0x5f2c10;if(_0x3bad26['query'][_0x2ab6('0x44')]){_0x35598c[_0x2ab6('0x45')]=[{'all':!![]}];}return db[_0x2ab6('0x2e')][_0x2ab6('0x46')](_0x35598c);})['then'](function(_0x5c23bd){_0x5aa5fd[_0x2ab6('0x47')]=_0x5c23bd;return _0x5aa5fd;})['then'](respondWithFilteredResult(_0x3c758a,_0x35598c))[_0x2ab6('0x48')](handleError(_0x3c758a,null));};exports['show']=function(_0x1704cb,_0x32e08b){var _0xd71e57={'raw':![],'where':{'id':_0x1704cb['params']['id']}},_0x42f4a6={};_0x42f4a6[_0x2ab6('0x32')]=_[_0x2ab6('0x34')](db[_0x2ab6('0x2e')][_0x2ab6('0x2f')]);_0x42f4a6[_0x2ab6('0x33')]=_[_0x2ab6('0x34')](_0x1704cb[_0x2ab6('0x33')]);_0x42f4a6[_0x2ab6('0x35')]=_[_0x2ab6('0x37')](_0x42f4a6['model'],_0x42f4a6[_0x2ab6('0x33')]);_0xd71e57[_0x2ab6('0x36')]=_[_0x2ab6('0x37')](_0x42f4a6['model'],qs['fields'](_0x1704cb['query'][_0x2ab6('0x38')]));_0xd71e57['attributes']=_0xd71e57[_0x2ab6('0x36')][_0x2ab6('0x39')]?_0xd71e57[_0x2ab6('0x36')]:_0x42f4a6[_0x2ab6('0x32')];if(_0x1704cb[_0x2ab6('0x33')][_0x2ab6('0x44')]){_0xd71e57[_0x2ab6('0x45')]=[{'all':!![]}];}_0xd71e57=_['merge']({},_0xd71e57,_0x1704cb[_0x2ab6('0x43')]);return db[_0x2ab6('0x2e')][_0x2ab6('0x49')](_0xd71e57)[_0x2ab6('0x28')](handleEntityNotFound(_0x32e08b,null))['then'](respondWithResult(_0x32e08b,null))[_0x2ab6('0x48')](handleError(_0x32e08b,null));};exports[_0x2ab6('0x4a')]=function(_0x4ddc8e,_0x5c3e13){return db[_0x2ab6('0x2e')][_0x2ab6('0x4a')](_0x4ddc8e[_0x2ab6('0x4b')],{})[_0x2ab6('0x28')](respondWithResult(_0x5c3e13,0xc9))[_0x2ab6('0x48')](handleError(_0x5c3e13,null));};exports[_0x2ab6('0x27')]=function(_0x3b74f7,_0x4b42b5){if(_0x3b74f7[_0x2ab6('0x4b')]['id']){delete _0x3b74f7[_0x2ab6('0x4b')]['id'];}return db[_0x2ab6('0x2e')]['find']({'where':{'id':_0x3b74f7[_0x2ab6('0x4c')]['id']}})[_0x2ab6('0x28')](handleEntityNotFound(_0x4b42b5,null))[_0x2ab6('0x28')](saveUpdates(_0x3b74f7[_0x2ab6('0x4b')],null))[_0x2ab6('0x28')](respondWithResult(_0x4b42b5,null))[_0x2ab6('0x48')](handleError(_0x4b42b5,null));};exports[_0x2ab6('0x4d')]=function(_0x4aff5c,_0x28ab91){return db[_0x2ab6('0x2e')][_0x2ab6('0x49')]({'where':{'id':_0x4aff5c['params']['id']}})[_0x2ab6('0x28')](handleEntityNotFound(_0x28ab91,null))[_0x2ab6('0x28')](removeEntity(_0x28ab91,null))[_0x2ab6('0x48')](handleError(_0x28ab91,null));};exports[_0x2ab6('0x4e')]=function(_0x33af13,_0x14749d,_0x47fe81){var _0x5ca0e5={};var _0x5d2d3e={};var _0x18213d;var _0x4bab06;return db['SugarcrmAccount']['findOne']({'where':{'id':_0x33af13[_0x2ab6('0x4c')]['id']}})['then'](handleEntityNotFound(_0x14749d,null))['then'](function(_0x125af0){if(_0x125af0){_0x18213d=_0x125af0;_0x5d2d3e[_0x2ab6('0x32')]=_[_0x2ab6('0x34')](db[_0x2ab6('0x4f')]['rawAttributes']);_0x5d2d3e[_0x2ab6('0x33')]=_['keys'](_0x33af13[_0x2ab6('0x33')]);_0x5d2d3e[_0x2ab6('0x35')]=_['intersection'](_0x5d2d3e[_0x2ab6('0x32')],_0x5d2d3e['query']);_0x5ca0e5[_0x2ab6('0x36')]=_[_0x2ab6('0x37')](_0x5d2d3e['model'],qs[_0x2ab6('0x38')](_0x33af13[_0x2ab6('0x33')][_0x2ab6('0x38')]));_0x5ca0e5[_0x2ab6('0x36')]=_0x5ca0e5[_0x2ab6('0x36')][_0x2ab6('0x39')]?_0x5ca0e5[_0x2ab6('0x36')]:_0x5d2d3e[_0x2ab6('0x32')];_0x5ca0e5['order']=qs['sort'](_0x33af13['query'][_0x2ab6('0x3d')]);_0x5ca0e5[_0x2ab6('0x3e')]=qs[_0x2ab6('0x35')](_['pick'](_0x33af13['query'],_0x5d2d3e[_0x2ab6('0x35')]));if(_0x33af13[_0x2ab6('0x33')][_0x2ab6('0x40')]){_0x5ca0e5['where']=_[_0x2ab6('0x41')](_0x5ca0e5[_0x2ab6('0x3e')],{'$or':_[_0x2ab6('0x2d')](_0x5ca0e5[_0x2ab6('0x36')],function(_0x165023){var _0x554673={};_0x554673[_0x165023]={'$like':'%'+_0x33af13['query']['filter']+'%'};return _0x554673;})});}_0x5ca0e5=_[_0x2ab6('0x41')]({},_0x5ca0e5,_0x33af13[_0x2ab6('0x43')]);return _0x18213d[_0x2ab6('0x4e')](_0x5ca0e5);}})[_0x2ab6('0x28')](function(_0x28cfa0){if(_0x28cfa0){_0x4bab06=_0x28cfa0[_0x2ab6('0x39')];if(!_0x33af13['query'][_0x2ab6('0x3a')](_0x2ab6('0x3b'))){_0x5ca0e5[_0x2ab6('0x20')]=qs[_0x2ab6('0x20')](_0x33af13[_0x2ab6('0x33')][_0x2ab6('0x20')]);_0x5ca0e5['offset']=qs[_0x2ab6('0x22')](_0x33af13['query'][_0x2ab6('0x22')]);}return _0x18213d['getConfigurations'](_0x5ca0e5);}})[_0x2ab6('0x28')](function(_0x91eb36){if(_0x91eb36){return _0x91eb36?{'count':_0x4bab06,'rows':_0x91eb36}:null;}})[_0x2ab6('0x28')](respondWithResult(_0x14749d,null))[_0x2ab6('0x48')](handleError(_0x14749d,null));};exports[_0x2ab6('0x50')]=function(_0x345c2d,_0x3e7c46,_0x4b8c2f){if(_0x345c2d[_0x2ab6('0x4b')]['id']){delete _0x345c2d[_0x2ab6('0x4b')]['id'];}return db[_0x2ab6('0x2e')][_0x2ab6('0x51')]({'where':{'id':_0x345c2d[_0x2ab6('0x4c')]['id']}})[_0x2ab6('0x28')](handleEntityNotFound(_0x3e7c46,null))['then'](function(_0x2cce40){if(_0x2cce40){_0x345c2d['body'][_0x2ab6('0x52')]=_0x2cce40['id'];_0x345c2d['body'][_0x2ab6('0x53')]=integrations[_0x2ab6('0x54')](_0x345c2d['body']['channel'],_0x345c2d[_0x2ab6('0x4b')][_0x2ab6('0x31')]);_0x345c2d['body'][_0x2ab6('0x55')]=integrations['getDescriptions'](_0x345c2d['body']['channel'],_0x345c2d[_0x2ab6('0x4b')][_0x2ab6('0x31')]);return db[_0x2ab6('0x4f')][_0x2ab6('0x4a')](_0x345c2d[_0x2ab6('0x4b')],{'include':[{'model':db['SugarcrmField'],'as':'Subjects'},{'model':db[_0x2ab6('0x56')],'as':_0x2ab6('0x55')}]});}return null;})[_0x2ab6('0x28')](respondWithResult(_0x3e7c46,null))[_0x2ab6('0x48')](handleError(_0x3e7c46,null));};exports[_0x2ab6('0x57')]=function(_0x19d2b7,_0x5c703e,_0x250b47){var _0x2c3c8c='';var _0x136249=['id','name',_0x2ab6('0x58'),'created_by',_0x2ab6('0x59'),'date_start',_0x2ab6('0x5a'),_0x2ab6('0x5b'),_0x2ab6('0x5c'),_0x2ab6('0x5d'),_0x2ab6('0x5e'),_0x2ab6('0x5f')];return db[_0x2ab6('0x2e')][_0x2ab6('0x51')]({'where':{'id':_0x19d2b7[_0x2ab6('0x4c')]['id']},'attributes':['id','username',_0x2ab6('0x60'),'remoteUri']})['then'](handleEntityNotFound(_0x5c703e,null))['then'](function(_0x52afb7){if(_0x52afb7){_0x2c3c8c=_0x52afb7[_0x2ab6('0x61')];var _0x113e7c=_0x2c3c8c[_0x2ab6('0x62')](-0x1);if(_0x113e7c==='/'){_0x2c3c8c=_0x2c3c8c[_0x2ab6('0x63')](0x0,_0x2c3c8c[_0x2ab6('0x64')](_0x113e7c));}return rp({'method':_0x2ab6('0x65'),'uri':util['format'](_0x2ab6('0x66'),_0x2c3c8c,_0x2ab6('0x67')),'json':!![],'form':{'method':_0x2ab6('0x68'),'input_type':_0x2ab6('0x69'),'response_type':_0x2ab6('0x69'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x52afb7[_0x2ab6('0x6a')],'password':_0x52afb7[_0x2ab6('0x60')],'encryption':'PLAIN'},'application':_0x2ab6('0x6b')})}});}})[_0x2ab6('0x28')](function(_0x120038){if(_0x120038&&_0x120038['name']!==_0x2ab6('0x6c')&&_0x120038['name']!==_0x2ab6('0x6d')){return rp({'method':_0x2ab6('0x65'),'uri':util[_0x2ab6('0x6e')]('%s%s',_0x2c3c8c,_0x2ab6('0x67')),'json':!![],'form':{'method':_0x2ab6('0x6f'),'input_type':_0x2ab6('0x69'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x120038['id'],'module_name':_0x2ab6('0x70')})}})[_0x2ab6('0x28')](function(_0x13ace0){if(_0x13ace0){var _0x49b635=_[_0x2ab6('0x71')](_0x13ace0[_0x2ab6('0x72')]);_[_0x2ab6('0x73')](_0x49b635,function(_0x1646ac){return _0x136249['includes'](_0x1646ac[_0x2ab6('0x2b')]);});return{'count':_0x49b635[_0x2ab6('0x39')],'rows':_['map'](_0x49b635,function(_0x56a96b){return{'id':_0x56a96b[_0x2ab6('0x2b')],'name':_0x56a96b[_0x2ab6('0x74')],'custom':_['endsWith'](_0x56a96b[_0x2ab6('0x2b')],'_c')?!![]:![],'options':_0x56a96b[_0x2ab6('0x43')]?_[_0x2ab6('0x2d')](_['values'](_0x56a96b[_0x2ab6('0x43')]),function(_0xc69cba){return{'name':_0xc69cba[_0x2ab6('0x75')],'value':_0xc69cba[_0x2ab6('0x2b')]};}):[]};})};}})[_0x2ab6('0x28')](respondWithResult(_0x5c703e,null))[_0x2ab6('0x48')](function(_0x1c2d0a){var _0x50d313=_0x19d2b7[_0x2ab6('0x33')]['test']?0x1f4:_0x1c2d0a['statusCode']||0x1f4;logger[_0x2ab6('0x29')](_0x2ab6('0x76'),_0x2ab6('0x57'),_0x50d313,JSON['stringify'](_0x1c2d0a));delete _0x1c2d0a['name'];if(_0x50d313===0x191){_0x50d313=0x190;}_0x5c703e[_0x2ab6('0x1d')](_0x50d313)[_0x2ab6('0x2c')](_0x19d2b7[_0x2ab6('0x33')]['test']?{'message':_0x2ab6('0x77'),'statusCode':_0x1c2d0a['statusCode']}:_0x1c2d0a);});}else{var _0x2e1dcd=0x1f4;_0x5c703e[_0x2ab6('0x1d')](_0x2e1dcd)[_0x2ab6('0x2c')]({'message':'Wrong\x20credentials','statusCode':0x190});}});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js index e88ea33..447a5f4 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 _0xb21b=['lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','define','SugarcrmAccount','int_sugarcrm_accounts'];(function(_0x3b787d,_0x7f5b19){var _0x2627d2=function(_0x1766f2){while(--_0x1766f2){_0x3b787d['push'](_0x3b787d['shift']());}};_0x2627d2(++_0x7f5b19);}(_0xb21b,0x1ec));var _0xbb21=function(_0xf6512f,_0x672e9e){_0xf6512f=_0xf6512f-0x0;var _0x2adc18=_0xb21b[_0xf6512f];return _0x2adc18;};'use strict';var _=require(_0xbb21('0x0'));var util=require('util');var logger=require(_0xbb21('0x1'))('api');var moment=require(_0xbb21('0x2'));var BPromise=require(_0xbb21('0x3'));var rp=require(_0xbb21('0x4'));var fs=require('fs');var path=require(_0xbb21('0x5'));var rimraf=require(_0xbb21('0x6'));var config=require(_0xbb21('0x7'));var attributes=require('./intSugarcrmAccount.attributes');var integrations=require(_0xbb21('0x8'));module['exports']=function(_0x4705d3,_0x28b39c){return _0x4705d3[_0xbb21('0x9')](_0xbb21('0xa'),attributes,{'tableName':_0xbb21('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdf2b=['rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','int_sugarcrm_accounts','util','moment','request-promise','path'];(function(_0x59fa34,_0x265a6d){var _0x18fec0=function(_0x149fe5){while(--_0x149fe5){_0x59fa34['push'](_0x59fa34['shift']());}};_0x18fec0(++_0x265a6d);}(_0xdf2b,0x125));var _0xbdf2=function(_0xcc445f,_0xbc6408){_0xcc445f=_0xcc445f-0x0;var _0x4c4a36=_0xdf2b[_0xcc445f];return _0x4c4a36;};'use strict';var _=require('lodash');var util=require(_0xbdf2('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xbdf2('0x1'));var BPromise=require('bluebird');var rp=require(_0xbdf2('0x2'));var fs=require('fs');var path=require(_0xbdf2('0x3'));var rimraf=require(_0xbdf2('0x4'));var config=require(_0xbdf2('0x5'));var attributes=require(_0xbdf2('0x6'));var integrations=require(_0xbdf2('0x7'));module[_0xbdf2('0x8')]=function(_0x5918c0,_0xa17031){return _0x5918c0[_0xbdf2('0x9')]('SugarcrmAccount',attributes,{'tableName':_0xbdf2('0xa'),'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 1d499c2..fa9e549 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 _0x329b=['ShowSugarcrmAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','info','SugarcrmAccount,\x20%s,\x20%s','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where','attributes','include','map','model','then'];(function(_0x158685,_0x58ab1a){var _0x273d9c=function(_0x183f18){while(--_0x183f18){_0x158685['push'](_0x158685['shift']());}};_0x273d9c(++_0x58ab1a);}(_0x329b,0x1f0));var _0xb329=function(_0x5f519b,_0x5b606f){_0x5f519b=_0x5f519b-0x0;var _0x2461e2=_0x329b[_0x5f519b];return _0x2461e2;};'use strict';var _=require(_0xb329('0x0'));var util=require(_0xb329('0x1'));var moment=require(_0xb329('0x2'));var BPromise=require(_0xb329('0x3'));var rs=require(_0xb329('0x4'));var fs=require('fs');var Redis=require(_0xb329('0x5'));var db=require(_0xb329('0x6'))['db'];var utils=require(_0xb329('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xb329('0x8'));var jayson=require(_0xb329('0x9'));var client=jayson['client'][_0xb329('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3e63d2,_0xfdc72f,_0x586e8d){return new BPromise(function(_0x54ba78,_0x42aa24){return client[_0xb329('0xb')](_0x3e63d2,_0x586e8d)['then'](function(_0x4ec34f){logger[_0xb329('0xc')](_0xb329('0xd'),_0xfdc72f,'request\x20sent');logger[_0xb329('0xe')](_0xb329('0xf'),_0xfdc72f,_0xb329('0x10'),JSON[_0xb329('0x11')](_0x4ec34f));if(_0x4ec34f[_0xb329('0x12')]){if(_0x4ec34f[_0xb329('0x12')]['code']===0x1f4){logger[_0xb329('0x12')](_0xb329('0xd'),_0xfdc72f,_0x4ec34f['error'][_0xb329('0x13')]);return _0x42aa24(_0x4ec34f['error'][_0xb329('0x13')]);}logger[_0xb329('0x12')](_0xb329('0xd'),_0xfdc72f,_0x4ec34f[_0xb329('0x12')]['message']);return _0x54ba78(_0x4ec34f['error']['message']);}else{logger[_0xb329('0xc')]('SugarcrmAccount,\x20%s,\x20%s',_0xfdc72f,_0xb329('0x10'));_0x54ba78(_0x4ec34f['result'][_0xb329('0x13')]);}})[_0xb329('0x14')](function(_0x3e5576){logger[_0xb329('0x12')](_0xb329('0xd'),_0xfdc72f,_0x3e5576);_0x42aa24(_0x3e5576);});});}exports[_0xb329('0x15')]=function(_0x54fcd9){var _0x5c4644=this;return new Promise(function(_0xb53150,_0x4efd42){return db[_0xb329('0x16')][_0xb329('0x17')]({'raw':_0x54fcd9[_0xb329('0x18')]?_0x54fcd9[_0xb329('0x18')][_0xb329('0x19')]===undefined?!![]:![]:!![],'where':_0x54fcd9[_0xb329('0x18')]?_0x54fcd9[_0xb329('0x18')][_0xb329('0x1a')]||null:null,'attributes':_0x54fcd9['options']?_0x54fcd9[_0xb329('0x18')][_0xb329('0x1b')]||null:null,'limit':_0x54fcd9[_0xb329('0x18')]?_0x54fcd9['options']['limit']||null:null,'include':_0x54fcd9[_0xb329('0x18')]?_0x54fcd9['options'][_0xb329('0x1c')]?_[_0xb329('0x1d')](_0x54fcd9[_0xb329('0x18')]['include'],function(_0x398a3d){return{'model':db[_0x398a3d[_0xb329('0x1e')]],'as':_0x398a3d['as'],'attributes':_0x398a3d[_0xb329('0x1b')],'include':_0x398a3d[_0xb329('0x1c')]?_[_0xb329('0x1d')](_0x398a3d[_0xb329('0x1c')],function(_0x286ba0){return{'model':db[_0x286ba0[_0xb329('0x1e')]],'as':_0x286ba0['as'],'attributes':_0x286ba0[_0xb329('0x1b')],'include':_0x286ba0['include']?_[_0xb329('0x1d')](_0x286ba0[_0xb329('0x1c')],function(_0x82e6a5){return{'model':db[_0x82e6a5['model']],'as':_0x82e6a5['as'],'attributes':_0x82e6a5['attributes']};}):[]};}):[]};}):[]:[]})[_0xb329('0x1f')](function(_0x350c2e){logger[_0xb329('0xc')](_0xb329('0x15'),_0x54fcd9);logger['debug'](_0xb329('0x15'),_0x54fcd9,JSON['stringify'](_0x350c2e));_0xb53150(_0x350c2e);})['catch'](function(_0x485c19){logger[_0xb329('0x12')](_0xb329('0x15'),_0x485c19['message'],_0x54fcd9);_0x4efd42(_0x5c4644[_0xb329('0x12')](0x1f4,_0x485c19['message']));});});};exports[_0xb329('0x20')]=function(_0x2057bf){var _0x1f969d=this;return new Promise(function(_0x527cc7,_0x22cb2b){return db[_0xb329('0x16')]['find']({'raw':_0x2057bf[_0xb329('0x18')]?_0x2057bf[_0xb329('0x18')][_0xb329('0x19')]===undefined?!![]:![]:!![],'where':_0x2057bf[_0xb329('0x18')]?_0x2057bf[_0xb329('0x18')][_0xb329('0x1a')]||null:null,'attributes':_0x2057bf[_0xb329('0x18')]?_0x2057bf[_0xb329('0x18')]['attributes']||null:null,'include':_0x2057bf[_0xb329('0x18')]?_0x2057bf[_0xb329('0x18')][_0xb329('0x1c')]?_[_0xb329('0x1d')](_0x2057bf[_0xb329('0x18')][_0xb329('0x1c')],function(_0x2befbe){return{'model':db[_0x2befbe[_0xb329('0x1e')]],'as':_0x2befbe['as'],'attributes':_0x2befbe['attributes'],'include':_0x2befbe[_0xb329('0x1c')]?_[_0xb329('0x1d')](_0x2befbe[_0xb329('0x1c')],function(_0x57e1b1){return{'model':db[_0x57e1b1['model']],'as':_0x57e1b1['as'],'attributes':_0x57e1b1['attributes'],'include':_0x57e1b1[_0xb329('0x1c')]?_[_0xb329('0x1d')](_0x57e1b1['include'],function(_0x2fc0d0){return{'model':db[_0x2fc0d0[_0xb329('0x1e')]],'as':_0x2fc0d0['as'],'attributes':_0x2fc0d0[_0xb329('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xb329('0x1f')](function(_0x405259){logger[_0xb329('0xc')]('ShowSugarcrmAccount',_0x2057bf);logger[_0xb329('0xe')](_0xb329('0x20'),_0x2057bf,JSON[_0xb329('0x11')](_0x405259));_0x527cc7(_0x405259);})[_0xb329('0x14')](function(_0x356448){logger['error'](_0xb329('0x20'),_0x356448['message'],_0x2057bf);_0x22cb2b(_0x1f969d[_0xb329('0x12')](0x1f4,_0x356448[_0xb329('0x13')]));});});}; \ No newline at end of file +var _0x49b7=['ShowSugarcrmAccount','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','SugarcrmAccount,\x20%s,\x20%s','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','where','limit','include','map','model','attributes','find','raw'];(function(_0x298182,_0x362cfa){var _0x5c014d=function(_0xc9e3f7){while(--_0xc9e3f7){_0x298182['push'](_0x298182['shift']());}};_0x5c014d(++_0x362cfa);}(_0x49b7,0xdf));var _0x749b=function(_0x154983,_0xc29edf){_0x154983=_0x154983-0x0;var _0x3d1243=_0x49b7[_0x154983];return _0x3d1243;};'use strict';var _=require(_0x749b('0x0'));var util=require('util');var moment=require(_0x749b('0x1'));var BPromise=require(_0x749b('0x2'));var rs=require(_0x749b('0x3'));var fs=require('fs');var Redis=require(_0x749b('0x4'));var db=require(_0x749b('0x5'))['db'];var utils=require(_0x749b('0x6'));var logger=require(_0x749b('0x7'))(_0x749b('0x8'));var config=require(_0x749b('0x9'));var jayson=require(_0x749b('0xa'));var client=jayson['client'][_0x749b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1e6703,_0x3eb3be,_0x305164){return new BPromise(function(_0x585695,_0x346c7b){return client['request'](_0x1e6703,_0x305164)[_0x749b('0xc')](function(_0x3f041d){logger['info'](_0x749b('0xd'),_0x3eb3be,'request\x20sent');logger[_0x749b('0xe')](_0x749b('0xf'),_0x3eb3be,'request\x20sent',JSON[_0x749b('0x10')](_0x3f041d));if(_0x3f041d['error']){if(_0x3f041d[_0x749b('0x11')][_0x749b('0x12')]===0x1f4){logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x3eb3be,_0x3f041d[_0x749b('0x11')][_0x749b('0x13')]);return _0x346c7b(_0x3f041d[_0x749b('0x11')][_0x749b('0x13')]);}logger[_0x749b('0x11')]('SugarcrmAccount,\x20%s,\x20%s',_0x3eb3be,_0x3f041d[_0x749b('0x11')][_0x749b('0x13')]);return _0x585695(_0x3f041d[_0x749b('0x11')][_0x749b('0x13')]);}else{logger[_0x749b('0x14')]('SugarcrmAccount,\x20%s,\x20%s',_0x3eb3be,_0x749b('0x15'));_0x585695(_0x3f041d[_0x749b('0x16')][_0x749b('0x13')]);}})[_0x749b('0x17')](function(_0x24760b){logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x3eb3be,_0x24760b);_0x346c7b(_0x24760b);});});}exports[_0x749b('0x18')]=function(_0x10f877){var _0x45d76c=this;return new Promise(function(_0x49a8d0,_0x71c627){return db[_0x749b('0x19')][_0x749b('0x1a')]({'raw':_0x10f877[_0x749b('0x1b')]?_0x10f877[_0x749b('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x10f877['options']?_0x10f877[_0x749b('0x1b')][_0x749b('0x1c')]||null:null,'attributes':_0x10f877[_0x749b('0x1b')]?_0x10f877['options']['attributes']||null:null,'limit':_0x10f877[_0x749b('0x1b')]?_0x10f877[_0x749b('0x1b')][_0x749b('0x1d')]||null:null,'include':_0x10f877[_0x749b('0x1b')]?_0x10f877[_0x749b('0x1b')][_0x749b('0x1e')]?_[_0x749b('0x1f')](_0x10f877['options'][_0x749b('0x1e')],function(_0x581569){return{'model':db[_0x581569[_0x749b('0x20')]],'as':_0x581569['as'],'attributes':_0x581569[_0x749b('0x21')],'include':_0x581569[_0x749b('0x1e')]?_[_0x749b('0x1f')](_0x581569['include'],function(_0x446c8d){return{'model':db[_0x446c8d[_0x749b('0x20')]],'as':_0x446c8d['as'],'attributes':_0x446c8d[_0x749b('0x21')],'include':_0x446c8d[_0x749b('0x1e')]?_[_0x749b('0x1f')](_0x446c8d[_0x749b('0x1e')],function(_0x29a7fb){return{'model':db[_0x29a7fb[_0x749b('0x20')]],'as':_0x29a7fb['as'],'attributes':_0x29a7fb[_0x749b('0x21')]};}):[]};}):[]};}):[]:[]})[_0x749b('0xc')](function(_0x9af08b){logger[_0x749b('0x14')](_0x749b('0x18'),_0x10f877);logger['debug'](_0x749b('0x18'),_0x10f877,JSON[_0x749b('0x10')](_0x9af08b));_0x49a8d0(_0x9af08b);})[_0x749b('0x17')](function(_0x52ac05){logger[_0x749b('0x11')]('GetSugarcrmAccount',_0x52ac05[_0x749b('0x13')],_0x10f877);_0x71c627(_0x45d76c[_0x749b('0x11')](0x1f4,_0x52ac05[_0x749b('0x13')]));});});};exports['ShowSugarcrmAccount']=function(_0x9ee794){var _0x2c3c4c=this;return new Promise(function(_0x2e8ec9,_0x48fdb1){return db[_0x749b('0x19')][_0x749b('0x22')]({'raw':_0x9ee794[_0x749b('0x1b')]?_0x9ee794[_0x749b('0x1b')][_0x749b('0x23')]===undefined?!![]:![]:!![],'where':_0x9ee794[_0x749b('0x1b')]?_0x9ee794['options'][_0x749b('0x1c')]||null:null,'attributes':_0x9ee794[_0x749b('0x1b')]?_0x9ee794['options'][_0x749b('0x21')]||null:null,'include':_0x9ee794['options']?_0x9ee794[_0x749b('0x1b')]['include']?_[_0x749b('0x1f')](_0x9ee794['options'][_0x749b('0x1e')],function(_0x325a5f){return{'model':db[_0x325a5f[_0x749b('0x20')]],'as':_0x325a5f['as'],'attributes':_0x325a5f[_0x749b('0x21')],'include':_0x325a5f['include']?_[_0x749b('0x1f')](_0x325a5f[_0x749b('0x1e')],function(_0x1062d6){return{'model':db[_0x1062d6['model']],'as':_0x1062d6['as'],'attributes':_0x1062d6[_0x749b('0x21')],'include':_0x1062d6[_0x749b('0x1e')]?_[_0x749b('0x1f')](_0x1062d6['include'],function(_0x4b0a02){return{'model':db[_0x4b0a02[_0x749b('0x20')]],'as':_0x4b0a02['as'],'attributes':_0x4b0a02[_0x749b('0x21')]};}):[]};}):[]};}):[]:[]})[_0x749b('0xc')](function(_0x3099af){logger[_0x749b('0x14')](_0x749b('0x24'),_0x9ee794);logger[_0x749b('0xe')](_0x749b('0x24'),_0x9ee794,JSON[_0x749b('0x10')](_0x3099af));_0x2e8ec9(_0x3099af);})[_0x749b('0x17')](function(_0x1edf87){logger['error']('ShowSugarcrmAccount',_0x1edf87[_0x749b('0x13')],_0x9ee794);_0x48fdb1(_0x2c3c4c['error'](0x1f4,_0x1edf87['message']));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index e4f9d8f..c8cf787 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 _0x7b22=['../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','put','update','delete','destroy','exports','multer','util','path','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x31465b,_0x175c97){var _0x114a8f=function(_0xbafa2b){while(--_0xbafa2b){_0x31465b['push'](_0x31465b['shift']());}};_0x114a8f(++_0x175c97);}(_0x7b22,0x13c));var _0x27b2=function(_0x419aa4,_0x5926a7){_0x419aa4=_0x419aa4-0x0;var _0x557d9b=_0x7b22[_0x419aa4];return _0x557d9b;};'use strict';var multer=require(_0x27b2('0x0'));var util=require(_0x27b2('0x1'));var path=require(_0x27b2('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x27b2('0x3'));var auth=require(_0x27b2('0x4'));var interaction=require(_0x27b2('0x5'));var config=require(_0x27b2('0x6'));var controller=require(_0x27b2('0x7'));router[_0x27b2('0x8')]('/',auth[_0x27b2('0x9')](),controller['index']);router[_0x27b2('0x8')](_0x27b2('0xa'),auth[_0x27b2('0x9')](),controller[_0x27b2('0xb')]);router[_0x27b2('0x8')](_0x27b2('0xc'),auth[_0x27b2('0x9')](),controller[_0x27b2('0xd')]);router[_0x27b2('0x8')](_0x27b2('0xe'),auth['isAuthenticated'](),controller[_0x27b2('0xf')]);router['get'](_0x27b2('0x10'),auth[_0x27b2('0x9')](),controller[_0x27b2('0x11')]);router['post']('/',auth[_0x27b2('0x9')](),controller['create']);router[_0x27b2('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x27b2('0x13')]);router[_0x27b2('0x14')](_0x27b2('0xa'),auth[_0x27b2('0x9')](),controller[_0x27b2('0x15')]);module[_0x27b2('0x16')]=router; \ No newline at end of file +var _0x1bae=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','getSubjects','getDescriptions','create','update','destroy','exports','multer','util','path','connect-timeout'];(function(_0x1e3801,_0x4a19a8){var _0x9ba139=function(_0x5859ef){while(--_0x5859ef){_0x1e3801['push'](_0x1e3801['shift']());}};_0x9ba139(++_0x4a19a8);}(_0x1bae,0xb4));var _0xe1ba=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x1bae[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xe1ba('0x0'));var util=require(_0xe1ba('0x1'));var path=require(_0xe1ba('0x2'));var timeout=require(_0xe1ba('0x3'));var express=require(_0xe1ba('0x4'));var router=express[_0xe1ba('0x5')]();var fs_extra=require(_0xe1ba('0x6'));var auth=require(_0xe1ba('0x7'));var interaction=require(_0xe1ba('0x8'));var config=require(_0xe1ba('0x9'));var controller=require('./intSugarcrmConfiguration.controller');router[_0xe1ba('0xa')]('/',auth[_0xe1ba('0xb')](),controller[_0xe1ba('0xc')]);router[_0xe1ba('0xa')](_0xe1ba('0xd'),auth[_0xe1ba('0xb')](),controller[_0xe1ba('0xe')]);router[_0xe1ba('0xa')](_0xe1ba('0xf'),auth['isAuthenticated'](),controller[_0xe1ba('0x10')]);router[_0xe1ba('0xa')]('/:id/subjects',auth['isAuthenticated'](),controller[_0xe1ba('0x11')]);router[_0xe1ba('0xa')]('/:id/descriptions',auth[_0xe1ba('0xb')](),controller[_0xe1ba('0x12')]);router['post']('/',auth[_0xe1ba('0xb')](),controller[_0xe1ba('0x13')]);router['put']('/:id',auth[_0xe1ba('0xb')](),controller[_0xe1ba('0x14')]);router['delete'](_0xe1ba('0xd'),auth[_0xe1ba('0xb')](),controller[_0xe1ba('0x15')]);module[_0xe1ba('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 c5fc682..bef509e 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 _0xa7af=['STRING','sequelize','exports'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa7af,0x169));var _0xfa7a=function(_0x597bf8,_0x4fda9c){_0x597bf8=_0x597bf8-0x0;var _0x3833ba=_0xa7af[_0x597bf8];return _0x3833ba;};'use strict';var Sequelize=require(_0xfa7a('0x0'));module[_0xfa7a('0x1')]={'name':{'type':Sequelize[_0xfa7a('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd1bf=['STRING'];(function(_0x29ee53,_0x27673c){var _0x595509=function(_0x2ecffd){while(--_0x2ecffd){_0x29ee53['push'](_0x29ee53['shift']());}};_0x595509(++_0x27673c);}(_0xd1bf,0x99));var _0xfd1b=function(_0x390591,_0x5b5ace){_0x390591=_0x390591-0x0;var _0x3cba65=_0xd1bf[_0x390591];return _0x3cba65;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xfd1b('0x0')]},'description':{'type':Sequelize[_0xfd1b('0x0')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 2d2536d..c32e28b 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 _0xb43d=['../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','SugarcrmConfiguration','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','getFields','findOne','SugarcrmField','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','fs-extra','lodash','squel','jsforce','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x4447a5,_0x1108fa){var _0x282036=function(_0x1b1c2c){while(--_0x1b1c2c){_0x4447a5['push'](_0x4447a5['shift']());}};_0x282036(++_0x1108fa);}(_0xb43d,0x173));var _0xdb43=function(_0x58d64c,_0x3e4647){_0x58d64c=_0x58d64c-0x0;var _0x25d125=_0xb43d[_0x58d64c];return _0x25d125;};'use strict';var emlformat=require(_0xdb43('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdb43('0x1'));var jsonpatch=require(_0xdb43('0x2'));var rp=require(_0xdb43('0x3'));var moment=require(_0xdb43('0x4'));var BPromise=require(_0xdb43('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xdb43('0x6'));var csv=require(_0xdb43('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdb43('0x8'));var _=require(_0xdb43('0x9'));var squel=require(_0xdb43('0xa'));var crypto=require('crypto');var jsforce=require(_0xdb43('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xdb43('0xc'));var as=require(_0xdb43('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdb43('0xe'))(_0xdb43('0xf'));var utils=require('../../config/utils');var config=require(_0xdb43('0x10'));var licenseUtil=require(_0xdb43('0x11'));var db=require(_0xdb43('0x12'))['db'];function respondWithStatusCode(_0x1094be,_0x29e230){_0x29e230=_0x29e230||0xcc;return function(_0x1ec303){if(_0x1ec303){return _0x1094be[_0xdb43('0x13')](_0x29e230);}return _0x1094be[_0xdb43('0x14')](_0x29e230)[_0xdb43('0x15')]();};}function respondWithResult(_0x15ead8,_0x37510c){_0x37510c=_0x37510c||0xc8;return function(_0x991d8c){if(_0x991d8c){return _0x15ead8[_0xdb43('0x14')](_0x37510c)[_0xdb43('0x16')](_0x991d8c);}};}function respondWithFilteredResult(_0x1dbd7c,_0x21f5c6){return function(_0x3ec9c5){if(_0x3ec9c5){var _0x458e88=typeof _0x21f5c6[_0xdb43('0x17')]===_0xdb43('0x18')&&typeof _0x21f5c6[_0xdb43('0x19')]==='undefined';var _0x5c825a=_0x3ec9c5[_0xdb43('0x1a')];var _0x57a1bf=_0x458e88?0x0:_0x21f5c6[_0xdb43('0x17')];var _0x49c591=_0x458e88?_0x3ec9c5[_0xdb43('0x1a')]:_0x21f5c6[_0xdb43('0x17')]+_0x21f5c6['limit'];var _0xba0930;if(_0x49c591>=_0x5c825a){_0x49c591=_0x5c825a;_0xba0930=0xc8;}else{_0xba0930=0xce;}_0x1dbd7c[_0xdb43('0x14')](_0xba0930);return _0x1dbd7c[_0xdb43('0x1b')](_0xdb43('0x1c'),_0x57a1bf+'-'+_0x49c591+'/'+_0x5c825a)[_0xdb43('0x16')](_0x3ec9c5);}return null;};}function patchUpdates(_0xcf297b){return function(_0x18d09a){try{jsonpatch[_0xdb43('0x1d')](_0x18d09a,_0xcf297b,!![]);}catch(_0x164ed9){return BPromise[_0xdb43('0x1e')](_0x164ed9);}return _0x18d09a[_0xdb43('0x1f')]();};}function saveUpdates(_0x296f85,_0xe96b83){return function(_0x3aa5b3){if(_0x3aa5b3){return _0x3aa5b3['update'](_0x296f85)[_0xdb43('0x20')](function(_0x42b336){return _0x42b336;});}return null;};}function removeEntity(_0x3054a8,_0x36acca){return function(_0x58859b){if(_0x58859b){return _0x58859b[_0xdb43('0x21')]()[_0xdb43('0x20')](function(){_0x3054a8[_0xdb43('0x14')](0xcc)[_0xdb43('0x15')]();});}};}function handleEntityNotFound(_0x40ee5c,_0x42a288){return function(_0x132fe7){if(!_0x132fe7){_0x40ee5c[_0xdb43('0x13')](0x194);}return _0x132fe7;};}function handleError(_0x567aee,_0x257cc0){_0x257cc0=_0x257cc0||0x1f4;return function(_0x2799e4){logger[_0xdb43('0x22')](_0x2799e4[_0xdb43('0x23')]);if(_0x2799e4['name']){delete _0x2799e4[_0xdb43('0x24')];}_0x567aee[_0xdb43('0x14')](_0x257cc0)[_0xdb43('0x25')](_0x2799e4);};}exports[_0xdb43('0x26')]=function(_0x501dd4,_0x5499f6){var _0x58361d={},_0x3704e3={},_0x255468={'count':0x0,'rows':[]};var _0x263ed8=_[_0xdb43('0x27')](db['SugarcrmConfiguration']['rawAttributes'],function(_0x64f75d){return{'name':_0x64f75d[_0xdb43('0x28')],'type':_0x64f75d['type'][_0xdb43('0x29')]};});_0x3704e3[_0xdb43('0x2a')]=_[_0xdb43('0x27')](_0x263ed8,_0xdb43('0x24'));_0x3704e3[_0xdb43('0x2b')]=_[_0xdb43('0x2c')](_0x501dd4[_0xdb43('0x2b')]);_0x3704e3[_0xdb43('0x2d')]=_['intersection'](_0x3704e3[_0xdb43('0x2a')],_0x3704e3[_0xdb43('0x2b')]);_0x58361d[_0xdb43('0x2e')]=_[_0xdb43('0x2f')](_0x3704e3[_0xdb43('0x2a')],qs[_0xdb43('0x30')](_0x501dd4[_0xdb43('0x2b')][_0xdb43('0x30')]));_0x58361d[_0xdb43('0x2e')]=_0x58361d[_0xdb43('0x2e')][_0xdb43('0x31')]?_0x58361d[_0xdb43('0x2e')]:_0x3704e3[_0xdb43('0x2a')];if(!_0x501dd4[_0xdb43('0x2b')][_0xdb43('0x32')](_0xdb43('0x33'))){_0x58361d['limit']=qs[_0xdb43('0x19')](_0x501dd4['query'][_0xdb43('0x19')]);_0x58361d[_0xdb43('0x17')]=qs[_0xdb43('0x17')](_0x501dd4[_0xdb43('0x2b')]['offset']);}_0x58361d[_0xdb43('0x34')]=qs['sort'](_0x501dd4[_0xdb43('0x2b')][_0xdb43('0x35')]);_0x58361d[_0xdb43('0x36')]=qs[_0xdb43('0x2d')](_[_0xdb43('0x37')](_0x501dd4['query'],_0x3704e3['filters']),_0x263ed8);if(_0x501dd4[_0xdb43('0x2b')][_0xdb43('0x38')]){_0x58361d[_0xdb43('0x36')]=_[_0xdb43('0x39')](_0x58361d[_0xdb43('0x36')],{'$or':_[_0xdb43('0x27')](_0x263ed8,function(_0x2bfb8e){if(_0x2bfb8e[_0xdb43('0x3a')]!==_0xdb43('0x3b')){var _0x5e1f25={};_0x5e1f25[_0x2bfb8e[_0xdb43('0x24')]]={'$like':'%'+_0x501dd4['query']['filter']+'%'};return _0x5e1f25;}})});}_0x58361d=_['merge']({},_0x58361d,_0x501dd4[_0xdb43('0x3c')]);var _0x4695e8={'where':_0x58361d['where']};return db[_0xdb43('0x3d')][_0xdb43('0x1a')](_0x4695e8)[_0xdb43('0x20')](function(_0x4da9a3){_0x255468[_0xdb43('0x1a')]=_0x4da9a3;if(_0x501dd4[_0xdb43('0x2b')][_0xdb43('0x3e')]){_0x58361d[_0xdb43('0x3f')]=[{'all':!![]}];}return db[_0xdb43('0x3d')]['findAll'](_0x58361d);})[_0xdb43('0x20')](function(_0x585c09){_0x255468[_0xdb43('0x40')]=_0x585c09;return _0x255468;})[_0xdb43('0x20')](respondWithFilteredResult(_0x5499f6,_0x58361d))[_0xdb43('0x41')](handleError(_0x5499f6,null));};exports[_0xdb43('0x42')]=function(_0x9bc964,_0x43506f){var _0x56c13f={'raw':![],'where':{'id':_0x9bc964[_0xdb43('0x43')]['id']}},_0x3047a2={};_0x3047a2[_0xdb43('0x2a')]=_[_0xdb43('0x2c')](db[_0xdb43('0x3d')][_0xdb43('0x44')]);_0x3047a2['query']=_[_0xdb43('0x2c')](_0x9bc964['query']);_0x3047a2[_0xdb43('0x2d')]=_[_0xdb43('0x2f')](_0x3047a2[_0xdb43('0x2a')],_0x3047a2[_0xdb43('0x2b')]);_0x56c13f['attributes']=_[_0xdb43('0x2f')](_0x3047a2[_0xdb43('0x2a')],qs['fields'](_0x9bc964['query'][_0xdb43('0x30')]));_0x56c13f[_0xdb43('0x2e')]=_0x56c13f['attributes'][_0xdb43('0x31')]?_0x56c13f[_0xdb43('0x2e')]:_0x3047a2[_0xdb43('0x2a')];if(_0x9bc964['query'][_0xdb43('0x3e')]){_0x56c13f[_0xdb43('0x3f')]=[{'all':!![]}];}_0x56c13f=_[_0xdb43('0x39')]({},_0x56c13f,_0x9bc964[_0xdb43('0x3c')]);return db[_0xdb43('0x3d')][_0xdb43('0x45')](_0x56c13f)[_0xdb43('0x20')](handleEntityNotFound(_0x43506f,null))[_0xdb43('0x20')](respondWithResult(_0x43506f,null))[_0xdb43('0x41')](handleError(_0x43506f,null));};exports[_0xdb43('0x46')]=function(_0x253ea3,_0x1396da){return db['SugarcrmConfiguration'][_0xdb43('0x46')](_0x253ea3[_0xdb43('0x47')],{})[_0xdb43('0x20')](respondWithResult(_0x1396da,0xc9))[_0xdb43('0x41')](handleError(_0x1396da,null));};exports['update']=function(_0x180ee0,_0x3949d5){if(_0x180ee0[_0xdb43('0x47')]['id']){delete _0x180ee0['body']['id'];}return db[_0xdb43('0x3d')][_0xdb43('0x45')]({'where':{'id':_0x180ee0[_0xdb43('0x43')]['id']}})[_0xdb43('0x20')](handleEntityNotFound(_0x3949d5,null))[_0xdb43('0x20')](saveUpdates(_0x180ee0[_0xdb43('0x47')],null))['then'](respondWithResult(_0x3949d5,null))[_0xdb43('0x41')](handleError(_0x3949d5,null));};exports[_0xdb43('0x21')]=function(_0x144738,_0x535014){return db[_0xdb43('0x3d')][_0xdb43('0x45')]({'where':{'id':_0x144738['params']['id']}})[_0xdb43('0x20')](handleEntityNotFound(_0x535014,null))[_0xdb43('0x20')](removeEntity(_0x535014,null))[_0xdb43('0x41')](handleError(_0x535014,null));};exports[_0xdb43('0x48')]=function(_0x2c8809,_0x3e19a8,_0x666d4f){var _0x5f31ba={};var _0x4e0f60={};var _0x41127d;var _0x49075b;return db[_0xdb43('0x3d')][_0xdb43('0x49')]({'where':{'id':_0x2c8809['params']['id']}})[_0xdb43('0x20')](handleEntityNotFound(_0x3e19a8,null))[_0xdb43('0x20')](function(_0x2781b){if(_0x2781b){_0x41127d=_0x2781b;_0x4e0f60['model']=_[_0xdb43('0x2c')](db[_0xdb43('0x4a')]['rawAttributes']);_0x4e0f60[_0xdb43('0x2b')]=_[_0xdb43('0x2c')](_0x2c8809[_0xdb43('0x2b')]);_0x4e0f60[_0xdb43('0x2d')]=_[_0xdb43('0x2f')](_0x4e0f60['model'],_0x4e0f60[_0xdb43('0x2b')]);_0x5f31ba[_0xdb43('0x2e')]=_[_0xdb43('0x2f')](_0x4e0f60[_0xdb43('0x2a')],qs['fields'](_0x2c8809[_0xdb43('0x2b')]['fields']));_0x5f31ba[_0xdb43('0x2e')]=_0x5f31ba['attributes'][_0xdb43('0x31')]?_0x5f31ba[_0xdb43('0x2e')]:_0x4e0f60[_0xdb43('0x2a')];_0x5f31ba[_0xdb43('0x34')]=qs[_0xdb43('0x35')](_0x2c8809['query'][_0xdb43('0x35')]);_0x5f31ba[_0xdb43('0x36')]=qs['filters'](_[_0xdb43('0x37')](_0x2c8809[_0xdb43('0x2b')],_0x4e0f60[_0xdb43('0x2d')]));if(_0x2c8809[_0xdb43('0x2b')][_0xdb43('0x38')]){_0x5f31ba[_0xdb43('0x36')]=_['merge'](_0x5f31ba[_0xdb43('0x36')],{'$or':_[_0xdb43('0x27')](_0x5f31ba['attributes'],function(_0x2087c9){var _0x1154f2={};_0x1154f2[_0x2087c9]={'$like':'%'+_0x2c8809[_0xdb43('0x2b')][_0xdb43('0x38')]+'%'};return _0x1154f2;})});}_0x5f31ba=_['merge']({},_0x5f31ba,_0x2c8809[_0xdb43('0x3c')]);return _0x41127d['getFields'](_0x5f31ba);}})['then'](function(_0x537971){if(_0x537971){_0x49075b=_0x537971[_0xdb43('0x31')];if(!_0x2c8809['query'][_0xdb43('0x32')](_0xdb43('0x33'))){_0x5f31ba['limit']=qs[_0xdb43('0x19')](_0x2c8809[_0xdb43('0x2b')][_0xdb43('0x19')]);_0x5f31ba[_0xdb43('0x17')]=qs[_0xdb43('0x17')](_0x2c8809[_0xdb43('0x2b')][_0xdb43('0x17')]);}return _0x41127d['getFields'](_0x5f31ba);}})[_0xdb43('0x20')](function(_0x42c22b){if(_0x42c22b){return _0x42c22b?{'count':_0x49075b,'rows':_0x42c22b}:null;}})[_0xdb43('0x20')](respondWithResult(_0x3e19a8,null))['catch'](handleError(_0x3e19a8,null));};exports[_0xdb43('0x4b')]=function(_0xc5f9fd,_0x182171,_0x433bcc){var _0xd27897={};var _0x26adae={};var _0x122021;var _0x58bb06;return db[_0xdb43('0x3d')][_0xdb43('0x49')]({'where':{'id':_0xc5f9fd[_0xdb43('0x43')]['id']}})['then'](handleEntityNotFound(_0x182171,null))[_0xdb43('0x20')](function(_0x496152){if(_0x496152){_0x122021=_0x496152;_0x26adae[_0xdb43('0x2a')]=_[_0xdb43('0x2c')](db[_0xdb43('0x4a')][_0xdb43('0x44')]);_0x26adae[_0xdb43('0x2b')]=_[_0xdb43('0x2c')](_0xc5f9fd[_0xdb43('0x2b')]);_0x26adae[_0xdb43('0x2d')]=_[_0xdb43('0x2f')](_0x26adae[_0xdb43('0x2a')],_0x26adae[_0xdb43('0x2b')]);_0xd27897[_0xdb43('0x2e')]=_[_0xdb43('0x2f')](_0x26adae['model'],qs[_0xdb43('0x30')](_0xc5f9fd['query'][_0xdb43('0x30')]));_0xd27897[_0xdb43('0x2e')]=_0xd27897['attributes'][_0xdb43('0x31')]?_0xd27897[_0xdb43('0x2e')]:_0x26adae[_0xdb43('0x2a')];_0xd27897[_0xdb43('0x34')]=qs[_0xdb43('0x35')](_0xc5f9fd[_0xdb43('0x2b')]['sort']);_0xd27897[_0xdb43('0x36')]=qs[_0xdb43('0x2d')](_[_0xdb43('0x37')](_0xc5f9fd[_0xdb43('0x2b')],_0x26adae[_0xdb43('0x2d')]));if(_0xc5f9fd[_0xdb43('0x2b')]['filter']){_0xd27897['where']=_[_0xdb43('0x39')](_0xd27897[_0xdb43('0x36')],{'$or':_[_0xdb43('0x27')](_0xd27897[_0xdb43('0x2e')],function(_0x4f2a87){var _0x4fbc34={};_0x4fbc34[_0x4f2a87]={'$like':'%'+_0xc5f9fd[_0xdb43('0x2b')][_0xdb43('0x38')]+'%'};return _0x4fbc34;})});}_0xd27897=_[_0xdb43('0x39')]({},_0xd27897,_0xc5f9fd[_0xdb43('0x3c')]);return _0x122021[_0xdb43('0x4b')](_0xd27897);}})['then'](function(_0x543514){if(_0x543514){_0x58bb06=_0x543514[_0xdb43('0x31')];if(!_0xc5f9fd[_0xdb43('0x2b')][_0xdb43('0x32')](_0xdb43('0x33'))){_0xd27897[_0xdb43('0x19')]=qs[_0xdb43('0x19')](_0xc5f9fd[_0xdb43('0x2b')][_0xdb43('0x19')]);_0xd27897[_0xdb43('0x17')]=qs[_0xdb43('0x17')](_0xc5f9fd[_0xdb43('0x2b')][_0xdb43('0x17')]);}return _0x122021[_0xdb43('0x4b')](_0xd27897);}})[_0xdb43('0x20')](function(_0x526c96){if(_0x526c96){return _0x526c96?{'count':_0x58bb06,'rows':_0x526c96}:null;}})[_0xdb43('0x20')](respondWithResult(_0x182171,null))[_0xdb43('0x41')](handleError(_0x182171,null));};exports[_0xdb43('0x4c')]=function(_0x279fa0,_0x1053ae,_0x179d50){var _0x589f4d={};var _0x32529c={};var _0x45f143;var _0x31f159;return db[_0xdb43('0x3d')]['findOne']({'where':{'id':_0x279fa0[_0xdb43('0x43')]['id']}})[_0xdb43('0x20')](handleEntityNotFound(_0x1053ae,null))[_0xdb43('0x20')](function(_0x11873e){if(_0x11873e){_0x45f143=_0x11873e;_0x32529c[_0xdb43('0x2a')]=_[_0xdb43('0x2c')](db[_0xdb43('0x4a')][_0xdb43('0x44')]);_0x32529c[_0xdb43('0x2b')]=_['keys'](_0x279fa0[_0xdb43('0x2b')]);_0x32529c[_0xdb43('0x2d')]=_[_0xdb43('0x2f')](_0x32529c[_0xdb43('0x2a')],_0x32529c['query']);_0x589f4d[_0xdb43('0x2e')]=_['intersection'](_0x32529c[_0xdb43('0x2a')],qs[_0xdb43('0x30')](_0x279fa0[_0xdb43('0x2b')]['fields']));_0x589f4d[_0xdb43('0x2e')]=_0x589f4d[_0xdb43('0x2e')][_0xdb43('0x31')]?_0x589f4d[_0xdb43('0x2e')]:_0x32529c[_0xdb43('0x2a')];_0x589f4d['order']=qs['sort'](_0x279fa0['query'][_0xdb43('0x35')]);_0x589f4d[_0xdb43('0x36')]=qs[_0xdb43('0x2d')](_['pick'](_0x279fa0['query'],_0x32529c[_0xdb43('0x2d')]));if(_0x279fa0[_0xdb43('0x2b')][_0xdb43('0x38')]){_0x589f4d[_0xdb43('0x36')]=_[_0xdb43('0x39')](_0x589f4d[_0xdb43('0x36')],{'$or':_[_0xdb43('0x27')](_0x589f4d['attributes'],function(_0x5866bc){var _0x146a9c={};_0x146a9c[_0x5866bc]={'$like':'%'+_0x279fa0[_0xdb43('0x2b')][_0xdb43('0x38')]+'%'};return _0x146a9c;})});}_0x589f4d=_[_0xdb43('0x39')]({},_0x589f4d,_0x279fa0[_0xdb43('0x3c')]);return _0x45f143[_0xdb43('0x4c')](_0x589f4d);}})[_0xdb43('0x20')](function(_0x26d420){if(_0x26d420){_0x31f159=_0x26d420[_0xdb43('0x31')];if(!_0x279fa0[_0xdb43('0x2b')][_0xdb43('0x32')](_0xdb43('0x33'))){_0x589f4d[_0xdb43('0x19')]=qs[_0xdb43('0x19')](_0x279fa0[_0xdb43('0x2b')][_0xdb43('0x19')]);_0x589f4d[_0xdb43('0x17')]=qs[_0xdb43('0x17')](_0x279fa0[_0xdb43('0x2b')][_0xdb43('0x17')]);}return _0x45f143['getDescriptions'](_0x589f4d);}})['then'](function(_0x251bd2){if(_0x251bd2){return _0x251bd2?{'count':_0x31f159,'rows':_0x251bd2}:null;}})[_0xdb43('0x20')](respondWithResult(_0x1053ae,null))[_0xdb43('0x41')](handleError(_0x1053ae,null));}; \ No newline at end of file +var _0xbdb5=['merge','find','create','body','catch','params','getFields','findOne','SugarcrmField','order','nolimit','getSubjects','getDescriptions','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','sort','filters','pick','filter','where','options','SugarcrmConfiguration','includeAll','include','findAll','show','length'];(function(_0x446613,_0x325071){var _0x2d293e=function(_0x21333b){while(--_0x21333b){_0x446613['push'](_0x446613['shift']());}};_0x2d293e(++_0x325071);}(_0xbdb5,0xf7));var _0x5bdb=function(_0x3bc779,_0x2caa24){_0x3bc779=_0x3bc779-0x0;var _0x1eed5c=_0xbdb5[_0x3bc779];return _0x1eed5c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5bdb('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5bdb('0x1'));var rp=require(_0x5bdb('0x2'));var moment=require(_0x5bdb('0x3'));var BPromise=require(_0x5bdb('0x4'));var Mustache=require(_0x5bdb('0x5'));var util=require(_0x5bdb('0x6'));var path=require('path');var sox=require(_0x5bdb('0x7'));var csv=require(_0x5bdb('0x8'));var ejs=require(_0x5bdb('0x9'));var fs=require('fs');var fs_extra=require(_0x5bdb('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5bdb('0xb'));var deskjs=require(_0x5bdb('0xc'));var toCsv=require(_0x5bdb('0x8'));var querystring=require(_0x5bdb('0xd'));var Papa=require(_0x5bdb('0xe'));var Redis=require(_0x5bdb('0xf'));var authService=require(_0x5bdb('0x10'));var qs=require(_0x5bdb('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5bdb('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x5bdb('0x13'));var config=require(_0x5bdb('0x14'));var licenseUtil=require(_0x5bdb('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xb6cd3e,_0x8701e4){_0x8701e4=_0x8701e4||0xcc;return function(_0x5ebd4c){if(_0x5ebd4c){return _0xb6cd3e[_0x5bdb('0x16')](_0x8701e4);}return _0xb6cd3e[_0x5bdb('0x17')](_0x8701e4)[_0x5bdb('0x18')]();};}function respondWithResult(_0x58b53c,_0x15667a){_0x15667a=_0x15667a||0xc8;return function(_0x31f43b){if(_0x31f43b){return _0x58b53c[_0x5bdb('0x17')](_0x15667a)[_0x5bdb('0x19')](_0x31f43b);}};}function respondWithFilteredResult(_0x56b6ff,_0x1cd1e1){return function(_0x3717b3){if(_0x3717b3){var _0x8f759f=typeof _0x1cd1e1['offset']===_0x5bdb('0x1a')&&typeof _0x1cd1e1[_0x5bdb('0x1b')]==='undefined';var _0x5ed1f2=_0x3717b3[_0x5bdb('0x1c')];var _0x1f1850=_0x8f759f?0x0:_0x1cd1e1[_0x5bdb('0x1d')];var _0x4d7b28=_0x8f759f?_0x3717b3[_0x5bdb('0x1c')]:_0x1cd1e1[_0x5bdb('0x1d')]+_0x1cd1e1[_0x5bdb('0x1b')];var _0x4e24d6;if(_0x4d7b28>=_0x5ed1f2){_0x4d7b28=_0x5ed1f2;_0x4e24d6=0xc8;}else{_0x4e24d6=0xce;}_0x56b6ff[_0x5bdb('0x17')](_0x4e24d6);return _0x56b6ff[_0x5bdb('0x1e')](_0x5bdb('0x1f'),_0x1f1850+'-'+_0x4d7b28+'/'+_0x5ed1f2)[_0x5bdb('0x19')](_0x3717b3);}return null;};}function patchUpdates(_0x2e9a0c){return function(_0x16400d){try{jsonpatch[_0x5bdb('0x20')](_0x16400d,_0x2e9a0c,!![]);}catch(_0x7ecdec){return BPromise[_0x5bdb('0x21')](_0x7ecdec);}return _0x16400d[_0x5bdb('0x22')]();};}function saveUpdates(_0x35a587,_0x5042a1){return function(_0xf533f7){if(_0xf533f7){return _0xf533f7[_0x5bdb('0x23')](_0x35a587)[_0x5bdb('0x24')](function(_0x55bb34){return _0x55bb34;});}return null;};}function removeEntity(_0x428a5f,_0x14655a){return function(_0x1ea190){if(_0x1ea190){return _0x1ea190[_0x5bdb('0x25')]()[_0x5bdb('0x24')](function(){_0x428a5f['status'](0xcc)[_0x5bdb('0x18')]();});}};}function handleEntityNotFound(_0x1f7b08,_0x45b36e){return function(_0x5d514c){if(!_0x5d514c){_0x1f7b08['sendStatus'](0x194);}return _0x5d514c;};}function handleError(_0x11aecb,_0x1d3394){_0x1d3394=_0x1d3394||0x1f4;return function(_0x49d8bc){logger[_0x5bdb('0x26')](_0x49d8bc[_0x5bdb('0x27')]);if(_0x49d8bc[_0x5bdb('0x28')]){delete _0x49d8bc[_0x5bdb('0x28')];}_0x11aecb[_0x5bdb('0x17')](_0x1d3394)['send'](_0x49d8bc);};}exports['index']=function(_0x52f0ca,_0x851193){var _0x919c40={},_0x1db55d={},_0x413239={'count':0x0,'rows':[]};var _0x30e3cc=_[_0x5bdb('0x29')](db['SugarcrmConfiguration'][_0x5bdb('0x2a')],function(_0x2e2b0d){return{'name':_0x2e2b0d[_0x5bdb('0x2b')],'type':_0x2e2b0d[_0x5bdb('0x2c')][_0x5bdb('0x2d')]};});_0x1db55d[_0x5bdb('0x2e')]=_[_0x5bdb('0x29')](_0x30e3cc,'name');_0x1db55d[_0x5bdb('0x2f')]=_[_0x5bdb('0x30')](_0x52f0ca[_0x5bdb('0x2f')]);_0x1db55d['filters']=_[_0x5bdb('0x31')](_0x1db55d['model'],_0x1db55d[_0x5bdb('0x2f')]);_0x919c40[_0x5bdb('0x32')]=_['intersection'](_0x1db55d[_0x5bdb('0x2e')],qs[_0x5bdb('0x33')](_0x52f0ca[_0x5bdb('0x2f')][_0x5bdb('0x33')]));_0x919c40[_0x5bdb('0x32')]=_0x919c40[_0x5bdb('0x32')]['length']?_0x919c40[_0x5bdb('0x32')]:_0x1db55d['model'];if(!_0x52f0ca[_0x5bdb('0x2f')][_0x5bdb('0x34')]('nolimit')){_0x919c40[_0x5bdb('0x1b')]=qs['limit'](_0x52f0ca['query'][_0x5bdb('0x1b')]);_0x919c40[_0x5bdb('0x1d')]=qs[_0x5bdb('0x1d')](_0x52f0ca[_0x5bdb('0x2f')][_0x5bdb('0x1d')]);}_0x919c40['order']=qs[_0x5bdb('0x35')](_0x52f0ca['query'][_0x5bdb('0x35')]);_0x919c40['where']=qs[_0x5bdb('0x36')](_[_0x5bdb('0x37')](_0x52f0ca[_0x5bdb('0x2f')],_0x1db55d['filters']),_0x30e3cc);if(_0x52f0ca['query'][_0x5bdb('0x38')]){_0x919c40['where']=_['merge'](_0x919c40[_0x5bdb('0x39')],{'$or':_[_0x5bdb('0x29')](_0x30e3cc,function(_0x437baa){if(_0x437baa['type']!=='VIRTUAL'){var _0x557627={};_0x557627[_0x437baa[_0x5bdb('0x28')]]={'$like':'%'+_0x52f0ca[_0x5bdb('0x2f')][_0x5bdb('0x38')]+'%'};return _0x557627;}})});}_0x919c40=_['merge']({},_0x919c40,_0x52f0ca[_0x5bdb('0x3a')]);var _0x101154={'where':_0x919c40['where']};return db[_0x5bdb('0x3b')][_0x5bdb('0x1c')](_0x101154)[_0x5bdb('0x24')](function(_0x30f058){_0x413239['count']=_0x30f058;if(_0x52f0ca['query'][_0x5bdb('0x3c')]){_0x919c40[_0x5bdb('0x3d')]=[{'all':!![]}];}return db[_0x5bdb('0x3b')][_0x5bdb('0x3e')](_0x919c40);})['then'](function(_0x40b72e){_0x413239['rows']=_0x40b72e;return _0x413239;})[_0x5bdb('0x24')](respondWithFilteredResult(_0x851193,_0x919c40))['catch'](handleError(_0x851193,null));};exports[_0x5bdb('0x3f')]=function(_0x5412b0,_0x402a97){var _0x4aba1c={'raw':![],'where':{'id':_0x5412b0['params']['id']}},_0x27d845={};_0x27d845[_0x5bdb('0x2e')]=_[_0x5bdb('0x30')](db['SugarcrmConfiguration'][_0x5bdb('0x2a')]);_0x27d845[_0x5bdb('0x2f')]=_[_0x5bdb('0x30')](_0x5412b0[_0x5bdb('0x2f')]);_0x27d845[_0x5bdb('0x36')]=_['intersection'](_0x27d845['model'],_0x27d845[_0x5bdb('0x2f')]);_0x4aba1c[_0x5bdb('0x32')]=_[_0x5bdb('0x31')](_0x27d845[_0x5bdb('0x2e')],qs[_0x5bdb('0x33')](_0x5412b0[_0x5bdb('0x2f')]['fields']));_0x4aba1c[_0x5bdb('0x32')]=_0x4aba1c[_0x5bdb('0x32')][_0x5bdb('0x40')]?_0x4aba1c[_0x5bdb('0x32')]:_0x27d845['model'];if(_0x5412b0[_0x5bdb('0x2f')]['includeAll']){_0x4aba1c[_0x5bdb('0x3d')]=[{'all':!![]}];}_0x4aba1c=_[_0x5bdb('0x41')]({},_0x4aba1c,_0x5412b0['options']);return db[_0x5bdb('0x3b')][_0x5bdb('0x42')](_0x4aba1c)[_0x5bdb('0x24')](handleEntityNotFound(_0x402a97,null))[_0x5bdb('0x24')](respondWithResult(_0x402a97,null))['catch'](handleError(_0x402a97,null));};exports[_0x5bdb('0x43')]=function(_0x54673e,_0x4bfd55){return db[_0x5bdb('0x3b')][_0x5bdb('0x43')](_0x54673e[_0x5bdb('0x44')],{})['then'](respondWithResult(_0x4bfd55,0xc9))['catch'](handleError(_0x4bfd55,null));};exports[_0x5bdb('0x23')]=function(_0x4154f3,_0x3d0d14){if(_0x4154f3['body']['id']){delete _0x4154f3[_0x5bdb('0x44')]['id'];}return db[_0x5bdb('0x3b')]['find']({'where':{'id':_0x4154f3['params']['id']}})['then'](handleEntityNotFound(_0x3d0d14,null))[_0x5bdb('0x24')](saveUpdates(_0x4154f3[_0x5bdb('0x44')],null))[_0x5bdb('0x24')](respondWithResult(_0x3d0d14,null))[_0x5bdb('0x45')](handleError(_0x3d0d14,null));};exports[_0x5bdb('0x25')]=function(_0x3f79ba,_0x37f62a){return db[_0x5bdb('0x3b')]['find']({'where':{'id':_0x3f79ba[_0x5bdb('0x46')]['id']}})['then'](handleEntityNotFound(_0x37f62a,null))[_0x5bdb('0x24')](removeEntity(_0x37f62a,null))[_0x5bdb('0x45')](handleError(_0x37f62a,null));};exports[_0x5bdb('0x47')]=function(_0x372321,_0x2a03b2,_0x1e9514){var _0x56a6ab={};var _0x52db27={};var _0x48dfd7;var _0xdc8112;return db[_0x5bdb('0x3b')][_0x5bdb('0x48')]({'where':{'id':_0x372321['params']['id']}})['then'](handleEntityNotFound(_0x2a03b2,null))['then'](function(_0x4a179e){if(_0x4a179e){_0x48dfd7=_0x4a179e;_0x52db27['model']=_[_0x5bdb('0x30')](db[_0x5bdb('0x49')][_0x5bdb('0x2a')]);_0x52db27[_0x5bdb('0x2f')]=_[_0x5bdb('0x30')](_0x372321['query']);_0x52db27[_0x5bdb('0x36')]=_[_0x5bdb('0x31')](_0x52db27[_0x5bdb('0x2e')],_0x52db27['query']);_0x56a6ab[_0x5bdb('0x32')]=_[_0x5bdb('0x31')](_0x52db27['model'],qs['fields'](_0x372321[_0x5bdb('0x2f')][_0x5bdb('0x33')]));_0x56a6ab['attributes']=_0x56a6ab['attributes'][_0x5bdb('0x40')]?_0x56a6ab[_0x5bdb('0x32')]:_0x52db27['model'];_0x56a6ab[_0x5bdb('0x4a')]=qs[_0x5bdb('0x35')](_0x372321[_0x5bdb('0x2f')]['sort']);_0x56a6ab[_0x5bdb('0x39')]=qs[_0x5bdb('0x36')](_['pick'](_0x372321[_0x5bdb('0x2f')],_0x52db27[_0x5bdb('0x36')]));if(_0x372321['query'][_0x5bdb('0x38')]){_0x56a6ab[_0x5bdb('0x39')]=_[_0x5bdb('0x41')](_0x56a6ab[_0x5bdb('0x39')],{'$or':_[_0x5bdb('0x29')](_0x56a6ab['attributes'],function(_0x400a56){var _0x2059d4={};_0x2059d4[_0x400a56]={'$like':'%'+_0x372321['query']['filter']+'%'};return _0x2059d4;})});}_0x56a6ab=_['merge']({},_0x56a6ab,_0x372321[_0x5bdb('0x3a')]);return _0x48dfd7[_0x5bdb('0x47')](_0x56a6ab);}})[_0x5bdb('0x24')](function(_0x15c3ce){if(_0x15c3ce){_0xdc8112=_0x15c3ce[_0x5bdb('0x40')];if(!_0x372321[_0x5bdb('0x2f')][_0x5bdb('0x34')](_0x5bdb('0x4b'))){_0x56a6ab[_0x5bdb('0x1b')]=qs[_0x5bdb('0x1b')](_0x372321['query'][_0x5bdb('0x1b')]);_0x56a6ab[_0x5bdb('0x1d')]=qs['offset'](_0x372321[_0x5bdb('0x2f')][_0x5bdb('0x1d')]);}return _0x48dfd7[_0x5bdb('0x47')](_0x56a6ab);}})[_0x5bdb('0x24')](function(_0x1f7350){if(_0x1f7350){return _0x1f7350?{'count':_0xdc8112,'rows':_0x1f7350}:null;}})[_0x5bdb('0x24')](respondWithResult(_0x2a03b2,null))['catch'](handleError(_0x2a03b2,null));};exports[_0x5bdb('0x4c')]=function(_0x1b3a3f,_0xffb20,_0x223a90){var _0x40b30f={};var _0x20636c={};var _0x55bf88;var _0x205ed2;return db[_0x5bdb('0x3b')][_0x5bdb('0x48')]({'where':{'id':_0x1b3a3f[_0x5bdb('0x46')]['id']}})[_0x5bdb('0x24')](handleEntityNotFound(_0xffb20,null))['then'](function(_0x55e1c0){if(_0x55e1c0){_0x55bf88=_0x55e1c0;_0x20636c[_0x5bdb('0x2e')]=_[_0x5bdb('0x30')](db['SugarcrmField'][_0x5bdb('0x2a')]);_0x20636c[_0x5bdb('0x2f')]=_[_0x5bdb('0x30')](_0x1b3a3f['query']);_0x20636c[_0x5bdb('0x36')]=_['intersection'](_0x20636c[_0x5bdb('0x2e')],_0x20636c[_0x5bdb('0x2f')]);_0x40b30f['attributes']=_[_0x5bdb('0x31')](_0x20636c['model'],qs['fields'](_0x1b3a3f[_0x5bdb('0x2f')]['fields']));_0x40b30f['attributes']=_0x40b30f[_0x5bdb('0x32')]['length']?_0x40b30f[_0x5bdb('0x32')]:_0x20636c[_0x5bdb('0x2e')];_0x40b30f[_0x5bdb('0x4a')]=qs[_0x5bdb('0x35')](_0x1b3a3f[_0x5bdb('0x2f')]['sort']);_0x40b30f[_0x5bdb('0x39')]=qs[_0x5bdb('0x36')](_[_0x5bdb('0x37')](_0x1b3a3f[_0x5bdb('0x2f')],_0x20636c['filters']));if(_0x1b3a3f[_0x5bdb('0x2f')][_0x5bdb('0x38')]){_0x40b30f[_0x5bdb('0x39')]=_[_0x5bdb('0x41')](_0x40b30f[_0x5bdb('0x39')],{'$or':_[_0x5bdb('0x29')](_0x40b30f[_0x5bdb('0x32')],function(_0x160a99){var _0x3c1e64={};_0x3c1e64[_0x160a99]={'$like':'%'+_0x1b3a3f[_0x5bdb('0x2f')][_0x5bdb('0x38')]+'%'};return _0x3c1e64;})});}_0x40b30f=_[_0x5bdb('0x41')]({},_0x40b30f,_0x1b3a3f[_0x5bdb('0x3a')]);return _0x55bf88[_0x5bdb('0x4c')](_0x40b30f);}})['then'](function(_0x356d76){if(_0x356d76){_0x205ed2=_0x356d76[_0x5bdb('0x40')];if(!_0x1b3a3f[_0x5bdb('0x2f')][_0x5bdb('0x34')](_0x5bdb('0x4b'))){_0x40b30f[_0x5bdb('0x1b')]=qs[_0x5bdb('0x1b')](_0x1b3a3f[_0x5bdb('0x2f')]['limit']);_0x40b30f[_0x5bdb('0x1d')]=qs[_0x5bdb('0x1d')](_0x1b3a3f[_0x5bdb('0x2f')][_0x5bdb('0x1d')]);}return _0x55bf88[_0x5bdb('0x4c')](_0x40b30f);}})[_0x5bdb('0x24')](function(_0x2a4966){if(_0x2a4966){return _0x2a4966?{'count':_0x205ed2,'rows':_0x2a4966}:null;}})[_0x5bdb('0x24')](respondWithResult(_0xffb20,null))['catch'](handleError(_0xffb20,null));};exports[_0x5bdb('0x4d')]=function(_0x30e641,_0xb8188f,_0xf1bf2a){var _0x44e1d0={};var _0x3c6234={};var _0x5ac299;var _0x38d764;return db[_0x5bdb('0x3b')][_0x5bdb('0x48')]({'where':{'id':_0x30e641[_0x5bdb('0x46')]['id']}})[_0x5bdb('0x24')](handleEntityNotFound(_0xb8188f,null))[_0x5bdb('0x24')](function(_0x3b689e){if(_0x3b689e){_0x5ac299=_0x3b689e;_0x3c6234[_0x5bdb('0x2e')]=_[_0x5bdb('0x30')](db[_0x5bdb('0x49')]['rawAttributes']);_0x3c6234[_0x5bdb('0x2f')]=_[_0x5bdb('0x30')](_0x30e641[_0x5bdb('0x2f')]);_0x3c6234[_0x5bdb('0x36')]=_[_0x5bdb('0x31')](_0x3c6234['model'],_0x3c6234[_0x5bdb('0x2f')]);_0x44e1d0[_0x5bdb('0x32')]=_[_0x5bdb('0x31')](_0x3c6234[_0x5bdb('0x2e')],qs[_0x5bdb('0x33')](_0x30e641[_0x5bdb('0x2f')][_0x5bdb('0x33')]));_0x44e1d0[_0x5bdb('0x32')]=_0x44e1d0['attributes'][_0x5bdb('0x40')]?_0x44e1d0[_0x5bdb('0x32')]:_0x3c6234[_0x5bdb('0x2e')];_0x44e1d0[_0x5bdb('0x4a')]=qs['sort'](_0x30e641[_0x5bdb('0x2f')][_0x5bdb('0x35')]);_0x44e1d0[_0x5bdb('0x39')]=qs[_0x5bdb('0x36')](_[_0x5bdb('0x37')](_0x30e641['query'],_0x3c6234['filters']));if(_0x30e641['query'][_0x5bdb('0x38')]){_0x44e1d0[_0x5bdb('0x39')]=_[_0x5bdb('0x41')](_0x44e1d0['where'],{'$or':_['map'](_0x44e1d0[_0x5bdb('0x32')],function(_0x1331e2){var _0x4e4550={};_0x4e4550[_0x1331e2]={'$like':'%'+_0x30e641[_0x5bdb('0x2f')]['filter']+'%'};return _0x4e4550;})});}_0x44e1d0=_['merge']({},_0x44e1d0,_0x30e641[_0x5bdb('0x3a')]);return _0x5ac299[_0x5bdb('0x4d')](_0x44e1d0);}})[_0x5bdb('0x24')](function(_0x530bad){if(_0x530bad){_0x38d764=_0x530bad[_0x5bdb('0x40')];if(!_0x30e641[_0x5bdb('0x2f')][_0x5bdb('0x34')]('nolimit')){_0x44e1d0[_0x5bdb('0x1b')]=qs[_0x5bdb('0x1b')](_0x30e641['query']['limit']);_0x44e1d0[_0x5bdb('0x1d')]=qs[_0x5bdb('0x1d')](_0x30e641[_0x5bdb('0x2f')]['offset']);}return _0x5ac299[_0x5bdb('0x4d')](_0x44e1d0);}})[_0x5bdb('0x24')](function(_0x329c30){if(_0x329c30){return _0x329c30?{'count':_0x38d764,'rows':_0x329c30}:null;}})[_0x5bdb('0x24')](respondWithResult(_0xb8188f,null))[_0x5bdb('0x45')](handleError(_0xb8188f,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 88ed440..53be1df 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 _0x6eee=['bluebird','request-promise','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','../../config/logger','api','moment'];(function(_0x1db1f4,_0x55dde7){var _0x26f677=function(_0x4e2f54){while(--_0x4e2f54){_0x1db1f4['push'](_0x1db1f4['shift']());}};_0x26f677(++_0x55dde7);}(_0x6eee,0xbf));var _0xe6ee=function(_0x1b5c18,_0x51644a){_0x1b5c18=_0x1b5c18-0x0;var _0x1b3e78=_0x6eee[_0x1b5c18];return _0x1b3e78;};'use strict';var _=require(_0xe6ee('0x0'));var util=require(_0xe6ee('0x1'));var logger=require(_0xe6ee('0x2'))(_0xe6ee('0x3'));var moment=require(_0xe6ee('0x4'));var BPromise=require(_0xe6ee('0x5'));var rp=require(_0xe6ee('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe6ee('0x7'));var config=require(_0xe6ee('0x8'));var attributes=require(_0xe6ee('0x9'));module[_0xe6ee('0xa')]=function(_0x3d138c,_0x366db9){return _0x3d138c[_0xe6ee('0xb')](_0xe6ee('0xc'),attributes,{'tableName':_0xe6ee('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x13c5=['util','../../config/logger','api','moment','bluebird','path','./intSugarcrmConfiguration.attributes','exports','SugarcrmConfiguration','lodash'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x13c5,0x1c1));var _0x513c=function(_0x29903f,_0x2ca80b){_0x29903f=_0x29903f-0x0;var _0x3ea920=_0x13c5[_0x29903f];return _0x3ea920;};'use strict';var _=require(_0x513c('0x0'));var util=require(_0x513c('0x1'));var logger=require(_0x513c('0x2'))(_0x513c('0x3'));var moment=require(_0x513c('0x4'));var BPromise=require(_0x513c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x513c('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x513c('0x7'));module[_0x513c('0x8')]=function(_0x37856d,_0xcc8d3d){return _0x37856d['define'](_0x513c('0x9'),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 b0bb5d0..f4d7401 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 _0xf3c9=['stringify','code','error','message','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','jayson/promise','then','info','SugarcrmConfiguration,\x20%s,\x20%s','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x46ef49,_0xb1ac19){var _0xb8b287=function(_0x45286b){while(--_0x45286b){_0x46ef49['push'](_0x46ef49['shift']());}};_0xb8b287(++_0xb1ac19);}(_0xf3c9,0x1cf));var _0x9f3c=function(_0x23f8a0,_0x2bc266){_0x23f8a0=_0x23f8a0-0x0;var _0x64fdcc=_0xf3c9[_0x23f8a0];return _0x64fdcc;};'use strict';var _=require('lodash');var util=require(_0x9f3c('0x0'));var moment=require(_0x9f3c('0x1'));var BPromise=require(_0x9f3c('0x2'));var rs=require(_0x9f3c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9f3c('0x4'))['db'];var utils=require(_0x9f3c('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x9f3c('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xc039f5,_0x11f0b0,_0x16a89d){return new BPromise(function(_0x5a5863,_0x5a970d){return client['request'](_0xc039f5,_0x16a89d)[_0x9f3c('0x7')](function(_0x4c00ec){logger[_0x9f3c('0x8')](_0x9f3c('0x9'),_0x11f0b0,'request\x20sent');logger[_0x9f3c('0xa')](_0x9f3c('0xb'),_0x11f0b0,_0x9f3c('0xc'),JSON[_0x9f3c('0xd')](_0x4c00ec));if(_0x4c00ec['error']){if(_0x4c00ec['error'][_0x9f3c('0xe')]===0x1f4){logger[_0x9f3c('0xf')](_0x9f3c('0x9'),_0x11f0b0,_0x4c00ec['error'][_0x9f3c('0x10')]);return _0x5a970d(_0x4c00ec[_0x9f3c('0xf')][_0x9f3c('0x10')]);}logger['error'](_0x9f3c('0x9'),_0x11f0b0,_0x4c00ec[_0x9f3c('0xf')][_0x9f3c('0x10')]);return _0x5a5863(_0x4c00ec['error']['message']);}else{logger[_0x9f3c('0x8')](_0x9f3c('0x9'),_0x11f0b0,_0x9f3c('0xc'));_0x5a5863(_0x4c00ec['result'][_0x9f3c('0x10')]);}})['catch'](function(_0x124f1d){logger['error'](_0x9f3c('0x9'),_0x11f0b0,_0x124f1d);_0x5a970d(_0x124f1d);});});} \ No newline at end of file +var _0x6deb=['jayson/promise','client','http','request','then','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3e9650,_0x15c3d9){var _0x2921f7=function(_0x271dff){while(--_0x271dff){_0x3e9650['push'](_0x3e9650['shift']());}};_0x2921f7(++_0x15c3d9);}(_0x6deb,0x9d));var _0xb6de=function(_0x3d7ba6,_0x58a354){_0x3d7ba6=_0x3d7ba6-0x0;var _0x4ca881=_0x6deb[_0x3d7ba6];return _0x4ca881;};'use strict';var _=require(_0xb6de('0x0'));var util=require(_0xb6de('0x1'));var moment=require(_0xb6de('0x2'));var BPromise=require(_0xb6de('0x3'));var rs=require(_0xb6de('0x4'));var fs=require('fs');var Redis=require(_0xb6de('0x5'));var db=require(_0xb6de('0x6'))['db'];var utils=require(_0xb6de('0x7'));var logger=require(_0xb6de('0x8'))(_0xb6de('0x9'));var config=require(_0xb6de('0xa'));var jayson=require(_0xb6de('0xb'));var client=jayson[_0xb6de('0xc')][_0xb6de('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x40d792,_0x6ae23a,_0x3aba16){return new BPromise(function(_0x4bf3e0,_0x5c4e3e){return client[_0xb6de('0xe')](_0x40d792,_0x3aba16)[_0xb6de('0xf')](function(_0x4ffde1){logger['info'](_0xb6de('0x10'),_0x6ae23a,_0xb6de('0x11'));logger[_0xb6de('0x12')](_0xb6de('0x13'),_0x6ae23a,'request\x20sent',JSON['stringify'](_0x4ffde1));if(_0x4ffde1[_0xb6de('0x14')]){if(_0x4ffde1[_0xb6de('0x14')]['code']===0x1f4){logger[_0xb6de('0x14')](_0xb6de('0x10'),_0x6ae23a,_0x4ffde1[_0xb6de('0x14')][_0xb6de('0x15')]);return _0x5c4e3e(_0x4ffde1[_0xb6de('0x14')][_0xb6de('0x15')]);}logger[_0xb6de('0x14')](_0xb6de('0x10'),_0x6ae23a,_0x4ffde1[_0xb6de('0x14')][_0xb6de('0x15')]);return _0x4bf3e0(_0x4ffde1[_0xb6de('0x14')][_0xb6de('0x15')]);}else{logger['info']('SugarcrmConfiguration,\x20%s,\x20%s',_0x6ae23a,_0xb6de('0x11'));_0x4bf3e0(_0x4ffde1[_0xb6de('0x16')][_0xb6de('0x15')]);}})[_0xb6de('0x17')](function(_0x562ffb){logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x6ae23a,_0x562ffb);_0x5c4e3e(_0x562ffb);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index abd0ba8..f0f6c55 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 _0x492e=['/:id','update','delete','destroy','exports','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','post','create','put'];(function(_0x4320b9,_0x587c28){var _0x418c2c=function(_0x51038a){while(--_0x51038a){_0x4320b9['push'](_0x4320b9['shift']());}};_0x418c2c(++_0x587c28);}(_0x492e,0x19d));var _0xe492=function(_0x3e8b16,_0x372dc3){_0x3e8b16=_0x3e8b16-0x0;var _0x104f60=_0x492e[_0x3e8b16];return _0x104f60;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe492('0x0'));var router=express[_0xe492('0x1')]();var fs_extra=require(_0xe492('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xe492('0x3'));var config=require(_0xe492('0x4'));var controller=require('./intSugarcrmField.controller');router[_0xe492('0x5')]('/',auth[_0xe492('0x6')](),controller[_0xe492('0x7')]);router['get']('/:id',auth[_0xe492('0x6')](),controller[_0xe492('0x8')]);router[_0xe492('0x9')]('/',auth[_0xe492('0x6')](),controller[_0xe492('0xa')]);router[_0xe492('0xb')](_0xe492('0xc'),auth[_0xe492('0x6')](),controller[_0xe492('0xd')]);router[_0xe492('0xe')](_0xe492('0xc'),auth[_0xe492('0x6')](),controller[_0xe492('0xf')]);module[_0xe492('0x10')]=router; \ No newline at end of file +var _0xf19b=['update','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','index','isAuthenticated','post','put','/:id'];(function(_0x8de54f,_0x271987){var _0x14cba4=function(_0x58ed41){while(--_0x58ed41){_0x8de54f['push'](_0x8de54f['shift']());}};_0x14cba4(++_0x271987);}(_0xf19b,0x197));var _0xbf19=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xf19b[_0x411add];return _0x238242;};'use strict';var multer=require('multer');var util=require(_0xbf19('0x0'));var path=require(_0xbf19('0x1'));var timeout=require(_0xbf19('0x2'));var express=require(_0xbf19('0x3'));var router=express[_0xbf19('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xbf19('0x5'));var interaction=require(_0xbf19('0x6'));var config=require('../../config/environment');var controller=require('./intSugarcrmField.controller');router[_0xbf19('0x7')]('/',auth['isAuthenticated'](),controller[_0xbf19('0x8')]);router[_0xbf19('0x7')]('/:id',auth[_0xbf19('0x9')](),controller['show']);router[_0xbf19('0xa')]('/',auth[_0xbf19('0x9')](),controller['create']);router[_0xbf19('0xb')](_0xbf19('0xc'),auth[_0xbf19('0x9')](),controller[_0xbf19('0xd')]);router['delete'](_0xbf19('0xc'),auth['isAuthenticated'](),controller[_0xbf19('0xe')]);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 ad72f07..7b89f7a 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 _0x9c9b=['BOOLEAN','sequelize','ENUM','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0x5b04a3,_0xfda4fd){var _0x1adf11=function(_0x9e242a){while(--_0x9e242a){_0x5b04a3['push'](_0x5b04a3['shift']());}};_0x1adf11(++_0xfda4fd);}(_0x9c9b,0x14e));var _0xb9c9=function(_0x323654,_0x5abc68){_0x323654=_0x323654-0x0;var _0x3b229a=_0x9c9b[_0x323654];return _0x3b229a;};'use strict';var Sequelize=require(_0xb9c9('0x0'));module['exports']={'type':{'type':Sequelize[_0xb9c9('0x1')](_0xb9c9('0x2'),_0xb9c9('0x3'),_0xb9c9('0x4'),_0xb9c9('0x5'),_0xb9c9('0x6')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xb9c9('0x7')]},'keyType':{'type':Sequelize[_0xb9c9('0x1')](_0xb9c9('0x2'),_0xb9c9('0x3'),_0xb9c9('0x4'))},'keyContent':{'type':Sequelize[_0xb9c9('0x7')]},'idField':{'type':Sequelize[_0xb9c9('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xb9c9('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb9c9('0x7')]}}; \ No newline at end of file +var _0xc490=['STRING','ENUM','variable','customVariable','keyValue','picklist','string'];(function(_0x39d39d,_0x5586bd){var _0x577ac3=function(_0x12f9f2){while(--_0x12f9f2){_0x39d39d['push'](_0x39d39d['shift']());}};_0x577ac3(++_0x5586bd);}(_0xc490,0x9b));var _0x0c49=function(_0x37b01f,_0x277385){_0x37b01f=_0x37b01f-0x0;var _0x1213f4=_0xc490[_0x37b01f];return _0x1213f4;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x0c49('0x0')]('string',_0x0c49('0x1'),_0x0c49('0x2'),_0x0c49('0x3'),_0x0c49('0x4')),'defaultValue':_0x0c49('0x5')},'content':{'type':Sequelize[_0x0c49('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x0c49('0x0')](_0x0c49('0x5'),_0x0c49('0x1'),_0x0c49('0x2'))},'keyContent':{'type':Sequelize[_0x0c49('0x6')]},'idField':{'type':Sequelize[_0x0c49('0x6')]},'nameField':{'type':Sequelize[_0x0c49('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0c49('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index ed9b011..8631af3 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 _0xa0a1=['findAll','show','keys','length','find','create','catch','body','params','destroy','zip-dir','request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','sendStatus','stack','name','send','index','map','SugarcrmField','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xa0a1,0x12a));var _0x1a0a=function(_0x416c70,_0x30ee05){_0x416c70=_0x416c70-0x0;var _0x2cead9=_0xa0a1[_0x416c70];return _0x2cead9;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1a0a('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1a0a('0x1'));var moment=require(_0x1a0a('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x1a0a('0x3'));var util=require(_0x1a0a('0x4'));var path=require(_0x1a0a('0x5'));var sox=require(_0x1a0a('0x6'));var csv=require('to-csv');var ejs=require(_0x1a0a('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1a0a('0x8'));var squel=require(_0x1a0a('0x9'));var crypto=require(_0x1a0a('0xa'));var jsforce=require(_0x1a0a('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1a0a('0xc'));var querystring=require('querystring');var Papa=require(_0x1a0a('0xd'));var Redis=require('ioredis');var authService=require(_0x1a0a('0xe'));var qs=require(_0x1a0a('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1a0a('0x10'));var logger=require(_0x1a0a('0x11'))(_0x1a0a('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x1a0a('0x13'));var db=require(_0x1a0a('0x14'))['db'];function respondWithStatusCode(_0x3aa559,_0x2422f){_0x2422f=_0x2422f||0xcc;return function(_0x5cc6f5){if(_0x5cc6f5){return _0x3aa559['sendStatus'](_0x2422f);}return _0x3aa559[_0x1a0a('0x15')](_0x2422f)[_0x1a0a('0x16')]();};}function respondWithResult(_0x16ea2b,_0x3ac053){_0x3ac053=_0x3ac053||0xc8;return function(_0x2ec970){if(_0x2ec970){return _0x16ea2b[_0x1a0a('0x15')](_0x3ac053)['json'](_0x2ec970);}};}function respondWithFilteredResult(_0x106e87,_0x22ef90){return function(_0x2223fb){if(_0x2223fb){var _0x3bf7d1=typeof _0x22ef90[_0x1a0a('0x17')]===_0x1a0a('0x18')&&typeof _0x22ef90[_0x1a0a('0x19')]===_0x1a0a('0x18');var _0x2dacef=_0x2223fb[_0x1a0a('0x1a')];var _0x1fc936=_0x3bf7d1?0x0:_0x22ef90[_0x1a0a('0x17')];var _0x2f781b=_0x3bf7d1?_0x2223fb[_0x1a0a('0x1a')]:_0x22ef90[_0x1a0a('0x17')]+_0x22ef90['limit'];var _0x375c84;if(_0x2f781b>=_0x2dacef){_0x2f781b=_0x2dacef;_0x375c84=0xc8;}else{_0x375c84=0xce;}_0x106e87[_0x1a0a('0x15')](_0x375c84);return _0x106e87[_0x1a0a('0x1b')](_0x1a0a('0x1c'),_0x1fc936+'-'+_0x2f781b+'/'+_0x2dacef)[_0x1a0a('0x1d')](_0x2223fb);}return null;};}function patchUpdates(_0x96945d){return function(_0x48f44a){try{jsonpatch['apply'](_0x48f44a,_0x96945d,!![]);}catch(_0x10be4a){return BPromise[_0x1a0a('0x1e')](_0x10be4a);}return _0x48f44a[_0x1a0a('0x1f')]();};}function saveUpdates(_0x3a3c24,_0x40cfbc){return function(_0x2b6fa6){if(_0x2b6fa6){return _0x2b6fa6[_0x1a0a('0x20')](_0x3a3c24)[_0x1a0a('0x21')](function(_0x2b6476){return _0x2b6476;});}return null;};}function removeEntity(_0x3ffdcf,_0x1e8337){return function(_0x5c1f68){if(_0x5c1f68){return _0x5c1f68['destroy']()[_0x1a0a('0x21')](function(){_0x3ffdcf['status'](0xcc)[_0x1a0a('0x16')]();});}};}function handleEntityNotFound(_0x183f9b,_0x3701bb){return function(_0x4cc2e1){if(!_0x4cc2e1){_0x183f9b[_0x1a0a('0x22')](0x194);}return _0x4cc2e1;};}function handleError(_0x2fb22b,_0x5c0f10){_0x5c0f10=_0x5c0f10||0x1f4;return function(_0x4c081b){logger['error'](_0x4c081b[_0x1a0a('0x23')]);if(_0x4c081b['name']){delete _0x4c081b[_0x1a0a('0x24')];}_0x2fb22b['status'](_0x5c0f10)[_0x1a0a('0x25')](_0x4c081b);};}exports[_0x1a0a('0x26')]=function(_0x3e194d,_0x349570){var _0x46a590={},_0xdb0150={},_0x35f308={'count':0x0,'rows':[]};var _0x4d0544=_[_0x1a0a('0x27')](db[_0x1a0a('0x28')][_0x1a0a('0x29')],function(_0xbc5e6e){return{'name':_0xbc5e6e[_0x1a0a('0x2a')],'type':_0xbc5e6e[_0x1a0a('0x2b')][_0x1a0a('0x2c')]};});_0xdb0150[_0x1a0a('0x2d')]=_[_0x1a0a('0x27')](_0x4d0544,'name');_0xdb0150[_0x1a0a('0x2e')]=_['keys'](_0x3e194d[_0x1a0a('0x2e')]);_0xdb0150[_0x1a0a('0x2f')]=_['intersection'](_0xdb0150[_0x1a0a('0x2d')],_0xdb0150['query']);_0x46a590['attributes']=_[_0x1a0a('0x30')](_0xdb0150['model'],qs[_0x1a0a('0x31')](_0x3e194d[_0x1a0a('0x2e')]['fields']));_0x46a590['attributes']=_0x46a590[_0x1a0a('0x32')]['length']?_0x46a590[_0x1a0a('0x32')]:_0xdb0150[_0x1a0a('0x2d')];if(!_0x3e194d[_0x1a0a('0x2e')][_0x1a0a('0x33')](_0x1a0a('0x34'))){_0x46a590[_0x1a0a('0x19')]=qs[_0x1a0a('0x19')](_0x3e194d[_0x1a0a('0x2e')][_0x1a0a('0x19')]);_0x46a590['offset']=qs['offset'](_0x3e194d[_0x1a0a('0x2e')][_0x1a0a('0x17')]);}_0x46a590[_0x1a0a('0x35')]=qs[_0x1a0a('0x36')](_0x3e194d[_0x1a0a('0x2e')][_0x1a0a('0x36')]);_0x46a590['where']=qs[_0x1a0a('0x2f')](_[_0x1a0a('0x37')](_0x3e194d[_0x1a0a('0x2e')],_0xdb0150[_0x1a0a('0x2f')]),_0x4d0544);if(_0x3e194d['query'][_0x1a0a('0x38')]){_0x46a590[_0x1a0a('0x39')]=_[_0x1a0a('0x3a')](_0x46a590['where'],{'$or':_[_0x1a0a('0x27')](_0x4d0544,function(_0x526ce4){if(_0x526ce4[_0x1a0a('0x2b')]!==_0x1a0a('0x3b')){var _0x1239ac={};_0x1239ac[_0x526ce4[_0x1a0a('0x24')]]={'$like':'%'+_0x3e194d[_0x1a0a('0x2e')][_0x1a0a('0x38')]+'%'};return _0x1239ac;}})});}_0x46a590=_[_0x1a0a('0x3a')]({},_0x46a590,_0x3e194d['options']);var _0x1ca8eb={'where':_0x46a590[_0x1a0a('0x39')]};return db[_0x1a0a('0x28')][_0x1a0a('0x1a')](_0x1ca8eb)[_0x1a0a('0x21')](function(_0x1e7307){_0x35f308[_0x1a0a('0x1a')]=_0x1e7307;if(_0x3e194d[_0x1a0a('0x2e')][_0x1a0a('0x3c')]){_0x46a590[_0x1a0a('0x3d')]=[{'all':!![]}];}return db['SugarcrmField'][_0x1a0a('0x3e')](_0x46a590);})[_0x1a0a('0x21')](function(_0x4e89ff){_0x35f308['rows']=_0x4e89ff;return _0x35f308;})[_0x1a0a('0x21')](respondWithFilteredResult(_0x349570,_0x46a590))['catch'](handleError(_0x349570,null));};exports[_0x1a0a('0x3f')]=function(_0x46b063,_0x334d99){var _0x40862b={'raw':!![],'where':{'id':_0x46b063['params']['id']}},_0x34f718={};_0x34f718[_0x1a0a('0x2d')]=_[_0x1a0a('0x40')](db[_0x1a0a('0x28')][_0x1a0a('0x29')]);_0x34f718[_0x1a0a('0x2e')]=_[_0x1a0a('0x40')](_0x46b063[_0x1a0a('0x2e')]);_0x34f718[_0x1a0a('0x2f')]=_[_0x1a0a('0x30')](_0x34f718[_0x1a0a('0x2d')],_0x34f718['query']);_0x40862b[_0x1a0a('0x32')]=_[_0x1a0a('0x30')](_0x34f718[_0x1a0a('0x2d')],qs['fields'](_0x46b063[_0x1a0a('0x2e')][_0x1a0a('0x31')]));_0x40862b[_0x1a0a('0x32')]=_0x40862b['attributes'][_0x1a0a('0x41')]?_0x40862b[_0x1a0a('0x32')]:_0x34f718[_0x1a0a('0x2d')];if(_0x46b063[_0x1a0a('0x2e')][_0x1a0a('0x3c')]){_0x40862b['include']=[{'all':!![]}];}_0x40862b=_[_0x1a0a('0x3a')]({},_0x40862b,_0x46b063['options']);return db['SugarcrmField'][_0x1a0a('0x42')](_0x40862b)[_0x1a0a('0x21')](handleEntityNotFound(_0x334d99,null))[_0x1a0a('0x21')](respondWithResult(_0x334d99,null))['catch'](handleError(_0x334d99,null));};exports[_0x1a0a('0x43')]=function(_0x9e1f1b,_0x2cd5f5){return db[_0x1a0a('0x28')][_0x1a0a('0x43')](_0x9e1f1b['body'],{})[_0x1a0a('0x21')](respondWithResult(_0x2cd5f5,0xc9))[_0x1a0a('0x44')](handleError(_0x2cd5f5,null));};exports[_0x1a0a('0x20')]=function(_0x1777e7,_0x620c84){if(_0x1777e7['body']['id']){delete _0x1777e7[_0x1a0a('0x45')]['id'];}return db[_0x1a0a('0x28')][_0x1a0a('0x42')]({'where':{'id':_0x1777e7[_0x1a0a('0x46')]['id']}})[_0x1a0a('0x21')](handleEntityNotFound(_0x620c84,null))['then'](saveUpdates(_0x1777e7[_0x1a0a('0x45')],null))[_0x1a0a('0x21')](respondWithResult(_0x620c84,null))[_0x1a0a('0x44')](handleError(_0x620c84,null));};exports[_0x1a0a('0x47')]=function(_0x43ae98,_0x5be346){return db[_0x1a0a('0x28')][_0x1a0a('0x42')]({'where':{'id':_0x43ae98[_0x1a0a('0x46')]['id']}})['then'](handleEntityNotFound(_0x5be346,null))[_0x1a0a('0x21')](removeEntity(_0x5be346,null))['catch'](handleError(_0x5be346,null));}; \ No newline at end of file +var _0x21c3=['../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','map','rawAttributes','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','where','pick','filters','filter','merge','type','VIRTUAL','name','SugarcrmField','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service'];(function(_0x52e68e,_0x309912){var _0x3211a4=function(_0x467c01){while(--_0x467c01){_0x52e68e['push'](_0x52e68e['shift']());}};_0x3211a4(++_0x309912);}(_0x21c3,0x114));var _0x321c=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x21c3[_0x2f5ac5];return _0x37c9a8;};'use strict';var emlformat=require(_0x321c('0x0'));var rimraf=require(_0x321c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x321c('0x2'));var rp=require(_0x321c('0x3'));var moment=require(_0x321c('0x4'));var BPromise=require(_0x321c('0x5'));var Mustache=require('mustache');var util=require(_0x321c('0x6'));var path=require('path');var sox=require(_0x321c('0x7'));var csv=require(_0x321c('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x321c('0x9'));var _=require(_0x321c('0xa'));var squel=require(_0x321c('0xb'));var crypto=require(_0x321c('0xc'));var jsforce=require(_0x321c('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x321c('0x8'));var querystring=require('querystring');var Papa=require(_0x321c('0xe'));var Redis=require('ioredis');var authService=require(_0x321c('0xf'));var qs=require(_0x321c('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x321c('0x11'))('api');var utils=require(_0x321c('0x12'));var config=require(_0x321c('0x13'));var licenseUtil=require(_0x321c('0x14'));var db=require(_0x321c('0x15'))['db'];function respondWithStatusCode(_0x29802b,_0x4df753){_0x4df753=_0x4df753||0xcc;return function(_0x572aff){if(_0x572aff){return _0x29802b['sendStatus'](_0x4df753);}return _0x29802b['status'](_0x4df753)[_0x321c('0x16')]();};}function respondWithResult(_0x5e37a5,_0x38015a){_0x38015a=_0x38015a||0xc8;return function(_0x3cf52c){if(_0x3cf52c){return _0x5e37a5[_0x321c('0x17')](_0x38015a)[_0x321c('0x18')](_0x3cf52c);}};}function respondWithFilteredResult(_0x393657,_0x28b9bc){return function(_0x2a1f88){if(_0x2a1f88){var _0x4820d5=typeof _0x28b9bc[_0x321c('0x19')]==='undefined'&&typeof _0x28b9bc['limit']===_0x321c('0x1a');var _0x513caf=_0x2a1f88[_0x321c('0x1b')];var _0x59630c=_0x4820d5?0x0:_0x28b9bc[_0x321c('0x19')];var _0x16416f=_0x4820d5?_0x2a1f88['count']:_0x28b9bc[_0x321c('0x19')]+_0x28b9bc['limit'];var _0x49b487;if(_0x16416f>=_0x513caf){_0x16416f=_0x513caf;_0x49b487=0xc8;}else{_0x49b487=0xce;}_0x393657['status'](_0x49b487);return _0x393657[_0x321c('0x1c')](_0x321c('0x1d'),_0x59630c+'-'+_0x16416f+'/'+_0x513caf)[_0x321c('0x18')](_0x2a1f88);}return null;};}function patchUpdates(_0x591337){return function(_0x3e048f){try{jsonpatch[_0x321c('0x1e')](_0x3e048f,_0x591337,!![]);}catch(_0x4a2951){return BPromise[_0x321c('0x1f')](_0x4a2951);}return _0x3e048f[_0x321c('0x20')]();};}function saveUpdates(_0x40a836,_0x1e682d){return function(_0x4dfb6e){if(_0x4dfb6e){return _0x4dfb6e[_0x321c('0x21')](_0x40a836)[_0x321c('0x22')](function(_0xcdbab8){return _0xcdbab8;});}return null;};}function removeEntity(_0x15c0a5,_0xf6fef){return function(_0x420404){if(_0x420404){return _0x420404[_0x321c('0x23')]()[_0x321c('0x22')](function(){_0x15c0a5[_0x321c('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x462a16,_0x3e37f8){return function(_0x276589){if(!_0x276589){_0x462a16[_0x321c('0x24')](0x194);}return _0x276589;};}function handleError(_0xa7e96,_0x151d62){_0x151d62=_0x151d62||0x1f4;return function(_0x24f706){logger[_0x321c('0x25')](_0x24f706[_0x321c('0x26')]);if(_0x24f706['name']){delete _0x24f706['name'];}_0xa7e96[_0x321c('0x17')](_0x151d62)['send'](_0x24f706);};}exports['index']=function(_0x47c6c6,_0x47ad29){var _0x154c02={},_0x3e0db4={},_0x50024d={'count':0x0,'rows':[]};var _0x4f03ca=_[_0x321c('0x27')](db['SugarcrmField'][_0x321c('0x28')],function(_0x11ee7c){return{'name':_0x11ee7c['fieldName'],'type':_0x11ee7c['type'][_0x321c('0x29')]};});_0x3e0db4[_0x321c('0x2a')]=_[_0x321c('0x27')](_0x4f03ca,'name');_0x3e0db4[_0x321c('0x2b')]=_[_0x321c('0x2c')](_0x47c6c6['query']);_0x3e0db4['filters']=_[_0x321c('0x2d')](_0x3e0db4[_0x321c('0x2a')],_0x3e0db4[_0x321c('0x2b')]);_0x154c02['attributes']=_[_0x321c('0x2d')](_0x3e0db4[_0x321c('0x2a')],qs[_0x321c('0x2e')](_0x47c6c6[_0x321c('0x2b')][_0x321c('0x2e')]));_0x154c02[_0x321c('0x2f')]=_0x154c02[_0x321c('0x2f')][_0x321c('0x30')]?_0x154c02['attributes']:_0x3e0db4[_0x321c('0x2a')];if(!_0x47c6c6[_0x321c('0x2b')][_0x321c('0x31')]('nolimit')){_0x154c02[_0x321c('0x32')]=qs['limit'](_0x47c6c6[_0x321c('0x2b')]['limit']);_0x154c02[_0x321c('0x19')]=qs[_0x321c('0x19')](_0x47c6c6[_0x321c('0x2b')]['offset']);}_0x154c02[_0x321c('0x33')]=qs[_0x321c('0x34')](_0x47c6c6[_0x321c('0x2b')]['sort']);_0x154c02[_0x321c('0x35')]=qs['filters'](_[_0x321c('0x36')](_0x47c6c6[_0x321c('0x2b')],_0x3e0db4[_0x321c('0x37')]),_0x4f03ca);if(_0x47c6c6[_0x321c('0x2b')][_0x321c('0x38')]){_0x154c02[_0x321c('0x35')]=_[_0x321c('0x39')](_0x154c02[_0x321c('0x35')],{'$or':_[_0x321c('0x27')](_0x4f03ca,function(_0x5e6e8a){if(_0x5e6e8a[_0x321c('0x3a')]!==_0x321c('0x3b')){var _0x3ccd86={};_0x3ccd86[_0x5e6e8a[_0x321c('0x3c')]]={'$like':'%'+_0x47c6c6[_0x321c('0x2b')][_0x321c('0x38')]+'%'};return _0x3ccd86;}})});}_0x154c02=_[_0x321c('0x39')]({},_0x154c02,_0x47c6c6['options']);var _0x1c75e0={'where':_0x154c02[_0x321c('0x35')]};return db[_0x321c('0x3d')]['count'](_0x1c75e0)['then'](function(_0x445131){_0x50024d['count']=_0x445131;if(_0x47c6c6[_0x321c('0x2b')][_0x321c('0x3e')]){_0x154c02[_0x321c('0x3f')]=[{'all':!![]}];}return db['SugarcrmField'][_0x321c('0x40')](_0x154c02);})['then'](function(_0x4c1262){_0x50024d[_0x321c('0x41')]=_0x4c1262;return _0x50024d;})[_0x321c('0x22')](respondWithFilteredResult(_0x47ad29,_0x154c02))[_0x321c('0x42')](handleError(_0x47ad29,null));};exports[_0x321c('0x43')]=function(_0xa34a3e,_0x5848e6){var _0x49ba9b={'raw':!![],'where':{'id':_0xa34a3e[_0x321c('0x44')]['id']}},_0x291606={};_0x291606['model']=_[_0x321c('0x2c')](db[_0x321c('0x3d')]['rawAttributes']);_0x291606[_0x321c('0x2b')]=_['keys'](_0xa34a3e['query']);_0x291606['filters']=_['intersection'](_0x291606[_0x321c('0x2a')],_0x291606[_0x321c('0x2b')]);_0x49ba9b[_0x321c('0x2f')]=_[_0x321c('0x2d')](_0x291606[_0x321c('0x2a')],qs[_0x321c('0x2e')](_0xa34a3e[_0x321c('0x2b')][_0x321c('0x2e')]));_0x49ba9b[_0x321c('0x2f')]=_0x49ba9b[_0x321c('0x2f')]['length']?_0x49ba9b['attributes']:_0x291606[_0x321c('0x2a')];if(_0xa34a3e[_0x321c('0x2b')][_0x321c('0x3e')]){_0x49ba9b[_0x321c('0x3f')]=[{'all':!![]}];}_0x49ba9b=_['merge']({},_0x49ba9b,_0xa34a3e[_0x321c('0x45')]);return db['SugarcrmField'][_0x321c('0x46')](_0x49ba9b)['then'](handleEntityNotFound(_0x5848e6,null))[_0x321c('0x22')](respondWithResult(_0x5848e6,null))[_0x321c('0x42')](handleError(_0x5848e6,null));};exports[_0x321c('0x47')]=function(_0x430e16,_0x4aedce){return db[_0x321c('0x3d')][_0x321c('0x47')](_0x430e16[_0x321c('0x48')],{})[_0x321c('0x22')](respondWithResult(_0x4aedce,0xc9))[_0x321c('0x42')](handleError(_0x4aedce,null));};exports[_0x321c('0x21')]=function(_0x198d9f,_0x4a8bb9){if(_0x198d9f[_0x321c('0x48')]['id']){delete _0x198d9f[_0x321c('0x48')]['id'];}return db[_0x321c('0x3d')][_0x321c('0x46')]({'where':{'id':_0x198d9f[_0x321c('0x44')]['id']}})[_0x321c('0x22')](handleEntityNotFound(_0x4a8bb9,null))[_0x321c('0x22')](saveUpdates(_0x198d9f[_0x321c('0x48')],null))[_0x321c('0x22')](respondWithResult(_0x4a8bb9,null))[_0x321c('0x42')](handleError(_0x4a8bb9,null));};exports[_0x321c('0x23')]=function(_0x1d4e23,_0x1bf42f){return db[_0x321c('0x3d')]['find']({'where':{'id':_0x1d4e23[_0x321c('0x44')]['id']}})[_0x321c('0x22')](handleEntityNotFound(_0x1bf42f,null))[_0x321c('0x22')](removeEntity(_0x1bf42f,null))[_0x321c('0x42')](handleError(_0x1bf42f,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index cc1d12f..0ac1a67 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 _0xfdbe=['./intSugarcrmField.attributes','exports','define','SugarcrmField','int_sugarcrm_fields','idField','FieldId','lodash','../../config/logger','api','moment','path','rimraf','../../config/environment'];(function(_0x219c82,_0xe6f67f){var _0x2195c9=function(_0x333d71){while(--_0x333d71){_0x219c82['push'](_0x219c82['shift']());}};_0x2195c9(++_0xe6f67f);}(_0xfdbe,0x13b));var _0xefdb=function(_0x2d2b63,_0x277d0a){_0x2d2b63=_0x2d2b63-0x0;var _0x5d18f8=_0xfdbe[_0x2d2b63];return _0x5d18f8;};'use strict';var _=require(_0xefdb('0x0'));var util=require('util');var logger=require(_0xefdb('0x1'))(_0xefdb('0x2'));var moment=require(_0xefdb('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xefdb('0x4'));var rimraf=require(_0xefdb('0x5'));var config=require(_0xefdb('0x6'));var attributes=require(_0xefdb('0x7'));module[_0xefdb('0x8')]=function(_0x3ccdc4,_0x2016f2){return _0x3ccdc4[_0xefdb('0x9')](_0xefdb('0xa'),attributes,{'tableName':_0xefdb('0xb'),'paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':[_0xefdb('0xc'),_0xefdb('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x90a1=['./intSugarcrmField.attributes','exports','define','SugarcrmField','int_sugarcrm_fields','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x127df0,_0xa6fe59){var _0x333bdc=function(_0x16bdbb){while(--_0x16bdbb){_0x127df0['push'](_0x127df0['shift']());}};_0x333bdc(++_0xa6fe59);}(_0x90a1,0x177));var _0x190a=function(_0x344a3f,_0x579a22){_0x344a3f=_0x344a3f-0x0;var _0x264712=_0x90a1[_0x344a3f];return _0x264712;};'use strict';var _=require(_0x190a('0x0'));var util=require(_0x190a('0x1'));var logger=require(_0x190a('0x2'))(_0x190a('0x3'));var moment=require(_0x190a('0x4'));var BPromise=require(_0x190a('0x5'));var rp=require(_0x190a('0x6'));var fs=require('fs');var path=require(_0x190a('0x7'));var rimraf=require('rimraf');var config=require(_0x190a('0x8'));var attributes=require(_0x190a('0x9'));module[_0x190a('0xa')]=function(_0x9501bb,_0x445ac1){return _0x9501bb[_0x190a('0xb')](_0x190a('0xc'),attributes,{'tableName':_0x190a('0xd'),'paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':[_0x190a('0xe'),_0x190a('0xf')],'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 a60b99a..f1abb05 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 _0x7e6c=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x7e6c,0x10e));var _0xc7e6=function(_0x159f91,_0xe8a30f){_0x159f91=_0x159f91-0x0;var _0x26bd65=_0x7e6c[_0x159f91];return _0x26bd65;};'use strict';var _=require(_0xc7e6('0x0'));var util=require('util');var moment=require(_0xc7e6('0x1'));var BPromise=require(_0xc7e6('0x2'));var rs=require(_0xc7e6('0x3'));var fs=require('fs');var Redis=require(_0xc7e6('0x4'));var db=require(_0xc7e6('0x5'))['db'];var utils=require(_0xc7e6('0x6'));var logger=require(_0xc7e6('0x7'))(_0xc7e6('0x8'));var config=require(_0xc7e6('0x9'));var jayson=require(_0xc7e6('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1afe08,_0xc1a884,_0x55dfef){return new BPromise(function(_0x15f1e1,_0x55ebf0){return client[_0xc7e6('0xb')](_0x1afe08,_0x55dfef)[_0xc7e6('0xc')](function(_0x537e3a){logger[_0xc7e6('0xd')](_0xc7e6('0xe'),_0xc1a884,_0xc7e6('0xf'));logger['debug'](_0xc7e6('0x10'),_0xc1a884,_0xc7e6('0xf'),JSON[_0xc7e6('0x11')](_0x537e3a));if(_0x537e3a[_0xc7e6('0x12')]){if(_0x537e3a[_0xc7e6('0x12')][_0xc7e6('0x13')]===0x1f4){logger[_0xc7e6('0x12')]('SugarcrmField,\x20%s,\x20%s',_0xc1a884,_0x537e3a['error'][_0xc7e6('0x14')]);return _0x55ebf0(_0x537e3a[_0xc7e6('0x12')]['message']);}logger[_0xc7e6('0x12')](_0xc7e6('0xe'),_0xc1a884,_0x537e3a[_0xc7e6('0x12')]['message']);return _0x15f1e1(_0x537e3a[_0xc7e6('0x12')][_0xc7e6('0x14')]);}else{logger['info'](_0xc7e6('0xe'),_0xc1a884,_0xc7e6('0xf'));_0x15f1e1(_0x537e3a[_0xc7e6('0x15')]['message']);}})[_0xc7e6('0x16')](function(_0x5d5a55){logger[_0xc7e6('0x12')]('SugarcrmField,\x20%s,\x20%s',_0xc1a884,_0x5d5a55);_0x55ebf0(_0x5d5a55);});});} \ No newline at end of file +var _0x2803=['SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','moment','ioredis','../../config/utils','rpc','client'];(function(_0x5ac5b4,_0x46d365){var _0x430ed7=function(_0x1a076b){while(--_0x1a076b){_0x5ac5b4['push'](_0x5ac5b4['shift']());}};_0x430ed7(++_0x46d365);}(_0x2803,0xda));var _0x3280=function(_0xa7561a,_0x2d6043){_0xa7561a=_0xa7561a-0x0;var _0x5c764b=_0x2803[_0xa7561a];return _0x5c764b;};'use strict';var _=require(_0x3280('0x0'));var util=require('util');var moment=require(_0x3280('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3280('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x3280('0x3'));var logger=require('../../config/logger')(_0x3280('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3280('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x9edae5,_0x544979,_0x126141){return new BPromise(function(_0x40f387,_0x40a0a7){return client['request'](_0x9edae5,_0x126141)['then'](function(_0x88f296){logger['info'](_0x3280('0x6'),_0x544979,_0x3280('0x7'));logger[_0x3280('0x8')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x544979,_0x3280('0x7'),JSON[_0x3280('0x9')](_0x88f296));if(_0x88f296[_0x3280('0xa')]){if(_0x88f296[_0x3280('0xa')][_0x3280('0xb')]===0x1f4){logger['error'](_0x3280('0x6'),_0x544979,_0x88f296[_0x3280('0xa')]['message']);return _0x40a0a7(_0x88f296[_0x3280('0xa')][_0x3280('0xc')]);}logger[_0x3280('0xa')](_0x3280('0x6'),_0x544979,_0x88f296[_0x3280('0xa')]['message']);return _0x40f387(_0x88f296[_0x3280('0xa')][_0x3280('0xc')]);}else{logger[_0x3280('0xd')]('SugarcrmField,\x20%s,\x20%s',_0x544979,'request\x20sent');_0x40f387(_0x88f296[_0x3280('0xe')][_0x3280('0xc')]);}})[_0x3280('0xf')](function(_0x427a1f){logger[_0x3280('0xa')]('SugarcrmField,\x20%s,\x20%s',_0x544979,_0x427a1f);_0x40a0a7(_0x427a1f);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 55b9938..a6806ff 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 _0xc9f5=['express','Router','fs-extra','../../config/environment','get','index','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','destroy','exports','util','path'];(function(_0x3cbb14,_0x3c95a7){var _0x2bfb35=function(_0x384c4d){while(--_0x384c4d){_0x3cbb14['push'](_0x3cbb14['shift']());}};_0x2bfb35(++_0x3c95a7);}(_0xc9f5,0xc4));var _0x5c9f=function(_0x2fff83,_0x29d5fe){_0x2fff83=_0x2fff83-0x0;var _0xa2a722=_0xc9f5[_0x2fff83];return _0xa2a722;};'use strict';var multer=require('multer');var util=require(_0x5c9f('0x0'));var path=require(_0x5c9f('0x1'));var timeout=require('connect-timeout');var express=require(_0x5c9f('0x2'));var router=express[_0x5c9f('0x3')]();var fs_extra=require(_0x5c9f('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5c9f('0x5'));var controller=require('./intVtigerAccount.controller');router[_0x5c9f('0x6')]('/',auth['isAuthenticated'](),controller[_0x5c9f('0x7')]);router[_0x5c9f('0x6')](_0x5c9f('0x8'),auth[_0x5c9f('0x9')](),controller[_0x5c9f('0xa')]);router[_0x5c9f('0x6')](_0x5c9f('0xb'),auth[_0x5c9f('0x9')](),controller[_0x5c9f('0xc')]);router[_0x5c9f('0x6')](_0x5c9f('0xd'),auth[_0x5c9f('0x9')](),controller[_0x5c9f('0xe')]);router[_0x5c9f('0xf')]('/',auth[_0x5c9f('0x9')](),controller[_0x5c9f('0x10')]);router[_0x5c9f('0xf')]('/:id/configurations',auth[_0x5c9f('0x9')](),controller[_0x5c9f('0x11')]);router[_0x5c9f('0x12')](_0x5c9f('0x8'),auth[_0x5c9f('0x9')](),controller[_0x5c9f('0x13')]);router['delete'](_0x5c9f('0x8'),auth[_0x5c9f('0x9')](),controller[_0x5c9f('0x14')]);module[_0x5c9f('0x15')]=router; \ No newline at end of file +var _0xca8d=['post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','index','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields'];(function(_0x3eeaee,_0x55727e){var _0x182ece=function(_0x402664){while(--_0x402664){_0x3eeaee['push'](_0x3eeaee['shift']());}};_0x182ece(++_0x55727e);}(_0xca8d,0x172));var _0xdca8=function(_0x4a519e,_0x5be3c4){_0x4a519e=_0x4a519e-0x0;var _0x1c7154=_0xca8d[_0x4a519e];return _0x1c7154;};'use strict';var multer=require(_0xdca8('0x0'));var util=require(_0xdca8('0x1'));var path=require(_0xdca8('0x2'));var timeout=require(_0xdca8('0x3'));var express=require(_0xdca8('0x4'));var router=express[_0xdca8('0x5')]();var fs_extra=require(_0xdca8('0x6'));var auth=require(_0xdca8('0x7'));var interaction=require(_0xdca8('0x8'));var config=require(_0xdca8('0x9'));var controller=require(_0xdca8('0xa'));router[_0xdca8('0xb')]('/',auth['isAuthenticated'](),controller[_0xdca8('0xc')]);router[_0xdca8('0xb')](_0xdca8('0xd'),auth[_0xdca8('0xe')](),controller[_0xdca8('0xf')]);router['get'](_0xdca8('0x10'),auth[_0xdca8('0xe')](),controller[_0xdca8('0x11')]);router['get'](_0xdca8('0x12'),auth[_0xdca8('0xe')](),controller[_0xdca8('0x13')]);router[_0xdca8('0x14')]('/',auth[_0xdca8('0xe')](),controller[_0xdca8('0x15')]);router[_0xdca8('0x14')](_0xdca8('0x10'),auth[_0xdca8('0xe')](),controller['addConfiguration']);router['put'](_0xdca8('0xd'),auth[_0xdca8('0xe')](),controller[_0xdca8('0x16')]);router[_0xdca8('0x17')](_0xdca8('0xd'),auth[_0xdca8('0xe')](),controller[_0xdca8('0x18')]);module[_0xdca8('0x19')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 642552e..03ec771 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 _0xe70c=['STRING','HelpDesk','exports'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xe70c,0x185));var _0xce70=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xe70c[_0x4cf98e];return _0x1623ac;};'use strict';var Sequelize=require('sequelize');module[_0xce70('0x0')]={'name':{'type':Sequelize[_0xce70('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xce70('0x1')]},'username':{'type':Sequelize[_0xce70('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0xce70('0x1')],'allowNull':![],'defaultValue':_0xce70('0x2')},'remoteUri':{'type':Sequelize[_0xce70('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xce70('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0xce70('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x4ef5=['HelpDesk','sequelize','exports','STRING'];(function(_0x4a1353,_0x2fbe86){var _0x3805cc=function(_0x39a7ee){while(--_0x39a7ee){_0x4a1353['push'](_0x4a1353['shift']());}};_0x3805cc(++_0x2fbe86);}(_0x4ef5,0x1c5));var _0x54ef=function(_0x5dd6ac,_0x30daee){_0x5dd6ac=_0x5dd6ac-0x0;var _0x398373=_0x4ef5[_0x5dd6ac];return _0x398373;};'use strict';var Sequelize=require(_0x54ef('0x0'));module[_0x54ef('0x1')]={'name':{'type':Sequelize[_0x54ef('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x54ef('0x2')]},'username':{'type':Sequelize[_0x54ef('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x54ef('0x2')],'allowNull':![],'defaultValue':_0x54ef('0x3')},'remoteUri':{'type':Sequelize[_0x54ef('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x54ef('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x54ef('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 9a4644c..88b2350 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 _0xe151=['VIRTUAL','includeAll','catch','params','options','find','create','body','getConfigurations','findOne','VtigerConfiguration','order','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','VtigerField','getFields','username','description','remoteUri','serverUrl','accessKey','moduleName','substring','lastIndexOf','format','%s/webservice.php','GET','success','POST','result','token','sessionName','autogenerated','owner','remove','includes','editable','label','cf_','picklistValues','value','log','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','undefined','limit','count','offset','Content-Range','json','apply','reject','save','update','then','sendStatus','error','stack','name','send','index','VtigerAccount','rawAttributes','key','model','map','query','keys','filters','intersection','attributes','fields','length','sort','pick','filter','where','merge','type'];(function(_0x4314d7,_0x355218){var _0x5c599b=function(_0x556354){while(--_0x556354){_0x4314d7['push'](_0x4314d7['shift']());}};_0x5c599b(++_0x355218);}(_0xe151,0xa4));var _0x1e15=function(_0x3328b4,_0x403a24){_0x3328b4=_0x3328b4-0x0;var _0x530143=_0xe151[_0x3328b4];return _0x530143;};'use strict';var emlformat=require(_0x1e15('0x0'));var rimraf=require(_0x1e15('0x1'));var zipdir=require(_0x1e15('0x2'));var jsonpatch=require(_0x1e15('0x3'));var rp=require(_0x1e15('0x4'));var moment=require('moment');var BPromise=require(_0x1e15('0x5'));var Mustache=require('mustache');var util=require(_0x1e15('0x6'));var path=require(_0x1e15('0x7'));var sox=require(_0x1e15('0x8'));var csv=require(_0x1e15('0x9'));var ejs=require(_0x1e15('0xa'));var fs=require('fs');var fs_extra=require(_0x1e15('0xb'));var _=require(_0x1e15('0xc'));var squel=require(_0x1e15('0xd'));var crypto=require(_0x1e15('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x1e15('0x9'));var querystring=require(_0x1e15('0xf'));var Papa=require(_0x1e15('0x10'));var Redis=require('ioredis');var authService=require(_0x1e15('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x1e15('0x12'));var hardwareService=require(_0x1e15('0x13'));var logger=require(_0x1e15('0x14'))(_0x1e15('0x15'));var utils=require(_0x1e15('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x1e15('0x17'));var db=require(_0x1e15('0x18'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x4e741a,_0x4136ab){_0x4136ab=_0x4136ab||0xcc;return function(_0x3a5977){if(_0x3a5977){return _0x4e741a['sendStatus'](_0x4136ab);}return _0x4e741a[_0x1e15('0x19')](_0x4136ab)[_0x1e15('0x1a')]();};}function respondWithResult(_0x5c917d,_0x1b80a7){_0x1b80a7=_0x1b80a7||0xc8;return function(_0x3f9877){if(_0x3f9877){return _0x5c917d[_0x1e15('0x19')](_0x1b80a7)['json'](_0x3f9877);}};}function respondWithFilteredResult(_0x5bcaed,_0x682abb){return function(_0xf9f8fe){if(_0xf9f8fe){var _0x37b344=typeof _0x682abb['offset']===_0x1e15('0x1b')&&typeof _0x682abb[_0x1e15('0x1c')]===_0x1e15('0x1b');var _0x30a1c6=_0xf9f8fe[_0x1e15('0x1d')];var _0x3f6536=_0x37b344?0x0:_0x682abb[_0x1e15('0x1e')];var _0x16878b=_0x37b344?_0xf9f8fe[_0x1e15('0x1d')]:_0x682abb[_0x1e15('0x1e')]+_0x682abb[_0x1e15('0x1c')];var _0x53e011;if(_0x16878b>=_0x30a1c6){_0x16878b=_0x30a1c6;_0x53e011=0xc8;}else{_0x53e011=0xce;}_0x5bcaed[_0x1e15('0x19')](_0x53e011);return _0x5bcaed['set'](_0x1e15('0x1f'),_0x3f6536+'-'+_0x16878b+'/'+_0x30a1c6)[_0x1e15('0x20')](_0xf9f8fe);}return null;};}function patchUpdates(_0x2aec53){return function(_0x183681){try{jsonpatch[_0x1e15('0x21')](_0x183681,_0x2aec53,!![]);}catch(_0x35bfbd){return BPromise[_0x1e15('0x22')](_0x35bfbd);}return _0x183681[_0x1e15('0x23')]();};}function saveUpdates(_0x2f9c7a,_0x166de7){return function(_0x336382){if(_0x336382){return _0x336382[_0x1e15('0x24')](_0x2f9c7a)[_0x1e15('0x25')](function(_0x281632){return _0x281632;});}return null;};}function removeEntity(_0x333fd2,_0x304c9e){return function(_0x352fff){if(_0x352fff){return _0x352fff['destroy']()['then'](function(){_0x333fd2['status'](0xcc)[_0x1e15('0x1a')]();});}};}function handleEntityNotFound(_0x705e0b,_0x4dd580){return function(_0x48b7fa){if(!_0x48b7fa){_0x705e0b[_0x1e15('0x26')](0x194);}return _0x48b7fa;};}function handleError(_0x3749af,_0x2391cd){_0x2391cd=_0x2391cd||0x1f4;return function(_0x3faafa){logger[_0x1e15('0x27')](_0x3faafa[_0x1e15('0x28')]);if(_0x3faafa[_0x1e15('0x29')]){delete _0x3faafa[_0x1e15('0x29')];}_0x3749af[_0x1e15('0x19')](_0x2391cd)[_0x1e15('0x2a')](_0x3faafa);};}exports[_0x1e15('0x2b')]=function(_0x21a9d1,_0x42de2e){var _0x500373={},_0x32809a={},_0x3849a7={'count':0x0,'rows':[]};var _0x4e258b=_['map'](db[_0x1e15('0x2c')][_0x1e15('0x2d')],function(_0x256f38){return{'name':_0x256f38['fieldName'],'type':_0x256f38['type'][_0x1e15('0x2e')]};});_0x32809a[_0x1e15('0x2f')]=_[_0x1e15('0x30')](_0x4e258b,_0x1e15('0x29'));_0x32809a[_0x1e15('0x31')]=_[_0x1e15('0x32')](_0x21a9d1['query']);_0x32809a[_0x1e15('0x33')]=_[_0x1e15('0x34')](_0x32809a[_0x1e15('0x2f')],_0x32809a[_0x1e15('0x31')]);_0x500373[_0x1e15('0x35')]=_[_0x1e15('0x34')](_0x32809a[_0x1e15('0x2f')],qs['fields'](_0x21a9d1[_0x1e15('0x31')][_0x1e15('0x36')]));_0x500373[_0x1e15('0x35')]=_0x500373['attributes'][_0x1e15('0x37')]?_0x500373[_0x1e15('0x35')]:_0x32809a[_0x1e15('0x2f')];if(!_0x21a9d1[_0x1e15('0x31')]['hasOwnProperty']('nolimit')){_0x500373['limit']=qs[_0x1e15('0x1c')](_0x21a9d1[_0x1e15('0x31')][_0x1e15('0x1c')]);_0x500373['offset']=qs['offset'](_0x21a9d1[_0x1e15('0x31')][_0x1e15('0x1e')]);}_0x500373['order']=qs[_0x1e15('0x38')](_0x21a9d1['query']['sort']);_0x500373['where']=qs[_0x1e15('0x33')](_[_0x1e15('0x39')](_0x21a9d1[_0x1e15('0x31')],_0x32809a[_0x1e15('0x33')]),_0x4e258b);if(_0x21a9d1['query'][_0x1e15('0x3a')]){_0x500373[_0x1e15('0x3b')]=_[_0x1e15('0x3c')](_0x500373['where'],{'$or':_[_0x1e15('0x30')](_0x4e258b,function(_0x7e40b3){if(_0x7e40b3[_0x1e15('0x3d')]!==_0x1e15('0x3e')){var _0x3805f6={};_0x3805f6[_0x7e40b3[_0x1e15('0x29')]]={'$like':'%'+_0x21a9d1[_0x1e15('0x31')]['filter']+'%'};return _0x3805f6;}})});}_0x500373=_[_0x1e15('0x3c')]({},_0x500373,_0x21a9d1['options']);var _0x305d5f={'where':_0x500373['where']};return db[_0x1e15('0x2c')]['count'](_0x305d5f)['then'](function(_0x6fe074){_0x3849a7[_0x1e15('0x1d')]=_0x6fe074;if(_0x21a9d1[_0x1e15('0x31')][_0x1e15('0x3f')]){_0x500373['include']=[{'all':!![]}];}return db[_0x1e15('0x2c')]['findAll'](_0x500373);})[_0x1e15('0x25')](function(_0x1135b6){_0x3849a7['rows']=_0x1135b6;return _0x3849a7;})[_0x1e15('0x25')](respondWithFilteredResult(_0x42de2e,_0x500373))[_0x1e15('0x40')](handleError(_0x42de2e,null));};exports['show']=function(_0x587233,_0x179a96){var _0x55d4e8={'raw':![],'where':{'id':_0x587233[_0x1e15('0x41')]['id']}},_0x2ce35a={};_0x2ce35a[_0x1e15('0x2f')]=_['keys'](db[_0x1e15('0x2c')]['rawAttributes']);_0x2ce35a['query']=_[_0x1e15('0x32')](_0x587233['query']);_0x2ce35a[_0x1e15('0x33')]=_[_0x1e15('0x34')](_0x2ce35a[_0x1e15('0x2f')],_0x2ce35a[_0x1e15('0x31')]);_0x55d4e8[_0x1e15('0x35')]=_[_0x1e15('0x34')](_0x2ce35a[_0x1e15('0x2f')],qs[_0x1e15('0x36')](_0x587233[_0x1e15('0x31')][_0x1e15('0x36')]));_0x55d4e8[_0x1e15('0x35')]=_0x55d4e8[_0x1e15('0x35')][_0x1e15('0x37')]?_0x55d4e8[_0x1e15('0x35')]:_0x2ce35a[_0x1e15('0x2f')];if(_0x587233['query'][_0x1e15('0x3f')]){_0x55d4e8['include']=[{'all':!![]}];}_0x55d4e8=_[_0x1e15('0x3c')]({},_0x55d4e8,_0x587233[_0x1e15('0x42')]);return db['VtigerAccount'][_0x1e15('0x43')](_0x55d4e8)[_0x1e15('0x25')](handleEntityNotFound(_0x179a96,null))['then'](respondWithResult(_0x179a96,null))[_0x1e15('0x40')](handleError(_0x179a96,null));};exports[_0x1e15('0x44')]=function(_0x32844b,_0x3c99fb){return db[_0x1e15('0x2c')][_0x1e15('0x44')](_0x32844b['body'],{})[_0x1e15('0x25')](respondWithResult(_0x3c99fb,0xc9))[_0x1e15('0x40')](handleError(_0x3c99fb,null));};exports[_0x1e15('0x24')]=function(_0x42524a,_0x3482fd){if(_0x42524a[_0x1e15('0x45')]['id']){delete _0x42524a[_0x1e15('0x45')]['id'];}return db['VtigerAccount'][_0x1e15('0x43')]({'where':{'id':_0x42524a[_0x1e15('0x41')]['id']}})['then'](handleEntityNotFound(_0x3482fd,null))[_0x1e15('0x25')](saveUpdates(_0x42524a[_0x1e15('0x45')],null))[_0x1e15('0x25')](respondWithResult(_0x3482fd,null))[_0x1e15('0x40')](handleError(_0x3482fd,null));};exports['destroy']=function(_0x2899c9,_0x46d045){return db[_0x1e15('0x2c')]['find']({'where':{'id':_0x2899c9['params']['id']}})['then'](handleEntityNotFound(_0x46d045,null))[_0x1e15('0x25')](removeEntity(_0x46d045,null))['catch'](handleError(_0x46d045,null));};exports[_0x1e15('0x46')]=function(_0x42ab92,_0x181bbd,_0x2a26e1){var _0x591bf7={};var _0x830b80={};var _0x51837d;var _0x5ea9ab;return db[_0x1e15('0x2c')][_0x1e15('0x47')]({'where':{'id':_0x42ab92[_0x1e15('0x41')]['id']}})[_0x1e15('0x25')](handleEntityNotFound(_0x181bbd,null))[_0x1e15('0x25')](function(_0x2799bb){if(_0x2799bb){_0x51837d=_0x2799bb;_0x830b80[_0x1e15('0x2f')]=_[_0x1e15('0x32')](db[_0x1e15('0x48')][_0x1e15('0x2d')]);_0x830b80[_0x1e15('0x31')]=_[_0x1e15('0x32')](_0x42ab92[_0x1e15('0x31')]);_0x830b80[_0x1e15('0x33')]=_['intersection'](_0x830b80['model'],_0x830b80[_0x1e15('0x31')]);_0x591bf7[_0x1e15('0x35')]=_[_0x1e15('0x34')](_0x830b80['model'],qs['fields'](_0x42ab92[_0x1e15('0x31')][_0x1e15('0x36')]));_0x591bf7['attributes']=_0x591bf7[_0x1e15('0x35')][_0x1e15('0x37')]?_0x591bf7['attributes']:_0x830b80[_0x1e15('0x2f')];_0x591bf7[_0x1e15('0x49')]=qs[_0x1e15('0x38')](_0x42ab92[_0x1e15('0x31')][_0x1e15('0x38')]);_0x591bf7[_0x1e15('0x3b')]=qs[_0x1e15('0x33')](_[_0x1e15('0x39')](_0x42ab92['query'],_0x830b80[_0x1e15('0x33')]));if(_0x42ab92[_0x1e15('0x31')][_0x1e15('0x3a')]){_0x591bf7[_0x1e15('0x3b')]=_[_0x1e15('0x3c')](_0x591bf7[_0x1e15('0x3b')],{'$or':_['map'](_0x591bf7['attributes'],function(_0x365007){var _0x3e6341={};_0x3e6341[_0x365007]={'$like':'%'+_0x42ab92['query'][_0x1e15('0x3a')]+'%'};return _0x3e6341;})});}_0x591bf7=_[_0x1e15('0x3c')]({},_0x591bf7,_0x42ab92[_0x1e15('0x42')]);return _0x51837d[_0x1e15('0x46')](_0x591bf7);}})[_0x1e15('0x25')](function(_0x302178){if(_0x302178){_0x5ea9ab=_0x302178[_0x1e15('0x37')];if(!_0x42ab92[_0x1e15('0x31')][_0x1e15('0x4a')]('nolimit')){_0x591bf7[_0x1e15('0x1c')]=qs['limit'](_0x42ab92[_0x1e15('0x31')]['limit']);_0x591bf7[_0x1e15('0x1e')]=qs[_0x1e15('0x1e')](_0x42ab92[_0x1e15('0x31')][_0x1e15('0x1e')]);}return _0x51837d['getConfigurations'](_0x591bf7);}})[_0x1e15('0x25')](function(_0x252b2a){if(_0x252b2a){return _0x252b2a?{'count':_0x5ea9ab,'rows':_0x252b2a}:null;}})[_0x1e15('0x25')](respondWithResult(_0x181bbd,null))[_0x1e15('0x40')](handleError(_0x181bbd,null));};exports[_0x1e15('0x4b')]=function(_0x25048d,_0x2da58e,_0x804253){if(_0x25048d['body']['id']){delete _0x25048d[_0x1e15('0x45')]['id'];}return db[_0x1e15('0x2c')][_0x1e15('0x47')]({'where':{'id':_0x25048d['params']['id']}})[_0x1e15('0x25')](handleEntityNotFound(_0x2da58e,null))['then'](function(_0x4e06e9){if(_0x4e06e9){_0x25048d['body'][_0x1e15('0x4c')]=_0x4e06e9['id'];_0x25048d[_0x1e15('0x45')][_0x1e15('0x4d')]=integrations[_0x1e15('0x4e')](_0x25048d[_0x1e15('0x45')][_0x1e15('0x4f')],_0x25048d[_0x1e15('0x45')][_0x1e15('0x3d')]);_0x25048d['body'][_0x1e15('0x50')]=integrations[_0x1e15('0x51')](_0x25048d[_0x1e15('0x45')][_0x1e15('0x4f')],_0x25048d[_0x1e15('0x45')][_0x1e15('0x3d')]);return db[_0x1e15('0x48')]['create'](_0x25048d[_0x1e15('0x45')],{'include':[{'model':db[_0x1e15('0x52')],'as':'Subjects'},{'model':db[_0x1e15('0x52')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x2da58e,null))[_0x1e15('0x40')](handleError(_0x2da58e,null));};var md5=require('md5');exports[_0x1e15('0x53')]=function(_0x5542cf,_0x2048cd,_0x172eec){var _0x4cf930=null;var _0x274715=null;var _0x34ea58=null;var _0x426664=null;var _0x48fe31='';return db[_0x1e15('0x2c')]['findOne']({'where':{'id':_0x5542cf[_0x1e15('0x41')]['id']},'attributes':['id',_0x1e15('0x29'),_0x1e15('0x54'),_0x1e15('0x55'),'moduleName',_0x1e15('0x56'),_0x1e15('0x57'),_0x1e15('0x58')]})[_0x1e15('0x25')](handleEntityNotFound(_0x2048cd,null))[_0x1e15('0x25')](function(_0x2fc73c){if(_0x2fc73c){_0x4cf930=_0x2fc73c[_0x1e15('0x54')];_0x274715=_0x2fc73c[_0x1e15('0x58')];_0x34ea58=_0x2fc73c[_0x1e15('0x59')];_0x48fe31=_0x2fc73c['remoteUri'];var _0x56b569=_0x48fe31['slice'](-0x1);if(_0x56b569==='/'){_0x48fe31=_0x48fe31[_0x1e15('0x5a')](0x0,_0x48fe31[_0x1e15('0x5b')](_0x56b569));}_0x426664=util[_0x1e15('0x5c')](_0x1e15('0x5d'),_0x48fe31);var _0x2b6281={'method':_0x1e15('0x5e'),'uri':_0x426664,'qs':{'operation':'getchallenge','username':_0x2fc73c[_0x1e15('0x54')]},'json':!![]};return rp(_0x2b6281);}})['then'](function(_0xfb29bf){if(_0xfb29bf[_0x1e15('0x5f')]){var _0x16153f={'method':_0x1e15('0x60'),'uri':_0x426664,'form':{'operation':'login','username':_0x4cf930,'accessKey':md5(_0xfb29bf[_0x1e15('0x61')][_0x1e15('0x62')]+_0x274715)},'json':!![]};return rp(_0x16153f);}})[_0x1e15('0x25')](function(_0x5740d4){if(_0x5740d4[_0x1e15('0x5f')]){var _0x386b89={'method':_0x1e15('0x5e'),'uri':_0x426664,'qs':{'operation':'describe','username':_0x4cf930,'sessionName':_0x5740d4[_0x1e15('0x61')][_0x1e15('0x63')],'elementType':_0x34ea58},'json':!![]};return rp(_0x386b89);}})[_0x1e15('0x25')](function(_0x1782ef){if(_0x1782ef[_0x1e15('0x5f')]){var _0xc45d9e=[_0x1e15('0x64'),'reference',_0x1e15('0x65')];_[_0x1e15('0x66')](_0x1782ef[_0x1e15('0x61')][_0x1e15('0x36')],function(_0x6993db){return _0xc45d9e[_0x1e15('0x67')](_0x6993db[_0x1e15('0x3d')][_0x1e15('0x29')]);});_[_0x1e15('0x66')](_0x1782ef[_0x1e15('0x61')]['fields'],function(_0x5c38a6){return _0x5c38a6[_0x1e15('0x68')]==='false';});return{'count':_0x1782ef[_0x1e15('0x61')][_0x1e15('0x36')][_0x1e15('0x37')],'rows':_[_0x1e15('0x30')](_0x1782ef[_0x1e15('0x61')][_0x1e15('0x36')],function(_0x4b5781){return{'id':_0x4b5781[_0x1e15('0x29')],'name':_0x4b5781[_0x1e15('0x69')],'custom':_['startsWith'](_0x4b5781[_0x1e15('0x29')],_0x1e15('0x6a'))?!![]:![],'options':_0x4b5781[_0x1e15('0x3d')][_0x1e15('0x29')]==='picklist'&&_0x4b5781['type'][_0x1e15('0x6b')][_0x1e15('0x37')]>0x0?_['map'](_0x4b5781[_0x1e15('0x3d')][_0x1e15('0x6b')],function(_0x45b14c){return{'name':_0x45b14c[_0x1e15('0x69')],'value':_0x45b14c[_0x1e15('0x6c')]};}):[]};})};}})[_0x1e15('0x25')](respondWithResult(_0x2048cd,null))[_0x1e15('0x40')](function(_0x6334c3){console[_0x1e15('0x6d')]('vTiger\x20error:\x20'+_0x6334c3);var _0x141162=_0x5542cf[_0x1e15('0x31')][_0x1e15('0x6e')]?0x1f4:_0x6334c3['statusCode']||0x1f4;logger['error'](_0x1e15('0x6f'),'getFields',_0x141162,JSON['stringify'](_0x6334c3));delete _0x6334c3[_0x1e15('0x29')];if(_0x141162===0x191){_0x141162=0x190;}_0x2048cd[_0x1e15('0x19')](_0x141162)[_0x1e15('0x2a')](_0x5542cf[_0x1e15('0x31')][_0x1e15('0x6e')]?{'message':_0x1e15('0x70'),'statusCode':_0x6334c3['statusCode']}:_0x6334c3);});}; \ No newline at end of file +var _0x13df=['../../components/integrations/configuration','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','reject','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','options','includeAll','VtigerAccount','catch','show','find','create','body','params','VtigerConfiguration','getConfigurations','addConfiguration','findOne','channel','Descriptions','getDescriptions','Subjects','VtigerField','md5','getFields','description','moduleName','remoteUri','serverUrl','username','accessKey','slice','lastIndexOf','GET','getchallenge','success','POST','login','result','token','describe','sessionName','reference','remove','includes','false','label','startsWith','cf_','picklist','picklistValues','log','vTiger\x20error:\x20','test','error','stringify','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','moment','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x1759d7,_0x19341f){var _0x535444=function(_0x57fb62){while(--_0x57fb62){_0x1759d7['push'](_0x1759d7['shift']());}};_0x535444(++_0x19341f);}(_0x13df,0xce));var _0xf13d=function(_0x3e292a,_0x5b8146){_0x3e292a=_0x3e292a-0x0;var _0x1703c4=_0x13df[_0x3e292a];return _0x1703c4;};'use strict';var emlformat=require(_0xf13d('0x0'));var rimraf=require(_0xf13d('0x1'));var zipdir=require(_0xf13d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf13d('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf13d('0x4'));var path=require(_0xf13d('0x5'));var sox=require(_0xf13d('0x6'));var csv=require('to-csv');var ejs=require(_0xf13d('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf13d('0x8'));var squel=require('squel');var crypto=require(_0xf13d('0x9'));var jsforce=require(_0xf13d('0xa'));var deskjs=require(_0xf13d('0xb'));var toCsv=require(_0xf13d('0xc'));var querystring=require(_0xf13d('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf13d('0xe'));var qs=require(_0xf13d('0xf'));var as=require(_0xf13d('0x10'));var hardwareService=require(_0xf13d('0x11'));var logger=require(_0xf13d('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xf13d('0x13'));var licenseUtil=require(_0xf13d('0x14'));var db=require(_0xf13d('0x15'))['db'];var integrations=require(_0xf13d('0x16'));function respondWithStatusCode(_0x3dbf6a,_0x41ef57){_0x41ef57=_0x41ef57||0xcc;return function(_0xe6132c){if(_0xe6132c){return _0x3dbf6a[_0xf13d('0x17')](_0x41ef57);}return _0x3dbf6a[_0xf13d('0x18')](_0x41ef57)[_0xf13d('0x19')]();};}function respondWithResult(_0x2b7244,_0x153587){_0x153587=_0x153587||0xc8;return function(_0x2f1d43){if(_0x2f1d43){return _0x2b7244[_0xf13d('0x18')](_0x153587)['json'](_0x2f1d43);}};}function respondWithFilteredResult(_0x24b870,_0x37a6f9){return function(_0x54e04b){if(_0x54e04b){var _0x11bc13=typeof _0x37a6f9['offset']===_0xf13d('0x1a')&&typeof _0x37a6f9[_0xf13d('0x1b')]===_0xf13d('0x1a');var _0x52b0d0=_0x54e04b[_0xf13d('0x1c')];var _0xfc5827=_0x11bc13?0x0:_0x37a6f9['offset'];var _0x54dc0c=_0x11bc13?_0x54e04b[_0xf13d('0x1c')]:_0x37a6f9[_0xf13d('0x1d')]+_0x37a6f9['limit'];var _0x3f76ba;if(_0x54dc0c>=_0x52b0d0){_0x54dc0c=_0x52b0d0;_0x3f76ba=0xc8;}else{_0x3f76ba=0xce;}_0x24b870[_0xf13d('0x18')](_0x3f76ba);return _0x24b870[_0xf13d('0x1e')](_0xf13d('0x1f'),_0xfc5827+'-'+_0x54dc0c+'/'+_0x52b0d0)[_0xf13d('0x20')](_0x54e04b);}return null;};}function patchUpdates(_0x234874){return function(_0x305a78){try{jsonpatch['apply'](_0x305a78,_0x234874,!![]);}catch(_0x545898){return BPromise[_0xf13d('0x21')](_0x545898);}return _0x305a78['save']();};}function saveUpdates(_0x4be5df,_0x1e7300){return function(_0x5d0043){if(_0x5d0043){return _0x5d0043[_0xf13d('0x22')](_0x4be5df)[_0xf13d('0x23')](function(_0x1ff445){return _0x1ff445;});}return null;};}function removeEntity(_0x596061,_0x2e070a){return function(_0xa7d883){if(_0xa7d883){return _0xa7d883[_0xf13d('0x24')]()[_0xf13d('0x23')](function(){_0x596061[_0xf13d('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x95fc7e,_0x10caea){return function(_0x364817){if(!_0x364817){_0x95fc7e[_0xf13d('0x17')](0x194);}return _0x364817;};}function handleError(_0x1c3c79,_0x1c975b){_0x1c975b=_0x1c975b||0x1f4;return function(_0x500acb){logger['error'](_0x500acb[_0xf13d('0x25')]);if(_0x500acb[_0xf13d('0x26')]){delete _0x500acb[_0xf13d('0x26')];}_0x1c3c79[_0xf13d('0x18')](_0x1c975b)[_0xf13d('0x27')](_0x500acb);};}exports[_0xf13d('0x28')]=function(_0x5309d6,_0x48700b){var _0x1414e2={},_0x18c352={},_0xdbb923={'count':0x0,'rows':[]};var _0x2c05fe=_[_0xf13d('0x29')](db['VtigerAccount'][_0xf13d('0x2a')],function(_0x1af3c6){return{'name':_0x1af3c6[_0xf13d('0x2b')],'type':_0x1af3c6[_0xf13d('0x2c')]['key']};});_0x18c352[_0xf13d('0x2d')]=_[_0xf13d('0x29')](_0x2c05fe,_0xf13d('0x26'));_0x18c352[_0xf13d('0x2e')]=_[_0xf13d('0x2f')](_0x5309d6['query']);_0x18c352['filters']=_[_0xf13d('0x30')](_0x18c352[_0xf13d('0x2d')],_0x18c352[_0xf13d('0x2e')]);_0x1414e2[_0xf13d('0x31')]=_[_0xf13d('0x30')](_0x18c352[_0xf13d('0x2d')],qs[_0xf13d('0x32')](_0x5309d6[_0xf13d('0x2e')][_0xf13d('0x32')]));_0x1414e2[_0xf13d('0x31')]=_0x1414e2[_0xf13d('0x31')][_0xf13d('0x33')]?_0x1414e2[_0xf13d('0x31')]:_0x18c352[_0xf13d('0x2d')];if(!_0x5309d6[_0xf13d('0x2e')][_0xf13d('0x34')](_0xf13d('0x35'))){_0x1414e2[_0xf13d('0x1b')]=qs[_0xf13d('0x1b')](_0x5309d6[_0xf13d('0x2e')][_0xf13d('0x1b')]);_0x1414e2[_0xf13d('0x1d')]=qs[_0xf13d('0x1d')](_0x5309d6[_0xf13d('0x2e')][_0xf13d('0x1d')]);}_0x1414e2[_0xf13d('0x36')]=qs[_0xf13d('0x37')](_0x5309d6[_0xf13d('0x2e')]['sort']);_0x1414e2['where']=qs[_0xf13d('0x38')](_['pick'](_0x5309d6[_0xf13d('0x2e')],_0x18c352[_0xf13d('0x38')]),_0x2c05fe);if(_0x5309d6[_0xf13d('0x2e')][_0xf13d('0x39')]){_0x1414e2[_0xf13d('0x3a')]=_[_0xf13d('0x3b')](_0x1414e2[_0xf13d('0x3a')],{'$or':_[_0xf13d('0x29')](_0x2c05fe,function(_0x44f89d){if(_0x44f89d['type']!==_0xf13d('0x3c')){var _0x27ad06={};_0x27ad06[_0x44f89d[_0xf13d('0x26')]]={'$like':'%'+_0x5309d6[_0xf13d('0x2e')][_0xf13d('0x39')]+'%'};return _0x27ad06;}})});}_0x1414e2=_[_0xf13d('0x3b')]({},_0x1414e2,_0x5309d6[_0xf13d('0x3d')]);var _0x2d7cd7={'where':_0x1414e2[_0xf13d('0x3a')]};return db['VtigerAccount'][_0xf13d('0x1c')](_0x2d7cd7)[_0xf13d('0x23')](function(_0x421fda){_0xdbb923[_0xf13d('0x1c')]=_0x421fda;if(_0x5309d6[_0xf13d('0x2e')][_0xf13d('0x3e')]){_0x1414e2['include']=[{'all':!![]}];}return db[_0xf13d('0x3f')]['findAll'](_0x1414e2);})[_0xf13d('0x23')](function(_0x1cc2a3){_0xdbb923['rows']=_0x1cc2a3;return _0xdbb923;})[_0xf13d('0x23')](respondWithFilteredResult(_0x48700b,_0x1414e2))[_0xf13d('0x40')](handleError(_0x48700b,null));};exports[_0xf13d('0x41')]=function(_0xf9aa52,_0x5a9c27){var _0x444dc6={'raw':![],'where':{'id':_0xf9aa52['params']['id']}},_0x3d64f8={};_0x3d64f8[_0xf13d('0x2d')]=_[_0xf13d('0x2f')](db['VtigerAccount'][_0xf13d('0x2a')]);_0x3d64f8[_0xf13d('0x2e')]=_[_0xf13d('0x2f')](_0xf9aa52['query']);_0x3d64f8[_0xf13d('0x38')]=_[_0xf13d('0x30')](_0x3d64f8[_0xf13d('0x2d')],_0x3d64f8[_0xf13d('0x2e')]);_0x444dc6[_0xf13d('0x31')]=_['intersection'](_0x3d64f8[_0xf13d('0x2d')],qs['fields'](_0xf9aa52[_0xf13d('0x2e')][_0xf13d('0x32')]));_0x444dc6[_0xf13d('0x31')]=_0x444dc6['attributes'][_0xf13d('0x33')]?_0x444dc6[_0xf13d('0x31')]:_0x3d64f8[_0xf13d('0x2d')];if(_0xf9aa52[_0xf13d('0x2e')][_0xf13d('0x3e')]){_0x444dc6['include']=[{'all':!![]}];}_0x444dc6=_[_0xf13d('0x3b')]({},_0x444dc6,_0xf9aa52[_0xf13d('0x3d')]);return db[_0xf13d('0x3f')][_0xf13d('0x42')](_0x444dc6)[_0xf13d('0x23')](handleEntityNotFound(_0x5a9c27,null))[_0xf13d('0x23')](respondWithResult(_0x5a9c27,null))[_0xf13d('0x40')](handleError(_0x5a9c27,null));};exports[_0xf13d('0x43')]=function(_0x3fad2c,_0x113f65){return db['VtigerAccount'][_0xf13d('0x43')](_0x3fad2c[_0xf13d('0x44')],{})[_0xf13d('0x23')](respondWithResult(_0x113f65,0xc9))[_0xf13d('0x40')](handleError(_0x113f65,null));};exports[_0xf13d('0x22')]=function(_0x55d840,_0x1415a8){if(_0x55d840[_0xf13d('0x44')]['id']){delete _0x55d840[_0xf13d('0x44')]['id'];}return db[_0xf13d('0x3f')][_0xf13d('0x42')]({'where':{'id':_0x55d840[_0xf13d('0x45')]['id']}})['then'](handleEntityNotFound(_0x1415a8,null))[_0xf13d('0x23')](saveUpdates(_0x55d840[_0xf13d('0x44')],null))[_0xf13d('0x23')](respondWithResult(_0x1415a8,null))[_0xf13d('0x40')](handleError(_0x1415a8,null));};exports[_0xf13d('0x24')]=function(_0x545d28,_0x2355c3){return db[_0xf13d('0x3f')][_0xf13d('0x42')]({'where':{'id':_0x545d28['params']['id']}})['then'](handleEntityNotFound(_0x2355c3,null))[_0xf13d('0x23')](removeEntity(_0x2355c3,null))['catch'](handleError(_0x2355c3,null));};exports['getConfigurations']=function(_0xdddf37,_0x3339d5,_0x15b991){var _0x2bef4e={};var _0x459969={};var _0x5c00f0;var _0x581965;return db[_0xf13d('0x3f')]['findOne']({'where':{'id':_0xdddf37['params']['id']}})['then'](handleEntityNotFound(_0x3339d5,null))[_0xf13d('0x23')](function(_0x189f91){if(_0x189f91){_0x5c00f0=_0x189f91;_0x459969[_0xf13d('0x2d')]=_[_0xf13d('0x2f')](db[_0xf13d('0x46')][_0xf13d('0x2a')]);_0x459969[_0xf13d('0x2e')]=_[_0xf13d('0x2f')](_0xdddf37[_0xf13d('0x2e')]);_0x459969[_0xf13d('0x38')]=_[_0xf13d('0x30')](_0x459969[_0xf13d('0x2d')],_0x459969[_0xf13d('0x2e')]);_0x2bef4e[_0xf13d('0x31')]=_[_0xf13d('0x30')](_0x459969[_0xf13d('0x2d')],qs[_0xf13d('0x32')](_0xdddf37[_0xf13d('0x2e')]['fields']));_0x2bef4e[_0xf13d('0x31')]=_0x2bef4e['attributes']['length']?_0x2bef4e[_0xf13d('0x31')]:_0x459969[_0xf13d('0x2d')];_0x2bef4e[_0xf13d('0x36')]=qs['sort'](_0xdddf37[_0xf13d('0x2e')][_0xf13d('0x37')]);_0x2bef4e[_0xf13d('0x3a')]=qs['filters'](_['pick'](_0xdddf37[_0xf13d('0x2e')],_0x459969[_0xf13d('0x38')]));if(_0xdddf37['query'][_0xf13d('0x39')]){_0x2bef4e[_0xf13d('0x3a')]=_[_0xf13d('0x3b')](_0x2bef4e[_0xf13d('0x3a')],{'$or':_[_0xf13d('0x29')](_0x2bef4e[_0xf13d('0x31')],function(_0x1d9762){var _0x387b1d={};_0x387b1d[_0x1d9762]={'$like':'%'+_0xdddf37[_0xf13d('0x2e')][_0xf13d('0x39')]+'%'};return _0x387b1d;})});}_0x2bef4e=_['merge']({},_0x2bef4e,_0xdddf37['options']);return _0x5c00f0[_0xf13d('0x47')](_0x2bef4e);}})[_0xf13d('0x23')](function(_0x454fb2){if(_0x454fb2){_0x581965=_0x454fb2['length'];if(!_0xdddf37['query'][_0xf13d('0x34')]('nolimit')){_0x2bef4e['limit']=qs['limit'](_0xdddf37[_0xf13d('0x2e')][_0xf13d('0x1b')]);_0x2bef4e[_0xf13d('0x1d')]=qs[_0xf13d('0x1d')](_0xdddf37[_0xf13d('0x2e')]['offset']);}return _0x5c00f0[_0xf13d('0x47')](_0x2bef4e);}})[_0xf13d('0x23')](function(_0x3b1f10){if(_0x3b1f10){return _0x3b1f10?{'count':_0x581965,'rows':_0x3b1f10}:null;}})[_0xf13d('0x23')](respondWithResult(_0x3339d5,null))[_0xf13d('0x40')](handleError(_0x3339d5,null));};exports[_0xf13d('0x48')]=function(_0x1b93a4,_0x4b6fc4,_0xffdcf8){if(_0x1b93a4['body']['id']){delete _0x1b93a4[_0xf13d('0x44')]['id'];}return db[_0xf13d('0x3f')][_0xf13d('0x49')]({'where':{'id':_0x1b93a4['params']['id']}})['then'](handleEntityNotFound(_0x4b6fc4,null))[_0xf13d('0x23')](function(_0x2d9f12){if(_0x2d9f12){_0x1b93a4[_0xf13d('0x44')]['AccountId']=_0x2d9f12['id'];_0x1b93a4['body']['Subjects']=integrations['getSubjects'](_0x1b93a4[_0xf13d('0x44')][_0xf13d('0x4a')],_0x1b93a4[_0xf13d('0x44')][_0xf13d('0x2c')]);_0x1b93a4[_0xf13d('0x44')][_0xf13d('0x4b')]=integrations[_0xf13d('0x4c')](_0x1b93a4['body'][_0xf13d('0x4a')],_0x1b93a4[_0xf13d('0x44')]['type']);return db[_0xf13d('0x46')][_0xf13d('0x43')](_0x1b93a4[_0xf13d('0x44')],{'include':[{'model':db['VtigerField'],'as':_0xf13d('0x4d')},{'model':db[_0xf13d('0x4e')],'as':_0xf13d('0x4b')}]});}return null;})[_0xf13d('0x23')](respondWithResult(_0x4b6fc4,null))[_0xf13d('0x40')](handleError(_0x4b6fc4,null));};var md5=require(_0xf13d('0x4f'));exports[_0xf13d('0x50')]=function(_0x364dfd,_0x437721,_0x106312){var _0x1ed471=null;var _0x4b8102=null;var _0x3924ed=null;var _0xb6c8ca=null;var _0x5a380a='';return db[_0xf13d('0x3f')][_0xf13d('0x49')]({'where':{'id':_0x364dfd[_0xf13d('0x45')]['id']},'attributes':['id',_0xf13d('0x26'),'username',_0xf13d('0x51'),_0xf13d('0x52'),_0xf13d('0x53'),_0xf13d('0x54'),'accessKey']})[_0xf13d('0x23')](handleEntityNotFound(_0x437721,null))['then'](function(_0x231a3e){if(_0x231a3e){_0x1ed471=_0x231a3e[_0xf13d('0x55')];_0x4b8102=_0x231a3e[_0xf13d('0x56')];_0x3924ed=_0x231a3e[_0xf13d('0x52')];_0x5a380a=_0x231a3e[_0xf13d('0x53')];var _0x109fe9=_0x5a380a[_0xf13d('0x57')](-0x1);if(_0x109fe9==='/'){_0x5a380a=_0x5a380a['substring'](0x0,_0x5a380a[_0xf13d('0x58')](_0x109fe9));}_0xb6c8ca=util['format']('%s/webservice.php',_0x5a380a);var _0xebe7ce={'method':_0xf13d('0x59'),'uri':_0xb6c8ca,'qs':{'operation':_0xf13d('0x5a'),'username':_0x231a3e[_0xf13d('0x55')]},'json':!![]};return rp(_0xebe7ce);}})[_0xf13d('0x23')](function(_0x1cc249){if(_0x1cc249[_0xf13d('0x5b')]){var _0x7cb8e9={'method':_0xf13d('0x5c'),'uri':_0xb6c8ca,'form':{'operation':_0xf13d('0x5d'),'username':_0x1ed471,'accessKey':md5(_0x1cc249[_0xf13d('0x5e')][_0xf13d('0x5f')]+_0x4b8102)},'json':!![]};return rp(_0x7cb8e9);}})[_0xf13d('0x23')](function(_0x3f90c8){if(_0x3f90c8[_0xf13d('0x5b')]){var _0x4a3029={'method':_0xf13d('0x59'),'uri':_0xb6c8ca,'qs':{'operation':_0xf13d('0x60'),'username':_0x1ed471,'sessionName':_0x3f90c8[_0xf13d('0x5e')][_0xf13d('0x61')],'elementType':_0x3924ed},'json':!![]};return rp(_0x4a3029);}})[_0xf13d('0x23')](function(_0x37b3f9){if(_0x37b3f9[_0xf13d('0x5b')]){var _0x55b306=['autogenerated',_0xf13d('0x62'),'owner'];_[_0xf13d('0x63')](_0x37b3f9[_0xf13d('0x5e')][_0xf13d('0x32')],function(_0x252fcb){return _0x55b306[_0xf13d('0x64')](_0x252fcb[_0xf13d('0x2c')][_0xf13d('0x26')]);});_[_0xf13d('0x63')](_0x37b3f9[_0xf13d('0x5e')]['fields'],function(_0x234e76){return _0x234e76['editable']===_0xf13d('0x65');});return{'count':_0x37b3f9[_0xf13d('0x5e')][_0xf13d('0x32')][_0xf13d('0x33')],'rows':_['map'](_0x37b3f9[_0xf13d('0x5e')][_0xf13d('0x32')],function(_0x4487cd){return{'id':_0x4487cd['name'],'name':_0x4487cd[_0xf13d('0x66')],'custom':_[_0xf13d('0x67')](_0x4487cd[_0xf13d('0x26')],_0xf13d('0x68'))?!![]:![],'options':_0x4487cd[_0xf13d('0x2c')][_0xf13d('0x26')]===_0xf13d('0x69')&&_0x4487cd['type'][_0xf13d('0x6a')][_0xf13d('0x33')]>0x0?_['map'](_0x4487cd[_0xf13d('0x2c')][_0xf13d('0x6a')],function(_0x50fe8c){return{'name':_0x50fe8c[_0xf13d('0x66')],'value':_0x50fe8c['value']};}):[]};})};}})[_0xf13d('0x23')](respondWithResult(_0x437721,null))[_0xf13d('0x40')](function(_0x22bf87){console[_0xf13d('0x6b')](_0xf13d('0x6c')+_0x22bf87);var _0x590456=_0x364dfd[_0xf13d('0x2e')][_0xf13d('0x6d')]?0x1f4:_0x22bf87['statusCode']||0x1f4;logger[_0xf13d('0x6e')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x590456,JSON[_0xf13d('0x6f')](_0x22bf87));delete _0x22bf87[_0xf13d('0x26')];if(_0x590456===0x191){_0x590456=0x190;}_0x437721[_0xf13d('0x18')](_0x590456)[_0xf13d('0x27')](_0x364dfd['query'][_0xf13d('0x6d')]?{'message':_0xf13d('0x70'),'statusCode':_0x22bf87[_0xf13d('0x71')]}:_0x22bf87);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 3e41682..f6878f8 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 _0x23ba=['VtigerAccount','int_vtiger_accounts','util','api','moment','bluebird','path','../../components/integrations/configuration','exports','define'];(function(_0x3de72c,_0x287f51){var _0x4fb162=function(_0x47ef92){while(--_0x47ef92){_0x3de72c['push'](_0x3de72c['shift']());}};_0x4fb162(++_0x287f51);}(_0x23ba,0x66));var _0xa23b=function(_0x5be796,_0x4dd53a){_0x5be796=_0x5be796-0x0;var _0x4e8837=_0x23ba[_0x5be796];return _0x4e8837;};'use strict';var _=require('lodash');var util=require(_0xa23b('0x0'));var logger=require('../../config/logger')(_0xa23b('0x1'));var moment=require(_0xa23b('0x2'));var BPromise=require(_0xa23b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa23b('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0xa23b('0x5'));module[_0xa23b('0x6')]=function(_0x2c06a8,_0x899e48){return _0x2c06a8[_0xa23b('0x7')](_0xa23b('0x8'),attributes,{'tableName':_0xa23b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2d80=['exports','define','VtigerAccount','int_vtiger_accounts','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration'];(function(_0x4c8fd7,_0x5ac749){var _0xd77a98=function(_0x3a5f2a){while(--_0x3a5f2a){_0x4c8fd7['push'](_0x4c8fd7['shift']());}};_0xd77a98(++_0x5ac749);}(_0x2d80,0xac));var _0x02d8=function(_0x1af8d3,_0x544d86){_0x1af8d3=_0x1af8d3-0x0;var _0x3a50c5=_0x2d80[_0x1af8d3];return _0x3a50c5;};'use strict';var _=require(_0x02d8('0x0'));var util=require(_0x02d8('0x1'));var logger=require(_0x02d8('0x2'))(_0x02d8('0x3'));var moment=require('moment');var BPromise=require(_0x02d8('0x4'));var rp=require(_0x02d8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x02d8('0x6'));var config=require(_0x02d8('0x7'));var attributes=require(_0x02d8('0x8'));var integrations=require(_0x02d8('0x9'));module[_0x02d8('0xa')]=function(_0x3fd634,_0x18a35c){return _0x3fd634[_0x02d8('0xb')](_0x02d8('0xc'),attributes,{'tableName':_0x02d8('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.rpc.js b/server/api/intVtigerAccount/intVtigerAccount.rpc.js index 69f7014..e543742 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 _0x5eb8=['where','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','error','message','catch','VtigerAccount','findAll','options','raw','limit','include','model','attributes','map','then','GetVtigerAccount','stringify','ShowVtigerAccount'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0x5eb8,0xb0));var _0x85eb=function(_0x40c402,_0x42ee7d){_0x40c402=_0x40c402-0x0;var _0x4e7680=_0x5eb8[_0x40c402];return _0x4e7680;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x85eb('0x0'));var BPromise=require(_0x85eb('0x1'));var rs=require(_0x85eb('0x2'));var fs=require('fs');var Redis=require(_0x85eb('0x3'));var db=require(_0x85eb('0x4'))['db'];var utils=require(_0x85eb('0x5'));var logger=require(_0x85eb('0x6'))(_0x85eb('0x7'));var config=require(_0x85eb('0x8'));var jayson=require(_0x85eb('0x9'));var client=jayson[_0x85eb('0xa')][_0x85eb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4a8814,_0x16d7b9,_0x3af658){return new BPromise(function(_0x448345,_0x5cd4ec){return client[_0x85eb('0xc')](_0x4a8814,_0x3af658)['then'](function(_0x1f0036){logger[_0x85eb('0xd')](_0x85eb('0xe'),_0x16d7b9,_0x85eb('0xf'));logger[_0x85eb('0x10')](_0x85eb('0x11'),_0x16d7b9,_0x85eb('0xf'),JSON['stringify'](_0x1f0036));if(_0x1f0036[_0x85eb('0x12')]){if(_0x1f0036[_0x85eb('0x12')]['code']===0x1f4){logger[_0x85eb('0x12')](_0x85eb('0xe'),_0x16d7b9,_0x1f0036[_0x85eb('0x12')][_0x85eb('0x13')]);return _0x5cd4ec(_0x1f0036['error']['message']);}logger[_0x85eb('0x12')]('VtigerAccount,\x20%s,\x20%s',_0x16d7b9,_0x1f0036[_0x85eb('0x12')][_0x85eb('0x13')]);return _0x448345(_0x1f0036[_0x85eb('0x12')][_0x85eb('0x13')]);}else{logger[_0x85eb('0xd')]('VtigerAccount,\x20%s,\x20%s',_0x16d7b9,_0x85eb('0xf'));_0x448345(_0x1f0036['result'][_0x85eb('0x13')]);}})[_0x85eb('0x14')](function(_0x3e23e8){logger[_0x85eb('0x12')]('VtigerAccount,\x20%s,\x20%s',_0x16d7b9,_0x3e23e8);_0x5cd4ec(_0x3e23e8);});});}exports['GetVtigerAccount']=function(_0x50d2a8){var _0xe198ca=this;return new Promise(function(_0x39ca96,_0x10cf2f){return db[_0x85eb('0x15')][_0x85eb('0x16')]({'raw':_0x50d2a8[_0x85eb('0x17')]?_0x50d2a8['options'][_0x85eb('0x18')]===undefined?!![]:![]:!![],'where':_0x50d2a8[_0x85eb('0x17')]?_0x50d2a8[_0x85eb('0x17')]['where']||null:null,'attributes':_0x50d2a8['options']?_0x50d2a8['options']['attributes']||null:null,'limit':_0x50d2a8[_0x85eb('0x17')]?_0x50d2a8[_0x85eb('0x17')][_0x85eb('0x19')]||null:null,'include':_0x50d2a8[_0x85eb('0x17')]?_0x50d2a8[_0x85eb('0x17')][_0x85eb('0x1a')]?_['map'](_0x50d2a8['options']['include'],function(_0x298e84){return{'model':db[_0x298e84[_0x85eb('0x1b')]],'as':_0x298e84['as'],'attributes':_0x298e84[_0x85eb('0x1c')],'include':_0x298e84[_0x85eb('0x1a')]?_[_0x85eb('0x1d')](_0x298e84[_0x85eb('0x1a')],function(_0x5dfc96){return{'model':db[_0x5dfc96[_0x85eb('0x1b')]],'as':_0x5dfc96['as'],'attributes':_0x5dfc96[_0x85eb('0x1c')],'include':_0x5dfc96[_0x85eb('0x1a')]?_[_0x85eb('0x1d')](_0x5dfc96[_0x85eb('0x1a')],function(_0x57a03c){return{'model':db[_0x57a03c[_0x85eb('0x1b')]],'as':_0x57a03c['as'],'attributes':_0x57a03c[_0x85eb('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x85eb('0x1e')](function(_0x3e7eb9){logger[_0x85eb('0xd')](_0x85eb('0x1f'),_0x50d2a8);logger['debug']('GetVtigerAccount',_0x50d2a8,JSON[_0x85eb('0x20')](_0x3e7eb9));_0x39ca96(_0x3e7eb9);})['catch'](function(_0xa9b14f){logger['error'](_0x85eb('0x1f'),_0xa9b14f[_0x85eb('0x13')],_0x50d2a8);_0x10cf2f(_0xe198ca[_0x85eb('0x12')](0x1f4,_0xa9b14f[_0x85eb('0x13')]));});});};exports[_0x85eb('0x21')]=function(_0xf4ac13){var _0x41ed76=this;return new Promise(function(_0x5decd5,_0x237f19){return db[_0x85eb('0x15')]['find']({'raw':_0xf4ac13[_0x85eb('0x17')]?_0xf4ac13['options']['raw']===undefined?!![]:![]:!![],'where':_0xf4ac13[_0x85eb('0x17')]?_0xf4ac13[_0x85eb('0x17')][_0x85eb('0x22')]||null:null,'attributes':_0xf4ac13[_0x85eb('0x17')]?_0xf4ac13[_0x85eb('0x17')][_0x85eb('0x1c')]||null:null,'include':_0xf4ac13[_0x85eb('0x17')]?_0xf4ac13[_0x85eb('0x17')][_0x85eb('0x1a')]?_[_0x85eb('0x1d')](_0xf4ac13['options'][_0x85eb('0x1a')],function(_0x3a5b87){return{'model':db[_0x3a5b87['model']],'as':_0x3a5b87['as'],'attributes':_0x3a5b87['attributes'],'include':_0x3a5b87[_0x85eb('0x1a')]?_[_0x85eb('0x1d')](_0x3a5b87[_0x85eb('0x1a')],function(_0x12cb4c){return{'model':db[_0x12cb4c[_0x85eb('0x1b')]],'as':_0x12cb4c['as'],'attributes':_0x12cb4c[_0x85eb('0x1c')],'include':_0x12cb4c[_0x85eb('0x1a')]?_[_0x85eb('0x1d')](_0x12cb4c[_0x85eb('0x1a')],function(_0x373e5f){return{'model':db[_0x373e5f[_0x85eb('0x1b')]],'as':_0x373e5f['as'],'attributes':_0x373e5f[_0x85eb('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x85eb('0x1e')](function(_0x33605a){logger['info'](_0x85eb('0x21'),_0xf4ac13);logger[_0x85eb('0x10')]('ShowVtigerAccount',_0xf4ac13,JSON['stringify'](_0x33605a));_0x5decd5(_0x33605a);})[_0x85eb('0x14')](function(_0xe22d16){logger['error'](_0x85eb('0x21'),_0xe22d16['message'],_0xf4ac13);_0x237f19(_0x41ed76[_0x85eb('0x12')](0x1f4,_0xe22d16['message']));});});}; \ No newline at end of file +var _0x750a=['util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error','code','VtigerAccount,\x20%s,\x20%s','message','catch','options','raw','attributes','limit','model','include','map','GetVtigerAccount','ShowVtigerAccount','VtigerAccount','where'];(function(_0x46d5ac,_0x4cc7df){var _0xb6f383=function(_0x3c7740){while(--_0x3c7740){_0x46d5ac['push'](_0x46d5ac['shift']());}};_0xb6f383(++_0x4cc7df);}(_0x750a,0x140));var _0xa750=function(_0x5930e1,_0x44ebf1){_0x5930e1=_0x5930e1-0x0;var _0x1bfcff=_0x750a[_0x5930e1];return _0x1bfcff;};'use strict';var _=require('lodash');var util=require(_0xa750('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa750('0x1'));var fs=require('fs');var Redis=require(_0xa750('0x2'));var db=require(_0xa750('0x3'))['db'];var utils=require(_0xa750('0x4'));var logger=require(_0xa750('0x5'))(_0xa750('0x6'));var config=require(_0xa750('0x7'));var jayson=require(_0xa750('0x8'));var client=jayson[_0xa750('0x9')][_0xa750('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x197299,_0x1ae455,_0x3d7c43){return new BPromise(function(_0x47a4dd,_0x53f2cb){return client[_0xa750('0xb')](_0x197299,_0x3d7c43)['then'](function(_0x4458b1){logger[_0xa750('0xc')]('VtigerAccount,\x20%s,\x20%s',_0x1ae455,_0xa750('0xd'));logger[_0xa750('0xe')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x1ae455,'request\x20sent',JSON[_0xa750('0xf')](_0x4458b1));if(_0x4458b1['error']){if(_0x4458b1[_0xa750('0x10')][_0xa750('0x11')]===0x1f4){logger['error'](_0xa750('0x12'),_0x1ae455,_0x4458b1[_0xa750('0x10')][_0xa750('0x13')]);return _0x53f2cb(_0x4458b1['error'][_0xa750('0x13')]);}logger[_0xa750('0x10')](_0xa750('0x12'),_0x1ae455,_0x4458b1[_0xa750('0x10')][_0xa750('0x13')]);return _0x47a4dd(_0x4458b1[_0xa750('0x10')]['message']);}else{logger[_0xa750('0xc')](_0xa750('0x12'),_0x1ae455,_0xa750('0xd'));_0x47a4dd(_0x4458b1['result'][_0xa750('0x13')]);}})[_0xa750('0x14')](function(_0x58639b){logger['error'](_0xa750('0x12'),_0x1ae455,_0x58639b);_0x53f2cb(_0x58639b);});});}exports['GetVtigerAccount']=function(_0x433dbd){var _0x1bde87=this;return new Promise(function(_0x4f1faa,_0x36dcca){return db['VtigerAccount']['findAll']({'raw':_0x433dbd[_0xa750('0x15')]?_0x433dbd['options'][_0xa750('0x16')]===undefined?!![]:![]:!![],'where':_0x433dbd['options']?_0x433dbd[_0xa750('0x15')]['where']||null:null,'attributes':_0x433dbd[_0xa750('0x15')]?_0x433dbd['options'][_0xa750('0x17')]||null:null,'limit':_0x433dbd['options']?_0x433dbd['options'][_0xa750('0x18')]||null:null,'include':_0x433dbd['options']?_0x433dbd[_0xa750('0x15')]['include']?_['map'](_0x433dbd['options']['include'],function(_0x15d72f){return{'model':db[_0x15d72f[_0xa750('0x19')]],'as':_0x15d72f['as'],'attributes':_0x15d72f[_0xa750('0x17')],'include':_0x15d72f[_0xa750('0x1a')]?_[_0xa750('0x1b')](_0x15d72f[_0xa750('0x1a')],function(_0x3001bc){return{'model':db[_0x3001bc[_0xa750('0x19')]],'as':_0x3001bc['as'],'attributes':_0x3001bc[_0xa750('0x17')],'include':_0x3001bc[_0xa750('0x1a')]?_[_0xa750('0x1b')](_0x3001bc[_0xa750('0x1a')],function(_0x31ea63){return{'model':db[_0x31ea63[_0xa750('0x19')]],'as':_0x31ea63['as'],'attributes':_0x31ea63[_0xa750('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3d3923){logger[_0xa750('0xc')](_0xa750('0x1c'),_0x433dbd);logger['debug'](_0xa750('0x1c'),_0x433dbd,JSON[_0xa750('0xf')](_0x3d3923));_0x4f1faa(_0x3d3923);})[_0xa750('0x14')](function(_0x1223d2){logger['error'](_0xa750('0x1c'),_0x1223d2[_0xa750('0x13')],_0x433dbd);_0x36dcca(_0x1bde87[_0xa750('0x10')](0x1f4,_0x1223d2[_0xa750('0x13')]));});});};exports[_0xa750('0x1d')]=function(_0x59ab33){var _0x46cc11=this;return new Promise(function(_0x4c2c9e,_0x2d0e93){return db[_0xa750('0x1e')]['find']({'raw':_0x59ab33[_0xa750('0x15')]?_0x59ab33[_0xa750('0x15')][_0xa750('0x16')]===undefined?!![]:![]:!![],'where':_0x59ab33[_0xa750('0x15')]?_0x59ab33[_0xa750('0x15')][_0xa750('0x1f')]||null:null,'attributes':_0x59ab33[_0xa750('0x15')]?_0x59ab33[_0xa750('0x15')]['attributes']||null:null,'include':_0x59ab33[_0xa750('0x15')]?_0x59ab33['options'][_0xa750('0x1a')]?_[_0xa750('0x1b')](_0x59ab33[_0xa750('0x15')][_0xa750('0x1a')],function(_0x556fde){return{'model':db[_0x556fde[_0xa750('0x19')]],'as':_0x556fde['as'],'attributes':_0x556fde[_0xa750('0x17')],'include':_0x556fde['include']?_[_0xa750('0x1b')](_0x556fde[_0xa750('0x1a')],function(_0x280b87){return{'model':db[_0x280b87[_0xa750('0x19')]],'as':_0x280b87['as'],'attributes':_0x280b87['attributes'],'include':_0x280b87[_0xa750('0x1a')]?_['map'](_0x280b87['include'],function(_0x4e59f3){return{'model':db[_0x4e59f3[_0xa750('0x19')]],'as':_0x4e59f3['as'],'attributes':_0x4e59f3[_0xa750('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x470089){logger[_0xa750('0xc')](_0xa750('0x1d'),_0x59ab33);logger['debug'](_0xa750('0x1d'),_0x59ab33,JSON[_0xa750('0xf')](_0x470089));_0x4c2c9e(_0x470089);})[_0xa750('0x14')](function(_0x5d402a){logger[_0xa750('0x10')](_0xa750('0x1d'),_0x5d402a[_0xa750('0x13')],_0x59ab33);_0x2d0e93(_0x46cc11['error'](0x1f4,_0x5d402a[_0xa750('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 046bc23..81bb119 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 _0xaecf=['path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','post','create','put','exports','multer'];(function(_0x429df3,_0x44d152){var _0x10f1ca=function(_0x2bee0f){while(--_0x2bee0f){_0x429df3['push'](_0x429df3['shift']());}};_0x10f1ca(++_0x44d152);}(_0xaecf,0x110));var _0xfaec=function(_0x48ad66,_0x55804a){_0x48ad66=_0x48ad66-0x0;var _0x2d59f0=_0xaecf[_0x48ad66];return _0x2d59f0;};'use strict';var multer=require(_0xfaec('0x0'));var util=require('util');var path=require(_0xfaec('0x1'));var timeout=require(_0xfaec('0x2'));var express=require('express');var router=express[_0xfaec('0x3')]();var fs_extra=require(_0xfaec('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xfaec('0x5'));var config=require(_0xfaec('0x6'));var controller=require('./intVtigerConfiguration.controller');router[_0xfaec('0x7')]('/',auth[_0xfaec('0x8')](),controller[_0xfaec('0x9')]);router[_0xfaec('0x7')](_0xfaec('0xa'),auth[_0xfaec('0x8')](),controller[_0xfaec('0xb')]);router[_0xfaec('0x7')](_0xfaec('0xc'),auth[_0xfaec('0x8')](),controller[_0xfaec('0xd')]);router[_0xfaec('0x7')](_0xfaec('0xe'),auth[_0xfaec('0x8')](),controller[_0xfaec('0xf')]);router[_0xfaec('0x7')]('/:id/descriptions',auth[_0xfaec('0x8')](),controller[_0xfaec('0x10')]);router[_0xfaec('0x11')]('/',auth['isAuthenticated'](),controller[_0xfaec('0x12')]);router[_0xfaec('0x13')](_0xfaec('0xa'),auth[_0xfaec('0x8')](),controller['update']);router['delete'](_0xfaec('0xa'),auth[_0xfaec('0x8')](),controller['destroy']);module[_0xfaec('0x14')]=router; \ No newline at end of file +var _0x469f=['connect-timeout','./intVtigerConfiguration.controller','isAuthenticated','index','get','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','create','put','/:id','update','delete','exports','util','path'];(function(_0x3b42d7,_0x3c97d3){var _0x504984=function(_0x1e6153){while(--_0x1e6153){_0x3b42d7['push'](_0x3b42d7['shift']());}};_0x504984(++_0x3c97d3);}(_0x469f,0xbc));var _0xf469=function(_0x17f6f0,_0x570f6c){_0x17f6f0=_0x17f6f0-0x0;var _0xbdfa78=_0x469f[_0x17f6f0];return _0xbdfa78;};'use strict';var multer=require('multer');var util=require(_0xf469('0x0'));var path=require(_0xf469('0x1'));var timeout=require(_0xf469('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf469('0x3'));router['get']('/',auth[_0xf469('0x4')](),controller[_0xf469('0x5')]);router[_0xf469('0x6')]('/:id',auth['isAuthenticated'](),controller[_0xf469('0x7')]);router[_0xf469('0x6')](_0xf469('0x8'),auth[_0xf469('0x4')](),controller[_0xf469('0x9')]);router[_0xf469('0x6')](_0xf469('0xa'),auth[_0xf469('0x4')](),controller[_0xf469('0xb')]);router['get'](_0xf469('0xc'),auth[_0xf469('0x4')](),controller['getDescriptions']);router['post']('/',auth[_0xf469('0x4')](),controller[_0xf469('0xd')]);router[_0xf469('0xe')](_0xf469('0xf'),auth[_0xf469('0x4')](),controller[_0xf469('0x10')]);router[_0xf469('0x11')](_0xf469('0xf'),auth[_0xf469('0x4')](),controller['destroy']);module[_0xf469('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 f322e2a..21f2a12 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 _0xa201=['sequelize','STRING'];(function(_0x3928ac,_0x354c37){var _0x2b6f47=function(_0x318d75){while(--_0x318d75){_0x3928ac['push'](_0x3928ac['shift']());}};_0x2b6f47(++_0x354c37);}(_0xa201,0x100));var _0x1a20=function(_0x3cd9c9,_0x596cf8){_0x3cd9c9=_0x3cd9c9-0x0;var _0x5adad5=_0xa201[_0x3cd9c9];return _0x5adad5;};'use strict';var Sequelize=require(_0x1a20('0x0'));module['exports']={'name':{'type':Sequelize[_0x1a20('0x1')]},'description':{'type':Sequelize[_0x1a20('0x1')]}}; \ No newline at end of file +var _0xea07=['STRING','sequelize','exports'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xea07,0x11e));var _0x7ea0=function(_0x50500f,_0x54b94b){_0x50500f=_0x50500f-0x0;var _0xb49c81=_0xea07[_0x50500f];return _0xb49c81;};'use strict';var Sequelize=require(_0x7ea0('0x0'));module[_0x7ea0('0x1')]={'name':{'type':Sequelize[_0x7ea0('0x2')]},'description':{'type':Sequelize[_0x7ea0('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index d8dac09..fb10a4a 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 _0x4d0b=['getDescriptions','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','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','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','update','then','error','send','index','map','VtigerConfiguration','rawAttributes','fieldName','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','find','create','body','destroy','findOne','VtigerField','pick','getFields','getSubjects','nolimit'];(function(_0x503c45,_0xf2946d){var _0x1e0593=function(_0x5edc49){while(--_0x5edc49){_0x503c45['push'](_0x503c45['shift']());}};_0x1e0593(++_0xf2946d);}(_0x4d0b,0x1d5));var _0xb4d0=function(_0x5eec9f,_0x1ac5d9){_0x5eec9f=_0x5eec9f-0x0;var _0x52fffc=_0x4d0b[_0x5eec9f];return _0x52fffc;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb4d0('0x0'));var jsonpatch=require(_0xb4d0('0x1'));var rp=require(_0xb4d0('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb4d0('0x3'));var util=require(_0xb4d0('0x4'));var path=require(_0xb4d0('0x5'));var sox=require(_0xb4d0('0x6'));var csv=require(_0xb4d0('0x7'));var ejs=require(_0xb4d0('0x8'));var fs=require('fs');var fs_extra=require(_0xb4d0('0x9'));var _=require(_0xb4d0('0xa'));var squel=require(_0xb4d0('0xb'));var crypto=require(_0xb4d0('0xc'));var jsforce=require(_0xb4d0('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xb4d0('0x7'));var querystring=require(_0xb4d0('0xe'));var Papa=require(_0xb4d0('0xf'));var Redis=require('ioredis');var authService=require(_0xb4d0('0x10'));var qs=require(_0xb4d0('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb4d0('0x12'));var logger=require(_0xb4d0('0x13'))(_0xb4d0('0x14'));var utils=require(_0xb4d0('0x15'));var config=require(_0xb4d0('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xb4d0('0x17'))['db'];function respondWithStatusCode(_0x41d871,_0x48dbff){_0x48dbff=_0x48dbff||0xcc;return function(_0x474c71){if(_0x474c71){return _0x41d871[_0xb4d0('0x18')](_0x48dbff);}return _0x41d871[_0xb4d0('0x19')](_0x48dbff)[_0xb4d0('0x1a')]();};}function respondWithResult(_0x44b187,_0x243f3d){_0x243f3d=_0x243f3d||0xc8;return function(_0x1bc41f){if(_0x1bc41f){return _0x44b187[_0xb4d0('0x19')](_0x243f3d)['json'](_0x1bc41f);}};}function respondWithFilteredResult(_0x4ba54d,_0x22416f){return function(_0x2bd1cf){if(_0x2bd1cf){var _0x239c11=typeof _0x22416f[_0xb4d0('0x1b')]===_0xb4d0('0x1c')&&typeof _0x22416f['limit']===_0xb4d0('0x1c');var _0xd965c5=_0x2bd1cf[_0xb4d0('0x1d')];var _0x52c981=_0x239c11?0x0:_0x22416f['offset'];var _0x3b1fcd=_0x239c11?_0x2bd1cf[_0xb4d0('0x1d')]:_0x22416f[_0xb4d0('0x1b')]+_0x22416f[_0xb4d0('0x1e')];var _0x302a56;if(_0x3b1fcd>=_0xd965c5){_0x3b1fcd=_0xd965c5;_0x302a56=0xc8;}else{_0x302a56=0xce;}_0x4ba54d[_0xb4d0('0x19')](_0x302a56);return _0x4ba54d[_0xb4d0('0x1f')](_0xb4d0('0x20'),_0x52c981+'-'+_0x3b1fcd+'/'+_0xd965c5)[_0xb4d0('0x21')](_0x2bd1cf);}return null;};}function patchUpdates(_0xa5433c){return function(_0x11daac){try{jsonpatch[_0xb4d0('0x22')](_0x11daac,_0xa5433c,!![]);}catch(_0xda8bd4){return BPromise[_0xb4d0('0x23')](_0xda8bd4);}return _0x11daac['save']();};}function saveUpdates(_0x1f3fc2,_0x34dd35){return function(_0x59b175){if(_0x59b175){return _0x59b175[_0xb4d0('0x24')](_0x1f3fc2)[_0xb4d0('0x25')](function(_0x4c4d80){return _0x4c4d80;});}return null;};}function removeEntity(_0x47f4bf,_0x1c5ed4){return function(_0x25d28f){if(_0x25d28f){return _0x25d28f['destroy']()[_0xb4d0('0x25')](function(){_0x47f4bf['status'](0xcc)[_0xb4d0('0x1a')]();});}};}function handleEntityNotFound(_0x375d98,_0x39bbc9){return function(_0x31fb42){if(!_0x31fb42){_0x375d98[_0xb4d0('0x18')](0x194);}return _0x31fb42;};}function handleError(_0xd4ea88,_0x361f29){_0x361f29=_0x361f29||0x1f4;return function(_0x2b9838){logger[_0xb4d0('0x26')](_0x2b9838['stack']);if(_0x2b9838['name']){delete _0x2b9838['name'];}_0xd4ea88[_0xb4d0('0x19')](_0x361f29)[_0xb4d0('0x27')](_0x2b9838);};}exports[_0xb4d0('0x28')]=function(_0x107352,_0xda4b58){var _0x4ccb2f={},_0x2b1afb={},_0x27704d={'count':0x0,'rows':[]};var _0x19c2dc=_[_0xb4d0('0x29')](db[_0xb4d0('0x2a')][_0xb4d0('0x2b')],function(_0x4de2e8){return{'name':_0x4de2e8[_0xb4d0('0x2c')],'type':_0x4de2e8['type']['key']};});_0x2b1afb[_0xb4d0('0x2d')]=_[_0xb4d0('0x29')](_0x19c2dc,_0xb4d0('0x2e'));_0x2b1afb[_0xb4d0('0x2f')]=_[_0xb4d0('0x30')](_0x107352['query']);_0x2b1afb[_0xb4d0('0x31')]=_[_0xb4d0('0x32')](_0x2b1afb['model'],_0x2b1afb[_0xb4d0('0x2f')]);_0x4ccb2f[_0xb4d0('0x33')]=_[_0xb4d0('0x32')](_0x2b1afb['model'],qs['fields'](_0x107352[_0xb4d0('0x2f')][_0xb4d0('0x34')]));_0x4ccb2f[_0xb4d0('0x33')]=_0x4ccb2f[_0xb4d0('0x33')][_0xb4d0('0x35')]?_0x4ccb2f['attributes']:_0x2b1afb[_0xb4d0('0x2d')];if(!_0x107352['query'][_0xb4d0('0x36')]('nolimit')){_0x4ccb2f[_0xb4d0('0x1e')]=qs['limit'](_0x107352[_0xb4d0('0x2f')][_0xb4d0('0x1e')]);_0x4ccb2f[_0xb4d0('0x1b')]=qs['offset'](_0x107352['query'][_0xb4d0('0x1b')]);}_0x4ccb2f[_0xb4d0('0x37')]=qs[_0xb4d0('0x38')](_0x107352[_0xb4d0('0x2f')][_0xb4d0('0x38')]);_0x4ccb2f[_0xb4d0('0x39')]=qs[_0xb4d0('0x31')](_['pick'](_0x107352[_0xb4d0('0x2f')],_0x2b1afb[_0xb4d0('0x31')]),_0x19c2dc);if(_0x107352['query'][_0xb4d0('0x3a')]){_0x4ccb2f['where']=_[_0xb4d0('0x3b')](_0x4ccb2f[_0xb4d0('0x39')],{'$or':_[_0xb4d0('0x29')](_0x19c2dc,function(_0x16cf8c){if(_0x16cf8c['type']!==_0xb4d0('0x3c')){var _0x467d32={};_0x467d32[_0x16cf8c[_0xb4d0('0x2e')]]={'$like':'%'+_0x107352['query'][_0xb4d0('0x3a')]+'%'};return _0x467d32;}})});}_0x4ccb2f=_[_0xb4d0('0x3b')]({},_0x4ccb2f,_0x107352[_0xb4d0('0x3d')]);var _0x34c32c={'where':_0x4ccb2f[_0xb4d0('0x39')]};return db[_0xb4d0('0x2a')][_0xb4d0('0x1d')](_0x34c32c)[_0xb4d0('0x25')](function(_0x28f689){_0x27704d[_0xb4d0('0x1d')]=_0x28f689;if(_0x107352['query'][_0xb4d0('0x3e')]){_0x4ccb2f['include']=[{'all':!![]}];}return db[_0xb4d0('0x2a')][_0xb4d0('0x3f')](_0x4ccb2f);})[_0xb4d0('0x25')](function(_0x3421fa){_0x27704d['rows']=_0x3421fa;return _0x27704d;})[_0xb4d0('0x25')](respondWithFilteredResult(_0xda4b58,_0x4ccb2f))[_0xb4d0('0x40')](handleError(_0xda4b58,null));};exports[_0xb4d0('0x41')]=function(_0x5ec58e,_0x20143c){var _0x31a425={'raw':![],'where':{'id':_0x5ec58e[_0xb4d0('0x42')]['id']}},_0x581401={};_0x581401[_0xb4d0('0x2d')]=_[_0xb4d0('0x30')](db[_0xb4d0('0x2a')]['rawAttributes']);_0x581401['query']=_[_0xb4d0('0x30')](_0x5ec58e[_0xb4d0('0x2f')]);_0x581401[_0xb4d0('0x31')]=_[_0xb4d0('0x32')](_0x581401[_0xb4d0('0x2d')],_0x581401[_0xb4d0('0x2f')]);_0x31a425['attributes']=_[_0xb4d0('0x32')](_0x581401[_0xb4d0('0x2d')],qs[_0xb4d0('0x34')](_0x5ec58e[_0xb4d0('0x2f')][_0xb4d0('0x34')]));_0x31a425['attributes']=_0x31a425['attributes']['length']?_0x31a425[_0xb4d0('0x33')]:_0x581401['model'];if(_0x5ec58e[_0xb4d0('0x2f')][_0xb4d0('0x3e')]){_0x31a425['include']=[{'all':!![]}];}_0x31a425=_['merge']({},_0x31a425,_0x5ec58e[_0xb4d0('0x3d')]);return db[_0xb4d0('0x2a')][_0xb4d0('0x43')](_0x31a425)[_0xb4d0('0x25')](handleEntityNotFound(_0x20143c,null))[_0xb4d0('0x25')](respondWithResult(_0x20143c,null))['catch'](handleError(_0x20143c,null));};exports[_0xb4d0('0x44')]=function(_0x1eb476,_0x1f41fc){return db[_0xb4d0('0x2a')][_0xb4d0('0x44')](_0x1eb476[_0xb4d0('0x45')],{})[_0xb4d0('0x25')](respondWithResult(_0x1f41fc,0xc9))[_0xb4d0('0x40')](handleError(_0x1f41fc,null));};exports[_0xb4d0('0x24')]=function(_0x19fa07,_0x7830d6){if(_0x19fa07[_0xb4d0('0x45')]['id']){delete _0x19fa07[_0xb4d0('0x45')]['id'];}return db[_0xb4d0('0x2a')][_0xb4d0('0x43')]({'where':{'id':_0x19fa07[_0xb4d0('0x42')]['id']}})[_0xb4d0('0x25')](handleEntityNotFound(_0x7830d6,null))['then'](saveUpdates(_0x19fa07[_0xb4d0('0x45')],null))[_0xb4d0('0x25')](respondWithResult(_0x7830d6,null))['catch'](handleError(_0x7830d6,null));};exports[_0xb4d0('0x46')]=function(_0xde2b8,_0x2a7a46){return db[_0xb4d0('0x2a')][_0xb4d0('0x43')]({'where':{'id':_0xde2b8[_0xb4d0('0x42')]['id']}})[_0xb4d0('0x25')](handleEntityNotFound(_0x2a7a46,null))[_0xb4d0('0x25')](removeEntity(_0x2a7a46,null))[_0xb4d0('0x40')](handleError(_0x2a7a46,null));};exports['getFields']=function(_0x4d7473,_0x2ea024,_0x1b2651){var _0x254f10={};var _0x3a3b0e={};var _0x438249;var _0x1b80da;return db['VtigerConfiguration'][_0xb4d0('0x47')]({'where':{'id':_0x4d7473[_0xb4d0('0x42')]['id']}})[_0xb4d0('0x25')](handleEntityNotFound(_0x2ea024,null))[_0xb4d0('0x25')](function(_0x40b5cb){if(_0x40b5cb){_0x438249=_0x40b5cb;_0x3a3b0e[_0xb4d0('0x2d')]=_[_0xb4d0('0x30')](db[_0xb4d0('0x48')][_0xb4d0('0x2b')]);_0x3a3b0e[_0xb4d0('0x2f')]=_[_0xb4d0('0x30')](_0x4d7473[_0xb4d0('0x2f')]);_0x3a3b0e[_0xb4d0('0x31')]=_[_0xb4d0('0x32')](_0x3a3b0e[_0xb4d0('0x2d')],_0x3a3b0e[_0xb4d0('0x2f')]);_0x254f10['attributes']=_['intersection'](_0x3a3b0e[_0xb4d0('0x2d')],qs[_0xb4d0('0x34')](_0x4d7473['query'][_0xb4d0('0x34')]));_0x254f10['attributes']=_0x254f10['attributes'][_0xb4d0('0x35')]?_0x254f10[_0xb4d0('0x33')]:_0x3a3b0e['model'];_0x254f10['order']=qs[_0xb4d0('0x38')](_0x4d7473['query'][_0xb4d0('0x38')]);_0x254f10[_0xb4d0('0x39')]=qs[_0xb4d0('0x31')](_[_0xb4d0('0x49')](_0x4d7473[_0xb4d0('0x2f')],_0x3a3b0e[_0xb4d0('0x31')]));if(_0x4d7473['query'][_0xb4d0('0x3a')]){_0x254f10['where']=_[_0xb4d0('0x3b')](_0x254f10[_0xb4d0('0x39')],{'$or':_['map'](_0x254f10['attributes'],function(_0x2f7446){var _0xcb5142={};_0xcb5142[_0x2f7446]={'$like':'%'+_0x4d7473[_0xb4d0('0x2f')]['filter']+'%'};return _0xcb5142;})});}_0x254f10=_[_0xb4d0('0x3b')]({},_0x254f10,_0x4d7473['options']);return _0x438249[_0xb4d0('0x4a')](_0x254f10);}})[_0xb4d0('0x25')](function(_0x25aa27){if(_0x25aa27){_0x1b80da=_0x25aa27[_0xb4d0('0x35')];if(!_0x4d7473[_0xb4d0('0x2f')][_0xb4d0('0x36')]('nolimit')){_0x254f10['limit']=qs[_0xb4d0('0x1e')](_0x4d7473[_0xb4d0('0x2f')]['limit']);_0x254f10['offset']=qs['offset'](_0x4d7473[_0xb4d0('0x2f')]['offset']);}return _0x438249[_0xb4d0('0x4a')](_0x254f10);}})[_0xb4d0('0x25')](function(_0x4e0ef7){if(_0x4e0ef7){return _0x4e0ef7?{'count':_0x1b80da,'rows':_0x4e0ef7}:null;}})[_0xb4d0('0x25')](respondWithResult(_0x2ea024,null))[_0xb4d0('0x40')](handleError(_0x2ea024,null));};exports[_0xb4d0('0x4b')]=function(_0x34d3b2,_0x327b68,_0x1f1d24){var _0xa7d1fc={};var _0x623fb9={};var _0x16cd12;var _0x3af607;return db[_0xb4d0('0x2a')][_0xb4d0('0x47')]({'where':{'id':_0x34d3b2['params']['id']}})[_0xb4d0('0x25')](handleEntityNotFound(_0x327b68,null))['then'](function(_0x45c4ac){if(_0x45c4ac){_0x16cd12=_0x45c4ac;_0x623fb9[_0xb4d0('0x2d')]=_['keys'](db[_0xb4d0('0x48')]['rawAttributes']);_0x623fb9[_0xb4d0('0x2f')]=_[_0xb4d0('0x30')](_0x34d3b2[_0xb4d0('0x2f')]);_0x623fb9['filters']=_['intersection'](_0x623fb9[_0xb4d0('0x2d')],_0x623fb9[_0xb4d0('0x2f')]);_0xa7d1fc[_0xb4d0('0x33')]=_['intersection'](_0x623fb9[_0xb4d0('0x2d')],qs[_0xb4d0('0x34')](_0x34d3b2[_0xb4d0('0x2f')][_0xb4d0('0x34')]));_0xa7d1fc['attributes']=_0xa7d1fc[_0xb4d0('0x33')][_0xb4d0('0x35')]?_0xa7d1fc[_0xb4d0('0x33')]:_0x623fb9[_0xb4d0('0x2d')];_0xa7d1fc[_0xb4d0('0x37')]=qs[_0xb4d0('0x38')](_0x34d3b2[_0xb4d0('0x2f')][_0xb4d0('0x38')]);_0xa7d1fc[_0xb4d0('0x39')]=qs['filters'](_[_0xb4d0('0x49')](_0x34d3b2['query'],_0x623fb9[_0xb4d0('0x31')]));if(_0x34d3b2['query']['filter']){_0xa7d1fc['where']=_[_0xb4d0('0x3b')](_0xa7d1fc[_0xb4d0('0x39')],{'$or':_['map'](_0xa7d1fc[_0xb4d0('0x33')],function(_0xc9440d){var _0x3f2b74={};_0x3f2b74[_0xc9440d]={'$like':'%'+_0x34d3b2[_0xb4d0('0x2f')]['filter']+'%'};return _0x3f2b74;})});}_0xa7d1fc=_['merge']({},_0xa7d1fc,_0x34d3b2[_0xb4d0('0x3d')]);return _0x16cd12[_0xb4d0('0x4b')](_0xa7d1fc);}})[_0xb4d0('0x25')](function(_0x4b93ea){if(_0x4b93ea){_0x3af607=_0x4b93ea[_0xb4d0('0x35')];if(!_0x34d3b2[_0xb4d0('0x2f')][_0xb4d0('0x36')](_0xb4d0('0x4c'))){_0xa7d1fc[_0xb4d0('0x1e')]=qs[_0xb4d0('0x1e')](_0x34d3b2['query'][_0xb4d0('0x1e')]);_0xa7d1fc[_0xb4d0('0x1b')]=qs[_0xb4d0('0x1b')](_0x34d3b2[_0xb4d0('0x2f')][_0xb4d0('0x1b')]);}return _0x16cd12[_0xb4d0('0x4b')](_0xa7d1fc);}})[_0xb4d0('0x25')](function(_0x30a8b0){if(_0x30a8b0){return _0x30a8b0?{'count':_0x3af607,'rows':_0x30a8b0}:null;}})[_0xb4d0('0x25')](respondWithResult(_0x327b68,null))[_0xb4d0('0x40')](handleError(_0x327b68,null));};exports['getDescriptions']=function(_0x3b66b0,_0x2b0acc,_0x220d25){var _0x5869a5={};var _0x40bc83={};var _0x30721d;var _0x2a3327;return db[_0xb4d0('0x2a')][_0xb4d0('0x47')]({'where':{'id':_0x3b66b0['params']['id']}})[_0xb4d0('0x25')](handleEntityNotFound(_0x2b0acc,null))[_0xb4d0('0x25')](function(_0x255e7a){if(_0x255e7a){_0x30721d=_0x255e7a;_0x40bc83[_0xb4d0('0x2d')]=_[_0xb4d0('0x30')](db[_0xb4d0('0x48')][_0xb4d0('0x2b')]);_0x40bc83[_0xb4d0('0x2f')]=_['keys'](_0x3b66b0[_0xb4d0('0x2f')]);_0x40bc83[_0xb4d0('0x31')]=_[_0xb4d0('0x32')](_0x40bc83['model'],_0x40bc83['query']);_0x5869a5[_0xb4d0('0x33')]=_[_0xb4d0('0x32')](_0x40bc83[_0xb4d0('0x2d')],qs['fields'](_0x3b66b0[_0xb4d0('0x2f')]['fields']));_0x5869a5[_0xb4d0('0x33')]=_0x5869a5[_0xb4d0('0x33')][_0xb4d0('0x35')]?_0x5869a5[_0xb4d0('0x33')]:_0x40bc83[_0xb4d0('0x2d')];_0x5869a5[_0xb4d0('0x37')]=qs[_0xb4d0('0x38')](_0x3b66b0[_0xb4d0('0x2f')][_0xb4d0('0x38')]);_0x5869a5['where']=qs[_0xb4d0('0x31')](_['pick'](_0x3b66b0[_0xb4d0('0x2f')],_0x40bc83[_0xb4d0('0x31')]));if(_0x3b66b0[_0xb4d0('0x2f')][_0xb4d0('0x3a')]){_0x5869a5[_0xb4d0('0x39')]=_[_0xb4d0('0x3b')](_0x5869a5[_0xb4d0('0x39')],{'$or':_[_0xb4d0('0x29')](_0x5869a5[_0xb4d0('0x33')],function(_0x1ecfcc){var _0x52cf3f={};_0x52cf3f[_0x1ecfcc]={'$like':'%'+_0x3b66b0[_0xb4d0('0x2f')]['filter']+'%'};return _0x52cf3f;})});}_0x5869a5=_[_0xb4d0('0x3b')]({},_0x5869a5,_0x3b66b0[_0xb4d0('0x3d')]);return _0x30721d[_0xb4d0('0x4d')](_0x5869a5);}})[_0xb4d0('0x25')](function(_0x479ff5){if(_0x479ff5){_0x2a3327=_0x479ff5[_0xb4d0('0x35')];if(!_0x3b66b0[_0xb4d0('0x2f')][_0xb4d0('0x36')]('nolimit')){_0x5869a5[_0xb4d0('0x1e')]=qs[_0xb4d0('0x1e')](_0x3b66b0[_0xb4d0('0x2f')]['limit']);_0x5869a5[_0xb4d0('0x1b')]=qs[_0xb4d0('0x1b')](_0x3b66b0[_0xb4d0('0x2f')][_0xb4d0('0x1b')]);}return _0x30721d[_0xb4d0('0x4d')](_0x5869a5);}})[_0xb4d0('0x25')](function(_0x41349e){if(_0x41349e){return _0x41349e?{'count':_0x2a3327,'rows':_0x41349e}:null;}})[_0xb4d0('0x25')](respondWithResult(_0x2b0acc,null))[_0xb4d0('0x40')](handleError(_0x2b0acc,null));}; \ No newline at end of file +var _0xae2c=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','status','end','json','offset','limit','undefined','set','Content-Range','apply','reject','save','update','destroy','sendStatus','error','stack','name','send','index','map','VtigerConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','count','then','includeAll','findAll','rows','catch','include','create','body','params','find','getFields','findOne','VtigerField','order','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis'];(function(_0xb41e0e,_0x5326d8){var _0x5d2ff6=function(_0x533577){while(--_0x533577){_0xb41e0e['push'](_0xb41e0e['shift']());}};_0x5d2ff6(++_0x5326d8);}(_0xae2c,0x94));var _0xcae2=function(_0x17f415,_0x1e98f7){_0x17f415=_0x17f415-0x0;var _0x4310a6=_0xae2c[_0x17f415];return _0x4310a6;};'use strict';var emlformat=require(_0xcae2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcae2('0x1'));var jsonpatch=require(_0xcae2('0x2'));var rp=require('request-promise');var moment=require(_0xcae2('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xcae2('0x4'));var util=require(_0xcae2('0x5'));var path=require(_0xcae2('0x6'));var sox=require(_0xcae2('0x7'));var csv=require(_0xcae2('0x8'));var ejs=require(_0xcae2('0x9'));var fs=require('fs');var fs_extra=require(_0xcae2('0xa'));var _=require(_0xcae2('0xb'));var squel=require(_0xcae2('0xc'));var crypto=require(_0xcae2('0xd'));var jsforce=require(_0xcae2('0xe'));var deskjs=require(_0xcae2('0xf'));var toCsv=require(_0xcae2('0x8'));var querystring=require('querystring');var Papa=require(_0xcae2('0x10'));var Redis=require(_0xcae2('0x11'));var authService=require(_0xcae2('0x12'));var qs=require(_0xcae2('0x13'));var as=require(_0xcae2('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xcae2('0x15'));var utils=require(_0xcae2('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xcae2('0x17'))['db'];function respondWithStatusCode(_0x3926a0,_0x27cd3a){_0x27cd3a=_0x27cd3a||0xcc;return function(_0x933bcd){if(_0x933bcd){return _0x3926a0['sendStatus'](_0x27cd3a);}return _0x3926a0[_0xcae2('0x18')](_0x27cd3a)[_0xcae2('0x19')]();};}function respondWithResult(_0x2f9497,_0x122d48){_0x122d48=_0x122d48||0xc8;return function(_0x293ce0){if(_0x293ce0){return _0x2f9497[_0xcae2('0x18')](_0x122d48)[_0xcae2('0x1a')](_0x293ce0);}};}function respondWithFilteredResult(_0xd631a4,_0x48d9cc){return function(_0x32c44b){if(_0x32c44b){var _0xdb6d88=typeof _0x48d9cc[_0xcae2('0x1b')]==='undefined'&&typeof _0x48d9cc[_0xcae2('0x1c')]===_0xcae2('0x1d');var _0x16d389=_0x32c44b['count'];var _0x202306=_0xdb6d88?0x0:_0x48d9cc[_0xcae2('0x1b')];var _0x4d2ddd=_0xdb6d88?_0x32c44b['count']:_0x48d9cc['offset']+_0x48d9cc[_0xcae2('0x1c')];var _0x26d879;if(_0x4d2ddd>=_0x16d389){_0x4d2ddd=_0x16d389;_0x26d879=0xc8;}else{_0x26d879=0xce;}_0xd631a4[_0xcae2('0x18')](_0x26d879);return _0xd631a4[_0xcae2('0x1e')](_0xcae2('0x1f'),_0x202306+'-'+_0x4d2ddd+'/'+_0x16d389)['json'](_0x32c44b);}return null;};}function patchUpdates(_0x2e4da4){return function(_0x148b37){try{jsonpatch[_0xcae2('0x20')](_0x148b37,_0x2e4da4,!![]);}catch(_0x465ef7){return BPromise[_0xcae2('0x21')](_0x465ef7);}return _0x148b37[_0xcae2('0x22')]();};}function saveUpdates(_0x23d635,_0x33e735){return function(_0x58f6ca){if(_0x58f6ca){return _0x58f6ca[_0xcae2('0x23')](_0x23d635)['then'](function(_0x3f5f66){return _0x3f5f66;});}return null;};}function removeEntity(_0x559f53,_0x107871){return function(_0x5c62ce){if(_0x5c62ce){return _0x5c62ce[_0xcae2('0x24')]()['then'](function(){_0x559f53[_0xcae2('0x18')](0xcc)[_0xcae2('0x19')]();});}};}function handleEntityNotFound(_0x2b417f,_0x4a827f){return function(_0x12c614){if(!_0x12c614){_0x2b417f[_0xcae2('0x25')](0x194);}return _0x12c614;};}function handleError(_0x5cdab0,_0x353c4c){_0x353c4c=_0x353c4c||0x1f4;return function(_0x192eb6){logger[_0xcae2('0x26')](_0x192eb6[_0xcae2('0x27')]);if(_0x192eb6[_0xcae2('0x28')]){delete _0x192eb6[_0xcae2('0x28')];}_0x5cdab0[_0xcae2('0x18')](_0x353c4c)[_0xcae2('0x29')](_0x192eb6);};}exports[_0xcae2('0x2a')]=function(_0x3b6b3b,_0xab5da8){var _0x5d26af={},_0x44ec20={},_0x359145={'count':0x0,'rows':[]};var _0x48927c=_[_0xcae2('0x2b')](db[_0xcae2('0x2c')][_0xcae2('0x2d')],function(_0x1aad15){return{'name':_0x1aad15[_0xcae2('0x2e')],'type':_0x1aad15[_0xcae2('0x2f')][_0xcae2('0x30')]};});_0x44ec20[_0xcae2('0x31')]=_[_0xcae2('0x2b')](_0x48927c,_0xcae2('0x28'));_0x44ec20[_0xcae2('0x32')]=_[_0xcae2('0x33')](_0x3b6b3b[_0xcae2('0x32')]);_0x44ec20[_0xcae2('0x34')]=_[_0xcae2('0x35')](_0x44ec20[_0xcae2('0x31')],_0x44ec20[_0xcae2('0x32')]);_0x5d26af['attributes']=_[_0xcae2('0x35')](_0x44ec20[_0xcae2('0x31')],qs['fields'](_0x3b6b3b[_0xcae2('0x32')][_0xcae2('0x36')]));_0x5d26af[_0xcae2('0x37')]=_0x5d26af[_0xcae2('0x37')][_0xcae2('0x38')]?_0x5d26af[_0xcae2('0x37')]:_0x44ec20['model'];if(!_0x3b6b3b[_0xcae2('0x32')][_0xcae2('0x39')](_0xcae2('0x3a'))){_0x5d26af['limit']=qs['limit'](_0x3b6b3b[_0xcae2('0x32')][_0xcae2('0x1c')]);_0x5d26af['offset']=qs[_0xcae2('0x1b')](_0x3b6b3b[_0xcae2('0x32')]['offset']);}_0x5d26af['order']=qs[_0xcae2('0x3b')](_0x3b6b3b['query']['sort']);_0x5d26af[_0xcae2('0x3c')]=qs[_0xcae2('0x34')](_[_0xcae2('0x3d')](_0x3b6b3b[_0xcae2('0x32')],_0x44ec20['filters']),_0x48927c);if(_0x3b6b3b[_0xcae2('0x32')][_0xcae2('0x3e')]){_0x5d26af['where']=_[_0xcae2('0x3f')](_0x5d26af[_0xcae2('0x3c')],{'$or':_['map'](_0x48927c,function(_0x1b06dd){if(_0x1b06dd[_0xcae2('0x2f')]!==_0xcae2('0x40')){var _0xe30c7c={};_0xe30c7c[_0x1b06dd['name']]={'$like':'%'+_0x3b6b3b[_0xcae2('0x32')]['filter']+'%'};return _0xe30c7c;}})});}_0x5d26af=_[_0xcae2('0x3f')]({},_0x5d26af,_0x3b6b3b[_0xcae2('0x41')]);var _0x2996be={'where':_0x5d26af[_0xcae2('0x3c')]};return db['VtigerConfiguration'][_0xcae2('0x42')](_0x2996be)[_0xcae2('0x43')](function(_0x2444d1){_0x359145[_0xcae2('0x42')]=_0x2444d1;if(_0x3b6b3b[_0xcae2('0x32')][_0xcae2('0x44')]){_0x5d26af['include']=[{'all':!![]}];}return db[_0xcae2('0x2c')][_0xcae2('0x45')](_0x5d26af);})[_0xcae2('0x43')](function(_0x198c24){_0x359145[_0xcae2('0x46')]=_0x198c24;return _0x359145;})[_0xcae2('0x43')](respondWithFilteredResult(_0xab5da8,_0x5d26af))[_0xcae2('0x47')](handleError(_0xab5da8,null));};exports['show']=function(_0x5d5ad6,_0x51bc6f){var _0x44ca7a={'raw':![],'where':{'id':_0x5d5ad6['params']['id']}},_0x2c8a06={};_0x2c8a06['model']=_[_0xcae2('0x33')](db[_0xcae2('0x2c')][_0xcae2('0x2d')]);_0x2c8a06[_0xcae2('0x32')]=_['keys'](_0x5d5ad6[_0xcae2('0x32')]);_0x2c8a06[_0xcae2('0x34')]=_['intersection'](_0x2c8a06[_0xcae2('0x31')],_0x2c8a06['query']);_0x44ca7a[_0xcae2('0x37')]=_[_0xcae2('0x35')](_0x2c8a06['model'],qs['fields'](_0x5d5ad6[_0xcae2('0x32')]['fields']));_0x44ca7a[_0xcae2('0x37')]=_0x44ca7a[_0xcae2('0x37')]['length']?_0x44ca7a[_0xcae2('0x37')]:_0x2c8a06[_0xcae2('0x31')];if(_0x5d5ad6[_0xcae2('0x32')][_0xcae2('0x44')]){_0x44ca7a[_0xcae2('0x48')]=[{'all':!![]}];}_0x44ca7a=_[_0xcae2('0x3f')]({},_0x44ca7a,_0x5d5ad6[_0xcae2('0x41')]);return db[_0xcae2('0x2c')]['find'](_0x44ca7a)[_0xcae2('0x43')](handleEntityNotFound(_0x51bc6f,null))['then'](respondWithResult(_0x51bc6f,null))[_0xcae2('0x47')](handleError(_0x51bc6f,null));};exports['create']=function(_0x2ddb63,_0xdc57ec){return db[_0xcae2('0x2c')][_0xcae2('0x49')](_0x2ddb63[_0xcae2('0x4a')],{})[_0xcae2('0x43')](respondWithResult(_0xdc57ec,0xc9))[_0xcae2('0x47')](handleError(_0xdc57ec,null));};exports['update']=function(_0x3269d7,_0x2f1b7b){if(_0x3269d7[_0xcae2('0x4a')]['id']){delete _0x3269d7['body']['id'];}return db[_0xcae2('0x2c')]['find']({'where':{'id':_0x3269d7[_0xcae2('0x4b')]['id']}})[_0xcae2('0x43')](handleEntityNotFound(_0x2f1b7b,null))[_0xcae2('0x43')](saveUpdates(_0x3269d7[_0xcae2('0x4a')],null))[_0xcae2('0x43')](respondWithResult(_0x2f1b7b,null))[_0xcae2('0x47')](handleError(_0x2f1b7b,null));};exports[_0xcae2('0x24')]=function(_0x1a3454,_0x569173){return db[_0xcae2('0x2c')][_0xcae2('0x4c')]({'where':{'id':_0x1a3454[_0xcae2('0x4b')]['id']}})[_0xcae2('0x43')](handleEntityNotFound(_0x569173,null))[_0xcae2('0x43')](removeEntity(_0x569173,null))[_0xcae2('0x47')](handleError(_0x569173,null));};exports[_0xcae2('0x4d')]=function(_0x22079c,_0x1f66bc,_0x167a34){var _0x367f58={};var _0x23a84e={};var _0x434dea;var _0x16eda3;return db[_0xcae2('0x2c')][_0xcae2('0x4e')]({'where':{'id':_0x22079c['params']['id']}})[_0xcae2('0x43')](handleEntityNotFound(_0x1f66bc,null))[_0xcae2('0x43')](function(_0x2c0e47){if(_0x2c0e47){_0x434dea=_0x2c0e47;_0x23a84e[_0xcae2('0x31')]=_[_0xcae2('0x33')](db[_0xcae2('0x4f')]['rawAttributes']);_0x23a84e[_0xcae2('0x32')]=_['keys'](_0x22079c[_0xcae2('0x32')]);_0x23a84e[_0xcae2('0x34')]=_['intersection'](_0x23a84e[_0xcae2('0x31')],_0x23a84e[_0xcae2('0x32')]);_0x367f58[_0xcae2('0x37')]=_[_0xcae2('0x35')](_0x23a84e['model'],qs[_0xcae2('0x36')](_0x22079c[_0xcae2('0x32')][_0xcae2('0x36')]));_0x367f58[_0xcae2('0x37')]=_0x367f58[_0xcae2('0x37')][_0xcae2('0x38')]?_0x367f58[_0xcae2('0x37')]:_0x23a84e['model'];_0x367f58['order']=qs[_0xcae2('0x3b')](_0x22079c['query']['sort']);_0x367f58[_0xcae2('0x3c')]=qs[_0xcae2('0x34')](_[_0xcae2('0x3d')](_0x22079c[_0xcae2('0x32')],_0x23a84e[_0xcae2('0x34')]));if(_0x22079c[_0xcae2('0x32')]['filter']){_0x367f58['where']=_[_0xcae2('0x3f')](_0x367f58['where'],{'$or':_[_0xcae2('0x2b')](_0x367f58[_0xcae2('0x37')],function(_0x38f03d){var _0xb38d3c={};_0xb38d3c[_0x38f03d]={'$like':'%'+_0x22079c['query'][_0xcae2('0x3e')]+'%'};return _0xb38d3c;})});}_0x367f58=_[_0xcae2('0x3f')]({},_0x367f58,_0x22079c[_0xcae2('0x41')]);return _0x434dea[_0xcae2('0x4d')](_0x367f58);}})['then'](function(_0xb5aad9){if(_0xb5aad9){_0x16eda3=_0xb5aad9[_0xcae2('0x38')];if(!_0x22079c[_0xcae2('0x32')][_0xcae2('0x39')](_0xcae2('0x3a'))){_0x367f58['limit']=qs[_0xcae2('0x1c')](_0x22079c[_0xcae2('0x32')][_0xcae2('0x1c')]);_0x367f58[_0xcae2('0x1b')]=qs[_0xcae2('0x1b')](_0x22079c[_0xcae2('0x32')][_0xcae2('0x1b')]);}return _0x434dea[_0xcae2('0x4d')](_0x367f58);}})[_0xcae2('0x43')](function(_0x49970c){if(_0x49970c){return _0x49970c?{'count':_0x16eda3,'rows':_0x49970c}:null;}})[_0xcae2('0x43')](respondWithResult(_0x1f66bc,null))['catch'](handleError(_0x1f66bc,null));};exports['getSubjects']=function(_0x237ea3,_0x3ba880,_0x4f5799){var _0x3274ff={};var _0x25dc03={};var _0x15ccc6;var _0x36ae42;return db[_0xcae2('0x2c')][_0xcae2('0x4e')]({'where':{'id':_0x237ea3[_0xcae2('0x4b')]['id']}})[_0xcae2('0x43')](handleEntityNotFound(_0x3ba880,null))[_0xcae2('0x43')](function(_0x354c52){if(_0x354c52){_0x15ccc6=_0x354c52;_0x25dc03[_0xcae2('0x31')]=_[_0xcae2('0x33')](db[_0xcae2('0x4f')][_0xcae2('0x2d')]);_0x25dc03[_0xcae2('0x32')]=_[_0xcae2('0x33')](_0x237ea3[_0xcae2('0x32')]);_0x25dc03[_0xcae2('0x34')]=_[_0xcae2('0x35')](_0x25dc03[_0xcae2('0x31')],_0x25dc03[_0xcae2('0x32')]);_0x3274ff[_0xcae2('0x37')]=_[_0xcae2('0x35')](_0x25dc03[_0xcae2('0x31')],qs[_0xcae2('0x36')](_0x237ea3['query'][_0xcae2('0x36')]));_0x3274ff[_0xcae2('0x37')]=_0x3274ff[_0xcae2('0x37')]['length']?_0x3274ff[_0xcae2('0x37')]:_0x25dc03[_0xcae2('0x31')];_0x3274ff[_0xcae2('0x50')]=qs[_0xcae2('0x3b')](_0x237ea3[_0xcae2('0x32')][_0xcae2('0x3b')]);_0x3274ff[_0xcae2('0x3c')]=qs[_0xcae2('0x34')](_[_0xcae2('0x3d')](_0x237ea3[_0xcae2('0x32')],_0x25dc03[_0xcae2('0x34')]));if(_0x237ea3[_0xcae2('0x32')]['filter']){_0x3274ff[_0xcae2('0x3c')]=_[_0xcae2('0x3f')](_0x3274ff[_0xcae2('0x3c')],{'$or':_[_0xcae2('0x2b')](_0x3274ff[_0xcae2('0x37')],function(_0x2cde60){var _0x483195={};_0x483195[_0x2cde60]={'$like':'%'+_0x237ea3['query'][_0xcae2('0x3e')]+'%'};return _0x483195;})});}_0x3274ff=_[_0xcae2('0x3f')]({},_0x3274ff,_0x237ea3[_0xcae2('0x41')]);return _0x15ccc6['getSubjects'](_0x3274ff);}})[_0xcae2('0x43')](function(_0x37e7dd){if(_0x37e7dd){_0x36ae42=_0x37e7dd['length'];if(!_0x237ea3['query'][_0xcae2('0x39')]('nolimit')){_0x3274ff[_0xcae2('0x1c')]=qs[_0xcae2('0x1c')](_0x237ea3[_0xcae2('0x32')][_0xcae2('0x1c')]);_0x3274ff[_0xcae2('0x1b')]=qs['offset'](_0x237ea3[_0xcae2('0x32')]['offset']);}return _0x15ccc6[_0xcae2('0x51')](_0x3274ff);}})[_0xcae2('0x43')](function(_0x132421){if(_0x132421){return _0x132421?{'count':_0x36ae42,'rows':_0x132421}:null;}})[_0xcae2('0x43')](respondWithResult(_0x3ba880,null))['catch'](handleError(_0x3ba880,null));};exports[_0xcae2('0x52')]=function(_0x4ed96a,_0x25e19f,_0x3a2776){var _0x251fe1={};var _0x582af6={};var _0x397fb6;var _0x1c21cd;return db[_0xcae2('0x2c')][_0xcae2('0x4e')]({'where':{'id':_0x4ed96a[_0xcae2('0x4b')]['id']}})[_0xcae2('0x43')](handleEntityNotFound(_0x25e19f,null))[_0xcae2('0x43')](function(_0x2217c5){if(_0x2217c5){_0x397fb6=_0x2217c5;_0x582af6['model']=_['keys'](db['VtigerField'][_0xcae2('0x2d')]);_0x582af6[_0xcae2('0x32')]=_[_0xcae2('0x33')](_0x4ed96a[_0xcae2('0x32')]);_0x582af6[_0xcae2('0x34')]=_[_0xcae2('0x35')](_0x582af6[_0xcae2('0x31')],_0x582af6[_0xcae2('0x32')]);_0x251fe1[_0xcae2('0x37')]=_[_0xcae2('0x35')](_0x582af6[_0xcae2('0x31')],qs[_0xcae2('0x36')](_0x4ed96a[_0xcae2('0x32')][_0xcae2('0x36')]));_0x251fe1[_0xcae2('0x37')]=_0x251fe1[_0xcae2('0x37')][_0xcae2('0x38')]?_0x251fe1[_0xcae2('0x37')]:_0x582af6['model'];_0x251fe1['order']=qs[_0xcae2('0x3b')](_0x4ed96a[_0xcae2('0x32')][_0xcae2('0x3b')]);_0x251fe1[_0xcae2('0x3c')]=qs[_0xcae2('0x34')](_['pick'](_0x4ed96a[_0xcae2('0x32')],_0x582af6[_0xcae2('0x34')]));if(_0x4ed96a['query'][_0xcae2('0x3e')]){_0x251fe1['where']=_[_0xcae2('0x3f')](_0x251fe1[_0xcae2('0x3c')],{'$or':_[_0xcae2('0x2b')](_0x251fe1[_0xcae2('0x37')],function(_0x11c44d){var _0x1d709d={};_0x1d709d[_0x11c44d]={'$like':'%'+_0x4ed96a[_0xcae2('0x32')][_0xcae2('0x3e')]+'%'};return _0x1d709d;})});}_0x251fe1=_[_0xcae2('0x3f')]({},_0x251fe1,_0x4ed96a[_0xcae2('0x41')]);return _0x397fb6[_0xcae2('0x52')](_0x251fe1);}})['then'](function(_0x12b350){if(_0x12b350){_0x1c21cd=_0x12b350['length'];if(!_0x4ed96a['query'][_0xcae2('0x39')](_0xcae2('0x3a'))){_0x251fe1['limit']=qs[_0xcae2('0x1c')](_0x4ed96a[_0xcae2('0x32')][_0xcae2('0x1c')]);_0x251fe1[_0xcae2('0x1b')]=qs[_0xcae2('0x1b')](_0x4ed96a[_0xcae2('0x32')]['offset']);}return _0x397fb6[_0xcae2('0x52')](_0x251fe1);}})['then'](function(_0x4671c7){if(_0x4671c7){return _0x4671c7?{'count':_0x1c21cd,'rows':_0x4671c7}:null;}})[_0xcae2('0x43')](respondWithResult(_0x25e19f,null))[_0xcae2('0x47')](handleError(_0x25e19f,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 0e9f46d..c230a48 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 _0xbcaa=['int_vtiger_configurations','util','api','moment','bluebird','request-promise','rimraf','./intVtigerConfiguration.attributes','exports','define'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0xbcaa,0xfb));var _0xabca=function(_0x387ff2,_0xba04e6){_0x387ff2=_0x387ff2-0x0;var _0x5ae05a=_0xbcaa[_0x387ff2];return _0x5ae05a;};'use strict';var _=require('lodash');var util=require(_0xabca('0x0'));var logger=require('../../config/logger')(_0xabca('0x1'));var moment=require(_0xabca('0x2'));var BPromise=require(_0xabca('0x3'));var rp=require(_0xabca('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xabca('0x5'));var config=require('../../config/environment');var attributes=require(_0xabca('0x6'));module[_0xabca('0x7')]=function(_0x5d9e2b,_0x3577ec){return _0x5d9e2b[_0xabca('0x8')]('VtigerConfiguration',attributes,{'tableName':_0xabca('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb9a5=['bluebird','request-promise','path','../../config/environment','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','int_vtiger_configurations','lodash','util','../../config/logger','api'];(function(_0x18b16d,_0x4e0caf){var _0x460100=function(_0x597429){while(--_0x597429){_0x18b16d['push'](_0x18b16d['shift']());}};_0x460100(++_0x4e0caf);}(_0xb9a5,0x7e));var _0x5b9a=function(_0x3a465a,_0x3e8001){_0x3a465a=_0x3a465a-0x0;var _0x1ed244=_0xb9a5[_0x3a465a];return _0x1ed244;};'use strict';var _=require(_0x5b9a('0x0'));var util=require(_0x5b9a('0x1'));var logger=require(_0x5b9a('0x2'))(_0x5b9a('0x3'));var moment=require('moment');var BPromise=require(_0x5b9a('0x4'));var rp=require(_0x5b9a('0x5'));var fs=require('fs');var path=require(_0x5b9a('0x6'));var rimraf=require('rimraf');var config=require(_0x5b9a('0x7'));var attributes=require(_0x5b9a('0x8'));module[_0x5b9a('0x9')]=function(_0x3c6169,_0x4e8600){return _0x3c6169[_0x5b9a('0xa')](_0x5b9a('0xb'),attributes,{'tableName':_0x5b9a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js index 9d65658..cdad8fb 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 _0xe355=['stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0xdf10cc,_0x407dd4){var _0x487392=function(_0x55c2ab){while(--_0x55c2ab){_0xdf10cc['push'](_0xdf10cc['shift']());}};_0x487392(++_0x407dd4);}(_0xe355,0xb3));var _0x5e35=function(_0x36d9ea,_0x43941c){_0x36d9ea=_0x36d9ea-0x0;var _0x5093ed=_0xe355[_0x36d9ea];return _0x5093ed;};'use strict';var _=require(_0x5e35('0x0'));var util=require(_0x5e35('0x1'));var moment=require(_0x5e35('0x2'));var BPromise=require(_0x5e35('0x3'));var rs=require(_0x5e35('0x4'));var fs=require('fs');var Redis=require(_0x5e35('0x5'));var db=require(_0x5e35('0x6'))['db'];var utils=require(_0x5e35('0x7'));var logger=require(_0x5e35('0x8'))(_0x5e35('0x9'));var config=require(_0x5e35('0xa'));var jayson=require(_0x5e35('0xb'));var client=jayson[_0x5e35('0xc')][_0x5e35('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x27befc,_0x50e31e,_0x21a0ff){return new BPromise(function(_0x14c99f,_0x33fba1){return client[_0x5e35('0xe')](_0x27befc,_0x21a0ff)[_0x5e35('0xf')](function(_0x244f52){logger[_0x5e35('0x10')](_0x5e35('0x11'),_0x50e31e,_0x5e35('0x12'));logger[_0x5e35('0x13')](_0x5e35('0x14'),_0x50e31e,'request\x20sent',JSON[_0x5e35('0x15')](_0x244f52));if(_0x244f52['error']){if(_0x244f52[_0x5e35('0x16')]['code']===0x1f4){logger[_0x5e35('0x16')](_0x5e35('0x11'),_0x50e31e,_0x244f52[_0x5e35('0x16')][_0x5e35('0x17')]);return _0x33fba1(_0x244f52[_0x5e35('0x16')][_0x5e35('0x17')]);}logger[_0x5e35('0x16')](_0x5e35('0x11'),_0x50e31e,_0x244f52['error'][_0x5e35('0x17')]);return _0x14c99f(_0x244f52[_0x5e35('0x16')][_0x5e35('0x17')]);}else{logger[_0x5e35('0x10')](_0x5e35('0x11'),_0x50e31e,'request\x20sent');_0x14c99f(_0x244f52['result'][_0x5e35('0x17')]);}})[_0x5e35('0x18')](function(_0x30e6fb){logger[_0x5e35('0x16')]('VtigerConfiguration,\x20%s,\x20%s',_0x50e31e,_0x30e6fb);_0x33fba1(_0x30e6fb);});});} \ No newline at end of file +var _0xec5b=['../../config/environment','jayson/promise','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc'];(function(_0xe22583,_0xde41d7){var _0xfb2392=function(_0x2e14f0){while(--_0x2e14f0){_0xe22583['push'](_0xe22583['shift']());}};_0xfb2392(++_0xde41d7);}(_0xec5b,0x1c5));var _0xbec5=function(_0x269603,_0x2df57b){_0x269603=_0x269603-0x0;var _0x48b22b=_0xec5b[_0x269603];return _0x48b22b;};'use strict';var _=require(_0xbec5('0x0'));var util=require(_0xbec5('0x1'));var moment=require(_0xbec5('0x2'));var BPromise=require(_0xbec5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbec5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbec5('0x5'));var logger=require('../../config/logger')(_0xbec5('0x6'));var config=require(_0xbec5('0x7'));var jayson=require(_0xbec5('0x8'));var client=jayson['client'][_0xbec5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x162cac,_0x2b84d1,_0x5b9e03){return new BPromise(function(_0x566e79,_0x3f3b8c){return client[_0xbec5('0xa')](_0x162cac,_0x5b9e03)[_0xbec5('0xb')](function(_0xd6558d){logger[_0xbec5('0xc')](_0xbec5('0xd'),_0x2b84d1,_0xbec5('0xe'));logger[_0xbec5('0xf')](_0xbec5('0x10'),_0x2b84d1,_0xbec5('0xe'),JSON[_0xbec5('0x11')](_0xd6558d));if(_0xd6558d[_0xbec5('0x12')]){if(_0xd6558d[_0xbec5('0x12')][_0xbec5('0x13')]===0x1f4){logger[_0xbec5('0x12')](_0xbec5('0xd'),_0x2b84d1,_0xd6558d['error']['message']);return _0x3f3b8c(_0xd6558d[_0xbec5('0x12')][_0xbec5('0x14')]);}logger['error'](_0xbec5('0xd'),_0x2b84d1,_0xd6558d[_0xbec5('0x12')][_0xbec5('0x14')]);return _0x566e79(_0xd6558d[_0xbec5('0x12')]['message']);}else{logger[_0xbec5('0xc')]('VtigerConfiguration,\x20%s,\x20%s',_0x2b84d1,_0xbec5('0xe'));_0x566e79(_0xd6558d[_0xbec5('0x15')][_0xbec5('0x14')]);}})[_0xbec5('0x16')](function(_0x54e629){logger[_0xbec5('0x12')](_0xbec5('0xd'),_0x2b84d1,_0x54e629);_0x3f3b8c(_0x54e629);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 0ea1ebd..9f7050f 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 _0x8ca7=['multer','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy'];(function(_0x3b41b5,_0x36da8b){var _0xc30195=function(_0x2f663e){while(--_0x2f663e){_0x3b41b5['push'](_0x3b41b5['shift']());}};_0xc30195(++_0x36da8b);}(_0x8ca7,0x130));var _0x78ca=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8ca7[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x78ca('0x0'));var util=require(_0x78ca('0x1'));var path=require(_0x78ca('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x78ca('0x3'));var auth=require(_0x78ca('0x4'));var interaction=require(_0x78ca('0x5'));var config=require('../../config/environment');var controller=require('./intVtigerField.controller');router[_0x78ca('0x6')]('/',auth[_0x78ca('0x7')](),controller[_0x78ca('0x8')]);router['get'](_0x78ca('0x9'),auth[_0x78ca('0x7')](),controller[_0x78ca('0xa')]);router[_0x78ca('0xb')]('/',auth[_0x78ca('0x7')](),controller[_0x78ca('0xc')]);router[_0x78ca('0xd')]('/:id',auth[_0x78ca('0x7')](),controller['update']);router[_0x78ca('0xe')](_0x78ca('0x9'),auth['isAuthenticated'](),controller[_0x78ca('0xf')]);module['exports']=router; \ No newline at end of file +var _0xca7a=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intVtigerField.controller','get','isAuthenticated','index','/:id','post','update','delete','destroy','exports','multer'];(function(_0x231adb,_0x26a8ca){var _0x49f558=function(_0x13b0b6){while(--_0x13b0b6){_0x231adb['push'](_0x231adb['shift']());}};_0x49f558(++_0x26a8ca);}(_0xca7a,0x6b));var _0xaca7=function(_0x3d8ca8,_0x1a9764){_0x3d8ca8=_0x3d8ca8-0x0;var _0x517e45=_0xca7a[_0x3d8ca8];return _0x517e45;};'use strict';var multer=require(_0xaca7('0x0'));var util=require('util');var path=require(_0xaca7('0x1'));var timeout=require(_0xaca7('0x2'));var express=require(_0xaca7('0x3'));var router=express[_0xaca7('0x4')]();var fs_extra=require(_0xaca7('0x5'));var auth=require(_0xaca7('0x6'));var interaction=require(_0xaca7('0x7'));var config=require('../../config/environment');var controller=require(_0xaca7('0x8'));router[_0xaca7('0x9')]('/',auth[_0xaca7('0xa')](),controller[_0xaca7('0xb')]);router[_0xaca7('0x9')](_0xaca7('0xc'),auth[_0xaca7('0xa')](),controller['show']);router[_0xaca7('0xd')]('/',auth[_0xaca7('0xa')](),controller['create']);router['put'](_0xaca7('0xc'),auth[_0xaca7('0xa')](),controller[_0xaca7('0xe')]);router[_0xaca7('0xf')](_0xaca7('0xc'),auth[_0xaca7('0xa')](),controller[_0xaca7('0x10')]);module[_0xaca7('0x11')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index f5a78ca..3408dd3 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 _0x7108=['picklist','string','STRING','ENUM','BOOLEAN','sequelize','exports','variable','customVariable','keyValue'];(function(_0x2a4f3b,_0x8a4a19){var _0x3d06fc=function(_0x4fe910){while(--_0x4fe910){_0x2a4f3b['push'](_0x2a4f3b['shift']());}};_0x3d06fc(++_0x8a4a19);}(_0x7108,0x1c7));var _0x8710=function(_0x236ef9,_0x375088){_0x236ef9=_0x236ef9-0x0;var _0x9d064=_0x7108[_0x236ef9];return _0x9d064;};'use strict';var Sequelize=require(_0x8710('0x0'));module[_0x8710('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x8710('0x2'),_0x8710('0x3'),_0x8710('0x4'),_0x8710('0x5')),'defaultValue':_0x8710('0x6')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x8710('0x7')]},'keyType':{'type':Sequelize[_0x8710('0x8')]('string',_0x8710('0x2'),_0x8710('0x3'))},'keyContent':{'type':Sequelize[_0x8710('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x8710('0x7')]},'customField':{'type':Sequelize[_0x8710('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8710('0x7')]}}; \ No newline at end of file +var _0xa8e1=['variable','sequelize','ENUM','string','customVariable','picklist','STRING'];(function(_0x4646e8,_0x456f78){var _0x53f7c2=function(_0x550233){while(--_0x550233){_0x4646e8['push'](_0x4646e8['shift']());}};_0x53f7c2(++_0x456f78);}(_0xa8e1,0xd3));var _0x1a8e=function(_0x2abc3d,_0x48edca){_0x2abc3d=_0x2abc3d-0x0;var _0x252745=_0xa8e1[_0x2abc3d];return _0x252745;};'use strict';var Sequelize=require(_0x1a8e('0x0'));module['exports']={'type':{'type':Sequelize[_0x1a8e('0x1')](_0x1a8e('0x2'),'variable',_0x1a8e('0x3'),'keyValue',_0x1a8e('0x4')),'defaultValue':_0x1a8e('0x2')},'content':{'type':Sequelize[_0x1a8e('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x1a8e('0x1')](_0x1a8e('0x2'),_0x1a8e('0x6'),_0x1a8e('0x3'))},'keyContent':{'type':Sequelize[_0x1a8e('0x5')]},'idField':{'type':Sequelize[_0x1a8e('0x5')]},'nameField':{'type':Sequelize[_0x1a8e('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1a8e('0x5')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index e798fcb..097ac90 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 _0x3488=['../../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','Content-Range','apply','reject','update','then','destroy','end','error','name','send','index','map','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','catch','show','params','keys','VtigerField','includeAll','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x39e2bc,_0x3d2efd){var _0x1cc251=function(_0x524372){while(--_0x524372){_0x39e2bc['push'](_0x39e2bc['shift']());}};_0x1cc251(++_0x3d2efd);}(_0x3488,0x1b4));var _0x8348=function(_0x4ca6ab,_0x29bc6c){_0x4ca6ab=_0x4ca6ab-0x0;var _0x516678=_0x3488[_0x4ca6ab];return _0x516678;};'use strict';var emlformat=require(_0x8348('0x0'));var rimraf=require(_0x8348('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8348('0x2'));var rp=require(_0x8348('0x3'));var moment=require(_0x8348('0x4'));var BPromise=require(_0x8348('0x5'));var Mustache=require('mustache');var util=require(_0x8348('0x6'));var path=require(_0x8348('0x7'));var sox=require(_0x8348('0x8'));var csv=require(_0x8348('0x9'));var ejs=require(_0x8348('0xa'));var fs=require('fs');var fs_extra=require(_0x8348('0xb'));var _=require(_0x8348('0xc'));var squel=require('squel');var crypto=require(_0x8348('0xd'));var jsforce=require(_0x8348('0xe'));var deskjs=require(_0x8348('0xf'));var toCsv=require(_0x8348('0x9'));var querystring=require(_0x8348('0x10'));var Papa=require(_0x8348('0x11'));var Redis=require(_0x8348('0x12'));var authService=require(_0x8348('0x13'));var qs=require(_0x8348('0x14'));var as=require(_0x8348('0x15'));var hardwareService=require(_0x8348('0x16'));var logger=require(_0x8348('0x17'))(_0x8348('0x18'));var utils=require(_0x8348('0x19'));var config=require(_0x8348('0x1a'));var licenseUtil=require(_0x8348('0x1b'));var db=require(_0x8348('0x1c'))['db'];function respondWithStatusCode(_0x5c87a8,_0x170225){_0x170225=_0x170225||0xcc;return function(_0x4d33c7){if(_0x4d33c7){return _0x5c87a8[_0x8348('0x1d')](_0x170225);}return _0x5c87a8[_0x8348('0x1e')](_0x170225)['end']();};}function respondWithResult(_0x29a335,_0x34ef7a){_0x34ef7a=_0x34ef7a||0xc8;return function(_0x20924d){if(_0x20924d){return _0x29a335['status'](_0x34ef7a)[_0x8348('0x1f')](_0x20924d);}};}function respondWithFilteredResult(_0x1fb06a,_0xa73e93){return function(_0x5acb74){if(_0x5acb74){var _0x1526f3=typeof _0xa73e93[_0x8348('0x20')]===_0x8348('0x21')&&typeof _0xa73e93[_0x8348('0x22')]===_0x8348('0x21');var _0x2db392=_0x5acb74[_0x8348('0x23')];var _0x345a60=_0x1526f3?0x0:_0xa73e93[_0x8348('0x20')];var _0x462a59=_0x1526f3?_0x5acb74[_0x8348('0x23')]:_0xa73e93[_0x8348('0x20')]+_0xa73e93[_0x8348('0x22')];var _0x1d3f33;if(_0x462a59>=_0x2db392){_0x462a59=_0x2db392;_0x1d3f33=0xc8;}else{_0x1d3f33=0xce;}_0x1fb06a[_0x8348('0x1e')](_0x1d3f33);return _0x1fb06a['set'](_0x8348('0x24'),_0x345a60+'-'+_0x462a59+'/'+_0x2db392)[_0x8348('0x1f')](_0x5acb74);}return null;};}function patchUpdates(_0x4d12e1){return function(_0x54b8f6){try{jsonpatch[_0x8348('0x25')](_0x54b8f6,_0x4d12e1,!![]);}catch(_0x88a011){return BPromise[_0x8348('0x26')](_0x88a011);}return _0x54b8f6['save']();};}function saveUpdates(_0x1035c7,_0x35dea0){return function(_0x566e06){if(_0x566e06){return _0x566e06[_0x8348('0x27')](_0x1035c7)[_0x8348('0x28')](function(_0x438c9b){return _0x438c9b;});}return null;};}function removeEntity(_0x3c3206,_0x4f72e6){return function(_0x4ac113){if(_0x4ac113){return _0x4ac113[_0x8348('0x29')]()[_0x8348('0x28')](function(){_0x3c3206[_0x8348('0x1e')](0xcc)[_0x8348('0x2a')]();});}};}function handleEntityNotFound(_0x1338a8,_0x15c813){return function(_0x104a95){if(!_0x104a95){_0x1338a8['sendStatus'](0x194);}return _0x104a95;};}function handleError(_0x1f11e8,_0x2609a8){_0x2609a8=_0x2609a8||0x1f4;return function(_0x527225){logger[_0x8348('0x2b')](_0x527225['stack']);if(_0x527225[_0x8348('0x2c')]){delete _0x527225['name'];}_0x1f11e8[_0x8348('0x1e')](_0x2609a8)[_0x8348('0x2d')](_0x527225);};}exports[_0x8348('0x2e')]=function(_0x5b6853,_0x5959b0){var _0x11ec03={},_0xbb8315={},_0x13d837={'count':0x0,'rows':[]};var _0x1f8f1b=_[_0x8348('0x2f')](db['VtigerField'][_0x8348('0x30')],function(_0x2ef236){return{'name':_0x2ef236['fieldName'],'type':_0x2ef236[_0x8348('0x31')][_0x8348('0x32')]};});_0xbb8315[_0x8348('0x33')]=_[_0x8348('0x2f')](_0x1f8f1b,'name');_0xbb8315[_0x8348('0x34')]=_['keys'](_0x5b6853['query']);_0xbb8315[_0x8348('0x35')]=_[_0x8348('0x36')](_0xbb8315[_0x8348('0x33')],_0xbb8315[_0x8348('0x34')]);_0x11ec03[_0x8348('0x37')]=_[_0x8348('0x36')](_0xbb8315[_0x8348('0x33')],qs[_0x8348('0x38')](_0x5b6853[_0x8348('0x34')][_0x8348('0x38')]));_0x11ec03['attributes']=_0x11ec03[_0x8348('0x37')][_0x8348('0x39')]?_0x11ec03[_0x8348('0x37')]:_0xbb8315[_0x8348('0x33')];if(!_0x5b6853[_0x8348('0x34')]['hasOwnProperty']('nolimit')){_0x11ec03['limit']=qs[_0x8348('0x22')](_0x5b6853[_0x8348('0x34')][_0x8348('0x22')]);_0x11ec03['offset']=qs[_0x8348('0x20')](_0x5b6853[_0x8348('0x34')][_0x8348('0x20')]);}_0x11ec03['order']=qs[_0x8348('0x3a')](_0x5b6853[_0x8348('0x34')][_0x8348('0x3a')]);_0x11ec03[_0x8348('0x3b')]=qs['filters'](_[_0x8348('0x3c')](_0x5b6853[_0x8348('0x34')],_0xbb8315[_0x8348('0x35')]),_0x1f8f1b);if(_0x5b6853[_0x8348('0x34')][_0x8348('0x3d')]){_0x11ec03[_0x8348('0x3b')]=_[_0x8348('0x3e')](_0x11ec03[_0x8348('0x3b')],{'$or':_[_0x8348('0x2f')](_0x1f8f1b,function(_0x5ed83c){if(_0x5ed83c[_0x8348('0x31')]!==_0x8348('0x3f')){var _0x4da587={};_0x4da587[_0x5ed83c[_0x8348('0x2c')]]={'$like':'%'+_0x5b6853[_0x8348('0x34')]['filter']+'%'};return _0x4da587;}})});}_0x11ec03=_[_0x8348('0x3e')]({},_0x11ec03,_0x5b6853[_0x8348('0x40')]);var _0x3fafc4={'where':_0x11ec03[_0x8348('0x3b')]};return db['VtigerField'][_0x8348('0x23')](_0x3fafc4)[_0x8348('0x28')](function(_0x287b38){_0x13d837[_0x8348('0x23')]=_0x287b38;if(_0x5b6853['query']['includeAll']){_0x11ec03[_0x8348('0x41')]=[{'all':!![]}];}return db['VtigerField']['findAll'](_0x11ec03);})[_0x8348('0x28')](function(_0x42c58f){_0x13d837[_0x8348('0x42')]=_0x42c58f;return _0x13d837;})['then'](respondWithFilteredResult(_0x5959b0,_0x11ec03))[_0x8348('0x43')](handleError(_0x5959b0,null));};exports[_0x8348('0x44')]=function(_0x3800e7,_0x453e36){var _0x563ff5={'raw':!![],'where':{'id':_0x3800e7[_0x8348('0x45')]['id']}},_0x2ff74c={};_0x2ff74c[_0x8348('0x33')]=_[_0x8348('0x46')](db[_0x8348('0x47')][_0x8348('0x30')]);_0x2ff74c['query']=_[_0x8348('0x46')](_0x3800e7['query']);_0x2ff74c['filters']=_['intersection'](_0x2ff74c['model'],_0x2ff74c['query']);_0x563ff5['attributes']=_[_0x8348('0x36')](_0x2ff74c[_0x8348('0x33')],qs[_0x8348('0x38')](_0x3800e7['query'][_0x8348('0x38')]));_0x563ff5['attributes']=_0x563ff5[_0x8348('0x37')]['length']?_0x563ff5['attributes']:_0x2ff74c[_0x8348('0x33')];if(_0x3800e7[_0x8348('0x34')][_0x8348('0x48')]){_0x563ff5['include']=[{'all':!![]}];}_0x563ff5=_[_0x8348('0x3e')]({},_0x563ff5,_0x3800e7[_0x8348('0x40')]);return db[_0x8348('0x47')][_0x8348('0x49')](_0x563ff5)['then'](handleEntityNotFound(_0x453e36,null))[_0x8348('0x28')](respondWithResult(_0x453e36,null))[_0x8348('0x43')](handleError(_0x453e36,null));};exports[_0x8348('0x4a')]=function(_0x277a2e,_0x3b2b72){return db[_0x8348('0x47')]['create'](_0x277a2e[_0x8348('0x4b')],{})[_0x8348('0x28')](respondWithResult(_0x3b2b72,0xc9))[_0x8348('0x43')](handleError(_0x3b2b72,null));};exports[_0x8348('0x27')]=function(_0x192989,_0x41aaa6){if(_0x192989[_0x8348('0x4b')]['id']){delete _0x192989[_0x8348('0x4b')]['id'];}return db['VtigerField']['find']({'where':{'id':_0x192989[_0x8348('0x45')]['id']}})[_0x8348('0x28')](handleEntityNotFound(_0x41aaa6,null))[_0x8348('0x28')](saveUpdates(_0x192989[_0x8348('0x4b')],null))[_0x8348('0x28')](respondWithResult(_0x41aaa6,null))[_0x8348('0x43')](handleError(_0x41aaa6,null));};exports[_0x8348('0x29')]=function(_0x26dbf8,_0x36a296){return db[_0x8348('0x47')][_0x8348('0x49')]({'where':{'id':_0x26dbf8[_0x8348('0x45')]['id']}})[_0x8348('0x28')](handleEntityNotFound(_0x36a296,null))[_0x8348('0x28')](removeEntity(_0x36a296,null))[_0x8348('0x43')](handleError(_0x36a296,null));}; \ No newline at end of file +var _0x64fa=['limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','options','VtigerField','include','findAll','catch','show','params','keys','includeAll','find','create','body','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','sendStatus','status','end','json','offset','undefined'];(function(_0x520c52,_0x477db4){var _0x1bd6c4=function(_0x5b4c39){while(--_0x5b4c39){_0x520c52['push'](_0x520c52['shift']());}};_0x1bd6c4(++_0x477db4);}(_0x64fa,0xbf));var _0xa64f=function(_0x662949,_0xfe856d){_0x662949=_0x662949-0x0;var _0x358966=_0x64fa[_0x662949];return _0x358966;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa64f('0x0'));var rp=require(_0xa64f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa64f('0x2'));var util=require(_0xa64f('0x3'));var path=require(_0xa64f('0x4'));var sox=require(_0xa64f('0x5'));var csv=require(_0xa64f('0x6'));var ejs=require(_0xa64f('0x7'));var fs=require('fs');var fs_extra=require(_0xa64f('0x8'));var _=require(_0xa64f('0x9'));var squel=require(_0xa64f('0xa'));var crypto=require(_0xa64f('0xb'));var jsforce=require(_0xa64f('0xc'));var deskjs=require(_0xa64f('0xd'));var toCsv=require(_0xa64f('0x6'));var querystring=require(_0xa64f('0xe'));var Papa=require(_0xa64f('0xf'));var Redis=require(_0xa64f('0x10'));var authService=require(_0xa64f('0x11'));var qs=require(_0xa64f('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa64f('0x13'));var logger=require(_0xa64f('0x14'))(_0xa64f('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2172ab,_0xbd040){_0xbd040=_0xbd040||0xcc;return function(_0x48fad5){if(_0x48fad5){return _0x2172ab[_0xa64f('0x16')](_0xbd040);}return _0x2172ab[_0xa64f('0x17')](_0xbd040)[_0xa64f('0x18')]();};}function respondWithResult(_0x434d16,_0x3c0713){_0x3c0713=_0x3c0713||0xc8;return function(_0x80cba){if(_0x80cba){return _0x434d16[_0xa64f('0x17')](_0x3c0713)[_0xa64f('0x19')](_0x80cba);}};}function respondWithFilteredResult(_0x32e63d,_0x1f458f){return function(_0x153e97){if(_0x153e97){var _0x3a8b63=typeof _0x1f458f[_0xa64f('0x1a')]===_0xa64f('0x1b')&&typeof _0x1f458f[_0xa64f('0x1c')]===_0xa64f('0x1b');var _0x4a308d=_0x153e97[_0xa64f('0x1d')];var _0x3872b5=_0x3a8b63?0x0:_0x1f458f[_0xa64f('0x1a')];var _0x1fe514=_0x3a8b63?_0x153e97[_0xa64f('0x1d')]:_0x1f458f[_0xa64f('0x1a')]+_0x1f458f['limit'];var _0x321e1d;if(_0x1fe514>=_0x4a308d){_0x1fe514=_0x4a308d;_0x321e1d=0xc8;}else{_0x321e1d=0xce;}_0x32e63d[_0xa64f('0x17')](_0x321e1d);return _0x32e63d[_0xa64f('0x1e')](_0xa64f('0x1f'),_0x3872b5+'-'+_0x1fe514+'/'+_0x4a308d)[_0xa64f('0x19')](_0x153e97);}return null;};}function patchUpdates(_0x42fb77){return function(_0x3aea0b){try{jsonpatch[_0xa64f('0x20')](_0x3aea0b,_0x42fb77,!![]);}catch(_0x2f38fe){return BPromise[_0xa64f('0x21')](_0x2f38fe);}return _0x3aea0b[_0xa64f('0x22')]();};}function saveUpdates(_0x34244a,_0xf850d7){return function(_0x155f95){if(_0x155f95){return _0x155f95[_0xa64f('0x23')](_0x34244a)[_0xa64f('0x24')](function(_0xd18fbd){return _0xd18fbd;});}return null;};}function removeEntity(_0x438215,_0x54c003){return function(_0x1c6c16){if(_0x1c6c16){return _0x1c6c16[_0xa64f('0x25')]()[_0xa64f('0x24')](function(){_0x438215['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x9a129,_0x4ef21a){return function(_0x4b4d53){if(!_0x4b4d53){_0x9a129[_0xa64f('0x16')](0x194);}return _0x4b4d53;};}function handleError(_0xdff191,_0x3d3c1d){_0x3d3c1d=_0x3d3c1d||0x1f4;return function(_0x34ee71){logger[_0xa64f('0x26')](_0x34ee71[_0xa64f('0x27')]);if(_0x34ee71['name']){delete _0x34ee71[_0xa64f('0x28')];}_0xdff191[_0xa64f('0x17')](_0x3d3c1d)[_0xa64f('0x29')](_0x34ee71);};}exports[_0xa64f('0x2a')]=function(_0x4d1b6f,_0x5e6b15){var _0x5899fb={},_0xbf94ed={},_0x33f1a7={'count':0x0,'rows':[]};var _0x1037d2=_[_0xa64f('0x2b')](db['VtigerField'][_0xa64f('0x2c')],function(_0x573c15){return{'name':_0x573c15['fieldName'],'type':_0x573c15[_0xa64f('0x2d')][_0xa64f('0x2e')]};});_0xbf94ed['model']=_[_0xa64f('0x2b')](_0x1037d2,_0xa64f('0x28'));_0xbf94ed[_0xa64f('0x2f')]=_['keys'](_0x4d1b6f[_0xa64f('0x2f')]);_0xbf94ed[_0xa64f('0x30')]=_[_0xa64f('0x31')](_0xbf94ed[_0xa64f('0x32')],_0xbf94ed[_0xa64f('0x2f')]);_0x5899fb[_0xa64f('0x33')]=_[_0xa64f('0x31')](_0xbf94ed[_0xa64f('0x32')],qs[_0xa64f('0x34')](_0x4d1b6f[_0xa64f('0x2f')][_0xa64f('0x34')]));_0x5899fb[_0xa64f('0x33')]=_0x5899fb[_0xa64f('0x33')][_0xa64f('0x35')]?_0x5899fb[_0xa64f('0x33')]:_0xbf94ed[_0xa64f('0x32')];if(!_0x4d1b6f[_0xa64f('0x2f')][_0xa64f('0x36')]('nolimit')){_0x5899fb[_0xa64f('0x1c')]=qs[_0xa64f('0x1c')](_0x4d1b6f['query'][_0xa64f('0x1c')]);_0x5899fb[_0xa64f('0x1a')]=qs[_0xa64f('0x1a')](_0x4d1b6f[_0xa64f('0x2f')]['offset']);}_0x5899fb[_0xa64f('0x37')]=qs[_0xa64f('0x38')](_0x4d1b6f[_0xa64f('0x2f')][_0xa64f('0x38')]);_0x5899fb[_0xa64f('0x39')]=qs[_0xa64f('0x30')](_[_0xa64f('0x3a')](_0x4d1b6f[_0xa64f('0x2f')],_0xbf94ed[_0xa64f('0x30')]),_0x1037d2);if(_0x4d1b6f[_0xa64f('0x2f')][_0xa64f('0x3b')]){_0x5899fb['where']=_['merge'](_0x5899fb[_0xa64f('0x39')],{'$or':_[_0xa64f('0x2b')](_0x1037d2,function(_0x1764e0){if(_0x1764e0[_0xa64f('0x2d')]!==_0xa64f('0x3c')){var _0x45270d={};_0x45270d[_0x1764e0['name']]={'$like':'%'+_0x4d1b6f[_0xa64f('0x2f')]['filter']+'%'};return _0x45270d;}})});}_0x5899fb=_['merge']({},_0x5899fb,_0x4d1b6f[_0xa64f('0x3d')]);var _0x2f4eb1={'where':_0x5899fb[_0xa64f('0x39')]};return db[_0xa64f('0x3e')][_0xa64f('0x1d')](_0x2f4eb1)[_0xa64f('0x24')](function(_0x5c430f){_0x33f1a7[_0xa64f('0x1d')]=_0x5c430f;if(_0x4d1b6f[_0xa64f('0x2f')]['includeAll']){_0x5899fb[_0xa64f('0x3f')]=[{'all':!![]}];}return db['VtigerField'][_0xa64f('0x40')](_0x5899fb);})[_0xa64f('0x24')](function(_0x3c0b4b){_0x33f1a7['rows']=_0x3c0b4b;return _0x33f1a7;})['then'](respondWithFilteredResult(_0x5e6b15,_0x5899fb))[_0xa64f('0x41')](handleError(_0x5e6b15,null));};exports[_0xa64f('0x42')]=function(_0x3c4de0,_0x44ff02){var _0x1ad278={'raw':!![],'where':{'id':_0x3c4de0[_0xa64f('0x43')]['id']}},_0x41da90={};_0x41da90[_0xa64f('0x32')]=_[_0xa64f('0x44')](db[_0xa64f('0x3e')]['rawAttributes']);_0x41da90[_0xa64f('0x2f')]=_['keys'](_0x3c4de0[_0xa64f('0x2f')]);_0x41da90[_0xa64f('0x30')]=_[_0xa64f('0x31')](_0x41da90[_0xa64f('0x32')],_0x41da90[_0xa64f('0x2f')]);_0x1ad278['attributes']=_[_0xa64f('0x31')](_0x41da90[_0xa64f('0x32')],qs['fields'](_0x3c4de0['query'][_0xa64f('0x34')]));_0x1ad278[_0xa64f('0x33')]=_0x1ad278[_0xa64f('0x33')][_0xa64f('0x35')]?_0x1ad278[_0xa64f('0x33')]:_0x41da90[_0xa64f('0x32')];if(_0x3c4de0[_0xa64f('0x2f')][_0xa64f('0x45')]){_0x1ad278[_0xa64f('0x3f')]=[{'all':!![]}];}_0x1ad278=_['merge']({},_0x1ad278,_0x3c4de0[_0xa64f('0x3d')]);return db[_0xa64f('0x3e')][_0xa64f('0x46')](_0x1ad278)[_0xa64f('0x24')](handleEntityNotFound(_0x44ff02,null))[_0xa64f('0x24')](respondWithResult(_0x44ff02,null))[_0xa64f('0x41')](handleError(_0x44ff02,null));};exports[_0xa64f('0x47')]=function(_0x13b7da,_0xcfacef){return db[_0xa64f('0x3e')]['create'](_0x13b7da[_0xa64f('0x48')],{})[_0xa64f('0x24')](respondWithResult(_0xcfacef,0xc9))[_0xa64f('0x41')](handleError(_0xcfacef,null));};exports[_0xa64f('0x23')]=function(_0x229bcc,_0x5d1fb2){if(_0x229bcc[_0xa64f('0x48')]['id']){delete _0x229bcc[_0xa64f('0x48')]['id'];}return db[_0xa64f('0x3e')][_0xa64f('0x46')]({'where':{'id':_0x229bcc[_0xa64f('0x43')]['id']}})[_0xa64f('0x24')](handleEntityNotFound(_0x5d1fb2,null))[_0xa64f('0x24')](saveUpdates(_0x229bcc[_0xa64f('0x48')],null))[_0xa64f('0x24')](respondWithResult(_0x5d1fb2,null))['catch'](handleError(_0x5d1fb2,null));};exports[_0xa64f('0x25')]=function(_0x5de979,_0x54b062){return db[_0xa64f('0x3e')][_0xa64f('0x46')]({'where':{'id':_0x5de979[_0xa64f('0x43')]['id']}})[_0xa64f('0x24')](handleEntityNotFound(_0x54b062,null))[_0xa64f('0x24')](removeEntity(_0x54b062,null))['catch'](handleError(_0x54b062,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index e66af43..a37a068 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 _0x0919=['request-promise','path','rimraf','../../config/environment','./intVtigerField.attributes','define','VtigerField','int_vtiger_fields','vtiger_unique_index','idField','FieldId','util','api','moment','bluebird'];(function(_0x25c7fb,_0x2e4e86){var _0x214b77=function(_0x36b7c0){while(--_0x36b7c0){_0x25c7fb['push'](_0x25c7fb['shift']());}};_0x214b77(++_0x2e4e86);}(_0x0919,0x65));var _0x9091=function(_0x55d6d9,_0x4b0d00){_0x55d6d9=_0x55d6d9-0x0;var _0x2cdb30=_0x0919[_0x55d6d9];return _0x2cdb30;};'use strict';var _=require('lodash');var util=require(_0x9091('0x0'));var logger=require('../../config/logger')(_0x9091('0x1'));var moment=require(_0x9091('0x2'));var BPromise=require(_0x9091('0x3'));var rp=require(_0x9091('0x4'));var fs=require('fs');var path=require(_0x9091('0x5'));var rimraf=require(_0x9091('0x6'));var config=require(_0x9091('0x7'));var attributes=require(_0x9091('0x8'));module['exports']=function(_0x17893f,_0x490860){return _0x17893f[_0x9091('0x9')](_0x9091('0xa'),attributes,{'tableName':_0x9091('0xb'),'paranoid':![],'indexes':[{'name':_0x9091('0xc'),'fields':[_0x9091('0xd'),_0x9091('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd822=['util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./intVtigerField.attributes','int_vtiger_fields','vtiger_unique_index','idField','FieldId','lodash'];(function(_0x622035,_0x1a4b91){var _0x326cf2=function(_0x5c3002){while(--_0x5c3002){_0x622035['push'](_0x622035['shift']());}};_0x326cf2(++_0x1a4b91);}(_0xd822,0xa8));var _0x2d82=function(_0x4c2fa3,_0x508c0c){_0x4c2fa3=_0x4c2fa3-0x0;var _0x51d327=_0xd822[_0x4c2fa3];return _0x51d327;};'use strict';var _=require(_0x2d82('0x0'));var util=require(_0x2d82('0x1'));var logger=require(_0x2d82('0x2'))('api');var moment=require(_0x2d82('0x3'));var BPromise=require(_0x2d82('0x4'));var rp=require(_0x2d82('0x5'));var fs=require('fs');var path=require(_0x2d82('0x6'));var rimraf=require('rimraf');var config=require(_0x2d82('0x7'));var attributes=require(_0x2d82('0x8'));module['exports']=function(_0x550eed,_0x7f807d){return _0x550eed['define']('VtigerField',attributes,{'tableName':_0x2d82('0x9'),'paranoid':![],'indexes':[{'name':_0x2d82('0xa'),'fields':[_0x2d82('0xb'),_0x2d82('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index ecd906c..83599d8 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 _0xb051=['rpc','jayson/promise','client','request','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','error','VtigerField,\x20%s,\x20%s','message','info','result','catch','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x2a8860,_0x2da926){var _0x2f47a4=function(_0x3b7f54){while(--_0x3b7f54){_0x2a8860['push'](_0x2a8860['shift']());}};_0x2f47a4(++_0x2da926);}(_0xb051,0xb7));var _0x1b05=function(_0x1fd675,_0x165dfe){_0x1fd675=_0x1fd675-0x0;var _0x16b554=_0xb051[_0x1fd675];return _0x16b554;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1b05('0x0'));var fs=require('fs');var Redis=require(_0x1b05('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0x1b05('0x2'));var logger=require(_0x1b05('0x3'))(_0x1b05('0x4'));var config=require('../../config/environment');var jayson=require(_0x1b05('0x5'));var client=jayson[_0x1b05('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b7280,_0x2c5361,_0x32fdf3){return new BPromise(function(_0x3d0a76,_0x413ec1){return client[_0x1b05('0x7')](_0x3b7280,_0x32fdf3)['then'](function(_0xc231ff){logger['info']('VtigerField,\x20%s,\x20%s',_0x2c5361,_0x1b05('0x8'));logger[_0x1b05('0x9')](_0x1b05('0xa'),_0x2c5361,_0x1b05('0x8'),JSON['stringify'](_0xc231ff));if(_0xc231ff[_0x1b05('0xb')]){if(_0xc231ff[_0x1b05('0xb')]['code']===0x1f4){logger[_0x1b05('0xb')](_0x1b05('0xc'),_0x2c5361,_0xc231ff[_0x1b05('0xb')][_0x1b05('0xd')]);return _0x413ec1(_0xc231ff[_0x1b05('0xb')][_0x1b05('0xd')]);}logger[_0x1b05('0xb')](_0x1b05('0xc'),_0x2c5361,_0xc231ff[_0x1b05('0xb')][_0x1b05('0xd')]);return _0x3d0a76(_0xc231ff['error'][_0x1b05('0xd')]);}else{logger[_0x1b05('0xe')](_0x1b05('0xc'),_0x2c5361,'request\x20sent');_0x3d0a76(_0xc231ff[_0x1b05('0xf')][_0x1b05('0xd')]);}})[_0x1b05('0x10')](function(_0x5d5063){logger['error'](_0x1b05('0xc'),_0x2c5361,_0x5d5063);_0x413ec1(_0x5d5063);});});} \ No newline at end of file +var _0xb10e=['result','util','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','info','VtigerField,\x20%s,\x20%s','VtigerField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0xe6b7b6,_0x4fac5d){var _0x192600=function(_0x306161){while(--_0x306161){_0xe6b7b6['push'](_0xe6b7b6['shift']());}};_0x192600(++_0x4fac5d);}(_0xb10e,0x151));var _0xeb10=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xb10e[_0x59ee6f];return _0x4c0979;};'use strict';var _=require('lodash');var util=require(_0xeb10('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xeb10('0x1'))['db'];var utils=require(_0xeb10('0x2'));var logger=require(_0xeb10('0x3'))(_0xeb10('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xeb10('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x5cd5a3,_0x383a92,_0x55df8b){return new BPromise(function(_0x216d83,_0x275b89){return client[_0xeb10('0x6')](_0x5cd5a3,_0x55df8b)['then'](function(_0x179f5e){logger[_0xeb10('0x7')](_0xeb10('0x8'),_0x383a92,'request\x20sent');logger['debug'](_0xeb10('0x9'),_0x383a92,_0xeb10('0xa'),JSON[_0xeb10('0xb')](_0x179f5e));if(_0x179f5e[_0xeb10('0xc')]){if(_0x179f5e[_0xeb10('0xc')][_0xeb10('0xd')]===0x1f4){logger['error'](_0xeb10('0x8'),_0x383a92,_0x179f5e[_0xeb10('0xc')]['message']);return _0x275b89(_0x179f5e[_0xeb10('0xc')][_0xeb10('0xe')]);}logger[_0xeb10('0xc')](_0xeb10('0x8'),_0x383a92,_0x179f5e[_0xeb10('0xc')][_0xeb10('0xe')]);return _0x216d83(_0x179f5e[_0xeb10('0xc')][_0xeb10('0xe')]);}else{logger[_0xeb10('0x7')](_0xeb10('0x8'),_0x383a92,_0xeb10('0xa'));_0x216d83(_0x179f5e[_0xeb10('0xf')][_0xeb10('0xe')]);}})['catch'](function(_0x9bad65){logger['error'](_0xeb10('0x8'),_0x383a92,_0x9bad65);_0x275b89(_0x9bad65);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index d83ec22..887c65d 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 _0x98da=['util','path','express','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','addConfiguration','put','update','delete','destroy','exports','multer'];(function(_0xfab5a7,_0x5c603b){var _0x275d2f=function(_0xcd7097){while(--_0xcd7097){_0xfab5a7['push'](_0xfab5a7['shift']());}};_0x275d2f(++_0x5c603b);}(_0x98da,0xe5));var _0xa98d=function(_0x46057a,_0x5e851d){_0x46057a=_0x46057a-0x0;var _0x4aa630=_0x98da[_0x46057a];return _0x4aa630;};'use strict';var multer=require(_0xa98d('0x0'));var util=require(_0xa98d('0x1'));var path=require(_0xa98d('0x2'));var timeout=require('connect-timeout');var express=require(_0xa98d('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xa98d('0x4'));var config=require(_0xa98d('0x5'));var controller=require(_0xa98d('0x6'));router[_0xa98d('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xa98d('0x7')](_0xa98d('0x8'),auth[_0xa98d('0x9')](),controller[_0xa98d('0xa')]);router[_0xa98d('0x7')](_0xa98d('0xb'),auth['isAuthenticated'](),controller[_0xa98d('0xc')]);router['get'](_0xa98d('0xd'),auth[_0xa98d('0x9')](),controller[_0xa98d('0xe')]);router['post']('/',auth[_0xa98d('0x9')](),controller[_0xa98d('0xf')]);router[_0xa98d('0x10')](_0xa98d('0xb'),auth[_0xa98d('0x9')](),controller[_0xa98d('0x11')]);router[_0xa98d('0x12')](_0xa98d('0x8'),auth[_0xa98d('0x9')](),controller[_0xa98d('0x13')]);router[_0xa98d('0x14')](_0xa98d('0x8'),auth[_0xa98d('0x9')](),controller[_0xa98d('0x15')]);module[_0xa98d('0x16')]=router; \ No newline at end of file +var _0x8256=['destroy','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete'];(function(_0x25bfbd,_0x747f23){var _0x1153a1=function(_0x288b23){while(--_0x288b23){_0x25bfbd['push'](_0x25bfbd['shift']());}};_0x1153a1(++_0x747f23);}(_0x8256,0x121));var _0x6825=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x8256[_0x57b54c];return _0x59cc19;};'use strict';var multer=require('multer');var util=require(_0x6825('0x0'));var path=require(_0x6825('0x1'));var timeout=require(_0x6825('0x2'));var express=require('express');var router=express[_0x6825('0x3')]();var fs_extra=require(_0x6825('0x4'));var auth=require(_0x6825('0x5'));var interaction=require(_0x6825('0x6'));var config=require(_0x6825('0x7'));var controller=require(_0x6825('0x8'));router[_0x6825('0x9')]('/',auth[_0x6825('0xa')](),controller[_0x6825('0xb')]);router[_0x6825('0x9')](_0x6825('0xc'),auth['isAuthenticated'](),controller[_0x6825('0xd')]);router[_0x6825('0x9')](_0x6825('0xe'),auth[_0x6825('0xa')](),controller['getConfigurations']);router[_0x6825('0x9')](_0x6825('0xf'),auth[_0x6825('0xa')](),controller[_0x6825('0x10')]);router[_0x6825('0x11')]('/',auth[_0x6825('0xa')](),controller[_0x6825('0x12')]);router[_0x6825('0x11')](_0x6825('0xe'),auth[_0x6825('0xa')](),controller[_0x6825('0x13')]);router[_0x6825('0x14')]('/:id',auth[_0x6825('0xa')](),controller[_0x6825('0x15')]);router[_0x6825('0x16')]('/:id',auth[_0x6825('0xa')](),controller[_0x6825('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index dba8b3b..2cfbb9d 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 _0xcaf2=['integrationTab','newTab','sequelize','STRING','username','ENUM','password','token'];(function(_0x5c4301,_0x4503b9){var _0x10e0fc=function(_0x5a6c31){while(--_0x5a6c31){_0x5c4301['push'](_0x5c4301['shift']());}};_0x10e0fc(++_0x4503b9);}(_0xcaf2,0x8a));var _0x2caf=function(_0x53b07e,_0x3bc254){_0x53b07e=_0x53b07e-0x0;var _0x5490b7=_0xcaf2[_0x53b07e];return _0x5490b7;};'use strict';var Sequelize=require(_0x2caf('0x0'));module['exports']={'name':{'type':Sequelize[_0x2caf('0x1')]},'description':{'type':Sequelize[_0x2caf('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x2caf('0x2')},'password':{'type':Sequelize[_0x2caf('0x1')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x2caf('0x1')],'unique':'remoteUri'},'authType':{'type':Sequelize[_0x2caf('0x3')](_0x2caf('0x4'),_0x2caf('0x5')),'defaultValue':'password'},'serverUrl':{'type':Sequelize[_0x2caf('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x2caf('0x3')](_0x2caf('0x6'),_0x2caf('0x7')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x4888=['password','token','exports','STRING','username','remoteUri','ENUM'];(function(_0x23a636,_0x987021){var _0x14e422=function(_0x5cd0e0){while(--_0x5cd0e0){_0x23a636['push'](_0x23a636['shift']());}};_0x14e422(++_0x987021);}(_0x4888,0x198));var _0x8488=function(_0xc2d1dc,_0x56b390){_0xc2d1dc=_0xc2d1dc-0x0;var _0x4ea771=_0x4888[_0xc2d1dc];return _0x4ea771;};'use strict';var Sequelize=require('sequelize');module[_0x8488('0x0')]={'name':{'type':Sequelize[_0x8488('0x1')]},'description':{'type':Sequelize[_0x8488('0x1')]},'username':{'type':Sequelize[_0x8488('0x1')],'unique':_0x8488('0x2')},'password':{'type':Sequelize[_0x8488('0x1')]},'token':{'type':Sequelize[_0x8488('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x8488('0x3')},'authType':{'type':Sequelize[_0x8488('0x4')](_0x8488('0x5'),_0x8488('0x6')),'defaultValue':_0x8488('0x5')},'serverUrl':{'type':Sequelize[_0x8488('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('integrationTab','newTab'),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index d6800a5..27b7cf5 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 _0xe1e3=['assignee','remove','includes','position','title','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','end','json','undefined','count','offset','status','set','apply','save','then','destroy','name','send','ZendeskAccount','type','map','query','keys','attributes','intersection','model','fields','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','VIRTUAL','includeAll','findAll','rows','catch','show','params','rawAttributes','merge','find','create','body','update','ZendeskConfiguration','length','getConfigurations','AccountId','getSubjects','channel','Descriptions','getDescriptions','ZendeskField','Subjects','getFields','findOne','password','token','authType','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','ticket_fields','Basic\x20%s','%s:%s','username','base64','headers','%s/token:%s','ValidationError','Unknown\x20authentication\x20type','subject','group'];(function(_0x5a8081,_0x1bbdd1){var _0x5d7624=function(_0xfd40aa){while(--_0xfd40aa){_0x5a8081['push'](_0x5a8081['shift']());}};_0x5d7624(++_0x1bbdd1);}(_0xe1e3,0x1bb));var _0x3e1e=function(_0x11b01b,_0x30ae07){_0x11b01b=_0x11b01b-0x0;var _0x622733=_0xe1e3[_0x11b01b];return _0x622733;};'use strict';var emlformat=require(_0x3e1e('0x0'));var rimraf=require(_0x3e1e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3e1e('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3e1e('0x3'));var Mustache=require('mustache');var util=require(_0x3e1e('0x4'));var path=require(_0x3e1e('0x5'));var sox=require(_0x3e1e('0x6'));var csv=require(_0x3e1e('0x7'));var ejs=require(_0x3e1e('0x8'));var fs=require('fs');var fs_extra=require(_0x3e1e('0x9'));var _=require('lodash');var squel=require(_0x3e1e('0xa'));var crypto=require(_0x3e1e('0xb'));var jsforce=require(_0x3e1e('0xc'));var deskjs=require(_0x3e1e('0xd'));var toCsv=require(_0x3e1e('0x7'));var querystring=require(_0x3e1e('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3e1e('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3e1e('0x10'));var logger=require(_0x3e1e('0x11'))(_0x3e1e('0x12'));var utils=require('../../config/utils');var config=require(_0x3e1e('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x536129,_0x5c09a2){_0x5c09a2=_0x5c09a2||0xcc;return function(_0x14ad58){if(_0x14ad58){return _0x536129['sendStatus'](_0x5c09a2);}return _0x536129['status'](_0x5c09a2)[_0x3e1e('0x14')]();};}function respondWithResult(_0x8bd4cd,_0x78ee54){_0x78ee54=_0x78ee54||0xc8;return function(_0x50f221){if(_0x50f221){return _0x8bd4cd['status'](_0x78ee54)[_0x3e1e('0x15')](_0x50f221);}};}function respondWithFilteredResult(_0x1b62e6,_0x4dca60){return function(_0x26cb35){if(_0x26cb35){var _0x1f0af9=typeof _0x4dca60['offset']===_0x3e1e('0x16')&&typeof _0x4dca60['limit']===_0x3e1e('0x16');var _0x247daa=_0x26cb35[_0x3e1e('0x17')];var _0x39eaa7=_0x1f0af9?0x0:_0x4dca60[_0x3e1e('0x18')];var _0x1c181b=_0x1f0af9?_0x26cb35['count']:_0x4dca60['offset']+_0x4dca60['limit'];var _0x428e4e;if(_0x1c181b>=_0x247daa){_0x1c181b=_0x247daa;_0x428e4e=0xc8;}else{_0x428e4e=0xce;}_0x1b62e6[_0x3e1e('0x19')](_0x428e4e);return _0x1b62e6[_0x3e1e('0x1a')]('Content-Range',_0x39eaa7+'-'+_0x1c181b+'/'+_0x247daa)[_0x3e1e('0x15')](_0x26cb35);}return null;};}function patchUpdates(_0x530815){return function(_0x228991){try{jsonpatch[_0x3e1e('0x1b')](_0x228991,_0x530815,!![]);}catch(_0x474085){return BPromise['reject'](_0x474085);}return _0x228991[_0x3e1e('0x1c')]();};}function saveUpdates(_0x96396,_0xefa098){return function(_0x55dc62){if(_0x55dc62){return _0x55dc62['update'](_0x96396)[_0x3e1e('0x1d')](function(_0x1b5097){return _0x1b5097;});}return null;};}function removeEntity(_0x488f9f,_0x60e6bc){return function(_0x56ae51){if(_0x56ae51){return _0x56ae51[_0x3e1e('0x1e')]()[_0x3e1e('0x1d')](function(){_0x488f9f[_0x3e1e('0x19')](0xcc)[_0x3e1e('0x14')]();});}};}function handleEntityNotFound(_0x43d583,_0x21c898){return function(_0x4ee2b5){if(!_0x4ee2b5){_0x43d583['sendStatus'](0x194);}return _0x4ee2b5;};}function handleError(_0x44e419,_0x541ef1){_0x541ef1=_0x541ef1||0x1f4;return function(_0x55db8f){logger['error'](_0x55db8f['stack']);if(_0x55db8f[_0x3e1e('0x1f')]){delete _0x55db8f[_0x3e1e('0x1f')];}_0x44e419['status'](_0x541ef1)[_0x3e1e('0x20')](_0x55db8f);};}exports['index']=function(_0xdfcd93,_0x176bb4){var _0x53a6ff={},_0x43e029={},_0x210a84={'count':0x0,'rows':[]};var _0x45ed0e=_['map'](db[_0x3e1e('0x21')]['rawAttributes'],function(_0x591c36){return{'name':_0x591c36['fieldName'],'type':_0x591c36[_0x3e1e('0x22')]['key']};});_0x43e029['model']=_[_0x3e1e('0x23')](_0x45ed0e,_0x3e1e('0x1f'));_0x43e029[_0x3e1e('0x24')]=_[_0x3e1e('0x25')](_0xdfcd93[_0x3e1e('0x24')]);_0x43e029['filters']=_['intersection'](_0x43e029['model'],_0x43e029['query']);_0x53a6ff[_0x3e1e('0x26')]=_[_0x3e1e('0x27')](_0x43e029[_0x3e1e('0x28')],qs[_0x3e1e('0x29')](_0xdfcd93[_0x3e1e('0x24')][_0x3e1e('0x29')]));_0x53a6ff[_0x3e1e('0x26')]=_0x53a6ff[_0x3e1e('0x26')]['length']?_0x53a6ff[_0x3e1e('0x26')]:_0x43e029[_0x3e1e('0x28')];if(!_0xdfcd93['query'][_0x3e1e('0x2a')](_0x3e1e('0x2b'))){_0x53a6ff[_0x3e1e('0x2c')]=qs[_0x3e1e('0x2c')](_0xdfcd93['query']['limit']);_0x53a6ff[_0x3e1e('0x18')]=qs[_0x3e1e('0x18')](_0xdfcd93['query'][_0x3e1e('0x18')]);}_0x53a6ff[_0x3e1e('0x2d')]=qs['sort'](_0xdfcd93[_0x3e1e('0x24')][_0x3e1e('0x2e')]);_0x53a6ff[_0x3e1e('0x2f')]=qs[_0x3e1e('0x30')](_[_0x3e1e('0x31')](_0xdfcd93['query'],_0x43e029[_0x3e1e('0x30')]),_0x45ed0e);if(_0xdfcd93[_0x3e1e('0x24')][_0x3e1e('0x32')]){_0x53a6ff[_0x3e1e('0x2f')]=_['merge'](_0x53a6ff[_0x3e1e('0x2f')],{'$or':_[_0x3e1e('0x23')](_0x45ed0e,function(_0x111da4){if(_0x111da4[_0x3e1e('0x22')]!==_0x3e1e('0x33')){var _0x25a95b={};_0x25a95b[_0x111da4[_0x3e1e('0x1f')]]={'$like':'%'+_0xdfcd93['query'][_0x3e1e('0x32')]+'%'};return _0x25a95b;}})});}_0x53a6ff=_['merge']({},_0x53a6ff,_0xdfcd93['options']);var _0x4f598e={'where':_0x53a6ff[_0x3e1e('0x2f')]};return db[_0x3e1e('0x21')]['count'](_0x4f598e)[_0x3e1e('0x1d')](function(_0xb030eb){_0x210a84['count']=_0xb030eb;if(_0xdfcd93[_0x3e1e('0x24')][_0x3e1e('0x34')]){_0x53a6ff['include']=[{'all':!![]}];}return db['ZendeskAccount'][_0x3e1e('0x35')](_0x53a6ff);})['then'](function(_0x4ff868){_0x210a84[_0x3e1e('0x36')]=_0x4ff868;return _0x210a84;})[_0x3e1e('0x1d')](respondWithFilteredResult(_0x176bb4,_0x53a6ff))[_0x3e1e('0x37')](handleError(_0x176bb4,null));};exports[_0x3e1e('0x38')]=function(_0x377a06,_0x55ea1d){var _0x5b32ad={'raw':![],'where':{'id':_0x377a06[_0x3e1e('0x39')]['id']}},_0x24b2ad={};_0x24b2ad[_0x3e1e('0x28')]=_['keys'](db[_0x3e1e('0x21')][_0x3e1e('0x3a')]);_0x24b2ad[_0x3e1e('0x24')]=_['keys'](_0x377a06[_0x3e1e('0x24')]);_0x24b2ad['filters']=_['intersection'](_0x24b2ad[_0x3e1e('0x28')],_0x24b2ad[_0x3e1e('0x24')]);_0x5b32ad[_0x3e1e('0x26')]=_[_0x3e1e('0x27')](_0x24b2ad['model'],qs['fields'](_0x377a06['query']['fields']));_0x5b32ad[_0x3e1e('0x26')]=_0x5b32ad[_0x3e1e('0x26')]['length']?_0x5b32ad['attributes']:_0x24b2ad[_0x3e1e('0x28')];if(_0x377a06[_0x3e1e('0x24')][_0x3e1e('0x34')]){_0x5b32ad['include']=[{'all':!![]}];}_0x5b32ad=_[_0x3e1e('0x3b')]({},_0x5b32ad,_0x377a06['options']);return db[_0x3e1e('0x21')][_0x3e1e('0x3c')](_0x5b32ad)[_0x3e1e('0x1d')](handleEntityNotFound(_0x55ea1d,null))[_0x3e1e('0x1d')](respondWithResult(_0x55ea1d,null))[_0x3e1e('0x37')](handleError(_0x55ea1d,null));};exports[_0x3e1e('0x3d')]=function(_0x53d32b,_0x2f14b3){return db[_0x3e1e('0x21')]['create'](_0x53d32b[_0x3e1e('0x3e')],{})[_0x3e1e('0x1d')](respondWithResult(_0x2f14b3,0xc9))['catch'](handleError(_0x2f14b3,null));};exports[_0x3e1e('0x3f')]=function(_0x347b3f,_0x2e286f){if(_0x347b3f[_0x3e1e('0x3e')]['id']){delete _0x347b3f['body']['id'];}return db[_0x3e1e('0x21')][_0x3e1e('0x3c')]({'where':{'id':_0x347b3f[_0x3e1e('0x39')]['id']}})[_0x3e1e('0x1d')](handleEntityNotFound(_0x2e286f,null))['then'](saveUpdates(_0x347b3f[_0x3e1e('0x3e')],null))[_0x3e1e('0x1d')](respondWithResult(_0x2e286f,null))[_0x3e1e('0x37')](handleError(_0x2e286f,null));};exports[_0x3e1e('0x1e')]=function(_0xe2516c,_0x1df5a8){return db[_0x3e1e('0x21')][_0x3e1e('0x3c')]({'where':{'id':_0xe2516c['params']['id']}})[_0x3e1e('0x1d')](handleEntityNotFound(_0x1df5a8,null))['then'](removeEntity(_0x1df5a8,null))['catch'](handleError(_0x1df5a8,null));};exports['getConfigurations']=function(_0x1c4269,_0x17641c,_0x5147a2){var _0x13b076={};var _0x592733={};var _0x5b2416;var _0x3eaf76;return db['ZendeskAccount']['findOne']({'where':{'id':_0x1c4269['params']['id']}})[_0x3e1e('0x1d')](handleEntityNotFound(_0x17641c,null))[_0x3e1e('0x1d')](function(_0x1334c8){if(_0x1334c8){_0x5b2416=_0x1334c8;_0x592733[_0x3e1e('0x28')]=_[_0x3e1e('0x25')](db[_0x3e1e('0x40')][_0x3e1e('0x3a')]);_0x592733['query']=_[_0x3e1e('0x25')](_0x1c4269['query']);_0x592733[_0x3e1e('0x30')]=_[_0x3e1e('0x27')](_0x592733[_0x3e1e('0x28')],_0x592733['query']);_0x13b076['attributes']=_[_0x3e1e('0x27')](_0x592733[_0x3e1e('0x28')],qs['fields'](_0x1c4269[_0x3e1e('0x24')]['fields']));_0x13b076['attributes']=_0x13b076[_0x3e1e('0x26')][_0x3e1e('0x41')]?_0x13b076['attributes']:_0x592733[_0x3e1e('0x28')];_0x13b076['order']=qs['sort'](_0x1c4269[_0x3e1e('0x24')]['sort']);_0x13b076[_0x3e1e('0x2f')]=qs['filters'](_[_0x3e1e('0x31')](_0x1c4269['query'],_0x592733[_0x3e1e('0x30')]));if(_0x1c4269[_0x3e1e('0x24')]['filter']){_0x13b076['where']=_['merge'](_0x13b076[_0x3e1e('0x2f')],{'$or':_[_0x3e1e('0x23')](_0x13b076[_0x3e1e('0x26')],function(_0x588189){var _0x1b04ce={};_0x1b04ce[_0x588189]={'$like':'%'+_0x1c4269[_0x3e1e('0x24')][_0x3e1e('0x32')]+'%'};return _0x1b04ce;})});}_0x13b076=_['merge']({},_0x13b076,_0x1c4269['options']);return _0x5b2416[_0x3e1e('0x42')](_0x13b076);}})['then'](function(_0x3b97a2){if(_0x3b97a2){_0x3eaf76=_0x3b97a2[_0x3e1e('0x41')];if(!_0x1c4269[_0x3e1e('0x24')]['hasOwnProperty'](_0x3e1e('0x2b'))){_0x13b076['limit']=qs[_0x3e1e('0x2c')](_0x1c4269[_0x3e1e('0x24')]['limit']);_0x13b076[_0x3e1e('0x18')]=qs['offset'](_0x1c4269[_0x3e1e('0x24')]['offset']);}return _0x5b2416[_0x3e1e('0x42')](_0x13b076);}})['then'](function(_0x31062e){if(_0x31062e){return _0x31062e?{'count':_0x3eaf76,'rows':_0x31062e}:null;}})[_0x3e1e('0x1d')](respondWithResult(_0x17641c,null))[_0x3e1e('0x37')](handleError(_0x17641c,null));};exports['addConfiguration']=function(_0x11cab1,_0x1fbcfc,_0x4e6957){if(_0x11cab1[_0x3e1e('0x3e')]['id']){delete _0x11cab1['body']['id'];}return db['ZendeskAccount']['findOne']({'where':{'id':_0x11cab1[_0x3e1e('0x39')]['id']}})[_0x3e1e('0x1d')](handleEntityNotFound(_0x1fbcfc,null))[_0x3e1e('0x1d')](function(_0x4b0944){if(_0x4b0944){_0x11cab1[_0x3e1e('0x3e')][_0x3e1e('0x43')]=_0x4b0944['id'];_0x11cab1[_0x3e1e('0x3e')]['Subjects']=integrations[_0x3e1e('0x44')](_0x11cab1[_0x3e1e('0x3e')][_0x3e1e('0x45')],_0x11cab1[_0x3e1e('0x3e')][_0x3e1e('0x22')]);_0x11cab1[_0x3e1e('0x3e')][_0x3e1e('0x46')]=integrations[_0x3e1e('0x47')](_0x11cab1['body']['channel'],_0x11cab1[_0x3e1e('0x3e')][_0x3e1e('0x22')]);return db[_0x3e1e('0x40')][_0x3e1e('0x3d')](_0x11cab1[_0x3e1e('0x3e')],{'include':[{'model':db[_0x3e1e('0x48')],'as':_0x3e1e('0x49')},{'model':db[_0x3e1e('0x48')],'as':_0x3e1e('0x46')}]});}return null;})[_0x3e1e('0x1d')](respondWithResult(_0x1fbcfc,null))[_0x3e1e('0x37')](handleError(_0x1fbcfc,null));};exports[_0x3e1e('0x4a')]=function(_0x5e148e,_0x5581ee,_0x20bc4d){var _0x29ddc4='';return db[_0x3e1e('0x21')][_0x3e1e('0x4b')]({'where':{'id':_0x5e148e[_0x3e1e('0x39')]['id']},'attributes':['id','username',_0x3e1e('0x4c'),_0x3e1e('0x4d'),_0x3e1e('0x4e'),_0x3e1e('0x4f')]})[_0x3e1e('0x1d')](handleEntityNotFound(_0x5581ee,null))['then'](function(_0x8b6b28){if(_0x8b6b28){_0x29ddc4=_0x8b6b28[_0x3e1e('0x4f')];var _0xc60340=_0x29ddc4[_0x3e1e('0x50')](-0x1);if(_0xc60340==='/'){_0x29ddc4=_0x29ddc4[_0x3e1e('0x51')](0x0,_0x29ddc4[_0x3e1e('0x52')](_0xc60340));}var _0x4d0854={'method':_0x3e1e('0x53'),'uri':util[_0x3e1e('0x54')](_0x3e1e('0x55'),_0x29ddc4,_0x3e1e('0x56')),'json':!![]};switch(_0x8b6b28[_0x3e1e('0x4e')]){case _0x3e1e('0x4c'):_0x4d0854['headers']={'Authorization':util[_0x3e1e('0x54')](_0x3e1e('0x57'),new Buffer(util[_0x3e1e('0x54')](_0x3e1e('0x58'),_0x8b6b28[_0x3e1e('0x59')],_0x8b6b28[_0x3e1e('0x4c')]))['toString'](_0x3e1e('0x5a')))};break;case'token':_0x4d0854[_0x3e1e('0x5b')]={'Authorization':util[_0x3e1e('0x54')]('Basic\x20%s',new Buffer(util[_0x3e1e('0x54')](_0x3e1e('0x5c'),_0x8b6b28[_0x3e1e('0x59')],_0x8b6b28[_0x3e1e('0x4d')]))['toString'](_0x3e1e('0x5a')))};break;default:throw new db['Sequelize'][(_0x3e1e('0x5d'))](_0x3e1e('0x5e'));}return rp(_0x4d0854);}})[_0x3e1e('0x1d')](function(_0x632f99){if(_0x632f99){var _0x2ef476=[_0x3e1e('0x5f'),'description',_0x3e1e('0x60'),_0x3e1e('0x61')];_[_0x3e1e('0x62')](_0x632f99[_0x3e1e('0x56')],function(_0x4b4fd4){return _0x2ef476[_0x3e1e('0x63')](_0x4b4fd4[_0x3e1e('0x22')]);});return{'count':_0x632f99[_0x3e1e('0x56')][_0x3e1e('0x41')],'rows':_['map'](_0x632f99[_0x3e1e('0x56')],function(_0x41d98f){return{'id':_0x41d98f['id'],'name':_0x41d98f[_0x3e1e('0x64')]>0x7?_0x41d98f[_0x3e1e('0x65')]:_0x41d98f[_0x3e1e('0x22')],'custom':_0x41d98f[_0x3e1e('0x64')]>0x7?!![]:![],'options':_0x41d98f['system_field_options']?_0x41d98f['system_field_options']:_0x41d98f['custom_field_options']?_0x41d98f[_0x3e1e('0x66')]:[]};})};}})['then'](respondWithResult(_0x5581ee,null))[_0x3e1e('0x37')](function(_0x5f436f){var _0x32b5ef=_0x5e148e[_0x3e1e('0x24')][_0x3e1e('0x67')]?0x1f4:_0x5f436f[_0x3e1e('0x68')]||0x1f4;logger['error'](_0x3e1e('0x69'),'getFields',_0x32b5ef,JSON[_0x3e1e('0x6a')](_0x5f436f));delete _0x5f436f['name'];if(_0x32b5ef===0x191){_0x32b5ef=0x190;}_0x5581ee[_0x3e1e('0x19')](_0x32b5ef)[_0x3e1e('0x20')](_0x5e148e['query'][_0x3e1e('0x67')]?{'message':_0x3e1e('0x6b'),'statusCode':_0x5f436f[_0x3e1e('0x68')]}:_0x5f436f);});}; \ No newline at end of file +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(_0x10d1bf,_0x3b6413){var _0x305c6e=function(_0xc3c60e){while(--_0xc3c60e){_0x10d1bf['push'](_0x10d1bf['shift']());}};_0x305c6e(++_0x3b6413);}(_0xae60,0x1c7));var _0x0ae6=function(_0x1a7846,_0x59723e){_0x1a7846=_0x1a7846-0x0;var _0x48049=_0xae60[_0x1a7846];return _0x48049;};'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 diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index b65fa6d..911ae1f 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 _0x1643=['../../components/integrations/configuration','exports','define','int_zendesk_accounts','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x52f562,_0x28b17d){var _0x120e8e=function(_0x4ef704){while(--_0x4ef704){_0x52f562['push'](_0x52f562['shift']());}};_0x120e8e(++_0x28b17d);}(_0x1643,0x130));var _0x3164=function(_0x597c07,_0x3a12ba){_0x597c07=_0x597c07-0x0;var _0x144344=_0x1643[_0x597c07];return _0x144344;};'use strict';var _=require('lodash');var util=require(_0x3164('0x0'));var logger=require(_0x3164('0x1'))(_0x3164('0x2'));var moment=require('moment');var BPromise=require(_0x3164('0x3'));var rp=require(_0x3164('0x4'));var fs=require('fs');var path=require(_0x3164('0x5'));var rimraf=require(_0x3164('0x6'));var config=require(_0x3164('0x7'));var attributes=require('./intZendeskAccount.attributes');var integrations=require(_0x3164('0x8'));module[_0x3164('0x9')]=function(_0x3e1dac,_0x422a38){return _0x3e1dac[_0x3164('0xa')]('ZendeskAccount',attributes,{'tableName':_0x3164('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x967d=['rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','ZendeskAccount','lodash','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x380252,_0x3133e2){var _0x5d1330=function(_0x33433e){while(--_0x33433e){_0x380252['push'](_0x380252['shift']());}};_0x5d1330(++_0x3133e2);}(_0x967d,0x125));var _0xd967=function(_0x2109a8,_0x3a7797){_0x2109a8=_0x2109a8-0x0;var _0x522094=_0x967d[_0x2109a8];return _0x522094;};'use strict';var _=require(_0xd967('0x0'));var util=require('util');var logger=require(_0xd967('0x1'))('api');var moment=require(_0xd967('0x2'));var BPromise=require(_0xd967('0x3'));var rp=require(_0xd967('0x4'));var fs=require('fs');var path=require(_0xd967('0x5'));var rimraf=require(_0xd967('0x6'));var config=require(_0xd967('0x7'));var attributes=require(_0xd967('0x8'));var integrations=require(_0xd967('0x9'));module[_0xd967('0xa')]=function(_0xf34cfe,_0x437350){return _0xf34cfe[_0xd967('0xb')](_0xd967('0xc'),attributes,{'tableName':'int_zendesk_accounts','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 1ba490d..4870c2d 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 _0x4a38=['bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','findAll','options','raw','where','attributes','limit','include','map','GetZendeskAccount','catch','ShowZendeskAccount','ZendeskAccount','model','lodash','util'];(function(_0x23e859,_0x419ccc){var _0xe4964=function(_0x2e2501){while(--_0x2e2501){_0x23e859['push'](_0x23e859['shift']());}};_0xe4964(++_0x419ccc);}(_0x4a38,0x1de));var _0x84a3=function(_0x1e961f,_0x21654e){_0x1e961f=_0x1e961f-0x0;var _0x554fd7=_0x4a38[_0x1e961f];return _0x554fd7;};'use strict';var _=require(_0x84a3('0x0'));var util=require(_0x84a3('0x1'));var moment=require('moment');var BPromise=require(_0x84a3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x84a3('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x84a3('0x4'));var logger=require(_0x84a3('0x5'))('rpc');var config=require(_0x84a3('0x6'));var jayson=require(_0x84a3('0x7'));var client=jayson['client'][_0x84a3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2aa739,_0x4bf203,_0x43fec9){return new BPromise(function(_0x2192a9,_0x1f5128){return client[_0x84a3('0x9')](_0x2aa739,_0x43fec9)[_0x84a3('0xa')](function(_0x469910){logger['info'](_0x84a3('0xb'),_0x4bf203,_0x84a3('0xc'));logger[_0x84a3('0xd')](_0x84a3('0xe'),_0x4bf203,_0x84a3('0xc'),JSON[_0x84a3('0xf')](_0x469910));if(_0x469910[_0x84a3('0x10')]){if(_0x469910[_0x84a3('0x10')]['code']===0x1f4){logger['error'](_0x84a3('0xb'),_0x4bf203,_0x469910[_0x84a3('0x10')]['message']);return _0x1f5128(_0x469910[_0x84a3('0x10')][_0x84a3('0x11')]);}logger[_0x84a3('0x10')](_0x84a3('0xb'),_0x4bf203,_0x469910['error'][_0x84a3('0x11')]);return _0x2192a9(_0x469910['error']['message']);}else{logger[_0x84a3('0x12')](_0x84a3('0xb'),_0x4bf203,'request\x20sent');_0x2192a9(_0x469910['result'][_0x84a3('0x11')]);}})['catch'](function(_0xda995e){logger[_0x84a3('0x10')](_0x84a3('0xb'),_0x4bf203,_0xda995e);_0x1f5128(_0xda995e);});});}exports['GetZendeskAccount']=function(_0x29a2c1){var _0x2471fa=this;return new Promise(function(_0xc9fbe1,_0x54801d){return db['ZendeskAccount'][_0x84a3('0x13')]({'raw':_0x29a2c1[_0x84a3('0x14')]?_0x29a2c1[_0x84a3('0x14')][_0x84a3('0x15')]===undefined?!![]:![]:!![],'where':_0x29a2c1[_0x84a3('0x14')]?_0x29a2c1[_0x84a3('0x14')][_0x84a3('0x16')]||null:null,'attributes':_0x29a2c1[_0x84a3('0x14')]?_0x29a2c1['options'][_0x84a3('0x17')]||null:null,'limit':_0x29a2c1[_0x84a3('0x14')]?_0x29a2c1['options'][_0x84a3('0x18')]||null:null,'include':_0x29a2c1['options']?_0x29a2c1['options'][_0x84a3('0x19')]?_['map'](_0x29a2c1[_0x84a3('0x14')][_0x84a3('0x19')],function(_0x1148e0){return{'model':db[_0x1148e0['model']],'as':_0x1148e0['as'],'attributes':_0x1148e0[_0x84a3('0x17')],'include':_0x1148e0[_0x84a3('0x19')]?_[_0x84a3('0x1a')](_0x1148e0['include'],function(_0x19d70e){return{'model':db[_0x19d70e['model']],'as':_0x19d70e['as'],'attributes':_0x19d70e['attributes'],'include':_0x19d70e['include']?_[_0x84a3('0x1a')](_0x19d70e['include'],function(_0x12bde4){return{'model':db[_0x12bde4['model']],'as':_0x12bde4['as'],'attributes':_0x12bde4['attributes']};}):[]};}):[]};}):[]:[]})[_0x84a3('0xa')](function(_0x17863a){logger['info'](_0x84a3('0x1b'),_0x29a2c1);logger[_0x84a3('0xd')](_0x84a3('0x1b'),_0x29a2c1,JSON[_0x84a3('0xf')](_0x17863a));_0xc9fbe1(_0x17863a);})[_0x84a3('0x1c')](function(_0x2a5ac2){logger[_0x84a3('0x10')](_0x84a3('0x1b'),_0x2a5ac2[_0x84a3('0x11')],_0x29a2c1);_0x54801d(_0x2471fa[_0x84a3('0x10')](0x1f4,_0x2a5ac2[_0x84a3('0x11')]));});});};exports[_0x84a3('0x1d')]=function(_0x154a7c){var _0x51675d=this;return new Promise(function(_0x1f7c20,_0x13c784){return db[_0x84a3('0x1e')]['find']({'raw':_0x154a7c[_0x84a3('0x14')]?_0x154a7c[_0x84a3('0x14')][_0x84a3('0x15')]===undefined?!![]:![]:!![],'where':_0x154a7c['options']?_0x154a7c[_0x84a3('0x14')][_0x84a3('0x16')]||null:null,'attributes':_0x154a7c['options']?_0x154a7c[_0x84a3('0x14')][_0x84a3('0x17')]||null:null,'include':_0x154a7c[_0x84a3('0x14')]?_0x154a7c[_0x84a3('0x14')]['include']?_[_0x84a3('0x1a')](_0x154a7c[_0x84a3('0x14')][_0x84a3('0x19')],function(_0x42708b){return{'model':db[_0x42708b['model']],'as':_0x42708b['as'],'attributes':_0x42708b[_0x84a3('0x17')],'include':_0x42708b[_0x84a3('0x19')]?_[_0x84a3('0x1a')](_0x42708b[_0x84a3('0x19')],function(_0x37ae1a){return{'model':db[_0x37ae1a[_0x84a3('0x1f')]],'as':_0x37ae1a['as'],'attributes':_0x37ae1a['attributes'],'include':_0x37ae1a[_0x84a3('0x19')]?_[_0x84a3('0x1a')](_0x37ae1a[_0x84a3('0x19')],function(_0xd2d2d7){return{'model':db[_0xd2d2d7['model']],'as':_0xd2d2d7['as'],'attributes':_0xd2d2d7['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x354bd1){logger['info']('ShowZendeskAccount',_0x154a7c);logger[_0x84a3('0xd')]('ShowZendeskAccount',_0x154a7c,JSON[_0x84a3('0xf')](_0x354bd1));_0x1f7c20(_0x354bd1);})[_0x84a3('0x1c')](function(_0x28c130){logger[_0x84a3('0x10')](_0x84a3('0x1d'),_0x28c130[_0x84a3('0x11')],_0x154a7c);_0x13c784(_0x51675d[_0x84a3('0x10')](0x1f4,_0x28c130[_0x84a3('0x11')]));});});}; \ No newline at end of file +var _0x5f0e=['ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetZendeskAccount','ZendeskAccount','options','raw','attributes','limit','map','include','model','ShowZendeskAccount','find','where','lodash','bluebird','ioredis','../../config/utils','../../config/logger','client','http','request','then','info'];(function(_0x35b322,_0x37de57){var _0x21b770=function(_0x59feb1){while(--_0x59feb1){_0x35b322['push'](_0x35b322['shift']());}};_0x21b770(++_0x37de57);}(_0x5f0e,0x19a));var _0xe5f0=function(_0x162e5c,_0x23d2aa){_0x162e5c=_0x162e5c-0x0;var _0x391ea2=_0x5f0e[_0x162e5c];return _0x391ea2;};'use strict';var _=require(_0xe5f0('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe5f0('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe5f0('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xe5f0('0x3'));var logger=require(_0xe5f0('0x4'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe5f0('0x5')][_0xe5f0('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x45efef,_0x7bd209,_0x595823){return new BPromise(function(_0xb99e1a,_0x323503){return client[_0xe5f0('0x7')](_0x45efef,_0x595823)[_0xe5f0('0x8')](function(_0x294ba7){logger[_0xe5f0('0x9')](_0xe5f0('0xa'),_0x7bd209,_0xe5f0('0xb'));logger[_0xe5f0('0xc')]('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x7bd209,'request\x20sent',JSON[_0xe5f0('0xd')](_0x294ba7));if(_0x294ba7[_0xe5f0('0xe')]){if(_0x294ba7['error'][_0xe5f0('0xf')]===0x1f4){logger['error'](_0xe5f0('0xa'),_0x7bd209,_0x294ba7[_0xe5f0('0xe')][_0xe5f0('0x10')]);return _0x323503(_0x294ba7[_0xe5f0('0xe')][_0xe5f0('0x10')]);}logger[_0xe5f0('0xe')](_0xe5f0('0xa'),_0x7bd209,_0x294ba7[_0xe5f0('0xe')]['message']);return _0xb99e1a(_0x294ba7[_0xe5f0('0xe')]['message']);}else{logger['info'](_0xe5f0('0xa'),_0x7bd209,_0xe5f0('0xb'));_0xb99e1a(_0x294ba7['result'][_0xe5f0('0x10')]);}})[_0xe5f0('0x11')](function(_0x48eff8){logger[_0xe5f0('0xe')](_0xe5f0('0xa'),_0x7bd209,_0x48eff8);_0x323503(_0x48eff8);});});}exports[_0xe5f0('0x12')]=function(_0x204ccb){var _0xc6d133=this;return new Promise(function(_0x1258b0,_0x4309ea){return db[_0xe5f0('0x13')]['findAll']({'raw':_0x204ccb[_0xe5f0('0x14')]?_0x204ccb['options'][_0xe5f0('0x15')]===undefined?!![]:![]:!![],'where':_0x204ccb[_0xe5f0('0x14')]?_0x204ccb[_0xe5f0('0x14')]['where']||null:null,'attributes':_0x204ccb[_0xe5f0('0x14')]?_0x204ccb[_0xe5f0('0x14')][_0xe5f0('0x16')]||null:null,'limit':_0x204ccb['options']?_0x204ccb[_0xe5f0('0x14')][_0xe5f0('0x17')]||null:null,'include':_0x204ccb[_0xe5f0('0x14')]?_0x204ccb['options']['include']?_[_0xe5f0('0x18')](_0x204ccb[_0xe5f0('0x14')][_0xe5f0('0x19')],function(_0x53f0c1){return{'model':db[_0x53f0c1[_0xe5f0('0x1a')]],'as':_0x53f0c1['as'],'attributes':_0x53f0c1[_0xe5f0('0x16')],'include':_0x53f0c1['include']?_[_0xe5f0('0x18')](_0x53f0c1[_0xe5f0('0x19')],function(_0x164daa){return{'model':db[_0x164daa[_0xe5f0('0x1a')]],'as':_0x164daa['as'],'attributes':_0x164daa[_0xe5f0('0x16')],'include':_0x164daa[_0xe5f0('0x19')]?_[_0xe5f0('0x18')](_0x164daa[_0xe5f0('0x19')],function(_0x37d969){return{'model':db[_0x37d969[_0xe5f0('0x1a')]],'as':_0x37d969['as'],'attributes':_0x37d969[_0xe5f0('0x16')]};}):[]};}):[]};}):[]:[]})[_0xe5f0('0x8')](function(_0x3404b3){logger[_0xe5f0('0x9')]('GetZendeskAccount',_0x204ccb);logger[_0xe5f0('0xc')]('GetZendeskAccount',_0x204ccb,JSON[_0xe5f0('0xd')](_0x3404b3));_0x1258b0(_0x3404b3);})['catch'](function(_0x2f6cf6){logger[_0xe5f0('0xe')](_0xe5f0('0x12'),_0x2f6cf6[_0xe5f0('0x10')],_0x204ccb);_0x4309ea(_0xc6d133[_0xe5f0('0xe')](0x1f4,_0x2f6cf6[_0xe5f0('0x10')]));});});};exports[_0xe5f0('0x1b')]=function(_0x3d2ffe){var _0x2949a8=this;return new Promise(function(_0x611ecd,_0x3b5b6a){return db[_0xe5f0('0x13')][_0xe5f0('0x1c')]({'raw':_0x3d2ffe[_0xe5f0('0x14')]?_0x3d2ffe[_0xe5f0('0x14')][_0xe5f0('0x15')]===undefined?!![]:![]:!![],'where':_0x3d2ffe[_0xe5f0('0x14')]?_0x3d2ffe[_0xe5f0('0x14')][_0xe5f0('0x1d')]||null:null,'attributes':_0x3d2ffe[_0xe5f0('0x14')]?_0x3d2ffe[_0xe5f0('0x14')][_0xe5f0('0x16')]||null:null,'include':_0x3d2ffe[_0xe5f0('0x14')]?_0x3d2ffe[_0xe5f0('0x14')]['include']?_[_0xe5f0('0x18')](_0x3d2ffe[_0xe5f0('0x14')][_0xe5f0('0x19')],function(_0x111072){return{'model':db[_0x111072[_0xe5f0('0x1a')]],'as':_0x111072['as'],'attributes':_0x111072['attributes'],'include':_0x111072['include']?_[_0xe5f0('0x18')](_0x111072['include'],function(_0x2a3cd1){return{'model':db[_0x2a3cd1[_0xe5f0('0x1a')]],'as':_0x2a3cd1['as'],'attributes':_0x2a3cd1['attributes'],'include':_0x2a3cd1['include']?_['map'](_0x2a3cd1[_0xe5f0('0x19')],function(_0x1ccde5){return{'model':db[_0x1ccde5[_0xe5f0('0x1a')]],'as':_0x1ccde5['as'],'attributes':_0x1ccde5[_0xe5f0('0x16')]};}):[]};}):[]};}):[]:[]})[_0xe5f0('0x8')](function(_0x3101c4){logger['info']('ShowZendeskAccount',_0x3d2ffe);logger[_0xe5f0('0xc')](_0xe5f0('0x1b'),_0x3d2ffe,JSON[_0xe5f0('0xd')](_0x3101c4));_0x611ecd(_0x3101c4);})[_0xe5f0('0x11')](function(_0x12378c){logger['error'](_0xe5f0('0x1b'),_0x12378c[_0xe5f0('0x10')],_0x3d2ffe);_0x3b5b6a(_0x2949a8[_0xe5f0('0xe')](0x1f4,_0x12378c['message']));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 17b0b6b..649a80c 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 _0x36ee=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','post','create','update','delete','destroy','exports','path','express'];(function(_0x1e172a,_0x52102b){var _0x96338b=function(_0x307313){while(--_0x307313){_0x1e172a['push'](_0x1e172a['shift']());}};_0x96338b(++_0x52102b);}(_0x36ee,0xe8));var _0xe36e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x36ee[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe36e('0x0'));var timeout=require('connect-timeout');var express=require(_0xe36e('0x1'));var router=express[_0xe36e('0x2')]();var fs_extra=require(_0xe36e('0x3'));var auth=require(_0xe36e('0x4'));var interaction=require(_0xe36e('0x5'));var config=require(_0xe36e('0x6'));var controller=require(_0xe36e('0x7'));router[_0xe36e('0x8')]('/',auth[_0xe36e('0x9')](),controller[_0xe36e('0xa')]);router[_0xe36e('0x8')](_0xe36e('0xb'),auth['isAuthenticated'](),controller[_0xe36e('0xc')]);router['get'](_0xe36e('0xd'),auth[_0xe36e('0x9')](),controller[_0xe36e('0xe')]);router['get'](_0xe36e('0xf'),auth['isAuthenticated'](),controller[_0xe36e('0x10')]);router[_0xe36e('0x8')](_0xe36e('0x11'),auth[_0xe36e('0x9')](),controller[_0xe36e('0x12')]);router[_0xe36e('0x8')](_0xe36e('0x13'),auth[_0xe36e('0x9')](),controller['getTags']);router[_0xe36e('0x14')]('/',auth[_0xe36e('0x9')](),controller[_0xe36e('0x15')]);router[_0xe36e('0x14')]('/:id/tags',auth[_0xe36e('0x9')](),controller['setTags']);router['put'](_0xe36e('0xb'),auth[_0xe36e('0x9')](),controller[_0xe36e('0x16')]);router[_0xe36e('0x17')](_0xe36e('0xb'),auth[_0xe36e('0x9')](),controller[_0xe36e('0x18')]);module[_0xe36e('0x19')]=router; \ No newline at end of file +var _0xea28=['Router','fs-extra','../../components/auth/service','../../config/environment','./intZendeskConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','setTags','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x5cf40a,_0x21e31f){var _0x26216d=function(_0x82a779){while(--_0x82a779){_0x5cf40a['push'](_0x5cf40a['shift']());}};_0x26216d(++_0x21e31f);}(_0xea28,0x13a));var _0x8ea2=function(_0x5e498b,_0x660891){_0x5e498b=_0x5e498b-0x0;var _0x1ece0c=_0xea28[_0x5e498b];return _0x1ece0c;};'use strict';var multer=require(_0x8ea2('0x0'));var util=require(_0x8ea2('0x1'));var path=require(_0x8ea2('0x2'));var timeout=require(_0x8ea2('0x3'));var express=require(_0x8ea2('0x4'));var router=express[_0x8ea2('0x5')]();var fs_extra=require(_0x8ea2('0x6'));var auth=require(_0x8ea2('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x8ea2('0x8'));var controller=require(_0x8ea2('0x9'));router[_0x8ea2('0xa')]('/',auth['isAuthenticated'](),controller[_0x8ea2('0xb')]);router[_0x8ea2('0xa')](_0x8ea2('0xc'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0xe')]);router[_0x8ea2('0xa')](_0x8ea2('0xf'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x10')]);router[_0x8ea2('0xa')](_0x8ea2('0x11'),auth[_0x8ea2('0xd')](),controller['getSubjects']);router['get'](_0x8ea2('0x12'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x13')]);router['get'](_0x8ea2('0x14'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x15')]);router[_0x8ea2('0x16')]('/',auth[_0x8ea2('0xd')](),controller['create']);router[_0x8ea2('0x16')]('/:id/tags',auth['isAuthenticated'](),controller[_0x8ea2('0x17')]);router[_0x8ea2('0x18')](_0x8ea2('0xc'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x19')]);router[_0x8ea2('0x1a')](_0x8ea2('0xc'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x1b')]);module[_0x8ea2('0x1c')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index a19a595..bc23b9e 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 _0xfe04=['STRING','sequelize'];(function(_0x89ac51,_0x5ecae1){var _0x166509=function(_0x11f862){while(--_0x11f862){_0x89ac51['push'](_0x89ac51['shift']());}};_0x166509(++_0x5ecae1);}(_0xfe04,0x193));var _0x4fe0=function(_0x57c205,_0x51d78e){_0x57c205=_0x57c205-0x0;var _0x539fb1=_0xfe04[_0x57c205];return _0x539fb1;};'use strict';var Sequelize=require(_0x4fe0('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4fe0('0x1')]}}; \ No newline at end of file +var _0xe930=['STRING','sequelize','exports'];(function(_0x5bacd3,_0x5529dd){var _0x10cecd=function(_0x3f8a89){while(--_0x3f8a89){_0x5bacd3['push'](_0x5bacd3['shift']());}};_0x10cecd(++_0x5529dd);}(_0xe930,0x76));var _0x0e93=function(_0x22663b,_0xc8c6e3){_0x22663b=_0x22663b-0x0;var _0x310d0a=_0xe930[_0x22663b];return _0x310d0a;};'use strict';var Sequelize=require(_0x0e93('0x0'));module[_0x0e93('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x0e93('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index c195cb5..9df0d0b 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 _0x7f31=['VIRTUAL','filter','includeAll','rows','catch','show','params','rawAttributes','include','options','find','body','ZendeskField','order','getFields','getSubjects','findOne','getTags','Tag','setTags','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','error','stack','name','map','ZendeskConfiguration','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge'];(function(_0x3794a0,_0x1a9cfc){var _0x5bdaba=function(_0x14a764){while(--_0x14a764){_0x3794a0['push'](_0x3794a0['shift']());}};_0x5bdaba(++_0x1a9cfc);}(_0x7f31,0x150));var _0x17f3=function(_0xdad237,_0x361a1d){_0xdad237=_0xdad237-0x0;var _0x15c575=_0x7f31[_0xdad237];return _0x15c575;};'use strict';var emlformat=require(_0x17f3('0x0'));var rimraf=require(_0x17f3('0x1'));var zipdir=require(_0x17f3('0x2'));var jsonpatch=require(_0x17f3('0x3'));var rp=require(_0x17f3('0x4'));var moment=require(_0x17f3('0x5'));var BPromise=require(_0x17f3('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x17f3('0x7'));var sox=require(_0x17f3('0x8'));var csv=require(_0x17f3('0x9'));var ejs=require(_0x17f3('0xa'));var fs=require('fs');var fs_extra=require(_0x17f3('0xb'));var _=require(_0x17f3('0xc'));var squel=require('squel');var crypto=require(_0x17f3('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x17f3('0xe'));var toCsv=require(_0x17f3('0x9'));var querystring=require(_0x17f3('0xf'));var Papa=require(_0x17f3('0x10'));var Redis=require(_0x17f3('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x17f3('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x17f3('0x13'));var utils=require(_0x17f3('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x17f3('0x15'));var db=require(_0x17f3('0x16'))['db'];function respondWithStatusCode(_0x4f1424,_0x3e2b2f){_0x3e2b2f=_0x3e2b2f||0xcc;return function(_0x536980){if(_0x536980){return _0x4f1424[_0x17f3('0x17')](_0x3e2b2f);}return _0x4f1424['status'](_0x3e2b2f)[_0x17f3('0x18')]();};}function respondWithResult(_0x171ee8,_0x31c97c){_0x31c97c=_0x31c97c||0xc8;return function(_0x5ab287){if(_0x5ab287){return _0x171ee8[_0x17f3('0x19')](_0x31c97c)[_0x17f3('0x1a')](_0x5ab287);}};}function respondWithFilteredResult(_0x5eef1d,_0x2a2004){return function(_0x56f434){if(_0x56f434){var _0x4c491a=typeof _0x2a2004[_0x17f3('0x1b')]===_0x17f3('0x1c')&&typeof _0x2a2004[_0x17f3('0x1d')]===_0x17f3('0x1c');var _0x56f393=_0x56f434[_0x17f3('0x1e')];var _0x57b94f=_0x4c491a?0x0:_0x2a2004[_0x17f3('0x1b')];var _0xf22a5e=_0x4c491a?_0x56f434[_0x17f3('0x1e')]:_0x2a2004['offset']+_0x2a2004[_0x17f3('0x1d')];var _0x359869;if(_0xf22a5e>=_0x56f393){_0xf22a5e=_0x56f393;_0x359869=0xc8;}else{_0x359869=0xce;}_0x5eef1d[_0x17f3('0x19')](_0x359869);return _0x5eef1d[_0x17f3('0x1f')](_0x17f3('0x20'),_0x57b94f+'-'+_0xf22a5e+'/'+_0x56f393)[_0x17f3('0x1a')](_0x56f434);}return null;};}function patchUpdates(_0x462df9){return function(_0x3831f1){try{jsonpatch[_0x17f3('0x21')](_0x3831f1,_0x462df9,!![]);}catch(_0x7eec42){return BPromise['reject'](_0x7eec42);}return _0x3831f1['save']();};}function saveUpdates(_0x37bfed,_0x5cfc81){return function(_0x296e5f){if(_0x296e5f){return _0x296e5f[_0x17f3('0x22')](_0x37bfed)[_0x17f3('0x23')](function(_0x1c2c9f){return _0x1c2c9f;});}return null;};}function removeEntity(_0x1866aa,_0xb94379){return function(_0x3b49d5){if(_0x3b49d5){return _0x3b49d5[_0x17f3('0x24')]()[_0x17f3('0x23')](function(){_0x1866aa[_0x17f3('0x19')](0xcc)[_0x17f3('0x18')]();});}};}function handleEntityNotFound(_0x2e0bcc,_0x3a6d16){return function(_0x1ad05d){if(!_0x1ad05d){_0x2e0bcc[_0x17f3('0x17')](0x194);}return _0x1ad05d;};}function handleError(_0x34c267,_0xae8c5){_0xae8c5=_0xae8c5||0x1f4;return function(_0x5db7c4){logger[_0x17f3('0x25')](_0x5db7c4[_0x17f3('0x26')]);if(_0x5db7c4[_0x17f3('0x27')]){delete _0x5db7c4[_0x17f3('0x27')];}_0x34c267[_0x17f3('0x19')](_0xae8c5)['send'](_0x5db7c4);};}exports['index']=function(_0x1ca1ae,_0x29f9cd){var _0x1a66e3={},_0x21ffcc={},_0x3c2fb9={'count':0x0,'rows':[]};var _0x2f3e6c=_[_0x17f3('0x28')](db[_0x17f3('0x29')]['rawAttributes'],function(_0x47af27){return{'name':_0x47af27[_0x17f3('0x2a')],'type':_0x47af27[_0x17f3('0x2b')][_0x17f3('0x2c')]};});_0x21ffcc[_0x17f3('0x2d')]=_['map'](_0x2f3e6c,_0x17f3('0x27'));_0x21ffcc[_0x17f3('0x2e')]=_[_0x17f3('0x2f')](_0x1ca1ae[_0x17f3('0x2e')]);_0x21ffcc[_0x17f3('0x30')]=_['intersection'](_0x21ffcc['model'],_0x21ffcc['query']);_0x1a66e3[_0x17f3('0x31')]=_[_0x17f3('0x32')](_0x21ffcc['model'],qs[_0x17f3('0x33')](_0x1ca1ae['query']['fields']));_0x1a66e3[_0x17f3('0x31')]=_0x1a66e3['attributes'][_0x17f3('0x34')]?_0x1a66e3[_0x17f3('0x31')]:_0x21ffcc['model'];if(!_0x1ca1ae[_0x17f3('0x2e')][_0x17f3('0x35')](_0x17f3('0x36'))){_0x1a66e3[_0x17f3('0x1d')]=qs[_0x17f3('0x1d')](_0x1ca1ae['query']['limit']);_0x1a66e3['offset']=qs[_0x17f3('0x1b')](_0x1ca1ae['query'][_0x17f3('0x1b')]);}_0x1a66e3['order']=qs[_0x17f3('0x37')](_0x1ca1ae['query']['sort']);_0x1a66e3[_0x17f3('0x38')]=qs['filters'](_[_0x17f3('0x39')](_0x1ca1ae['query'],_0x21ffcc[_0x17f3('0x30')]),_0x2f3e6c);if(_0x1ca1ae[_0x17f3('0x2e')]['filter']){_0x1a66e3['where']=_[_0x17f3('0x3a')](_0x1a66e3[_0x17f3('0x38')],{'$or':_[_0x17f3('0x28')](_0x2f3e6c,function(_0xf9ac23){if(_0xf9ac23['type']!==_0x17f3('0x3b')){var _0x170c8b={};_0x170c8b[_0xf9ac23[_0x17f3('0x27')]]={'$like':'%'+_0x1ca1ae['query'][_0x17f3('0x3c')]+'%'};return _0x170c8b;}})});}_0x1a66e3=_['merge']({},_0x1a66e3,_0x1ca1ae['options']);var _0x254a23={'where':_0x1a66e3[_0x17f3('0x38')]};return db[_0x17f3('0x29')][_0x17f3('0x1e')](_0x254a23)[_0x17f3('0x23')](function(_0x1acfd5){_0x3c2fb9[_0x17f3('0x1e')]=_0x1acfd5;if(_0x1ca1ae['query'][_0x17f3('0x3d')]){_0x1a66e3['include']=[{'all':!![]}];}return db[_0x17f3('0x29')]['findAll'](_0x1a66e3);})['then'](function(_0xc75ae0){_0x3c2fb9[_0x17f3('0x3e')]=_0xc75ae0;return _0x3c2fb9;})[_0x17f3('0x23')](respondWithFilteredResult(_0x29f9cd,_0x1a66e3))[_0x17f3('0x3f')](handleError(_0x29f9cd,null));};exports[_0x17f3('0x40')]=function(_0x528302,_0x282613){var _0x28042f={'raw':![],'where':{'id':_0x528302[_0x17f3('0x41')]['id']}},_0x3b95f7={};_0x3b95f7['model']=_[_0x17f3('0x2f')](db[_0x17f3('0x29')][_0x17f3('0x42')]);_0x3b95f7['query']=_[_0x17f3('0x2f')](_0x528302[_0x17f3('0x2e')]);_0x3b95f7[_0x17f3('0x30')]=_[_0x17f3('0x32')](_0x3b95f7[_0x17f3('0x2d')],_0x3b95f7[_0x17f3('0x2e')]);_0x28042f['attributes']=_[_0x17f3('0x32')](_0x3b95f7['model'],qs['fields'](_0x528302[_0x17f3('0x2e')][_0x17f3('0x33')]));_0x28042f['attributes']=_0x28042f['attributes'][_0x17f3('0x34')]?_0x28042f['attributes']:_0x3b95f7[_0x17f3('0x2d')];if(_0x528302[_0x17f3('0x2e')][_0x17f3('0x3d')]){_0x28042f[_0x17f3('0x43')]=[{'all':!![]}];}_0x28042f=_['merge']({},_0x28042f,_0x528302[_0x17f3('0x44')]);return db['ZendeskConfiguration'][_0x17f3('0x45')](_0x28042f)[_0x17f3('0x23')](handleEntityNotFound(_0x282613,null))[_0x17f3('0x23')](respondWithResult(_0x282613,null))[_0x17f3('0x3f')](handleError(_0x282613,null));};exports['create']=function(_0x2bba7b,_0x2cdf3a){return db[_0x17f3('0x29')]['create'](_0x2bba7b[_0x17f3('0x46')],{})[_0x17f3('0x23')](respondWithResult(_0x2cdf3a,0xc9))[_0x17f3('0x3f')](handleError(_0x2cdf3a,null));};exports[_0x17f3('0x22')]=function(_0x242467,_0x190434){if(_0x242467[_0x17f3('0x46')]['id']){delete _0x242467[_0x17f3('0x46')]['id'];}return db[_0x17f3('0x29')][_0x17f3('0x45')]({'where':{'id':_0x242467[_0x17f3('0x41')]['id']}})[_0x17f3('0x23')](handleEntityNotFound(_0x190434,null))[_0x17f3('0x23')](saveUpdates(_0x242467[_0x17f3('0x46')],null))[_0x17f3('0x23')](respondWithResult(_0x190434,null))['catch'](handleError(_0x190434,null));};exports[_0x17f3('0x24')]=function(_0x1f9b7c,_0x37dba0){return db[_0x17f3('0x29')][_0x17f3('0x45')]({'where':{'id':_0x1f9b7c['params']['id']}})[_0x17f3('0x23')](handleEntityNotFound(_0x37dba0,null))['then'](removeEntity(_0x37dba0,null))[_0x17f3('0x3f')](handleError(_0x37dba0,null));};exports['getFields']=function(_0x4ffd70,_0x52141d,_0x298eb9){var _0x533c7e={};var _0x4304ef={};var _0x24b85d;var _0x2d11ec;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x4ffd70[_0x17f3('0x41')]['id']}})[_0x17f3('0x23')](handleEntityNotFound(_0x52141d,null))['then'](function(_0xb22cca){if(_0xb22cca){_0x24b85d=_0xb22cca;_0x4304ef['model']=_['keys'](db[_0x17f3('0x47')][_0x17f3('0x42')]);_0x4304ef[_0x17f3('0x2e')]=_[_0x17f3('0x2f')](_0x4ffd70[_0x17f3('0x2e')]);_0x4304ef[_0x17f3('0x30')]=_['intersection'](_0x4304ef[_0x17f3('0x2d')],_0x4304ef[_0x17f3('0x2e')]);_0x533c7e[_0x17f3('0x31')]=_[_0x17f3('0x32')](_0x4304ef[_0x17f3('0x2d')],qs[_0x17f3('0x33')](_0x4ffd70[_0x17f3('0x2e')][_0x17f3('0x33')]));_0x533c7e['attributes']=_0x533c7e[_0x17f3('0x31')][_0x17f3('0x34')]?_0x533c7e[_0x17f3('0x31')]:_0x4304ef[_0x17f3('0x2d')];_0x533c7e[_0x17f3('0x48')]=qs['sort'](_0x4ffd70[_0x17f3('0x2e')][_0x17f3('0x37')]);_0x533c7e['where']=qs[_0x17f3('0x30')](_[_0x17f3('0x39')](_0x4ffd70[_0x17f3('0x2e')],_0x4304ef[_0x17f3('0x30')]));if(_0x4ffd70[_0x17f3('0x2e')][_0x17f3('0x3c')]){_0x533c7e[_0x17f3('0x38')]=_[_0x17f3('0x3a')](_0x533c7e[_0x17f3('0x38')],{'$or':_[_0x17f3('0x28')](_0x533c7e[_0x17f3('0x31')],function(_0x455607){var _0x5124dc={};_0x5124dc[_0x455607]={'$like':'%'+_0x4ffd70['query'][_0x17f3('0x3c')]+'%'};return _0x5124dc;})});}_0x533c7e=_[_0x17f3('0x3a')]({},_0x533c7e,_0x4ffd70[_0x17f3('0x44')]);return _0x24b85d[_0x17f3('0x49')](_0x533c7e);}})[_0x17f3('0x23')](function(_0x58d417){if(_0x58d417){_0x2d11ec=_0x58d417[_0x17f3('0x34')];if(!_0x4ffd70[_0x17f3('0x2e')][_0x17f3('0x35')](_0x17f3('0x36'))){_0x533c7e[_0x17f3('0x1d')]=qs[_0x17f3('0x1d')](_0x4ffd70[_0x17f3('0x2e')][_0x17f3('0x1d')]);_0x533c7e[_0x17f3('0x1b')]=qs[_0x17f3('0x1b')](_0x4ffd70[_0x17f3('0x2e')]['offset']);}return _0x24b85d[_0x17f3('0x49')](_0x533c7e);}})[_0x17f3('0x23')](function(_0x293d30){if(_0x293d30){return _0x293d30?{'count':_0x2d11ec,'rows':_0x293d30}:null;}})[_0x17f3('0x23')](respondWithResult(_0x52141d,null))[_0x17f3('0x3f')](handleError(_0x52141d,null));};exports[_0x17f3('0x4a')]=function(_0x22cb9f,_0x4810ab,_0x3d8f76){var _0x1beab7={};var _0x4b9f89={};var _0x4572d8;var _0x177332;return db[_0x17f3('0x29')][_0x17f3('0x4b')]({'where':{'id':_0x22cb9f[_0x17f3('0x41')]['id']}})[_0x17f3('0x23')](handleEntityNotFound(_0x4810ab,null))[_0x17f3('0x23')](function(_0x19f7ef){if(_0x19f7ef){_0x4572d8=_0x19f7ef;_0x4b9f89[_0x17f3('0x2d')]=_[_0x17f3('0x2f')](db[_0x17f3('0x47')][_0x17f3('0x42')]);_0x4b9f89[_0x17f3('0x2e')]=_[_0x17f3('0x2f')](_0x22cb9f['query']);_0x4b9f89[_0x17f3('0x30')]=_[_0x17f3('0x32')](_0x4b9f89[_0x17f3('0x2d')],_0x4b9f89[_0x17f3('0x2e')]);_0x1beab7[_0x17f3('0x31')]=_[_0x17f3('0x32')](_0x4b9f89[_0x17f3('0x2d')],qs[_0x17f3('0x33')](_0x22cb9f[_0x17f3('0x2e')][_0x17f3('0x33')]));_0x1beab7[_0x17f3('0x31')]=_0x1beab7[_0x17f3('0x31')][_0x17f3('0x34')]?_0x1beab7[_0x17f3('0x31')]:_0x4b9f89[_0x17f3('0x2d')];_0x1beab7[_0x17f3('0x48')]=qs['sort'](_0x22cb9f[_0x17f3('0x2e')][_0x17f3('0x37')]);_0x1beab7[_0x17f3('0x38')]=qs[_0x17f3('0x30')](_['pick'](_0x22cb9f['query'],_0x4b9f89[_0x17f3('0x30')]));if(_0x22cb9f[_0x17f3('0x2e')]['filter']){_0x1beab7[_0x17f3('0x38')]=_[_0x17f3('0x3a')](_0x1beab7['where'],{'$or':_[_0x17f3('0x28')](_0x1beab7[_0x17f3('0x31')],function(_0x27150){var _0x29703a={};_0x29703a[_0x27150]={'$like':'%'+_0x22cb9f[_0x17f3('0x2e')]['filter']+'%'};return _0x29703a;})});}_0x1beab7=_[_0x17f3('0x3a')]({},_0x1beab7,_0x22cb9f[_0x17f3('0x44')]);return _0x4572d8[_0x17f3('0x4a')](_0x1beab7);}})[_0x17f3('0x23')](function(_0xbda11b){if(_0xbda11b){_0x177332=_0xbda11b[_0x17f3('0x34')];if(!_0x22cb9f['query']['hasOwnProperty'](_0x17f3('0x36'))){_0x1beab7[_0x17f3('0x1d')]=qs['limit'](_0x22cb9f[_0x17f3('0x2e')][_0x17f3('0x1d')]);_0x1beab7['offset']=qs[_0x17f3('0x1b')](_0x22cb9f[_0x17f3('0x2e')][_0x17f3('0x1b')]);}return _0x4572d8[_0x17f3('0x4a')](_0x1beab7);}})[_0x17f3('0x23')](function(_0x57feef){if(_0x57feef){return _0x57feef?{'count':_0x177332,'rows':_0x57feef}:null;}})['then'](respondWithResult(_0x4810ab,null))[_0x17f3('0x3f')](handleError(_0x4810ab,null));};exports['getDescriptions']=function(_0x36d281,_0x460edd,_0x2c7826){var _0x4fcf0e={};var _0x34000f={};var _0x158f38;var _0x1f2aef;return db[_0x17f3('0x29')]['findOne']({'where':{'id':_0x36d281[_0x17f3('0x41')]['id']}})[_0x17f3('0x23')](handleEntityNotFound(_0x460edd,null))[_0x17f3('0x23')](function(_0x434745){if(_0x434745){_0x158f38=_0x434745;_0x34000f['model']=_[_0x17f3('0x2f')](db[_0x17f3('0x47')]['rawAttributes']);_0x34000f[_0x17f3('0x2e')]=_[_0x17f3('0x2f')](_0x36d281[_0x17f3('0x2e')]);_0x34000f[_0x17f3('0x30')]=_['intersection'](_0x34000f[_0x17f3('0x2d')],_0x34000f['query']);_0x4fcf0e[_0x17f3('0x31')]=_[_0x17f3('0x32')](_0x34000f[_0x17f3('0x2d')],qs[_0x17f3('0x33')](_0x36d281[_0x17f3('0x2e')]['fields']));_0x4fcf0e[_0x17f3('0x31')]=_0x4fcf0e['attributes'][_0x17f3('0x34')]?_0x4fcf0e[_0x17f3('0x31')]:_0x34000f['model'];_0x4fcf0e[_0x17f3('0x48')]=qs[_0x17f3('0x37')](_0x36d281[_0x17f3('0x2e')][_0x17f3('0x37')]);_0x4fcf0e['where']=qs[_0x17f3('0x30')](_[_0x17f3('0x39')](_0x36d281[_0x17f3('0x2e')],_0x34000f[_0x17f3('0x30')]));if(_0x36d281[_0x17f3('0x2e')][_0x17f3('0x3c')]){_0x4fcf0e[_0x17f3('0x38')]=_[_0x17f3('0x3a')](_0x4fcf0e['where'],{'$or':_[_0x17f3('0x28')](_0x4fcf0e[_0x17f3('0x31')],function(_0x315eed){var _0x1a3548={};_0x1a3548[_0x315eed]={'$like':'%'+_0x36d281[_0x17f3('0x2e')][_0x17f3('0x3c')]+'%'};return _0x1a3548;})});}_0x4fcf0e=_[_0x17f3('0x3a')]({},_0x4fcf0e,_0x36d281[_0x17f3('0x44')]);return _0x158f38['getDescriptions'](_0x4fcf0e);}})[_0x17f3('0x23')](function(_0x258e78){if(_0x258e78){_0x1f2aef=_0x258e78[_0x17f3('0x34')];if(!_0x36d281[_0x17f3('0x2e')][_0x17f3('0x35')](_0x17f3('0x36'))){_0x4fcf0e[_0x17f3('0x1d')]=qs[_0x17f3('0x1d')](_0x36d281['query'][_0x17f3('0x1d')]);_0x4fcf0e[_0x17f3('0x1b')]=qs[_0x17f3('0x1b')](_0x36d281[_0x17f3('0x2e')][_0x17f3('0x1b')]);}return _0x158f38['getDescriptions'](_0x4fcf0e);}})[_0x17f3('0x23')](function(_0x5b39fd){if(_0x5b39fd){return _0x5b39fd?{'count':_0x1f2aef,'rows':_0x5b39fd}:null;}})[_0x17f3('0x23')](respondWithResult(_0x460edd,null))[_0x17f3('0x3f')](handleError(_0x460edd,null));};exports[_0x17f3('0x4c')]=function(_0x1cd09c,_0x3411e5,_0x725480){var _0x31f422={};var _0x2b80c9={};var _0x57c7c0;var _0x4e2c5f;return db['ZendeskConfiguration'][_0x17f3('0x4b')]({'where':{'id':_0x1cd09c[_0x17f3('0x41')]['id']}})[_0x17f3('0x23')](handleEntityNotFound(_0x3411e5,null))[_0x17f3('0x23')](function(_0x49c400){if(_0x49c400){_0x57c7c0=_0x49c400;_0x2b80c9[_0x17f3('0x2d')]=_['keys'](db[_0x17f3('0x4d')][_0x17f3('0x42')]);_0x2b80c9[_0x17f3('0x2e')]=_[_0x17f3('0x2f')](_0x1cd09c['query']);_0x2b80c9[_0x17f3('0x30')]=_['intersection'](_0x2b80c9[_0x17f3('0x2d')],_0x2b80c9[_0x17f3('0x2e')]);_0x31f422[_0x17f3('0x31')]=_[_0x17f3('0x32')](_0x2b80c9[_0x17f3('0x2d')],qs[_0x17f3('0x33')](_0x1cd09c[_0x17f3('0x2e')]['fields']));_0x31f422[_0x17f3('0x31')]=_0x31f422[_0x17f3('0x31')][_0x17f3('0x34')]?_0x31f422[_0x17f3('0x31')]:_0x2b80c9[_0x17f3('0x2d')];_0x31f422[_0x17f3('0x48')]=qs[_0x17f3('0x37')](_0x1cd09c[_0x17f3('0x2e')][_0x17f3('0x37')]);_0x31f422[_0x17f3('0x38')]=qs[_0x17f3('0x30')](_[_0x17f3('0x39')](_0x1cd09c[_0x17f3('0x2e')],_0x2b80c9[_0x17f3('0x30')]));if(_0x1cd09c[_0x17f3('0x2e')][_0x17f3('0x3c')]){_0x31f422[_0x17f3('0x38')]=_['merge'](_0x31f422[_0x17f3('0x38')],{'$or':_['map'](_0x31f422[_0x17f3('0x31')],function(_0x2bb6f4){var _0x46427a={};_0x46427a[_0x2bb6f4]={'$like':'%'+_0x1cd09c['query'][_0x17f3('0x3c')]+'%'};return _0x46427a;})});}_0x31f422=_['merge']({},_0x31f422,_0x1cd09c[_0x17f3('0x44')]);return _0x57c7c0[_0x17f3('0x4c')](_0x31f422);}})['then'](function(_0x4caaa3){if(_0x4caaa3){_0x4e2c5f=_0x4caaa3['length'];if(!_0x1cd09c[_0x17f3('0x2e')]['hasOwnProperty'](_0x17f3('0x36'))){_0x31f422[_0x17f3('0x1d')]=qs['limit'](_0x1cd09c[_0x17f3('0x2e')][_0x17f3('0x1d')]);_0x31f422[_0x17f3('0x1b')]=qs['offset'](_0x1cd09c['query'][_0x17f3('0x1b')]);}return _0x57c7c0['getTags'](_0x31f422);}})['then'](function(_0x9e3780){if(_0x9e3780){return _0x9e3780?{'count':_0x4e2c5f,'rows':_0x9e3780}:null;}})[_0x17f3('0x23')](respondWithResult(_0x3411e5,null))[_0x17f3('0x3f')](handleError(_0x3411e5,null));};exports['setTags']=function(_0x131032,_0x1f4721,_0x1c2097){if(_0x131032[_0x17f3('0x46')]['id']){delete _0x131032[_0x17f3('0x46')]['id'];}return db[_0x17f3('0x29')][_0x17f3('0x4b')]({'where':{'id':_0x131032[_0x17f3('0x41')]['id']}})[_0x17f3('0x23')](handleEntityNotFound(_0x1f4721,null))['then'](function(_0x172068){if(_0x172068){return _0x172068[_0x17f3('0x4e')](_0x131032[_0x17f3('0x46')]['ids']||[]);}return null;})['then'](respondWithResult(_0x1f4721,null))['catch'](handleError(_0x1f4721,null));}; \ No newline at end of file +var _0x6e70=['moment','bluebird','mustache','util','path','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','undefined','offset','limit','set','reject','save','update','then','destroy','end','error','name','map','ZendeskConfiguration','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','include','findAll','rows','catch','params','create','body','find','getFields','findOne','hasOwnProperty','getSubjects','ZendeskField','getDescriptions','getTags','setTags','ids','eml-format','zip-dir','fast-json-patch','request-promise'];(function(_0x2212d1,_0x483fc8){var _0x15eec5=function(_0x15e6ac){while(--_0x15e6ac){_0x2212d1['push'](_0x2212d1['shift']());}};_0x15eec5(++_0x483fc8);}(_0x6e70,0x1d6));var _0x06e7=function(_0x2ed27e,_0x4393ee){_0x2ed27e=_0x2ed27e-0x0;var _0x5e1d88=_0x6e70[_0x2ed27e];return _0x5e1d88;};'use strict';var emlformat=require(_0x06e7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x06e7('0x1'));var jsonpatch=require(_0x06e7('0x2'));var rp=require(_0x06e7('0x3'));var moment=require(_0x06e7('0x4'));var BPromise=require(_0x06e7('0x5'));var Mustache=require(_0x06e7('0x6'));var util=require(_0x06e7('0x7'));var path=require(_0x06e7('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x06e7('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x06e7('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x06e7('0xb'));var deskjs=require(_0x06e7('0xc'));var toCsv=require('to-csv');var querystring=require(_0x06e7('0xd'));var Papa=require(_0x06e7('0xe'));var Redis=require(_0x06e7('0xf'));var authService=require(_0x06e7('0x10'));var qs=require(_0x06e7('0x11'));var as=require(_0x06e7('0x12'));var hardwareService=require(_0x06e7('0x13'));var logger=require(_0x06e7('0x14'))(_0x06e7('0x15'));var utils=require(_0x06e7('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x06e7('0x17'))['db'];function respondWithStatusCode(_0x1743e7,_0x585af8){_0x585af8=_0x585af8||0xcc;return function(_0x479481){if(_0x479481){return _0x1743e7[_0x06e7('0x18')](_0x585af8);}return _0x1743e7[_0x06e7('0x19')](_0x585af8)['end']();};}function respondWithResult(_0x229e44,_0x1fac22){_0x1fac22=_0x1fac22||0xc8;return function(_0x5e7547){if(_0x5e7547){return _0x229e44[_0x06e7('0x19')](_0x1fac22)[_0x06e7('0x1a')](_0x5e7547);}};}function respondWithFilteredResult(_0xe5e291,_0x15462f){return function(_0x36a310){if(_0x36a310){var _0x3593e3=typeof _0x15462f['offset']===_0x06e7('0x1b')&&typeof _0x15462f['limit']===_0x06e7('0x1b');var _0x5b83a7=_0x36a310['count'];var _0x38d94f=_0x3593e3?0x0:_0x15462f[_0x06e7('0x1c')];var _0x1775a6=_0x3593e3?_0x36a310['count']:_0x15462f[_0x06e7('0x1c')]+_0x15462f[_0x06e7('0x1d')];var _0xe1afc2;if(_0x1775a6>=_0x5b83a7){_0x1775a6=_0x5b83a7;_0xe1afc2=0xc8;}else{_0xe1afc2=0xce;}_0xe5e291[_0x06e7('0x19')](_0xe1afc2);return _0xe5e291[_0x06e7('0x1e')]('Content-Range',_0x38d94f+'-'+_0x1775a6+'/'+_0x5b83a7)[_0x06e7('0x1a')](_0x36a310);}return null;};}function patchUpdates(_0xf5e025){return function(_0x4065b3){try{jsonpatch['apply'](_0x4065b3,_0xf5e025,!![]);}catch(_0x3c8547){return BPromise[_0x06e7('0x1f')](_0x3c8547);}return _0x4065b3[_0x06e7('0x20')]();};}function saveUpdates(_0x24a085,_0x4bfe70){return function(_0x526850){if(_0x526850){return _0x526850[_0x06e7('0x21')](_0x24a085)[_0x06e7('0x22')](function(_0x3298b4){return _0x3298b4;});}return null;};}function removeEntity(_0x14e53a,_0x269e6f){return function(_0x4daa30){if(_0x4daa30){return _0x4daa30[_0x06e7('0x23')]()[_0x06e7('0x22')](function(){_0x14e53a[_0x06e7('0x19')](0xcc)[_0x06e7('0x24')]();});}};}function handleEntityNotFound(_0x210b21,_0x2a776a){return function(_0xf71835){if(!_0xf71835){_0x210b21[_0x06e7('0x18')](0x194);}return _0xf71835;};}function handleError(_0x3a1f4c,_0x31f8f7){_0x31f8f7=_0x31f8f7||0x1f4;return function(_0x41d745){logger[_0x06e7('0x25')](_0x41d745['stack']);if(_0x41d745[_0x06e7('0x26')]){delete _0x41d745[_0x06e7('0x26')];}_0x3a1f4c['status'](_0x31f8f7)['send'](_0x41d745);};}exports['index']=function(_0x254725,_0x256d31){var _0xa77cb6={},_0x5dc3dd={},_0x5e43d9={'count':0x0,'rows':[]};var _0x24887e=_[_0x06e7('0x27')](db[_0x06e7('0x28')][_0x06e7('0x29')],function(_0x458ba3){return{'name':_0x458ba3[_0x06e7('0x2a')],'type':_0x458ba3['type'][_0x06e7('0x2b')]};});_0x5dc3dd[_0x06e7('0x2c')]=_[_0x06e7('0x27')](_0x24887e,_0x06e7('0x26'));_0x5dc3dd[_0x06e7('0x2d')]=_[_0x06e7('0x2e')](_0x254725[_0x06e7('0x2d')]);_0x5dc3dd[_0x06e7('0x2f')]=_[_0x06e7('0x30')](_0x5dc3dd[_0x06e7('0x2c')],_0x5dc3dd['query']);_0xa77cb6[_0x06e7('0x31')]=_[_0x06e7('0x30')](_0x5dc3dd[_0x06e7('0x2c')],qs[_0x06e7('0x32')](_0x254725[_0x06e7('0x2d')][_0x06e7('0x32')]));_0xa77cb6[_0x06e7('0x31')]=_0xa77cb6[_0x06e7('0x31')][_0x06e7('0x33')]?_0xa77cb6[_0x06e7('0x31')]:_0x5dc3dd[_0x06e7('0x2c')];if(!_0x254725[_0x06e7('0x2d')]['hasOwnProperty'](_0x06e7('0x34'))){_0xa77cb6[_0x06e7('0x1d')]=qs[_0x06e7('0x1d')](_0x254725[_0x06e7('0x2d')]['limit']);_0xa77cb6[_0x06e7('0x1c')]=qs[_0x06e7('0x1c')](_0x254725[_0x06e7('0x2d')][_0x06e7('0x1c')]);}_0xa77cb6[_0x06e7('0x35')]=qs[_0x06e7('0x36')](_0x254725[_0x06e7('0x2d')][_0x06e7('0x36')]);_0xa77cb6[_0x06e7('0x37')]=qs['filters'](_[_0x06e7('0x38')](_0x254725['query'],_0x5dc3dd[_0x06e7('0x2f')]),_0x24887e);if(_0x254725['query'][_0x06e7('0x39')]){_0xa77cb6['where']=_[_0x06e7('0x3a')](_0xa77cb6[_0x06e7('0x37')],{'$or':_[_0x06e7('0x27')](_0x24887e,function(_0x39ba67){if(_0x39ba67['type']!==_0x06e7('0x3b')){var _0x2eb70e={};_0x2eb70e[_0x39ba67['name']]={'$like':'%'+_0x254725[_0x06e7('0x2d')][_0x06e7('0x39')]+'%'};return _0x2eb70e;}})});}_0xa77cb6=_[_0x06e7('0x3a')]({},_0xa77cb6,_0x254725[_0x06e7('0x3c')]);var _0x1cdf4f={'where':_0xa77cb6[_0x06e7('0x37')]};return db[_0x06e7('0x28')]['count'](_0x1cdf4f)[_0x06e7('0x22')](function(_0x3576a6){_0x5e43d9[_0x06e7('0x3d')]=_0x3576a6;if(_0x254725[_0x06e7('0x2d')]['includeAll']){_0xa77cb6[_0x06e7('0x3e')]=[{'all':!![]}];}return db[_0x06e7('0x28')][_0x06e7('0x3f')](_0xa77cb6);})['then'](function(_0x29e91e){_0x5e43d9[_0x06e7('0x40')]=_0x29e91e;return _0x5e43d9;})[_0x06e7('0x22')](respondWithFilteredResult(_0x256d31,_0xa77cb6))[_0x06e7('0x41')](handleError(_0x256d31,null));};exports['show']=function(_0x327396,_0x2942be){var _0x5002af={'raw':![],'where':{'id':_0x327396[_0x06e7('0x42')]['id']}},_0xe2bb58={};_0xe2bb58[_0x06e7('0x2c')]=_['keys'](db[_0x06e7('0x28')][_0x06e7('0x29')]);_0xe2bb58[_0x06e7('0x2d')]=_['keys'](_0x327396[_0x06e7('0x2d')]);_0xe2bb58[_0x06e7('0x2f')]=_['intersection'](_0xe2bb58[_0x06e7('0x2c')],_0xe2bb58[_0x06e7('0x2d')]);_0x5002af[_0x06e7('0x31')]=_[_0x06e7('0x30')](_0xe2bb58[_0x06e7('0x2c')],qs[_0x06e7('0x32')](_0x327396[_0x06e7('0x2d')][_0x06e7('0x32')]));_0x5002af['attributes']=_0x5002af[_0x06e7('0x31')][_0x06e7('0x33')]?_0x5002af[_0x06e7('0x31')]:_0xe2bb58[_0x06e7('0x2c')];if(_0x327396[_0x06e7('0x2d')]['includeAll']){_0x5002af[_0x06e7('0x3e')]=[{'all':!![]}];}_0x5002af=_[_0x06e7('0x3a')]({},_0x5002af,_0x327396[_0x06e7('0x3c')]);return db[_0x06e7('0x28')]['find'](_0x5002af)['then'](handleEntityNotFound(_0x2942be,null))[_0x06e7('0x22')](respondWithResult(_0x2942be,null))['catch'](handleError(_0x2942be,null));};exports[_0x06e7('0x43')]=function(_0x181b26,_0x4fea3e){return db[_0x06e7('0x28')][_0x06e7('0x43')](_0x181b26[_0x06e7('0x44')],{})[_0x06e7('0x22')](respondWithResult(_0x4fea3e,0xc9))['catch'](handleError(_0x4fea3e,null));};exports[_0x06e7('0x21')]=function(_0x5688c9,_0x1ecfa0){if(_0x5688c9[_0x06e7('0x44')]['id']){delete _0x5688c9[_0x06e7('0x44')]['id'];}return db['ZendeskConfiguration']['find']({'where':{'id':_0x5688c9[_0x06e7('0x42')]['id']}})[_0x06e7('0x22')](handleEntityNotFound(_0x1ecfa0,null))[_0x06e7('0x22')](saveUpdates(_0x5688c9[_0x06e7('0x44')],null))['then'](respondWithResult(_0x1ecfa0,null))[_0x06e7('0x41')](handleError(_0x1ecfa0,null));};exports[_0x06e7('0x23')]=function(_0x5a0ee8,_0xa3aa26){return db[_0x06e7('0x28')][_0x06e7('0x45')]({'where':{'id':_0x5a0ee8[_0x06e7('0x42')]['id']}})[_0x06e7('0x22')](handleEntityNotFound(_0xa3aa26,null))[_0x06e7('0x22')](removeEntity(_0xa3aa26,null))[_0x06e7('0x41')](handleError(_0xa3aa26,null));};exports[_0x06e7('0x46')]=function(_0x36dff5,_0xcc6419,_0x13e3b0){var _0xf47b7f={};var _0x400042={};var _0x209786;var _0x35abbe;return db['ZendeskConfiguration'][_0x06e7('0x47')]({'where':{'id':_0x36dff5[_0x06e7('0x42')]['id']}})['then'](handleEntityNotFound(_0xcc6419,null))['then'](function(_0x4ba8d6){if(_0x4ba8d6){_0x209786=_0x4ba8d6;_0x400042[_0x06e7('0x2c')]=_['keys'](db['ZendeskField'][_0x06e7('0x29')]);_0x400042[_0x06e7('0x2d')]=_['keys'](_0x36dff5[_0x06e7('0x2d')]);_0x400042[_0x06e7('0x2f')]=_[_0x06e7('0x30')](_0x400042[_0x06e7('0x2c')],_0x400042[_0x06e7('0x2d')]);_0xf47b7f[_0x06e7('0x31')]=_[_0x06e7('0x30')](_0x400042[_0x06e7('0x2c')],qs['fields'](_0x36dff5['query'][_0x06e7('0x32')]));_0xf47b7f[_0x06e7('0x31')]=_0xf47b7f['attributes'][_0x06e7('0x33')]?_0xf47b7f[_0x06e7('0x31')]:_0x400042[_0x06e7('0x2c')];_0xf47b7f[_0x06e7('0x35')]=qs['sort'](_0x36dff5[_0x06e7('0x2d')][_0x06e7('0x36')]);_0xf47b7f['where']=qs[_0x06e7('0x2f')](_[_0x06e7('0x38')](_0x36dff5[_0x06e7('0x2d')],_0x400042[_0x06e7('0x2f')]));if(_0x36dff5[_0x06e7('0x2d')][_0x06e7('0x39')]){_0xf47b7f['where']=_[_0x06e7('0x3a')](_0xf47b7f[_0x06e7('0x37')],{'$or':_['map'](_0xf47b7f[_0x06e7('0x31')],function(_0x2d1c5d){var _0x8b5914={};_0x8b5914[_0x2d1c5d]={'$like':'%'+_0x36dff5[_0x06e7('0x2d')][_0x06e7('0x39')]+'%'};return _0x8b5914;})});}_0xf47b7f=_[_0x06e7('0x3a')]({},_0xf47b7f,_0x36dff5[_0x06e7('0x3c')]);return _0x209786[_0x06e7('0x46')](_0xf47b7f);}})[_0x06e7('0x22')](function(_0x5e755d){if(_0x5e755d){_0x35abbe=_0x5e755d[_0x06e7('0x33')];if(!_0x36dff5[_0x06e7('0x2d')][_0x06e7('0x48')](_0x06e7('0x34'))){_0xf47b7f[_0x06e7('0x1d')]=qs[_0x06e7('0x1d')](_0x36dff5[_0x06e7('0x2d')]['limit']);_0xf47b7f[_0x06e7('0x1c')]=qs[_0x06e7('0x1c')](_0x36dff5[_0x06e7('0x2d')][_0x06e7('0x1c')]);}return _0x209786[_0x06e7('0x46')](_0xf47b7f);}})[_0x06e7('0x22')](function(_0x21b470){if(_0x21b470){return _0x21b470?{'count':_0x35abbe,'rows':_0x21b470}:null;}})[_0x06e7('0x22')](respondWithResult(_0xcc6419,null))[_0x06e7('0x41')](handleError(_0xcc6419,null));};exports[_0x06e7('0x49')]=function(_0x15506b,_0x4bcd20,_0x543ee6){var _0x1ae2c9={};var _0x122754={};var _0x2b0a30;var _0x3786a2;return db[_0x06e7('0x28')][_0x06e7('0x47')]({'where':{'id':_0x15506b[_0x06e7('0x42')]['id']}})[_0x06e7('0x22')](handleEntityNotFound(_0x4bcd20,null))['then'](function(_0x29e413){if(_0x29e413){_0x2b0a30=_0x29e413;_0x122754[_0x06e7('0x2c')]=_['keys'](db[_0x06e7('0x4a')][_0x06e7('0x29')]);_0x122754[_0x06e7('0x2d')]=_[_0x06e7('0x2e')](_0x15506b[_0x06e7('0x2d')]);_0x122754[_0x06e7('0x2f')]=_[_0x06e7('0x30')](_0x122754[_0x06e7('0x2c')],_0x122754['query']);_0x1ae2c9[_0x06e7('0x31')]=_['intersection'](_0x122754[_0x06e7('0x2c')],qs[_0x06e7('0x32')](_0x15506b[_0x06e7('0x2d')][_0x06e7('0x32')]));_0x1ae2c9[_0x06e7('0x31')]=_0x1ae2c9[_0x06e7('0x31')]['length']?_0x1ae2c9[_0x06e7('0x31')]:_0x122754[_0x06e7('0x2c')];_0x1ae2c9[_0x06e7('0x35')]=qs[_0x06e7('0x36')](_0x15506b[_0x06e7('0x2d')]['sort']);_0x1ae2c9[_0x06e7('0x37')]=qs[_0x06e7('0x2f')](_[_0x06e7('0x38')](_0x15506b['query'],_0x122754[_0x06e7('0x2f')]));if(_0x15506b[_0x06e7('0x2d')][_0x06e7('0x39')]){_0x1ae2c9[_0x06e7('0x37')]=_[_0x06e7('0x3a')](_0x1ae2c9[_0x06e7('0x37')],{'$or':_[_0x06e7('0x27')](_0x1ae2c9[_0x06e7('0x31')],function(_0x2c4bcd){var _0x584100={};_0x584100[_0x2c4bcd]={'$like':'%'+_0x15506b[_0x06e7('0x2d')]['filter']+'%'};return _0x584100;})});}_0x1ae2c9=_['merge']({},_0x1ae2c9,_0x15506b[_0x06e7('0x3c')]);return _0x2b0a30[_0x06e7('0x49')](_0x1ae2c9);}})[_0x06e7('0x22')](function(_0x4594ab){if(_0x4594ab){_0x3786a2=_0x4594ab[_0x06e7('0x33')];if(!_0x15506b[_0x06e7('0x2d')][_0x06e7('0x48')]('nolimit')){_0x1ae2c9[_0x06e7('0x1d')]=qs[_0x06e7('0x1d')](_0x15506b[_0x06e7('0x2d')][_0x06e7('0x1d')]);_0x1ae2c9[_0x06e7('0x1c')]=qs[_0x06e7('0x1c')](_0x15506b[_0x06e7('0x2d')]['offset']);}return _0x2b0a30[_0x06e7('0x49')](_0x1ae2c9);}})[_0x06e7('0x22')](function(_0xdd9a34){if(_0xdd9a34){return _0xdd9a34?{'count':_0x3786a2,'rows':_0xdd9a34}:null;}})[_0x06e7('0x22')](respondWithResult(_0x4bcd20,null))[_0x06e7('0x41')](handleError(_0x4bcd20,null));};exports[_0x06e7('0x4b')]=function(_0x56be0b,_0x3c857f,_0x9d92a8){var _0x183618={};var _0x2462a6={};var _0x108d3a;var _0x2f6ed6;return db[_0x06e7('0x28')][_0x06e7('0x47')]({'where':{'id':_0x56be0b[_0x06e7('0x42')]['id']}})['then'](handleEntityNotFound(_0x3c857f,null))[_0x06e7('0x22')](function(_0x362a93){if(_0x362a93){_0x108d3a=_0x362a93;_0x2462a6[_0x06e7('0x2c')]=_['keys'](db['ZendeskField']['rawAttributes']);_0x2462a6['query']=_[_0x06e7('0x2e')](_0x56be0b[_0x06e7('0x2d')]);_0x2462a6[_0x06e7('0x2f')]=_[_0x06e7('0x30')](_0x2462a6[_0x06e7('0x2c')],_0x2462a6[_0x06e7('0x2d')]);_0x183618[_0x06e7('0x31')]=_[_0x06e7('0x30')](_0x2462a6[_0x06e7('0x2c')],qs[_0x06e7('0x32')](_0x56be0b[_0x06e7('0x2d')][_0x06e7('0x32')]));_0x183618['attributes']=_0x183618[_0x06e7('0x31')][_0x06e7('0x33')]?_0x183618[_0x06e7('0x31')]:_0x2462a6[_0x06e7('0x2c')];_0x183618[_0x06e7('0x35')]=qs[_0x06e7('0x36')](_0x56be0b[_0x06e7('0x2d')]['sort']);_0x183618[_0x06e7('0x37')]=qs['filters'](_[_0x06e7('0x38')](_0x56be0b[_0x06e7('0x2d')],_0x2462a6['filters']));if(_0x56be0b[_0x06e7('0x2d')]['filter']){_0x183618[_0x06e7('0x37')]=_[_0x06e7('0x3a')](_0x183618[_0x06e7('0x37')],{'$or':_[_0x06e7('0x27')](_0x183618[_0x06e7('0x31')],function(_0x55b936){var _0x427721={};_0x427721[_0x55b936]={'$like':'%'+_0x56be0b[_0x06e7('0x2d')][_0x06e7('0x39')]+'%'};return _0x427721;})});}_0x183618=_['merge']({},_0x183618,_0x56be0b[_0x06e7('0x3c')]);return _0x108d3a['getDescriptions'](_0x183618);}})['then'](function(_0x128279){if(_0x128279){_0x2f6ed6=_0x128279['length'];if(!_0x56be0b[_0x06e7('0x2d')][_0x06e7('0x48')](_0x06e7('0x34'))){_0x183618[_0x06e7('0x1d')]=qs[_0x06e7('0x1d')](_0x56be0b[_0x06e7('0x2d')][_0x06e7('0x1d')]);_0x183618[_0x06e7('0x1c')]=qs[_0x06e7('0x1c')](_0x56be0b[_0x06e7('0x2d')]['offset']);}return _0x108d3a['getDescriptions'](_0x183618);}})[_0x06e7('0x22')](function(_0x3579c7){if(_0x3579c7){return _0x3579c7?{'count':_0x2f6ed6,'rows':_0x3579c7}:null;}})[_0x06e7('0x22')](respondWithResult(_0x3c857f,null))[_0x06e7('0x41')](handleError(_0x3c857f,null));};exports[_0x06e7('0x4c')]=function(_0x452555,_0x46a37b,_0x589c81){var _0x2f67c4={};var _0x33c8ee={};var _0x5f27e6;var _0x12c686;return db[_0x06e7('0x28')][_0x06e7('0x47')]({'where':{'id':_0x452555[_0x06e7('0x42')]['id']}})[_0x06e7('0x22')](handleEntityNotFound(_0x46a37b,null))[_0x06e7('0x22')](function(_0x43a4d7){if(_0x43a4d7){_0x5f27e6=_0x43a4d7;_0x33c8ee[_0x06e7('0x2c')]=_['keys'](db['Tag']['rawAttributes']);_0x33c8ee['query']=_[_0x06e7('0x2e')](_0x452555[_0x06e7('0x2d')]);_0x33c8ee['filters']=_[_0x06e7('0x30')](_0x33c8ee['model'],_0x33c8ee[_0x06e7('0x2d')]);_0x2f67c4[_0x06e7('0x31')]=_[_0x06e7('0x30')](_0x33c8ee[_0x06e7('0x2c')],qs['fields'](_0x452555[_0x06e7('0x2d')][_0x06e7('0x32')]));_0x2f67c4[_0x06e7('0x31')]=_0x2f67c4[_0x06e7('0x31')][_0x06e7('0x33')]?_0x2f67c4[_0x06e7('0x31')]:_0x33c8ee['model'];_0x2f67c4['order']=qs['sort'](_0x452555[_0x06e7('0x2d')][_0x06e7('0x36')]);_0x2f67c4['where']=qs[_0x06e7('0x2f')](_[_0x06e7('0x38')](_0x452555[_0x06e7('0x2d')],_0x33c8ee[_0x06e7('0x2f')]));if(_0x452555[_0x06e7('0x2d')][_0x06e7('0x39')]){_0x2f67c4[_0x06e7('0x37')]=_[_0x06e7('0x3a')](_0x2f67c4['where'],{'$or':_['map'](_0x2f67c4['attributes'],function(_0x8975b1){var _0x2d8ee2={};_0x2d8ee2[_0x8975b1]={'$like':'%'+_0x452555[_0x06e7('0x2d')]['filter']+'%'};return _0x2d8ee2;})});}_0x2f67c4=_[_0x06e7('0x3a')]({},_0x2f67c4,_0x452555[_0x06e7('0x3c')]);return _0x5f27e6[_0x06e7('0x4c')](_0x2f67c4);}})[_0x06e7('0x22')](function(_0x5a087a){if(_0x5a087a){_0x12c686=_0x5a087a['length'];if(!_0x452555[_0x06e7('0x2d')][_0x06e7('0x48')]('nolimit')){_0x2f67c4[_0x06e7('0x1d')]=qs[_0x06e7('0x1d')](_0x452555[_0x06e7('0x2d')]['limit']);_0x2f67c4[_0x06e7('0x1c')]=qs['offset'](_0x452555['query']['offset']);}return _0x5f27e6['getTags'](_0x2f67c4);}})[_0x06e7('0x22')](function(_0x3598f3){if(_0x3598f3){return _0x3598f3?{'count':_0x12c686,'rows':_0x3598f3}:null;}})[_0x06e7('0x22')](respondWithResult(_0x46a37b,null))[_0x06e7('0x41')](handleError(_0x46a37b,null));};exports[_0x06e7('0x4d')]=function(_0x3fdf4a,_0x1947e8,_0x535ff6){if(_0x3fdf4a[_0x06e7('0x44')]['id']){delete _0x3fdf4a[_0x06e7('0x44')]['id'];}return db[_0x06e7('0x28')]['findOne']({'where':{'id':_0x3fdf4a[_0x06e7('0x42')]['id']}})[_0x06e7('0x22')](handleEntityNotFound(_0x1947e8,null))[_0x06e7('0x22')](function(_0x3e5312){if(_0x3e5312){return _0x3e5312['setTags'](_0x3fdf4a[_0x06e7('0x44')][_0x06e7('0x4e')]||[]);}return null;})['then'](respondWithResult(_0x1947e8,null))['catch'](handleError(_0x1947e8,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 68c60a5..459a440 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 _0x8e3f=['request-promise','rimraf','../../config/environment','exports','define','int_zendesk_configurations','lodash','util','../../config/logger','moment','bluebird'];(function(_0x428537,_0x23ca2b){var _0x19fa2b=function(_0x43a131){while(--_0x43a131){_0x428537['push'](_0x428537['shift']());}};_0x19fa2b(++_0x23ca2b);}(_0x8e3f,0xc1));var _0xf8e3=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x8e3f[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0xf8e3('0x0'));var util=require(_0xf8e3('0x1'));var logger=require(_0xf8e3('0x2'))('api');var moment=require(_0xf8e3('0x3'));var BPromise=require(_0xf8e3('0x4'));var rp=require(_0xf8e3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf8e3('0x6'));var config=require(_0xf8e3('0x7'));var attributes=require('./intZendeskConfiguration.attributes');module[_0xf8e3('0x8')]=function(_0xb21f8d,_0x2621c5){return _0xb21f8d[_0xf8e3('0x9')]('ZendeskConfiguration',attributes,{'tableName':_0xf8e3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7d25=['api','moment','bluebird','request-promise','path','define','ZendeskConfiguration','int_zendesk_configurations','util','../../config/logger'];(function(_0x2c0c8d,_0x4a86c7){var _0x114e7a=function(_0x5ef296){while(--_0x5ef296){_0x2c0c8d['push'](_0x2c0c8d['shift']());}};_0x114e7a(++_0x4a86c7);}(_0x7d25,0x8a));var _0x57d2=function(_0x44946b,_0xf874ec){_0x44946b=_0x44946b-0x0;var _0x249bc4=_0x7d25[_0x44946b];return _0x249bc4;};'use strict';var _=require('lodash');var util=require(_0x57d2('0x0'));var logger=require(_0x57d2('0x1'))(_0x57d2('0x2'));var moment=require(_0x57d2('0x3'));var BPromise=require(_0x57d2('0x4'));var rp=require(_0x57d2('0x5'));var fs=require('fs');var path=require(_0x57d2('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intZendeskConfiguration.attributes');module['exports']=function(_0x3c5511,_0x49cc5f){return _0x3c5511[_0x57d2('0x7')](_0x57d2('0x8'),attributes,{'tableName':_0x57d2('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 de07b43..91bbf5d 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 _0xe2cc=['util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash'];(function(_0x3bde28,_0x1915f2){var _0x2a6a35=function(_0xd1e2c3){while(--_0xd1e2c3){_0x3bde28['push'](_0x3bde28['shift']());}};_0x2a6a35(++_0x1915f2);}(_0xe2cc,0xe5));var _0xce2c=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0xe2cc[_0x173441];return _0x2423a8;};'use strict';var _=require(_0xce2c('0x0'));var util=require(_0xce2c('0x1'));var moment=require(_0xce2c('0x2'));var BPromise=require(_0xce2c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xce2c('0x4'));var db=require(_0xce2c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xce2c('0x6'))(_0xce2c('0x7'));var config=require(_0xce2c('0x8'));var jayson=require(_0xce2c('0x9'));var client=jayson[_0xce2c('0xa')][_0xce2c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x125f03,_0x28e701,_0x4a41e5){return new BPromise(function(_0x408b17,_0x56de2a){return client[_0xce2c('0xc')](_0x125f03,_0x4a41e5)[_0xce2c('0xd')](function(_0x460b52){logger[_0xce2c('0xe')](_0xce2c('0xf'),_0x28e701,_0xce2c('0x10'));logger['debug'](_0xce2c('0x11'),_0x28e701,_0xce2c('0x10'),JSON['stringify'](_0x460b52));if(_0x460b52[_0xce2c('0x12')]){if(_0x460b52[_0xce2c('0x12')][_0xce2c('0x13')]===0x1f4){logger[_0xce2c('0x12')](_0xce2c('0xf'),_0x28e701,_0x460b52['error'][_0xce2c('0x14')]);return _0x56de2a(_0x460b52[_0xce2c('0x12')][_0xce2c('0x14')]);}logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x28e701,_0x460b52[_0xce2c('0x12')][_0xce2c('0x14')]);return _0x408b17(_0x460b52['error']['message']);}else{logger[_0xce2c('0xe')](_0xce2c('0xf'),_0x28e701,_0xce2c('0x10'));_0x408b17(_0x460b52[_0xce2c('0x15')][_0xce2c('0x14')]);}})[_0xce2c('0x16')](function(_0x2c53bc){logger[_0xce2c('0x12')](_0xce2c('0xf'),_0x28e701,_0x2c53bc);_0x56de2a(_0x2c53bc);});});} \ No newline at end of file +var _0x0d7f=['ZendeskConfiguration,\x20%s,\x20%s','message','info','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','error','code'];(function(_0x2f1477,_0x4857be){var _0x5ada87=function(_0x1f0637){while(--_0x1f0637){_0x2f1477['push'](_0x2f1477['shift']());}};_0x5ada87(++_0x4857be);}(_0x0d7f,0x194));var _0xf0d7=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x0d7f[_0x16b9ed];return _0x66b1f8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf0d7('0x0'));var BPromise=require(_0xf0d7('0x1'));var rs=require(_0xf0d7('0x2'));var fs=require('fs');var Redis=require(_0xf0d7('0x3'));var db=require(_0xf0d7('0x4'))['db'];var utils=require(_0xf0d7('0x5'));var logger=require(_0xf0d7('0x6'))('rpc');var config=require(_0xf0d7('0x7'));var jayson=require(_0xf0d7('0x8'));var client=jayson[_0xf0d7('0x9')][_0xf0d7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xdb5616,_0x362c53,_0x5e896c){return new BPromise(function(_0x250081,_0x1caf40){return client[_0xf0d7('0xb')](_0xdb5616,_0x5e896c)['then'](function(_0x3b5263){logger['info']('ZendeskConfiguration,\x20%s,\x20%s',_0x362c53,_0xf0d7('0xc'));logger[_0xf0d7('0xd')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x362c53,_0xf0d7('0xc'),JSON['stringify'](_0x3b5263));if(_0x3b5263[_0xf0d7('0xe')]){if(_0x3b5263['error'][_0xf0d7('0xf')]===0x1f4){logger['error'](_0xf0d7('0x10'),_0x362c53,_0x3b5263[_0xf0d7('0xe')][_0xf0d7('0x11')]);return _0x1caf40(_0x3b5263['error'][_0xf0d7('0x11')]);}logger[_0xf0d7('0xe')](_0xf0d7('0x10'),_0x362c53,_0x3b5263[_0xf0d7('0xe')][_0xf0d7('0x11')]);return _0x250081(_0x3b5263[_0xf0d7('0xe')][_0xf0d7('0x11')]);}else{logger[_0xf0d7('0x12')](_0xf0d7('0x10'),_0x362c53,_0xf0d7('0xc'));_0x250081(_0x3b5263['result'][_0xf0d7('0x11')]);}})[_0xf0d7('0x13')](function(_0x257320){logger[_0xf0d7('0xe')]('ZendeskConfiguration,\x20%s,\x20%s',_0x362c53,_0x257320);_0x1caf40(_0x257320);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index de2037b..0d223c8 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 _0x4916=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intZendeskField.controller','get','index','/:id','isAuthenticated','post','create','put','update','delete','exports','multer'];(function(_0x123b8b,_0x121d55){var _0x14785d=function(_0x2ccc40){while(--_0x2ccc40){_0x123b8b['push'](_0x123b8b['shift']());}};_0x14785d(++_0x121d55);}(_0x4916,0x13f));var _0x6491=function(_0x448c20,_0x256409){_0x448c20=_0x448c20-0x0;var _0x165519=_0x4916[_0x448c20];return _0x165519;};'use strict';var multer=require(_0x6491('0x0'));var util=require(_0x6491('0x1'));var path=require(_0x6491('0x2'));var timeout=require(_0x6491('0x3'));var express=require(_0x6491('0x4'));var router=express[_0x6491('0x5')]();var fs_extra=require(_0x6491('0x6'));var auth=require(_0x6491('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x6491('0x8'));var controller=require(_0x6491('0x9'));router[_0x6491('0xa')]('/',auth['isAuthenticated'](),controller[_0x6491('0xb')]);router[_0x6491('0xa')](_0x6491('0xc'),auth[_0x6491('0xd')](),controller['show']);router[_0x6491('0xe')]('/',auth['isAuthenticated'](),controller[_0x6491('0xf')]);router[_0x6491('0x10')]('/:id',auth[_0x6491('0xd')](),controller[_0x6491('0x11')]);router[_0x6491('0x12')](_0x6491('0xc'),auth[_0x6491('0xd')](),controller['destroy']);module[_0x6491('0x13')]=router; \ No newline at end of file +var _0x5ec0=['exports','multer','path','Router','../../components/auth/service','isAuthenticated','index','/:id','show','post','create','update','destroy'];(function(_0x4a2eb1,_0x36a590){var _0x1552a9=function(_0xbfe143){while(--_0xbfe143){_0x4a2eb1['push'](_0x4a2eb1['shift']());}};_0x1552a9(++_0x36a590);}(_0x5ec0,0x1d5));var _0x05ec=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x5ec0[_0x5d6456];return _0x4d66c1;};'use strict';var multer=require(_0x05ec('0x0'));var util=require('util');var path=require(_0x05ec('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x05ec('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x05ec('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intZendeskField.controller');router['get']('/',auth[_0x05ec('0x4')](),controller[_0x05ec('0x5')]);router['get'](_0x05ec('0x6'),auth[_0x05ec('0x4')](),controller[_0x05ec('0x7')]);router[_0x05ec('0x8')]('/',auth[_0x05ec('0x4')](),controller[_0x05ec('0x9')]);router['put'](_0x05ec('0x6'),auth['isAuthenticated'](),controller[_0x05ec('0xa')]);router['delete'](_0x05ec('0x6'),auth[_0x05ec('0x4')](),controller[_0x05ec('0xb')]);module[_0x05ec('0xc')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 7641187..b6f4f31 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 _0x0411=['BOOLEAN','ENUM','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0x2a644d,_0x4b2942){var _0x5b1964=function(_0xebd364){while(--_0xebd364){_0x2a644d['push'](_0x2a644d['shift']());}};_0x5b1964(++_0x4b2942);}(_0x0411,0xa1));var _0x1041=function(_0x139485,_0x2d0aac){_0x139485=_0x139485-0x0;var _0x221cb9=_0x0411[_0x139485];return _0x221cb9;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x1041('0x0')](_0x1041('0x1'),_0x1041('0x2'),_0x1041('0x3'),_0x1041('0x4'),_0x1041('0x5')),'defaultValue':_0x1041('0x1')},'content':{'type':Sequelize[_0x1041('0x6')]},'key':{'type':Sequelize[_0x1041('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x1041('0x1'),'variable',_0x1041('0x3'))},'keyContent':{'type':Sequelize[_0x1041('0x6')]},'idField':{'type':Sequelize[_0x1041('0x6')]},'nameField':{'type':Sequelize[_0x1041('0x6')]},'customField':{'type':Sequelize[_0x1041('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4619=['picklist','string','STRING','BOOLEAN','sequelize','exports','variable','keyValue'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4619,0xfc));var _0x9461=function(_0x4781d1,_0x33ac5a){_0x4781d1=_0x4781d1-0x0;var _0x3fcfcf=_0x4619[_0x4781d1];return _0x3fcfcf;};'use strict';var Sequelize=require(_0x9461('0x0'));module[_0x9461('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x9461('0x2'),'customVariable',_0x9461('0x3'),_0x9461('0x4')),'defaultValue':_0x9461('0x5')},'content':{'type':Sequelize[_0x9461('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM']('string','variable','customVariable')},'keyContent':{'type':Sequelize[_0x9461('0x6')]},'idField':{'type':Sequelize[_0x9461('0x6')]},'nameField':{'type':Sequelize[_0x9461('0x6')]},'customField':{'type':Sequelize[_0x9461('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index d2d2e82..3249bc3 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 _0xf6fb=['crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','apply','save','update','destroy','then','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','ZendeskField','includeAll','include','findAll','rows','catch','show','params','find','create','body','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x2d9e27,_0x5965b2){var _0xd35381=function(_0x343d18){while(--_0x343d18){_0x2d9e27['push'](_0x2d9e27['shift']());}};_0xd35381(++_0x5965b2);}(_0xf6fb,0x111));var _0xbf6f=function(_0x26911e,_0x121a02){_0x26911e=_0x26911e-0x0;var _0x47eb93=_0xf6fb[_0x26911e];return _0x47eb93;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xbf6f('0x0'));var jsonpatch=require(_0xbf6f('0x1'));var rp=require('request-promise');var moment=require(_0xbf6f('0x2'));var BPromise=require(_0xbf6f('0x3'));var Mustache=require('mustache');var util=require(_0xbf6f('0x4'));var path=require('path');var sox=require(_0xbf6f('0x5'));var csv=require(_0xbf6f('0x6'));var ejs=require(_0xbf6f('0x7'));var fs=require('fs');var fs_extra=require(_0xbf6f('0x8'));var _=require(_0xbf6f('0x9'));var squel=require(_0xbf6f('0xa'));var crypto=require(_0xbf6f('0xb'));var jsforce=require(_0xbf6f('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xbf6f('0x6'));var querystring=require(_0xbf6f('0xd'));var Papa=require(_0xbf6f('0xe'));var Redis=require(_0xbf6f('0xf'));var authService=require(_0xbf6f('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbf6f('0x11'));var logger=require(_0xbf6f('0x12'))(_0xbf6f('0x13'));var utils=require('../../config/utils');var config=require(_0xbf6f('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xbf6f('0x15'))['db'];function respondWithStatusCode(_0x7b939f,_0x3a5c09){_0x3a5c09=_0x3a5c09||0xcc;return function(_0x50c054){if(_0x50c054){return _0x7b939f[_0xbf6f('0x16')](_0x3a5c09);}return _0x7b939f[_0xbf6f('0x17')](_0x3a5c09)[_0xbf6f('0x18')]();};}function respondWithResult(_0x6f8fee,_0xce557a){_0xce557a=_0xce557a||0xc8;return function(_0x1dd2f1){if(_0x1dd2f1){return _0x6f8fee['status'](_0xce557a)[_0xbf6f('0x19')](_0x1dd2f1);}};}function respondWithFilteredResult(_0x3f1c33,_0x473d32){return function(_0x40ad56){if(_0x40ad56){var _0x270ec6=typeof _0x473d32[_0xbf6f('0x1a')]===_0xbf6f('0x1b')&&typeof _0x473d32['limit']==='undefined';var _0x734fe8=_0x40ad56[_0xbf6f('0x1c')];var _0x21b485=_0x270ec6?0x0:_0x473d32['offset'];var _0x56b4da=_0x270ec6?_0x40ad56[_0xbf6f('0x1c')]:_0x473d32[_0xbf6f('0x1a')]+_0x473d32[_0xbf6f('0x1d')];var _0x22e1e9;if(_0x56b4da>=_0x734fe8){_0x56b4da=_0x734fe8;_0x22e1e9=0xc8;}else{_0x22e1e9=0xce;}_0x3f1c33[_0xbf6f('0x17')](_0x22e1e9);return _0x3f1c33['set']('Content-Range',_0x21b485+'-'+_0x56b4da+'/'+_0x734fe8)[_0xbf6f('0x19')](_0x40ad56);}return null;};}function patchUpdates(_0x5985ac){return function(_0x3bd472){try{jsonpatch[_0xbf6f('0x1e')](_0x3bd472,_0x5985ac,!![]);}catch(_0x3cc13c){return BPromise['reject'](_0x3cc13c);}return _0x3bd472[_0xbf6f('0x1f')]();};}function saveUpdates(_0x21b547,_0x3a0087){return function(_0x528bf0){if(_0x528bf0){return _0x528bf0[_0xbf6f('0x20')](_0x21b547)['then'](function(_0x2af16f){return _0x2af16f;});}return null;};}function removeEntity(_0xb9e8bc,_0xba4b6a){return function(_0x49979a){if(_0x49979a){return _0x49979a[_0xbf6f('0x21')]()[_0xbf6f('0x22')](function(){_0xb9e8bc[_0xbf6f('0x17')](0xcc)[_0xbf6f('0x18')]();});}};}function handleEntityNotFound(_0x44d47f,_0x442f60){return function(_0x59c3d6){if(!_0x59c3d6){_0x44d47f[_0xbf6f('0x16')](0x194);}return _0x59c3d6;};}function handleError(_0xf6108a,_0x4c7e8d){_0x4c7e8d=_0x4c7e8d||0x1f4;return function(_0x506302){logger['error'](_0x506302[_0xbf6f('0x23')]);if(_0x506302['name']){delete _0x506302[_0xbf6f('0x24')];}_0xf6108a[_0xbf6f('0x17')](_0x4c7e8d)[_0xbf6f('0x25')](_0x506302);};}exports[_0xbf6f('0x26')]=function(_0xb440e8,_0x237b67){var _0x1aefcc={},_0x58c120={},_0x5dd4f6={'count':0x0,'rows':[]};var _0x1b675a=_[_0xbf6f('0x27')](db['ZendeskField'][_0xbf6f('0x28')],function(_0x4f2430){return{'name':_0x4f2430[_0xbf6f('0x29')],'type':_0x4f2430[_0xbf6f('0x2a')][_0xbf6f('0x2b')]};});_0x58c120[_0xbf6f('0x2c')]=_[_0xbf6f('0x27')](_0x1b675a,_0xbf6f('0x24'));_0x58c120[_0xbf6f('0x2d')]=_[_0xbf6f('0x2e')](_0xb440e8[_0xbf6f('0x2d')]);_0x58c120[_0xbf6f('0x2f')]=_['intersection'](_0x58c120['model'],_0x58c120[_0xbf6f('0x2d')]);_0x1aefcc[_0xbf6f('0x30')]=_[_0xbf6f('0x31')](_0x58c120[_0xbf6f('0x2c')],qs['fields'](_0xb440e8[_0xbf6f('0x2d')][_0xbf6f('0x32')]));_0x1aefcc[_0xbf6f('0x30')]=_0x1aefcc[_0xbf6f('0x30')][_0xbf6f('0x33')]?_0x1aefcc['attributes']:_0x58c120[_0xbf6f('0x2c')];if(!_0xb440e8[_0xbf6f('0x2d')][_0xbf6f('0x34')]('nolimit')){_0x1aefcc[_0xbf6f('0x1d')]=qs['limit'](_0xb440e8[_0xbf6f('0x2d')][_0xbf6f('0x1d')]);_0x1aefcc[_0xbf6f('0x1a')]=qs[_0xbf6f('0x1a')](_0xb440e8[_0xbf6f('0x2d')][_0xbf6f('0x1a')]);}_0x1aefcc[_0xbf6f('0x35')]=qs[_0xbf6f('0x36')](_0xb440e8[_0xbf6f('0x2d')][_0xbf6f('0x36')]);_0x1aefcc[_0xbf6f('0x37')]=qs[_0xbf6f('0x2f')](_['pick'](_0xb440e8[_0xbf6f('0x2d')],_0x58c120[_0xbf6f('0x2f')]),_0x1b675a);if(_0xb440e8[_0xbf6f('0x2d')][_0xbf6f('0x38')]){_0x1aefcc[_0xbf6f('0x37')]=_[_0xbf6f('0x39')](_0x1aefcc[_0xbf6f('0x37')],{'$or':_['map'](_0x1b675a,function(_0x460694){if(_0x460694[_0xbf6f('0x2a')]!==_0xbf6f('0x3a')){var _0x5d5c7c={};_0x5d5c7c[_0x460694[_0xbf6f('0x24')]]={'$like':'%'+_0xb440e8[_0xbf6f('0x2d')][_0xbf6f('0x38')]+'%'};return _0x5d5c7c;}})});}_0x1aefcc=_['merge']({},_0x1aefcc,_0xb440e8[_0xbf6f('0x3b')]);var _0x26da28={'where':_0x1aefcc[_0xbf6f('0x37')]};return db[_0xbf6f('0x3c')][_0xbf6f('0x1c')](_0x26da28)[_0xbf6f('0x22')](function(_0x3e409e){_0x5dd4f6[_0xbf6f('0x1c')]=_0x3e409e;if(_0xb440e8[_0xbf6f('0x2d')][_0xbf6f('0x3d')]){_0x1aefcc[_0xbf6f('0x3e')]=[{'all':!![]}];}return db[_0xbf6f('0x3c')][_0xbf6f('0x3f')](_0x1aefcc);})[_0xbf6f('0x22')](function(_0x4a7df7){_0x5dd4f6[_0xbf6f('0x40')]=_0x4a7df7;return _0x5dd4f6;})['then'](respondWithFilteredResult(_0x237b67,_0x1aefcc))[_0xbf6f('0x41')](handleError(_0x237b67,null));};exports[_0xbf6f('0x42')]=function(_0x53c523,_0x1c8ffa){var _0x5cbc5f={'raw':!![],'where':{'id':_0x53c523[_0xbf6f('0x43')]['id']}},_0x3718a3={};_0x3718a3[_0xbf6f('0x2c')]=_[_0xbf6f('0x2e')](db[_0xbf6f('0x3c')][_0xbf6f('0x28')]);_0x3718a3[_0xbf6f('0x2d')]=_[_0xbf6f('0x2e')](_0x53c523[_0xbf6f('0x2d')]);_0x3718a3[_0xbf6f('0x2f')]=_[_0xbf6f('0x31')](_0x3718a3[_0xbf6f('0x2c')],_0x3718a3[_0xbf6f('0x2d')]);_0x5cbc5f[_0xbf6f('0x30')]=_[_0xbf6f('0x31')](_0x3718a3[_0xbf6f('0x2c')],qs[_0xbf6f('0x32')](_0x53c523[_0xbf6f('0x2d')][_0xbf6f('0x32')]));_0x5cbc5f[_0xbf6f('0x30')]=_0x5cbc5f[_0xbf6f('0x30')]['length']?_0x5cbc5f[_0xbf6f('0x30')]:_0x3718a3[_0xbf6f('0x2c')];if(_0x53c523['query'][_0xbf6f('0x3d')]){_0x5cbc5f[_0xbf6f('0x3e')]=[{'all':!![]}];}_0x5cbc5f=_[_0xbf6f('0x39')]({},_0x5cbc5f,_0x53c523[_0xbf6f('0x3b')]);return db['ZendeskField'][_0xbf6f('0x44')](_0x5cbc5f)['then'](handleEntityNotFound(_0x1c8ffa,null))[_0xbf6f('0x22')](respondWithResult(_0x1c8ffa,null))[_0xbf6f('0x41')](handleError(_0x1c8ffa,null));};exports[_0xbf6f('0x45')]=function(_0x2e322e,_0x197664){return db['ZendeskField'][_0xbf6f('0x45')](_0x2e322e[_0xbf6f('0x46')],{})[_0xbf6f('0x22')](respondWithResult(_0x197664,0xc9))[_0xbf6f('0x41')](handleError(_0x197664,null));};exports['update']=function(_0x58ff77,_0x3b62e5){if(_0x58ff77[_0xbf6f('0x46')]['id']){delete _0x58ff77[_0xbf6f('0x46')]['id'];}return db[_0xbf6f('0x3c')][_0xbf6f('0x44')]({'where':{'id':_0x58ff77[_0xbf6f('0x43')]['id']}})[_0xbf6f('0x22')](handleEntityNotFound(_0x3b62e5,null))[_0xbf6f('0x22')](saveUpdates(_0x58ff77[_0xbf6f('0x46')],null))[_0xbf6f('0x22')](respondWithResult(_0x3b62e5,null))[_0xbf6f('0x41')](handleError(_0x3b62e5,null));};exports[_0xbf6f('0x21')]=function(_0x138225,_0x4a293){return db[_0xbf6f('0x3c')][_0xbf6f('0x44')]({'where':{'id':_0x138225[_0xbf6f('0x43')]['id']}})[_0xbf6f('0x22')](handleEntityNotFound(_0x4a293,null))[_0xbf6f('0x22')](removeEntity(_0x4a293,null))[_0xbf6f('0x41')](handleError(_0x4a293,null));}; \ No newline at end of file +var _0x735d=['show','params','find','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','error','stack','name','send','map','rawAttributes','fieldName','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','type','VIRTUAL','merge','options','ZendeskField','then','includeAll','include','findAll','rows','catch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x735d,0x18a));var _0xd735=function(_0x33ebf5,_0x258ec6){_0x33ebf5=_0x33ebf5-0x0;var _0x66957b=_0x735d[_0x33ebf5];return _0x66957b;};'use strict';var emlformat=require(_0xd735('0x0'));var rimraf=require(_0xd735('0x1'));var zipdir=require(_0xd735('0x2'));var jsonpatch=require(_0xd735('0x3'));var rp=require(_0xd735('0x4'));var moment=require(_0xd735('0x5'));var BPromise=require(_0xd735('0x6'));var Mustache=require(_0xd735('0x7'));var util=require(_0xd735('0x8'));var path=require(_0xd735('0x9'));var sox=require(_0xd735('0xa'));var csv=require(_0xd735('0xb'));var ejs=require(_0xd735('0xc'));var fs=require('fs');var fs_extra=require(_0xd735('0xd'));var _=require(_0xd735('0xe'));var squel=require(_0xd735('0xf'));var crypto=require(_0xd735('0x10'));var jsforce=require(_0xd735('0x11'));var deskjs=require(_0xd735('0x12'));var toCsv=require(_0xd735('0xb'));var querystring=require(_0xd735('0x13'));var Papa=require('papaparse');var Redis=require(_0xd735('0x14'));var authService=require(_0xd735('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0xd735('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xd735('0x17'));var config=require(_0xd735('0x18'));var licenseUtil=require(_0xd735('0x19'));var db=require(_0xd735('0x1a'))['db'];function respondWithStatusCode(_0x2beb6c,_0x40b97e){_0x40b97e=_0x40b97e||0xcc;return function(_0x4006ad){if(_0x4006ad){return _0x2beb6c[_0xd735('0x1b')](_0x40b97e);}return _0x2beb6c[_0xd735('0x1c')](_0x40b97e)[_0xd735('0x1d')]();};}function respondWithResult(_0x4e2fc1,_0x3f7d90){_0x3f7d90=_0x3f7d90||0xc8;return function(_0x44963c){if(_0x44963c){return _0x4e2fc1[_0xd735('0x1c')](_0x3f7d90)[_0xd735('0x1e')](_0x44963c);}};}function respondWithFilteredResult(_0x5d48b3,_0x52e6fc){return function(_0x526667){if(_0x526667){var _0x1f44fb=typeof _0x52e6fc[_0xd735('0x1f')]===_0xd735('0x20')&&typeof _0x52e6fc[_0xd735('0x21')]===_0xd735('0x20');var _0xcd3d62=_0x526667['count'];var _0x5a5023=_0x1f44fb?0x0:_0x52e6fc['offset'];var _0x15a4d3=_0x1f44fb?_0x526667[_0xd735('0x22')]:_0x52e6fc[_0xd735('0x1f')]+_0x52e6fc[_0xd735('0x21')];var _0xcab635;if(_0x15a4d3>=_0xcd3d62){_0x15a4d3=_0xcd3d62;_0xcab635=0xc8;}else{_0xcab635=0xce;}_0x5d48b3['status'](_0xcab635);return _0x5d48b3['set'](_0xd735('0x23'),_0x5a5023+'-'+_0x15a4d3+'/'+_0xcd3d62)['json'](_0x526667);}return null;};}function patchUpdates(_0x26d6a0){return function(_0x1315f6){try{jsonpatch[_0xd735('0x24')](_0x1315f6,_0x26d6a0,!![]);}catch(_0x8dbd08){return BPromise[_0xd735('0x25')](_0x8dbd08);}return _0x1315f6[_0xd735('0x26')]();};}function saveUpdates(_0x2a0f76,_0x4b2948){return function(_0x502ed7){if(_0x502ed7){return _0x502ed7[_0xd735('0x27')](_0x2a0f76)['then'](function(_0x9d7fc3){return _0x9d7fc3;});}return null;};}function removeEntity(_0x196e82,_0x15fafd){return function(_0x147a02){if(_0x147a02){return _0x147a02[_0xd735('0x28')]()['then'](function(){_0x196e82[_0xd735('0x1c')](0xcc)[_0xd735('0x1d')]();});}};}function handleEntityNotFound(_0x2ba03f,_0x315d6c){return function(_0x331a1b){if(!_0x331a1b){_0x2ba03f['sendStatus'](0x194);}return _0x331a1b;};}function handleError(_0x53e408,_0x3b94df){_0x3b94df=_0x3b94df||0x1f4;return function(_0x4725ea){logger[_0xd735('0x29')](_0x4725ea[_0xd735('0x2a')]);if(_0x4725ea[_0xd735('0x2b')]){delete _0x4725ea[_0xd735('0x2b')];}_0x53e408[_0xd735('0x1c')](_0x3b94df)[_0xd735('0x2c')](_0x4725ea);};}exports['index']=function(_0x54e3b3,_0x19ffef){var _0x37bf8c={},_0x26d873={},_0x4cff57={'count':0x0,'rows':[]};var _0x4b17b6=_[_0xd735('0x2d')](db['ZendeskField'][_0xd735('0x2e')],function(_0x3f5878){return{'name':_0x3f5878[_0xd735('0x2f')],'type':_0x3f5878['type'][_0xd735('0x30')]};});_0x26d873[_0xd735('0x31')]=_[_0xd735('0x2d')](_0x4b17b6,'name');_0x26d873[_0xd735('0x32')]=_[_0xd735('0x33')](_0x54e3b3[_0xd735('0x32')]);_0x26d873['filters']=_['intersection'](_0x26d873['model'],_0x26d873[_0xd735('0x32')]);_0x37bf8c[_0xd735('0x34')]=_[_0xd735('0x35')](_0x26d873[_0xd735('0x31')],qs[_0xd735('0x36')](_0x54e3b3[_0xd735('0x32')][_0xd735('0x36')]));_0x37bf8c[_0xd735('0x34')]=_0x37bf8c[_0xd735('0x34')][_0xd735('0x37')]?_0x37bf8c[_0xd735('0x34')]:_0x26d873['model'];if(!_0x54e3b3[_0xd735('0x32')][_0xd735('0x38')](_0xd735('0x39'))){_0x37bf8c[_0xd735('0x21')]=qs['limit'](_0x54e3b3[_0xd735('0x32')][_0xd735('0x21')]);_0x37bf8c[_0xd735('0x1f')]=qs[_0xd735('0x1f')](_0x54e3b3[_0xd735('0x32')][_0xd735('0x1f')]);}_0x37bf8c[_0xd735('0x3a')]=qs[_0xd735('0x3b')](_0x54e3b3['query']['sort']);_0x37bf8c[_0xd735('0x3c')]=qs['filters'](_[_0xd735('0x3d')](_0x54e3b3[_0xd735('0x32')],_0x26d873[_0xd735('0x3e')]),_0x4b17b6);if(_0x54e3b3[_0xd735('0x32')]['filter']){_0x37bf8c[_0xd735('0x3c')]=_['merge'](_0x37bf8c['where'],{'$or':_[_0xd735('0x2d')](_0x4b17b6,function(_0x547c1d){if(_0x547c1d[_0xd735('0x3f')]!==_0xd735('0x40')){var _0x2bef01={};_0x2bef01[_0x547c1d[_0xd735('0x2b')]]={'$like':'%'+_0x54e3b3['query']['filter']+'%'};return _0x2bef01;}})});}_0x37bf8c=_[_0xd735('0x41')]({},_0x37bf8c,_0x54e3b3[_0xd735('0x42')]);var _0xb37978={'where':_0x37bf8c[_0xd735('0x3c')]};return db[_0xd735('0x43')][_0xd735('0x22')](_0xb37978)[_0xd735('0x44')](function(_0x55ef0c){_0x4cff57[_0xd735('0x22')]=_0x55ef0c;if(_0x54e3b3[_0xd735('0x32')][_0xd735('0x45')]){_0x37bf8c[_0xd735('0x46')]=[{'all':!![]}];}return db[_0xd735('0x43')][_0xd735('0x47')](_0x37bf8c);})['then'](function(_0x4a321e){_0x4cff57[_0xd735('0x48')]=_0x4a321e;return _0x4cff57;})[_0xd735('0x44')](respondWithFilteredResult(_0x19ffef,_0x37bf8c))[_0xd735('0x49')](handleError(_0x19ffef,null));};exports[_0xd735('0x4a')]=function(_0x85f983,_0x30a703){var _0x2ecf2e={'raw':!![],'where':{'id':_0x85f983[_0xd735('0x4b')]['id']}},_0x165d96={};_0x165d96[_0xd735('0x31')]=_[_0xd735('0x33')](db[_0xd735('0x43')][_0xd735('0x2e')]);_0x165d96[_0xd735('0x32')]=_['keys'](_0x85f983[_0xd735('0x32')]);_0x165d96[_0xd735('0x3e')]=_[_0xd735('0x35')](_0x165d96['model'],_0x165d96[_0xd735('0x32')]);_0x2ecf2e[_0xd735('0x34')]=_[_0xd735('0x35')](_0x165d96['model'],qs[_0xd735('0x36')](_0x85f983[_0xd735('0x32')][_0xd735('0x36')]));_0x2ecf2e[_0xd735('0x34')]=_0x2ecf2e[_0xd735('0x34')][_0xd735('0x37')]?_0x2ecf2e['attributes']:_0x165d96['model'];if(_0x85f983[_0xd735('0x32')][_0xd735('0x45')]){_0x2ecf2e['include']=[{'all':!![]}];}_0x2ecf2e=_['merge']({},_0x2ecf2e,_0x85f983[_0xd735('0x42')]);return db[_0xd735('0x43')][_0xd735('0x4c')](_0x2ecf2e)[_0xd735('0x44')](handleEntityNotFound(_0x30a703,null))['then'](respondWithResult(_0x30a703,null))[_0xd735('0x49')](handleError(_0x30a703,null));};exports['create']=function(_0x59aa41,_0x3113fd){return db[_0xd735('0x43')]['create'](_0x59aa41[_0xd735('0x4d')],{})[_0xd735('0x44')](respondWithResult(_0x3113fd,0xc9))['catch'](handleError(_0x3113fd,null));};exports[_0xd735('0x27')]=function(_0x2e21ae,_0x499f30){if(_0x2e21ae['body']['id']){delete _0x2e21ae[_0xd735('0x4d')]['id'];}return db[_0xd735('0x43')][_0xd735('0x4c')]({'where':{'id':_0x2e21ae[_0xd735('0x4b')]['id']}})[_0xd735('0x44')](handleEntityNotFound(_0x499f30,null))[_0xd735('0x44')](saveUpdates(_0x2e21ae[_0xd735('0x4d')],null))['then'](respondWithResult(_0x499f30,null))[_0xd735('0x49')](handleError(_0x499f30,null));};exports[_0xd735('0x28')]=function(_0x19839e,_0x33d903){return db[_0xd735('0x43')][_0xd735('0x4c')]({'where':{'id':_0x19839e[_0xd735('0x4b')]['id']}})[_0xd735('0x44')](handleEntityNotFound(_0x33d903,null))[_0xd735('0x44')](removeEntity(_0x33d903,null))[_0xd735('0x49')](handleError(_0x33d903,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index d8d712b..89d1796 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 _0x9314=['int_zendesk_fields','zendesk_unique_index','idField','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskField.attributes','exports','define','ZendeskField'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x9314,0x16b));var _0x4931=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0x9314[_0x279d37];return _0x530173;};'use strict';var _=require(_0x4931('0x0'));var util=require(_0x4931('0x1'));var logger=require('../../config/logger')(_0x4931('0x2'));var moment=require('moment');var BPromise=require(_0x4931('0x3'));var rp=require(_0x4931('0x4'));var fs=require('fs');var path=require(_0x4931('0x5'));var rimraf=require(_0x4931('0x6'));var config=require(_0x4931('0x7'));var attributes=require(_0x4931('0x8'));module[_0x4931('0x9')]=function(_0x18d6ec,_0x1c6c52){return _0x18d6ec[_0x4931('0xa')](_0x4931('0xb'),attributes,{'tableName':_0x4931('0xc'),'paranoid':![],'indexes':[{'name':_0x4931('0xd'),'fields':[_0x4931('0xe'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4b88=['../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','exports','define','ZendeskField','int_zendesk_fields','zendesk_unique_index','FieldId','lodash'];(function(_0xaf81e4,_0x350e66){var _0x14025c=function(_0x3ce77a){while(--_0x3ce77a){_0xaf81e4['push'](_0xaf81e4['shift']());}};_0x14025c(++_0x350e66);}(_0x4b88,0xdc));var _0x84b8=function(_0x220d11,_0x17808e){_0x220d11=_0x220d11-0x0;var _0x4024bc=_0x4b88[_0x220d11];return _0x4024bc;};'use strict';var _=require(_0x84b8('0x0'));var util=require('util');var logger=require(_0x84b8('0x1'))(_0x84b8('0x2'));var moment=require('moment');var BPromise=require(_0x84b8('0x3'));var rp=require(_0x84b8('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x84b8('0x5'));var config=require(_0x84b8('0x6'));var attributes=require('./intZendeskField.attributes');module[_0x84b8('0x7')]=function(_0x38a13c,_0x3ddc35){return _0x38a13c[_0x84b8('0x8')](_0x84b8('0x9'),attributes,{'tableName':_0x84b8('0xa'),'paranoid':![],'indexes':[{'name':_0x84b8('0xb'),'fields':['idField',_0x84b8('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index 30a335b..f755269 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 _0xf5a3=['request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x5b013d,_0xc7691c){var _0x2b6eef=function(_0x3143ca){while(--_0x3143ca){_0x5b013d['push'](_0x5b013d['shift']());}};_0x2b6eef(++_0xc7691c);}(_0xf5a3,0x1ee));var _0x3f5a=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0xf5a3[_0x12fc8d];return _0x3f9d04;};'use strict';var _=require(_0x3f5a('0x0'));var util=require('util');var moment=require(_0x3f5a('0x1'));var BPromise=require(_0x3f5a('0x2'));var rs=require(_0x3f5a('0x3'));var fs=require('fs');var Redis=require(_0x3f5a('0x4'));var db=require(_0x3f5a('0x5'))['db'];var utils=require(_0x3f5a('0x6'));var logger=require(_0x3f5a('0x7'))(_0x3f5a('0x8'));var config=require('../../config/environment');var jayson=require(_0x3f5a('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x149c59,_0x13e43d,_0x14e787){return new BPromise(function(_0x151a56,_0x40c279){return client[_0x3f5a('0xa')](_0x149c59,_0x14e787)[_0x3f5a('0xb')](function(_0x40510b){logger[_0x3f5a('0xc')](_0x3f5a('0xd'),_0x13e43d,_0x3f5a('0xe'));logger[_0x3f5a('0xf')](_0x3f5a('0x10'),_0x13e43d,_0x3f5a('0xe'),JSON[_0x3f5a('0x11')](_0x40510b));if(_0x40510b['error']){if(_0x40510b[_0x3f5a('0x12')][_0x3f5a('0x13')]===0x1f4){logger[_0x3f5a('0x12')](_0x3f5a('0xd'),_0x13e43d,_0x40510b['error']['message']);return _0x40c279(_0x40510b[_0x3f5a('0x12')][_0x3f5a('0x14')]);}logger[_0x3f5a('0x12')](_0x3f5a('0xd'),_0x13e43d,_0x40510b[_0x3f5a('0x12')][_0x3f5a('0x14')]);return _0x151a56(_0x40510b[_0x3f5a('0x12')][_0x3f5a('0x14')]);}else{logger['info']('ZendeskField,\x20%s,\x20%s',_0x13e43d,_0x3f5a('0xe'));_0x151a56(_0x40510b['result'][_0x3f5a('0x14')]);}})['catch'](function(_0x5fddbd){logger[_0x3f5a('0x12')](_0x3f5a('0xd'),_0x13e43d,_0x5fddbd);_0x40c279(_0x5fddbd);});});} \ No newline at end of file +var _0xde2d=['../../config/utils','rpc','../../config/environment','client','http','request','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','error','code','message','ZendeskField,\x20%s,\x20%s','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x452791,_0x28c4d5){var _0x5c30d6=function(_0x16a85f){while(--_0x16a85f){_0x452791['push'](_0x452791['shift']());}};_0x5c30d6(++_0x28c4d5);}(_0xde2d,0x86));var _0xdde2=function(_0x416a3c,_0x481c83){_0x416a3c=_0x416a3c-0x0;var _0x2a055d=_0xde2d[_0x416a3c];return _0x2a055d;};'use strict';var _=require(_0xdde2('0x0'));var util=require(_0xdde2('0x1'));var moment=require('moment');var BPromise=require(_0xdde2('0x2'));var rs=require(_0xdde2('0x3'));var fs=require('fs');var Redis=require(_0xdde2('0x4'));var db=require(_0xdde2('0x5'))['db'];var utils=require(_0xdde2('0x6'));var logger=require('../../config/logger')(_0xdde2('0x7'));var config=require(_0xdde2('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xdde2('0x9')][_0xdde2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5d2240,_0x132b37,_0x341559){return new BPromise(function(_0x4d80c2,_0x2126c9){return client[_0xdde2('0xb')](_0x5d2240,_0x341559)['then'](function(_0x200618){logger['info']('ZendeskField,\x20%s,\x20%s',_0x132b37,_0xdde2('0xc'));logger[_0xdde2('0xd')](_0xdde2('0xe'),_0x132b37,'request\x20sent',JSON['stringify'](_0x200618));if(_0x200618[_0xdde2('0xf')]){if(_0x200618[_0xdde2('0xf')][_0xdde2('0x10')]===0x1f4){logger['error']('ZendeskField,\x20%s,\x20%s',_0x132b37,_0x200618[_0xdde2('0xf')]['message']);return _0x2126c9(_0x200618[_0xdde2('0xf')][_0xdde2('0x11')]);}logger[_0xdde2('0xf')](_0xdde2('0x12'),_0x132b37,_0x200618[_0xdde2('0xf')][_0xdde2('0x11')]);return _0x4d80c2(_0x200618[_0xdde2('0xf')]['message']);}else{logger['info'](_0xdde2('0x12'),_0x132b37,_0xdde2('0xc'));_0x4d80c2(_0x200618[_0xdde2('0x13')][_0xdde2('0x11')]);}})['catch'](function(_0x221fd7){logger[_0xdde2('0xf')](_0xdde2('0x12'),_0x132b37,_0x221fd7);_0x2126c9(_0x221fd7);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 8bc4de2..043f98a 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 _0x76fb=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','post','put','update','destroy','multer','util','path','connect-timeout'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x76fb,0xac));var _0xb76f=function(_0x332eba,_0x52c7ac){_0x332eba=_0x332eba-0x0;var _0x132a16=_0x76fb[_0x332eba];return _0x132a16;};'use strict';var multer=require(_0xb76f('0x0'));var util=require(_0xb76f('0x1'));var path=require(_0xb76f('0x2'));var timeout=require(_0xb76f('0x3'));var express=require(_0xb76f('0x4'));var router=express[_0xb76f('0x5')]();var fs_extra=require(_0xb76f('0x6'));var auth=require(_0xb76f('0x7'));var interaction=require(_0xb76f('0x8'));var config=require(_0xb76f('0x9'));var controller=require('./intZohoAccount.controller');router[_0xb76f('0xa')]('/',auth[_0xb76f('0xb')](),controller[_0xb76f('0xc')]);router['get'](_0xb76f('0xd'),auth[_0xb76f('0xb')](),controller['show']);router['get'](_0xb76f('0xe'),auth[_0xb76f('0xb')](),controller[_0xb76f('0xf')]);router['get'](_0xb76f('0x10'),auth[_0xb76f('0xb')](),controller[_0xb76f('0x11')]);router[_0xb76f('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0xb76f('0x12')]('/:id/configurations',auth[_0xb76f('0xb')](),controller['addConfiguration']);router[_0xb76f('0x13')](_0xb76f('0xd'),auth[_0xb76f('0xb')](),controller[_0xb76f('0x14')]);router['delete'](_0xb76f('0xd'),auth[_0xb76f('0xb')](),controller[_0xb76f('0x15')]);module['exports']=router; \ No newline at end of file +var _0x2731=['fs-extra','../../components/auth/service','./intZohoAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','put','/:id','update','delete','destroy','exports','multer','connect-timeout','Router'];(function(_0x45dcbb,_0x54bebf){var _0x4f2a49=function(_0x551ad2){while(--_0x551ad2){_0x45dcbb['push'](_0x45dcbb['shift']());}};_0x4f2a49(++_0x54bebf);}(_0x2731,0x173));var _0x1273=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x2731[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x1273('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x1273('0x1'));var express=require('express');var router=express[_0x1273('0x2')]();var fs_extra=require(_0x1273('0x3'));var auth=require(_0x1273('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1273('0x5'));router[_0x1273('0x6')]('/',auth[_0x1273('0x7')](),controller[_0x1273('0x8')]);router[_0x1273('0x6')]('/:id',auth[_0x1273('0x7')](),controller[_0x1273('0x9')]);router['get'](_0x1273('0xa'),auth[_0x1273('0x7')](),controller[_0x1273('0xb')]);router[_0x1273('0x6')](_0x1273('0xc'),auth[_0x1273('0x7')](),controller[_0x1273('0xd')]);router[_0x1273('0xe')]('/',auth[_0x1273('0x7')](),controller[_0x1273('0xf')]);router[_0x1273('0xe')]('/:id/configurations',auth[_0x1273('0x7')](),controller['addConfiguration']);router[_0x1273('0x10')](_0x1273('0x11'),auth[_0x1273('0x7')](),controller[_0x1273('0x12')]);router[_0x1273('0x13')]('/:id',auth[_0x1273('0x7')](),controller[_0x1273('0x14')]);module[_0x1273('0x15')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 8c84225..3d81604 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 _0xedd9=['exports','STRING'];(function(_0x1b9a53,_0x58e379){var _0x16f25f=function(_0x2ba85c){while(--_0x2ba85c){_0x1b9a53['push'](_0x1b9a53['shift']());}};_0x16f25f(++_0x58e379);}(_0xedd9,0xfc));var _0x9edd=function(_0x9f8bba,_0x252500){_0x9f8bba=_0x9f8bba-0x0;var _0x313765=_0xedd9[_0x9f8bba];return _0x313765;};'use strict';var Sequelize=require('sequelize');module[_0x9edd('0x0')]={'name':{'type':Sequelize[_0x9edd('0x1')]},'description':{'type':Sequelize[_0x9edd('0x1')]},'host':{'type':Sequelize[_0x9edd('0x1')]},'zone':{'type':Sequelize[_0x9edd('0x1')]},'clientId':{'type':Sequelize[_0x9edd('0x1')]},'clientSecret':{'type':Sequelize[_0x9edd('0x1')]},'serverUrl':{'type':Sequelize[_0x9edd('0x1')],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0x9edd('0x1')]}}; \ No newline at end of file +var _0xb821=['STRING','exports'];(function(_0x581af1,_0x4f02c5){var _0x54c22e=function(_0x5a7a5a){while(--_0x5a7a5a){_0x581af1['push'](_0x581af1['shift']());}};_0x54c22e(++_0x4f02c5);}(_0xb821,0xa7));var _0x1b82=function(_0x57a634,_0x266a81){_0x57a634=_0x57a634-0x0;var _0x4c47cb=_0xb821[_0x57a634];return _0x4c47cb;};'use strict';var Sequelize=require('sequelize');module[_0x1b82('0x0')]={'name':{'type':Sequelize[_0x1b82('0x1')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0x1b82('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x1b82('0x1')],'allowNull':![]},'code':{'type':Sequelize[_0x1b82('0x1')]},'refreshToken':{'type':Sequelize[_0x1b82('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 81d2ac9..5c1fc59 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 _0x671d=['https://accounts.zoho.eu','https://accounts.zoho.in','POST','refreshToken','clientId','clientSecret','refresh_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','serverUrl','code','zoho.eu','com','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','Calls','response','error','message','Owner','Subject','Description','WhoId','Call_Duration','Call_Start_Time','remove','system_mandatory','push','display_label','custom_field','data_type','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','destroy','name','index','map','ZohoAccount','rawAttributes','fieldName','type','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','rows','catch','params','keys','length','include','create','body','find','getConfigurations','findOne','ZohoConfiguration','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x671d,0xb0));var _0xd671=function(_0x336c8b,_0x56b55b){_0x336c8b=_0x336c8b-0x0;var _0x4dd2f6=_0x671d[_0x336c8b];return _0x4dd2f6;};'use strict';var emlformat=require(_0xd671('0x0'));var rimraf=require(_0xd671('0x1'));var zipdir=require(_0xd671('0x2'));var jsonpatch=require(_0xd671('0x3'));var rp=require(_0xd671('0x4'));var moment=require(_0xd671('0x5'));var BPromise=require(_0xd671('0x6'));var Mustache=require('mustache');var util=require(_0xd671('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd671('0x8'));var fs=require('fs');var fs_extra=require(_0xd671('0x9'));var _=require(_0xd671('0xa'));var squel=require(_0xd671('0xb'));var crypto=require(_0xd671('0xc'));var jsforce=require(_0xd671('0xd'));var deskjs=require(_0xd671('0xe'));var toCsv=require('to-csv');var querystring=require(_0xd671('0xf'));var Papa=require(_0xd671('0x10'));var Redis=require(_0xd671('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xd671('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd671('0x13'));var logger=require(_0xd671('0x14'))(_0xd671('0x15'));var utils=require(_0xd671('0x16'));var config=require(_0xd671('0x17'));var licenseUtil=require(_0xd671('0x18'));var db=require(_0xd671('0x19'))['db'];var integrations=require(_0xd671('0x1a'));function respondWithStatusCode(_0x7eba78,_0x52ef30){_0x52ef30=_0x52ef30||0xcc;return function(_0x534934){if(_0x534934){return _0x7eba78[_0xd671('0x1b')](_0x52ef30);}return _0x7eba78[_0xd671('0x1c')](_0x52ef30)[_0xd671('0x1d')]();};}function respondWithResult(_0xe1f6c6,_0x5047cd){_0x5047cd=_0x5047cd||0xc8;return function(_0x4bf5f3){if(_0x4bf5f3){return _0xe1f6c6['status'](_0x5047cd)['json'](_0x4bf5f3);}};}function respondWithFilteredResult(_0x1a7109,_0x187798){return function(_0x39038d){if(_0x39038d){var _0x4ed4d2=typeof _0x187798[_0xd671('0x1e')]===_0xd671('0x1f')&&typeof _0x187798[_0xd671('0x20')]===_0xd671('0x1f');var _0x3d6bd8=_0x39038d[_0xd671('0x21')];var _0x5b838e=_0x4ed4d2?0x0:_0x187798[_0xd671('0x1e')];var _0x4802ce=_0x4ed4d2?_0x39038d[_0xd671('0x21')]:_0x187798[_0xd671('0x1e')]+_0x187798[_0xd671('0x20')];var _0xb648ee;if(_0x4802ce>=_0x3d6bd8){_0x4802ce=_0x3d6bd8;_0xb648ee=0xc8;}else{_0xb648ee=0xce;}_0x1a7109[_0xd671('0x1c')](_0xb648ee);return _0x1a7109[_0xd671('0x22')](_0xd671('0x23'),_0x5b838e+'-'+_0x4802ce+'/'+_0x3d6bd8)[_0xd671('0x24')](_0x39038d);}return null;};}function patchUpdates(_0x6dd514){return function(_0x2f8553){try{jsonpatch[_0xd671('0x25')](_0x2f8553,_0x6dd514,!![]);}catch(_0x464d5e){return BPromise[_0xd671('0x26')](_0x464d5e);}return _0x2f8553[_0xd671('0x27')]();};}function saveUpdates(_0x18fb67,_0x437739){return function(_0x508f27){if(_0x508f27){return _0x508f27['update'](_0x18fb67)[_0xd671('0x28')](function(_0x517286){return _0x517286;});}return null;};}function removeEntity(_0x153a71,_0x250bc0){return function(_0x37d940){if(_0x37d940){return _0x37d940[_0xd671('0x29')]()[_0xd671('0x28')](function(){_0x153a71['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b0a8c,_0x5b6008){return function(_0x23b71d){if(!_0x23b71d){_0x4b0a8c['sendStatus'](0x194);}return _0x23b71d;};}function handleError(_0x10c3dd,_0x1e6cc6){_0x1e6cc6=_0x1e6cc6||0x1f4;return function(_0x56b384){logger['error'](_0x56b384['stack']);if(_0x56b384[_0xd671('0x2a')]){delete _0x56b384['name'];}_0x10c3dd['status'](_0x1e6cc6)['send'](_0x56b384);};}exports[_0xd671('0x2b')]=function(_0x45fab8,_0x18aabf){var _0x3dab58={},_0x2f3228={},_0x509d3a={'count':0x0,'rows':[]};var _0x2d7425=_[_0xd671('0x2c')](db[_0xd671('0x2d')][_0xd671('0x2e')],function(_0x56232c){return{'name':_0x56232c[_0xd671('0x2f')],'type':_0x56232c[_0xd671('0x30')]['key']};});_0x2f3228[_0xd671('0x31')]=_[_0xd671('0x2c')](_0x2d7425,'name');_0x2f3228[_0xd671('0x32')]=_['keys'](_0x45fab8[_0xd671('0x32')]);_0x2f3228[_0xd671('0x33')]=_[_0xd671('0x34')](_0x2f3228['model'],_0x2f3228[_0xd671('0x32')]);_0x3dab58['attributes']=_[_0xd671('0x34')](_0x2f3228[_0xd671('0x31')],qs[_0xd671('0x35')](_0x45fab8[_0xd671('0x32')][_0xd671('0x35')]));_0x3dab58[_0xd671('0x36')]=_0x3dab58['attributes']['length']?_0x3dab58[_0xd671('0x36')]:_0x2f3228[_0xd671('0x31')];if(!_0x45fab8[_0xd671('0x32')][_0xd671('0x37')](_0xd671('0x38'))){_0x3dab58['limit']=qs['limit'](_0x45fab8['query'][_0xd671('0x20')]);_0x3dab58[_0xd671('0x1e')]=qs[_0xd671('0x1e')](_0x45fab8[_0xd671('0x32')][_0xd671('0x1e')]);}_0x3dab58[_0xd671('0x39')]=qs[_0xd671('0x3a')](_0x45fab8['query'][_0xd671('0x3a')]);_0x3dab58[_0xd671('0x3b')]=qs[_0xd671('0x33')](_[_0xd671('0x3c')](_0x45fab8['query'],_0x2f3228['filters']),_0x2d7425);if(_0x45fab8[_0xd671('0x32')]['filter']){_0x3dab58[_0xd671('0x3b')]=_[_0xd671('0x3d')](_0x3dab58[_0xd671('0x3b')],{'$or':_[_0xd671('0x2c')](_0x2d7425,function(_0x4821a5){if(_0x4821a5[_0xd671('0x30')]!==_0xd671('0x3e')){var _0x1d24d={};_0x1d24d[_0x4821a5[_0xd671('0x2a')]]={'$like':'%'+_0x45fab8[_0xd671('0x32')][_0xd671('0x3f')]+'%'};return _0x1d24d;}})});}_0x3dab58=_[_0xd671('0x3d')]({},_0x3dab58,_0x45fab8[_0xd671('0x40')]);var _0x34d497={'where':_0x3dab58['where']};return db[_0xd671('0x2d')][_0xd671('0x21')](_0x34d497)['then'](function(_0x2b2e8b){_0x509d3a[_0xd671('0x21')]=_0x2b2e8b;if(_0x45fab8['query']['includeAll']){_0x3dab58['include']=[{'all':!![]}];}return db[_0xd671('0x2d')]['findAll'](_0x3dab58);})[_0xd671('0x28')](function(_0x523d0a){_0x509d3a[_0xd671('0x41')]=_0x523d0a;return _0x509d3a;})[_0xd671('0x28')](respondWithFilteredResult(_0x18aabf,_0x3dab58))[_0xd671('0x42')](handleError(_0x18aabf,null));};exports['show']=function(_0x5c9d4b,_0x450696){var _0x586d49={'raw':![],'where':{'id':_0x5c9d4b[_0xd671('0x43')]['id']}},_0x176581={};_0x176581['model']=_[_0xd671('0x44')](db[_0xd671('0x2d')][_0xd671('0x2e')]);_0x176581[_0xd671('0x32')]=_[_0xd671('0x44')](_0x5c9d4b[_0xd671('0x32')]);_0x176581[_0xd671('0x33')]=_[_0xd671('0x34')](_0x176581['model'],_0x176581[_0xd671('0x32')]);_0x586d49[_0xd671('0x36')]=_[_0xd671('0x34')](_0x176581['model'],qs[_0xd671('0x35')](_0x5c9d4b[_0xd671('0x32')][_0xd671('0x35')]));_0x586d49['attributes']=_0x586d49[_0xd671('0x36')][_0xd671('0x45')]?_0x586d49[_0xd671('0x36')]:_0x176581[_0xd671('0x31')];if(_0x5c9d4b[_0xd671('0x32')]['includeAll']){_0x586d49[_0xd671('0x46')]=[{'all':!![]}];}_0x586d49=_[_0xd671('0x3d')]({},_0x586d49,_0x5c9d4b[_0xd671('0x40')]);return db[_0xd671('0x2d')]['find'](_0x586d49)['then'](handleEntityNotFound(_0x450696,null))[_0xd671('0x28')](respondWithResult(_0x450696,null))[_0xd671('0x42')](handleError(_0x450696,null));};exports[_0xd671('0x47')]=function(_0x3683db,_0x395557){return db[_0xd671('0x2d')][_0xd671('0x47')](_0x3683db[_0xd671('0x48')],{})[_0xd671('0x28')](respondWithResult(_0x395557,0xc9))['catch'](handleError(_0x395557,null));};exports['update']=function(_0x1ad9f2,_0x54ce6d){if(_0x1ad9f2[_0xd671('0x48')]['id']){delete _0x1ad9f2[_0xd671('0x48')]['id'];}return db[_0xd671('0x2d')][_0xd671('0x49')]({'where':{'id':_0x1ad9f2[_0xd671('0x43')]['id']}})[_0xd671('0x28')](handleEntityNotFound(_0x54ce6d,null))[_0xd671('0x28')](saveUpdates(_0x1ad9f2[_0xd671('0x48')],null))[_0xd671('0x28')](respondWithResult(_0x54ce6d,null))[_0xd671('0x42')](handleError(_0x54ce6d,null));};exports[_0xd671('0x29')]=function(_0x372cf2,_0x4348ae){return db['ZohoAccount'][_0xd671('0x49')]({'where':{'id':_0x372cf2[_0xd671('0x43')]['id']}})[_0xd671('0x28')](handleEntityNotFound(_0x4348ae,null))[_0xd671('0x28')](removeEntity(_0x4348ae,null))[_0xd671('0x42')](handleError(_0x4348ae,null));};exports[_0xd671('0x4a')]=function(_0x426418,_0x2d4c9c,_0xb6fe2b){var _0x2e2138={};var _0x258804={};var _0x37ad24;var _0x3f9c77;return db[_0xd671('0x2d')][_0xd671('0x4b')]({'where':{'id':_0x426418[_0xd671('0x43')]['id']}})[_0xd671('0x28')](handleEntityNotFound(_0x2d4c9c,null))[_0xd671('0x28')](function(_0x228f2e){if(_0x228f2e){_0x37ad24=_0x228f2e;_0x258804['model']=_[_0xd671('0x44')](db[_0xd671('0x4c')]['rawAttributes']);_0x258804[_0xd671('0x32')]=_[_0xd671('0x44')](_0x426418[_0xd671('0x32')]);_0x258804['filters']=_[_0xd671('0x34')](_0x258804[_0xd671('0x31')],_0x258804[_0xd671('0x32')]);_0x2e2138['attributes']=_[_0xd671('0x34')](_0x258804[_0xd671('0x31')],qs[_0xd671('0x35')](_0x426418[_0xd671('0x32')][_0xd671('0x35')]));_0x2e2138[_0xd671('0x36')]=_0x2e2138[_0xd671('0x36')][_0xd671('0x45')]?_0x2e2138[_0xd671('0x36')]:_0x258804[_0xd671('0x31')];_0x2e2138[_0xd671('0x39')]=qs[_0xd671('0x3a')](_0x426418['query'][_0xd671('0x3a')]);_0x2e2138[_0xd671('0x3b')]=qs[_0xd671('0x33')](_[_0xd671('0x3c')](_0x426418[_0xd671('0x32')],_0x258804[_0xd671('0x33')]));if(_0x426418[_0xd671('0x32')][_0xd671('0x3f')]){_0x2e2138[_0xd671('0x3b')]=_[_0xd671('0x3d')](_0x2e2138[_0xd671('0x3b')],{'$or':_['map'](_0x2e2138[_0xd671('0x36')],function(_0x4d9444){var _0x6decc4={};_0x6decc4[_0x4d9444]={'$like':'%'+_0x426418['query'][_0xd671('0x3f')]+'%'};return _0x6decc4;})});}_0x2e2138=_[_0xd671('0x3d')]({},_0x2e2138,_0x426418[_0xd671('0x40')]);return _0x37ad24['getConfigurations'](_0x2e2138);}})[_0xd671('0x28')](function(_0x47aeee){if(_0x47aeee){_0x3f9c77=_0x47aeee[_0xd671('0x45')];if(!_0x426418['query'][_0xd671('0x37')](_0xd671('0x38'))){_0x2e2138[_0xd671('0x20')]=qs[_0xd671('0x20')](_0x426418['query'][_0xd671('0x20')]);_0x2e2138[_0xd671('0x1e')]=qs['offset'](_0x426418[_0xd671('0x32')][_0xd671('0x1e')]);}return _0x37ad24[_0xd671('0x4a')](_0x2e2138);}})[_0xd671('0x28')](function(_0x3b2a16){if(_0x3b2a16){return _0x3b2a16?{'count':_0x3f9c77,'rows':_0x3b2a16}:null;}})[_0xd671('0x28')](respondWithResult(_0x2d4c9c,null))[_0xd671('0x42')](handleError(_0x2d4c9c,null));};exports[_0xd671('0x4d')]=function(_0x3ff642,_0xd55423,_0x316543){if(_0x3ff642[_0xd671('0x48')]['id']){delete _0x3ff642['body']['id'];}return db['ZohoAccount'][_0xd671('0x4b')]({'where':{'id':_0x3ff642[_0xd671('0x43')]['id']}})[_0xd671('0x28')](handleEntityNotFound(_0xd55423,null))['then'](function(_0x43d006){if(_0x43d006){_0x3ff642[_0xd671('0x48')][_0xd671('0x4e')]=_0x43d006['id'];_0x3ff642[_0xd671('0x48')][_0xd671('0x4f')]=integrations[_0xd671('0x50')](_0x3ff642['body']['channel'],_0x3ff642[_0xd671('0x48')][_0xd671('0x30')]);_0x3ff642[_0xd671('0x48')][_0xd671('0x51')]=integrations[_0xd671('0x52')](_0x3ff642[_0xd671('0x48')][_0xd671('0x53')],_0x3ff642[_0xd671('0x48')]['type']);return db[_0xd671('0x4c')][_0xd671('0x47')](_0x3ff642[_0xd671('0x48')],{'include':[{'model':db[_0xd671('0x54')],'as':'Subjects'},{'model':db[_0xd671('0x54')],'as':_0xd671('0x51')}]});}return null;})['then'](respondWithResult(_0xd55423,null))[_0xd671('0x42')](handleError(_0xd55423,null));};function getAccessToken(_0x104a76){return new Promise(function(_0x2fd1e0,_0xf23e56){var _0x1fa443;switch(_0x104a76[_0xd671('0x55')]){case'US':_0x1fa443=_0xd671('0x56');break;case'AU':_0x1fa443=_0xd671('0x57');break;case'EU':_0x1fa443=_0xd671('0x58');break;case'IN':_0x1fa443=_0xd671('0x59');break;case'CN':_0x1fa443='https://accounts.zoho.com.cn';break;default:_0x1fa443='https://accounts.zoho.eu';break;}var _0x1dba95={'method':_0xd671('0x5a'),'uri':_0x1fa443+'/oauth/v2/token','qs':{'refresh_token':_0x104a76[_0xd671('0x5b')],'client_id':_0x104a76[_0xd671('0x5c')],'client_secret':_0x104a76[_0xd671('0x5d')],'grant_type':_0xd671('0x5e')},'json':!![]};return rp(_0x1dba95)[_0xd671('0x28')](function(_0x433487){if(_0x433487['access_token']){_0x2fd1e0(_0x433487['access_token']);}else{_0xf23e56(_0xd671('0x5f'));}})[_0xd671('0x42')](function(_0x377e72){_0xf23e56(_0x377e72);});});}exports[_0xd671('0x60')]=function(_0x488a69,_0x52e949,_0x116cdf){var _0x581010,_0x5c8920,_0x34ac32,_0xbb0a2,_0x2f39ae;return db[_0xd671('0x2d')][_0xd671('0x4b')]({'where':{'id':_0x488a69[_0xd671('0x43')]['id']},'attributes':['id',_0xd671('0x61'),'zone',_0xd671('0x5c'),_0xd671('0x5d'),_0xd671('0x62'),_0xd671('0x63'),_0xd671('0x5b')]})['then'](handleEntityNotFound(_0x52e949,null))['then'](function(_0x1d76dc){_0x2f39ae=_0x1d76dc;_0x581010=_0x2f39ae[_0xd671('0x61')];_0x5c8920=_0x581010===_0xd671('0x64')?'eu':_0xd671('0x65');_0x34ac32=_0x2f39ae['serverUrl'];var _0x294986=_0x34ac32[_0xd671('0x66')](-0x1);if(_0x294986==='/'||_0x294986==='\x5c'||_0x294986===':'){_0x34ac32=_0x34ac32[_0xd671('0x67')](0x0,_0x34ac32[_0xd671('0x68')](_0x294986));}if(!_0x2f39ae['refreshToken']){throw new Error(_0xd671('0x69'));}return getAccessToken(_0x2f39ae);})[_0xd671('0x28')](function(_0x54c378){if(_0x54c378){return rp({'method':_0xd671('0x6a'),'uri':util[_0xd671('0x6b')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0x5c8920),'qs':{'module':_0xd671('0x6c')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x54c378},'json':!![]});}})[_0xd671('0x28')](function(_0x3322da){if(_0x3322da){if(_0x3322da[_0xd671('0x6d')]&&_0x3322da[_0xd671('0x6d')][_0xd671('0x6e')]){throw new Error(_0x3322da['response']['error'][_0xd671('0x6f')]);}var _0x126224=[];var _0x497294=[];var _0x3ee681=[_0xd671('0x70'),_0xd671('0x71'),_0xd671('0x72'),_0xd671('0x73'),_0xd671('0x74'),'Call_Result',_0xd671('0x75'),'Call_Type'];_0x497294=_[_0xd671('0x76')](_0x3322da['fields'],function(_0x3fa555){return _0x3ee681['includes'](_0x3fa555['api_name']);});for(var _0x2e70c6=0x0;_0x2e70c6<_0x497294['length'];_0x2e70c6++){if(_0x497294[_0x2e70c6][_0xd671('0x77')]===![]){_0x126224[_0xd671('0x78')]({'id':_0x497294[_0x2e70c6]['id'],'name':_0x497294[_0x2e70c6][_0xd671('0x79')],'custom':_0x497294[_0x2e70c6][_0xd671('0x7a')],'options':_0x497294[_0x2e70c6][_0xd671('0x7b')]===_0xd671('0x7c')&&_0x497294[_0x2e70c6][_0xd671('0x7d')][_0xd671('0x45')]>-0x1?_[_0xd671('0x2c')](_0x497294[_0x2e70c6]['pick_list_values'],function(_0x3db2b5){return{'name':_0x3db2b5,'value':_0x3db2b5};}):[]});}}return{'count':_0x126224[_0xd671('0x45')],'rows':_0x126224};}else{return{'count':0x0,'rows':[]};}})[_0xd671('0x28')](respondWithResult(_0x52e949,null))[_0xd671('0x42')](function(_0x3a6063){var _0x1cd546=_0x488a69[_0xd671('0x32')][_0xd671('0x7e')]?0x1f4:_0x3a6063[_0xd671('0x7f')]||0x1f4;logger['error'](_0xd671('0x80'),_0xd671('0x60'),_0x1cd546,JSON[_0xd671('0x81')](_0x3a6063));delete _0x3a6063[_0xd671('0x2a')];if(_0x1cd546===0x191){_0x1cd546=0x190;}_0x52e949[_0xd671('0x1c')](_0x1cd546)[_0xd671('0x82')](_0x488a69['query'][_0xd671('0x7e')]?{'message':_0xd671('0x83'),'statusCode':_0x3a6063['statusCode']}:_0x3a6063);});}; \ No newline at end of file +var _0xbc41=['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','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','zone','serverUrl','code','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','message','Owner','Subject','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','includes','api_name','system_mandatory','push','display_label','custom_field','data_type','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','options','ZohoAccount','includeAll','include','findAll','rows','catch','show','params','find','create','body','getConfigurations','ZohoConfiguration','nolimit','addConfiguration','findOne','AccountId','getSubjects','Descriptions','getDescriptions','channel','ZohoField','Subjects'];(function(_0x199c23,_0x5bdfce){var _0x39ef23=function(_0x4e7e50){while(--_0x4e7e50){_0x199c23['push'](_0x199c23['shift']());}};_0x39ef23(++_0x5bdfce);}(_0xbc41,0x132));var _0x1bc4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbc41[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1bc4('0x0'));var zipdir=require(_0x1bc4('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1bc4('0x2'));var moment=require(_0x1bc4('0x3'));var BPromise=require(_0x1bc4('0x4'));var Mustache=require(_0x1bc4('0x5'));var util=require(_0x1bc4('0x6'));var path=require(_0x1bc4('0x7'));var sox=require('sox');var csv=require(_0x1bc4('0x8'));var ejs=require(_0x1bc4('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x1bc4('0xa'));var crypto=require(_0x1bc4('0xb'));var jsforce=require(_0x1bc4('0xc'));var deskjs=require(_0x1bc4('0xd'));var toCsv=require(_0x1bc4('0x8'));var querystring=require(_0x1bc4('0xe'));var Papa=require(_0x1bc4('0xf'));var Redis=require(_0x1bc4('0x10'));var authService=require(_0x1bc4('0x11'));var qs=require(_0x1bc4('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x1bc4('0x13'))(_0x1bc4('0x14'));var utils=require(_0x1bc4('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1bc4('0x16'))['db'];var integrations=require(_0x1bc4('0x17'));function respondWithStatusCode(_0x514bd2,_0x255621){_0x255621=_0x255621||0xcc;return function(_0x50d7e4){if(_0x50d7e4){return _0x514bd2[_0x1bc4('0x18')](_0x255621);}return _0x514bd2['status'](_0x255621)['end']();};}function respondWithResult(_0x33927e,_0x335118){_0x335118=_0x335118||0xc8;return function(_0x389758){if(_0x389758){return _0x33927e[_0x1bc4('0x19')](_0x335118)[_0x1bc4('0x1a')](_0x389758);}};}function respondWithFilteredResult(_0x488eb3,_0x4e3a8e){return function(_0x53ad1f){if(_0x53ad1f){var _0x41bb28=typeof _0x4e3a8e[_0x1bc4('0x1b')]==='undefined'&&typeof _0x4e3a8e[_0x1bc4('0x1c')]===_0x1bc4('0x1d');var _0x1ebe41=_0x53ad1f[_0x1bc4('0x1e')];var _0x3d2ff9=_0x41bb28?0x0:_0x4e3a8e[_0x1bc4('0x1b')];var _0x3f314a=_0x41bb28?_0x53ad1f['count']:_0x4e3a8e[_0x1bc4('0x1b')]+_0x4e3a8e[_0x1bc4('0x1c')];var _0x566c5b;if(_0x3f314a>=_0x1ebe41){_0x3f314a=_0x1ebe41;_0x566c5b=0xc8;}else{_0x566c5b=0xce;}_0x488eb3[_0x1bc4('0x19')](_0x566c5b);return _0x488eb3[_0x1bc4('0x1f')]('Content-Range',_0x3d2ff9+'-'+_0x3f314a+'/'+_0x1ebe41)['json'](_0x53ad1f);}return null;};}function patchUpdates(_0x5c77bd){return function(_0x2807e7){try{jsonpatch[_0x1bc4('0x20')](_0x2807e7,_0x5c77bd,!![]);}catch(_0x91d483){return BPromise[_0x1bc4('0x21')](_0x91d483);}return _0x2807e7[_0x1bc4('0x22')]();};}function saveUpdates(_0x5cb3de,_0x551a3f){return function(_0x3b1682){if(_0x3b1682){return _0x3b1682[_0x1bc4('0x23')](_0x5cb3de)[_0x1bc4('0x24')](function(_0x4dc790){return _0x4dc790;});}return null;};}function removeEntity(_0x450224,_0x2e1822){return function(_0x24cfab){if(_0x24cfab){return _0x24cfab[_0x1bc4('0x25')]()[_0x1bc4('0x24')](function(){_0x450224[_0x1bc4('0x19')](0xcc)[_0x1bc4('0x26')]();});}};}function handleEntityNotFound(_0x1f9d67,_0x132d11){return function(_0x1a85f7){if(!_0x1a85f7){_0x1f9d67[_0x1bc4('0x18')](0x194);}return _0x1a85f7;};}function handleError(_0x26af6b,_0x2614ed){_0x2614ed=_0x2614ed||0x1f4;return function(_0x45eeaa){logger[_0x1bc4('0x27')](_0x45eeaa[_0x1bc4('0x28')]);if(_0x45eeaa[_0x1bc4('0x29')]){delete _0x45eeaa[_0x1bc4('0x29')];}_0x26af6b[_0x1bc4('0x19')](_0x2614ed)[_0x1bc4('0x2a')](_0x45eeaa);};}exports[_0x1bc4('0x2b')]=function(_0x1bdc50,_0xb8b718){var _0x230171={},_0x37ec9c={},_0x58a3ca={'count':0x0,'rows':[]};var _0x1519e8=_[_0x1bc4('0x2c')](db['ZohoAccount'][_0x1bc4('0x2d')],function(_0x5ccbdf){return{'name':_0x5ccbdf['fieldName'],'type':_0x5ccbdf['type'][_0x1bc4('0x2e')]};});_0x37ec9c[_0x1bc4('0x2f')]=_[_0x1bc4('0x2c')](_0x1519e8,_0x1bc4('0x29'));_0x37ec9c[_0x1bc4('0x30')]=_[_0x1bc4('0x31')](_0x1bdc50[_0x1bc4('0x30')]);_0x37ec9c[_0x1bc4('0x32')]=_[_0x1bc4('0x33')](_0x37ec9c[_0x1bc4('0x2f')],_0x37ec9c[_0x1bc4('0x30')]);_0x230171[_0x1bc4('0x34')]=_['intersection'](_0x37ec9c[_0x1bc4('0x2f')],qs[_0x1bc4('0x35')](_0x1bdc50['query'][_0x1bc4('0x35')]));_0x230171[_0x1bc4('0x34')]=_0x230171[_0x1bc4('0x34')][_0x1bc4('0x36')]?_0x230171[_0x1bc4('0x34')]:_0x37ec9c[_0x1bc4('0x2f')];if(!_0x1bdc50[_0x1bc4('0x30')][_0x1bc4('0x37')]('nolimit')){_0x230171['limit']=qs[_0x1bc4('0x1c')](_0x1bdc50[_0x1bc4('0x30')][_0x1bc4('0x1c')]);_0x230171[_0x1bc4('0x1b')]=qs['offset'](_0x1bdc50['query'][_0x1bc4('0x1b')]);}_0x230171[_0x1bc4('0x38')]=qs['sort'](_0x1bdc50['query'][_0x1bc4('0x39')]);_0x230171[_0x1bc4('0x3a')]=qs[_0x1bc4('0x32')](_[_0x1bc4('0x3b')](_0x1bdc50[_0x1bc4('0x30')],_0x37ec9c[_0x1bc4('0x32')]),_0x1519e8);if(_0x1bdc50[_0x1bc4('0x30')][_0x1bc4('0x3c')]){_0x230171[_0x1bc4('0x3a')]=_[_0x1bc4('0x3d')](_0x230171[_0x1bc4('0x3a')],{'$or':_['map'](_0x1519e8,function(_0x2835e1){if(_0x2835e1[_0x1bc4('0x3e')]!=='VIRTUAL'){var _0xfbebed={};_0xfbebed[_0x2835e1['name']]={'$like':'%'+_0x1bdc50[_0x1bc4('0x30')][_0x1bc4('0x3c')]+'%'};return _0xfbebed;}})});}_0x230171=_[_0x1bc4('0x3d')]({},_0x230171,_0x1bdc50[_0x1bc4('0x3f')]);var _0x19bae0={'where':_0x230171[_0x1bc4('0x3a')]};return db[_0x1bc4('0x40')]['count'](_0x19bae0)['then'](function(_0x56231e){_0x58a3ca[_0x1bc4('0x1e')]=_0x56231e;if(_0x1bdc50['query'][_0x1bc4('0x41')]){_0x230171[_0x1bc4('0x42')]=[{'all':!![]}];}return db[_0x1bc4('0x40')][_0x1bc4('0x43')](_0x230171);})[_0x1bc4('0x24')](function(_0x425473){_0x58a3ca[_0x1bc4('0x44')]=_0x425473;return _0x58a3ca;})['then'](respondWithFilteredResult(_0xb8b718,_0x230171))[_0x1bc4('0x45')](handleError(_0xb8b718,null));};exports[_0x1bc4('0x46')]=function(_0x3321c9,_0x2f98d3){var _0x2e7c25={'raw':![],'where':{'id':_0x3321c9[_0x1bc4('0x47')]['id']}},_0x3a22ad={};_0x3a22ad[_0x1bc4('0x2f')]=_[_0x1bc4('0x31')](db[_0x1bc4('0x40')]['rawAttributes']);_0x3a22ad[_0x1bc4('0x30')]=_[_0x1bc4('0x31')](_0x3321c9[_0x1bc4('0x30')]);_0x3a22ad['filters']=_['intersection'](_0x3a22ad[_0x1bc4('0x2f')],_0x3a22ad[_0x1bc4('0x30')]);_0x2e7c25[_0x1bc4('0x34')]=_[_0x1bc4('0x33')](_0x3a22ad[_0x1bc4('0x2f')],qs['fields'](_0x3321c9['query']['fields']));_0x2e7c25[_0x1bc4('0x34')]=_0x2e7c25[_0x1bc4('0x34')][_0x1bc4('0x36')]?_0x2e7c25['attributes']:_0x3a22ad[_0x1bc4('0x2f')];if(_0x3321c9[_0x1bc4('0x30')]['includeAll']){_0x2e7c25[_0x1bc4('0x42')]=[{'all':!![]}];}_0x2e7c25=_[_0x1bc4('0x3d')]({},_0x2e7c25,_0x3321c9[_0x1bc4('0x3f')]);return db[_0x1bc4('0x40')][_0x1bc4('0x48')](_0x2e7c25)[_0x1bc4('0x24')](handleEntityNotFound(_0x2f98d3,null))[_0x1bc4('0x24')](respondWithResult(_0x2f98d3,null))[_0x1bc4('0x45')](handleError(_0x2f98d3,null));};exports[_0x1bc4('0x49')]=function(_0x26ba3d,_0x10bd64){return db[_0x1bc4('0x40')]['create'](_0x26ba3d[_0x1bc4('0x4a')],{})[_0x1bc4('0x24')](respondWithResult(_0x10bd64,0xc9))[_0x1bc4('0x45')](handleError(_0x10bd64,null));};exports['update']=function(_0x12c6e3,_0x15fd79){if(_0x12c6e3['body']['id']){delete _0x12c6e3[_0x1bc4('0x4a')]['id'];}return db[_0x1bc4('0x40')]['find']({'where':{'id':_0x12c6e3[_0x1bc4('0x47')]['id']}})['then'](handleEntityNotFound(_0x15fd79,null))[_0x1bc4('0x24')](saveUpdates(_0x12c6e3[_0x1bc4('0x4a')],null))[_0x1bc4('0x24')](respondWithResult(_0x15fd79,null))['catch'](handleError(_0x15fd79,null));};exports[_0x1bc4('0x25')]=function(_0x5756fc,_0x5cf901){return db['ZohoAccount']['find']({'where':{'id':_0x5756fc[_0x1bc4('0x47')]['id']}})[_0x1bc4('0x24')](handleEntityNotFound(_0x5cf901,null))['then'](removeEntity(_0x5cf901,null))[_0x1bc4('0x45')](handleError(_0x5cf901,null));};exports[_0x1bc4('0x4b')]=function(_0x3e8d59,_0x3870a2,_0x46d146){var _0x4821f2={};var _0x1cae5b={};var _0x2bd3ee;var _0x5e1991;return db[_0x1bc4('0x40')]['findOne']({'where':{'id':_0x3e8d59[_0x1bc4('0x47')]['id']}})[_0x1bc4('0x24')](handleEntityNotFound(_0x3870a2,null))[_0x1bc4('0x24')](function(_0x1a0515){if(_0x1a0515){_0x2bd3ee=_0x1a0515;_0x1cae5b['model']=_[_0x1bc4('0x31')](db[_0x1bc4('0x4c')][_0x1bc4('0x2d')]);_0x1cae5b[_0x1bc4('0x30')]=_[_0x1bc4('0x31')](_0x3e8d59[_0x1bc4('0x30')]);_0x1cae5b[_0x1bc4('0x32')]=_[_0x1bc4('0x33')](_0x1cae5b[_0x1bc4('0x2f')],_0x1cae5b['query']);_0x4821f2['attributes']=_['intersection'](_0x1cae5b[_0x1bc4('0x2f')],qs['fields'](_0x3e8d59['query'][_0x1bc4('0x35')]));_0x4821f2[_0x1bc4('0x34')]=_0x4821f2['attributes']['length']?_0x4821f2['attributes']:_0x1cae5b['model'];_0x4821f2[_0x1bc4('0x38')]=qs[_0x1bc4('0x39')](_0x3e8d59[_0x1bc4('0x30')][_0x1bc4('0x39')]);_0x4821f2['where']=qs[_0x1bc4('0x32')](_[_0x1bc4('0x3b')](_0x3e8d59[_0x1bc4('0x30')],_0x1cae5b[_0x1bc4('0x32')]));if(_0x3e8d59[_0x1bc4('0x30')][_0x1bc4('0x3c')]){_0x4821f2['where']=_[_0x1bc4('0x3d')](_0x4821f2[_0x1bc4('0x3a')],{'$or':_[_0x1bc4('0x2c')](_0x4821f2[_0x1bc4('0x34')],function(_0x55c41b){var _0x500919={};_0x500919[_0x55c41b]={'$like':'%'+_0x3e8d59[_0x1bc4('0x30')][_0x1bc4('0x3c')]+'%'};return _0x500919;})});}_0x4821f2=_[_0x1bc4('0x3d')]({},_0x4821f2,_0x3e8d59['options']);return _0x2bd3ee[_0x1bc4('0x4b')](_0x4821f2);}})[_0x1bc4('0x24')](function(_0x2bef3e){if(_0x2bef3e){_0x5e1991=_0x2bef3e[_0x1bc4('0x36')];if(!_0x3e8d59[_0x1bc4('0x30')][_0x1bc4('0x37')](_0x1bc4('0x4d'))){_0x4821f2[_0x1bc4('0x1c')]=qs[_0x1bc4('0x1c')](_0x3e8d59[_0x1bc4('0x30')][_0x1bc4('0x1c')]);_0x4821f2['offset']=qs[_0x1bc4('0x1b')](_0x3e8d59[_0x1bc4('0x30')]['offset']);}return _0x2bd3ee[_0x1bc4('0x4b')](_0x4821f2);}})[_0x1bc4('0x24')](function(_0x36d7ce){if(_0x36d7ce){return _0x36d7ce?{'count':_0x5e1991,'rows':_0x36d7ce}:null;}})[_0x1bc4('0x24')](respondWithResult(_0x3870a2,null))[_0x1bc4('0x45')](handleError(_0x3870a2,null));};exports[_0x1bc4('0x4e')]=function(_0x4d0a40,_0x56f945,_0x1cc1fd){if(_0x4d0a40['body']['id']){delete _0x4d0a40[_0x1bc4('0x4a')]['id'];}return db[_0x1bc4('0x40')][_0x1bc4('0x4f')]({'where':{'id':_0x4d0a40[_0x1bc4('0x47')]['id']}})[_0x1bc4('0x24')](handleEntityNotFound(_0x56f945,null))['then'](function(_0x577c8a){if(_0x577c8a){_0x4d0a40[_0x1bc4('0x4a')][_0x1bc4('0x50')]=_0x577c8a['id'];_0x4d0a40['body']['Subjects']=integrations[_0x1bc4('0x51')](_0x4d0a40[_0x1bc4('0x4a')]['channel'],_0x4d0a40['body'][_0x1bc4('0x3e')]);_0x4d0a40[_0x1bc4('0x4a')][_0x1bc4('0x52')]=integrations[_0x1bc4('0x53')](_0x4d0a40[_0x1bc4('0x4a')][_0x1bc4('0x54')],_0x4d0a40['body'][_0x1bc4('0x3e')]);return db[_0x1bc4('0x4c')][_0x1bc4('0x49')](_0x4d0a40[_0x1bc4('0x4a')],{'include':[{'model':db[_0x1bc4('0x55')],'as':_0x1bc4('0x56')},{'model':db[_0x1bc4('0x55')],'as':'Descriptions'}]});}return null;})[_0x1bc4('0x24')](respondWithResult(_0x56f945,null))[_0x1bc4('0x45')](handleError(_0x56f945,null));};function getAccessToken(_0x30ffc5){return new Promise(function(_0xd72af0,_0x2edea9){var _0x184046;switch(_0x30ffc5['zone']){case'US':_0x184046=_0x1bc4('0x57');break;case'AU':_0x184046=_0x1bc4('0x58');break;case'EU':_0x184046=_0x1bc4('0x59');break;case'IN':_0x184046=_0x1bc4('0x5a');break;case'CN':_0x184046='https://accounts.zoho.com.cn';break;default:_0x184046=_0x1bc4('0x59');break;}var _0x963a01={'method':_0x1bc4('0x5b'),'uri':_0x184046+'/oauth/v2/token','qs':{'refresh_token':_0x30ffc5[_0x1bc4('0x5c')],'client_id':_0x30ffc5[_0x1bc4('0x5d')],'client_secret':_0x30ffc5[_0x1bc4('0x5e')],'grant_type':_0x1bc4('0x5f')},'json':!![]};return rp(_0x963a01)[_0x1bc4('0x24')](function(_0x5b4a7c){if(_0x5b4a7c['access_token']){_0xd72af0(_0x5b4a7c[_0x1bc4('0x60')]);}else{_0x2edea9(_0x1bc4('0x61'));}})[_0x1bc4('0x45')](function(_0x21de39){_0x2edea9(_0x21de39);});});}exports[_0x1bc4('0x62')]=function(_0x4c139b,_0x3163e5,_0x50909e){var _0x387f2e,_0x132059,_0x17003c,_0x2340eb,_0x56ce29;return db[_0x1bc4('0x40')][_0x1bc4('0x4f')]({'where':{'id':_0x4c139b['params']['id']},'attributes':['id',_0x1bc4('0x63'),_0x1bc4('0x64'),_0x1bc4('0x5d'),_0x1bc4('0x5e'),_0x1bc4('0x65'),_0x1bc4('0x66'),'refreshToken']})[_0x1bc4('0x24')](handleEntityNotFound(_0x3163e5,null))[_0x1bc4('0x24')](function(_0x1cae0e){_0x56ce29=_0x1cae0e;_0x387f2e=_0x56ce29[_0x1bc4('0x63')];_0x132059=_0x387f2e==='zoho.eu'?'eu':'com';_0x17003c=_0x56ce29['serverUrl'];var _0x50cede=_0x17003c['slice'](-0x1);if(_0x50cede==='/'||_0x50cede==='\x5c'||_0x50cede===':'){_0x17003c=_0x17003c[_0x1bc4('0x67')](0x0,_0x17003c[_0x1bc4('0x68')](_0x50cede));}if(!_0x56ce29[_0x1bc4('0x5c')]){throw new Error(_0x1bc4('0x69'));}return getAccessToken(_0x56ce29);})[_0x1bc4('0x24')](function(_0x3ccb7b){if(_0x3ccb7b){return rp({'method':'GET','uri':util[_0x1bc4('0x6a')](_0x1bc4('0x6b'),_0x132059),'qs':{'module':_0x1bc4('0x6c')},'headers':{'Authorization':_0x1bc4('0x6d')+_0x3ccb7b},'json':!![]});}})[_0x1bc4('0x24')](function(_0x1f9e15){if(_0x1f9e15){if(_0x1f9e15['response']&&_0x1f9e15[_0x1bc4('0x6e')][_0x1bc4('0x27')]){throw new Error(_0x1f9e15[_0x1bc4('0x6e')][_0x1bc4('0x27')][_0x1bc4('0x6f')]);}var _0x336d44=[];var _0x428dd3=[];var _0x1cd78=[_0x1bc4('0x70'),_0x1bc4('0x71'),'Description',_0x1bc4('0x72'),_0x1bc4('0x73'),_0x1bc4('0x74'),_0x1bc4('0x75'),_0x1bc4('0x76')];_0x428dd3=_['remove'](_0x1f9e15[_0x1bc4('0x35')],function(_0x29c070){return _0x1cd78[_0x1bc4('0x77')](_0x29c070[_0x1bc4('0x78')]);});for(var _0x27274a=0x0;_0x27274a<_0x428dd3['length'];_0x27274a++){if(_0x428dd3[_0x27274a][_0x1bc4('0x79')]===![]){_0x336d44[_0x1bc4('0x7a')]({'id':_0x428dd3[_0x27274a]['id'],'name':_0x428dd3[_0x27274a][_0x1bc4('0x7b')],'custom':_0x428dd3[_0x27274a][_0x1bc4('0x7c')],'options':_0x428dd3[_0x27274a][_0x1bc4('0x7d')]==='picklist'&&_0x428dd3[_0x27274a][_0x1bc4('0x7e')][_0x1bc4('0x36')]>-0x1?_[_0x1bc4('0x2c')](_0x428dd3[_0x27274a]['pick_list_values'],function(_0x392375){return{'name':_0x392375,'value':_0x392375};}):[]});}}return{'count':_0x336d44['length'],'rows':_0x336d44};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x3163e5,null))[_0x1bc4('0x45')](function(_0x54d838){var _0x59ff94=_0x4c139b[_0x1bc4('0x30')][_0x1bc4('0x7f')]?0x1f4:_0x54d838[_0x1bc4('0x80')]||0x1f4;logger[_0x1bc4('0x27')](_0x1bc4('0x81'),_0x1bc4('0x62'),_0x59ff94,JSON[_0x1bc4('0x82')](_0x54d838));delete _0x54d838[_0x1bc4('0x29')];if(_0x59ff94===0x191){_0x59ff94=0x190;}_0x3163e5[_0x1bc4('0x19')](_0x59ff94)[_0x1bc4('0x2a')](_0x4c139b[_0x1bc4('0x30')][_0x1bc4('0x7f')]?{'message':'Wrong\x20credentials','statusCode':_0x54d838[_0x1bc4('0x80')]}:_0x54d838);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 9e7c69b..5119fdb 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 _0x0f7b=['serverUrl','clientId','clientSecret','code','host','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.eu','POST','authorization_code','application/x-www-form-urlencoded','parse','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','name','catch','zone','https://accounts.zoho.com.cn','then','refresh_token','inspect','lodash','util','../../config/logger','moment','path','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','int_zoho_accounts','changed'];(function(_0x52121d,_0x1d1704){var _0x448627=function(_0x495bf0){while(--_0x495bf0){_0x52121d['push'](_0x52121d['shift']());}};_0x448627(++_0x1d1704);}(_0x0f7b,0x113));var _0xb0f7=function(_0x5cb1af,_0x4bdc8c){_0x5cb1af=_0x5cb1af-0x0;var _0x8d7940=_0x0f7b[_0x5cb1af];return _0x8d7940;};'use strict';var _=require(_0xb0f7('0x0'));var util=require(_0xb0f7('0x1'));var logger=require(_0xb0f7('0x2'))('api');var moment=require(_0xb0f7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb0f7('0x4'));var rimraf=require(_0xb0f7('0x5'));var config=require(_0xb0f7('0x6'));var attributes=require(_0xb0f7('0x7'));var integrations=require(_0xb0f7('0x8'));module[_0xb0f7('0x9')]=function(_0x2a2606,_0x13ea21){return _0x2a2606['define']('ZohoAccount',attributes,{'tableName':_0xb0f7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3a4246,_0x482f25,_0x515c34){if(_0x3a4246[_0xb0f7('0xb')]('zone')||_0x3a4246[_0xb0f7('0xb')](_0xb0f7('0xc'))||_0x3a4246[_0xb0f7('0xb')](_0xb0f7('0xd'))||_0x3a4246[_0xb0f7('0xb')](_0xb0f7('0xe'))||_0x3a4246[_0xb0f7('0xb')](_0xb0f7('0xf'))||_0x3a4246[_0xb0f7('0xb')](_0xb0f7('0x10'))){var _0x3060ea,_0x223578;_0x3060ea=_0x3a4246[_0xb0f7('0xc')];var _0x233f59=_0x3060ea[_0xb0f7('0x11')](-0x1);if(_0x233f59==='/'||_0x233f59==='\x5c'||_0x233f59===':'){_0x3060ea=_0x3060ea[_0xb0f7('0x12')](0x0,_0x3060ea[_0xb0f7('0x13')](_0x233f59));}switch(_0x3a4246['zone']){case'US':_0x223578=_0xb0f7('0x14');break;case'AU':_0x223578=_0xb0f7('0x15');break;case'IN':_0x223578=_0xb0f7('0x16');break;case'CN':_0x223578='https://accounts.zoho.com.cn';break;default:_0x223578=_0xb0f7('0x17');break;}var _0x4ac3c0={'method':_0xb0f7('0x18'),'uri':_0x223578+'/oauth/v2/token','form':{'grant_type':_0xb0f7('0x19'),'client_id':_0x3a4246[_0xb0f7('0xd')],'client_secret':_0x3a4246[_0xb0f7('0xe')],'redirect_uri':_0x3a4246['serverUrl'],'code':_0x3a4246[_0xb0f7('0xf')]},'headers':{'Content-Type':_0xb0f7('0x1a')}};return rp(_0x4ac3c0)['then'](function(_0x59da15){var _0x269500=JSON[_0xb0f7('0x1b')](_0x59da15);if(_0x269500['refresh_token']){_0x3a4246[_0xb0f7('0x1c')]=_0x269500['refresh_token'];logger[_0xb0f7('0x1d')](util[_0xb0f7('0x1e')](_0xb0f7('0x1f'),_0x3a4246['name'],_0x3a4246['id']));}else{logger[_0xb0f7('0x20')](util[_0xb0f7('0x1e')](_0xb0f7('0x21'),_0x3a4246[_0xb0f7('0x22')],_0x3a4246['id']),util['inspect'](_0x269500,{'showHidden':![],'depth':null}));}return _0x515c34(null,_0x482f25);})[_0xb0f7('0x23')](function(_0xc6235b){logger['error'](util[_0xb0f7('0x1e')](_0xb0f7('0x21'),_0x3a4246[_0xb0f7('0x22')],_0x3a4246['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x515c34(_0xc6235b);});}else{return _0x515c34(null,_0x482f25);}},'beforeUpdate':function(_0x4233b4,_0x755164,_0x5690e0){if(_0x4233b4[_0xb0f7('0xb')]('zone')||_0x4233b4[_0xb0f7('0xb')]('serverUrl')||_0x4233b4[_0xb0f7('0xb')](_0xb0f7('0xd'))||_0x4233b4['changed'](_0xb0f7('0xe'))||_0x4233b4['changed'](_0xb0f7('0xf'))||_0x4233b4[_0xb0f7('0xb')]('host')){var _0x10a9f0,_0x14270f;_0x10a9f0=_0x4233b4['serverUrl'];var _0x5a65e6=_0x10a9f0[_0xb0f7('0x11')](-0x1);if(_0x5a65e6==='/'||_0x5a65e6==='\x5c'||_0x5a65e6===':'){_0x10a9f0=_0x10a9f0['substring'](0x0,_0x10a9f0[_0xb0f7('0x13')](_0x5a65e6));}switch(_0x4233b4[_0xb0f7('0x24')]){case'US':_0x14270f=_0xb0f7('0x14');break;case'AU':_0x14270f=_0xb0f7('0x15');break;case'IN':_0x14270f=_0xb0f7('0x16');break;case'CN':_0x14270f=_0xb0f7('0x25');break;default:_0x14270f='https://accounts.zoho.eu';break;}var _0x5da5a3={'method':_0xb0f7('0x18'),'uri':_0x14270f+'/oauth/v2/token','form':{'grant_type':_0xb0f7('0x19'),'client_id':_0x4233b4[_0xb0f7('0xd')],'client_secret':_0x4233b4[_0xb0f7('0xe')],'redirect_uri':_0x4233b4['serverUrl'],'code':_0x4233b4[_0xb0f7('0xf')]},'headers':{'Content-Type':_0xb0f7('0x1a')}};return rp(_0x5da5a3)[_0xb0f7('0x26')](function(_0x454289){var _0x3a7ac9=JSON['parse'](_0x454289);if(_0x3a7ac9['refresh_token']){_0x4233b4['refreshToken']=_0x3a7ac9[_0xb0f7('0x27')];logger[_0xb0f7('0x1d')](util['format']('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x4233b4[_0xb0f7('0x22')],_0x4233b4['id']));}else{logger[_0xb0f7('0x20')](util['format'](_0xb0f7('0x21'),_0x4233b4['name'],_0x4233b4['id']),util[_0xb0f7('0x28')](_0x3a7ac9,{'showHidden':![],'depth':null}));}return _0x5690e0(null,_0x755164);})[_0xb0f7('0x23')](function(_0x4c2e48){logger[_0xb0f7('0x20')](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x4233b4['name'],_0x4233b4['id']),util[_0xb0f7('0x28')](parsedResult,{'showHidden':![],'depth':null}));return _0x5690e0(_0x4c2e48);});}else{return _0x5690e0(null,_0x755164);}}}});}; \ No newline at end of file +var _0x1abd=['int_zoho_accounts','changed','serverUrl','code','host','lastIndexOf','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','clientId','clientSecret','application/x-www-form-urlencoded','then','parse','refresh_token','info','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','format','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','substring','refreshToken','catch','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount'];(function(_0x5756c6,_0x58290a){var _0x4b5806=function(_0x193246){while(--_0x193246){_0x5756c6['push'](_0x5756c6['shift']());}};_0x4b5806(++_0x58290a);}(_0x1abd,0x1e0));var _0xd1ab=function(_0x1a5852,_0x21f861){_0x1a5852=_0x1a5852-0x0;var _0x4080ca=_0x1abd[_0x1a5852];return _0x4080ca;};'use strict';var _=require(_0xd1ab('0x0'));var util=require(_0xd1ab('0x1'));var logger=require(_0xd1ab('0x2'))(_0xd1ab('0x3'));var moment=require(_0xd1ab('0x4'));var BPromise=require(_0xd1ab('0x5'));var rp=require(_0xd1ab('0x6'));var fs=require('fs');var path=require(_0xd1ab('0x7'));var rimraf=require(_0xd1ab('0x8'));var config=require(_0xd1ab('0x9'));var attributes=require(_0xd1ab('0xa'));var integrations=require(_0xd1ab('0xb'));module[_0xd1ab('0xc')]=function(_0x93fa2,_0x3c6c42){return _0x93fa2[_0xd1ab('0xd')](_0xd1ab('0xe'),attributes,{'tableName':_0xd1ab('0xf'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x155d8a,_0x1359f5,_0x27d59a){if(_0x155d8a[_0xd1ab('0x10')]('zone')||_0x155d8a['changed'](_0xd1ab('0x11'))||_0x155d8a[_0xd1ab('0x10')]('clientId')||_0x155d8a[_0xd1ab('0x10')]('clientSecret')||_0x155d8a['changed'](_0xd1ab('0x12'))||_0x155d8a[_0xd1ab('0x10')](_0xd1ab('0x13'))){var _0x51d892,_0x409aad;_0x51d892=_0x155d8a['serverUrl'];var _0x516d22=_0x51d892['slice'](-0x1);if(_0x516d22==='/'||_0x516d22==='\x5c'||_0x516d22===':'){_0x51d892=_0x51d892['substring'](0x0,_0x51d892[_0xd1ab('0x14')](_0x516d22));}switch(_0x155d8a[_0xd1ab('0x15')]){case'US':_0x409aad=_0xd1ab('0x16');break;case'AU':_0x409aad=_0xd1ab('0x17');break;case'IN':_0x409aad=_0xd1ab('0x18');break;case'CN':_0x409aad='https://accounts.zoho.com.cn';break;default:_0x409aad=_0xd1ab('0x19');break;}var _0x5d42d4={'method':_0xd1ab('0x1a'),'uri':_0x409aad+_0xd1ab('0x1b'),'form':{'grant_type':_0xd1ab('0x1c'),'client_id':_0x155d8a[_0xd1ab('0x1d')],'client_secret':_0x155d8a[_0xd1ab('0x1e')],'redirect_uri':_0x155d8a[_0xd1ab('0x11')],'code':_0x155d8a[_0xd1ab('0x12')]},'headers':{'Content-Type':_0xd1ab('0x1f')}};return rp(_0x5d42d4)[_0xd1ab('0x20')](function(_0x11daa5){var _0x5d1f6e=JSON[_0xd1ab('0x21')](_0x11daa5);if(_0x5d1f6e[_0xd1ab('0x22')]){_0x155d8a['refreshToken']=_0x5d1f6e[_0xd1ab('0x22')];logger[_0xd1ab('0x23')](util['format'](_0xd1ab('0x24'),_0x155d8a[_0xd1ab('0x25')],_0x155d8a['id']));}else{logger[_0xd1ab('0x26')](util[_0xd1ab('0x27')](_0xd1ab('0x28'),_0x155d8a['name'],_0x155d8a['id']),util[_0xd1ab('0x29')](_0x5d1f6e,{'showHidden':![],'depth':null}));}return _0x27d59a(null,_0x1359f5);})['catch'](function(_0x436aed){logger[_0xd1ab('0x26')](util['format'](_0xd1ab('0x28'),_0x155d8a[_0xd1ab('0x25')],_0x155d8a['id']),util[_0xd1ab('0x29')](parsedResult,{'showHidden':![],'depth':null}));return _0x27d59a(_0x436aed);});}else{return _0x27d59a(null,_0x1359f5);}},'beforeUpdate':function(_0x1c5fcd,_0x7f48ac,_0xf70b64){if(_0x1c5fcd[_0xd1ab('0x10')](_0xd1ab('0x15'))||_0x1c5fcd['changed'](_0xd1ab('0x11'))||_0x1c5fcd[_0xd1ab('0x10')]('clientId')||_0x1c5fcd[_0xd1ab('0x10')]('clientSecret')||_0x1c5fcd['changed'](_0xd1ab('0x12'))||_0x1c5fcd[_0xd1ab('0x10')](_0xd1ab('0x13'))){var _0x45ebce,_0x2d7bf6;_0x45ebce=_0x1c5fcd[_0xd1ab('0x11')];var _0x33d3f9=_0x45ebce['slice'](-0x1);if(_0x33d3f9==='/'||_0x33d3f9==='\x5c'||_0x33d3f9===':'){_0x45ebce=_0x45ebce[_0xd1ab('0x2a')](0x0,_0x45ebce[_0xd1ab('0x14')](_0x33d3f9));}switch(_0x1c5fcd[_0xd1ab('0x15')]){case'US':_0x2d7bf6=_0xd1ab('0x16');break;case'AU':_0x2d7bf6=_0xd1ab('0x17');break;case'IN':_0x2d7bf6=_0xd1ab('0x18');break;case'CN':_0x2d7bf6='https://accounts.zoho.com.cn';break;default:_0x2d7bf6='https://accounts.zoho.eu';break;}var _0x3b40d5={'method':_0xd1ab('0x1a'),'uri':_0x2d7bf6+_0xd1ab('0x1b'),'form':{'grant_type':_0xd1ab('0x1c'),'client_id':_0x1c5fcd[_0xd1ab('0x1d')],'client_secret':_0x1c5fcd[_0xd1ab('0x1e')],'redirect_uri':_0x1c5fcd[_0xd1ab('0x11')],'code':_0x1c5fcd['code']},'headers':{'Content-Type':_0xd1ab('0x1f')}};return rp(_0x3b40d5)[_0xd1ab('0x20')](function(_0x4d47b9){var _0x3e4b96=JSON[_0xd1ab('0x21')](_0x4d47b9);if(_0x3e4b96['refresh_token']){_0x1c5fcd[_0xd1ab('0x2b')]=_0x3e4b96['refresh_token'];logger[_0xd1ab('0x23')](util['format'](_0xd1ab('0x24'),_0x1c5fcd[_0xd1ab('0x25')],_0x1c5fcd['id']));}else{logger[_0xd1ab('0x26')](util[_0xd1ab('0x27')](_0xd1ab('0x28'),_0x1c5fcd[_0xd1ab('0x25')],_0x1c5fcd['id']),util[_0xd1ab('0x29')](_0x3e4b96,{'showHidden':![],'depth':null}));}return _0xf70b64(null,_0x7f48ac);})[_0xd1ab('0x2c')](function(_0x2a6950){logger[_0xd1ab('0x26')](util['format'](_0xd1ab('0x28'),_0x1c5fcd[_0xd1ab('0x25')],_0x1c5fcd['id']),util[_0xd1ab('0x29')](parsedResult,{'showHidden':![],'depth':null}));return _0xf70b64(_0x2a6950);});}else{return _0xf70b64(null,_0x7f48ac);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 040d469..ee70486 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 _0xedf1=['attributes','limit','include','map','model','catch','ShowZohoAccount','find','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','GetZohoAccount','findAll','options','raw','where'];(function(_0xeb80c9,_0x3fe888){var _0x259c37=function(_0x49478c){while(--_0x49478c){_0xeb80c9['push'](_0xeb80c9['shift']());}};_0x259c37(++_0x3fe888);}(_0xedf1,0xb2));var _0x1edf=function(_0x3ff3b8,_0xdcb1cd){_0x3ff3b8=_0x3ff3b8-0x0;var _0x3350c1=_0xedf1[_0x3ff3b8];return _0x3350c1;};'use strict';var _=require(_0x1edf('0x0'));var util=require(_0x1edf('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1edf('0x2'));var fs=require('fs');var Redis=require(_0x1edf('0x3'));var db=require(_0x1edf('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1edf('0x5'))(_0x1edf('0x6'));var config=require(_0x1edf('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1edf('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1615b2,_0x1029fe,_0x20b629){return new BPromise(function(_0x12293b,_0x206f63){return client[_0x1edf('0x9')](_0x1615b2,_0x20b629)[_0x1edf('0xa')](function(_0x30a13f){logger['info'](_0x1edf('0xb'),_0x1029fe,_0x1edf('0xc'));logger[_0x1edf('0xd')](_0x1edf('0xe'),_0x1029fe,'request\x20sent',JSON[_0x1edf('0xf')](_0x30a13f));if(_0x30a13f['error']){if(_0x30a13f[_0x1edf('0x10')][_0x1edf('0x11')]===0x1f4){logger[_0x1edf('0x10')](_0x1edf('0xb'),_0x1029fe,_0x30a13f[_0x1edf('0x10')][_0x1edf('0x12')]);return _0x206f63(_0x30a13f[_0x1edf('0x10')][_0x1edf('0x12')]);}logger[_0x1edf('0x10')]('ZohoAccount,\x20%s,\x20%s',_0x1029fe,_0x30a13f[_0x1edf('0x10')][_0x1edf('0x12')]);return _0x12293b(_0x30a13f['error'][_0x1edf('0x12')]);}else{logger[_0x1edf('0x13')](_0x1edf('0xb'),_0x1029fe,_0x1edf('0xc'));_0x12293b(_0x30a13f[_0x1edf('0x14')][_0x1edf('0x12')]);}})['catch'](function(_0x4f2584){logger[_0x1edf('0x10')](_0x1edf('0xb'),_0x1029fe,_0x4f2584);_0x206f63(_0x4f2584);});});}exports[_0x1edf('0x15')]=function(_0x280c4c){var _0x4bf06=this;return new Promise(function(_0x5e2c1c,_0x2daf2f){return db['ZohoAccount'][_0x1edf('0x16')]({'raw':_0x280c4c[_0x1edf('0x17')]?_0x280c4c[_0x1edf('0x17')][_0x1edf('0x18')]===undefined?!![]:![]:!![],'where':_0x280c4c[_0x1edf('0x17')]?_0x280c4c[_0x1edf('0x17')][_0x1edf('0x19')]||null:null,'attributes':_0x280c4c[_0x1edf('0x17')]?_0x280c4c[_0x1edf('0x17')][_0x1edf('0x1a')]||null:null,'limit':_0x280c4c[_0x1edf('0x17')]?_0x280c4c[_0x1edf('0x17')][_0x1edf('0x1b')]||null:null,'include':_0x280c4c['options']?_0x280c4c[_0x1edf('0x17')][_0x1edf('0x1c')]?_[_0x1edf('0x1d')](_0x280c4c['options'][_0x1edf('0x1c')],function(_0x44e7de){return{'model':db[_0x44e7de[_0x1edf('0x1e')]],'as':_0x44e7de['as'],'attributes':_0x44e7de[_0x1edf('0x1a')],'include':_0x44e7de[_0x1edf('0x1c')]?_[_0x1edf('0x1d')](_0x44e7de[_0x1edf('0x1c')],function(_0x2865ca){return{'model':db[_0x2865ca[_0x1edf('0x1e')]],'as':_0x2865ca['as'],'attributes':_0x2865ca[_0x1edf('0x1a')],'include':_0x2865ca[_0x1edf('0x1c')]?_[_0x1edf('0x1d')](_0x2865ca[_0x1edf('0x1c')],function(_0x532e36){return{'model':db[_0x532e36['model']],'as':_0x532e36['as'],'attributes':_0x532e36[_0x1edf('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x1edf('0xa')](function(_0xd8bb8c){logger[_0x1edf('0x13')](_0x1edf('0x15'),_0x280c4c);logger[_0x1edf('0xd')](_0x1edf('0x15'),_0x280c4c,JSON[_0x1edf('0xf')](_0xd8bb8c));_0x5e2c1c(_0xd8bb8c);})[_0x1edf('0x1f')](function(_0x184d70){logger[_0x1edf('0x10')](_0x1edf('0x15'),_0x184d70[_0x1edf('0x12')],_0x280c4c);_0x2daf2f(_0x4bf06[_0x1edf('0x10')](0x1f4,_0x184d70['message']));});});};exports[_0x1edf('0x20')]=function(_0x4f7a50){var _0x942631=this;return new Promise(function(_0x2c5dec,_0x3e13c9){return db['ZohoAccount'][_0x1edf('0x21')]({'raw':_0x4f7a50['options']?_0x4f7a50[_0x1edf('0x17')][_0x1edf('0x18')]===undefined?!![]:![]:!![],'where':_0x4f7a50['options']?_0x4f7a50[_0x1edf('0x17')][_0x1edf('0x19')]||null:null,'attributes':_0x4f7a50[_0x1edf('0x17')]?_0x4f7a50[_0x1edf('0x17')][_0x1edf('0x1a')]||null:null,'include':_0x4f7a50[_0x1edf('0x17')]?_0x4f7a50[_0x1edf('0x17')][_0x1edf('0x1c')]?_[_0x1edf('0x1d')](_0x4f7a50[_0x1edf('0x17')][_0x1edf('0x1c')],function(_0x49cabe){return{'model':db[_0x49cabe[_0x1edf('0x1e')]],'as':_0x49cabe['as'],'attributes':_0x49cabe[_0x1edf('0x1a')],'include':_0x49cabe[_0x1edf('0x1c')]?_[_0x1edf('0x1d')](_0x49cabe[_0x1edf('0x1c')],function(_0x1115ad){return{'model':db[_0x1115ad[_0x1edf('0x1e')]],'as':_0x1115ad['as'],'attributes':_0x1115ad[_0x1edf('0x1a')],'include':_0x1115ad[_0x1edf('0x1c')]?_[_0x1edf('0x1d')](_0x1115ad[_0x1edf('0x1c')],function(_0x2be392){return{'model':db[_0x2be392['model']],'as':_0x2be392['as'],'attributes':_0x2be392[_0x1edf('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x1edf('0xa')](function(_0x4cd819){logger['info'](_0x1edf('0x20'),_0x4f7a50);logger[_0x1edf('0xd')](_0x1edf('0x20'),_0x4f7a50,JSON[_0x1edf('0xf')](_0x4cd819));_0x2c5dec(_0x4cd819);})[_0x1edf('0x1f')](function(_0x4243cb){logger[_0x1edf('0x10')]('ShowZohoAccount',_0x4243cb[_0x1edf('0x12')],_0x4f7a50);_0x3e13c9(_0x942631[_0x1edf('0x10')](0x1f4,_0x4243cb[_0x1edf('0x12')]));});});}; \ No newline at end of file +var _0xb8a0=['attributes','limit','map','include','model','ShowZohoAccount','find','moment','bluebird','ioredis','../../config/environment','jayson/promise','client','http','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetZohoAccount','ZohoAccount','findAll','options','raw','where'];(function(_0x213c09,_0x333273){var _0x45bbfd=function(_0x4aa9f8){while(--_0x4aa9f8){_0x213c09['push'](_0x213c09['shift']());}};_0x45bbfd(++_0x333273);}(_0xb8a0,0x1d5));var _0x0b8a=function(_0x1835e1,_0xbbf196){_0x1835e1=_0x1835e1-0x0;var _0x154df1=_0xb8a0[_0x1835e1];return _0x154df1;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0b8a('0x0'));var BPromise=require(_0x0b8a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0b8a('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x0b8a('0x3'));var jayson=require(_0x0b8a('0x4'));var client=jayson[_0x0b8a('0x5')][_0x0b8a('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x3527dd,_0x4039c2,_0x33a5bd){return new BPromise(function(_0x463015,_0x29ebdc){return client[_0x0b8a('0x7')](_0x3527dd,_0x33a5bd)[_0x0b8a('0x8')](function(_0x478492){logger[_0x0b8a('0x9')](_0x0b8a('0xa'),_0x4039c2,_0x0b8a('0xb'));logger[_0x0b8a('0xc')](_0x0b8a('0xd'),_0x4039c2,_0x0b8a('0xb'),JSON[_0x0b8a('0xe')](_0x478492));if(_0x478492[_0x0b8a('0xf')]){if(_0x478492[_0x0b8a('0xf')][_0x0b8a('0x10')]===0x1f4){logger['error'](_0x0b8a('0xa'),_0x4039c2,_0x478492[_0x0b8a('0xf')][_0x0b8a('0x11')]);return _0x29ebdc(_0x478492[_0x0b8a('0xf')][_0x0b8a('0x11')]);}logger[_0x0b8a('0xf')](_0x0b8a('0xa'),_0x4039c2,_0x478492[_0x0b8a('0xf')][_0x0b8a('0x11')]);return _0x463015(_0x478492['error'][_0x0b8a('0x11')]);}else{logger[_0x0b8a('0x9')](_0x0b8a('0xa'),_0x4039c2,'request\x20sent');_0x463015(_0x478492[_0x0b8a('0x12')][_0x0b8a('0x11')]);}})[_0x0b8a('0x13')](function(_0x5a2623){logger['error']('ZohoAccount,\x20%s,\x20%s',_0x4039c2,_0x5a2623);_0x29ebdc(_0x5a2623);});});}exports[_0x0b8a('0x14')]=function(_0x51d28e){var _0x1a1d6b=this;return new Promise(function(_0x3c80c3,_0x12428e){return db[_0x0b8a('0x15')][_0x0b8a('0x16')]({'raw':_0x51d28e[_0x0b8a('0x17')]?_0x51d28e[_0x0b8a('0x17')][_0x0b8a('0x18')]===undefined?!![]:![]:!![],'where':_0x51d28e[_0x0b8a('0x17')]?_0x51d28e[_0x0b8a('0x17')][_0x0b8a('0x19')]||null:null,'attributes':_0x51d28e['options']?_0x51d28e[_0x0b8a('0x17')][_0x0b8a('0x1a')]||null:null,'limit':_0x51d28e['options']?_0x51d28e[_0x0b8a('0x17')][_0x0b8a('0x1b')]||null:null,'include':_0x51d28e[_0x0b8a('0x17')]?_0x51d28e[_0x0b8a('0x17')]['include']?_[_0x0b8a('0x1c')](_0x51d28e['options'][_0x0b8a('0x1d')],function(_0x29dbf3){return{'model':db[_0x29dbf3['model']],'as':_0x29dbf3['as'],'attributes':_0x29dbf3[_0x0b8a('0x1a')],'include':_0x29dbf3[_0x0b8a('0x1d')]?_[_0x0b8a('0x1c')](_0x29dbf3['include'],function(_0x65f12b){return{'model':db[_0x65f12b[_0x0b8a('0x1e')]],'as':_0x65f12b['as'],'attributes':_0x65f12b[_0x0b8a('0x1a')],'include':_0x65f12b['include']?_[_0x0b8a('0x1c')](_0x65f12b['include'],function(_0x1ed000){return{'model':db[_0x1ed000[_0x0b8a('0x1e')]],'as':_0x1ed000['as'],'attributes':_0x1ed000[_0x0b8a('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x0b8a('0x8')](function(_0x32670f){logger[_0x0b8a('0x9')](_0x0b8a('0x14'),_0x51d28e);logger[_0x0b8a('0xc')](_0x0b8a('0x14'),_0x51d28e,JSON[_0x0b8a('0xe')](_0x32670f));_0x3c80c3(_0x32670f);})[_0x0b8a('0x13')](function(_0x20b16d){logger['error'](_0x0b8a('0x14'),_0x20b16d[_0x0b8a('0x11')],_0x51d28e);_0x12428e(_0x1a1d6b[_0x0b8a('0xf')](0x1f4,_0x20b16d[_0x0b8a('0x11')]));});});};exports[_0x0b8a('0x1f')]=function(_0x59f54d){var _0x2e9d5b=this;return new Promise(function(_0x4690b6,_0x4f98dd){return db[_0x0b8a('0x15')][_0x0b8a('0x20')]({'raw':_0x59f54d[_0x0b8a('0x17')]?_0x59f54d[_0x0b8a('0x17')][_0x0b8a('0x18')]===undefined?!![]:![]:!![],'where':_0x59f54d['options']?_0x59f54d[_0x0b8a('0x17')][_0x0b8a('0x19')]||null:null,'attributes':_0x59f54d[_0x0b8a('0x17')]?_0x59f54d[_0x0b8a('0x17')][_0x0b8a('0x1a')]||null:null,'include':_0x59f54d['options']?_0x59f54d[_0x0b8a('0x17')][_0x0b8a('0x1d')]?_['map'](_0x59f54d[_0x0b8a('0x17')][_0x0b8a('0x1d')],function(_0x3745a5){return{'model':db[_0x3745a5[_0x0b8a('0x1e')]],'as':_0x3745a5['as'],'attributes':_0x3745a5['attributes'],'include':_0x3745a5[_0x0b8a('0x1d')]?_[_0x0b8a('0x1c')](_0x3745a5['include'],function(_0x575e08){return{'model':db[_0x575e08[_0x0b8a('0x1e')]],'as':_0x575e08['as'],'attributes':_0x575e08[_0x0b8a('0x1a')],'include':_0x575e08[_0x0b8a('0x1d')]?_[_0x0b8a('0x1c')](_0x575e08['include'],function(_0xfb54ed){return{'model':db[_0xfb54ed[_0x0b8a('0x1e')]],'as':_0xfb54ed['as'],'attributes':_0xfb54ed[_0x0b8a('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x155e18){logger[_0x0b8a('0x9')](_0x0b8a('0x1f'),_0x59f54d);logger[_0x0b8a('0xc')](_0x0b8a('0x1f'),_0x59f54d,JSON[_0x0b8a('0xe')](_0x155e18));_0x4690b6(_0x155e18);})[_0x0b8a('0x13')](function(_0x2d01c0){logger[_0x0b8a('0xf')](_0x0b8a('0x1f'),_0x2d01c0['message'],_0x59f54d);_0x4f98dd(_0x2e9d5b[_0x0b8a('0xf')](0x1f4,_0x2d01c0[_0x0b8a('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index f73b9fc..e2e4e87 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 _0xd89f=['get','isAuthenticated','index','/:id','show','/:id/fields','/:id/descriptions','getDescriptions','post','create','put','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller'];(function(_0x34becf,_0x6dc485){var _0x1a41ee=function(_0x368907){while(--_0x368907){_0x34becf['push'](_0x34becf['shift']());}};_0x1a41ee(++_0x6dc485);}(_0xd89f,0x182));var _0xfd89=function(_0x47dbde,_0x467090){_0x47dbde=_0x47dbde-0x0;var _0x5eb3b4=_0xd89f[_0x47dbde];return _0x5eb3b4;};'use strict';var multer=require(_0xfd89('0x0'));var util=require(_0xfd89('0x1'));var path=require(_0xfd89('0x2'));var timeout=require(_0xfd89('0x3'));var express=require(_0xfd89('0x4'));var router=express[_0xfd89('0x5')]();var fs_extra=require(_0xfd89('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xfd89('0x7'));var config=require(_0xfd89('0x8'));var controller=require(_0xfd89('0x9'));router[_0xfd89('0xa')]('/',auth[_0xfd89('0xb')](),controller[_0xfd89('0xc')]);router[_0xfd89('0xa')](_0xfd89('0xd'),auth[_0xfd89('0xb')](),controller[_0xfd89('0xe')]);router[_0xfd89('0xa')](_0xfd89('0xf'),auth[_0xfd89('0xb')](),controller['getFields']);router[_0xfd89('0xa')]('/:id/subjects',auth[_0xfd89('0xb')](),controller['getSubjects']);router[_0xfd89('0xa')](_0xfd89('0x10'),auth[_0xfd89('0xb')](),controller[_0xfd89('0x11')]);router[_0xfd89('0x12')]('/',auth[_0xfd89('0xb')](),controller[_0xfd89('0x13')]);router[_0xfd89('0x14')]('/:id',auth[_0xfd89('0xb')](),controller['update']);router['delete'](_0xfd89('0xd'),auth[_0xfd89('0xb')](),controller['destroy']);module[_0xfd89('0x15')]=router; \ No newline at end of file +var _0x38d5=['../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/:id','show','get','/:id/fields','getFields','/:id/subjects','post','create','put','update','delete','destroy','multer','path','express','Router','fs-extra'];(function(_0x5df2ff,_0x48300e){var _0x594f25=function(_0x1f5788){while(--_0x1f5788){_0x5df2ff['push'](_0x5df2ff['shift']());}};_0x594f25(++_0x48300e);}(_0x38d5,0x12f));var _0x538d=function(_0x2f71d1,_0x588b00){_0x2f71d1=_0x2f71d1-0x0;var _0x268a3e=_0x38d5[_0x2f71d1];return _0x268a3e;};'use strict';var multer=require(_0x538d('0x0'));var util=require('util');var path=require(_0x538d('0x1'));var timeout=require('connect-timeout');var express=require(_0x538d('0x2'));var router=express[_0x538d('0x3')]();var fs_extra=require(_0x538d('0x4'));var auth=require(_0x538d('0x5'));var interaction=require(_0x538d('0x6'));var config=require(_0x538d('0x7'));var controller=require('./intZohoConfiguration.controller');router['get']('/',auth[_0x538d('0x8')](),controller[_0x538d('0x9')]);router['get'](_0x538d('0xa'),auth[_0x538d('0x8')](),controller[_0x538d('0xb')]);router[_0x538d('0xc')](_0x538d('0xd'),auth[_0x538d('0x8')](),controller[_0x538d('0xe')]);router[_0x538d('0xc')](_0x538d('0xf'),auth['isAuthenticated'](),controller['getSubjects']);router['get']('/:id/descriptions',auth['isAuthenticated'](),controller['getDescriptions']);router[_0x538d('0x10')]('/',auth['isAuthenticated'](),controller[_0x538d('0x11')]);router[_0x538d('0x12')](_0x538d('0xa'),auth[_0x538d('0x8')](),controller[_0x538d('0x13')]);router[_0x538d('0x14')](_0x538d('0xa'),auth[_0x538d('0x8')](),controller[_0x538d('0x15')]);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 9c93b1b..9572f04 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 _0x6087=['ENUM','lead','contact','nothing','contact_lead','sequelize','STRING'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x6087,0x1cc));var _0x7608=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x6087[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0x7608('0x0'));module['exports']={'name':{'type':Sequelize[_0x7608('0x1')]},'moduleCreate':{'type':Sequelize[_0x7608('0x2')](_0x7608('0x3'),_0x7608('0x4'),_0x7608('0x5')),'defaultValue':_0x7608('0x3')},'moduleSearch':{'type':Sequelize[_0x7608('0x2')]('contact_lead',_0x7608('0x4'),_0x7608('0x3')),'defaultValue':_0x7608('0x6')},'description':{'type':Sequelize[_0x7608('0x1')]}}; \ No newline at end of file +var _0xd05f=['nothing','contact_lead','sequelize','exports','STRING','ENUM','lead','contact'];(function(_0x30d5d8,_0x1127e9){var _0x4061a3=function(_0x3a9909){while(--_0x3a9909){_0x30d5d8['push'](_0x30d5d8['shift']());}};_0x4061a3(++_0x1127e9);}(_0xd05f,0x102));var _0xfd05=function(_0x5f9d5e,_0x3d4699){_0x5f9d5e=_0x5f9d5e-0x0;var _0x3a4e8b=_0xd05f[_0x5f9d5e];return _0x3a4e8b;};'use strict';var Sequelize=require(_0xfd05('0x0'));module[_0xfd05('0x1')]={'name':{'type':Sequelize[_0xfd05('0x2')]},'moduleCreate':{'type':Sequelize[_0xfd05('0x3')](_0xfd05('0x4'),_0xfd05('0x5'),_0xfd05('0x6')),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize[_0xfd05('0x3')]('contact_lead',_0xfd05('0x5'),_0xfd05('0x4')),'defaultValue':_0xfd05('0x7')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 9d4c579..74a173e 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 _0x0c5b=['ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../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','index','map','ZohoConfiguration','rawAttributes','key','model','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','catch','params','filters','fields','include','find','create','body','sort','getFields','getSubjects','findOne','ZohoField','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x5a79e2,_0x319b1a){var _0x266c45=function(_0x172478){while(--_0x172478){_0x5a79e2['push'](_0x5a79e2['shift']());}};_0x266c45(++_0x319b1a);}(_0x0c5b,0xe0));var _0xb0c5=function(_0x55d1fd,_0x2b37ae){_0x55d1fd=_0x55d1fd-0x0;var _0x259777=_0x0c5b[_0x55d1fd];return _0x259777;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb0c5('0x0'));var zipdir=require(_0xb0c5('0x1'));var jsonpatch=require(_0xb0c5('0x2'));var rp=require(_0xb0c5('0x3'));var moment=require('moment');var BPromise=require(_0xb0c5('0x4'));var Mustache=require(_0xb0c5('0x5'));var util=require(_0xb0c5('0x6'));var path=require(_0xb0c5('0x7'));var sox=require('sox');var csv=require(_0xb0c5('0x8'));var ejs=require(_0xb0c5('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb0c5('0xa'));var squel=require('squel');var crypto=require(_0xb0c5('0xb'));var jsforce=require(_0xb0c5('0xc'));var deskjs=require(_0xb0c5('0xd'));var toCsv=require(_0xb0c5('0x8'));var querystring=require(_0xb0c5('0xe'));var Papa=require(_0xb0c5('0xf'));var Redis=require(_0xb0c5('0x10'));var authService=require(_0xb0c5('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb0c5('0x12'))(_0xb0c5('0x13'));var utils=require(_0xb0c5('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xb0c5('0x15'));var db=require(_0xb0c5('0x16'))['db'];function respondWithStatusCode(_0x549023,_0x1d368f){_0x1d368f=_0x1d368f||0xcc;return function(_0x4e3f25){if(_0x4e3f25){return _0x549023[_0xb0c5('0x17')](_0x1d368f);}return _0x549023[_0xb0c5('0x18')](_0x1d368f)[_0xb0c5('0x19')]();};}function respondWithResult(_0x7ef3c9,_0x1cb1a6){_0x1cb1a6=_0x1cb1a6||0xc8;return function(_0x481cfd){if(_0x481cfd){return _0x7ef3c9[_0xb0c5('0x18')](_0x1cb1a6)[_0xb0c5('0x1a')](_0x481cfd);}};}function respondWithFilteredResult(_0x259927,_0x3ec872){return function(_0x375cb9){if(_0x375cb9){var _0x26b1e6=typeof _0x3ec872[_0xb0c5('0x1b')]===_0xb0c5('0x1c')&&typeof _0x3ec872[_0xb0c5('0x1d')]===_0xb0c5('0x1c');var _0x56212e=_0x375cb9[_0xb0c5('0x1e')];var _0x525483=_0x26b1e6?0x0:_0x3ec872['offset'];var _0x207cd9=_0x26b1e6?_0x375cb9[_0xb0c5('0x1e')]:_0x3ec872[_0xb0c5('0x1b')]+_0x3ec872[_0xb0c5('0x1d')];var _0x2b7c55;if(_0x207cd9>=_0x56212e){_0x207cd9=_0x56212e;_0x2b7c55=0xc8;}else{_0x2b7c55=0xce;}_0x259927[_0xb0c5('0x18')](_0x2b7c55);return _0x259927[_0xb0c5('0x1f')](_0xb0c5('0x20'),_0x525483+'-'+_0x207cd9+'/'+_0x56212e)[_0xb0c5('0x1a')](_0x375cb9);}return null;};}function patchUpdates(_0x5a2bb9){return function(_0x166cf6){try{jsonpatch[_0xb0c5('0x21')](_0x166cf6,_0x5a2bb9,!![]);}catch(_0x51aad7){return BPromise[_0xb0c5('0x22')](_0x51aad7);}return _0x166cf6[_0xb0c5('0x23')]();};}function saveUpdates(_0x607d21,_0x3dea1d){return function(_0x50745b){if(_0x50745b){return _0x50745b[_0xb0c5('0x24')](_0x607d21)[_0xb0c5('0x25')](function(_0x3ec4ea){return _0x3ec4ea;});}return null;};}function removeEntity(_0x39c299,_0x8b01b2){return function(_0x15469c){if(_0x15469c){return _0x15469c[_0xb0c5('0x26')]()[_0xb0c5('0x25')](function(){_0x39c299[_0xb0c5('0x18')](0xcc)[_0xb0c5('0x19')]();});}};}function handleEntityNotFound(_0x1a2cf9,_0x292fc2){return function(_0x1bd99a){if(!_0x1bd99a){_0x1a2cf9[_0xb0c5('0x17')](0x194);}return _0x1bd99a;};}function handleError(_0x53dba2,_0x3438d2){_0x3438d2=_0x3438d2||0x1f4;return function(_0x25b7e4){logger[_0xb0c5('0x27')](_0x25b7e4[_0xb0c5('0x28')]);if(_0x25b7e4['name']){delete _0x25b7e4[_0xb0c5('0x29')];}_0x53dba2[_0xb0c5('0x18')](_0x3438d2)[_0xb0c5('0x2a')](_0x25b7e4);};}exports[_0xb0c5('0x2b')]=function(_0x3978a5,_0x302deb){var _0x34ffb2={},_0x46072d={},_0x135947={'count':0x0,'rows':[]};var _0x1d7e20=_[_0xb0c5('0x2c')](db[_0xb0c5('0x2d')][_0xb0c5('0x2e')],function(_0x4bc114){return{'name':_0x4bc114['fieldName'],'type':_0x4bc114['type'][_0xb0c5('0x2f')]};});_0x46072d[_0xb0c5('0x30')]=_[_0xb0c5('0x2c')](_0x1d7e20,_0xb0c5('0x29'));_0x46072d[_0xb0c5('0x31')]=_[_0xb0c5('0x32')](_0x3978a5[_0xb0c5('0x31')]);_0x46072d['filters']=_[_0xb0c5('0x33')](_0x46072d['model'],_0x46072d[_0xb0c5('0x31')]);_0x34ffb2[_0xb0c5('0x34')]=_[_0xb0c5('0x33')](_0x46072d[_0xb0c5('0x30')],qs['fields'](_0x3978a5[_0xb0c5('0x31')]['fields']));_0x34ffb2[_0xb0c5('0x34')]=_0x34ffb2[_0xb0c5('0x34')][_0xb0c5('0x35')]?_0x34ffb2[_0xb0c5('0x34')]:_0x46072d[_0xb0c5('0x30')];if(!_0x3978a5[_0xb0c5('0x31')][_0xb0c5('0x36')](_0xb0c5('0x37'))){_0x34ffb2['limit']=qs['limit'](_0x3978a5[_0xb0c5('0x31')][_0xb0c5('0x1d')]);_0x34ffb2[_0xb0c5('0x1b')]=qs[_0xb0c5('0x1b')](_0x3978a5[_0xb0c5('0x31')]['offset']);}_0x34ffb2[_0xb0c5('0x38')]=qs['sort'](_0x3978a5[_0xb0c5('0x31')]['sort']);_0x34ffb2[_0xb0c5('0x39')]=qs['filters'](_[_0xb0c5('0x3a')](_0x3978a5[_0xb0c5('0x31')],_0x46072d['filters']),_0x1d7e20);if(_0x3978a5[_0xb0c5('0x31')][_0xb0c5('0x3b')]){_0x34ffb2[_0xb0c5('0x39')]=_[_0xb0c5('0x3c')](_0x34ffb2['where'],{'$or':_[_0xb0c5('0x2c')](_0x1d7e20,function(_0x572356){if(_0x572356[_0xb0c5('0x3d')]!==_0xb0c5('0x3e')){var _0x5b4c00={};_0x5b4c00[_0x572356[_0xb0c5('0x29')]]={'$like':'%'+_0x3978a5['query'][_0xb0c5('0x3b')]+'%'};return _0x5b4c00;}})});}_0x34ffb2=_[_0xb0c5('0x3c')]({},_0x34ffb2,_0x3978a5[_0xb0c5('0x3f')]);var _0x5af2ed={'where':_0x34ffb2['where']};return db[_0xb0c5('0x2d')][_0xb0c5('0x1e')](_0x5af2ed)[_0xb0c5('0x25')](function(_0x3bd9af){_0x135947[_0xb0c5('0x1e')]=_0x3bd9af;if(_0x3978a5[_0xb0c5('0x31')][_0xb0c5('0x40')]){_0x34ffb2['include']=[{'all':!![]}];}return db['ZohoConfiguration'][_0xb0c5('0x41')](_0x34ffb2);})[_0xb0c5('0x25')](function(_0xe4b2f6){_0x135947['rows']=_0xe4b2f6;return _0x135947;})['then'](respondWithFilteredResult(_0x302deb,_0x34ffb2))[_0xb0c5('0x42')](handleError(_0x302deb,null));};exports['show']=function(_0x36cdb3,_0x13567b){var _0x1d4d4e={'raw':![],'where':{'id':_0x36cdb3[_0xb0c5('0x43')]['id']}},_0x2aa562={};_0x2aa562[_0xb0c5('0x30')]=_[_0xb0c5('0x32')](db['ZohoConfiguration'][_0xb0c5('0x2e')]);_0x2aa562[_0xb0c5('0x31')]=_['keys'](_0x36cdb3['query']);_0x2aa562[_0xb0c5('0x44')]=_[_0xb0c5('0x33')](_0x2aa562['model'],_0x2aa562['query']);_0x1d4d4e[_0xb0c5('0x34')]=_['intersection'](_0x2aa562[_0xb0c5('0x30')],qs['fields'](_0x36cdb3[_0xb0c5('0x31')][_0xb0c5('0x45')]));_0x1d4d4e[_0xb0c5('0x34')]=_0x1d4d4e[_0xb0c5('0x34')][_0xb0c5('0x35')]?_0x1d4d4e[_0xb0c5('0x34')]:_0x2aa562[_0xb0c5('0x30')];if(_0x36cdb3[_0xb0c5('0x31')][_0xb0c5('0x40')]){_0x1d4d4e[_0xb0c5('0x46')]=[{'all':!![]}];}_0x1d4d4e=_[_0xb0c5('0x3c')]({},_0x1d4d4e,_0x36cdb3[_0xb0c5('0x3f')]);return db[_0xb0c5('0x2d')][_0xb0c5('0x47')](_0x1d4d4e)['then'](handleEntityNotFound(_0x13567b,null))[_0xb0c5('0x25')](respondWithResult(_0x13567b,null))[_0xb0c5('0x42')](handleError(_0x13567b,null));};exports[_0xb0c5('0x48')]=function(_0x928534,_0x5b6a71){return db[_0xb0c5('0x2d')][_0xb0c5('0x48')](_0x928534['body'],{})[_0xb0c5('0x25')](respondWithResult(_0x5b6a71,0xc9))['catch'](handleError(_0x5b6a71,null));};exports['update']=function(_0x2a0c7c,_0x413620){if(_0x2a0c7c[_0xb0c5('0x49')]['id']){delete _0x2a0c7c[_0xb0c5('0x49')]['id'];}return db['ZohoConfiguration'][_0xb0c5('0x47')]({'where':{'id':_0x2a0c7c[_0xb0c5('0x43')]['id']}})[_0xb0c5('0x25')](handleEntityNotFound(_0x413620,null))[_0xb0c5('0x25')](saveUpdates(_0x2a0c7c['body'],null))[_0xb0c5('0x25')](respondWithResult(_0x413620,null))['catch'](handleError(_0x413620,null));};exports['destroy']=function(_0x35acdb,_0x3de9fc){return db[_0xb0c5('0x2d')][_0xb0c5('0x47')]({'where':{'id':_0x35acdb['params']['id']}})[_0xb0c5('0x25')](handleEntityNotFound(_0x3de9fc,null))[_0xb0c5('0x25')](removeEntity(_0x3de9fc,null))[_0xb0c5('0x42')](handleError(_0x3de9fc,null));};exports['getFields']=function(_0x3b9f7f,_0x34afb6,_0x585bef){var _0x4d7715={};var _0x5543a8={};var _0x261014;var _0x5b7e2d;return db[_0xb0c5('0x2d')]['findOne']({'where':{'id':_0x3b9f7f[_0xb0c5('0x43')]['id']}})[_0xb0c5('0x25')](handleEntityNotFound(_0x34afb6,null))[_0xb0c5('0x25')](function(_0x2a2568){if(_0x2a2568){_0x261014=_0x2a2568;_0x5543a8[_0xb0c5('0x30')]=_[_0xb0c5('0x32')](db['ZohoField'][_0xb0c5('0x2e')]);_0x5543a8[_0xb0c5('0x31')]=_[_0xb0c5('0x32')](_0x3b9f7f['query']);_0x5543a8[_0xb0c5('0x44')]=_[_0xb0c5('0x33')](_0x5543a8[_0xb0c5('0x30')],_0x5543a8[_0xb0c5('0x31')]);_0x4d7715['attributes']=_[_0xb0c5('0x33')](_0x5543a8[_0xb0c5('0x30')],qs[_0xb0c5('0x45')](_0x3b9f7f[_0xb0c5('0x31')]['fields']));_0x4d7715['attributes']=_0x4d7715[_0xb0c5('0x34')][_0xb0c5('0x35')]?_0x4d7715[_0xb0c5('0x34')]:_0x5543a8[_0xb0c5('0x30')];_0x4d7715[_0xb0c5('0x38')]=qs[_0xb0c5('0x4a')](_0x3b9f7f['query'][_0xb0c5('0x4a')]);_0x4d7715[_0xb0c5('0x39')]=qs[_0xb0c5('0x44')](_[_0xb0c5('0x3a')](_0x3b9f7f['query'],_0x5543a8['filters']));if(_0x3b9f7f['query']['filter']){_0x4d7715['where']=_['merge'](_0x4d7715[_0xb0c5('0x39')],{'$or':_['map'](_0x4d7715[_0xb0c5('0x34')],function(_0x326a3b){var _0x15060c={};_0x15060c[_0x326a3b]={'$like':'%'+_0x3b9f7f[_0xb0c5('0x31')][_0xb0c5('0x3b')]+'%'};return _0x15060c;})});}_0x4d7715=_['merge']({},_0x4d7715,_0x3b9f7f[_0xb0c5('0x3f')]);return _0x261014[_0xb0c5('0x4b')](_0x4d7715);}})[_0xb0c5('0x25')](function(_0x4415c0){if(_0x4415c0){_0x5b7e2d=_0x4415c0[_0xb0c5('0x35')];if(!_0x3b9f7f[_0xb0c5('0x31')][_0xb0c5('0x36')](_0xb0c5('0x37'))){_0x4d7715['limit']=qs[_0xb0c5('0x1d')](_0x3b9f7f[_0xb0c5('0x31')]['limit']);_0x4d7715[_0xb0c5('0x1b')]=qs[_0xb0c5('0x1b')](_0x3b9f7f[_0xb0c5('0x31')][_0xb0c5('0x1b')]);}return _0x261014['getFields'](_0x4d7715);}})[_0xb0c5('0x25')](function(_0xfe8f34){if(_0xfe8f34){return _0xfe8f34?{'count':_0x5b7e2d,'rows':_0xfe8f34}:null;}})['then'](respondWithResult(_0x34afb6,null))['catch'](handleError(_0x34afb6,null));};exports[_0xb0c5('0x4c')]=function(_0x3602e2,_0x5d46ae,_0x141159){var _0x5b5f8a={};var _0x36e614={};var _0x3ae59f;var _0x18278e;return db[_0xb0c5('0x2d')][_0xb0c5('0x4d')]({'where':{'id':_0x3602e2[_0xb0c5('0x43')]['id']}})[_0xb0c5('0x25')](handleEntityNotFound(_0x5d46ae,null))['then'](function(_0x15a9e8){if(_0x15a9e8){_0x3ae59f=_0x15a9e8;_0x36e614['model']=_[_0xb0c5('0x32')](db[_0xb0c5('0x4e')]['rawAttributes']);_0x36e614['query']=_[_0xb0c5('0x32')](_0x3602e2['query']);_0x36e614[_0xb0c5('0x44')]=_['intersection'](_0x36e614[_0xb0c5('0x30')],_0x36e614[_0xb0c5('0x31')]);_0x5b5f8a[_0xb0c5('0x34')]=_[_0xb0c5('0x33')](_0x36e614[_0xb0c5('0x30')],qs[_0xb0c5('0x45')](_0x3602e2[_0xb0c5('0x31')][_0xb0c5('0x45')]));_0x5b5f8a['attributes']=_0x5b5f8a[_0xb0c5('0x34')][_0xb0c5('0x35')]?_0x5b5f8a[_0xb0c5('0x34')]:_0x36e614[_0xb0c5('0x30')];_0x5b5f8a[_0xb0c5('0x38')]=qs[_0xb0c5('0x4a')](_0x3602e2['query']['sort']);_0x5b5f8a[_0xb0c5('0x39')]=qs[_0xb0c5('0x44')](_[_0xb0c5('0x3a')](_0x3602e2['query'],_0x36e614[_0xb0c5('0x44')]));if(_0x3602e2[_0xb0c5('0x31')]['filter']){_0x5b5f8a[_0xb0c5('0x39')]=_['merge'](_0x5b5f8a[_0xb0c5('0x39')],{'$or':_['map'](_0x5b5f8a[_0xb0c5('0x34')],function(_0x59f900){var _0x27e367={};_0x27e367[_0x59f900]={'$like':'%'+_0x3602e2[_0xb0c5('0x31')][_0xb0c5('0x3b')]+'%'};return _0x27e367;})});}_0x5b5f8a=_['merge']({},_0x5b5f8a,_0x3602e2[_0xb0c5('0x3f')]);return _0x3ae59f[_0xb0c5('0x4c')](_0x5b5f8a);}})[_0xb0c5('0x25')](function(_0xce02f9){if(_0xce02f9){_0x18278e=_0xce02f9[_0xb0c5('0x35')];if(!_0x3602e2['query'][_0xb0c5('0x36')](_0xb0c5('0x37'))){_0x5b5f8a[_0xb0c5('0x1d')]=qs['limit'](_0x3602e2[_0xb0c5('0x31')][_0xb0c5('0x1d')]);_0x5b5f8a[_0xb0c5('0x1b')]=qs[_0xb0c5('0x1b')](_0x3602e2['query']['offset']);}return _0x3ae59f[_0xb0c5('0x4c')](_0x5b5f8a);}})[_0xb0c5('0x25')](function(_0x7ee629){if(_0x7ee629){return _0x7ee629?{'count':_0x18278e,'rows':_0x7ee629}:null;}})['then'](respondWithResult(_0x5d46ae,null))['catch'](handleError(_0x5d46ae,null));};exports[_0xb0c5('0x4f')]=function(_0x151a0f,_0x1eeb5a,_0x46effd){var _0x5c7981={};var _0x14a3b1={};var _0x128fc0;var _0x41a86c;return db[_0xb0c5('0x2d')][_0xb0c5('0x4d')]({'where':{'id':_0x151a0f['params']['id']}})['then'](handleEntityNotFound(_0x1eeb5a,null))[_0xb0c5('0x25')](function(_0x4b7f2a){if(_0x4b7f2a){_0x128fc0=_0x4b7f2a;_0x14a3b1[_0xb0c5('0x30')]=_['keys'](db[_0xb0c5('0x4e')][_0xb0c5('0x2e')]);_0x14a3b1[_0xb0c5('0x31')]=_['keys'](_0x151a0f['query']);_0x14a3b1[_0xb0c5('0x44')]=_['intersection'](_0x14a3b1[_0xb0c5('0x30')],_0x14a3b1[_0xb0c5('0x31')]);_0x5c7981[_0xb0c5('0x34')]=_[_0xb0c5('0x33')](_0x14a3b1[_0xb0c5('0x30')],qs[_0xb0c5('0x45')](_0x151a0f[_0xb0c5('0x31')][_0xb0c5('0x45')]));_0x5c7981[_0xb0c5('0x34')]=_0x5c7981[_0xb0c5('0x34')][_0xb0c5('0x35')]?_0x5c7981[_0xb0c5('0x34')]:_0x14a3b1[_0xb0c5('0x30')];_0x5c7981[_0xb0c5('0x38')]=qs[_0xb0c5('0x4a')](_0x151a0f[_0xb0c5('0x31')]['sort']);_0x5c7981[_0xb0c5('0x39')]=qs['filters'](_[_0xb0c5('0x3a')](_0x151a0f[_0xb0c5('0x31')],_0x14a3b1['filters']));if(_0x151a0f[_0xb0c5('0x31')][_0xb0c5('0x3b')]){_0x5c7981[_0xb0c5('0x39')]=_['merge'](_0x5c7981[_0xb0c5('0x39')],{'$or':_['map'](_0x5c7981[_0xb0c5('0x34')],function(_0x248e59){var _0x54fa93={};_0x54fa93[_0x248e59]={'$like':'%'+_0x151a0f['query'][_0xb0c5('0x3b')]+'%'};return _0x54fa93;})});}_0x5c7981=_[_0xb0c5('0x3c')]({},_0x5c7981,_0x151a0f['options']);return _0x128fc0[_0xb0c5('0x4f')](_0x5c7981);}})[_0xb0c5('0x25')](function(_0x2a5bf1){if(_0x2a5bf1){_0x41a86c=_0x2a5bf1[_0xb0c5('0x35')];if(!_0x151a0f[_0xb0c5('0x31')]['hasOwnProperty'](_0xb0c5('0x37'))){_0x5c7981[_0xb0c5('0x1d')]=qs[_0xb0c5('0x1d')](_0x151a0f[_0xb0c5('0x31')][_0xb0c5('0x1d')]);_0x5c7981[_0xb0c5('0x1b')]=qs[_0xb0c5('0x1b')](_0x151a0f[_0xb0c5('0x31')][_0xb0c5('0x1b')]);}return _0x128fc0[_0xb0c5('0x4f')](_0x5c7981);}})['then'](function(_0xa24eb){if(_0xa24eb){return _0xa24eb?{'count':_0x41a86c,'rows':_0xa24eb}:null;}})['then'](respondWithResult(_0x1eeb5a,null))[_0xb0c5('0x42')](handleError(_0x1eeb5a,null));}; \ No newline at end of file +var _0x9402=['path','to-csv','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','map','ZohoConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','includeAll','rows','catch','show','params','include','find','create','body','getFields','findOne','ZohoField','getSubjects','hasOwnProperty','getDescriptions','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util'];(function(_0x1ee856,_0x52596f){var _0x3473c7=function(_0x58898e){while(--_0x58898e){_0x1ee856['push'](_0x1ee856['shift']());}};_0x3473c7(++_0x52596f);}(_0x9402,0x135));var _0x2940=function(_0x1e1971,_0x435254){_0x1e1971=_0x1e1971-0x0;var _0x499384=_0x9402[_0x1e1971];return _0x499384;};'use strict';var emlformat=require(_0x2940('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2940('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2940('0x2'));var moment=require(_0x2940('0x3'));var BPromise=require(_0x2940('0x4'));var Mustache=require(_0x2940('0x5'));var util=require(_0x2940('0x6'));var path=require(_0x2940('0x7'));var sox=require('sox');var csv=require(_0x2940('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2940('0x9'));var _=require('lodash');var squel=require(_0x2940('0xa'));var crypto=require(_0x2940('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x2940('0xc'));var toCsv=require(_0x2940('0x8'));var querystring=require(_0x2940('0xd'));var Papa=require(_0x2940('0xe'));var Redis=require(_0x2940('0xf'));var authService=require(_0x2940('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x2940('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2940('0x12'))(_0x2940('0x13'));var utils=require(_0x2940('0x14'));var config=require(_0x2940('0x15'));var licenseUtil=require(_0x2940('0x16'));var db=require(_0x2940('0x17'))['db'];function respondWithStatusCode(_0x3c9367,_0x429129){_0x429129=_0x429129||0xcc;return function(_0x192148){if(_0x192148){return _0x3c9367['sendStatus'](_0x429129);}return _0x3c9367[_0x2940('0x18')](_0x429129)[_0x2940('0x19')]();};}function respondWithResult(_0x42b796,_0x4512ae){_0x4512ae=_0x4512ae||0xc8;return function(_0x118274){if(_0x118274){return _0x42b796[_0x2940('0x18')](_0x4512ae)[_0x2940('0x1a')](_0x118274);}};}function respondWithFilteredResult(_0x1e77b0,_0x51c8e8){return function(_0x59bcf4){if(_0x59bcf4){var _0xaa21f=typeof _0x51c8e8[_0x2940('0x1b')]===_0x2940('0x1c')&&typeof _0x51c8e8['limit']===_0x2940('0x1c');var _0x6440e6=_0x59bcf4[_0x2940('0x1d')];var _0xdce7c3=_0xaa21f?0x0:_0x51c8e8[_0x2940('0x1b')];var _0x1e39ae=_0xaa21f?_0x59bcf4[_0x2940('0x1d')]:_0x51c8e8['offset']+_0x51c8e8[_0x2940('0x1e')];var _0x5dbe23;if(_0x1e39ae>=_0x6440e6){_0x1e39ae=_0x6440e6;_0x5dbe23=0xc8;}else{_0x5dbe23=0xce;}_0x1e77b0[_0x2940('0x18')](_0x5dbe23);return _0x1e77b0[_0x2940('0x1f')](_0x2940('0x20'),_0xdce7c3+'-'+_0x1e39ae+'/'+_0x6440e6)['json'](_0x59bcf4);}return null;};}function patchUpdates(_0x487b5f){return function(_0x2e4335){try{jsonpatch[_0x2940('0x21')](_0x2e4335,_0x487b5f,!![]);}catch(_0x3ddd4d){return BPromise[_0x2940('0x22')](_0x3ddd4d);}return _0x2e4335[_0x2940('0x23')]();};}function saveUpdates(_0x1ac96c,_0x274694){return function(_0xe81081){if(_0xe81081){return _0xe81081[_0x2940('0x24')](_0x1ac96c)[_0x2940('0x25')](function(_0x5fcc42){return _0x5fcc42;});}return null;};}function removeEntity(_0x50641d,_0x558543){return function(_0x353126){if(_0x353126){return _0x353126[_0x2940('0x26')]()[_0x2940('0x25')](function(){_0x50641d[_0x2940('0x18')](0xcc)[_0x2940('0x19')]();});}};}function handleEntityNotFound(_0x34ebaa,_0xd3e9e3){return function(_0x304e58){if(!_0x304e58){_0x34ebaa['sendStatus'](0x194);}return _0x304e58;};}function handleError(_0x105c43,_0x4ac166){_0x4ac166=_0x4ac166||0x1f4;return function(_0x42588d){logger['error'](_0x42588d[_0x2940('0x27')]);if(_0x42588d[_0x2940('0x28')]){delete _0x42588d[_0x2940('0x28')];}_0x105c43[_0x2940('0x18')](_0x4ac166)[_0x2940('0x29')](_0x42588d);};}exports['index']=function(_0x2db6ef,_0x4c3952){var _0x14082e={},_0x4824de={},_0x1b48e1={'count':0x0,'rows':[]};var _0x49128c=_[_0x2940('0x2a')](db[_0x2940('0x2b')][_0x2940('0x2c')],function(_0x402640){return{'name':_0x402640[_0x2940('0x2d')],'type':_0x402640[_0x2940('0x2e')][_0x2940('0x2f')]};});_0x4824de[_0x2940('0x30')]=_[_0x2940('0x2a')](_0x49128c,'name');_0x4824de[_0x2940('0x31')]=_[_0x2940('0x32')](_0x2db6ef[_0x2940('0x31')]);_0x4824de[_0x2940('0x33')]=_[_0x2940('0x34')](_0x4824de[_0x2940('0x30')],_0x4824de[_0x2940('0x31')]);_0x14082e[_0x2940('0x35')]=_[_0x2940('0x34')](_0x4824de['model'],qs['fields'](_0x2db6ef[_0x2940('0x31')][_0x2940('0x36')]));_0x14082e[_0x2940('0x35')]=_0x14082e[_0x2940('0x35')][_0x2940('0x37')]?_0x14082e[_0x2940('0x35')]:_0x4824de[_0x2940('0x30')];if(!_0x2db6ef[_0x2940('0x31')]['hasOwnProperty'](_0x2940('0x38'))){_0x14082e[_0x2940('0x1e')]=qs[_0x2940('0x1e')](_0x2db6ef['query'][_0x2940('0x1e')]);_0x14082e['offset']=qs['offset'](_0x2db6ef[_0x2940('0x31')][_0x2940('0x1b')]);}_0x14082e[_0x2940('0x39')]=qs['sort'](_0x2db6ef[_0x2940('0x31')][_0x2940('0x3a')]);_0x14082e[_0x2940('0x3b')]=qs[_0x2940('0x33')](_[_0x2940('0x3c')](_0x2db6ef[_0x2940('0x31')],_0x4824de['filters']),_0x49128c);if(_0x2db6ef[_0x2940('0x31')][_0x2940('0x3d')]){_0x14082e[_0x2940('0x3b')]=_[_0x2940('0x3e')](_0x14082e[_0x2940('0x3b')],{'$or':_[_0x2940('0x2a')](_0x49128c,function(_0x1e25ff){if(_0x1e25ff[_0x2940('0x2e')]!=='VIRTUAL'){var _0x50160f={};_0x50160f[_0x1e25ff[_0x2940('0x28')]]={'$like':'%'+_0x2db6ef[_0x2940('0x31')][_0x2940('0x3d')]+'%'};return _0x50160f;}})});}_0x14082e=_[_0x2940('0x3e')]({},_0x14082e,_0x2db6ef[_0x2940('0x3f')]);var _0x5839ff={'where':_0x14082e[_0x2940('0x3b')]};return db[_0x2940('0x2b')]['count'](_0x5839ff)['then'](function(_0x4a5ff3){_0x1b48e1[_0x2940('0x1d')]=_0x4a5ff3;if(_0x2db6ef[_0x2940('0x31')][_0x2940('0x40')]){_0x14082e['include']=[{'all':!![]}];}return db[_0x2940('0x2b')]['findAll'](_0x14082e);})['then'](function(_0x22d337){_0x1b48e1[_0x2940('0x41')]=_0x22d337;return _0x1b48e1;})['then'](respondWithFilteredResult(_0x4c3952,_0x14082e))[_0x2940('0x42')](handleError(_0x4c3952,null));};exports[_0x2940('0x43')]=function(_0x405bb2,_0x2951c9){var _0x13dc86={'raw':![],'where':{'id':_0x405bb2[_0x2940('0x44')]['id']}},_0x10aa4c={};_0x10aa4c[_0x2940('0x30')]=_[_0x2940('0x32')](db[_0x2940('0x2b')][_0x2940('0x2c')]);_0x10aa4c['query']=_[_0x2940('0x32')](_0x405bb2[_0x2940('0x31')]);_0x10aa4c[_0x2940('0x33')]=_[_0x2940('0x34')](_0x10aa4c[_0x2940('0x30')],_0x10aa4c[_0x2940('0x31')]);_0x13dc86[_0x2940('0x35')]=_['intersection'](_0x10aa4c[_0x2940('0x30')],qs['fields'](_0x405bb2['query'][_0x2940('0x36')]));_0x13dc86[_0x2940('0x35')]=_0x13dc86[_0x2940('0x35')][_0x2940('0x37')]?_0x13dc86[_0x2940('0x35')]:_0x10aa4c[_0x2940('0x30')];if(_0x405bb2['query'][_0x2940('0x40')]){_0x13dc86[_0x2940('0x45')]=[{'all':!![]}];}_0x13dc86=_[_0x2940('0x3e')]({},_0x13dc86,_0x405bb2[_0x2940('0x3f')]);return db[_0x2940('0x2b')][_0x2940('0x46')](_0x13dc86)[_0x2940('0x25')](handleEntityNotFound(_0x2951c9,null))[_0x2940('0x25')](respondWithResult(_0x2951c9,null))['catch'](handleError(_0x2951c9,null));};exports[_0x2940('0x47')]=function(_0xad22e8,_0x297578){return db[_0x2940('0x2b')][_0x2940('0x47')](_0xad22e8[_0x2940('0x48')],{})[_0x2940('0x25')](respondWithResult(_0x297578,0xc9))['catch'](handleError(_0x297578,null));};exports[_0x2940('0x24')]=function(_0x5597a5,_0x4bbc90){if(_0x5597a5['body']['id']){delete _0x5597a5[_0x2940('0x48')]['id'];}return db[_0x2940('0x2b')][_0x2940('0x46')]({'where':{'id':_0x5597a5[_0x2940('0x44')]['id']}})['then'](handleEntityNotFound(_0x4bbc90,null))['then'](saveUpdates(_0x5597a5[_0x2940('0x48')],null))[_0x2940('0x25')](respondWithResult(_0x4bbc90,null))[_0x2940('0x42')](handleError(_0x4bbc90,null));};exports[_0x2940('0x26')]=function(_0x1f39db,_0x2e8ef5){return db[_0x2940('0x2b')][_0x2940('0x46')]({'where':{'id':_0x1f39db['params']['id']}})[_0x2940('0x25')](handleEntityNotFound(_0x2e8ef5,null))[_0x2940('0x25')](removeEntity(_0x2e8ef5,null))['catch'](handleError(_0x2e8ef5,null));};exports[_0x2940('0x49')]=function(_0x222d7f,_0x34bab4,_0x1a964f){var _0x16b3b1={};var _0x219ac2={};var _0xbb0d3c;var _0x371d48;return db[_0x2940('0x2b')][_0x2940('0x4a')]({'where':{'id':_0x222d7f[_0x2940('0x44')]['id']}})[_0x2940('0x25')](handleEntityNotFound(_0x34bab4,null))[_0x2940('0x25')](function(_0x25715a){if(_0x25715a){_0xbb0d3c=_0x25715a;_0x219ac2[_0x2940('0x30')]=_[_0x2940('0x32')](db[_0x2940('0x4b')][_0x2940('0x2c')]);_0x219ac2[_0x2940('0x31')]=_[_0x2940('0x32')](_0x222d7f['query']);_0x219ac2[_0x2940('0x33')]=_[_0x2940('0x34')](_0x219ac2[_0x2940('0x30')],_0x219ac2[_0x2940('0x31')]);_0x16b3b1['attributes']=_['intersection'](_0x219ac2[_0x2940('0x30')],qs[_0x2940('0x36')](_0x222d7f[_0x2940('0x31')][_0x2940('0x36')]));_0x16b3b1[_0x2940('0x35')]=_0x16b3b1[_0x2940('0x35')][_0x2940('0x37')]?_0x16b3b1['attributes']:_0x219ac2[_0x2940('0x30')];_0x16b3b1[_0x2940('0x39')]=qs[_0x2940('0x3a')](_0x222d7f[_0x2940('0x31')]['sort']);_0x16b3b1[_0x2940('0x3b')]=qs[_0x2940('0x33')](_[_0x2940('0x3c')](_0x222d7f[_0x2940('0x31')],_0x219ac2['filters']));if(_0x222d7f[_0x2940('0x31')][_0x2940('0x3d')]){_0x16b3b1['where']=_[_0x2940('0x3e')](_0x16b3b1[_0x2940('0x3b')],{'$or':_[_0x2940('0x2a')](_0x16b3b1['attributes'],function(_0x19c8a8){var _0x253b9e={};_0x253b9e[_0x19c8a8]={'$like':'%'+_0x222d7f[_0x2940('0x31')][_0x2940('0x3d')]+'%'};return _0x253b9e;})});}_0x16b3b1=_['merge']({},_0x16b3b1,_0x222d7f[_0x2940('0x3f')]);return _0xbb0d3c[_0x2940('0x49')](_0x16b3b1);}})[_0x2940('0x25')](function(_0x4e2d7a){if(_0x4e2d7a){_0x371d48=_0x4e2d7a[_0x2940('0x37')];if(!_0x222d7f[_0x2940('0x31')]['hasOwnProperty'](_0x2940('0x38'))){_0x16b3b1[_0x2940('0x1e')]=qs[_0x2940('0x1e')](_0x222d7f['query'][_0x2940('0x1e')]);_0x16b3b1[_0x2940('0x1b')]=qs[_0x2940('0x1b')](_0x222d7f[_0x2940('0x31')][_0x2940('0x1b')]);}return _0xbb0d3c['getFields'](_0x16b3b1);}})['then'](function(_0x241235){if(_0x241235){return _0x241235?{'count':_0x371d48,'rows':_0x241235}:null;}})[_0x2940('0x25')](respondWithResult(_0x34bab4,null))['catch'](handleError(_0x34bab4,null));};exports[_0x2940('0x4c')]=function(_0x3c77a8,_0x3a5e3c,_0x19bbc9){var _0x50771c={};var _0x70b8e={};var _0x2101a0;var _0x51226d;return db[_0x2940('0x2b')]['findOne']({'where':{'id':_0x3c77a8['params']['id']}})[_0x2940('0x25')](handleEntityNotFound(_0x3a5e3c,null))[_0x2940('0x25')](function(_0x36ee31){if(_0x36ee31){_0x2101a0=_0x36ee31;_0x70b8e[_0x2940('0x30')]=_['keys'](db['ZohoField'][_0x2940('0x2c')]);_0x70b8e[_0x2940('0x31')]=_[_0x2940('0x32')](_0x3c77a8[_0x2940('0x31')]);_0x70b8e[_0x2940('0x33')]=_[_0x2940('0x34')](_0x70b8e[_0x2940('0x30')],_0x70b8e[_0x2940('0x31')]);_0x50771c[_0x2940('0x35')]=_[_0x2940('0x34')](_0x70b8e['model'],qs['fields'](_0x3c77a8[_0x2940('0x31')][_0x2940('0x36')]));_0x50771c[_0x2940('0x35')]=_0x50771c['attributes'][_0x2940('0x37')]?_0x50771c[_0x2940('0x35')]:_0x70b8e[_0x2940('0x30')];_0x50771c[_0x2940('0x39')]=qs[_0x2940('0x3a')](_0x3c77a8[_0x2940('0x31')][_0x2940('0x3a')]);_0x50771c['where']=qs[_0x2940('0x33')](_['pick'](_0x3c77a8[_0x2940('0x31')],_0x70b8e['filters']));if(_0x3c77a8[_0x2940('0x31')][_0x2940('0x3d')]){_0x50771c[_0x2940('0x3b')]=_['merge'](_0x50771c[_0x2940('0x3b')],{'$or':_[_0x2940('0x2a')](_0x50771c[_0x2940('0x35')],function(_0x560416){var _0x35fc38={};_0x35fc38[_0x560416]={'$like':'%'+_0x3c77a8['query']['filter']+'%'};return _0x35fc38;})});}_0x50771c=_[_0x2940('0x3e')]({},_0x50771c,_0x3c77a8[_0x2940('0x3f')]);return _0x2101a0['getSubjects'](_0x50771c);}})[_0x2940('0x25')](function(_0x436a70){if(_0x436a70){_0x51226d=_0x436a70['length'];if(!_0x3c77a8[_0x2940('0x31')][_0x2940('0x4d')](_0x2940('0x38'))){_0x50771c['limit']=qs[_0x2940('0x1e')](_0x3c77a8[_0x2940('0x31')][_0x2940('0x1e')]);_0x50771c[_0x2940('0x1b')]=qs['offset'](_0x3c77a8[_0x2940('0x31')][_0x2940('0x1b')]);}return _0x2101a0[_0x2940('0x4c')](_0x50771c);}})[_0x2940('0x25')](function(_0x511c09){if(_0x511c09){return _0x511c09?{'count':_0x51226d,'rows':_0x511c09}:null;}})[_0x2940('0x25')](respondWithResult(_0x3a5e3c,null))['catch'](handleError(_0x3a5e3c,null));};exports[_0x2940('0x4e')]=function(_0x2ffa28,_0x121509,_0x23b681){var _0x2da281={};var _0x18a422={};var _0x2cb507;var _0x11f00e;return db[_0x2940('0x2b')][_0x2940('0x4a')]({'where':{'id':_0x2ffa28[_0x2940('0x44')]['id']}})['then'](handleEntityNotFound(_0x121509,null))[_0x2940('0x25')](function(_0xb0ae7b){if(_0xb0ae7b){_0x2cb507=_0xb0ae7b;_0x18a422['model']=_[_0x2940('0x32')](db[_0x2940('0x4b')][_0x2940('0x2c')]);_0x18a422[_0x2940('0x31')]=_[_0x2940('0x32')](_0x2ffa28[_0x2940('0x31')]);_0x18a422[_0x2940('0x33')]=_[_0x2940('0x34')](_0x18a422[_0x2940('0x30')],_0x18a422[_0x2940('0x31')]);_0x2da281[_0x2940('0x35')]=_['intersection'](_0x18a422[_0x2940('0x30')],qs[_0x2940('0x36')](_0x2ffa28['query']['fields']));_0x2da281['attributes']=_0x2da281[_0x2940('0x35')][_0x2940('0x37')]?_0x2da281[_0x2940('0x35')]:_0x18a422[_0x2940('0x30')];_0x2da281['order']=qs['sort'](_0x2ffa28[_0x2940('0x31')][_0x2940('0x3a')]);_0x2da281[_0x2940('0x3b')]=qs['filters'](_[_0x2940('0x3c')](_0x2ffa28[_0x2940('0x31')],_0x18a422[_0x2940('0x33')]));if(_0x2ffa28[_0x2940('0x31')][_0x2940('0x3d')]){_0x2da281[_0x2940('0x3b')]=_[_0x2940('0x3e')](_0x2da281['where'],{'$or':_[_0x2940('0x2a')](_0x2da281[_0x2940('0x35')],function(_0x48d461){var _0x3e1bf9={};_0x3e1bf9[_0x48d461]={'$like':'%'+_0x2ffa28[_0x2940('0x31')]['filter']+'%'};return _0x3e1bf9;})});}_0x2da281=_['merge']({},_0x2da281,_0x2ffa28['options']);return _0x2cb507['getDescriptions'](_0x2da281);}})[_0x2940('0x25')](function(_0x2bab25){if(_0x2bab25){_0x11f00e=_0x2bab25[_0x2940('0x37')];if(!_0x2ffa28[_0x2940('0x31')]['hasOwnProperty'](_0x2940('0x38'))){_0x2da281['limit']=qs[_0x2940('0x1e')](_0x2ffa28[_0x2940('0x31')][_0x2940('0x1e')]);_0x2da281[_0x2940('0x1b')]=qs[_0x2940('0x1b')](_0x2ffa28[_0x2940('0x31')][_0x2940('0x1b')]);}return _0x2cb507['getDescriptions'](_0x2da281);}})[_0x2940('0x25')](function(_0x957ec){if(_0x957ec){return _0x957ec?{'count':_0x11f00e,'rows':_0x957ec}:null;}})[_0x2940('0x25')](respondWithResult(_0x121509,null))[_0x2940('0x42')](handleError(_0x121509,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 8fd360c..cdbaf0a 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 _0x5f30=['int_zoho_configurations','lodash','util','api','moment','request-promise','rimraf','../../config/environment','exports','define','ZohoConfiguration'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x5f30,0xa6));var _0x05f3=function(_0x5ef88f,_0x330745){_0x5ef88f=_0x5ef88f-0x0;var _0xcedad9=_0x5f30[_0x5ef88f];return _0xcedad9;};'use strict';var _=require(_0x05f3('0x0'));var util=require(_0x05f3('0x1'));var logger=require('../../config/logger')(_0x05f3('0x2'));var moment=require(_0x05f3('0x3'));var BPromise=require('bluebird');var rp=require(_0x05f3('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x05f3('0x5'));var config=require(_0x05f3('0x6'));var attributes=require('./intZohoConfiguration.attributes');module[_0x05f3('0x7')]=function(_0x4ec68b,_0x380dd7){return _0x4ec68b[_0x05f3('0x8')](_0x05f3('0x9'),attributes,{'tableName':_0x05f3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0ae5=['api','moment','bluebird','request-promise','path','../../config/environment','./intZohoConfiguration.attributes','exports','ZohoConfiguration','int_zoho_configurations'];(function(_0x13bf5d,_0x24c3b5){var _0x5e3cbb=function(_0x31a912){while(--_0x31a912){_0x13bf5d['push'](_0x13bf5d['shift']());}};_0x5e3cbb(++_0x24c3b5);}(_0x0ae5,0xd2));var _0x50ae=function(_0x5484bc,_0xaed0c3){_0x5484bc=_0x5484bc-0x0;var _0x361aaa=_0x0ae5[_0x5484bc];return _0x361aaa;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x50ae('0x0'));var moment=require(_0x50ae('0x1'));var BPromise=require(_0x50ae('0x2'));var rp=require(_0x50ae('0x3'));var fs=require('fs');var path=require(_0x50ae('0x4'));var rimraf=require('rimraf');var config=require(_0x50ae('0x5'));var attributes=require(_0x50ae('0x6'));module[_0x50ae('0x7')]=function(_0xe816bc,_0x216522){return _0xe816bc['define'](_0x50ae('0x8'),attributes,{'tableName':_0x50ae('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js b/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js index dbe2312..8f4da43 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 _0x3aa6=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ZohoConfiguration,\x20%s,\x20%s','result','message','catch','lodash','util','bluebird','randomstring','ioredis'];(function(_0x36a291,_0x1d2e97){var _0x49036d=function(_0x13ddb8){while(--_0x13ddb8){_0x36a291['push'](_0x36a291['shift']());}};_0x49036d(++_0x1d2e97);}(_0x3aa6,0x163));var _0x63aa=function(_0x209ec9,_0x30378c){_0x209ec9=_0x209ec9-0x0;var _0x129b1b=_0x3aa6[_0x209ec9];return _0x129b1b;};'use strict';var _=require(_0x63aa('0x0'));var util=require(_0x63aa('0x1'));var moment=require('moment');var BPromise=require(_0x63aa('0x2'));var rs=require(_0x63aa('0x3'));var fs=require('fs');var Redis=require(_0x63aa('0x4'));var db=require(_0x63aa('0x5'))['db'];var utils=require(_0x63aa('0x6'));var logger=require('../../config/logger')(_0x63aa('0x7'));var config=require('../../config/environment');var jayson=require(_0x63aa('0x8'));var client=jayson[_0x63aa('0x9')][_0x63aa('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1856d2,_0x4e8e58,_0x1928fc){return new BPromise(function(_0x1b7a62,_0x40325b){return client[_0x63aa('0xb')](_0x1856d2,_0x1928fc)[_0x63aa('0xc')](function(_0x2e34c2){logger[_0x63aa('0xd')]('ZohoConfiguration,\x20%s,\x20%s',_0x4e8e58,_0x63aa('0xe'));logger[_0x63aa('0xf')](_0x63aa('0x10'),_0x4e8e58,'request\x20sent',JSON[_0x63aa('0x11')](_0x2e34c2));if(_0x2e34c2['error']){if(_0x2e34c2[_0x63aa('0x12')][_0x63aa('0x13')]===0x1f4){logger[_0x63aa('0x12')](_0x63aa('0x14'),_0x4e8e58,_0x2e34c2['error']['message']);return _0x40325b(_0x2e34c2[_0x63aa('0x12')]['message']);}logger[_0x63aa('0x12')](_0x63aa('0x14'),_0x4e8e58,_0x2e34c2[_0x63aa('0x12')]['message']);return _0x1b7a62(_0x2e34c2[_0x63aa('0x12')]['message']);}else{logger['info'](_0x63aa('0x14'),_0x4e8e58,'request\x20sent');_0x1b7a62(_0x2e34c2[_0x63aa('0x15')][_0x63aa('0x16')]);}})[_0x63aa('0x17')](function(_0x187bad){logger[_0x63aa('0x12')](_0x63aa('0x14'),_0x4e8e58,_0x187bad);_0x40325b(_0x187bad);});});} \ No newline at end of file +var _0xe658=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ZohoConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils'];(function(_0x173c4f,_0x324e32){var _0x55b330=function(_0x46edf0){while(--_0x46edf0){_0x173c4f['push'](_0x173c4f['shift']());}};_0x55b330(++_0x324e32);}(_0xe658,0xc2));var _0x8e65=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xe658[_0x138adb];return _0x1b27f2;};'use strict';var _=require(_0x8e65('0x0'));var util=require(_0x8e65('0x1'));var moment=require(_0x8e65('0x2'));var BPromise=require('bluebird');var rs=require(_0x8e65('0x3'));var fs=require('fs');var Redis=require(_0x8e65('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8e65('0x5'));var logger=require(_0x8e65('0x6'))(_0x8e65('0x7'));var config=require(_0x8e65('0x8'));var jayson=require(_0x8e65('0x9'));var client=jayson[_0x8e65('0xa')][_0x8e65('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1ce424,_0x3777c9,_0x2dc720){return new BPromise(function(_0x40c5a3,_0x1e7611){return client[_0x8e65('0xc')](_0x1ce424,_0x2dc720)[_0x8e65('0xd')](function(_0x31a31b){logger[_0x8e65('0xe')]('ZohoConfiguration,\x20%s,\x20%s',_0x3777c9,_0x8e65('0xf'));logger[_0x8e65('0x10')](_0x8e65('0x11'),_0x3777c9,_0x8e65('0xf'),JSON[_0x8e65('0x12')](_0x31a31b));if(_0x31a31b[_0x8e65('0x13')]){if(_0x31a31b[_0x8e65('0x13')][_0x8e65('0x14')]===0x1f4){logger[_0x8e65('0x13')](_0x8e65('0x15'),_0x3777c9,_0x31a31b['error'][_0x8e65('0x16')]);return _0x1e7611(_0x31a31b[_0x8e65('0x13')]['message']);}logger[_0x8e65('0x13')](_0x8e65('0x15'),_0x3777c9,_0x31a31b[_0x8e65('0x13')][_0x8e65('0x16')]);return _0x40c5a3(_0x31a31b[_0x8e65('0x13')][_0x8e65('0x16')]);}else{logger['info'](_0x8e65('0x15'),_0x3777c9,_0x8e65('0xf'));_0x40c5a3(_0x31a31b[_0x8e65('0x17')][_0x8e65('0x16')]);}})[_0x8e65('0x18')](function(_0x366666){logger[_0x8e65('0x13')](_0x8e65('0x15'),_0x3777c9,_0x366666);_0x1e7611(_0x366666);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index c819a64..7b1fe98 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 _0x46bf=['/:id','show','post','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','isAuthenticated'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x46bf,0xf1));var _0xf46b=function(_0x303862,_0x20b5ab){_0x303862=_0x303862-0x0;var _0xe6f228=_0x46bf[_0x303862];return _0xe6f228;};'use strict';var multer=require('multer');var util=require(_0xf46b('0x0'));var path=require(_0xf46b('0x1'));var timeout=require(_0xf46b('0x2'));var express=require('express');var router=express[_0xf46b('0x3')]();var fs_extra=require(_0xf46b('0x4'));var auth=require(_0xf46b('0x5'));var interaction=require(_0xf46b('0x6'));var config=require(_0xf46b('0x7'));var controller=require(_0xf46b('0x8'));router[_0xf46b('0x9')]('/',auth[_0xf46b('0xa')](),controller['index']);router[_0xf46b('0x9')](_0xf46b('0xb'),auth[_0xf46b('0xa')](),controller[_0xf46b('0xc')]);router[_0xf46b('0xd')]('/',auth[_0xf46b('0xa')](),controller['create']);router['put'](_0xf46b('0xb'),auth[_0xf46b('0xa')](),controller[_0xf46b('0xe')]);router[_0xf46b('0xf')](_0xf46b('0xb'),auth['isAuthenticated'](),controller[_0xf46b('0x10')]);module[_0xf46b('0x11')]=router; \ No newline at end of file +var _0xbcb9=['fs-extra','../../components/auth/service','../../config/environment','./intZohoField.controller','get','/:id','isAuthenticated','show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x530504,_0x435b73){var _0x2bb4bb=function(_0x58e391){while(--_0x58e391){_0x530504['push'](_0x530504['shift']());}};_0x2bb4bb(++_0x435b73);}(_0xbcb9,0x188));var _0x9bcb=function(_0x53a6fd,_0x5c7351){_0x53a6fd=_0x53a6fd-0x0;var _0x2b9a44=_0xbcb9[_0x53a6fd];return _0x2b9a44;};'use strict';var multer=require(_0x9bcb('0x0'));var util=require(_0x9bcb('0x1'));var path=require(_0x9bcb('0x2'));var timeout=require(_0x9bcb('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x9bcb('0x4'));var auth=require(_0x9bcb('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x9bcb('0x6'));var controller=require(_0x9bcb('0x7'));router[_0x9bcb('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x9bcb('0x9'),auth[_0x9bcb('0xa')](),controller[_0x9bcb('0xb')]);router[_0x9bcb('0xc')]('/',auth[_0x9bcb('0xa')](),controller[_0x9bcb('0xd')]);router['put'](_0x9bcb('0x9'),auth['isAuthenticated'](),controller[_0x9bcb('0xe')]);router[_0x9bcb('0xf')](_0x9bcb('0x9'),auth[_0x9bcb('0xa')](),controller[_0x9bcb('0x10')]);module[_0x9bcb('0x11')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 11ec0c2..acbf8dc 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 _0x7615=['keyValue','picklist','STRING','BOOLEAN','exports','ENUM','string','variable','customVariable'];(function(_0x5a18fc,_0xb1a4aa){var _0x57b441=function(_0x14e663){while(--_0x14e663){_0x5a18fc['push'](_0x5a18fc['shift']());}};_0x57b441(++_0xb1a4aa);}(_0x7615,0x109));var _0x5761=function(_0x12bcf7,_0xc11103){_0x12bcf7=_0x12bcf7-0x0;var _0x2825a=_0x7615[_0x12bcf7];return _0x2825a;};'use strict';var Sequelize=require('sequelize');module[_0x5761('0x0')]={'type':{'type':Sequelize[_0x5761('0x1')](_0x5761('0x2'),_0x5761('0x3'),_0x5761('0x4'),_0x5761('0x5'),_0x5761('0x6')),'defaultValue':_0x5761('0x2')},'content':{'type':Sequelize[_0x5761('0x7')]},'key':{'type':Sequelize[_0x5761('0x7')]},'keyType':{'type':Sequelize[_0x5761('0x1')]('string',_0x5761('0x3'),_0x5761('0x4'))},'keyContent':{'type':Sequelize[_0x5761('0x7')]},'idField':{'type':Sequelize[_0x5761('0x7')]},'nameField':{'type':Sequelize[_0x5761('0x7')]},'customField':{'type':Sequelize[_0x5761('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2000=['ENUM','customVariable','keyValue','STRING','string','variable','exports'];(function(_0x32be09,_0x508724){var _0x1db24d=function(_0x4fbd40){while(--_0x4fbd40){_0x32be09['push'](_0x32be09['shift']());}};_0x1db24d(++_0x508724);}(_0x2000,0xae));var _0x0200=function(_0x43c2cf,_0x3d1fb4){_0x43c2cf=_0x43c2cf-0x0;var _0x4992d8=_0x2000[_0x43c2cf];return _0x4992d8;};'use strict';var Sequelize=require('sequelize');module[_0x0200('0x0')]={'type':{'type':Sequelize[_0x0200('0x1')]('string','variable',_0x0200('0x2'),_0x0200('0x3'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x0200('0x4')]},'key':{'type':Sequelize[_0x0200('0x4')]},'keyType':{'type':Sequelize[_0x0200('0x1')](_0x0200('0x5'),_0x0200('0x6'),_0x0200('0x2'))},'keyContent':{'type':Sequelize[_0x0200('0x4')]},'idField':{'type':Sequelize[_0x0200('0x4')]},'nameField':{'type':Sequelize[_0x0200('0x4')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 2012fc4..75af3c3 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 _0x8574=['type','model','query','keys','filters','attributes','intersection','fields','order','sort','where','pick','merge','map','VIRTUAL','filter','options','includeAll','findAll','catch','show','params','length','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','ZohoField','rawAttributes','fieldName'];(function(_0x174cd3,_0x57aa53){var _0x58e87c=function(_0x2a273e){while(--_0x2a273e){_0x174cd3['push'](_0x174cd3['shift']());}};_0x58e87c(++_0x57aa53);}(_0x8574,0xb2));var _0x4857=function(_0x34af18,_0x145b88){_0x34af18=_0x34af18-0x0;var _0x1a16ba=_0x8574[_0x34af18];return _0x1a16ba;};'use strict';var emlformat=require(_0x4857('0x0'));var rimraf=require(_0x4857('0x1'));var zipdir=require(_0x4857('0x2'));var jsonpatch=require(_0x4857('0x3'));var rp=require(_0x4857('0x4'));var moment=require(_0x4857('0x5'));var BPromise=require(_0x4857('0x6'));var Mustache=require('mustache');var util=require(_0x4857('0x7'));var path=require(_0x4857('0x8'));var sox=require(_0x4857('0x9'));var csv=require(_0x4857('0xa'));var ejs=require(_0x4857('0xb'));var fs=require('fs');var fs_extra=require(_0x4857('0xc'));var _=require(_0x4857('0xd'));var squel=require(_0x4857('0xe'));var crypto=require(_0x4857('0xf'));var jsforce=require(_0x4857('0x10'));var deskjs=require(_0x4857('0x11'));var toCsv=require(_0x4857('0xa'));var querystring=require(_0x4857('0x12'));var Papa=require(_0x4857('0x13'));var Redis=require(_0x4857('0x14'));var authService=require(_0x4857('0x15'));var qs=require(_0x4857('0x16'));var as=require(_0x4857('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4857('0x18'))('api');var utils=require('../../config/utils');var config=require(_0x4857('0x19'));var licenseUtil=require(_0x4857('0x1a'));var db=require(_0x4857('0x1b'))['db'];function respondWithStatusCode(_0xfd8a3c,_0x14a5d0){_0x14a5d0=_0x14a5d0||0xcc;return function(_0x35e0bd){if(_0x35e0bd){return _0xfd8a3c['sendStatus'](_0x14a5d0);}return _0xfd8a3c[_0x4857('0x1c')](_0x14a5d0)[_0x4857('0x1d')]();};}function respondWithResult(_0x318bfb,_0x3c0544){_0x3c0544=_0x3c0544||0xc8;return function(_0x213c28){if(_0x213c28){return _0x318bfb[_0x4857('0x1c')](_0x3c0544)[_0x4857('0x1e')](_0x213c28);}};}function respondWithFilteredResult(_0x348ab0,_0x5186c1){return function(_0x58cc95){if(_0x58cc95){var _0x416611=typeof _0x5186c1[_0x4857('0x1f')]===_0x4857('0x20')&&typeof _0x5186c1[_0x4857('0x21')]===_0x4857('0x20');var _0xd96c85=_0x58cc95['count'];var _0x583b0c=_0x416611?0x0:_0x5186c1[_0x4857('0x1f')];var _0x1961bc=_0x416611?_0x58cc95[_0x4857('0x22')]:_0x5186c1[_0x4857('0x1f')]+_0x5186c1[_0x4857('0x21')];var _0x47535b;if(_0x1961bc>=_0xd96c85){_0x1961bc=_0xd96c85;_0x47535b=0xc8;}else{_0x47535b=0xce;}_0x348ab0[_0x4857('0x1c')](_0x47535b);return _0x348ab0[_0x4857('0x23')](_0x4857('0x24'),_0x583b0c+'-'+_0x1961bc+'/'+_0xd96c85)[_0x4857('0x1e')](_0x58cc95);}return null;};}function patchUpdates(_0x554650){return function(_0x488b13){try{jsonpatch[_0x4857('0x25')](_0x488b13,_0x554650,!![]);}catch(_0x1fe93c){return BPromise[_0x4857('0x26')](_0x1fe93c);}return _0x488b13[_0x4857('0x27')]();};}function saveUpdates(_0x38c96f,_0x359ba7){return function(_0x241751){if(_0x241751){return _0x241751[_0x4857('0x28')](_0x38c96f)['then'](function(_0x20f794){return _0x20f794;});}return null;};}function removeEntity(_0x53e9c9,_0x5547d1){return function(_0x21b553){if(_0x21b553){return _0x21b553[_0x4857('0x29')]()[_0x4857('0x2a')](function(){_0x53e9c9['status'](0xcc)[_0x4857('0x1d')]();});}};}function handleEntityNotFound(_0x16086f,_0x44e8a8){return function(_0x115d0e){if(!_0x115d0e){_0x16086f[_0x4857('0x2b')](0x194);}return _0x115d0e;};}function handleError(_0x5c95a0,_0x9d4535){_0x9d4535=_0x9d4535||0x1f4;return function(_0x5d3bd7){logger[_0x4857('0x2c')](_0x5d3bd7[_0x4857('0x2d')]);if(_0x5d3bd7[_0x4857('0x2e')]){delete _0x5d3bd7[_0x4857('0x2e')];}_0x5c95a0['status'](_0x9d4535)['send'](_0x5d3bd7);};}exports['index']=function(_0x5ba3aa,_0x1064ef){var _0x5b2854={},_0x5295a5={},_0x164a5c={'count':0x0,'rows':[]};var _0x4f1fa4=_['map'](db[_0x4857('0x2f')][_0x4857('0x30')],function(_0x490679){return{'name':_0x490679[_0x4857('0x31')],'type':_0x490679[_0x4857('0x32')]['key']};});_0x5295a5[_0x4857('0x33')]=_['map'](_0x4f1fa4,_0x4857('0x2e'));_0x5295a5[_0x4857('0x34')]=_[_0x4857('0x35')](_0x5ba3aa[_0x4857('0x34')]);_0x5295a5[_0x4857('0x36')]=_['intersection'](_0x5295a5['model'],_0x5295a5['query']);_0x5b2854[_0x4857('0x37')]=_[_0x4857('0x38')](_0x5295a5['model'],qs[_0x4857('0x39')](_0x5ba3aa['query']['fields']));_0x5b2854[_0x4857('0x37')]=_0x5b2854[_0x4857('0x37')]['length']?_0x5b2854[_0x4857('0x37')]:_0x5295a5[_0x4857('0x33')];if(!_0x5ba3aa['query']['hasOwnProperty']('nolimit')){_0x5b2854['limit']=qs['limit'](_0x5ba3aa['query'][_0x4857('0x21')]);_0x5b2854['offset']=qs[_0x4857('0x1f')](_0x5ba3aa[_0x4857('0x34')][_0x4857('0x1f')]);}_0x5b2854[_0x4857('0x3a')]=qs[_0x4857('0x3b')](_0x5ba3aa[_0x4857('0x34')][_0x4857('0x3b')]);_0x5b2854[_0x4857('0x3c')]=qs['filters'](_[_0x4857('0x3d')](_0x5ba3aa[_0x4857('0x34')],_0x5295a5['filters']),_0x4f1fa4);if(_0x5ba3aa[_0x4857('0x34')]['filter']){_0x5b2854['where']=_[_0x4857('0x3e')](_0x5b2854[_0x4857('0x3c')],{'$or':_[_0x4857('0x3f')](_0x4f1fa4,function(_0x1d9daa){if(_0x1d9daa[_0x4857('0x32')]!==_0x4857('0x40')){var _0x498df2={};_0x498df2[_0x1d9daa['name']]={'$like':'%'+_0x5ba3aa[_0x4857('0x34')][_0x4857('0x41')]+'%'};return _0x498df2;}})});}_0x5b2854=_[_0x4857('0x3e')]({},_0x5b2854,_0x5ba3aa[_0x4857('0x42')]);var _0x4f733a={'where':_0x5b2854['where']};return db[_0x4857('0x2f')][_0x4857('0x22')](_0x4f733a)[_0x4857('0x2a')](function(_0xb2ff4d){_0x164a5c[_0x4857('0x22')]=_0xb2ff4d;if(_0x5ba3aa[_0x4857('0x34')][_0x4857('0x43')]){_0x5b2854['include']=[{'all':!![]}];}return db['ZohoField'][_0x4857('0x44')](_0x5b2854);})['then'](function(_0x3dc1b0){_0x164a5c['rows']=_0x3dc1b0;return _0x164a5c;})[_0x4857('0x2a')](respondWithFilteredResult(_0x1064ef,_0x5b2854))[_0x4857('0x45')](handleError(_0x1064ef,null));};exports[_0x4857('0x46')]=function(_0x16237b,_0x244c41){var _0x220da2={'raw':!![],'where':{'id':_0x16237b[_0x4857('0x47')]['id']}},_0x41eac5={};_0x41eac5[_0x4857('0x33')]=_['keys'](db['ZohoField'][_0x4857('0x30')]);_0x41eac5[_0x4857('0x34')]=_[_0x4857('0x35')](_0x16237b[_0x4857('0x34')]);_0x41eac5[_0x4857('0x36')]=_['intersection'](_0x41eac5['model'],_0x41eac5[_0x4857('0x34')]);_0x220da2[_0x4857('0x37')]=_[_0x4857('0x38')](_0x41eac5[_0x4857('0x33')],qs[_0x4857('0x39')](_0x16237b[_0x4857('0x34')][_0x4857('0x39')]));_0x220da2['attributes']=_0x220da2['attributes'][_0x4857('0x48')]?_0x220da2[_0x4857('0x37')]:_0x41eac5[_0x4857('0x33')];if(_0x16237b[_0x4857('0x34')]['includeAll']){_0x220da2['include']=[{'all':!![]}];}_0x220da2=_['merge']({},_0x220da2,_0x16237b[_0x4857('0x42')]);return db[_0x4857('0x2f')][_0x4857('0x49')](_0x220da2)[_0x4857('0x2a')](handleEntityNotFound(_0x244c41,null))[_0x4857('0x2a')](respondWithResult(_0x244c41,null))[_0x4857('0x45')](handleError(_0x244c41,null));};exports[_0x4857('0x4a')]=function(_0x52ef9d,_0x1e596d){return db[_0x4857('0x2f')][_0x4857('0x4a')](_0x52ef9d[_0x4857('0x4b')],{})['then'](respondWithResult(_0x1e596d,0xc9))[_0x4857('0x45')](handleError(_0x1e596d,null));};exports[_0x4857('0x28')]=function(_0x256ab7,_0x3a49d2){if(_0x256ab7[_0x4857('0x4b')]['id']){delete _0x256ab7[_0x4857('0x4b')]['id'];}return db[_0x4857('0x2f')][_0x4857('0x49')]({'where':{'id':_0x256ab7['params']['id']}})[_0x4857('0x2a')](handleEntityNotFound(_0x3a49d2,null))[_0x4857('0x2a')](saveUpdates(_0x256ab7[_0x4857('0x4b')],null))[_0x4857('0x2a')](respondWithResult(_0x3a49d2,null))['catch'](handleError(_0x3a49d2,null));};exports[_0x4857('0x29')]=function(_0x19890b,_0x48583d){return db[_0x4857('0x2f')]['find']({'where':{'id':_0x19890b['params']['id']}})[_0x4857('0x2a')](handleEntityNotFound(_0x48583d,null))[_0x4857('0x2a')](removeEntity(_0x48583d,null))['catch'](handleError(_0x48583d,null));}; \ No newline at end of file +var _0xe9d6=['include','findAll','rows','params','keys','includeAll','catch','create','update','body','find','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','save','then','destroy','stack','name','send','index','map','ZohoField','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','options'];(function(_0x445c98,_0x132bf7){var _0x2fe913=function(_0x32e864){while(--_0x32e864){_0x445c98['push'](_0x445c98['shift']());}};_0x2fe913(++_0x132bf7);}(_0xe9d6,0x1c7));var _0x6e9d=function(_0x20ae75,_0x297684){_0x20ae75=_0x20ae75-0x0;var _0x3ea752=_0xe9d6[_0x20ae75];return _0x3ea752;};'use strict';var emlformat=require(_0x6e9d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6e9d('0x1'));var jsonpatch=require(_0x6e9d('0x2'));var rp=require(_0x6e9d('0x3'));var moment=require(_0x6e9d('0x4'));var BPromise=require(_0x6e9d('0x5'));var Mustache=require(_0x6e9d('0x6'));var util=require(_0x6e9d('0x7'));var path=require(_0x6e9d('0x8'));var sox=require('sox');var csv=require(_0x6e9d('0x9'));var ejs=require(_0x6e9d('0xa'));var fs=require('fs');var fs_extra=require(_0x6e9d('0xb'));var _=require(_0x6e9d('0xc'));var squel=require(_0x6e9d('0xd'));var crypto=require('crypto');var jsforce=require(_0x6e9d('0xe'));var deskjs=require(_0x6e9d('0xf'));var toCsv=require(_0x6e9d('0x9'));var querystring=require(_0x6e9d('0x10'));var Papa=require(_0x6e9d('0x11'));var Redis=require(_0x6e9d('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6e9d('0x13'));var logger=require(_0x6e9d('0x14'))(_0x6e9d('0x15'));var utils=require(_0x6e9d('0x16'));var config=require(_0x6e9d('0x17'));var licenseUtil=require(_0x6e9d('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x530e35,_0xccb38f){_0xccb38f=_0xccb38f||0xcc;return function(_0x16bb40){if(_0x16bb40){return _0x530e35[_0x6e9d('0x19')](_0xccb38f);}return _0x530e35[_0x6e9d('0x1a')](_0xccb38f)[_0x6e9d('0x1b')]();};}function respondWithResult(_0x4f26eb,_0xa680c7){_0xa680c7=_0xa680c7||0xc8;return function(_0x5d4690){if(_0x5d4690){return _0x4f26eb[_0x6e9d('0x1a')](_0xa680c7)[_0x6e9d('0x1c')](_0x5d4690);}};}function respondWithFilteredResult(_0x442a7e,_0x596eec){return function(_0x429012){if(_0x429012){var _0x5531b7=typeof _0x596eec['offset']===_0x6e9d('0x1d')&&typeof _0x596eec[_0x6e9d('0x1e')]===_0x6e9d('0x1d');var _0x33e83f=_0x429012[_0x6e9d('0x1f')];var _0xf02876=_0x5531b7?0x0:_0x596eec[_0x6e9d('0x20')];var _0x356e44=_0x5531b7?_0x429012[_0x6e9d('0x1f')]:_0x596eec[_0x6e9d('0x20')]+_0x596eec[_0x6e9d('0x1e')];var _0x1d4095;if(_0x356e44>=_0x33e83f){_0x356e44=_0x33e83f;_0x1d4095=0xc8;}else{_0x1d4095=0xce;}_0x442a7e[_0x6e9d('0x1a')](_0x1d4095);return _0x442a7e[_0x6e9d('0x21')]('Content-Range',_0xf02876+'-'+_0x356e44+'/'+_0x33e83f)['json'](_0x429012);}return null;};}function patchUpdates(_0x1225b9){return function(_0x1587b4){try{jsonpatch[_0x6e9d('0x22')](_0x1587b4,_0x1225b9,!![]);}catch(_0x298f22){return BPromise[_0x6e9d('0x23')](_0x298f22);}return _0x1587b4[_0x6e9d('0x24')]();};}function saveUpdates(_0x152127,_0x3a69a8){return function(_0x29715f){if(_0x29715f){return _0x29715f['update'](_0x152127)[_0x6e9d('0x25')](function(_0xc1de14){return _0xc1de14;});}return null;};}function removeEntity(_0x476a4a,_0x25cdeb){return function(_0x239e88){if(_0x239e88){return _0x239e88[_0x6e9d('0x26')]()[_0x6e9d('0x25')](function(){_0x476a4a[_0x6e9d('0x1a')](0xcc)[_0x6e9d('0x1b')]();});}};}function handleEntityNotFound(_0x1644c8,_0x5ca0b8){return function(_0x30ebf1){if(!_0x30ebf1){_0x1644c8[_0x6e9d('0x19')](0x194);}return _0x30ebf1;};}function handleError(_0x53121d,_0x5ba6ca){_0x5ba6ca=_0x5ba6ca||0x1f4;return function(_0x48c964){logger['error'](_0x48c964[_0x6e9d('0x27')]);if(_0x48c964[_0x6e9d('0x28')]){delete _0x48c964[_0x6e9d('0x28')];}_0x53121d[_0x6e9d('0x1a')](_0x5ba6ca)[_0x6e9d('0x29')](_0x48c964);};}exports[_0x6e9d('0x2a')]=function(_0x4b6421,_0x24911f){var _0x3dba1={},_0x3cb52b={},_0x71c525={'count':0x0,'rows':[]};var _0x45669c=_[_0x6e9d('0x2b')](db[_0x6e9d('0x2c')][_0x6e9d('0x2d')],function(_0x228b15){return{'name':_0x228b15['fieldName'],'type':_0x228b15[_0x6e9d('0x2e')][_0x6e9d('0x2f')]};});_0x3cb52b[_0x6e9d('0x30')]=_[_0x6e9d('0x2b')](_0x45669c,_0x6e9d('0x28'));_0x3cb52b[_0x6e9d('0x31')]=_['keys'](_0x4b6421[_0x6e9d('0x31')]);_0x3cb52b[_0x6e9d('0x32')]=_[_0x6e9d('0x33')](_0x3cb52b[_0x6e9d('0x30')],_0x3cb52b[_0x6e9d('0x31')]);_0x3dba1['attributes']=_[_0x6e9d('0x33')](_0x3cb52b[_0x6e9d('0x30')],qs[_0x6e9d('0x34')](_0x4b6421['query'][_0x6e9d('0x34')]));_0x3dba1[_0x6e9d('0x35')]=_0x3dba1['attributes'][_0x6e9d('0x36')]?_0x3dba1[_0x6e9d('0x35')]:_0x3cb52b[_0x6e9d('0x30')];if(!_0x4b6421[_0x6e9d('0x31')]['hasOwnProperty'](_0x6e9d('0x37'))){_0x3dba1[_0x6e9d('0x1e')]=qs['limit'](_0x4b6421[_0x6e9d('0x31')][_0x6e9d('0x1e')]);_0x3dba1['offset']=qs[_0x6e9d('0x20')](_0x4b6421[_0x6e9d('0x31')]['offset']);}_0x3dba1[_0x6e9d('0x38')]=qs[_0x6e9d('0x39')](_0x4b6421[_0x6e9d('0x31')][_0x6e9d('0x39')]);_0x3dba1[_0x6e9d('0x3a')]=qs['filters'](_[_0x6e9d('0x3b')](_0x4b6421[_0x6e9d('0x31')],_0x3cb52b['filters']),_0x45669c);if(_0x4b6421[_0x6e9d('0x31')][_0x6e9d('0x3c')]){_0x3dba1[_0x6e9d('0x3a')]=_['merge'](_0x3dba1[_0x6e9d('0x3a')],{'$or':_[_0x6e9d('0x2b')](_0x45669c,function(_0x56a4fd){if(_0x56a4fd[_0x6e9d('0x2e')]!=='VIRTUAL'){var _0x3d776e={};_0x3d776e[_0x56a4fd[_0x6e9d('0x28')]]={'$like':'%'+_0x4b6421[_0x6e9d('0x31')]['filter']+'%'};return _0x3d776e;}})});}_0x3dba1=_[_0x6e9d('0x3d')]({},_0x3dba1,_0x4b6421[_0x6e9d('0x3e')]);var _0x2aeadf={'where':_0x3dba1['where']};return db[_0x6e9d('0x2c')]['count'](_0x2aeadf)[_0x6e9d('0x25')](function(_0x20a4ac){_0x71c525[_0x6e9d('0x1f')]=_0x20a4ac;if(_0x4b6421[_0x6e9d('0x31')]['includeAll']){_0x3dba1[_0x6e9d('0x3f')]=[{'all':!![]}];}return db[_0x6e9d('0x2c')][_0x6e9d('0x40')](_0x3dba1);})[_0x6e9d('0x25')](function(_0x26106a){_0x71c525[_0x6e9d('0x41')]=_0x26106a;return _0x71c525;})[_0x6e9d('0x25')](respondWithFilteredResult(_0x24911f,_0x3dba1))['catch'](handleError(_0x24911f,null));};exports['show']=function(_0x4d4b79,_0x51c360){var _0x1367ba={'raw':!![],'where':{'id':_0x4d4b79[_0x6e9d('0x42')]['id']}},_0x4ea2b5={};_0x4ea2b5[_0x6e9d('0x30')]=_[_0x6e9d('0x43')](db[_0x6e9d('0x2c')][_0x6e9d('0x2d')]);_0x4ea2b5[_0x6e9d('0x31')]=_[_0x6e9d('0x43')](_0x4d4b79[_0x6e9d('0x31')]);_0x4ea2b5['filters']=_[_0x6e9d('0x33')](_0x4ea2b5[_0x6e9d('0x30')],_0x4ea2b5[_0x6e9d('0x31')]);_0x1367ba[_0x6e9d('0x35')]=_[_0x6e9d('0x33')](_0x4ea2b5['model'],qs['fields'](_0x4d4b79[_0x6e9d('0x31')][_0x6e9d('0x34')]));_0x1367ba[_0x6e9d('0x35')]=_0x1367ba[_0x6e9d('0x35')]['length']?_0x1367ba[_0x6e9d('0x35')]:_0x4ea2b5[_0x6e9d('0x30')];if(_0x4d4b79[_0x6e9d('0x31')][_0x6e9d('0x44')]){_0x1367ba[_0x6e9d('0x3f')]=[{'all':!![]}];}_0x1367ba=_['merge']({},_0x1367ba,_0x4d4b79[_0x6e9d('0x3e')]);return db['ZohoField']['find'](_0x1367ba)['then'](handleEntityNotFound(_0x51c360,null))['then'](respondWithResult(_0x51c360,null))[_0x6e9d('0x45')](handleError(_0x51c360,null));};exports[_0x6e9d('0x46')]=function(_0x20bffa,_0x5abf6a){return db[_0x6e9d('0x2c')][_0x6e9d('0x46')](_0x20bffa['body'],{})[_0x6e9d('0x25')](respondWithResult(_0x5abf6a,0xc9))[_0x6e9d('0x45')](handleError(_0x5abf6a,null));};exports[_0x6e9d('0x47')]=function(_0x25c60f,_0x11dce3){if(_0x25c60f[_0x6e9d('0x48')]['id']){delete _0x25c60f[_0x6e9d('0x48')]['id'];}return db[_0x6e9d('0x2c')][_0x6e9d('0x49')]({'where':{'id':_0x25c60f[_0x6e9d('0x42')]['id']}})['then'](handleEntityNotFound(_0x11dce3,null))[_0x6e9d('0x25')](saveUpdates(_0x25c60f['body'],null))['then'](respondWithResult(_0x11dce3,null))[_0x6e9d('0x45')](handleError(_0x11dce3,null));};exports[_0x6e9d('0x26')]=function(_0x10d9ce,_0x1df256){return db[_0x6e9d('0x2c')][_0x6e9d('0x49')]({'where':{'id':_0x10d9ce[_0x6e9d('0x42')]['id']}})[_0x6e9d('0x25')](handleEntityNotFound(_0x1df256,null))[_0x6e9d('0x25')](removeEntity(_0x1df256,null))[_0x6e9d('0x45')](handleError(_0x1df256,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 6a89abc..d5c8310 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 _0xadb5=['ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId','util','api','moment','bluebird','path','rimraf','../../config/environment','exports','define'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xadb5,0xad));var _0x5adb=function(_0x566303,_0xf38824){_0x566303=_0x566303-0x0;var _0x9fc5ae=_0xadb5[_0x566303];return _0x9fc5ae;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var logger=require('../../config/logger')(_0x5adb('0x1'));var moment=require(_0x5adb('0x2'));var BPromise=require(_0x5adb('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5adb('0x4'));var rimraf=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var attributes=require('./intZohoField.attributes');module[_0x5adb('0x7')]=function(_0x168d89,_0x3e2555){return _0x168d89[_0x5adb('0x8')](_0x5adb('0x9'),attributes,{'tableName':_0x5adb('0xa'),'paranoid':![],'indexes':[{'name':_0x5adb('0xb'),'fields':[_0x5adb('0xc'),_0x5adb('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1623=['zoho_unique_index','idField','FieldId','lodash','api','moment','bluebird','request-promise','path','./intZohoField.attributes','ZohoField','int_zoho_fields'];(function(_0x2043f8,_0x2d6764){var _0x4aad83=function(_0x407975){while(--_0x407975){_0x2043f8['push'](_0x2043f8['shift']());}};_0x4aad83(++_0x2d6764);}(_0x1623,0xab));var _0x3162=function(_0x31d8c5,_0x354b77){_0x31d8c5=_0x31d8c5-0x0;var _0x37957e=_0x1623[_0x31d8c5];return _0x37957e;};'use strict';var _=require(_0x3162('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3162('0x1'));var moment=require(_0x3162('0x2'));var BPromise=require(_0x3162('0x3'));var rp=require(_0x3162('0x4'));var fs=require('fs');var path=require(_0x3162('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3162('0x6'));module['exports']=function(_0x1b55f2,_0x428de6){return _0x1b55f2['define'](_0x3162('0x7'),attributes,{'tableName':_0x3162('0x8'),'paranoid':![],'indexes':[{'name':_0x3162('0x9'),'fields':[_0x3162('0xa'),_0x3162('0xb')],'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 58532ed..46c30a4 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 _0xac08=['code','message','catch','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','ZohoField,\x20%s,\x20%s','debug','ZohoField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x3c81b5,_0x3f5ed7){var _0x5888c4=function(_0x4e65b0){while(--_0x4e65b0){_0x3c81b5['push'](_0x3c81b5['shift']());}};_0x5888c4(++_0x3f5ed7);}(_0xac08,0x75));var _0x8ac0=function(_0x3bb35b,_0x51dfd3){_0x3bb35b=_0x3bb35b-0x0;var _0x547598=_0xac08[_0x3bb35b];return _0x547598;};'use strict';var _=require('lodash');var util=require(_0x8ac0('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8ac0('0x1'));var fs=require('fs');var Redis=require(_0x8ac0('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x8ac0('0x3'));var logger=require(_0x8ac0('0x4'))(_0x8ac0('0x5'));var config=require(_0x8ac0('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x8ac0('0x7')][_0x8ac0('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x55ec7b,_0x15a9d9,_0x12c474){return new BPromise(function(_0x3b9c2d,_0x2be86f){return client['request'](_0x55ec7b,_0x12c474)[_0x8ac0('0x9')](function(_0x54948a){logger['info'](_0x8ac0('0xa'),_0x15a9d9,'request\x20sent');logger[_0x8ac0('0xb')](_0x8ac0('0xc'),_0x15a9d9,_0x8ac0('0xd'),JSON[_0x8ac0('0xe')](_0x54948a));if(_0x54948a['error']){if(_0x54948a[_0x8ac0('0xf')][_0x8ac0('0x10')]===0x1f4){logger[_0x8ac0('0xf')](_0x8ac0('0xa'),_0x15a9d9,_0x54948a[_0x8ac0('0xf')]['message']);return _0x2be86f(_0x54948a['error'][_0x8ac0('0x11')]);}logger[_0x8ac0('0xf')](_0x8ac0('0xa'),_0x15a9d9,_0x54948a[_0x8ac0('0xf')][_0x8ac0('0x11')]);return _0x3b9c2d(_0x54948a[_0x8ac0('0xf')][_0x8ac0('0x11')]);}else{logger['info'](_0x8ac0('0xa'),_0x15a9d9,_0x8ac0('0xd'));_0x3b9c2d(_0x54948a['result'][_0x8ac0('0x11')]);}})[_0x8ac0('0x12')](function(_0x264bfc){logger[_0x8ac0('0xf')]('ZohoField,\x20%s,\x20%s',_0x15a9d9,_0x264bfc);_0x2be86f(_0x264bfc);});});} \ No newline at end of file +var _0x1e4a=['debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','request','then','info','request\x20sent'];(function(_0x4e3e87,_0x5b53f6){var _0x142650=function(_0x60246d){while(--_0x60246d){_0x4e3e87['push'](_0x4e3e87['shift']());}};_0x142650(++_0x5b53f6);}(_0x1e4a,0x138));var _0xa1e4=function(_0x5d759e,_0x1f4584){_0x5d759e=_0x5d759e-0x0;var _0x344b8c=_0x1e4a[_0x5d759e];return _0x344b8c;};'use strict';var _=require(_0xa1e4('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa1e4('0x1'));var rs=require(_0xa1e4('0x2'));var fs=require('fs');var Redis=require(_0xa1e4('0x3'));var db=require(_0xa1e4('0x4'))['db'];var utils=require(_0xa1e4('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xa1e4('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xeb0418,_0x4b3709,_0x5ae15b){return new BPromise(function(_0x199eaf,_0x3573fa){return client[_0xa1e4('0x7')](_0xeb0418,_0x5ae15b)[_0xa1e4('0x8')](function(_0x5dab98){logger[_0xa1e4('0x9')]('ZohoField,\x20%s,\x20%s',_0x4b3709,_0xa1e4('0xa'));logger[_0xa1e4('0xb')](_0xa1e4('0xc'),_0x4b3709,_0xa1e4('0xa'),JSON[_0xa1e4('0xd')](_0x5dab98));if(_0x5dab98[_0xa1e4('0xe')]){if(_0x5dab98[_0xa1e4('0xe')][_0xa1e4('0xf')]===0x1f4){logger['error']('ZohoField,\x20%s,\x20%s',_0x4b3709,_0x5dab98[_0xa1e4('0xe')][_0xa1e4('0x10')]);return _0x3573fa(_0x5dab98[_0xa1e4('0xe')]['message']);}logger[_0xa1e4('0xe')]('ZohoField,\x20%s,\x20%s',_0x4b3709,_0x5dab98[_0xa1e4('0xe')][_0xa1e4('0x10')]);return _0x199eaf(_0x5dab98['error'][_0xa1e4('0x10')]);}else{logger[_0xa1e4('0x9')]('ZohoField,\x20%s,\x20%s',_0x4b3709,_0xa1e4('0xa'));_0x199eaf(_0x5dab98[_0xa1e4('0x11')]['message']);}})[_0xa1e4('0x12')](function(_0x58c615){logger[_0xa1e4('0xe')]('ZohoField,\x20%s,\x20%s',_0x4b3709,_0x58c615);_0x3573fa(_0x58c615);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index e87fe1f..d5dc38c 100644 --- a/server/api/integration/index.js +++ b/server/api/integration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x3e493c,_0xa502e9){var _0x107e89=function(_0x10eda4){while(--_0x10eda4){_0x3e493c['push'](_0x3e493c['shift']());}};_0x107e89(++_0xa502e9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0xdbaf5f,_0x5e9f6f){var _0x4d69ce=function(_0xe75d58){while(--_0xe75d58){_0xdbaf5f['push'](_0xdbaf5f['shift']());}};_0x4d69ce(++_0x5e9f6f);}(_0x70e0,0x17b));var _0x070e=function(_0x17fc19,_0x3dc06b){_0x17fc19=_0x17fc19-0x0;var _0x10218b=_0x70e0[_0x17fc19];return _0x10218b;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 23a62e7..f4b4d25 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 _0xa03f=['sequelize','exports','STRING','unique_name_and_version','INTEGER','BOOLEAN','state'];(function(_0x2f43ad,_0x12fb38){var _0x1d736a=function(_0x42b796){while(--_0x42b796){_0x2f43ad['push'](_0x2f43ad['shift']());}};_0x1d736a(++_0x12fb38);}(_0xa03f,0x1ce));var _0xfa03=function(_0x33daec,_0xede941){_0x33daec=_0x33daec-0x0;var _0x3f8d8a=_0xa03f[_0x33daec];return _0x3f8d8a;};'use strict';var Sequelize=require(_0xfa03('0x0'));module[_0xfa03('0x1')]={'name':{'type':Sequelize[_0xfa03('0x2')],'allowNull':![],'unique':_0xfa03('0x3')},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xfa03('0x3')},'main':{'type':Sequelize[_0xfa03('0x2')],'defaultValue':'app.js'},'filename':{'type':Sequelize[_0xfa03('0x2')]},'path':{'type':Sequelize[_0xfa03('0x2')]},'type':{'type':Sequelize[_0xfa03('0x2')]},'size':{'type':Sequelize[_0xfa03('0x4')]},'active':{'type':Sequelize[_0xfa03('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0xfa03('0x2')]},'logo':{'type':Sequelize[_0xfa03('0x2')]},'state':{'type':Sequelize['STRING'],'unique':_0xfa03('0x6')},'description':{'type':Sequelize[_0xfa03('0x2')]},'title':{'type':Sequelize[_0xfa03('0x2')]},'remoteUri':{'type':Sequelize[_0xfa03('0x2')]},'link':{'type':Sequelize[_0xfa03('0x2')],'defaultValue':'#'}}; \ No newline at end of file +var _0x6b5c=['INTEGER','state','sequelize','exports','unique_name_and_version','STRING','app.js'];(function(_0x3be860,_0x115a5f){var _0x46882a=function(_0x116cdc){while(--_0x116cdc){_0x3be860['push'](_0x3be860['shift']());}};_0x46882a(++_0x115a5f);}(_0x6b5c,0xdb));var _0xc6b5=function(_0x13945b,_0x289c94){_0x13945b=_0x13945b-0x0;var _0x1b1643=_0x6b5c[_0x13945b];return _0x1b1643;};'use strict';var Sequelize=require(_0xc6b5('0x0'));module[_0xc6b5('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xc6b5('0x2')},'version':{'type':Sequelize[_0xc6b5('0x3')],'allowNull':![],'unique':_0xc6b5('0x2')},'main':{'type':Sequelize[_0xc6b5('0x3')],'defaultValue':_0xc6b5('0x4')},'filename':{'type':Sequelize[_0xc6b5('0x3')]},'path':{'type':Sequelize[_0xc6b5('0x3')]},'type':{'type':Sequelize[_0xc6b5('0x3')]},'size':{'type':Sequelize[_0xc6b5('0x5')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize[_0xc6b5('0x3')]},'state':{'type':Sequelize[_0xc6b5('0x3')],'unique':_0xc6b5('0x6')},'description':{'type':Sequelize[_0xc6b5('0x3')]},'title':{'type':Sequelize[_0xc6b5('0x3')]},'remoteUri':{'type':Sequelize[_0xc6b5('0x3')]},'link':{'type':Sequelize[_0xc6b5('0x3')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 1270d1b..85c26ab 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 _0x9f0e=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','update','then','destroy','end','error','name','send','index','map','Integration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','options','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js'];(function(_0x2f68f6,_0xdf99dd){var _0x5025e1=function(_0x29a1d3){while(--_0x29a1d3){_0x2f68f6['push'](_0x2f68f6['shift']());}};_0x5025e1(++_0xdf99dd);}(_0x9f0e,0x116));var _0xe9f0=function(_0x215ac8,_0x48af9d){_0x215ac8=_0x215ac8-0x0;var _0xb62fee=_0x9f0e[_0x215ac8];return _0xb62fee;};'use strict';var emlformat=require(_0xe9f0('0x0'));var rimraf=require(_0xe9f0('0x1'));var zipdir=require(_0xe9f0('0x2'));var jsonpatch=require(_0xe9f0('0x3'));var rp=require(_0xe9f0('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe9f0('0x5'));var util=require(_0xe9f0('0x6'));var path=require(_0xe9f0('0x7'));var sox=require(_0xe9f0('0x8'));var csv=require(_0xe9f0('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe9f0('0xa'));var squel=require(_0xe9f0('0xb'));var crypto=require(_0xe9f0('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe9f0('0xd'));var toCsv=require(_0xe9f0('0x9'));var querystring=require(_0xe9f0('0xe'));var Papa=require(_0xe9f0('0xf'));var Redis=require(_0xe9f0('0x10'));var authService=require(_0xe9f0('0x11'));var qs=require(_0xe9f0('0x12'));var as=require(_0xe9f0('0x13'));var hardwareService=require(_0xe9f0('0x14'));var logger=require('../../config/logger')(_0xe9f0('0x15'));var utils=require(_0xe9f0('0x16'));var config=require(_0xe9f0('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xe9f0('0x18'))['db'];function respondWithStatusCode(_0x586763,_0x367545){_0x367545=_0x367545||0xcc;return function(_0xd82420){if(_0xd82420){return _0x586763[_0xe9f0('0x19')](_0x367545);}return _0x586763[_0xe9f0('0x1a')](_0x367545)['end']();};}function respondWithResult(_0x2cf75d,_0x5a10c6){_0x5a10c6=_0x5a10c6||0xc8;return function(_0x1e3ba8){if(_0x1e3ba8){return _0x2cf75d[_0xe9f0('0x1a')](_0x5a10c6)[_0xe9f0('0x1b')](_0x1e3ba8);}};}function respondWithFilteredResult(_0x59320d,_0x28bfac){return function(_0x33e9e4){if(_0x33e9e4){var _0x2e68ef=typeof _0x28bfac['offset']===_0xe9f0('0x1c')&&typeof _0x28bfac[_0xe9f0('0x1d')]===_0xe9f0('0x1c');var _0xd71ac8=_0x33e9e4[_0xe9f0('0x1e')];var _0x2ab12b=_0x2e68ef?0x0:_0x28bfac[_0xe9f0('0x1f')];var _0x59bf5a=_0x2e68ef?_0x33e9e4[_0xe9f0('0x1e')]:_0x28bfac[_0xe9f0('0x1f')]+_0x28bfac[_0xe9f0('0x1d')];var _0x5c4182;if(_0x59bf5a>=_0xd71ac8){_0x59bf5a=_0xd71ac8;_0x5c4182=0xc8;}else{_0x5c4182=0xce;}_0x59320d[_0xe9f0('0x1a')](_0x5c4182);return _0x59320d[_0xe9f0('0x20')](_0xe9f0('0x21'),_0x2ab12b+'-'+_0x59bf5a+'/'+_0xd71ac8)[_0xe9f0('0x1b')](_0x33e9e4);}return null;};}function patchUpdates(_0x5ba788){return function(_0x33f143){try{jsonpatch[_0xe9f0('0x22')](_0x33f143,_0x5ba788,!![]);}catch(_0x583687){return BPromise['reject'](_0x583687);}return _0x33f143['save']();};}function saveUpdates(_0x12fe9f,_0xa1ddc){return function(_0x1211ae){if(_0x1211ae){return _0x1211ae[_0xe9f0('0x23')](_0x12fe9f)[_0xe9f0('0x24')](function(_0x4a5c27){return _0x4a5c27;});}return null;};}function removeEntity(_0x229fe0,_0x38b7ee){return function(_0x437d43){if(_0x437d43){return _0x437d43[_0xe9f0('0x25')]()[_0xe9f0('0x24')](function(){_0x229fe0[_0xe9f0('0x1a')](0xcc)[_0xe9f0('0x26')]();});}};}function handleEntityNotFound(_0x1321bb,_0x3c4ba9){return function(_0x3fce54){if(!_0x3fce54){_0x1321bb['sendStatus'](0x194);}return _0x3fce54;};}function handleError(_0x371095,_0x27541f){_0x27541f=_0x27541f||0x1f4;return function(_0x2ddfba){logger[_0xe9f0('0x27')](_0x2ddfba['stack']);if(_0x2ddfba[_0xe9f0('0x28')]){delete _0x2ddfba[_0xe9f0('0x28')];}_0x371095[_0xe9f0('0x1a')](_0x27541f)[_0xe9f0('0x29')](_0x2ddfba);};}exports[_0xe9f0('0x2a')]=function(_0x5457f6,_0x130f96){var _0xdc16bc={},_0x44fb5b={},_0xab3d81={'count':0x0,'rows':[]};var _0xa27c84=_[_0xe9f0('0x2b')](db[_0xe9f0('0x2c')][_0xe9f0('0x2d')],function(_0x2b6503){return{'name':_0x2b6503[_0xe9f0('0x2e')],'type':_0x2b6503[_0xe9f0('0x2f')][_0xe9f0('0x30')]};});_0x44fb5b[_0xe9f0('0x31')]=_[_0xe9f0('0x2b')](_0xa27c84,_0xe9f0('0x28'));_0x44fb5b[_0xe9f0('0x32')]=_[_0xe9f0('0x33')](_0x5457f6[_0xe9f0('0x32')]);_0x44fb5b[_0xe9f0('0x34')]=_[_0xe9f0('0x35')](_0x44fb5b[_0xe9f0('0x31')],_0x44fb5b[_0xe9f0('0x32')]);_0xdc16bc[_0xe9f0('0x36')]=_[_0xe9f0('0x35')](_0x44fb5b['model'],qs['fields'](_0x5457f6['query'][_0xe9f0('0x37')]));_0xdc16bc['attributes']=_0xdc16bc[_0xe9f0('0x36')][_0xe9f0('0x38')]?_0xdc16bc['attributes']:_0x44fb5b[_0xe9f0('0x31')];if(!_0x5457f6['query']['hasOwnProperty']('nolimit')){_0xdc16bc[_0xe9f0('0x1d')]=qs[_0xe9f0('0x1d')](_0x5457f6['query'][_0xe9f0('0x1d')]);_0xdc16bc[_0xe9f0('0x1f')]=qs[_0xe9f0('0x1f')](_0x5457f6['query']['offset']);}_0xdc16bc[_0xe9f0('0x39')]=qs[_0xe9f0('0x3a')](_0x5457f6[_0xe9f0('0x32')]['sort']);_0xdc16bc[_0xe9f0('0x3b')]=qs[_0xe9f0('0x34')](_[_0xe9f0('0x3c')](_0x5457f6[_0xe9f0('0x32')],_0x44fb5b[_0xe9f0('0x34')]),_0xa27c84);if(_0x5457f6['query'][_0xe9f0('0x3d')]){_0xdc16bc[_0xe9f0('0x3b')]=_[_0xe9f0('0x3e')](_0xdc16bc['where'],{'$or':_[_0xe9f0('0x2b')](_0xa27c84,function(_0xbec11f){if(_0xbec11f['type']!==_0xe9f0('0x3f')){var _0x5154c3={};_0x5154c3[_0xbec11f[_0xe9f0('0x28')]]={'$like':'%'+_0x5457f6['query']['filter']+'%'};return _0x5154c3;}})});}_0xdc16bc=_['merge']({},_0xdc16bc,_0x5457f6['options']);var _0x5165f7={'where':_0xdc16bc[_0xe9f0('0x3b')]};return db[_0xe9f0('0x2c')][_0xe9f0('0x1e')](_0x5165f7)[_0xe9f0('0x24')](function(_0x2560c6){_0xab3d81[_0xe9f0('0x1e')]=_0x2560c6;if(_0x5457f6[_0xe9f0('0x32')][_0xe9f0('0x40')]){_0xdc16bc[_0xe9f0('0x41')]=[{'all':!![]}];}return db['Integration'][_0xe9f0('0x42')](_0xdc16bc);})[_0xe9f0('0x24')](function(_0x36b00a){_0xab3d81['rows']=_0x36b00a;return _0xab3d81;})['then'](respondWithFilteredResult(_0x130f96,_0xdc16bc))[_0xe9f0('0x43')](handleError(_0x130f96,null));};exports['show']=function(_0x297689,_0x52613a){var _0x314f0e={'raw':![],'where':{'id':_0x297689['params']['id']}},_0x42d9d2={};_0x42d9d2[_0xe9f0('0x31')]=_[_0xe9f0('0x33')](db[_0xe9f0('0x2c')][_0xe9f0('0x2d')]);_0x42d9d2[_0xe9f0('0x32')]=_['keys'](_0x297689[_0xe9f0('0x32')]);_0x42d9d2[_0xe9f0('0x34')]=_[_0xe9f0('0x35')](_0x42d9d2[_0xe9f0('0x31')],_0x42d9d2[_0xe9f0('0x32')]);_0x314f0e['attributes']=_[_0xe9f0('0x35')](_0x42d9d2['model'],qs['fields'](_0x297689[_0xe9f0('0x32')][_0xe9f0('0x37')]));_0x314f0e['attributes']=_0x314f0e[_0xe9f0('0x36')][_0xe9f0('0x38')]?_0x314f0e[_0xe9f0('0x36')]:_0x42d9d2[_0xe9f0('0x31')];if(_0x297689[_0xe9f0('0x32')][_0xe9f0('0x40')]){_0x314f0e[_0xe9f0('0x41')]=[{'all':!![]}];}_0x314f0e=_['merge']({},_0x314f0e,_0x297689[_0xe9f0('0x44')]);return db['Integration'][_0xe9f0('0x45')](_0x314f0e)['then'](handleEntityNotFound(_0x52613a,null))[_0xe9f0('0x24')](respondWithResult(_0x52613a,null))['catch'](handleError(_0x52613a,null));};exports[_0xe9f0('0x46')]=function(_0x2023b4,_0x422324){return db['Integration'][_0xe9f0('0x46')](_0x2023b4[_0xe9f0('0x47')],{})[_0xe9f0('0x24')](respondWithResult(_0x422324,0xc9))[_0xe9f0('0x43')](handleError(_0x422324,null));};exports[_0xe9f0('0x23')]=function(_0x135175,_0x6ece3f){if(_0x135175[_0xe9f0('0x47')]['id']){delete _0x135175[_0xe9f0('0x47')]['id'];}return db[_0xe9f0('0x2c')][_0xe9f0('0x45')]({'where':{'id':_0x135175[_0xe9f0('0x48')]['id']}})['then'](handleEntityNotFound(_0x6ece3f,null))['then'](saveUpdates(_0x135175[_0xe9f0('0x47')],null))[_0xe9f0('0x24')](respondWithResult(_0x6ece3f,null))[_0xe9f0('0x43')](handleError(_0x6ece3f,null));};exports['destroy']=function(_0x1ac381,_0x4d8b2e){return db[_0xe9f0('0x2c')][_0xe9f0('0x45')]({'where':{'id':_0x1ac381[_0xe9f0('0x48')]['id']}})[_0xe9f0('0x24')](handleEntityNotFound(_0x4d8b2e,null))['then'](removeEntity(_0x4d8b2e,null))[_0xe9f0('0x43')](handleError(_0x4d8b2e,null));}; \ No newline at end of file +var _0x9536=['includeAll','include','findAll','rows','catch','params','rawAttributes','intersection','length','options','find','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','error','stack','name','index','map','Integration','fieldName','model','query','keys','filters','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','then'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9536,0x179));var _0x6953=function(_0x205e5a,_0x5c19fb){_0x205e5a=_0x205e5a-0x0;var _0x10da58=_0x9536[_0x205e5a];return _0x10da58;};'use strict';var emlformat=require(_0x6953('0x0'));var rimraf=require(_0x6953('0x1'));var zipdir=require(_0x6953('0x2'));var jsonpatch=require(_0x6953('0x3'));var rp=require('request-promise');var moment=require(_0x6953('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6953('0x5'));var util=require(_0x6953('0x6'));var path=require(_0x6953('0x7'));var sox=require(_0x6953('0x8'));var csv=require(_0x6953('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6953('0xa'));var _=require(_0x6953('0xb'));var squel=require(_0x6953('0xc'));var crypto=require(_0x6953('0xd'));var jsforce=require(_0x6953('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x6953('0x9'));var querystring=require(_0x6953('0xf'));var Papa=require(_0x6953('0x10'));var Redis=require('ioredis');var authService=require(_0x6953('0x11'));var qs=require(_0x6953('0x12'));var as=require(_0x6953('0x13'));var hardwareService=require(_0x6953('0x14'));var logger=require(_0x6953('0x15'))(_0x6953('0x16'));var utils=require(_0x6953('0x17'));var config=require(_0x6953('0x18'));var licenseUtil=require(_0x6953('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x358388,_0x513dd0){_0x513dd0=_0x513dd0||0xcc;return function(_0x8de91e){if(_0x8de91e){return _0x358388[_0x6953('0x1a')](_0x513dd0);}return _0x358388[_0x6953('0x1b')](_0x513dd0)[_0x6953('0x1c')]();};}function respondWithResult(_0x1b5221,_0x244713){_0x244713=_0x244713||0xc8;return function(_0x175fa9){if(_0x175fa9){return _0x1b5221[_0x6953('0x1b')](_0x244713)[_0x6953('0x1d')](_0x175fa9);}};}function respondWithFilteredResult(_0x31d182,_0xae5515){return function(_0x548473){if(_0x548473){var _0x5f49db=typeof _0xae5515[_0x6953('0x1e')]===_0x6953('0x1f')&&typeof _0xae5515[_0x6953('0x20')]===_0x6953('0x1f');var _0x510d46=_0x548473[_0x6953('0x21')];var _0x2da771=_0x5f49db?0x0:_0xae5515['offset'];var _0x10858a=_0x5f49db?_0x548473[_0x6953('0x21')]:_0xae5515[_0x6953('0x1e')]+_0xae5515[_0x6953('0x20')];var _0xc714d3;if(_0x10858a>=_0x510d46){_0x10858a=_0x510d46;_0xc714d3=0xc8;}else{_0xc714d3=0xce;}_0x31d182['status'](_0xc714d3);return _0x31d182[_0x6953('0x22')](_0x6953('0x23'),_0x2da771+'-'+_0x10858a+'/'+_0x510d46)[_0x6953('0x1d')](_0x548473);}return null;};}function patchUpdates(_0x2ba433){return function(_0x41f021){try{jsonpatch['apply'](_0x41f021,_0x2ba433,!![]);}catch(_0xf96d07){return BPromise[_0x6953('0x24')](_0xf96d07);}return _0x41f021['save']();};}function saveUpdates(_0x317979,_0x40c9d1){return function(_0xb92529){if(_0xb92529){return _0xb92529[_0x6953('0x25')](_0x317979)['then'](function(_0x37f339){return _0x37f339;});}return null;};}function removeEntity(_0x231cb2,_0x2a7f6a){return function(_0x508ea7){if(_0x508ea7){return _0x508ea7['destroy']()['then'](function(){_0x231cb2[_0x6953('0x1b')](0xcc)[_0x6953('0x1c')]();});}};}function handleEntityNotFound(_0x550be4,_0x1a32f4){return function(_0x587df0){if(!_0x587df0){_0x550be4[_0x6953('0x1a')](0x194);}return _0x587df0;};}function handleError(_0x2bf39b,_0xcdbce8){_0xcdbce8=_0xcdbce8||0x1f4;return function(_0x2cc01e){logger[_0x6953('0x26')](_0x2cc01e[_0x6953('0x27')]);if(_0x2cc01e['name']){delete _0x2cc01e[_0x6953('0x28')];}_0x2bf39b[_0x6953('0x1b')](_0xcdbce8)['send'](_0x2cc01e);};}exports[_0x6953('0x29')]=function(_0x4af39d,_0x173b3c){var _0x3b1175={},_0x426c7c={},_0x4b0325={'count':0x0,'rows':[]};var _0x131992=_[_0x6953('0x2a')](db[_0x6953('0x2b')]['rawAttributes'],function(_0x4c49fc){return{'name':_0x4c49fc[_0x6953('0x2c')],'type':_0x4c49fc['type']['key']};});_0x426c7c[_0x6953('0x2d')]=_[_0x6953('0x2a')](_0x131992,_0x6953('0x28'));_0x426c7c[_0x6953('0x2e')]=_[_0x6953('0x2f')](_0x4af39d['query']);_0x426c7c[_0x6953('0x30')]=_['intersection'](_0x426c7c[_0x6953('0x2d')],_0x426c7c[_0x6953('0x2e')]);_0x3b1175['attributes']=_['intersection'](_0x426c7c[_0x6953('0x2d')],qs[_0x6953('0x31')](_0x4af39d[_0x6953('0x2e')]['fields']));_0x3b1175[_0x6953('0x32')]=_0x3b1175['attributes']['length']?_0x3b1175['attributes']:_0x426c7c['model'];if(!_0x4af39d[_0x6953('0x2e')][_0x6953('0x33')](_0x6953('0x34'))){_0x3b1175[_0x6953('0x20')]=qs[_0x6953('0x20')](_0x4af39d[_0x6953('0x2e')]['limit']);_0x3b1175[_0x6953('0x1e')]=qs['offset'](_0x4af39d[_0x6953('0x2e')]['offset']);}_0x3b1175[_0x6953('0x35')]=qs[_0x6953('0x36')](_0x4af39d[_0x6953('0x2e')][_0x6953('0x36')]);_0x3b1175['where']=qs[_0x6953('0x30')](_[_0x6953('0x37')](_0x4af39d[_0x6953('0x2e')],_0x426c7c[_0x6953('0x30')]),_0x131992);if(_0x4af39d[_0x6953('0x2e')][_0x6953('0x38')]){_0x3b1175[_0x6953('0x39')]=_[_0x6953('0x3a')](_0x3b1175[_0x6953('0x39')],{'$or':_[_0x6953('0x2a')](_0x131992,function(_0x2d9d81){if(_0x2d9d81['type']!==_0x6953('0x3b')){var _0x3c03ab={};_0x3c03ab[_0x2d9d81[_0x6953('0x28')]]={'$like':'%'+_0x4af39d['query']['filter']+'%'};return _0x3c03ab;}})});}_0x3b1175=_[_0x6953('0x3a')]({},_0x3b1175,_0x4af39d['options']);var _0x5abaf2={'where':_0x3b1175[_0x6953('0x39')]};return db[_0x6953('0x2b')]['count'](_0x5abaf2)[_0x6953('0x3c')](function(_0x263728){_0x4b0325[_0x6953('0x21')]=_0x263728;if(_0x4af39d[_0x6953('0x2e')][_0x6953('0x3d')]){_0x3b1175[_0x6953('0x3e')]=[{'all':!![]}];}return db['Integration'][_0x6953('0x3f')](_0x3b1175);})[_0x6953('0x3c')](function(_0x30a27a){_0x4b0325[_0x6953('0x40')]=_0x30a27a;return _0x4b0325;})[_0x6953('0x3c')](respondWithFilteredResult(_0x173b3c,_0x3b1175))[_0x6953('0x41')](handleError(_0x173b3c,null));};exports['show']=function(_0x5a40de,_0xeef91a){var _0x54d7c2={'raw':![],'where':{'id':_0x5a40de[_0x6953('0x42')]['id']}},_0x588ff8={};_0x588ff8[_0x6953('0x2d')]=_[_0x6953('0x2f')](db[_0x6953('0x2b')][_0x6953('0x43')]);_0x588ff8['query']=_['keys'](_0x5a40de[_0x6953('0x2e')]);_0x588ff8[_0x6953('0x30')]=_['intersection'](_0x588ff8[_0x6953('0x2d')],_0x588ff8['query']);_0x54d7c2[_0x6953('0x32')]=_[_0x6953('0x44')](_0x588ff8[_0x6953('0x2d')],qs[_0x6953('0x31')](_0x5a40de['query'][_0x6953('0x31')]));_0x54d7c2[_0x6953('0x32')]=_0x54d7c2['attributes'][_0x6953('0x45')]?_0x54d7c2[_0x6953('0x32')]:_0x588ff8[_0x6953('0x2d')];if(_0x5a40de[_0x6953('0x2e')][_0x6953('0x3d')]){_0x54d7c2[_0x6953('0x3e')]=[{'all':!![]}];}_0x54d7c2=_[_0x6953('0x3a')]({},_0x54d7c2,_0x5a40de[_0x6953('0x46')]);return db[_0x6953('0x2b')][_0x6953('0x47')](_0x54d7c2)[_0x6953('0x3c')](handleEntityNotFound(_0xeef91a,null))['then'](respondWithResult(_0xeef91a,null))[_0x6953('0x41')](handleError(_0xeef91a,null));};exports['create']=function(_0x15c142,_0x1d5979){return db[_0x6953('0x2b')]['create'](_0x15c142[_0x6953('0x48')],{})[_0x6953('0x3c')](respondWithResult(_0x1d5979,0xc9))['catch'](handleError(_0x1d5979,null));};exports['update']=function(_0xbf5b61,_0x265b44){if(_0xbf5b61[_0x6953('0x48')]['id']){delete _0xbf5b61[_0x6953('0x48')]['id'];}return db[_0x6953('0x2b')][_0x6953('0x47')]({'where':{'id':_0xbf5b61[_0x6953('0x42')]['id']}})[_0x6953('0x3c')](handleEntityNotFound(_0x265b44,null))[_0x6953('0x3c')](saveUpdates(_0xbf5b61[_0x6953('0x48')],null))[_0x6953('0x3c')](respondWithResult(_0x265b44,null))['catch'](handleError(_0x265b44,null));};exports['destroy']=function(_0x14a7bf,_0x38e3e8){return db[_0x6953('0x2b')][_0x6953('0x47')]({'where':{'id':_0x14a7bf[_0x6953('0x42')]['id']}})[_0x6953('0x3c')](handleEntityNotFound(_0x38e3e8,null))[_0x6953('0x3c')](removeEntity(_0x38e3e8,null))[_0x6953('0x41')](handleError(_0x38e3e8,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index dd5b4f1..9b1319c 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 _0x4677=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./integration.attributes','exports','Integration','integrations','../../config/logger'];(function(_0x2cb0c8,_0x149549){var _0x17f95b=function(_0x2b1310){while(--_0x2b1310){_0x2cb0c8['push'](_0x2cb0c8['shift']());}};_0x17f95b(++_0x149549);}(_0x4677,0x8e));var _0x7467=function(_0x2a7d64,_0x436664){_0x2a7d64=_0x2a7d64-0x0;var _0x2989db=_0x4677[_0x2a7d64];return _0x2989db;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7467('0x0'))(_0x7467('0x1'));var moment=require(_0x7467('0x2'));var BPromise=require(_0x7467('0x3'));var rp=require(_0x7467('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7467('0x5'));var config=require(_0x7467('0x6'));var attributes=require(_0x7467('0x7'));module[_0x7467('0x8')]=function(_0x450032,_0x2ff295){return _0x450032['define'](_0x7467('0x9'),attributes,{'tableName':_0x7467('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd67e=['util','../../config/logger','moment','bluebird','request-promise','rimraf','./integration.attributes','define','Integration','integrations','lodash'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xd67e,0x18b));var _0xed67=function(_0xcc5c1,_0x34bb2e){_0xcc5c1=_0xcc5c1-0x0;var _0x29c6d1=_0xd67e[_0xcc5c1];return _0x29c6d1;};'use strict';var _=require(_0xed67('0x0'));var util=require(_0xed67('0x1'));var logger=require(_0xed67('0x2'))('api');var moment=require(_0xed67('0x3'));var BPromise=require(_0xed67('0x4'));var rp=require(_0xed67('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xed67('0x6'));var config=require('../../config/environment');var attributes=require(_0xed67('0x7'));module['exports']=function(_0x171633,_0x13c4dd){return _0x171633[_0xed67('0x8')](_0xed67('0x9'),attributes,{'tableName':_0xed67('0xa'),'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 a626f6d..4c2c0b7 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 _0x9f0e=['../../config/environment','jayson/promise','request','then','info','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc'];(function(_0x5eafa2,_0x26390a){var _0x45bfd6=function(_0x5dcbe0){while(--_0x5dcbe0){_0x5eafa2['push'](_0x5eafa2['shift']());}};_0x45bfd6(++_0x26390a);}(_0x9f0e,0x116));var _0xe9f0=function(_0x4236bf,_0x32b08b){_0x4236bf=_0x4236bf-0x0;var _0x53e1aa=_0x9f0e[_0x4236bf];return _0x53e1aa;};'use strict';var _=require(_0xe9f0('0x0'));var util=require(_0xe9f0('0x1'));var moment=require(_0xe9f0('0x2'));var BPromise=require(_0xe9f0('0x3'));var rs=require(_0xe9f0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe9f0('0x5'));var logger=require(_0xe9f0('0x6'))(_0xe9f0('0x7'));var config=require(_0xe9f0('0x8'));var jayson=require(_0xe9f0('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3a17b3,_0x167198,_0xe64a79){return new BPromise(function(_0x4be6a6,_0xf4a256){return client[_0xe9f0('0xa')](_0x3a17b3,_0xe64a79)[_0xe9f0('0xb')](function(_0x3386a8){logger[_0xe9f0('0xc')](_0xe9f0('0xd'),_0x167198,_0xe9f0('0xe'));logger[_0xe9f0('0xf')](_0xe9f0('0x10'),_0x167198,'request\x20sent',JSON[_0xe9f0('0x11')](_0x3386a8));if(_0x3386a8[_0xe9f0('0x12')]){if(_0x3386a8[_0xe9f0('0x12')]['code']===0x1f4){logger[_0xe9f0('0x12')]('Integration,\x20%s,\x20%s',_0x167198,_0x3386a8[_0xe9f0('0x12')][_0xe9f0('0x13')]);return _0xf4a256(_0x3386a8[_0xe9f0('0x12')][_0xe9f0('0x13')]);}logger['error'](_0xe9f0('0xd'),_0x167198,_0x3386a8['error'][_0xe9f0('0x13')]);return _0x4be6a6(_0x3386a8[_0xe9f0('0x12')][_0xe9f0('0x13')]);}else{logger['info'](_0xe9f0('0xd'),_0x167198,_0xe9f0('0xe'));_0x4be6a6(_0x3386a8[_0xe9f0('0x14')]['message']);}})[_0xe9f0('0x15')](function(_0x1e16e0){logger[_0xe9f0('0x12')](_0xe9f0('0xd'),_0x167198,_0x1e16e0);_0xf4a256(_0x1e16e0);});});} \ No newline at end of file +var _0x57ca=['client','http','request','info','request\x20sent','Integration,\x20%s,\x20%s,\x20%s','error','code','Integration,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x2683d8,_0x5d4d27){var _0x109093=function(_0x59a286){while(--_0x59a286){_0x2683d8['push'](_0x2683d8['shift']());}};_0x109093(++_0x5d4d27);}(_0x57ca,0x108));var _0xa57c=function(_0x106f67,_0x534a5b){_0x106f67=_0x106f67-0x0;var _0x48b4a1=_0x57ca[_0x106f67];return _0x48b4a1;};'use strict';var _=require('lodash');var util=require(_0xa57c('0x0'));var moment=require(_0xa57c('0x1'));var BPromise=require('bluebird');var rs=require(_0xa57c('0x2'));var fs=require('fs');var Redis=require(_0xa57c('0x3'));var db=require(_0xa57c('0x4'))['db'];var utils=require(_0xa57c('0x5'));var logger=require(_0xa57c('0x6'))('rpc');var config=require(_0xa57c('0x7'));var jayson=require(_0xa57c('0x8'));var client=jayson[_0xa57c('0x9')][_0xa57c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xbdfffb,_0x314574,_0x19e28e){return new BPromise(function(_0x271ccc,_0x5e3962){return client[_0xa57c('0xb')](_0xbdfffb,_0x19e28e)['then'](function(_0x46ba92){logger[_0xa57c('0xc')]('Integration,\x20%s,\x20%s',_0x314574,_0xa57c('0xd'));logger['debug'](_0xa57c('0xe'),_0x314574,_0xa57c('0xd'),JSON['stringify'](_0x46ba92));if(_0x46ba92[_0xa57c('0xf')]){if(_0x46ba92['error'][_0xa57c('0x10')]===0x1f4){logger[_0xa57c('0xf')](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x5e3962(_0x46ba92['error'][_0xa57c('0x12')]);}logger['error'](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x271ccc(_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);}else{logger[_0xa57c('0xc')](_0xa57c('0x11'),_0x314574,'request\x20sent');_0x271ccc(_0x46ba92[_0xa57c('0x13')][_0xa57c('0x12')]);}})[_0xa57c('0x14')](function(_0x5a6024){logger[_0xa57c('0xf')]('Integration,\x20%s,\x20%s',_0x314574,_0x5a6024);_0x5e3962(_0x5a6024);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 76d537a..828349c 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 _0x0295=['isAuthenticated','index','post','create','put','/:id','update','delete','destroy','exports','multer','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get'];(function(_0x4e7d25,_0x58285f){var _0x526fe6=function(_0x4f0aec){while(--_0x4f0aec){_0x4e7d25['push'](_0x4e7d25['shift']());}};_0x526fe6(++_0x58285f);}(_0x0295,0x1f0));var _0x5029=function(_0x136cbb,_0x2a97f9){_0x136cbb=_0x136cbb-0x0;var _0x333a69=_0x0295[_0x136cbb];return _0x333a69;};'use strict';var multer=require(_0x5029('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5029('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x5029('0x2'));var auth=require(_0x5029('0x3'));var interaction=require(_0x5029('0x4'));var config=require(_0x5029('0x5'));var controller=require(_0x5029('0x6'));router[_0x5029('0x7')]('/',auth[_0x5029('0x8')](),controller[_0x5029('0x9')]);router[_0x5029('0x7')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x5029('0x7')]('/:id',auth[_0x5029('0x8')](),controller['show']);router[_0x5029('0xa')]('/',auth['isAuthenticated'](),controller[_0x5029('0xb')]);router[_0x5029('0xc')](_0x5029('0xd'),auth['isAuthenticated'](),controller[_0x5029('0xe')]);router[_0x5029('0xf')](_0x5029('0xd'),auth['isAuthenticated'](),controller[_0x5029('0x10')]);module[_0x5029('0x11')]=router; \ No newline at end of file +var _0x4137=['show','post','create','put','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','index','/describe','isAuthenticated','/:id'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0x4137,0xf8));var _0x7413=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x4137[_0x40a045];return _0x1a687c;};'use strict';var multer=require(_0x7413('0x0'));var util=require(_0x7413('0x1'));var path=require(_0x7413('0x2'));var timeout=require(_0x7413('0x3'));var express=require(_0x7413('0x4'));var router=express[_0x7413('0x5')]();var fs_extra=require(_0x7413('0x6'));var auth=require(_0x7413('0x7'));var interaction=require(_0x7413('0x8'));var config=require(_0x7413('0x9'));var controller=require(_0x7413('0xa'));router[_0x7413('0xb')]('/',auth['isAuthenticated'](),controller[_0x7413('0xc')]);router[_0x7413('0xb')](_0x7413('0xd'),auth[_0x7413('0xe')](),controller['describe']);router[_0x7413('0xb')](_0x7413('0xf'),auth['isAuthenticated'](),controller[_0x7413('0x10')]);router[_0x7413('0x11')]('/',auth['isAuthenticated'](),controller[_0x7413('0x12')]);router[_0x7413('0x13')](_0x7413('0xf'),auth[_0x7413('0xe')](),controller[_0x7413('0x14')]);router['delete'](_0x7413('0xf'),auth[_0x7413('0xe')](),controller['destroy']);module[_0x7413('0x15')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 2f971bc..859a7e2 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 _0x24fd=['TEXT','SENT','SENDING','RECEIVED','FAILED','sequelize','exports','STRING','INTEGER','DATE','BOOLEAN'];(function(_0x523dce,_0x169542){var _0x2ad85b=function(_0x48a6b4){while(--_0x48a6b4){_0x523dce['push'](_0x523dce['shift']());}};_0x2ad85b(++_0x169542);}(_0x24fd,0x102));var _0xd24f=function(_0x38537f,_0x252124){_0x38537f=_0x38537f-0x0;var _0x141e23=_0x24fd[_0x38537f];return _0x141e23;};'use strict';var Sequelize=require(_0xd24f('0x0'));module[_0xd24f('0x1')]={'integration':{'type':Sequelize[_0xd24f('0x2')]},'eventChannel':{'type':Sequelize[_0xd24f('0x2')]},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize[_0xd24f('0x2')]},'integrationId':{'type':Sequelize[_0xd24f('0x3')]},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xd24f('0x2')]},'calleridname':{'type':Sequelize[_0xd24f('0x2')]},'queue':{'type':Sequelize[_0xd24f('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xd24f('0x2')]},'agentcalledAt':{'type':Sequelize[_0xd24f('0x4')]},'agentconnectAt':{'type':Sequelize[_0xd24f('0x4')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xd24f('0x4')]},'talktime':{'type':Sequelize[_0xd24f('0x3')]},'agentacw':{'type':Sequelize[_0xd24f('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xd24f('0x3')]},'reason':{'type':Sequelize[_0xd24f('0x2')]},'agentringnoanswer':{'type':Sequelize[_0xd24f('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize[_0xd24f('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xd24f('0x2')]},'channelstate':{'type':Sequelize[_0xd24f('0x3')]},'channelstatedesc':{'type':Sequelize[_0xd24f('0x2')]},'connectedlinenum':{'type':Sequelize[_0xd24f('0x2')]},'connectedlinename':{'type':Sequelize[_0xd24f('0x2')]},'language':{'type':Sequelize[_0xd24f('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xd24f('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xd24f('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xd24f('0x2')]},'destcalleridname':{'type':Sequelize[_0xd24f('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xd24f('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xd24f('0x2')]},'destlanguage':{'type':Sequelize[_0xd24f('0x2')]},'destaccountcode':{'type':Sequelize[_0xd24f('0x2')]},'destcontext':{'type':Sequelize[_0xd24f('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xd24f('0x2')]},'destuniqueid':{'type':Sequelize[_0xd24f('0x2')]},'messageId':{'type':Sequelize[_0xd24f('0x2')]},'inReplyTo':{'type':Sequelize[_0xd24f('0x2')]},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xd24f('0x2')]},'attachment':{'type':Sequelize[_0xd24f('0x6')]},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0xd24f('0x6')]},'status':{'type':Sequelize['ENUM'](_0xd24f('0x7'),_0xd24f('0x8'),_0xd24f('0x9'),_0xd24f('0xa'))},'url':{'type':Sequelize[_0xd24f('0x2')]},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0xd24f('0x2')]},'projectId':{'type':Sequelize[_0xd24f('0x3')]}}; \ No newline at end of file +var _0xda05=['BOOLEAN','TEXT','ENUM','SENT','SENDING','RECEIVED','FAILED','STRING','INTEGER','DATE'];(function(_0x8ef167,_0x55a52a){var _0x464b90=function(_0x1b064c){while(--_0x1b064c){_0x8ef167['push'](_0x8ef167['shift']());}};_0x464b90(++_0x55a52a);}(_0xda05,0x7f));var _0x5da0=function(_0x273fc6,_0x4068aa){_0x273fc6=_0x273fc6-0x0;var _0x2da2e5=_0xda05[_0x273fc6];return _0x2da2e5;};'use strict';var Sequelize=require('sequelize');module['exports']={'integration':{'type':Sequelize[_0x5da0('0x0')]},'eventChannel':{'type':Sequelize[_0x5da0('0x0')]},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize[_0x5da0('0x0')]},'integrationId':{'type':Sequelize[_0x5da0('0x1')]},'contacts':{'type':Sequelize[_0x5da0('0x0')]},'uniqueid':{'type':Sequelize[_0x5da0('0x0')]},'calleridnum':{'type':Sequelize[_0x5da0('0x0')]},'calleridname':{'type':Sequelize[_0x5da0('0x0')]},'queue':{'type':Sequelize[_0x5da0('0x0')]},'interface':{'type':Sequelize[_0x5da0('0x0')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x5da0('0x2')]},'agentconnectAt':{'type':Sequelize[_0x5da0('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x5da0('0x3')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x5da0('0x2')]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x5da0('0x3')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x5da0('0x1')]},'reason':{'type':Sequelize[_0x5da0('0x0')]},'agentringnoanswer':{'type':Sequelize[_0x5da0('0x3')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x5da0('0x2')]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x5da0('0x2')]},'lastevent':{'type':Sequelize[_0x5da0('0x0')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x5da0('0x1')]},'channelstatedesc':{'type':Sequelize[_0x5da0('0x0')]},'connectedlinenum':{'type':Sequelize[_0x5da0('0x0')]},'connectedlinename':{'type':Sequelize[_0x5da0('0x0')]},'language':{'type':Sequelize[_0x5da0('0x0')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x5da0('0x0')]},'exten':{'type':Sequelize[_0x5da0('0x0')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x5da0('0x0')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x5da0('0x0')]},'destcalleridname':{'type':Sequelize[_0x5da0('0x0')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x5da0('0x0')]},'destlanguage':{'type':Sequelize[_0x5da0('0x0')]},'destaccountcode':{'type':Sequelize[_0x5da0('0x0')]},'destcontext':{'type':Sequelize[_0x5da0('0x0')]},'destexten':{'type':Sequelize[_0x5da0('0x0')]},'destpriority':{'type':Sequelize[_0x5da0('0x0')]},'destuniqueid':{'type':Sequelize[_0x5da0('0x0')]},'messageId':{'type':Sequelize[_0x5da0('0x0')]},'inReplyTo':{'type':Sequelize[_0x5da0('0x0')]},'subject':{'type':Sequelize[_0x5da0('0x0')]},'from':{'type':Sequelize[_0x5da0('0x0')]},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x5da0('0x0')]},'attachment':{'type':Sequelize[_0x5da0('0x4')]},'html':{'type':Sequelize[_0x5da0('0x4')]},'text':{'type':Sequelize[_0x5da0('0x4')]},'status':{'type':Sequelize[_0x5da0('0x5')](_0x5da0('0x6'),_0x5da0('0x7'),_0x5da0('0x8'),_0x5da0('0x9'))},'url':{'type':Sequelize[_0x5da0('0x0')]},'app':{'type':Sequelize[_0x5da0('0x0')]},'appdata':{'type':Sequelize[_0x5da0('0x0')]},'projectId':{'type':Sequelize[_0x5da0('0x1')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index e85a155..c67394b 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 _0xff54=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','then','end','error','stack','name','send','index','IntegrationReport','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','params','rawAttributes','create','body','catch','find','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x116ddf,_0x1bc70c){var _0x5f3f4d=function(_0x2fd45c){while(--_0x2fd45c){_0x116ddf['push'](_0x116ddf['shift']());}};_0x5f3f4d(++_0x1bc70c);}(_0xff54,0x11b));var _0x4ff5=function(_0x488b47,_0x547bf3){_0x488b47=_0x488b47-0x0;var _0x18315e=_0xff54[_0x488b47];return _0x18315e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4ff5('0x0'));var zipdir=require(_0x4ff5('0x1'));var jsonpatch=require(_0x4ff5('0x2'));var rp=require(_0x4ff5('0x3'));var moment=require(_0x4ff5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4ff5('0x5'));var util=require('util');var path=require(_0x4ff5('0x6'));var sox=require(_0x4ff5('0x7'));var csv=require(_0x4ff5('0x8'));var ejs=require(_0x4ff5('0x9'));var fs=require('fs');var fs_extra=require(_0x4ff5('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x4ff5('0xb'));var jsforce=require(_0x4ff5('0xc'));var deskjs=require(_0x4ff5('0xd'));var toCsv=require(_0x4ff5('0x8'));var querystring=require(_0x4ff5('0xe'));var Papa=require(_0x4ff5('0xf'));var Redis=require(_0x4ff5('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x4ff5('0x11'));var as=require(_0x4ff5('0x12'));var hardwareService=require(_0x4ff5('0x13'));var logger=require(_0x4ff5('0x14'))(_0x4ff5('0x15'));var utils=require(_0x4ff5('0x16'));var config=require(_0x4ff5('0x17'));var licenseUtil=require(_0x4ff5('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x43a9e6,_0x461cac){_0x461cac=_0x461cac||0xcc;return function(_0x1a5194){if(_0x1a5194){return _0x43a9e6[_0x4ff5('0x19')](_0x461cac);}return _0x43a9e6[_0x4ff5('0x1a')](_0x461cac)['end']();};}function respondWithResult(_0x4379db,_0x2d4bab){_0x2d4bab=_0x2d4bab||0xc8;return function(_0x51de48){if(_0x51de48){return _0x4379db[_0x4ff5('0x1a')](_0x2d4bab)['json'](_0x51de48);}};}function respondWithFilteredResult(_0x4faf93,_0x33256b){return function(_0x5f00f8){if(_0x5f00f8){var _0x5d7584=typeof _0x33256b[_0x4ff5('0x1b')]===_0x4ff5('0x1c')&&typeof _0x33256b[_0x4ff5('0x1d')]==='undefined';var _0xc1dabc=_0x5f00f8[_0x4ff5('0x1e')];var _0x4c3525=_0x5d7584?0x0:_0x33256b[_0x4ff5('0x1b')];var _0x17a625=_0x5d7584?_0x5f00f8[_0x4ff5('0x1e')]:_0x33256b[_0x4ff5('0x1b')]+_0x33256b['limit'];var _0x2abac8;if(_0x17a625>=_0xc1dabc){_0x17a625=_0xc1dabc;_0x2abac8=0xc8;}else{_0x2abac8=0xce;}_0x4faf93['status'](_0x2abac8);return _0x4faf93[_0x4ff5('0x1f')](_0x4ff5('0x20'),_0x4c3525+'-'+_0x17a625+'/'+_0xc1dabc)[_0x4ff5('0x21')](_0x5f00f8);}return null;};}function patchUpdates(_0x208e19){return function(_0x582ffa){try{jsonpatch[_0x4ff5('0x22')](_0x582ffa,_0x208e19,!![]);}catch(_0x18d36f){return BPromise[_0x4ff5('0x23')](_0x18d36f);}return _0x582ffa['save']();};}function saveUpdates(_0x593021,_0x365599){return function(_0x253984){if(_0x253984){return _0x253984['update'](_0x593021)[_0x4ff5('0x24')](function(_0x54433a){return _0x54433a;});}return null;};}function removeEntity(_0x80b61b,_0x2e2c24){return function(_0x54d9c6){if(_0x54d9c6){return _0x54d9c6['destroy']()[_0x4ff5('0x24')](function(){_0x80b61b[_0x4ff5('0x1a')](0xcc)[_0x4ff5('0x25')]();});}};}function handleEntityNotFound(_0x3e8c37,_0x237e99){return function(_0x151e69){if(!_0x151e69){_0x3e8c37[_0x4ff5('0x19')](0x194);}return _0x151e69;};}function handleError(_0x18fa06,_0x11e884){_0x11e884=_0x11e884||0x1f4;return function(_0x1f38bb){logger[_0x4ff5('0x26')](_0x1f38bb[_0x4ff5('0x27')]);if(_0x1f38bb[_0x4ff5('0x28')]){delete _0x1f38bb[_0x4ff5('0x28')];}_0x18fa06[_0x4ff5('0x1a')](_0x11e884)[_0x4ff5('0x29')](_0x1f38bb);};}exports[_0x4ff5('0x2a')]=function(_0x239783,_0x4390cd){var _0x47cf32={},_0x387352={},_0x2e0b9c={'count':0x0,'rows':[]};var _0xa4c985=_['map'](db[_0x4ff5('0x2b')]['rawAttributes'],function(_0x13d654){return{'name':_0x13d654['fieldName'],'type':_0x13d654['type'][_0x4ff5('0x2c')]};});_0x387352[_0x4ff5('0x2d')]=_[_0x4ff5('0x2e')](_0xa4c985,_0x4ff5('0x28'));_0x387352[_0x4ff5('0x2f')]=_[_0x4ff5('0x30')](_0x239783[_0x4ff5('0x2f')]);_0x387352[_0x4ff5('0x31')]=_[_0x4ff5('0x32')](_0x387352[_0x4ff5('0x2d')],_0x387352[_0x4ff5('0x2f')]);_0x47cf32['attributes']=_['intersection'](_0x387352['model'],qs[_0x4ff5('0x33')](_0x239783[_0x4ff5('0x2f')]['fields']));_0x47cf32[_0x4ff5('0x34')]=_0x47cf32['attributes'][_0x4ff5('0x35')]?_0x47cf32['attributes']:_0x387352[_0x4ff5('0x2d')];if(!_0x239783['query'][_0x4ff5('0x36')](_0x4ff5('0x37'))){_0x47cf32['limit']=qs[_0x4ff5('0x1d')](_0x239783['query']['limit']);_0x47cf32[_0x4ff5('0x1b')]=qs['offset'](_0x239783[_0x4ff5('0x2f')][_0x4ff5('0x1b')]);}_0x47cf32[_0x4ff5('0x38')]=qs[_0x4ff5('0x39')](_0x239783[_0x4ff5('0x2f')][_0x4ff5('0x39')]);_0x47cf32[_0x4ff5('0x3a')]=qs[_0x4ff5('0x31')](_[_0x4ff5('0x3b')](_0x239783[_0x4ff5('0x2f')],_0x387352[_0x4ff5('0x31')]),_0xa4c985);if(_0x239783[_0x4ff5('0x2f')]['filter']){_0x47cf32[_0x4ff5('0x3a')]=_[_0x4ff5('0x3c')](_0x47cf32[_0x4ff5('0x3a')],{'$or':_[_0x4ff5('0x2e')](_0xa4c985,function(_0x4a1a69){if(_0x4a1a69['type']!==_0x4ff5('0x3d')){var _0x37707b={};_0x37707b[_0x4a1a69['name']]={'$like':'%'+_0x239783[_0x4ff5('0x2f')][_0x4ff5('0x3e')]+'%'};return _0x37707b;}})});}_0x47cf32=_[_0x4ff5('0x3c')]({},_0x47cf32,_0x239783[_0x4ff5('0x3f')]);var _0x920095={'where':_0x47cf32['where']};return db['IntegrationReport'][_0x4ff5('0x1e')](_0x920095)[_0x4ff5('0x24')](function(_0x249b63){_0x2e0b9c[_0x4ff5('0x1e')]=_0x249b63;if(_0x239783[_0x4ff5('0x2f')][_0x4ff5('0x40')]){_0x47cf32[_0x4ff5('0x41')]=[{'all':!![]}];}return db[_0x4ff5('0x2b')][_0x4ff5('0x42')](_0x47cf32);})[_0x4ff5('0x24')](function(_0x1bcee3){_0x2e0b9c['rows']=_0x1bcee3;return _0x2e0b9c;})[_0x4ff5('0x24')](respondWithFilteredResult(_0x4390cd,_0x47cf32))['catch'](handleError(_0x4390cd,null));};exports['show']=function(_0x48fcfa,_0x32159e){var _0x5a61c2={'raw':![],'where':{'id':_0x48fcfa[_0x4ff5('0x43')]['id']}},_0x525ebc={};_0x525ebc['model']=_[_0x4ff5('0x30')](db[_0x4ff5('0x2b')][_0x4ff5('0x44')]);_0x525ebc['query']=_['keys'](_0x48fcfa[_0x4ff5('0x2f')]);_0x525ebc[_0x4ff5('0x31')]=_[_0x4ff5('0x32')](_0x525ebc[_0x4ff5('0x2d')],_0x525ebc[_0x4ff5('0x2f')]);_0x5a61c2[_0x4ff5('0x34')]=_[_0x4ff5('0x32')](_0x525ebc[_0x4ff5('0x2d')],qs[_0x4ff5('0x33')](_0x48fcfa[_0x4ff5('0x2f')][_0x4ff5('0x33')]));_0x5a61c2[_0x4ff5('0x34')]=_0x5a61c2[_0x4ff5('0x34')][_0x4ff5('0x35')]?_0x5a61c2['attributes']:_0x525ebc[_0x4ff5('0x2d')];if(_0x48fcfa[_0x4ff5('0x2f')][_0x4ff5('0x40')]){_0x5a61c2['include']=[{'all':!![]}];}_0x5a61c2=_[_0x4ff5('0x3c')]({},_0x5a61c2,_0x48fcfa[_0x4ff5('0x3f')]);return db['IntegrationReport']['find'](_0x5a61c2)['then'](handleEntityNotFound(_0x32159e,null))['then'](respondWithResult(_0x32159e,null))['catch'](handleError(_0x32159e,null));};exports[_0x4ff5('0x45')]=function(_0x805e16,_0x127343){return db[_0x4ff5('0x2b')][_0x4ff5('0x45')](_0x805e16[_0x4ff5('0x46')],{})['then'](respondWithResult(_0x127343,0xc9))[_0x4ff5('0x47')](handleError(_0x127343,null));};exports['update']=function(_0xb66ad8,_0x384880){if(_0xb66ad8['body']['id']){delete _0xb66ad8[_0x4ff5('0x46')]['id'];}return db[_0x4ff5('0x2b')][_0x4ff5('0x48')]({'where':{'id':_0xb66ad8['params']['id']}})[_0x4ff5('0x24')](handleEntityNotFound(_0x384880,null))[_0x4ff5('0x24')](saveUpdates(_0xb66ad8[_0x4ff5('0x46')],null))[_0x4ff5('0x24')](respondWithResult(_0x384880,null))[_0x4ff5('0x47')](handleError(_0x384880,null));};exports[_0x4ff5('0x49')]=function(_0x44887b,_0x1e8c5d){return db[_0x4ff5('0x2b')][_0x4ff5('0x48')]({'where':{'id':_0x44887b[_0x4ff5('0x43')]['id']}})[_0x4ff5('0x24')](handleEntityNotFound(_0x1e8c5d,null))[_0x4ff5('0x24')](removeEntity(_0x1e8c5d,null))[_0x4ff5('0x47')](handleError(_0x1e8c5d,null));};exports[_0x4ff5('0x4a')]=function(_0x4d3857,_0x27d012){return db[_0x4ff5('0x2b')][_0x4ff5('0x4a')]()['then'](respondWithResult(_0x27d012,null))[_0x4ff5('0x47')](handleError(_0x27d012,null));}; \ No newline at end of file +var _0x76f3=['count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','fieldName','type','key','map','query','keys','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','IntegrationReport','includeAll','include','findAll','show','params','rawAttributes','find','catch','create','body','eml-format','fast-json-patch','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','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit'];(function(_0x4c6c9f,_0x25c8a9){var _0x31e332=function(_0x55ec4f){while(--_0x55ec4f){_0x4c6c9f['push'](_0x4c6c9f['shift']());}};_0x31e332(++_0x25c8a9);}(_0x76f3,0x111));var _0x376f=function(_0x43cd3e,_0x4d924d){_0x43cd3e=_0x43cd3e-0x0;var _0x56b394=_0x76f3[_0x43cd3e];return _0x56b394;};'use strict';var emlformat=require(_0x376f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x376f('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x376f('0x2'));var Mustache=require(_0x376f('0x3'));var util=require(_0x376f('0x4'));var path=require('path');var sox=require(_0x376f('0x5'));var csv=require(_0x376f('0x6'));var ejs=require(_0x376f('0x7'));var fs=require('fs');var fs_extra=require(_0x376f('0x8'));var _=require(_0x376f('0x9'));var squel=require(_0x376f('0xa'));var crypto=require(_0x376f('0xb'));var jsforce=require(_0x376f('0xc'));var deskjs=require(_0x376f('0xd'));var toCsv=require(_0x376f('0x6'));var querystring=require(_0x376f('0xe'));var Papa=require(_0x376f('0xf'));var Redis=require(_0x376f('0x10'));var authService=require(_0x376f('0x11'));var qs=require(_0x376f('0x12'));var as=require(_0x376f('0x13'));var hardwareService=require(_0x376f('0x14'));var logger=require('../../config/logger')(_0x376f('0x15'));var utils=require(_0x376f('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x376f('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3fdc76,_0x3aa5d9){_0x3aa5d9=_0x3aa5d9||0xcc;return function(_0x5ac1ff){if(_0x5ac1ff){return _0x3fdc76[_0x376f('0x18')](_0x3aa5d9);}return _0x3fdc76[_0x376f('0x19')](_0x3aa5d9)[_0x376f('0x1a')]();};}function respondWithResult(_0x1fb192,_0xaabe3d){_0xaabe3d=_0xaabe3d||0xc8;return function(_0x5f38f7){if(_0x5f38f7){return _0x1fb192[_0x376f('0x19')](_0xaabe3d)[_0x376f('0x1b')](_0x5f38f7);}};}function respondWithFilteredResult(_0xf1d5df,_0x47b5ea){return function(_0x13696){if(_0x13696){var _0x367372=typeof _0x47b5ea[_0x376f('0x1c')]===_0x376f('0x1d')&&typeof _0x47b5ea[_0x376f('0x1e')]===_0x376f('0x1d');var _0x3cc07b=_0x13696[_0x376f('0x1f')];var _0x502be=_0x367372?0x0:_0x47b5ea['offset'];var _0xd402e0=_0x367372?_0x13696['count']:_0x47b5ea[_0x376f('0x1c')]+_0x47b5ea[_0x376f('0x1e')];var _0x5de22b;if(_0xd402e0>=_0x3cc07b){_0xd402e0=_0x3cc07b;_0x5de22b=0xc8;}else{_0x5de22b=0xce;}_0xf1d5df[_0x376f('0x19')](_0x5de22b);return _0xf1d5df[_0x376f('0x20')](_0x376f('0x21'),_0x502be+'-'+_0xd402e0+'/'+_0x3cc07b)[_0x376f('0x1b')](_0x13696);}return null;};}function patchUpdates(_0x16e2cc){return function(_0x4a293b){try{jsonpatch[_0x376f('0x22')](_0x4a293b,_0x16e2cc,!![]);}catch(_0x12d677){return BPromise['reject'](_0x12d677);}return _0x4a293b[_0x376f('0x23')]();};}function saveUpdates(_0x2d29f6,_0x5a46d5){return function(_0x424c41){if(_0x424c41){return _0x424c41[_0x376f('0x24')](_0x2d29f6)[_0x376f('0x25')](function(_0x266cdb){return _0x266cdb;});}return null;};}function removeEntity(_0x42f634,_0x135c65){return function(_0x1f8e0d){if(_0x1f8e0d){return _0x1f8e0d[_0x376f('0x26')]()[_0x376f('0x25')](function(){_0x42f634['status'](0xcc)[_0x376f('0x1a')]();});}};}function handleEntityNotFound(_0xe0d3e3,_0x1b754d){return function(_0x4d70de){if(!_0x4d70de){_0xe0d3e3['sendStatus'](0x194);}return _0x4d70de;};}function handleError(_0xbd05f5,_0x1fade1){_0x1fade1=_0x1fade1||0x1f4;return function(_0x155091){logger[_0x376f('0x27')](_0x155091[_0x376f('0x28')]);if(_0x155091['name']){delete _0x155091[_0x376f('0x29')];}_0xbd05f5['status'](_0x1fade1)[_0x376f('0x2a')](_0x155091);};}exports[_0x376f('0x2b')]=function(_0x512227,_0x586620){var _0x3bb132={},_0x261934={},_0x10189d={'count':0x0,'rows':[]};var _0x13b162=_['map'](db['IntegrationReport']['rawAttributes'],function(_0x5c0d54){return{'name':_0x5c0d54[_0x376f('0x2c')],'type':_0x5c0d54[_0x376f('0x2d')][_0x376f('0x2e')]};});_0x261934['model']=_[_0x376f('0x2f')](_0x13b162,_0x376f('0x29'));_0x261934[_0x376f('0x30')]=_[_0x376f('0x31')](_0x512227['query']);_0x261934[_0x376f('0x32')]=_['intersection'](_0x261934[_0x376f('0x33')],_0x261934[_0x376f('0x30')]);_0x3bb132['attributes']=_[_0x376f('0x34')](_0x261934['model'],qs[_0x376f('0x35')](_0x512227[_0x376f('0x30')]['fields']));_0x3bb132[_0x376f('0x36')]=_0x3bb132[_0x376f('0x36')][_0x376f('0x37')]?_0x3bb132[_0x376f('0x36')]:_0x261934['model'];if(!_0x512227['query'][_0x376f('0x38')](_0x376f('0x39'))){_0x3bb132[_0x376f('0x1e')]=qs[_0x376f('0x1e')](_0x512227[_0x376f('0x30')][_0x376f('0x1e')]);_0x3bb132[_0x376f('0x1c')]=qs[_0x376f('0x1c')](_0x512227['query']['offset']);}_0x3bb132[_0x376f('0x3a')]=qs[_0x376f('0x3b')](_0x512227[_0x376f('0x30')]['sort']);_0x3bb132[_0x376f('0x3c')]=qs[_0x376f('0x32')](_[_0x376f('0x3d')](_0x512227[_0x376f('0x30')],_0x261934[_0x376f('0x32')]),_0x13b162);if(_0x512227['query'][_0x376f('0x3e')]){_0x3bb132['where']=_[_0x376f('0x3f')](_0x3bb132[_0x376f('0x3c')],{'$or':_[_0x376f('0x2f')](_0x13b162,function(_0x3b0918){if(_0x3b0918[_0x376f('0x2d')]!=='VIRTUAL'){var _0x4c4074={};_0x4c4074[_0x3b0918[_0x376f('0x29')]]={'$like':'%'+_0x512227[_0x376f('0x30')][_0x376f('0x3e')]+'%'};return _0x4c4074;}})});}_0x3bb132=_[_0x376f('0x3f')]({},_0x3bb132,_0x512227[_0x376f('0x40')]);var _0x1edaa5={'where':_0x3bb132[_0x376f('0x3c')]};return db[_0x376f('0x41')][_0x376f('0x1f')](_0x1edaa5)[_0x376f('0x25')](function(_0x17b98a){_0x10189d[_0x376f('0x1f')]=_0x17b98a;if(_0x512227[_0x376f('0x30')][_0x376f('0x42')]){_0x3bb132[_0x376f('0x43')]=[{'all':!![]}];}return db[_0x376f('0x41')][_0x376f('0x44')](_0x3bb132);})[_0x376f('0x25')](function(_0x364340){_0x10189d['rows']=_0x364340;return _0x10189d;})[_0x376f('0x25')](respondWithFilteredResult(_0x586620,_0x3bb132))['catch'](handleError(_0x586620,null));};exports[_0x376f('0x45')]=function(_0x34803f,_0x141e39){var _0x1d7288={'raw':![],'where':{'id':_0x34803f[_0x376f('0x46')]['id']}},_0x4905ad={};_0x4905ad['model']=_[_0x376f('0x31')](db[_0x376f('0x41')][_0x376f('0x47')]);_0x4905ad[_0x376f('0x30')]=_[_0x376f('0x31')](_0x34803f['query']);_0x4905ad[_0x376f('0x32')]=_['intersection'](_0x4905ad[_0x376f('0x33')],_0x4905ad[_0x376f('0x30')]);_0x1d7288[_0x376f('0x36')]=_['intersection'](_0x4905ad[_0x376f('0x33')],qs[_0x376f('0x35')](_0x34803f['query'][_0x376f('0x35')]));_0x1d7288[_0x376f('0x36')]=_0x1d7288[_0x376f('0x36')][_0x376f('0x37')]?_0x1d7288[_0x376f('0x36')]:_0x4905ad['model'];if(_0x34803f[_0x376f('0x30')][_0x376f('0x42')]){_0x1d7288[_0x376f('0x43')]=[{'all':!![]}];}_0x1d7288=_[_0x376f('0x3f')]({},_0x1d7288,_0x34803f[_0x376f('0x40')]);return db[_0x376f('0x41')][_0x376f('0x48')](_0x1d7288)['then'](handleEntityNotFound(_0x141e39,null))[_0x376f('0x25')](respondWithResult(_0x141e39,null))[_0x376f('0x49')](handleError(_0x141e39,null));};exports[_0x376f('0x4a')]=function(_0x4b7e91,_0x44026b){return db[_0x376f('0x41')]['create'](_0x4b7e91[_0x376f('0x4b')],{})['then'](respondWithResult(_0x44026b,0xc9))[_0x376f('0x49')](handleError(_0x44026b,null));};exports[_0x376f('0x24')]=function(_0x314fa8,_0x30245f){if(_0x314fa8['body']['id']){delete _0x314fa8[_0x376f('0x4b')]['id'];}return db[_0x376f('0x41')][_0x376f('0x48')]({'where':{'id':_0x314fa8[_0x376f('0x46')]['id']}})[_0x376f('0x25')](handleEntityNotFound(_0x30245f,null))[_0x376f('0x25')](saveUpdates(_0x314fa8[_0x376f('0x4b')],null))['then'](respondWithResult(_0x30245f,null))[_0x376f('0x49')](handleError(_0x30245f,null));};exports['destroy']=function(_0x16def1,_0x4b8d78){return db[_0x376f('0x41')]['find']({'where':{'id':_0x16def1[_0x376f('0x46')]['id']}})[_0x376f('0x25')](handleEntityNotFound(_0x4b8d78,null))[_0x376f('0x25')](removeEntity(_0x4b8d78,null))['catch'](handleError(_0x4b8d78,null));};exports['describe']=function(_0x3d0f00,_0x527cb5){return db['IntegrationReport']['describe']()['then'](respondWithResult(_0x527cb5,null))[_0x376f('0x49')](handleError(_0x527cb5,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index dafd60a..71f156f 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 _0x8564=['./integrationReport.attributes','exports','IntegrationReport','report_integration','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment'];(function(_0x399338,_0x11496b){var _0x3c4485=function(_0x17e385){while(--_0x17e385){_0x399338['push'](_0x399338['shift']());}};_0x3c4485(++_0x11496b);}(_0x8564,0x1d8));var _0x4856=function(_0x420eb3,_0x276ae0){_0x420eb3=_0x420eb3-0x0;var _0x5572de=_0x8564[_0x420eb3];return _0x5572de;};'use strict';var _=require(_0x4856('0x0'));var util=require(_0x4856('0x1'));var logger=require(_0x4856('0x2'))(_0x4856('0x3'));var moment=require('moment');var BPromise=require(_0x4856('0x4'));var rp=require(_0x4856('0x5'));var fs=require('fs');var path=require(_0x4856('0x6'));var rimraf=require('rimraf');var config=require(_0x4856('0x7'));var attributes=require(_0x4856('0x8'));module[_0x4856('0x9')]=function(_0x14981e,_0x5f07a6){return _0x14981e['define'](_0x4856('0xa'),attributes,{'tableName':_0x4856('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2275=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./integrationReport.attributes','define','IntegrationReport','lodash'];(function(_0x43a5c7,_0x2286bf){var _0x3b12a2=function(_0x1f8f53){while(--_0x1f8f53){_0x43a5c7['push'](_0x43a5c7['shift']());}};_0x3b12a2(++_0x2286bf);}(_0x2275,0x154));var _0x5227=function(_0x5d0514,_0xba8f6){_0x5d0514=_0x5d0514-0x0;var _0x5ce318=_0x2275[_0x5d0514];return _0x5ce318;};'use strict';var _=require(_0x5227('0x0'));var util=require('util');var logger=require(_0x5227('0x1'))(_0x5227('0x2'));var moment=require('moment');var BPromise=require(_0x5227('0x3'));var rp=require(_0x5227('0x4'));var fs=require('fs');var path=require(_0x5227('0x5'));var rimraf=require(_0x5227('0x6'));var config=require(_0x5227('0x7'));var attributes=require(_0x5227('0x8'));module['exports']=function(_0x827170,_0x5722d5){return _0x827170[_0x5227('0x9')](_0x5227('0xa'),attributes,{'tableName':'report_integration','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 474b794..a183bb7 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 _0x687b=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils'];(function(_0x1e6e4e,_0x2b1b09){var _0x3d746b=function(_0x4483dd){while(--_0x4483dd){_0x1e6e4e['push'](_0x1e6e4e['shift']());}};_0x3d746b(++_0x2b1b09);}(_0x687b,0x14a));var _0xb687=function(_0x1d38fc,_0x27cd20){_0x1d38fc=_0x1d38fc-0x0;var _0x1a260c=_0x687b[_0x1d38fc];return _0x1a260c;};'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 +var _0x4137=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','IntegrationReport,\x20%s,\x20%s','message','lodash','util','moment','bluebird','randomstring'];(function(_0x45aa72,_0x8af642){var _0x75adaa=function(_0x1f6809){while(--_0x1f6809){_0x45aa72['push'](_0x45aa72['shift']());}};_0x75adaa(++_0x8af642);}(_0x4137,0xf8));var _0x7413=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x4137[_0x46e363];return _0x3fb059;};'use strict';var _=require(_0x7413('0x0'));var util=require(_0x7413('0x1'));var moment=require(_0x7413('0x2'));var BPromise=require(_0x7413('0x3'));var rs=require(_0x7413('0x4'));var fs=require('fs');var Redis=require(_0x7413('0x5'));var db=require(_0x7413('0x6'))['db'];var utils=require(_0x7413('0x7'));var logger=require(_0x7413('0x8'))(_0x7413('0x9'));var config=require(_0x7413('0xa'));var jayson=require(_0x7413('0xb'));var client=jayson['client'][_0x7413('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x188d89,_0x5b39ac,_0x15af0d){return new BPromise(function(_0x5f4cd0,_0x3236ec){return client[_0x7413('0xd')](_0x188d89,_0x15af0d)['then'](function(_0x422bf5){logger[_0x7413('0xe')]('IntegrationReport,\x20%s,\x20%s',_0x5b39ac,_0x7413('0xf'));logger[_0x7413('0x10')](_0x7413('0x11'),_0x5b39ac,_0x7413('0xf'),JSON[_0x7413('0x12')](_0x422bf5));if(_0x422bf5['error']){if(_0x422bf5[_0x7413('0x13')][_0x7413('0x14')]===0x1f4){logger['error'](_0x7413('0x15'),_0x5b39ac,_0x422bf5[_0x7413('0x13')][_0x7413('0x16')]);return _0x3236ec(_0x422bf5['error']['message']);}logger['error'](_0x7413('0x15'),_0x5b39ac,_0x422bf5[_0x7413('0x13')]['message']);return _0x5f4cd0(_0x422bf5[_0x7413('0x13')][_0x7413('0x16')]);}else{logger['info'](_0x7413('0x15'),_0x5b39ac,'request\x20sent');_0x5f4cd0(_0x422bf5['result'][_0x7413('0x16')]);}})['catch'](function(_0x195c72){logger['error'](_0x7413('0x15'),_0x5b39ac,_0x195c72);_0x3236ec(_0x195c72);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index c344464..061e647 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 _0xd9d9=['getIntervals','create','post','addInterval','/:id/sub_intervals/create_many','put','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','/:id','isAuthenticated','show','/:id/sub_intervals'];(function(_0x191f98,_0x1a49b6){var _0x4e5b77=function(_0xb7a2b8){while(--_0xb7a2b8){_0x191f98['push'](_0x191f98['shift']());}};_0x4e5b77(++_0x1a49b6);}(_0xd9d9,0x11d));var _0x9d9d=function(_0x307e27,_0x8c0cda){_0x307e27=_0x307e27-0x0;var _0x4ffaaf=_0xd9d9[_0x307e27];return _0x4ffaaf;};'use strict';var multer=require('multer');var util=require(_0x9d9d('0x0'));var path=require(_0x9d9d('0x1'));var timeout=require(_0x9d9d('0x2'));var express=require(_0x9d9d('0x3'));var router=express[_0x9d9d('0x4')]();var fs_extra=require(_0x9d9d('0x5'));var auth=require(_0x9d9d('0x6'));var interaction=require(_0x9d9d('0x7'));var config=require('../../config/environment');var controller=require('./interval.controller');router[_0x9d9d('0x8')]('/',auth['isAuthenticated'](),controller[_0x9d9d('0x9')]);router['get'](_0x9d9d('0xa'),auth[_0x9d9d('0xb')](),controller[_0x9d9d('0xc')]);router['get'](_0x9d9d('0xd'),auth[_0x9d9d('0xb')](),controller[_0x9d9d('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x9d9d('0xf')]);router[_0x9d9d('0x10')](_0x9d9d('0xd'),auth['isAuthenticated'](),controller[_0x9d9d('0x11')]);router['post'](_0x9d9d('0x12'),auth[_0x9d9d('0xb')](),controller['addIntervals']);router[_0x9d9d('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x9d9d('0x14')]);router[_0x9d9d('0x15')]('/:id',auth[_0x9d9d('0xb')](),controller[_0x9d9d('0x16')]);module['exports']=router; \ No newline at end of file +var _0xb138=['fs-extra','../../components/interaction/service','../../config/environment','./interval.controller','isAuthenticated','index','/:id','show','/:id/sub_intervals','create','post','/:id/sub_intervals/create_many','addIntervals','put','delete','multer','util','path','connect-timeout','express','Router'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xb138,0x1dd));var _0x8b13=function(_0x33ee73,_0x2f60d2){_0x33ee73=_0x33ee73-0x0;var _0x554fab=_0xb138[_0x33ee73];return _0x554fab;};'use strict';var multer=require(_0x8b13('0x0'));var util=require(_0x8b13('0x1'));var path=require(_0x8b13('0x2'));var timeout=require(_0x8b13('0x3'));var express=require(_0x8b13('0x4'));var router=express[_0x8b13('0x5')]();var fs_extra=require(_0x8b13('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x8b13('0x7'));var config=require(_0x8b13('0x8'));var controller=require(_0x8b13('0x9'));router['get']('/',auth[_0x8b13('0xa')](),controller[_0x8b13('0xb')]);router['get'](_0x8b13('0xc'),auth[_0x8b13('0xa')](),controller[_0x8b13('0xd')]);router['get'](_0x8b13('0xe'),auth[_0x8b13('0xa')](),controller['getIntervals']);router['post']('/',auth[_0x8b13('0xa')](),controller[_0x8b13('0xf')]);router[_0x8b13('0x10')](_0x8b13('0xe'),auth[_0x8b13('0xa')](),controller['addInterval']);router[_0x8b13('0x10')](_0x8b13('0x11'),auth[_0x8b13('0xa')](),controller[_0x8b13('0x12')]);router[_0x8b13('0x13')](_0x8b13('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x8b13('0x14')](_0x8b13('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 1013d38..0acb48b 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 _0xc3ba=['STRING','sequelize','exports'];(function(_0x20c9b2,_0x55d7b1){var _0x2c6030=function(_0x10845f){while(--_0x10845f){_0x20c9b2['push'](_0x20c9b2['shift']());}};_0x2c6030(++_0x55d7b1);}(_0xc3ba,0xf7));var _0xac3b=function(_0x77a81a,_0x2596a7){_0x77a81a=_0x77a81a-0x0;var _0x53bf26=_0xc3ba[_0x77a81a];return _0x53bf26;};'use strict';var Sequelize=require(_0xac3b('0x0'));module[_0xac3b('0x1')]={'name':{'type':Sequelize[_0xac3b('0x2')]},'description':{'type':Sequelize[_0xac3b('0x2')]},'interval':{'type':Sequelize[_0xac3b('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x9ddf=['exports','STRING'];(function(_0x57b025,_0x4451bb){var _0x334a21=function(_0x28f502){while(--_0x28f502){_0x57b025['push'](_0x57b025['shift']());}};_0x334a21(++_0x4451bb);}(_0x9ddf,0x136));var _0xf9dd=function(_0x1ba0c1,_0x42d7b7){_0x1ba0c1=_0x1ba0c1-0x0;var _0x59d3d5=_0x9ddf[_0x1ba0c1];return _0x59d3d5;};'use strict';var Sequelize=require('sequelize');module[_0xf9dd('0x0')]={'name':{'type':Sequelize[_0xf9dd('0x1')]},'description':{'type':Sequelize[_0xf9dd('0x1')]},'interval':{'type':Sequelize[_0xf9dd('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 2b78257..68cfab3 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 _0xed29=['count','offset','limit','set','Content-Range','reject','save','update','then','destroy','get','Intervals','UserProfileResource','end','sendStatus','error','stack','name','send','Interval','fieldName','type','key','model','map','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','intersection','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addInterval','getIntervals','findOne','filters','addIntervals','transaction','bulkCreate','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../components/extensions/rewrite','status','json','undefined'];(function(_0x438988,_0x2a86cf){var _0x1ce59f=function(_0x26f36a){while(--_0x26f36a){_0x438988['push'](_0x438988['shift']());}};_0x1ce59f(++_0x2a86cf);}(_0xed29,0x1ac));var _0x9ed2=function(_0x23bb07,_0x2d8a9b){_0x23bb07=_0x23bb07-0x0;var _0x3577df=_0xed29[_0x23bb07];return _0x3577df;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9ed2('0x0'));var zipdir=require(_0x9ed2('0x1'));var jsonpatch=require(_0x9ed2('0x2'));var rp=require('request-promise');var moment=require(_0x9ed2('0x3'));var BPromise=require(_0x9ed2('0x4'));var Mustache=require(_0x9ed2('0x5'));var util=require(_0x9ed2('0x6'));var path=require('path');var sox=require(_0x9ed2('0x7'));var csv=require('to-csv');var ejs=require(_0x9ed2('0x8'));var fs=require('fs');var fs_extra=require(_0x9ed2('0x9'));var _=require(_0x9ed2('0xa'));var squel=require('squel');var crypto=require(_0x9ed2('0xb'));var jsforce=require(_0x9ed2('0xc'));var deskjs=require(_0x9ed2('0xd'));var toCsv=require(_0x9ed2('0xe'));var querystring=require(_0x9ed2('0xf'));var Papa=require(_0x9ed2('0x10'));var Redis=require(_0x9ed2('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x9ed2('0x12'));var as=require(_0x9ed2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9ed2('0x14'))(_0x9ed2('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x9ed2('0x16'));var db=require('../../mysqldb')['db'];var extensions=require(_0x9ed2('0x17'));function respondWithStatusCode(_0x5718fb,_0xf7938e){_0xf7938e=_0xf7938e||0xcc;return function(_0x2c4849){if(_0x2c4849){return _0x5718fb['sendStatus'](_0xf7938e);}return _0x5718fb[_0x9ed2('0x18')](_0xf7938e)['end']();};}function respondWithResult(_0x122499,_0x3cc39c){_0x3cc39c=_0x3cc39c||0xc8;return function(_0xf1ea96){if(_0xf1ea96){return _0x122499[_0x9ed2('0x18')](_0x3cc39c)[_0x9ed2('0x19')](_0xf1ea96);}};}function respondWithFilteredResult(_0x4ff6cb,_0x4ffa88){return function(_0x5c1838){if(_0x5c1838){var _0x361b93=typeof _0x4ffa88['offset']==='undefined'&&typeof _0x4ffa88['limit']===_0x9ed2('0x1a');var _0x4a815b=_0x5c1838[_0x9ed2('0x1b')];var _0x3d7612=_0x361b93?0x0:_0x4ffa88['offset'];var _0x201831=_0x361b93?_0x5c1838[_0x9ed2('0x1b')]:_0x4ffa88[_0x9ed2('0x1c')]+_0x4ffa88[_0x9ed2('0x1d')];var _0x1af579;if(_0x201831>=_0x4a815b){_0x201831=_0x4a815b;_0x1af579=0xc8;}else{_0x1af579=0xce;}_0x4ff6cb[_0x9ed2('0x18')](_0x1af579);return _0x4ff6cb[_0x9ed2('0x1e')](_0x9ed2('0x1f'),_0x3d7612+'-'+_0x201831+'/'+_0x4a815b)[_0x9ed2('0x19')](_0x5c1838);}return null;};}function patchUpdates(_0x11f522){return function(_0x287bb3){try{jsonpatch['apply'](_0x287bb3,_0x11f522,!![]);}catch(_0x518b26){return BPromise[_0x9ed2('0x20')](_0x518b26);}return _0x287bb3[_0x9ed2('0x21')]();};}function saveUpdates(_0x59d05a,_0x4fa8b3){return function(_0x15a803){if(_0x15a803){return _0x15a803[_0x9ed2('0x22')](_0x59d05a)[_0x9ed2('0x23')](function(_0x4d6c3c){return _0x4d6c3c;});}return null;};}function removeEntity(_0x508b41,_0x4663b2){return function(_0x458a69){if(_0x458a69){return _0x458a69[_0x9ed2('0x24')]()['then'](function(){var _0x36d974=_0x458a69[_0x9ed2('0x25')]({'plain':!![]});var _0x451d2f=_0x9ed2('0x26');return db[_0x9ed2('0x27')][_0x9ed2('0x24')]({'where':{'type':_0x451d2f,'resourceId':_0x36d974['id']}})[_0x9ed2('0x23')](function(){return _0x458a69;});})['then'](function(){_0x508b41[_0x9ed2('0x18')](0xcc)[_0x9ed2('0x28')]();});}};}function handleEntityNotFound(_0x30d330,_0x116957){return function(_0x405e1a){if(!_0x405e1a){_0x30d330[_0x9ed2('0x29')](0x194);}return _0x405e1a;};}function handleError(_0x53f34a,_0x1390c0){_0x1390c0=_0x1390c0||0x1f4;return function(_0x1d9dec){logger[_0x9ed2('0x2a')](_0x1d9dec[_0x9ed2('0x2b')]);if(_0x1d9dec[_0x9ed2('0x2c')]){delete _0x1d9dec[_0x9ed2('0x2c')];}_0x53f34a['status'](_0x1390c0)[_0x9ed2('0x2d')](_0x1d9dec);};}exports['index']=function(_0x57a587,_0x134e6d){var _0x98c51c={},_0x3cfb95={},_0x216624={'count':0x0,'rows':[]};var _0x264568=_['map'](db[_0x9ed2('0x2e')]['rawAttributes'],function(_0x9854e3){return{'name':_0x9854e3[_0x9ed2('0x2f')],'type':_0x9854e3[_0x9ed2('0x30')][_0x9ed2('0x31')]};});_0x3cfb95[_0x9ed2('0x32')]=_[_0x9ed2('0x33')](_0x264568,_0x9ed2('0x2c'));_0x3cfb95[_0x9ed2('0x34')]=_[_0x9ed2('0x35')](_0x57a587[_0x9ed2('0x34')]);_0x3cfb95['filters']=_['intersection'](_0x3cfb95[_0x9ed2('0x32')],_0x3cfb95['query']);_0x98c51c[_0x9ed2('0x36')]=_['intersection'](_0x3cfb95['model'],qs['fields'](_0x57a587[_0x9ed2('0x34')][_0x9ed2('0x37')]));_0x98c51c[_0x9ed2('0x36')]=_0x98c51c[_0x9ed2('0x36')][_0x9ed2('0x38')]?_0x98c51c[_0x9ed2('0x36')]:_0x3cfb95[_0x9ed2('0x32')];if(!_0x57a587[_0x9ed2('0x34')][_0x9ed2('0x39')](_0x9ed2('0x3a'))){_0x98c51c[_0x9ed2('0x1d')]=qs['limit'](_0x57a587[_0x9ed2('0x34')][_0x9ed2('0x1d')]);_0x98c51c[_0x9ed2('0x1c')]=qs[_0x9ed2('0x1c')](_0x57a587['query']['offset']);}_0x98c51c[_0x9ed2('0x3b')]=qs[_0x9ed2('0x3c')](_0x57a587[_0x9ed2('0x34')]['sort']);_0x98c51c[_0x9ed2('0x3d')]=qs['filters'](_[_0x9ed2('0x3e')](_0x57a587[_0x9ed2('0x34')],_0x3cfb95['filters']),_0x264568);if(_0x57a587[_0x9ed2('0x34')][_0x9ed2('0x3f')]){_0x98c51c[_0x9ed2('0x3d')]=_[_0x9ed2('0x40')](_0x98c51c[_0x9ed2('0x3d')],{'$or':_[_0x9ed2('0x33')](_0x264568,function(_0xdf60b7){if(_0xdf60b7[_0x9ed2('0x30')]!==_0x9ed2('0x41')){var _0x3b2e59={};_0x3b2e59[_0xdf60b7[_0x9ed2('0x2c')]]={'$like':'%'+_0x57a587[_0x9ed2('0x34')][_0x9ed2('0x3f')]+'%'};return _0x3b2e59;}})});}_0x98c51c=_[_0x9ed2('0x40')]({},_0x98c51c,_0x57a587[_0x9ed2('0x42')]);var _0x46e3eb={'where':_0x98c51c[_0x9ed2('0x3d')]};return db[_0x9ed2('0x2e')][_0x9ed2('0x1b')](_0x46e3eb)[_0x9ed2('0x23')](function(_0x1086a1){_0x216624[_0x9ed2('0x1b')]=_0x1086a1;if(_0x57a587['query'][_0x9ed2('0x43')]){_0x98c51c[_0x9ed2('0x44')]=[{'all':!![]}];}return db['Interval'][_0x9ed2('0x45')](_0x98c51c);})['then'](function(_0x59bd90){_0x216624[_0x9ed2('0x46')]=_0x59bd90;return _0x216624;})['then'](respondWithFilteredResult(_0x134e6d,_0x98c51c))[_0x9ed2('0x47')](handleError(_0x134e6d,null));};exports[_0x9ed2('0x48')]=function(_0x47940a,_0x598d06){var _0x3d69b7={'raw':!![],'where':{'id':_0x47940a[_0x9ed2('0x49')]['id']}},_0x5f415c={};_0x5f415c[_0x9ed2('0x32')]=_[_0x9ed2('0x35')](db[_0x9ed2('0x2e')][_0x9ed2('0x4a')]);_0x5f415c[_0x9ed2('0x34')]=_[_0x9ed2('0x35')](_0x47940a[_0x9ed2('0x34')]);_0x5f415c['filters']=_[_0x9ed2('0x4b')](_0x5f415c['model'],_0x5f415c[_0x9ed2('0x34')]);_0x3d69b7[_0x9ed2('0x36')]=_[_0x9ed2('0x4b')](_0x5f415c[_0x9ed2('0x32')],qs['fields'](_0x47940a[_0x9ed2('0x34')][_0x9ed2('0x37')]));_0x3d69b7[_0x9ed2('0x36')]=_0x3d69b7['attributes'][_0x9ed2('0x38')]?_0x3d69b7['attributes']:_0x5f415c[_0x9ed2('0x32')];if(_0x47940a[_0x9ed2('0x34')][_0x9ed2('0x43')]){_0x3d69b7[_0x9ed2('0x44')]=[{'all':!![]}];}_0x3d69b7=_[_0x9ed2('0x40')]({},_0x3d69b7,_0x47940a[_0x9ed2('0x42')]);return db['Interval'][_0x9ed2('0x4c')](_0x3d69b7)[_0x9ed2('0x23')](handleEntityNotFound(_0x598d06,null))[_0x9ed2('0x23')](respondWithResult(_0x598d06,null))['catch'](handleError(_0x598d06,null));};exports[_0x9ed2('0x4d')]=function(_0x50d62a,_0xd63bfa){return db[_0x9ed2('0x2e')][_0x9ed2('0x4d')](_0x50d62a['body'],{})[_0x9ed2('0x23')](function(_0x6c9330){var _0x711f07=_0x50d62a[_0x9ed2('0x4e')][_0x9ed2('0x25')]({'plain':!![]});if(!_0x711f07)throw new Error(_0x9ed2('0x4f'));if(_0x711f07['role']===_0x9ed2('0x4e')){var _0x3ef66f=_0x6c9330[_0x9ed2('0x25')]({'plain':!![]});var _0x4beca2=_0x9ed2('0x26');return db[_0x9ed2('0x50')][_0x9ed2('0x4c')]({'where':{'name':_0x4beca2,'userProfileId':_0x711f07['userProfileId']},'raw':!![]})[_0x9ed2('0x23')](function(_0x53da27){if(_0x53da27&&_0x53da27[_0x9ed2('0x51')]===0x0){return db[_0x9ed2('0x27')]['create']({'name':_0x3ef66f[_0x9ed2('0x2c')],'resourceId':_0x3ef66f['id'],'type':_0x53da27[_0x9ed2('0x2c')],'sectionId':_0x53da27['id']},{})[_0x9ed2('0x23')](function(){return _0x6c9330;});}else{return _0x6c9330;}})[_0x9ed2('0x47')](function(_0x5f1f9b){logger['error'](_0x9ed2('0x52'),_0x5f1f9b);throw _0x5f1f9b;});}return _0x6c9330;})[_0x9ed2('0x23')](respondWithResult(_0xd63bfa,0xc9))['catch'](handleError(_0xd63bfa,null));};exports[_0x9ed2('0x22')]=function(_0x106579,_0x51e5f1){if(_0x106579[_0x9ed2('0x53')]['id']){delete _0x106579[_0x9ed2('0x53')]['id'];}return db[_0x9ed2('0x2e')][_0x9ed2('0x4c')]({'where':{'id':_0x106579[_0x9ed2('0x49')]['id']}})[_0x9ed2('0x23')](handleEntityNotFound(_0x51e5f1,null))[_0x9ed2('0x23')](saveUpdates(_0x106579[_0x9ed2('0x53')],null))[_0x9ed2('0x23')](respondWithResult(_0x51e5f1,null))[_0x9ed2('0x47')](handleError(_0x51e5f1,null));};exports[_0x9ed2('0x24')]=function(_0x1b4825,_0x41518c){return db['Interval'][_0x9ed2('0x4c')]({'where':{'id':_0x1b4825[_0x9ed2('0x49')]['id']}})[_0x9ed2('0x23')](handleEntityNotFound(_0x41518c,null))[_0x9ed2('0x23')](removeEntity(_0x41518c,null))[_0x9ed2('0x47')](handleError(_0x41518c,null));};exports[_0x9ed2('0x54')]=function(_0x44cbf4,_0x4ee512,_0x5bae1e){if(_0x44cbf4[_0x9ed2('0x53')]['id']){delete _0x44cbf4[_0x9ed2('0x53')]['id'];}return db[_0x9ed2('0x2e')][_0x9ed2('0x4c')]({'where':{'id':_0x44cbf4[_0x9ed2('0x49')]['id']}})[_0x9ed2('0x23')](handleEntityNotFound(_0x4ee512,null))['then'](function(_0x5e2ba2){if(_0x5e2ba2){_0x44cbf4[_0x9ed2('0x53')]['IntervalId']=_0x5e2ba2['id'];return db[_0x9ed2('0x2e')][_0x9ed2('0x4d')](_0x44cbf4[_0x9ed2('0x53')]);}})[_0x9ed2('0x23')](respondWithResult(_0x4ee512,null))['catch'](handleError(_0x4ee512,null));};exports[_0x9ed2('0x55')]=function(_0x574a67,_0x57f5fb,_0x4c7001){var _0x3e9910={};var _0xe852d8={};var _0x113beb;var _0x16bef8;return db[_0x9ed2('0x2e')][_0x9ed2('0x56')]({'where':{'id':_0x574a67[_0x9ed2('0x49')]['id']}})[_0x9ed2('0x23')](handleEntityNotFound(_0x57f5fb,null))[_0x9ed2('0x23')](function(_0xbc03d){if(_0xbc03d){_0x113beb=_0xbc03d;_0xe852d8[_0x9ed2('0x32')]=_[_0x9ed2('0x35')](db[_0x9ed2('0x2e')][_0x9ed2('0x4a')]);_0xe852d8['query']=_['keys'](_0x574a67['query']);_0xe852d8[_0x9ed2('0x57')]=_[_0x9ed2('0x4b')](_0xe852d8[_0x9ed2('0x32')],_0xe852d8['query']);_0x3e9910[_0x9ed2('0x36')]=_[_0x9ed2('0x4b')](_0xe852d8[_0x9ed2('0x32')],qs['fields'](_0x574a67[_0x9ed2('0x34')][_0x9ed2('0x37')]));_0x3e9910['attributes']=_0x3e9910['attributes'][_0x9ed2('0x38')]?_0x3e9910[_0x9ed2('0x36')]:_0xe852d8[_0x9ed2('0x32')];_0x3e9910['order']=qs[_0x9ed2('0x3c')](_0x574a67[_0x9ed2('0x34')][_0x9ed2('0x3c')]);_0x3e9910[_0x9ed2('0x3d')]=qs[_0x9ed2('0x57')](_[_0x9ed2('0x3e')](_0x574a67[_0x9ed2('0x34')],_0xe852d8[_0x9ed2('0x57')]));if(_0x574a67[_0x9ed2('0x34')]['filter']){_0x3e9910[_0x9ed2('0x3d')]=_[_0x9ed2('0x40')](_0x3e9910[_0x9ed2('0x3d')],{'$or':_[_0x9ed2('0x33')](_0x3e9910[_0x9ed2('0x36')],function(_0x2a549c){var _0x5f0429={};_0x5f0429[_0x2a549c]={'$like':'%'+_0x574a67['query'][_0x9ed2('0x3f')]+'%'};return _0x5f0429;})});}_0x3e9910=_[_0x9ed2('0x40')]({},_0x3e9910,_0x574a67[_0x9ed2('0x42')]);return _0x113beb[_0x9ed2('0x55')](_0x3e9910);}})['then'](function(_0x489026){if(_0x489026){_0x16bef8=_0x489026[_0x9ed2('0x38')];if(!_0x574a67[_0x9ed2('0x34')]['hasOwnProperty'](_0x9ed2('0x3a'))){_0x3e9910[_0x9ed2('0x1d')]=qs[_0x9ed2('0x1d')](_0x574a67[_0x9ed2('0x34')][_0x9ed2('0x1d')]);_0x3e9910[_0x9ed2('0x1c')]=qs['offset'](_0x574a67[_0x9ed2('0x34')]['offset']);}return _0x113beb[_0x9ed2('0x55')](_0x3e9910);}})['then'](function(_0x9e0216){if(_0x9e0216){return _0x9e0216?{'count':_0x16bef8,'rows':_0x9e0216}:null;}})[_0x9ed2('0x23')](respondWithResult(_0x57f5fb,null))[_0x9ed2('0x47')](handleError(_0x57f5fb,null));};exports[_0x9ed2('0x58')]=function(_0x3baf2f,_0x152afb,_0x48fb13){return db[_0x9ed2('0x2e')][_0x9ed2('0x56')]({'where':{'id':_0x3baf2f[_0x9ed2('0x49')]['id']}})[_0x9ed2('0x23')](handleEntityNotFound(_0x152afb,null))[_0x9ed2('0x23')](function(_0x3a543a){if(_0x3a543a){return db['sequelize'][_0x9ed2('0x59')](function(_0x537945){return db[_0x9ed2('0x2e')][_0x9ed2('0x24')]({'where':{'IntervalId':_0x3baf2f[_0x9ed2('0x49')]['id']},'transaction':_0x537945})[_0x9ed2('0x23')](function(_0x14609f){var _0x860f75=_[_0x9ed2('0x33')](_0x3baf2f[_0x9ed2('0x53')],function(_0x29c416){delete _0x29c416['id'];_0x29c416['IntervalId']=_0x3baf2f[_0x9ed2('0x49')]['id'];return _0x29c416;});return db[_0x9ed2('0x2e')][_0x9ed2('0x5a')](_0x860f75,{'transaction':_0x537945});});})[_0x9ed2('0x23')](function(){return db[_0x9ed2('0x2e')][_0x9ed2('0x45')]({'where':{'IntervalId':_0x3baf2f['params']['id']}});});}})['then'](respondWithResult(_0x152afb,null))[_0x9ed2('0x47')](handleError(_0x152afb,null));}; \ No newline at end of file +var _0xabf3=['map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','Interval','includeAll','include','findAll','rows','catch','params','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','name','error','find','addInterval','getIntervals','findOne','sequelize','transaction','IntervalId','bulkCreate','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','get','Intervals','UserProfileResource','stack','send','index'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xabf3,0x8b));var _0x3abf=function(_0x35ba41,_0x2a6d94){_0x35ba41=_0x35ba41-0x0;var _0x4ae7a2=_0xabf3[_0x35ba41];return _0x4ae7a2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3abf('0x0'));var zipdir=require(_0x3abf('0x1'));var jsonpatch=require(_0x3abf('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3abf('0x3'));var Mustache=require(_0x3abf('0x4'));var util=require(_0x3abf('0x5'));var path=require(_0x3abf('0x6'));var sox=require(_0x3abf('0x7'));var csv=require(_0x3abf('0x8'));var ejs=require(_0x3abf('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3abf('0xa'));var squel=require('squel');var crypto=require(_0x3abf('0xb'));var jsforce=require(_0x3abf('0xc'));var deskjs=require(_0x3abf('0xd'));var toCsv=require(_0x3abf('0x8'));var querystring=require(_0x3abf('0xe'));var Papa=require(_0x3abf('0xf'));var Redis=require(_0x3abf('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x3abf('0x11'));var as=require(_0x3abf('0x12'));var hardwareService=require(_0x3abf('0x13'));var logger=require('../../config/logger')(_0x3abf('0x14'));var utils=require('../../config/utils');var config=require(_0x3abf('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x3abf('0x16'))['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x19f4c3,_0x374b28){_0x374b28=_0x374b28||0xcc;return function(_0x1d4a5f){if(_0x1d4a5f){return _0x19f4c3[_0x3abf('0x17')](_0x374b28);}return _0x19f4c3[_0x3abf('0x18')](_0x374b28)[_0x3abf('0x19')]();};}function respondWithResult(_0x1b8be6,_0x4a8f73){_0x4a8f73=_0x4a8f73||0xc8;return function(_0x243372){if(_0x243372){return _0x1b8be6['status'](_0x4a8f73)[_0x3abf('0x1a')](_0x243372);}};}function respondWithFilteredResult(_0x4963ba,_0x3079b9){return function(_0x571f3a){if(_0x571f3a){var _0x34cdf6=typeof _0x3079b9[_0x3abf('0x1b')]===_0x3abf('0x1c')&&typeof _0x3079b9[_0x3abf('0x1d')]===_0x3abf('0x1c');var _0x54edfa=_0x571f3a['count'];var _0x1187ca=_0x34cdf6?0x0:_0x3079b9['offset'];var _0x549ed4=_0x34cdf6?_0x571f3a[_0x3abf('0x1e')]:_0x3079b9[_0x3abf('0x1b')]+_0x3079b9['limit'];var _0x56a9f8;if(_0x549ed4>=_0x54edfa){_0x549ed4=_0x54edfa;_0x56a9f8=0xc8;}else{_0x56a9f8=0xce;}_0x4963ba[_0x3abf('0x18')](_0x56a9f8);return _0x4963ba['set'](_0x3abf('0x1f'),_0x1187ca+'-'+_0x549ed4+'/'+_0x54edfa)[_0x3abf('0x1a')](_0x571f3a);}return null;};}function patchUpdates(_0x11766d){return function(_0x1a938d){try{jsonpatch[_0x3abf('0x20')](_0x1a938d,_0x11766d,!![]);}catch(_0x513bbd){return BPromise[_0x3abf('0x21')](_0x513bbd);}return _0x1a938d['save']();};}function saveUpdates(_0x1f9572,_0x3d77ec){return function(_0x46cf75){if(_0x46cf75){return _0x46cf75[_0x3abf('0x22')](_0x1f9572)[_0x3abf('0x23')](function(_0x2b577a){return _0x2b577a;});}return null;};}function removeEntity(_0x323da5,_0x1c675d){return function(_0x79b257){if(_0x79b257){return _0x79b257[_0x3abf('0x24')]()[_0x3abf('0x23')](function(){var _0x2160ea=_0x79b257[_0x3abf('0x25')]({'plain':!![]});var _0x4d9bc3=_0x3abf('0x26');return db[_0x3abf('0x27')]['destroy']({'where':{'type':_0x4d9bc3,'resourceId':_0x2160ea['id']}})[_0x3abf('0x23')](function(){return _0x79b257;});})[_0x3abf('0x23')](function(){_0x323da5[_0x3abf('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x44b76d,_0x3bda7d){return function(_0x6701d4){if(!_0x6701d4){_0x44b76d['sendStatus'](0x194);}return _0x6701d4;};}function handleError(_0x2cb41b,_0x547ce3){_0x547ce3=_0x547ce3||0x1f4;return function(_0x31dfe4){logger['error'](_0x31dfe4[_0x3abf('0x28')]);if(_0x31dfe4['name']){delete _0x31dfe4['name'];}_0x2cb41b[_0x3abf('0x18')](_0x547ce3)[_0x3abf('0x29')](_0x31dfe4);};}exports[_0x3abf('0x2a')]=function(_0x5ef4ed,_0x3c677b){var _0x236e33={},_0x5dee69={},_0x3d46ac={'count':0x0,'rows':[]};var _0x5b149f=_[_0x3abf('0x2b')](db['Interval'][_0x3abf('0x2c')],function(_0x3fd307){return{'name':_0x3fd307[_0x3abf('0x2d')],'type':_0x3fd307[_0x3abf('0x2e')][_0x3abf('0x2f')]};});_0x5dee69[_0x3abf('0x30')]=_['map'](_0x5b149f,'name');_0x5dee69[_0x3abf('0x31')]=_[_0x3abf('0x32')](_0x5ef4ed[_0x3abf('0x31')]);_0x5dee69[_0x3abf('0x33')]=_['intersection'](_0x5dee69[_0x3abf('0x30')],_0x5dee69[_0x3abf('0x31')]);_0x236e33[_0x3abf('0x34')]=_[_0x3abf('0x35')](_0x5dee69['model'],qs[_0x3abf('0x36')](_0x5ef4ed[_0x3abf('0x31')]['fields']));_0x236e33['attributes']=_0x236e33['attributes'][_0x3abf('0x37')]?_0x236e33['attributes']:_0x5dee69[_0x3abf('0x30')];if(!_0x5ef4ed[_0x3abf('0x31')][_0x3abf('0x38')](_0x3abf('0x39'))){_0x236e33[_0x3abf('0x1d')]=qs[_0x3abf('0x1d')](_0x5ef4ed['query']['limit']);_0x236e33[_0x3abf('0x1b')]=qs['offset'](_0x5ef4ed[_0x3abf('0x31')][_0x3abf('0x1b')]);}_0x236e33[_0x3abf('0x3a')]=qs[_0x3abf('0x3b')](_0x5ef4ed[_0x3abf('0x31')][_0x3abf('0x3b')]);_0x236e33[_0x3abf('0x3c')]=qs[_0x3abf('0x33')](_[_0x3abf('0x3d')](_0x5ef4ed[_0x3abf('0x31')],_0x5dee69[_0x3abf('0x33')]),_0x5b149f);if(_0x5ef4ed[_0x3abf('0x31')][_0x3abf('0x3e')]){_0x236e33[_0x3abf('0x3c')]=_[_0x3abf('0x3f')](_0x236e33[_0x3abf('0x3c')],{'$or':_[_0x3abf('0x2b')](_0x5b149f,function(_0x31bc77){if(_0x31bc77[_0x3abf('0x2e')]!==_0x3abf('0x40')){var _0x132480={};_0x132480[_0x31bc77['name']]={'$like':'%'+_0x5ef4ed['query'][_0x3abf('0x3e')]+'%'};return _0x132480;}})});}_0x236e33=_['merge']({},_0x236e33,_0x5ef4ed[_0x3abf('0x41')]);var _0x4fbe0e={'where':_0x236e33[_0x3abf('0x3c')]};return db[_0x3abf('0x42')]['count'](_0x4fbe0e)[_0x3abf('0x23')](function(_0x20efe8){_0x3d46ac[_0x3abf('0x1e')]=_0x20efe8;if(_0x5ef4ed['query'][_0x3abf('0x43')]){_0x236e33[_0x3abf('0x44')]=[{'all':!![]}];}return db[_0x3abf('0x42')][_0x3abf('0x45')](_0x236e33);})[_0x3abf('0x23')](function(_0x5646e6){_0x3d46ac[_0x3abf('0x46')]=_0x5646e6;return _0x3d46ac;})['then'](respondWithFilteredResult(_0x3c677b,_0x236e33))[_0x3abf('0x47')](handleError(_0x3c677b,null));};exports['show']=function(_0x42e0da,_0x7aed49){var _0x4e338d={'raw':!![],'where':{'id':_0x42e0da[_0x3abf('0x48')]['id']}},_0x59a591={};_0x59a591['model']=_[_0x3abf('0x32')](db[_0x3abf('0x42')][_0x3abf('0x2c')]);_0x59a591[_0x3abf('0x31')]=_[_0x3abf('0x32')](_0x42e0da[_0x3abf('0x31')]);_0x59a591[_0x3abf('0x33')]=_[_0x3abf('0x35')](_0x59a591[_0x3abf('0x30')],_0x59a591[_0x3abf('0x31')]);_0x4e338d[_0x3abf('0x34')]=_[_0x3abf('0x35')](_0x59a591[_0x3abf('0x30')],qs['fields'](_0x42e0da['query'][_0x3abf('0x36')]));_0x4e338d[_0x3abf('0x34')]=_0x4e338d[_0x3abf('0x34')][_0x3abf('0x37')]?_0x4e338d['attributes']:_0x59a591[_0x3abf('0x30')];if(_0x42e0da[_0x3abf('0x31')][_0x3abf('0x43')]){_0x4e338d[_0x3abf('0x44')]=[{'all':!![]}];}_0x4e338d=_[_0x3abf('0x3f')]({},_0x4e338d,_0x42e0da[_0x3abf('0x41')]);return db[_0x3abf('0x42')]['find'](_0x4e338d)['then'](handleEntityNotFound(_0x7aed49,null))[_0x3abf('0x23')](respondWithResult(_0x7aed49,null))[_0x3abf('0x47')](handleError(_0x7aed49,null));};exports['create']=function(_0x7f6c61,_0x298a49){return db[_0x3abf('0x42')][_0x3abf('0x49')](_0x7f6c61[_0x3abf('0x4a')],{})[_0x3abf('0x23')](function(_0x35634a){var _0x4a48c6=_0x7f6c61['user'][_0x3abf('0x25')]({'plain':!![]});if(!_0x4a48c6)throw new Error(_0x3abf('0x4b'));if(_0x4a48c6[_0x3abf('0x4c')]===_0x3abf('0x4d')){var _0x31377c=_0x35634a[_0x3abf('0x25')]({'plain':!![]});var _0x170769=_0x3abf('0x26');return db[_0x3abf('0x4e')]['find']({'where':{'name':_0x170769,'userProfileId':_0x4a48c6[_0x3abf('0x4f')]},'raw':!![]})[_0x3abf('0x23')](function(_0x9739b7){if(_0x9739b7&&_0x9739b7[_0x3abf('0x50')]===0x0){return db[_0x3abf('0x27')][_0x3abf('0x49')]({'name':_0x31377c[_0x3abf('0x51')],'resourceId':_0x31377c['id'],'type':_0x9739b7[_0x3abf('0x51')],'sectionId':_0x9739b7['id']},{})[_0x3abf('0x23')](function(){return _0x35634a;});}else{return _0x35634a;}})[_0x3abf('0x47')](function(_0x3c922e){logger[_0x3abf('0x52')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3c922e);throw _0x3c922e;});}return _0x35634a;})[_0x3abf('0x23')](respondWithResult(_0x298a49,0xc9))[_0x3abf('0x47')](handleError(_0x298a49,null));};exports[_0x3abf('0x22')]=function(_0xa4efe4,_0x5c1e20){if(_0xa4efe4['body']['id']){delete _0xa4efe4[_0x3abf('0x4a')]['id'];}return db[_0x3abf('0x42')][_0x3abf('0x53')]({'where':{'id':_0xa4efe4[_0x3abf('0x48')]['id']}})[_0x3abf('0x23')](handleEntityNotFound(_0x5c1e20,null))[_0x3abf('0x23')](saveUpdates(_0xa4efe4['body'],null))[_0x3abf('0x23')](respondWithResult(_0x5c1e20,null))[_0x3abf('0x47')](handleError(_0x5c1e20,null));};exports[_0x3abf('0x24')]=function(_0x398261,_0x421347){return db['Interval']['find']({'where':{'id':_0x398261[_0x3abf('0x48')]['id']}})[_0x3abf('0x23')](handleEntityNotFound(_0x421347,null))['then'](removeEntity(_0x421347,null))[_0x3abf('0x47')](handleError(_0x421347,null));};exports[_0x3abf('0x54')]=function(_0x179d1b,_0x292e93,_0x2cd2c3){if(_0x179d1b['body']['id']){delete _0x179d1b[_0x3abf('0x4a')]['id'];}return db[_0x3abf('0x42')][_0x3abf('0x53')]({'where':{'id':_0x179d1b[_0x3abf('0x48')]['id']}})[_0x3abf('0x23')](handleEntityNotFound(_0x292e93,null))[_0x3abf('0x23')](function(_0x281b4d){if(_0x281b4d){_0x179d1b['body']['IntervalId']=_0x281b4d['id'];return db[_0x3abf('0x42')][_0x3abf('0x49')](_0x179d1b[_0x3abf('0x4a')]);}})[_0x3abf('0x23')](respondWithResult(_0x292e93,null))[_0x3abf('0x47')](handleError(_0x292e93,null));};exports[_0x3abf('0x55')]=function(_0x2a7269,_0x5806e2,_0x34e39b){var _0x63ca0a={};var _0x365a49={};var _0x5bb2a0;var _0x56da6b;return db[_0x3abf('0x42')][_0x3abf('0x56')]({'where':{'id':_0x2a7269[_0x3abf('0x48')]['id']}})['then'](handleEntityNotFound(_0x5806e2,null))[_0x3abf('0x23')](function(_0x13c4b1){if(_0x13c4b1){_0x5bb2a0=_0x13c4b1;_0x365a49[_0x3abf('0x30')]=_['keys'](db['Interval']['rawAttributes']);_0x365a49[_0x3abf('0x31')]=_['keys'](_0x2a7269[_0x3abf('0x31')]);_0x365a49['filters']=_[_0x3abf('0x35')](_0x365a49[_0x3abf('0x30')],_0x365a49[_0x3abf('0x31')]);_0x63ca0a[_0x3abf('0x34')]=_[_0x3abf('0x35')](_0x365a49[_0x3abf('0x30')],qs[_0x3abf('0x36')](_0x2a7269[_0x3abf('0x31')][_0x3abf('0x36')]));_0x63ca0a[_0x3abf('0x34')]=_0x63ca0a[_0x3abf('0x34')][_0x3abf('0x37')]?_0x63ca0a[_0x3abf('0x34')]:_0x365a49[_0x3abf('0x30')];_0x63ca0a['order']=qs['sort'](_0x2a7269[_0x3abf('0x31')][_0x3abf('0x3b')]);_0x63ca0a[_0x3abf('0x3c')]=qs[_0x3abf('0x33')](_[_0x3abf('0x3d')](_0x2a7269[_0x3abf('0x31')],_0x365a49['filters']));if(_0x2a7269['query'][_0x3abf('0x3e')]){_0x63ca0a[_0x3abf('0x3c')]=_['merge'](_0x63ca0a[_0x3abf('0x3c')],{'$or':_[_0x3abf('0x2b')](_0x63ca0a[_0x3abf('0x34')],function(_0x45e29d){var _0x51bc74={};_0x51bc74[_0x45e29d]={'$like':'%'+_0x2a7269['query'][_0x3abf('0x3e')]+'%'};return _0x51bc74;})});}_0x63ca0a=_['merge']({},_0x63ca0a,_0x2a7269[_0x3abf('0x41')]);return _0x5bb2a0[_0x3abf('0x55')](_0x63ca0a);}})[_0x3abf('0x23')](function(_0x3470f9){if(_0x3470f9){_0x56da6b=_0x3470f9[_0x3abf('0x37')];if(!_0x2a7269[_0x3abf('0x31')]['hasOwnProperty'](_0x3abf('0x39'))){_0x63ca0a[_0x3abf('0x1d')]=qs[_0x3abf('0x1d')](_0x2a7269[_0x3abf('0x31')]['limit']);_0x63ca0a[_0x3abf('0x1b')]=qs['offset'](_0x2a7269[_0x3abf('0x31')]['offset']);}return _0x5bb2a0[_0x3abf('0x55')](_0x63ca0a);}})[_0x3abf('0x23')](function(_0x35fa4c){if(_0x35fa4c){return _0x35fa4c?{'count':_0x56da6b,'rows':_0x35fa4c}:null;}})[_0x3abf('0x23')](respondWithResult(_0x5806e2,null))[_0x3abf('0x47')](handleError(_0x5806e2,null));};exports['addIntervals']=function(_0x1e7eab,_0x892947,_0x3392a9){return db[_0x3abf('0x42')][_0x3abf('0x56')]({'where':{'id':_0x1e7eab[_0x3abf('0x48')]['id']}})['then'](handleEntityNotFound(_0x892947,null))[_0x3abf('0x23')](function(_0x50372e){if(_0x50372e){return db[_0x3abf('0x57')][_0x3abf('0x58')](function(_0x4dc4b0){return db[_0x3abf('0x42')][_0x3abf('0x24')]({'where':{'IntervalId':_0x1e7eab[_0x3abf('0x48')]['id']},'transaction':_0x4dc4b0})[_0x3abf('0x23')](function(_0x3197a1){var _0x1f3724=_[_0x3abf('0x2b')](_0x1e7eab[_0x3abf('0x4a')],function(_0x5dc157){delete _0x5dc157['id'];_0x5dc157[_0x3abf('0x59')]=_0x1e7eab[_0x3abf('0x48')]['id'];return _0x5dc157;});return db[_0x3abf('0x42')][_0x3abf('0x5a')](_0x1f3724,{'transaction':_0x4dc4b0});});})[_0x3abf('0x23')](function(){return db['Interval'][_0x3abf('0x45')]({'where':{'IntervalId':_0x1e7eab[_0x3abf('0x48')]['id']}});});}})[_0x3abf('0x23')](respondWithResult(_0x892947,null))[_0x3abf('0x47')](handleError(_0x892947,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 7e7d1c8..f0912e0 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 _0x7f35=['exports','define','Interval','tools_intervals','rewrite','interval','then','all','map','ifTime','reduce','./interval.attributes','../../components/extensions/rewrite','iftime'];(function(_0x3b35a6,_0x1a7902){var _0x45b645=function(_0x3ac39d){while(--_0x3ac39d){_0x3b35a6['push'](_0x3b35a6['shift']());}};_0x45b645(++_0x1a7902);}(_0x7f35,0x131));var _0x57f3=function(_0x36cc47,_0x1ebd6e){_0x36cc47=_0x36cc47-0x0;var _0x3211c5=_0x7f35[_0x36cc47];return _0x3211c5;};'use strict';var attributes=require(_0x57f3('0x0'));var extensions=require(_0x57f3('0x1'));var iftime=require('../../utils/iftime')[_0x57f3('0x2')];module[_0x57f3('0x3')]=function(_0xe2940e){return _0xe2940e[_0x57f3('0x4')](_0x57f3('0x5'),attributes,{'tableName':_0x57f3('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x44c623){extensions['rewrite'](_0xe2940e,_0x44c623);},'afterBulkCreate':function(_0x23919c,_0x746e9,_0x4ca52c){_0x4ca52c();extensions['rewrite'](_0xe2940e,_0x23919c[0x0]);},'afterUpdate':function(_0x2dbf09){extensions[_0x57f3('0x7')](_0xe2940e,_0x2dbf09);},'afterDestroy':function(_0x358dba){extensions['rewrite'](_0xe2940e,_0x358dba);}},'instanceMethods':{'ifTime':function(_0xb06feb=undefined,_0x42d95a=new Date()){if(typeof this[_0x57f3('0x8')]==='string'){return iftime(this[_0x57f3('0x8')],_0xb06feb,_0x42d95a);}else{return this['getIntervals']()[_0x57f3('0x9')](function(_0x566a6d){return Promise[_0x57f3('0xa')](_0x566a6d[_0x57f3('0xb')](function(_0xd0b1b9){return _0xd0b1b9[_0x57f3('0xc')](_0xb06feb,_0x42d95a);}));})[_0x57f3('0x9')](function(_0x1c7da9){return _0x1c7da9[_0x57f3('0xd')](function(_0x2cfa3b,_0x40bdb3){return _0x2cfa3b||_0x40bdb3;},![]);});}}}});}; \ No newline at end of file +var _0x63c8=['map','ifTime','then','reduce','./interval.attributes','../../components/extensions/rewrite','../../utils/iftime','iftime','exports','tools_intervals','rewrite','interval','string','all'];(function(_0x20cf8a,_0x44cd6b){var _0x54e165=function(_0xcce1d0){while(--_0xcce1d0){_0x20cf8a['push'](_0x20cf8a['shift']());}};_0x54e165(++_0x44cd6b);}(_0x63c8,0x1a8));var _0x863c=function(_0x249f8b,_0x4ffeb0){_0x249f8b=_0x249f8b-0x0;var _0x285e7a=_0x63c8[_0x249f8b];return _0x285e7a;};'use strict';var attributes=require(_0x863c('0x0'));var extensions=require(_0x863c('0x1'));var iftime=require(_0x863c('0x2'))[_0x863c('0x3')];module[_0x863c('0x4')]=function(_0x42b95d){return _0x42b95d['define']('Interval',attributes,{'tableName':_0x863c('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x26415c){extensions[_0x863c('0x6')](_0x42b95d,_0x26415c);},'afterBulkCreate':function(_0x2c1c26,_0x172ca6,_0x5b57d7){_0x5b57d7();extensions[_0x863c('0x6')](_0x42b95d,_0x2c1c26[0x0]);},'afterUpdate':function(_0x599f20){extensions['rewrite'](_0x42b95d,_0x599f20);},'afterDestroy':function(_0x5719de){extensions['rewrite'](_0x42b95d,_0x5719de);}},'instanceMethods':{'ifTime':function(_0x4e7192=undefined,_0x4832cb=new Date()){if(typeof this[_0x863c('0x7')]===_0x863c('0x8')){return iftime(this[_0x863c('0x7')],_0x4e7192,_0x4832cb);}else{return this['getIntervals']()['then'](function(_0x1b395d){return Promise[_0x863c('0x9')](_0x1b395d[_0x863c('0xa')](function(_0x3e5fd0){return _0x3e5fd0[_0x863c('0xb')](_0x4e7192,_0x4832cb);}));})[_0x863c('0xc')](function(_0x1c8a4b){return _0x1c8a4b[_0x863c('0xd')](function(_0x4e7678,_0x1f350f){return _0x4e7678||_0x1f350f;},![]);});}}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 42e23e0..8a11afb 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 _0x82a2=['length','IntervalIftime:\x20timezone\x20=\x20%s','Iftime','resolve','lodash','util','../../mysqldb','../../utils/iftime','iftime','../../config/logger','rpc','GetInterval','Interval','findAll','options','raw','where','attributes','limit','include','map','model','then','info','debug','error','message','find','ShowInterval','stringify','catch','all','ifTime','reduce','format','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','name','join','findById','IntervalIftime','intervalIds','isArray','intervals'];(function(_0x2576d7,_0x167624){var _0x16a08c=function(_0x19de1e){while(--_0x19de1e){_0x2576d7['push'](_0x2576d7['shift']());}};_0x16a08c(++_0x167624);}(_0x82a2,0x85));var _0x282a=function(_0x223876,_0x84b8fe){_0x223876=_0x223876-0x0;var _0x4f01e3=_0x82a2[_0x223876];return _0x4f01e3;};'use strict';var _=require(_0x282a('0x0'));var util=require(_0x282a('0x1'));var db=require(_0x282a('0x2'))['db'];var iftime=require(_0x282a('0x3'))[_0x282a('0x4')];var logger=require(_0x282a('0x5'))(_0x282a('0x6'));exports[_0x282a('0x7')]=function(_0x35916e){var _0x2326a3=this;return new Promise(function(_0x56b551,_0x5b8a3b){return db[_0x282a('0x8')][_0x282a('0x9')]({'raw':_0x35916e[_0x282a('0xa')]?_0x35916e['options'][_0x282a('0xb')]===undefined?!![]:![]:!![],'where':_0x35916e[_0x282a('0xa')]?_0x35916e[_0x282a('0xa')][_0x282a('0xc')]||null:null,'attributes':_0x35916e[_0x282a('0xa')]?_0x35916e[_0x282a('0xa')][_0x282a('0xd')]||null:null,'limit':_0x35916e[_0x282a('0xa')]?_0x35916e[_0x282a('0xa')][_0x282a('0xe')]||null:null,'include':_0x35916e[_0x282a('0xa')]?_0x35916e[_0x282a('0xa')][_0x282a('0xf')]?_['map'](_0x35916e[_0x282a('0xa')][_0x282a('0xf')],function(_0x418ed5){return{'model':db[_0x418ed5['model']],'as':_0x418ed5['as'],'attributes':_0x418ed5[_0x282a('0xd')],'include':_0x418ed5['include']?_[_0x282a('0x10')](_0x418ed5[_0x282a('0xf')],function(_0x34bfc6){return{'model':db[_0x34bfc6['model']],'as':_0x34bfc6['as'],'attributes':_0x34bfc6[_0x282a('0xd')],'include':_0x34bfc6[_0x282a('0xf')]?_[_0x282a('0x10')](_0x34bfc6['include'],function(_0x20d99f){return{'model':db[_0x20d99f[_0x282a('0x11')]],'as':_0x20d99f['as'],'attributes':_0x20d99f[_0x282a('0xd')]};}):[]};}):[]};}):[]:[]})[_0x282a('0x12')](function(_0x226c1d){logger[_0x282a('0x13')](_0x282a('0x7'),_0x35916e);logger[_0x282a('0x14')]('GetInterval',_0x35916e,JSON['stringify'](_0x226c1d));_0x56b551(_0x226c1d);})['catch'](function(_0x509ea3){logger[_0x282a('0x15')](_0x282a('0x7'),_0x509ea3[_0x282a('0x16')],_0x35916e);_0x5b8a3b(_0x2326a3['error'](0x1f4,_0x509ea3[_0x282a('0x16')]));});});};exports['ShowInterval']=function(_0x99d6be){var _0xaf0da7=this;return new Promise(function(_0x18fa17,_0x4eab4f){return db[_0x282a('0x8')][_0x282a('0x17')]({'raw':_0x99d6be['options']?_0x99d6be[_0x282a('0xa')]['raw']===undefined?!![]:![]:!![],'where':_0x99d6be['options']?_0x99d6be[_0x282a('0xa')][_0x282a('0xc')]||null:null,'attributes':_0x99d6be['options']?_0x99d6be[_0x282a('0xa')][_0x282a('0xd')]||null:null,'include':_0x99d6be[_0x282a('0xa')]?_0x99d6be[_0x282a('0xa')][_0x282a('0xf')]?_['map'](_0x99d6be[_0x282a('0xa')][_0x282a('0xf')],function(_0x2275c7){return{'model':db[_0x2275c7['model']],'as':_0x2275c7['as'],'attributes':_0x2275c7[_0x282a('0xd')],'include':_0x2275c7[_0x282a('0xf')]?_[_0x282a('0x10')](_0x2275c7['include'],function(_0x102ded){return{'model':db[_0x102ded[_0x282a('0x11')]],'as':_0x102ded['as'],'attributes':_0x102ded[_0x282a('0xd')],'include':_0x102ded[_0x282a('0xf')]?_['map'](_0x102ded[_0x282a('0xf')],function(_0x2ae9e7){return{'model':db[_0x2ae9e7[_0x282a('0x11')]],'as':_0x2ae9e7['as'],'attributes':_0x2ae9e7[_0x282a('0xd')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x474578){logger['info'](_0x282a('0x18'),_0x99d6be);logger[_0x282a('0x14')]('ShowInterval',_0x99d6be,JSON[_0x282a('0x19')](_0x474578));_0x18fa17(_0x474578);})[_0x282a('0x1a')](function(_0xa57dc6){logger[_0x282a('0x15')](_0x282a('0x18'),_0xa57dc6[_0x282a('0x16')],_0x99d6be);_0x4eab4f(_0xaf0da7[_0x282a('0x15')](0x1f4,_0xa57dc6[_0x282a('0x16')]));});});};function checkArrayOfIntervals(_0x855cd8,_0x2722ab){var _0x32bf33=[];return db[_0x282a('0x8')][_0x282a('0x9')]({'where':{'id':_0x855cd8}})[_0x282a('0x12')](function(_0xe04d91){_0x32bf33=_0xe04d91;return Promise[_0x282a('0x1b')](_0x32bf33[_0x282a('0x10')](function(_0x3a550d){return _0x3a550d[_0x282a('0x1c')](_0x2722ab);}));})[_0x282a('0x12')](function(_0x3594b1){var _0x415938=_0x3594b1[_0x282a('0x1d')](function(_0x5338d1,_0x3c6231){return _0x5338d1||_0x3c6231;},![]);logger[_0x282a('0x13')](util[_0x282a('0x1e')](_0x282a('0x1f'),_0x32bf33[_0x282a('0x10')](function(_0x425bc8){return _0x425bc8[_0x282a('0x20')];})[_0x282a('0x21')](',\x20'),_0x32bf33[_0x282a('0x10')](function(_0x2f264a){return _0x2f264a['id'];})[_0x282a('0x21')](',\x20')));return _0x415938;});}function checkSingleInterval(_0x1f87ae,_0x3c70b2){return db['Interval'][_0x282a('0x22')](_0x1f87ae)[_0x282a('0x12')](function(_0x19a80e){if(_0x19a80e){logger[_0x282a('0x13')](util[_0x282a('0x1e')]('IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)',_0x19a80e['name'],_0x19a80e['id']));return _0x19a80e[_0x282a('0x1c')](_0x3c70b2);}});}exports[_0x282a('0x23')]=function(_0x55c0b9){var _0x33e561=_0x55c0b9[_0x282a('0x24')];var _0x4f2fbf=Array[_0x282a('0x25')](_0x55c0b9[_0x282a('0x26')])?_0x55c0b9[_0x282a('0x26')]:typeof _0x55c0b9[_0x282a('0x26')]==='string'?[_0x55c0b9['intervals']]:[];var _0x3f2a01=_0x55c0b9['timezone']||undefined;var _0x21b070=![];if(_0x4f2fbf[_0x282a('0x27')]){logger[_0x282a('0x13')](util[_0x282a('0x1e')]('IntervalIftime:\x20interval\x20strings\x20=\x20%s',_0x4f2fbf[_0x282a('0x21')](';\x20')));}if(_0x3f2a01){logger[_0x282a('0x13')](util['format'](_0x282a('0x28'),_0x3f2a01));}logger[_0x282a('0x14')](_0x282a('0x29'),_0x21b070);logger['silly'](_0x282a('0x23'),_0x55c0b9);return Promise[_0x282a('0x2a')]()[_0x282a('0x12')](function(){if(Array[_0x282a('0x25')](_0x33e561)){return checkArrayOfIntervals(_0x33e561,_0x3f2a01);}else if(_0x33e561){return checkSingleInterval(_0x33e561,_0x3f2a01);}})[_0x282a('0x12')](function(_0x3e5253){var _0x28abd2=_0x4f2fbf[_0x282a('0x1d')](function(_0x6c2e0,_0x38f4fe){return _0x6c2e0||iftime(_0x38f4fe,_0x3f2a01);},![]);_0x21b070=_0x3e5253||_0x28abd2;return _0x21b070;})['catch'](function(_0x4385f1){logger['error'](_0x282a('0x23'),_0x55c0b9,_0x4385f1);throw this[_0x282a('0x15')](0x1f4,_0x4385f1['message']);});}; \ No newline at end of file +var _0xc84e=['iftime','../../config/logger','rpc','GetInterval','Interval','findAll','options','raw','where','attributes','limit','include','map','model','then','catch','message','error','info','ShowInterval','debug','stringify','all','ifTime','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)','IntervalIftime','isArray','intervals','string','timezone','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','Iftime','silly','../../mysqldb','../../utils/iftime'];(function(_0x5d8473,_0x49b676){var _0x449cb3=function(_0x4295a5){while(--_0x4295a5){_0x5d8473['push'](_0x5d8473['shift']());}};_0x449cb3(++_0x49b676);}(_0xc84e,0x1d7));var _0xec84=function(_0x30d5b8,_0x220e9f){_0x30d5b8=_0x30d5b8-0x0;var _0xb53cf3=_0xc84e[_0x30d5b8];return _0xb53cf3;};'use strict';var _=require('lodash');var util=require('util');var db=require(_0xec84('0x0'))['db'];var iftime=require(_0xec84('0x1'))[_0xec84('0x2')];var logger=require(_0xec84('0x3'))(_0xec84('0x4'));exports[_0xec84('0x5')]=function(_0x24336d){var _0x338966=this;return new Promise(function(_0x429dc0,_0x4eb9ff){return db[_0xec84('0x6')][_0xec84('0x7')]({'raw':_0x24336d[_0xec84('0x8')]?_0x24336d['options'][_0xec84('0x9')]===undefined?!![]:![]:!![],'where':_0x24336d[_0xec84('0x8')]?_0x24336d[_0xec84('0x8')][_0xec84('0xa')]||null:null,'attributes':_0x24336d[_0xec84('0x8')]?_0x24336d['options'][_0xec84('0xb')]||null:null,'limit':_0x24336d[_0xec84('0x8')]?_0x24336d[_0xec84('0x8')][_0xec84('0xc')]||null:null,'include':_0x24336d['options']?_0x24336d[_0xec84('0x8')][_0xec84('0xd')]?_[_0xec84('0xe')](_0x24336d[_0xec84('0x8')][_0xec84('0xd')],function(_0x1905fa){return{'model':db[_0x1905fa['model']],'as':_0x1905fa['as'],'attributes':_0x1905fa[_0xec84('0xb')],'include':_0x1905fa[_0xec84('0xd')]?_[_0xec84('0xe')](_0x1905fa[_0xec84('0xd')],function(_0xe43c34){return{'model':db[_0xe43c34[_0xec84('0xf')]],'as':_0xe43c34['as'],'attributes':_0xe43c34[_0xec84('0xb')],'include':_0xe43c34['include']?_['map'](_0xe43c34[_0xec84('0xd')],function(_0x2a4ea7){return{'model':db[_0x2a4ea7['model']],'as':_0x2a4ea7['as'],'attributes':_0x2a4ea7[_0xec84('0xb')]};}):[]};}):[]};}):[]:[]})[_0xec84('0x10')](function(_0x3c5586){logger['info'](_0xec84('0x5'),_0x24336d);logger['debug'](_0xec84('0x5'),_0x24336d,JSON['stringify'](_0x3c5586));_0x429dc0(_0x3c5586);})[_0xec84('0x11')](function(_0x30272e){logger['error'](_0xec84('0x5'),_0x30272e[_0xec84('0x12')],_0x24336d);_0x4eb9ff(_0x338966[_0xec84('0x13')](0x1f4,_0x30272e['message']));});});};exports['ShowInterval']=function(_0x41288b){var _0x2fdbcb=this;return new Promise(function(_0x171a8d,_0x2f71a3){return db[_0xec84('0x6')]['find']({'raw':_0x41288b[_0xec84('0x8')]?_0x41288b[_0xec84('0x8')][_0xec84('0x9')]===undefined?!![]:![]:!![],'where':_0x41288b[_0xec84('0x8')]?_0x41288b['options'][_0xec84('0xa')]||null:null,'attributes':_0x41288b[_0xec84('0x8')]?_0x41288b[_0xec84('0x8')][_0xec84('0xb')]||null:null,'include':_0x41288b['options']?_0x41288b[_0xec84('0x8')][_0xec84('0xd')]?_[_0xec84('0xe')](_0x41288b[_0xec84('0x8')][_0xec84('0xd')],function(_0x284120){return{'model':db[_0x284120[_0xec84('0xf')]],'as':_0x284120['as'],'attributes':_0x284120[_0xec84('0xb')],'include':_0x284120[_0xec84('0xd')]?_['map'](_0x284120[_0xec84('0xd')],function(_0x528dec){return{'model':db[_0x528dec[_0xec84('0xf')]],'as':_0x528dec['as'],'attributes':_0x528dec[_0xec84('0xb')],'include':_0x528dec[_0xec84('0xd')]?_[_0xec84('0xe')](_0x528dec[_0xec84('0xd')],function(_0xde55f){return{'model':db[_0xde55f['model']],'as':_0xde55f['as'],'attributes':_0xde55f[_0xec84('0xb')]};}):[]};}):[]};}):[]:[]})[_0xec84('0x10')](function(_0x349723){logger[_0xec84('0x14')](_0xec84('0x15'),_0x41288b);logger[_0xec84('0x16')](_0xec84('0x15'),_0x41288b,JSON[_0xec84('0x17')](_0x349723));_0x171a8d(_0x349723);})[_0xec84('0x11')](function(_0x17427a){logger['error']('ShowInterval',_0x17427a['message'],_0x41288b);_0x2f71a3(_0x2fdbcb[_0xec84('0x13')](0x1f4,_0x17427a[_0xec84('0x12')]));});});};function checkArrayOfIntervals(_0x48e0dc,_0xcba0a3){var _0x41ccdc=[];return db[_0xec84('0x6')][_0xec84('0x7')]({'where':{'id':_0x48e0dc}})[_0xec84('0x10')](function(_0x3644f0){_0x41ccdc=_0x3644f0;return Promise[_0xec84('0x18')](_0x41ccdc['map'](function(_0x54449d){return _0x54449d[_0xec84('0x19')](_0xcba0a3);}));})[_0xec84('0x10')](function(_0x348f48){var _0x56306e=_0x348f48[_0xec84('0x1a')](function(_0x47824b,_0x307e7e){return _0x47824b||_0x307e7e;},![]);logger[_0xec84('0x14')](util[_0xec84('0x1b')](_0xec84('0x1c'),_0x41ccdc[_0xec84('0xe')](function(_0x58d33c){return _0x58d33c[_0xec84('0x1d')];})[_0xec84('0x1e')](',\x20'),_0x41ccdc[_0xec84('0xe')](function(_0x4aebf6){return _0x4aebf6['id'];})[_0xec84('0x1e')](',\x20')));return _0x56306e;});}function checkSingleInterval(_0x5dca9e,_0x1e0a5e){return db[_0xec84('0x6')][_0xec84('0x1f')](_0x5dca9e)['then'](function(_0x38252d){if(_0x38252d){logger[_0xec84('0x14')](util[_0xec84('0x1b')](_0xec84('0x20'),_0x38252d[_0xec84('0x1d')],_0x38252d['id']));return _0x38252d[_0xec84('0x19')](_0x1e0a5e);}});}exports[_0xec84('0x21')]=function(_0x247bf2){var _0x39247e=_0x247bf2['intervalIds'];var _0x432336=Array[_0xec84('0x22')](_0x247bf2['intervals'])?_0x247bf2[_0xec84('0x23')]:typeof _0x247bf2[_0xec84('0x23')]===_0xec84('0x24')?[_0x247bf2[_0xec84('0x23')]]:[];var _0x195a45=_0x247bf2[_0xec84('0x25')]||undefined;var _0x2a1226=![];if(_0x432336[_0xec84('0x26')]){logger[_0xec84('0x14')](util['format'](_0xec84('0x27'),_0x432336['join'](';\x20')));}if(_0x195a45){logger['info'](util[_0xec84('0x1b')](_0xec84('0x28'),_0x195a45));}logger['debug'](_0xec84('0x29'),_0x2a1226);logger[_0xec84('0x2a')](_0xec84('0x21'),_0x247bf2);return Promise['resolve']()[_0xec84('0x10')](function(){if(Array[_0xec84('0x22')](_0x39247e)){return checkArrayOfIntervals(_0x39247e,_0x195a45);}else if(_0x39247e){return checkSingleInterval(_0x39247e,_0x195a45);}})[_0xec84('0x10')](function(_0x8c6f6c){var _0x2600b2=_0x432336[_0xec84('0x1a')](function(_0x33696f,_0x349373){return _0x33696f||iftime(_0x349373,_0x195a45);},![]);_0x2a1226=_0x8c6f6c||_0x2600b2;return _0x2a1226;})[_0xec84('0x11')](function(_0x44fa6c){logger[_0xec84('0x13')](_0xec84('0x21'),_0x247bf2,_0x44fa6c);throw this['error'](0x1f4,_0x44fa6c[_0xec84('0x12')]);});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 45f1d78..f340492 100644 --- a/server/api/jira/index.js +++ b/server/api/jira/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2032=['isAuthenticated','send','Router','../../components/auth/service','./jira.controller'];(function(_0x37434f,_0x5037d1){var _0x528037=function(_0x3a1149){while(--_0x3a1149){_0x37434f['push'](_0x37434f['shift']());}};_0x528037(++_0x5037d1);}(_0x2032,0xd9));var _0x2203=function(_0xfaf338,_0x57b2fb){_0xfaf338=_0xfaf338-0x0;var _0x18491a=_0x2032[_0xfaf338];return _0x18491a;};'use strict';var express=require('express');var router=express[_0x2203('0x0')]();var auth=require(_0x2203('0x1'));var controller=require(_0x2203('0x2'));router['post']('/',auth[_0x2203('0x3')](),controller[_0x2203('0x4')]);module['exports']=router; \ No newline at end of file +var _0xdb28=['isAuthenticated','send','exports','express','Router','../../components/auth/service','./jira.controller'];(function(_0x5bdf28,_0x1b702b){var _0x26fc9a=function(_0x3fa275){while(--_0x3fa275){_0x5bdf28['push'](_0x5bdf28['shift']());}};_0x26fc9a(++_0x1b702b);}(_0xdb28,0x106));var _0x8db2=function(_0x2b4ccb,_0x413d07){_0x2b4ccb=_0x2b4ccb-0x0;var _0x1ef0d3=_0xdb28[_0x2b4ccb];return _0x1ef0d3;};'use strict';var express=require(_0x8db2('0x0'));var router=express[_0x8db2('0x1')]();var auth=require(_0x8db2('0x2'));var controller=require(_0x8db2('0x3'));router['post']('/',auth[_0x8db2('0x4')](),controller[_0x8db2('0x5')]);module[_0x8db2('0x6')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 704a87c..fa34d12 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 _0x54a9=['error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','send','body','headers','remoteAddress','socket','connection','bluebird','https','../../config/logger','api','3eAmWpBVP0','MOTGUI','summary','Report','description','stringify','issuetype','Bug','fields','customfield_11500','email','customfield_11501','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','POST','application/json','Basic\x20','toString','base64','request','utf8','data','end','status','json','parse'];(function(_0x5c3c0b,_0x4ee35e){var _0x52ecd2=function(_0x3cf575){while(--_0x3cf575){_0x5c3c0b['push'](_0x5c3c0b['shift']());}};_0x52ecd2(++_0x4ee35e);}(_0x54a9,0x8f));var _0x954a=function(_0x569e2d,_0x367173){_0x569e2d=_0x569e2d-0x0;var _0x154a06=_0x54a9[_0x569e2d];return _0x154a06;};'use strict';var BPromise=require(_0x954a('0x0'));var https=require(_0x954a('0x1'));var logger=require(_0x954a('0x2'))(_0x954a('0x3'));var USERNAME='support';var PASSWORD=_0x954a('0x4');function openIssue(_0x38ab10,_0x525e3d){var _0x52af1e={'fields':{'project':{'key':_0x38ab10['key']||_0x954a('0x5')},'summary':(_0x38ab10[_0x954a('0x6')]||_0x954a('0x7'))+'\x20from\x20'+_0x38ab10['ip'],'description':_0x38ab10[_0x954a('0x8')]||JSON[_0x954a('0x9')](_0x38ab10),'issuetype':{'name':_0x38ab10[_0x954a('0xa')]||_0x954a('0xb')}}};_0x52af1e[_0x954a('0xc')][_0x954a('0xd')]=_0x38ab10[_0x954a('0xe')];_0x52af1e['fields'][_0x954a('0xf')]=_0x38ab10['oldToken'];_0x52af1e['fields']['customfield_11502']=_0x38ab10['newToken'];_0x52af1e[_0x954a('0xc')]['customfield_11503']=_0x38ab10[_0x954a('0x10')];_0x52af1e[_0x954a('0xc')][_0x954a('0x11')]=_0x38ab10[_0x954a('0x12')];_0x52af1e[_0x954a('0xc')][_0x954a('0x13')]=_0x38ab10['ip'];var _0x3dca1f={'host':_0x954a('0x14'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0x954a('0x15'),'timeout':0x4e20,'headers':{'Content-Type':_0x954a('0x16'),'Authorization':_0x954a('0x17')+new Buffer(USERNAME+':'+PASSWORD)[_0x954a('0x18')](_0x954a('0x19'))}};var _0x5c2abd=JSON[_0x954a('0x9')](_0x52af1e);var _0x44886b=https[_0x954a('0x1a')](_0x3dca1f,function(_0x3c14a6){_0x3c14a6['setEncoding'](_0x954a('0x1b'));var _0x1c2ad8='';_0x3c14a6['on'](_0x954a('0x1c'),function(_0x31ac25){_0x1c2ad8+=_0x31ac25;});_0x3c14a6['on'](_0x954a('0x1d'),function(){if(_0x525e3d){return _0x525e3d[_0x954a('0x1e')](_0x3c14a6['statusCode'])[_0x954a('0x1f')](JSON[_0x954a('0x20')](_0x1c2ad8));}});});_0x44886b['on'](_0x954a('0x21'),function(_0xe09a3e){if(_0x525e3d){return _0x525e3d[_0x954a('0x1e')](0x1f4)['json']({'errors':[{'message':_0x954a('0x22'),'type':_0x954a('0x23')}]});}});_0x44886b[_0x954a('0x24')](_0x5c2abd);_0x44886b[_0x954a('0x1d')]();}exports[_0x954a('0x25')]=openIssue;exports[_0x954a('0x26')]=function(_0x57605d,_0x58cc8e){_0x57605d[_0x954a('0x27')]['ip']=_0x57605d[_0x954a('0x28')]['x-forwarded-for']||_0x57605d['connection'][_0x954a('0x29')]||_0x57605d[_0x954a('0x2a')]['remoteAddress']||_0x57605d[_0x954a('0x2b')][_0x954a('0x2a')]['remoteAddress'];return openIssue(_0x57605d[_0x954a('0x27')],_0x58cc8e);}; \ No newline at end of file +var _0xe28f=['bluebird','https','api','support','3eAmWpBVP0','key','Report','\x20from\x20','description','stringify','customfield_11500','email','fields','oldToken','customfield_11502','newToken','customfield_11503','name','customfield_10102','POST','Basic\x20','toString','base64','request','setEncoding','utf8','data','end','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','send','body','headers','x-forwarded-for','remoteAddress','socket','connection'];(function(_0x1a72f3,_0x217011){var _0x57ef47=function(_0x20123d){while(--_0x20123d){_0x1a72f3['push'](_0x1a72f3['shift']());}};_0x57ef47(++_0x217011);}(_0xe28f,0xa8));var _0xfe28=function(_0x4c5f32,_0x3189ea){_0x4c5f32=_0x4c5f32-0x0;var _0x70b74d=_0xe28f[_0x4c5f32];return _0x70b74d;};'use strict';var BPromise=require(_0xfe28('0x0'));var https=require(_0xfe28('0x1'));var logger=require('../../config/logger')(_0xfe28('0x2'));var USERNAME=_0xfe28('0x3');var PASSWORD=_0xfe28('0x4');function openIssue(_0x5e6fa3,_0x379e60){var _0x14fb7a={'fields':{'project':{'key':_0x5e6fa3[_0xfe28('0x5')]||'MOTGUI'},'summary':(_0x5e6fa3['summary']||_0xfe28('0x6'))+_0xfe28('0x7')+_0x5e6fa3['ip'],'description':_0x5e6fa3[_0xfe28('0x8')]||JSON[_0xfe28('0x9')](_0x5e6fa3),'issuetype':{'name':_0x5e6fa3['issuetype']||'Bug'}}};_0x14fb7a['fields'][_0xfe28('0xa')]=_0x5e6fa3[_0xfe28('0xb')];_0x14fb7a[_0xfe28('0xc')]['customfield_11501']=_0x5e6fa3[_0xfe28('0xd')];_0x14fb7a[_0xfe28('0xc')][_0xfe28('0xe')]=_0x5e6fa3[_0xfe28('0xf')];_0x14fb7a['fields'][_0xfe28('0x10')]=_0x5e6fa3[_0xfe28('0x11')];_0x14fb7a[_0xfe28('0xc')]['customfield_11504']=_0x5e6fa3['reason'];_0x14fb7a[_0xfe28('0xc')][_0xfe28('0x12')]=_0x5e6fa3['ip'];var _0x5c2476={'host':'track.xcallymotion.com','port':0x1bb,'path':'/rest/api/2/issue','method':_0xfe28('0x13'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0xfe28('0x14')+new Buffer(USERNAME+':'+PASSWORD)[_0xfe28('0x15')](_0xfe28('0x16'))}};var _0x5bf95e=JSON['stringify'](_0x14fb7a);var _0x1ad1bb=https[_0xfe28('0x17')](_0x5c2476,function(_0x47bfbf){_0x47bfbf[_0xfe28('0x18')](_0xfe28('0x19'));var _0x4611c7='';_0x47bfbf['on'](_0xfe28('0x1a'),function(_0x542d20){_0x4611c7+=_0x542d20;});_0x47bfbf['on'](_0xfe28('0x1b'),function(){if(_0x379e60){return _0x379e60['status'](_0x47bfbf['statusCode'])[_0xfe28('0x1c')](JSON[_0xfe28('0x1d')](_0x4611c7));}});});_0x1ad1bb['on'](_0xfe28('0x1e'),function(_0x111831){if(_0x379e60){return _0x379e60['status'](0x1f4)[_0xfe28('0x1c')]({'errors':[{'message':_0xfe28('0x1f'),'type':_0xfe28('0x20')}]});}});_0x1ad1bb[_0xfe28('0x21')](_0x5bf95e);_0x1ad1bb[_0xfe28('0x1b')]();}exports[_0xfe28('0x22')]=openIssue;exports[_0xfe28('0x23')]=function(_0x20c0e1,_0x41d00a){_0x20c0e1[_0xfe28('0x24')]['ip']=_0x20c0e1[_0xfe28('0x25')][_0xfe28('0x26')]||_0x20c0e1['connection'][_0xfe28('0x27')]||_0x20c0e1[_0xfe28('0x28')][_0xfe28('0x27')]||_0x20c0e1[_0xfe28('0x29')][_0xfe28('0x28')]['remoteAddress'];return openIssue(_0x20c0e1[_0xfe28('0x24')],_0x41d00a);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index d9895e8..28d8da9 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 _0x99e9=['update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put'];(function(_0x494112,_0x35b4e9){var _0x16efb4=function(_0x21de11){while(--_0x21de11){_0x494112['push'](_0x494112['shift']());}};_0x16efb4(++_0x35b4e9);}(_0x99e9,0xb4));var _0x999e=function(_0x430095,_0x122722){_0x430095=_0x430095-0x0;var _0x115f8a=_0x99e9[_0x430095];return _0x115f8a;};'use strict';var multer=require('multer');var util=require(_0x999e('0x0'));var path=require(_0x999e('0x1'));var timeout=require(_0x999e('0x2'));var express=require(_0x999e('0x3'));var router=express['Router']();var fs_extra=require(_0x999e('0x4'));var auth=require(_0x999e('0x5'));var interaction=require(_0x999e('0x6'));var config=require('../../config/environment');var controller=require(_0x999e('0x7'));router['get']('/',auth[_0x999e('0x8')](),controller[_0x999e('0x9')]);router[_0x999e('0xa')](_0x999e('0xb'),auth['isAuthenticated'](),controller[_0x999e('0xc')]);router[_0x999e('0xa')](_0x999e('0xd'),auth[_0x999e('0x8')](),controller[_0x999e('0xe')]);router[_0x999e('0xf')]('/',auth[_0x999e('0x8')](),controller[_0x999e('0x10')]);router[_0x999e('0x11')](_0x999e('0xd'),auth[_0x999e('0x8')](),controller[_0x999e('0x12')]);router[_0x999e('0x13')](_0x999e('0xd'),auth[_0x999e('0x8')](),controller[_0x999e('0x14')]);module[_0x999e('0x15')]=router; \ No newline at end of file +var _0xe14d=['isAuthenticated','index','describe','/:id','show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get'];(function(_0x521426,_0x5881c7){var _0x344c4a=function(_0x46f31b){while(--_0x46f31b){_0x521426['push'](_0x521426['shift']());}};_0x344c4a(++_0x5881c7);}(_0xe14d,0x1ee));var _0xde14=function(_0x5317b5,_0x4dfd6e){_0x5317b5=_0x5317b5-0x0;var _0x3b7ce2=_0xe14d[_0x5317b5];return _0x3b7ce2;};'use strict';var multer=require(_0xde14('0x0'));var util=require(_0xde14('0x1'));var path=require(_0xde14('0x2'));var timeout=require(_0xde14('0x3'));var express=require('express');var router=express[_0xde14('0x4')]();var fs_extra=require(_0xde14('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xde14('0x6'));var config=require(_0xde14('0x7'));var controller=require(_0xde14('0x8'));router[_0xde14('0x9')]('/',auth[_0xde14('0xa')](),controller[_0xde14('0xb')]);router['get']('/describe',auth[_0xde14('0xa')](),controller[_0xde14('0xc')]);router[_0xde14('0x9')](_0xde14('0xd'),auth[_0xde14('0xa')](),controller[_0xde14('0xe')]);router[_0xde14('0xf')]('/',auth[_0xde14('0xa')](),controller['create']);router[_0xde14('0x10')](_0xde14('0xd'),auth[_0xde14('0xa')](),controller[_0xde14('0x11')]);router[_0xde14('0x12')](_0xde14('0xd'),auth[_0xde14('0xa')](),controller[_0xde14('0x13')]);module[_0xde14('0x14')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index a05e138..6e0029f 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(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x7a54,0x106));var _0x47a5=function(_0x2f91d3,_0x126770){_0x2f91d3=_0x2f91d3-0x0;var _0x5017a6=_0x7a54[_0x2f91d3];return _0x5017a6;};'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(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x7a54,0x106));var _0x47a5=function(_0x2d4bd6,_0x4f32bd){_0x2d4bd6=_0x2d4bd6-0x0;var _0x2d0ee7=_0x7a54[_0x2d4bd6];return _0x2d0ee7;};'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 8865a5d..7e9887b 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 _0x3bd7=['ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','then','destroy','stack','name','send','index','map','rawAttributes','key','model','keys','filters','intersection','query','fields','attributes','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','JscriptyAnswerReport','includeAll','include','findAll','rows','catch','show','params','create','update','body','find','describe','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','squel','to-csv'];(function(_0x3a3e9c,_0x286464){var _0x309585=function(_0x31d00d){while(--_0x31d00d){_0x3a3e9c['push'](_0x3a3e9c['shift']());}};_0x309585(++_0x286464);}(_0x3bd7,0x199));var _0x73bd=function(_0x2e3107,_0x25f970){_0x2e3107=_0x2e3107-0x0;var _0x833d69=_0x3bd7[_0x2e3107];return _0x833d69;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x73bd('0x0'));var jsonpatch=require(_0x73bd('0x1'));var rp=require(_0x73bd('0x2'));var moment=require('moment');var BPromise=require(_0x73bd('0x3'));var Mustache=require(_0x73bd('0x4'));var util=require(_0x73bd('0x5'));var path=require('path');var sox=require(_0x73bd('0x6'));var csv=require('to-csv');var ejs=require(_0x73bd('0x7'));var fs=require('fs');var fs_extra=require(_0x73bd('0x8'));var _=require('lodash');var squel=require(_0x73bd('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x73bd('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x73bd('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x73bd('0xc'));var as=require(_0x73bd('0xd'));var hardwareService=require(_0x73bd('0xe'));var logger=require(_0x73bd('0xf'))(_0x73bd('0x10'));var utils=require(_0x73bd('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x73bd('0x12'));var db=require(_0x73bd('0x13'))['db'];function respondWithStatusCode(_0x31c882,_0x41f324){_0x41f324=_0x41f324||0xcc;return function(_0x2a5dea){if(_0x2a5dea){return _0x31c882[_0x73bd('0x14')](_0x41f324);}return _0x31c882['status'](_0x41f324)[_0x73bd('0x15')]();};}function respondWithResult(_0x5c4bc8,_0x189007){_0x189007=_0x189007||0xc8;return function(_0x3eab86){if(_0x3eab86){return _0x5c4bc8[_0x73bd('0x16')](_0x189007)[_0x73bd('0x17')](_0x3eab86);}};}function respondWithFilteredResult(_0x3e628a,_0x5ea8db){return function(_0x41663e){if(_0x41663e){var _0xfdf66=typeof _0x5ea8db[_0x73bd('0x18')]===_0x73bd('0x19')&&typeof _0x5ea8db[_0x73bd('0x1a')]===_0x73bd('0x19');var _0x10e371=_0x41663e[_0x73bd('0x1b')];var _0x21787b=_0xfdf66?0x0:_0x5ea8db['offset'];var _0x1e559b=_0xfdf66?_0x41663e[_0x73bd('0x1b')]:_0x5ea8db[_0x73bd('0x18')]+_0x5ea8db[_0x73bd('0x1a')];var _0x1cb0e3;if(_0x1e559b>=_0x10e371){_0x1e559b=_0x10e371;_0x1cb0e3=0xc8;}else{_0x1cb0e3=0xce;}_0x3e628a[_0x73bd('0x16')](_0x1cb0e3);return _0x3e628a[_0x73bd('0x1c')](_0x73bd('0x1d'),_0x21787b+'-'+_0x1e559b+'/'+_0x10e371)[_0x73bd('0x17')](_0x41663e);}return null;};}function patchUpdates(_0x57d1ec){return function(_0x459965){try{jsonpatch[_0x73bd('0x1e')](_0x459965,_0x57d1ec,!![]);}catch(_0x292f8c){return BPromise['reject'](_0x292f8c);}return _0x459965['save']();};}function saveUpdates(_0x4f23e6,_0x10b388){return function(_0x269e84){if(_0x269e84){return _0x269e84['update'](_0x4f23e6)[_0x73bd('0x1f')](function(_0x22574c){return _0x22574c;});}return null;};}function removeEntity(_0x5b7bbb,_0x325cc1){return function(_0x1e22c5){if(_0x1e22c5){return _0x1e22c5[_0x73bd('0x20')]()[_0x73bd('0x1f')](function(){_0x5b7bbb[_0x73bd('0x16')](0xcc)[_0x73bd('0x15')]();});}};}function handleEntityNotFound(_0x2dd70b,_0x36f7e0){return function(_0x840215){if(!_0x840215){_0x2dd70b[_0x73bd('0x14')](0x194);}return _0x840215;};}function handleError(_0x473527,_0x388698){_0x388698=_0x388698||0x1f4;return function(_0x52e910){logger['error'](_0x52e910[_0x73bd('0x21')]);if(_0x52e910[_0x73bd('0x22')]){delete _0x52e910['name'];}_0x473527[_0x73bd('0x16')](_0x388698)[_0x73bd('0x23')](_0x52e910);};}exports[_0x73bd('0x24')]=function(_0x5ada8d,_0x5ae04e){var _0x2f38fe={},_0x3f15f8={},_0x315318={'count':0x0,'rows':[]};var _0x5be8d6=_[_0x73bd('0x25')](db['JscriptyAnswerReport'][_0x73bd('0x26')],function(_0x2701da){return{'name':_0x2701da['fieldName'],'type':_0x2701da['type'][_0x73bd('0x27')]};});_0x3f15f8[_0x73bd('0x28')]=_[_0x73bd('0x25')](_0x5be8d6,_0x73bd('0x22'));_0x3f15f8['query']=_[_0x73bd('0x29')](_0x5ada8d['query']);_0x3f15f8[_0x73bd('0x2a')]=_[_0x73bd('0x2b')](_0x3f15f8[_0x73bd('0x28')],_0x3f15f8[_0x73bd('0x2c')]);_0x2f38fe['attributes']=_[_0x73bd('0x2b')](_0x3f15f8[_0x73bd('0x28')],qs[_0x73bd('0x2d')](_0x5ada8d[_0x73bd('0x2c')][_0x73bd('0x2d')]));_0x2f38fe[_0x73bd('0x2e')]=_0x2f38fe[_0x73bd('0x2e')][_0x73bd('0x2f')]?_0x2f38fe['attributes']:_0x3f15f8[_0x73bd('0x28')];if(!_0x5ada8d[_0x73bd('0x2c')]['hasOwnProperty'](_0x73bd('0x30'))){_0x2f38fe[_0x73bd('0x1a')]=qs['limit'](_0x5ada8d[_0x73bd('0x2c')]['limit']);_0x2f38fe[_0x73bd('0x18')]=qs['offset'](_0x5ada8d[_0x73bd('0x2c')][_0x73bd('0x18')]);}_0x2f38fe[_0x73bd('0x31')]=qs[_0x73bd('0x32')](_0x5ada8d[_0x73bd('0x2c')][_0x73bd('0x32')]);_0x2f38fe[_0x73bd('0x33')]=qs['filters'](_[_0x73bd('0x34')](_0x5ada8d[_0x73bd('0x2c')],_0x3f15f8['filters']),_0x5be8d6);if(_0x5ada8d[_0x73bd('0x2c')]['filter']){_0x2f38fe[_0x73bd('0x33')]=_[_0x73bd('0x35')](_0x2f38fe[_0x73bd('0x33')],{'$or':_[_0x73bd('0x25')](_0x5be8d6,function(_0x367597){if(_0x367597['type']!==_0x73bd('0x36')){var _0x2de851={};_0x2de851[_0x367597[_0x73bd('0x22')]]={'$like':'%'+_0x5ada8d['query'][_0x73bd('0x37')]+'%'};return _0x2de851;}})});}_0x2f38fe=_[_0x73bd('0x35')]({},_0x2f38fe,_0x5ada8d[_0x73bd('0x38')]);var _0x30e148={'where':_0x2f38fe[_0x73bd('0x33')]};return db[_0x73bd('0x39')][_0x73bd('0x1b')](_0x30e148)[_0x73bd('0x1f')](function(_0x519c3c){_0x315318[_0x73bd('0x1b')]=_0x519c3c;if(_0x5ada8d[_0x73bd('0x2c')][_0x73bd('0x3a')]){_0x2f38fe[_0x73bd('0x3b')]=[{'all':!![]}];}return db[_0x73bd('0x39')][_0x73bd('0x3c')](_0x2f38fe);})[_0x73bd('0x1f')](function(_0x48fed7){_0x315318[_0x73bd('0x3d')]=_0x48fed7;return _0x315318;})[_0x73bd('0x1f')](respondWithFilteredResult(_0x5ae04e,_0x2f38fe))[_0x73bd('0x3e')](handleError(_0x5ae04e,null));};exports[_0x73bd('0x3f')]=function(_0x532afd,_0x142532){var _0x234de7={'raw':!![],'where':{'id':_0x532afd[_0x73bd('0x40')]['id']}},_0xe91596={};_0xe91596[_0x73bd('0x28')]=_['keys'](db[_0x73bd('0x39')]['rawAttributes']);_0xe91596[_0x73bd('0x2c')]=_['keys'](_0x532afd[_0x73bd('0x2c')]);_0xe91596[_0x73bd('0x2a')]=_['intersection'](_0xe91596[_0x73bd('0x28')],_0xe91596[_0x73bd('0x2c')]);_0x234de7[_0x73bd('0x2e')]=_[_0x73bd('0x2b')](_0xe91596[_0x73bd('0x28')],qs['fields'](_0x532afd[_0x73bd('0x2c')][_0x73bd('0x2d')]));_0x234de7[_0x73bd('0x2e')]=_0x234de7[_0x73bd('0x2e')][_0x73bd('0x2f')]?_0x234de7[_0x73bd('0x2e')]:_0xe91596[_0x73bd('0x28')];if(_0x532afd[_0x73bd('0x2c')]['includeAll']){_0x234de7['include']=[{'all':!![]}];}_0x234de7=_[_0x73bd('0x35')]({},_0x234de7,_0x532afd[_0x73bd('0x38')]);return db[_0x73bd('0x39')]['find'](_0x234de7)[_0x73bd('0x1f')](handleEntityNotFound(_0x142532,null))['then'](respondWithResult(_0x142532,null))[_0x73bd('0x3e')](handleError(_0x142532,null));};exports[_0x73bd('0x41')]=function(_0x57df9e,_0x4905a4){return db['JscriptyAnswerReport'][_0x73bd('0x41')](_0x57df9e['body'],{})[_0x73bd('0x1f')](respondWithResult(_0x4905a4,0xc9))['catch'](handleError(_0x4905a4,null));};exports[_0x73bd('0x42')]=function(_0x1e2e28,_0x7b4baf){if(_0x1e2e28[_0x73bd('0x43')]['id']){delete _0x1e2e28['body']['id'];}return db[_0x73bd('0x39')][_0x73bd('0x44')]({'where':{'id':_0x1e2e28[_0x73bd('0x40')]['id']}})[_0x73bd('0x1f')](handleEntityNotFound(_0x7b4baf,null))[_0x73bd('0x1f')](saveUpdates(_0x1e2e28[_0x73bd('0x43')],null))[_0x73bd('0x1f')](respondWithResult(_0x7b4baf,null))[_0x73bd('0x3e')](handleError(_0x7b4baf,null));};exports['destroy']=function(_0x8b88f5,_0x47397d){return db['JscriptyAnswerReport'][_0x73bd('0x44')]({'where':{'id':_0x8b88f5[_0x73bd('0x40')]['id']}})[_0x73bd('0x1f')](handleEntityNotFound(_0x47397d,null))['then'](removeEntity(_0x47397d,null))[_0x73bd('0x3e')](handleError(_0x47397d,null));};exports[_0x73bd('0x45')]=function(_0x23b5ad,_0x2201c7){return db[_0x73bd('0x39')]['describe']()['then'](respondWithResult(_0x2201c7,null))['catch'](handleError(_0x2201c7,null));}; \ No newline at end of file +var _0x5d58=['undefined','limit','count','set','apply','then','error','stack','name','send','index','map','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','JscriptyAnswerReport','include','findAll','rows','show','params','rawAttributes','keys','length','includeAll','merge','create','update','find','catch','destroy','describe','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset'];(function(_0x3da612,_0x332456){var _0x1a9d1d=function(_0x5ca0d0){while(--_0x5ca0d0){_0x3da612['push'](_0x3da612['shift']());}};_0x1a9d1d(++_0x332456);}(_0x5d58,0x187));var _0x85d5=function(_0x12ebe2,_0x11b0ba){_0x12ebe2=_0x12ebe2-0x0;var _0x55053f=_0x5d58[_0x12ebe2];return _0x55053f;};'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('request-promise');var moment=require(_0x85d5('0x0'));var BPromise=require(_0x85d5('0x1'));var Mustache=require('mustache');var util=require(_0x85d5('0x2'));var path=require(_0x85d5('0x3'));var sox=require('sox');var csv=require(_0x85d5('0x4'));var ejs=require(_0x85d5('0x5'));var fs=require('fs');var fs_extra=require(_0x85d5('0x6'));var _=require(_0x85d5('0x7'));var squel=require('squel');var crypto=require(_0x85d5('0x8'));var jsforce=require(_0x85d5('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x85d5('0x4'));var querystring=require('querystring');var Papa=require(_0x85d5('0xa'));var Redis=require(_0x85d5('0xb'));var authService=require(_0x85d5('0xc'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x85d5('0xd'))(_0x85d5('0xe'));var utils=require(_0x85d5('0xf'));var config=require(_0x85d5('0x10'));var licenseUtil=require(_0x85d5('0x11'));var db=require(_0x85d5('0x12'))['db'];function respondWithStatusCode(_0x31409d,_0x5897af){_0x5897af=_0x5897af||0xcc;return function(_0x4bbf2a){if(_0x4bbf2a){return _0x31409d['sendStatus'](_0x5897af);}return _0x31409d[_0x85d5('0x13')](_0x5897af)[_0x85d5('0x14')]();};}function respondWithResult(_0x339d4f,_0x1704f0){_0x1704f0=_0x1704f0||0xc8;return function(_0x18a20c){if(_0x18a20c){return _0x339d4f[_0x85d5('0x13')](_0x1704f0)[_0x85d5('0x15')](_0x18a20c);}};}function respondWithFilteredResult(_0x586382,_0x18e977){return function(_0x2d7c95){if(_0x2d7c95){var _0x1621ed=typeof _0x18e977[_0x85d5('0x16')]===_0x85d5('0x17')&&typeof _0x18e977[_0x85d5('0x18')]===_0x85d5('0x17');var _0x12bef9=_0x2d7c95[_0x85d5('0x19')];var _0x17acb0=_0x1621ed?0x0:_0x18e977[_0x85d5('0x16')];var _0x432bd6=_0x1621ed?_0x2d7c95[_0x85d5('0x19')]:_0x18e977[_0x85d5('0x16')]+_0x18e977[_0x85d5('0x18')];var _0x26981b;if(_0x432bd6>=_0x12bef9){_0x432bd6=_0x12bef9;_0x26981b=0xc8;}else{_0x26981b=0xce;}_0x586382[_0x85d5('0x13')](_0x26981b);return _0x586382[_0x85d5('0x1a')]('Content-Range',_0x17acb0+'-'+_0x432bd6+'/'+_0x12bef9)[_0x85d5('0x15')](_0x2d7c95);}return null;};}function patchUpdates(_0x133fa9){return function(_0x5f5755){try{jsonpatch[_0x85d5('0x1b')](_0x5f5755,_0x133fa9,!![]);}catch(_0x1264ca){return BPromise['reject'](_0x1264ca);}return _0x5f5755['save']();};}function saveUpdates(_0x347337,_0x5a1b9a){return function(_0x2f2bae){if(_0x2f2bae){return _0x2f2bae['update'](_0x347337)[_0x85d5('0x1c')](function(_0x1f8d27){return _0x1f8d27;});}return null;};}function removeEntity(_0x560b3a,_0x4e11c4){return function(_0x4da71b){if(_0x4da71b){return _0x4da71b['destroy']()[_0x85d5('0x1c')](function(){_0x560b3a[_0x85d5('0x13')](0xcc)[_0x85d5('0x14')]();});}};}function handleEntityNotFound(_0x466bbd,_0x12fea3){return function(_0xef2405){if(!_0xef2405){_0x466bbd['sendStatus'](0x194);}return _0xef2405;};}function handleError(_0x7e9a11,_0x4f8c66){_0x4f8c66=_0x4f8c66||0x1f4;return function(_0x1b3fae){logger[_0x85d5('0x1d')](_0x1b3fae[_0x85d5('0x1e')]);if(_0x1b3fae['name']){delete _0x1b3fae[_0x85d5('0x1f')];}_0x7e9a11[_0x85d5('0x13')](_0x4f8c66)[_0x85d5('0x20')](_0x1b3fae);};}exports[_0x85d5('0x21')]=function(_0x4605c5,_0x56031f){var _0x1cbef1={},_0x476c8b={},_0x330f8a={'count':0x0,'rows':[]};var _0x22a961=_[_0x85d5('0x22')](db['JscriptyAnswerReport']['rawAttributes'],function(_0x2ce7a9){return{'name':_0x2ce7a9[_0x85d5('0x23')],'type':_0x2ce7a9[_0x85d5('0x24')][_0x85d5('0x25')]};});_0x476c8b[_0x85d5('0x26')]=_['map'](_0x22a961,_0x85d5('0x1f'));_0x476c8b[_0x85d5('0x27')]=_['keys'](_0x4605c5['query']);_0x476c8b[_0x85d5('0x28')]=_[_0x85d5('0x29')](_0x476c8b['model'],_0x476c8b[_0x85d5('0x27')]);_0x1cbef1['attributes']=_[_0x85d5('0x29')](_0x476c8b[_0x85d5('0x26')],qs['fields'](_0x4605c5[_0x85d5('0x27')][_0x85d5('0x2a')]));_0x1cbef1[_0x85d5('0x2b')]=_0x1cbef1[_0x85d5('0x2b')]['length']?_0x1cbef1['attributes']:_0x476c8b[_0x85d5('0x26')];if(!_0x4605c5[_0x85d5('0x27')][_0x85d5('0x2c')](_0x85d5('0x2d'))){_0x1cbef1[_0x85d5('0x18')]=qs[_0x85d5('0x18')](_0x4605c5[_0x85d5('0x27')][_0x85d5('0x18')]);_0x1cbef1[_0x85d5('0x16')]=qs['offset'](_0x4605c5['query'][_0x85d5('0x16')]);}_0x1cbef1[_0x85d5('0x2e')]=qs[_0x85d5('0x2f')](_0x4605c5[_0x85d5('0x27')][_0x85d5('0x2f')]);_0x1cbef1[_0x85d5('0x30')]=qs[_0x85d5('0x28')](_[_0x85d5('0x31')](_0x4605c5['query'],_0x476c8b[_0x85d5('0x28')]),_0x22a961);if(_0x4605c5[_0x85d5('0x27')][_0x85d5('0x32')]){_0x1cbef1[_0x85d5('0x30')]=_['merge'](_0x1cbef1[_0x85d5('0x30')],{'$or':_[_0x85d5('0x22')](_0x22a961,function(_0x3282d3){if(_0x3282d3[_0x85d5('0x24')]!=='VIRTUAL'){var _0x34caed={};_0x34caed[_0x3282d3['name']]={'$like':'%'+_0x4605c5['query'][_0x85d5('0x32')]+'%'};return _0x34caed;}})});}_0x1cbef1=_['merge']({},_0x1cbef1,_0x4605c5[_0x85d5('0x33')]);var _0x5ddba7={'where':_0x1cbef1['where']};return db[_0x85d5('0x34')][_0x85d5('0x19')](_0x5ddba7)[_0x85d5('0x1c')](function(_0x1beffc){_0x330f8a[_0x85d5('0x19')]=_0x1beffc;if(_0x4605c5['query']['includeAll']){_0x1cbef1[_0x85d5('0x35')]=[{'all':!![]}];}return db[_0x85d5('0x34')][_0x85d5('0x36')](_0x1cbef1);})[_0x85d5('0x1c')](function(_0xdd8b3e){_0x330f8a[_0x85d5('0x37')]=_0xdd8b3e;return _0x330f8a;})['then'](respondWithFilteredResult(_0x56031f,_0x1cbef1))['catch'](handleError(_0x56031f,null));};exports[_0x85d5('0x38')]=function(_0x52c99b,_0xfbf466){var _0x18e94d={'raw':!![],'where':{'id':_0x52c99b[_0x85d5('0x39')]['id']}},_0x7dd430={};_0x7dd430[_0x85d5('0x26')]=_['keys'](db['JscriptyAnswerReport'][_0x85d5('0x3a')]);_0x7dd430[_0x85d5('0x27')]=_[_0x85d5('0x3b')](_0x52c99b[_0x85d5('0x27')]);_0x7dd430[_0x85d5('0x28')]=_[_0x85d5('0x29')](_0x7dd430[_0x85d5('0x26')],_0x7dd430[_0x85d5('0x27')]);_0x18e94d[_0x85d5('0x2b')]=_[_0x85d5('0x29')](_0x7dd430[_0x85d5('0x26')],qs[_0x85d5('0x2a')](_0x52c99b[_0x85d5('0x27')][_0x85d5('0x2a')]));_0x18e94d[_0x85d5('0x2b')]=_0x18e94d[_0x85d5('0x2b')][_0x85d5('0x3c')]?_0x18e94d['attributes']:_0x7dd430['model'];if(_0x52c99b[_0x85d5('0x27')][_0x85d5('0x3d')]){_0x18e94d[_0x85d5('0x35')]=[{'all':!![]}];}_0x18e94d=_[_0x85d5('0x3e')]({},_0x18e94d,_0x52c99b[_0x85d5('0x33')]);return db[_0x85d5('0x34')]['find'](_0x18e94d)[_0x85d5('0x1c')](handleEntityNotFound(_0xfbf466,null))['then'](respondWithResult(_0xfbf466,null))['catch'](handleError(_0xfbf466,null));};exports[_0x85d5('0x3f')]=function(_0x13ab32,_0x12a03){return db[_0x85d5('0x34')][_0x85d5('0x3f')](_0x13ab32['body'],{})[_0x85d5('0x1c')](respondWithResult(_0x12a03,0xc9))['catch'](handleError(_0x12a03,null));};exports[_0x85d5('0x40')]=function(_0xd8db57,_0x219154){if(_0xd8db57['body']['id']){delete _0xd8db57['body']['id'];}return db['JscriptyAnswerReport'][_0x85d5('0x41')]({'where':{'id':_0xd8db57[_0x85d5('0x39')]['id']}})[_0x85d5('0x1c')](handleEntityNotFound(_0x219154,null))['then'](saveUpdates(_0xd8db57['body'],null))[_0x85d5('0x1c')](respondWithResult(_0x219154,null))[_0x85d5('0x42')](handleError(_0x219154,null));};exports[_0x85d5('0x43')]=function(_0x288b56,_0x4b2dce){return db[_0x85d5('0x34')][_0x85d5('0x41')]({'where':{'id':_0x288b56[_0x85d5('0x39')]['id']}})[_0x85d5('0x1c')](handleEntityNotFound(_0x4b2dce,null))[_0x85d5('0x1c')](removeEntity(_0x4b2dce,null))[_0x85d5('0x42')](handleError(_0x4b2dce,null));};exports[_0x85d5('0x44')]=function(_0x34b784,_0x185a70){return db[_0x85d5('0x34')][_0x85d5('0x44')]()[_0x85d5('0x1c')](respondWithResult(_0x185a70,null))[_0x85d5('0x42')](handleError(_0x185a70,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 0168530..1634ebc 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 _0xa596=['./jscriptyAnswerReport.attributes','exports','define','report_jscripty_answers','util','moment','bluebird','request-promise','path','rimraf'];(function(_0x3e531a,_0x28a82a){var _0x3c2574=function(_0x4a0c98){while(--_0x4a0c98){_0x3e531a['push'](_0x3e531a['shift']());}};_0x3c2574(++_0x28a82a);}(_0xa596,0x108));var _0x6a59=function(_0x312067,_0x384152){_0x312067=_0x312067-0x0;var _0x4af09d=_0xa596[_0x312067];return _0x4af09d;};'use strict';var _=require('lodash');var util=require(_0x6a59('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x6a59('0x1'));var BPromise=require(_0x6a59('0x2'));var rp=require(_0x6a59('0x3'));var fs=require('fs');var path=require(_0x6a59('0x4'));var rimraf=require(_0x6a59('0x5'));var config=require('../../config/environment');var attributes=require(_0x6a59('0x6'));module[_0x6a59('0x7')]=function(_0x58b721,_0x317a9b){return _0x58b721[_0x6a59('0x8')]('JscriptyAnswerReport',attributes,{'tableName':_0x6a59('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x66fb=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','report_jscripty_answers','util','../../config/logger'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x66fb,0xa3));var _0xb66f=function(_0x5d0e28,_0x465a0f){_0x5d0e28=_0x5d0e28-0x0;var _0x464986=_0x66fb[_0x5d0e28];return _0x464986;};'use strict';var _=require('lodash');var util=require(_0xb66f('0x0'));var logger=require(_0xb66f('0x1'))(_0xb66f('0x2'));var moment=require(_0xb66f('0x3'));var BPromise=require(_0xb66f('0x4'));var rp=require(_0xb66f('0x5'));var fs=require('fs');var path=require(_0xb66f('0x6'));var rimraf=require(_0xb66f('0x7'));var config=require(_0xb66f('0x8'));var attributes=require('./jscriptyAnswerReport.attributes');module['exports']=function(_0x2b5bdf,_0x2f2f74){return _0x2b5bdf[_0xb66f('0x9')]('JscriptyAnswerReport',attributes,{'tableName':_0xb66f('0xa'),'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 d17c1df..758cb37 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 _0x0088=['../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','lodash','moment'];(function(_0x31cb77,_0x348021){var _0x710374=function(_0x5e92f6){while(--_0x5e92f6){_0x31cb77['push'](_0x31cb77['shift']());}};_0x710374(++_0x348021);}(_0x0088,0xa0));var _0x8008=function(_0xb62ada,_0x2d39d9){_0xb62ada=_0xb62ada-0x0;var _0x4c6fc7=_0x0088[_0xb62ada];return _0x4c6fc7;};'use strict';var _=require(_0x8008('0x0'));var util=require('util');var moment=require(_0x8008('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8008('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x8008('0x3'))(_0x8008('0x4'));var config=require(_0x8008('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x8008('0x6')][_0x8008('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3c5fb1,_0xbaeeac,_0x8e36e6){return new BPromise(function(_0xa85823,_0x3e1c0f){return client[_0x8008('0x8')](_0x3c5fb1,_0x8e36e6)[_0x8008('0x9')](function(_0x335b28){logger[_0x8008('0xa')](_0x8008('0xb'),_0xbaeeac,'request\x20sent');logger['debug'](_0x8008('0xc'),_0xbaeeac,_0x8008('0xd'),JSON['stringify'](_0x335b28));if(_0x335b28[_0x8008('0xe')]){if(_0x335b28['error'][_0x8008('0xf')]===0x1f4){logger[_0x8008('0xe')](_0x8008('0xb'),_0xbaeeac,_0x335b28['error'][_0x8008('0x10')]);return _0x3e1c0f(_0x335b28['error'][_0x8008('0x10')]);}logger[_0x8008('0xe')](_0x8008('0xb'),_0xbaeeac,_0x335b28[_0x8008('0xe')]['message']);return _0xa85823(_0x335b28[_0x8008('0xe')][_0x8008('0x10')]);}else{logger[_0x8008('0xa')]('JscriptyAnswerReport,\x20%s,\x20%s',_0xbaeeac,'request\x20sent');_0xa85823(_0x335b28['result'][_0x8008('0x10')]);}})[_0x8008('0x11')](function(_0x14680f){logger[_0x8008('0xe')](_0x8008('0xb'),_0xbaeeac,_0x14680f);_0x3e1c0f(_0x14680f);});});} \ No newline at end of file +var _0xa35f=['info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','error','code','message','result','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x397cfb,_0xb8f317){var _0x15fed9=function(_0x3eba43){while(--_0x3eba43){_0x397cfb['push'](_0x397cfb['shift']());}};_0x15fed9(++_0xb8f317);}(_0xa35f,0xa3));var _0xfa35=function(_0x26a818,_0x40708a){_0x26a818=_0x26a818-0x0;var _0x5d8ca0=_0xa35f[_0x26a818];return _0x5d8ca0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xfa35('0x0'));var BPromise=require('bluebird');var rs=require(_0xfa35('0x1'));var fs=require('fs');var Redis=require(_0xfa35('0x2'));var db=require(_0xfa35('0x3'))['db'];var utils=require(_0xfa35('0x4'));var logger=require(_0xfa35('0x5'))(_0xfa35('0x6'));var config=require(_0xfa35('0x7'));var jayson=require(_0xfa35('0x8'));var client=jayson[_0xfa35('0x9')][_0xfa35('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x193287,_0x2b6391,_0x28279d){return new BPromise(function(_0x574278,_0x37ca9b){return client[_0xfa35('0xb')](_0x193287,_0x28279d)[_0xfa35('0xc')](function(_0x2a88a7){logger[_0xfa35('0xd')](_0xfa35('0xe'),_0x2b6391,_0xfa35('0xf'));logger[_0xfa35('0x10')](_0xfa35('0x11'),_0x2b6391,'request\x20sent',JSON['stringify'](_0x2a88a7));if(_0x2a88a7[_0xfa35('0x12')]){if(_0x2a88a7[_0xfa35('0x12')][_0xfa35('0x13')]===0x1f4){logger[_0xfa35('0x12')](_0xfa35('0xe'),_0x2b6391,_0x2a88a7[_0xfa35('0x12')][_0xfa35('0x14')]);return _0x37ca9b(_0x2a88a7['error'][_0xfa35('0x14')]);}logger[_0xfa35('0x12')](_0xfa35('0xe'),_0x2b6391,_0x2a88a7[_0xfa35('0x12')]['message']);return _0x574278(_0x2a88a7[_0xfa35('0x12')][_0xfa35('0x14')]);}else{logger[_0xfa35('0xd')](_0xfa35('0xe'),_0x2b6391,'request\x20sent');_0x574278(_0x2a88a7[_0xfa35('0x15')][_0xfa35('0x14')]);}})['catch'](function(_0xfbfbe4){logger[_0xfa35('0x12')](_0xfa35('0xe'),_0x2b6391,_0xfbfbe4);_0x37ca9b(_0xfbfbe4);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 623288b..7b0f362 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 _0xa03a=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','isAuthenticated','index','get','/:id','show','/:id/sessions','/:id/answers','getAnswers','/:id/summary','30s','getSummary','post','/:id/clone','clone','put','delete','destroy','exports'];(function(_0x2c996a,_0x3b53e1){var _0x17f8e8=function(_0x258b2){while(--_0x258b2){_0x2c996a['push'](_0x2c996a['shift']());}};_0x17f8e8(++_0x3b53e1);}(_0xa03a,0xe0));var _0xaa03=function(_0x486f4a,_0x478dc7){_0x486f4a=_0x486f4a-0x0;var _0x135d99=_0xa03a[_0x486f4a];return _0x135d99;};'use strict';var multer=require(_0xaa03('0x0'));var util=require(_0xaa03('0x1'));var path=require(_0xaa03('0x2'));var timeout=require(_0xaa03('0x3'));var express=require(_0xaa03('0x4'));var router=express[_0xaa03('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xaa03('0x6'));var interaction=require(_0xaa03('0x7'));var config=require(_0xaa03('0x8'));var controller=require(_0xaa03('0x9'));router['get']('/',auth[_0xaa03('0xa')](),controller[_0xaa03('0xb')]);router[_0xaa03('0xc')](_0xaa03('0xd'),auth[_0xaa03('0xa')](),controller[_0xaa03('0xe')]);router[_0xaa03('0xc')](_0xaa03('0xf'),auth['isAuthenticated'](),controller['getSessions']);router[_0xaa03('0xc')](_0xaa03('0x10'),auth[_0xaa03('0xa')](),controller[_0xaa03('0x11')]);router[_0xaa03('0xc')](_0xaa03('0x12'),auth[_0xaa03('0xa')](),timeout(_0xaa03('0x13')),controller[_0xaa03('0x14')]);router[_0xaa03('0x15')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xaa03('0x16'),auth['isAuthenticated'](),controller[_0xaa03('0x17')]);router[_0xaa03('0x18')](_0xaa03('0xd'),auth['isAuthenticated'](),controller['update']);router[_0xaa03('0x19')](_0xaa03('0xd'),auth[_0xaa03('0xa')](),controller[_0xaa03('0x1a')]);module[_0xaa03('0x1b')]=router; \ No newline at end of file +var _0x70d1=['exports','util','path','connect-timeout','express','Router','../../components/interaction/service','./jscriptyProject.controller','get','index','isAuthenticated','show','/:id/sessions','getSessions','/:id/answers','/:id/summary','30s','getSummary','post','create','/:id/clone','clone','put','/:id','update','delete','destroy'];(function(_0x1acc2d,_0x597696){var _0xabfa6d=function(_0x41e83c){while(--_0x41e83c){_0x1acc2d['push'](_0x1acc2d['shift']());}};_0xabfa6d(++_0x597696);}(_0x70d1,0x160));var _0x170d=function(_0x1ac562,_0x270a2d){_0x1ac562=_0x1ac562-0x0;var _0x483610=_0x70d1[_0x1ac562];return _0x483610;};'use strict';var multer=require('multer');var util=require(_0x170d('0x0'));var path=require(_0x170d('0x1'));var timeout=require(_0x170d('0x2'));var express=require(_0x170d('0x3'));var router=express[_0x170d('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x170d('0x5'));var config=require('../../config/environment');var controller=require(_0x170d('0x6'));router[_0x170d('0x7')]('/',auth['isAuthenticated'](),controller[_0x170d('0x8')]);router[_0x170d('0x7')]('/:id',auth[_0x170d('0x9')](),controller[_0x170d('0xa')]);router[_0x170d('0x7')](_0x170d('0xb'),auth['isAuthenticated'](),controller[_0x170d('0xc')]);router[_0x170d('0x7')](_0x170d('0xd'),auth[_0x170d('0x9')](),controller['getAnswers']);router[_0x170d('0x7')](_0x170d('0xe'),auth['isAuthenticated'](),timeout(_0x170d('0xf')),controller[_0x170d('0x10')]);router[_0x170d('0x11')]('/',auth[_0x170d('0x9')](),controller[_0x170d('0x12')]);router['post'](_0x170d('0x13'),auth[_0x170d('0x9')](),controller[_0x170d('0x14')]);router[_0x170d('0x15')](_0x170d('0x16'),auth[_0x170d('0x9')](),controller[_0x170d('0x17')]);router[_0x170d('0x18')]('/:id',auth[_0x170d('0x9')](),controller[_0x170d('0x19')]);module[_0x170d('0x1a')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index cc8236d..7ab8e14 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 _0x4365=['getDataValue','description','BOOLEAN','sequelize','util','exports','STRING','name','TEXT','long','isObjectLike','setDataValue','isString','formData','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}'];(function(_0x10fa41,_0x130665){var _0xd9e417=function(_0x4319f1){while(--_0x4319f1){_0x10fa41['push'](_0x10fa41['shift']());}};_0xd9e417(++_0x130665);}(_0x4365,0x163));var _0x5436=function(_0x5d245c,_0x858414){_0x5d245c=_0x5d245c-0x0;var _0x2cfacd=_0x4365[_0x5d245c];return _0x2cfacd;};'use strict';var Sequelize=require(_0x5436('0x0'));var _=require('lodash');var util=require(_0x5436('0x1'));module[_0x5436('0x2')]={'name':{'type':Sequelize[_0x5436('0x3')],'unique':_0x5436('0x4')},'description':{'type':Sequelize[_0x5436('0x3')]},'formData':{'type':Sequelize[_0x5436('0x5')](_0x5436('0x6')),'set':function(_0xf3a69c){if(_[_0x5436('0x7')](_0xf3a69c)){this[_0x5436('0x8')]('formData',JSON['stringify'](_0xf3a69c));}else if(_[_0x5436('0x9')](_0xf3a69c)){this[_0x5436('0x8')]('formData',_0xf3a69c);}else{this[_0x5436('0x8')](_0x5436('0xa'),util[_0x5436('0xb')](_0x5436('0xc'),this[_0x5436('0xd')]('name')||'',this[_0x5436('0xd')](_0x5436('0xe'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x5436('0xf')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x5436('0xf')],'defaultValue':![]}}; \ No newline at end of file +var _0x3695=['formData','stringify','isString','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize','lodash','util','exports','STRING','name','TEXT','long','isObjectLike','setDataValue'];(function(_0x2e3f0a,_0x20920b){var _0x37fd32=function(_0x2c80c0){while(--_0x2c80c0){_0x2e3f0a['push'](_0x2e3f0a['shift']());}};_0x37fd32(++_0x20920b);}(_0x3695,0x194));var _0x5369=function(_0x3cb2f0,_0x3f79aa){_0x3cb2f0=_0x3cb2f0-0x0;var _0x1368ea=_0x3695[_0x3cb2f0];return _0x1368ea;};'use strict';var Sequelize=require(_0x5369('0x0'));var _=require(_0x5369('0x1'));var util=require(_0x5369('0x2'));module[_0x5369('0x3')]={'name':{'type':Sequelize[_0x5369('0x4')],'unique':_0x5369('0x5')},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x5369('0x6')](_0x5369('0x7')),'set':function(_0x5b19b2){if(_[_0x5369('0x8')](_0x5b19b2)){this[_0x5369('0x9')](_0x5369('0xa'),JSON[_0x5369('0xb')](_0x5b19b2));}else if(_[_0x5369('0xc')](_0x5b19b2)){this[_0x5369('0x9')]('formData',_0x5b19b2);}else{this[_0x5369('0x9')](_0x5369('0xa'),util[_0x5369('0xd')](_0x5369('0xe'),this[_0x5369('0xf')](_0x5369('0x5'))||'',this['getDataValue'](_0x5369('0x10'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x5369('0x11')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index d29fb20..c67e9de 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 _0x99cd=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','UserProfileResource','then','error','stack','name','send','index','JscriptyProject','type','key','map','keys','query','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','get','role','user','Projects','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','length','createdAt','updatedAt','omit','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','getSessions','findOne','JscriptySessionReport','order','ProjectId','findAll','getAnswers','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','replace','getSummary','startTime','starttime','parse','JscriptyQuestionReport','-createdAt','question','SessionId','questionId','answer','push','now','writeFileSync','format','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','download','/tmp/Jscripty_Project_%d_Summary_%s.csv','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel'];(function(_0x37f972,_0x5de23f){var _0x1040d6=function(_0x55efe6){while(--_0x55efe6){_0x37f972['push'](_0x37f972['shift']());}};_0x1040d6(++_0x5de23f);}(_0x99cd,0x1df));var _0xd99c=function(_0x210d3,_0x2ed879){_0x210d3=_0x210d3-0x0;var _0x5612df=_0x99cd[_0x210d3];return _0x5612df;};'use strict';var emlformat=require(_0xd99c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd99c('0x1'));var jsonpatch=require(_0xd99c('0x2'));var rp=require(_0xd99c('0x3'));var moment=require(_0xd99c('0x4'));var BPromise=require(_0xd99c('0x5'));var Mustache=require(_0xd99c('0x6'));var util=require(_0xd99c('0x7'));var path=require(_0xd99c('0x8'));var sox=require(_0xd99c('0x9'));var csv=require(_0xd99c('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd99c('0xb'));var _=require('lodash');var squel=require(_0xd99c('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd99c('0xd'));var toCsv=require(_0xd99c('0xa'));var querystring=require(_0xd99c('0xe'));var Papa=require(_0xd99c('0xf'));var Redis=require(_0xd99c('0x10'));var authService=require(_0xd99c('0x11'));var qs=require(_0xd99c('0x12'));var as=require(_0xd99c('0x13'));var hardwareService=require(_0xd99c('0x14'));var logger=require(_0xd99c('0x15'))(_0xd99c('0x16'));var utils=require(_0xd99c('0x17'));var config=require(_0xd99c('0x18'));var licenseUtil=require(_0xd99c('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x46150e,_0x33a938){_0x33a938=_0x33a938||0xcc;return function(_0x41042a){if(_0x41042a){return _0x46150e[_0xd99c('0x1a')](_0x33a938);}return _0x46150e[_0xd99c('0x1b')](_0x33a938)['end']();};}function respondWithResult(_0x9c9edd,_0x407696){_0x407696=_0x407696||0xc8;return function(_0x471dcb){if(_0x471dcb){return _0x9c9edd[_0xd99c('0x1b')](_0x407696)[_0xd99c('0x1c')](_0x471dcb);}};}function respondWithFilteredResult(_0x4e891f,_0x219c1){return function(_0x31d5d6){if(_0x31d5d6){var _0x35b50f=typeof _0x219c1[_0xd99c('0x1d')]===_0xd99c('0x1e')&&typeof _0x219c1[_0xd99c('0x1f')]===_0xd99c('0x1e');var _0x177aa6=_0x31d5d6['count'];var _0x486607=_0x35b50f?0x0:_0x219c1[_0xd99c('0x1d')];var _0x2d98cb=_0x35b50f?_0x31d5d6[_0xd99c('0x20')]:_0x219c1[_0xd99c('0x1d')]+_0x219c1[_0xd99c('0x1f')];var _0x134aac;if(_0x2d98cb>=_0x177aa6){_0x2d98cb=_0x177aa6;_0x134aac=0xc8;}else{_0x134aac=0xce;}_0x4e891f['status'](_0x134aac);return _0x4e891f['set'](_0xd99c('0x21'),_0x486607+'-'+_0x2d98cb+'/'+_0x177aa6)[_0xd99c('0x1c')](_0x31d5d6);}return null;};}function patchUpdates(_0x271a35){return function(_0x11b683){try{jsonpatch[_0xd99c('0x22')](_0x11b683,_0x271a35,!![]);}catch(_0x44009a){return BPromise[_0xd99c('0x23')](_0x44009a);}return _0x11b683[_0xd99c('0x24')]();};}function saveUpdates(_0x39c705,_0x1d84bb){return function(_0x2cfbeb){if(_0x2cfbeb){return _0x2cfbeb[_0xd99c('0x25')](_0x39c705)['then'](function(_0x11cdd6){return _0x11cdd6;});}return null;};}function removeEntity(_0x4a700d,_0x5cbb9f){return function(_0x14ffb8){if(_0x14ffb8){return _0x14ffb8[_0xd99c('0x26')]()['then'](function(){var _0x4af932=_0x14ffb8['get']({'plain':!![]});var _0x3e426a='Projects';return db[_0xd99c('0x27')][_0xd99c('0x26')]({'where':{'type':_0x3e426a,'resourceId':_0x4af932['id']}})[_0xd99c('0x28')](function(){return _0x14ffb8;});})['then'](function(){_0x4a700d[_0xd99c('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24d08e,_0x3c041b){return function(_0x1ae635){if(!_0x1ae635){_0x24d08e['sendStatus'](0x194);}return _0x1ae635;};}function handleError(_0x5a171a,_0x1e2377){_0x1e2377=_0x1e2377||0x1f4;return function(_0x14cf86){logger[_0xd99c('0x29')](_0x14cf86[_0xd99c('0x2a')]);if(_0x14cf86[_0xd99c('0x2b')]){delete _0x14cf86[_0xd99c('0x2b')];}_0x5a171a['status'](_0x1e2377)[_0xd99c('0x2c')](_0x14cf86);};}exports[_0xd99c('0x2d')]=function(_0x4dbbc,_0x4aff4d){var _0xfcb19={},_0x3cdfce={},_0x506f8f={'count':0x0,'rows':[]};var _0x3cdab0=_['map'](db[_0xd99c('0x2e')]['rawAttributes'],function(_0x4b524c){return{'name':_0x4b524c['fieldName'],'type':_0x4b524c[_0xd99c('0x2f')][_0xd99c('0x30')]};});_0x3cdfce['model']=_[_0xd99c('0x31')](_0x3cdab0,_0xd99c('0x2b'));_0x3cdfce['query']=_[_0xd99c('0x32')](_0x4dbbc[_0xd99c('0x33')]);_0x3cdfce[_0xd99c('0x34')]=_['intersection'](_0x3cdfce[_0xd99c('0x35')],_0x3cdfce[_0xd99c('0x33')]);_0xfcb19[_0xd99c('0x36')]=_[_0xd99c('0x37')](_0x3cdfce['model'],qs[_0xd99c('0x38')](_0x4dbbc[_0xd99c('0x33')][_0xd99c('0x38')]));_0xfcb19[_0xd99c('0x36')]=_0xfcb19['attributes']['length']?_0xfcb19['attributes']:_0x3cdfce[_0xd99c('0x35')];if(!_0x4dbbc[_0xd99c('0x33')][_0xd99c('0x39')](_0xd99c('0x3a'))){_0xfcb19[_0xd99c('0x1f')]=qs['limit'](_0x4dbbc[_0xd99c('0x33')]['limit']);_0xfcb19[_0xd99c('0x1d')]=qs[_0xd99c('0x1d')](_0x4dbbc[_0xd99c('0x33')][_0xd99c('0x1d')]);}_0xfcb19['order']=qs[_0xd99c('0x3b')](_0x4dbbc[_0xd99c('0x33')][_0xd99c('0x3b')]);_0xfcb19['where']=qs[_0xd99c('0x34')](_[_0xd99c('0x3c')](_0x4dbbc[_0xd99c('0x33')],_0x3cdfce[_0xd99c('0x34')]),_0x3cdab0);if(_0x4dbbc[_0xd99c('0x33')][_0xd99c('0x3d')]){_0xfcb19['where']=_[_0xd99c('0x3e')](_0xfcb19[_0xd99c('0x3f')],{'$or':_[_0xd99c('0x31')](_0x3cdab0,function(_0x29b6eb){if(_0x29b6eb['type']!==_0xd99c('0x40')){var _0x39e419={};_0x39e419[_0x29b6eb[_0xd99c('0x2b')]]={'$like':'%'+_0x4dbbc[_0xd99c('0x33')][_0xd99c('0x3d')]+'%'};return _0x39e419;}})});}_0xfcb19=_[_0xd99c('0x3e')]({},_0xfcb19,_0x4dbbc[_0xd99c('0x41')]);var _0x5b172e={'where':_0xfcb19[_0xd99c('0x3f')]};return db[_0xd99c('0x2e')]['count'](_0x5b172e)[_0xd99c('0x28')](function(_0x3def9b){_0x506f8f[_0xd99c('0x20')]=_0x3def9b;if(_0x4dbbc[_0xd99c('0x33')][_0xd99c('0x42')]){_0xfcb19[_0xd99c('0x43')]=[{'all':!![]}];}return db[_0xd99c('0x2e')]['findAll'](_0xfcb19);})[_0xd99c('0x28')](function(_0x399ab7){_0x506f8f[_0xd99c('0x44')]=_0x399ab7;return _0x506f8f;})[_0xd99c('0x28')](respondWithFilteredResult(_0x4aff4d,_0xfcb19))[_0xd99c('0x45')](handleError(_0x4aff4d,null));};exports[_0xd99c('0x46')]=function(_0x671460,_0x100905){var _0x4819bb={'raw':![],'where':{'id':_0x671460[_0xd99c('0x47')]['id']}},_0x41533d={};_0x41533d[_0xd99c('0x35')]=_[_0xd99c('0x32')](db[_0xd99c('0x2e')][_0xd99c('0x48')]);_0x41533d[_0xd99c('0x33')]=_[_0xd99c('0x32')](_0x671460[_0xd99c('0x33')]);_0x41533d[_0xd99c('0x34')]=_[_0xd99c('0x37')](_0x41533d['model'],_0x41533d[_0xd99c('0x33')]);_0x4819bb[_0xd99c('0x36')]=_[_0xd99c('0x37')](_0x41533d[_0xd99c('0x35')],qs[_0xd99c('0x38')](_0x671460[_0xd99c('0x33')]['fields']));_0x4819bb[_0xd99c('0x36')]=_0x4819bb[_0xd99c('0x36')]['length']?_0x4819bb['attributes']:_0x41533d[_0xd99c('0x35')];if(_0x671460[_0xd99c('0x33')]['includeAll']){_0x4819bb[_0xd99c('0x43')]=[{'all':!![]}];}_0x4819bb=_[_0xd99c('0x3e')]({},_0x4819bb,_0x671460[_0xd99c('0x41')]);return db[_0xd99c('0x2e')][_0xd99c('0x49')](_0x4819bb)['then'](handleEntityNotFound(_0x100905,null))[_0xd99c('0x28')](respondWithResult(_0x100905,null))[_0xd99c('0x45')](handleError(_0x100905,null));};exports['create']=function(_0x2c92d1,_0x5a4dc4){return db[_0xd99c('0x2e')][_0xd99c('0x4a')](_0x2c92d1[_0xd99c('0x4b')],{})[_0xd99c('0x28')](function(_0x3e0e57){var _0x5c8dd7=_0x2c92d1['user'][_0xd99c('0x4c')]({'plain':!![]});if(!_0x5c8dd7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5c8dd7[_0xd99c('0x4d')]===_0xd99c('0x4e')){var _0x3d55f4=_0x3e0e57[_0xd99c('0x4c')]({'plain':!![]});var _0x9011f1=_0xd99c('0x4f');return db['UserProfileSection'][_0xd99c('0x49')]({'where':{'name':_0x9011f1,'userProfileId':_0x5c8dd7['userProfileId']},'raw':!![]})[_0xd99c('0x28')](function(_0x3a6106){if(_0x3a6106&&_0x3a6106[_0xd99c('0x50')]===0x0){return db[_0xd99c('0x27')][_0xd99c('0x4a')]({'name':_0x3d55f4['name'],'resourceId':_0x3d55f4['id'],'type':_0x3a6106[_0xd99c('0x2b')],'sectionId':_0x3a6106['id']},{})[_0xd99c('0x28')](function(){return _0x3e0e57;});}else{return _0x3e0e57;}})[_0xd99c('0x45')](function(_0x251312){logger[_0xd99c('0x29')](_0xd99c('0x51'),_0x251312);throw _0x251312;});}return _0x3e0e57;})[_0xd99c('0x28')](respondWithResult(_0x5a4dc4,0xc9))[_0xd99c('0x45')](handleError(_0x5a4dc4,null));};exports[_0xd99c('0x52')]=function(_0x551e02,_0x426dae){var _0x5e0085={'where':{'id':_0x551e02[_0xd99c('0x47')]['id']}},_0x32cbaa={};_0x32cbaa[_0xd99c('0x35')]=_[_0xd99c('0x32')](db[_0xd99c('0x2e')][_0xd99c('0x48')]);_0x5e0085['attributes']=_['intersection'](_0x32cbaa['model'],qs[_0xd99c('0x38')](_0x551e02[_0xd99c('0x33')][_0xd99c('0x38')]));_0x5e0085[_0xd99c('0x36')]=_0x5e0085['attributes'][_0xd99c('0x53')]?_0x5e0085['attributes']:_0x32cbaa[_0xd99c('0x35')];if(_0x551e02['query'][_0xd99c('0x42')]){_0x5e0085[_0xd99c('0x43')]=[{'all':!![]}];}_0x5e0085=_[_0xd99c('0x3e')]({},_0x5e0085,_0x551e02['options']);return db[_0xd99c('0x2e')][_0xd99c('0x49')](_0x5e0085)[_0xd99c('0x28')](handleEntityNotFound(_0x426dae,null))[_0xd99c('0x28')](function(_0x4cf018){if(_0x4cf018){var _0x283b16=_0x4cf018[_0xd99c('0x4c')]({'plain':!![]});_0x283b16=qs['omit'](_0x283b16,['id',_0xd99c('0x54'),_0xd99c('0x55')]);_0x551e02['body']=_[_0xd99c('0x56')](_0x551e02[_0xd99c('0x4b')],['id',_0xd99c('0x54'),_0xd99c('0x55')]);return db[_0xd99c('0x2e')]['create'](_[_0xd99c('0x3e')](_0x283b16,_0x551e02[_0xd99c('0x4b')]),{'include':_0x551e02[_0xd99c('0x33')]['includeAll']?[{'all':!![]}]:undefined})[_0xd99c('0x28')](function(_0x5cf1a7){var _0x439e88=_0x551e02[_0xd99c('0x4e')][_0xd99c('0x4c')]({'plain':!![]});if(!_0x439e88)throw new Error(_0xd99c('0x57'));if(_0x439e88[_0xd99c('0x4d')]===_0xd99c('0x4e')){var _0x3eb7e9=_0x5cf1a7[_0xd99c('0x4c')]({'plain':!![]});var _0x1e0fa7=_0xd99c('0x4f');return db[_0xd99c('0x58')][_0xd99c('0x49')]({'where':{'name':_0x1e0fa7,'userProfileId':_0x439e88['userProfileId']},'raw':!![]})[_0xd99c('0x28')](function(_0x5f2107){if(_0x5f2107&&_0x5f2107['autoAssociation']===0x0){return db[_0xd99c('0x27')][_0xd99c('0x4a')]({'name':_0x3eb7e9['name'],'resourceId':_0x3eb7e9['id'],'type':_0x5f2107['name'],'sectionId':_0x5f2107['id']},{})[_0xd99c('0x28')](function(){return _0x5cf1a7;});}else{return _0x5cf1a7;}})[_0xd99c('0x45')](function(_0x2c2739){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2c2739);throw _0x2c2739;});}return _0x5cf1a7;});}})[_0xd99c('0x28')](respondWithResult(_0x426dae,0xc9))['catch'](handleError(_0x426dae,null));};exports[_0xd99c('0x25')]=function(_0x348b80,_0x523582){if(_0x348b80[_0xd99c('0x4b')]['id']){delete _0x348b80[_0xd99c('0x4b')]['id'];}return db[_0xd99c('0x2e')]['find']({'where':{'id':_0x348b80['params']['id']}})[_0xd99c('0x28')](handleEntityNotFound(_0x523582,null))[_0xd99c('0x28')](saveUpdates(_0x348b80[_0xd99c('0x4b')],null))[_0xd99c('0x28')](respondWithResult(_0x523582,null))['catch'](handleError(_0x523582,null));};exports[_0xd99c('0x26')]=function(_0x1e43b1,_0x36b016){return db[_0xd99c('0x2e')][_0xd99c('0x49')]({'where':{'id':_0x1e43b1[_0xd99c('0x47')]['id']}})[_0xd99c('0x28')](handleEntityNotFound(_0x36b016,null))[_0xd99c('0x28')](removeEntity(_0x36b016,null))[_0xd99c('0x45')](handleError(_0x36b016,null));};exports[_0xd99c('0x59')]=function(_0x5788d0,_0x2d3dc7,_0x48b2e4){var _0x20cde0={'raw':!![],'where':{}};var _0x39a1f9={};var _0x106a79={'count':0x0,'rows':[]};return db[_0xd99c('0x2e')][_0xd99c('0x5a')]({'where':{'id':_0x5788d0[_0xd99c('0x47')]['id']}})[_0xd99c('0x28')](handleEntityNotFound(_0x2d3dc7,null))[_0xd99c('0x28')](function(_0x3d90c3){if(_0x3d90c3){_0x39a1f9['model']=_['keys'](db[_0xd99c('0x5b')][_0xd99c('0x48')]);_0x39a1f9[_0xd99c('0x33')]=_[_0xd99c('0x32')](_0x5788d0[_0xd99c('0x33')]);_0x39a1f9[_0xd99c('0x34')]=_[_0xd99c('0x37')](_0x39a1f9[_0xd99c('0x35')],_0x39a1f9[_0xd99c('0x33')]);_0x20cde0[_0xd99c('0x36')]=_[_0xd99c('0x37')](_0x39a1f9[_0xd99c('0x35')],qs[_0xd99c('0x38')](_0x5788d0[_0xd99c('0x33')][_0xd99c('0x38')]));_0x20cde0[_0xd99c('0x36')]=_0x20cde0[_0xd99c('0x36')][_0xd99c('0x53')]?_0x20cde0[_0xd99c('0x36')]:_0x39a1f9[_0xd99c('0x35')];if(!_0x5788d0['query'][_0xd99c('0x39')]('nolimit')){_0x20cde0[_0xd99c('0x1f')]=qs[_0xd99c('0x1f')](_0x5788d0['query'][_0xd99c('0x1f')]);_0x20cde0[_0xd99c('0x1d')]=qs[_0xd99c('0x1d')](_0x5788d0[_0xd99c('0x33')][_0xd99c('0x1d')]);}_0x20cde0[_0xd99c('0x5c')]=qs['sort'](_0x5788d0[_0xd99c('0x33')]['sort']);_0x20cde0[_0xd99c('0x3f')]=qs[_0xd99c('0x34')](_[_0xd99c('0x3c')](_0x5788d0[_0xd99c('0x33')],_0x39a1f9[_0xd99c('0x34')]));_0x20cde0['where'][_0xd99c('0x5d')]=_0x3d90c3['id'];if(_0x5788d0[_0xd99c('0x33')][_0xd99c('0x3d')]){_0x20cde0['where']=_[_0xd99c('0x3e')](_0x20cde0[_0xd99c('0x3f')],{'$or':_[_0xd99c('0x31')](_0x20cde0[_0xd99c('0x36')],function(_0x4d8713){var _0x35091a={};_0x35091a[_0x4d8713]={'$like':'%'+_0x5788d0[_0xd99c('0x33')][_0xd99c('0x3d')]+'%'};return _0x35091a;})});}_0x20cde0=_[_0xd99c('0x3e')]({},_0x20cde0,_0x5788d0[_0xd99c('0x41')]);return db[_0xd99c('0x5b')][_0xd99c('0x20')]({'where':_0x20cde0[_0xd99c('0x3f')]})[_0xd99c('0x28')](function(_0x4273ff){_0x106a79[_0xd99c('0x20')]=_0x4273ff;if(_0x5788d0[_0xd99c('0x33')][_0xd99c('0x42')]){_0x20cde0[_0xd99c('0x43')]=[{'all':!![]}];}return db[_0xd99c('0x5b')][_0xd99c('0x5e')](_0x20cde0);})[_0xd99c('0x28')](function(_0x57be40){_0x106a79[_0xd99c('0x44')]=_0x57be40;return _0x106a79;});}})['then'](respondWithFilteredResult(_0x2d3dc7,_0x20cde0))[_0xd99c('0x45')](handleError(_0x2d3dc7,null));};exports[_0xd99c('0x5f')]=function(_0xc11fc1,_0x9cdd09,_0x329c2b){var _0x488a35={'raw':!![],'where':{}};var _0x2943a2={};var _0x33db89={'count':0x0,'rows':[]};return db[_0xd99c('0x2e')][_0xd99c('0x5a')]({'where':{'id':_0xc11fc1['params']['id']}})[_0xd99c('0x28')](handleEntityNotFound(_0x9cdd09,null))[_0xd99c('0x28')](function(_0x1d8cc0){if(_0x1d8cc0){_0x2943a2[_0xd99c('0x35')]=_[_0xd99c('0x32')](db[_0xd99c('0x60')][_0xd99c('0x48')]);_0x2943a2[_0xd99c('0x33')]=_[_0xd99c('0x32')](_0xc11fc1[_0xd99c('0x33')]);_0x2943a2[_0xd99c('0x34')]=_[_0xd99c('0x37')](_0x2943a2[_0xd99c('0x35')],_0x2943a2[_0xd99c('0x33')]);_0x488a35[_0xd99c('0x36')]=_[_0xd99c('0x37')](_0x2943a2[_0xd99c('0x35')],qs[_0xd99c('0x38')](_0xc11fc1[_0xd99c('0x33')][_0xd99c('0x38')]));_0x488a35[_0xd99c('0x36')]=_0x488a35[_0xd99c('0x36')][_0xd99c('0x53')]?_0x488a35['attributes']:_0x2943a2[_0xd99c('0x35')];if(!_0xc11fc1['query'][_0xd99c('0x39')](_0xd99c('0x3a'))){_0x488a35[_0xd99c('0x1f')]=qs[_0xd99c('0x1f')](_0xc11fc1[_0xd99c('0x33')][_0xd99c('0x1f')]);_0x488a35[_0xd99c('0x1d')]=qs['offset'](_0xc11fc1[_0xd99c('0x33')][_0xd99c('0x1d')]);}_0x488a35['order']=qs['sort'](_0xc11fc1['query'][_0xd99c('0x3b')]);_0x488a35[_0xd99c('0x3f')]=qs[_0xd99c('0x34')](_[_0xd99c('0x3c')](_0xc11fc1[_0xd99c('0x33')],_0x2943a2[_0xd99c('0x34')]));_0x488a35[_0xd99c('0x3f')][_0xd99c('0x5d')]=_0x1d8cc0['id'];if(_0xc11fc1['query']['filter']){_0x488a35['where']=_['merge'](_0x488a35[_0xd99c('0x3f')],{'$or':_[_0xd99c('0x31')](_0x488a35[_0xd99c('0x36')],function(_0x1db506){var _0x195346={};_0x195346[_0x1db506]={'$like':'%'+_0xc11fc1['query']['filter']+'%'};return _0x195346;})});}_0x488a35=_[_0xd99c('0x3e')]({},_0x488a35,_0xc11fc1[_0xd99c('0x41')]);return db['JscriptyAnswerReport'][_0xd99c('0x20')]({'where':_0x488a35[_0xd99c('0x3f')]})[_0xd99c('0x28')](function(_0x113b3f){_0x33db89['count']=_0x113b3f;if(_0xc11fc1[_0xd99c('0x33')]['includeAll']){_0x488a35[_0xd99c('0x43')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0xd99c('0x5e')](_0x488a35);})[_0xd99c('0x28')](function(_0x401f23){_0x33db89[_0xd99c('0x44')]=_0x401f23;return _0x33db89;});}})[_0xd99c('0x28')](respondWithFilteredResult(_0x9cdd09,_0x488a35))[_0xd99c('0x45')](handleError(_0x9cdd09,null));};function char(_0x46df14){return _0xd99c('0x61')===typeof _0x46df14?String[_0xd99c('0x62')][_0xd99c('0x22')](null,arguments):_0x46df14;}function needsEncapsulation(_0x29f331){return!!_0x29f331&&(_0x29f331[_0xd99c('0x63')]()[_0xd99c('0x64')](char(0xd))>=0x0||_0x29f331[_0xd99c('0x63')]()[_0xd99c('0x64')](char(0xa))>=0x0||_0x29f331[_0xd99c('0x63')]()[_0xd99c('0x64')](char(0x2c))>=0x0||_0x29f331[_0xd99c('0x63')]()[_0xd99c('0x64')](char(0x22))>=0x0);}function encapsulate(_0x123e2c){var _0x53de92=char(0x22),_0x447fa0='\x5c'+char(0x22),_0x53dd77=_0x123e2c[_0xd99c('0x63')]()[_0xd99c('0x65')](new RegExp(_0x53de92,'g'),_0x447fa0);return _0x53de92+_0x53dd77+_0x53de92;}exports[_0xd99c('0x66')]=function(_0x2705be,_0x520658,_0x15b006){var _0x61dd9e,_0x27ad92;var _0x3b455d={'where':{'ProjectId':_0x2705be[_0xd99c('0x47')]['id']}};if(_0x2705be[_0xd99c('0x33')][_0xd99c('0x67')]){_0x3b455d[_0xd99c('0x3f')][_0xd99c('0x68')]=JSON[_0xd99c('0x69')](_0x2705be[_0xd99c('0x33')]['startTime']);}return db[_0xd99c('0x5b')][_0xd99c('0x5e')](_0x3b455d)[_0xd99c('0x28')](handleEntityNotFound(_0x520658,null))[_0xd99c('0x28')](function(_0x444ee0){if(_0x444ee0){_0x61dd9e=_0x444ee0;return db[_0xd99c('0x6a')][_0xd99c('0x5e')]({'where':{'SessionId':{'$in':_[_0xd99c('0x31')](_0x61dd9e,'id')},'ProjectId':_0x2705be['params']['id']},'order':_0xd99c('0x6b')});}})[_0xd99c('0x28')](handleEntityNotFound(_0x520658,null))[_0xd99c('0x28')](function(_0x7473f5){if(_0x7473f5){_0x27ad92=_0x7473f5;var _0x2eeb8e={};for(var _0x3dc415=0x0,_0x4ef61a=_0x27ad92[_0xd99c('0x53')];_0x3dc415<_0x4ef61a;_0x3dc415++){if(!_0x2eeb8e[_0xd99c('0x39')](_0x27ad92[_0x3dc415]['questionId'])){_0x2eeb8e[_0x27ad92[_0x3dc415]['questionId']]=needsEncapsulation(_0x27ad92[_0x3dc415]['question'])?encapsulate(_0x27ad92[_0x3dc415][_0xd99c('0x6c')]):_0x27ad92[_0x3dc415]['question'];}}var _0xd0e03b=[],_0x80bc6b={};for(var _0x6d17f7=0x0,_0x3ea616=_0x61dd9e['length'];_0x6d17f7<_0x3ea616;_0x6d17f7++){_0x80bc6b={'ProjectId':_0x2705be[_0xd99c('0x47')]['id'],'SessionId':_0x61dd9e[_0x6d17f7]['id'],'StartTime':moment(_0x61dd9e[_0x6d17f7][_0xd99c('0x68')])['format']('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x514d0d=0x0,_0x5bf1ed=_0x27ad92[_0xd99c('0x53')];_0x514d0d<_0x5bf1ed;_0x514d0d++){if(_0x27ad92[_0x514d0d][_0xd99c('0x6d')]==_0x61dd9e[_0x6d17f7]['id']&&_0x2eeb8e[_0xd99c('0x39')](_0x27ad92[_0x514d0d][_0xd99c('0x6e')])){_0x80bc6b[_0x2eeb8e[_0x27ad92[_0x514d0d][_0xd99c('0x6e')]]]=_0x27ad92[_0x514d0d][_0xd99c('0x6f')];}}for(var _0x10db38 in _0x2eeb8e){if(!_0x80bc6b[_0xd99c('0x39')](_0x2eeb8e[_0x10db38])){_0x80bc6b[_0x2eeb8e[_0x10db38]]=null;}}_0xd0e03b[_0xd99c('0x70')](_0x80bc6b);}return _0xd0e03b;}})['then'](function(_0x4dba69){if(!_['isEmpty'](_0x4dba69)){var _0x34bb17=toCsv(_0x4dba69);var _0x4166bd=Date[_0xd99c('0x71')]();fs[_0xd99c('0x72')](util[_0xd99c('0x73')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x2705be[_0xd99c('0x47')]['id'],_0x4166bd),_0x34bb17);_0x520658[_0xd99c('0x74')](_0xd99c('0x75'),_0xd99c('0x76')+util[_0xd99c('0x73')](_0xd99c('0x77'),_0x2705be[_0xd99c('0x47')]['id'],_0x4166bd));_0x520658[_0xd99c('0x74')](_0xd99c('0x78'),'text/csv');return _0x520658[_0xd99c('0x79')](util[_0xd99c('0x73')](_0xd99c('0x7a'),_0x2705be['params']['id'],_0x4166bd));}else{return _0x520658['sendStatus'](0xcc);}})[_0xd99c('0x45')](handleError(_0x520658,null));}; \ No newline at end of file +var _0xceab=['indexOf','replace','startTime','starttime','parse','JscriptyQuestionReport','-createdAt','question','YYYY-MM-DD\x20HH:mm:ss','SessionId','questionId','push','isEmpty','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','format','Jscripty_Project_%d_Summary_%s.csv','text/csv','download','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','json','undefined','offset','count','limit','set','Content-Range','apply','reject','save','then','get','Projects','UserProfileResource','destroy','end','sendStatus','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','nolimit','order','sort','pick','filter','where','merge','map','VIRTUAL','JscriptyProject','includeAll','include','catch','show','params','length','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','clone','omit','createdAt','updatedAt','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','findOne','JscriptySessionReport','hasOwnProperty','ProjectId','options','findAll','rows','getAnswers','JscriptyAnswerReport','toString'];(function(_0x16cb82,_0x2bc17f){var _0x353e1a=function(_0xda4d3f){while(--_0xda4d3f){_0x16cb82['push'](_0x16cb82['shift']());}};_0x353e1a(++_0x2bc17f);}(_0xceab,0x106));var _0xbcea=function(_0x2b020c,_0x22216a){_0x2b020c=_0x2b020c-0x0;var _0x276d93=_0xceab[_0x2b020c];return _0x276d93;};'use strict';var emlformat=require(_0xbcea('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbcea('0x1'));var jsonpatch=require(_0xbcea('0x2'));var rp=require('request-promise');var moment=require(_0xbcea('0x3'));var BPromise=require(_0xbcea('0x4'));var Mustache=require('mustache');var util=require(_0xbcea('0x5'));var path=require(_0xbcea('0x6'));var sox=require('sox');var csv=require(_0xbcea('0x7'));var ejs=require(_0xbcea('0x8'));var fs=require('fs');var fs_extra=require(_0xbcea('0x9'));var _=require(_0xbcea('0xa'));var squel=require(_0xbcea('0xb'));var crypto=require('crypto');var jsforce=require(_0xbcea('0xc'));var deskjs=require(_0xbcea('0xd'));var toCsv=require(_0xbcea('0x7'));var querystring=require(_0xbcea('0xe'));var Papa=require(_0xbcea('0xf'));var Redis=require('ioredis');var authService=require(_0xbcea('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xbcea('0x11'));var hardwareService=require(_0xbcea('0x12'));var logger=require(_0xbcea('0x13'))(_0xbcea('0x14'));var utils=require(_0xbcea('0x15'));var config=require(_0xbcea('0x16'));var licenseUtil=require(_0xbcea('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x24822a,_0x365160){_0x365160=_0x365160||0xcc;return function(_0x39dde5){if(_0x39dde5){return _0x24822a['sendStatus'](_0x365160);}return _0x24822a[_0xbcea('0x18')](_0x365160)['end']();};}function respondWithResult(_0x47b444,_0xd2be3c){_0xd2be3c=_0xd2be3c||0xc8;return function(_0x3ae03e){if(_0x3ae03e){return _0x47b444[_0xbcea('0x18')](_0xd2be3c)[_0xbcea('0x19')](_0x3ae03e);}};}function respondWithFilteredResult(_0x419364,_0x326814){return function(_0x4f205f){if(_0x4f205f){var _0x407cda=typeof _0x326814['offset']==='undefined'&&typeof _0x326814['limit']===_0xbcea('0x1a');var _0x1487d8=_0x4f205f['count'];var _0x3d68f0=_0x407cda?0x0:_0x326814[_0xbcea('0x1b')];var _0x356754=_0x407cda?_0x4f205f[_0xbcea('0x1c')]:_0x326814[_0xbcea('0x1b')]+_0x326814[_0xbcea('0x1d')];var _0x3466bb;if(_0x356754>=_0x1487d8){_0x356754=_0x1487d8;_0x3466bb=0xc8;}else{_0x3466bb=0xce;}_0x419364[_0xbcea('0x18')](_0x3466bb);return _0x419364[_0xbcea('0x1e')](_0xbcea('0x1f'),_0x3d68f0+'-'+_0x356754+'/'+_0x1487d8)[_0xbcea('0x19')](_0x4f205f);}return null;};}function patchUpdates(_0x4bae81){return function(_0x2f133b){try{jsonpatch[_0xbcea('0x20')](_0x2f133b,_0x4bae81,!![]);}catch(_0x5c3c29){return BPromise[_0xbcea('0x21')](_0x5c3c29);}return _0x2f133b[_0xbcea('0x22')]();};}function saveUpdates(_0x4350a8,_0x3eb213){return function(_0x4cb14f){if(_0x4cb14f){return _0x4cb14f['update'](_0x4350a8)[_0xbcea('0x23')](function(_0x2465bc){return _0x2465bc;});}return null;};}function removeEntity(_0x805c0,_0x56f7fb){return function(_0xb58516){if(_0xb58516){return _0xb58516['destroy']()['then'](function(){var _0x5f1f1e=_0xb58516[_0xbcea('0x24')]({'plain':!![]});var _0x17aeac=_0xbcea('0x25');return db[_0xbcea('0x26')][_0xbcea('0x27')]({'where':{'type':_0x17aeac,'resourceId':_0x5f1f1e['id']}})[_0xbcea('0x23')](function(){return _0xb58516;});})[_0xbcea('0x23')](function(){_0x805c0[_0xbcea('0x18')](0xcc)[_0xbcea('0x28')]();});}};}function handleEntityNotFound(_0x4eeb4c,_0x11cf9f){return function(_0x2df4d6){if(!_0x2df4d6){_0x4eeb4c[_0xbcea('0x29')](0x194);}return _0x2df4d6;};}function handleError(_0x53f9a0,_0x4e956f){_0x4e956f=_0x4e956f||0x1f4;return function(_0x2358e8){logger[_0xbcea('0x2a')](_0x2358e8[_0xbcea('0x2b')]);if(_0x2358e8['name']){delete _0x2358e8[_0xbcea('0x2c')];}_0x53f9a0[_0xbcea('0x18')](_0x4e956f)[_0xbcea('0x2d')](_0x2358e8);};}exports[_0xbcea('0x2e')]=function(_0x1393a5,_0x2a7468){var _0x2ddaee={},_0x32d3cd={},_0x34ccdc={'count':0x0,'rows':[]};var _0x3abfae=_['map'](db['JscriptyProject'][_0xbcea('0x2f')],function(_0x266ca5){return{'name':_0x266ca5[_0xbcea('0x30')],'type':_0x266ca5[_0xbcea('0x31')][_0xbcea('0x32')]};});_0x32d3cd[_0xbcea('0x33')]=_['map'](_0x3abfae,'name');_0x32d3cd['query']=_[_0xbcea('0x34')](_0x1393a5[_0xbcea('0x35')]);_0x32d3cd[_0xbcea('0x36')]=_[_0xbcea('0x37')](_0x32d3cd[_0xbcea('0x33')],_0x32d3cd[_0xbcea('0x35')]);_0x2ddaee[_0xbcea('0x38')]=_[_0xbcea('0x37')](_0x32d3cd['model'],qs['fields'](_0x1393a5['query'][_0xbcea('0x39')]));_0x2ddaee['attributes']=_0x2ddaee[_0xbcea('0x38')]['length']?_0x2ddaee['attributes']:_0x32d3cd[_0xbcea('0x33')];if(!_0x1393a5[_0xbcea('0x35')]['hasOwnProperty'](_0xbcea('0x3a'))){_0x2ddaee[_0xbcea('0x1d')]=qs[_0xbcea('0x1d')](_0x1393a5['query'][_0xbcea('0x1d')]);_0x2ddaee['offset']=qs[_0xbcea('0x1b')](_0x1393a5[_0xbcea('0x35')][_0xbcea('0x1b')]);}_0x2ddaee[_0xbcea('0x3b')]=qs[_0xbcea('0x3c')](_0x1393a5[_0xbcea('0x35')][_0xbcea('0x3c')]);_0x2ddaee['where']=qs['filters'](_[_0xbcea('0x3d')](_0x1393a5['query'],_0x32d3cd[_0xbcea('0x36')]),_0x3abfae);if(_0x1393a5['query'][_0xbcea('0x3e')]){_0x2ddaee[_0xbcea('0x3f')]=_[_0xbcea('0x40')](_0x2ddaee[_0xbcea('0x3f')],{'$or':_[_0xbcea('0x41')](_0x3abfae,function(_0x169136){if(_0x169136['type']!==_0xbcea('0x42')){var _0x232ea4={};_0x232ea4[_0x169136[_0xbcea('0x2c')]]={'$like':'%'+_0x1393a5[_0xbcea('0x35')]['filter']+'%'};return _0x232ea4;}})});}_0x2ddaee=_[_0xbcea('0x40')]({},_0x2ddaee,_0x1393a5['options']);var _0x12d0ba={'where':_0x2ddaee[_0xbcea('0x3f')]};return db[_0xbcea('0x43')]['count'](_0x12d0ba)[_0xbcea('0x23')](function(_0x4ba3eb){_0x34ccdc[_0xbcea('0x1c')]=_0x4ba3eb;if(_0x1393a5[_0xbcea('0x35')][_0xbcea('0x44')]){_0x2ddaee[_0xbcea('0x45')]=[{'all':!![]}];}return db[_0xbcea('0x43')]['findAll'](_0x2ddaee);})['then'](function(_0x3f5b33){_0x34ccdc['rows']=_0x3f5b33;return _0x34ccdc;})[_0xbcea('0x23')](respondWithFilteredResult(_0x2a7468,_0x2ddaee))[_0xbcea('0x46')](handleError(_0x2a7468,null));};exports[_0xbcea('0x47')]=function(_0x31bab8,_0x274299){var _0x31a1bc={'raw':![],'where':{'id':_0x31bab8[_0xbcea('0x48')]['id']}},_0x1f5680={};_0x1f5680[_0xbcea('0x33')]=_[_0xbcea('0x34')](db[_0xbcea('0x43')][_0xbcea('0x2f')]);_0x1f5680[_0xbcea('0x35')]=_['keys'](_0x31bab8['query']);_0x1f5680[_0xbcea('0x36')]=_[_0xbcea('0x37')](_0x1f5680[_0xbcea('0x33')],_0x1f5680[_0xbcea('0x35')]);_0x31a1bc[_0xbcea('0x38')]=_[_0xbcea('0x37')](_0x1f5680[_0xbcea('0x33')],qs[_0xbcea('0x39')](_0x31bab8[_0xbcea('0x35')][_0xbcea('0x39')]));_0x31a1bc[_0xbcea('0x38')]=_0x31a1bc[_0xbcea('0x38')][_0xbcea('0x49')]?_0x31a1bc[_0xbcea('0x38')]:_0x1f5680[_0xbcea('0x33')];if(_0x31bab8['query'][_0xbcea('0x44')]){_0x31a1bc[_0xbcea('0x45')]=[{'all':!![]}];}_0x31a1bc=_['merge']({},_0x31a1bc,_0x31bab8['options']);return db[_0xbcea('0x43')][_0xbcea('0x4a')](_0x31a1bc)['then'](handleEntityNotFound(_0x274299,null))[_0xbcea('0x23')](respondWithResult(_0x274299,null))[_0xbcea('0x46')](handleError(_0x274299,null));};exports['create']=function(_0x3f83f1,_0x4bcce3){return db[_0xbcea('0x43')][_0xbcea('0x4b')](_0x3f83f1[_0xbcea('0x4c')],{})[_0xbcea('0x23')](function(_0x464c66){var _0x5cb081=_0x3f83f1['user'][_0xbcea('0x24')]({'plain':!![]});if(!_0x5cb081)throw new Error(_0xbcea('0x4d'));if(_0x5cb081['role']===_0xbcea('0x4e')){var _0x5ec50a=_0x464c66[_0xbcea('0x24')]({'plain':!![]});var _0x3ee0bd=_0xbcea('0x25');return db[_0xbcea('0x4f')][_0xbcea('0x4a')]({'where':{'name':_0x3ee0bd,'userProfileId':_0x5cb081['userProfileId']},'raw':!![]})['then'](function(_0x259262){if(_0x259262&&_0x259262[_0xbcea('0x50')]===0x0){return db['UserProfileResource'][_0xbcea('0x4b')]({'name':_0x5ec50a[_0xbcea('0x2c')],'resourceId':_0x5ec50a['id'],'type':_0x259262[_0xbcea('0x2c')],'sectionId':_0x259262['id']},{})[_0xbcea('0x23')](function(){return _0x464c66;});}else{return _0x464c66;}})[_0xbcea('0x46')](function(_0x41569b){logger[_0xbcea('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x41569b);throw _0x41569b;});}return _0x464c66;})[_0xbcea('0x23')](respondWithResult(_0x4bcce3,0xc9))['catch'](handleError(_0x4bcce3,null));};exports[_0xbcea('0x51')]=function(_0x2637c1,_0x50dcc3){var _0x43a5da={'where':{'id':_0x2637c1[_0xbcea('0x48')]['id']}},_0x305545={};_0x305545[_0xbcea('0x33')]=_[_0xbcea('0x34')](db[_0xbcea('0x43')]['rawAttributes']);_0x43a5da[_0xbcea('0x38')]=_[_0xbcea('0x37')](_0x305545['model'],qs[_0xbcea('0x39')](_0x2637c1[_0xbcea('0x35')]['fields']));_0x43a5da[_0xbcea('0x38')]=_0x43a5da['attributes'][_0xbcea('0x49')]?_0x43a5da[_0xbcea('0x38')]:_0x305545[_0xbcea('0x33')];if(_0x2637c1[_0xbcea('0x35')][_0xbcea('0x44')]){_0x43a5da[_0xbcea('0x45')]=[{'all':!![]}];}_0x43a5da=_[_0xbcea('0x40')]({},_0x43a5da,_0x2637c1['options']);return db['JscriptyProject'][_0xbcea('0x4a')](_0x43a5da)[_0xbcea('0x23')](handleEntityNotFound(_0x50dcc3,null))[_0xbcea('0x23')](function(_0x19c645){if(_0x19c645){var _0x5c8c7d=_0x19c645[_0xbcea('0x24')]({'plain':!![]});_0x5c8c7d=qs[_0xbcea('0x52')](_0x5c8c7d,['id',_0xbcea('0x53'),'updatedAt']);_0x2637c1['body']=_[_0xbcea('0x52')](_0x2637c1[_0xbcea('0x4c')],['id',_0xbcea('0x53'),_0xbcea('0x54')]);return db[_0xbcea('0x43')][_0xbcea('0x4b')](_[_0xbcea('0x40')](_0x5c8c7d,_0x2637c1[_0xbcea('0x4c')]),{'include':_0x2637c1[_0xbcea('0x35')][_0xbcea('0x44')]?[{'all':!![]}]:undefined})[_0xbcea('0x23')](function(_0x394c86){var _0x159b95=_0x2637c1['user']['get']({'plain':!![]});if(!_0x159b95)throw new Error(_0xbcea('0x4d'));if(_0x159b95[_0xbcea('0x55')]==='user'){var _0x4e6973=_0x394c86[_0xbcea('0x24')]({'plain':!![]});var _0x260b57=_0xbcea('0x25');return db[_0xbcea('0x4f')][_0xbcea('0x4a')]({'where':{'name':_0x260b57,'userProfileId':_0x159b95['userProfileId']},'raw':!![]})[_0xbcea('0x23')](function(_0x1731e9){if(_0x1731e9&&_0x1731e9[_0xbcea('0x50')]===0x0){return db[_0xbcea('0x26')][_0xbcea('0x4b')]({'name':_0x4e6973[_0xbcea('0x2c')],'resourceId':_0x4e6973['id'],'type':_0x1731e9[_0xbcea('0x2c')],'sectionId':_0x1731e9['id']},{})[_0xbcea('0x23')](function(){return _0x394c86;});}else{return _0x394c86;}})[_0xbcea('0x46')](function(_0x1814fe){logger['error'](_0xbcea('0x56'),_0x1814fe);throw _0x1814fe;});}return _0x394c86;});}})['then'](respondWithResult(_0x50dcc3,0xc9))[_0xbcea('0x46')](handleError(_0x50dcc3,null));};exports[_0xbcea('0x57')]=function(_0x1c0191,_0x3bf9cc){if(_0x1c0191['body']['id']){delete _0x1c0191[_0xbcea('0x4c')]['id'];}return db['JscriptyProject']['find']({'where':{'id':_0x1c0191[_0xbcea('0x48')]['id']}})[_0xbcea('0x23')](handleEntityNotFound(_0x3bf9cc,null))[_0xbcea('0x23')](saveUpdates(_0x1c0191[_0xbcea('0x4c')],null))[_0xbcea('0x23')](respondWithResult(_0x3bf9cc,null))[_0xbcea('0x46')](handleError(_0x3bf9cc,null));};exports[_0xbcea('0x27')]=function(_0x2b8b93,_0x13c7ff){return db[_0xbcea('0x43')]['find']({'where':{'id':_0x2b8b93[_0xbcea('0x48')]['id']}})[_0xbcea('0x23')](handleEntityNotFound(_0x13c7ff,null))[_0xbcea('0x23')](removeEntity(_0x13c7ff,null))[_0xbcea('0x46')](handleError(_0x13c7ff,null));};exports['getSessions']=function(_0x262c25,_0x549ac0,_0x412c62){var _0x23114c={'raw':!![],'where':{}};var _0x24422c={};var _0x1f4960={'count':0x0,'rows':[]};return db[_0xbcea('0x43')][_0xbcea('0x58')]({'where':{'id':_0x262c25[_0xbcea('0x48')]['id']}})['then'](handleEntityNotFound(_0x549ac0,null))['then'](function(_0x187491){if(_0x187491){_0x24422c['model']=_[_0xbcea('0x34')](db[_0xbcea('0x59')][_0xbcea('0x2f')]);_0x24422c[_0xbcea('0x35')]=_['keys'](_0x262c25[_0xbcea('0x35')]);_0x24422c[_0xbcea('0x36')]=_[_0xbcea('0x37')](_0x24422c['model'],_0x24422c[_0xbcea('0x35')]);_0x23114c['attributes']=_[_0xbcea('0x37')](_0x24422c[_0xbcea('0x33')],qs[_0xbcea('0x39')](_0x262c25[_0xbcea('0x35')][_0xbcea('0x39')]));_0x23114c[_0xbcea('0x38')]=_0x23114c[_0xbcea('0x38')][_0xbcea('0x49')]?_0x23114c[_0xbcea('0x38')]:_0x24422c[_0xbcea('0x33')];if(!_0x262c25[_0xbcea('0x35')][_0xbcea('0x5a')](_0xbcea('0x3a'))){_0x23114c[_0xbcea('0x1d')]=qs[_0xbcea('0x1d')](_0x262c25[_0xbcea('0x35')][_0xbcea('0x1d')]);_0x23114c[_0xbcea('0x1b')]=qs[_0xbcea('0x1b')](_0x262c25[_0xbcea('0x35')]['offset']);}_0x23114c['order']=qs['sort'](_0x262c25[_0xbcea('0x35')]['sort']);_0x23114c[_0xbcea('0x3f')]=qs['filters'](_[_0xbcea('0x3d')](_0x262c25[_0xbcea('0x35')],_0x24422c[_0xbcea('0x36')]));_0x23114c[_0xbcea('0x3f')][_0xbcea('0x5b')]=_0x187491['id'];if(_0x262c25['query']['filter']){_0x23114c[_0xbcea('0x3f')]=_[_0xbcea('0x40')](_0x23114c['where'],{'$or':_[_0xbcea('0x41')](_0x23114c['attributes'],function(_0x47c2cb){var _0x48b040={};_0x48b040[_0x47c2cb]={'$like':'%'+_0x262c25[_0xbcea('0x35')]['filter']+'%'};return _0x48b040;})});}_0x23114c=_[_0xbcea('0x40')]({},_0x23114c,_0x262c25[_0xbcea('0x5c')]);return db['JscriptySessionReport'][_0xbcea('0x1c')]({'where':_0x23114c[_0xbcea('0x3f')]})['then'](function(_0x1ad7ad){_0x1f4960['count']=_0x1ad7ad;if(_0x262c25[_0xbcea('0x35')][_0xbcea('0x44')]){_0x23114c[_0xbcea('0x45')]=[{'all':!![]}];}return db[_0xbcea('0x59')][_0xbcea('0x5d')](_0x23114c);})[_0xbcea('0x23')](function(_0x43a316){_0x1f4960[_0xbcea('0x5e')]=_0x43a316;return _0x1f4960;});}})['then'](respondWithFilteredResult(_0x549ac0,_0x23114c))[_0xbcea('0x46')](handleError(_0x549ac0,null));};exports[_0xbcea('0x5f')]=function(_0x24d3c3,_0x21c421,_0x510078){var _0x14e6c0={'raw':!![],'where':{}};var _0x601bf1={};var _0x3b979c={'count':0x0,'rows':[]};return db[_0xbcea('0x43')][_0xbcea('0x58')]({'where':{'id':_0x24d3c3[_0xbcea('0x48')]['id']}})['then'](handleEntityNotFound(_0x21c421,null))['then'](function(_0x46ca41){if(_0x46ca41){_0x601bf1[_0xbcea('0x33')]=_[_0xbcea('0x34')](db[_0xbcea('0x60')][_0xbcea('0x2f')]);_0x601bf1['query']=_['keys'](_0x24d3c3[_0xbcea('0x35')]);_0x601bf1[_0xbcea('0x36')]=_['intersection'](_0x601bf1[_0xbcea('0x33')],_0x601bf1[_0xbcea('0x35')]);_0x14e6c0[_0xbcea('0x38')]=_[_0xbcea('0x37')](_0x601bf1[_0xbcea('0x33')],qs[_0xbcea('0x39')](_0x24d3c3[_0xbcea('0x35')][_0xbcea('0x39')]));_0x14e6c0[_0xbcea('0x38')]=_0x14e6c0[_0xbcea('0x38')][_0xbcea('0x49')]?_0x14e6c0[_0xbcea('0x38')]:_0x601bf1[_0xbcea('0x33')];if(!_0x24d3c3[_0xbcea('0x35')][_0xbcea('0x5a')](_0xbcea('0x3a'))){_0x14e6c0[_0xbcea('0x1d')]=qs[_0xbcea('0x1d')](_0x24d3c3[_0xbcea('0x35')][_0xbcea('0x1d')]);_0x14e6c0[_0xbcea('0x1b')]=qs[_0xbcea('0x1b')](_0x24d3c3['query'][_0xbcea('0x1b')]);}_0x14e6c0[_0xbcea('0x3b')]=qs['sort'](_0x24d3c3[_0xbcea('0x35')][_0xbcea('0x3c')]);_0x14e6c0[_0xbcea('0x3f')]=qs[_0xbcea('0x36')](_[_0xbcea('0x3d')](_0x24d3c3['query'],_0x601bf1['filters']));_0x14e6c0[_0xbcea('0x3f')][_0xbcea('0x5b')]=_0x46ca41['id'];if(_0x24d3c3[_0xbcea('0x35')][_0xbcea('0x3e')]){_0x14e6c0['where']=_[_0xbcea('0x40')](_0x14e6c0[_0xbcea('0x3f')],{'$or':_[_0xbcea('0x41')](_0x14e6c0['attributes'],function(_0x3f7159){var _0xabc3a0={};_0xabc3a0[_0x3f7159]={'$like':'%'+_0x24d3c3['query']['filter']+'%'};return _0xabc3a0;})});}_0x14e6c0=_[_0xbcea('0x40')]({},_0x14e6c0,_0x24d3c3['options']);return db[_0xbcea('0x60')]['count']({'where':_0x14e6c0[_0xbcea('0x3f')]})[_0xbcea('0x23')](function(_0x99ed2d){_0x3b979c['count']=_0x99ed2d;if(_0x24d3c3[_0xbcea('0x35')][_0xbcea('0x44')]){_0x14e6c0['include']=[{'all':!![]}];}return db[_0xbcea('0x60')][_0xbcea('0x5d')](_0x14e6c0);})[_0xbcea('0x23')](function(_0x47709a){_0x3b979c[_0xbcea('0x5e')]=_0x47709a;return _0x3b979c;});}})[_0xbcea('0x23')](respondWithFilteredResult(_0x21c421,_0x14e6c0))[_0xbcea('0x46')](handleError(_0x21c421,null));};function char(_0x35cde9){return'number'===typeof _0x35cde9?String['fromCharCode'][_0xbcea('0x20')](null,arguments):_0x35cde9;}function needsEncapsulation(_0xdc026e){return!!_0xdc026e&&(_0xdc026e[_0xbcea('0x61')]()['indexOf'](char(0xd))>=0x0||_0xdc026e[_0xbcea('0x61')]()[_0xbcea('0x62')](char(0xa))>=0x0||_0xdc026e[_0xbcea('0x61')]()['indexOf'](char(0x2c))>=0x0||_0xdc026e[_0xbcea('0x61')]()[_0xbcea('0x62')](char(0x22))>=0x0);}function encapsulate(_0x26737a){var _0xf1791c=char(0x22),_0x6d0cac='\x5c'+char(0x22),_0x449970=_0x26737a['toString']()[_0xbcea('0x63')](new RegExp(_0xf1791c,'g'),_0x6d0cac);return _0xf1791c+_0x449970+_0xf1791c;}exports['getSummary']=function(_0x2183ac,_0x1715b5,_0x3d6304){var _0x1c9b13,_0x3ae4ba;var _0x3ed87a={'where':{'ProjectId':_0x2183ac[_0xbcea('0x48')]['id']}};if(_0x2183ac[_0xbcea('0x35')][_0xbcea('0x64')]){_0x3ed87a['where'][_0xbcea('0x65')]=JSON[_0xbcea('0x66')](_0x2183ac[_0xbcea('0x35')][_0xbcea('0x64')]);}return db[_0xbcea('0x59')][_0xbcea('0x5d')](_0x3ed87a)[_0xbcea('0x23')](handleEntityNotFound(_0x1715b5,null))[_0xbcea('0x23')](function(_0x2bc249){if(_0x2bc249){_0x1c9b13=_0x2bc249;return db[_0xbcea('0x67')][_0xbcea('0x5d')]({'where':{'SessionId':{'$in':_[_0xbcea('0x41')](_0x1c9b13,'id')},'ProjectId':_0x2183ac[_0xbcea('0x48')]['id']},'order':_0xbcea('0x68')});}})[_0xbcea('0x23')](handleEntityNotFound(_0x1715b5,null))[_0xbcea('0x23')](function(_0x57f62b){if(_0x57f62b){_0x3ae4ba=_0x57f62b;var _0x3ef315={};for(var _0x2daf89=0x0,_0xa4e3b4=_0x3ae4ba[_0xbcea('0x49')];_0x2daf89<_0xa4e3b4;_0x2daf89++){if(!_0x3ef315[_0xbcea('0x5a')](_0x3ae4ba[_0x2daf89]['questionId'])){_0x3ef315[_0x3ae4ba[_0x2daf89]['questionId']]=needsEncapsulation(_0x3ae4ba[_0x2daf89][_0xbcea('0x69')])?encapsulate(_0x3ae4ba[_0x2daf89][_0xbcea('0x69')]):_0x3ae4ba[_0x2daf89][_0xbcea('0x69')];}}var _0x38d412=[],_0x1aee28={};for(var _0x4fe7ec=0x0,_0x3eecc1=_0x1c9b13['length'];_0x4fe7ec<_0x3eecc1;_0x4fe7ec++){_0x1aee28={'ProjectId':_0x2183ac[_0xbcea('0x48')]['id'],'SessionId':_0x1c9b13[_0x4fe7ec]['id'],'StartTime':moment(_0x1c9b13[_0x4fe7ec][_0xbcea('0x65')])['format'](_0xbcea('0x6a'))};for(var _0x329ebf=0x0,_0x246002=_0x3ae4ba[_0xbcea('0x49')];_0x329ebf<_0x246002;_0x329ebf++){if(_0x3ae4ba[_0x329ebf][_0xbcea('0x6b')]==_0x1c9b13[_0x4fe7ec]['id']&&_0x3ef315[_0xbcea('0x5a')](_0x3ae4ba[_0x329ebf][_0xbcea('0x6c')])){_0x1aee28[_0x3ef315[_0x3ae4ba[_0x329ebf][_0xbcea('0x6c')]]]=_0x3ae4ba[_0x329ebf]['answer'];}}for(var _0x43aeb0 in _0x3ef315){if(!_0x1aee28[_0xbcea('0x5a')](_0x3ef315[_0x43aeb0])){_0x1aee28[_0x3ef315[_0x43aeb0]]=null;}}_0x38d412[_0xbcea('0x6d')](_0x1aee28);}return _0x38d412;}})[_0xbcea('0x23')](function(_0x344cc6){if(!_[_0xbcea('0x6e')](_0x344cc6)){var _0x1028a9=toCsv(_0x344cc6);var _0x191217=Date['now']();fs[_0xbcea('0x6f')](util['format'](_0xbcea('0x70'),_0x2183ac[_0xbcea('0x48')]['id'],_0x191217),_0x1028a9);_0x1715b5[_0xbcea('0x71')](_0xbcea('0x72'),_0xbcea('0x73')+util[_0xbcea('0x74')](_0xbcea('0x75'),_0x2183ac[_0xbcea('0x48')]['id'],_0x191217));_0x1715b5['setHeader']('Content-type',_0xbcea('0x76'));return _0x1715b5[_0xbcea('0x77')](util[_0xbcea('0x74')](_0xbcea('0x70'),_0x2183ac[_0xbcea('0x48')]['id'],_0x191217));}else{return _0x1715b5[_0xbcea('0x29')](0xcc);}})[_0xbcea('0x46')](handleError(_0x1715b5,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 411bded..b543f8a 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 _0x5243=['rimraf','./jscriptyProject.attributes','define','JscriptyProject','jscripty_projects','lodash','api','moment','path'];(function(_0x2b6c01,_0x4a1d39){var _0x4c051e=function(_0x3ef1ee){while(--_0x3ef1ee){_0x2b6c01['push'](_0x2b6c01['shift']());}};_0x4c051e(++_0x4a1d39);}(_0x5243,0x71));var _0x3524=function(_0x352f35,_0x40fa54){_0x352f35=_0x352f35-0x0;var _0x59caf7=_0x5243[_0x352f35];return _0x59caf7;};'use strict';var _=require(_0x3524('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3524('0x1'));var moment=require(_0x3524('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3524('0x3'));var rimraf=require(_0x3524('0x4'));var config=require('../../config/environment');var attributes=require(_0x3524('0x5'));module['exports']=function(_0x2d8995,_0x564239){return _0x2d8995[_0x3524('0x6')](_0x3524('0x7'),attributes,{'tableName':_0x3524('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4453=['lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','./jscriptyProject.attributes','exports','define','JscriptyProject'];(function(_0x320f3c,_0xb0468f){var _0xbebc44=function(_0x2166e0){while(--_0x2166e0){_0x320f3c['push'](_0x320f3c['shift']());}};_0xbebc44(++_0xb0468f);}(_0x4453,0x9c));var _0x3445=function(_0x29733c,_0x2da30b){_0x29733c=_0x29733c-0x0;var _0x49e72f=_0x4453[_0x29733c];return _0x49e72f;};'use strict';var _=require(_0x3445('0x0'));var util=require(_0x3445('0x1'));var logger=require('../../config/logger')(_0x3445('0x2'));var moment=require(_0x3445('0x3'));var BPromise=require('bluebird');var rp=require(_0x3445('0x4'));var fs=require('fs');var path=require(_0x3445('0x5'));var rimraf=require(_0x3445('0x6'));var config=require(_0x3445('0x7'));var attributes=require(_0x3445('0x8'));module[_0x3445('0x9')]=function(_0x43214d,_0x1bd1dc){return _0x43214d[_0x3445('0xa')](_0x3445('0xb'),attributes,{'tableName':'jscripty_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.rpc.js b/server/api/jscriptyProject/jscriptyProject.rpc.js index 45be6e3..c04ad51 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 _0xa9e0=['http','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\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(_0x394695,_0x152d13){var _0x4ad150=function(_0x1a7db8){while(--_0x1a7db8){_0x394695['push'](_0x394695['shift']());}};_0x4ad150(++_0x152d13);}(_0xa9e0,0x123));var _0x0a9e=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xa9e0[_0x934425];return _0x31d596;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 _0xf4eb=['JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x235e66,_0x4bef96){var _0x36019b=function(_0x3674f3){while(--_0x3674f3){_0x235e66['push'](_0x235e66['shift']());}};_0x36019b(++_0x4bef96);}(_0xf4eb,0xec));var _0xbf4e=function(_0xd65574,_0x4f3c9a){_0xd65574=_0xd65574-0x0;var _0x5e93d2=_0xf4eb[_0xd65574];return _0x5e93d2;};'use strict';var _=require(_0xbf4e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbf4e('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbf4e('0x2'))(_0xbf4e('0x3'));var config=require(_0xbf4e('0x4'));var jayson=require(_0xbf4e('0x5'));var client=jayson[_0xbf4e('0x6')][_0xbf4e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x15b99f,_0x540736,_0x449d55){return new BPromise(function(_0x5013c2,_0x5e23d4){return client[_0xbf4e('0x8')](_0x15b99f,_0x449d55)[_0xbf4e('0x9')](function(_0xcc4097){logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));logger[_0xbf4e('0xd')]('JscriptyProject,\x20%s,\x20%s,\x20%s',_0x540736,'request\x20sent',JSON[_0xbf4e('0xe')](_0xcc4097));if(_0xcc4097['error']){if(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x10')]===0x1f4){logger['error'](_0xbf4e('0xb'),_0x540736,_0xcc4097['error']['message']);return _0x5e23d4(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);}logger[_0xbf4e('0xf')](_0xbf4e('0xb'),_0x540736,_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);return _0x5013c2(_0xcc4097['error']['message']);}else{logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));_0x5013c2(_0xcc4097['result'][_0xbf4e('0x11')]);}})[_0xbf4e('0x12')](function(_0x912fc0){logger[_0xbf4e('0xf')]('JscriptyProject,\x20%s,\x20%s',_0x540736,_0x912fc0);_0x5e23d4(_0x912fc0);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index f7111dc..c6c8c07 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 _0x0820=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','index','get','/describe','isAuthenticated','describe','/:id','show','create','put','update','delete','exports','util','path','connect-timeout','Router'];(function(_0x4996d5,_0x123daf){var _0x4793f9=function(_0x30c7ec){while(--_0x30c7ec){_0x4996d5['push'](_0x4996d5['shift']());}};_0x4793f9(++_0x123daf);}(_0x0820,0xf8));var _0x0082=function(_0x40366d,_0x439fe2){_0x40366d=_0x40366d-0x0;var _0x17c4eb=_0x0820[_0x40366d];return _0x17c4eb;};'use strict';var multer=require('multer');var util=require(_0x0082('0x0'));var path=require(_0x0082('0x1'));var timeout=require(_0x0082('0x2'));var express=require('express');var router=express[_0x0082('0x3')]();var fs_extra=require(_0x0082('0x4'));var auth=require(_0x0082('0x5'));var interaction=require(_0x0082('0x6'));var config=require(_0x0082('0x7'));var controller=require(_0x0082('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x0082('0x9')]);router[_0x0082('0xa')](_0x0082('0xb'),auth[_0x0082('0xc')](),controller[_0x0082('0xd')]);router[_0x0082('0xa')](_0x0082('0xe'),auth['isAuthenticated'](),controller[_0x0082('0xf')]);router['post']('/',auth[_0x0082('0xc')](),controller[_0x0082('0x10')]);router[_0x0082('0x11')]('/:id',auth[_0x0082('0xc')](),controller[_0x0082('0x12')]);router[_0x0082('0x13')](_0x0082('0xe'),auth[_0x0082('0xc')](),controller['destroy']);module[_0x0082('0x14')]=router; \ No newline at end of file +var _0x9bb0=['/describe','isAuthenticated','describe','/:id','show','post','update','delete','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','index'];(function(_0x3f59b1,_0x25cdbe){var _0x11d2e8=function(_0x37b3fc){while(--_0x37b3fc){_0x3f59b1['push'](_0x3f59b1['shift']());}};_0x11d2e8(++_0x25cdbe);}(_0x9bb0,0x1aa));var _0x09bb=function(_0x12e7de,_0x2b96d0){_0x12e7de=_0x12e7de-0x0;var _0x1375bf=_0x9bb0[_0x12e7de];return _0x1375bf;};'use strict';var multer=require(_0x09bb('0x0'));var util=require(_0x09bb('0x1'));var path=require(_0x09bb('0x2'));var timeout=require('connect-timeout');var express=require(_0x09bb('0x3'));var router=express[_0x09bb('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x09bb('0x5'));var interaction=require(_0x09bb('0x6'));var config=require(_0x09bb('0x7'));var controller=require(_0x09bb('0x8'));router[_0x09bb('0x9')]('/',auth['isAuthenticated'](),controller[_0x09bb('0xa')]);router[_0x09bb('0x9')](_0x09bb('0xb'),auth[_0x09bb('0xc')](),controller[_0x09bb('0xd')]);router[_0x09bb('0x9')](_0x09bb('0xe'),auth[_0x09bb('0xc')](),controller[_0x09bb('0xf')]);router[_0x09bb('0x10')]('/',auth[_0x09bb('0xc')](),controller['create']);router['put'](_0x09bb('0xe'),auth[_0x09bb('0xc')](),controller[_0x09bb('0x11')]);router[_0x09bb('0x12')]('/:id',auth[_0x09bb('0xc')](),controller['destroy']);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 a9ca648..65e6711 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(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x7a54,0x106));var _0x47a5=function(_0x203112,_0x40d5ad){_0x203112=_0x203112-0x0;var _0x3a010b=_0x7a54[_0x203112];return _0x3a010b;};'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(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x7a54,0x106));var _0x47a5=function(_0x4ecd6a,_0x256897){_0x4ecd6a=_0x4ecd6a-0x0;var _0x9f1b18=_0x7a54[_0x4ecd6a];return _0x9f1b18;};'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 a1d7421..f74f48b 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 _0x501f=['hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','then','findAll','rows','catch','show','params','keys','include','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','lodash','squel','crypto','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','undefined','limit','count','offset','Content-Range','reject','save','update','destroy','end','error','stack','name','map','JscriptyQuestionReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length'];(function(_0xbaf7d7,_0x5ef011){var _0x5bb3d6=function(_0x2e32a2){while(--_0x2e32a2){_0xbaf7d7['push'](_0xbaf7d7['shift']());}};_0x5bb3d6(++_0x5ef011);}(_0x501f,0x9d));var _0xf501=function(_0x32433b,_0x434558){_0x32433b=_0x32433b-0x0;var _0x549eee=_0x501f[_0x32433b];return _0x549eee;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf501('0x0'));var zipdir=require(_0xf501('0x1'));var jsonpatch=require(_0xf501('0x2'));var rp=require(_0xf501('0x3'));var moment=require(_0xf501('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xf501('0x5'));var sox=require(_0xf501('0x6'));var csv=require(_0xf501('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf501('0x8'));var squel=require(_0xf501('0x9'));var crypto=require(_0xf501('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf501('0x7'));var querystring=require('querystring');var Papa=require(_0xf501('0xb'));var Redis=require('ioredis');var authService=require(_0xf501('0xc'));var qs=require(_0xf501('0xd'));var as=require(_0xf501('0xe'));var hardwareService=require(_0xf501('0xf'));var logger=require(_0xf501('0x10'))(_0xf501('0x11'));var utils=require(_0xf501('0x12'));var config=require(_0xf501('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x11c4b0,_0xcc8119){_0xcc8119=_0xcc8119||0xcc;return function(_0x54c791){if(_0x54c791){return _0x11c4b0[_0xf501('0x14')](_0xcc8119);}return _0x11c4b0['status'](_0xcc8119)['end']();};}function respondWithResult(_0x240222,_0xb5de){_0xb5de=_0xb5de||0xc8;return function(_0x5e0b0d){if(_0x5e0b0d){return _0x240222['status'](_0xb5de)['json'](_0x5e0b0d);}};}function respondWithFilteredResult(_0x28fb35,_0x2fdb56){return function(_0x2cad68){if(_0x2cad68){var _0xce8316=typeof _0x2fdb56['offset']===_0xf501('0x15')&&typeof _0x2fdb56[_0xf501('0x16')]===_0xf501('0x15');var _0x4e3deb=_0x2cad68[_0xf501('0x17')];var _0x5c79c9=_0xce8316?0x0:_0x2fdb56[_0xf501('0x18')];var _0x2c15e7=_0xce8316?_0x2cad68[_0xf501('0x17')]:_0x2fdb56[_0xf501('0x18')]+_0x2fdb56[_0xf501('0x16')];var _0x2157de;if(_0x2c15e7>=_0x4e3deb){_0x2c15e7=_0x4e3deb;_0x2157de=0xc8;}else{_0x2157de=0xce;}_0x28fb35['status'](_0x2157de);return _0x28fb35['set'](_0xf501('0x19'),_0x5c79c9+'-'+_0x2c15e7+'/'+_0x4e3deb)['json'](_0x2cad68);}return null;};}function patchUpdates(_0x5df4a0){return function(_0x2befca){try{jsonpatch['apply'](_0x2befca,_0x5df4a0,!![]);}catch(_0x3498ca){return BPromise[_0xf501('0x1a')](_0x3498ca);}return _0x2befca[_0xf501('0x1b')]();};}function saveUpdates(_0x5173ff,_0x4c9ce6){return function(_0x31e8ef){if(_0x31e8ef){return _0x31e8ef[_0xf501('0x1c')](_0x5173ff)['then'](function(_0x58a0ed){return _0x58a0ed;});}return null;};}function removeEntity(_0x4c777b,_0x543ae8){return function(_0x547ebf){if(_0x547ebf){return _0x547ebf[_0xf501('0x1d')]()['then'](function(){_0x4c777b['status'](0xcc)[_0xf501('0x1e')]();});}};}function handleEntityNotFound(_0x26e913,_0x34c0b7){return function(_0x10f9e9){if(!_0x10f9e9){_0x26e913[_0xf501('0x14')](0x194);}return _0x10f9e9;};}function handleError(_0x447380,_0x5819ec){_0x5819ec=_0x5819ec||0x1f4;return function(_0x3168d2){logger[_0xf501('0x1f')](_0x3168d2[_0xf501('0x20')]);if(_0x3168d2[_0xf501('0x21')]){delete _0x3168d2[_0xf501('0x21')];}_0x447380['status'](_0x5819ec)['send'](_0x3168d2);};}exports['index']=function(_0x2eab10,_0x5e996e){var _0x32788a={},_0xf21b51={},_0x225be1={'count':0x0,'rows':[]};var _0x41e049=_[_0xf501('0x22')](db[_0xf501('0x23')][_0xf501('0x24')],function(_0x5cb723){return{'name':_0x5cb723[_0xf501('0x25')],'type':_0x5cb723[_0xf501('0x26')][_0xf501('0x27')]};});_0xf21b51[_0xf501('0x28')]=_[_0xf501('0x22')](_0x41e049,_0xf501('0x21'));_0xf21b51[_0xf501('0x29')]=_['keys'](_0x2eab10['query']);_0xf21b51[_0xf501('0x2a')]=_[_0xf501('0x2b')](_0xf21b51[_0xf501('0x28')],_0xf21b51[_0xf501('0x29')]);_0x32788a[_0xf501('0x2c')]=_['intersection'](_0xf21b51['model'],qs['fields'](_0x2eab10[_0xf501('0x29')][_0xf501('0x2d')]));_0x32788a[_0xf501('0x2c')]=_0x32788a[_0xf501('0x2c')][_0xf501('0x2e')]?_0x32788a['attributes']:_0xf21b51[_0xf501('0x28')];if(!_0x2eab10[_0xf501('0x29')][_0xf501('0x2f')](_0xf501('0x30'))){_0x32788a[_0xf501('0x16')]=qs[_0xf501('0x16')](_0x2eab10['query'][_0xf501('0x16')]);_0x32788a[_0xf501('0x18')]=qs[_0xf501('0x18')](_0x2eab10[_0xf501('0x29')][_0xf501('0x18')]);}_0x32788a[_0xf501('0x31')]=qs[_0xf501('0x32')](_0x2eab10[_0xf501('0x29')]['sort']);_0x32788a[_0xf501('0x33')]=qs[_0xf501('0x2a')](_[_0xf501('0x34')](_0x2eab10['query'],_0xf21b51[_0xf501('0x2a')]),_0x41e049);if(_0x2eab10['query'][_0xf501('0x35')]){_0x32788a[_0xf501('0x33')]=_[_0xf501('0x36')](_0x32788a['where'],{'$or':_[_0xf501('0x22')](_0x41e049,function(_0x294908){if(_0x294908['type']!==_0xf501('0x37')){var _0x2f13e9={};_0x2f13e9[_0x294908[_0xf501('0x21')]]={'$like':'%'+_0x2eab10[_0xf501('0x29')][_0xf501('0x35')]+'%'};return _0x2f13e9;}})});}_0x32788a=_[_0xf501('0x36')]({},_0x32788a,_0x2eab10['options']);var _0x2e1d4e={'where':_0x32788a[_0xf501('0x33')]};return db['JscriptyQuestionReport'][_0xf501('0x17')](_0x2e1d4e)[_0xf501('0x38')](function(_0x597e08){_0x225be1[_0xf501('0x17')]=_0x597e08;if(_0x2eab10['query']['includeAll']){_0x32788a['include']=[{'all':!![]}];}return db[_0xf501('0x23')][_0xf501('0x39')](_0x32788a);})['then'](function(_0x5c860e){_0x225be1[_0xf501('0x3a')]=_0x5c860e;return _0x225be1;})['then'](respondWithFilteredResult(_0x5e996e,_0x32788a))[_0xf501('0x3b')](handleError(_0x5e996e,null));};exports[_0xf501('0x3c')]=function(_0x4fef4e,_0x3b8602){var _0x3bf969={'raw':!![],'where':{'id':_0x4fef4e[_0xf501('0x3d')]['id']}},_0x497902={};_0x497902['model']=_[_0xf501('0x3e')](db[_0xf501('0x23')][_0xf501('0x24')]);_0x497902[_0xf501('0x29')]=_[_0xf501('0x3e')](_0x4fef4e[_0xf501('0x29')]);_0x497902[_0xf501('0x2a')]=_[_0xf501('0x2b')](_0x497902[_0xf501('0x28')],_0x497902[_0xf501('0x29')]);_0x3bf969['attributes']=_[_0xf501('0x2b')](_0x497902[_0xf501('0x28')],qs[_0xf501('0x2d')](_0x4fef4e[_0xf501('0x29')][_0xf501('0x2d')]));_0x3bf969[_0xf501('0x2c')]=_0x3bf969['attributes']['length']?_0x3bf969[_0xf501('0x2c')]:_0x497902['model'];if(_0x4fef4e[_0xf501('0x29')]['includeAll']){_0x3bf969[_0xf501('0x3f')]=[{'all':!![]}];}_0x3bf969=_[_0xf501('0x36')]({},_0x3bf969,_0x4fef4e['options']);return db[_0xf501('0x23')][_0xf501('0x40')](_0x3bf969)['then'](handleEntityNotFound(_0x3b8602,null))[_0xf501('0x38')](respondWithResult(_0x3b8602,null))[_0xf501('0x3b')](handleError(_0x3b8602,null));};exports['create']=function(_0xa8a85e,_0x305739){return db[_0xf501('0x23')][_0xf501('0x41')](_0xa8a85e['body'],{})[_0xf501('0x38')](respondWithResult(_0x305739,0xc9))[_0xf501('0x3b')](handleError(_0x305739,null));};exports[_0xf501('0x1c')]=function(_0x4453d6,_0x4c3f90){if(_0x4453d6[_0xf501('0x42')]['id']){delete _0x4453d6['body']['id'];}return db[_0xf501('0x23')][_0xf501('0x40')]({'where':{'id':_0x4453d6[_0xf501('0x3d')]['id']}})[_0xf501('0x38')](handleEntityNotFound(_0x4c3f90,null))['then'](saveUpdates(_0x4453d6['body'],null))[_0xf501('0x38')](respondWithResult(_0x4c3f90,null))[_0xf501('0x3b')](handleError(_0x4c3f90,null));};exports[_0xf501('0x1d')]=function(_0x510fab,_0x349c86){return db[_0xf501('0x23')][_0xf501('0x40')]({'where':{'id':_0x510fab['params']['id']}})[_0xf501('0x38')](handleEntityNotFound(_0x349c86,null))[_0xf501('0x38')](removeEntity(_0x349c86,null))[_0xf501('0x3b')](handleError(_0x349c86,null));};exports[_0xf501('0x43')]=function(_0x3655ab,_0x18b141){return db[_0xf501('0x23')][_0xf501('0x43')]()['then'](respondWithResult(_0x18b141,null))['catch'](handleError(_0x18b141,null));}; \ No newline at end of file +var _0xf68e=['path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','update','destroy','then','error','stack','name','send','index','map','JscriptyQuestionReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','params','keys','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache'];(function(_0x3064e7,_0x34edba){var _0x26038e=function(_0x35336c){while(--_0x35336c){_0x3064e7['push'](_0x3064e7['shift']());}};_0x26038e(++_0x34edba);}(_0xf68e,0x129));var _0xef68=function(_0x580256,_0x50c541){_0x580256=_0x580256-0x0;var _0x281255=_0xf68e[_0x580256];return _0x281255;};'use strict';var emlformat=require(_0xef68('0x0'));var rimraf=require(_0xef68('0x1'));var zipdir=require(_0xef68('0x2'));var jsonpatch=require(_0xef68('0x3'));var rp=require(_0xef68('0x4'));var moment=require('moment');var BPromise=require(_0xef68('0x5'));var Mustache=require(_0xef68('0x6'));var util=require('util');var path=require(_0xef68('0x7'));var sox=require(_0xef68('0x8'));var csv=require(_0xef68('0x9'));var ejs=require(_0xef68('0xa'));var fs=require('fs');var fs_extra=require(_0xef68('0xb'));var _=require(_0xef68('0xc'));var squel=require(_0xef68('0xd'));var crypto=require('crypto');var jsforce=require(_0xef68('0xe'));var deskjs=require(_0xef68('0xf'));var toCsv=require(_0xef68('0x9'));var querystring=require(_0xef68('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xef68('0x11'));var qs=require(_0xef68('0x12'));var as=require(_0xef68('0x13'));var hardwareService=require(_0xef68('0x14'));var logger=require(_0xef68('0x15'))(_0xef68('0x16'));var utils=require('../../config/utils');var config=require(_0xef68('0x17'));var licenseUtil=require(_0xef68('0x18'));var db=require(_0xef68('0x19'))['db'];function respondWithStatusCode(_0x546cc4,_0x451df2){_0x451df2=_0x451df2||0xcc;return function(_0x1d793c){if(_0x1d793c){return _0x546cc4[_0xef68('0x1a')](_0x451df2);}return _0x546cc4[_0xef68('0x1b')](_0x451df2)[_0xef68('0x1c')]();};}function respondWithResult(_0xc7a810,_0x18b395){_0x18b395=_0x18b395||0xc8;return function(_0x349d7b){if(_0x349d7b){return _0xc7a810[_0xef68('0x1b')](_0x18b395)[_0xef68('0x1d')](_0x349d7b);}};}function respondWithFilteredResult(_0x168842,_0x2e3aee){return function(_0x5ac7da){if(_0x5ac7da){var _0x321412=typeof _0x2e3aee[_0xef68('0x1e')]==='undefined'&&typeof _0x2e3aee[_0xef68('0x1f')]===_0xef68('0x20');var _0x390cfb=_0x5ac7da[_0xef68('0x21')];var _0x22e343=_0x321412?0x0:_0x2e3aee[_0xef68('0x1e')];var _0x242dd5=_0x321412?_0x5ac7da[_0xef68('0x21')]:_0x2e3aee[_0xef68('0x1e')]+_0x2e3aee['limit'];var _0x1eae10;if(_0x242dd5>=_0x390cfb){_0x242dd5=_0x390cfb;_0x1eae10=0xc8;}else{_0x1eae10=0xce;}_0x168842['status'](_0x1eae10);return _0x168842[_0xef68('0x22')]('Content-Range',_0x22e343+'-'+_0x242dd5+'/'+_0x390cfb)['json'](_0x5ac7da);}return null;};}function patchUpdates(_0x2b6720){return function(_0x48b403){try{jsonpatch[_0xef68('0x23')](_0x48b403,_0x2b6720,!![]);}catch(_0x4cb692){return BPromise[_0xef68('0x24')](_0x4cb692);}return _0x48b403['save']();};}function saveUpdates(_0x4c41a5,_0x18ea4d){return function(_0x4016dd){if(_0x4016dd){return _0x4016dd[_0xef68('0x25')](_0x4c41a5)['then'](function(_0x4c4489){return _0x4c4489;});}return null;};}function removeEntity(_0x1aff6,_0x324a3a){return function(_0x2679c7){if(_0x2679c7){return _0x2679c7[_0xef68('0x26')]()[_0xef68('0x27')](function(){_0x1aff6[_0xef68('0x1b')](0xcc)[_0xef68('0x1c')]();});}};}function handleEntityNotFound(_0x2940d7,_0x6136e9){return function(_0x1112f1){if(!_0x1112f1){_0x2940d7['sendStatus'](0x194);}return _0x1112f1;};}function handleError(_0x13003d,_0x2a510d){_0x2a510d=_0x2a510d||0x1f4;return function(_0x1a1394){logger[_0xef68('0x28')](_0x1a1394[_0xef68('0x29')]);if(_0x1a1394[_0xef68('0x2a')]){delete _0x1a1394[_0xef68('0x2a')];}_0x13003d['status'](_0x2a510d)[_0xef68('0x2b')](_0x1a1394);};}exports[_0xef68('0x2c')]=function(_0xb4acd5,_0x512648){var _0x1e0581={},_0x386add={},_0x1d7032={'count':0x0,'rows':[]};var _0x43c1f2=_[_0xef68('0x2d')](db[_0xef68('0x2e')][_0xef68('0x2f')],function(_0x1514e8){return{'name':_0x1514e8[_0xef68('0x30')],'type':_0x1514e8[_0xef68('0x31')][_0xef68('0x32')]};});_0x386add[_0xef68('0x33')]=_[_0xef68('0x2d')](_0x43c1f2,_0xef68('0x2a'));_0x386add[_0xef68('0x34')]=_['keys'](_0xb4acd5[_0xef68('0x34')]);_0x386add[_0xef68('0x35')]=_[_0xef68('0x36')](_0x386add[_0xef68('0x33')],_0x386add['query']);_0x1e0581[_0xef68('0x37')]=_['intersection'](_0x386add[_0xef68('0x33')],qs[_0xef68('0x38')](_0xb4acd5[_0xef68('0x34')][_0xef68('0x38')]));_0x1e0581[_0xef68('0x37')]=_0x1e0581[_0xef68('0x37')]['length']?_0x1e0581['attributes']:_0x386add[_0xef68('0x33')];if(!_0xb4acd5[_0xef68('0x34')][_0xef68('0x39')]('nolimit')){_0x1e0581[_0xef68('0x1f')]=qs[_0xef68('0x1f')](_0xb4acd5[_0xef68('0x34')][_0xef68('0x1f')]);_0x1e0581[_0xef68('0x1e')]=qs['offset'](_0xb4acd5[_0xef68('0x34')]['offset']);}_0x1e0581[_0xef68('0x3a')]=qs['sort'](_0xb4acd5[_0xef68('0x34')][_0xef68('0x3b')]);_0x1e0581[_0xef68('0x3c')]=qs[_0xef68('0x35')](_['pick'](_0xb4acd5[_0xef68('0x34')],_0x386add[_0xef68('0x35')]),_0x43c1f2);if(_0xb4acd5[_0xef68('0x34')][_0xef68('0x3d')]){_0x1e0581['where']=_['merge'](_0x1e0581[_0xef68('0x3c')],{'$or':_[_0xef68('0x2d')](_0x43c1f2,function(_0x5620ca){if(_0x5620ca[_0xef68('0x31')]!==_0xef68('0x3e')){var _0x5d6d1b={};_0x5d6d1b[_0x5620ca[_0xef68('0x2a')]]={'$like':'%'+_0xb4acd5[_0xef68('0x34')]['filter']+'%'};return _0x5d6d1b;}})});}_0x1e0581=_[_0xef68('0x3f')]({},_0x1e0581,_0xb4acd5[_0xef68('0x40')]);var _0x37a264={'where':_0x1e0581['where']};return db[_0xef68('0x2e')][_0xef68('0x21')](_0x37a264)[_0xef68('0x27')](function(_0x53952e){_0x1d7032['count']=_0x53952e;if(_0xb4acd5['query'][_0xef68('0x41')]){_0x1e0581[_0xef68('0x42')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0xef68('0x43')](_0x1e0581);})[_0xef68('0x27')](function(_0xfaee0f){_0x1d7032[_0xef68('0x44')]=_0xfaee0f;return _0x1d7032;})['then'](respondWithFilteredResult(_0x512648,_0x1e0581))['catch'](handleError(_0x512648,null));};exports['show']=function(_0x5a2774,_0x4a4432){var _0x407155={'raw':!![],'where':{'id':_0x5a2774[_0xef68('0x45')]['id']}},_0x591d69={};_0x591d69[_0xef68('0x33')]=_[_0xef68('0x46')](db[_0xef68('0x2e')][_0xef68('0x2f')]);_0x591d69[_0xef68('0x34')]=_[_0xef68('0x46')](_0x5a2774[_0xef68('0x34')]);_0x591d69['filters']=_[_0xef68('0x36')](_0x591d69[_0xef68('0x33')],_0x591d69[_0xef68('0x34')]);_0x407155[_0xef68('0x37')]=_[_0xef68('0x36')](_0x591d69[_0xef68('0x33')],qs['fields'](_0x5a2774[_0xef68('0x34')][_0xef68('0x38')]));_0x407155[_0xef68('0x37')]=_0x407155[_0xef68('0x37')]['length']?_0x407155[_0xef68('0x37')]:_0x591d69[_0xef68('0x33')];if(_0x5a2774['query'][_0xef68('0x41')]){_0x407155[_0xef68('0x42')]=[{'all':!![]}];}_0x407155=_[_0xef68('0x3f')]({},_0x407155,_0x5a2774[_0xef68('0x40')]);return db['JscriptyQuestionReport'][_0xef68('0x47')](_0x407155)['then'](handleEntityNotFound(_0x4a4432,null))[_0xef68('0x27')](respondWithResult(_0x4a4432,null))[_0xef68('0x48')](handleError(_0x4a4432,null));};exports['create']=function(_0x9c046e,_0x12a31f){return db[_0xef68('0x2e')][_0xef68('0x49')](_0x9c046e[_0xef68('0x4a')],{})[_0xef68('0x27')](respondWithResult(_0x12a31f,0xc9))[_0xef68('0x48')](handleError(_0x12a31f,null));};exports[_0xef68('0x25')]=function(_0x4ae286,_0x433dce){if(_0x4ae286[_0xef68('0x4a')]['id']){delete _0x4ae286['body']['id'];}return db[_0xef68('0x2e')][_0xef68('0x47')]({'where':{'id':_0x4ae286[_0xef68('0x45')]['id']}})[_0xef68('0x27')](handleEntityNotFound(_0x433dce,null))['then'](saveUpdates(_0x4ae286[_0xef68('0x4a')],null))[_0xef68('0x27')](respondWithResult(_0x433dce,null))['catch'](handleError(_0x433dce,null));};exports[_0xef68('0x26')]=function(_0x5911bc,_0x46a013){return db[_0xef68('0x2e')][_0xef68('0x47')]({'where':{'id':_0x5911bc[_0xef68('0x45')]['id']}})[_0xef68('0x27')](handleEntityNotFound(_0x46a013,null))['then'](removeEntity(_0x46a013,null))[_0xef68('0x48')](handleError(_0x46a013,null));};exports[_0xef68('0x4b')]=function(_0x53f4ef,_0x8933ae){return db['JscriptyQuestionReport'][_0xef68('0x4b')]()[_0xef68('0x27')](respondWithResult(_0x8933ae,null))[_0xef68('0x48')](handleError(_0x8933ae,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index fa91af0..c491977 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 _0xea95=['util','api','request-promise','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport','report_jscripty_questions','lodash'];(function(_0x8e8778,_0x31be87){var _0x421072=function(_0x513a63){while(--_0x513a63){_0x8e8778['push'](_0x8e8778['shift']());}};_0x421072(++_0x31be87);}(_0xea95,0x18b));var _0x5ea9=function(_0x3b8735,_0x3ef395){_0x3b8735=_0x3b8735-0x0;var _0x26cf93=_0xea95[_0x3b8735];return _0x26cf93;};'use strict';var _=require(_0x5ea9('0x0'));var util=require(_0x5ea9('0x1'));var logger=require('../../config/logger')(_0x5ea9('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5ea9('0x3'));var fs=require('fs');var path=require(_0x5ea9('0x4'));var rimraf=require(_0x5ea9('0x5'));var config=require(_0x5ea9('0x6'));var attributes=require(_0x5ea9('0x7'));module[_0x5ea9('0x8')]=function(_0x225fe7,_0x371bba){return _0x225fe7[_0x5ea9('0x9')](_0x5ea9('0xa'),attributes,{'tableName':_0x5ea9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5287=['path','rimraf','../../config/environment','exports','define','JscriptyQuestionReport','report_jscripty_questions','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x446970,_0x2e8abc){var _0xccb49a=function(_0x49d1f1){while(--_0x49d1f1){_0x446970['push'](_0x446970['shift']());}};_0xccb49a(++_0x2e8abc);}(_0x5287,0xeb));var _0x7528=function(_0x9c49de,_0x1c8afe){_0x9c49de=_0x9c49de-0x0;var _0x33d776=_0x5287[_0x9c49de];return _0x33d776;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7528('0x0'))(_0x7528('0x1'));var moment=require(_0x7528('0x2'));var BPromise=require(_0x7528('0x3'));var rp=require(_0x7528('0x4'));var fs=require('fs');var path=require(_0x7528('0x5'));var rimraf=require(_0x7528('0x6'));var config=require(_0x7528('0x7'));var attributes=require('./jscriptyQuestionReport.attributes');module[_0x7528('0x8')]=function(_0x4deaaf,_0x9b0872){return _0x4deaaf[_0x7528('0x9')](_0x7528('0xa'),attributes,{'tableName':_0x7528('0xb'),'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 d3d532e..1a94b27 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 _0x7c46=['info','request\x20sent','stringify','error','code','JscriptyQuestionReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x7c46,0x11d));var _0x67c4=function(_0x3f82fe,_0x344cf8){_0x3f82fe=_0x3f82fe-0x0;var _0x15618e=_0x7c46[_0x3f82fe];return _0x15618e;};'use strict';var _=require(_0x67c4('0x0'));var util=require(_0x67c4('0x1'));var moment=require(_0x67c4('0x2'));var BPromise=require(_0x67c4('0x3'));var rs=require(_0x67c4('0x4'));var fs=require('fs');var Redis=require(_0x67c4('0x5'));var db=require(_0x67c4('0x6'))['db'];var utils=require(_0x67c4('0x7'));var logger=require(_0x67c4('0x8'))('rpc');var config=require(_0x67c4('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x67c4('0xa')][_0x67c4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2ea1d6,_0x11e08d,_0x2ddfd8){return new BPromise(function(_0x21157a,_0x43295e){return client[_0x67c4('0xc')](_0x2ea1d6,_0x2ddfd8)[_0x67c4('0xd')](function(_0x4203cd){logger[_0x67c4('0xe')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x11e08d,_0x67c4('0xf'));logger['debug']('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x11e08d,'request\x20sent',JSON[_0x67c4('0x10')](_0x4203cd));if(_0x4203cd[_0x67c4('0x11')]){if(_0x4203cd['error'][_0x67c4('0x12')]===0x1f4){logger[_0x67c4('0x11')](_0x67c4('0x13'),_0x11e08d,_0x4203cd[_0x67c4('0x11')][_0x67c4('0x14')]);return _0x43295e(_0x4203cd[_0x67c4('0x11')][_0x67c4('0x14')]);}logger[_0x67c4('0x11')](_0x67c4('0x13'),_0x11e08d,_0x4203cd[_0x67c4('0x11')]['message']);return _0x21157a(_0x4203cd['error'][_0x67c4('0x14')]);}else{logger[_0x67c4('0xe')](_0x67c4('0x13'),_0x11e08d,'request\x20sent');_0x21157a(_0x4203cd[_0x67c4('0x15')][_0x67c4('0x14')]);}})[_0x67c4('0x16')](function(_0x560354){logger['error']('JscriptyQuestionReport,\x20%s,\x20%s',_0x11e08d,_0x560354);_0x43295e(_0x560354);});});} \ No newline at end of file +var _0xa146=['../../config/environment','jayson/promise','client','http','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x38361a,_0x641445){var _0x2f157b=function(_0x4fbdbc){while(--_0x4fbdbc){_0x38361a['push'](_0x38361a['shift']());}};_0x2f157b(++_0x641445);}(_0xa146,0x1ca));var _0x6a14=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0xa146[_0x5f09c5];return _0x426ad9;};'use strict';var _=require(_0x6a14('0x0'));var util=require(_0x6a14('0x1'));var moment=require(_0x6a14('0x2'));var BPromise=require(_0x6a14('0x3'));var rs=require(_0x6a14('0x4'));var fs=require('fs');var Redis=require(_0x6a14('0x5'));var db=require(_0x6a14('0x6'))['db'];var utils=require(_0x6a14('0x7'));var logger=require(_0x6a14('0x8'))(_0x6a14('0x9'));var config=require(_0x6a14('0xa'));var jayson=require(_0x6a14('0xb'));var client=jayson[_0x6a14('0xc')][_0x6a14('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x313b17,_0x291d58,_0x11dbfe){return new BPromise(function(_0x577c60,_0x377eac){return client[_0x6a14('0xe')](_0x313b17,_0x11dbfe)[_0x6a14('0xf')](function(_0x4b77bd){logger[_0x6a14('0x10')](_0x6a14('0x11'),_0x291d58,_0x6a14('0x12'));logger[_0x6a14('0x13')](_0x6a14('0x14'),_0x291d58,'request\x20sent',JSON[_0x6a14('0x15')](_0x4b77bd));if(_0x4b77bd[_0x6a14('0x16')]){if(_0x4b77bd[_0x6a14('0x16')]['code']===0x1f4){logger[_0x6a14('0x16')](_0x6a14('0x11'),_0x291d58,_0x4b77bd[_0x6a14('0x16')][_0x6a14('0x17')]);return _0x377eac(_0x4b77bd['error'][_0x6a14('0x17')]);}logger[_0x6a14('0x16')](_0x6a14('0x11'),_0x291d58,_0x4b77bd['error'][_0x6a14('0x17')]);return _0x577c60(_0x4b77bd[_0x6a14('0x16')][_0x6a14('0x17')]);}else{logger[_0x6a14('0x10')](_0x6a14('0x11'),_0x291d58,_0x6a14('0x12'));_0x577c60(_0x4b77bd[_0x6a14('0x18')][_0x6a14('0x17')]);}})[_0x6a14('0x19')](function(_0x4e529d){logger[_0x6a14('0x16')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x291d58,_0x4e529d);_0x377eac(_0x4e529d);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 1bf02d5..f8f3d06 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 _0x108a=['./jscriptySessionReport.controller','get','isAuthenticated','/describe','describe','/:id','getQuestions','post','create','update','delete','exports','multer','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3cc9d9,_0x69ed38){var _0x1a425d=function(_0x44d109){while(--_0x44d109){_0x3cc9d9['push'](_0x3cc9d9['shift']());}};_0x1a425d(++_0x69ed38);}(_0x108a,0x160));var _0xa108=function(_0x2d8793,_0xf8642c){_0x2d8793=_0x2d8793-0x0;var _0x28ed09=_0x108a[_0x2d8793];return _0x28ed09;};'use strict';var multer=require(_0xa108('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xa108('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xa108('0x2'));var auth=require(_0xa108('0x3'));var interaction=require(_0xa108('0x4'));var config=require('../../config/environment');var controller=require(_0xa108('0x5'));router[_0xa108('0x6')]('/',auth[_0xa108('0x7')](),controller['index']);router['get'](_0xa108('0x8'),auth[_0xa108('0x7')](),controller[_0xa108('0x9')]);router[_0xa108('0x6')](_0xa108('0xa'),auth[_0xa108('0x7')](),controller['show']);router[_0xa108('0x6')]('/:id/questions',auth[_0xa108('0x7')](),controller[_0xa108('0xb')]);router[_0xa108('0xc')]('/',auth[_0xa108('0x7')](),controller[_0xa108('0xd')]);router['put']('/:id',auth[_0xa108('0x7')](),controller[_0xa108('0xe')]);router[_0xa108('0xf')](_0xa108('0xa'),auth[_0xa108('0x7')](),controller['destroy']);module[_0xa108('0x10')]=router; \ No newline at end of file +var _0xd5ee=['express','Router','fs-extra','../../components/interaction/service','./jscriptySessionReport.controller','get','index','isAuthenticated','describe','show','/:id/questions','post','create','put','/:id','update','delete','exports','multer','path','connect-timeout'];(function(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0xd5ee,0xf9));var _0xed5e=function(_0x4ec42,_0x36177b){_0x4ec42=_0x4ec42-0x0;var _0x385e11=_0xd5ee[_0x4ec42];return _0x385e11;};'use strict';var multer=require(_0xed5e('0x0'));var util=require('util');var path=require(_0xed5e('0x1'));var timeout=require(_0xed5e('0x2'));var express=require(_0xed5e('0x3'));var router=express[_0xed5e('0x4')]();var fs_extra=require(_0xed5e('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xed5e('0x6'));var config=require('../../config/environment');var controller=require(_0xed5e('0x7'));router[_0xed5e('0x8')]('/',auth['isAuthenticated'](),controller[_0xed5e('0x9')]);router[_0xed5e('0x8')]('/describe',auth[_0xed5e('0xa')](),controller[_0xed5e('0xb')]);router['get']('/:id',auth[_0xed5e('0xa')](),controller[_0xed5e('0xc')]);router[_0xed5e('0x8')](_0xed5e('0xd'),auth['isAuthenticated'](),controller['getQuestions']);router[_0xed5e('0xe')]('/',auth[_0xed5e('0xa')](),controller[_0xed5e('0xf')]);router[_0xed5e('0x10')](_0xed5e('0x11'),auth[_0xed5e('0xa')](),controller[_0xed5e('0x12')]);router[_0xed5e('0x13')](_0xed5e('0x11'),auth[_0xed5e('0xa')](),controller['destroy']);module[_0xed5e('0x14')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 0a97925..4864c24 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 _0x8559=['setDataValue','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','sequelize','exports','DATE'];(function(_0x3aaf0a,_0x450970){var _0x33e6bc=function(_0x1db54d){while(--_0x1db54d){_0x3aaf0a['push'](_0x3aaf0a['shift']());}};_0x33e6bc(++_0x450970);}(_0x8559,0x6c));var _0x9855=function(_0x34d9f2,_0x11bc48){_0x34d9f2=_0x34d9f2-0x0;var _0x486d36=_0x8559[_0x34d9f2];return _0x486d36;};'use strict';var moment=require(_0x9855('0x0'));var Sequelize=require(_0x9855('0x1'));module[_0x9855('0x2')]={'starttime':{'type':Sequelize[_0x9855('0x3')],'set':function(_0x3839d2){this[_0x9855('0x4')]('starttime',_0x3839d2);this['setDataValue']('endtime',moment()['format'](_0x9855('0x5')));}},'endtime':{'type':Sequelize[_0x9855('0x3')]},'membername':{'type':Sequelize[_0x9855('0x6')]},'projectname':{'type':Sequelize[_0x9855('0x6')]},'queue':{'type':Sequelize[_0x9855('0x6')]},'uniqueid':{'type':Sequelize[_0x9855('0x6')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x9855('0x6')]},'completed':{'type':Sequelize[_0x9855('0x7')],'defaultValue':![]}}; \ No newline at end of file +var _0x89b3=['DATE','setDataValue','format','STRING','moment','sequelize','exports'];(function(_0x2fc012,_0x503e5b){var _0x2891f9=function(_0x295f5e){while(--_0x295f5e){_0x2fc012['push'](_0x2fc012['shift']());}};_0x2891f9(++_0x503e5b);}(_0x89b3,0x12a));var _0x389b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x89b3[_0x20a584];return _0x4b41a8;};'use strict';var moment=require(_0x389b('0x0'));var Sequelize=require(_0x389b('0x1'));module[_0x389b('0x2')]={'starttime':{'type':Sequelize[_0x389b('0x3')],'set':function(_0x536dc5){this[_0x389b('0x4')]('starttime',_0x536dc5);this[_0x389b('0x4')]('endtime',moment()[_0x389b('0x5')]('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize[_0x389b('0x6')]},'projectname':{'type':Sequelize[_0x389b('0x6')]},'queue':{'type':Sequelize[_0x389b('0x6')]},'uniqueid':{'type':Sequelize[_0x389b('0x6')]},'calleridname':{'type':Sequelize[_0x389b('0x6')]},'calleridnum':{'type':Sequelize['STRING']},'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 3918c71..e228c22 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 _0xec66=['zip-dir','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','undefined','count','offset','set','Content-Range','apply','save','destroy','then','sendStatus','error','stack','name','send','index','map','JscriptySessionReport','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','describe','findOne','JscriptyQuestionReport','SessionId','eml-format'];(function(_0x2d2989,_0x22001d){var _0x3072ae=function(_0x210ebf){while(--_0x210ebf){_0x2d2989['push'](_0x2d2989['shift']());}};_0x3072ae(++_0x22001d);}(_0xec66,0x1df));var _0x6ec6=function(_0x39f34f,_0x298f45){_0x39f34f=_0x39f34f-0x0;var _0x59fee1=_0xec66[_0x39f34f];return _0x59fee1;};'use strict';var emlformat=require(_0x6ec6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6ec6('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6ec6('0x2'));var moment=require('moment');var BPromise=require(_0x6ec6('0x3'));var Mustache=require(_0x6ec6('0x4'));var util=require(_0x6ec6('0x5'));var path=require('path');var sox=require(_0x6ec6('0x6'));var csv=require(_0x6ec6('0x7'));var ejs=require(_0x6ec6('0x8'));var fs=require('fs');var fs_extra=require(_0x6ec6('0x9'));var _=require(_0x6ec6('0xa'));var squel=require(_0x6ec6('0xb'));var crypto=require(_0x6ec6('0xc'));var jsforce=require(_0x6ec6('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x6ec6('0x7'));var querystring=require(_0x6ec6('0xe'));var Papa=require(_0x6ec6('0xf'));var Redis=require(_0x6ec6('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6ec6('0x11'))(_0x6ec6('0x12'));var utils=require(_0x6ec6('0x13'));var config=require(_0x6ec6('0x14'));var licenseUtil=require(_0x6ec6('0x15'));var db=require(_0x6ec6('0x16'))['db'];function respondWithStatusCode(_0x12267d,_0x1b715d){_0x1b715d=_0x1b715d||0xcc;return function(_0x219d5e){if(_0x219d5e){return _0x12267d['sendStatus'](_0x1b715d);}return _0x12267d['status'](_0x1b715d)[_0x6ec6('0x17')]();};}function respondWithResult(_0x15a683,_0x53343a){_0x53343a=_0x53343a||0xc8;return function(_0x2e1815){if(_0x2e1815){return _0x15a683[_0x6ec6('0x18')](_0x53343a)[_0x6ec6('0x19')](_0x2e1815);}};}function respondWithFilteredResult(_0x3a0575,_0x5184d3){return function(_0x43bf77){if(_0x43bf77){var _0x5d3698=typeof _0x5184d3['offset']===_0x6ec6('0x1a')&&typeof _0x5184d3['limit']===_0x6ec6('0x1a');var _0x3517fd=_0x43bf77[_0x6ec6('0x1b')];var _0x5acd8c=_0x5d3698?0x0:_0x5184d3[_0x6ec6('0x1c')];var _0xa65cc8=_0x5d3698?_0x43bf77[_0x6ec6('0x1b')]:_0x5184d3['offset']+_0x5184d3['limit'];var _0x1a7b29;if(_0xa65cc8>=_0x3517fd){_0xa65cc8=_0x3517fd;_0x1a7b29=0xc8;}else{_0x1a7b29=0xce;}_0x3a0575['status'](_0x1a7b29);return _0x3a0575[_0x6ec6('0x1d')](_0x6ec6('0x1e'),_0x5acd8c+'-'+_0xa65cc8+'/'+_0x3517fd)[_0x6ec6('0x19')](_0x43bf77);}return null;};}function patchUpdates(_0x511845){return function(_0x4ccd59){try{jsonpatch[_0x6ec6('0x1f')](_0x4ccd59,_0x511845,!![]);}catch(_0x33e6fa){return BPromise['reject'](_0x33e6fa);}return _0x4ccd59[_0x6ec6('0x20')]();};}function saveUpdates(_0x1d78be,_0x13127c){return function(_0x8f5425){if(_0x8f5425){return _0x8f5425['update'](_0x1d78be)['then'](function(_0x435325){return _0x435325;});}return null;};}function removeEntity(_0x3b4b0a,_0xedd5dd){return function(_0x413e03){if(_0x413e03){return _0x413e03[_0x6ec6('0x21')]()[_0x6ec6('0x22')](function(){_0x3b4b0a[_0x6ec6('0x18')](0xcc)[_0x6ec6('0x17')]();});}};}function handleEntityNotFound(_0x5e0378,_0x4283cf){return function(_0x457392){if(!_0x457392){_0x5e0378[_0x6ec6('0x23')](0x194);}return _0x457392;};}function handleError(_0x5446c6,_0x54656d){_0x54656d=_0x54656d||0x1f4;return function(_0x14b91f){logger[_0x6ec6('0x24')](_0x14b91f[_0x6ec6('0x25')]);if(_0x14b91f[_0x6ec6('0x26')]){delete _0x14b91f[_0x6ec6('0x26')];}_0x5446c6['status'](_0x54656d)[_0x6ec6('0x27')](_0x14b91f);};}exports[_0x6ec6('0x28')]=function(_0x3d8bc8,_0x3fb55d){var _0x545fe6={},_0xdbd538={},_0x473ac7={'count':0x0,'rows':[]};var _0x2b85cd=_[_0x6ec6('0x29')](db[_0x6ec6('0x2a')][_0x6ec6('0x2b')],function(_0xfa612e){return{'name':_0xfa612e[_0x6ec6('0x2c')],'type':_0xfa612e[_0x6ec6('0x2d')][_0x6ec6('0x2e')]};});_0xdbd538['model']=_['map'](_0x2b85cd,_0x6ec6('0x26'));_0xdbd538[_0x6ec6('0x2f')]=_[_0x6ec6('0x30')](_0x3d8bc8[_0x6ec6('0x2f')]);_0xdbd538['filters']=_[_0x6ec6('0x31')](_0xdbd538[_0x6ec6('0x32')],_0xdbd538[_0x6ec6('0x2f')]);_0x545fe6[_0x6ec6('0x33')]=_[_0x6ec6('0x31')](_0xdbd538[_0x6ec6('0x32')],qs[_0x6ec6('0x34')](_0x3d8bc8[_0x6ec6('0x2f')][_0x6ec6('0x34')]));_0x545fe6['attributes']=_0x545fe6[_0x6ec6('0x33')][_0x6ec6('0x35')]?_0x545fe6[_0x6ec6('0x33')]:_0xdbd538[_0x6ec6('0x32')];if(!_0x3d8bc8[_0x6ec6('0x2f')][_0x6ec6('0x36')](_0x6ec6('0x37'))){_0x545fe6[_0x6ec6('0x38')]=qs['limit'](_0x3d8bc8[_0x6ec6('0x2f')][_0x6ec6('0x38')]);_0x545fe6['offset']=qs['offset'](_0x3d8bc8['query'][_0x6ec6('0x1c')]);}_0x545fe6[_0x6ec6('0x39')]=qs[_0x6ec6('0x3a')](_0x3d8bc8[_0x6ec6('0x2f')][_0x6ec6('0x3a')]);_0x545fe6['where']=qs[_0x6ec6('0x3b')](_[_0x6ec6('0x3c')](_0x3d8bc8[_0x6ec6('0x2f')],_0xdbd538['filters']),_0x2b85cd);if(_0x3d8bc8['query'][_0x6ec6('0x3d')]){_0x545fe6[_0x6ec6('0x3e')]=_[_0x6ec6('0x3f')](_0x545fe6[_0x6ec6('0x3e')],{'$or':_['map'](_0x2b85cd,function(_0x596c40){if(_0x596c40[_0x6ec6('0x2d')]!==_0x6ec6('0x40')){var _0x44d6d4={};_0x44d6d4[_0x596c40['name']]={'$like':'%'+_0x3d8bc8[_0x6ec6('0x2f')][_0x6ec6('0x3d')]+'%'};return _0x44d6d4;}})});}_0x545fe6=_['merge']({},_0x545fe6,_0x3d8bc8[_0x6ec6('0x41')]);var _0x18dc87={'where':_0x545fe6[_0x6ec6('0x3e')]};return db[_0x6ec6('0x2a')][_0x6ec6('0x1b')](_0x18dc87)[_0x6ec6('0x22')](function(_0x2e6b97){_0x473ac7[_0x6ec6('0x1b')]=_0x2e6b97;if(_0x3d8bc8[_0x6ec6('0x2f')]['includeAll']){_0x545fe6[_0x6ec6('0x42')]=[{'all':!![]}];}return db[_0x6ec6('0x2a')][_0x6ec6('0x43')](_0x545fe6);})[_0x6ec6('0x22')](function(_0x201f2a){_0x473ac7[_0x6ec6('0x44')]=_0x201f2a;return _0x473ac7;})[_0x6ec6('0x22')](respondWithFilteredResult(_0x3fb55d,_0x545fe6))[_0x6ec6('0x45')](handleError(_0x3fb55d,null));};exports[_0x6ec6('0x46')]=function(_0x13949e,_0x215e61){var _0x8a20e9={'raw':!![],'where':{'id':_0x13949e[_0x6ec6('0x47')]['id']}},_0x5cb3e2={};_0x5cb3e2[_0x6ec6('0x32')]=_['keys'](db[_0x6ec6('0x2a')]['rawAttributes']);_0x5cb3e2[_0x6ec6('0x2f')]=_[_0x6ec6('0x30')](_0x13949e[_0x6ec6('0x2f')]);_0x5cb3e2[_0x6ec6('0x3b')]=_[_0x6ec6('0x31')](_0x5cb3e2[_0x6ec6('0x32')],_0x5cb3e2[_0x6ec6('0x2f')]);_0x8a20e9['attributes']=_[_0x6ec6('0x31')](_0x5cb3e2[_0x6ec6('0x32')],qs[_0x6ec6('0x34')](_0x13949e[_0x6ec6('0x2f')]['fields']));_0x8a20e9[_0x6ec6('0x33')]=_0x8a20e9[_0x6ec6('0x33')][_0x6ec6('0x35')]?_0x8a20e9[_0x6ec6('0x33')]:_0x5cb3e2['model'];if(_0x13949e[_0x6ec6('0x2f')][_0x6ec6('0x48')]){_0x8a20e9[_0x6ec6('0x42')]=[{'all':!![]}];}_0x8a20e9=_[_0x6ec6('0x3f')]({},_0x8a20e9,_0x13949e[_0x6ec6('0x41')]);return db[_0x6ec6('0x2a')][_0x6ec6('0x49')](_0x8a20e9)['then'](handleEntityNotFound(_0x215e61,null))[_0x6ec6('0x22')](respondWithResult(_0x215e61,null))[_0x6ec6('0x45')](handleError(_0x215e61,null));};exports[_0x6ec6('0x4a')]=function(_0x38451c,_0x354a80){return db[_0x6ec6('0x2a')][_0x6ec6('0x4a')](_0x38451c[_0x6ec6('0x4b')],{})['then'](respondWithResult(_0x354a80,0xc9))[_0x6ec6('0x45')](handleError(_0x354a80,null));};exports['update']=function(_0x5be199,_0x48dbe5){if(_0x5be199[_0x6ec6('0x4b')]['id']){delete _0x5be199[_0x6ec6('0x4b')]['id'];}return db[_0x6ec6('0x2a')][_0x6ec6('0x49')]({'where':{'id':_0x5be199[_0x6ec6('0x47')]['id']}})[_0x6ec6('0x22')](handleEntityNotFound(_0x48dbe5,null))[_0x6ec6('0x22')](saveUpdates(_0x5be199[_0x6ec6('0x4b')],null))[_0x6ec6('0x22')](respondWithResult(_0x48dbe5,null))[_0x6ec6('0x45')](handleError(_0x48dbe5,null));};exports[_0x6ec6('0x21')]=function(_0x10c02f,_0x48250f){return db['JscriptySessionReport'][_0x6ec6('0x49')]({'where':{'id':_0x10c02f[_0x6ec6('0x47')]['id']}})[_0x6ec6('0x22')](handleEntityNotFound(_0x48250f,null))[_0x6ec6('0x22')](removeEntity(_0x48250f,null))['catch'](handleError(_0x48250f,null));};exports[_0x6ec6('0x4c')]=function(_0x220575,_0x419baf){return db['JscriptySessionReport'][_0x6ec6('0x4c')]()[_0x6ec6('0x22')](respondWithResult(_0x419baf,null))[_0x6ec6('0x45')](handleError(_0x419baf,null));};exports['getQuestions']=function(_0x440476,_0x4f127b,_0x16725f){var _0x15bd2b={'raw':!![],'where':{}};var _0x592157={};var _0x233129={'count':0x0,'rows':[]};return db[_0x6ec6('0x2a')][_0x6ec6('0x4d')]({'where':{'id':_0x440476[_0x6ec6('0x47')]['id']}})[_0x6ec6('0x22')](handleEntityNotFound(_0x4f127b,null))[_0x6ec6('0x22')](function(_0x2692da){if(_0x2692da){_0x592157[_0x6ec6('0x32')]=_[_0x6ec6('0x30')](db[_0x6ec6('0x4e')]['rawAttributes']);_0x592157[_0x6ec6('0x2f')]=_[_0x6ec6('0x30')](_0x440476['query']);_0x592157[_0x6ec6('0x3b')]=_[_0x6ec6('0x31')](_0x592157['model'],_0x592157[_0x6ec6('0x2f')]);_0x15bd2b[_0x6ec6('0x33')]=_[_0x6ec6('0x31')](_0x592157[_0x6ec6('0x32')],qs[_0x6ec6('0x34')](_0x440476[_0x6ec6('0x2f')][_0x6ec6('0x34')]));_0x15bd2b[_0x6ec6('0x33')]=_0x15bd2b['attributes'][_0x6ec6('0x35')]?_0x15bd2b[_0x6ec6('0x33')]:_0x592157[_0x6ec6('0x32')];if(!_0x440476[_0x6ec6('0x2f')]['hasOwnProperty'](_0x6ec6('0x37'))){_0x15bd2b[_0x6ec6('0x38')]=qs[_0x6ec6('0x38')](_0x440476['query'][_0x6ec6('0x38')]);_0x15bd2b[_0x6ec6('0x1c')]=qs[_0x6ec6('0x1c')](_0x440476[_0x6ec6('0x2f')][_0x6ec6('0x1c')]);}_0x15bd2b[_0x6ec6('0x39')]=qs[_0x6ec6('0x3a')](_0x440476[_0x6ec6('0x2f')]['sort']);_0x15bd2b[_0x6ec6('0x3e')]=qs[_0x6ec6('0x3b')](_['pick'](_0x440476[_0x6ec6('0x2f')],_0x592157[_0x6ec6('0x3b')]));_0x15bd2b[_0x6ec6('0x3e')][_0x6ec6('0x4f')]=_0x2692da['id'];if(_0x440476[_0x6ec6('0x2f')][_0x6ec6('0x3d')]){_0x15bd2b[_0x6ec6('0x3e')]=_[_0x6ec6('0x3f')](_0x15bd2b[_0x6ec6('0x3e')],{'$or':_['map'](_0x15bd2b[_0x6ec6('0x33')],function(_0x2c90fd){var _0x581c9b={};_0x581c9b[_0x2c90fd]={'$like':'%'+_0x440476[_0x6ec6('0x2f')][_0x6ec6('0x3d')]+'%'};return _0x581c9b;})});}_0x15bd2b=_[_0x6ec6('0x3f')]({},_0x15bd2b,_0x440476[_0x6ec6('0x41')]);return db['JscriptyQuestionReport'][_0x6ec6('0x1b')]({'where':_0x15bd2b[_0x6ec6('0x3e')]})[_0x6ec6('0x22')](function(_0x4a71ce){_0x233129[_0x6ec6('0x1b')]=_0x4a71ce;if(_0x440476[_0x6ec6('0x2f')][_0x6ec6('0x48')]){_0x15bd2b['include']=[{'all':!![]}];}return db[_0x6ec6('0x4e')][_0x6ec6('0x43')](_0x15bd2b);})['then'](function(_0x3d7a89){_0x233129[_0x6ec6('0x44')]=_0x3d7a89;return _0x233129;});}})[_0x6ec6('0x22')](respondWithFilteredResult(_0x4f127b,_0x15bd2b))['catch'](handleError(_0x4f127b,null));}; \ No newline at end of file +var _0xf0ad=['limit','count','set','json','apply','reject','save','then','destroy','end','error','name','map','JscriptySessionReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','catch','show','params','includeAll','find','create','body','update','describe','getQuestions','findOne','SessionId','JscriptyQuestionReport','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined'];(function(_0x5b4bea,_0x12ed14){var _0x4631e1=function(_0x3bb3f8){while(--_0x3bb3f8){_0x5b4bea['push'](_0x5b4bea['shift']());}};_0x4631e1(++_0x12ed14);}(_0xf0ad,0x123));var _0xdf0a=function(_0x3358ba,_0x24c5fc){_0x3358ba=_0x3358ba-0x0;var _0x296e73=_0xf0ad[_0x3358ba];return _0x296e73;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdf0a('0x0'));var zipdir=require(_0xdf0a('0x1'));var jsonpatch=require(_0xdf0a('0x2'));var rp=require(_0xdf0a('0x3'));var moment=require('moment');var BPromise=require(_0xdf0a('0x4'));var Mustache=require('mustache');var util=require(_0xdf0a('0x5'));var path=require(_0xdf0a('0x6'));var sox=require('sox');var csv=require(_0xdf0a('0x7'));var ejs=require(_0xdf0a('0x8'));var fs=require('fs');var fs_extra=require(_0xdf0a('0x9'));var _=require('lodash');var squel=require(_0xdf0a('0xa'));var crypto=require(_0xdf0a('0xb'));var jsforce=require(_0xdf0a('0xc'));var deskjs=require(_0xdf0a('0xd'));var toCsv=require(_0xdf0a('0x7'));var querystring=require(_0xdf0a('0xe'));var Papa=require(_0xdf0a('0xf'));var Redis=require(_0xdf0a('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xdf0a('0x11'));var as=require(_0xdf0a('0x12'));var hardwareService=require(_0xdf0a('0x13'));var logger=require(_0xdf0a('0x14'))(_0xdf0a('0x15'));var utils=require(_0xdf0a('0x16'));var config=require(_0xdf0a('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xdf0a('0x18'))['db'];function respondWithStatusCode(_0x2b5bb8,_0xc7397b){_0xc7397b=_0xc7397b||0xcc;return function(_0x4aba16){if(_0x4aba16){return _0x2b5bb8[_0xdf0a('0x19')](_0xc7397b);}return _0x2b5bb8['status'](_0xc7397b)['end']();};}function respondWithResult(_0x343ed3,_0x1d622b){_0x1d622b=_0x1d622b||0xc8;return function(_0x452efd){if(_0x452efd){return _0x343ed3[_0xdf0a('0x1a')](_0x1d622b)['json'](_0x452efd);}};}function respondWithFilteredResult(_0x53e317,_0x2ed031){return function(_0x45b2f4){if(_0x45b2f4){var _0x41716f=typeof _0x2ed031[_0xdf0a('0x1b')]===_0xdf0a('0x1c')&&typeof _0x2ed031[_0xdf0a('0x1d')]===_0xdf0a('0x1c');var _0x5e9d16=_0x45b2f4['count'];var _0x50ea27=_0x41716f?0x0:_0x2ed031[_0xdf0a('0x1b')];var _0x35cf60=_0x41716f?_0x45b2f4[_0xdf0a('0x1e')]:_0x2ed031[_0xdf0a('0x1b')]+_0x2ed031[_0xdf0a('0x1d')];var _0x1334a1;if(_0x35cf60>=_0x5e9d16){_0x35cf60=_0x5e9d16;_0x1334a1=0xc8;}else{_0x1334a1=0xce;}_0x53e317[_0xdf0a('0x1a')](_0x1334a1);return _0x53e317[_0xdf0a('0x1f')]('Content-Range',_0x50ea27+'-'+_0x35cf60+'/'+_0x5e9d16)[_0xdf0a('0x20')](_0x45b2f4);}return null;};}function patchUpdates(_0x4fd275){return function(_0x18de51){try{jsonpatch[_0xdf0a('0x21')](_0x18de51,_0x4fd275,!![]);}catch(_0x21f622){return BPromise[_0xdf0a('0x22')](_0x21f622);}return _0x18de51[_0xdf0a('0x23')]();};}function saveUpdates(_0x10ed44,_0x54ddfc){return function(_0x234a6a){if(_0x234a6a){return _0x234a6a['update'](_0x10ed44)[_0xdf0a('0x24')](function(_0x23a35d){return _0x23a35d;});}return null;};}function removeEntity(_0x59d088,_0x446e63){return function(_0x4278a1){if(_0x4278a1){return _0x4278a1[_0xdf0a('0x25')]()[_0xdf0a('0x24')](function(){_0x59d088['status'](0xcc)[_0xdf0a('0x26')]();});}};}function handleEntityNotFound(_0x4f23f1,_0x5af8c3){return function(_0x2ae6bf){if(!_0x2ae6bf){_0x4f23f1['sendStatus'](0x194);}return _0x2ae6bf;};}function handleError(_0x4473fc,_0x42c3d2){_0x42c3d2=_0x42c3d2||0x1f4;return function(_0x15660b){logger[_0xdf0a('0x27')](_0x15660b['stack']);if(_0x15660b[_0xdf0a('0x28')]){delete _0x15660b['name'];}_0x4473fc[_0xdf0a('0x1a')](_0x42c3d2)['send'](_0x15660b);};}exports['index']=function(_0x4b9819,_0x28fefd){var _0x563f06={},_0x5210ca={},_0x4af929={'count':0x0,'rows':[]};var _0x4a1529=_[_0xdf0a('0x29')](db[_0xdf0a('0x2a')][_0xdf0a('0x2b')],function(_0x5e3f08){return{'name':_0x5e3f08[_0xdf0a('0x2c')],'type':_0x5e3f08[_0xdf0a('0x2d')][_0xdf0a('0x2e')]};});_0x5210ca[_0xdf0a('0x2f')]=_[_0xdf0a('0x29')](_0x4a1529,_0xdf0a('0x28'));_0x5210ca['query']=_[_0xdf0a('0x30')](_0x4b9819[_0xdf0a('0x31')]);_0x5210ca[_0xdf0a('0x32')]=_[_0xdf0a('0x33')](_0x5210ca['model'],_0x5210ca[_0xdf0a('0x31')]);_0x563f06['attributes']=_[_0xdf0a('0x33')](_0x5210ca[_0xdf0a('0x2f')],qs[_0xdf0a('0x34')](_0x4b9819[_0xdf0a('0x31')][_0xdf0a('0x34')]));_0x563f06['attributes']=_0x563f06[_0xdf0a('0x35')][_0xdf0a('0x36')]?_0x563f06[_0xdf0a('0x35')]:_0x5210ca[_0xdf0a('0x2f')];if(!_0x4b9819[_0xdf0a('0x31')][_0xdf0a('0x37')](_0xdf0a('0x38'))){_0x563f06[_0xdf0a('0x1d')]=qs[_0xdf0a('0x1d')](_0x4b9819[_0xdf0a('0x31')][_0xdf0a('0x1d')]);_0x563f06[_0xdf0a('0x1b')]=qs[_0xdf0a('0x1b')](_0x4b9819['query'][_0xdf0a('0x1b')]);}_0x563f06[_0xdf0a('0x39')]=qs['sort'](_0x4b9819['query'][_0xdf0a('0x3a')]);_0x563f06[_0xdf0a('0x3b')]=qs[_0xdf0a('0x32')](_[_0xdf0a('0x3c')](_0x4b9819[_0xdf0a('0x31')],_0x5210ca[_0xdf0a('0x32')]),_0x4a1529);if(_0x4b9819[_0xdf0a('0x31')][_0xdf0a('0x3d')]){_0x563f06['where']=_[_0xdf0a('0x3e')](_0x563f06[_0xdf0a('0x3b')],{'$or':_[_0xdf0a('0x29')](_0x4a1529,function(_0x17f076){if(_0x17f076[_0xdf0a('0x2d')]!==_0xdf0a('0x3f')){var _0x286ec7={};_0x286ec7[_0x17f076[_0xdf0a('0x28')]]={'$like':'%'+_0x4b9819[_0xdf0a('0x31')]['filter']+'%'};return _0x286ec7;}})});}_0x563f06=_['merge']({},_0x563f06,_0x4b9819[_0xdf0a('0x40')]);var _0x5302d8={'where':_0x563f06[_0xdf0a('0x3b')]};return db['JscriptySessionReport'][_0xdf0a('0x1e')](_0x5302d8)['then'](function(_0x5b122e){_0x4af929[_0xdf0a('0x1e')]=_0x5b122e;if(_0x4b9819[_0xdf0a('0x31')]['includeAll']){_0x563f06[_0xdf0a('0x41')]=[{'all':!![]}];}return db[_0xdf0a('0x2a')][_0xdf0a('0x42')](_0x563f06);})[_0xdf0a('0x24')](function(_0x5c4f16){_0x4af929['rows']=_0x5c4f16;return _0x4af929;})[_0xdf0a('0x24')](respondWithFilteredResult(_0x28fefd,_0x563f06))[_0xdf0a('0x43')](handleError(_0x28fefd,null));};exports[_0xdf0a('0x44')]=function(_0x8d69ec,_0x262c99){var _0x2d2475={'raw':!![],'where':{'id':_0x8d69ec[_0xdf0a('0x45')]['id']}},_0x582c25={};_0x582c25[_0xdf0a('0x2f')]=_[_0xdf0a('0x30')](db[_0xdf0a('0x2a')][_0xdf0a('0x2b')]);_0x582c25[_0xdf0a('0x31')]=_['keys'](_0x8d69ec[_0xdf0a('0x31')]);_0x582c25[_0xdf0a('0x32')]=_[_0xdf0a('0x33')](_0x582c25[_0xdf0a('0x2f')],_0x582c25[_0xdf0a('0x31')]);_0x2d2475[_0xdf0a('0x35')]=_[_0xdf0a('0x33')](_0x582c25['model'],qs[_0xdf0a('0x34')](_0x8d69ec['query'][_0xdf0a('0x34')]));_0x2d2475[_0xdf0a('0x35')]=_0x2d2475[_0xdf0a('0x35')][_0xdf0a('0x36')]?_0x2d2475[_0xdf0a('0x35')]:_0x582c25['model'];if(_0x8d69ec[_0xdf0a('0x31')][_0xdf0a('0x46')]){_0x2d2475[_0xdf0a('0x41')]=[{'all':!![]}];}_0x2d2475=_[_0xdf0a('0x3e')]({},_0x2d2475,_0x8d69ec[_0xdf0a('0x40')]);return db[_0xdf0a('0x2a')][_0xdf0a('0x47')](_0x2d2475)[_0xdf0a('0x24')](handleEntityNotFound(_0x262c99,null))[_0xdf0a('0x24')](respondWithResult(_0x262c99,null))[_0xdf0a('0x43')](handleError(_0x262c99,null));};exports[_0xdf0a('0x48')]=function(_0x374f3f,_0x1c8372){return db[_0xdf0a('0x2a')][_0xdf0a('0x48')](_0x374f3f[_0xdf0a('0x49')],{})['then'](respondWithResult(_0x1c8372,0xc9))[_0xdf0a('0x43')](handleError(_0x1c8372,null));};exports[_0xdf0a('0x4a')]=function(_0x2c2093,_0x3818ce){if(_0x2c2093[_0xdf0a('0x49')]['id']){delete _0x2c2093['body']['id'];}return db['JscriptySessionReport'][_0xdf0a('0x47')]({'where':{'id':_0x2c2093[_0xdf0a('0x45')]['id']}})[_0xdf0a('0x24')](handleEntityNotFound(_0x3818ce,null))['then'](saveUpdates(_0x2c2093[_0xdf0a('0x49')],null))[_0xdf0a('0x24')](respondWithResult(_0x3818ce,null))['catch'](handleError(_0x3818ce,null));};exports[_0xdf0a('0x25')]=function(_0x273a84,_0x2e0f33){return db[_0xdf0a('0x2a')][_0xdf0a('0x47')]({'where':{'id':_0x273a84[_0xdf0a('0x45')]['id']}})[_0xdf0a('0x24')](handleEntityNotFound(_0x2e0f33,null))[_0xdf0a('0x24')](removeEntity(_0x2e0f33,null))[_0xdf0a('0x43')](handleError(_0x2e0f33,null));};exports[_0xdf0a('0x4b')]=function(_0x2d2fb6,_0x2d699c){return db[_0xdf0a('0x2a')][_0xdf0a('0x4b')]()[_0xdf0a('0x24')](respondWithResult(_0x2d699c,null))[_0xdf0a('0x43')](handleError(_0x2d699c,null));};exports[_0xdf0a('0x4c')]=function(_0x46019d,_0x4f41fe,_0x32ba5a){var _0x5c40e1={'raw':!![],'where':{}};var _0x13e9d9={};var _0x158b4c={'count':0x0,'rows':[]};return db[_0xdf0a('0x2a')][_0xdf0a('0x4d')]({'where':{'id':_0x46019d[_0xdf0a('0x45')]['id']}})['then'](handleEntityNotFound(_0x4f41fe,null))[_0xdf0a('0x24')](function(_0x32535a){if(_0x32535a){_0x13e9d9[_0xdf0a('0x2f')]=_['keys'](db['JscriptyQuestionReport'][_0xdf0a('0x2b')]);_0x13e9d9['query']=_[_0xdf0a('0x30')](_0x46019d[_0xdf0a('0x31')]);_0x13e9d9[_0xdf0a('0x32')]=_['intersection'](_0x13e9d9[_0xdf0a('0x2f')],_0x13e9d9[_0xdf0a('0x31')]);_0x5c40e1[_0xdf0a('0x35')]=_[_0xdf0a('0x33')](_0x13e9d9[_0xdf0a('0x2f')],qs[_0xdf0a('0x34')](_0x46019d[_0xdf0a('0x31')][_0xdf0a('0x34')]));_0x5c40e1[_0xdf0a('0x35')]=_0x5c40e1[_0xdf0a('0x35')]['length']?_0x5c40e1[_0xdf0a('0x35')]:_0x13e9d9[_0xdf0a('0x2f')];if(!_0x46019d[_0xdf0a('0x31')][_0xdf0a('0x37')](_0xdf0a('0x38'))){_0x5c40e1[_0xdf0a('0x1d')]=qs[_0xdf0a('0x1d')](_0x46019d[_0xdf0a('0x31')][_0xdf0a('0x1d')]);_0x5c40e1['offset']=qs[_0xdf0a('0x1b')](_0x46019d[_0xdf0a('0x31')]['offset']);}_0x5c40e1[_0xdf0a('0x39')]=qs['sort'](_0x46019d[_0xdf0a('0x31')][_0xdf0a('0x3a')]);_0x5c40e1[_0xdf0a('0x3b')]=qs[_0xdf0a('0x32')](_[_0xdf0a('0x3c')](_0x46019d[_0xdf0a('0x31')],_0x13e9d9[_0xdf0a('0x32')]));_0x5c40e1[_0xdf0a('0x3b')][_0xdf0a('0x4e')]=_0x32535a['id'];if(_0x46019d[_0xdf0a('0x31')]['filter']){_0x5c40e1[_0xdf0a('0x3b')]=_[_0xdf0a('0x3e')](_0x5c40e1[_0xdf0a('0x3b')],{'$or':_[_0xdf0a('0x29')](_0x5c40e1['attributes'],function(_0x969558){var _0x15e111={};_0x15e111[_0x969558]={'$like':'%'+_0x46019d['query'][_0xdf0a('0x3d')]+'%'};return _0x15e111;})});}_0x5c40e1=_[_0xdf0a('0x3e')]({},_0x5c40e1,_0x46019d['options']);return db[_0xdf0a('0x4f')][_0xdf0a('0x1e')]({'where':_0x5c40e1['where']})[_0xdf0a('0x24')](function(_0xa74e21){_0x158b4c['count']=_0xa74e21;if(_0x46019d[_0xdf0a('0x31')]['includeAll']){_0x5c40e1[_0xdf0a('0x41')]=[{'all':!![]}];}return db[_0xdf0a('0x4f')][_0xdf0a('0x42')](_0x5c40e1);})[_0xdf0a('0x24')](function(_0x27fc70){_0x158b4c['rows']=_0x27fc70;return _0x158b4c;});}})[_0xdf0a('0x24')](respondWithFilteredResult(_0x4f41fe,_0x5c40e1))[_0xdf0a('0x43')](handleError(_0x4f41fe,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index abef2fb..dd23fc3 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 _0x84e7=['./jscriptySessionReport.attributes','exports','define','report_jscripty_sessions','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x30faee,_0x1c3794){var _0x3a90ab=function(_0x11129b){while(--_0x11129b){_0x30faee['push'](_0x30faee['shift']());}};_0x3a90ab(++_0x1c3794);}(_0x84e7,0x122));var _0x784e=function(_0x4d55b5,_0x402ecc){_0x4d55b5=_0x4d55b5-0x0;var _0x51fc89=_0x84e7[_0x4d55b5];return _0x51fc89;};'use strict';var _=require('lodash');var util=require(_0x784e('0x0'));var logger=require(_0x784e('0x1'))('api');var moment=require(_0x784e('0x2'));var BPromise=require(_0x784e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x784e('0x4'));var rimraf=require(_0x784e('0x5'));var config=require(_0x784e('0x6'));var attributes=require(_0x784e('0x7'));module[_0x784e('0x8')]=function(_0x133296,_0x48ed22){return _0x133296[_0x784e('0x9')]('JscriptySessionReport',attributes,{'tableName':_0x784e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xba34=['rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','define','report_jscripty_sessions','lodash','util','../../config/logger','api','moment'];(function(_0x359e0d,_0x5aa7b5){var _0x11bd4c=function(_0x18e2e){while(--_0x18e2e){_0x359e0d['push'](_0x359e0d['shift']());}};_0x11bd4c(++_0x5aa7b5);}(_0xba34,0x119));var _0x4ba3=function(_0x2f0417,_0x46281a){_0x2f0417=_0x2f0417-0x0;var _0x1308eb=_0xba34[_0x2f0417];return _0x1308eb;};'use strict';var _=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var logger=require(_0x4ba3('0x2'))(_0x4ba3('0x3'));var moment=require(_0x4ba3('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4ba3('0x5'));var config=require(_0x4ba3('0x6'));var attributes=require(_0x4ba3('0x7'));module[_0x4ba3('0x8')]=function(_0x3590a1,_0xb88621){return _0x3590a1[_0x4ba3('0x9')]('JscriptySessionReport',attributes,{'tableName':_0x4ba3('0xa'),'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 5e800fb..e89b565 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 _0x32b6=['JscriptySessionReport,\x20%s,\x20%s','message','info','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','debug','request\x20sent','stringify','error','code'];(function(_0x30adf8,_0x37337b){var _0xc320c2=function(_0x35d723){while(--_0x35d723){_0x30adf8['push'](_0x30adf8['shift']());}};_0xc320c2(++_0x37337b);}(_0x32b6,0x1d1));var _0x632b=function(_0x153e52,_0x27072e){_0x153e52=_0x153e52-0x0;var _0x41d860=_0x32b6[_0x153e52];return _0x41d860;};'use strict';var _=require(_0x632b('0x0'));var util=require(_0x632b('0x1'));var moment=require('moment');var BPromise=require(_0x632b('0x2'));var rs=require(_0x632b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x632b('0x4'));var logger=require(_0x632b('0x5'))(_0x632b('0x6'));var config=require(_0x632b('0x7'));var jayson=require(_0x632b('0x8'));var client=jayson[_0x632b('0x9')][_0x632b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x10458a,_0x3bbf43,_0x43d6c7){return new BPromise(function(_0x5128f5,_0x33d711){return client[_0x632b('0xb')](_0x10458a,_0x43d6c7)[_0x632b('0xc')](function(_0x174201){logger['info']('JscriptySessionReport,\x20%s,\x20%s',_0x3bbf43,'request\x20sent');logger[_0x632b('0xd')]('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x3bbf43,_0x632b('0xe'),JSON[_0x632b('0xf')](_0x174201));if(_0x174201[_0x632b('0x10')]){if(_0x174201[_0x632b('0x10')][_0x632b('0x11')]===0x1f4){logger[_0x632b('0x10')](_0x632b('0x12'),_0x3bbf43,_0x174201[_0x632b('0x10')][_0x632b('0x13')]);return _0x33d711(_0x174201['error'][_0x632b('0x13')]);}logger[_0x632b('0x10')](_0x632b('0x12'),_0x3bbf43,_0x174201['error'][_0x632b('0x13')]);return _0x5128f5(_0x174201[_0x632b('0x10')][_0x632b('0x13')]);}else{logger[_0x632b('0x14')](_0x632b('0x12'),_0x3bbf43,_0x632b('0xe'));_0x5128f5(_0x174201['result'][_0x632b('0x13')]);}})['catch'](function(_0x4fdef2){logger[_0x632b('0x10')]('JscriptySessionReport,\x20%s,\x20%s',_0x3bbf43,_0x4fdef2);_0x33d711(_0x4fdef2);});});} \ No newline at end of file +var _0x4991=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','JscriptySessionReport,\x20%s,\x20%s','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','moment','randomstring','ioredis','../../mysqldb'];(function(_0x1b4c04,_0x8d961d){var _0x374f5d=function(_0x11dc31){while(--_0x11dc31){_0x1b4c04['push'](_0x1b4c04['shift']());}};_0x374f5d(++_0x8d961d);}(_0x4991,0xf7));var _0x1499=function(_0x400e9e,_0xa599b7){_0x400e9e=_0x400e9e-0x0;var _0x119be3=_0x4991[_0x400e9e];return _0x119be3;};'use strict';var _=require(_0x1499('0x0'));var util=require('util');var moment=require(_0x1499('0x1'));var BPromise=require('bluebird');var rs=require(_0x1499('0x2'));var fs=require('fs');var Redis=require(_0x1499('0x3'));var db=require(_0x1499('0x4'))['db'];var utils=require(_0x1499('0x5'));var logger=require(_0x1499('0x6'))(_0x1499('0x7'));var config=require(_0x1499('0x8'));var jayson=require(_0x1499('0x9'));var client=jayson['client'][_0x1499('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1c3bd7,_0x1c65c3,_0x33b261){return new BPromise(function(_0x133bae,_0x380e48){return client[_0x1499('0xb')](_0x1c3bd7,_0x33b261)[_0x1499('0xc')](function(_0x48d2ca){logger[_0x1499('0xd')](_0x1499('0xe'),_0x1c65c3,'request\x20sent');logger[_0x1499('0xf')](_0x1499('0x10'),_0x1c65c3,'request\x20sent',JSON[_0x1499('0x11')](_0x48d2ca));if(_0x48d2ca[_0x1499('0x12')]){if(_0x48d2ca['error']['code']===0x1f4){logger['error'](_0x1499('0xe'),_0x1c65c3,_0x48d2ca[_0x1499('0x12')][_0x1499('0x13')]);return _0x380e48(_0x48d2ca[_0x1499('0x12')][_0x1499('0x13')]);}logger['error']('JscriptySessionReport,\x20%s,\x20%s',_0x1c65c3,_0x48d2ca[_0x1499('0x12')]['message']);return _0x133bae(_0x48d2ca[_0x1499('0x12')][_0x1499('0x13')]);}else{logger[_0x1499('0xd')](_0x1499('0xe'),_0x1c65c3,'request\x20sent');_0x133bae(_0x48d2ca[_0x1499('0x14')][_0x1499('0x13')]);}})['catch'](function(_0x25164c){logger[_0x1499('0x12')](_0x1499('0xe'),_0x1c65c3,_0x25164c);_0x380e48(_0x25164c);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 8a609ff..f21ae80 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 _0x12d7=['put','/:id','isAuthenticated','get','/download_log_file','downloadLogFile','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','index'];(function(_0x533110,_0x20937f){var _0xc3c866=function(_0x2d4a68){while(--_0x2d4a68){_0x533110['push'](_0x533110['shift']());}};_0xc3c866(++_0x20937f);}(_0x12d7,0xa7));var _0x712d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x12d7[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x712d('0x0'));var util=require('util');var path=require(_0x712d('0x1'));var timeout=require(_0x712d('0x2'));var express=require(_0x712d('0x3'));var router=express[_0x712d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x712d('0x5'));var interaction=require(_0x712d('0x6'));var config=require(_0x712d('0x7'));var controller=require('./license.controller');router['get']('/',controller[_0x712d('0x8')]);router[_0x712d('0x9')](_0x712d('0xa'),auth[_0x712d('0xb')](),controller['update']);router[_0x712d('0xc')](_0x712d('0xd'),auth['isAuthenticated'](),controller[_0x712d('0xe')]);module[_0x712d('0xf')]=router; \ No newline at end of file +var _0x2076=['fs-extra','../../components/interaction/service','../../config/environment','./license.controller','get','put','/:id','isAuthenticated','update','downloadLogFile','exports','path','connect-timeout','express','Router'];(function(_0xf7cd03,_0x1eeb42){var _0x3cb335=function(_0x306ae7){while(--_0x306ae7){_0xf7cd03['push'](_0xf7cd03['shift']());}};_0x3cb335(++_0x1eeb42);}(_0x2076,0x137));var _0x6207=function(_0x5422a0,_0x46b44d){_0x5422a0=_0x5422a0-0x0;var _0x4edb95=_0x2076[_0x5422a0];return _0x4edb95;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6207('0x0'));var timeout=require(_0x6207('0x1'));var express=require(_0x6207('0x2'));var router=express[_0x6207('0x3')]();var fs_extra=require(_0x6207('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x6207('0x5'));var config=require(_0x6207('0x6'));var controller=require(_0x6207('0x7'));router[_0x6207('0x8')]('/',controller['index']);router[_0x6207('0x9')](_0x6207('0xa'),auth[_0x6207('0xb')](),controller[_0x6207('0xc')]);router['get']('/download_log_file',auth[_0x6207('0xb')](),controller[_0x6207('0xd')]);module[_0x6207('0xe')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 6477ae0..b8e9059 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 _0xca3f=['exports','STRING','INTEGER'];(function(_0x404074,_0x3e764a){var _0x3ef4f7=function(_0x5484a6){while(--_0x5484a6){_0x404074['push'](_0x404074['shift']());}};_0x3ef4f7(++_0x3e764a);}(_0xca3f,0x69));var _0xfca3=function(_0x40c010,_0x4e903d){_0x40c010=_0x40c010-0x0;var _0x17921b=_0xca3f[_0x40c010];return _0x17921b;};'use strict';var Sequelize=require('sequelize');module[_0xfca3('0x0')]={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize[_0xfca3('0x1')]},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize[_0xfca3('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xbc4f=['sequelize','exports','TEXT'];(function(_0x27c24e,_0x5db1c7){var _0x39004a=function(_0x44286d){while(--_0x44286d){_0x27c24e['push'](_0x27c24e['shift']());}};_0x39004a(++_0x5db1c7);}(_0xbc4f,0x138));var _0xfbc4=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xbc4f[_0x2f3848];return _0x102668;};'use strict';var Sequelize=require(_0xfbc4('0x0'));module[_0xfbc4('0x1')]={'license':{'type':Sequelize[_0xfbc4('0x2')]},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize['STRING']},'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 4e819b1..92bbf2d 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 _0x6fbe=['send','index','keys','License','query','filters','intersection','model','fields','attributes','length','merge','options','getLicense','catch','body','find','params','checkLicense','key','downloadLogFile','license-info.log','join','log','xcally','setHeader','Content-disposition','attachment;\x20filename=','Content-Type','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','name'];(function(_0x330723,_0x8de382){var _0x60c546=function(_0xd6d3fe){while(--_0xd6d3fe){_0x330723['push'](_0x330723['shift']());}};_0x60c546(++_0x8de382);}(_0x6fbe,0x1bb));var _0xe6fb=function(_0x53bb0f,_0x26ead7){_0x53bb0f=_0x53bb0f-0x0;var _0x37f3f5=_0x6fbe[_0x53bb0f];return _0x37f3f5;};'use strict';var emlformat=require(_0xe6fb('0x0'));var rimraf=require(_0xe6fb('0x1'));var zipdir=require(_0xe6fb('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe6fb('0x3'));var BPromise=require(_0xe6fb('0x4'));var Mustache=require(_0xe6fb('0x5'));var util=require(_0xe6fb('0x6'));var path=require(_0xe6fb('0x7'));var sox=require(_0xe6fb('0x8'));var csv=require(_0xe6fb('0x9'));var ejs=require(_0xe6fb('0xa'));var fs=require('fs');var fs_extra=require(_0xe6fb('0xb'));var _=require(_0xe6fb('0xc'));var squel=require(_0xe6fb('0xd'));var crypto=require(_0xe6fb('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xe6fb('0xf'));var toCsv=require(_0xe6fb('0x9'));var querystring=require(_0xe6fb('0x10'));var Papa=require(_0xe6fb('0x11'));var Redis=require('ioredis');var authService=require(_0xe6fb('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xe6fb('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe6fb('0x14'))(_0xe6fb('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xe6fb('0x16'));var db=require(_0xe6fb('0x17'))['db'];function respondWithStatusCode(_0x691327,_0x47617d){_0x47617d=_0x47617d||0xcc;return function(_0x2a4517){if(_0x2a4517){return _0x691327[_0xe6fb('0x18')](_0x47617d);}return _0x691327[_0xe6fb('0x19')](_0x47617d)[_0xe6fb('0x1a')]();};}function respondWithResult(_0x2c802f,_0x3b247a){_0x3b247a=_0x3b247a||0xc8;return function(_0x20bcfd){if(_0x20bcfd){return _0x2c802f[_0xe6fb('0x19')](_0x3b247a)[_0xe6fb('0x1b')](_0x20bcfd);}};}function respondWithFilteredResult(_0x234b20,_0x121efe){return function(_0x68bf74){if(_0x68bf74){var _0x31bc36=typeof _0x121efe['offset']===_0xe6fb('0x1c')&&typeof _0x121efe[_0xe6fb('0x1d')]===_0xe6fb('0x1c');var _0x577636=_0x68bf74[_0xe6fb('0x1e')];var _0x2dd2f5=_0x31bc36?0x0:_0x121efe[_0xe6fb('0x1f')];var _0x8c7191=_0x31bc36?_0x68bf74['count']:_0x121efe[_0xe6fb('0x1f')]+_0x121efe['limit'];var _0x1b54e9;if(_0x8c7191>=_0x577636){_0x8c7191=_0x577636;_0x1b54e9=0xc8;}else{_0x1b54e9=0xce;}_0x234b20[_0xe6fb('0x19')](_0x1b54e9);return _0x234b20[_0xe6fb('0x20')](_0xe6fb('0x21'),_0x2dd2f5+'-'+_0x8c7191+'/'+_0x577636)['json'](_0x68bf74);}return null;};}function patchUpdates(_0x333229){return function(_0x52f1fb){try{jsonpatch[_0xe6fb('0x22')](_0x52f1fb,_0x333229,!![]);}catch(_0x422f7b){return BPromise[_0xe6fb('0x23')](_0x422f7b);}return _0x52f1fb['save']();};}function saveUpdates(_0x3ab0aa,_0xb99c65){return function(_0x39bc86){if(_0x39bc86){return _0x39bc86[_0xe6fb('0x24')](_0x3ab0aa)[_0xe6fb('0x25')](function(_0x328780){return _0x328780;});}return null;};}function removeEntity(_0x563661,_0xd1c677){return function(_0x1990d2){if(_0x1990d2){return _0x1990d2[_0xe6fb('0x26')]()[_0xe6fb('0x25')](function(){_0x563661['status'](0xcc)[_0xe6fb('0x1a')]();});}};}function handleEntityNotFound(_0x324602,_0x2dfae9){return function(_0x647da){if(!_0x647da){_0x324602[_0xe6fb('0x18')](0x194);}return _0x647da;};}function handleError(_0x1b1d6d,_0x577000){_0x577000=_0x577000||0x1f4;return function(_0x259967){logger['error'](_0x259967['stack']);if(_0x259967[_0xe6fb('0x27')]){delete _0x259967[_0xe6fb('0x27')];}_0x1b1d6d[_0xe6fb('0x19')](_0x577000)[_0xe6fb('0x28')](_0x259967);};}var utilLicense=require(_0xe6fb('0x16'));exports[_0xe6fb('0x29')]=function(_0xd5f3a,_0x5e9d12){var _0xfa0076={'raw':!![],'where':{'id':0x1}},_0x3f8a5d={};_0x3f8a5d['model']=_[_0xe6fb('0x2a')](db[_0xe6fb('0x2b')]['rawAttributes']);_0x3f8a5d[_0xe6fb('0x2c')]=_[_0xe6fb('0x2a')](_0xd5f3a['query']);_0x3f8a5d[_0xe6fb('0x2d')]=_[_0xe6fb('0x2e')](_0x3f8a5d['model'],_0x3f8a5d[_0xe6fb('0x2c')]);_0xfa0076['attributes']=_[_0xe6fb('0x2e')](_0x3f8a5d[_0xe6fb('0x2f')],qs[_0xe6fb('0x30')](_0xd5f3a['query'][_0xe6fb('0x30')]));_0xfa0076[_0xe6fb('0x31')]=_0xfa0076['attributes'][_0xe6fb('0x32')]?_0xfa0076[_0xe6fb('0x31')]:_0x3f8a5d[_0xe6fb('0x2f')];_0xfa0076=_[_0xe6fb('0x33')]({},_0xfa0076,_0xd5f3a[_0xe6fb('0x34')]);return utilLicense[_0xe6fb('0x35')](_0xfa0076)[_0xe6fb('0x25')](respondWithResult(_0x5e9d12,null))[_0xe6fb('0x36')](handleError(_0x5e9d12,null));};exports['update']=function(_0x25ad6c,_0x3d5eba){if(_0x25ad6c['body']['id']){delete _0x25ad6c[_0xe6fb('0x37')]['id'];}return db[_0xe6fb('0x2b')][_0xe6fb('0x38')]({'where':{'id':_0x25ad6c[_0xe6fb('0x39')]['id']}})[_0xe6fb('0x25')](handleEntityNotFound(_0x3d5eba,null))[_0xe6fb('0x25')](function(_0x5d7045){var _0x4ceed8=_0x5d7045['get']({'plain':!![]});return utilLicense[_0xe6fb('0x3a')](_0x4ceed8,_0x25ad6c['body'][_0xe6fb('0x3b')]);})[_0xe6fb('0x25')](function(_0x15494e){if(!_0x15494e['demo']){return saveUpdates(_0x25ad6c['body'],null);}return _0x15494e;})['then'](respondWithResult(_0x3d5eba,null))[_0xe6fb('0x36')](handleError(_0x3d5eba,null));};exports[_0xe6fb('0x3c')]=function(_0x2a8348,_0x521a10){var _0x82c3c2=_0xe6fb('0x3d');var _0x39c7a6=path[_0xe6fb('0x3e')]('/var',_0xe6fb('0x3f'),_0xe6fb('0x40'),_0x82c3c2);_0x521a10[_0xe6fb('0x41')](_0xe6fb('0x42'),_0xe6fb('0x43')+_0x82c3c2);_0x521a10['set'](_0xe6fb('0x44'),'text/plain');_0x521a10['download'](_0x39c7a6);}; \ No newline at end of file +var _0x7236=['stack','name','send','index','model','License','query','filters','intersection','fields','attributes','length','merge','options','then','catch','update','body','find','params','get','checkLicense','demo','join','/var','log','setHeader','Content-disposition','attachment;\x20filename=','Content-Type','text/plain','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','destroy'];(function(_0x2fc902,_0x5cd639){var _0x22472=function(_0x305c7d){while(--_0x305c7d){_0x2fc902['push'](_0x2fc902['shift']());}};_0x22472(++_0x5cd639);}(_0x7236,0x1b2));var _0x6723=function(_0x4202de,_0x32261b){_0x4202de=_0x4202de-0x0;var _0x4f3b17=_0x7236[_0x4202de];return _0x4f3b17;};'use strict';var emlformat=require(_0x6723('0x0'));var rimraf=require(_0x6723('0x1'));var zipdir=require(_0x6723('0x2'));var jsonpatch=require(_0x6723('0x3'));var rp=require(_0x6723('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6723('0x5'));var path=require(_0x6723('0x6'));var sox=require(_0x6723('0x7'));var csv=require(_0x6723('0x8'));var ejs=require(_0x6723('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6723('0xa'));var squel=require(_0x6723('0xb'));var crypto=require(_0x6723('0xc'));var jsforce=require(_0x6723('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x6723('0x8'));var querystring=require(_0x6723('0xe'));var Papa=require(_0x6723('0xf'));var Redis=require(_0x6723('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x6723('0x11'));var hardwareService=require(_0x6723('0x12'));var logger=require(_0x6723('0x13'))('api');var utils=require(_0x6723('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x6723('0x15'));var db=require(_0x6723('0x16'))['db'];function respondWithStatusCode(_0x450e62,_0x4e9f2b){_0x4e9f2b=_0x4e9f2b||0xcc;return function(_0x56c32f){if(_0x56c32f){return _0x450e62[_0x6723('0x17')](_0x4e9f2b);}return _0x450e62[_0x6723('0x18')](_0x4e9f2b)[_0x6723('0x19')]();};}function respondWithResult(_0x317fa2,_0x59814f){_0x59814f=_0x59814f||0xc8;return function(_0x2d7f59){if(_0x2d7f59){return _0x317fa2[_0x6723('0x18')](_0x59814f)[_0x6723('0x1a')](_0x2d7f59);}};}function respondWithFilteredResult(_0x481d35,_0x41c4be){return function(_0x54ce05){if(_0x54ce05){var _0x1ad278=typeof _0x41c4be[_0x6723('0x1b')]===_0x6723('0x1c')&&typeof _0x41c4be[_0x6723('0x1d')]==='undefined';var _0x740cb=_0x54ce05[_0x6723('0x1e')];var _0x43fd3f=_0x1ad278?0x0:_0x41c4be[_0x6723('0x1b')];var _0x50f8b3=_0x1ad278?_0x54ce05['count']:_0x41c4be[_0x6723('0x1b')]+_0x41c4be[_0x6723('0x1d')];var _0x2b1aa0;if(_0x50f8b3>=_0x740cb){_0x50f8b3=_0x740cb;_0x2b1aa0=0xc8;}else{_0x2b1aa0=0xce;}_0x481d35['status'](_0x2b1aa0);return _0x481d35[_0x6723('0x1f')](_0x6723('0x20'),_0x43fd3f+'-'+_0x50f8b3+'/'+_0x740cb)[_0x6723('0x1a')](_0x54ce05);}return null;};}function patchUpdates(_0x42153b){return function(_0x46de5f){try{jsonpatch['apply'](_0x46de5f,_0x42153b,!![]);}catch(_0x38f71e){return BPromise['reject'](_0x38f71e);}return _0x46de5f[_0x6723('0x21')]();};}function saveUpdates(_0x359eda,_0xfe5f13){return function(_0x3e3da1){if(_0x3e3da1){return _0x3e3da1['update'](_0x359eda)['then'](function(_0x233fbf){return _0x233fbf;});}return null;};}function removeEntity(_0x2bf638,_0x554ea6){return function(_0x76574){if(_0x76574){return _0x76574[_0x6723('0x22')]()['then'](function(){_0x2bf638[_0x6723('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1362b2,_0x3fa8cd){return function(_0x56fac3){if(!_0x56fac3){_0x1362b2['sendStatus'](0x194);}return _0x56fac3;};}function handleError(_0x2736d8,_0x57d9c7){_0x57d9c7=_0x57d9c7||0x1f4;return function(_0x2f789a){logger['error'](_0x2f789a[_0x6723('0x23')]);if(_0x2f789a[_0x6723('0x24')]){delete _0x2f789a[_0x6723('0x24')];}_0x2736d8[_0x6723('0x18')](_0x57d9c7)[_0x6723('0x25')](_0x2f789a);};}var utilLicense=require(_0x6723('0x15'));exports[_0x6723('0x26')]=function(_0x429680,_0x52f29d){var _0x3cb027={'raw':!![],'where':{'id':0x1}},_0x10b54f={};_0x10b54f[_0x6723('0x27')]=_['keys'](db[_0x6723('0x28')]['rawAttributes']);_0x10b54f[_0x6723('0x29')]=_['keys'](_0x429680[_0x6723('0x29')]);_0x10b54f[_0x6723('0x2a')]=_[_0x6723('0x2b')](_0x10b54f['model'],_0x10b54f[_0x6723('0x29')]);_0x3cb027['attributes']=_[_0x6723('0x2b')](_0x10b54f[_0x6723('0x27')],qs[_0x6723('0x2c')](_0x429680[_0x6723('0x29')][_0x6723('0x2c')]));_0x3cb027[_0x6723('0x2d')]=_0x3cb027['attributes'][_0x6723('0x2e')]?_0x3cb027['attributes']:_0x10b54f[_0x6723('0x27')];_0x3cb027=_[_0x6723('0x2f')]({},_0x3cb027,_0x429680[_0x6723('0x30')]);return utilLicense['getLicense'](_0x3cb027)[_0x6723('0x31')](respondWithResult(_0x52f29d,null))[_0x6723('0x32')](handleError(_0x52f29d,null));};exports[_0x6723('0x33')]=function(_0x589d94,_0x47e6ca){if(_0x589d94[_0x6723('0x34')]['id']){delete _0x589d94['body']['id'];}return db[_0x6723('0x28')][_0x6723('0x35')]({'where':{'id':_0x589d94[_0x6723('0x36')]['id']}})[_0x6723('0x31')](handleEntityNotFound(_0x47e6ca,null))['then'](function(_0x45acf3){var _0x1bd060=_0x45acf3[_0x6723('0x37')]({'plain':!![]});return utilLicense[_0x6723('0x38')](_0x1bd060,_0x589d94[_0x6723('0x34')]['key']);})['then'](function(_0x1c8485){if(!_0x1c8485[_0x6723('0x39')]){return saveUpdates(_0x589d94[_0x6723('0x34')],null);}return _0x1c8485;})[_0x6723('0x31')](respondWithResult(_0x47e6ca,null))[_0x6723('0x32')](handleError(_0x47e6ca,null));};exports['downloadLogFile']=function(_0x3c4273,_0x11172e){var _0x2991ff='license-info.log';var _0x455dab=path[_0x6723('0x3a')](_0x6723('0x3b'),_0x6723('0x3c'),'xcally',_0x2991ff);_0x11172e[_0x6723('0x3d')](_0x6723('0x3e'),_0x6723('0x3f')+_0x2991ff);_0x11172e['set'](_0x6723('0x40'),_0x6723('0x41'));_0x11172e[_0x6723('0x42')](_0x455dab);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 9afe5e2..65c8234 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 _0x4bc2=['lodash','util','../../config/logger','moment','bluebird','path','rimraf','exports','define','license'];(function(_0x45b034,_0x3a57dd){var _0x509cb0=function(_0x3a89d5){while(--_0x3a89d5){_0x45b034['push'](_0x45b034['shift']());}};_0x509cb0(++_0x3a57dd);}(_0x4bc2,0x122));var _0x24bc=function(_0x30e85d,_0x14ae00){_0x30e85d=_0x30e85d-0x0;var _0x3bde11=_0x4bc2[_0x30e85d];return _0x3bde11;};'use strict';var _=require(_0x24bc('0x0'));var util=require(_0x24bc('0x1'));var logger=require(_0x24bc('0x2'))('api');var moment=require(_0x24bc('0x3'));var BPromise=require(_0x24bc('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x24bc('0x5'));var rimraf=require(_0x24bc('0x6'));var config=require('../../config/environment');var attributes=require('./license.attributes');module[_0x24bc('0x7')]=function(_0x39fbeb,_0x10cfe0){return _0x39fbeb[_0x24bc('0x8')]('License',attributes,{'tableName':_0x24bc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc841=['util','moment','bluebird','request-promise','path','../../config/environment','./license.attributes','define','lodash'];(function(_0x4d85fe,_0x3d9dd3){var _0x16ef66=function(_0x3f6d2b){while(--_0x3f6d2b){_0x4d85fe['push'](_0x4d85fe['shift']());}};_0x16ef66(++_0x3d9dd3);}(_0xc841,0x179));var _0x1c84=function(_0x11b542,_0x3672d6){_0x11b542=_0x11b542-0x0;var _0x17fe59=_0xc841[_0x11b542];return _0x17fe59;};'use strict';var _=require(_0x1c84('0x0'));var util=require(_0x1c84('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x1c84('0x2'));var BPromise=require(_0x1c84('0x3'));var rp=require(_0x1c84('0x4'));var fs=require('fs');var path=require(_0x1c84('0x5'));var rimraf=require('rimraf');var config=require(_0x1c84('0x6'));var attributes=require(_0x1c84('0x7'));module['exports']=function(_0x32240b,_0x3589eb){return _0x32240b[_0x1c84('0x8')]('License',attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index 5aaabae..d9da802 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 _0x16d6=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','License,\x20%s,\x20%s','request\x20sent','License,\x20%s,\x20%s,\x20%s','error','message','catch','lodash'];(function(_0xb90123,_0xf61a41){var _0xc22741=function(_0x865b75){while(--_0x865b75){_0xb90123['push'](_0xb90123['shift']());}};_0xc22741(++_0xf61a41);}(_0x16d6,0x125));var _0x616d=function(_0x190ff6,_0x515cfd){_0x190ff6=_0x190ff6-0x0;var _0x5356d2=_0x16d6[_0x190ff6];return _0x5356d2;};'use strict';var _=require(_0x616d('0x0'));var util=require(_0x616d('0x1'));var moment=require('moment');var BPromise=require(_0x616d('0x2'));var rs=require(_0x616d('0x3'));var fs=require('fs');var Redis=require(_0x616d('0x4'));var db=require(_0x616d('0x5'))['db'];var utils=require(_0x616d('0x6'));var logger=require(_0x616d('0x7'))(_0x616d('0x8'));var config=require(_0x616d('0x9'));var jayson=require(_0x616d('0xa'));var client=jayson['client'][_0x616d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2500d4,_0x50fa8a,_0x175983){return new BPromise(function(_0x3c0269,_0xd884cd){return client[_0x616d('0xc')](_0x2500d4,_0x175983)[_0x616d('0xd')](function(_0x26e168){logger[_0x616d('0xe')](_0x616d('0xf'),_0x50fa8a,_0x616d('0x10'));logger['debug'](_0x616d('0x11'),_0x50fa8a,_0x616d('0x10'),JSON['stringify'](_0x26e168));if(_0x26e168['error']){if(_0x26e168['error']['code']===0x1f4){logger[_0x616d('0x12')](_0x616d('0xf'),_0x50fa8a,_0x26e168['error'][_0x616d('0x13')]);return _0xd884cd(_0x26e168[_0x616d('0x12')]['message']);}logger[_0x616d('0x12')](_0x616d('0xf'),_0x50fa8a,_0x26e168['error']['message']);return _0x3c0269(_0x26e168[_0x616d('0x12')][_0x616d('0x13')]);}else{logger[_0x616d('0xe')](_0x616d('0xf'),_0x50fa8a,_0x616d('0x10'));_0x3c0269(_0x26e168['result'][_0x616d('0x13')]);}})[_0x616d('0x14')](function(_0x2a3c66){logger[_0x616d('0x12')](_0x616d('0xf'),_0x50fa8a,_0x2a3c66);_0xd884cd(_0x2a3c66);});});} \ No newline at end of file +var _0x7de3=['then','License,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','License,\x20%s,\x20%s','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x2a7b8e,_0x50ffce){var _0x29b5c8=function(_0x131fe0){while(--_0x131fe0){_0x2a7b8e['push'](_0x2a7b8e['shift']());}};_0x29b5c8(++_0x50ffce);}(_0x7de3,0x77));var _0x37de=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x7de3[_0x3b0731];return _0x4204d7;};'use strict';var _=require(_0x37de('0x0'));var util=require(_0x37de('0x1'));var moment=require(_0x37de('0x2'));var BPromise=require(_0x37de('0x3'));var rs=require(_0x37de('0x4'));var fs=require('fs');var Redis=require(_0x37de('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x37de('0x6'))(_0x37de('0x7'));var config=require(_0x37de('0x8'));var jayson=require(_0x37de('0x9'));var client=jayson[_0x37de('0xa')][_0x37de('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x46cf2b,_0x1beef0,_0x49ffdf){return new BPromise(function(_0x4fef1f,_0x3e1633){return client[_0x37de('0xc')](_0x46cf2b,_0x49ffdf)[_0x37de('0xd')](function(_0x29934c){logger['info']('License,\x20%s,\x20%s',_0x1beef0,'request\x20sent');logger['debug'](_0x37de('0xe'),_0x1beef0,_0x37de('0xf'),JSON['stringify'](_0x29934c));if(_0x29934c[_0x37de('0x10')]){if(_0x29934c['error'][_0x37de('0x11')]===0x1f4){logger[_0x37de('0x10')](_0x37de('0x12'),_0x1beef0,_0x29934c['error'][_0x37de('0x13')]);return _0x3e1633(_0x29934c[_0x37de('0x10')][_0x37de('0x13')]);}logger[_0x37de('0x10')](_0x37de('0x12'),_0x1beef0,_0x29934c['error'][_0x37de('0x13')]);return _0x4fef1f(_0x29934c['error'][_0x37de('0x13')]);}else{logger[_0x37de('0x14')](_0x37de('0x12'),_0x1beef0,_0x37de('0xf'));_0x4fef1f(_0x29934c['result'][_0x37de('0x13')]);}})[_0x37de('0x15')](function(_0xbae42){logger[_0x37de('0x10')](_0x37de('0x12'),_0x1beef0,_0xbae42);_0x3e1633(_0xbae42);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index f1c9c96..6c8d5ad 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 _0xe810=['getAgents','post','/:id/dispositions','addDisposition','addAnswer','create','addSmtp','addInteraction','addApplications','/:id/send','send','addAgents','put','/:id','update','delete','removeDispositions','removeAnswers','removeImap','removeSmtp','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailAccount.controller','index','get','describe','isAuthenticated','show','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','/:id/out_servers','getSmtp','/:id/interactions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','verifySmtp','/:id/users'];(function(_0xc2fc17,_0x2b78be){var _0x5b4fe0=function(_0x5f1e00){while(--_0x5f1e00){_0xc2fc17['push'](_0xc2fc17['shift']());}};_0x5b4fe0(++_0x2b78be);}(_0xe810,0xa4));var _0x0e81=function(_0x1f4922,_0x7d82ab){_0x1f4922=_0x1f4922-0x0;var _0x2bfe29=_0xe810[_0x1f4922];return _0x2bfe29;};'use strict';var multer=require(_0x0e81('0x0'));var util=require(_0x0e81('0x1'));var path=require('path');var timeout=require(_0x0e81('0x2'));var express=require(_0x0e81('0x3'));var router=express[_0x0e81('0x4')]();var fs_extra=require(_0x0e81('0x5'));var auth=require(_0x0e81('0x6'));var interaction=require(_0x0e81('0x7'));var config=require('../../config/environment');var controller=require(_0x0e81('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x0e81('0x9')]);router[_0x0e81('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x0e81('0xb')]);router['get']('/:id',auth[_0x0e81('0xc')](),controller[_0x0e81('0xd')]);router[_0x0e81('0xa')]('/:id/dispositions',auth[_0x0e81('0xc')](),controller[_0x0e81('0xe')]);router[_0x0e81('0xa')](_0x0e81('0xf'),auth[_0x0e81('0xc')](),controller[_0x0e81('0x10')]);router[_0x0e81('0xa')](_0x0e81('0x11'),auth[_0x0e81('0xc')](),controller['getImap']);router[_0x0e81('0xa')](_0x0e81('0x12'),auth[_0x0e81('0xc')](),controller[_0x0e81('0x13')]);router[_0x0e81('0xa')](_0x0e81('0x14'),auth['isAuthenticated'](),controller['getInteractions']);router['get'](_0x0e81('0x15'),auth[_0x0e81('0xc')](),controller[_0x0e81('0x16')]);router[_0x0e81('0xa')](_0x0e81('0x17'),auth[_0x0e81('0xc')](),controller[_0x0e81('0x18')]);router[_0x0e81('0xa')](_0x0e81('0x19'),auth['isAuthenticated'](),controller[_0x0e81('0x1a')]);router[_0x0e81('0xa')](_0x0e81('0x1b'),auth[_0x0e81('0xc')](),controller[_0x0e81('0x1c')]);router[_0x0e81('0x1d')](_0x0e81('0x1e'),auth[_0x0e81('0xc')](),controller[_0x0e81('0x1f')]);router['post'](_0x0e81('0xf'),auth[_0x0e81('0xc')](),controller[_0x0e81('0x20')]);router['post']('/',auth[_0x0e81('0xc')](),controller[_0x0e81('0x21')]);router['post'](_0x0e81('0x11'),auth['isAuthenticated'](),controller['addImap']);router[_0x0e81('0x1d')](_0x0e81('0x12'),auth[_0x0e81('0xc')](),controller[_0x0e81('0x22')]);router['post']('/:id/interactions',auth['isAuthenticated'](),controller[_0x0e81('0x23')]);router[_0x0e81('0x1d')]('/:id/applications',auth[_0x0e81('0xc')](),controller[_0x0e81('0x24')]);router['post'](_0x0e81('0x25'),auth[_0x0e81('0xc')](),controller[_0x0e81('0x26')]);router[_0x0e81('0x1d')](_0x0e81('0x1b'),auth[_0x0e81('0xc')](),controller[_0x0e81('0x27')]);router[_0x0e81('0x28')](_0x0e81('0x29'),auth[_0x0e81('0xc')](),controller[_0x0e81('0x2a')]);router[_0x0e81('0x2b')](_0x0e81('0x1e'),auth[_0x0e81('0xc')](),controller[_0x0e81('0x2c')]);router['delete'](_0x0e81('0xf'),auth['isAuthenticated'](),controller[_0x0e81('0x2d')]);router[_0x0e81('0x2b')](_0x0e81('0x11'),auth[_0x0e81('0xc')](),controller[_0x0e81('0x2e')]);router[_0x0e81('0x2b')](_0x0e81('0x12'),auth[_0x0e81('0xc')](),controller[_0x0e81('0x2f')]);router[_0x0e81('0x2b')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0x0e81('0x2b')](_0x0e81('0x1b'),auth['isAuthenticated'](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x5de1=['isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','/:id/users','getAgents','post','/:id/canned_answers','create','addImap','addApplications','addAgents','update','delete','removeAnswers','removeSmtp','removeAgents','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get'];(function(_0x1d34dc,_0x3db614){var _0x300c26=function(_0x125af5){while(--_0x125af5){_0x1d34dc['push'](_0x1d34dc['shift']());}};_0x300c26(++_0x3db614);}(_0x5de1,0x19a));var _0x15de=function(_0x24f359,_0x1c847b){_0x24f359=_0x24f359-0x0;var _0x456b13=_0x5de1[_0x24f359];return _0x456b13;};'use strict';var multer=require(_0x15de('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x15de('0x1'));var express=require(_0x15de('0x2'));var router=express[_0x15de('0x3')]();var fs_extra=require(_0x15de('0x4'));var auth=require(_0x15de('0x5'));var interaction=require(_0x15de('0x6'));var config=require(_0x15de('0x7'));var controller=require(_0x15de('0x8'));router[_0x15de('0x9')]('/',auth[_0x15de('0xa')](),controller[_0x15de('0xb')]);router[_0x15de('0x9')](_0x15de('0xc'),auth[_0x15de('0xa')](),controller[_0x15de('0xd')]);router[_0x15de('0x9')](_0x15de('0xe'),auth[_0x15de('0xa')](),controller[_0x15de('0xf')]);router['get'](_0x15de('0x10'),auth[_0x15de('0xa')](),controller[_0x15de('0x11')]);router[_0x15de('0x9')]('/:id/canned_answers',auth[_0x15de('0xa')](),controller['getAnswers']);router[_0x15de('0x9')]('/:id/in_servers',auth[_0x15de('0xa')](),controller[_0x15de('0x12')]);router['get'](_0x15de('0x13'),auth[_0x15de('0xa')](),controller[_0x15de('0x14')]);router[_0x15de('0x9')](_0x15de('0x15'),auth['isAuthenticated'](),controller[_0x15de('0x16')]);router[_0x15de('0x9')](_0x15de('0x17'),auth[_0x15de('0xa')](),controller[_0x15de('0x18')]);router['get'](_0x15de('0x19'),auth[_0x15de('0xa')](),controller[_0x15de('0x1a')]);router['get'](_0x15de('0x1b'),auth[_0x15de('0xa')](),controller['verifySmtp']);router[_0x15de('0x9')](_0x15de('0x1c'),auth[_0x15de('0xa')](),controller[_0x15de('0x1d')]);router['post'](_0x15de('0x10'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x15de('0x1e')](_0x15de('0x1f'),auth[_0x15de('0xa')](),controller['addAnswer']);router[_0x15de('0x1e')]('/',auth['isAuthenticated'](),controller[_0x15de('0x20')]);router['post']('/:id/in_servers',auth[_0x15de('0xa')](),controller[_0x15de('0x21')]);router[_0x15de('0x1e')](_0x15de('0x13'),auth['isAuthenticated'](),controller['addSmtp']);router[_0x15de('0x1e')]('/:id/interactions',auth[_0x15de('0xa')](),controller['addInteraction']);router[_0x15de('0x1e')](_0x15de('0x17'),auth[_0x15de('0xa')](),controller[_0x15de('0x22')]);router[_0x15de('0x1e')]('/:id/send',auth[_0x15de('0xa')](),controller['send']);router[_0x15de('0x1e')]('/:id/users',auth[_0x15de('0xa')](),controller[_0x15de('0x23')]);router['put']('/:id',auth[_0x15de('0xa')](),controller[_0x15de('0x24')]);router[_0x15de('0x25')]('/:id/dispositions',auth['isAuthenticated'](),controller['removeDispositions']);router['delete'](_0x15de('0x1f'),auth[_0x15de('0xa')](),controller[_0x15de('0x26')]);router[_0x15de('0x25')]('/:id/in_servers',auth['isAuthenticated'](),controller['removeImap']);router['delete']('/:id/out_servers',auth[_0x15de('0xa')](),controller[_0x15de('0x27')]);router[_0x15de('0x25')](_0x15de('0xe'),auth[_0x15de('0xa')](),controller['destroy']);router[_0x15de('0x25')](_0x15de('0x1c'),auth['isAuthenticated'](),controller[_0x15de('0x28')]);module[_0x15de('0x29')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index f32b1e8..8504efc 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 _0x9e07=['UNSIGNED','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','ENUM','gmail','hotmail','yahoo','outlook365','getDataValue','provider','custom','sequelize','STRING','BOOLEAN','TEXT','INTEGER'];(function(_0x1aa470,_0x5dd093){var _0x133ea8=function(_0x42d332){while(--_0x42d332){_0x1aa470['push'](_0x1aa470['shift']());}};_0x133ea8(++_0x5dd093);}(_0x9e07,0xc7));var _0x79e0=function(_0x31b45c,_0x2761e9){_0x31b45c=_0x31b45c-0x0;var _0x5e9414=_0x9e07[_0x31b45c];return _0x5e9414;};'use strict';var Sequelize=require(_0x79e0('0x0'));module['exports']={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x79e0('0x1')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x79e0('0x2')],'defaultValue':!![]},'key':{'type':Sequelize[_0x79e0('0x1')],'allowNull':![]},'template':{'type':Sequelize[_0x79e0('0x3')]},'markAsUnread':{'type':Sequelize[_0x79e0('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x79e0('0x1')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize[_0x79e0('0x4')](0x2)[_0x79e0('0x5')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x79e0('0x3')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}';}},'notificationSound':{'type':Sequelize[_0x79e0('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x79e0('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x79e0('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x79e0('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x79e0('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x79e0('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x79e0('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x79e0('0x4')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x79e0('0x2')],'defaultValue':![],'comment':_0x79e0('0x6'),'set':function(_0x4d269b){if(!_0x4d269b)this[_0x79e0('0x7')]('mandatoryDispositionPauseId',null);this[_0x79e0('0x7')](_0x79e0('0x8'),_0x4d269b);}},'provider':{'type':Sequelize[_0x79e0('0x9')](_0x79e0('0xa'),_0x79e0('0xb'),_0x79e0('0xc'),_0x79e0('0xd')),'defaultValue':null,'get':function(){var _0x2a5501=this[_0x79e0('0xe')](_0x79e0('0xf'));return _0x2a5501||'custom';},'set':function(_0x46cfe0){if(_0x46cfe0===_0x79e0('0x10')){_0x46cfe0=null;}return this[_0x79e0('0x7')](_0x79e0('0xf'),_0x46cfe0);}}}; \ No newline at end of file +var _0xe8d5=['BOOLEAN','TEXT','Arial,Helvetica,sans-serif','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','ENUM','gmail','hotmail','yahoo','provider','exports','STRING'];(function(_0x2b3317,_0x240680){var _0x22029c=function(_0x2792ae){while(--_0x2792ae){_0x2b3317['push'](_0x2b3317['shift']());}};_0x22029c(++_0x240680);}(_0xe8d5,0x163));var _0x5e8d=function(_0x45d3f0,_0x4be53f){_0x45d3f0=_0x45d3f0-0x0;var _0x314b79=_0xe8d5[_0x45d3f0];return _0x314b79;};'use strict';var Sequelize=require('sequelize');module[_0x5e8d('0x0')]={'description':{'type':Sequelize[_0x5e8d('0x1')]},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x5e8d('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x5e8d('0x2')],'defaultValue':!![]},'key':{'type':Sequelize[_0x5e8d('0x1')],'allowNull':![]},'template':{'type':Sequelize[_0x5e8d('0x3')]},'markAsUnread':{'type':Sequelize[_0x5e8d('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x5e8d('0x1')],'allowNull':![],'defaultValue':_0x5e8d('0x4')},'fontSize':{'type':Sequelize['INTEGER'](0x2)[_0x5e8d('0x5')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x5e8d('0x3')],'defaultValue':function(){return _0x5e8d('0x6');}},'notificationSound':{'type':Sequelize[_0x5e8d('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x5e8d('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x5e8d('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x5e8d('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x5e8d('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5e8d('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x5e8d('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x5e8d('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x5e8d('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0x5e8d('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x5e8d('0x2')],'defaultValue':![],'comment':_0x5e8d('0x9'),'set':function(_0x3cf8ae){if(!_0x3cf8ae)this[_0x5e8d('0xa')](_0x5e8d('0xb'),null);this[_0x5e8d('0xa')]('mandatoryDisposition',_0x3cf8ae);}},'provider':{'type':Sequelize[_0x5e8d('0xc')](_0x5e8d('0xd'),_0x5e8d('0xe'),_0x5e8d('0xf'),'outlook365'),'defaultValue':null,'get':function(){var _0xc9beac=this['getDataValue']('provider');return _0xc9beac||'custom';},'set':function(_0x3f2379){if(_0x3f2379==='custom'){_0x3f2379=null;}return this['setDataValue'](_0x5e8d('0x10'),_0x3f2379);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index d373520..6800d98 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 _0xb4d0=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','getSmtp','addSmtp','addInteraction','MailInteraction','omit','getInteractions','CmContact','User','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','priority','finally','MailApplication','getApplications','getMessages','MailMessage','$gte','split','format','inlineCss','true','List','Contacts','updatedAt','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','from','%s\x20<%s>','attachments','join','root','server/files/attachments','basename','getSmtpOptions','SendMail','List\x20not\x20found','messageId','subject','attach','out','YYYY-MM-DD\x20HH:mm:ss','Interaction','Messages','verifySmtp','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','userMailAccount:save','removeAgents','isArray','emit','getAgents','moment','bluebird','util','path','lodash','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','jayson/promise','http','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','update','get','destroy','stack','name','send','gmail','imap.gmail.com','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','yahoo','smtp.mail.yahoo.com','smtp-mail.outlook.com','smtp.office365.com','Unknown\x20email\x20service\x20provider','user','username','password','modernAuthentication','CloudProviderId','pass','host','port','secure','service','authentication','Imap','Smtp','index','MailServerIn','MailServerOut','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','type','options','MailAccount','includeAll','include','findAll','show','params','merge','find','body','provider','custom','Mail\x20Account\x20not\x20found','describe','addDisposition','MailAccountId','Disposition','getDispositions','findOne','rows','removeDispositions','ids','addAnswer','CannedAnswer','create','getAnswers','removeAnswers','email','ListId','isNil','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','MailAccounts','userProfileId','UserProfileResource'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb4d0,0x1d3));var _0x0b4d=function(_0x3e1bf2,_0x121002){_0x3e1bf2=_0x3e1bf2-0x0;var _0x1de65a=_0xb4d0[_0x3e1bf2];return _0x1de65a;};'use strict';var moment=require(_0x0b4d('0x0'));var BPromise=require(_0x0b4d('0x1'));var util=require(_0x0b4d('0x2'));var path=require(_0x0b4d('0x3'));var _=require(_0x0b4d('0x4'));var juice=require('juice');var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0x0b4d('0x5'))(_0x0b4d('0x6'));var config=require(_0x0b4d('0x7'));var db=require(_0x0b4d('0x8'))['db'];config[_0x0b4d('0x9')]=_[_0x0b4d('0xa')](config[_0x0b4d('0x9')],{'host':_0x0b4d('0xb'),'port':0x18eb});var socket=require(_0x0b4d('0xc'))(new Redis(config[_0x0b4d('0x9')]));require(_0x0b4d('0xd'))[_0x0b4d('0xe')](socket);var jayson=require(_0x0b4d('0xf'));var client=jayson['client'][_0x0b4d('0x10')]({'port':0x232b});function respondWithRpcPromise(_0x5d8dec,_0x5b63d4,_0x3a8ce7,_0xddbbff){return new BPromise(function(_0x164f54,_0x4de0f7){var _0x580b4f=_0xddbbff||client;return _0x580b4f[_0x0b4d('0x11')](_0x5d8dec,_0x3a8ce7)[_0x0b4d('0x12')](function(_0x1dd2ae){logger[_0x0b4d('0x13')](_0x0b4d('0x14'),_0x5b63d4,_0x0b4d('0x15'));logger['debug'](_0x0b4d('0x16'),_0x5b63d4,_0x0b4d('0x15'),JSON[_0x0b4d('0x17')](_0x1dd2ae));if(_0x1dd2ae['error']){if(_0x1dd2ae[_0x0b4d('0x18')]['code']===0x1f4){logger[_0x0b4d('0x18')]('MailAccount,\x20%s,\x20%s',_0x5b63d4,_0x1dd2ae[_0x0b4d('0x18')][_0x0b4d('0x19')]);return _0x4de0f7(_0x1dd2ae[_0x0b4d('0x18')]['message']);}logger[_0x0b4d('0x18')](_0x0b4d('0x14'),_0x5b63d4,_0x1dd2ae[_0x0b4d('0x18')][_0x0b4d('0x19')]);return _0x164f54(_0x1dd2ae[_0x0b4d('0x18')][_0x0b4d('0x19')]);}else{logger['info'](_0x0b4d('0x14'),_0x5b63d4,_0x0b4d('0x15'));_0x164f54(_0x1dd2ae['result'][_0x0b4d('0x19')]);}})[_0x0b4d('0x1a')](function(_0x5f1277){logger[_0x0b4d('0x18')](_0x0b4d('0x14'),_0x5b63d4,_0x5f1277);_0x4de0f7(_0x5f1277);});});}function respondWithStatusCode(_0x30aa23,_0xc0451e){_0xc0451e=_0xc0451e||0xcc;return function(_0x3b0f1a){if(_0x3b0f1a){return _0x30aa23[_0x0b4d('0x1b')](_0xc0451e);}return _0x30aa23[_0x0b4d('0x1c')](_0xc0451e)[_0x0b4d('0x1d')]();};}function respondWithResult(_0x3a8f75,_0xad6dac){_0xad6dac=_0xad6dac||0xc8;return function(_0x434858){if(_0x434858){return _0x3a8f75['status'](_0xad6dac)['json'](_0x434858);}};}function respondWithFilteredResult(_0x1ecd28,_0x2aa303){return function(_0x19a007){if(_0x19a007){var _0x4acf08=typeof _0x2aa303[_0x0b4d('0x1e')]===_0x0b4d('0x1f')&&typeof _0x2aa303[_0x0b4d('0x20')]===_0x0b4d('0x1f');var _0x18bb37=_0x19a007[_0x0b4d('0x21')];var _0x339614=_0x4acf08?0x0:_0x2aa303[_0x0b4d('0x1e')];var _0x5cc354=_0x4acf08?_0x19a007[_0x0b4d('0x21')]:_0x2aa303[_0x0b4d('0x1e')]+_0x2aa303['limit'];var _0x48c975;if(_0x5cc354>=_0x18bb37){_0x5cc354=_0x18bb37;_0x48c975=0xc8;}else{_0x48c975=0xce;}_0x1ecd28['status'](_0x48c975);return _0x1ecd28[_0x0b4d('0x22')](_0x0b4d('0x23'),_0x339614+'-'+_0x5cc354+'/'+_0x18bb37)[_0x0b4d('0x24')](_0x19a007);}return null;};}function saveUpdates(_0x24f430){return function(_0x3d9bff){if(_0x3d9bff){return _0x3d9bff[_0x0b4d('0x25')](_0x24f430)['then'](function(_0x36116e){return _0x36116e;});}return null;};}function removeEntity(_0x2c6a73){return function(_0x32497b){if(_0x32497b){return _0x32497b['destroy']()[_0x0b4d('0x12')](function(){var _0xaf0f9=_0x32497b[_0x0b4d('0x26')]({'plain':!![]});var _0x42a857='MailAccounts';return db['UserProfileResource'][_0x0b4d('0x27')]({'where':{'type':_0x42a857,'resourceId':_0xaf0f9['id']}})[_0x0b4d('0x12')](function(){return _0x32497b;});})[_0x0b4d('0x12')](function(){_0x2c6a73['status'](0xcc)[_0x0b4d('0x1d')]();});}};}function handleEntityNotFound(_0x261e99){return function(_0x5678a8){if(!_0x5678a8){_0x261e99['sendStatus'](0x194);}return _0x5678a8;};}function handleError(_0xefa829,_0x3ecdb9){_0x3ecdb9=_0x3ecdb9||0x1f4;return function(_0x5ab5d3){logger[_0x0b4d('0x18')](_0x5ab5d3[_0x0b4d('0x28')]);if(_0x5ab5d3['name']){delete _0x5ab5d3[_0x0b4d('0x29')];}_0xefa829[_0x0b4d('0x1c')](_0x3ecdb9)[_0x0b4d('0x2a')](_0x5ab5d3);};}function getImapHost(_0x29721c){switch(_0x29721c){case _0x0b4d('0x2b'):return _0x0b4d('0x2c');case'yahoo':return _0x0b4d('0x2d');case _0x0b4d('0x2e'):return _0x0b4d('0x2f');case _0x0b4d('0x30'):return _0x0b4d('0x31');}throw new Error('Unknown\x20email\x20service\x20provider',_0x29721c);}function getSmtpHost(_0x3405ba){switch(_0x3405ba){case _0x0b4d('0x2b'):return'smtp.gmail.com';case _0x0b4d('0x32'):return _0x0b4d('0x33');case'hotmail':return _0x0b4d('0x34');case'outlook365':return _0x0b4d('0x35');}throw new Error(_0x0b4d('0x36'),_0x3405ba);}function getAuthenticationOptions(_0x145d7f,_0x5b716b){var _0xe9f935={};var _0x2f5d0c={};if(_0x145d7f){_0xe9f935[_0x0b4d('0x37')]=_0x2f5d0c['user']=_0x5b716b[_0x0b4d('0x38')];_0xe9f935[_0x0b4d('0x39')]=_0x2f5d0c['pass']=_0x5b716b[_0x0b4d('0x39')];if(_0x5b716b[_0x0b4d('0x3a')]){_0xe9f935[_0x0b4d('0x3a')]=_0x2f5d0c[_0x0b4d('0x3a')]=!![];_0xe9f935[_0x0b4d('0x3b')]=_0x2f5d0c[_0x0b4d('0x3b')]=_0x5b716b[_0x0b4d('0x3b')];_0xe9f935[_0x0b4d('0x39')]=_0x2f5d0c[_0x0b4d('0x3c')]=null;}else{_0xe9f935['CloudProviderId']=_0x2f5d0c[_0x0b4d('0x3b')]=null;}_0xe9f935[_0x0b4d('0x3d')]=getImapHost(_0x145d7f);_0xe9f935['port']=0x3e1;_0x2f5d0c[_0x0b4d('0x3d')]=getSmtpHost(_0x145d7f);_0x2f5d0c[_0x0b4d('0x3e')]=0x24b;_0x2f5d0c[_0x0b4d('0x3f')]=![];_0xe9f935[_0x0b4d('0x40')]=_0x2f5d0c[_0x0b4d('0x40')]=null;}else{if(_0x5b716b['authentication']){_0xe9f935['user']=_0x2f5d0c[_0x0b4d('0x37')]=_0x5b716b['username'];_0xe9f935[_0x0b4d('0x39')]=_0x2f5d0c[_0x0b4d('0x3c')]=_0x5b716b[_0x0b4d('0x39')];}else{_0xe9f935[_0x0b4d('0x41')]=_0x2f5d0c['authentication']=![];_0xe9f935[_0x0b4d('0x37')]=_0x2f5d0c['user']=null;_0xe9f935[_0x0b4d('0x39')]=_0x2f5d0c[_0x0b4d('0x3c')]=null;}_0xe9f935[_0x0b4d('0x3d')]=_0x5b716b[_0x0b4d('0x42')][_0x0b4d('0x3d')];_0xe9f935['port']=_0x5b716b[_0x0b4d('0x42')][_0x0b4d('0x3e')];_0x2f5d0c['host']=_0x5b716b[_0x0b4d('0x43')][_0x0b4d('0x3d')];_0x2f5d0c['port']=_0x5b716b[_0x0b4d('0x43')]['port'];}return{'Imap':_0xe9f935,'Smtp':_0x2f5d0c};}exports[_0x0b4d('0x44')]=function(_0x369633,_0x14078e){var _0x45287a={'include':[{'model':db[_0x0b4d('0x45')],'as':'Imap'},{'model':db[_0x0b4d('0x46')],'as':_0x0b4d('0x43')},{'model':db[_0x0b4d('0x47')],'as':_0x0b4d('0x48')}]},_0x3596ff={},_0x4c7432={'count':0x0,'rows':[]};var _0x1eaa65=_[_0x0b4d('0x49')](db['MailAccount'][_0x0b4d('0x4a')],function(_0x6fb162){return{'name':_0x6fb162[_0x0b4d('0x4b')],'type':_0x6fb162['type'][_0x0b4d('0x4c')]};});_0x3596ff[_0x0b4d('0x4d')]=_[_0x0b4d('0x49')](_0x1eaa65,_0x0b4d('0x29'));_0x3596ff[_0x0b4d('0x4e')]=_[_0x0b4d('0x4f')](_0x369633['query']);_0x3596ff[_0x0b4d('0x50')]=_[_0x0b4d('0x51')](_0x3596ff[_0x0b4d('0x4d')],_0x3596ff[_0x0b4d('0x4e')]);_0x45287a[_0x0b4d('0x52')]=_['intersection'](_0x3596ff['model'],qs[_0x0b4d('0x53')](_0x369633[_0x0b4d('0x4e')][_0x0b4d('0x53')]));_0x45287a['attributes']=_0x45287a['attributes'][_0x0b4d('0x54')]?_0x45287a[_0x0b4d('0x52')]:_0x3596ff['model'];if(!_0x369633['query'][_0x0b4d('0x55')](_0x0b4d('0x56'))){_0x45287a['limit']=qs['limit'](_0x369633['query'][_0x0b4d('0x20')]);_0x45287a[_0x0b4d('0x1e')]=qs[_0x0b4d('0x1e')](_0x369633[_0x0b4d('0x4e')]['offset']);}_0x45287a[_0x0b4d('0x57')]=qs[_0x0b4d('0x58')](_0x369633[_0x0b4d('0x4e')][_0x0b4d('0x58')]);_0x45287a['where']=qs[_0x0b4d('0x50')](_[_0x0b4d('0x59')](_0x369633[_0x0b4d('0x4e')],_0x3596ff[_0x0b4d('0x50')]),_0x1eaa65);if(_0x369633[_0x0b4d('0x4e')][_0x0b4d('0x5a')]){_0x45287a['where']=_['merge'](_0x45287a[_0x0b4d('0x5b')],{'$or':_[_0x0b4d('0x49')](_0x1eaa65,function(_0x55b5f1){if(_0x55b5f1[_0x0b4d('0x5c')]!=='VIRTUAL'){var _0x4231f9={};_0x4231f9[_0x55b5f1['name']]={'$like':'%'+_0x369633[_0x0b4d('0x4e')]['filter']+'%'};return _0x4231f9;}})});}_0x45287a=_['merge']({},_0x45287a,_0x369633[_0x0b4d('0x5d')]);var _0x3e2698={'where':_0x45287a['where']};return db[_0x0b4d('0x5e')][_0x0b4d('0x21')](_0x3e2698)['then'](function(_0xb0d8ae){_0x4c7432[_0x0b4d('0x21')]=_0xb0d8ae;if(_0x369633[_0x0b4d('0x4e')][_0x0b4d('0x5f')]){_0x45287a[_0x0b4d('0x60')]=[{'all':!![]}];}return db[_0x0b4d('0x5e')][_0x0b4d('0x61')](_0x45287a);})['then'](function(_0x18d5db){_0x4c7432['rows']=_0x18d5db;return _0x4c7432;})[_0x0b4d('0x12')](respondWithFilteredResult(_0x14078e,_0x45287a))['catch'](handleError(_0x14078e,null));};exports[_0x0b4d('0x62')]=function(_0x5339c1,_0x402fde){var _0x5e858b={'raw':![],'where':{'id':_0x5339c1[_0x0b4d('0x63')]['id']},'include':[{'model':db[_0x0b4d('0x45')],'as':_0x0b4d('0x42')},{'model':db[_0x0b4d('0x46')],'as':_0x0b4d('0x43')},{'model':db[_0x0b4d('0x47')],'as':_0x0b4d('0x48')}]},_0x5652ba={};_0x5652ba[_0x0b4d('0x4d')]=_['keys'](db[_0x0b4d('0x5e')][_0x0b4d('0x4a')]);_0x5652ba[_0x0b4d('0x4e')]=_[_0x0b4d('0x4f')](_0x5339c1[_0x0b4d('0x4e')]);_0x5652ba[_0x0b4d('0x50')]=_[_0x0b4d('0x51')](_0x5652ba['model'],_0x5652ba['query']);_0x5e858b['attributes']=_[_0x0b4d('0x51')](_0x5652ba[_0x0b4d('0x4d')],qs['fields'](_0x5339c1[_0x0b4d('0x4e')][_0x0b4d('0x53')]));_0x5e858b[_0x0b4d('0x52')]=_0x5e858b[_0x0b4d('0x52')][_0x0b4d('0x54')]?_0x5e858b[_0x0b4d('0x52')]:_0x5652ba[_0x0b4d('0x4d')];if(_0x5339c1['query'][_0x0b4d('0x5f')]){_0x5e858b['include']=[{'all':!![]}];}_0x5e858b=_[_0x0b4d('0x64')]({},_0x5e858b,_0x5339c1[_0x0b4d('0x5d')]);return db['MailAccount'][_0x0b4d('0x65')](_0x5e858b)[_0x0b4d('0x12')](handleEntityNotFound(_0x402fde,null))[_0x0b4d('0x12')](respondWithResult(_0x402fde,null))['catch'](handleError(_0x402fde,null));};exports['update']=function(_0x10f9b6,_0x594d33){if(_0x10f9b6[_0x0b4d('0x66')]['id']){delete _0x10f9b6[_0x0b4d('0x66')]['id'];}var _0x44fc8e=_0x10f9b6[_0x0b4d('0x66')][_0x0b4d('0x67')]===_0x0b4d('0x68')?null:_0x10f9b6[_0x0b4d('0x66')]['provider'];var _0x2d37da=_0x10f9b6[_0x0b4d('0x66')]['Imap']||{};var _0x512ede=_0x10f9b6[_0x0b4d('0x66')]['Smtp']||{};if(_0x44fc8e){_0x2d37da[_0x0b4d('0x3d')]=getImapHost(_0x44fc8e);_0x2d37da[_0x0b4d('0x3e')]=0x3e1;_0x512ede['host']=getSmtpHost(_0x44fc8e);_0x512ede[_0x0b4d('0x3e')]=0x24b;_0x512ede[_0x0b4d('0x3f')]=![];}if(_0x512ede['modernAuthentication']){_0x512ede[_0x0b4d('0x3f')]=![];}else{_0x512ede[_0x0b4d('0x3b')]=null;}if(!_0x2d37da[_0x0b4d('0x3a')])_0x2d37da['CloudProviderId']=null;_0x10f9b6['body']['Imap']=_0x2d37da;_0x10f9b6[_0x0b4d('0x66')]['Smtp']=_0x512ede;return db[_0x0b4d('0x5e')]['find']({'where':{'id':_0x10f9b6[_0x0b4d('0x63')]['id']},'include':[{'model':db['MailServerIn'],'as':'Imap'},{'model':db[_0x0b4d('0x46')],'as':_0x0b4d('0x43')},{'model':db[_0x0b4d('0x47')],'as':_0x0b4d('0x48')}]})[_0x0b4d('0x12')](handleEntityNotFound(_0x594d33,null))[_0x0b4d('0x12')](function(_0x36b5b4){if(!_0x36b5b4)throw new Error(_0x0b4d('0x69'));if(_0x36b5b4['service'])delete _0x10f9b6[_0x0b4d('0x66')]['Imap'];return _0x36b5b4;})['then'](saveUpdates(_0x10f9b6['body'],null))['then'](function(_0x2eb855){if(!_0x10f9b6['body'][_0x0b4d('0x42')])return _0x2eb855;return db[_0x0b4d('0x45')][_0x0b4d('0x25')](_0x10f9b6['body']['Imap'],{'where':{'MailAccountId':_0x2eb855['id']}})[_0x0b4d('0x12')](function(){return _0x2eb855;});})['then'](function(_0x2f2779){if(!_0x10f9b6['body'][_0x0b4d('0x43')])return _0x2f2779;return db[_0x0b4d('0x46')][_0x0b4d('0x25')](_0x10f9b6[_0x0b4d('0x66')]['Smtp'],{'where':{'MailAccountId':_0x2f2779['id']}})[_0x0b4d('0x12')](function(){return _0x2f2779;});})[_0x0b4d('0x12')](respondWithResult(_0x594d33,null))[_0x0b4d('0x1a')](handleError(_0x594d33,null));};exports[_0x0b4d('0x6a')]=function(_0x59b5a7,_0x1f6bf1){return db[_0x0b4d('0x5e')]['describe']()[_0x0b4d('0x12')](respondWithResult(_0x1f6bf1,null))[_0x0b4d('0x1a')](handleError(_0x1f6bf1,null));};exports[_0x0b4d('0x6b')]=function(_0x2b21c2,_0x23dd3d){if(_0x2b21c2[_0x0b4d('0x66')]['id']){delete _0x2b21c2[_0x0b4d('0x66')]['id'];}return db[_0x0b4d('0x5e')][_0x0b4d('0x65')]({'where':{'id':_0x2b21c2[_0x0b4d('0x63')]['id']}})[_0x0b4d('0x12')](handleEntityNotFound(_0x23dd3d,null))['then'](function(_0x407324){if(_0x407324){_0x2b21c2[_0x0b4d('0x66')][_0x0b4d('0x6c')]=_0x407324['id'];return db[_0x0b4d('0x6d')]['create'](_0x2b21c2[_0x0b4d('0x66')]);}})['then'](respondWithResult(_0x23dd3d,null))['catch'](handleError(_0x23dd3d,null));};exports[_0x0b4d('0x6e')]=function(_0x523396,_0x2c4bf5){var _0x4259a7={'raw':![],'where':{}};var _0x5ccdfa={};var _0x527679={'count':0x0,'rows':[]};return db['MailAccount'][_0x0b4d('0x6f')]({'where':{'id':_0x523396[_0x0b4d('0x63')]['id']}})[_0x0b4d('0x12')](handleEntityNotFound(_0x2c4bf5,null))['then'](function(_0x267d10){if(_0x267d10){_0x5ccdfa[_0x0b4d('0x4d')]=_[_0x0b4d('0x4f')](db[_0x0b4d('0x6d')]['rawAttributes']);_0x5ccdfa[_0x0b4d('0x4e')]=_[_0x0b4d('0x4f')](_0x523396[_0x0b4d('0x4e')]);_0x5ccdfa[_0x0b4d('0x50')]=_[_0x0b4d('0x51')](_0x5ccdfa[_0x0b4d('0x4d')],_0x5ccdfa[_0x0b4d('0x4e')]);_0x4259a7[_0x0b4d('0x52')]=_[_0x0b4d('0x51')](_0x5ccdfa[_0x0b4d('0x4d')],qs[_0x0b4d('0x53')](_0x523396[_0x0b4d('0x4e')]['fields']));_0x4259a7[_0x0b4d('0x52')]=_0x4259a7[_0x0b4d('0x52')]['length']?_0x4259a7[_0x0b4d('0x52')]:_0x5ccdfa[_0x0b4d('0x4d')];if(!_0x523396[_0x0b4d('0x4e')][_0x0b4d('0x55')](_0x0b4d('0x56'))){_0x4259a7['limit']=qs['limit'](_0x523396[_0x0b4d('0x4e')][_0x0b4d('0x20')]);_0x4259a7['offset']=qs[_0x0b4d('0x1e')](_0x523396[_0x0b4d('0x4e')][_0x0b4d('0x1e')]);}_0x4259a7[_0x0b4d('0x57')]=qs['sort'](_0x523396[_0x0b4d('0x4e')][_0x0b4d('0x58')]);_0x4259a7[_0x0b4d('0x5b')]=qs['filters'](_[_0x0b4d('0x59')](_0x523396['query'],_0x5ccdfa[_0x0b4d('0x50')]));_0x4259a7['where'][_0x0b4d('0x6c')]=_0x267d10['id'];if(_0x523396[_0x0b4d('0x4e')][_0x0b4d('0x5a')]){_0x4259a7[_0x0b4d('0x5b')]=_['merge'](_0x4259a7[_0x0b4d('0x5b')],{'$or':_[_0x0b4d('0x49')](_0x4259a7[_0x0b4d('0x52')],function(_0x4d2926){var _0x31bbc6={};_0x31bbc6[_0x4d2926]={'$like':'%'+_0x523396[_0x0b4d('0x4e')][_0x0b4d('0x5a')]+'%'};return _0x31bbc6;})});}_0x4259a7=_[_0x0b4d('0x64')]({},_0x4259a7,_0x523396['options']);return db['Disposition'][_0x0b4d('0x21')]({'where':_0x4259a7[_0x0b4d('0x5b')]})[_0x0b4d('0x12')](function(_0x12d5dc){_0x527679[_0x0b4d('0x21')]=_0x12d5dc;if(_0x523396[_0x0b4d('0x4e')]['includeAll']){_0x4259a7[_0x0b4d('0x60')]=[{'all':!![]}];}return db[_0x0b4d('0x6d')]['findAll'](_0x4259a7);})['then'](function(_0x5267f7){_0x527679[_0x0b4d('0x70')]=_0x5267f7;return _0x527679;});}})['then'](respondWithFilteredResult(_0x2c4bf5,_0x4259a7))[_0x0b4d('0x1a')](handleError(_0x2c4bf5,null));};exports['removeDispositions']=function(_0x5d6df8,_0x3cb4dc){return db[_0x0b4d('0x5e')][_0x0b4d('0x65')]({'where':{'id':_0x5d6df8[_0x0b4d('0x63')]['id']}})[_0x0b4d('0x12')](handleEntityNotFound(_0x3cb4dc,null))['then'](function(_0x9d3d9e){if(_0x9d3d9e){return _0x9d3d9e[_0x0b4d('0x71')](_0x5d6df8[_0x0b4d('0x4e')][_0x0b4d('0x72')]);}})[_0x0b4d('0x12')](respondWithStatusCode(_0x3cb4dc,null))['catch'](handleError(_0x3cb4dc,null));};exports[_0x0b4d('0x73')]=function(_0x1ba70a,_0x5e0067){if(_0x1ba70a[_0x0b4d('0x66')]['id']){delete _0x1ba70a[_0x0b4d('0x66')]['id'];}return db[_0x0b4d('0x5e')]['find']({'where':{'id':_0x1ba70a['params']['id']}})[_0x0b4d('0x12')](handleEntityNotFound(_0x5e0067,null))[_0x0b4d('0x12')](function(_0x4823f8){if(_0x4823f8){_0x1ba70a[_0x0b4d('0x66')][_0x0b4d('0x6c')]=_0x4823f8['id'];return db[_0x0b4d('0x74')][_0x0b4d('0x75')](_0x1ba70a['body']);}})['then'](respondWithResult(_0x5e0067,null))[_0x0b4d('0x1a')](handleError(_0x5e0067,null));};exports[_0x0b4d('0x76')]=function(_0x4dfb12,_0xe5b8c0){var _0x1b9616={'raw':![],'where':{}};var _0x3c9add={};var _0x4d76f3={'count':0x0,'rows':[]};return db[_0x0b4d('0x5e')]['findOne']({'where':{'id':_0x4dfb12[_0x0b4d('0x63')]['id']}})['then'](handleEntityNotFound(_0xe5b8c0,null))[_0x0b4d('0x12')](function(_0x388216){if(_0x388216){_0x3c9add[_0x0b4d('0x4d')]=_[_0x0b4d('0x4f')](db[_0x0b4d('0x74')]['rawAttributes']);_0x3c9add[_0x0b4d('0x4e')]=_[_0x0b4d('0x4f')](_0x4dfb12[_0x0b4d('0x4e')]);_0x3c9add[_0x0b4d('0x50')]=_['intersection'](_0x3c9add[_0x0b4d('0x4d')],_0x3c9add[_0x0b4d('0x4e')]);_0x1b9616[_0x0b4d('0x52')]=_[_0x0b4d('0x51')](_0x3c9add[_0x0b4d('0x4d')],qs[_0x0b4d('0x53')](_0x4dfb12[_0x0b4d('0x4e')]['fields']));_0x1b9616[_0x0b4d('0x52')]=_0x1b9616[_0x0b4d('0x52')][_0x0b4d('0x54')]?_0x1b9616['attributes']:_0x3c9add[_0x0b4d('0x4d')];if(!_0x4dfb12['query'][_0x0b4d('0x55')](_0x0b4d('0x56'))){_0x1b9616[_0x0b4d('0x20')]=qs['limit'](_0x4dfb12[_0x0b4d('0x4e')][_0x0b4d('0x20')]);_0x1b9616[_0x0b4d('0x1e')]=qs['offset'](_0x4dfb12[_0x0b4d('0x4e')]['offset']);}_0x1b9616[_0x0b4d('0x57')]=qs[_0x0b4d('0x58')](_0x4dfb12['query'][_0x0b4d('0x58')]);_0x1b9616[_0x0b4d('0x5b')]=qs[_0x0b4d('0x50')](_[_0x0b4d('0x59')](_0x4dfb12[_0x0b4d('0x4e')],_0x3c9add[_0x0b4d('0x50')]));_0x1b9616[_0x0b4d('0x5b')][_0x0b4d('0x6c')]=_0x388216['id'];if(_0x4dfb12[_0x0b4d('0x4e')][_0x0b4d('0x5a')]){_0x1b9616[_0x0b4d('0x5b')]=_[_0x0b4d('0x64')](_0x1b9616[_0x0b4d('0x5b')],{'$or':_[_0x0b4d('0x49')](_0x1b9616['attributes'],function(_0x2c865d){var _0x430446={};_0x430446[_0x2c865d]={'$like':'%'+_0x4dfb12[_0x0b4d('0x4e')][_0x0b4d('0x5a')]+'%'};return _0x430446;})});}_0x1b9616=_[_0x0b4d('0x64')]({},_0x1b9616,_0x4dfb12[_0x0b4d('0x5d')]);return db[_0x0b4d('0x74')][_0x0b4d('0x21')]({'where':_0x1b9616[_0x0b4d('0x5b')]})[_0x0b4d('0x12')](function(_0x2f8ff7){_0x4d76f3['count']=_0x2f8ff7;if(_0x4dfb12['query'][_0x0b4d('0x5f')]){_0x1b9616['include']=[{'all':!![]}];}return db[_0x0b4d('0x74')]['findAll'](_0x1b9616);})[_0x0b4d('0x12')](function(_0x1efd98){_0x4d76f3[_0x0b4d('0x70')]=_0x1efd98;return _0x4d76f3;});}})[_0x0b4d('0x12')](respondWithFilteredResult(_0xe5b8c0,_0x1b9616))[_0x0b4d('0x1a')](handleError(_0xe5b8c0,null));};exports[_0x0b4d('0x77')]=function(_0x134ed7,_0xdda9ae){return db[_0x0b4d('0x5e')]['find']({'where':{'id':_0x134ed7[_0x0b4d('0x63')]['id']}})[_0x0b4d('0x12')](handleEntityNotFound(_0xdda9ae,null))[_0x0b4d('0x12')](function(_0x11b338){if(_0x11b338){return _0x11b338['removeAnswers'](_0x134ed7[_0x0b4d('0x4e')]['ids']);}})[_0x0b4d('0x12')](respondWithStatusCode(_0xdda9ae,null))['catch'](handleError(_0xdda9ae,null));};exports[_0x0b4d('0x75')]=function(_0x593fbc,_0x59a100){var _0x25a289={'name':_0x593fbc[_0x0b4d('0x66')][_0x0b4d('0x29')],'key':_0x593fbc[_0x0b4d('0x66')][_0x0b4d('0x4c')],'provider':_0x593fbc[_0x0b4d('0x66')]['provider']===_0x0b4d('0x68')?null:_0x593fbc[_0x0b4d('0x66')][_0x0b4d('0x67')],'email':_0x593fbc[_0x0b4d('0x66')][_0x0b4d('0x78')],'ListId':_0x593fbc[_0x0b4d('0x66')][_0x0b4d('0x79')],'active':!_[_0x0b4d('0x7a')](_0x593fbc[_0x0b4d('0x66')][_0x0b4d('0x7b')])?_0x593fbc[_0x0b4d('0x66')]['active']:!![],'description':_0x593fbc[_0x0b4d('0x66')][_0x0b4d('0x7c')]||null};var _0x99a148=getAuthenticationOptions(_0x25a289[_0x0b4d('0x67')],_0x593fbc[_0x0b4d('0x66')]);_0x25a289['Imap']=_0x99a148[_0x0b4d('0x42')];_0x25a289['Smtp']=_0x99a148['Smtp'];return db[_0x0b4d('0x5e')]['create'](_0x25a289,{'include':[{'model':db[_0x0b4d('0x46')],'as':_0x0b4d('0x43')},{'model':db[_0x0b4d('0x45')],'as':_0x0b4d('0x42')}]})[_0x0b4d('0x12')](function(_0x3988e5){var _0x28af5c=_0x593fbc[_0x0b4d('0x37')][_0x0b4d('0x26')]({'plain':!![]});if(!_0x28af5c)throw new Error(_0x0b4d('0x7d'));if(_0x28af5c[_0x0b4d('0x7e')]===_0x0b4d('0x37')){var _0x5c75e9=_0x3988e5[_0x0b4d('0x26')]({'plain':!![]});return db['UserProfileSection'][_0x0b4d('0x65')]({'where':{'name':_0x0b4d('0x7f'),'userProfileId':_0x28af5c[_0x0b4d('0x80')]},'raw':!![]})[_0x0b4d('0x12')](function(_0x56cc41){if(_0x56cc41&&_0x56cc41['autoAssociation']===0x0){return db[_0x0b4d('0x81')]['create']({'name':_0x5c75e9[_0x0b4d('0x29')],'resourceId':_0x5c75e9['id'],'type':_0x56cc41['name'],'sectionId':_0x56cc41['id']},{})[_0x0b4d('0x12')](function(){return _0x3988e5;});}else{return _0x3988e5;}})['catch'](function(_0x550fcb){logger[_0x0b4d('0x18')](_0x0b4d('0x82'),_0x550fcb);throw _0x550fcb;});}return _0x3988e5;})[_0x0b4d('0x12')](respondWithResult(_0x59a100,0xc9))[_0x0b4d('0x1a')](handleError(_0x59a100,null));};exports[_0x0b4d('0x83')]=function(_0x4c34ab,_0x321aae){return db[_0x0b4d('0x5e')][_0x0b4d('0x6f')]({'where':{'id':_0x4c34ab[_0x0b4d('0x63')]['id']}})[_0x0b4d('0x12')](handleEntityNotFound(_0x321aae,null))[_0x0b4d('0x12')](function(_0x3e1c94){if(_0x3e1c94){return _0x3e1c94['getImap']();}return null;})[_0x0b4d('0x12')](respondWithResult(_0x321aae,null))[_0x0b4d('0x1a')](handleError(_0x321aae,null));};exports[_0x0b4d('0x84')]=function(_0x2b0196,_0x2e2698){if(_0x2b0196[_0x0b4d('0x66')]['id']){delete _0x2b0196['body']['id'];}return db[_0x0b4d('0x5e')]['find']({'where':{'id':_0x2b0196['params']['id']}})[_0x0b4d('0x12')](handleEntityNotFound(_0x2e2698,null))['then'](function(_0x292ecf){if(_0x292ecf){_0x2b0196[_0x0b4d('0x66')][_0x0b4d('0x6c')]=_0x292ecf['id'];return db[_0x0b4d('0x45')][_0x0b4d('0x75')](_0x2b0196[_0x0b4d('0x66')]);}})[_0x0b4d('0x12')](respondWithResult(_0x2e2698,null))[_0x0b4d('0x1a')](handleError(_0x2e2698,null));};exports['removeImap']=function(_0x6e3cbb,_0xf4fb6c){return db[_0x0b4d('0x5e')][_0x0b4d('0x6f')]({'where':{'id':_0x6e3cbb[_0x0b4d('0x63')]['id']}})[_0x0b4d('0x12')](handleEntityNotFound(_0xf4fb6c,null))[_0x0b4d('0x12')](function(_0x268ce0){if(_0x268ce0){return _0x268ce0['setImap'](null);}return null;})['then'](respondWithStatusCode(_0xf4fb6c,null))['catch'](handleError(_0xf4fb6c,null));};exports[_0x0b4d('0x85')]=function(_0x29a4b5,_0xe95981){return db[_0x0b4d('0x5e')][_0x0b4d('0x6f')]({'where':{'id':_0x29a4b5['params']['id']}})[_0x0b4d('0x12')](handleEntityNotFound(_0xe95981,null))[_0x0b4d('0x12')](function(_0x3e4052){if(_0x3e4052){return _0x3e4052[_0x0b4d('0x85')]();}return null;})[_0x0b4d('0x12')](respondWithResult(_0xe95981,null))[_0x0b4d('0x1a')](handleError(_0xe95981,null));};exports[_0x0b4d('0x86')]=function(_0x3ca7b7,_0x1f3c82){if(_0x3ca7b7['body']['id']){delete _0x3ca7b7[_0x0b4d('0x66')]['id'];}return db[_0x0b4d('0x5e')][_0x0b4d('0x65')]({'where':{'id':_0x3ca7b7[_0x0b4d('0x63')]['id']}})['then'](handleEntityNotFound(_0x1f3c82,null))['then'](function(_0x5d6940){if(_0x5d6940){_0x3ca7b7[_0x0b4d('0x66')][_0x0b4d('0x6c')]=_0x5d6940['id'];return db['MailServerOut'][_0x0b4d('0x75')](_0x3ca7b7[_0x0b4d('0x66')]);}})[_0x0b4d('0x12')](respondWithResult(_0x1f3c82,null))['catch'](handleError(_0x1f3c82,null));};exports['removeSmtp']=function(_0xf3d7d1,_0x933de8){return db[_0x0b4d('0x5e')]['findOne']({'where':{'id':_0xf3d7d1[_0x0b4d('0x63')]['id']}})[_0x0b4d('0x12')](handleEntityNotFound(_0x933de8,null))['then'](function(_0x29def4){if(_0x29def4){return _0x29def4['setSmtp'](null);}return null;})[_0x0b4d('0x12')](respondWithStatusCode(_0x933de8,null))[_0x0b4d('0x1a')](handleError(_0x933de8,null));};exports[_0x0b4d('0x87')]=function(_0x2fff47,_0x3bcc58){return db[_0x0b4d('0x88')][_0x0b4d('0x65')]({'where':{'id':_0x2fff47['params']['id']}})['then'](handleEntityNotFound(_0x3bcc58,null))[_0x0b4d('0x12')](function(_0x58ba56){if(_0x58ba56){return _0x58ba56[_0x0b4d('0x87')](_0x2fff47[_0x0b4d('0x66')][_0x0b4d('0x72')],_[_0x0b4d('0x89')](_0x2fff47[_0x0b4d('0x66')],[_0x0b4d('0x72'),'id'])||{});}})[_0x0b4d('0x12')](respondWithResult(_0x3bcc58,null))['catch'](handleError(_0x3bcc58,null));};exports[_0x0b4d('0x8a')]=function(_0x4cdc46,_0x445d4a){var _0x34d452={'raw':![],'where':{}};var _0x2f6252={};var _0x177e45={'count':0x0,'rows':[]};return db[_0x0b4d('0x5e')][_0x0b4d('0x6f')]({'where':{'id':_0x4cdc46[_0x0b4d('0x63')]['id']}})[_0x0b4d('0x12')](handleEntityNotFound(_0x445d4a,null))[_0x0b4d('0x12')](function(_0x180af9){if(_0x180af9){_0x2f6252[_0x0b4d('0x4d')]=_[_0x0b4d('0x4f')](db['MailInteraction'][_0x0b4d('0x4a')]);_0x2f6252[_0x0b4d('0x4e')]=_[_0x0b4d('0x4f')](_0x4cdc46['query']);_0x2f6252['filters']=_['intersection'](_0x2f6252[_0x0b4d('0x4d')],_0x2f6252[_0x0b4d('0x4e')]);_0x34d452[_0x0b4d('0x52')]=_[_0x0b4d('0x51')](_0x2f6252[_0x0b4d('0x4d')],qs[_0x0b4d('0x53')](_0x4cdc46[_0x0b4d('0x4e')]['fields']));_0x34d452[_0x0b4d('0x52')]=_0x34d452['attributes'][_0x0b4d('0x54')]?_0x34d452[_0x0b4d('0x52')]:_0x2f6252[_0x0b4d('0x4d')];if(!_0x4cdc46['query']['hasOwnProperty'](_0x0b4d('0x56'))){_0x34d452['limit']=qs[_0x0b4d('0x20')](_0x4cdc46[_0x0b4d('0x4e')][_0x0b4d('0x20')]);_0x34d452[_0x0b4d('0x1e')]=qs[_0x0b4d('0x1e')](_0x4cdc46[_0x0b4d('0x4e')][_0x0b4d('0x1e')]);}_0x34d452['order']=qs['sort'](_0x4cdc46[_0x0b4d('0x4e')][_0x0b4d('0x58')]);_0x34d452[_0x0b4d('0x5b')]=qs[_0x0b4d('0x50')](_['pick'](_0x4cdc46['query'],_0x2f6252[_0x0b4d('0x50')]));_0x34d452['where'][_0x0b4d('0x6c')]=_0x180af9['id'];if(_0x4cdc46[_0x0b4d('0x4e')]['filter']){_0x34d452['where']=_[_0x0b4d('0x64')](_0x34d452[_0x0b4d('0x5b')],{'$or':_[_0x0b4d('0x49')](_0x34d452[_0x0b4d('0x52')],function(_0x491507){var _0x57d3d9={};_0x57d3d9[_0x491507]={'$like':'%'+_0x4cdc46[_0x0b4d('0x4e')][_0x0b4d('0x5a')]+'%'};return _0x57d3d9;})});}_0x34d452=_[_0x0b4d('0x64')]({},_0x34d452,_0x4cdc46['options']);return db[_0x0b4d('0x88')]['count']({'where':_0x34d452[_0x0b4d('0x5b')]})[_0x0b4d('0x12')](function(_0x44e2b0){_0x177e45[_0x0b4d('0x21')]=_0x44e2b0;if(_0x4cdc46[_0x0b4d('0x4e')][_0x0b4d('0x5f')]){_0x34d452[_0x0b4d('0x60')]=[{'model':db[_0x0b4d('0x8b')],'as':'Contact','required':![]},{'model':db[_0x0b4d('0x8c')],'as':'Owner','attributes':[_0x0b4d('0x29'),_0x0b4d('0x8d'),_0x0b4d('0x8e')],'required':![]},{'model':db[_0x0b4d('0x8f')],'as':_0x0b4d('0x90'),'attributes':['id',_0x0b4d('0x29'),_0x0b4d('0x91')],'where':_0x4cdc46[_0x0b4d('0x4e')][_0x0b4d('0x92')]?{'id':_0x4cdc46[_0x0b4d('0x4e')][_0x0b4d('0x92')]}:undefined,'required':_0x4cdc46['query']['tag']?!![]:![]}];}return db[_0x0b4d('0x88')][_0x0b4d('0x61')](_0x34d452);})[_0x0b4d('0x12')](function(_0xd93727){_0x177e45[_0x0b4d('0x70')]=_0xd93727;return _0x177e45;});}})[_0x0b4d('0x12')](respondWithFilteredResult(_0x445d4a,_0x34d452))[_0x0b4d('0x1a')](handleError(_0x445d4a,null));};exports[_0x0b4d('0x93')]=function addApplications(_0xc59457,_0x4a69b7){var _0x45634d=_0xc59457[_0x0b4d('0x63')]['id'];var _0x1695dd=_0xc59457[_0x0b4d('0x66')];var _0xf22ca7=0xc8;var _0x4a6c4e=null;return db[_0x0b4d('0x94')][_0x0b4d('0x95')]({'isolationLevel':db[_0x0b4d('0x94')][_0x0b4d('0x96')][_0x0b4d('0x97')][_0x0b4d('0x98')]},function(_0x5e68e7){return db[_0x0b4d('0x5e')][_0x0b4d('0x6f')]({'where':{'id':_0x45634d},'transaction':_0x5e68e7})['then'](function(_0x4836cd){if(_0x4836cd){return db['MailApplication'][_0x0b4d('0x27')]({'where':{'MailAccountId':_0x45634d},'transaction':_0x5e68e7})[_0x0b4d('0x12')](function(){var _0x4efc5a=_[_0x0b4d('0x49')](_0x1695dd,function(_0x4f02e3){_0x4f02e3[_0x0b4d('0x6c')]=_0x45634d;return _0x4f02e3;});return db['MailApplication'][_0x0b4d('0x99')](_0x4efc5a,{'transaction':_0x5e68e7});});}else{_0xf22ca7=0x194;_0x4a6c4e=[];}});})['then'](function(){if(_0xf22ca7!==0x194){return db['MailApplication']['findAndCountAll']({'where':{'MailAccountId':_0x45634d},'order':_0x0b4d('0x9a')})[_0x0b4d('0x12')](function(_0x76654a){_0x4a6c4e=_0x76654a;});}})['catch'](function(_0x34c214){_0xf22ca7=0x1f4;logger[_0x0b4d('0x18')](_0x34c214[_0x0b4d('0x28')]);if(_0x34c214[_0x0b4d('0x29')]){delete _0x34c214['name'];}_0x4a6c4e=_0x34c214;})[_0x0b4d('0x9b')](function(){if(_0x4a6c4e===null){_0x4a69b7[_0x0b4d('0x1b')](_0xf22ca7);}else{if(_0xf22ca7===0x1f4){_0x4a69b7[_0x0b4d('0x1c')](_0xf22ca7)['send'](_0x4a6c4e);}else{_0x4a69b7[_0x0b4d('0x1c')](_0xf22ca7)[_0x0b4d('0x24')](_0x4a6c4e);}}});};exports['getApplications']=function(_0xe8e2db,_0x3d96d3){var _0x3f640e={};var _0xeeb1b9={};var _0x5d0ce7;var _0x11bd0e;return db[_0x0b4d('0x5e')][_0x0b4d('0x6f')]({'where':{'id':_0xe8e2db[_0x0b4d('0x63')]['id']}})['then'](handleEntityNotFound(_0x3d96d3,null))[_0x0b4d('0x12')](function(_0x51f8e1){if(_0x51f8e1){_0x5d0ce7=_0x51f8e1;_0xeeb1b9[_0x0b4d('0x4d')]=_['keys'](db[_0x0b4d('0x9c')][_0x0b4d('0x4a')]);_0xeeb1b9['query']=_[_0x0b4d('0x4f')](_0xe8e2db[_0x0b4d('0x4e')]);_0xeeb1b9[_0x0b4d('0x50')]=_[_0x0b4d('0x51')](_0xeeb1b9[_0x0b4d('0x4d')],_0xeeb1b9[_0x0b4d('0x4e')]);_0x3f640e[_0x0b4d('0x52')]=_[_0x0b4d('0x51')](_0xeeb1b9[_0x0b4d('0x4d')],qs['fields'](_0xe8e2db[_0x0b4d('0x4e')][_0x0b4d('0x53')]));_0x3f640e['attributes']=_0x3f640e['attributes']['length']?_0x3f640e[_0x0b4d('0x52')]:_0xeeb1b9[_0x0b4d('0x4d')];_0x3f640e[_0x0b4d('0x57')]=qs[_0x0b4d('0x58')](_0xe8e2db[_0x0b4d('0x4e')][_0x0b4d('0x58')]);_0x3f640e[_0x0b4d('0x5b')]=qs[_0x0b4d('0x50')](_[_0x0b4d('0x59')](_0xe8e2db[_0x0b4d('0x4e')],_0xeeb1b9[_0x0b4d('0x50')]));if(_0xe8e2db[_0x0b4d('0x4e')][_0x0b4d('0x5a')]){_0x3f640e['where']=_[_0x0b4d('0x64')](_0x3f640e[_0x0b4d('0x5b')],{'$or':_[_0x0b4d('0x49')](_0x3f640e[_0x0b4d('0x52')],function(_0x17b559){var _0x3d987d={};_0x3d987d[_0x17b559]={'$like':'%'+_0xe8e2db[_0x0b4d('0x4e')]['filter']+'%'};return _0x3d987d;})});}_0x3f640e=_[_0x0b4d('0x64')]({},_0x3f640e,_0xe8e2db['options']);return _0x5d0ce7['getApplications'](_0x3f640e);}})[_0x0b4d('0x12')](function(_0x455789){if(_0x455789){_0x11bd0e=_0x455789[_0x0b4d('0x54')];if(!_0xe8e2db[_0x0b4d('0x4e')]['hasOwnProperty'](_0x0b4d('0x56'))){_0x3f640e[_0x0b4d('0x20')]=qs['limit'](_0xe8e2db[_0x0b4d('0x4e')][_0x0b4d('0x20')]);_0x3f640e[_0x0b4d('0x1e')]=qs['offset'](_0xe8e2db[_0x0b4d('0x4e')][_0x0b4d('0x1e')]);}return _0x5d0ce7[_0x0b4d('0x9d')](_0x3f640e);}})[_0x0b4d('0x12')](function(_0x3cb978){if(_0x3cb978){return _0x3cb978?{'count':_0x11bd0e,'rows':_0x3cb978}:null;}})[_0x0b4d('0x12')](respondWithResult(_0x3d96d3,null))[_0x0b4d('0x1a')](handleError(_0x3d96d3,null));};exports[_0x0b4d('0x9e')]=function(_0x1c42d2,_0x24255a){var _0x2ab44={'raw':!![],'where':{}};var _0x336652={};var _0x13ff2e={'count':0x0,'rows':[]};return db[_0x0b4d('0x5e')]['findOne']({'where':{'id':_0x1c42d2[_0x0b4d('0x63')]['id']}})[_0x0b4d('0x12')](handleEntityNotFound(_0x24255a,null))[_0x0b4d('0x12')](function(_0x5bb06f){if(_0x5bb06f){_0x336652['model']=_['keys'](db[_0x0b4d('0x9f')]['rawAttributes']);_0x336652[_0x0b4d('0x4e')]=_[_0x0b4d('0x4f')](_0x1c42d2[_0x0b4d('0x4e')]);_0x336652[_0x0b4d('0x50')]=_['intersection'](_0x336652['model'],_0x336652['query']);_0x2ab44['attributes']=_[_0x0b4d('0x51')](_0x336652[_0x0b4d('0x4d')],qs[_0x0b4d('0x53')](_0x1c42d2[_0x0b4d('0x4e')][_0x0b4d('0x53')]));_0x2ab44['attributes']=_0x2ab44['attributes']['length']?_0x2ab44[_0x0b4d('0x52')]:_0x336652['model'];if(!_0x1c42d2[_0x0b4d('0x4e')][_0x0b4d('0x55')](_0x0b4d('0x56'))){_0x2ab44[_0x0b4d('0x20')]=qs[_0x0b4d('0x20')](_0x1c42d2[_0x0b4d('0x4e')]['limit']);_0x2ab44[_0x0b4d('0x1e')]=qs[_0x0b4d('0x1e')](_0x1c42d2[_0x0b4d('0x4e')][_0x0b4d('0x1e')]);}_0x2ab44[_0x0b4d('0x57')]=qs['sort'](_0x1c42d2['query']['sort']);_0x2ab44['where']=qs[_0x0b4d('0x50')](_[_0x0b4d('0x59')](_0x1c42d2[_0x0b4d('0x4e')],_0x336652[_0x0b4d('0x50')]));_0x2ab44['where'][_0x0b4d('0x6c')]=_0x5bb06f['id'];if(_0x1c42d2[_0x0b4d('0x4e')][_0x0b4d('0x5a')]){_0x2ab44[_0x0b4d('0x5b')]=_[_0x0b4d('0x64')](_0x2ab44['where'],{'$or':_[_0x0b4d('0x49')](_0x2ab44['attributes'],function(_0xd8fa6){var _0x42e964={};_0x42e964[_0xd8fa6]={'$like':'%'+_0x1c42d2[_0x0b4d('0x4e')][_0x0b4d('0x5a')]+'%'};return _0x42e964;})});}if(_0x1c42d2['query'][_0x0b4d('0xa0')]){var _0x56d3a1=_0x1c42d2[_0x0b4d('0x4e')][_0x0b4d('0xa0')][_0x0b4d('0xa1')](',');var _0x1a6d54={};_0x1a6d54[_0x56d3a1[0x0]]={'$gte':moment(_0x56d3a1[0x1])[_0x0b4d('0xa2')]('YYYY-MM-DD\x20HH:mm:ss')};_0x2ab44['where']=_['merge'](_0x2ab44[_0x0b4d('0x5b')],_0x1a6d54);}_0x2ab44=_[_0x0b4d('0x64')]({},_0x2ab44,_0x1c42d2['options']);return db['MailMessage']['count']({'where':_0x2ab44[_0x0b4d('0x5b')]})[_0x0b4d('0x12')](function(_0x2df8b8){_0x13ff2e[_0x0b4d('0x21')]=_0x2df8b8;if(_0x1c42d2[_0x0b4d('0x4e')][_0x0b4d('0x5f')]){_0x2ab44[_0x0b4d('0x60')]=[{'all':!![]}];}return db[_0x0b4d('0x9f')]['findAll'](_0x2ab44);})[_0x0b4d('0x12')](function(_0x3a6b79){if(_0x1c42d2['query'][_0x0b4d('0xa3')]===_0x0b4d('0xa4')){for(var _0x4141cc=0x0;_0x4141cc<_0x3a6b79[_0x0b4d('0x54')];_0x4141cc++){_0x3a6b79[_0x4141cc][_0x0b4d('0x66')]=juice(_0x3a6b79[_0x4141cc][_0x0b4d('0x66')]);}}_0x13ff2e[_0x0b4d('0x70')]=_0x3a6b79;return _0x13ff2e;});}})['then'](respondWithFilteredResult(_0x24255a,_0x2ab44))[_0x0b4d('0x1a')](handleError(_0x24255a,null));};exports[_0x0b4d('0x2a')]=function(_0x3321b4,_0x3302fe){var _0x3d5868,_0x37723a={},_0x13b739;if(_0x3321b4['body']['to']){_0x13b739=_0x3321b4[_0x0b4d('0x66')]['to'][_0x0b4d('0xa1')](',')[0x0];}return db[_0x0b4d('0x5e')][_0x0b4d('0x65')]({'where':{'id':_0x3321b4[_0x0b4d('0x63')]['id']},'include':[{'model':db['CmList'],'as':_0x0b4d('0xa5'),'include':[{'model':db[_0x0b4d('0x8b')],'as':_0x0b4d('0xa6'),'where':{'email':_0x13b739},'limit':0x1,'order':[[_0x0b4d('0xa7'),_0x0b4d('0xa8')]]}]},{'model':db[_0x0b4d('0x46')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x0b4d('0xa9')],'as':_0x0b4d('0xa9'),'raw':!![]}]}]})[_0x0b4d('0x12')](handleEntityNotFound(_0x3302fe,null))[_0x0b4d('0x12')](function(_0x10f77b){if(!_0x10f77b)return;_0x3d5868=_0x10f77b;if(!_0x10f77b[_0x0b4d('0x43')])throw new Error(_0x0b4d('0xaa'));if(_[_0x0b4d('0x7a')](_0x3321b4[_0x0b4d('0x66')][_0x0b4d('0xab')])){_0x3321b4[_0x0b4d('0x66')][_0x0b4d('0xab')]=util[_0x0b4d('0xa2')](_0x0b4d('0xac'),_0x10f77b[_0x0b4d('0x29')],_0x10f77b[_0x0b4d('0x78')]||_0x10f77b[_0x0b4d('0x43')][_0x0b4d('0x37')]);}if(_0x3321b4['body'][_0x0b4d('0xad')]&&_0x3321b4['body'][_0x0b4d('0xad')]['length']){for(var _0x4d7b00=0x0;_0x4d7b00<_0x3321b4[_0x0b4d('0x66')][_0x0b4d('0xad')]['length'];_0x4d7b00+=0x1){_0x3321b4[_0x0b4d('0x66')][_0x0b4d('0xad')][_0x4d7b00]={'filename':_0x3321b4[_0x0b4d('0x66')]['attachments'][_0x4d7b00][_0x0b4d('0x29')],'path':path[_0x0b4d('0xae')](config[_0x0b4d('0xaf')],_0x0b4d('0xb0'),_0x3321b4[_0x0b4d('0x66')][_0x0b4d('0xad')][_0x4d7b00][_0x0b4d('0xb1')])};}}var _0x299385=_0x10f77b[_0x0b4d('0xb2')]();return respondWithRpcPromise(_0x0b4d('0xb3'),'sendMail',{'account':_0x299385,'message':_0x3321b4[_0x0b4d('0x66')]});})[_0x0b4d('0x12')](function(_0x545fe3){if(!_0x545fe3)return;_0x37723a=_0x545fe3;if(!_0x3d5868[_0x0b4d('0xa5')])throw new Error(_0x0b4d('0xb4'));if(_0x3d5868[_0x0b4d('0xa5')]['Contacts'][_0x0b4d('0x54')])return _0x3d5868[_0x0b4d('0xa5')][_0x0b4d('0xa6')][0x0];return db['CmContact']['create'](_[_0x0b4d('0xa')](_0x3321b4['body'],{'firstName':_0x3321b4[_0x0b4d('0x66')]['to'],'email':_0x3321b4[_0x0b4d('0x66')]['to'],'phone':_0x3321b4[_0x0b4d('0x66')]['to'],'ListId':_0x3d5868[_0x0b4d('0x79')]}));})[_0x0b4d('0x12')](function(_0x445c44){if(!_0x445c44)return;var _0x207fa1={'UserId':_0x3321b4[_0x0b4d('0x37')]['id'],'ContactId':_0x445c44['id'],'MailAccountId':_0x3d5868['id'],'inReplyTo':_0x37723a[_0x0b4d('0xb5')],'to':_0x3321b4[_0x0b4d('0x66')][_0x0b4d('0xab')],'cc':_0x3321b4[_0x0b4d('0x66')]['cc'],'subject':_0x3321b4[_0x0b4d('0x66')][_0x0b4d('0xb6')],'attach':_0x3321b4[_0x0b4d('0x66')][_0x0b4d('0xb7')],'firstMsgDirection':_0x0b4d('0xb8'),'lastMsgAt':moment()[_0x0b4d('0xa2')](_0x0b4d('0xb9')),'lastMsgDirection':'out','Messages':[_[_0x0b4d('0x64')](_0x3321b4[_0x0b4d('0x66')],{'messageId':_0x37723a[_0x0b4d('0xb5')],'sentAt':moment()[_0x0b4d('0xa2')](_0x0b4d('0xb9')),'read':!![],'MailAccountId':_0x3d5868['id'],'UserId':_0x3321b4['user']['id'],'ContactId':_0x445c44['id']})]};if(_0x3321b4[_0x0b4d('0x66')]['Interaction']){_0x207fa1=_['merge'](_0x207fa1,_0x3321b4[_0x0b4d('0x66')][_0x0b4d('0xba')]);}return db[_0x0b4d('0x88')][_0x0b4d('0x75')](_0x207fa1,{'include':[{'model':db[_0x0b4d('0x9f')],'as':_0x0b4d('0xbb')}]});})['then'](respondWithResult(_0x3302fe,null))[_0x0b4d('0x1a')](handleError(_0x3302fe,null));};exports[_0x0b4d('0xbc')]=function(_0x2b7cde,_0xd8a2da){return db['MailAccount'][_0x0b4d('0x65')]({'where':{'id':_0x2b7cde[_0x0b4d('0x63')]['id']},'include':[{'model':db[_0x0b4d('0x46')],'as':_0x0b4d('0x43'),'raw':!![],'include':[{'model':db[_0x0b4d('0xa9')],'as':'CloudProvider','raw':!![]}]}]})[_0x0b4d('0x12')](handleEntityNotFound(_0xd8a2da,null))[_0x0b4d('0x12')](function(_0x1482c3){if(!_0x1482c3['Smtp'])return;var _0x79a421=_0x1482c3['getSmtpOptions']();return respondWithRpcPromise(_0x0b4d('0xbd'),_0x0b4d('0xbc'),{'account':_0x79a421});})[_0x0b4d('0x12')](respondWithResult(_0xd8a2da,null))[_0x0b4d('0x1a')](handleError(_0xd8a2da,null));};exports['destroy']=function(_0x2dbe80,_0x33965e){return db[_0x0b4d('0x5e')]['find']({'where':{'id':_0x2dbe80[_0x0b4d('0x63')]['id']}})[_0x0b4d('0x12')](handleEntityNotFound(_0x33965e,null))[_0x0b4d('0x12')](function(_0x56a6ff){if(_0x56a6ff&&_0x56a6ff['service']){throw new db[(_0x0b4d('0xbe'))][(_0x0b4d('0xbf'))](_0x0b4d('0xc0'));}return _0x56a6ff;})[_0x0b4d('0x12')](removeEntity(_0x33965e,null))['catch'](handleError(_0x33965e,null));};exports[_0x0b4d('0xc1')]=function(_0x4257a4,_0x1d401c){return db[_0x0b4d('0x5e')][_0x0b4d('0x65')]({'where':{'id':_0x4257a4[_0x0b4d('0x63')]['id']}})[_0x0b4d('0x12')](handleEntityNotFound(_0x1d401c,null))['then'](function(_0x226f56){if(_0x226f56){return _0x226f56[_0x0b4d('0xc1')](_0x4257a4[_0x0b4d('0x66')][_0x0b4d('0x72')],_[_0x0b4d('0x89')](_0x4257a4[_0x0b4d('0x66')],[_0x0b4d('0x72'),'id'])||{})['spread'](function(_0x15fea2){for(var _0x541217=0x0;_0x541217<_0x4257a4[_0x0b4d('0x66')]['ids'][_0x0b4d('0x54')];_0x541217+=0x1){socket['emit'](_0x0b4d('0xc2'),{'UserId':Number(_0x4257a4[_0x0b4d('0x66')][_0x0b4d('0x72')][_0x541217]),'MailAccountId':Number(_0x4257a4[_0x0b4d('0x63')]['id'])});}return _0x15fea2;});}})['then'](respondWithResult(_0x1d401c,null))['catch'](handleError(_0x1d401c,null));};exports[_0x0b4d('0xc3')]=function(_0x1cf308,_0x4d6aba){return db[_0x0b4d('0x5e')]['find']({'where':{'id':_0x1cf308[_0x0b4d('0x63')]['id']}})[_0x0b4d('0x12')](handleEntityNotFound(_0x4d6aba,null))[_0x0b4d('0x12')](function(_0x3b9f90){if(_0x3b9f90){return _0x3b9f90[_0x0b4d('0xc3')](_0x1cf308[_0x0b4d('0x4e')]['ids'])[_0x0b4d('0x12')](function(){if(_[_0x0b4d('0xc4')](_0x1cf308[_0x0b4d('0x4e')][_0x0b4d('0x72')])){for(var _0x4a06d9=0x0;_0x4a06d9<_0x1cf308['query']['ids'][_0x0b4d('0x54')];_0x4a06d9+=0x1){socket[_0x0b4d('0xc5')]('userMailAccount:remove',{'UserId':Number(_0x1cf308[_0x0b4d('0x4e')][_0x0b4d('0x72')][_0x4a06d9]),'MailAccountId':Number(_0x1cf308['params']['id'])});}}else{socket[_0x0b4d('0xc5')]('userMailAccount:remove',{'UserId':Number(_0x1cf308['query']['ids']),'MailAccountId':Number(_0x1cf308['params']['id'])});}});}})[_0x0b4d('0x12')](respondWithStatusCode(_0x4d6aba,null))['catch'](handleError(_0x4d6aba,null));};exports[_0x0b4d('0xc6')]=function(_0x42ffae,_0x18755c){var _0x5d79e4={};var _0x3ee89d={};var _0x5d0b97;var _0x2d5b1e;return db[_0x0b4d('0x5e')][_0x0b4d('0x6f')]({'where':{'id':_0x42ffae[_0x0b4d('0x63')]['id']}})['then'](handleEntityNotFound(_0x18755c,null))[_0x0b4d('0x12')](function(_0x217308){if(_0x217308){_0x5d0b97=_0x217308;_0x3ee89d['model']=_['keys'](db[_0x0b4d('0x8c')]['rawAttributes']);_0x3ee89d['query']=_[_0x0b4d('0x4f')](_0x42ffae[_0x0b4d('0x4e')]);_0x3ee89d[_0x0b4d('0x50')]=_['intersection'](_0x3ee89d[_0x0b4d('0x4d')],_0x3ee89d[_0x0b4d('0x4e')]);_0x5d79e4[_0x0b4d('0x52')]=_[_0x0b4d('0x51')](_0x3ee89d['model'],qs[_0x0b4d('0x53')](_0x42ffae[_0x0b4d('0x4e')][_0x0b4d('0x53')]));_0x5d79e4[_0x0b4d('0x52')]=_0x5d79e4[_0x0b4d('0x52')][_0x0b4d('0x54')]?_0x5d79e4[_0x0b4d('0x52')]:_0x3ee89d[_0x0b4d('0x4d')];_0x5d79e4[_0x0b4d('0x57')]=qs[_0x0b4d('0x58')](_0x42ffae[_0x0b4d('0x4e')][_0x0b4d('0x58')]);_0x5d79e4[_0x0b4d('0x5b')]=qs[_0x0b4d('0x50')](_[_0x0b4d('0x59')](_0x42ffae[_0x0b4d('0x4e')],_0x3ee89d[_0x0b4d('0x50')]));if(_0x42ffae['query']['filter']){_0x5d79e4[_0x0b4d('0x5b')]=_[_0x0b4d('0x64')](_0x5d79e4[_0x0b4d('0x5b')],{'$or':_[_0x0b4d('0x49')](_0x5d79e4[_0x0b4d('0x52')],function(_0xc70f75){var _0x1d6efe={};_0x1d6efe[_0xc70f75]={'$like':'%'+_0x42ffae[_0x0b4d('0x4e')][_0x0b4d('0x5a')]+'%'};return _0x1d6efe;})});}_0x5d79e4=_['merge']({},_0x5d79e4,_0x42ffae[_0x0b4d('0x5d')]);return _0x5d0b97[_0x0b4d('0xc6')](_0x5d79e4);}})[_0x0b4d('0x12')](function(_0x1e5ebf){if(_0x1e5ebf){_0x2d5b1e=_0x1e5ebf['length'];if(!_0x42ffae['query'][_0x0b4d('0x55')]('nolimit')){_0x5d79e4[_0x0b4d('0x20')]=qs[_0x0b4d('0x20')](_0x42ffae[_0x0b4d('0x4e')]['limit']);_0x5d79e4[_0x0b4d('0x1e')]=qs[_0x0b4d('0x1e')](_0x42ffae['query'][_0x0b4d('0x1e')]);}return _0x5d0b97[_0x0b4d('0xc6')](_0x5d79e4);}})[_0x0b4d('0x12')](function(_0x17faa6){if(_0x17faa6){return _0x17faa6?{'count':_0x2d5b1e,'rows':_0x17faa6}:null;}})[_0x0b4d('0x12')](respondWithResult(_0x18755c,null))[_0x0b4d('0x1a')](handleError(_0x18755c,null));}; \ No newline at end of file +var _0x5eed=['mandatoryDispositionPause','map','rawAttributes','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','limit','sort','pick','where','merge','type','VIRTUAL','filter','options','MailAccount','includeAll','include','findAll','rows','show','keys','find','body','provider','params','Mail\x20Account\x20not\x20found','describe','MailAccountId','Disposition','getDispositions','findOne','nolimit','order','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','custom','isNil','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','create','setImap','getSmtp','setSmtp','addInteraction','omit','getInteractions','MailInteraction','CmContact','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','finally','getApplications','MailMessage','$gte','format','inlineCss','split','CmList','List','Contacts','updatedAt','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','from','%s\x20<%s>','attachments','join','root','server/files/attachments','basename','SendMail','sendMail','defaults','ListId','subject','attach','out','messageId','Interaction','Messages','getSmtpOptions','VerifySmtp','verifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','removeAgents','userMailAccount:remove','moment','bluebird','util','path','juice','ioredis','../../components/parsers/qs','../../config/logger','../../mysqldb','redis','socket.io-emitter','./mailAccount.socket','register','http','request','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','MailAccount,\x20%s,\x20%s','message','request\x20sent','catch','sendStatus','status','end','json','undefined','count','offset','set','Content-Range','update','destroy','get','MailAccounts','UserProfileResource','then','stack','name','send','gmail','yahoo','imap.mail.yahoo.com','Unknown\x20email\x20service\x20provider','smtp.gmail.com','hotmail','smtp-mail.outlook.com','outlook365','smtp.office365.com','user','password','pass','modernAuthentication','CloudProviderId','port','secure','service','authentication','host','Imap','Smtp','index','MailServerIn','MailServerOut','Pause'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5eed,0x138));var _0xd5ee=function(_0x39d14c,_0x3eeb25){_0x39d14c=_0x39d14c-0x0;var _0x172e0a=_0x5eed[_0x39d14c];return _0x172e0a;};'use strict';var moment=require(_0xd5ee('0x0'));var BPromise=require(_0xd5ee('0x1'));var util=require(_0xd5ee('0x2'));var path=require(_0xd5ee('0x3'));var _=require('lodash');var juice=require(_0xd5ee('0x4'));var Redis=require(_0xd5ee('0x5'));var qs=require(_0xd5ee('0x6'));var logger=require(_0xd5ee('0x7'))('api');var config=require('../../config/environment');var db=require(_0xd5ee('0x8'))['db'];config['redis']=_['defaults'](config[_0xd5ee('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xd5ee('0xa'))(new Redis(config[_0xd5ee('0x9')]));require(_0xd5ee('0xb'))[_0xd5ee('0xc')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xd5ee('0xd')]({'port':0x232b});function respondWithRpcPromise(_0x3a05e6,_0x225fe4,_0x1dfea5,_0x2f597b){return new BPromise(function(_0x1d8664,_0x3cace6){var _0x46d362=_0x2f597b||client;return _0x46d362[_0xd5ee('0xe')](_0x3a05e6,_0x1dfea5)['then'](function(_0x5f1f00){logger['info']('MailAccount,\x20%s,\x20%s',_0x225fe4,'request\x20sent');logger[_0xd5ee('0xf')](_0xd5ee('0x10'),_0x225fe4,'request\x20sent',JSON[_0xd5ee('0x11')](_0x5f1f00));if(_0x5f1f00[_0xd5ee('0x12')]){if(_0x5f1f00[_0xd5ee('0x12')]['code']===0x1f4){logger[_0xd5ee('0x12')](_0xd5ee('0x13'),_0x225fe4,_0x5f1f00[_0xd5ee('0x12')][_0xd5ee('0x14')]);return _0x3cace6(_0x5f1f00[_0xd5ee('0x12')][_0xd5ee('0x14')]);}logger[_0xd5ee('0x12')](_0xd5ee('0x13'),_0x225fe4,_0x5f1f00['error'][_0xd5ee('0x14')]);return _0x1d8664(_0x5f1f00[_0xd5ee('0x12')][_0xd5ee('0x14')]);}else{logger['info'](_0xd5ee('0x13'),_0x225fe4,_0xd5ee('0x15'));_0x1d8664(_0x5f1f00['result'][_0xd5ee('0x14')]);}})[_0xd5ee('0x16')](function(_0x7449f1){logger[_0xd5ee('0x12')](_0xd5ee('0x13'),_0x225fe4,_0x7449f1);_0x3cace6(_0x7449f1);});});}function respondWithStatusCode(_0x35712d,_0x108a72){_0x108a72=_0x108a72||0xcc;return function(_0x55915f){if(_0x55915f){return _0x35712d[_0xd5ee('0x17')](_0x108a72);}return _0x35712d[_0xd5ee('0x18')](_0x108a72)[_0xd5ee('0x19')]();};}function respondWithResult(_0x43ad50,_0x5238f9){_0x5238f9=_0x5238f9||0xc8;return function(_0x3a1bec){if(_0x3a1bec){return _0x43ad50[_0xd5ee('0x18')](_0x5238f9)[_0xd5ee('0x1a')](_0x3a1bec);}};}function respondWithFilteredResult(_0x4c79fe,_0x340fc0){return function(_0x51ffb){if(_0x51ffb){var _0xd94d42=typeof _0x340fc0['offset']===_0xd5ee('0x1b')&&typeof _0x340fc0['limit']===_0xd5ee('0x1b');var _0x33fa60=_0x51ffb[_0xd5ee('0x1c')];var _0x1686f5=_0xd94d42?0x0:_0x340fc0[_0xd5ee('0x1d')];var _0x3c6494=_0xd94d42?_0x51ffb['count']:_0x340fc0[_0xd5ee('0x1d')]+_0x340fc0['limit'];var _0x9322b1;if(_0x3c6494>=_0x33fa60){_0x3c6494=_0x33fa60;_0x9322b1=0xc8;}else{_0x9322b1=0xce;}_0x4c79fe[_0xd5ee('0x18')](_0x9322b1);return _0x4c79fe[_0xd5ee('0x1e')](_0xd5ee('0x1f'),_0x1686f5+'-'+_0x3c6494+'/'+_0x33fa60)[_0xd5ee('0x1a')](_0x51ffb);}return null;};}function saveUpdates(_0x1b0a4e){return function(_0x4fef9b){if(_0x4fef9b){return _0x4fef9b[_0xd5ee('0x20')](_0x1b0a4e)['then'](function(_0xd32f38){return _0xd32f38;});}return null;};}function removeEntity(_0x40fc74){return function(_0x2d0319){if(_0x2d0319){return _0x2d0319[_0xd5ee('0x21')]()['then'](function(){var _0x3ec207=_0x2d0319[_0xd5ee('0x22')]({'plain':!![]});var _0x530f9e=_0xd5ee('0x23');return db[_0xd5ee('0x24')][_0xd5ee('0x21')]({'where':{'type':_0x530f9e,'resourceId':_0x3ec207['id']}})[_0xd5ee('0x25')](function(){return _0x2d0319;});})[_0xd5ee('0x25')](function(){_0x40fc74[_0xd5ee('0x18')](0xcc)[_0xd5ee('0x19')]();});}};}function handleEntityNotFound(_0x5158c3){return function(_0x246a71){if(!_0x246a71){_0x5158c3['sendStatus'](0x194);}return _0x246a71;};}function handleError(_0x3fbbb7,_0x5061f7){_0x5061f7=_0x5061f7||0x1f4;return function(_0x5de646){logger[_0xd5ee('0x12')](_0x5de646[_0xd5ee('0x26')]);if(_0x5de646[_0xd5ee('0x27')]){delete _0x5de646[_0xd5ee('0x27')];}_0x3fbbb7[_0xd5ee('0x18')](_0x5061f7)[_0xd5ee('0x28')](_0x5de646);};}function getImapHost(_0x582ad4){switch(_0x582ad4){case _0xd5ee('0x29'):return'imap.gmail.com';case _0xd5ee('0x2a'):return _0xd5ee('0x2b');case'hotmail':return'imap-mail.outlook.com';case'outlook365':return'outlook.office365.com';}throw new Error(_0xd5ee('0x2c'),_0x582ad4);}function getSmtpHost(_0x557fc0){switch(_0x557fc0){case _0xd5ee('0x29'):return _0xd5ee('0x2d');case _0xd5ee('0x2a'):return'smtp.mail.yahoo.com';case _0xd5ee('0x2e'):return _0xd5ee('0x2f');case _0xd5ee('0x30'):return _0xd5ee('0x31');}throw new Error(_0xd5ee('0x2c'),_0x557fc0);}function getAuthenticationOptions(_0x48e81e,_0x512f81){var _0xca6e86={};var _0x14ed2d={};if(_0x48e81e){_0xca6e86[_0xd5ee('0x32')]=_0x14ed2d[_0xd5ee('0x32')]=_0x512f81['username'];_0xca6e86[_0xd5ee('0x33')]=_0x14ed2d[_0xd5ee('0x34')]=_0x512f81['password'];if(_0x512f81[_0xd5ee('0x35')]){_0xca6e86[_0xd5ee('0x35')]=_0x14ed2d[_0xd5ee('0x35')]=!![];_0xca6e86['CloudProviderId']=_0x14ed2d[_0xd5ee('0x36')]=_0x512f81['CloudProviderId'];_0xca6e86[_0xd5ee('0x33')]=_0x14ed2d[_0xd5ee('0x34')]=null;}else{_0xca6e86[_0xd5ee('0x36')]=_0x14ed2d[_0xd5ee('0x36')]=null;}_0xca6e86['host']=getImapHost(_0x48e81e);_0xca6e86['port']=0x3e1;_0x14ed2d['host']=getSmtpHost(_0x48e81e);_0x14ed2d[_0xd5ee('0x37')]=0x24b;_0x14ed2d[_0xd5ee('0x38')]=![];_0xca6e86[_0xd5ee('0x39')]=_0x14ed2d['service']=null;}else{if(_0x512f81['authentication']){_0xca6e86[_0xd5ee('0x32')]=_0x14ed2d['user']=_0x512f81['username'];_0xca6e86['password']=_0x14ed2d[_0xd5ee('0x34')]=_0x512f81['password'];}else{_0xca6e86[_0xd5ee('0x3a')]=_0x14ed2d['authentication']=![];_0xca6e86[_0xd5ee('0x32')]=_0x14ed2d['user']=null;_0xca6e86[_0xd5ee('0x33')]=_0x14ed2d[_0xd5ee('0x34')]=null;}_0xca6e86[_0xd5ee('0x3b')]=_0x512f81[_0xd5ee('0x3c')]['host'];_0xca6e86[_0xd5ee('0x37')]=_0x512f81[_0xd5ee('0x3c')][_0xd5ee('0x37')];_0x14ed2d[_0xd5ee('0x3b')]=_0x512f81[_0xd5ee('0x3d')][_0xd5ee('0x3b')];_0x14ed2d['port']=_0x512f81['Smtp'][_0xd5ee('0x37')];}return{'Imap':_0xca6e86,'Smtp':_0x14ed2d};}exports[_0xd5ee('0x3e')]=function(_0x550230,_0x148a70){var _0x2f9c4b={'include':[{'model':db[_0xd5ee('0x3f')],'as':'Imap'},{'model':db[_0xd5ee('0x40')],'as':_0xd5ee('0x3d')},{'model':db[_0xd5ee('0x41')],'as':_0xd5ee('0x42')}]},_0x3833b7={},_0x3c67b3={'count':0x0,'rows':[]};var _0x3914f0=_[_0xd5ee('0x43')](db['MailAccount'][_0xd5ee('0x44')],function(_0x40288c){return{'name':_0x40288c['fieldName'],'type':_0x40288c['type'][_0xd5ee('0x45')]};});_0x3833b7[_0xd5ee('0x46')]=_[_0xd5ee('0x43')](_0x3914f0,_0xd5ee('0x27'));_0x3833b7[_0xd5ee('0x47')]=_['keys'](_0x550230[_0xd5ee('0x47')]);_0x3833b7[_0xd5ee('0x48')]=_['intersection'](_0x3833b7[_0xd5ee('0x46')],_0x3833b7[_0xd5ee('0x47')]);_0x2f9c4b[_0xd5ee('0x49')]=_[_0xd5ee('0x4a')](_0x3833b7[_0xd5ee('0x46')],qs['fields'](_0x550230['query'][_0xd5ee('0x4b')]));_0x2f9c4b['attributes']=_0x2f9c4b[_0xd5ee('0x49')][_0xd5ee('0x4c')]?_0x2f9c4b[_0xd5ee('0x49')]:_0x3833b7['model'];if(!_0x550230['query'][_0xd5ee('0x4d')]('nolimit')){_0x2f9c4b['limit']=qs[_0xd5ee('0x4e')](_0x550230[_0xd5ee('0x47')]['limit']);_0x2f9c4b[_0xd5ee('0x1d')]=qs[_0xd5ee('0x1d')](_0x550230['query'][_0xd5ee('0x1d')]);}_0x2f9c4b['order']=qs[_0xd5ee('0x4f')](_0x550230['query'][_0xd5ee('0x4f')]);_0x2f9c4b['where']=qs[_0xd5ee('0x48')](_[_0xd5ee('0x50')](_0x550230[_0xd5ee('0x47')],_0x3833b7[_0xd5ee('0x48')]),_0x3914f0);if(_0x550230[_0xd5ee('0x47')]['filter']){_0x2f9c4b[_0xd5ee('0x51')]=_[_0xd5ee('0x52')](_0x2f9c4b[_0xd5ee('0x51')],{'$or':_['map'](_0x3914f0,function(_0x80916c){if(_0x80916c[_0xd5ee('0x53')]!==_0xd5ee('0x54')){var _0x3f8c35={};_0x3f8c35[_0x80916c[_0xd5ee('0x27')]]={'$like':'%'+_0x550230['query'][_0xd5ee('0x55')]+'%'};return _0x3f8c35;}})});}_0x2f9c4b=_['merge']({},_0x2f9c4b,_0x550230[_0xd5ee('0x56')]);var _0x20ade1={'where':_0x2f9c4b[_0xd5ee('0x51')]};return db[_0xd5ee('0x57')][_0xd5ee('0x1c')](_0x20ade1)[_0xd5ee('0x25')](function(_0x297991){_0x3c67b3['count']=_0x297991;if(_0x550230[_0xd5ee('0x47')][_0xd5ee('0x58')]){_0x2f9c4b[_0xd5ee('0x59')]=[{'all':!![]}];}return db[_0xd5ee('0x57')][_0xd5ee('0x5a')](_0x2f9c4b);})[_0xd5ee('0x25')](function(_0x4dfa2a){_0x3c67b3[_0xd5ee('0x5b')]=_0x4dfa2a;return _0x3c67b3;})['then'](respondWithFilteredResult(_0x148a70,_0x2f9c4b))[_0xd5ee('0x16')](handleError(_0x148a70,null));};exports[_0xd5ee('0x5c')]=function(_0x245d68,_0x29bb8e){var _0x203e29={'raw':![],'where':{'id':_0x245d68['params']['id']},'include':[{'model':db['MailServerIn'],'as':_0xd5ee('0x3c')},{'model':db[_0xd5ee('0x40')],'as':'Smtp'},{'model':db[_0xd5ee('0x41')],'as':_0xd5ee('0x42')}]},_0x21ed54={};_0x21ed54[_0xd5ee('0x46')]=_['keys'](db[_0xd5ee('0x57')][_0xd5ee('0x44')]);_0x21ed54[_0xd5ee('0x47')]=_[_0xd5ee('0x5d')](_0x245d68[_0xd5ee('0x47')]);_0x21ed54['filters']=_[_0xd5ee('0x4a')](_0x21ed54[_0xd5ee('0x46')],_0x21ed54[_0xd5ee('0x47')]);_0x203e29[_0xd5ee('0x49')]=_['intersection'](_0x21ed54[_0xd5ee('0x46')],qs['fields'](_0x245d68['query'][_0xd5ee('0x4b')]));_0x203e29[_0xd5ee('0x49')]=_0x203e29[_0xd5ee('0x49')]['length']?_0x203e29['attributes']:_0x21ed54[_0xd5ee('0x46')];if(_0x245d68['query'][_0xd5ee('0x58')]){_0x203e29['include']=[{'all':!![]}];}_0x203e29=_[_0xd5ee('0x52')]({},_0x203e29,_0x245d68[_0xd5ee('0x56')]);return db['MailAccount'][_0xd5ee('0x5e')](_0x203e29)[_0xd5ee('0x25')](handleEntityNotFound(_0x29bb8e,null))[_0xd5ee('0x25')](respondWithResult(_0x29bb8e,null))[_0xd5ee('0x16')](handleError(_0x29bb8e,null));};exports[_0xd5ee('0x20')]=function(_0x2c7360,_0x3d7375){if(_0x2c7360[_0xd5ee('0x5f')]['id']){delete _0x2c7360[_0xd5ee('0x5f')]['id'];}var _0x40cf92=_0x2c7360['body']['provider']==='custom'?null:_0x2c7360[_0xd5ee('0x5f')][_0xd5ee('0x60')];var _0x28e341=_0x2c7360[_0xd5ee('0x5f')][_0xd5ee('0x3c')]||{};var _0x5bf95a=_0x2c7360[_0xd5ee('0x5f')]['Smtp']||{};if(_0x40cf92){_0x28e341[_0xd5ee('0x3b')]=getImapHost(_0x40cf92);_0x28e341['port']=0x3e1;_0x5bf95a['host']=getSmtpHost(_0x40cf92);_0x5bf95a[_0xd5ee('0x37')]=0x24b;_0x5bf95a[_0xd5ee('0x38')]=![];}if(_0x5bf95a[_0xd5ee('0x35')]){_0x5bf95a[_0xd5ee('0x38')]=![];}else{_0x5bf95a[_0xd5ee('0x36')]=null;}if(!_0x28e341[_0xd5ee('0x35')])_0x28e341[_0xd5ee('0x36')]=null;_0x2c7360[_0xd5ee('0x5f')]['Imap']=_0x28e341;_0x2c7360[_0xd5ee('0x5f')][_0xd5ee('0x3d')]=_0x5bf95a;return db[_0xd5ee('0x57')]['find']({'where':{'id':_0x2c7360[_0xd5ee('0x61')]['id']},'include':[{'model':db[_0xd5ee('0x3f')],'as':_0xd5ee('0x3c')},{'model':db[_0xd5ee('0x40')],'as':_0xd5ee('0x3d')},{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x3d7375,null))[_0xd5ee('0x25')](function(_0x428785){if(!_0x428785)throw new Error(_0xd5ee('0x62'));if(_0x428785[_0xd5ee('0x39')])delete _0x2c7360['body']['Imap'];return _0x428785;})['then'](saveUpdates(_0x2c7360[_0xd5ee('0x5f')],null))['then'](function(_0x445529){if(!_0x2c7360['body']['Imap'])return _0x445529;return db[_0xd5ee('0x3f')]['update'](_0x2c7360['body'][_0xd5ee('0x3c')],{'where':{'MailAccountId':_0x445529['id']}})[_0xd5ee('0x25')](function(){return _0x445529;});})[_0xd5ee('0x25')](function(_0x530073){if(!_0x2c7360[_0xd5ee('0x5f')][_0xd5ee('0x3d')])return _0x530073;return db[_0xd5ee('0x40')][_0xd5ee('0x20')](_0x2c7360[_0xd5ee('0x5f')]['Smtp'],{'where':{'MailAccountId':_0x530073['id']}})['then'](function(){return _0x530073;});})[_0xd5ee('0x25')](respondWithResult(_0x3d7375,null))[_0xd5ee('0x16')](handleError(_0x3d7375,null));};exports[_0xd5ee('0x63')]=function(_0x7665df,_0x3562b1){return db[_0xd5ee('0x57')][_0xd5ee('0x63')]()['then'](respondWithResult(_0x3562b1,null))['catch'](handleError(_0x3562b1,null));};exports['addDisposition']=function(_0x4b0efe,_0x21432c){if(_0x4b0efe[_0xd5ee('0x5f')]['id']){delete _0x4b0efe[_0xd5ee('0x5f')]['id'];}return db[_0xd5ee('0x57')]['find']({'where':{'id':_0x4b0efe[_0xd5ee('0x61')]['id']}})['then'](handleEntityNotFound(_0x21432c,null))[_0xd5ee('0x25')](function(_0x44670e){if(_0x44670e){_0x4b0efe[_0xd5ee('0x5f')][_0xd5ee('0x64')]=_0x44670e['id'];return db[_0xd5ee('0x65')]['create'](_0x4b0efe[_0xd5ee('0x5f')]);}})[_0xd5ee('0x25')](respondWithResult(_0x21432c,null))['catch'](handleError(_0x21432c,null));};exports[_0xd5ee('0x66')]=function(_0x380599,_0x7938b0){var _0x54ef28={'raw':![],'where':{}};var _0x48b431={};var _0x16b521={'count':0x0,'rows':[]};return db[_0xd5ee('0x57')][_0xd5ee('0x67')]({'where':{'id':_0x380599[_0xd5ee('0x61')]['id']}})[_0xd5ee('0x25')](handleEntityNotFound(_0x7938b0,null))['then'](function(_0x522f2e){if(_0x522f2e){_0x48b431[_0xd5ee('0x46')]=_[_0xd5ee('0x5d')](db[_0xd5ee('0x65')]['rawAttributes']);_0x48b431['query']=_[_0xd5ee('0x5d')](_0x380599[_0xd5ee('0x47')]);_0x48b431[_0xd5ee('0x48')]=_['intersection'](_0x48b431[_0xd5ee('0x46')],_0x48b431['query']);_0x54ef28[_0xd5ee('0x49')]=_['intersection'](_0x48b431[_0xd5ee('0x46')],qs[_0xd5ee('0x4b')](_0x380599['query']['fields']));_0x54ef28['attributes']=_0x54ef28[_0xd5ee('0x49')]['length']?_0x54ef28[_0xd5ee('0x49')]:_0x48b431[_0xd5ee('0x46')];if(!_0x380599[_0xd5ee('0x47')][_0xd5ee('0x4d')](_0xd5ee('0x68'))){_0x54ef28['limit']=qs[_0xd5ee('0x4e')](_0x380599[_0xd5ee('0x47')][_0xd5ee('0x4e')]);_0x54ef28[_0xd5ee('0x1d')]=qs[_0xd5ee('0x1d')](_0x380599[_0xd5ee('0x47')]['offset']);}_0x54ef28[_0xd5ee('0x69')]=qs[_0xd5ee('0x4f')](_0x380599['query']['sort']);_0x54ef28[_0xd5ee('0x51')]=qs[_0xd5ee('0x48')](_['pick'](_0x380599[_0xd5ee('0x47')],_0x48b431[_0xd5ee('0x48')]));_0x54ef28[_0xd5ee('0x51')][_0xd5ee('0x64')]=_0x522f2e['id'];if(_0x380599[_0xd5ee('0x47')][_0xd5ee('0x55')]){_0x54ef28['where']=_[_0xd5ee('0x52')](_0x54ef28[_0xd5ee('0x51')],{'$or':_[_0xd5ee('0x43')](_0x54ef28['attributes'],function(_0x44fdcd){var _0x2a60f0={};_0x2a60f0[_0x44fdcd]={'$like':'%'+_0x380599[_0xd5ee('0x47')][_0xd5ee('0x55')]+'%'};return _0x2a60f0;})});}_0x54ef28=_[_0xd5ee('0x52')]({},_0x54ef28,_0x380599[_0xd5ee('0x56')]);return db['Disposition'][_0xd5ee('0x1c')]({'where':_0x54ef28[_0xd5ee('0x51')]})[_0xd5ee('0x25')](function(_0x178e57){_0x16b521[_0xd5ee('0x1c')]=_0x178e57;if(_0x380599['query'][_0xd5ee('0x58')]){_0x54ef28[_0xd5ee('0x59')]=[{'all':!![]}];}return db['Disposition'][_0xd5ee('0x5a')](_0x54ef28);})[_0xd5ee('0x25')](function(_0x138bbe){_0x16b521['rows']=_0x138bbe;return _0x16b521;});}})[_0xd5ee('0x25')](respondWithFilteredResult(_0x7938b0,_0x54ef28))[_0xd5ee('0x16')](handleError(_0x7938b0,null));};exports['removeDispositions']=function(_0x1035f3,_0x3ff3de){return db[_0xd5ee('0x57')][_0xd5ee('0x5e')]({'where':{'id':_0x1035f3[_0xd5ee('0x61')]['id']}})['then'](handleEntityNotFound(_0x3ff3de,null))['then'](function(_0x22c92f){if(_0x22c92f){return _0x22c92f[_0xd5ee('0x6a')](_0x1035f3['query']['ids']);}})[_0xd5ee('0x25')](respondWithStatusCode(_0x3ff3de,null))[_0xd5ee('0x16')](handleError(_0x3ff3de,null));};exports[_0xd5ee('0x6b')]=function(_0x4ce694,_0x1739c8){if(_0x4ce694['body']['id']){delete _0x4ce694[_0xd5ee('0x5f')]['id'];}return db[_0xd5ee('0x57')][_0xd5ee('0x5e')]({'where':{'id':_0x4ce694[_0xd5ee('0x61')]['id']}})[_0xd5ee('0x25')](handleEntityNotFound(_0x1739c8,null))[_0xd5ee('0x25')](function(_0x41d955){if(_0x41d955){_0x4ce694[_0xd5ee('0x5f')][_0xd5ee('0x64')]=_0x41d955['id'];return db[_0xd5ee('0x6c')]['create'](_0x4ce694['body']);}})[_0xd5ee('0x25')](respondWithResult(_0x1739c8,null))[_0xd5ee('0x16')](handleError(_0x1739c8,null));};exports[_0xd5ee('0x6d')]=function(_0x56b8b1,_0x213943){var _0x4c880d={'raw':![],'where':{}};var _0x3f9a21={};var _0x2b2aaf={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x56b8b1['params']['id']}})[_0xd5ee('0x25')](handleEntityNotFound(_0x213943,null))[_0xd5ee('0x25')](function(_0x88e739){if(_0x88e739){_0x3f9a21[_0xd5ee('0x46')]=_[_0xd5ee('0x5d')](db[_0xd5ee('0x6c')][_0xd5ee('0x44')]);_0x3f9a21[_0xd5ee('0x47')]=_[_0xd5ee('0x5d')](_0x56b8b1['query']);_0x3f9a21['filters']=_['intersection'](_0x3f9a21[_0xd5ee('0x46')],_0x3f9a21['query']);_0x4c880d[_0xd5ee('0x49')]=_[_0xd5ee('0x4a')](_0x3f9a21[_0xd5ee('0x46')],qs['fields'](_0x56b8b1[_0xd5ee('0x47')][_0xd5ee('0x4b')]));_0x4c880d[_0xd5ee('0x49')]=_0x4c880d[_0xd5ee('0x49')][_0xd5ee('0x4c')]?_0x4c880d[_0xd5ee('0x49')]:_0x3f9a21['model'];if(!_0x56b8b1[_0xd5ee('0x47')][_0xd5ee('0x4d')](_0xd5ee('0x68'))){_0x4c880d[_0xd5ee('0x4e')]=qs[_0xd5ee('0x4e')](_0x56b8b1[_0xd5ee('0x47')][_0xd5ee('0x4e')]);_0x4c880d[_0xd5ee('0x1d')]=qs[_0xd5ee('0x1d')](_0x56b8b1[_0xd5ee('0x47')][_0xd5ee('0x1d')]);}_0x4c880d[_0xd5ee('0x69')]=qs[_0xd5ee('0x4f')](_0x56b8b1[_0xd5ee('0x47')][_0xd5ee('0x4f')]);_0x4c880d[_0xd5ee('0x51')]=qs[_0xd5ee('0x48')](_[_0xd5ee('0x50')](_0x56b8b1['query'],_0x3f9a21[_0xd5ee('0x48')]));_0x4c880d[_0xd5ee('0x51')][_0xd5ee('0x64')]=_0x88e739['id'];if(_0x56b8b1[_0xd5ee('0x47')][_0xd5ee('0x55')]){_0x4c880d['where']=_[_0xd5ee('0x52')](_0x4c880d[_0xd5ee('0x51')],{'$or':_[_0xd5ee('0x43')](_0x4c880d['attributes'],function(_0x1fb188){var _0x2b30c7={};_0x2b30c7[_0x1fb188]={'$like':'%'+_0x56b8b1[_0xd5ee('0x47')][_0xd5ee('0x55')]+'%'};return _0x2b30c7;})});}_0x4c880d=_[_0xd5ee('0x52')]({},_0x4c880d,_0x56b8b1[_0xd5ee('0x56')]);return db[_0xd5ee('0x6c')][_0xd5ee('0x1c')]({'where':_0x4c880d[_0xd5ee('0x51')]})[_0xd5ee('0x25')](function(_0xdcd930){_0x2b2aaf[_0xd5ee('0x1c')]=_0xdcd930;if(_0x56b8b1[_0xd5ee('0x47')][_0xd5ee('0x58')]){_0x4c880d[_0xd5ee('0x59')]=[{'all':!![]}];}return db[_0xd5ee('0x6c')]['findAll'](_0x4c880d);})[_0xd5ee('0x25')](function(_0x6013e8){_0x2b2aaf[_0xd5ee('0x5b')]=_0x6013e8;return _0x2b2aaf;});}})[_0xd5ee('0x25')](respondWithFilteredResult(_0x213943,_0x4c880d))['catch'](handleError(_0x213943,null));};exports[_0xd5ee('0x6e')]=function(_0xcd7d79,_0x544ccc){return db['MailAccount']['find']({'where':{'id':_0xcd7d79[_0xd5ee('0x61')]['id']}})[_0xd5ee('0x25')](handleEntityNotFound(_0x544ccc,null))[_0xd5ee('0x25')](function(_0x382a5a){if(_0x382a5a){return _0x382a5a['removeAnswers'](_0xcd7d79[_0xd5ee('0x47')][_0xd5ee('0x6f')]);}})[_0xd5ee('0x25')](respondWithStatusCode(_0x544ccc,null))[_0xd5ee('0x16')](handleError(_0x544ccc,null));};exports['create']=function(_0x30f9c2,_0x762e60){var _0x1c6529={'name':_0x30f9c2[_0xd5ee('0x5f')][_0xd5ee('0x27')],'key':_0x30f9c2[_0xd5ee('0x5f')][_0xd5ee('0x45')],'provider':_0x30f9c2[_0xd5ee('0x5f')]['provider']===_0xd5ee('0x70')?null:_0x30f9c2[_0xd5ee('0x5f')]['provider'],'email':_0x30f9c2[_0xd5ee('0x5f')]['email'],'ListId':_0x30f9c2[_0xd5ee('0x5f')]['ListId'],'active':!_[_0xd5ee('0x71')](_0x30f9c2[_0xd5ee('0x5f')][_0xd5ee('0x72')])?_0x30f9c2['body'][_0xd5ee('0x72')]:!![],'description':_0x30f9c2[_0xd5ee('0x5f')][_0xd5ee('0x73')]||null};var _0x3cb9d6=getAuthenticationOptions(_0x1c6529['provider'],_0x30f9c2[_0xd5ee('0x5f')]);_0x1c6529['Imap']=_0x3cb9d6[_0xd5ee('0x3c')];_0x1c6529[_0xd5ee('0x3d')]=_0x3cb9d6['Smtp'];return db[_0xd5ee('0x57')]['create'](_0x1c6529,{'include':[{'model':db[_0xd5ee('0x40')],'as':'Smtp'},{'model':db[_0xd5ee('0x3f')],'as':'Imap'}]})[_0xd5ee('0x25')](function(_0x2b2163){var _0x117cfe=_0x30f9c2['user'][_0xd5ee('0x22')]({'plain':!![]});if(!_0x117cfe)throw new Error(_0xd5ee('0x74'));if(_0x117cfe['role']===_0xd5ee('0x32')){var _0x145ace=_0x2b2163[_0xd5ee('0x22')]({'plain':!![]});return db[_0xd5ee('0x75')][_0xd5ee('0x5e')]({'where':{'name':_0xd5ee('0x23'),'userProfileId':_0x117cfe['userProfileId']},'raw':!![]})[_0xd5ee('0x25')](function(_0x58b46b){if(_0x58b46b&&_0x58b46b['autoAssociation']===0x0){return db[_0xd5ee('0x24')]['create']({'name':_0x145ace[_0xd5ee('0x27')],'resourceId':_0x145ace['id'],'type':_0x58b46b[_0xd5ee('0x27')],'sectionId':_0x58b46b['id']},{})[_0xd5ee('0x25')](function(){return _0x2b2163;});}else{return _0x2b2163;}})[_0xd5ee('0x16')](function(_0x488000){logger[_0xd5ee('0x12')](_0xd5ee('0x76'),_0x488000);throw _0x488000;});}return _0x2b2163;})[_0xd5ee('0x25')](respondWithResult(_0x762e60,0xc9))['catch'](handleError(_0x762e60,null));};exports[_0xd5ee('0x77')]=function(_0x27ff45,_0x576a83){return db['MailAccount']['findOne']({'where':{'id':_0x27ff45['params']['id']}})[_0xd5ee('0x25')](handleEntityNotFound(_0x576a83,null))['then'](function(_0x4ac2a8){if(_0x4ac2a8){return _0x4ac2a8[_0xd5ee('0x77')]();}return null;})[_0xd5ee('0x25')](respondWithResult(_0x576a83,null))[_0xd5ee('0x16')](handleError(_0x576a83,null));};exports[_0xd5ee('0x78')]=function(_0x1d76ba,_0x19739e){if(_0x1d76ba[_0xd5ee('0x5f')]['id']){delete _0x1d76ba['body']['id'];}return db[_0xd5ee('0x57')][_0xd5ee('0x5e')]({'where':{'id':_0x1d76ba['params']['id']}})[_0xd5ee('0x25')](handleEntityNotFound(_0x19739e,null))['then'](function(_0x538c52){if(_0x538c52){_0x1d76ba[_0xd5ee('0x5f')][_0xd5ee('0x64')]=_0x538c52['id'];return db['MailServerIn'][_0xd5ee('0x79')](_0x1d76ba[_0xd5ee('0x5f')]);}})['then'](respondWithResult(_0x19739e,null))['catch'](handleError(_0x19739e,null));};exports['removeImap']=function(_0x2344a4,_0x13a491){return db[_0xd5ee('0x57')][_0xd5ee('0x67')]({'where':{'id':_0x2344a4[_0xd5ee('0x61')]['id']}})[_0xd5ee('0x25')](handleEntityNotFound(_0x13a491,null))[_0xd5ee('0x25')](function(_0x3df668){if(_0x3df668){return _0x3df668[_0xd5ee('0x7a')](null);}return null;})[_0xd5ee('0x25')](respondWithStatusCode(_0x13a491,null))[_0xd5ee('0x16')](handleError(_0x13a491,null));};exports[_0xd5ee('0x7b')]=function(_0x53fff7,_0x1fa74f){return db[_0xd5ee('0x57')][_0xd5ee('0x67')]({'where':{'id':_0x53fff7[_0xd5ee('0x61')]['id']}})[_0xd5ee('0x25')](handleEntityNotFound(_0x1fa74f,null))[_0xd5ee('0x25')](function(_0x114751){if(_0x114751){return _0x114751[_0xd5ee('0x7b')]();}return null;})['then'](respondWithResult(_0x1fa74f,null))[_0xd5ee('0x16')](handleError(_0x1fa74f,null));};exports['addSmtp']=function(_0x5c8255,_0x46a9b8){if(_0x5c8255['body']['id']){delete _0x5c8255[_0xd5ee('0x5f')]['id'];}return db['MailAccount']['find']({'where':{'id':_0x5c8255[_0xd5ee('0x61')]['id']}})[_0xd5ee('0x25')](handleEntityNotFound(_0x46a9b8,null))['then'](function(_0x473353){if(_0x473353){_0x5c8255['body'][_0xd5ee('0x64')]=_0x473353['id'];return db[_0xd5ee('0x40')][_0xd5ee('0x79')](_0x5c8255[_0xd5ee('0x5f')]);}})['then'](respondWithResult(_0x46a9b8,null))[_0xd5ee('0x16')](handleError(_0x46a9b8,null));};exports['removeSmtp']=function(_0x585b81,_0x3e6a3d){return db['MailAccount'][_0xd5ee('0x67')]({'where':{'id':_0x585b81[_0xd5ee('0x61')]['id']}})[_0xd5ee('0x25')](handleEntityNotFound(_0x3e6a3d,null))['then'](function(_0x4ace6d){if(_0x4ace6d){return _0x4ace6d[_0xd5ee('0x7c')](null);}return null;})[_0xd5ee('0x25')](respondWithStatusCode(_0x3e6a3d,null))[_0xd5ee('0x16')](handleError(_0x3e6a3d,null));};exports[_0xd5ee('0x7d')]=function(_0x293d88,_0x4ebba1){return db['MailInteraction'][_0xd5ee('0x5e')]({'where':{'id':_0x293d88[_0xd5ee('0x61')]['id']}})[_0xd5ee('0x25')](handleEntityNotFound(_0x4ebba1,null))[_0xd5ee('0x25')](function(_0x50a3d9){if(_0x50a3d9){return _0x50a3d9[_0xd5ee('0x7d')](_0x293d88[_0xd5ee('0x5f')][_0xd5ee('0x6f')],_[_0xd5ee('0x7e')](_0x293d88[_0xd5ee('0x5f')],[_0xd5ee('0x6f'),'id'])||{});}})[_0xd5ee('0x25')](respondWithResult(_0x4ebba1,null))['catch'](handleError(_0x4ebba1,null));};exports[_0xd5ee('0x7f')]=function(_0x4b8022,_0x1ddcd4){var _0x495a83={'raw':![],'where':{}};var _0x10f817={};var _0x3b8431={'count':0x0,'rows':[]};return db[_0xd5ee('0x57')][_0xd5ee('0x67')]({'where':{'id':_0x4b8022[_0xd5ee('0x61')]['id']}})[_0xd5ee('0x25')](handleEntityNotFound(_0x1ddcd4,null))['then'](function(_0x1292f5){if(_0x1292f5){_0x10f817[_0xd5ee('0x46')]=_[_0xd5ee('0x5d')](db[_0xd5ee('0x80')]['rawAttributes']);_0x10f817['query']=_[_0xd5ee('0x5d')](_0x4b8022[_0xd5ee('0x47')]);_0x10f817[_0xd5ee('0x48')]=_[_0xd5ee('0x4a')](_0x10f817[_0xd5ee('0x46')],_0x10f817[_0xd5ee('0x47')]);_0x495a83[_0xd5ee('0x49')]=_[_0xd5ee('0x4a')](_0x10f817[_0xd5ee('0x46')],qs['fields'](_0x4b8022[_0xd5ee('0x47')]['fields']));_0x495a83[_0xd5ee('0x49')]=_0x495a83[_0xd5ee('0x49')][_0xd5ee('0x4c')]?_0x495a83[_0xd5ee('0x49')]:_0x10f817['model'];if(!_0x4b8022[_0xd5ee('0x47')][_0xd5ee('0x4d')]('nolimit')){_0x495a83[_0xd5ee('0x4e')]=qs[_0xd5ee('0x4e')](_0x4b8022['query'][_0xd5ee('0x4e')]);_0x495a83[_0xd5ee('0x1d')]=qs[_0xd5ee('0x1d')](_0x4b8022['query'][_0xd5ee('0x1d')]);}_0x495a83[_0xd5ee('0x69')]=qs['sort'](_0x4b8022[_0xd5ee('0x47')][_0xd5ee('0x4f')]);_0x495a83[_0xd5ee('0x51')]=qs[_0xd5ee('0x48')](_[_0xd5ee('0x50')](_0x4b8022[_0xd5ee('0x47')],_0x10f817[_0xd5ee('0x48')]));_0x495a83[_0xd5ee('0x51')]['MailAccountId']=_0x1292f5['id'];if(_0x4b8022[_0xd5ee('0x47')][_0xd5ee('0x55')]){_0x495a83['where']=_[_0xd5ee('0x52')](_0x495a83[_0xd5ee('0x51')],{'$or':_[_0xd5ee('0x43')](_0x495a83['attributes'],function(_0x279313){var _0x557203={};_0x557203[_0x279313]={'$like':'%'+_0x4b8022[_0xd5ee('0x47')][_0xd5ee('0x55')]+'%'};return _0x557203;})});}_0x495a83=_[_0xd5ee('0x52')]({},_0x495a83,_0x4b8022[_0xd5ee('0x56')]);return db['MailInteraction'][_0xd5ee('0x1c')]({'where':_0x495a83['where']})[_0xd5ee('0x25')](function(_0x28b701){_0x3b8431[_0xd5ee('0x1c')]=_0x28b701;if(_0x4b8022[_0xd5ee('0x47')][_0xd5ee('0x58')]){_0x495a83[_0xd5ee('0x59')]=[{'model':db[_0xd5ee('0x81')],'as':_0xd5ee('0x82'),'required':![]},{'model':db[_0xd5ee('0x83')],'as':_0xd5ee('0x84'),'attributes':[_0xd5ee('0x27'),_0xd5ee('0x85'),_0xd5ee('0x86')],'required':![]},{'model':db[_0xd5ee('0x87')],'as':_0xd5ee('0x88'),'attributes':['id',_0xd5ee('0x27'),_0xd5ee('0x89')],'where':_0x4b8022['query']['tag']?{'id':_0x4b8022['query'][_0xd5ee('0x8a')]}:undefined,'required':_0x4b8022['query'][_0xd5ee('0x8a')]?!![]:![]}];}return db[_0xd5ee('0x80')][_0xd5ee('0x5a')](_0x495a83);})[_0xd5ee('0x25')](function(_0x22b6da){_0x3b8431['rows']=_0x22b6da;return _0x3b8431;});}})[_0xd5ee('0x25')](respondWithFilteredResult(_0x1ddcd4,_0x495a83))[_0xd5ee('0x16')](handleError(_0x1ddcd4,null));};exports['addApplications']=function addApplications(_0x34060b,_0x40e1fd){var _0x3ff44e=_0x34060b['params']['id'];var _0x1c4722=_0x34060b[_0xd5ee('0x5f')];var _0x7c7a86=0xc8;var _0x3d3956=null;return db[_0xd5ee('0x8b')][_0xd5ee('0x8c')]({'isolationLevel':db[_0xd5ee('0x8b')][_0xd5ee('0x8d')][_0xd5ee('0x8e')][_0xd5ee('0x8f')]},function(_0x3e56b5){return db[_0xd5ee('0x57')]['findOne']({'where':{'id':_0x3ff44e},'transaction':_0x3e56b5})[_0xd5ee('0x25')](function(_0x5dbd72){if(_0x5dbd72){return db[_0xd5ee('0x90')][_0xd5ee('0x21')]({'where':{'MailAccountId':_0x3ff44e},'transaction':_0x3e56b5})[_0xd5ee('0x25')](function(){var _0x17a660=_[_0xd5ee('0x43')](_0x1c4722,function(_0x2f2e54){_0x2f2e54[_0xd5ee('0x64')]=_0x3ff44e;return _0x2f2e54;});return db['MailApplication'][_0xd5ee('0x91')](_0x17a660,{'transaction':_0x3e56b5});});}else{_0x7c7a86=0x194;_0x3d3956=[];}});})[_0xd5ee('0x25')](function(){if(_0x7c7a86!==0x194){return db['MailApplication'][_0xd5ee('0x92')]({'where':{'MailAccountId':_0x3ff44e},'order':'priority'})[_0xd5ee('0x25')](function(_0x234e4d){_0x3d3956=_0x234e4d;});}})[_0xd5ee('0x16')](function(_0x34ea4b){_0x7c7a86=0x1f4;logger[_0xd5ee('0x12')](_0x34ea4b[_0xd5ee('0x26')]);if(_0x34ea4b[_0xd5ee('0x27')]){delete _0x34ea4b[_0xd5ee('0x27')];}_0x3d3956=_0x34ea4b;})[_0xd5ee('0x93')](function(){if(_0x3d3956===null){_0x40e1fd[_0xd5ee('0x17')](_0x7c7a86);}else{if(_0x7c7a86===0x1f4){_0x40e1fd['status'](_0x7c7a86)[_0xd5ee('0x28')](_0x3d3956);}else{_0x40e1fd[_0xd5ee('0x18')](_0x7c7a86)[_0xd5ee('0x1a')](_0x3d3956);}}});};exports[_0xd5ee('0x94')]=function(_0x1cd593,_0x249f7c){var _0x270db9={};var _0x38a8a6={};var _0x2c221b;var _0x192746;return db[_0xd5ee('0x57')]['findOne']({'where':{'id':_0x1cd593[_0xd5ee('0x61')]['id']}})['then'](handleEntityNotFound(_0x249f7c,null))[_0xd5ee('0x25')](function(_0x22705b){if(_0x22705b){_0x2c221b=_0x22705b;_0x38a8a6['model']=_[_0xd5ee('0x5d')](db['MailApplication']['rawAttributes']);_0x38a8a6[_0xd5ee('0x47')]=_[_0xd5ee('0x5d')](_0x1cd593[_0xd5ee('0x47')]);_0x38a8a6['filters']=_['intersection'](_0x38a8a6[_0xd5ee('0x46')],_0x38a8a6[_0xd5ee('0x47')]);_0x270db9['attributes']=_[_0xd5ee('0x4a')](_0x38a8a6[_0xd5ee('0x46')],qs[_0xd5ee('0x4b')](_0x1cd593[_0xd5ee('0x47')][_0xd5ee('0x4b')]));_0x270db9['attributes']=_0x270db9[_0xd5ee('0x49')][_0xd5ee('0x4c')]?_0x270db9[_0xd5ee('0x49')]:_0x38a8a6[_0xd5ee('0x46')];_0x270db9[_0xd5ee('0x69')]=qs[_0xd5ee('0x4f')](_0x1cd593[_0xd5ee('0x47')]['sort']);_0x270db9[_0xd5ee('0x51')]=qs[_0xd5ee('0x48')](_['pick'](_0x1cd593[_0xd5ee('0x47')],_0x38a8a6[_0xd5ee('0x48')]));if(_0x1cd593[_0xd5ee('0x47')][_0xd5ee('0x55')]){_0x270db9[_0xd5ee('0x51')]=_[_0xd5ee('0x52')](_0x270db9[_0xd5ee('0x51')],{'$or':_[_0xd5ee('0x43')](_0x270db9[_0xd5ee('0x49')],function(_0x19e219){var _0x2afa55={};_0x2afa55[_0x19e219]={'$like':'%'+_0x1cd593[_0xd5ee('0x47')][_0xd5ee('0x55')]+'%'};return _0x2afa55;})});}_0x270db9=_[_0xd5ee('0x52')]({},_0x270db9,_0x1cd593[_0xd5ee('0x56')]);return _0x2c221b[_0xd5ee('0x94')](_0x270db9);}})[_0xd5ee('0x25')](function(_0x1b6736){if(_0x1b6736){_0x192746=_0x1b6736['length'];if(!_0x1cd593[_0xd5ee('0x47')][_0xd5ee('0x4d')](_0xd5ee('0x68'))){_0x270db9[_0xd5ee('0x4e')]=qs[_0xd5ee('0x4e')](_0x1cd593[_0xd5ee('0x47')][_0xd5ee('0x4e')]);_0x270db9['offset']=qs[_0xd5ee('0x1d')](_0x1cd593[_0xd5ee('0x47')]['offset']);}return _0x2c221b[_0xd5ee('0x94')](_0x270db9);}})[_0xd5ee('0x25')](function(_0x2123c2){if(_0x2123c2){return _0x2123c2?{'count':_0x192746,'rows':_0x2123c2}:null;}})[_0xd5ee('0x25')](respondWithResult(_0x249f7c,null))[_0xd5ee('0x16')](handleError(_0x249f7c,null));};exports['getMessages']=function(_0x2adcdb,_0x14d9b0){var _0x2f8a92={'raw':!![],'where':{}};var _0x1eece9={};var _0x176eee={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x2adcdb[_0xd5ee('0x61')]['id']}})[_0xd5ee('0x25')](handleEntityNotFound(_0x14d9b0,null))[_0xd5ee('0x25')](function(_0x368cec){if(_0x368cec){_0x1eece9['model']=_[_0xd5ee('0x5d')](db[_0xd5ee('0x95')][_0xd5ee('0x44')]);_0x1eece9[_0xd5ee('0x47')]=_[_0xd5ee('0x5d')](_0x2adcdb['query']);_0x1eece9['filters']=_['intersection'](_0x1eece9[_0xd5ee('0x46')],_0x1eece9[_0xd5ee('0x47')]);_0x2f8a92[_0xd5ee('0x49')]=_[_0xd5ee('0x4a')](_0x1eece9[_0xd5ee('0x46')],qs[_0xd5ee('0x4b')](_0x2adcdb[_0xd5ee('0x47')]['fields']));_0x2f8a92[_0xd5ee('0x49')]=_0x2f8a92[_0xd5ee('0x49')][_0xd5ee('0x4c')]?_0x2f8a92[_0xd5ee('0x49')]:_0x1eece9[_0xd5ee('0x46')];if(!_0x2adcdb['query'][_0xd5ee('0x4d')](_0xd5ee('0x68'))){_0x2f8a92[_0xd5ee('0x4e')]=qs['limit'](_0x2adcdb[_0xd5ee('0x47')]['limit']);_0x2f8a92[_0xd5ee('0x1d')]=qs['offset'](_0x2adcdb['query'][_0xd5ee('0x1d')]);}_0x2f8a92['order']=qs[_0xd5ee('0x4f')](_0x2adcdb[_0xd5ee('0x47')]['sort']);_0x2f8a92[_0xd5ee('0x51')]=qs[_0xd5ee('0x48')](_[_0xd5ee('0x50')](_0x2adcdb[_0xd5ee('0x47')],_0x1eece9[_0xd5ee('0x48')]));_0x2f8a92[_0xd5ee('0x51')]['MailAccountId']=_0x368cec['id'];if(_0x2adcdb['query'][_0xd5ee('0x55')]){_0x2f8a92[_0xd5ee('0x51')]=_[_0xd5ee('0x52')](_0x2f8a92[_0xd5ee('0x51')],{'$or':_[_0xd5ee('0x43')](_0x2f8a92[_0xd5ee('0x49')],function(_0x23fa1a){var _0x1f98ca={};_0x1f98ca[_0x23fa1a]={'$like':'%'+_0x2adcdb['query'][_0xd5ee('0x55')]+'%'};return _0x1f98ca;})});}if(_0x2adcdb[_0xd5ee('0x47')][_0xd5ee('0x96')]){var _0x2e9caf=_0x2adcdb[_0xd5ee('0x47')][_0xd5ee('0x96')]['split'](',');var _0x324844={};_0x324844[_0x2e9caf[0x0]]={'$gte':moment(_0x2e9caf[0x1])[_0xd5ee('0x97')]('YYYY-MM-DD\x20HH:mm:ss')};_0x2f8a92['where']=_[_0xd5ee('0x52')](_0x2f8a92[_0xd5ee('0x51')],_0x324844);}_0x2f8a92=_[_0xd5ee('0x52')]({},_0x2f8a92,_0x2adcdb[_0xd5ee('0x56')]);return db['MailMessage'][_0xd5ee('0x1c')]({'where':_0x2f8a92[_0xd5ee('0x51')]})[_0xd5ee('0x25')](function(_0x3d6e90){_0x176eee[_0xd5ee('0x1c')]=_0x3d6e90;if(_0x2adcdb[_0xd5ee('0x47')][_0xd5ee('0x58')]){_0x2f8a92[_0xd5ee('0x59')]=[{'all':!![]}];}return db[_0xd5ee('0x95')][_0xd5ee('0x5a')](_0x2f8a92);})[_0xd5ee('0x25')](function(_0x102f91){if(_0x2adcdb['query'][_0xd5ee('0x98')]==='true'){for(var _0x27b144=0x0;_0x27b144<_0x102f91[_0xd5ee('0x4c')];_0x27b144++){_0x102f91[_0x27b144][_0xd5ee('0x5f')]=juice(_0x102f91[_0x27b144][_0xd5ee('0x5f')]);}}_0x176eee[_0xd5ee('0x5b')]=_0x102f91;return _0x176eee;});}})[_0xd5ee('0x25')](respondWithFilteredResult(_0x14d9b0,_0x2f8a92))[_0xd5ee('0x16')](handleError(_0x14d9b0,null));};exports[_0xd5ee('0x28')]=function(_0x4d626b,_0x3cd8cb){var _0x271ed2,_0x3cff86={},_0x561bd9;if(_0x4d626b[_0xd5ee('0x5f')]['to']){_0x561bd9=_0x4d626b[_0xd5ee('0x5f')]['to'][_0xd5ee('0x99')](',')[0x0];}return db['MailAccount']['find']({'where':{'id':_0x4d626b['params']['id']},'include':[{'model':db[_0xd5ee('0x9a')],'as':_0xd5ee('0x9b'),'include':[{'model':db[_0xd5ee('0x81')],'as':_0xd5ee('0x9c'),'where':{'email':_0x561bd9},'limit':0x1,'order':[[_0xd5ee('0x9d'),_0xd5ee('0x9e')]]}]},{'model':db[_0xd5ee('0x40')],'as':_0xd5ee('0x3d'),'raw':!![],'include':[{'model':db[_0xd5ee('0x9f')],'as':'CloudProvider','raw':!![]}]}]})['then'](handleEntityNotFound(_0x3cd8cb,null))['then'](function(_0x113365){if(!_0x113365)return;_0x271ed2=_0x113365;if(!_0x113365['Smtp'])throw new Error(_0xd5ee('0xa0'));if(_[_0xd5ee('0x71')](_0x4d626b[_0xd5ee('0x5f')][_0xd5ee('0xa1')])){_0x4d626b[_0xd5ee('0x5f')][_0xd5ee('0xa1')]=util[_0xd5ee('0x97')](_0xd5ee('0xa2'),_0x113365[_0xd5ee('0x27')],_0x113365['email']||_0x113365['Smtp'][_0xd5ee('0x32')]);}if(_0x4d626b[_0xd5ee('0x5f')][_0xd5ee('0xa3')]&&_0x4d626b['body'][_0xd5ee('0xa3')]['length']){for(var _0x279fac=0x0;_0x279fac<_0x4d626b[_0xd5ee('0x5f')][_0xd5ee('0xa3')]['length'];_0x279fac+=0x1){_0x4d626b['body'][_0xd5ee('0xa3')][_0x279fac]={'filename':_0x4d626b['body'][_0xd5ee('0xa3')][_0x279fac][_0xd5ee('0x27')],'path':path[_0xd5ee('0xa4')](config[_0xd5ee('0xa5')],_0xd5ee('0xa6'),_0x4d626b[_0xd5ee('0x5f')]['attachments'][_0x279fac][_0xd5ee('0xa7')])};}}var _0x4a19d0=_0x113365['getSmtpOptions']();return respondWithRpcPromise(_0xd5ee('0xa8'),_0xd5ee('0xa9'),{'account':_0x4a19d0,'message':_0x4d626b[_0xd5ee('0x5f')]});})[_0xd5ee('0x25')](function(_0x4881e9){if(!_0x4881e9)return;_0x3cff86=_0x4881e9;if(!_0x271ed2['List'])throw new Error('List\x20not\x20found');if(_0x271ed2[_0xd5ee('0x9b')]['Contacts'][_0xd5ee('0x4c')])return _0x271ed2[_0xd5ee('0x9b')][_0xd5ee('0x9c')][0x0];return db[_0xd5ee('0x81')][_0xd5ee('0x79')](_[_0xd5ee('0xaa')](_0x4d626b[_0xd5ee('0x5f')],{'firstName':_0x4d626b['body']['to'],'email':_0x4d626b['body']['to'],'phone':_0x4d626b[_0xd5ee('0x5f')]['to'],'ListId':_0x271ed2[_0xd5ee('0xab')]}));})[_0xd5ee('0x25')](function(_0x4efae3){if(!_0x4efae3)return;var _0x2c1ae0={'UserId':_0x4d626b['user']['id'],'ContactId':_0x4efae3['id'],'MailAccountId':_0x271ed2['id'],'inReplyTo':_0x3cff86['messageId'],'to':_0x4d626b[_0xd5ee('0x5f')][_0xd5ee('0xa1')],'cc':_0x4d626b['body']['cc'],'subject':_0x4d626b['body'][_0xd5ee('0xac')],'attach':_0x4d626b[_0xd5ee('0x5f')][_0xd5ee('0xad')],'firstMsgDirection':_0xd5ee('0xae'),'lastMsgAt':moment()[_0xd5ee('0x97')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'out','Messages':[_[_0xd5ee('0x52')](_0x4d626b[_0xd5ee('0x5f')],{'messageId':_0x3cff86[_0xd5ee('0xaf')],'sentAt':moment()[_0xd5ee('0x97')]('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x271ed2['id'],'UserId':_0x4d626b[_0xd5ee('0x32')]['id'],'ContactId':_0x4efae3['id']})]};if(_0x4d626b[_0xd5ee('0x5f')][_0xd5ee('0xb0')]){_0x2c1ae0=_[_0xd5ee('0x52')](_0x2c1ae0,_0x4d626b[_0xd5ee('0x5f')][_0xd5ee('0xb0')]);}return db[_0xd5ee('0x80')][_0xd5ee('0x79')](_0x2c1ae0,{'include':[{'model':db[_0xd5ee('0x95')],'as':_0xd5ee('0xb1')}]});})['then'](respondWithResult(_0x3cd8cb,null))[_0xd5ee('0x16')](handleError(_0x3cd8cb,null));};exports['verifySmtp']=function(_0x2888d9,_0x3a5792){return db[_0xd5ee('0x57')]['find']({'where':{'id':_0x2888d9[_0xd5ee('0x61')]['id']},'include':[{'model':db[_0xd5ee('0x40')],'as':'Smtp','raw':!![],'include':[{'model':db[_0xd5ee('0x9f')],'as':_0xd5ee('0x9f'),'raw':!![]}]}]})[_0xd5ee('0x25')](handleEntityNotFound(_0x3a5792,null))[_0xd5ee('0x25')](function(_0x1f8f0d){if(!_0x1f8f0d[_0xd5ee('0x3d')])return;var _0x1edac9=_0x1f8f0d[_0xd5ee('0xb2')]();return respondWithRpcPromise(_0xd5ee('0xb3'),_0xd5ee('0xb4'),{'account':_0x1edac9});})[_0xd5ee('0x25')](respondWithResult(_0x3a5792,null))['catch'](handleError(_0x3a5792,null));};exports['destroy']=function(_0x1bf0f2,_0x4be567){return db[_0xd5ee('0x57')][_0xd5ee('0x5e')]({'where':{'id':_0x1bf0f2['params']['id']}})[_0xd5ee('0x25')](handleEntityNotFound(_0x4be567,null))[_0xd5ee('0x25')](function(_0x1a4873){if(_0x1a4873&&_0x1a4873[_0xd5ee('0x39')]){throw new db[(_0xd5ee('0xb5'))][(_0xd5ee('0xb6'))](_0xd5ee('0xb7'));}return _0x1a4873;})[_0xd5ee('0x25')](removeEntity(_0x4be567,null))[_0xd5ee('0x16')](handleError(_0x4be567,null));};exports[_0xd5ee('0xb8')]=function(_0x28b64e,_0x779105){return db['MailAccount'][_0xd5ee('0x5e')]({'where':{'id':_0x28b64e[_0xd5ee('0x61')]['id']}})['then'](handleEntityNotFound(_0x779105,null))[_0xd5ee('0x25')](function(_0x2e6fed){if(_0x2e6fed){return _0x2e6fed[_0xd5ee('0xb8')](_0x28b64e[_0xd5ee('0x5f')][_0xd5ee('0x6f')],_['omit'](_0x28b64e[_0xd5ee('0x5f')],[_0xd5ee('0x6f'),'id'])||{})[_0xd5ee('0xb9')](function(_0x46c846){for(var _0x5cfaf0=0x0;_0x5cfaf0<_0x28b64e[_0xd5ee('0x5f')][_0xd5ee('0x6f')][_0xd5ee('0x4c')];_0x5cfaf0+=0x1){socket[_0xd5ee('0xba')]('userMailAccount:save',{'UserId':Number(_0x28b64e['body']['ids'][_0x5cfaf0]),'MailAccountId':Number(_0x28b64e[_0xd5ee('0x61')]['id'])});}return _0x46c846;});}})['then'](respondWithResult(_0x779105,null))[_0xd5ee('0x16')](handleError(_0x779105,null));};exports['removeAgents']=function(_0x384c93,_0x512017){return db[_0xd5ee('0x57')][_0xd5ee('0x5e')]({'where':{'id':_0x384c93[_0xd5ee('0x61')]['id']}})[_0xd5ee('0x25')](handleEntityNotFound(_0x512017,null))[_0xd5ee('0x25')](function(_0x3837dd){if(_0x3837dd){return _0x3837dd[_0xd5ee('0xbb')](_0x384c93['query'][_0xd5ee('0x6f')])[_0xd5ee('0x25')](function(){if(_['isArray'](_0x384c93[_0xd5ee('0x47')]['ids'])){for(var _0x59c102=0x0;_0x59c102<_0x384c93[_0xd5ee('0x47')][_0xd5ee('0x6f')][_0xd5ee('0x4c')];_0x59c102+=0x1){socket['emit'](_0xd5ee('0xbc'),{'UserId':Number(_0x384c93[_0xd5ee('0x47')][_0xd5ee('0x6f')][_0x59c102]),'MailAccountId':Number(_0x384c93[_0xd5ee('0x61')]['id'])});}}else{socket[_0xd5ee('0xba')]('userMailAccount:remove',{'UserId':Number(_0x384c93['query'][_0xd5ee('0x6f')]),'MailAccountId':Number(_0x384c93[_0xd5ee('0x61')]['id'])});}});}})['then'](respondWithStatusCode(_0x512017,null))[_0xd5ee('0x16')](handleError(_0x512017,null));};exports['getAgents']=function(_0x2f66ae,_0x1d1c73){var _0x5affcf={};var _0x227d56={};var _0x1bc5b8;var _0x124a5b;return db['MailAccount']['findOne']({'where':{'id':_0x2f66ae[_0xd5ee('0x61')]['id']}})[_0xd5ee('0x25')](handleEntityNotFound(_0x1d1c73,null))[_0xd5ee('0x25')](function(_0x330601){if(_0x330601){_0x1bc5b8=_0x330601;_0x227d56[_0xd5ee('0x46')]=_[_0xd5ee('0x5d')](db[_0xd5ee('0x83')][_0xd5ee('0x44')]);_0x227d56[_0xd5ee('0x47')]=_[_0xd5ee('0x5d')](_0x2f66ae[_0xd5ee('0x47')]);_0x227d56[_0xd5ee('0x48')]=_[_0xd5ee('0x4a')](_0x227d56[_0xd5ee('0x46')],_0x227d56['query']);_0x5affcf['attributes']=_[_0xd5ee('0x4a')](_0x227d56['model'],qs['fields'](_0x2f66ae['query'][_0xd5ee('0x4b')]));_0x5affcf[_0xd5ee('0x49')]=_0x5affcf['attributes'][_0xd5ee('0x4c')]?_0x5affcf['attributes']:_0x227d56[_0xd5ee('0x46')];_0x5affcf['order']=qs[_0xd5ee('0x4f')](_0x2f66ae['query'][_0xd5ee('0x4f')]);_0x5affcf['where']=qs[_0xd5ee('0x48')](_['pick'](_0x2f66ae['query'],_0x227d56[_0xd5ee('0x48')]));if(_0x2f66ae[_0xd5ee('0x47')][_0xd5ee('0x55')]){_0x5affcf[_0xd5ee('0x51')]=_[_0xd5ee('0x52')](_0x5affcf['where'],{'$or':_[_0xd5ee('0x43')](_0x5affcf['attributes'],function(_0x1f1804){var _0x2cf47e={};_0x2cf47e[_0x1f1804]={'$like':'%'+_0x2f66ae[_0xd5ee('0x47')][_0xd5ee('0x55')]+'%'};return _0x2cf47e;})});}_0x5affcf=_[_0xd5ee('0x52')]({},_0x5affcf,_0x2f66ae[_0xd5ee('0x56')]);return _0x1bc5b8['getAgents'](_0x5affcf);}})[_0xd5ee('0x25')](function(_0x1c49a2){if(_0x1c49a2){_0x124a5b=_0x1c49a2[_0xd5ee('0x4c')];if(!_0x2f66ae[_0xd5ee('0x47')][_0xd5ee('0x4d')](_0xd5ee('0x68'))){_0x5affcf[_0xd5ee('0x4e')]=qs['limit'](_0x2f66ae['query'][_0xd5ee('0x4e')]);_0x5affcf[_0xd5ee('0x1d')]=qs[_0xd5ee('0x1d')](_0x2f66ae[_0xd5ee('0x47')][_0xd5ee('0x1d')]);}return _0x1bc5b8['getAgents'](_0x5affcf);}})[_0xd5ee('0x25')](function(_0xa34172){if(_0xa34172){return _0xa34172?{'count':_0x124a5b,'rows':_0xa34172}:null;}})[_0xd5ee('0x25')](respondWithResult(_0x1d1c73,null))['catch'](handleError(_0x1d1c73,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 645f459..dcce699 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 _0x25ed=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x25ed,0x1e8));var _0xd25e=function(_0x42f247,_0x5bbeca){_0x42f247=_0x42f247-0x0;var _0x411317=_0x25ed[_0x42f247];return _0x411317;};'use strict';var EventEmitter=require(_0xd25e('0x0'));var MailAccount=require(_0xd25e('0x1'))['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xd25e('0x2')](0x0);var events={'afterCreate':_0xd25e('0x3'),'afterUpdate':_0xd25e('0x4'),'afterDestroy':_0xd25e('0x5')};function emitEvent(_0x20c44f){return function(_0x38aba1,_0x470789,_0x176105){MailAccountEvents[_0xd25e('0x6')](_0x20c44f+':'+_0x38aba1['id'],_0x38aba1);MailAccountEvents[_0xd25e('0x6')](_0x20c44f,_0x38aba1);_0x176105(null);};}for(var e in events){if(events[_0xd25e('0x7')](e)){var event=events[e];MailAccount[_0xd25e('0x8')](e,emitEvent(event));}}module[_0xd25e('0x9')]=MailAccountEvents; \ No newline at end of file +var _0xd4f4=['setMaxListeners','save','emit','hook','events'];(function(_0x2ae6a9,_0x311e26){var _0x2f2ceb=function(_0x499d95){while(--_0x499d95){_0x2ae6a9['push'](_0x2ae6a9['shift']());}};_0x2f2ceb(++_0x311e26);}(_0xd4f4,0x1bc));var _0x4d4f=function(_0x4e571d,_0x152b48){_0x4e571d=_0x4e571d-0x0;var _0x3c4ebc=_0xd4f4[_0x4e571d];return _0x3c4ebc;};'use strict';var EventEmitter=require(_0x4d4f('0x0'));var MailAccount=require('../../mysqldb')['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x4d4f('0x1')](0x0);var events={'afterCreate':_0x4d4f('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x160665){return function(_0x48e54e,_0x49f0ac,_0x41e226){MailAccountEvents[_0x4d4f('0x3')](_0x160665+':'+_0x48e54e['id'],_0x48e54e);MailAccountEvents[_0x4d4f('0x3')](_0x160665,_0x48e54e);_0x41e226(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailAccount[_0x4d4f('0x4')](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 4724379..8c53bc2 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 _0x50d7=['auth','OAuth2','CloudProvider','data5','pass','./mailAccount.attributes','exports','mail_accounts','provider','custom','host','port','Smtp','secure','authentication','modernAuthentication','Cloud\x20Provider\x20configuration\x20not\x20found'];(function(_0x4f03b6,_0x2797dc){var _0x5ab5de=function(_0x3ec16e){while(--_0x3ec16e){_0x4f03b6['push'](_0x4f03b6['shift']());}};_0x5ab5de(++_0x2797dc);}(_0x50d7,0x159));var _0x750d=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x50d7[_0x432682];return _0x463d05;};'use strict';var attributes=require(_0x750d('0x0'));module[_0x750d('0x1')]=function(_0x1472f){return _0x1472f['define']('MailAccount',attributes,{'tableName':_0x750d('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x14bf84=this;var _0x2b597a={'id':_0x14bf84['id'],'tls':{'rejectUnauthorized':![]}};if(_0x14bf84[_0x750d('0x3')]!==_0x750d('0x4')){_0x2b597a['service']=_0x14bf84[_0x750d('0x3')];}else{_0x2b597a[_0x750d('0x5')]=_0x14bf84['Smtp'][_0x750d('0x5')];_0x2b597a[_0x750d('0x6')]=_0x14bf84[_0x750d('0x7')][_0x750d('0x6')];_0x2b597a[_0x750d('0x8')]=_0x14bf84[_0x750d('0x7')][_0x750d('0x8')];}if(_0x14bf84[_0x750d('0x7')][_0x750d('0x9')]){if(_0x14bf84[_0x750d('0x7')][_0x750d('0xa')]){if(!_0x14bf84['Smtp']['CloudProvider'])throw new Error(_0x750d('0xb'));_0x2b597a[_0x750d('0xc')]={'type':_0x750d('0xd'),'user':_0x14bf84['Smtp']['user'],'accessToken':_0x14bf84[_0x750d('0x7')][_0x750d('0xe')][_0x750d('0xf')]};}else{_0x2b597a[_0x750d('0xc')]={'user':_0x14bf84[_0x750d('0x7')]['user'],'pass':_0x14bf84[_0x750d('0x7')][_0x750d('0x10')]};}}return _0x2b597a;}}});}; \ No newline at end of file +var _0x93d3=['custom','host','Smtp','port','secure','authentication','modernAuthentication','CloudProvider','OAuth2','user','data5','auth','pass','mail_accounts','provider'];(function(_0xd67723,_0x1e576f){var _0x53b62b=function(_0x2460a3){while(--_0x2460a3){_0xd67723['push'](_0xd67723['shift']());}};_0x53b62b(++_0x1e576f);}(_0x93d3,0x157));var _0x393d=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0x93d3[_0x2064e5];return _0x21a233;};'use strict';var attributes=require('./mailAccount.attributes');module['exports']=function(_0xdc2d93){return _0xdc2d93['define']('MailAccount',attributes,{'tableName':_0x393d('0x0'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x2312ce=this;var _0x369cae={'id':_0x2312ce['id'],'tls':{'rejectUnauthorized':![]}};if(_0x2312ce[_0x393d('0x1')]!==_0x393d('0x2')){_0x369cae['service']=_0x2312ce['provider'];}else{_0x369cae[_0x393d('0x3')]=_0x2312ce[_0x393d('0x4')][_0x393d('0x3')];_0x369cae[_0x393d('0x5')]=_0x2312ce[_0x393d('0x4')][_0x393d('0x5')];_0x369cae['secure']=_0x2312ce[_0x393d('0x4')][_0x393d('0x6')];}if(_0x2312ce[_0x393d('0x4')][_0x393d('0x7')]){if(_0x2312ce[_0x393d('0x4')][_0x393d('0x8')]){if(!_0x2312ce[_0x393d('0x4')][_0x393d('0x9')])throw new Error('Cloud\x20Provider\x20configuration\x20not\x20found');_0x369cae['auth']={'type':_0x393d('0xa'),'user':_0x2312ce[_0x393d('0x4')][_0x393d('0xb')],'accessToken':_0x2312ce['Smtp'][_0x393d('0x9')][_0x393d('0xc')]};}else{_0x369cae[_0x393d('0xd')]={'user':_0x2312ce['Smtp']['user'],'pass':_0x2312ce['Smtp'][_0x393d('0xe')]};}}return _0x369cae;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index a4c8c0f..20f68cc 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 _0x4074=['attachments','originCc','bcc','ChatWebsiteId','Email','Attachment','Attachments','UserId','User','name','unshift','waitForTheAssignedAgent','*,*,*,*','MailQueue','queueId','queue','waitForTheAssignedQueue','startRouting','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./mailAccount.socket','register','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetMailAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowMailAccount','find','smtp','smtpOptions','getSmtpOptions','stringify','NotifyMailAccount','body','difference','keys','CmContact','rawAttributes','createdAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','account','CmList','List','updatedAt','DESC','Applications','MailServerOut','CloudProvider','omit','applications','list','orderBy','priority','asc','length','close','autoclose','create','List\x20not\x20found','contact','messageId','generate','subject','attach','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','Messages','inReplyTo','Contact\x20not\x20found','update','format','interaction','created','MailMessage'];(function(_0x880f9d,_0x1f3b16){var _0x1e7a2f=function(_0x5e6ed8){while(--_0x5e6ed8){_0x880f9d['push'](_0x880f9d['shift']());}};_0x1e7a2f(++_0x1f3b16);}(_0x4074,0xf0));var _0x4407=function(_0x520e2b,_0x12fe72){_0x520e2b=_0x520e2b-0x0;var _0x4bfd5e=_0x4074[_0x520e2b];return _0x4bfd5e;};'use strict';var _=require(_0x4407('0x0'));var moment=require(_0x4407('0x1'));var BPromise=require(_0x4407('0x2'));var rs=require('randomstring');var Redis=require(_0x4407('0x3'));var db=require(_0x4407('0x4'))['db'];var logger=require(_0x4407('0x5'))(_0x4407('0x6'));var config=require(_0x4407('0x7'));var jayson=require(_0x4407('0x8'));var client=jayson[_0x4407('0x9')][_0x4407('0xa')]({'port':0x232c});config[_0x4407('0xb')]=_[_0x4407('0xc')](config['redis'],{'host':_0x4407('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4407('0xb')]));require(_0x4407('0xe'))[_0x4407('0xf')](socket);function respondWithRpcPromise(_0x54b465,_0x5e70a5,_0x59d74f){return new BPromise(function(_0x801db8,_0x74e6f8){return client[_0x4407('0x10')](_0x54b465,_0x59d74f)[_0x4407('0x11')](function(_0x36cde5){logger[_0x4407('0x12')](_0x4407('0x13'),_0x5e70a5,_0x4407('0x14'));logger[_0x4407('0x15')](_0x4407('0x16'),_0x5e70a5,_0x4407('0x14'),JSON['stringify'](_0x36cde5));if(_0x36cde5[_0x4407('0x17')]){if(_0x36cde5[_0x4407('0x17')]['code']===0x1f4){logger[_0x4407('0x17')]('MailAccount,\x20%s,\x20%s',_0x5e70a5,_0x36cde5[_0x4407('0x17')][_0x4407('0x18')]);return _0x74e6f8(_0x36cde5[_0x4407('0x17')][_0x4407('0x18')]);}logger[_0x4407('0x17')](_0x4407('0x13'),_0x5e70a5,_0x36cde5[_0x4407('0x17')][_0x4407('0x18')]);return _0x801db8(_0x36cde5['error'][_0x4407('0x18')]);}else{logger[_0x4407('0x12')](_0x4407('0x13'),_0x5e70a5,_0x4407('0x14'));_0x801db8(_0x36cde5[_0x4407('0x19')]['message']);}})[_0x4407('0x1a')](function(_0x54caa1){logger[_0x4407('0x17')](_0x4407('0x13'),_0x5e70a5,_0x54caa1);_0x74e6f8(_0x54caa1);});});}exports[_0x4407('0x1b')]=function(_0x2db8b2){var _0x3fad4e=this;return new Promise(function(_0x52cb20,_0x451897){return db['MailAccount'][_0x4407('0x1c')]({'raw':_0x2db8b2[_0x4407('0x1d')]?_0x2db8b2[_0x4407('0x1d')][_0x4407('0x1e')]===undefined?!![]:![]:!![],'where':_0x2db8b2['options']?_0x2db8b2[_0x4407('0x1d')][_0x4407('0x1f')]||null:null,'attributes':_0x2db8b2[_0x4407('0x1d')]?_0x2db8b2[_0x4407('0x1d')][_0x4407('0x20')]||null:null,'limit':_0x2db8b2['options']?_0x2db8b2[_0x4407('0x1d')][_0x4407('0x21')]||null:null,'include':_0x2db8b2[_0x4407('0x1d')]?_0x2db8b2[_0x4407('0x1d')][_0x4407('0x22')]?_['map'](_0x2db8b2[_0x4407('0x1d')]['include'],function(_0x309274){return{'model':db[_0x309274['model']],'as':_0x309274['as'],'attributes':_0x309274[_0x4407('0x20')],'include':_0x309274['include']?_[_0x4407('0x23')](_0x309274['include'],function(_0x57ba27){return{'model':db[_0x57ba27[_0x4407('0x24')]],'as':_0x57ba27['as'],'attributes':_0x57ba27[_0x4407('0x20')],'include':_0x57ba27[_0x4407('0x22')]?_['map'](_0x57ba27['include'],function(_0x4ae052){return{'model':db[_0x4ae052[_0x4407('0x24')]],'as':_0x4ae052['as'],'attributes':_0x4ae052[_0x4407('0x20')]};}):[]};}):[]};}):[]:[]})[_0x4407('0x11')](function(_0x84a8a){logger[_0x4407('0x12')](_0x4407('0x1b'),_0x2db8b2);logger[_0x4407('0x15')]('GetMailAccount',_0x2db8b2,JSON['stringify'](_0x84a8a));_0x52cb20(_0x84a8a);})['catch'](function(_0x28e99e){logger[_0x4407('0x17')](_0x4407('0x1b'),_0x28e99e[_0x4407('0x18')],_0x2db8b2);_0x451897(_0x3fad4e[_0x4407('0x17')](0x1f4,_0x28e99e[_0x4407('0x18')]));});});};exports[_0x4407('0x25')]=function(_0x2fdb8e){var _0x2784ca=this;return new Promise(function(_0x12de0d,_0x55b149){return db['MailAccount'][_0x4407('0x26')]({'raw':_0x2fdb8e[_0x4407('0x1d')]?_0x2fdb8e[_0x4407('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x2fdb8e[_0x4407('0x1d')]?_0x2fdb8e[_0x4407('0x1d')][_0x4407('0x1f')]||null:null,'attributes':_0x2fdb8e[_0x4407('0x1d')]?_0x2fdb8e[_0x4407('0x1d')]['attributes']||null:null,'include':_0x2fdb8e[_0x4407('0x1d')]?_0x2fdb8e['options'][_0x4407('0x22')]?_['map'](_0x2fdb8e['options'][_0x4407('0x22')],function(_0x3d2d33){return{'model':db[_0x3d2d33[_0x4407('0x24')]],'as':_0x3d2d33['as'],'attributes':_0x3d2d33[_0x4407('0x20')],'include':_0x3d2d33[_0x4407('0x22')]?_[_0x4407('0x23')](_0x3d2d33[_0x4407('0x22')],function(_0x4de7a8){return{'model':db[_0x4de7a8[_0x4407('0x24')]],'as':_0x4de7a8['as'],'attributes':_0x4de7a8[_0x4407('0x20')],'include':_0x4de7a8[_0x4407('0x22')]?_[_0x4407('0x23')](_0x4de7a8[_0x4407('0x22')],function(_0x4b314e){return{'model':db[_0x4b314e[_0x4407('0x24')]],'as':_0x4b314e['as'],'attributes':_0x4b314e['attributes']};}):[]};}):[]};}):[]:[]})[_0x4407('0x11')](function(_0x21fc80){if(_0x2fdb8e[_0x4407('0x1d')][_0x4407('0x27')]===!![])_0x21fc80['setDataValue'](_0x4407('0x28'),_0x21fc80[_0x4407('0x29')]());logger[_0x4407('0x12')](_0x4407('0x25'),_0x2fdb8e);logger[_0x4407('0x15')](_0x4407('0x25'),_0x2fdb8e,JSON[_0x4407('0x2a')](_0x21fc80));_0x12de0d(_0x21fc80);})[_0x4407('0x1a')](function(_0x23938e){logger['error']('ShowMailAccount',_0x23938e[_0x4407('0x18')],_0x2fdb8e);_0x55b149(_0x2784ca[_0x4407('0x17')](0x1f4,_0x23938e[_0x4407('0x18')]));});});};exports[_0x4407('0x2b')]=function(_0x4ceba3){var _0x415e1f=this;return new Promise(function(_0x2cb65e,_0x33e670){var _0x574f53={'body':_0x4ceba3[_0x4407('0x2c')],'channel':'mail'};var _0x56b0a1=_[_0x4407('0x2d')](_[_0x4407('0x2e')](db[_0x4407('0x2f')][_0x4407('0x30')]),[_0x4407('0x31'),'updatedAt',_0x4407('0x32'),_0x4407('0x33')]);var _0x819b8b=![];if(_0x4ceba3[_0x4407('0x2c')]['id']){delete _0x4ceba3['body']['id'];}if(_[_0x4407('0x34')](_0x4ceba3[_0x4407('0x2c')][_0x4407('0x35')])){return _0x33e670(_0x415e1f[_0x4407('0x17')](0x1f4,_0x4407('0x36')));}if(_['isNil'](_0x4ceba3[_0x4407('0x2c')]['body'])||_0x4ceba3['body'][_0x4407('0x2c')]===''){return _0x33e670(_0x415e1f[_0x4407('0x17')](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x4407('0x34')](_0x4ceba3[_0x4407('0x2c')][_0x4407('0x37')])){return _0x33e670(_0x415e1f[_0x4407('0x17')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x56b0a1));}if(!_[_0x4407('0x38')](_0x56b0a1,_0x4ceba3[_0x4407('0x2c')][_0x4407('0x37')])){return _0x33e670(_0x415e1f[_0x4407('0x17')](0x1f4,_0x4407('0x39')+_0x56b0a1));}var _0x5759ae={};_0x5759ae[_0x4ceba3[_0x4407('0x2c')][_0x4407('0x37')]]=_0x4ceba3[_0x4407('0x2c')][_0x4407('0x35')];return db[_0x4407('0x3a')]['find']({'where':{'id':_0x4ceba3[_0x4407('0x3b')]['id']},'include':[{'model':db[_0x4407('0x3c')],'as':_0x4407('0x3d'),'include':[{'model':db[_0x4407('0x2f')],'as':'Contacts','where':_0x5759ae,'limit':0x1,'order':[[_0x4407('0x3e'),_0x4407('0x3f')]]}]},{'model':db['MailApplication'],'as':_0x4407('0x40')},{'model':db[_0x4407('0x41')],'as':'Smtp','include':[{'model':db[_0x4407('0x42')],'as':_0x4407('0x42')}]}]})[_0x4407('0x11')](function(_0x4fbc1f){if(_0x4fbc1f&&_0x4fbc1f[_0x4407('0x3d')]){var _0x58f244=_0x4fbc1f['get']({'plain':!![]});_0x574f53[_0x4407('0x3b')]=_[_0x4407('0x43')](_0x58f244,['Applications',_0x4407('0x3d')]);_0x574f53[_0x4407('0x3b')][_0x4407('0x28')]=_0x4fbc1f[_0x4407('0x29')]();_0x574f53[_0x4407('0x44')]=_0x58f244['Applications'];_0x574f53[_0x4407('0x45')]=_0x58f244[_0x4407('0x3d')];_0x574f53[_0x4407('0x44')]=_[_0x4407('0x46')](_0x574f53[_0x4407('0x44')],[_0x4407('0x47')],[_0x4407('0x48')]);if(_0x574f53[_0x4407('0x3b')]&&_0x574f53[_0x4407('0x3b')]['autoclose']){_0x574f53[_0x4407('0x44')]['push']({'id':0x0,'priority':_0x574f53[_0x4407('0x44')][_0x4407('0x49')]+0x1,'app':_0x4407('0x4a'),'appdata':_0x4407('0x4b'),'interval':'*,*,*,*'});}if(_0x574f53['account']['Applications']){delete _0x574f53[_0x4407('0x3b')][_0x4407('0x40')];}if(_0x574f53['account'][_0x4407('0x3d')]){delete _0x574f53[_0x4407('0x3b')][_0x4407('0x3d')];}if(_0x58f244[_0x4407('0x3d')]['Contacts'][_0x4407('0x49')]){return _0x58f244[_0x4407('0x3d')]['Contacts'][0x0];}var _0x242062=_[_0x4407('0xc')](_0x4ceba3[_0x4407('0x2c')],{'firstName':_0x4ceba3['body'][_0x4407('0x35')],'ListId':_0x58f244[_0x4407('0x33')]});_0x242062[_0x4ceba3[_0x4407('0x2c')][_0x4407('0x37')]]=_0x4ceba3[_0x4407('0x2c')][_0x4407('0x35')];return db['CmContact'][_0x4407('0x4c')](_0x242062);}else{throw new Error(_0x4407('0x4d'));}})[_0x4407('0x11')](function(_0x51d056){_0x574f53[_0x4407('0x4e')]=_0x51d056;if(_0x51d056){if(!_0x4ceba3[_0x4407('0x2c')][_0x4407('0x18')][_0x4407('0x4f')]){_0x4ceba3['body'][_0x4407('0x18')]['messageId']=rs[_0x4407('0x50')]()+'\x20'+_0x4ceba3[_0x4407('0x2c')][_0x4407('0x18')][_0x4407('0x35')];}var _0x38f3b6={'ContactId':_0x51d056['id'],'MailAccountId':_0x4ceba3[_0x4407('0x3b')]['id'],'inReplyTo':_0x4ceba3[_0x4407('0x2c')]['message'][_0x4407('0x4f')],'to':_0x4ceba3['body'][_0x4407('0x18')][_0x4407('0x35')],'cc':_0x4ceba3[_0x4407('0x2c')]['message']['cc'],'subject':_0x4ceba3['body'][_0x4407('0x18')][_0x4407('0x51')],'attach':_0x4ceba3[_0x4407('0x2c')][_0x4407('0x18')][_0x4407('0x52')],'lastMsgAt':moment()['format'](_0x4407('0x53')),'lastMsgDirection':'in'};return db[_0x4407('0x54')][_0x4407('0x26')]({'where':{'closed':![],'MailAccountId':_0x4ceba3[_0x4407('0x3b')]['id']},'include':[{'model':db['MailMessage'],'as':_0x4407('0x55'),'attributes':[_0x4407('0x4f')],'where':{'messageId':_0x4ceba3[_0x4407('0x2c')][_0x4407('0x18')][_0x4407('0x56')]}}]})[_0x4407('0x11')](function(_0x12ea57){if(_0x12ea57){return[_0x12ea57,![]];}return db[_0x4407('0x54')]['create'](_0x38f3b6)[_0x4407('0x11')](function(_0x796cef){return[_0x796cef,!![]];});});}else{throw new Error(_0x4407('0x57'));}})['spread'](function(_0x37fda2,_0x4ce441){if(_0x37fda2){_0x819b8b=_0x4ce441;if(!_0x4ce441){return _0x37fda2[_0x4407('0x58')]({'inReplyTo':_0x4ceba3[_0x4407('0x2c')][_0x4407('0x18')][_0x4407('0x4f')],'to':_0x4ceba3['body']['message'][_0x4407('0x35')],'cc':_0x4ceba3[_0x4407('0x2c')]['message']['cc'],'subject':_0x4ceba3[_0x4407('0x2c')][_0x4407('0x18')][_0x4407('0x51')],'attach':_0x37fda2[_0x4407('0x52')]?_0x37fda2[_0x4407('0x52')]:_0x4ceba3[_0x4407('0x2c')][_0x4407('0x18')]['attach'],'substatus':null,'substatusAt':moment()[_0x4407('0x59')](_0x4407('0x53')),'lastMsgAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'});}else{return _0x37fda2;}}})[_0x4407('0x11')](function(_0x244a8a){_0x574f53[_0x4407('0x5a')]=_0x244a8a['get']({'plain':!![]});_0x574f53[_0x4407('0x5a')][_0x4407('0x5b')]=_0x819b8b;return db[_0x4407('0x5c')][_0x4407('0x4c')]({'body':_0x4ceba3['body'][_0x4407('0x2c')],'MailAccountId':_0x4ceba3[_0x4407('0x3b')]['id'],'MailInteractionId':_0x244a8a['id'],'direction':'in','ContactId':_0x574f53[_0x4407('0x4e')]['id'],'messageId':_0x4ceba3[_0x4407('0x2c')][_0x4407('0x18')][_0x4407('0x4f')],'from':_0x4ceba3['body']['message']['from'],'to':_0x4ceba3[_0x4407('0x2c')][_0x4407('0x18')]['to'],'cc':_0x4ceba3[_0x4407('0x2c')][_0x4407('0x18')]['cc'],'subject':_0x4ceba3[_0x4407('0x2c')]['message'][_0x4407('0x51')],'attach':_0x4ceba3[_0x4407('0x2c')][_0x4407('0x18')][_0x4407('0x52')],'Attachments':_0x4ceba3['body'][_0x4407('0x18')][_0x4407('0x5d')],'originTo':_0x4ceba3[_0x4407('0x2c')][_0x4407('0x18')]['originTo'],'originCc':_0x4ceba3[_0x4407('0x2c')]['message'][_0x4407('0x5e')],'bcc':_0x4ceba3[_0x4407('0x2c')]['message'][_0x4407('0x5f')],'ChatWebsiteId':_0x4ceba3[_0x4407('0x2c')][_0x4407('0x18')][_0x4407('0x60')]||null,'originChannel':_0x4ceba3[_0x4407('0x2c')]['message']['originChannel']||_0x4407('0x61'),'ChatOfflineMessageId':_0x4ceba3[_0x4407('0x2c')]['message']['ChatOfflineMessageId']||null},{'include':[{'model':db[_0x4407('0x62')],'as':_0x4407('0x63')}]});})['then'](function(_0x16d0ef){_0x574f53['message']=_0x16d0ef;if(!_0x574f53[_0x4407('0x5a')][_0x4407('0x64')]){return;}return db[_0x4407('0x65')][_0x4407('0x26')]({'attributes':['id',_0x4407('0x66')],'where':{'id':_0x574f53[_0x4407('0x5a')][_0x4407('0x64')]}});})['then'](function(_0x16a175){if(_0x16a175){_0x574f53['applications'][_0x4407('0x67')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x16a175['name']+','+(_0x574f53[_0x4407('0x3b')][_0x4407('0x68')]||0xa),'interval':_0x4407('0x69')});}if(!_0x574f53[_0x4407('0x5a')]['queueId']){return;}return db[_0x4407('0x6a')][_0x4407('0x26')]({'attributes':['id','name'],'where':{'id':_0x574f53['interaction'][_0x4407('0x6b')]}});})[_0x4407('0x11')](function(_0x2772d7){if(_0x2772d7){_0x574f53[_0x4407('0x44')]['unshift']({'id':0x0,'priority':0x1,'app':_0x4407('0x6c'),'appdata':_0x2772d7[_0x4407('0x66')]+','+(_0x574f53[_0x4407('0x3b')][_0x4407('0x6d')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start',_0x4407('0x6e'),_0x574f53);})[_0x4407('0x11')](function(_0x4fc04a){_0x2cb65e(_0x4fc04a);})[_0x4407('0x1a')](function(_0x4a0dfd){_0x33e670(_0x415e1f['error'](0x1f4,_0x4a0dfd[_0x4407('0x18')]));});});}; \ No newline at end of file +var _0xb4c7=['model','catch','ShowMailAccount','find','smtp','getSmtpOptions','NotifyMailAccount','mail','CmContact','rawAttributes','createdAt','updatedAt','ListId','body','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','from','account','List','Contacts','DESC','MailApplication','Applications','MailServerOut','Smtp','get','list','orderBy','applications','priority','autoclose','length','close','*,*,*,*','create','contact','messageId','generate','attach','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','update','subject','format','interaction','created','attachments','originTo','originCc','originChannel','Email','ChatOfflineMessageId','Attachment','Attachments','UserId','User','name','unshift','agent','waitForTheAssignedAgent','queueId','MailQueue','queue','waitForTheAssignedQueue','Start','startRouting','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','register','request','then','info','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','MailAccount,\x20%s,\x20%s','message','result','GetMailAccount','MailAccount','options','raw','where','attributes','limit','include','map'];(function(_0x11c0d1,_0x29aa18){var _0x1d9d8e=function(_0x2d8dbf){while(--_0x2d8dbf){_0x11c0d1['push'](_0x11c0d1['shift']());}};_0x1d9d8e(++_0x29aa18);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x418c8c,_0xfb4928){_0x418c8c=_0x418c8c-0x0;var _0x23f5c5=_0xb4c7[_0x418c8c];return _0x23f5c5;};'use strict';var _=require(_0x7b4c('0x0'));var moment=require(_0x7b4c('0x1'));var BPromise=require(_0x7b4c('0x2'));var rs=require(_0x7b4c('0x3'));var Redis=require(_0x7b4c('0x4'));var db=require('../../mysqldb')['db'];var logger=require(_0x7b4c('0x5'))(_0x7b4c('0x6'));var config=require(_0x7b4c('0x7'));var jayson=require(_0x7b4c('0x8'));var client=jayson[_0x7b4c('0x9')]['http']({'port':0x232c});config[_0x7b4c('0xa')]=_[_0x7b4c('0xb')](config[_0x7b4c('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x7b4c('0xc'))(new Redis(config[_0x7b4c('0xa')]));require('./mailAccount.socket')[_0x7b4c('0xd')](socket);function respondWithRpcPromise(_0x179b2d,_0x28e902,_0x237e28){return new BPromise(function(_0x365225,_0x93d013){return client[_0x7b4c('0xe')](_0x179b2d,_0x237e28)[_0x7b4c('0xf')](function(_0xa9814e){logger[_0x7b4c('0x10')]('MailAccount,\x20%s,\x20%s',_0x28e902,'request\x20sent');logger[_0x7b4c('0x11')](_0x7b4c('0x12'),_0x28e902,_0x7b4c('0x13'),JSON[_0x7b4c('0x14')](_0xa9814e));if(_0xa9814e[_0x7b4c('0x15')]){if(_0xa9814e[_0x7b4c('0x15')][_0x7b4c('0x16')]===0x1f4){logger[_0x7b4c('0x15')](_0x7b4c('0x17'),_0x28e902,_0xa9814e[_0x7b4c('0x15')]['message']);return _0x93d013(_0xa9814e[_0x7b4c('0x15')][_0x7b4c('0x18')]);}logger[_0x7b4c('0x15')](_0x7b4c('0x17'),_0x28e902,_0xa9814e[_0x7b4c('0x15')][_0x7b4c('0x18')]);return _0x365225(_0xa9814e[_0x7b4c('0x15')][_0x7b4c('0x18')]);}else{logger['info'](_0x7b4c('0x17'),_0x28e902,_0x7b4c('0x13'));_0x365225(_0xa9814e[_0x7b4c('0x19')][_0x7b4c('0x18')]);}})['catch'](function(_0x3ce10c){logger[_0x7b4c('0x15')](_0x7b4c('0x17'),_0x28e902,_0x3ce10c);_0x93d013(_0x3ce10c);});});}exports[_0x7b4c('0x1a')]=function(_0x2d4c72){var _0x1363b4=this;return new Promise(function(_0x237110,_0x445281){return db[_0x7b4c('0x1b')]['findAll']({'raw':_0x2d4c72[_0x7b4c('0x1c')]?_0x2d4c72[_0x7b4c('0x1c')][_0x7b4c('0x1d')]===undefined?!![]:![]:!![],'where':_0x2d4c72[_0x7b4c('0x1c')]?_0x2d4c72[_0x7b4c('0x1c')][_0x7b4c('0x1e')]||null:null,'attributes':_0x2d4c72[_0x7b4c('0x1c')]?_0x2d4c72[_0x7b4c('0x1c')][_0x7b4c('0x1f')]||null:null,'limit':_0x2d4c72[_0x7b4c('0x1c')]?_0x2d4c72['options'][_0x7b4c('0x20')]||null:null,'include':_0x2d4c72[_0x7b4c('0x1c')]?_0x2d4c72[_0x7b4c('0x1c')][_0x7b4c('0x21')]?_[_0x7b4c('0x22')](_0x2d4c72[_0x7b4c('0x1c')][_0x7b4c('0x21')],function(_0x459eb4){return{'model':db[_0x459eb4[_0x7b4c('0x23')]],'as':_0x459eb4['as'],'attributes':_0x459eb4[_0x7b4c('0x1f')],'include':_0x459eb4[_0x7b4c('0x21')]?_[_0x7b4c('0x22')](_0x459eb4[_0x7b4c('0x21')],function(_0x501f75){return{'model':db[_0x501f75[_0x7b4c('0x23')]],'as':_0x501f75['as'],'attributes':_0x501f75[_0x7b4c('0x1f')],'include':_0x501f75[_0x7b4c('0x21')]?_[_0x7b4c('0x22')](_0x501f75[_0x7b4c('0x21')],function(_0x4ce02c){return{'model':db[_0x4ce02c[_0x7b4c('0x23')]],'as':_0x4ce02c['as'],'attributes':_0x4ce02c[_0x7b4c('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x7b4c('0xf')](function(_0x9a799b){logger[_0x7b4c('0x10')](_0x7b4c('0x1a'),_0x2d4c72);logger[_0x7b4c('0x11')](_0x7b4c('0x1a'),_0x2d4c72,JSON[_0x7b4c('0x14')](_0x9a799b));_0x237110(_0x9a799b);})[_0x7b4c('0x24')](function(_0x1d0724){logger[_0x7b4c('0x15')](_0x7b4c('0x1a'),_0x1d0724['message'],_0x2d4c72);_0x445281(_0x1363b4['error'](0x1f4,_0x1d0724['message']));});});};exports[_0x7b4c('0x25')]=function(_0x2efff3){var _0x14fb7f=this;return new Promise(function(_0x66e770,_0x498391){return db[_0x7b4c('0x1b')][_0x7b4c('0x26')]({'raw':_0x2efff3['options']?_0x2efff3[_0x7b4c('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x2efff3[_0x7b4c('0x1c')]?_0x2efff3[_0x7b4c('0x1c')][_0x7b4c('0x1e')]||null:null,'attributes':_0x2efff3['options']?_0x2efff3[_0x7b4c('0x1c')][_0x7b4c('0x1f')]||null:null,'include':_0x2efff3['options']?_0x2efff3[_0x7b4c('0x1c')][_0x7b4c('0x21')]?_[_0x7b4c('0x22')](_0x2efff3[_0x7b4c('0x1c')]['include'],function(_0x4d0355){return{'model':db[_0x4d0355[_0x7b4c('0x23')]],'as':_0x4d0355['as'],'attributes':_0x4d0355[_0x7b4c('0x1f')],'include':_0x4d0355['include']?_[_0x7b4c('0x22')](_0x4d0355['include'],function(_0x543309){return{'model':db[_0x543309[_0x7b4c('0x23')]],'as':_0x543309['as'],'attributes':_0x543309[_0x7b4c('0x1f')],'include':_0x543309[_0x7b4c('0x21')]?_[_0x7b4c('0x22')](_0x543309['include'],function(_0x81ddf4){return{'model':db[_0x81ddf4[_0x7b4c('0x23')]],'as':_0x81ddf4['as'],'attributes':_0x81ddf4[_0x7b4c('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x7b4c('0xf')](function(_0x346e0c){if(_0x2efff3[_0x7b4c('0x1c')][_0x7b4c('0x27')]===!![])_0x346e0c['setDataValue']('smtpOptions',_0x346e0c[_0x7b4c('0x28')]());logger[_0x7b4c('0x10')](_0x7b4c('0x25'),_0x2efff3);logger[_0x7b4c('0x11')](_0x7b4c('0x25'),_0x2efff3,JSON['stringify'](_0x346e0c));_0x66e770(_0x346e0c);})[_0x7b4c('0x24')](function(_0x902367){logger[_0x7b4c('0x15')](_0x7b4c('0x25'),_0x902367[_0x7b4c('0x18')],_0x2efff3);_0x498391(_0x14fb7f[_0x7b4c('0x15')](0x1f4,_0x902367[_0x7b4c('0x18')]));});});};exports[_0x7b4c('0x29')]=function(_0x3d8126){var _0x54cd10=this;return new Promise(function(_0x2a4085,_0x562838){var _0x2a3a74={'body':_0x3d8126['body'],'channel':_0x7b4c('0x2a')};var _0x46a23d=_['difference'](_['keys'](db[_0x7b4c('0x2b')][_0x7b4c('0x2c')]),[_0x7b4c('0x2d'),_0x7b4c('0x2e'),'CompanyId',_0x7b4c('0x2f')]);var _0x2ed731=![];if(_0x3d8126[_0x7b4c('0x30')]['id']){delete _0x3d8126['body']['id'];}if(_[_0x7b4c('0x31')](_0x3d8126['body']['from'])){return _0x562838(_0x54cd10[_0x7b4c('0x15')](0x1f4,'from\x20is\x20mandatory'));}if(_[_0x7b4c('0x31')](_0x3d8126[_0x7b4c('0x30')][_0x7b4c('0x30')])||_0x3d8126[_0x7b4c('0x30')][_0x7b4c('0x30')]===''){return _0x562838(_0x54cd10[_0x7b4c('0x15')](0x1f4,_0x7b4c('0x32')));}if(_[_0x7b4c('0x31')](_0x3d8126[_0x7b4c('0x30')]['mapKey'])){return _0x562838(_0x54cd10[_0x7b4c('0x15')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x46a23d));}if(!_['includes'](_0x46a23d,_0x3d8126[_0x7b4c('0x30')][_0x7b4c('0x33')])){return _0x562838(_0x54cd10['error'](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x46a23d));}var _0x255cca={};_0x255cca[_0x3d8126[_0x7b4c('0x30')][_0x7b4c('0x33')]]=_0x3d8126[_0x7b4c('0x30')][_0x7b4c('0x34')];return db[_0x7b4c('0x1b')][_0x7b4c('0x26')]({'where':{'id':_0x3d8126[_0x7b4c('0x35')]['id']},'include':[{'model':db['CmList'],'as':_0x7b4c('0x36'),'include':[{'model':db[_0x7b4c('0x2b')],'as':_0x7b4c('0x37'),'where':_0x255cca,'limit':0x1,'order':[[_0x7b4c('0x2e'),_0x7b4c('0x38')]]}]},{'model':db[_0x7b4c('0x39')],'as':_0x7b4c('0x3a')},{'model':db[_0x7b4c('0x3b')],'as':_0x7b4c('0x3c'),'include':[{'model':db['CloudProvider'],'as':'CloudProvider'}]}]})[_0x7b4c('0xf')](function(_0x3f6aaa){if(_0x3f6aaa&&_0x3f6aaa[_0x7b4c('0x36')]){var _0x5d4192=_0x3f6aaa[_0x7b4c('0x3d')]({'plain':!![]});_0x2a3a74[_0x7b4c('0x35')]=_['omit'](_0x5d4192,[_0x7b4c('0x3a'),'List']);_0x2a3a74[_0x7b4c('0x35')]['smtpOptions']=_0x3f6aaa[_0x7b4c('0x28')]();_0x2a3a74['applications']=_0x5d4192[_0x7b4c('0x3a')];_0x2a3a74[_0x7b4c('0x3e')]=_0x5d4192['List'];_0x2a3a74['applications']=_[_0x7b4c('0x3f')](_0x2a3a74[_0x7b4c('0x40')],[_0x7b4c('0x41')],['asc']);if(_0x2a3a74['account']&&_0x2a3a74[_0x7b4c('0x35')][_0x7b4c('0x42')]){_0x2a3a74['applications']['push']({'id':0x0,'priority':_0x2a3a74[_0x7b4c('0x40')][_0x7b4c('0x43')]+0x1,'app':_0x7b4c('0x44'),'appdata':'autoclose','interval':_0x7b4c('0x45')});}if(_0x2a3a74[_0x7b4c('0x35')]['Applications']){delete _0x2a3a74['account'][_0x7b4c('0x3a')];}if(_0x2a3a74['account']['List']){delete _0x2a3a74[_0x7b4c('0x35')]['List'];}if(_0x5d4192['List'][_0x7b4c('0x37')][_0x7b4c('0x43')]){return _0x5d4192[_0x7b4c('0x36')][_0x7b4c('0x37')][0x0];}var _0x4895dd=_['defaults'](_0x3d8126[_0x7b4c('0x30')],{'firstName':_0x3d8126[_0x7b4c('0x30')][_0x7b4c('0x34')],'ListId':_0x5d4192['ListId']});_0x4895dd[_0x3d8126[_0x7b4c('0x30')][_0x7b4c('0x33')]]=_0x3d8126[_0x7b4c('0x30')]['from'];return db[_0x7b4c('0x2b')][_0x7b4c('0x46')](_0x4895dd);}else{throw new Error('List\x20not\x20found');}})[_0x7b4c('0xf')](function(_0x186e7d){_0x2a3a74[_0x7b4c('0x47')]=_0x186e7d;if(_0x186e7d){if(!_0x3d8126[_0x7b4c('0x30')][_0x7b4c('0x18')][_0x7b4c('0x48')]){_0x3d8126[_0x7b4c('0x30')]['message'][_0x7b4c('0x48')]=rs[_0x7b4c('0x49')]()+'\x20'+_0x3d8126['body'][_0x7b4c('0x18')][_0x7b4c('0x34')];}var _0x36ee90={'ContactId':_0x186e7d['id'],'MailAccountId':_0x3d8126[_0x7b4c('0x35')]['id'],'inReplyTo':_0x3d8126['body'][_0x7b4c('0x18')]['messageId'],'to':_0x3d8126['body'][_0x7b4c('0x18')][_0x7b4c('0x34')],'cc':_0x3d8126[_0x7b4c('0x30')][_0x7b4c('0x18')]['cc'],'subject':_0x3d8126[_0x7b4c('0x30')]['message']['subject'],'attach':_0x3d8126[_0x7b4c('0x30')][_0x7b4c('0x18')][_0x7b4c('0x4a')],'lastMsgAt':moment()['format'](_0x7b4c('0x4b')),'lastMsgDirection':'in'};return db[_0x7b4c('0x4c')][_0x7b4c('0x26')]({'where':{'closed':![],'MailAccountId':_0x3d8126['account']['id']},'include':[{'model':db[_0x7b4c('0x4d')],'as':_0x7b4c('0x4e'),'attributes':[_0x7b4c('0x48')],'where':{'messageId':_0x3d8126['body'][_0x7b4c('0x18')][_0x7b4c('0x4f')]}}]})['then'](function(_0x1c64d5){if(_0x1c64d5){return[_0x1c64d5,![]];}return db['MailInteraction'][_0x7b4c('0x46')](_0x36ee90)[_0x7b4c('0xf')](function(_0x3a3713){return[_0x3a3713,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})['spread'](function(_0x237921,_0x401c4b){if(_0x237921){_0x2ed731=_0x401c4b;if(!_0x401c4b){return _0x237921[_0x7b4c('0x50')]({'inReplyTo':_0x3d8126['body'][_0x7b4c('0x18')]['messageId'],'to':_0x3d8126[_0x7b4c('0x30')][_0x7b4c('0x18')][_0x7b4c('0x34')],'cc':_0x3d8126[_0x7b4c('0x30')][_0x7b4c('0x18')]['cc'],'subject':_0x3d8126['body'][_0x7b4c('0x18')][_0x7b4c('0x51')],'attach':_0x237921['attach']?_0x237921[_0x7b4c('0x4a')]:_0x3d8126[_0x7b4c('0x30')][_0x7b4c('0x18')][_0x7b4c('0x4a')],'substatus':null,'substatusAt':moment()[_0x7b4c('0x52')](_0x7b4c('0x4b')),'lastMsgAt':moment()[_0x7b4c('0x52')](_0x7b4c('0x4b')),'lastMsgDirection':'in'});}else{return _0x237921;}}})['then'](function(_0x10d5b3){_0x2a3a74[_0x7b4c('0x53')]=_0x10d5b3[_0x7b4c('0x3d')]({'plain':!![]});_0x2a3a74[_0x7b4c('0x53')][_0x7b4c('0x54')]=_0x2ed731;return db[_0x7b4c('0x4d')][_0x7b4c('0x46')]({'body':_0x3d8126[_0x7b4c('0x30')][_0x7b4c('0x30')],'MailAccountId':_0x3d8126[_0x7b4c('0x35')]['id'],'MailInteractionId':_0x10d5b3['id'],'direction':'in','ContactId':_0x2a3a74[_0x7b4c('0x47')]['id'],'messageId':_0x3d8126[_0x7b4c('0x30')][_0x7b4c('0x18')][_0x7b4c('0x48')],'from':_0x3d8126[_0x7b4c('0x30')][_0x7b4c('0x18')][_0x7b4c('0x34')],'to':_0x3d8126[_0x7b4c('0x30')][_0x7b4c('0x18')]['to'],'cc':_0x3d8126[_0x7b4c('0x30')]['message']['cc'],'subject':_0x3d8126['body'][_0x7b4c('0x18')][_0x7b4c('0x51')],'attach':_0x3d8126['body'][_0x7b4c('0x18')][_0x7b4c('0x4a')],'Attachments':_0x3d8126[_0x7b4c('0x30')][_0x7b4c('0x18')][_0x7b4c('0x55')],'originTo':_0x3d8126[_0x7b4c('0x30')][_0x7b4c('0x18')][_0x7b4c('0x56')],'originCc':_0x3d8126[_0x7b4c('0x30')]['message'][_0x7b4c('0x57')],'bcc':_0x3d8126['body'][_0x7b4c('0x18')]['bcc'],'ChatWebsiteId':_0x3d8126['body'][_0x7b4c('0x18')]['ChatWebsiteId']||null,'originChannel':_0x3d8126['body'][_0x7b4c('0x18')][_0x7b4c('0x58')]||_0x7b4c('0x59'),'ChatOfflineMessageId':_0x3d8126['body'][_0x7b4c('0x18')][_0x7b4c('0x5a')]||null},{'include':[{'model':db[_0x7b4c('0x5b')],'as':_0x7b4c('0x5c')}]});})[_0x7b4c('0xf')](function(_0x2837aa){_0x2a3a74[_0x7b4c('0x18')]=_0x2837aa;if(!_0x2a3a74[_0x7b4c('0x53')][_0x7b4c('0x5d')]){return;}return db[_0x7b4c('0x5e')][_0x7b4c('0x26')]({'attributes':['id',_0x7b4c('0x5f')],'where':{'id':_0x2a3a74[_0x7b4c('0x53')][_0x7b4c('0x5d')]}});})['then'](function(_0x1df6f1){if(_0x1df6f1){_0x2a3a74[_0x7b4c('0x40')][_0x7b4c('0x60')]({'id':0x0,'priority':0x0,'app':_0x7b4c('0x61'),'appdata':_0x1df6f1['name']+','+(_0x2a3a74[_0x7b4c('0x35')][_0x7b4c('0x62')]||0xa),'interval':_0x7b4c('0x45')});}if(!_0x2a3a74[_0x7b4c('0x53')][_0x7b4c('0x63')]){return;}return db[_0x7b4c('0x64')][_0x7b4c('0x26')]({'attributes':['id','name'],'where':{'id':_0x2a3a74[_0x7b4c('0x53')][_0x7b4c('0x63')]}});})['then'](function(_0x4a9cf6){if(_0x4a9cf6){_0x2a3a74['applications'][_0x7b4c('0x60')]({'id':0x0,'priority':0x1,'app':_0x7b4c('0x65'),'appdata':_0x4a9cf6[_0x7b4c('0x5f')]+','+(_0x2a3a74[_0x7b4c('0x35')][_0x7b4c('0x66')]||0x12c),'interval':_0x7b4c('0x45')});}return respondWithRpcPromise(_0x7b4c('0x67'),_0x7b4c('0x68'),_0x2a3a74);})[_0x7b4c('0xf')](function(_0x2bc889){_0x2a4085(_0x2bc889);})[_0x7b4c('0x24')](function(_0x257fae){_0x562838(_0x54cd10[_0x7b4c('0x15')](0x1f4,_0x257fae['message']));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 9b8b132..9916075 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 _0xfa28=['remove','update','removeListener','register'];(function(_0x354ab0,_0x3738b9){var _0x5c542c=function(_0x3ba5e1){while(--_0x3ba5e1){_0x354ab0['push'](_0x354ab0['shift']());}};_0x5c542c(++_0x3738b9);}(_0xfa28,0x84));var _0x8fa2=function(_0x3df9dd,_0x26f5cd){_0x3df9dd=_0x3df9dd-0x0;var _0x4f11e4=_0xfa28[_0x3df9dd];return _0x4f11e4;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=['save',_0x8fa2('0x0'),_0x8fa2('0x1')];function createListener(_0xe65228,_0x2b667a){return function(_0x3b179c){_0x2b667a['emit'](_0xe65228,_0x3b179c);};}function removeListener(_0xe2f122,_0x2e11d4){return function(){MailAccountEvents[_0x8fa2('0x2')](_0xe2f122,_0x2e11d4);};}exports[_0x8fa2('0x3')]=function(_0x3ee22a){for(var _0x4d1609=0x0,_0x5127b4=events['length'];_0x4d1609<_0x5127b4;_0x4d1609++){var _0x251157=events[_0x4d1609];var _0x3ca5d0=createListener('mailAccount:'+_0x251157,_0x3ee22a);MailAccountEvents['on'](_0x251157,_0x3ca5d0);}}; \ No newline at end of file +var _0x6725=['remove','update','emit','./mailAccount.events','save'];(function(_0x5e6310,_0x136d16){var _0x4900f9=function(_0x19d1f8){while(--_0x19d1f8){_0x5e6310['push'](_0x5e6310['shift']());}};_0x4900f9(++_0x136d16);}(_0x6725,0x1a2));var _0x5672=function(_0x1b1d54,_0x3f0755){_0x1b1d54=_0x1b1d54-0x0;var _0x2b5134=_0x6725[_0x1b1d54];return _0x2b5134;};'use strict';var MailAccountEvents=require(_0x5672('0x0'));var events=[_0x5672('0x1'),_0x5672('0x2'),_0x5672('0x3')];function createListener(_0x4bc362,_0x28df7d){return function(_0x366435){_0x28df7d[_0x5672('0x4')](_0x4bc362,_0x366435);};}function removeListener(_0x43ca1d,_0x349976){return function(){MailAccountEvents['removeListener'](_0x43ca1d,_0x349976);};}exports['register']=function(_0x33e21f){for(var _0x3d42cb=0x0,_0x485ee5=events['length'];_0x3d42cb<_0x485ee5;_0x3d42cb++){var _0x5673d6=events[_0x3d42cb];var _0x10fd06=createListener('mailAccount:'+_0x5673d6,_0x33e21f);MailAccountEvents['on'](_0x5673d6,_0x10fd06);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index a13bb85..ebe3772 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 _0x90b8=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','/:id','isAuthenticated','show','update','delete','destroy','util','connect-timeout'];(function(_0x18c7f7,_0x684577){var _0x154c6e=function(_0x541940){while(--_0x541940){_0x18c7f7['push'](_0x18c7f7['shift']());}};_0x154c6e(++_0x684577);}(_0x90b8,0x11b));var _0x890b=function(_0x557f5f,_0x31d8e7){_0x557f5f=_0x557f5f-0x0;var _0x196eba=_0x90b8[_0x557f5f];return _0x196eba;};'use strict';var multer=require('multer');var util=require(_0x890b('0x0'));var path=require('path');var timeout=require(_0x890b('0x1'));var express=require('express');var router=express[_0x890b('0x2')]();var fs_extra=require(_0x890b('0x3'));var auth=require(_0x890b('0x4'));var interaction=require(_0x890b('0x5'));var config=require(_0x890b('0x6'));var controller=require(_0x890b('0x7'));router[_0x890b('0x8')](_0x890b('0x9'),auth[_0x890b('0xa')](),controller[_0x890b('0xb')]);router['put'](_0x890b('0x9'),auth[_0x890b('0xa')](),controller[_0x890b('0xc')]);router[_0x890b('0xd')](_0x890b('0x9'),auth[_0x890b('0xa')](),controller[_0x890b('0xe')]);module['exports']=router; \ No newline at end of file +var _0x803d=['exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./mailApplication.controller','get','/:id','show','isAuthenticated','update','delete','destroy'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x803d,0x141));var _0xd803=function(_0x1add39,_0x6bfaa8){_0x1add39=_0x1add39-0x0;var _0x407784=_0x803d[_0x1add39];return _0x407784;};'use strict';var multer=require('multer');var util=require(_0xd803('0x0'));var path=require(_0xd803('0x1'));var timeout=require(_0xd803('0x2'));var express=require(_0xd803('0x3'));var router=express[_0xd803('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd803('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xd803('0x6'));var controller=require(_0xd803('0x7'));router[_0xd803('0x8')](_0xd803('0x9'),auth['isAuthenticated'](),controller[_0xd803('0xa')]);router['put']('/:id',auth[_0xd803('0xb')](),controller[_0xd803('0xc')]);router[_0xd803('0xd')](_0xd803('0x9'),auth['isAuthenticated'](),controller[_0xd803('0xe')]);module[_0xd803('0xf')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 89b473c..af9d06b 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 _0x6144=['TEXT','sequelize','exports','INTEGER','STRING','noop'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0x6144,0x169));var _0x4614=function(_0x59d210,_0xd6d448){_0x59d210=_0x59d210-0x0;var _0x50f52d=_0x6144[_0x59d210];return _0x50f52d;};'use strict';var Sequelize=require(_0x4614('0x0'));module[_0x4614('0x1')]={'priority':{'type':Sequelize[_0x4614('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x4614('0x3')],'allowNull':![],'defaultValue':_0x4614('0x4')},'appdata':{'type':Sequelize[_0x4614('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xb547=['STRING','noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0x41d02a,_0x355e19){var _0x4c3983=function(_0x4802a7){while(--_0x4802a7){_0x41d02a['push'](_0x41d02a['shift']());}};_0x4c3983(++_0x355e19);}(_0xb547,0x184));var _0x7b54=function(_0x415f7e,_0x4630b6){_0x415f7e=_0x415f7e-0x0;var _0x311ff4=_0xb547[_0x415f7e];return _0x311ff4;};'use strict';var Sequelize=require(_0x7b54('0x0'));module[_0x7b54('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x7b54('0x2')],'allowNull':![],'defaultValue':_0x7b54('0x3')},'appdata':{'type':Sequelize[_0x7b54('0x4')]()},'description':{'type':Sequelize[_0x7b54('0x2')]},'interval':{'type':Sequelize[_0x7b54('0x2')],'defaultValue':_0x7b54('0x5')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index fd6ef76..a27577e 100644 --- a/server/api/mailApplication/mailApplication.controller.js +++ b/server/api/mailApplication/mailApplication.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf4eb=['limit','count','Content-Range','json','apply','reject','save','then','destroy','error','name','send','params','keys','MailApplication','rawAttributes','query','filters','intersection','model','fields','attributes','includeAll','include','options','find','catch','body','eml-format','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined'];(function(_0x19d995,_0x56ff21){var _0xa618c=function(_0x31170f){while(--_0x31170f){_0x19d995['push'](_0x19d995['shift']());}};_0xa618c(++_0x56ff21);}(_0xf4eb,0xec));var _0xbf4e=function(_0x3ad77a,_0x26572a){_0x3ad77a=_0x3ad77a-0x0;var _0x137da2=_0xf4eb[_0x3ad77a];return _0x137da2;};'use strict';var emlformat=require(_0xbf4e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xbf4e('0x1'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xbf4e('0x2'));var path=require(_0xbf4e('0x3'));var sox=require(_0xbf4e('0x4'));var csv=require(_0xbf4e('0x5'));var ejs=require(_0xbf4e('0x6'));var fs=require('fs');var fs_extra=require(_0xbf4e('0x7'));var _=require(_0xbf4e('0x8'));var squel=require('squel');var crypto=require(_0xbf4e('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbf4e('0x5'));var querystring=require(_0xbf4e('0xa'));var Papa=require(_0xbf4e('0xb'));var Redis=require(_0xbf4e('0xc'));var authService=require(_0xbf4e('0xd'));var qs=require(_0xbf4e('0xe'));var as=require(_0xbf4e('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xbf4e('0x10'));var utils=require('../../config/utils');var config=require(_0xbf4e('0x11'));var licenseUtil=require(_0xbf4e('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x17fd01,_0x5a3035){_0x5a3035=_0x5a3035||0xcc;return function(_0x56d185){if(_0x56d185){return _0x17fd01[_0xbf4e('0x13')](_0x5a3035);}return _0x17fd01[_0xbf4e('0x14')](_0x5a3035)[_0xbf4e('0x15')]();};}function respondWithResult(_0x302841,_0x3b74bd){_0x3b74bd=_0x3b74bd||0xc8;return function(_0x61bd54){if(_0x61bd54){return _0x302841['status'](_0x3b74bd)['json'](_0x61bd54);}};}function respondWithFilteredResult(_0x180432,_0x1735ae){return function(_0x28fc6b){if(_0x28fc6b){var _0x542909=typeof _0x1735ae[_0xbf4e('0x16')]===_0xbf4e('0x17')&&typeof _0x1735ae[_0xbf4e('0x18')]===_0xbf4e('0x17');var _0x5a631e=_0x28fc6b[_0xbf4e('0x19')];var _0x577c27=_0x542909?0x0:_0x1735ae['offset'];var _0x566ec3=_0x542909?_0x28fc6b['count']:_0x1735ae[_0xbf4e('0x16')]+_0x1735ae[_0xbf4e('0x18')];var _0x1fc800;if(_0x566ec3>=_0x5a631e){_0x566ec3=_0x5a631e;_0x1fc800=0xc8;}else{_0x1fc800=0xce;}_0x180432['status'](_0x1fc800);return _0x180432['set'](_0xbf4e('0x1a'),_0x577c27+'-'+_0x566ec3+'/'+_0x5a631e)[_0xbf4e('0x1b')](_0x28fc6b);}return null;};}function patchUpdates(_0x3be138){return function(_0x3a875b){try{jsonpatch[_0xbf4e('0x1c')](_0x3a875b,_0x3be138,!![]);}catch(_0x1e2a68){return BPromise[_0xbf4e('0x1d')](_0x1e2a68);}return _0x3a875b[_0xbf4e('0x1e')]();};}function saveUpdates(_0xd09e12,_0x376832){return function(_0x30539b){if(_0x30539b){return _0x30539b['update'](_0xd09e12)[_0xbf4e('0x1f')](function(_0x2e7673){return _0x2e7673;});}return null;};}function removeEntity(_0x51648c,_0x31e3f5){return function(_0x30994d){if(_0x30994d){return _0x30994d[_0xbf4e('0x20')]()[_0xbf4e('0x1f')](function(){_0x51648c[_0xbf4e('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x90635e,_0x36688a){return function(_0x3d6863){if(!_0x3d6863){_0x90635e['sendStatus'](0x194);}return _0x3d6863;};}function handleError(_0x2fb490,_0x5e08b1){_0x5e08b1=_0x5e08b1||0x1f4;return function(_0x5bcf71){logger[_0xbf4e('0x21')](_0x5bcf71['stack']);if(_0x5bcf71[_0xbf4e('0x22')]){delete _0x5bcf71[_0xbf4e('0x22')];}_0x2fb490[_0xbf4e('0x14')](_0x5e08b1)[_0xbf4e('0x23')](_0x5bcf71);};}exports['show']=function(_0x2d4686,_0x8e0ab5){var _0x43879d={'raw':!![],'where':{'id':_0x2d4686[_0xbf4e('0x24')]['id']}},_0x4cd4a1={};_0x4cd4a1['model']=_[_0xbf4e('0x25')](db[_0xbf4e('0x26')][_0xbf4e('0x27')]);_0x4cd4a1['query']=_[_0xbf4e('0x25')](_0x2d4686[_0xbf4e('0x28')]);_0x4cd4a1[_0xbf4e('0x29')]=_[_0xbf4e('0x2a')](_0x4cd4a1[_0xbf4e('0x2b')],_0x4cd4a1[_0xbf4e('0x28')]);_0x43879d['attributes']=_[_0xbf4e('0x2a')](_0x4cd4a1[_0xbf4e('0x2b')],qs['fields'](_0x2d4686[_0xbf4e('0x28')][_0xbf4e('0x2c')]));_0x43879d['attributes']=_0x43879d[_0xbf4e('0x2d')]['length']?_0x43879d[_0xbf4e('0x2d')]:_0x4cd4a1['model'];if(_0x2d4686[_0xbf4e('0x28')][_0xbf4e('0x2e')]){_0x43879d[_0xbf4e('0x2f')]=[{'all':!![]}];}_0x43879d=_['merge']({},_0x43879d,_0x2d4686[_0xbf4e('0x30')]);return db[_0xbf4e('0x26')][_0xbf4e('0x31')](_0x43879d)[_0xbf4e('0x1f')](handleEntityNotFound(_0x8e0ab5,null))[_0xbf4e('0x1f')](respondWithResult(_0x8e0ab5,null))[_0xbf4e('0x32')](handleError(_0x8e0ab5,null));};exports['update']=function(_0x99b320,_0x3dbb2b){if(_0x99b320[_0xbf4e('0x33')]['id']){delete _0x99b320[_0xbf4e('0x33')]['id'];}return db[_0xbf4e('0x26')]['find']({'where':{'id':_0x99b320['params']['id']}})['then'](handleEntityNotFound(_0x3dbb2b,null))['then'](saveUpdates(_0x99b320[_0xbf4e('0x33')],null))[_0xbf4e('0x1f')](respondWithResult(_0x3dbb2b,null))[_0xbf4e('0x32')](handleError(_0x3dbb2b,null));};exports[_0xbf4e('0x20')]=function(_0x22ddde,_0x257b74){return db[_0xbf4e('0x26')][_0xbf4e('0x31')]({'where':{'id':_0x22ddde[_0xbf4e('0x24')]['id']}})['then'](handleEntityNotFound(_0x257b74,null))['then'](removeEntity(_0x257b74,null))[_0xbf4e('0x32')](handleError(_0x257b74,null));}; \ No newline at end of file +var _0x0713=['catch','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','stack','name','send','show','params','MailApplication','rawAttributes','query','keys','filters','intersection','model','fields','attributes','length','includeAll','include','merge','options','find','body'];(function(_0xcdf360,_0x28c99d){var _0x5389e9=function(_0x76216){while(--_0x76216){_0xcdf360['push'](_0xcdf360['shift']());}};_0x5389e9(++_0x28c99d);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3071('0x0'));var jsonpatch=require(_0x3071('0x1'));var rp=require(_0x3071('0x2'));var moment=require(_0x3071('0x3'));var BPromise=require(_0x3071('0x4'));var Mustache=require('mustache');var util=require(_0x3071('0x5'));var path=require(_0x3071('0x6'));var sox=require(_0x3071('0x7'));var csv=require(_0x3071('0x8'));var ejs=require(_0x3071('0x9'));var fs=require('fs');var fs_extra=require(_0x3071('0xa'));var _=require(_0x3071('0xb'));var squel=require(_0x3071('0xc'));var crypto=require(_0x3071('0xd'));var jsforce=require(_0x3071('0xe'));var deskjs=require(_0x3071('0xf'));var toCsv=require(_0x3071('0x8'));var querystring=require(_0x3071('0x10'));var Papa=require('papaparse');var Redis=require(_0x3071('0x11'));var authService=require(_0x3071('0x12'));var qs=require(_0x3071('0x13'));var as=require(_0x3071('0x14'));var hardwareService=require(_0x3071('0x15'));var logger=require('../../config/logger')(_0x3071('0x16'));var utils=require(_0x3071('0x17'));var config=require(_0x3071('0x18'));var licenseUtil=require(_0x3071('0x19'));var db=require(_0x3071('0x1a'))['db'];function respondWithStatusCode(_0x4a8cc7,_0x5330a8){_0x5330a8=_0x5330a8||0xcc;return function(_0x1826ca){if(_0x1826ca){return _0x4a8cc7['sendStatus'](_0x5330a8);}return _0x4a8cc7[_0x3071('0x1b')](_0x5330a8)[_0x3071('0x1c')]();};}function respondWithResult(_0x5d4883,_0x104e73){_0x104e73=_0x104e73||0xc8;return function(_0x4e1219){if(_0x4e1219){return _0x5d4883[_0x3071('0x1b')](_0x104e73)[_0x3071('0x1d')](_0x4e1219);}};}function respondWithFilteredResult(_0x1271d0,_0x1f14e1){return function(_0x1caa5d){if(_0x1caa5d){var _0x2a6a4b=typeof _0x1f14e1[_0x3071('0x1e')]===_0x3071('0x1f')&&typeof _0x1f14e1[_0x3071('0x20')]===_0x3071('0x1f');var _0x5f3c22=_0x1caa5d[_0x3071('0x21')];var _0x17dbda=_0x2a6a4b?0x0:_0x1f14e1[_0x3071('0x1e')];var _0x108a83=_0x2a6a4b?_0x1caa5d[_0x3071('0x21')]:_0x1f14e1[_0x3071('0x1e')]+_0x1f14e1[_0x3071('0x20')];var _0x26f113;if(_0x108a83>=_0x5f3c22){_0x108a83=_0x5f3c22;_0x26f113=0xc8;}else{_0x26f113=0xce;}_0x1271d0['status'](_0x26f113);return _0x1271d0[_0x3071('0x22')](_0x3071('0x23'),_0x17dbda+'-'+_0x108a83+'/'+_0x5f3c22)[_0x3071('0x1d')](_0x1caa5d);}return null;};}function patchUpdates(_0x56c267){return function(_0xb8f4e3){try{jsonpatch['apply'](_0xb8f4e3,_0x56c267,!![]);}catch(_0x833074){return BPromise[_0x3071('0x24')](_0x833074);}return _0xb8f4e3[_0x3071('0x25')]();};}function saveUpdates(_0x457b57,_0x33090c){return function(_0x34c50e){if(_0x34c50e){return _0x34c50e[_0x3071('0x26')](_0x457b57)[_0x3071('0x27')](function(_0x542646){return _0x542646;});}return null;};}function removeEntity(_0x481a51,_0x2ce48a){return function(_0xb05b1d){if(_0xb05b1d){return _0xb05b1d[_0x3071('0x28')]()[_0x3071('0x27')](function(){_0x481a51[_0x3071('0x1b')](0xcc)[_0x3071('0x1c')]();});}};}function handleEntityNotFound(_0x7a4cb4,_0x1fe727){return function(_0x1de5fb){if(!_0x1de5fb){_0x7a4cb4['sendStatus'](0x194);}return _0x1de5fb;};}function handleError(_0x2e5f93,_0x3f1e6e){_0x3f1e6e=_0x3f1e6e||0x1f4;return function(_0x177138){logger['error'](_0x177138[_0x3071('0x29')]);if(_0x177138[_0x3071('0x2a')]){delete _0x177138[_0x3071('0x2a')];}_0x2e5f93[_0x3071('0x1b')](_0x3f1e6e)[_0x3071('0x2b')](_0x177138);};}exports[_0x3071('0x2c')]=function(_0x177b5f,_0x3921a1){var _0x32f1b4={'raw':!![],'where':{'id':_0x177b5f[_0x3071('0x2d')]['id']}},_0x292205={};_0x292205['model']=_['keys'](db[_0x3071('0x2e')][_0x3071('0x2f')]);_0x292205[_0x3071('0x30')]=_[_0x3071('0x31')](_0x177b5f[_0x3071('0x30')]);_0x292205[_0x3071('0x32')]=_[_0x3071('0x33')](_0x292205[_0x3071('0x34')],_0x292205['query']);_0x32f1b4['attributes']=_['intersection'](_0x292205[_0x3071('0x34')],qs[_0x3071('0x35')](_0x177b5f['query'][_0x3071('0x35')]));_0x32f1b4[_0x3071('0x36')]=_0x32f1b4[_0x3071('0x36')][_0x3071('0x37')]?_0x32f1b4['attributes']:_0x292205[_0x3071('0x34')];if(_0x177b5f[_0x3071('0x30')][_0x3071('0x38')]){_0x32f1b4[_0x3071('0x39')]=[{'all':!![]}];}_0x32f1b4=_[_0x3071('0x3a')]({},_0x32f1b4,_0x177b5f[_0x3071('0x3b')]);return db[_0x3071('0x2e')][_0x3071('0x3c')](_0x32f1b4)['then'](handleEntityNotFound(_0x3921a1,null))[_0x3071('0x27')](respondWithResult(_0x3921a1,null))['catch'](handleError(_0x3921a1,null));};exports['update']=function(_0x1a1a64,_0xa3a7ae){if(_0x1a1a64['body']['id']){delete _0x1a1a64[_0x3071('0x3d')]['id'];}return db[_0x3071('0x2e')][_0x3071('0x3c')]({'where':{'id':_0x1a1a64[_0x3071('0x2d')]['id']}})[_0x3071('0x27')](handleEntityNotFound(_0xa3a7ae,null))[_0x3071('0x27')](saveUpdates(_0x1a1a64['body'],null))[_0x3071('0x27')](respondWithResult(_0xa3a7ae,null))[_0x3071('0x3e')](handleError(_0xa3a7ae,null));};exports['destroy']=function(_0x44ad05,_0x5b1392){return db[_0x3071('0x2e')][_0x3071('0x3c')]({'where':{'id':_0x44ad05['params']['id']}})['then'](handleEntityNotFound(_0x5b1392,null))[_0x3071('0x27')](removeEntity(_0x5b1392,null))[_0x3071('0x3e')](handleError(_0x5b1392,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index ac4a4cc..dd8d13e 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 _0xdd5f=['path','rimraf','../../config/environment','./mailApplication.attributes','exports','define','MailApplication','mail_applications','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0xdd5f,0x13d));var _0xfdd5=function(_0x46d0c9,_0x526bfa){_0x46d0c9=_0x46d0c9-0x0;var _0x174506=_0xdd5f[_0x46d0c9];return _0x174506;};'use strict';var _=require(_0xfdd5('0x0'));var util=require(_0xfdd5('0x1'));var logger=require('../../config/logger')(_0xfdd5('0x2'));var moment=require(_0xfdd5('0x3'));var BPromise=require(_0xfdd5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfdd5('0x5'));var rimraf=require(_0xfdd5('0x6'));var config=require(_0xfdd5('0x7'));var attributes=require(_0xfdd5('0x8'));module[_0xfdd5('0x9')]=function(_0x2d28f3,_0x26a165){return _0x2d28f3[_0xfdd5('0xa')](_0xfdd5('0xb'),attributes,{'tableName':_0xfdd5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xfdd5('0xd')});}; \ No newline at end of file +var _0x4a7a=['util','../../config/logger','api','request-promise','path','rimraf','./mailApplication.attributes','exports','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x279631,_0x10cae0){var _0x276bd1=function(_0x5ad952){while(--_0x5ad952){_0x279631['push'](_0x279631['shift']());}};_0x276bd1(++_0x10cae0);}(_0x4a7a,0x1d3));var _0xa4a7=function(_0x335236,_0x12ea97){_0x335236=_0x335236-0x0;var _0x51ac14=_0x4a7a[_0x335236];return _0x51ac14;};'use strict';var _=require(_0xa4a7('0x0'));var util=require(_0xa4a7('0x1'));var logger=require(_0xa4a7('0x2'))(_0xa4a7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa4a7('0x4'));var fs=require('fs');var path=require(_0xa4a7('0x5'));var rimraf=require(_0xa4a7('0x6'));var config=require('../../config/environment');var attributes=require(_0xa4a7('0x7'));module[_0xa4a7('0x8')]=function(_0x4b2ff1,_0x2f29dc){return _0x4b2ff1['define'](_0xa4a7('0x9'),attributes,{'tableName':_0xa4a7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa4a7('0xb'),'collate':_0xa4a7('0xc')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index d673653..1100c89 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 _0x323e=['attributes','moment','randomstring','ioredis','../../mysqldb','jayson/promise','client','http','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','UpdateMailApplication','MailApplication','update','body','options','where'];(function(_0x27bc65,_0x93b685){var _0x6d521f=function(_0x2850cf){while(--_0x2850cf){_0x27bc65['push'](_0x27bc65['shift']());}};_0x6d521f(++_0x93b685);}(_0x323e,0x18d));var _0xe323=function(_0x209eda,_0x5776cf){_0x209eda=_0x209eda-0x0;var _0x1fe649=_0x323e[_0x209eda];return _0x1fe649;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe323('0x0'));var BPromise=require('bluebird');var rs=require(_0xe323('0x1'));var fs=require('fs');var Redis=require(_0xe323('0x2'));var db=require(_0xe323('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xe323('0x4'));var client=jayson[_0xe323('0x5')][_0xe323('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x4c7253,_0x10bfa4,_0x10c493){return new BPromise(function(_0x28c733,_0x17e8cc){return client['request'](_0x4c7253,_0x10c493)[_0xe323('0x7')](function(_0x5c58e2){logger[_0xe323('0x8')](_0xe323('0x9'),_0x10bfa4,_0xe323('0xa'));logger['debug'](_0xe323('0xb'),_0x10bfa4,'request\x20sent',JSON[_0xe323('0xc')](_0x5c58e2));if(_0x5c58e2['error']){if(_0x5c58e2[_0xe323('0xd')]['code']===0x1f4){logger[_0xe323('0xd')](_0xe323('0x9'),_0x10bfa4,_0x5c58e2[_0xe323('0xd')][_0xe323('0xe')]);return _0x17e8cc(_0x5c58e2[_0xe323('0xd')][_0xe323('0xe')]);}logger[_0xe323('0xd')](_0xe323('0x9'),_0x10bfa4,_0x5c58e2[_0xe323('0xd')][_0xe323('0xe')]);return _0x28c733(_0x5c58e2[_0xe323('0xd')][_0xe323('0xe')]);}else{logger[_0xe323('0x8')](_0xe323('0x9'),_0x10bfa4,_0xe323('0xa'));_0x28c733(_0x5c58e2['result'][_0xe323('0xe')]);}})['catch'](function(_0x7bc8cc){logger[_0xe323('0xd')](_0xe323('0x9'),_0x10bfa4,_0x7bc8cc);_0x17e8cc(_0x7bc8cc);});});}exports[_0xe323('0xf')]=function(_0x4528a6){var _0x23720f=this;return new Promise(function(_0x46931e,_0x57116f){return db[_0xe323('0x10')][_0xe323('0x11')](_0x4528a6[_0xe323('0x12')],{'raw':_0x4528a6[_0xe323('0x13')]?_0x4528a6[_0xe323('0x13')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4528a6[_0xe323('0x13')]?_0x4528a6['options'][_0xe323('0x14')]||null:null,'attributes':_0x4528a6[_0xe323('0x13')]?_0x4528a6[_0xe323('0x13')][_0xe323('0x15')]||null:null,'limit':_0x4528a6[_0xe323('0x13')]?_0x4528a6['options']['limit']||null:null})[_0xe323('0x7')](function(_0x2714f9){logger[_0xe323('0x8')]('UpdateMailApplication',_0x4528a6);logger['debug'](_0xe323('0xf'),_0x4528a6,JSON[_0xe323('0xc')](_0x2714f9));_0x46931e(_0x2714f9);})['catch'](function(_0x5ebab6){logger[_0xe323('0xd')](_0xe323('0xf'),_0x5ebab6[_0xe323('0xe')],_0x4528a6);_0x57116f(_0x23720f[_0xe323('0xd')](0x1f4,_0x5ebab6['message']));});});}; \ No newline at end of file +var _0xb087=['attributes','limit','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','client','request','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateMailApplication','MailApplication','update','body','options','raw','where'];(function(_0x3e10ce,_0x49e675){var _0x32c397=function(_0x52b065){while(--_0x52b065){_0x3e10ce['push'](_0x3e10ce['shift']());}};_0x32c397(++_0x49e675);}(_0xb087,0x1b5));var _0x7b08=function(_0x17e333,_0xabde3){_0x17e333=_0x17e333-0x0;var _0xcfdd41=_0xb087[_0x17e333];return _0xcfdd41;};'use strict';var _=require(_0x7b08('0x0'));var util=require(_0x7b08('0x1'));var moment=require(_0x7b08('0x2'));var BPromise=require(_0x7b08('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7b08('0x4'));var db=require(_0x7b08('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7b08('0x6'));var config=require(_0x7b08('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x7b08('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x154f44,_0x422085,_0x900d40){return new BPromise(function(_0x6f4495,_0x2f7a0c){return client[_0x7b08('0x9')](_0x154f44,_0x900d40)[_0x7b08('0xa')](function(_0x52cebf){logger[_0x7b08('0xb')](_0x7b08('0xc'),_0x422085,_0x7b08('0xd'));logger[_0x7b08('0xe')](_0x7b08('0xf'),_0x422085,'request\x20sent',JSON['stringify'](_0x52cebf));if(_0x52cebf['error']){if(_0x52cebf[_0x7b08('0x10')][_0x7b08('0x11')]===0x1f4){logger['error'](_0x7b08('0xc'),_0x422085,_0x52cebf[_0x7b08('0x10')][_0x7b08('0x12')]);return _0x2f7a0c(_0x52cebf[_0x7b08('0x10')]['message']);}logger['error'](_0x7b08('0xc'),_0x422085,_0x52cebf[_0x7b08('0x10')][_0x7b08('0x12')]);return _0x6f4495(_0x52cebf[_0x7b08('0x10')][_0x7b08('0x12')]);}else{logger[_0x7b08('0xb')](_0x7b08('0xc'),_0x422085,_0x7b08('0xd'));_0x6f4495(_0x52cebf[_0x7b08('0x13')][_0x7b08('0x12')]);}})[_0x7b08('0x14')](function(_0x49d8bb){logger['error']('MailApplication,\x20%s,\x20%s',_0x422085,_0x49d8bb);_0x2f7a0c(_0x49d8bb);});});}exports[_0x7b08('0x15')]=function(_0x229f1a){var _0xd65e92=this;return new Promise(function(_0x37cdb1,_0x47d2a4){return db[_0x7b08('0x16')][_0x7b08('0x17')](_0x229f1a[_0x7b08('0x18')],{'raw':_0x229f1a[_0x7b08('0x19')]?_0x229f1a[_0x7b08('0x19')][_0x7b08('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x229f1a[_0x7b08('0x19')]?_0x229f1a[_0x7b08('0x19')][_0x7b08('0x1b')]||null:null,'attributes':_0x229f1a['options']?_0x229f1a['options'][_0x7b08('0x1c')]||null:null,'limit':_0x229f1a['options']?_0x229f1a[_0x7b08('0x19')][_0x7b08('0x1d')]||null:null})['then'](function(_0x215af1){logger[_0x7b08('0xb')](_0x7b08('0x15'),_0x229f1a);logger[_0x7b08('0xe')](_0x7b08('0x15'),_0x229f1a,JSON[_0x7b08('0x1e')](_0x215af1));_0x37cdb1(_0x215af1);})[_0x7b08('0x14')](function(_0x2ff41b){logger['error'](_0x7b08('0x15'),_0x2ff41b[_0x7b08('0x12')],_0x229f1a);_0x47d2a4(_0xd65e92[_0x7b08('0x10')](0x1f4,_0x2ff41b['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 08708d3..1928384 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 _0x8142=['post','create','/:id/tags','mail','addTags','put','mailinteraction:update','update','delete','destroy','exports','express','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','index','describe','/:id','show','/:id/messages','getMessages','/:id/download','download'];(function(_0x1f0398,_0x4a96ef){var _0x1c35cd=function(_0x3ac730){while(--_0x3ac730){_0x1f0398['push'](_0x1f0398['shift']());}};_0x1c35cd(++_0x4a96ef);}(_0x8142,0x129));var _0x2814=function(_0x4e6fb2,_0x3cf23e){_0x4e6fb2=_0x4e6fb2-0x0;var _0x2f1636=_0x8142[_0x4e6fb2];return _0x2f1636;};'use strict';var express=require(_0x2814('0x0'));var router=express[_0x2814('0x1')]();var auth=require(_0x2814('0x2'));var interaction=require(_0x2814('0x3'));var controller=require(_0x2814('0x4'));router[_0x2814('0x5')]('/',auth[_0x2814('0x6')](),controller[_0x2814('0x7')]);router[_0x2814('0x5')]('/describe',auth[_0x2814('0x6')](),controller[_0x2814('0x8')]);router['get'](_0x2814('0x9'),auth['isAuthenticated'](),controller[_0x2814('0xa')]);router[_0x2814('0x5')](_0x2814('0xb'),auth[_0x2814('0x6')](),controller[_0x2814('0xc')]);router[_0x2814('0x5')](_0x2814('0xd'),auth[_0x2814('0x6')](),controller[_0x2814('0xe')]);router[_0x2814('0xf')]('/',auth[_0x2814('0x6')](),controller[_0x2814('0x10')]);router[_0x2814('0xf')](_0x2814('0xb'),auth[_0x2814('0x6')](),controller['addMessage']);router[_0x2814('0xf')](_0x2814('0x11'),auth[_0x2814('0x6')](),interaction['tracked'](_0x2814('0x12'),'mailinteraction:addtags'),controller[_0x2814('0x13')]);router[_0x2814('0x14')](_0x2814('0x9'),auth['isAuthenticated'](),interaction['tracked']('mail',_0x2814('0x15')),controller[_0x2814('0x16')]);router[_0x2814('0x17')](_0x2814('0x9'),auth[_0x2814('0x6')](),interaction['tracked']('mail','mailinteraction:destroy'),controller[_0x2814('0x18')]);router['delete']('/:id/tags',auth[_0x2814('0x6')](),controller['removeTags']);module[_0x2814('0x19')]=router; \ No newline at end of file +var _0x8972=['../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/messages','download','post','create','addMessage','/:id/tags','tracked','addTags','put','mail','delete','mailinteraction:destroy','destroy','removeTags','exports','express','Router'];(function(_0x3fe2ea,_0x485b45){var _0x5185de=function(_0x396148){while(--_0x396148){_0x3fe2ea['push'](_0x3fe2ea['shift']());}};_0x5185de(++_0x485b45);}(_0x8972,0x178));var _0x2897=function(_0x44aa6a,_0x148a1b){_0x44aa6a=_0x44aa6a-0x0;var _0x58fa9b=_0x8972[_0x44aa6a];return _0x58fa9b;};'use strict';var express=require(_0x2897('0x0'));var router=express[_0x2897('0x1')]();var auth=require(_0x2897('0x2'));var interaction=require(_0x2897('0x3'));var controller=require(_0x2897('0x4'));router['get']('/',auth[_0x2897('0x5')](),controller[_0x2897('0x6')]);router[_0x2897('0x7')](_0x2897('0x8'),auth[_0x2897('0x5')](),controller[_0x2897('0x9')]);router['get'](_0x2897('0xa'),auth['isAuthenticated'](),controller[_0x2897('0xb')]);router['get'](_0x2897('0xc'),auth[_0x2897('0x5')](),controller['getMessages']);router[_0x2897('0x7')]('/:id/download',auth[_0x2897('0x5')](),controller[_0x2897('0xd')]);router[_0x2897('0xe')]('/',auth[_0x2897('0x5')](),controller[_0x2897('0xf')]);router[_0x2897('0xe')](_0x2897('0xc'),auth[_0x2897('0x5')](),controller[_0x2897('0x10')]);router[_0x2897('0xe')](_0x2897('0x11'),auth[_0x2897('0x5')](),interaction[_0x2897('0x12')]('mail','mailinteraction:addtags'),controller[_0x2897('0x13')]);router[_0x2897('0x14')](_0x2897('0xa'),auth[_0x2897('0x5')](),interaction['tracked'](_0x2897('0x15'),'mailinteraction:update'),controller['update']);router[_0x2897('0x16')]('/:id',auth[_0x2897('0x5')](),interaction['tracked'](_0x2897('0x15'),_0x2897('0x17')),controller[_0x2897('0x18')]);router[_0x2897('0x16')](_0x2897('0x11'),auth[_0x2897('0x5')](),controller[_0x2897('0x19')]);module[_0x2897('0x1a')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 106688b..47bfd61 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 _0x674e=['STRING','TEXT','ENUM','out','INTEGER','sequelize','iconv','exports','BOOLEAN','DATE'];(function(_0x401b3e,_0xed8de5){var _0x4f290f=function(_0xa45f77){while(--_0xa45f77){_0x401b3e['push'](_0x401b3e['shift']());}};_0x4f290f(++_0xed8de5);}(_0x674e,0x91));var _0xe674=function(_0x745a3f,_0x4310d9){_0x745a3f=_0x745a3f-0x0;var _0x33d2e0=_0x674e[_0x745a3f];return _0x33d2e0;};'use strict';var Sequelize=require(_0xe674('0x0'));var iconv=require(_0xe674('0x1'));module[_0xe674('0x2')]={'closed':{'type':Sequelize[_0xe674('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xe674('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xe674('0x5')]},'thirdDisposition':{'type':Sequelize[_0xe674('0x5')]},'note':{'type':Sequelize[_0xe674('0x5')]},'inReplyTo':{'type':Sequelize[_0xe674('0x5')](0x1fe)},'to':{'type':Sequelize[_0xe674('0x5')]},'cc':{'type':Sequelize[_0xe674('0x6')]('long')},'subject':{'type':Sequelize[_0xe674('0x6')]()},'attach':{'type':Sequelize[_0xe674('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xe674('0x4')]},'substatus':{'type':Sequelize[_0xe674('0x5')](0x3c)},'substatusAt':{'type':Sequelize[_0xe674('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xe674('0x7')]('in',_0xe674('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xe674('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xe674('0x7')]('in',_0xe674('0x8')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0xe674('0x9')]}}; \ No newline at end of file +var _0x62fe=['long','ENUM','out','sequelize','iconv','exports','BOOLEAN','DATE','STRING','TEXT'];(function(_0x8e624d,_0x2da1f6){var _0x12bd8d=function(_0x48cf6b){while(--_0x48cf6b){_0x8e624d['push'](_0x8e624d['shift']());}};_0x12bd8d(++_0x2da1f6);}(_0x62fe,0x11b));var _0xe62f=function(_0x3f9456,_0x47c6e1){_0x3f9456=_0x3f9456-0x0;var _0x24eb3e=_0x62fe[_0x3f9456];return _0x24eb3e;};'use strict';var Sequelize=require(_0xe62f('0x0'));var iconv=require(_0xe62f('0x1'));module[_0xe62f('0x2')]={'closed':{'type':Sequelize[_0xe62f('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xe62f('0x4')]},'disposition':{'type':Sequelize[_0xe62f('0x5')]},'secondDisposition':{'type':Sequelize[_0xe62f('0x5')]},'thirdDisposition':{'type':Sequelize[_0xe62f('0x5')]},'note':{'type':Sequelize[_0xe62f('0x5')]},'inReplyTo':{'type':Sequelize[_0xe62f('0x5')](0x1fe)},'to':{'type':Sequelize[_0xe62f('0x5')]},'cc':{'type':Sequelize[_0xe62f('0x6')](_0xe62f('0x7'))},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize[_0xe62f('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xe62f('0x4')]},'substatus':{'type':Sequelize[_0xe62f('0x5')](0x3c)},'substatusAt':{'type':Sequelize[_0xe62f('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xe62f('0x8')]('in',_0xe62f('0x9')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xe62f('0x8')]('in',_0xe62f('0x9')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xe62f('0x3')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 69cb497..787f48c 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 _0xc498=['../../config/environment','../../mysqldb','html-entities','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','sendStatus','status','end','json','offset','undefined','count','limit','set','then','destroy','error','name','send','index','map','MailInteraction','rawAttributes','fieldName','type','key','findAll','mail','query','user','show','params','model','keys','filters','intersection','fields','attributes','length','includeAll','include','merge','find','catch','create','body','update','describe','addMessage','ids','omit','getMessages','findOne','nolimit','order','sort','where','pick','MailInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','options','MailMessage','inlineCss','rows','spread','Tag','emit','mailInteractionTags:save','removeTags','download','unix','server','files','tmp','join','root','attachments','transcript-%d-%s.zip','Attachment','Attachments','Messages','from','bcc','subject','get','mkdirSync','each','decode','createdAt','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','basename','existsSync','push','readFileSync','build','writeFileSync','message%d.eml','unlinkSync','eml-format','rimraf','zip-dir','moment','bluebird','path','lodash','juice','ioredis','../../components/interaction/service','../../components/parsers/qs'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc498,0x157));var _0x8c49=function(_0x706fb4,_0x24e06b){_0x706fb4=_0x706fb4-0x0;var _0x48477a=_0xc498[_0x706fb4];return _0x48477a;};'use strict';var emlformat=require(_0x8c49('0x0'));var rimraf=require(_0x8c49('0x1'));var zipdir=require(_0x8c49('0x2'));var moment=require(_0x8c49('0x3'));var BPromise=require(_0x8c49('0x4'));var util=require('util');var path=require(_0x8c49('0x5'));var fs=require('fs');var _=require(_0x8c49('0x6'));var juice=require(_0x8c49('0x7'));var Redis=require(_0x8c49('0x8'));var interaction=require(_0x8c49('0x9'));var qs=require(_0x8c49('0xa'));var logger=require('../../config/logger')('api');var config=require(_0x8c49('0xb'));var db=require(_0x8c49('0xc'))['db'];var htmlEntities=require(_0x8c49('0xd'));config[_0x8c49('0xe')]=_[_0x8c49('0xf')](config[_0x8c49('0xe')],{'host':_0x8c49('0x10'),'port':0x18eb});var socket=require(_0x8c49('0x11'))(new Redis(config[_0x8c49('0xe')]));require(_0x8c49('0x12'))['register'](socket);function respondWithStatusCode(_0x133825,_0x177854){_0x177854=_0x177854||0xcc;return function(_0x2fd574){if(_0x2fd574){return _0x133825[_0x8c49('0x13')](_0x177854);}return _0x133825[_0x8c49('0x14')](_0x177854)[_0x8c49('0x15')]();};}function respondWithResult(_0x51f1a9,_0x54e8e3){_0x54e8e3=_0x54e8e3||0xc8;return function(_0x27722a){if(_0x27722a){return _0x51f1a9['status'](_0x54e8e3)[_0x8c49('0x16')](_0x27722a);}};}function respondWithFilteredResult(_0x1af738,_0x2388f4){return function(_0x3518f1){if(_0x3518f1){var _0x541621=typeof _0x2388f4[_0x8c49('0x17')]===_0x8c49('0x18')&&typeof _0x2388f4['limit']===_0x8c49('0x18');var _0x5c68b4=_0x3518f1['count'];var _0x23c474=_0x541621?0x0:_0x2388f4[_0x8c49('0x17')];var _0x534a20=_0x541621?_0x3518f1[_0x8c49('0x19')]:_0x2388f4['offset']+_0x2388f4[_0x8c49('0x1a')];var _0x511d8a;if(_0x534a20>=_0x5c68b4){_0x534a20=_0x5c68b4;_0x511d8a=0xc8;}else{_0x511d8a=0xce;}_0x1af738[_0x8c49('0x14')](_0x511d8a);return _0x1af738[_0x8c49('0x1b')]('Content-Range',_0x23c474+'-'+_0x534a20+'/'+_0x5c68b4)[_0x8c49('0x16')](_0x3518f1);}return null;};}function saveUpdates(_0x585a0b){return function(_0x47fcb5){if(_0x47fcb5){return _0x47fcb5['update'](_0x585a0b)[_0x8c49('0x1c')](function(_0x29cc5c){return _0x29cc5c;});}return null;};}function removeEntity(_0x476faa){return function(_0x2bb841){if(_0x2bb841){return _0x2bb841[_0x8c49('0x1d')]()[_0x8c49('0x1c')](function(){_0x476faa[_0x8c49('0x14')](0xcc)[_0x8c49('0x15')]();});}};}function handleEntityNotFound(_0x5b1730){return function(_0x2a964a){if(!_0x2a964a){_0x5b1730['sendStatus'](0x194);}return _0x2a964a;};}function handleError(_0x3e5984,_0x135b5b){_0x135b5b=_0x135b5b||0x1f4;return function(_0x11415b){logger[_0x8c49('0x1e')](_0x11415b['stack']);if(_0x11415b['name']){delete _0x11415b[_0x8c49('0x1f')];}_0x3e5984[_0x8c49('0x14')](_0x135b5b)[_0x8c49('0x20')](_0x11415b);};}exports[_0x8c49('0x21')]=function(_0x3a540d,_0x2c9c2a){var _0x3d742d={};var _0x2d44ef=_[_0x8c49('0x22')](db[_0x8c49('0x23')][_0x8c49('0x24')],function(_0x55c652){return{'name':_0x55c652[_0x8c49('0x25')],'type':_0x55c652[_0x8c49('0x26')][_0x8c49('0x27')]};});_0x3d742d=qs['getOptions'](_0x2d44ef,_0x3a540d);return interaction[_0x8c49('0x28')](_0x8c49('0x29'),_0x3a540d[_0x8c49('0x2a')],_0x3a540d[_0x8c49('0x2b')],_0x3d742d,_0x2d44ef)['then'](respondWithFilteredResult(_0x2c9c2a,_0x3d742d))['catch'](handleError(_0x2c9c2a,null));};exports[_0x8c49('0x2c')]=function(_0x1fddcd,_0x2971aa){var _0x188b49={'raw':![],'where':{'id':_0x1fddcd[_0x8c49('0x2d')]['id']}},_0x3e765e={};_0x3e765e[_0x8c49('0x2e')]=_[_0x8c49('0x2f')](db['MailInteraction'][_0x8c49('0x24')]);_0x3e765e[_0x8c49('0x2a')]=_['keys'](_0x1fddcd[_0x8c49('0x2a')]);_0x3e765e[_0x8c49('0x30')]=_[_0x8c49('0x31')](_0x3e765e['model'],_0x3e765e[_0x8c49('0x2a')]);_0x188b49['attributes']=_[_0x8c49('0x31')](_0x3e765e[_0x8c49('0x2e')],qs[_0x8c49('0x32')](_0x1fddcd[_0x8c49('0x2a')][_0x8c49('0x32')]));_0x188b49[_0x8c49('0x33')]=_0x188b49['attributes'][_0x8c49('0x34')]?_0x188b49['attributes']:_0x3e765e['model'];if(_0x1fddcd['query'][_0x8c49('0x35')]){_0x188b49[_0x8c49('0x36')]=[{'all':!![]}];}_0x188b49=_[_0x8c49('0x37')]({},_0x188b49,_0x1fddcd['options']);return db[_0x8c49('0x23')][_0x8c49('0x38')](_0x188b49)[_0x8c49('0x1c')](handleEntityNotFound(_0x2971aa,null))[_0x8c49('0x1c')](respondWithResult(_0x2971aa,null))[_0x8c49('0x39')](handleError(_0x2971aa,null));};exports[_0x8c49('0x3a')]=function(_0x7e4736,_0x3278ce){return db[_0x8c49('0x23')][_0x8c49('0x3a')](_0x7e4736[_0x8c49('0x3b')],{})[_0x8c49('0x1c')](respondWithResult(_0x3278ce,0xc9))[_0x8c49('0x39')](handleError(_0x3278ce,null));};exports[_0x8c49('0x3c')]=function(_0x57851c,_0x545187){if(_0x57851c[_0x8c49('0x3b')]['id']){delete _0x57851c['body']['id'];}return db['MailInteraction']['find']({'where':{'id':_0x57851c[_0x8c49('0x2d')]['id']}})[_0x8c49('0x1c')](handleEntityNotFound(_0x545187,null))[_0x8c49('0x1c')](saveUpdates(_0x57851c[_0x8c49('0x3b')],null))[_0x8c49('0x1c')](respondWithResult(_0x545187,null))[_0x8c49('0x39')](handleError(_0x545187,null));};exports['destroy']=function(_0x280492,_0x5d0673){return db[_0x8c49('0x23')][_0x8c49('0x38')]({'where':{'id':_0x280492[_0x8c49('0x2d')]['id']}})[_0x8c49('0x1c')](handleEntityNotFound(_0x5d0673,null))[_0x8c49('0x1c')](removeEntity(_0x5d0673,null))[_0x8c49('0x39')](handleError(_0x5d0673,null));};exports['describe']=function(_0x3ca038,_0xd22548){return db['MailInteraction'][_0x8c49('0x3d')]()[_0x8c49('0x1c')](respondWithResult(_0xd22548,null))['catch'](handleError(_0xd22548,null));};exports[_0x8c49('0x3e')]=function(_0x520f5d,_0x5c7ae5){return db['MailMessage'][_0x8c49('0x38')]({'where':{'id':_0x520f5d['params']['id']}})[_0x8c49('0x1c')](handleEntityNotFound(_0x5c7ae5,null))[_0x8c49('0x1c')](function(_0x414e5a){if(_0x414e5a){return _0x414e5a[_0x8c49('0x3e')](_0x520f5d[_0x8c49('0x3b')][_0x8c49('0x3f')],_[_0x8c49('0x40')](_0x520f5d[_0x8c49('0x3b')],['ids','id'])||{});}})[_0x8c49('0x1c')](respondWithResult(_0x5c7ae5,null))[_0x8c49('0x39')](handleError(_0x5c7ae5,null));};exports[_0x8c49('0x41')]=function(_0x4f7af7,_0x5e993e){var _0x5ff56e={'raw':![],'where':{}};var _0x50b46e={};var _0x4253e7={'count':0x0,'rows':[]};return db['MailInteraction'][_0x8c49('0x42')]({'where':{'id':_0x4f7af7['params']['id']}})['then'](handleEntityNotFound(_0x5e993e,null))[_0x8c49('0x1c')](function(_0x49e2eb){if(_0x49e2eb){_0x50b46e[_0x8c49('0x2e')]=_[_0x8c49('0x2f')](db['MailMessage'][_0x8c49('0x24')]);_0x50b46e[_0x8c49('0x2a')]=_[_0x8c49('0x2f')](_0x4f7af7[_0x8c49('0x2a')]);_0x50b46e[_0x8c49('0x30')]=_[_0x8c49('0x31')](_0x50b46e[_0x8c49('0x2e')],_0x50b46e[_0x8c49('0x2a')]);_0x5ff56e['attributes']=_[_0x8c49('0x31')](_0x50b46e[_0x8c49('0x2e')],qs['fields'](_0x4f7af7['query'][_0x8c49('0x32')]));_0x5ff56e[_0x8c49('0x33')]=_0x5ff56e[_0x8c49('0x33')][_0x8c49('0x34')]?_0x5ff56e[_0x8c49('0x33')]:_0x50b46e[_0x8c49('0x2e')];if(!_0x4f7af7[_0x8c49('0x2a')]['hasOwnProperty'](_0x8c49('0x43'))){_0x5ff56e[_0x8c49('0x1a')]=qs[_0x8c49('0x1a')](_0x4f7af7[_0x8c49('0x2a')]['limit']);_0x5ff56e[_0x8c49('0x17')]=qs['offset'](_0x4f7af7['query']['offset']);}_0x5ff56e[_0x8c49('0x44')]=qs[_0x8c49('0x45')](_0x4f7af7[_0x8c49('0x2a')][_0x8c49('0x45')]);_0x5ff56e[_0x8c49('0x46')]=qs[_0x8c49('0x30')](_[_0x8c49('0x47')](_0x4f7af7[_0x8c49('0x2a')],_0x50b46e[_0x8c49('0x30')]));_0x5ff56e['where'][_0x8c49('0x48')]=_0x49e2eb['id'];if(_0x4f7af7[_0x8c49('0x2a')][_0x8c49('0x49')]){_0x5ff56e[_0x8c49('0x46')]=_[_0x8c49('0x37')](_0x5ff56e[_0x8c49('0x46')],{'$or':_['map'](_0x5ff56e['attributes'],function(_0xc5cdaa){var _0x454b81={};_0x454b81[_0xc5cdaa]={'$like':'%'+_0x4f7af7['query'][_0x8c49('0x49')]+'%'};return _0x454b81;})});}if(_0x4f7af7['query'][_0x8c49('0x4a')]){var _0x8fcd88=_0x4f7af7['query']['$gte'][_0x8c49('0x4b')](',');var _0x4e4385={};_0x4e4385[_0x8fcd88[0x0]]={'$gte':moment(_0x8fcd88[0x1])[_0x8c49('0x4c')](_0x8c49('0x4d'))};_0x5ff56e['where']=_[_0x8c49('0x37')](_0x5ff56e[_0x8c49('0x46')],_0x4e4385);}_0x5ff56e=_['merge']({},_0x5ff56e,_0x4f7af7[_0x8c49('0x4e')]);return db['MailMessage'][_0x8c49('0x19')]({'where':_0x5ff56e[_0x8c49('0x46')]})[_0x8c49('0x1c')](function(_0xa8c20a){_0x4253e7[_0x8c49('0x19')]=_0xa8c20a;if(_0x4f7af7[_0x8c49('0x2a')][_0x8c49('0x35')]){_0x5ff56e[_0x8c49('0x36')]=[{'all':!![]}];}return db[_0x8c49('0x4f')][_0x8c49('0x28')](_0x5ff56e);})[_0x8c49('0x1c')](function(_0x15552b){if(_0x4f7af7['query'][_0x8c49('0x50')]==='true'){for(var _0x19b1e3=0x0;_0x19b1e3<_0x15552b['length'];_0x19b1e3++){_0x15552b[_0x19b1e3][_0x8c49('0x3b')]=juice(_0x15552b[_0x19b1e3][_0x8c49('0x3b')]);}}_0x4253e7[_0x8c49('0x51')]=_0x15552b;return _0x4253e7;});}})[_0x8c49('0x1c')](respondWithFilteredResult(_0x5e993e,_0x5ff56e))[_0x8c49('0x39')](handleError(_0x5e993e,null));};exports['addTags']=function(_0x10948b,_0x569292){return db[_0x8c49('0x23')][_0x8c49('0x38')]({'where':{'id':_0x10948b['params']['id']}})[_0x8c49('0x1c')](handleEntityNotFound(_0x569292,null))[_0x8c49('0x1c')](function(_0x191f25){if(_0x191f25){return _0x191f25['setTags'](_0x10948b[_0x8c49('0x3b')][_0x8c49('0x3f')],_['omit'](_0x10948b[_0x8c49('0x3b')],[_0x8c49('0x3f'),'id'])||{})[_0x8c49('0x52')](function(){return db[_0x8c49('0x53')][_0x8c49('0x28')]({'attributes':['id','name','color'],'where':{'id':_0x10948b[_0x8c49('0x3b')]['ids']}});})['then'](function(_0x56aa8b){socket[_0x8c49('0x54')](_0x8c49('0x55'),{'id':Number(_0x10948b[_0x8c49('0x2d')]['id']),'tags':_0x56aa8b||[]});return{'id':Number(_0x10948b[_0x8c49('0x2d')]['id']),'tags':_0x56aa8b||[]};});}})[_0x8c49('0x1c')](respondWithResult(_0x569292,null))[_0x8c49('0x39')](handleError(_0x569292,null));};exports[_0x8c49('0x56')]=function(_0x4d4a7a,_0x4b8f15){return db[_0x8c49('0x23')][_0x8c49('0x38')]({'where':{'id':_0x4d4a7a[_0x8c49('0x2d')]['id']}})[_0x8c49('0x1c')](handleEntityNotFound(_0x4b8f15,null))[_0x8c49('0x1c')](function(_0x5d67d6){if(_0x5d67d6){return _0x5d67d6['removeTags'](_0x4d4a7a[_0x8c49('0x2a')]['ids']);}})[_0x8c49('0x1c')](respondWithStatusCode(_0x4b8f15,null))[_0x8c49('0x39')](handleError(_0x4b8f15,null));};exports[_0x8c49('0x57')]=function(_0x4ae69a,_0x56576b){var _0x3aa89a=moment()[_0x8c49('0x58')]()['toString']();var _0x241c3e=path['join'](config['root'],_0x8c49('0x59'),_0x8c49('0x5a'),_0x8c49('0x5b'));var _0x329356=path[_0x8c49('0x5c')](config[_0x8c49('0x5d')],'server',_0x8c49('0x5a'),_0x8c49('0x5e'));var _0x348670=path['join'](_0x241c3e,_0x3aa89a);var _0x411a70=util[_0x8c49('0x4c')](_0x8c49('0x5f'),_0x4ae69a[_0x8c49('0x2d')]['id'],_0x3aa89a);var _0x50c898=path[_0x8c49('0x5c')](_0x241c3e,_0x411a70);var _0x409131=[];if(_0x4ae69a[_0x8c49('0x2a')][_0x8c49('0x5e')]){_0x409131['push']({'model':db[_0x8c49('0x60')],'as':_0x8c49('0x61'),'raw':!![]});}var _0x13adb7=[{'model':db[_0x8c49('0x4f')],'as':_0x8c49('0x62'),'attributes':['id',_0x8c49('0x3b'),_0x8c49('0x63'),'to','cc',_0x8c49('0x64'),_0x8c49('0x65'),'createdAt'],'where':{'secret':![]},'order':qs[_0x8c49('0x45')]('id'),'include':_0x409131}];return db['MailInteraction'][_0x8c49('0x38')]({'where':{'id':_0x4ae69a[_0x8c49('0x2d')]['id']},'include':_0x13adb7})[_0x8c49('0x1c')](handleEntityNotFound(_0x56576b,null))[_0x8c49('0x1c')](function(_0x4929fa){if(_0x4929fa&&_0x4929fa[_0x8c49('0x62')]){var _0x247849=_0x4929fa[_0x8c49('0x66')]({'plain':!![]});fs[_0x8c49('0x67')](_0x348670);return BPromise[_0x8c49('0x68')](_0x247849[_0x8c49('0x62')],function(_0x5000f5,_0x3ceef9){var _0x4e4a67={'from':_0x5000f5[_0x8c49('0x63')],'to':_0x5000f5['to']||'missing.recipient@your.company.com','subject':_0x5000f5[_0x8c49('0x65')],'html':htmlEntities[_0x8c49('0x69')](_0x5000f5[_0x8c49('0x3b')]),'headers':{'Date':moment(_0x5000f5[_0x8c49('0x6a')])[_0x8c49('0x4c')](_0x8c49('0x6b'))},'attachments':[]};if(_0x5000f5['cc']){_0x4e4a67['headers']['Cc']=_0x5000f5['cc'];}if(_0x5000f5[_0x8c49('0x64')]){_0x4e4a67[_0x8c49('0x6c')][_0x8c49('0x6d')]=_0x5000f5[_0x8c49('0x64')];}return new BPromise(function(_0x560b2d,_0x167a1e){if(_0x5000f5[_0x8c49('0x61')]){for(var _0x3451b6=0x0;_0x3451b6<_0x5000f5[_0x8c49('0x61')][_0x8c49('0x34')];_0x3451b6++){var _0xf2c3c0=_0x5000f5['Attachments'][_0x3451b6];var _0x214b95=path[_0x8c49('0x5c')](_0x329356,_0xf2c3c0[_0x8c49('0x6e')]);if(fs[_0x8c49('0x6f')](_0x214b95)){_0x4e4a67[_0x8c49('0x5e')][_0x8c49('0x70')]({'name':_0xf2c3c0[_0x8c49('0x1f')],'contentType':_0xf2c3c0[_0x8c49('0x26')],'data':fs[_0x8c49('0x71')](_0x214b95)});}}}emlformat[_0x8c49('0x72')](_0x4e4a67,function(_0x488564,_0xa47d9f){if(_0x488564)return _0x167a1e(_0x488564);fs[_0x8c49('0x73')](path[_0x8c49('0x5c')](_0x348670,util[_0x8c49('0x4c')](_0x8c49('0x74'),_0x3ceef9)),_0xa47d9f);return _0x560b2d(_0xa47d9f);});});})[_0x8c49('0x1c')](function(){return new BPromise(function(_0x5ac387,_0x27dea2){zipdir(_0x348670,{'saveTo':_0x50c898},function(_0x3abb0,_0x24c055){if(_0x3abb0)return _0x27dea2(_0x3abb0);return _0x5ac387(_0x24c055);});})[_0x8c49('0x1c')](function(){return new BPromise(function(_0x5cb8ad,_0x1d3270){rimraf(_0x348670,function(_0x23f327){if(_0x23f327)_0x1d3270(_0x23f327);return _0x5cb8ad();});});})[_0x8c49('0x1c')](function(){return _0x56576b[_0x8c49('0x57')](_0x50c898,_0x411a70,function(_0x21973d){if(!_0x21973d)fs[_0x8c49('0x75')](_0x50c898);});});});}else{return _0x56576b[_0x8c49('0x13')](0xc8);}})[_0x8c49('0x39')](handleError(_0x56576b,null));}; \ No newline at end of file +var _0x34df=['server','tmp','join','format','push','Attachments','Messages','subject','createdAt','mkdirSync','each','from','decode','headers','bcc','Bcc','basename','existsSync','name','readFileSync','build','message%d.eml','unlinkSync','rimraf','zip-dir','moment','bluebird','path','lodash','juice','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','html-entities','redis','defaults','localhost','./mailInteraction.socket','status','end','offset','undefined','limit','count','set','Content-Range','json','update','destroy','then','error','send','map','MailInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','user','catch','show','params','model','keys','query','intersection','attributes','fields','include','merge','options','find','create','body','addMessage','ids','omit','filters','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','split','YYYY-MM-DD\x20HH:mm:ss','MailMessage','includeAll','inlineCss','true','addTags','Tag','color','emit','removeTags','download','unix','root'];(function(_0x5a69a9,_0x1cb225){var _0xdb22c7=function(_0x4fbe13){while(--_0x4fbe13){_0x5a69a9['push'](_0x5a69a9['shift']());}};_0xdb22c7(++_0x1cb225);}(_0x34df,0x80));var _0xf34d=function(_0x9c3c56,_0x169b56){_0x9c3c56=_0x9c3c56-0x0;var _0x2dd782=_0x34df[_0x9c3c56];return _0x2dd782;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf34d('0x0'));var zipdir=require(_0xf34d('0x1'));var moment=require(_0xf34d('0x2'));var BPromise=require(_0xf34d('0x3'));var util=require('util');var path=require(_0xf34d('0x4'));var fs=require('fs');var _=require(_0xf34d('0x5'));var juice=require(_0xf34d('0x6'));var Redis=require(_0xf34d('0x7'));var interaction=require(_0xf34d('0x8'));var qs=require(_0xf34d('0x9'));var logger=require(_0xf34d('0xa'))('api');var config=require(_0xf34d('0xb'));var db=require(_0xf34d('0xc'))['db'];var htmlEntities=require(_0xf34d('0xd'));config[_0xf34d('0xe')]=_[_0xf34d('0xf')](config['redis'],{'host':_0xf34d('0x10'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf34d('0xe')]));require(_0xf34d('0x11'))['register'](socket);function respondWithStatusCode(_0x929a84,_0x334e13){_0x334e13=_0x334e13||0xcc;return function(_0x238f82){if(_0x238f82){return _0x929a84['sendStatus'](_0x334e13);}return _0x929a84[_0xf34d('0x12')](_0x334e13)[_0xf34d('0x13')]();};}function respondWithResult(_0x3902b4,_0x4107eb){_0x4107eb=_0x4107eb||0xc8;return function(_0x4d67ad){if(_0x4d67ad){return _0x3902b4[_0xf34d('0x12')](_0x4107eb)['json'](_0x4d67ad);}};}function respondWithFilteredResult(_0x579a8e,_0x483e0d){return function(_0x46f406){if(_0x46f406){var _0x30cda6=typeof _0x483e0d[_0xf34d('0x14')]===_0xf34d('0x15')&&typeof _0x483e0d[_0xf34d('0x16')]==='undefined';var _0x126ce2=_0x46f406['count'];var _0x3c30f6=_0x30cda6?0x0:_0x483e0d[_0xf34d('0x14')];var _0x43b184=_0x30cda6?_0x46f406[_0xf34d('0x17')]:_0x483e0d[_0xf34d('0x14')]+_0x483e0d['limit'];var _0x3212e4;if(_0x43b184>=_0x126ce2){_0x43b184=_0x126ce2;_0x3212e4=0xc8;}else{_0x3212e4=0xce;}_0x579a8e['status'](_0x3212e4);return _0x579a8e[_0xf34d('0x18')](_0xf34d('0x19'),_0x3c30f6+'-'+_0x43b184+'/'+_0x126ce2)[_0xf34d('0x1a')](_0x46f406);}return null;};}function saveUpdates(_0xbaeb97){return function(_0x17da12){if(_0x17da12){return _0x17da12[_0xf34d('0x1b')](_0xbaeb97)['then'](function(_0x1ea57e){return _0x1ea57e;});}return null;};}function removeEntity(_0x4e64c0){return function(_0x3ef5ee){if(_0x3ef5ee){return _0x3ef5ee[_0xf34d('0x1c')]()[_0xf34d('0x1d')](function(){_0x4e64c0['status'](0xcc)[_0xf34d('0x13')]();});}};}function handleEntityNotFound(_0x2cf83f){return function(_0x48aa48){if(!_0x48aa48){_0x2cf83f['sendStatus'](0x194);}return _0x48aa48;};}function handleError(_0x47dbbe,_0x1c6cbe){_0x1c6cbe=_0x1c6cbe||0x1f4;return function(_0x13fb00){logger[_0xf34d('0x1e')](_0x13fb00['stack']);if(_0x13fb00['name']){delete _0x13fb00['name'];}_0x47dbbe['status'](_0x1c6cbe)[_0xf34d('0x1f')](_0x13fb00);};}exports['index']=function(_0x5bf9ae,_0x3f8694){var _0x50f4ca={};var _0x21e67a=_[_0xf34d('0x20')](db[_0xf34d('0x21')][_0xf34d('0x22')],function(_0x42b904){return{'name':_0x42b904[_0xf34d('0x23')],'type':_0x42b904[_0xf34d('0x24')][_0xf34d('0x25')]};});_0x50f4ca=qs[_0xf34d('0x26')](_0x21e67a,_0x5bf9ae);return interaction[_0xf34d('0x27')]('mail',_0x5bf9ae['query'],_0x5bf9ae[_0xf34d('0x28')],_0x50f4ca,_0x21e67a)[_0xf34d('0x1d')](respondWithFilteredResult(_0x3f8694,_0x50f4ca))[_0xf34d('0x29')](handleError(_0x3f8694,null));};exports[_0xf34d('0x2a')]=function(_0x166e43,_0x1098e6){var _0x4a6f15={'raw':![],'where':{'id':_0x166e43[_0xf34d('0x2b')]['id']}},_0x58a256={};_0x58a256[_0xf34d('0x2c')]=_[_0xf34d('0x2d')](db[_0xf34d('0x21')][_0xf34d('0x22')]);_0x58a256[_0xf34d('0x2e')]=_['keys'](_0x166e43['query']);_0x58a256['filters']=_[_0xf34d('0x2f')](_0x58a256['model'],_0x58a256[_0xf34d('0x2e')]);_0x4a6f15[_0xf34d('0x30')]=_[_0xf34d('0x2f')](_0x58a256[_0xf34d('0x2c')],qs[_0xf34d('0x31')](_0x166e43[_0xf34d('0x2e')][_0xf34d('0x31')]));_0x4a6f15[_0xf34d('0x30')]=_0x4a6f15[_0xf34d('0x30')]['length']?_0x4a6f15['attributes']:_0x58a256[_0xf34d('0x2c')];if(_0x166e43[_0xf34d('0x2e')]['includeAll']){_0x4a6f15[_0xf34d('0x32')]=[{'all':!![]}];}_0x4a6f15=_[_0xf34d('0x33')]({},_0x4a6f15,_0x166e43[_0xf34d('0x34')]);return db['MailInteraction'][_0xf34d('0x35')](_0x4a6f15)[_0xf34d('0x1d')](handleEntityNotFound(_0x1098e6,null))[_0xf34d('0x1d')](respondWithResult(_0x1098e6,null))['catch'](handleError(_0x1098e6,null));};exports[_0xf34d('0x36')]=function(_0x1c1115,_0x1f32ef){return db[_0xf34d('0x21')][_0xf34d('0x36')](_0x1c1115[_0xf34d('0x37')],{})[_0xf34d('0x1d')](respondWithResult(_0x1f32ef,0xc9))[_0xf34d('0x29')](handleError(_0x1f32ef,null));};exports[_0xf34d('0x1b')]=function(_0x3e194f,_0x3168b2){if(_0x3e194f[_0xf34d('0x37')]['id']){delete _0x3e194f[_0xf34d('0x37')]['id'];}return db['MailInteraction'][_0xf34d('0x35')]({'where':{'id':_0x3e194f[_0xf34d('0x2b')]['id']}})[_0xf34d('0x1d')](handleEntityNotFound(_0x3168b2,null))['then'](saveUpdates(_0x3e194f[_0xf34d('0x37')],null))[_0xf34d('0x1d')](respondWithResult(_0x3168b2,null))[_0xf34d('0x29')](handleError(_0x3168b2,null));};exports['destroy']=function(_0x1460db,_0x21a03f){return db[_0xf34d('0x21')][_0xf34d('0x35')]({'where':{'id':_0x1460db[_0xf34d('0x2b')]['id']}})[_0xf34d('0x1d')](handleEntityNotFound(_0x21a03f,null))['then'](removeEntity(_0x21a03f,null))[_0xf34d('0x29')](handleError(_0x21a03f,null));};exports['describe']=function(_0x99fcc0,_0x2a940d){return db[_0xf34d('0x21')]['describe']()['then'](respondWithResult(_0x2a940d,null))[_0xf34d('0x29')](handleError(_0x2a940d,null));};exports[_0xf34d('0x38')]=function(_0x3c87ab,_0xf29df9){return db['MailMessage'][_0xf34d('0x35')]({'where':{'id':_0x3c87ab[_0xf34d('0x2b')]['id']}})[_0xf34d('0x1d')](handleEntityNotFound(_0xf29df9,null))[_0xf34d('0x1d')](function(_0x32d6f4){if(_0x32d6f4){return _0x32d6f4['addMessage'](_0x3c87ab[_0xf34d('0x37')][_0xf34d('0x39')],_[_0xf34d('0x3a')](_0x3c87ab['body'],[_0xf34d('0x39'),'id'])||{});}})[_0xf34d('0x1d')](respondWithResult(_0xf29df9,null))[_0xf34d('0x29')](handleError(_0xf29df9,null));};exports['getMessages']=function(_0x22bf80,_0x589bf4){var _0x1253fb={'raw':![],'where':{}};var _0x1638f3={};var _0x34c0a2={'count':0x0,'rows':[]};return db[_0xf34d('0x21')]['findOne']({'where':{'id':_0x22bf80[_0xf34d('0x2b')]['id']}})[_0xf34d('0x1d')](handleEntityNotFound(_0x589bf4,null))[_0xf34d('0x1d')](function(_0x24071a){if(_0x24071a){_0x1638f3[_0xf34d('0x2c')]=_[_0xf34d('0x2d')](db['MailMessage'][_0xf34d('0x22')]);_0x1638f3[_0xf34d('0x2e')]=_[_0xf34d('0x2d')](_0x22bf80['query']);_0x1638f3[_0xf34d('0x3b')]=_['intersection'](_0x1638f3[_0xf34d('0x2c')],_0x1638f3[_0xf34d('0x2e')]);_0x1253fb[_0xf34d('0x30')]=_[_0xf34d('0x2f')](_0x1638f3[_0xf34d('0x2c')],qs[_0xf34d('0x31')](_0x22bf80[_0xf34d('0x2e')]['fields']));_0x1253fb['attributes']=_0x1253fb[_0xf34d('0x30')][_0xf34d('0x3c')]?_0x1253fb['attributes']:_0x1638f3[_0xf34d('0x2c')];if(!_0x22bf80[_0xf34d('0x2e')][_0xf34d('0x3d')](_0xf34d('0x3e'))){_0x1253fb['limit']=qs['limit'](_0x22bf80[_0xf34d('0x2e')]['limit']);_0x1253fb['offset']=qs[_0xf34d('0x14')](_0x22bf80[_0xf34d('0x2e')][_0xf34d('0x14')]);}_0x1253fb[_0xf34d('0x3f')]=qs[_0xf34d('0x40')](_0x22bf80[_0xf34d('0x2e')][_0xf34d('0x40')]);_0x1253fb['where']=qs['filters'](_[_0xf34d('0x41')](_0x22bf80[_0xf34d('0x2e')],_0x1638f3[_0xf34d('0x3b')]));_0x1253fb['where']['MailInteractionId']=_0x24071a['id'];if(_0x22bf80['query'][_0xf34d('0x42')]){_0x1253fb['where']=_['merge'](_0x1253fb[_0xf34d('0x43')],{'$or':_[_0xf34d('0x20')](_0x1253fb[_0xf34d('0x30')],function(_0x199c2d){var _0x2e2a94={};_0x2e2a94[_0x199c2d]={'$like':'%'+_0x22bf80['query'][_0xf34d('0x42')]+'%'};return _0x2e2a94;})});}if(_0x22bf80[_0xf34d('0x2e')]['$gte']){var _0x27a91e=_0x22bf80[_0xf34d('0x2e')]['$gte'][_0xf34d('0x44')](',');var _0x34d09a={};_0x34d09a[_0x27a91e[0x0]]={'$gte':moment(_0x27a91e[0x1])['format'](_0xf34d('0x45'))};_0x1253fb[_0xf34d('0x43')]=_[_0xf34d('0x33')](_0x1253fb[_0xf34d('0x43')],_0x34d09a);}_0x1253fb=_['merge']({},_0x1253fb,_0x22bf80['options']);return db[_0xf34d('0x46')][_0xf34d('0x17')]({'where':_0x1253fb[_0xf34d('0x43')]})['then'](function(_0x5684ea){_0x34c0a2[_0xf34d('0x17')]=_0x5684ea;if(_0x22bf80[_0xf34d('0x2e')][_0xf34d('0x47')]){_0x1253fb[_0xf34d('0x32')]=[{'all':!![]}];}return db[_0xf34d('0x46')]['findAll'](_0x1253fb);})['then'](function(_0x26577c){if(_0x22bf80[_0xf34d('0x2e')][_0xf34d('0x48')]===_0xf34d('0x49')){for(var _0x1342f1=0x0;_0x1342f1<_0x26577c[_0xf34d('0x3c')];_0x1342f1++){_0x26577c[_0x1342f1][_0xf34d('0x37')]=juice(_0x26577c[_0x1342f1][_0xf34d('0x37')]);}}_0x34c0a2['rows']=_0x26577c;return _0x34c0a2;});}})[_0xf34d('0x1d')](respondWithFilteredResult(_0x589bf4,_0x1253fb))[_0xf34d('0x29')](handleError(_0x589bf4,null));};exports[_0xf34d('0x4a')]=function(_0x4be4e8,_0x372358){return db[_0xf34d('0x21')]['find']({'where':{'id':_0x4be4e8['params']['id']}})['then'](handleEntityNotFound(_0x372358,null))['then'](function(_0x49a92a){if(_0x49a92a){return _0x49a92a['setTags'](_0x4be4e8['body']['ids'],_[_0xf34d('0x3a')](_0x4be4e8[_0xf34d('0x37')],['ids','id'])||{})['spread'](function(){return db[_0xf34d('0x4b')][_0xf34d('0x27')]({'attributes':['id','name',_0xf34d('0x4c')],'where':{'id':_0x4be4e8[_0xf34d('0x37')][_0xf34d('0x39')]}});})[_0xf34d('0x1d')](function(_0x3469c0){socket[_0xf34d('0x4d')]('mailInteractionTags:save',{'id':Number(_0x4be4e8[_0xf34d('0x2b')]['id']),'tags':_0x3469c0||[]});return{'id':Number(_0x4be4e8[_0xf34d('0x2b')]['id']),'tags':_0x3469c0||[]};});}})[_0xf34d('0x1d')](respondWithResult(_0x372358,null))[_0xf34d('0x29')](handleError(_0x372358,null));};exports[_0xf34d('0x4e')]=function(_0x1ce5c5,_0x18b3aa){return db[_0xf34d('0x21')][_0xf34d('0x35')]({'where':{'id':_0x1ce5c5[_0xf34d('0x2b')]['id']}})['then'](handleEntityNotFound(_0x18b3aa,null))['then'](function(_0x39890a){if(_0x39890a){return _0x39890a[_0xf34d('0x4e')](_0x1ce5c5[_0xf34d('0x2e')][_0xf34d('0x39')]);}})[_0xf34d('0x1d')](respondWithStatusCode(_0x18b3aa,null))['catch'](handleError(_0x18b3aa,null));};exports[_0xf34d('0x4f')]=function(_0x2718dc,_0x458ece){var _0xd5fb40=moment()[_0xf34d('0x50')]()['toString']();var _0x3910c9=path['join'](config[_0xf34d('0x51')],_0xf34d('0x52'),'files',_0xf34d('0x53'));var _0x56d026=path[_0xf34d('0x54')](config[_0xf34d('0x51')],'server','files','attachments');var _0x47ae44=path[_0xf34d('0x54')](_0x3910c9,_0xd5fb40);var _0x92daed=util[_0xf34d('0x55')]('transcript-%d-%s.zip',_0x2718dc[_0xf34d('0x2b')]['id'],_0xd5fb40);var _0x559f45=path['join'](_0x3910c9,_0x92daed);var _0x3a48f9=[];if(_0x2718dc[_0xf34d('0x2e')]['attachments']){_0x3a48f9[_0xf34d('0x56')]({'model':db['Attachment'],'as':_0xf34d('0x57'),'raw':!![]});}var _0x94a97f=[{'model':db[_0xf34d('0x46')],'as':_0xf34d('0x58'),'attributes':['id',_0xf34d('0x37'),'from','to','cc','bcc',_0xf34d('0x59'),_0xf34d('0x5a')],'where':{'secret':![]},'order':qs[_0xf34d('0x40')]('id'),'include':_0x3a48f9}];return db[_0xf34d('0x21')][_0xf34d('0x35')]({'where':{'id':_0x2718dc[_0xf34d('0x2b')]['id']},'include':_0x94a97f})[_0xf34d('0x1d')](handleEntityNotFound(_0x458ece,null))[_0xf34d('0x1d')](function(_0x62470b){if(_0x62470b&&_0x62470b[_0xf34d('0x58')]){var _0x34f3d0=_0x62470b['get']({'plain':!![]});fs[_0xf34d('0x5b')](_0x47ae44);return BPromise[_0xf34d('0x5c')](_0x34f3d0[_0xf34d('0x58')],function(_0x410d38,_0x4b1132){var _0x3c44b8={'from':_0x410d38[_0xf34d('0x5d')],'to':_0x410d38['to']||'missing.recipient@your.company.com','subject':_0x410d38[_0xf34d('0x59')],'html':htmlEntities[_0xf34d('0x5e')](_0x410d38[_0xf34d('0x37')]),'headers':{'Date':moment(_0x410d38[_0xf34d('0x5a')])[_0xf34d('0x55')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x410d38['cc']){_0x3c44b8[_0xf34d('0x5f')]['Cc']=_0x410d38['cc'];}if(_0x410d38[_0xf34d('0x60')]){_0x3c44b8['headers'][_0xf34d('0x61')]=_0x410d38['bcc'];}return new BPromise(function(_0x52503c,_0x196f07){if(_0x410d38[_0xf34d('0x57')]){for(var _0x1bc9d0=0x0;_0x1bc9d0<_0x410d38[_0xf34d('0x57')][_0xf34d('0x3c')];_0x1bc9d0++){var _0x595d15=_0x410d38[_0xf34d('0x57')][_0x1bc9d0];var _0x78664f=path[_0xf34d('0x54')](_0x56d026,_0x595d15[_0xf34d('0x62')]);if(fs[_0xf34d('0x63')](_0x78664f)){_0x3c44b8['attachments'][_0xf34d('0x56')]({'name':_0x595d15[_0xf34d('0x64')],'contentType':_0x595d15[_0xf34d('0x24')],'data':fs[_0xf34d('0x65')](_0x78664f)});}}}emlformat[_0xf34d('0x66')](_0x3c44b8,function(_0x3d8a3f,_0x4a0394){if(_0x3d8a3f)return _0x196f07(_0x3d8a3f);fs['writeFileSync'](path[_0xf34d('0x54')](_0x47ae44,util[_0xf34d('0x55')](_0xf34d('0x67'),_0x4b1132)),_0x4a0394);return _0x52503c(_0x4a0394);});});})[_0xf34d('0x1d')](function(){return new BPromise(function(_0x40875e,_0x4eeed5){zipdir(_0x47ae44,{'saveTo':_0x559f45},function(_0x2aab55,_0x5369cb){if(_0x2aab55)return _0x4eeed5(_0x2aab55);return _0x40875e(_0x5369cb);});})[_0xf34d('0x1d')](function(){return new BPromise(function(_0x4c5e4a,_0x182b00){rimraf(_0x47ae44,function(_0x25f06f){if(_0x25f06f)_0x182b00(_0x25f06f);return _0x4c5e4a();});});})['then'](function(){return _0x458ece['download'](_0x559f45,_0x92daed,function(_0x57506b){if(!_0x57506b)fs[_0xf34d('0x68')](_0x559f45);});});});}else{return _0x458ece['sendStatus'](0xc8);}})['catch'](handleError(_0x458ece,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 539f862..c1a7866 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 _0x15ec=['catch','hasOwnProperty','exports','events','MailInteraction','MailMessage','setMaxListeners','save','update','remove','getUsers','Users','findAll','then','setDataValue','unreadMessages','emit'];(function(_0x296809,_0x1c9665){var _0x18c0d3=function(_0x249156){while(--_0x249156){_0x296809['push'](_0x296809['shift']());}};_0x18c0d3(++_0x1c9665);}(_0x15ec,0x157));var _0xc15e=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0x15ec[_0x12d033];return _0x3b4e80;};'use strict';var EventEmitter=require(_0xc15e('0x0'));var MailInteraction=require('../../mysqldb')['db'][_0xc15e('0x1')];var MailMessage=require('../../mysqldb')['db'][_0xc15e('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xc15e('0x3')](0x0);var events={'afterCreate':_0xc15e('0x4'),'afterUpdate':_0xc15e('0x5'),'afterDestroy':_0xc15e('0x6')};function emitEvent(_0x44ba8f){return function(_0x358f4c,_0x175c5f,_0x5e8440){_0x358f4c[_0xc15e('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x194957){_0x358f4c['setDataValue'](_0xc15e('0x8'),_0x194957['map'](function(_0x285cc6){return{'id':_0x285cc6['id']};}));return MailMessage[_0xc15e('0x9')]({'where':{'MailInteractionId':_0x358f4c['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc15e('0xa')](function(_0x3c1d08){_0x358f4c[_0xc15e('0xb')](_0xc15e('0xc'),_0x3c1d08['length']);MailInteractionEvents['emit'](_0x44ba8f+':'+_0x358f4c['id'],_0x358f4c);MailInteractionEvents[_0xc15e('0xd')](_0x44ba8f,_0x358f4c);_0x5e8440(null);})[_0xc15e('0xe')](_0x5e8440(null));};}for(var e in events){if(events[_0xc15e('0xf')](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module[_0xc15e('0x10')]=MailInteractionEvents; \ No newline at end of file +var _0x651f=['events','../../mysqldb','MailInteraction','setMaxListeners','save','update','remove','getUsers','setDataValue','Users','map','then','unreadMessages','length','emit','hook','exports'];(function(_0x116b56,_0x408f72){var _0x53b2e4=function(_0x36a2b3){while(--_0x36a2b3){_0x116b56['push'](_0x116b56['shift']());}};_0x53b2e4(++_0x408f72);}(_0x651f,0x110));var _0xf651=function(_0x10ed7b,_0xf87701){_0x10ed7b=_0x10ed7b-0x0;var _0x234bfe=_0x651f[_0x10ed7b];return _0x234bfe;};'use strict';var EventEmitter=require(_0xf651('0x0'));var MailInteraction=require(_0xf651('0x1'))['db'][_0xf651('0x2')];var MailMessage=require(_0xf651('0x1'))['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xf651('0x3')](0x0);var events={'afterCreate':_0xf651('0x4'),'afterUpdate':_0xf651('0x5'),'afterDestroy':_0xf651('0x6')};function emitEvent(_0x2a0ebf){return function(_0x18d3f0,_0xd59e50,_0x3c7fed){_0x18d3f0[_0xf651('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x38b41d){_0x18d3f0[_0xf651('0x8')](_0xf651('0x9'),_0x38b41d[_0xf651('0xa')](function(_0x29dea8){return{'id':_0x29dea8['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x18d3f0['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf651('0xb')](function(_0x15a75e){_0x18d3f0['setDataValue'](_0xf651('0xc'),_0x15a75e[_0xf651('0xd')]);MailInteractionEvents[_0xf651('0xe')](_0x2a0ebf+':'+_0x18d3f0['id'],_0x18d3f0);MailInteractionEvents['emit'](_0x2a0ebf,_0x18d3f0);_0x3c7fed(null);})['catch'](_0x3c7fed(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0xf651('0xf')](e,emitEvent(event));}}module[_0xf651('0x10')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 975d0ce..3920948 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 _0x0564=['FULLTEXT','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','models','get','update','then','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','define','MailInteraction','mail_interactions'];(function(_0x12a5ac,_0x4cb0d2){var _0x282958=function(_0x3ae041){while(--_0x3ae041){_0x12a5ac['push'](_0x12a5ac['shift']());}};_0x282958(++_0x4cb0d2);}(_0x0564,0x11f));var _0x4056=function(_0x2a69a3,_0x1618e1){_0x2a69a3=_0x2a69a3-0x0;var _0x3aa680=_0x0564[_0x2a69a3];return _0x3aa680;};'use strict';var _=require('lodash');var util=require(_0x4056('0x0'));var logger=require(_0x4056('0x1'))(_0x4056('0x2'));var moment=require(_0x4056('0x3'));var BPromise=require(_0x4056('0x4'));var rp=require(_0x4056('0x5'));var fs=require('fs');var path=require(_0x4056('0x6'));var rimraf=require(_0x4056('0x7'));var config=require(_0x4056('0x8'));var attributes=require(_0x4056('0x9'));module['exports']=function(_0x428fb3,_0xf402ad){return _0x428fb3[_0x4056('0xa')](_0x4056('0xb'),attributes,{'tableName':_0x4056('0xc'),'paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':['subject','to'],'type':_0x4056('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x22f5d3,_0xcd802d,_0x20a5f4){if(_0x22f5d3[_0x4056('0xe')]){_0x22f5d3[_0x4056('0xf')]=moment()[_0x4056('0x10')](_0x4056('0x11'));}if(_0x22f5d3[_0x4056('0x12')]){_0x22f5d3[_0x4056('0x13')]=moment()[_0x4056('0x10')](_0x4056('0x11'));}_0x20a5f4(null,_0xcd802d);},'beforeUpdate':function(_0x38fa33,_0x4b1a51,_0x11758e){if(_0x38fa33[_0x4056('0x14')]('substatus')){_0x38fa33[_0x4056('0xf')]=_0x38fa33[_0x4056('0xe')]?moment()[_0x4056('0x10')](_0x4056('0x11')):null;}if(_0x38fa33['changed'](_0x4056('0x12'))){_0x38fa33[_0x4056('0x13')]=moment()[_0x4056('0x10')](_0x4056('0x11'));_0x38fa33['substatus']=null;_0x38fa33[_0x4056('0xf')]=null;}_0x11758e(null,_0x38fa33);},'afterUpdate':function(_0x503730,_0x5771f3,_0x587d77){var _0x26675b=_0x428fb3[_0x4056('0x15')];var _0x183931=_0x503730[_0x4056('0x16')]({'plain':!![]});if(_0x183931[_0x4056('0x12')]){return _0x26675b['MailMessage'][_0x4056('0x17')]({'read':!![]},{'where':{'MailInteractionId':_0x183931['id']}})[_0x4056('0x18')](function(){_0x587d77();})['catch'](function(_0x24610b){_0x587d77(_0x24610b);});}else{_0x587d77();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x8269=['substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','models','MailMessage','update','then','catch','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','MailInteraction','FULLTEXT'];(function(_0x3ef8f2,_0x2c7aaa){var _0x30ff7e=function(_0x47c02d){while(--_0x47c02d){_0x3ef8f2['push'](_0x3ef8f2['shift']());}};_0x30ff7e(++_0x2c7aaa);}(_0x8269,0x1d5));var _0x9826=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x8269[_0x2b4411];return _0x8e41ef;};'use strict';var _=require(_0x9826('0x0'));var util=require(_0x9826('0x1'));var logger=require(_0x9826('0x2'))(_0x9826('0x3'));var moment=require(_0x9826('0x4'));var BPromise=require(_0x9826('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9826('0x6'));var rimraf=require(_0x9826('0x7'));var config=require(_0x9826('0x8'));var attributes=require('./mailInteraction.attributes');module['exports']=function(_0x47b7a0,_0x3010ac){return _0x47b7a0['define'](_0x9826('0x9'),attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':['subject','to'],'type':_0x9826('0xa')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3b4fd5,_0x4835bc,_0x13a53c){if(_0x3b4fd5[_0x9826('0xb')]){_0x3b4fd5[_0x9826('0xc')]=moment()[_0x9826('0xd')](_0x9826('0xe'));}if(_0x3b4fd5[_0x9826('0xf')]){_0x3b4fd5[_0x9826('0x10')]=moment()[_0x9826('0xd')](_0x9826('0xe'));}_0x13a53c(null,_0x4835bc);},'beforeUpdate':function(_0xaa77c5,_0xf854c6,_0x4d34ba){if(_0xaa77c5[_0x9826('0x11')](_0x9826('0xb'))){_0xaa77c5[_0x9826('0xc')]=_0xaa77c5[_0x9826('0xb')]?moment()[_0x9826('0xd')](_0x9826('0xe')):null;}if(_0xaa77c5[_0x9826('0x11')](_0x9826('0xf'))){_0xaa77c5[_0x9826('0x10')]=moment()[_0x9826('0xd')](_0x9826('0xe'));_0xaa77c5[_0x9826('0xb')]=null;_0xaa77c5['substatusAt']=null;}_0x4d34ba(null,_0xaa77c5);},'afterUpdate':function(_0x5a9d32,_0x136ba0,_0x6041bc){var _0x464764=_0x47b7a0[_0x9826('0x12')];var _0x3fc4e9=_0x5a9d32['get']({'plain':!![]});if(_0x3fc4e9[_0x9826('0xf')]){return _0x464764[_0x9826('0x13')][_0x9826('0x14')]({'read':!![]},{'where':{'MailInteractionId':_0x3fc4e9['id']}})[_0x9826('0x15')](function(){_0x6041bc();})[_0x9826('0x16')](function(_0x2e27d8){_0x6041bc(_0x2e27d8);});}else{_0x6041bc();}}},'charset':_0x9826('0x17'),'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 e163e5a..da60a68 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 _0x50e5=['MailInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./mailInteraction.socket','register','request','info','MailInteraction,\x20%s,\x20%s','request\x20sent','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateMailInteraction','update','body','raw','options','where','attributes','then','debug','AddTagsToMailInteraction'];(function(_0x12d951,_0x249808){var _0x44de17=function(_0x182fd9){while(--_0x182fd9){_0x12d951['push'](_0x12d951['shift']());}};_0x44de17(++_0x249808);}(_0x50e5,0xb7));var _0x550e=function(_0x5b4373,_0x5f1df9){_0x5b4373=_0x5b4373-0x0;var _0xda7127=_0x50e5[_0x5b4373];return _0xda7127;};'use strict';var _=require(_0x550e('0x0'));var util=require(_0x550e('0x1'));var moment=require('moment');var BPromise=require(_0x550e('0x2'));var rs=require(_0x550e('0x3'));var fs=require('fs');var Redis=require(_0x550e('0x4'));var db=require(_0x550e('0x5'))['db'];var utils=require(_0x550e('0x6'));var logger=require(_0x550e('0x7'))(_0x550e('0x8'));var config=require(_0x550e('0x9'));var jayson=require(_0x550e('0xa'));var client=jayson[_0x550e('0xb')][_0x550e('0xc')]({'port':0x232a});config[_0x550e('0xd')]=_['defaults'](config[_0x550e('0xd')],{'host':_0x550e('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x550e('0xd')]));require(_0x550e('0xf'))[_0x550e('0x10')](socket);function respondWithRpcPromise(_0x4d236d,_0x1a1e3e,_0x49cc53){return new BPromise(function(_0x59c6c9,_0x116691){return client[_0x550e('0x11')](_0x4d236d,_0x49cc53)['then'](function(_0x13f7e9){logger[_0x550e('0x12')](_0x550e('0x13'),_0x1a1e3e,_0x550e('0x14'));logger['debug'](_0x550e('0x15'),_0x1a1e3e,'request\x20sent',JSON[_0x550e('0x16')](_0x13f7e9));if(_0x13f7e9['error']){if(_0x13f7e9[_0x550e('0x17')][_0x550e('0x18')]===0x1f4){logger[_0x550e('0x17')](_0x550e('0x13'),_0x1a1e3e,_0x13f7e9[_0x550e('0x17')]['message']);return _0x116691(_0x13f7e9[_0x550e('0x17')]['message']);}logger[_0x550e('0x17')]('MailInteraction,\x20%s,\x20%s',_0x1a1e3e,_0x13f7e9['error'][_0x550e('0x19')]);return _0x59c6c9(_0x13f7e9[_0x550e('0x17')]['message']);}else{logger['info']('MailInteraction,\x20%s,\x20%s',_0x1a1e3e,_0x550e('0x14'));_0x59c6c9(_0x13f7e9['result']['message']);}})[_0x550e('0x1a')](function(_0x3607ad){logger[_0x550e('0x17')](_0x550e('0x13'),_0x1a1e3e,_0x3607ad);_0x116691(_0x3607ad);});});}exports[_0x550e('0x1b')]=function(_0x29f2db){var _0x3b4dca=this;return new Promise(function(_0x38f12b,_0x1b9799){return db['MailInteraction'][_0x550e('0x1c')](_0x29f2db[_0x550e('0x1d')],{'raw':_0x29f2db['options']?_0x29f2db['options'][_0x550e('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x29f2db[_0x550e('0x1f')]?_0x29f2db['options'][_0x550e('0x20')]||null:null,'attributes':_0x29f2db[_0x550e('0x1f')]?_0x29f2db[_0x550e('0x1f')][_0x550e('0x21')]||null:null,'limit':_0x29f2db[_0x550e('0x1f')]?_0x29f2db[_0x550e('0x1f')]['limit']||null:null})[_0x550e('0x22')](function(_0x205e3a){logger[_0x550e('0x12')](_0x550e('0x1b'),_0x29f2db);logger[_0x550e('0x23')](_0x550e('0x1b'),_0x29f2db,JSON[_0x550e('0x16')](_0x205e3a));_0x38f12b(_0x205e3a);})[_0x550e('0x1a')](function(_0x13ca4e){logger[_0x550e('0x17')](_0x550e('0x1b'),_0x13ca4e[_0x550e('0x19')],_0x29f2db);_0x1b9799(_0x3b4dca['error'](0x1f4,_0x13ca4e[_0x550e('0x19')]));});});};exports[_0x550e('0x24')]=function(_0x48d367){return new Promise(function(_0x3a1d62,_0x78f04c){return db[_0x550e('0x25')][_0x550e('0x26')]({'where':_0x48d367[_0x550e('0x1f')]?_0x48d367[_0x550e('0x1f')][_0x550e('0x20')]||null:null})[_0x550e('0x22')](function(_0x209f30){if(_0x209f30){return _0x209f30[_0x550e('0x27')](_0x48d367[_0x550e('0x1d')][_0x550e('0x28')],_[_0x550e('0x29')](_0x48d367[_0x550e('0x1d')],['ids','id'])||{});}})[_0x550e('0x2a')](function(_0x1a544d){logger['info'](_0x550e('0x2b'),_0x48d367);logger[_0x550e('0x23')]('AddTags',_0x48d367,JSON[_0x550e('0x16')](_0x1a544d));_0x3a1d62(_0x1a544d);})[_0x550e('0x1a')](function(_0x1beb59){logger[_0x550e('0x17')](_0x550e('0x2b'),_0x1beb59[_0x550e('0x19')],_0x48d367);_0x78f04c(_this[_0x550e('0x17')](0x1f4,_0x1beb59[_0x550e('0x19')]));});});}; \ No newline at end of file +var _0x63b5=['MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','MailInteraction,\x20%s,\x20%s','message','result','catch','UpdateMailInteraction','update','body','options','raw','limit','MailInteraction','find','where','ids','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','then','info','request\x20sent','debug'];(function(_0x1e7701,_0x13fd0f){var _0x3ab707=function(_0x3c5242){while(--_0x3c5242){_0x1e7701['push'](_0x1e7701['shift']());}};_0x3ab707(++_0x13fd0f);}(_0x63b5,0x17c));var _0x563b=function(_0x4a4ecf,_0xcc49eb){_0x4a4ecf=_0x4a4ecf-0x0;var _0x309fad=_0x63b5[_0x4a4ecf];return _0x309fad;};'use strict';var _=require(_0x563b('0x0'));var util=require(_0x563b('0x1'));var moment=require(_0x563b('0x2'));var BPromise=require(_0x563b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x563b('0x4'));var db=require(_0x563b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x563b('0x6'))(_0x563b('0x7'));var config=require(_0x563b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x563b('0x9')][_0x563b('0xa')]({'port':0x232a});config[_0x563b('0xb')]=_[_0x563b('0xc')](config[_0x563b('0xb')],{'host':_0x563b('0xd'),'port':0x18eb});var socket=require(_0x563b('0xe'))(new Redis(config[_0x563b('0xb')]));require('./mailInteraction.socket')[_0x563b('0xf')](socket);function respondWithRpcPromise(_0x2775c8,_0x33c4ed,_0x2b886a){return new BPromise(function(_0x5a2e55,_0x29cb74){return client['request'](_0x2775c8,_0x2b886a)[_0x563b('0x10')](function(_0x1f5e6e){logger[_0x563b('0x11')]('MailInteraction,\x20%s,\x20%s',_0x33c4ed,_0x563b('0x12'));logger[_0x563b('0x13')](_0x563b('0x14'),_0x33c4ed,_0x563b('0x12'),JSON[_0x563b('0x15')](_0x1f5e6e));if(_0x1f5e6e[_0x563b('0x16')]){if(_0x1f5e6e[_0x563b('0x16')][_0x563b('0x17')]===0x1f4){logger[_0x563b('0x16')](_0x563b('0x18'),_0x33c4ed,_0x1f5e6e[_0x563b('0x16')]['message']);return _0x29cb74(_0x1f5e6e[_0x563b('0x16')][_0x563b('0x19')]);}logger['error']('MailInteraction,\x20%s,\x20%s',_0x33c4ed,_0x1f5e6e['error'][_0x563b('0x19')]);return _0x5a2e55(_0x1f5e6e['error']['message']);}else{logger[_0x563b('0x11')](_0x563b('0x18'),_0x33c4ed,_0x563b('0x12'));_0x5a2e55(_0x1f5e6e[_0x563b('0x1a')][_0x563b('0x19')]);}})[_0x563b('0x1b')](function(_0x2cb17c){logger[_0x563b('0x16')](_0x563b('0x18'),_0x33c4ed,_0x2cb17c);_0x29cb74(_0x2cb17c);});});}exports[_0x563b('0x1c')]=function(_0x2e91ba){var _0x328240=this;return new Promise(function(_0x5c3e61,_0x41602b){return db['MailInteraction'][_0x563b('0x1d')](_0x2e91ba[_0x563b('0x1e')],{'raw':_0x2e91ba[_0x563b('0x1f')]?_0x2e91ba[_0x563b('0x1f')][_0x563b('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2e91ba[_0x563b('0x1f')]?_0x2e91ba['options']['where']||null:null,'attributes':_0x2e91ba[_0x563b('0x1f')]?_0x2e91ba[_0x563b('0x1f')]['attributes']||null:null,'limit':_0x2e91ba[_0x563b('0x1f')]?_0x2e91ba[_0x563b('0x1f')][_0x563b('0x21')]||null:null})[_0x563b('0x10')](function(_0x481ff2){logger[_0x563b('0x11')](_0x563b('0x1c'),_0x2e91ba);logger[_0x563b('0x13')](_0x563b('0x1c'),_0x2e91ba,JSON[_0x563b('0x15')](_0x481ff2));_0x5c3e61(_0x481ff2);})[_0x563b('0x1b')](function(_0x4427d7){logger[_0x563b('0x16')](_0x563b('0x1c'),_0x4427d7[_0x563b('0x19')],_0x2e91ba);_0x41602b(_0x328240['error'](0x1f4,_0x4427d7['message']));});});};exports['AddTagsToMailInteraction']=function(_0x21f978){return new Promise(function(_0x261e7b,_0x25f515){return db[_0x563b('0x22')][_0x563b('0x23')]({'where':_0x21f978[_0x563b('0x1f')]?_0x21f978['options'][_0x563b('0x24')]||null:null})['then'](function(_0x56692f){if(_0x56692f){return _0x56692f['addTags'](_0x21f978[_0x563b('0x1e')][_0x563b('0x25')],_['omit'](_0x21f978[_0x563b('0x1e')],['ids','id'])||{});}})[_0x563b('0x26')](function(_0x11e35d){logger[_0x563b('0x11')](_0x563b('0x27'),_0x21f978);logger[_0x563b('0x13')](_0x563b('0x27'),_0x21f978,JSON[_0x563b('0x15')](_0x11e35d));_0x261e7b(_0x11e35d);})[_0x563b('0x1b')](function(_0x810ced){logger['error'](_0x563b('0x27'),_0x810ced[_0x563b('0x19')],_0x21f978);_0x25f515(_this['error'](0x1f4,_0x810ced['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 80bd099..1473ec0 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 _0x276c=['length','mailInteraction:','./mailInteraction.events','save','update','emit'];(function(_0x37fd3b,_0x1c518a){var _0x693cc3=function(_0x4edea6){while(--_0x4edea6){_0x37fd3b['push'](_0x37fd3b['shift']());}};_0x693cc3(++_0x1c518a);}(_0x276c,0x92));var _0xc276=function(_0x5d463d,_0x574434){_0x5d463d=_0x5d463d-0x0;var _0x37c7e4=_0x276c[_0x5d463d];return _0x37c7e4;};'use strict';var MailInteractionEvents=require(_0xc276('0x0'));var events=[_0xc276('0x1'),'remove',_0xc276('0x2')];function createListener(_0xe50b34,_0x44a671){return function(_0x150a98){_0x44a671[_0xc276('0x3')](_0xe50b34,_0x150a98);};}function removeListener(_0x2c9be1,_0xf392aa){return function(){MailInteractionEvents['removeListener'](_0x2c9be1,_0xf392aa);};}exports['register']=function(_0x53b4ff){for(var _0x52fca1=0x0,_0x1f2716=events[_0xc276('0x4')];_0x52fca1<_0x1f2716;_0x52fca1++){var _0x391736=events[_0x52fca1];var _0x10ed33=createListener(_0xc276('0x5')+_0x391736,_0x53b4ff);MailInteractionEvents['on'](_0x391736,_0x10ed33);}}; \ No newline at end of file +var _0xcb94=['remove','update','register','length','mailInteraction:','./mailInteraction.events'];(function(_0x1acf9b,_0x11f097){var _0x4ba2a9=function(_0x508e13){while(--_0x508e13){_0x1acf9b['push'](_0x1acf9b['shift']());}};_0x4ba2a9(++_0x11f097);}(_0xcb94,0x173));var _0x4cb9=function(_0x2a2ef4,_0x514613){_0x2a2ef4=_0x2a2ef4-0x0;var _0x3394e2=_0xcb94[_0x2a2ef4];return _0x3394e2;};'use strict';var MailInteractionEvents=require(_0x4cb9('0x0'));var events=['save',_0x4cb9('0x1'),_0x4cb9('0x2')];function createListener(_0x21c3be,_0xcfcdbd){return function(_0x920adf){_0xcfcdbd['emit'](_0x21c3be,_0x920adf);};}function removeListener(_0x1b6a0c,_0xd98475){return function(){MailInteractionEvents['removeListener'](_0x1b6a0c,_0xd98475);};}exports[_0x4cb9('0x3')]=function(_0x442f8b){for(var _0x2178ab=0x0,_0x3e7086=events[_0x4cb9('0x4')];_0x2178ab<_0x3e7086;_0x2178ab++){var _0x3feaf1=events[_0x2178ab];var _0x38e04a=createListener(_0x4cb9('0x5')+_0x3feaf1,_0x442f8b);MailInteractionEvents['on'](_0x3feaf1,_0x38e04a);}}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/index.js b/server/api/mailInteractionHasTag/index.js index 3b985dd..a9a5652 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 _0x1f44=['get','exports','express','../../components/auth/service'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0x1f44,0x14a));var _0x41f4=function(_0x20a450,_0x5df858){_0x20a450=_0x20a450-0x0;var _0x308218=_0x1f44[_0x20a450];return _0x308218;};'use strict';var express=require(_0x41f4('0x0'));var router=express['Router']();var auth=require(_0x41f4('0x1'));var controller=require('./mailInteractionHasTag.controller');router[_0x41f4('0x2')]('/describe',auth['isAuthenticated'](),controller['describe']);module[_0x41f4('0x3')]=router; \ No newline at end of file +var _0xd1b5=['./mailInteractionHasTag.controller','/describe','isAuthenticated','describe','exports','express','Router'];(function(_0x1a4878,_0x26adb8){var _0x3e5350=function(_0x2d44eb){while(--_0x2d44eb){_0x1a4878['push'](_0x1a4878['shift']());}};_0x3e5350(++_0x26adb8);}(_0xd1b5,0x67));var _0x5d1b=function(_0x8371fc,_0x43995c){_0x8371fc=_0x8371fc-0x0;var _0x2e42e4=_0xd1b5[_0x8371fc];return _0x2e42e4;};'use strict';var express=require(_0x5d1b('0x0'));var router=express[_0x5d1b('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x5d1b('0x2'));router['get'](_0x5d1b('0x3'),auth[_0x5d1b('0x4')](),controller[_0x5d1b('0x5')]);module[_0x5d1b('0x6')]=router; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js index 0b8ed8c..6fda315 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(_0x70fa08,_0x1c517f){var _0x4af067=function(_0x49d841){while(--_0x49d841){_0x70fa08['push'](_0x70fa08['shift']());}};_0x4af067(++_0x1c517f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'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(_0x562f5a,_0x2b4b26){var _0x5f44f4=function(_0x23642e){while(--_0x23642e){_0x562f5a['push'](_0x562f5a['shift']());}};_0x5f44f4(++_0x2b4b26);}(_0xa9e0,0x123));var _0x0a9e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa9e0[_0x92c450];return _0x2a9599;};'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 192a31c..9eee76f 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 _0x329b=['exports','INTEGER'];(function(_0x4fa565,_0x4034e5){var _0x4ea092=function(_0x38fe14){while(--_0x38fe14){_0x4fa565['push'](_0x4fa565['shift']());}};_0x4ea092(++_0x4034e5);}(_0x329b,0x12c));var _0xb329=function(_0x5c4d27,_0x5b0822){_0x5c4d27=_0x5c4d27-0x0;var _0x1dda1a=_0x329b[_0x5c4d27];return _0x1dda1a;};'use strict';var Sequelize=require('sequelize');module[_0xb329('0x0')]={'MailInteractionId':{'type':Sequelize[_0xb329('0x1')],'primaryKey':!![]},'TagId':{'type':Sequelize['INTEGER'],'defaultValue':null}}; \ No newline at end of file +var _0x8c5d=['sequelize','exports','INTEGER'];(function(_0x173d0d,_0x5e3c8f){var _0x2709ae=function(_0xdda9f8){while(--_0xdda9f8){_0x173d0d['push'](_0x173d0d['shift']());}};_0x2709ae(++_0x5e3c8f);}(_0x8c5d,0x1bf));var _0xd8c5=function(_0x18f70d,_0x3f06df){_0x18f70d=_0x18f70d-0x0;var _0x40f302=_0x8c5d[_0x18f70d];return _0x40f302;};'use strict';var Sequelize=require(_0xd8c5('0x0'));module[_0xd8c5('0x1')]={'MailInteractionId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'TagId':{'type':Sequelize[_0xd8c5('0x2')],'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 3b2359e..8ba8cee 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 _0x93d4=['./mailInteractionHasTag','exports'];(function(_0xff1c76,_0x1a2d3e){var _0x1d7af4=function(_0x11069e){while(--_0x11069e){_0xff1c76['push'](_0xff1c76['shift']());}};_0x1d7af4(++_0x1a2d3e);}(_0x93d4,0x1cc));var _0x493d=function(_0x3850bf,_0x569b75){_0x3850bf=_0x3850bf-0x0;var _0x263fff=_0x93d4[_0x3850bf];return _0x263fff;};'use strict';var attributes=require(_0x493d('0x0'));module[_0x493d('0x1')]=function(_0x590522){return _0x590522['define']('MailInteractionHasTag',attributes,{'tableName':'mail_interaction_has_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9202=['MailInteractionHasTag','exports','define'];(function(_0x250bfb,_0x183c55){var _0x2fa5d0=function(_0x2d9495){while(--_0x2d9495){_0x250bfb['push'](_0x250bfb['shift']());}};_0x2fa5d0(++_0x183c55);}(_0x9202,0x178));var _0x2920=function(_0xc46fbb,_0x26628b){_0xc46fbb=_0xc46fbb-0x0;var _0x470784=_0x9202[_0xc46fbb];return _0x470784;};'use strict';var attributes=require('./mailInteractionHasTag');module[_0x2920('0x0')]=function(_0x1878ac){return _0x1878ac[_0x2920('0x1')](_0x2920('0x2'),attributes,{'tableName':'mail_interaction_has_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 1dbe30b..0c71ee9 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 _0x79d3=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','/:id/download','download','post','tracked','mailmessage:create','create','/:id/accept','put','delete'];(function(_0x3797fe,_0x1cf7d2){var _0x300685=function(_0x27d072){while(--_0x27d072){_0x3797fe['push'](_0x3797fe['shift']());}};_0x300685(++_0x1cf7d2);}(_0x79d3,0x179));var _0x379d=function(_0x164e8f,_0xdba27a){_0x164e8f=_0x164e8f-0x0;var _0x2b2840=_0x79d3[_0x164e8f];return _0x2b2840;};'use strict';var multer=require(_0x379d('0x0'));var util=require(_0x379d('0x1'));var path=require(_0x379d('0x2'));var timeout=require(_0x379d('0x3'));var express=require(_0x379d('0x4'));var router=express[_0x379d('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x379d('0x6'));var interaction=require(_0x379d('0x7'));var config=require('../../config/environment');var controller=require('./mailMessage.controller');router[_0x379d('0x8')]('/',auth[_0x379d('0x9')](),controller[_0x379d('0xa')]);router[_0x379d('0x8')](_0x379d('0xb'),auth['isAuthenticated'](),controller[_0x379d('0xc')]);router[_0x379d('0x8')](_0x379d('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x379d('0x8')](_0x379d('0xe'),auth['isAuthenticated'](),controller[_0x379d('0xf')]);router[_0x379d('0x10')]('/',auth[_0x379d('0x9')](),interaction[_0x379d('0x11')]('mail',_0x379d('0x12')),controller[_0x379d('0x13')]);router['put'](_0x379d('0xd'),auth[_0x379d('0x9')](),controller['update']);router['put'](_0x379d('0x14'),auth['isAuthenticated'](),controller['accept']);router[_0x379d('0x15')]('/:id/reject',auth[_0x379d('0x9')](),controller['reject']);router[_0x379d('0x16')](_0x379d('0xd'),auth[_0x379d('0x9')](),controller[_0x379d('0x17')]);module[_0x379d('0x18')]=router; \ No newline at end of file +var _0x7d5a=['update','accept','/:id/reject','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./mailMessage.controller','get','isAuthenticated','index','describe','/:id','show','download','post','tracked','mail','mailmessage:create','put'];(function(_0x394723,_0x46db8a){var _0xd24d52=function(_0x467d69){while(--_0x467d69){_0x394723['push'](_0x394723['shift']());}};_0xd24d52(++_0x46db8a);}(_0x7d5a,0x17b));var _0xa7d5=function(_0x5e7cc9,_0xaca146){_0x5e7cc9=_0x5e7cc9-0x0;var _0x41fd29=_0x7d5a[_0x5e7cc9];return _0x41fd29;};'use strict';var multer=require(_0xa7d5('0x0'));var util=require(_0xa7d5('0x1'));var path=require(_0xa7d5('0x2'));var timeout=require(_0xa7d5('0x3'));var express=require(_0xa7d5('0x4'));var router=express[_0xa7d5('0x5')]();var fs_extra=require(_0xa7d5('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa7d5('0x7'));var controller=require(_0xa7d5('0x8'));router[_0xa7d5('0x9')]('/',auth[_0xa7d5('0xa')](),controller[_0xa7d5('0xb')]);router[_0xa7d5('0x9')]('/describe',auth[_0xa7d5('0xa')](),controller[_0xa7d5('0xc')]);router[_0xa7d5('0x9')](_0xa7d5('0xd'),auth[_0xa7d5('0xa')](),controller[_0xa7d5('0xe')]);router[_0xa7d5('0x9')]('/:id/download',auth[_0xa7d5('0xa')](),controller[_0xa7d5('0xf')]);router[_0xa7d5('0x10')]('/',auth['isAuthenticated'](),interaction[_0xa7d5('0x11')](_0xa7d5('0x12'),_0xa7d5('0x13')),controller['create']);router[_0xa7d5('0x14')](_0xa7d5('0xd'),auth[_0xa7d5('0xa')](),controller[_0xa7d5('0x15')]);router[_0xa7d5('0x14')]('/:id/accept',auth[_0xa7d5('0xa')](),controller[_0xa7d5('0x16')]);router[_0xa7d5('0x14')](_0xa7d5('0x17'),auth[_0xa7d5('0xa')](),controller['reject']);router[_0xa7d5('0x18')](_0xa7d5('0xd'),auth[_0xa7d5('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index f4e00ca..245ad92 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 _0x1f0a=['STRING','INTEGER','DATE','Email','Chat','sequelize','exports','TEXT','long','medium','BOOLEAN','ENUM','out'];(function(_0x77d7f2,_0xe936fe){var _0x4a05df=function(_0x5199b0){while(--_0x5199b0){_0x77d7f2['push'](_0x77d7f2['shift']());}};_0x4a05df(++_0xe936fe);}(_0x1f0a,0x1e6));var _0xa1f0=function(_0x16f4b6,_0x555536){_0x16f4b6=_0x16f4b6-0x0;var _0xd0b6b0=_0x1f0a[_0x16f4b6];return _0xd0b6b0;};'use strict';var Sequelize=require(_0xa1f0('0x0'));var _=require('lodash');module[_0xa1f0('0x1')]={'body':{'type':Sequelize[_0xa1f0('0x2')](_0xa1f0('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xa1f0('0x2')](_0xa1f0('0x4'))},'read':{'type':Sequelize[_0xa1f0('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0xa1f0('0x6')]('in','out'),'defaultValue':_0xa1f0('0x7'),'allowNull':![]},'messageId':{'type':Sequelize[_0xa1f0('0x8')](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0xa1f0('0x2')](_0xa1f0('0x3'))},'cc':{'type':Sequelize[_0xa1f0('0x2')](_0xa1f0('0x3'))},'bcc':{'type':Sequelize[_0xa1f0('0x2')]('long')},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize[_0xa1f0('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize[_0xa1f0('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xa1f0('0xa')]},'originTo':{'type':Sequelize[_0xa1f0('0x2')](_0xa1f0('0x3'))},'originCc':{'type':Sequelize[_0xa1f0('0x2')](_0xa1f0('0x3'))},'originChannel':{'type':Sequelize[_0xa1f0('0x6')](_0xa1f0('0xb'),_0xa1f0('0xc')),'defaultValue':_0xa1f0('0xb'),'allowNull':![]}}; \ No newline at end of file +var _0x8e65=['lodash','exports','TEXT','medium','BOOLEAN','ENUM','out','STRING','DATE','INTEGER','long','Email','sequelize'];(function(_0x5ea3df,_0x2b410e){var _0x4bca46=function(_0x20a574){while(--_0x20a574){_0x5ea3df['push'](_0x5ea3df['shift']());}};_0x4bca46(++_0x2b410e);}(_0x8e65,0x1ac));var _0x58e6=function(_0x18d19e,_0x52c1fb){_0x18d19e=_0x18d19e-0x0;var _0xca36dc=_0x8e65[_0x18d19e];return _0xca36dc;};'use strict';var Sequelize=require(_0x58e6('0x0'));var _=require(_0x58e6('0x1'));module[_0x58e6('0x2')]={'body':{'type':Sequelize[_0x58e6('0x3')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0x58e6('0x3')](_0x58e6('0x4'))},'read':{'type':Sequelize[_0x58e6('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0x58e6('0x6')]('in',_0x58e6('0x7')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x58e6('0x8')](0x1fe)},'from':{'type':Sequelize[_0x58e6('0x8')]},'to':{'type':Sequelize[_0x58e6('0x3')]('long')},'cc':{'type':Sequelize['TEXT']('long')},'bcc':{'type':Sequelize[_0x58e6('0x3')]('long')},'subject':{'type':Sequelize[_0x58e6('0x3')]},'sentAt':{'type':Sequelize[_0x58e6('0x9')]},'attach':{'type':Sequelize[_0x58e6('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x58e6('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x58e6('0x9')]},'originTo':{'type':Sequelize[_0x58e6('0x3')](_0x58e6('0xb'))},'originCc':{'type':Sequelize[_0x58e6('0x3')](_0x58e6('0xb'))},'originChannel':{'type':Sequelize[_0x58e6('0x6')](_0x58e6('0xc'),'Chat'),'defaultValue':_0x58e6('0xc'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 5b1739e..ec852fd 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 _0x4e46=['[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','Sequelize','QueryTypes','contact','fullname','manual','interface','SIP/%s','channel','motionChannel','event','fromString','EventManager','acceptmessage','reject','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','SELECT','User','email','internal','rejectmessage','download','unix','toString','root','server','files','from','bcc','subject','createdAt','Attachments','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','readFileSync','unlinkSync','eml-format','bluebird','util','path','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../config/environment','../../mysqldb','redis','localhost','html-entities','./mailMessage.socket','jayson/promise','client','http','request','then','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','json','offset','undefined','limit','status','update','destroy','end','stack','name','send','index','MailMessage','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','show','params','find','body','describe','create','direction','secret','split','MailAccount','findOne','CmList','List','Contacts','updatedAt','DESC','MailServerOut','Smtp','CloudProvider','attachments','join','server/files/attachments','CmContact','List\x20not\x20found','SendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','accept','mail','readAt','UserId','user','agent','get','MailInteraction','MailInteractionId','read1stAt','interaction'];(function(_0x11c5e4,_0x5067cb){var _0x11b0e0=function(_0x56677b){while(--_0x56677b){_0x11c5e4['push'](_0x11c5e4['shift']());}};_0x11b0e0(++_0x5067cb);}(_0x4e46,0x166));var _0x64e4=function(_0x2d4176,_0x3814dd){_0x2d4176=_0x2d4176-0x0;var _0x41e20a=_0x4e46[_0x2d4176];return _0x41e20a;};'use strict';var emlformat=require(_0x64e4('0x0'));var moment=require('moment');var BPromise=require(_0x64e4('0x1'));var util=require(_0x64e4('0x2'));var path=require(_0x64e4('0x3'));var fs=require('fs');var _=require(_0x64e4('0x4'));var Redis=require(_0x64e4('0x5'));var htmlToText=require('html-to-text');var qs=require(_0x64e4('0x6'));var logger=require(_0x64e4('0x7'))(_0x64e4('0x8'));var interaction_log=require(_0x64e4('0x7'))(_0x64e4('0x9'));var config=require(_0x64e4('0xa'));var db=require(_0x64e4('0xb'))['db'];config['redis']=_['defaults'](config[_0x64e4('0xc')],{'host':_0x64e4('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));var htmlEntities=require(_0x64e4('0xe'));require(_0x64e4('0xf'))['register'](socket);var jayson=require(_0x64e4('0x10'));var client=jayson['client']['http']({'port':0x232c});var client9003=jayson[_0x64e4('0x11')][_0x64e4('0x12')]({'port':0x232b});var client9002=jayson[_0x64e4('0x11')][_0x64e4('0x12')]({'port':0x232a});function respondWithRpcPromise(_0x3eeabb,_0x14d121,_0x395c35,_0x3fc871){return new BPromise(function(_0x45782f,_0x3ae13a){var _0x584d6e=_0x3fc871||client;return _0x584d6e[_0x64e4('0x13')](_0x3eeabb,_0x395c35)[_0x64e4('0x14')](function(_0x38a2b8){logger['info'](_0x64e4('0x15'),_0x14d121,_0x64e4('0x16'));logger[_0x64e4('0x17')](_0x64e4('0x18'),_0x14d121,_0x64e4('0x16'),JSON[_0x64e4('0x19')](_0x38a2b8));if(_0x38a2b8[_0x64e4('0x1a')]){if(_0x38a2b8[_0x64e4('0x1a')][_0x64e4('0x1b')]===0x1f4){logger[_0x64e4('0x1a')](_0x64e4('0x15'),_0x14d121,_0x38a2b8[_0x64e4('0x1a')][_0x64e4('0x1c')]);return _0x3ae13a(_0x38a2b8[_0x64e4('0x1a')][_0x64e4('0x1c')]);}logger[_0x64e4('0x1a')]('MailMessage,\x20%s,\x20%s',_0x14d121,_0x38a2b8[_0x64e4('0x1a')][_0x64e4('0x1c')]);return _0x45782f(_0x38a2b8[_0x64e4('0x1a')][_0x64e4('0x1c')]);}else{logger[_0x64e4('0x1d')](_0x64e4('0x15'),_0x14d121,_0x64e4('0x16'));_0x45782f(_0x38a2b8[_0x64e4('0x1e')][_0x64e4('0x1c')]);}})[_0x64e4('0x1f')](function(_0x2b116f){logger['error'](_0x64e4('0x15'),_0x14d121,_0x2b116f);_0x3ae13a(_0x2b116f);});});}function respondWithResult(_0xb7ad4e,_0x3bf291){_0x3bf291=_0x3bf291||0xc8;return function(_0x4adecf){if(_0x4adecf){return _0xb7ad4e['status'](_0x3bf291)[_0x64e4('0x20')](_0x4adecf);}};}function respondWithFilteredResult(_0x302d70,_0x5ec3d0){return function(_0x1ce56d){if(_0x1ce56d){var _0x58041c=typeof _0x5ec3d0[_0x64e4('0x21')]===_0x64e4('0x22')&&typeof _0x5ec3d0[_0x64e4('0x23')]===_0x64e4('0x22');var _0x551425=_0x1ce56d['count'];var _0x69ac69=_0x58041c?0x0:_0x5ec3d0[_0x64e4('0x21')];var _0x3fc4f2=_0x58041c?_0x1ce56d['count']:_0x5ec3d0[_0x64e4('0x21')]+_0x5ec3d0['limit'];var _0x3c8529;if(_0x3fc4f2>=_0x551425){_0x3fc4f2=_0x551425;_0x3c8529=0xc8;}else{_0x3c8529=0xce;}_0x302d70[_0x64e4('0x24')](_0x3c8529);return _0x302d70['set']('Content-Range',_0x69ac69+'-'+_0x3fc4f2+'/'+_0x551425)[_0x64e4('0x20')](_0x1ce56d);}return null;};}function saveUpdates(_0x392de8){return function(_0x2e6468){if(_0x2e6468){return _0x2e6468[_0x64e4('0x25')](_0x392de8)[_0x64e4('0x14')](function(_0x163777){return _0x163777;});}return null;};}function removeEntity(_0x48ed57){return function(_0x3f4f20){if(_0x3f4f20){return _0x3f4f20[_0x64e4('0x26')]()[_0x64e4('0x14')](function(){_0x48ed57[_0x64e4('0x24')](0xcc)[_0x64e4('0x27')]();});}};}function handleEntityNotFound(_0x16d283){return function(_0x510e86){if(!_0x510e86){_0x16d283['sendStatus'](0x194);}return _0x510e86;};}function handleError(_0xff6ef2,_0x423824){_0x423824=_0x423824||0x1f4;return function(_0x39c678){logger[_0x64e4('0x1a')](_0x39c678[_0x64e4('0x28')]);if(_0x39c678['name']){delete _0x39c678[_0x64e4('0x29')];}_0xff6ef2[_0x64e4('0x24')](_0x423824)[_0x64e4('0x2a')](_0x39c678);};}exports[_0x64e4('0x2b')]=function(_0x1ddc00,_0xebe7fa){var _0x3b6f42={},_0x27e16b={},_0x3600b9={'count':0x0,'rows':[]};var _0x1b18d0=_['map'](db[_0x64e4('0x2c')][_0x64e4('0x2d')],function(_0x2cb0e7){return{'name':_0x2cb0e7[_0x64e4('0x2e')],'type':_0x2cb0e7[_0x64e4('0x2f')][_0x64e4('0x30')]};});_0x27e16b[_0x64e4('0x31')]=_[_0x64e4('0x32')](_0x1b18d0,_0x64e4('0x29'));_0x27e16b[_0x64e4('0x33')]=_[_0x64e4('0x34')](_0x1ddc00['query']);_0x27e16b[_0x64e4('0x35')]=_[_0x64e4('0x36')](_0x27e16b[_0x64e4('0x31')],_0x27e16b[_0x64e4('0x33')]);_0x3b6f42[_0x64e4('0x37')]=_['intersection'](_0x27e16b[_0x64e4('0x31')],qs[_0x64e4('0x38')](_0x1ddc00[_0x64e4('0x33')][_0x64e4('0x38')]));_0x3b6f42[_0x64e4('0x37')]=_0x3b6f42[_0x64e4('0x37')][_0x64e4('0x39')]?_0x3b6f42[_0x64e4('0x37')]:_0x27e16b['model'];if(!_0x1ddc00['query']['hasOwnProperty'](_0x64e4('0x3a'))){_0x3b6f42[_0x64e4('0x23')]=qs[_0x64e4('0x23')](_0x1ddc00[_0x64e4('0x33')]['limit']);_0x3b6f42[_0x64e4('0x21')]=qs[_0x64e4('0x21')](_0x1ddc00[_0x64e4('0x33')]['offset']);}_0x3b6f42['order']=qs['sort'](_0x1ddc00['query'][_0x64e4('0x3b')]);_0x3b6f42[_0x64e4('0x3c')]=qs['filters'](_[_0x64e4('0x3d')](_0x1ddc00[_0x64e4('0x33')],_0x27e16b[_0x64e4('0x35')]),_0x1b18d0);if(_0x1ddc00[_0x64e4('0x33')][_0x64e4('0x3e')]){_0x3b6f42[_0x64e4('0x3c')]=_[_0x64e4('0x3f')](_0x3b6f42[_0x64e4('0x3c')],{'$or':_[_0x64e4('0x32')](_0x1b18d0,function(_0x3e612d){if(_0x3e612d[_0x64e4('0x2f')]!==_0x64e4('0x40')){var _0x24a6af={};_0x24a6af[_0x3e612d[_0x64e4('0x29')]]={'$like':'%'+_0x1ddc00[_0x64e4('0x33')]['filter']+'%'};return _0x24a6af;}})});}_0x3b6f42=_[_0x64e4('0x3f')]({},_0x3b6f42,_0x1ddc00[_0x64e4('0x41')]);var _0x34ff66={'where':_0x3b6f42[_0x64e4('0x3c')]};return db[_0x64e4('0x2c')][_0x64e4('0x42')](_0x34ff66)[_0x64e4('0x14')](function(_0x53ca63){_0x3600b9[_0x64e4('0x42')]=_0x53ca63;if(_0x1ddc00['query'][_0x64e4('0x43')]){_0x3b6f42[_0x64e4('0x44')]=[{'all':!![]}];}return db[_0x64e4('0x2c')][_0x64e4('0x45')](_0x3b6f42);})[_0x64e4('0x14')](function(_0x51062f){_0x3600b9[_0x64e4('0x46')]=_0x51062f;return _0x3600b9;})[_0x64e4('0x14')](respondWithFilteredResult(_0xebe7fa,_0x3b6f42))[_0x64e4('0x1f')](handleError(_0xebe7fa,null));};exports[_0x64e4('0x47')]=function(_0x4812ff,_0x369b60){var _0x20425d={'raw':!![],'where':{'id':_0x4812ff[_0x64e4('0x48')]['id']}},_0x401845={};_0x401845[_0x64e4('0x31')]=_[_0x64e4('0x34')](db[_0x64e4('0x2c')]['rawAttributes']);_0x401845[_0x64e4('0x33')]=_[_0x64e4('0x34')](_0x4812ff[_0x64e4('0x33')]);_0x401845['filters']=_['intersection'](_0x401845[_0x64e4('0x31')],_0x401845[_0x64e4('0x33')]);_0x20425d[_0x64e4('0x37')]=_[_0x64e4('0x36')](_0x401845[_0x64e4('0x31')],qs[_0x64e4('0x38')](_0x4812ff['query'][_0x64e4('0x38')]));_0x20425d['attributes']=_0x20425d[_0x64e4('0x37')][_0x64e4('0x39')]?_0x20425d[_0x64e4('0x37')]:_0x401845[_0x64e4('0x31')];if(_0x4812ff['query'][_0x64e4('0x43')]){_0x20425d[_0x64e4('0x44')]=[{'all':!![]}];}_0x20425d=_[_0x64e4('0x3f')]({},_0x20425d,_0x4812ff[_0x64e4('0x41')]);return db[_0x64e4('0x2c')][_0x64e4('0x49')](_0x20425d)[_0x64e4('0x14')](handleEntityNotFound(_0x369b60,null))[_0x64e4('0x14')](respondWithResult(_0x369b60,null))['catch'](handleError(_0x369b60,null));};exports[_0x64e4('0x25')]=function(_0x14bbac,_0x169d39){if(_0x14bbac['body']['id']){delete _0x14bbac['body']['id'];}return db['MailMessage'][_0x64e4('0x49')]({'where':{'id':_0x14bbac[_0x64e4('0x48')]['id']}})[_0x64e4('0x14')](handleEntityNotFound(_0x169d39,null))['then'](saveUpdates(_0x14bbac[_0x64e4('0x4a')],null))[_0x64e4('0x14')](respondWithResult(_0x169d39,null))['catch'](handleError(_0x169d39,null));};exports[_0x64e4('0x26')]=function(_0x33a461,_0xf11369){return db[_0x64e4('0x2c')][_0x64e4('0x49')]({'where':{'id':_0x33a461[_0x64e4('0x48')]['id']}})[_0x64e4('0x14')](handleEntityNotFound(_0xf11369,null))['then'](removeEntity(_0xf11369,null))[_0x64e4('0x1f')](handleError(_0xf11369,null));};exports[_0x64e4('0x4b')]=function(_0x574914,_0x256c31){return db[_0x64e4('0x2c')]['describe']()['then'](respondWithResult(_0x256c31,null))['catch'](handleError(_0x256c31,null));};exports[_0x64e4('0x4c')]=function(_0x5dedd5,_0x54cef6){return db[_0x64e4('0x2c')][_0x64e4('0x4c')](_0x5dedd5[_0x64e4('0x4a')])['then'](function(_0x28f456){if(_0x28f456){if(_0x28f456[_0x64e4('0x4d')]==='out'&&!_0x28f456[_0x64e4('0x4e')]){var _0xf843ba,_0x4bbb15,_0x266ea2;if(_0x5dedd5[_0x64e4('0x4a')]['to']){_0x4bbb15=_0x5dedd5['body']['to'][_0x64e4('0x4f')](',')[0x0];}return db[_0x64e4('0x50')][_0x64e4('0x51')]({'where':{'id':_0x28f456['MailAccountId']},'include':[{'model':db[_0x64e4('0x52')],'as':_0x64e4('0x53'),'include':[{'model':db['CmContact'],'as':_0x64e4('0x54'),'where':{'email':_0x4bbb15},'limit':0x1,'order':[[_0x64e4('0x55'),_0x64e4('0x56')]]}]},{'model':db[_0x64e4('0x57')],'as':_0x64e4('0x58'),'raw':!![],'include':[{'model':db[_0x64e4('0x59')],'as':_0x64e4('0x59'),'raw':!![]}]}]})[_0x64e4('0x14')](function(_0x45cb63){_0xf843ba=_0x45cb63;if(!_0xf843ba||!_0xf843ba[_0x64e4('0x58')])return;var _0x38c55f=_0xf843ba['getSmtpOptions']();if(_0x5dedd5[_0x64e4('0x4a')][_0x64e4('0x5a')]&&_0x5dedd5[_0x64e4('0x4a')][_0x64e4('0x5a')][_0x64e4('0x39')]){for(var _0x446e97=0x0;_0x446e97<_0x5dedd5['body'][_0x64e4('0x5a')]['length'];_0x446e97+=0x1){_0x5dedd5[_0x64e4('0x4a')][_0x64e4('0x5a')][_0x446e97]={'filename':_0x5dedd5[_0x64e4('0x4a')][_0x64e4('0x5a')][_0x446e97][_0x64e4('0x29')],'path':path[_0x64e4('0x5b')](config['root'],_0x64e4('0x5c'),_0x5dedd5[_0x64e4('0x4a')][_0x64e4('0x5a')][_0x446e97]['basename'])};}}_0x266ea2={'account':_0x38c55f,'message':_0x5dedd5['body']};return;})['then'](function(){if(_0xf843ba[_0x64e4('0x53')]){if(_0xf843ba[_0x64e4('0x53')][_0x64e4('0x54')]['length']){return _0xf843ba[_0x64e4('0x53')]['Contacts'][0x0];}else{return db[_0x64e4('0x5d')][_0x64e4('0x4c')](_['defaults'](_0x5dedd5[_0x64e4('0x4a')],{'firstName':_0x5dedd5['body']['to'],'email':_0x5dedd5['body']['to'],'phone':_0x5dedd5['body']['to'],'ListId':_0xf843ba['ListId']}));}}else{throw new Error(_0x64e4('0x5e'));}})[_0x64e4('0x14')](function(){if(_0x266ea2){return respondWithRpcPromise(_0x64e4('0x5f'),'sendMail',_0x266ea2,client9003)[_0x64e4('0x14')](function(_0x4a0802){return _0x28f456[_0x64e4('0x25')]({'read':!![],'messageId':_0x4a0802[_0x64e4('0x60')],'sentAt':moment()[_0x64e4('0x61')](_0x64e4('0x62'))});})[_0x64e4('0x1f')](function(_0x53fcdf){logger[_0x64e4('0x1a')]('%s',JSON['stringify'](_0x53fcdf));return _0x28f456;});}return _0x28f456;});}return _0x28f456;}})[_0x64e4('0x14')](respondWithResult(_0x54cef6,0xc9))['catch'](handleError(_0x54cef6,null));};exports[_0x64e4('0x63')]=function(_0x133a7c,_0x512250){var _0x201410={'agent':{},'channel':_0x64e4('0x64')};if(_0x133a7c['body']['id']){delete _0x133a7c[_0x64e4('0x4a')]['id'];}_0x133a7c[_0x64e4('0x4a')]['read']=!![];_0x133a7c[_0x64e4('0x4a')][_0x64e4('0x65')]=moment()[_0x64e4('0x61')](_0x64e4('0x62'));_0x133a7c[_0x64e4('0x4a')][_0x64e4('0x66')]=_0x133a7c['body']['UserId']||_0x133a7c[_0x64e4('0x67')]['id'];_0x201410[_0x64e4('0x68')]['id']=_0x133a7c['body']['UserId'];return db[_0x64e4('0x2c')][_0x64e4('0x49')]({'where':{'id':_0x133a7c[_0x64e4('0x48')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x512250,null))[_0x64e4('0x14')](saveUpdates(_0x133a7c[_0x64e4('0x4a')],null))['then'](function(_0x592b08){if(_0x592b08){_0x201410[_0x64e4('0x1c')]=_0x592b08[_0x64e4('0x69')]({'plain':!![]});return db[_0x64e4('0x6a')]['find']({'where':{'id':_0x592b08[_0x64e4('0x6b')]}});}return null;})[_0x64e4('0x14')](handleEntityNotFound(_0x512250,null))[_0x64e4('0x14')](function(_0x4f751a){if(_0x4f751a){return _0x4f751a[_0x64e4('0x25')]({'UserId':_0x133a7c[_0x64e4('0x4a')][_0x64e4('0x66')],'read1stAt':_['isNil'](_0x4f751a[_0x64e4('0x6c')])?moment()[_0x64e4('0x61')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x64e4('0x14')](function(_0x883d57){if(_0x883d57){_0x201410[_0x64e4('0x6d')]=_0x883d57[_0x64e4('0x69')]({'plain':!![]});interaction_log['info'](_0x64e4('0x6e'),_0x133a7c['user']['id'],_0x133a7c[_0x64e4('0x67')][_0x64e4('0x29')],_0x133a7c[_0x64e4('0x67')][_0x64e4('0x6f')],_0x201410[_0x64e4('0x6d')]['id'],_0x133a7c['body']?JSON['stringify'](_0x133a7c[_0x64e4('0x4a')]):_0x64e4('0x70'));return respondWithRpcPromise(_0x64e4('0x71'),_0x64e4('0x72'),_0x201410);}return null;})['then'](function(_0x2d12a9){var _0x451f08='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2d12a9[_0x64e4('0x1c')]['ContactId'];return db['sequelize'][_0x64e4('0x33')](_0x451f08,{'type':db[_0x64e4('0x73')][_0x64e4('0x74')]['SELECT'],'raw':!![]})['then'](function(_0x19a6d0){return _0x19a6d0;});})[_0x64e4('0x14')](function(_0x5e57d0){if(_0x5e57d0){_0x201410['message'][_0x64e4('0x75')]=_0x5e57d0[0x0];if(!_0x133a7c['body']['UserId'])return;return db['User']['find']({'where':{'id':_0x133a7c['body'][_0x64e4('0x66')],'role':_0x64e4('0x68')},'attributes':['id',_0x64e4('0x29'),_0x64e4('0x76'),'email','internal'],'raw':!![]});}return null;})['then'](function(_0x4d3be5){if(!_0x4d3be5)return null;_0x201410[_0x64e4('0x1c')]['agent']=_0x4d3be5;return _0x201410;})[_0x64e4('0x14')](function(_0x296a72){if(_0x296a72){if(_0x133a7c[_0x64e4('0x4a')][_0x64e4('0x77')]){_0x201410[_0x64e4('0x1c')][_0x64e4('0x78')]=util[_0x64e4('0x61')](_0x64e4('0x79'),_0x133a7c[_0x64e4('0x67')]['name']);_0x201410['message']['channel']=_0x201410[_0x64e4('0x7a')];_0x201410[_0x64e4('0x1c')][_0x64e4('0x7b')]=_0x201410[_0x64e4('0x7a')];_0x201410['message'][_0x64e4('0x7c')]=_0x64e4('0x63');_0x201410[_0x64e4('0x1c')][_0x64e4('0x4a')]=htmlToText[_0x64e4('0x7d')](_0x201410[_0x64e4('0x1c')][_0x64e4('0x4a')]);return respondWithRpcPromise('EventManager',_0x64e4('0x7e'),{'event':_0x64e4('0x7f'),'message':_0x201410[_0x64e4('0x1c')]},client9002)[_0x64e4('0x14')](function(){return _0x201410;});}return _0x201410;}return null;})['then'](respondWithResult(_0x512250,null))[_0x64e4('0x1f')](handleError(_0x512250,null));};exports[_0x64e4('0x80')]=function(_0x9dd894,_0x5811c1){var _0x4be56f={'agent':{},'channel':_0x64e4('0x64')};if(_0x9dd894[_0x64e4('0x4a')]['id']){delete _0x9dd894[_0x64e4('0x4a')]['id'];}_0x9dd894['body'][_0x64e4('0x66')]=_0x9dd894[_0x64e4('0x4a')][_0x64e4('0x66')]||_0x9dd894[_0x64e4('0x67')]['id'];_0x4be56f['agent']['id']=_0x9dd894['body']['UserId'];return db['MailMessage']['find']({'where':{'id':_0x9dd894[_0x64e4('0x48')]['id'],'UserId':null}})[_0x64e4('0x14')](handleEntityNotFound(_0x5811c1,null))['then'](function(_0x30ced1){if(_0x30ced1){_0x4be56f[_0x64e4('0x1c')]=_0x30ced1[_0x64e4('0x69')]({'plain':!![]});return db[_0x64e4('0x6a')][_0x64e4('0x49')]({'where':{'id':_0x30ced1[_0x64e4('0x6b')]}});}return null;})[_0x64e4('0x14')](handleEntityNotFound(_0x5811c1,null))['then'](function(_0xea3201){if(_0xea3201){_0x4be56f[_0x64e4('0x6d')]=_0xea3201[_0x64e4('0x69')]({'plain':!![]});interaction_log[_0x64e4('0x1d')](_0x64e4('0x81'),_0x9dd894[_0x64e4('0x67')]['id'],_0x9dd894[_0x64e4('0x67')][_0x64e4('0x29')],_0x9dd894[_0x64e4('0x67')][_0x64e4('0x6f')],_0x4be56f[_0x64e4('0x6d')]['id'],_0x9dd894['body']?JSON[_0x64e4('0x19')](_0x9dd894['body']):_0x64e4('0x70'));return respondWithRpcPromise('RejectMessage',_0x64e4('0x82'),_0x4be56f);}return null;})['then'](function(_0x3099dd){var _0xf96f0a=_0x64e4('0x83')+_0x3099dd[_0x64e4('0x1c')][_0x64e4('0x84')];return db[_0x64e4('0x85')][_0x64e4('0x33')](_0xf96f0a,{'type':db[_0x64e4('0x73')][_0x64e4('0x74')][_0x64e4('0x86')],'raw':!![]})[_0x64e4('0x14')](function(_0x5ade39){return _0x5ade39;});})[_0x64e4('0x14')](function(_0x2b7bbc){if(_0x2b7bbc){_0x4be56f['message'][_0x64e4('0x75')]=_0x2b7bbc[0x0];if(!_0x9dd894[_0x64e4('0x4a')][_0x64e4('0x66')])return;return db[_0x64e4('0x87')][_0x64e4('0x49')]({'where':{'id':_0x9dd894[_0x64e4('0x4a')][_0x64e4('0x66')],'role':_0x64e4('0x68')},'attributes':['id',_0x64e4('0x29'),'fullname',_0x64e4('0x88'),_0x64e4('0x89')],'raw':!![]});}return null;})[_0x64e4('0x14')](function(_0x57b435){if(!_0x57b435)return null;_0x4be56f[_0x64e4('0x1c')][_0x64e4('0x68')]=_0x57b435;return _0x4be56f;})[_0x64e4('0x14')](function(_0x28283e){if(_0x28283e){_0x28283e[_0x64e4('0x1c')]['interface']=util[_0x64e4('0x61')](_0x64e4('0x79'),_0x9dd894[_0x64e4('0x67')][_0x64e4('0x29')]);_0x28283e[_0x64e4('0x1c')][_0x64e4('0x7a')]=_0x4be56f[_0x64e4('0x7a')];_0x28283e[_0x64e4('0x1c')][_0x64e4('0x7b')]=_0x4be56f['channel'];_0x28283e[_0x64e4('0x1c')][_0x64e4('0x7c')]=_0x64e4('0x80');_0x28283e['message'][_0x64e4('0x4a')]=htmlToText[_0x64e4('0x7d')](_0x4be56f[_0x64e4('0x1c')]['body']);respondWithRpcPromise(_0x64e4('0x7e'),_0x64e4('0x7e'),{'event':_0x64e4('0x8a'),'message':_0x28283e[_0x64e4('0x1c')]},client9002);return _0x4be56f;}return null;})[_0x64e4('0x14')](respondWithResult(_0x5811c1,null))[_0x64e4('0x1f')](handleError(_0x5811c1,null));};exports[_0x64e4('0x8b')]=function(_0xb5e39f,_0x2722d0){var _0x461b7e=moment()[_0x64e4('0x8c')]()[_0x64e4('0x8d')]();var _0x443ffe=path[_0x64e4('0x5b')](config[_0x64e4('0x8e')],_0x64e4('0x8f'),'files','tmp');var _0x559f38=path[_0x64e4('0x5b')](config[_0x64e4('0x8e')],_0x64e4('0x8f'),_0x64e4('0x90'),_0x64e4('0x5a'));var _0x202920=util['format']('message-%s.eml',_0x461b7e);return db[_0x64e4('0x2c')][_0x64e4('0x49')]({'where':{'id':_0xb5e39f[_0x64e4('0x48')]['id']},'attributes':['id','body',_0x64e4('0x91'),'to','cc',_0x64e4('0x92'),_0x64e4('0x93'),_0x64e4('0x94')],'include':_0xb5e39f[_0x64e4('0x33')][_0x64e4('0x5a')]?[{'model':db['Attachment'],'as':_0x64e4('0x95')}]:undefined})[_0x64e4('0x14')](handleEntityNotFound(_0x2722d0,null))[_0x64e4('0x14')](function(_0x55cf38){if(_0x55cf38){var _0x330b68=_0x55cf38;var _0x4e007f={'from':_0x330b68[_0x64e4('0x91')],'to':_0x330b68['to'],'subject':_0x330b68['subject'],'html':htmlEntities[_0x64e4('0x96')](_0x330b68[_0x64e4('0x4a')]),'headers':{'Date':moment(_0x330b68[_0x64e4('0x94')])[_0x64e4('0x61')](_0x64e4('0x97'))},'attachments':[]};if(_0x55cf38['cc']){_0x4e007f[_0x64e4('0x98')]['Cc']=_0x55cf38['cc'];}if(_0x55cf38[_0x64e4('0x92')]){_0x4e007f[_0x64e4('0x98')][_0x64e4('0x99')]=_0x55cf38['bcc'];}return new BPromise(function(_0x540eb4,_0x5a54f6){if(_0x55cf38['Attachments']){for(var _0x47995e=0x0;_0x47995e<_0x55cf38[_0x64e4('0x95')][_0x64e4('0x39')];_0x47995e++){var _0x48f007=_0x55cf38[_0x64e4('0x95')][_0x47995e];var _0x457377=path[_0x64e4('0x5b')](_0x559f38,_0x48f007['basename']);if(fs['existsSync'](_0x457377)){_0x4e007f['attachments']['push']({'name':_0x48f007[_0x64e4('0x29')],'contentType':_0x48f007[_0x64e4('0x2f')],'data':fs[_0x64e4('0x9a')](_0x457377)});}}}emlformat['build'](_0x4e007f,function(_0x5cbce5,_0x963bea){if(_0x5cbce5)return _0x5a54f6(_0x5cbce5);fs['writeFileSync'](path[_0x64e4('0x5b')](_0x443ffe,_0x202920),_0x963bea);return _0x540eb4(_0x963bea);});});}})[_0x64e4('0x14')](function(_0x3df27f){if(_0x3df27f){return _0x2722d0[_0x64e4('0x8b')](path['join'](_0x443ffe,_0x202920),_0x202920,function(_0xa6a662){if(!_0xa6a662)fs[_0x64e4('0x9b')](path[_0x64e4('0x5b')](_0x443ffe,_0x202920));});}})[_0x64e4('0x1f')](handleError(_0x2722d0,null));}; \ No newline at end of file +var _0xdf20=['describe','create','out','secret','split','MailAccountId','CmList','CmContact','updatedAt','DESC','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','join','server/files/attachments','List','Contacts','List\x20not\x20found','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','stringify','mail','read','readAt','UserId','agent','get','isNil','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','SELECT','User','fullname','email','internal','manual','interface','channel','motionChannel','accept','EventManager','acceptmessage','reject','MailInteraction','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','rejectMessage','ContactId','QueryTypes','contact','SIP/%s','fromString','rejectmessage','download','root','server','tmp','files','message-%s.eml','from','bcc','subject','createdAt','Attachment','decode','headers','Attachments','basename','push','readFileSync','writeFileSync','unlinkSync','eml-format','moment','util','path','lodash','ioredis','html-to-text','../../components/parsers/qs','api','../../config/logger','mail-interactions','../../mysqldb','redis','defaults','socket.io-emitter','./mailMessage.socket','register','jayson/promise','client','http','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','code','message','catch','json','offset','undefined','limit','count','status','set','Content-Range','update','destroy','end','stack','name','index','MailMessage','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','keys','rawAttributes','find','body'];(function(_0x3cb6dc,_0x120dd3){var _0x47ec89=function(_0x55150a){while(--_0x55150a){_0x3cb6dc['push'](_0x3cb6dc['shift']());}};_0x47ec89(++_0x120dd3);}(_0xdf20,0x193));var _0x0df2=function(_0x5cb06e,_0x29050b){_0x5cb06e=_0x5cb06e-0x0;var _0x5d6fc6=_0xdf20[_0x5cb06e];return _0x5d6fc6;};'use strict';var emlformat=require(_0x0df2('0x0'));var moment=require(_0x0df2('0x1'));var BPromise=require('bluebird');var util=require(_0x0df2('0x2'));var path=require(_0x0df2('0x3'));var fs=require('fs');var _=require(_0x0df2('0x4'));var Redis=require(_0x0df2('0x5'));var htmlToText=require(_0x0df2('0x6'));var qs=require(_0x0df2('0x7'));var logger=require('../../config/logger')(_0x0df2('0x8'));var interaction_log=require(_0x0df2('0x9'))(_0x0df2('0xa'));var config=require('../../config/environment');var db=require(_0x0df2('0xb'))['db'];config[_0x0df2('0xc')]=_[_0x0df2('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0df2('0xe'))(new Redis(config[_0x0df2('0xc')]));var htmlEntities=require('html-entities');require(_0x0df2('0xf'))[_0x0df2('0x10')](socket);var jayson=require(_0x0df2('0x11'));var client=jayson['client']['http']({'port':0x232c});var client9003=jayson[_0x0df2('0x12')][_0x0df2('0x13')]({'port':0x232b});var client9002=jayson[_0x0df2('0x12')][_0x0df2('0x13')]({'port':0x232a});function respondWithRpcPromise(_0x222e74,_0x27ade5,_0x809ea6,_0x41e8cf){return new BPromise(function(_0x42a824,_0x5250d4){var _0x4e0402=_0x41e8cf||client;return _0x4e0402[_0x0df2('0x14')](_0x222e74,_0x809ea6)[_0x0df2('0x15')](function(_0x14a337){logger[_0x0df2('0x16')](_0x0df2('0x17'),_0x27ade5,_0x0df2('0x18'));logger[_0x0df2('0x19')](_0x0df2('0x1a'),_0x27ade5,_0x0df2('0x18'),JSON['stringify'](_0x14a337));if(_0x14a337[_0x0df2('0x1b')]){if(_0x14a337[_0x0df2('0x1b')][_0x0df2('0x1c')]===0x1f4){logger['error']('MailMessage,\x20%s,\x20%s',_0x27ade5,_0x14a337[_0x0df2('0x1b')][_0x0df2('0x1d')]);return _0x5250d4(_0x14a337[_0x0df2('0x1b')][_0x0df2('0x1d')]);}logger[_0x0df2('0x1b')]('MailMessage,\x20%s,\x20%s',_0x27ade5,_0x14a337[_0x0df2('0x1b')][_0x0df2('0x1d')]);return _0x42a824(_0x14a337[_0x0df2('0x1b')][_0x0df2('0x1d')]);}else{logger[_0x0df2('0x16')](_0x0df2('0x17'),_0x27ade5,'request\x20sent');_0x42a824(_0x14a337['result'][_0x0df2('0x1d')]);}})[_0x0df2('0x1e')](function(_0x2e32de){logger['error']('MailMessage,\x20%s,\x20%s',_0x27ade5,_0x2e32de);_0x5250d4(_0x2e32de);});});}function respondWithResult(_0x362c79,_0x1349b0){_0x1349b0=_0x1349b0||0xc8;return function(_0x4acd09){if(_0x4acd09){return _0x362c79['status'](_0x1349b0)[_0x0df2('0x1f')](_0x4acd09);}};}function respondWithFilteredResult(_0x21e345,_0x108062){return function(_0x21e05f){if(_0x21e05f){var _0x5ad34e=typeof _0x108062[_0x0df2('0x20')]===_0x0df2('0x21')&&typeof _0x108062[_0x0df2('0x22')]===_0x0df2('0x21');var _0x2213c5=_0x21e05f['count'];var _0x583206=_0x5ad34e?0x0:_0x108062[_0x0df2('0x20')];var _0x3b2b63=_0x5ad34e?_0x21e05f[_0x0df2('0x23')]:_0x108062[_0x0df2('0x20')]+_0x108062[_0x0df2('0x22')];var _0x4e3685;if(_0x3b2b63>=_0x2213c5){_0x3b2b63=_0x2213c5;_0x4e3685=0xc8;}else{_0x4e3685=0xce;}_0x21e345[_0x0df2('0x24')](_0x4e3685);return _0x21e345[_0x0df2('0x25')](_0x0df2('0x26'),_0x583206+'-'+_0x3b2b63+'/'+_0x2213c5)[_0x0df2('0x1f')](_0x21e05f);}return null;};}function saveUpdates(_0x4b5d7a){return function(_0x1f25ff){if(_0x1f25ff){return _0x1f25ff[_0x0df2('0x27')](_0x4b5d7a)[_0x0df2('0x15')](function(_0x586e94){return _0x586e94;});}return null;};}function removeEntity(_0xdb3c98){return function(_0x2d6cb4){if(_0x2d6cb4){return _0x2d6cb4[_0x0df2('0x28')]()[_0x0df2('0x15')](function(){_0xdb3c98[_0x0df2('0x24')](0xcc)[_0x0df2('0x29')]();});}};}function handleEntityNotFound(_0x270909){return function(_0x2d1311){if(!_0x2d1311){_0x270909['sendStatus'](0x194);}return _0x2d1311;};}function handleError(_0xdd005e,_0x4c0e9d){_0x4c0e9d=_0x4c0e9d||0x1f4;return function(_0x37e7db){logger[_0x0df2('0x1b')](_0x37e7db[_0x0df2('0x2a')]);if(_0x37e7db['name']){delete _0x37e7db[_0x0df2('0x2b')];}_0xdd005e[_0x0df2('0x24')](_0x4c0e9d)['send'](_0x37e7db);};}exports[_0x0df2('0x2c')]=function(_0x1cba96,_0x1d013c){var _0xed99cf={},_0x454648={},_0x1dd0f9={'count':0x0,'rows':[]};var _0x1b9f73=_['map'](db[_0x0df2('0x2d')]['rawAttributes'],function(_0x2c4b81){return{'name':_0x2c4b81[_0x0df2('0x2e')],'type':_0x2c4b81[_0x0df2('0x2f')][_0x0df2('0x30')]};});_0x454648[_0x0df2('0x31')]=_[_0x0df2('0x32')](_0x1b9f73,_0x0df2('0x2b'));_0x454648[_0x0df2('0x33')]=_['keys'](_0x1cba96[_0x0df2('0x33')]);_0x454648[_0x0df2('0x34')]=_[_0x0df2('0x35')](_0x454648['model'],_0x454648[_0x0df2('0x33')]);_0xed99cf[_0x0df2('0x36')]=_[_0x0df2('0x35')](_0x454648['model'],qs[_0x0df2('0x37')](_0x1cba96['query'][_0x0df2('0x37')]));_0xed99cf[_0x0df2('0x36')]=_0xed99cf[_0x0df2('0x36')][_0x0df2('0x38')]?_0xed99cf['attributes']:_0x454648[_0x0df2('0x31')];if(!_0x1cba96[_0x0df2('0x33')][_0x0df2('0x39')](_0x0df2('0x3a'))){_0xed99cf[_0x0df2('0x22')]=qs[_0x0df2('0x22')](_0x1cba96['query'][_0x0df2('0x22')]);_0xed99cf[_0x0df2('0x20')]=qs['offset'](_0x1cba96[_0x0df2('0x33')][_0x0df2('0x20')]);}_0xed99cf[_0x0df2('0x3b')]=qs[_0x0df2('0x3c')](_0x1cba96[_0x0df2('0x33')][_0x0df2('0x3c')]);_0xed99cf[_0x0df2('0x3d')]=qs[_0x0df2('0x34')](_[_0x0df2('0x3e')](_0x1cba96[_0x0df2('0x33')],_0x454648[_0x0df2('0x34')]),_0x1b9f73);if(_0x1cba96[_0x0df2('0x33')]['filter']){_0xed99cf[_0x0df2('0x3d')]=_[_0x0df2('0x3f')](_0xed99cf[_0x0df2('0x3d')],{'$or':_[_0x0df2('0x32')](_0x1b9f73,function(_0x541aa1){if(_0x541aa1[_0x0df2('0x2f')]!==_0x0df2('0x40')){var _0x5982eb={};_0x5982eb[_0x541aa1[_0x0df2('0x2b')]]={'$like':'%'+_0x1cba96[_0x0df2('0x33')][_0x0df2('0x41')]+'%'};return _0x5982eb;}})});}_0xed99cf=_[_0x0df2('0x3f')]({},_0xed99cf,_0x1cba96[_0x0df2('0x42')]);var _0xda5e3f={'where':_0xed99cf[_0x0df2('0x3d')]};return db[_0x0df2('0x2d')][_0x0df2('0x23')](_0xda5e3f)['then'](function(_0x4ce4aa){_0x1dd0f9[_0x0df2('0x23')]=_0x4ce4aa;if(_0x1cba96[_0x0df2('0x33')][_0x0df2('0x43')]){_0xed99cf[_0x0df2('0x44')]=[{'all':!![]}];}return db[_0x0df2('0x2d')][_0x0df2('0x45')](_0xed99cf);})[_0x0df2('0x15')](function(_0x473008){_0x1dd0f9[_0x0df2('0x46')]=_0x473008;return _0x1dd0f9;})['then'](respondWithFilteredResult(_0x1d013c,_0xed99cf))[_0x0df2('0x1e')](handleError(_0x1d013c,null));};exports[_0x0df2('0x47')]=function(_0x800c39,_0x2ccfb8){var _0x585776={'raw':!![],'where':{'id':_0x800c39[_0x0df2('0x48')]['id']}},_0x4dce72={};_0x4dce72['model']=_[_0x0df2('0x49')](db['MailMessage'][_0x0df2('0x4a')]);_0x4dce72['query']=_[_0x0df2('0x49')](_0x800c39['query']);_0x4dce72[_0x0df2('0x34')]=_['intersection'](_0x4dce72[_0x0df2('0x31')],_0x4dce72['query']);_0x585776['attributes']=_['intersection'](_0x4dce72[_0x0df2('0x31')],qs[_0x0df2('0x37')](_0x800c39[_0x0df2('0x33')]['fields']));_0x585776['attributes']=_0x585776[_0x0df2('0x36')][_0x0df2('0x38')]?_0x585776[_0x0df2('0x36')]:_0x4dce72['model'];if(_0x800c39[_0x0df2('0x33')]['includeAll']){_0x585776[_0x0df2('0x44')]=[{'all':!![]}];}_0x585776=_[_0x0df2('0x3f')]({},_0x585776,_0x800c39[_0x0df2('0x42')]);return db[_0x0df2('0x2d')][_0x0df2('0x4b')](_0x585776)['then'](handleEntityNotFound(_0x2ccfb8,null))[_0x0df2('0x15')](respondWithResult(_0x2ccfb8,null))[_0x0df2('0x1e')](handleError(_0x2ccfb8,null));};exports[_0x0df2('0x27')]=function(_0x569524,_0x52f23e){if(_0x569524[_0x0df2('0x4c')]['id']){delete _0x569524[_0x0df2('0x4c')]['id'];}return db['MailMessage'][_0x0df2('0x4b')]({'where':{'id':_0x569524[_0x0df2('0x48')]['id']}})[_0x0df2('0x15')](handleEntityNotFound(_0x52f23e,null))['then'](saveUpdates(_0x569524[_0x0df2('0x4c')],null))[_0x0df2('0x15')](respondWithResult(_0x52f23e,null))[_0x0df2('0x1e')](handleError(_0x52f23e,null));};exports[_0x0df2('0x28')]=function(_0x245167,_0x393c46){return db[_0x0df2('0x2d')][_0x0df2('0x4b')]({'where':{'id':_0x245167[_0x0df2('0x48')]['id']}})[_0x0df2('0x15')](handleEntityNotFound(_0x393c46,null))[_0x0df2('0x15')](removeEntity(_0x393c46,null))[_0x0df2('0x1e')](handleError(_0x393c46,null));};exports[_0x0df2('0x4d')]=function(_0x4c16b9,_0x50d3b2){return db[_0x0df2('0x2d')][_0x0df2('0x4d')]()[_0x0df2('0x15')](respondWithResult(_0x50d3b2,null))[_0x0df2('0x1e')](handleError(_0x50d3b2,null));};exports[_0x0df2('0x4e')]=function(_0x2933d3,_0x487e5b){return db['MailMessage'][_0x0df2('0x4e')](_0x2933d3[_0x0df2('0x4c')])[_0x0df2('0x15')](function(_0x320972){if(_0x320972){if(_0x320972['direction']===_0x0df2('0x4f')&&!_0x320972[_0x0df2('0x50')]){var _0x28f13b,_0x95bd2,_0x2bc746;if(_0x2933d3[_0x0df2('0x4c')]['to']){_0x95bd2=_0x2933d3[_0x0df2('0x4c')]['to'][_0x0df2('0x51')](',')[0x0];}return db['MailAccount']['findOne']({'where':{'id':_0x320972[_0x0df2('0x52')]},'include':[{'model':db[_0x0df2('0x53')],'as':'List','include':[{'model':db[_0x0df2('0x54')],'as':'Contacts','where':{'email':_0x95bd2},'limit':0x1,'order':[[_0x0df2('0x55'),_0x0df2('0x56')]]}]},{'model':db[_0x0df2('0x57')],'as':_0x0df2('0x58'),'raw':!![],'include':[{'model':db[_0x0df2('0x59')],'as':_0x0df2('0x59'),'raw':!![]}]}]})[_0x0df2('0x15')](function(_0x20e037){_0x28f13b=_0x20e037;if(!_0x28f13b||!_0x28f13b['Smtp'])return;var _0x481f4b=_0x28f13b[_0x0df2('0x5a')]();if(_0x2933d3[_0x0df2('0x4c')][_0x0df2('0x5b')]&&_0x2933d3[_0x0df2('0x4c')]['attachments'][_0x0df2('0x38')]){for(var _0xe3b2c9=0x0;_0xe3b2c9<_0x2933d3[_0x0df2('0x4c')][_0x0df2('0x5b')][_0x0df2('0x38')];_0xe3b2c9+=0x1){_0x2933d3[_0x0df2('0x4c')][_0x0df2('0x5b')][_0xe3b2c9]={'filename':_0x2933d3['body']['attachments'][_0xe3b2c9][_0x0df2('0x2b')],'path':path[_0x0df2('0x5c')](config['root'],_0x0df2('0x5d'),_0x2933d3[_0x0df2('0x4c')][_0x0df2('0x5b')][_0xe3b2c9]['basename'])};}}_0x2bc746={'account':_0x481f4b,'message':_0x2933d3[_0x0df2('0x4c')]};return;})[_0x0df2('0x15')](function(){if(_0x28f13b['List']){if(_0x28f13b[_0x0df2('0x5e')][_0x0df2('0x5f')][_0x0df2('0x38')]){return _0x28f13b[_0x0df2('0x5e')][_0x0df2('0x5f')][0x0];}else{return db[_0x0df2('0x54')][_0x0df2('0x4e')](_[_0x0df2('0xd')](_0x2933d3[_0x0df2('0x4c')],{'firstName':_0x2933d3[_0x0df2('0x4c')]['to'],'email':_0x2933d3['body']['to'],'phone':_0x2933d3[_0x0df2('0x4c')]['to'],'ListId':_0x28f13b['ListId']}));}}else{throw new Error(_0x0df2('0x60'));}})['then'](function(){if(_0x2bc746){return respondWithRpcPromise(_0x0df2('0x61'),_0x0df2('0x62'),_0x2bc746,client9003)[_0x0df2('0x15')](function(_0x4845c0){return _0x320972[_0x0df2('0x27')]({'read':!![],'messageId':_0x4845c0[_0x0df2('0x63')],'sentAt':moment()[_0x0df2('0x64')](_0x0df2('0x65'))});})[_0x0df2('0x1e')](function(_0x59b43c){logger[_0x0df2('0x1b')]('%s',JSON[_0x0df2('0x66')](_0x59b43c));return _0x320972;});}return _0x320972;});}return _0x320972;}})[_0x0df2('0x15')](respondWithResult(_0x487e5b,0xc9))['catch'](handleError(_0x487e5b,null));};exports['accept']=function(_0x3ef9e8,_0x51d06e){var _0x5ed4b0={'agent':{},'channel':_0x0df2('0x67')};if(_0x3ef9e8[_0x0df2('0x4c')]['id']){delete _0x3ef9e8['body']['id'];}_0x3ef9e8[_0x0df2('0x4c')][_0x0df2('0x68')]=!![];_0x3ef9e8[_0x0df2('0x4c')][_0x0df2('0x69')]=moment()[_0x0df2('0x64')]('YYYY-MM-DD\x20HH:mm:ss');_0x3ef9e8['body'][_0x0df2('0x6a')]=_0x3ef9e8[_0x0df2('0x4c')]['UserId']||_0x3ef9e8['user']['id'];_0x5ed4b0[_0x0df2('0x6b')]['id']=_0x3ef9e8[_0x0df2('0x4c')][_0x0df2('0x6a')];return db[_0x0df2('0x2d')]['find']({'where':{'id':_0x3ef9e8[_0x0df2('0x48')]['id'],'UserId':null}})[_0x0df2('0x15')](handleEntityNotFound(_0x51d06e,null))[_0x0df2('0x15')](saveUpdates(_0x3ef9e8[_0x0df2('0x4c')],null))['then'](function(_0x3a37ad){if(_0x3a37ad){_0x5ed4b0[_0x0df2('0x1d')]=_0x3a37ad[_0x0df2('0x6c')]({'plain':!![]});return db['MailInteraction'][_0x0df2('0x4b')]({'where':{'id':_0x3a37ad['MailInteractionId']}});}return null;})[_0x0df2('0x15')](handleEntityNotFound(_0x51d06e,null))[_0x0df2('0x15')](function(_0xc964a0){if(_0xc964a0){return _0xc964a0['update']({'UserId':_0x3ef9e8[_0x0df2('0x4c')]['UserId'],'read1stAt':_[_0x0df2('0x6d')](_0xc964a0[_0x0df2('0x6e')])?moment()[_0x0df2('0x64')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x0df2('0x15')](function(_0x35abb1){if(_0x35abb1){_0x5ed4b0[_0x0df2('0x6f')]=_0x35abb1[_0x0df2('0x6c')]({'plain':!![]});interaction_log['info'](_0x0df2('0x70'),_0x3ef9e8[_0x0df2('0x71')]['id'],_0x3ef9e8['user']['name'],_0x3ef9e8[_0x0df2('0x71')]['role'],_0x5ed4b0[_0x0df2('0x6f')]['id'],_0x3ef9e8[_0x0df2('0x4c')]?JSON[_0x0df2('0x66')](_0x3ef9e8[_0x0df2('0x4c')]):'null');return respondWithRpcPromise('AcceptMessage',_0x0df2('0x72'),_0x5ed4b0);}return null;})[_0x0df2('0x15')](function(_0x569308){var _0x3b0a47=_0x0df2('0x73')+_0x569308[_0x0df2('0x1d')]['ContactId'];return db[_0x0df2('0x74')][_0x0df2('0x33')](_0x3b0a47,{'type':db[_0x0df2('0x75')]['QueryTypes'][_0x0df2('0x76')],'raw':!![]})[_0x0df2('0x15')](function(_0x1d8558){return _0x1d8558;});})[_0x0df2('0x15')](function(_0x288764){if(_0x288764){_0x5ed4b0[_0x0df2('0x1d')]['contact']=_0x288764[0x0];if(!_0x3ef9e8[_0x0df2('0x4c')][_0x0df2('0x6a')])return;return db[_0x0df2('0x77')][_0x0df2('0x4b')]({'where':{'id':_0x3ef9e8[_0x0df2('0x4c')][_0x0df2('0x6a')],'role':'agent'},'attributes':['id',_0x0df2('0x2b'),_0x0df2('0x78'),_0x0df2('0x79'),_0x0df2('0x7a')],'raw':!![]});}return null;})[_0x0df2('0x15')](function(_0x710fb9){if(!_0x710fb9)return null;_0x5ed4b0['message'][_0x0df2('0x6b')]=_0x710fb9;return _0x5ed4b0;})[_0x0df2('0x15')](function(_0x1fe889){if(_0x1fe889){if(_0x3ef9e8[_0x0df2('0x4c')][_0x0df2('0x7b')]){_0x5ed4b0[_0x0df2('0x1d')][_0x0df2('0x7c')]=util[_0x0df2('0x64')]('SIP/%s',_0x3ef9e8[_0x0df2('0x71')][_0x0df2('0x2b')]);_0x5ed4b0[_0x0df2('0x1d')][_0x0df2('0x7d')]=_0x5ed4b0[_0x0df2('0x7d')];_0x5ed4b0[_0x0df2('0x1d')][_0x0df2('0x7e')]=_0x5ed4b0['channel'];_0x5ed4b0['message']['event']=_0x0df2('0x7f');_0x5ed4b0[_0x0df2('0x1d')][_0x0df2('0x4c')]=htmlToText['fromString'](_0x5ed4b0['message'][_0x0df2('0x4c')]);return respondWithRpcPromise(_0x0df2('0x80'),'EventManager',{'event':_0x0df2('0x81'),'message':_0x5ed4b0[_0x0df2('0x1d')]},client9002)[_0x0df2('0x15')](function(){return _0x5ed4b0;});}return _0x5ed4b0;}return null;})[_0x0df2('0x15')](respondWithResult(_0x51d06e,null))[_0x0df2('0x1e')](handleError(_0x51d06e,null));};exports[_0x0df2('0x82')]=function(_0x4ef5df,_0xb9dfdd){var _0x480ba4={'agent':{},'channel':_0x0df2('0x67')};if(_0x4ef5df[_0x0df2('0x4c')]['id']){delete _0x4ef5df['body']['id'];}_0x4ef5df[_0x0df2('0x4c')][_0x0df2('0x6a')]=_0x4ef5df[_0x0df2('0x4c')][_0x0df2('0x6a')]||_0x4ef5df[_0x0df2('0x71')]['id'];_0x480ba4['agent']['id']=_0x4ef5df[_0x0df2('0x4c')][_0x0df2('0x6a')];return db[_0x0df2('0x2d')]['find']({'where':{'id':_0x4ef5df[_0x0df2('0x48')]['id'],'UserId':null}})[_0x0df2('0x15')](handleEntityNotFound(_0xb9dfdd,null))[_0x0df2('0x15')](function(_0xf9b4fc){if(_0xf9b4fc){_0x480ba4[_0x0df2('0x1d')]=_0xf9b4fc[_0x0df2('0x6c')]({'plain':!![]});return db[_0x0df2('0x83')][_0x0df2('0x4b')]({'where':{'id':_0xf9b4fc['MailInteractionId']}});}return null;})[_0x0df2('0x15')](handleEntityNotFound(_0xb9dfdd,null))[_0x0df2('0x15')](function(_0x38cbda){if(_0x38cbda){_0x480ba4['interaction']=_0x38cbda[_0x0df2('0x6c')]({'plain':!![]});interaction_log[_0x0df2('0x16')](_0x0df2('0x84'),_0x4ef5df[_0x0df2('0x71')]['id'],_0x4ef5df[_0x0df2('0x71')][_0x0df2('0x2b')],_0x4ef5df['user'][_0x0df2('0x85')],_0x480ba4[_0x0df2('0x6f')]['id'],_0x4ef5df['body']?JSON[_0x0df2('0x66')](_0x4ef5df['body']):'null');return respondWithRpcPromise('RejectMessage',_0x0df2('0x86'),_0x480ba4);}return null;})[_0x0df2('0x15')](function(_0x5e8fa7){var _0x383dfd='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5e8fa7[_0x0df2('0x1d')][_0x0df2('0x87')];return db[_0x0df2('0x74')][_0x0df2('0x33')](_0x383dfd,{'type':db['Sequelize'][_0x0df2('0x88')]['SELECT'],'raw':!![]})[_0x0df2('0x15')](function(_0x2c27a2){return _0x2c27a2;});})[_0x0df2('0x15')](function(_0x1701fa){if(_0x1701fa){_0x480ba4[_0x0df2('0x1d')][_0x0df2('0x89')]=_0x1701fa[0x0];if(!_0x4ef5df[_0x0df2('0x4c')][_0x0df2('0x6a')])return;return db[_0x0df2('0x77')][_0x0df2('0x4b')]({'where':{'id':_0x4ef5df[_0x0df2('0x4c')][_0x0df2('0x6a')],'role':'agent'},'attributes':['id','name','fullname',_0x0df2('0x79'),'internal'],'raw':!![]});}return null;})[_0x0df2('0x15')](function(_0x42a0db){if(!_0x42a0db)return null;_0x480ba4[_0x0df2('0x1d')][_0x0df2('0x6b')]=_0x42a0db;return _0x480ba4;})['then'](function(_0x205566){if(_0x205566){_0x205566[_0x0df2('0x1d')][_0x0df2('0x7c')]=util[_0x0df2('0x64')](_0x0df2('0x8a'),_0x4ef5df[_0x0df2('0x71')]['name']);_0x205566['message'][_0x0df2('0x7d')]=_0x480ba4[_0x0df2('0x7d')];_0x205566[_0x0df2('0x1d')]['motionChannel']=_0x480ba4['channel'];_0x205566['message']['event']='reject';_0x205566[_0x0df2('0x1d')][_0x0df2('0x4c')]=htmlToText[_0x0df2('0x8b')](_0x480ba4['message'][_0x0df2('0x4c')]);respondWithRpcPromise(_0x0df2('0x80'),_0x0df2('0x80'),{'event':_0x0df2('0x8c'),'message':_0x205566['message']},client9002);return _0x480ba4;}return null;})[_0x0df2('0x15')](respondWithResult(_0xb9dfdd,null))[_0x0df2('0x1e')](handleError(_0xb9dfdd,null));};exports[_0x0df2('0x8d')]=function(_0x25c12f,_0x14d790){var _0x202387=moment()['unix']()['toString']();var _0x2b520d=path[_0x0df2('0x5c')](config[_0x0df2('0x8e')],_0x0df2('0x8f'),'files',_0x0df2('0x90'));var _0x196d68=path[_0x0df2('0x5c')](config['root'],_0x0df2('0x8f'),_0x0df2('0x91'),_0x0df2('0x5b'));var _0x30c41a=util[_0x0df2('0x64')](_0x0df2('0x92'),_0x202387);return db['MailMessage'][_0x0df2('0x4b')]({'where':{'id':_0x25c12f[_0x0df2('0x48')]['id']},'attributes':['id',_0x0df2('0x4c'),_0x0df2('0x93'),'to','cc',_0x0df2('0x94'),_0x0df2('0x95'),_0x0df2('0x96')],'include':_0x25c12f[_0x0df2('0x33')]['attachments']?[{'model':db[_0x0df2('0x97')],'as':'Attachments'}]:undefined})[_0x0df2('0x15')](handleEntityNotFound(_0x14d790,null))[_0x0df2('0x15')](function(_0x3511c4){if(_0x3511c4){var _0x37a050=_0x3511c4;var _0x5e7611={'from':_0x37a050[_0x0df2('0x93')],'to':_0x37a050['to'],'subject':_0x37a050[_0x0df2('0x95')],'html':htmlEntities[_0x0df2('0x98')](_0x37a050[_0x0df2('0x4c')]),'headers':{'Date':moment(_0x37a050[_0x0df2('0x96')])[_0x0df2('0x64')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x3511c4['cc']){_0x5e7611['headers']['Cc']=_0x3511c4['cc'];}if(_0x3511c4['bcc']){_0x5e7611[_0x0df2('0x99')]['Bcc']=_0x3511c4[_0x0df2('0x94')];}return new BPromise(function(_0x378d8f,_0x2d6bb8){if(_0x3511c4[_0x0df2('0x9a')]){for(var _0x318137=0x0;_0x318137<_0x3511c4[_0x0df2('0x9a')][_0x0df2('0x38')];_0x318137++){var _0xefb39a=_0x3511c4[_0x0df2('0x9a')][_0x318137];var _0x54cc5c=path['join'](_0x196d68,_0xefb39a[_0x0df2('0x9b')]);if(fs['existsSync'](_0x54cc5c)){_0x5e7611[_0x0df2('0x5b')][_0x0df2('0x9c')]({'name':_0xefb39a[_0x0df2('0x2b')],'contentType':_0xefb39a[_0x0df2('0x2f')],'data':fs[_0x0df2('0x9d')](_0x54cc5c)});}}}emlformat['build'](_0x5e7611,function(_0x39eb79,_0x5c0df8){if(_0x39eb79)return _0x2d6bb8(_0x39eb79);fs[_0x0df2('0x9e')](path[_0x0df2('0x5c')](_0x2b520d,_0x30c41a),_0x5c0df8);return _0x378d8f(_0x5c0df8);});});}})[_0x0df2('0x15')](function(_0x4ac0df){if(_0x4ac0df){return _0x14d790[_0x0df2('0x8d')](path[_0x0df2('0x5c')](_0x2b520d,_0x30c41a),_0x30c41a,function(_0x15c474){if(!_0x15c474)fs[_0x0df2('0x9f')](path[_0x0df2('0x5c')](_0x2b520d,_0x30c41a));});}})[_0x0df2('0x1e')](handleError(_0x14d790,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 891c50a..ff791dc 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 _0x38d1=['remove','emit','exports','../../mysqldb','setMaxListeners','save','update'];(function(_0x16078d,_0x394dfe){var _0x105524=function(_0x3c526a){while(--_0x3c526a){_0x16078d['push'](_0x16078d['shift']());}};_0x105524(++_0x394dfe);}(_0x38d1,0x192));var _0x138d=function(_0x109148,_0xe3dc2b){_0x109148=_0x109148-0x0;var _0x3c6510=_0x38d1[_0x109148];return _0x3c6510;};'use strict';var EventEmitter=require('events');var MailMessage=require(_0x138d('0x0'))['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x138d('0x1')](0x0);var events={'afterCreate':_0x138d('0x2'),'afterUpdate':_0x138d('0x3'),'afterDestroy':_0x138d('0x4')};function emitEvent(_0xf0133){return function(_0x5d47cc,_0x4f04ff,_0x57e93b){MailMessageEvents[_0x138d('0x5')](_0xf0133+':'+_0x5d47cc['id'],_0x5d47cc);MailMessageEvents[_0x138d('0x5')](_0xf0133,_0x5d47cc);_0x57e93b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage['hook'](e,emitEvent(event));}}module[_0x138d('0x6')]=MailMessageEvents; \ No newline at end of file +var _0x75d0=['events','../../mysqldb','MailMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x252782,_0x5b7839){var _0x5123ea=function(_0xbace4b){while(--_0xbace4b){_0x252782['push'](_0x252782['shift']());}};_0x5123ea(++_0x5b7839);}(_0x75d0,0x8c));var _0x075d=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x75d0[_0x432682];return _0x463d05;};'use strict';var EventEmitter=require(_0x075d('0x0'));var MailMessage=require(_0x075d('0x1'))['db'][_0x075d('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x075d('0x3')](0x0);var events={'afterCreate':_0x075d('0x4'),'afterUpdate':_0x075d('0x5'),'afterDestroy':_0x075d('0x6')};function emitEvent(_0x579c9b){return function(_0x2a6ead,_0x4717d6,_0x4251f0){MailMessageEvents[_0x075d('0x7')](_0x579c9b+':'+_0x2a6ead['id'],_0x2a6ead);MailMessageEvents[_0x075d('0x7')](_0x579c9b,_0x2a6ead);_0x4251f0(null);};}for(var e in events){if(events[_0x075d('0x8')](e)){var event=events[e];MailMessage['hook'](e,emitEvent(event));}}module[_0x075d('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 51e1bdb..b23b072 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 _0x1d0d=['error','utf8mb4','utf8mb4_unicode_ci','util','moment','bluebird','request-promise','html-to-text','path','rimraf','../../config/environment','exports','define','mail_messages','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','get','direction','toLowerCase','out','MailInteraction','MailInteractionId','then','createdAt','catch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1d0d,0x17c));var _0xd1d0=function(_0x337131,_0x293505){_0x337131=_0x337131-0x0;var _0x1466d3=_0x1d0d[_0x337131];return _0x1466d3;};'use strict';var _=require('lodash');var util=require(_0xd1d0('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xd1d0('0x1'));var BPromise=require(_0xd1d0('0x2'));var rp=require(_0xd1d0('0x3'));var htmlToText=require(_0xd1d0('0x4'));var fs=require('fs');var path=require(_0xd1d0('0x5'));var rimraf=require(_0xd1d0('0x6'));var config=require(_0xd1d0('0x7'));var attributes=require('./mailMessage.attributes');module[_0xd1d0('0x8')]=function(_0x12c8ff,_0x355c0f){return _0x12c8ff[_0xd1d0('0x9')]('MailMessage',attributes,{'tableName':_0xd1d0('0xa'),'paranoid':![],'indexes':[{'name':_0xd1d0('0xb'),'fields':['messageId']},{'name':_0xd1d0('0xc'),'fields':[_0xd1d0('0xd'),_0xd1d0('0xe')],'type':_0xd1d0('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x110548,_0x140ba3,_0x26933b){if(_0x110548[_0xd1d0('0x10')]){_0x110548[_0xd1d0('0xd')]=htmlToText['fromString'](_0x110548[_0xd1d0('0x10')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x26933b(null,_0x140ba3);},'afterCreate':function(_0xd06f2d,_0x173b5e,_0x569bd9){var _0x43ab4e=_0x12c8ff['models'];var _0x57646e=_0xd06f2d[_0xd1d0('0x11')]({'plain':!![]});if(_0x57646e[_0xd1d0('0x12')][_0xd1d0('0x13')]()==='in'||_0x57646e[_0xd1d0('0x12')][_0xd1d0('0x13')]()===_0xd1d0('0x14')&&!_0x57646e['secret']&&!_['isNil'](_0x57646e['UserId'])){_0x43ab4e[_0xd1d0('0x15')]['findOne']({'where':{'id':_0x57646e[_0xd1d0('0x16')]}})[_0xd1d0('0x17')](function(_0x41b689){if(_0x41b689){_0x41b689['update']({'lastMsgAt':_0x57646e[_0xd1d0('0x18')],'lastMsgDirection':_0x57646e[_0xd1d0('0x12')][_0xd1d0('0x13')]()});}})[_0xd1d0('0x19')](function(_0xe04d2){console[_0xd1d0('0x1a')](_0xe04d2);});}_0x569bd9();}},'charset':_0xd1d0('0x1b'),'collate':_0xd1d0('0x1c')});}; \ No newline at end of file +var _0xa27f=['UserId','MailInteraction','findOne','MailInteractionId','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','rimraf','./mailMessage.attributes','define','mail_messages','messageId','fti_mail_messages','plainBody','subject','body','fromString','models','direction','toLowerCase','out','secret','isNil'];(function(_0xf13e52,_0x26431b){var _0x3a324d=function(_0x212928){while(--_0x212928){_0xf13e52['push'](_0xf13e52['shift']());}};_0x3a324d(++_0x26431b);}(_0xa27f,0x19d));var _0xfa27=function(_0x15fc45,_0x177241){_0x15fc45=_0x15fc45-0x0;var _0x111432=_0xa27f[_0x15fc45];return _0x111432;};'use strict';var _=require(_0xfa27('0x0'));var util=require(_0xfa27('0x1'));var logger=require(_0xfa27('0x2'))(_0xfa27('0x3'));var moment=require('moment');var BPromise=require(_0xfa27('0x4'));var rp=require('request-promise');var htmlToText=require('html-to-text');var fs=require('fs');var path=require('path');var rimraf=require(_0xfa27('0x5'));var config=require('../../config/environment');var attributes=require(_0xfa27('0x6'));module['exports']=function(_0x3bdde0,_0x5aeed9){return _0x3bdde0[_0xfa27('0x7')]('MailMessage',attributes,{'tableName':_0xfa27('0x8'),'paranoid':![],'indexes':[{'name':_0xfa27('0x9'),'fields':[_0xfa27('0x9')]},{'name':_0xfa27('0xa'),'fields':[_0xfa27('0xb'),_0xfa27('0xc')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x140fb6,_0x2efd6e,_0x2105f3){if(_0x140fb6[_0xfa27('0xd')]){_0x140fb6['plainBody']=htmlToText[_0xfa27('0xe')](_0x140fb6[_0xfa27('0xd')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x2105f3(null,_0x2efd6e);},'afterCreate':function(_0x575b01,_0x293414,_0x452c8b){var _0x13785a=_0x3bdde0[_0xfa27('0xf')];var _0x327150=_0x575b01['get']({'plain':!![]});if(_0x327150[_0xfa27('0x10')][_0xfa27('0x11')]()==='in'||_0x327150[_0xfa27('0x10')]['toLowerCase']()===_0xfa27('0x12')&&!_0x327150[_0xfa27('0x13')]&&!_[_0xfa27('0x14')](_0x327150[_0xfa27('0x15')])){_0x13785a[_0xfa27('0x16')][_0xfa27('0x17')]({'where':{'id':_0x327150[_0xfa27('0x18')]}})['then'](function(_0x1d7f34){if(_0x1d7f34){_0x1d7f34[_0xfa27('0x19')]({'lastMsgAt':_0x327150[_0xfa27('0x1a')],'lastMsgDirection':_0x327150['direction'][_0xfa27('0x11')]()});}})[_0xfa27('0x1b')](function(_0x4435e9){console[_0xfa27('0x1c')](_0x4435e9);});}_0x452c8b();}},'charset':_0xfa27('0x1d'),'collate':_0xfa27('0x1e')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index e9d0c4f..4c8fc24 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 _0xe1e3=['rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./mailMessage.socket','request','then','info','stringify','code','error','MailMessage,\x20%s,\x20%s','message','request\x20sent','result','catch','CreateMailMessage','create','body','options','raw','debug','lodash','util','bluebird','../../mysqldb','../../config/logger'];(function(_0x3da832,_0x2133f1){var _0xe602f2=function(_0xb7b2f){while(--_0xb7b2f){_0x3da832['push'](_0x3da832['shift']());}};_0xe602f2(++_0x2133f1);}(_0xe1e3,0x1bb));var _0x3e1e=function(_0x582361,_0x4cfabb){_0x582361=_0x582361-0x0;var _0x82aa95=_0xe1e3[_0x582361];return _0x82aa95;};'use strict';var _=require(_0x3e1e('0x0'));var util=require(_0x3e1e('0x1'));var moment=require('moment');var BPromise=require(_0x3e1e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3e1e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x3e1e('0x4'))(_0x3e1e('0x5'));var config=require(_0x3e1e('0x6'));var jayson=require(_0x3e1e('0x7'));var client=jayson[_0x3e1e('0x8')][_0x3e1e('0x9')]({'port':0x232a});config['redis']=_[_0x3e1e('0xa')](config[_0x3e1e('0xb')],{'host':_0x3e1e('0xc'),'port':0x18eb});var socket=require(_0x3e1e('0xd'))(new Redis(config[_0x3e1e('0xb')]));require(_0x3e1e('0xe'))['register'](socket);function respondWithRpcPromise(_0x5c4c25,_0x5060e8,_0x31d205){return new BPromise(function(_0x5b0df8,_0x349460){return client[_0x3e1e('0xf')](_0x5c4c25,_0x31d205)[_0x3e1e('0x10')](function(_0x594c59){logger[_0x3e1e('0x11')]('MailMessage,\x20%s,\x20%s',_0x5060e8,'request\x20sent');logger['debug']('MailMessage,\x20%s,\x20%s,\x20%s',_0x5060e8,'request\x20sent',JSON[_0x3e1e('0x12')](_0x594c59));if(_0x594c59['error']){if(_0x594c59['error'][_0x3e1e('0x13')]===0x1f4){logger[_0x3e1e('0x14')](_0x3e1e('0x15'),_0x5060e8,_0x594c59['error']['message']);return _0x349460(_0x594c59[_0x3e1e('0x14')][_0x3e1e('0x16')]);}logger['error'](_0x3e1e('0x15'),_0x5060e8,_0x594c59[_0x3e1e('0x14')]['message']);return _0x5b0df8(_0x594c59[_0x3e1e('0x14')]['message']);}else{logger[_0x3e1e('0x11')](_0x3e1e('0x15'),_0x5060e8,_0x3e1e('0x17'));_0x5b0df8(_0x594c59[_0x3e1e('0x18')][_0x3e1e('0x16')]);}})[_0x3e1e('0x19')](function(_0x569f49){logger['error']('MailMessage,\x20%s,\x20%s',_0x5060e8,_0x569f49);_0x349460(_0x569f49);});});}exports[_0x3e1e('0x1a')]=function(_0x30acbf){var _0xa3e99c=this;return new Promise(function(_0x57c660,_0x1c5acd){return db['MailMessage'][_0x3e1e('0x1b')](_0x30acbf[_0x3e1e('0x1c')],{'raw':_0x30acbf[_0x3e1e('0x1d')]?_0x30acbf['options'][_0x3e1e('0x1e')]===undefined?!![]:![]:!![]})[_0x3e1e('0x10')](function(_0xefa098){logger['info']('CreateMailMessage',_0x30acbf);logger[_0x3e1e('0x1f')](_0x3e1e('0x1a'),_0x30acbf,JSON['stringify'](_0xefa098));_0x57c660(_0xefa098);})[_0x3e1e('0x19')](function(_0x56ae51){logger[_0x3e1e('0x14')](_0x3e1e('0x1a'),_0x56ae51[_0x3e1e('0x16')],_0x30acbf);_0x1c5acd(_0xa3e99c[_0x3e1e('0x14')](0x1f4,_0x56ae51[_0x3e1e('0x16')]));});});}; \ No newline at end of file +var _0x4e2e=['socket.io-emitter','./mailMessage.socket','request','then','info','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','code','MailMessage,\x20%s,\x20%s','message','catch','CreateMailMessage','create','body','options','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost'];(function(_0x359bbe,_0x5b7fcc){var _0x1b3353=function(_0x34b41c){while(--_0x34b41c){_0x359bbe['push'](_0x359bbe['shift']());}};_0x1b3353(++_0x5b7fcc);}(_0x4e2e,0x1f2));var _0xe4e2=function(_0x3faf51,_0xd231f7){_0x3faf51=_0x3faf51-0x0;var _0x5c23fb=_0x4e2e[_0x3faf51];return _0x5c23fb;};'use strict';var _=require('lodash');var util=require(_0xe4e2('0x0'));var moment=require(_0xe4e2('0x1'));var BPromise=require(_0xe4e2('0x2'));var rs=require(_0xe4e2('0x3'));var fs=require('fs');var Redis=require(_0xe4e2('0x4'));var db=require(_0xe4e2('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe4e2('0x6'))(_0xe4e2('0x7'));var config=require(_0xe4e2('0x8'));var jayson=require(_0xe4e2('0x9'));var client=jayson['client'][_0xe4e2('0xa')]({'port':0x232a});config[_0xe4e2('0xb')]=_[_0xe4e2('0xc')](config[_0xe4e2('0xb')],{'host':_0xe4e2('0xd'),'port':0x18eb});var socket=require(_0xe4e2('0xe'))(new Redis(config[_0xe4e2('0xb')]));require(_0xe4e2('0xf'))['register'](socket);function respondWithRpcPromise(_0xd81011,_0x14fe0d,_0xa4df88){return new BPromise(function(_0x5b7889,_0x1954f8){return client[_0xe4e2('0x10')](_0xd81011,_0xa4df88)[_0xe4e2('0x11')](function(_0x107816){logger[_0xe4e2('0x12')]('MailMessage,\x20%s,\x20%s',_0x14fe0d,_0xe4e2('0x13'));logger[_0xe4e2('0x14')](_0xe4e2('0x15'),_0x14fe0d,_0xe4e2('0x13'),JSON['stringify'](_0x107816));if(_0x107816[_0xe4e2('0x16')]){if(_0x107816[_0xe4e2('0x16')][_0xe4e2('0x17')]===0x1f4){logger[_0xe4e2('0x16')](_0xe4e2('0x18'),_0x14fe0d,_0x107816['error']['message']);return _0x1954f8(_0x107816[_0xe4e2('0x16')][_0xe4e2('0x19')]);}logger[_0xe4e2('0x16')](_0xe4e2('0x18'),_0x14fe0d,_0x107816[_0xe4e2('0x16')]['message']);return _0x5b7889(_0x107816[_0xe4e2('0x16')][_0xe4e2('0x19')]);}else{logger[_0xe4e2('0x12')]('MailMessage,\x20%s,\x20%s',_0x14fe0d,_0xe4e2('0x13'));_0x5b7889(_0x107816['result'][_0xe4e2('0x19')]);}})[_0xe4e2('0x1a')](function(_0x7a47c3){logger[_0xe4e2('0x16')](_0xe4e2('0x18'),_0x14fe0d,_0x7a47c3);_0x1954f8(_0x7a47c3);});});}exports[_0xe4e2('0x1b')]=function(_0x339d00){var _0x3c4e90=this;return new Promise(function(_0x4769dd,_0x362741){return db['MailMessage'][_0xe4e2('0x1c')](_0x339d00[_0xe4e2('0x1d')],{'raw':_0x339d00[_0xe4e2('0x1e')]?_0x339d00[_0xe4e2('0x1e')][_0xe4e2('0x1f')]===undefined?!![]:![]:!![]})[_0xe4e2('0x11')](function(_0x16f14b){logger['info'](_0xe4e2('0x1b'),_0x339d00);logger[_0xe4e2('0x14')](_0xe4e2('0x1b'),_0x339d00,JSON['stringify'](_0x16f14b));_0x4769dd(_0x16f14b);})[_0xe4e2('0x1a')](function(_0x12ad33){logger['error'](_0xe4e2('0x1b'),_0x12ad33[_0xe4e2('0x19')],_0x339d00);_0x362741(_0x3c4e90[_0xe4e2('0x16')](0x1f4,_0x12ad33[_0xe4e2('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index df80426..650323b 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 _0x853d=['register','length','mailMessage:','./mailMessage.events','save','remove','removeListener'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x853d,0xd5));var _0xd853=function(_0x2ef7bc,_0x49bb0e){_0x2ef7bc=_0x2ef7bc-0x0;var _0x369e28=_0x853d[_0x2ef7bc];return _0x369e28;};'use strict';var MailMessageEvents=require(_0xd853('0x0'));var events=[_0xd853('0x1'),_0xd853('0x2'),'update'];function createListener(_0x4306d7,_0x5ca13d){return function(_0x2a4643){_0x5ca13d['emit'](_0x4306d7,_0x2a4643);};}function removeListener(_0x22d371,_0x40eca7){return function(){MailMessageEvents[_0xd853('0x3')](_0x22d371,_0x40eca7);};}exports[_0xd853('0x4')]=function(_0xa13f3c){for(var _0x22c1b9=0x0,_0x13442c=events[_0xd853('0x5')];_0x22c1b9<_0x13442c;_0x22c1b9++){var _0x3f9f22=events[_0x22c1b9];var _0x3e74bd=createListener(_0xd853('0x6')+_0x3f9f22,_0xa13f3c);MailMessageEvents['on'](_0x3f9f22,_0x3e74bd);}}; \ No newline at end of file +var _0xb642=['remove','register','length','mailMessage:','save'];(function(_0xfa4a79,_0x3fc1f2){var _0x6350eb=function(_0x55dc84){while(--_0x55dc84){_0xfa4a79['push'](_0xfa4a79['shift']());}};_0x6350eb(++_0x3fc1f2);}(_0xb642,0x15d));var _0x2b64=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0xb642[_0x23e7c1];return _0x1add43;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=[_0x2b64('0x0'),_0x2b64('0x1'),'update'];function createListener(_0x1c2fbf,_0x352a17){return function(_0x10fcd2){_0x352a17['emit'](_0x1c2fbf,_0x10fcd2);};}function removeListener(_0x510dcb,_0x43e208){return function(){MailMessageEvents['removeListener'](_0x510dcb,_0x43e208);};}exports[_0x2b64('0x2')]=function(_0x4331f0){for(var _0x4dedfc=0x0,_0x2305e3=events[_0x2b64('0x3')];_0x4dedfc<_0x2305e3;_0x4dedfc++){var _0x33dbbc=events[_0x4dedfc];var _0x4a0afd=createListener(_0x2b64('0x4')+_0x33dbbc,_0x4331f0);MailMessageEvents['on'](_0x33dbbc,_0x4a0afd);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index b04b0a9..ca78e75 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 _0xbdaf=['../../components/interaction/service','../../config/environment','./mailQueue.controller','isAuthenticated','index','get','describe','/:id','show','getMembers','/:id/teams','/:id/users','getAgents','post','addTeams','addAgents','put','update','delete','destroy','removeTeams','exports','util','express'];(function(_0x5296ca,_0x5c5c6e){var _0xf12fd=function(_0x34bda8){while(--_0x34bda8){_0x5296ca['push'](_0x5296ca['shift']());}};_0xf12fd(++_0x5c5c6e);}(_0xbdaf,0x1c6));var _0xfbda=function(_0x474bc0,_0x26989c){_0x474bc0=_0x474bc0-0x0;var _0x4b24cf=_0xbdaf[_0x474bc0];return _0x4b24cf;};'use strict';var multer=require('multer');var util=require(_0xfbda('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xfbda('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xfbda('0x2'));var config=require(_0xfbda('0x3'));var controller=require(_0xfbda('0x4'));router['get']('/',auth[_0xfbda('0x5')](),controller[_0xfbda('0x6')]);router[_0xfbda('0x7')]('/describe',auth[_0xfbda('0x5')](),controller[_0xfbda('0x8')]);router[_0xfbda('0x7')](_0xfbda('0x9'),auth['isAuthenticated'](),controller[_0xfbda('0xa')]);router['get']('/:id/members',auth[_0xfbda('0x5')](),controller[_0xfbda('0xb')]);router[_0xfbda('0x7')](_0xfbda('0xc'),auth[_0xfbda('0x5')](),controller['getTeams']);router[_0xfbda('0x7')](_0xfbda('0xd'),auth[_0xfbda('0x5')](),controller[_0xfbda('0xe')]);router['post']('/',auth[_0xfbda('0x5')](),controller['create']);router[_0xfbda('0xf')]('/:id/teams',auth['isAuthenticated'](),controller[_0xfbda('0x10')]);router[_0xfbda('0xf')](_0xfbda('0xd'),auth['isAuthenticated'](),controller[_0xfbda('0x11')]);router[_0xfbda('0x12')](_0xfbda('0x9'),auth['isAuthenticated'](),controller[_0xfbda('0x13')]);router[_0xfbda('0x14')]('/:id',auth[_0xfbda('0x5')](),controller[_0xfbda('0x15')]);router[_0xfbda('0x14')]('/:id/teams',auth[_0xfbda('0x5')](),controller[_0xfbda('0x16')]);router[_0xfbda('0x14')](_0xfbda('0xd'),auth[_0xfbda('0x5')](),controller['removeAgents']);module[_0xfbda('0x17')]=router; \ No newline at end of file +var _0x2b01=['../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','isAuthenticated','index','get','/describe','describe','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','update','destroy','delete','removeTeams','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x474c3b,_0x133d9f){var _0x2ef5bd=function(_0x41d669){while(--_0x41d669){_0x474c3b['push'](_0x474c3b['shift']());}};_0x2ef5bd(++_0x133d9f);}(_0x2b01,0x192));var _0x12b0=function(_0x3ae693,_0x2f7d80){_0x3ae693=_0x3ae693-0x0;var _0x522f58=_0x2b01[_0x3ae693];return _0x522f58;};'use strict';var multer=require(_0x12b0('0x0'));var util=require('util');var path=require(_0x12b0('0x1'));var timeout=require(_0x12b0('0x2'));var express=require(_0x12b0('0x3'));var router=express[_0x12b0('0x4')]();var fs_extra=require(_0x12b0('0x5'));var auth=require(_0x12b0('0x6'));var interaction=require(_0x12b0('0x7'));var config=require(_0x12b0('0x8'));var controller=require(_0x12b0('0x9'));router['get']('/',auth[_0x12b0('0xa')](),controller[_0x12b0('0xb')]);router[_0x12b0('0xc')](_0x12b0('0xd'),auth[_0x12b0('0xa')](),controller[_0x12b0('0xe')]);router[_0x12b0('0xc')]('/:id',auth[_0x12b0('0xa')](),controller[_0x12b0('0xf')]);router['get'](_0x12b0('0x10'),auth[_0x12b0('0xa')](),controller[_0x12b0('0x11')]);router['get'](_0x12b0('0x12'),auth['isAuthenticated'](),controller[_0x12b0('0x13')]);router['get'](_0x12b0('0x14'),auth['isAuthenticated'](),controller[_0x12b0('0x15')]);router[_0x12b0('0x16')]('/',auth['isAuthenticated'](),controller[_0x12b0('0x17')]);router[_0x12b0('0x16')](_0x12b0('0x12'),auth[_0x12b0('0xa')](),controller[_0x12b0('0x18')]);router[_0x12b0('0x16')](_0x12b0('0x14'),auth[_0x12b0('0xa')](),controller[_0x12b0('0x19')]);router[_0x12b0('0x1a')](_0x12b0('0x1b'),auth[_0x12b0('0xa')](),controller[_0x12b0('0x1c')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x12b0('0x1d')]);router[_0x12b0('0x1e')](_0x12b0('0x12'),auth[_0x12b0('0xa')](),controller[_0x12b0('0x1f')]);router[_0x12b0('0x1e')](_0x12b0('0x14'),auth[_0x12b0('0xa')](),controller[_0x12b0('0x20')]);module[_0x12b0('0x21')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 1e8e385..099b1f2 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 _0x3a98=['name','STRING','INTEGER','ENUM','rrmemory','beepall','sequelize','exports'];(function(_0x15105e,_0xef49b){var _0x4b5afb=function(_0x225037){while(--_0x225037){_0x15105e['push'](_0x15105e['shift']());}};_0x4b5afb(++_0xef49b);}(_0x3a98,0xae));var _0x83a9=function(_0x5e1b91,_0x236f17){_0x5e1b91=_0x5e1b91-0x0;var _0x59b52f=_0x3a98[_0x5e1b91];return _0x59b52f;};'use strict';var Sequelize=require(_0x83a9('0x0'));module[_0x83a9('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x83a9('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x83a9('0x3')]},'timeout':{'type':Sequelize[_0x83a9('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x83a9('0x5')](_0x83a9('0x6'),_0x83a9('0x7'),'roundrobin')}}; \ No newline at end of file +var _0x092c=['roundrobin','sequelize','exports','STRING','INTEGER','ENUM'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x092c,0x157));var _0xc092=function(_0x98a285,_0x223e76){_0x98a285=_0x98a285-0x0;var _0x18e244=_0x092c[_0x98a285];return _0x18e244;};'use strict';var Sequelize=require(_0xc092('0x0'));module[_0xc092('0x1')]={'name':{'type':Sequelize[_0xc092('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xc092('0x2')]},'timeout':{'type':Sequelize[_0xc092('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xc092('0x4')]('rrmemory','beepall',_0xc092('0x5'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 068c78b..6440dfd 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 _0xb7d5=['userMailQueue:remove','addAgents','omit','spread','isArray','getAgents','bluebird','util','../../components/parsers/qs','api','../../mysqldb','redis','socket.io-emitter','register','sendStatus','status','end','offset','undefined','count','set','Content-Range','json','then','get','MailQueues','destroy','error','stack','name','send','index','map','MailQueue','rawAttributes','fieldName','type','key','where','include','query','findAll','show','keys','filters','intersection','model','attributes','fields','includeAll','merge','options','find','catch','create','body','user','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','getMembers','UserMailQueue','length','hasOwnProperty','nolimit','limit','order','sort','User','findAndCountAll','UserId','agent','updatedAt','rows','%s/%s','SIP','findOne','Team','pick','filter','addTeams','ids','Agents','online','voicePause','sequelize','transaction','each','findOrCreate','emit','userMailQueue:save','tq.TeamId','from','team_has_mail_queues','user_has_teams','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','removeTeams','isEmpty','removeAgents','forEach'];(function(_0x2cfac6,_0x44cefe){var _0x474c57=function(_0x5bc746){while(--_0x5bc746){_0x2cfac6['push'](_0x2cfac6['shift']());}};_0x474c57(++_0x44cefe);}(_0xb7d5,0x162));var _0x5b7d=function(_0x545f02,_0x2239bb){_0x545f02=_0x545f02-0x0;var _0x230ea0=_0xb7d5[_0x545f02];return _0x230ea0;};'use strict';var BPromise=require(_0x5b7d('0x0'));var util=require(_0x5b7d('0x1'));var _=require('lodash');var squel=require('squel');var Redis=require('ioredis');var qs=require(_0x5b7d('0x2'));var logger=require('../../config/logger')(_0x5b7d('0x3'));var config=require('../../config/environment');var db=require(_0x5b7d('0x4'))['db'];config[_0x5b7d('0x5')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x5b7d('0x6'))(new Redis(config[_0x5b7d('0x5')]));require('./mailQueue.socket')[_0x5b7d('0x7')](socket);function respondWithStatusCode(_0x389777,_0x30d623){_0x30d623=_0x30d623||0xcc;return function(_0x5584b5){if(_0x5584b5){return _0x389777[_0x5b7d('0x8')](_0x30d623);}return _0x389777[_0x5b7d('0x9')](_0x30d623)[_0x5b7d('0xa')]();};}function respondWithResult(_0x5b135f,_0x27bf06){_0x27bf06=_0x27bf06||0xc8;return function(_0x47b463){if(_0x47b463){return _0x5b135f[_0x5b7d('0x9')](_0x27bf06)['json'](_0x47b463);}};}function respondWithFilteredResult(_0x2ed65e,_0x44ed7b){return function(_0x1e62ca){if(_0x1e62ca){var _0x32814a=typeof _0x44ed7b[_0x5b7d('0xb')]===_0x5b7d('0xc')&&typeof _0x44ed7b['limit']===_0x5b7d('0xc');var _0x1460b3=_0x1e62ca[_0x5b7d('0xd')];var _0xd5ec39=_0x32814a?0x0:_0x44ed7b[_0x5b7d('0xb')];var _0x307fc9=_0x32814a?_0x1e62ca[_0x5b7d('0xd')]:_0x44ed7b[_0x5b7d('0xb')]+_0x44ed7b['limit'];var _0x49a87f;if(_0x307fc9>=_0x1460b3){_0x307fc9=_0x1460b3;_0x49a87f=0xc8;}else{_0x49a87f=0xce;}_0x2ed65e['status'](_0x49a87f);return _0x2ed65e[_0x5b7d('0xe')](_0x5b7d('0xf'),_0xd5ec39+'-'+_0x307fc9+'/'+_0x1460b3)[_0x5b7d('0x10')](_0x1e62ca);}return null;};}function saveUpdates(_0x5a5214){return function(_0x50fbbf){if(_0x50fbbf){return _0x50fbbf['update'](_0x5a5214)[_0x5b7d('0x11')](function(_0x5f4011){return _0x5f4011;});}return null;};}function removeEntity(_0x3eb4f3){return function(_0xfb025b){if(_0xfb025b){return _0xfb025b['destroy']()[_0x5b7d('0x11')](function(){var _0x38eb4e=_0xfb025b[_0x5b7d('0x12')]({'plain':!![]});var _0x12b297=_0x5b7d('0x13');return db['UserProfileResource'][_0x5b7d('0x14')]({'where':{'type':_0x12b297,'resourceId':_0x38eb4e['id']}})[_0x5b7d('0x11')](function(){return _0xfb025b;});})[_0x5b7d('0x11')](function(){_0x3eb4f3[_0x5b7d('0x9')](0xcc)[_0x5b7d('0xa')]();});}};}function handleEntityNotFound(_0x2a0fb2){return function(_0x16cc59){if(!_0x16cc59){_0x2a0fb2[_0x5b7d('0x8')](0x194);}return _0x16cc59;};}function handleError(_0x5e1df7,_0x3214a1){_0x3214a1=_0x3214a1||0x1f4;return function(_0x1e16ea){logger[_0x5b7d('0x15')](_0x1e16ea[_0x5b7d('0x16')]);if(_0x1e16ea[_0x5b7d('0x17')]){delete _0x1e16ea['name'];}_0x5e1df7[_0x5b7d('0x9')](_0x3214a1)[_0x5b7d('0x18')](_0x1e16ea);};}exports[_0x5b7d('0x19')]=function(_0x348894,_0x43885e){var _0x481ca4={};var _0x575420={'count':0x0,'rows':[]};var _0x1099f1=_[_0x5b7d('0x1a')](db[_0x5b7d('0x1b')][_0x5b7d('0x1c')],function(_0x481878){return{'name':_0x481878[_0x5b7d('0x1d')],'type':_0x481878[_0x5b7d('0x1e')][_0x5b7d('0x1f')]};});_0x481ca4=qs['getOptions'](_0x1099f1,_0x348894);var _0x3ae3cf={'where':_0x481ca4[_0x5b7d('0x20')]};return db[_0x5b7d('0x1b')][_0x5b7d('0xd')](_0x3ae3cf)[_0x5b7d('0x11')](function(_0x275877){_0x575420[_0x5b7d('0xd')]=_0x275877;_0x481ca4[_0x5b7d('0x21')]=qs[_0x5b7d('0x21')](_0x348894[_0x5b7d('0x22')]);return db[_0x5b7d('0x1b')][_0x5b7d('0x23')](_0x481ca4);})['then'](function(_0x3a5659){_0x575420['rows']=_0x3a5659;return _0x575420;})[_0x5b7d('0x11')](respondWithFilteredResult(_0x43885e,_0x481ca4))['catch'](handleError(_0x43885e,null));};exports[_0x5b7d('0x24')]=function(_0x5b9ec3,_0x171abe){var _0x100dae={'raw':!![],'where':{'id':_0x5b9ec3['params']['id']}},_0x274652={};_0x274652['model']=_['keys'](db['MailQueue'][_0x5b7d('0x1c')]);_0x274652[_0x5b7d('0x22')]=_[_0x5b7d('0x25')](_0x5b9ec3['query']);_0x274652[_0x5b7d('0x26')]=_[_0x5b7d('0x27')](_0x274652[_0x5b7d('0x28')],_0x274652[_0x5b7d('0x22')]);_0x100dae[_0x5b7d('0x29')]=_['intersection'](_0x274652[_0x5b7d('0x28')],qs['fields'](_0x5b9ec3['query'][_0x5b7d('0x2a')]));_0x100dae[_0x5b7d('0x29')]=_0x100dae['attributes']['length']?_0x100dae[_0x5b7d('0x29')]:_0x274652[_0x5b7d('0x28')];if(_0x5b9ec3[_0x5b7d('0x22')][_0x5b7d('0x2b')]){_0x100dae[_0x5b7d('0x21')]=[{'all':!![]}];}_0x100dae=_[_0x5b7d('0x2c')]({},_0x100dae,_0x5b9ec3[_0x5b7d('0x2d')]);return db[_0x5b7d('0x1b')][_0x5b7d('0x2e')](_0x100dae)[_0x5b7d('0x11')](handleEntityNotFound(_0x171abe,null))['then'](respondWithResult(_0x171abe,null))[_0x5b7d('0x2f')](handleError(_0x171abe,null));};exports[_0x5b7d('0x30')]=function(_0x296df3,_0x46e06c){return db['MailQueue']['create'](_0x296df3[_0x5b7d('0x31')],{})[_0x5b7d('0x11')](function(_0x3caf4c){var _0x5a480d=_0x296df3[_0x5b7d('0x32')][_0x5b7d('0x12')]({'plain':!![]});if(!_0x5a480d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5a480d['role']===_0x5b7d('0x32')){var _0x5a5288=_0x3caf4c[_0x5b7d('0x12')]({'plain':!![]});var _0x113e13=_0x5b7d('0x13');return db[_0x5b7d('0x33')][_0x5b7d('0x2e')]({'where':{'name':_0x113e13,'userProfileId':_0x5a480d['userProfileId']},'raw':!![]})[_0x5b7d('0x11')](function(_0x5a5ca0){if(_0x5a5ca0&&_0x5a5ca0['autoAssociation']===0x0){return db[_0x5b7d('0x34')][_0x5b7d('0x30')]({'name':_0x5a5288[_0x5b7d('0x17')],'resourceId':_0x5a5288['id'],'type':_0x5a5ca0['name'],'sectionId':_0x5a5ca0['id']},{})[_0x5b7d('0x11')](function(){return _0x3caf4c;});}else{return _0x3caf4c;}})['catch'](function(_0x51e06c){logger['error'](_0x5b7d('0x35'),_0x51e06c);throw _0x51e06c;});}return _0x3caf4c;})['then'](respondWithResult(_0x46e06c,0xc9))[_0x5b7d('0x2f')](handleError(_0x46e06c,null));};exports[_0x5b7d('0x36')]=function(_0x18f9f1,_0x4b526f){if(_0x18f9f1[_0x5b7d('0x31')]['id']){delete _0x18f9f1[_0x5b7d('0x31')]['id'];}return db['MailQueue'][_0x5b7d('0x2e')]({'where':{'id':_0x18f9f1['params']['id']}})['then'](handleEntityNotFound(_0x4b526f,null))[_0x5b7d('0x11')](saveUpdates(_0x18f9f1[_0x5b7d('0x31')],null))['then'](respondWithResult(_0x4b526f,null))[_0x5b7d('0x2f')](handleError(_0x4b526f,null));};exports[_0x5b7d('0x14')]=function(_0x299f1e,_0x2f73c3){return db[_0x5b7d('0x1b')][_0x5b7d('0x2e')]({'where':{'id':_0x299f1e[_0x5b7d('0x37')]['id']}})[_0x5b7d('0x11')](handleEntityNotFound(_0x2f73c3,null))[_0x5b7d('0x11')](removeEntity(_0x2f73c3,null))[_0x5b7d('0x2f')](handleError(_0x2f73c3,null));};exports[_0x5b7d('0x38')]=function(_0x4c0e01,_0x7f546f){return db[_0x5b7d('0x1b')]['describe']()[_0x5b7d('0x11')](respondWithResult(_0x7f546f,null))['catch'](handleError(_0x7f546f,null));};exports[_0x5b7d('0x39')]=function(_0x7b5c26,_0x517667){var _0x10099b={'raw':!![],'where':{}},_0x3c3fa6={},_0x61c5a1;return db['MailQueue']['findOne']({'where':{'id':_0x7b5c26[_0x5b7d('0x37')]['id']}})[_0x5b7d('0x11')](handleEntityNotFound(_0x517667,null))[_0x5b7d('0x11')](function(_0x57067f){if(_0x57067f){_0x61c5a1=_0x57067f[_0x5b7d('0x12')]({'plain':!![]});_0x3c3fa6[_0x5b7d('0x28')]=_[_0x5b7d('0x25')](db[_0x5b7d('0x3a')][_0x5b7d('0x1c')]);_0x3c3fa6[_0x5b7d('0x22')]=_[_0x5b7d('0x25')](_0x7b5c26[_0x5b7d('0x22')]);_0x3c3fa6[_0x5b7d('0x26')]=_[_0x5b7d('0x27')](_0x3c3fa6[_0x5b7d('0x28')],_0x3c3fa6[_0x5b7d('0x22')]);_0x10099b[_0x5b7d('0x29')]=_[_0x5b7d('0x27')](_0x3c3fa6[_0x5b7d('0x28')],qs['fields'](_0x7b5c26['query'][_0x5b7d('0x2a')]));_0x10099b[_0x5b7d('0x29')]=_0x10099b[_0x5b7d('0x29')][_0x5b7d('0x3b')]?_0x10099b[_0x5b7d('0x29')]:_0x3c3fa6[_0x5b7d('0x28')];if(!_0x7b5c26[_0x5b7d('0x22')][_0x5b7d('0x3c')](_0x5b7d('0x3d'))){_0x10099b[_0x5b7d('0x3e')]=qs[_0x5b7d('0x3e')](_0x7b5c26[_0x5b7d('0x22')][_0x5b7d('0x3e')]);_0x10099b[_0x5b7d('0xb')]=qs[_0x5b7d('0xb')](_0x7b5c26['query'][_0x5b7d('0xb')]);}_0x10099b[_0x5b7d('0x3f')]=qs[_0x5b7d('0x40')](_0x7b5c26[_0x5b7d('0x22')][_0x5b7d('0x40')]);_0x10099b['where']=qs['filters'](_['pick'](_0x7b5c26['query'],_0x3c3fa6[_0x5b7d('0x26')]));_0x10099b[_0x5b7d('0x20')]['MailQueueId']=_0x57067f['id'];if(_0x7b5c26[_0x5b7d('0x22')]['filter']){_0x10099b[_0x5b7d('0x20')]=_[_0x5b7d('0x2c')](_0x10099b[_0x5b7d('0x20')],{'$or':_[_0x5b7d('0x1a')](_0x10099b[_0x5b7d('0x29')],function(_0x5d8d13){var _0x2db541={};_0x2db541[_0x5d8d13]={'$like':'%'+_0x7b5c26[_0x5b7d('0x22')]['filter']+'%'};return _0x2db541;})});}_0x10099b=_[_0x5b7d('0x2c')]({},_0x10099b,_0x7b5c26[_0x5b7d('0x2d')]);return db[_0x5b7d('0x3a')][_0x5b7d('0x23')](_0x10099b);}})['then'](function(_0x225f07){if(_0x225f07){return db[_0x5b7d('0x41')][_0x5b7d('0x42')]({'where':{'id':_['map'](_0x225f07,_0x5b7d('0x43')),'role':_0x5b7d('0x44')},'attributes':['id',_0x5b7d('0x17'),'mailPause',_0x5b7d('0x45'),'createdAt']});}})['then'](function(_0x4b57bf){if(_0x4b57bf){return{'count':_0x4b57bf[_0x5b7d('0xd')],'rows':_[_0x5b7d('0x1a')](_0x4b57bf[_0x5b7d('0x46')],function(_0x4493f8){return{'membername':_0x4493f8[_0x5b7d('0x17')],'UserId':_0x4493f8['id'],'queue_name':_0x61c5a1[_0x5b7d('0x17')],'MailQueueId':_0x61c5a1['id'],'interface':util['format'](_0x5b7d('0x47'),_0x5b7d('0x48'),_0x4493f8[_0x5b7d('0x17')]),'penalty':0x0,'paused':_0x4493f8['mailPause'],'createdAt':_0x4493f8['createdAt'],'updatedAt':_0x4493f8[_0x5b7d('0x45')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x5b7d('0x11')](respondWithFilteredResult(_0x517667,_0x10099b))[_0x5b7d('0x2f')](handleError(_0x517667,null));};exports['getTeams']=function(_0x4d9913,_0x1b2e57){var _0x4a9078={};var _0x36bcbd={};var _0xa76a6f;var _0x49f3a5;return db[_0x5b7d('0x1b')][_0x5b7d('0x49')]({'where':{'id':_0x4d9913['params']['id']}})[_0x5b7d('0x11')](handleEntityNotFound(_0x1b2e57,null))[_0x5b7d('0x11')](function(_0x38b5eb){if(_0x38b5eb){_0xa76a6f=_0x38b5eb;_0x36bcbd[_0x5b7d('0x28')]=_[_0x5b7d('0x25')](db[_0x5b7d('0x4a')][_0x5b7d('0x1c')]);_0x36bcbd[_0x5b7d('0x22')]=_[_0x5b7d('0x25')](_0x4d9913[_0x5b7d('0x22')]);_0x36bcbd['filters']=_[_0x5b7d('0x27')](_0x36bcbd[_0x5b7d('0x28')],_0x36bcbd[_0x5b7d('0x22')]);_0x4a9078['attributes']=_['intersection'](_0x36bcbd[_0x5b7d('0x28')],qs[_0x5b7d('0x2a')](_0x4d9913['query'][_0x5b7d('0x2a')]));_0x4a9078[_0x5b7d('0x29')]=_0x4a9078[_0x5b7d('0x29')]['length']?_0x4a9078['attributes']:_0x36bcbd[_0x5b7d('0x28')];_0x4a9078[_0x5b7d('0x3f')]=qs['sort'](_0x4d9913[_0x5b7d('0x22')][_0x5b7d('0x40')]);_0x4a9078[_0x5b7d('0x20')]=qs[_0x5b7d('0x26')](_[_0x5b7d('0x4b')](_0x4d9913[_0x5b7d('0x22')],_0x36bcbd[_0x5b7d('0x26')]));if(_0x4d9913[_0x5b7d('0x22')]['filter']){_0x4a9078[_0x5b7d('0x20')]=_[_0x5b7d('0x2c')](_0x4a9078[_0x5b7d('0x20')],{'$or':_[_0x5b7d('0x1a')](_0x4a9078[_0x5b7d('0x29')],function(_0x4fe28f){var _0x25232b={};_0x25232b[_0x4fe28f]={'$like':'%'+_0x4d9913[_0x5b7d('0x22')][_0x5b7d('0x4c')]+'%'};return _0x25232b;})});}_0x4a9078=_[_0x5b7d('0x2c')]({},_0x4a9078,_0x4d9913[_0x5b7d('0x2d')]);return _0xa76a6f['getTeams'](_0x4a9078);}})[_0x5b7d('0x11')](function(_0xa4d4d1){if(_0xa4d4d1){_0x49f3a5=_0xa4d4d1[_0x5b7d('0x3b')];if(!_0x4d9913[_0x5b7d('0x22')][_0x5b7d('0x3c')](_0x5b7d('0x3d'))){_0x4a9078[_0x5b7d('0x3e')]=qs['limit'](_0x4d9913[_0x5b7d('0x22')][_0x5b7d('0x3e')]);_0x4a9078[_0x5b7d('0xb')]=qs[_0x5b7d('0xb')](_0x4d9913['query']['offset']);}return _0xa76a6f['getTeams'](_0x4a9078);}})[_0x5b7d('0x11')](function(_0x5c5cf3){if(_0x5c5cf3){return _0x5c5cf3?{'count':_0x49f3a5,'rows':_0x5c5cf3}:null;}})[_0x5b7d('0x11')](respondWithResult(_0x1b2e57,null))[_0x5b7d('0x2f')](handleError(_0x1b2e57,null));};exports[_0x5b7d('0x4d')]=function(_0x1a2367,_0x18170f){var _0x24dd3b=_0x1a2367[_0x5b7d('0x31')][_0x5b7d('0x4e')];return db['Team']['findAll']({'where':{'id':_0x24dd3b},'attributes':['id'],'include':[{'model':db[_0x5b7d('0x41')],'as':_0x5b7d('0x4f'),'attributes':['id',_0x5b7d('0x17'),_0x5b7d('0x50'),_0x5b7d('0x51'),'interface'],'raw':!![]}]})[_0x5b7d('0x11')](function(_0x17b92e){if(_0x17b92e){var _0x924d3c=_['flatMap'](_0x17b92e,function(_0x1fe818){var _0x567fd6=_0x1fe818[_0x5b7d('0x12')]({'plain':!![]});return _0x567fd6['Agents'];});return db[_0x5b7d('0x1b')][_0x5b7d('0x2e')]({'where':{'id':_0x1a2367[_0x5b7d('0x37')]['id']}})[_0x5b7d('0x11')](function(_0x5e8f48){return db[_0x5b7d('0x52')][_0x5b7d('0x53')](function(_0x2d314c){return _0x5e8f48['addTeams'](_0x24dd3b,{'transaction':_0x2d314c})[_0x5b7d('0x11')](function(){return BPromise[_0x5b7d('0x54')](_0x924d3c,function(_0x445129){return db[_0x5b7d('0x3a')][_0x5b7d('0x55')]({'where':{'UserId':_0x445129['id'],'MailQueueId':_0x1a2367[_0x5b7d('0x37')]['id']},'transaction':_0x2d314c});});})['then'](function(){_0x924d3c['forEach'](function(_0xe5e976){socket[_0x5b7d('0x56')](_0x5b7d('0x57'),{'UserId':_0xe5e976['id'],'MailQueueId':_0x5e8f48['id']});});});});});}})[_0x5b7d('0x11')](respondWithStatusCode(_0x18170f,null))['catch'](handleError(_0x18170f,null));};exports['removeTeams']=function(_0x585c65,_0x5bafa1){return db['Team'][_0x5b7d('0x23')]({'where':{'id':_0x585c65['query'][_0x5b7d('0x4e')]},'attributes':['id'],'include':[{'model':db[_0x5b7d('0x41')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x5b7d('0x11')](handleEntityNotFound(_0x5bafa1,null))[_0x5b7d('0x11')](function(_0x1d7011){var _0x16fdc0=_['map'](_0x1d7011,'id');var _0x49fa73=[];var _0x5b7b75=[];var _0x2d3683=squel['select']();_0x2d3683['field'](_0x5b7d('0x58'))[_0x5b7d('0x59')](_0x5b7d('0x5a'),'tq')['join'](_0x5b7d('0x5b'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x5b7d('0x5c'),_0x585c65['params']['id']);for(var _0xa7593e=0x0;_0xa7593e<_0x1d7011[_0x5b7d('0x3b')];_0xa7593e+=0x1){let _0x10f2ef=_0x1d7011[_0xa7593e];for(var _0x478cb2=0x0;_0x478cb2<_0x10f2ef['Agents'][_0x5b7d('0x3b')];_0x478cb2+=0x1){let _0x143175=_0x10f2ef[_0x5b7d('0x4f')][_0x478cb2];var _0x4b108e=_0x2d3683[_0x5b7d('0x5d')]();_0x4b108e[_0x5b7d('0x20')](_0x5b7d('0x5e'),_0x143175['id']);_0x5b7b75[_0x5b7d('0x5f')](db[_0x5b7d('0x52')][_0x5b7d('0x22')](_0x4b108e[_0x5b7d('0x60')](),{'type':db[_0x5b7d('0x52')][_0x5b7d('0x61')][_0x5b7d('0x62')]})['then'](function(_0x4f793a){if(_0x4f793a[_0x5b7d('0x3b')]===0x1){return _0x143175['id'];}else{var _0xc3bca2=_[_0x5b7d('0x63')](_[_0x5b7d('0x1a')](_0x4f793a,_0x5b7d('0x64')),function(_0x26965f){return _[_0x5b7d('0x65')](_0x16fdc0,_0x26965f);});if(_0xc3bca2){return _0x143175['id'];}}}));}}return BPromise[_0x5b7d('0x66')](_0x5b7b75)['then'](function(_0x24422d){_0x49fa73=_(_0x49fa73)[_0x5b7d('0x67')](_0x24422d)[_0x5b7d('0x68')]()[_0x5b7d('0x69')]();return db[_0x5b7d('0x1b')][_0x5b7d('0x2e')]({'where':{'id':_0x585c65['params']['id']}})[_0x5b7d('0x11')](function(_0x31646d){return db[_0x5b7d('0x52')][_0x5b7d('0x53')](function(_0x33e150){return _0x31646d[_0x5b7d('0x6a')](_0x585c65[_0x5b7d('0x22')][_0x5b7d('0x4e')],{'transaction':_0x33e150})[_0x5b7d('0x11')](function(){if(!_[_0x5b7d('0x6b')](_0x49fa73)){return _0x31646d[_0x5b7d('0x6c')](_0x49fa73,{'transaction':_0x33e150});}})['then'](function(){_0x49fa73[_0x5b7d('0x6d')](function(_0x5eecf1){socket[_0x5b7d('0x56')](_0x5b7d('0x6e'),{'UserId':_0x5eecf1,'MailQueueId':_0x31646d['id']});});});});});});})[_0x5b7d('0x11')](respondWithStatusCode(_0x5bafa1,null))[_0x5b7d('0x2f')](handleError(_0x5bafa1,null));};exports['addAgents']=function(_0x474591,_0x347be0){return db['MailQueue'][_0x5b7d('0x2e')]({'where':{'id':_0x474591[_0x5b7d('0x37')]['id']}})[_0x5b7d('0x11')](handleEntityNotFound(_0x347be0,null))[_0x5b7d('0x11')](function(_0x18af9d){if(_0x18af9d){return _0x18af9d[_0x5b7d('0x6f')](_0x474591[_0x5b7d('0x31')][_0x5b7d('0x4e')],_[_0x5b7d('0x70')](_0x474591[_0x5b7d('0x31')],[_0x5b7d('0x4e'),'id'])||{})[_0x5b7d('0x71')](function(_0x3def67){for(var _0x409ae8=0x0;_0x409ae8<_0x474591['body'][_0x5b7d('0x4e')][_0x5b7d('0x3b')];_0x409ae8+=0x1){socket[_0x5b7d('0x56')](_0x5b7d('0x57'),{'UserId':Number(_0x474591[_0x5b7d('0x31')]['ids'][_0x409ae8]),'MailQueueId':Number(_0x474591['params']['id'])});}return _0x3def67;});}})[_0x5b7d('0x11')](respondWithResult(_0x347be0,null))[_0x5b7d('0x2f')](handleError(_0x347be0,null));};exports[_0x5b7d('0x6c')]=function(_0x4c47de,_0x5824ad){return db['MailQueue']['find']({'where':{'id':_0x4c47de[_0x5b7d('0x37')]['id']}})[_0x5b7d('0x11')](handleEntityNotFound(_0x5824ad,null))[_0x5b7d('0x11')](function(_0x3056c5){if(_0x3056c5){return _0x3056c5['removeAgents'](_0x4c47de[_0x5b7d('0x22')]['ids'])[_0x5b7d('0x11')](function(){if(_[_0x5b7d('0x72')](_0x4c47de[_0x5b7d('0x22')][_0x5b7d('0x4e')])){for(var _0x150d55=0x0;_0x150d55<_0x4c47de[_0x5b7d('0x22')][_0x5b7d('0x4e')][_0x5b7d('0x3b')];_0x150d55+=0x1){socket[_0x5b7d('0x56')](_0x5b7d('0x6e'),{'UserId':Number(_0x4c47de[_0x5b7d('0x22')][_0x5b7d('0x4e')][_0x150d55]),'MailQueueId':Number(_0x4c47de[_0x5b7d('0x37')]['id'])});}}else{socket[_0x5b7d('0x56')]('userMailQueue:remove',{'UserId':Number(_0x4c47de[_0x5b7d('0x22')][_0x5b7d('0x4e')]),'MailQueueId':Number(_0x4c47de['params']['id'])});}});}})[_0x5b7d('0x11')](respondWithStatusCode(_0x5824ad,null))[_0x5b7d('0x2f')](handleError(_0x5824ad,null));};exports[_0x5b7d('0x73')]=function(_0xdd3efb,_0x295ab5){var _0x1df25a={};var _0x279eec={};var _0x14bea6;var _0x49ff79;return db[_0x5b7d('0x1b')]['findOne']({'where':{'id':_0xdd3efb['params']['id']}})[_0x5b7d('0x11')](handleEntityNotFound(_0x295ab5,null))[_0x5b7d('0x11')](function(_0x35fdc2){if(_0x35fdc2){_0x14bea6=_0x35fdc2;_0x279eec[_0x5b7d('0x28')]=_[_0x5b7d('0x25')](db[_0x5b7d('0x41')][_0x5b7d('0x1c')]);_0x279eec['query']=_[_0x5b7d('0x25')](_0xdd3efb['query']);_0x279eec[_0x5b7d('0x26')]=_['intersection'](_0x279eec[_0x5b7d('0x28')],_0x279eec['query']);_0x1df25a[_0x5b7d('0x29')]=_[_0x5b7d('0x27')](_0x279eec['model'],qs['fields'](_0xdd3efb[_0x5b7d('0x22')][_0x5b7d('0x2a')]));_0x1df25a[_0x5b7d('0x29')]=_0x1df25a[_0x5b7d('0x29')][_0x5b7d('0x3b')]?_0x1df25a[_0x5b7d('0x29')]:_0x279eec[_0x5b7d('0x28')];_0x1df25a[_0x5b7d('0x3f')]=qs['sort'](_0xdd3efb[_0x5b7d('0x22')]['sort']);_0x1df25a[_0x5b7d('0x20')]=qs[_0x5b7d('0x26')](_['pick'](_0xdd3efb[_0x5b7d('0x22')],_0x279eec[_0x5b7d('0x26')]));if(_0xdd3efb['query'][_0x5b7d('0x4c')]){_0x1df25a[_0x5b7d('0x20')]=_[_0x5b7d('0x2c')](_0x1df25a[_0x5b7d('0x20')],{'$or':_[_0x5b7d('0x1a')](_0x1df25a[_0x5b7d('0x29')],function(_0x27a675){var _0x6caea7={};_0x6caea7[_0x27a675]={'$like':'%'+_0xdd3efb['query'][_0x5b7d('0x4c')]+'%'};return _0x6caea7;})});}_0x1df25a=_[_0x5b7d('0x2c')]({},_0x1df25a,_0xdd3efb[_0x5b7d('0x2d')]);return _0x14bea6[_0x5b7d('0x73')](_0x1df25a);}})['then'](function(_0x352b6b){if(_0x352b6b){_0x49ff79=_0x352b6b[_0x5b7d('0x3b')];if(!_0xdd3efb['query'][_0x5b7d('0x3c')]('nolimit')){_0x1df25a[_0x5b7d('0x3e')]=qs[_0x5b7d('0x3e')](_0xdd3efb[_0x5b7d('0x22')][_0x5b7d('0x3e')]);_0x1df25a['offset']=qs['offset'](_0xdd3efb[_0x5b7d('0x22')][_0x5b7d('0xb')]);}return _0x14bea6[_0x5b7d('0x73')](_0x1df25a);}})[_0x5b7d('0x11')](function(_0x195a03){if(_0x195a03){return _0x195a03?{'count':_0x49ff79,'rows':_0x195a03}:null;}})['then'](respondWithResult(_0x295ab5,null))[_0x5b7d('0x2f')](handleError(_0x295ab5,null));}; \ No newline at end of file +var _0x9062=['join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','union','compact','value','removeAgents','userMailQueue:remove','addAgents','omit','getAgents','bluebird','lodash','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./mailQueue.socket','register','end','status','offset','limit','undefined','count','set','json','then','destroy','UserProfileResource','sendStatus','error','stack','name','index','map','MailQueue','rawAttributes','key','getOptions','where','include','query','findAll','rows','catch','show','model','keys','filters','intersection','attributes','fields','length','includeAll','merge','options','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','MailQueues','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','getMembers','UserMailQueue','nolimit','order','sort','pick','filter','UserId','agent','mailPause','updatedAt','createdAt','format','SIP','Team','getTeams','hasOwnProperty','ids','User','Agents','online','interface','sequelize','transaction','addTeams','each','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','select','field','tq.TeamId','from'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0x9062,0x103));var _0x2906=function(_0xf7069,_0x3e72af){_0xf7069=_0xf7069-0x0;var _0x39ea9e=_0x9062[_0xf7069];return _0x39ea9e;};'use strict';var BPromise=require(_0x2906('0x0'));var util=require('util');var _=require(_0x2906('0x1'));var squel=require('squel');var Redis=require(_0x2906('0x2'));var qs=require(_0x2906('0x3'));var logger=require(_0x2906('0x4'))('api');var config=require(_0x2906('0x5'));var db=require(_0x2906('0x6'))['db'];config['redis']=_[_0x2906('0x7')](config[_0x2906('0x8')],{'host':_0x2906('0x9'),'port':0x18eb});var socket=require(_0x2906('0xa'))(new Redis(config['redis']));require(_0x2906('0xb'))[_0x2906('0xc')](socket);function respondWithStatusCode(_0x1a7f8f,_0x504b69){_0x504b69=_0x504b69||0xcc;return function(_0x2f6d02){if(_0x2f6d02){return _0x1a7f8f['sendStatus'](_0x504b69);}return _0x1a7f8f['status'](_0x504b69)[_0x2906('0xd')]();};}function respondWithResult(_0x10961b,_0x503fc2){_0x503fc2=_0x503fc2||0xc8;return function(_0x2d9daf){if(_0x2d9daf){return _0x10961b[_0x2906('0xe')](_0x503fc2)['json'](_0x2d9daf);}};}function respondWithFilteredResult(_0x1220da,_0x20b051){return function(_0x4593fe){if(_0x4593fe){var _0x5158b2=typeof _0x20b051[_0x2906('0xf')]==='undefined'&&typeof _0x20b051[_0x2906('0x10')]===_0x2906('0x11');var _0x451984=_0x4593fe[_0x2906('0x12')];var _0xb875a8=_0x5158b2?0x0:_0x20b051[_0x2906('0xf')];var _0x3a7df0=_0x5158b2?_0x4593fe[_0x2906('0x12')]:_0x20b051['offset']+_0x20b051[_0x2906('0x10')];var _0x58ed17;if(_0x3a7df0>=_0x451984){_0x3a7df0=_0x451984;_0x58ed17=0xc8;}else{_0x58ed17=0xce;}_0x1220da[_0x2906('0xe')](_0x58ed17);return _0x1220da[_0x2906('0x13')]('Content-Range',_0xb875a8+'-'+_0x3a7df0+'/'+_0x451984)[_0x2906('0x14')](_0x4593fe);}return null;};}function saveUpdates(_0x5f4aad){return function(_0x4dba59){if(_0x4dba59){return _0x4dba59['update'](_0x5f4aad)[_0x2906('0x15')](function(_0x5e20db){return _0x5e20db;});}return null;};}function removeEntity(_0x5c0c17){return function(_0x20d20a){if(_0x20d20a){return _0x20d20a[_0x2906('0x16')]()[_0x2906('0x15')](function(){var _0x19343a=_0x20d20a['get']({'plain':!![]});var _0x1a4c1e='MailQueues';return db[_0x2906('0x17')]['destroy']({'where':{'type':_0x1a4c1e,'resourceId':_0x19343a['id']}})[_0x2906('0x15')](function(){return _0x20d20a;});})['then'](function(){_0x5c0c17['status'](0xcc)[_0x2906('0xd')]();});}};}function handleEntityNotFound(_0xda3736){return function(_0x1b0343){if(!_0x1b0343){_0xda3736[_0x2906('0x18')](0x194);}return _0x1b0343;};}function handleError(_0x3265e5,_0x49e71a){_0x49e71a=_0x49e71a||0x1f4;return function(_0xd1bd45){logger[_0x2906('0x19')](_0xd1bd45[_0x2906('0x1a')]);if(_0xd1bd45['name']){delete _0xd1bd45[_0x2906('0x1b')];}_0x3265e5[_0x2906('0xe')](_0x49e71a)['send'](_0xd1bd45);};}exports[_0x2906('0x1c')]=function(_0x330b89,_0x2be809){var _0x2d4adb={};var _0x218762={'count':0x0,'rows':[]};var _0x45e06d=_[_0x2906('0x1d')](db[_0x2906('0x1e')][_0x2906('0x1f')],function(_0x129d1a){return{'name':_0x129d1a['fieldName'],'type':_0x129d1a['type'][_0x2906('0x20')]};});_0x2d4adb=qs[_0x2906('0x21')](_0x45e06d,_0x330b89);var _0x2f0236={'where':_0x2d4adb[_0x2906('0x22')]};return db[_0x2906('0x1e')][_0x2906('0x12')](_0x2f0236)[_0x2906('0x15')](function(_0x28ca26){_0x218762['count']=_0x28ca26;_0x2d4adb[_0x2906('0x23')]=qs[_0x2906('0x23')](_0x330b89[_0x2906('0x24')]);return db['MailQueue'][_0x2906('0x25')](_0x2d4adb);})['then'](function(_0x2fdb5a){_0x218762[_0x2906('0x26')]=_0x2fdb5a;return _0x218762;})[_0x2906('0x15')](respondWithFilteredResult(_0x2be809,_0x2d4adb))[_0x2906('0x27')](handleError(_0x2be809,null));};exports[_0x2906('0x28')]=function(_0x3a3c0a,_0x7c0e2a){var _0x18e44d={'raw':!![],'where':{'id':_0x3a3c0a['params']['id']}},_0x55ec11={};_0x55ec11[_0x2906('0x29')]=_[_0x2906('0x2a')](db['MailQueue'][_0x2906('0x1f')]);_0x55ec11[_0x2906('0x24')]=_[_0x2906('0x2a')](_0x3a3c0a['query']);_0x55ec11[_0x2906('0x2b')]=_[_0x2906('0x2c')](_0x55ec11[_0x2906('0x29')],_0x55ec11[_0x2906('0x24')]);_0x18e44d[_0x2906('0x2d')]=_[_0x2906('0x2c')](_0x55ec11[_0x2906('0x29')],qs[_0x2906('0x2e')](_0x3a3c0a[_0x2906('0x24')][_0x2906('0x2e')]));_0x18e44d[_0x2906('0x2d')]=_0x18e44d['attributes'][_0x2906('0x2f')]?_0x18e44d[_0x2906('0x2d')]:_0x55ec11[_0x2906('0x29')];if(_0x3a3c0a[_0x2906('0x24')][_0x2906('0x30')]){_0x18e44d[_0x2906('0x23')]=[{'all':!![]}];}_0x18e44d=_[_0x2906('0x31')]({},_0x18e44d,_0x3a3c0a[_0x2906('0x32')]);return db[_0x2906('0x1e')][_0x2906('0x33')](_0x18e44d)[_0x2906('0x15')](handleEntityNotFound(_0x7c0e2a,null))[_0x2906('0x15')](respondWithResult(_0x7c0e2a,null))[_0x2906('0x27')](handleError(_0x7c0e2a,null));};exports[_0x2906('0x34')]=function(_0x2bed89,_0x1bdae1){return db['MailQueue'][_0x2906('0x34')](_0x2bed89[_0x2906('0x35')],{})[_0x2906('0x15')](function(_0x3126b7){var _0x2c0162=_0x2bed89['user'][_0x2906('0x36')]({'plain':!![]});if(!_0x2c0162)throw new Error(_0x2906('0x37'));if(_0x2c0162['role']==='user'){var _0x5011cd=_0x3126b7[_0x2906('0x36')]({'plain':!![]});var _0x416fe0=_0x2906('0x38');return db[_0x2906('0x39')]['find']({'where':{'name':_0x416fe0,'userProfileId':_0x2c0162['userProfileId']},'raw':!![]})[_0x2906('0x15')](function(_0x179247){if(_0x179247&&_0x179247[_0x2906('0x3a')]===0x0){return db['UserProfileResource'][_0x2906('0x34')]({'name':_0x5011cd[_0x2906('0x1b')],'resourceId':_0x5011cd['id'],'type':_0x179247[_0x2906('0x1b')],'sectionId':_0x179247['id']},{})[_0x2906('0x15')](function(){return _0x3126b7;});}else{return _0x3126b7;}})[_0x2906('0x27')](function(_0x8f9f3c){logger['error'](_0x2906('0x3b'),_0x8f9f3c);throw _0x8f9f3c;});}return _0x3126b7;})[_0x2906('0x15')](respondWithResult(_0x1bdae1,0xc9))[_0x2906('0x27')](handleError(_0x1bdae1,null));};exports[_0x2906('0x3c')]=function(_0x48fb48,_0x3b8647){if(_0x48fb48[_0x2906('0x35')]['id']){delete _0x48fb48[_0x2906('0x35')]['id'];}return db['MailQueue']['find']({'where':{'id':_0x48fb48[_0x2906('0x3d')]['id']}})[_0x2906('0x15')](handleEntityNotFound(_0x3b8647,null))['then'](saveUpdates(_0x48fb48[_0x2906('0x35')],null))[_0x2906('0x15')](respondWithResult(_0x3b8647,null))[_0x2906('0x27')](handleError(_0x3b8647,null));};exports[_0x2906('0x16')]=function(_0x621a17,_0x4fa66c){return db[_0x2906('0x1e')][_0x2906('0x33')]({'where':{'id':_0x621a17[_0x2906('0x3d')]['id']}})[_0x2906('0x15')](handleEntityNotFound(_0x4fa66c,null))[_0x2906('0x15')](removeEntity(_0x4fa66c,null))[_0x2906('0x27')](handleError(_0x4fa66c,null));};exports[_0x2906('0x3e')]=function(_0x48572d,_0x1021b0){return db[_0x2906('0x1e')][_0x2906('0x3e')]()[_0x2906('0x15')](respondWithResult(_0x1021b0,null))[_0x2906('0x27')](handleError(_0x1021b0,null));};exports[_0x2906('0x3f')]=function(_0x227d12,_0x13a010){var _0x5c3436={'raw':!![],'where':{}},_0x28af88={},_0x5402ee;return db['MailQueue']['findOne']({'where':{'id':_0x227d12['params']['id']}})[_0x2906('0x15')](handleEntityNotFound(_0x13a010,null))['then'](function(_0x2a8ce9){if(_0x2a8ce9){_0x5402ee=_0x2a8ce9[_0x2906('0x36')]({'plain':!![]});_0x28af88[_0x2906('0x29')]=_[_0x2906('0x2a')](db[_0x2906('0x40')]['rawAttributes']);_0x28af88['query']=_[_0x2906('0x2a')](_0x227d12[_0x2906('0x24')]);_0x28af88[_0x2906('0x2b')]=_[_0x2906('0x2c')](_0x28af88[_0x2906('0x29')],_0x28af88[_0x2906('0x24')]);_0x5c3436['attributes']=_[_0x2906('0x2c')](_0x28af88['model'],qs[_0x2906('0x2e')](_0x227d12['query'][_0x2906('0x2e')]));_0x5c3436[_0x2906('0x2d')]=_0x5c3436[_0x2906('0x2d')][_0x2906('0x2f')]?_0x5c3436['attributes']:_0x28af88[_0x2906('0x29')];if(!_0x227d12['query']['hasOwnProperty'](_0x2906('0x41'))){_0x5c3436[_0x2906('0x10')]=qs['limit'](_0x227d12[_0x2906('0x24')][_0x2906('0x10')]);_0x5c3436['offset']=qs[_0x2906('0xf')](_0x227d12[_0x2906('0x24')]['offset']);}_0x5c3436[_0x2906('0x42')]=qs[_0x2906('0x43')](_0x227d12['query'][_0x2906('0x43')]);_0x5c3436['where']=qs['filters'](_[_0x2906('0x44')](_0x227d12['query'],_0x28af88['filters']));_0x5c3436[_0x2906('0x22')]['MailQueueId']=_0x2a8ce9['id'];if(_0x227d12['query'][_0x2906('0x45')]){_0x5c3436['where']=_[_0x2906('0x31')](_0x5c3436[_0x2906('0x22')],{'$or':_[_0x2906('0x1d')](_0x5c3436[_0x2906('0x2d')],function(_0x109179){var _0x264f20={};_0x264f20[_0x109179]={'$like':'%'+_0x227d12[_0x2906('0x24')][_0x2906('0x45')]+'%'};return _0x264f20;})});}_0x5c3436=_[_0x2906('0x31')]({},_0x5c3436,_0x227d12[_0x2906('0x32')]);return db[_0x2906('0x40')][_0x2906('0x25')](_0x5c3436);}})[_0x2906('0x15')](function(_0x241453){if(_0x241453){return db['User']['findAndCountAll']({'where':{'id':_[_0x2906('0x1d')](_0x241453,_0x2906('0x46')),'role':_0x2906('0x47')},'attributes':['id','name',_0x2906('0x48'),_0x2906('0x49'),_0x2906('0x4a')]});}})[_0x2906('0x15')](function(_0x3f3d22){if(_0x3f3d22){return{'count':_0x3f3d22['count'],'rows':_[_0x2906('0x1d')](_0x3f3d22['rows'],function(_0x5eb539){return{'membername':_0x5eb539['name'],'UserId':_0x5eb539['id'],'queue_name':_0x5402ee[_0x2906('0x1b')],'MailQueueId':_0x5402ee['id'],'interface':util[_0x2906('0x4b')]('%s/%s',_0x2906('0x4c'),_0x5eb539['name']),'penalty':0x0,'paused':_0x5eb539[_0x2906('0x48')],'createdAt':_0x5eb539['createdAt'],'updatedAt':_0x5eb539[_0x2906('0x49')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x2906('0x15')](respondWithFilteredResult(_0x13a010,_0x5c3436))[_0x2906('0x27')](handleError(_0x13a010,null));};exports['getTeams']=function(_0x415496,_0x40537f){var _0x87d401={};var _0x674f6={};var _0x2dbe1e;var _0x37b2f3;return db[_0x2906('0x1e')]['findOne']({'where':{'id':_0x415496[_0x2906('0x3d')]['id']}})[_0x2906('0x15')](handleEntityNotFound(_0x40537f,null))['then'](function(_0x38535e){if(_0x38535e){_0x2dbe1e=_0x38535e;_0x674f6[_0x2906('0x29')]=_[_0x2906('0x2a')](db[_0x2906('0x4d')][_0x2906('0x1f')]);_0x674f6[_0x2906('0x24')]=_[_0x2906('0x2a')](_0x415496[_0x2906('0x24')]);_0x674f6[_0x2906('0x2b')]=_[_0x2906('0x2c')](_0x674f6['model'],_0x674f6[_0x2906('0x24')]);_0x87d401[_0x2906('0x2d')]=_[_0x2906('0x2c')](_0x674f6[_0x2906('0x29')],qs[_0x2906('0x2e')](_0x415496['query'][_0x2906('0x2e')]));_0x87d401[_0x2906('0x2d')]=_0x87d401[_0x2906('0x2d')][_0x2906('0x2f')]?_0x87d401[_0x2906('0x2d')]:_0x674f6[_0x2906('0x29')];_0x87d401['order']=qs[_0x2906('0x43')](_0x415496[_0x2906('0x24')][_0x2906('0x43')]);_0x87d401['where']=qs[_0x2906('0x2b')](_[_0x2906('0x44')](_0x415496[_0x2906('0x24')],_0x674f6[_0x2906('0x2b')]));if(_0x415496[_0x2906('0x24')][_0x2906('0x45')]){_0x87d401[_0x2906('0x22')]=_[_0x2906('0x31')](_0x87d401['where'],{'$or':_[_0x2906('0x1d')](_0x87d401['attributes'],function(_0x344b7b){var _0x3f2f53={};_0x3f2f53[_0x344b7b]={'$like':'%'+_0x415496[_0x2906('0x24')][_0x2906('0x45')]+'%'};return _0x3f2f53;})});}_0x87d401=_[_0x2906('0x31')]({},_0x87d401,_0x415496[_0x2906('0x32')]);return _0x2dbe1e[_0x2906('0x4e')](_0x87d401);}})[_0x2906('0x15')](function(_0x18d8a1){if(_0x18d8a1){_0x37b2f3=_0x18d8a1[_0x2906('0x2f')];if(!_0x415496['query'][_0x2906('0x4f')](_0x2906('0x41'))){_0x87d401[_0x2906('0x10')]=qs['limit'](_0x415496[_0x2906('0x24')]['limit']);_0x87d401[_0x2906('0xf')]=qs[_0x2906('0xf')](_0x415496['query'][_0x2906('0xf')]);}return _0x2dbe1e[_0x2906('0x4e')](_0x87d401);}})['then'](function(_0x323814){if(_0x323814){return _0x323814?{'count':_0x37b2f3,'rows':_0x323814}:null;}})[_0x2906('0x15')](respondWithResult(_0x40537f,null))[_0x2906('0x27')](handleError(_0x40537f,null));};exports['addTeams']=function(_0x3e8422,_0x5d9e5b){var _0x357c26=_0x3e8422['body'][_0x2906('0x50')];return db[_0x2906('0x4d')][_0x2906('0x25')]({'where':{'id':_0x357c26},'attributes':['id'],'include':[{'model':db[_0x2906('0x51')],'as':_0x2906('0x52'),'attributes':['id',_0x2906('0x1b'),_0x2906('0x53'),'voicePause',_0x2906('0x54')],'raw':!![]}]})['then'](function(_0x38f314){if(_0x38f314){var _0x51ce65=_['flatMap'](_0x38f314,function(_0x118787){var _0x5e5df8=_0x118787[_0x2906('0x36')]({'plain':!![]});return _0x5e5df8[_0x2906('0x52')];});return db[_0x2906('0x1e')][_0x2906('0x33')]({'where':{'id':_0x3e8422[_0x2906('0x3d')]['id']}})[_0x2906('0x15')](function(_0x5f3874){return db[_0x2906('0x55')][_0x2906('0x56')](function(_0xbc73f7){return _0x5f3874[_0x2906('0x57')](_0x357c26,{'transaction':_0xbc73f7})['then'](function(){return BPromise[_0x2906('0x58')](_0x51ce65,function(_0x286ffb){return db[_0x2906('0x40')][_0x2906('0x59')]({'where':{'UserId':_0x286ffb['id'],'MailQueueId':_0x3e8422['params']['id']},'transaction':_0xbc73f7});});})['then'](function(){_0x51ce65[_0x2906('0x5a')](function(_0x28433b){socket[_0x2906('0x5b')](_0x2906('0x5c'),{'UserId':_0x28433b['id'],'MailQueueId':_0x5f3874['id']});});});});});}})[_0x2906('0x15')](respondWithStatusCode(_0x5d9e5b,null))[_0x2906('0x27')](handleError(_0x5d9e5b,null));};exports[_0x2906('0x5d')]=function(_0x19ff22,_0x4c3889){return db[_0x2906('0x4d')][_0x2906('0x25')]({'where':{'id':_0x19ff22['query'][_0x2906('0x50')]},'attributes':['id'],'include':[{'model':db[_0x2906('0x51')],'as':_0x2906('0x52'),'attributes':['id'],'raw':!![]}]})[_0x2906('0x15')](handleEntityNotFound(_0x4c3889,null))[_0x2906('0x15')](function(_0x2999c3){var _0x2be78f=_['map'](_0x2999c3,'id');var _0x5e74f7=[];var _0x489efe=[];var _0x5bd1e6=squel[_0x2906('0x5e')]();_0x5bd1e6[_0x2906('0x5f')](_0x2906('0x60'))[_0x2906('0x61')]('team_has_mail_queues','tq')[_0x2906('0x62')](_0x2906('0x63'),'ut',_0x2906('0x64'))[_0x2906('0x22')](_0x2906('0x65'),_0x19ff22[_0x2906('0x3d')]['id']);for(var _0x71a545=0x0;_0x71a545<_0x2999c3[_0x2906('0x2f')];_0x71a545+=0x1){let _0x37b7b1=_0x2999c3[_0x71a545];for(var _0x2b9078=0x0;_0x2b9078<_0x37b7b1[_0x2906('0x52')][_0x2906('0x2f')];_0x2b9078+=0x1){let _0x19369d=_0x37b7b1[_0x2906('0x52')][_0x2b9078];var _0x13620d=_0x5bd1e6[_0x2906('0x66')]();_0x13620d[_0x2906('0x22')](_0x2906('0x67'),_0x19369d['id']);_0x489efe[_0x2906('0x68')](db[_0x2906('0x55')][_0x2906('0x24')](_0x13620d[_0x2906('0x69')](),{'type':db[_0x2906('0x55')][_0x2906('0x6a')][_0x2906('0x6b')]})['then'](function(_0x1aee97){if(_0x1aee97[_0x2906('0x2f')]===0x1){return _0x19369d['id'];}else{var _0xf707af=_[_0x2906('0x6c')](_[_0x2906('0x1d')](_0x1aee97,_0x2906('0x6d')),function(_0x4a6b12){return _[_0x2906('0x6e')](_0x2be78f,_0x4a6b12);});if(_0xf707af){return _0x19369d['id'];}}}));}}return BPromise['all'](_0x489efe)[_0x2906('0x15')](function(_0x1350d8){_0x5e74f7=_(_0x5e74f7)[_0x2906('0x6f')](_0x1350d8)[_0x2906('0x70')]()[_0x2906('0x71')]();return db['MailQueue'][_0x2906('0x33')]({'where':{'id':_0x19ff22[_0x2906('0x3d')]['id']}})[_0x2906('0x15')](function(_0x3591e9){return db[_0x2906('0x55')][_0x2906('0x56')](function(_0x49c4b3){return _0x3591e9['removeTeams'](_0x19ff22['query'][_0x2906('0x50')],{'transaction':_0x49c4b3})[_0x2906('0x15')](function(){if(!_['isEmpty'](_0x5e74f7)){return _0x3591e9[_0x2906('0x72')](_0x5e74f7,{'transaction':_0x49c4b3});}})[_0x2906('0x15')](function(){_0x5e74f7['forEach'](function(_0x28f59d){socket[_0x2906('0x5b')](_0x2906('0x73'),{'UserId':_0x28f59d,'MailQueueId':_0x3591e9['id']});});});});});});})[_0x2906('0x15')](respondWithStatusCode(_0x4c3889,null))[_0x2906('0x27')](handleError(_0x4c3889,null));};exports[_0x2906('0x74')]=function(_0x55cdd4,_0x108185){return db['MailQueue']['find']({'where':{'id':_0x55cdd4[_0x2906('0x3d')]['id']}})[_0x2906('0x15')](handleEntityNotFound(_0x108185,null))[_0x2906('0x15')](function(_0x5c17fd){if(_0x5c17fd){return _0x5c17fd[_0x2906('0x74')](_0x55cdd4[_0x2906('0x35')][_0x2906('0x50')],_[_0x2906('0x75')](_0x55cdd4[_0x2906('0x35')],[_0x2906('0x50'),'id'])||{})['spread'](function(_0x56f848){for(var _0x38b580=0x0;_0x38b580<_0x55cdd4[_0x2906('0x35')][_0x2906('0x50')][_0x2906('0x2f')];_0x38b580+=0x1){socket['emit'](_0x2906('0x5c'),{'UserId':Number(_0x55cdd4['body'][_0x2906('0x50')][_0x38b580]),'MailQueueId':Number(_0x55cdd4['params']['id'])});}return _0x56f848;});}})[_0x2906('0x15')](respondWithResult(_0x108185,null))['catch'](handleError(_0x108185,null));};exports[_0x2906('0x72')]=function(_0x1b8e41,_0x452a81){return db[_0x2906('0x1e')][_0x2906('0x33')]({'where':{'id':_0x1b8e41[_0x2906('0x3d')]['id']}})[_0x2906('0x15')](handleEntityNotFound(_0x452a81,null))[_0x2906('0x15')](function(_0x138f97){if(_0x138f97){return _0x138f97[_0x2906('0x72')](_0x1b8e41[_0x2906('0x24')]['ids'])[_0x2906('0x15')](function(){if(_['isArray'](_0x1b8e41[_0x2906('0x24')][_0x2906('0x50')])){for(var _0xc8c88f=0x0;_0xc8c88f<_0x1b8e41[_0x2906('0x24')][_0x2906('0x50')][_0x2906('0x2f')];_0xc8c88f+=0x1){socket['emit']('userMailQueue:remove',{'UserId':Number(_0x1b8e41[_0x2906('0x24')]['ids'][_0xc8c88f]),'MailQueueId':Number(_0x1b8e41[_0x2906('0x3d')]['id'])});}}else{socket[_0x2906('0x5b')](_0x2906('0x73'),{'UserId':Number(_0x1b8e41['query'][_0x2906('0x50')]),'MailQueueId':Number(_0x1b8e41['params']['id'])});}});}})[_0x2906('0x15')](respondWithStatusCode(_0x452a81,null))[_0x2906('0x27')](handleError(_0x452a81,null));};exports[_0x2906('0x76')]=function(_0x5cab1a,_0x2951de){var _0x2b9a69={};var _0x2a1ee5={};var _0xe88a76;var _0x57767a;return db[_0x2906('0x1e')]['findOne']({'where':{'id':_0x5cab1a[_0x2906('0x3d')]['id']}})['then'](handleEntityNotFound(_0x2951de,null))['then'](function(_0x50d6c4){if(_0x50d6c4){_0xe88a76=_0x50d6c4;_0x2a1ee5['model']=_[_0x2906('0x2a')](db[_0x2906('0x51')][_0x2906('0x1f')]);_0x2a1ee5[_0x2906('0x24')]=_[_0x2906('0x2a')](_0x5cab1a['query']);_0x2a1ee5['filters']=_[_0x2906('0x2c')](_0x2a1ee5[_0x2906('0x29')],_0x2a1ee5[_0x2906('0x24')]);_0x2b9a69[_0x2906('0x2d')]=_[_0x2906('0x2c')](_0x2a1ee5[_0x2906('0x29')],qs[_0x2906('0x2e')](_0x5cab1a[_0x2906('0x24')][_0x2906('0x2e')]));_0x2b9a69['attributes']=_0x2b9a69[_0x2906('0x2d')][_0x2906('0x2f')]?_0x2b9a69[_0x2906('0x2d')]:_0x2a1ee5[_0x2906('0x29')];_0x2b9a69[_0x2906('0x42')]=qs[_0x2906('0x43')](_0x5cab1a[_0x2906('0x24')]['sort']);_0x2b9a69[_0x2906('0x22')]=qs[_0x2906('0x2b')](_[_0x2906('0x44')](_0x5cab1a[_0x2906('0x24')],_0x2a1ee5[_0x2906('0x2b')]));if(_0x5cab1a[_0x2906('0x24')][_0x2906('0x45')]){_0x2b9a69['where']=_['merge'](_0x2b9a69[_0x2906('0x22')],{'$or':_[_0x2906('0x1d')](_0x2b9a69[_0x2906('0x2d')],function(_0x5581cc){var _0x330112={};_0x330112[_0x5581cc]={'$like':'%'+_0x5cab1a['query'][_0x2906('0x45')]+'%'};return _0x330112;})});}_0x2b9a69=_['merge']({},_0x2b9a69,_0x5cab1a['options']);return _0xe88a76[_0x2906('0x76')](_0x2b9a69);}})['then'](function(_0x58cb08){if(_0x58cb08){_0x57767a=_0x58cb08[_0x2906('0x2f')];if(!_0x5cab1a[_0x2906('0x24')][_0x2906('0x4f')](_0x2906('0x41'))){_0x2b9a69[_0x2906('0x10')]=qs[_0x2906('0x10')](_0x5cab1a['query'][_0x2906('0x10')]);_0x2b9a69[_0x2906('0xf')]=qs[_0x2906('0xf')](_0x5cab1a[_0x2906('0x24')]['offset']);}return _0xe88a76[_0x2906('0x76')](_0x2b9a69);}})[_0x2906('0x15')](function(_0x33344d){if(_0x33344d){return _0x33344d?{'count':_0x57767a,'rows':_0x33344d}:null;}})[_0x2906('0x15')](respondWithResult(_0x2951de,null))[_0x2906('0x27')](handleError(_0x2951de,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 15d6947..729583b 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 _0x351a=['hasOwnProperty','exports','../../mysqldb','MailQueue','setMaxListeners','update','remove','emit'];(function(_0xc8a931,_0x260690){var _0x28bd27=function(_0x591b9f){while(--_0x591b9f){_0xc8a931['push'](_0xc8a931['shift']());}};_0x28bd27(++_0x260690);}(_0x351a,0x142));var _0xa351=function(_0x337688,_0x69444b){_0x337688=_0x337688-0x0;var _0x3424c5=_0x351a[_0x337688];return _0x3424c5;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0xa351('0x0'))['db'][_0xa351('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xa351('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa351('0x3'),'afterDestroy':_0xa351('0x4')};function emitEvent(_0x142569){return function(_0x5a60d0,_0x36b029,_0x5618da){MailQueueEvents[_0xa351('0x5')](_0x142569+':'+_0x5a60d0['id'],_0x5a60d0);MailQueueEvents['emit'](_0x142569,_0x5a60d0);_0x5618da(null);};}for(var e in events){if(events[_0xa351('0x6')](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0xa351('0x7')]=MailQueueEvents; \ No newline at end of file +var _0xdecf=['emit','hasOwnProperty','exports','events','../../mysqldb','MailQueue','setMaxListeners','save','remove'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xdecf,0xe4));var _0xfdec=function(_0x4a7f7c,_0x4fa8cc){_0x4a7f7c=_0x4a7f7c-0x0;var _0x2e75c3=_0xdecf[_0x4a7f7c];return _0x2e75c3;};'use strict';var EventEmitter=require(_0xfdec('0x0'));var MailQueue=require(_0xfdec('0x1'))['db'][_0xfdec('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xfdec('0x3')](0x0);var events={'afterCreate':_0xfdec('0x4'),'afterUpdate':'update','afterDestroy':_0xfdec('0x5')};function emitEvent(_0x217ce3){return function(_0x1617c5,_0x3b1535,_0x51e42a){MailQueueEvents[_0xfdec('0x6')](_0x217ce3+':'+_0x1617c5['id'],_0x1617c5);MailQueueEvents[_0xfdec('0x6')](_0x217ce3,_0x1617c5);_0x51e42a(null);};}for(var e in events){if(events[_0xfdec('0x7')](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0xfdec('0x8')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 3f7f091..fb6f6bc 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 _0xaa80=['bluebird','rimraf','../../config/environment','./mailQueue.attributes','define','MailQueue','util','../../config/logger','api'];(function(_0x1faaa1,_0x1568dd){var _0x994ec=function(_0x298ef4){while(--_0x298ef4){_0x1faaa1['push'](_0x1faaa1['shift']());}};_0x994ec(++_0x1568dd);}(_0xaa80,0x1e3));var _0x0aa8=function(_0x52c27d,_0xda4996){_0x52c27d=_0x52c27d-0x0;var _0x3e712a=_0xaa80[_0x52c27d];return _0x3e712a;};'use strict';var _=require('lodash');var util=require(_0x0aa8('0x0'));var logger=require(_0x0aa8('0x1'))(_0x0aa8('0x2'));var moment=require('moment');var BPromise=require(_0x0aa8('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0aa8('0x4'));var config=require(_0x0aa8('0x5'));var attributes=require(_0x0aa8('0x6'));module['exports']=function(_0x3b9d6a,_0x518fed){return _0x3b9d6a[_0x0aa8('0x7')](_0x0aa8('0x8'),attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xccc0=['./mailQueue.attributes','define','MailQueue','mail_queues','util','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x544be0,_0x148488){var _0x46ec0d=function(_0x16ca1f){while(--_0x16ca1f){_0x544be0['push'](_0x544be0['shift']());}};_0x46ec0d(++_0x148488);}(_0xccc0,0x1f3));var _0x0ccc=function(_0x107a8a,_0x4dd876){_0x107a8a=_0x107a8a-0x0;var _0x2dff6c=_0xccc0[_0x107a8a];return _0x2dff6c;};'use strict';var _=require('lodash');var util=require(_0x0ccc('0x0'));var logger=require('../../config/logger')(_0x0ccc('0x1'));var moment=require(_0x0ccc('0x2'));var BPromise=require(_0x0ccc('0x3'));var rp=require(_0x0ccc('0x4'));var fs=require('fs');var path=require(_0x0ccc('0x5'));var rimraf=require('rimraf');var config=require(_0x0ccc('0x6'));var attributes=require(_0x0ccc('0x7'));module['exports']=function(_0x4b63d2,_0x50b056){return _0x4b63d2[_0x0ccc('0x8')](_0x0ccc('0x9'),attributes,{'tableName':_0x0ccc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.rpc.js b/server/api/mailQueue/mailQueue.rpc.js index 015ef91..cd1be83 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 _0xea1a=['ShowMailQueue','find','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./mailQueue.socket','info','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','MailQueue,\x20%s,\x20%s','message','result','catch','GetMailQueue','MailQueue','findAll','options','raw','include','model','attributes','map','then'];(function(_0x1992f1,_0x5c61f0){var _0x413dfe=function(_0x2136e5){while(--_0x2136e5){_0x1992f1['push'](_0x1992f1['shift']());}};_0x413dfe(++_0x5c61f0);}(_0xea1a,0x158));var _0xaea1=function(_0xda15ae,_0x2b4990){_0xda15ae=_0xda15ae-0x0;var _0x50c1c0=_0xea1a[_0xda15ae];return _0x50c1c0;};'use strict';var _=require(_0xaea1('0x0'));var util=require(_0xaea1('0x1'));var moment=require(_0xaea1('0x2'));var BPromise=require(_0xaea1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaea1('0x4'));var db=require(_0xaea1('0x5'))['db'];var utils=require(_0xaea1('0x6'));var logger=require(_0xaea1('0x7'))(_0xaea1('0x8'));var config=require(_0xaea1('0x9'));var jayson=require(_0xaea1('0xa'));var client=jayson[_0xaea1('0xb')]['http']({'port':0x232a});config[_0xaea1('0xc')]=_[_0xaea1('0xd')](config[_0xaea1('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xaea1('0xe'))(new Redis(config['redis']));require(_0xaea1('0xf'))['register'](socket);function respondWithRpcPromise(_0x26fb87,_0x4de4c1,_0x5663f9){return new BPromise(function(_0x541e58,_0x443249){return client['request'](_0x26fb87,_0x5663f9)['then'](function(_0x18a725){logger[_0xaea1('0x10')]('MailQueue,\x20%s,\x20%s',_0x4de4c1,_0xaea1('0x11'));logger[_0xaea1('0x12')](_0xaea1('0x13'),_0x4de4c1,_0xaea1('0x11'),JSON[_0xaea1('0x14')](_0x18a725));if(_0x18a725[_0xaea1('0x15')]){if(_0x18a725[_0xaea1('0x15')]['code']===0x1f4){logger[_0xaea1('0x15')](_0xaea1('0x16'),_0x4de4c1,_0x18a725[_0xaea1('0x15')][_0xaea1('0x17')]);return _0x443249(_0x18a725[_0xaea1('0x15')][_0xaea1('0x17')]);}logger[_0xaea1('0x15')](_0xaea1('0x16'),_0x4de4c1,_0x18a725[_0xaea1('0x15')][_0xaea1('0x17')]);return _0x541e58(_0x18a725[_0xaea1('0x15')][_0xaea1('0x17')]);}else{logger[_0xaea1('0x10')](_0xaea1('0x16'),_0x4de4c1,_0xaea1('0x11'));_0x541e58(_0x18a725[_0xaea1('0x18')][_0xaea1('0x17')]);}})[_0xaea1('0x19')](function(_0x5b38af){logger[_0xaea1('0x15')]('MailQueue,\x20%s,\x20%s',_0x4de4c1,_0x5b38af);_0x443249(_0x5b38af);});});}exports[_0xaea1('0x1a')]=function(_0x2125cb){var _0x1b18d0=this;return new Promise(function(_0x448f36,_0x10fa19){return db[_0xaea1('0x1b')][_0xaea1('0x1c')]({'raw':_0x2125cb[_0xaea1('0x1d')]?_0x2125cb[_0xaea1('0x1d')][_0xaea1('0x1e')]===undefined?!![]:![]:!![],'where':_0x2125cb['options']?_0x2125cb[_0xaea1('0x1d')]['where']||null:null,'attributes':_0x2125cb['options']?_0x2125cb['options']['attributes']||null:null,'limit':_0x2125cb[_0xaea1('0x1d')]?_0x2125cb['options']['limit']||null:null,'include':_0x2125cb[_0xaea1('0x1d')]?_0x2125cb[_0xaea1('0x1d')][_0xaea1('0x1f')]?_['map'](_0x2125cb['options'][_0xaea1('0x1f')],function(_0x3a95cc){return{'model':db[_0x3a95cc[_0xaea1('0x20')]],'as':_0x3a95cc['as'],'attributes':_0x3a95cc[_0xaea1('0x21')],'include':_0x3a95cc[_0xaea1('0x1f')]?_['map'](_0x3a95cc[_0xaea1('0x1f')],function(_0x38e1bd){return{'model':db[_0x38e1bd[_0xaea1('0x20')]],'as':_0x38e1bd['as'],'attributes':_0x38e1bd[_0xaea1('0x21')],'include':_0x38e1bd[_0xaea1('0x1f')]?_[_0xaea1('0x22')](_0x38e1bd[_0xaea1('0x1f')],function(_0x5b5556){return{'model':db[_0x5b5556[_0xaea1('0x20')]],'as':_0x5b5556['as'],'attributes':_0x5b5556['attributes']};}):[]};}):[]};}):[]:[]})[_0xaea1('0x23')](function(_0x178e48){logger['info'](_0xaea1('0x1a'),_0x2125cb);logger[_0xaea1('0x12')]('GetMailQueue',_0x2125cb,JSON[_0xaea1('0x14')](_0x178e48));_0x448f36(_0x178e48);})['catch'](function(_0x5cad8b){logger['error'](_0xaea1('0x1a'),_0x5cad8b['message'],_0x2125cb);_0x10fa19(_0x1b18d0[_0xaea1('0x15')](0x1f4,_0x5cad8b['message']));});});};exports[_0xaea1('0x24')]=function(_0x5e0836){var _0x267037=this;return new Promise(function(_0x2852f8,_0x36e2d9){return db[_0xaea1('0x1b')][_0xaea1('0x25')]({'raw':_0x5e0836['options']?_0x5e0836[_0xaea1('0x1d')][_0xaea1('0x1e')]===undefined?!![]:![]:!![],'where':_0x5e0836[_0xaea1('0x1d')]?_0x5e0836[_0xaea1('0x1d')]['where']||null:null,'attributes':_0x5e0836[_0xaea1('0x1d')]?_0x5e0836[_0xaea1('0x1d')][_0xaea1('0x21')]||null:null,'include':_0x5e0836[_0xaea1('0x1d')]?_0x5e0836[_0xaea1('0x1d')][_0xaea1('0x1f')]?_[_0xaea1('0x22')](_0x5e0836[_0xaea1('0x1d')][_0xaea1('0x1f')],function(_0x1a4794){return{'model':db[_0x1a4794[_0xaea1('0x20')]],'as':_0x1a4794['as'],'attributes':_0x1a4794[_0xaea1('0x21')],'include':_0x1a4794[_0xaea1('0x1f')]?_[_0xaea1('0x22')](_0x1a4794['include'],function(_0x5a254e){return{'model':db[_0x5a254e['model']],'as':_0x5a254e['as'],'attributes':_0x5a254e[_0xaea1('0x21')],'include':_0x5a254e['include']?_[_0xaea1('0x22')](_0x5a254e[_0xaea1('0x1f')],function(_0x546e8f){return{'model':db[_0x546e8f[_0xaea1('0x20')]],'as':_0x546e8f['as'],'attributes':_0x546e8f[_0xaea1('0x21')]};}):[]};}):[]};}):[]:[]})[_0xaea1('0x23')](function(_0x217846){logger[_0xaea1('0x10')](_0xaea1('0x24'),_0x5e0836);logger[_0xaea1('0x12')](_0xaea1('0x24'),_0x5e0836,JSON['stringify'](_0x217846));_0x2852f8(_0x217846);})[_0xaea1('0x19')](function(_0x436300){logger[_0xaea1('0x15')](_0xaea1('0x24'),_0x436300[_0xaea1('0x17')],_0x5e0836);_0x36e2d9(_0x267037[_0xaea1('0x15')](0x1f4,_0x436300[_0xaea1('0x17')]));});});}; \ No newline at end of file +var _0x983a=['where','attributes','limit','include','map','model','then','GetMailQueue','find','ShowMailQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','./mailQueue.socket','register','request','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','MailQueue','options','raw'];(function(_0x32df68,_0x58b4a8){var _0x1163df=function(_0x1a2ac4){while(--_0x1a2ac4){_0x32df68['push'](_0x32df68['shift']());}};_0x1163df(++_0x58b4a8);}(_0x983a,0x100));var _0xa983=function(_0x3696ae,_0x4c462a){_0x3696ae=_0x3696ae-0x0;var _0x3d55c7=_0x983a[_0x3696ae];return _0x3d55c7;};'use strict';var _=require(_0xa983('0x0'));var util=require(_0xa983('0x1'));var moment=require(_0xa983('0x2'));var BPromise=require(_0xa983('0x3'));var rs=require(_0xa983('0x4'));var fs=require('fs');var Redis=require(_0xa983('0x5'));var db=require(_0xa983('0x6'))['db'];var utils=require(_0xa983('0x7'));var logger=require(_0xa983('0x8'))('rpc');var config=require(_0xa983('0x9'));var jayson=require(_0xa983('0xa'));var client=jayson[_0xa983('0xb')][_0xa983('0xc')]({'port':0x232a});config[_0xa983('0xd')]=_[_0xa983('0xe')](config[_0xa983('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa983('0xd')]));require(_0xa983('0xf'))[_0xa983('0x10')](socket);function respondWithRpcPromise(_0x1ceba6,_0x305651,_0x5b8832){return new BPromise(function(_0x2c0a2f,_0x10174b){return client[_0xa983('0x11')](_0x1ceba6,_0x5b8832)['then'](function(_0x14e08d){logger[_0xa983('0x12')](_0xa983('0x13'),_0x305651,_0xa983('0x14'));logger[_0xa983('0x15')]('MailQueue,\x20%s,\x20%s,\x20%s',_0x305651,_0xa983('0x14'),JSON[_0xa983('0x16')](_0x14e08d));if(_0x14e08d[_0xa983('0x17')]){if(_0x14e08d[_0xa983('0x17')][_0xa983('0x18')]===0x1f4){logger[_0xa983('0x17')](_0xa983('0x13'),_0x305651,_0x14e08d[_0xa983('0x17')][_0xa983('0x19')]);return _0x10174b(_0x14e08d[_0xa983('0x17')][_0xa983('0x19')]);}logger[_0xa983('0x17')](_0xa983('0x13'),_0x305651,_0x14e08d[_0xa983('0x17')]['message']);return _0x2c0a2f(_0x14e08d[_0xa983('0x17')][_0xa983('0x19')]);}else{logger[_0xa983('0x12')]('MailQueue,\x20%s,\x20%s',_0x305651,_0xa983('0x14'));_0x2c0a2f(_0x14e08d[_0xa983('0x1a')][_0xa983('0x19')]);}})[_0xa983('0x1b')](function(_0x26fab7){logger[_0xa983('0x17')](_0xa983('0x13'),_0x305651,_0x26fab7);_0x10174b(_0x26fab7);});});}exports['GetMailQueue']=function(_0x1e4da5){var _0x4e8be0=this;return new Promise(function(_0x4caf20,_0x470447){return db[_0xa983('0x1c')]['findAll']({'raw':_0x1e4da5['options']?_0x1e4da5[_0xa983('0x1d')][_0xa983('0x1e')]===undefined?!![]:![]:!![],'where':_0x1e4da5[_0xa983('0x1d')]?_0x1e4da5['options'][_0xa983('0x1f')]||null:null,'attributes':_0x1e4da5[_0xa983('0x1d')]?_0x1e4da5[_0xa983('0x1d')][_0xa983('0x20')]||null:null,'limit':_0x1e4da5['options']?_0x1e4da5['options'][_0xa983('0x21')]||null:null,'include':_0x1e4da5['options']?_0x1e4da5[_0xa983('0x1d')]['include']?_['map'](_0x1e4da5[_0xa983('0x1d')][_0xa983('0x22')],function(_0x2d80ef){return{'model':db[_0x2d80ef['model']],'as':_0x2d80ef['as'],'attributes':_0x2d80ef[_0xa983('0x20')],'include':_0x2d80ef[_0xa983('0x22')]?_[_0xa983('0x23')](_0x2d80ef[_0xa983('0x22')],function(_0x399f4b){return{'model':db[_0x399f4b['model']],'as':_0x399f4b['as'],'attributes':_0x399f4b['attributes'],'include':_0x399f4b[_0xa983('0x22')]?_[_0xa983('0x23')](_0x399f4b['include'],function(_0x55324c){return{'model':db[_0x55324c[_0xa983('0x24')]],'as':_0x55324c['as'],'attributes':_0x55324c['attributes']};}):[]};}):[]};}):[]:[]})[_0xa983('0x25')](function(_0x38e876){logger['info'](_0xa983('0x26'),_0x1e4da5);logger[_0xa983('0x15')]('GetMailQueue',_0x1e4da5,JSON[_0xa983('0x16')](_0x38e876));_0x4caf20(_0x38e876);})[_0xa983('0x1b')](function(_0x48eaa3){logger[_0xa983('0x17')](_0xa983('0x26'),_0x48eaa3[_0xa983('0x19')],_0x1e4da5);_0x470447(_0x4e8be0[_0xa983('0x17')](0x1f4,_0x48eaa3[_0xa983('0x19')]));});});};exports['ShowMailQueue']=function(_0x4982dc){var _0x2a2c5f=this;return new Promise(function(_0x9189a5,_0x177da4){return db[_0xa983('0x1c')][_0xa983('0x27')]({'raw':_0x4982dc[_0xa983('0x1d')]?_0x4982dc[_0xa983('0x1d')][_0xa983('0x1e')]===undefined?!![]:![]:!![],'where':_0x4982dc['options']?_0x4982dc['options'][_0xa983('0x1f')]||null:null,'attributes':_0x4982dc[_0xa983('0x1d')]?_0x4982dc[_0xa983('0x1d')]['attributes']||null:null,'include':_0x4982dc[_0xa983('0x1d')]?_0x4982dc[_0xa983('0x1d')]['include']?_[_0xa983('0x23')](_0x4982dc[_0xa983('0x1d')][_0xa983('0x22')],function(_0x19ac37){return{'model':db[_0x19ac37[_0xa983('0x24')]],'as':_0x19ac37['as'],'attributes':_0x19ac37[_0xa983('0x20')],'include':_0x19ac37[_0xa983('0x22')]?_['map'](_0x19ac37['include'],function(_0x2f8c4d){return{'model':db[_0x2f8c4d[_0xa983('0x24')]],'as':_0x2f8c4d['as'],'attributes':_0x2f8c4d['attributes'],'include':_0x2f8c4d[_0xa983('0x22')]?_[_0xa983('0x23')](_0x2f8c4d['include'],function(_0x559265){return{'model':db[_0x559265[_0xa983('0x24')]],'as':_0x559265['as'],'attributes':_0x559265[_0xa983('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x266eef){logger[_0xa983('0x12')]('ShowMailQueue',_0x4982dc);logger[_0xa983('0x15')]('ShowMailQueue',_0x4982dc,JSON[_0xa983('0x16')](_0x266eef));_0x9189a5(_0x266eef);})[_0xa983('0x1b')](function(_0x509e8b){logger['error'](_0xa983('0x28'),_0x509e8b[_0xa983('0x19')],_0x4982dc);_0x177da4(_0x2a2c5f[_0xa983('0x17')](0x1f4,_0x509e8b[_0xa983('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 0f40125..8c53742 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 _0x61f1=['emit','removeListener','register','length','mailQueue:','save','update'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x61f1,0xde));var _0x161f=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x61f1[_0xa464c9];return _0x3d73c4;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=[_0x161f('0x0'),'remove',_0x161f('0x1')];function createListener(_0x4d509b,_0x241188){return function(_0x102846){_0x241188[_0x161f('0x2')](_0x4d509b,_0x102846);};}function removeListener(_0x2c8d18,_0x1ef139){return function(){MailQueueEvents[_0x161f('0x3')](_0x2c8d18,_0x1ef139);};}exports[_0x161f('0x4')]=function(_0x10b7c7){for(var _0xd9ef96=0x0,_0x596bd9=events[_0x161f('0x5')];_0xd9ef96<_0x596bd9;_0xd9ef96++){var _0x19a931=events[_0xd9ef96];var _0x458e0=createListener(_0x161f('0x6')+_0x19a931,_0x10b7c7);MailQueueEvents['on'](_0x19a931,_0x458e0);}}; \ No newline at end of file +var _0x4742=['update','emit','removeListener','length','./mailQueue.events','save'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x4742,0x64));var _0x2474=function(_0x4888b0,_0x9532c6){_0x4888b0=_0x4888b0-0x0;var _0x1f469a=_0x4742[_0x4888b0];return _0x1f469a;};'use strict';var MailQueueEvents=require(_0x2474('0x0'));var events=[_0x2474('0x1'),'remove',_0x2474('0x2')];function createListener(_0x21ba66,_0x3ba170){return function(_0x25e096){_0x3ba170[_0x2474('0x3')](_0x21ba66,_0x25e096);};}function removeListener(_0x5b7106,_0x18357e){return function(){MailQueueEvents[_0x2474('0x4')](_0x5b7106,_0x18357e);};}exports['register']=function(_0xab2b22){for(var _0x175338=0x0,_0x52d7ec=events[_0x2474('0x5')];_0x175338<_0x52d7ec;_0x175338++){var _0x58b08b=events[_0x175338];var _0x2a387f=createListener('mailQueue:'+_0x58b08b,_0xab2b22);MailQueueEvents['on'](_0x58b08b,_0x2a387f);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 756c0e3..a626b1f 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 _0x625e=['./mailQueueReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','put','update','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2468ce,_0x132e13){var _0x252e02=function(_0x1365a6){while(--_0x1365a6){_0x2468ce['push'](_0x2468ce['shift']());}};_0x252e02(++_0x132e13);}(_0x625e,0x98));var _0xe625=function(_0xe501ff,_0x955b7e){_0xe501ff=_0xe501ff-0x0;var _0x17135d=_0x625e[_0xe501ff];return _0x17135d;};'use strict';var multer=require(_0xe625('0x0'));var util=require('util');var path=require(_0xe625('0x1'));var timeout=require(_0xe625('0x2'));var express=require(_0xe625('0x3'));var router=express[_0xe625('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe625('0x5'));var interaction=require(_0xe625('0x6'));var config=require(_0xe625('0x7'));var controller=require(_0xe625('0x8'));router[_0xe625('0x9')]('/',auth[_0xe625('0xa')](),controller['index']);router[_0xe625('0x9')](_0xe625('0xb'),auth[_0xe625('0xa')](),controller[_0xe625('0xc')]);router['get'](_0xe625('0xd'),auth[_0xe625('0xa')](),controller[_0xe625('0xe')]);router[_0xe625('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xe625('0x10')](_0xe625('0xd'),auth[_0xe625('0xa')](),controller[_0xe625('0x11')]);router['delete'](_0xe625('0xd'),auth['isAuthenticated'](),controller[_0xe625('0x12')]);module[_0xe625('0x13')]=router; \ No newline at end of file +var _0x6649=['./mailQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x6649,0x67));var _0x9664=function(_0xcb775b,_0x289ed3){_0xcb775b=_0xcb775b-0x0;var _0x9a3c44=_0x6649[_0xcb775b];return _0x9a3c44;};'use strict';var multer=require(_0x9664('0x0'));var util=require(_0x9664('0x1'));var path=require(_0x9664('0x2'));var timeout=require(_0x9664('0x3'));var express=require(_0x9664('0x4'));var router=express[_0x9664('0x5')]();var fs_extra=require(_0x9664('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9664('0x7'));router[_0x9664('0x8')]('/',auth[_0x9664('0x9')](),controller[_0x9664('0xa')]);router[_0x9664('0x8')](_0x9664('0xb'),auth['isAuthenticated'](),controller[_0x9664('0xc')]);router[_0x9664('0x8')](_0x9664('0xd'),auth['isAuthenticated'](),controller[_0x9664('0xe')]);router[_0x9664('0xf')]('/',auth[_0x9664('0x9')](),controller[_0x9664('0x10')]);router[_0x9664('0x11')](_0x9664('0xd'),auth[_0x9664('0x9')](),controller[_0x9664('0x12')]);router[_0x9664('0x13')](_0x9664('0xd'),auth[_0x9664('0x9')](),controller[_0x9664('0x14')]);module[_0x9664('0x15')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index dcd0e8f..5bcea8a 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 _0xf8d5=['sequelize','exports','STRING','DATE','moment'];(function(_0x3635ce,_0x33a6f9){var _0x97ecd0=function(_0x123d98){while(--_0x123d98){_0x3635ce['push'](_0x3635ce['shift']());}};_0x97ecd0(++_0x33a6f9);}(_0xf8d5,0xcc));var _0x5f8d=function(_0x294684,_0x1438ec){_0x294684=_0x294684-0x0;var _0x2c9b31=_0xf8d5[_0x294684];return _0x2c9b31;};'use strict';var moment=require(_0x5f8d('0x0'));var Sequelize=require(_0x5f8d('0x1'));module[_0x5f8d('0x2')]={'uniqueid':{'type':Sequelize[_0x5f8d('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x5f8d('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x5f8d('0x4')]},'exitAt':{'type':Sequelize[_0x5f8d('0x4')]},'reason':{'type':Sequelize[_0x5f8d('0x3')]}}; \ No newline at end of file +var _0x69eb=['sequelize','exports','STRING','DATE'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x69eb,0x188));var _0xb69e=function(_0x1ef49c,_0xf3c642){_0x1ef49c=_0x1ef49c-0x0;var _0x383f4d=_0x69eb[_0x1ef49c];return _0x383f4d;};'use strict';var moment=require('moment');var Sequelize=require(_0xb69e('0x0'));module[_0xb69e('0x1')]={'uniqueid':{'type':Sequelize[_0xb69e('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xb69e('0x2')]},'joinAt':{'type':Sequelize[_0xb69e('0x3')]},'leaveAt':{'type':Sequelize[_0xb69e('0x3')]},'acceptAt':{'type':Sequelize[_0xb69e('0x3')]},'exitAt':{'type':Sequelize[_0xb69e('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 388af46..a146983 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 _0x0598=['include','rows','catch','show','params','keys','rawAttributes','includeAll','find','create','body','describe','eml-format','rimraf','fast-json-patch','bluebird','mustache','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','sendStatus','status','json','undefined','limit','count','offset','set','apply','update','destroy','then','end','error','stack','name','index','map','MailQueueReport','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x0598,0x92));var _0x8059=function(_0x253690,_0x268339){_0x253690=_0x253690-0x0;var _0x5dfa99=_0x0598[_0x253690];return _0x5dfa99;};'use strict';var emlformat=require(_0x8059('0x0'));var rimraf=require(_0x8059('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8059('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8059('0x3'));var Mustache=require(_0x8059('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x8059('0x5'));var ejs=require(_0x8059('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8059('0x7'));var crypto=require(_0x8059('0x8'));var jsforce=require(_0x8059('0x9'));var deskjs=require(_0x8059('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8059('0xb'));var Redis=require(_0x8059('0xc'));var authService=require(_0x8059('0xd'));var qs=require(_0x8059('0xe'));var as=require(_0x8059('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8059('0x10'));var utils=require(_0x8059('0x11'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1ead10,_0x2d26e2){_0x2d26e2=_0x2d26e2||0xcc;return function(_0x306467){if(_0x306467){return _0x1ead10[_0x8059('0x12')](_0x2d26e2);}return _0x1ead10[_0x8059('0x13')](_0x2d26e2)['end']();};}function respondWithResult(_0x11218f,_0x5480a5){_0x5480a5=_0x5480a5||0xc8;return function(_0x346b23){if(_0x346b23){return _0x11218f['status'](_0x5480a5)[_0x8059('0x14')](_0x346b23);}};}function respondWithFilteredResult(_0x13bf07,_0x4810fd){return function(_0x4d3873){if(_0x4d3873){var _0x516c1f=typeof _0x4810fd['offset']===_0x8059('0x15')&&typeof _0x4810fd[_0x8059('0x16')]===_0x8059('0x15');var _0x246c9d=_0x4d3873[_0x8059('0x17')];var _0x4b6d55=_0x516c1f?0x0:_0x4810fd[_0x8059('0x18')];var _0x2bb670=_0x516c1f?_0x4d3873[_0x8059('0x17')]:_0x4810fd[_0x8059('0x18')]+_0x4810fd['limit'];var _0x5456a9;if(_0x2bb670>=_0x246c9d){_0x2bb670=_0x246c9d;_0x5456a9=0xc8;}else{_0x5456a9=0xce;}_0x13bf07['status'](_0x5456a9);return _0x13bf07[_0x8059('0x19')]('Content-Range',_0x4b6d55+'-'+_0x2bb670+'/'+_0x246c9d)[_0x8059('0x14')](_0x4d3873);}return null;};}function patchUpdates(_0x56d794){return function(_0x466a88){try{jsonpatch[_0x8059('0x1a')](_0x466a88,_0x56d794,!![]);}catch(_0x1e9ac5){return BPromise['reject'](_0x1e9ac5);}return _0x466a88['save']();};}function saveUpdates(_0x21a80f,_0x232f1b){return function(_0x32aeda){if(_0x32aeda){return _0x32aeda[_0x8059('0x1b')](_0x21a80f)['then'](function(_0x3bc226){return _0x3bc226;});}return null;};}function removeEntity(_0x21ac82,_0x3da080){return function(_0x5449d9){if(_0x5449d9){return _0x5449d9[_0x8059('0x1c')]()[_0x8059('0x1d')](function(){_0x21ac82[_0x8059('0x13')](0xcc)[_0x8059('0x1e')]();});}};}function handleEntityNotFound(_0x59d3a6,_0x140f64){return function(_0x2cd179){if(!_0x2cd179){_0x59d3a6[_0x8059('0x12')](0x194);}return _0x2cd179;};}function handleError(_0x3e2d2b,_0x202b30){_0x202b30=_0x202b30||0x1f4;return function(_0x54b88b){logger[_0x8059('0x1f')](_0x54b88b[_0x8059('0x20')]);if(_0x54b88b[_0x8059('0x21')]){delete _0x54b88b['name'];}_0x3e2d2b['status'](_0x202b30)['send'](_0x54b88b);};}exports[_0x8059('0x22')]=function(_0xbebe0e,_0xc32b1f){var _0x1009af={},_0x59abe9={},_0x1eb71b={'count':0x0,'rows':[]};var _0x50b737=_[_0x8059('0x23')](db[_0x8059('0x24')]['rawAttributes'],function(_0x3814f5){return{'name':_0x3814f5[_0x8059('0x25')],'type':_0x3814f5[_0x8059('0x26')][_0x8059('0x27')]};});_0x59abe9[_0x8059('0x28')]=_[_0x8059('0x23')](_0x50b737,_0x8059('0x21'));_0x59abe9[_0x8059('0x29')]=_['keys'](_0xbebe0e[_0x8059('0x29')]);_0x59abe9[_0x8059('0x2a')]=_[_0x8059('0x2b')](_0x59abe9[_0x8059('0x28')],_0x59abe9[_0x8059('0x29')]);_0x1009af['attributes']=_[_0x8059('0x2b')](_0x59abe9[_0x8059('0x28')],qs[_0x8059('0x2c')](_0xbebe0e[_0x8059('0x29')][_0x8059('0x2c')]));_0x1009af[_0x8059('0x2d')]=_0x1009af[_0x8059('0x2d')][_0x8059('0x2e')]?_0x1009af[_0x8059('0x2d')]:_0x59abe9[_0x8059('0x28')];if(!_0xbebe0e['query'][_0x8059('0x2f')]('nolimit')){_0x1009af[_0x8059('0x16')]=qs['limit'](_0xbebe0e['query'][_0x8059('0x16')]);_0x1009af['offset']=qs[_0x8059('0x18')](_0xbebe0e['query'][_0x8059('0x18')]);}_0x1009af['order']=qs[_0x8059('0x30')](_0xbebe0e[_0x8059('0x29')]['sort']);_0x1009af[_0x8059('0x31')]=qs[_0x8059('0x2a')](_[_0x8059('0x32')](_0xbebe0e['query'],_0x59abe9[_0x8059('0x2a')]),_0x50b737);if(_0xbebe0e['query'][_0x8059('0x33')]){_0x1009af['where']=_[_0x8059('0x34')](_0x1009af[_0x8059('0x31')],{'$or':_[_0x8059('0x23')](_0x50b737,function(_0xb3b3c1){if(_0xb3b3c1['type']!==_0x8059('0x35')){var _0x55aaec={};_0x55aaec[_0xb3b3c1['name']]={'$like':'%'+_0xbebe0e[_0x8059('0x29')][_0x8059('0x33')]+'%'};return _0x55aaec;}})});}_0x1009af=_[_0x8059('0x34')]({},_0x1009af,_0xbebe0e[_0x8059('0x36')]);var _0x2f68b0={'where':_0x1009af['where']};return db['MailQueueReport']['count'](_0x2f68b0)['then'](function(_0x373e10){_0x1eb71b[_0x8059('0x17')]=_0x373e10;if(_0xbebe0e[_0x8059('0x29')]['includeAll']){_0x1009af[_0x8059('0x37')]=[{'all':!![]}];}return db[_0x8059('0x24')]['findAll'](_0x1009af);})[_0x8059('0x1d')](function(_0x2980cb){_0x1eb71b[_0x8059('0x38')]=_0x2980cb;return _0x1eb71b;})['then'](respondWithFilteredResult(_0xc32b1f,_0x1009af))[_0x8059('0x39')](handleError(_0xc32b1f,null));};exports[_0x8059('0x3a')]=function(_0x57eb56,_0x338493){var _0x280047={'raw':!![],'where':{'id':_0x57eb56[_0x8059('0x3b')]['id']}},_0x3f00de={};_0x3f00de[_0x8059('0x28')]=_[_0x8059('0x3c')](db[_0x8059('0x24')][_0x8059('0x3d')]);_0x3f00de[_0x8059('0x29')]=_[_0x8059('0x3c')](_0x57eb56[_0x8059('0x29')]);_0x3f00de[_0x8059('0x2a')]=_[_0x8059('0x2b')](_0x3f00de[_0x8059('0x28')],_0x3f00de[_0x8059('0x29')]);_0x280047[_0x8059('0x2d')]=_[_0x8059('0x2b')](_0x3f00de[_0x8059('0x28')],qs[_0x8059('0x2c')](_0x57eb56[_0x8059('0x29')][_0x8059('0x2c')]));_0x280047[_0x8059('0x2d')]=_0x280047[_0x8059('0x2d')]['length']?_0x280047[_0x8059('0x2d')]:_0x3f00de['model'];if(_0x57eb56['query'][_0x8059('0x3e')]){_0x280047['include']=[{'all':!![]}];}_0x280047=_[_0x8059('0x34')]({},_0x280047,_0x57eb56['options']);return db[_0x8059('0x24')][_0x8059('0x3f')](_0x280047)[_0x8059('0x1d')](handleEntityNotFound(_0x338493,null))[_0x8059('0x1d')](respondWithResult(_0x338493,null))[_0x8059('0x39')](handleError(_0x338493,null));};exports[_0x8059('0x40')]=function(_0x538ab6,_0x301dca){return db['MailQueueReport'][_0x8059('0x40')](_0x538ab6[_0x8059('0x41')],{})[_0x8059('0x1d')](respondWithResult(_0x301dca,0xc9))['catch'](handleError(_0x301dca,null));};exports[_0x8059('0x1b')]=function(_0x120665,_0x46bec8){if(_0x120665[_0x8059('0x41')]['id']){delete _0x120665['body']['id'];}return db[_0x8059('0x24')][_0x8059('0x3f')]({'where':{'id':_0x120665[_0x8059('0x3b')]['id']}})['then'](handleEntityNotFound(_0x46bec8,null))[_0x8059('0x1d')](saveUpdates(_0x120665['body'],null))['then'](respondWithResult(_0x46bec8,null))[_0x8059('0x39')](handleError(_0x46bec8,null));};exports['destroy']=function(_0x20caa3,_0x54d2d2){return db[_0x8059('0x24')][_0x8059('0x3f')]({'where':{'id':_0x20caa3['params']['id']}})[_0x8059('0x1d')](handleEntityNotFound(_0x54d2d2,null))['then'](removeEntity(_0x54d2d2,null))[_0x8059('0x39')](handleError(_0x54d2d2,null));};exports[_0x8059('0x42')]=function(_0x429cf0,_0x5d5f16){return db[_0x8059('0x24')]['describe']()[_0x8059('0x1d')](respondWithResult(_0x5d5f16,null))[_0x8059('0x39')](handleError(_0x5d5f16,null));}; \ No newline at end of file +var _0xa456=['where','filters','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','params','keys','options','catch','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','sendStatus','status','end','undefined','count','offset','set','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','MailQueueReport','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','length','nolimit','limit','order','sort'];(function(_0x3a0863,_0x4cd5ef){var _0x85c557=function(_0x3011cb){while(--_0x3011cb){_0x3a0863['push'](_0x3a0863['shift']());}};_0x85c557(++_0x4cd5ef);}(_0xa456,0x142));var _0x6a45=function(_0x39e84d,_0x11931d){_0x39e84d=_0x39e84d-0x0;var _0x1991bc=_0xa456[_0x39e84d];return _0x1991bc;};'use strict';var emlformat=require(_0x6a45('0x0'));var rimraf=require(_0x6a45('0x1'));var zipdir=require(_0x6a45('0x2'));var jsonpatch=require(_0x6a45('0x3'));var rp=require('request-promise');var moment=require(_0x6a45('0x4'));var BPromise=require(_0x6a45('0x5'));var Mustache=require(_0x6a45('0x6'));var util=require('util');var path=require(_0x6a45('0x7'));var sox=require(_0x6a45('0x8'));var csv=require(_0x6a45('0x9'));var ejs=require(_0x6a45('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6a45('0xb'));var squel=require(_0x6a45('0xc'));var crypto=require(_0x6a45('0xd'));var jsforce=require(_0x6a45('0xe'));var deskjs=require(_0x6a45('0xf'));var toCsv=require('to-csv');var querystring=require(_0x6a45('0x10'));var Papa=require('papaparse');var Redis=require(_0x6a45('0x11'));var authService=require(_0x6a45('0x12'));var qs=require(_0x6a45('0x13'));var as=require(_0x6a45('0x14'));var hardwareService=require(_0x6a45('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x6a45('0x16'));var config=require(_0x6a45('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x511b92,_0x1aa4b4){_0x1aa4b4=_0x1aa4b4||0xcc;return function(_0x25a8b9){if(_0x25a8b9){return _0x511b92[_0x6a45('0x18')](_0x1aa4b4);}return _0x511b92[_0x6a45('0x19')](_0x1aa4b4)[_0x6a45('0x1a')]();};}function respondWithResult(_0x5a9f29,_0x563c3b){_0x563c3b=_0x563c3b||0xc8;return function(_0x3a5d94){if(_0x3a5d94){return _0x5a9f29[_0x6a45('0x19')](_0x563c3b)['json'](_0x3a5d94);}};}function respondWithFilteredResult(_0x2c20db,_0x171176){return function(_0x3fab82){if(_0x3fab82){var _0x13adc0=typeof _0x171176['offset']==='undefined'&&typeof _0x171176['limit']===_0x6a45('0x1b');var _0x391f81=_0x3fab82[_0x6a45('0x1c')];var _0x52a055=_0x13adc0?0x0:_0x171176[_0x6a45('0x1d')];var _0x102981=_0x13adc0?_0x3fab82[_0x6a45('0x1c')]:_0x171176['offset']+_0x171176['limit'];var _0x573453;if(_0x102981>=_0x391f81){_0x102981=_0x391f81;_0x573453=0xc8;}else{_0x573453=0xce;}_0x2c20db[_0x6a45('0x19')](_0x573453);return _0x2c20db[_0x6a45('0x1e')]('Content-Range',_0x52a055+'-'+_0x102981+'/'+_0x391f81)[_0x6a45('0x1f')](_0x3fab82);}return null;};}function patchUpdates(_0x1be485){return function(_0x4f7000){try{jsonpatch[_0x6a45('0x20')](_0x4f7000,_0x1be485,!![]);}catch(_0xdf10c6){return BPromise[_0x6a45('0x21')](_0xdf10c6);}return _0x4f7000[_0x6a45('0x22')]();};}function saveUpdates(_0x15ad0e,_0x487666){return function(_0x5d990e){if(_0x5d990e){return _0x5d990e[_0x6a45('0x23')](_0x15ad0e)[_0x6a45('0x24')](function(_0x11290c){return _0x11290c;});}return null;};}function removeEntity(_0x22373c,_0x25a380){return function(_0x3ad898){if(_0x3ad898){return _0x3ad898[_0x6a45('0x25')]()[_0x6a45('0x24')](function(){_0x22373c[_0x6a45('0x19')](0xcc)[_0x6a45('0x1a')]();});}};}function handleEntityNotFound(_0x1310d7,_0x46587a){return function(_0x5cd761){if(!_0x5cd761){_0x1310d7[_0x6a45('0x18')](0x194);}return _0x5cd761;};}function handleError(_0x5a0389,_0x1b83fa){_0x1b83fa=_0x1b83fa||0x1f4;return function(_0x25467d){logger[_0x6a45('0x26')](_0x25467d[_0x6a45('0x27')]);if(_0x25467d[_0x6a45('0x28')]){delete _0x25467d['name'];}_0x5a0389[_0x6a45('0x19')](_0x1b83fa)[_0x6a45('0x29')](_0x25467d);};}exports[_0x6a45('0x2a')]=function(_0x1ccff0,_0x8265d9){var _0x227b6f={},_0x3fac9b={},_0x313c13={'count':0x0,'rows':[]};var _0x54286d=_[_0x6a45('0x2b')](db[_0x6a45('0x2c')][_0x6a45('0x2d')],function(_0x201369){return{'name':_0x201369[_0x6a45('0x2e')],'type':_0x201369['type'][_0x6a45('0x2f')]};});_0x3fac9b[_0x6a45('0x30')]=_[_0x6a45('0x2b')](_0x54286d,_0x6a45('0x28'));_0x3fac9b['query']=_['keys'](_0x1ccff0[_0x6a45('0x31')]);_0x3fac9b['filters']=_[_0x6a45('0x32')](_0x3fac9b['model'],_0x3fac9b[_0x6a45('0x31')]);_0x227b6f[_0x6a45('0x33')]=_[_0x6a45('0x32')](_0x3fac9b[_0x6a45('0x30')],qs[_0x6a45('0x34')](_0x1ccff0[_0x6a45('0x31')][_0x6a45('0x34')]));_0x227b6f[_0x6a45('0x33')]=_0x227b6f[_0x6a45('0x33')][_0x6a45('0x35')]?_0x227b6f[_0x6a45('0x33')]:_0x3fac9b[_0x6a45('0x30')];if(!_0x1ccff0[_0x6a45('0x31')]['hasOwnProperty'](_0x6a45('0x36'))){_0x227b6f['limit']=qs[_0x6a45('0x37')](_0x1ccff0[_0x6a45('0x31')][_0x6a45('0x37')]);_0x227b6f[_0x6a45('0x1d')]=qs[_0x6a45('0x1d')](_0x1ccff0[_0x6a45('0x31')]['offset']);}_0x227b6f[_0x6a45('0x38')]=qs[_0x6a45('0x39')](_0x1ccff0[_0x6a45('0x31')][_0x6a45('0x39')]);_0x227b6f[_0x6a45('0x3a')]=qs[_0x6a45('0x3b')](_['pick'](_0x1ccff0[_0x6a45('0x31')],_0x3fac9b[_0x6a45('0x3b')]),_0x54286d);if(_0x1ccff0['query'][_0x6a45('0x3c')]){_0x227b6f[_0x6a45('0x3a')]=_[_0x6a45('0x3d')](_0x227b6f[_0x6a45('0x3a')],{'$or':_[_0x6a45('0x2b')](_0x54286d,function(_0x50ebe0){if(_0x50ebe0[_0x6a45('0x3e')]!==_0x6a45('0x3f')){var _0x205afd={};_0x205afd[_0x50ebe0[_0x6a45('0x28')]]={'$like':'%'+_0x1ccff0[_0x6a45('0x31')][_0x6a45('0x3c')]+'%'};return _0x205afd;}})});}_0x227b6f=_[_0x6a45('0x3d')]({},_0x227b6f,_0x1ccff0['options']);var _0x1c941a={'where':_0x227b6f['where']};return db[_0x6a45('0x2c')][_0x6a45('0x1c')](_0x1c941a)[_0x6a45('0x24')](function(_0x2715dc){_0x313c13['count']=_0x2715dc;if(_0x1ccff0['query'][_0x6a45('0x40')]){_0x227b6f[_0x6a45('0x41')]=[{'all':!![]}];}return db['MailQueueReport'][_0x6a45('0x42')](_0x227b6f);})[_0x6a45('0x24')](function(_0x3bd926){_0x313c13[_0x6a45('0x43')]=_0x3bd926;return _0x313c13;})['then'](respondWithFilteredResult(_0x8265d9,_0x227b6f))['catch'](handleError(_0x8265d9,null));};exports['show']=function(_0x5b9798,_0xe90201){var _0xb5d191={'raw':!![],'where':{'id':_0x5b9798[_0x6a45('0x44')]['id']}},_0x328d9f={};_0x328d9f[_0x6a45('0x30')]=_[_0x6a45('0x45')](db[_0x6a45('0x2c')][_0x6a45('0x2d')]);_0x328d9f['query']=_[_0x6a45('0x45')](_0x5b9798['query']);_0x328d9f['filters']=_[_0x6a45('0x32')](_0x328d9f[_0x6a45('0x30')],_0x328d9f['query']);_0xb5d191[_0x6a45('0x33')]=_['intersection'](_0x328d9f[_0x6a45('0x30')],qs[_0x6a45('0x34')](_0x5b9798[_0x6a45('0x31')][_0x6a45('0x34')]));_0xb5d191['attributes']=_0xb5d191[_0x6a45('0x33')][_0x6a45('0x35')]?_0xb5d191[_0x6a45('0x33')]:_0x328d9f[_0x6a45('0x30')];if(_0x5b9798[_0x6a45('0x31')]['includeAll']){_0xb5d191[_0x6a45('0x41')]=[{'all':!![]}];}_0xb5d191=_['merge']({},_0xb5d191,_0x5b9798[_0x6a45('0x46')]);return db[_0x6a45('0x2c')]['find'](_0xb5d191)[_0x6a45('0x24')](handleEntityNotFound(_0xe90201,null))[_0x6a45('0x24')](respondWithResult(_0xe90201,null))[_0x6a45('0x47')](handleError(_0xe90201,null));};exports[_0x6a45('0x48')]=function(_0x524296,_0x34bbb7){return db['MailQueueReport'][_0x6a45('0x48')](_0x524296['body'],{})[_0x6a45('0x24')](respondWithResult(_0x34bbb7,0xc9))[_0x6a45('0x47')](handleError(_0x34bbb7,null));};exports[_0x6a45('0x23')]=function(_0x2bf8d3,_0x5d9f52){if(_0x2bf8d3[_0x6a45('0x49')]['id']){delete _0x2bf8d3[_0x6a45('0x49')]['id'];}return db[_0x6a45('0x2c')][_0x6a45('0x4a')]({'where':{'id':_0x2bf8d3[_0x6a45('0x44')]['id']}})[_0x6a45('0x24')](handleEntityNotFound(_0x5d9f52,null))[_0x6a45('0x24')](saveUpdates(_0x2bf8d3[_0x6a45('0x49')],null))[_0x6a45('0x24')](respondWithResult(_0x5d9f52,null))[_0x6a45('0x47')](handleError(_0x5d9f52,null));};exports['destroy']=function(_0x3ea4a7,_0x8877c7){return db[_0x6a45('0x2c')][_0x6a45('0x4a')]({'where':{'id':_0x3ea4a7['params']['id']}})[_0x6a45('0x24')](handleEntityNotFound(_0x8877c7,null))[_0x6a45('0x24')](removeEntity(_0x8877c7,null))[_0x6a45('0x47')](handleError(_0x8877c7,null));};exports['describe']=function(_0x4e7967,_0x5a17b8){return db[_0x6a45('0x2c')][_0x6a45('0x4b')]()[_0x6a45('0x24')](respondWithResult(_0x5a17b8,null))[_0x6a45('0x47')](handleError(_0x5a17b8,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index fa24a4e..b4e63f4 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 _0xc571=['../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue','uniqueid','lodash','util','../../config/logger','api','moment','path','rimraf'];(function(_0x1d5cbd,_0x1bbfa7){var _0x3d2215=function(_0x286e5a){while(--_0x286e5a){_0x1d5cbd['push'](_0x1d5cbd['shift']());}};_0x3d2215(++_0x1bbfa7);}(_0xc571,0x149));var _0x1c57=function(_0x3ec122,_0x55150a){_0x3ec122=_0x3ec122-0x0;var _0x4ecf41=_0xc571[_0x3ec122];return _0x4ecf41;};'use strict';var _=require(_0x1c57('0x0'));var util=require(_0x1c57('0x1'));var logger=require(_0x1c57('0x2'))(_0x1c57('0x3'));var moment=require(_0x1c57('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1c57('0x5'));var rimraf=require(_0x1c57('0x6'));var config=require(_0x1c57('0x7'));var attributes=require(_0x1c57('0x8'));module[_0x1c57('0x9')]=function(_0xfcf4bc,_0x15494d){return _0xfcf4bc[_0x1c57('0xa')](_0x1c57('0xb'),attributes,{'tableName':_0x1c57('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x1c57('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb8bb=['moment','bluebird','path','rimraf','../../config/environment','./mailQueueReport.attributes','define','MailQueueReport','uniqueid','lodash','util','../../config/logger','api'];(function(_0x4af1c1,_0x4f351f){var _0x1a2087=function(_0x7bab51){while(--_0x7bab51){_0x4af1c1['push'](_0x4af1c1['shift']());}};_0x1a2087(++_0x4f351f);}(_0xb8bb,0x10d));var _0xbb8b=function(_0xe077a3,_0x5719b4){_0xe077a3=_0xe077a3-0x0;var _0xfec9f5=_0xb8bb[_0xe077a3];return _0xfec9f5;};'use strict';var _=require(_0xbb8b('0x0'));var util=require(_0xbb8b('0x1'));var logger=require(_0xbb8b('0x2'))(_0xbb8b('0x3'));var moment=require(_0xbb8b('0x4'));var BPromise=require(_0xbb8b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbb8b('0x6'));var rimraf=require(_0xbb8b('0x7'));var config=require(_0xbb8b('0x8'));var attributes=require(_0xbb8b('0x9'));module['exports']=function(_0x158f67,_0x2ac34b){return _0x158f67[_0xbb8b('0xa')](_0xbb8b('0xb'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0xbb8b('0xc'),'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 3fb7305..de878b8 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(_0x13fdb1,_0x1c6fba){var _0x55f710=function(_0x3b0f2b){while(--_0x3b0f2b){_0x13fdb1['push'](_0x13fdb1['shift']());}};_0x55f710(++_0x1c6fba);}(_0x2ef3,0xba));var _0x32ef=function(_0x20160a,_0x2b2207){_0x20160a=_0x20160a-0x0;var _0x1a0e88=_0x2ef3[_0x20160a];return _0x1a0e88;};'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 _0xdb28=['UpdateMailQueueReport','MailQueueReport','update','raw','where','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','CreateMailQueueReport','create','body','options'];(function(_0x520236,_0x5c8564){var _0x4d6664=function(_0x398c51){while(--_0x398c51){_0x520236['push'](_0x520236['shift']());}};_0x4d6664(++_0x5c8564);}(_0xdb28,0x106));var _0x8db2=function(_0xd1de80,_0x3288a2){_0xd1de80=_0xd1de80-0x0;var _0x35d917=_0xdb28[_0xd1de80];return _0x35d917;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});}exports[_0x8db2('0x16')]=function(_0x3fddc2){var _0x2efd06=this;return new Promise(function(_0x46ce14,_0x51d60d){return db['MailQueueReport'][_0x8db2('0x17')](_0x3fddc2[_0x8db2('0x18')],{'raw':_0x3fddc2[_0x8db2('0x19')]?_0x3fddc2[_0x8db2('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x8db2('0xc')](function(_0x36a9ff){logger[_0x8db2('0x14')](_0x8db2('0x16'),_0x3fddc2);logger[_0x8db2('0xf')]('CreateMailQueueReport',_0x3fddc2,JSON[_0x8db2('0x10')](_0x36a9ff));_0x46ce14(_0x36a9ff);})[_0x8db2('0x15')](function(_0x18f69c){logger[_0x8db2('0x11')](_0x8db2('0x16'),_0x18f69c[_0x8db2('0x13')],_0x3fddc2);_0x51d60d(_0x2efd06[_0x8db2('0x11')](0x1f4,_0x18f69c['message']));});});};exports[_0x8db2('0x1a')]=function(_0x4f6516){var _0x5725f0=this;return new Promise(function(_0x52a9ca,_0x4d923c){return db[_0x8db2('0x1b')][_0x8db2('0x1c')](_0x4f6516[_0x8db2('0x18')],{'raw':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f6516['options']?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1e')]||null:null,'attributes':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')]['attributes']||null:null,'limit':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1f')]||null:null})[_0x8db2('0xc')](function(_0xbe5ece){logger[_0x8db2('0x14')](_0x8db2('0x1a'),_0x4f6516);logger[_0x8db2('0xf')](_0x8db2('0x1a'),_0x4f6516,JSON['stringify'](_0xbe5ece));_0x52a9ca(_0xbe5ece);})[_0x8db2('0x15')](function(_0x50b28d){logger['error'](_0x8db2('0x1a'),_0x50b28d[_0x8db2('0x13')],_0x4f6516);_0x4d923c(_0x5725f0[_0x8db2('0x11')](0x1f4,_0x50b28d['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index d890099..af58d27 100644 --- a/server/api/mailServerIn/index.js +++ b/server/api/mailServerIn/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x406f00,_0x58080d){var _0x3c287d=function(_0x2a527d){while(--_0x2a527d){_0x406f00['push'](_0x406f00['shift']());}};_0x3c287d(++_0x58080d);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x65c50e,_0x1aa926){_0x65c50e=_0x65c50e-0x0;var _0x4573e7=_0xcb91[_0x65c50e];return _0x4573e7;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x53b934,_0x43fdfe){var _0x2ce3b5=function(_0x367902){while(--_0x367902){_0x53b934['push'](_0x53b934['shift']());}};_0x2ce3b5(++_0x43fdfe);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 6da7173..4ab2f97 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 _0xf084=['INTEGER','BOOLEAN','INBOX','sequelize','exports','STRING'];(function(_0xb87bc4,_0x860c01){var _0x2ae775=function(_0x219029){while(--_0x219029){_0xb87bc4['push'](_0xb87bc4['shift']());}};_0x2ae775(++_0x860c01);}(_0xf084,0x183));var _0x4f08=function(_0x3fa735,_0x494cf4){_0x3fa735=_0x3fa735-0x0;var _0x55ea57=_0xf084[_0x3fa735];return _0x55ea57;};'use strict';var Sequelize=require(_0x4f08('0x0'));module[_0x4f08('0x1')]={'description':{'type':Sequelize[_0x4f08('0x2')]},'host':{'type':Sequelize[_0x4f08('0x2')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize[_0x4f08('0x2')]},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x4f08('0x3')]},'tls':{'type':Sequelize[_0x4f08('0x4')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x4f08('0x2')],'defaultValue':_0x4f08('0x5')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0x4f08('0x2')]},'modernAuthentication':{'type':Sequelize[_0x4f08('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x92f3=['sequelize','exports','STRING','BOOLEAN','INBOX','INTEGER'];(function(_0x172133,_0x10246b){var _0x2460e5=function(_0x3c4918){while(--_0x3c4918){_0x172133['push'](_0x172133['shift']());}};_0x2460e5(++_0x10246b);}(_0x92f3,0xf0));var _0x392f=function(_0x5ec49a,_0x10c596){_0x5ec49a=_0x5ec49a-0x0;var _0x2d4fcf=_0x92f3[_0x5ec49a];return _0x2d4fcf;};'use strict';var Sequelize=require(_0x392f('0x0'));module[_0x392f('0x1')]={'description':{'type':Sequelize[_0x392f('0x2')]},'host':{'type':Sequelize[_0x392f('0x2')]},'authentication':{'type':Sequelize[_0x392f('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0x392f('0x2')]},'password':{'type':Sequelize[_0x392f('0x2')]},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize[_0x392f('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x392f('0x2')],'defaultValue':_0x392f('0x4')},'connTimeout':{'type':Sequelize[_0x392f('0x5')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x392f('0x5')],'defaultValue':0x5},'service':{'type':Sequelize[_0x392f('0x2')]},'modernAuthentication':{'type':Sequelize[_0x392f('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index b86bc07..f8c63e9 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 _0x2909=['exports','define','MailServerIn','mail_servers_in','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./mailServerIn.attributes'];(function(_0x74a9f5,_0x3922fd){var _0x6d5e09=function(_0x2eee81){while(--_0x2eee81){_0x74a9f5['push'](_0x74a9f5['shift']());}};_0x6d5e09(++_0x3922fd);}(_0x2909,0xc8));var _0x9290=function(_0x1c6215,_0x1f1496){_0x1c6215=_0x1c6215-0x0;var _0x1c5f7c=_0x2909[_0x1c6215];return _0x1c5f7c;};'use strict';var _=require(_0x9290('0x0'));var util=require(_0x9290('0x1'));var logger=require(_0x9290('0x2'))(_0x9290('0x3'));var moment=require(_0x9290('0x4'));var BPromise=require(_0x9290('0x5'));var rp=require(_0x9290('0x6'));var fs=require('fs');var path=require(_0x9290('0x7'));var rimraf=require('rimraf');var config=require(_0x9290('0x8'));var attributes=require(_0x9290('0x9'));module[_0x9290('0xa')]=function(_0xbbebe2,_0x5b59df){return _0xbbebe2[_0x9290('0xb')](_0x9290('0xc'),attributes,{'tableName':_0x9290('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x27c9=['moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','util','../../config/logger','api'];(function(_0x502302,_0x5eee2b){var _0x3816c3=function(_0xae7b6a){while(--_0xae7b6a){_0x502302['push'](_0x502302['shift']());}};_0x3816c3(++_0x5eee2b);}(_0x27c9,0xb1));var _0x927c=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x27c9[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require('lodash');var util=require(_0x927c('0x0'));var logger=require(_0x927c('0x1'))(_0x927c('0x2'));var moment=require(_0x927c('0x3'));var BPromise=require(_0x927c('0x4'));var rp=require(_0x927c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x927c('0x6'));var config=require(_0x927c('0x7'));var attributes=require('./mailServerIn.attributes');module[_0x927c('0x8')]=function(_0x4afcab,_0x4798cd){return _0x4afcab[_0x927c('0x9')]('MailServerIn',attributes,{'tableName':'mail_servers_in','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index 716e371..d7725fa 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 _0xc459=['jayson/promise','client','request','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetMailServerIn','findAll','options','where','attributes','limit','include','map','model','then','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x58ac0e,_0x3eca77){var _0x6b8bce=function(_0x1e17ae){while(--_0x1e17ae){_0x58ac0e['push'](_0x58ac0e['shift']());}};_0x6b8bce(++_0x3eca77);}(_0xc459,0x1d9));var _0x9c45=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc459[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x9c45('0x0'));var moment=require('moment');var BPromise=require(_0x9c45('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9c45('0x2'));var db=require(_0x9c45('0x3'))['db'];var utils=require(_0x9c45('0x4'));var logger=require(_0x9c45('0x5'))(_0x9c45('0x6'));var config=require('../../config/environment');var jayson=require(_0x9c45('0x7'));var client=jayson[_0x9c45('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x7189fc,_0x2d52c4,_0x587b23){return new BPromise(function(_0x2dd755,_0x4ab58f){return client[_0x9c45('0x9')](_0x7189fc,_0x587b23)['then'](function(_0x253be8){logger[_0x9c45('0xa')](_0x9c45('0xb'),_0x2d52c4,_0x9c45('0xc'));logger[_0x9c45('0xd')](_0x9c45('0xe'),_0x2d52c4,_0x9c45('0xc'),JSON[_0x9c45('0xf')](_0x253be8));if(_0x253be8[_0x9c45('0x10')]){if(_0x253be8[_0x9c45('0x10')][_0x9c45('0x11')]===0x1f4){logger[_0x9c45('0x10')]('MailServerIn,\x20%s,\x20%s',_0x2d52c4,_0x253be8[_0x9c45('0x10')][_0x9c45('0x12')]);return _0x4ab58f(_0x253be8[_0x9c45('0x10')][_0x9c45('0x12')]);}logger[_0x9c45('0x10')](_0x9c45('0xb'),_0x2d52c4,_0x253be8[_0x9c45('0x10')][_0x9c45('0x12')]);return _0x2dd755(_0x253be8[_0x9c45('0x10')][_0x9c45('0x12')]);}else{logger[_0x9c45('0xa')](_0x9c45('0xb'),_0x2d52c4,_0x9c45('0xc'));_0x2dd755(_0x253be8['result'][_0x9c45('0x12')]);}})['catch'](function(_0x22a821){logger[_0x9c45('0x10')]('MailServerIn,\x20%s,\x20%s',_0x2d52c4,_0x22a821);_0x4ab58f(_0x22a821);});});}exports[_0x9c45('0x13')]=function(_0xa2a45c){var _0x569fed=this;return new Promise(function(_0x5d5589,_0x1a343d){return db['MailServerIn'][_0x9c45('0x14')]({'raw':_0xa2a45c[_0x9c45('0x15')]?_0xa2a45c[_0x9c45('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0xa2a45c[_0x9c45('0x15')]?_0xa2a45c['options'][_0x9c45('0x16')]||null:null,'attributes':_0xa2a45c[_0x9c45('0x15')]?_0xa2a45c[_0x9c45('0x15')][_0x9c45('0x17')]||null:null,'limit':_0xa2a45c[_0x9c45('0x15')]?_0xa2a45c[_0x9c45('0x15')][_0x9c45('0x18')]||null:null,'include':_0xa2a45c[_0x9c45('0x15')]?_0xa2a45c[_0x9c45('0x15')][_0x9c45('0x19')]?_[_0x9c45('0x1a')](_0xa2a45c[_0x9c45('0x15')][_0x9c45('0x19')],function(_0x4971e9){return{'model':db[_0x4971e9[_0x9c45('0x1b')]],'as':_0x4971e9['as'],'attributes':_0x4971e9[_0x9c45('0x17')],'include':_0x4971e9[_0x9c45('0x19')]?_['map'](_0x4971e9[_0x9c45('0x19')],function(_0x388943){return{'model':db[_0x388943[_0x9c45('0x1b')]],'as':_0x388943['as'],'attributes':_0x388943['attributes'],'include':_0x388943[_0x9c45('0x19')]?_[_0x9c45('0x1a')](_0x388943[_0x9c45('0x19')],function(_0x26ba1c){return{'model':db[_0x26ba1c[_0x9c45('0x1b')]],'as':_0x26ba1c['as'],'attributes':_0x26ba1c[_0x9c45('0x17')]};}):[]};}):[]};}):[]:[]})[_0x9c45('0x1c')](function(_0x5205c2){logger[_0x9c45('0xa')](_0x9c45('0x13'),_0xa2a45c);logger['debug'](_0x9c45('0x13'),_0xa2a45c,JSON[_0x9c45('0xf')](_0x5205c2));_0x5d5589(_0x5205c2);})[_0x9c45('0x1d')](function(_0x1d1ad1){logger[_0x9c45('0x10')](_0x9c45('0x13'),_0x1d1ad1[_0x9c45('0x12')],_0xa2a45c);_0x1a343d(_0x569fed[_0x9c45('0x10')](0x1f4,_0x1d1ad1[_0x9c45('0x12')]));});});}; \ No newline at end of file +var _0x4cdd=['stringify','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','info','MailServerIn,\x20%s,\x20%s','debug','MailServerIn,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','catch','MailServerIn','options','raw','attributes','limit','include','map','model','GetMailServerIn'];(function(_0x27f204,_0x2214fa){var _0x2f409c=function(_0x1345eb){while(--_0x1345eb){_0x27f204['push'](_0x27f204['shift']());}};_0x2f409c(++_0x2214fa);}(_0x4cdd,0x1a5));var _0xd4cd=function(_0x3a4164,_0x53c0fe){_0x3a4164=_0x3a4164-0x0;var _0x568bea=_0x4cdd[_0x3a4164];return _0x568bea;};'use strict';var _=require(_0xd4cd('0x0'));var util=require(_0xd4cd('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd4cd('0x2'));var fs=require('fs');var Redis=require(_0xd4cd('0x3'));var db=require(_0xd4cd('0x4'))['db'];var utils=require(_0xd4cd('0x5'));var logger=require(_0xd4cd('0x6'))(_0xd4cd('0x7'));var config=require(_0xd4cd('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3c3065,_0x4f4739,_0x24db75){return new BPromise(function(_0x4a0e74,_0x168dc1){return client[_0xd4cd('0x9')](_0x3c3065,_0x24db75)[_0xd4cd('0xa')](function(_0x456c40){logger[_0xd4cd('0xb')](_0xd4cd('0xc'),_0x4f4739,'request\x20sent');logger[_0xd4cd('0xd')](_0xd4cd('0xe'),_0x4f4739,_0xd4cd('0xf'),JSON['stringify'](_0x456c40));if(_0x456c40['error']){if(_0x456c40['error'][_0xd4cd('0x10')]===0x1f4){logger[_0xd4cd('0x11')]('MailServerIn,\x20%s,\x20%s',_0x4f4739,_0x456c40['error'][_0xd4cd('0x12')]);return _0x168dc1(_0x456c40[_0xd4cd('0x11')]['message']);}logger['error']('MailServerIn,\x20%s,\x20%s',_0x4f4739,_0x456c40[_0xd4cd('0x11')][_0xd4cd('0x12')]);return _0x4a0e74(_0x456c40['error']['message']);}else{logger['info'](_0xd4cd('0xc'),_0x4f4739,'request\x20sent');_0x4a0e74(_0x456c40['result'][_0xd4cd('0x12')]);}})[_0xd4cd('0x13')](function(_0x346760){logger[_0xd4cd('0x11')](_0xd4cd('0xc'),_0x4f4739,_0x346760);_0x168dc1(_0x346760);});});}exports['GetMailServerIn']=function(_0x3062e6){var _0x3888fe=this;return new Promise(function(_0x4eea06,_0x3e0a87){return db[_0xd4cd('0x14')]['findAll']({'raw':_0x3062e6[_0xd4cd('0x15')]?_0x3062e6[_0xd4cd('0x15')][_0xd4cd('0x16')]===undefined?!![]:![]:!![],'where':_0x3062e6[_0xd4cd('0x15')]?_0x3062e6[_0xd4cd('0x15')]['where']||null:null,'attributes':_0x3062e6['options']?_0x3062e6[_0xd4cd('0x15')][_0xd4cd('0x17')]||null:null,'limit':_0x3062e6[_0xd4cd('0x15')]?_0x3062e6[_0xd4cd('0x15')][_0xd4cd('0x18')]||null:null,'include':_0x3062e6[_0xd4cd('0x15')]?_0x3062e6['options'][_0xd4cd('0x19')]?_[_0xd4cd('0x1a')](_0x3062e6['options'][_0xd4cd('0x19')],function(_0x2e2dbf){return{'model':db[_0x2e2dbf['model']],'as':_0x2e2dbf['as'],'attributes':_0x2e2dbf[_0xd4cd('0x17')],'include':_0x2e2dbf['include']?_['map'](_0x2e2dbf[_0xd4cd('0x19')],function(_0x27bbe8){return{'model':db[_0x27bbe8[_0xd4cd('0x1b')]],'as':_0x27bbe8['as'],'attributes':_0x27bbe8[_0xd4cd('0x17')],'include':_0x27bbe8[_0xd4cd('0x19')]?_[_0xd4cd('0x1a')](_0x27bbe8[_0xd4cd('0x19')],function(_0x443f9e){return{'model':db[_0x443f9e[_0xd4cd('0x1b')]],'as':_0x443f9e['as'],'attributes':_0x443f9e[_0xd4cd('0x17')]};}):[]};}):[]};}):[]:[]})[_0xd4cd('0xa')](function(_0x43f459){logger[_0xd4cd('0xb')](_0xd4cd('0x1c'),_0x3062e6);logger['debug'](_0xd4cd('0x1c'),_0x3062e6,JSON[_0xd4cd('0x1d')](_0x43f459));_0x4eea06(_0x43f459);})['catch'](function(_0xe245f3){logger[_0xd4cd('0x11')]('GetMailServerIn',_0xe245f3[_0xd4cd('0x12')],_0x3062e6);_0x3e0a87(_0x3888fe[_0xd4cd('0x11')](0x1f4,_0xe245f3[_0xd4cd('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 7e784a2..112980a 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 _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailServerOut.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(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'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 +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(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0x7a54,0x106));var _0x47a5=function(_0x4d9934,_0x4ef191){_0x4d9934=_0x4d9934-0x0;var _0xdca2a9=_0x7a54[_0x4d9934];return _0xdca2a9;};'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 a015388..bc66e01 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 _0x3f8c=['STRING'];(function(_0x2d8fc2,_0x1c461d){var _0x3a9e53=function(_0x18941c){while(--_0x18941c){_0x2d8fc2['push'](_0x2d8fc2['shift']());}};_0x3a9e53(++_0x1c461d);}(_0x3f8c,0x104));var _0xc3f8=function(_0x2d5214,_0x2bba99){_0x2d5214=_0x2d5214-0x0;var _0x17647f=_0x3f8c[_0x2d5214];return _0x17647f;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize[_0xc3f8('0x0')]},'host':{'type':Sequelize[_0xc3f8('0x0')]},'user':{'type':Sequelize[_0xc3f8('0x0')]},'pass':{'type':Sequelize[_0xc3f8('0x0')]},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x63a5=['STRING','INTEGER','BOOLEAN','sequelize','exports'];(function(_0x5d011e,_0x4399ae){var _0x5715dc=function(_0x129e3b){while(--_0x129e3b){_0x5d011e['push'](_0x5d011e['shift']());}};_0x5715dc(++_0x4399ae);}(_0x63a5,0x18e));var _0x563a=function(_0x556bb1,_0x34830d){_0x556bb1=_0x556bb1-0x0;var _0x45455f=_0x63a5[_0x556bb1];return _0x45455f;};'use strict';var Sequelize=require(_0x563a('0x0'));module[_0x563a('0x1')]={'description':{'type':Sequelize[_0x563a('0x2')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0x563a('0x2')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x563a('0x3')]},'secure':{'type':Sequelize[_0x563a('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0x563a('0x2')]},'authentication':{'type':Sequelize[_0x563a('0x4')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index e7e6cf8..2e7e585 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 _0xd6f9=['map','MailServerOut','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','find','create','body','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','querystring','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','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index'];(function(_0x3810fe,_0xb013fb){var _0x38496f=function(_0x1640e3){while(--_0x1640e3){_0x3810fe['push'](_0x3810fe['shift']());}};_0x38496f(++_0xb013fb);}(_0xd6f9,0x14f));var _0x9d6f=function(_0x1c510a,_0x1413a9){_0x1c510a=_0x1c510a-0x0;var _0x23cedd=_0xd6f9[_0x1c510a];return _0x23cedd;};'use strict';var emlformat=require(_0x9d6f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9d6f('0x1'));var jsonpatch=require(_0x9d6f('0x2'));var rp=require('request-promise');var moment=require(_0x9d6f('0x3'));var BPromise=require(_0x9d6f('0x4'));var Mustache=require(_0x9d6f('0x5'));var util=require(_0x9d6f('0x6'));var path=require(_0x9d6f('0x7'));var sox=require(_0x9d6f('0x8'));var csv=require('to-csv');var ejs=require(_0x9d6f('0x9'));var fs=require('fs');var fs_extra=require(_0x9d6f('0xa'));var _=require(_0x9d6f('0xb'));var squel=require(_0x9d6f('0xc'));var crypto=require('crypto');var jsforce=require(_0x9d6f('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9d6f('0xe'));var Papa=require('papaparse');var Redis=require(_0x9d6f('0xf'));var authService=require(_0x9d6f('0x10'));var qs=require(_0x9d6f('0x11'));var as=require(_0x9d6f('0x12'));var hardwareService=require(_0x9d6f('0x13'));var logger=require(_0x9d6f('0x14'))(_0x9d6f('0x15'));var utils=require(_0x9d6f('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x9d6f('0x17'));var db=require(_0x9d6f('0x18'))['db'];function respondWithStatusCode(_0x36441b,_0x2e5404){_0x2e5404=_0x2e5404||0xcc;return function(_0x5079e6){if(_0x5079e6){return _0x36441b[_0x9d6f('0x19')](_0x2e5404);}return _0x36441b[_0x9d6f('0x1a')](_0x2e5404)[_0x9d6f('0x1b')]();};}function respondWithResult(_0x3c7081,_0x53935e){_0x53935e=_0x53935e||0xc8;return function(_0x5b8e65){if(_0x5b8e65){return _0x3c7081[_0x9d6f('0x1a')](_0x53935e)[_0x9d6f('0x1c')](_0x5b8e65);}};}function respondWithFilteredResult(_0x507e2a,_0x2b9004){return function(_0x1b765e){if(_0x1b765e){var _0x99257b=typeof _0x2b9004[_0x9d6f('0x1d')]===_0x9d6f('0x1e')&&typeof _0x2b9004[_0x9d6f('0x1f')]===_0x9d6f('0x1e');var _0x39df85=_0x1b765e[_0x9d6f('0x20')];var _0xc64a10=_0x99257b?0x0:_0x2b9004['offset'];var _0x57b4cd=_0x99257b?_0x1b765e[_0x9d6f('0x20')]:_0x2b9004[_0x9d6f('0x1d')]+_0x2b9004['limit'];var _0xf4185f;if(_0x57b4cd>=_0x39df85){_0x57b4cd=_0x39df85;_0xf4185f=0xc8;}else{_0xf4185f=0xce;}_0x507e2a['status'](_0xf4185f);return _0x507e2a[_0x9d6f('0x21')](_0x9d6f('0x22'),_0xc64a10+'-'+_0x57b4cd+'/'+_0x39df85)['json'](_0x1b765e);}return null;};}function patchUpdates(_0x15d966){return function(_0x2e3e70){try{jsonpatch[_0x9d6f('0x23')](_0x2e3e70,_0x15d966,!![]);}catch(_0x16b5ae){return BPromise[_0x9d6f('0x24')](_0x16b5ae);}return _0x2e3e70[_0x9d6f('0x25')]();};}function saveUpdates(_0x411b3b,_0x17fcee){return function(_0x8d356c){if(_0x8d356c){return _0x8d356c['update'](_0x411b3b)[_0x9d6f('0x26')](function(_0x582800){return _0x582800;});}return null;};}function removeEntity(_0xeb76ed,_0xf63e59){return function(_0x2ce84b){if(_0x2ce84b){return _0x2ce84b[_0x9d6f('0x27')]()['then'](function(){_0xeb76ed[_0x9d6f('0x1a')](0xcc)[_0x9d6f('0x1b')]();});}};}function handleEntityNotFound(_0x318b95,_0xfc05b5){return function(_0x1b9af3){if(!_0x1b9af3){_0x318b95[_0x9d6f('0x19')](0x194);}return _0x1b9af3;};}function handleError(_0x42f702,_0x2e4418){_0x2e4418=_0x2e4418||0x1f4;return function(_0x58aeb7){logger[_0x9d6f('0x28')](_0x58aeb7[_0x9d6f('0x29')]);if(_0x58aeb7[_0x9d6f('0x2a')]){delete _0x58aeb7[_0x9d6f('0x2a')];}_0x42f702[_0x9d6f('0x1a')](_0x2e4418)[_0x9d6f('0x2b')](_0x58aeb7);};}exports[_0x9d6f('0x2c')]=function(_0x1b985a,_0xc81c9e){var _0x337fed={},_0x515658={},_0x246c50={'count':0x0,'rows':[]};var _0x5535d2=_[_0x9d6f('0x2d')](db[_0x9d6f('0x2e')][_0x9d6f('0x2f')],function(_0x435b8d){return{'name':_0x435b8d['fieldName'],'type':_0x435b8d[_0x9d6f('0x30')][_0x9d6f('0x31')]};});_0x515658['model']=_[_0x9d6f('0x2d')](_0x5535d2,_0x9d6f('0x2a'));_0x515658[_0x9d6f('0x32')]=_[_0x9d6f('0x33')](_0x1b985a['query']);_0x515658[_0x9d6f('0x34')]=_[_0x9d6f('0x35')](_0x515658[_0x9d6f('0x36')],_0x515658['query']);_0x337fed[_0x9d6f('0x37')]=_['intersection'](_0x515658[_0x9d6f('0x36')],qs[_0x9d6f('0x38')](_0x1b985a[_0x9d6f('0x32')][_0x9d6f('0x38')]));_0x337fed[_0x9d6f('0x37')]=_0x337fed[_0x9d6f('0x37')][_0x9d6f('0x39')]?_0x337fed[_0x9d6f('0x37')]:_0x515658[_0x9d6f('0x36')];if(!_0x1b985a[_0x9d6f('0x32')][_0x9d6f('0x3a')](_0x9d6f('0x3b'))){_0x337fed[_0x9d6f('0x1f')]=qs[_0x9d6f('0x1f')](_0x1b985a[_0x9d6f('0x32')][_0x9d6f('0x1f')]);_0x337fed['offset']=qs[_0x9d6f('0x1d')](_0x1b985a[_0x9d6f('0x32')][_0x9d6f('0x1d')]);}_0x337fed[_0x9d6f('0x3c')]=qs[_0x9d6f('0x3d')](_0x1b985a[_0x9d6f('0x32')][_0x9d6f('0x3d')]);_0x337fed['where']=qs[_0x9d6f('0x34')](_[_0x9d6f('0x3e')](_0x1b985a[_0x9d6f('0x32')],_0x515658[_0x9d6f('0x34')]),_0x5535d2);if(_0x1b985a[_0x9d6f('0x32')][_0x9d6f('0x3f')]){_0x337fed[_0x9d6f('0x40')]=_[_0x9d6f('0x41')](_0x337fed[_0x9d6f('0x40')],{'$or':_[_0x9d6f('0x2d')](_0x5535d2,function(_0x224488){if(_0x224488[_0x9d6f('0x30')]!==_0x9d6f('0x42')){var _0x41a9cb={};_0x41a9cb[_0x224488[_0x9d6f('0x2a')]]={'$like':'%'+_0x1b985a[_0x9d6f('0x32')][_0x9d6f('0x3f')]+'%'};return _0x41a9cb;}})});}_0x337fed=_[_0x9d6f('0x41')]({},_0x337fed,_0x1b985a['options']);var _0x16d28d={'where':_0x337fed[_0x9d6f('0x40')]};return db[_0x9d6f('0x2e')]['count'](_0x16d28d)[_0x9d6f('0x26')](function(_0x527670){_0x246c50[_0x9d6f('0x20')]=_0x527670;if(_0x1b985a['query'][_0x9d6f('0x43')]){_0x337fed['include']=[{'all':!![]}];}return db['MailServerOut'][_0x9d6f('0x44')](_0x337fed);})[_0x9d6f('0x26')](function(_0x46ca18){_0x246c50[_0x9d6f('0x45')]=_0x46ca18;return _0x246c50;})[_0x9d6f('0x26')](respondWithFilteredResult(_0xc81c9e,_0x337fed))[_0x9d6f('0x46')](handleError(_0xc81c9e,null));};exports[_0x9d6f('0x47')]=function(_0x4df514,_0x454235){var _0x297432={'raw':!![],'where':{'id':_0x4df514[_0x9d6f('0x48')]['id']}},_0x4f6db7={};_0x4f6db7[_0x9d6f('0x36')]=_[_0x9d6f('0x33')](db[_0x9d6f('0x2e')][_0x9d6f('0x2f')]);_0x4f6db7[_0x9d6f('0x32')]=_['keys'](_0x4df514['query']);_0x4f6db7[_0x9d6f('0x34')]=_[_0x9d6f('0x35')](_0x4f6db7[_0x9d6f('0x36')],_0x4f6db7[_0x9d6f('0x32')]);_0x297432[_0x9d6f('0x37')]=_[_0x9d6f('0x35')](_0x4f6db7[_0x9d6f('0x36')],qs[_0x9d6f('0x38')](_0x4df514['query']['fields']));_0x297432[_0x9d6f('0x37')]=_0x297432[_0x9d6f('0x37')][_0x9d6f('0x39')]?_0x297432['attributes']:_0x4f6db7[_0x9d6f('0x36')];if(_0x4df514[_0x9d6f('0x32')][_0x9d6f('0x43')]){_0x297432['include']=[{'all':!![]}];}_0x297432=_['merge']({},_0x297432,_0x4df514['options']);return db[_0x9d6f('0x2e')][_0x9d6f('0x49')](_0x297432)[_0x9d6f('0x26')](handleEntityNotFound(_0x454235,null))[_0x9d6f('0x26')](respondWithResult(_0x454235,null))[_0x9d6f('0x46')](handleError(_0x454235,null));};exports[_0x9d6f('0x4a')]=function(_0x1cba03,_0x4b4d2f){return db[_0x9d6f('0x2e')][_0x9d6f('0x4a')](_0x1cba03['body'],{})[_0x9d6f('0x26')](respondWithResult(_0x4b4d2f,0xc9))['catch'](handleError(_0x4b4d2f,null));};exports['update']=function(_0x1690fc,_0x4e26d1){if(_0x1690fc[_0x9d6f('0x4b')]['id']){delete _0x1690fc[_0x9d6f('0x4b')]['id'];}return db[_0x9d6f('0x2e')][_0x9d6f('0x49')]({'where':{'id':_0x1690fc[_0x9d6f('0x48')]['id']}})[_0x9d6f('0x26')](handleEntityNotFound(_0x4e26d1,null))[_0x9d6f('0x26')](saveUpdates(_0x1690fc[_0x9d6f('0x4b')],null))[_0x9d6f('0x26')](respondWithResult(_0x4e26d1,null))[_0x9d6f('0x46')](handleError(_0x4e26d1,null));};exports[_0x9d6f('0x27')]=function(_0x257e87,_0xabf6e0){return db[_0x9d6f('0x2e')][_0x9d6f('0x49')]({'where':{'id':_0x257e87[_0x9d6f('0x48')]['id']}})[_0x9d6f('0x26')](handleEntityNotFound(_0xabf6e0,null))['then'](removeEntity(_0xabf6e0,null))[_0x9d6f('0x46')](handleError(_0xabf6e0,null));}; \ No newline at end of file +var _0x11fa=['update','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','end','error','stack','name','send','map','MailServerOut','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','VIRTUAL','filter','merge','options','include','rows','catch','show','params','find','create'];(function(_0x24403d,_0x94ebf1){var _0x3fabf3=function(_0x39b1a9){while(--_0x39b1a9){_0x24403d['push'](_0x24403d['shift']());}};_0x3fabf3(++_0x94ebf1);}(_0x11fa,0xe6));var _0xa11f=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0x11fa[_0x599f41];return _0x2e4d58;};'use strict';var emlformat=require(_0xa11f('0x0'));var rimraf=require(_0xa11f('0x1'));var zipdir=require(_0xa11f('0x2'));var jsonpatch=require(_0xa11f('0x3'));var rp=require(_0xa11f('0x4'));var moment=require(_0xa11f('0x5'));var BPromise=require(_0xa11f('0x6'));var Mustache=require(_0xa11f('0x7'));var util=require(_0xa11f('0x8'));var path=require('path');var sox=require(_0xa11f('0x9'));var csv=require(_0xa11f('0xa'));var ejs=require(_0xa11f('0xb'));var fs=require('fs');var fs_extra=require(_0xa11f('0xc'));var _=require('lodash');var squel=require(_0xa11f('0xd'));var crypto=require(_0xa11f('0xe'));var jsforce=require(_0xa11f('0xf'));var deskjs=require(_0xa11f('0x10'));var toCsv=require(_0xa11f('0xa'));var querystring=require('querystring');var Papa=require(_0xa11f('0x11'));var Redis=require('ioredis');var authService=require(_0xa11f('0x12'));var qs=require(_0xa11f('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa11f('0x14'))(_0xa11f('0x15'));var utils=require('../../config/utils');var config=require(_0xa11f('0x16'));var licenseUtil=require(_0xa11f('0x17'));var db=require(_0xa11f('0x18'))['db'];function respondWithStatusCode(_0x502551,_0x4d15da){_0x4d15da=_0x4d15da||0xcc;return function(_0x50925c){if(_0x50925c){return _0x502551[_0xa11f('0x19')](_0x4d15da);}return _0x502551[_0xa11f('0x1a')](_0x4d15da)['end']();};}function respondWithResult(_0x4f1d89,_0x532745){_0x532745=_0x532745||0xc8;return function(_0x3e2b49){if(_0x3e2b49){return _0x4f1d89[_0xa11f('0x1a')](_0x532745)[_0xa11f('0x1b')](_0x3e2b49);}};}function respondWithFilteredResult(_0x4a7a01,_0x345fa6){return function(_0xe20602){if(_0xe20602){var _0x4d62fb=typeof _0x345fa6[_0xa11f('0x1c')]===_0xa11f('0x1d')&&typeof _0x345fa6[_0xa11f('0x1e')]===_0xa11f('0x1d');var _0x1d598a=_0xe20602['count'];var _0x46099f=_0x4d62fb?0x0:_0x345fa6['offset'];var _0x38f50a=_0x4d62fb?_0xe20602[_0xa11f('0x1f')]:_0x345fa6[_0xa11f('0x1c')]+_0x345fa6[_0xa11f('0x1e')];var _0x34c317;if(_0x38f50a>=_0x1d598a){_0x38f50a=_0x1d598a;_0x34c317=0xc8;}else{_0x34c317=0xce;}_0x4a7a01[_0xa11f('0x1a')](_0x34c317);return _0x4a7a01[_0xa11f('0x20')](_0xa11f('0x21'),_0x46099f+'-'+_0x38f50a+'/'+_0x1d598a)[_0xa11f('0x1b')](_0xe20602);}return null;};}function patchUpdates(_0x334499){return function(_0x5294dd){try{jsonpatch[_0xa11f('0x22')](_0x5294dd,_0x334499,!![]);}catch(_0x33de83){return BPromise['reject'](_0x33de83);}return _0x5294dd[_0xa11f('0x23')]();};}function saveUpdates(_0x5a9fff,_0x979568){return function(_0x4a2c38){if(_0x4a2c38){return _0x4a2c38['update'](_0x5a9fff)[_0xa11f('0x24')](function(_0x79fdc8){return _0x79fdc8;});}return null;};}function removeEntity(_0x13cac7,_0x29f84d){return function(_0x3a55b0){if(_0x3a55b0){return _0x3a55b0[_0xa11f('0x25')]()[_0xa11f('0x24')](function(){_0x13cac7[_0xa11f('0x1a')](0xcc)[_0xa11f('0x26')]();});}};}function handleEntityNotFound(_0x25a97d,_0x164919){return function(_0x18f09c){if(!_0x18f09c){_0x25a97d['sendStatus'](0x194);}return _0x18f09c;};}function handleError(_0x5a9367,_0xc04b58){_0xc04b58=_0xc04b58||0x1f4;return function(_0x41d1c7){logger[_0xa11f('0x27')](_0x41d1c7[_0xa11f('0x28')]);if(_0x41d1c7[_0xa11f('0x29')]){delete _0x41d1c7[_0xa11f('0x29')];}_0x5a9367[_0xa11f('0x1a')](_0xc04b58)[_0xa11f('0x2a')](_0x41d1c7);};}exports['index']=function(_0x2893a7,_0x48bdbe){var _0x1c4cf7={},_0x1b40d5={},_0xa42415={'count':0x0,'rows':[]};var _0x2588f5=_[_0xa11f('0x2b')](db[_0xa11f('0x2c')][_0xa11f('0x2d')],function(_0x3255a4){return{'name':_0x3255a4[_0xa11f('0x2e')],'type':_0x3255a4[_0xa11f('0x2f')][_0xa11f('0x30')]};});_0x1b40d5[_0xa11f('0x31')]=_[_0xa11f('0x2b')](_0x2588f5,_0xa11f('0x29'));_0x1b40d5[_0xa11f('0x32')]=_[_0xa11f('0x33')](_0x2893a7[_0xa11f('0x32')]);_0x1b40d5['filters']=_[_0xa11f('0x34')](_0x1b40d5[_0xa11f('0x31')],_0x1b40d5['query']);_0x1c4cf7[_0xa11f('0x35')]=_[_0xa11f('0x34')](_0x1b40d5[_0xa11f('0x31')],qs[_0xa11f('0x36')](_0x2893a7['query'][_0xa11f('0x36')]));_0x1c4cf7['attributes']=_0x1c4cf7[_0xa11f('0x35')][_0xa11f('0x37')]?_0x1c4cf7[_0xa11f('0x35')]:_0x1b40d5[_0xa11f('0x31')];if(!_0x2893a7[_0xa11f('0x32')][_0xa11f('0x38')](_0xa11f('0x39'))){_0x1c4cf7[_0xa11f('0x1e')]=qs['limit'](_0x2893a7[_0xa11f('0x32')][_0xa11f('0x1e')]);_0x1c4cf7[_0xa11f('0x1c')]=qs['offset'](_0x2893a7[_0xa11f('0x32')]['offset']);}_0x1c4cf7[_0xa11f('0x3a')]=qs[_0xa11f('0x3b')](_0x2893a7[_0xa11f('0x32')]['sort']);_0x1c4cf7[_0xa11f('0x3c')]=qs[_0xa11f('0x3d')](_[_0xa11f('0x3e')](_0x2893a7[_0xa11f('0x32')],_0x1b40d5[_0xa11f('0x3d')]),_0x2588f5);if(_0x2893a7['query']['filter']){_0x1c4cf7[_0xa11f('0x3c')]=_['merge'](_0x1c4cf7['where'],{'$or':_[_0xa11f('0x2b')](_0x2588f5,function(_0x1776fb){if(_0x1776fb[_0xa11f('0x2f')]!==_0xa11f('0x3f')){var _0x1d2fcd={};_0x1d2fcd[_0x1776fb[_0xa11f('0x29')]]={'$like':'%'+_0x2893a7[_0xa11f('0x32')][_0xa11f('0x40')]+'%'};return _0x1d2fcd;}})});}_0x1c4cf7=_[_0xa11f('0x41')]({},_0x1c4cf7,_0x2893a7[_0xa11f('0x42')]);var _0xfb8dc0={'where':_0x1c4cf7[_0xa11f('0x3c')]};return db[_0xa11f('0x2c')][_0xa11f('0x1f')](_0xfb8dc0)[_0xa11f('0x24')](function(_0x4fc500){_0xa42415[_0xa11f('0x1f')]=_0x4fc500;if(_0x2893a7[_0xa11f('0x32')]['includeAll']){_0x1c4cf7[_0xa11f('0x43')]=[{'all':!![]}];}return db['MailServerOut']['findAll'](_0x1c4cf7);})['then'](function(_0x1ca676){_0xa42415[_0xa11f('0x44')]=_0x1ca676;return _0xa42415;})[_0xa11f('0x24')](respondWithFilteredResult(_0x48bdbe,_0x1c4cf7))[_0xa11f('0x45')](handleError(_0x48bdbe,null));};exports[_0xa11f('0x46')]=function(_0x1b44af,_0x147102){var _0x11069b={'raw':!![],'where':{'id':_0x1b44af[_0xa11f('0x47')]['id']}},_0xfd6d61={};_0xfd6d61[_0xa11f('0x31')]=_[_0xa11f('0x33')](db[_0xa11f('0x2c')][_0xa11f('0x2d')]);_0xfd6d61[_0xa11f('0x32')]=_[_0xa11f('0x33')](_0x1b44af[_0xa11f('0x32')]);_0xfd6d61[_0xa11f('0x3d')]=_[_0xa11f('0x34')](_0xfd6d61[_0xa11f('0x31')],_0xfd6d61[_0xa11f('0x32')]);_0x11069b[_0xa11f('0x35')]=_['intersection'](_0xfd6d61[_0xa11f('0x31')],qs[_0xa11f('0x36')](_0x1b44af[_0xa11f('0x32')]['fields']));_0x11069b[_0xa11f('0x35')]=_0x11069b[_0xa11f('0x35')][_0xa11f('0x37')]?_0x11069b[_0xa11f('0x35')]:_0xfd6d61['model'];if(_0x1b44af[_0xa11f('0x32')]['includeAll']){_0x11069b[_0xa11f('0x43')]=[{'all':!![]}];}_0x11069b=_['merge']({},_0x11069b,_0x1b44af[_0xa11f('0x42')]);return db['MailServerOut'][_0xa11f('0x48')](_0x11069b)['then'](handleEntityNotFound(_0x147102,null))[_0xa11f('0x24')](respondWithResult(_0x147102,null))[_0xa11f('0x45')](handleError(_0x147102,null));};exports[_0xa11f('0x49')]=function(_0x223687,_0x49f6e0){return db['MailServerOut'][_0xa11f('0x49')](_0x223687['body'],{})['then'](respondWithResult(_0x49f6e0,0xc9))[_0xa11f('0x45')](handleError(_0x49f6e0,null));};exports[_0xa11f('0x4a')]=function(_0x45a3ee,_0x1d406a){if(_0x45a3ee[_0xa11f('0x4b')]['id']){delete _0x45a3ee[_0xa11f('0x4b')]['id'];}return db[_0xa11f('0x2c')][_0xa11f('0x48')]({'where':{'id':_0x45a3ee[_0xa11f('0x47')]['id']}})[_0xa11f('0x24')](handleEntityNotFound(_0x1d406a,null))[_0xa11f('0x24')](saveUpdates(_0x45a3ee['body'],null))[_0xa11f('0x24')](respondWithResult(_0x1d406a,null))[_0xa11f('0x45')](handleError(_0x1d406a,null));};exports[_0xa11f('0x25')]=function(_0x60a8da,_0x226b66){return db[_0xa11f('0x2c')][_0xa11f('0x48')]({'where':{'id':_0x60a8da[_0xa11f('0x47')]['id']}})[_0xa11f('0x24')](handleEntityNotFound(_0x226b66,null))[_0xa11f('0x24')](removeEntity(_0x226b66,null))['catch'](handleError(_0x226b66,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 41eed11..0317e44 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 _0xfe74=['./mailServerOut.attributes','exports','MailServerOut','lodash','../../config/logger','bluebird','request-promise','path','../../config/environment'];(function(_0x56c5d2,_0x5b8f6a){var _0x2ac14d=function(_0x4982d2){while(--_0x4982d2){_0x56c5d2['push'](_0x56c5d2['shift']());}};_0x2ac14d(++_0x5b8f6a);}(_0xfe74,0x12c));var _0x4fe7=function(_0x5e80a8,_0x4e86e7){_0x5e80a8=_0x5e80a8-0x0;var _0x2f448b=_0xfe74[_0x5e80a8];return _0x2f448b;};'use strict';var _=require(_0x4fe7('0x0'));var util=require('util');var logger=require(_0x4fe7('0x1'))('api');var moment=require('moment');var BPromise=require(_0x4fe7('0x2'));var rp=require(_0x4fe7('0x3'));var fs=require('fs');var path=require(_0x4fe7('0x4'));var rimraf=require('rimraf');var config=require(_0x4fe7('0x5'));var attributes=require(_0x4fe7('0x6'));module[_0x4fe7('0x7')]=function(_0x322212,_0x4441f9){return _0x322212['define'](_0x4fe7('0x8'),attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x11c4=['define','MailServerOut','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./mailServerOut.attributes','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x11c4,0xb6));var _0x411c=function(_0x6174e8,_0x3f2d95){_0x6174e8=_0x6174e8-0x0;var _0x25dd9c=_0x11c4[_0x6174e8];return _0x25dd9c;};'use strict';var _=require(_0x411c('0x0'));var util=require(_0x411c('0x1'));var logger=require(_0x411c('0x2'))('api');var moment=require(_0x411c('0x3'));var BPromise=require('bluebird');var rp=require(_0x411c('0x4'));var fs=require('fs');var path=require(_0x411c('0x5'));var rimraf=require(_0x411c('0x6'));var config=require(_0x411c('0x7'));var attributes=require(_0x411c('0x8'));module[_0x411c('0x9')]=function(_0x4e4e4c,_0xe9c98b){return _0x4e4e4c[_0x411c('0xa')](_0x411c('0xb'),attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index cd2c867..95c23b7 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 _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','MailServerOut,\x20%s,\x20%s','MailServerOut,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x1229be,_0x5a076f){var _0x138319=function(_0x4e1266){while(--_0x4e1266){_0x1229be['push'](_0x1229be['shift']());}};_0x138319(++_0x5a076f);}(_0x2ef3,0xba));var _0x32ef=function(_0x36b605,_0x56e0e0){_0x36b605=_0x36b605-0x0;var _0x3542b1=_0x2ef3[_0x36b605];return _0x3542b1;};'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')]('MailServerOut,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('MailServerOut,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file +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(_0x169d93,_0x2c6864){var _0xdef4fb=function(_0x120610){while(--_0x120610){_0x169d93['push'](_0x169d93['shift']());}};_0xdef4fb(++_0x2c6864);}(_0x1261,0x144));var _0x1126=function(_0x5a9b6c,_0x30ccd0){_0x5a9b6c=_0x5a9b6c-0x0;var _0x72bed=_0x1261[_0x5a9b6c];return _0x72bed;};'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 diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 58c756d..2eb2237 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 _0x4ae9=['show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','describe','/:id'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4ae9,0x71));var _0x94ae=function(_0x5e745e,_0xde2931){_0x5e745e=_0x5e745e-0x0;var _0x122dab=_0x4ae9[_0x5e745e];return _0x122dab;};'use strict';var multer=require(_0x94ae('0x0'));var util=require('util');var path=require(_0x94ae('0x1'));var timeout=require(_0x94ae('0x2'));var express=require(_0x94ae('0x3'));var router=express[_0x94ae('0x4')]();var fs_extra=require(_0x94ae('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x94ae('0x6'));var config=require(_0x94ae('0x7'));var controller=require('./mailSubstatus.controller');router[_0x94ae('0x8')]('/',auth['isAuthenticated'](),controller[_0x94ae('0x9')]);router[_0x94ae('0x8')]('/describe',auth[_0x94ae('0xa')](),controller[_0x94ae('0xb')]);router['get'](_0x94ae('0xc'),auth['isAuthenticated'](),controller[_0x94ae('0xd')]);router[_0x94ae('0xe')]('/',auth['isAuthenticated'](),controller[_0x94ae('0xf')]);router[_0x94ae('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x94ae('0x11')]);router[_0x94ae('0x12')](_0x94ae('0xc'),auth[_0x94ae('0xa')](),controller[_0x94ae('0x13')]);module[_0x94ae('0x14')]=router; \ No newline at end of file +var _0x83c3=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','index','isAuthenticated','describe','/:id','post','create','put','delete','destroy','exports','multer','path','connect-timeout'];(function(_0x48affa,_0x52ed60){var _0x4ee41d=function(_0x5d4b26){while(--_0x5d4b26){_0x48affa['push'](_0x48affa['shift']());}};_0x4ee41d(++_0x52ed60);}(_0x83c3,0x123));var _0x383c=function(_0xf61a76,_0x249781){_0xf61a76=_0xf61a76-0x0;var _0x168c51=_0x83c3[_0xf61a76];return _0x168c51;};'use strict';var multer=require(_0x383c('0x0'));var util=require('util');var path=require(_0x383c('0x1'));var timeout=require(_0x383c('0x2'));var express=require(_0x383c('0x3'));var router=express[_0x383c('0x4')]();var fs_extra=require(_0x383c('0x5'));var auth=require(_0x383c('0x6'));var interaction=require(_0x383c('0x7'));var config=require(_0x383c('0x8'));var controller=require(_0x383c('0x9'));router[_0x383c('0xa')]('/',auth['isAuthenticated'](),controller[_0x383c('0xb')]);router['get']('/describe',auth[_0x383c('0xc')](),controller[_0x383c('0xd')]);router[_0x383c('0xa')](_0x383c('0xe'),auth[_0x383c('0xc')](),controller['show']);router[_0x383c('0xf')]('/',auth[_0x383c('0xc')](),controller[_0x383c('0x10')]);router[_0x383c('0x11')](_0x383c('0xe'),auth[_0x383c('0xc')](),controller['update']);router[_0x383c('0x12')]('/:id',auth[_0x383c('0xc')](),controller[_0x383c('0x13')]);module[_0x383c('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index feb3f8e..c09c3fc 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 _0x8958=['exports'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x8958,0x93));var _0x8895=function(_0x5eb758,_0x7207ad){_0x5eb758=_0x5eb758-0x0;var _0x50a8fa=_0x8958[_0x5eb758];return _0x50a8fa;};'use strict';var Sequelize=require('sequelize');module[_0x8895('0x0')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x02a7=['exports','STRING'];(function(_0x31abee,_0x11ff0c){var _0x3c1761=function(_0x2b5062){while(--_0x2b5062){_0x31abee['push'](_0x31abee['shift']());}};_0x3c1761(++_0x11ff0c);}(_0x02a7,0x7a));var _0x702a=function(_0x23b476,_0x4c4c4a){_0x23b476=_0x23b476-0x0;var _0x32b8e6=_0x02a7[_0x23b476];return _0x32b8e6;};'use strict';var Sequelize=require('sequelize');module[_0x702a('0x0')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x702a('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index c4afb03..3a4c0f7 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 _0xebe2=['then','error','stack','name','send','index','map','MailSubstatus','rawAttributes','fieldName','type','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','find','create','update','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','limit','set','Content-Range','apply','reject','save'];(function(_0xf58718,_0x33541a){var _0x5aea10=function(_0x16f386){while(--_0x16f386){_0xf58718['push'](_0xf58718['shift']());}};_0x5aea10(++_0x33541a);}(_0xebe2,0x150));var _0x2ebe=function(_0x33ca22,_0xbcc94){_0x33ca22=_0x33ca22-0x0;var _0x1790c3=_0xebe2[_0x33ca22];return _0x1790c3;};'use strict';var emlformat=require(_0x2ebe('0x0'));var rimraf=require(_0x2ebe('0x1'));var zipdir=require(_0x2ebe('0x2'));var jsonpatch=require(_0x2ebe('0x3'));var rp=require(_0x2ebe('0x4'));var moment=require(_0x2ebe('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x2ebe('0x6'));var util=require(_0x2ebe('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x2ebe('0x8'));var ejs=require(_0x2ebe('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2ebe('0xa'));var squel=require(_0x2ebe('0xb'));var crypto=require(_0x2ebe('0xc'));var jsforce=require(_0x2ebe('0xd'));var deskjs=require(_0x2ebe('0xe'));var toCsv=require(_0x2ebe('0x8'));var querystring=require('querystring');var Papa=require(_0x2ebe('0xf'));var Redis=require(_0x2ebe('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x2ebe('0x11'));var as=require(_0x2ebe('0x12'));var hardwareService=require(_0x2ebe('0x13'));var logger=require(_0x2ebe('0x14'))('api');var utils=require(_0x2ebe('0x15'));var config=require(_0x2ebe('0x16'));var licenseUtil=require(_0x2ebe('0x17'));var db=require(_0x2ebe('0x18'))['db'];function respondWithStatusCode(_0x5905d6,_0x9732ff){_0x9732ff=_0x9732ff||0xcc;return function(_0x5f0c0f){if(_0x5f0c0f){return _0x5905d6['sendStatus'](_0x9732ff);}return _0x5905d6[_0x2ebe('0x19')](_0x9732ff)['end']();};}function respondWithResult(_0x142400,_0xb1c96f){_0xb1c96f=_0xb1c96f||0xc8;return function(_0x11c286){if(_0x11c286){return _0x142400[_0x2ebe('0x19')](_0xb1c96f)[_0x2ebe('0x1a')](_0x11c286);}};}function respondWithFilteredResult(_0x98c91a,_0x3c87e5){return function(_0x3c6422){if(_0x3c6422){var _0x185db0=typeof _0x3c87e5[_0x2ebe('0x1b')]==='undefined'&&typeof _0x3c87e5[_0x2ebe('0x1c')]==='undefined';var _0x28377f=_0x3c6422['count'];var _0x4771e6=_0x185db0?0x0:_0x3c87e5[_0x2ebe('0x1b')];var _0x10fa3e=_0x185db0?_0x3c6422['count']:_0x3c87e5[_0x2ebe('0x1b')]+_0x3c87e5[_0x2ebe('0x1c')];var _0x220155;if(_0x10fa3e>=_0x28377f){_0x10fa3e=_0x28377f;_0x220155=0xc8;}else{_0x220155=0xce;}_0x98c91a['status'](_0x220155);return _0x98c91a[_0x2ebe('0x1d')](_0x2ebe('0x1e'),_0x4771e6+'-'+_0x10fa3e+'/'+_0x28377f)[_0x2ebe('0x1a')](_0x3c6422);}return null;};}function patchUpdates(_0x2428b2){return function(_0x1aca63){try{jsonpatch[_0x2ebe('0x1f')](_0x1aca63,_0x2428b2,!![]);}catch(_0x16a078){return BPromise[_0x2ebe('0x20')](_0x16a078);}return _0x1aca63[_0x2ebe('0x21')]();};}function saveUpdates(_0x72392a,_0x40f75c){return function(_0x531de5){if(_0x531de5){return _0x531de5['update'](_0x72392a)[_0x2ebe('0x22')](function(_0x4eeaea){return _0x4eeaea;});}return null;};}function removeEntity(_0x33cc5e,_0x2f8b71){return function(_0x1c00b3){if(_0x1c00b3){return _0x1c00b3['destroy']()[_0x2ebe('0x22')](function(){_0x33cc5e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xe8d74f,_0x2e35df){return function(_0x4b448f){if(!_0x4b448f){_0xe8d74f['sendStatus'](0x194);}return _0x4b448f;};}function handleError(_0x5c815,_0x5b6ba7){_0x5b6ba7=_0x5b6ba7||0x1f4;return function(_0xc689db){logger[_0x2ebe('0x23')](_0xc689db[_0x2ebe('0x24')]);if(_0xc689db[_0x2ebe('0x25')]){delete _0xc689db[_0x2ebe('0x25')];}_0x5c815[_0x2ebe('0x19')](_0x5b6ba7)[_0x2ebe('0x26')](_0xc689db);};}exports[_0x2ebe('0x27')]=function(_0x4512ed,_0x584359){var _0x44352d={},_0x2d4066={},_0x353d6e={'count':0x0,'rows':[]};var _0x574770=_[_0x2ebe('0x28')](db[_0x2ebe('0x29')][_0x2ebe('0x2a')],function(_0x15839d){return{'name':_0x15839d[_0x2ebe('0x2b')],'type':_0x15839d[_0x2ebe('0x2c')]['key']};});_0x2d4066['model']=_['map'](_0x574770,_0x2ebe('0x25'));_0x2d4066[_0x2ebe('0x2d')]=_['keys'](_0x4512ed[_0x2ebe('0x2d')]);_0x2d4066[_0x2ebe('0x2e')]=_[_0x2ebe('0x2f')](_0x2d4066['model'],_0x2d4066[_0x2ebe('0x2d')]);_0x44352d[_0x2ebe('0x30')]=_[_0x2ebe('0x2f')](_0x2d4066[_0x2ebe('0x31')],qs[_0x2ebe('0x32')](_0x4512ed['query'][_0x2ebe('0x32')]));_0x44352d[_0x2ebe('0x30')]=_0x44352d[_0x2ebe('0x30')][_0x2ebe('0x33')]?_0x44352d[_0x2ebe('0x30')]:_0x2d4066[_0x2ebe('0x31')];if(!_0x4512ed[_0x2ebe('0x2d')][_0x2ebe('0x34')]('nolimit')){_0x44352d[_0x2ebe('0x1c')]=qs[_0x2ebe('0x1c')](_0x4512ed['query'][_0x2ebe('0x1c')]);_0x44352d[_0x2ebe('0x1b')]=qs[_0x2ebe('0x1b')](_0x4512ed[_0x2ebe('0x2d')][_0x2ebe('0x1b')]);}_0x44352d[_0x2ebe('0x35')]=qs[_0x2ebe('0x36')](_0x4512ed['query'][_0x2ebe('0x36')]);_0x44352d[_0x2ebe('0x37')]=qs[_0x2ebe('0x2e')](_[_0x2ebe('0x38')](_0x4512ed['query'],_0x2d4066[_0x2ebe('0x2e')]),_0x574770);if(_0x4512ed['query'][_0x2ebe('0x39')]){_0x44352d[_0x2ebe('0x37')]=_[_0x2ebe('0x3a')](_0x44352d[_0x2ebe('0x37')],{'$or':_[_0x2ebe('0x28')](_0x574770,function(_0x2be90f){if(_0x2be90f[_0x2ebe('0x2c')]!==_0x2ebe('0x3b')){var _0x58c8b5={};_0x58c8b5[_0x2be90f[_0x2ebe('0x25')]]={'$like':'%'+_0x4512ed[_0x2ebe('0x2d')][_0x2ebe('0x39')]+'%'};return _0x58c8b5;}})});}_0x44352d=_[_0x2ebe('0x3a')]({},_0x44352d,_0x4512ed[_0x2ebe('0x3c')]);var _0x66adab={'where':_0x44352d[_0x2ebe('0x37')]};return db[_0x2ebe('0x29')]['count'](_0x66adab)[_0x2ebe('0x22')](function(_0x300632){_0x353d6e['count']=_0x300632;if(_0x4512ed[_0x2ebe('0x2d')][_0x2ebe('0x3d')]){_0x44352d[_0x2ebe('0x3e')]=[{'all':!![]}];}return db['MailSubstatus']['findAll'](_0x44352d);})[_0x2ebe('0x22')](function(_0x169541){_0x353d6e[_0x2ebe('0x3f')]=_0x169541;return _0x353d6e;})['then'](respondWithFilteredResult(_0x584359,_0x44352d))[_0x2ebe('0x40')](handleError(_0x584359,null));};exports[_0x2ebe('0x41')]=function(_0x3a7fd1,_0x1a61a8){var _0x1caf81={'raw':!![],'where':{'id':_0x3a7fd1[_0x2ebe('0x42')]['id']}},_0x48279b={};_0x48279b[_0x2ebe('0x31')]=_['keys'](db['MailSubstatus'][_0x2ebe('0x2a')]);_0x48279b['query']=_[_0x2ebe('0x43')](_0x3a7fd1[_0x2ebe('0x2d')]);_0x48279b[_0x2ebe('0x2e')]=_[_0x2ebe('0x2f')](_0x48279b[_0x2ebe('0x31')],_0x48279b[_0x2ebe('0x2d')]);_0x1caf81['attributes']=_[_0x2ebe('0x2f')](_0x48279b[_0x2ebe('0x31')],qs[_0x2ebe('0x32')](_0x3a7fd1[_0x2ebe('0x2d')][_0x2ebe('0x32')]));_0x1caf81[_0x2ebe('0x30')]=_0x1caf81[_0x2ebe('0x30')][_0x2ebe('0x33')]?_0x1caf81[_0x2ebe('0x30')]:_0x48279b[_0x2ebe('0x31')];if(_0x3a7fd1['query'][_0x2ebe('0x3d')]){_0x1caf81['include']=[{'all':!![]}];}_0x1caf81=_['merge']({},_0x1caf81,_0x3a7fd1[_0x2ebe('0x3c')]);return db[_0x2ebe('0x29')][_0x2ebe('0x44')](_0x1caf81)['then'](handleEntityNotFound(_0x1a61a8,null))['then'](respondWithResult(_0x1a61a8,null))[_0x2ebe('0x40')](handleError(_0x1a61a8,null));};exports[_0x2ebe('0x45')]=function(_0x4c1ef9,_0x8e8e82){return db[_0x2ebe('0x29')][_0x2ebe('0x45')](_0x4c1ef9['body'],{})[_0x2ebe('0x22')](respondWithResult(_0x8e8e82,0xc9))[_0x2ebe('0x40')](handleError(_0x8e8e82,null));};exports[_0x2ebe('0x46')]=function(_0xb091f8,_0x177809){if(_0xb091f8[_0x2ebe('0x47')]['id']){delete _0xb091f8[_0x2ebe('0x47')]['id'];}return db['MailSubstatus'][_0x2ebe('0x44')]({'where':{'id':_0xb091f8[_0x2ebe('0x42')]['id']}})['then'](handleEntityNotFound(_0x177809,null))[_0x2ebe('0x22')](saveUpdates(_0xb091f8[_0x2ebe('0x47')],null))['then'](respondWithResult(_0x177809,null))[_0x2ebe('0x40')](handleError(_0x177809,null));};exports[_0x2ebe('0x48')]=function(_0x2eb324,_0x166630){return db[_0x2ebe('0x29')][_0x2ebe('0x44')]({'where':{'id':_0x2eb324[_0x2ebe('0x42')]['id']}})['then'](handleEntityNotFound(_0x166630,null))['then'](removeEntity(_0x166630,null))[_0x2ebe('0x40')](handleError(_0x166630,null));};exports[_0x2ebe('0x49')]=function(_0x54b611,_0x441c7d){return db[_0x2ebe('0x29')][_0x2ebe('0x49')]()['then'](respondWithResult(_0x441c7d,null))['catch'](handleError(_0x441c7d,null));}; \ No newline at end of file +var _0x855b=['find','catch','create','body','describe','eml-format','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','MailSubstatus','rawAttributes','fieldName','type','key','query','filters','attributes','intersection','model','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','include'];(function(_0x445a2e,_0x2a568b){var _0x307908=function(_0x2ac0e5){while(--_0x2ac0e5){_0x445a2e['push'](_0x445a2e['shift']());}};_0x307908(++_0x2a568b);}(_0x855b,0x1cd));var _0xb855=function(_0x19a26c,_0x54aa0f){_0x19a26c=_0x19a26c-0x0;var _0xcbe71a=_0x855b[_0x19a26c];return _0xcbe71a;};'use strict';var emlformat=require(_0xb855('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb855('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb855('0x2'));var BPromise=require(_0xb855('0x3'));var Mustache=require(_0xb855('0x4'));var util=require(_0xb855('0x5'));var path=require(_0xb855('0x6'));var sox=require(_0xb855('0x7'));var csv=require(_0xb855('0x8'));var ejs=require(_0xb855('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb855('0xa'));var squel=require('squel');var crypto=require(_0xb855('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xb855('0xc'));var toCsv=require('to-csv');var querystring=require(_0xb855('0xd'));var Papa=require(_0xb855('0xe'));var Redis=require('ioredis');var authService=require(_0xb855('0xf'));var qs=require(_0xb855('0x10'));var as=require(_0xb855('0x11'));var hardwareService=require(_0xb855('0x12'));var logger=require(_0xb855('0x13'))('api');var utils=require(_0xb855('0x14'));var config=require(_0xb855('0x15'));var licenseUtil=require(_0xb855('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1fa276,_0x1c9bee){_0x1c9bee=_0x1c9bee||0xcc;return function(_0x2999e1){if(_0x2999e1){return _0x1fa276[_0xb855('0x17')](_0x1c9bee);}return _0x1fa276[_0xb855('0x18')](_0x1c9bee)['end']();};}function respondWithResult(_0x441edf,_0x3a7137){_0x3a7137=_0x3a7137||0xc8;return function(_0xa27977){if(_0xa27977){return _0x441edf[_0xb855('0x18')](_0x3a7137)[_0xb855('0x19')](_0xa27977);}};}function respondWithFilteredResult(_0x2e10cf,_0x5cb870){return function(_0x42b7dd){if(_0x42b7dd){var _0x2c8507=typeof _0x5cb870[_0xb855('0x1a')]===_0xb855('0x1b')&&typeof _0x5cb870[_0xb855('0x1c')]===_0xb855('0x1b');var _0x488dce=_0x42b7dd[_0xb855('0x1d')];var _0x2b77a3=_0x2c8507?0x0:_0x5cb870[_0xb855('0x1a')];var _0x25cd5f=_0x2c8507?_0x42b7dd['count']:_0x5cb870[_0xb855('0x1a')]+_0x5cb870[_0xb855('0x1c')];var _0x38b7cd;if(_0x25cd5f>=_0x488dce){_0x25cd5f=_0x488dce;_0x38b7cd=0xc8;}else{_0x38b7cd=0xce;}_0x2e10cf[_0xb855('0x18')](_0x38b7cd);return _0x2e10cf[_0xb855('0x1e')](_0xb855('0x1f'),_0x2b77a3+'-'+_0x25cd5f+'/'+_0x488dce)[_0xb855('0x19')](_0x42b7dd);}return null;};}function patchUpdates(_0x5456fd){return function(_0x306cd9){try{jsonpatch[_0xb855('0x20')](_0x306cd9,_0x5456fd,!![]);}catch(_0xf28cf9){return BPromise[_0xb855('0x21')](_0xf28cf9);}return _0x306cd9[_0xb855('0x22')]();};}function saveUpdates(_0x4c830e,_0x50eeac){return function(_0x3228b2){if(_0x3228b2){return _0x3228b2[_0xb855('0x23')](_0x4c830e)[_0xb855('0x24')](function(_0x543902){return _0x543902;});}return null;};}function removeEntity(_0x324415,_0x58879d){return function(_0x159c4e){if(_0x159c4e){return _0x159c4e[_0xb855('0x25')]()[_0xb855('0x24')](function(){_0x324415[_0xb855('0x18')](0xcc)[_0xb855('0x26')]();});}};}function handleEntityNotFound(_0x2f777a,_0x2768b4){return function(_0xd7c80b){if(!_0xd7c80b){_0x2f777a['sendStatus'](0x194);}return _0xd7c80b;};}function handleError(_0x3501c1,_0x2e30a4){_0x2e30a4=_0x2e30a4||0x1f4;return function(_0x4a1a7c){logger[_0xb855('0x27')](_0x4a1a7c[_0xb855('0x28')]);if(_0x4a1a7c[_0xb855('0x29')]){delete _0x4a1a7c[_0xb855('0x29')];}_0x3501c1['status'](_0x2e30a4)[_0xb855('0x2a')](_0x4a1a7c);};}exports[_0xb855('0x2b')]=function(_0x595b2d,_0x48be65){var _0x17806c={},_0x2625c1={},_0x50a33b={'count':0x0,'rows':[]};var _0x586c2e=_[_0xb855('0x2c')](db[_0xb855('0x2d')][_0xb855('0x2e')],function(_0x405f4a){return{'name':_0x405f4a[_0xb855('0x2f')],'type':_0x405f4a[_0xb855('0x30')][_0xb855('0x31')]};});_0x2625c1['model']=_[_0xb855('0x2c')](_0x586c2e,_0xb855('0x29'));_0x2625c1[_0xb855('0x32')]=_['keys'](_0x595b2d[_0xb855('0x32')]);_0x2625c1[_0xb855('0x33')]=_['intersection'](_0x2625c1['model'],_0x2625c1[_0xb855('0x32')]);_0x17806c[_0xb855('0x34')]=_[_0xb855('0x35')](_0x2625c1[_0xb855('0x36')],qs[_0xb855('0x37')](_0x595b2d[_0xb855('0x32')][_0xb855('0x37')]));_0x17806c['attributes']=_0x17806c[_0xb855('0x34')]['length']?_0x17806c[_0xb855('0x34')]:_0x2625c1[_0xb855('0x36')];if(!_0x595b2d[_0xb855('0x32')]['hasOwnProperty'](_0xb855('0x38'))){_0x17806c[_0xb855('0x1c')]=qs[_0xb855('0x1c')](_0x595b2d[_0xb855('0x32')][_0xb855('0x1c')]);_0x17806c['offset']=qs[_0xb855('0x1a')](_0x595b2d[_0xb855('0x32')]['offset']);}_0x17806c[_0xb855('0x39')]=qs[_0xb855('0x3a')](_0x595b2d[_0xb855('0x32')][_0xb855('0x3a')]);_0x17806c[_0xb855('0x3b')]=qs[_0xb855('0x33')](_[_0xb855('0x3c')](_0x595b2d['query'],_0x2625c1[_0xb855('0x33')]),_0x586c2e);if(_0x595b2d[_0xb855('0x32')][_0xb855('0x3d')]){_0x17806c[_0xb855('0x3b')]=_[_0xb855('0x3e')](_0x17806c[_0xb855('0x3b')],{'$or':_['map'](_0x586c2e,function(_0x3e0362){if(_0x3e0362[_0xb855('0x30')]!==_0xb855('0x3f')){var _0x55b037={};_0x55b037[_0x3e0362[_0xb855('0x29')]]={'$like':'%'+_0x595b2d[_0xb855('0x32')][_0xb855('0x3d')]+'%'};return _0x55b037;}})});}_0x17806c=_[_0xb855('0x3e')]({},_0x17806c,_0x595b2d[_0xb855('0x40')]);var _0x449cce={'where':_0x17806c['where']};return db[_0xb855('0x2d')][_0xb855('0x1d')](_0x449cce)[_0xb855('0x24')](function(_0x5007e5){_0x50a33b[_0xb855('0x1d')]=_0x5007e5;if(_0x595b2d['query'][_0xb855('0x41')]){_0x17806c['include']=[{'all':!![]}];}return db[_0xb855('0x2d')][_0xb855('0x42')](_0x17806c);})['then'](function(_0x392848){_0x50a33b[_0xb855('0x43')]=_0x392848;return _0x50a33b;})['then'](respondWithFilteredResult(_0x48be65,_0x17806c))['catch'](handleError(_0x48be65,null));};exports[_0xb855('0x44')]=function(_0x5f0054,_0xb26341){var _0x1ca346={'raw':!![],'where':{'id':_0x5f0054[_0xb855('0x45')]['id']}},_0x48414b={};_0x48414b[_0xb855('0x36')]=_['keys'](db['MailSubstatus'][_0xb855('0x2e')]);_0x48414b['query']=_['keys'](_0x5f0054[_0xb855('0x32')]);_0x48414b[_0xb855('0x33')]=_['intersection'](_0x48414b[_0xb855('0x36')],_0x48414b[_0xb855('0x32')]);_0x1ca346['attributes']=_[_0xb855('0x35')](_0x48414b['model'],qs[_0xb855('0x37')](_0x5f0054['query'][_0xb855('0x37')]));_0x1ca346['attributes']=_0x1ca346[_0xb855('0x34')]['length']?_0x1ca346['attributes']:_0x48414b['model'];if(_0x5f0054[_0xb855('0x32')][_0xb855('0x41')]){_0x1ca346[_0xb855('0x46')]=[{'all':!![]}];}_0x1ca346=_[_0xb855('0x3e')]({},_0x1ca346,_0x5f0054[_0xb855('0x40')]);return db[_0xb855('0x2d')][_0xb855('0x47')](_0x1ca346)[_0xb855('0x24')](handleEntityNotFound(_0xb26341,null))[_0xb855('0x24')](respondWithResult(_0xb26341,null))[_0xb855('0x48')](handleError(_0xb26341,null));};exports['create']=function(_0x2b90d5,_0x408684){return db[_0xb855('0x2d')][_0xb855('0x49')](_0x2b90d5[_0xb855('0x4a')],{})[_0xb855('0x24')](respondWithResult(_0x408684,0xc9))[_0xb855('0x48')](handleError(_0x408684,null));};exports[_0xb855('0x23')]=function(_0xc07985,_0x11d5df){if(_0xc07985[_0xb855('0x4a')]['id']){delete _0xc07985['body']['id'];}return db[_0xb855('0x2d')]['find']({'where':{'id':_0xc07985[_0xb855('0x45')]['id']}})[_0xb855('0x24')](handleEntityNotFound(_0x11d5df,null))[_0xb855('0x24')](saveUpdates(_0xc07985[_0xb855('0x4a')],null))[_0xb855('0x24')](respondWithResult(_0x11d5df,null))[_0xb855('0x48')](handleError(_0x11d5df,null));};exports[_0xb855('0x25')]=function(_0x2419d8,_0x1edbd1){return db[_0xb855('0x2d')][_0xb855('0x47')]({'where':{'id':_0x2419d8[_0xb855('0x45')]['id']}})[_0xb855('0x24')](handleEntityNotFound(_0x1edbd1,null))[_0xb855('0x24')](removeEntity(_0x1edbd1,null))['catch'](handleError(_0x1edbd1,null));};exports[_0xb855('0x4b')]=function(_0x32c84b,_0x191962){return db[_0xb855('0x2d')]['describe']()[_0xb855('0x24')](respondWithResult(_0x191962,null))[_0xb855('0x48')](handleError(_0x191962,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index 952fb10..33252aa 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 _0xd3e0=['events','../../mysqldb','MailSubstatus','setMaxListeners','update','emit','hasOwnProperty','hook','exports'];(function(_0x10bb59,_0x3b6596){var _0x4d914a=function(_0x26a493){while(--_0x26a493){_0x10bb59['push'](_0x10bb59['shift']());}};_0x4d914a(++_0x3b6596);}(_0xd3e0,0x1cb));var _0x0d3e=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd3e0[_0x122ef9];return _0x42fba0;};'use strict';var EventEmitter=require(_0x0d3e('0x0'));var MailSubstatus=require(_0x0d3e('0x1'))['db'][_0x0d3e('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x0d3e('0x3')](0x0);var events={'afterUpdate':_0x0d3e('0x4')};function emitEvent(_0x2fa580){return function(_0x5b3134,_0xe916f3,_0x5804c7){MailSubstatusEvents[_0x0d3e('0x5')](_0x2fa580+':'+_0x5b3134['id'],_0x5b3134);MailSubstatusEvents['emit'](_0x2fa580,_0x5b3134);_0x5804c7(null);};}for(var e in events){if(events[_0x0d3e('0x6')](e)){var event=events[e];MailSubstatus[_0x0d3e('0x7')](e,emitEvent(event));}}module[_0x0d3e('0x8')]=MailSubstatusEvents; \ No newline at end of file +var _0x75a0=['events','../../mysqldb','setMaxListeners','update','emit','hasOwnProperty','hook','exports'];(function(_0x41a0be,_0x41d7ff){var _0x2bdc4e=function(_0x432262){while(--_0x432262){_0x41a0be['push'](_0x41a0be['shift']());}};_0x2bdc4e(++_0x41d7ff);}(_0x75a0,0x128));var _0x075a=function(_0x36610a,_0x5954f0){_0x36610a=_0x36610a-0x0;var _0x56e2ad=_0x75a0[_0x36610a];return _0x56e2ad;};'use strict';var EventEmitter=require(_0x075a('0x0'));var MailSubstatus=require(_0x075a('0x1'))['db']['MailSubstatus'];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x075a('0x2')](0x0);var events={'afterUpdate':_0x075a('0x3')};function emitEvent(_0xd4d63b){return function(_0x10ea6d,_0x1808ef,_0x1cfa75){MailSubstatusEvents['emit'](_0xd4d63b+':'+_0x10ea6d['id'],_0x10ea6d);MailSubstatusEvents[_0x075a('0x4')](_0xd4d63b,_0x10ea6d);_0x1cfa75(null);};}for(var e in events){if(events[_0x075a('0x5')](e)){var event=events[e];MailSubstatus[_0x075a('0x6')](e,emitEvent(event));}}module[_0x075a('0x7')]=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index edb7186..5d9f45d 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 _0x6caf=['name','catch','./mailSubstatus.attributes','models','define','MailSubstatus','Condition','update','mailSubstatus','_previousDataValues'];(function(_0x1ac8ad,_0x1f6e6b){var _0x5a5e88=function(_0x598ac7){while(--_0x598ac7){_0x1ac8ad['push'](_0x1ac8ad['shift']());}};_0x5a5e88(++_0x1f6e6b);}(_0x6caf,0x142));var _0xf6ca=function(_0x4c7b20,_0x361515){_0x4c7b20=_0x4c7b20-0x0;var _0x4872bd=_0x6caf[_0x4c7b20];return _0x4872bd;};'use strict';var attributes=require(_0xf6ca('0x0'));module['exports']=function(_0x508dc1){var _0x4ec6cb=_0x508dc1[_0xf6ca('0x1')];return _0x508dc1[_0xf6ca('0x2')](_0xf6ca('0x3'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x300e35,_0x37de90,_0x396ae0){return _0x4ec6cb[_0xf6ca('0x4')][_0xf6ca('0x5')]({'value':_0x300e35['name']},{'where':{'field':_0xf6ca('0x6'),'value':_0x300e35[_0xf6ca('0x7')][_0xf6ca('0x8')]}})['then'](function(){_0x396ae0();})[_0xf6ca('0x9')](function(_0x3db1cb){_0x396ae0(_0x3db1cb);});}}});}; \ No newline at end of file +var _0x51db=['name','mailSubstatus','_previousDataValues','then','catch','./mailSubstatus.attributes','exports','models','define','Condition','update'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x51db,0xb5));var _0xb51d=function(_0x48fd71,_0x41c6cb){_0x48fd71=_0x48fd71-0x0;var _0x21568c=_0x51db[_0x48fd71];return _0x21568c;};'use strict';var attributes=require(_0xb51d('0x0'));module[_0xb51d('0x1')]=function(_0x79b10b){var _0x11bf66=_0x79b10b[_0xb51d('0x2')];return _0x79b10b[_0xb51d('0x3')]('MailSubstatus',attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x2ec883,_0x1e541a,_0x3296b5){return _0x11bf66[_0xb51d('0x4')][_0xb51d('0x5')]({'value':_0x2ec883[_0xb51d('0x6')]},{'where':{'field':_0xb51d('0x7'),'value':_0x2ec883[_0xb51d('0x8')][_0xb51d('0x6')]}})[_0xb51d('0x9')](function(){_0x3296b5();})[_0xb51d('0xa')](function(_0x59de57){_0x3296b5(_0x59de57);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index efb9176..a397762 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 _0xdd5c=['debug','stringify','error','code','MailSubstatus,\x20%s,\x20%s','message','info','result','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','request\x20sent'];(function(_0x407d87,_0x528aa8){var _0x31ec1d=function(_0xa5af91){while(--_0xa5af91){_0x407d87['push'](_0x407d87['shift']());}};_0x31ec1d(++_0x528aa8);}(_0xdd5c,0xda));var _0xcdd5=function(_0x11b19b,_0x213234){_0x11b19b=_0x11b19b-0x0;var _0x1daac1=_0xdd5c[_0x11b19b];return _0x1daac1;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xcdd5('0x0'));var rs=require(_0xcdd5('0x1'));var fs=require('fs');var Redis=require(_0xcdd5('0x2'));var db=require(_0xcdd5('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xcdd5('0x4'))(_0xcdd5('0x5'));var config=require(_0xcdd5('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xcdd5('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x6f9591,_0xb6bc98,_0x31767d){return new BPromise(function(_0x45539e,_0x55ed69){return client[_0xcdd5('0x8')](_0x6f9591,_0x31767d)['then'](function(_0x1bcca2){logger['info']('MailSubstatus,\x20%s,\x20%s',_0xb6bc98,_0xcdd5('0x9'));logger[_0xcdd5('0xa')]('MailSubstatus,\x20%s,\x20%s,\x20%s',_0xb6bc98,_0xcdd5('0x9'),JSON[_0xcdd5('0xb')](_0x1bcca2));if(_0x1bcca2['error']){if(_0x1bcca2[_0xcdd5('0xc')][_0xcdd5('0xd')]===0x1f4){logger['error'](_0xcdd5('0xe'),_0xb6bc98,_0x1bcca2['error']['message']);return _0x55ed69(_0x1bcca2[_0xcdd5('0xc')][_0xcdd5('0xf')]);}logger[_0xcdd5('0xc')](_0xcdd5('0xe'),_0xb6bc98,_0x1bcca2[_0xcdd5('0xc')][_0xcdd5('0xf')]);return _0x45539e(_0x1bcca2[_0xcdd5('0xc')][_0xcdd5('0xf')]);}else{logger[_0xcdd5('0x10')](_0xcdd5('0xe'),_0xb6bc98,_0xcdd5('0x9'));_0x45539e(_0x1bcca2[_0xcdd5('0x11')][_0xcdd5('0xf')]);}})[_0xcdd5('0x12')](function(_0x1ea6e6){logger['error']('MailSubstatus,\x20%s,\x20%s',_0xb6bc98,_0x1ea6e6);_0x55ed69(_0x1ea6e6);});});} \ No newline at end of file +var _0xe5e7=['lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','message','catch'];(function(_0x2302ae,_0x3b25cc){var _0x4215f8=function(_0xf7ca2a){while(--_0xf7ca2a){_0x2302ae['push'](_0x2302ae['shift']());}};_0x4215f8(++_0x3b25cc);}(_0xe5e7,0x1ee));var _0x7e5e=function(_0x523662,_0xc51da9){_0x523662=_0x523662-0x0;var _0x8671b5=_0xe5e7[_0x523662];return _0x8671b5;};'use strict';var _=require(_0x7e5e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x7e5e('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7e5e('0x2'));var db=require(_0x7e5e('0x3'))['db'];var utils=require(_0x7e5e('0x4'));var logger=require(_0x7e5e('0x5'))(_0x7e5e('0x6'));var config=require(_0x7e5e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x7e5e('0x8')][_0x7e5e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x11001a,_0x778f5a,_0x147e41){return new BPromise(function(_0x1215f4,_0x5afab8){return client[_0x7e5e('0xa')](_0x11001a,_0x147e41)['then'](function(_0x1a65c3){logger[_0x7e5e('0xb')](_0x7e5e('0xc'),_0x778f5a,_0x7e5e('0xd'));logger['debug'](_0x7e5e('0xe'),_0x778f5a,_0x7e5e('0xd'),JSON[_0x7e5e('0xf')](_0x1a65c3));if(_0x1a65c3[_0x7e5e('0x10')]){if(_0x1a65c3[_0x7e5e('0x10')]['code']===0x1f4){logger['error'](_0x7e5e('0xc'),_0x778f5a,_0x1a65c3[_0x7e5e('0x10')][_0x7e5e('0x11')]);return _0x5afab8(_0x1a65c3[_0x7e5e('0x10')][_0x7e5e('0x11')]);}logger['error']('MailSubstatus,\x20%s,\x20%s',_0x778f5a,_0x1a65c3[_0x7e5e('0x10')]['message']);return _0x1215f4(_0x1a65c3[_0x7e5e('0x10')][_0x7e5e('0x11')]);}else{logger[_0x7e5e('0xb')](_0x7e5e('0xc'),_0x778f5a,_0x7e5e('0xd'));_0x1215f4(_0x1a65c3['result']['message']);}})[_0x7e5e('0x12')](function(_0x35a5dd){logger[_0x7e5e('0x10')](_0x7e5e('0xc'),_0x778f5a,_0x35a5dd);_0x5afab8(_0x35a5dd);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 58d4f95..3f10387 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 _0x63ee=['./mailTransferReport.controller','get','isAuthenticated','index','/describe','show','post','create','put','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x5f49a2,_0x54b7ed){var _0x2e49ac=function(_0x5d3c59){while(--_0x5d3c59){_0x5f49a2['push'](_0x5f49a2['shift']());}};_0x2e49ac(++_0x54b7ed);}(_0x63ee,0x16c));var _0xe63e=function(_0x538491,_0x43bae2){_0x538491=_0x538491-0x0;var _0x261ffa=_0x63ee[_0x538491];return _0x261ffa;};'use strict';var multer=require(_0xe63e('0x0'));var util=require(_0xe63e('0x1'));var path=require(_0xe63e('0x2'));var timeout=require(_0xe63e('0x3'));var express=require(_0xe63e('0x4'));var router=express[_0xe63e('0x5')]();var fs_extra=require(_0xe63e('0x6'));var auth=require(_0xe63e('0x7'));var interaction=require(_0xe63e('0x8'));var config=require(_0xe63e('0x9'));var controller=require(_0xe63e('0xa'));router[_0xe63e('0xb')]('/',auth[_0xe63e('0xc')](),controller[_0xe63e('0xd')]);router[_0xe63e('0xb')](_0xe63e('0xe'),auth[_0xe63e('0xc')](),controller['describe']);router[_0xe63e('0xb')]('/:id',auth[_0xe63e('0xc')](),controller[_0xe63e('0xf')]);router[_0xe63e('0x10')]('/',auth[_0xe63e('0xc')](),controller[_0xe63e('0x11')]);router[_0xe63e('0x12')](_0xe63e('0x13'),auth[_0xe63e('0xc')](),controller['update']);router['delete'](_0xe63e('0x13'),auth[_0xe63e('0xc')](),controller[_0xe63e('0x14')]);module[_0xe63e('0x15')]=router; \ No newline at end of file +var _0x1c10=['update','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','index','get','isAuthenticated','/:id','show','post','create'];(function(_0x22047a,_0x17fb4e){var _0x18858c=function(_0x4b595a){while(--_0x4b595a){_0x22047a['push'](_0x22047a['shift']());}};_0x18858c(++_0x17fb4e);}(_0x1c10,0x146));var _0x01c1=function(_0x3579dc,_0x31ed0b){_0x3579dc=_0x3579dc-0x0;var _0x326c0d=_0x1c10[_0x3579dc];return _0x326c0d;};'use strict';var multer=require(_0x01c1('0x0'));var util=require(_0x01c1('0x1'));var path=require(_0x01c1('0x2'));var timeout=require(_0x01c1('0x3'));var express=require('express');var router=express[_0x01c1('0x4')]();var fs_extra=require(_0x01c1('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x01c1('0x6'));var config=require('../../config/environment');var controller=require('./mailTransferReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x01c1('0x7')]);router[_0x01c1('0x8')]('/describe',auth[_0x01c1('0x9')](),controller['describe']);router[_0x01c1('0x8')](_0x01c1('0xa'),auth[_0x01c1('0x9')](),controller[_0x01c1('0xb')]);router[_0x01c1('0xc')]('/',auth[_0x01c1('0x9')](),controller[_0x01c1('0xd')]);router['put'](_0x01c1('0xa'),auth['isAuthenticated'](),controller[_0x01c1('0xe')]);router[_0x01c1('0xf')](_0x01c1('0xa'),auth[_0x01c1('0x9')](),controller[_0x01c1('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index d6859ef..fe1ec9b 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 _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0x38ce4c,_0xfdbe8c){var _0x5d4544=function(_0x503537){while(--_0x503537){_0x38ce4c['push'](_0x38ce4c['shift']());}};_0x5d4544(++_0xfdbe8c);}(_0x9bde,0xe1));var _0xe9bd=function(_0x62d67d,_0x43ab48){_0x62d67d=_0x62d67d-0x0;var _0x367212=_0x9bde[_0x62d67d];return _0x367212;};'use strict';var moment=require('moment');var Sequelize=require(_0xe9bd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe9bd('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe9bd('0x2'),_0xe9bd('0x3'),_0xe9bd('0x4')),'allowNull':![],'defaultValue':_0xe9bd('0x4')},'transferredAt':{'type':Sequelize[_0xe9bd('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xe9bd('0x6')]}}; \ No newline at end of file +var _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x28b951,_0x2825b0){var _0x37a82e=function(_0x3e831b){while(--_0x3e831b){_0x28b951['push'](_0x28b951['shift']());}};_0x37a82e(++_0x2825b0);}(_0x34e8,0x12c));var _0x834e=function(_0x10773a,_0xec0e37){_0x10773a=_0x10773a-0x0;var _0x3cf659=_0x34e8[_0x10773a];return _0x3cf659;};'use strict';var moment=require(_0x834e('0x0'));var Sequelize=require(_0x834e('0x1'));module[_0x834e('0x2')]={'uniqueid':{'type':Sequelize[_0x834e('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6')),'allowNull':![],'defaultValue':_0x834e('0x6')},'transferredAt':{'type':Sequelize[_0x834e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x834e('0x8')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index c9957d1..11863aa 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 _0x8d24=['type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','params','create','body','find','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../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','apply','reject','update','destroy','then','end','error','stack','name','send','index','map','MailTransferReport','rawAttributes','fieldName'];(function(_0x3fa7d3,_0x37f83c){var _0x4c51bd=function(_0x59e85b){while(--_0x59e85b){_0x3fa7d3['push'](_0x3fa7d3['shift']());}};_0x4c51bd(++_0x37f83c);}(_0x8d24,0x101));var _0x48d2=function(_0x89cb3a,_0x385fd1){_0x89cb3a=_0x89cb3a-0x0;var _0x407cf1=_0x8d24[_0x89cb3a];return _0x407cf1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x48d2('0x0'));var zipdir=require(_0x48d2('0x1'));var jsonpatch=require(_0x48d2('0x2'));var rp=require(_0x48d2('0x3'));var moment=require(_0x48d2('0x4'));var BPromise=require(_0x48d2('0x5'));var Mustache=require(_0x48d2('0x6'));var util=require(_0x48d2('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x48d2('0x8'));var ejs=require(_0x48d2('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x48d2('0xa'));var jsforce=require(_0x48d2('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x48d2('0x8'));var querystring=require(_0x48d2('0xc'));var Papa=require(_0x48d2('0xd'));var Redis=require(_0x48d2('0xe'));var authService=require(_0x48d2('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x48d2('0x10'));var hardwareService=require(_0x48d2('0x11'));var logger=require(_0x48d2('0x12'))(_0x48d2('0x13'));var utils=require(_0x48d2('0x14'));var config=require(_0x48d2('0x15'));var licenseUtil=require(_0x48d2('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xbd2f30,_0x327370){_0x327370=_0x327370||0xcc;return function(_0x30c3a4){if(_0x30c3a4){return _0xbd2f30[_0x48d2('0x17')](_0x327370);}return _0xbd2f30[_0x48d2('0x18')](_0x327370)['end']();};}function respondWithResult(_0x29ad7a,_0x3d1c1a){_0x3d1c1a=_0x3d1c1a||0xc8;return function(_0x4113da){if(_0x4113da){return _0x29ad7a['status'](_0x3d1c1a)[_0x48d2('0x19')](_0x4113da);}};}function respondWithFilteredResult(_0x2f2098,_0x2bb0e5){return function(_0x151c81){if(_0x151c81){var _0x304ffb=typeof _0x2bb0e5[_0x48d2('0x1a')]===_0x48d2('0x1b')&&typeof _0x2bb0e5[_0x48d2('0x1c')]===_0x48d2('0x1b');var _0x5e1702=_0x151c81['count'];var _0x989cd9=_0x304ffb?0x0:_0x2bb0e5[_0x48d2('0x1a')];var _0x50651d=_0x304ffb?_0x151c81[_0x48d2('0x1d')]:_0x2bb0e5[_0x48d2('0x1a')]+_0x2bb0e5[_0x48d2('0x1c')];var _0x2664cd;if(_0x50651d>=_0x5e1702){_0x50651d=_0x5e1702;_0x2664cd=0xc8;}else{_0x2664cd=0xce;}_0x2f2098[_0x48d2('0x18')](_0x2664cd);return _0x2f2098[_0x48d2('0x1e')](_0x48d2('0x1f'),_0x989cd9+'-'+_0x50651d+'/'+_0x5e1702)[_0x48d2('0x19')](_0x151c81);}return null;};}function patchUpdates(_0x42cf19){return function(_0x23dcb9){try{jsonpatch[_0x48d2('0x20')](_0x23dcb9,_0x42cf19,!![]);}catch(_0x236857){return BPromise[_0x48d2('0x21')](_0x236857);}return _0x23dcb9['save']();};}function saveUpdates(_0x260fba,_0x50df2c){return function(_0x25eecf){if(_0x25eecf){return _0x25eecf[_0x48d2('0x22')](_0x260fba)['then'](function(_0xc2e87a){return _0xc2e87a;});}return null;};}function removeEntity(_0x56f773,_0x3c2372){return function(_0xc8ee7c){if(_0xc8ee7c){return _0xc8ee7c[_0x48d2('0x23')]()[_0x48d2('0x24')](function(){_0x56f773[_0x48d2('0x18')](0xcc)[_0x48d2('0x25')]();});}};}function handleEntityNotFound(_0x4ad435,_0x3f61){return function(_0x1675c7){if(!_0x1675c7){_0x4ad435[_0x48d2('0x17')](0x194);}return _0x1675c7;};}function handleError(_0xb4cf7,_0x388b84){_0x388b84=_0x388b84||0x1f4;return function(_0x447164){logger[_0x48d2('0x26')](_0x447164[_0x48d2('0x27')]);if(_0x447164[_0x48d2('0x28')]){delete _0x447164[_0x48d2('0x28')];}_0xb4cf7[_0x48d2('0x18')](_0x388b84)[_0x48d2('0x29')](_0x447164);};}exports[_0x48d2('0x2a')]=function(_0x45144c,_0x266135){var _0x57ff52={},_0x2c792b={},_0x4c8268={'count':0x0,'rows':[]};var _0x525927=_[_0x48d2('0x2b')](db[_0x48d2('0x2c')][_0x48d2('0x2d')],function(_0x37edc4){return{'name':_0x37edc4[_0x48d2('0x2e')],'type':_0x37edc4[_0x48d2('0x2f')][_0x48d2('0x30')]};});_0x2c792b['model']=_['map'](_0x525927,_0x48d2('0x28'));_0x2c792b[_0x48d2('0x31')]=_[_0x48d2('0x32')](_0x45144c['query']);_0x2c792b[_0x48d2('0x33')]=_[_0x48d2('0x34')](_0x2c792b[_0x48d2('0x35')],_0x2c792b[_0x48d2('0x31')]);_0x57ff52[_0x48d2('0x36')]=_['intersection'](_0x2c792b[_0x48d2('0x35')],qs[_0x48d2('0x37')](_0x45144c[_0x48d2('0x31')][_0x48d2('0x37')]));_0x57ff52[_0x48d2('0x36')]=_0x57ff52[_0x48d2('0x36')][_0x48d2('0x38')]?_0x57ff52[_0x48d2('0x36')]:_0x2c792b[_0x48d2('0x35')];if(!_0x45144c[_0x48d2('0x31')][_0x48d2('0x39')](_0x48d2('0x3a'))){_0x57ff52['limit']=qs[_0x48d2('0x1c')](_0x45144c[_0x48d2('0x31')][_0x48d2('0x1c')]);_0x57ff52[_0x48d2('0x1a')]=qs['offset'](_0x45144c['query'][_0x48d2('0x1a')]);}_0x57ff52[_0x48d2('0x3b')]=qs['sort'](_0x45144c[_0x48d2('0x31')][_0x48d2('0x3c')]);_0x57ff52[_0x48d2('0x3d')]=qs[_0x48d2('0x33')](_[_0x48d2('0x3e')](_0x45144c[_0x48d2('0x31')],_0x2c792b[_0x48d2('0x33')]),_0x525927);if(_0x45144c['query'][_0x48d2('0x3f')]){_0x57ff52['where']=_['merge'](_0x57ff52[_0x48d2('0x3d')],{'$or':_[_0x48d2('0x2b')](_0x525927,function(_0x4b85c2){if(_0x4b85c2[_0x48d2('0x2f')]!==_0x48d2('0x40')){var _0x55b27b={};_0x55b27b[_0x4b85c2[_0x48d2('0x28')]]={'$like':'%'+_0x45144c['query']['filter']+'%'};return _0x55b27b;}})});}_0x57ff52=_[_0x48d2('0x41')]({},_0x57ff52,_0x45144c[_0x48d2('0x42')]);var _0x535812={'where':_0x57ff52['where']};return db[_0x48d2('0x2c')][_0x48d2('0x1d')](_0x535812)['then'](function(_0x2e5bdc){_0x4c8268[_0x48d2('0x1d')]=_0x2e5bdc;if(_0x45144c['query'][_0x48d2('0x43')]){_0x57ff52['include']=[{'all':!![]}];}return db[_0x48d2('0x2c')][_0x48d2('0x44')](_0x57ff52);})[_0x48d2('0x24')](function(_0x1bf11f){_0x4c8268[_0x48d2('0x45')]=_0x1bf11f;return _0x4c8268;})[_0x48d2('0x24')](respondWithFilteredResult(_0x266135,_0x57ff52))[_0x48d2('0x46')](handleError(_0x266135,null));};exports['show']=function(_0x1bdec9,_0xf65de2){var _0x971929={'raw':!![],'where':{'id':_0x1bdec9[_0x48d2('0x47')]['id']}},_0x3a902f={};_0x3a902f[_0x48d2('0x35')]=_[_0x48d2('0x32')](db[_0x48d2('0x2c')][_0x48d2('0x2d')]);_0x3a902f[_0x48d2('0x31')]=_['keys'](_0x1bdec9[_0x48d2('0x31')]);_0x3a902f['filters']=_['intersection'](_0x3a902f['model'],_0x3a902f['query']);_0x971929[_0x48d2('0x36')]=_[_0x48d2('0x34')](_0x3a902f[_0x48d2('0x35')],qs[_0x48d2('0x37')](_0x1bdec9[_0x48d2('0x31')][_0x48d2('0x37')]));_0x971929[_0x48d2('0x36')]=_0x971929['attributes'][_0x48d2('0x38')]?_0x971929[_0x48d2('0x36')]:_0x3a902f[_0x48d2('0x35')];if(_0x1bdec9[_0x48d2('0x31')][_0x48d2('0x43')]){_0x971929['include']=[{'all':!![]}];}_0x971929=_[_0x48d2('0x41')]({},_0x971929,_0x1bdec9[_0x48d2('0x42')]);return db[_0x48d2('0x2c')]['find'](_0x971929)[_0x48d2('0x24')](handleEntityNotFound(_0xf65de2,null))[_0x48d2('0x24')](respondWithResult(_0xf65de2,null))['catch'](handleError(_0xf65de2,null));};exports[_0x48d2('0x48')]=function(_0x21a961,_0x355b38){return db[_0x48d2('0x2c')][_0x48d2('0x48')](_0x21a961[_0x48d2('0x49')],{})[_0x48d2('0x24')](respondWithResult(_0x355b38,0xc9))[_0x48d2('0x46')](handleError(_0x355b38,null));};exports['update']=function(_0x2717b6,_0x77b75){if(_0x2717b6[_0x48d2('0x49')]['id']){delete _0x2717b6[_0x48d2('0x49')]['id'];}return db['MailTransferReport'][_0x48d2('0x4a')]({'where':{'id':_0x2717b6['params']['id']}})[_0x48d2('0x24')](handleEntityNotFound(_0x77b75,null))['then'](saveUpdates(_0x2717b6[_0x48d2('0x49')],null))[_0x48d2('0x24')](respondWithResult(_0x77b75,null))[_0x48d2('0x46')](handleError(_0x77b75,null));};exports[_0x48d2('0x23')]=function(_0x3225d0,_0x1e56bc){return db[_0x48d2('0x2c')]['find']({'where':{'id':_0x3225d0[_0x48d2('0x47')]['id']}})[_0x48d2('0x24')](handleEntityNotFound(_0x1e56bc,null))[_0x48d2('0x24')](removeEntity(_0x1e56bc,null))[_0x48d2('0x46')](handleError(_0x1e56bc,null));};exports[_0x48d2('0x4b')]=function(_0xc1b6c6,_0x1f2ac0){return db[_0x48d2('0x2c')]['describe']()[_0x48d2('0x24')](respondWithResult(_0x1f2ac0,null))[_0x48d2('0x46')](handleError(_0x1f2ac0,null));}; \ No newline at end of file +var _0xd5f8=['mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','end','error','stack','name','send','index','MailTransferReport','rawAttributes','fieldName','key','model','keys','filters','intersection','query','fields','attributes','nolimit','order','sort','where','pick','merge','map','type','includeAll','findAll','catch','show','length','include','find','create','body','params','describe','eml-format','zip-dir','request-promise','bluebird'];(function(_0x363bc4,_0x3211d8){var _0x1665f3=function(_0x24840b){while(--_0x24840b){_0x363bc4['push'](_0x363bc4['shift']());}};_0x1665f3(++_0x3211d8);}(_0xd5f8,0xda));var _0x8d5f=function(_0x1b58cf,_0x54246b){_0x1b58cf=_0x1b58cf-0x0;var _0x221cfe=_0xd5f8[_0x1b58cf];return _0x221cfe;};'use strict';var emlformat=require(_0x8d5f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8d5f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8d5f('0x2'));var moment=require('moment');var BPromise=require(_0x8d5f('0x3'));var Mustache=require(_0x8d5f('0x4'));var util=require(_0x8d5f('0x5'));var path=require(_0x8d5f('0x6'));var sox=require(_0x8d5f('0x7'));var csv=require(_0x8d5f('0x8'));var ejs=require(_0x8d5f('0x9'));var fs=require('fs');var fs_extra=require(_0x8d5f('0xa'));var _=require(_0x8d5f('0xb'));var squel=require(_0x8d5f('0xc'));var crypto=require(_0x8d5f('0xd'));var jsforce=require(_0x8d5f('0xe'));var deskjs=require(_0x8d5f('0xf'));var toCsv=require(_0x8d5f('0x8'));var querystring=require('querystring');var Papa=require(_0x8d5f('0x10'));var Redis=require(_0x8d5f('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x8d5f('0x12'));var as=require(_0x8d5f('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8d5f('0x14'))(_0x8d5f('0x15'));var utils=require('../../config/utils');var config=require(_0x8d5f('0x16'));var licenseUtil=require(_0x8d5f('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x51dc18,_0x59b587){_0x59b587=_0x59b587||0xcc;return function(_0x2895ab){if(_0x2895ab){return _0x51dc18[_0x8d5f('0x18')](_0x59b587);}return _0x51dc18[_0x8d5f('0x19')](_0x59b587)['end']();};}function respondWithResult(_0x152129,_0x5f51cb){_0x5f51cb=_0x5f51cb||0xc8;return function(_0x55a797){if(_0x55a797){return _0x152129[_0x8d5f('0x19')](_0x5f51cb)[_0x8d5f('0x1a')](_0x55a797);}};}function respondWithFilteredResult(_0x43814a,_0x32e0eb){return function(_0x4f4747){if(_0x4f4747){var _0x341d5d=typeof _0x32e0eb['offset']===_0x8d5f('0x1b')&&typeof _0x32e0eb['limit']===_0x8d5f('0x1b');var _0x1d55e5=_0x4f4747[_0x8d5f('0x1c')];var _0x15a558=_0x341d5d?0x0:_0x32e0eb['offset'];var _0x46c73d=_0x341d5d?_0x4f4747[_0x8d5f('0x1c')]:_0x32e0eb[_0x8d5f('0x1d')]+_0x32e0eb[_0x8d5f('0x1e')];var _0x298dc9;if(_0x46c73d>=_0x1d55e5){_0x46c73d=_0x1d55e5;_0x298dc9=0xc8;}else{_0x298dc9=0xce;}_0x43814a[_0x8d5f('0x19')](_0x298dc9);return _0x43814a[_0x8d5f('0x1f')](_0x8d5f('0x20'),_0x15a558+'-'+_0x46c73d+'/'+_0x1d55e5)[_0x8d5f('0x1a')](_0x4f4747);}return null;};}function patchUpdates(_0x4beead){return function(_0x2ea7d0){try{jsonpatch[_0x8d5f('0x21')](_0x2ea7d0,_0x4beead,!![]);}catch(_0x364034){return BPromise['reject'](_0x364034);}return _0x2ea7d0[_0x8d5f('0x22')]();};}function saveUpdates(_0x30a367,_0x4242da){return function(_0x45b5bf){if(_0x45b5bf){return _0x45b5bf[_0x8d5f('0x23')](_0x30a367)[_0x8d5f('0x24')](function(_0x400cfb){return _0x400cfb;});}return null;};}function removeEntity(_0x4b90d2,_0x568c3d){return function(_0xb6c9fc){if(_0xb6c9fc){return _0xb6c9fc[_0x8d5f('0x25')]()[_0x8d5f('0x24')](function(){_0x4b90d2[_0x8d5f('0x19')](0xcc)[_0x8d5f('0x26')]();});}};}function handleEntityNotFound(_0x1b38d3,_0x2609d5){return function(_0x3e397b){if(!_0x3e397b){_0x1b38d3[_0x8d5f('0x18')](0x194);}return _0x3e397b;};}function handleError(_0xad8bc0,_0x57097f){_0x57097f=_0x57097f||0x1f4;return function(_0x46ab10){logger[_0x8d5f('0x27')](_0x46ab10[_0x8d5f('0x28')]);if(_0x46ab10[_0x8d5f('0x29')]){delete _0x46ab10[_0x8d5f('0x29')];}_0xad8bc0[_0x8d5f('0x19')](_0x57097f)[_0x8d5f('0x2a')](_0x46ab10);};}exports[_0x8d5f('0x2b')]=function(_0x18ef8d,_0x137d56){var _0x3a347b={},_0x145da9={},_0x567fec={'count':0x0,'rows':[]};var _0x1c596b=_['map'](db[_0x8d5f('0x2c')][_0x8d5f('0x2d')],function(_0x2c1728){return{'name':_0x2c1728[_0x8d5f('0x2e')],'type':_0x2c1728['type'][_0x8d5f('0x2f')]};});_0x145da9[_0x8d5f('0x30')]=_['map'](_0x1c596b,_0x8d5f('0x29'));_0x145da9['query']=_[_0x8d5f('0x31')](_0x18ef8d['query']);_0x145da9[_0x8d5f('0x32')]=_[_0x8d5f('0x33')](_0x145da9[_0x8d5f('0x30')],_0x145da9[_0x8d5f('0x34')]);_0x3a347b['attributes']=_[_0x8d5f('0x33')](_0x145da9[_0x8d5f('0x30')],qs[_0x8d5f('0x35')](_0x18ef8d[_0x8d5f('0x34')][_0x8d5f('0x35')]));_0x3a347b[_0x8d5f('0x36')]=_0x3a347b[_0x8d5f('0x36')]['length']?_0x3a347b[_0x8d5f('0x36')]:_0x145da9['model'];if(!_0x18ef8d[_0x8d5f('0x34')]['hasOwnProperty'](_0x8d5f('0x37'))){_0x3a347b[_0x8d5f('0x1e')]=qs[_0x8d5f('0x1e')](_0x18ef8d[_0x8d5f('0x34')][_0x8d5f('0x1e')]);_0x3a347b[_0x8d5f('0x1d')]=qs['offset'](_0x18ef8d[_0x8d5f('0x34')][_0x8d5f('0x1d')]);}_0x3a347b[_0x8d5f('0x38')]=qs['sort'](_0x18ef8d['query'][_0x8d5f('0x39')]);_0x3a347b[_0x8d5f('0x3a')]=qs[_0x8d5f('0x32')](_[_0x8d5f('0x3b')](_0x18ef8d[_0x8d5f('0x34')],_0x145da9[_0x8d5f('0x32')]),_0x1c596b);if(_0x18ef8d[_0x8d5f('0x34')]['filter']){_0x3a347b[_0x8d5f('0x3a')]=_[_0x8d5f('0x3c')](_0x3a347b[_0x8d5f('0x3a')],{'$or':_[_0x8d5f('0x3d')](_0x1c596b,function(_0x33f5f1){if(_0x33f5f1[_0x8d5f('0x3e')]!=='VIRTUAL'){var _0x296442={};_0x296442[_0x33f5f1['name']]={'$like':'%'+_0x18ef8d[_0x8d5f('0x34')]['filter']+'%'};return _0x296442;}})});}_0x3a347b=_[_0x8d5f('0x3c')]({},_0x3a347b,_0x18ef8d['options']);var _0x1c692a={'where':_0x3a347b[_0x8d5f('0x3a')]};return db['MailTransferReport'][_0x8d5f('0x1c')](_0x1c692a)['then'](function(_0x45a1ac){_0x567fec[_0x8d5f('0x1c')]=_0x45a1ac;if(_0x18ef8d[_0x8d5f('0x34')][_0x8d5f('0x3f')]){_0x3a347b['include']=[{'all':!![]}];}return db[_0x8d5f('0x2c')][_0x8d5f('0x40')](_0x3a347b);})[_0x8d5f('0x24')](function(_0x5d5d5b){_0x567fec['rows']=_0x5d5d5b;return _0x567fec;})[_0x8d5f('0x24')](respondWithFilteredResult(_0x137d56,_0x3a347b))[_0x8d5f('0x41')](handleError(_0x137d56,null));};exports[_0x8d5f('0x42')]=function(_0x1937ee,_0x2efda8){var _0x3ffebd={'raw':!![],'where':{'id':_0x1937ee['params']['id']}},_0x42a01b={};_0x42a01b[_0x8d5f('0x30')]=_['keys'](db[_0x8d5f('0x2c')]['rawAttributes']);_0x42a01b[_0x8d5f('0x34')]=_[_0x8d5f('0x31')](_0x1937ee[_0x8d5f('0x34')]);_0x42a01b[_0x8d5f('0x32')]=_[_0x8d5f('0x33')](_0x42a01b[_0x8d5f('0x30')],_0x42a01b[_0x8d5f('0x34')]);_0x3ffebd[_0x8d5f('0x36')]=_[_0x8d5f('0x33')](_0x42a01b[_0x8d5f('0x30')],qs[_0x8d5f('0x35')](_0x1937ee['query'][_0x8d5f('0x35')]));_0x3ffebd[_0x8d5f('0x36')]=_0x3ffebd[_0x8d5f('0x36')][_0x8d5f('0x43')]?_0x3ffebd[_0x8d5f('0x36')]:_0x42a01b[_0x8d5f('0x30')];if(_0x1937ee[_0x8d5f('0x34')][_0x8d5f('0x3f')]){_0x3ffebd[_0x8d5f('0x44')]=[{'all':!![]}];}_0x3ffebd=_[_0x8d5f('0x3c')]({},_0x3ffebd,_0x1937ee['options']);return db['MailTransferReport'][_0x8d5f('0x45')](_0x3ffebd)[_0x8d5f('0x24')](handleEntityNotFound(_0x2efda8,null))[_0x8d5f('0x24')](respondWithResult(_0x2efda8,null))[_0x8d5f('0x41')](handleError(_0x2efda8,null));};exports[_0x8d5f('0x46')]=function(_0x40e9da,_0x4b4adc){return db[_0x8d5f('0x2c')]['create'](_0x40e9da[_0x8d5f('0x47')],{})['then'](respondWithResult(_0x4b4adc,0xc9))['catch'](handleError(_0x4b4adc,null));};exports['update']=function(_0x2d7d13,_0x37f022){if(_0x2d7d13[_0x8d5f('0x47')]['id']){delete _0x2d7d13[_0x8d5f('0x47')]['id'];}return db[_0x8d5f('0x2c')][_0x8d5f('0x45')]({'where':{'id':_0x2d7d13[_0x8d5f('0x48')]['id']}})[_0x8d5f('0x24')](handleEntityNotFound(_0x37f022,null))[_0x8d5f('0x24')](saveUpdates(_0x2d7d13[_0x8d5f('0x47')],null))['then'](respondWithResult(_0x37f022,null))[_0x8d5f('0x41')](handleError(_0x37f022,null));};exports[_0x8d5f('0x25')]=function(_0x133556,_0x46dc77){return db['MailTransferReport'][_0x8d5f('0x45')]({'where':{'id':_0x133556[_0x8d5f('0x48')]['id']}})[_0x8d5f('0x24')](handleEntityNotFound(_0x46dc77,null))[_0x8d5f('0x24')](removeEntity(_0x46dc77,null))[_0x8d5f('0x41')](handleError(_0x46dc77,null));};exports[_0x8d5f('0x49')]=function(_0x2ff5bd,_0x50b773){return db[_0x8d5f('0x2c')]['describe']()[_0x8d5f('0x24')](respondWithResult(_0x50b773,null))[_0x8d5f('0x41')](handleError(_0x50b773,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 36fc186..ed34837 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 _0x82a7=['define','MailTransferReport','report_mail_transfer','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./mailTransferReport.attributes','exports'];(function(_0xd578cb,_0x2167a3){var _0x775533=function(_0x1c340d){while(--_0x1c340d){_0xd578cb['push'](_0xd578cb['shift']());}};_0x775533(++_0x2167a3);}(_0x82a7,0x1c4));var _0x782a=function(_0x4aa6a5,_0x5713fb){_0x4aa6a5=_0x4aa6a5-0x0;var _0x301ea0=_0x82a7[_0x4aa6a5];return _0x301ea0;};'use strict';var _=require('lodash');var util=require(_0x782a('0x0'));var logger=require(_0x782a('0x1'))(_0x782a('0x2'));var moment=require(_0x782a('0x3'));var BPromise=require(_0x782a('0x4'));var rp=require(_0x782a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x782a('0x6'));var config=require(_0x782a('0x7'));var attributes=require(_0x782a('0x8'));module[_0x782a('0x9')]=function(_0x2fc0df,_0x2c5ea1){return _0x2fc0df[_0x782a('0xa')](_0x782a('0xb'),attributes,{'tableName':_0x782a('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x782a('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x639d=['lodash','util','../../config/logger','moment','bluebird','path','../../config/environment','define','MailTransferReport','report_mail_transfer','uniqueid'];(function(_0x5df061,_0x400a05){var _0x5a4ef6=function(_0x224a94){while(--_0x224a94){_0x5df061['push'](_0x5df061['shift']());}};_0x5a4ef6(++_0x400a05);}(_0x639d,0xbb));var _0xd639=function(_0x2dc060,_0x38523a){_0x2dc060=_0x2dc060-0x0;var _0x50a172=_0x639d[_0x2dc060];return _0x50a172;};'use strict';var _=require(_0xd639('0x0'));var util=require(_0xd639('0x1'));var logger=require(_0xd639('0x2'))('api');var moment=require(_0xd639('0x3'));var BPromise=require(_0xd639('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd639('0x5'));var rimraf=require('rimraf');var config=require(_0xd639('0x6'));var attributes=require('./mailTransferReport.attributes');module['exports']=function(_0x2a71b9,_0x1cebd4){return _0x2a71b9[_0xd639('0x7')](_0xd639('0x8'),attributes,{'tableName':_0xd639('0x9'),'paranoid':![],'indexes':[{'name':_0xd639('0xa'),'fields':[_0xd639('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 493330b..99a22da 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 _0x3292=['error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x43b227,_0x7ec976){var _0x5aa13c=function(_0x5c00af){while(--_0x5c00af){_0x43b227['push'](_0x43b227['shift']());}};_0x5aa13c(++_0x7ec976);}(_0x3292,0x131));var _0x2329=function(_0x2d061e,_0x1d7fd3){_0x2d061e=_0x2d061e-0x0;var _0xd9aa55=_0x3292[_0x2d061e];return _0xd9aa55;};'use strict';var _=require(_0x2329('0x0'));var util=require(_0x2329('0x1'));var moment=require(_0x2329('0x2'));var BPromise=require(_0x2329('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2329('0x4'));var db=require(_0x2329('0x5'))['db'];var utils=require(_0x2329('0x6'));var logger=require(_0x2329('0x7'))(_0x2329('0x8'));var config=require(_0x2329('0x9'));var jayson=require(_0x2329('0xa'));var client=jayson[_0x2329('0xb')][_0x2329('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4cd4fd,_0x4d1bb0,_0x36ef87){return new BPromise(function(_0x1b3bef,_0x386cfe){return client[_0x2329('0xd')](_0x4cd4fd,_0x36ef87)[_0x2329('0xe')](function(_0xd34248){logger[_0x2329('0xf')](_0x2329('0x10'),_0x4d1bb0,_0x2329('0x11'));logger['debug'](_0x2329('0x12'),_0x4d1bb0,_0x2329('0x11'),JSON[_0x2329('0x13')](_0xd34248));if(_0xd34248['error']){if(_0xd34248[_0x2329('0x14')][_0x2329('0x15')]===0x1f4){logger['error'](_0x2329('0x10'),_0x4d1bb0,_0xd34248[_0x2329('0x14')][_0x2329('0x16')]);return _0x386cfe(_0xd34248['error'][_0x2329('0x16')]);}logger[_0x2329('0x14')](_0x2329('0x10'),_0x4d1bb0,_0xd34248[_0x2329('0x14')][_0x2329('0x16')]);return _0x1b3bef(_0xd34248['error'][_0x2329('0x16')]);}else{logger[_0x2329('0xf')](_0x2329('0x10'),_0x4d1bb0,'request\x20sent');_0x1b3bef(_0xd34248[_0x2329('0x17')]['message']);}})[_0x2329('0x18')](function(_0x472c10){logger['error'](_0x2329('0x10'),_0x4d1bb0,_0x472c10);_0x386cfe(_0x472c10);});});} \ No newline at end of file +var _0x7ee0=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4dfde6,_0x5adc3e){var _0x250d34=function(_0x84d8be){while(--_0x84d8be){_0x4dfde6['push'](_0x4dfde6['shift']());}};_0x250d34(++_0x5adc3e);}(_0x7ee0,0x123));var _0x07ee=function(_0x35d6ad,_0x392906){_0x35d6ad=_0x35d6ad-0x0;var _0x204ef7=_0x7ee0[_0x35d6ad];return _0x204ef7;};'use strict';var _=require('lodash');var util=require(_0x07ee('0x0'));var moment=require('moment');var BPromise=require(_0x07ee('0x1'));var rs=require(_0x07ee('0x2'));var fs=require('fs');var Redis=require(_0x07ee('0x3'));var db=require(_0x07ee('0x4'))['db'];var utils=require(_0x07ee('0x5'));var logger=require(_0x07ee('0x6'))(_0x07ee('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x07ee('0x8')][_0x07ee('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xdbdfb5,_0x37b6f6,_0xbd8b46){return new BPromise(function(_0x1f938c,_0x5add8d){return client[_0x07ee('0xa')](_0xdbdfb5,_0xbd8b46)[_0x07ee('0xb')](function(_0x4bbf4b){logger[_0x07ee('0xc')](_0x07ee('0xd'),_0x37b6f6,_0x07ee('0xe'));logger['debug'](_0x07ee('0xf'),_0x37b6f6,'request\x20sent',JSON[_0x07ee('0x10')](_0x4bbf4b));if(_0x4bbf4b[_0x07ee('0x11')]){if(_0x4bbf4b[_0x07ee('0x11')][_0x07ee('0x12')]===0x1f4){logger['error'](_0x07ee('0xd'),_0x37b6f6,_0x4bbf4b[_0x07ee('0x11')][_0x07ee('0x13')]);return _0x5add8d(_0x4bbf4b[_0x07ee('0x11')]['message']);}logger['error'](_0x07ee('0xd'),_0x37b6f6,_0x4bbf4b[_0x07ee('0x11')]['message']);return _0x1f938c(_0x4bbf4b[_0x07ee('0x11')][_0x07ee('0x13')]);}else{logger['info'](_0x07ee('0xd'),_0x37b6f6,_0x07ee('0xe'));_0x1f938c(_0x4bbf4b[_0x07ee('0x14')]['message']);}})[_0x07ee('0x15')](function(_0x4949b2){logger[_0x07ee('0x11')](_0x07ee('0xd'),_0x37b6f6,_0x4949b2);_0x5add8d(_0x4949b2);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 0ad5f5b..91c95f4 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 _0xe7d6=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','index','get','describe','/:id','isAuthenticated','show','create','put','delete','destroy','exports','util','connect-timeout','express'];(function(_0x4fea8d,_0x5c85d4){var _0x110b8c=function(_0x449ae3){while(--_0x449ae3){_0x4fea8d['push'](_0x4fea8d['shift']());}};_0x110b8c(++_0x5c85d4);}(_0xe7d6,0xa8));var _0x6e7d=function(_0x7de33e,_0x46a873){_0x7de33e=_0x7de33e-0x0;var _0x9b0f8=_0xe7d6[_0x7de33e];return _0x9b0f8;};'use strict';var multer=require('multer');var util=require(_0x6e7d('0x0'));var path=require('path');var timeout=require(_0x6e7d('0x1'));var express=require(_0x6e7d('0x2'));var router=express['Router']();var fs_extra=require(_0x6e7d('0x3'));var auth=require(_0x6e7d('0x4'));var interaction=require(_0x6e7d('0x5'));var config=require(_0x6e7d('0x6'));var controller=require(_0x6e7d('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x6e7d('0x8')]);router[_0x6e7d('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x6e7d('0xa')]);router['get'](_0x6e7d('0xb'),auth[_0x6e7d('0xc')](),controller[_0x6e7d('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x6e7d('0xe')]);router[_0x6e7d('0xf')](_0x6e7d('0xb'),auth[_0x6e7d('0xc')](),controller['update']);router[_0x6e7d('0x10')](_0x6e7d('0xb'),auth['isAuthenticated'](),controller[_0x6e7d('0x11')]);module[_0x6e7d('0x12')]=router; \ No newline at end of file +var _0xb67b=['put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show'];(function(_0x15b277,_0x48e918){var _0x4d07b0=function(_0x49dd6b){while(--_0x49dd6b){_0x15b277['push'](_0x15b277['shift']());}};_0x4d07b0(++_0x48e918);}(_0xb67b,0x191));var _0xbb67=function(_0x258b93,_0x188ccc){_0x258b93=_0x258b93-0x0;var _0x35484b=_0xb67b[_0x258b93];return _0x35484b;};'use strict';var multer=require(_0xbb67('0x0'));var util=require('util');var path=require(_0xbb67('0x1'));var timeout=require(_0xbb67('0x2'));var express=require(_0xbb67('0x3'));var router=express[_0xbb67('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xbb67('0x5'));var controller=require('./memberReport.controller');router[_0xbb67('0x6')]('/',auth['isAuthenticated'](),controller[_0xbb67('0x7')]);router['get'](_0xbb67('0x8'),auth[_0xbb67('0x9')](),controller[_0xbb67('0xa')]);router[_0xbb67('0x6')](_0xbb67('0xb'),auth[_0xbb67('0x9')](),controller[_0xbb67('0xc')]);router['post']('/',auth[_0xbb67('0x9')](),controller['create']);router[_0xbb67('0xd')](_0xbb67('0xb'),auth[_0xbb67('0x9')](),controller[_0xbb67('0xe')]);router[_0xbb67('0xf')]('/:id',auth[_0xbb67('0x9')](),controller[_0xbb67('0x10')]);module[_0xbb67('0x11')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 78126d0..4adf113 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 _0x48bf=['talk:[destination]','talk:[dial\x20string]','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','enterAt','diff','seconds','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]'];(function(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0x48bf,0x92));var _0xf48b=function(_0x390143,_0x2b54ac){_0x390143=_0x390143-0x0;var _0x11361b=_0x48bf[_0x390143];return _0x11361b;};'use strict';var Sequelize=require(_0xf48b('0x0'));var moment=require(_0xf48b('0x1'));module[_0xf48b('0x2')]={'channel':{'type':Sequelize[_0xf48b('0x3')]},'membername':{'type':Sequelize[_0xf48b('0x3')]},'interface':{'type':Sequelize[_0xf48b('0x3')]},'type':{'type':Sequelize[_0xf48b('0x3')],'defaultValue':_0xf48b('0x4'),'comment':_0xf48b('0x5')},'duration':{'type':Sequelize[_0xf48b('0x6')]},'enterAt':{'type':Sequelize[_0xf48b('0x7')]},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x33492f){var _0x4d557c=moment(_0x33492f);var _0x3d1a2d=moment(this['getDataValue'](_0xf48b('0x8')));var _0x3096c6=_0x4d557c[_0xf48b('0x9')](_0x3d1a2d,_0xf48b('0xa'));this[_0xf48b('0xb')](_0xf48b('0xc'),_0x33492f);this[_0xf48b('0xb')](_0xf48b('0xd'),_0x3096c6>=0x0?_0x3096c6:null);}},'data1':{'type':Sequelize['STRING'],'comment':_0xf48b('0xe')},'data2':{'type':Sequelize['STRING'],'comment':_0xf48b('0xf')},'data3':{'type':Sequelize['STRING'],'comment':_0xf48b('0x10')},'data4':{'type':Sequelize[_0xf48b('0x3')],'comment':_0xf48b('0x11')},'data5':{'type':Sequelize[_0xf48b('0x3')],'comment':'talk:[queue]'},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize[_0xf48b('0x6')]},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc126=['DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','diff','setDataValue','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[queue]','sequelize','moment','exports','STRING'];(function(_0x53a637,_0x105cc3){var _0x2736de=function(_0x5e92d5){while(--_0x5e92d5){_0x53a637['push'](_0x53a637['shift']());}};_0x2736de(++_0x105cc3);}(_0xc126,0xdc));var _0x6c12=function(_0x52d075,_0x11abf7){_0x52d075=_0x52d075-0x0;var _0x47a21e=_0xc126[_0x52d075];return _0x47a21e;};'use strict';var Sequelize=require(_0x6c12('0x0'));var moment=require(_0x6c12('0x1'));module[_0x6c12('0x2')]={'channel':{'type':Sequelize[_0x6c12('0x3')]},'membername':{'type':Sequelize[_0x6c12('0x3')]},'interface':{'type':Sequelize[_0x6c12('0x3')]},'type':{'type':Sequelize[_0x6c12('0x3')],'defaultValue':_0x6c12('0x4'),'comment':_0x6c12('0x5')},'duration':{'type':Sequelize[_0x6c12('0x6')]},'enterAt':{'type':Sequelize[_0x6c12('0x7')]},'exitAt':{'type':Sequelize[_0x6c12('0x7')],'set':function(_0x23b041){var _0x1d8fcf=moment(_0x23b041);var _0x25f1cc=moment(this[_0x6c12('0x8')]('enterAt'));var _0x249f80=_0x1d8fcf[_0x6c12('0x9')](_0x25f1cc,'seconds');this[_0x6c12('0xa')]('exitAt',_0x23b041);this[_0x6c12('0xa')](_0x6c12('0xb'),_0x249f80>=0x0?_0x249f80:null);}},'data1':{'type':Sequelize['STRING'],'comment':_0x6c12('0xc')},'data2':{'type':Sequelize['STRING'],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0x6c12('0x3')],'comment':'talk:[destination]'},'data4':{'type':Sequelize[_0x6c12('0x3')],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize[_0x6c12('0x3')],'comment':_0x6c12('0xd')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize[_0x6c12('0x6')]},'uniqueid':{'type':Sequelize[_0x6c12('0x3')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 0c2369e..07ce288 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(_0x3c4a7c,_0x2f4e3c){var _0xf13d1e=function(_0x24cb78){while(--_0x24cb78){_0x3c4a7c['push'](_0x3c4a7c['shift']());}};_0xf13d1e(++_0x2f4e3c);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'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 _0x7217=['query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','merge','filter','includeAll','include','rows','catch','show','params','rawAttributes','length','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','send','index','map','MemberReport','fieldName','type','model','name','keys'];(function(_0x1292c7,_0x406e8e){var _0x8e4cbb=function(_0x39f9cb){while(--_0x39f9cb){_0x1292c7['push'](_0x1292c7['shift']());}};_0x8e4cbb(++_0x406e8e);}(_0x7217,0x19e));var _0x7721=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x7217[_0x4243a3];return _0x1b2a33;};'use strict';var emlformat=require(_0x7721('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7721('0x1'));var jsonpatch=require(_0x7721('0x2'));var rp=require(_0x7721('0x3'));var moment=require(_0x7721('0x4'));var BPromise=require(_0x7721('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7721('0x6'));var sox=require(_0x7721('0x7'));var csv=require(_0x7721('0x8'));var ejs=require(_0x7721('0x9'));var fs=require('fs');var fs_extra=require(_0x7721('0xa'));var _=require(_0x7721('0xb'));var squel=require(_0x7721('0xc'));var crypto=require(_0x7721('0xd'));var jsforce=require(_0x7721('0xe'));var deskjs=require(_0x7721('0xf'));var toCsv=require(_0x7721('0x8'));var querystring=require(_0x7721('0x10'));var Papa=require(_0x7721('0x11'));var Redis=require(_0x7721('0x12'));var authService=require(_0x7721('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x7721('0x14'));var hardwareService=require(_0x7721('0x15'));var logger=require(_0x7721('0x16'))(_0x7721('0x17'));var utils=require(_0x7721('0x18'));var config=require(_0x7721('0x19'));var licenseUtil=require(_0x7721('0x1a'));var db=require(_0x7721('0x1b'))['db'];function respondWithStatusCode(_0x55b4ca,_0x2911ec){_0x2911ec=_0x2911ec||0xcc;return function(_0x199930){if(_0x199930){return _0x55b4ca['sendStatus'](_0x2911ec);}return _0x55b4ca[_0x7721('0x1c')](_0x2911ec)[_0x7721('0x1d')]();};}function respondWithResult(_0x3f01c5,_0x2e9752){_0x2e9752=_0x2e9752||0xc8;return function(_0x5069da){if(_0x5069da){return _0x3f01c5[_0x7721('0x1c')](_0x2e9752)[_0x7721('0x1e')](_0x5069da);}};}function respondWithFilteredResult(_0x534f1b,_0x4e199a){return function(_0x4b183e){if(_0x4b183e){var _0x5ed54=typeof _0x4e199a[_0x7721('0x1f')]===_0x7721('0x20')&&typeof _0x4e199a[_0x7721('0x21')]==='undefined';var _0x20f669=_0x4b183e['count'];var _0x3fc09e=_0x5ed54?0x0:_0x4e199a['offset'];var _0xfec626=_0x5ed54?_0x4b183e[_0x7721('0x22')]:_0x4e199a[_0x7721('0x1f')]+_0x4e199a[_0x7721('0x21')];var _0x2286e5;if(_0xfec626>=_0x20f669){_0xfec626=_0x20f669;_0x2286e5=0xc8;}else{_0x2286e5=0xce;}_0x534f1b[_0x7721('0x1c')](_0x2286e5);return _0x534f1b[_0x7721('0x23')](_0x7721('0x24'),_0x3fc09e+'-'+_0xfec626+'/'+_0x20f669)[_0x7721('0x1e')](_0x4b183e);}return null;};}function patchUpdates(_0xaeccc4){return function(_0x4ce1db){try{jsonpatch[_0x7721('0x25')](_0x4ce1db,_0xaeccc4,!![]);}catch(_0x2c1583){return BPromise[_0x7721('0x26')](_0x2c1583);}return _0x4ce1db[_0x7721('0x27')]();};}function saveUpdates(_0x57140c,_0x28f5a6){return function(_0x512f31){if(_0x512f31){return _0x512f31[_0x7721('0x28')](_0x57140c)[_0x7721('0x29')](function(_0x3e8a4e){return _0x3e8a4e;});}return null;};}function removeEntity(_0x1caad8,_0x121cc4){return function(_0x395b15){if(_0x395b15){return _0x395b15[_0x7721('0x2a')]()['then'](function(){_0x1caad8[_0x7721('0x1c')](0xcc)[_0x7721('0x1d')]();});}};}function handleEntityNotFound(_0x125564,_0x1f67c7){return function(_0x40d550){if(!_0x40d550){_0x125564[_0x7721('0x2b')](0x194);}return _0x40d550;};}function handleError(_0x424e05,_0xf753f1){_0xf753f1=_0xf753f1||0x1f4;return function(_0x40f367){logger['error'](_0x40f367[_0x7721('0x2c')]);if(_0x40f367['name']){delete _0x40f367['name'];}_0x424e05[_0x7721('0x1c')](_0xf753f1)[_0x7721('0x2d')](_0x40f367);};}exports[_0x7721('0x2e')]=function(_0x158d98,_0x1ea4d){var _0x37b9f0={},_0xd7d703={},_0x1da2d8={'count':0x0,'rows':[]};var _0x5c54f0=_[_0x7721('0x2f')](db[_0x7721('0x30')]['rawAttributes'],function(_0x4a25c9){return{'name':_0x4a25c9[_0x7721('0x31')],'type':_0x4a25c9[_0x7721('0x32')]['key']};});_0xd7d703[_0x7721('0x33')]=_[_0x7721('0x2f')](_0x5c54f0,_0x7721('0x34'));_0xd7d703['query']=_[_0x7721('0x35')](_0x158d98[_0x7721('0x36')]);_0xd7d703[_0x7721('0x37')]=_[_0x7721('0x38')](_0xd7d703[_0x7721('0x33')],_0xd7d703['query']);_0x37b9f0[_0x7721('0x39')]=_[_0x7721('0x38')](_0xd7d703[_0x7721('0x33')],qs['fields'](_0x158d98[_0x7721('0x36')][_0x7721('0x3a')]));_0x37b9f0['attributes']=_0x37b9f0[_0x7721('0x39')]['length']?_0x37b9f0[_0x7721('0x39')]:_0xd7d703[_0x7721('0x33')];if(!_0x158d98[_0x7721('0x36')][_0x7721('0x3b')](_0x7721('0x3c'))){_0x37b9f0[_0x7721('0x21')]=qs[_0x7721('0x21')](_0x158d98[_0x7721('0x36')][_0x7721('0x21')]);_0x37b9f0[_0x7721('0x1f')]=qs[_0x7721('0x1f')](_0x158d98['query'][_0x7721('0x1f')]);}_0x37b9f0['order']=qs[_0x7721('0x3d')](_0x158d98[_0x7721('0x36')][_0x7721('0x3d')]);_0x37b9f0[_0x7721('0x3e')]=qs[_0x7721('0x37')](_[_0x7721('0x3f')](_0x158d98['query'],_0xd7d703['filters']),_0x5c54f0);if(_0x158d98['query']['filter']){_0x37b9f0[_0x7721('0x3e')]=_[_0x7721('0x40')](_0x37b9f0[_0x7721('0x3e')],{'$or':_[_0x7721('0x2f')](_0x5c54f0,function(_0x4a90ce){if(_0x4a90ce[_0x7721('0x32')]!=='VIRTUAL'){var _0xfab37b={};_0xfab37b[_0x4a90ce[_0x7721('0x34')]]={'$like':'%'+_0x158d98['query'][_0x7721('0x41')]+'%'};return _0xfab37b;}})});}_0x37b9f0=_[_0x7721('0x40')]({},_0x37b9f0,_0x158d98['options']);var _0x4d0111={'where':_0x37b9f0[_0x7721('0x3e')]};return db[_0x7721('0x30')][_0x7721('0x22')](_0x4d0111)[_0x7721('0x29')](function(_0x577af9){_0x1da2d8[_0x7721('0x22')]=_0x577af9;if(_0x158d98[_0x7721('0x36')][_0x7721('0x42')]){_0x37b9f0[_0x7721('0x43')]=[{'all':!![]}];}return db[_0x7721('0x30')]['findAll'](_0x37b9f0);})[_0x7721('0x29')](function(_0x4a2c28){_0x1da2d8[_0x7721('0x44')]=_0x4a2c28;return _0x1da2d8;})['then'](respondWithFilteredResult(_0x1ea4d,_0x37b9f0))[_0x7721('0x45')](handleError(_0x1ea4d,null));};exports[_0x7721('0x46')]=function(_0x231dad,_0x49e0c5){var _0x1453d4={'raw':!![],'where':{'id':_0x231dad[_0x7721('0x47')]['id']}},_0x11d853={};_0x11d853['model']=_[_0x7721('0x35')](db[_0x7721('0x30')][_0x7721('0x48')]);_0x11d853[_0x7721('0x36')]=_[_0x7721('0x35')](_0x231dad[_0x7721('0x36')]);_0x11d853[_0x7721('0x37')]=_['intersection'](_0x11d853['model'],_0x11d853[_0x7721('0x36')]);_0x1453d4[_0x7721('0x39')]=_[_0x7721('0x38')](_0x11d853[_0x7721('0x33')],qs[_0x7721('0x3a')](_0x231dad[_0x7721('0x36')][_0x7721('0x3a')]));_0x1453d4[_0x7721('0x39')]=_0x1453d4[_0x7721('0x39')][_0x7721('0x49')]?_0x1453d4['attributes']:_0x11d853['model'];if(_0x231dad[_0x7721('0x36')][_0x7721('0x42')]){_0x1453d4[_0x7721('0x43')]=[{'all':!![]}];}_0x1453d4=_[_0x7721('0x40')]({},_0x1453d4,_0x231dad['options']);return db[_0x7721('0x30')][_0x7721('0x4a')](_0x1453d4)['then'](handleEntityNotFound(_0x49e0c5,null))[_0x7721('0x29')](respondWithResult(_0x49e0c5,null))['catch'](handleError(_0x49e0c5,null));};exports[_0x7721('0x4b')]=function(_0x5c6922,_0x334f23){return db[_0x7721('0x30')][_0x7721('0x4b')](_0x5c6922['body'],{})[_0x7721('0x29')](respondWithResult(_0x334f23,0xc9))[_0x7721('0x45')](handleError(_0x334f23,null));};exports['update']=function(_0x223d93,_0x1196c2){if(_0x223d93[_0x7721('0x4c')]['id']){delete _0x223d93['body']['id'];}return db[_0x7721('0x30')]['find']({'where':{'id':_0x223d93[_0x7721('0x47')]['id']}})[_0x7721('0x29')](handleEntityNotFound(_0x1196c2,null))[_0x7721('0x29')](saveUpdates(_0x223d93[_0x7721('0x4c')],null))[_0x7721('0x29')](respondWithResult(_0x1196c2,null))[_0x7721('0x45')](handleError(_0x1196c2,null));};exports[_0x7721('0x2a')]=function(_0x7fbb73,_0x694d2f){return db[_0x7721('0x30')][_0x7721('0x4a')]({'where':{'id':_0x7fbb73[_0x7721('0x47')]['id']}})[_0x7721('0x29')](handleEntityNotFound(_0x694d2f,null))[_0x7721('0x29')](removeEntity(_0x694d2f,null))[_0x7721('0x45')](handleError(_0x694d2f,null));};exports['describe']=function(_0x474f32,_0x2f6f30){return db[_0x7721('0x30')][_0x7721('0x4d')]()[_0x7721('0x29')](respondWithResult(_0x2f6f30,null))[_0x7721('0x45')](handleError(_0x2f6f30,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index a1eef15..12ffebe 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 _0x7f5f=['../../config/environment','./memberReport.attributes','define','report_member','membername_interface','interface','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x178b0d,_0xd803dc){var _0x440783=function(_0x5dfe1b){while(--_0x5dfe1b){_0x178b0d['push'](_0x178b0d['shift']());}};_0x440783(++_0xd803dc);}(_0x7f5f,0xa0));var _0xf7f5=function(_0x55641d,_0xe3277c){_0x55641d=_0x55641d-0x0;var _0xd5f85e=_0x7f5f[_0x55641d];return _0xd5f85e;};'use strict';var _=require(_0xf7f5('0x0'));var util=require(_0xf7f5('0x1'));var logger=require(_0xf7f5('0x2'))(_0xf7f5('0x3'));var moment=require(_0xf7f5('0x4'));var BPromise=require(_0xf7f5('0x5'));var rp=require(_0xf7f5('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf7f5('0x7'));var config=require(_0xf7f5('0x8'));var attributes=require(_0xf7f5('0x9'));module['exports']=function(_0x4d1ce2,_0x53b8a5){return _0x4d1ce2[_0xf7f5('0xa')]('MemberReport',attributes,{'tableName':_0xf7f5('0xb'),'paranoid':![],'indexes':[{'name':_0xf7f5('0xc'),'fields':['membername',_0xf7f5('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8057=['exports','MemberReport','report_member','interface','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./memberReport.attributes'];(function(_0x26bcec,_0xe13f50){var _0x1049dc=function(_0x4c0d9b){while(--_0x4c0d9b){_0x26bcec['push'](_0x26bcec['shift']());}};_0x1049dc(++_0xe13f50);}(_0x8057,0x13f));var _0x7805=function(_0x4b7abd,_0x27ef63){_0x4b7abd=_0x4b7abd-0x0;var _0x1f3bb0=_0x8057[_0x4b7abd];return _0x1f3bb0;};'use strict';var _=require(_0x7805('0x0'));var util=require(_0x7805('0x1'));var logger=require(_0x7805('0x2'))(_0x7805('0x3'));var moment=require(_0x7805('0x4'));var BPromise=require(_0x7805('0x5'));var rp=require(_0x7805('0x6'));var fs=require('fs');var path=require(_0x7805('0x7'));var rimraf=require(_0x7805('0x8'));var config=require(_0x7805('0x9'));var attributes=require(_0x7805('0xa'));module[_0x7805('0xb')]=function(_0x5395aa,_0x3873b3){return _0x5395aa['define'](_0x7805('0xc'),attributes,{'tableName':_0x7805('0xd'),'paranoid':![],'indexes':[{'name':'membername_interface','fields':['membername',_0x7805('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index d3c5161..fddd986 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 _0xbecd=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','MemberReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','MemberReport,\x20%s,\x20%s','message','info','catch','GetMemberReport','MemberReport','findAll','options','raw','where','limit','include','map','model','attributes','then','debug','CreateMemberReport','UpdateMemberReport','body','lodash','moment','bluebird','ioredis','../../mysqldb'];(function(_0x8f6a2c,_0x435996){var _0x42a718=function(_0x572dd2){while(--_0x572dd2){_0x8f6a2c['push'](_0x8f6a2c['shift']());}};_0x42a718(++_0x435996);}(_0xbecd,0x6a));var _0xdbec=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xbecd[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xdbec('0x0'));var util=require('util');var moment=require(_0xdbec('0x1'));var BPromise=require(_0xdbec('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdbec('0x3'));var db=require(_0xdbec('0x4'))['db'];var utils=require(_0xdbec('0x5'));var logger=require(_0xdbec('0x6'))(_0xdbec('0x7'));var config=require(_0xdbec('0x8'));var jayson=require(_0xdbec('0x9'));var client=jayson[_0xdbec('0xa')][_0xdbec('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x38cac4,_0x13dfff,_0x380bf8){return new BPromise(function(_0x406cd3,_0x242b59){return client[_0xdbec('0xc')](_0x38cac4,_0x380bf8)['then'](function(_0x299d84){logger['info']('MemberReport,\x20%s,\x20%s',_0x13dfff,'request\x20sent');logger['debug'](_0xdbec('0xd'),_0x13dfff,_0xdbec('0xe'),JSON['stringify'](_0x299d84));if(_0x299d84[_0xdbec('0xf')]){if(_0x299d84[_0xdbec('0xf')][_0xdbec('0x10')]===0x1f4){logger[_0xdbec('0xf')](_0xdbec('0x11'),_0x13dfff,_0x299d84[_0xdbec('0xf')]['message']);return _0x242b59(_0x299d84[_0xdbec('0xf')][_0xdbec('0x12')]);}logger['error'](_0xdbec('0x11'),_0x13dfff,_0x299d84[_0xdbec('0xf')]['message']);return _0x406cd3(_0x299d84[_0xdbec('0xf')]['message']);}else{logger[_0xdbec('0x13')]('MemberReport,\x20%s,\x20%s',_0x13dfff,_0xdbec('0xe'));_0x406cd3(_0x299d84['result']['message']);}})[_0xdbec('0x14')](function(_0x1c9054){logger[_0xdbec('0xf')](_0xdbec('0x11'),_0x13dfff,_0x1c9054);_0x242b59(_0x1c9054);});});}exports[_0xdbec('0x15')]=function(_0x392600){var _0x309219=this;return new Promise(function(_0x5d9ed5,_0x39d49d){return db[_0xdbec('0x16')][_0xdbec('0x17')]({'raw':_0x392600[_0xdbec('0x18')]?_0x392600[_0xdbec('0x18')][_0xdbec('0x19')]===undefined?!![]:![]:!![],'where':_0x392600[_0xdbec('0x18')]?_0x392600['options'][_0xdbec('0x1a')]||null:null,'attributes':_0x392600[_0xdbec('0x18')]?_0x392600[_0xdbec('0x18')]['attributes']||null:null,'limit':_0x392600[_0xdbec('0x18')]?_0x392600['options'][_0xdbec('0x1b')]||null:null,'include':_0x392600[_0xdbec('0x18')]?_0x392600[_0xdbec('0x18')][_0xdbec('0x1c')]?_[_0xdbec('0x1d')](_0x392600[_0xdbec('0x18')][_0xdbec('0x1c')],function(_0x3b5c13){return{'model':db[_0x3b5c13[_0xdbec('0x1e')]],'as':_0x3b5c13['as'],'attributes':_0x3b5c13[_0xdbec('0x1f')],'include':_0x3b5c13[_0xdbec('0x1c')]?_[_0xdbec('0x1d')](_0x3b5c13[_0xdbec('0x1c')],function(_0x3aeaa4){return{'model':db[_0x3aeaa4[_0xdbec('0x1e')]],'as':_0x3aeaa4['as'],'attributes':_0x3aeaa4[_0xdbec('0x1f')],'include':_0x3aeaa4[_0xdbec('0x1c')]?_[_0xdbec('0x1d')](_0x3aeaa4[_0xdbec('0x1c')],function(_0x1f7f4d){return{'model':db[_0x1f7f4d[_0xdbec('0x1e')]],'as':_0x1f7f4d['as'],'attributes':_0x1f7f4d['attributes']};}):[]};}):[]};}):[]:[]})[_0xdbec('0x20')](function(_0x26a6b9){logger[_0xdbec('0x13')](_0xdbec('0x15'),_0x392600);logger[_0xdbec('0x21')](_0xdbec('0x15'),_0x392600,JSON['stringify'](_0x26a6b9));_0x5d9ed5(_0x26a6b9);})[_0xdbec('0x14')](function(_0x2225ae){logger[_0xdbec('0xf')]('GetMemberReport',_0x2225ae[_0xdbec('0x12')],_0x392600);_0x39d49d(_0x309219['error'](0x1f4,_0x2225ae[_0xdbec('0x12')]));});});};exports['CreateMemberReport']=function(_0x13ec80){var _0x4f73be=this;return new Promise(function(_0x445ce7,_0x25c192){return db[_0xdbec('0x16')]['create'](_0x13ec80['body'],{'raw':_0x13ec80[_0xdbec('0x18')]?_0x13ec80[_0xdbec('0x18')]['raw']===undefined?!![]:![]:!![]})[_0xdbec('0x20')](function(_0x40c6d9){logger[_0xdbec('0x13')](_0xdbec('0x22'),_0x13ec80);logger['debug'](_0xdbec('0x22'),_0x13ec80,JSON['stringify'](_0x40c6d9));_0x445ce7(_0x40c6d9);})[_0xdbec('0x14')](function(_0x26d8a7){logger[_0xdbec('0xf')](_0xdbec('0x22'),_0x26d8a7[_0xdbec('0x12')],_0x13ec80);_0x25c192(_0x4f73be[_0xdbec('0xf')](0x1f4,_0x26d8a7['message']));});});};exports[_0xdbec('0x23')]=function(_0x7983e8){var _0x43cf04=this;return new Promise(function(_0x5331a7,_0xe2c284){return db[_0xdbec('0x16')]['update'](_0x7983e8[_0xdbec('0x24')],{'raw':_0x7983e8['options']?_0x7983e8[_0xdbec('0x18')][_0xdbec('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x7983e8[_0xdbec('0x18')]?_0x7983e8[_0xdbec('0x18')][_0xdbec('0x1a')]||null:null,'attributes':_0x7983e8[_0xdbec('0x18')]?_0x7983e8['options']['attributes']||null:null,'limit':_0x7983e8[_0xdbec('0x18')]?_0x7983e8[_0xdbec('0x18')]['limit']||null:null})[_0xdbec('0x20')](function(_0x5e0851){logger['info'](_0xdbec('0x23'),_0x7983e8);logger[_0xdbec('0x21')](_0xdbec('0x23'),_0x7983e8,JSON['stringify'](_0x5e0851));_0x5331a7(_0x5e0851);})[_0xdbec('0x14')](function(_0x5e7441){logger[_0xdbec('0xf')](_0xdbec('0x23'),_0x5e7441['message'],_0x7983e8);_0xe2c284(_0x43cf04['error'](0x1f4,_0x5e7441[_0xdbec('0x12')]));});});}; \ No newline at end of file +var _0x158f=['stringify','CreateMemberReport','MemberReport','body','raw','UpdateMemberReport','update','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','error','code','MemberReport,\x20%s,\x20%s','message','result','catch','GetMemberReport','options','where','attributes','limit','include','map','model'];(function(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0x158f,0x137));var _0xf158=function(_0xb475a2,_0x4ce5c9){_0xb475a2=_0xb475a2-0x0;var _0x38be70=_0x158f[_0xb475a2];return _0x38be70;};'use strict';var _=require('lodash');var util=require(_0xf158('0x0'));var moment=require(_0xf158('0x1'));var BPromise=require(_0xf158('0x2'));var rs=require(_0xf158('0x3'));var fs=require('fs');var Redis=require(_0xf158('0x4'));var db=require(_0xf158('0x5'))['db'];var utils=require(_0xf158('0x6'));var logger=require('../../config/logger')(_0xf158('0x7'));var config=require('../../config/environment');var jayson=require(_0xf158('0x8'));var client=jayson[_0xf158('0x9')][_0xf158('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x23ff44,_0x5acfb7,_0x2a24a7){return new BPromise(function(_0x395f69,_0x2873ce){return client[_0xf158('0xb')](_0x23ff44,_0x2a24a7)[_0xf158('0xc')](function(_0x2a17df){logger[_0xf158('0xd')]('MemberReport,\x20%s,\x20%s',_0x5acfb7,_0xf158('0xe'));logger[_0xf158('0xf')](_0xf158('0x10'),_0x5acfb7,_0xf158('0xe'),JSON['stringify'](_0x2a17df));if(_0x2a17df[_0xf158('0x11')]){if(_0x2a17df[_0xf158('0x11')][_0xf158('0x12')]===0x1f4){logger[_0xf158('0x11')](_0xf158('0x13'),_0x5acfb7,_0x2a17df[_0xf158('0x11')][_0xf158('0x14')]);return _0x2873ce(_0x2a17df['error'][_0xf158('0x14')]);}logger['error'](_0xf158('0x13'),_0x5acfb7,_0x2a17df[_0xf158('0x11')][_0xf158('0x14')]);return _0x395f69(_0x2a17df[_0xf158('0x11')][_0xf158('0x14')]);}else{logger['info'](_0xf158('0x13'),_0x5acfb7,_0xf158('0xe'));_0x395f69(_0x2a17df[_0xf158('0x15')]['message']);}})[_0xf158('0x16')](function(_0x3bfdf1){logger['error']('MemberReport,\x20%s,\x20%s',_0x5acfb7,_0x3bfdf1);_0x2873ce(_0x3bfdf1);});});}exports[_0xf158('0x17')]=function(_0x15fffe){var _0x170363=this;return new Promise(function(_0x5317e5,_0x264fb6){return db['MemberReport']['findAll']({'raw':_0x15fffe[_0xf158('0x18')]?_0x15fffe[_0xf158('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x15fffe[_0xf158('0x18')]?_0x15fffe['options'][_0xf158('0x19')]||null:null,'attributes':_0x15fffe[_0xf158('0x18')]?_0x15fffe[_0xf158('0x18')][_0xf158('0x1a')]||null:null,'limit':_0x15fffe[_0xf158('0x18')]?_0x15fffe[_0xf158('0x18')][_0xf158('0x1b')]||null:null,'include':_0x15fffe[_0xf158('0x18')]?_0x15fffe[_0xf158('0x18')][_0xf158('0x1c')]?_[_0xf158('0x1d')](_0x15fffe[_0xf158('0x18')][_0xf158('0x1c')],function(_0x3e44fb){return{'model':db[_0x3e44fb[_0xf158('0x1e')]],'as':_0x3e44fb['as'],'attributes':_0x3e44fb[_0xf158('0x1a')],'include':_0x3e44fb['include']?_[_0xf158('0x1d')](_0x3e44fb['include'],function(_0x5ba0be){return{'model':db[_0x5ba0be[_0xf158('0x1e')]],'as':_0x5ba0be['as'],'attributes':_0x5ba0be[_0xf158('0x1a')],'include':_0x5ba0be['include']?_[_0xf158('0x1d')](_0x5ba0be[_0xf158('0x1c')],function(_0x1d032f){return{'model':db[_0x1d032f[_0xf158('0x1e')]],'as':_0x1d032f['as'],'attributes':_0x1d032f[_0xf158('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xf158('0xc')](function(_0x2924af){logger['info'](_0xf158('0x17'),_0x15fffe);logger[_0xf158('0xf')]('GetMemberReport',_0x15fffe,JSON[_0xf158('0x1f')](_0x2924af));_0x5317e5(_0x2924af);})[_0xf158('0x16')](function(_0xe96997){logger['error'](_0xf158('0x17'),_0xe96997[_0xf158('0x14')],_0x15fffe);_0x264fb6(_0x170363[_0xf158('0x11')](0x1f4,_0xe96997[_0xf158('0x14')]));});});};exports[_0xf158('0x20')]=function(_0x5f4bf5){var _0x25ba0e=this;return new Promise(function(_0x4769d5,_0x18130f){return db[_0xf158('0x21')]['create'](_0x5f4bf5[_0xf158('0x22')],{'raw':_0x5f4bf5[_0xf158('0x18')]?_0x5f4bf5['options'][_0xf158('0x23')]===undefined?!![]:![]:!![]})['then'](function(_0xe3c013){logger['info'](_0xf158('0x20'),_0x5f4bf5);logger[_0xf158('0xf')](_0xf158('0x20'),_0x5f4bf5,JSON[_0xf158('0x1f')](_0xe3c013));_0x4769d5(_0xe3c013);})[_0xf158('0x16')](function(_0x363d14){logger[_0xf158('0x11')](_0xf158('0x20'),_0x363d14['message'],_0x5f4bf5);_0x18130f(_0x25ba0e[_0xf158('0x11')](0x1f4,_0x363d14['message']));});});};exports[_0xf158('0x24')]=function(_0x10ba31){var _0x5023aa=this;return new Promise(function(_0x35af38,_0x1c8804){return db[_0xf158('0x21')][_0xf158('0x25')](_0x10ba31[_0xf158('0x22')],{'raw':_0x10ba31[_0xf158('0x18')]?_0x10ba31[_0xf158('0x18')][_0xf158('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x10ba31[_0xf158('0x18')]?_0x10ba31['options']['where']||null:null,'attributes':_0x10ba31['options']?_0x10ba31[_0xf158('0x18')][_0xf158('0x1a')]||null:null,'limit':_0x10ba31[_0xf158('0x18')]?_0x10ba31[_0xf158('0x18')][_0xf158('0x1b')]||null:null})[_0xf158('0xc')](function(_0xffb0fa){logger[_0xf158('0xd')](_0xf158('0x24'),_0x10ba31);logger['debug']('UpdateMemberReport',_0x10ba31,JSON['stringify'](_0xffb0fa));_0x35af38(_0xffb0fa);})[_0xf158('0x16')](function(_0x394eba){logger[_0xf158('0x11')](_0xf158('0x24'),_0x394eba['message'],_0x10ba31);_0x1c8804(_0x5023aa[_0xf158('0x11')](0x1f4,_0x394eba[_0xf158('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index bedfc84..a467410 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 _0x57d8=['util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','exports','multer'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0x57d8,0x1e7));var _0x857d=function(_0x27b070,_0x217d9b){_0x27b070=_0x27b070-0x0;var _0x1d8ecb=_0x57d8[_0x27b070];return _0x1d8ecb;};'use strict';var multer=require(_0x857d('0x0'));var util=require(_0x857d('0x1'));var path=require(_0x857d('0x2'));var timeout=require(_0x857d('0x3'));var express=require('express');var router=express[_0x857d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x857d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x857d('0x6'));var controller=require('./migration.controller');router['get']('/',controller['index']);module[_0x857d('0x7')]=router; \ No newline at end of file +var _0x3ccc=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','get','index','exports','multer'];(function(_0x30a060,_0x2caee6){var _0x12403a=function(_0x3fc58e){while(--_0x3fc58e){_0x30a060['push'](_0x30a060['shift']());}};_0x12403a(++_0x2caee6);}(_0x3ccc,0x1bb));var _0xc3cc=function(_0x36bab3,_0x19ce33){_0x36bab3=_0x36bab3-0x0;var _0x2d3989=_0x3ccc[_0x36bab3];return _0x2d3989;};'use strict';var multer=require(_0xc3cc('0x0'));var util=require('util');var path=require(_0xc3cc('0x1'));var timeout=require(_0xc3cc('0x2'));var express=require(_0xc3cc('0x3'));var router=express['Router']();var fs_extra=require(_0xc3cc('0x4'));var auth=require(_0xc3cc('0x5'));var interaction=require(_0xc3cc('0x6'));var config=require(_0xc3cc('0x7'));var controller=require(_0xc3cc('0x8'));router[_0xc3cc('0x9')]('/',controller[_0xc3cc('0xa')]);module[_0xc3cc('0xb')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 9a05e53..fe5d55e 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 _0x36e4=['sequelize','exports','STRING','version'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x36e4,0x1cc));var _0x436e=function(_0x906118,_0xca36d2){_0x906118=_0x906118-0x0;var _0x34ed30=_0x36e4[_0x906118];return _0x34ed30;};'use strict';var Sequelize=require(_0x436e('0x0'));module[_0x436e('0x1')]={'version':{'type':Sequelize[_0x436e('0x2')],'unique':_0x436e('0x3')}}; \ No newline at end of file +var _0xadce=['exports','STRING','version','sequelize'];(function(_0x269c26,_0xc76a28){var _0x33baad=function(_0x53be83){while(--_0x53be83){_0x269c26['push'](_0x269c26['shift']());}};_0x33baad(++_0xc76a28);}(_0xadce,0x8f));var _0xeadc=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xadce[_0x4b055c];return _0x4b62bb;};'use strict';var Sequelize=require(_0xeadc('0x0'));module[_0xeadc('0x1')]={'version':{'type':Sequelize[_0xeadc('0x2')],'unique':_0xeadc('0x3')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 316d98e..4a0fe6b 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 _0xc0f9=['order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','count','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','Migration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','hasOwnProperty'];(function(_0xdd0313,_0x251c2b){var _0x2bd7e8=function(_0x340f1f){while(--_0x340f1f){_0xdd0313['push'](_0xdd0313['shift']());}};_0x2bd7e8(++_0x251c2b);}(_0xc0f9,0x119));var _0x9c0f=function(_0x10e653,_0x59f1cc){_0x10e653=_0x10e653-0x0;var _0x328dfd=_0xc0f9[_0x10e653];return _0x328dfd;};'use strict';var emlformat=require(_0x9c0f('0x0'));var rimraf=require(_0x9c0f('0x1'));var zipdir=require(_0x9c0f('0x2'));var jsonpatch=require(_0x9c0f('0x3'));var rp=require(_0x9c0f('0x4'));var moment=require(_0x9c0f('0x5'));var BPromise=require(_0x9c0f('0x6'));var Mustache=require(_0x9c0f('0x7'));var util=require(_0x9c0f('0x8'));var path=require('path');var sox=require(_0x9c0f('0x9'));var csv=require(_0x9c0f('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9c0f('0xb'));var _=require(_0x9c0f('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9c0f('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9c0f('0xe'));var Papa=require(_0x9c0f('0xf'));var Redis=require(_0x9c0f('0x10'));var authService=require(_0x9c0f('0x11'));var qs=require(_0x9c0f('0x12'));var as=require(_0x9c0f('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x9c0f('0x14'));var db=require(_0x9c0f('0x15'))['db'];function respondWithStatusCode(_0x40b9df,_0x328bed){_0x328bed=_0x328bed||0xcc;return function(_0xf22317){if(_0xf22317){return _0x40b9df[_0x9c0f('0x16')](_0x328bed);}return _0x40b9df[_0x9c0f('0x17')](_0x328bed)[_0x9c0f('0x18')]();};}function respondWithResult(_0x1f2b8d,_0x2f5682){_0x2f5682=_0x2f5682||0xc8;return function(_0x17cdcb){if(_0x17cdcb){return _0x1f2b8d[_0x9c0f('0x17')](_0x2f5682)[_0x9c0f('0x19')](_0x17cdcb);}};}function respondWithFilteredResult(_0x28683a,_0x45372f){return function(_0xbf5251){if(_0xbf5251){var _0x4cd735=typeof _0x45372f[_0x9c0f('0x1a')]==='undefined'&&typeof _0x45372f['limit']==='undefined';var _0x340120=_0xbf5251['count'];var _0x3aaf3a=_0x4cd735?0x0:_0x45372f[_0x9c0f('0x1a')];var _0x4a95e5=_0x4cd735?_0xbf5251[_0x9c0f('0x1b')]:_0x45372f['offset']+_0x45372f[_0x9c0f('0x1c')];var _0x594182;if(_0x4a95e5>=_0x340120){_0x4a95e5=_0x340120;_0x594182=0xc8;}else{_0x594182=0xce;}_0x28683a[_0x9c0f('0x17')](_0x594182);return _0x28683a['set'](_0x9c0f('0x1d'),_0x3aaf3a+'-'+_0x4a95e5+'/'+_0x340120)[_0x9c0f('0x19')](_0xbf5251);}return null;};}function patchUpdates(_0x54dcbb){return function(_0x243d7d){try{jsonpatch[_0x9c0f('0x1e')](_0x243d7d,_0x54dcbb,!![]);}catch(_0x29fbd3){return BPromise[_0x9c0f('0x1f')](_0x29fbd3);}return _0x243d7d[_0x9c0f('0x20')]();};}function saveUpdates(_0x1bc746,_0x464b45){return function(_0x4bedc7){if(_0x4bedc7){return _0x4bedc7[_0x9c0f('0x21')](_0x1bc746)[_0x9c0f('0x22')](function(_0x1fe272){return _0x1fe272;});}return null;};}function removeEntity(_0x3bc1d8,_0x5a707e){return function(_0x3cf47e){if(_0x3cf47e){return _0x3cf47e[_0x9c0f('0x23')]()[_0x9c0f('0x22')](function(){_0x3bc1d8[_0x9c0f('0x17')](0xcc)[_0x9c0f('0x18')]();});}};}function handleEntityNotFound(_0x4b1dfd,_0x252c3e){return function(_0x5ddb37){if(!_0x5ddb37){_0x4b1dfd[_0x9c0f('0x16')](0x194);}return _0x5ddb37;};}function handleError(_0x5230e8,_0xcad55){_0xcad55=_0xcad55||0x1f4;return function(_0x3776ac){logger[_0x9c0f('0x24')](_0x3776ac[_0x9c0f('0x25')]);if(_0x3776ac[_0x9c0f('0x26')]){delete _0x3776ac['name'];}_0x5230e8[_0x9c0f('0x17')](_0xcad55)[_0x9c0f('0x27')](_0x3776ac);};}exports[_0x9c0f('0x28')]=function(_0xd75363,_0x41ef65){var _0x437342={},_0xc977d1={},_0x22701f={'count':0x0,'rows':[]};var _0x2eb86f=_[_0x9c0f('0x29')](db[_0x9c0f('0x2a')][_0x9c0f('0x2b')],function(_0x34019e){return{'name':_0x34019e[_0x9c0f('0x2c')],'type':_0x34019e[_0x9c0f('0x2d')][_0x9c0f('0x2e')]};});_0xc977d1[_0x9c0f('0x2f')]=_[_0x9c0f('0x29')](_0x2eb86f,_0x9c0f('0x26'));_0xc977d1[_0x9c0f('0x30')]=_[_0x9c0f('0x31')](_0xd75363[_0x9c0f('0x30')]);_0xc977d1[_0x9c0f('0x32')]=_[_0x9c0f('0x33')](_0xc977d1['model'],_0xc977d1[_0x9c0f('0x30')]);_0x437342[_0x9c0f('0x34')]=_['intersection'](_0xc977d1[_0x9c0f('0x2f')],qs['fields'](_0xd75363['query']['fields']));_0x437342[_0x9c0f('0x34')]=_0x437342[_0x9c0f('0x34')]['length']?_0x437342['attributes']:_0xc977d1[_0x9c0f('0x2f')];if(!_0xd75363['query'][_0x9c0f('0x35')]('nolimit')){_0x437342['limit']=qs[_0x9c0f('0x1c')](_0xd75363[_0x9c0f('0x30')]['limit']);_0x437342[_0x9c0f('0x1a')]=qs[_0x9c0f('0x1a')](_0xd75363[_0x9c0f('0x30')][_0x9c0f('0x1a')]);}_0x437342[_0x9c0f('0x36')]=qs['sort'](_0xd75363[_0x9c0f('0x30')][_0x9c0f('0x37')]);_0x437342[_0x9c0f('0x38')]=qs[_0x9c0f('0x32')](_[_0x9c0f('0x39')](_0xd75363[_0x9c0f('0x30')],_0xc977d1['filters']),_0x2eb86f);if(_0xd75363[_0x9c0f('0x30')][_0x9c0f('0x3a')]){_0x437342['where']=_['merge'](_0x437342[_0x9c0f('0x38')],{'$or':_[_0x9c0f('0x29')](_0x2eb86f,function(_0xb2786c){if(_0xb2786c['type']!==_0x9c0f('0x3b')){var _0x4953ff={};_0x4953ff[_0xb2786c[_0x9c0f('0x26')]]={'$like':'%'+_0xd75363[_0x9c0f('0x30')][_0x9c0f('0x3a')]+'%'};return _0x4953ff;}})});}_0x437342=_[_0x9c0f('0x3c')]({},_0x437342,_0xd75363[_0x9c0f('0x3d')]);var _0x30c054={'where':_0x437342[_0x9c0f('0x38')]};return db[_0x9c0f('0x2a')]['count'](_0x30c054)[_0x9c0f('0x22')](function(_0x4d7bfa){_0x22701f[_0x9c0f('0x1b')]=_0x4d7bfa;if(_0xd75363[_0x9c0f('0x30')][_0x9c0f('0x3e')]){_0x437342[_0x9c0f('0x3f')]=[{'all':!![]}];}return db[_0x9c0f('0x2a')][_0x9c0f('0x40')](_0x437342);})[_0x9c0f('0x22')](function(_0x3acc12){_0x22701f[_0x9c0f('0x41')]=_0x3acc12;return _0x22701f;})[_0x9c0f('0x22')](respondWithFilteredResult(_0x41ef65,_0x437342))[_0x9c0f('0x42')](handleError(_0x41ef65,null));}; \ No newline at end of file +var _0x03df=['util','path','sox','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','destroy','then','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','Migration','includeAll','include','findAll','rows','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x395155,_0x192ffd){var _0x179767=function(_0xb18ee3){while(--_0xb18ee3){_0x395155['push'](_0x395155['shift']());}};_0x179767(++_0x192ffd);}(_0x03df,0x83));var _0xf03d=function(_0x3e8d49,_0x54359b){_0x3e8d49=_0x3e8d49-0x0;var _0x303606=_0x03df[_0x3e8d49];return _0x303606;};'use strict';var emlformat=require(_0xf03d('0x0'));var rimraf=require(_0xf03d('0x1'));var zipdir=require(_0xf03d('0x2'));var jsonpatch=require(_0xf03d('0x3'));var rp=require(_0xf03d('0x4'));var moment=require(_0xf03d('0x5'));var BPromise=require(_0xf03d('0x6'));var Mustache=require('mustache');var util=require(_0xf03d('0x7'));var path=require(_0xf03d('0x8'));var sox=require(_0xf03d('0x9'));var csv=require(_0xf03d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf03d('0xb'));var _=require(_0xf03d('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xf03d('0xd'));var deskjs=require(_0xf03d('0xe'));var toCsv=require(_0xf03d('0xa'));var querystring=require(_0xf03d('0xf'));var Papa=require('papaparse');var Redis=require(_0xf03d('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xf03d('0x11'));var as=require(_0xf03d('0x12'));var hardwareService=require(_0xf03d('0x13'));var logger=require(_0xf03d('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf03d('0x15'));var db=require(_0xf03d('0x16'))['db'];function respondWithStatusCode(_0x5b8246,_0x11d7a0){_0x11d7a0=_0x11d7a0||0xcc;return function(_0x222b8d){if(_0x222b8d){return _0x5b8246[_0xf03d('0x17')](_0x11d7a0);}return _0x5b8246[_0xf03d('0x18')](_0x11d7a0)[_0xf03d('0x19')]();};}function respondWithResult(_0x504be4,_0x2dd662){_0x2dd662=_0x2dd662||0xc8;return function(_0x205f9e){if(_0x205f9e){return _0x504be4['status'](_0x2dd662)[_0xf03d('0x1a')](_0x205f9e);}};}function respondWithFilteredResult(_0x23de85,_0x1adaab){return function(_0x4decb1){if(_0x4decb1){var _0x3d1003=typeof _0x1adaab[_0xf03d('0x1b')]===_0xf03d('0x1c')&&typeof _0x1adaab[_0xf03d('0x1d')]===_0xf03d('0x1c');var _0x2341f1=_0x4decb1[_0xf03d('0x1e')];var _0x430a24=_0x3d1003?0x0:_0x1adaab[_0xf03d('0x1b')];var _0x56d497=_0x3d1003?_0x4decb1[_0xf03d('0x1e')]:_0x1adaab[_0xf03d('0x1b')]+_0x1adaab[_0xf03d('0x1d')];var _0x56c636;if(_0x56d497>=_0x2341f1){_0x56d497=_0x2341f1;_0x56c636=0xc8;}else{_0x56c636=0xce;}_0x23de85[_0xf03d('0x18')](_0x56c636);return _0x23de85[_0xf03d('0x1f')]('Content-Range',_0x430a24+'-'+_0x56d497+'/'+_0x2341f1)[_0xf03d('0x1a')](_0x4decb1);}return null;};}function patchUpdates(_0x27377e){return function(_0x55d0d5){try{jsonpatch[_0xf03d('0x20')](_0x55d0d5,_0x27377e,!![]);}catch(_0x480f52){return BPromise[_0xf03d('0x21')](_0x480f52);}return _0x55d0d5[_0xf03d('0x22')]();};}function saveUpdates(_0x396f04,_0x5160aa){return function(_0x1e302c){if(_0x1e302c){return _0x1e302c['update'](_0x396f04)['then'](function(_0x21adc8){return _0x21adc8;});}return null;};}function removeEntity(_0x2aab16,_0x2fe4b2){return function(_0x531dad){if(_0x531dad){return _0x531dad[_0xf03d('0x23')]()[_0xf03d('0x24')](function(){_0x2aab16['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x6067f5,_0x32b4d5){return function(_0x367709){if(!_0x367709){_0x6067f5[_0xf03d('0x17')](0x194);}return _0x367709;};}function handleError(_0x5b0c34,_0x3c8b08){_0x3c8b08=_0x3c8b08||0x1f4;return function(_0x5a830c){logger['error'](_0x5a830c[_0xf03d('0x25')]);if(_0x5a830c[_0xf03d('0x26')]){delete _0x5a830c[_0xf03d('0x26')];}_0x5b0c34[_0xf03d('0x18')](_0x3c8b08)[_0xf03d('0x27')](_0x5a830c);};}exports[_0xf03d('0x28')]=function(_0x3c4fe1,_0x111217){var _0x430e68={},_0x273418={},_0x3809df={'count':0x0,'rows':[]};var _0x10cd02=_[_0xf03d('0x29')](db['Migration'][_0xf03d('0x2a')],function(_0x33c4cd){return{'name':_0x33c4cd[_0xf03d('0x2b')],'type':_0x33c4cd[_0xf03d('0x2c')][_0xf03d('0x2d')]};});_0x273418[_0xf03d('0x2e')]=_['map'](_0x10cd02,_0xf03d('0x26'));_0x273418['query']=_[_0xf03d('0x2f')](_0x3c4fe1['query']);_0x273418[_0xf03d('0x30')]=_[_0xf03d('0x31')](_0x273418[_0xf03d('0x2e')],_0x273418[_0xf03d('0x32')]);_0x430e68[_0xf03d('0x33')]=_[_0xf03d('0x31')](_0x273418[_0xf03d('0x2e')],qs['fields'](_0x3c4fe1[_0xf03d('0x32')][_0xf03d('0x34')]));_0x430e68[_0xf03d('0x33')]=_0x430e68[_0xf03d('0x33')][_0xf03d('0x35')]?_0x430e68[_0xf03d('0x33')]:_0x273418[_0xf03d('0x2e')];if(!_0x3c4fe1['query'][_0xf03d('0x36')](_0xf03d('0x37'))){_0x430e68[_0xf03d('0x1d')]=qs[_0xf03d('0x1d')](_0x3c4fe1[_0xf03d('0x32')]['limit']);_0x430e68['offset']=qs[_0xf03d('0x1b')](_0x3c4fe1[_0xf03d('0x32')][_0xf03d('0x1b')]);}_0x430e68[_0xf03d('0x38')]=qs[_0xf03d('0x39')](_0x3c4fe1[_0xf03d('0x32')][_0xf03d('0x39')]);_0x430e68[_0xf03d('0x3a')]=qs['filters'](_[_0xf03d('0x3b')](_0x3c4fe1['query'],_0x273418[_0xf03d('0x30')]),_0x10cd02);if(_0x3c4fe1[_0xf03d('0x32')][_0xf03d('0x3c')]){_0x430e68['where']=_['merge'](_0x430e68[_0xf03d('0x3a')],{'$or':_[_0xf03d('0x29')](_0x10cd02,function(_0x1f4961){if(_0x1f4961['type']!==_0xf03d('0x3d')){var _0x218213={};_0x218213[_0x1f4961[_0xf03d('0x26')]]={'$like':'%'+_0x3c4fe1[_0xf03d('0x32')][_0xf03d('0x3c')]+'%'};return _0x218213;}})});}_0x430e68=_[_0xf03d('0x3e')]({},_0x430e68,_0x3c4fe1['options']);var _0x58e548={'where':_0x430e68[_0xf03d('0x3a')]};return db[_0xf03d('0x3f')][_0xf03d('0x1e')](_0x58e548)[_0xf03d('0x24')](function(_0x306575){_0x3809df[_0xf03d('0x1e')]=_0x306575;if(_0x3c4fe1[_0xf03d('0x32')][_0xf03d('0x40')]){_0x430e68[_0xf03d('0x41')]=[{'all':!![]}];}return db['Migration'][_0xf03d('0x42')](_0x430e68);})[_0xf03d('0x24')](function(_0x398f74){_0x3809df[_0xf03d('0x43')]=_0x398f74;return _0x3809df;})[_0xf03d('0x24')](respondWithFilteredResult(_0x111217,_0x430e68))[_0xf03d('0x44')](handleError(_0x111217,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 8bc760e..7163db7 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 _0x1a5b=['bluebird','request-promise','path','rimraf','../../config/environment','./migration.attributes','define','Migration','migrations','lodash','util','../../config/logger','moment'];(function(_0x3a0d06,_0x565852){var _0x557e9c=function(_0x17bba4){while(--_0x17bba4){_0x3a0d06['push'](_0x3a0d06['shift']());}};_0x557e9c(++_0x565852);}(_0x1a5b,0x15b));var _0xb1a5=function(_0x1354ec,_0xfb6e10){_0x1354ec=_0x1354ec-0x0;var _0x1ab41e=_0x1a5b[_0x1354ec];return _0x1ab41e;};'use strict';var _=require(_0xb1a5('0x0'));var util=require(_0xb1a5('0x1'));var logger=require(_0xb1a5('0x2'))('api');var moment=require(_0xb1a5('0x3'));var BPromise=require(_0xb1a5('0x4'));var rp=require(_0xb1a5('0x5'));var fs=require('fs');var path=require(_0xb1a5('0x6'));var rimraf=require(_0xb1a5('0x7'));var config=require(_0xb1a5('0x8'));var attributes=require(_0xb1a5('0x9'));module['exports']=function(_0x3fc805,_0x129a67){return _0x3fc805[_0xb1a5('0xa')](_0xb1a5('0xb'),attributes,{'tableName':_0xb1a5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x690b=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./migration.attributes','exports','define','Migration','migrations'];(function(_0x239a39,_0x5b787d){var _0x5bdc07=function(_0x3eb166){while(--_0x3eb166){_0x239a39['push'](_0x239a39['shift']());}};_0x5bdc07(++_0x5b787d);}(_0x690b,0xb6));var _0xb690=function(_0x438fe1,_0x3308d5){_0x438fe1=_0x438fe1-0x0;var _0x3c8e1b=_0x690b[_0x438fe1];return _0x3c8e1b;};'use strict';var _=require(_0xb690('0x0'));var util=require(_0xb690('0x1'));var logger=require(_0xb690('0x2'))(_0xb690('0x3'));var moment=require(_0xb690('0x4'));var BPromise=require(_0xb690('0x5'));var rp=require(_0xb690('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb690('0x7'));var config=require(_0xb690('0x8'));var attributes=require(_0xb690('0x9'));module[_0xb690('0xa')]=function(_0x5b1919,_0x221894){return _0x5b1919[_0xb690('0xb')](_0xb690('0xc'),attributes,{'tableName':_0xb690('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index 13a6499..87bb78f 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 _0xf9bc=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','Migration,\x20%s,\x20%s','request\x20sent','Migration,\x20%s,\x20%s,\x20%s','error','message','info','result','catch'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0xf9bc,0x7e));var _0xcf9b=function(_0x1fcac5,_0x310aa2){_0x1fcac5=_0x1fcac5-0x0;var _0x15eed3=_0xf9bc[_0x1fcac5];return _0x15eed3;};'use strict';var _=require('lodash');var util=require(_0xcf9b('0x0'));var moment=require(_0xcf9b('0x1'));var BPromise=require(_0xcf9b('0x2'));var rs=require(_0xcf9b('0x3'));var fs=require('fs');var Redis=require(_0xcf9b('0x4'));var db=require(_0xcf9b('0x5'))['db'];var utils=require(_0xcf9b('0x6'));var logger=require(_0xcf9b('0x7'))(_0xcf9b('0x8'));var config=require(_0xcf9b('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xcf9b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2ba407,_0xbf765c,_0x2493f0){return new BPromise(function(_0x1ec363,_0x2c0e77){return client[_0xcf9b('0xb')](_0x2ba407,_0x2493f0)[_0xcf9b('0xc')](function(_0x3447ef){logger['info'](_0xcf9b('0xd'),_0xbf765c,_0xcf9b('0xe'));logger['debug'](_0xcf9b('0xf'),_0xbf765c,'request\x20sent',JSON['stringify'](_0x3447ef));if(_0x3447ef['error']){if(_0x3447ef[_0xcf9b('0x10')]['code']===0x1f4){logger[_0xcf9b('0x10')](_0xcf9b('0xd'),_0xbf765c,_0x3447ef['error'][_0xcf9b('0x11')]);return _0x2c0e77(_0x3447ef[_0xcf9b('0x10')][_0xcf9b('0x11')]);}logger[_0xcf9b('0x10')](_0xcf9b('0xd'),_0xbf765c,_0x3447ef['error'][_0xcf9b('0x11')]);return _0x1ec363(_0x3447ef[_0xcf9b('0x10')][_0xcf9b('0x11')]);}else{logger[_0xcf9b('0x12')]('Migration,\x20%s,\x20%s',_0xbf765c,'request\x20sent');_0x1ec363(_0x3447ef[_0xcf9b('0x13')][_0xcf9b('0x11')]);}})[_0xcf9b('0x14')](function(_0x3276a8){logger[_0xcf9b('0x10')](_0xcf9b('0xd'),_0xbf765c,_0x3276a8);_0x2c0e77(_0x3276a8);});});} \ No newline at end of file +var _0x6364=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment'];(function(_0x34bc30,_0x177cb0){var _0x5706de=function(_0x535a8c){while(--_0x535a8c){_0x34bc30['push'](_0x34bc30['shift']());}};_0x5706de(++_0x177cb0);}(_0x6364,0x8f));var _0x4636=function(_0x698446,_0x5d9fd0){_0x698446=_0x698446-0x0;var _0x70a82b=_0x6364[_0x698446];return _0x70a82b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4636('0x0'));var BPromise=require(_0x4636('0x1'));var rs=require(_0x4636('0x2'));var fs=require('fs');var Redis=require(_0x4636('0x3'));var db=require(_0x4636('0x4'))['db'];var utils=require(_0x4636('0x5'));var logger=require(_0x4636('0x6'))(_0x4636('0x7'));var config=require('../../config/environment');var jayson=require(_0x4636('0x8'));var client=jayson[_0x4636('0x9')][_0x4636('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x185ea0,_0x17456d,_0x4e662e){return new BPromise(function(_0xd364dc,_0x1be4b5){return client[_0x4636('0xb')](_0x185ea0,_0x4e662e)[_0x4636('0xc')](function(_0x498de6){logger[_0x4636('0xd')](_0x4636('0xe'),_0x17456d,_0x4636('0xf'));logger[_0x4636('0x10')](_0x4636('0x11'),_0x17456d,'request\x20sent',JSON[_0x4636('0x12')](_0x498de6));if(_0x498de6[_0x4636('0x13')]){if(_0x498de6[_0x4636('0x13')][_0x4636('0x14')]===0x1f4){logger['error'](_0x4636('0xe'),_0x17456d,_0x498de6[_0x4636('0x13')][_0x4636('0x15')]);return _0x1be4b5(_0x498de6[_0x4636('0x13')][_0x4636('0x15')]);}logger['error']('Migration,\x20%s,\x20%s',_0x17456d,_0x498de6[_0x4636('0x13')][_0x4636('0x15')]);return _0xd364dc(_0x498de6[_0x4636('0x13')][_0x4636('0x15')]);}else{logger['info'](_0x4636('0xe'),_0x17456d,_0x4636('0xf'));_0xd364dc(_0x498de6[_0x4636('0x16')][_0x4636('0x15')]);}})[_0x4636('0x17')](function(_0x216748){logger['error'](_0x4636('0xe'),_0x17456d,_0x216748);_0x1be4b5(_0x216748);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index f81985d..890e90d 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 _0x4489=['Router','fs-extra','isAuthenticated','get','show','post','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express'];(function(_0x351a2e,_0x578e7f){var _0x1a39e4=function(_0x2257a3){while(--_0x2257a3){_0x351a2e['push'](_0x351a2e['shift']());}};_0x1a39e4(++_0x578e7f);}(_0x4489,0x164));var _0x9448=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4489[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x9448('0x0'));var util=require(_0x9448('0x1'));var path=require('path');var timeout=require(_0x9448('0x2'));var express=require(_0x9448('0x3'));var router=express[_0x9448('0x4')]();var fs_extra=require(_0x9448('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./network.controller');router['get']('/',auth[_0x9448('0x6')](),controller['index']);router[_0x9448('0x7')]('/:id',auth[_0x9448('0x6')](),controller[_0x9448('0x8')]);router[_0x9448('0x9')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x9448('0xa'),auth[_0x9448('0x6')](),controller[_0x9448('0xb')]);router[_0x9448('0xc')](_0x9448('0xa'),auth['isAuthenticated'](),controller[_0x9448('0xd')]);module[_0x9448('0xe')]=router; \ No newline at end of file +var _0x9148=['isAuthenticated','get','show','post','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller'];(function(_0x1a1818,_0x36400c){var _0x361250=function(_0x377ded){while(--_0x377ded){_0x1a1818['push'](_0x1a1818['shift']());}};_0x361250(++_0x36400c);}(_0x9148,0x10d));var _0x8914=function(_0x3df419,_0xa233ba){_0x3df419=_0x3df419-0x0;var _0x461974=_0x9148[_0x3df419];return _0x461974;};'use strict';var multer=require(_0x8914('0x0'));var util=require(_0x8914('0x1'));var path=require(_0x8914('0x2'));var timeout=require(_0x8914('0x3'));var express=require(_0x8914('0x4'));var router=express[_0x8914('0x5')]();var fs_extra=require(_0x8914('0x6'));var auth=require(_0x8914('0x7'));var interaction=require(_0x8914('0x8'));var config=require(_0x8914('0x9'));var controller=require(_0x8914('0xa'));router['get']('/',auth[_0x8914('0xb')](),controller['index']);router[_0x8914('0xc')]('/:id',auth[_0x8914('0xb')](),controller[_0x8914('0xd')]);router[_0x8914('0xe')]('/',auth[_0x8914('0xb')](),controller['create']);router[_0x8914('0xf')](_0x8914('0x10'),auth[_0x8914('0xb')](),controller[_0x8914('0x11')]);router[_0x8914('0x12')]('/:id',auth[_0x8914('0xb')](),controller[_0x8914('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index d233439..9abe6e4 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 _0xef17=['externip','stun','turn','STRING','sequelize','ENUM','localnet'];(function(_0x20c42c,_0x110411){var _0x56126c=function(_0x42a499){while(--_0x42a499){_0x20c42c['push'](_0x20c42c['shift']());}};_0x56126c(++_0x110411);}(_0xef17,0x82));var _0x7ef1=function(_0x126e4d,_0x442aed){_0x126e4d=_0x126e4d-0x0;var _0x39e090=_0xef17[_0x126e4d];return _0x39e090;};'use strict';var Sequelize=require(_0x7ef1('0x0'));module['exports']={'type':{'type':Sequelize[_0x7ef1('0x1')](_0x7ef1('0x2'),_0x7ef1('0x3'),_0x7ef1('0x4'),_0x7ef1('0x5'))},'value':{'type':Sequelize[_0x7ef1('0x6')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x7ef1('0x6')]}}; \ No newline at end of file +var _0x7ab4=['exports','ENUM','localnet','externip','stun','STRING','sequelize'];(function(_0x2cc104,_0x275dbb){var _0x191b17=function(_0x4cc7f8){while(--_0x4cc7f8){_0x2cc104['push'](_0x2cc104['shift']());}};_0x191b17(++_0x275dbb);}(_0x7ab4,0x13a));var _0x47ab=function(_0x502598,_0x1e95c8){_0x502598=_0x502598-0x0;var _0xbdee21=_0x7ab4[_0x502598];return _0xbdee21;};'use strict';var Sequelize=require(_0x47ab('0x0'));module[_0x47ab('0x1')]={'type':{'type':Sequelize[_0x47ab('0x2')](_0x47ab('0x3'),_0x47ab('0x4'),_0x47ab('0x5'),'turn')},'value':{'type':Sequelize[_0x47ab('0x6')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index fd7dc03..306f196 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 _0xa31e=['catch','status','json','offset','undefined','count','limit','set','Content-Range','update','end','stack','name','send','index','Network','rawAttributes','type','query','model','attributes','intersection','fields','length','nolimit','sort','where','filters','pick','filter','merge','map','VIRTUAL','options','include','findAll','rows','show','includeAll','find','create','body','toUpperCase','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','writeFileSync','/etc/asterisk/stun_xcally.conf','res_stun_monitor.so','server/files/templates/turn_multiple.ejs','render','/etc/asterisk/turn_xcally.conf','Reload','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','params','TURN','destroy','util','path','ejs','lodash','../../components/parsers/qs','api','../../config/environment','jayson/promise','request','then','info','Network,\x20%s,\x20%s','Network,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message'];(function(_0x220109,_0x1d2547){var _0x4ccd65=function(_0x33e0d9){while(--_0x33e0d9){_0x220109['push'](_0x220109['shift']());}};_0x4ccd65(++_0x1d2547);}(_0xa31e,0x184));var _0xea31=function(_0xdb27ce,_0x21e4f6){_0xdb27ce=_0xdb27ce-0x0;var _0x2a9fcb=_0xa31e[_0xdb27ce];return _0x2a9fcb;};'use strict';var util=require(_0xea31('0x0'));var path=require(_0xea31('0x1'));var ejs=require(_0xea31('0x2'));var fs=require('fs');var _=require(_0xea31('0x3'));var qs=require(_0xea31('0x4'));var logger=require('../../config/logger')(_0xea31('0x5'));var config=require(_0xea31('0x6'));var db=require('../../mysqldb')['db'];var jayson=require(_0xea31('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x282624,_0x31489a,_0x11848d,_0x2b820e){return new Promise(function(_0x380961,_0x305ec2){var _0x29fd72=_0x2b820e||client;return _0x29fd72[_0xea31('0x8')](_0x282624,_0x11848d)[_0xea31('0x9')](function(_0x2eae51){logger[_0xea31('0xa')](_0xea31('0xb'),_0x31489a,'request\x20sent');logger['debug'](_0xea31('0xc'),_0x31489a,_0xea31('0xd'),JSON['stringify'](_0x2eae51));if(_0x2eae51[_0xea31('0xe')]){if(_0x2eae51[_0xea31('0xe')][_0xea31('0xf')]===0x1f4){logger[_0xea31('0xe')](_0xea31('0xb'),_0x31489a,_0x2eae51[_0xea31('0xe')][_0xea31('0x10')]);return _0x305ec2(_0x2eae51[_0xea31('0xe')][_0xea31('0x10')]);}logger[_0xea31('0xe')](_0xea31('0xb'),_0x31489a,_0x2eae51[_0xea31('0xe')]['message']);return _0x380961(_0x2eae51[_0xea31('0xe')]['message']);}else{logger[_0xea31('0xa')](_0xea31('0xb'),_0x31489a,'request\x20sent');_0x380961(_0x2eae51['result']['message']);}})[_0xea31('0x11')](function(_0x52ad18){logger[_0xea31('0xe')]('Network,\x20%s,\x20%s',_0x31489a,_0x52ad18);_0x305ec2(_0x52ad18);});});}function respondWithResult(_0x3975fd,_0x4a8968){_0x4a8968=_0x4a8968||0xc8;return function(_0x433770){if(_0x433770){return _0x3975fd[_0xea31('0x12')](_0x4a8968)[_0xea31('0x13')](_0x433770);}};}function respondWithFilteredResult(_0x4a1e6e,_0x9994e5){return function(_0x3cdcaf){if(_0x3cdcaf){var _0x5e7f64=typeof _0x9994e5[_0xea31('0x14')]===_0xea31('0x15')&&typeof _0x9994e5['limit']===_0xea31('0x15');var _0x28fa20=_0x3cdcaf[_0xea31('0x16')];var _0x547433=_0x5e7f64?0x0:_0x9994e5[_0xea31('0x14')];var _0x3ed06b=_0x5e7f64?_0x3cdcaf[_0xea31('0x16')]:_0x9994e5[_0xea31('0x14')]+_0x9994e5[_0xea31('0x17')];var _0x5a9ba3;if(_0x3ed06b>=_0x28fa20){_0x3ed06b=_0x28fa20;_0x5a9ba3=0xc8;}else{_0x5a9ba3=0xce;}_0x4a1e6e['status'](_0x5a9ba3);return _0x4a1e6e[_0xea31('0x18')](_0xea31('0x19'),_0x547433+'-'+_0x3ed06b+'/'+_0x28fa20)[_0xea31('0x13')](_0x3cdcaf);}return null;};}function saveUpdates(_0x620b14){return function(_0x3e7ead){if(_0x3e7ead){return _0x3e7ead[_0xea31('0x1a')](_0x620b14)[_0xea31('0x9')](function(_0x1d6aaa){return _0x1d6aaa;});}return null;};}function removeEntity(_0x45ef4d){return function(_0x456596){if(_0x456596){return _0x456596['destroy']()[_0xea31('0x9')](function(){_0x45ef4d['status'](0xcc)[_0xea31('0x1b')]();});}};}function handleEntityNotFound(_0xe4c44){return function(_0x5b7b66){if(!_0x5b7b66){_0xe4c44['sendStatus'](0x194);}return _0x5b7b66;};}function handleError(_0xc5ae7c,_0x68cd5f){_0x68cd5f=_0x68cd5f||0x1f4;return function(_0x27f754){logger[_0xea31('0xe')](_0x27f754[_0xea31('0x1c')]);if(_0x27f754[_0xea31('0x1d')]){delete _0x27f754['name'];}_0xc5ae7c[_0xea31('0x12')](_0x68cd5f)[_0xea31('0x1e')](_0x27f754);};}exports[_0xea31('0x1f')]=function(_0x30b6eb,_0x550f76){var _0x7148aa={},_0x3eebc4={},_0x30fb74={'count':0x0,'rows':[]};var _0x460f07=_['map'](db[_0xea31('0x20')][_0xea31('0x21')],function(_0xe46d0f){return{'name':_0xe46d0f['fieldName'],'type':_0xe46d0f[_0xea31('0x22')]['key']};});_0x3eebc4['model']=_['map'](_0x460f07,_0xea31('0x1d'));_0x3eebc4[_0xea31('0x23')]=_['keys'](_0x30b6eb[_0xea31('0x23')]);_0x3eebc4['filters']=_['intersection'](_0x3eebc4[_0xea31('0x24')],_0x3eebc4[_0xea31('0x23')]);_0x7148aa[_0xea31('0x25')]=_[_0xea31('0x26')](_0x3eebc4[_0xea31('0x24')],qs[_0xea31('0x27')](_0x30b6eb[_0xea31('0x23')][_0xea31('0x27')]));_0x7148aa[_0xea31('0x25')]=_0x7148aa[_0xea31('0x25')][_0xea31('0x28')]?_0x7148aa[_0xea31('0x25')]:_0x3eebc4[_0xea31('0x24')];if(!_0x30b6eb[_0xea31('0x23')]['hasOwnProperty'](_0xea31('0x29'))){_0x7148aa[_0xea31('0x17')]=qs['limit'](_0x30b6eb[_0xea31('0x23')][_0xea31('0x17')]);_0x7148aa[_0xea31('0x14')]=qs[_0xea31('0x14')](_0x30b6eb['query'][_0xea31('0x14')]);}_0x7148aa['order']=qs[_0xea31('0x2a')](_0x30b6eb[_0xea31('0x23')][_0xea31('0x2a')]);_0x7148aa[_0xea31('0x2b')]=qs[_0xea31('0x2c')](_[_0xea31('0x2d')](_0x30b6eb[_0xea31('0x23')],_0x3eebc4[_0xea31('0x2c')]),_0x460f07);if(_0x30b6eb[_0xea31('0x23')][_0xea31('0x2e')]){_0x7148aa[_0xea31('0x2b')]=_[_0xea31('0x2f')](_0x7148aa[_0xea31('0x2b')],{'$or':_[_0xea31('0x30')](_0x460f07,function(_0x743987){if(_0x743987[_0xea31('0x22')]!==_0xea31('0x31')){var _0x35667d={};_0x35667d[_0x743987[_0xea31('0x1d')]]={'$like':'%'+_0x30b6eb[_0xea31('0x23')][_0xea31('0x2e')]+'%'};return _0x35667d;}})});}_0x7148aa=_[_0xea31('0x2f')]({},_0x7148aa,_0x30b6eb[_0xea31('0x32')]);var _0x2c2f9e={'where':_0x7148aa[_0xea31('0x2b')]};return db[_0xea31('0x20')][_0xea31('0x16')](_0x2c2f9e)['then'](function(_0x53c4ff){_0x30fb74['count']=_0x53c4ff;if(_0x30b6eb[_0xea31('0x23')]['includeAll']){_0x7148aa[_0xea31('0x33')]=[{'all':!![]}];}return db[_0xea31('0x20')][_0xea31('0x34')](_0x7148aa);})[_0xea31('0x9')](function(_0x48f3ac){_0x30fb74[_0xea31('0x35')]=_0x48f3ac;return _0x30fb74;})[_0xea31('0x9')](respondWithFilteredResult(_0x550f76,_0x7148aa))[_0xea31('0x11')](handleError(_0x550f76,null));};exports[_0xea31('0x36')]=function(_0x50c9ed,_0x3e63db){var _0x2f9e03={'raw':!![],'where':{'id':_0x50c9ed['params']['id']}},_0x5a4e37={};_0x5a4e37[_0xea31('0x24')]=_['keys'](db[_0xea31('0x20')]['rawAttributes']);_0x5a4e37[_0xea31('0x23')]=_['keys'](_0x50c9ed['query']);_0x5a4e37[_0xea31('0x2c')]=_[_0xea31('0x26')](_0x5a4e37['model'],_0x5a4e37['query']);_0x2f9e03[_0xea31('0x25')]=_[_0xea31('0x26')](_0x5a4e37[_0xea31('0x24')],qs[_0xea31('0x27')](_0x50c9ed['query'][_0xea31('0x27')]));_0x2f9e03[_0xea31('0x25')]=_0x2f9e03['attributes']['length']?_0x2f9e03['attributes']:_0x5a4e37[_0xea31('0x24')];if(_0x50c9ed[_0xea31('0x23')][_0xea31('0x37')]){_0x2f9e03['include']=[{'all':!![]}];}_0x2f9e03=_['merge']({},_0x2f9e03,_0x50c9ed['options']);return db[_0xea31('0x20')][_0xea31('0x38')](_0x2f9e03)[_0xea31('0x9')](handleEntityNotFound(_0x3e63db,null))[_0xea31('0x9')](respondWithResult(_0x3e63db,null))[_0xea31('0x11')](handleError(_0x3e63db,null));};exports[_0xea31('0x39')]=function(_0x41f045,_0x1c8f94){var _0x54ad14;return db['Network'][_0xea31('0x39')](_0x41f045[_0xea31('0x3a')],{'raw':!![]})['then'](function(_0x2890fd){_0x54ad14=_0x2890fd;return db[_0xea31('0x20')][_0xea31('0x34')]({'where':{'type':_0x41f045[_0xea31('0x3a')][_0xea31('0x22')]},'raw':!![]});})['then'](function(_0x72214f){if(_0x54ad14['type'][_0xea31('0x3b')]()==_0xea31('0x3c')){var _0xa37ef4=fs[_0xea31('0x3d')](path[_0xea31('0x3e')](config[_0xea31('0x3f')],_0xea31('0x40')),_0xea31('0x41'));var _0x2c40ed=ejs['render'](_0xa37ef4,{'networks':_0x72214f||[]});fs[_0xea31('0x42')](_0xea31('0x43'),_0x2c40ed);return respondWithRpcPromise('Reload',_0xea31('0x39'),{'module':_0xea31('0x44')});}else if(_0x54ad14[_0xea31('0x22')]['toUpperCase']()=='TURN'){var _0x53ca75=fs[_0xea31('0x3d')](path[_0xea31('0x3e')](config['root'],_0xea31('0x45')),_0xea31('0x41'));var _0x551d6a=ejs[_0xea31('0x46')](_0x53ca75,{'networks':_0x72214f||[]});fs[_0xea31('0x42')](_0xea31('0x47'),_0x551d6a);return respondWithRpcPromise(_0xea31('0x48'),_0xea31('0x39'),{'module':_0xea31('0x44')});}else{var _0x5ab5de=fs['readFileSync'](path[_0xea31('0x3e')](config[_0xea31('0x3f')],_0xea31('0x49')),_0xea31('0x41'));var _0x3b2107=ejs[_0xea31('0x46')](_0x5ab5de,{'networks':_0x72214f||[]});fs[_0xea31('0x42')](util[_0xea31('0x4a')](_0xea31('0x4b'),_0x41f045[_0xea31('0x3a')][_0xea31('0x22')][_0xea31('0x4c')]()),_0x3b2107);return respondWithRpcPromise(_0xea31('0x48'),_0xea31('0x39'),{'module':_0xea31('0x4d')});}})[_0xea31('0x9')](function(){return _0x54ad14;})[_0xea31('0x9')](respondWithResult(_0x1c8f94,0xc9))[_0xea31('0x11')](handleError(_0x1c8f94,null));};exports['update']=function(_0x5e39eb,_0x249d76){var _0x2e6826;return db[_0xea31('0x20')][_0xea31('0x38')]({'where':{'id':_0x5e39eb[_0xea31('0x4e')]['id']}})[_0xea31('0x9')](handleEntityNotFound(_0x249d76,null))['then'](saveUpdates(_0x5e39eb[_0xea31('0x3a')],null))[_0xea31('0x9')](function(_0x43f9cc){if(_0x43f9cc){_0x2e6826=_0x43f9cc;return db['Network'][_0xea31('0x34')]({'where':{'type':_0x2e6826[_0xea31('0x22')]},'raw':!![]});}return null;})[_0xea31('0x9')](function(_0x2d8c3f){if(_0x2e6826[_0xea31('0x22')]['toUpperCase']()==_0xea31('0x3c')){var _0x1c46c1=fs[_0xea31('0x3d')](path['join'](config[_0xea31('0x3f')],_0xea31('0x40')),_0xea31('0x41'));var _0x1a3962=ejs['render'](_0x1c46c1,{'networks':_0x2d8c3f||[]});fs['writeFileSync'](_0xea31('0x43'),_0x1a3962);return respondWithRpcPromise(_0xea31('0x48'),_0xea31('0x1a'),{'module':_0xea31('0x44')});}else if(_0x2e6826[_0xea31('0x22')][_0xea31('0x3b')]()==_0xea31('0x4f')){var _0x1798bc=fs[_0xea31('0x3d')](path['join'](config['root'],_0xea31('0x45')),_0xea31('0x41'));var _0x78ba52=ejs['render'](_0x1798bc,{'networks':_0x2d8c3f||[]});fs['writeFileSync'](_0xea31('0x47'),_0x78ba52);return respondWithRpcPromise(_0xea31('0x48'),_0xea31('0x1a'),{'module':_0xea31('0x44')});}else{var _0x54193b=fs['readFileSync'](path[_0xea31('0x3e')](config['root'],_0xea31('0x49')),_0xea31('0x41'));var _0xe2fd62=ejs['render'](_0x54193b,{'networks':_0x2d8c3f||[]});fs[_0xea31('0x42')](util[_0xea31('0x4a')]('/etc/asterisk/sip_xcally_%s.conf',_0x5e39eb['body'][_0xea31('0x22')][_0xea31('0x4c')]()),_0xe2fd62);return respondWithRpcPromise('Reload',_0xea31('0x1a'),{'module':'chan_sip.so'});}})[_0xea31('0x9')](function(_0x1c9459){if(_0x1c9459){return _0x2e6826;}return null;})[_0xea31('0x9')](respondWithResult(_0x249d76,null))[_0xea31('0x11')](handleError(_0x249d76,null));};exports['destroy']=function(_0x4e797d,_0x49c6ed){var _0x17f427;return db[_0xea31('0x20')][_0xea31('0x38')]({'where':{'id':_0x4e797d[_0xea31('0x4e')]['id']}})[_0xea31('0x9')](function(_0x363408){_0x17f427=_0x363408;return _0x363408;})[_0xea31('0x9')](handleEntityNotFound(_0x49c6ed,null))['then'](removeEntity(_0x49c6ed,null))[_0xea31('0x9')](function(){if(_0x17f427){return db[_0xea31('0x20')][_0xea31('0x34')]({'where':{'type':_0x17f427[_0xea31('0x22')]},'raw':!![]});}})[_0xea31('0x9')](function(_0x273abc){if(_0x17f427[_0xea31('0x22')][_0xea31('0x3b')]()==_0xea31('0x3c')){var _0x549292=fs[_0xea31('0x3d')](path[_0xea31('0x3e')](config[_0xea31('0x3f')],'server/files/templates/stun_multiple.ejs'),'utf8');var _0x1bf19c=ejs[_0xea31('0x46')](_0x549292,{'networks':_0x273abc||[]});fs[_0xea31('0x42')](_0xea31('0x43'),_0x1bf19c);return respondWithRpcPromise(_0xea31('0x48'),_0xea31('0x50'),{'module':'res_stun_monitor.so'});}else if(_0x17f427[_0xea31('0x22')][_0xea31('0x3b')]()==_0xea31('0x4f')){var _0x4e6716=fs[_0xea31('0x3d')](path['join'](config[_0xea31('0x3f')],_0xea31('0x45')),_0xea31('0x41'));var _0x465a69=ejs[_0xea31('0x46')](_0x4e6716,{'networks':_0x273abc||[]});fs[_0xea31('0x42')]('/etc/asterisk/turn_xcally.conf',_0x465a69);return respondWithRpcPromise(_0xea31('0x48'),_0xea31('0x50'),{'module':'res_stun_monitor.so'});}else{var _0x415b02=fs[_0xea31('0x3d')](path[_0xea31('0x3e')](config['root'],_0xea31('0x49')),_0xea31('0x41'));var _0x161875=ejs['render'](_0x415b02,{'networks':_0x273abc||[]});fs[_0xea31('0x42')](util[_0xea31('0x4a')](_0xea31('0x4b'),_0x17f427['type'][_0xea31('0x4c')]()),_0x161875);return respondWithRpcPromise(_0xea31('0x48'),_0xea31('0x50'),{'module':_0xea31('0x4d')});}})[_0xea31('0x11')](handleError(_0x49c6ed,null));}; \ No newline at end of file +var _0xf3bd=['send','index','map','rawAttributes','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','Network','includeAll','include','findAll','rows','show','params','keys','find','create','body','toUpperCase','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','render','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','writeFileSync','utf8','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','server/files/templates/turn_multiple.ejs','ejs','api','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','Network,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','json','offset','limit','undefined','count','status','update','destroy','end','sendStatus','stack','name'];(function(_0x3243c5,_0x390ac7){var _0x2d2950=function(_0x530f50){while(--_0x530f50){_0x3243c5['push'](_0x3243c5['shift']());}};_0x2d2950(++_0x390ac7);}(_0xf3bd,0xe0));var _0xdf3b=function(_0x51fff5,_0x19a074){_0x51fff5=_0x51fff5-0x0;var _0x132417=_0xf3bd[_0x51fff5];return _0x132417;};'use strict';var util=require('util');var path=require('path');var ejs=require(_0xdf3b('0x0'));var fs=require('fs');var _=require('lodash');var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0xdf3b('0x1'));var config=require(_0xdf3b('0x2'));var db=require(_0xdf3b('0x3'))['db'];var jayson=require(_0xdf3b('0x4'));var client=jayson[_0xdf3b('0x5')][_0xdf3b('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x49e99f,_0x10c53d,_0x17a2fe,_0xcc28f3){return new Promise(function(_0x13e1b7,_0x42370b){var _0x56b0a6=_0xcc28f3||client;return _0x56b0a6[_0xdf3b('0x7')](_0x49e99f,_0x17a2fe)[_0xdf3b('0x8')](function(_0x238830){logger['info'](_0xdf3b('0x9'),_0x10c53d,_0xdf3b('0xa'));logger[_0xdf3b('0xb')]('Network,\x20%s,\x20%s,\x20%s',_0x10c53d,_0xdf3b('0xa'),JSON[_0xdf3b('0xc')](_0x238830));if(_0x238830['error']){if(_0x238830[_0xdf3b('0xd')][_0xdf3b('0xe')]===0x1f4){logger['error'](_0xdf3b('0x9'),_0x10c53d,_0x238830['error'][_0xdf3b('0xf')]);return _0x42370b(_0x238830['error']['message']);}logger[_0xdf3b('0xd')](_0xdf3b('0x9'),_0x10c53d,_0x238830[_0xdf3b('0xd')][_0xdf3b('0xf')]);return _0x13e1b7(_0x238830[_0xdf3b('0xd')][_0xdf3b('0xf')]);}else{logger[_0xdf3b('0x10')](_0xdf3b('0x9'),_0x10c53d,_0xdf3b('0xa'));_0x13e1b7(_0x238830[_0xdf3b('0x11')][_0xdf3b('0xf')]);}})[_0xdf3b('0x12')](function(_0x2d5cad){logger[_0xdf3b('0xd')](_0xdf3b('0x9'),_0x10c53d,_0x2d5cad);_0x42370b(_0x2d5cad);});});}function respondWithResult(_0x2e3352,_0x59ecf3){_0x59ecf3=_0x59ecf3||0xc8;return function(_0x2b90ff){if(_0x2b90ff){return _0x2e3352['status'](_0x59ecf3)[_0xdf3b('0x13')](_0x2b90ff);}};}function respondWithFilteredResult(_0x524f2b,_0x3e92cd){return function(_0x46abbc){if(_0x46abbc){var _0x589583=typeof _0x3e92cd[_0xdf3b('0x14')]==='undefined'&&typeof _0x3e92cd[_0xdf3b('0x15')]===_0xdf3b('0x16');var _0xcbae00=_0x46abbc[_0xdf3b('0x17')];var _0x532024=_0x589583?0x0:_0x3e92cd['offset'];var _0x5e924b=_0x589583?_0x46abbc['count']:_0x3e92cd[_0xdf3b('0x14')]+_0x3e92cd['limit'];var _0x1757cb;if(_0x5e924b>=_0xcbae00){_0x5e924b=_0xcbae00;_0x1757cb=0xc8;}else{_0x1757cb=0xce;}_0x524f2b[_0xdf3b('0x18')](_0x1757cb);return _0x524f2b['set']('Content-Range',_0x532024+'-'+_0x5e924b+'/'+_0xcbae00)['json'](_0x46abbc);}return null;};}function saveUpdates(_0x5353ad){return function(_0x4b46a6){if(_0x4b46a6){return _0x4b46a6[_0xdf3b('0x19')](_0x5353ad)[_0xdf3b('0x8')](function(_0x3419be){return _0x3419be;});}return null;};}function removeEntity(_0x325812){return function(_0x4c4f99){if(_0x4c4f99){return _0x4c4f99[_0xdf3b('0x1a')]()['then'](function(){_0x325812[_0xdf3b('0x18')](0xcc)[_0xdf3b('0x1b')]();});}};}function handleEntityNotFound(_0x5712a2){return function(_0x83b834){if(!_0x83b834){_0x5712a2[_0xdf3b('0x1c')](0x194);}return _0x83b834;};}function handleError(_0x10cc2c,_0x3c0546){_0x3c0546=_0x3c0546||0x1f4;return function(_0x55f1b7){logger[_0xdf3b('0xd')](_0x55f1b7[_0xdf3b('0x1d')]);if(_0x55f1b7[_0xdf3b('0x1e')]){delete _0x55f1b7[_0xdf3b('0x1e')];}_0x10cc2c[_0xdf3b('0x18')](_0x3c0546)[_0xdf3b('0x1f')](_0x55f1b7);};}exports[_0xdf3b('0x20')]=function(_0x3fcef1,_0x1c0f27){var _0x159d0d={},_0x5f2fa9={},_0x334903={'count':0x0,'rows':[]};var _0x4266fd=_[_0xdf3b('0x21')](db['Network'][_0xdf3b('0x22')],function(_0x5b7806){return{'name':_0x5b7806['fieldName'],'type':_0x5b7806[_0xdf3b('0x23')][_0xdf3b('0x24')]};});_0x5f2fa9['model']=_[_0xdf3b('0x21')](_0x4266fd,'name');_0x5f2fa9[_0xdf3b('0x25')]=_['keys'](_0x3fcef1[_0xdf3b('0x25')]);_0x5f2fa9[_0xdf3b('0x26')]=_[_0xdf3b('0x27')](_0x5f2fa9[_0xdf3b('0x28')],_0x5f2fa9[_0xdf3b('0x25')]);_0x159d0d['attributes']=_[_0xdf3b('0x27')](_0x5f2fa9[_0xdf3b('0x28')],qs['fields'](_0x3fcef1['query'][_0xdf3b('0x29')]));_0x159d0d['attributes']=_0x159d0d[_0xdf3b('0x2a')][_0xdf3b('0x2b')]?_0x159d0d[_0xdf3b('0x2a')]:_0x5f2fa9['model'];if(!_0x3fcef1[_0xdf3b('0x25')][_0xdf3b('0x2c')](_0xdf3b('0x2d'))){_0x159d0d[_0xdf3b('0x15')]=qs[_0xdf3b('0x15')](_0x3fcef1[_0xdf3b('0x25')][_0xdf3b('0x15')]);_0x159d0d['offset']=qs[_0xdf3b('0x14')](_0x3fcef1[_0xdf3b('0x25')][_0xdf3b('0x14')]);}_0x159d0d[_0xdf3b('0x2e')]=qs['sort'](_0x3fcef1['query'][_0xdf3b('0x2f')]);_0x159d0d[_0xdf3b('0x30')]=qs['filters'](_[_0xdf3b('0x31')](_0x3fcef1[_0xdf3b('0x25')],_0x5f2fa9[_0xdf3b('0x26')]),_0x4266fd);if(_0x3fcef1[_0xdf3b('0x25')][_0xdf3b('0x32')]){_0x159d0d[_0xdf3b('0x30')]=_[_0xdf3b('0x33')](_0x159d0d['where'],{'$or':_[_0xdf3b('0x21')](_0x4266fd,function(_0x42d7b2){if(_0x42d7b2[_0xdf3b('0x23')]!==_0xdf3b('0x34')){var _0x433e85={};_0x433e85[_0x42d7b2[_0xdf3b('0x1e')]]={'$like':'%'+_0x3fcef1[_0xdf3b('0x25')][_0xdf3b('0x32')]+'%'};return _0x433e85;}})});}_0x159d0d=_['merge']({},_0x159d0d,_0x3fcef1[_0xdf3b('0x35')]);var _0x57ecc={'where':_0x159d0d[_0xdf3b('0x30')]};return db[_0xdf3b('0x36')][_0xdf3b('0x17')](_0x57ecc)[_0xdf3b('0x8')](function(_0x3a490d){_0x334903['count']=_0x3a490d;if(_0x3fcef1[_0xdf3b('0x25')][_0xdf3b('0x37')]){_0x159d0d[_0xdf3b('0x38')]=[{'all':!![]}];}return db[_0xdf3b('0x36')][_0xdf3b('0x39')](_0x159d0d);})[_0xdf3b('0x8')](function(_0x18e758){_0x334903[_0xdf3b('0x3a')]=_0x18e758;return _0x334903;})[_0xdf3b('0x8')](respondWithFilteredResult(_0x1c0f27,_0x159d0d))[_0xdf3b('0x12')](handleError(_0x1c0f27,null));};exports[_0xdf3b('0x3b')]=function(_0x16dc47,_0x202f93){var _0x1b6a43={'raw':!![],'where':{'id':_0x16dc47[_0xdf3b('0x3c')]['id']}},_0x5c40e2={};_0x5c40e2[_0xdf3b('0x28')]=_[_0xdf3b('0x3d')](db[_0xdf3b('0x36')][_0xdf3b('0x22')]);_0x5c40e2[_0xdf3b('0x25')]=_['keys'](_0x16dc47[_0xdf3b('0x25')]);_0x5c40e2['filters']=_[_0xdf3b('0x27')](_0x5c40e2[_0xdf3b('0x28')],_0x5c40e2[_0xdf3b('0x25')]);_0x1b6a43[_0xdf3b('0x2a')]=_['intersection'](_0x5c40e2[_0xdf3b('0x28')],qs[_0xdf3b('0x29')](_0x16dc47[_0xdf3b('0x25')][_0xdf3b('0x29')]));_0x1b6a43[_0xdf3b('0x2a')]=_0x1b6a43['attributes'][_0xdf3b('0x2b')]?_0x1b6a43[_0xdf3b('0x2a')]:_0x5c40e2['model'];if(_0x16dc47[_0xdf3b('0x25')]['includeAll']){_0x1b6a43['include']=[{'all':!![]}];}_0x1b6a43=_['merge']({},_0x1b6a43,_0x16dc47[_0xdf3b('0x35')]);return db['Network'][_0xdf3b('0x3e')](_0x1b6a43)[_0xdf3b('0x8')](handleEntityNotFound(_0x202f93,null))[_0xdf3b('0x8')](respondWithResult(_0x202f93,null))[_0xdf3b('0x12')](handleError(_0x202f93,null));};exports[_0xdf3b('0x3f')]=function(_0x184b3a,_0x20d980){var _0x59e294;return db[_0xdf3b('0x36')]['create'](_0x184b3a[_0xdf3b('0x40')],{'raw':!![]})[_0xdf3b('0x8')](function(_0x24d7af){_0x59e294=_0x24d7af;return db[_0xdf3b('0x36')][_0xdf3b('0x39')]({'where':{'type':_0x184b3a[_0xdf3b('0x40')]['type']},'raw':!![]});})[_0xdf3b('0x8')](function(_0x580e2e){if(_0x59e294[_0xdf3b('0x23')][_0xdf3b('0x41')]()==_0xdf3b('0x42')){var _0x5d6418=fs[_0xdf3b('0x43')](path[_0xdf3b('0x44')](config[_0xdf3b('0x45')],_0xdf3b('0x46')),'utf8');var _0x4b4239=ejs[_0xdf3b('0x47')](_0x5d6418,{'networks':_0x580e2e||[]});fs['writeFileSync'](_0xdf3b('0x48'),_0x4b4239);return respondWithRpcPromise(_0xdf3b('0x49'),_0xdf3b('0x3f'),{'module':_0xdf3b('0x4a')});}else if(_0x59e294[_0xdf3b('0x23')]['toUpperCase']()==_0xdf3b('0x4b')){var _0x293621=fs[_0xdf3b('0x43')](path['join'](config['root'],'server/files/templates/turn_multiple.ejs'),'utf8');var _0x248476=ejs[_0xdf3b('0x47')](_0x293621,{'networks':_0x580e2e||[]});fs[_0xdf3b('0x4c')]('/etc/asterisk/turn_xcally.conf',_0x248476);return respondWithRpcPromise('Reload',_0xdf3b('0x3f'),{'module':_0xdf3b('0x4a')});}else{var _0x8fa7aa=fs[_0xdf3b('0x43')](path[_0xdf3b('0x44')](config[_0xdf3b('0x45')],'server/files/templates/network.ejs'),_0xdf3b('0x4d'));var _0x14bfc8=ejs['render'](_0x8fa7aa,{'networks':_0x580e2e||[]});fs[_0xdf3b('0x4c')](util[_0xdf3b('0x4e')](_0xdf3b('0x4f'),_0x184b3a['body'][_0xdf3b('0x23')][_0xdf3b('0x50')]()),_0x14bfc8);return respondWithRpcPromise(_0xdf3b('0x49'),_0xdf3b('0x3f'),{'module':_0xdf3b('0x51')});}})[_0xdf3b('0x8')](function(){return _0x59e294;})[_0xdf3b('0x8')](respondWithResult(_0x20d980,0xc9))[_0xdf3b('0x12')](handleError(_0x20d980,null));};exports[_0xdf3b('0x19')]=function(_0x57c6e8,_0x3ffa0c){var _0x322c04;return db[_0xdf3b('0x36')][_0xdf3b('0x3e')]({'where':{'id':_0x57c6e8[_0xdf3b('0x3c')]['id']}})[_0xdf3b('0x8')](handleEntityNotFound(_0x3ffa0c,null))['then'](saveUpdates(_0x57c6e8[_0xdf3b('0x40')],null))[_0xdf3b('0x8')](function(_0x4326de){if(_0x4326de){_0x322c04=_0x4326de;return db[_0xdf3b('0x36')][_0xdf3b('0x39')]({'where':{'type':_0x322c04[_0xdf3b('0x23')]},'raw':!![]});}return null;})[_0xdf3b('0x8')](function(_0x40d0ae){if(_0x322c04[_0xdf3b('0x23')][_0xdf3b('0x41')]()==_0xdf3b('0x42')){var _0x94e3fd=fs[_0xdf3b('0x43')](path[_0xdf3b('0x44')](config[_0xdf3b('0x45')],_0xdf3b('0x46')),_0xdf3b('0x4d'));var _0x29b158=ejs[_0xdf3b('0x47')](_0x94e3fd,{'networks':_0x40d0ae||[]});fs[_0xdf3b('0x4c')](_0xdf3b('0x48'),_0x29b158);return respondWithRpcPromise(_0xdf3b('0x49'),_0xdf3b('0x19'),{'module':_0xdf3b('0x4a')});}else if(_0x322c04[_0xdf3b('0x23')][_0xdf3b('0x41')]()=='TURN'){var _0x3ac36b=fs[_0xdf3b('0x43')](path[_0xdf3b('0x44')](config[_0xdf3b('0x45')],'server/files/templates/turn_multiple.ejs'),_0xdf3b('0x4d'));var _0x509b1a=ejs['render'](_0x3ac36b,{'networks':_0x40d0ae||[]});fs[_0xdf3b('0x4c')](_0xdf3b('0x52'),_0x509b1a);return respondWithRpcPromise('Reload','update',{'module':_0xdf3b('0x4a')});}else{var _0x58d8c5=fs[_0xdf3b('0x43')](path['join'](config[_0xdf3b('0x45')],_0xdf3b('0x53')),_0xdf3b('0x4d'));var _0x14f4a3=ejs['render'](_0x58d8c5,{'networks':_0x40d0ae||[]});fs['writeFileSync'](util[_0xdf3b('0x4e')](_0xdf3b('0x4f'),_0x57c6e8[_0xdf3b('0x40')][_0xdf3b('0x23')][_0xdf3b('0x50')]()),_0x14f4a3);return respondWithRpcPromise(_0xdf3b('0x49'),'update',{'module':'chan_sip.so'});}})[_0xdf3b('0x8')](function(_0x4686c1){if(_0x4686c1){return _0x322c04;}return null;})[_0xdf3b('0x8')](respondWithResult(_0x3ffa0c,null))[_0xdf3b('0x12')](handleError(_0x3ffa0c,null));};exports[_0xdf3b('0x1a')]=function(_0x328e37,_0x39e255){var _0x3762df;return db[_0xdf3b('0x36')][_0xdf3b('0x3e')]({'where':{'id':_0x328e37[_0xdf3b('0x3c')]['id']}})[_0xdf3b('0x8')](function(_0x1d2692){_0x3762df=_0x1d2692;return _0x1d2692;})[_0xdf3b('0x8')](handleEntityNotFound(_0x39e255,null))[_0xdf3b('0x8')](removeEntity(_0x39e255,null))[_0xdf3b('0x8')](function(){if(_0x3762df){return db[_0xdf3b('0x36')][_0xdf3b('0x39')]({'where':{'type':_0x3762df[_0xdf3b('0x23')]},'raw':!![]});}})[_0xdf3b('0x8')](function(_0xb228ea){if(_0x3762df[_0xdf3b('0x23')][_0xdf3b('0x41')]()==_0xdf3b('0x42')){var _0x4cce6c=fs['readFileSync'](path[_0xdf3b('0x44')](config[_0xdf3b('0x45')],_0xdf3b('0x46')),_0xdf3b('0x4d'));var _0x24c57c=ejs['render'](_0x4cce6c,{'networks':_0xb228ea||[]});fs[_0xdf3b('0x4c')]('/etc/asterisk/stun_xcally.conf',_0x24c57c);return respondWithRpcPromise(_0xdf3b('0x49'),'destroy',{'module':_0xdf3b('0x4a')});}else if(_0x3762df[_0xdf3b('0x23')][_0xdf3b('0x41')]()=='TURN'){var _0x2f4b03=fs[_0xdf3b('0x43')](path['join'](config[_0xdf3b('0x45')],_0xdf3b('0x54')),_0xdf3b('0x4d'));var _0x5b581a=ejs['render'](_0x2f4b03,{'networks':_0xb228ea||[]});fs['writeFileSync']('/etc/asterisk/turn_xcally.conf',_0x5b581a);return respondWithRpcPromise(_0xdf3b('0x49'),'destroy',{'module':_0xdf3b('0x4a')});}else{var _0x545df4=fs['readFileSync'](path[_0xdf3b('0x44')](config[_0xdf3b('0x45')],_0xdf3b('0x53')),'utf8');var _0x26ce43=ejs['render'](_0x545df4,{'networks':_0xb228ea||[]});fs['writeFileSync'](util[_0xdf3b('0x4e')]('/etc/asterisk/sip_xcally_%s.conf',_0x3762df[_0xdf3b('0x23')][_0xdf3b('0x50')]()),_0x26ce43);return respondWithRpcPromise(_0xdf3b('0x49'),_0xdf3b('0x1a'),{'module':_0xdf3b('0x51')});}})[_0xdf3b('0x12')](handleError(_0x39e255,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index cf880b2..77fa32d 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 _0x1b73=['../../config/logger','api','moment','request-promise','rimraf','../../config/environment','exports','Network','network','util'];(function(_0x5c521a,_0x4faa20){var _0x1325a8=function(_0x56416b){while(--_0x56416b){_0x5c521a['push'](_0x5c521a['shift']());}};_0x1325a8(++_0x4faa20);}(_0x1b73,0x1d5));var _0x31b7=function(_0x276201,_0x28c04a){_0x276201=_0x276201-0x0;var _0x5bc1cf=_0x1b73[_0x276201];return _0x5bc1cf;};'use strict';var _=require('lodash');var util=require(_0x31b7('0x0'));var logger=require(_0x31b7('0x1'))(_0x31b7('0x2'));var moment=require(_0x31b7('0x3'));var BPromise=require('bluebird');var rp=require(_0x31b7('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x31b7('0x5'));var config=require(_0x31b7('0x6'));var attributes=require('./network.attributes');module[_0x31b7('0x7')]=function(_0x3d058f,_0x15c31e){return _0x3d058f['define'](_0x31b7('0x8'),attributes,{'tableName':_0x31b7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa699=['Network','network','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./network.attributes','exports','define'];(function(_0x4d1a4e,_0x15ca2d){var _0xb5d7e8=function(_0x140edc){while(--_0x140edc){_0x4d1a4e['push'](_0x4d1a4e['shift']());}};_0xb5d7e8(++_0x15ca2d);}(_0xa699,0x6b));var _0x9a69=function(_0x3cae69,_0x233c38){_0x3cae69=_0x3cae69-0x0;var _0x3128eb=_0xa699[_0x3cae69];return _0x3128eb;};'use strict';var _=require(_0x9a69('0x0'));var util=require(_0x9a69('0x1'));var logger=require(_0x9a69('0x2'))(_0x9a69('0x3'));var moment=require(_0x9a69('0x4'));var BPromise=require(_0x9a69('0x5'));var rp=require(_0x9a69('0x6'));var fs=require('fs');var path=require(_0x9a69('0x7'));var rimraf=require(_0x9a69('0x8'));var config=require(_0x9a69('0x9'));var attributes=require(_0x9a69('0xa'));module[_0x9a69('0xb')]=function(_0x15f2fc,_0x58eb4d){return _0x15f2fc[_0x9a69('0xc')](_0x9a69('0xd'),attributes,{'tableName':_0x9a69('0xe'),'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 3b96996..05b9f13 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(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x7a54,0x106));var _0x47a5=function(_0x4a1887,_0x253272){_0x4a1887=_0x4a1887-0x0;var _0x19a074=_0x7a54[_0x4a1887];return _0x19a074;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x7a54,0x106));var _0x47a5=function(_0x4127ca,_0x31e19b){_0x4127ca=_0x4127ca-0x0;var _0x58fcbb=_0x7a54[_0x4127ca];return _0x58fcbb;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 9ef914c..ea431e7 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 _0x955f=['exports','multer','util','path','connect-timeout','express','fs-extra','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','/:id/dispositions','getAnswers','getInteractions','/:id/users','getAgents','post','create','/:id/canned_answers','addAnswer','notify','/:id/applications','addApplications','addAgents','/:id/send','send','update','delete','destroy','removeDispositions','removeAnswers','removeAgents'];(function(_0x2ab9da,_0x21ebb6){var _0x56c2c4=function(_0x39e484){while(--_0x39e484){_0x2ab9da['push'](_0x2ab9da['shift']());}};_0x56c2c4(++_0x21ebb6);}(_0x955f,0x1eb));var _0xf955=function(_0x3109fa,_0x3ecbd4){_0x3109fa=_0x3109fa-0x0;var _0x577274=_0x955f[_0x3109fa];return _0x577274;};'use strict';var multer=require(_0xf955('0x0'));var util=require(_0xf955('0x1'));var path=require(_0xf955('0x2'));var timeout=require(_0xf955('0x3'));var express=require(_0xf955('0x4'));var router=express['Router']();var fs_extra=require(_0xf955('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf955('0x6'));var controller=require('./openchannelAccount.controller');router[_0xf955('0x7')]('/',auth[_0xf955('0x8')](),controller[_0xf955('0x9')]);router['get'](_0xf955('0xa'),auth[_0xf955('0x8')](),controller['describe']);router[_0xf955('0x7')](_0xf955('0xb'),auth[_0xf955('0x8')](),controller[_0xf955('0xc')]);router[_0xf955('0x7')](_0xf955('0xd'),auth[_0xf955('0x8')](),controller['getDispositions']);router[_0xf955('0x7')]('/:id/canned_answers',auth[_0xf955('0x8')](),controller[_0xf955('0xe')]);router[_0xf955('0x7')]('/:id/applications',auth[_0xf955('0x8')](),controller['getApplications']);router[_0xf955('0x7')]('/:id/interactions',auth[_0xf955('0x8')](),controller[_0xf955('0xf')]);router[_0xf955('0x7')](_0xf955('0x10'),auth[_0xf955('0x8')](),controller[_0xf955('0x11')]);router[_0xf955('0x12')]('/',auth[_0xf955('0x8')](),controller[_0xf955('0x13')]);router[_0xf955('0x12')]('/:id/dispositions',auth[_0xf955('0x8')](),controller['addDisposition']);router[_0xf955('0x12')](_0xf955('0x14'),auth[_0xf955('0x8')](),controller[_0xf955('0x15')]);router['post']('/:id/notify',controller[_0xf955('0x16')]);router[_0xf955('0x12')](_0xf955('0x17'),auth['isAuthenticated'](),controller[_0xf955('0x18')]);router[_0xf955('0x12')](_0xf955('0x10'),auth[_0xf955('0x8')](),controller[_0xf955('0x19')]);router['post'](_0xf955('0x1a'),auth[_0xf955('0x8')](),controller[_0xf955('0x1b')]);router['put'](_0xf955('0xb'),auth['isAuthenticated'](),controller[_0xf955('0x1c')]);router[_0xf955('0x1d')](_0xf955('0xb'),auth[_0xf955('0x8')](),controller[_0xf955('0x1e')]);router['delete'](_0xf955('0xd'),auth[_0xf955('0x8')](),controller[_0xf955('0x1f')]);router[_0xf955('0x1d')](_0xf955('0x14'),auth[_0xf955('0x8')](),controller[_0xf955('0x20')]);router['delete'](_0xf955('0x10'),auth[_0xf955('0x8')](),controller[_0xf955('0x21')]);module[_0xf955('0x22')]=router; \ No newline at end of file +var _0xe2cf=['post','addDisposition','addAnswer','/:id/notify','notify','addApplications','/:id/users','addAgents','send','delete','destroy','removeDispositions','removeAnswers','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelAccount.controller','get','/describe','/:id','isAuthenticated','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/applications','getInteractions','getAgents'];(function(_0x30c612,_0x4aca23){var _0x22799b=function(_0x45ff61){while(--_0x45ff61){_0x30c612['push'](_0x30c612['shift']());}};_0x22799b(++_0x4aca23);}(_0xe2cf,0x1a1));var _0xfe2c=function(_0x17f145,_0x3422bb){_0x17f145=_0x17f145-0x0;var _0x2d5420=_0xe2cf[_0x17f145];return _0x2d5420;};'use strict';var multer=require('multer');var util=require(_0xfe2c('0x0'));var path=require('path');var timeout=require(_0xfe2c('0x1'));var express=require('express');var router=express[_0xfe2c('0x2')]();var fs_extra=require(_0xfe2c('0x3'));var auth=require(_0xfe2c('0x4'));var interaction=require(_0xfe2c('0x5'));var config=require('../../config/environment');var controller=require(_0xfe2c('0x6'));router[_0xfe2c('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xfe2c('0x7')](_0xfe2c('0x8'),auth['isAuthenticated'](),controller['describe']);router[_0xfe2c('0x7')](_0xfe2c('0x9'),auth[_0xfe2c('0xa')](),controller['show']);router['get'](_0xfe2c('0xb'),auth[_0xfe2c('0xa')](),controller['getDispositions']);router[_0xfe2c('0x7')](_0xfe2c('0xc'),auth[_0xfe2c('0xa')](),controller[_0xfe2c('0xd')]);router[_0xfe2c('0x7')](_0xfe2c('0xe'),auth[_0xfe2c('0xa')](),controller['getApplications']);router['get']('/:id/interactions',auth['isAuthenticated'](),controller[_0xfe2c('0xf')]);router['get']('/:id/users',auth[_0xfe2c('0xa')](),controller[_0xfe2c('0x10')]);router[_0xfe2c('0x11')]('/',auth[_0xfe2c('0xa')](),controller['create']);router['post'](_0xfe2c('0xb'),auth[_0xfe2c('0xa')](),controller[_0xfe2c('0x12')]);router[_0xfe2c('0x11')]('/:id/canned_answers',auth[_0xfe2c('0xa')](),controller[_0xfe2c('0x13')]);router[_0xfe2c('0x11')](_0xfe2c('0x14'),controller[_0xfe2c('0x15')]);router[_0xfe2c('0x11')]('/:id/applications',auth[_0xfe2c('0xa')](),controller[_0xfe2c('0x16')]);router[_0xfe2c('0x11')](_0xfe2c('0x17'),auth['isAuthenticated'](),controller[_0xfe2c('0x18')]);router['post']('/:id/send',auth[_0xfe2c('0xa')](),controller[_0xfe2c('0x19')]);router['put'](_0xfe2c('0x9'),auth[_0xfe2c('0xa')](),controller['update']);router[_0xfe2c('0x1a')]('/:id',auth[_0xfe2c('0xa')](),controller[_0xfe2c('0x1b')]);router[_0xfe2c('0x1a')](_0xfe2c('0xb'),auth[_0xfe2c('0xa')](),controller[_0xfe2c('0x1c')]);router['delete'](_0xfe2c('0xc'),auth[_0xfe2c('0xa')](),controller[_0xfe2c('0x1d')]);router[_0xfe2c('0x1a')](_0xfe2c('0x17'),auth[_0xfe2c('0xa')](),controller['removeAgents']);module[_0xfe2c('0x1e')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index a09359c..abc45be 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 _0xe95d=['setDataValue','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0xe95d,0x1af));var _0xde95=function(_0x56d1b5,_0x289333){_0x56d1b5=_0x56d1b5-0x0;var _0x4ad91e=_0xe95d[_0x56d1b5];return _0x4ad91e;};'use strict';var Sequelize=require(_0xde95('0x0'));var rs=require(_0xde95('0x1'));module[_0xde95('0x2')]={'name':{'type':Sequelize[_0xde95('0x3')],'unique':_0xde95('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0xde95('0x3')]},'token':{'type':Sequelize[_0xde95('0x3')],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xde95('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xde95('0x5')],'defaultValue':function(){return _0xde95('0x6');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xde95('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xde95('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xde95('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xde95('0x3')]},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xde95('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xde95('0x9')},'mandatoryDisposition':{'type':Sequelize[_0xde95('0x7')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x19e3c5){if(!_0x19e3c5)this['setDataValue'](_0xde95('0xa'),null);this[_0xde95('0xb')](_0xde95('0xc'),_0x19e3c5);}}}; \ No newline at end of file +var _0x4423=['BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','randomstring','exports','name','STRING','generate','TEXT'];(function(_0xae52c0,_0x5338b7){var _0x4ff2bc=function(_0x877c69){while(--_0x877c69){_0xae52c0['push'](_0xae52c0['shift']());}};_0x4ff2bc(++_0x5338b7);}(_0x4423,0x165));var _0x3442=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x4423[_0xfae23b];return _0x200640;};'use strict';var Sequelize=require(_0x3442('0x0'));var rs=require(_0x3442('0x1'));module[_0x3442('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0x3442('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x3442('0x4')],'defaultValue':function(){return rs[_0x3442('0x5')]();}},'replyUri':{'type':Sequelize[_0x3442('0x4')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x3442('0x4')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x3442('0x6')],'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[_0x3442('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x3442('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x3442('0x4')]},'queueTransfer':{'type':Sequelize[_0x3442('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x3442('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x3442('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x3442('0x8')],'allowNull':!![],'defaultValue':null,'comment':_0x3442('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x3442('0x7')],'defaultValue':![],'comment':_0x3442('0xa'),'set':function(_0x36ee89){if(!_0x36ee89)this[_0x3442('0xb')](_0x3442('0xc'),null);this['setDataValue']('mandatoryDisposition',_0x36ee89);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index ee67143..d270b7c 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 _0x7c49=['rawAttributes','type','key','map','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','sort','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','Disposition','getDispositions','findOne','order','pick','OpenchannelAccountId','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','openchannel','CmContact','Sequelize','ValidationError','createdAt','difference','updatedAt','isNil','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','DESC','Applications','account','list','List','applications','orderBy','priority','Contacts','defaults','ListId','contact','lastName','threadId','OpenchannelInteraction','externalUrl','spread','messageId','interaction','created','push','close','unmanaged','*,*,*,*','UserId','agent','waitForTheAssignedAgent','queueId','OpenchannelQueue','queue','waitForTheAssignedQueue','startRouting','EventManager','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','OpenchannelApplication','bulkCreate','findAndCountAll','finally','sendStatus','send','getApplications','getInteractions','Contact','User','Owner','fullname','internal','Tags','color','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','getAgents','out','Messages','OpenchannelMessage','dataValues','eml-format','rimraf','request-promise','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','register','jayson/promise','client','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','destroy','get','OpenchannelAccounts','stack','name','Pause','mandatoryDispositionPause','OpenchannelAccount'];(function(_0xc0ed16,_0x2a548b){var _0x825420=function(_0x5bd1e7){while(--_0x5bd1e7){_0xc0ed16['push'](_0xc0ed16['shift']());}};_0x825420(++_0x2a548b);}(_0x7c49,0x141));var _0x97c4=function(_0x3bff16,_0x1f6a13){_0x3bff16=_0x3bff16-0x0;var _0x5984ec=_0x7c49[_0x3bff16];return _0x5984ec;};'use strict';var emlformat=require(_0x97c4('0x0'));var rimraf=require(_0x97c4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x97c4('0x2'));var moment=require('moment');var BPromise=require(_0x97c4('0x3'));var Mustache=require(_0x97c4('0x4'));var util=require('util');var path=require('path');var sox=require(_0x97c4('0x5'));var csv=require(_0x97c4('0x6'));var ejs=require(_0x97c4('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x97c4('0x8'));var squel=require(_0x97c4('0x9'));var crypto=require(_0x97c4('0xa'));var jsforce=require(_0x97c4('0xb'));var deskjs=require(_0x97c4('0xc'));var toCsv=require(_0x97c4('0x6'));var querystring=require(_0x97c4('0xd'));var Papa=require(_0x97c4('0xe'));var Redis=require(_0x97c4('0xf'));var authService=require(_0x97c4('0x10'));var qs=require(_0x97c4('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x97c4('0x12'))(_0x97c4('0x13'));var utils=require('../../config/utils');var config=require(_0x97c4('0x14'));var licenseUtil=require(_0x97c4('0x15'));var db=require(_0x97c4('0x16'))['db'];config['redis']=_['defaults'](config[_0x97c4('0x17')],{'host':_0x97c4('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x97c4('0x17')]));require('./openchannelAccount.socket')[_0x97c4('0x19')](socket);var jayson=require(_0x97c4('0x1a'));var client=jayson[_0x97c4('0x1b')][_0x97c4('0x1c')]({'port':0x232c});var client9002=jayson[_0x97c4('0x1b')][_0x97c4('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x50d8ad,_0x1fff7e,_0x5d6fc3,_0x23b79f){return new BPromise(function(_0x465c79,_0x202739){var _0x1f178b=_0x23b79f||client;return _0x1f178b[_0x97c4('0x1d')](_0x50d8ad,_0x5d6fc3)[_0x97c4('0x1e')](function(_0xdeb273){logger[_0x97c4('0x1f')](_0x97c4('0x20'),_0x1fff7e,_0x97c4('0x21'));logger['debug'](_0x97c4('0x22'),_0x1fff7e,_0x97c4('0x21'),JSON[_0x97c4('0x23')](_0xdeb273));if(_0xdeb273['error']){if(_0xdeb273[_0x97c4('0x24')][_0x97c4('0x25')]===0x1f4){logger[_0x97c4('0x24')]('OpenchannelAccount,\x20%s,\x20%s',_0x1fff7e,_0xdeb273['error']['message']);return _0x202739(_0xdeb273['error'][_0x97c4('0x26')]);}logger[_0x97c4('0x24')](_0x97c4('0x20'),_0x1fff7e,_0xdeb273[_0x97c4('0x24')][_0x97c4('0x26')]);return _0x465c79(_0xdeb273[_0x97c4('0x24')][_0x97c4('0x26')]);}else{logger[_0x97c4('0x1f')](_0x97c4('0x20'),_0x1fff7e,_0x97c4('0x21'));_0x465c79(_0xdeb273[_0x97c4('0x27')][_0x97c4('0x26')]);}})[_0x97c4('0x28')](function(_0x4afb57){logger[_0x97c4('0x24')](_0x97c4('0x20'),_0x1fff7e,_0x4afb57);_0x202739(_0x4afb57);});});}function respondWithStatusCode(_0x37a0c9,_0x58f724){_0x58f724=_0x58f724||0xcc;return function(_0x2daa91){if(_0x2daa91){return _0x37a0c9['sendStatus'](_0x58f724);}return _0x37a0c9[_0x97c4('0x29')](_0x58f724)[_0x97c4('0x2a')]();};}function respondWithResult(_0x355e48,_0x40be2d){_0x40be2d=_0x40be2d||0xc8;return function(_0x2718be){if(_0x2718be){return _0x355e48[_0x97c4('0x29')](_0x40be2d)[_0x97c4('0x2b')](_0x2718be);}};}function respondWithFilteredResult(_0x38cb3f,_0x174be5){return function(_0x3c4323){if(_0x3c4323){var _0x3bc0d2=typeof _0x174be5['offset']===_0x97c4('0x2c')&&typeof _0x174be5[_0x97c4('0x2d')]==='undefined';var _0x57081f=_0x3c4323[_0x97c4('0x2e')];var _0x4b7ed9=_0x3bc0d2?0x0:_0x174be5[_0x97c4('0x2f')];var _0x4f361e=_0x3bc0d2?_0x3c4323[_0x97c4('0x2e')]:_0x174be5[_0x97c4('0x2f')]+_0x174be5[_0x97c4('0x2d')];var _0x412bb8;if(_0x4f361e>=_0x57081f){_0x4f361e=_0x57081f;_0x412bb8=0xc8;}else{_0x412bb8=0xce;}_0x38cb3f[_0x97c4('0x29')](_0x412bb8);return _0x38cb3f[_0x97c4('0x30')](_0x97c4('0x31'),_0x4b7ed9+'-'+_0x4f361e+'/'+_0x57081f)[_0x97c4('0x2b')](_0x3c4323);}return null;};}function patchUpdates(_0x41d5bc){return function(_0x5b6e3d){try{jsonpatch['apply'](_0x5b6e3d,_0x41d5bc,!![]);}catch(_0x17e384){return BPromise[_0x97c4('0x32')](_0x17e384);}return _0x5b6e3d[_0x97c4('0x33')]();};}function saveUpdates(_0x41c490,_0x36a066){return function(_0x233919){if(_0x233919){return _0x233919[_0x97c4('0x34')](_0x41c490)[_0x97c4('0x1e')](function(_0x589056){return _0x589056;});}return null;};}function removeEntity(_0x39edd3,_0xad3729){return function(_0xa9b340){if(_0xa9b340){return _0xa9b340[_0x97c4('0x35')]()[_0x97c4('0x1e')](function(){var _0x2d391d=_0xa9b340[_0x97c4('0x36')]({'plain':!![]});var _0x5258e4=_0x97c4('0x37');return db['UserProfileResource']['destroy']({'where':{'type':_0x5258e4,'resourceId':_0x2d391d['id']}})[_0x97c4('0x1e')](function(){return _0xa9b340;});})[_0x97c4('0x1e')](function(){_0x39edd3[_0x97c4('0x29')](0xcc)[_0x97c4('0x2a')]();});}};}function handleEntityNotFound(_0x415307,_0x5621d8){return function(_0x4b3894){if(!_0x4b3894){_0x415307['sendStatus'](0x194);}return _0x4b3894;};}function handleError(_0x5c7371,_0x18434e){_0x18434e=_0x18434e||0x1f4;return function(_0x35eb2c){logger[_0x97c4('0x24')](_0x35eb2c[_0x97c4('0x38')]);if(_0x35eb2c[_0x97c4('0x39')]){delete _0x35eb2c[_0x97c4('0x39')];}_0x5c7371[_0x97c4('0x29')](_0x18434e)['send'](_0x35eb2c);};}exports['index']=function(_0x10a807,_0xd2feb9){var _0x4ee6c8={'include':[{'model':db[_0x97c4('0x3a')],'as':_0x97c4('0x3b')}]},_0x2c8ea9={},_0x4cacb5={'count':0x0,'rows':[]};var _0x359936=_['map'](db[_0x97c4('0x3c')][_0x97c4('0x3d')],function(_0x3b2814){return{'name':_0x3b2814['fieldName'],'type':_0x3b2814[_0x97c4('0x3e')][_0x97c4('0x3f')]};});_0x2c8ea9['model']=_[_0x97c4('0x40')](_0x359936,'name');_0x2c8ea9[_0x97c4('0x41')]=_[_0x97c4('0x42')](_0x10a807[_0x97c4('0x41')]);_0x2c8ea9[_0x97c4('0x43')]=_['intersection'](_0x2c8ea9[_0x97c4('0x44')],_0x2c8ea9[_0x97c4('0x41')]);_0x4ee6c8[_0x97c4('0x45')]=_[_0x97c4('0x46')](_0x2c8ea9['model'],qs[_0x97c4('0x47')](_0x10a807['query']['fields']));_0x4ee6c8[_0x97c4('0x45')]=_0x4ee6c8[_0x97c4('0x45')]['length']?_0x4ee6c8[_0x97c4('0x45')]:_0x2c8ea9[_0x97c4('0x44')];if(!_0x10a807[_0x97c4('0x41')][_0x97c4('0x48')](_0x97c4('0x49'))){_0x4ee6c8[_0x97c4('0x2d')]=qs[_0x97c4('0x2d')](_0x10a807['query']['limit']);_0x4ee6c8[_0x97c4('0x2f')]=qs[_0x97c4('0x2f')](_0x10a807[_0x97c4('0x41')][_0x97c4('0x2f')]);}_0x4ee6c8['order']=qs['sort'](_0x10a807['query'][_0x97c4('0x4a')]);_0x4ee6c8['where']=qs['filters'](_['pick'](_0x10a807['query'],_0x2c8ea9[_0x97c4('0x43')]),_0x359936);if(_0x10a807['query'][_0x97c4('0x4b')]){_0x4ee6c8['where']=_['merge'](_0x4ee6c8[_0x97c4('0x4c')],{'$or':_[_0x97c4('0x40')](_0x359936,function(_0x372378){if(_0x372378[_0x97c4('0x3e')]!==_0x97c4('0x4d')){var _0xdca0b8={};_0xdca0b8[_0x372378['name']]={'$like':'%'+_0x10a807['query'][_0x97c4('0x4b')]+'%'};return _0xdca0b8;}})});}_0x4ee6c8=_[_0x97c4('0x4e')]({},_0x4ee6c8,_0x10a807[_0x97c4('0x4f')]);var _0x2e1185={'where':_0x4ee6c8[_0x97c4('0x4c')]};return db[_0x97c4('0x3c')]['count'](_0x2e1185)[_0x97c4('0x1e')](function(_0x17c73e){_0x4cacb5[_0x97c4('0x2e')]=_0x17c73e;if(_0x10a807[_0x97c4('0x41')][_0x97c4('0x50')]){_0x4ee6c8[_0x97c4('0x51')]=[{'all':!![]}];}return db[_0x97c4('0x3c')][_0x97c4('0x52')](_0x4ee6c8);})[_0x97c4('0x1e')](function(_0x3a3d72){_0x4cacb5[_0x97c4('0x53')]=_0x3a3d72;return _0x4cacb5;})[_0x97c4('0x1e')](respondWithFilteredResult(_0xd2feb9,_0x4ee6c8))[_0x97c4('0x28')](handleError(_0xd2feb9,null));};exports[_0x97c4('0x54')]=function(_0x311aee,_0x2f2c3a){var _0x387d24={'raw':![],'where':{'id':_0x311aee[_0x97c4('0x55')]['id']},'include':[{'model':db[_0x97c4('0x3a')],'as':_0x97c4('0x3b')}]},_0x28b1ba={};_0x28b1ba['model']=_[_0x97c4('0x42')](db['OpenchannelAccount'][_0x97c4('0x3d')]);_0x28b1ba[_0x97c4('0x41')]=_[_0x97c4('0x42')](_0x311aee[_0x97c4('0x41')]);_0x28b1ba['filters']=_[_0x97c4('0x46')](_0x28b1ba[_0x97c4('0x44')],_0x28b1ba[_0x97c4('0x41')]);_0x387d24[_0x97c4('0x45')]=_[_0x97c4('0x46')](_0x28b1ba[_0x97c4('0x44')],qs[_0x97c4('0x47')](_0x311aee[_0x97c4('0x41')][_0x97c4('0x47')]));_0x387d24[_0x97c4('0x45')]=_0x387d24['attributes'][_0x97c4('0x56')]?_0x387d24[_0x97c4('0x45')]:_0x28b1ba[_0x97c4('0x44')];if(_0x311aee['query'][_0x97c4('0x50')]){_0x387d24[_0x97c4('0x51')]=[{'all':!![]}];}_0x387d24=_[_0x97c4('0x4e')]({},_0x387d24,_0x311aee['options']);return db[_0x97c4('0x3c')][_0x97c4('0x57')](_0x387d24)[_0x97c4('0x1e')](handleEntityNotFound(_0x2f2c3a,null))[_0x97c4('0x1e')](respondWithResult(_0x2f2c3a,null))[_0x97c4('0x28')](handleError(_0x2f2c3a,null));};exports['create']=function(_0x59a05c,_0x382ea6){return db['OpenchannelAccount'][_0x97c4('0x58')](_0x59a05c[_0x97c4('0x59')],{})[_0x97c4('0x1e')](function(_0x136736){var _0x5bcce9=_0x59a05c[_0x97c4('0x5a')][_0x97c4('0x36')]({'plain':!![]});if(!_0x5bcce9)throw new Error(_0x97c4('0x5b'));if(_0x5bcce9['role']==='user'){var _0xdaddff=_0x136736['get']({'plain':!![]});var _0x461132='OpenchannelAccounts';return db['UserProfileSection'][_0x97c4('0x57')]({'where':{'name':_0x461132,'userProfileId':_0x5bcce9[_0x97c4('0x5c')]},'raw':!![]})[_0x97c4('0x1e')](function(_0x4e65e4){if(_0x4e65e4&&_0x4e65e4[_0x97c4('0x5d')]===0x0){return db[_0x97c4('0x5e')][_0x97c4('0x58')]({'name':_0xdaddff[_0x97c4('0x39')],'resourceId':_0xdaddff['id'],'type':_0x4e65e4[_0x97c4('0x39')],'sectionId':_0x4e65e4['id']},{})[_0x97c4('0x1e')](function(){return _0x136736;});}else{return _0x136736;}})[_0x97c4('0x28')](function(_0x4a5a29){logger[_0x97c4('0x24')](_0x97c4('0x5f'),_0x4a5a29);throw _0x4a5a29;});}return _0x136736;})['then'](respondWithResult(_0x382ea6,0xc9))[_0x97c4('0x28')](handleError(_0x382ea6,null));};exports[_0x97c4('0x34')]=function(_0x3be5f7,_0x1884b7){if(_0x3be5f7[_0x97c4('0x59')]['id']){delete _0x3be5f7[_0x97c4('0x59')]['id'];}return db[_0x97c4('0x3c')][_0x97c4('0x57')]({'where':{'id':_0x3be5f7[_0x97c4('0x55')]['id']},'include':[{'model':db['Pause'],'as':_0x97c4('0x3b')}]})[_0x97c4('0x1e')](handleEntityNotFound(_0x1884b7,null))[_0x97c4('0x1e')](saveUpdates(_0x3be5f7[_0x97c4('0x59')],null))[_0x97c4('0x1e')](respondWithResult(_0x1884b7,null))[_0x97c4('0x28')](handleError(_0x1884b7,null));};exports[_0x97c4('0x35')]=function(_0x291654,_0x178098){return db['OpenchannelAccount'][_0x97c4('0x57')]({'where':{'id':_0x291654[_0x97c4('0x55')]['id']}})['then'](handleEntityNotFound(_0x178098,null))[_0x97c4('0x1e')](removeEntity(_0x178098,null))[_0x97c4('0x28')](handleError(_0x178098,null));};exports[_0x97c4('0x60')]=function(_0x301414,_0x28c6da){return db[_0x97c4('0x3c')]['describe']()[_0x97c4('0x1e')](respondWithResult(_0x28c6da,null))[_0x97c4('0x28')](handleError(_0x28c6da,null));};exports[_0x97c4('0x61')]=function(_0x2cd77c,_0x55fbee,_0xa3ca7e){if(_0x2cd77c[_0x97c4('0x59')]['id']){delete _0x2cd77c[_0x97c4('0x59')]['id'];}return db[_0x97c4('0x3c')]['find']({'where':{'id':_0x2cd77c[_0x97c4('0x55')]['id']}})[_0x97c4('0x1e')](handleEntityNotFound(_0x55fbee,null))['then'](function(_0x208d71){if(_0x208d71){_0x2cd77c['body']['OpenchannelAccountId']=_0x208d71['id'];return db[_0x97c4('0x62')][_0x97c4('0x58')](_0x2cd77c[_0x97c4('0x59')]);}})[_0x97c4('0x1e')](respondWithResult(_0x55fbee,null))[_0x97c4('0x28')](handleError(_0x55fbee,null));};exports[_0x97c4('0x63')]=function(_0x295f5c,_0x1fc96b,_0x5407b2){var _0x183e08={'raw':![],'where':{}};var _0x5f25e0={};var _0x56663c={'count':0x0,'rows':[]};return db[_0x97c4('0x3c')][_0x97c4('0x64')]({'where':{'id':_0x295f5c[_0x97c4('0x55')]['id']}})['then'](handleEntityNotFound(_0x1fc96b,null))[_0x97c4('0x1e')](function(_0x4c2688){if(_0x4c2688){_0x5f25e0[_0x97c4('0x44')]=_[_0x97c4('0x42')](db[_0x97c4('0x62')][_0x97c4('0x3d')]);_0x5f25e0[_0x97c4('0x41')]=_[_0x97c4('0x42')](_0x295f5c[_0x97c4('0x41')]);_0x5f25e0[_0x97c4('0x43')]=_[_0x97c4('0x46')](_0x5f25e0['model'],_0x5f25e0[_0x97c4('0x41')]);_0x183e08[_0x97c4('0x45')]=_['intersection'](_0x5f25e0['model'],qs[_0x97c4('0x47')](_0x295f5c[_0x97c4('0x41')][_0x97c4('0x47')]));_0x183e08[_0x97c4('0x45')]=_0x183e08['attributes']['length']?_0x183e08[_0x97c4('0x45')]:_0x5f25e0[_0x97c4('0x44')];if(!_0x295f5c['query'][_0x97c4('0x48')](_0x97c4('0x49'))){_0x183e08[_0x97c4('0x2d')]=qs[_0x97c4('0x2d')](_0x295f5c[_0x97c4('0x41')][_0x97c4('0x2d')]);_0x183e08[_0x97c4('0x2f')]=qs['offset'](_0x295f5c[_0x97c4('0x41')]['offset']);}_0x183e08[_0x97c4('0x65')]=qs[_0x97c4('0x4a')](_0x295f5c['query']['sort']);_0x183e08[_0x97c4('0x4c')]=qs[_0x97c4('0x43')](_[_0x97c4('0x66')](_0x295f5c[_0x97c4('0x41')],_0x5f25e0[_0x97c4('0x43')]));_0x183e08[_0x97c4('0x4c')][_0x97c4('0x67')]=_0x4c2688['id'];if(_0x295f5c[_0x97c4('0x41')][_0x97c4('0x4b')]){_0x183e08[_0x97c4('0x4c')]=_[_0x97c4('0x4e')](_0x183e08['where'],{'$or':_[_0x97c4('0x40')](_0x183e08[_0x97c4('0x45')],function(_0x155e01){var _0x3b98e2={};_0x3b98e2[_0x155e01]={'$like':'%'+_0x295f5c['query'][_0x97c4('0x4b')]+'%'};return _0x3b98e2;})});}_0x183e08=_['merge']({},_0x183e08,_0x295f5c[_0x97c4('0x4f')]);return db[_0x97c4('0x62')][_0x97c4('0x2e')]({'where':_0x183e08[_0x97c4('0x4c')]})[_0x97c4('0x1e')](function(_0x13927e){_0x56663c[_0x97c4('0x2e')]=_0x13927e;if(_0x295f5c[_0x97c4('0x41')][_0x97c4('0x50')]){_0x183e08[_0x97c4('0x51')]=[{'all':!![]}];}return db[_0x97c4('0x62')]['findAll'](_0x183e08);})[_0x97c4('0x1e')](function(_0x2df456){_0x56663c['rows']=_0x2df456;return _0x56663c;});}})[_0x97c4('0x1e')](respondWithFilteredResult(_0x1fc96b,_0x183e08))[_0x97c4('0x28')](handleError(_0x1fc96b,null));};exports[_0x97c4('0x68')]=function(_0x5dc2fa,_0x1a4c44,_0x3d5563){return db[_0x97c4('0x3c')][_0x97c4('0x57')]({'where':{'id':_0x5dc2fa[_0x97c4('0x55')]['id']}})[_0x97c4('0x1e')](handleEntityNotFound(_0x1a4c44,null))['then'](function(_0x4f7508){if(_0x4f7508){return _0x4f7508[_0x97c4('0x68')](_0x5dc2fa[_0x97c4('0x41')][_0x97c4('0x69')]);}})[_0x97c4('0x1e')](respondWithStatusCode(_0x1a4c44,null))['catch'](handleError(_0x1a4c44,null));};exports[_0x97c4('0x6a')]=function(_0x233707,_0x11ae10,_0x239f1a){if(_0x233707[_0x97c4('0x59')]['id']){delete _0x233707['body']['id'];}return db[_0x97c4('0x3c')][_0x97c4('0x57')]({'where':{'id':_0x233707['params']['id']}})[_0x97c4('0x1e')](handleEntityNotFound(_0x11ae10,null))[_0x97c4('0x1e')](function(_0x5e7764){if(_0x5e7764){_0x233707[_0x97c4('0x59')][_0x97c4('0x67')]=_0x5e7764['id'];return db[_0x97c4('0x6b')][_0x97c4('0x58')](_0x233707[_0x97c4('0x59')]);}})[_0x97c4('0x1e')](respondWithResult(_0x11ae10,null))['catch'](handleError(_0x11ae10,null));};exports[_0x97c4('0x6c')]=function(_0x4f6112,_0x3f5bf0,_0x5c65da){var _0x25266e={'raw':![],'where':{}};var _0x31f652={};var _0x5871fd={'count':0x0,'rows':[]};return db[_0x97c4('0x3c')][_0x97c4('0x64')]({'where':{'id':_0x4f6112[_0x97c4('0x55')]['id']}})[_0x97c4('0x1e')](handleEntityNotFound(_0x3f5bf0,null))[_0x97c4('0x1e')](function(_0x55bcea){if(_0x55bcea){_0x31f652['model']=_[_0x97c4('0x42')](db[_0x97c4('0x6b')][_0x97c4('0x3d')]);_0x31f652[_0x97c4('0x41')]=_[_0x97c4('0x42')](_0x4f6112[_0x97c4('0x41')]);_0x31f652[_0x97c4('0x43')]=_['intersection'](_0x31f652[_0x97c4('0x44')],_0x31f652[_0x97c4('0x41')]);_0x25266e[_0x97c4('0x45')]=_['intersection'](_0x31f652[_0x97c4('0x44')],qs[_0x97c4('0x47')](_0x4f6112[_0x97c4('0x41')][_0x97c4('0x47')]));_0x25266e[_0x97c4('0x45')]=_0x25266e['attributes']['length']?_0x25266e[_0x97c4('0x45')]:_0x31f652[_0x97c4('0x44')];if(!_0x4f6112[_0x97c4('0x41')][_0x97c4('0x48')](_0x97c4('0x49'))){_0x25266e[_0x97c4('0x2d')]=qs[_0x97c4('0x2d')](_0x4f6112[_0x97c4('0x41')][_0x97c4('0x2d')]);_0x25266e[_0x97c4('0x2f')]=qs['offset'](_0x4f6112[_0x97c4('0x41')][_0x97c4('0x2f')]);}_0x25266e[_0x97c4('0x65')]=qs[_0x97c4('0x4a')](_0x4f6112[_0x97c4('0x41')][_0x97c4('0x4a')]);_0x25266e[_0x97c4('0x4c')]=qs[_0x97c4('0x43')](_[_0x97c4('0x66')](_0x4f6112[_0x97c4('0x41')],_0x31f652['filters']));_0x25266e['where'][_0x97c4('0x67')]=_0x55bcea['id'];if(_0x4f6112[_0x97c4('0x41')][_0x97c4('0x4b')]){_0x25266e[_0x97c4('0x4c')]=_[_0x97c4('0x4e')](_0x25266e[_0x97c4('0x4c')],{'$or':_['map'](_0x25266e[_0x97c4('0x45')],function(_0x16c023){var _0x5c54cc={};_0x5c54cc[_0x16c023]={'$like':'%'+_0x4f6112[_0x97c4('0x41')][_0x97c4('0x4b')]+'%'};return _0x5c54cc;})});}_0x25266e=_[_0x97c4('0x4e')]({},_0x25266e,_0x4f6112[_0x97c4('0x4f')]);return db['CannedAnswer'][_0x97c4('0x2e')]({'where':_0x25266e[_0x97c4('0x4c')]})['then'](function(_0xe56d3c){_0x5871fd[_0x97c4('0x2e')]=_0xe56d3c;if(_0x4f6112[_0x97c4('0x41')][_0x97c4('0x50')]){_0x25266e[_0x97c4('0x51')]=[{'all':!![]}];}return db[_0x97c4('0x6b')]['findAll'](_0x25266e);})[_0x97c4('0x1e')](function(_0x340b03){_0x5871fd['rows']=_0x340b03;return _0x5871fd;});}})[_0x97c4('0x1e')](respondWithFilteredResult(_0x3f5bf0,_0x25266e))[_0x97c4('0x28')](handleError(_0x3f5bf0,null));};exports[_0x97c4('0x6d')]=function(_0x1704e2,_0x3ab2ca,_0xbd4022){return db[_0x97c4('0x3c')][_0x97c4('0x57')]({'where':{'id':_0x1704e2[_0x97c4('0x55')]['id']}})[_0x97c4('0x1e')](handleEntityNotFound(_0x3ab2ca,null))[_0x97c4('0x1e')](function(_0x73303f){if(_0x73303f){return _0x73303f[_0x97c4('0x6d')](_0x1704e2['query']['ids']);}})[_0x97c4('0x1e')](respondWithStatusCode(_0x3ab2ca,null))[_0x97c4('0x28')](handleError(_0x3ab2ca,null));};exports[_0x97c4('0x6e')]=function(_0x2ef61c,_0x383d11,_0x3dd62c){var _0x2cc513={'body':_0x2ef61c[_0x97c4('0x59')],'channel':_0x97c4('0x6f')};var _0x468c5=[];var _0x18e7c5=[];var _0x340b78={};var _0x39ef4b=![];return db[_0x97c4('0x70')][_0x97c4('0x60')]()[_0x97c4('0x1e')](function(_0x1a4657){if(!_0x1a4657){throw new db[(_0x97c4('0x71'))][(_0x97c4('0x72'))]('no\x20available\x20attributes');}_0x468c5=_['difference'](_[_0x97c4('0x42')](_0x1a4657),[_0x97c4('0x73'),'updatedAt']);_0x18e7c5=_[_0x97c4('0x74')](_[_0x97c4('0x42')](_0x1a4657),[_0x97c4('0x73'),_0x97c4('0x75'),'CompanyId','ListId']);if(_0x2ef61c['body']['id']){delete _0x2ef61c['body']['id'];}if(_[_0x97c4('0x76')](_0x2ef61c[_0x97c4('0x59')][_0x97c4('0x77')])){throw new db[(_0x97c4('0x71'))][(_0x97c4('0x72'))]('from\x20is\x20mandatory');}if(_[_0x97c4('0x76')](_0x2ef61c[_0x97c4('0x59')][_0x97c4('0x59')])||_0x2ef61c[_0x97c4('0x59')][_0x97c4('0x59')]===''){throw new db[(_0x97c4('0x71'))][(_0x97c4('0x72'))](_0x97c4('0x78'));}if(_[_0x97c4('0x76')](_0x2ef61c['body']['mapKey'])){throw new db[(_0x97c4('0x71'))][(_0x97c4('0x72'))](_0x97c4('0x79')+_0x18e7c5);}if(!_[_0x97c4('0x7a')](_0x18e7c5,_0x2ef61c[_0x97c4('0x59')][_0x97c4('0x7b')])){throw new db[(_0x97c4('0x71'))][(_0x97c4('0x72'))](_0x97c4('0x7c')+_0x18e7c5);}_0x340b78[_0x2ef61c[_0x97c4('0x59')][_0x97c4('0x7b')]]=_0x2ef61c[_0x97c4('0x59')][_0x97c4('0x77')];})[_0x97c4('0x1e')](function(){return db[_0x97c4('0x3c')][_0x97c4('0x57')]({'where':{'id':_0x2ef61c[_0x97c4('0x55')]['id']},'include':[{'model':db[_0x97c4('0x7d')],'as':'List','include':[{'model':db[_0x97c4('0x70')],'as':'Contacts','where':_0x340b78,'limit':0x1,'order':[[_0x97c4('0x75'),_0x97c4('0x7e')]]}]},{'model':db['OpenchannelApplication'],'as':_0x97c4('0x7f')}]});})[_0x97c4('0x1e')](handleEntityNotFound(_0x383d11,null))[_0x97c4('0x1e')](function(_0x5823fc){if(_0x5823fc&&_0x5823fc['List']){_0x2cc513[_0x97c4('0x80')]=_0x5823fc;_0x2cc513['applications']=_0x5823fc[_0x97c4('0x7f')];_0x2cc513[_0x97c4('0x81')]=_0x5823fc[_0x97c4('0x82')];_0x2cc513[_0x97c4('0x83')]=_[_0x97c4('0x84')](_0x2cc513[_0x97c4('0x83')],[_0x97c4('0x85')],['asc']);if(_0x2cc513[_0x97c4('0x80')][_0x97c4('0x7f')]){delete _0x2cc513[_0x97c4('0x80')][_0x97c4('0x7f')];}if(_0x2cc513[_0x97c4('0x80')][_0x97c4('0x82')]&&_0x2cc513['account'][_0x97c4('0x82')][_0x97c4('0x86')]['length']){return _0x2cc513[_0x97c4('0x80')]['List'][_0x97c4('0x86')][0x0];}var _0x1e87f7=_[_0x97c4('0x87')](_0x2ef61c[_0x97c4('0x59')],{'firstName':_0x2ef61c[_0x97c4('0x59')][_0x97c4('0x77')],'ListId':_0x5823fc[_0x97c4('0x88')]});_0x1e87f7[_0x2ef61c[_0x97c4('0x59')][_0x97c4('0x7b')]]=_0x2ef61c['body']['from'];return db[_0x97c4('0x70')]['create'](_0x1e87f7,{'fields':_0x468c5,'raw':!![]});}})[_0x97c4('0x1e')](handleEntityNotFound(_0x383d11,null))[_0x97c4('0x1e')](function(_0x15e384){_0x2cc513[_0x97c4('0x89')]=_0x15e384;if(_0x15e384){var _0x585b1f={'ContactId':_0x15e384['id'],'OpenchannelAccountId':_0x2ef61c['params']['id'],'from':(_0x15e384['firstName']||'')+'\x20'+(_0x15e384[_0x97c4('0x8a')]||'')};var _0x44df1d={'OpenchannelAccountId':_0x2ef61c['params']['id'],'closed':![]};if(_0x2ef61c['body'][_0x97c4('0x8b')]){_0x44df1d[_0x97c4('0x8b')]=_0x2ef61c[_0x97c4('0x59')][_0x97c4('0x8b')];return db[_0x97c4('0x8c')][_0x97c4('0x57')]({'where':_0x44df1d})[_0x97c4('0x1e')](function(_0x5a7100){if(_0x5a7100){return[_0x5a7100,![]];}_0x585b1f['threadId']=_0x2ef61c[_0x97c4('0x59')][_0x97c4('0x8b')];_0x585b1f[_0x97c4('0x8d')]=_0x2ef61c[_0x97c4('0x59')]['externalUrl'];return db[_0x97c4('0x8c')]['create'](_0x585b1f)['then'](function(_0xce19c7){return[_0xce19c7,!![]];});});}else{_0x44df1d[_0x97c4('0x8b')]=null;}_0x44df1d['ContactId']=_0x15e384['id'];return db[_0x97c4('0x8c')][_0x97c4('0x57')]({'where':_0x44df1d})[_0x97c4('0x1e')](function(_0x5a1e7d){if(_0x5a1e7d){return[_0x5a1e7d,![]];}return db[_0x97c4('0x8c')][_0x97c4('0x58')](_0x585b1f)['then'](function(_0x33947a){return[_0x33947a,!![]];});});}})[_0x97c4('0x8e')](function(_0x3c0c54,_0x49ec81){if(_0x3c0c54){_0x39ef4b=_0x49ec81;if(!_0x49ec81){var _0x5ceb1d={'from':(_0x2cc513[_0x97c4('0x89')]['firstName']||'')+'\x20'+(_0x2cc513[_0x97c4('0x89')][_0x97c4('0x8a')]||'')};if(_0x2ef61c[_0x97c4('0x59')]['threadId']&&_0x2ef61c[_0x97c4('0x59')][_0x97c4('0x8f')]&&_0x2ef61c['body'][_0x97c4('0x8b')]!=_0x2ef61c[_0x97c4('0x59')]['messageId']){_0x5ceb1d['threadId']=_0x2ef61c[_0x97c4('0x59')]['messageId'];}return _0x3c0c54[_0x97c4('0x34')](_0x5ceb1d);}else{return _0x3c0c54;}}})[_0x97c4('0x1e')](function(_0x22e01a){_0x2cc513['interaction']=_0x22e01a[_0x97c4('0x36')]({'plain':!![]});_0x2cc513[_0x97c4('0x90')][_0x97c4('0x91')]=_0x39ef4b;if(_0x2cc513[_0x97c4('0x90')][_0x97c4('0x91')]){if(_0x2cc513[_0x97c4('0x80')]['autoclose']){_0x2cc513[_0x97c4('0x83')][_0x97c4('0x92')]({'id':0x0,'priority':_0x2cc513[_0x97c4('0x83')][_0x97c4('0x56')]+0x1,'app':_0x97c4('0x93'),'appdata':_0x97c4('0x94'),'interval':_0x97c4('0x95')});}}return db['OpenchannelMessage']['create']({'body':_0x2ef61c['body']['body'],'OpenchannelAccountId':_0x2ef61c[_0x97c4('0x55')]['id'],'OpenchannelInteractionId':_0x22e01a['id'],'direction':'in','ContactId':_0x2cc513[_0x97c4('0x89')]['id'],'AttachmentId':_0x2ef61c[_0x97c4('0x59')]['AttachmentId']});})[_0x97c4('0x1e')](function(_0x45712c){_0x2cc513[_0x97c4('0x26')]=_0x45712c;if(!_0x2cc513[_0x97c4('0x90')][_0x97c4('0x96')])return;return db['User'][_0x97c4('0x57')]({'attributes':['id',_0x97c4('0x39')],'where':{'id':_0x2cc513[_0x97c4('0x90')][_0x97c4('0x96')]}});})[_0x97c4('0x1e')](function(_0x3dd67c){if(_0x3dd67c){_0x2cc513[_0x97c4('0x83')]['unshift']({'id':0x0,'priority':0x0,'app':_0x97c4('0x97'),'appdata':_0x3dd67c['name']+','+(_0x2cc513[_0x97c4('0x80')][_0x97c4('0x98')]||0xa),'interval':_0x97c4('0x95')});}if(!_0x2cc513[_0x97c4('0x90')][_0x97c4('0x99')])return;return db[_0x97c4('0x9a')][_0x97c4('0x57')]({'attributes':['id',_0x97c4('0x39')],'where':{'id':_0x2cc513[_0x97c4('0x90')]['queueId']}});})[_0x97c4('0x1e')](function(_0x165911){if(_0x165911){_0x2cc513['applications']['unshift']({'id':0x0,'priority':0x1,'app':_0x97c4('0x9b'),'appdata':_0x165911[_0x97c4('0x39')]+','+(_0x2cc513['account'][_0x97c4('0x9c')]||0x12c),'interval':_0x97c4('0x95')});}return respondWithRpcPromise('Start',_0x97c4('0x9d'),_0x2cc513);})[_0x97c4('0x1e')](function(_0x1f63c0){respondWithRpcPromise('EventManager',_0x97c4('0x9e'),{'event':_0x97c4('0x6e'),'message':_0x1f63c0},client9002);return _0x1f63c0;})[_0x97c4('0x1e')](respondWithResult(_0x383d11,null))[_0x97c4('0x28')](handleError(_0x383d11,null));};exports['addApplications']=function(_0x37cfec,_0x5a331d){var _0x5d7cce=_0x37cfec[_0x97c4('0x55')]['id'];var _0x29c02b=_0x37cfec[_0x97c4('0x59')];var _0x16babc=0xc8;var _0x3988d9=null;return db[_0x97c4('0x9f')][_0x97c4('0xa0')]({'isolationLevel':db[_0x97c4('0x9f')][_0x97c4('0xa1')][_0x97c4('0xa2')][_0x97c4('0xa3')]},function(_0x31d968){return db['OpenchannelAccount'][_0x97c4('0x64')]({'where':{'id':_0x5d7cce},'transaction':_0x31d968})[_0x97c4('0x1e')](function(_0x32f703){if(_0x32f703){return db[_0x97c4('0xa4')]['destroy']({'where':{'OpenchannelAccountId':_0x5d7cce},'transaction':_0x31d968})[_0x97c4('0x1e')](function(){var _0x34fd44=_[_0x97c4('0x40')](_0x29c02b,function(_0x51db17){_0x51db17['OpenchannelAccountId']=_0x5d7cce;return _0x51db17;});return db[_0x97c4('0xa4')][_0x97c4('0xa5')](_0x34fd44,{'transaction':_0x31d968});});}else{_0x16babc=0x194;_0x3988d9=[];}});})['then'](function(){if(_0x16babc!==0x194){return db[_0x97c4('0xa4')][_0x97c4('0xa6')]({'where':{'OpenchannelAccountId':_0x5d7cce},'order':_0x97c4('0x85')})[_0x97c4('0x1e')](function(_0xcf407a){_0x3988d9=_0xcf407a;});}})[_0x97c4('0x28')](function(_0x13f08d){_0x16babc=0x1f4;logger[_0x97c4('0x24')](_0x13f08d[_0x97c4('0x38')]);if(_0x13f08d[_0x97c4('0x39')]){delete _0x13f08d[_0x97c4('0x39')];}_0x3988d9=_0x13f08d;})[_0x97c4('0xa7')](function(){if(_0x3988d9===null){_0x5a331d[_0x97c4('0xa8')](_0x16babc);}else{if(_0x16babc===0x1f4){_0x5a331d[_0x97c4('0x29')](_0x16babc)[_0x97c4('0xa9')](_0x3988d9);}else{_0x5a331d[_0x97c4('0x29')](_0x16babc)[_0x97c4('0x2b')](_0x3988d9);}}});};exports[_0x97c4('0xaa')]=function(_0x16b95f,_0x484ba6,_0x169966){var _0x5254e1={};var _0xacd8e3={};var _0x22ca12;var _0x4396ab;return db[_0x97c4('0x3c')][_0x97c4('0x64')]({'where':{'id':_0x16b95f[_0x97c4('0x55')]['id']}})[_0x97c4('0x1e')](handleEntityNotFound(_0x484ba6,null))[_0x97c4('0x1e')](function(_0x78bd28){if(_0x78bd28){_0x22ca12=_0x78bd28;_0xacd8e3['model']=_[_0x97c4('0x42')](db[_0x97c4('0xa4')]['rawAttributes']);_0xacd8e3[_0x97c4('0x41')]=_[_0x97c4('0x42')](_0x16b95f[_0x97c4('0x41')]);_0xacd8e3['filters']=_['intersection'](_0xacd8e3[_0x97c4('0x44')],_0xacd8e3[_0x97c4('0x41')]);_0x5254e1['attributes']=_[_0x97c4('0x46')](_0xacd8e3[_0x97c4('0x44')],qs['fields'](_0x16b95f[_0x97c4('0x41')][_0x97c4('0x47')]));_0x5254e1[_0x97c4('0x45')]=_0x5254e1[_0x97c4('0x45')][_0x97c4('0x56')]?_0x5254e1['attributes']:_0xacd8e3['model'];_0x5254e1[_0x97c4('0x65')]=qs['sort'](_0x16b95f[_0x97c4('0x41')][_0x97c4('0x4a')]);_0x5254e1[_0x97c4('0x4c')]=qs[_0x97c4('0x43')](_[_0x97c4('0x66')](_0x16b95f[_0x97c4('0x41')],_0xacd8e3['filters']));if(_0x16b95f[_0x97c4('0x41')][_0x97c4('0x4b')]){_0x5254e1[_0x97c4('0x4c')]=_[_0x97c4('0x4e')](_0x5254e1[_0x97c4('0x4c')],{'$or':_[_0x97c4('0x40')](_0x5254e1[_0x97c4('0x45')],function(_0x3e2d50){var _0x5a9db0={};_0x5a9db0[_0x3e2d50]={'$like':'%'+_0x16b95f[_0x97c4('0x41')][_0x97c4('0x4b')]+'%'};return _0x5a9db0;})});}_0x5254e1=_[_0x97c4('0x4e')]({},_0x5254e1,_0x16b95f['options']);return _0x22ca12[_0x97c4('0xaa')](_0x5254e1);}})[_0x97c4('0x1e')](function(_0x326a32){if(_0x326a32){_0x4396ab=_0x326a32[_0x97c4('0x56')];if(!_0x16b95f[_0x97c4('0x41')][_0x97c4('0x48')](_0x97c4('0x49'))){_0x5254e1['limit']=qs[_0x97c4('0x2d')](_0x16b95f['query'][_0x97c4('0x2d')]);_0x5254e1[_0x97c4('0x2f')]=qs[_0x97c4('0x2f')](_0x16b95f[_0x97c4('0x41')]['offset']);}return _0x22ca12[_0x97c4('0xaa')](_0x5254e1);}})[_0x97c4('0x1e')](function(_0x181e0a){if(_0x181e0a){return _0x181e0a?{'count':_0x4396ab,'rows':_0x181e0a}:null;}})[_0x97c4('0x1e')](respondWithResult(_0x484ba6,null))['catch'](handleError(_0x484ba6,null));};exports[_0x97c4('0xab')]=function(_0x7f1242,_0x29b6d3,_0x190b5a){var _0x3510ff={'raw':![],'where':{}};var _0x349cc4={};var _0x365326={'count':0x0,'rows':[]};return db[_0x97c4('0x3c')][_0x97c4('0x64')]({'where':{'id':_0x7f1242[_0x97c4('0x55')]['id']}})[_0x97c4('0x1e')](handleEntityNotFound(_0x29b6d3,null))[_0x97c4('0x1e')](function(_0x13905c){if(_0x13905c){_0x349cc4['model']=_[_0x97c4('0x42')](db['OpenchannelInteraction'][_0x97c4('0x3d')]);_0x349cc4[_0x97c4('0x41')]=_[_0x97c4('0x42')](_0x7f1242[_0x97c4('0x41')]);_0x349cc4[_0x97c4('0x43')]=_[_0x97c4('0x46')](_0x349cc4[_0x97c4('0x44')],_0x349cc4[_0x97c4('0x41')]);_0x3510ff['attributes']=_[_0x97c4('0x46')](_0x349cc4[_0x97c4('0x44')],qs[_0x97c4('0x47')](_0x7f1242['query'][_0x97c4('0x47')]));_0x3510ff[_0x97c4('0x45')]=_0x3510ff[_0x97c4('0x45')]['length']?_0x3510ff[_0x97c4('0x45')]:_0x349cc4['model'];if(!_0x7f1242[_0x97c4('0x41')][_0x97c4('0x48')](_0x97c4('0x49'))){_0x3510ff[_0x97c4('0x2d')]=qs['limit'](_0x7f1242[_0x97c4('0x41')][_0x97c4('0x2d')]);_0x3510ff[_0x97c4('0x2f')]=qs[_0x97c4('0x2f')](_0x7f1242[_0x97c4('0x41')][_0x97c4('0x2f')]);}_0x3510ff[_0x97c4('0x65')]=qs['sort'](_0x7f1242[_0x97c4('0x41')][_0x97c4('0x4a')]);_0x3510ff[_0x97c4('0x4c')]=qs[_0x97c4('0x43')](_[_0x97c4('0x66')](_0x7f1242[_0x97c4('0x41')],_0x349cc4['filters']));_0x3510ff[_0x97c4('0x4c')][_0x97c4('0x67')]=_0x13905c['id'];if(_0x7f1242[_0x97c4('0x41')][_0x97c4('0x4b')]){_0x3510ff[_0x97c4('0x4c')]=_['merge'](_0x3510ff['where'],{'$or':_['map'](_0x3510ff['attributes'],function(_0x217dda){var _0x3cda55={};_0x3cda55[_0x217dda]={'$like':'%'+_0x7f1242[_0x97c4('0x41')][_0x97c4('0x4b')]+'%'};return _0x3cda55;})});}_0x3510ff=_[_0x97c4('0x4e')]({},_0x3510ff,_0x7f1242['options']);return db[_0x97c4('0x8c')][_0x97c4('0x2e')]({'where':_0x3510ff[_0x97c4('0x4c')]})['then'](function(_0x4f8f94){_0x365326['count']=_0x4f8f94;if(_0x7f1242[_0x97c4('0x41')][_0x97c4('0x50')]){_0x3510ff[_0x97c4('0x51')]=[{'model':db['CmContact'],'as':_0x97c4('0xac'),'required':![]},{'model':db[_0x97c4('0xad')],'as':_0x97c4('0xae'),'attributes':[_0x97c4('0x39'),_0x97c4('0xaf'),_0x97c4('0xb0')],'required':![]},{'model':db['Tag'],'as':_0x97c4('0xb1'),'attributes':['id',_0x97c4('0x39'),_0x97c4('0xb2')],'where':_0x7f1242['query'][_0x97c4('0xb3')]?{'id':_0x7f1242[_0x97c4('0x41')][_0x97c4('0xb3')]}:undefined,'required':_0x7f1242['query'][_0x97c4('0xb3')]?!![]:![]}];}return db[_0x97c4('0x8c')][_0x97c4('0x52')](_0x3510ff);})['then'](function(_0x6ae04b){_0x365326['rows']=_0x6ae04b;return _0x365326;});}})['then'](respondWithFilteredResult(_0x29b6d3,_0x3510ff))[_0x97c4('0x28')](handleError(_0x29b6d3,null));};exports[_0x97c4('0xb4')]=function(_0x226829,_0x369984,_0x3fe999){return db['OpenchannelAccount'][_0x97c4('0x57')]({'where':{'id':_0x226829[_0x97c4('0x55')]['id']}})[_0x97c4('0x1e')](handleEntityNotFound(_0x369984,null))[_0x97c4('0x1e')](function(_0x3a7899){if(_0x3a7899){return _0x3a7899[_0x97c4('0xb4')](_0x226829[_0x97c4('0x59')][_0x97c4('0x69')],_[_0x97c4('0xb5')](_0x226829[_0x97c4('0x59')],[_0x97c4('0x69'),'id'])||{})[_0x97c4('0x8e')](function(_0x417252){for(var _0x5391e9=0x0;_0x5391e9<_0x226829[_0x97c4('0x59')][_0x97c4('0x69')][_0x97c4('0x56')];_0x5391e9+=0x1){socket[_0x97c4('0xb6')](_0x97c4('0xb7'),{'UserId':Number(_0x226829[_0x97c4('0x59')][_0x97c4('0x69')][_0x5391e9]),'OpenchannelAccountId':Number(_0x226829[_0x97c4('0x55')]['id'])});}return _0x417252;});}})[_0x97c4('0x1e')](respondWithResult(_0x369984,null))[_0x97c4('0x28')](handleError(_0x369984,null));};exports[_0x97c4('0xb8')]=function(_0x305c1d,_0x2a26d3,_0xc9d08c){return db[_0x97c4('0x3c')][_0x97c4('0x57')]({'where':{'id':_0x305c1d[_0x97c4('0x55')]['id']}})['then'](handleEntityNotFound(_0x2a26d3,null))[_0x97c4('0x1e')](function(_0x52b4b1){if(_0x52b4b1){return _0x52b4b1['removeAgents'](_0x305c1d[_0x97c4('0x41')][_0x97c4('0x69')])[_0x97c4('0x1e')](function(){if(_[_0x97c4('0xb9')](_0x305c1d[_0x97c4('0x41')][_0x97c4('0x69')])){for(var _0x69415c=0x0;_0x69415c<_0x305c1d['query'][_0x97c4('0x69')][_0x97c4('0x56')];_0x69415c+=0x1){socket['emit']('userOpenchannelAccount:remove',{'UserId':Number(_0x305c1d['query'][_0x97c4('0x69')][_0x69415c]),'OpenchannelAccountId':Number(_0x305c1d['params']['id'])});}}else{socket[_0x97c4('0xb6')]('userOpenchannelAccount:remove',{'UserId':Number(_0x305c1d[_0x97c4('0x41')][_0x97c4('0x69')]),'OpenchannelAccountId':Number(_0x305c1d['params']['id'])});}});}})['then'](respondWithStatusCode(_0x2a26d3,null))[_0x97c4('0x28')](handleError(_0x2a26d3,null));};exports[_0x97c4('0xba')]=function(_0xbe286c,_0x5c602c,_0x440822){var _0x18b058={};var _0x4618f6={};var _0x56d2e3;var _0x406aab;return db[_0x97c4('0x3c')][_0x97c4('0x64')]({'where':{'id':_0xbe286c[_0x97c4('0x55')]['id']}})[_0x97c4('0x1e')](handleEntityNotFound(_0x5c602c,null))[_0x97c4('0x1e')](function(_0x98b7a8){if(_0x98b7a8){_0x56d2e3=_0x98b7a8;_0x4618f6[_0x97c4('0x44')]=_[_0x97c4('0x42')](db[_0x97c4('0xad')][_0x97c4('0x3d')]);_0x4618f6['query']=_[_0x97c4('0x42')](_0xbe286c['query']);_0x4618f6[_0x97c4('0x43')]=_[_0x97c4('0x46')](_0x4618f6['model'],_0x4618f6[_0x97c4('0x41')]);_0x18b058[_0x97c4('0x45')]=_[_0x97c4('0x46')](_0x4618f6[_0x97c4('0x44')],qs['fields'](_0xbe286c[_0x97c4('0x41')][_0x97c4('0x47')]));_0x18b058[_0x97c4('0x45')]=_0x18b058[_0x97c4('0x45')]['length']?_0x18b058['attributes']:_0x4618f6[_0x97c4('0x44')];_0x18b058[_0x97c4('0x65')]=qs[_0x97c4('0x4a')](_0xbe286c['query'][_0x97c4('0x4a')]);_0x18b058[_0x97c4('0x4c')]=qs[_0x97c4('0x43')](_['pick'](_0xbe286c[_0x97c4('0x41')],_0x4618f6[_0x97c4('0x43')]));if(_0xbe286c['query'][_0x97c4('0x4b')]){_0x18b058[_0x97c4('0x4c')]=_['merge'](_0x18b058[_0x97c4('0x4c')],{'$or':_[_0x97c4('0x40')](_0x18b058[_0x97c4('0x45')],function(_0x26cf5c){var _0x2801de={};_0x2801de[_0x26cf5c]={'$like':'%'+_0xbe286c[_0x97c4('0x41')][_0x97c4('0x4b')]+'%'};return _0x2801de;})});}_0x18b058=_['merge']({},_0x18b058,_0xbe286c[_0x97c4('0x4f')]);return _0x56d2e3[_0x97c4('0xba')](_0x18b058);}})[_0x97c4('0x1e')](function(_0x29b926){if(_0x29b926){_0x406aab=_0x29b926[_0x97c4('0x56')];if(!_0xbe286c['query']['hasOwnProperty']('nolimit')){_0x18b058[_0x97c4('0x2d')]=qs[_0x97c4('0x2d')](_0xbe286c['query'][_0x97c4('0x2d')]);_0x18b058['offset']=qs[_0x97c4('0x2f')](_0xbe286c[_0x97c4('0x41')][_0x97c4('0x2f')]);}return _0x56d2e3['getAgents'](_0x18b058);}})['then'](function(_0x183108){if(_0x183108){return _0x183108?{'count':_0x406aab,'rows':_0x183108}:null;}})[_0x97c4('0x1e')](respondWithResult(_0x5c602c,null))[_0x97c4('0x28')](handleError(_0x5c602c,null));};exports[_0x97c4('0xa9')]=function(_0x1744bd,_0x7eaba4,_0x284fe0){var _0x1c1b6a,_0x21454c,_0x43bbc4;if(_[_0x97c4('0x76')](_0x1744bd[_0x97c4('0x59')][_0x97c4('0x59')])||_0x1744bd[_0x97c4('0x59')]['body']===''){throw new db['Sequelize'][(_0x97c4('0x72'))](_0x97c4('0x78'));}if(_[_0x97c4('0x76')](_0x1744bd[_0x97c4('0x59')]['to'])){}_0x1c1b6a=_0x1744bd['body']['to'];return db[_0x97c4('0x3c')][_0x97c4('0x64')]({'where':{'id':_0x1744bd[_0x97c4('0x55')]['id']}})[_0x97c4('0x1e')](handleEntityNotFound(_0x7eaba4,null))['then'](function(_0x21fef6){if(_0x21fef6){return db[_0x97c4('0x3c')][_0x97c4('0x57')]({'where':{'id':_0x21fef6['id']},'include':[{'model':db[_0x97c4('0x7d')],'as':_0x97c4('0x82'),'include':[{'model':db['CmContact'],'as':_0x97c4('0x86'),'where':{[_0x21fef6[_0x97c4('0x7b')]]:_0x1c1b6a},'limit':0x1,'order':[['updatedAt',_0x97c4('0x7e')]]}]}]})[_0x97c4('0x1e')](handleEntityNotFound(_0x7eaba4,null))[_0x97c4('0x1e')](function(_0x57bc45){if(_0x57bc45&&_0x57bc45['List']){_0x21454c=_0x57bc45['get']({'plain':!![]});if(_0x21454c[_0x97c4('0x82')]&&_0x21454c[_0x97c4('0x82')]['Contacts']['length']){return _0x21454c[_0x97c4('0x82')]['Contacts'][0x0];}return db[_0x97c4('0x70')]['create'](_['defaults'](_0x1744bd[_0x97c4('0x59')],{'firstName':_0x1c1b6a,[_0x57bc45['mapKey']]:_0x1c1b6a,'phone':_0x1c1b6a,'ListId':_0x21454c[_0x97c4('0x88')]}));}})[_0x97c4('0x1e')](handleEntityNotFound(_0x7eaba4,null))[_0x97c4('0x1e')](function(_0x153fa5){if(_0x153fa5){_0x43bbc4=_0x153fa5;return db[_0x97c4('0x8c')]['find']({'where':{'ContactId':_0x43bbc4['id'],'closed':![],'OpenchannelAccountId':_0x21454c['id']}})[_0x97c4('0x1e')](function(_0x57665f){if(_0x57665f){return[_0x57665f,![]];}return db['OpenchannelInteraction'][_0x97c4('0x58')]({'UserId':_0x1744bd[_0x97c4('0x5a')]['id'],'ContactId':_0x43bbc4['id'],'OpenchannelAccountId':_0x21454c['id'],'lastMsgDirection':'out','firstMsgDirection':_0x97c4('0xbb'),'Messages':[_['merge'](_0x1744bd[_0x97c4('0x59')],{'read':![],'body':_0x1744bd[_0x97c4('0x59')][_0x97c4('0x59')],'OpenchannelAccountId':_0x21454c['id'],'UserId':_0x1744bd[_0x97c4('0x5a')]['id'],'ContactId':_0x43bbc4['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':_0x97c4('0xbc')}]})[_0x97c4('0x1e')](function(_0x2b58d9){return[_0x2b58d9,!![]];});});}})[_0x97c4('0x8e')](function(_0x4ee21c,_0x278521){if(_0x278521){return _0x4ee21c;}return db[_0x97c4('0xbd')]['create'](_[_0x97c4('0x4e')](_0x1744bd[_0x97c4('0x59')],{'read':![],'body':_0x1744bd['body'][_0x97c4('0x59')],'OpenchannelAccountId':_0x21454c['id'],'OpenchannelInteractionId':_0x4ee21c['id'],'UserId':_0x1744bd[_0x97c4('0x5a')]['id'],'ContactId':_0x43bbc4['id']}))[_0x97c4('0x1e')](function(_0x32e849){_0x4ee21c[_0x97c4('0xbe')][_0x97c4('0xbc')]=[];_0x4ee21c[_0x97c4('0xbe')][_0x97c4('0xbc')][_0x97c4('0x92')](_0x32e849[_0x97c4('0xbe')]);return _0x4ee21c;});});}})['then'](respondWithResult(_0x7eaba4,null))[_0x97c4('0x28')](handleError(_0x7eaba4,null));}; \ No newline at end of file +var _0x6b1d=['emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','User','CmList','ListId','out','OpenchannelMessage','dataValues','Messages','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./openchannelAccount.socket','register','jayson/promise','http','client','request','then','info','OpenchannelAccount,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','destroy','get','stack','name','send','Pause','mandatoryDispositionPause','OpenchannelAccount','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','map','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','show','params','find','create','body','user','role','OpenchannelAccounts','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','findOne','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','pick','removeAnswers','notify','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt','createdAt','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','List','Contacts','DESC','OpenchannelApplication','Applications','applications','orderBy','priority','asc','account','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','spread','contact','messageId','interaction','created','push','close','unmanaged','*,*,*,*','AttachmentId','UserId','unshift','OpenchannelQueue','queueId','queue','EventManager','sequelize','Transaction','READ_COMMITTED','findAndCountAll','getApplications','getInteractions','Contact','internal','Tags','color','tag','addAgents','omit'];(function(_0x213e38,_0xbaed93){var _0x4be48f=function(_0x51bb34){while(--_0x51bb34){_0x213e38['push'](_0x213e38['shift']());}};_0x4be48f(++_0xbaed93);}(_0x6b1d,0xc9));var _0xd6b1=function(_0xe3bbea,_0x3ae4d3){_0xe3bbea=_0xe3bbea-0x0;var _0x18713d=_0x6b1d[_0xe3bbea];return _0x18713d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd6b1('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd6b1('0x1'));var rp=require(_0xd6b1('0x2'));var moment=require(_0xd6b1('0x3'));var BPromise=require(_0xd6b1('0x4'));var Mustache=require(_0xd6b1('0x5'));var util=require('util');var path=require(_0xd6b1('0x6'));var sox=require('sox');var csv=require(_0xd6b1('0x7'));var ejs=require(_0xd6b1('0x8'));var fs=require('fs');var fs_extra=require(_0xd6b1('0x9'));var _=require(_0xd6b1('0xa'));var squel=require(_0xd6b1('0xb'));var crypto=require(_0xd6b1('0xc'));var jsforce=require(_0xd6b1('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd6b1('0x7'));var querystring=require(_0xd6b1('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd6b1('0xf'));var qs=require(_0xd6b1('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd6b1('0x11'));var logger=require(_0xd6b1('0x12'))(_0xd6b1('0x13'));var utils=require(_0xd6b1('0x14'));var config=require(_0xd6b1('0x15'));var licenseUtil=require(_0xd6b1('0x16'));var db=require(_0xd6b1('0x17'))['db'];config[_0xd6b1('0x18')]=_[_0xd6b1('0x19')](config[_0xd6b1('0x18')],{'host':_0xd6b1('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd6b1('0x18')]));require(_0xd6b1('0x1b'))[_0xd6b1('0x1c')](socket);var jayson=require(_0xd6b1('0x1d'));var client=jayson['client'][_0xd6b1('0x1e')]({'port':0x232c});var client9002=jayson[_0xd6b1('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0x426e9e,_0x2ad390,_0x25452e,_0x563651){return new BPromise(function(_0x32060d,_0xc9637c){var _0x3cbdfe=_0x563651||client;return _0x3cbdfe[_0xd6b1('0x20')](_0x426e9e,_0x25452e)[_0xd6b1('0x21')](function(_0x480751){logger[_0xd6b1('0x22')](_0xd6b1('0x23'),_0x2ad390,'request\x20sent');logger[_0xd6b1('0x24')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x2ad390,'request\x20sent',JSON[_0xd6b1('0x25')](_0x480751));if(_0x480751[_0xd6b1('0x26')]){if(_0x480751['error'][_0xd6b1('0x27')]===0x1f4){logger[_0xd6b1('0x26')]('OpenchannelAccount,\x20%s,\x20%s',_0x2ad390,_0x480751[_0xd6b1('0x26')][_0xd6b1('0x28')]);return _0xc9637c(_0x480751[_0xd6b1('0x26')][_0xd6b1('0x28')]);}logger[_0xd6b1('0x26')]('OpenchannelAccount,\x20%s,\x20%s',_0x2ad390,_0x480751[_0xd6b1('0x26')][_0xd6b1('0x28')]);return _0x32060d(_0x480751['error'][_0xd6b1('0x28')]);}else{logger[_0xd6b1('0x22')](_0xd6b1('0x23'),_0x2ad390,_0xd6b1('0x29'));_0x32060d(_0x480751[_0xd6b1('0x2a')][_0xd6b1('0x28')]);}})[_0xd6b1('0x2b')](function(_0x88a845){logger['error'](_0xd6b1('0x23'),_0x2ad390,_0x88a845);_0xc9637c(_0x88a845);});});}function respondWithStatusCode(_0x25b14a,_0x230815){_0x230815=_0x230815||0xcc;return function(_0x9cc68d){if(_0x9cc68d){return _0x25b14a[_0xd6b1('0x2c')](_0x230815);}return _0x25b14a[_0xd6b1('0x2d')](_0x230815)[_0xd6b1('0x2e')]();};}function respondWithResult(_0x16e317,_0x300f05){_0x300f05=_0x300f05||0xc8;return function(_0x72fbe0){if(_0x72fbe0){return _0x16e317[_0xd6b1('0x2d')](_0x300f05)[_0xd6b1('0x2f')](_0x72fbe0);}};}function respondWithFilteredResult(_0xd1280f,_0x5c69e2){return function(_0x1f7cc9){if(_0x1f7cc9){var _0x343c29=typeof _0x5c69e2[_0xd6b1('0x30')]==='undefined'&&typeof _0x5c69e2[_0xd6b1('0x31')]===_0xd6b1('0x32');var _0x2a65fb=_0x1f7cc9[_0xd6b1('0x33')];var _0x1a0894=_0x343c29?0x0:_0x5c69e2[_0xd6b1('0x30')];var _0x1cfe9a=_0x343c29?_0x1f7cc9[_0xd6b1('0x33')]:_0x5c69e2['offset']+_0x5c69e2['limit'];var _0xedfa8a;if(_0x1cfe9a>=_0x2a65fb){_0x1cfe9a=_0x2a65fb;_0xedfa8a=0xc8;}else{_0xedfa8a=0xce;}_0xd1280f[_0xd6b1('0x2d')](_0xedfa8a);return _0xd1280f[_0xd6b1('0x34')](_0xd6b1('0x35'),_0x1a0894+'-'+_0x1cfe9a+'/'+_0x2a65fb)[_0xd6b1('0x2f')](_0x1f7cc9);}return null;};}function patchUpdates(_0x115b55){return function(_0x4656a8){try{jsonpatch['apply'](_0x4656a8,_0x115b55,!![]);}catch(_0x4df3b1){return BPromise[_0xd6b1('0x36')](_0x4df3b1);}return _0x4656a8[_0xd6b1('0x37')]();};}function saveUpdates(_0x17a9e8,_0x298fc2){return function(_0x2832ed){if(_0x2832ed){return _0x2832ed[_0xd6b1('0x38')](_0x17a9e8)['then'](function(_0x3a7b5f){return _0x3a7b5f;});}return null;};}function removeEntity(_0x325673,_0x2fd99f){return function(_0x175394){if(_0x175394){return _0x175394[_0xd6b1('0x39')]()['then'](function(){var _0x188ca6=_0x175394[_0xd6b1('0x3a')]({'plain':!![]});var _0x482baa='OpenchannelAccounts';return db['UserProfileResource']['destroy']({'where':{'type':_0x482baa,'resourceId':_0x188ca6['id']}})[_0xd6b1('0x21')](function(){return _0x175394;});})[_0xd6b1('0x21')](function(){_0x325673[_0xd6b1('0x2d')](0xcc)[_0xd6b1('0x2e')]();});}};}function handleEntityNotFound(_0x21d248,_0x14cd4e){return function(_0x2c030d){if(!_0x2c030d){_0x21d248[_0xd6b1('0x2c')](0x194);}return _0x2c030d;};}function handleError(_0xec781,_0x520942){_0x520942=_0x520942||0x1f4;return function(_0x202d98){logger['error'](_0x202d98[_0xd6b1('0x3b')]);if(_0x202d98[_0xd6b1('0x3c')]){delete _0x202d98[_0xd6b1('0x3c')];}_0xec781['status'](_0x520942)[_0xd6b1('0x3d')](_0x202d98);};}exports['index']=function(_0x1c0413,_0x4ac542){var _0x57d59e={'include':[{'model':db[_0xd6b1('0x3e')],'as':_0xd6b1('0x3f')}]},_0x51148b={},_0x3203a6={'count':0x0,'rows':[]};var _0x326535=_['map'](db[_0xd6b1('0x40')][_0xd6b1('0x41')],function(_0x1cd307){return{'name':_0x1cd307[_0xd6b1('0x42')],'type':_0x1cd307[_0xd6b1('0x43')][_0xd6b1('0x44')]};});_0x51148b['model']=_['map'](_0x326535,'name');_0x51148b['query']=_[_0xd6b1('0x45')](_0x1c0413[_0xd6b1('0x46')]);_0x51148b[_0xd6b1('0x47')]=_[_0xd6b1('0x48')](_0x51148b[_0xd6b1('0x49')],_0x51148b[_0xd6b1('0x46')]);_0x57d59e[_0xd6b1('0x4a')]=_[_0xd6b1('0x48')](_0x51148b[_0xd6b1('0x49')],qs[_0xd6b1('0x4b')](_0x1c0413['query'][_0xd6b1('0x4b')]));_0x57d59e[_0xd6b1('0x4a')]=_0x57d59e[_0xd6b1('0x4a')][_0xd6b1('0x4c')]?_0x57d59e[_0xd6b1('0x4a')]:_0x51148b[_0xd6b1('0x49')];if(!_0x1c0413['query'][_0xd6b1('0x4d')](_0xd6b1('0x4e'))){_0x57d59e['limit']=qs[_0xd6b1('0x31')](_0x1c0413[_0xd6b1('0x46')][_0xd6b1('0x31')]);_0x57d59e[_0xd6b1('0x30')]=qs['offset'](_0x1c0413['query'][_0xd6b1('0x30')]);}_0x57d59e[_0xd6b1('0x4f')]=qs['sort'](_0x1c0413[_0xd6b1('0x46')][_0xd6b1('0x50')]);_0x57d59e[_0xd6b1('0x51')]=qs['filters'](_['pick'](_0x1c0413[_0xd6b1('0x46')],_0x51148b['filters']),_0x326535);if(_0x1c0413['query']['filter']){_0x57d59e['where']=_['merge'](_0x57d59e[_0xd6b1('0x51')],{'$or':_[_0xd6b1('0x52')](_0x326535,function(_0x3bfbd9){if(_0x3bfbd9[_0xd6b1('0x43')]!==_0xd6b1('0x53')){var _0x1e957f={};_0x1e957f[_0x3bfbd9['name']]={'$like':'%'+_0x1c0413[_0xd6b1('0x46')][_0xd6b1('0x54')]+'%'};return _0x1e957f;}})});}_0x57d59e=_[_0xd6b1('0x55')]({},_0x57d59e,_0x1c0413[_0xd6b1('0x56')]);var _0x12ad7f={'where':_0x57d59e[_0xd6b1('0x51')]};return db[_0xd6b1('0x40')][_0xd6b1('0x33')](_0x12ad7f)[_0xd6b1('0x21')](function(_0x3be028){_0x3203a6[_0xd6b1('0x33')]=_0x3be028;if(_0x1c0413[_0xd6b1('0x46')][_0xd6b1('0x57')]){_0x57d59e[_0xd6b1('0x58')]=[{'all':!![]}];}return db[_0xd6b1('0x40')][_0xd6b1('0x59')](_0x57d59e);})[_0xd6b1('0x21')](function(_0x289fd3){_0x3203a6[_0xd6b1('0x5a')]=_0x289fd3;return _0x3203a6;})[_0xd6b1('0x21')](respondWithFilteredResult(_0x4ac542,_0x57d59e))[_0xd6b1('0x2b')](handleError(_0x4ac542,null));};exports[_0xd6b1('0x5b')]=function(_0x1a1e91,_0x530346){var _0x2e9e5d={'raw':![],'where':{'id':_0x1a1e91[_0xd6b1('0x5c')]['id']},'include':[{'model':db[_0xd6b1('0x3e')],'as':'mandatoryDispositionPause'}]},_0x27c4ec={};_0x27c4ec[_0xd6b1('0x49')]=_[_0xd6b1('0x45')](db[_0xd6b1('0x40')][_0xd6b1('0x41')]);_0x27c4ec['query']=_[_0xd6b1('0x45')](_0x1a1e91[_0xd6b1('0x46')]);_0x27c4ec[_0xd6b1('0x47')]=_[_0xd6b1('0x48')](_0x27c4ec[_0xd6b1('0x49')],_0x27c4ec[_0xd6b1('0x46')]);_0x2e9e5d['attributes']=_[_0xd6b1('0x48')](_0x27c4ec['model'],qs[_0xd6b1('0x4b')](_0x1a1e91[_0xd6b1('0x46')][_0xd6b1('0x4b')]));_0x2e9e5d['attributes']=_0x2e9e5d['attributes']['length']?_0x2e9e5d[_0xd6b1('0x4a')]:_0x27c4ec[_0xd6b1('0x49')];if(_0x1a1e91[_0xd6b1('0x46')][_0xd6b1('0x57')]){_0x2e9e5d[_0xd6b1('0x58')]=[{'all':!![]}];}_0x2e9e5d=_['merge']({},_0x2e9e5d,_0x1a1e91[_0xd6b1('0x56')]);return db[_0xd6b1('0x40')][_0xd6b1('0x5d')](_0x2e9e5d)[_0xd6b1('0x21')](handleEntityNotFound(_0x530346,null))[_0xd6b1('0x21')](respondWithResult(_0x530346,null))[_0xd6b1('0x2b')](handleError(_0x530346,null));};exports[_0xd6b1('0x5e')]=function(_0x39aa54,_0x3c005f){return db[_0xd6b1('0x40')][_0xd6b1('0x5e')](_0x39aa54[_0xd6b1('0x5f')],{})[_0xd6b1('0x21')](function(_0xf967cc){var _0x1b6730=_0x39aa54[_0xd6b1('0x60')][_0xd6b1('0x3a')]({'plain':!![]});if(!_0x1b6730)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1b6730[_0xd6b1('0x61')]===_0xd6b1('0x60')){var _0x3c4dcc=_0xf967cc[_0xd6b1('0x3a')]({'plain':!![]});var _0x474bd2=_0xd6b1('0x62');return db['UserProfileSection']['find']({'where':{'name':_0x474bd2,'userProfileId':_0x1b6730[_0xd6b1('0x63')]},'raw':!![]})[_0xd6b1('0x21')](function(_0x5e5ede){if(_0x5e5ede&&_0x5e5ede[_0xd6b1('0x64')]===0x0){return db[_0xd6b1('0x65')][_0xd6b1('0x5e')]({'name':_0x3c4dcc['name'],'resourceId':_0x3c4dcc['id'],'type':_0x5e5ede[_0xd6b1('0x3c')],'sectionId':_0x5e5ede['id']},{})[_0xd6b1('0x21')](function(){return _0xf967cc;});}else{return _0xf967cc;}})[_0xd6b1('0x2b')](function(_0x6df8ec){logger[_0xd6b1('0x26')](_0xd6b1('0x66'),_0x6df8ec);throw _0x6df8ec;});}return _0xf967cc;})[_0xd6b1('0x21')](respondWithResult(_0x3c005f,0xc9))[_0xd6b1('0x2b')](handleError(_0x3c005f,null));};exports[_0xd6b1('0x38')]=function(_0x5ec63a,_0x565e43){if(_0x5ec63a[_0xd6b1('0x5f')]['id']){delete _0x5ec63a[_0xd6b1('0x5f')]['id'];}return db[_0xd6b1('0x40')]['find']({'where':{'id':_0x5ec63a[_0xd6b1('0x5c')]['id']},'include':[{'model':db[_0xd6b1('0x3e')],'as':'mandatoryDispositionPause'}]})[_0xd6b1('0x21')](handleEntityNotFound(_0x565e43,null))[_0xd6b1('0x21')](saveUpdates(_0x5ec63a[_0xd6b1('0x5f')],null))[_0xd6b1('0x21')](respondWithResult(_0x565e43,null))[_0xd6b1('0x2b')](handleError(_0x565e43,null));};exports['destroy']=function(_0xc97b91,_0x1dd370){return db['OpenchannelAccount'][_0xd6b1('0x5d')]({'where':{'id':_0xc97b91['params']['id']}})[_0xd6b1('0x21')](handleEntityNotFound(_0x1dd370,null))[_0xd6b1('0x21')](removeEntity(_0x1dd370,null))[_0xd6b1('0x2b')](handleError(_0x1dd370,null));};exports[_0xd6b1('0x67')]=function(_0x4d1e2b,_0x370620){return db[_0xd6b1('0x40')][_0xd6b1('0x67')]()[_0xd6b1('0x21')](respondWithResult(_0x370620,null))[_0xd6b1('0x2b')](handleError(_0x370620,null));};exports[_0xd6b1('0x68')]=function(_0x9c5154,_0x5b6075,_0x4e5b25){if(_0x9c5154[_0xd6b1('0x5f')]['id']){delete _0x9c5154[_0xd6b1('0x5f')]['id'];}return db[_0xd6b1('0x40')][_0xd6b1('0x5d')]({'where':{'id':_0x9c5154[_0xd6b1('0x5c')]['id']}})[_0xd6b1('0x21')](handleEntityNotFound(_0x5b6075,null))['then'](function(_0x1c2fa8){if(_0x1c2fa8){_0x9c5154[_0xd6b1('0x5f')][_0xd6b1('0x69')]=_0x1c2fa8['id'];return db[_0xd6b1('0x6a')][_0xd6b1('0x5e')](_0x9c5154['body']);}})[_0xd6b1('0x21')](respondWithResult(_0x5b6075,null))['catch'](handleError(_0x5b6075,null));};exports[_0xd6b1('0x6b')]=function(_0x2a86ae,_0x136a66,_0x4fa51b){var _0x2dd4c7={'raw':![],'where':{}};var _0x3c8679={};var _0x597438={'count':0x0,'rows':[]};return db[_0xd6b1('0x40')][_0xd6b1('0x6c')]({'where':{'id':_0x2a86ae[_0xd6b1('0x5c')]['id']}})[_0xd6b1('0x21')](handleEntityNotFound(_0x136a66,null))[_0xd6b1('0x21')](function(_0x4aabec){if(_0x4aabec){_0x3c8679[_0xd6b1('0x49')]=_[_0xd6b1('0x45')](db[_0xd6b1('0x6a')]['rawAttributes']);_0x3c8679[_0xd6b1('0x46')]=_[_0xd6b1('0x45')](_0x2a86ae[_0xd6b1('0x46')]);_0x3c8679[_0xd6b1('0x47')]=_[_0xd6b1('0x48')](_0x3c8679[_0xd6b1('0x49')],_0x3c8679[_0xd6b1('0x46')]);_0x2dd4c7[_0xd6b1('0x4a')]=_['intersection'](_0x3c8679['model'],qs[_0xd6b1('0x4b')](_0x2a86ae['query'][_0xd6b1('0x4b')]));_0x2dd4c7[_0xd6b1('0x4a')]=_0x2dd4c7[_0xd6b1('0x4a')]['length']?_0x2dd4c7[_0xd6b1('0x4a')]:_0x3c8679['model'];if(!_0x2a86ae[_0xd6b1('0x46')][_0xd6b1('0x4d')](_0xd6b1('0x4e'))){_0x2dd4c7[_0xd6b1('0x31')]=qs[_0xd6b1('0x31')](_0x2a86ae[_0xd6b1('0x46')][_0xd6b1('0x31')]);_0x2dd4c7[_0xd6b1('0x30')]=qs['offset'](_0x2a86ae[_0xd6b1('0x46')][_0xd6b1('0x30')]);}_0x2dd4c7[_0xd6b1('0x4f')]=qs[_0xd6b1('0x50')](_0x2a86ae['query']['sort']);_0x2dd4c7['where']=qs[_0xd6b1('0x47')](_['pick'](_0x2a86ae['query'],_0x3c8679['filters']));_0x2dd4c7[_0xd6b1('0x51')][_0xd6b1('0x69')]=_0x4aabec['id'];if(_0x2a86ae[_0xd6b1('0x46')][_0xd6b1('0x54')]){_0x2dd4c7[_0xd6b1('0x51')]=_['merge'](_0x2dd4c7[_0xd6b1('0x51')],{'$or':_[_0xd6b1('0x52')](_0x2dd4c7[_0xd6b1('0x4a')],function(_0x4553f4){var _0x2da10c={};_0x2da10c[_0x4553f4]={'$like':'%'+_0x2a86ae[_0xd6b1('0x46')]['filter']+'%'};return _0x2da10c;})});}_0x2dd4c7=_[_0xd6b1('0x55')]({},_0x2dd4c7,_0x2a86ae[_0xd6b1('0x56')]);return db[_0xd6b1('0x6a')]['count']({'where':_0x2dd4c7[_0xd6b1('0x51')]})[_0xd6b1('0x21')](function(_0x491cef){_0x597438['count']=_0x491cef;if(_0x2a86ae[_0xd6b1('0x46')]['includeAll']){_0x2dd4c7[_0xd6b1('0x58')]=[{'all':!![]}];}return db[_0xd6b1('0x6a')][_0xd6b1('0x59')](_0x2dd4c7);})[_0xd6b1('0x21')](function(_0x34ec1b){_0x597438[_0xd6b1('0x5a')]=_0x34ec1b;return _0x597438;});}})[_0xd6b1('0x21')](respondWithFilteredResult(_0x136a66,_0x2dd4c7))[_0xd6b1('0x2b')](handleError(_0x136a66,null));};exports[_0xd6b1('0x6d')]=function(_0x3b1539,_0x2bc792,_0x39af53){return db['OpenchannelAccount'][_0xd6b1('0x5d')]({'where':{'id':_0x3b1539['params']['id']}})[_0xd6b1('0x21')](handleEntityNotFound(_0x2bc792,null))[_0xd6b1('0x21')](function(_0x2ebc2d){if(_0x2ebc2d){return _0x2ebc2d[_0xd6b1('0x6d')](_0x3b1539[_0xd6b1('0x46')][_0xd6b1('0x6e')]);}})[_0xd6b1('0x21')](respondWithStatusCode(_0x2bc792,null))['catch'](handleError(_0x2bc792,null));};exports[_0xd6b1('0x6f')]=function(_0x28a8c6,_0x4789d9,_0x27ebbe){if(_0x28a8c6[_0xd6b1('0x5f')]['id']){delete _0x28a8c6[_0xd6b1('0x5f')]['id'];}return db[_0xd6b1('0x40')]['find']({'where':{'id':_0x28a8c6['params']['id']}})[_0xd6b1('0x21')](handleEntityNotFound(_0x4789d9,null))['then'](function(_0x3015bd){if(_0x3015bd){_0x28a8c6['body'][_0xd6b1('0x69')]=_0x3015bd['id'];return db[_0xd6b1('0x70')]['create'](_0x28a8c6['body']);}})[_0xd6b1('0x21')](respondWithResult(_0x4789d9,null))[_0xd6b1('0x2b')](handleError(_0x4789d9,null));};exports[_0xd6b1('0x71')]=function(_0x5db649,_0x4352ae,_0x4b6cfe){var _0x3efd69={'raw':![],'where':{}};var _0x5cd89e={};var _0x408f11={'count':0x0,'rows':[]};return db[_0xd6b1('0x40')][_0xd6b1('0x6c')]({'where':{'id':_0x5db649['params']['id']}})[_0xd6b1('0x21')](handleEntityNotFound(_0x4352ae,null))['then'](function(_0x2a37d5){if(_0x2a37d5){_0x5cd89e[_0xd6b1('0x49')]=_['keys'](db['CannedAnswer']['rawAttributes']);_0x5cd89e[_0xd6b1('0x46')]=_[_0xd6b1('0x45')](_0x5db649[_0xd6b1('0x46')]);_0x5cd89e[_0xd6b1('0x47')]=_[_0xd6b1('0x48')](_0x5cd89e[_0xd6b1('0x49')],_0x5cd89e['query']);_0x3efd69[_0xd6b1('0x4a')]=_[_0xd6b1('0x48')](_0x5cd89e[_0xd6b1('0x49')],qs[_0xd6b1('0x4b')](_0x5db649['query'][_0xd6b1('0x4b')]));_0x3efd69[_0xd6b1('0x4a')]=_0x3efd69[_0xd6b1('0x4a')][_0xd6b1('0x4c')]?_0x3efd69[_0xd6b1('0x4a')]:_0x5cd89e[_0xd6b1('0x49')];if(!_0x5db649[_0xd6b1('0x46')]['hasOwnProperty'](_0xd6b1('0x4e'))){_0x3efd69[_0xd6b1('0x31')]=qs[_0xd6b1('0x31')](_0x5db649['query']['limit']);_0x3efd69['offset']=qs[_0xd6b1('0x30')](_0x5db649['query'][_0xd6b1('0x30')]);}_0x3efd69[_0xd6b1('0x4f')]=qs[_0xd6b1('0x50')](_0x5db649[_0xd6b1('0x46')][_0xd6b1('0x50')]);_0x3efd69['where']=qs[_0xd6b1('0x47')](_[_0xd6b1('0x72')](_0x5db649[_0xd6b1('0x46')],_0x5cd89e['filters']));_0x3efd69[_0xd6b1('0x51')][_0xd6b1('0x69')]=_0x2a37d5['id'];if(_0x5db649['query'][_0xd6b1('0x54')]){_0x3efd69[_0xd6b1('0x51')]=_['merge'](_0x3efd69['where'],{'$or':_[_0xd6b1('0x52')](_0x3efd69['attributes'],function(_0x3abf2d){var _0x1207cf={};_0x1207cf[_0x3abf2d]={'$like':'%'+_0x5db649['query'][_0xd6b1('0x54')]+'%'};return _0x1207cf;})});}_0x3efd69=_[_0xd6b1('0x55')]({},_0x3efd69,_0x5db649['options']);return db[_0xd6b1('0x70')][_0xd6b1('0x33')]({'where':_0x3efd69[_0xd6b1('0x51')]})[_0xd6b1('0x21')](function(_0x59db25){_0x408f11[_0xd6b1('0x33')]=_0x59db25;if(_0x5db649[_0xd6b1('0x46')]['includeAll']){_0x3efd69[_0xd6b1('0x58')]=[{'all':!![]}];}return db['CannedAnswer'][_0xd6b1('0x59')](_0x3efd69);})[_0xd6b1('0x21')](function(_0x293f3d){_0x408f11[_0xd6b1('0x5a')]=_0x293f3d;return _0x408f11;});}})[_0xd6b1('0x21')](respondWithFilteredResult(_0x4352ae,_0x3efd69))['catch'](handleError(_0x4352ae,null));};exports[_0xd6b1('0x73')]=function(_0x28fe4c,_0x1d9af1,_0x3ba4b2){return db[_0xd6b1('0x40')][_0xd6b1('0x5d')]({'where':{'id':_0x28fe4c[_0xd6b1('0x5c')]['id']}})[_0xd6b1('0x21')](handleEntityNotFound(_0x1d9af1,null))[_0xd6b1('0x21')](function(_0x2de292){if(_0x2de292){return _0x2de292[_0xd6b1('0x73')](_0x28fe4c[_0xd6b1('0x46')]['ids']);}})[_0xd6b1('0x21')](respondWithStatusCode(_0x1d9af1,null))[_0xd6b1('0x2b')](handleError(_0x1d9af1,null));};exports[_0xd6b1('0x74')]=function(_0x4eeb9f,_0x2491c4,_0x3cb287){var _0x4d3985={'body':_0x4eeb9f[_0xd6b1('0x5f')],'channel':_0xd6b1('0x75')};var _0x2cdbcd=[];var _0xf05d2=[];var _0xbcc755={};var _0x4b7425=![];return db[_0xd6b1('0x76')]['describe']()['then'](function(_0x454884){if(!_0x454884){throw new db[(_0xd6b1('0x77'))][(_0xd6b1('0x78'))](_0xd6b1('0x79'));}_0x2cdbcd=_[_0xd6b1('0x7a')](_[_0xd6b1('0x45')](_0x454884),['createdAt',_0xd6b1('0x7b')]);_0xf05d2=_['difference'](_[_0xd6b1('0x45')](_0x454884),[_0xd6b1('0x7c'),_0xd6b1('0x7b'),'CompanyId','ListId']);if(_0x4eeb9f[_0xd6b1('0x5f')]['id']){delete _0x4eeb9f['body']['id'];}if(_[_0xd6b1('0x7d')](_0x4eeb9f[_0xd6b1('0x5f')]['from'])){throw new db[(_0xd6b1('0x77'))][(_0xd6b1('0x78'))]('from\x20is\x20mandatory');}if(_[_0xd6b1('0x7d')](_0x4eeb9f['body']['body'])||_0x4eeb9f[_0xd6b1('0x5f')][_0xd6b1('0x5f')]===''){throw new db[(_0xd6b1('0x77'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xd6b1('0x7d')](_0x4eeb9f[_0xd6b1('0x5f')][_0xd6b1('0x7e')])){throw new db[(_0xd6b1('0x77'))][(_0xd6b1('0x78'))](_0xd6b1('0x7f')+_0xf05d2);}if(!_[_0xd6b1('0x80')](_0xf05d2,_0x4eeb9f[_0xd6b1('0x5f')][_0xd6b1('0x7e')])){throw new db[(_0xd6b1('0x77'))]['ValidationError'](_0xd6b1('0x81')+_0xf05d2);}_0xbcc755[_0x4eeb9f['body']['mapKey']]=_0x4eeb9f['body'][_0xd6b1('0x82')];})[_0xd6b1('0x21')](function(){return db['OpenchannelAccount'][_0xd6b1('0x5d')]({'where':{'id':_0x4eeb9f[_0xd6b1('0x5c')]['id']},'include':[{'model':db['CmList'],'as':_0xd6b1('0x83'),'include':[{'model':db[_0xd6b1('0x76')],'as':_0xd6b1('0x84'),'where':_0xbcc755,'limit':0x1,'order':[[_0xd6b1('0x7b'),_0xd6b1('0x85')]]}]},{'model':db[_0xd6b1('0x86')],'as':_0xd6b1('0x87')}]});})[_0xd6b1('0x21')](handleEntityNotFound(_0x2491c4,null))[_0xd6b1('0x21')](function(_0x5345d0){if(_0x5345d0&&_0x5345d0[_0xd6b1('0x83')]){_0x4d3985['account']=_0x5345d0;_0x4d3985[_0xd6b1('0x88')]=_0x5345d0[_0xd6b1('0x87')];_0x4d3985['list']=_0x5345d0[_0xd6b1('0x83')];_0x4d3985[_0xd6b1('0x88')]=_[_0xd6b1('0x89')](_0x4d3985[_0xd6b1('0x88')],[_0xd6b1('0x8a')],[_0xd6b1('0x8b')]);if(_0x4d3985[_0xd6b1('0x8c')][_0xd6b1('0x87')]){delete _0x4d3985['account'][_0xd6b1('0x87')];}if(_0x4d3985['account'][_0xd6b1('0x83')]&&_0x4d3985[_0xd6b1('0x8c')][_0xd6b1('0x83')][_0xd6b1('0x84')]['length']){return _0x4d3985[_0xd6b1('0x8c')][_0xd6b1('0x83')][_0xd6b1('0x84')][0x0];}var _0x55e634=_[_0xd6b1('0x19')](_0x4eeb9f[_0xd6b1('0x5f')],{'firstName':_0x4eeb9f[_0xd6b1('0x5f')]['from'],'ListId':_0x5345d0['ListId']});_0x55e634[_0x4eeb9f[_0xd6b1('0x5f')][_0xd6b1('0x7e')]]=_0x4eeb9f[_0xd6b1('0x5f')][_0xd6b1('0x82')];return db['CmContact']['create'](_0x55e634,{'fields':_0x2cdbcd,'raw':!![]});}})[_0xd6b1('0x21')](handleEntityNotFound(_0x2491c4,null))['then'](function(_0xa18079){_0x4d3985['contact']=_0xa18079;if(_0xa18079){var _0x53bdd5={'ContactId':_0xa18079['id'],'OpenchannelAccountId':_0x4eeb9f['params']['id'],'from':(_0xa18079[_0xd6b1('0x8d')]||'')+'\x20'+(_0xa18079[_0xd6b1('0x8e')]||'')};var _0x2fda20={'OpenchannelAccountId':_0x4eeb9f['params']['id'],'closed':![]};if(_0x4eeb9f['body'][_0xd6b1('0x8f')]){_0x2fda20[_0xd6b1('0x8f')]=_0x4eeb9f['body'][_0xd6b1('0x8f')];return db[_0xd6b1('0x90')][_0xd6b1('0x5d')]({'where':_0x2fda20})[_0xd6b1('0x21')](function(_0x28b4aa){if(_0x28b4aa){return[_0x28b4aa,![]];}_0x53bdd5['threadId']=_0x4eeb9f['body'][_0xd6b1('0x8f')];_0x53bdd5[_0xd6b1('0x91')]=_0x4eeb9f['body'][_0xd6b1('0x91')];return db[_0xd6b1('0x90')][_0xd6b1('0x5e')](_0x53bdd5)['then'](function(_0x14e5b2){return[_0x14e5b2,!![]];});});}else{_0x2fda20[_0xd6b1('0x8f')]=null;}_0x2fda20['ContactId']=_0xa18079['id'];return db[_0xd6b1('0x90')][_0xd6b1('0x5d')]({'where':_0x2fda20})['then'](function(_0x3be770){if(_0x3be770){return[_0x3be770,![]];}return db['OpenchannelInteraction']['create'](_0x53bdd5)[_0xd6b1('0x21')](function(_0x235d41){return[_0x235d41,!![]];});});}})[_0xd6b1('0x92')](function(_0x261e57,_0x2239af){if(_0x261e57){_0x4b7425=_0x2239af;if(!_0x2239af){var _0x40fb1d={'from':(_0x4d3985['contact'][_0xd6b1('0x8d')]||'')+'\x20'+(_0x4d3985[_0xd6b1('0x93')][_0xd6b1('0x8e')]||'')};if(_0x4eeb9f[_0xd6b1('0x5f')][_0xd6b1('0x8f')]&&_0x4eeb9f['body'][_0xd6b1('0x94')]&&_0x4eeb9f[_0xd6b1('0x5f')][_0xd6b1('0x8f')]!=_0x4eeb9f[_0xd6b1('0x5f')][_0xd6b1('0x94')]){_0x40fb1d['threadId']=_0x4eeb9f[_0xd6b1('0x5f')]['messageId'];}return _0x261e57[_0xd6b1('0x38')](_0x40fb1d);}else{return _0x261e57;}}})[_0xd6b1('0x21')](function(_0x89656e){_0x4d3985[_0xd6b1('0x95')]=_0x89656e[_0xd6b1('0x3a')]({'plain':!![]});_0x4d3985[_0xd6b1('0x95')][_0xd6b1('0x96')]=_0x4b7425;if(_0x4d3985[_0xd6b1('0x95')][_0xd6b1('0x96')]){if(_0x4d3985[_0xd6b1('0x8c')]['autoclose']){_0x4d3985['applications'][_0xd6b1('0x97')]({'id':0x0,'priority':_0x4d3985[_0xd6b1('0x88')]['length']+0x1,'app':_0xd6b1('0x98'),'appdata':_0xd6b1('0x99'),'interval':_0xd6b1('0x9a')});}}return db['OpenchannelMessage'][_0xd6b1('0x5e')]({'body':_0x4eeb9f['body'][_0xd6b1('0x5f')],'OpenchannelAccountId':_0x4eeb9f[_0xd6b1('0x5c')]['id'],'OpenchannelInteractionId':_0x89656e['id'],'direction':'in','ContactId':_0x4d3985[_0xd6b1('0x93')]['id'],'AttachmentId':_0x4eeb9f[_0xd6b1('0x5f')][_0xd6b1('0x9b')]});})[_0xd6b1('0x21')](function(_0x22c616){_0x4d3985[_0xd6b1('0x28')]=_0x22c616;if(!_0x4d3985['interaction'][_0xd6b1('0x9c')])return;return db['User'][_0xd6b1('0x5d')]({'attributes':['id','name'],'where':{'id':_0x4d3985['interaction'][_0xd6b1('0x9c')]}});})[_0xd6b1('0x21')](function(_0x171ad8){if(_0x171ad8){_0x4d3985[_0xd6b1('0x88')][_0xd6b1('0x9d')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x171ad8[_0xd6b1('0x3c')]+','+(_0x4d3985[_0xd6b1('0x8c')]['waitForTheAssignedAgent']||0xa),'interval':_0xd6b1('0x9a')});}if(!_0x4d3985[_0xd6b1('0x95')]['queueId'])return;return db[_0xd6b1('0x9e')][_0xd6b1('0x5d')]({'attributes':['id',_0xd6b1('0x3c')],'where':{'id':_0x4d3985[_0xd6b1('0x95')][_0xd6b1('0x9f')]}});})[_0xd6b1('0x21')](function(_0x193da6){if(_0x193da6){_0x4d3985[_0xd6b1('0x88')]['unshift']({'id':0x0,'priority':0x1,'app':_0xd6b1('0xa0'),'appdata':_0x193da6['name']+','+(_0x4d3985[_0xd6b1('0x8c')]['waitForTheAssignedQueue']||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start','startRouting',_0x4d3985);})['then'](function(_0x321c2d){respondWithRpcPromise('EventManager',_0xd6b1('0xa1'),{'event':_0xd6b1('0x74'),'message':_0x321c2d},client9002);return _0x321c2d;})[_0xd6b1('0x21')](respondWithResult(_0x2491c4,null))[_0xd6b1('0x2b')](handleError(_0x2491c4,null));};exports['addApplications']=function(_0x3a9e93,_0xdb3db4){var _0x1b3e36=_0x3a9e93[_0xd6b1('0x5c')]['id'];var _0x4923c0=_0x3a9e93[_0xd6b1('0x5f')];var _0x4d6eb1=0xc8;var _0x7e3f5a=null;return db[_0xd6b1('0xa2')]['transaction']({'isolationLevel':db['sequelize'][_0xd6b1('0xa3')]['ISOLATION_LEVELS'][_0xd6b1('0xa4')]},function(_0x494850){return db[_0xd6b1('0x40')]['findOne']({'where':{'id':_0x1b3e36},'transaction':_0x494850})[_0xd6b1('0x21')](function(_0x380c2c){if(_0x380c2c){return db['OpenchannelApplication'][_0xd6b1('0x39')]({'where':{'OpenchannelAccountId':_0x1b3e36},'transaction':_0x494850})['then'](function(){var _0xe7755c=_['map'](_0x4923c0,function(_0x45e99c){_0x45e99c[_0xd6b1('0x69')]=_0x1b3e36;return _0x45e99c;});return db[_0xd6b1('0x86')]['bulkCreate'](_0xe7755c,{'transaction':_0x494850});});}else{_0x4d6eb1=0x194;_0x7e3f5a=[];}});})['then'](function(){if(_0x4d6eb1!==0x194){return db[_0xd6b1('0x86')][_0xd6b1('0xa5')]({'where':{'OpenchannelAccountId':_0x1b3e36},'order':_0xd6b1('0x8a')})[_0xd6b1('0x21')](function(_0x266c24){_0x7e3f5a=_0x266c24;});}})[_0xd6b1('0x2b')](function(_0x244209){_0x4d6eb1=0x1f4;logger[_0xd6b1('0x26')](_0x244209[_0xd6b1('0x3b')]);if(_0x244209[_0xd6b1('0x3c')]){delete _0x244209[_0xd6b1('0x3c')];}_0x7e3f5a=_0x244209;})['finally'](function(){if(_0x7e3f5a===null){_0xdb3db4['sendStatus'](_0x4d6eb1);}else{if(_0x4d6eb1===0x1f4){_0xdb3db4[_0xd6b1('0x2d')](_0x4d6eb1)[_0xd6b1('0x3d')](_0x7e3f5a);}else{_0xdb3db4[_0xd6b1('0x2d')](_0x4d6eb1)[_0xd6b1('0x2f')](_0x7e3f5a);}}});};exports[_0xd6b1('0xa6')]=function(_0x474f00,_0x3a5dc5,_0x59d096){var _0x4122ad={};var _0x280e1d={};var _0x21f601;var _0x45b91a;return db[_0xd6b1('0x40')][_0xd6b1('0x6c')]({'where':{'id':_0x474f00[_0xd6b1('0x5c')]['id']}})[_0xd6b1('0x21')](handleEntityNotFound(_0x3a5dc5,null))['then'](function(_0x37aede){if(_0x37aede){_0x21f601=_0x37aede;_0x280e1d[_0xd6b1('0x49')]=_['keys'](db[_0xd6b1('0x86')]['rawAttributes']);_0x280e1d[_0xd6b1('0x46')]=_[_0xd6b1('0x45')](_0x474f00[_0xd6b1('0x46')]);_0x280e1d[_0xd6b1('0x47')]=_[_0xd6b1('0x48')](_0x280e1d[_0xd6b1('0x49')],_0x280e1d[_0xd6b1('0x46')]);_0x4122ad[_0xd6b1('0x4a')]=_['intersection'](_0x280e1d[_0xd6b1('0x49')],qs[_0xd6b1('0x4b')](_0x474f00[_0xd6b1('0x46')]['fields']));_0x4122ad['attributes']=_0x4122ad[_0xd6b1('0x4a')][_0xd6b1('0x4c')]?_0x4122ad[_0xd6b1('0x4a')]:_0x280e1d[_0xd6b1('0x49')];_0x4122ad[_0xd6b1('0x4f')]=qs[_0xd6b1('0x50')](_0x474f00[_0xd6b1('0x46')]['sort']);_0x4122ad[_0xd6b1('0x51')]=qs[_0xd6b1('0x47')](_['pick'](_0x474f00[_0xd6b1('0x46')],_0x280e1d['filters']));if(_0x474f00[_0xd6b1('0x46')][_0xd6b1('0x54')]){_0x4122ad[_0xd6b1('0x51')]=_[_0xd6b1('0x55')](_0x4122ad[_0xd6b1('0x51')],{'$or':_[_0xd6b1('0x52')](_0x4122ad[_0xd6b1('0x4a')],function(_0x16c368){var _0x32e9d6={};_0x32e9d6[_0x16c368]={'$like':'%'+_0x474f00[_0xd6b1('0x46')]['filter']+'%'};return _0x32e9d6;})});}_0x4122ad=_[_0xd6b1('0x55')]({},_0x4122ad,_0x474f00[_0xd6b1('0x56')]);return _0x21f601[_0xd6b1('0xa6')](_0x4122ad);}})[_0xd6b1('0x21')](function(_0x1275b6){if(_0x1275b6){_0x45b91a=_0x1275b6['length'];if(!_0x474f00['query'][_0xd6b1('0x4d')](_0xd6b1('0x4e'))){_0x4122ad['limit']=qs[_0xd6b1('0x31')](_0x474f00[_0xd6b1('0x46')][_0xd6b1('0x31')]);_0x4122ad[_0xd6b1('0x30')]=qs[_0xd6b1('0x30')](_0x474f00['query']['offset']);}return _0x21f601[_0xd6b1('0xa6')](_0x4122ad);}})[_0xd6b1('0x21')](function(_0x4c811d){if(_0x4c811d){return _0x4c811d?{'count':_0x45b91a,'rows':_0x4c811d}:null;}})[_0xd6b1('0x21')](respondWithResult(_0x3a5dc5,null))['catch'](handleError(_0x3a5dc5,null));};exports[_0xd6b1('0xa7')]=function(_0xda5e07,_0x989414,_0x4da360){var _0x331218={'raw':![],'where':{}};var _0x39d975={};var _0x573402={'count':0x0,'rows':[]};return db[_0xd6b1('0x40')][_0xd6b1('0x6c')]({'where':{'id':_0xda5e07[_0xd6b1('0x5c')]['id']}})[_0xd6b1('0x21')](handleEntityNotFound(_0x989414,null))[_0xd6b1('0x21')](function(_0x174fef){if(_0x174fef){_0x39d975[_0xd6b1('0x49')]=_[_0xd6b1('0x45')](db[_0xd6b1('0x90')]['rawAttributes']);_0x39d975[_0xd6b1('0x46')]=_['keys'](_0xda5e07['query']);_0x39d975[_0xd6b1('0x47')]=_['intersection'](_0x39d975[_0xd6b1('0x49')],_0x39d975['query']);_0x331218['attributes']=_['intersection'](_0x39d975[_0xd6b1('0x49')],qs['fields'](_0xda5e07['query'][_0xd6b1('0x4b')]));_0x331218[_0xd6b1('0x4a')]=_0x331218['attributes'][_0xd6b1('0x4c')]?_0x331218['attributes']:_0x39d975['model'];if(!_0xda5e07[_0xd6b1('0x46')][_0xd6b1('0x4d')](_0xd6b1('0x4e'))){_0x331218[_0xd6b1('0x31')]=qs['limit'](_0xda5e07[_0xd6b1('0x46')][_0xd6b1('0x31')]);_0x331218[_0xd6b1('0x30')]=qs['offset'](_0xda5e07['query'][_0xd6b1('0x30')]);}_0x331218[_0xd6b1('0x4f')]=qs[_0xd6b1('0x50')](_0xda5e07[_0xd6b1('0x46')][_0xd6b1('0x50')]);_0x331218['where']=qs[_0xd6b1('0x47')](_['pick'](_0xda5e07[_0xd6b1('0x46')],_0x39d975['filters']));_0x331218[_0xd6b1('0x51')][_0xd6b1('0x69')]=_0x174fef['id'];if(_0xda5e07[_0xd6b1('0x46')]['filter']){_0x331218[_0xd6b1('0x51')]=_[_0xd6b1('0x55')](_0x331218['where'],{'$or':_[_0xd6b1('0x52')](_0x331218[_0xd6b1('0x4a')],function(_0x9d813c){var _0x5669b9={};_0x5669b9[_0x9d813c]={'$like':'%'+_0xda5e07[_0xd6b1('0x46')][_0xd6b1('0x54')]+'%'};return _0x5669b9;})});}_0x331218=_[_0xd6b1('0x55')]({},_0x331218,_0xda5e07[_0xd6b1('0x56')]);return db[_0xd6b1('0x90')][_0xd6b1('0x33')]({'where':_0x331218[_0xd6b1('0x51')]})[_0xd6b1('0x21')](function(_0x17d56e){_0x573402[_0xd6b1('0x33')]=_0x17d56e;if(_0xda5e07[_0xd6b1('0x46')][_0xd6b1('0x57')]){_0x331218['include']=[{'model':db[_0xd6b1('0x76')],'as':_0xd6b1('0xa8'),'required':![]},{'model':db['User'],'as':'Owner','attributes':[_0xd6b1('0x3c'),'fullname',_0xd6b1('0xa9')],'required':![]},{'model':db['Tag'],'as':_0xd6b1('0xaa'),'attributes':['id',_0xd6b1('0x3c'),_0xd6b1('0xab')],'where':_0xda5e07[_0xd6b1('0x46')][_0xd6b1('0xac')]?{'id':_0xda5e07['query']['tag']}:undefined,'required':_0xda5e07[_0xd6b1('0x46')][_0xd6b1('0xac')]?!![]:![]}];}return db[_0xd6b1('0x90')][_0xd6b1('0x59')](_0x331218);})[_0xd6b1('0x21')](function(_0x2360c7){_0x573402['rows']=_0x2360c7;return _0x573402;});}})[_0xd6b1('0x21')](respondWithFilteredResult(_0x989414,_0x331218))['catch'](handleError(_0x989414,null));};exports[_0xd6b1('0xad')]=function(_0xf1e9ec,_0x441566,_0x3fdcd8){return db[_0xd6b1('0x40')]['find']({'where':{'id':_0xf1e9ec[_0xd6b1('0x5c')]['id']}})[_0xd6b1('0x21')](handleEntityNotFound(_0x441566,null))['then'](function(_0x5d24c5){if(_0x5d24c5){return _0x5d24c5[_0xd6b1('0xad')](_0xf1e9ec['body'][_0xd6b1('0x6e')],_[_0xd6b1('0xae')](_0xf1e9ec[_0xd6b1('0x5f')],[_0xd6b1('0x6e'),'id'])||{})[_0xd6b1('0x92')](function(_0x114744){for(var _0x28e133=0x0;_0x28e133<_0xf1e9ec[_0xd6b1('0x5f')][_0xd6b1('0x6e')][_0xd6b1('0x4c')];_0x28e133+=0x1){socket[_0xd6b1('0xaf')](_0xd6b1('0xb0'),{'UserId':Number(_0xf1e9ec[_0xd6b1('0x5f')][_0xd6b1('0x6e')][_0x28e133]),'OpenchannelAccountId':Number(_0xf1e9ec['params']['id'])});}return _0x114744;});}})['then'](respondWithResult(_0x441566,null))[_0xd6b1('0x2b')](handleError(_0x441566,null));};exports[_0xd6b1('0xb1')]=function(_0x353eeb,_0x3e78d4,_0x4e6ea8){return db[_0xd6b1('0x40')]['find']({'where':{'id':_0x353eeb[_0xd6b1('0x5c')]['id']}})['then'](handleEntityNotFound(_0x3e78d4,null))['then'](function(_0x123e4a){if(_0x123e4a){return _0x123e4a['removeAgents'](_0x353eeb[_0xd6b1('0x46')]['ids'])[_0xd6b1('0x21')](function(){if(_[_0xd6b1('0xb2')](_0x353eeb[_0xd6b1('0x46')][_0xd6b1('0x6e')])){for(var _0x181f15=0x0;_0x181f15<_0x353eeb[_0xd6b1('0x46')]['ids']['length'];_0x181f15+=0x1){socket[_0xd6b1('0xaf')]('userOpenchannelAccount:remove',{'UserId':Number(_0x353eeb['query'][_0xd6b1('0x6e')][_0x181f15]),'OpenchannelAccountId':Number(_0x353eeb[_0xd6b1('0x5c')]['id'])});}}else{socket[_0xd6b1('0xaf')](_0xd6b1('0xb3'),{'UserId':Number(_0x353eeb['query'][_0xd6b1('0x6e')]),'OpenchannelAccountId':Number(_0x353eeb[_0xd6b1('0x5c')]['id'])});}});}})['then'](respondWithStatusCode(_0x3e78d4,null))['catch'](handleError(_0x3e78d4,null));};exports[_0xd6b1('0xb4')]=function(_0x133645,_0x5486fc,_0x27e234){var _0x371213={};var _0x595f88={};var _0x15d55e;var _0x30c03e;return db['OpenchannelAccount']['findOne']({'where':{'id':_0x133645['params']['id']}})[_0xd6b1('0x21')](handleEntityNotFound(_0x5486fc,null))['then'](function(_0x50e658){if(_0x50e658){_0x15d55e=_0x50e658;_0x595f88[_0xd6b1('0x49')]=_[_0xd6b1('0x45')](db[_0xd6b1('0xb5')]['rawAttributes']);_0x595f88[_0xd6b1('0x46')]=_[_0xd6b1('0x45')](_0x133645[_0xd6b1('0x46')]);_0x595f88[_0xd6b1('0x47')]=_[_0xd6b1('0x48')](_0x595f88[_0xd6b1('0x49')],_0x595f88[_0xd6b1('0x46')]);_0x371213[_0xd6b1('0x4a')]=_['intersection'](_0x595f88['model'],qs['fields'](_0x133645[_0xd6b1('0x46')]['fields']));_0x371213[_0xd6b1('0x4a')]=_0x371213['attributes']['length']?_0x371213[_0xd6b1('0x4a')]:_0x595f88['model'];_0x371213[_0xd6b1('0x4f')]=qs[_0xd6b1('0x50')](_0x133645['query'][_0xd6b1('0x50')]);_0x371213[_0xd6b1('0x51')]=qs[_0xd6b1('0x47')](_[_0xd6b1('0x72')](_0x133645[_0xd6b1('0x46')],_0x595f88[_0xd6b1('0x47')]));if(_0x133645[_0xd6b1('0x46')][_0xd6b1('0x54')]){_0x371213[_0xd6b1('0x51')]=_[_0xd6b1('0x55')](_0x371213[_0xd6b1('0x51')],{'$or':_[_0xd6b1('0x52')](_0x371213[_0xd6b1('0x4a')],function(_0x525a66){var _0x5969d={};_0x5969d[_0x525a66]={'$like':'%'+_0x133645[_0xd6b1('0x46')]['filter']+'%'};return _0x5969d;})});}_0x371213=_[_0xd6b1('0x55')]({},_0x371213,_0x133645[_0xd6b1('0x56')]);return _0x15d55e['getAgents'](_0x371213);}})['then'](function(_0x360829){if(_0x360829){_0x30c03e=_0x360829[_0xd6b1('0x4c')];if(!_0x133645[_0xd6b1('0x46')][_0xd6b1('0x4d')](_0xd6b1('0x4e'))){_0x371213[_0xd6b1('0x31')]=qs['limit'](_0x133645[_0xd6b1('0x46')][_0xd6b1('0x31')]);_0x371213[_0xd6b1('0x30')]=qs[_0xd6b1('0x30')](_0x133645[_0xd6b1('0x46')][_0xd6b1('0x30')]);}return _0x15d55e[_0xd6b1('0xb4')](_0x371213);}})[_0xd6b1('0x21')](function(_0x4d0c92){if(_0x4d0c92){return _0x4d0c92?{'count':_0x30c03e,'rows':_0x4d0c92}:null;}})['then'](respondWithResult(_0x5486fc,null))['catch'](handleError(_0x5486fc,null));};exports[_0xd6b1('0x3d')]=function(_0x1e5c95,_0x1243d6,_0x49a16c){var _0x4352db,_0x5218d7,_0x39b053;if(_[_0xd6b1('0x7d')](_0x1e5c95['body'][_0xd6b1('0x5f')])||_0x1e5c95[_0xd6b1('0x5f')]['body']===''){throw new db['Sequelize'][(_0xd6b1('0x78'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xd6b1('0x7d')](_0x1e5c95['body']['to'])){}_0x4352db=_0x1e5c95['body']['to'];return db['OpenchannelAccount']['findOne']({'where':{'id':_0x1e5c95[_0xd6b1('0x5c')]['id']}})[_0xd6b1('0x21')](handleEntityNotFound(_0x1243d6,null))['then'](function(_0x2211cf){if(_0x2211cf){return db['OpenchannelAccount'][_0xd6b1('0x5d')]({'where':{'id':_0x2211cf['id']},'include':[{'model':db[_0xd6b1('0xb6')],'as':_0xd6b1('0x83'),'include':[{'model':db['CmContact'],'as':_0xd6b1('0x84'),'where':{[_0x2211cf[_0xd6b1('0x7e')]]:_0x4352db},'limit':0x1,'order':[[_0xd6b1('0x7b'),_0xd6b1('0x85')]]}]}]})[_0xd6b1('0x21')](handleEntityNotFound(_0x1243d6,null))[_0xd6b1('0x21')](function(_0x1e5771){if(_0x1e5771&&_0x1e5771['List']){_0x5218d7=_0x1e5771[_0xd6b1('0x3a')]({'plain':!![]});if(_0x5218d7['List']&&_0x5218d7[_0xd6b1('0x83')][_0xd6b1('0x84')][_0xd6b1('0x4c')]){return _0x5218d7['List'][_0xd6b1('0x84')][0x0];}return db[_0xd6b1('0x76')]['create'](_[_0xd6b1('0x19')](_0x1e5c95[_0xd6b1('0x5f')],{'firstName':_0x4352db,[_0x1e5771[_0xd6b1('0x7e')]]:_0x4352db,'phone':_0x4352db,'ListId':_0x5218d7[_0xd6b1('0xb7')]}));}})['then'](handleEntityNotFound(_0x1243d6,null))[_0xd6b1('0x21')](function(_0x35e6a6){if(_0x35e6a6){_0x39b053=_0x35e6a6;return db[_0xd6b1('0x90')][_0xd6b1('0x5d')]({'where':{'ContactId':_0x39b053['id'],'closed':![],'OpenchannelAccountId':_0x5218d7['id']}})[_0xd6b1('0x21')](function(_0x3da701){if(_0x3da701){return[_0x3da701,![]];}return db[_0xd6b1('0x90')][_0xd6b1('0x5e')]({'UserId':_0x1e5c95['user']['id'],'ContactId':_0x39b053['id'],'OpenchannelAccountId':_0x5218d7['id'],'lastMsgDirection':_0xd6b1('0xb8'),'firstMsgDirection':_0xd6b1('0xb8'),'Messages':[_[_0xd6b1('0x55')](_0x1e5c95[_0xd6b1('0x5f')],{'read':![],'body':_0x1e5c95[_0xd6b1('0x5f')]['body'],'OpenchannelAccountId':_0x5218d7['id'],'UserId':_0x1e5c95[_0xd6b1('0x60')]['id'],'ContactId':_0x39b053['id']})]},{'include':[{'model':db[_0xd6b1('0xb9')],'as':'Messages'}]})[_0xd6b1('0x21')](function(_0x4c0453){return[_0x4c0453,!![]];});});}})[_0xd6b1('0x92')](function(_0x4fb5ce,_0x1e0ff1){if(_0x1e0ff1){return _0x4fb5ce;}return db[_0xd6b1('0xb9')][_0xd6b1('0x5e')](_['merge'](_0x1e5c95[_0xd6b1('0x5f')],{'read':![],'body':_0x1e5c95[_0xd6b1('0x5f')][_0xd6b1('0x5f')],'OpenchannelAccountId':_0x5218d7['id'],'OpenchannelInteractionId':_0x4fb5ce['id'],'UserId':_0x1e5c95[_0xd6b1('0x60')]['id'],'ContactId':_0x39b053['id']}))[_0xd6b1('0x21')](function(_0xe14f3){_0x4fb5ce[_0xd6b1('0xba')][_0xd6b1('0xbb')]=[];_0x4fb5ce['dataValues'][_0xd6b1('0xbb')][_0xd6b1('0x97')](_0xe14f3['dataValues']);return _0x4fb5ce;});});}})[_0xd6b1('0x21')](respondWithResult(_0x1243d6,null))[_0xd6b1('0x2b')](handleError(_0x1243d6,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 0f2cb9a..305d707 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 _0xb903=['setMaxListeners','update','remove','emit','hasOwnProperty','events','../../mysqldb','OpenchannelAccount'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0xb903,0x185));var _0x3b90=function(_0x3452a1,_0x268938){_0x3452a1=_0x3452a1-0x0;var _0x35fe10=_0xb903[_0x3452a1];return _0x35fe10;};'use strict';var EventEmitter=require(_0x3b90('0x0'));var OpenchannelAccount=require(_0x3b90('0x1'))['db'][_0x3b90('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x3b90('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3b90('0x4'),'afterDestroy':_0x3b90('0x5')};function emitEvent(_0x3b024a){return function(_0x1cd5d8,_0x30d8db,_0x40f726){OpenchannelAccountEvents[_0x3b90('0x6')](_0x3b024a+':'+_0x1cd5d8['id'],_0x1cd5d8);OpenchannelAccountEvents['emit'](_0x3b024a,_0x1cd5d8);_0x40f726(null);};}for(var e in events){if(events[_0x3b90('0x7')](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file +var _0xac4a=['../../mysqldb','OpenchannelAccount','setMaxListeners','save','update','emit','hook','events'];(function(_0x6c8b3b,_0x5b2d91){var _0x1bb34e=function(_0x19fa55){while(--_0x19fa55){_0x6c8b3b['push'](_0x6c8b3b['shift']());}};_0x1bb34e(++_0x5b2d91);}(_0xac4a,0x13f));var _0xaac4=function(_0x30e62c,_0x41c68e){_0x30e62c=_0x30e62c-0x0;var _0xcc9b2e=_0xac4a[_0x30e62c];return _0xcc9b2e;};'use strict';var EventEmitter=require(_0xaac4('0x0'));var OpenchannelAccount=require(_0xaac4('0x1'))['db'][_0xaac4('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xaac4('0x3')](0x0);var events={'afterCreate':_0xaac4('0x4'),'afterUpdate':_0xaac4('0x5'),'afterDestroy':'remove'};function emitEvent(_0x58626e){return function(_0x2af0f6,_0x2a5762,_0x32d34c){OpenchannelAccountEvents['emit'](_0x58626e+':'+_0x2af0f6['id'],_0x2af0f6);OpenchannelAccountEvents[_0xaac4('0x6')](_0x58626e,_0x2af0f6);_0x32d34c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount[_0xaac4('0x7')](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index f1763fc..b6d54f3 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(_0x1202b3,_0x2f51a5){var _0x56a424=function(_0x1d1b4a){while(--_0x1d1b4a){_0x1202b3['push'](_0x1202b3['shift']());}};_0x56a424(++_0x2f51a5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xa9e0[_0x481bf7];return _0x461787;};'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(_0x5718f8,_0x673584){var _0x1fee3e=function(_0x215224){while(--_0x215224){_0x5718f8['push'](_0x5718f8['shift']());}};_0x1fee3e(++_0x673584);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'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 9e927fe..07e8535 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 _0x23a3=['jayson/promise','client','http','defaults','redis','socket.io-emitter','./openchannelAccount.socket','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x5d65f9,_0x2d5618){var _0x1d1164=function(_0x5c24cc){while(--_0x5c24cc){_0x5d65f9['push'](_0x5d65f9['shift']());}};_0x1d1164(++_0x2d5618);}(_0x23a3,0x131));var _0x323a=function(_0x510229,_0x2d1382){_0x510229=_0x510229-0x0;var _0x23ecfd=_0x23a3[_0x510229];return _0x23ecfd;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x323a('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x323a('0x1'));var db=require(_0x323a('0x2'))['db'];var utils=require(_0x323a('0x3'));var logger=require(_0x323a('0x4'))(_0x323a('0x5'));var config=require(_0x323a('0x6'));var jayson=require(_0x323a('0x7'));var client=jayson[_0x323a('0x8')][_0x323a('0x9')]({'port':0x232a});config['redis']=_[_0x323a('0xa')](config[_0x323a('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x323a('0xc'))(new Redis(config[_0x323a('0xb')]));require(_0x323a('0xd'))['register'](socket);function respondWithRpcPromise(_0x27d081,_0x11f2e5,_0xbdb43f){return new BPromise(function(_0x3e0e0b,_0x1b3d13){return client[_0x323a('0xe')](_0x27d081,_0xbdb43f)[_0x323a('0xf')](function(_0x2cea45){logger[_0x323a('0x10')](_0x323a('0x11'),_0x11f2e5,_0x323a('0x12'));logger[_0x323a('0x13')](_0x323a('0x14'),_0x11f2e5,_0x323a('0x12'),JSON['stringify'](_0x2cea45));if(_0x2cea45[_0x323a('0x15')]){if(_0x2cea45['error'][_0x323a('0x16')]===0x1f4){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x11f2e5,_0x2cea45[_0x323a('0x15')]['message']);return _0x1b3d13(_0x2cea45[_0x323a('0x15')]['message']);}logger[_0x323a('0x15')](_0x323a('0x11'),_0x11f2e5,_0x2cea45['error'][_0x323a('0x17')]);return _0x3e0e0b(_0x2cea45[_0x323a('0x15')]['message']);}else{logger['info'](_0x323a('0x11'),_0x11f2e5,_0x323a('0x12'));_0x3e0e0b(_0x2cea45[_0x323a('0x18')][_0x323a('0x17')]);}})[_0x323a('0x19')](function(_0x2cad9b){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x11f2e5,_0x2cad9b);_0x1b3d13(_0x2cad9b);});});} \ No newline at end of file +var _0xe130=['then','info','OpenchannelAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','socket.io-emitter'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xe130,0x127));var _0x0e13=function(_0x4ef030,_0xb27fe){_0x4ef030=_0x4ef030-0x0;var _0x3635e0=_0xe130[_0x4ef030];return _0x3635e0;};'use strict';var _=require(_0x0e13('0x0'));var util=require(_0x0e13('0x1'));var moment=require('moment');var BPromise=require(_0x0e13('0x2'));var rs=require(_0x0e13('0x3'));var fs=require('fs');var Redis=require(_0x0e13('0x4'));var db=require(_0x0e13('0x5'))['db'];var utils=require(_0x0e13('0x6'));var logger=require('../../config/logger')(_0x0e13('0x7'));var config=require(_0x0e13('0x8'));var jayson=require(_0x0e13('0x9'));var client=jayson[_0x0e13('0xa')]['http']({'port':0x232a});config[_0x0e13('0xb')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0e13('0xc'))(new Redis(config[_0x0e13('0xb')]));require('./openchannelAccount.socket')['register'](socket);function respondWithRpcPromise(_0x2906e9,_0x124e0d,_0x3aad73){return new BPromise(function(_0x2e385d,_0x53f9a9){return client['request'](_0x2906e9,_0x3aad73)[_0x0e13('0xd')](function(_0x37a04e){logger[_0x0e13('0xe')](_0x0e13('0xf'),_0x124e0d,'request\x20sent');logger[_0x0e13('0x10')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x124e0d,_0x0e13('0x11'),JSON[_0x0e13('0x12')](_0x37a04e));if(_0x37a04e[_0x0e13('0x13')]){if(_0x37a04e[_0x0e13('0x13')][_0x0e13('0x14')]===0x1f4){logger[_0x0e13('0x13')](_0x0e13('0xf'),_0x124e0d,_0x37a04e[_0x0e13('0x13')][_0x0e13('0x15')]);return _0x53f9a9(_0x37a04e['error'][_0x0e13('0x15')]);}logger[_0x0e13('0x13')](_0x0e13('0xf'),_0x124e0d,_0x37a04e[_0x0e13('0x13')][_0x0e13('0x15')]);return _0x2e385d(_0x37a04e[_0x0e13('0x13')]['message']);}else{logger[_0x0e13('0xe')](_0x0e13('0xf'),_0x124e0d,'request\x20sent');_0x2e385d(_0x37a04e['result'][_0x0e13('0x15')]);}})['catch'](function(_0x2063ca){logger['error'](_0x0e13('0xf'),_0x124e0d,_0x2063ca);_0x53f9a9(_0x2063ca);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index a693fa2..60decf2 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 _0xf9bc=['save','remove','update','emit','removeListener','length','openchannelAccount:'];(function(_0x45286f,_0x4ae9f9){var _0x1c4a69=function(_0x2480c0){while(--_0x2480c0){_0x45286f['push'](_0x45286f['shift']());}};_0x1c4a69(++_0x4ae9f9);}(_0xf9bc,0x7e));var _0xcf9b=function(_0x565161,_0x50e2de){_0x565161=_0x565161-0x0;var _0x25a502=_0xf9bc[_0x565161];return _0x25a502;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=[_0xcf9b('0x0'),_0xcf9b('0x1'),_0xcf9b('0x2')];function createListener(_0x19ad1b,_0x2c385a){return function(_0x2dd51e){_0x2c385a[_0xcf9b('0x3')](_0x19ad1b,_0x2dd51e);};}function removeListener(_0x373f46,_0x6d522){return function(){OpenchannelAccountEvents[_0xcf9b('0x4')](_0x373f46,_0x6d522);};}exports['register']=function(_0x48a202){for(var _0x3595ac=0x0,_0x2ba407=events[_0xcf9b('0x5')];_0x3595ac<_0x2ba407;_0x3595ac++){var _0x2493f0=events[_0x3595ac];var _0x1ec363=createListener(_0xcf9b('0x6')+_0x2493f0,_0x48a202);OpenchannelAccountEvents['on'](_0x2493f0,_0x1ec363);}}; \ No newline at end of file +var _0xf69b=['length','openchannelAccount:','save','update','emit','register'];(function(_0x29c811,_0xb4b35c){var _0x265d46=function(_0x5170cc){while(--_0x5170cc){_0x29c811['push'](_0x29c811['shift']());}};_0x265d46(++_0xb4b35c);}(_0xf69b,0xc8));var _0xbf69=function(_0x533c56,_0x27bf0e){_0x533c56=_0x533c56-0x0;var _0x309322=_0xf69b[_0x533c56];return _0x309322;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=[_0xbf69('0x0'),'remove',_0xbf69('0x1')];function createListener(_0x4ff894,_0x2d35f6){return function(_0x44a08d){_0x2d35f6[_0xbf69('0x2')](_0x4ff894,_0x44a08d);};}function removeListener(_0x5b8f25,_0x28fa1e){return function(){OpenchannelAccountEvents['removeListener'](_0x5b8f25,_0x28fa1e);};}exports[_0xbf69('0x3')]=function(_0x1480a1){for(var _0x33d729=0x0,_0x642645=events[_0xbf69('0x4')];_0x33d729<_0x642645;_0x33d729++){var _0x4e3088=events[_0x33d729];var _0x1fec31=createListener(_0xbf69('0x5')+_0x4e3088,_0x1480a1);OpenchannelAccountEvents['on'](_0x4e3088,_0x1fec31);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index b34c736..1ac2b52 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 _0x3821=['get','isAuthenticated','show','post','create','put','/:id','update','delete','exports','multer','util','Router','../../config/environment'];(function(_0x5c0467,_0x24d47a){var _0x3f8309=function(_0x41bf2d){while(--_0x41bf2d){_0x5c0467['push'](_0x5c0467['shift']());}};_0x3f8309(++_0x24d47a);}(_0x3821,0x1ca));var _0x1382=function(_0x2c722b,_0x914dd8){_0x2c722b=_0x2c722b-0x0;var _0x485aa1=_0x3821[_0x2c722b];return _0x485aa1;};'use strict';var multer=require(_0x1382('0x0'));var util=require(_0x1382('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1382('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1382('0x3'));var controller=require('./openchannelApplication.controller');router[_0x1382('0x4')]('/',auth[_0x1382('0x5')](),controller['index']);router[_0x1382('0x4')]('/:id',auth[_0x1382('0x5')](),controller[_0x1382('0x6')]);router[_0x1382('0x7')]('/',auth[_0x1382('0x5')](),controller[_0x1382('0x8')]);router[_0x1382('0x9')](_0x1382('0xa'),auth[_0x1382('0x5')](),controller[_0x1382('0xb')]);router[_0x1382('0xc')](_0x1382('0xa'),auth[_0x1382('0x5')](),controller['destroy']);module[_0x1382('0xd')]=router; \ No newline at end of file +var _0xa395=['index','/:id','show','create','put','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','./openchannelApplication.controller','get','isAuthenticated'];(function(_0x582df7,_0x3d02cf){var _0x5081fd=function(_0x3f197c){while(--_0x3f197c){_0x582df7['push'](_0x582df7['shift']());}};_0x5081fd(++_0x3d02cf);}(_0xa395,0x17d));var _0x5a39=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa395[_0x187ee1];return _0x388160;};'use strict';var multer=require(_0x5a39('0x0'));var util=require(_0x5a39('0x1'));var path=require(_0x5a39('0x2'));var timeout=require(_0x5a39('0x3'));var express=require(_0x5a39('0x4'));var router=express[_0x5a39('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x5a39('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5a39('0x7'));router[_0x5a39('0x8')]('/',auth[_0x5a39('0x9')](),controller[_0x5a39('0xa')]);router['get'](_0x5a39('0xb'),auth[_0x5a39('0x9')](),controller[_0x5a39('0xc')]);router['post']('/',auth[_0x5a39('0x9')](),controller[_0x5a39('0xd')]);router[_0x5a39('0xe')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x5a39('0xf')](_0x5a39('0xb'),auth['isAuthenticated'](),controller[_0x5a39('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 1d6f43e..73fe168 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 _0x0170=['*,*,*,*','sequelize','exports','INTEGER','STRING','noop','TEXT'];(function(_0x407091,_0x2913c4){var _0x4e56e0=function(_0xdc95b8){while(--_0xdc95b8){_0x407091['push'](_0x407091['shift']());}};_0x4e56e0(++_0x2913c4);}(_0x0170,0x1e4));var _0x0017=function(_0x384db8,_0x67788e){_0x384db8=_0x384db8-0x0;var _0x54d689=_0x0170[_0x384db8];return _0x54d689;};'use strict';var Sequelize=require(_0x0017('0x0'));module[_0x0017('0x1')]={'priority':{'type':Sequelize[_0x0017('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x0017('0x3')],'allowNull':![],'defaultValue':_0x0017('0x4')},'appdata':{'type':Sequelize[_0x0017('0x5')]()},'description':{'type':Sequelize[_0x0017('0x3')]},'interval':{'type':Sequelize[_0x0017('0x3')],'defaultValue':_0x0017('0x6')}}; \ No newline at end of file +var _0x2b44=['noop','TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2b44,0x14c));var _0x42b4=function(_0x54c139,_0x4c8f19){_0x54c139=_0x54c139-0x0;var _0x57ed93=_0x2b44[_0x54c139];return _0x57ed93;};'use strict';var Sequelize=require(_0x42b4('0x0'));module[_0x42b4('0x1')]={'priority':{'type':Sequelize[_0x42b4('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x42b4('0x3')],'allowNull':![],'defaultValue':_0x42b4('0x4')},'appdata':{'type':Sequelize[_0x42b4('0x5')]()},'description':{'type':Sequelize[_0x42b4('0x3')]},'interval':{'type':Sequelize[_0x42b4('0x3')],'defaultValue':_0x42b4('0x6')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 1157762..84491ee 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 _0x2132=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','limit','Content-Range','apply','reject','save','then','destroy','sendStatus','error','name','index','map','OpenchannelApplication','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js'];(function(_0x4436ae,_0x297c22){var _0x2058d0=function(_0x34b0ee){while(--_0x34b0ee){_0x4436ae['push'](_0x4436ae['shift']());}};_0x2058d0(++_0x297c22);}(_0x2132,0xca));var _0x2213=function(_0x4e5de5,_0x58d2bf){_0x4e5de5=_0x4e5de5-0x0;var _0x2fc39c=_0x2132[_0x4e5de5];return _0x2fc39c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2213('0x0'));var zipdir=require(_0x2213('0x1'));var jsonpatch=require(_0x2213('0x2'));var rp=require(_0x2213('0x3'));var moment=require(_0x2213('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x2213('0x5'));var sox=require(_0x2213('0x6'));var csv=require(_0x2213('0x7'));var ejs=require(_0x2213('0x8'));var fs=require('fs');var fs_extra=require(_0x2213('0x9'));var _=require('lodash');var squel=require(_0x2213('0xa'));var crypto=require(_0x2213('0xb'));var jsforce=require(_0x2213('0xc'));var deskjs=require(_0x2213('0xd'));var toCsv=require(_0x2213('0x7'));var querystring=require(_0x2213('0xe'));var Papa=require(_0x2213('0xf'));var Redis=require(_0x2213('0x10'));var authService=require(_0x2213('0x11'));var qs=require(_0x2213('0x12'));var as=require(_0x2213('0x13'));var hardwareService=require(_0x2213('0x14'));var logger=require(_0x2213('0x15'))(_0x2213('0x16'));var utils=require(_0x2213('0x17'));var config=require(_0x2213('0x18'));var licenseUtil=require(_0x2213('0x19'));var db=require(_0x2213('0x1a'))['db'];function respondWithStatusCode(_0x32ce34,_0x22e1fe){_0x22e1fe=_0x22e1fe||0xcc;return function(_0x5f46a8){if(_0x5f46a8){return _0x32ce34['sendStatus'](_0x22e1fe);}return _0x32ce34[_0x2213('0x1b')](_0x22e1fe)[_0x2213('0x1c')]();};}function respondWithResult(_0x148275,_0x17e7ef){_0x17e7ef=_0x17e7ef||0xc8;return function(_0x24b2ec){if(_0x24b2ec){return _0x148275[_0x2213('0x1b')](_0x17e7ef)['json'](_0x24b2ec);}};}function respondWithFilteredResult(_0x3ceee0,_0x483f23){return function(_0x2a01a5){if(_0x2a01a5){var _0x5dd28e=typeof _0x483f23[_0x2213('0x1d')]===_0x2213('0x1e')&&typeof _0x483f23['limit']==='undefined';var _0x32b9c2=_0x2a01a5[_0x2213('0x1f')];var _0x5c5295=_0x5dd28e?0x0:_0x483f23['offset'];var _0x8396c9=_0x5dd28e?_0x2a01a5[_0x2213('0x1f')]:_0x483f23['offset']+_0x483f23[_0x2213('0x20')];var _0x37d14;if(_0x8396c9>=_0x32b9c2){_0x8396c9=_0x32b9c2;_0x37d14=0xc8;}else{_0x37d14=0xce;}_0x3ceee0[_0x2213('0x1b')](_0x37d14);return _0x3ceee0['set'](_0x2213('0x21'),_0x5c5295+'-'+_0x8396c9+'/'+_0x32b9c2)['json'](_0x2a01a5);}return null;};}function patchUpdates(_0x3fa342){return function(_0x5de293){try{jsonpatch[_0x2213('0x22')](_0x5de293,_0x3fa342,!![]);}catch(_0xaeaad){return BPromise[_0x2213('0x23')](_0xaeaad);}return _0x5de293[_0x2213('0x24')]();};}function saveUpdates(_0x282674,_0x538aa5){return function(_0x2365ec){if(_0x2365ec){return _0x2365ec['update'](_0x282674)[_0x2213('0x25')](function(_0x4065d9){return _0x4065d9;});}return null;};}function removeEntity(_0x292dfa,_0x33ca7e){return function(_0x344021){if(_0x344021){return _0x344021[_0x2213('0x26')]()[_0x2213('0x25')](function(){_0x292dfa[_0x2213('0x1b')](0xcc)[_0x2213('0x1c')]();});}};}function handleEntityNotFound(_0x7c5dd8,_0x5bee1a){return function(_0x33b6dd){if(!_0x33b6dd){_0x7c5dd8[_0x2213('0x27')](0x194);}return _0x33b6dd;};}function handleError(_0x11d33f,_0x5bc953){_0x5bc953=_0x5bc953||0x1f4;return function(_0x548eca){logger[_0x2213('0x28')](_0x548eca['stack']);if(_0x548eca[_0x2213('0x29')]){delete _0x548eca[_0x2213('0x29')];}_0x11d33f['status'](_0x5bc953)['send'](_0x548eca);};}exports[_0x2213('0x2a')]=function(_0x3e4dac,_0x47193c){var _0x74c5e8={},_0x35d44b={},_0x12bd75={'count':0x0,'rows':[]};var _0x210cee=_[_0x2213('0x2b')](db[_0x2213('0x2c')]['rawAttributes'],function(_0x538891){return{'name':_0x538891['fieldName'],'type':_0x538891[_0x2213('0x2d')][_0x2213('0x2e')]};});_0x35d44b[_0x2213('0x2f')]=_[_0x2213('0x2b')](_0x210cee,_0x2213('0x29'));_0x35d44b[_0x2213('0x30')]=_[_0x2213('0x31')](_0x3e4dac['query']);_0x35d44b[_0x2213('0x32')]=_[_0x2213('0x33')](_0x35d44b['model'],_0x35d44b[_0x2213('0x30')]);_0x74c5e8[_0x2213('0x34')]=_['intersection'](_0x35d44b[_0x2213('0x2f')],qs[_0x2213('0x35')](_0x3e4dac['query'][_0x2213('0x35')]));_0x74c5e8['attributes']=_0x74c5e8[_0x2213('0x34')][_0x2213('0x36')]?_0x74c5e8[_0x2213('0x34')]:_0x35d44b[_0x2213('0x2f')];if(!_0x3e4dac[_0x2213('0x30')]['hasOwnProperty']('nolimit')){_0x74c5e8[_0x2213('0x20')]=qs[_0x2213('0x20')](_0x3e4dac[_0x2213('0x30')][_0x2213('0x20')]);_0x74c5e8[_0x2213('0x1d')]=qs[_0x2213('0x1d')](_0x3e4dac['query'][_0x2213('0x1d')]);}_0x74c5e8[_0x2213('0x37')]=qs[_0x2213('0x38')](_0x3e4dac[_0x2213('0x30')][_0x2213('0x38')]);_0x74c5e8['where']=qs[_0x2213('0x32')](_[_0x2213('0x39')](_0x3e4dac[_0x2213('0x30')],_0x35d44b[_0x2213('0x32')]),_0x210cee);if(_0x3e4dac[_0x2213('0x30')][_0x2213('0x3a')]){_0x74c5e8[_0x2213('0x3b')]=_[_0x2213('0x3c')](_0x74c5e8[_0x2213('0x3b')],{'$or':_[_0x2213('0x2b')](_0x210cee,function(_0x17716d){if(_0x17716d[_0x2213('0x2d')]!==_0x2213('0x3d')){var _0xfaa6d1={};_0xfaa6d1[_0x17716d[_0x2213('0x29')]]={'$like':'%'+_0x3e4dac[_0x2213('0x30')][_0x2213('0x3a')]+'%'};return _0xfaa6d1;}})});}_0x74c5e8=_['merge']({},_0x74c5e8,_0x3e4dac[_0x2213('0x3e')]);var _0x14f785={'where':_0x74c5e8[_0x2213('0x3b')]};return db[_0x2213('0x2c')][_0x2213('0x1f')](_0x14f785)[_0x2213('0x25')](function(_0x5a26dd){_0x12bd75[_0x2213('0x1f')]=_0x5a26dd;if(_0x3e4dac['query'][_0x2213('0x3f')]){_0x74c5e8[_0x2213('0x40')]=[{'all':!![]}];}return db[_0x2213('0x2c')][_0x2213('0x41')](_0x74c5e8);})[_0x2213('0x25')](function(_0x2cac30){_0x12bd75['rows']=_0x2cac30;return _0x12bd75;})[_0x2213('0x25')](respondWithFilteredResult(_0x47193c,_0x74c5e8))[_0x2213('0x42')](handleError(_0x47193c,null));};exports[_0x2213('0x43')]=function(_0x352150,_0x28dbdf){var _0x4b2bae={'raw':!![],'where':{'id':_0x352150[_0x2213('0x44')]['id']}},_0x209816={};_0x209816[_0x2213('0x2f')]=_[_0x2213('0x31')](db[_0x2213('0x2c')]['rawAttributes']);_0x209816['query']=_[_0x2213('0x31')](_0x352150[_0x2213('0x30')]);_0x209816['filters']=_[_0x2213('0x33')](_0x209816[_0x2213('0x2f')],_0x209816[_0x2213('0x30')]);_0x4b2bae[_0x2213('0x34')]=_[_0x2213('0x33')](_0x209816[_0x2213('0x2f')],qs[_0x2213('0x35')](_0x352150['query'][_0x2213('0x35')]));_0x4b2bae[_0x2213('0x34')]=_0x4b2bae['attributes']['length']?_0x4b2bae[_0x2213('0x34')]:_0x209816['model'];if(_0x352150[_0x2213('0x30')][_0x2213('0x3f')]){_0x4b2bae['include']=[{'all':!![]}];}_0x4b2bae=_[_0x2213('0x3c')]({},_0x4b2bae,_0x352150[_0x2213('0x3e')]);return db['OpenchannelApplication'][_0x2213('0x45')](_0x4b2bae)[_0x2213('0x25')](handleEntityNotFound(_0x28dbdf,null))[_0x2213('0x25')](respondWithResult(_0x28dbdf,null))[_0x2213('0x42')](handleError(_0x28dbdf,null));};exports[_0x2213('0x46')]=function(_0x37d44a,_0x54d94d){return db[_0x2213('0x2c')][_0x2213('0x46')](_0x37d44a[_0x2213('0x47')],{})['then'](respondWithResult(_0x54d94d,0xc9))[_0x2213('0x42')](handleError(_0x54d94d,null));};exports['update']=function(_0x13479d,_0x579a8b){if(_0x13479d[_0x2213('0x47')]['id']){delete _0x13479d[_0x2213('0x47')]['id'];}return db[_0x2213('0x2c')][_0x2213('0x45')]({'where':{'id':_0x13479d[_0x2213('0x44')]['id']}})[_0x2213('0x25')](handleEntityNotFound(_0x579a8b,null))[_0x2213('0x25')](saveUpdates(_0x13479d[_0x2213('0x47')],null))[_0x2213('0x25')](respondWithResult(_0x579a8b,null))[_0x2213('0x42')](handleError(_0x579a8b,null));};exports[_0x2213('0x26')]=function(_0x10a74d,_0x3b50a8){return db[_0x2213('0x2c')][_0x2213('0x45')]({'where':{'id':_0x10a74d['params']['id']}})[_0x2213('0x25')](handleEntityNotFound(_0x3b50a8,null))[_0x2213('0x25')](removeEntity(_0x3b50a8,null))[_0x2213('0x42')](handleError(_0x3b50a8,null));}; \ No newline at end of file +var _0xcd18=['end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','update','then','error','stack','name','send','index','map','OpenchannelApplication','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status'];(function(_0x9b5bb2,_0x5db315){var _0x2e1e92=function(_0x5621c9){while(--_0x5621c9){_0x9b5bb2['push'](_0x9b5bb2['shift']());}};_0x2e1e92(++_0x5db315);}(_0xcd18,0xca));var _0x8cd1=function(_0x1e0972,_0x2912a9){_0x1e0972=_0x1e0972-0x0;var _0x456ab8=_0xcd18[_0x1e0972];return _0x456ab8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8cd1('0x0'));var zipdir=require(_0x8cd1('0x1'));var jsonpatch=require(_0x8cd1('0x2'));var rp=require(_0x8cd1('0x3'));var moment=require(_0x8cd1('0x4'));var BPromise=require(_0x8cd1('0x5'));var Mustache=require('mustache');var util=require(_0x8cd1('0x6'));var path=require(_0x8cd1('0x7'));var sox=require(_0x8cd1('0x8'));var csv=require('to-csv');var ejs=require(_0x8cd1('0x9'));var fs=require('fs');var fs_extra=require(_0x8cd1('0xa'));var _=require(_0x8cd1('0xb'));var squel=require(_0x8cd1('0xc'));var crypto=require('crypto');var jsforce=require(_0x8cd1('0xd'));var deskjs=require(_0x8cd1('0xe'));var toCsv=require(_0x8cd1('0xf'));var querystring=require(_0x8cd1('0x10'));var Papa=require(_0x8cd1('0x11'));var Redis=require(_0x8cd1('0x12'));var authService=require(_0x8cd1('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x8cd1('0x14'));var hardwareService=require(_0x8cd1('0x15'));var logger=require(_0x8cd1('0x16'))(_0x8cd1('0x17'));var utils=require(_0x8cd1('0x18'));var config=require(_0x8cd1('0x19'));var licenseUtil=require(_0x8cd1('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x207995,_0x1343a5){_0x1343a5=_0x1343a5||0xcc;return function(_0x14dcab){if(_0x14dcab){return _0x207995[_0x8cd1('0x1b')](_0x1343a5);}return _0x207995[_0x8cd1('0x1c')](_0x1343a5)[_0x8cd1('0x1d')]();};}function respondWithResult(_0x432150,_0xad1c12){_0xad1c12=_0xad1c12||0xc8;return function(_0x29cf9b){if(_0x29cf9b){return _0x432150[_0x8cd1('0x1c')](_0xad1c12)[_0x8cd1('0x1e')](_0x29cf9b);}};}function respondWithFilteredResult(_0x553c1d,_0x261cfe){return function(_0x547e18){if(_0x547e18){var _0x7aeb2f=typeof _0x261cfe['offset']===_0x8cd1('0x1f')&&typeof _0x261cfe['limit']===_0x8cd1('0x1f');var _0x2842fe=_0x547e18[_0x8cd1('0x20')];var _0x3482db=_0x7aeb2f?0x0:_0x261cfe[_0x8cd1('0x21')];var _0x6a2db0=_0x7aeb2f?_0x547e18[_0x8cd1('0x20')]:_0x261cfe[_0x8cd1('0x21')]+_0x261cfe[_0x8cd1('0x22')];var _0x59c862;if(_0x6a2db0>=_0x2842fe){_0x6a2db0=_0x2842fe;_0x59c862=0xc8;}else{_0x59c862=0xce;}_0x553c1d['status'](_0x59c862);return _0x553c1d[_0x8cd1('0x23')](_0x8cd1('0x24'),_0x3482db+'-'+_0x6a2db0+'/'+_0x2842fe)['json'](_0x547e18);}return null;};}function patchUpdates(_0x35d1e7){return function(_0x1c1268){try{jsonpatch[_0x8cd1('0x25')](_0x1c1268,_0x35d1e7,!![]);}catch(_0x46a2ec){return BPromise[_0x8cd1('0x26')](_0x46a2ec);}return _0x1c1268['save']();};}function saveUpdates(_0x3c236a,_0x17ce95){return function(_0x394e3d){if(_0x394e3d){return _0x394e3d[_0x8cd1('0x27')](_0x3c236a)[_0x8cd1('0x28')](function(_0x110020){return _0x110020;});}return null;};}function removeEntity(_0x35ea6d,_0x4e0f24){return function(_0x3c3840){if(_0x3c3840){return _0x3c3840['destroy']()[_0x8cd1('0x28')](function(){_0x35ea6d[_0x8cd1('0x1c')](0xcc)[_0x8cd1('0x1d')]();});}};}function handleEntityNotFound(_0x1589ce,_0x210d9c){return function(_0x596634){if(!_0x596634){_0x1589ce[_0x8cd1('0x1b')](0x194);}return _0x596634;};}function handleError(_0x5d2c7e,_0x72e05e){_0x72e05e=_0x72e05e||0x1f4;return function(_0x226cdf){logger[_0x8cd1('0x29')](_0x226cdf[_0x8cd1('0x2a')]);if(_0x226cdf[_0x8cd1('0x2b')]){delete _0x226cdf[_0x8cd1('0x2b')];}_0x5d2c7e[_0x8cd1('0x1c')](_0x72e05e)[_0x8cd1('0x2c')](_0x226cdf);};}exports[_0x8cd1('0x2d')]=function(_0x2a3ffb,_0x259f27){var _0x1af56b={},_0x2e64bd={},_0x4e55be={'count':0x0,'rows':[]};var _0x25846e=_[_0x8cd1('0x2e')](db[_0x8cd1('0x2f')][_0x8cd1('0x30')],function(_0x3170c6){return{'name':_0x3170c6[_0x8cd1('0x31')],'type':_0x3170c6[_0x8cd1('0x32')][_0x8cd1('0x33')]};});_0x2e64bd[_0x8cd1('0x34')]=_[_0x8cd1('0x2e')](_0x25846e,_0x8cd1('0x2b'));_0x2e64bd[_0x8cd1('0x35')]=_['keys'](_0x2a3ffb[_0x8cd1('0x35')]);_0x2e64bd[_0x8cd1('0x36')]=_[_0x8cd1('0x37')](_0x2e64bd[_0x8cd1('0x34')],_0x2e64bd[_0x8cd1('0x35')]);_0x1af56b[_0x8cd1('0x38')]=_['intersection'](_0x2e64bd[_0x8cd1('0x34')],qs[_0x8cd1('0x39')](_0x2a3ffb['query'][_0x8cd1('0x39')]));_0x1af56b[_0x8cd1('0x38')]=_0x1af56b[_0x8cd1('0x38')][_0x8cd1('0x3a')]?_0x1af56b[_0x8cd1('0x38')]:_0x2e64bd[_0x8cd1('0x34')];if(!_0x2a3ffb[_0x8cd1('0x35')]['hasOwnProperty'](_0x8cd1('0x3b'))){_0x1af56b[_0x8cd1('0x22')]=qs[_0x8cd1('0x22')](_0x2a3ffb['query']['limit']);_0x1af56b[_0x8cd1('0x21')]=qs[_0x8cd1('0x21')](_0x2a3ffb[_0x8cd1('0x35')][_0x8cd1('0x21')]);}_0x1af56b['order']=qs[_0x8cd1('0x3c')](_0x2a3ffb[_0x8cd1('0x35')][_0x8cd1('0x3c')]);_0x1af56b[_0x8cd1('0x3d')]=qs[_0x8cd1('0x36')](_[_0x8cd1('0x3e')](_0x2a3ffb[_0x8cd1('0x35')],_0x2e64bd[_0x8cd1('0x36')]),_0x25846e);if(_0x2a3ffb['query'][_0x8cd1('0x3f')]){_0x1af56b[_0x8cd1('0x3d')]=_[_0x8cd1('0x40')](_0x1af56b[_0x8cd1('0x3d')],{'$or':_['map'](_0x25846e,function(_0x1e975f){if(_0x1e975f[_0x8cd1('0x32')]!=='VIRTUAL'){var _0x2e5db0={};_0x2e5db0[_0x1e975f[_0x8cd1('0x2b')]]={'$like':'%'+_0x2a3ffb[_0x8cd1('0x35')][_0x8cd1('0x3f')]+'%'};return _0x2e5db0;}})});}_0x1af56b=_[_0x8cd1('0x40')]({},_0x1af56b,_0x2a3ffb[_0x8cd1('0x41')]);var _0x2f80f8={'where':_0x1af56b[_0x8cd1('0x3d')]};return db['OpenchannelApplication']['count'](_0x2f80f8)[_0x8cd1('0x28')](function(_0x1f7122){_0x4e55be['count']=_0x1f7122;if(_0x2a3ffb[_0x8cd1('0x35')][_0x8cd1('0x42')]){_0x1af56b[_0x8cd1('0x43')]=[{'all':!![]}];}return db['OpenchannelApplication'][_0x8cd1('0x44')](_0x1af56b);})[_0x8cd1('0x28')](function(_0x3d635a){_0x4e55be[_0x8cd1('0x45')]=_0x3d635a;return _0x4e55be;})[_0x8cd1('0x28')](respondWithFilteredResult(_0x259f27,_0x1af56b))[_0x8cd1('0x46')](handleError(_0x259f27,null));};exports[_0x8cd1('0x47')]=function(_0x1c21db,_0x5a36a8){var _0x5d9870={'raw':!![],'where':{'id':_0x1c21db[_0x8cd1('0x48')]['id']}},_0x1a586e={};_0x1a586e[_0x8cd1('0x34')]=_['keys'](db[_0x8cd1('0x2f')]['rawAttributes']);_0x1a586e['query']=_['keys'](_0x1c21db[_0x8cd1('0x35')]);_0x1a586e['filters']=_[_0x8cd1('0x37')](_0x1a586e['model'],_0x1a586e[_0x8cd1('0x35')]);_0x5d9870[_0x8cd1('0x38')]=_['intersection'](_0x1a586e[_0x8cd1('0x34')],qs[_0x8cd1('0x39')](_0x1c21db[_0x8cd1('0x35')]['fields']));_0x5d9870['attributes']=_0x5d9870[_0x8cd1('0x38')]['length']?_0x5d9870[_0x8cd1('0x38')]:_0x1a586e[_0x8cd1('0x34')];if(_0x1c21db[_0x8cd1('0x35')][_0x8cd1('0x42')]){_0x5d9870[_0x8cd1('0x43')]=[{'all':!![]}];}_0x5d9870=_[_0x8cd1('0x40')]({},_0x5d9870,_0x1c21db[_0x8cd1('0x41')]);return db[_0x8cd1('0x2f')][_0x8cd1('0x49')](_0x5d9870)[_0x8cd1('0x28')](handleEntityNotFound(_0x5a36a8,null))['then'](respondWithResult(_0x5a36a8,null))[_0x8cd1('0x46')](handleError(_0x5a36a8,null));};exports['create']=function(_0x26aa0c,_0x49ec5a){return db[_0x8cd1('0x2f')][_0x8cd1('0x4a')](_0x26aa0c[_0x8cd1('0x4b')],{})[_0x8cd1('0x28')](respondWithResult(_0x49ec5a,0xc9))['catch'](handleError(_0x49ec5a,null));};exports['update']=function(_0x17b2fd,_0x3c95d5){if(_0x17b2fd[_0x8cd1('0x4b')]['id']){delete _0x17b2fd[_0x8cd1('0x4b')]['id'];}return db['OpenchannelApplication'][_0x8cd1('0x49')]({'where':{'id':_0x17b2fd[_0x8cd1('0x48')]['id']}})[_0x8cd1('0x28')](handleEntityNotFound(_0x3c95d5,null))['then'](saveUpdates(_0x17b2fd[_0x8cd1('0x4b')],null))[_0x8cd1('0x28')](respondWithResult(_0x3c95d5,null))[_0x8cd1('0x46')](handleError(_0x3c95d5,null));};exports[_0x8cd1('0x4c')]=function(_0x23c28e,_0x35040e){return db['OpenchannelApplication'][_0x8cd1('0x49')]({'where':{'id':_0x23c28e[_0x8cd1('0x48')]['id']}})[_0x8cd1('0x28')](handleEntityNotFound(_0x35040e,null))[_0x8cd1('0x28')](removeEntity(_0x35040e,null))[_0x8cd1('0x46')](handleError(_0x35040e,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 679eafd..37b914b 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 _0x26ff=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelApplication.attributes','exports','define','lodash','util'];(function(_0x5c6412,_0x543ba4){var _0x3f0cdb=function(_0x1c62ba){while(--_0x1c62ba){_0x5c6412['push'](_0x5c6412['shift']());}};_0x3f0cdb(++_0x543ba4);}(_0x26ff,0x14e));var _0xf26f=function(_0x37eaf8,_0x2ff239){_0x37eaf8=_0x37eaf8-0x0;var _0x382546=_0x26ff[_0x37eaf8];return _0x382546;};'use strict';var _=require(_0xf26f('0x0'));var util=require(_0xf26f('0x1'));var logger=require(_0xf26f('0x2'))(_0xf26f('0x3'));var moment=require(_0xf26f('0x4'));var BPromise=require(_0xf26f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf26f('0x6'));var rimraf=require(_0xf26f('0x7'));var config=require(_0xf26f('0x8'));var attributes=require(_0xf26f('0x9'));module[_0xf26f('0xa')]=function(_0x3c92ad,_0x150d0a){return _0x3c92ad[_0xf26f('0xb')]('OpenchannelApplication',attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xfeac=['rimraf','../../config/environment','./openchannelApplication.attributes','exports','define','OpenchannelApplication','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x54defc,_0x627178){var _0x1955d3=function(_0x299afe){while(--_0x299afe){_0x54defc['push'](_0x54defc['shift']());}};_0x1955d3(++_0x627178);}(_0xfeac,0xb1));var _0xcfea=function(_0x30fa6e,_0x4568d8){_0x30fa6e=_0x30fa6e-0x0;var _0x3d5486=_0xfeac[_0x30fa6e];return _0x3d5486;};'use strict';var _=require(_0xcfea('0x0'));var util=require('util');var logger=require(_0xcfea('0x1'))(_0xcfea('0x2'));var moment=require('moment');var BPromise=require(_0xcfea('0x3'));var rp=require(_0xcfea('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcfea('0x5'));var config=require(_0xcfea('0x6'));var attributes=require(_0xcfea('0x7'));module[_0xcfea('0x8')]=function(_0x89af18,_0xc38365){return _0x89af18[_0xcfea('0x9')](_0xcfea('0xa'),attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xcfea('0xb'),'collate':_0xcfea('0xc')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 55ce0ac..14f9cf7 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 _0x61de=['../../config/environment','jayson/promise','http','request','OpenchannelApplication,\x20%s,\x20%s','debug','stringify','error','code','message','info','request\x20sent','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','body','options','where','attributes','limit','then','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x5f2668,_0x29630f){var _0x42df13=function(_0x4ea449){while(--_0x4ea449){_0x5f2668['push'](_0x5f2668['shift']());}};_0x42df13(++_0x29630f);}(_0x61de,0x1e7));var _0xe61d=function(_0xe66cf2,_0x32ba5f){_0xe66cf2=_0xe66cf2-0x0;var _0x2d84e7=_0x61de[_0xe66cf2];return _0x2d84e7;};'use strict';var _=require(_0xe61d('0x0'));var util=require(_0xe61d('0x1'));var moment=require(_0xe61d('0x2'));var BPromise=require(_0xe61d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe61d('0x4'));var db=require(_0xe61d('0x5'))['db'];var utils=require(_0xe61d('0x6'));var logger=require(_0xe61d('0x7'))(_0xe61d('0x8'));var config=require(_0xe61d('0x9'));var jayson=require(_0xe61d('0xa'));var client=jayson['client'][_0xe61d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x32204f,_0x221287,_0xa0c620){return new BPromise(function(_0x4072d3,_0x3310d9){return client[_0xe61d('0xc')](_0x32204f,_0xa0c620)['then'](function(_0x41ccb5){logger['info'](_0xe61d('0xd'),_0x221287,'request\x20sent');logger[_0xe61d('0xe')]('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x221287,'request\x20sent',JSON[_0xe61d('0xf')](_0x41ccb5));if(_0x41ccb5[_0xe61d('0x10')]){if(_0x41ccb5[_0xe61d('0x10')][_0xe61d('0x11')]===0x1f4){logger[_0xe61d('0x10')](_0xe61d('0xd'),_0x221287,_0x41ccb5[_0xe61d('0x10')][_0xe61d('0x12')]);return _0x3310d9(_0x41ccb5[_0xe61d('0x10')][_0xe61d('0x12')]);}logger[_0xe61d('0x10')](_0xe61d('0xd'),_0x221287,_0x41ccb5[_0xe61d('0x10')][_0xe61d('0x12')]);return _0x4072d3(_0x41ccb5[_0xe61d('0x10')]['message']);}else{logger[_0xe61d('0x13')]('OpenchannelApplication,\x20%s,\x20%s',_0x221287,_0xe61d('0x14'));_0x4072d3(_0x41ccb5[_0xe61d('0x15')][_0xe61d('0x12')]);}})[_0xe61d('0x16')](function(_0x571590){logger[_0xe61d('0x10')](_0xe61d('0xd'),_0x221287,_0x571590);_0x3310d9(_0x571590);});});}exports[_0xe61d('0x17')]=function(_0xa4f83f){var _0x25f440=this;return new Promise(function(_0x4307ee,_0x5924f3){return db[_0xe61d('0x18')]['update'](_0xa4f83f[_0xe61d('0x19')],{'raw':_0xa4f83f[_0xe61d('0x1a')]?_0xa4f83f[_0xe61d('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xa4f83f['options']?_0xa4f83f[_0xe61d('0x1a')][_0xe61d('0x1b')]||null:null,'attributes':_0xa4f83f[_0xe61d('0x1a')]?_0xa4f83f[_0xe61d('0x1a')][_0xe61d('0x1c')]||null:null,'limit':_0xa4f83f[_0xe61d('0x1a')]?_0xa4f83f[_0xe61d('0x1a')][_0xe61d('0x1d')]||null:null})[_0xe61d('0x1e')](function(_0x6eb63f){logger[_0xe61d('0x13')](_0xe61d('0x17'),_0xa4f83f);logger['debug'](_0xe61d('0x17'),_0xa4f83f,JSON[_0xe61d('0xf')](_0x6eb63f));_0x4307ee(_0x6eb63f);})[_0xe61d('0x16')](function(_0x568ae8){logger['error']('UpdateOpenchannelApplication',_0x568ae8[_0xe61d('0x12')],_0xa4f83f);_0x5924f3(_0x25f440[_0xe61d('0x10')](0x1f4,_0x568ae8['message']));});});}; \ No newline at end of file +var _0x78f1=['../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','OpenchannelApplication,\x20%s,\x20%s','catch','update','body','options','where','attributes','limit','UpdateOpenchannelApplication','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger'];(function(_0x24d39c,_0x3d5f29){var _0x128608=function(_0x31bbdd){while(--_0x31bbdd){_0x24d39c['push'](_0x24d39c['shift']());}};_0x128608(++_0x3d5f29);}(_0x78f1,0x1d6));var _0x178f=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x78f1[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require(_0x178f('0x0'));var moment=require(_0x178f('0x1'));var BPromise=require(_0x178f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x178f('0x3'));var db=require(_0x178f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x178f('0x5'))('rpc');var config=require(_0x178f('0x6'));var jayson=require(_0x178f('0x7'));var client=jayson[_0x178f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3197bf,_0x1d7e52,_0x299ea3){return new BPromise(function(_0x32a4ad,_0x3d35c4){return client[_0x178f('0x9')](_0x3197bf,_0x299ea3)[_0x178f('0xa')](function(_0x4c8917){logger[_0x178f('0xb')]('OpenchannelApplication,\x20%s,\x20%s',_0x1d7e52,_0x178f('0xc'));logger[_0x178f('0xd')](_0x178f('0xe'),_0x1d7e52,_0x178f('0xc'),JSON[_0x178f('0xf')](_0x4c8917));if(_0x4c8917[_0x178f('0x10')]){if(_0x4c8917[_0x178f('0x10')][_0x178f('0x11')]===0x1f4){logger[_0x178f('0x10')]('OpenchannelApplication,\x20%s,\x20%s',_0x1d7e52,_0x4c8917[_0x178f('0x10')][_0x178f('0x12')]);return _0x3d35c4(_0x4c8917[_0x178f('0x10')][_0x178f('0x12')]);}logger['error'](_0x178f('0x13'),_0x1d7e52,_0x4c8917['error'][_0x178f('0x12')]);return _0x32a4ad(_0x4c8917['error']['message']);}else{logger[_0x178f('0xb')](_0x178f('0x13'),_0x1d7e52,_0x178f('0xc'));_0x32a4ad(_0x4c8917['result'][_0x178f('0x12')]);}})[_0x178f('0x14')](function(_0x59b9fc){logger['error']('OpenchannelApplication,\x20%s,\x20%s',_0x1d7e52,_0x59b9fc);_0x3d35c4(_0x59b9fc);});});}exports['UpdateOpenchannelApplication']=function(_0x29bf56){var _0x40cc07=this;return new Promise(function(_0x49e921,_0x1a5850){return db['OpenchannelApplication'][_0x178f('0x15')](_0x29bf56[_0x178f('0x16')],{'raw':_0x29bf56[_0x178f('0x17')]?_0x29bf56[_0x178f('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x29bf56[_0x178f('0x17')]?_0x29bf56['options'][_0x178f('0x18')]||null:null,'attributes':_0x29bf56[_0x178f('0x17')]?_0x29bf56['options'][_0x178f('0x19')]||null:null,'limit':_0x29bf56[_0x178f('0x17')]?_0x29bf56[_0x178f('0x17')][_0x178f('0x1a')]||null:null})[_0x178f('0xa')](function(_0x359b4e){logger[_0x178f('0xb')](_0x178f('0x1b'),_0x29bf56);logger[_0x178f('0xd')](_0x178f('0x1b'),_0x29bf56,JSON[_0x178f('0xf')](_0x359b4e));_0x49e921(_0x359b4e);})[_0x178f('0x14')](function(_0x482a25){logger[_0x178f('0x10')](_0x178f('0x1b'),_0x482a25['message'],_0x29bf56);_0x1a5850(_0x40cc07[_0x178f('0x10')](0x1f4,_0x482a25[_0x178f('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index a336562..e3804a0 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 _0x5919=['openchannelinteraction:destroy','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','create','post','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','put','openchannelinteraction:update'];(function(_0x363ef8,_0x4ecb1a){var _0x148822=function(_0x232634){while(--_0x232634){_0x363ef8['push'](_0x363ef8['shift']());}};_0x148822(++_0x4ecb1a);}(_0x5919,0x83));var _0x9591=function(_0x26d2a9,_0x154f8b){_0x26d2a9=_0x26d2a9-0x0;var _0x5d31f1=_0x5919[_0x26d2a9];return _0x5d31f1;};'use strict';var multer=require(_0x9591('0x0'));var util=require('util');var path=require(_0x9591('0x1'));var timeout=require(_0x9591('0x2'));var express=require(_0x9591('0x3'));var router=express[_0x9591('0x4')]();var fs_extra=require(_0x9591('0x5'));var auth=require(_0x9591('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x9591('0x7'));var controller=require('./openchannelInteraction.controller');router[_0x9591('0x8')]('/',auth[_0x9591('0x9')](),controller[_0x9591('0xa')]);router[_0x9591('0x8')](_0x9591('0xb'),auth[_0x9591('0x9')](),controller[_0x9591('0xc')]);router['get'](_0x9591('0xd'),auth['isAuthenticated'](),controller[_0x9591('0xe')]);router['get'](_0x9591('0xf'),auth[_0x9591('0x9')](),controller[_0x9591('0x10')]);router[_0x9591('0x8')](_0x9591('0x11'),auth[_0x9591('0x9')](),controller[_0x9591('0x12')]);router['post']('/',auth[_0x9591('0x9')](),controller[_0x9591('0x13')]);router[_0x9591('0x14')](_0x9591('0xf'),auth[_0x9591('0x9')](),controller[_0x9591('0x15')]);router[_0x9591('0x14')](_0x9591('0x16'),auth['isAuthenticated'](),interaction[_0x9591('0x17')](_0x9591('0x18'),_0x9591('0x19')),controller[_0x9591('0x1a')]);router[_0x9591('0x1b')](_0x9591('0xd'),auth['isAuthenticated'](),interaction['tracked'](_0x9591('0x18'),_0x9591('0x1c')),controller['update']);router['delete'](_0x9591('0xd'),auth['isAuthenticated'](),interaction[_0x9591('0x17')]('openchannel',_0x9591('0x1d')),controller['destroy']);router[_0x9591('0x1e')](_0x9591('0x16'),auth['isAuthenticated'](),controller['removeTags']);module[_0x9591('0x1f')]=router; \ No newline at end of file +var _0x6096=['describe','isAuthenticated','show','/:id/messages','/:id/download','post','create','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','openchannelinteraction:update','delete','openchannelinteraction:destroy','destroy','removeTags','exports','multer','util','connect-timeout','Router','fs-extra','../../config/environment','./openchannelInteraction.controller','get','index'];(function(_0x1a8f86,_0x5ed9c4){var _0x20d876=function(_0x596e1b){while(--_0x596e1b){_0x1a8f86['push'](_0x1a8f86['shift']());}};_0x20d876(++_0x5ed9c4);}(_0x6096,0x17d));var _0x6609=function(_0x1a81ed,_0x16d17d){_0x1a81ed=_0x1a81ed-0x0;var _0x5d9db0=_0x6096[_0x1a81ed];return _0x5d9db0;};'use strict';var multer=require(_0x6609('0x0'));var util=require(_0x6609('0x1'));var path=require('path');var timeout=require(_0x6609('0x2'));var express=require('express');var router=express[_0x6609('0x3')]();var fs_extra=require(_0x6609('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6609('0x5'));var controller=require(_0x6609('0x6'));router[_0x6609('0x7')]('/',auth['isAuthenticated'](),controller[_0x6609('0x8')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x6609('0x9')]);router[_0x6609('0x7')]('/:id',auth[_0x6609('0xa')](),controller[_0x6609('0xb')]);router[_0x6609('0x7')](_0x6609('0xc'),auth['isAuthenticated'](),controller['getMessages']);router['get'](_0x6609('0xd'),auth[_0x6609('0xa')](),controller['download']);router[_0x6609('0xe')]('/',auth[_0x6609('0xa')](),controller[_0x6609('0xf')]);router[_0x6609('0xe')](_0x6609('0xc'),auth[_0x6609('0xa')](),controller['addMessage']);router['post'](_0x6609('0x10'),auth[_0x6609('0xa')](),interaction[_0x6609('0x11')](_0x6609('0x12'),_0x6609('0x13')),controller['addTags']);router['put']('/:id',auth[_0x6609('0xa')](),interaction['tracked'](_0x6609('0x12'),_0x6609('0x14')),controller['update']);router[_0x6609('0x15')]('/:id',auth[_0x6609('0xa')](),interaction[_0x6609('0x11')](_0x6609('0x12'),_0x6609('0x16')),controller[_0x6609('0x17')]);router['delete'](_0x6609('0x10'),auth['isAuthenticated'](),controller[_0x6609('0x18')]);module[_0x6609('0x19')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index b86dc68..b4d841e 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 _0x1bc6=['STRING','ENUM','out','INTEGER','sequelize','exports','BOOLEAN','DATE'];(function(_0x38a792,_0x5a21a5){var _0x2cee7b=function(_0x3e9555){while(--_0x3e9555){_0x38a792['push'](_0x38a792['shift']());}};_0x2cee7b(++_0x5a21a5);}(_0x1bc6,0x94));var _0x61bc=function(_0x2e123d,_0x38a435){_0x2e123d=_0x2e123d-0x0;var _0xe4188e=_0x1bc6[_0x2e123d];return _0xe4188e;};'use strict';var Sequelize=require(_0x61bc('0x0'));module[_0x61bc('0x1')]={'closed':{'type':Sequelize[_0x61bc('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x61bc('0x3')]},'disposition':{'type':Sequelize[_0x61bc('0x4')]},'secondDisposition':{'type':Sequelize[_0x61bc('0x4')]},'thirdDisposition':{'type':Sequelize[_0x61bc('0x4')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x61bc('0x3')]},'threadId':{'type':Sequelize[_0x61bc('0x4')]},'externalUrl':{'type':Sequelize[_0x61bc('0x4')]},'lastMsgAt':{'type':Sequelize[_0x61bc('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x61bc('0x5')]('in',_0x61bc('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x61bc('0x5')]('in',_0x61bc('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x61bc('0x4')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0x61bc('0x7')]}}; \ No newline at end of file +var _0x58c4=['INTEGER','sequelize','BOOLEAN','DATE','STRING','ENUM','out'];(function(_0x481d5c,_0x521302){var _0x47abb9=function(_0x42f50a){while(--_0x42f50a){_0x481d5c['push'](_0x481d5c['shift']());}};_0x47abb9(++_0x521302);}(_0x58c4,0x135));var _0x458c=function(_0x5da47f,_0x29b51d){_0x5da47f=_0x5da47f-0x0;var _0x59e427=_0x58c4[_0x5da47f];return _0x59e427;};'use strict';var Sequelize=require(_0x458c('0x0'));module['exports']={'closed':{'type':Sequelize[_0x458c('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x458c('0x2')]},'disposition':{'type':Sequelize[_0x458c('0x3')]},'secondDisposition':{'type':Sequelize[_0x458c('0x3')]},'thirdDisposition':{'type':Sequelize[_0x458c('0x3')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize[_0x458c('0x3')]},'externalUrl':{'type':Sequelize[_0x458c('0x3')]},'lastMsgAt':{'type':Sequelize[_0x458c('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x458c('0x4')]('in',_0x458c('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x458c('0x4')]('in',_0x458c('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0x458c('0x6')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index ceb4749..e3b215c 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 _0xc3b1=['params','model','keys','filters','intersection','attributes','fields','length','includeAll','options','find','create','body','describe','addMessage','ids','getMessages','findOne','OpenchannelMessage','nolimit','order','pick','where','OpenchannelInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','merge','include','setTags','omit','Tag','color','openchannelInteractionTags:save','removeTags','download','unix','toString','root','tmp','join','server','files','attachments','format','transcript-%d-%s.zip','push','User','fullname','Contact','firstName','lastName','Attachment','Messages','createdAt','read','Account','get','mkdirSync','Openchannel','Owner','N.A.','closed','closedAt','disposition','threadId','Public','Private','basename','createWriteStream','direction','out','System','renderFile','.pdf','createPdfFromHTML','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','zip-dir','moment','util','ejs','lodash','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','api','../../config/environment','../../mysqldb','redis','./openchannelInteraction.socket','register','sendStatus','status','end','json','undefined','limit','offset','count','Content-Range','update','destroy','then','error','stack','name','send','map','OpenchannelInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','openchannel','user','catch','query','from'];(function(_0x4ef9b5,_0x3ff74e){var _0x382f5e=function(_0xc860b){while(--_0xc860b){_0x4ef9b5['push'](_0x4ef9b5['shift']());}};_0x382f5e(++_0x3ff74e);}(_0xc3b1,0xc9));var _0x1c3b=function(_0x38d37b,_0x437620){_0x38d37b=_0x38d37b-0x0;var _0x47e5f3=_0xc3b1[_0x38d37b];return _0x47e5f3;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x1c3b('0x0'));var moment=require(_0x1c3b('0x1'));var util=require(_0x1c3b('0x2'));var path=require('path');var ejs=require(_0x1c3b('0x3'));var fs=require('fs');var _=require(_0x1c3b('0x4'));var Redis=require('ioredis');var interaction=require(_0x1c3b('0x5'));var qs=require(_0x1c3b('0x6'));var pdf=require(_0x1c3b('0x7'));var logger=require('../../config/logger')(_0x1c3b('0x8'));var config=require(_0x1c3b('0x9'));var db=require(_0x1c3b('0xa'))['db'];config['redis']=_['defaults'](config[_0x1c3b('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1c3b('0xb')]));require(_0x1c3b('0xc'))[_0x1c3b('0xd')](socket);function respondWithStatusCode(_0x542ec3,_0x13d4b5){_0x13d4b5=_0x13d4b5||0xcc;return function(_0x964434){if(_0x964434){return _0x542ec3[_0x1c3b('0xe')](_0x13d4b5);}return _0x542ec3[_0x1c3b('0xf')](_0x13d4b5)[_0x1c3b('0x10')]();};}function respondWithResult(_0x1c90f5,_0x2e6416){_0x2e6416=_0x2e6416||0xc8;return function(_0x381845){if(_0x381845){return _0x1c90f5['status'](_0x2e6416)[_0x1c3b('0x11')](_0x381845);}};}function respondWithFilteredResult(_0x4635e9,_0x2808cd){return function(_0x491cf0){if(_0x491cf0){var _0x170ec0=typeof _0x2808cd['offset']===_0x1c3b('0x12')&&typeof _0x2808cd[_0x1c3b('0x13')]==='undefined';var _0x52c5cb=_0x491cf0['count'];var _0x267c13=_0x170ec0?0x0:_0x2808cd[_0x1c3b('0x14')];var _0x1e32dd=_0x170ec0?_0x491cf0[_0x1c3b('0x15')]:_0x2808cd[_0x1c3b('0x14')]+_0x2808cd[_0x1c3b('0x13')];var _0x34737d;if(_0x1e32dd>=_0x52c5cb){_0x1e32dd=_0x52c5cb;_0x34737d=0xc8;}else{_0x34737d=0xce;}_0x4635e9[_0x1c3b('0xf')](_0x34737d);return _0x4635e9['set'](_0x1c3b('0x16'),_0x267c13+'-'+_0x1e32dd+'/'+_0x52c5cb)[_0x1c3b('0x11')](_0x491cf0);}return null;};}function saveUpdates(_0x180485){return function(_0x1663dc){if(_0x1663dc){return _0x1663dc[_0x1c3b('0x17')](_0x180485)['then'](function(_0x5b3455){return _0x5b3455;});}return null;};}function removeEntity(_0x34b181){return function(_0x483dbc){if(_0x483dbc){return _0x483dbc[_0x1c3b('0x18')]()[_0x1c3b('0x19')](function(){_0x34b181['status'](0xcc)[_0x1c3b('0x10')]();});}};}function handleEntityNotFound(_0x4d9892){return function(_0x601cd8){if(!_0x601cd8){_0x4d9892['sendStatus'](0x194);}return _0x601cd8;};}function handleError(_0x1f508c,_0x236ffe){_0x236ffe=_0x236ffe||0x1f4;return function(_0x491872){logger[_0x1c3b('0x1a')](_0x491872[_0x1c3b('0x1b')]);if(_0x491872[_0x1c3b('0x1c')]){delete _0x491872[_0x1c3b('0x1c')];}_0x1f508c[_0x1c3b('0xf')](_0x236ffe)[_0x1c3b('0x1d')](_0x491872);};}exports['index']=function(_0x3a7470,_0x295142){var _0x48fe20={};var _0x486bfe=_[_0x1c3b('0x1e')](db[_0x1c3b('0x1f')][_0x1c3b('0x20')],function(_0x1077ab){return{'name':_0x1077ab[_0x1c3b('0x21')],'type':_0x1077ab[_0x1c3b('0x22')][_0x1c3b('0x23')]};});_0x48fe20=qs[_0x1c3b('0x24')](_0x486bfe,_0x3a7470);return interaction[_0x1c3b('0x25')](_0x1c3b('0x26'),_0x3a7470['query'],_0x3a7470[_0x1c3b('0x27')],_0x48fe20,_0x486bfe)[_0x1c3b('0x19')](respondWithFilteredResult(_0x295142,_0x48fe20))[_0x1c3b('0x28')](handleError(_0x295142,null));};exports['show']=function(_0x4dcc03,_0x474205){var _0x55acf1={};if(_0x4dcc03['query'][_0x1c3b('0x22')]&&_0x4dcc03[_0x1c3b('0x29')][_0x1c3b('0x22')]===_0x1c3b('0x2a')){_0x55acf1[_0x1c3b('0x2a')]=_0x4dcc03[_0x1c3b('0x2b')]['id'];}else{_0x55acf1['id']=_0x4dcc03[_0x1c3b('0x2b')]['id'];}var _0x54787b={'raw':![],'where':_0x55acf1},_0x4dfa8e={};_0x4dfa8e[_0x1c3b('0x2c')]=_[_0x1c3b('0x2d')](db[_0x1c3b('0x1f')][_0x1c3b('0x20')]);_0x4dfa8e[_0x1c3b('0x29')]=_[_0x1c3b('0x2d')](_0x4dcc03['query']);_0x4dfa8e[_0x1c3b('0x2e')]=_[_0x1c3b('0x2f')](_0x4dfa8e[_0x1c3b('0x2c')],_0x4dfa8e[_0x1c3b('0x29')]);_0x54787b[_0x1c3b('0x30')]=_[_0x1c3b('0x2f')](_0x4dfa8e[_0x1c3b('0x2c')],qs[_0x1c3b('0x31')](_0x4dcc03[_0x1c3b('0x29')][_0x1c3b('0x31')]));_0x54787b['attributes']=_0x54787b[_0x1c3b('0x30')][_0x1c3b('0x32')]?_0x54787b[_0x1c3b('0x30')]:_0x4dfa8e[_0x1c3b('0x2c')];if(_0x4dcc03['query'][_0x1c3b('0x33')]){_0x54787b['include']=[{'all':!![]}];}_0x54787b=_['merge']({},_0x54787b,_0x4dcc03[_0x1c3b('0x34')]);return db[_0x1c3b('0x1f')][_0x1c3b('0x35')](_0x54787b)['then'](handleEntityNotFound(_0x474205,null))[_0x1c3b('0x19')](respondWithResult(_0x474205,null))[_0x1c3b('0x28')](handleError(_0x474205,null));};exports['create']=function(_0x41bfd1,_0x127412){return db[_0x1c3b('0x1f')][_0x1c3b('0x36')](_0x41bfd1[_0x1c3b('0x37')],{})['then'](respondWithResult(_0x127412,0xc9))['catch'](handleError(_0x127412,null));};exports[_0x1c3b('0x17')]=function(_0x5a1fbe,_0x4bf143){if(_0x5a1fbe['body']['id']){delete _0x5a1fbe[_0x1c3b('0x37')]['id'];}return db[_0x1c3b('0x1f')][_0x1c3b('0x35')]({'where':{'id':_0x5a1fbe[_0x1c3b('0x2b')]['id']}})[_0x1c3b('0x19')](handleEntityNotFound(_0x4bf143,null))[_0x1c3b('0x19')](saveUpdates(_0x5a1fbe['body'],null))['then'](respondWithResult(_0x4bf143,null))[_0x1c3b('0x28')](handleError(_0x4bf143,null));};exports[_0x1c3b('0x18')]=function(_0xff6a29,_0x5c9545){return db[_0x1c3b('0x1f')][_0x1c3b('0x35')]({'where':{'id':_0xff6a29[_0x1c3b('0x2b')]['id']}})[_0x1c3b('0x19')](handleEntityNotFound(_0x5c9545,null))['then'](removeEntity(_0x5c9545,null))[_0x1c3b('0x28')](handleError(_0x5c9545,null));};exports[_0x1c3b('0x38')]=function(_0x3262b2,_0x324376){return db[_0x1c3b('0x1f')]['describe']()['then'](respondWithResult(_0x324376,null))[_0x1c3b('0x28')](handleError(_0x324376,null));};exports[_0x1c3b('0x39')]=function(_0x64ac89,_0x4106fa){return db['OpenchannelMessage'][_0x1c3b('0x35')]({'where':{'id':_0x64ac89[_0x1c3b('0x2b')]['id']}})[_0x1c3b('0x19')](handleEntityNotFound(_0x4106fa,null))[_0x1c3b('0x19')](function(_0x5c7daf){if(_0x5c7daf){return _0x5c7daf[_0x1c3b('0x39')](_0x64ac89[_0x1c3b('0x37')]['ids'],_['omit'](_0x64ac89[_0x1c3b('0x37')],[_0x1c3b('0x3a'),'id'])||{});}})[_0x1c3b('0x19')](respondWithResult(_0x4106fa,null))[_0x1c3b('0x28')](handleError(_0x4106fa,null));};exports[_0x1c3b('0x3b')]=function(_0x218b0d,_0x518c2f){var _0x5b27b2={'raw':![],'where':{}};var _0x1344bb={};var _0x50fc72={'count':0x0,'rows':[]};return db[_0x1c3b('0x1f')][_0x1c3b('0x3c')]({'where':{'id':_0x218b0d['params']['id']}})[_0x1c3b('0x19')](handleEntityNotFound(_0x518c2f,null))[_0x1c3b('0x19')](function(_0x5d85dc){if(_0x5d85dc){_0x1344bb[_0x1c3b('0x2c')]=_[_0x1c3b('0x2d')](db[_0x1c3b('0x3d')][_0x1c3b('0x20')]);_0x1344bb[_0x1c3b('0x29')]=_[_0x1c3b('0x2d')](_0x218b0d['query']);_0x1344bb['filters']=_['intersection'](_0x1344bb[_0x1c3b('0x2c')],_0x1344bb['query']);_0x5b27b2[_0x1c3b('0x30')]=_[_0x1c3b('0x2f')](_0x1344bb[_0x1c3b('0x2c')],qs[_0x1c3b('0x31')](_0x218b0d[_0x1c3b('0x29')]['fields']));_0x5b27b2[_0x1c3b('0x30')]=_0x5b27b2[_0x1c3b('0x30')][_0x1c3b('0x32')]?_0x5b27b2['attributes']:_0x1344bb[_0x1c3b('0x2c')];if(!_0x218b0d['query']['hasOwnProperty'](_0x1c3b('0x3e'))){_0x5b27b2[_0x1c3b('0x13')]=qs[_0x1c3b('0x13')](_0x218b0d[_0x1c3b('0x29')][_0x1c3b('0x13')]);_0x5b27b2['offset']=qs[_0x1c3b('0x14')](_0x218b0d[_0x1c3b('0x29')][_0x1c3b('0x14')]);}_0x5b27b2[_0x1c3b('0x3f')]=qs['sort'](_0x218b0d[_0x1c3b('0x29')]['sort']);_0x5b27b2['where']=qs['filters'](_[_0x1c3b('0x40')](_0x218b0d['query'],_0x1344bb[_0x1c3b('0x2e')]));_0x5b27b2[_0x1c3b('0x41')][_0x1c3b('0x42')]=_0x5d85dc['id'];if(_0x218b0d[_0x1c3b('0x29')][_0x1c3b('0x43')]){_0x5b27b2[_0x1c3b('0x41')]=_['merge'](_0x5b27b2['where'],{'$or':_[_0x1c3b('0x1e')](_0x5b27b2[_0x1c3b('0x30')],function(_0x88dd63){var _0x25290a={};_0x25290a[_0x88dd63]={'$like':'%'+_0x218b0d[_0x1c3b('0x29')][_0x1c3b('0x43')]+'%'};return _0x25290a;})});}if(_0x218b0d[_0x1c3b('0x29')]['$gte']){var _0x4a2905=_0x218b0d[_0x1c3b('0x29')][_0x1c3b('0x44')][_0x1c3b('0x45')](',');var _0x4d0e1f={};_0x4d0e1f[_0x4a2905[0x0]]={'$gte':moment(_0x4a2905[0x1])['format'](_0x1c3b('0x46'))};_0x5b27b2[_0x1c3b('0x41')]=_[_0x1c3b('0x47')](_0x5b27b2[_0x1c3b('0x41')],_0x4d0e1f);}_0x5b27b2=_[_0x1c3b('0x47')]({},_0x5b27b2,_0x218b0d[_0x1c3b('0x34')]);return db['OpenchannelMessage'][_0x1c3b('0x15')]({'where':_0x5b27b2[_0x1c3b('0x41')]})['then'](function(_0x38bbbe){_0x50fc72[_0x1c3b('0x15')]=_0x38bbbe;if(_0x218b0d[_0x1c3b('0x29')][_0x1c3b('0x33')]){_0x5b27b2[_0x1c3b('0x48')]=[{'all':!![]}];}return db[_0x1c3b('0x3d')][_0x1c3b('0x25')](_0x5b27b2);})[_0x1c3b('0x19')](function(_0x2eef42){_0x50fc72['rows']=_0x2eef42;return _0x50fc72;});}})[_0x1c3b('0x19')](respondWithFilteredResult(_0x518c2f,_0x5b27b2))[_0x1c3b('0x28')](handleError(_0x518c2f,null));};exports['addTags']=function(_0x59cea0,_0x135a83){return db['OpenchannelInteraction'][_0x1c3b('0x35')]({'where':{'id':_0x59cea0[_0x1c3b('0x2b')]['id']}})[_0x1c3b('0x19')](handleEntityNotFound(_0x135a83,null))[_0x1c3b('0x19')](function(_0x5ac5e4){if(_0x5ac5e4){return _0x5ac5e4[_0x1c3b('0x49')](_0x59cea0['body'][_0x1c3b('0x3a')],_[_0x1c3b('0x4a')](_0x59cea0[_0x1c3b('0x37')],[_0x1c3b('0x3a'),'id'])||{})['spread'](function(){return db[_0x1c3b('0x4b')][_0x1c3b('0x25')]({'attributes':['id',_0x1c3b('0x1c'),_0x1c3b('0x4c')],'where':{'id':_0x59cea0[_0x1c3b('0x37')][_0x1c3b('0x3a')]}});})[_0x1c3b('0x19')](function(_0x1963e9){socket['emit'](_0x1c3b('0x4d'),{'id':Number(_0x59cea0['params']['id']),'tags':_0x1963e9||[]});return{'id':Number(_0x59cea0[_0x1c3b('0x2b')]['id']),'tags':_0x1963e9||[]};});}})[_0x1c3b('0x19')](respondWithResult(_0x135a83,null))[_0x1c3b('0x28')](handleError(_0x135a83,null));};exports[_0x1c3b('0x4e')]=function(_0xe94ca3,_0x5113c9){return db[_0x1c3b('0x1f')][_0x1c3b('0x35')]({'where':{'id':_0xe94ca3['params']['id']}})[_0x1c3b('0x19')](handleEntityNotFound(_0x5113c9,null))[_0x1c3b('0x19')](function(_0x331e62){if(_0x331e62){return _0x331e62[_0x1c3b('0x4e')](_0xe94ca3['query'][_0x1c3b('0x3a')]);}})[_0x1c3b('0x19')](respondWithStatusCode(_0x5113c9,null))[_0x1c3b('0x28')](handleError(_0x5113c9,null));};exports[_0x1c3b('0x4f')]=function(_0x395d31,_0x2ec7fc){var _0x1240a8=moment()[_0x1c3b('0x50')]()[_0x1c3b('0x51')]();var _0x5429e9=path['join'](config[_0x1c3b('0x52')],'server','files',_0x1c3b('0x53'));var _0x214292=path[_0x1c3b('0x54')](config[_0x1c3b('0x52')],_0x1c3b('0x55'),_0x1c3b('0x56'),_0x1c3b('0x57'));var _0x3e73dc=path['join'](_0x5429e9,_0x1240a8);var _0x161744=util[_0x1c3b('0x58')](_0x1c3b('0x59'),_0x395d31[_0x1c3b('0x2b')]['id'],_0x1240a8);var _0x5eb80d=path[_0x1c3b('0x54')](_0x5429e9,_0x161744);var _0x56777f=[];_0x56777f[_0x1c3b('0x5a')]({'model':db[_0x1c3b('0x5b')],'as':'User','attributes':['id',_0x1c3b('0x5c')],'raw':!![]});_0x56777f[_0x1c3b('0x5a')]({'model':db['CmContact'],'as':_0x1c3b('0x5d'),'attributes':['id',_0x1c3b('0x5e'),_0x1c3b('0x5f')],'raw':!![]});if(_0x395d31[_0x1c3b('0x29')][_0x1c3b('0x57')]){_0x56777f[_0x1c3b('0x5a')]({'model':db[_0x1c3b('0x60')],'as':'Attachment','raw':!![]});}var _0x237e6d=[{'model':db[_0x1c3b('0x3d')],'as':_0x1c3b('0x61'),'attributes':['id',_0x1c3b('0x37'),_0x1c3b('0x62'),'direction','secret',_0x1c3b('0x63')],'include':_0x56777f}];_0x237e6d[_0x1c3b('0x5a')]({'model':db['OpenchannelAccount'],'as':_0x1c3b('0x64'),'attributes':['id',_0x1c3b('0x1c')]});_0x237e6d['push']({'model':db[_0x1c3b('0x5b')],'as':'Owner','attributes':['id','fullname']});return db[_0x1c3b('0x1f')][_0x1c3b('0x35')]({'where':{'id':_0x395d31['params']['id']},'include':_0x237e6d})[_0x1c3b('0x19')](handleEntityNotFound(_0x2ec7fc,null))[_0x1c3b('0x19')](function(_0x4d8804){if(_0x4d8804){var _0x35731e=_0x4d8804[_0x1c3b('0x65')]({'plain':!![]});fs[_0x1c3b('0x66')](_0x3e73dc);var _0x422306={'channel':_0x1c3b('0x67'),'account':_0x35731e['Account'][_0x1c3b('0x1c')],'agent':_0x35731e[_0x1c3b('0x68')]?_0x35731e[_0x1c3b('0x68')][_0x1c3b('0x5c')]:_0x1c3b('0x69'),'createdAt':moment(_0x35731e['createdAt'])[_0x1c3b('0x58')](_0x1c3b('0x46'))['toString'](),'closedAt':_0x35731e[_0x1c3b('0x6a')]?moment(_0x35731e[_0x1c3b('0x6b')])[_0x1c3b('0x58')]('YYYY-MM-DD\x20HH:mm:ss')[_0x1c3b('0x51')]():'','disposition':_0x35731e[_0x1c3b('0x6c')],'visibility':_0x35731e[_0x1c3b('0x6d')]?_0x1c3b('0x6e'):_0x1c3b('0x6f'),'messages':_(_0x35731e['Messages'])[_0x1c3b('0x43')]({'secret':![]})[_0x1c3b('0x1e')](function(_0x57f1d8){if(_0x57f1d8[_0x1c3b('0x60')]){var _0x32686d=path[_0x1c3b('0x54')](_0x214292,_0x57f1d8[_0x1c3b('0x60')][_0x1c3b('0x70')]);if(fs['existsSync'](_0x32686d)){fs['createReadStream'](_0x32686d)['pipe'](fs[_0x1c3b('0x71')](path[_0x1c3b('0x54')](_0x3e73dc,_0x57f1d8[_0x1c3b('0x60')]['basename'])));}}return{'date':moment(_0x57f1d8['createdAt'])[_0x1c3b('0x58')](_0x1c3b('0x46'))['toString'](),'sender':_0x57f1d8[_0x1c3b('0x72')]===_0x1c3b('0x73')?_0x57f1d8[_0x1c3b('0x5b')]?_0x57f1d8['User'][_0x1c3b('0x5c')]:_0x1c3b('0x74'):_0x57f1d8[_0x1c3b('0x5d')][_0x1c3b('0x5e')]+(_0x57f1d8[_0x1c3b('0x5d')][_0x1c3b('0x5f')]?'\x20'+_0x57f1d8[_0x1c3b('0x5d')][_0x1c3b('0x5f')]:''),'body':_0x57f1d8['Attachment']?_0x57f1d8[_0x1c3b('0x60')]['basename']:_0x57f1d8['body'],'direction':_0x57f1d8[_0x1c3b('0x72')]===_0x1c3b('0x73')?'A':'C','secret':_0x57f1d8['secret'],'read':_0x57f1d8['read'],'attachment':_0x57f1d8['Attachment']};})['value']()};return ejs[_0x1c3b('0x75')](path[_0x1c3b('0x54')](config[_0x1c3b('0x52')],_0x1c3b('0x55'),'views','downloadInteraction.ejs'),{'interaction':_0x422306})['then'](function(_0x54dea3){var _0x5de6cd=path['join'](_0x3e73dc,'transcript-'+_0x35731e['id']+'-'+_0x1240a8+_0x1c3b('0x76'));var _0x52f44c={'path':_0x5de6cd,'channel':_0x1c3b('0x67'),'interactionId':_0x35731e['id']};return pdf[_0x1c3b('0x77')](_0x54dea3,_0x52f44c);})[_0x1c3b('0x19')](function(){return new Promise(function(_0x50e50e,_0x5ccbce){zipdir(_0x3e73dc,{'saveTo':_0x5eb80d},function(_0x118167,_0x67c516){if(_0x118167)return _0x5ccbce(_0x118167);return _0x50e50e(_0x67c516);});})[_0x1c3b('0x19')](function(){return new Promise(function(_0x1ae01c,_0x445cbc){rimraf(_0x3e73dc,function(_0x5f206d){if(_0x5f206d)_0x445cbc(_0x5f206d);return _0x1ae01c();});});})[_0x1c3b('0x19')](function(){return _0x2ec7fc[_0x1c3b('0x4f')](_0x5eb80d,_0x161744,function(_0x2afffb){if(_0x2afffb){logger['error'](_0x1c3b('0x78'),_0x2afffb);}else{fs[_0x1c3b('0x79')](_0x5eb80d);}});});});}else{return _0x2ec7fc[_0x1c3b('0xe')](0xc8);}})[_0x1c3b('0x28')](handleError(_0x2ec7fc,null));}; \ No newline at end of file +var _0x495e=['unix','toString','join','root','server','tmp','files','attachments','transcript-%d-%s.zip','push','User','CmContact','Contact','lastName','Attachment','Messages','createdAt','direction','read','OpenchannelAccount','Account','Owner','fullname','get','Openchannel','N.A.','closed','disposition','Public','existsSync','createReadStream','pipe','basename','out','value','renderFile','downloadInteraction.ejs','.pdf','createPdfFromHTML','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','rimraf','zip-dir','moment','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','destroy','then','stack','name','send','index','map','OpenchannelInteraction','rawAttributes','fieldName','key','findAll','openchannel','query','user','catch','show','type','from','params','model','filters','attributes','intersection','fields','includeAll','include','options','find','create','body','describe','addMessage','OpenchannelMessage','ids','omit','getMessages','findOne','keys','length','hasOwnProperty','order','sort','pick','where','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','merge','rows','setTags','spread','removeTags','download'];(function(_0x56fa48,_0x24b172){var _0x415f95=function(_0x3039aa){while(--_0x3039aa){_0x56fa48['push'](_0x56fa48['shift']());}};_0x415f95(++_0x24b172);}(_0x495e,0x1ac));var _0xe495=function(_0x4dcc2d,_0x422839){_0x4dcc2d=_0x4dcc2d-0x0;var _0x1bbd79=_0x495e[_0x4dcc2d];return _0x1bbd79;};'use strict';var rimraf=require(_0xe495('0x0'));var zipdir=require(_0xe495('0x1'));var moment=require(_0xe495('0x2'));var util=require(_0xe495('0x3'));var path=require(_0xe495('0x4'));var ejs=require(_0xe495('0x5'));var fs=require('fs');var _=require(_0xe495('0x6'));var Redis=require(_0xe495('0x7'));var interaction=require(_0xe495('0x8'));var qs=require(_0xe495('0x9'));var pdf=require(_0xe495('0xa'));var logger=require(_0xe495('0xb'))(_0xe495('0xc'));var config=require(_0xe495('0xd'));var db=require(_0xe495('0xe'))['db'];config['redis']=_[_0xe495('0xf')](config[_0xe495('0x10')],{'host':_0xe495('0x11'),'port':0x18eb});var socket=require(_0xe495('0x12'))(new Redis(config[_0xe495('0x10')]));require(_0xe495('0x13'))[_0xe495('0x14')](socket);function respondWithStatusCode(_0x283900,_0x426a58){_0x426a58=_0x426a58||0xcc;return function(_0xfef889){if(_0xfef889){return _0x283900[_0xe495('0x15')](_0x426a58);}return _0x283900[_0xe495('0x16')](_0x426a58)[_0xe495('0x17')]();};}function respondWithResult(_0x31f440,_0x11f9cb){_0x11f9cb=_0x11f9cb||0xc8;return function(_0x25c577){if(_0x25c577){return _0x31f440[_0xe495('0x16')](_0x11f9cb)[_0xe495('0x18')](_0x25c577);}};}function respondWithFilteredResult(_0x441d24,_0x50e8d5){return function(_0x518f48){if(_0x518f48){var _0x48d48c=typeof _0x50e8d5[_0xe495('0x19')]===_0xe495('0x1a')&&typeof _0x50e8d5[_0xe495('0x1b')]===_0xe495('0x1a');var _0x4181d8=_0x518f48['count'];var _0x2ceca2=_0x48d48c?0x0:_0x50e8d5['offset'];var _0x4abaac=_0x48d48c?_0x518f48[_0xe495('0x1c')]:_0x50e8d5[_0xe495('0x19')]+_0x50e8d5[_0xe495('0x1b')];var _0x199501;if(_0x4abaac>=_0x4181d8){_0x4abaac=_0x4181d8;_0x199501=0xc8;}else{_0x199501=0xce;}_0x441d24[_0xe495('0x16')](_0x199501);return _0x441d24[_0xe495('0x1d')](_0xe495('0x1e'),_0x2ceca2+'-'+_0x4abaac+'/'+_0x4181d8)['json'](_0x518f48);}return null;};}function saveUpdates(_0x82f05b){return function(_0x2dc837){if(_0x2dc837){return _0x2dc837[_0xe495('0x1f')](_0x82f05b)['then'](function(_0x474410){return _0x474410;});}return null;};}function removeEntity(_0x58d078){return function(_0x1c62e6){if(_0x1c62e6){return _0x1c62e6[_0xe495('0x20')]()[_0xe495('0x21')](function(){_0x58d078[_0xe495('0x16')](0xcc)[_0xe495('0x17')]();});}};}function handleEntityNotFound(_0x460953){return function(_0xae60f9){if(!_0xae60f9){_0x460953[_0xe495('0x15')](0x194);}return _0xae60f9;};}function handleError(_0x5eb335,_0x5810e5){_0x5810e5=_0x5810e5||0x1f4;return function(_0x13ed37){logger['error'](_0x13ed37[_0xe495('0x22')]);if(_0x13ed37[_0xe495('0x23')]){delete _0x13ed37[_0xe495('0x23')];}_0x5eb335[_0xe495('0x16')](_0x5810e5)[_0xe495('0x24')](_0x13ed37);};}exports[_0xe495('0x25')]=function(_0xc57f36,_0x4fc76a){var _0x5745f4={};var _0x608596=_[_0xe495('0x26')](db[_0xe495('0x27')][_0xe495('0x28')],function(_0x1817c7){return{'name':_0x1817c7[_0xe495('0x29')],'type':_0x1817c7['type'][_0xe495('0x2a')]};});_0x5745f4=qs['getOptions'](_0x608596,_0xc57f36);return interaction[_0xe495('0x2b')](_0xe495('0x2c'),_0xc57f36[_0xe495('0x2d')],_0xc57f36[_0xe495('0x2e')],_0x5745f4,_0x608596)[_0xe495('0x21')](respondWithFilteredResult(_0x4fc76a,_0x5745f4))[_0xe495('0x2f')](handleError(_0x4fc76a,null));};exports[_0xe495('0x30')]=function(_0x50d70e,_0x734899){var _0x5b9126={};if(_0x50d70e[_0xe495('0x2d')][_0xe495('0x31')]&&_0x50d70e[_0xe495('0x2d')][_0xe495('0x31')]==='from'){_0x5b9126[_0xe495('0x32')]=_0x50d70e[_0xe495('0x33')]['id'];}else{_0x5b9126['id']=_0x50d70e[_0xe495('0x33')]['id'];}var _0x1124f6={'raw':![],'where':_0x5b9126},_0x2d6ce2={};_0x2d6ce2[_0xe495('0x34')]=_['keys'](db[_0xe495('0x27')][_0xe495('0x28')]);_0x2d6ce2[_0xe495('0x2d')]=_['keys'](_0x50d70e[_0xe495('0x2d')]);_0x2d6ce2[_0xe495('0x35')]=_['intersection'](_0x2d6ce2[_0xe495('0x34')],_0x2d6ce2[_0xe495('0x2d')]);_0x1124f6[_0xe495('0x36')]=_[_0xe495('0x37')](_0x2d6ce2[_0xe495('0x34')],qs[_0xe495('0x38')](_0x50d70e[_0xe495('0x2d')]['fields']));_0x1124f6[_0xe495('0x36')]=_0x1124f6[_0xe495('0x36')]['length']?_0x1124f6[_0xe495('0x36')]:_0x2d6ce2[_0xe495('0x34')];if(_0x50d70e['query'][_0xe495('0x39')]){_0x1124f6[_0xe495('0x3a')]=[{'all':!![]}];}_0x1124f6=_['merge']({},_0x1124f6,_0x50d70e[_0xe495('0x3b')]);return db['OpenchannelInteraction'][_0xe495('0x3c')](_0x1124f6)[_0xe495('0x21')](handleEntityNotFound(_0x734899,null))[_0xe495('0x21')](respondWithResult(_0x734899,null))[_0xe495('0x2f')](handleError(_0x734899,null));};exports['create']=function(_0x303ecf,_0x21cb14){return db[_0xe495('0x27')][_0xe495('0x3d')](_0x303ecf['body'],{})[_0xe495('0x21')](respondWithResult(_0x21cb14,0xc9))['catch'](handleError(_0x21cb14,null));};exports[_0xe495('0x1f')]=function(_0x452d48,_0x33ce94){if(_0x452d48[_0xe495('0x3e')]['id']){delete _0x452d48['body']['id'];}return db[_0xe495('0x27')][_0xe495('0x3c')]({'where':{'id':_0x452d48[_0xe495('0x33')]['id']}})[_0xe495('0x21')](handleEntityNotFound(_0x33ce94,null))[_0xe495('0x21')](saveUpdates(_0x452d48[_0xe495('0x3e')],null))[_0xe495('0x21')](respondWithResult(_0x33ce94,null))[_0xe495('0x2f')](handleError(_0x33ce94,null));};exports[_0xe495('0x20')]=function(_0x5412ad,_0x54e2c){return db['OpenchannelInteraction'][_0xe495('0x3c')]({'where':{'id':_0x5412ad[_0xe495('0x33')]['id']}})[_0xe495('0x21')](handleEntityNotFound(_0x54e2c,null))[_0xe495('0x21')](removeEntity(_0x54e2c,null))[_0xe495('0x2f')](handleError(_0x54e2c,null));};exports[_0xe495('0x3f')]=function(_0xc898af,_0x25bb7a){return db[_0xe495('0x27')][_0xe495('0x3f')]()[_0xe495('0x21')](respondWithResult(_0x25bb7a,null))[_0xe495('0x2f')](handleError(_0x25bb7a,null));};exports[_0xe495('0x40')]=function(_0x44d95e,_0x455cb0){return db[_0xe495('0x41')]['find']({'where':{'id':_0x44d95e['params']['id']}})['then'](handleEntityNotFound(_0x455cb0,null))[_0xe495('0x21')](function(_0x1bcbc9){if(_0x1bcbc9){return _0x1bcbc9[_0xe495('0x40')](_0x44d95e['body'][_0xe495('0x42')],_[_0xe495('0x43')](_0x44d95e[_0xe495('0x3e')],[_0xe495('0x42'),'id'])||{});}})[_0xe495('0x21')](respondWithResult(_0x455cb0,null))[_0xe495('0x2f')](handleError(_0x455cb0,null));};exports[_0xe495('0x44')]=function(_0xf00eb8,_0x2b959d){var _0x47aaf0={'raw':![],'where':{}};var _0x6b228d={};var _0x4b361a={'count':0x0,'rows':[]};return db[_0xe495('0x27')][_0xe495('0x45')]({'where':{'id':_0xf00eb8[_0xe495('0x33')]['id']}})[_0xe495('0x21')](handleEntityNotFound(_0x2b959d,null))['then'](function(_0x1d2d70){if(_0x1d2d70){_0x6b228d[_0xe495('0x34')]=_[_0xe495('0x46')](db[_0xe495('0x41')][_0xe495('0x28')]);_0x6b228d['query']=_[_0xe495('0x46')](_0xf00eb8[_0xe495('0x2d')]);_0x6b228d['filters']=_[_0xe495('0x37')](_0x6b228d['model'],_0x6b228d[_0xe495('0x2d')]);_0x47aaf0[_0xe495('0x36')]=_[_0xe495('0x37')](_0x6b228d[_0xe495('0x34')],qs[_0xe495('0x38')](_0xf00eb8[_0xe495('0x2d')][_0xe495('0x38')]));_0x47aaf0[_0xe495('0x36')]=_0x47aaf0[_0xe495('0x36')][_0xe495('0x47')]?_0x47aaf0[_0xe495('0x36')]:_0x6b228d[_0xe495('0x34')];if(!_0xf00eb8['query'][_0xe495('0x48')]('nolimit')){_0x47aaf0['limit']=qs[_0xe495('0x1b')](_0xf00eb8[_0xe495('0x2d')][_0xe495('0x1b')]);_0x47aaf0[_0xe495('0x19')]=qs['offset'](_0xf00eb8[_0xe495('0x2d')][_0xe495('0x19')]);}_0x47aaf0[_0xe495('0x49')]=qs[_0xe495('0x4a')](_0xf00eb8[_0xe495('0x2d')][_0xe495('0x4a')]);_0x47aaf0['where']=qs[_0xe495('0x35')](_[_0xe495('0x4b')](_0xf00eb8[_0xe495('0x2d')],_0x6b228d['filters']));_0x47aaf0[_0xe495('0x4c')]['OpenchannelInteractionId']=_0x1d2d70['id'];if(_0xf00eb8[_0xe495('0x2d')][_0xe495('0x4d')]){_0x47aaf0[_0xe495('0x4c')]=_['merge'](_0x47aaf0[_0xe495('0x4c')],{'$or':_[_0xe495('0x26')](_0x47aaf0['attributes'],function(_0x1066a3){var _0x559d15={};_0x559d15[_0x1066a3]={'$like':'%'+_0xf00eb8['query'][_0xe495('0x4d')]+'%'};return _0x559d15;})});}if(_0xf00eb8[_0xe495('0x2d')][_0xe495('0x4e')]){var _0x3ea798=_0xf00eb8[_0xe495('0x2d')][_0xe495('0x4e')][_0xe495('0x4f')](',');var _0x4e10a4={};_0x4e10a4[_0x3ea798[0x0]]={'$gte':moment(_0x3ea798[0x1])[_0xe495('0x50')](_0xe495('0x51'))};_0x47aaf0[_0xe495('0x4c')]=_['merge'](_0x47aaf0[_0xe495('0x4c')],_0x4e10a4);}_0x47aaf0=_[_0xe495('0x52')]({},_0x47aaf0,_0xf00eb8[_0xe495('0x3b')]);return db[_0xe495('0x41')][_0xe495('0x1c')]({'where':_0x47aaf0[_0xe495('0x4c')]})[_0xe495('0x21')](function(_0xfb5ac5){_0x4b361a[_0xe495('0x1c')]=_0xfb5ac5;if(_0xf00eb8['query'][_0xe495('0x39')]){_0x47aaf0[_0xe495('0x3a')]=[{'all':!![]}];}return db[_0xe495('0x41')]['findAll'](_0x47aaf0);})['then'](function(_0x599e2c){_0x4b361a[_0xe495('0x53')]=_0x599e2c;return _0x4b361a;});}})[_0xe495('0x21')](respondWithFilteredResult(_0x2b959d,_0x47aaf0))[_0xe495('0x2f')](handleError(_0x2b959d,null));};exports['addTags']=function(_0x115299,_0x464920){return db[_0xe495('0x27')]['find']({'where':{'id':_0x115299[_0xe495('0x33')]['id']}})[_0xe495('0x21')](handleEntityNotFound(_0x464920,null))[_0xe495('0x21')](function(_0x404462){if(_0x404462){return _0x404462[_0xe495('0x54')](_0x115299['body'][_0xe495('0x42')],_[_0xe495('0x43')](_0x115299[_0xe495('0x3e')],[_0xe495('0x42'),'id'])||{})[_0xe495('0x55')](function(){return db['Tag'][_0xe495('0x2b')]({'attributes':['id',_0xe495('0x23'),'color'],'where':{'id':_0x115299[_0xe495('0x3e')][_0xe495('0x42')]}});})[_0xe495('0x21')](function(_0x203475){socket['emit']('openchannelInteractionTags:save',{'id':Number(_0x115299['params']['id']),'tags':_0x203475||[]});return{'id':Number(_0x115299['params']['id']),'tags':_0x203475||[]};});}})[_0xe495('0x21')](respondWithResult(_0x464920,null))[_0xe495('0x2f')](handleError(_0x464920,null));};exports['removeTags']=function(_0x557dbc,_0x4d2c84){return db[_0xe495('0x27')][_0xe495('0x3c')]({'where':{'id':_0x557dbc['params']['id']}})[_0xe495('0x21')](handleEntityNotFound(_0x4d2c84,null))[_0xe495('0x21')](function(_0x5bdb5e){if(_0x5bdb5e){return _0x5bdb5e[_0xe495('0x56')](_0x557dbc['query'][_0xe495('0x42')]);}})[_0xe495('0x21')](respondWithStatusCode(_0x4d2c84,null))[_0xe495('0x2f')](handleError(_0x4d2c84,null));};exports[_0xe495('0x57')]=function(_0x31e74b,_0x272a24){var _0x12ded1=moment()[_0xe495('0x58')]()[_0xe495('0x59')]();var _0x13cf70=path[_0xe495('0x5a')](config[_0xe495('0x5b')],_0xe495('0x5c'),'files',_0xe495('0x5d'));var _0x15ff55=path[_0xe495('0x5a')](config[_0xe495('0x5b')],'server',_0xe495('0x5e'),_0xe495('0x5f'));var _0x145241=path['join'](_0x13cf70,_0x12ded1);var _0x3f6bef=util['format'](_0xe495('0x60'),_0x31e74b['params']['id'],_0x12ded1);var _0x3d0a94=path['join'](_0x13cf70,_0x3f6bef);var _0x48727c=[];_0x48727c[_0xe495('0x61')]({'model':db['User'],'as':_0xe495('0x62'),'attributes':['id','fullname'],'raw':!![]});_0x48727c['push']({'model':db[_0xe495('0x63')],'as':_0xe495('0x64'),'attributes':['id','firstName',_0xe495('0x65')],'raw':!![]});if(_0x31e74b[_0xe495('0x2d')]['attachments']){_0x48727c[_0xe495('0x61')]({'model':db['Attachment'],'as':_0xe495('0x66'),'raw':!![]});}var _0x23636f=[{'model':db[_0xe495('0x41')],'as':_0xe495('0x67'),'attributes':['id',_0xe495('0x3e'),_0xe495('0x68'),_0xe495('0x69'),'secret',_0xe495('0x6a')],'include':_0x48727c}];_0x23636f[_0xe495('0x61')]({'model':db[_0xe495('0x6b')],'as':_0xe495('0x6c'),'attributes':['id',_0xe495('0x23')]});_0x23636f[_0xe495('0x61')]({'model':db['User'],'as':_0xe495('0x6d'),'attributes':['id',_0xe495('0x6e')]});return db[_0xe495('0x27')][_0xe495('0x3c')]({'where':{'id':_0x31e74b[_0xe495('0x33')]['id']},'include':_0x23636f})['then'](handleEntityNotFound(_0x272a24,null))[_0xe495('0x21')](function(_0x4dafcc){if(_0x4dafcc){var _0x1784e4=_0x4dafcc[_0xe495('0x6f')]({'plain':!![]});fs['mkdirSync'](_0x145241);var _0x346148={'channel':_0xe495('0x70'),'account':_0x1784e4[_0xe495('0x6c')][_0xe495('0x23')],'agent':_0x1784e4['Owner']?_0x1784e4['Owner'][_0xe495('0x6e')]:_0xe495('0x71'),'createdAt':moment(_0x1784e4['createdAt'])[_0xe495('0x50')](_0xe495('0x51'))[_0xe495('0x59')](),'closedAt':_0x1784e4[_0xe495('0x72')]?moment(_0x1784e4['closedAt'])[_0xe495('0x50')]('YYYY-MM-DD\x20HH:mm:ss')[_0xe495('0x59')]():'','disposition':_0x1784e4[_0xe495('0x73')],'visibility':_0x1784e4['threadId']?_0xe495('0x74'):'Private','messages':_(_0x1784e4[_0xe495('0x67')])['filter']({'secret':![]})[_0xe495('0x26')](function(_0x5c3f9b){if(_0x5c3f9b['Attachment']){var _0x355085=path[_0xe495('0x5a')](_0x15ff55,_0x5c3f9b[_0xe495('0x66')]['basename']);if(fs[_0xe495('0x75')](_0x355085)){fs[_0xe495('0x76')](_0x355085)[_0xe495('0x77')](fs['createWriteStream'](path[_0xe495('0x5a')](_0x145241,_0x5c3f9b[_0xe495('0x66')][_0xe495('0x78')])));}}return{'date':moment(_0x5c3f9b[_0xe495('0x68')])[_0xe495('0x50')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x5c3f9b['direction']===_0xe495('0x79')?_0x5c3f9b[_0xe495('0x62')]?_0x5c3f9b[_0xe495('0x62')][_0xe495('0x6e')]:'System':_0x5c3f9b[_0xe495('0x64')]['firstName']+(_0x5c3f9b[_0xe495('0x64')][_0xe495('0x65')]?'\x20'+_0x5c3f9b[_0xe495('0x64')][_0xe495('0x65')]:''),'body':_0x5c3f9b['Attachment']?_0x5c3f9b['Attachment'][_0xe495('0x78')]:_0x5c3f9b[_0xe495('0x3e')],'direction':_0x5c3f9b[_0xe495('0x69')]===_0xe495('0x79')?'A':'C','secret':_0x5c3f9b['secret'],'read':_0x5c3f9b['read'],'attachment':_0x5c3f9b[_0xe495('0x66')]};})[_0xe495('0x7a')]()};return ejs[_0xe495('0x7b')](path['join'](config[_0xe495('0x5b')],_0xe495('0x5c'),'views',_0xe495('0x7c')),{'interaction':_0x346148})[_0xe495('0x21')](function(_0x397410){var _0x42c734=path[_0xe495('0x5a')](_0x145241,'transcript-'+_0x1784e4['id']+'-'+_0x12ded1+_0xe495('0x7d'));var _0x4f76a2={'path':_0x42c734,'channel':_0xe495('0x70'),'interactionId':_0x1784e4['id']};return pdf[_0xe495('0x7e')](_0x397410,_0x4f76a2);})[_0xe495('0x21')](function(){return new Promise(function(_0x55a54e,_0x1ca43c){zipdir(_0x145241,{'saveTo':_0x3d0a94},function(_0x156eb9,_0x46812e){if(_0x156eb9)return _0x1ca43c(_0x156eb9);return _0x55a54e(_0x46812e);});})['then'](function(){return new Promise(function(_0xf013bf,_0x14a352){rimraf(_0x145241,function(_0x420eed){if(_0x420eed)_0x14a352(_0x420eed);return _0xf013bf();});});})[_0xe495('0x21')](function(){return _0x272a24['download'](_0x3d0a94,_0x3f6bef,function(_0x5e2d1a){if(_0x5e2d1a){logger['error'](_0xe495('0x7f'),_0x5e2d1a);}else{fs[_0xe495('0x80')](_0x3d0a94);}});});});}else{return _0x272a24[_0xe495('0x15')](0xc8);}})['catch'](handleError(_0x272a24,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 77282c0..101364e 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 _0x00f2=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelInteraction','setMaxListeners','save','update','getUsers','Users','findAll','then','setDataValue'];(function(_0x3b51b4,_0x178d9d){var _0x1bcb5a=function(_0x2aec8d){while(--_0x2aec8d){_0x3b51b4['push'](_0x3b51b4['shift']());}};_0x1bcb5a(++_0x178d9d);}(_0x00f2,0x16c));var _0x200f=function(_0x3a2969,_0x7ea140){_0x3a2969=_0x3a2969-0x0;var _0x509520=_0x00f2[_0x3a2969];return _0x509520;};'use strict';var EventEmitter=require(_0x200f('0x0'));var OpenchannelInteraction=require(_0x200f('0x1'))['db'][_0x200f('0x2')];var OpenchannelMessage=require(_0x200f('0x1'))['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x200f('0x3')](0x0);var events={'afterCreate':_0x200f('0x4'),'afterUpdate':_0x200f('0x5'),'afterDestroy':'remove'};function emitEvent(_0x281c11){return function(_0xb8511d,_0xdf0d60,_0x25f539){_0xb8511d[_0x200f('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x238343){_0xb8511d['setDataValue'](_0x200f('0x7'),_0x238343['map'](function(_0x2553fd){return{'id':_0x2553fd['id']};}));return OpenchannelMessage[_0x200f('0x8')]({'where':{'OpenchannelInteractionId':_0xb8511d['id'],'direction':'in','read':![]},'raw':!![]});})[_0x200f('0x9')](function(_0x9fdec0){_0xb8511d[_0x200f('0xa')]('unreadMessages',_0x9fdec0['length']);OpenchannelInteractionEvents[_0x200f('0xb')](_0x281c11+':'+_0xb8511d['id'],_0xb8511d);OpenchannelInteractionEvents[_0x200f('0xb')](_0x281c11,_0xb8511d);_0x25f539(null);})['catch'](_0x25f539(null));};}for(var e in events){if(events[_0x200f('0xc')](e)){var event=events[e];OpenchannelInteraction[_0x200f('0xd')](e,emitEvent(event));}}module[_0x200f('0xe')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0xc7c4=['setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelInteraction','setMaxListeners','update','remove','getUsers','map','findAll','then'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0xc7c4,0x1a6));var _0x4c7c=function(_0x2be272,_0x1cc13a){_0x2be272=_0x2be272-0x0;var _0x5da7cb=_0xc7c4[_0x2be272];return _0x5da7cb;};'use strict';var EventEmitter=require(_0x4c7c('0x0'));var OpenchannelInteraction=require(_0x4c7c('0x1'))['db'][_0x4c7c('0x2')];var OpenchannelMessage=require(_0x4c7c('0x1'))['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x4c7c('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4c7c('0x4'),'afterDestroy':_0x4c7c('0x5')};function emitEvent(_0x38dac7){return function(_0x40ea13,_0x29ee68,_0xae432a){_0x40ea13[_0x4c7c('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x43f59c){_0x40ea13['setDataValue']('Users',_0x43f59c[_0x4c7c('0x7')](function(_0x1b3bde){return{'id':_0x1b3bde['id']};}));return OpenchannelMessage[_0x4c7c('0x8')]({'where':{'OpenchannelInteractionId':_0x40ea13['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4c7c('0x9')](function(_0x5e8e17){_0x40ea13[_0x4c7c('0xa')](_0x4c7c('0xb'),_0x5e8e17[_0x4c7c('0xc')]);OpenchannelInteractionEvents[_0x4c7c('0xd')](_0x38dac7+':'+_0x40ea13['id'],_0x40ea13);OpenchannelInteractionEvents[_0x4c7c('0xd')](_0x38dac7,_0x40ea13);_0xae432a(null);})[_0x4c7c('0xe')](_0xae432a(null));};}for(var e in events){if(events[_0x4c7c('0xf')](e)){var event=events[e];OpenchannelInteraction[_0x4c7c('0x10')](e,emitEvent(event));}}module[_0x4c7c('0x11')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 58dbb23..6c378fc 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 _0xf179=['define','OpenchannelInteraction','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed','closed','closedAt','format','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','./openchannelInteraction.attributes','exports'];(function(_0x3c18b7,_0x21cb07){var _0x3d38b3=function(_0x16b659){while(--_0x16b659){_0x3c18b7['push'](_0x3c18b7['shift']());}};_0x3d38b3(++_0x21cb07);}(_0xf179,0x87));var _0x9f17=function(_0x18fd88,_0x484f5d){_0x18fd88=_0x18fd88-0x0;var _0x166b50=_0xf179[_0x18fd88];return _0x166b50;};'use strict';var _=require(_0x9f17('0x0'));var util=require(_0x9f17('0x1'));var logger=require(_0x9f17('0x2'))('api');var moment=require(_0x9f17('0x3'));var BPromise=require(_0x9f17('0x4'));var rp=require(_0x9f17('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9f17('0x6'));var config=require('../../config/environment');var attributes=require(_0x9f17('0x7'));module[_0x9f17('0x8')]=function(_0x3f0c03,_0x294f76){return _0x3f0c03[_0x9f17('0x9')](_0x9f17('0xa'),attributes,{'tableName':_0x9f17('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9f17('0xc'),'collate':_0x9f17('0xd'),'hooks':{'beforeUpdate':function(_0x4822d1,_0x50ba76,_0x386dae){if(_0x4822d1[_0x9f17('0xe')](_0x9f17('0xf'))){_0x4822d1[_0x9f17('0x10')]=moment()[_0x9f17('0x11')]('YYYY-MM-DD\x20HH:mm:ss');}_0x386dae(null,_0x4822d1);}}});}; \ No newline at end of file +var _0xf162=['bluebird','path','../../config/environment','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','../../config/logger','api'];(function(_0x14018d,_0x5eb973){var _0x2f89ff=function(_0x3df24a){while(--_0x3df24a){_0x14018d['push'](_0x14018d['shift']());}};_0x2f89ff(++_0x5eb973);}(_0xf162,0x8e));var _0x2f16=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xf162[_0x21a9d9];return _0x46adce;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2f16('0x0'))(_0x2f16('0x1'));var moment=require('moment');var BPromise=require(_0x2f16('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2f16('0x3'));var rimraf=require('rimraf');var config=require(_0x2f16('0x4'));var attributes=require(_0x2f16('0x5'));module[_0x2f16('0x6')]=function(_0x435b5c,_0x818cbb){return _0x435b5c[_0x2f16('0x7')](_0x2f16('0x8'),attributes,{'tableName':_0x2f16('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2f16('0xa'),'collate':_0x2f16('0xb'),'hooks':{'beforeUpdate':function(_0x374d89,_0x5f0d9f,_0xbe2081){if(_0x374d89[_0x2f16('0xc')](_0x2f16('0xd'))){_0x374d89[_0x2f16('0xe')]=moment()['format'](_0x2f16('0xf'));}_0xbe2081(null,_0x374d89);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 5eff983..fbf3b7a 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 _0x88a6=['stringify','error','code','message','result','catch','OpenchannelInteraction','body','options','raw','where','attributes','limit','then','UpdateOpenchannelInteraction','AddTagsToOpenchannelInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','client','http','redis','defaults','request','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s'];(function(_0x43f3ba,_0x2393a9){var _0x160675=function(_0x2fa01f){while(--_0x2fa01f){_0x43f3ba['push'](_0x43f3ba['shift']());}};_0x160675(++_0x2393a9);}(_0x88a6,0x12e));var _0x688a=function(_0x411c23,_0x5503ae){_0x411c23=_0x411c23-0x0;var _0x27fab6=_0x88a6[_0x411c23];return _0x27fab6;};'use strict';var _=require(_0x688a('0x0'));var util=require(_0x688a('0x1'));var moment=require(_0x688a('0x2'));var BPromise=require(_0x688a('0x3'));var rs=require(_0x688a('0x4'));var fs=require('fs');var Redis=require(_0x688a('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x688a('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x688a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x688a('0x8')][_0x688a('0x9')]({'port':0x232a});config[_0x688a('0xa')]=_[_0x688a('0xb')](config[_0x688a('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./openchannelInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x2c9aa9,_0x759be4,_0x1ca557){return new BPromise(function(_0x37e591,_0x2e7599){return client[_0x688a('0xc')](_0x2c9aa9,_0x1ca557)['then'](function(_0x5592fd){logger[_0x688a('0xd')](_0x688a('0xe'),_0x759be4,_0x688a('0xf'));logger[_0x688a('0x10')](_0x688a('0x11'),_0x759be4,'request\x20sent',JSON[_0x688a('0x12')](_0x5592fd));if(_0x5592fd[_0x688a('0x13')]){if(_0x5592fd[_0x688a('0x13')][_0x688a('0x14')]===0x1f4){logger[_0x688a('0x13')](_0x688a('0xe'),_0x759be4,_0x5592fd['error'][_0x688a('0x15')]);return _0x2e7599(_0x5592fd[_0x688a('0x13')][_0x688a('0x15')]);}logger[_0x688a('0x13')](_0x688a('0xe'),_0x759be4,_0x5592fd[_0x688a('0x13')][_0x688a('0x15')]);return _0x37e591(_0x5592fd['error'][_0x688a('0x15')]);}else{logger[_0x688a('0xd')](_0x688a('0xe'),_0x759be4,_0x688a('0xf'));_0x37e591(_0x5592fd[_0x688a('0x16')][_0x688a('0x15')]);}})[_0x688a('0x17')](function(_0x311584){logger[_0x688a('0x13')](_0x688a('0xe'),_0x759be4,_0x311584);_0x2e7599(_0x311584);});});}exports['UpdateOpenchannelInteraction']=function(_0x11d3e7){var _0x338e73=this;return new Promise(function(_0xbb851c,_0x4ede4e){return db[_0x688a('0x18')]['update'](_0x11d3e7[_0x688a('0x19')],{'raw':_0x11d3e7[_0x688a('0x1a')]?_0x11d3e7['options'][_0x688a('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x11d3e7[_0x688a('0x1a')]?_0x11d3e7[_0x688a('0x1a')][_0x688a('0x1c')]||null:null,'attributes':_0x11d3e7[_0x688a('0x1a')]?_0x11d3e7['options'][_0x688a('0x1d')]||null:null,'limit':_0x11d3e7[_0x688a('0x1a')]?_0x11d3e7['options'][_0x688a('0x1e')]||null:null})[_0x688a('0x1f')](function(_0x4f8c6c){logger[_0x688a('0xd')]('UpdateOpenchannelInteraction',_0x11d3e7);logger[_0x688a('0x10')](_0x688a('0x20'),_0x11d3e7,JSON['stringify'](_0x4f8c6c));_0xbb851c(_0x4f8c6c);})[_0x688a('0x17')](function(_0x244e59){logger[_0x688a('0x13')](_0x688a('0x20'),_0x244e59['message'],_0x11d3e7);_0x4ede4e(_0x338e73[_0x688a('0x13')](0x1f4,_0x244e59['message']));});});};exports[_0x688a('0x21')]=function(_0xc1896e){return new Promise(function(_0x4e8cb2,_0x1d067a){return db[_0x688a('0x18')][_0x688a('0x22')]({'where':_0xc1896e['options']?_0xc1896e[_0x688a('0x1a')]['where']||null:null})[_0x688a('0x1f')](function(_0x444ab6){if(_0x444ab6){return _0x444ab6[_0x688a('0x23')](_0xc1896e['body'][_0x688a('0x24')],_[_0x688a('0x25')](_0xc1896e[_0x688a('0x19')],[_0x688a('0x24'),'id'])||{});}})[_0x688a('0x26')](function(_0x366de2){logger[_0x688a('0xd')](_0x688a('0x27'),_0xc1896e);logger[_0x688a('0x10')](_0x688a('0x27'),_0xc1896e,JSON[_0x688a('0x12')](_0x366de2));_0x4e8cb2(_0x366de2);})['catch'](function(_0x40a13c){logger['error'](_0x688a('0x27'),_0x40a13c[_0x688a('0x15')],_0xc1896e);_0x1d067a(_this[_0x688a('0x13')](0x1f4,_0x40a13c[_0x688a('0x15')]));});});}; \ No newline at end of file +var _0x769a=['http','redis','localhost','./openchannelInteraction.socket','register','request','info','request\x20sent','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelInteraction,\x20%s,\x20%s','message','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','attributes','limit','then','debug','find','where','addTags','ids','omit','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x235f7c,_0x1782b2){var _0x172576=function(_0x376a13){while(--_0x376a13){_0x235f7c['push'](_0x235f7c['shift']());}};_0x172576(++_0x1782b2);}(_0x769a,0x76));var _0xa769=function(_0x10d670,_0x178996){_0x10d670=_0x10d670-0x0;var _0x20d6f8=_0x769a[_0x10d670];return _0x20d6f8;};'use strict';var _=require(_0xa769('0x0'));var util=require('util');var moment=require(_0xa769('0x1'));var BPromise=require(_0xa769('0x2'));var rs=require(_0xa769('0x3'));var fs=require('fs');var Redis=require(_0xa769('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa769('0x5'));var logger=require(_0xa769('0x6'))(_0xa769('0x7'));var config=require(_0xa769('0x8'));var jayson=require(_0xa769('0x9'));var client=jayson[_0xa769('0xa')][_0xa769('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0xa769('0xc')],{'host':_0xa769('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa769('0xc')]));require(_0xa769('0xe'))[_0xa769('0xf')](socket);function respondWithRpcPromise(_0x16bd77,_0x41e716,_0x580137){return new BPromise(function(_0x564460,_0x4bd8ee){return client[_0xa769('0x10')](_0x16bd77,_0x580137)['then'](function(_0x286900){logger[_0xa769('0x11')]('OpenchannelInteraction,\x20%s,\x20%s',_0x41e716,_0xa769('0x12'));logger['debug'](_0xa769('0x13'),_0x41e716,_0xa769('0x12'),JSON[_0xa769('0x14')](_0x286900));if(_0x286900[_0xa769('0x15')]){if(_0x286900[_0xa769('0x15')][_0xa769('0x16')]===0x1f4){logger[_0xa769('0x15')](_0xa769('0x17'),_0x41e716,_0x286900[_0xa769('0x15')]['message']);return _0x4bd8ee(_0x286900[_0xa769('0x15')][_0xa769('0x18')]);}logger[_0xa769('0x15')](_0xa769('0x17'),_0x41e716,_0x286900[_0xa769('0x15')][_0xa769('0x18')]);return _0x564460(_0x286900['error']['message']);}else{logger[_0xa769('0x11')](_0xa769('0x17'),_0x41e716,_0xa769('0x12'));_0x564460(_0x286900[_0xa769('0x19')][_0xa769('0x18')]);}})[_0xa769('0x1a')](function(_0x436705){logger[_0xa769('0x15')]('OpenchannelInteraction,\x20%s,\x20%s',_0x41e716,_0x436705);_0x4bd8ee(_0x436705);});});}exports[_0xa769('0x1b')]=function(_0x1bc695){var _0x45a616=this;return new Promise(function(_0xe18dd9,_0x2b14d3){return db[_0xa769('0x1c')][_0xa769('0x1d')](_0x1bc695[_0xa769('0x1e')],{'raw':_0x1bc695[_0xa769('0x1f')]?_0x1bc695['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1bc695[_0xa769('0x1f')]?_0x1bc695[_0xa769('0x1f')]['where']||null:null,'attributes':_0x1bc695[_0xa769('0x1f')]?_0x1bc695['options'][_0xa769('0x20')]||null:null,'limit':_0x1bc695[_0xa769('0x1f')]?_0x1bc695['options'][_0xa769('0x21')]||null:null})[_0xa769('0x22')](function(_0x1fd510){logger['info'](_0xa769('0x1b'),_0x1bc695);logger[_0xa769('0x23')](_0xa769('0x1b'),_0x1bc695,JSON['stringify'](_0x1fd510));_0xe18dd9(_0x1fd510);})[_0xa769('0x1a')](function(_0x8bc257){logger[_0xa769('0x15')](_0xa769('0x1b'),_0x8bc257[_0xa769('0x18')],_0x1bc695);_0x2b14d3(_0x45a616[_0xa769('0x15')](0x1f4,_0x8bc257[_0xa769('0x18')]));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x42e4e5){return new Promise(function(_0x281eba,_0x59fa12){return db[_0xa769('0x1c')][_0xa769('0x24')]({'where':_0x42e4e5[_0xa769('0x1f')]?_0x42e4e5[_0xa769('0x1f')][_0xa769('0x25')]||null:null})[_0xa769('0x22')](function(_0x92313b){if(_0x92313b){return _0x92313b[_0xa769('0x26')](_0x42e4e5[_0xa769('0x1e')][_0xa769('0x27')],_[_0xa769('0x28')](_0x42e4e5[_0xa769('0x1e')],[_0xa769('0x27'),'id'])||{});}})[_0xa769('0x29')](function(_0x3d82eb){logger['info'](_0xa769('0x2a'),_0x42e4e5);logger['debug'](_0xa769('0x2a'),_0x42e4e5,JSON['stringify'](_0x3d82eb));_0x281eba(_0x3d82eb);})[_0xa769('0x1a')](function(_0x3dadc2){logger[_0xa769('0x15')]('AddTags',_0x3dadc2[_0xa769('0x18')],_0x42e4e5);_0x59fa12(_this[_0xa769('0x15')](0x1f4,_0x3dadc2['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index a7b49ff..90983ee 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 _0xb8dc=['update','emit','removeListener','register','length','openchannelInteraction:','remove'];(function(_0xd595c,_0x363346){var _0x2ffecd=function(_0x2613ac){while(--_0x2613ac){_0xd595c['push'](_0xd595c['shift']());}};_0x2ffecd(++_0x363346);}(_0xb8dc,0x117));var _0xcb8d=function(_0x46d878,_0x120e28){_0x46d878=_0x46d878-0x0;var _0x5b5959=_0xb8dc[_0x46d878];return _0x5b5959;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=['save',_0xcb8d('0x0'),_0xcb8d('0x1')];function createListener(_0x4987ea,_0x4ee8a1){return function(_0x597a7d){_0x4ee8a1[_0xcb8d('0x2')](_0x4987ea,_0x597a7d);};}function removeListener(_0x198ab1,_0x4352f0){return function(){OpenchannelInteractionEvents[_0xcb8d('0x3')](_0x198ab1,_0x4352f0);};}exports[_0xcb8d('0x4')]=function(_0x40e9b5){for(var _0x228c83=0x0,_0x42591a=events[_0xcb8d('0x5')];_0x228c83<_0x42591a;_0x228c83++){var _0x147b72=events[_0x228c83];var _0x238ca0=createListener(_0xcb8d('0x6')+_0x147b72,_0x40e9b5);OpenchannelInteractionEvents['on'](_0x147b72,_0x238ca0);}}; \ No newline at end of file +var _0xaa5a=['register','length','openchannelInteraction:','./openchannelInteraction.events','save','update','removeListener'];(function(_0x215b42,_0x27b257){var _0x33bb86=function(_0x1748d7){while(--_0x1748d7){_0x215b42['push'](_0x215b42['shift']());}};_0x33bb86(++_0x27b257);}(_0xaa5a,0xff));var _0xaaa5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xaa5a[_0x3dd15e];return _0x231fd0;};'use strict';var OpenchannelInteractionEvents=require(_0xaaa5('0x0'));var events=[_0xaaa5('0x1'),'remove',_0xaaa5('0x2')];function createListener(_0x5042fb,_0x28c61e){return function(_0x219e07){_0x28c61e['emit'](_0x5042fb,_0x219e07);};}function removeListener(_0x3e4ea6,_0x254c53){return function(){OpenchannelInteractionEvents[_0xaaa5('0x3')](_0x3e4ea6,_0x254c53);};}exports[_0xaaa5('0x4')]=function(_0x2901f6){for(var _0x31a3c4=0x0,_0x1340b9=events[_0xaaa5('0x5')];_0x31a3c4<_0x1340b9;_0x31a3c4++){var _0x1a5272=events[_0x31a3c4];var _0x4dd77e=createListener(_0xaaa5('0x6')+_0x1a5272,_0x2901f6);OpenchannelInteractionEvents['on'](_0x1a5272,_0x4dd77e);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index e71f79d..25fa306 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 _0xe706=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','openchannel','openchannelmessage:create','create','update','put','/:id/accept','accept','/:id/reject','exports','multer','util','path','express','Router'];(function(_0x414525,_0x4abcd5){var _0x2265c5=function(_0x37d111){while(--_0x37d111){_0x414525['push'](_0x414525['shift']());}};_0x2265c5(++_0x4abcd5);}(_0xe706,0xa3));var _0x6e70=function(_0x5e9876,_0x16052d){_0x5e9876=_0x5e9876-0x0;var _0x576c48=_0xe706[_0x5e9876];return _0x576c48;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),interaction[_0x6e70('0x12')](_0x6e70('0x13'),_0x6e70('0x14')),controller[_0x6e70('0x15')]);router['put']('/:id',auth[_0x6e70('0xb')](),controller[_0x6e70('0x16')]);router[_0x6e70('0x17')](_0x6e70('0x18'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x19')]);router[_0x6e70('0x17')](_0x6e70('0x1a'),auth['isAuthenticated'](),controller['reject']);router['delete'](_0x6e70('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0x6e70('0x1b')]=router; \ No newline at end of file +var _0x0713=['get','isAuthenticated','index','/describe','describe','/:id','post','tracked','openchannel','openchannelmessage:create','put','update','accept','/:id/reject','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelMessage.controller'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_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'));var controller=require(_0x3071('0x7'));router[_0x3071('0x8')]('/',auth[_0x3071('0x9')](),controller[_0x3071('0xa')]);router[_0x3071('0x8')](_0x3071('0xb'),auth[_0x3071('0x9')](),controller[_0x3071('0xc')]);router[_0x3071('0x8')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller['show']);router[_0x3071('0xe')]('/',auth[_0x3071('0x9')](),interaction[_0x3071('0xf')](_0x3071('0x10'),_0x3071('0x11')),controller['create']);router[_0x3071('0x12')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller[_0x3071('0x13')]);router[_0x3071('0x12')]('/:id/accept',auth['isAuthenticated'](),controller[_0x3071('0x14')]);router['put'](_0x3071('0x15'),auth[_0x3071('0x9')](),controller['reject']);router[_0x3071('0x16')]('/:id',auth[_0x3071('0x9')](),controller[_0x3071('0x17')]);module[_0x3071('0x18')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index fa5f55f..f9b530a 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 _0x2884=['STRING','sequelize','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0x5c0d3b,_0x205099){var _0x992742=function(_0x52d545){while(--_0x52d545){_0x5c0d3b['push'](_0x5c0d3b['shift']());}};_0x992742(++_0x205099);}(_0x2884,0x1eb));var _0x4288=function(_0x507e43,_0x5428d8){_0x507e43=_0x507e43-0x0;var _0x3454d9=_0x2884[_0x507e43];return _0x3454d9;};'use strict';var Sequelize=require(_0x4288('0x0'));module['exports']={'body':{'type':Sequelize[_0x4288('0x1')](_0x4288('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x4288('0x3')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x4288('0x4')]('in',_0x4288('0x5')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x4288('0x6')]},'providerResponse':{'type':Sequelize[_0x4288('0x1')]}}; \ No newline at end of file +var _0x282b=['BOOLEAN','out','DATE','STRING','sequelize','exports','TEXT','medium'];(function(_0x2bcf02,_0xa1adf7){var _0x1b3c48=function(_0x25bf69){while(--_0x25bf69){_0x2bcf02['push'](_0x2bcf02['shift']());}};_0x1b3c48(++_0xa1adf7);}(_0x282b,0xec));var _0xb282=function(_0x40f8b3,_0xc45091){_0x40f8b3=_0x40f8b3-0x0;var _0x1d1be2=_0x282b[_0x40f8b3];return _0x1d1be2;};'use strict';var Sequelize=require(_0xb282('0x0'));module[_0xb282('0x1')]={'body':{'type':Sequelize[_0xb282('0x2')](_0xb282('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xb282('0x4')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xb282('0x5')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0xb282('0x6')]},'providerName':{'type':Sequelize[_0xb282('0x7')]},'providerResponse':{'type':Sequelize[_0xb282('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index c8b04fc..46b422a 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 _0xa8db=['[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','QueryTypes','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','acceptmessage','openchannel-interactions','openchannel','OpenchannelInteractionId','interaction','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','ContactId','sequelize','EventManager','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','http','client','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','json','offset','undefined','limit','set','Content-Range','reject','save','update','destroy','end','stack','name','index','OpenchannelMessage','rawAttributes','fieldName','type','model','map','query','filters','intersection','fields','attributes','length','order','sort','where','filter','VIRTUAL','options','count','includeAll','include','rows','show','params','keys','merge','find','create','body','describe','accept','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','OpenchannelInteraction','isNil','format','get'];(function(_0x2a3b4d,_0x151237){var _0x3b875d=function(_0x3e39a4){while(--_0x3e39a4){_0x2a3b4d['push'](_0x2a3b4d['shift']());}};_0x3b875d(++_0x151237);}(_0xa8db,0x12a));var _0xba8d=function(_0x5a60ce,_0x48f080){_0x5a60ce=_0x5a60ce-0x0;var _0x393e5e=_0xa8db[_0x5a60ce];return _0x393e5e;};'use strict';var emlformat=require(_0xba8d('0x0'));var rimraf=require(_0xba8d('0x1'));var zipdir=require(_0xba8d('0x2'));var jsonpatch=require(_0xba8d('0x3'));var rp=require(_0xba8d('0x4'));var moment=require('moment');var BPromise=require(_0xba8d('0x5'));var Mustache=require(_0xba8d('0x6'));var util=require(_0xba8d('0x7'));var path=require(_0xba8d('0x8'));var sox=require(_0xba8d('0x9'));var csv=require('to-csv');var ejs=require(_0xba8d('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xba8d('0xb'));var crypto=require(_0xba8d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xba8d('0xd'));var toCsv=require(_0xba8d('0xe'));var querystring=require(_0xba8d('0xf'));var Papa=require(_0xba8d('0x10'));var Redis=require('ioredis');var authService=require(_0xba8d('0x11'));var qs=require(_0xba8d('0x12'));var as=require(_0xba8d('0x13'));var hardwareService=require(_0xba8d('0x14'));var logger=require(_0xba8d('0x15'))(_0xba8d('0x16'));var utils=require('../../config/utils');var config=require(_0xba8d('0x17'));var licenseUtil=require(_0xba8d('0x18'));var db=require(_0xba8d('0x19'))['db'];config[_0xba8d('0x1a')]=_[_0xba8d('0x1b')](config[_0xba8d('0x1a')],{'host':_0xba8d('0x1c'),'port':0x18eb});var socket=require(_0xba8d('0x1d'))(new Redis(config['redis']));require(_0xba8d('0x1e'))[_0xba8d('0x1f')](socket);var jayson=require(_0xba8d('0x20'));var client=jayson['client'][_0xba8d('0x21')]({'port':0x232c});var client9002=jayson[_0xba8d('0x22')][_0xba8d('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x24aca2,_0x52670c,_0x22512e,_0x15935a){return new BPromise(function(_0x105833,_0x247495){var _0x27f6b4=_0x15935a||client;return _0x27f6b4[_0xba8d('0x23')](_0x24aca2,_0x22512e)[_0xba8d('0x24')](function(_0x527df2){logger[_0xba8d('0x25')](_0xba8d('0x26'),_0x52670c,_0xba8d('0x27'));logger[_0xba8d('0x28')](_0xba8d('0x29'),_0x52670c,_0xba8d('0x27'),JSON[_0xba8d('0x2a')](_0x527df2));if(_0x527df2[_0xba8d('0x2b')]){if(_0x527df2['error']['code']===0x1f4){logger[_0xba8d('0x2b')](_0xba8d('0x26'),_0x52670c,_0x527df2['error'][_0xba8d('0x2c')]);return _0x247495(_0x527df2[_0xba8d('0x2b')]['message']);}logger[_0xba8d('0x2b')]('OpenchannelMessage,\x20%s,\x20%s',_0x52670c,_0x527df2['error'][_0xba8d('0x2c')]);return _0x105833(_0x527df2[_0xba8d('0x2b')][_0xba8d('0x2c')]);}else{logger['info'](_0xba8d('0x26'),_0x52670c,_0xba8d('0x27'));_0x105833(_0x527df2[_0xba8d('0x2d')]['message']);}})[_0xba8d('0x2e')](function(_0x12ebd9){logger['error'](_0xba8d('0x26'),_0x52670c,_0x12ebd9);_0x247495(_0x12ebd9);});});}function respondWithStatusCode(_0x3fe467,_0x187880){_0x187880=_0x187880||0xcc;return function(_0x2adbfb){if(_0x2adbfb){return _0x3fe467[_0xba8d('0x2f')](_0x187880);}return _0x3fe467[_0xba8d('0x30')](_0x187880)['end']();};}function respondWithResult(_0x11cdef,_0x28c178){_0x28c178=_0x28c178||0xc8;return function(_0x1916a4){if(_0x1916a4){return _0x11cdef[_0xba8d('0x30')](_0x28c178)[_0xba8d('0x31')](_0x1916a4);}};}function respondWithFilteredResult(_0x16110b,_0x3712a1){return function(_0x1ecfa4){if(_0x1ecfa4){var _0x104cff=typeof _0x3712a1[_0xba8d('0x32')]===_0xba8d('0x33')&&typeof _0x3712a1[_0xba8d('0x34')]===_0xba8d('0x33');var _0x20a5e2=_0x1ecfa4['count'];var _0x3c0cba=_0x104cff?0x0:_0x3712a1[_0xba8d('0x32')];var _0x2064e2=_0x104cff?_0x1ecfa4['count']:_0x3712a1[_0xba8d('0x32')]+_0x3712a1[_0xba8d('0x34')];var _0x4f51aa;if(_0x2064e2>=_0x20a5e2){_0x2064e2=_0x20a5e2;_0x4f51aa=0xc8;}else{_0x4f51aa=0xce;}_0x16110b[_0xba8d('0x30')](_0x4f51aa);return _0x16110b[_0xba8d('0x35')](_0xba8d('0x36'),_0x3c0cba+'-'+_0x2064e2+'/'+_0x20a5e2)[_0xba8d('0x31')](_0x1ecfa4);}return null;};}function patchUpdates(_0x1d001d){return function(_0x56d5c5){try{jsonpatch['apply'](_0x56d5c5,_0x1d001d,!![]);}catch(_0x5f3fcc){return BPromise[_0xba8d('0x37')](_0x5f3fcc);}return _0x56d5c5[_0xba8d('0x38')]();};}function saveUpdates(_0x5e934d,_0x330b18){return function(_0x42bc98){if(_0x42bc98){return _0x42bc98[_0xba8d('0x39')](_0x5e934d)['then'](function(_0x89923c){return _0x89923c;});}return null;};}function removeEntity(_0x3338eb,_0x3213ac){return function(_0x1d5423){if(_0x1d5423){return _0x1d5423[_0xba8d('0x3a')]()[_0xba8d('0x24')](function(){_0x3338eb[_0xba8d('0x30')](0xcc)[_0xba8d('0x3b')]();});}};}function handleEntityNotFound(_0x2cdab6,_0x3ae48f){return function(_0x504bd6){if(!_0x504bd6){_0x2cdab6[_0xba8d('0x2f')](0x194);}return _0x504bd6;};}function handleError(_0x9e4e4a,_0x1b0bcb){_0x1b0bcb=_0x1b0bcb||0x1f4;return function(_0x4efb8d){logger[_0xba8d('0x2b')](_0x4efb8d[_0xba8d('0x3c')]);if(_0x4efb8d[_0xba8d('0x3d')]){delete _0x4efb8d[_0xba8d('0x3d')];}_0x9e4e4a[_0xba8d('0x30')](_0x1b0bcb)['send'](_0x4efb8d);};}exports[_0xba8d('0x3e')]=function(_0x2ecfa1,_0x58c7e1){var _0x5f2852={},_0x1f7fd6={},_0x57de2a={'count':0x0,'rows':[]};var _0x7bec60=_['map'](db[_0xba8d('0x3f')][_0xba8d('0x40')],function(_0x3bccfd){return{'name':_0x3bccfd[_0xba8d('0x41')],'type':_0x3bccfd[_0xba8d('0x42')]['key']};});_0x1f7fd6[_0xba8d('0x43')]=_[_0xba8d('0x44')](_0x7bec60,_0xba8d('0x3d'));_0x1f7fd6[_0xba8d('0x45')]=_['keys'](_0x2ecfa1[_0xba8d('0x45')]);_0x1f7fd6[_0xba8d('0x46')]=_[_0xba8d('0x47')](_0x1f7fd6[_0xba8d('0x43')],_0x1f7fd6[_0xba8d('0x45')]);_0x5f2852['attributes']=_[_0xba8d('0x47')](_0x1f7fd6[_0xba8d('0x43')],qs[_0xba8d('0x48')](_0x2ecfa1[_0xba8d('0x45')][_0xba8d('0x48')]));_0x5f2852[_0xba8d('0x49')]=_0x5f2852[_0xba8d('0x49')][_0xba8d('0x4a')]?_0x5f2852[_0xba8d('0x49')]:_0x1f7fd6[_0xba8d('0x43')];if(!_0x2ecfa1['query']['hasOwnProperty']('nolimit')){_0x5f2852[_0xba8d('0x34')]=qs[_0xba8d('0x34')](_0x2ecfa1[_0xba8d('0x45')][_0xba8d('0x34')]);_0x5f2852[_0xba8d('0x32')]=qs[_0xba8d('0x32')](_0x2ecfa1[_0xba8d('0x45')][_0xba8d('0x32')]);}_0x5f2852[_0xba8d('0x4b')]=qs[_0xba8d('0x4c')](_0x2ecfa1[_0xba8d('0x45')]['sort']);_0x5f2852[_0xba8d('0x4d')]=qs[_0xba8d('0x46')](_['pick'](_0x2ecfa1[_0xba8d('0x45')],_0x1f7fd6[_0xba8d('0x46')]),_0x7bec60);if(_0x2ecfa1[_0xba8d('0x45')][_0xba8d('0x4e')]){_0x5f2852[_0xba8d('0x4d')]=_['merge'](_0x5f2852[_0xba8d('0x4d')],{'$or':_[_0xba8d('0x44')](_0x7bec60,function(_0x10bb98){if(_0x10bb98[_0xba8d('0x42')]!==_0xba8d('0x4f')){var _0x3aa280={};_0x3aa280[_0x10bb98[_0xba8d('0x3d')]]={'$like':'%'+_0x2ecfa1[_0xba8d('0x45')][_0xba8d('0x4e')]+'%'};return _0x3aa280;}})});}_0x5f2852=_['merge']({},_0x5f2852,_0x2ecfa1[_0xba8d('0x50')]);var _0x15cffb={'where':_0x5f2852[_0xba8d('0x4d')]};return db[_0xba8d('0x3f')][_0xba8d('0x51')](_0x15cffb)[_0xba8d('0x24')](function(_0x2d2c06){_0x57de2a['count']=_0x2d2c06;if(_0x2ecfa1[_0xba8d('0x45')][_0xba8d('0x52')]){_0x5f2852[_0xba8d('0x53')]=[{'all':!![]}];}return db[_0xba8d('0x3f')]['findAll'](_0x5f2852);})[_0xba8d('0x24')](function(_0x26f061){_0x57de2a[_0xba8d('0x54')]=_0x26f061;return _0x57de2a;})[_0xba8d('0x24')](respondWithFilteredResult(_0x58c7e1,_0x5f2852))[_0xba8d('0x2e')](handleError(_0x58c7e1,null));};exports[_0xba8d('0x55')]=function(_0x27874a,_0x5bd038){var _0x4267ac={'raw':!![],'where':{'id':_0x27874a[_0xba8d('0x56')]['id']}},_0x36ad99={};_0x36ad99[_0xba8d('0x43')]=_['keys'](db[_0xba8d('0x3f')]['rawAttributes']);_0x36ad99['query']=_[_0xba8d('0x57')](_0x27874a[_0xba8d('0x45')]);_0x36ad99[_0xba8d('0x46')]=_[_0xba8d('0x47')](_0x36ad99[_0xba8d('0x43')],_0x36ad99[_0xba8d('0x45')]);_0x4267ac['attributes']=_[_0xba8d('0x47')](_0x36ad99[_0xba8d('0x43')],qs['fields'](_0x27874a[_0xba8d('0x45')][_0xba8d('0x48')]));_0x4267ac['attributes']=_0x4267ac[_0xba8d('0x49')][_0xba8d('0x4a')]?_0x4267ac[_0xba8d('0x49')]:_0x36ad99[_0xba8d('0x43')];if(_0x27874a[_0xba8d('0x45')][_0xba8d('0x52')]){_0x4267ac[_0xba8d('0x53')]=[{'all':!![]}];}_0x4267ac=_[_0xba8d('0x58')]({},_0x4267ac,_0x27874a[_0xba8d('0x50')]);return db[_0xba8d('0x3f')][_0xba8d('0x59')](_0x4267ac)[_0xba8d('0x24')](handleEntityNotFound(_0x5bd038,null))[_0xba8d('0x24')](respondWithResult(_0x5bd038,null))[_0xba8d('0x2e')](handleError(_0x5bd038,null));};exports[_0xba8d('0x5a')]=function(_0x3a700b,_0x5d1695){return db['OpenchannelMessage'][_0xba8d('0x5a')](_0x3a700b[_0xba8d('0x5b')],{})[_0xba8d('0x24')](respondWithResult(_0x5d1695,0xc9))[_0xba8d('0x2e')](handleError(_0x5d1695,null));};exports[_0xba8d('0x39')]=function(_0xab53c1,_0x189b81){if(_0xab53c1[_0xba8d('0x5b')]['id']){delete _0xab53c1[_0xba8d('0x5b')]['id'];}return db[_0xba8d('0x3f')][_0xba8d('0x59')]({'where':{'id':_0xab53c1[_0xba8d('0x56')]['id']}})['then'](handleEntityNotFound(_0x189b81,null))[_0xba8d('0x24')](saveUpdates(_0xab53c1[_0xba8d('0x5b')],null))['then'](respondWithResult(_0x189b81,null))[_0xba8d('0x2e')](handleError(_0x189b81,null));};exports[_0xba8d('0x3a')]=function(_0x3afd4a,_0xf7d0cc){return db[_0xba8d('0x3f')][_0xba8d('0x59')]({'where':{'id':_0x3afd4a['params']['id']}})[_0xba8d('0x24')](handleEntityNotFound(_0xf7d0cc,null))[_0xba8d('0x24')](removeEntity(_0xf7d0cc,null))['catch'](handleError(_0xf7d0cc,null));};exports[_0xba8d('0x5c')]=function(_0x20db7d,_0x25717b){return db['OpenchannelMessage']['describe']()['then'](respondWithResult(_0x25717b,null))[_0xba8d('0x2e')](handleError(_0x25717b,null));};var interaction_log=require(_0xba8d('0x15'))('openchannel-interactions');exports[_0xba8d('0x5d')]=function(_0x6b4f8,_0x415c79,_0x8c5fdc){var _0xcc72bf={'agent':{},'channel':'openchannel'};if(_0x6b4f8[_0xba8d('0x5b')]['id']){delete _0x6b4f8['body']['id'];}_0x6b4f8[_0xba8d('0x5b')][_0xba8d('0x5e')]=!![];_0x6b4f8[_0xba8d('0x5b')][_0xba8d('0x5f')]=moment()['format'](_0xba8d('0x60'));_0x6b4f8[_0xba8d('0x5b')][_0xba8d('0x61')]=_0x6b4f8[_0xba8d('0x5b')]['UserId']||_0x6b4f8[_0xba8d('0x62')]['id'];_0xcc72bf[_0xba8d('0x63')]['id']=_0x6b4f8[_0xba8d('0x5b')][_0xba8d('0x61')];return db['OpenchannelMessage']['find']({'where':{'id':_0x6b4f8[_0xba8d('0x56')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x415c79,null))['then'](saveUpdates(_0x6b4f8[_0xba8d('0x5b')],null))[_0xba8d('0x24')](function(_0x34825f){if(_0x34825f){_0xcc72bf[_0xba8d('0x2c')]=_0x34825f['get']({'plain':!![]});return db[_0xba8d('0x64')][_0xba8d('0x59')]({'where':{'id':_0x34825f['OpenchannelInteractionId']}});}return null;})[_0xba8d('0x24')](handleEntityNotFound(_0x415c79,null))[_0xba8d('0x24')](function(_0x460d9c){if(_0x460d9c){return _0x460d9c[_0xba8d('0x39')]({'UserId':_0x6b4f8[_0xba8d('0x5b')]['UserId'],'read1stAt':_[_0xba8d('0x65')](_0x460d9c['read1stAt'])?moment()[_0xba8d('0x66')](_0xba8d('0x60')):undefined});}return null;})[_0xba8d('0x24')](function(_0x34b258){if(_0x34b258){_0xcc72bf['interaction']=_0x34b258[_0xba8d('0x67')]({'plain':!![]});interaction_log['info'](_0xba8d('0x68'),_0x6b4f8[_0xba8d('0x62')]['id'],_0x6b4f8[_0xba8d('0x62')][_0xba8d('0x3d')],_0x6b4f8[_0xba8d('0x62')][_0xba8d('0x69')],_0xcc72bf['interaction']['id'],_0x6b4f8[_0xba8d('0x5b')]?JSON[_0xba8d('0x2a')](_0x6b4f8[_0xba8d('0x5b')]):_0xba8d('0x6a'));return respondWithRpcPromise(_0xba8d('0x6b'),'acceptMessage',_0xcc72bf);}return null;})[_0xba8d('0x24')](function(_0x370897){var _0x4cbe9a=_0xba8d('0x6c')+_0x370897[_0xba8d('0x2c')]['ContactId'];return db['sequelize'][_0xba8d('0x45')](_0x4cbe9a,{'type':db[_0xba8d('0x6d')][_0xba8d('0x6e')]['SELECT'],'raw':!![]})[_0xba8d('0x24')](function(_0x49a009){return _0x49a009;});})['then'](function(_0x192050){if(_0x192050){_0xcc72bf[_0xba8d('0x2c')][_0xba8d('0x6f')]=_0x192050[0x0];if(!_0x6b4f8['body'][_0xba8d('0x61')])return;return db[_0xba8d('0x70')][_0xba8d('0x59')]({'where':{'id':_0x6b4f8[_0xba8d('0x5b')][_0xba8d('0x61')],'role':_0xba8d('0x63')},'attributes':['id',_0xba8d('0x3d'),_0xba8d('0x71'),_0xba8d('0x72'),_0xba8d('0x73')],'raw':!![]});}return null;})[_0xba8d('0x24')](function(_0x1a3279){if(!_0x1a3279)return null;_0xcc72bf[_0xba8d('0x2c')]['agent']=_0x1a3279;return _0xcc72bf;})['then'](function(_0x3e3c77){if(_0x3e3c77){if(_0x6b4f8[_0xba8d('0x5b')][_0xba8d('0x74')]){_0xcc72bf['message'][_0xba8d('0x75')]=util[_0xba8d('0x66')](_0xba8d('0x76'),_0x6b4f8[_0xba8d('0x62')]['name']);_0xcc72bf[_0xba8d('0x2c')]['channel']=_0xcc72bf[_0xba8d('0x77')];_0xcc72bf[_0xba8d('0x2c')][_0xba8d('0x78')]=_0xcc72bf[_0xba8d('0x77')];_0xcc72bf['message'][_0xba8d('0x79')]=_0xba8d('0x5d');return respondWithRpcPromise('EventManager','EventManager',{'event':_0xba8d('0x7a'),'message':_0xcc72bf['message']},client9002)[_0xba8d('0x24')](function(){return _0xcc72bf;});}return _0xcc72bf;}return null;})[_0xba8d('0x24')](respondWithResult(_0x415c79,null))['catch'](handleError(_0x415c79,null));};var interaction_log=require(_0xba8d('0x15'))(_0xba8d('0x7b'));exports[_0xba8d('0x37')]=function(_0x4e3af7,_0x5f48e0,_0x52d420){var _0x5424aa={'agent':{},'channel':_0xba8d('0x7c')};if(_0x4e3af7[_0xba8d('0x5b')]['id']){delete _0x4e3af7['body']['id'];}_0x4e3af7[_0xba8d('0x5b')]['UserId']=_0x4e3af7[_0xba8d('0x5b')][_0xba8d('0x61')]||_0x4e3af7[_0xba8d('0x62')]['id'];_0x5424aa['agent']['id']=_0x4e3af7[_0xba8d('0x5b')]['UserId'];return db[_0xba8d('0x3f')][_0xba8d('0x59')]({'where':{'id':_0x4e3af7[_0xba8d('0x56')]['id'],'UserId':null}})[_0xba8d('0x24')](handleEntityNotFound(_0x5f48e0,null))[_0xba8d('0x24')](function(_0xfb05f3){if(_0xfb05f3){_0x5424aa[_0xba8d('0x2c')]=_0xfb05f3[_0xba8d('0x67')]({'plain':!![]});return db[_0xba8d('0x64')]['find']({'where':{'id':_0xfb05f3[_0xba8d('0x7d')]}});}return null;})['then'](handleEntityNotFound(_0x5f48e0,null))[_0xba8d('0x24')](function(_0x16e570){if(_0x16e570){_0x5424aa[_0xba8d('0x7e')]=_0x16e570[_0xba8d('0x67')]({'plain':!![]});interaction_log['info'](_0xba8d('0x7f'),_0x4e3af7['user']['id'],_0x4e3af7['user']['name'],_0x4e3af7[_0xba8d('0x62')][_0xba8d('0x69')],_0x5424aa['interaction']['id'],_0x4e3af7[_0xba8d('0x5b')]?JSON[_0xba8d('0x2a')](_0x4e3af7[_0xba8d('0x5b')]):'null');return respondWithRpcPromise(_0xba8d('0x80'),_0xba8d('0x81'),_0x5424aa);}return null;})['then'](function(_0x3d39d6){var _0x39350a=_0xba8d('0x6c')+_0x3d39d6[_0xba8d('0x2c')][_0xba8d('0x82')];return db[_0xba8d('0x83')][_0xba8d('0x45')](_0x39350a,{'type':db[_0xba8d('0x6d')]['QueryTypes']['SELECT'],'raw':!![]})[_0xba8d('0x24')](function(_0x44235a){return _0x44235a;});})[_0xba8d('0x24')](function(_0x1c9872){if(_0x1c9872){_0x5424aa[_0xba8d('0x2c')][_0xba8d('0x6f')]=_0x1c9872[0x0];if(!_0x4e3af7[_0xba8d('0x5b')][_0xba8d('0x61')])return;return db[_0xba8d('0x70')][_0xba8d('0x59')]({'where':{'id':_0x4e3af7[_0xba8d('0x5b')]['UserId'],'role':_0xba8d('0x63')},'attributes':['id',_0xba8d('0x3d'),'fullname',_0xba8d('0x72'),_0xba8d('0x73')],'raw':!![]});}return null;})['then'](function(_0x2098ee){if(!_0x2098ee)return null;_0x5424aa[_0xba8d('0x2c')][_0xba8d('0x63')]=_0x2098ee;return _0x5424aa;})['then'](function(_0x4b0366){if(_0x4b0366){_0x4b0366[_0xba8d('0x2c')][_0xba8d('0x75')]=util[_0xba8d('0x66')](_0xba8d('0x76'),_0x4e3af7[_0xba8d('0x62')][_0xba8d('0x3d')]);_0x4b0366[_0xba8d('0x2c')][_0xba8d('0x77')]=_0x5424aa[_0xba8d('0x77')];_0x4b0366['message']['motionChannel']=_0x5424aa[_0xba8d('0x77')];_0x4b0366[_0xba8d('0x2c')][_0xba8d('0x79')]=_0xba8d('0x37');respondWithRpcPromise(_0xba8d('0x84'),_0xba8d('0x84'),{'event':_0xba8d('0x85'),'message':_0x4b0366['message']},client9002);return _0x5424aa;}return null;})[_0xba8d('0x24')](respondWithResult(_0x5f48e0,null))[_0xba8d('0x2e')](handleError(_0x5f48e0,null));}; \ No newline at end of file +var _0x3ef1=['SELECT','User','fullname','internal','manual','channel','motionChannel','event','accept','EventManager','acceptmessage','openchannel-interactions','openchannel','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','RejectMessage','rejectMessage','sequelize','contact','email','interface','SIP/%s','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','register','jayson/promise','http','client','request','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','OpenchannelMessage,\x20%s,\x20%s,\x20%s','code','error','message','info','result','catch','end','json','offset','undefined','limit','count','status','set','Content-Range','reject','save','update','destroy','sendStatus','stack','name','send','index','map','OpenchannelMessage','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','findAll','show','params','rawAttributes','include','find','create','body','describe','read','readAt','format','UserId','user','agent','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes'];(function(_0x506172,_0xbc3a3){var _0x2723c0=function(_0x57c3d9){while(--_0x57c3d9){_0x506172['push'](_0x506172['shift']());}};_0x2723c0(++_0xbc3a3);}(_0x3ef1,0x99));var _0x13ef=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x3ef1[_0x1d9aa0];return _0x226868;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x13ef('0x0'));var zipdir=require(_0x13ef('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x13ef('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x13ef('0x3'));var util=require(_0x13ef('0x4'));var path=require(_0x13ef('0x5'));var sox=require(_0x13ef('0x6'));var csv=require(_0x13ef('0x7'));var ejs=require(_0x13ef('0x8'));var fs=require('fs');var fs_extra=require(_0x13ef('0x9'));var _=require(_0x13ef('0xa'));var squel=require('squel');var crypto=require(_0x13ef('0xb'));var jsforce=require(_0x13ef('0xc'));var deskjs=require(_0x13ef('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x13ef('0xe'));var Redis=require(_0x13ef('0xf'));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(_0x13ef('0x10'))(_0x13ef('0x11'));var utils=require('../../config/utils');var config=require(_0x13ef('0x12'));var licenseUtil=require(_0x13ef('0x13'));var db=require(_0x13ef('0x14'))['db'];config[_0x13ef('0x15')]=_['defaults'](config[_0x13ef('0x15')],{'host':_0x13ef('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x13ef('0x15')]));require('./openchannelMessage.socket')[_0x13ef('0x17')](socket);var jayson=require(_0x13ef('0x18'));var client=jayson['client'][_0x13ef('0x19')]({'port':0x232c});var client9002=jayson[_0x13ef('0x1a')][_0x13ef('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x2d2544,_0x1437e0,_0x334b0b,_0x35d442){return new BPromise(function(_0x5dedcd,_0x11e542){var _0x451626=_0x35d442||client;return _0x451626[_0x13ef('0x1b')](_0x2d2544,_0x334b0b)[_0x13ef('0x1c')](function(_0x1532b7){logger['info'](_0x13ef('0x1d'),_0x1437e0,_0x13ef('0x1e'));logger['debug'](_0x13ef('0x1f'),_0x1437e0,'request\x20sent',JSON['stringify'](_0x1532b7));if(_0x1532b7['error']){if(_0x1532b7['error'][_0x13ef('0x20')]===0x1f4){logger[_0x13ef('0x21')]('OpenchannelMessage,\x20%s,\x20%s',_0x1437e0,_0x1532b7[_0x13ef('0x21')][_0x13ef('0x22')]);return _0x11e542(_0x1532b7[_0x13ef('0x21')][_0x13ef('0x22')]);}logger[_0x13ef('0x21')](_0x13ef('0x1d'),_0x1437e0,_0x1532b7[_0x13ef('0x21')][_0x13ef('0x22')]);return _0x5dedcd(_0x1532b7[_0x13ef('0x21')][_0x13ef('0x22')]);}else{logger[_0x13ef('0x23')](_0x13ef('0x1d'),_0x1437e0,_0x13ef('0x1e'));_0x5dedcd(_0x1532b7[_0x13ef('0x24')]['message']);}})[_0x13ef('0x25')](function(_0x346684){logger[_0x13ef('0x21')](_0x13ef('0x1d'),_0x1437e0,_0x346684);_0x11e542(_0x346684);});});}function respondWithStatusCode(_0x323955,_0x3294ac){_0x3294ac=_0x3294ac||0xcc;return function(_0x140d0e){if(_0x140d0e){return _0x323955['sendStatus'](_0x3294ac);}return _0x323955['status'](_0x3294ac)[_0x13ef('0x26')]();};}function respondWithResult(_0x5bbbda,_0x24069a){_0x24069a=_0x24069a||0xc8;return function(_0x39d053){if(_0x39d053){return _0x5bbbda['status'](_0x24069a)[_0x13ef('0x27')](_0x39d053);}};}function respondWithFilteredResult(_0x39b5c1,_0x1dd185){return function(_0x26a442){if(_0x26a442){var _0xb96d1c=typeof _0x1dd185[_0x13ef('0x28')]===_0x13ef('0x29')&&typeof _0x1dd185[_0x13ef('0x2a')]===_0x13ef('0x29');var _0x387bab=_0x26a442[_0x13ef('0x2b')];var _0x3a4abd=_0xb96d1c?0x0:_0x1dd185[_0x13ef('0x28')];var _0x32f303=_0xb96d1c?_0x26a442[_0x13ef('0x2b')]:_0x1dd185[_0x13ef('0x28')]+_0x1dd185['limit'];var _0x28e364;if(_0x32f303>=_0x387bab){_0x32f303=_0x387bab;_0x28e364=0xc8;}else{_0x28e364=0xce;}_0x39b5c1[_0x13ef('0x2c')](_0x28e364);return _0x39b5c1[_0x13ef('0x2d')](_0x13ef('0x2e'),_0x3a4abd+'-'+_0x32f303+'/'+_0x387bab)['json'](_0x26a442);}return null;};}function patchUpdates(_0x14d59c){return function(_0x1357a3){try{jsonpatch['apply'](_0x1357a3,_0x14d59c,!![]);}catch(_0x5029a4){return BPromise[_0x13ef('0x2f')](_0x5029a4);}return _0x1357a3[_0x13ef('0x30')]();};}function saveUpdates(_0x3a813d,_0x3ad897){return function(_0x519a25){if(_0x519a25){return _0x519a25[_0x13ef('0x31')](_0x3a813d)['then'](function(_0x836241){return _0x836241;});}return null;};}function removeEntity(_0x2dc70d,_0xabb0){return function(_0x34e715){if(_0x34e715){return _0x34e715[_0x13ef('0x32')]()[_0x13ef('0x1c')](function(){_0x2dc70d[_0x13ef('0x2c')](0xcc)[_0x13ef('0x26')]();});}};}function handleEntityNotFound(_0x4927e8,_0x51289e){return function(_0x4b88d9){if(!_0x4b88d9){_0x4927e8[_0x13ef('0x33')](0x194);}return _0x4b88d9;};}function handleError(_0x2e81b5,_0x469b04){_0x469b04=_0x469b04||0x1f4;return function(_0x19972a){logger[_0x13ef('0x21')](_0x19972a[_0x13ef('0x34')]);if(_0x19972a[_0x13ef('0x35')]){delete _0x19972a[_0x13ef('0x35')];}_0x2e81b5[_0x13ef('0x2c')](_0x469b04)[_0x13ef('0x36')](_0x19972a);};}exports[_0x13ef('0x37')]=function(_0x22a2a3,_0x4bf890){var _0xbc9dcb={},_0x3f2546={},_0x173c85={'count':0x0,'rows':[]};var _0x266196=_[_0x13ef('0x38')](db[_0x13ef('0x39')]['rawAttributes'],function(_0x548dc8){return{'name':_0x548dc8[_0x13ef('0x3a')],'type':_0x548dc8['type'][_0x13ef('0x3b')]};});_0x3f2546[_0x13ef('0x3c')]=_[_0x13ef('0x38')](_0x266196,_0x13ef('0x35'));_0x3f2546[_0x13ef('0x3d')]=_[_0x13ef('0x3e')](_0x22a2a3[_0x13ef('0x3d')]);_0x3f2546[_0x13ef('0x3f')]=_[_0x13ef('0x40')](_0x3f2546['model'],_0x3f2546[_0x13ef('0x3d')]);_0xbc9dcb[_0x13ef('0x41')]=_[_0x13ef('0x40')](_0x3f2546[_0x13ef('0x3c')],qs['fields'](_0x22a2a3[_0x13ef('0x3d')][_0x13ef('0x42')]));_0xbc9dcb['attributes']=_0xbc9dcb[_0x13ef('0x41')][_0x13ef('0x43')]?_0xbc9dcb['attributes']:_0x3f2546[_0x13ef('0x3c')];if(!_0x22a2a3['query'][_0x13ef('0x44')]('nolimit')){_0xbc9dcb['limit']=qs[_0x13ef('0x2a')](_0x22a2a3['query']['limit']);_0xbc9dcb['offset']=qs[_0x13ef('0x28')](_0x22a2a3['query']['offset']);}_0xbc9dcb[_0x13ef('0x45')]=qs[_0x13ef('0x46')](_0x22a2a3[_0x13ef('0x3d')][_0x13ef('0x46')]);_0xbc9dcb[_0x13ef('0x47')]=qs[_0x13ef('0x3f')](_[_0x13ef('0x48')](_0x22a2a3['query'],_0x3f2546['filters']),_0x266196);if(_0x22a2a3[_0x13ef('0x3d')]['filter']){_0xbc9dcb[_0x13ef('0x47')]=_[_0x13ef('0x49')](_0xbc9dcb[_0x13ef('0x47')],{'$or':_[_0x13ef('0x38')](_0x266196,function(_0x542d92){if(_0x542d92[_0x13ef('0x4a')]!==_0x13ef('0x4b')){var _0x16da3b={};_0x16da3b[_0x542d92[_0x13ef('0x35')]]={'$like':'%'+_0x22a2a3['query'][_0x13ef('0x4c')]+'%'};return _0x16da3b;}})});}_0xbc9dcb=_[_0x13ef('0x49')]({},_0xbc9dcb,_0x22a2a3[_0x13ef('0x4d')]);var _0x211b01={'where':_0xbc9dcb[_0x13ef('0x47')]};return db[_0x13ef('0x39')][_0x13ef('0x2b')](_0x211b01)['then'](function(_0x57dc29){_0x173c85[_0x13ef('0x2b')]=_0x57dc29;if(_0x22a2a3[_0x13ef('0x3d')][_0x13ef('0x4e')]){_0xbc9dcb['include']=[{'all':!![]}];}return db[_0x13ef('0x39')][_0x13ef('0x4f')](_0xbc9dcb);})['then'](function(_0x27b953){_0x173c85['rows']=_0x27b953;return _0x173c85;})[_0x13ef('0x1c')](respondWithFilteredResult(_0x4bf890,_0xbc9dcb))['catch'](handleError(_0x4bf890,null));};exports[_0x13ef('0x50')]=function(_0x153554,_0x2ade06){var _0xff3934={'raw':!![],'where':{'id':_0x153554[_0x13ef('0x51')]['id']}},_0x341ce6={};_0x341ce6[_0x13ef('0x3c')]=_[_0x13ef('0x3e')](db[_0x13ef('0x39')][_0x13ef('0x52')]);_0x341ce6['query']=_[_0x13ef('0x3e')](_0x153554[_0x13ef('0x3d')]);_0x341ce6['filters']=_['intersection'](_0x341ce6['model'],_0x341ce6[_0x13ef('0x3d')]);_0xff3934[_0x13ef('0x41')]=_[_0x13ef('0x40')](_0x341ce6[_0x13ef('0x3c')],qs[_0x13ef('0x42')](_0x153554['query'][_0x13ef('0x42')]));_0xff3934[_0x13ef('0x41')]=_0xff3934[_0x13ef('0x41')][_0x13ef('0x43')]?_0xff3934['attributes']:_0x341ce6[_0x13ef('0x3c')];if(_0x153554[_0x13ef('0x3d')][_0x13ef('0x4e')]){_0xff3934[_0x13ef('0x53')]=[{'all':!![]}];}_0xff3934=_[_0x13ef('0x49')]({},_0xff3934,_0x153554[_0x13ef('0x4d')]);return db[_0x13ef('0x39')][_0x13ef('0x54')](_0xff3934)[_0x13ef('0x1c')](handleEntityNotFound(_0x2ade06,null))[_0x13ef('0x1c')](respondWithResult(_0x2ade06,null))['catch'](handleError(_0x2ade06,null));};exports[_0x13ef('0x55')]=function(_0x22441d,_0x1351f6){return db[_0x13ef('0x39')][_0x13ef('0x55')](_0x22441d['body'],{})['then'](respondWithResult(_0x1351f6,0xc9))[_0x13ef('0x25')](handleError(_0x1351f6,null));};exports[_0x13ef('0x31')]=function(_0x342db4,_0x2215be){if(_0x342db4[_0x13ef('0x56')]['id']){delete _0x342db4['body']['id'];}return db[_0x13ef('0x39')][_0x13ef('0x54')]({'where':{'id':_0x342db4[_0x13ef('0x51')]['id']}})[_0x13ef('0x1c')](handleEntityNotFound(_0x2215be,null))[_0x13ef('0x1c')](saveUpdates(_0x342db4[_0x13ef('0x56')],null))[_0x13ef('0x1c')](respondWithResult(_0x2215be,null))['catch'](handleError(_0x2215be,null));};exports['destroy']=function(_0x2b793d,_0x49035d){return db[_0x13ef('0x39')][_0x13ef('0x54')]({'where':{'id':_0x2b793d['params']['id']}})[_0x13ef('0x1c')](handleEntityNotFound(_0x49035d,null))[_0x13ef('0x1c')](removeEntity(_0x49035d,null))[_0x13ef('0x25')](handleError(_0x49035d,null));};exports[_0x13ef('0x57')]=function(_0x17b38f,_0x290f50){return db[_0x13ef('0x39')][_0x13ef('0x57')]()[_0x13ef('0x1c')](respondWithResult(_0x290f50,null))['catch'](handleError(_0x290f50,null));};var interaction_log=require('../../config/logger')('openchannel-interactions');exports['accept']=function(_0x1ddb42,_0x569c2c,_0xfdbd20){var _0x502777={'agent':{},'channel':'openchannel'};if(_0x1ddb42[_0x13ef('0x56')]['id']){delete _0x1ddb42[_0x13ef('0x56')]['id'];}_0x1ddb42['body'][_0x13ef('0x58')]=!![];_0x1ddb42[_0x13ef('0x56')][_0x13ef('0x59')]=moment()[_0x13ef('0x5a')]('YYYY-MM-DD\x20HH:mm:ss');_0x1ddb42[_0x13ef('0x56')][_0x13ef('0x5b')]=_0x1ddb42[_0x13ef('0x56')][_0x13ef('0x5b')]||_0x1ddb42[_0x13ef('0x5c')]['id'];_0x502777[_0x13ef('0x5d')]['id']=_0x1ddb42['body'][_0x13ef('0x5b')];return db[_0x13ef('0x39')][_0x13ef('0x54')]({'where':{'id':_0x1ddb42[_0x13ef('0x51')]['id'],'UserId':null}})[_0x13ef('0x1c')](handleEntityNotFound(_0x569c2c,null))[_0x13ef('0x1c')](saveUpdates(_0x1ddb42[_0x13ef('0x56')],null))[_0x13ef('0x1c')](function(_0x211f25){if(_0x211f25){_0x502777[_0x13ef('0x22')]=_0x211f25[_0x13ef('0x5e')]({'plain':!![]});return db[_0x13ef('0x5f')][_0x13ef('0x54')]({'where':{'id':_0x211f25[_0x13ef('0x60')]}});}return null;})[_0x13ef('0x1c')](handleEntityNotFound(_0x569c2c,null))['then'](function(_0x208be4){if(_0x208be4){return _0x208be4[_0x13ef('0x31')]({'UserId':_0x1ddb42['body'][_0x13ef('0x5b')],'read1stAt':_[_0x13ef('0x61')](_0x208be4[_0x13ef('0x62')])?moment()[_0x13ef('0x5a')](_0x13ef('0x63')):undefined});}return null;})[_0x13ef('0x1c')](function(_0x4ff2db){if(_0x4ff2db){_0x502777[_0x13ef('0x64')]=_0x4ff2db[_0x13ef('0x5e')]({'plain':!![]});interaction_log[_0x13ef('0x23')](_0x13ef('0x65'),_0x1ddb42[_0x13ef('0x5c')]['id'],_0x1ddb42[_0x13ef('0x5c')][_0x13ef('0x35')],_0x1ddb42[_0x13ef('0x5c')][_0x13ef('0x66')],_0x502777[_0x13ef('0x64')]['id'],_0x1ddb42[_0x13ef('0x56')]?JSON['stringify'](_0x1ddb42[_0x13ef('0x56')]):_0x13ef('0x67'));return respondWithRpcPromise(_0x13ef('0x68'),'acceptMessage',_0x502777);}return null;})[_0x13ef('0x1c')](function(_0x28bff3){var _0x4e567b=_0x13ef('0x69')+_0x28bff3[_0x13ef('0x22')][_0x13ef('0x6a')];return db['sequelize'][_0x13ef('0x3d')](_0x4e567b,{'type':db[_0x13ef('0x6b')][_0x13ef('0x6c')][_0x13ef('0x6d')],'raw':!![]})[_0x13ef('0x1c')](function(_0x2bd41d){return _0x2bd41d;});})[_0x13ef('0x1c')](function(_0x1ac046){if(_0x1ac046){_0x502777[_0x13ef('0x22')]['contact']=_0x1ac046[0x0];if(!_0x1ddb42[_0x13ef('0x56')][_0x13ef('0x5b')])return;return db[_0x13ef('0x6e')][_0x13ef('0x54')]({'where':{'id':_0x1ddb42[_0x13ef('0x56')][_0x13ef('0x5b')],'role':_0x13ef('0x5d')},'attributes':['id','name',_0x13ef('0x6f'),'email',_0x13ef('0x70')],'raw':!![]});}return null;})[_0x13ef('0x1c')](function(_0x5f2598){if(!_0x5f2598)return null;_0x502777[_0x13ef('0x22')][_0x13ef('0x5d')]=_0x5f2598;return _0x502777;})[_0x13ef('0x1c')](function(_0x59fa73){if(_0x59fa73){if(_0x1ddb42['body'][_0x13ef('0x71')]){_0x502777[_0x13ef('0x22')]['interface']=util['format']('SIP/%s',_0x1ddb42[_0x13ef('0x5c')]['name']);_0x502777[_0x13ef('0x22')][_0x13ef('0x72')]=_0x502777[_0x13ef('0x72')];_0x502777[_0x13ef('0x22')][_0x13ef('0x73')]=_0x502777[_0x13ef('0x72')];_0x502777[_0x13ef('0x22')][_0x13ef('0x74')]=_0x13ef('0x75');return respondWithRpcPromise('EventManager',_0x13ef('0x76'),{'event':_0x13ef('0x77'),'message':_0x502777['message']},client9002)[_0x13ef('0x1c')](function(){return _0x502777;});}return _0x502777;}return null;})[_0x13ef('0x1c')](respondWithResult(_0x569c2c,null))[_0x13ef('0x25')](handleError(_0x569c2c,null));};var interaction_log=require('../../config/logger')(_0x13ef('0x78'));exports['reject']=function(_0x1db152,_0x1fdebc,_0x19f7af){var _0x3f2745={'agent':{},'channel':_0x13ef('0x79')};if(_0x1db152[_0x13ef('0x56')]['id']){delete _0x1db152[_0x13ef('0x56')]['id'];}_0x1db152[_0x13ef('0x56')]['UserId']=_0x1db152[_0x13ef('0x56')][_0x13ef('0x5b')]||_0x1db152[_0x13ef('0x5c')]['id'];_0x3f2745['agent']['id']=_0x1db152['body'][_0x13ef('0x5b')];return db[_0x13ef('0x39')]['find']({'where':{'id':_0x1db152[_0x13ef('0x51')]['id'],'UserId':null}})[_0x13ef('0x1c')](handleEntityNotFound(_0x1fdebc,null))['then'](function(_0x48d662){if(_0x48d662){_0x3f2745[_0x13ef('0x22')]=_0x48d662[_0x13ef('0x5e')]({'plain':!![]});return db[_0x13ef('0x5f')]['find']({'where':{'id':_0x48d662[_0x13ef('0x60')]}});}return null;})['then'](handleEntityNotFound(_0x1fdebc,null))[_0x13ef('0x1c')](function(_0x305025){if(_0x305025){_0x3f2745['interaction']=_0x305025[_0x13ef('0x5e')]({'plain':!![]});interaction_log['info'](_0x13ef('0x7a'),_0x1db152[_0x13ef('0x5c')]['id'],_0x1db152['user'][_0x13ef('0x35')],_0x1db152[_0x13ef('0x5c')][_0x13ef('0x66')],_0x3f2745['interaction']['id'],_0x1db152[_0x13ef('0x56')]?JSON[_0x13ef('0x7b')](_0x1db152[_0x13ef('0x56')]):'null');return respondWithRpcPromise(_0x13ef('0x7c'),_0x13ef('0x7d'),_0x3f2745);}return null;})[_0x13ef('0x1c')](function(_0x199720){var _0x5ee365=_0x13ef('0x69')+_0x199720[_0x13ef('0x22')][_0x13ef('0x6a')];return db[_0x13ef('0x7e')]['query'](_0x5ee365,{'type':db[_0x13ef('0x6b')][_0x13ef('0x6c')][_0x13ef('0x6d')],'raw':!![]})[_0x13ef('0x1c')](function(_0x4c9ba0){return _0x4c9ba0;});})['then'](function(_0x2eed1e){if(_0x2eed1e){_0x3f2745[_0x13ef('0x22')][_0x13ef('0x7f')]=_0x2eed1e[0x0];if(!_0x1db152[_0x13ef('0x56')]['UserId'])return;return db['User'][_0x13ef('0x54')]({'where':{'id':_0x1db152['body'][_0x13ef('0x5b')],'role':'agent'},'attributes':['id','name',_0x13ef('0x6f'),_0x13ef('0x80'),_0x13ef('0x70')],'raw':!![]});}return null;})[_0x13ef('0x1c')](function(_0x32f3c5){if(!_0x32f3c5)return null;_0x3f2745[_0x13ef('0x22')][_0x13ef('0x5d')]=_0x32f3c5;return _0x3f2745;})['then'](function(_0x589c2e){if(_0x589c2e){_0x589c2e[_0x13ef('0x22')][_0x13ef('0x81')]=util['format'](_0x13ef('0x82'),_0x1db152[_0x13ef('0x5c')][_0x13ef('0x35')]);_0x589c2e[_0x13ef('0x22')][_0x13ef('0x72')]=_0x3f2745[_0x13ef('0x72')];_0x589c2e[_0x13ef('0x22')]['motionChannel']=_0x3f2745[_0x13ef('0x72')];_0x589c2e['message'][_0x13ef('0x74')]=_0x13ef('0x2f');respondWithRpcPromise(_0x13ef('0x76'),_0x13ef('0x76'),{'event':'rejectmessage','message':_0x589c2e['message']},client9002);return _0x3f2745;}return null;})['then'](respondWithResult(_0x1fdebc,null))[_0x13ef('0x25')](handleError(_0x1fdebc,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 79471a9..c301fa1 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 _0x3de6=['hasOwnProperty','exports','events','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','remove','emit'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x3de6,0xe8));var _0x63de=function(_0x30ba40,_0x4700b1){_0x30ba40=_0x30ba40-0x0;var _0x2f8670=_0x3de6[_0x30ba40];return _0x2f8670;};'use strict';var EventEmitter=require(_0x63de('0x0'));var OpenchannelMessage=require(_0x63de('0x1'))['db'][_0x63de('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x63de('0x3')](0x0);var events={'afterCreate':_0x63de('0x4'),'afterUpdate':_0x63de('0x5'),'afterDestroy':_0x63de('0x6')};function emitEvent(_0x93a9b5){return function(_0x594b3f,_0x3e3d0d,_0x56ff55){OpenchannelMessageEvents[_0x63de('0x7')](_0x93a9b5+':'+_0x594b3f['id'],_0x594b3f);OpenchannelMessageEvents[_0x63de('0x7')](_0x93a9b5,_0x594b3f);_0x56ff55(null);};}for(var e in events){if(events[_0x63de('0x8')](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module[_0x63de('0x9')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x9078=['save','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','OpenchannelMessage'];(function(_0x4268a0,_0x482e91){var _0x260f31=function(_0x433680){while(--_0x433680){_0x4268a0['push'](_0x4268a0['shift']());}};_0x260f31(++_0x482e91);}(_0x9078,0xd6));var _0x8907=function(_0x1c87f1,_0x30f181){_0x1c87f1=_0x1c87f1-0x0;var _0x3442f6=_0x9078[_0x1c87f1];return _0x3442f6;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0x8907('0x0'))['db'][_0x8907('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8907('0x2'),'afterUpdate':'update','afterDestroy':_0x8907('0x3')};function emitEvent(_0x22f3a3){return function(_0x4dfc5b,_0x2d6f9e,_0x42ee79){OpenchannelMessageEvents[_0x8907('0x4')](_0x22f3a3+':'+_0x4dfc5b['id'],_0x4dfc5b);OpenchannelMessageEvents[_0x8907('0x4')](_0x22f3a3,_0x4dfc5b);_0x42ee79(null);};}for(var e in events){if(events[_0x8907('0x5')](e)){var event=events[e];OpenchannelMessage[_0x8907('0x6')](e,emitEvent(event));}}module[_0x8907('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 5f7f24e..6b66c69 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 _0x54bf=['secret','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','update','createdAt','catch','error','CmContact','describe','OpenchannelAccount','OpenchannelAccountId','keys','replyUri','info','afterCreate','format','Interactions','Contact','POST','method','GET','OpenchannelMessage,\x20%s,\x20%s','threadId','Interaction','inspect','finally','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','bluebird','../../config/environment','./openchannelMessage.attributes','openchannel_messages','body','FULLTEXT','models','direction','toLowerCase','out'];(function(_0x483d8b,_0x526c52){var _0x6500f1=function(_0x372797){while(--_0x372797){_0x483d8b['push'](_0x483d8b['shift']());}};_0x6500f1(++_0x526c52);}(_0x54bf,0xa7));var _0xf54b=function(_0xf48efb,_0x307c7f){_0xf48efb=_0xf48efb-0x0;var _0x179636=_0x54bf[_0xf48efb];return _0x179636;};'use strict';var _=require(_0xf54b('0x0'));var util=require('util');var logger=require(_0xf54b('0x1'))(_0xf54b('0x2'));var moment=require('moment');var BPromise=require(_0xf54b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf54b('0x4'));var attributes=require(_0xf54b('0x5'));module['exports']=function(_0x46b36d,_0x4a34b7){return _0x46b36d['define']('OpenchannelMessage',attributes,{'tableName':_0xf54b('0x6'),'paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':[_0xf54b('0x7')],'type':_0xf54b('0x8')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x163772,_0xd7420e,_0x492440){var _0x2fb09c=_0x46b36d[_0xf54b('0x9')];var _0x164ec3=_0x163772['get']({'plain':!![]});if(_0x164ec3[_0xf54b('0xa')][_0xf54b('0xb')]()==='in'||_0x164ec3['direction'][_0xf54b('0xb')]()===_0xf54b('0xc')&&!_0x164ec3[_0xf54b('0xd')]&&!_[_0xf54b('0xe')](_0x164ec3[_0xf54b('0xf')])){_0x2fb09c[_0xf54b('0x10')][_0xf54b('0x11')]({'where':{'id':_0x164ec3[_0xf54b('0x12')]}})[_0xf54b('0x13')](function(_0x1d5b51){if(_0x1d5b51){_0x1d5b51[_0xf54b('0x14')]({'lastMsgAt':_0x164ec3[_0xf54b('0x15')],'lastMsgDirection':_0x164ec3[_0xf54b('0xa')][_0xf54b('0xb')]()});}})[_0xf54b('0x16')](function(_0x4d5abc){console[_0xf54b('0x17')](_0x4d5abc);});}if(_0x164ec3[_0xf54b('0xa')]===_0xf54b('0xc')&&!_0x164ec3['secret']){var _0x1acf31;_0x2fb09c[_0xf54b('0x18')][_0xf54b('0x19')]()[_0xf54b('0x13')](function(_0x24c769){return _0x2fb09c[_0xf54b('0x1a')]['find']({'where':{'id':_0x164ec3[_0xf54b('0x1b')]},'include':[{'model':_0x2fb09c[_0xf54b('0x10')],'as':'Interactions','where':{'id':_0x164ec3[_0xf54b('0x12')]},'limit':0x1,'include':[{'model':_0x2fb09c['CmContact'],'as':'Contact','attributes':_[_0xf54b('0x1c')](_0x24c769)}]}]});})['then'](function(_0x27ea63){_0x1acf31=_0x27ea63['get']({'plain':!![]});if(_0x1acf31&&_0x1acf31[_0xf54b('0x1d')]){logger[_0xf54b('0x1e')]('OpenchannelMessage,\x20%s,\x20%s',_0xf54b('0x1f'),util[_0xf54b('0x20')]('Forwarding\x20message\x20%d\x20to\x20%s',_0x164ec3['id'],_0x1acf31['replyUri']));if(_0x1acf31[_0xf54b('0x21')]&&_0x1acf31[_0xf54b('0x21')]['length']){_0x164ec3['Interaction']=_['omit'](_0x1acf31[_0xf54b('0x21')][0x0],'Contact');_0x164ec3[_0xf54b('0x22')]=_0x1acf31[_0xf54b('0x21')][0x0]['Contact'];}var _0xd7420e={'method':_0xf54b('0x23'),'uri':encodeURI(_0x1acf31['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0xd7420e[_0xf54b('0x24')]){case _0xf54b('0x25'):_0xd7420e['qs']=_0x164ec3;break;case _0xf54b('0x23'):_0xd7420e['body']=_0x164ec3;break;}return rp(_0xd7420e)['then'](function(_0x5cd3e9){logger[_0xf54b('0x1e')](_0xf54b('0x26'),_0xf54b('0x1f'),util[_0xf54b('0x20')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x164ec3['id'],_0x1acf31[_0xf54b('0x1d')]));if(_0x5cd3e9[_0xf54b('0x7')][_0xf54b('0x27')]&&_0x5cd3e9['body'][_0xf54b('0x27')]!=_0x164ec3['Interaction']['threadId']){return _0x2fb09c['OpenchannelInteraction']['update']({'threadId':_0x5cd3e9[_0xf54b('0x7')][_0xf54b('0x27')]},{'where':{'id':_0x164ec3[_0xf54b('0x28')]['id']}});}else{return;}})[_0xf54b('0x13')](function(){return _0x163772[_0xf54b('0x14')]({'read':!![]});})[_0xf54b('0x16')](function(_0x548608){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0xf54b('0x1f'),util[_0xf54b('0x29')](_0x548608,{'showHidden':![],'depth':null}));_0x492440();});}else{_0x492440();}})[_0xf54b('0x2a')](function(){_0x492440();});}else{_0x492440();}}},'charset':_0xf54b('0x2b'),'collate':_0xf54b('0x2c')});}; \ No newline at end of file +var _0x90fc=['fti_openchannel_messages','FULLTEXT','models','get','direction','toLowerCase','out','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','update','catch','error','CmContact','describe','OpenchannelAccount','find','OpenchannelAccountId','Interactions','Contact','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','Forwarding\x20message\x20%d\x20to\x20%s','omit','method','GET','POST','body','Message\x20%d\x20forwarded\x20to\x20%s','threadId','Interaction','inspect','finally','utf8mb4','util','moment','bluebird','path','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0x90fc,0x89));var _0xc90f=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0x90fc[_0x2235bf];return _0x4c3a64;};'use strict';var _=require('lodash');var util=require(_0xc90f('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xc90f('0x1'));var BPromise=require(_0xc90f('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc90f('0x3'));var rimraf=require('rimraf');var config=require(_0xc90f('0x4'));var attributes=require(_0xc90f('0x5'));module[_0xc90f('0x6')]=function(_0x4849f0,_0x9a1c54){return _0x4849f0[_0xc90f('0x7')](_0xc90f('0x8'),attributes,{'tableName':_0xc90f('0x9'),'paranoid':![],'indexes':[{'name':_0xc90f('0xa'),'fields':['body'],'type':_0xc90f('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4d17a1,_0x53a54b,_0x519b9e){var _0xf46101=_0x4849f0[_0xc90f('0xc')];var _0x4237e8=_0x4d17a1[_0xc90f('0xd')]({'plain':!![]});if(_0x4237e8['direction']['toLowerCase']()==='in'||_0x4237e8[_0xc90f('0xe')][_0xc90f('0xf')]()===_0xc90f('0x10')&&!_0x4237e8['secret']&&!_['isNil'](_0x4237e8[_0xc90f('0x11')])){_0xf46101[_0xc90f('0x12')][_0xc90f('0x13')]({'where':{'id':_0x4237e8[_0xc90f('0x14')]}})[_0xc90f('0x15')](function(_0x24ef58){if(_0x24ef58){_0x24ef58[_0xc90f('0x16')]({'lastMsgAt':_0x4237e8['createdAt'],'lastMsgDirection':_0x4237e8[_0xc90f('0xe')][_0xc90f('0xf')]()});}})[_0xc90f('0x17')](function(_0x4a3f44){console[_0xc90f('0x18')](_0x4a3f44);});}if(_0x4237e8[_0xc90f('0xe')]===_0xc90f('0x10')&&!_0x4237e8['secret']){var _0x4eb2b9;_0xf46101[_0xc90f('0x19')][_0xc90f('0x1a')]()[_0xc90f('0x15')](function(_0x5e4e27){return _0xf46101[_0xc90f('0x1b')][_0xc90f('0x1c')]({'where':{'id':_0x4237e8[_0xc90f('0x1d')]},'include':[{'model':_0xf46101[_0xc90f('0x12')],'as':_0xc90f('0x1e'),'where':{'id':_0x4237e8['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0xf46101['CmContact'],'as':_0xc90f('0x1f'),'attributes':_[_0xc90f('0x20')](_0x5e4e27)}]}]});})[_0xc90f('0x15')](function(_0x51242c){_0x4eb2b9=_0x51242c[_0xc90f('0xd')]({'plain':!![]});if(_0x4eb2b9&&_0x4eb2b9[_0xc90f('0x21')]){logger[_0xc90f('0x22')](_0xc90f('0x23'),_0xc90f('0x24'),util['format'](_0xc90f('0x25'),_0x4237e8['id'],_0x4eb2b9[_0xc90f('0x21')]));if(_0x4eb2b9[_0xc90f('0x1e')]&&_0x4eb2b9[_0xc90f('0x1e')]['length']){_0x4237e8['Interaction']=_[_0xc90f('0x26')](_0x4eb2b9[_0xc90f('0x1e')][0x0],_0xc90f('0x1f'));_0x4237e8['Contact']=_0x4eb2b9[_0xc90f('0x1e')][0x0][_0xc90f('0x1f')];}var _0x53a54b={'method':'POST','uri':encodeURI(_0x4eb2b9[_0xc90f('0x21')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x53a54b[_0xc90f('0x27')]){case _0xc90f('0x28'):_0x53a54b['qs']=_0x4237e8;break;case _0xc90f('0x29'):_0x53a54b[_0xc90f('0x2a')]=_0x4237e8;break;}return rp(_0x53a54b)['then'](function(_0x55f165){logger['info'](_0xc90f('0x23'),_0xc90f('0x24'),util['format'](_0xc90f('0x2b'),_0x4237e8['id'],_0x4eb2b9[_0xc90f('0x21')]));if(_0x55f165[_0xc90f('0x2a')]['threadId']&&_0x55f165[_0xc90f('0x2a')][_0xc90f('0x2c')]!=_0x4237e8['Interaction'][_0xc90f('0x2c')]){return _0xf46101['OpenchannelInteraction'][_0xc90f('0x16')]({'threadId':_0x55f165[_0xc90f('0x2a')]['threadId']},{'where':{'id':_0x4237e8[_0xc90f('0x2d')]['id']}});}else{return;}})[_0xc90f('0x15')](function(){return _0x4d17a1[_0xc90f('0x16')]({'read':!![]});})[_0xc90f('0x17')](function(_0x2da0ea){logger[_0xc90f('0x18')]('OpenchannelMessage,\x20%s,\x20%s','afterCreate',util[_0xc90f('0x2e')](_0x2da0ea,{'showHidden':![],'depth':null}));_0x519b9e();});}else{_0x519b9e();}})[_0xc90f('0x2f')](function(){_0x519b9e();});}else{_0x519b9e();}}},'charset':_0xc90f('0x30'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index f047139..33455c8 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 _0xdb28=['then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateOpenchannelMessage','OpenchannelMessage','create','body','options','raw','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','request'];(function(_0x4314c9,_0x1a6d36){var _0x1f8798=function(_0x27858f){while(--_0x27858f){_0x4314c9['push'](_0x4314c9['shift']());}};_0x1f8798(++_0x1a6d36);}(_0xdb28,0x106));var _0x8db2=function(_0xe1b4ce,_0x4afb05){_0xe1b4ce=_0xe1b4ce-0x0;var _0x274a82=_0xdb28[_0xe1b4ce];return _0x274a82;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});config['redis']=_[_0x8db2('0xb')](config[_0x8db2('0xc')],{'host':_0x8db2('0xd'),'port':0x18eb});var socket=require(_0x8db2('0xe'))(new Redis(config[_0x8db2('0xc')]));require(_0x8db2('0xf'))[_0x8db2('0x10')](socket);function respondWithRpcPromise(_0x4ba340,_0x30dc90,_0x476216){return new BPromise(function(_0x1f62af,_0x57015f){return client[_0x8db2('0x11')](_0x4ba340,_0x476216)[_0x8db2('0x12')](function(_0x576475){logger[_0x8db2('0x13')](_0x8db2('0x14'),_0x30dc90,_0x8db2('0x15'));logger[_0x8db2('0x16')](_0x8db2('0x17'),_0x30dc90,'request\x20sent',JSON['stringify'](_0x576475));if(_0x576475[_0x8db2('0x18')]){if(_0x576475[_0x8db2('0x18')][_0x8db2('0x19')]===0x1f4){logger[_0x8db2('0x18')](_0x8db2('0x14'),_0x30dc90,_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);return _0x57015f(_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);}logger[_0x8db2('0x18')]('OpenchannelMessage,\x20%s,\x20%s',_0x30dc90,_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);return _0x1f62af(_0x576475['error'][_0x8db2('0x1a')]);}else{logger[_0x8db2('0x13')](_0x8db2('0x14'),_0x30dc90,_0x8db2('0x15'));_0x1f62af(_0x576475[_0x8db2('0x1b')][_0x8db2('0x1a')]);}})['catch'](function(_0x5df464){logger[_0x8db2('0x18')](_0x8db2('0x14'),_0x30dc90,_0x5df464);_0x57015f(_0x5df464);});});}exports[_0x8db2('0x1c')]=function(_0x1b64e4){var _0x58562e=this;return new Promise(function(_0x431d60,_0x36a9ff){return db[_0x8db2('0x1d')][_0x8db2('0x1e')](_0x1b64e4[_0x8db2('0x1f')],{'raw':_0x1b64e4['options']?_0x1b64e4[_0x8db2('0x20')][_0x8db2('0x21')]===undefined?!![]:![]:!![]})[_0x8db2('0x12')](function(_0x125be2){logger[_0x8db2('0x13')](_0x8db2('0x1c'),_0x1b64e4);logger[_0x8db2('0x16')]('CreateOpenchannelMessage',_0x1b64e4,JSON[_0x8db2('0x22')](_0x125be2));_0x431d60(_0x125be2);})['catch'](function(_0x5725f0){logger['error']('CreateOpenchannelMessage',_0x5725f0[_0x8db2('0x1a')],_0x1b64e4);_0x36a9ff(_0x58562e[_0x8db2('0x18')](0x1f4,_0x5725f0[_0x8db2('0x1a')]));});});}; \ No newline at end of file +var _0x1261=['../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','localhost','socket.io-emitter','./openchannelMessage.socket','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','OpenchannelMessage','options','raw','then','CreateOpenchannelMessage','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x5b756c,_0x3621b6){var _0x2e0952=function(_0xca7707){while(--_0xca7707){_0x5b756c['push'](_0x5b756c['shift']());}};_0x2e0952(++_0x3621b6);}(_0x1261,0x144));var _0x1126=function(_0x554292,_0x82948a){_0x554292=_0x554292-0x0;var _0x3dd555=_0x1261[_0x554292];return _0x3dd555;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});config[_0x1126('0xb')]=_['defaults'](config[_0x1126('0xb')],{'host':_0x1126('0xc'),'port':0x18eb});var socket=require(_0x1126('0xd'))(new Redis(config[_0x1126('0xb')]));require(_0x1126('0xe'))['register'](socket);function respondWithRpcPromise(_0x3f09ac,_0x18dbe6,_0x167ef1){return new BPromise(function(_0x5e72e2,_0x34571c){return client['request'](_0x3f09ac,_0x167ef1)['then'](function(_0x15c071){logger['info'](_0x1126('0xf'),_0x18dbe6,_0x1126('0x10'));logger[_0x1126('0x11')](_0x1126('0x12'),_0x18dbe6,_0x1126('0x10'),JSON[_0x1126('0x13')](_0x15c071));if(_0x15c071[_0x1126('0x14')]){if(_0x15c071[_0x1126('0x14')][_0x1126('0x15')]===0x1f4){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x18dbe6,_0x15c071[_0x1126('0x14')][_0x1126('0x16')]);return _0x34571c(_0x15c071[_0x1126('0x14')]['message']);}logger[_0x1126('0x14')]('OpenchannelMessage,\x20%s,\x20%s',_0x18dbe6,_0x15c071[_0x1126('0x14')][_0x1126('0x16')]);return _0x5e72e2(_0x15c071[_0x1126('0x14')]['message']);}else{logger[_0x1126('0x17')](_0x1126('0xf'),_0x18dbe6,'request\x20sent');_0x5e72e2(_0x15c071['result'][_0x1126('0x16')]);}})[_0x1126('0x18')](function(_0x58d11a){logger['error'](_0x1126('0xf'),_0x18dbe6,_0x58d11a);_0x34571c(_0x58d11a);});});}exports['CreateOpenchannelMessage']=function(_0x22ed37){var _0x1d6d19=this;return new Promise(function(_0x2f70ac,_0x54400a){return db[_0x1126('0x19')]['create'](_0x22ed37['body'],{'raw':_0x22ed37[_0x1126('0x1a')]?_0x22ed37[_0x1126('0x1a')][_0x1126('0x1b')]===undefined?!![]:![]:!![]})[_0x1126('0x1c')](function(_0x526ca1){logger[_0x1126('0x17')](_0x1126('0x1d'),_0x22ed37);logger['debug'](_0x1126('0x1d'),_0x22ed37,JSON['stringify'](_0x526ca1));_0x2f70ac(_0x526ca1);})['catch'](function(_0x4b57ab){logger[_0x1126('0x14')](_0x1126('0x1d'),_0x4b57ab[_0x1126('0x16')],_0x22ed37);_0x54400a(_0x1d6d19[_0x1126('0x14')](0x1f4,_0x4b57ab[_0x1126('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 52c0b1f..d86e0ef 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 _0x16a7=['register','length','openchannelMessage:','./openchannelMessage.events','save','remove','update','emit','removeListener'];(function(_0xede44e,_0x2540de){var _0x36367b=function(_0x10bad9){while(--_0x10bad9){_0xede44e['push'](_0xede44e['shift']());}};_0x36367b(++_0x2540de);}(_0x16a7,0xa5));var _0x716a=function(_0x4567c8,_0x7a89ba){_0x4567c8=_0x4567c8-0x0;var _0x3117d9=_0x16a7[_0x4567c8];return _0x3117d9;};'use strict';var OpenchannelMessageEvents=require(_0x716a('0x0'));var events=[_0x716a('0x1'),_0x716a('0x2'),_0x716a('0x3')];function createListener(_0x4aa23e,_0x4d0520){return function(_0x437ff8){_0x4d0520[_0x716a('0x4')](_0x4aa23e,_0x437ff8);};}function removeListener(_0x56d122,_0x128002){return function(){OpenchannelMessageEvents[_0x716a('0x5')](_0x56d122,_0x128002);};}exports[_0x716a('0x6')]=function(_0x68977a){for(var _0x22b026=0x0,_0x557d05=events[_0x716a('0x7')];_0x22b026<_0x557d05;_0x22b026++){var _0x1ee0e2=events[_0x22b026];var _0x724309=createListener(_0x716a('0x8')+_0x1ee0e2,_0x68977a);OpenchannelMessageEvents['on'](_0x1ee0e2,_0x724309);}}; \ No newline at end of file +var _0xe767=['update','register','length','openchannelMessage:','save','remove'];(function(_0x51b919,_0x448a9a){var _0x27b072=function(_0xc7cd0){while(--_0xc7cd0){_0x51b919['push'](_0x51b919['shift']());}};_0x27b072(++_0x448a9a);}(_0xe767,0x11e));var _0x7e76=function(_0x449bc7,_0xb4edad){_0x449bc7=_0x449bc7-0x0;var _0x4c7bee=_0xe767[_0x449bc7];return _0x4c7bee;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=[_0x7e76('0x0'),_0x7e76('0x1'),_0x7e76('0x2')];function createListener(_0x431b0e,_0xcb0d17){return function(_0x1418d2){_0xcb0d17['emit'](_0x431b0e,_0x1418d2);};}function removeListener(_0x4fa707,_0x473b73){return function(){OpenchannelMessageEvents['removeListener'](_0x4fa707,_0x473b73);};}exports[_0x7e76('0x3')]=function(_0x5d179a){for(var _0x333c38=0x0,_0x2a703b=events[_0x7e76('0x4')];_0x333c38<_0x2a703b;_0x333c38++){var _0x3aaa07=events[_0x333c38];var _0x46ddea=createListener(_0x7e76('0x5')+_0x3aaa07,_0x5d179a);OpenchannelMessageEvents['on'](_0x3aaa07,_0x46ddea);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index f96c239..9ba208e 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 _0x55a4=['removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','/:id','show','/:id/members','getMembers','/:id/teams','/:id/users','post','addTeams','put','update','delete','destroy'];(function(_0x524201,_0x36b230){var _0x4b5d11=function(_0x260488){while(--_0x260488){_0x524201['push'](_0x524201['shift']());}};_0x4b5d11(++_0x36b230);}(_0x55a4,0x137));var _0x455a=function(_0x359e21,_0x3ce767){_0x359e21=_0x359e21-0x0;var _0x57e35f=_0x55a4[_0x359e21];return _0x57e35f;};'use strict';var multer=require(_0x455a('0x0'));var util=require(_0x455a('0x1'));var path=require(_0x455a('0x2'));var timeout=require(_0x455a('0x3'));var express=require(_0x455a('0x4'));var router=express['Router']();var fs_extra=require(_0x455a('0x5'));var auth=require(_0x455a('0x6'));var interaction=require(_0x455a('0x7'));var config=require(_0x455a('0x8'));var controller=require('./openchannelQueue.controller');router[_0x455a('0x9')]('/',auth['isAuthenticated'](),controller[_0x455a('0xa')]);router[_0x455a('0x9')](_0x455a('0xb'),auth[_0x455a('0xc')](),controller['describe']);router['get'](_0x455a('0xd'),auth[_0x455a('0xc')](),controller[_0x455a('0xe')]);router['get'](_0x455a('0xf'),auth[_0x455a('0xc')](),controller[_0x455a('0x10')]);router[_0x455a('0x9')](_0x455a('0x11'),auth[_0x455a('0xc')](),controller['getTeams']);router[_0x455a('0x9')](_0x455a('0x12'),auth[_0x455a('0xc')](),controller['getAgents']);router[_0x455a('0x13')]('/',auth[_0x455a('0xc')](),controller['create']);router[_0x455a('0x13')](_0x455a('0x11'),auth[_0x455a('0xc')](),controller[_0x455a('0x14')]);router[_0x455a('0x13')](_0x455a('0x12'),auth[_0x455a('0xc')](),controller['addAgents']);router[_0x455a('0x15')](_0x455a('0xd'),auth[_0x455a('0xc')](),controller[_0x455a('0x16')]);router[_0x455a('0x17')](_0x455a('0xd'),auth[_0x455a('0xc')](),controller[_0x455a('0x18')]);router[_0x455a('0x17')](_0x455a('0x11'),auth[_0x455a('0xc')](),controller[_0x455a('0x19')]);router[_0x455a('0x17')](_0x455a('0x12'),auth[_0x455a('0xc')](),controller[_0x455a('0x1a')]);module[_0x455a('0x1b')]=router; \ No newline at end of file +var _0x49a3=['/:id/members','getMembers','/:id/teams','/:id/users','post','addTeams','addAgents','put','delete','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelQueue.controller','isAuthenticated','index','describe','get','/:id','show'];(function(_0x177026,_0x259fae){var _0x4557d0=function(_0x4b80b8){while(--_0x4b80b8){_0x177026['push'](_0x177026['shift']());}};_0x4557d0(++_0x259fae);}(_0x49a3,0x192));var _0x349a=function(_0x5afc8b,_0x1dfa0e){_0x5afc8b=_0x5afc8b-0x0;var _0x47bf45=_0x49a3[_0x5afc8b];return _0x47bf45;};'use strict';var multer=require(_0x349a('0x0'));var util=require(_0x349a('0x1'));var path=require(_0x349a('0x2'));var timeout=require(_0x349a('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x349a('0x4'));var auth=require(_0x349a('0x5'));var interaction=require(_0x349a('0x6'));var config=require('../../config/environment');var controller=require(_0x349a('0x7'));router['get']('/',auth[_0x349a('0x8')](),controller[_0x349a('0x9')]);router['get']('/describe',auth[_0x349a('0x8')](),controller[_0x349a('0xa')]);router[_0x349a('0xb')](_0x349a('0xc'),auth['isAuthenticated'](),controller[_0x349a('0xd')]);router[_0x349a('0xb')](_0x349a('0xe'),auth[_0x349a('0x8')](),controller[_0x349a('0xf')]);router[_0x349a('0xb')](_0x349a('0x10'),auth['isAuthenticated'](),controller['getTeams']);router['get'](_0x349a('0x11'),auth[_0x349a('0x8')](),controller['getAgents']);router[_0x349a('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0x349a('0x12')](_0x349a('0x10'),auth[_0x349a('0x8')](),controller[_0x349a('0x13')]);router[_0x349a('0x12')](_0x349a('0x11'),auth[_0x349a('0x8')](),controller[_0x349a('0x14')]);router[_0x349a('0x15')](_0x349a('0xc'),auth[_0x349a('0x8')](),controller['update']);router[_0x349a('0x16')]('/:id',auth[_0x349a('0x8')](),controller['destroy']);router['delete'](_0x349a('0x10'),auth[_0x349a('0x8')](),controller[_0x349a('0x17')]);router[_0x349a('0x16')](_0x349a('0x11'),auth[_0x349a('0x8')](),controller[_0x349a('0x18')]);module[_0x349a('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 e76a128..72beae8 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 _0xfb61=['beepall','sequelize','exports','STRING','name','ENUM'];(function(_0x35da42,_0x5c2610){var _0x370035=function(_0x546db5){while(--_0x546db5){_0x35da42['push'](_0x35da42['shift']());}};_0x370035(++_0x5c2610);}(_0xfb61,0x67));var _0x1fb6=function(_0x19a49f,_0x444d74){_0x19a49f=_0x19a49f-0x0;var _0x5351ae=_0xfb61[_0x19a49f];return _0x5351ae;};'use strict';var Sequelize=require(_0x1fb6('0x0'));module[_0x1fb6('0x1')]={'name':{'type':Sequelize[_0x1fb6('0x2')],'unique':_0x1fb6('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x1fb6('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x1fb6('0x4')]('rrmemory',_0x1fb6('0x5'),'roundrobin')}}; \ No newline at end of file +var _0x736b=['roundrobin','sequelize','STRING','name','INTEGER','ENUM','rrmemory'];(function(_0x29686e,_0x191cb6){var _0x20b34a=function(_0x44ed64){while(--_0x44ed64){_0x29686e['push'](_0x29686e['shift']());}};_0x20b34a(++_0x191cb6);}(_0x736b,0xcc));var _0xb736=function(_0x5ac1d2,_0x2b0d84){_0x5ac1d2=_0x5ac1d2-0x0;var _0x2cf2f0=_0x736b[_0x5ac1d2];return _0x2cf2f0;};'use strict';var Sequelize=require(_0xb736('0x0'));module['exports']={'name':{'type':Sequelize[_0xb736('0x1')],'unique':_0xb736('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xb736('0x1')]},'timeout':{'type':Sequelize[_0xb736('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xb736('0x4')](_0xb736('0x5'),'beepall',_0xb736('0x6'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 76aad79..5fafa78 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 _0x5c70=['Team','order','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','forEach','emit','userOpenchannelQueue:save','removeTeams','select','field','tq.TeamId','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','every','includes','all','union','value','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','spread','isArray','getAgents','pick','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','OpenchannelQueues','UserProfileResource','destroy','error','stack','name','send','index','map','OpenchannelQueue','fieldName','key','getOptions','where','include','query','catch','show','params','model','keys','rawAttributes','intersection','attributes','fields','length','includeAll','merge','options','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','findOne','filters','hasOwnProperty','nolimit','sort','filter','UserOpenchannelQueue','findAll','User','UserId','agent','updatedAt','createdAt','format','%s/%s','SIP','getTeams'];(function(_0x46ad9e,_0x203184){var _0x5727cb=function(_0x32a93e){while(--_0x32a93e){_0x46ad9e['push'](_0x46ad9e['shift']());}};_0x5727cb(++_0x203184);}(_0x5c70,0xa3));var _0x05c7=function(_0x2fbf89,_0x176496){_0x2fbf89=_0x2fbf89-0x0;var _0x169fcf=_0x5c70[_0x2fbf89];return _0x169fcf;};'use strict';var BPromise=require(_0x05c7('0x0'));var util=require(_0x05c7('0x1'));var _=require(_0x05c7('0x2'));var squel=require(_0x05c7('0x3'));var Redis=require(_0x05c7('0x4'));var qs=require(_0x05c7('0x5'));var logger=require('../../config/logger')(_0x05c7('0x6'));var config=require(_0x05c7('0x7'));var db=require(_0x05c7('0x8'))['db'];config[_0x05c7('0x9')]=_['defaults'](config['redis'],{'host':_0x05c7('0xa'),'port':0x18eb});var socket=require(_0x05c7('0xb'))(new Redis(config['redis']));require(_0x05c7('0xc'))[_0x05c7('0xd')](socket);function respondWithStatusCode(_0x51c6b3,_0x289135){_0x289135=_0x289135||0xcc;return function(_0x584c47){if(_0x584c47){return _0x51c6b3[_0x05c7('0xe')](_0x289135);}return _0x51c6b3[_0x05c7('0xf')](_0x289135)[_0x05c7('0x10')]();};}function respondWithResult(_0x5b88a0,_0x485057){_0x485057=_0x485057||0xc8;return function(_0x5b3cb7){if(_0x5b3cb7){return _0x5b88a0[_0x05c7('0xf')](_0x485057)[_0x05c7('0x11')](_0x5b3cb7);}};}function respondWithFilteredResult(_0x235f2d,_0x4774f7){return function(_0x465b2){if(_0x465b2){var _0x15661f=typeof _0x4774f7[_0x05c7('0x12')]===_0x05c7('0x13')&&typeof _0x4774f7[_0x05c7('0x14')]===_0x05c7('0x13');var _0x1b06eb=_0x465b2[_0x05c7('0x15')];var _0x50f041=_0x15661f?0x0:_0x4774f7[_0x05c7('0x12')];var _0x20dc6e=_0x15661f?_0x465b2[_0x05c7('0x15')]:_0x4774f7[_0x05c7('0x12')]+_0x4774f7[_0x05c7('0x14')];var _0x3e8757;if(_0x20dc6e>=_0x1b06eb){_0x20dc6e=_0x1b06eb;_0x3e8757=0xc8;}else{_0x3e8757=0xce;}_0x235f2d[_0x05c7('0xf')](_0x3e8757);return _0x235f2d[_0x05c7('0x16')](_0x05c7('0x17'),_0x50f041+'-'+_0x20dc6e+'/'+_0x1b06eb)['json'](_0x465b2);}return null;};}function saveUpdates(_0x7d1e10){return function(_0x28455c){if(_0x28455c){return _0x28455c[_0x05c7('0x18')](_0x7d1e10)[_0x05c7('0x19')](function(_0x70bdcf){return _0x70bdcf;});}return null;};}function removeEntity(_0x52fa67){return function(_0x3ef0ea){if(_0x3ef0ea){return _0x3ef0ea['destroy']()['then'](function(){var _0x30346c=_0x3ef0ea['get']({'plain':!![]});var _0x56c5fa=_0x05c7('0x1a');return db[_0x05c7('0x1b')][_0x05c7('0x1c')]({'where':{'type':_0x56c5fa,'resourceId':_0x30346c['id']}})['then'](function(){return _0x3ef0ea;});})[_0x05c7('0x19')](function(){_0x52fa67[_0x05c7('0xf')](0xcc)[_0x05c7('0x10')]();});}};}function handleEntityNotFound(_0x52700b){return function(_0x2c19e9){if(!_0x2c19e9){_0x52700b[_0x05c7('0xe')](0x194);}return _0x2c19e9;};}function handleError(_0x5c1ccc,_0x1ef377){_0x1ef377=_0x1ef377||0x1f4;return function(_0x30e3ed){logger[_0x05c7('0x1d')](_0x30e3ed[_0x05c7('0x1e')]);if(_0x30e3ed[_0x05c7('0x1f')]){delete _0x30e3ed[_0x05c7('0x1f')];}_0x5c1ccc['status'](_0x1ef377)[_0x05c7('0x20')](_0x30e3ed);};}exports[_0x05c7('0x21')]=function(_0x3839f4,_0x3ced94){var _0x21a220={};var _0xc95725={'count':0x0,'rows':[]};var _0x30557a=_[_0x05c7('0x22')](db[_0x05c7('0x23')]['rawAttributes'],function(_0x6eda8f){return{'name':_0x6eda8f[_0x05c7('0x24')],'type':_0x6eda8f['type'][_0x05c7('0x25')]};});_0x21a220=qs[_0x05c7('0x26')](_0x30557a,_0x3839f4);var _0x42bc49={'where':_0x21a220[_0x05c7('0x27')]};return db[_0x05c7('0x23')][_0x05c7('0x15')](_0x42bc49)[_0x05c7('0x19')](function(_0x46d57a){_0xc95725['count']=_0x46d57a;_0x21a220['include']=qs[_0x05c7('0x28')](_0x3839f4[_0x05c7('0x29')]);return db[_0x05c7('0x23')]['findAll'](_0x21a220);})[_0x05c7('0x19')](function(_0x516fa6){_0xc95725['rows']=_0x516fa6;return _0xc95725;})[_0x05c7('0x19')](respondWithFilteredResult(_0x3ced94,_0x21a220))[_0x05c7('0x2a')](handleError(_0x3ced94,null));};exports[_0x05c7('0x2b')]=function(_0x2c6794,_0x20788d){var _0x474519={'raw':!![],'where':{'id':_0x2c6794[_0x05c7('0x2c')]['id']}},_0x1b2368={};_0x1b2368[_0x05c7('0x2d')]=_[_0x05c7('0x2e')](db[_0x05c7('0x23')][_0x05c7('0x2f')]);_0x1b2368[_0x05c7('0x29')]=_[_0x05c7('0x2e')](_0x2c6794[_0x05c7('0x29')]);_0x1b2368['filters']=_[_0x05c7('0x30')](_0x1b2368[_0x05c7('0x2d')],_0x1b2368[_0x05c7('0x29')]);_0x474519[_0x05c7('0x31')]=_[_0x05c7('0x30')](_0x1b2368[_0x05c7('0x2d')],qs[_0x05c7('0x32')](_0x2c6794[_0x05c7('0x29')][_0x05c7('0x32')]));_0x474519[_0x05c7('0x31')]=_0x474519[_0x05c7('0x31')][_0x05c7('0x33')]?_0x474519[_0x05c7('0x31')]:_0x1b2368[_0x05c7('0x2d')];if(_0x2c6794[_0x05c7('0x29')][_0x05c7('0x34')]){_0x474519['include']=[{'all':!![]}];}_0x474519=_[_0x05c7('0x35')]({},_0x474519,_0x2c6794[_0x05c7('0x36')]);return db[_0x05c7('0x23')][_0x05c7('0x37')](_0x474519)[_0x05c7('0x19')](handleEntityNotFound(_0x20788d,null))[_0x05c7('0x19')](respondWithResult(_0x20788d,null))[_0x05c7('0x2a')](handleError(_0x20788d,null));};exports[_0x05c7('0x38')]=function(_0x35acbb,_0x13c4ae){return db[_0x05c7('0x23')][_0x05c7('0x38')](_0x35acbb['body'],{})[_0x05c7('0x19')](function(_0x12e1f9){var _0x16882b=_0x35acbb[_0x05c7('0x39')][_0x05c7('0x3a')]({'plain':!![]});if(!_0x16882b)throw new Error(_0x05c7('0x3b'));if(_0x16882b[_0x05c7('0x3c')]===_0x05c7('0x39')){var _0xbc34d5=_0x12e1f9['get']({'plain':!![]});var _0x25ae17=_0x05c7('0x1a');return db[_0x05c7('0x3d')]['find']({'where':{'name':_0x25ae17,'userProfileId':_0x16882b[_0x05c7('0x3e')]},'raw':!![]})['then'](function(_0x538867){if(_0x538867&&_0x538867['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0xbc34d5[_0x05c7('0x1f')],'resourceId':_0xbc34d5['id'],'type':_0x538867[_0x05c7('0x1f')],'sectionId':_0x538867['id']},{})['then'](function(){return _0x12e1f9;});}else{return _0x12e1f9;}})[_0x05c7('0x2a')](function(_0xa77e81){logger[_0x05c7('0x1d')](_0x05c7('0x3f'),_0xa77e81);throw _0xa77e81;});}return _0x12e1f9;})[_0x05c7('0x19')](respondWithResult(_0x13c4ae,0xc9))[_0x05c7('0x2a')](handleError(_0x13c4ae,null));};exports[_0x05c7('0x18')]=function(_0x15b248,_0x4f8042){if(_0x15b248[_0x05c7('0x40')]['id']){delete _0x15b248[_0x05c7('0x40')]['id'];}return db[_0x05c7('0x23')][_0x05c7('0x37')]({'where':{'id':_0x15b248[_0x05c7('0x2c')]['id']}})[_0x05c7('0x19')](handleEntityNotFound(_0x4f8042,null))[_0x05c7('0x19')](saveUpdates(_0x15b248[_0x05c7('0x40')],null))[_0x05c7('0x19')](respondWithResult(_0x4f8042,null))[_0x05c7('0x2a')](handleError(_0x4f8042,null));};exports['destroy']=function(_0x2bf692,_0xc201a7){return db[_0x05c7('0x23')][_0x05c7('0x37')]({'where':{'id':_0x2bf692[_0x05c7('0x2c')]['id']}})[_0x05c7('0x19')](handleEntityNotFound(_0xc201a7,null))[_0x05c7('0x19')](removeEntity(_0xc201a7,null))[_0x05c7('0x2a')](handleError(_0xc201a7,null));};exports[_0x05c7('0x41')]=function(_0x16f409,_0x34d97d){return db[_0x05c7('0x23')][_0x05c7('0x41')]()[_0x05c7('0x19')](respondWithResult(_0x34d97d,null))['catch'](handleError(_0x34d97d,null));};exports['getMembers']=function(_0x550a28,_0x303c15){var _0x447132={'raw':!![],'where':{}},_0x2dddf7={},_0x5e9e01;return db[_0x05c7('0x23')][_0x05c7('0x42')]({'where':{'id':_0x550a28[_0x05c7('0x2c')]['id']}})['then'](handleEntityNotFound(_0x303c15,null))[_0x05c7('0x19')](function(_0x175236){if(_0x175236){_0x5e9e01=_0x175236['get']({'plain':!![]});_0x2dddf7[_0x05c7('0x2d')]=_['keys'](db['UserOpenchannelQueue']['rawAttributes']);_0x2dddf7[_0x05c7('0x29')]=_[_0x05c7('0x2e')](_0x550a28[_0x05c7('0x29')]);_0x2dddf7[_0x05c7('0x43')]=_['intersection'](_0x2dddf7[_0x05c7('0x2d')],_0x2dddf7[_0x05c7('0x29')]);_0x447132['attributes']=_[_0x05c7('0x30')](_0x2dddf7['model'],qs['fields'](_0x550a28['query']['fields']));_0x447132['attributes']=_0x447132[_0x05c7('0x31')][_0x05c7('0x33')]?_0x447132[_0x05c7('0x31')]:_0x2dddf7['model'];if(!_0x550a28[_0x05c7('0x29')][_0x05c7('0x44')](_0x05c7('0x45'))){_0x447132['limit']=qs['limit'](_0x550a28[_0x05c7('0x29')][_0x05c7('0x14')]);_0x447132[_0x05c7('0x12')]=qs[_0x05c7('0x12')](_0x550a28[_0x05c7('0x29')][_0x05c7('0x12')]);}_0x447132['order']=qs[_0x05c7('0x46')](_0x550a28[_0x05c7('0x29')][_0x05c7('0x46')]);_0x447132[_0x05c7('0x27')]=qs['filters'](_['pick'](_0x550a28[_0x05c7('0x29')],_0x2dddf7[_0x05c7('0x43')]));_0x447132['where']['OpenchannelQueueId']=_0x175236['id'];if(_0x550a28[_0x05c7('0x29')][_0x05c7('0x47')]){_0x447132[_0x05c7('0x27')]=_[_0x05c7('0x35')](_0x447132[_0x05c7('0x27')],{'$or':_['map'](_0x447132['attributes'],function(_0x2ab2f1){var _0x41e095={};_0x41e095[_0x2ab2f1]={'$like':'%'+_0x550a28[_0x05c7('0x29')]['filter']+'%'};return _0x41e095;})});}_0x447132=_[_0x05c7('0x35')]({},_0x447132,_0x550a28[_0x05c7('0x36')]);return db[_0x05c7('0x48')][_0x05c7('0x49')](_0x447132);}})['then'](function(_0x3ed80b){if(_0x3ed80b){return db[_0x05c7('0x4a')]['findAndCountAll']({'where':{'id':_['map'](_0x3ed80b,_0x05c7('0x4b')),'role':_0x05c7('0x4c')},'attributes':['id',_0x05c7('0x1f'),'openchannelPause',_0x05c7('0x4d'),_0x05c7('0x4e')]});}})[_0x05c7('0x19')](function(_0x4014e1){if(_0x4014e1){return{'count':_0x4014e1[_0x05c7('0x15')],'rows':_[_0x05c7('0x22')](_0x4014e1['rows'],function(_0x576f66){return{'membername':_0x576f66[_0x05c7('0x1f')],'UserId':_0x576f66['id'],'queue_name':_0x5e9e01[_0x05c7('0x1f')],'OpenchannelQueueId':_0x5e9e01['id'],'interface':util[_0x05c7('0x4f')](_0x05c7('0x50'),_0x05c7('0x51'),_0x576f66['name']),'penalty':0x0,'paused':_0x576f66['openchannelPause'],'createdAt':_0x576f66[_0x05c7('0x4e')],'updatedAt':_0x576f66[_0x05c7('0x4d')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x303c15,_0x447132))[_0x05c7('0x2a')](handleError(_0x303c15,null));};exports[_0x05c7('0x52')]=function(_0x1d7167,_0x1001c6){var _0x361dfc={};var _0x2e0684={};var _0x413ca6;var _0x17051b;return db[_0x05c7('0x23')][_0x05c7('0x42')]({'where':{'id':_0x1d7167['params']['id']}})[_0x05c7('0x19')](handleEntityNotFound(_0x1001c6,null))[_0x05c7('0x19')](function(_0x257298){if(_0x257298){_0x413ca6=_0x257298;_0x2e0684[_0x05c7('0x2d')]=_[_0x05c7('0x2e')](db[_0x05c7('0x53')][_0x05c7('0x2f')]);_0x2e0684[_0x05c7('0x29')]=_['keys'](_0x1d7167[_0x05c7('0x29')]);_0x2e0684[_0x05c7('0x43')]=_[_0x05c7('0x30')](_0x2e0684[_0x05c7('0x2d')],_0x2e0684['query']);_0x361dfc['attributes']=_[_0x05c7('0x30')](_0x2e0684[_0x05c7('0x2d')],qs[_0x05c7('0x32')](_0x1d7167[_0x05c7('0x29')][_0x05c7('0x32')]));_0x361dfc[_0x05c7('0x31')]=_0x361dfc[_0x05c7('0x31')][_0x05c7('0x33')]?_0x361dfc[_0x05c7('0x31')]:_0x2e0684['model'];_0x361dfc[_0x05c7('0x54')]=qs[_0x05c7('0x46')](_0x1d7167[_0x05c7('0x29')][_0x05c7('0x46')]);_0x361dfc['where']=qs[_0x05c7('0x43')](_['pick'](_0x1d7167['query'],_0x2e0684[_0x05c7('0x43')]));if(_0x1d7167[_0x05c7('0x29')][_0x05c7('0x47')]){_0x361dfc[_0x05c7('0x27')]=_[_0x05c7('0x35')](_0x361dfc[_0x05c7('0x27')],{'$or':_[_0x05c7('0x22')](_0x361dfc['attributes'],function(_0x15c4e8){var _0x1fda85={};_0x1fda85[_0x15c4e8]={'$like':'%'+_0x1d7167[_0x05c7('0x29')][_0x05c7('0x47')]+'%'};return _0x1fda85;})});}_0x361dfc=_[_0x05c7('0x35')]({},_0x361dfc,_0x1d7167[_0x05c7('0x36')]);return _0x413ca6['getTeams'](_0x361dfc);}})[_0x05c7('0x19')](function(_0x59e711){if(_0x59e711){_0x17051b=_0x59e711[_0x05c7('0x33')];if(!_0x1d7167['query'][_0x05c7('0x44')]('nolimit')){_0x361dfc[_0x05c7('0x14')]=qs[_0x05c7('0x14')](_0x1d7167[_0x05c7('0x29')]['limit']);_0x361dfc[_0x05c7('0x12')]=qs[_0x05c7('0x12')](_0x1d7167[_0x05c7('0x29')][_0x05c7('0x12')]);}return _0x413ca6[_0x05c7('0x52')](_0x361dfc);}})[_0x05c7('0x19')](function(_0x4c51be){if(_0x4c51be){return _0x4c51be?{'count':_0x17051b,'rows':_0x4c51be}:null;}})[_0x05c7('0x19')](respondWithResult(_0x1001c6,null))[_0x05c7('0x2a')](handleError(_0x1001c6,null));};exports[_0x05c7('0x55')]=function(_0xb48528,_0x3f6ea4){var _0x83deda=_0xb48528[_0x05c7('0x40')][_0x05c7('0x56')];return db[_0x05c7('0x53')][_0x05c7('0x49')]({'where':{'id':_0x83deda},'attributes':['id'],'include':[{'model':db['User'],'as':_0x05c7('0x57'),'attributes':['id',_0x05c7('0x1f'),_0x05c7('0x58'),_0x05c7('0x59'),_0x05c7('0x5a')],'raw':!![]}]})[_0x05c7('0x19')](function(_0x23f2d9){if(_0x23f2d9){var _0x44f0d1=_[_0x05c7('0x5b')](_0x23f2d9,function(_0x4e7afe){var _0x49f5ad=_0x4e7afe[_0x05c7('0x3a')]({'plain':!![]});return _0x49f5ad[_0x05c7('0x57')];});return db[_0x05c7('0x23')][_0x05c7('0x37')]({'where':{'id':_0xb48528['params']['id']}})[_0x05c7('0x19')](function(_0x460ceb){return db[_0x05c7('0x5c')][_0x05c7('0x5d')](function(_0x47b635){return _0x460ceb[_0x05c7('0x55')](_0x83deda,{'transaction':_0x47b635})[_0x05c7('0x19')](function(){return BPromise[_0x05c7('0x5e')](_0x44f0d1,function(_0x1ce5c1){return db['UserOpenchannelQueue']['findOrCreate']({'where':{'UserId':_0x1ce5c1['id'],'OpenchannelQueueId':_0xb48528[_0x05c7('0x2c')]['id']},'transaction':_0x47b635});});})[_0x05c7('0x19')](function(){_0x44f0d1[_0x05c7('0x5f')](function(_0x1115eb){socket[_0x05c7('0x60')](_0x05c7('0x61'),{'UserId':_0x1115eb['id'],'OpenchannelQueueId':_0x460ceb['id']});});});});});}})[_0x05c7('0x19')](respondWithStatusCode(_0x3f6ea4,null))[_0x05c7('0x2a')](handleError(_0x3f6ea4,null));};exports[_0x05c7('0x62')]=function(_0x30303e,_0x482b01){return db[_0x05c7('0x53')][_0x05c7('0x49')]({'where':{'id':_0x30303e['query'][_0x05c7('0x56')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x05c7('0x57'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x482b01,null))[_0x05c7('0x19')](function(_0x5ef99a){var _0x2ab872=_[_0x05c7('0x22')](_0x5ef99a,'id');var _0x5443f8=[];var _0x555e7a=[];var _0x3d3707=squel[_0x05c7('0x63')]();_0x3d3707[_0x05c7('0x64')](_0x05c7('0x65'))['from'](_0x05c7('0x66'),'tq')[_0x05c7('0x67')](_0x05c7('0x68'),'ut',_0x05c7('0x69'))[_0x05c7('0x27')](_0x05c7('0x6a'),_0x30303e[_0x05c7('0x2c')]['id']);for(var _0x3c6479=0x0;_0x3c6479<_0x5ef99a[_0x05c7('0x33')];_0x3c6479+=0x1){let _0x13c931=_0x5ef99a[_0x3c6479];for(var _0x4fccf0=0x0;_0x4fccf0<_0x13c931[_0x05c7('0x57')][_0x05c7('0x33')];_0x4fccf0+=0x1){let _0x5b82ae=_0x13c931[_0x05c7('0x57')][_0x4fccf0];var _0x772c9f=_0x3d3707[_0x05c7('0x6b')]();_0x772c9f[_0x05c7('0x27')](_0x05c7('0x6c'),_0x5b82ae['id']);_0x555e7a[_0x05c7('0x6d')](db['sequelize'][_0x05c7('0x29')](_0x772c9f['toString'](),{'type':db['sequelize']['QueryTypes']['SELECT']})['then'](function(_0x2ab5b4){if(_0x2ab5b4['length']===0x1){return _0x5b82ae['id'];}else{var _0x155871=_[_0x05c7('0x6e')](_[_0x05c7('0x22')](_0x2ab5b4,'TeamId'),function(_0x302fe7){return _[_0x05c7('0x6f')](_0x2ab872,_0x302fe7);});if(_0x155871){return _0x5b82ae['id'];}}}));}}return BPromise[_0x05c7('0x70')](_0x555e7a)[_0x05c7('0x19')](function(_0xe7a5a6){_0x5443f8=_(_0x5443f8)[_0x05c7('0x71')](_0xe7a5a6)['compact']()[_0x05c7('0x72')]();return db['OpenchannelQueue'][_0x05c7('0x37')]({'where':{'id':_0x30303e[_0x05c7('0x2c')]['id']}})[_0x05c7('0x19')](function(_0x5a730d){return db[_0x05c7('0x5c')]['transaction'](function(_0x1bd1f1){return _0x5a730d[_0x05c7('0x62')](_0x30303e[_0x05c7('0x29')][_0x05c7('0x56')],{'transaction':_0x1bd1f1})[_0x05c7('0x19')](function(){if(!_[_0x05c7('0x73')](_0x5443f8)){return _0x5a730d[_0x05c7('0x74')](_0x5443f8,{'transaction':_0x1bd1f1});}})[_0x05c7('0x19')](function(){_0x5443f8[_0x05c7('0x5f')](function(_0xc8a745){socket[_0x05c7('0x60')](_0x05c7('0x75'),{'UserId':_0xc8a745,'OpenchannelQueueId':_0x5a730d['id']});});});});});});})[_0x05c7('0x19')](respondWithStatusCode(_0x482b01,null))['catch'](handleError(_0x482b01,null));};exports[_0x05c7('0x76')]=function(_0x4bed6a,_0x2c0a97){return db['OpenchannelQueue'][_0x05c7('0x37')]({'where':{'id':_0x4bed6a['params']['id']}})[_0x05c7('0x19')](handleEntityNotFound(_0x2c0a97,null))['then'](function(_0x325ebc){if(_0x325ebc){return _0x325ebc[_0x05c7('0x76')](_0x4bed6a[_0x05c7('0x40')]['ids'],_['omit'](_0x4bed6a[_0x05c7('0x40')],['ids','id'])||{})[_0x05c7('0x77')](function(_0x46080b){for(var _0x19f5c3=0x0;_0x19f5c3<_0x4bed6a[_0x05c7('0x40')]['ids'][_0x05c7('0x33')];_0x19f5c3+=0x1){socket[_0x05c7('0x60')](_0x05c7('0x61'),{'UserId':Number(_0x4bed6a[_0x05c7('0x40')][_0x05c7('0x56')][_0x19f5c3]),'OpenchannelQueueId':Number(_0x4bed6a[_0x05c7('0x2c')]['id'])});}return _0x46080b;});}})[_0x05c7('0x19')](respondWithResult(_0x2c0a97,null))[_0x05c7('0x2a')](handleError(_0x2c0a97,null));};exports[_0x05c7('0x74')]=function(_0x3d8711,_0x5f3f1b){return db[_0x05c7('0x23')][_0x05c7('0x37')]({'where':{'id':_0x3d8711['params']['id']}})[_0x05c7('0x19')](handleEntityNotFound(_0x5f3f1b,null))[_0x05c7('0x19')](function(_0x4ceebb){if(_0x4ceebb){return _0x4ceebb['removeAgents'](_0x3d8711[_0x05c7('0x29')][_0x05c7('0x56')])[_0x05c7('0x19')](function(){if(_[_0x05c7('0x78')](_0x3d8711['query'][_0x05c7('0x56')])){for(var _0x13b7d9=0x0;_0x13b7d9<_0x3d8711[_0x05c7('0x29')][_0x05c7('0x56')][_0x05c7('0x33')];_0x13b7d9+=0x1){socket[_0x05c7('0x60')](_0x05c7('0x75'),{'UserId':Number(_0x3d8711[_0x05c7('0x29')][_0x05c7('0x56')][_0x13b7d9]),'OpenchannelQueueId':Number(_0x3d8711[_0x05c7('0x2c')]['id'])});}}else{socket['emit'](_0x05c7('0x75'),{'UserId':Number(_0x3d8711[_0x05c7('0x29')]['ids']),'OpenchannelQueueId':Number(_0x3d8711['params']['id'])});}});}})[_0x05c7('0x19')](respondWithStatusCode(_0x5f3f1b,null))[_0x05c7('0x2a')](handleError(_0x5f3f1b,null));};exports[_0x05c7('0x79')]=function(_0x3cbd42,_0x25345e){var _0x2a2ea1={};var _0x488c74={};var _0x4690cd;var _0x44cd61;return db[_0x05c7('0x23')]['findOne']({'where':{'id':_0x3cbd42[_0x05c7('0x2c')]['id']}})['then'](handleEntityNotFound(_0x25345e,null))[_0x05c7('0x19')](function(_0x4356f0){if(_0x4356f0){_0x4690cd=_0x4356f0;_0x488c74[_0x05c7('0x2d')]=_[_0x05c7('0x2e')](db[_0x05c7('0x4a')][_0x05c7('0x2f')]);_0x488c74[_0x05c7('0x29')]=_[_0x05c7('0x2e')](_0x3cbd42[_0x05c7('0x29')]);_0x488c74[_0x05c7('0x43')]=_[_0x05c7('0x30')](_0x488c74[_0x05c7('0x2d')],_0x488c74[_0x05c7('0x29')]);_0x2a2ea1['attributes']=_[_0x05c7('0x30')](_0x488c74[_0x05c7('0x2d')],qs[_0x05c7('0x32')](_0x3cbd42[_0x05c7('0x29')][_0x05c7('0x32')]));_0x2a2ea1[_0x05c7('0x31')]=_0x2a2ea1[_0x05c7('0x31')][_0x05c7('0x33')]?_0x2a2ea1[_0x05c7('0x31')]:_0x488c74[_0x05c7('0x2d')];_0x2a2ea1[_0x05c7('0x54')]=qs['sort'](_0x3cbd42['query']['sort']);_0x2a2ea1['where']=qs[_0x05c7('0x43')](_[_0x05c7('0x7a')](_0x3cbd42['query'],_0x488c74[_0x05c7('0x43')]));if(_0x3cbd42['query'][_0x05c7('0x47')]){_0x2a2ea1[_0x05c7('0x27')]=_[_0x05c7('0x35')](_0x2a2ea1['where'],{'$or':_[_0x05c7('0x22')](_0x2a2ea1[_0x05c7('0x31')],function(_0x2b3c00){var _0x98bb3b={};_0x98bb3b[_0x2b3c00]={'$like':'%'+_0x3cbd42['query'][_0x05c7('0x47')]+'%'};return _0x98bb3b;})});}_0x2a2ea1=_[_0x05c7('0x35')]({},_0x2a2ea1,_0x3cbd42[_0x05c7('0x36')]);return _0x4690cd[_0x05c7('0x79')](_0x2a2ea1);}})[_0x05c7('0x19')](function(_0x2cfc23){if(_0x2cfc23){_0x44cd61=_0x2cfc23[_0x05c7('0x33')];if(!_0x3cbd42[_0x05c7('0x29')][_0x05c7('0x44')](_0x05c7('0x45'))){_0x2a2ea1[_0x05c7('0x14')]=qs[_0x05c7('0x14')](_0x3cbd42[_0x05c7('0x29')][_0x05c7('0x14')]);_0x2a2ea1[_0x05c7('0x12')]=qs[_0x05c7('0x12')](_0x3cbd42[_0x05c7('0x29')][_0x05c7('0x12')]);}return _0x4690cd[_0x05c7('0x79')](_0x2a2ea1);}})[_0x05c7('0x19')](function(_0x563fd6){if(_0x563fd6){return _0x563fd6?{'count':_0x44cd61,'rows':_0x563fd6}:null;}})[_0x05c7('0x19')](respondWithResult(_0x25345e,null))[_0x05c7('0x2a')](handleError(_0x25345e,null));}; \ No newline at end of file +var _0x10c0=['findOrCreate','emit','userOpenchannelQueue:save','removeTeams','ids','select','field','from','team_has_openchannel_queues','join','user_has_teams','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','value','isEmpty','forEach','userOpenchannelQueue:remove','addAgents','omit','spread','removeAgents','isArray','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','./openchannelQueue.socket','register','sendStatus','status','end','undefined','limit','offset','count','Content-Range','update','then','destroy','get','UserProfileResource','error','stack','name','index','rawAttributes','fieldName','type','key','getOptions','where','include','query','OpenchannelQueue','findAll','rows','catch','show','keys','intersection','model','attributes','fields','includeAll','merge','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','OpenchannelQueues','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','UserOpenchannelQueue','filters','length','nolimit','order','sort','pick','OpenchannelQueueId','filter','options','User','findAndCountAll','map','agent','openchannelPause','updatedAt','createdAt','format','%s/%s','getTeams','findOne','Team','hasOwnProperty','addTeams','Agents','online','voicePause','interface','flatMap','sequelize','transaction'];(function(_0x4d0662,_0x145963){var _0x6eea6d=function(_0x2def06){while(--_0x2def06){_0x4d0662['push'](_0x4d0662['shift']());}};_0x6eea6d(++_0x145963);}(_0x10c0,0x11a));var _0x010c=function(_0x350258,_0x4e0a50){_0x350258=_0x350258-0x0;var _0x3714b3=_0x10c0[_0x350258];return _0x3714b3;};'use strict';var BPromise=require(_0x010c('0x0'));var util=require(_0x010c('0x1'));var _=require(_0x010c('0x2'));var squel=require(_0x010c('0x3'));var Redis=require(_0x010c('0x4'));var qs=require(_0x010c('0x5'));var logger=require('../../config/logger')(_0x010c('0x6'));var config=require(_0x010c('0x7'));var db=require(_0x010c('0x8'))['db'];config['redis']=_['defaults'](config[_0x010c('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x010c('0x9')]));require(_0x010c('0xa'))[_0x010c('0xb')](socket);function respondWithStatusCode(_0x2a0f3b,_0xc2754c){_0xc2754c=_0xc2754c||0xcc;return function(_0x2246be){if(_0x2246be){return _0x2a0f3b[_0x010c('0xc')](_0xc2754c);}return _0x2a0f3b[_0x010c('0xd')](_0xc2754c)[_0x010c('0xe')]();};}function respondWithResult(_0x3054b1,_0x3738f8){_0x3738f8=_0x3738f8||0xc8;return function(_0x2ff35c){if(_0x2ff35c){return _0x3054b1[_0x010c('0xd')](_0x3738f8)['json'](_0x2ff35c);}};}function respondWithFilteredResult(_0x3b2662,_0x1d92aa){return function(_0x4b2e47){if(_0x4b2e47){var _0x1da5c=typeof _0x1d92aa['offset']===_0x010c('0xf')&&typeof _0x1d92aa[_0x010c('0x10')]===_0x010c('0xf');var _0x49d4ce=_0x4b2e47['count'];var _0x4794e1=_0x1da5c?0x0:_0x1d92aa[_0x010c('0x11')];var _0x4295d=_0x1da5c?_0x4b2e47[_0x010c('0x12')]:_0x1d92aa['offset']+_0x1d92aa[_0x010c('0x10')];var _0x50aec3;if(_0x4295d>=_0x49d4ce){_0x4295d=_0x49d4ce;_0x50aec3=0xc8;}else{_0x50aec3=0xce;}_0x3b2662[_0x010c('0xd')](_0x50aec3);return _0x3b2662['set'](_0x010c('0x13'),_0x4794e1+'-'+_0x4295d+'/'+_0x49d4ce)['json'](_0x4b2e47);}return null;};}function saveUpdates(_0x332f70){return function(_0x2a2e17){if(_0x2a2e17){return _0x2a2e17[_0x010c('0x14')](_0x332f70)[_0x010c('0x15')](function(_0x25dfb8){return _0x25dfb8;});}return null;};}function removeEntity(_0x15c9a3){return function(_0x2ab367){if(_0x2ab367){return _0x2ab367[_0x010c('0x16')]()[_0x010c('0x15')](function(){var _0x2eca09=_0x2ab367[_0x010c('0x17')]({'plain':!![]});var _0x2c6685='OpenchannelQueues';return db[_0x010c('0x18')][_0x010c('0x16')]({'where':{'type':_0x2c6685,'resourceId':_0x2eca09['id']}})[_0x010c('0x15')](function(){return _0x2ab367;});})[_0x010c('0x15')](function(){_0x15c9a3[_0x010c('0xd')](0xcc)[_0x010c('0xe')]();});}};}function handleEntityNotFound(_0x127138){return function(_0x4fc954){if(!_0x4fc954){_0x127138['sendStatus'](0x194);}return _0x4fc954;};}function handleError(_0x385124,_0x5b0a3f){_0x5b0a3f=_0x5b0a3f||0x1f4;return function(_0x14ef08){logger[_0x010c('0x19')](_0x14ef08[_0x010c('0x1a')]);if(_0x14ef08['name']){delete _0x14ef08[_0x010c('0x1b')];}_0x385124[_0x010c('0xd')](_0x5b0a3f)['send'](_0x14ef08);};}exports[_0x010c('0x1c')]=function(_0x4566c5,_0x172b30){var _0x20ddb3={};var _0x407607={'count':0x0,'rows':[]};var _0x3577f5=_['map'](db['OpenchannelQueue'][_0x010c('0x1d')],function(_0x81f272){return{'name':_0x81f272[_0x010c('0x1e')],'type':_0x81f272[_0x010c('0x1f')][_0x010c('0x20')]};});_0x20ddb3=qs[_0x010c('0x21')](_0x3577f5,_0x4566c5);var _0x37926f={'where':_0x20ddb3[_0x010c('0x22')]};return db['OpenchannelQueue'][_0x010c('0x12')](_0x37926f)['then'](function(_0x13158c){_0x407607[_0x010c('0x12')]=_0x13158c;_0x20ddb3[_0x010c('0x23')]=qs['include'](_0x4566c5[_0x010c('0x24')]);return db[_0x010c('0x25')][_0x010c('0x26')](_0x20ddb3);})[_0x010c('0x15')](function(_0x44b91a){_0x407607[_0x010c('0x27')]=_0x44b91a;return _0x407607;})[_0x010c('0x15')](respondWithFilteredResult(_0x172b30,_0x20ddb3))[_0x010c('0x28')](handleError(_0x172b30,null));};exports[_0x010c('0x29')]=function(_0x1d094f,_0x357ee5){var _0x45b45c={'raw':!![],'where':{'id':_0x1d094f['params']['id']}},_0x59b24b={};_0x59b24b['model']=_[_0x010c('0x2a')](db[_0x010c('0x25')][_0x010c('0x1d')]);_0x59b24b['query']=_['keys'](_0x1d094f['query']);_0x59b24b['filters']=_[_0x010c('0x2b')](_0x59b24b[_0x010c('0x2c')],_0x59b24b[_0x010c('0x24')]);_0x45b45c[_0x010c('0x2d')]=_[_0x010c('0x2b')](_0x59b24b[_0x010c('0x2c')],qs['fields'](_0x1d094f['query'][_0x010c('0x2e')]));_0x45b45c[_0x010c('0x2d')]=_0x45b45c['attributes']['length']?_0x45b45c[_0x010c('0x2d')]:_0x59b24b[_0x010c('0x2c')];if(_0x1d094f[_0x010c('0x24')][_0x010c('0x2f')]){_0x45b45c['include']=[{'all':!![]}];}_0x45b45c=_[_0x010c('0x30')]({},_0x45b45c,_0x1d094f['options']);return db[_0x010c('0x25')]['find'](_0x45b45c)[_0x010c('0x15')](handleEntityNotFound(_0x357ee5,null))[_0x010c('0x15')](respondWithResult(_0x357ee5,null))['catch'](handleError(_0x357ee5,null));};exports[_0x010c('0x31')]=function(_0x122d52,_0x4ff82){return db[_0x010c('0x25')]['create'](_0x122d52[_0x010c('0x32')],{})[_0x010c('0x15')](function(_0x4501b6){var _0x42fd02=_0x122d52['user'][_0x010c('0x17')]({'plain':!![]});if(!_0x42fd02)throw new Error(_0x010c('0x33'));if(_0x42fd02[_0x010c('0x34')]===_0x010c('0x35')){var _0xeef679=_0x4501b6[_0x010c('0x17')]({'plain':!![]});var _0x565a5e=_0x010c('0x36');return db[_0x010c('0x37')][_0x010c('0x38')]({'where':{'name':_0x565a5e,'userProfileId':_0x42fd02[_0x010c('0x39')]},'raw':!![]})[_0x010c('0x15')](function(_0x340997){if(_0x340997&&_0x340997[_0x010c('0x3a')]===0x0){return db[_0x010c('0x18')][_0x010c('0x31')]({'name':_0xeef679[_0x010c('0x1b')],'resourceId':_0xeef679['id'],'type':_0x340997[_0x010c('0x1b')],'sectionId':_0x340997['id']},{})[_0x010c('0x15')](function(){return _0x4501b6;});}else{return _0x4501b6;}})[_0x010c('0x28')](function(_0x42cec7){logger[_0x010c('0x19')](_0x010c('0x3b'),_0x42cec7);throw _0x42cec7;});}return _0x4501b6;})[_0x010c('0x15')](respondWithResult(_0x4ff82,0xc9))[_0x010c('0x28')](handleError(_0x4ff82,null));};exports['update']=function(_0xb772cc,_0x28c37a){if(_0xb772cc[_0x010c('0x32')]['id']){delete _0xb772cc['body']['id'];}return db[_0x010c('0x25')][_0x010c('0x38')]({'where':{'id':_0xb772cc[_0x010c('0x3c')]['id']}})['then'](handleEntityNotFound(_0x28c37a,null))[_0x010c('0x15')](saveUpdates(_0xb772cc['body'],null))['then'](respondWithResult(_0x28c37a,null))['catch'](handleError(_0x28c37a,null));};exports[_0x010c('0x16')]=function(_0x18cb36,_0x3b7bb9){return db[_0x010c('0x25')][_0x010c('0x38')]({'where':{'id':_0x18cb36[_0x010c('0x3c')]['id']}})[_0x010c('0x15')](handleEntityNotFound(_0x3b7bb9,null))[_0x010c('0x15')](removeEntity(_0x3b7bb9,null))[_0x010c('0x28')](handleError(_0x3b7bb9,null));};exports[_0x010c('0x3d')]=function(_0x5257e3,_0xb85f7e){return db[_0x010c('0x25')]['describe']()[_0x010c('0x15')](respondWithResult(_0xb85f7e,null))[_0x010c('0x28')](handleError(_0xb85f7e,null));};exports['getMembers']=function(_0x101c72,_0xc2e72e){var _0x3065b9={'raw':!![],'where':{}},_0x1c5ea6={},_0x1d3a65;return db[_0x010c('0x25')]['findOne']({'where':{'id':_0x101c72[_0x010c('0x3c')]['id']}})[_0x010c('0x15')](handleEntityNotFound(_0xc2e72e,null))['then'](function(_0x41c72e){if(_0x41c72e){_0x1d3a65=_0x41c72e[_0x010c('0x17')]({'plain':!![]});_0x1c5ea6[_0x010c('0x2c')]=_['keys'](db[_0x010c('0x3e')][_0x010c('0x1d')]);_0x1c5ea6[_0x010c('0x24')]=_['keys'](_0x101c72[_0x010c('0x24')]);_0x1c5ea6[_0x010c('0x3f')]=_[_0x010c('0x2b')](_0x1c5ea6[_0x010c('0x2c')],_0x1c5ea6[_0x010c('0x24')]);_0x3065b9[_0x010c('0x2d')]=_[_0x010c('0x2b')](_0x1c5ea6['model'],qs[_0x010c('0x2e')](_0x101c72['query'][_0x010c('0x2e')]));_0x3065b9[_0x010c('0x2d')]=_0x3065b9[_0x010c('0x2d')][_0x010c('0x40')]?_0x3065b9[_0x010c('0x2d')]:_0x1c5ea6[_0x010c('0x2c')];if(!_0x101c72[_0x010c('0x24')]['hasOwnProperty'](_0x010c('0x41'))){_0x3065b9[_0x010c('0x10')]=qs['limit'](_0x101c72[_0x010c('0x24')]['limit']);_0x3065b9[_0x010c('0x11')]=qs[_0x010c('0x11')](_0x101c72[_0x010c('0x24')][_0x010c('0x11')]);}_0x3065b9[_0x010c('0x42')]=qs[_0x010c('0x43')](_0x101c72[_0x010c('0x24')][_0x010c('0x43')]);_0x3065b9['where']=qs[_0x010c('0x3f')](_[_0x010c('0x44')](_0x101c72[_0x010c('0x24')],_0x1c5ea6[_0x010c('0x3f')]));_0x3065b9[_0x010c('0x22')][_0x010c('0x45')]=_0x41c72e['id'];if(_0x101c72[_0x010c('0x24')][_0x010c('0x46')]){_0x3065b9[_0x010c('0x22')]=_['merge'](_0x3065b9[_0x010c('0x22')],{'$or':_['map'](_0x3065b9[_0x010c('0x2d')],function(_0x50d96f){var _0x176a64={};_0x176a64[_0x50d96f]={'$like':'%'+_0x101c72['query'][_0x010c('0x46')]+'%'};return _0x176a64;})});}_0x3065b9=_['merge']({},_0x3065b9,_0x101c72[_0x010c('0x47')]);return db[_0x010c('0x3e')][_0x010c('0x26')](_0x3065b9);}})[_0x010c('0x15')](function(_0x44ccd9){if(_0x44ccd9){return db[_0x010c('0x48')][_0x010c('0x49')]({'where':{'id':_[_0x010c('0x4a')](_0x44ccd9,'UserId'),'role':_0x010c('0x4b')},'attributes':['id',_0x010c('0x1b'),_0x010c('0x4c'),_0x010c('0x4d'),_0x010c('0x4e')]});}})[_0x010c('0x15')](function(_0x53988b){if(_0x53988b){return{'count':_0x53988b['count'],'rows':_[_0x010c('0x4a')](_0x53988b['rows'],function(_0x70f4de){return{'membername':_0x70f4de[_0x010c('0x1b')],'UserId':_0x70f4de['id'],'queue_name':_0x1d3a65[_0x010c('0x1b')],'OpenchannelQueueId':_0x1d3a65['id'],'interface':util[_0x010c('0x4f')](_0x010c('0x50'),'SIP',_0x70f4de['name']),'penalty':0x0,'paused':_0x70f4de[_0x010c('0x4c')],'createdAt':_0x70f4de['createdAt'],'updatedAt':_0x70f4de[_0x010c('0x4d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x010c('0x15')](respondWithFilteredResult(_0xc2e72e,_0x3065b9))['catch'](handleError(_0xc2e72e,null));};exports[_0x010c('0x51')]=function(_0x20960b,_0x5aabb4){var _0x1f9f1e={};var _0x3218df={};var _0x1ea4ef;var _0x7ad3bd;return db[_0x010c('0x25')][_0x010c('0x52')]({'where':{'id':_0x20960b['params']['id']}})[_0x010c('0x15')](handleEntityNotFound(_0x5aabb4,null))['then'](function(_0x481cbd){if(_0x481cbd){_0x1ea4ef=_0x481cbd;_0x3218df['model']=_[_0x010c('0x2a')](db[_0x010c('0x53')][_0x010c('0x1d')]);_0x3218df[_0x010c('0x24')]=_[_0x010c('0x2a')](_0x20960b['query']);_0x3218df[_0x010c('0x3f')]=_[_0x010c('0x2b')](_0x3218df[_0x010c('0x2c')],_0x3218df[_0x010c('0x24')]);_0x1f9f1e['attributes']=_[_0x010c('0x2b')](_0x3218df['model'],qs[_0x010c('0x2e')](_0x20960b['query'][_0x010c('0x2e')]));_0x1f9f1e[_0x010c('0x2d')]=_0x1f9f1e[_0x010c('0x2d')]['length']?_0x1f9f1e[_0x010c('0x2d')]:_0x3218df[_0x010c('0x2c')];_0x1f9f1e[_0x010c('0x42')]=qs[_0x010c('0x43')](_0x20960b[_0x010c('0x24')][_0x010c('0x43')]);_0x1f9f1e['where']=qs[_0x010c('0x3f')](_[_0x010c('0x44')](_0x20960b[_0x010c('0x24')],_0x3218df[_0x010c('0x3f')]));if(_0x20960b[_0x010c('0x24')][_0x010c('0x46')]){_0x1f9f1e[_0x010c('0x22')]=_[_0x010c('0x30')](_0x1f9f1e[_0x010c('0x22')],{'$or':_['map'](_0x1f9f1e[_0x010c('0x2d')],function(_0x42e673){var _0x4a16af={};_0x4a16af[_0x42e673]={'$like':'%'+_0x20960b['query'][_0x010c('0x46')]+'%'};return _0x4a16af;})});}_0x1f9f1e=_[_0x010c('0x30')]({},_0x1f9f1e,_0x20960b['options']);return _0x1ea4ef[_0x010c('0x51')](_0x1f9f1e);}})['then'](function(_0x1ebe1d){if(_0x1ebe1d){_0x7ad3bd=_0x1ebe1d[_0x010c('0x40')];if(!_0x20960b[_0x010c('0x24')][_0x010c('0x54')](_0x010c('0x41'))){_0x1f9f1e[_0x010c('0x10')]=qs[_0x010c('0x10')](_0x20960b[_0x010c('0x24')][_0x010c('0x10')]);_0x1f9f1e[_0x010c('0x11')]=qs[_0x010c('0x11')](_0x20960b['query'][_0x010c('0x11')]);}return _0x1ea4ef[_0x010c('0x51')](_0x1f9f1e);}})['then'](function(_0x5e812b){if(_0x5e812b){return _0x5e812b?{'count':_0x7ad3bd,'rows':_0x5e812b}:null;}})[_0x010c('0x15')](respondWithResult(_0x5aabb4,null))[_0x010c('0x28')](handleError(_0x5aabb4,null));};exports[_0x010c('0x55')]=function(_0x1eb444,_0x2fb21e){var _0x53d90f=_0x1eb444[_0x010c('0x32')]['ids'];return db[_0x010c('0x53')][_0x010c('0x26')]({'where':{'id':_0x53d90f},'attributes':['id'],'include':[{'model':db['User'],'as':_0x010c('0x56'),'attributes':['id',_0x010c('0x1b'),_0x010c('0x57'),_0x010c('0x58'),_0x010c('0x59')],'raw':!![]}]})['then'](function(_0x35beee){if(_0x35beee){var _0x1f64e9=_[_0x010c('0x5a')](_0x35beee,function(_0x44654e){var _0x280def=_0x44654e[_0x010c('0x17')]({'plain':!![]});return _0x280def[_0x010c('0x56')];});return db['OpenchannelQueue'][_0x010c('0x38')]({'where':{'id':_0x1eb444[_0x010c('0x3c')]['id']}})['then'](function(_0x1fd97d){return db[_0x010c('0x5b')][_0x010c('0x5c')](function(_0x2410e0){return _0x1fd97d[_0x010c('0x55')](_0x53d90f,{'transaction':_0x2410e0})[_0x010c('0x15')](function(){return BPromise['each'](_0x1f64e9,function(_0x6cae13){return db['UserOpenchannelQueue'][_0x010c('0x5d')]({'where':{'UserId':_0x6cae13['id'],'OpenchannelQueueId':_0x1eb444[_0x010c('0x3c')]['id']},'transaction':_0x2410e0});});})[_0x010c('0x15')](function(){_0x1f64e9['forEach'](function(_0x3a5f58){socket[_0x010c('0x5e')](_0x010c('0x5f'),{'UserId':_0x3a5f58['id'],'OpenchannelQueueId':_0x1fd97d['id']});});});});});}})[_0x010c('0x15')](respondWithStatusCode(_0x2fb21e,null))[_0x010c('0x28')](handleError(_0x2fb21e,null));};exports[_0x010c('0x60')]=function(_0x20cd2a,_0x505f6e){return db[_0x010c('0x53')]['findAll']({'where':{'id':_0x20cd2a[_0x010c('0x24')][_0x010c('0x61')]},'attributes':['id'],'include':[{'model':db[_0x010c('0x48')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x010c('0x15')](handleEntityNotFound(_0x505f6e,null))[_0x010c('0x15')](function(_0x54a666){var _0x355a5b=_[_0x010c('0x4a')](_0x54a666,'id');var _0x440e23=[];var _0x1e84ce=[];var _0x329945=squel[_0x010c('0x62')]();_0x329945[_0x010c('0x63')]('tq.TeamId')[_0x010c('0x64')](_0x010c('0x65'),'tq')[_0x010c('0x66')](_0x010c('0x67'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x010c('0x68'),_0x20cd2a[_0x010c('0x3c')]['id']);for(var _0x3795e1=0x0;_0x3795e1<_0x54a666[_0x010c('0x40')];_0x3795e1+=0x1){let _0x112a1a=_0x54a666[_0x3795e1];for(var _0x4e2b5d=0x0;_0x4e2b5d<_0x112a1a[_0x010c('0x56')][_0x010c('0x40')];_0x4e2b5d+=0x1){let _0x539516=_0x112a1a[_0x010c('0x56')][_0x4e2b5d];var _0x271dfb=_0x329945[_0x010c('0x69')]();_0x271dfb[_0x010c('0x22')](_0x010c('0x6a'),_0x539516['id']);_0x1e84ce[_0x010c('0x6b')](db['sequelize'][_0x010c('0x24')](_0x271dfb[_0x010c('0x6c')](),{'type':db['sequelize'][_0x010c('0x6d')][_0x010c('0x6e')]})[_0x010c('0x15')](function(_0x4111e5){if(_0x4111e5['length']===0x1){return _0x539516['id'];}else{var _0x49cc24=_[_0x010c('0x6f')](_[_0x010c('0x4a')](_0x4111e5,_0x010c('0x70')),function(_0x1d2aa1){return _[_0x010c('0x71')](_0x355a5b,_0x1d2aa1);});if(_0x49cc24){return _0x539516['id'];}}}));}}return BPromise[_0x010c('0x72')](_0x1e84ce)[_0x010c('0x15')](function(_0x5b1343){_0x440e23=_(_0x440e23)[_0x010c('0x73')](_0x5b1343)['compact']()[_0x010c('0x74')]();return db[_0x010c('0x25')]['find']({'where':{'id':_0x20cd2a['params']['id']}})[_0x010c('0x15')](function(_0x5e2c98){return db[_0x010c('0x5b')]['transaction'](function(_0x267506){return _0x5e2c98[_0x010c('0x60')](_0x20cd2a[_0x010c('0x24')][_0x010c('0x61')],{'transaction':_0x267506})[_0x010c('0x15')](function(){if(!_[_0x010c('0x75')](_0x440e23)){return _0x5e2c98['removeAgents'](_0x440e23,{'transaction':_0x267506});}})[_0x010c('0x15')](function(){_0x440e23[_0x010c('0x76')](function(_0x27ed15){socket['emit'](_0x010c('0x77'),{'UserId':_0x27ed15,'OpenchannelQueueId':_0x5e2c98['id']});});});});});});})[_0x010c('0x15')](respondWithStatusCode(_0x505f6e,null))[_0x010c('0x28')](handleError(_0x505f6e,null));};exports[_0x010c('0x78')]=function(_0x5380a8,_0xcb5588){return db[_0x010c('0x25')][_0x010c('0x38')]({'where':{'id':_0x5380a8['params']['id']}})[_0x010c('0x15')](handleEntityNotFound(_0xcb5588,null))['then'](function(_0x66c7b4){if(_0x66c7b4){return _0x66c7b4[_0x010c('0x78')](_0x5380a8['body']['ids'],_[_0x010c('0x79')](_0x5380a8[_0x010c('0x32')],['ids','id'])||{})[_0x010c('0x7a')](function(_0x37e31b){for(var _0x4b4ff9=0x0;_0x4b4ff9<_0x5380a8[_0x010c('0x32')][_0x010c('0x61')][_0x010c('0x40')];_0x4b4ff9+=0x1){socket[_0x010c('0x5e')](_0x010c('0x5f'),{'UserId':Number(_0x5380a8['body'][_0x010c('0x61')][_0x4b4ff9]),'OpenchannelQueueId':Number(_0x5380a8['params']['id'])});}return _0x37e31b;});}})[_0x010c('0x15')](respondWithResult(_0xcb5588,null))['catch'](handleError(_0xcb5588,null));};exports[_0x010c('0x7b')]=function(_0x690e4b,_0x525a59){return db[_0x010c('0x25')][_0x010c('0x38')]({'where':{'id':_0x690e4b[_0x010c('0x3c')]['id']}})[_0x010c('0x15')](handleEntityNotFound(_0x525a59,null))[_0x010c('0x15')](function(_0x54ebd3){if(_0x54ebd3){return _0x54ebd3['removeAgents'](_0x690e4b[_0x010c('0x24')][_0x010c('0x61')])['then'](function(){if(_[_0x010c('0x7c')](_0x690e4b['query']['ids'])){for(var _0x6ed211=0x0;_0x6ed211<_0x690e4b['query']['ids'][_0x010c('0x40')];_0x6ed211+=0x1){socket[_0x010c('0x5e')](_0x010c('0x77'),{'UserId':Number(_0x690e4b[_0x010c('0x24')][_0x010c('0x61')][_0x6ed211]),'OpenchannelQueueId':Number(_0x690e4b[_0x010c('0x3c')]['id'])});}}else{socket[_0x010c('0x5e')](_0x010c('0x77'),{'UserId':Number(_0x690e4b[_0x010c('0x24')][_0x010c('0x61')]),'OpenchannelQueueId':Number(_0x690e4b[_0x010c('0x3c')]['id'])});}});}})[_0x010c('0x15')](respondWithStatusCode(_0x525a59,null))[_0x010c('0x28')](handleError(_0x525a59,null));};exports['getAgents']=function(_0x16690a,_0x1c4688){var _0x5c04b2={};var _0x19709f={};var _0x270738;var _0x2c4e44;return db['OpenchannelQueue'][_0x010c('0x52')]({'where':{'id':_0x16690a[_0x010c('0x3c')]['id']}})[_0x010c('0x15')](handleEntityNotFound(_0x1c4688,null))[_0x010c('0x15')](function(_0x466fe9){if(_0x466fe9){_0x270738=_0x466fe9;_0x19709f[_0x010c('0x2c')]=_['keys'](db['User'][_0x010c('0x1d')]);_0x19709f[_0x010c('0x24')]=_['keys'](_0x16690a['query']);_0x19709f[_0x010c('0x3f')]=_[_0x010c('0x2b')](_0x19709f[_0x010c('0x2c')],_0x19709f[_0x010c('0x24')]);_0x5c04b2[_0x010c('0x2d')]=_[_0x010c('0x2b')](_0x19709f[_0x010c('0x2c')],qs[_0x010c('0x2e')](_0x16690a[_0x010c('0x24')][_0x010c('0x2e')]));_0x5c04b2['attributes']=_0x5c04b2['attributes'][_0x010c('0x40')]?_0x5c04b2[_0x010c('0x2d')]:_0x19709f[_0x010c('0x2c')];_0x5c04b2[_0x010c('0x42')]=qs[_0x010c('0x43')](_0x16690a['query']['sort']);_0x5c04b2[_0x010c('0x22')]=qs[_0x010c('0x3f')](_['pick'](_0x16690a['query'],_0x19709f['filters']));if(_0x16690a['query'][_0x010c('0x46')]){_0x5c04b2['where']=_[_0x010c('0x30')](_0x5c04b2[_0x010c('0x22')],{'$or':_[_0x010c('0x4a')](_0x5c04b2[_0x010c('0x2d')],function(_0x1abe7d){var _0x58371e={};_0x58371e[_0x1abe7d]={'$like':'%'+_0x16690a[_0x010c('0x24')][_0x010c('0x46')]+'%'};return _0x58371e;})});}_0x5c04b2=_[_0x010c('0x30')]({},_0x5c04b2,_0x16690a[_0x010c('0x47')]);return _0x270738['getAgents'](_0x5c04b2);}})['then'](function(_0x292b05){if(_0x292b05){_0x2c4e44=_0x292b05['length'];if(!_0x16690a[_0x010c('0x24')][_0x010c('0x54')](_0x010c('0x41'))){_0x5c04b2[_0x010c('0x10')]=qs[_0x010c('0x10')](_0x16690a[_0x010c('0x24')]['limit']);_0x5c04b2[_0x010c('0x11')]=qs['offset'](_0x16690a['query'][_0x010c('0x11')]);}return _0x270738['getAgents'](_0x5c04b2);}})[_0x010c('0x15')](function(_0x49bf3b){if(_0x49bf3b){return _0x49bf3b?{'count':_0x2c4e44,'rows':_0x49bf3b}:null;}})[_0x010c('0x15')](respondWithResult(_0x1c4688,null))[_0x010c('0x28')](handleError(_0x1c4688,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index a4ddf9b..dff8195 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 _0x73df=['exports','events','../../mysqldb','OpenchannelQueue','update','remove','emit','hasOwnProperty','hook'];(function(_0x2b737e,_0x3d030f){var _0x1e6438=function(_0x580944){while(--_0x580944){_0x2b737e['push'](_0x2b737e['shift']());}};_0x1e6438(++_0x3d030f);}(_0x73df,0x17b));var _0xf73d=function(_0x4ee8e2,_0x2a05eb){_0x4ee8e2=_0x4ee8e2-0x0;var _0x54b9a5=_0x73df[_0x4ee8e2];return _0x54b9a5;};'use strict';var EventEmitter=require(_0xf73d('0x0'));var OpenchannelQueue=require(_0xf73d('0x1'))['db'][_0xf73d('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xf73d('0x3'),'afterDestroy':_0xf73d('0x4')};function emitEvent(_0x4acf6a){return function(_0x384a6a,_0x487542,_0x23315b){OpenchannelQueueEvents['emit'](_0x4acf6a+':'+_0x384a6a['id'],_0x384a6a);OpenchannelQueueEvents[_0xf73d('0x5')](_0x4acf6a,_0x384a6a);_0x23315b(null);};}for(var e in events){if(events[_0xf73d('0x6')](e)){var event=events[e];OpenchannelQueue[_0xf73d('0x7')](e,emitEvent(event));}}module[_0xf73d('0x8')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x9421=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','OpenchannelQueue'];(function(_0x1a1101,_0x1eb4c0){var _0x342d0d=function(_0x1ea3f9){while(--_0x1ea3f9){_0x1a1101['push'](_0x1a1101['shift']());}};_0x342d0d(++_0x1eb4c0);}(_0x9421,0xed));var _0x1942=function(_0xdc9953,_0x337824){_0xdc9953=_0xdc9953-0x0;var _0x5d16e7=_0x9421[_0xdc9953];return _0x5d16e7;};'use strict';var EventEmitter=require(_0x1942('0x0'));var OpenchannelQueue=require(_0x1942('0x1'))['db'][_0x1942('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x1942('0x3')](0x0);var events={'afterCreate':_0x1942('0x4'),'afterUpdate':_0x1942('0x5'),'afterDestroy':_0x1942('0x6')};function emitEvent(_0x187170){return function(_0x35abfb,_0x319e79,_0x50d2bc){OpenchannelQueueEvents[_0x1942('0x7')](_0x187170+':'+_0x35abfb['id'],_0x35abfb);OpenchannelQueueEvents[_0x1942('0x7')](_0x187170,_0x35abfb);_0x50d2bc(null);};}for(var e in events){if(events[_0x1942('0x8')](e)){var event=events[e];OpenchannelQueue[_0x1942('0x9')](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index e4f5fb8..11c7f10 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 _0x84a8=['define','OpenchannelQueue','openchannel_queues','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','./openchannelQueue.attributes'];(function(_0x50d5ca,_0x445326){var _0x3f1615=function(_0x3d13d9){while(--_0x3d13d9){_0x50d5ca['push'](_0x50d5ca['shift']());}};_0x3f1615(++_0x445326);}(_0x84a8,0xc9));var _0x884a=function(_0x34361b,_0x9642d4){_0x34361b=_0x34361b-0x0;var _0x1de9c5=_0x84a8[_0x34361b];return _0x1de9c5;};'use strict';var _=require(_0x884a('0x0'));var util=require(_0x884a('0x1'));var logger=require(_0x884a('0x2'))('api');var moment=require(_0x884a('0x3'));var BPromise=require(_0x884a('0x4'));var rp=require(_0x884a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x884a('0x6'));var config=require('../../config/environment');var attributes=require(_0x884a('0x7'));module['exports']=function(_0x3f93fc,_0x110acf){return _0x3f93fc[_0x884a('0x8')](_0x884a('0x9'),attributes,{'tableName':_0x884a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb84e=['rimraf','./openchannelQueue.attributes','exports','define','OpenchannelQueue','openchannel_queues','util','../../config/logger','api','moment','request-promise','path'];(function(_0x16b4a9,_0x4fea9e){var _0x4a1870=function(_0x2108d2){while(--_0x2108d2){_0x16b4a9['push'](_0x16b4a9['shift']());}};_0x4a1870(++_0x4fea9e);}(_0xb84e,0x102));var _0xeb84=function(_0x587ba2,_0x42eb40){_0x587ba2=_0x587ba2-0x0;var _0x50ec73=_0xb84e[_0x587ba2];return _0x50ec73;};'use strict';var _=require('lodash');var util=require(_0xeb84('0x0'));var logger=require(_0xeb84('0x1'))(_0xeb84('0x2'));var moment=require(_0xeb84('0x3'));var BPromise=require('bluebird');var rp=require(_0xeb84('0x4'));var fs=require('fs');var path=require(_0xeb84('0x5'));var rimraf=require(_0xeb84('0x6'));var config=require('../../config/environment');var attributes=require(_0xeb84('0x7'));module[_0xeb84('0x8')]=function(_0xaf5a92,_0x45cc9f){return _0xaf5a92[_0xeb84('0x9')](_0xeb84('0xa'),attributes,{'tableName':_0xeb84('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index fa39121..acb8456 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 _0x32bf=['model','debug','stringify','GetOpenchannelQueue','ShowOpenchannelQueue','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./openchannelQueue.socket','register','request','then','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','OpenchannelQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','OpenchannelQueue','findAll','options','raw','where','attributes','limit','include','map'];(function(_0x3cf78d,_0x3a467a){var _0x35e8d6=function(_0x24dfe1){while(--_0x24dfe1){_0x3cf78d['push'](_0x3cf78d['shift']());}};_0x35e8d6(++_0x3a467a);}(_0x32bf,0x83));var _0xf32b=function(_0x58ad2c,_0x5339f1){_0x58ad2c=_0x58ad2c-0x0;var _0x45346a=_0x32bf[_0x58ad2c];return _0x45346a;};'use strict';var _=require('lodash');var util=require(_0xf32b('0x0'));var moment=require(_0xf32b('0x1'));var BPromise=require(_0xf32b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf32b('0x3'));var db=require(_0xf32b('0x4'))['db'];var utils=require(_0xf32b('0x5'));var logger=require(_0xf32b('0x6'))(_0xf32b('0x7'));var config=require(_0xf32b('0x8'));var jayson=require(_0xf32b('0x9'));var client=jayson[_0xf32b('0xa')][_0xf32b('0xb')]({'port':0x232a});config[_0xf32b('0xc')]=_[_0xf32b('0xd')](config[_0xf32b('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xf32b('0xe'))(new Redis(config[_0xf32b('0xc')]));require(_0xf32b('0xf'))[_0xf32b('0x10')](socket);function respondWithRpcPromise(_0x5e94ef,_0x5f0463,_0xa58c5f){return new BPromise(function(_0xe80e5a,_0x140af6){return client[_0xf32b('0x11')](_0x5e94ef,_0xa58c5f)[_0xf32b('0x12')](function(_0x46a369){logger['info'](_0xf32b('0x13'),_0x5f0463,_0xf32b('0x14'));logger['debug'](_0xf32b('0x15'),_0x5f0463,'request\x20sent',JSON['stringify'](_0x46a369));if(_0x46a369['error']){if(_0x46a369[_0xf32b('0x16')][_0xf32b('0x17')]===0x1f4){logger['error'](_0xf32b('0x13'),_0x5f0463,_0x46a369['error'][_0xf32b('0x18')]);return _0x140af6(_0x46a369[_0xf32b('0x16')][_0xf32b('0x18')]);}logger[_0xf32b('0x16')]('OpenchannelQueue,\x20%s,\x20%s',_0x5f0463,_0x46a369[_0xf32b('0x16')]['message']);return _0xe80e5a(_0x46a369[_0xf32b('0x16')][_0xf32b('0x18')]);}else{logger[_0xf32b('0x19')](_0xf32b('0x13'),_0x5f0463,'request\x20sent');_0xe80e5a(_0x46a369[_0xf32b('0x1a')][_0xf32b('0x18')]);}})[_0xf32b('0x1b')](function(_0x59608e){logger[_0xf32b('0x16')](_0xf32b('0x13'),_0x5f0463,_0x59608e);_0x140af6(_0x59608e);});});}exports['GetOpenchannelQueue']=function(_0x3841f7){var _0x3b070b=this;return new Promise(function(_0x2b8b8f,_0x3aa1c1){return db[_0xf32b('0x1c')][_0xf32b('0x1d')]({'raw':_0x3841f7[_0xf32b('0x1e')]?_0x3841f7[_0xf32b('0x1e')][_0xf32b('0x1f')]===undefined?!![]:![]:!![],'where':_0x3841f7[_0xf32b('0x1e')]?_0x3841f7[_0xf32b('0x1e')][_0xf32b('0x20')]||null:null,'attributes':_0x3841f7['options']?_0x3841f7['options'][_0xf32b('0x21')]||null:null,'limit':_0x3841f7[_0xf32b('0x1e')]?_0x3841f7[_0xf32b('0x1e')][_0xf32b('0x22')]||null:null,'include':_0x3841f7[_0xf32b('0x1e')]?_0x3841f7[_0xf32b('0x1e')][_0xf32b('0x23')]?_[_0xf32b('0x24')](_0x3841f7['options'][_0xf32b('0x23')],function(_0x1d3e81){return{'model':db[_0x1d3e81[_0xf32b('0x25')]],'as':_0x1d3e81['as'],'attributes':_0x1d3e81[_0xf32b('0x21')],'include':_0x1d3e81[_0xf32b('0x23')]?_['map'](_0x1d3e81[_0xf32b('0x23')],function(_0x84d909){return{'model':db[_0x84d909['model']],'as':_0x84d909['as'],'attributes':_0x84d909[_0xf32b('0x21')],'include':_0x84d909['include']?_['map'](_0x84d909[_0xf32b('0x23')],function(_0x146c82){return{'model':db[_0x146c82[_0xf32b('0x25')]],'as':_0x146c82['as'],'attributes':_0x146c82['attributes']};}):[]};}):[]};}):[]:[]})[_0xf32b('0x12')](function(_0x110a49){logger[_0xf32b('0x19')]('GetOpenchannelQueue',_0x3841f7);logger[_0xf32b('0x26')]('GetOpenchannelQueue',_0x3841f7,JSON[_0xf32b('0x27')](_0x110a49));_0x2b8b8f(_0x110a49);})[_0xf32b('0x1b')](function(_0x1f3c05){logger[_0xf32b('0x16')](_0xf32b('0x28'),_0x1f3c05[_0xf32b('0x18')],_0x3841f7);_0x3aa1c1(_0x3b070b[_0xf32b('0x16')](0x1f4,_0x1f3c05['message']));});});};exports[_0xf32b('0x29')]=function(_0x303fb6){var _0x133882=this;return new Promise(function(_0x40abdc,_0x2248d9){return db[_0xf32b('0x1c')]['find']({'raw':_0x303fb6['options']?_0x303fb6[_0xf32b('0x1e')][_0xf32b('0x1f')]===undefined?!![]:![]:!![],'where':_0x303fb6[_0xf32b('0x1e')]?_0x303fb6['options'][_0xf32b('0x20')]||null:null,'attributes':_0x303fb6[_0xf32b('0x1e')]?_0x303fb6['options'][_0xf32b('0x21')]||null:null,'include':_0x303fb6[_0xf32b('0x1e')]?_0x303fb6[_0xf32b('0x1e')][_0xf32b('0x23')]?_[_0xf32b('0x24')](_0x303fb6[_0xf32b('0x1e')][_0xf32b('0x23')],function(_0x48a488){return{'model':db[_0x48a488[_0xf32b('0x25')]],'as':_0x48a488['as'],'attributes':_0x48a488['attributes'],'include':_0x48a488['include']?_['map'](_0x48a488[_0xf32b('0x23')],function(_0x2a370d){return{'model':db[_0x2a370d[_0xf32b('0x25')]],'as':_0x2a370d['as'],'attributes':_0x2a370d['attributes'],'include':_0x2a370d['include']?_['map'](_0x2a370d[_0xf32b('0x23')],function(_0x43a77a){return{'model':db[_0x43a77a[_0xf32b('0x25')]],'as':_0x43a77a['as'],'attributes':_0x43a77a[_0xf32b('0x21')]};}):[]};}):[]};}):[]:[]})[_0xf32b('0x12')](function(_0x2c4b5a){logger[_0xf32b('0x19')](_0xf32b('0x29'),_0x303fb6);logger['debug']('ShowOpenchannelQueue',_0x303fb6,JSON['stringify'](_0x2c4b5a));_0x40abdc(_0x2c4b5a);})[_0xf32b('0x1b')](function(_0x47eb22){logger['error'](_0xf32b('0x29'),_0x47eb22[_0xf32b('0x18')],_0x303fb6);_0x2248d9(_0x133882['error'](0x1f4,_0x47eb22[_0xf32b('0x18')]));});});}; \ No newline at end of file +var _0x52bf=['map','debug','catch','find','raw','ShowOpenchannelQueue','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','defaults','localhost','socket.io-emitter','redis','./openchannelQueue.socket','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetOpenchannelQueue','OpenchannelQueue','options','where','attributes','include','model'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x52bf,0xfc));var _0xf52b=function(_0x2caa8e,_0x3cdb46){_0x2caa8e=_0x2caa8e-0x0;var _0x5a94b8=_0x52bf[_0x2caa8e];return _0x5a94b8;};'use strict';var _=require(_0xf52b('0x0'));var util=require(_0xf52b('0x1'));var moment=require(_0xf52b('0x2'));var BPromise=require(_0xf52b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf52b('0x4'));var db=require(_0xf52b('0x5'))['db'];var utils=require(_0xf52b('0x6'));var logger=require(_0xf52b('0x7'))('rpc');var config=require(_0xf52b('0x8'));var jayson=require(_0xf52b('0x9'));var client=jayson['client'][_0xf52b('0xa')]({'port':0x232a});config['redis']=_[_0xf52b('0xb')](config['redis'],{'host':_0xf52b('0xc'),'port':0x18eb});var socket=require(_0xf52b('0xd'))(new Redis(config[_0xf52b('0xe')]));require(_0xf52b('0xf'))[_0xf52b('0x10')](socket);function respondWithRpcPromise(_0x51cd02,_0x2c01f3,_0x556d3b){return new BPromise(function(_0x20f29f,_0x4f8d93){return client[_0xf52b('0x11')](_0x51cd02,_0x556d3b)[_0xf52b('0x12')](function(_0x3725e1){logger[_0xf52b('0x13')](_0xf52b('0x14'),_0x2c01f3,_0xf52b('0x15'));logger['debug'](_0xf52b('0x16'),_0x2c01f3,_0xf52b('0x15'),JSON[_0xf52b('0x17')](_0x3725e1));if(_0x3725e1['error']){if(_0x3725e1[_0xf52b('0x18')][_0xf52b('0x19')]===0x1f4){logger['error'](_0xf52b('0x14'),_0x2c01f3,_0x3725e1[_0xf52b('0x18')][_0xf52b('0x1a')]);return _0x4f8d93(_0x3725e1['error'][_0xf52b('0x1a')]);}logger['error'](_0xf52b('0x14'),_0x2c01f3,_0x3725e1[_0xf52b('0x18')]['message']);return _0x20f29f(_0x3725e1[_0xf52b('0x18')][_0xf52b('0x1a')]);}else{logger['info'](_0xf52b('0x14'),_0x2c01f3,_0xf52b('0x15'));_0x20f29f(_0x3725e1[_0xf52b('0x1b')]['message']);}})['catch'](function(_0x5263d5){logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0x2c01f3,_0x5263d5);_0x4f8d93(_0x5263d5);});});}exports[_0xf52b('0x1c')]=function(_0x987c2d){var _0x137558=this;return new Promise(function(_0x15b360,_0x23b5b0){return db[_0xf52b('0x1d')]['findAll']({'raw':_0x987c2d[_0xf52b('0x1e')]?_0x987c2d[_0xf52b('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x987c2d['options']?_0x987c2d[_0xf52b('0x1e')][_0xf52b('0x1f')]||null:null,'attributes':_0x987c2d['options']?_0x987c2d[_0xf52b('0x1e')][_0xf52b('0x20')]||null:null,'limit':_0x987c2d[_0xf52b('0x1e')]?_0x987c2d[_0xf52b('0x1e')]['limit']||null:null,'include':_0x987c2d[_0xf52b('0x1e')]?_0x987c2d['options'][_0xf52b('0x21')]?_['map'](_0x987c2d[_0xf52b('0x1e')]['include'],function(_0x311fe3){return{'model':db[_0x311fe3[_0xf52b('0x22')]],'as':_0x311fe3['as'],'attributes':_0x311fe3[_0xf52b('0x20')],'include':_0x311fe3['include']?_['map'](_0x311fe3['include'],function(_0x3a2f16){return{'model':db[_0x3a2f16['model']],'as':_0x3a2f16['as'],'attributes':_0x3a2f16['attributes'],'include':_0x3a2f16[_0xf52b('0x21')]?_[_0xf52b('0x23')](_0x3a2f16[_0xf52b('0x21')],function(_0x179bbb){return{'model':db[_0x179bbb[_0xf52b('0x22')]],'as':_0x179bbb['as'],'attributes':_0x179bbb[_0xf52b('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x413bac){logger[_0xf52b('0x13')]('GetOpenchannelQueue',_0x987c2d);logger[_0xf52b('0x24')]('GetOpenchannelQueue',_0x987c2d,JSON[_0xf52b('0x17')](_0x413bac));_0x15b360(_0x413bac);})[_0xf52b('0x25')](function(_0x33d4f3){logger[_0xf52b('0x18')](_0xf52b('0x1c'),_0x33d4f3['message'],_0x987c2d);_0x23b5b0(_0x137558['error'](0x1f4,_0x33d4f3[_0xf52b('0x1a')]));});});};exports['ShowOpenchannelQueue']=function(_0x2c7113){var _0x37dba0=this;return new Promise(function(_0x16a180,_0x28f81b){return db[_0xf52b('0x1d')][_0xf52b('0x26')]({'raw':_0x2c7113[_0xf52b('0x1e')]?_0x2c7113[_0xf52b('0x1e')][_0xf52b('0x27')]===undefined?!![]:![]:!![],'where':_0x2c7113[_0xf52b('0x1e')]?_0x2c7113[_0xf52b('0x1e')]['where']||null:null,'attributes':_0x2c7113[_0xf52b('0x1e')]?_0x2c7113[_0xf52b('0x1e')][_0xf52b('0x20')]||null:null,'include':_0x2c7113[_0xf52b('0x1e')]?_0x2c7113['options']['include']?_[_0xf52b('0x23')](_0x2c7113[_0xf52b('0x1e')][_0xf52b('0x21')],function(_0x39934b){return{'model':db[_0x39934b[_0xf52b('0x22')]],'as':_0x39934b['as'],'attributes':_0x39934b['attributes'],'include':_0x39934b[_0xf52b('0x21')]?_[_0xf52b('0x23')](_0x39934b[_0xf52b('0x21')],function(_0x48dae3){return{'model':db[_0x48dae3[_0xf52b('0x22')]],'as':_0x48dae3['as'],'attributes':_0x48dae3[_0xf52b('0x20')],'include':_0x48dae3[_0xf52b('0x21')]?_[_0xf52b('0x23')](_0x48dae3[_0xf52b('0x21')],function(_0x198a06){return{'model':db[_0x198a06[_0xf52b('0x22')]],'as':_0x198a06['as'],'attributes':_0x198a06[_0xf52b('0x20')]};}):[]};}):[]};}):[]:[]})[_0xf52b('0x12')](function(_0x290341){logger[_0xf52b('0x13')](_0xf52b('0x28'),_0x2c7113);logger[_0xf52b('0x24')](_0xf52b('0x28'),_0x2c7113,JSON[_0xf52b('0x17')](_0x290341));_0x16a180(_0x290341);})[_0xf52b('0x25')](function(_0x8d2298){logger['error']('ShowOpenchannelQueue',_0x8d2298['message'],_0x2c7113);_0x28f81b(_0x37dba0[_0xf52b('0x18')](0x1f4,_0x8d2298[_0xf52b('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 8a253ed..c960ce2 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 _0x3684=['update','emit','removeListener','length','openchannelQueue:','./openchannelQueue.events','save','remove'];(function(_0xa45395,_0x5579e6){var _0x3c83d2=function(_0x5d013c){while(--_0x5d013c){_0xa45395['push'](_0xa45395['shift']());}};_0x3c83d2(++_0x5579e6);}(_0x3684,0x155));var _0x4368=function(_0x58baa2,_0x15de4b){_0x58baa2=_0x58baa2-0x0;var _0x795f0a=_0x3684[_0x58baa2];return _0x795f0a;};'use strict';var OpenchannelQueueEvents=require(_0x4368('0x0'));var events=[_0x4368('0x1'),_0x4368('0x2'),_0x4368('0x3')];function createListener(_0x4e65ea,_0x1ccefd){return function(_0x50ec9d){_0x1ccefd[_0x4368('0x4')](_0x4e65ea,_0x50ec9d);};}function removeListener(_0x2ffe7c,_0x153d98){return function(){OpenchannelQueueEvents[_0x4368('0x5')](_0x2ffe7c,_0x153d98);};}exports['register']=function(_0x317602){for(var _0x541b8c=0x0,_0x40d20d=events[_0x4368('0x6')];_0x541b8c<_0x40d20d;_0x541b8c++){var _0x2382b4=events[_0x541b8c];var _0x1fa979=createListener(_0x4368('0x7')+_0x2382b4,_0x317602);OpenchannelQueueEvents['on'](_0x2382b4,_0x1fa979);}}; \ No newline at end of file +var _0x1806=['register','length','openchannelQueue:','save','removeListener'];(function(_0x2da958,_0x372781){var _0x44600d=function(_0x18388c){while(--_0x18388c){_0x2da958['push'](_0x2da958['shift']());}};_0x44600d(++_0x372781);}(_0x1806,0x8f));var _0x6180=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x1806[_0x3b380d];return _0x54502b;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=[_0x6180('0x0'),'remove','update'];function createListener(_0x37bc15,_0x1a6fbf){return function(_0x2673b6){_0x1a6fbf['emit'](_0x37bc15,_0x2673b6);};}function removeListener(_0x5af5ab,_0x54282f){return function(){OpenchannelQueueEvents[_0x6180('0x1')](_0x5af5ab,_0x54282f);};}exports[_0x6180('0x2')]=function(_0x4b3f8a){for(var _0x547f18=0x0,_0x3e78a4=events[_0x6180('0x3')];_0x547f18<_0x3e78a4;_0x547f18++){var _0x21c6fe=events[_0x547f18];var _0x1e6edd=createListener(_0x6180('0x4')+_0x21c6fe,_0x4b3f8a);OpenchannelQueueEvents['on'](_0x21c6fe,_0x1e6edd);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 466aaf6..09ccfd6 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 _0xca5d=['show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x2f7bda,_0x427a49){var _0x787430=function(_0x4d17ef){while(--_0x4d17ef){_0x2f7bda['push'](_0x2f7bda['shift']());}};_0x787430(++_0x427a49);}(_0xca5d,0x196));var _0xdca5=function(_0x1c3b1d,_0x5ad449){_0x1c3b1d=_0x1c3b1d-0x0;var _0x3eef73=_0xca5d[_0x1c3b1d];return _0x3eef73;};'use strict';var multer=require(_0xdca5('0x0'));var util=require(_0xdca5('0x1'));var path=require(_0xdca5('0x2'));var timeout=require(_0xdca5('0x3'));var express=require('express');var router=express[_0xdca5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xdca5('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xdca5('0x6'));var controller=require(_0xdca5('0x7'));router[_0xdca5('0x8')]('/',auth[_0xdca5('0x9')](),controller[_0xdca5('0xa')]);router[_0xdca5('0x8')](_0xdca5('0xb'),auth['isAuthenticated'](),controller[_0xdca5('0xc')]);router[_0xdca5('0x8')](_0xdca5('0xd'),auth[_0xdca5('0x9')](),controller[_0xdca5('0xe')]);router[_0xdca5('0xf')]('/',auth[_0xdca5('0x9')](),controller[_0xdca5('0x10')]);router[_0xdca5('0x11')](_0xdca5('0xd'),auth[_0xdca5('0x9')](),controller[_0xdca5('0x12')]);router[_0xdca5('0x13')](_0xdca5('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0xdca5('0x14')]=router; \ No newline at end of file +var _0xd752=['exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy'];(function(_0x1a0600,_0x41feef){var _0x734670=function(_0x2da4e4){while(--_0x2da4e4){_0x1a0600['push'](_0x1a0600['shift']());}};_0x734670(++_0x41feef);}(_0xd752,0x6f));var _0x2d75=function(_0x4b92b9,_0x1bd47d){_0x4b92b9=_0x4b92b9-0x0;var _0x157b9d=_0xd752[_0x4b92b9];return _0x157b9d;};'use strict';var multer=require('multer');var util=require(_0x2d75('0x0'));var path=require(_0x2d75('0x1'));var timeout=require(_0x2d75('0x2'));var express=require(_0x2d75('0x3'));var router=express[_0x2d75('0x4')]();var fs_extra=require(_0x2d75('0x5'));var auth=require(_0x2d75('0x6'));var interaction=require(_0x2d75('0x7'));var config=require(_0x2d75('0x8'));var controller=require(_0x2d75('0x9'));router[_0x2d75('0xa')]('/',auth[_0x2d75('0xb')](),controller[_0x2d75('0xc')]);router[_0x2d75('0xa')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x2d75('0xa')](_0x2d75('0xd'),auth['isAuthenticated'](),controller[_0x2d75('0xe')]);router[_0x2d75('0xf')]('/',auth[_0x2d75('0xb')](),controller[_0x2d75('0x10')]);router[_0x2d75('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x2d75('0x12')]);router[_0x2d75('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x2d75('0x14')]);module[_0x2d75('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 1e11d00..ae50d5d 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 _0xf96e=['DATE','moment','sequelize','exports','STRING'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf96e,0x196));var _0xef96=function(_0x264b1a,_0x15646c){_0x264b1a=_0x264b1a-0x0;var _0x4aad96=_0xf96e[_0x264b1a];return _0x4aad96;};'use strict';var moment=require(_0xef96('0x0'));var Sequelize=require(_0xef96('0x1'));module[_0xef96('0x2')]={'uniqueid':{'type':Sequelize[_0xef96('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xef96('0x3')]},'joinAt':{'type':Sequelize[_0xef96('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xef96('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xef96('0x3')]}}; \ No newline at end of file +var _0x9490=['STRING','DATE'];(function(_0x261297,_0xe0d298){var _0x38c1ea=function(_0x4f14b7){while(--_0x4f14b7){_0x261297['push'](_0x261297['shift']());}};_0x38c1ea(++_0xe0d298);}(_0x9490,0x15c));var _0x0949=function(_0xf1e3ad,_0x1b6fb8){_0xf1e3ad=_0xf1e3ad-0x0;var _0x47592b=_0x9490[_0xf1e3ad];return _0x47592b;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x0949('0x0')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x0949('0x1')]},'leaveAt':{'type':Sequelize[_0x0949('0x1')]},'acceptAt':{'type':Sequelize[_0x0949('0x1')]},'exitAt':{'type':Sequelize[_0x0949('0x1')]},'reason':{'type':Sequelize[_0x0949('0x0')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index ea74654..cbe3f31 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 _0x29e3=['rawAttributes','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','merge','where','VIRTUAL','options','includeAll','include','then','rows','catch','show','params','find','create','body','destroy','describe','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','stack','name','send','map','OpenchannelQueueReport'];(function(_0x335104,_0x2802ef){var _0x49057f=function(_0xcf0a97){while(--_0xcf0a97){_0x335104['push'](_0x335104['shift']());}};_0x49057f(++_0x2802ef);}(_0x29e3,0x143));var _0x329e=function(_0x406a7e,_0x38da5c){_0x406a7e=_0x406a7e-0x0;var _0x4ac067=_0x29e3[_0x406a7e];return _0x4ac067;};'use strict';var emlformat=require(_0x329e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x329e('0x1'));var rp=require('request-promise');var moment=require(_0x329e('0x2'));var BPromise=require(_0x329e('0x3'));var Mustache=require(_0x329e('0x4'));var util=require(_0x329e('0x5'));var path=require(_0x329e('0x6'));var sox=require(_0x329e('0x7'));var csv=require(_0x329e('0x8'));var ejs=require(_0x329e('0x9'));var fs=require('fs');var fs_extra=require(_0x329e('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x329e('0xb'));var jsforce=require(_0x329e('0xc'));var deskjs=require(_0x329e('0xd'));var toCsv=require(_0x329e('0x8'));var querystring=require(_0x329e('0xe'));var Papa=require('papaparse');var Redis=require(_0x329e('0xf'));var authService=require(_0x329e('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x329e('0x11'));var hardwareService=require(_0x329e('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x329e('0x13'));var config=require(_0x329e('0x14'));var licenseUtil=require(_0x329e('0x15'));var db=require(_0x329e('0x16'))['db'];function respondWithStatusCode(_0xc02c25,_0x3845ca){_0x3845ca=_0x3845ca||0xcc;return function(_0x2d0ab5){if(_0x2d0ab5){return _0xc02c25[_0x329e('0x17')](_0x3845ca);}return _0xc02c25['status'](_0x3845ca)[_0x329e('0x18')]();};}function respondWithResult(_0x2e7963,_0x321be9){_0x321be9=_0x321be9||0xc8;return function(_0x4a5e9b){if(_0x4a5e9b){return _0x2e7963['status'](_0x321be9)[_0x329e('0x19')](_0x4a5e9b);}};}function respondWithFilteredResult(_0x116dc6,_0xff085e){return function(_0x43fc7c){if(_0x43fc7c){var _0x192699=typeof _0xff085e[_0x329e('0x1a')]===_0x329e('0x1b')&&typeof _0xff085e[_0x329e('0x1c')]==='undefined';var _0x1f1911=_0x43fc7c[_0x329e('0x1d')];var _0x90937a=_0x192699?0x0:_0xff085e['offset'];var _0xd4a55a=_0x192699?_0x43fc7c[_0x329e('0x1d')]:_0xff085e[_0x329e('0x1a')]+_0xff085e[_0x329e('0x1c')];var _0x4b61ed;if(_0xd4a55a>=_0x1f1911){_0xd4a55a=_0x1f1911;_0x4b61ed=0xc8;}else{_0x4b61ed=0xce;}_0x116dc6[_0x329e('0x1e')](_0x4b61ed);return _0x116dc6[_0x329e('0x1f')](_0x329e('0x20'),_0x90937a+'-'+_0xd4a55a+'/'+_0x1f1911)[_0x329e('0x19')](_0x43fc7c);}return null;};}function patchUpdates(_0x18bc48){return function(_0x3e5d77){try{jsonpatch[_0x329e('0x21')](_0x3e5d77,_0x18bc48,!![]);}catch(_0x37b1ca){return BPromise[_0x329e('0x22')](_0x37b1ca);}return _0x3e5d77[_0x329e('0x23')]();};}function saveUpdates(_0x3d73a7,_0x534246){return function(_0x2641c8){if(_0x2641c8){return _0x2641c8[_0x329e('0x24')](_0x3d73a7)['then'](function(_0x211318){return _0x211318;});}return null;};}function removeEntity(_0x286415,_0x1b2b3b){return function(_0x15fbfd){if(_0x15fbfd){return _0x15fbfd['destroy']()['then'](function(){_0x286415[_0x329e('0x1e')](0xcc)[_0x329e('0x18')]();});}};}function handleEntityNotFound(_0x59b294,_0xe9adce){return function(_0x41ede6){if(!_0x41ede6){_0x59b294['sendStatus'](0x194);}return _0x41ede6;};}function handleError(_0x526e52,_0x5ed055){_0x5ed055=_0x5ed055||0x1f4;return function(_0x1a45f1){logger['error'](_0x1a45f1[_0x329e('0x25')]);if(_0x1a45f1[_0x329e('0x26')]){delete _0x1a45f1[_0x329e('0x26')];}_0x526e52['status'](_0x5ed055)[_0x329e('0x27')](_0x1a45f1);};}exports['index']=function(_0x1235d3,_0x1aa243){var _0x18e83f={},_0x1da04b={},_0x181055={'count':0x0,'rows':[]};var _0x2d2044=_[_0x329e('0x28')](db[_0x329e('0x29')][_0x329e('0x2a')],function(_0x545100){return{'name':_0x545100['fieldName'],'type':_0x545100[_0x329e('0x2b')][_0x329e('0x2c')]};});_0x1da04b[_0x329e('0x2d')]=_[_0x329e('0x28')](_0x2d2044,_0x329e('0x26'));_0x1da04b['query']=_[_0x329e('0x2e')](_0x1235d3['query']);_0x1da04b[_0x329e('0x2f')]=_[_0x329e('0x30')](_0x1da04b[_0x329e('0x2d')],_0x1da04b[_0x329e('0x31')]);_0x18e83f[_0x329e('0x32')]=_[_0x329e('0x30')](_0x1da04b[_0x329e('0x2d')],qs[_0x329e('0x33')](_0x1235d3[_0x329e('0x31')][_0x329e('0x33')]));_0x18e83f['attributes']=_0x18e83f[_0x329e('0x32')][_0x329e('0x34')]?_0x18e83f[_0x329e('0x32')]:_0x1da04b[_0x329e('0x2d')];if(!_0x1235d3[_0x329e('0x31')][_0x329e('0x35')](_0x329e('0x36'))){_0x18e83f['limit']=qs[_0x329e('0x1c')](_0x1235d3['query']['limit']);_0x18e83f[_0x329e('0x1a')]=qs[_0x329e('0x1a')](_0x1235d3[_0x329e('0x31')][_0x329e('0x1a')]);}_0x18e83f['order']=qs[_0x329e('0x37')](_0x1235d3[_0x329e('0x31')][_0x329e('0x37')]);_0x18e83f['where']=qs['filters'](_['pick'](_0x1235d3[_0x329e('0x31')],_0x1da04b[_0x329e('0x2f')]),_0x2d2044);if(_0x1235d3[_0x329e('0x31')][_0x329e('0x38')]){_0x18e83f['where']=_[_0x329e('0x39')](_0x18e83f[_0x329e('0x3a')],{'$or':_[_0x329e('0x28')](_0x2d2044,function(_0x16a9ef){if(_0x16a9ef['type']!==_0x329e('0x3b')){var _0x3f09f3={};_0x3f09f3[_0x16a9ef['name']]={'$like':'%'+_0x1235d3[_0x329e('0x31')]['filter']+'%'};return _0x3f09f3;}})});}_0x18e83f=_[_0x329e('0x39')]({},_0x18e83f,_0x1235d3[_0x329e('0x3c')]);var _0x55e04a={'where':_0x18e83f['where']};return db[_0x329e('0x29')]['count'](_0x55e04a)['then'](function(_0x42e8f6){_0x181055[_0x329e('0x1d')]=_0x42e8f6;if(_0x1235d3['query'][_0x329e('0x3d')]){_0x18e83f[_0x329e('0x3e')]=[{'all':!![]}];}return db[_0x329e('0x29')]['findAll'](_0x18e83f);})[_0x329e('0x3f')](function(_0x341a25){_0x181055[_0x329e('0x40')]=_0x341a25;return _0x181055;})[_0x329e('0x3f')](respondWithFilteredResult(_0x1aa243,_0x18e83f))[_0x329e('0x41')](handleError(_0x1aa243,null));};exports[_0x329e('0x42')]=function(_0x56f20f,_0x1a281a){var _0x11d3c5={'raw':!![],'where':{'id':_0x56f20f[_0x329e('0x43')]['id']}},_0x2a1472={};_0x2a1472[_0x329e('0x2d')]=_[_0x329e('0x2e')](db['OpenchannelQueueReport'][_0x329e('0x2a')]);_0x2a1472[_0x329e('0x31')]=_[_0x329e('0x2e')](_0x56f20f[_0x329e('0x31')]);_0x2a1472[_0x329e('0x2f')]=_[_0x329e('0x30')](_0x2a1472['model'],_0x2a1472[_0x329e('0x31')]);_0x11d3c5['attributes']=_[_0x329e('0x30')](_0x2a1472[_0x329e('0x2d')],qs['fields'](_0x56f20f['query'][_0x329e('0x33')]));_0x11d3c5[_0x329e('0x32')]=_0x11d3c5[_0x329e('0x32')][_0x329e('0x34')]?_0x11d3c5[_0x329e('0x32')]:_0x2a1472[_0x329e('0x2d')];if(_0x56f20f[_0x329e('0x31')]['includeAll']){_0x11d3c5['include']=[{'all':!![]}];}_0x11d3c5=_['merge']({},_0x11d3c5,_0x56f20f['options']);return db[_0x329e('0x29')][_0x329e('0x44')](_0x11d3c5)[_0x329e('0x3f')](handleEntityNotFound(_0x1a281a,null))[_0x329e('0x3f')](respondWithResult(_0x1a281a,null))['catch'](handleError(_0x1a281a,null));};exports[_0x329e('0x45')]=function(_0x5b85d5,_0x5a4bda){return db['OpenchannelQueueReport']['create'](_0x5b85d5[_0x329e('0x46')],{})[_0x329e('0x3f')](respondWithResult(_0x5a4bda,0xc9))['catch'](handleError(_0x5a4bda,null));};exports[_0x329e('0x24')]=function(_0x5a4c23,_0xf72dc){if(_0x5a4c23[_0x329e('0x46')]['id']){delete _0x5a4c23[_0x329e('0x46')]['id'];}return db[_0x329e('0x29')][_0x329e('0x44')]({'where':{'id':_0x5a4c23['params']['id']}})['then'](handleEntityNotFound(_0xf72dc,null))[_0x329e('0x3f')](saveUpdates(_0x5a4c23['body'],null))['then'](respondWithResult(_0xf72dc,null))[_0x329e('0x41')](handleError(_0xf72dc,null));};exports[_0x329e('0x47')]=function(_0x5425f6,_0x35d8d2){return db[_0x329e('0x29')][_0x329e('0x44')]({'where':{'id':_0x5425f6[_0x329e('0x43')]['id']}})[_0x329e('0x3f')](handleEntityNotFound(_0x35d8d2,null))[_0x329e('0x3f')](removeEntity(_0x35d8d2,null))[_0x329e('0x41')](handleError(_0x35d8d2,null));};exports[_0x329e('0x48')]=function(_0x4d0ee0,_0x139e95){return db[_0x329e('0x29')][_0x329e('0x48')]()[_0x329e('0x3f')](respondWithResult(_0x139e95,null))['catch'](handleError(_0x139e95,null));}; \ No newline at end of file +var _0x4c34=['send','index','map','OpenchannelQueueReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','length','nolimit','sort','where','pick','merge','filter','options','includeAll','findAll','catch','show','fields','find','create','body','params','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name'];(function(_0x4abcf4,_0x4d80bc){var _0x24c066=function(_0x52ef99){while(--_0x52ef99){_0x4abcf4['push'](_0x4abcf4['shift']());}};_0x24c066(++_0x4d80bc);}(_0x4c34,0xfc));var _0x44c3=function(_0x39bfe1,_0x33525d){_0x39bfe1=_0x39bfe1-0x0;var _0x120d1a=_0x4c34[_0x39bfe1];return _0x120d1a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x44c3('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x44c3('0x1'));var moment=require(_0x44c3('0x2'));var BPromise=require(_0x44c3('0x3'));var Mustache=require(_0x44c3('0x4'));var util=require(_0x44c3('0x5'));var path=require(_0x44c3('0x6'));var sox=require(_0x44c3('0x7'));var csv=require(_0x44c3('0x8'));var ejs=require(_0x44c3('0x9'));var fs=require('fs');var fs_extra=require(_0x44c3('0xa'));var _=require(_0x44c3('0xb'));var squel=require(_0x44c3('0xc'));var crypto=require(_0x44c3('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x44c3('0xe'));var toCsv=require(_0x44c3('0x8'));var querystring=require(_0x44c3('0xf'));var Papa=require('papaparse');var Redis=require(_0x44c3('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x44c3('0x11'));var as=require(_0x44c3('0x12'));var hardwareService=require(_0x44c3('0x13'));var logger=require(_0x44c3('0x14'))(_0x44c3('0x15'));var utils=require(_0x44c3('0x16'));var config=require(_0x44c3('0x17'));var licenseUtil=require(_0x44c3('0x18'));var db=require(_0x44c3('0x19'))['db'];function respondWithStatusCode(_0x255f09,_0xf02492){_0xf02492=_0xf02492||0xcc;return function(_0x2584b3){if(_0x2584b3){return _0x255f09[_0x44c3('0x1a')](_0xf02492);}return _0x255f09[_0x44c3('0x1b')](_0xf02492)[_0x44c3('0x1c')]();};}function respondWithResult(_0x4808b8,_0xc06336){_0xc06336=_0xc06336||0xc8;return function(_0x4791c0){if(_0x4791c0){return _0x4808b8[_0x44c3('0x1b')](_0xc06336)[_0x44c3('0x1d')](_0x4791c0);}};}function respondWithFilteredResult(_0x102264,_0x5108da){return function(_0x229739){if(_0x229739){var _0x118118=typeof _0x5108da[_0x44c3('0x1e')]===_0x44c3('0x1f')&&typeof _0x5108da[_0x44c3('0x20')]==='undefined';var _0x20b4a6=_0x229739[_0x44c3('0x21')];var _0x597fda=_0x118118?0x0:_0x5108da[_0x44c3('0x1e')];var _0x76294f=_0x118118?_0x229739[_0x44c3('0x21')]:_0x5108da[_0x44c3('0x1e')]+_0x5108da['limit'];var _0x493d8c;if(_0x76294f>=_0x20b4a6){_0x76294f=_0x20b4a6;_0x493d8c=0xc8;}else{_0x493d8c=0xce;}_0x102264[_0x44c3('0x1b')](_0x493d8c);return _0x102264[_0x44c3('0x22')](_0x44c3('0x23'),_0x597fda+'-'+_0x76294f+'/'+_0x20b4a6)[_0x44c3('0x1d')](_0x229739);}return null;};}function patchUpdates(_0x283253){return function(_0x254b0d){try{jsonpatch['apply'](_0x254b0d,_0x283253,!![]);}catch(_0x1c3da7){return BPromise[_0x44c3('0x24')](_0x1c3da7);}return _0x254b0d[_0x44c3('0x25')]();};}function saveUpdates(_0x402590,_0x3ffbdb){return function(_0x2f1c60){if(_0x2f1c60){return _0x2f1c60[_0x44c3('0x26')](_0x402590)[_0x44c3('0x27')](function(_0x464076){return _0x464076;});}return null;};}function removeEntity(_0x47ee51,_0x5a8ca8){return function(_0x990fe7){if(_0x990fe7){return _0x990fe7[_0x44c3('0x28')]()[_0x44c3('0x27')](function(){_0x47ee51[_0x44c3('0x1b')](0xcc)[_0x44c3('0x1c')]();});}};}function handleEntityNotFound(_0x14b988,_0x2687fb){return function(_0x1ccf99){if(!_0x1ccf99){_0x14b988[_0x44c3('0x1a')](0x194);}return _0x1ccf99;};}function handleError(_0x3a23c1,_0x10384c){_0x10384c=_0x10384c||0x1f4;return function(_0x3f6e00){logger[_0x44c3('0x29')](_0x3f6e00[_0x44c3('0x2a')]);if(_0x3f6e00[_0x44c3('0x2b')]){delete _0x3f6e00[_0x44c3('0x2b')];}_0x3a23c1[_0x44c3('0x1b')](_0x10384c)[_0x44c3('0x2c')](_0x3f6e00);};}exports[_0x44c3('0x2d')]=function(_0x405894,_0x30cb30){var _0x3b1a53={},_0x1f3028={},_0x2aee3a={'count':0x0,'rows':[]};var _0x1d3f88=_[_0x44c3('0x2e')](db[_0x44c3('0x2f')][_0x44c3('0x30')],function(_0x40c39a){return{'name':_0x40c39a['fieldName'],'type':_0x40c39a[_0x44c3('0x31')][_0x44c3('0x32')]};});_0x1f3028[_0x44c3('0x33')]=_[_0x44c3('0x2e')](_0x1d3f88,_0x44c3('0x2b'));_0x1f3028[_0x44c3('0x34')]=_[_0x44c3('0x35')](_0x405894[_0x44c3('0x34')]);_0x1f3028[_0x44c3('0x36')]=_[_0x44c3('0x37')](_0x1f3028[_0x44c3('0x33')],_0x1f3028[_0x44c3('0x34')]);_0x3b1a53[_0x44c3('0x38')]=_[_0x44c3('0x37')](_0x1f3028['model'],qs['fields'](_0x405894[_0x44c3('0x34')]['fields']));_0x3b1a53[_0x44c3('0x38')]=_0x3b1a53[_0x44c3('0x38')][_0x44c3('0x39')]?_0x3b1a53[_0x44c3('0x38')]:_0x1f3028['model'];if(!_0x405894['query']['hasOwnProperty'](_0x44c3('0x3a'))){_0x3b1a53['limit']=qs[_0x44c3('0x20')](_0x405894[_0x44c3('0x34')][_0x44c3('0x20')]);_0x3b1a53[_0x44c3('0x1e')]=qs[_0x44c3('0x1e')](_0x405894['query']['offset']);}_0x3b1a53['order']=qs['sort'](_0x405894['query'][_0x44c3('0x3b')]);_0x3b1a53[_0x44c3('0x3c')]=qs[_0x44c3('0x36')](_[_0x44c3('0x3d')](_0x405894[_0x44c3('0x34')],_0x1f3028['filters']),_0x1d3f88);if(_0x405894[_0x44c3('0x34')]['filter']){_0x3b1a53[_0x44c3('0x3c')]=_[_0x44c3('0x3e')](_0x3b1a53['where'],{'$or':_['map'](_0x1d3f88,function(_0x4efe89){if(_0x4efe89[_0x44c3('0x31')]!=='VIRTUAL'){var _0x18515c={};_0x18515c[_0x4efe89[_0x44c3('0x2b')]]={'$like':'%'+_0x405894[_0x44c3('0x34')][_0x44c3('0x3f')]+'%'};return _0x18515c;}})});}_0x3b1a53=_['merge']({},_0x3b1a53,_0x405894[_0x44c3('0x40')]);var _0x57a6fa={'where':_0x3b1a53[_0x44c3('0x3c')]};return db[_0x44c3('0x2f')][_0x44c3('0x21')](_0x57a6fa)[_0x44c3('0x27')](function(_0xef1c9e){_0x2aee3a[_0x44c3('0x21')]=_0xef1c9e;if(_0x405894[_0x44c3('0x34')][_0x44c3('0x41')]){_0x3b1a53['include']=[{'all':!![]}];}return db[_0x44c3('0x2f')][_0x44c3('0x42')](_0x3b1a53);})[_0x44c3('0x27')](function(_0x56f064){_0x2aee3a['rows']=_0x56f064;return _0x2aee3a;})[_0x44c3('0x27')](respondWithFilteredResult(_0x30cb30,_0x3b1a53))[_0x44c3('0x43')](handleError(_0x30cb30,null));};exports[_0x44c3('0x44')]=function(_0x1da523,_0x284c16){var _0x4fab8b={'raw':!![],'where':{'id':_0x1da523['params']['id']}},_0x56fbcf={};_0x56fbcf['model']=_[_0x44c3('0x35')](db['OpenchannelQueueReport'][_0x44c3('0x30')]);_0x56fbcf[_0x44c3('0x34')]=_[_0x44c3('0x35')](_0x1da523['query']);_0x56fbcf['filters']=_[_0x44c3('0x37')](_0x56fbcf[_0x44c3('0x33')],_0x56fbcf[_0x44c3('0x34')]);_0x4fab8b[_0x44c3('0x38')]=_['intersection'](_0x56fbcf['model'],qs[_0x44c3('0x45')](_0x1da523[_0x44c3('0x34')][_0x44c3('0x45')]));_0x4fab8b[_0x44c3('0x38')]=_0x4fab8b['attributes'][_0x44c3('0x39')]?_0x4fab8b[_0x44c3('0x38')]:_0x56fbcf['model'];if(_0x1da523['query']['includeAll']){_0x4fab8b['include']=[{'all':!![]}];}_0x4fab8b=_[_0x44c3('0x3e')]({},_0x4fab8b,_0x1da523[_0x44c3('0x40')]);return db[_0x44c3('0x2f')][_0x44c3('0x46')](_0x4fab8b)[_0x44c3('0x27')](handleEntityNotFound(_0x284c16,null))[_0x44c3('0x27')](respondWithResult(_0x284c16,null))['catch'](handleError(_0x284c16,null));};exports['create']=function(_0x5698f1,_0x51acfc){return db[_0x44c3('0x2f')][_0x44c3('0x47')](_0x5698f1[_0x44c3('0x48')],{})['then'](respondWithResult(_0x51acfc,0xc9))[_0x44c3('0x43')](handleError(_0x51acfc,null));};exports[_0x44c3('0x26')]=function(_0x14322e,_0xaef06c){if(_0x14322e[_0x44c3('0x48')]['id']){delete _0x14322e[_0x44c3('0x48')]['id'];}return db[_0x44c3('0x2f')][_0x44c3('0x46')]({'where':{'id':_0x14322e[_0x44c3('0x49')]['id']}})['then'](handleEntityNotFound(_0xaef06c,null))[_0x44c3('0x27')](saveUpdates(_0x14322e[_0x44c3('0x48')],null))[_0x44c3('0x27')](respondWithResult(_0xaef06c,null))[_0x44c3('0x43')](handleError(_0xaef06c,null));};exports[_0x44c3('0x28')]=function(_0x4c9f9b,_0x419c98){return db['OpenchannelQueueReport'][_0x44c3('0x46')]({'where':{'id':_0x4c9f9b[_0x44c3('0x49')]['id']}})[_0x44c3('0x27')](handleEntityNotFound(_0x419c98,null))[_0x44c3('0x27')](removeEntity(_0x419c98,null))['catch'](handleError(_0x419c98,null));};exports['describe']=function(_0x4e32d0,_0x361070){return db['OpenchannelQueueReport']['describe']()[_0x44c3('0x27')](respondWithResult(_0x361070,null))['catch'](handleError(_0x361070,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 616dba3..76fce84 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 _0x5fc3=['util','api','moment','bluebird','request-promise','path','../../config/environment','./openchannelQueueReport.attributes','exports','define','report_openchannel_queue','uniqueid','lodash'];(function(_0x1dfce3,_0x491d21){var _0x127504=function(_0x3028cb){while(--_0x3028cb){_0x1dfce3['push'](_0x1dfce3['shift']());}};_0x127504(++_0x491d21);}(_0x5fc3,0xa8));var _0x35fc=function(_0xd0b415,_0x149675){_0xd0b415=_0xd0b415-0x0;var _0x2bdf2c=_0x5fc3[_0xd0b415];return _0x2bdf2c;};'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')]('OpenchannelQueueReport',attributes,{'tableName':_0x35fc('0xb'),'paranoid':![],'indexes':[{'name':_0x35fc('0xc'),'fields':[_0x35fc('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5fc3=['util','api','moment','bluebird','request-promise','path','../../config/environment','./openchannelQueueReport.attributes','exports','define','report_openchannel_queue','uniqueid','lodash'];(function(_0x2d909e,_0x1f8783){var _0x20f89e=function(_0x383d25){while(--_0x383d25){_0x2d909e['push'](_0x2d909e['shift']());}};_0x20f89e(++_0x1f8783);}(_0x5fc3,0xa8));var _0x35fc=function(_0x1c9c24,_0x2a517b){_0x1c9c24=_0x1c9c24-0x0;var _0x349c69=_0x5fc3[_0x1c9c24];return _0x349c69;};'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')]('OpenchannelQueueReport',attributes,{'tableName':_0x35fc('0xb'),'paranoid':![],'indexes':[{'name':_0x35fc('0xc'),'fields':[_0x35fc('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 8e395fc..9a1768a 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 _0xab40=['OpenchannelQueueReport','create','body','options','then','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','raw','attributes','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch'];(function(_0x415fed,_0x3626d3){var _0x34ae5e=function(_0x223900){while(--_0x223900){_0x415fed['push'](_0x415fed['shift']());}};_0x34ae5e(++_0x3626d3);}(_0xab40,0xcd));var _0x0ab4=function(_0x9abd30,_0x391422){_0x9abd30=_0x9abd30-0x0;var _0x124ecd=_0xab40[_0x9abd30];return _0x124ecd;};'use strict';var _=require(_0x0ab4('0x0'));var util=require(_0x0ab4('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0ab4('0x2'));var db=require(_0x0ab4('0x3'))['db'];var utils=require(_0x0ab4('0x4'));var logger=require(_0x0ab4('0x5'))(_0x0ab4('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0ab4('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x10d92b,_0x46d16a,_0x11e99f){return new BPromise(function(_0x6d135d,_0x4cf8de){return client['request'](_0x10d92b,_0x11e99f)['then'](function(_0x24271e){logger[_0x0ab4('0x8')](_0x0ab4('0x9'),_0x46d16a,_0x0ab4('0xa'));logger[_0x0ab4('0xb')](_0x0ab4('0xc'),_0x46d16a,_0x0ab4('0xa'),JSON[_0x0ab4('0xd')](_0x24271e));if(_0x24271e['error']){if(_0x24271e['error'][_0x0ab4('0xe')]===0x1f4){logger['error'](_0x0ab4('0x9'),_0x46d16a,_0x24271e[_0x0ab4('0xf')][_0x0ab4('0x10')]);return _0x4cf8de(_0x24271e[_0x0ab4('0xf')][_0x0ab4('0x10')]);}logger[_0x0ab4('0xf')](_0x0ab4('0x9'),_0x46d16a,_0x24271e[_0x0ab4('0xf')][_0x0ab4('0x10')]);return _0x6d135d(_0x24271e[_0x0ab4('0xf')][_0x0ab4('0x10')]);}else{logger[_0x0ab4('0x8')](_0x0ab4('0x9'),_0x46d16a,_0x0ab4('0xa'));_0x6d135d(_0x24271e[_0x0ab4('0x11')][_0x0ab4('0x10')]);}})[_0x0ab4('0x12')](function(_0x2bdda7){logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0x46d16a,_0x2bdda7);_0x4cf8de(_0x2bdda7);});});}exports['CreateOpenchannelQueueReport']=function(_0x17422f){var _0x30d5df=this;return new Promise(function(_0x2f50d2,_0x53723c){return db[_0x0ab4('0x13')][_0x0ab4('0x14')](_0x17422f[_0x0ab4('0x15')],{'raw':_0x17422f[_0x0ab4('0x16')]?_0x17422f['options']['raw']===undefined?!![]:![]:!![]})[_0x0ab4('0x17')](function(_0x5b1ed5){logger[_0x0ab4('0x8')](_0x0ab4('0x18'),_0x17422f);logger['debug'](_0x0ab4('0x18'),_0x17422f,JSON[_0x0ab4('0xd')](_0x5b1ed5));_0x2f50d2(_0x5b1ed5);})[_0x0ab4('0x12')](function(_0x1d5c14){logger[_0x0ab4('0xf')]('CreateOpenchannelQueueReport',_0x1d5c14['message'],_0x17422f);_0x53723c(_0x30d5df[_0x0ab4('0xf')](0x1f4,_0x1d5c14[_0x0ab4('0x10')]));});});};exports[_0x0ab4('0x19')]=function(_0x13c882){var _0x4e4b80=this;return new Promise(function(_0x42d2dd,_0x3caa9d){return db[_0x0ab4('0x13')]['update'](_0x13c882['body'],{'raw':_0x13c882[_0x0ab4('0x16')]?_0x13c882[_0x0ab4('0x16')][_0x0ab4('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x13c882['options']?_0x13c882['options']['where']||null:null,'attributes':_0x13c882[_0x0ab4('0x16')]?_0x13c882['options'][_0x0ab4('0x1b')]||null:null,'limit':_0x13c882[_0x0ab4('0x16')]?_0x13c882['options']['limit']||null:null})['then'](function(_0x3d38a4){logger[_0x0ab4('0x8')](_0x0ab4('0x19'),_0x13c882);logger[_0x0ab4('0xb')](_0x0ab4('0x19'),_0x13c882,JSON['stringify'](_0x3d38a4));_0x42d2dd(_0x3d38a4);})['catch'](function(_0x580d56){logger[_0x0ab4('0xf')](_0x0ab4('0x19'),_0x580d56[_0x0ab4('0x10')],_0x13c882);_0x3caa9d(_0x4e4b80[_0x0ab4('0xf')](0x1f4,_0x580d56[_0x0ab4('0x10')]));});});}; \ No newline at end of file +var _0x32b6=['stringify','error','code','OpenchannelQueueReport,\x20%s,\x20%s','message','info','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','raw','catch','UpdateOpenchannelQueueReport','where','attributes','limit','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','debug','request\x20sent'];(function(_0x3520fb,_0x2d9497){var _0x46b740=function(_0x34880b){while(--_0x34880b){_0x3520fb['push'](_0x3520fb['shift']());}};_0x46b740(++_0x2d9497);}(_0x32b6,0x1d1));var _0x632b=function(_0x104151,_0x26278e){_0x104151=_0x104151-0x0;var _0x18c298=_0x32b6[_0x104151];return _0x18c298;};'use strict';var _=require(_0x632b('0x0'));var util=require(_0x632b('0x1'));var moment=require('moment');var BPromise=require(_0x632b('0x2'));var rs=require(_0x632b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x632b('0x4'));var logger=require(_0x632b('0x5'))(_0x632b('0x6'));var config=require(_0x632b('0x7'));var jayson=require(_0x632b('0x8'));var client=jayson[_0x632b('0x9')][_0x632b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x10458a,_0x3bbf43,_0x43d6c7){return new BPromise(function(_0x5128f5,_0x33d711){return client[_0x632b('0xb')](_0x10458a,_0x43d6c7)[_0x632b('0xc')](function(_0x174201){logger['info']('OpenchannelQueueReport,\x20%s,\x20%s',_0x3bbf43,'request\x20sent');logger[_0x632b('0xd')]('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0x3bbf43,_0x632b('0xe'),JSON[_0x632b('0xf')](_0x174201));if(_0x174201[_0x632b('0x10')]){if(_0x174201[_0x632b('0x10')][_0x632b('0x11')]===0x1f4){logger[_0x632b('0x10')](_0x632b('0x12'),_0x3bbf43,_0x174201[_0x632b('0x10')][_0x632b('0x13')]);return _0x33d711(_0x174201['error'][_0x632b('0x13')]);}logger[_0x632b('0x10')](_0x632b('0x12'),_0x3bbf43,_0x174201['error'][_0x632b('0x13')]);return _0x5128f5(_0x174201[_0x632b('0x10')][_0x632b('0x13')]);}else{logger[_0x632b('0x14')](_0x632b('0x12'),_0x3bbf43,_0x632b('0xe'));_0x5128f5(_0x174201['result'][_0x632b('0x13')]);}})['catch'](function(_0x4fdef2){logger[_0x632b('0x10')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x3bbf43,_0x4fdef2);_0x33d711(_0x4fdef2);});});}exports[_0x632b('0x15')]=function(_0x3bb27f){var _0x28c472=this;return new Promise(function(_0x51c894,_0x2f3e88){return db[_0x632b('0x16')][_0x632b('0x17')](_0x3bb27f[_0x632b('0x18')],{'raw':_0x3bb27f['options']?_0x3bb27f[_0x632b('0x19')][_0x632b('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x116f62){logger['info']('CreateOpenchannelQueueReport',_0x3bb27f);logger[_0x632b('0xd')]('CreateOpenchannelQueueReport',_0x3bb27f,JSON[_0x632b('0xf')](_0x116f62));_0x51c894(_0x116f62);})[_0x632b('0x1b')](function(_0x2a6833){logger['error'](_0x632b('0x15'),_0x2a6833[_0x632b('0x13')],_0x3bb27f);_0x2f3e88(_0x28c472['error'](0x1f4,_0x2a6833[_0x632b('0x13')]));});});};exports[_0x632b('0x1c')]=function(_0x30ffb9){var _0x1e448c=this;return new Promise(function(_0x45d017,_0x183c5c){return db['OpenchannelQueueReport']['update'](_0x30ffb9[_0x632b('0x18')],{'raw':_0x30ffb9['options']?_0x30ffb9[_0x632b('0x19')][_0x632b('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x30ffb9['options']?_0x30ffb9[_0x632b('0x19')][_0x632b('0x1d')]||null:null,'attributes':_0x30ffb9[_0x632b('0x19')]?_0x30ffb9[_0x632b('0x19')][_0x632b('0x1e')]||null:null,'limit':_0x30ffb9[_0x632b('0x19')]?_0x30ffb9[_0x632b('0x19')][_0x632b('0x1f')]||null:null})[_0x632b('0xc')](function(_0x4f8410){logger[_0x632b('0x14')](_0x632b('0x1c'),_0x30ffb9);logger[_0x632b('0xd')](_0x632b('0x1c'),_0x30ffb9,JSON[_0x632b('0xf')](_0x4f8410));_0x45d017(_0x4f8410);})[_0x632b('0x1b')](function(_0x3c5dc9){logger[_0x632b('0x10')](_0x632b('0x1c'),_0x3c5dc9[_0x632b('0x13')],_0x30ffb9);_0x183c5c(_0x1e448c[_0x632b('0x10')](0x1f4,_0x3c5dc9[_0x632b('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 374815d..a6f743b 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 _0xd1fd=['../../config/environment','./openchannelTransferReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','create','put','update','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x205d9a,_0x121808){var _0x30eb69=function(_0x52c750){while(--_0x52c750){_0x205d9a['push'](_0x205d9a['shift']());}};_0x30eb69(++_0x121808);}(_0xd1fd,0x188));var _0xdd1f=function(_0x3f8a03,_0x319b9c){_0x3f8a03=_0x3f8a03-0x0;var _0x147fb2=_0xd1fd[_0x3f8a03];return _0x147fb2;};'use strict';var multer=require(_0xdd1f('0x0'));var util=require(_0xdd1f('0x1'));var path=require('path');var timeout=require(_0xdd1f('0x2'));var express=require(_0xdd1f('0x3'));var router=express[_0xdd1f('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xdd1f('0x5'));var interaction=require(_0xdd1f('0x6'));var config=require(_0xdd1f('0x7'));var controller=require(_0xdd1f('0x8'));router['get']('/',auth[_0xdd1f('0x9')](),controller[_0xdd1f('0xa')]);router[_0xdd1f('0xb')](_0xdd1f('0xc'),auth[_0xdd1f('0x9')](),controller[_0xdd1f('0xd')]);router[_0xdd1f('0xb')](_0xdd1f('0xe'),auth[_0xdd1f('0x9')](),controller[_0xdd1f('0xf')]);router['post']('/',auth[_0xdd1f('0x9')](),controller[_0xdd1f('0x10')]);router[_0xdd1f('0x11')](_0xdd1f('0xe'),auth[_0xdd1f('0x9')](),controller[_0xdd1f('0x12')]);router['delete']('/:id',auth[_0xdd1f('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xb116=['index','/describe','describe','post','create','put','/:id','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated'];(function(_0x47cdab,_0x28e311){var _0x2dc1c8=function(_0x10780d){while(--_0x10780d){_0x47cdab['push'](_0x47cdab['shift']());}};_0x2dc1c8(++_0x28e311);}(_0xb116,0x1c2));var _0x6b11=function(_0x27dba4,_0x419253){_0x27dba4=_0x27dba4-0x0;var _0x35ec9d=_0xb116[_0x27dba4];return _0x35ec9d;};'use strict';var multer=require('multer');var util=require(_0x6b11('0x0'));var path=require('path');var timeout=require(_0x6b11('0x1'));var express=require(_0x6b11('0x2'));var router=express[_0x6b11('0x3')]();var fs_extra=require(_0x6b11('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x6b11('0x5'));var config=require(_0x6b11('0x6'));var controller=require(_0x6b11('0x7'));router[_0x6b11('0x8')]('/',auth[_0x6b11('0x9')](),controller[_0x6b11('0xa')]);router[_0x6b11('0x8')](_0x6b11('0xb'),auth[_0x6b11('0x9')](),controller[_0x6b11('0xc')]);router[_0x6b11('0x8')]('/:id',auth[_0x6b11('0x9')](),controller['show']);router[_0x6b11('0xd')]('/',auth[_0x6b11('0x9')](),controller[_0x6b11('0xe')]);router[_0x6b11('0xf')](_0x6b11('0x10'),auth[_0x6b11('0x9')](),controller['update']);router[_0x6b11('0x11')]('/:id',auth[_0x6b11('0x9')](),controller[_0x6b11('0x12')]);module[_0x6b11('0x13')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 3600768..9550259 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 _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x6b5f2e,_0x98ce11){var _0x572297=function(_0x2e8dbe){while(--_0x2e8dbe){_0x6b5f2e['push'](_0x6b5f2e['shift']());}};_0x572297(++_0x98ce11);}(_0x54ef,0x112));var _0xf54e=function(_0x2739a,_0x288663){_0x2739a=_0x2739a-0x0;var _0x278793=_0x54ef[_0x2739a];return _0x278793;};'use strict';var moment=require(_0xf54e('0x0'));var Sequelize=require(_0xf54e('0x1'));module[_0xf54e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf54e('0x3')](_0xf54e('0x4'),_0xf54e('0x5'),_0xf54e('0x6')),'allowNull':![],'defaultValue':_0xf54e('0x6')},'transferredAt':{'type':Sequelize[_0xf54e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xf54e('0x8')]}}; \ No newline at end of file +var _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x4493ac,_0x230b71){var _0x5ef300=function(_0x29186f){while(--_0x29186f){_0x4493ac['push'](_0x4493ac['shift']());}};_0x5ef300(++_0x230b71);}(_0xaa88,0x137));var _0x8aa8=function(_0x199b1f,_0x4ed849){_0x199b1f=_0x199b1f-0x0;var _0x267ac9=_0xaa88[_0x199b1f];return _0x267ac9;};'use strict';var moment=require(_0x8aa8('0x0'));var Sequelize=require(_0x8aa8('0x1'));module[_0x8aa8('0x2')]={'uniqueid':{'type':Sequelize[_0x8aa8('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x8aa8('0x4'),_0x8aa8('0x5'),_0x8aa8('0x6')),'allowNull':![],'defaultValue':_0x8aa8('0x6')},'transferredAt':{'type':Sequelize[_0x8aa8('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x8aa8('0x8')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 85d12c3..36f9c59 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 _0x852c=['create','catch','update','body','find','destroy','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','error','stack','name','send','map','OpenchannelTransferReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','params','includeAll','include'];(function(_0x3861f7,_0x995b22){var _0x50879f=function(_0x3003f1){while(--_0x3003f1){_0x3861f7['push'](_0x3861f7['shift']());}};_0x50879f(++_0x995b22);}(_0x852c,0x174));var _0xc852=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x852c[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc852('0x0'));var jsonpatch=require(_0xc852('0x1'));var rp=require(_0xc852('0x2'));var moment=require(_0xc852('0x3'));var BPromise=require(_0xc852('0x4'));var Mustache=require(_0xc852('0x5'));var util=require(_0xc852('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xc852('0x7'));var ejs=require(_0xc852('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc852('0x9'));var squel=require('squel');var crypto=require(_0xc852('0xa'));var jsforce=require(_0xc852('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xc852('0x7'));var querystring=require(_0xc852('0xc'));var Papa=require('papaparse');var Redis=require(_0xc852('0xd'));var authService=require(_0xc852('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xc852('0xf'));var hardwareService=require(_0xc852('0x10'));var logger=require(_0xc852('0x11'))('api');var utils=require(_0xc852('0x12'));var config=require(_0xc852('0x13'));var licenseUtil=require(_0xc852('0x14'));var db=require(_0xc852('0x15'))['db'];function respondWithStatusCode(_0x3ea887,_0x20e77d){_0x20e77d=_0x20e77d||0xcc;return function(_0x3bc7b4){if(_0x3bc7b4){return _0x3ea887[_0xc852('0x16')](_0x20e77d);}return _0x3ea887[_0xc852('0x17')](_0x20e77d)[_0xc852('0x18')]();};}function respondWithResult(_0x30ff3b,_0x4e3c29){_0x4e3c29=_0x4e3c29||0xc8;return function(_0x42da34){if(_0x42da34){return _0x30ff3b[_0xc852('0x17')](_0x4e3c29)[_0xc852('0x19')](_0x42da34);}};}function respondWithFilteredResult(_0x27a4c8,_0x2ee4d3){return function(_0x168fc6){if(_0x168fc6){var _0x399309=typeof _0x2ee4d3['offset']===_0xc852('0x1a')&&typeof _0x2ee4d3['limit']===_0xc852('0x1a');var _0x5a033a=_0x168fc6[_0xc852('0x1b')];var _0x3e1100=_0x399309?0x0:_0x2ee4d3[_0xc852('0x1c')];var _0x5afad4=_0x399309?_0x168fc6['count']:_0x2ee4d3[_0xc852('0x1c')]+_0x2ee4d3[_0xc852('0x1d')];var _0x2feff2;if(_0x5afad4>=_0x5a033a){_0x5afad4=_0x5a033a;_0x2feff2=0xc8;}else{_0x2feff2=0xce;}_0x27a4c8[_0xc852('0x17')](_0x2feff2);return _0x27a4c8[_0xc852('0x1e')](_0xc852('0x1f'),_0x3e1100+'-'+_0x5afad4+'/'+_0x5a033a)['json'](_0x168fc6);}return null;};}function patchUpdates(_0x1099dc){return function(_0x282061){try{jsonpatch['apply'](_0x282061,_0x1099dc,!![]);}catch(_0x17f4d3){return BPromise[_0xc852('0x20')](_0x17f4d3);}return _0x282061[_0xc852('0x21')]();};}function saveUpdates(_0xb87c1a,_0x2dbf51){return function(_0x331ef8){if(_0x331ef8){return _0x331ef8['update'](_0xb87c1a)[_0xc852('0x22')](function(_0x1c0ce2){return _0x1c0ce2;});}return null;};}function removeEntity(_0x1a4881,_0x3e0972){return function(_0x7e6284){if(_0x7e6284){return _0x7e6284['destroy']()[_0xc852('0x22')](function(){_0x1a4881[_0xc852('0x17')](0xcc)[_0xc852('0x18')]();});}};}function handleEntityNotFound(_0x297db4,_0x416b28){return function(_0x1d3288){if(!_0x1d3288){_0x297db4[_0xc852('0x16')](0x194);}return _0x1d3288;};}function handleError(_0x14a288,_0x3dbe51){_0x3dbe51=_0x3dbe51||0x1f4;return function(_0x59540f){logger[_0xc852('0x23')](_0x59540f[_0xc852('0x24')]);if(_0x59540f[_0xc852('0x25')]){delete _0x59540f[_0xc852('0x25')];}_0x14a288[_0xc852('0x17')](_0x3dbe51)[_0xc852('0x26')](_0x59540f);};}exports['index']=function(_0x2fe7bb,_0x3c6004){var _0x39667a={},_0x615ebd={},_0x1d7eab={'count':0x0,'rows':[]};var _0x463580=_[_0xc852('0x27')](db[_0xc852('0x28')][_0xc852('0x29')],function(_0x1bd590){return{'name':_0x1bd590[_0xc852('0x2a')],'type':_0x1bd590[_0xc852('0x2b')][_0xc852('0x2c')]};});_0x615ebd[_0xc852('0x2d')]=_[_0xc852('0x27')](_0x463580,_0xc852('0x25'));_0x615ebd['query']=_[_0xc852('0x2e')](_0x2fe7bb[_0xc852('0x2f')]);_0x615ebd[_0xc852('0x30')]=_[_0xc852('0x31')](_0x615ebd[_0xc852('0x2d')],_0x615ebd[_0xc852('0x2f')]);_0x39667a[_0xc852('0x32')]=_[_0xc852('0x31')](_0x615ebd[_0xc852('0x2d')],qs['fields'](_0x2fe7bb[_0xc852('0x2f')][_0xc852('0x33')]));_0x39667a[_0xc852('0x32')]=_0x39667a[_0xc852('0x32')][_0xc852('0x34')]?_0x39667a[_0xc852('0x32')]:_0x615ebd[_0xc852('0x2d')];if(!_0x2fe7bb[_0xc852('0x2f')][_0xc852('0x35')](_0xc852('0x36'))){_0x39667a['limit']=qs['limit'](_0x2fe7bb['query']['limit']);_0x39667a[_0xc852('0x1c')]=qs['offset'](_0x2fe7bb[_0xc852('0x2f')][_0xc852('0x1c')]);}_0x39667a[_0xc852('0x37')]=qs[_0xc852('0x38')](_0x2fe7bb[_0xc852('0x2f')][_0xc852('0x38')]);_0x39667a['where']=qs[_0xc852('0x30')](_[_0xc852('0x39')](_0x2fe7bb[_0xc852('0x2f')],_0x615ebd[_0xc852('0x30')]),_0x463580);if(_0x2fe7bb[_0xc852('0x2f')][_0xc852('0x3a')]){_0x39667a[_0xc852('0x3b')]=_['merge'](_0x39667a[_0xc852('0x3b')],{'$or':_[_0xc852('0x27')](_0x463580,function(_0x1d18ae){if(_0x1d18ae['type']!==_0xc852('0x3c')){var _0x4b413f={};_0x4b413f[_0x1d18ae[_0xc852('0x25')]]={'$like':'%'+_0x2fe7bb[_0xc852('0x2f')][_0xc852('0x3a')]+'%'};return _0x4b413f;}})});}_0x39667a=_[_0xc852('0x3d')]({},_0x39667a,_0x2fe7bb[_0xc852('0x3e')]);var _0x3b98da={'where':_0x39667a[_0xc852('0x3b')]};return db[_0xc852('0x28')][_0xc852('0x1b')](_0x3b98da)['then'](function(_0x219ccc){_0x1d7eab[_0xc852('0x1b')]=_0x219ccc;if(_0x2fe7bb[_0xc852('0x2f')]['includeAll']){_0x39667a['include']=[{'all':!![]}];}return db[_0xc852('0x28')]['findAll'](_0x39667a);})[_0xc852('0x22')](function(_0x3f2b5c){_0x1d7eab['rows']=_0x3f2b5c;return _0x1d7eab;})[_0xc852('0x22')](respondWithFilteredResult(_0x3c6004,_0x39667a))['catch'](handleError(_0x3c6004,null));};exports['show']=function(_0x1cc031,_0x1a0a28){var _0x1a8759={'raw':!![],'where':{'id':_0x1cc031[_0xc852('0x3f')]['id']}},_0x2f4175={};_0x2f4175[_0xc852('0x2d')]=_[_0xc852('0x2e')](db[_0xc852('0x28')][_0xc852('0x29')]);_0x2f4175[_0xc852('0x2f')]=_[_0xc852('0x2e')](_0x1cc031['query']);_0x2f4175[_0xc852('0x30')]=_[_0xc852('0x31')](_0x2f4175[_0xc852('0x2d')],_0x2f4175[_0xc852('0x2f')]);_0x1a8759[_0xc852('0x32')]=_[_0xc852('0x31')](_0x2f4175[_0xc852('0x2d')],qs[_0xc852('0x33')](_0x1cc031[_0xc852('0x2f')][_0xc852('0x33')]));_0x1a8759[_0xc852('0x32')]=_0x1a8759[_0xc852('0x32')][_0xc852('0x34')]?_0x1a8759[_0xc852('0x32')]:_0x2f4175[_0xc852('0x2d')];if(_0x1cc031[_0xc852('0x2f')][_0xc852('0x40')]){_0x1a8759[_0xc852('0x41')]=[{'all':!![]}];}_0x1a8759=_[_0xc852('0x3d')]({},_0x1a8759,_0x1cc031['options']);return db[_0xc852('0x28')]['find'](_0x1a8759)[_0xc852('0x22')](handleEntityNotFound(_0x1a0a28,null))[_0xc852('0x22')](respondWithResult(_0x1a0a28,null))['catch'](handleError(_0x1a0a28,null));};exports[_0xc852('0x42')]=function(_0x1a78fa,_0x5b0649){return db[_0xc852('0x28')][_0xc852('0x42')](_0x1a78fa['body'],{})['then'](respondWithResult(_0x5b0649,0xc9))[_0xc852('0x43')](handleError(_0x5b0649,null));};exports[_0xc852('0x44')]=function(_0x50e9cc,_0x376ff3){if(_0x50e9cc[_0xc852('0x45')]['id']){delete _0x50e9cc[_0xc852('0x45')]['id'];}return db[_0xc852('0x28')][_0xc852('0x46')]({'where':{'id':_0x50e9cc['params']['id']}})[_0xc852('0x22')](handleEntityNotFound(_0x376ff3,null))[_0xc852('0x22')](saveUpdates(_0x50e9cc[_0xc852('0x45')],null))[_0xc852('0x22')](respondWithResult(_0x376ff3,null))[_0xc852('0x43')](handleError(_0x376ff3,null));};exports[_0xc852('0x47')]=function(_0x29216f,_0x452659){return db['OpenchannelTransferReport'][_0xc852('0x46')]({'where':{'id':_0x29216f[_0xc852('0x3f')]['id']}})[_0xc852('0x22')](handleEntityNotFound(_0x452659,null))[_0xc852('0x22')](removeEntity(_0x452659,null))[_0xc852('0x43')](handleError(_0x452659,null));};exports[_0xc852('0x48')]=function(_0x46e940,_0x3ff37c){return db[_0xc852('0x28')]['describe']()['then'](respondWithResult(_0x3ff37c,null))[_0xc852('0x43')](handleError(_0x3ff37c,null));}; \ No newline at end of file +var _0x1730=['OpenchannelTransferReport','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','catch','show','params','merge','find','create','body','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','error','name','send','map'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x1730,0xfe));var _0x0173=function(_0x16de47,_0x52233f){_0x16de47=_0x16de47-0x0;var _0x38e40b=_0x1730[_0x16de47];return _0x38e40b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0173('0x0'));var zipdir=require(_0x0173('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0173('0x2'));var moment=require(_0x0173('0x3'));var BPromise=require(_0x0173('0x4'));var Mustache=require(_0x0173('0x5'));var util=require(_0x0173('0x6'));var path=require(_0x0173('0x7'));var sox=require(_0x0173('0x8'));var csv=require(_0x0173('0x9'));var ejs=require(_0x0173('0xa'));var fs=require('fs');var fs_extra=require(_0x0173('0xb'));var _=require('lodash');var squel=require(_0x0173('0xc'));var crypto=require(_0x0173('0xd'));var jsforce=require(_0x0173('0xe'));var deskjs=require(_0x0173('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0173('0x10'));var Redis=require(_0x0173('0x11'));var authService=require(_0x0173('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x0173('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0173('0x14'))(_0x0173('0x15'));var utils=require(_0x0173('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x0173('0x17'));var db=require(_0x0173('0x18'))['db'];function respondWithStatusCode(_0x3682c0,_0x1d0ecc){_0x1d0ecc=_0x1d0ecc||0xcc;return function(_0x27bd21){if(_0x27bd21){return _0x3682c0[_0x0173('0x19')](_0x1d0ecc);}return _0x3682c0[_0x0173('0x1a')](_0x1d0ecc)[_0x0173('0x1b')]();};}function respondWithResult(_0x146d06,_0x1ea16c){_0x1ea16c=_0x1ea16c||0xc8;return function(_0xfc7242){if(_0xfc7242){return _0x146d06['status'](_0x1ea16c)['json'](_0xfc7242);}};}function respondWithFilteredResult(_0x593035,_0x7f7627){return function(_0x3be5f2){if(_0x3be5f2){var _0x5062b7=typeof _0x7f7627[_0x0173('0x1c')]===_0x0173('0x1d')&&typeof _0x7f7627[_0x0173('0x1e')]==='undefined';var _0x475706=_0x3be5f2[_0x0173('0x1f')];var _0x5f28bc=_0x5062b7?0x0:_0x7f7627[_0x0173('0x1c')];var _0x397ea6=_0x5062b7?_0x3be5f2[_0x0173('0x1f')]:_0x7f7627[_0x0173('0x1c')]+_0x7f7627[_0x0173('0x1e')];var _0x1d980b;if(_0x397ea6>=_0x475706){_0x397ea6=_0x475706;_0x1d980b=0xc8;}else{_0x1d980b=0xce;}_0x593035[_0x0173('0x1a')](_0x1d980b);return _0x593035[_0x0173('0x20')](_0x0173('0x21'),_0x5f28bc+'-'+_0x397ea6+'/'+_0x475706)['json'](_0x3be5f2);}return null;};}function patchUpdates(_0x4f9c86){return function(_0x272b8c){try{jsonpatch['apply'](_0x272b8c,_0x4f9c86,!![]);}catch(_0x1a0d1a){return BPromise[_0x0173('0x22')](_0x1a0d1a);}return _0x272b8c['save']();};}function saveUpdates(_0x17ada6,_0x260291){return function(_0x212b60){if(_0x212b60){return _0x212b60[_0x0173('0x23')](_0x17ada6)[_0x0173('0x24')](function(_0x31a6dd){return _0x31a6dd;});}return null;};}function removeEntity(_0x292d46,_0x360a3a){return function(_0x2af389){if(_0x2af389){return _0x2af389[_0x0173('0x25')]()['then'](function(){_0x292d46[_0x0173('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x238b2b,_0x476081){return function(_0x593068){if(!_0x593068){_0x238b2b[_0x0173('0x19')](0x194);}return _0x593068;};}function handleError(_0x1bcb6e,_0x57cf4b){_0x57cf4b=_0x57cf4b||0x1f4;return function(_0x10b6b7){logger[_0x0173('0x26')](_0x10b6b7['stack']);if(_0x10b6b7[_0x0173('0x27')]){delete _0x10b6b7[_0x0173('0x27')];}_0x1bcb6e[_0x0173('0x1a')](_0x57cf4b)[_0x0173('0x28')](_0x10b6b7);};}exports['index']=function(_0x102123,_0x41e6bc){var _0x254c6e={},_0x2d5e05={},_0x32f1d2={'count':0x0,'rows':[]};var _0x224b2a=_[_0x0173('0x29')](db[_0x0173('0x2a')][_0x0173('0x2b')],function(_0x343217){return{'name':_0x343217[_0x0173('0x2c')],'type':_0x343217[_0x0173('0x2d')]['key']};});_0x2d5e05['model']=_[_0x0173('0x29')](_0x224b2a,'name');_0x2d5e05[_0x0173('0x2e')]=_[_0x0173('0x2f')](_0x102123['query']);_0x2d5e05[_0x0173('0x30')]=_[_0x0173('0x31')](_0x2d5e05[_0x0173('0x32')],_0x2d5e05['query']);_0x254c6e[_0x0173('0x33')]=_[_0x0173('0x31')](_0x2d5e05['model'],qs[_0x0173('0x34')](_0x102123[_0x0173('0x2e')][_0x0173('0x34')]));_0x254c6e[_0x0173('0x33')]=_0x254c6e[_0x0173('0x33')][_0x0173('0x35')]?_0x254c6e[_0x0173('0x33')]:_0x2d5e05[_0x0173('0x32')];if(!_0x102123[_0x0173('0x2e')][_0x0173('0x36')](_0x0173('0x37'))){_0x254c6e[_0x0173('0x1e')]=qs[_0x0173('0x1e')](_0x102123[_0x0173('0x2e')][_0x0173('0x1e')]);_0x254c6e['offset']=qs[_0x0173('0x1c')](_0x102123[_0x0173('0x2e')][_0x0173('0x1c')]);}_0x254c6e[_0x0173('0x38')]=qs[_0x0173('0x39')](_0x102123[_0x0173('0x2e')][_0x0173('0x39')]);_0x254c6e[_0x0173('0x3a')]=qs[_0x0173('0x30')](_[_0x0173('0x3b')](_0x102123[_0x0173('0x2e')],_0x2d5e05[_0x0173('0x30')]),_0x224b2a);if(_0x102123['query'][_0x0173('0x3c')]){_0x254c6e[_0x0173('0x3a')]=_['merge'](_0x254c6e['where'],{'$or':_[_0x0173('0x29')](_0x224b2a,function(_0x1c7a70){if(_0x1c7a70[_0x0173('0x2d')]!==_0x0173('0x3d')){var _0x53e2cb={};_0x53e2cb[_0x1c7a70[_0x0173('0x27')]]={'$like':'%'+_0x102123['query'][_0x0173('0x3c')]+'%'};return _0x53e2cb;}})});}_0x254c6e=_['merge']({},_0x254c6e,_0x102123[_0x0173('0x3e')]);var _0x379197={'where':_0x254c6e[_0x0173('0x3a')]};return db[_0x0173('0x2a')][_0x0173('0x1f')](_0x379197)['then'](function(_0x3af4b4){_0x32f1d2[_0x0173('0x1f')]=_0x3af4b4;if(_0x102123[_0x0173('0x2e')][_0x0173('0x3f')]){_0x254c6e[_0x0173('0x40')]=[{'all':!![]}];}return db['OpenchannelTransferReport'][_0x0173('0x41')](_0x254c6e);})[_0x0173('0x24')](function(_0x1bfee3){_0x32f1d2['rows']=_0x1bfee3;return _0x32f1d2;})[_0x0173('0x24')](respondWithFilteredResult(_0x41e6bc,_0x254c6e))[_0x0173('0x42')](handleError(_0x41e6bc,null));};exports[_0x0173('0x43')]=function(_0x290ee0,_0xa0eafd){var _0x5def28={'raw':!![],'where':{'id':_0x290ee0[_0x0173('0x44')]['id']}},_0xd60515={};_0xd60515['model']=_[_0x0173('0x2f')](db[_0x0173('0x2a')]['rawAttributes']);_0xd60515[_0x0173('0x2e')]=_[_0x0173('0x2f')](_0x290ee0[_0x0173('0x2e')]);_0xd60515[_0x0173('0x30')]=_[_0x0173('0x31')](_0xd60515['model'],_0xd60515[_0x0173('0x2e')]);_0x5def28[_0x0173('0x33')]=_[_0x0173('0x31')](_0xd60515[_0x0173('0x32')],qs['fields'](_0x290ee0[_0x0173('0x2e')][_0x0173('0x34')]));_0x5def28[_0x0173('0x33')]=_0x5def28[_0x0173('0x33')][_0x0173('0x35')]?_0x5def28[_0x0173('0x33')]:_0xd60515[_0x0173('0x32')];if(_0x290ee0[_0x0173('0x2e')][_0x0173('0x3f')]){_0x5def28['include']=[{'all':!![]}];}_0x5def28=_[_0x0173('0x45')]({},_0x5def28,_0x290ee0[_0x0173('0x3e')]);return db[_0x0173('0x2a')][_0x0173('0x46')](_0x5def28)[_0x0173('0x24')](handleEntityNotFound(_0xa0eafd,null))['then'](respondWithResult(_0xa0eafd,null))[_0x0173('0x42')](handleError(_0xa0eafd,null));};exports[_0x0173('0x47')]=function(_0x20b3e9,_0x413af8){return db['OpenchannelTransferReport']['create'](_0x20b3e9['body'],{})[_0x0173('0x24')](respondWithResult(_0x413af8,0xc9))[_0x0173('0x42')](handleError(_0x413af8,null));};exports[_0x0173('0x23')]=function(_0x12d018,_0x163e09){if(_0x12d018['body']['id']){delete _0x12d018[_0x0173('0x48')]['id'];}return db[_0x0173('0x2a')][_0x0173('0x46')]({'where':{'id':_0x12d018['params']['id']}})['then'](handleEntityNotFound(_0x163e09,null))[_0x0173('0x24')](saveUpdates(_0x12d018[_0x0173('0x48')],null))['then'](respondWithResult(_0x163e09,null))[_0x0173('0x42')](handleError(_0x163e09,null));};exports['destroy']=function(_0x485253,_0x4c41f3){return db[_0x0173('0x2a')]['find']({'where':{'id':_0x485253[_0x0173('0x44')]['id']}})[_0x0173('0x24')](handleEntityNotFound(_0x4c41f3,null))[_0x0173('0x24')](removeEntity(_0x4c41f3,null))['catch'](handleError(_0x4c41f3,null));};exports[_0x0173('0x49')]=function(_0x2d1532,_0x4a2d20){return db['OpenchannelTransferReport']['describe']()[_0x0173('0x24')](respondWithResult(_0x4a2d20,null))['catch'](handleError(_0x4a2d20,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 4ad5ca1..c6e3ecd 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 _0x21f9=['exports','define','report_openchannel_transfer','lodash','../../config/logger','api','moment','rimraf'];(function(_0x47c0e9,_0x55a288){var _0x32def3=function(_0x194bcf){while(--_0x194bcf){_0x47c0e9['push'](_0x47c0e9['shift']());}};_0x32def3(++_0x55a288);}(_0x21f9,0xc3));var _0x921f=function(_0x2e454d,_0x32b87a){_0x2e454d=_0x2e454d-0x0;var _0x684eee=_0x21f9[_0x2e454d];return _0x684eee;};'use strict';var _=require(_0x921f('0x0'));var util=require('util');var logger=require(_0x921f('0x1'))(_0x921f('0x2'));var moment=require(_0x921f('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x921f('0x4'));var config=require('../../config/environment');var attributes=require('./openchannelTransferReport.attributes');module[_0x921f('0x5')]=function(_0x53fc3a,_0x350622){return _0x53fc3a[_0x921f('0x6')]('OpenchannelTransferReport',attributes,{'tableName':_0x921f('0x7'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x5111=['path','rimraf','../../config/environment','exports','define','OpenchannelTransferReport','uniqueid','lodash','util','../../config/logger','api','bluebird'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5111,0xaf));var _0x1511=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x5111[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x1511('0x0'));var util=require(_0x1511('0x1'));var logger=require(_0x1511('0x2'))(_0x1511('0x3'));var moment=require('moment');var BPromise=require(_0x1511('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1511('0x5'));var rimraf=require(_0x1511('0x6'));var config=require(_0x1511('0x7'));var attributes=require('./openchannelTransferReport.attributes');module[_0x1511('0x8')]=function(_0x3c49f9,_0xbe9ddc){return _0x3c49f9[_0x1511('0x9')](_0x1511('0xa'),attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':_0x1511('0xb'),'fields':[_0x1511('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 68e44c2..f9b11cc 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 _0x3645=['error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4536cb,_0x38279b){var _0x5786cf=function(_0xc98109){while(--_0xc98109){_0x4536cb['push'](_0x4536cb['shift']());}};_0x5786cf(++_0x38279b);}(_0x3645,0x154));var _0x5364=function(_0x26721d,_0x448ba5){_0x26721d=_0x26721d-0x0;var _0x1035c5=_0x3645[_0x26721d];return _0x1035c5;};'use strict';var _=require('lodash');var util=require(_0x5364('0x0'));var moment=require(_0x5364('0x1'));var BPromise=require(_0x5364('0x2'));var rs=require(_0x5364('0x3'));var fs=require('fs');var Redis=require(_0x5364('0x4'));var db=require(_0x5364('0x5'))['db'];var utils=require(_0x5364('0x6'));var logger=require('../../config/logger')(_0x5364('0x7'));var config=require(_0x5364('0x8'));var jayson=require(_0x5364('0x9'));var client=jayson[_0x5364('0xa')][_0x5364('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x7933a5,_0x195fbe,_0x43fb3f){return new BPromise(function(_0x3c1b21,_0x47e3cf){return client[_0x5364('0xc')](_0x7933a5,_0x43fb3f)[_0x5364('0xd')](function(_0x3e60ea){logger[_0x5364('0xe')](_0x5364('0xf'),_0x195fbe,_0x5364('0x10'));logger[_0x5364('0x11')](_0x5364('0x12'),_0x195fbe,_0x5364('0x10'),JSON[_0x5364('0x13')](_0x3e60ea));if(_0x3e60ea[_0x5364('0x14')]){if(_0x3e60ea[_0x5364('0x14')][_0x5364('0x15')]===0x1f4){logger['error'](_0x5364('0xf'),_0x195fbe,_0x3e60ea[_0x5364('0x14')][_0x5364('0x16')]);return _0x47e3cf(_0x3e60ea[_0x5364('0x14')]['message']);}logger[_0x5364('0x14')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x195fbe,_0x3e60ea[_0x5364('0x14')]['message']);return _0x3c1b21(_0x3e60ea[_0x5364('0x14')][_0x5364('0x16')]);}else{logger[_0x5364('0xe')](_0x5364('0xf'),_0x195fbe,_0x5364('0x10'));_0x3c1b21(_0x3e60ea['result']['message']);}})[_0x5364('0x17')](function(_0x66766a){logger[_0x5364('0x14')](_0x5364('0xf'),_0x195fbe,_0x66766a);_0x47e3cf(_0x66766a);});});} \ No newline at end of file +var _0xa4dc=['code','OpenchannelTransferReport,\x20%s,\x20%s','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','info','request\x20sent','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x1cba66,_0x48a549){var _0x4caffd=function(_0xca308e){while(--_0xca308e){_0x1cba66['push'](_0x1cba66['shift']());}};_0x4caffd(++_0x48a549);}(_0xa4dc,0x16a));var _0xca4d=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0xa4dc[_0x2235bf];return _0x4c3a64;};'use strict';var _=require(_0xca4d('0x0'));var util=require(_0xca4d('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xca4d('0x2'));var fs=require('fs');var Redis=require(_0xca4d('0x3'));var db=require(_0xca4d('0x4'))['db'];var utils=require(_0xca4d('0x5'));var logger=require(_0xca4d('0x6'))('rpc');var config=require(_0xca4d('0x7'));var jayson=require(_0xca4d('0x8'));var client=jayson[_0xca4d('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x299f58,_0x5e3284,_0x35b21a){return new BPromise(function(_0x2fa52a,_0x21c434){return client[_0xca4d('0xa')](_0x299f58,_0x35b21a)['then'](function(_0x182f8a){logger[_0xca4d('0xb')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x5e3284,_0xca4d('0xc'));logger['debug'](_0xca4d('0xd'),_0x5e3284,_0xca4d('0xc'),JSON[_0xca4d('0xe')](_0x182f8a));if(_0x182f8a[_0xca4d('0xf')]){if(_0x182f8a[_0xca4d('0xf')][_0xca4d('0x10')]===0x1f4){logger[_0xca4d('0xf')](_0xca4d('0x11'),_0x5e3284,_0x182f8a['error'][_0xca4d('0x12')]);return _0x21c434(_0x182f8a['error'][_0xca4d('0x12')]);}logger[_0xca4d('0xf')](_0xca4d('0x11'),_0x5e3284,_0x182f8a['error'][_0xca4d('0x12')]);return _0x2fa52a(_0x182f8a['error'][_0xca4d('0x12')]);}else{logger[_0xca4d('0xb')](_0xca4d('0x11'),_0x5e3284,_0xca4d('0xc'));_0x2fa52a(_0x182f8a[_0xca4d('0x13')][_0xca4d('0x12')]);}})[_0xca4d('0x14')](function(_0x5b7620){logger[_0xca4d('0xf')](_0xca4d('0x11'),_0x5e3284,_0x5b7620);_0x21c434(_0x5b7620);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 9a614ad..7d9d118 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 _0x4111=['../../config/environment','./pause.controller','get','isAuthenticated','index','show','post','create','/:id','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4111,0x188));var _0x1411=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4111[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x1411('0x0'));var util=require(_0x1411('0x1'));var path=require(_0x1411('0x2'));var timeout=require(_0x1411('0x3'));var express=require('express');var router=express[_0x1411('0x4')]();var fs_extra=require(_0x1411('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x1411('0x6'));var config=require(_0x1411('0x7'));var controller=require(_0x1411('0x8'));router[_0x1411('0x9')]('/',auth[_0x1411('0xa')](),controller[_0x1411('0xb')]);router[_0x1411('0x9')]('/:id',auth[_0x1411('0xa')](),controller[_0x1411('0xc')]);router[_0x1411('0xd')]('/',auth[_0x1411('0xa')](),controller[_0x1411('0xe')]);router['put'](_0x1411('0xf'),auth[_0x1411('0xa')](),controller[_0x1411('0x10')]);router[_0x1411('0x11')](_0x1411('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0x1411('0x12')]=router; \ No newline at end of file +var _0xb12c=['multer','util','connect-timeout','express','fs-extra','./pause.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','destroy','exports'];(function(_0x3a1b90,_0x3c0158){var _0xf6de77=function(_0x396533){while(--_0x396533){_0x3a1b90['push'](_0x3a1b90['shift']());}};_0xf6de77(++_0x3c0158);}(_0xb12c,0xaa));var _0xcb12=function(_0x32a563,_0x5bd345){_0x32a563=_0x32a563-0x0;var _0x238d0a=_0xb12c[_0x32a563];return _0x238d0a;};'use strict';var multer=require(_0xcb12('0x0'));var util=require(_0xcb12('0x1'));var path=require('path');var timeout=require(_0xcb12('0x2'));var express=require(_0xcb12('0x3'));var router=express['Router']();var fs_extra=require(_0xcb12('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xcb12('0x5'));router[_0xcb12('0x6')]('/',auth[_0xcb12('0x7')](),controller[_0xcb12('0x8')]);router[_0xcb12('0x6')]('/:id',auth[_0xcb12('0x7')](),controller[_0xcb12('0x9')]);router[_0xcb12('0xa')]('/',auth[_0xcb12('0x7')](),controller[_0xcb12('0xb')]);router[_0xcb12('0xc')](_0xcb12('0xd'),auth[_0xcb12('0x7')](),controller[_0xcb12('0xe')]);router['delete'](_0xcb12('0xd'),auth[_0xcb12('0x7')](),controller[_0xcb12('0xf')]);module[_0xcb12('0x10')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 7ac0a7c..b6b6b87 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 _0x0a1e=['STRING','sequelize','exports'];(function(_0x2c78df,_0x20abba){var _0x50912=function(_0x5aa161){while(--_0x5aa161){_0x2c78df['push'](_0x2c78df['shift']());}};_0x50912(++_0x20abba);}(_0x0a1e,0x1d5));var _0xe0a1=function(_0x4b645f,_0x277536){_0x4b645f=_0x4b645f-0x0;var _0x47e3c1=_0x0a1e[_0x4b645f];return _0x47e3c1;};'use strict';var Sequelize=require(_0xe0a1('0x0'));module[_0xe0a1('0x1')]={'name':{'type':Sequelize[_0xe0a1('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xe0a1('0x2')]}}; \ No newline at end of file +var _0x95d9=['STRING','name','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x95d9,0x15a));var _0x995d=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x95d9[_0x5d4607];return _0x5e4a86;};'use strict';var Sequelize=require(_0x995d('0x0'));module[_0x995d('0x1')]={'name':{'type':Sequelize[_0x995d('0x2')],'unique':_0x995d('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x995d('0x2')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 1d892f4..5dd9028 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 _0xae97=['length','hasOwnProperty','order','sort','pick','filter','where','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','user','get','role','userProfileId','autoAssociation','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','status','json','limit','count','offset','set','Content-Range','reject','update','destroy','Pauses','UserProfileResource','then','error','stack','name','send','map','Pause','fieldName','model','keys','query','filters','intersection','attributes','fields'];(function(_0x49f00e,_0x5c11f2){var _0x27e691=function(_0x411769){while(--_0x411769){_0x49f00e['push'](_0x49f00e['shift']());}};_0x27e691(++_0x5c11f2);}(_0xae97,0x6d));var _0x7ae9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xae97[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7ae9('0x0'));var zipdir=require(_0x7ae9('0x1'));var jsonpatch=require(_0x7ae9('0x2'));var rp=require(_0x7ae9('0x3'));var moment=require(_0x7ae9('0x4'));var BPromise=require(_0x7ae9('0x5'));var Mustache=require('mustache');var util=require(_0x7ae9('0x6'));var path=require(_0x7ae9('0x7'));var sox=require(_0x7ae9('0x8'));var csv=require('to-csv');var ejs=require(_0x7ae9('0x9'));var fs=require('fs');var fs_extra=require(_0x7ae9('0xa'));var _=require(_0x7ae9('0xb'));var squel=require(_0x7ae9('0xc'));var crypto=require(_0x7ae9('0xd'));var jsforce=require(_0x7ae9('0xe'));var deskjs=require(_0x7ae9('0xf'));var toCsv=require(_0x7ae9('0x10'));var querystring=require(_0x7ae9('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7ae9('0x12'));var qs=require(_0x7ae9('0x13'));var as=require(_0x7ae9('0x14'));var hardwareService=require(_0x7ae9('0x15'));var logger=require(_0x7ae9('0x16'))(_0x7ae9('0x17'));var utils=require(_0x7ae9('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7ae9('0x19'))['db'];function respondWithStatusCode(_0x30e135,_0x287c03){_0x287c03=_0x287c03||0xcc;return function(_0x5bb324){if(_0x5bb324){return _0x30e135[_0x7ae9('0x1a')](_0x287c03);}return _0x30e135['status'](_0x287c03)[_0x7ae9('0x1b')]();};}function respondWithResult(_0x427277,_0x28e0b5){_0x28e0b5=_0x28e0b5||0xc8;return function(_0x38263a){if(_0x38263a){return _0x427277[_0x7ae9('0x1c')](_0x28e0b5)[_0x7ae9('0x1d')](_0x38263a);}};}function respondWithFilteredResult(_0x25f032,_0x1d0174){return function(_0x5a447d){if(_0x5a447d){var _0x557c90=typeof _0x1d0174['offset']==='undefined'&&typeof _0x1d0174[_0x7ae9('0x1e')]==='undefined';var _0x3cd092=_0x5a447d[_0x7ae9('0x1f')];var _0xbe9994=_0x557c90?0x0:_0x1d0174[_0x7ae9('0x20')];var _0x290f98=_0x557c90?_0x5a447d[_0x7ae9('0x1f')]:_0x1d0174[_0x7ae9('0x20')]+_0x1d0174['limit'];var _0x20ea74;if(_0x290f98>=_0x3cd092){_0x290f98=_0x3cd092;_0x20ea74=0xc8;}else{_0x20ea74=0xce;}_0x25f032[_0x7ae9('0x1c')](_0x20ea74);return _0x25f032[_0x7ae9('0x21')](_0x7ae9('0x22'),_0xbe9994+'-'+_0x290f98+'/'+_0x3cd092)['json'](_0x5a447d);}return null;};}function patchUpdates(_0x1bb780){return function(_0x42a02b){try{jsonpatch['apply'](_0x42a02b,_0x1bb780,!![]);}catch(_0x122570){return BPromise[_0x7ae9('0x23')](_0x122570);}return _0x42a02b['save']();};}function saveUpdates(_0x5696f4,_0x3758b0){return function(_0x192bd8){if(_0x192bd8){return _0x192bd8[_0x7ae9('0x24')](_0x5696f4)['then'](function(_0x4b68d7){return _0x4b68d7;});}return null;};}function removeEntity(_0x24d37b,_0x31792b){return function(_0x4f4036){if(_0x4f4036){return _0x4f4036[_0x7ae9('0x25')]()['then'](function(){var _0x400313=_0x4f4036['get']({'plain':!![]});var _0x27b34c=_0x7ae9('0x26');return db[_0x7ae9('0x27')][_0x7ae9('0x25')]({'where':{'type':_0x27b34c,'resourceId':_0x400313['id']}})[_0x7ae9('0x28')](function(){return _0x4f4036;});})[_0x7ae9('0x28')](function(){_0x24d37b[_0x7ae9('0x1c')](0xcc)[_0x7ae9('0x1b')]();});}};}function handleEntityNotFound(_0x27b23e,_0x208980){return function(_0xa43410){if(!_0xa43410){_0x27b23e[_0x7ae9('0x1a')](0x194);}return _0xa43410;};}function handleError(_0x40105a,_0x3d6e97){_0x3d6e97=_0x3d6e97||0x1f4;return function(_0x6412a8){logger[_0x7ae9('0x29')](_0x6412a8[_0x7ae9('0x2a')]);if(_0x6412a8[_0x7ae9('0x2b')]){delete _0x6412a8['name'];}_0x40105a[_0x7ae9('0x1c')](_0x3d6e97)[_0x7ae9('0x2c')](_0x6412a8);};}exports['index']=function(_0x5a2a26,_0x2fe6b3){var _0xef0e60={},_0x3e8563={},_0x16b6ba={'count':0x0,'rows':[]};var _0x5a070a=_[_0x7ae9('0x2d')](db[_0x7ae9('0x2e')]['rawAttributes'],function(_0x55b1dd){return{'name':_0x55b1dd[_0x7ae9('0x2f')],'type':_0x55b1dd['type']['key']};});_0x3e8563[_0x7ae9('0x30')]=_[_0x7ae9('0x2d')](_0x5a070a,_0x7ae9('0x2b'));_0x3e8563['query']=_[_0x7ae9('0x31')](_0x5a2a26[_0x7ae9('0x32')]);_0x3e8563[_0x7ae9('0x33')]=_[_0x7ae9('0x34')](_0x3e8563[_0x7ae9('0x30')],_0x3e8563['query']);_0xef0e60[_0x7ae9('0x35')]=_[_0x7ae9('0x34')](_0x3e8563[_0x7ae9('0x30')],qs[_0x7ae9('0x36')](_0x5a2a26['query'][_0x7ae9('0x36')]));_0xef0e60[_0x7ae9('0x35')]=_0xef0e60[_0x7ae9('0x35')][_0x7ae9('0x37')]?_0xef0e60[_0x7ae9('0x35')]:_0x3e8563[_0x7ae9('0x30')];if(!_0x5a2a26[_0x7ae9('0x32')][_0x7ae9('0x38')]('nolimit')){_0xef0e60[_0x7ae9('0x1e')]=qs['limit'](_0x5a2a26[_0x7ae9('0x32')][_0x7ae9('0x1e')]);_0xef0e60[_0x7ae9('0x20')]=qs[_0x7ae9('0x20')](_0x5a2a26[_0x7ae9('0x32')][_0x7ae9('0x20')]);}_0xef0e60[_0x7ae9('0x39')]=qs['sort'](_0x5a2a26[_0x7ae9('0x32')][_0x7ae9('0x3a')]);_0xef0e60['where']=qs[_0x7ae9('0x33')](_[_0x7ae9('0x3b')](_0x5a2a26[_0x7ae9('0x32')],_0x3e8563[_0x7ae9('0x33')]),_0x5a070a);if(_0x5a2a26[_0x7ae9('0x32')][_0x7ae9('0x3c')]){_0xef0e60[_0x7ae9('0x3d')]=_['merge'](_0xef0e60[_0x7ae9('0x3d')],{'$or':_[_0x7ae9('0x2d')](_0x5a070a,function(_0x5aeb22){if(_0x5aeb22[_0x7ae9('0x3e')]!==_0x7ae9('0x3f')){var _0x581a04={};_0x581a04[_0x5aeb22[_0x7ae9('0x2b')]]={'$like':'%'+_0x5a2a26[_0x7ae9('0x32')][_0x7ae9('0x3c')]+'%'};return _0x581a04;}})});}_0xef0e60=_[_0x7ae9('0x40')]({},_0xef0e60,_0x5a2a26[_0x7ae9('0x41')]);var _0x542b06={'where':_0xef0e60[_0x7ae9('0x3d')]};return db['Pause'][_0x7ae9('0x1f')](_0x542b06)[_0x7ae9('0x28')](function(_0x3d0297){_0x16b6ba[_0x7ae9('0x1f')]=_0x3d0297;if(_0x5a2a26[_0x7ae9('0x32')][_0x7ae9('0x42')]){_0xef0e60[_0x7ae9('0x43')]=[{'all':!![]}];}return db[_0x7ae9('0x2e')][_0x7ae9('0x44')](_0xef0e60);})[_0x7ae9('0x28')](function(_0x10ec9d){_0x16b6ba[_0x7ae9('0x45')]=_0x10ec9d;return _0x16b6ba;})[_0x7ae9('0x28')](respondWithFilteredResult(_0x2fe6b3,_0xef0e60))[_0x7ae9('0x46')](handleError(_0x2fe6b3,null));};exports[_0x7ae9('0x47')]=function(_0x3c2b4d,_0x5941f3){var _0x51d91f={'raw':!![],'where':{'id':_0x3c2b4d[_0x7ae9('0x48')]['id']}},_0x7a4459={};_0x7a4459[_0x7ae9('0x30')]=_['keys'](db[_0x7ae9('0x2e')][_0x7ae9('0x49')]);_0x7a4459[_0x7ae9('0x32')]=_[_0x7ae9('0x31')](_0x3c2b4d[_0x7ae9('0x32')]);_0x7a4459['filters']=_[_0x7ae9('0x34')](_0x7a4459['model'],_0x7a4459[_0x7ae9('0x32')]);_0x51d91f[_0x7ae9('0x35')]=_[_0x7ae9('0x34')](_0x7a4459['model'],qs[_0x7ae9('0x36')](_0x3c2b4d[_0x7ae9('0x32')][_0x7ae9('0x36')]));_0x51d91f[_0x7ae9('0x35')]=_0x51d91f['attributes'][_0x7ae9('0x37')]?_0x51d91f[_0x7ae9('0x35')]:_0x7a4459['model'];if(_0x3c2b4d[_0x7ae9('0x32')][_0x7ae9('0x42')]){_0x51d91f[_0x7ae9('0x43')]=[{'all':!![]}];}_0x51d91f=_['merge']({},_0x51d91f,_0x3c2b4d[_0x7ae9('0x41')]);return db[_0x7ae9('0x2e')][_0x7ae9('0x4a')](_0x51d91f)[_0x7ae9('0x28')](handleEntityNotFound(_0x5941f3,null))['then'](respondWithResult(_0x5941f3,null))[_0x7ae9('0x46')](handleError(_0x5941f3,null));};exports['create']=function(_0x5eedf5,_0x41b422){return db['Pause'][_0x7ae9('0x4b')](_0x5eedf5[_0x7ae9('0x4c')],{})['then'](function(_0x255ead){var _0x6a1b5b=_0x5eedf5[_0x7ae9('0x4d')][_0x7ae9('0x4e')]({'plain':!![]});if(!_0x6a1b5b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x6a1b5b[_0x7ae9('0x4f')]===_0x7ae9('0x4d')){var _0x1ea660=_0x255ead[_0x7ae9('0x4e')]({'plain':!![]});var _0x1434c5=_0x7ae9('0x26');return db['UserProfileSection']['find']({'where':{'name':_0x1434c5,'userProfileId':_0x6a1b5b[_0x7ae9('0x50')]},'raw':!![]})[_0x7ae9('0x28')](function(_0x38fad6){if(_0x38fad6&&_0x38fad6[_0x7ae9('0x51')]===0x0){return db['UserProfileResource'][_0x7ae9('0x4b')]({'name':_0x1ea660[_0x7ae9('0x2b')],'resourceId':_0x1ea660['id'],'type':_0x38fad6['name'],'sectionId':_0x38fad6['id']},{})[_0x7ae9('0x28')](function(){return _0x255ead;});}else{return _0x255ead;}})[_0x7ae9('0x46')](function(_0x41632b){logger[_0x7ae9('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x41632b);throw _0x41632b;});}return _0x255ead;})['then'](respondWithResult(_0x41b422,0xc9))['catch'](handleError(_0x41b422,null));};exports[_0x7ae9('0x24')]=function(_0x516097,_0x3c33b0){if(_0x516097[_0x7ae9('0x4c')]['id']){delete _0x516097[_0x7ae9('0x4c')]['id'];}return db[_0x7ae9('0x2e')][_0x7ae9('0x4a')]({'where':{'id':_0x516097[_0x7ae9('0x48')]['id']}})[_0x7ae9('0x28')](handleEntityNotFound(_0x3c33b0,null))[_0x7ae9('0x28')](saveUpdates(_0x516097['body'],null))['then'](respondWithResult(_0x3c33b0,null))['catch'](handleError(_0x3c33b0,null));};exports[_0x7ae9('0x25')]=function(_0x3a10ee,_0x5fdf38){return db[_0x7ae9('0x2e')][_0x7ae9('0x4a')]({'where':{'id':_0x3a10ee[_0x7ae9('0x48')]['id']}})['then'](handleEntityNotFound(_0x5fdf38,null))['then'](removeEntity(_0x5fdf38,null))[_0x7ae9('0x46')](handleError(_0x5fdf38,null));}; \ No newline at end of file +var _0x8875=['squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','get','Pauses','UserProfileResource','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','Pause','includeAll','include','findAll','rows','catch','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8875,0x1ee));var _0x5887=function(_0x773e03,_0x283799){_0x773e03=_0x773e03-0x0;var _0x6e5954=_0x8875[_0x773e03];return _0x6e5954;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5887('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5887('0x1'));var rp=require('request-promise');var moment=require(_0x5887('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x5887('0x3'));var util=require(_0x5887('0x4'));var path=require(_0x5887('0x5'));var sox=require(_0x5887('0x6'));var csv=require(_0x5887('0x7'));var ejs=require(_0x5887('0x8'));var fs=require('fs');var fs_extra=require(_0x5887('0x9'));var _=require('lodash');var squel=require(_0x5887('0xa'));var crypto=require(_0x5887('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x5887('0xc'));var toCsv=require(_0x5887('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5887('0xd'));var authService=require(_0x5887('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x5887('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5887('0x10'))('api');var utils=require(_0x5887('0x11'));var config=require(_0x5887('0x12'));var licenseUtil=require(_0x5887('0x13'));var db=require(_0x5887('0x14'))['db'];function respondWithStatusCode(_0x14eae7,_0x7c2fca){_0x7c2fca=_0x7c2fca||0xcc;return function(_0x23ac3c){if(_0x23ac3c){return _0x14eae7['sendStatus'](_0x7c2fca);}return _0x14eae7[_0x5887('0x15')](_0x7c2fca)[_0x5887('0x16')]();};}function respondWithResult(_0x10af7a,_0xdfd14){_0xdfd14=_0xdfd14||0xc8;return function(_0x24128c){if(_0x24128c){return _0x10af7a[_0x5887('0x15')](_0xdfd14)['json'](_0x24128c);}};}function respondWithFilteredResult(_0x14e7c1,_0x3ec60f){return function(_0x57ce1b){if(_0x57ce1b){var _0x2892bb=typeof _0x3ec60f[_0x5887('0x17')]===_0x5887('0x18')&&typeof _0x3ec60f[_0x5887('0x19')]===_0x5887('0x18');var _0x2acb78=_0x57ce1b[_0x5887('0x1a')];var _0x561341=_0x2892bb?0x0:_0x3ec60f[_0x5887('0x17')];var _0x2b98d5=_0x2892bb?_0x57ce1b[_0x5887('0x1a')]:_0x3ec60f['offset']+_0x3ec60f[_0x5887('0x19')];var _0x343263;if(_0x2b98d5>=_0x2acb78){_0x2b98d5=_0x2acb78;_0x343263=0xc8;}else{_0x343263=0xce;}_0x14e7c1[_0x5887('0x15')](_0x343263);return _0x14e7c1[_0x5887('0x1b')](_0x5887('0x1c'),_0x561341+'-'+_0x2b98d5+'/'+_0x2acb78)[_0x5887('0x1d')](_0x57ce1b);}return null;};}function patchUpdates(_0x7b73b4){return function(_0x5a9bc7){try{jsonpatch[_0x5887('0x1e')](_0x5a9bc7,_0x7b73b4,!![]);}catch(_0x2404c7){return BPromise[_0x5887('0x1f')](_0x2404c7);}return _0x5a9bc7['save']();};}function saveUpdates(_0x3e9a6e,_0x20afc5){return function(_0x4ece1b){if(_0x4ece1b){return _0x4ece1b[_0x5887('0x20')](_0x3e9a6e)[_0x5887('0x21')](function(_0x4a495e){return _0x4a495e;});}return null;};}function removeEntity(_0x28a355,_0x4a2b99){return function(_0x586294){if(_0x586294){return _0x586294[_0x5887('0x22')]()[_0x5887('0x21')](function(){var _0x360425=_0x586294[_0x5887('0x23')]({'plain':!![]});var _0x146bc2=_0x5887('0x24');return db[_0x5887('0x25')][_0x5887('0x22')]({'where':{'type':_0x146bc2,'resourceId':_0x360425['id']}})[_0x5887('0x21')](function(){return _0x586294;});})[_0x5887('0x21')](function(){_0x28a355[_0x5887('0x15')](0xcc)[_0x5887('0x16')]();});}};}function handleEntityNotFound(_0x168a15,_0xe899f4){return function(_0x2bff25){if(!_0x2bff25){_0x168a15[_0x5887('0x26')](0x194);}return _0x2bff25;};}function handleError(_0x53c016,_0x13f224){_0x13f224=_0x13f224||0x1f4;return function(_0x5cec75){logger['error'](_0x5cec75[_0x5887('0x27')]);if(_0x5cec75[_0x5887('0x28')]){delete _0x5cec75[_0x5887('0x28')];}_0x53c016[_0x5887('0x15')](_0x13f224)[_0x5887('0x29')](_0x5cec75);};}exports[_0x5887('0x2a')]=function(_0x4584ad,_0x3e947e){var _0x53c1f2={},_0x346314={},_0x5c04dc={'count':0x0,'rows':[]};var _0x23d046=_[_0x5887('0x2b')](db['Pause'][_0x5887('0x2c')],function(_0x462242){return{'name':_0x462242[_0x5887('0x2d')],'type':_0x462242[_0x5887('0x2e')][_0x5887('0x2f')]};});_0x346314[_0x5887('0x30')]=_['map'](_0x23d046,'name');_0x346314[_0x5887('0x31')]=_[_0x5887('0x32')](_0x4584ad['query']);_0x346314[_0x5887('0x33')]=_[_0x5887('0x34')](_0x346314['model'],_0x346314[_0x5887('0x31')]);_0x53c1f2[_0x5887('0x35')]=_[_0x5887('0x34')](_0x346314[_0x5887('0x30')],qs[_0x5887('0x36')](_0x4584ad['query'][_0x5887('0x36')]));_0x53c1f2['attributes']=_0x53c1f2['attributes'][_0x5887('0x37')]?_0x53c1f2['attributes']:_0x346314[_0x5887('0x30')];if(!_0x4584ad[_0x5887('0x31')][_0x5887('0x38')](_0x5887('0x39'))){_0x53c1f2[_0x5887('0x19')]=qs[_0x5887('0x19')](_0x4584ad[_0x5887('0x31')][_0x5887('0x19')]);_0x53c1f2[_0x5887('0x17')]=qs[_0x5887('0x17')](_0x4584ad['query'][_0x5887('0x17')]);}_0x53c1f2[_0x5887('0x3a')]=qs[_0x5887('0x3b')](_0x4584ad['query'][_0x5887('0x3b')]);_0x53c1f2[_0x5887('0x3c')]=qs['filters'](_[_0x5887('0x3d')](_0x4584ad[_0x5887('0x31')],_0x346314[_0x5887('0x33')]),_0x23d046);if(_0x4584ad['query'][_0x5887('0x3e')]){_0x53c1f2['where']=_[_0x5887('0x3f')](_0x53c1f2[_0x5887('0x3c')],{'$or':_['map'](_0x23d046,function(_0x356430){if(_0x356430[_0x5887('0x2e')]!==_0x5887('0x40')){var _0x3a80d5={};_0x3a80d5[_0x356430[_0x5887('0x28')]]={'$like':'%'+_0x4584ad[_0x5887('0x31')]['filter']+'%'};return _0x3a80d5;}})});}_0x53c1f2=_['merge']({},_0x53c1f2,_0x4584ad[_0x5887('0x41')]);var _0x57981b={'where':_0x53c1f2['where']};return db[_0x5887('0x42')][_0x5887('0x1a')](_0x57981b)[_0x5887('0x21')](function(_0x5d3221){_0x5c04dc[_0x5887('0x1a')]=_0x5d3221;if(_0x4584ad[_0x5887('0x31')][_0x5887('0x43')]){_0x53c1f2[_0x5887('0x44')]=[{'all':!![]}];}return db[_0x5887('0x42')][_0x5887('0x45')](_0x53c1f2);})[_0x5887('0x21')](function(_0x33bee6){_0x5c04dc[_0x5887('0x46')]=_0x33bee6;return _0x5c04dc;})[_0x5887('0x21')](respondWithFilteredResult(_0x3e947e,_0x53c1f2))[_0x5887('0x47')](handleError(_0x3e947e,null));};exports[_0x5887('0x48')]=function(_0x19a657,_0x52ef2a){var _0x3caf33={'raw':!![],'where':{'id':_0x19a657[_0x5887('0x49')]['id']}},_0x2d143c={};_0x2d143c[_0x5887('0x30')]=_['keys'](db['Pause']['rawAttributes']);_0x2d143c[_0x5887('0x31')]=_[_0x5887('0x32')](_0x19a657['query']);_0x2d143c['filters']=_[_0x5887('0x34')](_0x2d143c[_0x5887('0x30')],_0x2d143c[_0x5887('0x31')]);_0x3caf33['attributes']=_[_0x5887('0x34')](_0x2d143c['model'],qs[_0x5887('0x36')](_0x19a657[_0x5887('0x31')][_0x5887('0x36')]));_0x3caf33[_0x5887('0x35')]=_0x3caf33['attributes'][_0x5887('0x37')]?_0x3caf33['attributes']:_0x2d143c[_0x5887('0x30')];if(_0x19a657['query'][_0x5887('0x43')]){_0x3caf33[_0x5887('0x44')]=[{'all':!![]}];}_0x3caf33=_[_0x5887('0x3f')]({},_0x3caf33,_0x19a657[_0x5887('0x41')]);return db[_0x5887('0x42')][_0x5887('0x4a')](_0x3caf33)[_0x5887('0x21')](handleEntityNotFound(_0x52ef2a,null))['then'](respondWithResult(_0x52ef2a,null))[_0x5887('0x47')](handleError(_0x52ef2a,null));};exports[_0x5887('0x4b')]=function(_0x1ea880,_0x5a3c48){return db['Pause'][_0x5887('0x4b')](_0x1ea880[_0x5887('0x4c')],{})[_0x5887('0x21')](function(_0x4b5f13){var _0x1f119d=_0x1ea880['user'][_0x5887('0x23')]({'plain':!![]});if(!_0x1f119d)throw new Error(_0x5887('0x4d'));if(_0x1f119d[_0x5887('0x4e')]===_0x5887('0x4f')){var _0x562d86=_0x4b5f13[_0x5887('0x23')]({'plain':!![]});var _0x374a00=_0x5887('0x24');return db['UserProfileSection']['find']({'where':{'name':_0x374a00,'userProfileId':_0x1f119d[_0x5887('0x50')]},'raw':!![]})['then'](function(_0x40de43){if(_0x40de43&&_0x40de43[_0x5887('0x51')]===0x0){return db['UserProfileResource'][_0x5887('0x4b')]({'name':_0x562d86[_0x5887('0x28')],'resourceId':_0x562d86['id'],'type':_0x40de43[_0x5887('0x28')],'sectionId':_0x40de43['id']},{})[_0x5887('0x21')](function(){return _0x4b5f13;});}else{return _0x4b5f13;}})[_0x5887('0x47')](function(_0x587893){logger[_0x5887('0x52')](_0x5887('0x53'),_0x587893);throw _0x587893;});}return _0x4b5f13;})[_0x5887('0x21')](respondWithResult(_0x5a3c48,0xc9))[_0x5887('0x47')](handleError(_0x5a3c48,null));};exports['update']=function(_0x24f708,_0x2a720d){if(_0x24f708[_0x5887('0x4c')]['id']){delete _0x24f708[_0x5887('0x4c')]['id'];}return db[_0x5887('0x42')][_0x5887('0x4a')]({'where':{'id':_0x24f708[_0x5887('0x49')]['id']}})[_0x5887('0x21')](handleEntityNotFound(_0x2a720d,null))[_0x5887('0x21')](saveUpdates(_0x24f708[_0x5887('0x4c')],null))[_0x5887('0x21')](respondWithResult(_0x2a720d,null))[_0x5887('0x47')](handleError(_0x2a720d,null));};exports[_0x5887('0x22')]=function(_0x44fe0b,_0x456cec){return db['Pause']['find']({'where':{'id':_0x44fe0b[_0x5887('0x49')]['id']}})[_0x5887('0x21')](handleEntityNotFound(_0x456cec,null))[_0x5887('0x21')](removeEntity(_0x456cec,null))[_0x5887('0x47')](handleError(_0x456cec,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 2845a5b..882919d 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 _0xabce=['util','../../config/logger','api','moment','path','rimraf','../../config/environment','define','tools_pauses','lodash'];(function(_0x4aefcd,_0x8e9f72){var _0xa973ad=function(_0x4d2bb4){while(--_0x4d2bb4){_0x4aefcd['push'](_0x4aefcd['shift']());}};_0xa973ad(++_0x8e9f72);}(_0xabce,0x103));var _0xeabc=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xabce[_0x2bf141];return _0x48277b;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var logger=require(_0xeabc('0x2'))(_0xeabc('0x3'));var moment=require(_0xeabc('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xeabc('0x5'));var rimraf=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var attributes=require('./pause.attributes');module['exports']=function(_0x1b07a8,_0x52a4d7){return _0x1b07a8[_0xeabc('0x8')]('Pause',attributes,{'tableName':_0xeabc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xabce=['util','../../config/logger','api','moment','path','rimraf','../../config/environment','define','tools_pauses','lodash'];(function(_0x3ad182,_0x342ff){var _0x1a6cd8=function(_0x2a48c4){while(--_0x2a48c4){_0x3ad182['push'](_0x3ad182['shift']());}};_0x1a6cd8(++_0x342ff);}(_0xabce,0x103));var _0xeabc=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xabce[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var logger=require(_0xeabc('0x2'))(_0xeabc('0x3'));var moment=require(_0xeabc('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xeabc('0x5'));var rimraf=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var attributes=require('./pause.attributes');module['exports']=function(_0x1b07a8,_0x52a4d7){return _0x1b07a8[_0xeabc('0x8')]('Pause',attributes,{'tableName':_0xeabc('0x9'),'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 771af87..fcb3a41 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(_0x592e9e,_0x3a9301){var _0x1dda1c=function(_0x1e830a){while(--_0x1e830a){_0x592e9e['push'](_0x592e9e['shift']());}};_0x1dda1c(++_0x3a9301);}(_0x7a54,0x106));var _0x47a5=function(_0x404887,_0x922cb3){_0x404887=_0x404887-0x0;var _0x42906b=_0x7a54[_0x404887];return _0x42906b;};'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(_0x5c74d4,_0x20b457){var _0x44e19d=function(_0x128691){while(--_0x128691){_0x5c74d4['push'](_0x5c74d4['shift']());}};_0x44e19d(++_0x20b457);}(_0x7a54,0x106));var _0x47a5=function(_0x474396,_0x497d52){_0x474396=_0x474396-0x0;var _0x2b9ea8=_0x7a54[_0x474396];return _0x2b9ea8;};'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 74c5aad..edcc155 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 _0x3140=['../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','/webhook','webhookGet','/:id','/:id/download','download','diskStorage','join','server/files/plugins','originalname','replace','%s-%s%s','basename','extname','now','single','file','upload','delete','multer','util','path','connect-timeout','fs-extra'];(function(_0x1759c1,_0x1c11ca){var _0x82e460=function(_0x2407bc){while(--_0x2407bc){_0x1759c1['push'](_0x1759c1['shift']());}};_0x82e460(++_0x1c11ca);}(_0x3140,0xaf));var _0x0314=function(_0x1030ce,_0xbe3f74){_0x1030ce=_0x1030ce-0x0;var _0x3367fd=_0x3140[_0x1030ce];return _0x3367fd;};'use strict';var multer=require(_0x0314('0x0'));var util=require(_0x0314('0x1'));var path=require(_0x0314('0x2'));var timeout=require(_0x0314('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x0314('0x4'));var auth=require(_0x0314('0x5'));var interaction=require(_0x0314('0x6'));var config=require(_0x0314('0x7'));var controller=require(_0x0314('0x8'));router[_0x0314('0x9')]('/',auth[_0x0314('0xa')](),controller[_0x0314('0xb')]);router[_0x0314('0x9')](_0x0314('0xc'),controller[_0x0314('0xd')]);router['get'](_0x0314('0xe'),auth[_0x0314('0xa')](),controller['show']);router['get'](_0x0314('0xf'),auth['isAuthenticated'](),controller[_0x0314('0x10')]);var upload=multer({'storage':multer[_0x0314('0x11')]({'destination':function(_0x3a7713,_0x376da9,_0x375416){_0x375416(null,path[_0x0314('0x12')](config['root'],_0x0314('0x13')));},'filename':function(_0x2bc151,_0xd85ddf,_0x4602ec){_0xd85ddf[_0x0314('0x14')]=_0xd85ddf[_0x0314('0x14')][_0x0314('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4602ec(null,util['format'](_0x0314('0x16'),path[_0x0314('0x17')](_0xd85ddf[_0x0314('0x14')],path[_0x0314('0x18')](_0xd85ddf[_0x0314('0x14')])),Date[_0x0314('0x19')](),path[_0x0314('0x18')](_0xd85ddf[_0x0314('0x14')])));}})});router['post']('/',upload[_0x0314('0x1a')](_0x0314('0x1b')),controller[_0x0314('0x1c')]);router['post'](_0x0314('0xc'),controller['webhookPost']);router['put'](_0x0314('0xe'),auth[_0x0314('0xa')](),controller['update']);router[_0x0314('0x1d')](_0x0314('0xe'),auth['isAuthenticated'](),controller[_0x0314('0x1d')]);module['exports']=router; \ No newline at end of file +var _0x57d4=['../../config/environment','./plugin.controller','get','isAuthenticated','index','/webhook','webhookGet','show','diskStorage','join','root','server/files/plugins','originalname','%s-%s%s','basename','extname','now','single','file','upload','webhookPost','/:id','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x5987ac,_0x213dac){var _0xb3d18=function(_0x5e435e){while(--_0x5e435e){_0x5987ac['push'](_0x5987ac['shift']());}};_0xb3d18(++_0x213dac);}(_0x57d4,0x78));var _0x457d=function(_0x295e13,_0xd6b48b){_0x295e13=_0x295e13-0x0;var _0x33ac46=_0x57d4[_0x295e13];return _0x33ac46;};'use strict';var multer=require(_0x457d('0x0'));var util=require(_0x457d('0x1'));var path=require('path');var timeout=require(_0x457d('0x2'));var express=require(_0x457d('0x3'));var router=express[_0x457d('0x4')]();var fs_extra=require(_0x457d('0x5'));var auth=require(_0x457d('0x6'));var interaction=require(_0x457d('0x7'));var config=require(_0x457d('0x8'));var controller=require(_0x457d('0x9'));router[_0x457d('0xa')]('/',auth[_0x457d('0xb')](),controller[_0x457d('0xc')]);router['get'](_0x457d('0xd'),controller[_0x457d('0xe')]);router['get']('/:id',auth[_0x457d('0xb')](),controller[_0x457d('0xf')]);router[_0x457d('0xa')]('/:id/download',auth['isAuthenticated'](),controller['download']);var upload=multer({'storage':multer[_0x457d('0x10')]({'destination':function(_0x38ec93,_0x449f48,_0x128e09){_0x128e09(null,path[_0x457d('0x11')](config[_0x457d('0x12')],_0x457d('0x13')));},'filename':function(_0x24cf65,_0xe7d200,_0x5abf49){_0xe7d200[_0x457d('0x14')]=_0xe7d200[_0x457d('0x14')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x5abf49(null,util['format'](_0x457d('0x15'),path[_0x457d('0x16')](_0xe7d200[_0x457d('0x14')],path[_0x457d('0x17')](_0xe7d200[_0x457d('0x14')])),Date[_0x457d('0x18')](),path[_0x457d('0x17')](_0xe7d200[_0x457d('0x14')])));}})});router['post']('/',upload[_0x457d('0x19')](_0x457d('0x1a')),controller[_0x457d('0x1b')]);router['post']('/webhook',controller[_0x457d('0x1c')]);router['put'](_0x457d('0x1d'),auth[_0x457d('0xb')](),controller['update']);router[_0x457d('0x1e')]('/:id',auth['isAuthenticated'](),controller[_0x457d('0x1e')]);module[_0x457d('0x1f')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index dfc080f..179225b 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 _0xf106=['always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','STRING','ENUM','html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly'];(function(_0x27dfb2,_0x59b146){var _0x52c5be=function(_0x44965f){while(--_0x44965f){_0x27dfb2['push'](_0x27dfb2['shift']());}};_0x52c5be(++_0x59b146);}(_0xf106,0xe3));var _0x6f10=function(_0x39caaa,_0x1f37bc){_0x39caaa=_0x39caaa-0x0;var _0x9b9c7d=_0xf106[_0x39caaa];return _0x9b9c7d;};'use strict';var Sequelize=require(_0x6f10('0x0'));module['exports']={'name':{'type':Sequelize[_0x6f10('0x1')]},'type':{'type':Sequelize[_0x6f10('0x2')](_0x6f10('0x3'),_0x6f10('0x4'))},'description':{'type':Sequelize[_0x6f10('0x5')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0x6f10('0x1')],'comment':_0x6f10('0x6')},'active':{'type':Sequelize[_0x6f10('0x7')],'defaultValue':0x0,'comment':_0x6f10('0x8')},'sidebar':{'type':Sequelize[_0x6f10('0x2')](_0x6f10('0x9'),_0x6f10('0xa'),_0x6f10('0xb'),_0x6f10('0xc')),'defaultValue':'always','comment':_0x6f10('0xd')},'icon':{'type':Sequelize[_0x6f10('0x1')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize[_0x6f10('0x1')]},'scriptName':{'type':Sequelize[_0x6f10('0x1')]},'scriptPath':{'type':Sequelize[_0x6f10('0x1')]}}; \ No newline at end of file +var _0x8b54=['BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING','html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'];(function(_0x2b498a,_0x479ec8){var _0x134fc2=function(_0x5f29d3){while(--_0x5f29d3){_0x2b498a['push'](_0x2b498a['shift']());}};_0x134fc2(++_0x479ec8);}(_0x8b54,0x149));var _0x48b5=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8b54[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x48b5('0x0'));module[_0x48b5('0x1')]={'name':{'type':Sequelize[_0x48b5('0x2')]},'type':{'type':Sequelize['ENUM'](_0x48b5('0x3'),_0x48b5('0x4'))},'description':{'type':Sequelize[_0x48b5('0x5')]},'version':{'type':Sequelize[_0x48b5('0x5')]},'path':{'type':Sequelize[_0x48b5('0x2')],'comment':_0x48b5('0x6')},'active':{'type':Sequelize[_0x48b5('0x7')],'defaultValue':0x0,'comment':_0x48b5('0x8')},'sidebar':{'type':Sequelize['ENUM'](_0x48b5('0x9'),_0x48b5('0xa'),_0x48b5('0xb'),_0x48b5('0xc')),'defaultValue':_0x48b5('0xb'),'comment':_0x48b5('0xd')},'icon':{'type':Sequelize[_0x48b5('0x2')]},'adminUrl':{'type':Sequelize[_0x48b5('0x2')]},'agentUrl':{'type':Sequelize[_0x48b5('0x2')]},'scriptName':{'type':Sequelize[_0x48b5('0x2')]},'scriptPath':{'type':Sequelize[_0x48b5('0x2')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index e7f37d1..11e97e5 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 _0xe846=['extname','file','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','manifest.json','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','type','Invalid\x20manifest:\x20type\x20missing','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','admin','agent','script','Invalid\x20manifest:\x20script\x20name\x20missing','Invalid\x20manifest:\x20script\x20path\x20missing','description','sidebar','always','icon','icon-apps','version','plugins','Warning:\x20admin\x20view\x20not\x20specified','test','Warning:\x20agent\x20view\x20not\x20specified','scriptPath','create','role','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','update','delete','params','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','json','encoding','method','%s%s','headers','content-length','content-type','statusCode','webhookPost','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./plugin.socket','sendStatus','end','status','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','get','Plugins','UserProfileResource','stack','name','send','map','Plugin','rawAttributes','model','keys','query','filters','intersection','attributes','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','findAll','rows','catch','show','fields','includeAll','include','find','root','server/files/plugins','format','%s.zip','basename','createWriteStream','zip','code','ENOENT','error','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','Sequelize','glob','**/*','join','dirname','node_modules/**/*','attachments/**/*','finalize','close','Plugin\x20not\x20found','download','Error\x20while\x20downloading\x20the\x20plugin','info','upload','filename'];(function(_0x39075a,_0x50aeae){var _0x417784=function(_0xfc640){while(--_0xfc640){_0x39075a['push'](_0x39075a['shift']());}};_0x417784(++_0x50aeae);}(_0xe846,0xef));var _0x6e84=function(_0x3f2c78,_0x318d94){_0x3f2c78=_0x3f2c78-0x0;var _0x231f31=_0xe846[_0x3f2c78];return _0x231f31;};'use strict';var emlformat=require(_0x6e84('0x0'));var rimraf=require(_0x6e84('0x1'));var zipdir=require(_0x6e84('0x2'));var jsonpatch=require(_0x6e84('0x3'));var rp=require(_0x6e84('0x4'));var moment=require(_0x6e84('0x5'));var BPromise=require(_0x6e84('0x6'));var Mustache=require(_0x6e84('0x7'));var util=require(_0x6e84('0x8'));var path=require(_0x6e84('0x9'));var sox=require('sox');var csv=require(_0x6e84('0xa'));var ejs=require(_0x6e84('0xb'));var fs=require('fs');var fs_extra=require(_0x6e84('0xc'));var _=require(_0x6e84('0xd'));var squel=require(_0x6e84('0xe'));var crypto=require(_0x6e84('0xf'));var jsforce=require(_0x6e84('0x10'));var deskjs=require(_0x6e84('0x11'));var toCsv=require('to-csv');var querystring=require(_0x6e84('0x12'));var Papa=require(_0x6e84('0x13'));var extract=require('extract-zip');var rimraf=require(_0x6e84('0x1'));var archiver=require(_0x6e84('0x14'));var Redis=require(_0x6e84('0x15'));var authService=require(_0x6e84('0x16'));var qs=require(_0x6e84('0x17'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6e84('0x18'));var logger=require('../../config/logger')(_0x6e84('0x19'));var utils=require(_0x6e84('0x1a'));var config=require('../../config/environment');var licenseUtil=require(_0x6e84('0x1b'));var db=require(_0x6e84('0x1c'))['db'];config['redis']=_['defaults'](config[_0x6e84('0x1d')],{'host':_0x6e84('0x1e'),'port':0x18eb});var socket=require(_0x6e84('0x1f'))(new Redis(config[_0x6e84('0x1d')]));require(_0x6e84('0x20'))['register'](socket);function respondWithStatusCode(_0x26df0d,_0x1bdc4e){_0x1bdc4e=_0x1bdc4e||0xcc;return function(_0x54649d){if(_0x54649d){return _0x26df0d[_0x6e84('0x21')](_0x1bdc4e);}return _0x26df0d['status'](_0x1bdc4e)[_0x6e84('0x22')]();};}function respondWithResult(_0x216149,_0x133e54){_0x133e54=_0x133e54||0xc8;return function(_0x1f0471){if(_0x1f0471){return _0x216149[_0x6e84('0x23')](_0x133e54)['json'](_0x1f0471);}};}function respondWithFilteredResult(_0x3dd7a6,_0xbe0fb0){return function(_0x35fd5f){if(_0x35fd5f){var _0x40bc0c=typeof _0xbe0fb0['offset']===_0x6e84('0x24')&&typeof _0xbe0fb0[_0x6e84('0x25')]===_0x6e84('0x24');var _0x290186=_0x35fd5f[_0x6e84('0x26')];var _0x39ee08=_0x40bc0c?0x0:_0xbe0fb0[_0x6e84('0x27')];var _0x33c016=_0x40bc0c?_0x35fd5f[_0x6e84('0x26')]:_0xbe0fb0['offset']+_0xbe0fb0[_0x6e84('0x25')];var _0x4f4965;if(_0x33c016>=_0x290186){_0x33c016=_0x290186;_0x4f4965=0xc8;}else{_0x4f4965=0xce;}_0x3dd7a6[_0x6e84('0x23')](_0x4f4965);return _0x3dd7a6[_0x6e84('0x28')](_0x6e84('0x29'),_0x39ee08+'-'+_0x33c016+'/'+_0x290186)['json'](_0x35fd5f);}return null;};}function patchUpdates(_0x27ab86){return function(_0x213aaf){try{jsonpatch[_0x6e84('0x2a')](_0x213aaf,_0x27ab86,!![]);}catch(_0x3bf7be){return BPromise[_0x6e84('0x2b')](_0x3bf7be);}return _0x213aaf[_0x6e84('0x2c')]();};}function saveUpdates(_0x163611,_0x54bf7b){return function(_0x2096c8){if(_0x2096c8){return _0x2096c8['update'](_0x163611)[_0x6e84('0x2d')](function(_0x23f9fa){return _0x23f9fa;});}return null;};}function removeEntity(_0x550691,_0x34c49){return function(_0x56b96e){if(_0x56b96e){return _0x56b96e[_0x6e84('0x2e')]()[_0x6e84('0x2d')](function(){var _0x11578a=_0x56b96e[_0x6e84('0x2f')]({'plain':!![]});var _0x5b37ac=_0x6e84('0x30');return db[_0x6e84('0x31')]['destroy']({'where':{'type':_0x5b37ac,'resourceId':_0x11578a['id']}})[_0x6e84('0x2d')](function(){return _0x56b96e;});})[_0x6e84('0x2d')](function(){_0x550691[_0x6e84('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x64b1cd,_0x308054){return function(_0x4eabf0){if(!_0x4eabf0){_0x64b1cd[_0x6e84('0x21')](0x194);}return _0x4eabf0;};}function handleError(_0x46b4a5,_0x5de98b){_0x5de98b=_0x5de98b||0x1f4;return function(_0x1d0cda){logger['error'](_0x1d0cda[_0x6e84('0x32')]);if(_0x1d0cda['name']){delete _0x1d0cda[_0x6e84('0x33')];}_0x46b4a5[_0x6e84('0x23')](_0x5de98b)[_0x6e84('0x34')](_0x1d0cda);};}exports['index']=function(_0x5d69d1,_0x38d322){var _0x3f0c69={},_0x8a752a={},_0x5e99cc={'count':0x0,'rows':[]};var _0x49ab48=_[_0x6e84('0x35')](db[_0x6e84('0x36')][_0x6e84('0x37')],function(_0x5a9f94){return{'name':_0x5a9f94['fieldName'],'type':_0x5a9f94['type']['key']};});_0x8a752a[_0x6e84('0x38')]=_[_0x6e84('0x35')](_0x49ab48,_0x6e84('0x33'));_0x8a752a['query']=_[_0x6e84('0x39')](_0x5d69d1[_0x6e84('0x3a')]);_0x8a752a[_0x6e84('0x3b')]=_[_0x6e84('0x3c')](_0x8a752a['model'],_0x8a752a[_0x6e84('0x3a')]);_0x3f0c69['attributes']=_[_0x6e84('0x3c')](_0x8a752a['model'],qs['fields'](_0x5d69d1[_0x6e84('0x3a')]['fields']));_0x3f0c69[_0x6e84('0x3d')]=_0x3f0c69[_0x6e84('0x3d')][_0x6e84('0x3e')]?_0x3f0c69['attributes']:_0x8a752a[_0x6e84('0x38')];if(!_0x5d69d1[_0x6e84('0x3a')]['hasOwnProperty'](_0x6e84('0x3f'))){_0x3f0c69[_0x6e84('0x25')]=qs[_0x6e84('0x25')](_0x5d69d1[_0x6e84('0x3a')][_0x6e84('0x25')]);_0x3f0c69['offset']=qs['offset'](_0x5d69d1[_0x6e84('0x3a')][_0x6e84('0x27')]);}_0x3f0c69[_0x6e84('0x40')]=qs[_0x6e84('0x41')](_0x5d69d1[_0x6e84('0x3a')][_0x6e84('0x41')]);_0x3f0c69['where']=qs[_0x6e84('0x3b')](_[_0x6e84('0x42')](_0x5d69d1[_0x6e84('0x3a')],_0x8a752a[_0x6e84('0x3b')]),_0x49ab48);if(_0x5d69d1[_0x6e84('0x3a')][_0x6e84('0x43')]){_0x3f0c69[_0x6e84('0x44')]=_[_0x6e84('0x45')](_0x3f0c69[_0x6e84('0x44')],{'$or':_[_0x6e84('0x35')](_0x49ab48,function(_0x162ed1){if(_0x162ed1['type']!==_0x6e84('0x46')){var _0x2a69bf={};_0x2a69bf[_0x162ed1[_0x6e84('0x33')]]={'$like':'%'+_0x5d69d1[_0x6e84('0x3a')]['filter']+'%'};return _0x2a69bf;}})});}_0x3f0c69=_['merge']({},_0x3f0c69,_0x5d69d1[_0x6e84('0x47')]);var _0x2e1b31={'where':_0x3f0c69['where']};return db['Plugin']['count'](_0x2e1b31)['then'](function(_0x4f242e){_0x5e99cc[_0x6e84('0x26')]=_0x4f242e;if(_0x5d69d1['query']['includeAll']){_0x3f0c69['include']=[{'all':!![]}];}return db['Plugin'][_0x6e84('0x48')](_0x3f0c69);})['then'](function(_0x3c900f){_0x5e99cc[_0x6e84('0x49')]=_0x3c900f;return _0x5e99cc;})[_0x6e84('0x2d')](respondWithFilteredResult(_0x38d322,_0x3f0c69))[_0x6e84('0x4a')](handleError(_0x38d322,null));};exports[_0x6e84('0x4b')]=function(_0x5ca1aa,_0x125fac){var _0x385828={'raw':!![],'where':{'id':_0x5ca1aa['params']['id']}},_0x591568={};_0x591568[_0x6e84('0x38')]=_['keys'](db[_0x6e84('0x36')]['rawAttributes']);_0x591568[_0x6e84('0x3a')]=_[_0x6e84('0x39')](_0x5ca1aa['query']);_0x591568[_0x6e84('0x3b')]=_[_0x6e84('0x3c')](_0x591568[_0x6e84('0x38')],_0x591568[_0x6e84('0x3a')]);_0x385828[_0x6e84('0x3d')]=_[_0x6e84('0x3c')](_0x591568[_0x6e84('0x38')],qs[_0x6e84('0x4c')](_0x5ca1aa['query']['fields']));_0x385828[_0x6e84('0x3d')]=_0x385828[_0x6e84('0x3d')][_0x6e84('0x3e')]?_0x385828['attributes']:_0x591568[_0x6e84('0x38')];if(_0x5ca1aa['query'][_0x6e84('0x4d')]){_0x385828[_0x6e84('0x4e')]=[{'all':!![]}];}_0x385828=_['merge']({},_0x385828,_0x5ca1aa[_0x6e84('0x47')]);return db[_0x6e84('0x36')][_0x6e84('0x4f')](_0x385828)['then'](handleEntityNotFound(_0x125fac,null))['then'](respondWithResult(_0x125fac,null))[_0x6e84('0x4a')](handleError(_0x125fac,null));};exports['download']=function(_0x2f7f89,_0xc697e,_0x37bbf5){return db[_0x6e84('0x36')][_0x6e84('0x4f')]({'where':{'id':_0x2f7f89['params']['id']},'attributes':[_0x6e84('0x33'),'path'],'raw':!![]})['then'](handleEntityNotFound(_0xc697e,null))['then'](function(_0x36f73f){if(_0x36f73f){var _0x238b12=path['join'](config[_0x6e84('0x50')],_0x6e84('0x51'),util[_0x6e84('0x52')](_0x6e84('0x53'),path[_0x6e84('0x54')](_0x36f73f[_0x6e84('0x9')])));var _0x319f0d=fs[_0x6e84('0x55')](_0x238b12);var _0xb37cac=archiver(_0x6e84('0x56'),{'zlib':{'level':0x9}});_0xb37cac['on']('warning',function(_0x96ddae){if(_0x96ddae[_0x6e84('0x57')]===_0x6e84('0x58')){logger[_0x6e84('0x59')](_0x96ddae);}else{throw new db['Sequelize'][(_0x6e84('0x5a'))](_0x6e84('0x5b'));}});_0xb37cac['on'](_0x6e84('0x59'),function(_0x31cac3){throw new db[(_0x6e84('0x5c'))]['Error'](_0x6e84('0x5b'));});_0xb37cac['pipe'](_0x319f0d);_0xb37cac[_0x6e84('0x5d')](_0x6e84('0x5e'),{'cwd':path[_0x6e84('0x5f')](config[_0x6e84('0x50')],_0x6e84('0x51'),path[_0x6e84('0x60')](_0x36f73f[_0x6e84('0x9')])),'ignore':[path['join'](path['basename'](_0x36f73f[_0x6e84('0x9')]),_0x6e84('0x61')),path[_0x6e84('0x5f')](path[_0x6e84('0x54')](_0x36f73f[_0x6e84('0x9')]),_0x6e84('0x62'))],'nodir':!![]})[_0x6e84('0x63')]();_0x319f0d['on'](_0x6e84('0x64'),function(){if(!fs['existsSync'](_0x238b12)){throw new db[(_0x6e84('0x5c'))][(_0x6e84('0x5a'))](_0x6e84('0x65'));}return _0xc697e[_0x6e84('0x66')](_0x238b12,util[_0x6e84('0x52')](_0x6e84('0x53'),path[_0x6e84('0x54')](_0x36f73f[_0x6e84('0x9')])),function(_0xdb4d6e){if(_0xdb4d6e){throw new db['Sequelize'][(_0x6e84('0x5a'))](_0x6e84('0x67'));}fs['unlinkSync'](_0x238b12);logger[_0x6e84('0x68')]('Download\x20completed');logger[_0x6e84('0x68')]('Temporary\x20file\x20removed');});});}return null;})['catch'](handleError(_0xc697e,null));};exports[_0x6e84('0x69')]=function(_0x2e0256,_0x87d41d,_0x396cc0){var _0x15ad95=path[_0x6e84('0x54')](_0x2e0256['file'][_0x6e84('0x6a')],path[_0x6e84('0x6b')](_0x2e0256['file'][_0x6e84('0x6a')]));var _0x17f665=path['join'](config[_0x6e84('0x50')],_0x6e84('0x51'),_0x2e0256[_0x6e84('0x6c')][_0x6e84('0x6a')]);var _0x537d0d=path[_0x6e84('0x5f')](config[_0x6e84('0x50')],_0x6e84('0x51'),_0x15ad95);logger[_0x6e84('0x68')](_0x6e84('0x6d'),_0x17f665);logger['info'](_0x6e84('0x6e'),_0x537d0d);try{fs[_0x6e84('0x6f')](_0x17f665,parseInt(_0x6e84('0x70'),0x8));extract(_0x17f665,{'dir':_0x537d0d},function(_0x31057f){if(_0x31057f){logger[_0x6e84('0x59')](_0x31057f);handleError(_0x31057f,!![]);};var _0x494bc3=fs[_0x6e84('0x71')](_0x537d0d);if(_0x494bc3[_0x6e84('0x3e')]>0x1){removeReferences(_0x17f665,_0x537d0d);logger[_0x6e84('0x59')](_0x6e84('0x72'));return _0x396cc0(new Error(_0x6e84('0x72')));}var _0x4780c3=fs[_0x6e84('0x73')](path[_0x6e84('0x5f')](_0x537d0d,_0x494bc3[0x0]));if(_0x4780c3[_0x6e84('0x74')]()){removeReferences(_0x17f665,_0x537d0d);logger[_0x6e84('0x59')](_0x6e84('0x72'));return _0x396cc0(new Error('Invalid\x20plugin\x20structure'));}if(_0x4780c3[_0x6e84('0x75')]()){var _0x329f99=fs[_0x6e84('0x71')](path[_0x6e84('0x5f')](_0x537d0d,_0x494bc3[0x0]));if(_0x329f99[_0x6e84('0x3e')]===0x0){removeReferences(_0x17f665,_0x537d0d);logger[_0x6e84('0x59')](_0x6e84('0x72'));return _0x396cc0(new Error('Invalid\x20plugin\x20structure'));}var _0x3d9c4b=_0x329f99['some'](function(_0x46628f){return _0x46628f===_0x6e84('0x76');});if(!_0x3d9c4b){return _0x396cc0(new Error('Plugin\x20manifest\x20missing'));}var _0x44e932=fs[_0x6e84('0x77')](path[_0x6e84('0x5f')](_0x537d0d,_0x494bc3[0x0],'manifest.json'));var _0x284d94=JSON[_0x6e84('0x78')](_0x44e932);if(_0x6e84('0x24')==typeof _0x284d94[_0x6e84('0x33')]){return _0x396cc0(new Error(_0x6e84('0x79')));}if(_0x6e84('0x24')==typeof _0x284d94[_0x6e84('0x7a')]){return _0x396cc0(new Error(_0x6e84('0x7b')));}if(_0x6e84('0x24')==typeof _0x284d94['version']){return _0x396cc0(new Error(_0x6e84('0x7c')));}if(_0x6e84('0x24')==typeof _0x284d94[_0x6e84('0x7d')]){return _0x396cc0(new Error(_0x6e84('0x7e')));}if(_0x284d94[_0x6e84('0x7a')]===_0x6e84('0x7f')){if(_0x6e84('0x24')==typeof _0x284d94[_0x6e84('0x7d')][_0x6e84('0x80')]){return _0x396cc0(new Error('Invalid\x20manifest:\x20views\x20missing'));}if('undefined'==typeof _0x284d94[_0x6e84('0x7d')][_0x6e84('0x80')][_0x6e84('0x81')]&&_0x6e84('0x24')==typeof _0x284d94[_0x6e84('0x7d')][_0x6e84('0x80')][_0x6e84('0x82')]){return _0x396cc0(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x284d94[_0x6e84('0x7a')]===_0x6e84('0x83')){if(_0x6e84('0x24')==typeof _0x284d94[_0x6e84('0x7d')]['scriptName']){return _0x396cc0(new Error(_0x6e84('0x84')));}if(_0x6e84('0x24')==typeof _0x284d94[_0x6e84('0x7d')]['scriptPath']){return _0x396cc0(new Error(_0x6e84('0x85')));}}else{return _0x396cc0(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x33df04=_0x284d94['name'];var _0x4aa4e0=_0x284d94[_0x6e84('0x86')];var _0x1076a7=_0x284d94[_0x6e84('0x7a')];var _0x53b864=_0x284d94[_0x6e84('0x87')]?_0x284d94['sidebar']:_0x6e84('0x88');var _0x1f2bd3=_0x284d94['icon']?_0x284d94[_0x6e84('0x89')]:_0x6e84('0x8a');var _0x286f91='';var _0x16ac02='';var _0x14f24e='';var _0x1102e3='';var _0x9fb854=_0x284d94[_0x6e84('0x8b')];if(_0x1076a7===_0x6e84('0x7f')){if(_0x6e84('0x24')!=typeof _0x284d94[_0x6e84('0x7d')]['views'][_0x6e84('0x81')]){var _0x8e773=_0x284d94[_0x6e84('0x7d')]['views'][_0x6e84('0x81')];if(!/^(f|ht)tps?:\/\//i['test'](_0x8e773)){_0x286f91=path['join'](_0x6e84('0x8c'),_0x15ad95,_0x494bc3[0x0],_0x8e773);}else{_0x286f91=_0x8e773;}}else{logger['info'](_0x6e84('0x8d'));}if(_0x6e84('0x24')!=typeof _0x284d94[_0x6e84('0x7d')][_0x6e84('0x80')]['agent']){var _0x1a3b65=_0x284d94[_0x6e84('0x7d')][_0x6e84('0x80')][_0x6e84('0x82')];if(!/^(f|ht)tps?:\/\//i[_0x6e84('0x8e')](_0x1a3b65)){_0x16ac02=path[_0x6e84('0x5f')](_0x6e84('0x8c'),_0x15ad95,_0x494bc3[0x0],_0x1a3b65);}else{_0x16ac02=_0x1a3b65;}}else{logger[_0x6e84('0x68')](_0x6e84('0x8f'));}}else if(_0x1076a7==='script'){_0x14f24e=_0x284d94[_0x6e84('0x7d')]['scriptName'];_0x1102e3=_0x284d94[_0x6e84('0x7d')][_0x6e84('0x90')];if(_0x6e84('0x24')!=typeof _0x284d94[_0x6e84('0x7d')][_0x6e84('0x80')]){if('undefined'!=typeof _0x284d94[_0x6e84('0x7d')][_0x6e84('0x80')][_0x6e84('0x81')]){var _0x8e773=_0x284d94[_0x6e84('0x7d')][_0x6e84('0x80')][_0x6e84('0x81')];if(!/^(f|ht)tps?:\/\//i['test'](_0x8e773)){_0x286f91=path[_0x6e84('0x5f')](_0x6e84('0x8c'),_0x15ad95,_0x494bc3[0x0],_0x8e773);}else{_0x286f91=_0x8e773;}}if(_0x6e84('0x24')!=typeof _0x284d94['parameters'][_0x6e84('0x80')]['agent']){var _0x1a3b65=_0x284d94[_0x6e84('0x7d')][_0x6e84('0x80')][_0x6e84('0x82')];if(!/^(f|ht)tps?:\/\//i[_0x6e84('0x8e')](_0x1a3b65)){_0x16ac02=path[_0x6e84('0x5f')](_0x6e84('0x8c'),_0x15ad95,_0x494bc3[0x0],_0x1a3b65);}else{_0x16ac02=_0x1a3b65;}}}}var _0x477798={'name':_0x33df04,'description':_0x4aa4e0,'path':path[_0x6e84('0x5f')](_0x15ad95,_0x494bc3[0x0]),'type':_0x1076a7,'sidebar':_0x53b864,'icon':_0x1f2bd3,'adminUrl':_0x286f91,'agentUrl':_0x16ac02,'scriptName':_0x14f24e,'scriptPath':_0x1102e3,'version':_0x9fb854};removeReferences(_0x17f665,null);return db[_0x6e84('0x36')][_0x6e84('0x91')](_0x477798)[_0x6e84('0x2d')](function(_0x1e41f6){var _0x15da8d={'role':_0x2e0256['body'][_0x6e84('0x92')],'userProfileId':_0x2e0256[_0x6e84('0x93')][_0x6e84('0x94')]};if(!_0x15da8d)throw new Error(_0x6e84('0x95'));if(_0x15da8d[_0x6e84('0x92')]===_0x6e84('0x96')){var _0x2809cb=_0x1e41f6['get']({'plain':!![]});return db['UserProfileSection'][_0x6e84('0x4f')]({'where':{'name':_0x6e84('0x30'),'userProfileId':_0x15da8d['userProfileId']},'raw':!![]})[_0x6e84('0x2d')](function(_0x18c256){if(_0x18c256&&_0x18c256[_0x6e84('0x97')]===0x0){return db[_0x6e84('0x31')][_0x6e84('0x91')]({'name':_0x2809cb[_0x6e84('0x33')],'resourceId':_0x2809cb['id'],'type':_0x18c256[_0x6e84('0x33')],'sectionId':_0x18c256['id']},{})[_0x6e84('0x2d')](function(){return _0x1e41f6;});}else{return _0x1e41f6;}})[_0x6e84('0x4a')](function(_0x553fe8){logger['error'](_0x6e84('0x98'),_0x553fe8);throw _0x553fe8;});}return _0x1e41f6;})[_0x6e84('0x2d')](respondWithResult(_0x87d41d,null))['catch'](handleError(_0x87d41d,null));}});}catch(_0xfc7089){_0x87d41d['status'](0x1f4)[_0x6e84('0x34')](_0xfc7089);}};function removeReferences(_0x3edfb0,_0x2f450e){try{if(_0x3edfb0){fs['unlinkSync'](_0x3edfb0);logger[_0x6e84('0x68')](_0x6e84('0x99'));}if(_0x2f450e){rimraf(_0x2f450e,function(){});logger[_0x6e84('0x68')](_0x6e84('0x9a'));}}catch(_0x4dbcd7){logger['error'](_0x4dbcd7);}}exports[_0x6e84('0x9b')]=function(_0xb098a2,_0x33305b,_0xa0ead6){return db['Plugin'][_0x6e84('0x4f')]({'where':{'id':_0xb098a2['params']['id']}})['then'](handleEntityNotFound(_0x33305b,null))[_0x6e84('0x2d')](saveUpdates(_0xb098a2['body'],null))[_0x6e84('0x2d')](respondWithResult(_0x33305b,null))[_0x6e84('0x4a')](handleError(_0x33305b,null));};exports[_0x6e84('0x9c')]=function(_0x2eb450,_0x48495b,_0x59efb8){return db[_0x6e84('0x36')][_0x6e84('0x4f')]({'where':{'id':_0x2eb450[_0x6e84('0x9d')]['id']}})[_0x6e84('0x2d')](function(_0x3509d2){if(_0x3509d2){return _0x3509d2[_0x6e84('0x2e')]();}})['then'](function(_0x134fc0){rimraf(path[_0x6e84('0x5f')](config[_0x6e84('0x50')],_0x6e84('0x51'),path[_0x6e84('0x60')](_0x134fc0[_0x6e84('0x9')])),function(){});return _0x134fc0;})[_0x6e84('0x2d')](handleEntityNotFound(_0x48495b,null))['then'](respondWithStatusCode(_0x48495b,null))['catch'](handleError(_0x48495b,null));};exports['webhookGet']=function(_0x5a503a,_0x26a5bb,_0x1dc335){return BPromise[_0x6e84('0x9e')]()[_0x6e84('0x2d')](function(){if(!_0x5a503a[_0x6e84('0x3a')][_0x6e84('0x9')]){throw new Error(_0x6e84('0x9f'));}if(!_0x5a503a[_0x6e84('0x3a')][_0x6e84('0xa0')]){throw new Error(_0x6e84('0xa1'));}var _0x45a130=_0x5a503a[_0x6e84('0x3a')]['hostname']?_0x5a503a['query'][_0x6e84('0xa2')]+':'+_0x5a503a[_0x6e84('0x3a')]['port']:_0x6e84('0xa3')+_0x5a503a[_0x6e84('0x3a')][_0x6e84('0xa0')];var _0x32d34a=_0x5a503a[_0x6e84('0x3a')][_0x6e84('0xa4')]?_0x5a503a[_0x6e84('0x3a')][_0x6e84('0xa4')]:!![];var _0x49e274=_0x5a503a[_0x6e84('0x3a')][_0x6e84('0xa5')]?_0x5a503a['query']['encoding']:null;var _0x19b9f6={'method':_0x5a503a[_0x6e84('0xa6')],'uri':util[_0x6e84('0x52')](_0x6e84('0xa7'),_0x45a130,_0x5a503a['query']['path']),'json':_0x32d34a,'resolveWithFullResponse':!![],'encoding':_0x49e274,'qs':_0x5a503a[_0x6e84('0x3a')]};if(_0x5a503a['headers']){_0x19b9f6['headers']=_0x5a503a[_0x6e84('0xa8')];if(_0x19b9f6[_0x6e84('0xa8')][_0x6e84('0xa9')]){delete _0x19b9f6[_0x6e84('0xa8')][_0x6e84('0xa9')];}}if(_0x19b9f6[_0x6e84('0xa8')][_0x6e84('0xaa')]){delete _0x19b9f6[_0x6e84('0xa8')][_0x6e84('0xaa')];}return rp(_0x19b9f6);})[_0x6e84('0x2d')](function(_0x5f4bdc){if(_0x5f4bdc){_0x26a5bb['set'](_0x5f4bdc[_0x6e84('0xa8')]);logger[_0x6e84('0x68')](_0x5f4bdc[_0x6e84('0x93')]);if(_['endsWith'](_0x5a503a['query'][_0x6e84('0x9')],_0x6e84('0x66'))&&_0x5f4bdc[_0x6e84('0xab')]==0x1f4){return _0x26a5bb[_0x6e84('0x21')](_0x5f4bdc['statusCode']);}else{return _0x26a5bb[_0x6e84('0x23')](_0x5f4bdc[_0x6e84('0xab')])[_0x6e84('0x34')](_0x5f4bdc[_0x6e84('0x93')]);}}else{return _0x26a5bb[_0x6e84('0x21')](0xc8);}})['catch'](handleError(_0x26a5bb,null));};exports[_0x6e84('0xac')]=function(_0x1dbd84,_0x36559a,_0x1eafda){return BPromise[_0x6e84('0x9e')]()[_0x6e84('0x2d')](function(){if(!_0x1dbd84['query'][_0x6e84('0x9')]){throw new Error(_0x6e84('0x9f'));}if(!_0x1dbd84[_0x6e84('0x3a')][_0x6e84('0xa0')]){throw new Error(_0x6e84('0xa1'));}var _0x22833d=_0x1dbd84['query'][_0x6e84('0xa2')]?_0x1dbd84[_0x6e84('0x3a')][_0x6e84('0xa2')]+':'+_0x1dbd84[_0x6e84('0x3a')]['port']:_0x6e84('0xa3')+_0x1dbd84[_0x6e84('0x3a')][_0x6e84('0xa0')];var _0x23e3b1=_0x1dbd84[_0x6e84('0x3a')]['json']?_0x1dbd84[_0x6e84('0x3a')][_0x6e84('0xa4')]:!![];var _0x2359df=_0x1dbd84[_0x6e84('0x3a')][_0x6e84('0xa5')]?_0x1dbd84[_0x6e84('0x3a')][_0x6e84('0xa5')]:null;var _0x3287c0={'method':_0x1dbd84[_0x6e84('0xa6')],'uri':util[_0x6e84('0x52')](_0x6e84('0xa7'),_0x22833d,_0x1dbd84[_0x6e84('0x3a')][_0x6e84('0x9')]),'json':_0x23e3b1,'resolveWithFullResponse':!![],'encoding':_0x2359df,'body':_0x1dbd84['body']};if(_0x1dbd84[_0x6e84('0xa8')]){_0x3287c0[_0x6e84('0xa8')]=_0x1dbd84['headers'];if(_0x3287c0[_0x6e84('0xa8')][_0x6e84('0xa9')]){delete _0x3287c0[_0x6e84('0xa8')][_0x6e84('0xa9')];}}if(_0x3287c0[_0x6e84('0xa8')][_0x6e84('0xaa')]){delete _0x3287c0['headers'][_0x6e84('0xaa')];}return rp(_0x3287c0);})[_0x6e84('0x2d')](function(_0x43f21d){if(_0x43f21d){_0x36559a[_0x6e84('0x28')](_0x43f21d['headers']);logger[_0x6e84('0x68')](_0x43f21d['body']);return _0x36559a[_0x6e84('0x23')](_0x43f21d[_0x6e84('0xab')])[_0x6e84('0x34')](_0x43f21d[_0x6e84('0x93')]);}else{return _0x36559a[_0x6e84('0x21')](0xc8);}})[_0x6e84('0x4a')](handleError(_0x36559a,null));}; \ No newline at end of file +var _0xc40a=['stack','index','fieldName','type','key','model','name','keys','intersection','query','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','map','VIRTUAL','options','Plugin','findAll','rows','show','rawAttributes','fields','includeAll','include','catch','download','params','root','server/files/plugins','path','zip','warning','code','error','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','join','finalize','close','Plugin\x20not\x20found','format','basename','Error\x20while\x20downloading\x20the\x20plugin','Download\x20completed','info','upload','file','extname','filename','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','readdirSync','Invalid\x20plugin\x20structure','isFile','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','admin','Invalid\x20manifest:\x20no\x20view\x20specified','scriptPath','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','test','plugins','agent','script','create','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','autoAssociation','send','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','update','delete','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','port','encoding','method','headers','content-length','content-type','endsWith','statusCode','%s%s','eml-format','fast-json-patch','moment','bluebird','mustache','sox','to-csv','lodash','crypto','jsforce','querystring','extract-zip','archiver','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','./plugin.socket','register','sendStatus','end','json','undefined','limit','count','offset','status','set','apply','reject','save','then','get','Plugins','UserProfileResource','destroy'];(function(_0x239eaf,_0x1968b4){var _0x8863f7=function(_0x1b34d7){while(--_0x1b34d7){_0x239eaf['push'](_0x239eaf['shift']());}};_0x8863f7(++_0x1968b4);}(_0xc40a,0x78));var _0xac40=function(_0x4ef0c5,_0x18e928){_0x4ef0c5=_0x4ef0c5-0x0;var _0x5127ac=_0xc40a[_0x4ef0c5];return _0x5127ac;};'use strict';var emlformat=require(_0xac40('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xac40('0x1'));var rp=require('request-promise');var moment=require(_0xac40('0x2'));var BPromise=require(_0xac40('0x3'));var Mustache=require(_0xac40('0x4'));var util=require('util');var path=require('path');var sox=require(_0xac40('0x5'));var csv=require(_0xac40('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xac40('0x7'));var squel=require('squel');var crypto=require(_0xac40('0x8'));var jsforce=require(_0xac40('0x9'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xac40('0xa'));var Papa=require('papaparse');var extract=require(_0xac40('0xb'));var rimraf=require('rimraf');var archiver=require(_0xac40('0xc'));var Redis=require(_0xac40('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xac40('0xe'));var as=require(_0xac40('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xac40('0x10'));var utils=require(_0xac40('0x11'));var config=require(_0xac40('0x12'));var licenseUtil=require(_0xac40('0x13'));var db=require(_0xac40('0x14'))['db'];config[_0xac40('0x15')]=_['defaults'](config[_0xac40('0x15')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xac40('0x15')]));require(_0xac40('0x16'))[_0xac40('0x17')](socket);function respondWithStatusCode(_0xdbdcff,_0x1f4692){_0x1f4692=_0x1f4692||0xcc;return function(_0x2982b8){if(_0x2982b8){return _0xdbdcff[_0xac40('0x18')](_0x1f4692);}return _0xdbdcff['status'](_0x1f4692)[_0xac40('0x19')]();};}function respondWithResult(_0x10f6fb,_0x2ed072){_0x2ed072=_0x2ed072||0xc8;return function(_0x5cf607){if(_0x5cf607){return _0x10f6fb['status'](_0x2ed072)[_0xac40('0x1a')](_0x5cf607);}};}function respondWithFilteredResult(_0x1e0268,_0x1f7905){return function(_0x3d69ab){if(_0x3d69ab){var _0x151957=typeof _0x1f7905['offset']===_0xac40('0x1b')&&typeof _0x1f7905[_0xac40('0x1c')]===_0xac40('0x1b');var _0x134901=_0x3d69ab[_0xac40('0x1d')];var _0x1b6993=_0x151957?0x0:_0x1f7905[_0xac40('0x1e')];var _0x523010=_0x151957?_0x3d69ab[_0xac40('0x1d')]:_0x1f7905[_0xac40('0x1e')]+_0x1f7905['limit'];var _0x5e5cfc;if(_0x523010>=_0x134901){_0x523010=_0x134901;_0x5e5cfc=0xc8;}else{_0x5e5cfc=0xce;}_0x1e0268[_0xac40('0x1f')](_0x5e5cfc);return _0x1e0268[_0xac40('0x20')]('Content-Range',_0x1b6993+'-'+_0x523010+'/'+_0x134901)[_0xac40('0x1a')](_0x3d69ab);}return null;};}function patchUpdates(_0x350375){return function(_0x4ec486){try{jsonpatch[_0xac40('0x21')](_0x4ec486,_0x350375,!![]);}catch(_0x5d4b8a){return BPromise[_0xac40('0x22')](_0x5d4b8a);}return _0x4ec486[_0xac40('0x23')]();};}function saveUpdates(_0x5385c5,_0x408138){return function(_0x59f756){if(_0x59f756){return _0x59f756['update'](_0x5385c5)['then'](function(_0xadaac){return _0xadaac;});}return null;};}function removeEntity(_0xae01bb,_0x388fa8){return function(_0x538434){if(_0x538434){return _0x538434['destroy']()[_0xac40('0x24')](function(){var _0x2c836c=_0x538434[_0xac40('0x25')]({'plain':!![]});var _0x32d108=_0xac40('0x26');return db[_0xac40('0x27')][_0xac40('0x28')]({'where':{'type':_0x32d108,'resourceId':_0x2c836c['id']}})['then'](function(){return _0x538434;});})[_0xac40('0x24')](function(){_0xae01bb[_0xac40('0x1f')](0xcc)[_0xac40('0x19')]();});}};}function handleEntityNotFound(_0x2b03db,_0x51f1dc){return function(_0x4920e8){if(!_0x4920e8){_0x2b03db[_0xac40('0x18')](0x194);}return _0x4920e8;};}function handleError(_0x3aeaac,_0x286f27){_0x286f27=_0x286f27||0x1f4;return function(_0x375899){logger['error'](_0x375899[_0xac40('0x29')]);if(_0x375899['name']){delete _0x375899['name'];}_0x3aeaac[_0xac40('0x1f')](_0x286f27)['send'](_0x375899);};}exports[_0xac40('0x2a')]=function(_0x24c8d5,_0x51b792){var _0x2e5fdc={},_0x12f6d3={},_0x548896={'count':0x0,'rows':[]};var _0x3a1488=_['map'](db['Plugin']['rawAttributes'],function(_0x43ac56){return{'name':_0x43ac56[_0xac40('0x2b')],'type':_0x43ac56[_0xac40('0x2c')][_0xac40('0x2d')]};});_0x12f6d3[_0xac40('0x2e')]=_['map'](_0x3a1488,_0xac40('0x2f'));_0x12f6d3['query']=_[_0xac40('0x30')](_0x24c8d5['query']);_0x12f6d3['filters']=_[_0xac40('0x31')](_0x12f6d3['model'],_0x12f6d3[_0xac40('0x32')]);_0x2e5fdc[_0xac40('0x33')]=_[_0xac40('0x31')](_0x12f6d3[_0xac40('0x2e')],qs['fields'](_0x24c8d5[_0xac40('0x32')]['fields']));_0x2e5fdc[_0xac40('0x33')]=_0x2e5fdc[_0xac40('0x33')][_0xac40('0x34')]?_0x2e5fdc[_0xac40('0x33')]:_0x12f6d3[_0xac40('0x2e')];if(!_0x24c8d5[_0xac40('0x32')][_0xac40('0x35')](_0xac40('0x36'))){_0x2e5fdc[_0xac40('0x1c')]=qs[_0xac40('0x1c')](_0x24c8d5['query'][_0xac40('0x1c')]);_0x2e5fdc[_0xac40('0x1e')]=qs[_0xac40('0x1e')](_0x24c8d5[_0xac40('0x32')][_0xac40('0x1e')]);}_0x2e5fdc[_0xac40('0x37')]=qs[_0xac40('0x38')](_0x24c8d5[_0xac40('0x32')]['sort']);_0x2e5fdc[_0xac40('0x39')]=qs['filters'](_[_0xac40('0x3a')](_0x24c8d5[_0xac40('0x32')],_0x12f6d3[_0xac40('0x3b')]),_0x3a1488);if(_0x24c8d5['query'][_0xac40('0x3c')]){_0x2e5fdc[_0xac40('0x39')]=_[_0xac40('0x3d')](_0x2e5fdc[_0xac40('0x39')],{'$or':_[_0xac40('0x3e')](_0x3a1488,function(_0x3abea8){if(_0x3abea8[_0xac40('0x2c')]!==_0xac40('0x3f')){var _0x3a1081={};_0x3a1081[_0x3abea8['name']]={'$like':'%'+_0x24c8d5[_0xac40('0x32')][_0xac40('0x3c')]+'%'};return _0x3a1081;}})});}_0x2e5fdc=_['merge']({},_0x2e5fdc,_0x24c8d5[_0xac40('0x40')]);var _0x247175={'where':_0x2e5fdc[_0xac40('0x39')]};return db['Plugin'][_0xac40('0x1d')](_0x247175)[_0xac40('0x24')](function(_0x348f3c){_0x548896[_0xac40('0x1d')]=_0x348f3c;if(_0x24c8d5[_0xac40('0x32')]['includeAll']){_0x2e5fdc['include']=[{'all':!![]}];}return db[_0xac40('0x41')][_0xac40('0x42')](_0x2e5fdc);})[_0xac40('0x24')](function(_0x11b6f5){_0x548896[_0xac40('0x43')]=_0x11b6f5;return _0x548896;})[_0xac40('0x24')](respondWithFilteredResult(_0x51b792,_0x2e5fdc))['catch'](handleError(_0x51b792,null));};exports[_0xac40('0x44')]=function(_0x502d2e,_0x3ad61d){var _0x433bdf={'raw':!![],'where':{'id':_0x502d2e['params']['id']}},_0xb4f49c={};_0xb4f49c[_0xac40('0x2e')]=_[_0xac40('0x30')](db['Plugin'][_0xac40('0x45')]);_0xb4f49c['query']=_[_0xac40('0x30')](_0x502d2e[_0xac40('0x32')]);_0xb4f49c[_0xac40('0x3b')]=_[_0xac40('0x31')](_0xb4f49c['model'],_0xb4f49c[_0xac40('0x32')]);_0x433bdf[_0xac40('0x33')]=_['intersection'](_0xb4f49c['model'],qs[_0xac40('0x46')](_0x502d2e[_0xac40('0x32')]['fields']));_0x433bdf[_0xac40('0x33')]=_0x433bdf[_0xac40('0x33')][_0xac40('0x34')]?_0x433bdf[_0xac40('0x33')]:_0xb4f49c[_0xac40('0x2e')];if(_0x502d2e[_0xac40('0x32')][_0xac40('0x47')]){_0x433bdf[_0xac40('0x48')]=[{'all':!![]}];}_0x433bdf=_[_0xac40('0x3d')]({},_0x433bdf,_0x502d2e[_0xac40('0x40')]);return db['Plugin']['find'](_0x433bdf)[_0xac40('0x24')](handleEntityNotFound(_0x3ad61d,null))['then'](respondWithResult(_0x3ad61d,null))[_0xac40('0x49')](handleError(_0x3ad61d,null));};exports[_0xac40('0x4a')]=function(_0x18fc3d,_0x1618ec,_0x5ea4e0){return db[_0xac40('0x41')]['find']({'where':{'id':_0x18fc3d[_0xac40('0x4b')]['id']},'attributes':[_0xac40('0x2f'),'path'],'raw':!![]})[_0xac40('0x24')](handleEntityNotFound(_0x1618ec,null))[_0xac40('0x24')](function(_0xf716a1){if(_0xf716a1){var _0x3a299d=path['join'](config[_0xac40('0x4c')],_0xac40('0x4d'),util['format']('%s.zip',path['basename'](_0xf716a1[_0xac40('0x4e')])));var _0x3bfa02=fs['createWriteStream'](_0x3a299d);var _0x401579=archiver(_0xac40('0x4f'),{'zlib':{'level':0x9}});_0x401579['on'](_0xac40('0x50'),function(_0x1b17cd){if(_0x1b17cd[_0xac40('0x51')]==='ENOENT'){logger[_0xac40('0x52')](_0x1b17cd);}else{throw new db[(_0xac40('0x53'))][(_0xac40('0x54'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0x401579['on'](_0xac40('0x52'),function(_0x15d719){throw new db['Sequelize'][(_0xac40('0x54'))](_0xac40('0x55'));});_0x401579[_0xac40('0x56')](_0x3bfa02);_0x401579[_0xac40('0x57')](_0xac40('0x58'),{'cwd':path[_0xac40('0x59')](config[_0xac40('0x4c')],_0xac40('0x4d'),path['dirname'](_0xf716a1[_0xac40('0x4e')])),'ignore':[path['join'](path['basename'](_0xf716a1[_0xac40('0x4e')]),'node_modules/**/*'),path[_0xac40('0x59')](path['basename'](_0xf716a1[_0xac40('0x4e')]),'attachments/**/*')],'nodir':!![]})[_0xac40('0x5a')]();_0x3bfa02['on'](_0xac40('0x5b'),function(){if(!fs['existsSync'](_0x3a299d)){throw new db[(_0xac40('0x53'))][(_0xac40('0x54'))](_0xac40('0x5c'));}return _0x1618ec[_0xac40('0x4a')](_0x3a299d,util[_0xac40('0x5d')]('%s.zip',path[_0xac40('0x5e')](_0xf716a1['path'])),function(_0x500b23){if(_0x500b23){throw new db[(_0xac40('0x53'))][(_0xac40('0x54'))](_0xac40('0x5f'));}fs['unlinkSync'](_0x3a299d);logger['info'](_0xac40('0x60'));logger[_0xac40('0x61')]('Temporary\x20file\x20removed');});});}return null;})[_0xac40('0x49')](handleError(_0x1618ec,null));};exports[_0xac40('0x62')]=function(_0xb18ad6,_0x4cc1f6,_0x117b5d){var _0x4cf742=path[_0xac40('0x5e')](_0xb18ad6[_0xac40('0x63')]['filename'],path[_0xac40('0x64')](_0xb18ad6[_0xac40('0x63')][_0xac40('0x65')]));var _0x5bb37b=path[_0xac40('0x59')](config[_0xac40('0x4c')],'server/files/plugins',_0xb18ad6[_0xac40('0x63')][_0xac40('0x65')]);var _0x590fc7=path['join'](config[_0xac40('0x4c')],_0xac40('0x4d'),_0x4cf742);logger[_0xac40('0x61')](_0xac40('0x66'),_0x5bb37b);logger[_0xac40('0x61')](_0xac40('0x67'),_0x590fc7);try{fs[_0xac40('0x68')](_0x5bb37b,parseInt('0777',0x8));extract(_0x5bb37b,{'dir':_0x590fc7},function(_0x43844e){if(_0x43844e){logger['error'](_0x43844e);handleError(_0x43844e,!![]);};var _0x4e408d=fs[_0xac40('0x69')](_0x590fc7);if(_0x4e408d[_0xac40('0x34')]>0x1){removeReferences(_0x5bb37b,_0x590fc7);logger[_0xac40('0x52')](_0xac40('0x6a'));return _0x117b5d(new Error(_0xac40('0x6a')));}var _0x2f1977=fs['lstatSync'](path[_0xac40('0x59')](_0x590fc7,_0x4e408d[0x0]));if(_0x2f1977[_0xac40('0x6b')]()){removeReferences(_0x5bb37b,_0x590fc7);logger[_0xac40('0x52')](_0xac40('0x6a'));return _0x117b5d(new Error('Invalid\x20plugin\x20structure'));}if(_0x2f1977[_0xac40('0x6c')]()){var _0x3b4787=fs[_0xac40('0x69')](path[_0xac40('0x59')](_0x590fc7,_0x4e408d[0x0]));if(_0x3b4787['length']===0x0){removeReferences(_0x5bb37b,_0x590fc7);logger['error'](_0xac40('0x6a'));return _0x117b5d(new Error(_0xac40('0x6a')));}var _0x5adb9b=_0x3b4787[_0xac40('0x6d')](function(_0x267475){return _0x267475===_0xac40('0x6e');});if(!_0x5adb9b){return _0x117b5d(new Error(_0xac40('0x6f')));}var _0x3ad176=fs[_0xac40('0x70')](path[_0xac40('0x59')](_0x590fc7,_0x4e408d[0x0],_0xac40('0x6e')));var _0x4ac557=JSON[_0xac40('0x71')](_0x3ad176);if('undefined'==typeof _0x4ac557[_0xac40('0x2f')]){return _0x117b5d(new Error(_0xac40('0x72')));}if(_0xac40('0x1b')==typeof _0x4ac557[_0xac40('0x2c')]){return _0x117b5d(new Error(_0xac40('0x73')));}if(_0xac40('0x1b')==typeof _0x4ac557['version']){return _0x117b5d(new Error(_0xac40('0x74')));}if(_0xac40('0x1b')==typeof _0x4ac557[_0xac40('0x75')]){return _0x117b5d(new Error(_0xac40('0x76')));}if(_0x4ac557[_0xac40('0x2c')]===_0xac40('0x77')){if(_0xac40('0x1b')==typeof _0x4ac557[_0xac40('0x75')][_0xac40('0x78')]){return _0x117b5d(new Error(_0xac40('0x79')));}if('undefined'==typeof _0x4ac557['parameters'][_0xac40('0x78')][_0xac40('0x7a')]&&'undefined'==typeof _0x4ac557['parameters'][_0xac40('0x78')]['agent']){return _0x117b5d(new Error(_0xac40('0x7b')));}}else if(_0x4ac557[_0xac40('0x2c')]==='script'){if(_0xac40('0x1b')==typeof _0x4ac557['parameters']['scriptName']){return _0x117b5d(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if(_0xac40('0x1b')==typeof _0x4ac557['parameters'][_0xac40('0x7c')]){return _0x117b5d(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0x117b5d(new Error(_0xac40('0x7d')));}var _0x51281e=_0x4ac557[_0xac40('0x2f')];var _0xec4d0e=_0x4ac557[_0xac40('0x7e')];var _0xfd5092=_0x4ac557[_0xac40('0x2c')];var _0x28ca16=_0x4ac557[_0xac40('0x7f')]?_0x4ac557[_0xac40('0x7f')]:_0xac40('0x80');var _0x4ced7f=_0x4ac557[_0xac40('0x81')]?_0x4ac557[_0xac40('0x81')]:'icon-apps';var _0x5f1f84='';var _0x10a463='';var _0x54f3b7='';var _0x78e62c='';var _0x331295=_0x4ac557['version'];if(_0xfd5092==='html'){if(_0xac40('0x1b')!=typeof _0x4ac557[_0xac40('0x75')]['views'][_0xac40('0x7a')]){var _0x4af359=_0x4ac557[_0xac40('0x75')]['views'][_0xac40('0x7a')];if(!/^(f|ht)tps?:\/\//i[_0xac40('0x82')](_0x4af359)){_0x5f1f84=path[_0xac40('0x59')](_0xac40('0x83'),_0x4cf742,_0x4e408d[0x0],_0x4af359);}else{_0x5f1f84=_0x4af359;}}else{logger[_0xac40('0x61')]('Warning:\x20admin\x20view\x20not\x20specified');}if(_0xac40('0x1b')!=typeof _0x4ac557['parameters']['views'][_0xac40('0x84')]){var _0x3507c3=_0x4ac557[_0xac40('0x75')][_0xac40('0x78')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0xac40('0x82')](_0x3507c3)){_0x10a463=path[_0xac40('0x59')](_0xac40('0x83'),_0x4cf742,_0x4e408d[0x0],_0x3507c3);}else{_0x10a463=_0x3507c3;}}else{logger[_0xac40('0x61')]('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0xfd5092===_0xac40('0x85')){_0x54f3b7=_0x4ac557['parameters']['scriptName'];_0x78e62c=_0x4ac557['parameters'][_0xac40('0x7c')];if(_0xac40('0x1b')!=typeof _0x4ac557[_0xac40('0x75')]['views']){if(_0xac40('0x1b')!=typeof _0x4ac557[_0xac40('0x75')][_0xac40('0x78')][_0xac40('0x7a')]){var _0x4af359=_0x4ac557[_0xac40('0x75')][_0xac40('0x78')]['admin'];if(!/^(f|ht)tps?:\/\//i['test'](_0x4af359)){_0x5f1f84=path['join']('plugins',_0x4cf742,_0x4e408d[0x0],_0x4af359);}else{_0x5f1f84=_0x4af359;}}if('undefined'!=typeof _0x4ac557[_0xac40('0x75')][_0xac40('0x78')][_0xac40('0x84')]){var _0x3507c3=_0x4ac557[_0xac40('0x75')][_0xac40('0x78')][_0xac40('0x84')];if(!/^(f|ht)tps?:\/\//i[_0xac40('0x82')](_0x3507c3)){_0x10a463=path['join'](_0xac40('0x83'),_0x4cf742,_0x4e408d[0x0],_0x3507c3);}else{_0x10a463=_0x3507c3;}}}}var _0x38713c={'name':_0x51281e,'description':_0xec4d0e,'path':path['join'](_0x4cf742,_0x4e408d[0x0]),'type':_0xfd5092,'sidebar':_0x28ca16,'icon':_0x4ced7f,'adminUrl':_0x5f1f84,'agentUrl':_0x10a463,'scriptName':_0x54f3b7,'scriptPath':_0x78e62c,'version':_0x331295};removeReferences(_0x5bb37b,null);return db['Plugin'][_0xac40('0x86')](_0x38713c)[_0xac40('0x24')](function(_0x524e62){var _0x168222={'role':_0xb18ad6[_0xac40('0x87')]['role'],'userProfileId':_0xb18ad6['body'][_0xac40('0x88')]};if(!_0x168222)throw new Error(_0xac40('0x89'));if(_0x168222[_0xac40('0x8a')]===_0xac40('0x8b')){var _0x20de4e=_0x524e62[_0xac40('0x25')]({'plain':!![]});return db[_0xac40('0x8c')][_0xac40('0x8d')]({'where':{'name':_0xac40('0x26'),'userProfileId':_0x168222['userProfileId']},'raw':!![]})[_0xac40('0x24')](function(_0x5333e6){if(_0x5333e6&&_0x5333e6[_0xac40('0x8e')]===0x0){return db[_0xac40('0x27')][_0xac40('0x86')]({'name':_0x20de4e[_0xac40('0x2f')],'resourceId':_0x20de4e['id'],'type':_0x5333e6[_0xac40('0x2f')],'sectionId':_0x5333e6['id']},{})['then'](function(){return _0x524e62;});}else{return _0x524e62;}})[_0xac40('0x49')](function(_0x5d2219){logger[_0xac40('0x52')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5d2219);throw _0x5d2219;});}return _0x524e62;})['then'](respondWithResult(_0x4cc1f6,null))[_0xac40('0x49')](handleError(_0x4cc1f6,null));}});}catch(_0x1de77c){_0x4cc1f6[_0xac40('0x1f')](0x1f4)[_0xac40('0x8f')](_0x1de77c);}};function removeReferences(_0x17412c,_0x2d8146){try{if(_0x17412c){fs['unlinkSync'](_0x17412c);logger[_0xac40('0x61')](_0xac40('0x90'));}if(_0x2d8146){rimraf(_0x2d8146,function(){});logger[_0xac40('0x61')](_0xac40('0x91'));}}catch(_0x514963){logger[_0xac40('0x52')](_0x514963);}}exports[_0xac40('0x92')]=function(_0x498bfa,_0x1ccfb5,_0x4019f0){return db['Plugin'][_0xac40('0x8d')]({'where':{'id':_0x498bfa[_0xac40('0x4b')]['id']}})[_0xac40('0x24')](handleEntityNotFound(_0x1ccfb5,null))[_0xac40('0x24')](saveUpdates(_0x498bfa[_0xac40('0x87')],null))['then'](respondWithResult(_0x1ccfb5,null))[_0xac40('0x49')](handleError(_0x1ccfb5,null));};exports[_0xac40('0x93')]=function(_0x6edbac,_0x28988a,_0x390456){return db['Plugin'][_0xac40('0x8d')]({'where':{'id':_0x6edbac[_0xac40('0x4b')]['id']}})[_0xac40('0x24')](function(_0x9fbc4f){if(_0x9fbc4f){return _0x9fbc4f['destroy']();}})['then'](function(_0x15d302){rimraf(path[_0xac40('0x59')](config[_0xac40('0x4c')],'server/files/plugins',path['dirname'](_0x15d302['path'])),function(){});return _0x15d302;})[_0xac40('0x24')](handleEntityNotFound(_0x28988a,null))[_0xac40('0x24')](respondWithStatusCode(_0x28988a,null))[_0xac40('0x49')](handleError(_0x28988a,null));};exports['webhookGet']=function(_0x4376f0,_0x59fcbb,_0x348fdd){return BPromise[_0xac40('0x94')]()[_0xac40('0x24')](function(){if(!_0x4376f0[_0xac40('0x32')][_0xac40('0x4e')]){throw new Error(_0xac40('0x95'));}if(!_0x4376f0[_0xac40('0x32')]['port']){throw new Error(_0xac40('0x96'));}var _0x5c546c=_0x4376f0[_0xac40('0x32')][_0xac40('0x97')]?_0x4376f0[_0xac40('0x32')][_0xac40('0x97')]+':'+_0x4376f0['query'][_0xac40('0x98')]:'http://localhost:'+_0x4376f0[_0xac40('0x32')][_0xac40('0x98')];var _0x52ba77=_0x4376f0[_0xac40('0x32')][_0xac40('0x1a')]?_0x4376f0[_0xac40('0x32')][_0xac40('0x1a')]:!![];var _0x19105d=_0x4376f0['query'][_0xac40('0x99')]?_0x4376f0['query'][_0xac40('0x99')]:null;var _0x36234c={'method':_0x4376f0[_0xac40('0x9a')],'uri':util['format']('%s%s',_0x5c546c,_0x4376f0['query'][_0xac40('0x4e')]),'json':_0x52ba77,'resolveWithFullResponse':!![],'encoding':_0x19105d,'qs':_0x4376f0['query']};if(_0x4376f0[_0xac40('0x9b')]){_0x36234c['headers']=_0x4376f0['headers'];if(_0x36234c['headers'][_0xac40('0x9c')]){delete _0x36234c[_0xac40('0x9b')]['content-length'];}}if(_0x36234c[_0xac40('0x9b')][_0xac40('0x9d')]){delete _0x36234c[_0xac40('0x9b')][_0xac40('0x9d')];}return rp(_0x36234c);})['then'](function(_0xe1c398){if(_0xe1c398){_0x59fcbb[_0xac40('0x20')](_0xe1c398['headers']);logger[_0xac40('0x61')](_0xe1c398[_0xac40('0x87')]);if(_[_0xac40('0x9e')](_0x4376f0[_0xac40('0x32')]['path'],'download')&&_0xe1c398['statusCode']==0x1f4){return _0x59fcbb[_0xac40('0x18')](_0xe1c398[_0xac40('0x9f')]);}else{return _0x59fcbb[_0xac40('0x1f')](_0xe1c398[_0xac40('0x9f')])[_0xac40('0x8f')](_0xe1c398['body']);}}else{return _0x59fcbb[_0xac40('0x18')](0xc8);}})[_0xac40('0x49')](handleError(_0x59fcbb,null));};exports['webhookPost']=function(_0x2bab80,_0x61aaee,_0x1c2e45){return BPromise[_0xac40('0x94')]()[_0xac40('0x24')](function(){if(!_0x2bab80[_0xac40('0x32')][_0xac40('0x4e')]){throw new Error(_0xac40('0x95'));}if(!_0x2bab80[_0xac40('0x32')][_0xac40('0x98')]){throw new Error(_0xac40('0x96'));}var _0x4910ec=_0x2bab80['query'][_0xac40('0x97')]?_0x2bab80[_0xac40('0x32')][_0xac40('0x97')]+':'+_0x2bab80[_0xac40('0x32')][_0xac40('0x98')]:'http://localhost:'+_0x2bab80['query'][_0xac40('0x98')];var _0x52e501=_0x2bab80[_0xac40('0x32')][_0xac40('0x1a')]?_0x2bab80['query'][_0xac40('0x1a')]:!![];var _0x544ebc=_0x2bab80['query'][_0xac40('0x99')]?_0x2bab80['query'][_0xac40('0x99')]:null;var _0x3f6c2d={'method':_0x2bab80[_0xac40('0x9a')],'uri':util[_0xac40('0x5d')](_0xac40('0xa0'),_0x4910ec,_0x2bab80[_0xac40('0x32')][_0xac40('0x4e')]),'json':_0x52e501,'resolveWithFullResponse':!![],'encoding':_0x544ebc,'body':_0x2bab80[_0xac40('0x87')]};if(_0x2bab80[_0xac40('0x9b')]){_0x3f6c2d['headers']=_0x2bab80[_0xac40('0x9b')];if(_0x3f6c2d[_0xac40('0x9b')][_0xac40('0x9c')]){delete _0x3f6c2d[_0xac40('0x9b')][_0xac40('0x9c')];}}if(_0x3f6c2d[_0xac40('0x9b')][_0xac40('0x9d')]){delete _0x3f6c2d[_0xac40('0x9b')][_0xac40('0x9d')];}return rp(_0x3f6c2d);})[_0xac40('0x24')](function(_0x63d0f){if(_0x63d0f){_0x61aaee[_0xac40('0x20')](_0x63d0f['headers']);logger[_0xac40('0x61')](_0x63d0f[_0xac40('0x87')]);return _0x61aaee['status'](_0x63d0f[_0xac40('0x9f')])[_0xac40('0x8f')](_0x63d0f[_0xac40('0x87')]);}else{return _0x61aaee['sendStatus'](0xc8);}})[_0xac40('0x49')](handleError(_0x61aaee,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 66c5af4..a13fd99 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 _0xfcf0=['hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x1989cd,_0x49a8b6){var _0x5355bc=function(_0x194a5b){while(--_0x194a5b){_0x1989cd['push'](_0x1989cd['shift']());}};_0x5355bc(++_0x49a8b6);}(_0xfcf0,0x138));var _0x0fcf=function(_0x1f239e,_0x367b43){_0x1f239e=_0x1f239e-0x0;var _0x826971=_0xfcf0[_0x1f239e];return _0x826971;};'use strict';var EventEmitter=require(_0x0fcf('0x0'));var Plugin=require(_0x0fcf('0x1'))['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents[_0x0fcf('0x2')](0x0);var events={'afterCreate':_0x0fcf('0x3'),'afterUpdate':_0x0fcf('0x4'),'afterDestroy':_0x0fcf('0x5')};function emitEvent(_0x5c865e){return function(_0x2fe6d8,_0x265968,_0x3bd34d){PluginEvents[_0x0fcf('0x6')](_0x5c865e+':'+_0x2fe6d8['id'],_0x2fe6d8);PluginEvents[_0x0fcf('0x6')](_0x5c865e,_0x2fe6d8);_0x3bd34d(null);};}for(var e in events){if(events[_0x0fcf('0x7')](e)){var event=events[e];Plugin[_0x0fcf('0x8')](e,emitEvent(event));}}module[_0x0fcf('0x9')]=PluginEvents; \ No newline at end of file +var _0x9ade=['hook','exports','events','../../mysqldb','Plugin','setMaxListeners','save','update','remove','emit'];(function(_0xb3b7ca,_0x44bce0){var _0x549831=function(_0x1aab2f){while(--_0x1aab2f){_0xb3b7ca['push'](_0xb3b7ca['shift']());}};_0x549831(++_0x44bce0);}(_0x9ade,0x8e));var _0xe9ad=function(_0x15adc6,_0xbc8322){_0x15adc6=_0x15adc6-0x0;var _0x3bb841=_0x9ade[_0x15adc6];return _0x3bb841;};'use strict';var EventEmitter=require(_0xe9ad('0x0'));var Plugin=require(_0xe9ad('0x1'))['db'][_0xe9ad('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0xe9ad('0x3')](0x0);var events={'afterCreate':_0xe9ad('0x4'),'afterUpdate':_0xe9ad('0x5'),'afterDestroy':_0xe9ad('0x6')};function emitEvent(_0x157ca1){return function(_0x468a5b,_0x441278,_0x5ed31d){PluginEvents[_0xe9ad('0x7')](_0x157ca1+':'+_0x468a5b['id'],_0x468a5b);PluginEvents['emit'](_0x157ca1,_0x468a5b);_0x5ed31d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin[_0xe9ad('0x8')](e,emitEvent(event));}}module[_0xe9ad('0x9')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 6cea609..19de405 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 _0x6029=['exports','plugins','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5d6992,_0x5bafe0){var _0x2dc258=function(_0x2c6a46){while(--_0x2c6a46){_0x5d6992['push'](_0x5d6992['shift']());}};_0x2dc258(++_0x5bafe0);}(_0x6029,0x1ba));var _0x9602=function(_0x551aad,_0x167616){_0x551aad=_0x551aad-0x0;var _0x10b5a0=_0x6029[_0x551aad];return _0x10b5a0;};'use strict';var _=require('lodash');var util=require(_0x9602('0x0'));var logger=require('../../config/logger')(_0x9602('0x1'));var moment=require(_0x9602('0x2'));var BPromise=require(_0x9602('0x3'));var rp=require(_0x9602('0x4'));var fs=require('fs');var path=require(_0x9602('0x5'));var rimraf=require(_0x9602('0x6'));var config=require(_0x9602('0x7'));var attributes=require('./plugin.attributes');module[_0x9602('0x8')]=function(_0x42cb3f,_0xe006d0){return _0x42cb3f['define']('Plugin',attributes,{'tableName':_0x9602('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb0bc=['request-promise','rimraf','exports','define','Plugin','plugins','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x458117,_0x4f91d8){var _0x52f041=function(_0x5d68d1){while(--_0x5d68d1){_0x458117['push'](_0x458117['shift']());}};_0x52f041(++_0x4f91d8);}(_0xb0bc,0x156));var _0xcb0b=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xb0bc[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0xcb0b('0x0'));var util=require(_0xcb0b('0x1'));var logger=require(_0xcb0b('0x2'))(_0xcb0b('0x3'));var moment=require(_0xcb0b('0x4'));var BPromise=require(_0xcb0b('0x5'));var rp=require(_0xcb0b('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcb0b('0x7'));var config=require('../../config/environment');var attributes=require('./plugin.attributes');module[_0xcb0b('0x8')]=function(_0x342a11,_0x47d314){return _0x342a11[_0xcb0b('0x9')](_0xcb0b('0xa'),attributes,{'tableName':_0xcb0b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.rpc.js b/server/api/plugin/plugin.rpc.js index 056bd15..6505a63 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 _0xd5f5=['./plugin.socket','request','then','info','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','Plugin,\x20%s,\x20%s','message','catch','Plugin','create','body','options','raw','CreatePlugin','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','redis','localhost','socket.io-emitter'];(function(_0x3d6294,_0x5ead37){var _0x3f32be=function(_0x1413d5){while(--_0x1413d5){_0x3d6294['push'](_0x3d6294['shift']());}};_0x3f32be(++_0x5ead37);}(_0xd5f5,0xcc));var _0x5d5f=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xd5f5[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x5d5f('0x0'));var util=require(_0x5d5f('0x1'));var moment=require('moment');var BPromise=require(_0x5d5f('0x2'));var rs=require(_0x5d5f('0x3'));var fs=require('fs');var Redis=require(_0x5d5f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5d5f('0x5'));var logger=require(_0x5d5f('0x6'))(_0x5d5f('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5d5f('0x8')][_0x5d5f('0x9')]({'port':0x232a});config[_0x5d5f('0xa')]=_['defaults'](config[_0x5d5f('0xa')],{'host':_0x5d5f('0xb'),'port':0x18eb});var socket=require(_0x5d5f('0xc'))(new Redis(config[_0x5d5f('0xa')]));require(_0x5d5f('0xd'))['register'](socket);function respondWithRpcPromise(_0x3c17e1,_0x5e23c2,_0x553d1b){return new BPromise(function(_0x45b676,_0xc9e2ea){return client[_0x5d5f('0xe')](_0x3c17e1,_0x553d1b)[_0x5d5f('0xf')](function(_0x33430a){logger[_0x5d5f('0x10')]('Plugin,\x20%s,\x20%s',_0x5e23c2,_0x5d5f('0x11'));logger[_0x5d5f('0x12')](_0x5d5f('0x13'),_0x5e23c2,'request\x20sent',JSON[_0x5d5f('0x14')](_0x33430a));if(_0x33430a[_0x5d5f('0x15')]){if(_0x33430a[_0x5d5f('0x15')]['code']===0x1f4){logger[_0x5d5f('0x15')](_0x5d5f('0x16'),_0x5e23c2,_0x33430a['error'][_0x5d5f('0x17')]);return _0xc9e2ea(_0x33430a[_0x5d5f('0x15')]['message']);}logger[_0x5d5f('0x15')]('Plugin,\x20%s,\x20%s',_0x5e23c2,_0x33430a[_0x5d5f('0x15')][_0x5d5f('0x17')]);return _0x45b676(_0x33430a[_0x5d5f('0x15')][_0x5d5f('0x17')]);}else{logger['info'](_0x5d5f('0x16'),_0x5e23c2,_0x5d5f('0x11'));_0x45b676(_0x33430a['result']['message']);}})[_0x5d5f('0x18')](function(_0x3da606){logger[_0x5d5f('0x15')](_0x5d5f('0x16'),_0x5e23c2,_0x3da606);_0xc9e2ea(_0x3da606);});});}exports['CreatePlugin']=function(_0x250ed1){var _0x10f587=this;return new Promise(function(_0x311d08,_0x254808){return db[_0x5d5f('0x19')][_0x5d5f('0x1a')](_0x250ed1[_0x5d5f('0x1b')],{'raw':_0x250ed1[_0x5d5f('0x1c')]?_0x250ed1[_0x5d5f('0x1c')][_0x5d5f('0x1d')]===undefined?!![]:![]:!![]})[_0x5d5f('0xf')](function(_0x392ce4){logger[_0x5d5f('0x10')]('CreatePlugin',_0x250ed1);logger[_0x5d5f('0x12')](_0x5d5f('0x1e'),_0x250ed1,JSON['stringify'](_0x392ce4));_0x311d08(_0x392ce4);})['catch'](function(_0x697467){logger[_0x5d5f('0x15')](_0x5d5f('0x1e'),_0x697467[_0x5d5f('0x17')],_0x250ed1);_0x254808(_0x10f587[_0x5d5f('0x15')](0x1f4,_0x697467[_0x5d5f('0x17')]));});});}; \ No newline at end of file +var _0x0187=['message','CreatePlugin','Plugin','create','body','options','raw','stringify','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','http','redis','defaults','localhost','./plugin.socket','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0x0187,0x158));var _0x7018=function(_0x2dc343,_0xf015a2){_0x2dc343=_0x2dc343-0x0;var _0x51eac5=_0x0187[_0x2dc343];return _0x51eac5;};'use strict';var _=require(_0x7018('0x0'));var util=require(_0x7018('0x1'));var moment=require(_0x7018('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7018('0x3'))['db'];var utils=require(_0x7018('0x4'));var logger=require(_0x7018('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x7018('0x6')]({'port':0x232a});config[_0x7018('0x7')]=_[_0x7018('0x8')](config[_0x7018('0x7')],{'host':_0x7018('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7018('0x7')]));require(_0x7018('0xa'))['register'](socket);function respondWithRpcPromise(_0x1f9533,_0x35ff33,_0x26b3b6){return new BPromise(function(_0x42f6e0,_0xf8b506){return client[_0x7018('0xb')](_0x1f9533,_0x26b3b6)[_0x7018('0xc')](function(_0x100041){logger[_0x7018('0xd')](_0x7018('0xe'),_0x35ff33,_0x7018('0xf'));logger[_0x7018('0x10')](_0x7018('0x11'),_0x35ff33,_0x7018('0xf'),JSON['stringify'](_0x100041));if(_0x100041[_0x7018('0x12')]){if(_0x100041['error'][_0x7018('0x13')]===0x1f4){logger[_0x7018('0x12')](_0x7018('0xe'),_0x35ff33,_0x100041[_0x7018('0x12')][_0x7018('0x14')]);return _0xf8b506(_0x100041[_0x7018('0x12')][_0x7018('0x14')]);}logger['error'](_0x7018('0xe'),_0x35ff33,_0x100041[_0x7018('0x12')][_0x7018('0x14')]);return _0x42f6e0(_0x100041[_0x7018('0x12')]['message']);}else{logger[_0x7018('0xd')](_0x7018('0xe'),_0x35ff33,_0x7018('0xf'));_0x42f6e0(_0x100041['result'][_0x7018('0x14')]);}})['catch'](function(_0x5843f1){logger[_0x7018('0x12')]('Plugin,\x20%s,\x20%s',_0x35ff33,_0x5843f1);_0xf8b506(_0x5843f1);});});}exports[_0x7018('0x15')]=function(_0x45b118){var _0x258b28=this;return new Promise(function(_0x1edc59,_0x3699bd){return db[_0x7018('0x16')][_0x7018('0x17')](_0x45b118[_0x7018('0x18')],{'raw':_0x45b118['options']?_0x45b118[_0x7018('0x19')][_0x7018('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x16dd7c){logger[_0x7018('0xd')]('CreatePlugin',_0x45b118);logger[_0x7018('0x10')](_0x7018('0x15'),_0x45b118,JSON[_0x7018('0x1b')](_0x16dd7c));_0x1edc59(_0x16dd7c);})['catch'](function(_0x420037){logger[_0x7018('0x12')]('CreatePlugin',_0x420037['message'],_0x45b118);_0x3699bd(_0x258b28[_0x7018('0x12')](0x1f4,_0x420037[_0x7018('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index fac4fb2..9062cf6 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 _0x70d8=['./plugin.events','remove','update','emit','removeListener','length'];(function(_0x10a301,_0x2f55ab){var _0x5689a5=function(_0x548e11){while(--_0x548e11){_0x10a301['push'](_0x10a301['shift']());}};_0x5689a5(++_0x2f55ab);}(_0x70d8,0x156));var _0x870d=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x70d8[_0x413feb];return _0x40ee88;};'use strict';var PluginEvents=require(_0x870d('0x0'));var events=['save',_0x870d('0x1'),_0x870d('0x2')];function createListener(_0x44eb5a,_0x696adf){return function(_0x4c0d06){_0x696adf[_0x870d('0x3')](_0x44eb5a,_0x4c0d06);};}function removeListener(_0x4eb630,_0x5c2a36){return function(){PluginEvents[_0x870d('0x4')](_0x4eb630,_0x5c2a36);};}exports['register']=function(_0x31ce9d){for(var _0x281da4=0x0,_0x12501e=events[_0x870d('0x5')];_0x281da4<_0x12501e;_0x281da4++){var _0x3a9d8c=events[_0x281da4];var _0xe7c76e=createListener('plugin:'+_0x3a9d8c,_0x31ce9d);PluginEvents['on'](_0x3a9d8c,_0xe7c76e);}}; \ No newline at end of file +var _0x94c5=['length','plugin:','./plugin.events','save','remove','update','removeListener','register'];(function(_0x313ba7,_0x4567e4){var _0x1ce46e=function(_0x58fb2c){while(--_0x58fb2c){_0x313ba7['push'](_0x313ba7['shift']());}};_0x1ce46e(++_0x4567e4);}(_0x94c5,0x1a2));var _0x594c=function(_0x78ac8e,_0x34f635){_0x78ac8e=_0x78ac8e-0x0;var _0x242d93=_0x94c5[_0x78ac8e];return _0x242d93;};'use strict';var PluginEvents=require(_0x594c('0x0'));var events=[_0x594c('0x1'),_0x594c('0x2'),_0x594c('0x3')];function createListener(_0x5a4f23,_0x208b68){return function(_0x2e555d){_0x208b68['emit'](_0x5a4f23,_0x2e555d);};}function removeListener(_0x1fef23,_0x5ef12d){return function(){PluginEvents[_0x594c('0x4')](_0x1fef23,_0x5ef12d);};}exports[_0x594c('0x5')]=function(_0x32c944){for(var _0x4bee1b=0x0,_0x421aaf=events[_0x594c('0x6')];_0x4bee1b<_0x421aaf;_0x4bee1b++){var _0xbb23d9=events[_0x4bee1b];var _0xaf6702=createListener(_0x594c('0x7')+_0xbb23d9,_0x32c944);PluginEvents['on'](_0xbb23d9,_0xaf6702);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index de66b8f..ba6a3ac 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(_0x365c91,_0xc944b4){var _0x4231ab=function(_0x5a6be2){while(--_0x5a6be2){_0x365c91['push'](_0x365c91['shift']());}};_0x4231ab(++_0xc944b4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'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(_0xab30c0,_0x24e7f0){var _0x116d70=function(_0x5802b0){while(--_0x5802b0){_0xab30c0['push'](_0xab30c0['shift']());}};_0x116d70(++_0x24e7f0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'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 de031bf..f9e9096 100644 --- a/server/api/pm2/pm2.controller.js +++ b/server/api/pm2/pm2.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdace=['path','exec','bluebird','sendStatus','status','json','error','stack','send','npm\x20install','info','index','list','then','reject','name','express','length','catch','show','create','body','script','join','../../files/plugins','chdir','dirname','start','dump','Missing\x20name\x20and/or\x20path','update','restart','stop','params','Unknown\x20status','destroy','Unknown\x20id','lodash','../../config/logger','api'];(function(_0x931f91,_0x10f162){var _0x20e3ff=function(_0x5f2d18){while(--_0x5f2d18){_0x931f91['push'](_0x931f91['shift']());}};_0x20e3ff(++_0x10f162);}(_0xdace,0xc5));var _0xedac=function(_0x12b8ec,_0x1655be){_0x12b8ec=_0x12b8ec-0x0;var _0x21af77=_0xdace[_0x12b8ec];return _0x21af77;};'use strict';var _=require(_0xedac('0x0'));var pm2=require('../../config/pm2');var logger=require(_0xedac('0x1'))(_0xedac('0x2'));var path=require(_0xedac('0x3'));var exec=require('child_process')[_0xedac('0x4')];var BPromise=require(_0xedac('0x5'));function handleEntityNotFound(_0x15d3bd,_0xefb142){return function(_0x5a97c0){if(!_0x5a97c0){_0x15d3bd[_0xedac('0x6')](0x194);;}return _0x5a97c0;};}function respondWithResult(_0x1cba89,_0x39328a){_0x39328a=_0x39328a||0xc8;return function(_0x5ecbd3){if(_0x5ecbd3){return _0x1cba89[_0xedac('0x7')](_0x39328a)[_0xedac('0x8')](_0x5ecbd3);}return null;};}function handleError(_0x162eea,_0x53fa43){_0x53fa43=_0x53fa43||0x1f4;return function(_0x27243f){logger[_0xedac('0x9')](_0x27243f[_0xedac('0xa')]);if(_0x27243f['name']){delete _0x27243f['name'];}_0x162eea[_0xedac('0x7')](_0x53fa43)[_0xedac('0xb')](_0x27243f);};}function execChildProcess(){return new BPromise(function(_0x57e1bf,_0x4d6a29){exec(_0xedac('0xc'),function(_0x25395d,_0x57f637,_0x261401){logger['info'](_0x57f637);logger[_0xedac('0xd')](_0x261401);if(_0x25395d){logger[_0xedac('0x9')](_0x25395d);return _0x4d6a29(_0x25395d);}return _0x57e1bf(_0x57f637);});});}exports[_0xedac('0xe')]=function(_0x342186,_0x9a79a0){return pm2[_0xedac('0xf')]()[_0xedac('0x10')](function(_0x11f0b0){if(_0x11f0b0){var _0x593030=_[_0xedac('0x11')](_0x11f0b0,function(_0x4651d4){return _0x4651d4[_0xedac('0x12')]===_0xedac('0x13')||_0x4651d4[_0xedac('0x12')]==='motion2';});return{'rows':_0x593030,'count':_0x593030[_0xedac('0x14')]};}return null;})['then'](respondWithResult(_0x9a79a0,null))[_0xedac('0x15')](handleError(_0x9a79a0,null));};exports[_0xedac('0x16')]=function(_0xdad128,_0xba0c93){return pm2['describe'](_0xdad128['params']['id'])[_0xedac('0x10')](respondWithResult(_0xba0c93,null))[_0xedac('0x10')](handleEntityNotFound(_0xba0c93,null))[_0xedac('0x15')](handleError(_0xba0c93,null));};exports[_0xedac('0x17')]=function(_0x5a5438,_0x4a699b){if(_0x5a5438[_0xedac('0x18')][_0xedac('0x12')]&&_0x5a5438[_0xedac('0x18')][_0xedac('0x19')]){var _0x2f5eee=path[_0xedac('0x1a')](__dirname,_0xedac('0x1b'),_0x5a5438[_0xedac('0x18')]['script']);var _0x4593e8=process['cwd']();process[_0xedac('0x1c')](path[_0xedac('0x1d')](_0x2f5eee));return execChildProcess()['then'](function(_0x46e09d){process[_0xedac('0x1c')](_0x4593e8);return pm2[_0xedac('0x1e')]({'name':_0x5a5438[_0xedac('0x18')][_0xedac('0x12')],'script':_0x2f5eee});})[_0xedac('0x10')](function(_0x5d7c31){pm2[_0xedac('0x1f')]();return _0x5d7c31[0x0];})[_0xedac('0x10')](respondWithResult(_0x4a699b,0xc9))[_0xedac('0x15')](handleError(_0x4a699b,null));}else{return _0x4a699b[_0xedac('0x7')](0x1f4)[_0xedac('0xb')]({'message':_0xedac('0x20')});}};exports[_0xedac('0x21')]=function(_0x26c6f7,_0x409825){if(_0x26c6f7[_0xedac('0x18')]['id']){delete _0x26c6f7['body']['id'];}var _0x25d7f5={'online':_0xedac('0x22'),'stopped':_0xedac('0x23')};if(_0x25d7f5['hasOwnProperty'](_0x26c6f7[_0xedac('0x18')]['status'])){return pm2[_0x25d7f5[_0x26c6f7['body'][_0xedac('0x7')]]](_0x26c6f7[_0xedac('0x24')]['id'])[_0xedac('0x10')](respondWithResult(_0x409825,0xc8))[_0xedac('0x15')](handleError(_0x409825,null));}else{return _0x409825['status'](0x1f4)['send']({'message':_0xedac('0x25')});}};exports[_0xedac('0x26')]=function(_0x24b182,_0x2ee8d7){if(_0x24b182[_0xedac('0x18')]['id']){delete _0x24b182[_0xedac('0x18')]['id'];}if(_0x24b182[_0xedac('0x24')]['id']){return pm2['delete'](_0x24b182[_0xedac('0x24')]['id'])[_0xedac('0x10')](function(_0x2cbe33){pm2['dump']();return _0x2cbe33[0x0];})[_0xedac('0x10')](respondWithResult(_0x2ee8d7,null))[_0xedac('0x15')](handleError(_0x2ee8d7,null));}else{return _0x2ee8d7['status'](0x1f4)[_0xedac('0xb')]({'message':_0xedac('0x27')});}}; \ No newline at end of file +var _0x2750=['exec','bluebird','sendStatus','status','json','error','name','send','npm\x20install','info','list','then','motion2','catch','body','script','../../files/plugins','cwd','dirname','chdir','dump','Missing\x20name\x20and/or\x20path','stop','hasOwnProperty','params','Unknown\x20status','destroy','lodash','../../config/logger','api','path','child_process'];(function(_0x5a0a7f,_0x78623c){var _0x3c6c79=function(_0x692239){while(--_0x692239){_0x5a0a7f['push'](_0x5a0a7f['shift']());}};_0x3c6c79(++_0x78623c);}(_0x2750,0x13b));var _0x0275=function(_0x92ae55,_0x5321ac){_0x92ae55=_0x92ae55-0x0;var _0xb008b8=_0x2750[_0x92ae55];return _0xb008b8;};'use strict';var _=require(_0x0275('0x0'));var pm2=require('../../config/pm2');var logger=require(_0x0275('0x1'))(_0x0275('0x2'));var path=require(_0x0275('0x3'));var exec=require(_0x0275('0x4'))[_0x0275('0x5')];var BPromise=require(_0x0275('0x6'));function handleEntityNotFound(_0x20273d,_0x4960){return function(_0x3d0c9c){if(!_0x3d0c9c){_0x20273d[_0x0275('0x7')](0x194);;}return _0x3d0c9c;};}function respondWithResult(_0x5953f9,_0x3f645f){_0x3f645f=_0x3f645f||0xc8;return function(_0x2421fd){if(_0x2421fd){return _0x5953f9[_0x0275('0x8')](_0x3f645f)[_0x0275('0x9')](_0x2421fd);}return null;};}function handleError(_0x4dffd1,_0x1f7c4a){_0x1f7c4a=_0x1f7c4a||0x1f4;return function(_0x30632d){logger[_0x0275('0xa')](_0x30632d['stack']);if(_0x30632d['name']){delete _0x30632d[_0x0275('0xb')];}_0x4dffd1['status'](_0x1f7c4a)[_0x0275('0xc')](_0x30632d);};}function execChildProcess(){return new BPromise(function(_0x377087,_0x14f68c){exec(_0x0275('0xd'),function(_0x14bc3e,_0x5ae208,_0x2e8723){logger[_0x0275('0xe')](_0x5ae208);logger[_0x0275('0xe')](_0x2e8723);if(_0x14bc3e){logger['error'](_0x14bc3e);return _0x14f68c(_0x14bc3e);}return _0x377087(_0x5ae208);});});}exports['index']=function(_0x292f93,_0x395398){return pm2[_0x0275('0xf')]()[_0x0275('0x10')](function(_0x28827b){if(_0x28827b){var _0x36921c=_['reject'](_0x28827b,function(_0x3e0791){return _0x3e0791[_0x0275('0xb')]==='express'||_0x3e0791[_0x0275('0xb')]===_0x0275('0x11');});return{'rows':_0x36921c,'count':_0x36921c['length']};}return null;})[_0x0275('0x10')](respondWithResult(_0x395398,null))[_0x0275('0x12')](handleError(_0x395398,null));};exports['show']=function(_0x5e7466,_0x56e719){return pm2['describe'](_0x5e7466['params']['id'])[_0x0275('0x10')](respondWithResult(_0x56e719,null))[_0x0275('0x10')](handleEntityNotFound(_0x56e719,null))[_0x0275('0x12')](handleError(_0x56e719,null));};exports['create']=function(_0x7075c9,_0x30730a){if(_0x7075c9[_0x0275('0x13')]['name']&&_0x7075c9[_0x0275('0x13')][_0x0275('0x14')]){var _0x575786=path['join'](__dirname,_0x0275('0x15'),_0x7075c9[_0x0275('0x13')][_0x0275('0x14')]);var _0x592a53=process[_0x0275('0x16')]();process['chdir'](path[_0x0275('0x17')](_0x575786));return execChildProcess()['then'](function(_0x26f2c2){process[_0x0275('0x18')](_0x592a53);return pm2['start']({'name':_0x7075c9[_0x0275('0x13')][_0x0275('0xb')],'script':_0x575786});})[_0x0275('0x10')](function(_0x52946b){pm2[_0x0275('0x19')]();return _0x52946b[0x0];})[_0x0275('0x10')](respondWithResult(_0x30730a,0xc9))[_0x0275('0x12')](handleError(_0x30730a,null));}else{return _0x30730a[_0x0275('0x8')](0x1f4)[_0x0275('0xc')]({'message':_0x0275('0x1a')});}};exports['update']=function(_0x35343c,_0x14d7d8){if(_0x35343c[_0x0275('0x13')]['id']){delete _0x35343c[_0x0275('0x13')]['id'];}var _0x4689a3={'online':'restart','stopped':_0x0275('0x1b')};if(_0x4689a3[_0x0275('0x1c')](_0x35343c[_0x0275('0x13')][_0x0275('0x8')])){return pm2[_0x4689a3[_0x35343c[_0x0275('0x13')]['status']]](_0x35343c[_0x0275('0x1d')]['id'])[_0x0275('0x10')](respondWithResult(_0x14d7d8,0xc8))[_0x0275('0x12')](handleError(_0x14d7d8,null));}else{return _0x14d7d8['status'](0x1f4)['send']({'message':_0x0275('0x1e')});}};exports[_0x0275('0x1f')]=function(_0x5dc2bc,_0x7eff96){if(_0x5dc2bc[_0x0275('0x13')]['id']){delete _0x5dc2bc[_0x0275('0x13')]['id'];}if(_0x5dc2bc[_0x0275('0x1d')]['id']){return pm2['delete'](_0x5dc2bc[_0x0275('0x1d')]['id'])[_0x0275('0x10')](function(_0x3bba47){pm2[_0x0275('0x19')]();return _0x3bba47[0x0];})['then'](respondWithResult(_0x7eff96,null))[_0x0275('0x12')](handleError(_0x7eff96,null));}else{return _0x7eff96['status'](0x1f4)[_0x0275('0xc')]({'message':'Unknown\x20id'});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index b4d38fc..123cd55 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 _0x9b94=['/queues','getQueues','exports','express','Router','../../components/auth/service','./realtime.controller','get','/agents','isAuthenticated','getAgents'];(function(_0x4a2953,_0x2d263e){var _0x35341e=function(_0x388a7d){while(--_0x388a7d){_0x4a2953['push'](_0x4a2953['shift']());}};_0x35341e(++_0x2d263e);}(_0x9b94,0x1a5));var _0x49b9=function(_0x948199,_0xa290d1){_0x948199=_0x948199-0x0;var _0x19fbe9=_0x9b94[_0x948199];return _0x19fbe9;};'use strict';var express=require(_0x49b9('0x0'));var router=express[_0x49b9('0x1')]();var auth=require(_0x49b9('0x2'));var controller=require(_0x49b9('0x3'));router[_0x49b9('0x4')](_0x49b9('0x5'),auth[_0x49b9('0x6')](),controller[_0x49b9('0x7')]);router[_0x49b9('0x4')](_0x49b9('0x8'),auth[_0x49b9('0x6')](),controller[_0x49b9('0x9')]);module[_0x49b9('0xa')]=router; \ No newline at end of file +var _0x87e4=['/agents','isAuthenticated','getAgents','/queues','exports','../../components/auth/service','./realtime.controller','get'];(function(_0x3c4c97,_0xd77e27){var _0xee9bd=function(_0x43f6ea){while(--_0x43f6ea){_0x3c4c97['push'](_0x3c4c97['shift']());}};_0xee9bd(++_0xd77e27);}(_0x87e4,0xe5));var _0x487e=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x87e4[_0x311c35];return _0x5cc50c;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x487e('0x0'));var controller=require(_0x487e('0x1'));router[_0x487e('0x2')](_0x487e('0x3'),auth[_0x487e('0x4')](),controller[_0x487e('0x5')]);router[_0x487e('0x2')](_0x487e('0x6'),auth['isAuthenticated'](),controller['getQueues']);module[_0x487e('0x7')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index e063bd7..33ffefb 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 _0x4f3a=['getSortedAgentsIdsByStatus','getAgentIdsByStatus','length','map','User','rawAttributes','fieldName','key','role','agent','raw','push','sequelize','literal','FIELD(id,','forEach','Pause','merge','user','Agents','online','extraQueryConditions','assign','omit','UserProfile','getResources','findAndCountAll','count','find','filterAgentAttributes','getAgentStatus','voiceStatus','talking','Status','sortAgentsByStatus','getRealtimeAgentsQueryFields','pick','catch','getQueues','resolve','isValidChannel','startCase','Queue','type','name','voice','dialActive','dialMethod','getOptions','userProfileId','outbound','QueueCampaigns','Queues','initializeQueues','lodash','util','../../components/parsers/qs','../../config/utils','../../mysqldb','../../errors/api','APIBadRequestError','offset','undefined','limit','status','set','Content-Range','getAgents','getChannels','query','globalQueueFilter','pauseTypeFilter','pause','channel','format','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','includes','globalStatus','validateSortParameter','getUpdatedSortOptions','fields','join','order','then','getAgentIdsByQueues','getRealtimeAgents','rows'];(function(_0x1859b6,_0x379cb5){var _0x20ad23=function(_0x526642){while(--_0x526642){_0x1859b6['push'](_0x1859b6['shift']());}};_0x20ad23(++_0x379cb5);}(_0x4f3a,0x1f3));var _0xa4f3=function(_0x252328,_0x4c22f0){_0x252328=_0x252328-0x0;var _0xaa85b7=_0x4f3a[_0x252328];return _0xaa85b7;};'use strict';var _=require(_0xa4f3('0x0'));var util=require(_0xa4f3('0x1'));var rta=require('../../components/realtime/agents');var rtq=require('../../components/realtime/queues');var qs=require(_0xa4f3('0x2'));var utils=require(_0xa4f3('0x3'));var db=require(_0xa4f3('0x4'))['db'];var APIBadRequestError=require(_0xa4f3('0x5'))[_0xa4f3('0x6')];var APIHandleError=require(_0xa4f3('0x5'))['handleError'];function respondWithFilteredResult(_0x3a0753,_0x11cc46){return function(_0x53448d){if(_0x53448d){var _0x4cfa16=typeof _0x11cc46[_0xa4f3('0x7')]===_0xa4f3('0x8')&&typeof _0x11cc46[_0xa4f3('0x9')]===_0xa4f3('0x8');var _0xbf927a=_0x53448d['count'];var _0x4fb9d6=_0x4cfa16?0x0:_0x11cc46[_0xa4f3('0x7')];var _0x126433=_0x4cfa16?_0x53448d['count']:_0x11cc46[_0xa4f3('0x7')]+_0x11cc46[_0xa4f3('0x9')];var _0x3b90e1;if(_0x126433>=_0xbf927a){_0x126433=_0xbf927a;_0x3b90e1=0xc8;}else{_0x3b90e1=0xce;}_0x3a0753[_0xa4f3('0xa')](_0x3b90e1);return _0x3a0753[_0xa4f3('0xb')](_0xa4f3('0xc'),_0x4fb9d6+'-'+_0x126433+'/'+_0xbf927a)['json'](_0x53448d);}return null;};}exports[_0xa4f3('0xd')]=function(_0x230385,_0x17fb67){var _0x3649c3={'count':0x0,'rows':[]};var _0x27fb89={};var _0x20550e;var _0x3f5431=utils[_0xa4f3('0xe')]();var _0x47a711;var _0x17b062;var _0x2db258=_0x230385[_0xa4f3('0xf')][_0xa4f3('0x10')];var _0x45cdd7=_0x230385[_0xa4f3('0xf')]['globalStatusFilter'];var _0x58a9e1=_0x230385[_0xa4f3('0xf')][_0xa4f3('0x11')];var _0x354c35=_0x45cdd7===_0xa4f3('0x12')||_0x45cdd7==='*pause'?!![]:![];var _0x5824e1=[];var _0x1fa4a2;var _0x468283;Promise['resolve']()['then'](function(){if(_0x230385[_0xa4f3('0xf')][_0xa4f3('0x13')]){if(!utils['isValidChannel'](_0x230385[_0xa4f3('0xf')]['channel'])){throw new APIBadRequestError(util[_0xa4f3('0x14')](_0xa4f3('0x15'),_0x230385[_0xa4f3('0xf')]['channel']));}_0x20550e=_0x230385[_0xa4f3('0xf')]['channel'][_0xa4f3('0x16')]();}if(!_0x230385['query'][_0xa4f3('0x17')]||!_0x230385[_0xa4f3('0xf')][_0xa4f3('0x17')][_0xa4f3('0x18')](_0xa4f3('0x19'))){_0x230385['query'][_0xa4f3('0x17')]=rta[_0xa4f3('0x1a')](_0x230385[_0xa4f3('0xf')][_0xa4f3('0x17')]);return;}var _0x31d09d=rta[_0xa4f3('0x1b')](_0x230385[_0xa4f3('0xf')][_0xa4f3('0x17')]);_0x230385[_0xa4f3('0xf')][_0xa4f3('0x17')]=_0x31d09d[_0xa4f3('0x1c')][_0xa4f3('0x1d')](',');_0x1fa4a2=_0x31d09d[_0xa4f3('0x1e')];})[_0xa4f3('0x1f')](function(){if(!_0x2db258){return[];}return rta[_0xa4f3('0x20')](_0x2db258,_0x20550e);})[_0xa4f3('0x1f')](function(_0x588da3){_0x5824e1=_0x588da3;return rta[_0xa4f3('0x21')]();})['then'](function(_0x1d3747){_0x17b062=_0x1d3747[_0xa4f3('0x22')];if((!_0x45cdd7||_0x354c35)&&!_0x1fa4a2){return _0x5824e1;}if(_0x1fa4a2&&!_0x45cdd7){return rta[_0xa4f3('0x23')](_0x17b062,_0x5824e1,_0x1fa4a2);}else{return rta[_0xa4f3('0x24')](_0x17b062,_0x5824e1,_0x45cdd7);}})[_0xa4f3('0x1f')](function(_0x2a8bda){_0x5824e1=_0x2a8bda;var _0x20f8fa=![];if(_0x5824e1[_0xa4f3('0x25')]===0x0){if(_0x2db258||_0x45cdd7){_0x20f8fa=!![];}if(_0x354c35){_0x20f8fa=![];}}if(_0x20f8fa){return _0x3649c3;}var _0x18d6d6=_[_0xa4f3('0x26')](db[_0xa4f3('0x27')][_0xa4f3('0x28')],function(_0x5edcab){return{'name':_0x5edcab[_0xa4f3('0x29')],'type':_0x5edcab['type'][_0xa4f3('0x2a')]};});_0x230385[_0xa4f3('0xf')][_0xa4f3('0x2b')]=_0xa4f3('0x2c');_0x27fb89=qs['getOptions'](_0x18d6d6,_0x230385);_0x27fb89[_0xa4f3('0x2d')]=!![];var _0x716ed8=[];if(_0x5824e1[_0xa4f3('0x25')]>0x0){_0x716ed8[_0xa4f3('0x2e')]({'id':{'$in':_0x5824e1}});if(_0x1fa4a2&&!_0x45cdd7){_0x468283=[db[_0xa4f3('0x2f')][_0xa4f3('0x30')](_0xa4f3('0x31')+_0x5824e1+')')];_0x27fb89[_0xa4f3('0x1e')]=_0x468283;}}if(_0x354c35){_0x3f5431[_0xa4f3('0x32')](function(_0x594e34){var _0x53d292=!![];if(_0x45cdd7==='*pause'&&_0x20550e!==_0x594e34){_0x53d292=![];}_0x716ed8['push']({[_0x594e34+_0xa4f3('0x33')]:_0x53d292});});if(_0x58a9e1){_0x716ed8['push']({'pauseType':_0x58a9e1});}}else if(_0x45cdd7){_0x3f5431[_0xa4f3('0x32')](function(_0x5a53e3){_0x716ed8[_0xa4f3('0x2e')]({[_0x5a53e3+_0xa4f3('0x33')]:![]});});}_0x27fb89['where']=_[_0xa4f3('0x34')](_0x27fb89['where'],{'$and':_0x716ed8});if(_0x230385['user'][_0xa4f3('0x2b')]==='user'){var _0x256b14={'params':{'id':_0x230385[_0xa4f3('0x35')]['userProfileId']},'query':{'section':_0xa4f3('0x36'),'role':_0xa4f3('0x2c'),'raw':!![],'ids':_0x5824e1,'customSorting':_0x468283}};if(_0x230385[_0xa4f3('0xf')][_0xa4f3('0x37')]){_0x256b14[_0xa4f3('0xf')][_0xa4f3('0x37')]=!![];}if(_0x354c35){_0x256b14[_0xa4f3('0xf')][_0xa4f3('0x38')]=_0x716ed8;}_0x256b14[_0xa4f3('0xf')]=Object[_0xa4f3('0x39')](_0x256b14[_0xa4f3('0xf')],_[_0xa4f3('0x3a')](_0x230385[_0xa4f3('0xf')],'id'));return db[_0xa4f3('0x3b')][_0xa4f3('0x3c')](_0x256b14);}return db[_0xa4f3('0x27')][_0xa4f3('0x3d')](_0x27fb89);})['then'](function(_0x31031b){_0x3649c3[_0xa4f3('0x3e')]=_0x31031b[_0xa4f3('0x3e')];_0x47a711=_0x31031b['rows'];return _0x47a711[_0xa4f3('0x26')](function(_0x14949d){var _0x574163=_[_0xa4f3('0x3f')](_0x17b062,['id',_0x14949d['id']]);if(_0x574163){var _0x558276=rta[_0xa4f3('0x40')](_0x574163);_[_0xa4f3('0x34')](_0x14949d,_0x558276);}_0x14949d['globalStatus']=rta[_0xa4f3('0x41')](_0x14949d);if(_0x14949d[_0xa4f3('0x19')][_0xa4f3('0x18')]('pause')){_0x3f5431[_0xa4f3('0x32')](function(_0x2eee1d){if(_0x14949d[_0x2eee1d+_0xa4f3('0x33')]){if(_0x2eee1d==='voice'){if(_0x14949d[_0xa4f3('0x42')]!==_0xa4f3('0x43')){_0x14949d[_0xa4f3('0x42')]=_0xa4f3('0x12');}}else{_0x14949d[_0x2eee1d+_0xa4f3('0x44')]=_0xa4f3('0x12');}}});}return _0x14949d;});})[_0xa4f3('0x1f')](function(_0xc5345){if(!_0x1fa4a2||_0x468283){return _0xc5345;}return rta[_0xa4f3('0x45')](_0xc5345,_0x1fa4a2);})[_0xa4f3('0x1f')](function(_0x1acda7){var _0x474448=rta[_0xa4f3('0x46')]();_0x3649c3[_0xa4f3('0x22')]=_0x1acda7[_0xa4f3('0x26')](function(_0x2ca7e2){return _[_0xa4f3('0x47')](_0x2ca7e2,_0x474448);});return _0x3649c3;})[_0xa4f3('0x1f')](respondWithFilteredResult(_0x17fb67,_0x27fb89))[_0xa4f3('0x48')](APIHandleError(_0x17fb67));};exports[_0xa4f3('0x49')]=function(_0x2095a2,_0x2ec93a){var _0x11d71e={'count':0x0,'rows':[]};var _0x7fcfdc={};var _0xdb32c6;var _0x1ec167;var _0x1bf336;Promise[_0xa4f3('0x4a')]()[_0xa4f3('0x1f')](function(){if(_0x2095a2[_0xa4f3('0xf')]['channel']){if(!utils[_0xa4f3('0x4b')](_0x2095a2['query'][_0xa4f3('0x13')])){throw new APIBadRequestError(util[_0xa4f3('0x14')](_0xa4f3('0x15'),_0x2095a2['query']['channel']));}_0xdb32c6=_0x2095a2['query']['channel'][_0xa4f3('0x16')]();}var _0x54cce1=_[_0xa4f3('0x4c')](_0xdb32c6)+_0xa4f3('0x4d');var _0x5b935e=_['map'](db[_0x54cce1][_0xa4f3('0x28')],function(_0x1ef6e4){return{'name':_0x1ef6e4[_0xa4f3('0x29')],'type':_0x1ef6e4[_0xa4f3('0x4e')][_0xa4f3('0x2a')]};});if(!_0x2095a2[_0xa4f3('0xf')][_0xa4f3('0x1c')]){var _0x2c8aed=['id',_0xa4f3('0x4f')];if(_0xdb32c6===_0xa4f3('0x50')){_0x2c8aed[_0xa4f3('0x2e')]('type');if(_0x2095a2[_0xa4f3('0xf')][_0xa4f3('0x4e')]==='outbound'){_0x2c8aed[_0xa4f3('0x2e')]([_0xa4f3('0x51'),_0xa4f3('0x52')]);}}_0x2095a2[_0xa4f3('0xf')][_0xa4f3('0x1c')]=_0x2c8aed[_0xa4f3('0x1d')](',');}_0x7fcfdc=qs[_0xa4f3('0x53')](_0x5b935e,_0x2095a2);if(_0x2095a2[_0xa4f3('0x35')][_0xa4f3('0x2b')]===_0xa4f3('0x35')){var _0x3b7eec={'params':{'id':_0x2095a2[_0xa4f3('0x35')][_0xa4f3('0x54')]},'query':{'section':_0xdb32c6===_0xa4f3('0x50')&&_0x2095a2[_0xa4f3('0xf')]['type']===_0xa4f3('0x55')?_0xa4f3('0x56'):_[_0xa4f3('0x4c')](_0xdb32c6)+_0xa4f3('0x57'),'type':_0x2095a2[_0xa4f3('0xf')][_0xa4f3('0x4e')],'nolimit':!![],'sort':_0xa4f3('0x4f'),'filter':_0x2095a2[_0xa4f3('0xf')]['filter']}};_0x3b7eec[_0xa4f3('0xf')]=Object[_0xa4f3('0x39')](_0x3b7eec[_0xa4f3('0xf')],_0x2095a2['query']);delete _0x3b7eec['query']['id'];return db[_0xa4f3('0x3b')][_0xa4f3('0x3c')](_0x3b7eec);}return db[_0x54cce1][_0xa4f3('0x3d')](_0x7fcfdc);})[_0xa4f3('0x1f')](function(_0x4fd6d0){_0x11d71e[_0xa4f3('0x3e')]=_0x4fd6d0[_0xa4f3('0x3e')];_0x1ec167=_0x4fd6d0[_0xa4f3('0x22')];return rtq['getRealtimeQueues'](_0x2095a2,_0xdb32c6);})[_0xa4f3('0x1f')](function(_0x58f4e4){_0x1bf336=_0x58f4e4[_0xa4f3('0x22')];return rtq[_0xa4f3('0x58')](_0x1ec167,_0x1bf336,_0xdb32c6,_0x2095a2[_0xa4f3('0xf')][_0xa4f3('0x4e')]);})[_0xa4f3('0x1f')](function(_0x29a323){_0x11d71e['rows']=_0x29a323;return _0x11d71e;})[_0xa4f3('0x1f')](respondWithFilteredResult(_0x2ec93a,_0x7fcfdc))[_0xa4f3('0x48')](APIHandleError(_0x2ec93a));}; \ No newline at end of file +var _0xa364=['name','voice','outbound','dialActive','dialMethod','QueueCampaigns','Queues','filter','getRealtimeQueues','initializeQueues','lodash','util','../../components/realtime/agents','../../components/realtime/queues','../../errors/api','handleError','offset','undefined','limit','count','status','set','Content-Range','json','getAgents','getChannels','query','globalQueueFilter','globalStatusFilter','pauseTypeFilter','pause','*pause','resolve','then','isValidChannel','channel','format','sort','includes','globalStatus','validateSortParameter','fields','join','order','getAgentIdsByQueues','getRealtimeAgents','getSortedAgentsIdsByStatus','getAgentIdsByStatus','length','map','User','rawAttributes','fieldName','type','key','role','agent','getOptions','raw','push','sequelize','literal','FIELD(id,','forEach','Pause','where','merge','user','userProfileId','online','extraQueryConditions','assign','omit','UserProfile','getResources','findAndCountAll','rows','find','filterAgentAttributes','getAgentStatus','voiceStatus','talking','Status','sortAgentsByStatus','pick','catch','getQueues','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','startCase','Queue'];(function(_0x7feb90,_0x28e700){var _0x3c5b33=function(_0x113cfa){while(--_0x113cfa){_0x7feb90['push'](_0x7feb90['shift']());}};_0x3c5b33(++_0x28e700);}(_0xa364,0x176));var _0x4a36=function(_0x3c8dd5,_0x9a2c04){_0x3c8dd5=_0x3c8dd5-0x0;var _0x46b0ff=_0xa364[_0x3c8dd5];return _0x46b0ff;};'use strict';var _=require(_0x4a36('0x0'));var util=require(_0x4a36('0x1'));var rta=require(_0x4a36('0x2'));var rtq=require(_0x4a36('0x3'));var qs=require('../../components/parsers/qs');var utils=require('../../config/utils');var db=require('../../mysqldb')['db'];var APIBadRequestError=require(_0x4a36('0x4'))['APIBadRequestError'];var APIHandleError=require('../../errors/api')[_0x4a36('0x5')];function respondWithFilteredResult(_0x418e9d,_0x1976e2){return function(_0x3c8aad){if(_0x3c8aad){var _0x353b17=typeof _0x1976e2[_0x4a36('0x6')]===_0x4a36('0x7')&&typeof _0x1976e2[_0x4a36('0x8')]===_0x4a36('0x7');var _0x15717c=_0x3c8aad[_0x4a36('0x9')];var _0x5e83b9=_0x353b17?0x0:_0x1976e2[_0x4a36('0x6')];var _0x6d59e3=_0x353b17?_0x3c8aad[_0x4a36('0x9')]:_0x1976e2[_0x4a36('0x6')]+_0x1976e2[_0x4a36('0x8')];var _0x2b5522;if(_0x6d59e3>=_0x15717c){_0x6d59e3=_0x15717c;_0x2b5522=0xc8;}else{_0x2b5522=0xce;}_0x418e9d[_0x4a36('0xa')](_0x2b5522);return _0x418e9d[_0x4a36('0xb')](_0x4a36('0xc'),_0x5e83b9+'-'+_0x6d59e3+'/'+_0x15717c)[_0x4a36('0xd')](_0x3c8aad);}return null;};}exports[_0x4a36('0xe')]=function(_0x7e1880,_0xfd2b2c){var _0x19d9d5={'count':0x0,'rows':[]};var _0x489924={};var _0x5bc394;var _0x466e0a=utils[_0x4a36('0xf')]();var _0x8b2655;var _0x40efce;var _0x2240e9=_0x7e1880[_0x4a36('0x10')][_0x4a36('0x11')];var _0x216195=_0x7e1880[_0x4a36('0x10')][_0x4a36('0x12')];var _0x503949=_0x7e1880[_0x4a36('0x10')][_0x4a36('0x13')];var _0x29488=_0x216195===_0x4a36('0x14')||_0x216195===_0x4a36('0x15')?!![]:![];var _0x2e59ac=[];var _0x21465b;var _0x3bf27b;Promise[_0x4a36('0x16')]()[_0x4a36('0x17')](function(){if(_0x7e1880['query']['channel']){if(!utils[_0x4a36('0x18')](_0x7e1880[_0x4a36('0x10')][_0x4a36('0x19')])){throw new APIBadRequestError(util[_0x4a36('0x1a')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x7e1880[_0x4a36('0x10')][_0x4a36('0x19')]));}_0x5bc394=_0x7e1880[_0x4a36('0x10')][_0x4a36('0x19')]['toLowerCase']();}if(!_0x7e1880[_0x4a36('0x10')][_0x4a36('0x1b')]||!_0x7e1880['query']['sort'][_0x4a36('0x1c')](_0x4a36('0x1d'))){_0x7e1880[_0x4a36('0x10')][_0x4a36('0x1b')]=rta[_0x4a36('0x1e')](_0x7e1880[_0x4a36('0x10')][_0x4a36('0x1b')]);return;}var _0x66fb18=rta['getUpdatedSortOptions'](_0x7e1880[_0x4a36('0x10')]['sort']);_0x7e1880['query'][_0x4a36('0x1b')]=_0x66fb18[_0x4a36('0x1f')][_0x4a36('0x20')](',');_0x21465b=_0x66fb18[_0x4a36('0x21')];})[_0x4a36('0x17')](function(){if(!_0x2240e9){return[];}return rta[_0x4a36('0x22')](_0x2240e9,_0x5bc394);})['then'](function(_0x30c7cc){_0x2e59ac=_0x30c7cc;return rta[_0x4a36('0x23')]();})['then'](function(_0x13800c){_0x40efce=_0x13800c['rows'];if((!_0x216195||_0x29488)&&!_0x21465b){return _0x2e59ac;}if(_0x21465b&&!_0x216195){return rta[_0x4a36('0x24')](_0x40efce,_0x2e59ac,_0x21465b);}else{return rta[_0x4a36('0x25')](_0x40efce,_0x2e59ac,_0x216195);}})[_0x4a36('0x17')](function(_0x501858){_0x2e59ac=_0x501858;var _0x5054cf=![];if(_0x2e59ac[_0x4a36('0x26')]===0x0){if(_0x2240e9||_0x216195){_0x5054cf=!![];}if(_0x29488){_0x5054cf=![];}}if(_0x5054cf){return _0x19d9d5;}var _0x22f3a0=_[_0x4a36('0x27')](db[_0x4a36('0x28')][_0x4a36('0x29')],function(_0x50de7c){return{'name':_0x50de7c[_0x4a36('0x2a')],'type':_0x50de7c[_0x4a36('0x2b')][_0x4a36('0x2c')]};});_0x7e1880[_0x4a36('0x10')][_0x4a36('0x2d')]=_0x4a36('0x2e');_0x489924=qs[_0x4a36('0x2f')](_0x22f3a0,_0x7e1880);_0x489924[_0x4a36('0x30')]=!![];var _0x2fd801=[];if(_0x2e59ac[_0x4a36('0x26')]>0x0){_0x2fd801[_0x4a36('0x31')]({'id':{'$in':_0x2e59ac}});if(_0x21465b&&!_0x216195){_0x3bf27b=[db[_0x4a36('0x32')][_0x4a36('0x33')](_0x4a36('0x34')+_0x2e59ac+')')];_0x489924[_0x4a36('0x21')]=_0x3bf27b;}}if(_0x29488){_0x466e0a[_0x4a36('0x35')](function(_0x50e979){var _0x3c5c74=!![];if(_0x216195==='*pause'&&_0x5bc394!==_0x50e979){_0x3c5c74=![];}_0x2fd801['push']({[_0x50e979+_0x4a36('0x36')]:_0x3c5c74});});if(_0x503949){_0x2fd801[_0x4a36('0x31')]({'pauseType':_0x503949});}}else if(_0x216195){_0x466e0a[_0x4a36('0x35')](function(_0x697d10){_0x2fd801[_0x4a36('0x31')]({[_0x697d10+_0x4a36('0x36')]:![]});});}_0x489924[_0x4a36('0x37')]=_[_0x4a36('0x38')](_0x489924[_0x4a36('0x37')],{'$and':_0x2fd801});if(_0x7e1880[_0x4a36('0x39')]['role']==='user'){var _0x536918={'params':{'id':_0x7e1880[_0x4a36('0x39')][_0x4a36('0x3a')]},'query':{'section':'Agents','role':'agent','raw':!![],'ids':_0x2e59ac,'customSorting':_0x3bf27b}};if(_0x7e1880[_0x4a36('0x10')][_0x4a36('0x3b')]){_0x536918[_0x4a36('0x10')][_0x4a36('0x3b')]=!![];}if(_0x29488){_0x536918[_0x4a36('0x10')][_0x4a36('0x3c')]=_0x2fd801;}_0x536918['query']=Object[_0x4a36('0x3d')](_0x536918[_0x4a36('0x10')],_[_0x4a36('0x3e')](_0x7e1880['query'],'id'));return db[_0x4a36('0x3f')][_0x4a36('0x40')](_0x536918);}return db['User'][_0x4a36('0x41')](_0x489924);})[_0x4a36('0x17')](function(_0xd732c4){_0x19d9d5[_0x4a36('0x9')]=_0xd732c4[_0x4a36('0x9')];_0x8b2655=_0xd732c4[_0x4a36('0x42')];return _0x8b2655[_0x4a36('0x27')](function(_0x31d125){var _0x5a0f43=_[_0x4a36('0x43')](_0x40efce,['id',_0x31d125['id']]);if(_0x5a0f43){var _0x17db5c=rta[_0x4a36('0x44')](_0x5a0f43);_[_0x4a36('0x38')](_0x31d125,_0x17db5c);}_0x31d125[_0x4a36('0x1d')]=rta[_0x4a36('0x45')](_0x31d125);if(_0x31d125['globalStatus'][_0x4a36('0x1c')](_0x4a36('0x14'))){_0x466e0a[_0x4a36('0x35')](function(_0x39f519){if(_0x31d125[_0x39f519+_0x4a36('0x36')]){if(_0x39f519==='voice'){if(_0x31d125[_0x4a36('0x46')]!==_0x4a36('0x47')){_0x31d125[_0x4a36('0x46')]=_0x4a36('0x14');}}else{_0x31d125[_0x39f519+_0x4a36('0x48')]=_0x4a36('0x14');}}});}return _0x31d125;});})['then'](function(_0x5e81bb){if(!_0x21465b||_0x3bf27b){return _0x5e81bb;}return rta[_0x4a36('0x49')](_0x5e81bb,_0x21465b);})[_0x4a36('0x17')](function(_0x2321b0){var _0x17e181=rta['getRealtimeAgentsQueryFields']();_0x19d9d5[_0x4a36('0x42')]=_0x2321b0[_0x4a36('0x27')](function(_0x2854f9){return _[_0x4a36('0x4a')](_0x2854f9,_0x17e181);});return _0x19d9d5;})[_0x4a36('0x17')](respondWithFilteredResult(_0xfd2b2c,_0x489924))[_0x4a36('0x4b')](APIHandleError(_0xfd2b2c));};exports[_0x4a36('0x4c')]=function(_0x359407,_0x2e19fb){var _0x48ca10={'count':0x0,'rows':[]};var _0x4775f3={};var _0x138b5f;var _0x2ac6be;var _0x7bdada;Promise['resolve']()['then'](function(){if(_0x359407[_0x4a36('0x10')][_0x4a36('0x19')]){if(!utils['isValidChannel'](_0x359407['query']['channel'])){throw new APIBadRequestError(util[_0x4a36('0x1a')](_0x4a36('0x4d'),_0x359407[_0x4a36('0x10')][_0x4a36('0x19')]));}_0x138b5f=_0x359407[_0x4a36('0x10')]['channel'][_0x4a36('0x4e')]();}var _0x104d6e=_[_0x4a36('0x4f')](_0x138b5f)+_0x4a36('0x50');var _0xdf6ef6=_[_0x4a36('0x27')](db[_0x104d6e]['rawAttributes'],function(_0x21203e){return{'name':_0x21203e[_0x4a36('0x2a')],'type':_0x21203e['type'][_0x4a36('0x2c')]};});if(!_0x359407[_0x4a36('0x10')][_0x4a36('0x1f')]){var _0x4d0029=['id',_0x4a36('0x51')];if(_0x138b5f===_0x4a36('0x52')){_0x4d0029[_0x4a36('0x31')](_0x4a36('0x2b'));if(_0x359407[_0x4a36('0x10')][_0x4a36('0x2b')]===_0x4a36('0x53')){_0x4d0029[_0x4a36('0x31')]([_0x4a36('0x54'),_0x4a36('0x55')]);}}_0x359407[_0x4a36('0x10')][_0x4a36('0x1f')]=_0x4d0029[_0x4a36('0x20')](',');}_0x4775f3=qs['getOptions'](_0xdf6ef6,_0x359407);if(_0x359407[_0x4a36('0x39')][_0x4a36('0x2d')]==='user'){var _0x3c9b10={'params':{'id':_0x359407[_0x4a36('0x39')][_0x4a36('0x3a')]},'query':{'section':_0x138b5f===_0x4a36('0x52')&&_0x359407['query'][_0x4a36('0x2b')]===_0x4a36('0x53')?_0x4a36('0x56'):_['startCase'](_0x138b5f)+_0x4a36('0x57'),'type':_0x359407[_0x4a36('0x10')][_0x4a36('0x2b')],'nolimit':!![],'sort':_0x4a36('0x51'),'filter':_0x359407[_0x4a36('0x10')][_0x4a36('0x58')]}};_0x3c9b10['query']=Object['assign'](_0x3c9b10[_0x4a36('0x10')],_0x359407[_0x4a36('0x10')]);delete _0x3c9b10[_0x4a36('0x10')]['id'];return db[_0x4a36('0x3f')][_0x4a36('0x40')](_0x3c9b10);}return db[_0x104d6e]['findAndCountAll'](_0x4775f3);})[_0x4a36('0x17')](function(_0x349a25){_0x48ca10[_0x4a36('0x9')]=_0x349a25[_0x4a36('0x9')];_0x2ac6be=_0x349a25['rows'];return rtq[_0x4a36('0x59')](_0x359407,_0x138b5f);})['then'](function(_0x1f9142){_0x7bdada=_0x1f9142[_0x4a36('0x42')];return rtq[_0x4a36('0x5a')](_0x2ac6be,_0x7bdada,_0x138b5f,_0x359407['query'][_0x4a36('0x2b')]);})[_0x4a36('0x17')](function(_0x4c9720){_0x48ca10[_0x4a36('0x42')]=_0x4c9720;return _0x48ca10;})[_0x4a36('0x17')](respondWithFilteredResult(_0x2e19fb,_0x4775f3))[_0x4a36('0x4b')](APIHandleError(_0x2e19fb));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 5046ca0..5b78ecb 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x536bf1,_0xcef6ea){var _0x2ef863=function(_0x406540){while(--_0x406540){_0x536bf1['push'](_0x536bf1['shift']());}};_0x2ef863(++_0xcef6ea);}(_0x9c44,0x178));var _0x49c4=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x9c44[_0x422905];return _0x33dc6c;};'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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0xc21b09,_0x5b4e19){var _0x34a385=function(_0x46efa5){while(--_0x46efa5){_0xc21b09['push'](_0xc21b09['shift']());}};_0x34a385(++_0x5b4e19);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 5541da8..65bc860 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 _0x280b=['INTEGER','sequelize','exports','STRING','DATE'];(function(_0x2963b5,_0x44209e){var _0x45ae66=function(_0x4a5ec7){while(--_0x4a5ec7){_0x2963b5['push'](_0x2963b5['shift']());}};_0x45ae66(++_0x44209e);}(_0x280b,0xce));var _0xb280=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x280b[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require(_0xb280('0x0'));module[_0xb280('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0xb280('0x2')]},'scheduledat':{'type':Sequelize[_0xb280('0x3')]},'uniqueid':{'type':Sequelize[_0xb280('0x2')]},'starttime':{'type':Sequelize[_0xb280('0x3')]},'responsetime':{'type':Sequelize[_0xb280('0x3')]},'ringtime':{'type':Sequelize[_0xb280('0x4')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xb280('0x2')]},'campaigntype':{'type':Sequelize[_0xb280('0x2')]},'membername':{'type':Sequelize[_0xb280('0x2')]}}; \ No newline at end of file +var _0xd072=['DATE','sequelize','exports','INTEGER','STRING'];(function(_0x2acd22,_0x43d09b){var _0x164f1b=function(_0x4691b0){while(--_0x4691b0){_0x2acd22['push'](_0x2acd22['shift']());}};_0x164f1b(++_0x43d09b);}(_0xd072,0x132));var _0x2d07=function(_0x12579c,_0x321ff0){_0x12579c=_0x12579c-0x0;var _0x9eda58=_0xd072[_0x12579c];return _0x9eda58;};'use strict';var Sequelize=require(_0x2d07('0x0'));module[_0x2d07('0x1')]={'state':{'type':Sequelize[_0x2d07('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x2d07('0x3')]},'scheduledat':{'type':Sequelize[_0x2d07('0x4')]},'uniqueid':{'type':Sequelize[_0x2d07('0x3')]},'starttime':{'type':Sequelize[_0x2d07('0x4')]},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x2d07('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x2d07('0x3')]},'campaigntype':{'type':Sequelize[_0x2d07('0x3')]},'membername':{'type':Sequelize[_0x2d07('0x3')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 5b976b3..6d5f34c 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 _0xa2bf=['ReportAgentPreview','report_agent_preview','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','define'];(function(_0x32d52b,_0x1c2f2d){var _0x5686b7=function(_0x1d7213){while(--_0x1d7213){_0x32d52b['push'](_0x32d52b['shift']());}};_0x5686b7(++_0x1c2f2d);}(_0xa2bf,0xce));var _0xfa2b=function(_0x25bb00,_0x5816b5){_0x25bb00=_0x25bb00-0x0;var _0x1de138=_0xa2bf[_0x25bb00];return _0x1de138;};'use strict';var _=require(_0xfa2b('0x0'));var util=require(_0xfa2b('0x1'));var logger=require(_0xfa2b('0x2'))(_0xfa2b('0x3'));var moment=require(_0xfa2b('0x4'));var BPromise=require('bluebird');var rp=require(_0xfa2b('0x5'));var fs=require('fs');var path=require(_0xfa2b('0x6'));var rimraf=require(_0xfa2b('0x7'));var config=require(_0xfa2b('0x8'));var attributes=require('./reportAgentPreview.attributes');module['exports']=function(_0x47fae1,_0x11d3ac){return _0x47fae1[_0xfa2b('0x9')](_0xfa2b('0xa'),attributes,{'tableName':_0xfa2b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4600=['ReportAgentPreview','report_agent_preview','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment','./reportAgentPreview.attributes'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0x4600,0x98));var _0x0460=function(_0x423142,_0x81d5ef){_0x423142=_0x423142-0x0;var _0x3c4785=_0x4600[_0x423142];return _0x3c4785;};'use strict';var _=require(_0x0460('0x0'));var util=require(_0x0460('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0460('0x2'));var rp=require(_0x0460('0x3'));var fs=require('fs');var path=require(_0x0460('0x4'));var rimraf=require(_0x0460('0x5'));var config=require(_0x0460('0x6'));var attributes=require(_0x0460('0x7'));module['exports']=function(_0xcaefbb,_0x494c49){return _0xcaefbb['define'](_0x0460('0x8'),attributes,{'tableName':_0x0460('0x9'),'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 f2d2803..ae98595 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 _0x1455=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','error','code','message','info','result','CreateReportAgentPreview','create','options','raw','stringify','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x1eab4a,_0x590c9c){var _0x1669bf=function(_0x2b2de7){while(--_0x2b2de7){_0x1eab4a['push'](_0x1eab4a['shift']());}};_0x1669bf(++_0x590c9c);}(_0x1455,0xda));var _0x5145=function(_0x16f362,_0x3981a3){_0x16f362=_0x16f362-0x0;var _0x2bd24a=_0x1455[_0x16f362];return _0x2bd24a;};'use strict';var _=require('lodash');var util=require(_0x5145('0x0'));var moment=require(_0x5145('0x1'));var BPromise=require(_0x5145('0x2'));var rs=require(_0x5145('0x3'));var fs=require('fs');var Redis=require(_0x5145('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5145('0x5'));var logger=require(_0x5145('0x6'))(_0x5145('0x7'));var config=require(_0x5145('0x8'));var jayson=require(_0x5145('0x9'));var client=jayson[_0x5145('0xa')][_0x5145('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x348dfd,_0x2d763c,_0x32137a){return new BPromise(function(_0x5e9880,_0x1177e1){return client['request'](_0x348dfd,_0x32137a)[_0x5145('0xc')](function(_0x41aa9d){logger['info'](_0x5145('0xd'),_0x2d763c,_0x5145('0xe'));logger[_0x5145('0xf')](_0x5145('0x10'),_0x2d763c,'request\x20sent',JSON['stringify'](_0x41aa9d));if(_0x41aa9d[_0x5145('0x11')]){if(_0x41aa9d['error'][_0x5145('0x12')]===0x1f4){logger[_0x5145('0x11')]('ReportAgentPreview,\x20%s,\x20%s',_0x2d763c,_0x41aa9d[_0x5145('0x11')]['message']);return _0x1177e1(_0x41aa9d[_0x5145('0x11')][_0x5145('0x13')]);}logger[_0x5145('0x11')](_0x5145('0xd'),_0x2d763c,_0x41aa9d[_0x5145('0x11')][_0x5145('0x13')]);return _0x5e9880(_0x41aa9d[_0x5145('0x11')][_0x5145('0x13')]);}else{logger[_0x5145('0x14')](_0x5145('0xd'),_0x2d763c,_0x5145('0xe'));_0x5e9880(_0x41aa9d[_0x5145('0x15')][_0x5145('0x13')]);}})['catch'](function(_0x4e2caf){logger[_0x5145('0x11')](_0x5145('0xd'),_0x2d763c,_0x4e2caf);_0x1177e1(_0x4e2caf);});});}exports[_0x5145('0x16')]=function(_0x407950){var _0x5ccd25=this;return new Promise(function(_0xe2e6a9,_0x432b23){return db['ReportAgentPreview'][_0x5145('0x17')](_0x407950['body'],{'raw':_0x407950[_0x5145('0x18')]?_0x407950[_0x5145('0x18')][_0x5145('0x19')]===undefined?!![]:![]:!![]})[_0x5145('0xc')](function(_0x55b812){logger['info'](_0x5145('0x16'),_0x407950);logger[_0x5145('0xf')]('CreateReportAgentPreview',_0x407950,JSON[_0x5145('0x1a')](_0x55b812));_0xe2e6a9(_0x55b812);})[_0x5145('0x1b')](function(_0x4bc646){logger[_0x5145('0x11')](_0x5145('0x16'),_0x4bc646[_0x5145('0x13')],_0x407950);_0x432b23(_0x5ccd25[_0x5145('0x11')](0x1f4,_0x4bc646['message']));});});}; \ No newline at end of file +var _0x9d5d=['util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','ReportAgentPreview,\x20%s,\x20%s','ReportAgentPreview,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','CreateReportAgentPreview','create','body','options','debug','catch','lodash'];(function(_0x3644b5,_0x5eed09){var _0x55e2ba=function(_0x378365){while(--_0x378365){_0x3644b5['push'](_0x3644b5['shift']());}};_0x55e2ba(++_0x5eed09);}(_0x9d5d,0x1e5));var _0xd9d5=function(_0x52ef4b,_0x15f96e){_0x52ef4b=_0x52ef4b-0x0;var _0x3616dd=_0x9d5d[_0x52ef4b];return _0x3616dd;};'use strict';var _=require(_0xd9d5('0x0'));var util=require(_0xd9d5('0x1'));var moment=require(_0xd9d5('0x2'));var BPromise=require(_0xd9d5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd9d5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd9d5('0x5'));var logger=require('../../config/logger')(_0xd9d5('0x6'));var config=require(_0xd9d5('0x7'));var jayson=require(_0xd9d5('0x8'));var client=jayson[_0xd9d5('0x9')][_0xd9d5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3312bf,_0x30ef47,_0xb50b1e){return new BPromise(function(_0x1ce7b3,_0x18f816){return client['request'](_0x3312bf,_0xb50b1e)[_0xd9d5('0xb')](function(_0x32b522){logger['info'](_0xd9d5('0xc'),_0x30ef47,'request\x20sent');logger['debug'](_0xd9d5('0xd'),_0x30ef47,_0xd9d5('0xe'),JSON[_0xd9d5('0xf')](_0x32b522));if(_0x32b522[_0xd9d5('0x10')]){if(_0x32b522[_0xd9d5('0x10')][_0xd9d5('0x11')]===0x1f4){logger[_0xd9d5('0x10')]('ReportAgentPreview,\x20%s,\x20%s',_0x30ef47,_0x32b522[_0xd9d5('0x10')][_0xd9d5('0x12')]);return _0x18f816(_0x32b522[_0xd9d5('0x10')]['message']);}logger[_0xd9d5('0x10')](_0xd9d5('0xc'),_0x30ef47,_0x32b522['error']['message']);return _0x1ce7b3(_0x32b522['error']['message']);}else{logger[_0xd9d5('0x13')](_0xd9d5('0xc'),_0x30ef47,_0xd9d5('0xe'));_0x1ce7b3(_0x32b522[_0xd9d5('0x14')][_0xd9d5('0x12')]);}})['catch'](function(_0x132bd3){logger[_0xd9d5('0x10')](_0xd9d5('0xc'),_0x30ef47,_0x132bd3);_0x18f816(_0x132bd3);});});}exports[_0xd9d5('0x15')]=function(_0xdbc948){var _0x67eb45=this;return new Promise(function(_0x17bbd6,_0x4a94ef){return db['ReportAgentPreview'][_0xd9d5('0x16')](_0xdbc948[_0xd9d5('0x17')],{'raw':_0xdbc948['options']?_0xdbc948[_0xd9d5('0x18')]['raw']===undefined?!![]:![]:!![]})[_0xd9d5('0xb')](function(_0x11b3e9){logger[_0xd9d5('0x13')](_0xd9d5('0x15'),_0xdbc948);logger[_0xd9d5('0x19')](_0xd9d5('0x15'),_0xdbc948,JSON[_0xd9d5('0xf')](_0x11b3e9));_0x17bbd6(_0x11b3e9);})[_0xd9d5('0x1a')](function(_0x50c38c){logger[_0xd9d5('0x10')](_0xd9d5('0x15'),_0x50c38c[_0xd9d5('0x12')],_0xdbc948);_0x4a94ef(_0x67eb45['error'](0x1f4,_0x50c38c[_0xd9d5('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index d42e698..dd900da 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 _0xe366=['util','path','Router','../../components/auth/service','get','isAuthenticated','voiceChannels','voiceChannelMixMonitor','voiceChannelStopMixMonitor','/voice/queues','/chat/queues','chatQueues','mailQueues','/mail/accounts','mailAccounts','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','/voice/queues/:id','showVoiceQueues','updateVoiceQueue','/outbound','outbound','/outbound/channels','outboundChannels','/agents','agents','put','/agents/:id/capacity','agentCapacity','telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','/chat/queues/:id/notify','chat','/chat/queues/:id','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','showOpenchannelQueues','/sms/queues/:id/notify','sms','whatsapp','/sms/queues/:id','/whatsapp/queues/:id','/agents/:id/notify','agentNotify','exports','multer'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xe366,0x199));var _0x6e36=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xe366[_0x5b78e8];return _0xf2c321;};'use strict';var multer=require(_0x6e36('0x0'));var util=require(_0x6e36('0x1'));var path=require(_0x6e36('0x2'));var express=require('express');var router=express[_0x6e36('0x3')]();var auth=require(_0x6e36('0x4'));var controller=require('./rpc.controller');router[_0x6e36('0x5')]('/voice/channels',auth[_0x6e36('0x6')](),controller[_0x6e36('0x7')]);router[_0x6e36('0x5')]('/voice/channels/:uniqueid/mixmonitor',auth[_0x6e36('0x6')](),controller[_0x6e36('0x8')]);router[_0x6e36('0x5')]('/voice/channels/:uniqueid/stopmixmonitor',auth[_0x6e36('0x6')](),controller[_0x6e36('0x9')]);router['get'](_0x6e36('0xa'),auth[_0x6e36('0x6')](),controller['voiceQueues']);router[_0x6e36('0x5')](_0x6e36('0xb'),auth[_0x6e36('0x6')](),controller[_0x6e36('0xc')]);router[_0x6e36('0x5')]('/mail/queues',auth[_0x6e36('0x6')](),controller[_0x6e36('0xd')]);router[_0x6e36('0x5')](_0x6e36('0xe'),auth[_0x6e36('0x6')](),controller[_0x6e36('0xf')]);router[_0x6e36('0x5')]('/openchannel/queues',auth[_0x6e36('0x6')](),controller['openchannelQueues']);router[_0x6e36('0x5')](_0x6e36('0x10'),auth[_0x6e36('0x6')](),controller[_0x6e36('0x11')]);router['get'](_0x6e36('0x12'),auth[_0x6e36('0x6')](),controller[_0x6e36('0x13')]);router[_0x6e36('0x5')](_0x6e36('0x14'),auth[_0x6e36('0x6')](),controller[_0x6e36('0x15')]);router[_0x6e36('0x5')](_0x6e36('0x16'),auth[_0x6e36('0x6')](),controller[_0x6e36('0x17')]);router['get'](_0x6e36('0x18'),auth[_0x6e36('0x6')](),controller['voiceQueuesChannels']);router['get'](_0x6e36('0x19'),auth['isAuthenticated'](),controller[_0x6e36('0x1a')]);router[_0x6e36('0x5')](_0x6e36('0x1b'),auth[_0x6e36('0x6')](),controller[_0x6e36('0x1c')]);router['get'](_0x6e36('0x1d'),auth[_0x6e36('0x6')](),controller['voiceQueuesChannelRedirect']);router['get'](_0x6e36('0x1e'),auth[_0x6e36('0x6')](),controller[_0x6e36('0x1f')]);router['put']('/voice/queues/:id',auth['isAuthenticated'](),controller[_0x6e36('0x20')]);router[_0x6e36('0x5')](_0x6e36('0x21'),auth['isAuthenticated'](),controller[_0x6e36('0x22')]);router[_0x6e36('0x5')](_0x6e36('0x23'),auth['isAuthenticated'](),controller[_0x6e36('0x24')]);router[_0x6e36('0x5')](_0x6e36('0x25'),auth[_0x6e36('0x6')](),controller[_0x6e36('0x26')]);router[_0x6e36('0x27')](_0x6e36('0x28'),auth[_0x6e36('0x6')](),controller[_0x6e36('0x29')]);router[_0x6e36('0x5')]('/telephones',auth[_0x6e36('0x6')](),controller[_0x6e36('0x2a')]);router[_0x6e36('0x5')](_0x6e36('0x2b'),auth[_0x6e36('0x6')](),controller[_0x6e36('0x2c')]);router[_0x6e36('0x5')](_0x6e36('0x2d'),auth['isAuthenticated'](),controller[_0x6e36('0x2e')]);router[_0x6e36('0x5')](_0x6e36('0x2f'),auth['isAuthenticated'](),controller[_0x6e36('0x30')]);router['get'](_0x6e36('0x31'),auth['isAuthenticated'](),controller[_0x6e36('0x32')]);router[_0x6e36('0x5')](_0x6e36('0x33'),auth[_0x6e36('0x6')](),controller['mailQueuesWaitingInteractions']);router['get'](_0x6e36('0x34'),auth[_0x6e36('0x6')](),controller[_0x6e36('0x35')]);router[_0x6e36('0x5')](_0x6e36('0x36'),auth[_0x6e36('0x6')](),controller[_0x6e36('0x37')]);router[_0x6e36('0x5')](_0x6e36('0x38'),auth[_0x6e36('0x6')](),controller['smsQueuesWaitingInteractions']);router[_0x6e36('0x5')]('/whatsapp/queues/waitinginteractions',auth[_0x6e36('0x6')](),controller[_0x6e36('0x39')]);router['get'](_0x6e36('0x3a'),auth[_0x6e36('0x6')](),controller['faxQueuesWaitingInteractions']);router[_0x6e36('0x3b')](_0x6e36('0x3c'),auth['isAuthenticated'](),controller[_0x6e36('0x3d')](_0x6e36('0x3e')));router['get'](_0x6e36('0x3f'),auth[_0x6e36('0x6')](),controller['showMailQueues']);router[_0x6e36('0x3b')](_0x6e36('0x40'),auth[_0x6e36('0x6')](),controller[_0x6e36('0x3d')](_0x6e36('0x41')));router['get'](_0x6e36('0x42'),auth['isAuthenticated'](),controller['showChatQueues']);router[_0x6e36('0x3b')](_0x6e36('0x43'),auth[_0x6e36('0x6')](),controller[_0x6e36('0x3d')](_0x6e36('0x44')));router[_0x6e36('0x5')](_0x6e36('0x45'),auth['isAuthenticated'](),controller[_0x6e36('0x46')]);router[_0x6e36('0x3b')](_0x6e36('0x47'),auth[_0x6e36('0x6')](),controller[_0x6e36('0x3d')](_0x6e36('0x48')));router['get']('/openchannel/queues/:id',auth[_0x6e36('0x6')](),controller[_0x6e36('0x49')]);router['post'](_0x6e36('0x4a'),auth['isAuthenticated'](),controller[_0x6e36('0x3d')](_0x6e36('0x4b')));router[_0x6e36('0x3b')]('/whatsapp/queues/:id/notify',auth['isAuthenticated'](),controller[_0x6e36('0x3d')](_0x6e36('0x4c')));router[_0x6e36('0x5')](_0x6e36('0x4d'),auth[_0x6e36('0x6')](),controller['showSmsQueues']);router[_0x6e36('0x5')](_0x6e36('0x4e'),auth['isAuthenticated'](),controller['showWhatsappQueues']);router['post'](_0x6e36('0x4f'),auth[_0x6e36('0x6')](),controller[_0x6e36('0x50')]);module[_0x6e36('0x51')]=router; \ No newline at end of file +var _0x1e99=['trunks','/campaigns','campaigns','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','post','queueNotify','mail','/mail/queues/:id','/chat/queues/:id/notify','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','showFaxQueues','/openchannel/queues/:id/notify','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','showWhatsappQueues','/agents/:id/notify','agentNotify','multer','util','path','express','Router','../../components/auth/service','./rpc.controller','get','/voice/channels','voiceChannels','/voice/channels/:uniqueid/mixmonitor','isAuthenticated','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','put','/voice/queues/:id','updateVoiceQueue','/outbound','outbound','/outbound/channels','outboundChannels','/agents','agents','/agents/:id/capacity','agentCapacity','/telephones','/trunks'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x1e99,0x1d7));var _0x91e9=function(_0x1a4143,_0x6bda61){_0x1a4143=_0x1a4143-0x0;var _0x236873=_0x1e99[_0x1a4143];return _0x236873;};'use strict';var multer=require(_0x91e9('0x0'));var util=require(_0x91e9('0x1'));var path=require(_0x91e9('0x2'));var express=require(_0x91e9('0x3'));var router=express[_0x91e9('0x4')]();var auth=require(_0x91e9('0x5'));var controller=require(_0x91e9('0x6'));router[_0x91e9('0x7')](_0x91e9('0x8'),auth['isAuthenticated'](),controller[_0x91e9('0x9')]);router[_0x91e9('0x7')](_0x91e9('0xa'),auth[_0x91e9('0xb')](),controller[_0x91e9('0xc')]);router[_0x91e9('0x7')](_0x91e9('0xd'),auth[_0x91e9('0xb')](),controller[_0x91e9('0xe')]);router[_0x91e9('0x7')](_0x91e9('0xf'),auth['isAuthenticated'](),controller[_0x91e9('0x10')]);router[_0x91e9('0x7')](_0x91e9('0x11'),auth[_0x91e9('0xb')](),controller[_0x91e9('0x12')]);router[_0x91e9('0x7')](_0x91e9('0x13'),auth[_0x91e9('0xb')](),controller[_0x91e9('0x14')]);router[_0x91e9('0x7')](_0x91e9('0x15'),auth['isAuthenticated'](),controller['mailAccounts']);router[_0x91e9('0x7')](_0x91e9('0x16'),auth['isAuthenticated'](),controller[_0x91e9('0x17')]);router[_0x91e9('0x7')](_0x91e9('0x18'),auth[_0x91e9('0xb')](),controller[_0x91e9('0x19')]);router[_0x91e9('0x7')](_0x91e9('0x1a'),auth[_0x91e9('0xb')](),controller[_0x91e9('0x1b')]);router['get']('/fax/queues',auth[_0x91e9('0xb')](),controller[_0x91e9('0x1c')]);router[_0x91e9('0x7')](_0x91e9('0x1d'),auth[_0x91e9('0xb')](),controller[_0x91e9('0x1e')]);router[_0x91e9('0x7')](_0x91e9('0x1f'),auth['isAuthenticated'](),controller[_0x91e9('0x20')]);router[_0x91e9('0x7')](_0x91e9('0x21'),auth['isAuthenticated'](),controller[_0x91e9('0x22')]);router[_0x91e9('0x7')](_0x91e9('0x23'),auth[_0x91e9('0xb')](),controller[_0x91e9('0x24')]);router[_0x91e9('0x7')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth['isAuthenticated'](),controller[_0x91e9('0x25')]);router['get']('/voice/queues/:id',auth['isAuthenticated'](),controller['showVoiceQueues']);router[_0x91e9('0x26')](_0x91e9('0x27'),auth[_0x91e9('0xb')](),controller[_0x91e9('0x28')]);router[_0x91e9('0x7')](_0x91e9('0x29'),auth[_0x91e9('0xb')](),controller[_0x91e9('0x2a')]);router[_0x91e9('0x7')](_0x91e9('0x2b'),auth[_0x91e9('0xb')](),controller[_0x91e9('0x2c')]);router[_0x91e9('0x7')](_0x91e9('0x2d'),auth[_0x91e9('0xb')](),controller[_0x91e9('0x2e')]);router[_0x91e9('0x26')](_0x91e9('0x2f'),auth[_0x91e9('0xb')](),controller[_0x91e9('0x30')]);router[_0x91e9('0x7')](_0x91e9('0x31'),auth[_0x91e9('0xb')](),controller['telephones']);router[_0x91e9('0x7')](_0x91e9('0x32'),auth['isAuthenticated'](),controller[_0x91e9('0x33')]);router[_0x91e9('0x7')](_0x91e9('0x34'),auth[_0x91e9('0xb')](),controller[_0x91e9('0x35')]);router['get']('/fax/accounts',auth[_0x91e9('0xb')](),controller[_0x91e9('0x36')]);router[_0x91e9('0x7')](_0x91e9('0x37'),auth[_0x91e9('0xb')](),controller[_0x91e9('0x38')]);router[_0x91e9('0x7')]('/mail/queues/waitinginteractions',auth[_0x91e9('0xb')](),controller[_0x91e9('0x39')]);router[_0x91e9('0x7')](_0x91e9('0x3a'),auth['isAuthenticated'](),controller['openchannelQueuesWaitingInteractions']);router[_0x91e9('0x7')](_0x91e9('0x3b'),auth[_0x91e9('0xb')](),controller[_0x91e9('0x3c')]);router[_0x91e9('0x7')](_0x91e9('0x3d'),auth[_0x91e9('0xb')](),controller[_0x91e9('0x3e')]);router[_0x91e9('0x7')]('/whatsapp/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0x91e9('0x3f')]);router['get'](_0x91e9('0x40'),auth['isAuthenticated'](),controller['faxQueuesWaitingInteractions']);router[_0x91e9('0x41')]('/mail/queues/:id/notify',auth[_0x91e9('0xb')](),controller[_0x91e9('0x42')](_0x91e9('0x43')));router[_0x91e9('0x7')](_0x91e9('0x44'),auth[_0x91e9('0xb')](),controller['showMailQueues']);router['post'](_0x91e9('0x45'),auth[_0x91e9('0xb')](),controller['queueNotify']('chat'));router['get'](_0x91e9('0x46'),auth[_0x91e9('0xb')](),controller[_0x91e9('0x47')]);router['post'](_0x91e9('0x48'),auth['isAuthenticated'](),controller[_0x91e9('0x42')](_0x91e9('0x49')));router[_0x91e9('0x7')]('/fax/queues/:id',auth[_0x91e9('0xb')](),controller[_0x91e9('0x4a')]);router[_0x91e9('0x41')](_0x91e9('0x4b'),auth[_0x91e9('0xb')](),controller[_0x91e9('0x42')]('openchannel'));router[_0x91e9('0x7')](_0x91e9('0x4c'),auth[_0x91e9('0xb')](),controller[_0x91e9('0x4d')]);router[_0x91e9('0x41')](_0x91e9('0x4e'),auth[_0x91e9('0xb')](),controller[_0x91e9('0x42')](_0x91e9('0x4f')));router[_0x91e9('0x41')](_0x91e9('0x50'),auth[_0x91e9('0xb')](),controller[_0x91e9('0x42')](_0x91e9('0x51')));router[_0x91e9('0x7')](_0x91e9('0x52'),auth[_0x91e9('0xb')](),controller[_0x91e9('0x53')]);router[_0x91e9('0x7')]('/whatsapp/queues/:id',auth['isAuthenticated'](),controller[_0x91e9('0x54')]);router[_0x91e9('0x41')](_0x91e9('0x55'),auth['isAuthenticated'](),controller[_0x91e9('0x56')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index d36db7f..3fc89d9 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 _0xbaf0=['MailQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','map','queue_id','value','indexOf','smsQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Queue','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','Account','\x20Message\x20not\x20found','update','queue','From','QueueId','TransferReport','create','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','Website','Agent\x20not\x20found','InteractionId','agentTransferTimeout','moment','lodash','util','../../mysqldb','../../config/logger','api','client','http','request','then','error','code','message','result','status','sendStatus','stack','name','isNil','rows','voiceChannels','VoiceChannels','catch','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','query','params','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','body','interaction','user','hasOwnProperty','MemberReport','findAll','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','interface','SIP/%s','agent','internal','AgentCapacity','capacity','telephones','Telephones','trunks','Campaigns','chatQueues','ChatQueues','showChatQueues','MailQueues','showMailQueues','mailAccounts','openchannelQueues','OpenchannelQueues','smsQueues','showSmsQueues','WhatsappQueues','showWhatsappQueues','faxQueues','showFaxQueues','FaxQueues','faxAccounts','FaxAccounts','mailQueuesWaitingInteractions'];(function(_0x583a09,_0xf75310){var _0x3ebb31=function(_0x29dc5f){while(--_0x29dc5f){_0x583a09['push'](_0x583a09['shift']());}};_0x3ebb31(++_0xf75310);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xbaf0[_0x5b644e];return _0x49c6bf;};'use strict';var BPromise=require('bluebird');var moment=require(_0x0baf('0x0'));var _=require(_0x0baf('0x1'));var util=require(_0x0baf('0x2'));var db=require(_0x0baf('0x3'))['db'];var logger=require(_0x0baf('0x4'))(_0x0baf('0x5'));var jayson=require('jayson/promise');var amiClient=jayson[_0x0baf('0x6')][_0x0baf('0x7')]({'port':0x232a});var mailClient=jayson[_0x0baf('0x6')][_0x0baf('0x7')]({'port':0x232b});var routingClient=jayson[_0x0baf('0x6')][_0x0baf('0x7')]({'port':0x232c});function respondWithRpcPromise(_0x1a10b1,_0x2dcaac,_0x1d0a0d){return new BPromise(function(_0x5f5030,_0x11b947){var _0x5f20aa=_0x1d0a0d?_0x1d0a0d:amiClient;return _0x5f20aa[_0x0baf('0x8')](_0x1a10b1,_0x2dcaac)[_0x0baf('0x9')](function(_0x465528){if(_0x465528[_0x0baf('0xa')]){if(_0x465528[_0x0baf('0xa')][_0x0baf('0xb')]===0x1f4){return _0x11b947(_0x465528[_0x0baf('0xa')][_0x0baf('0xc')]);}return _0x5f5030(_0x465528[_0x0baf('0xa')][_0x0baf('0xc')]);}else{_0x5f5030(_0x465528[_0x0baf('0xd')]);}})['catch'](function(_0x5a53e2){_0x11b947(_0x5a53e2);});});}function respondWithResult(_0x465dd7,_0xe4378c){_0xe4378c=_0xe4378c||0xc8;return function(_0x5db689){if(_0x5db689){return _0x465dd7[_0x0baf('0xe')](_0xe4378c)['json'](_0x5db689);}return _0x465dd7[_0x0baf('0xf')](0x194);};}function handleError(_0x49e44b,_0x1c76a8){_0x1c76a8=_0x1c76a8||0x1f4;return function(_0x1f50c3){logger[_0x0baf('0xa')](_0x1f50c3[_0x0baf('0x10')]);if(_0x1f50c3[_0x0baf('0x11')]){delete _0x1f50c3[_0x0baf('0x11')];}_0x49e44b['status'](_0x1c76a8)['send'](_0x1f50c3);};}function findById(_0x2312c7){return function(_0x38395b){if(!_[_0x0baf('0x12')](_0x2312c7)&&!_[_0x0baf('0x12')](_0x38395b)&&!_[_0x0baf('0x12')](_0x38395b[_0x0baf('0x13')])){return _['find'](_0x38395b[_0x0baf('0x13')],function(_0xfbecec){return _0xfbecec['id']==_0x2312c7;});}return null;};}exports[_0x0baf('0x14')]=function(_0x3e9cb4,_0x47070d){return respondWithRpcPromise(_0x0baf('0x15'),_0x3e9cb4['query'])['then'](respondWithResult(_0x47070d,null))[_0x0baf('0x16')](handleError(_0x47070d,null));};exports[_0x0baf('0x17')]=function(_0x32e839,_0x1848e8){return respondWithRpcPromise(_0x0baf('0x18'),_[_0x0baf('0x19')](_0x32e839[_0x0baf('0x1a')],_0x32e839[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x1848e8,null))[_0x0baf('0x16')](handleError(_0x1848e8,null));};exports['voiceChannelStopMixMonitor']=function(_0x334bd6,_0x482522){return respondWithRpcPromise(_0x0baf('0x1c'),_['merge'](_0x334bd6['query'],_0x334bd6[_0x0baf('0x1b')]))['then'](respondWithResult(_0x482522,null))['catch'](handleError(_0x482522,null));};exports[_0x0baf('0x1d')]=function(_0x27b59c,_0x34e264){return respondWithRpcPromise(_0x0baf('0x1e'),_0x27b59c[_0x0baf('0x1a')])['then'](respondWithResult(_0x34e264,null))[_0x0baf('0x16')](handleError(_0x34e264,null));};exports[_0x0baf('0x1f')]=function(_0x1ca35a,_0x366e71){return respondWithRpcPromise(_0x0baf('0x1e'),_0x1ca35a[_0x0baf('0x1a')])[_0x0baf('0x9')](findById(_0x1ca35a['params']['id']))[_0x0baf('0x9')](respondWithResult(_0x366e71,null))[_0x0baf('0x16')](handleError(_0x366e71,null));};exports[_0x0baf('0x20')]=function(_0x265915,_0x55c715){return respondWithRpcPromise(_0x0baf('0x21'),_[_0x0baf('0x19')](_0x265915['body'],_0x265915[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x55c715,null))[_0x0baf('0x16')](handleError(_0x55c715,null));};exports[_0x0baf('0x22')]=function(_0xd14f0f,_0x366924){return respondWithRpcPromise(_0x0baf('0x23'),_['merge'](_0xd14f0f[_0x0baf('0x1a')],_0xd14f0f[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x366924,null))[_0x0baf('0x16')](handleError(_0x366924,null));};exports[_0x0baf('0x24')]=function(_0x275ea1,_0x2fc983){return respondWithRpcPromise(_0x0baf('0x25'),_0x275ea1[_0x0baf('0x1a')])[_0x0baf('0x9')](respondWithResult(_0x2fc983,null))[_0x0baf('0x16')](handleError(_0x2fc983,null));};exports[_0x0baf('0x26')]=function(_0x45294a,_0x3a3353){return respondWithRpcPromise('VoiceQueuesChannel',_[_0x0baf('0x19')](_0x45294a['query'],_0x45294a[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x3a3353,null))[_0x0baf('0x16')](handleError(_0x3a3353,null));};exports[_0x0baf('0x27')]=function(_0x5300a5,_0x1a2b03){return respondWithRpcPromise(_0x0baf('0x28'),_['merge'](_0x5300a5[_0x0baf('0x1a')],_0x5300a5[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x1a2b03,null))[_0x0baf('0x16')](handleError(_0x1a2b03,null));};exports[_0x0baf('0x29')]=function(_0x1b0991,_0xe03d82){return respondWithRpcPromise(_0x0baf('0x2a'),_['merge'](_0x1b0991[_0x0baf('0x1a')],_0x1b0991[_0x0baf('0x1b')]))['then'](respondWithResult(_0xe03d82,null))[_0x0baf('0x16')](handleError(_0xe03d82,null));};exports['outbound']=function(_0x5c545f,_0x11bc49){return respondWithRpcPromise(_0x0baf('0x2b'),_0x5c545f['query'])['then'](respondWithResult(_0x11bc49,null))[_0x0baf('0x16')](handleError(_0x11bc49,null));};exports[_0x0baf('0x2c')]=function(_0x3412bc,_0xb2d9ab){return respondWithRpcPromise(_0x0baf('0x2d'),_0x3412bc[_0x0baf('0x1a')])[_0x0baf('0x9')](respondWithResult(_0xb2d9ab,null))[_0x0baf('0x16')](handleError(_0xb2d9ab,null));};exports[_0x0baf('0x2e')]=function(_0x36c6d2,_0x200864){var _0x148540;return respondWithRpcPromise(_0x0baf('0x2f'),_0x36c6d2[_0x0baf('0x1a')])['then'](function(_0x3573ce){_0x148540=_0x3573ce;return respondWithRpcPromise(_0x0baf('0x2f'),_0x36c6d2['query'],routingClient);})[_0x0baf('0x9')](function(_0x324369){return _[_0x0baf('0x19')]({},_0x324369,_0x148540);})[_0x0baf('0x9')](respondWithResult(_0x200864,null))[_0x0baf('0x16')](handleError(_0x200864,null));};exports[_0x0baf('0x30')]=function(_0x57b581,_0x23ad34){if(_0x57b581[_0x0baf('0x31')]&&_0x57b581['body'][_0x0baf('0x32')]&&_0x57b581[_0x0baf('0x33')]&&_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')]){for(var _0x504031 in _0x57b581[_0x0baf('0x31')][_0x0baf('0x32')]){if(_0x57b581[_0x0baf('0x31')][_0x0baf('0x32')][_0x0baf('0x34')](_0x504031)){db[_0x0baf('0x35')][_0x0baf('0x36')]({'where':{'channel':_0x504031,'membername':_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')],'type':_0x0baf('0x37'),'exitAt':null,'uniqueid':_0x57b581['body'][_0x0baf('0x32')][_0x504031]&&_0x57b581[_0x0baf('0x31')][_0x0baf('0x32')][_0x504031][_0x0baf('0x38')]?{'$notIn':_0x57b581[_0x0baf('0x31')]['interaction'][_0x504031]}:{'$ne':null}}})[_0x0baf('0x9')](function(_0x310240){var _0x27c3ee=moment()[_0x0baf('0x39')](_0x0baf('0x3a'));for(var _0x54ed41=0x0,_0x2a0924=_0x310240[_0x0baf('0x38')];_0x54ed41<_0x2a0924;_0x54ed41+=0x1){_0x310240[_0x54ed41][_0x0baf('0x3b')]({'exitAt':_0x27c3ee});}});for(var _0x1522b0=0x0;_0x1522b0<_0x57b581[_0x0baf('0x31')][_0x0baf('0x32')][_0x504031][_0x0baf('0x38')];_0x1522b0+=0x1){db['MemberReport'][_0x0baf('0x3c')]({'where':{'channel':_0x504031,'membername':_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')],'type':'INTERACTION','uniqueid':_0x57b581[_0x0baf('0x31')][_0x0baf('0x32')][_0x504031][_0x1522b0],'exitAt':null},'defaults':{'channel':_0x504031,'membername':_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')],'interface':_[_0x0baf('0x12')](_0x57b581[_0x0baf('0x33')][_0x0baf('0x3d')])?util['format'](_0x0baf('0x3e'),_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')]):_0x57b581[_0x0baf('0x33')][_0x0baf('0x3d')],'type':_0x0baf('0x37'),'enterAt':moment()[_0x0baf('0x39')](_0x0baf('0x3a')),'role':_0x0baf('0x3f'),'internal':_0x57b581[_0x0baf('0x33')][_0x0baf('0x40')],'uniqueid':_0x57b581['body']['interaction'][_0x504031][_0x1522b0]}});}}}}return respondWithRpcPromise(_0x0baf('0x41'),{'id':_0x57b581[_0x0baf('0x1b')]['id'],'capacity':_0x57b581[_0x0baf('0x31')][_0x0baf('0x42')]},routingClient)[_0x0baf('0x9')](respondWithResult(_0x23ad34,null))[_0x0baf('0x16')](handleError(_0x23ad34,null));};exports[_0x0baf('0x43')]=function(_0x4b492c,_0x3fe534){return respondWithRpcPromise(_0x0baf('0x44'),_0x4b492c[_0x0baf('0x1a')])[_0x0baf('0x9')](respondWithResult(_0x3fe534,null))[_0x0baf('0x16')](handleError(_0x3fe534,null));};exports[_0x0baf('0x45')]=function(_0x5e1849,_0x3eebe5){return respondWithRpcPromise('Trunks',_0x5e1849[_0x0baf('0x1a')])['then'](respondWithResult(_0x3eebe5,null))[_0x0baf('0x16')](handleError(_0x3eebe5,null));};exports['campaigns']=function(_0x35b1a5,_0x4c035b){return respondWithRpcPromise(_0x0baf('0x46'),_0x35b1a5[_0x0baf('0x1a')])[_0x0baf('0x9')](respondWithResult(_0x4c035b,null))[_0x0baf('0x16')](handleError(_0x4c035b,null));};exports[_0x0baf('0x47')]=function(_0x576475,_0x21f179){return respondWithRpcPromise(_0x0baf('0x48'),_0x576475[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x21f179,null))[_0x0baf('0x16')](handleError(_0x21f179,null));};exports[_0x0baf('0x49')]=function(_0x480834,_0x402f4d){return respondWithRpcPromise(_0x0baf('0x48'),_0x480834[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](findById(_0x480834[_0x0baf('0x1b')]['id']))[_0x0baf('0x9')](respondWithResult(_0x402f4d,null))[_0x0baf('0x16')](handleError(_0x402f4d,null));};exports['mailQueues']=function(_0x48e855,_0x23f6ea){return respondWithRpcPromise(_0x0baf('0x4a'),_0x48e855[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x23f6ea,null))[_0x0baf('0x16')](handleError(_0x23f6ea,null));};exports[_0x0baf('0x4b')]=function(_0xaa4293,_0x14a667){return respondWithRpcPromise(_0x0baf('0x4a'),_0xaa4293['query'],routingClient)[_0x0baf('0x9')](findById(_0xaa4293[_0x0baf('0x1b')]['id']))[_0x0baf('0x9')](respondWithResult(_0x14a667,null))[_0x0baf('0x16')](handleError(_0x14a667,null));};exports[_0x0baf('0x4c')]=function(_0xebfc0c,_0x26f5c9){return respondWithRpcPromise('MailAccounts',_0xebfc0c[_0x0baf('0x1a')],mailClient)[_0x0baf('0x9')](respondWithResult(_0x26f5c9,null))[_0x0baf('0x16')](handleError(_0x26f5c9,null));};exports[_0x0baf('0x4d')]=function(_0x1c7d88,_0x1a6d22){return respondWithRpcPromise(_0x0baf('0x4e'),_0x1c7d88[_0x0baf('0x1a')],routingClient)['then'](respondWithResult(_0x1a6d22,null))[_0x0baf('0x16')](handleError(_0x1a6d22,null));};exports['showOpenchannelQueues']=function(_0x3c00e7,_0x5f2fbe){return respondWithRpcPromise('OpenchannelQueues',_0x3c00e7[_0x0baf('0x1a')],routingClient)['then'](findById(_0x3c00e7[_0x0baf('0x1b')]['id']))[_0x0baf('0x9')](respondWithResult(_0x5f2fbe,null))['catch'](handleError(_0x5f2fbe,null));};exports[_0x0baf('0x4f')]=function(_0xfb6708,_0x156572){return respondWithRpcPromise('SmsQueues',_0xfb6708['query'],routingClient)[_0x0baf('0x9')](respondWithResult(_0x156572,null))[_0x0baf('0x16')](handleError(_0x156572,null));};exports[_0x0baf('0x50')]=function(_0x7f49e,_0x784e1a){return respondWithRpcPromise('SmsQueues',_0x7f49e[_0x0baf('0x1a')],routingClient)['then'](findById(_0x7f49e['params']['id']))['then'](respondWithResult(_0x784e1a,null))[_0x0baf('0x16')](handleError(_0x784e1a,null));};exports['whatsappQueues']=function(_0x4946d4,_0x11a81e){return respondWithRpcPromise(_0x0baf('0x51'),_0x4946d4[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x11a81e,null))[_0x0baf('0x16')](handleError(_0x11a81e,null));};exports[_0x0baf('0x52')]=function(_0x4c05d6,_0xec3b32){return respondWithRpcPromise(_0x0baf('0x51'),_0x4c05d6[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](findById(_0x4c05d6[_0x0baf('0x1b')]['id']))[_0x0baf('0x9')](respondWithResult(_0xec3b32,null))['catch'](handleError(_0xec3b32,null));};exports[_0x0baf('0x53')]=function(_0x468363,_0x29fd46){return respondWithRpcPromise('FaxQueues',_0x468363[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x29fd46,null))[_0x0baf('0x16')](handleError(_0x29fd46,null));};exports[_0x0baf('0x54')]=function(_0x125906,_0x27a959){return respondWithRpcPromise(_0x0baf('0x55'),_0x125906['query'],routingClient)['then'](findById(_0x125906['params']['id']))[_0x0baf('0x9')](respondWithResult(_0x27a959,null))[_0x0baf('0x16')](handleError(_0x27a959,null));};exports[_0x0baf('0x56')]=function(_0x12b9b5,_0x3e65d4){return respondWithRpcPromise(_0x0baf('0x57'),_0x12b9b5['query'])['then'](respondWithResult(_0x3e65d4,null))[_0x0baf('0x16')](handleError(_0x3e65d4,null));};exports['chatQueuesWaitingInteractions']=function(_0x22cd07,_0x3e9b79){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x22cd07[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x3e9b79,null))[_0x0baf('0x16')](handleError(_0x3e9b79,null));};exports[_0x0baf('0x58')]=function(_0x115ff5,_0x33a5af){return respondWithRpcPromise(_0x0baf('0x59'),_0x115ff5[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x33a5af,null))['catch'](handleError(_0x33a5af,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x58a079,_0x493784){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x58a079[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x493784,null))[_0x0baf('0x16')](handleError(_0x493784,null));};exports[_0x0baf('0x5a')]=function(_0x5093f5,_0x1be7f2){return respondWithRpcPromise(_0x0baf('0x5b'),_0x5093f5['query'],routingClient)['then'](function(_0x43aecd){if(_0x5093f5[_0x0baf('0x1a')][_0x0baf('0x5c')]!==undefined){var _0x442e5f=_(_0x43aecd[_0x0baf('0x13')])[_0x0baf('0x5d')]([_0x5093f5[_0x0baf('0x1a')][_0x0baf('0x5c')],_0x5093f5['params']['id']])[_0x0baf('0x5e')](_0x0baf('0x5f'))['uniq']()[_0x0baf('0x60')]();return _0x43aecd[_0x0baf('0x13')]['filter'](function(_0x97d385){return _0x442e5f[_0x0baf('0x61')](_0x97d385[_0x0baf('0x5f')])>-0x1;});}else{return _0x43aecd[_0x0baf('0x13')][_0x0baf('0x5d')](function(_0x4fc5af){return _0x4fc5af['queue_id']===parseInt(_0x5093f5[_0x0baf('0x1b')]['id']);});}})[_0x0baf('0x9')](respondWithResult(_0x1be7f2,null))['catch'](handleError(_0x1be7f2,null));};exports[_0x0baf('0x62')]=function(_0x59dad5,_0x21ad25){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x59dad5[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x21ad25,null))[_0x0baf('0x16')](handleError(_0x21ad25,null));};exports['whatsappQueuesWaitingInteractions']=function(_0x3c2bc1,_0x5008c5){return respondWithRpcPromise(_0x0baf('0x63'),_0x3c2bc1[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x5008c5,null))[_0x0baf('0x16')](handleError(_0x5008c5,null));};exports[_0x0baf('0x64')]=function(_0x52e845,_0x866e6e){return respondWithRpcPromise(_0x0baf('0x65'),_0x52e845['query'],routingClient)[_0x0baf('0x9')](respondWithResult(_0x866e6e,null))[_0x0baf('0x16')](handleError(_0x866e6e,null));};exports[_0x0baf('0x66')]=function(_0x379c54){return function(_0x1cbbcc,_0x250df2){var _0xa4fd1b,_0x1cda78;var _0x44ef57=_[_0x0baf('0x67')](_0x379c54);var _0x3b7abf=_0x379c54===_0x0baf('0x68')?'Website':'Account';return db[_0x44ef57+_0x0baf('0x69')][_0x0baf('0x6a')]({'raw':!![],'where':{'id':_0x1cbbcc[_0x0baf('0x1b')]['id']}})['then'](function(_0x507783){if(_[_0x0baf('0x12')](_0x507783)){throw new Error(_0x44ef57+_0x0baf('0x6b'));}_0xa4fd1b=_0x507783;return db[_0x44ef57+_0x0baf('0x6c')][_0x0baf('0x6a')]({'where':{'id':_0x1cbbcc[_0x0baf('0x31')][_0x0baf('0x6d')]},'include':[{'model':db[_0x44ef57+_0x0baf('0x6e')],'as':_0x0baf('0x6e')},{'model':db[_0x44ef57+_0x3b7abf],'as':_0x0baf('0x6f')}]});})['then'](function(_0x1590a5){if(_[_0x0baf('0x12')](_0x1590a5)){throw new Error(_0x44ef57+_0x0baf('0x70'));}_0x1cda78=_0x1590a5;return _0x1590a5[_0x0baf('0x71')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x5d26e6={'uniqueid':_0x379c54+'.'+_0x1cda78['id']+'.'+_0x1cda78['Interaction']['id'],'FromUserId':_0x1cbbcc[_0x0baf('0x33')]['id'],'type':_0x0baf('0x72')};_0x5d26e6[_0x44ef57+'MessageId']=_0x1cda78['id'];_0x5d26e6[_0x44ef57+'InteractionId']=_0x1cda78[_0x0baf('0x6e')]['id'];_0x5d26e6[_0x0baf('0x73')+_0x44ef57+_0x3b7abf+'Id']=_0x1cda78['Account']['id'];_0x5d26e6['To'+_0x44ef57+_0x0baf('0x74')]=_0xa4fd1b['id'];return db[_0x44ef57+_0x0baf('0x75')][_0x0baf('0x76')](_0x5d26e6);})[_0x0baf('0x9')](function(){return respondWithRpcPromise(_0x0baf('0x77'),{'channel':_0x379c54,'interaction':_0x1cda78[_0x0baf('0x6e')],'message':_0x1cda78,'account':_0x1cda78[_0x0baf('0x6f')],'applications':[{'id':0x0,'priority':0x1,'app':_0x0baf('0x72'),'appdata':_0xa4fd1b[_0x0baf('0x11')]+','+(_0x1cda78[_0x0baf('0x6f')][_0x0baf('0x78')]||0x12c),'interval':_0x0baf('0x79')}],'transfer':!![]},routingClient);})['then'](respondWithResult(_0x250df2,null))[_0x0baf('0x16')](handleError(_0x250df2,null));};};exports[_0x0baf('0x7a')]=function(_0x1e1adb,_0x3bd15b){var _0x3c37b4,_0x195303;if(_['isNil'](_0x1e1adb[_0x0baf('0x31')][_0x0baf('0x7b')])){throw new Error(_0x0baf('0x7c'));}var _0x457ae8=_0x1e1adb[_0x0baf('0x31')]['channel'];var _0x3761b5=_[_0x0baf('0x67')](_0x457ae8);var _0x2eae1b=_0x457ae8===_0x0baf('0x68')?_0x0baf('0x7d'):'Account';return db['User'][_0x0baf('0x6a')]({'raw':!![],'where':{'id':_0x1e1adb['params']['id'],'role':_0x0baf('0x3f')}})['then'](function(_0x32d8b6){if(_[_0x0baf('0x12')](_0x32d8b6)){throw new Error(_0x0baf('0x7e'));}_0x3c37b4=_0x32d8b6;return db[_0x3761b5+_0x0baf('0x6c')]['findOne']({'where':{'id':_0x1e1adb[_0x0baf('0x31')][_0x0baf('0x6d')]},'include':[{'model':db[_0x3761b5+_0x0baf('0x6e')],'as':'Interaction'},{'model':db[_0x3761b5+_0x2eae1b],'as':'Account'}]});})['then'](function(_0x4d4884){if(_[_0x0baf('0x12')](_0x4d4884)){throw new Error(_0x3761b5+_0x0baf('0x70'));}_0x195303=_0x4d4884;return _0x4d4884[_0x0baf('0x71')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0baf('0x9')](function(){var _0x597830={'uniqueid':_0x457ae8+'.'+_0x195303['id']+'.'+_0x195303[_0x0baf('0x6e')]['id'],'FromUserId':_0x1e1adb[_0x0baf('0x33')]['id'],'type':_0x0baf('0x3f'),'ToUserId':_0x3c37b4['id']};_0x597830[_0x3761b5+'MessageId']=_0x195303['id'];_0x597830[_0x3761b5+_0x0baf('0x7f')]=_0x195303[_0x0baf('0x6e')]['id'];_0x597830['From'+_0x3761b5+_0x2eae1b+'Id']=_0x195303[_0x0baf('0x6f')]['id'];return db[_0x3761b5+'TransferReport'][_0x0baf('0x76')](_0x597830);})[_0x0baf('0x9')](function(){return respondWithRpcPromise(_0x0baf('0x77'),{'channel':_0x457ae8,'interaction':_0x195303[_0x0baf('0x6e')],'message':_0x195303,'account':_0x195303['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x3c37b4[_0x0baf('0x11')]+','+(_0x195303['Account'][_0x0baf('0x80')]||0x12c),'interval':_0x0baf('0x79')}],'transfer':!![]},routingClient);})[_0x0baf('0x9')](respondWithResult(_0x3bd15b,null))[_0x0baf('0x16')](handleError(_0x3bd15b,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(_0x52e3dd,_0x159b90){var _0x4ea4ef=function(_0x15acfe){while(--_0x15acfe){_0x52e3dd['push'](_0x52e3dd['shift']());}};_0x4ea4ef(++_0x159b90);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'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 a07ffff..03327a7 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 _0x7c9d=['util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./schedule.controller','isAuthenticated','index','get','/:id','show','run','post','create','update','delete','exports','multer'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0x7c9d,0x109));var _0xd7c9=function(_0x5af319,_0x197661){_0x5af319=_0x5af319-0x0;var _0x4c3fc3=_0x7c9d[_0x5af319];return _0x4c3fc3;};'use strict';var multer=require(_0xd7c9('0x0'));var util=require(_0xd7c9('0x1'));var path=require(_0xd7c9('0x2'));var timeout=require(_0xd7c9('0x3'));var express=require('express');var router=express[_0xd7c9('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xd7c9('0x5'));var config=require(_0xd7c9('0x6'));var controller=require(_0xd7c9('0x7'));router['get']('/',auth[_0xd7c9('0x8')](),controller[_0xd7c9('0x9')]);router[_0xd7c9('0xa')](_0xd7c9('0xb'),auth[_0xd7c9('0x8')](),controller[_0xd7c9('0xc')]);router[_0xd7c9('0xa')]('/:id/run',auth[_0xd7c9('0x8')](),controller[_0xd7c9('0xd')]);router[_0xd7c9('0xe')]('/',auth[_0xd7c9('0x8')](),controller[_0xd7c9('0xf')]);router['put'](_0xd7c9('0xb'),auth[_0xd7c9('0x8')](),controller[_0xd7c9('0x10')]);router[_0xd7c9('0x11')]('/:id',auth[_0xd7c9('0x8')](),controller['destroy']);module[_0xd7c9('0x12')]=router; \ No newline at end of file +var _0x2b32=['../../config/environment','get','index','isAuthenticated','show','/:id/run','post','put','/:id','update','delete','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0xf0fb3c,_0xdecb22){var _0xdad4a3=function(_0xe2e904){while(--_0xe2e904){_0xf0fb3c['push'](_0xf0fb3c['shift']());}};_0xdad4a3(++_0xdecb22);}(_0x2b32,0x14e));var _0x22b3=function(_0x1b69aa,_0x5aa147){_0x1b69aa=_0x1b69aa-0x0;var _0x42647d=_0x2b32[_0x1b69aa];return _0x42647d;};'use strict';var multer=require('multer');var util=require(_0x22b3('0x0'));var path=require(_0x22b3('0x1'));var timeout=require('connect-timeout');var express=require(_0x22b3('0x2'));var router=express[_0x22b3('0x3')]();var fs_extra=require(_0x22b3('0x4'));var auth=require(_0x22b3('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x22b3('0x6'));var controller=require('./schedule.controller');router[_0x22b3('0x7')]('/',auth['isAuthenticated'](),controller[_0x22b3('0x8')]);router['get']('/:id',auth[_0x22b3('0x9')](),controller[_0x22b3('0xa')]);router[_0x22b3('0x7')](_0x22b3('0xb'),auth[_0x22b3('0x9')](),controller['run']);router[_0x22b3('0xc')]('/',auth[_0x22b3('0x9')](),controller['create']);router[_0x22b3('0xd')](_0x22b3('0xe'),auth[_0x22b3('0x9')](),controller[_0x22b3('0xf')]);router[_0x22b3('0x10')](_0x22b3('0xe'),auth[_0x22b3('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index decf2bf..ed47e3a 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 _0x09d1=['weeks','hours','days','csv','pdf','xlsx','custom','TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years'];(function(_0x4823b7,_0x579922){var _0x30b6d2=function(_0x543b26){while(--_0x543b26){_0x4823b7['push'](_0x4823b7['shift']());}};_0x30b6d2(++_0x579922);}(_0x09d1,0xb2));var _0x109d=function(_0x2f4090,_0x8200eb){_0x2f4090=_0x2f4090-0x0;var _0x59afb8=_0x09d1[_0x2f4090];return _0x59afb8;};'use strict';var Sequelize=require(_0x109d('0x0'));module[_0x109d('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x109d('0x2')]},'active':{'type':Sequelize[_0x109d('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x109d('0x2')],'allowNull':![],'defaultValue':_0x109d('0x4')},'startAt':{'type':Sequelize[_0x109d('0x5')],'allowNull':![]},'endAt':{'type':Sequelize[_0x109d('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x109d('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x109d('0x7')](_0x109d('0x8'),'quarters','months',_0x109d('0x9'),'days',_0x109d('0xa'),'minutes'),'allowNull':![],'defaultValue':_0x109d('0xb')},'output':{'type':Sequelize[_0x109d('0x7')](_0x109d('0xc'),_0x109d('0xd'),_0x109d('0xe')),'allowNull':![],'defaultValue':_0x109d('0xc')},'type':{'type':Sequelize[_0x109d('0x7')](_0x109d('0xf'),'default'),'allowNull':![],'defaultValue':_0x109d('0xf')},'sendMail':{'type':Sequelize[_0x109d('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x109d('0x2')]},'cc':{'type':Sequelize[_0x109d('0x10')]},'bcc':{'type':Sequelize[_0x109d('0x10')]},'sendIfEmpty':{'type':Sequelize[_0x109d('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x27bf=['DATE','INTEGER','ENUM','years','quarters','weeks','days','xlsx','csv','custom','default','STRING','TEXT','exports','BOOLEAN'];(function(_0x4db56c,_0x20b972){var _0x3dfff8=function(_0x2d1e25){while(--_0x2d1e25){_0x4db56c['push'](_0x4db56c['shift']());}};_0x3dfff8(++_0x20b972);}(_0x27bf,0x11b));var _0xf27b=function(_0x3504f9,_0x49964d){_0x3504f9=_0x3504f9-0x0;var _0x2024e1=_0x27bf[_0x3504f9];return _0x2024e1;};'use strict';var Sequelize=require('sequelize');module[_0xf27b('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0xf27b('0x1')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize[_0xf27b('0x2')],'allowNull':![]},'endAt':{'type':Sequelize[_0xf27b('0x2')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xf27b('0x3')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xf27b('0x4')](_0xf27b('0x5'),_0xf27b('0x6'),'months',_0xf27b('0x7'),_0xf27b('0x8'),'hours','minutes'),'allowNull':![],'defaultValue':_0xf27b('0x8')},'output':{'type':Sequelize[_0xf27b('0x4')]('csv','pdf',_0xf27b('0x9')),'allowNull':![],'defaultValue':_0xf27b('0xa')},'type':{'type':Sequelize[_0xf27b('0x4')](_0xf27b('0xb'),_0xf27b('0xc')),'allowNull':![],'defaultValue':_0xf27b('0xb')},'sendMail':{'type':Sequelize[_0xf27b('0x1')],'defaultValue':![]},'email':{'type':Sequelize[_0xf27b('0xd')]},'cc':{'type':Sequelize[_0xf27b('0xe')]},'bcc':{'type':Sequelize[_0xf27b('0xe')]},'sendIfEmpty':{'type':Sequelize[_0xf27b('0x1')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 6ffa852..6482cb2 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 _0x3ee8=['querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','json','offset','undefined','count','limit','set','reject','save','update','then','destroy','get','Scheduler','status','sendStatus','error','stack','name','send','index','map','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','where','type','VIRTUAL','merge','options','Schedule','includeAll','include','findAll','rows','catch','show','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','run','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js'];(function(_0x8e9386,_0x3cc60f){var _0x4abf26=function(_0x59de5a){while(--_0x59de5a){_0x8e9386['push'](_0x8e9386['shift']());}};_0x4abf26(++_0x3cc60f);}(_0x3ee8,0x192));var _0x83ee=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3ee8[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x83ee('0x0'));var rimraf=require(_0x83ee('0x1'));var zipdir=require(_0x83ee('0x2'));var jsonpatch=require(_0x83ee('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x83ee('0x4'));var Mustache=require('mustache');var util=require(_0x83ee('0x5'));var path=require('path');var sox=require(_0x83ee('0x6'));var csv=require(_0x83ee('0x7'));var ejs=require(_0x83ee('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x83ee('0x9'));var squel=require(_0x83ee('0xa'));var crypto=require('crypto');var jsforce=require(_0x83ee('0xb'));var deskjs=require(_0x83ee('0xc'));var toCsv=require('to-csv');var querystring=require(_0x83ee('0xd'));var Papa=require(_0x83ee('0xe'));var Redis=require(_0x83ee('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x83ee('0x10'));var as=require(_0x83ee('0x11'));var hardwareService=require(_0x83ee('0x12'));var logger=require(_0x83ee('0x13'))(_0x83ee('0x14'));var utils=require(_0x83ee('0x15'));var config=require(_0x83ee('0x16'));var licenseUtil=require(_0x83ee('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x34eae6,_0x4fa7cb){_0x4fa7cb=_0x4fa7cb||0xcc;return function(_0x5451b3){if(_0x5451b3){return _0x34eae6['sendStatus'](_0x4fa7cb);}return _0x34eae6['status'](_0x4fa7cb)['end']();};}function respondWithResult(_0x371ff0,_0x3b2ffd){_0x3b2ffd=_0x3b2ffd||0xc8;return function(_0x5b7dfc){if(_0x5b7dfc){return _0x371ff0['status'](_0x3b2ffd)[_0x83ee('0x18')](_0x5b7dfc);}};}function respondWithFilteredResult(_0x170431,_0x3e45ca){return function(_0xf4554f){if(_0xf4554f){var _0x105c32=typeof _0x3e45ca[_0x83ee('0x19')]===_0x83ee('0x1a')&&typeof _0x3e45ca['limit']===_0x83ee('0x1a');var _0x52cb9a=_0xf4554f[_0x83ee('0x1b')];var _0x4c3053=_0x105c32?0x0:_0x3e45ca[_0x83ee('0x19')];var _0x4f82a6=_0x105c32?_0xf4554f[_0x83ee('0x1b')]:_0x3e45ca['offset']+_0x3e45ca[_0x83ee('0x1c')];var _0x3ae4cf;if(_0x4f82a6>=_0x52cb9a){_0x4f82a6=_0x52cb9a;_0x3ae4cf=0xc8;}else{_0x3ae4cf=0xce;}_0x170431['status'](_0x3ae4cf);return _0x170431[_0x83ee('0x1d')]('Content-Range',_0x4c3053+'-'+_0x4f82a6+'/'+_0x52cb9a)['json'](_0xf4554f);}return null;};}function patchUpdates(_0x504392){return function(_0x4cf25d){try{jsonpatch['apply'](_0x4cf25d,_0x504392,!![]);}catch(_0x5e4367){return BPromise[_0x83ee('0x1e')](_0x5e4367);}return _0x4cf25d[_0x83ee('0x1f')]();};}function saveUpdates(_0x447cad,_0x461b25){return function(_0x28d772){if(_0x28d772){return _0x28d772[_0x83ee('0x20')](_0x447cad)[_0x83ee('0x21')](function(_0x474cfa){return _0x474cfa;});}return null;};}function removeEntity(_0x393e2a,_0xa18527){return function(_0x39d7de){if(_0x39d7de){return _0x39d7de[_0x83ee('0x22')]()[_0x83ee('0x21')](function(){var _0x4b033b=_0x39d7de[_0x83ee('0x23')]({'plain':!![]});var _0x2ccaa6=_0x83ee('0x24');return db['UserProfileResource'][_0x83ee('0x22')]({'where':{'type':_0x2ccaa6,'resourceId':_0x4b033b['id']}})['then'](function(){return _0x39d7de;});})[_0x83ee('0x21')](function(){_0x393e2a[_0x83ee('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x30247c,_0x4de73a){return function(_0x4fccc5){if(!_0x4fccc5){_0x30247c[_0x83ee('0x26')](0x194);}return _0x4fccc5;};}function handleError(_0xa7540b,_0x4fcd12){_0x4fcd12=_0x4fcd12||0x1f4;return function(_0x4baeef){logger[_0x83ee('0x27')](_0x4baeef[_0x83ee('0x28')]);if(_0x4baeef[_0x83ee('0x29')]){delete _0x4baeef[_0x83ee('0x29')];}_0xa7540b[_0x83ee('0x25')](_0x4fcd12)[_0x83ee('0x2a')](_0x4baeef);};}exports[_0x83ee('0x2b')]=function(_0x27aa69,_0x363796){var _0x592ebf={},_0x164882={},_0x96be1f={'count':0x0,'rows':[]};var _0xc8110b=_[_0x83ee('0x2c')](db['Schedule']['rawAttributes'],function(_0x4481ac){return{'name':_0x4481ac[_0x83ee('0x2d')],'type':_0x4481ac['type'][_0x83ee('0x2e')]};});_0x164882[_0x83ee('0x2f')]=_[_0x83ee('0x2c')](_0xc8110b,'name');_0x164882[_0x83ee('0x30')]=_[_0x83ee('0x31')](_0x27aa69[_0x83ee('0x30')]);_0x164882[_0x83ee('0x32')]=_[_0x83ee('0x33')](_0x164882['model'],_0x164882[_0x83ee('0x30')]);_0x592ebf['attributes']=_[_0x83ee('0x33')](_0x164882[_0x83ee('0x2f')],qs[_0x83ee('0x34')](_0x27aa69[_0x83ee('0x30')][_0x83ee('0x34')]));_0x592ebf['attributes']=_0x592ebf[_0x83ee('0x35')][_0x83ee('0x36')]?_0x592ebf[_0x83ee('0x35')]:_0x164882[_0x83ee('0x2f')];if(!_0x27aa69['query'][_0x83ee('0x37')](_0x83ee('0x38'))){_0x592ebf[_0x83ee('0x1c')]=qs[_0x83ee('0x1c')](_0x27aa69[_0x83ee('0x30')][_0x83ee('0x1c')]);_0x592ebf['offset']=qs[_0x83ee('0x19')](_0x27aa69[_0x83ee('0x30')][_0x83ee('0x19')]);}_0x592ebf['order']=qs['sort'](_0x27aa69[_0x83ee('0x30')][_0x83ee('0x39')]);_0x592ebf['where']=qs[_0x83ee('0x32')](_[_0x83ee('0x3a')](_0x27aa69['query'],_0x164882[_0x83ee('0x32')]),_0xc8110b);if(_0x27aa69[_0x83ee('0x30')][_0x83ee('0x3b')]){_0x592ebf[_0x83ee('0x3c')]=_['merge'](_0x592ebf[_0x83ee('0x3c')],{'$or':_[_0x83ee('0x2c')](_0xc8110b,function(_0x39025c){if(_0x39025c[_0x83ee('0x3d')]!==_0x83ee('0x3e')){var _0x5cfe39={};_0x5cfe39[_0x39025c['name']]={'$like':'%'+_0x27aa69[_0x83ee('0x30')]['filter']+'%'};return _0x5cfe39;}})});}_0x592ebf=_[_0x83ee('0x3f')]({},_0x592ebf,_0x27aa69[_0x83ee('0x40')]);var _0x19d4cb={'where':_0x592ebf[_0x83ee('0x3c')]};return db[_0x83ee('0x41')]['count'](_0x19d4cb)[_0x83ee('0x21')](function(_0x3e041a){_0x96be1f[_0x83ee('0x1b')]=_0x3e041a;if(_0x27aa69[_0x83ee('0x30')][_0x83ee('0x42')]){_0x592ebf[_0x83ee('0x43')]=[{'all':!![]}];}return db[_0x83ee('0x41')][_0x83ee('0x44')](_0x592ebf);})[_0x83ee('0x21')](function(_0x47e3ec){_0x96be1f[_0x83ee('0x45')]=_0x47e3ec;return _0x96be1f;})['then'](respondWithFilteredResult(_0x363796,_0x592ebf))[_0x83ee('0x46')](handleError(_0x363796,null));};exports[_0x83ee('0x47')]=function(_0x2f8ff5,_0x14b7f9){var _0x3210d4={'raw':![],'where':{'id':_0x2f8ff5['params']['id']}},_0x48b5c8={};_0x48b5c8[_0x83ee('0x2f')]=_[_0x83ee('0x31')](db[_0x83ee('0x41')]['rawAttributes']);_0x48b5c8[_0x83ee('0x30')]=_[_0x83ee('0x31')](_0x2f8ff5[_0x83ee('0x30')]);_0x48b5c8[_0x83ee('0x32')]=_['intersection'](_0x48b5c8['model'],_0x48b5c8[_0x83ee('0x30')]);_0x3210d4['attributes']=_[_0x83ee('0x33')](_0x48b5c8[_0x83ee('0x2f')],qs[_0x83ee('0x34')](_0x2f8ff5[_0x83ee('0x30')]['fields']));_0x3210d4[_0x83ee('0x35')]=_0x3210d4[_0x83ee('0x35')]['length']?_0x3210d4[_0x83ee('0x35')]:_0x48b5c8[_0x83ee('0x2f')];if(_0x2f8ff5[_0x83ee('0x30')]['includeAll']){_0x3210d4[_0x83ee('0x43')]=[{'all':!![]}];}_0x3210d4=_[_0x83ee('0x3f')]({},_0x3210d4,_0x2f8ff5['options']);return db['Schedule'][_0x83ee('0x48')](_0x3210d4)['then'](handleEntityNotFound(_0x14b7f9,null))['then'](respondWithResult(_0x14b7f9,null))['catch'](handleError(_0x14b7f9,null));};exports[_0x83ee('0x49')]=function(_0x12e87b,_0x567b33){return db['Schedule'][_0x83ee('0x49')](_0x12e87b[_0x83ee('0x4a')],{})[_0x83ee('0x21')](function(_0x3e2f6a){var _0x5cf350=_0x12e87b['user'][_0x83ee('0x23')]({'plain':!![]});if(!_0x5cf350)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5cf350['role']===_0x83ee('0x4b')){var _0x30afc1=_0x3e2f6a[_0x83ee('0x23')]({'plain':!![]});var _0x2e6c3e=_0x83ee('0x24');return db[_0x83ee('0x4c')][_0x83ee('0x48')]({'where':{'name':_0x2e6c3e,'userProfileId':_0x5cf350[_0x83ee('0x4d')]},'raw':!![]})['then'](function(_0x536742){if(_0x536742&&_0x536742[_0x83ee('0x4e')]===0x0){return db[_0x83ee('0x4f')][_0x83ee('0x49')]({'name':_0x30afc1[_0x83ee('0x29')],'resourceId':_0x30afc1['id'],'type':_0x536742[_0x83ee('0x29')],'sectionId':_0x536742['id']},{})[_0x83ee('0x21')](function(){return _0x3e2f6a;});}else{return _0x3e2f6a;}})[_0x83ee('0x46')](function(_0x22ab35){logger['error'](_0x83ee('0x50'),_0x22ab35);throw _0x22ab35;});}return _0x3e2f6a;})['then'](respondWithResult(_0x567b33,0xc9))[_0x83ee('0x46')](handleError(_0x567b33,null));};exports[_0x83ee('0x20')]=function(_0x2062b8,_0xd3bda4){if(_0x2062b8[_0x83ee('0x4a')]['id']){delete _0x2062b8[_0x83ee('0x4a')]['id'];}return db[_0x83ee('0x41')]['find']({'where':{'id':_0x2062b8[_0x83ee('0x51')]['id']}})[_0x83ee('0x21')](handleEntityNotFound(_0xd3bda4,null))[_0x83ee('0x21')](saveUpdates(_0x2062b8['body'],null))['then'](respondWithResult(_0xd3bda4,null))[_0x83ee('0x46')](handleError(_0xd3bda4,null));};exports[_0x83ee('0x22')]=function(_0x2590bd,_0x1829cb){return db['Schedule'][_0x83ee('0x48')]({'where':{'id':_0x2590bd['params']['id']}})[_0x83ee('0x21')](handleEntityNotFound(_0x1829cb,null))[_0x83ee('0x21')](removeEntity(_0x1829cb,null))[_0x83ee('0x46')](handleError(_0x1829cb,null));};exports[_0x83ee('0x52')]=function(_0x131744,_0x4d7af2,_0x9be9){var _0x34549f=require('../../config/schedule');return db['Schedule'][_0x83ee('0x48')]({'where':{'id':_0x131744[_0x83ee('0x51')]['id']},'raw':!![]})[_0x83ee('0x21')](handleEntityNotFound(_0x4d7af2,null))[_0x83ee('0x21')](function(){_0x34549f[_0x83ee('0x52')](_0x131744[_0x83ee('0x51')]['id']);})['then'](respondWithStatusCode(_0x4d7af2,null))['catch'](handleError(_0x4d7af2,null));}; \ No newline at end of file +var _0xa3cc=['UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','run','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','status','end','json','offset','count','limit','set','apply','reject','save','then','destroy','get','Scheduler','UserProfileResource','error','stack','name','send','index','map','Schedule','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','length','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x149bc3,_0x4b09d8){var _0x5d33eb=function(_0x46af03){while(--_0x46af03){_0x149bc3['push'](_0x149bc3['shift']());}};_0x5d33eb(++_0x4b09d8);}(_0xa3cc,0x192));var _0xca3c=function(_0x3a8b41,_0x122312){_0x3a8b41=_0x3a8b41-0x0;var _0x19cb35=_0xa3cc[_0x3a8b41];return _0x19cb35;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xca3c('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xca3c('0x1'));var moment=require(_0xca3c('0x2'));var BPromise=require(_0xca3c('0x3'));var Mustache=require(_0xca3c('0x4'));var util=require(_0xca3c('0x5'));var path=require('path');var sox=require(_0xca3c('0x6'));var csv=require(_0xca3c('0x7'));var ejs=require(_0xca3c('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xca3c('0x9'));var squel=require(_0xca3c('0xa'));var crypto=require('crypto');var jsforce=require(_0xca3c('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xca3c('0x7'));var querystring=require(_0xca3c('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xca3c('0xd'));var as=require(_0xca3c('0xe'));var hardwareService=require(_0xca3c('0xf'));var logger=require(_0xca3c('0x10'))(_0xca3c('0x11'));var utils=require(_0xca3c('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x271d67,_0x5bae29){_0x5bae29=_0x5bae29||0xcc;return function(_0x5469a9){if(_0x5469a9){return _0x271d67['sendStatus'](_0x5bae29);}return _0x271d67[_0xca3c('0x13')](_0x5bae29)[_0xca3c('0x14')]();};}function respondWithResult(_0x2f78dc,_0x40b30c){_0x40b30c=_0x40b30c||0xc8;return function(_0x2e259e){if(_0x2e259e){return _0x2f78dc[_0xca3c('0x13')](_0x40b30c)[_0xca3c('0x15')](_0x2e259e);}};}function respondWithFilteredResult(_0x12de8e,_0x1c93e0){return function(_0x4cfe3c){if(_0x4cfe3c){var _0x187067=typeof _0x1c93e0[_0xca3c('0x16')]==='undefined'&&typeof _0x1c93e0['limit']==='undefined';var _0x42002f=_0x4cfe3c[_0xca3c('0x17')];var _0x2de503=_0x187067?0x0:_0x1c93e0['offset'];var _0x3cb14b=_0x187067?_0x4cfe3c[_0xca3c('0x17')]:_0x1c93e0[_0xca3c('0x16')]+_0x1c93e0[_0xca3c('0x18')];var _0x690549;if(_0x3cb14b>=_0x42002f){_0x3cb14b=_0x42002f;_0x690549=0xc8;}else{_0x690549=0xce;}_0x12de8e['status'](_0x690549);return _0x12de8e[_0xca3c('0x19')]('Content-Range',_0x2de503+'-'+_0x3cb14b+'/'+_0x42002f)['json'](_0x4cfe3c);}return null;};}function patchUpdates(_0x3e1de7){return function(_0x4e1d15){try{jsonpatch[_0xca3c('0x1a')](_0x4e1d15,_0x3e1de7,!![]);}catch(_0x3508af){return BPromise[_0xca3c('0x1b')](_0x3508af);}return _0x4e1d15[_0xca3c('0x1c')]();};}function saveUpdates(_0x5c36e7,_0x98ee5){return function(_0x8384cb){if(_0x8384cb){return _0x8384cb['update'](_0x5c36e7)[_0xca3c('0x1d')](function(_0x41b402){return _0x41b402;});}return null;};}function removeEntity(_0x51cdba,_0x2fea32){return function(_0x54884b){if(_0x54884b){return _0x54884b[_0xca3c('0x1e')]()[_0xca3c('0x1d')](function(){var _0xa3aba6=_0x54884b[_0xca3c('0x1f')]({'plain':!![]});var _0x46282b=_0xca3c('0x20');return db[_0xca3c('0x21')][_0xca3c('0x1e')]({'where':{'type':_0x46282b,'resourceId':_0xa3aba6['id']}})[_0xca3c('0x1d')](function(){return _0x54884b;});})[_0xca3c('0x1d')](function(){_0x51cdba[_0xca3c('0x13')](0xcc)[_0xca3c('0x14')]();});}};}function handleEntityNotFound(_0x3bf5e1,_0x20869e){return function(_0x5f2064){if(!_0x5f2064){_0x3bf5e1['sendStatus'](0x194);}return _0x5f2064;};}function handleError(_0x3cee59,_0x49b472){_0x49b472=_0x49b472||0x1f4;return function(_0x7b2b87){logger[_0xca3c('0x22')](_0x7b2b87[_0xca3c('0x23')]);if(_0x7b2b87[_0xca3c('0x24')]){delete _0x7b2b87[_0xca3c('0x24')];}_0x3cee59[_0xca3c('0x13')](_0x49b472)[_0xca3c('0x25')](_0x7b2b87);};}exports[_0xca3c('0x26')]=function(_0x3039d9,_0x5de701){var _0x5c40ba={},_0x39d263={},_0x5edd5b={'count':0x0,'rows':[]};var _0x597607=_[_0xca3c('0x27')](db[_0xca3c('0x28')][_0xca3c('0x29')],function(_0x28459e){return{'name':_0x28459e[_0xca3c('0x2a')],'type':_0x28459e[_0xca3c('0x2b')][_0xca3c('0x2c')]};});_0x39d263['model']=_[_0xca3c('0x27')](_0x597607,_0xca3c('0x24'));_0x39d263[_0xca3c('0x2d')]=_[_0xca3c('0x2e')](_0x3039d9['query']);_0x39d263[_0xca3c('0x2f')]=_[_0xca3c('0x30')](_0x39d263['model'],_0x39d263['query']);_0x5c40ba['attributes']=_[_0xca3c('0x30')](_0x39d263[_0xca3c('0x31')],qs['fields'](_0x3039d9[_0xca3c('0x2d')][_0xca3c('0x32')]));_0x5c40ba['attributes']=_0x5c40ba['attributes'][_0xca3c('0x33')]?_0x5c40ba[_0xca3c('0x34')]:_0x39d263[_0xca3c('0x31')];if(!_0x3039d9[_0xca3c('0x2d')][_0xca3c('0x35')]('nolimit')){_0x5c40ba['limit']=qs[_0xca3c('0x18')](_0x3039d9['query'][_0xca3c('0x18')]);_0x5c40ba['offset']=qs[_0xca3c('0x16')](_0x3039d9['query'][_0xca3c('0x16')]);}_0x5c40ba[_0xca3c('0x36')]=qs[_0xca3c('0x37')](_0x3039d9[_0xca3c('0x2d')]['sort']);_0x5c40ba[_0xca3c('0x38')]=qs[_0xca3c('0x2f')](_[_0xca3c('0x39')](_0x3039d9['query'],_0x39d263['filters']),_0x597607);if(_0x3039d9['query'][_0xca3c('0x3a')]){_0x5c40ba[_0xca3c('0x38')]=_[_0xca3c('0x3b')](_0x5c40ba[_0xca3c('0x38')],{'$or':_[_0xca3c('0x27')](_0x597607,function(_0x19011a){if(_0x19011a['type']!=='VIRTUAL'){var _0x5ae3d7={};_0x5ae3d7[_0x19011a[_0xca3c('0x24')]]={'$like':'%'+_0x3039d9[_0xca3c('0x2d')][_0xca3c('0x3a')]+'%'};return _0x5ae3d7;}})});}_0x5c40ba=_[_0xca3c('0x3b')]({},_0x5c40ba,_0x3039d9[_0xca3c('0x3c')]);var _0x457d86={'where':_0x5c40ba[_0xca3c('0x38')]};return db['Schedule'][_0xca3c('0x17')](_0x457d86)[_0xca3c('0x1d')](function(_0x31c391){_0x5edd5b[_0xca3c('0x17')]=_0x31c391;if(_0x3039d9[_0xca3c('0x2d')][_0xca3c('0x3d')]){_0x5c40ba[_0xca3c('0x3e')]=[{'all':!![]}];}return db[_0xca3c('0x28')][_0xca3c('0x3f')](_0x5c40ba);})[_0xca3c('0x1d')](function(_0x3e83f0){_0x5edd5b[_0xca3c('0x40')]=_0x3e83f0;return _0x5edd5b;})['then'](respondWithFilteredResult(_0x5de701,_0x5c40ba))[_0xca3c('0x41')](handleError(_0x5de701,null));};exports[_0xca3c('0x42')]=function(_0x2808e9,_0x2d8d7c){var _0x5e7205={'raw':![],'where':{'id':_0x2808e9['params']['id']}},_0x1557af={};_0x1557af[_0xca3c('0x31')]=_[_0xca3c('0x2e')](db['Schedule']['rawAttributes']);_0x1557af[_0xca3c('0x2d')]=_[_0xca3c('0x2e')](_0x2808e9['query']);_0x1557af[_0xca3c('0x2f')]=_['intersection'](_0x1557af['model'],_0x1557af['query']);_0x5e7205[_0xca3c('0x34')]=_[_0xca3c('0x30')](_0x1557af[_0xca3c('0x31')],qs[_0xca3c('0x32')](_0x2808e9[_0xca3c('0x2d')][_0xca3c('0x32')]));_0x5e7205[_0xca3c('0x34')]=_0x5e7205[_0xca3c('0x34')][_0xca3c('0x33')]?_0x5e7205[_0xca3c('0x34')]:_0x1557af[_0xca3c('0x31')];if(_0x2808e9[_0xca3c('0x2d')][_0xca3c('0x3d')]){_0x5e7205['include']=[{'all':!![]}];}_0x5e7205=_[_0xca3c('0x3b')]({},_0x5e7205,_0x2808e9[_0xca3c('0x3c')]);return db[_0xca3c('0x28')][_0xca3c('0x43')](_0x5e7205)[_0xca3c('0x1d')](handleEntityNotFound(_0x2d8d7c,null))[_0xca3c('0x1d')](respondWithResult(_0x2d8d7c,null))[_0xca3c('0x41')](handleError(_0x2d8d7c,null));};exports[_0xca3c('0x44')]=function(_0xadb262,_0x14e2d0){return db[_0xca3c('0x28')][_0xca3c('0x44')](_0xadb262['body'],{})[_0xca3c('0x1d')](function(_0x593221){var _0x2ada23=_0xadb262[_0xca3c('0x45')][_0xca3c('0x1f')]({'plain':!![]});if(!_0x2ada23)throw new Error(_0xca3c('0x46'));if(_0x2ada23[_0xca3c('0x47')]==='user'){var _0x452a47=_0x593221['get']({'plain':!![]});var _0xe20572=_0xca3c('0x20');return db[_0xca3c('0x48')]['find']({'where':{'name':_0xe20572,'userProfileId':_0x2ada23['userProfileId']},'raw':!![]})[_0xca3c('0x1d')](function(_0x30bbe1){if(_0x30bbe1&&_0x30bbe1[_0xca3c('0x49')]===0x0){return db[_0xca3c('0x21')]['create']({'name':_0x452a47[_0xca3c('0x24')],'resourceId':_0x452a47['id'],'type':_0x30bbe1['name'],'sectionId':_0x30bbe1['id']},{})[_0xca3c('0x1d')](function(){return _0x593221;});}else{return _0x593221;}})[_0xca3c('0x41')](function(_0x2c0f5d){logger['error'](_0xca3c('0x4a'),_0x2c0f5d);throw _0x2c0f5d;});}return _0x593221;})[_0xca3c('0x1d')](respondWithResult(_0x14e2d0,0xc9))[_0xca3c('0x41')](handleError(_0x14e2d0,null));};exports[_0xca3c('0x4b')]=function(_0x25c227,_0x72ad4b){if(_0x25c227[_0xca3c('0x4c')]['id']){delete _0x25c227[_0xca3c('0x4c')]['id'];}return db[_0xca3c('0x28')][_0xca3c('0x43')]({'where':{'id':_0x25c227[_0xca3c('0x4d')]['id']}})[_0xca3c('0x1d')](handleEntityNotFound(_0x72ad4b,null))[_0xca3c('0x1d')](saveUpdates(_0x25c227['body'],null))[_0xca3c('0x1d')](respondWithResult(_0x72ad4b,null))['catch'](handleError(_0x72ad4b,null));};exports[_0xca3c('0x1e')]=function(_0xece3c2,_0x50390a){return db[_0xca3c('0x28')]['find']({'where':{'id':_0xece3c2[_0xca3c('0x4d')]['id']}})['then'](handleEntityNotFound(_0x50390a,null))[_0xca3c('0x1d')](removeEntity(_0x50390a,null))[_0xca3c('0x41')](handleError(_0x50390a,null));};exports[_0xca3c('0x4e')]=function(_0x2f2c97,_0x39d32e,_0x49912a){var _0x4e8b36=require('../../config/schedule');return db['Schedule'][_0xca3c('0x43')]({'where':{'id':_0x2f2c97['params']['id']},'raw':!![]})[_0xca3c('0x1d')](handleEntityNotFound(_0x39d32e,null))[_0xca3c('0x1d')](function(){_0x4e8b36[_0xca3c('0x4e')](_0x2f2c97[_0xca3c('0x4d')]['id']);})[_0xca3c('0x1d')](respondWithStatusCode(_0x39d32e,null))[_0xca3c('0x41')](handleError(_0x39d32e,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index b8251a6..e0937fb 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 _0x4cba=['Schedule','tools_schedules','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./schedule.attributes','exports','define'];(function(_0x33e164,_0xcf6baa){var _0x265ed3=function(_0x3a934f){while(--_0x3a934f){_0x33e164['push'](_0x33e164['shift']());}};_0x265ed3(++_0xcf6baa);}(_0x4cba,0xdf));var _0xa4cb=function(_0x1dd86e,_0x3c5f18){_0x1dd86e=_0x1dd86e-0x0;var _0x510e27=_0x4cba[_0x1dd86e];return _0x510e27;};'use strict';var _=require(_0xa4cb('0x0'));var util=require(_0xa4cb('0x1'));var logger=require(_0xa4cb('0x2'))(_0xa4cb('0x3'));var moment=require('moment');var BPromise=require(_0xa4cb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa4cb('0x5'));var rimraf=require(_0xa4cb('0x6'));var config=require(_0xa4cb('0x7'));var attributes=require(_0xa4cb('0x8'));module[_0xa4cb('0x9')]=function(_0x5431b2,_0x3d589e){return _0x5431b2[_0xa4cb('0xa')](_0xa4cb('0xb'),attributes,{'tableName':_0xa4cb('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x42ef=['moment','bluebird','path','rimraf','../../config/environment','./schedule.attributes','tools_schedules','lodash','util','../../config/logger','api'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x42ef,0x15c));var _0xf42e=function(_0x2b4bae,_0xf2ad5d){_0x2b4bae=_0x2b4bae-0x0;var _0x4b73c9=_0x42ef[_0x2b4bae];return _0x4b73c9;};'use strict';var _=require(_0xf42e('0x0'));var util=require(_0xf42e('0x1'));var logger=require(_0xf42e('0x2'))(_0xf42e('0x3'));var moment=require(_0xf42e('0x4'));var BPromise=require(_0xf42e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf42e('0x6'));var rimraf=require(_0xf42e('0x7'));var config=require(_0xf42e('0x8'));var attributes=require(_0xf42e('0x9'));module['exports']=function(_0x24f77c,_0x554ed5){return _0x24f77c['define']('Schedule',attributes,{'tableName':_0xf42e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/schedule/schedule.rpc.js b/server/api/schedule/schedule.rpc.js index 50b0988..c2aeb4e 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 _0xd58d=['message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x90bf88,_0xb760eb){var _0x516c05=function(_0x36543c){while(--_0x36543c){_0x90bf88['push'](_0x90bf88['shift']());}};_0x516c05(++_0xb760eb);}(_0xd58d,0x93));var _0xdd58=function(_0x34ed6f,_0x7e74f2){_0x34ed6f=_0x34ed6f-0x0;var _0x2eae38=_0xd58d[_0x34ed6f];return _0x2eae38;};'use strict';var _=require(_0xdd58('0x0'));var util=require(_0xdd58('0x1'));var moment=require(_0xdd58('0x2'));var BPromise=require(_0xdd58('0x3'));var rs=require(_0xdd58('0x4'));var fs=require('fs');var Redis=require(_0xdd58('0x5'));var db=require(_0xdd58('0x6'))['db'];var utils=require(_0xdd58('0x7'));var logger=require('../../config/logger')(_0xdd58('0x8'));var config=require(_0xdd58('0x9'));var jayson=require(_0xdd58('0xa'));var client=jayson[_0xdd58('0xb')][_0xdd58('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x352386,_0x104327,_0x1863ea){return new BPromise(function(_0x1481eb,_0x57c357){return client['request'](_0x352386,_0x1863ea)[_0xdd58('0xd')](function(_0x421388){logger['info'](_0xdd58('0xe'),_0x104327,_0xdd58('0xf'));logger[_0xdd58('0x10')](_0xdd58('0x11'),_0x104327,'request\x20sent',JSON[_0xdd58('0x12')](_0x421388));if(_0x421388[_0xdd58('0x13')]){if(_0x421388[_0xdd58('0x13')][_0xdd58('0x14')]===0x1f4){logger[_0xdd58('0x13')]('Schedule,\x20%s,\x20%s',_0x104327,_0x421388[_0xdd58('0x13')]['message']);return _0x57c357(_0x421388['error'][_0xdd58('0x15')]);}logger['error'](_0xdd58('0xe'),_0x104327,_0x421388[_0xdd58('0x13')][_0xdd58('0x15')]);return _0x1481eb(_0x421388[_0xdd58('0x13')][_0xdd58('0x15')]);}else{logger[_0xdd58('0x16')](_0xdd58('0xe'),_0x104327,_0xdd58('0xf'));_0x1481eb(_0x421388['result'][_0xdd58('0x15')]);}})[_0xdd58('0x17')](function(_0x3eaf26){logger['error'](_0xdd58('0xe'),_0x104327,_0x3eaf26);_0x57c357(_0x3eaf26);});});} \ No newline at end of file +var _0xd590=['randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','Schedule,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','lodash','util','moment'];(function(_0x1ebc6c,_0x58a00b){var _0x3a826d=function(_0x27d7eb){while(--_0x27d7eb){_0x1ebc6c['push'](_0x1ebc6c['shift']());}};_0x3a826d(++_0x58a00b);}(_0xd590,0x177));var _0x0d59=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd590[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x0d59('0x0'));var util=require(_0x0d59('0x1'));var moment=require(_0x0d59('0x2'));var BPromise=require('bluebird');var rs=require(_0x0d59('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0d59('0x4'))['db'];var utils=require(_0x0d59('0x5'));var logger=require(_0x0d59('0x6'))('rpc');var config=require(_0x0d59('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0d59('0x8')][_0x0d59('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x562461,_0x1c1498,_0x1055b0){return new BPromise(function(_0x3f765d,_0x2ed4a2){return client[_0x0d59('0xa')](_0x562461,_0x1055b0)[_0x0d59('0xb')](function(_0x4a9226){logger[_0x0d59('0xc')](_0x0d59('0xd'),_0x1c1498,'request\x20sent');logger[_0x0d59('0xe')]('Schedule,\x20%s,\x20%s,\x20%s',_0x1c1498,_0x0d59('0xf'),JSON['stringify'](_0x4a9226));if(_0x4a9226[_0x0d59('0x10')]){if(_0x4a9226['error'][_0x0d59('0x11')]===0x1f4){logger[_0x0d59('0x10')](_0x0d59('0xd'),_0x1c1498,_0x4a9226[_0x0d59('0x10')]['message']);return _0x2ed4a2(_0x4a9226[_0x0d59('0x10')][_0x0d59('0x12')]);}logger['error'](_0x0d59('0xd'),_0x1c1498,_0x4a9226[_0x0d59('0x10')]['message']);return _0x3f765d(_0x4a9226['error'][_0x0d59('0x12')]);}else{logger[_0x0d59('0xc')](_0x0d59('0xd'),_0x1c1498,_0x0d59('0xf'));_0x3f765d(_0x4a9226[_0x0d59('0x13')][_0x0d59('0x12')]);}})[_0x0d59('0x14')](function(_0x46ddd3){logger[_0x0d59('0x10')](_0x0d59('0xd'),_0x1c1498,_0x46ddd3);_0x2ed4a2(_0x46ddd3);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 2fecd38..0e6a9fb 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 _0x718b=['../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','index','get','isAuthenticated','show','/:id/download','download','post','/:id','update','destroy','exports','multer','util','express','Router','fs-extra'];(function(_0x3c6835,_0x952d5c){var _0x1adeb9=function(_0xfefab3){while(--_0xfefab3){_0x3c6835['push'](_0x3c6835['shift']());}};_0x1adeb9(++_0x952d5c);}(_0x718b,0xc3));var _0xb718=function(_0x20fb02,_0x96c029){_0x20fb02=_0x20fb02-0x0;var _0x24a33e=_0x718b[_0x20fb02];return _0x24a33e;};'use strict';var multer=require(_0xb718('0x0'));var util=require(_0xb718('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb718('0x2'));var router=express[_0xb718('0x3')]();var fs_extra=require(_0xb718('0x4'));var auth=require(_0xb718('0x5'));var interaction=require(_0xb718('0x6'));var config=require(_0xb718('0x7'));var controller=require(_0xb718('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xb718('0x9')]);router[_0xb718('0xa')]('/describe',auth[_0xb718('0xb')](),controller['describe']);router[_0xb718('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xb718('0xc')]);router[_0xb718('0xa')](_0xb718('0xd'),auth[_0xb718('0xb')](),controller[_0xb718('0xe')]);router[_0xb718('0xf')]('/',auth[_0xb718('0xb')](),controller['create']);router['put'](_0xb718('0x10'),auth['isAuthenticated'](),controller[_0xb718('0x11')]);router['delete'](_0xb718('0x10'),auth['isAuthenticated'](),controller[_0xb718('0x12')]);module[_0xb718('0x13')]=router; \ No newline at end of file +var _0xf32a=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./screenRecording.controller','get','index','/describe','/:id','isAuthenticated','show','/:id/download','download','post','put','update','delete','exports','multer','util','path'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0xf32a,0x19b));var _0xaf32=function(_0x26ecda,_0x276013){_0x26ecda=_0x26ecda-0x0;var _0x302a66=_0xf32a[_0x26ecda];return _0x302a66;};'use strict';var multer=require(_0xaf32('0x0'));var util=require(_0xaf32('0x1'));var path=require(_0xaf32('0x2'));var timeout=require(_0xaf32('0x3'));var express=require(_0xaf32('0x4'));var router=express[_0xaf32('0x5')]();var fs_extra=require(_0xaf32('0x6'));var auth=require(_0xaf32('0x7'));var interaction=require(_0xaf32('0x8'));var config=require('../../config/environment');var controller=require(_0xaf32('0x9'));router[_0xaf32('0xa')]('/',auth['isAuthenticated'](),controller[_0xaf32('0xb')]);router[_0xaf32('0xa')](_0xaf32('0xc'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xaf32('0xd'),auth[_0xaf32('0xe')](),controller[_0xaf32('0xf')]);router[_0xaf32('0xa')](_0xaf32('0x10'),auth[_0xaf32('0xe')](),controller[_0xaf32('0x11')]);router[_0xaf32('0x12')]('/',auth[_0xaf32('0xe')](),controller['create']);router[_0xaf32('0x13')](_0xaf32('0xd'),auth[_0xaf32('0xe')](),controller[_0xaf32('0x14')]);router[_0xaf32('0x15')]('/:id',auth[_0xaf32('0xe')](),controller['destroy']);module[_0xaf32('0x16')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index d201498..8d3f1e9 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 _0xae24=['toString','format','createdAt','updatedAt','path','../../config/environment','exports','VIRTUAL','getDataValue','value','extname','STRING','INTEGER','setDataValue','startedAt','subtract','closedAt','duration','DATE','MM-DD-YYYY\x20HH:mm'];(function(_0x46211f,_0x589dc3){var _0x39f0cd=function(_0x45b161){while(--_0x45b161){_0x46211f['push'](_0x46211f['shift']());}};_0x39f0cd(++_0x589dc3);}(_0xae24,0x180));var _0x4ae2=function(_0x1bca5b,_0x2d5b4f){_0x1bca5b=_0x1bca5b-0x0;var _0x41c255=_0xae24[_0x1bca5b];return _0x41c255;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');var path=require(_0x4ae2('0x0'));var config=require(_0x4ae2('0x1'));module[_0x4ae2('0x2')]={'format':{'type':Sequelize[_0x4ae2('0x3')],'get':function(){return this[_0x4ae2('0x4')](_0x4ae2('0x5'))?path[_0x4ae2('0x6')](this[_0x4ae2('0x4')](_0x4ae2('0x5'))):undefined;}},'interactionid':{'type':Sequelize[_0x4ae2('0x7')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0x4ae2('0x7')],'set':function(_0x46b90b){var _0xda7751=_0x46b90b['replace'](/\\/g,'/');this['setDataValue'](_0x4ae2('0x5'),_0xda7751);}},'rating':{'type':Sequelize[_0x4ae2('0x8')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x4ae2('0x8')],'set':function(_0x1b19cd){this[_0x4ae2('0x9')](_0x4ae2('0xa'),moment()[_0x4ae2('0xb')](_0x1b19cd,'ms'));this[_0x4ae2('0x9')](_0x4ae2('0xc'),moment());this['setDataValue'](_0x4ae2('0xd'),_0x1b19cd);}},'startedAt':{'type':Sequelize[_0x4ae2('0xe')],'get':function(){return moment(this['getDataValue'](_0x4ae2('0xa')))['format'](_0x4ae2('0xf'))[_0x4ae2('0x10')]();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x4ae2('0x4')]('closedAt'))[_0x4ae2('0x11')](_0x4ae2('0xf'))['toString']();}},'createdAt':{'type':Sequelize[_0x4ae2('0xe')],'get':function(){return moment(this[_0x4ae2('0x4')](_0x4ae2('0x12')))[_0x4ae2('0x11')](_0x4ae2('0xf'))[_0x4ae2('0x10')]();}},'updatedAt':{'type':Sequelize[_0x4ae2('0xe')],'get':function(){return moment(this[_0x4ae2('0x4')](_0x4ae2('0x13')))[_0x4ae2('0x11')](_0x4ae2('0xf'))['toString']();}}}; \ No newline at end of file +var _0xacc6=['sequelize','moment','path','../../config/environment','exports','getDataValue','value','extname','STRING','setDataValue','INTEGER','subtract','closedAt','duration','DATE','startedAt','format','MM-DD-YYYY\x20HH:mm','toString','createdAt','updatedAt'];(function(_0x5b3962,_0x58eb95){var _0x2dd647=function(_0x110baf){while(--_0x110baf){_0x5b3962['push'](_0x5b3962['shift']());}};_0x2dd647(++_0x58eb95);}(_0xacc6,0x150));var _0x6acc=function(_0x590851,_0x496bee){_0x590851=_0x590851-0x0;var _0x3b0115=_0xacc6[_0x590851];return _0x3b0115;};'use strict';var Sequelize=require(_0x6acc('0x0'));var moment=require(_0x6acc('0x1'));var path=require(_0x6acc('0x2'));var config=require(_0x6acc('0x3'));module[_0x6acc('0x4')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x6acc('0x5')](_0x6acc('0x6'))?path[_0x6acc('0x7')](this['getDataValue'](_0x6acc('0x6'))):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x6acc('0x8')]},'value':{'type':Sequelize[_0x6acc('0x8')],'set':function(_0x5e7f3a){var _0x41edfd=_0x5e7f3a['replace'](/\\/g,'/');this[_0x6acc('0x9')](_0x6acc('0x6'),_0x41edfd);}},'rating':{'type':Sequelize[_0x6acc('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x6acc('0xa')],'set':function(_0x4d6b7f){this[_0x6acc('0x9')]('startedAt',moment()[_0x6acc('0xb')](_0x4d6b7f,'ms'));this[_0x6acc('0x9')](_0x6acc('0xc'),moment());this[_0x6acc('0x9')](_0x6acc('0xd'),_0x4d6b7f);}},'startedAt':{'type':Sequelize[_0x6acc('0xe')],'get':function(){return moment(this['getDataValue'](_0x6acc('0xf')))[_0x6acc('0x10')](_0x6acc('0x11'))[_0x6acc('0x12')]();}},'closedAt':{'type':Sequelize[_0x6acc('0xe')],'get':function(){return moment(this['getDataValue']('closedAt'))[_0x6acc('0x10')](_0x6acc('0x11'))[_0x6acc('0x12')]();}},'createdAt':{'type':Sequelize[_0x6acc('0xe')],'get':function(){return moment(this[_0x6acc('0x5')](_0x6acc('0x13')))[_0x6acc('0x10')](_0x6acc('0x11'))[_0x6acc('0x12')]();}},'updatedAt':{'type':Sequelize[_0x6acc('0xe')],'get':function(){return moment(this[_0x6acc('0x5')](_0x6acc('0x14')))[_0x6acc('0x10')](_0x6acc('0x11'))[_0x6acc('0x12')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index dccd2b7..ecdd98c 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 _0xed1f=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','ScreenRecording','rawAttributes','fieldName','type','key','differenceBy','map','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','show','params','merge','options','catch','create','body','duration','createdAt','closedAt','value','find','describe','download','../../components/encryptor','uniqueid','join','root','server/files/screen_recordings','format','decryptFile','secrets','recording','existsSync','Sequelize','ValidationError','filename','extname','unlink','message','ScreenRecording\x20not\x20found','Not\x20found','isNil','Entity\x20not\x20found','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','eml-format','rimraf'];(function(_0x278ecc,_0x4191e4){var _0x40ee55=function(_0xa3957){while(--_0xa3957){_0x278ecc['push'](_0x278ecc['shift']());}};_0x40ee55(++_0x4191e4);}(_0xed1f,0x6a));var _0xfed1=function(_0x11c573,_0x9e7c6e){_0x11c573=_0x11c573-0x0;var _0x6b72de=_0xed1f[_0x11c573];return _0x6b72de;};'use strict';var emlformat=require(_0xfed1('0x0'));var rimraf=require(_0xfed1('0x1'));var zipdir=require(_0xfed1('0x2'));var jsonpatch=require(_0xfed1('0x3'));var rp=require(_0xfed1('0x4'));var moment=require(_0xfed1('0x5'));var BPromise=require(_0xfed1('0x6'));var Mustache=require(_0xfed1('0x7'));var util=require(_0xfed1('0x8'));var path=require(_0xfed1('0x9'));var sox=require(_0xfed1('0xa'));var csv=require(_0xfed1('0xb'));var ejs=require(_0xfed1('0xc'));var fs=require('fs');var fs_extra=require(_0xfed1('0xd'));var _=require(_0xfed1('0xe'));var squel=require(_0xfed1('0xf'));var crypto=require(_0xfed1('0x10'));var jsforce=require(_0xfed1('0x11'));var deskjs=require('desk.js');var toCsv=require(_0xfed1('0xb'));var querystring=require(_0xfed1('0x12'));var Papa=require('papaparse');var Redis=require(_0xfed1('0x13'));var authService=require(_0xfed1('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xfed1('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfed1('0x16'))(_0xfed1('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xfed1('0x18'));var db=require(_0xfed1('0x19'))['db'];function respondWithStatusCode(_0x569a6e,_0x17f4fe){_0x17f4fe=_0x17f4fe||0xcc;return function(_0x5a3469){if(_0x5a3469){return _0x569a6e['sendStatus'](_0x17f4fe);}return _0x569a6e[_0xfed1('0x1a')](_0x17f4fe)[_0xfed1('0x1b')]();};}function respondWithResult(_0x532537,_0x2dde3a){_0x2dde3a=_0x2dde3a||0xc8;return function(_0x5b9455){if(_0x5b9455){return _0x532537['status'](_0x2dde3a)[_0xfed1('0x1c')](_0x5b9455);}};}function respondWithFilteredResult(_0x39aa0c,_0x1fbb7a){return function(_0x123c46){if(_0x123c46){var _0x582e67=typeof _0x1fbb7a[_0xfed1('0x1d')]==='undefined'&&typeof _0x1fbb7a[_0xfed1('0x1e')]===_0xfed1('0x1f');var _0x489a0f=_0x123c46[_0xfed1('0x20')];var _0xa72a20=_0x582e67?0x0:_0x1fbb7a['offset'];var _0x59509b=_0x582e67?_0x123c46['count']:_0x1fbb7a[_0xfed1('0x1d')]+_0x1fbb7a['limit'];var _0x201f18;if(_0x59509b>=_0x489a0f){_0x59509b=_0x489a0f;_0x201f18=0xc8;}else{_0x201f18=0xce;}_0x39aa0c[_0xfed1('0x1a')](_0x201f18);return _0x39aa0c['set'](_0xfed1('0x21'),_0xa72a20+'-'+_0x59509b+'/'+_0x489a0f)[_0xfed1('0x1c')](_0x123c46);}return null;};}function patchUpdates(_0x59ee9d){return function(_0x3ce944){try{jsonpatch[_0xfed1('0x22')](_0x3ce944,_0x59ee9d,!![]);}catch(_0xff4842){return BPromise[_0xfed1('0x23')](_0xff4842);}return _0x3ce944['save']();};}function saveUpdates(_0x203cec,_0x59333e){return function(_0x446558){if(_0x446558){return _0x446558[_0xfed1('0x24')](_0x203cec)[_0xfed1('0x25')](function(_0x532ec2){return _0x532ec2;});}return null;};}function removeEntity(_0x41d22c,_0x594917){return function(_0x460555){if(_0x460555){return _0x460555[_0xfed1('0x26')]()[_0xfed1('0x25')](function(){_0x41d22c[_0xfed1('0x1a')](0xcc)[_0xfed1('0x1b')]();});}};}function handleEntityNotFound(_0x1199b7,_0x527fc7){return function(_0x465ce6){if(!_0x465ce6){_0x1199b7[_0xfed1('0x27')](0x194);}return _0x465ce6;};}function handleError(_0x49072b,_0x1d6c72){_0x1d6c72=_0x1d6c72||0x1f4;return function(_0x2b9dd2){logger[_0xfed1('0x28')](_0x2b9dd2[_0xfed1('0x29')]);if(_0x2b9dd2[_0xfed1('0x2a')]){delete _0x2b9dd2[_0xfed1('0x2a')];}_0x49072b['status'](_0x1d6c72)[_0xfed1('0x2b')](_0x2b9dd2);};}exports['index']=function(_0x3106ee,_0x4e5249){var _0x53b0c9={},_0x1cec64={},_0x42c950={'count':0x0,'rows':[]};var _0x2d334e=_['map'](db[_0xfed1('0x2c')][_0xfed1('0x2d')],function(_0x13f414){return{'name':_0x13f414[_0xfed1('0x2e')],'type':_0x13f414[_0xfed1('0x2f')][_0xfed1('0x30')]};});_0x1cec64['model']=_[_0xfed1('0x31')](_[_0xfed1('0x32')](_0x2d334e,'name'),['format']);_0x1cec64[_0xfed1('0x33')]=_[_0xfed1('0x34')](_0x3106ee[_0xfed1('0x33')]);_0x1cec64[_0xfed1('0x35')]=_[_0xfed1('0x36')](_0x1cec64['model'],_0x1cec64[_0xfed1('0x33')]);_0x53b0c9[_0xfed1('0x37')]=_[_0xfed1('0x36')](_0x1cec64[_0xfed1('0x38')],qs[_0xfed1('0x39')](_0x3106ee['query'][_0xfed1('0x39')]));_0x53b0c9['attributes']=_0x53b0c9[_0xfed1('0x37')][_0xfed1('0x3a')]?_0x53b0c9[_0xfed1('0x37')]:_0x1cec64[_0xfed1('0x38')];if(!_0x3106ee[_0xfed1('0x33')][_0xfed1('0x3b')](_0xfed1('0x3c'))){_0x53b0c9[_0xfed1('0x1e')]=qs['limit'](_0x3106ee[_0xfed1('0x33')][_0xfed1('0x1e')]);_0x53b0c9[_0xfed1('0x1d')]=qs[_0xfed1('0x1d')](_0x3106ee['query']['offset']);}_0x53b0c9[_0xfed1('0x3d')]=qs[_0xfed1('0x3e')](_0x3106ee[_0xfed1('0x33')][_0xfed1('0x3e')]);_0x53b0c9[_0xfed1('0x3f')]=qs[_0xfed1('0x35')](_[_0xfed1('0x40')](_0x3106ee[_0xfed1('0x33')],_0x1cec64['filters']),_0x2d334e);if(_0x3106ee['query'][_0xfed1('0x41')]){_0x53b0c9[_0xfed1('0x3f')]=_['merge'](_0x53b0c9[_0xfed1('0x3f')],{'$or':_[_0xfed1('0x32')](_0x2d334e,function(_0x3b0973){if(_0x3b0973[_0xfed1('0x2f')]!==_0xfed1('0x42')){var _0x31ffeb={};_0x31ffeb[_0x3b0973[_0xfed1('0x2a')]]={'$like':'%'+_0x3106ee[_0xfed1('0x33')][_0xfed1('0x41')]+'%'};return _0x31ffeb;}})});}_0x53b0c9=_['merge']({},_0x53b0c9,_0x3106ee['options']);var _0x5598dc={'where':_0x53b0c9[_0xfed1('0x3f')]};return db[_0xfed1('0x2c')][_0xfed1('0x20')](_0x5598dc)['then'](function(_0x3454e6){_0x42c950['count']=_0x3454e6;if(_0x3106ee[_0xfed1('0x33')][_0xfed1('0x43')]){_0x53b0c9[_0xfed1('0x44')]=[{'all':!![]}];}return db['ScreenRecording'][_0xfed1('0x45')](_0x53b0c9);})[_0xfed1('0x25')](function(_0x422433){_0x42c950['rows']=_0x422433;return _0x42c950;})[_0xfed1('0x25')](respondWithFilteredResult(_0x4e5249,_0x53b0c9))['catch'](handleError(_0x4e5249,null));};exports[_0xfed1('0x46')]=function(_0xf1f739,_0x229fc7){var _0x13c087={'raw':![],'where':{'id':_0xf1f739[_0xfed1('0x47')]['id']}},_0x1bfbe8={};_0x1bfbe8[_0xfed1('0x38')]=_[_0xfed1('0x34')](db[_0xfed1('0x2c')]['rawAttributes']);_0x1bfbe8[_0xfed1('0x33')]=_[_0xfed1('0x34')](_0xf1f739[_0xfed1('0x33')]);_0x1bfbe8['filters']=_['intersection'](_0x1bfbe8[_0xfed1('0x38')],_0x1bfbe8[_0xfed1('0x33')]);_0x13c087[_0xfed1('0x37')]=_[_0xfed1('0x36')](_0x1bfbe8[_0xfed1('0x38')],qs[_0xfed1('0x39')](_0xf1f739[_0xfed1('0x33')][_0xfed1('0x39')]));_0x13c087[_0xfed1('0x37')]=_0x13c087[_0xfed1('0x37')][_0xfed1('0x3a')]?_0x13c087[_0xfed1('0x37')]:_0x1bfbe8['model'];if(_0xf1f739[_0xfed1('0x33')][_0xfed1('0x43')]){_0x13c087[_0xfed1('0x44')]=[{'all':!![]}];}_0x13c087=_[_0xfed1('0x48')]({},_0x13c087,_0xf1f739[_0xfed1('0x49')]);return db[_0xfed1('0x2c')]['find'](_0x13c087)[_0xfed1('0x25')](handleEntityNotFound(_0x229fc7,null))[_0xfed1('0x25')](respondWithResult(_0x229fc7,null))[_0xfed1('0x4a')](handleError(_0x229fc7,null));};exports['create']=function(_0x22874a,_0x10f98d){return db[_0xfed1('0x2c')][_0xfed1('0x4b')](_0x22874a['body'],{})[_0xfed1('0x25')](respondWithResult(_0x10f98d,0xc9))[_0xfed1('0x4a')](handleError(_0x10f98d,null));};exports[_0xfed1('0x24')]=function(_0x42761f,_0x14745e){if(_0x42761f[_0xfed1('0x4c')]['id']){delete _0x42761f[_0xfed1('0x4c')]['id'];}delete _0x42761f[_0xfed1('0x4c')][_0xfed1('0x4d')];delete _0x42761f[_0xfed1('0x4c')][_0xfed1('0x4e')];delete _0x42761f[_0xfed1('0x4c')][_0xfed1('0x4f')];delete _0x42761f[_0xfed1('0x4c')][_0xfed1('0x50')];return db[_0xfed1('0x2c')][_0xfed1('0x51')]({'where':{'id':_0x42761f[_0xfed1('0x47')]['id']}})['then'](handleEntityNotFound(_0x14745e,null))['then'](saveUpdates(_0x42761f[_0xfed1('0x4c')],null))[_0xfed1('0x25')](respondWithResult(_0x14745e,null))[_0xfed1('0x4a')](handleError(_0x14745e,null));};exports[_0xfed1('0x52')]=function(_0x5da599,_0x3c2534){return db[_0xfed1('0x2c')]['describe']()['then'](respondWithResult(_0x3c2534,null))['catch'](handleError(_0x3c2534,null));};exports[_0xfed1('0x53')]=function(_0x1aaa3d,_0x15e90f,_0x1d8ef2){var _0x2665c8=require(_0xfed1('0x54'));var _0x1a9f22=![];var _0x144102={};if(_0x1aaa3d[_0xfed1('0x33')][_0xfed1('0x2f')]&&_0x1aaa3d['query']['type']===_0xfed1('0x55')){_0x144102[_0xfed1('0x55')]=_0x1aaa3d[_0xfed1('0x47')]['id'];}else{_0x144102['id']=_0x1aaa3d[_0xfed1('0x47')]['id'];}return db[_0xfed1('0x2c')][_0xfed1('0x51')]({'where':_0x144102,'attributes':['id',_0xfed1('0x50')],'raw':!![]})[_0xfed1('0x25')](handleEntityNotFound(_0x15e90f,null))[_0xfed1('0x25')](function(_0x427fa6){if(_0x427fa6){var _0xbd49dc=path[_0xfed1('0x56')](config[_0xfed1('0x57')],_0xfed1('0x58'),_0x427fa6[_0xfed1('0x50')]);var _0x3a7a42=util[_0xfed1('0x59')]('%s.cypher',_0xbd49dc);if(fs['existsSync'](_0x3a7a42)){_0x1a9f22=!![];return _0x2665c8[_0xfed1('0x5a')](_0x3a7a42,_0xbd49dc,config[_0xfed1('0x5b')][_0xfed1('0x5c')])[_0xfed1('0x25')](function(){return _0x427fa6;});}return _0x427fa6;}})[_0xfed1('0x25')](function(_0x41a22a){if(_0x41a22a){var _0x2ccdc3=path[_0xfed1('0x56')](config[_0xfed1('0x57')],_0xfed1('0x58'),_0x41a22a[_0xfed1('0x50')]);if(!fs[_0xfed1('0x5d')](_0x2ccdc3)){throw new db[(_0xfed1('0x5e'))][(_0xfed1('0x5f'))]('ScreenRecording\x20not\x20found');}if(_0x41a22a[_0xfed1('0x60')]){return _0x15e90f['download'](_0x2ccdc3,_0x41a22a['filename']+path[_0xfed1('0x61')](_0x2ccdc3),function(){if(_0x1a9f22){fs['unlink'](_0x2ccdc3);}});}else{return _0x15e90f[_0xfed1('0x53')](_0x2ccdc3,function(_0x5acc45){if(_0x1a9f22){fs[_0xfed1('0x62')](_0x2ccdc3);}});}}})[_0xfed1('0x4a')](function(_0x53f0ab){if(_0x53f0ab[_0xfed1('0x63')]===_0xfed1('0x64')){_0x15e90f['status'](0x194)[_0xfed1('0x2b')](_0xfed1('0x65'));}else{return handleError(_0x15e90f,null);}});};exports[_0xfed1('0x26')]=function(_0x2f37b9,_0x59a23a){return db[_0xfed1('0x2c')][_0xfed1('0x51')]({'where':{'id':_0x2f37b9[_0xfed1('0x47')]['id']}})[_0xfed1('0x25')](function(_0x23347a){if(_[_0xfed1('0x66')](_0x23347a)){throw new ReferenceError(_0xfed1('0x67'));}return _0x23347a;})[_0xfed1('0x25')](function(_0x5c043d){var _0x2d66ec=path[_0xfed1('0x56')](config[_0xfed1('0x57')],_0xfed1('0x58'),_0x5c043d[_0xfed1('0x50')]);logger[_0xfed1('0x68')]('cancellazione\x20fisica\x20documento\x20%s',_0x2d66ec);if(!_['isNil'](_0x5c043d['value'])&&fs[_0xfed1('0x5d')](_0x2d66ec)){logger[_0xfed1('0x68')](_0xfed1('0x69')+_0x2d66ec+_0xfed1('0x6a'));fs['unlinkSync'](_0x2d66ec);}_0x2d66ec=_0x2d66ec+_0xfed1('0x6b');if(!_['isNil'](_0x5c043d[_0xfed1('0x50')])&&fs[_0xfed1('0x5d')](_0x2d66ec)){logger[_0xfed1('0x68')](_0xfed1('0x69')+_0x2d66ec+_0xfed1('0x6a'));fs['unlinkSync'](_0x2d66ec);}return _0x5c043d;})[_0xfed1('0x25')](function(_0x6b74cb){if(!_0x6b74cb)throw new InternalError();return _0x6b74cb[_0xfed1('0x26')]();})['then'](function(){_0x59a23a[_0xfed1('0x1a')](0xcc)[_0xfed1('0x1b')]();})[_0xfed1('0x4a')](handleError(_0x59a23a,null));}; \ No newline at end of file +var _0x5fd1=['body','duration','createdAt','closedAt','describe','../../components/encryptor','uniqueid','join','value','format','%s.cypher','decryptFile','secrets','recording','root','server/files/screen_recordings','existsSync','Sequelize','filename','download','extname','unlink','message','ScreenRecording\x20not\x20found','Not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','offset','set','Content-Range','apply','update','then','destroy','end','error','name','send','index','map','ScreenRecording','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','type','VIRTUAL','filter','options','count','include','findAll','rows','catch','show','params','rawAttributes','merge','find','create'];(function(_0x5936ad,_0x199c60){var _0x26bed2=function(_0x1035c4){while(--_0x1035c4){_0x5936ad['push'](_0x5936ad['shift']());}};_0x26bed2(++_0x199c60);}(_0x5fd1,0x155));var _0x15fd=function(_0x586f0e,_0x3a2338){_0x586f0e=_0x586f0e-0x0;var _0xcba921=_0x5fd1[_0x586f0e];return _0xcba921;};'use strict';var emlformat=require(_0x15fd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x15fd('0x1'));var jsonpatch=require(_0x15fd('0x2'));var rp=require(_0x15fd('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x15fd('0x4'));var util=require(_0x15fd('0x5'));var path=require(_0x15fd('0x6'));var sox=require('sox');var csv=require(_0x15fd('0x7'));var ejs=require(_0x15fd('0x8'));var fs=require('fs');var fs_extra=require(_0x15fd('0x9'));var _=require(_0x15fd('0xa'));var squel=require(_0x15fd('0xb'));var crypto=require('crypto');var jsforce=require(_0x15fd('0xc'));var deskjs=require(_0x15fd('0xd'));var toCsv=require(_0x15fd('0x7'));var querystring=require('querystring');var Papa=require(_0x15fd('0xe'));var Redis=require('ioredis');var authService=require(_0x15fd('0xf'));var qs=require(_0x15fd('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x15fd('0x11'));var utils=require(_0x15fd('0x12'));var config=require(_0x15fd('0x13'));var licenseUtil=require(_0x15fd('0x14'));var db=require(_0x15fd('0x15'))['db'];function respondWithStatusCode(_0x2e18ec,_0x346ab1){_0x346ab1=_0x346ab1||0xcc;return function(_0x2660db){if(_0x2660db){return _0x2e18ec[_0x15fd('0x16')](_0x346ab1);}return _0x2e18ec['status'](_0x346ab1)['end']();};}function respondWithResult(_0x5784a3,_0x3fda60){_0x3fda60=_0x3fda60||0xc8;return function(_0x135a15){if(_0x135a15){return _0x5784a3[_0x15fd('0x17')](_0x3fda60)[_0x15fd('0x18')](_0x135a15);}};}function respondWithFilteredResult(_0x44eae6,_0x2ffa03){return function(_0x2c5375){if(_0x2c5375){var _0x44a63a=typeof _0x2ffa03['offset']==='undefined'&&typeof _0x2ffa03[_0x15fd('0x19')]==='undefined';var _0x7afe9c=_0x2c5375['count'];var _0x917fe4=_0x44a63a?0x0:_0x2ffa03[_0x15fd('0x1a')];var _0x855bae=_0x44a63a?_0x2c5375['count']:_0x2ffa03[_0x15fd('0x1a')]+_0x2ffa03[_0x15fd('0x19')];var _0x8b7b9e;if(_0x855bae>=_0x7afe9c){_0x855bae=_0x7afe9c;_0x8b7b9e=0xc8;}else{_0x8b7b9e=0xce;}_0x44eae6[_0x15fd('0x17')](_0x8b7b9e);return _0x44eae6[_0x15fd('0x1b')](_0x15fd('0x1c'),_0x917fe4+'-'+_0x855bae+'/'+_0x7afe9c)[_0x15fd('0x18')](_0x2c5375);}return null;};}function patchUpdates(_0x2f46f1){return function(_0x1b8b9f){try{jsonpatch[_0x15fd('0x1d')](_0x1b8b9f,_0x2f46f1,!![]);}catch(_0x3ff307){return BPromise['reject'](_0x3ff307);}return _0x1b8b9f['save']();};}function saveUpdates(_0x293d7b,_0x36b21e){return function(_0x252a1c){if(_0x252a1c){return _0x252a1c[_0x15fd('0x1e')](_0x293d7b)[_0x15fd('0x1f')](function(_0x11496a){return _0x11496a;});}return null;};}function removeEntity(_0x2073da,_0x50d493){return function(_0x40d43){if(_0x40d43){return _0x40d43[_0x15fd('0x20')]()[_0x15fd('0x1f')](function(){_0x2073da['status'](0xcc)[_0x15fd('0x21')]();});}};}function handleEntityNotFound(_0x49062f,_0x3d1835){return function(_0x1fc24f){if(!_0x1fc24f){_0x49062f[_0x15fd('0x16')](0x194);}return _0x1fc24f;};}function handleError(_0x4c9708,_0x16b87c){_0x16b87c=_0x16b87c||0x1f4;return function(_0x1cbf2c){logger[_0x15fd('0x22')](_0x1cbf2c['stack']);if(_0x1cbf2c[_0x15fd('0x23')]){delete _0x1cbf2c['name'];}_0x4c9708[_0x15fd('0x17')](_0x16b87c)[_0x15fd('0x24')](_0x1cbf2c);};}exports[_0x15fd('0x25')]=function(_0x27d2c4,_0x233ed3){var _0x6c213b={},_0x218034={},_0xe650a3={'count':0x0,'rows':[]};var _0x4590a1=_[_0x15fd('0x26')](db[_0x15fd('0x27')]['rawAttributes'],function(_0x47c22c){return{'name':_0x47c22c[_0x15fd('0x28')],'type':_0x47c22c['type'][_0x15fd('0x29')]};});_0x218034[_0x15fd('0x2a')]=_['differenceBy'](_[_0x15fd('0x26')](_0x4590a1,_0x15fd('0x23')),['format']);_0x218034[_0x15fd('0x2b')]=_[_0x15fd('0x2c')](_0x27d2c4[_0x15fd('0x2b')]);_0x218034[_0x15fd('0x2d')]=_[_0x15fd('0x2e')](_0x218034[_0x15fd('0x2a')],_0x218034['query']);_0x6c213b[_0x15fd('0x2f')]=_[_0x15fd('0x2e')](_0x218034[_0x15fd('0x2a')],qs[_0x15fd('0x30')](_0x27d2c4['query'][_0x15fd('0x30')]));_0x6c213b[_0x15fd('0x2f')]=_0x6c213b[_0x15fd('0x2f')][_0x15fd('0x31')]?_0x6c213b[_0x15fd('0x2f')]:_0x218034[_0x15fd('0x2a')];if(!_0x27d2c4['query'][_0x15fd('0x32')](_0x15fd('0x33'))){_0x6c213b['limit']=qs[_0x15fd('0x19')](_0x27d2c4[_0x15fd('0x2b')][_0x15fd('0x19')]);_0x6c213b['offset']=qs[_0x15fd('0x1a')](_0x27d2c4[_0x15fd('0x2b')][_0x15fd('0x1a')]);}_0x6c213b[_0x15fd('0x34')]=qs[_0x15fd('0x35')](_0x27d2c4[_0x15fd('0x2b')]['sort']);_0x6c213b['where']=qs['filters'](_[_0x15fd('0x36')](_0x27d2c4[_0x15fd('0x2b')],_0x218034[_0x15fd('0x2d')]),_0x4590a1);if(_0x27d2c4['query']['filter']){_0x6c213b[_0x15fd('0x37')]=_['merge'](_0x6c213b['where'],{'$or':_['map'](_0x4590a1,function(_0x2edb0d){if(_0x2edb0d[_0x15fd('0x38')]!==_0x15fd('0x39')){var _0x59d0d7={};_0x59d0d7[_0x2edb0d[_0x15fd('0x23')]]={'$like':'%'+_0x27d2c4[_0x15fd('0x2b')][_0x15fd('0x3a')]+'%'};return _0x59d0d7;}})});}_0x6c213b=_['merge']({},_0x6c213b,_0x27d2c4[_0x15fd('0x3b')]);var _0x1c4d40={'where':_0x6c213b[_0x15fd('0x37')]};return db[_0x15fd('0x27')][_0x15fd('0x3c')](_0x1c4d40)[_0x15fd('0x1f')](function(_0x19a29f){_0xe650a3[_0x15fd('0x3c')]=_0x19a29f;if(_0x27d2c4[_0x15fd('0x2b')]['includeAll']){_0x6c213b[_0x15fd('0x3d')]=[{'all':!![]}];}return db[_0x15fd('0x27')][_0x15fd('0x3e')](_0x6c213b);})[_0x15fd('0x1f')](function(_0x2d2b6f){_0xe650a3[_0x15fd('0x3f')]=_0x2d2b6f;return _0xe650a3;})[_0x15fd('0x1f')](respondWithFilteredResult(_0x233ed3,_0x6c213b))[_0x15fd('0x40')](handleError(_0x233ed3,null));};exports[_0x15fd('0x41')]=function(_0x104eef,_0x2eb6b6){var _0x145eab={'raw':![],'where':{'id':_0x104eef[_0x15fd('0x42')]['id']}},_0x269aae={};_0x269aae[_0x15fd('0x2a')]=_['keys'](db[_0x15fd('0x27')][_0x15fd('0x43')]);_0x269aae[_0x15fd('0x2b')]=_[_0x15fd('0x2c')](_0x104eef[_0x15fd('0x2b')]);_0x269aae[_0x15fd('0x2d')]=_[_0x15fd('0x2e')](_0x269aae[_0x15fd('0x2a')],_0x269aae['query']);_0x145eab['attributes']=_[_0x15fd('0x2e')](_0x269aae['model'],qs[_0x15fd('0x30')](_0x104eef[_0x15fd('0x2b')]['fields']));_0x145eab[_0x15fd('0x2f')]=_0x145eab[_0x15fd('0x2f')][_0x15fd('0x31')]?_0x145eab[_0x15fd('0x2f')]:_0x269aae[_0x15fd('0x2a')];if(_0x104eef[_0x15fd('0x2b')]['includeAll']){_0x145eab[_0x15fd('0x3d')]=[{'all':!![]}];}_0x145eab=_[_0x15fd('0x44')]({},_0x145eab,_0x104eef[_0x15fd('0x3b')]);return db[_0x15fd('0x27')][_0x15fd('0x45')](_0x145eab)[_0x15fd('0x1f')](handleEntityNotFound(_0x2eb6b6,null))[_0x15fd('0x1f')](respondWithResult(_0x2eb6b6,null))[_0x15fd('0x40')](handleError(_0x2eb6b6,null));};exports[_0x15fd('0x46')]=function(_0x1d3beb,_0x16b4f5){return db[_0x15fd('0x27')]['create'](_0x1d3beb[_0x15fd('0x47')],{})['then'](respondWithResult(_0x16b4f5,0xc9))[_0x15fd('0x40')](handleError(_0x16b4f5,null));};exports[_0x15fd('0x1e')]=function(_0xeb1e06,_0x5a1f32){if(_0xeb1e06[_0x15fd('0x47')]['id']){delete _0xeb1e06[_0x15fd('0x47')]['id'];}delete _0xeb1e06[_0x15fd('0x47')][_0x15fd('0x48')];delete _0xeb1e06['body'][_0x15fd('0x49')];delete _0xeb1e06[_0x15fd('0x47')][_0x15fd('0x4a')];delete _0xeb1e06[_0x15fd('0x47')]['value'];return db[_0x15fd('0x27')][_0x15fd('0x45')]({'where':{'id':_0xeb1e06['params']['id']}})['then'](handleEntityNotFound(_0x5a1f32,null))['then'](saveUpdates(_0xeb1e06[_0x15fd('0x47')],null))[_0x15fd('0x1f')](respondWithResult(_0x5a1f32,null))[_0x15fd('0x40')](handleError(_0x5a1f32,null));};exports[_0x15fd('0x4b')]=function(_0x292174,_0x33a128){return db['ScreenRecording'][_0x15fd('0x4b')]()[_0x15fd('0x1f')](respondWithResult(_0x33a128,null))[_0x15fd('0x40')](handleError(_0x33a128,null));};exports['download']=function(_0x30c4e3,_0x4dd1d5,_0x3a48e7){var _0x2886e3=require(_0x15fd('0x4c'));var _0x42d4de=![];var _0x332df7={};if(_0x30c4e3[_0x15fd('0x2b')][_0x15fd('0x38')]&&_0x30c4e3[_0x15fd('0x2b')][_0x15fd('0x38')]===_0x15fd('0x4d')){_0x332df7[_0x15fd('0x4d')]=_0x30c4e3[_0x15fd('0x42')]['id'];}else{_0x332df7['id']=_0x30c4e3[_0x15fd('0x42')]['id'];}return db['ScreenRecording'][_0x15fd('0x45')]({'where':_0x332df7,'attributes':['id','value'],'raw':!![]})[_0x15fd('0x1f')](handleEntityNotFound(_0x4dd1d5,null))['then'](function(_0x25bdea){if(_0x25bdea){var _0x1fac7f=path[_0x15fd('0x4e')](config['root'],'server/files/screen_recordings',_0x25bdea[_0x15fd('0x4f')]);var _0xc9c5ef=util[_0x15fd('0x50')](_0x15fd('0x51'),_0x1fac7f);if(fs['existsSync'](_0xc9c5ef)){_0x42d4de=!![];return _0x2886e3[_0x15fd('0x52')](_0xc9c5ef,_0x1fac7f,config[_0x15fd('0x53')][_0x15fd('0x54')])[_0x15fd('0x1f')](function(){return _0x25bdea;});}return _0x25bdea;}})[_0x15fd('0x1f')](function(_0x321fe7){if(_0x321fe7){var _0x59b3b4=path[_0x15fd('0x4e')](config[_0x15fd('0x55')],_0x15fd('0x56'),_0x321fe7[_0x15fd('0x4f')]);if(!fs[_0x15fd('0x57')](_0x59b3b4)){throw new db[(_0x15fd('0x58'))]['ValidationError']('ScreenRecording\x20not\x20found');}if(_0x321fe7[_0x15fd('0x59')]){return _0x4dd1d5[_0x15fd('0x5a')](_0x59b3b4,_0x321fe7['filename']+path[_0x15fd('0x5b')](_0x59b3b4),function(){if(_0x42d4de){fs[_0x15fd('0x5c')](_0x59b3b4);}});}else{return _0x4dd1d5['download'](_0x59b3b4,function(_0x285fd5){if(_0x42d4de){fs[_0x15fd('0x5c')](_0x59b3b4);}});}}})[_0x15fd('0x40')](function(_0x53bfd7){if(_0x53bfd7[_0x15fd('0x5d')]===_0x15fd('0x5e')){_0x4dd1d5[_0x15fd('0x17')](0x194)[_0x15fd('0x24')](_0x15fd('0x5f'));}else{return handleError(_0x4dd1d5,null);}});};exports[_0x15fd('0x20')]=function(_0xa1bb5c,_0x290497){return db[_0x15fd('0x27')][_0x15fd('0x45')]({'where':{'id':_0xa1bb5c['params']['id']}})[_0x15fd('0x1f')](function(_0x3a26c8){if(_['isNil'](_0x3a26c8)){throw new ReferenceError('Entity\x20not\x20found');}return _0x3a26c8;})[_0x15fd('0x1f')](function(_0x39e6ee){var _0x2bd6ef=path[_0x15fd('0x4e')](config[_0x15fd('0x55')],_0x15fd('0x56'),_0x39e6ee['value']);logger[_0x15fd('0x60')](_0x15fd('0x61'),_0x2bd6ef);if(!_[_0x15fd('0x62')](_0x39e6ee[_0x15fd('0x4f')])&&fs[_0x15fd('0x57')](_0x2bd6ef)){logger[_0x15fd('0x60')](_0x15fd('0x63')+_0x2bd6ef+_0x15fd('0x64'));fs[_0x15fd('0x65')](_0x2bd6ef);}_0x2bd6ef=_0x2bd6ef+_0x15fd('0x66');if(!_[_0x15fd('0x62')](_0x39e6ee['value'])&&fs['existsSync'](_0x2bd6ef)){logger[_0x15fd('0x60')](_0x15fd('0x63')+_0x2bd6ef+_0x15fd('0x64'));fs[_0x15fd('0x65')](_0x2bd6ef);}return _0x39e6ee;})[_0x15fd('0x1f')](function(_0xfa3aa1){if(!_0xfa3aa1)throw new InternalError();return _0xfa3aa1[_0x15fd('0x20')]();})['then'](function(){_0x290497[_0x15fd('0x17')](0xcc)['end']();})[_0x15fd('0x40')](handleError(_0x290497,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 24861d0..5ba718f 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 _0x6324=['rimraf','../../config/environment','./screenRecording.attributes','exports','define','ScreenRecording','screen_recordings','interactionid','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x2e4cbb,_0x5799c9){var _0x1818b8=function(_0x5a06ce){while(--_0x5a06ce){_0x2e4cbb['push'](_0x2e4cbb['shift']());}};_0x1818b8(++_0x5799c9);}(_0x6324,0x80));var _0x4632=function(_0x31631c,_0x47179b){_0x31631c=_0x31631c-0x0;var _0x2de94e=_0x6324[_0x31631c];return _0x2de94e;};'use strict';var _=require(_0x4632('0x0'));var util=require(_0x4632('0x1'));var logger=require(_0x4632('0x2'))(_0x4632('0x3'));var moment=require(_0x4632('0x4'));var BPromise=require('bluebird');var rp=require(_0x4632('0x5'));var fs=require('fs');var path=require(_0x4632('0x6'));var rimraf=require(_0x4632('0x7'));var config=require(_0x4632('0x8'));var attributes=require(_0x4632('0x9'));module[_0x4632('0xa')]=function(_0xc0f494,_0x4c564b){return _0xc0f494[_0x4632('0xb')](_0x4632('0xc'),attributes,{'tableName':_0x4632('0xd'),'paranoid':![],'indexes':[{'name':_0x4632('0xe'),'fields':[_0x4632('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe348=['define','screen_recordings','interactionid','util','../../config/logger','moment','request-promise','path','rimraf','./screenRecording.attributes','exports'];(function(_0x13cb09,_0x2516f4){var _0x5a04af=function(_0x37e1f9){while(--_0x37e1f9){_0x13cb09['push'](_0x13cb09['shift']());}};_0x5a04af(++_0x2516f4);}(_0xe348,0x163));var _0x8e34=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0xe348[_0x21549c];return _0x426cbd;};'use strict';var _=require('lodash');var util=require(_0x8e34('0x0'));var logger=require(_0x8e34('0x1'))('api');var moment=require(_0x8e34('0x2'));var BPromise=require('bluebird');var rp=require(_0x8e34('0x3'));var fs=require('fs');var path=require(_0x8e34('0x4'));var rimraf=require(_0x8e34('0x5'));var config=require('../../config/environment');var attributes=require(_0x8e34('0x6'));module[_0x8e34('0x7')]=function(_0x1ecf82,_0xdfc6f1){return _0x1ecf82[_0x8e34('0x8')]('ScreenRecording',attributes,{'tableName':_0x8e34('0x9'),'paranoid':![],'indexes':[{'name':_0x8e34('0xa'),'fields':['interactionid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index c9deb6f..4b20c14 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 _0x91cc=['../../config/environment','http','request','then','ScreenRecording,\x20%s,\x20%s','debug','request\x20sent','error','code','message','info','catch','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc'];(function(_0x563dc2,_0x1a1c64){var _0x27113d=function(_0x28bf12){while(--_0x28bf12){_0x563dc2['push'](_0x563dc2['shift']());}};_0x27113d(++_0x1a1c64);}(_0x91cc,0x8a));var _0xc91c=function(_0x50aa2e,_0xfbd6f0){_0x50aa2e=_0x50aa2e-0x0;var _0x5e07f0=_0x91cc[_0x50aa2e];return _0x5e07f0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc91c('0x0'));var BPromise=require(_0xc91c('0x1'));var rs=require(_0xc91c('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc91c('0x3'))['db'];var utils=require(_0xc91c('0x4'));var logger=require('../../config/logger')(_0xc91c('0x5'));var config=require(_0xc91c('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xc91c('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x48a704,_0x44b000,_0x1243d3){return new BPromise(function(_0x519bb4,_0x3f5ec4){return client[_0xc91c('0x8')](_0x48a704,_0x1243d3)[_0xc91c('0x9')](function(_0x60fd58){logger['info'](_0xc91c('0xa'),_0x44b000,'request\x20sent');logger[_0xc91c('0xb')]('ScreenRecording,\x20%s,\x20%s,\x20%s',_0x44b000,_0xc91c('0xc'),JSON['stringify'](_0x60fd58));if(_0x60fd58[_0xc91c('0xd')]){if(_0x60fd58[_0xc91c('0xd')][_0xc91c('0xe')]===0x1f4){logger[_0xc91c('0xd')](_0xc91c('0xa'),_0x44b000,_0x60fd58[_0xc91c('0xd')]['message']);return _0x3f5ec4(_0x60fd58['error'][_0xc91c('0xf')]);}logger[_0xc91c('0xd')](_0xc91c('0xa'),_0x44b000,_0x60fd58[_0xc91c('0xd')][_0xc91c('0xf')]);return _0x519bb4(_0x60fd58[_0xc91c('0xd')]['message']);}else{logger[_0xc91c('0x10')](_0xc91c('0xa'),_0x44b000,_0xc91c('0xc'));_0x519bb4(_0x60fd58['result'][_0xc91c('0xf')]);}})[_0xc91c('0x11')](function(_0x5e9227){logger['error'](_0xc91c('0xa'),_0x44b000,_0x5e9227);_0x3f5ec4(_0x5e9227);});});} \ No newline at end of file +var _0x42a8=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment'];(function(_0x5cdead,_0x4cc697){var _0x34dd2f=function(_0x4081a1){while(--_0x4081a1){_0x5cdead['push'](_0x5cdead['shift']());}};_0x34dd2f(++_0x4cc697);}(_0x42a8,0x1c5));var _0x842a=function(_0x32b092,_0x3547aa){_0x32b092=_0x32b092-0x0;var _0x33b0ba=_0x42a8[_0x32b092];return _0x33b0ba;};'use strict';var _=require(_0x842a('0x0'));var util=require(_0x842a('0x1'));var moment=require(_0x842a('0x2'));var BPromise=require(_0x842a('0x3'));var rs=require(_0x842a('0x4'));var fs=require('fs');var Redis=require(_0x842a('0x5'));var db=require(_0x842a('0x6'))['db'];var utils=require(_0x842a('0x7'));var logger=require(_0x842a('0x8'))(_0x842a('0x9'));var config=require(_0x842a('0xa'));var jayson=require(_0x842a('0xb'));var client=jayson[_0x842a('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x44c65e,_0x35a9a3,_0x2266e5){return new BPromise(function(_0x4daa2f,_0x35e2bc){return client[_0x842a('0xd')](_0x44c65e,_0x2266e5)['then'](function(_0x35a5c1){logger[_0x842a('0xe')](_0x842a('0xf'),_0x35a9a3,_0x842a('0x10'));logger[_0x842a('0x11')](_0x842a('0x12'),_0x35a9a3,'request\x20sent',JSON[_0x842a('0x13')](_0x35a5c1));if(_0x35a5c1[_0x842a('0x14')]){if(_0x35a5c1['error'][_0x842a('0x15')]===0x1f4){logger['error']('ScreenRecording,\x20%s,\x20%s',_0x35a9a3,_0x35a5c1[_0x842a('0x14')][_0x842a('0x16')]);return _0x35e2bc(_0x35a5c1[_0x842a('0x14')]['message']);}logger['error'](_0x842a('0xf'),_0x35a9a3,_0x35a5c1[_0x842a('0x14')][_0x842a('0x16')]);return _0x4daa2f(_0x35a5c1[_0x842a('0x14')][_0x842a('0x16')]);}else{logger[_0x842a('0xe')](_0x842a('0xf'),_0x35a9a3,_0x842a('0x10'));_0x4daa2f(_0x35a5c1[_0x842a('0x17')][_0x842a('0x16')]);}})['catch'](function(_0x327a44){logger[_0x842a('0x14')]('ScreenRecording,\x20%s,\x20%s',_0x35a9a3,_0x327a44);_0x35e2bc(_0x327a44);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 2465749..2bc0c04 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 _0x49bb=['show','getLogo','/:id/logo_login','gdpr','/:id/favicon','getFavicon','join','root','server/files/images/logos/','format','%s%s','logo','extname','originalname','post','file','addLogo','diskStorage','logologin','single','addLogoLogin','preferred','addPreferred','put','isAuthenticated','update','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./setting.controller','get','/now','getDate','/:id'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x49bb,0x1a1));var _0xb49b=function(_0x554026,_0x2abc81){_0x554026=_0x554026-0x0;var _0x5d583a=_0x49bb[_0x554026];return _0x5d583a;};'use strict';var multer=require('multer');var util=require(_0xb49b('0x0'));var path=require(_0xb49b('0x1'));var timeout=require(_0xb49b('0x2'));var express=require(_0xb49b('0x3'));var router=express[_0xb49b('0x4')]();var fs_extra=require(_0xb49b('0x5'));var auth=require(_0xb49b('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb49b('0x7'));router[_0xb49b('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xb49b('0x9'),controller[_0xb49b('0xa')]);router[_0xb49b('0x8')](_0xb49b('0xb'),controller[_0xb49b('0xc')]);router[_0xb49b('0x8')]('/:id/logo',controller[_0xb49b('0xd')]);router[_0xb49b('0x8')](_0xb49b('0xe'),controller['getLogoLogin']);router[_0xb49b('0x8')]('/:id/gdpr',controller[_0xb49b('0xf')]);router[_0xb49b('0x8')]('/:id/preferred',controller['getPreferred']);router[_0xb49b('0x8')](_0xb49b('0x10'),controller[_0xb49b('0x11')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x47a43f,_0x402664,_0x6f5b79){_0x6f5b79(null,path[_0xb49b('0x12')](config[_0xb49b('0x13')],_0xb49b('0x14')));},'filename':function(_0x339ea3,_0x30ee7b,_0xd7a93){_0xd7a93(null,util[_0xb49b('0x15')](_0xb49b('0x16'),_0xb49b('0x17'),path[_0xb49b('0x18')](_0x30ee7b[_0xb49b('0x19')])));}})});router[_0xb49b('0x1a')]('/:id/logo',upload['single'](_0xb49b('0x1b')),controller[_0xb49b('0x1c')]);var upload=multer({'storage':multer[_0xb49b('0x1d')]({'destination':function(_0xcb44bb,_0x4acdea,_0x1512a2){_0x1512a2(null,path[_0xb49b('0x12')](config['root'],_0xb49b('0x14')));},'filename':function(_0x3f1407,_0x392344,_0x231d3c){_0x231d3c(null,util['format'](_0xb49b('0x16'),_0xb49b('0x1e'),path['extname'](_0x392344['originalname'])));}})});router[_0xb49b('0x1a')](_0xb49b('0xe'),upload[_0xb49b('0x1f')]('file'),controller[_0xb49b('0x20')]);var upload=multer({'storage':multer[_0xb49b('0x1d')]({'destination':function(_0x21557a,_0x5ae1e4,_0x151906){_0x151906(null,path[_0xb49b('0x12')](config[_0xb49b('0x13')],'server/files/images/logos/'));},'filename':function(_0x802cc7,_0x533493,_0x5f3b3e){_0x5f3b3e(null,util['format']('%s%s',_0xb49b('0x21'),path['extname'](_0x533493[_0xb49b('0x19')])));}})});router[_0xb49b('0x1a')]('/:id/preferred',upload[_0xb49b('0x1f')](_0xb49b('0x1b')),controller[_0xb49b('0x22')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x27aa3d,_0x42099c,_0x1dd910){_0x1dd910(null,path['join'](config[_0xb49b('0x13')],_0xb49b('0x14')));},'filename':function(_0x3cf211,_0x4086e3,_0x27e45b){_0x27e45b(null,util['format'](_0xb49b('0x16'),'favicon',path[_0xb49b('0x18')](_0x4086e3[_0xb49b('0x19')])));}})});router[_0xb49b('0x1a')](_0xb49b('0x10'),upload[_0xb49b('0x1f')](_0xb49b('0x1b')),controller['addFavicon']);router[_0xb49b('0x23')](_0xb49b('0xb'),auth[_0xb49b('0x24')](),controller[_0xb49b('0x25')]);module[_0xb49b('0x26')]=router; \ No newline at end of file +var _0xbf79=['server/files/images/logos/','extname','originalname','post','addLogo','logologin','single','addLogoLogin','format','%s%s','preferred','file','addPreferred','favicon','addFavicon','isAuthenticated','update','exports','util','connect-timeout','../../components/auth/service','../../components/interaction/service','./setting.controller','index','get','/now','getDate','/:id','show','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','diskStorage','join','root'];(function(_0x38b271,_0x587ec9){var _0x29d174=function(_0x33565c){while(--_0x33565c){_0x38b271['push'](_0x38b271['shift']());}};_0x29d174(++_0x587ec9);}(_0xbf79,0x10e));var _0x9bf7=function(_0x7d4ed8,_0x37b6fd){_0x7d4ed8=_0x7d4ed8-0x0;var _0x34d0c5=_0xbf79[_0x7d4ed8];return _0x34d0c5;};'use strict';var multer=require('multer');var util=require(_0x9bf7('0x0'));var path=require('path');var timeout=require(_0x9bf7('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x9bf7('0x2'));var interaction=require(_0x9bf7('0x3'));var config=require('../../config/environment');var controller=require(_0x9bf7('0x4'));router['get']('/',auth['isAuthenticated'](),controller[_0x9bf7('0x5')]);router[_0x9bf7('0x6')](_0x9bf7('0x7'),controller[_0x9bf7('0x8')]);router['get'](_0x9bf7('0x9'),controller[_0x9bf7('0xa')]);router[_0x9bf7('0x6')](_0x9bf7('0xb'),controller[_0x9bf7('0xc')]);router[_0x9bf7('0x6')](_0x9bf7('0xd'),controller[_0x9bf7('0xe')]);router[_0x9bf7('0x6')](_0x9bf7('0xf'),controller[_0x9bf7('0x10')]);router['get'](_0x9bf7('0x11'),controller[_0x9bf7('0x12')]);router[_0x9bf7('0x6')](_0x9bf7('0x13'),controller[_0x9bf7('0x14')]);var upload=multer({'storage':multer[_0x9bf7('0x15')]({'destination':function(_0x43c198,_0x2abdb1,_0x244977){_0x244977(null,path[_0x9bf7('0x16')](config[_0x9bf7('0x17')],_0x9bf7('0x18')));},'filename':function(_0x444d1d,_0x4b3c0e,_0x1100e4){_0x1100e4(null,util['format']('%s%s','logo',path[_0x9bf7('0x19')](_0x4b3c0e[_0x9bf7('0x1a')])));}})});router[_0x9bf7('0x1b')]('/:id/logo',upload['single']('file'),controller[_0x9bf7('0x1c')]);var upload=multer({'storage':multer[_0x9bf7('0x15')]({'destination':function(_0x5e1003,_0x695845,_0x17b645){_0x17b645(null,path[_0x9bf7('0x16')](config['root'],'server/files/images/logos/'));},'filename':function(_0x31c630,_0x5f3049,_0x16df3f){_0x16df3f(null,util['format']('%s%s',_0x9bf7('0x1d'),path[_0x9bf7('0x19')](_0x5f3049[_0x9bf7('0x1a')])));}})});router['post'](_0x9bf7('0xd'),upload[_0x9bf7('0x1e')]('file'),controller[_0x9bf7('0x1f')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x500e2d,_0x281747,_0x33db22){_0x33db22(null,path[_0x9bf7('0x16')](config['root'],_0x9bf7('0x18')));},'filename':function(_0x40c00b,_0x513b4a,_0xa06f0e){_0xa06f0e(null,util[_0x9bf7('0x20')](_0x9bf7('0x21'),_0x9bf7('0x22'),path[_0x9bf7('0x19')](_0x513b4a[_0x9bf7('0x1a')])));}})});router[_0x9bf7('0x1b')](_0x9bf7('0x11'),upload[_0x9bf7('0x1e')](_0x9bf7('0x23')),controller[_0x9bf7('0x24')]);var upload=multer({'storage':multer[_0x9bf7('0x15')]({'destination':function(_0x43143b,_0x1d7979,_0x4eb92d){_0x4eb92d(null,path['join'](config[_0x9bf7('0x17')],_0x9bf7('0x18')));},'filename':function(_0x4364ea,_0x379fc5,_0x2b468a){_0x2b468a(null,util[_0x9bf7('0x20')](_0x9bf7('0x21'),_0x9bf7('0x25'),path[_0x9bf7('0x19')](_0x379fc5[_0x9bf7('0x1a')])));}})});router['post']('/:id/favicon',upload[_0x9bf7('0x1e')](_0x9bf7('0x23')),controller[_0x9bf7('0x26')]);router['put']('/:id',auth[_0x9bf7('0x27')](),controller[_0x9bf7('0x28')]);module[_0x9bf7('0x29')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 0938771..4e0070f 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 _0x2034=['/var/opt/motion2/server/files/sounds/converted','BOOLEAN','STRING','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox'];(function(_0x5a0fb6,_0x450fe4){var _0x3f46ec=function(_0xcbe7ea){while(--_0xcbe7ea){_0x5a0fb6['push'](_0x5a0fb6['shift']());}};_0x3f46ec(++_0x450fe4);}(_0x2034,0x1f0));var _0x4203=function(_0x10d5b5,_0x157238){_0x10d5b5=_0x10d5b5-0x0;var _0x4b128b=_0x2034[_0x10d5b5];return _0x4b128b;};'use strict';var Sequelize=require(_0x4203('0x0'));module[_0x4203('0x1')]={'min_internal':{'type':Sequelize[_0x4203('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x4203('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x4203('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize['STRING'],'defaultValue':_0x4203('0x4')},'logo':{'type':Sequelize['STRING']},'defaultLogo':{'type':Sequelize[_0x4203('0x5')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x4203('0x6')]},'defaultLoginLogo':{'type':Sequelize[_0x4203('0x5')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize['STRING']},'defaultHeaderWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x4203('0x5')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x4203('0x6')]},'turnaddr':{'type':Sequelize[_0x4203('0x6')]},'turnusername':{'type':Sequelize[_0x4203('0x6')]},'turnpassword':{'type':Sequelize[_0x4203('0x6')]},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize[_0x4203('0x5')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x4203('0x5')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x4203('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x4203('0x5')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x4203('0x6')],'defaultValue':_0x4203('0x7')},'enableEmailPreview':{'type':Sequelize[_0x4203('0x5')],'defaultValue':![]},'split':{'type':Sequelize[_0x4203('0x5')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x4203('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x4203('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x4203('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x4203('0x6')],'defaultValue':_0x4203('0x8')},'chatTimeout':{'type':Sequelize[_0x4203('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x4203('0x5')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x4203('0x6')]},'defaultPreferred':{'type':Sequelize[_0x4203('0x5')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x4203('0x5')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x4203('0x6')]},'allowedLoginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x4203('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x4203('0x6')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x4203('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x4203('0x5')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x4203('0x2')]},'transcribeRegion':{'type':Sequelize['STRING']},'sentiment':{'type':Sequelize[_0x4203('0x5')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x4203('0x5')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x4203('0x2')]},'sentimentRegion':{'type':Sequelize[_0x4203('0x6')]},'language':{'type':Sequelize[_0x4203('0x6')]},'bucket':{'type':Sequelize['STRING']},'googleSsoEnabled':{'type':Sequelize[_0x4203('0x5')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x4203('0x5')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x4203('0x5')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x4203('0x2')](0x2)[_0x4203('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize['INTEGER'](0x2)[_0x4203('0x9')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x4203('0x2')](0x2)[_0x4203('0x9')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize['INTEGER'](0x2)[_0x4203('0x9')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x4203('0x5')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x4203('0x2')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x4203('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x4203('0x2')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x4203('0x2')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x4203('0x5')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x4203('0x5')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x4203('0x5')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x4203('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x4203('0x2')],'defaultValue':0x14},'filterFullName':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x527f=['INTEGER','min_internal','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','alternate','UNSIGNED','sequelize','exports'];(function(_0xa2c0a3,_0x5bbac0){var _0x52c618=function(_0x20f7fd){while(--_0x20f7fd){_0xa2c0a3['push'](_0xa2c0a3['shift']());}};_0x52c618(++_0x5bbac0);}(_0x527f,0x1d2));var _0xf527=function(_0x576dec,_0x299f21){_0x576dec=_0x576dec-0x0;var _0x1822b3=_0x527f[_0x576dec];return _0x1822b3;};'use strict';var Sequelize=require(_0xf527('0x0'));module[_0xf527('0x1')]={'min_internal':{'type':Sequelize[_0xf527('0x2')](0xb),'unique':_0xf527('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0xf527('0x2')](0xb),'unique':'min_mailbox','defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0xf527('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0xf527('0x4')],'defaultValue':_0xf527('0x5')},'logo':{'type':Sequelize[_0xf527('0x4')]},'defaultLogo':{'type':Sequelize[_0xf527('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0xf527('0x4')]},'defaultLoginLogo':{'type':Sequelize[_0xf527('0x6')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize['STRING']},'defaultHeaderWhiteLabel':{'type':Sequelize[_0xf527('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0xf527('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0xf527('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0xf527('0x4')]},'turnusername':{'type':Sequelize[_0xf527('0x4')]},'turnpassword':{'type':Sequelize[_0xf527('0x4')]},'pageTitle':{'type':Sequelize[_0xf527('0x4')]},'defaultPageTitle':{'type':Sequelize[_0xf527('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0xf527('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0xf527('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize[_0xf527('0x6')],'defaultValue':![]},'split':{'type':Sequelize[_0xf527('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0xf527('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0xf527('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0xf527('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0xf527('0x4')],'defaultValue':_0xf527('0x7')},'chatTimeout':{'type':Sequelize[_0xf527('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'preferred':{'type':Sequelize[_0xf527('0x4')]},'defaultPreferred':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0xf527('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0xf527('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0xf527('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0xf527('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0xf527('0x4')]},'defaultFavicon':{'type':Sequelize[_0xf527('0x6')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0xf527('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0xf527('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0xf527('0x2')]},'transcribeRegion':{'type':Sequelize['STRING']},'sentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0xf527('0x6')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0xf527('0x2')]},'sentimentRegion':{'type':Sequelize[_0xf527('0x4')]},'language':{'type':Sequelize['STRING']},'bucket':{'type':Sequelize[_0xf527('0x4')]},'googleSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0xf527('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0xf527('0x2')](0x2)[_0xf527('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0xf527('0x2')](0x2)[_0xf527('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0xf527('0x2')](0x2)[_0xf527('0x8')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0xf527('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0xf527('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0xf527('0x2')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0xf527('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0xf527('0x2')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0xf527('0x2')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0xf527('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0xf527('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0xf527('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize[_0xf527('0x6')],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0xf527('0x2')],'defaultValue':0x14},'filterFullName':{'type':Sequelize[_0xf527('0x6')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 44db723..a4de27a 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 _0x5001=['then','info','request\x20sent','debug','stringify','error','Setting,\x20%s,\x20%s','message','catch','sendStatus','status','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','destroy','end','stack','name','send','index','map','Setting','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','length','includeAll','find','body','addLogo','file','filename','addLogoLogin','loginLogo','getLogo','server/files/images/logos','getLicense','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','logo','existsSync','join','root','toLower','default_logo.svg','default','upperFirst','custom','Sequelize','ValidationError','\x20not\x20found','download','getLogoLogin','default_loginLogo.svg','gdpr','addPreferred','getPreferred','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/license/util','jayson/promise','client','request'];(function(_0x1f8f63,_0x1e6bb2){var _0x34fef9=function(_0x2b308e){while(--_0x2b308e){_0x1f8f63['push'](_0x1f8f63['shift']());}};_0x34fef9(++_0x1e6bb2);}(_0x5001,0x15a));var _0x1500=function(_0x4e0a60,_0x53a5b7){_0x4e0a60=_0x4e0a60-0x0;var _0x9cb007=_0x5001[_0x4e0a60];return _0x9cb007;};'use strict';var emlformat=require(_0x1500('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1500('0x1'));var jsonpatch=require(_0x1500('0x2'));var rp=require('request-promise');var moment=require(_0x1500('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1500('0x4'));var util=require(_0x1500('0x5'));var path=require(_0x1500('0x6'));var sox=require(_0x1500('0x7'));var csv=require(_0x1500('0x8'));var ejs=require(_0x1500('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1500('0xa'));var squel=require(_0x1500('0xb'));var crypto=require(_0x1500('0xc'));var jsforce=require(_0x1500('0xd'));var deskjs=require(_0x1500('0xe'));var toCsv=require(_0x1500('0x8'));var querystring=require(_0x1500('0xf'));var Papa=require(_0x1500('0x10'));var Redis=require(_0x1500('0x11'));var authService=require(_0x1500('0x12'));var qs=require(_0x1500('0x13'));var as=require(_0x1500('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x1500('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1500('0x16'));var db=require('../../mysqldb')['db'];var jayson=require(_0x1500('0x17'));var client=jayson[_0x1500('0x18')]['http']({'port':0x232a});function respondWithRpcPromise(_0x8ff770,_0x2208c5,_0x163b64,_0x23d39e){return new BPromise(function(_0x39af2a,_0x894907){var _0x139de6=_0x23d39e||client;return _0x139de6[_0x1500('0x19')](_0x8ff770,_0x163b64)[_0x1500('0x1a')](function(_0x39d92d){logger[_0x1500('0x1b')]('Setting,\x20%s,\x20%s',_0x2208c5,_0x1500('0x1c'));logger[_0x1500('0x1d')]('Setting,\x20%s,\x20%s,\x20%s',_0x2208c5,_0x1500('0x1c'),JSON[_0x1500('0x1e')](_0x39d92d));if(_0x39d92d[_0x1500('0x1f')]){if(_0x39d92d[_0x1500('0x1f')]['code']===0x1f4){logger['error'](_0x1500('0x20'),_0x2208c5,_0x39d92d[_0x1500('0x1f')][_0x1500('0x21')]);return _0x894907(_0x39d92d[_0x1500('0x1f')]['message']);}logger['error'](_0x1500('0x20'),_0x2208c5,_0x39d92d['error'][_0x1500('0x21')]);return _0x39af2a(_0x39d92d[_0x1500('0x1f')]['message']);}else{logger['info'](_0x1500('0x20'),_0x2208c5,'request\x20sent');_0x39af2a(_0x39d92d['result'][_0x1500('0x21')]);}})[_0x1500('0x22')](function(_0x335d84){logger[_0x1500('0x1f')]('Setting,\x20%s,\x20%s',_0x2208c5,_0x335d84);_0x894907(_0x335d84);});});}function respondWithStatusCode(_0x4c4deb,_0x3c467e){_0x3c467e=_0x3c467e||0xcc;return function(_0x67236){if(_0x67236){return _0x4c4deb[_0x1500('0x23')](_0x3c467e);}return _0x4c4deb[_0x1500('0x24')](_0x3c467e)['end']();};}function respondWithResult(_0x1e8e8c,_0x999345){_0x999345=_0x999345||0xc8;return function(_0x5968cc){if(_0x5968cc){return _0x1e8e8c[_0x1500('0x24')](_0x999345)[_0x1500('0x25')](_0x5968cc);}};}function respondWithFilteredResult(_0x583832,_0x125a88){return function(_0x16d1dc){if(_0x16d1dc){var _0x49f0cb=typeof _0x125a88['offset']==='undefined'&&typeof _0x125a88[_0x1500('0x26')]===_0x1500('0x27');var _0x36f52a=_0x16d1dc['count'];var _0x58fba6=_0x49f0cb?0x0:_0x125a88['offset'];var _0x5a0420=_0x49f0cb?_0x16d1dc[_0x1500('0x28')]:_0x125a88[_0x1500('0x29')]+_0x125a88['limit'];var _0x1644ec;if(_0x5a0420>=_0x36f52a){_0x5a0420=_0x36f52a;_0x1644ec=0xc8;}else{_0x1644ec=0xce;}_0x583832[_0x1500('0x24')](_0x1644ec);return _0x583832[_0x1500('0x2a')](_0x1500('0x2b'),_0x58fba6+'-'+_0x5a0420+'/'+_0x36f52a)[_0x1500('0x25')](_0x16d1dc);}return null;};}function patchUpdates(_0x26393e){return function(_0x262b89){try{jsonpatch[_0x1500('0x2c')](_0x262b89,_0x26393e,!![]);}catch(_0x3396bc){return BPromise[_0x1500('0x2d')](_0x3396bc);}return _0x262b89[_0x1500('0x2e')]();};}function saveUpdates(_0x425859,_0x25a7a6){return function(_0x929187){if(_0x929187){return _0x929187[_0x1500('0x2f')](_0x425859)[_0x1500('0x1a')](function(_0x577e35){return _0x577e35;});}return null;};}function removeEntity(_0x3050d2,_0x22ac61){return function(_0x5cdd61){if(_0x5cdd61){return _0x5cdd61[_0x1500('0x30')]()['then'](function(){_0x3050d2[_0x1500('0x24')](0xcc)[_0x1500('0x31')]();});}};}function handleEntityNotFound(_0x59f7e7,_0x5c535c){return function(_0x4b2ed7){if(!_0x4b2ed7){_0x59f7e7['sendStatus'](0x194);}return _0x4b2ed7;};}function handleError(_0x33d400,_0x4ab7c7){_0x4ab7c7=_0x4ab7c7||0x1f4;return function(_0x54bb69){logger[_0x1500('0x1f')](_0x54bb69[_0x1500('0x32')]);if(_0x54bb69['name']){delete _0x54bb69[_0x1500('0x33')];}_0x33d400[_0x1500('0x24')](_0x4ab7c7)[_0x1500('0x34')](_0x54bb69);};}exports[_0x1500('0x35')]=function(_0x373f25,_0xda5ccd){var _0x2ff107={},_0x49e43c={},_0x19383b={'count':0x0,'rows':[]};var _0x11f607=_[_0x1500('0x36')](db[_0x1500('0x37')][_0x1500('0x38')],function(_0x161b18){return{'name':_0x161b18[_0x1500('0x39')],'type':_0x161b18[_0x1500('0x3a')]['key']};});_0x49e43c[_0x1500('0x3b')]=_[_0x1500('0x36')](_0x11f607,_0x1500('0x33'));_0x49e43c[_0x1500('0x3c')]=_[_0x1500('0x3d')](_0x373f25[_0x1500('0x3c')]);_0x49e43c[_0x1500('0x3e')]=_[_0x1500('0x3f')](_0x49e43c[_0x1500('0x3b')],_0x49e43c['query']);_0x2ff107[_0x1500('0x40')]=_[_0x1500('0x3f')](_0x49e43c[_0x1500('0x3b')],qs[_0x1500('0x41')](_0x373f25[_0x1500('0x3c')]['fields']));_0x2ff107[_0x1500('0x40')]=_0x2ff107['attributes']['length']?_0x2ff107['attributes']:_0x49e43c[_0x1500('0x3b')];if(!_0x373f25['query'][_0x1500('0x42')](_0x1500('0x43'))){_0x2ff107['limit']=qs[_0x1500('0x26')](_0x373f25[_0x1500('0x3c')]['limit']);_0x2ff107[_0x1500('0x29')]=qs[_0x1500('0x29')](_0x373f25[_0x1500('0x3c')][_0x1500('0x29')]);}_0x2ff107['order']=qs[_0x1500('0x44')](_0x373f25[_0x1500('0x3c')][_0x1500('0x44')]);_0x2ff107[_0x1500('0x45')]=qs['filters'](_[_0x1500('0x46')](_0x373f25['query'],_0x49e43c[_0x1500('0x3e')]),_0x11f607);if(_0x373f25[_0x1500('0x3c')][_0x1500('0x47')]){_0x2ff107['where']=_[_0x1500('0x48')](_0x2ff107[_0x1500('0x45')],{'$or':_[_0x1500('0x36')](_0x11f607,function(_0x2157da){if(_0x2157da[_0x1500('0x3a')]!==_0x1500('0x49')){var _0x17d360={};_0x17d360[_0x2157da[_0x1500('0x33')]]={'$like':'%'+_0x373f25[_0x1500('0x3c')][_0x1500('0x47')]+'%'};return _0x17d360;}})});}_0x2ff107=_['merge']({},_0x2ff107,_0x373f25[_0x1500('0x4a')]);var _0x224598={'where':_0x2ff107[_0x1500('0x45')]};return db[_0x1500('0x37')][_0x1500('0x28')](_0x224598)['then'](function(_0x32f9a9){_0x19383b[_0x1500('0x28')]=_0x32f9a9;if(_0x373f25[_0x1500('0x3c')]['includeAll']){_0x2ff107[_0x1500('0x4b')]=[{'all':!![]}];}return db[_0x1500('0x37')][_0x1500('0x4c')](_0x2ff107);})[_0x1500('0x1a')](function(_0x2f2f78){_0x19383b[_0x1500('0x4d')]=_0x2f2f78;return _0x19383b;})[_0x1500('0x1a')](respondWithFilteredResult(_0xda5ccd,_0x2ff107))['catch'](handleError(_0xda5ccd,null));};exports[_0x1500('0x4e')]=function(_0x5d7c09,_0x4ab4c0){var _0x13948d={'raw':![],'where':{'id':_0x5d7c09[_0x1500('0x4f')]['id']}},_0x49702b={};_0x49702b[_0x1500('0x3b')]=_[_0x1500('0x3d')](db[_0x1500('0x37')][_0x1500('0x38')]);_0x49702b['query']=_[_0x1500('0x3d')](_0x5d7c09[_0x1500('0x3c')]);_0x49702b[_0x1500('0x3e')]=_[_0x1500('0x3f')](_0x49702b[_0x1500('0x3b')],_0x49702b['query']);_0x13948d[_0x1500('0x40')]=_[_0x1500('0x3f')](_0x49702b[_0x1500('0x3b')],qs[_0x1500('0x41')](_0x5d7c09[_0x1500('0x3c')]['fields']));_0x13948d[_0x1500('0x40')]=_0x13948d['attributes'][_0x1500('0x50')]?_0x13948d[_0x1500('0x40')]:_0x49702b[_0x1500('0x3b')];if(_0x5d7c09[_0x1500('0x3c')][_0x1500('0x51')]){_0x13948d[_0x1500('0x4b')]=[{'all':!![]}];}_0x13948d=_[_0x1500('0x48')]({},_0x13948d,_0x5d7c09[_0x1500('0x4a')]);return db[_0x1500('0x37')][_0x1500('0x52')](_0x13948d)['then'](handleEntityNotFound(_0x4ab4c0,null))['then'](respondWithResult(_0x4ab4c0,null))[_0x1500('0x22')](handleError(_0x4ab4c0,null));};exports[_0x1500('0x2f')]=function(_0x5094ab,_0x37fcef){if(_0x5094ab[_0x1500('0x53')]['id']){delete _0x5094ab['body']['id'];}return db[_0x1500('0x37')][_0x1500('0x52')]({'where':{'id':_0x5094ab['params']['id']}})[_0x1500('0x1a')](handleEntityNotFound(_0x37fcef,null))[_0x1500('0x1a')](saveUpdates(_0x5094ab[_0x1500('0x53')],null))['then'](respondWithResult(_0x37fcef,null))[_0x1500('0x22')](handleError(_0x37fcef,null));};exports[_0x1500('0x54')]=function(_0x5451ef,_0x5024e8,_0x2672aa){if(_0x5451ef[_0x1500('0x55')]&&_0x5451ef[_0x1500('0x55')][_0x1500('0x56')]){_0x5451ef[_0x1500('0x53')]['logo']=_0x5451ef['file'][_0x1500('0x56')];}return db[_0x1500('0x37')]['find']({'where':{'id':_0x5451ef['params']['id']}})[_0x1500('0x1a')](handleEntityNotFound(_0x5024e8,null))['then'](saveUpdates(_0x5451ef['body'],null))[_0x1500('0x1a')](respondWithResult(_0x5024e8,null))['catch'](handleError(_0x5024e8,null));};exports[_0x1500('0x57')]=function(_0x1e0ec5,_0x1f67cb,_0x4a016f){if(_0x1e0ec5['file']&&_0x1e0ec5[_0x1500('0x55')][_0x1500('0x56')]){_0x1e0ec5[_0x1500('0x53')][_0x1500('0x58')]=_0x1e0ec5[_0x1500('0x55')][_0x1500('0x56')];}return db[_0x1500('0x37')][_0x1500('0x52')]({'where':{'id':_0x1e0ec5[_0x1500('0x4f')]['id']}})['then'](handleEntityNotFound(_0x1f67cb,null))['then'](saveUpdates(_0x1e0ec5[_0x1500('0x53')],null))[_0x1500('0x1a')](respondWithResult(_0x1f67cb,null))[_0x1500('0x22')](handleError(_0x1f67cb,null));};var utilLicense=require('../../config/license/util');exports[_0x1500('0x59')]=function(_0x4f0b8d,_0x1ea02b,_0x4f2a05){var _0x4bd139=_0x1500('0x5a');var _0x2e76b9={'custom':![]};return utilLicense[_0x1500('0x5b')]()[_0x1500('0x1a')](function(_0x37d011){if(_0x37d011){_0x2e76b9=_0x37d011;}return db['Setting'][_0x1500('0x52')]({'where':{'id':_0x4f0b8d[_0x1500('0x4f')]['id']},'attributes':['logo',_0x1500('0x58'),_0x1500('0x5c'),_0x1500('0x5d'),_0x1500('0x5e'),_0x1500('0x5f'),_0x1500('0x60'),_0x1500('0x61')],'raw':!![]});})['then'](handleEntityNotFound(_0x1ea02b,null))['then'](function(_0x488538){if(_0x488538){var _0x527c0c=_0x488538[_0x1500('0x62')]&&fs[_0x1500('0x63')](path[_0x1500('0x64')](config[_0x1500('0x65')],_0x4bd139,_[_0x1500('0x66')](_0x488538[_0x1500('0x62')])))?path['join'](config[_0x1500('0x65')],_0x4bd139,_[_0x1500('0x66')](_0x488538[_0x1500('0x62')])):path[_0x1500('0x64')](config[_0x1500('0x65')],_0x4bd139,_['toLower'](_0x1500('0x67')));var _0x768381=_0x1500('0x68')+_[_0x1500('0x69')](_0x1500('0x62'));if(_0x488538[_0x768381]||!_0x2e76b9[_0x1500('0x6a')]){_0x527c0c=path[_0x1500('0x64')](config[_0x1500('0x65')],_0x4bd139,_[_0x1500('0x66')](_0x1500('0x67')));}if(!fs[_0x1500('0x63')](_0x527c0c)){throw new db[(_0x1500('0x6b'))][(_0x1500('0x6c'))](_[_0x1500('0x69')]('logo')+_0x1500('0x6d'));}return _0x1ea02b[_0x1500('0x6e')](_0x527c0c);}})['catch'](handleError(_0x1ea02b,null));};var utilLicense=require(_0x1500('0x16'));exports[_0x1500('0x6f')]=function(_0x40fa16,_0x4bb458,_0x475df2){var _0x11c3f3='server/files/images/logos';var _0x169cd6={'custom':![]};return utilLicense[_0x1500('0x5b')]()['then'](function(_0x258a14){if(_0x258a14){_0x169cd6=_0x258a14;}return db[_0x1500('0x37')]['find']({'where':{'id':_0x40fa16[_0x1500('0x4f')]['id']},'attributes':['logo',_0x1500('0x58'),_0x1500('0x5c'),_0x1500('0x5d'),'defaultLogo','defaultLoginLogo',_0x1500('0x60'),'defaultFavicon'],'raw':!![]});})[_0x1500('0x1a')](handleEntityNotFound(_0x4bb458,null))[_0x1500('0x1a')](function(_0x3a9d35){if(_0x3a9d35){var _0x4f7b80=_0x3a9d35[_0x1500('0x58')]&&fs[_0x1500('0x63')](path[_0x1500('0x64')](config['root'],_0x11c3f3,_[_0x1500('0x66')](_0x3a9d35['loginLogo'])))?path['join'](config[_0x1500('0x65')],_0x11c3f3,_[_0x1500('0x66')](_0x3a9d35[_0x1500('0x58')])):path[_0x1500('0x64')](config[_0x1500('0x65')],_0x11c3f3,_[_0x1500('0x66')](_0x1500('0x70')));var _0x1a51f6=_0x1500('0x68')+_['upperFirst'](_0x1500('0x58'));if(_0x3a9d35[_0x1a51f6]||!_0x169cd6[_0x1500('0x6a')]){_0x4f7b80=path[_0x1500('0x64')](config[_0x1500('0x65')],_0x11c3f3,_[_0x1500('0x66')](_0x1500('0x70')));}if(!fs[_0x1500('0x63')](_0x4f7b80)){throw new db[(_0x1500('0x6b'))][(_0x1500('0x6c'))](_[_0x1500('0x69')]('loginLogo')+'\x20not\x20found');}return _0x4bb458[_0x1500('0x6e')](_0x4f7b80);}})[_0x1500('0x22')](handleError(_0x4bb458,null));};exports[_0x1500('0x71')]=function(_0x402f47,_0xac7d75){return db[_0x1500('0x37')]['find']({'where':{'id':_0x402f47[_0x1500('0x4f')]['id']},'attributes':['securePassword']})[_0x1500('0x1a')](respondWithResult(_0xac7d75,null))[_0x1500('0x22')](handleError(_0xac7d75,null));};exports[_0x1500('0x72')]=function(_0x30348d,_0x72b0a6,_0x2ccf93){if(_0x30348d['file']&&_0x30348d[_0x1500('0x55')][_0x1500('0x56')]){_0x30348d['body'][_0x1500('0x5c')]=_0x30348d[_0x1500('0x55')][_0x1500('0x56')];}return db[_0x1500('0x37')][_0x1500('0x52')]({'where':{'id':_0x30348d[_0x1500('0x4f')]['id']}})['then'](handleEntityNotFound(_0x72b0a6,null))[_0x1500('0x1a')](saveUpdates(_0x30348d['body'],null))[_0x1500('0x1a')](respondWithResult(_0x72b0a6,null))['catch'](handleError(_0x72b0a6,null));};var utilLicense=require(_0x1500('0x16'));exports[_0x1500('0x73')]=function(_0x16ef1e,_0x390540,_0x3e9c98){var _0x3d63d5=_0x1500('0x5a');var _0x5b58aa={'custom':![]};return utilLicense[_0x1500('0x5b')]()['then'](function(_0x43b7c6){if(_0x43b7c6){_0x5b58aa=_0x43b7c6;}return db[_0x1500('0x37')][_0x1500('0x52')]({'where':{'id':_0x16ef1e[_0x1500('0x4f')]['id']},'attributes':[_0x1500('0x62'),_0x1500('0x58'),_0x1500('0x5c'),_0x1500('0x5d'),_0x1500('0x5e'),'defaultLoginLogo',_0x1500('0x60'),_0x1500('0x61')],'raw':!![]});})[_0x1500('0x1a')](handleEntityNotFound(_0x390540,null))[_0x1500('0x1a')](function(_0x1a6e69){if(_0x1a6e69){var _0x5c27cb=_0x1a6e69[_0x1500('0x5c')]&&fs['existsSync'](path['join'](config[_0x1500('0x65')],_0x3d63d5,_[_0x1500('0x66')](_0x1a6e69['preferred'])))?path[_0x1500('0x64')](config['root'],_0x3d63d5,_['toLower'](_0x1a6e69[_0x1500('0x5c')])):path[_0x1500('0x64')](config[_0x1500('0x65')],_0x3d63d5,_[_0x1500('0x66')](_0x1500('0x74')));var _0xbdf123=_0x1500('0x68')+_[_0x1500('0x69')](_0x1500('0x5c'));if(_0x1a6e69[_0xbdf123]||!_0x5b58aa[_0x1500('0x6a')]||!_0x5b58aa[_0x1500('0x5c')]){_0x5c27cb=path[_0x1500('0x64')](config[_0x1500('0x65')],_0x3d63d5,_[_0x1500('0x66')](_0x1500('0x74')));}if(!fs[_0x1500('0x63')](_0x5c27cb)){throw new db[(_0x1500('0x6b'))][(_0x1500('0x6c'))](_[_0x1500('0x69')](_0x1500('0x5c'))+_0x1500('0x6d'));}return _0x390540[_0x1500('0x6e')](_0x5c27cb);}})[_0x1500('0x22')](handleError(_0x390540,null));};exports[_0x1500('0x75')]=function(_0x310306,_0x4f7700,_0x2d4756){if(_0x310306[_0x1500('0x55')]&&_0x310306[_0x1500('0x55')]['filename']){_0x310306['body'][_0x1500('0x5d')]=_0x310306['file'][_0x1500('0x56')];}return db[_0x1500('0x37')][_0x1500('0x52')]({'where':{'id':_0x310306[_0x1500('0x4f')]['id']}})[_0x1500('0x1a')](handleEntityNotFound(_0x4f7700,null))[_0x1500('0x1a')](saveUpdates(_0x310306[_0x1500('0x53')],null))[_0x1500('0x1a')](respondWithResult(_0x4f7700,null))['catch'](handleError(_0x4f7700,null));};var utilLicense=require('../../config/license/util');exports[_0x1500('0x76')]=function(_0x519281,_0x206b1a,_0x316edd){var _0x5f3c2c=_0x1500('0x5a');var _0x9ceaa6={'custom':![]};return utilLicense[_0x1500('0x5b')]()[_0x1500('0x1a')](function(_0x32e8d8){if(_0x32e8d8){_0x9ceaa6=_0x32e8d8;}return db[_0x1500('0x37')][_0x1500('0x52')]({'where':{'id':_0x519281[_0x1500('0x4f')]['id']},'attributes':[_0x1500('0x62'),_0x1500('0x58'),_0x1500('0x5c'),_0x1500('0x5d'),_0x1500('0x5e'),_0x1500('0x5f'),'defaultPreferred',_0x1500('0x61')],'raw':!![]});})['then'](handleEntityNotFound(_0x206b1a,null))[_0x1500('0x1a')](function(_0xe07a5c){if(_0xe07a5c){var _0x4e05d3=_0xe07a5c[_0x1500('0x5d')]&&fs[_0x1500('0x63')](path['join'](config[_0x1500('0x65')],_0x5f3c2c,_['toLower'](_0xe07a5c[_0x1500('0x5d')])))?path[_0x1500('0x64')](config[_0x1500('0x65')],_0x5f3c2c,_['toLower'](_0xe07a5c[_0x1500('0x5d')])):path[_0x1500('0x64')](config[_0x1500('0x65')],_0x5f3c2c,_['toLower'](_0x1500('0x77')));var _0x712212=_0x1500('0x68')+_[_0x1500('0x69')]('favicon');if(_0xe07a5c[_0x712212]||!_0x9ceaa6[_0x1500('0x6a')]){_0x4e05d3=path['join'](config['root'],_0x5f3c2c,_[_0x1500('0x66')]('default_favicon.ico'));}if(!fs[_0x1500('0x63')](_0x4e05d3)){throw new db[(_0x1500('0x6b'))][(_0x1500('0x6c'))](_['upperFirst'](_0x1500('0x5d'))+_0x1500('0x6d'));}return _0x206b1a[_0x1500('0x6e')](_0x4e05d3);}})[_0x1500('0x22')](handleError(_0x206b1a,null));};exports['getDate']=function(_0x22cb75,_0x5afe65){var _0x2b1d7d={'offset':moment()[_0x1500('0x78')]()};_0x2b1d7d[_0x1500('0x79')]=moment()[_0x1500('0x78')](_0x2b1d7d[_0x1500('0x29')])[_0x1500('0x7a')](_0x1500('0x7b'));return _0x5afe65[_0x1500('0x24')](0xc8)['send'](_0x2b1d7d);}; \ No newline at end of file +var _0xe01d=['update','destroy','end','name','send','map','Setting','rawAttributes','fieldName','type','key','model','query','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','include','rows','catch','params','keys','fields','includeAll','find','body','file','filename','logo','loginLogo','../../config/license/util','getLogo','server/files/images/logos','getLicense','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','existsSync','join','root','toLower','default','custom','default_logo.svg','upperFirst','\x20not\x20found','download','getLogoLogin','default_loginLogo.svg','Sequelize','ValidationError','gdpr','securePassword','addPreferred','getPreferred','defaultFavicon','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','info','Setting,\x20%s,\x20%s','debug','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','sendStatus','status','json','undefined','limit','count','offset','Content-Range','apply','reject','save'];(function(_0x235b64,_0x1bb0d0){var _0xb721da=function(_0x209402){while(--_0x209402){_0x235b64['push'](_0x235b64['shift']());}};_0xb721da(++_0x1bb0d0);}(_0xe01d,0x1c2));var _0xde01=function(_0x224436,_0x13088b){_0x224436=_0x224436-0x0;var _0x3c694a=_0xe01d[_0x224436];return _0x3c694a;};'use strict';var emlformat=require(_0xde01('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xde01('0x1'));var jsonpatch=require(_0xde01('0x2'));var rp=require(_0xde01('0x3'));var moment=require(_0xde01('0x4'));var BPromise=require(_0xde01('0x5'));var Mustache=require(_0xde01('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xde01('0x7'));var ejs=require(_0xde01('0x8'));var fs=require('fs');var fs_extra=require(_0xde01('0x9'));var _=require(_0xde01('0xa'));var squel=require(_0xde01('0xb'));var crypto=require(_0xde01('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xde01('0xd'));var toCsv=require('to-csv');var querystring=require(_0xde01('0xe'));var Papa=require('papaparse');var Redis=require(_0xde01('0xf'));var authService=require(_0xde01('0x10'));var qs=require(_0xde01('0x11'));var as=require(_0xde01('0x12'));var hardwareService=require(_0xde01('0x13'));var logger=require(_0xde01('0x14'))(_0xde01('0x15'));var utils=require(_0xde01('0x16'));var config=require(_0xde01('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xde01('0x18'))['db'];var jayson=require(_0xde01('0x19'));var client=jayson[_0xde01('0x1a')][_0xde01('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0xc50461,_0x3c4308,_0x563b5a,_0x154cdd){return new BPromise(function(_0x20079e,_0x152b54){var _0x1f5504=_0x154cdd||client;return _0x1f5504[_0xde01('0x1c')](_0xc50461,_0x563b5a)[_0xde01('0x1d')](function(_0x4b471f){logger[_0xde01('0x1e')](_0xde01('0x1f'),_0x3c4308,'request\x20sent');logger[_0xde01('0x20')](_0xde01('0x21'),_0x3c4308,_0xde01('0x22'),JSON['stringify'](_0x4b471f));if(_0x4b471f[_0xde01('0x23')]){if(_0x4b471f[_0xde01('0x23')][_0xde01('0x24')]===0x1f4){logger[_0xde01('0x23')](_0xde01('0x1f'),_0x3c4308,_0x4b471f[_0xde01('0x23')][_0xde01('0x25')]);return _0x152b54(_0x4b471f[_0xde01('0x23')][_0xde01('0x25')]);}logger[_0xde01('0x23')](_0xde01('0x1f'),_0x3c4308,_0x4b471f[_0xde01('0x23')]['message']);return _0x20079e(_0x4b471f[_0xde01('0x23')]['message']);}else{logger['info']('Setting,\x20%s,\x20%s',_0x3c4308,'request\x20sent');_0x20079e(_0x4b471f[_0xde01('0x26')][_0xde01('0x25')]);}})['catch'](function(_0x12b317){logger[_0xde01('0x23')](_0xde01('0x1f'),_0x3c4308,_0x12b317);_0x152b54(_0x12b317);});});}function respondWithStatusCode(_0x29ca67,_0x2b397b){_0x2b397b=_0x2b397b||0xcc;return function(_0xcceaca){if(_0xcceaca){return _0x29ca67[_0xde01('0x27')](_0x2b397b);}return _0x29ca67[_0xde01('0x28')](_0x2b397b)['end']();};}function respondWithResult(_0x3fcbe5,_0x461552){_0x461552=_0x461552||0xc8;return function(_0x4107eb){if(_0x4107eb){return _0x3fcbe5[_0xde01('0x28')](_0x461552)[_0xde01('0x29')](_0x4107eb);}};}function respondWithFilteredResult(_0x1114a7,_0x3b2299){return function(_0x3a29ad){if(_0x3a29ad){var _0x4799b8=typeof _0x3b2299['offset']===_0xde01('0x2a')&&typeof _0x3b2299[_0xde01('0x2b')]===_0xde01('0x2a');var _0x149652=_0x3a29ad[_0xde01('0x2c')];var _0x2f9fd6=_0x4799b8?0x0:_0x3b2299[_0xde01('0x2d')];var _0x265cf7=_0x4799b8?_0x3a29ad[_0xde01('0x2c')]:_0x3b2299['offset']+_0x3b2299[_0xde01('0x2b')];var _0x2ac2d4;if(_0x265cf7>=_0x149652){_0x265cf7=_0x149652;_0x2ac2d4=0xc8;}else{_0x2ac2d4=0xce;}_0x1114a7[_0xde01('0x28')](_0x2ac2d4);return _0x1114a7['set'](_0xde01('0x2e'),_0x2f9fd6+'-'+_0x265cf7+'/'+_0x149652)['json'](_0x3a29ad);}return null;};}function patchUpdates(_0x22d5ea){return function(_0x5847e5){try{jsonpatch[_0xde01('0x2f')](_0x5847e5,_0x22d5ea,!![]);}catch(_0x54e606){return BPromise[_0xde01('0x30')](_0x54e606);}return _0x5847e5[_0xde01('0x31')]();};}function saveUpdates(_0x3bde03,_0x21a129){return function(_0x1fba1a){if(_0x1fba1a){return _0x1fba1a[_0xde01('0x32')](_0x3bde03)[_0xde01('0x1d')](function(_0x41dd59){return _0x41dd59;});}return null;};}function removeEntity(_0x47e310,_0x560fdf){return function(_0x37a5af){if(_0x37a5af){return _0x37a5af[_0xde01('0x33')]()['then'](function(){_0x47e310[_0xde01('0x28')](0xcc)[_0xde01('0x34')]();});}};}function handleEntityNotFound(_0x1dda89,_0x44f462){return function(_0x391383){if(!_0x391383){_0x1dda89[_0xde01('0x27')](0x194);}return _0x391383;};}function handleError(_0x70290c,_0x29b376){_0x29b376=_0x29b376||0x1f4;return function(_0x4b161d){logger[_0xde01('0x23')](_0x4b161d['stack']);if(_0x4b161d[_0xde01('0x35')]){delete _0x4b161d['name'];}_0x70290c[_0xde01('0x28')](_0x29b376)[_0xde01('0x36')](_0x4b161d);};}exports['index']=function(_0xdaee3f,_0x1972ae){var _0x3094a6={},_0x2039ac={},_0x2a6c68={'count':0x0,'rows':[]};var _0x5450fd=_[_0xde01('0x37')](db[_0xde01('0x38')][_0xde01('0x39')],function(_0x5a7c20){return{'name':_0x5a7c20[_0xde01('0x3a')],'type':_0x5a7c20[_0xde01('0x3b')][_0xde01('0x3c')]};});_0x2039ac[_0xde01('0x3d')]=_[_0xde01('0x37')](_0x5450fd,_0xde01('0x35'));_0x2039ac[_0xde01('0x3e')]=_['keys'](_0xdaee3f[_0xde01('0x3e')]);_0x2039ac['filters']=_['intersection'](_0x2039ac['model'],_0x2039ac[_0xde01('0x3e')]);_0x3094a6[_0xde01('0x3f')]=_[_0xde01('0x40')](_0x2039ac[_0xde01('0x3d')],qs['fields'](_0xdaee3f[_0xde01('0x3e')]['fields']));_0x3094a6['attributes']=_0x3094a6[_0xde01('0x3f')][_0xde01('0x41')]?_0x3094a6[_0xde01('0x3f')]:_0x2039ac[_0xde01('0x3d')];if(!_0xdaee3f[_0xde01('0x3e')][_0xde01('0x42')](_0xde01('0x43'))){_0x3094a6['limit']=qs[_0xde01('0x2b')](_0xdaee3f['query'][_0xde01('0x2b')]);_0x3094a6[_0xde01('0x2d')]=qs['offset'](_0xdaee3f[_0xde01('0x3e')]['offset']);}_0x3094a6[_0xde01('0x44')]=qs['sort'](_0xdaee3f[_0xde01('0x3e')][_0xde01('0x45')]);_0x3094a6[_0xde01('0x46')]=qs[_0xde01('0x47')](_[_0xde01('0x48')](_0xdaee3f[_0xde01('0x3e')],_0x2039ac[_0xde01('0x47')]),_0x5450fd);if(_0xdaee3f[_0xde01('0x3e')][_0xde01('0x49')]){_0x3094a6[_0xde01('0x46')]=_[_0xde01('0x4a')](_0x3094a6[_0xde01('0x46')],{'$or':_[_0xde01('0x37')](_0x5450fd,function(_0x5a9608){if(_0x5a9608[_0xde01('0x3b')]!=='VIRTUAL'){var _0x4afeae={};_0x4afeae[_0x5a9608[_0xde01('0x35')]]={'$like':'%'+_0xdaee3f['query'][_0xde01('0x49')]+'%'};return _0x4afeae;}})});}_0x3094a6=_[_0xde01('0x4a')]({},_0x3094a6,_0xdaee3f[_0xde01('0x4b')]);var _0x394625={'where':_0x3094a6[_0xde01('0x46')]};return db['Setting'][_0xde01('0x2c')](_0x394625)[_0xde01('0x1d')](function(_0x63bb25){_0x2a6c68['count']=_0x63bb25;if(_0xdaee3f[_0xde01('0x3e')]['includeAll']){_0x3094a6[_0xde01('0x4c')]=[{'all':!![]}];}return db[_0xde01('0x38')]['findAll'](_0x3094a6);})[_0xde01('0x1d')](function(_0x54984e){_0x2a6c68[_0xde01('0x4d')]=_0x54984e;return _0x2a6c68;})[_0xde01('0x1d')](respondWithFilteredResult(_0x1972ae,_0x3094a6))[_0xde01('0x4e')](handleError(_0x1972ae,null));};exports['show']=function(_0x1b8061,_0x1bcb6e){var _0x58b3de={'raw':![],'where':{'id':_0x1b8061[_0xde01('0x4f')]['id']}},_0x56352e={};_0x56352e[_0xde01('0x3d')]=_[_0xde01('0x50')](db[_0xde01('0x38')][_0xde01('0x39')]);_0x56352e[_0xde01('0x3e')]=_[_0xde01('0x50')](_0x1b8061[_0xde01('0x3e')]);_0x56352e[_0xde01('0x47')]=_['intersection'](_0x56352e[_0xde01('0x3d')],_0x56352e[_0xde01('0x3e')]);_0x58b3de['attributes']=_['intersection'](_0x56352e[_0xde01('0x3d')],qs['fields'](_0x1b8061[_0xde01('0x3e')][_0xde01('0x51')]));_0x58b3de['attributes']=_0x58b3de['attributes'][_0xde01('0x41')]?_0x58b3de['attributes']:_0x56352e[_0xde01('0x3d')];if(_0x1b8061[_0xde01('0x3e')][_0xde01('0x52')]){_0x58b3de[_0xde01('0x4c')]=[{'all':!![]}];}_0x58b3de=_[_0xde01('0x4a')]({},_0x58b3de,_0x1b8061[_0xde01('0x4b')]);return db[_0xde01('0x38')][_0xde01('0x53')](_0x58b3de)[_0xde01('0x1d')](handleEntityNotFound(_0x1bcb6e,null))['then'](respondWithResult(_0x1bcb6e,null))['catch'](handleError(_0x1bcb6e,null));};exports[_0xde01('0x32')]=function(_0x282288,_0x475a2d){if(_0x282288[_0xde01('0x54')]['id']){delete _0x282288['body']['id'];}return db[_0xde01('0x38')][_0xde01('0x53')]({'where':{'id':_0x282288[_0xde01('0x4f')]['id']}})[_0xde01('0x1d')](handleEntityNotFound(_0x475a2d,null))[_0xde01('0x1d')](saveUpdates(_0x282288[_0xde01('0x54')],null))['then'](respondWithResult(_0x475a2d,null))[_0xde01('0x4e')](handleError(_0x475a2d,null));};exports['addLogo']=function(_0x1628a4,_0x5ac495,_0x34e7f5){if(_0x1628a4[_0xde01('0x55')]&&_0x1628a4[_0xde01('0x55')][_0xde01('0x56')]){_0x1628a4['body'][_0xde01('0x57')]=_0x1628a4[_0xde01('0x55')]['filename'];}return db[_0xde01('0x38')][_0xde01('0x53')]({'where':{'id':_0x1628a4[_0xde01('0x4f')]['id']}})['then'](handleEntityNotFound(_0x5ac495,null))[_0xde01('0x1d')](saveUpdates(_0x1628a4[_0xde01('0x54')],null))['then'](respondWithResult(_0x5ac495,null))[_0xde01('0x4e')](handleError(_0x5ac495,null));};exports['addLogoLogin']=function(_0xf1a94d,_0x60510d,_0xc9e088){if(_0xf1a94d['file']&&_0xf1a94d['file'][_0xde01('0x56')]){_0xf1a94d[_0xde01('0x54')][_0xde01('0x58')]=_0xf1a94d[_0xde01('0x55')][_0xde01('0x56')];}return db['Setting'][_0xde01('0x53')]({'where':{'id':_0xf1a94d[_0xde01('0x4f')]['id']}})[_0xde01('0x1d')](handleEntityNotFound(_0x60510d,null))['then'](saveUpdates(_0xf1a94d[_0xde01('0x54')],null))[_0xde01('0x1d')](respondWithResult(_0x60510d,null))[_0xde01('0x4e')](handleError(_0x60510d,null));};var utilLicense=require(_0xde01('0x59'));exports[_0xde01('0x5a')]=function(_0x1007bf,_0x246d9d,_0x2e35da){var _0x3a36f8=_0xde01('0x5b');var _0x1dbc19={'custom':![]};return utilLicense[_0xde01('0x5c')]()[_0xde01('0x1d')](function(_0x19bb47){if(_0x19bb47){_0x1dbc19=_0x19bb47;}return db[_0xde01('0x38')][_0xde01('0x53')]({'where':{'id':_0x1007bf[_0xde01('0x4f')]['id']},'attributes':[_0xde01('0x57'),_0xde01('0x58'),_0xde01('0x5d'),_0xde01('0x5e'),_0xde01('0x5f'),_0xde01('0x60'),_0xde01('0x61'),'defaultFavicon'],'raw':!![]});})[_0xde01('0x1d')](handleEntityNotFound(_0x246d9d,null))[_0xde01('0x1d')](function(_0x341905){if(_0x341905){var _0x344c8a=_0x341905[_0xde01('0x57')]&&fs[_0xde01('0x62')](path[_0xde01('0x63')](config[_0xde01('0x64')],_0x3a36f8,_[_0xde01('0x65')](_0x341905[_0xde01('0x57')])))?path[_0xde01('0x63')](config['root'],_0x3a36f8,_['toLower'](_0x341905[_0xde01('0x57')])):path[_0xde01('0x63')](config[_0xde01('0x64')],_0x3a36f8,_[_0xde01('0x65')]('default_logo.svg'));var _0x9a40bb=_0xde01('0x66')+_['upperFirst'](_0xde01('0x57'));if(_0x341905[_0x9a40bb]||!_0x1dbc19[_0xde01('0x67')]){_0x344c8a=path[_0xde01('0x63')](config['root'],_0x3a36f8,_[_0xde01('0x65')](_0xde01('0x68')));}if(!fs[_0xde01('0x62')](_0x344c8a)){throw new db['Sequelize']['ValidationError'](_[_0xde01('0x69')](_0xde01('0x57'))+_0xde01('0x6a'));}return _0x246d9d[_0xde01('0x6b')](_0x344c8a);}})[_0xde01('0x4e')](handleError(_0x246d9d,null));};var utilLicense=require(_0xde01('0x59'));exports[_0xde01('0x6c')]=function(_0x2c61e8,_0x5c1ac2,_0x5c22e0){var _0x5d1685=_0xde01('0x5b');var _0xc91071={'custom':![]};return utilLicense['getLicense']()[_0xde01('0x1d')](function(_0x121f60){if(_0x121f60){_0xc91071=_0x121f60;}return db[_0xde01('0x38')][_0xde01('0x53')]({'where':{'id':_0x2c61e8[_0xde01('0x4f')]['id']},'attributes':[_0xde01('0x57'),_0xde01('0x58'),_0xde01('0x5d'),_0xde01('0x5e'),_0xde01('0x5f'),_0xde01('0x60'),'defaultPreferred','defaultFavicon'],'raw':!![]});})[_0xde01('0x1d')](handleEntityNotFound(_0x5c1ac2,null))['then'](function(_0x33837b){if(_0x33837b){var _0x4cd798=_0x33837b[_0xde01('0x58')]&&fs[_0xde01('0x62')](path[_0xde01('0x63')](config['root'],_0x5d1685,_[_0xde01('0x65')](_0x33837b[_0xde01('0x58')])))?path['join'](config[_0xde01('0x64')],_0x5d1685,_[_0xde01('0x65')](_0x33837b[_0xde01('0x58')])):path['join'](config['root'],_0x5d1685,_[_0xde01('0x65')](_0xde01('0x6d')));var _0x479208=_0xde01('0x66')+_[_0xde01('0x69')]('loginLogo');if(_0x33837b[_0x479208]||!_0xc91071[_0xde01('0x67')]){_0x4cd798=path[_0xde01('0x63')](config['root'],_0x5d1685,_[_0xde01('0x65')](_0xde01('0x6d')));}if(!fs[_0xde01('0x62')](_0x4cd798)){throw new db[(_0xde01('0x6e'))][(_0xde01('0x6f'))](_[_0xde01('0x69')]('loginLogo')+_0xde01('0x6a'));}return _0x5c1ac2[_0xde01('0x6b')](_0x4cd798);}})['catch'](handleError(_0x5c1ac2,null));};exports[_0xde01('0x70')]=function(_0xbc3b1c,_0x3d28f9){return db[_0xde01('0x38')][_0xde01('0x53')]({'where':{'id':_0xbc3b1c[_0xde01('0x4f')]['id']},'attributes':[_0xde01('0x71')]})[_0xde01('0x1d')](respondWithResult(_0x3d28f9,null))[_0xde01('0x4e')](handleError(_0x3d28f9,null));};exports[_0xde01('0x72')]=function(_0x3aba8a,_0x6ba7c6,_0x25595a){if(_0x3aba8a[_0xde01('0x55')]&&_0x3aba8a[_0xde01('0x55')][_0xde01('0x56')]){_0x3aba8a[_0xde01('0x54')][_0xde01('0x5d')]=_0x3aba8a['file'][_0xde01('0x56')];}return db[_0xde01('0x38')][_0xde01('0x53')]({'where':{'id':_0x3aba8a['params']['id']}})['then'](handleEntityNotFound(_0x6ba7c6,null))[_0xde01('0x1d')](saveUpdates(_0x3aba8a[_0xde01('0x54')],null))[_0xde01('0x1d')](respondWithResult(_0x6ba7c6,null))['catch'](handleError(_0x6ba7c6,null));};var utilLicense=require(_0xde01('0x59'));exports[_0xde01('0x73')]=function(_0x215986,_0x571f9e,_0x35682e){var _0x33e2a6=_0xde01('0x5b');var _0x497214={'custom':![]};return utilLicense[_0xde01('0x5c')]()['then'](function(_0x52a02f){if(_0x52a02f){_0x497214=_0x52a02f;}return db[_0xde01('0x38')][_0xde01('0x53')]({'where':{'id':_0x215986['params']['id']},'attributes':[_0xde01('0x57'),_0xde01('0x58'),'preferred',_0xde01('0x5e'),'defaultLogo',_0xde01('0x60'),_0xde01('0x61'),_0xde01('0x74')],'raw':!![]});})[_0xde01('0x1d')](handleEntityNotFound(_0x571f9e,null))[_0xde01('0x1d')](function(_0x2d270b){if(_0x2d270b){var _0x498024=_0x2d270b['preferred']&&fs[_0xde01('0x62')](path[_0xde01('0x63')](config['root'],_0x33e2a6,_['toLower'](_0x2d270b[_0xde01('0x5d')])))?path[_0xde01('0x63')](config[_0xde01('0x64')],_0x33e2a6,_[_0xde01('0x65')](_0x2d270b[_0xde01('0x5d')])):path[_0xde01('0x63')](config['root'],_0x33e2a6,_[_0xde01('0x65')]('default_preferred.png'));var _0x15d6b5=_0xde01('0x66')+_[_0xde01('0x69')](_0xde01('0x5d'));if(_0x2d270b[_0x15d6b5]||!_0x497214['custom']||!_0x497214['preferred']){_0x498024=path[_0xde01('0x63')](config[_0xde01('0x64')],_0x33e2a6,_['toLower'](_0xde01('0x75')));}if(!fs[_0xde01('0x62')](_0x498024)){throw new db[(_0xde01('0x6e'))]['ValidationError'](_[_0xde01('0x69')]('preferred')+_0xde01('0x6a'));}return _0x571f9e[_0xde01('0x6b')](_0x498024);}})['catch'](handleError(_0x571f9e,null));};exports[_0xde01('0x76')]=function(_0x3681a4,_0x59c357,_0x38c473){if(_0x3681a4['file']&&_0x3681a4['file'][_0xde01('0x56')]){_0x3681a4[_0xde01('0x54')][_0xde01('0x5e')]=_0x3681a4['file'][_0xde01('0x56')];}return db['Setting'][_0xde01('0x53')]({'where':{'id':_0x3681a4[_0xde01('0x4f')]['id']}})[_0xde01('0x1d')](handleEntityNotFound(_0x59c357,null))[_0xde01('0x1d')](saveUpdates(_0x3681a4[_0xde01('0x54')],null))[_0xde01('0x1d')](respondWithResult(_0x59c357,null))[_0xde01('0x4e')](handleError(_0x59c357,null));};var utilLicense=require(_0xde01('0x59'));exports[_0xde01('0x77')]=function(_0x986859,_0x2d41ad,_0xb806a3){var _0x1f84d8=_0xde01('0x5b');var _0x36ee04={'custom':![]};return utilLicense[_0xde01('0x5c')]()[_0xde01('0x1d')](function(_0x46c8a4){if(_0x46c8a4){_0x36ee04=_0x46c8a4;}return db[_0xde01('0x38')][_0xde01('0x53')]({'where':{'id':_0x986859[_0xde01('0x4f')]['id']},'attributes':[_0xde01('0x57'),_0xde01('0x58'),_0xde01('0x5d'),_0xde01('0x5e'),_0xde01('0x5f'),'defaultLoginLogo',_0xde01('0x61'),_0xde01('0x74')],'raw':!![]});})[_0xde01('0x1d')](handleEntityNotFound(_0x2d41ad,null))['then'](function(_0x5a6181){if(_0x5a6181){var _0x12b58a=_0x5a6181[_0xde01('0x5e')]&&fs[_0xde01('0x62')](path[_0xde01('0x63')](config[_0xde01('0x64')],_0x1f84d8,_[_0xde01('0x65')](_0x5a6181[_0xde01('0x5e')])))?path[_0xde01('0x63')](config[_0xde01('0x64')],_0x1f84d8,_[_0xde01('0x65')](_0x5a6181[_0xde01('0x5e')])):path[_0xde01('0x63')](config[_0xde01('0x64')],_0x1f84d8,_['toLower'](_0xde01('0x78')));var _0x40db25=_0xde01('0x66')+_[_0xde01('0x69')](_0xde01('0x5e'));if(_0x5a6181[_0x40db25]||!_0x36ee04[_0xde01('0x67')]){_0x12b58a=path[_0xde01('0x63')](config[_0xde01('0x64')],_0x1f84d8,_[_0xde01('0x65')]('default_favicon.ico'));}if(!fs[_0xde01('0x62')](_0x12b58a)){throw new db['Sequelize'][(_0xde01('0x6f'))](_[_0xde01('0x69')](_0xde01('0x5e'))+_0xde01('0x6a'));}return _0x2d41ad[_0xde01('0x6b')](_0x12b58a);}})[_0xde01('0x4e')](handleError(_0x2d41ad,null));};exports['getDate']=function(_0x43f9ab,_0x5bde1e){var _0x18a600={'offset':moment()[_0xde01('0x79')]()};_0x18a600[_0xde01('0x7a')]=moment()[_0xde01('0x79')](_0x18a600[_0xde01('0x2d')])[_0xde01('0x7b')](_0xde01('0x7c'));return _0x5bde1e[_0xde01('0x28')](0xc8)['send'](_0x18a600);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 6053198..d236539 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 _0xe14b=['bluebird','path','./setting.attributes','exports','define','Setting','settings','lodash','util','moment'];(function(_0x544e30,_0x15cf04){var _0x277b5f=function(_0x2c54a7){while(--_0x2c54a7){_0x544e30['push'](_0x544e30['shift']());}};_0x277b5f(++_0x15cf04);}(_0xe14b,0x93));var _0xbe14=function(_0x5459a,_0x5f31fc){_0x5459a=_0x5459a-0x0;var _0x2bd539=_0xe14b[_0x5459a];return _0x2bd539;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe14('0x5'));module[_0xbe14('0x6')]=function(_0x1fe204,_0x1ff100){return _0x1fe204[_0xbe14('0x7')](_0xbe14('0x8'),attributes,{'tableName':_0xbe14('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./setting.attributes','exports','Setting','util'];(function(_0x32b4d9,_0x1ed508){var _0x486e2a=function(_0x19c48e){while(--_0x19c48e){_0x32b4d9['push'](_0x32b4d9['shift']());}};_0x486e2a(++_0x1ed508);}(_0xedd9,0xfc));var _0x9edd=function(_0x35c4d0,_0x3fb283){_0x35c4d0=_0x35c4d0-0x0;var _0x2af969=_0xedd9[_0x35c4d0];return _0x2af969;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var fs=require('fs');var path=require(_0x9edd('0x6'));var rimraf=require(_0x9edd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9edd('0x8'));module[_0x9edd('0x9')]=function(_0x268f9e,_0x34c1a7){return _0x268f9e['define'](_0x9edd('0xa'),attributes,{'tableName':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 619dc78..9803786 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 _0xdb66=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Setting,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','Setting','options','where','include','map','attributes','model','catch','ShowSetting','moment','bluebird','randomstring','ioredis'];(function(_0x14d0d9,_0x170c73){var _0x5e3e1c=function(_0xb46f16){while(--_0xb46f16){_0x14d0d9['push'](_0x14d0d9['shift']());}};_0x5e3e1c(++_0x170c73);}(_0xdb66,0x128));var _0x6db6=function(_0x424a9a,_0x2dd9af){_0x424a9a=_0x424a9a-0x0;var _0xa7831c=_0xdb66[_0x424a9a];return _0xa7831c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6db6('0x0'));var BPromise=require(_0x6db6('0x1'));var rs=require(_0x6db6('0x2'));var fs=require('fs');var Redis=require(_0x6db6('0x3'));var db=require(_0x6db6('0x4'))['db'];var utils=require(_0x6db6('0x5'));var logger=require(_0x6db6('0x6'))(_0x6db6('0x7'));var config=require(_0x6db6('0x8'));var jayson=require(_0x6db6('0x9'));var client=jayson[_0x6db6('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32fbed,_0x3e9781,_0x46cfee){return new BPromise(function(_0x48371c,_0x5ac22d){return client[_0x6db6('0xb')](_0x32fbed,_0x46cfee)[_0x6db6('0xc')](function(_0x4e1b96){logger[_0x6db6('0xd')](_0x6db6('0xe'),_0x3e9781,'request\x20sent');logger[_0x6db6('0xf')]('Setting,\x20%s,\x20%s,\x20%s',_0x3e9781,_0x6db6('0x10'),JSON[_0x6db6('0x11')](_0x4e1b96));if(_0x4e1b96[_0x6db6('0x12')]){if(_0x4e1b96[_0x6db6('0x12')]['code']===0x1f4){logger[_0x6db6('0x12')](_0x6db6('0xe'),_0x3e9781,_0x4e1b96[_0x6db6('0x12')][_0x6db6('0x13')]);return _0x5ac22d(_0x4e1b96[_0x6db6('0x12')][_0x6db6('0x13')]);}logger[_0x6db6('0x12')](_0x6db6('0xe'),_0x3e9781,_0x4e1b96[_0x6db6('0x12')][_0x6db6('0x13')]);return _0x48371c(_0x4e1b96[_0x6db6('0x12')][_0x6db6('0x13')]);}else{logger['info'](_0x6db6('0xe'),_0x3e9781,_0x6db6('0x10'));_0x48371c(_0x4e1b96[_0x6db6('0x14')]['message']);}})['catch'](function(_0x3c0761){logger[_0x6db6('0x12')](_0x6db6('0xe'),_0x3e9781,_0x3c0761);_0x5ac22d(_0x3c0761);});});}exports['ShowSetting']=function(_0x2a7451){var _0x22fcca=this;return new Promise(function(_0x462cc3,_0xa71bf7){return db[_0x6db6('0x15')]['find']({'raw':_0x2a7451[_0x6db6('0x16')]?_0x2a7451[_0x6db6('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x2a7451['options']?_0x2a7451[_0x6db6('0x16')][_0x6db6('0x17')]||null:null,'attributes':_0x2a7451['options']?_0x2a7451['options']['attributes']||null:null,'include':_0x2a7451[_0x6db6('0x16')]?_0x2a7451[_0x6db6('0x16')][_0x6db6('0x18')]?_[_0x6db6('0x19')](_0x2a7451['options'][_0x6db6('0x18')],function(_0xe233ca){return{'model':db[_0xe233ca['model']],'as':_0xe233ca['as'],'attributes':_0xe233ca[_0x6db6('0x1a')],'include':_0xe233ca[_0x6db6('0x18')]?_['map'](_0xe233ca['include'],function(_0x4d565d){return{'model':db[_0x4d565d[_0x6db6('0x1b')]],'as':_0x4d565d['as'],'attributes':_0x4d565d['attributes'],'include':_0x4d565d[_0x6db6('0x18')]?_[_0x6db6('0x19')](_0x4d565d[_0x6db6('0x18')],function(_0x179d6b){return{'model':db[_0x179d6b[_0x6db6('0x1b')]],'as':_0x179d6b['as'],'attributes':_0x179d6b[_0x6db6('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4fa73e){logger[_0x6db6('0xd')]('ShowSetting',_0x2a7451);logger[_0x6db6('0xf')]('ShowSetting',_0x2a7451,JSON['stringify'](_0x4fa73e));_0x462cc3(_0x4fa73e);})[_0x6db6('0x1c')](function(_0x2fa921){logger[_0x6db6('0x12')](_0x6db6('0x1d'),_0x2fa921[_0x6db6('0x13')],_0x2a7451);_0xa71bf7(_0x22fcca[_0x6db6('0x12')](0x1f4,_0x2fa921[_0x6db6('0x13')]));});});}; \ No newline at end of file +var _0x59e3=['info','Setting,\x20%s,\x20%s','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','ShowSetting','Setting','options','raw','where','attributes','include','map','model','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x2fa1f6,_0x46f872){var _0x55d45c=function(_0x3ceeb6){while(--_0x3ceeb6){_0x2fa1f6['push'](_0x2fa1f6['shift']());}};_0x55d45c(++_0x46f872);}(_0x59e3,0x1c4));var _0x359e=function(_0x4ffcde,_0x5bf31d){_0x4ffcde=_0x4ffcde-0x0;var _0x230d47=_0x59e3[_0x4ffcde];return _0x230d47;};'use strict';var _=require('lodash');var util=require(_0x359e('0x0'));var moment=require(_0x359e('0x1'));var BPromise=require('bluebird');var rs=require(_0x359e('0x2'));var fs=require('fs');var Redis=require(_0x359e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x359e('0x4'));var logger=require(_0x359e('0x5'))(_0x359e('0x6'));var config=require(_0x359e('0x7'));var jayson=require(_0x359e('0x8'));var client=jayson[_0x359e('0x9')][_0x359e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x203778,_0x5ab56e,_0x45b58a){return new BPromise(function(_0x36a789,_0x415ecd){return client[_0x359e('0xb')](_0x203778,_0x45b58a)[_0x359e('0xc')](function(_0x459eea){logger[_0x359e('0xd')](_0x359e('0xe'),_0x5ab56e,'request\x20sent');logger[_0x359e('0xf')](_0x359e('0x10'),_0x5ab56e,'request\x20sent',JSON[_0x359e('0x11')](_0x459eea));if(_0x459eea['error']){if(_0x459eea[_0x359e('0x12')][_0x359e('0x13')]===0x1f4){logger[_0x359e('0x12')](_0x359e('0xe'),_0x5ab56e,_0x459eea[_0x359e('0x12')][_0x359e('0x14')]);return _0x415ecd(_0x459eea[_0x359e('0x12')][_0x359e('0x14')]);}logger[_0x359e('0x12')]('Setting,\x20%s,\x20%s',_0x5ab56e,_0x459eea[_0x359e('0x12')]['message']);return _0x36a789(_0x459eea[_0x359e('0x12')][_0x359e('0x14')]);}else{logger[_0x359e('0xd')]('Setting,\x20%s,\x20%s',_0x5ab56e,'request\x20sent');_0x36a789(_0x459eea['result']['message']);}})[_0x359e('0x15')](function(_0x8eb650){logger[_0x359e('0x12')](_0x359e('0xe'),_0x5ab56e,_0x8eb650);_0x415ecd(_0x8eb650);});});}exports[_0x359e('0x16')]=function(_0x4c54cf){var _0xd10d1d=this;return new Promise(function(_0x388ff8,_0x43c09f){return db[_0x359e('0x17')]['find']({'raw':_0x4c54cf[_0x359e('0x18')]?_0x4c54cf[_0x359e('0x18')][_0x359e('0x19')]===undefined?!![]:![]:!![],'where':_0x4c54cf[_0x359e('0x18')]?_0x4c54cf[_0x359e('0x18')][_0x359e('0x1a')]||null:null,'attributes':_0x4c54cf[_0x359e('0x18')]?_0x4c54cf['options'][_0x359e('0x1b')]||null:null,'include':_0x4c54cf['options']?_0x4c54cf['options'][_0x359e('0x1c')]?_[_0x359e('0x1d')](_0x4c54cf['options'][_0x359e('0x1c')],function(_0x1b3440){return{'model':db[_0x1b3440[_0x359e('0x1e')]],'as':_0x1b3440['as'],'attributes':_0x1b3440[_0x359e('0x1b')],'include':_0x1b3440[_0x359e('0x1c')]?_[_0x359e('0x1d')](_0x1b3440[_0x359e('0x1c')],function(_0x5b3f69){return{'model':db[_0x5b3f69['model']],'as':_0x5b3f69['as'],'attributes':_0x5b3f69[_0x359e('0x1b')],'include':_0x5b3f69[_0x359e('0x1c')]?_[_0x359e('0x1d')](_0x5b3f69[_0x359e('0x1c')],function(_0xc7e42c){return{'model':db[_0xc7e42c[_0x359e('0x1e')]],'as':_0xc7e42c['as'],'attributes':_0xc7e42c['attributes']};}):[]};}):[]};}):[]:[]})[_0x359e('0xc')](function(_0x1cb929){logger['info']('ShowSetting',_0x4c54cf);logger[_0x359e('0xf')](_0x359e('0x16'),_0x4c54cf,JSON[_0x359e('0x11')](_0x1cb929));_0x388ff8(_0x1cb929);})[_0x359e('0x15')](function(_0x5323a8){logger[_0x359e('0x12')](_0x359e('0x16'),_0x5323a8[_0x359e('0x14')],_0x4c54cf);_0x43c09f(_0xd10d1d['error'](0x1f4,_0x5323a8[_0x359e('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 66df805..d45ff8d 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(_0x1ea124,_0x2244b3){var _0x480f33=function(_0x287ef2){while(--_0x287ef2){_0x1ea124['push'](_0x1ea124['shift']());}};_0x480f33(++_0x2244b3);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id',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(_0x2b084a,_0x9079ff){var _0x7c323=function(_0x33513f){while(--_0x33513f){_0x2b084a['push'](_0x2b084a['shift']());}};_0x7c323(++_0x9079ff);}(_0x7a54,0x106));var _0x47a5=function(_0x5b7172,_0x2e3046){_0x5b7172=_0x5b7172-0x0;var _0x104cff=_0x7a54[_0x5b7172];return _0x104cff;};'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 a4e1137..09c266f 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 _0x65c8=['plivo','bandwidth','csc','infobip','intelepeer','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','randomstring','STRING','name','generate','ENUM','twilio','skebby','connectel'];(function(_0x106bb8,_0x44e522){var _0x4fa7e5=function(_0x39df92){while(--_0x39df92){_0x106bb8['push'](_0x106bb8['shift']());}};_0x4fa7e5(++_0x44e522);}(_0x65c8,0x7b));var _0x865c=function(_0x48afc9,_0x3b0a1d){_0x48afc9=_0x48afc9-0x0;var _0x18d991=_0x65c8[_0x48afc9];return _0x18d991;};'use strict';var Sequelize=require(_0x865c('0x0'));var rs=require(_0x865c('0x1'));module['exports']={'name':{'type':Sequelize[_0x865c('0x2')],'unique':_0x865c('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x865c('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x865c('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x865c('0x2')],'defaultValue':function(){return rs[_0x865c('0x4')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x865c('0x5')](_0x865c('0x6'),_0x865c('0x7'),_0x865c('0x8'),'clicksend',_0x865c('0x9'),'clickatell',_0x865c('0xa'),_0x865c('0xb'),_0x865c('0xc'),_0x865c('0xd'))},'accountSid':{'type':Sequelize[_0x865c('0x2')]},'authId':{'type':Sequelize[_0x865c('0x2')]},'authToken':{'type':Sequelize[_0x865c('0x2')]},'smsMethod':{'type':Sequelize[_0x865c('0x5')]('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0x865c('0x2')]},'applicationId':{'type':Sequelize[_0x865c('0x2')]},'accountId':{'type':Sequelize[_0x865c('0x2')]},'senderString':{'type':Sequelize[_0x865c('0x2')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x865c('0x2')]},'notificationTemplate':{'type':Sequelize[_0x865c('0xe')],'defaultValue':function(){return _0x865c('0xf');}},'notificationSound':{'type':Sequelize[_0x865c('0x10')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x865c('0x10')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x865c('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x865c('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x865c('0x10')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x865c('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x865c('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x865c('0x11')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x865c('0x12'),'set':function(_0x514757){if(!_0x514757)this['setDataValue'](_0x865c('0x13'),null);this[_0x865c('0x14')](_0x865c('0x15'),_0x514757);}}}; \ No newline at end of file +var _0x7a7a=['ENUM','twilio','skebby','clicksend','plivo','clickatell','bandwidth','infobip','intelepeer','BOOLEAN','TEXT','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','setDataValue','sequelize','randomstring','exports','STRING','name','generate'];(function(_0x2aa91c,_0x2ac87f){var _0xf06bdd=function(_0x43dcbc){while(--_0x43dcbc){_0x2aa91c['push'](_0x2aa91c['shift']());}};_0xf06bdd(++_0x2ac87f);}(_0x7a7a,0x1dd));var _0xa7a7=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x7a7a[_0x422905];return _0x33dc6c;};'use strict';var Sequelize=require(_0xa7a7('0x0'));var rs=require(_0xa7a7('0x1'));module[_0xa7a7('0x2')]={'name':{'type':Sequelize[_0xa7a7('0x3')],'unique':_0xa7a7('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0xa7a7('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0xa7a7('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0xa7a7('0x3')],'defaultValue':function(){return rs[_0xa7a7('0x5')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xa7a7('0x6')](_0xa7a7('0x7'),_0xa7a7('0x8'),'connectel',_0xa7a7('0x9'),_0xa7a7('0xa'),_0xa7a7('0xb'),_0xa7a7('0xc'),'csc',_0xa7a7('0xd'),_0xa7a7('0xe'))},'accountSid':{'type':Sequelize[_0xa7a7('0x3')]},'authId':{'type':Sequelize[_0xa7a7('0x3')]},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize[_0xa7a7('0x6')]('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0xa7a7('0x3')]},'applicationId':{'type':Sequelize[_0xa7a7('0x3')]},'accountId':{'type':Sequelize[_0xa7a7('0x3')]},'senderString':{'type':Sequelize[_0xa7a7('0x3')]},'deliveryReport':{'type':Sequelize[_0xa7a7('0xf')],'defaultValue':![]},'description':{'type':Sequelize[_0xa7a7('0x3')]},'notificationTemplate':{'type':Sequelize[_0xa7a7('0x10')],'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[_0xa7a7('0xf')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xa7a7('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xa7a7('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xa7a7('0xf')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xa7a7('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xa7a7('0xf')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xa7a7('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xa7a7('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xa7a7('0x11')],'comment':_0xa7a7('0x12')},'mandatoryDisposition':{'type':Sequelize[_0xa7a7('0xf')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x5db02d){if(!_0x5db02d)this['setDataValue'](_0xa7a7('0x13'),null);this[_0xa7a7('0x14')]('mandatoryDisposition',_0x5db02d);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 29181ed..e7ee924 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 _0x36ea=['moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','redis','./smsAccount.socket','register','jayson/promise','http','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','error','message','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','get','UserProfileResource','stack','name','index','Pause','mandatoryDispositionPause','map','type','key','model','keys','filters','intersection','query','fields','attributes','length','sort','where','pick','filter','merge','VIRTUAL','options','SmsAccount','includeAll','include','findAll','rows','show','params','rawAttributes','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SmsAccounts','userProfileId','autoAssociation','create','describe','addDisposition','SmsAccountId','Disposition','findOne','hasOwnProperty','nolimit','order','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','notify','sms','SmsApplication','account','applications','Applications','priority','asc','CmContact','Sequelize','ValidationError','difference','updatedAt','createdAt','mobile','twilio','from','From','Body','messageId','skebby','text','connectel','clicksend','plivo','Text','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','refid','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','ListId','DESC','list','Contacts','contact','SmsInteraction','spread','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','User','queueId','unshift','queue','waitForTheAssignedQueue','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','text/xml','send','\x0a','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','finally','getApplications','Contact','Owner','fullname','internal','Tag','Tags','color','tag','to\x20is\x20mandatory','List','out','dataValues','Messages','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','message_id','groupName','redif','DELIVERED','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','statusGet','message-id','state','addAgents','omit','userSmsAccount:save','removeAgents','isArray','emit','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x36ea,0xe5));var _0xa36e=function(_0x188703,_0x596b26){_0x188703=_0x188703-0x0;var _0x1a0c81=_0x36ea[_0x188703];return _0x1a0c81;};'use strict';var emlformat=require(_0xa36e('0x0'));var rimraf=require(_0xa36e('0x1'));var zipdir=require(_0xa36e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa36e('0x3'));var BPromise=require(_0xa36e('0x4'));var Mustache=require(_0xa36e('0x5'));var util=require(_0xa36e('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xa36e('0x7'));var ejs=require(_0xa36e('0x8'));var fs=require('fs');var fs_extra=require(_0xa36e('0x9'));var _=require(_0xa36e('0xa'));var squel=require(_0xa36e('0xb'));var crypto=require('crypto');var jsforce=require(_0xa36e('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa36e('0x7'));var querystring=require(_0xa36e('0xd'));var Papa=require(_0xa36e('0xe'));var Redis=require('ioredis');var authService=require(_0xa36e('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa36e('0x10'));var logger=require(_0xa36e('0x11'))(_0xa36e('0x12'));var utils=require(_0xa36e('0x13'));var config=require(_0xa36e('0x14'));var licenseUtil=require(_0xa36e('0x15'));var db=require(_0xa36e('0x16'))['db'];config['redis']=_[_0xa36e('0x17')](config['redis'],{'host':_0xa36e('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa36e('0x19')]));require(_0xa36e('0x1a'))[_0xa36e('0x1b')](socket);var jayson=require(_0xa36e('0x1c'));var client=jayson['client'][_0xa36e('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0x3d8885,_0x5d8c3a,_0x271166,_0x159c26){return new BPromise(function(_0x1ccaf4,_0x114cba){var _0x174118=_0x159c26||client;return _0x174118['request'](_0x3d8885,_0x271166)[_0xa36e('0x1e')](function(_0x126532){logger[_0xa36e('0x1f')](_0xa36e('0x20'),_0x5d8c3a,_0xa36e('0x21'));logger[_0xa36e('0x22')](_0xa36e('0x23'),_0x5d8c3a,_0xa36e('0x21'),JSON['stringify'](_0x126532));if(_0x126532['error']){if(_0x126532[_0xa36e('0x24')]['code']===0x1f4){logger[_0xa36e('0x24')](_0xa36e('0x20'),_0x5d8c3a,_0x126532['error'][_0xa36e('0x25')]);return _0x114cba(_0x126532['error'][_0xa36e('0x25')]);}logger[_0xa36e('0x24')](_0xa36e('0x20'),_0x5d8c3a,_0x126532[_0xa36e('0x24')]['message']);return _0x1ccaf4(_0x126532[_0xa36e('0x24')][_0xa36e('0x25')]);}else{logger[_0xa36e('0x1f')](_0xa36e('0x20'),_0x5d8c3a,_0xa36e('0x21'));_0x1ccaf4(_0x126532[_0xa36e('0x26')][_0xa36e('0x25')]);}})[_0xa36e('0x27')](function(_0x12aecf){logger[_0xa36e('0x24')]('SmsAccount,\x20%s,\x20%s',_0x5d8c3a,_0x12aecf);_0x114cba(_0x12aecf);});});}function respondWithStatusCode(_0x2b0dc2,_0x280a24){_0x280a24=_0x280a24||0xcc;return function(_0x4b5983){if(_0x4b5983){return _0x2b0dc2[_0xa36e('0x28')](_0x280a24);}return _0x2b0dc2[_0xa36e('0x29')](_0x280a24)[_0xa36e('0x2a')]();};}function respondWithResult(_0x227d95,_0xc38849){_0xc38849=_0xc38849||0xc8;return function(_0x382b5e){if(_0x382b5e){return _0x227d95[_0xa36e('0x29')](_0xc38849)['json'](_0x382b5e);}};}function respondWithFilteredResult(_0x9ae323,_0x2a093f){return function(_0x4877f9){if(_0x4877f9){var _0x1b01de=typeof _0x2a093f[_0xa36e('0x2b')]===_0xa36e('0x2c')&&typeof _0x2a093f[_0xa36e('0x2d')]==='undefined';var _0x286151=_0x4877f9[_0xa36e('0x2e')];var _0x1ae472=_0x1b01de?0x0:_0x2a093f['offset'];var _0x10aa42=_0x1b01de?_0x4877f9['count']:_0x2a093f['offset']+_0x2a093f[_0xa36e('0x2d')];var _0x21f4ac;if(_0x10aa42>=_0x286151){_0x10aa42=_0x286151;_0x21f4ac=0xc8;}else{_0x21f4ac=0xce;}_0x9ae323[_0xa36e('0x29')](_0x21f4ac);return _0x9ae323[_0xa36e('0x2f')](_0xa36e('0x30'),_0x1ae472+'-'+_0x10aa42+'/'+_0x286151)[_0xa36e('0x31')](_0x4877f9);}return null;};}function patchUpdates(_0x2854de){return function(_0x17a721){try{jsonpatch[_0xa36e('0x32')](_0x17a721,_0x2854de,!![]);}catch(_0x29d6b6){return BPromise[_0xa36e('0x33')](_0x29d6b6);}return _0x17a721[_0xa36e('0x34')]();};}function saveUpdates(_0x1a066a,_0x1165a1){return function(_0x4409e3){if(_0x4409e3){return _0x4409e3[_0xa36e('0x35')](_0x1a066a)['then'](function(_0x59caa2){return _0x59caa2;});}return null;};}function removeEntity(_0x4a5284,_0x391d4c){return function(_0x1e4bd9){if(_0x1e4bd9){return _0x1e4bd9[_0xa36e('0x36')]()[_0xa36e('0x1e')](function(){var _0x56380d=_0x1e4bd9[_0xa36e('0x37')]({'plain':!![]});var _0x54024f='SmsAccounts';return db[_0xa36e('0x38')]['destroy']({'where':{'type':_0x54024f,'resourceId':_0x56380d['id']}})[_0xa36e('0x1e')](function(){return _0x1e4bd9;});})['then'](function(){_0x4a5284[_0xa36e('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x28dbb8,_0x413f7d){return function(_0x405fd1){if(!_0x405fd1){_0x28dbb8[_0xa36e('0x28')](0x194);}return _0x405fd1;};}function handleError(_0x49df9a,_0x34df1f){_0x34df1f=_0x34df1f||0x1f4;return function(_0xbd9021){logger[_0xa36e('0x24')](_0xbd9021[_0xa36e('0x39')]);if(_0xbd9021[_0xa36e('0x3a')]){delete _0xbd9021[_0xa36e('0x3a')];}_0x49df9a['status'](_0x34df1f)['send'](_0xbd9021);};}exports[_0xa36e('0x3b')]=function(_0xf31d74,_0xb5dbf){var _0x188962={'include':[{'model':db[_0xa36e('0x3c')],'as':_0xa36e('0x3d')}]},_0x2393b3={},_0x3209be={'count':0x0,'rows':[]};var _0x1b772b=_[_0xa36e('0x3e')](db['SmsAccount']['rawAttributes'],function(_0x1cc395){return{'name':_0x1cc395['fieldName'],'type':_0x1cc395[_0xa36e('0x3f')][_0xa36e('0x40')]};});_0x2393b3[_0xa36e('0x41')]=_[_0xa36e('0x3e')](_0x1b772b,_0xa36e('0x3a'));_0x2393b3['query']=_[_0xa36e('0x42')](_0xf31d74['query']);_0x2393b3[_0xa36e('0x43')]=_[_0xa36e('0x44')](_0x2393b3[_0xa36e('0x41')],_0x2393b3[_0xa36e('0x45')]);_0x188962['attributes']=_[_0xa36e('0x44')](_0x2393b3[_0xa36e('0x41')],qs[_0xa36e('0x46')](_0xf31d74['query'][_0xa36e('0x46')]));_0x188962[_0xa36e('0x47')]=_0x188962[_0xa36e('0x47')][_0xa36e('0x48')]?_0x188962[_0xa36e('0x47')]:_0x2393b3['model'];if(!_0xf31d74['query']['hasOwnProperty']('nolimit')){_0x188962['limit']=qs['limit'](_0xf31d74['query']['limit']);_0x188962[_0xa36e('0x2b')]=qs['offset'](_0xf31d74['query'][_0xa36e('0x2b')]);}_0x188962['order']=qs[_0xa36e('0x49')](_0xf31d74[_0xa36e('0x45')][_0xa36e('0x49')]);_0x188962[_0xa36e('0x4a')]=qs['filters'](_[_0xa36e('0x4b')](_0xf31d74[_0xa36e('0x45')],_0x2393b3['filters']),_0x1b772b);if(_0xf31d74[_0xa36e('0x45')][_0xa36e('0x4c')]){_0x188962['where']=_[_0xa36e('0x4d')](_0x188962[_0xa36e('0x4a')],{'$or':_[_0xa36e('0x3e')](_0x1b772b,function(_0x5b45b9){if(_0x5b45b9[_0xa36e('0x3f')]!==_0xa36e('0x4e')){var _0x35a289={};_0x35a289[_0x5b45b9[_0xa36e('0x3a')]]={'$like':'%'+_0xf31d74[_0xa36e('0x45')][_0xa36e('0x4c')]+'%'};return _0x35a289;}})});}_0x188962=_[_0xa36e('0x4d')]({},_0x188962,_0xf31d74[_0xa36e('0x4f')]);var _0xf29485={'where':_0x188962[_0xa36e('0x4a')]};return db[_0xa36e('0x50')][_0xa36e('0x2e')](_0xf29485)[_0xa36e('0x1e')](function(_0x492848){_0x3209be[_0xa36e('0x2e')]=_0x492848;if(_0xf31d74[_0xa36e('0x45')][_0xa36e('0x51')]){_0x188962[_0xa36e('0x52')]=[{'all':!![]}];}return db[_0xa36e('0x50')][_0xa36e('0x53')](_0x188962);})['then'](function(_0xa9da60){_0x3209be[_0xa36e('0x54')]=_0xa9da60;return _0x3209be;})[_0xa36e('0x1e')](respondWithFilteredResult(_0xb5dbf,_0x188962))[_0xa36e('0x27')](handleError(_0xb5dbf,null));};exports[_0xa36e('0x55')]=function(_0x5bedd7,_0x5a2885){var _0x3254a8={'raw':![],'where':{'id':_0x5bedd7[_0xa36e('0x56')]['id']},'include':[{'model':db[_0xa36e('0x3c')],'as':'mandatoryDispositionPause'}]},_0x1f895c={};_0x1f895c[_0xa36e('0x41')]=_[_0xa36e('0x42')](db[_0xa36e('0x50')][_0xa36e('0x57')]);_0x1f895c[_0xa36e('0x45')]=_[_0xa36e('0x42')](_0x5bedd7[_0xa36e('0x45')]);_0x1f895c[_0xa36e('0x43')]=_[_0xa36e('0x44')](_0x1f895c[_0xa36e('0x41')],_0x1f895c[_0xa36e('0x45')]);_0x3254a8[_0xa36e('0x47')]=_[_0xa36e('0x44')](_0x1f895c[_0xa36e('0x41')],qs[_0xa36e('0x46')](_0x5bedd7[_0xa36e('0x45')]['fields']));_0x3254a8['attributes']=_0x3254a8[_0xa36e('0x47')]['length']?_0x3254a8[_0xa36e('0x47')]:_0x1f895c[_0xa36e('0x41')];if(_0x5bedd7[_0xa36e('0x45')]['includeAll']){_0x3254a8[_0xa36e('0x52')]=[{'all':!![]}];}_0x3254a8=_[_0xa36e('0x4d')]({},_0x3254a8,_0x5bedd7['options']);return db['SmsAccount'][_0xa36e('0x58')](_0x3254a8)[_0xa36e('0x1e')](handleEntityNotFound(_0x5a2885,null))[_0xa36e('0x1e')](respondWithResult(_0x5a2885,null))[_0xa36e('0x27')](handleError(_0x5a2885,null));};exports['create']=function(_0x1e2d9d,_0x81567){return db[_0xa36e('0x50')]['create'](_0x1e2d9d[_0xa36e('0x59')],{})[_0xa36e('0x1e')](function(_0x98182d){var _0x45dcd2=_0x1e2d9d[_0xa36e('0x5a')][_0xa36e('0x37')]({'plain':!![]});if(!_0x45dcd2)throw new Error(_0xa36e('0x5b'));if(_0x45dcd2[_0xa36e('0x5c')]===_0xa36e('0x5a')){var _0x1ae5eb=_0x98182d[_0xa36e('0x37')]({'plain':!![]});var _0x498518=_0xa36e('0x5d');return db['UserProfileSection'][_0xa36e('0x58')]({'where':{'name':_0x498518,'userProfileId':_0x45dcd2[_0xa36e('0x5e')]},'raw':!![]})['then'](function(_0x322111){if(_0x322111&&_0x322111[_0xa36e('0x5f')]===0x0){return db[_0xa36e('0x38')][_0xa36e('0x60')]({'name':_0x1ae5eb['name'],'resourceId':_0x1ae5eb['id'],'type':_0x322111[_0xa36e('0x3a')],'sectionId':_0x322111['id']},{})['then'](function(){return _0x98182d;});}else{return _0x98182d;}})[_0xa36e('0x27')](function(_0x3b0a54){logger[_0xa36e('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3b0a54);throw _0x3b0a54;});}return _0x98182d;})[_0xa36e('0x1e')](respondWithResult(_0x81567,0xc9))[_0xa36e('0x27')](handleError(_0x81567,null));};exports[_0xa36e('0x35')]=function(_0x1425c5,_0x385363){if(_0x1425c5[_0xa36e('0x59')]['id']){delete _0x1425c5[_0xa36e('0x59')]['id'];}return db[_0xa36e('0x50')][_0xa36e('0x58')]({'where':{'id':_0x1425c5[_0xa36e('0x56')]['id']},'include':[{'model':db['Pause'],'as':_0xa36e('0x3d')}]})['then'](handleEntityNotFound(_0x385363,null))[_0xa36e('0x1e')](saveUpdates(_0x1425c5[_0xa36e('0x59')],null))[_0xa36e('0x1e')](respondWithResult(_0x385363,null))['catch'](handleError(_0x385363,null));};exports[_0xa36e('0x36')]=function(_0x45ec0e,_0x1543a6){return db[_0xa36e('0x50')][_0xa36e('0x58')]({'where':{'id':_0x45ec0e[_0xa36e('0x56')]['id']}})[_0xa36e('0x1e')](handleEntityNotFound(_0x1543a6,null))[_0xa36e('0x1e')](removeEntity(_0x1543a6,null))[_0xa36e('0x27')](handleError(_0x1543a6,null));};exports[_0xa36e('0x61')]=function(_0x1df822,_0x57d799){return db['SmsAccount'][_0xa36e('0x61')]()[_0xa36e('0x1e')](respondWithResult(_0x57d799,null))[_0xa36e('0x27')](handleError(_0x57d799,null));};exports[_0xa36e('0x62')]=function(_0x2de7b7,_0x563ba1,_0x2f66af){if(_0x2de7b7['body']['id']){delete _0x2de7b7[_0xa36e('0x59')]['id'];}return db['SmsAccount'][_0xa36e('0x58')]({'where':{'id':_0x2de7b7[_0xa36e('0x56')]['id']}})[_0xa36e('0x1e')](handleEntityNotFound(_0x563ba1,null))[_0xa36e('0x1e')](function(_0x21a1b3){if(_0x21a1b3){_0x2de7b7[_0xa36e('0x59')][_0xa36e('0x63')]=_0x21a1b3['id'];return db[_0xa36e('0x64')][_0xa36e('0x60')](_0x2de7b7[_0xa36e('0x59')]);}})[_0xa36e('0x1e')](respondWithResult(_0x563ba1,null))['catch'](handleError(_0x563ba1,null));};exports['getDispositions']=function(_0x42ac04,_0x45362c,_0x1e8d23){var _0x5eaf0c={'raw':![],'where':{}};var _0x135b2f={};var _0xae7147={'count':0x0,'rows':[]};return db[_0xa36e('0x50')][_0xa36e('0x65')]({'where':{'id':_0x42ac04[_0xa36e('0x56')]['id']}})[_0xa36e('0x1e')](handleEntityNotFound(_0x45362c,null))[_0xa36e('0x1e')](function(_0x294994){if(_0x294994){_0x135b2f[_0xa36e('0x41')]=_['keys'](db[_0xa36e('0x64')][_0xa36e('0x57')]);_0x135b2f[_0xa36e('0x45')]=_[_0xa36e('0x42')](_0x42ac04['query']);_0x135b2f[_0xa36e('0x43')]=_[_0xa36e('0x44')](_0x135b2f[_0xa36e('0x41')],_0x135b2f['query']);_0x5eaf0c[_0xa36e('0x47')]=_[_0xa36e('0x44')](_0x135b2f[_0xa36e('0x41')],qs[_0xa36e('0x46')](_0x42ac04[_0xa36e('0x45')]['fields']));_0x5eaf0c[_0xa36e('0x47')]=_0x5eaf0c[_0xa36e('0x47')][_0xa36e('0x48')]?_0x5eaf0c['attributes']:_0x135b2f['model'];if(!_0x42ac04['query'][_0xa36e('0x66')](_0xa36e('0x67'))){_0x5eaf0c[_0xa36e('0x2d')]=qs['limit'](_0x42ac04['query']['limit']);_0x5eaf0c['offset']=qs[_0xa36e('0x2b')](_0x42ac04[_0xa36e('0x45')][_0xa36e('0x2b')]);}_0x5eaf0c[_0xa36e('0x68')]=qs[_0xa36e('0x49')](_0x42ac04[_0xa36e('0x45')][_0xa36e('0x49')]);_0x5eaf0c[_0xa36e('0x4a')]=qs['filters'](_[_0xa36e('0x4b')](_0x42ac04[_0xa36e('0x45')],_0x135b2f[_0xa36e('0x43')]));_0x5eaf0c[_0xa36e('0x4a')][_0xa36e('0x63')]=_0x294994['id'];if(_0x42ac04[_0xa36e('0x45')][_0xa36e('0x4c')]){_0x5eaf0c[_0xa36e('0x4a')]=_[_0xa36e('0x4d')](_0x5eaf0c[_0xa36e('0x4a')],{'$or':_[_0xa36e('0x3e')](_0x5eaf0c['attributes'],function(_0x3bd605){var _0x41a464={};_0x41a464[_0x3bd605]={'$like':'%'+_0x42ac04[_0xa36e('0x45')][_0xa36e('0x4c')]+'%'};return _0x41a464;})});}_0x5eaf0c=_[_0xa36e('0x4d')]({},_0x5eaf0c,_0x42ac04[_0xa36e('0x4f')]);return db[_0xa36e('0x64')]['count']({'where':_0x5eaf0c[_0xa36e('0x4a')]})['then'](function(_0x178aa6){_0xae7147['count']=_0x178aa6;if(_0x42ac04[_0xa36e('0x45')][_0xa36e('0x51')]){_0x5eaf0c[_0xa36e('0x52')]=[{'all':!![]}];}return db[_0xa36e('0x64')][_0xa36e('0x53')](_0x5eaf0c);})[_0xa36e('0x1e')](function(_0x55ed00){_0xae7147[_0xa36e('0x54')]=_0x55ed00;return _0xae7147;});}})['then'](respondWithFilteredResult(_0x45362c,_0x5eaf0c))[_0xa36e('0x27')](handleError(_0x45362c,null));};exports[_0xa36e('0x69')]=function(_0x2e17fa,_0x4ca038,_0x42c22d){return db[_0xa36e('0x50')][_0xa36e('0x58')]({'where':{'id':_0x2e17fa['params']['id']}})['then'](handleEntityNotFound(_0x4ca038,null))[_0xa36e('0x1e')](function(_0x57fff1){if(_0x57fff1){return _0x57fff1[_0xa36e('0x69')](_0x2e17fa[_0xa36e('0x45')][_0xa36e('0x6a')]);}})[_0xa36e('0x1e')](respondWithStatusCode(_0x4ca038,null))['catch'](handleError(_0x4ca038,null));};exports[_0xa36e('0x6b')]=function(_0x10dd1a,_0xb1d3c3,_0xc03d11){if(_0x10dd1a[_0xa36e('0x59')]['id']){delete _0x10dd1a[_0xa36e('0x59')]['id'];}return db[_0xa36e('0x50')][_0xa36e('0x58')]({'where':{'id':_0x10dd1a['params']['id']}})[_0xa36e('0x1e')](handleEntityNotFound(_0xb1d3c3,null))['then'](function(_0x16779a){if(_0x16779a){_0x10dd1a[_0xa36e('0x59')][_0xa36e('0x63')]=_0x16779a['id'];return db['CannedAnswer'][_0xa36e('0x60')](_0x10dd1a[_0xa36e('0x59')]);}})['then'](respondWithResult(_0xb1d3c3,null))[_0xa36e('0x27')](handleError(_0xb1d3c3,null));};exports[_0xa36e('0x6c')]=function(_0x428d98,_0xec668a,_0x427831){var _0x2594b1={'raw':![],'where':{}};var _0x5f2932={};var _0x22f444={'count':0x0,'rows':[]};return db['SmsAccount']['findOne']({'where':{'id':_0x428d98[_0xa36e('0x56')]['id']}})[_0xa36e('0x1e')](handleEntityNotFound(_0xec668a,null))[_0xa36e('0x1e')](function(_0x284992){if(_0x284992){_0x5f2932[_0xa36e('0x41')]=_[_0xa36e('0x42')](db['CannedAnswer'][_0xa36e('0x57')]);_0x5f2932[_0xa36e('0x45')]=_[_0xa36e('0x42')](_0x428d98[_0xa36e('0x45')]);_0x5f2932[_0xa36e('0x43')]=_['intersection'](_0x5f2932[_0xa36e('0x41')],_0x5f2932[_0xa36e('0x45')]);_0x2594b1[_0xa36e('0x47')]=_['intersection'](_0x5f2932[_0xa36e('0x41')],qs[_0xa36e('0x46')](_0x428d98[_0xa36e('0x45')][_0xa36e('0x46')]));_0x2594b1[_0xa36e('0x47')]=_0x2594b1[_0xa36e('0x47')]['length']?_0x2594b1[_0xa36e('0x47')]:_0x5f2932[_0xa36e('0x41')];if(!_0x428d98[_0xa36e('0x45')]['hasOwnProperty'](_0xa36e('0x67'))){_0x2594b1['limit']=qs['limit'](_0x428d98[_0xa36e('0x45')]['limit']);_0x2594b1['offset']=qs[_0xa36e('0x2b')](_0x428d98[_0xa36e('0x45')][_0xa36e('0x2b')]);}_0x2594b1[_0xa36e('0x68')]=qs[_0xa36e('0x49')](_0x428d98[_0xa36e('0x45')][_0xa36e('0x49')]);_0x2594b1[_0xa36e('0x4a')]=qs[_0xa36e('0x43')](_['pick'](_0x428d98[_0xa36e('0x45')],_0x5f2932['filters']));_0x2594b1['where'][_0xa36e('0x63')]=_0x284992['id'];if(_0x428d98[_0xa36e('0x45')][_0xa36e('0x4c')]){_0x2594b1[_0xa36e('0x4a')]=_[_0xa36e('0x4d')](_0x2594b1['where'],{'$or':_[_0xa36e('0x3e')](_0x2594b1[_0xa36e('0x47')],function(_0x4db4ed){var _0x1341a2={};_0x1341a2[_0x4db4ed]={'$like':'%'+_0x428d98[_0xa36e('0x45')][_0xa36e('0x4c')]+'%'};return _0x1341a2;})});}_0x2594b1=_[_0xa36e('0x4d')]({},_0x2594b1,_0x428d98[_0xa36e('0x4f')]);return db[_0xa36e('0x6d')][_0xa36e('0x2e')]({'where':_0x2594b1[_0xa36e('0x4a')]})[_0xa36e('0x1e')](function(_0x408a32){_0x22f444[_0xa36e('0x2e')]=_0x408a32;if(_0x428d98['query'][_0xa36e('0x51')]){_0x2594b1['include']=[{'all':!![]}];}return db[_0xa36e('0x6d')][_0xa36e('0x53')](_0x2594b1);})[_0xa36e('0x1e')](function(_0x33e3cd){_0x22f444[_0xa36e('0x54')]=_0x33e3cd;return _0x22f444;});}})[_0xa36e('0x1e')](respondWithFilteredResult(_0xec668a,_0x2594b1))[_0xa36e('0x27')](handleError(_0xec668a,null));};exports[_0xa36e('0x6e')]=function(_0x598d9e,_0x1b10d4,_0x27198d){return db[_0xa36e('0x50')][_0xa36e('0x58')]({'where':{'id':_0x598d9e[_0xa36e('0x56')]['id']}})['then'](handleEntityNotFound(_0x1b10d4,null))[_0xa36e('0x1e')](function(_0x15b997){if(_0x15b997){return _0x15b997[_0xa36e('0x6e')](_0x598d9e[_0xa36e('0x45')][_0xa36e('0x6a')]);}})['then'](respondWithStatusCode(_0x1b10d4,null))[_0xa36e('0x27')](handleError(_0x1b10d4,null));};exports[_0xa36e('0x6f')]=function(_0x8c7e02,_0xcc1172,_0x26b2fd){var _0x3b2f5f={'channel':_0xa36e('0x70')};var _0x482cfc=[];var _0x283db8=[];var _0x4aa092={};return db[_0xa36e('0x50')]['find']({'where':{'id':_0x8c7e02['params']['id']},'include':[{'model':db[_0xa36e('0x71')],'as':'Applications'}]})[_0xa36e('0x1e')](handleEntityNotFound(_0xcc1172,null))[_0xa36e('0x1e')](function(_0x179c06){_0x3b2f5f[_0xa36e('0x72')]=_0x179c06;_0x3b2f5f[_0xa36e('0x73')]=_['orderBy'](_0x179c06[_0xa36e('0x74')],[_0xa36e('0x75')],[_0xa36e('0x76')]);if(_0x3b2f5f[_0xa36e('0x72')][_0xa36e('0x74')]){delete _0x3b2f5f['account'][_0xa36e('0x74')];}return db[_0xa36e('0x77')][_0xa36e('0x61')]();})['then'](function(_0x51103e){if(!_0x51103e){throw new db[(_0xa36e('0x78'))][(_0xa36e('0x79'))]('no\x20available\x20attributes');}_0x482cfc=_[_0xa36e('0x7a')](_['keys'](_0x51103e),['createdAt',_0xa36e('0x7b')]);_0x283db8=_[_0xa36e('0x7a')](_['keys'](_0x51103e),[_0xa36e('0x7c'),_0xa36e('0x7b'),'CompanyId','ListId']);_0x3b2f5f[_0xa36e('0x59')]={'mapKey':_0xa36e('0x7d')};if(_0x3b2f5f['account'][_0xa36e('0x3f')]){switch(_0x3b2f5f[_0xa36e('0x72')]['type']){case _0xa36e('0x7e'):_0x3b2f5f[_0xa36e('0x59')][_0xa36e('0x7f')]=_0x8c7e02[_0xa36e('0x59')][_0xa36e('0x80')];_0x3b2f5f[_0xa36e('0x59')][_0xa36e('0x59')]=_0x8c7e02['body'][_0xa36e('0x81')];_0x3b2f5f['body'][_0xa36e('0x82')]=_0x8c7e02['body']['MessageSid'];break;case _0xa36e('0x83'):_0x3b2f5f[_0xa36e('0x59')][_0xa36e('0x7f')]='+'+_0x8c7e02[_0xa36e('0x59')]['sender'];_0x3b2f5f[_0xa36e('0x59')][_0xa36e('0x59')]=_0x8c7e02['body'][_0xa36e('0x84')];break;case _0xa36e('0x85'):_0x3b2f5f['body'][_0xa36e('0x7f')]=_0x8c7e02[_0xa36e('0x59')][_0xa36e('0x7f')];_0x3b2f5f[_0xa36e('0x59')]['body']=_0x8c7e02[_0xa36e('0x59')]['message'];break;case _0xa36e('0x86'):_0x3b2f5f[_0xa36e('0x59')][_0xa36e('0x7f')]=_0x8c7e02['body'][_0xa36e('0x7f')];_0x3b2f5f[_0xa36e('0x59')][_0xa36e('0x59')]=_0x8c7e02['body'][_0xa36e('0x59')];_0x3b2f5f[_0xa36e('0x59')]['messageId']=_0x8c7e02[_0xa36e('0x59')]['message_id'];break;case _0xa36e('0x87'):_0x3b2f5f[_0xa36e('0x59')][_0xa36e('0x7f')]=_0x8c7e02[_0xa36e('0x59')]['From'];_0x3b2f5f[_0xa36e('0x59')][_0xa36e('0x59')]=_0x8c7e02[_0xa36e('0x59')][_0xa36e('0x88')];_0x3b2f5f[_0xa36e('0x59')][_0xa36e('0x82')]=_0x8c7e02[_0xa36e('0x59')][_0xa36e('0x89')];break;case _0xa36e('0x8a'):_0x3b2f5f['body'][_0xa36e('0x7f')]='+'+_0x8c7e02['body'][_0xa36e('0x8b')][0x0]['from'];_0x3b2f5f[_0xa36e('0x59')][_0xa36e('0x59')]=_0x8c7e02[_0xa36e('0x59')][_0xa36e('0x8b')][0x0][_0xa36e('0x84')];_0x3b2f5f[_0xa36e('0x59')][_0xa36e('0x82')]=_0x8c7e02[_0xa36e('0x59')]['results'][0x0][_0xa36e('0x82')];break;case _0xa36e('0x8c'):_0x3b2f5f['body']['from']=_0x8c7e02[_0xa36e('0x59')][_0xa36e('0x8d')];_0x3b2f5f[_0xa36e('0x59')]['body']=_0x8c7e02[_0xa36e('0x59')][_0xa36e('0x8e')][_0xa36e('0x25')];break;case _0xa36e('0x8f'):_0x3b2f5f[_0xa36e('0x59')][_0xa36e('0x7f')]=_0x8c7e02['body'][_0xa36e('0x90')];_0x3b2f5f[_0xa36e('0x59')][_0xa36e('0x59')]=_0x8c7e02[_0xa36e('0x59')][_0xa36e('0x84')];_0x3b2f5f[_0xa36e('0x59')]['messageId']=_0x8c7e02[_0xa36e('0x59')][_0xa36e('0x91')];break;case _0xa36e('0x92'):_0x3b2f5f[_0xa36e('0x59')][_0xa36e('0x82')]=_0x8c7e02[_0xa36e('0x59')][0x0]['message']['id'];_0x3b2f5f['body'][_0xa36e('0x7f')]=_0x8c7e02['body'][0x0][_0xa36e('0x25')][_0xa36e('0x7f')];_0x3b2f5f[_0xa36e('0x59')][_0xa36e('0x59')]=_0x8c7e02['body'][0x0][_0xa36e('0x25')]['text'];break;case _0xa36e('0x93'):_0x3b2f5f[_0xa36e('0x59')]['from']=_0x8c7e02[_0xa36e('0x59')][_0xa36e('0x7f')];_0x3b2f5f['body'][_0xa36e('0x59')]=_0x8c7e02[_0xa36e('0x59')][_0xa36e('0x25')];_0x3b2f5f[_0xa36e('0x59')][_0xa36e('0x82')]=_0x8c7e02['body'][_0xa36e('0x94')];break;}}if(_0x3b2f5f[_0xa36e('0x59')]['id']){delete _0x3b2f5f[_0xa36e('0x59')]['id'];}if(_[_0xa36e('0x95')](_0x3b2f5f[_0xa36e('0x59')]['from'])){throw new db[(_0xa36e('0x78'))][(_0xa36e('0x79'))]('from\x20is\x20mandatory');}if(_[_0xa36e('0x95')](_0x3b2f5f[_0xa36e('0x59')][_0xa36e('0x59')])||_0x3b2f5f[_0xa36e('0x59')][_0xa36e('0x59')]===''){throw new db[(_0xa36e('0x78'))][(_0xa36e('0x79'))](_0xa36e('0x96'));}if(_[_0xa36e('0x95')](_0x3b2f5f[_0xa36e('0x59')][_0xa36e('0x97')])){throw new db['Sequelize']['ValidationError'](_0xa36e('0x98')+_0x283db8);}if(!_['includes'](_0x283db8,_0x3b2f5f[_0xa36e('0x59')][_0xa36e('0x97')])){throw new db[(_0xa36e('0x78'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x283db8);}_0x4aa092[_0x3b2f5f['body']['mapKey']]=_0x3b2f5f[_0xa36e('0x59')][_0xa36e('0x7f')];return db[_0xa36e('0x99')]['find']({'where':{'id':_0x3b2f5f[_0xa36e('0x72')][_0xa36e('0x9a')]},'include':[{'model':db[_0xa36e('0x77')],'as':'Contacts','where':_0x4aa092,'limit':0x1,'order':[[_0xa36e('0x7b'),_0xa36e('0x9b')]]}]});})['then'](handleEntityNotFound(_0xcc1172,null))[_0xa36e('0x1e')](function(_0x319a2b){if(_0x319a2b){_0x3b2f5f[_0xa36e('0x9c')]=_['omit'](_0x319a2b,[_0xa36e('0x9d')]);if(_0x319a2b[_0xa36e('0x9d')][_0xa36e('0x48')]){return _0x319a2b[_0xa36e('0x9d')][0x0];}var _0x3e2c19=_[_0xa36e('0x17')](_0x3b2f5f[_0xa36e('0x59')],{'firstName':_0x3b2f5f['body'][_0xa36e('0x7f')],'ListId':_0x319a2b['id']});_0x3e2c19[_0x3b2f5f['body'][_0xa36e('0x97')]]=_0x3b2f5f[_0xa36e('0x59')][_0xa36e('0x7f')];return db[_0xa36e('0x77')][_0xa36e('0x60')](_0x3e2c19,{'fields':_0x482cfc,'raw':!![]});}})['then'](handleEntityNotFound(_0xcc1172,null))[_0xa36e('0x1e')](function(_0x1446b8){if(_0x1446b8){_0x3b2f5f[_0xa36e('0x9e')]=_0x1446b8;var _0x227e90={'ContactId':_0x1446b8['id'],'phone':_0x3b2f5f[_0xa36e('0x59')][_0xa36e('0x7f')],'SmsAccountId':_0x8c7e02[_0xa36e('0x56')]['id']};var _0x57d48b={'ContactId':_0x1446b8['id'],'SmsAccountId':_0x8c7e02[_0xa36e('0x56')]['id'],'closed':![]};return db[_0xa36e('0x9f')]['find']({'where':_0x57d48b})[_0xa36e('0x1e')](function(_0x273f7c){if(_0x273f7c){return[_0x273f7c,![]];}return db[_0xa36e('0x9f')]['create'](_0x227e90)[_0xa36e('0x1e')](function(_0x653eca){return[_0x653eca,!![]];});});}})[_0xa36e('0xa0')](function(_0xab8d01,_0x162d05){_0x3b2f5f[_0xa36e('0xa1')]=_0xab8d01[_0xa36e('0x37')]({'plain':!![]});_0x3b2f5f[_0xa36e('0xa1')][_0xa36e('0xa2')]=![];if(_0x162d05){if(_0x3b2f5f[_0xa36e('0x72')][_0xa36e('0xa3')]){_0x3b2f5f[_0xa36e('0x73')][_0xa36e('0xa4')]({'id':0x0,'priority':_0x3b2f5f[_0xa36e('0x73')][_0xa36e('0x48')]+0x1,'app':_0xa36e('0xa5'),'appdata':_0xa36e('0xa6'),'interval':_0xa36e('0xa7')});}_0x3b2f5f[_0xa36e('0xa1')][_0xa36e('0xa2')]=!![];}return db[_0xa36e('0xa8')]['create']({'phone':_0x3b2f5f[_0xa36e('0x59')][_0xa36e('0x7f')],'messageId':_0x3b2f5f[_0xa36e('0x59')]['messageId'],'body':_0x3b2f5f[_0xa36e('0x59')][_0xa36e('0x59')],'SmsAccountId':_0x8c7e02[_0xa36e('0x56')]['id'],'SmsInteractionId':_0xab8d01['id'],'direction':'in','ContactId':_0xab8d01[_0xa36e('0xa9')],'AttachmentId':_0x3b2f5f[_0xa36e('0x59')][_0xa36e('0xaa')]});})[_0xa36e('0x1e')](function(_0x384edb){_0x3b2f5f[_0xa36e('0x25')]=_0x384edb;if(!_0x3b2f5f[_0xa36e('0xa1')][_0xa36e('0xab')])return;return db[_0xa36e('0xac')]['find']({'attributes':['id','name'],'where':{'id':_0x3b2f5f[_0xa36e('0xa1')]['UserId']}});})['then'](function(_0x486924){if(_0x486924){_0x3b2f5f['applications']['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x486924[_0xa36e('0x3a')]+','+(_0x3b2f5f[_0xa36e('0x72')]['waitForTheAssignedAgent']||0xa),'interval':_0xa36e('0xa7')});}if(!_0x3b2f5f[_0xa36e('0xa1')][_0xa36e('0xad')])return;return db['SmsQueue'][_0xa36e('0x58')]({'attributes':['id',_0xa36e('0x3a')],'where':{'id':_0x3b2f5f[_0xa36e('0xa1')]['queueId']}});})[_0xa36e('0x1e')](function(_0x1dc917){if(_0x1dc917){_0x3b2f5f[_0xa36e('0x73')][_0xa36e('0xae')]({'id':0x0,'priority':0x1,'app':_0xa36e('0xaf'),'appdata':_0x1dc917['name']+','+(_0x3b2f5f[_0xa36e('0x72')][_0xa36e('0xb0')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start',_0xa36e('0xb1'),_0x3b2f5f);})[_0xa36e('0x1e')](function(_0xe1037c){if(_0xe1037c){var _0x300579=0xc8;var _0x553184=_0xa36e('0xb2');logger[_0xa36e('0x1f')](_0xa36e('0x23'),_0x553184,_0x300579,_0xa36e('0xb3'));logger[_0xa36e('0x22')](_0xa36e('0xb4'),_0x553184,_0x300579,_0xa36e('0xb3'),JSON[_0xa36e('0xb5')](_0xe1037c));if(_0x3b2f5f[_0xa36e('0x72')][_0xa36e('0x3f')]==='twilio'){return _0xcc1172[_0xa36e('0x29')](_0x300579)[_0xa36e('0x2f')]('Content-Type',_0xa36e('0xb6'))[_0xa36e('0xb7')](_0xa36e('0xb8'));}else{return _0xcc1172['status'](_0x300579)[_0xa36e('0x31')](_0xe1037c);}}})[_0xa36e('0x27')](handleError(_0xcc1172,null));};exports[_0xa36e('0xb9')]=function(_0x7d8288,_0xb09534){var _0x35303c=_0x7d8288['params']['id'];var _0x50a6fa=_0x7d8288[_0xa36e('0x59')];var _0x523a19=0xc8;var _0x353366=null;return db[_0xa36e('0xba')][_0xa36e('0xbb')]({'isolationLevel':db[_0xa36e('0xba')][_0xa36e('0xbc')][_0xa36e('0xbd')][_0xa36e('0xbe')]},function(_0x481f6d){return db[_0xa36e('0x50')][_0xa36e('0x65')]({'where':{'id':_0x35303c},'transaction':_0x481f6d})['then'](function(_0x2671ba){if(_0x2671ba){return db['SmsApplication']['destroy']({'where':{'SmsAccountId':_0x35303c},'transaction':_0x481f6d})['then'](function(){var _0x5c44a1=_[_0xa36e('0x3e')](_0x50a6fa,function(_0x2232cb){_0x2232cb['SmsAccountId']=_0x35303c;return _0x2232cb;});return db[_0xa36e('0x71')][_0xa36e('0xbf')](_0x5c44a1,{'transaction':_0x481f6d});});}else{_0x523a19=0x194;_0x353366=[];}});})[_0xa36e('0x1e')](function(){if(_0x523a19!==0x194){return db[_0xa36e('0x71')]['findAndCountAll']({'where':{'SmsAccountId':_0x35303c},'order':_0xa36e('0x75')})[_0xa36e('0x1e')](function(_0x52888a){_0x353366=_0x52888a;});}})['catch'](function(_0x1c5986){_0x523a19=0x1f4;logger[_0xa36e('0x24')](_0x1c5986[_0xa36e('0x39')]);if(_0x1c5986['name']){delete _0x1c5986['name'];}_0x353366=_0x1c5986;})[_0xa36e('0xc0')](function(){if(_0x353366===null){_0xb09534[_0xa36e('0x28')](_0x523a19);}else{if(_0x523a19===0x1f4){_0xb09534[_0xa36e('0x29')](_0x523a19)[_0xa36e('0xb7')](_0x353366);}else{_0xb09534[_0xa36e('0x29')](_0x523a19)[_0xa36e('0x31')](_0x353366);}}});};exports[_0xa36e('0xc1')]=function(_0x429171,_0x3d29f5,_0x20e892){var _0x311da8={};var _0x11662d={};var _0x3f5b55;var _0x275cb6;return db[_0xa36e('0x50')]['findOne']({'where':{'id':_0x429171[_0xa36e('0x56')]['id']}})[_0xa36e('0x1e')](handleEntityNotFound(_0x3d29f5,null))[_0xa36e('0x1e')](function(_0x4612c8){if(_0x4612c8){_0x3f5b55=_0x4612c8;_0x11662d[_0xa36e('0x41')]=_['keys'](db['SmsApplication'][_0xa36e('0x57')]);_0x11662d[_0xa36e('0x45')]=_[_0xa36e('0x42')](_0x429171[_0xa36e('0x45')]);_0x11662d[_0xa36e('0x43')]=_[_0xa36e('0x44')](_0x11662d['model'],_0x11662d[_0xa36e('0x45')]);_0x311da8[_0xa36e('0x47')]=_['intersection'](_0x11662d[_0xa36e('0x41')],qs['fields'](_0x429171[_0xa36e('0x45')]['fields']));_0x311da8[_0xa36e('0x47')]=_0x311da8['attributes'][_0xa36e('0x48')]?_0x311da8['attributes']:_0x11662d[_0xa36e('0x41')];_0x311da8[_0xa36e('0x68')]=qs['sort'](_0x429171['query'][_0xa36e('0x49')]);_0x311da8[_0xa36e('0x4a')]=qs['filters'](_['pick'](_0x429171[_0xa36e('0x45')],_0x11662d['filters']));if(_0x429171['query']['filter']){_0x311da8[_0xa36e('0x4a')]=_[_0xa36e('0x4d')](_0x311da8[_0xa36e('0x4a')],{'$or':_['map'](_0x311da8[_0xa36e('0x47')],function(_0x52b665){var _0x158031={};_0x158031[_0x52b665]={'$like':'%'+_0x429171[_0xa36e('0x45')][_0xa36e('0x4c')]+'%'};return _0x158031;})});}_0x311da8=_['merge']({},_0x311da8,_0x429171[_0xa36e('0x4f')]);return _0x3f5b55[_0xa36e('0xc1')](_0x311da8);}})[_0xa36e('0x1e')](function(_0x5cfdfc){if(_0x5cfdfc){_0x275cb6=_0x5cfdfc[_0xa36e('0x48')];if(!_0x429171['query'][_0xa36e('0x66')](_0xa36e('0x67'))){_0x311da8[_0xa36e('0x2d')]=qs[_0xa36e('0x2d')](_0x429171[_0xa36e('0x45')]['limit']);_0x311da8[_0xa36e('0x2b')]=qs[_0xa36e('0x2b')](_0x429171[_0xa36e('0x45')][_0xa36e('0x2b')]);}return _0x3f5b55[_0xa36e('0xc1')](_0x311da8);}})['then'](function(_0x32cf6b){if(_0x32cf6b){return _0x32cf6b?{'count':_0x275cb6,'rows':_0x32cf6b}:null;}})[_0xa36e('0x1e')](respondWithResult(_0x3d29f5,null))[_0xa36e('0x27')](handleError(_0x3d29f5,null));};exports['getInteractions']=function(_0x5b190d,_0x499b7b,_0x1c1437){var _0x56558e={'raw':![],'where':{}};var _0x2b4903={};var _0x2c03a3={'count':0x0,'rows':[]};return db[_0xa36e('0x50')][_0xa36e('0x65')]({'where':{'id':_0x5b190d[_0xa36e('0x56')]['id']}})[_0xa36e('0x1e')](handleEntityNotFound(_0x499b7b,null))[_0xa36e('0x1e')](function(_0x2e44e1){if(_0x2e44e1){_0x2b4903[_0xa36e('0x41')]=_[_0xa36e('0x42')](db[_0xa36e('0x9f')][_0xa36e('0x57')]);_0x2b4903[_0xa36e('0x45')]=_[_0xa36e('0x42')](_0x5b190d[_0xa36e('0x45')]);_0x2b4903[_0xa36e('0x43')]=_[_0xa36e('0x44')](_0x2b4903[_0xa36e('0x41')],_0x2b4903[_0xa36e('0x45')]);_0x56558e[_0xa36e('0x47')]=_[_0xa36e('0x44')](_0x2b4903[_0xa36e('0x41')],qs['fields'](_0x5b190d[_0xa36e('0x45')][_0xa36e('0x46')]));_0x56558e[_0xa36e('0x47')]=_0x56558e['attributes'][_0xa36e('0x48')]?_0x56558e[_0xa36e('0x47')]:_0x2b4903['model'];if(!_0x5b190d[_0xa36e('0x45')][_0xa36e('0x66')](_0xa36e('0x67'))){_0x56558e['limit']=qs['limit'](_0x5b190d[_0xa36e('0x45')]['limit']);_0x56558e[_0xa36e('0x2b')]=qs[_0xa36e('0x2b')](_0x5b190d[_0xa36e('0x45')][_0xa36e('0x2b')]);}_0x56558e[_0xa36e('0x68')]=qs[_0xa36e('0x49')](_0x5b190d['query'][_0xa36e('0x49')]);_0x56558e[_0xa36e('0x4a')]=qs[_0xa36e('0x43')](_['pick'](_0x5b190d[_0xa36e('0x45')],_0x2b4903['filters']));_0x56558e[_0xa36e('0x4a')][_0xa36e('0x63')]=_0x2e44e1['id'];if(_0x5b190d[_0xa36e('0x45')][_0xa36e('0x4c')]){_0x56558e[_0xa36e('0x4a')]=_[_0xa36e('0x4d')](_0x56558e[_0xa36e('0x4a')],{'$or':_[_0xa36e('0x3e')](_0x56558e[_0xa36e('0x47')],function(_0x108636){var _0x42b128={};_0x42b128[_0x108636]={'$like':'%'+_0x5b190d['query'][_0xa36e('0x4c')]+'%'};return _0x42b128;})});}_0x56558e=_[_0xa36e('0x4d')]({},_0x56558e,_0x5b190d['options']);return db[_0xa36e('0x9f')][_0xa36e('0x2e')]({'where':_0x56558e['where']})['then'](function(_0x448232){_0x2c03a3[_0xa36e('0x2e')]=_0x448232;if(_0x5b190d[_0xa36e('0x45')][_0xa36e('0x51')]){_0x56558e[_0xa36e('0x52')]=[{'model':db['CmContact'],'as':_0xa36e('0xc2'),'required':![]},{'model':db[_0xa36e('0xac')],'as':_0xa36e('0xc3'),'attributes':[_0xa36e('0x3a'),_0xa36e('0xc4'),_0xa36e('0xc5')],'required':![]},{'model':db[_0xa36e('0xc6')],'as':_0xa36e('0xc7'),'attributes':['id',_0xa36e('0x3a'),_0xa36e('0xc8')],'where':_0x5b190d[_0xa36e('0x45')]['tag']?{'id':_0x5b190d['query'][_0xa36e('0xc9')]}:undefined,'required':_0x5b190d['query'][_0xa36e('0xc9')]?!![]:![]}];}return db['SmsInteraction'][_0xa36e('0x53')](_0x56558e);})[_0xa36e('0x1e')](function(_0x2ac448){_0x2c03a3['rows']=_0x2ac448;return _0x2c03a3;});}})[_0xa36e('0x1e')](respondWithFilteredResult(_0x499b7b,_0x56558e))[_0xa36e('0x27')](handleError(_0x499b7b,null));};exports['send']=function(_0x2e9422,_0x4c0374,_0x1316eb){var _0x4ed28d,_0x299a0d,_0x5cf2f7;if(_[_0xa36e('0x95')](_0x2e9422[_0xa36e('0x59')][_0xa36e('0x59')])||_0x2e9422[_0xa36e('0x59')][_0xa36e('0x59')]===''){throw new db['Sequelize'][(_0xa36e('0x79'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xa36e('0x95')](_0x2e9422[_0xa36e('0x59')]['to'])){throw new db[(_0xa36e('0x78'))][(_0xa36e('0x79'))](_0xa36e('0xca'));}_0x4ed28d=_0x2e9422[_0xa36e('0x59')]['to'];return db[_0xa36e('0x50')]['find']({'where':{'id':_0x2e9422[_0xa36e('0x56')]['id']},'include':[{'model':db['CmList'],'as':_0xa36e('0xcb'),'include':[{'model':db['CmContact'],'as':_0xa36e('0x9d'),'where':{'mobile':_0x4ed28d},'limit':0x1,'order':[[_0xa36e('0x7b'),_0xa36e('0x9b')]]}]}]})[_0xa36e('0x1e')](handleEntityNotFound(_0x4c0374,null))['then'](function(_0x59348a){if(_0x59348a&&_0x59348a[_0xa36e('0xcb')]){_0x299a0d=_0x59348a['get']({'plain':!![]});if(_0x299a0d[_0xa36e('0xcb')]&&_0x299a0d[_0xa36e('0xcb')][_0xa36e('0x9d')]['length']){return _0x299a0d[_0xa36e('0xcb')]['Contacts'][0x0];}return db[_0xa36e('0x77')][_0xa36e('0x60')](_['defaults'](_0x2e9422['body'],{'firstName':_0x4ed28d,'mobile':_0x4ed28d,'phone':_0x4ed28d,'ListId':_0x299a0d[_0xa36e('0x9a')]}));}})[_0xa36e('0x1e')](handleEntityNotFound(_0x4c0374,null))[_0xa36e('0x1e')](function(_0x52826b){if(_0x52826b){_0x5cf2f7=_0x52826b;return db[_0xa36e('0x9f')][_0xa36e('0x58')]({'where':{'ContactId':_0x5cf2f7['id'],'closed':![],'SmsAccountId':_0x299a0d['id']}})[_0xa36e('0x1e')](function(_0x4bdeb9){if(_0x4bdeb9){return[_0x4bdeb9,![]];}return db[_0xa36e('0x9f')]['create']({'UserId':_0x2e9422['user']['id'],'ContactId':_0x5cf2f7['id'],'SmsAccountId':_0x299a0d['id'],'phone':_0x4ed28d,'firstMsgDirection':_0xa36e('0xcc'),'Messages':[_[_0xa36e('0x4d')](_0x2e9422[_0xa36e('0x59')],{'read':![],'body':_0x2e9422[_0xa36e('0x59')][_0xa36e('0x59')],'phone':_0x4ed28d,'SmsAccountId':_0x299a0d['id'],'UserId':_0x2e9422[_0xa36e('0x5a')]['id'],'ContactId':_0x5cf2f7['id']})]},{'include':[{'model':db[_0xa36e('0xa8')],'as':'Messages'}]})[_0xa36e('0x1e')](function(_0x4570aa){return[_0x4570aa,!![]];});});}})['spread'](function(_0x5b6bcc,_0x4d7369){if(_0x4d7369){return _0x5b6bcc;}return db[_0xa36e('0xa8')][_0xa36e('0x60')](_[_0xa36e('0x4d')](_0x2e9422[_0xa36e('0x59')],{'read':![],'body':_0x2e9422[_0xa36e('0x59')][_0xa36e('0x59')],'phone':_0x4ed28d,'SmsAccountId':_0x299a0d['id'],'SmsInteractionId':_0x5b6bcc['id'],'UserId':_0x2e9422['user']['id'],'ContactId':_0x5cf2f7['id']}))[_0xa36e('0x1e')](function(_0x2089ce){_0x5b6bcc[_0xa36e('0xcd')]['Messages']=[];_0x5b6bcc[_0xa36e('0xcd')][_0xa36e('0xce')][_0xa36e('0xa4')](_0x2089ce[_0xa36e('0xcd')]);return _0x5b6bcc;});})[_0xa36e('0x1e')](respondWithResult(_0x4c0374,null))['catch'](handleError(_0x4c0374,null));};exports['status']=function(_0x51b041,_0x40a751,_0x18ec7d){if(_0x51b041[_0xa36e('0x59')]['id']){delete _0x51b041['body']['id'];}var _0x4f7317,_0x545ae0,_0x2405aa;return db[_0xa36e('0x50')][_0xa36e('0x58')]({'where':{'id':_0x51b041[_0xa36e('0x56')]['id']}})[_0xa36e('0x1e')](handleEntityNotFound(_0x40a751,null))['then'](function(_0x5483f0){if(_0x5483f0){_0x2405aa=_0x5483f0;logger[_0xa36e('0x22')](_0xa36e('0x23'),_0xa36e('0x29'),_0xa36e('0xcf'),_0x5483f0[_0xa36e('0x3f')],util[_0xa36e('0xd0')](_0x51b041[_0xa36e('0x59')],{'showHidden':![],'depth':null}));switch(_0x5483f0[_0xa36e('0x3f')]){case _0xa36e('0x83'):if(_0x51b041[_0xa36e('0x59')][_0xa36e('0xd1')]&&_0x51b041[_0xa36e('0x59')][_0xa36e('0x29')]){_0x545ae0=_0x51b041[_0xa36e('0x59')][_0xa36e('0x29')];return db[_0xa36e('0xa8')][_0xa36e('0x58')]({'where':{'messageId':_0x51b041['body']['skebby_dispatch_id']}});}break;case _0xa36e('0x85'):if(_0x51b041[_0xa36e('0x59')][_0xa36e('0xd2')]&&_0x51b041[_0xa36e('0x59')][_0xa36e('0xd3')]){_0x545ae0=_0x51b041[_0xa36e('0x59')][_0xa36e('0xd3')];return db[_0xa36e('0xa8')][_0xa36e('0x58')]({'where':{'messageId':_0x51b041[_0xa36e('0x59')]['requestid']}});}break;case _0xa36e('0x86'):if(_0x51b041[_0xa36e('0x59')][_0xa36e('0xd4')]&&_0x51b041['body']['status_code']){_0x545ae0=_0x51b041['body']['status_code'];return db[_0xa36e('0xa8')][_0xa36e('0x58')]({'where':{'messageId':_0x51b041[_0xa36e('0x59')][_0xa36e('0xd4')]}});}break;case _0xa36e('0x8a'):var _0xf95f3d=_0x51b041[_0xa36e('0x59')][_0xa36e('0x8b')][0x0];if(_0xf95f3d[_0xa36e('0x82')]&&_0xf95f3d[_0xa36e('0x29')][_0xa36e('0xd5')]==='DELIVERED'){_0x545ae0=_0xf95f3d['status']['groupName'];return db[_0xa36e('0xa8')]['find']({'where':{'messageId':_0xf95f3d[_0xa36e('0x82')]}});}break;case _0xa36e('0x8f'):if(_0x51b041[_0xa36e('0x59')][_0xa36e('0x82')]&&_0x51b041[_0xa36e('0x59')]['status']){_0x545ae0=_0x51b041[_0xa36e('0x59')][_0xa36e('0x29')];return db['SmsMessage']['find']({'where':{'messageId':_0x51b041['body'][_0xa36e('0x82')]}});}break;case'bandwidth':if(_0x51b041[_0xa36e('0x59')][0x0][_0xa36e('0x25')]['id']){_0x545ae0=_0x51b041[_0xa36e('0x59')][0x0]['type'];return db['SmsMessage']['find']({'where':{'messageId':_0x51b041['body'][0x0][_0xa36e('0x25')]['id']}});}break;case _0xa36e('0x93'):if(_0x51b041[_0xa36e('0x59')][_0xa36e('0xd6')]&&_0x51b041[_0xa36e('0x59')]['status']){_0x545ae0=_0x51b041['body']['status'];return db['SmsMessage'][_0xa36e('0x58')]({'where':{'messageId':_0x51b041[_0xa36e('0x59')][_0xa36e('0xd6')]}});}break;}}})[_0xa36e('0x1e')](handleEntityNotFound(_0x40a751,null))[_0xa36e('0x1e')](function(_0x5907b5){if(_0x5907b5){_0x4f7317=_0x5907b5;switch(_0x2405aa[_0xa36e('0x3f')]){case _0xa36e('0x83'):if(_0x545ae0===_0xa36e('0xd7')){return _0x4f7317['update']({'read':!![]});}else{logger[_0xa36e('0x24')](_0xa36e('0x23'),'status',_0xa36e('0x83'),util[_0xa36e('0xd0')](_0x51b041['body'],{'showHidden':![],'depth':null}));}break;case _0xa36e('0x85'):if(_0x545ae0==='1'){return _0x4f7317[_0xa36e('0x35')]({'read':!![]});}else{logger['error'](_0xa36e('0x23'),_0xa36e('0x29'),_0xa36e('0x83'),util[_0xa36e('0xd0')](_0x51b041[_0xa36e('0x59')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x51b041['body']['error_code']&&_0x545ae0>=0xc8&&_0x545ae0<=0xce){return _0x4f7317[_0xa36e('0x35')]({'read':!![]});}else{logger[_0xa36e('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xa36e('0x29'),'clicksend',util[_0xa36e('0xd0')](_0x51b041[_0xa36e('0x59')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x8fdd=_0x51b041[_0xa36e('0x59')][_0xa36e('0x8b')][0x0];if(_0x8fdd[_0xa36e('0x29')][_0xa36e('0xd5')]===_0xa36e('0xd7')){return _0x4f7317[_0xa36e('0x35')]({'read':!![]});}else{logger[_0xa36e('0x24')](_0xa36e('0x23'),_0xa36e('0x29'),_0xa36e('0x8a'),util[_0xa36e('0xd0')](_0x51b041[_0xa36e('0x59')],{'showHidden':![],'depth':null}));}break;case _0xa36e('0x8f'):if(_0x545ae0==_0xa36e('0xd8')||_0x545ae0==_0xa36e('0xd9')){return _0x4f7317['update']({'read':!![]});}else{logger[_0xa36e('0x24')](_0xa36e('0x23'),_0xa36e('0x29'),_0xa36e('0x8f'),util['inspect'](_0x51b041['body'],{'showHidden':![],'depth':null}));}break;case _0xa36e('0x92'):if(_0x545ae0==_0xa36e('0xda')){return _0x4f7317[_0xa36e('0x35')]({'read':!![]});}else{logger[_0xa36e('0x24')](_0xa36e('0x23'),'status',_0xa36e('0x92'),util[_0xa36e('0xd0')](_0x51b041[_0xa36e('0x59')],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x545ae0===_0xa36e('0xdb')||_0x545ae0===_0xa36e('0xdc')){return _0x4f7317[_0xa36e('0x35')]({'read':!![]});}else{logger[_0xa36e('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xa36e('0x29'),_0xa36e('0x93'),util[_0xa36e('0xd0')](_0x51b041[_0xa36e('0x59')],{'showHidden':![],'depth':null}));}break;}return _0x4f7317;}})[_0xa36e('0x1e')](respondWithResult(_0x40a751,null))[_0xa36e('0x27')](handleError(_0x40a751,null));};exports[_0xa36e('0xdd')]=function(_0x3bcb22,_0x42b031,_0x4c59d5){var _0x4d67cb,_0x3abf19,_0x3409a5;return db['SmsAccount'][_0xa36e('0x58')]({'where':{'id':_0x3bcb22[_0xa36e('0x56')]['id']}})[_0xa36e('0x1e')](handleEntityNotFound(_0x42b031,null))['then'](function(_0x2a77f5){if(_0x2a77f5){_0x3409a5=_0x2a77f5;logger[_0xa36e('0x22')](_0xa36e('0x23'),_0xa36e('0x29'),_0xa36e('0xcf'),_0x2a77f5['type'],util['inspect'](_0x3bcb22[_0xa36e('0x45')],{'showHidden':![],'depth':null}));switch(_0x2a77f5['type']){case _0xa36e('0x8c'):if(_0x3bcb22[_0xa36e('0x45')][_0xa36e('0xde')]&&_0x3bcb22['query'][_0xa36e('0xdf')]){_0x3abf19=_0x3bcb22[_0xa36e('0x45')][_0xa36e('0xdf')];return db[_0xa36e('0xa8')]['find']({'where':{'messageId':_0x3bcb22['query']['message-id']}});}break;}}})['then'](handleEntityNotFound(_0x42b031,null))[_0xa36e('0x1e')](function(_0x59b8c9){if(_0x59b8c9){_0x4d67cb=_0x59b8c9;switch(_0x3409a5[_0xa36e('0x3f')]){case'csc':if(_0x3abf19==='2'||_0x3abf19==='6'){return _0x4d67cb[_0xa36e('0x35')]({'read':!![]});}else{logger[_0xa36e('0x24')](_0xa36e('0x23'),_0xa36e('0x29'),_0xa36e('0x8c'),util['inspect'](_0x3bcb22[_0xa36e('0x45')],{'showHidden':![],'depth':null}));};break;}return _0x4d67cb;}})[_0xa36e('0x1e')](respondWithResult(_0x42b031,null))[_0xa36e('0x27')](handleError(_0x42b031,null));};exports[_0xa36e('0xe0')]=function(_0x5bffcd,_0x1291d1,_0x25c8ba){return db[_0xa36e('0x50')]['find']({'where':{'id':_0x5bffcd[_0xa36e('0x56')]['id']}})[_0xa36e('0x1e')](handleEntityNotFound(_0x1291d1,null))['then'](function(_0x1fd888){if(_0x1fd888){return _0x1fd888[_0xa36e('0xe0')](_0x5bffcd[_0xa36e('0x59')]['ids'],_[_0xa36e('0xe1')](_0x5bffcd[_0xa36e('0x59')],[_0xa36e('0x6a'),'id'])||{})[_0xa36e('0xa0')](function(_0x294594){for(var _0x328c61=0x0;_0x328c61<_0x5bffcd[_0xa36e('0x59')][_0xa36e('0x6a')]['length'];_0x328c61+=0x1){socket['emit'](_0xa36e('0xe2'),{'UserId':Number(_0x5bffcd[_0xa36e('0x59')][_0xa36e('0x6a')][_0x328c61]),'SmsAccountId':Number(_0x5bffcd[_0xa36e('0x56')]['id'])});}return _0x294594;});}})['then'](respondWithResult(_0x1291d1,null))[_0xa36e('0x27')](handleError(_0x1291d1,null));};exports['removeAgents']=function(_0x1ee92e,_0x1f42c7,_0x349fc5){return db[_0xa36e('0x50')][_0xa36e('0x58')]({'where':{'id':_0x1ee92e['params']['id']}})[_0xa36e('0x1e')](handleEntityNotFound(_0x1f42c7,null))[_0xa36e('0x1e')](function(_0x23bf7d){if(_0x23bf7d){return _0x23bf7d[_0xa36e('0xe3')](_0x1ee92e['query'][_0xa36e('0x6a')])['then'](function(){if(_[_0xa36e('0xe4')](_0x1ee92e[_0xa36e('0x45')][_0xa36e('0x6a')])){for(var _0x40e87b=0x0;_0x40e87b<_0x1ee92e['query'][_0xa36e('0x6a')][_0xa36e('0x48')];_0x40e87b+=0x1){socket[_0xa36e('0xe5')](_0xa36e('0xe6'),{'UserId':Number(_0x1ee92e['query']['ids'][_0x40e87b]),'SmsAccountId':Number(_0x1ee92e[_0xa36e('0x56')]['id'])});}}else{socket[_0xa36e('0xe5')](_0xa36e('0xe6'),{'UserId':Number(_0x1ee92e[_0xa36e('0x45')][_0xa36e('0x6a')]),'SmsAccountId':Number(_0x1ee92e[_0xa36e('0x56')]['id'])});}});}})[_0xa36e('0x1e')](respondWithStatusCode(_0x1f42c7,null))['catch'](handleError(_0x1f42c7,null));};exports['getAgents']=function(_0x173fb4,_0x20ace1,_0xc4824d){var _0x269753={};var _0x3de055={};var _0x548856;var _0x4455c7;return db['SmsAccount'][_0xa36e('0x65')]({'where':{'id':_0x173fb4[_0xa36e('0x56')]['id']}})[_0xa36e('0x1e')](handleEntityNotFound(_0x20ace1,null))[_0xa36e('0x1e')](function(_0x159562){if(_0x159562){_0x548856=_0x159562;_0x3de055[_0xa36e('0x41')]=_[_0xa36e('0x42')](db['User'][_0xa36e('0x57')]);_0x3de055[_0xa36e('0x45')]=_[_0xa36e('0x42')](_0x173fb4[_0xa36e('0x45')]);_0x3de055['filters']=_['intersection'](_0x3de055[_0xa36e('0x41')],_0x3de055[_0xa36e('0x45')]);_0x269753[_0xa36e('0x47')]=_[_0xa36e('0x44')](_0x3de055['model'],qs[_0xa36e('0x46')](_0x173fb4['query'][_0xa36e('0x46')]));_0x269753[_0xa36e('0x47')]=_0x269753['attributes'][_0xa36e('0x48')]?_0x269753[_0xa36e('0x47')]:_0x3de055[_0xa36e('0x41')];_0x269753['order']=qs[_0xa36e('0x49')](_0x173fb4[_0xa36e('0x45')]['sort']);_0x269753[_0xa36e('0x4a')]=qs[_0xa36e('0x43')](_[_0xa36e('0x4b')](_0x173fb4[_0xa36e('0x45')],_0x3de055[_0xa36e('0x43')]));if(_0x173fb4[_0xa36e('0x45')][_0xa36e('0x4c')]){_0x269753[_0xa36e('0x4a')]=_[_0xa36e('0x4d')](_0x269753[_0xa36e('0x4a')],{'$or':_['map'](_0x269753[_0xa36e('0x47')],function(_0x13ca0b){var _0x3e1867={};_0x3e1867[_0x13ca0b]={'$like':'%'+_0x173fb4['query'][_0xa36e('0x4c')]+'%'};return _0x3e1867;})});}_0x269753=_[_0xa36e('0x4d')]({},_0x269753,_0x173fb4['options']);return _0x548856['getAgents'](_0x269753);}})[_0xa36e('0x1e')](function(_0x2b760b){if(_0x2b760b){_0x4455c7=_0x2b760b[_0xa36e('0x48')];if(!_0x173fb4[_0xa36e('0x45')][_0xa36e('0x66')](_0xa36e('0x67'))){_0x269753['limit']=qs['limit'](_0x173fb4[_0xa36e('0x45')][_0xa36e('0x2d')]);_0x269753[_0xa36e('0x2b')]=qs[_0xa36e('0x2b')](_0x173fb4[_0xa36e('0x45')][_0xa36e('0x2b')]);}return _0x548856[_0xa36e('0xe7')](_0x269753);}})[_0xa36e('0x1e')](function(_0x2cfb40){if(_0x2cfb40){return _0x2cfb40?{'count':_0x4455c7,'rows':_0x2cfb40}:null;}})[_0xa36e('0x1e')](respondWithResult(_0x20ace1,null))[_0xa36e('0x27')](handleError(_0x20ace1,null));}; \ No newline at end of file +var _0x5189=['register','jayson/promise','client','http','request','then','request\x20sent','stringify','error','code','SmsAccount,\x20%s,\x20%s','message','status','end','json','offset','undefined','count','set','Content-Range','reject','save','destroy','get','SmsAccounts','UserProfileResource','sendStatus','send','index','Pause','mandatoryDispositionPause','map','fieldName','type','key','name','query','keys','filters','intersection','model','attributes','fields','limit','sort','where','pick','filter','merge','includeAll','include','SmsAccount','rows','catch','show','rawAttributes','options','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','describe','addDisposition','SmsAccountId','Disposition','getDispositions','length','hasOwnProperty','nolimit','findAll','removeDispositions','addAnswer','CannedAnswer','findOne','order','removeAnswers','ids','notify','sms','Applications','account','applications','orderBy','priority','CmContact','Sequelize','ValidationError','difference','updatedAt','createdAt','ListId','mobile','twilio','from','From','Body','skebby','sender','clicksend','messageId','message_id','plivo','MessageUUID','infobip','results','text','originatingAddress','fromNumber','replyMessageId','bandwidth','intelepeer','refid','isNil','from\x20is\x20mandatory','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','Contacts','DESC','list','omit','contact','SmsInteraction','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','queueId','SmsQueue','waitForTheAssignedQueue','Start','receiveMessage','info','SmsAccount,\x20%s,\x20%s,\x20%s','entity\x20found','debug','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a','addApplications','transaction','ISOLATION_LEVELS','READ_COMMITTED','SmsApplication','bulkCreate','findAndCountAll','finally','getApplications','Contact','Owner','internal','Tag','color','tag','to\x20is\x20mandatory','CmList','List','out','spread','dataValues','Messages','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','connectel','requestid','statusInt','status_code','DELIVERED','clickatell','redif','error_code','groupName','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','csc','state','message-id','addAgents','userSmsAccount:save','removeAgents','isArray','emit','getAgents','rimraf','zip-dir','request-promise','moment','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','localhost','./smsAccount.socket'];(function(_0xe775be,_0x4822af){var _0x49e73c=function(_0x225efd){while(--_0x225efd){_0xe775be['push'](_0xe775be['shift']());}};_0x49e73c(++_0x4822af);}(_0x5189,0xce));var _0x9518=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x5189[_0x18ab2a];return _0x16dcee;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9518('0x0'));var zipdir=require(_0x9518('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9518('0x2'));var moment=require(_0x9518('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x9518('0x4'));var path=require(_0x9518('0x5'));var sox=require(_0x9518('0x6'));var csv=require('to-csv');var ejs=require(_0x9518('0x7'));var fs=require('fs');var fs_extra=require(_0x9518('0x8'));var _=require(_0x9518('0x9'));var squel=require(_0x9518('0xa'));var crypto=require(_0x9518('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x9518('0xc'));var toCsv=require(_0x9518('0xd'));var querystring=require(_0x9518('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9518('0xf'));var as=require(_0x9518('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9518('0x11'))(_0x9518('0x12'));var utils=require(_0x9518('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x9518('0x14'));var db=require('../../mysqldb')['db'];config[_0x9518('0x15')]=_[_0x9518('0x16')](config[_0x9518('0x15')],{'host':_0x9518('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9518('0x15')]));require(_0x9518('0x18'))[_0x9518('0x19')](socket);var jayson=require(_0x9518('0x1a'));var client=jayson[_0x9518('0x1b')][_0x9518('0x1c')]({'port':0x232c});function respondWithRpcPromise(_0x54ad3d,_0x1bb608,_0x364b8d,_0x41fb04){return new BPromise(function(_0x32fdcd,_0x1d5017){var _0x277c3a=_0x41fb04||client;return _0x277c3a[_0x9518('0x1d')](_0x54ad3d,_0x364b8d)[_0x9518('0x1e')](function(_0x14d83b){logger['info']('SmsAccount,\x20%s,\x20%s',_0x1bb608,_0x9518('0x1f'));logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x1bb608,_0x9518('0x1f'),JSON[_0x9518('0x20')](_0x14d83b));if(_0x14d83b[_0x9518('0x21')]){if(_0x14d83b[_0x9518('0x21')][_0x9518('0x22')]===0x1f4){logger[_0x9518('0x21')](_0x9518('0x23'),_0x1bb608,_0x14d83b[_0x9518('0x21')][_0x9518('0x24')]);return _0x1d5017(_0x14d83b[_0x9518('0x21')][_0x9518('0x24')]);}logger[_0x9518('0x21')](_0x9518('0x23'),_0x1bb608,_0x14d83b[_0x9518('0x21')][_0x9518('0x24')]);return _0x32fdcd(_0x14d83b[_0x9518('0x21')][_0x9518('0x24')]);}else{logger['info'](_0x9518('0x23'),_0x1bb608,'request\x20sent');_0x32fdcd(_0x14d83b['result'][_0x9518('0x24')]);}})['catch'](function(_0x385f3a){logger[_0x9518('0x21')](_0x9518('0x23'),_0x1bb608,_0x385f3a);_0x1d5017(_0x385f3a);});});}function respondWithStatusCode(_0x3e552d,_0x5d4e0d){_0x5d4e0d=_0x5d4e0d||0xcc;return function(_0x10b621){if(_0x10b621){return _0x3e552d['sendStatus'](_0x5d4e0d);}return _0x3e552d[_0x9518('0x25')](_0x5d4e0d)[_0x9518('0x26')]();};}function respondWithResult(_0x1b415e,_0x5e3a86){_0x5e3a86=_0x5e3a86||0xc8;return function(_0x1bcb61){if(_0x1bcb61){return _0x1b415e['status'](_0x5e3a86)[_0x9518('0x27')](_0x1bcb61);}};}function respondWithFilteredResult(_0xb45c90,_0x4480b2){return function(_0xbfa5e2){if(_0xbfa5e2){var _0x2c9402=typeof _0x4480b2[_0x9518('0x28')]===_0x9518('0x29')&&typeof _0x4480b2['limit']===_0x9518('0x29');var _0xeb767c=_0xbfa5e2['count'];var _0x1ce015=_0x2c9402?0x0:_0x4480b2['offset'];var _0x230b9c=_0x2c9402?_0xbfa5e2[_0x9518('0x2a')]:_0x4480b2['offset']+_0x4480b2['limit'];var _0x3382db;if(_0x230b9c>=_0xeb767c){_0x230b9c=_0xeb767c;_0x3382db=0xc8;}else{_0x3382db=0xce;}_0xb45c90[_0x9518('0x25')](_0x3382db);return _0xb45c90[_0x9518('0x2b')](_0x9518('0x2c'),_0x1ce015+'-'+_0x230b9c+'/'+_0xeb767c)[_0x9518('0x27')](_0xbfa5e2);}return null;};}function patchUpdates(_0x15f292){return function(_0x5b49fc){try{jsonpatch['apply'](_0x5b49fc,_0x15f292,!![]);}catch(_0x1f89d3){return BPromise[_0x9518('0x2d')](_0x1f89d3);}return _0x5b49fc[_0x9518('0x2e')]();};}function saveUpdates(_0x52b66e,_0x30a10c){return function(_0x762ce9){if(_0x762ce9){return _0x762ce9['update'](_0x52b66e)[_0x9518('0x1e')](function(_0x485b7f){return _0x485b7f;});}return null;};}function removeEntity(_0x4c7291,_0xd1d3d1){return function(_0x35dc6e){if(_0x35dc6e){return _0x35dc6e[_0x9518('0x2f')]()[_0x9518('0x1e')](function(){var _0x4131f9=_0x35dc6e[_0x9518('0x30')]({'plain':!![]});var _0xd8885f=_0x9518('0x31');return db[_0x9518('0x32')][_0x9518('0x2f')]({'where':{'type':_0xd8885f,'resourceId':_0x4131f9['id']}})[_0x9518('0x1e')](function(){return _0x35dc6e;});})[_0x9518('0x1e')](function(){_0x4c7291[_0x9518('0x25')](0xcc)[_0x9518('0x26')]();});}};}function handleEntityNotFound(_0x36e603,_0x2742a6){return function(_0x15b7b3){if(!_0x15b7b3){_0x36e603[_0x9518('0x33')](0x194);}return _0x15b7b3;};}function handleError(_0x539d3c,_0x48eba7){_0x48eba7=_0x48eba7||0x1f4;return function(_0x6ad5be){logger[_0x9518('0x21')](_0x6ad5be['stack']);if(_0x6ad5be['name']){delete _0x6ad5be['name'];}_0x539d3c['status'](_0x48eba7)[_0x9518('0x34')](_0x6ad5be);};}exports[_0x9518('0x35')]=function(_0x3f4ad3,_0xad9b31){var _0x47efa9={'include':[{'model':db[_0x9518('0x36')],'as':_0x9518('0x37')}]},_0x147bb5={},_0x3ec429={'count':0x0,'rows':[]};var _0x119a85=_[_0x9518('0x38')](db['SmsAccount']['rawAttributes'],function(_0x1f24d8){return{'name':_0x1f24d8[_0x9518('0x39')],'type':_0x1f24d8[_0x9518('0x3a')][_0x9518('0x3b')]};});_0x147bb5['model']=_['map'](_0x119a85,_0x9518('0x3c'));_0x147bb5[_0x9518('0x3d')]=_[_0x9518('0x3e')](_0x3f4ad3[_0x9518('0x3d')]);_0x147bb5[_0x9518('0x3f')]=_[_0x9518('0x40')](_0x147bb5[_0x9518('0x41')],_0x147bb5[_0x9518('0x3d')]);_0x47efa9[_0x9518('0x42')]=_['intersection'](_0x147bb5[_0x9518('0x41')],qs[_0x9518('0x43')](_0x3f4ad3[_0x9518('0x3d')][_0x9518('0x43')]));_0x47efa9[_0x9518('0x42')]=_0x47efa9[_0x9518('0x42')]['length']?_0x47efa9[_0x9518('0x42')]:_0x147bb5[_0x9518('0x41')];if(!_0x3f4ad3[_0x9518('0x3d')]['hasOwnProperty']('nolimit')){_0x47efa9[_0x9518('0x44')]=qs[_0x9518('0x44')](_0x3f4ad3['query']['limit']);_0x47efa9[_0x9518('0x28')]=qs[_0x9518('0x28')](_0x3f4ad3[_0x9518('0x3d')]['offset']);}_0x47efa9['order']=qs[_0x9518('0x45')](_0x3f4ad3[_0x9518('0x3d')][_0x9518('0x45')]);_0x47efa9[_0x9518('0x46')]=qs[_0x9518('0x3f')](_[_0x9518('0x47')](_0x3f4ad3[_0x9518('0x3d')],_0x147bb5['filters']),_0x119a85);if(_0x3f4ad3[_0x9518('0x3d')][_0x9518('0x48')]){_0x47efa9[_0x9518('0x46')]=_[_0x9518('0x49')](_0x47efa9['where'],{'$or':_[_0x9518('0x38')](_0x119a85,function(_0x4cf9bf){if(_0x4cf9bf[_0x9518('0x3a')]!=='VIRTUAL'){var _0x434f13={};_0x434f13[_0x4cf9bf[_0x9518('0x3c')]]={'$like':'%'+_0x3f4ad3[_0x9518('0x3d')][_0x9518('0x48')]+'%'};return _0x434f13;}})});}_0x47efa9=_[_0x9518('0x49')]({},_0x47efa9,_0x3f4ad3['options']);var _0x2d3419={'where':_0x47efa9[_0x9518('0x46')]};return db['SmsAccount']['count'](_0x2d3419)['then'](function(_0x43f6f1){_0x3ec429[_0x9518('0x2a')]=_0x43f6f1;if(_0x3f4ad3[_0x9518('0x3d')][_0x9518('0x4a')]){_0x47efa9[_0x9518('0x4b')]=[{'all':!![]}];}return db[_0x9518('0x4c')]['findAll'](_0x47efa9);})[_0x9518('0x1e')](function(_0x3d439f){_0x3ec429[_0x9518('0x4d')]=_0x3d439f;return _0x3ec429;})['then'](respondWithFilteredResult(_0xad9b31,_0x47efa9))[_0x9518('0x4e')](handleError(_0xad9b31,null));};exports[_0x9518('0x4f')]=function(_0x188e70,_0x5974a2){var _0x51291a={'raw':![],'where':{'id':_0x188e70['params']['id']},'include':[{'model':db[_0x9518('0x36')],'as':'mandatoryDispositionPause'}]},_0xb4e20d={};_0xb4e20d['model']=_['keys'](db[_0x9518('0x4c')][_0x9518('0x50')]);_0xb4e20d[_0x9518('0x3d')]=_[_0x9518('0x3e')](_0x188e70[_0x9518('0x3d')]);_0xb4e20d[_0x9518('0x3f')]=_['intersection'](_0xb4e20d['model'],_0xb4e20d['query']);_0x51291a[_0x9518('0x42')]=_[_0x9518('0x40')](_0xb4e20d[_0x9518('0x41')],qs[_0x9518('0x43')](_0x188e70[_0x9518('0x3d')][_0x9518('0x43')]));_0x51291a[_0x9518('0x42')]=_0x51291a[_0x9518('0x42')]['length']?_0x51291a[_0x9518('0x42')]:_0xb4e20d[_0x9518('0x41')];if(_0x188e70[_0x9518('0x3d')][_0x9518('0x4a')]){_0x51291a[_0x9518('0x4b')]=[{'all':!![]}];}_0x51291a=_[_0x9518('0x49')]({},_0x51291a,_0x188e70[_0x9518('0x51')]);return db[_0x9518('0x4c')]['find'](_0x51291a)[_0x9518('0x1e')](handleEntityNotFound(_0x5974a2,null))[_0x9518('0x1e')](respondWithResult(_0x5974a2,null))[_0x9518('0x4e')](handleError(_0x5974a2,null));};exports['create']=function(_0x2f659b,_0xbf4fcb){return db[_0x9518('0x4c')][_0x9518('0x52')](_0x2f659b['body'],{})['then'](function(_0x1c1318){var _0x3904e4=_0x2f659b[_0x9518('0x53')][_0x9518('0x30')]({'plain':!![]});if(!_0x3904e4)throw new Error(_0x9518('0x54'));if(_0x3904e4[_0x9518('0x55')]===_0x9518('0x53')){var _0x2ea99b=_0x1c1318[_0x9518('0x30')]({'plain':!![]});var _0x486ec7=_0x9518('0x31');return db['UserProfileSection'][_0x9518('0x56')]({'where':{'name':_0x486ec7,'userProfileId':_0x3904e4[_0x9518('0x57')]},'raw':!![]})[_0x9518('0x1e')](function(_0x2db110){if(_0x2db110&&_0x2db110[_0x9518('0x58')]===0x0){return db[_0x9518('0x32')][_0x9518('0x52')]({'name':_0x2ea99b['name'],'resourceId':_0x2ea99b['id'],'type':_0x2db110[_0x9518('0x3c')],'sectionId':_0x2db110['id']},{})[_0x9518('0x1e')](function(){return _0x1c1318;});}else{return _0x1c1318;}})[_0x9518('0x4e')](function(_0x43a38b){logger[_0x9518('0x21')](_0x9518('0x59'),_0x43a38b);throw _0x43a38b;});}return _0x1c1318;})[_0x9518('0x1e')](respondWithResult(_0xbf4fcb,0xc9))[_0x9518('0x4e')](handleError(_0xbf4fcb,null));};exports[_0x9518('0x5a')]=function(_0x1975da,_0x4e8ed8){if(_0x1975da[_0x9518('0x5b')]['id']){delete _0x1975da[_0x9518('0x5b')]['id'];}return db['SmsAccount'][_0x9518('0x56')]({'where':{'id':_0x1975da[_0x9518('0x5c')]['id']},'include':[{'model':db[_0x9518('0x36')],'as':_0x9518('0x37')}]})[_0x9518('0x1e')](handleEntityNotFound(_0x4e8ed8,null))[_0x9518('0x1e')](saveUpdates(_0x1975da[_0x9518('0x5b')],null))[_0x9518('0x1e')](respondWithResult(_0x4e8ed8,null))[_0x9518('0x4e')](handleError(_0x4e8ed8,null));};exports[_0x9518('0x2f')]=function(_0x4f5b6d,_0xf96cf0){return db['SmsAccount'][_0x9518('0x56')]({'where':{'id':_0x4f5b6d[_0x9518('0x5c')]['id']}})['then'](handleEntityNotFound(_0xf96cf0,null))[_0x9518('0x1e')](removeEntity(_0xf96cf0,null))[_0x9518('0x4e')](handleError(_0xf96cf0,null));};exports[_0x9518('0x5d')]=function(_0x58fdfe,_0x4b7ca0){return db['SmsAccount'][_0x9518('0x5d')]()[_0x9518('0x1e')](respondWithResult(_0x4b7ca0,null))['catch'](handleError(_0x4b7ca0,null));};exports[_0x9518('0x5e')]=function(_0x589fff,_0x2728b0,_0x3fa01d){if(_0x589fff['body']['id']){delete _0x589fff[_0x9518('0x5b')]['id'];}return db[_0x9518('0x4c')][_0x9518('0x56')]({'where':{'id':_0x589fff[_0x9518('0x5c')]['id']}})['then'](handleEntityNotFound(_0x2728b0,null))[_0x9518('0x1e')](function(_0x411215){if(_0x411215){_0x589fff[_0x9518('0x5b')][_0x9518('0x5f')]=_0x411215['id'];return db[_0x9518('0x60')]['create'](_0x589fff[_0x9518('0x5b')]);}})['then'](respondWithResult(_0x2728b0,null))['catch'](handleError(_0x2728b0,null));};exports[_0x9518('0x61')]=function(_0x310749,_0x32aa73,_0x3d66c6){var _0x55f6ba={'raw':![],'where':{}};var _0x49a19e={};var _0x565af7={'count':0x0,'rows':[]};return db[_0x9518('0x4c')]['findOne']({'where':{'id':_0x310749[_0x9518('0x5c')]['id']}})[_0x9518('0x1e')](handleEntityNotFound(_0x32aa73,null))[_0x9518('0x1e')](function(_0x153bba){if(_0x153bba){_0x49a19e[_0x9518('0x41')]=_['keys'](db['Disposition'][_0x9518('0x50')]);_0x49a19e['query']=_[_0x9518('0x3e')](_0x310749[_0x9518('0x3d')]);_0x49a19e[_0x9518('0x3f')]=_[_0x9518('0x40')](_0x49a19e[_0x9518('0x41')],_0x49a19e[_0x9518('0x3d')]);_0x55f6ba['attributes']=_[_0x9518('0x40')](_0x49a19e['model'],qs['fields'](_0x310749['query'][_0x9518('0x43')]));_0x55f6ba[_0x9518('0x42')]=_0x55f6ba[_0x9518('0x42')][_0x9518('0x62')]?_0x55f6ba[_0x9518('0x42')]:_0x49a19e[_0x9518('0x41')];if(!_0x310749['query'][_0x9518('0x63')](_0x9518('0x64'))){_0x55f6ba[_0x9518('0x44')]=qs['limit'](_0x310749[_0x9518('0x3d')][_0x9518('0x44')]);_0x55f6ba[_0x9518('0x28')]=qs[_0x9518('0x28')](_0x310749[_0x9518('0x3d')]['offset']);}_0x55f6ba['order']=qs[_0x9518('0x45')](_0x310749[_0x9518('0x3d')]['sort']);_0x55f6ba[_0x9518('0x46')]=qs[_0x9518('0x3f')](_[_0x9518('0x47')](_0x310749[_0x9518('0x3d')],_0x49a19e['filters']));_0x55f6ba[_0x9518('0x46')][_0x9518('0x5f')]=_0x153bba['id'];if(_0x310749[_0x9518('0x3d')][_0x9518('0x48')]){_0x55f6ba[_0x9518('0x46')]=_[_0x9518('0x49')](_0x55f6ba[_0x9518('0x46')],{'$or':_['map'](_0x55f6ba[_0x9518('0x42')],function(_0x424209){var _0x370f40={};_0x370f40[_0x424209]={'$like':'%'+_0x310749[_0x9518('0x3d')]['filter']+'%'};return _0x370f40;})});}_0x55f6ba=_['merge']({},_0x55f6ba,_0x310749[_0x9518('0x51')]);return db['Disposition'][_0x9518('0x2a')]({'where':_0x55f6ba['where']})[_0x9518('0x1e')](function(_0x30ee54){_0x565af7[_0x9518('0x2a')]=_0x30ee54;if(_0x310749[_0x9518('0x3d')]['includeAll']){_0x55f6ba[_0x9518('0x4b')]=[{'all':!![]}];}return db[_0x9518('0x60')][_0x9518('0x65')](_0x55f6ba);})[_0x9518('0x1e')](function(_0x2278b3){_0x565af7[_0x9518('0x4d')]=_0x2278b3;return _0x565af7;});}})[_0x9518('0x1e')](respondWithFilteredResult(_0x32aa73,_0x55f6ba))[_0x9518('0x4e')](handleError(_0x32aa73,null));};exports[_0x9518('0x66')]=function(_0x16d9ef,_0x1c42c2,_0x135244){return db[_0x9518('0x4c')][_0x9518('0x56')]({'where':{'id':_0x16d9ef[_0x9518('0x5c')]['id']}})[_0x9518('0x1e')](handleEntityNotFound(_0x1c42c2,null))[_0x9518('0x1e')](function(_0x2b21e4){if(_0x2b21e4){return _0x2b21e4['removeDispositions'](_0x16d9ef[_0x9518('0x3d')]['ids']);}})[_0x9518('0x1e')](respondWithStatusCode(_0x1c42c2,null))[_0x9518('0x4e')](handleError(_0x1c42c2,null));};exports[_0x9518('0x67')]=function(_0x297b43,_0x35d244,_0x5a524a){if(_0x297b43['body']['id']){delete _0x297b43[_0x9518('0x5b')]['id'];}return db['SmsAccount']['find']({'where':{'id':_0x297b43[_0x9518('0x5c')]['id']}})[_0x9518('0x1e')](handleEntityNotFound(_0x35d244,null))['then'](function(_0xf083d0){if(_0xf083d0){_0x297b43[_0x9518('0x5b')][_0x9518('0x5f')]=_0xf083d0['id'];return db[_0x9518('0x68')]['create'](_0x297b43['body']);}})[_0x9518('0x1e')](respondWithResult(_0x35d244,null))[_0x9518('0x4e')](handleError(_0x35d244,null));};exports['getAnswers']=function(_0x26e051,_0x5719a4,_0x55fe0f){var _0x4ad334={'raw':![],'where':{}};var _0x44dd6a={};var _0x45fac1={'count':0x0,'rows':[]};return db[_0x9518('0x4c')][_0x9518('0x69')]({'where':{'id':_0x26e051[_0x9518('0x5c')]['id']}})['then'](handleEntityNotFound(_0x5719a4,null))[_0x9518('0x1e')](function(_0x804d1b){if(_0x804d1b){_0x44dd6a['model']=_['keys'](db['CannedAnswer'][_0x9518('0x50')]);_0x44dd6a[_0x9518('0x3d')]=_[_0x9518('0x3e')](_0x26e051[_0x9518('0x3d')]);_0x44dd6a[_0x9518('0x3f')]=_[_0x9518('0x40')](_0x44dd6a[_0x9518('0x41')],_0x44dd6a[_0x9518('0x3d')]);_0x4ad334[_0x9518('0x42')]=_[_0x9518('0x40')](_0x44dd6a[_0x9518('0x41')],qs[_0x9518('0x43')](_0x26e051[_0x9518('0x3d')][_0x9518('0x43')]));_0x4ad334[_0x9518('0x42')]=_0x4ad334[_0x9518('0x42')][_0x9518('0x62')]?_0x4ad334[_0x9518('0x42')]:_0x44dd6a['model'];if(!_0x26e051[_0x9518('0x3d')][_0x9518('0x63')]('nolimit')){_0x4ad334[_0x9518('0x44')]=qs[_0x9518('0x44')](_0x26e051[_0x9518('0x3d')][_0x9518('0x44')]);_0x4ad334['offset']=qs[_0x9518('0x28')](_0x26e051[_0x9518('0x3d')]['offset']);}_0x4ad334[_0x9518('0x6a')]=qs['sort'](_0x26e051[_0x9518('0x3d')][_0x9518('0x45')]);_0x4ad334['where']=qs[_0x9518('0x3f')](_[_0x9518('0x47')](_0x26e051[_0x9518('0x3d')],_0x44dd6a[_0x9518('0x3f')]));_0x4ad334['where'][_0x9518('0x5f')]=_0x804d1b['id'];if(_0x26e051['query'][_0x9518('0x48')]){_0x4ad334[_0x9518('0x46')]=_[_0x9518('0x49')](_0x4ad334[_0x9518('0x46')],{'$or':_[_0x9518('0x38')](_0x4ad334[_0x9518('0x42')],function(_0x2b7cdd){var _0x49e1bd={};_0x49e1bd[_0x2b7cdd]={'$like':'%'+_0x26e051[_0x9518('0x3d')]['filter']+'%'};return _0x49e1bd;})});}_0x4ad334=_['merge']({},_0x4ad334,_0x26e051[_0x9518('0x51')]);return db['CannedAnswer'][_0x9518('0x2a')]({'where':_0x4ad334[_0x9518('0x46')]})[_0x9518('0x1e')](function(_0x188253){_0x45fac1[_0x9518('0x2a')]=_0x188253;if(_0x26e051[_0x9518('0x3d')]['includeAll']){_0x4ad334['include']=[{'all':!![]}];}return db[_0x9518('0x68')][_0x9518('0x65')](_0x4ad334);})['then'](function(_0xee6218){_0x45fac1[_0x9518('0x4d')]=_0xee6218;return _0x45fac1;});}})[_0x9518('0x1e')](respondWithFilteredResult(_0x5719a4,_0x4ad334))[_0x9518('0x4e')](handleError(_0x5719a4,null));};exports[_0x9518('0x6b')]=function(_0x192c69,_0x616c8f,_0x58461e){return db['SmsAccount'][_0x9518('0x56')]({'where':{'id':_0x192c69[_0x9518('0x5c')]['id']}})[_0x9518('0x1e')](handleEntityNotFound(_0x616c8f,null))['then'](function(_0x40aa2b){if(_0x40aa2b){return _0x40aa2b['removeAnswers'](_0x192c69['query'][_0x9518('0x6c')]);}})[_0x9518('0x1e')](respondWithStatusCode(_0x616c8f,null))[_0x9518('0x4e')](handleError(_0x616c8f,null));};exports[_0x9518('0x6d')]=function(_0x384d3e,_0x3dc6e4,_0x41f9c8){var _0xa115e4={'channel':_0x9518('0x6e')};var _0x25bc46=[];var _0x2c39e7=[];var _0x167c3a={};return db['SmsAccount'][_0x9518('0x56')]({'where':{'id':_0x384d3e[_0x9518('0x5c')]['id']},'include':[{'model':db['SmsApplication'],'as':_0x9518('0x6f')}]})[_0x9518('0x1e')](handleEntityNotFound(_0x3dc6e4,null))[_0x9518('0x1e')](function(_0x1b1641){_0xa115e4[_0x9518('0x70')]=_0x1b1641;_0xa115e4[_0x9518('0x71')]=_[_0x9518('0x72')](_0x1b1641[_0x9518('0x6f')],[_0x9518('0x73')],['asc']);if(_0xa115e4[_0x9518('0x70')][_0x9518('0x6f')]){delete _0xa115e4[_0x9518('0x70')][_0x9518('0x6f')];}return db[_0x9518('0x74')][_0x9518('0x5d')]();})[_0x9518('0x1e')](function(_0x438500){if(!_0x438500){throw new db[(_0x9518('0x75'))][(_0x9518('0x76'))]('no\x20available\x20attributes');}_0x25bc46=_[_0x9518('0x77')](_[_0x9518('0x3e')](_0x438500),['createdAt',_0x9518('0x78')]);_0x2c39e7=_[_0x9518('0x77')](_[_0x9518('0x3e')](_0x438500),[_0x9518('0x79'),_0x9518('0x78'),'CompanyId',_0x9518('0x7a')]);_0xa115e4[_0x9518('0x5b')]={'mapKey':_0x9518('0x7b')};if(_0xa115e4[_0x9518('0x70')]['type']){switch(_0xa115e4[_0x9518('0x70')]['type']){case _0x9518('0x7c'):_0xa115e4[_0x9518('0x5b')][_0x9518('0x7d')]=_0x384d3e[_0x9518('0x5b')][_0x9518('0x7e')];_0xa115e4[_0x9518('0x5b')][_0x9518('0x5b')]=_0x384d3e[_0x9518('0x5b')][_0x9518('0x7f')];_0xa115e4['body']['messageId']=_0x384d3e[_0x9518('0x5b')]['MessageSid'];break;case _0x9518('0x80'):_0xa115e4['body'][_0x9518('0x7d')]='+'+_0x384d3e[_0x9518('0x5b')][_0x9518('0x81')];_0xa115e4[_0x9518('0x5b')]['body']=_0x384d3e[_0x9518('0x5b')]['text'];break;case'connectel':_0xa115e4[_0x9518('0x5b')][_0x9518('0x7d')]=_0x384d3e[_0x9518('0x5b')]['from'];_0xa115e4[_0x9518('0x5b')][_0x9518('0x5b')]=_0x384d3e[_0x9518('0x5b')][_0x9518('0x24')];break;case _0x9518('0x82'):_0xa115e4[_0x9518('0x5b')][_0x9518('0x7d')]=_0x384d3e[_0x9518('0x5b')][_0x9518('0x7d')];_0xa115e4['body']['body']=_0x384d3e[_0x9518('0x5b')][_0x9518('0x5b')];_0xa115e4[_0x9518('0x5b')][_0x9518('0x83')]=_0x384d3e[_0x9518('0x5b')][_0x9518('0x84')];break;case _0x9518('0x85'):_0xa115e4[_0x9518('0x5b')][_0x9518('0x7d')]=_0x384d3e[_0x9518('0x5b')][_0x9518('0x7e')];_0xa115e4[_0x9518('0x5b')][_0x9518('0x5b')]=_0x384d3e[_0x9518('0x5b')]['Text'];_0xa115e4['body']['messageId']=_0x384d3e[_0x9518('0x5b')][_0x9518('0x86')];break;case _0x9518('0x87'):_0xa115e4[_0x9518('0x5b')][_0x9518('0x7d')]='+'+_0x384d3e[_0x9518('0x5b')][_0x9518('0x88')][0x0][_0x9518('0x7d')];_0xa115e4[_0x9518('0x5b')][_0x9518('0x5b')]=_0x384d3e[_0x9518('0x5b')][_0x9518('0x88')][0x0][_0x9518('0x89')];_0xa115e4[_0x9518('0x5b')][_0x9518('0x83')]=_0x384d3e[_0x9518('0x5b')]['results'][0x0]['messageId'];break;case'csc':_0xa115e4[_0x9518('0x5b')][_0x9518('0x7d')]=_0x384d3e[_0x9518('0x5b')][_0x9518('0x8a')];_0xa115e4['body'][_0x9518('0x5b')]=_0x384d3e[_0x9518('0x5b')]['segmentedMessage']['message'];break;case'clickatell':_0xa115e4[_0x9518('0x5b')][_0x9518('0x7d')]=_0x384d3e['body'][_0x9518('0x8b')];_0xa115e4[_0x9518('0x5b')][_0x9518('0x5b')]=_0x384d3e[_0x9518('0x5b')][_0x9518('0x89')];_0xa115e4['body']['messageId']=_0x384d3e[_0x9518('0x5b')][_0x9518('0x8c')];break;case _0x9518('0x8d'):_0xa115e4[_0x9518('0x5b')]['messageId']=_0x384d3e[_0x9518('0x5b')][0x0]['message']['id'];_0xa115e4[_0x9518('0x5b')][_0x9518('0x7d')]=_0x384d3e[_0x9518('0x5b')][0x0][_0x9518('0x24')][_0x9518('0x7d')];_0xa115e4[_0x9518('0x5b')][_0x9518('0x5b')]=_0x384d3e[_0x9518('0x5b')][0x0][_0x9518('0x24')][_0x9518('0x89')];break;case _0x9518('0x8e'):_0xa115e4[_0x9518('0x5b')][_0x9518('0x7d')]=_0x384d3e[_0x9518('0x5b')][_0x9518('0x7d')];_0xa115e4[_0x9518('0x5b')][_0x9518('0x5b')]=_0x384d3e[_0x9518('0x5b')][_0x9518('0x24')];_0xa115e4[_0x9518('0x5b')]['messageId']=_0x384d3e['body'][_0x9518('0x8f')];break;}}if(_0xa115e4[_0x9518('0x5b')]['id']){delete _0xa115e4[_0x9518('0x5b')]['id'];}if(_[_0x9518('0x90')](_0xa115e4[_0x9518('0x5b')][_0x9518('0x7d')])){throw new db[(_0x9518('0x75'))][(_0x9518('0x76'))](_0x9518('0x91'));}if(_[_0x9518('0x90')](_0xa115e4['body'][_0x9518('0x5b')])||_0xa115e4[_0x9518('0x5b')][_0x9518('0x5b')]===''){throw new db[(_0x9518('0x75'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0xa115e4[_0x9518('0x5b')][_0x9518('0x92')])){throw new db[(_0x9518('0x75'))][(_0x9518('0x76'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2c39e7);}if(!_[_0x9518('0x93')](_0x2c39e7,_0xa115e4['body'][_0x9518('0x92')])){throw new db[(_0x9518('0x75'))]['ValidationError'](_0x9518('0x94')+_0x2c39e7);}_0x167c3a[_0xa115e4[_0x9518('0x5b')][_0x9518('0x92')]]=_0xa115e4['body']['from'];return db['CmList']['find']({'where':{'id':_0xa115e4[_0x9518('0x70')]['ListId']},'include':[{'model':db[_0x9518('0x74')],'as':_0x9518('0x95'),'where':_0x167c3a,'limit':0x1,'order':[[_0x9518('0x78'),_0x9518('0x96')]]}]});})[_0x9518('0x1e')](handleEntityNotFound(_0x3dc6e4,null))[_0x9518('0x1e')](function(_0xbcff3c){if(_0xbcff3c){_0xa115e4[_0x9518('0x97')]=_[_0x9518('0x98')](_0xbcff3c,[_0x9518('0x95')]);if(_0xbcff3c[_0x9518('0x95')][_0x9518('0x62')]){return _0xbcff3c['Contacts'][0x0];}var _0xe6e880=_[_0x9518('0x16')](_0xa115e4[_0x9518('0x5b')],{'firstName':_0xa115e4[_0x9518('0x5b')][_0x9518('0x7d')],'ListId':_0xbcff3c['id']});_0xe6e880[_0xa115e4['body'][_0x9518('0x92')]]=_0xa115e4[_0x9518('0x5b')][_0x9518('0x7d')];return db[_0x9518('0x74')][_0x9518('0x52')](_0xe6e880,{'fields':_0x25bc46,'raw':!![]});}})['then'](handleEntityNotFound(_0x3dc6e4,null))[_0x9518('0x1e')](function(_0x4b6b8d){if(_0x4b6b8d){_0xa115e4[_0x9518('0x99')]=_0x4b6b8d;var _0x37fbec={'ContactId':_0x4b6b8d['id'],'phone':_0xa115e4[_0x9518('0x5b')][_0x9518('0x7d')],'SmsAccountId':_0x384d3e[_0x9518('0x5c')]['id']};var _0x5cc390={'ContactId':_0x4b6b8d['id'],'SmsAccountId':_0x384d3e['params']['id'],'closed':![]};return db[_0x9518('0x9a')][_0x9518('0x56')]({'where':_0x5cc390})[_0x9518('0x1e')](function(_0x27266a){if(_0x27266a){return[_0x27266a,![]];}return db[_0x9518('0x9a')]['create'](_0x37fbec)[_0x9518('0x1e')](function(_0x5d79d7){return[_0x5d79d7,!![]];});});}})['spread'](function(_0x3e0bd2,_0x1b6072){_0xa115e4[_0x9518('0x9b')]=_0x3e0bd2[_0x9518('0x30')]({'plain':!![]});_0xa115e4[_0x9518('0x9b')][_0x9518('0x9c')]=![];if(_0x1b6072){if(_0xa115e4[_0x9518('0x70')][_0x9518('0x9d')]){_0xa115e4[_0x9518('0x71')][_0x9518('0x9e')]({'id':0x0,'priority':_0xa115e4[_0x9518('0x71')][_0x9518('0x62')]+0x1,'app':_0x9518('0x9f'),'appdata':_0x9518('0xa0'),'interval':_0x9518('0xa1')});}_0xa115e4[_0x9518('0x9b')]['created']=!![];}return db[_0x9518('0xa2')][_0x9518('0x52')]({'phone':_0xa115e4[_0x9518('0x5b')]['from'],'messageId':_0xa115e4['body'][_0x9518('0x83')],'body':_0xa115e4[_0x9518('0x5b')][_0x9518('0x5b')],'SmsAccountId':_0x384d3e[_0x9518('0x5c')]['id'],'SmsInteractionId':_0x3e0bd2['id'],'direction':'in','ContactId':_0x3e0bd2[_0x9518('0xa3')],'AttachmentId':_0xa115e4[_0x9518('0x5b')][_0x9518('0xa4')]});})[_0x9518('0x1e')](function(_0x4a2790){_0xa115e4[_0x9518('0x24')]=_0x4a2790;if(!_0xa115e4[_0x9518('0x9b')][_0x9518('0xa5')])return;return db[_0x9518('0xa6')]['find']({'attributes':['id','name'],'where':{'id':_0xa115e4[_0x9518('0x9b')][_0x9518('0xa5')]}});})[_0x9518('0x1e')](function(_0x11c5e4){if(_0x11c5e4){_0xa115e4['applications'][_0x9518('0xa7')]({'id':0x0,'priority':0x0,'app':_0x9518('0xa8'),'appdata':_0x11c5e4['name']+','+(_0xa115e4['account'][_0x9518('0xa9')]||0xa),'interval':_0x9518('0xa1')});}if(!_0xa115e4[_0x9518('0x9b')][_0x9518('0xaa')])return;return db[_0x9518('0xab')]['find']({'attributes':['id',_0x9518('0x3c')],'where':{'id':_0xa115e4[_0x9518('0x9b')][_0x9518('0xaa')]}});})[_0x9518('0x1e')](function(_0x24f768){if(_0x24f768){_0xa115e4['applications'][_0x9518('0xa7')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x24f768[_0x9518('0x3c')]+','+(_0xa115e4[_0x9518('0x70')][_0x9518('0xac')]||0x12c),'interval':_0x9518('0xa1')});}return respondWithRpcPromise(_0x9518('0xad'),'startRouting',_0xa115e4);})[_0x9518('0x1e')](function(_0x3456f1){if(_0x3456f1){var _0x290310=0xc8;var _0x10aa3e=_0x9518('0xae');logger[_0x9518('0xaf')](_0x9518('0xb0'),_0x10aa3e,_0x290310,_0x9518('0xb1'));logger[_0x9518('0xb2')](_0x9518('0xb3'),_0x10aa3e,_0x290310,_0x9518('0xb1'),JSON[_0x9518('0x20')](_0x3456f1));if(_0xa115e4['account'][_0x9518('0x3a')]==='twilio'){return _0x3dc6e4['status'](_0x290310)[_0x9518('0x2b')](_0x9518('0xb4'),_0x9518('0xb5'))[_0x9518('0x34')](_0x9518('0xb6'));}else{return _0x3dc6e4[_0x9518('0x25')](_0x290310)[_0x9518('0x27')](_0x3456f1);}}})[_0x9518('0x4e')](handleError(_0x3dc6e4,null));};exports[_0x9518('0xb7')]=function(_0x4b21bf,_0x275f7a){var _0x5a4c79=_0x4b21bf[_0x9518('0x5c')]['id'];var _0x5df970=_0x4b21bf[_0x9518('0x5b')];var _0x2f284f=0xc8;var _0x1cc2f2=null;return db['sequelize'][_0x9518('0xb8')]({'isolationLevel':db['sequelize']['Transaction'][_0x9518('0xb9')][_0x9518('0xba')]},function(_0x18b981){return db[_0x9518('0x4c')][_0x9518('0x69')]({'where':{'id':_0x5a4c79},'transaction':_0x18b981})[_0x9518('0x1e')](function(_0x40da27){if(_0x40da27){return db[_0x9518('0xbb')]['destroy']({'where':{'SmsAccountId':_0x5a4c79},'transaction':_0x18b981})[_0x9518('0x1e')](function(){var _0x560e0a=_['map'](_0x5df970,function(_0x54bca8){_0x54bca8[_0x9518('0x5f')]=_0x5a4c79;return _0x54bca8;});return db['SmsApplication'][_0x9518('0xbc')](_0x560e0a,{'transaction':_0x18b981});});}else{_0x2f284f=0x194;_0x1cc2f2=[];}});})[_0x9518('0x1e')](function(){if(_0x2f284f!==0x194){return db[_0x9518('0xbb')][_0x9518('0xbd')]({'where':{'SmsAccountId':_0x5a4c79},'order':_0x9518('0x73')})[_0x9518('0x1e')](function(_0x4b2a3a){_0x1cc2f2=_0x4b2a3a;});}})['catch'](function(_0x18a122){_0x2f284f=0x1f4;logger['error'](_0x18a122['stack']);if(_0x18a122[_0x9518('0x3c')]){delete _0x18a122[_0x9518('0x3c')];}_0x1cc2f2=_0x18a122;})[_0x9518('0xbe')](function(){if(_0x1cc2f2===null){_0x275f7a[_0x9518('0x33')](_0x2f284f);}else{if(_0x2f284f===0x1f4){_0x275f7a['status'](_0x2f284f)[_0x9518('0x34')](_0x1cc2f2);}else{_0x275f7a['status'](_0x2f284f)['json'](_0x1cc2f2);}}});};exports['getApplications']=function(_0x3df9b5,_0x4fbecb,_0xd60652){var _0x22c924={};var _0xdf4c52={};var _0x2e01f6;var _0x1faa5d;return db[_0x9518('0x4c')]['findOne']({'where':{'id':_0x3df9b5[_0x9518('0x5c')]['id']}})[_0x9518('0x1e')](handleEntityNotFound(_0x4fbecb,null))[_0x9518('0x1e')](function(_0x27be1d){if(_0x27be1d){_0x2e01f6=_0x27be1d;_0xdf4c52['model']=_['keys'](db['SmsApplication'][_0x9518('0x50')]);_0xdf4c52[_0x9518('0x3d')]=_[_0x9518('0x3e')](_0x3df9b5[_0x9518('0x3d')]);_0xdf4c52['filters']=_[_0x9518('0x40')](_0xdf4c52['model'],_0xdf4c52[_0x9518('0x3d')]);_0x22c924['attributes']=_[_0x9518('0x40')](_0xdf4c52[_0x9518('0x41')],qs[_0x9518('0x43')](_0x3df9b5[_0x9518('0x3d')][_0x9518('0x43')]));_0x22c924[_0x9518('0x42')]=_0x22c924[_0x9518('0x42')]['length']?_0x22c924[_0x9518('0x42')]:_0xdf4c52[_0x9518('0x41')];_0x22c924['order']=qs[_0x9518('0x45')](_0x3df9b5['query'][_0x9518('0x45')]);_0x22c924['where']=qs['filters'](_[_0x9518('0x47')](_0x3df9b5[_0x9518('0x3d')],_0xdf4c52[_0x9518('0x3f')]));if(_0x3df9b5[_0x9518('0x3d')]['filter']){_0x22c924[_0x9518('0x46')]=_[_0x9518('0x49')](_0x22c924['where'],{'$or':_[_0x9518('0x38')](_0x22c924[_0x9518('0x42')],function(_0x54599d){var _0x514e93={};_0x514e93[_0x54599d]={'$like':'%'+_0x3df9b5[_0x9518('0x3d')]['filter']+'%'};return _0x514e93;})});}_0x22c924=_[_0x9518('0x49')]({},_0x22c924,_0x3df9b5['options']);return _0x2e01f6[_0x9518('0xbf')](_0x22c924);}})[_0x9518('0x1e')](function(_0x33ac30){if(_0x33ac30){_0x1faa5d=_0x33ac30[_0x9518('0x62')];if(!_0x3df9b5[_0x9518('0x3d')][_0x9518('0x63')](_0x9518('0x64'))){_0x22c924[_0x9518('0x44')]=qs[_0x9518('0x44')](_0x3df9b5[_0x9518('0x3d')]['limit']);_0x22c924[_0x9518('0x28')]=qs['offset'](_0x3df9b5[_0x9518('0x3d')]['offset']);}return _0x2e01f6[_0x9518('0xbf')](_0x22c924);}})[_0x9518('0x1e')](function(_0x9d0049){if(_0x9d0049){return _0x9d0049?{'count':_0x1faa5d,'rows':_0x9d0049}:null;}})[_0x9518('0x1e')](respondWithResult(_0x4fbecb,null))[_0x9518('0x4e')](handleError(_0x4fbecb,null));};exports['getInteractions']=function(_0xbbd178,_0x27db44,_0x392f27){var _0x46159d={'raw':![],'where':{}};var _0x42408c={};var _0x2aae37={'count':0x0,'rows':[]};return db['SmsAccount'][_0x9518('0x69')]({'where':{'id':_0xbbd178[_0x9518('0x5c')]['id']}})[_0x9518('0x1e')](handleEntityNotFound(_0x27db44,null))[_0x9518('0x1e')](function(_0x548c10){if(_0x548c10){_0x42408c['model']=_[_0x9518('0x3e')](db[_0x9518('0x9a')][_0x9518('0x50')]);_0x42408c['query']=_['keys'](_0xbbd178[_0x9518('0x3d')]);_0x42408c[_0x9518('0x3f')]=_[_0x9518('0x40')](_0x42408c[_0x9518('0x41')],_0x42408c[_0x9518('0x3d')]);_0x46159d[_0x9518('0x42')]=_[_0x9518('0x40')](_0x42408c['model'],qs['fields'](_0xbbd178[_0x9518('0x3d')][_0x9518('0x43')]));_0x46159d['attributes']=_0x46159d[_0x9518('0x42')][_0x9518('0x62')]?_0x46159d[_0x9518('0x42')]:_0x42408c[_0x9518('0x41')];if(!_0xbbd178[_0x9518('0x3d')][_0x9518('0x63')]('nolimit')){_0x46159d[_0x9518('0x44')]=qs[_0x9518('0x44')](_0xbbd178['query'][_0x9518('0x44')]);_0x46159d[_0x9518('0x28')]=qs[_0x9518('0x28')](_0xbbd178['query'][_0x9518('0x28')]);}_0x46159d[_0x9518('0x6a')]=qs[_0x9518('0x45')](_0xbbd178['query'][_0x9518('0x45')]);_0x46159d['where']=qs[_0x9518('0x3f')](_[_0x9518('0x47')](_0xbbd178[_0x9518('0x3d')],_0x42408c['filters']));_0x46159d['where'][_0x9518('0x5f')]=_0x548c10['id'];if(_0xbbd178[_0x9518('0x3d')][_0x9518('0x48')]){_0x46159d[_0x9518('0x46')]=_['merge'](_0x46159d['where'],{'$or':_['map'](_0x46159d[_0x9518('0x42')],function(_0x5b6f4d){var _0x392073={};_0x392073[_0x5b6f4d]={'$like':'%'+_0xbbd178[_0x9518('0x3d')]['filter']+'%'};return _0x392073;})});}_0x46159d=_[_0x9518('0x49')]({},_0x46159d,_0xbbd178[_0x9518('0x51')]);return db[_0x9518('0x9a')]['count']({'where':_0x46159d[_0x9518('0x46')]})[_0x9518('0x1e')](function(_0x359ee2){_0x2aae37[_0x9518('0x2a')]=_0x359ee2;if(_0xbbd178[_0x9518('0x3d')][_0x9518('0x4a')]){_0x46159d[_0x9518('0x4b')]=[{'model':db[_0x9518('0x74')],'as':_0x9518('0xc0'),'required':![]},{'model':db[_0x9518('0xa6')],'as':_0x9518('0xc1'),'attributes':[_0x9518('0x3c'),'fullname',_0x9518('0xc2')],'required':![]},{'model':db[_0x9518('0xc3')],'as':'Tags','attributes':['id','name',_0x9518('0xc4')],'where':_0xbbd178[_0x9518('0x3d')][_0x9518('0xc5')]?{'id':_0xbbd178[_0x9518('0x3d')][_0x9518('0xc5')]}:undefined,'required':_0xbbd178['query'][_0x9518('0xc5')]?!![]:![]}];}return db[_0x9518('0x9a')][_0x9518('0x65')](_0x46159d);})[_0x9518('0x1e')](function(_0x57a8cb){_0x2aae37[_0x9518('0x4d')]=_0x57a8cb;return _0x2aae37;});}})[_0x9518('0x1e')](respondWithFilteredResult(_0x27db44,_0x46159d))[_0x9518('0x4e')](handleError(_0x27db44,null));};exports[_0x9518('0x34')]=function(_0x2304c8,_0x585cab,_0x47da31){var _0x5d72fa,_0x17c412,_0x162102;if(_[_0x9518('0x90')](_0x2304c8[_0x9518('0x5b')][_0x9518('0x5b')])||_0x2304c8[_0x9518('0x5b')]['body']===''){throw new db['Sequelize']['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x9518('0x90')](_0x2304c8[_0x9518('0x5b')]['to'])){throw new db[(_0x9518('0x75'))][(_0x9518('0x76'))](_0x9518('0xc6'));}_0x5d72fa=_0x2304c8['body']['to'];return db[_0x9518('0x4c')]['find']({'where':{'id':_0x2304c8[_0x9518('0x5c')]['id']},'include':[{'model':db[_0x9518('0xc7')],'as':_0x9518('0xc8'),'include':[{'model':db[_0x9518('0x74')],'as':_0x9518('0x95'),'where':{'mobile':_0x5d72fa},'limit':0x1,'order':[['updatedAt',_0x9518('0x96')]]}]}]})[_0x9518('0x1e')](handleEntityNotFound(_0x585cab,null))['then'](function(_0x2757f1){if(_0x2757f1&&_0x2757f1[_0x9518('0xc8')]){_0x17c412=_0x2757f1[_0x9518('0x30')]({'plain':!![]});if(_0x17c412[_0x9518('0xc8')]&&_0x17c412[_0x9518('0xc8')][_0x9518('0x95')][_0x9518('0x62')]){return _0x17c412[_0x9518('0xc8')]['Contacts'][0x0];}return db[_0x9518('0x74')][_0x9518('0x52')](_[_0x9518('0x16')](_0x2304c8[_0x9518('0x5b')],{'firstName':_0x5d72fa,'mobile':_0x5d72fa,'phone':_0x5d72fa,'ListId':_0x17c412[_0x9518('0x7a')]}));}})[_0x9518('0x1e')](handleEntityNotFound(_0x585cab,null))['then'](function(_0x2c8e64){if(_0x2c8e64){_0x162102=_0x2c8e64;return db[_0x9518('0x9a')][_0x9518('0x56')]({'where':{'ContactId':_0x162102['id'],'closed':![],'SmsAccountId':_0x17c412['id']}})['then'](function(_0x20811d){if(_0x20811d){return[_0x20811d,![]];}return db[_0x9518('0x9a')][_0x9518('0x52')]({'UserId':_0x2304c8['user']['id'],'ContactId':_0x162102['id'],'SmsAccountId':_0x17c412['id'],'phone':_0x5d72fa,'firstMsgDirection':_0x9518('0xc9'),'Messages':[_[_0x9518('0x49')](_0x2304c8[_0x9518('0x5b')],{'read':![],'body':_0x2304c8[_0x9518('0x5b')][_0x9518('0x5b')],'phone':_0x5d72fa,'SmsAccountId':_0x17c412['id'],'UserId':_0x2304c8[_0x9518('0x53')]['id'],'ContactId':_0x162102['id']})]},{'include':[{'model':db[_0x9518('0xa2')],'as':'Messages'}]})['then'](function(_0x54a769){return[_0x54a769,!![]];});});}})[_0x9518('0xca')](function(_0x4a187b,_0x129b1d){if(_0x129b1d){return _0x4a187b;}return db[_0x9518('0xa2')][_0x9518('0x52')](_[_0x9518('0x49')](_0x2304c8[_0x9518('0x5b')],{'read':![],'body':_0x2304c8['body'][_0x9518('0x5b')],'phone':_0x5d72fa,'SmsAccountId':_0x17c412['id'],'SmsInteractionId':_0x4a187b['id'],'UserId':_0x2304c8[_0x9518('0x53')]['id'],'ContactId':_0x162102['id']}))[_0x9518('0x1e')](function(_0x507fbc){_0x4a187b[_0x9518('0xcb')][_0x9518('0xcc')]=[];_0x4a187b[_0x9518('0xcb')][_0x9518('0xcc')][_0x9518('0x9e')](_0x507fbc['dataValues']);return _0x4a187b;});})['then'](respondWithResult(_0x585cab,null))['catch'](handleError(_0x585cab,null));};exports[_0x9518('0x25')]=function(_0x42a53d,_0x3e6b4b,_0x24dc8c){if(_0x42a53d[_0x9518('0x5b')]['id']){delete _0x42a53d[_0x9518('0x5b')]['id'];}var _0x182a01,_0x23b7de,_0x49c6c0;return db[_0x9518('0x4c')][_0x9518('0x56')]({'where':{'id':_0x42a53d[_0x9518('0x5c')]['id']}})['then'](handleEntityNotFound(_0x3e6b4b,null))[_0x9518('0x1e')](function(_0x354336){if(_0x354336){_0x49c6c0=_0x354336;logger[_0x9518('0xb2')](_0x9518('0xb0'),_0x9518('0x25'),_0x9518('0xcd'),_0x354336[_0x9518('0x3a')],util[_0x9518('0xce')](_0x42a53d['body'],{'showHidden':![],'depth':null}));switch(_0x354336['type']){case _0x9518('0x80'):if(_0x42a53d['body'][_0x9518('0xcf')]&&_0x42a53d[_0x9518('0x5b')][_0x9518('0x25')]){_0x23b7de=_0x42a53d[_0x9518('0x5b')][_0x9518('0x25')];return db[_0x9518('0xa2')][_0x9518('0x56')]({'where':{'messageId':_0x42a53d[_0x9518('0x5b')][_0x9518('0xcf')]}});}break;case _0x9518('0xd0'):if(_0x42a53d[_0x9518('0x5b')][_0x9518('0xd1')]&&_0x42a53d[_0x9518('0x5b')][_0x9518('0xd2')]){_0x23b7de=_0x42a53d[_0x9518('0x5b')][_0x9518('0xd2')];return db[_0x9518('0xa2')]['find']({'where':{'messageId':_0x42a53d[_0x9518('0x5b')][_0x9518('0xd1')]}});}break;case'clicksend':if(_0x42a53d[_0x9518('0x5b')]['message_id']&&_0x42a53d[_0x9518('0x5b')][_0x9518('0xd3')]){_0x23b7de=_0x42a53d[_0x9518('0x5b')][_0x9518('0xd3')];return db[_0x9518('0xa2')][_0x9518('0x56')]({'where':{'messageId':_0x42a53d[_0x9518('0x5b')]['message_id']}});}break;case _0x9518('0x87'):var _0x1a796d=_0x42a53d[_0x9518('0x5b')][_0x9518('0x88')][0x0];if(_0x1a796d['messageId']&&_0x1a796d[_0x9518('0x25')]['groupName']===_0x9518('0xd4')){_0x23b7de=_0x1a796d[_0x9518('0x25')]['groupName'];return db[_0x9518('0xa2')]['find']({'where':{'messageId':_0x1a796d[_0x9518('0x83')]}});}break;case _0x9518('0xd5'):if(_0x42a53d['body']['messageId']&&_0x42a53d[_0x9518('0x5b')][_0x9518('0x25')]){_0x23b7de=_0x42a53d[_0x9518('0x5b')][_0x9518('0x25')];return db[_0x9518('0xa2')][_0x9518('0x56')]({'where':{'messageId':_0x42a53d[_0x9518('0x5b')]['messageId']}});}break;case _0x9518('0x8d'):if(_0x42a53d[_0x9518('0x5b')][0x0]['message']['id']){_0x23b7de=_0x42a53d[_0x9518('0x5b')][0x0][_0x9518('0x3a')];return db[_0x9518('0xa2')][_0x9518('0x56')]({'where':{'messageId':_0x42a53d[_0x9518('0x5b')][0x0][_0x9518('0x24')]['id']}});}break;case _0x9518('0x8e'):if(_0x42a53d['body']['redif']&&_0x42a53d[_0x9518('0x5b')][_0x9518('0x25')]){_0x23b7de=_0x42a53d[_0x9518('0x5b')][_0x9518('0x25')];return db[_0x9518('0xa2')][_0x9518('0x56')]({'where':{'messageId':_0x42a53d[_0x9518('0x5b')][_0x9518('0xd6')]}});}break;}}})['then'](handleEntityNotFound(_0x3e6b4b,null))['then'](function(_0x3c7fd3){if(_0x3c7fd3){_0x182a01=_0x3c7fd3;switch(_0x49c6c0[_0x9518('0x3a')]){case _0x9518('0x80'):if(_0x23b7de==='DELIVERED'){return _0x182a01[_0x9518('0x5a')]({'read':!![]});}else{logger[_0x9518('0x21')](_0x9518('0xb0'),'status',_0x9518('0x80'),util[_0x9518('0xce')](_0x42a53d[_0x9518('0x5b')],{'showHidden':![],'depth':null}));}break;case _0x9518('0xd0'):if(_0x23b7de==='1'){return _0x182a01[_0x9518('0x5a')]({'read':!![]});}else{logger[_0x9518('0x21')](_0x9518('0xb0'),'status','skebby',util[_0x9518('0xce')](_0x42a53d['body'],{'showHidden':![],'depth':null}));}break;case _0x9518('0x82'):if(!_0x42a53d[_0x9518('0x5b')][_0x9518('0xd7')]&&_0x23b7de>=0xc8&&_0x23b7de<=0xce){return _0x182a01['update']({'read':!![]});}else{logger[_0x9518('0x21')](_0x9518('0xb0'),_0x9518('0x25'),_0x9518('0x82'),util['inspect'](_0x42a53d['body'],{'showHidden':![],'depth':null}));}break;case _0x9518('0x87'):var _0x3ac1c0=_0x42a53d[_0x9518('0x5b')][_0x9518('0x88')][0x0];if(_0x3ac1c0[_0x9518('0x25')][_0x9518('0xd8')]===_0x9518('0xd4')){return _0x182a01[_0x9518('0x5a')]({'read':!![]});}else{logger[_0x9518('0x21')](_0x9518('0xb0'),'status',_0x9518('0x87'),util[_0x9518('0xce')](_0x42a53d[_0x9518('0x5b')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x23b7de==_0x9518('0xd9')||_0x23b7de==_0x9518('0xda')){return _0x182a01[_0x9518('0x5a')]({'read':!![]});}else{logger['error'](_0x9518('0xb0'),_0x9518('0x25'),'clickatell',util[_0x9518('0xce')](_0x42a53d[_0x9518('0x5b')],{'showHidden':![],'depth':null}));}break;case _0x9518('0x8d'):if(_0x23b7de==_0x9518('0xdb')){return _0x182a01[_0x9518('0x5a')]({'read':!![]});}else{logger['error'](_0x9518('0xb0'),_0x9518('0x25'),_0x9518('0x8d'),util[_0x9518('0xce')](_0x42a53d['body'],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x23b7de===_0x9518('0xdc')||_0x23b7de===_0x9518('0xdd')){return _0x182a01[_0x9518('0x5a')]({'read':!![]});}else{logger[_0x9518('0x21')](_0x9518('0xb0'),'status',_0x9518('0x8e'),util[_0x9518('0xce')](_0x42a53d[_0x9518('0x5b')],{'showHidden':![],'depth':null}));}break;}return _0x182a01;}})['then'](respondWithResult(_0x3e6b4b,null))[_0x9518('0x4e')](handleError(_0x3e6b4b,null));};exports['statusGet']=function(_0x1f016b,_0x450dc2,_0x5671b2){var _0x509220,_0x2cd963,_0x52ae03;return db['SmsAccount'][_0x9518('0x56')]({'where':{'id':_0x1f016b[_0x9518('0x5c')]['id']}})[_0x9518('0x1e')](handleEntityNotFound(_0x450dc2,null))['then'](function(_0x33d3e9){if(_0x33d3e9){_0x52ae03=_0x33d3e9;logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x9518('0x25'),_0x9518('0xcd'),_0x33d3e9[_0x9518('0x3a')],util['inspect'](_0x1f016b[_0x9518('0x3d')],{'showHidden':![],'depth':null}));switch(_0x33d3e9[_0x9518('0x3a')]){case _0x9518('0xde'):if(_0x1f016b[_0x9518('0x3d')]['message-id']&&_0x1f016b['query'][_0x9518('0xdf')]){_0x2cd963=_0x1f016b[_0x9518('0x3d')]['state'];return db[_0x9518('0xa2')]['find']({'where':{'messageId':_0x1f016b[_0x9518('0x3d')][_0x9518('0xe0')]}});}break;}}})[_0x9518('0x1e')](handleEntityNotFound(_0x450dc2,null))[_0x9518('0x1e')](function(_0x147297){if(_0x147297){_0x509220=_0x147297;switch(_0x52ae03[_0x9518('0x3a')]){case _0x9518('0xde'):if(_0x2cd963==='2'||_0x2cd963==='6'){return _0x509220[_0x9518('0x5a')]({'read':!![]});}else{logger['error'](_0x9518('0xb0'),_0x9518('0x25'),'csc',util[_0x9518('0xce')](_0x1f016b[_0x9518('0x3d')],{'showHidden':![],'depth':null}));};break;}return _0x509220;}})['then'](respondWithResult(_0x450dc2,null))[_0x9518('0x4e')](handleError(_0x450dc2,null));};exports[_0x9518('0xe1')]=function(_0x4df042,_0x4ae4f7,_0x166485){return db['SmsAccount'][_0x9518('0x56')]({'where':{'id':_0x4df042[_0x9518('0x5c')]['id']}})[_0x9518('0x1e')](handleEntityNotFound(_0x4ae4f7,null))[_0x9518('0x1e')](function(_0x57e404){if(_0x57e404){return _0x57e404['addAgents'](_0x4df042[_0x9518('0x5b')][_0x9518('0x6c')],_[_0x9518('0x98')](_0x4df042['body'],['ids','id'])||{})[_0x9518('0xca')](function(_0x5ca2e3){for(var _0x3cb94b=0x0;_0x3cb94b<_0x4df042[_0x9518('0x5b')][_0x9518('0x6c')][_0x9518('0x62')];_0x3cb94b+=0x1){socket['emit'](_0x9518('0xe2'),{'UserId':Number(_0x4df042[_0x9518('0x5b')][_0x9518('0x6c')][_0x3cb94b]),'SmsAccountId':Number(_0x4df042[_0x9518('0x5c')]['id'])});}return _0x5ca2e3;});}})[_0x9518('0x1e')](respondWithResult(_0x4ae4f7,null))['catch'](handleError(_0x4ae4f7,null));};exports[_0x9518('0xe3')]=function(_0x581a05,_0x278fd0,_0xc88061){return db[_0x9518('0x4c')][_0x9518('0x56')]({'where':{'id':_0x581a05['params']['id']}})[_0x9518('0x1e')](handleEntityNotFound(_0x278fd0,null))[_0x9518('0x1e')](function(_0x476db1){if(_0x476db1){return _0x476db1[_0x9518('0xe3')](_0x581a05[_0x9518('0x3d')][_0x9518('0x6c')])['then'](function(){if(_[_0x9518('0xe4')](_0x581a05[_0x9518('0x3d')]['ids'])){for(var _0x4b8279=0x0;_0x4b8279<_0x581a05['query'][_0x9518('0x6c')][_0x9518('0x62')];_0x4b8279+=0x1){socket[_0x9518('0xe5')]('userSmsAccount:remove',{'UserId':Number(_0x581a05[_0x9518('0x3d')][_0x9518('0x6c')][_0x4b8279]),'SmsAccountId':Number(_0x581a05[_0x9518('0x5c')]['id'])});}}else{socket[_0x9518('0xe5')]('userSmsAccount:remove',{'UserId':Number(_0x581a05[_0x9518('0x3d')]['ids']),'SmsAccountId':Number(_0x581a05[_0x9518('0x5c')]['id'])});}});}})[_0x9518('0x1e')](respondWithStatusCode(_0x278fd0,null))['catch'](handleError(_0x278fd0,null));};exports['getAgents']=function(_0x2312a6,_0x4e38f9,_0x453622){var _0x4cbd68={};var _0x3dfda0={};var _0x65c423;var _0x17da1e;return db[_0x9518('0x4c')][_0x9518('0x69')]({'where':{'id':_0x2312a6[_0x9518('0x5c')]['id']}})[_0x9518('0x1e')](handleEntityNotFound(_0x4e38f9,null))[_0x9518('0x1e')](function(_0x1ba954){if(_0x1ba954){_0x65c423=_0x1ba954;_0x3dfda0[_0x9518('0x41')]=_[_0x9518('0x3e')](db[_0x9518('0xa6')][_0x9518('0x50')]);_0x3dfda0[_0x9518('0x3d')]=_[_0x9518('0x3e')](_0x2312a6[_0x9518('0x3d')]);_0x3dfda0['filters']=_[_0x9518('0x40')](_0x3dfda0[_0x9518('0x41')],_0x3dfda0[_0x9518('0x3d')]);_0x4cbd68[_0x9518('0x42')]=_[_0x9518('0x40')](_0x3dfda0[_0x9518('0x41')],qs['fields'](_0x2312a6[_0x9518('0x3d')][_0x9518('0x43')]));_0x4cbd68[_0x9518('0x42')]=_0x4cbd68[_0x9518('0x42')][_0x9518('0x62')]?_0x4cbd68[_0x9518('0x42')]:_0x3dfda0[_0x9518('0x41')];_0x4cbd68['order']=qs[_0x9518('0x45')](_0x2312a6[_0x9518('0x3d')]['sort']);_0x4cbd68['where']=qs[_0x9518('0x3f')](_[_0x9518('0x47')](_0x2312a6[_0x9518('0x3d')],_0x3dfda0[_0x9518('0x3f')]));if(_0x2312a6[_0x9518('0x3d')][_0x9518('0x48')]){_0x4cbd68[_0x9518('0x46')]=_[_0x9518('0x49')](_0x4cbd68['where'],{'$or':_['map'](_0x4cbd68[_0x9518('0x42')],function(_0x2eb8b4){var _0x42e71e={};_0x42e71e[_0x2eb8b4]={'$like':'%'+_0x2312a6[_0x9518('0x3d')][_0x9518('0x48')]+'%'};return _0x42e71e;})});}_0x4cbd68=_[_0x9518('0x49')]({},_0x4cbd68,_0x2312a6[_0x9518('0x51')]);return _0x65c423[_0x9518('0xe6')](_0x4cbd68);}})[_0x9518('0x1e')](function(_0x3ec6f5){if(_0x3ec6f5){_0x17da1e=_0x3ec6f5[_0x9518('0x62')];if(!_0x2312a6[_0x9518('0x3d')]['hasOwnProperty']('nolimit')){_0x4cbd68['limit']=qs['limit'](_0x2312a6['query'][_0x9518('0x44')]);_0x4cbd68['offset']=qs[_0x9518('0x28')](_0x2312a6['query'][_0x9518('0x28')]);}return _0x65c423[_0x9518('0xe6')](_0x4cbd68);}})[_0x9518('0x1e')](function(_0x3819ba){if(_0x3819ba){return _0x3819ba?{'count':_0x17da1e,'rows':_0x3819ba}:null;}})['then'](respondWithResult(_0x4e38f9,null))['catch'](handleError(_0x4e38f9,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index b97d18c..8dc55cc 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 _0xfbbb=['../../mysqldb','setMaxListeners','save','update','remove','emit','hook','exports','events'];(function(_0xcb4af1,_0x1284e4){var _0x582348=function(_0x2b3e12){while(--_0x2b3e12){_0xcb4af1['push'](_0xcb4af1['shift']());}};_0x582348(++_0x1284e4);}(_0xfbbb,0x1c1));var _0xbfbb=function(_0x12b8a3,_0x1e7210){_0x12b8a3=_0x12b8a3-0x0;var _0x21f317=_0xfbbb[_0x12b8a3];return _0x21f317;};'use strict';var EventEmitter=require(_0xbfbb('0x0'));var SmsAccount=require(_0xbfbb('0x1'))['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xbfbb('0x2')](0x0);var events={'afterCreate':_0xbfbb('0x3'),'afterUpdate':_0xbfbb('0x4'),'afterDestroy':_0xbfbb('0x5')};function emitEvent(_0x35c9b6){return function(_0x1a9d97,_0x1d1486,_0x31b6b4){SmsAccountEvents['emit'](_0x35c9b6+':'+_0x1a9d97['id'],_0x1a9d97);SmsAccountEvents[_0xbfbb('0x6')](_0x35c9b6,_0x1a9d97);_0x31b6b4(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount[_0xbfbb('0x7')](e,emitEvent(event));}}module[_0xbfbb('0x8')]=SmsAccountEvents; \ No newline at end of file +var _0xa5ba=['exports','events','save','update','emit','hasOwnProperty','hook'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xa5ba,0x151));var _0xaa5b=function(_0x364ec5,_0x4e9c03){_0x364ec5=_0x364ec5-0x0;var _0x40b68b=_0xa5ba[_0x364ec5];return _0x40b68b;};'use strict';var EventEmitter=require(_0xaa5b('0x0'));var SmsAccount=require('../../mysqldb')['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xaa5b('0x1'),'afterUpdate':_0xaa5b('0x2'),'afterDestroy':'remove'};function emitEvent(_0x498d34){return function(_0x2dfca6,_0x167fa7,_0x362822){SmsAccountEvents['emit'](_0x498d34+':'+_0x2dfca6['id'],_0x2dfca6);SmsAccountEvents[_0xaa5b('0x3')](_0x498d34,_0x2dfca6);_0x362822(null);};}for(var e in events){if(events[_0xaa5b('0x4')](e)){var event=events[e];SmsAccount[_0xaa5b('0x5')](e,emitEvent(event));}}module[_0xaa5b('0x6')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index de06f89..eee2dfa 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 _0xd40b=['sms_accounts','lodash','util','api','moment','bluebird','request-promise','path','rimraf','./smsAccount.attributes','exports','define'];(function(_0x315c6e,_0x51d5ad){var _0x2169f4=function(_0x31f998){while(--_0x31f998){_0x315c6e['push'](_0x315c6e['shift']());}};_0x2169f4(++_0x51d5ad);}(_0xd40b,0x85));var _0xbd40=function(_0x3b2acd,_0x3a4221){_0x3b2acd=_0x3b2acd-0x0;var _0x302b58=_0xd40b[_0x3b2acd];return _0x302b58;};'use strict';var _=require(_0xbd40('0x0'));var util=require(_0xbd40('0x1'));var logger=require('../../config/logger')(_0xbd40('0x2'));var moment=require(_0xbd40('0x3'));var BPromise=require(_0xbd40('0x4'));var rp=require(_0xbd40('0x5'));var fs=require('fs');var path=require(_0xbd40('0x6'));var rimraf=require(_0xbd40('0x7'));var config=require('../../config/environment');var attributes=require(_0xbd40('0x8'));module[_0xbd40('0x9')]=function(_0x56a48f,_0x23c498){return _0x56a48f[_0xbd40('0xa')]('SmsAccount',attributes,{'tableName':_0xbd40('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5c5f=['moment','bluebird','request-promise','path','./smsAccount.attributes','exports','define','SmsAccount','sms_accounts','util','../../config/logger'];(function(_0x452eb1,_0x23179b){var _0x50d368=function(_0xae6968){while(--_0xae6968){_0x452eb1['push'](_0x452eb1['shift']());}};_0x50d368(++_0x23179b);}(_0x5c5f,0xda));var _0xf5c5=function(_0x4213f8,_0x3572a4){_0x4213f8=_0x4213f8-0x0;var _0x2e690e=_0x5c5f[_0x4213f8];return _0x2e690e;};'use strict';var _=require('lodash');var util=require(_0xf5c5('0x0'));var logger=require(_0xf5c5('0x1'))('api');var moment=require(_0xf5c5('0x2'));var BPromise=require(_0xf5c5('0x3'));var rp=require(_0xf5c5('0x4'));var fs=require('fs');var path=require(_0xf5c5('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf5c5('0x6'));module[_0xf5c5('0x7')]=function(_0x2532bb,_0x820918){return _0x2532bb[_0xf5c5('0x8')](_0xf5c5('0x9'),attributes,{'tableName':_0xf5c5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index 0826fb7..1c5dcbd 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 _0xaf6a=['model','include','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsAccount,\x20%s,\x20%s','message','result','catch','ShowSmsAccount','SmsAccount','options','raw','where','attributes','map'];(function(_0xc13903,_0x2d2959){var _0x5a2604=function(_0x419d16){while(--_0x419d16){_0xc13903['push'](_0xc13903['shift']());}};_0x5a2604(++_0x2d2959);}(_0xaf6a,0x1af));var _0xaaf6=function(_0x4cc61d,_0x3fd027){_0x4cc61d=_0x4cc61d-0x0;var _0x916589=_0xaf6a[_0x4cc61d];return _0x916589;};'use strict';var _=require(_0xaaf6('0x0'));var util=require('util');var moment=require(_0xaaf6('0x1'));var BPromise=require(_0xaaf6('0x2'));var rs=require(_0xaaf6('0x3'));var fs=require('fs');var Redis=require(_0xaaf6('0x4'));var db=require(_0xaaf6('0x5'))['db'];var utils=require(_0xaaf6('0x6'));var logger=require(_0xaaf6('0x7'))(_0xaaf6('0x8'));var config=require(_0xaaf6('0x9'));var jayson=require(_0xaaf6('0xa'));var client=jayson[_0xaaf6('0xb')][_0xaaf6('0xc')]({'port':0x232a});config[_0xaaf6('0xd')]=_['defaults'](config[_0xaaf6('0xd')],{'host':_0xaaf6('0xe'),'port':0x18eb});var socket=require(_0xaaf6('0xf'))(new Redis(config[_0xaaf6('0xd')]));require('./smsAccount.socket')[_0xaaf6('0x10')](socket);function respondWithRpcPromise(_0x3b7dd9,_0x3144b5,_0x3c079e){return new BPromise(function(_0x5b4059,_0xecd92e){return client[_0xaaf6('0x11')](_0x3b7dd9,_0x3c079e)[_0xaaf6('0x12')](function(_0x32e7b9){logger[_0xaaf6('0x13')]('SmsAccount,\x20%s,\x20%s',_0x3144b5,_0xaaf6('0x14'));logger[_0xaaf6('0x15')](_0xaaf6('0x16'),_0x3144b5,_0xaaf6('0x14'),JSON[_0xaaf6('0x17')](_0x32e7b9));if(_0x32e7b9[_0xaaf6('0x18')]){if(_0x32e7b9[_0xaaf6('0x18')][_0xaaf6('0x19')]===0x1f4){logger[_0xaaf6('0x18')](_0xaaf6('0x1a'),_0x3144b5,_0x32e7b9[_0xaaf6('0x18')]['message']);return _0xecd92e(_0x32e7b9[_0xaaf6('0x18')][_0xaaf6('0x1b')]);}logger['error'](_0xaaf6('0x1a'),_0x3144b5,_0x32e7b9[_0xaaf6('0x18')][_0xaaf6('0x1b')]);return _0x5b4059(_0x32e7b9[_0xaaf6('0x18')][_0xaaf6('0x1b')]);}else{logger[_0xaaf6('0x13')]('SmsAccount,\x20%s,\x20%s',_0x3144b5,_0xaaf6('0x14'));_0x5b4059(_0x32e7b9[_0xaaf6('0x1c')][_0xaaf6('0x1b')]);}})[_0xaaf6('0x1d')](function(_0x154243){logger[_0xaaf6('0x18')]('SmsAccount,\x20%s,\x20%s',_0x3144b5,_0x154243);_0xecd92e(_0x154243);});});}exports[_0xaaf6('0x1e')]=function(_0x5e19a8){var _0x2ad83a=this;return new Promise(function(_0x3cfdc5,_0x2e3d4d){return db[_0xaaf6('0x1f')]['find']({'raw':_0x5e19a8[_0xaaf6('0x20')]?_0x5e19a8['options'][_0xaaf6('0x21')]===undefined?!![]:![]:!![],'where':_0x5e19a8[_0xaaf6('0x20')]?_0x5e19a8[_0xaaf6('0x20')][_0xaaf6('0x22')]||null:null,'attributes':_0x5e19a8[_0xaaf6('0x20')]?_0x5e19a8[_0xaaf6('0x20')][_0xaaf6('0x23')]||null:null,'include':_0x5e19a8['options']?_0x5e19a8['options']['include']?_[_0xaaf6('0x24')](_0x5e19a8[_0xaaf6('0x20')]['include'],function(_0x52e1e6){return{'model':db[_0x52e1e6[_0xaaf6('0x25')]],'as':_0x52e1e6['as'],'attributes':_0x52e1e6[_0xaaf6('0x23')],'include':_0x52e1e6['include']?_[_0xaaf6('0x24')](_0x52e1e6['include'],function(_0x96ebc9){return{'model':db[_0x96ebc9[_0xaaf6('0x25')]],'as':_0x96ebc9['as'],'attributes':_0x96ebc9['attributes'],'include':_0x96ebc9[_0xaaf6('0x26')]?_['map'](_0x96ebc9[_0xaaf6('0x26')],function(_0x8da633){return{'model':db[_0x8da633[_0xaaf6('0x25')]],'as':_0x8da633['as'],'attributes':_0x8da633[_0xaaf6('0x23')]};}):[]};}):[]};}):[]:[]})[_0xaaf6('0x12')](function(_0x3d40cd){logger[_0xaaf6('0x13')](_0xaaf6('0x1e'),_0x5e19a8);logger[_0xaaf6('0x15')](_0xaaf6('0x1e'),_0x5e19a8,JSON[_0xaaf6('0x17')](_0x3d40cd));_0x3cfdc5(_0x3d40cd);})['catch'](function(_0xfffc6a){logger[_0xaaf6('0x18')](_0xaaf6('0x1e'),_0xfffc6a[_0xaaf6('0x1b')],_0x5e19a8);_0x2e3d4d(_0x2ad83a['error'](0x1f4,_0xfffc6a[_0xaaf6('0x1b')]));});});}; \ No newline at end of file +var _0xf148=['where','map','include','model','attributes','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSmsAccount','SmsAccount','options','raw'];(function(_0x1992f1,_0x5c61f0){var _0x413dfe=function(_0x2136e5){while(--_0x2136e5){_0x1992f1['push'](_0x1992f1['shift']());}};_0x413dfe(++_0x5c61f0);}(_0xf148,0x1b3));var _0x8f14=function(_0x15fa20,_0x1978e0){_0x15fa20=_0x15fa20-0x0;var _0x47fbc1=_0xf148[_0x15fa20];return _0x47fbc1;};'use strict';var _=require(_0x8f14('0x0'));var util=require(_0x8f14('0x1'));var moment=require(_0x8f14('0x2'));var BPromise=require(_0x8f14('0x3'));var rs=require(_0x8f14('0x4'));var fs=require('fs');var Redis=require(_0x8f14('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x8f14('0x6'));var logger=require(_0x8f14('0x7'))(_0x8f14('0x8'));var config=require('../../config/environment');var jayson=require(_0x8f14('0x9'));var client=jayson[_0x8f14('0xa')][_0x8f14('0xb')]({'port':0x232a});config[_0x8f14('0xc')]=_[_0x8f14('0xd')](config['redis'],{'host':_0x8f14('0xe'),'port':0x18eb});var socket=require(_0x8f14('0xf'))(new Redis(config[_0x8f14('0xc')]));require('./smsAccount.socket')[_0x8f14('0x10')](socket);function respondWithRpcPromise(_0x4f2f03,_0x1c4782,_0x5f2baa){return new BPromise(function(_0x592619,_0x5d8907){return client[_0x8f14('0x11')](_0x4f2f03,_0x5f2baa)[_0x8f14('0x12')](function(_0x2c35c3){logger[_0x8f14('0x13')](_0x8f14('0x14'),_0x1c4782,_0x8f14('0x15'));logger['debug'](_0x8f14('0x16'),_0x1c4782,'request\x20sent',JSON[_0x8f14('0x17')](_0x2c35c3));if(_0x2c35c3['error']){if(_0x2c35c3[_0x8f14('0x18')][_0x8f14('0x19')]===0x1f4){logger['error']('SmsAccount,\x20%s,\x20%s',_0x1c4782,_0x2c35c3[_0x8f14('0x18')]['message']);return _0x5d8907(_0x2c35c3[_0x8f14('0x18')]['message']);}logger['error'](_0x8f14('0x14'),_0x1c4782,_0x2c35c3[_0x8f14('0x18')][_0x8f14('0x1a')]);return _0x592619(_0x2c35c3[_0x8f14('0x18')][_0x8f14('0x1a')]);}else{logger[_0x8f14('0x13')](_0x8f14('0x14'),_0x1c4782,_0x8f14('0x15'));_0x592619(_0x2c35c3[_0x8f14('0x1b')][_0x8f14('0x1a')]);}})[_0x8f14('0x1c')](function(_0xd6dcc9){logger[_0x8f14('0x18')](_0x8f14('0x14'),_0x1c4782,_0xd6dcc9);_0x5d8907(_0xd6dcc9);});});}exports[_0x8f14('0x1d')]=function(_0x4283c1){var _0x1afd80=this;return new Promise(function(_0x27c5af,_0x11dad6){return db[_0x8f14('0x1e')]['find']({'raw':_0x4283c1[_0x8f14('0x1f')]?_0x4283c1[_0x8f14('0x1f')][_0x8f14('0x20')]===undefined?!![]:![]:!![],'where':_0x4283c1[_0x8f14('0x1f')]?_0x4283c1[_0x8f14('0x1f')][_0x8f14('0x21')]||null:null,'attributes':_0x4283c1[_0x8f14('0x1f')]?_0x4283c1['options']['attributes']||null:null,'include':_0x4283c1['options']?_0x4283c1['options']['include']?_[_0x8f14('0x22')](_0x4283c1[_0x8f14('0x1f')][_0x8f14('0x23')],function(_0x1e8f1c){return{'model':db[_0x1e8f1c[_0x8f14('0x24')]],'as':_0x1e8f1c['as'],'attributes':_0x1e8f1c[_0x8f14('0x25')],'include':_0x1e8f1c[_0x8f14('0x23')]?_['map'](_0x1e8f1c[_0x8f14('0x23')],function(_0x3b8039){return{'model':db[_0x3b8039[_0x8f14('0x24')]],'as':_0x3b8039['as'],'attributes':_0x3b8039['attributes'],'include':_0x3b8039[_0x8f14('0x23')]?_[_0x8f14('0x22')](_0x3b8039[_0x8f14('0x23')],function(_0x544d12){return{'model':db[_0x544d12[_0x8f14('0x24')]],'as':_0x544d12['as'],'attributes':_0x544d12['attributes']};}):[]};}):[]};}):[]:[]})[_0x8f14('0x12')](function(_0x548f16){logger[_0x8f14('0x13')](_0x8f14('0x1d'),_0x4283c1);logger[_0x8f14('0x26')](_0x8f14('0x1d'),_0x4283c1,JSON[_0x8f14('0x17')](_0x548f16));_0x27c5af(_0x548f16);})['catch'](function(_0x37a2d1){logger[_0x8f14('0x18')](_0x8f14('0x1d'),_0x37a2d1[_0x8f14('0x1a')],_0x4283c1);_0x11dad6(_0x1afd80[_0x8f14('0x18')](0x1f4,_0x37a2d1[_0x8f14('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index f8e362e..86113f6 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(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'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(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'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 30c09c9..c552b2b 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(_0x454bd8,_0x217a3c){var _0x449e1a=function(_0x3bbe57){while(--_0x3bbe57){_0x454bd8['push'](_0x454bd8['shift']());}};_0x449e1a(++_0x217a3c);}(_0x55ca,0x126));var _0xa55c=function(_0x34bbd5,_0x3c810a){_0x34bbd5=_0x34bbd5-0x0;var _0x46244f=_0x55ca[_0x34bbd5];return _0x46244f;};'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 _0xedd9=['post','create','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsApplication.controller','get','isAuthenticated','index','/:id','show'];(function(_0x174b00,_0x38c75c){var _0x32f4e3=function(_0x38485c){while(--_0x38485c){_0x174b00['push'](_0x174b00['shift']());}};_0x32f4e3(++_0x38c75c);}(_0xedd9,0xfc));var _0x9edd=function(_0x5b6654,_0x5bd6ea){_0x5b6654=_0x5b6654-0x0;var _0x2b9c13=_0xedd9[_0x5b6654];return _0x2b9c13;};'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('0xe')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xf')]);router['put'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0x10')]);router[_0x9edd('0x11')]('/:id',auth[_0x9edd('0xa')](),controller[_0x9edd('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index cd58d05..4bf606e 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 _0xdd62=['STRING','noop','TEXT','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0xdd62,0x12a));var _0x2dd6=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xdd62[_0x4fc9e6];return _0x551d28;};'use strict';var Sequelize=require(_0x2dd6('0x0'));module[_0x2dd6('0x1')]={'priority':{'type':Sequelize[_0x2dd6('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x2dd6('0x3')],'allowNull':![],'defaultValue':_0x2dd6('0x4')},'appdata':{'type':Sequelize[_0x2dd6('0x5')]()},'description':{'type':Sequelize[_0x2dd6('0x3')]},'interval':{'type':Sequelize[_0x2dd6('0x3')],'defaultValue':_0x2dd6('0x6')}}; \ No newline at end of file +var _0x4a3c=['*,*,*,*','exports','STRING','noop','TEXT'];(function(_0x2a56d5,_0x30e7ea){var _0x2aee9e=function(_0x38bf8a){while(--_0x38bf8a){_0x2a56d5['push'](_0x2a56d5['shift']());}};_0x2aee9e(++_0x30e7ea);}(_0x4a3c,0x8d));var _0xc4a3=function(_0x3ff3db,_0x4418fa){_0x3ff3db=_0x3ff3db-0x0;var _0x3d1ef1=_0x4a3c[_0x3ff3db];return _0x3d1ef1;};'use strict';var Sequelize=require('sequelize');module[_0xc4a3('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xc4a3('0x1')],'allowNull':![],'defaultValue':_0xc4a3('0x2')},'appdata':{'type':Sequelize[_0xc4a3('0x3')]()},'description':{'type':Sequelize[_0xc4a3('0x1')]},'interval':{'type':Sequelize[_0xc4a3('0x1')],'defaultValue':_0xc4a3('0x4')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 91ff26f..e17b1db 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 _0x639d=['sort','where','pick','filter','merge','options','SmsApplication','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','status','end','json','undefined','limit','count','offset','set','apply','reject','update','destroy','then','sendStatus','error','stack','name','send','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','nolimit','order'];(function(_0x1897bc,_0x4e9fcf){var _0x4bb0bc=function(_0xed207b){while(--_0xed207b){_0x1897bc['push'](_0x1897bc['shift']());}};_0x4bb0bc(++_0x4e9fcf);}(_0x639d,0xa6));var _0xd639=function(_0x3507e4,_0x13f216){_0x3507e4=_0x3507e4-0x0;var _0x586a22=_0x639d[_0x3507e4];return _0x586a22;};'use strict';var emlformat=require(_0xd639('0x0'));var rimraf=require(_0xd639('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd639('0x2'));var moment=require(_0xd639('0x3'));var BPromise=require(_0xd639('0x4'));var Mustache=require(_0xd639('0x5'));var util=require(_0xd639('0x6'));var path=require(_0xd639('0x7'));var sox=require(_0xd639('0x8'));var csv=require(_0xd639('0x9'));var ejs=require(_0xd639('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd639('0xb'));var squel=require(_0xd639('0xc'));var crypto=require('crypto');var jsforce=require(_0xd639('0xd'));var deskjs=require(_0xd639('0xe'));var toCsv=require(_0xd639('0x9'));var querystring=require('querystring');var Papa=require(_0xd639('0xf'));var Redis=require(_0xd639('0x10'));var authService=require(_0xd639('0x11'));var qs=require(_0xd639('0x12'));var as=require(_0xd639('0x13'));var hardwareService=require(_0xd639('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xd639('0x15'));var config=require(_0xd639('0x16'));var licenseUtil=require(_0xd639('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x30bb80,_0x477ed3){_0x477ed3=_0x477ed3||0xcc;return function(_0x3ac704){if(_0x3ac704){return _0x30bb80['sendStatus'](_0x477ed3);}return _0x30bb80[_0xd639('0x18')](_0x477ed3)[_0xd639('0x19')]();};}function respondWithResult(_0x2d5eb0,_0x1dde7d){_0x1dde7d=_0x1dde7d||0xc8;return function(_0xbf73be){if(_0xbf73be){return _0x2d5eb0['status'](_0x1dde7d)[_0xd639('0x1a')](_0xbf73be);}};}function respondWithFilteredResult(_0xa7128c,_0x210a3e){return function(_0x4b1b3d){if(_0x4b1b3d){var _0x42460a=typeof _0x210a3e['offset']===_0xd639('0x1b')&&typeof _0x210a3e[_0xd639('0x1c')]===_0xd639('0x1b');var _0x1d9210=_0x4b1b3d[_0xd639('0x1d')];var _0x5a01f8=_0x42460a?0x0:_0x210a3e[_0xd639('0x1e')];var _0xb80bc6=_0x42460a?_0x4b1b3d['count']:_0x210a3e['offset']+_0x210a3e['limit'];var _0x19684d;if(_0xb80bc6>=_0x1d9210){_0xb80bc6=_0x1d9210;_0x19684d=0xc8;}else{_0x19684d=0xce;}_0xa7128c[_0xd639('0x18')](_0x19684d);return _0xa7128c[_0xd639('0x1f')]('Content-Range',_0x5a01f8+'-'+_0xb80bc6+'/'+_0x1d9210)[_0xd639('0x1a')](_0x4b1b3d);}return null;};}function patchUpdates(_0x39af5a){return function(_0x551540){try{jsonpatch[_0xd639('0x20')](_0x551540,_0x39af5a,!![]);}catch(_0x5258ad){return BPromise[_0xd639('0x21')](_0x5258ad);}return _0x551540['save']();};}function saveUpdates(_0xe7e715,_0x39d39e){return function(_0x2338e2){if(_0x2338e2){return _0x2338e2[_0xd639('0x22')](_0xe7e715)['then'](function(_0x3600cf){return _0x3600cf;});}return null;};}function removeEntity(_0x1bfa6a,_0x1bb73e){return function(_0x648fa6){if(_0x648fa6){return _0x648fa6[_0xd639('0x23')]()[_0xd639('0x24')](function(){_0x1bfa6a[_0xd639('0x18')](0xcc)[_0xd639('0x19')]();});}};}function handleEntityNotFound(_0x4e6561,_0x4740a9){return function(_0x1d82dc){if(!_0x1d82dc){_0x4e6561[_0xd639('0x25')](0x194);}return _0x1d82dc;};}function handleError(_0x67855f,_0x522c94){_0x522c94=_0x522c94||0x1f4;return function(_0x10397f){logger[_0xd639('0x26')](_0x10397f[_0xd639('0x27')]);if(_0x10397f[_0xd639('0x28')]){delete _0x10397f[_0xd639('0x28')];}_0x67855f[_0xd639('0x18')](_0x522c94)[_0xd639('0x29')](_0x10397f);};}exports['index']=function(_0x4cd425,_0x3e6002){var _0x25816f={},_0x54e20e={},_0x221e4b={'count':0x0,'rows':[]};var _0xec4ce2=_['map'](db['SmsApplication'][_0xd639('0x2a')],function(_0x265223){return{'name':_0x265223[_0xd639('0x2b')],'type':_0x265223[_0xd639('0x2c')][_0xd639('0x2d')]};});_0x54e20e[_0xd639('0x2e')]=_[_0xd639('0x2f')](_0xec4ce2,_0xd639('0x28'));_0x54e20e[_0xd639('0x30')]=_['keys'](_0x4cd425[_0xd639('0x30')]);_0x54e20e[_0xd639('0x31')]=_[_0xd639('0x32')](_0x54e20e[_0xd639('0x2e')],_0x54e20e['query']);_0x25816f[_0xd639('0x33')]=_[_0xd639('0x32')](_0x54e20e[_0xd639('0x2e')],qs[_0xd639('0x34')](_0x4cd425['query'][_0xd639('0x34')]));_0x25816f[_0xd639('0x33')]=_0x25816f[_0xd639('0x33')][_0xd639('0x35')]?_0x25816f['attributes']:_0x54e20e['model'];if(!_0x4cd425[_0xd639('0x30')]['hasOwnProperty'](_0xd639('0x36'))){_0x25816f['limit']=qs[_0xd639('0x1c')](_0x4cd425[_0xd639('0x30')][_0xd639('0x1c')]);_0x25816f[_0xd639('0x1e')]=qs[_0xd639('0x1e')](_0x4cd425[_0xd639('0x30')][_0xd639('0x1e')]);}_0x25816f[_0xd639('0x37')]=qs[_0xd639('0x38')](_0x4cd425[_0xd639('0x30')][_0xd639('0x38')]);_0x25816f[_0xd639('0x39')]=qs[_0xd639('0x31')](_[_0xd639('0x3a')](_0x4cd425[_0xd639('0x30')],_0x54e20e[_0xd639('0x31')]),_0xec4ce2);if(_0x4cd425['query'][_0xd639('0x3b')]){_0x25816f[_0xd639('0x39')]=_[_0xd639('0x3c')](_0x25816f[_0xd639('0x39')],{'$or':_[_0xd639('0x2f')](_0xec4ce2,function(_0x27b777){if(_0x27b777[_0xd639('0x2c')]!=='VIRTUAL'){var _0x3940fb={};_0x3940fb[_0x27b777['name']]={'$like':'%'+_0x4cd425[_0xd639('0x30')][_0xd639('0x3b')]+'%'};return _0x3940fb;}})});}_0x25816f=_[_0xd639('0x3c')]({},_0x25816f,_0x4cd425[_0xd639('0x3d')]);var _0x19e74d={'where':_0x25816f[_0xd639('0x39')]};return db[_0xd639('0x3e')][_0xd639('0x1d')](_0x19e74d)['then'](function(_0x251432){_0x221e4b[_0xd639('0x1d')]=_0x251432;if(_0x4cd425[_0xd639('0x30')][_0xd639('0x3f')]){_0x25816f[_0xd639('0x40')]=[{'all':!![]}];}return db[_0xd639('0x3e')][_0xd639('0x41')](_0x25816f);})[_0xd639('0x24')](function(_0x187bd6){_0x221e4b[_0xd639('0x42')]=_0x187bd6;return _0x221e4b;})['then'](respondWithFilteredResult(_0x3e6002,_0x25816f))[_0xd639('0x43')](handleError(_0x3e6002,null));};exports[_0xd639('0x44')]=function(_0x5b7d26,_0x551037){var _0x3c6605={'raw':!![],'where':{'id':_0x5b7d26[_0xd639('0x45')]['id']}},_0x30c74b={};_0x30c74b[_0xd639('0x2e')]=_[_0xd639('0x46')](db[_0xd639('0x3e')][_0xd639('0x2a')]);_0x30c74b['query']=_[_0xd639('0x46')](_0x5b7d26['query']);_0x30c74b['filters']=_[_0xd639('0x32')](_0x30c74b['model'],_0x30c74b[_0xd639('0x30')]);_0x3c6605[_0xd639('0x33')]=_['intersection'](_0x30c74b[_0xd639('0x2e')],qs['fields'](_0x5b7d26[_0xd639('0x30')][_0xd639('0x34')]));_0x3c6605[_0xd639('0x33')]=_0x3c6605['attributes'][_0xd639('0x35')]?_0x3c6605[_0xd639('0x33')]:_0x30c74b[_0xd639('0x2e')];if(_0x5b7d26[_0xd639('0x30')][_0xd639('0x3f')]){_0x3c6605[_0xd639('0x40')]=[{'all':!![]}];}_0x3c6605=_[_0xd639('0x3c')]({},_0x3c6605,_0x5b7d26[_0xd639('0x3d')]);return db[_0xd639('0x3e')][_0xd639('0x47')](_0x3c6605)[_0xd639('0x24')](handleEntityNotFound(_0x551037,null))[_0xd639('0x24')](respondWithResult(_0x551037,null))[_0xd639('0x43')](handleError(_0x551037,null));};exports[_0xd639('0x48')]=function(_0x161465,_0x7dbdd4){return db[_0xd639('0x3e')][_0xd639('0x48')](_0x161465[_0xd639('0x49')],{})[_0xd639('0x24')](respondWithResult(_0x7dbdd4,0xc9))[_0xd639('0x43')](handleError(_0x7dbdd4,null));};exports['update']=function(_0x14499b,_0x44338c){if(_0x14499b[_0xd639('0x49')]['id']){delete _0x14499b[_0xd639('0x49')]['id'];}return db[_0xd639('0x3e')][_0xd639('0x47')]({'where':{'id':_0x14499b[_0xd639('0x45')]['id']}})[_0xd639('0x24')](handleEntityNotFound(_0x44338c,null))['then'](saveUpdates(_0x14499b[_0xd639('0x49')],null))['then'](respondWithResult(_0x44338c,null))[_0xd639('0x43')](handleError(_0x44338c,null));};exports[_0xd639('0x23')]=function(_0x55bf7a,_0x247d19){return db[_0xd639('0x3e')][_0xd639('0x47')]({'where':{'id':_0x55bf7a['params']['id']}})[_0xd639('0x24')](handleEntityNotFound(_0x247d19,null))[_0xd639('0x24')](removeEntity(_0x247d19,null))[_0xd639('0x43')](handleError(_0x247d19,null));}; \ No newline at end of file +var _0xd134=['catch','show','include','create','body','destroy','find','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','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','limit','undefined','count','set','reject','save','update','then','error','name','send','index','map','SmsApplication','rawAttributes','fieldName','type','key','keys','intersection','model','query','attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter','merge','VIRTUAL','includeAll','findAll'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd134,0xdd));var _0x4d13=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xd134[_0x46698a];return _0x356db0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4d13('0x0'));var zipdir=require(_0x4d13('0x1'));var jsonpatch=require(_0x4d13('0x2'));var rp=require(_0x4d13('0x3'));var moment=require(_0x4d13('0x4'));var BPromise=require(_0x4d13('0x5'));var Mustache=require(_0x4d13('0x6'));var util=require('util');var path=require(_0x4d13('0x7'));var sox=require(_0x4d13('0x8'));var csv=require('to-csv');var ejs=require(_0x4d13('0x9'));var fs=require('fs');var fs_extra=require(_0x4d13('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4d13('0xb'));var toCsv=require('to-csv');var querystring=require(_0x4d13('0xc'));var Papa=require(_0x4d13('0xd'));var Redis=require(_0x4d13('0xe'));var authService=require(_0x4d13('0xf'));var qs=require(_0x4d13('0x10'));var as=require(_0x4d13('0x11'));var hardwareService=require(_0x4d13('0x12'));var logger=require(_0x4d13('0x13'))(_0x4d13('0x14'));var utils=require(_0x4d13('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4d13('0x16'))['db'];function respondWithStatusCode(_0x233644,_0x4294bb){_0x4294bb=_0x4294bb||0xcc;return function(_0x3891f4){if(_0x3891f4){return _0x233644[_0x4d13('0x17')](_0x4294bb);}return _0x233644[_0x4d13('0x18')](_0x4294bb)[_0x4d13('0x19')]();};}function respondWithResult(_0x3ea32d,_0x40b9a4){_0x40b9a4=_0x40b9a4||0xc8;return function(_0x5d54d3){if(_0x5d54d3){return _0x3ea32d[_0x4d13('0x18')](_0x40b9a4)[_0x4d13('0x1a')](_0x5d54d3);}};}function respondWithFilteredResult(_0x2e53af,_0x22c973){return function(_0x57d708){if(_0x57d708){var _0x21e087=typeof _0x22c973[_0x4d13('0x1b')]==='undefined'&&typeof _0x22c973[_0x4d13('0x1c')]===_0x4d13('0x1d');var _0x20ad1b=_0x57d708[_0x4d13('0x1e')];var _0x49fbbf=_0x21e087?0x0:_0x22c973[_0x4d13('0x1b')];var _0x5458b3=_0x21e087?_0x57d708[_0x4d13('0x1e')]:_0x22c973[_0x4d13('0x1b')]+_0x22c973[_0x4d13('0x1c')];var _0x55738a;if(_0x5458b3>=_0x20ad1b){_0x5458b3=_0x20ad1b;_0x55738a=0xc8;}else{_0x55738a=0xce;}_0x2e53af[_0x4d13('0x18')](_0x55738a);return _0x2e53af[_0x4d13('0x1f')]('Content-Range',_0x49fbbf+'-'+_0x5458b3+'/'+_0x20ad1b)['json'](_0x57d708);}return null;};}function patchUpdates(_0x2d0e39){return function(_0x13d1d5){try{jsonpatch['apply'](_0x13d1d5,_0x2d0e39,!![]);}catch(_0x46472a){return BPromise[_0x4d13('0x20')](_0x46472a);}return _0x13d1d5[_0x4d13('0x21')]();};}function saveUpdates(_0x14f7c6,_0x4443b2){return function(_0x5108c4){if(_0x5108c4){return _0x5108c4[_0x4d13('0x22')](_0x14f7c6)['then'](function(_0x25cc94){return _0x25cc94;});}return null;};}function removeEntity(_0x3c7da5,_0xfb717f){return function(_0x44199f){if(_0x44199f){return _0x44199f['destroy']()[_0x4d13('0x23')](function(){_0x3c7da5['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x38dc93,_0x4b0735){return function(_0x1dc778){if(!_0x1dc778){_0x38dc93[_0x4d13('0x17')](0x194);}return _0x1dc778;};}function handleError(_0x34c675,_0x40b1a7){_0x40b1a7=_0x40b1a7||0x1f4;return function(_0x526cff){logger[_0x4d13('0x24')](_0x526cff['stack']);if(_0x526cff[_0x4d13('0x25')]){delete _0x526cff['name'];}_0x34c675[_0x4d13('0x18')](_0x40b1a7)[_0x4d13('0x26')](_0x526cff);};}exports[_0x4d13('0x27')]=function(_0x3d4b2a,_0x35627b){var _0x19f36a={},_0x975769={},_0x4233f3={'count':0x0,'rows':[]};var _0xe033f5=_[_0x4d13('0x28')](db[_0x4d13('0x29')][_0x4d13('0x2a')],function(_0x60ad36){return{'name':_0x60ad36[_0x4d13('0x2b')],'type':_0x60ad36[_0x4d13('0x2c')][_0x4d13('0x2d')]};});_0x975769['model']=_[_0x4d13('0x28')](_0xe033f5,'name');_0x975769['query']=_[_0x4d13('0x2e')](_0x3d4b2a['query']);_0x975769['filters']=_[_0x4d13('0x2f')](_0x975769[_0x4d13('0x30')],_0x975769[_0x4d13('0x31')]);_0x19f36a[_0x4d13('0x32')]=_[_0x4d13('0x2f')](_0x975769[_0x4d13('0x30')],qs[_0x4d13('0x33')](_0x3d4b2a[_0x4d13('0x31')][_0x4d13('0x33')]));_0x19f36a[_0x4d13('0x32')]=_0x19f36a[_0x4d13('0x32')][_0x4d13('0x34')]?_0x19f36a[_0x4d13('0x32')]:_0x975769[_0x4d13('0x30')];if(!_0x3d4b2a[_0x4d13('0x31')][_0x4d13('0x35')]('nolimit')){_0x19f36a[_0x4d13('0x1c')]=qs[_0x4d13('0x1c')](_0x3d4b2a[_0x4d13('0x31')][_0x4d13('0x1c')]);_0x19f36a[_0x4d13('0x1b')]=qs[_0x4d13('0x1b')](_0x3d4b2a[_0x4d13('0x31')][_0x4d13('0x1b')]);}_0x19f36a[_0x4d13('0x36')]=qs[_0x4d13('0x37')](_0x3d4b2a[_0x4d13('0x31')][_0x4d13('0x37')]);_0x19f36a[_0x4d13('0x38')]=qs[_0x4d13('0x39')](_['pick'](_0x3d4b2a[_0x4d13('0x31')],_0x975769['filters']),_0xe033f5);if(_0x3d4b2a[_0x4d13('0x31')][_0x4d13('0x3a')]){_0x19f36a[_0x4d13('0x38')]=_[_0x4d13('0x3b')](_0x19f36a['where'],{'$or':_[_0x4d13('0x28')](_0xe033f5,function(_0x110298){if(_0x110298['type']!==_0x4d13('0x3c')){var _0x567273={};_0x567273[_0x110298['name']]={'$like':'%'+_0x3d4b2a[_0x4d13('0x31')][_0x4d13('0x3a')]+'%'};return _0x567273;}})});}_0x19f36a=_[_0x4d13('0x3b')]({},_0x19f36a,_0x3d4b2a['options']);var _0x3af18e={'where':_0x19f36a[_0x4d13('0x38')]};return db['SmsApplication'][_0x4d13('0x1e')](_0x3af18e)[_0x4d13('0x23')](function(_0x376707){_0x4233f3[_0x4d13('0x1e')]=_0x376707;if(_0x3d4b2a[_0x4d13('0x31')][_0x4d13('0x3d')]){_0x19f36a['include']=[{'all':!![]}];}return db[_0x4d13('0x29')][_0x4d13('0x3e')](_0x19f36a);})['then'](function(_0x48d133){_0x4233f3['rows']=_0x48d133;return _0x4233f3;})[_0x4d13('0x23')](respondWithFilteredResult(_0x35627b,_0x19f36a))[_0x4d13('0x3f')](handleError(_0x35627b,null));};exports[_0x4d13('0x40')]=function(_0x1cac9a,_0x4bab32){var _0x41bf74={'raw':!![],'where':{'id':_0x1cac9a['params']['id']}},_0x37fb2e={};_0x37fb2e[_0x4d13('0x30')]=_['keys'](db['SmsApplication']['rawAttributes']);_0x37fb2e[_0x4d13('0x31')]=_[_0x4d13('0x2e')](_0x1cac9a[_0x4d13('0x31')]);_0x37fb2e['filters']=_[_0x4d13('0x2f')](_0x37fb2e[_0x4d13('0x30')],_0x37fb2e[_0x4d13('0x31')]);_0x41bf74['attributes']=_[_0x4d13('0x2f')](_0x37fb2e[_0x4d13('0x30')],qs[_0x4d13('0x33')](_0x1cac9a[_0x4d13('0x31')]['fields']));_0x41bf74[_0x4d13('0x32')]=_0x41bf74[_0x4d13('0x32')][_0x4d13('0x34')]?_0x41bf74[_0x4d13('0x32')]:_0x37fb2e[_0x4d13('0x30')];if(_0x1cac9a[_0x4d13('0x31')][_0x4d13('0x3d')]){_0x41bf74[_0x4d13('0x41')]=[{'all':!![]}];}_0x41bf74=_[_0x4d13('0x3b')]({},_0x41bf74,_0x1cac9a['options']);return db[_0x4d13('0x29')]['find'](_0x41bf74)['then'](handleEntityNotFound(_0x4bab32,null))[_0x4d13('0x23')](respondWithResult(_0x4bab32,null))['catch'](handleError(_0x4bab32,null));};exports[_0x4d13('0x42')]=function(_0x5d1b42,_0x33ca7b){return db['SmsApplication']['create'](_0x5d1b42['body'],{})['then'](respondWithResult(_0x33ca7b,0xc9))[_0x4d13('0x3f')](handleError(_0x33ca7b,null));};exports['update']=function(_0x3f5ff1,_0x43f561){if(_0x3f5ff1[_0x4d13('0x43')]['id']){delete _0x3f5ff1[_0x4d13('0x43')]['id'];}return db['SmsApplication']['find']({'where':{'id':_0x3f5ff1['params']['id']}})[_0x4d13('0x23')](handleEntityNotFound(_0x43f561,null))[_0x4d13('0x23')](saveUpdates(_0x3f5ff1[_0x4d13('0x43')],null))['then'](respondWithResult(_0x43f561,null))['catch'](handleError(_0x43f561,null));};exports[_0x4d13('0x44')]=function(_0x59cd4a,_0x5882f4){return db['SmsApplication'][_0x4d13('0x45')]({'where':{'id':_0x59cd4a[_0x4d13('0x46')]['id']}})['then'](handleEntityNotFound(_0x5882f4,null))[_0x4d13('0x23')](removeEntity(_0x5882f4,null))[_0x4d13('0x3f')](handleError(_0x5882f4,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 4bf6b3d..50b04f9 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 _0xb459=['util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','exports','define','SmsApplication','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x3b7c45,_0x300de7){var _0x23989a=function(_0x32681d){while(--_0x32681d){_0x3b7c45['push'](_0x3b7c45['shift']());}};_0x23989a(++_0x300de7);}(_0xb459,0x178));var _0x9b45=function(_0x1a8bbc,_0x17a086){_0x1a8bbc=_0x1a8bbc-0x0;var _0x212fc2=_0xb459[_0x1a8bbc];return _0x212fc2;};'use strict';var _=require(_0x9b45('0x0'));var util=require(_0x9b45('0x1'));var logger=require(_0x9b45('0x2'))(_0x9b45('0x3'));var moment=require('moment');var BPromise=require(_0x9b45('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9b45('0x5'));var rimraf=require(_0x9b45('0x6'));var config=require(_0x9b45('0x7'));var attributes=require('./smsApplication.attributes');module[_0x9b45('0x8')]=function(_0x5d2823,_0x9e0bf4){return _0x5d2823[_0x9b45('0x9')](_0x9b45('0xa'),attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9b45('0xb'),'collate':_0x9b45('0xc')});}; \ No newline at end of file +var _0x174d=['rimraf','./smsApplication.attributes','exports','define','SmsApplication','sms_applications','utf8mb4_unicode_ci','../../config/logger','api','moment','request-promise'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x174d,0x1ca));var _0xd174=function(_0x15b0d0,_0x49d4bc){_0x15b0d0=_0x15b0d0-0x0;var _0x31a929=_0x174d[_0x15b0d0];return _0x31a929;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd174('0x0'))(_0xd174('0x1'));var moment=require(_0xd174('0x2'));var BPromise=require('bluebird');var rp=require(_0xd174('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd174('0x4'));var config=require('../../config/environment');var attributes=require(_0xd174('0x5'));module[_0xd174('0x6')]=function(_0x35ae3f,_0x53e2fa){return _0x35ae3f[_0xd174('0x7')](_0xd174('0x8'),attributes,{'tableName':_0xd174('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xd174('0xa')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index e1e5fb2..f073117 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 _0x8814=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','SmsApplication,\x20%s,\x20%s','debug','SmsApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8814,0x1b8));var _0x4881=function(_0x54edc9,_0x345f01){_0x54edc9=_0x54edc9-0x0;var _0x2ae7a9=_0x8814[_0x54edc9];return _0x2ae7a9;};'use strict';var _=require(_0x4881('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x4881('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4881('0x2'));var db=require(_0x4881('0x3'))['db'];var utils=require(_0x4881('0x4'));var logger=require(_0x4881('0x5'))('rpc');var config=require(_0x4881('0x6'));var jayson=require(_0x4881('0x7'));var client=jayson[_0x4881('0x8')][_0x4881('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4bcf00,_0x1151b4,_0x505b8a){return new BPromise(function(_0x23a0d4,_0x471090){return client[_0x4881('0xa')](_0x4bcf00,_0x505b8a)[_0x4881('0xb')](function(_0x5baef8){logger[_0x4881('0xc')](_0x4881('0xd'),_0x1151b4,'request\x20sent');logger[_0x4881('0xe')](_0x4881('0xf'),_0x1151b4,_0x4881('0x10'),JSON[_0x4881('0x11')](_0x5baef8));if(_0x5baef8[_0x4881('0x12')]){if(_0x5baef8[_0x4881('0x12')]['code']===0x1f4){logger[_0x4881('0x12')](_0x4881('0xd'),_0x1151b4,_0x5baef8[_0x4881('0x12')][_0x4881('0x13')]);return _0x471090(_0x5baef8['error'][_0x4881('0x13')]);}logger[_0x4881('0x12')](_0x4881('0xd'),_0x1151b4,_0x5baef8[_0x4881('0x12')][_0x4881('0x13')]);return _0x23a0d4(_0x5baef8[_0x4881('0x12')]['message']);}else{logger['info']('SmsApplication,\x20%s,\x20%s',_0x1151b4,'request\x20sent');_0x23a0d4(_0x5baef8[_0x4881('0x14')][_0x4881('0x13')]);}})['catch'](function(_0x384f9b){logger[_0x4881('0x12')](_0x4881('0xd'),_0x1151b4,_0x384f9b);_0x471090(_0x384f9b);});});} \ No newline at end of file +var _0x8ff9=['../../config/environment','client','http','request','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x8ff9,0x1a6));var _0x98ff=function(_0x204b73,_0xaecf3c){_0x204b73=_0x204b73-0x0;var _0x267202=_0x8ff9[_0x204b73];return _0x267202;};'use strict';var _=require(_0x98ff('0x0'));var util=require(_0x98ff('0x1'));var moment=require(_0x98ff('0x2'));var BPromise=require(_0x98ff('0x3'));var rs=require(_0x98ff('0x4'));var fs=require('fs');var Redis=require(_0x98ff('0x5'));var db=require(_0x98ff('0x6'))['db'];var utils=require(_0x98ff('0x7'));var logger=require(_0x98ff('0x8'))(_0x98ff('0x9'));var config=require(_0x98ff('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x98ff('0xb')][_0x98ff('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x13537e,_0x21d840,_0x12d3fe){return new BPromise(function(_0xbe13f3,_0x51fbd8){return client[_0x98ff('0xd')](_0x13537e,_0x12d3fe)['then'](function(_0x4bbf37){logger[_0x98ff('0xe')](_0x98ff('0xf'),_0x21d840,_0x98ff('0x10'));logger[_0x98ff('0x11')](_0x98ff('0x12'),_0x21d840,'request\x20sent',JSON[_0x98ff('0x13')](_0x4bbf37));if(_0x4bbf37['error']){if(_0x4bbf37[_0x98ff('0x14')]['code']===0x1f4){logger['error'](_0x98ff('0xf'),_0x21d840,_0x4bbf37[_0x98ff('0x14')][_0x98ff('0x15')]);return _0x51fbd8(_0x4bbf37['error'][_0x98ff('0x15')]);}logger['error'](_0x98ff('0xf'),_0x21d840,_0x4bbf37[_0x98ff('0x14')][_0x98ff('0x15')]);return _0xbe13f3(_0x4bbf37[_0x98ff('0x14')][_0x98ff('0x15')]);}else{logger[_0x98ff('0xe')]('SmsApplication,\x20%s,\x20%s',_0x21d840,_0x98ff('0x10'));_0xbe13f3(_0x4bbf37[_0x98ff('0x16')][_0x98ff('0x15')]);}})[_0x98ff('0x17')](function(_0x3751b9){logger[_0x98ff('0x14')](_0x98ff('0xf'),_0x21d840,_0x3751b9);_0x51fbd8(_0x3751b9);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 14f6c21..c2a4e1c 100644 --- a/server/api/smsInteraction/index.js +++ b/server/api/smsInteraction/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x80ed=['delete','smsinteraction:destroy','destroy','/:id/tags','removeTags','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','/:id/download','download','post','create','tracked','sms','smsinteraction:addtags','addTags','smsinteraction:update','update'];(function(_0x56456b,_0x5babd7){var _0x37da11=function(_0x45698e){while(--_0x45698e){_0x56456b['push'](_0x56456b['shift']());}};_0x37da11(++_0x5babd7);}(_0x80ed,0x11c));var _0xd80e=function(_0x295369,_0x4a7e63){_0x295369=_0x295369-0x0;var _0x15d4b7=_0x80ed[_0x295369];return _0x15d4b7;};'use strict';var multer=require(_0xd80e('0x0'));var util=require('util');var path=require(_0xd80e('0x1'));var timeout=require(_0xd80e('0x2'));var express=require(_0xd80e('0x3'));var router=express['Router']();var fs_extra=require(_0xd80e('0x4'));var auth=require(_0xd80e('0x5'));var interaction=require(_0xd80e('0x6'));var config=require(_0xd80e('0x7'));var controller=require('./smsInteraction.controller');router[_0xd80e('0x8')]('/',auth[_0xd80e('0x9')](),controller[_0xd80e('0xa')]);router['get'](_0xd80e('0xb'),auth[_0xd80e('0x9')](),controller[_0xd80e('0xc')]);router[_0xd80e('0x8')](_0xd80e('0xd'),auth[_0xd80e('0x9')](),controller[_0xd80e('0xe')]);router[_0xd80e('0x8')](_0xd80e('0xf'),auth[_0xd80e('0x9')](),controller['getMessages']);router[_0xd80e('0x8')](_0xd80e('0x10'),auth[_0xd80e('0x9')](),controller[_0xd80e('0x11')]);router[_0xd80e('0x12')]('/',auth[_0xd80e('0x9')](),controller[_0xd80e('0x13')]);router[_0xd80e('0x12')](_0xd80e('0xf'),auth['isAuthenticated'](),controller['addMessage']);router['post']('/:id/tags',auth[_0xd80e('0x9')](),interaction[_0xd80e('0x14')](_0xd80e('0x15'),_0xd80e('0x16')),controller[_0xd80e('0x17')]);router['put'](_0xd80e('0xd'),auth[_0xd80e('0x9')](),interaction[_0xd80e('0x14')](_0xd80e('0x15'),_0xd80e('0x18')),controller[_0xd80e('0x19')]);router[_0xd80e('0x1a')](_0xd80e('0xd'),auth['isAuthenticated'](),interaction[_0xd80e('0x14')](_0xd80e('0x15'),_0xd80e('0x1b')),controller[_0xd80e('0x1c')]);router['delete'](_0xd80e('0x1d'),auth[_0xd80e('0x9')](),controller[_0xd80e('0x1e')]);module['exports']=router; \ No newline at end of file +var _0x0b0e=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','describe','/:id','/:id/messages','getMessages','download','post','create','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','put','smsinteraction:update','delete','exports','multer'];(function(_0x28b3bb,_0x2fac53){var _0x1920db=function(_0x48e8c3){while(--_0x48e8c3){_0x28b3bb['push'](_0x28b3bb['shift']());}};_0x1920db(++_0x2fac53);}(_0x0b0e,0x187));var _0xe0b0=function(_0x11deef,_0x34bbdb){_0x11deef=_0x11deef-0x0;var _0xe9ba85=_0x0b0e[_0x11deef];return _0xe9ba85;};'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')]('/describe',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0x9')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['show']);router[_0xe0b0('0x9')](_0xe0b0('0xe'),auth['isAuthenticated'](),controller[_0xe0b0('0xf')]);router[_0xe0b0('0x9')]('/:id/download',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x10')]);router[_0xe0b0('0x11')]('/',auth['isAuthenticated'](),controller[_0xe0b0('0x12')]);router[_0xe0b0('0x11')](_0xe0b0('0xe'),auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x13')]);router['post'](_0xe0b0('0x14'),auth[_0xe0b0('0xa')](),interaction[_0xe0b0('0x15')](_0xe0b0('0x16'),_0xe0b0('0x17')),controller['addTags']);router[_0xe0b0('0x18')]('/:id',auth[_0xe0b0('0xa')](),interaction[_0xe0b0('0x15')]('sms',_0xe0b0('0x19')),controller['update']);router[_0xe0b0('0x1a')](_0xe0b0('0xd'),auth['isAuthenticated'](),interaction['tracked'](_0xe0b0('0x16'),'smsinteraction:destroy'),controller['destroy']);router['delete'](_0xe0b0('0x14'),auth['isAuthenticated'](),controller['removeTags']);module[_0xe0b0('0x1b')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 65ec824..6afee23 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 _0x29b1=['DATE','STRING','ENUM','out','INTEGER','sequelize','moment','exports','BOOLEAN'];(function(_0x2c958a,_0x4d4a68){var _0x48a27c=function(_0x4ff1f8){while(--_0x4ff1f8){_0x2c958a['push'](_0x2c958a['shift']());}};_0x48a27c(++_0x4d4a68);}(_0x29b1,0x16d));var _0x129b=function(_0x174ef5,_0x256e8e){_0x174ef5=_0x174ef5-0x0;var _0x1cc379=_0x29b1[_0x174ef5];return _0x1cc379;};'use strict';var Sequelize=require(_0x129b('0x0'));var moment=require(_0x129b('0x1'));module[_0x129b('0x2')]={'closed':{'type':Sequelize[_0x129b('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x129b('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x129b('0x5')]},'thirdDisposition':{'type':Sequelize[_0x129b('0x5')]},'note':{'type':Sequelize[_0x129b('0x5')]},'phone':{'type':Sequelize[_0x129b('0x5')]},'read1stAt':{'type':Sequelize[_0x129b('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x129b('0x6')]('in',_0x129b('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x129b('0x4')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x129b('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0x129b('0x8')]}}; \ No newline at end of file +var _0x5204=['moment','BOOLEAN','DATE','STRING','ENUM','out','INTEGER','sequelize'];(function(_0x457aa6,_0x20f036){var _0x2b1d0d=function(_0xe0b842){while(--_0xe0b842){_0x457aa6['push'](_0x457aa6['shift']());}};_0x2b1d0d(++_0x20f036);}(_0x5204,0xdf));var _0x4520=function(_0x10e983,_0x2f4eda){_0x10e983=_0x10e983-0x0;var _0x324138=_0x5204[_0x10e983];return _0x324138;};'use strict';var Sequelize=require(_0x4520('0x0'));var moment=require(_0x4520('0x1'));module['exports']={'closed':{'type':Sequelize[_0x4520('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x4520('0x3')]},'disposition':{'type':Sequelize[_0x4520('0x4')]},'secondDisposition':{'type':Sequelize[_0x4520('0x4')]},'thirdDisposition':{'type':Sequelize[_0x4520('0x4')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x4520('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x4520('0x5')]('in',_0x4520('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x4520('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x4520('0x5')]('in',_0x4520('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x4520('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x4520('0x7')]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 5ed35c8..d56099e 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 _0xb20f=['mkdirSync','Sms','N.A.','YYYY-MM-DD\x20HH:mm:ss','closedAt','disposition','out','System','secret','value','renderFile','root','views','downloadInteraction.ejs','transcript-','.pdf','log','err','unlinkSync','rimraf','zip-dir','moment','bluebird','util','ejs','lodash','ioredis','../../components/interaction/service','../../components/export/pdf','../../config/environment','../../mysqldb','defaults','localhost','./smsInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','then','stack','name','send','map','rawAttributes','fieldName','getOptions','user','catch','show','params','keys','query','filters','intersection','attributes','fields','length','model','includeAll','merge','options','SmsInteraction','find','create','body','update','describe','addMessage','SmsMessage','ids','omit','findOne','hasOwnProperty','nolimit','order','sort','where','pick','filter','$gte','split','format','include','findAll','rows','addTags','setTags','spread','color','emit','removeTags','download','unix','toString','join','server','files','transcript-%d-%s.zip','User','fullname','CmContact','Contact','firstName','lastName','Messages','createdAt','direction','read','SmsAccount','Account','Owner','get'];(function(_0x229607,_0x5653a6){var _0x5ed9a6=function(_0x4c60b7){while(--_0x4c60b7){_0x229607['push'](_0x229607['shift']());}};_0x5ed9a6(++_0x5653a6);}(_0xb20f,0x1ef));var _0xfb20=function(_0x45d0dc,_0x367a3e){_0x45d0dc=_0x45d0dc-0x0;var _0x29cfc5=_0xb20f[_0x45d0dc];return _0x29cfc5;};'use strict';var rimraf=require(_0xfb20('0x0'));var zipdir=require(_0xfb20('0x1'));var moment=require(_0xfb20('0x2'));var BPromise=require(_0xfb20('0x3'));var util=require(_0xfb20('0x4'));var path=require('path');var ejs=require(_0xfb20('0x5'));var fs=require('fs');var _=require(_0xfb20('0x6'));var Redis=require(_0xfb20('0x7'));var interaction=require(_0xfb20('0x8'));var qs=require('../../components/parsers/qs');var pdf=require(_0xfb20('0x9'));var logger=require('../../config/logger')('api');var config=require(_0xfb20('0xa'));var db=require(_0xfb20('0xb'))['db'];config['redis']=_[_0xfb20('0xc')](config['redis'],{'host':_0xfb20('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xfb20('0xe'))[_0xfb20('0xf')](socket);function respondWithStatusCode(_0x4ca1c0,_0x262f5f){_0x262f5f=_0x262f5f||0xcc;return function(_0x3b0c08){if(_0x3b0c08){return _0x4ca1c0[_0xfb20('0x10')](_0x262f5f);}return _0x4ca1c0[_0xfb20('0x11')](_0x262f5f)[_0xfb20('0x12')]();};}function respondWithResult(_0x131439,_0x314329){_0x314329=_0x314329||0xc8;return function(_0x291106){if(_0x291106){return _0x131439[_0xfb20('0x11')](_0x314329)[_0xfb20('0x13')](_0x291106);}};}function respondWithFilteredResult(_0x399cec,_0x5e65d3){return function(_0xa72436){if(_0xa72436){var _0x3d4c1c=typeof _0x5e65d3[_0xfb20('0x14')]===_0xfb20('0x15')&&typeof _0x5e65d3[_0xfb20('0x16')]==='undefined';var _0x2e9b97=_0xa72436['count'];var _0x5f2ab8=_0x3d4c1c?0x0:_0x5e65d3['offset'];var _0x4b36df=_0x3d4c1c?_0xa72436[_0xfb20('0x17')]:_0x5e65d3[_0xfb20('0x14')]+_0x5e65d3[_0xfb20('0x16')];var _0x26e72c;if(_0x4b36df>=_0x2e9b97){_0x4b36df=_0x2e9b97;_0x26e72c=0xc8;}else{_0x26e72c=0xce;}_0x399cec[_0xfb20('0x11')](_0x26e72c);return _0x399cec[_0xfb20('0x18')](_0xfb20('0x19'),_0x5f2ab8+'-'+_0x4b36df+'/'+_0x2e9b97)[_0xfb20('0x13')](_0xa72436);}return null;};}function saveUpdates(_0x3fc909){return function(_0x1a5ec3){if(_0x1a5ec3){return _0x1a5ec3['update'](_0x3fc909)[_0xfb20('0x1a')](function(_0x42a87f){return _0x42a87f;});}return null;};}function removeEntity(_0x38b804){return function(_0x691ba5){if(_0x691ba5){return _0x691ba5['destroy']()[_0xfb20('0x1a')](function(){_0x38b804[_0xfb20('0x11')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d48f8){return function(_0x3540d1){if(!_0x3540d1){_0x5d48f8[_0xfb20('0x10')](0x194);}return _0x3540d1;};}function handleError(_0x385441,_0x103aed){_0x103aed=_0x103aed||0x1f4;return function(_0x35562a){logger['error'](_0x35562a[_0xfb20('0x1b')]);if(_0x35562a[_0xfb20('0x1c')]){delete _0x35562a['name'];}_0x385441[_0xfb20('0x11')](_0x103aed)[_0xfb20('0x1d')](_0x35562a);};}exports['index']=function(_0x2753a9,_0x21fb86){var _0x41f17d={};var _0x41f5c7=_[_0xfb20('0x1e')](db['SmsInteraction'][_0xfb20('0x1f')],function(_0x23c0a1){return{'name':_0x23c0a1[_0xfb20('0x20')],'type':_0x23c0a1['type']['key']};});_0x41f17d=qs[_0xfb20('0x21')](_0x41f5c7,_0x2753a9);return interaction['findAll']('sms',_0x2753a9['query'],_0x2753a9[_0xfb20('0x22')],_0x41f17d,_0x41f5c7)[_0xfb20('0x1a')](respondWithFilteredResult(_0x21fb86,_0x41f17d))[_0xfb20('0x23')](handleError(_0x21fb86,null));};exports[_0xfb20('0x24')]=function(_0x25d60d,_0x5a23da){var _0x232823={'raw':![],'where':{'id':_0x25d60d[_0xfb20('0x25')]['id']}},_0x272e5a={};_0x272e5a['model']=_[_0xfb20('0x26')](db['SmsInteraction'][_0xfb20('0x1f')]);_0x272e5a[_0xfb20('0x27')]=_['keys'](_0x25d60d[_0xfb20('0x27')]);_0x272e5a[_0xfb20('0x28')]=_[_0xfb20('0x29')](_0x272e5a['model'],_0x272e5a[_0xfb20('0x27')]);_0x232823[_0xfb20('0x2a')]=_[_0xfb20('0x29')](_0x272e5a['model'],qs[_0xfb20('0x2b')](_0x25d60d['query'][_0xfb20('0x2b')]));_0x232823['attributes']=_0x232823[_0xfb20('0x2a')][_0xfb20('0x2c')]?_0x232823['attributes']:_0x272e5a[_0xfb20('0x2d')];if(_0x25d60d[_0xfb20('0x27')][_0xfb20('0x2e')]){_0x232823['include']=[{'all':!![]}];}_0x232823=_[_0xfb20('0x2f')]({},_0x232823,_0x25d60d[_0xfb20('0x30')]);return db[_0xfb20('0x31')][_0xfb20('0x32')](_0x232823)[_0xfb20('0x1a')](handleEntityNotFound(_0x5a23da,null))['then'](respondWithResult(_0x5a23da,null))[_0xfb20('0x23')](handleError(_0x5a23da,null));};exports['create']=function(_0x355a01,_0x42ec43){return db[_0xfb20('0x31')][_0xfb20('0x33')](_0x355a01[_0xfb20('0x34')],{})[_0xfb20('0x1a')](respondWithResult(_0x42ec43,0xc9))[_0xfb20('0x23')](handleError(_0x42ec43,null));};exports[_0xfb20('0x35')]=function(_0x4c8733,_0x554ef6){if(_0x4c8733[_0xfb20('0x34')]['id']){delete _0x4c8733[_0xfb20('0x34')]['id'];}return db[_0xfb20('0x31')][_0xfb20('0x32')]({'where':{'id':_0x4c8733[_0xfb20('0x25')]['id']}})['then'](handleEntityNotFound(_0x554ef6,null))[_0xfb20('0x1a')](saveUpdates(_0x4c8733[_0xfb20('0x34')],null))[_0xfb20('0x1a')](respondWithResult(_0x554ef6,null))[_0xfb20('0x23')](handleError(_0x554ef6,null));};exports['destroy']=function(_0x1353b2,_0x40d28b){return db[_0xfb20('0x31')][_0xfb20('0x32')]({'where':{'id':_0x1353b2['params']['id']}})[_0xfb20('0x1a')](handleEntityNotFound(_0x40d28b,null))[_0xfb20('0x1a')](removeEntity(_0x40d28b,null))['catch'](handleError(_0x40d28b,null));};exports[_0xfb20('0x36')]=function(_0x57cdde,_0x78e405){return db[_0xfb20('0x31')]['describe']()[_0xfb20('0x1a')](respondWithResult(_0x78e405,null))['catch'](handleError(_0x78e405,null));};exports[_0xfb20('0x37')]=function(_0x41cd34,_0x7b822e){return db[_0xfb20('0x38')][_0xfb20('0x32')]({'where':{'id':_0x41cd34[_0xfb20('0x25')]['id']}})['then'](handleEntityNotFound(_0x7b822e,null))[_0xfb20('0x1a')](function(_0x70d6be){if(_0x70d6be){return _0x70d6be['addMessage'](_0x41cd34['body'][_0xfb20('0x39')],_[_0xfb20('0x3a')](_0x41cd34[_0xfb20('0x34')],[_0xfb20('0x39'),'id'])||{});}})[_0xfb20('0x1a')](respondWithResult(_0x7b822e,null))[_0xfb20('0x23')](handleError(_0x7b822e,null));};exports['getMessages']=function(_0x142fe3,_0x5ba4c6){var _0x3c967a={'raw':![],'where':{}};var _0x4e59c1={};var _0x5b4e1f={'count':0x0,'rows':[]};return db[_0xfb20('0x31')][_0xfb20('0x3b')]({'where':{'id':_0x142fe3[_0xfb20('0x25')]['id']}})[_0xfb20('0x1a')](handleEntityNotFound(_0x5ba4c6,null))[_0xfb20('0x1a')](function(_0x3baada){if(_0x3baada){_0x4e59c1[_0xfb20('0x2d')]=_[_0xfb20('0x26')](db[_0xfb20('0x38')][_0xfb20('0x1f')]);_0x4e59c1['query']=_['keys'](_0x142fe3[_0xfb20('0x27')]);_0x4e59c1['filters']=_[_0xfb20('0x29')](_0x4e59c1[_0xfb20('0x2d')],_0x4e59c1[_0xfb20('0x27')]);_0x3c967a[_0xfb20('0x2a')]=_[_0xfb20('0x29')](_0x4e59c1['model'],qs['fields'](_0x142fe3[_0xfb20('0x27')][_0xfb20('0x2b')]));_0x3c967a[_0xfb20('0x2a')]=_0x3c967a[_0xfb20('0x2a')][_0xfb20('0x2c')]?_0x3c967a['attributes']:_0x4e59c1[_0xfb20('0x2d')];if(!_0x142fe3['query'][_0xfb20('0x3c')](_0xfb20('0x3d'))){_0x3c967a[_0xfb20('0x16')]=qs[_0xfb20('0x16')](_0x142fe3[_0xfb20('0x27')][_0xfb20('0x16')]);_0x3c967a[_0xfb20('0x14')]=qs[_0xfb20('0x14')](_0x142fe3['query']['offset']);}_0x3c967a[_0xfb20('0x3e')]=qs[_0xfb20('0x3f')](_0x142fe3[_0xfb20('0x27')][_0xfb20('0x3f')]);_0x3c967a[_0xfb20('0x40')]=qs['filters'](_[_0xfb20('0x41')](_0x142fe3[_0xfb20('0x27')],_0x4e59c1[_0xfb20('0x28')]));_0x3c967a[_0xfb20('0x40')]['SmsInteractionId']=_0x3baada['id'];if(_0x142fe3[_0xfb20('0x27')][_0xfb20('0x42')]){_0x3c967a[_0xfb20('0x40')]=_[_0xfb20('0x2f')](_0x3c967a[_0xfb20('0x40')],{'$or':_[_0xfb20('0x1e')](_0x3c967a[_0xfb20('0x2a')],function(_0x3696ee){var _0x374322={};_0x374322[_0x3696ee]={'$like':'%'+_0x142fe3['query'][_0xfb20('0x42')]+'%'};return _0x374322;})});}if(_0x142fe3[_0xfb20('0x27')][_0xfb20('0x43')]){var _0x4f9283=_0x142fe3[_0xfb20('0x27')][_0xfb20('0x43')][_0xfb20('0x44')](',');var _0x488f6f={};_0x488f6f[_0x4f9283[0x0]]={'$gte':moment(_0x4f9283[0x1])[_0xfb20('0x45')]('YYYY-MM-DD\x20HH:mm:ss')};_0x3c967a[_0xfb20('0x40')]=_[_0xfb20('0x2f')](_0x3c967a[_0xfb20('0x40')],_0x488f6f);}_0x3c967a=_[_0xfb20('0x2f')]({},_0x3c967a,_0x142fe3[_0xfb20('0x30')]);return db[_0xfb20('0x38')][_0xfb20('0x17')]({'where':_0x3c967a[_0xfb20('0x40')]})[_0xfb20('0x1a')](function(_0x54298c){_0x5b4e1f[_0xfb20('0x17')]=_0x54298c;if(_0x142fe3[_0xfb20('0x27')][_0xfb20('0x2e')]){_0x3c967a[_0xfb20('0x46')]=[{'all':!![]}];}return db[_0xfb20('0x38')][_0xfb20('0x47')](_0x3c967a);})[_0xfb20('0x1a')](function(_0x3f41a7){_0x5b4e1f[_0xfb20('0x48')]=_0x3f41a7;return _0x5b4e1f;});}})['then'](respondWithFilteredResult(_0x5ba4c6,_0x3c967a))[_0xfb20('0x23')](handleError(_0x5ba4c6,null));};exports[_0xfb20('0x49')]=function(_0x1e94de,_0x5cf485){return db[_0xfb20('0x31')][_0xfb20('0x32')]({'where':{'id':_0x1e94de['params']['id']}})['then'](handleEntityNotFound(_0x5cf485,null))[_0xfb20('0x1a')](function(_0x57a3f3){if(_0x57a3f3){return _0x57a3f3[_0xfb20('0x4a')](_0x1e94de[_0xfb20('0x34')][_0xfb20('0x39')],_['omit'](_0x1e94de['body'],[_0xfb20('0x39'),'id'])||{})[_0xfb20('0x4b')](function(){return db['Tag'][_0xfb20('0x47')]({'attributes':['id',_0xfb20('0x1c'),_0xfb20('0x4c')],'where':{'id':_0x1e94de['body'][_0xfb20('0x39')]}});})['then'](function(_0x37b5ac){socket[_0xfb20('0x4d')]('smsInteractionTags:save',{'id':Number(_0x1e94de[_0xfb20('0x25')]['id']),'tags':_0x37b5ac||[]});return{'id':Number(_0x1e94de[_0xfb20('0x25')]['id']),'tags':_0x37b5ac||[]};});}})[_0xfb20('0x1a')](respondWithResult(_0x5cf485,null))[_0xfb20('0x23')](handleError(_0x5cf485,null));};exports[_0xfb20('0x4e')]=function(_0x5dd644,_0x27afb0){return db[_0xfb20('0x31')]['find']({'where':{'id':_0x5dd644[_0xfb20('0x25')]['id']}})['then'](handleEntityNotFound(_0x27afb0,null))['then'](function(_0x23da5b){if(_0x23da5b){return _0x23da5b[_0xfb20('0x4e')](_0x5dd644[_0xfb20('0x27')]['ids']);}})[_0xfb20('0x1a')](respondWithStatusCode(_0x27afb0,null))[_0xfb20('0x23')](handleError(_0x27afb0,null));};exports[_0xfb20('0x4f')]=function(_0x952fff,_0x17b4b9){var _0x28a508=moment()[_0xfb20('0x50')]()[_0xfb20('0x51')]();var _0x3f9425=path[_0xfb20('0x52')](config['root'],_0xfb20('0x53'),_0xfb20('0x54'),'tmp');var _0x1c5d10=path['join'](_0x3f9425,_0x28a508);var _0x324c3d=util[_0xfb20('0x45')](_0xfb20('0x55'),_0x952fff[_0xfb20('0x25')]['id'],_0x28a508);var _0x44786a=path[_0xfb20('0x52')](_0x3f9425,_0x324c3d);var _0x2e4a49=[];_0x2e4a49['push']({'model':db[_0xfb20('0x56')],'as':_0xfb20('0x56'),'attributes':['id',_0xfb20('0x57')],'raw':!![]});_0x2e4a49['push']({'model':db[_0xfb20('0x58')],'as':_0xfb20('0x59'),'attributes':['id',_0xfb20('0x5a'),_0xfb20('0x5b')],'raw':!![]});var _0x9e7adc=[{'model':db[_0xfb20('0x38')],'as':_0xfb20('0x5c'),'attributes':['id',_0xfb20('0x34'),_0xfb20('0x5d'),_0xfb20('0x5e'),'secret',_0xfb20('0x5f')],'include':_0x2e4a49}];_0x9e7adc['push']({'model':db[_0xfb20('0x60')],'as':_0xfb20('0x61'),'attributes':['id','name']});_0x9e7adc['push']({'model':db[_0xfb20('0x56')],'as':_0xfb20('0x62'),'attributes':['id',_0xfb20('0x57')]});return db[_0xfb20('0x31')][_0xfb20('0x32')]({'where':{'id':_0x952fff[_0xfb20('0x25')]['id']},'include':_0x9e7adc})[_0xfb20('0x1a')](handleEntityNotFound(_0x17b4b9,null))['then'](function(_0x43bc87){if(_0x43bc87){var _0x485e03=_0x43bc87[_0xfb20('0x63')]({'plain':!![]});fs[_0xfb20('0x64')](_0x1c5d10);var _0x59b3bb={'channel':_0xfb20('0x65'),'account':_0x485e03[_0xfb20('0x61')]['name'],'agent':_0x485e03[_0xfb20('0x62')]?_0x485e03[_0xfb20('0x62')][_0xfb20('0x57')]:_0xfb20('0x66'),'createdAt':moment(_0x485e03[_0xfb20('0x5d')])[_0xfb20('0x45')](_0xfb20('0x67'))['toString'](),'closedAt':_0x485e03['closed']?moment(_0x485e03[_0xfb20('0x68')])['format'](_0xfb20('0x67'))[_0xfb20('0x51')]():'','disposition':_0x485e03[_0xfb20('0x69')],'messages':_(_0x485e03[_0xfb20('0x5c')])['filter']({'secret':![]})[_0xfb20('0x1e')](function(_0x4e2a37){return{'date':moment(_0x4e2a37[_0xfb20('0x5d')])[_0xfb20('0x45')](_0xfb20('0x67'))[_0xfb20('0x51')](),'sender':_0x4e2a37[_0xfb20('0x5e')]===_0xfb20('0x6a')?_0x4e2a37[_0xfb20('0x56')]?_0x4e2a37[_0xfb20('0x56')][_0xfb20('0x57')]:_0xfb20('0x6b'):_0x4e2a37['Contact'][_0xfb20('0x5a')]+(_0x4e2a37[_0xfb20('0x59')][_0xfb20('0x5b')]?'\x20'+_0x4e2a37[_0xfb20('0x59')][_0xfb20('0x5b')]:''),'body':_0x4e2a37[_0xfb20('0x34')],'direction':_0x4e2a37[_0xfb20('0x5e')]===_0xfb20('0x6a')?'A':'C','secret':_0x4e2a37[_0xfb20('0x6c')],'read':_0x4e2a37[_0xfb20('0x5f')]};})[_0xfb20('0x6d')]()};return ejs[_0xfb20('0x6e')](path[_0xfb20('0x52')](config[_0xfb20('0x6f')],_0xfb20('0x53'),_0xfb20('0x70'),_0xfb20('0x71')),{'interaction':_0x59b3bb})[_0xfb20('0x1a')](function(_0x109073){var _0x3de0d7=path['join'](_0x1c5d10,_0xfb20('0x72')+_0x485e03['id']+'-'+_0x28a508+_0xfb20('0x73'));var _0x39ed05={'path':_0x3de0d7,'channel':_0xfb20('0x65'),'interactionId':_0x485e03['id']};return pdf['createPdfFromHTML'](_0x109073,_0x39ed05);})['then'](function(){return new BPromise(function(_0x44aced,_0x1b5d84){zipdir(_0x1c5d10,{'saveTo':_0x44786a},function(_0x3837fb,_0x4302d1){if(_0x3837fb)return _0x1b5d84(_0x3837fb);return _0x44aced(_0x4302d1);});})[_0xfb20('0x1a')](function(){return new BPromise(function(_0x4a9e54,_0x1c12aa){rimraf(_0x1c5d10,function(_0x319bfb){if(_0x319bfb)_0x1c12aa(_0x319bfb);return _0x4a9e54();});});})[_0xfb20('0x1a')](function(){return _0x17b4b9[_0xfb20('0x4f')](_0x44786a,_0x324c3d,function(_0x2c7f52){if(_0x2c7f52){console[_0xfb20('0x74')](_0xfb20('0x75'),_0x2c7f52);}else{fs[_0xfb20('0x76')](_0x44786a);}});});});}else{return _0x17b4b9['sendStatus'](0xc8);}})[_0xfb20('0x23')](handleError(_0x17b4b9,null));}; \ No newline at end of file +var _0xa906=['format','YYYY-MM-DD\x20HH:mm:ss','disposition','out','System','Contact','value','renderFile','root','views','downloadInteraction.ejs','transcript-','Sms','createPdfFromHTML','log','rimraf','moment','path','ejs','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','defaults','socket.io-emitter','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','then','destroy','end','error','stack','name','send','index','map','fieldName','type','getOptions','findAll','sms','catch','show','params','model','rawAttributes','query','keys','filters','attributes','fields','length','merge','SmsInteraction','create','update','body','find','describe','SmsMessage','addMessage','omit','ids','getMessages','findOne','intersection','hasOwnProperty','nolimit','sort','where','pick','SmsInteractionId','filter','$gte','split','options','includeAll','include','rows','addTags','setTags','spread','Tag','color','emit','smsInteractionTags:save','removeTags','download','unix','toString','server','files','join','push','User','firstName','lastName','Messages','createdAt','direction','secret','read','SmsAccount','Account','Owner','fullname','get','mkdirSync'];(function(_0x248a99,_0x5839ed){var _0x53951a=function(_0xeafb48){while(--_0xeafb48){_0x248a99['push'](_0x248a99['shift']());}};_0x53951a(++_0x5839ed);}(_0xa906,0x1e3));var _0x6a90=function(_0x41490e,_0x5f4544){_0x41490e=_0x41490e-0x0;var _0x15ff7b=_0xa906[_0x41490e];return _0x15ff7b;};'use strict';var rimraf=require(_0x6a90('0x0'));var zipdir=require('zip-dir');var moment=require(_0x6a90('0x1'));var BPromise=require('bluebird');var util=require('util');var path=require(_0x6a90('0x2'));var ejs=require(_0x6a90('0x3'));var fs=require('fs');var _=require('lodash');var Redis=require('ioredis');var interaction=require(_0x6a90('0x4'));var qs=require(_0x6a90('0x5'));var pdf=require('../../components/export/pdf');var logger=require(_0x6a90('0x6'))(_0x6a90('0x7'));var config=require(_0x6a90('0x8'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x6a90('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x6a90('0xa'))(new Redis(config['redis']));require('./smsInteraction.socket')[_0x6a90('0xb')](socket);function respondWithStatusCode(_0xcb4021,_0x64531){_0x64531=_0x64531||0xcc;return function(_0x507e37){if(_0x507e37){return _0xcb4021[_0x6a90('0xc')](_0x64531);}return _0xcb4021[_0x6a90('0xd')](_0x64531)['end']();};}function respondWithResult(_0x42dc57,_0x957e6d){_0x957e6d=_0x957e6d||0xc8;return function(_0x4ddfdb){if(_0x4ddfdb){return _0x42dc57[_0x6a90('0xd')](_0x957e6d)[_0x6a90('0xe')](_0x4ddfdb);}};}function respondWithFilteredResult(_0x30b716,_0x58c7c7){return function(_0x3c0862){if(_0x3c0862){var _0x328b57=typeof _0x58c7c7[_0x6a90('0xf')]===_0x6a90('0x10')&&typeof _0x58c7c7[_0x6a90('0x11')]===_0x6a90('0x10');var _0x1d5d77=_0x3c0862[_0x6a90('0x12')];var _0x94a82c=_0x328b57?0x0:_0x58c7c7['offset'];var _0xf0c0ac=_0x328b57?_0x3c0862[_0x6a90('0x12')]:_0x58c7c7[_0x6a90('0xf')]+_0x58c7c7[_0x6a90('0x11')];var _0x38be60;if(_0xf0c0ac>=_0x1d5d77){_0xf0c0ac=_0x1d5d77;_0x38be60=0xc8;}else{_0x38be60=0xce;}_0x30b716[_0x6a90('0xd')](_0x38be60);return _0x30b716[_0x6a90('0x13')](_0x6a90('0x14'),_0x94a82c+'-'+_0xf0c0ac+'/'+_0x1d5d77)['json'](_0x3c0862);}return null;};}function saveUpdates(_0x4d70e3){return function(_0x64494c){if(_0x64494c){return _0x64494c['update'](_0x4d70e3)[_0x6a90('0x15')](function(_0x320ef8){return _0x320ef8;});}return null;};}function removeEntity(_0x554b16){return function(_0x3869ba){if(_0x3869ba){return _0x3869ba[_0x6a90('0x16')]()['then'](function(){_0x554b16[_0x6a90('0xd')](0xcc)[_0x6a90('0x17')]();});}};}function handleEntityNotFound(_0x1948aa){return function(_0x32697f){if(!_0x32697f){_0x1948aa[_0x6a90('0xc')](0x194);}return _0x32697f;};}function handleError(_0x2c471e,_0x186878){_0x186878=_0x186878||0x1f4;return function(_0x3236fe){logger[_0x6a90('0x18')](_0x3236fe[_0x6a90('0x19')]);if(_0x3236fe[_0x6a90('0x1a')]){delete _0x3236fe[_0x6a90('0x1a')];}_0x2c471e[_0x6a90('0xd')](_0x186878)[_0x6a90('0x1b')](_0x3236fe);};}exports[_0x6a90('0x1c')]=function(_0x175497,_0x2feda0){var _0x1023ae={};var _0x4cf74e=_[_0x6a90('0x1d')](db['SmsInteraction']['rawAttributes'],function(_0x37d6c4){return{'name':_0x37d6c4[_0x6a90('0x1e')],'type':_0x37d6c4[_0x6a90('0x1f')]['key']};});_0x1023ae=qs[_0x6a90('0x20')](_0x4cf74e,_0x175497);return interaction[_0x6a90('0x21')](_0x6a90('0x22'),_0x175497['query'],_0x175497['user'],_0x1023ae,_0x4cf74e)[_0x6a90('0x15')](respondWithFilteredResult(_0x2feda0,_0x1023ae))[_0x6a90('0x23')](handleError(_0x2feda0,null));};exports[_0x6a90('0x24')]=function(_0x57c12e,_0x3e908f){var _0x450716={'raw':![],'where':{'id':_0x57c12e[_0x6a90('0x25')]['id']}},_0xf9ba61={};_0xf9ba61[_0x6a90('0x26')]=_['keys'](db['SmsInteraction'][_0x6a90('0x27')]);_0xf9ba61[_0x6a90('0x28')]=_[_0x6a90('0x29')](_0x57c12e[_0x6a90('0x28')]);_0xf9ba61[_0x6a90('0x2a')]=_['intersection'](_0xf9ba61[_0x6a90('0x26')],_0xf9ba61[_0x6a90('0x28')]);_0x450716[_0x6a90('0x2b')]=_['intersection'](_0xf9ba61[_0x6a90('0x26')],qs[_0x6a90('0x2c')](_0x57c12e[_0x6a90('0x28')][_0x6a90('0x2c')]));_0x450716[_0x6a90('0x2b')]=_0x450716[_0x6a90('0x2b')][_0x6a90('0x2d')]?_0x450716['attributes']:_0xf9ba61[_0x6a90('0x26')];if(_0x57c12e[_0x6a90('0x28')]['includeAll']){_0x450716['include']=[{'all':!![]}];}_0x450716=_[_0x6a90('0x2e')]({},_0x450716,_0x57c12e['options']);return db['SmsInteraction']['find'](_0x450716)[_0x6a90('0x15')](handleEntityNotFound(_0x3e908f,null))[_0x6a90('0x15')](respondWithResult(_0x3e908f,null))['catch'](handleError(_0x3e908f,null));};exports['create']=function(_0x35c4c7,_0x12f2a3){return db[_0x6a90('0x2f')][_0x6a90('0x30')](_0x35c4c7['body'],{})[_0x6a90('0x15')](respondWithResult(_0x12f2a3,0xc9))[_0x6a90('0x23')](handleError(_0x12f2a3,null));};exports[_0x6a90('0x31')]=function(_0x2ec728,_0x942ec7){if(_0x2ec728['body']['id']){delete _0x2ec728[_0x6a90('0x32')]['id'];}return db[_0x6a90('0x2f')][_0x6a90('0x33')]({'where':{'id':_0x2ec728['params']['id']}})[_0x6a90('0x15')](handleEntityNotFound(_0x942ec7,null))[_0x6a90('0x15')](saveUpdates(_0x2ec728['body'],null))[_0x6a90('0x15')](respondWithResult(_0x942ec7,null))[_0x6a90('0x23')](handleError(_0x942ec7,null));};exports[_0x6a90('0x16')]=function(_0x3e305d,_0x251597){return db[_0x6a90('0x2f')][_0x6a90('0x33')]({'where':{'id':_0x3e305d[_0x6a90('0x25')]['id']}})[_0x6a90('0x15')](handleEntityNotFound(_0x251597,null))[_0x6a90('0x15')](removeEntity(_0x251597,null))[_0x6a90('0x23')](handleError(_0x251597,null));};exports[_0x6a90('0x34')]=function(_0x443476,_0x5c2870){return db[_0x6a90('0x2f')]['describe']()[_0x6a90('0x15')](respondWithResult(_0x5c2870,null))[_0x6a90('0x23')](handleError(_0x5c2870,null));};exports['addMessage']=function(_0x4a98b9,_0x482b02){return db[_0x6a90('0x35')][_0x6a90('0x33')]({'where':{'id':_0x4a98b9[_0x6a90('0x25')]['id']}})[_0x6a90('0x15')](handleEntityNotFound(_0x482b02,null))['then'](function(_0x4a5e5e){if(_0x4a5e5e){return _0x4a5e5e[_0x6a90('0x36')](_0x4a98b9['body']['ids'],_[_0x6a90('0x37')](_0x4a98b9[_0x6a90('0x32')],[_0x6a90('0x38'),'id'])||{});}})[_0x6a90('0x15')](respondWithResult(_0x482b02,null))[_0x6a90('0x23')](handleError(_0x482b02,null));};exports[_0x6a90('0x39')]=function(_0x3f19b8,_0xe9c40a){var _0x46e74e={'raw':![],'where':{}};var _0x34edb0={};var _0x429500={'count':0x0,'rows':[]};return db[_0x6a90('0x2f')][_0x6a90('0x3a')]({'where':{'id':_0x3f19b8['params']['id']}})['then'](handleEntityNotFound(_0xe9c40a,null))[_0x6a90('0x15')](function(_0x22825e){if(_0x22825e){_0x34edb0[_0x6a90('0x26')]=_['keys'](db[_0x6a90('0x35')][_0x6a90('0x27')]);_0x34edb0[_0x6a90('0x28')]=_[_0x6a90('0x29')](_0x3f19b8[_0x6a90('0x28')]);_0x34edb0['filters']=_[_0x6a90('0x3b')](_0x34edb0[_0x6a90('0x26')],_0x34edb0[_0x6a90('0x28')]);_0x46e74e[_0x6a90('0x2b')]=_[_0x6a90('0x3b')](_0x34edb0[_0x6a90('0x26')],qs[_0x6a90('0x2c')](_0x3f19b8['query']['fields']));_0x46e74e['attributes']=_0x46e74e[_0x6a90('0x2b')][_0x6a90('0x2d')]?_0x46e74e[_0x6a90('0x2b')]:_0x34edb0[_0x6a90('0x26')];if(!_0x3f19b8[_0x6a90('0x28')][_0x6a90('0x3c')](_0x6a90('0x3d'))){_0x46e74e[_0x6a90('0x11')]=qs['limit'](_0x3f19b8[_0x6a90('0x28')][_0x6a90('0x11')]);_0x46e74e['offset']=qs[_0x6a90('0xf')](_0x3f19b8[_0x6a90('0x28')][_0x6a90('0xf')]);}_0x46e74e['order']=qs[_0x6a90('0x3e')](_0x3f19b8[_0x6a90('0x28')][_0x6a90('0x3e')]);_0x46e74e[_0x6a90('0x3f')]=qs[_0x6a90('0x2a')](_[_0x6a90('0x40')](_0x3f19b8[_0x6a90('0x28')],_0x34edb0[_0x6a90('0x2a')]));_0x46e74e['where'][_0x6a90('0x41')]=_0x22825e['id'];if(_0x3f19b8[_0x6a90('0x28')][_0x6a90('0x42')]){_0x46e74e[_0x6a90('0x3f')]=_[_0x6a90('0x2e')](_0x46e74e['where'],{'$or':_['map'](_0x46e74e['attributes'],function(_0xf75112){var _0x44c9a9={};_0x44c9a9[_0xf75112]={'$like':'%'+_0x3f19b8[_0x6a90('0x28')][_0x6a90('0x42')]+'%'};return _0x44c9a9;})});}if(_0x3f19b8['query'][_0x6a90('0x43')]){var _0x51be2d=_0x3f19b8[_0x6a90('0x28')][_0x6a90('0x43')][_0x6a90('0x44')](',');var _0x4574cb={};_0x4574cb[_0x51be2d[0x0]]={'$gte':moment(_0x51be2d[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x46e74e[_0x6a90('0x3f')]=_[_0x6a90('0x2e')](_0x46e74e[_0x6a90('0x3f')],_0x4574cb);}_0x46e74e=_[_0x6a90('0x2e')]({},_0x46e74e,_0x3f19b8[_0x6a90('0x45')]);return db[_0x6a90('0x35')][_0x6a90('0x12')]({'where':_0x46e74e[_0x6a90('0x3f')]})[_0x6a90('0x15')](function(_0x33aa77){_0x429500[_0x6a90('0x12')]=_0x33aa77;if(_0x3f19b8[_0x6a90('0x28')][_0x6a90('0x46')]){_0x46e74e[_0x6a90('0x47')]=[{'all':!![]}];}return db[_0x6a90('0x35')][_0x6a90('0x21')](_0x46e74e);})[_0x6a90('0x15')](function(_0x44ffee){_0x429500[_0x6a90('0x48')]=_0x44ffee;return _0x429500;});}})[_0x6a90('0x15')](respondWithFilteredResult(_0xe9c40a,_0x46e74e))[_0x6a90('0x23')](handleError(_0xe9c40a,null));};exports[_0x6a90('0x49')]=function(_0x11ce7e,_0x1347ec){return db[_0x6a90('0x2f')]['find']({'where':{'id':_0x11ce7e[_0x6a90('0x25')]['id']}})['then'](handleEntityNotFound(_0x1347ec,null))[_0x6a90('0x15')](function(_0x127ea2){if(_0x127ea2){return _0x127ea2[_0x6a90('0x4a')](_0x11ce7e['body'][_0x6a90('0x38')],_[_0x6a90('0x37')](_0x11ce7e['body'],['ids','id'])||{})[_0x6a90('0x4b')](function(){return db[_0x6a90('0x4c')]['findAll']({'attributes':['id',_0x6a90('0x1a'),_0x6a90('0x4d')],'where':{'id':_0x11ce7e[_0x6a90('0x32')][_0x6a90('0x38')]}});})[_0x6a90('0x15')](function(_0x2f9c5f){socket[_0x6a90('0x4e')](_0x6a90('0x4f'),{'id':Number(_0x11ce7e[_0x6a90('0x25')]['id']),'tags':_0x2f9c5f||[]});return{'id':Number(_0x11ce7e[_0x6a90('0x25')]['id']),'tags':_0x2f9c5f||[]};});}})[_0x6a90('0x15')](respondWithResult(_0x1347ec,null))[_0x6a90('0x23')](handleError(_0x1347ec,null));};exports[_0x6a90('0x50')]=function(_0x43db2b,_0x2a0bd2){return db[_0x6a90('0x2f')]['find']({'where':{'id':_0x43db2b[_0x6a90('0x25')]['id']}})[_0x6a90('0x15')](handleEntityNotFound(_0x2a0bd2,null))[_0x6a90('0x15')](function(_0x529cb4){if(_0x529cb4){return _0x529cb4['removeTags'](_0x43db2b[_0x6a90('0x28')]['ids']);}})[_0x6a90('0x15')](respondWithStatusCode(_0x2a0bd2,null))[_0x6a90('0x23')](handleError(_0x2a0bd2,null));};exports[_0x6a90('0x51')]=function(_0x397b64,_0x1bff54){var _0x1b9ee6=moment()[_0x6a90('0x52')]()[_0x6a90('0x53')]();var _0x27d4bf=path['join'](config['root'],_0x6a90('0x54'),_0x6a90('0x55'),'tmp');var _0x16e82a=path[_0x6a90('0x56')](_0x27d4bf,_0x1b9ee6);var _0x2091e8=util['format']('transcript-%d-%s.zip',_0x397b64['params']['id'],_0x1b9ee6);var _0x5ae734=path[_0x6a90('0x56')](_0x27d4bf,_0x2091e8);var _0x4df14b=[];_0x4df14b[_0x6a90('0x57')]({'model':db[_0x6a90('0x58')],'as':_0x6a90('0x58'),'attributes':['id','fullname'],'raw':!![]});_0x4df14b['push']({'model':db['CmContact'],'as':'Contact','attributes':['id',_0x6a90('0x59'),_0x6a90('0x5a')],'raw':!![]});var _0x397d56=[{'model':db[_0x6a90('0x35')],'as':_0x6a90('0x5b'),'attributes':['id',_0x6a90('0x32'),_0x6a90('0x5c'),_0x6a90('0x5d'),_0x6a90('0x5e'),_0x6a90('0x5f')],'include':_0x4df14b}];_0x397d56['push']({'model':db[_0x6a90('0x60')],'as':_0x6a90('0x61'),'attributes':['id','name']});_0x397d56[_0x6a90('0x57')]({'model':db[_0x6a90('0x58')],'as':_0x6a90('0x62'),'attributes':['id',_0x6a90('0x63')]});return db[_0x6a90('0x2f')][_0x6a90('0x33')]({'where':{'id':_0x397b64[_0x6a90('0x25')]['id']},'include':_0x397d56})[_0x6a90('0x15')](handleEntityNotFound(_0x1bff54,null))['then'](function(_0x134f34){if(_0x134f34){var _0x118c33=_0x134f34[_0x6a90('0x64')]({'plain':!![]});fs[_0x6a90('0x65')](_0x16e82a);var _0x3249b5={'channel':'Sms','account':_0x118c33[_0x6a90('0x61')][_0x6a90('0x1a')],'agent':_0x118c33[_0x6a90('0x62')]?_0x118c33['Owner'][_0x6a90('0x63')]:'N.A.','createdAt':moment(_0x118c33[_0x6a90('0x5c')])[_0x6a90('0x66')](_0x6a90('0x67'))[_0x6a90('0x53')](),'closedAt':_0x118c33['closed']?moment(_0x118c33['closedAt'])['format'](_0x6a90('0x67'))[_0x6a90('0x53')]():'','disposition':_0x118c33[_0x6a90('0x68')],'messages':_(_0x118c33[_0x6a90('0x5b')])['filter']({'secret':![]})[_0x6a90('0x1d')](function(_0x5e9719){return{'date':moment(_0x5e9719[_0x6a90('0x5c')])['format'](_0x6a90('0x67'))['toString'](),'sender':_0x5e9719[_0x6a90('0x5d')]===_0x6a90('0x69')?_0x5e9719['User']?_0x5e9719['User']['fullname']:_0x6a90('0x6a'):_0x5e9719[_0x6a90('0x6b')][_0x6a90('0x59')]+(_0x5e9719[_0x6a90('0x6b')][_0x6a90('0x5a')]?'\x20'+_0x5e9719[_0x6a90('0x6b')][_0x6a90('0x5a')]:''),'body':_0x5e9719[_0x6a90('0x32')],'direction':_0x5e9719[_0x6a90('0x5d')]===_0x6a90('0x69')?'A':'C','secret':_0x5e9719[_0x6a90('0x5e')],'read':_0x5e9719[_0x6a90('0x5f')]};})[_0x6a90('0x6c')]()};return ejs[_0x6a90('0x6d')](path[_0x6a90('0x56')](config[_0x6a90('0x6e')],_0x6a90('0x54'),_0x6a90('0x6f'),_0x6a90('0x70')),{'interaction':_0x3249b5})[_0x6a90('0x15')](function(_0x8436c2){var _0x20c871=path['join'](_0x16e82a,_0x6a90('0x71')+_0x118c33['id']+'-'+_0x1b9ee6+'.pdf');var _0x45b50f={'path':_0x20c871,'channel':_0x6a90('0x72'),'interactionId':_0x118c33['id']};return pdf[_0x6a90('0x73')](_0x8436c2,_0x45b50f);})[_0x6a90('0x15')](function(){return new BPromise(function(_0x67bcd7,_0xe27086){zipdir(_0x16e82a,{'saveTo':_0x5ae734},function(_0x5df6b2,_0x3b7a64){if(_0x5df6b2)return _0xe27086(_0x5df6b2);return _0x67bcd7(_0x3b7a64);});})['then'](function(){return new BPromise(function(_0x274b4c,_0x62b64c){rimraf(_0x16e82a,function(_0x2d07fd){if(_0x2d07fd)_0x62b64c(_0x2d07fd);return _0x274b4c();});});})['then'](function(){return _0x1bff54[_0x6a90('0x51')](_0x5ae734,_0x2091e8,function(_0xd32605){if(_0xd32605){console[_0x6a90('0x74')]('err',_0xd32605);}else{fs['unlinkSync'](_0x5ae734);}});});});}else{return _0x1bff54[_0x6a90('0xc')](0xc8);}})[_0x6a90('0x23')](handleError(_0x1bff54,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 43a0a87..a1d51e3 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 _0x5eb8=['SmsInteraction','../../mysqldb','SmsMessage','setMaxListeners','save','update','remove','getUsers','setDataValue','Users','then','unreadMessages','length','emit','hasOwnProperty','hook'];(function(_0x3d5d36,_0x4c7a41){var _0x217498=function(_0x13d30e){while(--_0x13d30e){_0x3d5d36['push'](_0x3d5d36['shift']());}};_0x217498(++_0x4c7a41);}(_0x5eb8,0xb0));var _0x85eb=function(_0x3cd451,_0x26e81a){_0x3cd451=_0x3cd451-0x0;var _0x571ce6=_0x5eb8[_0x3cd451];return _0x571ce6;};'use strict';var EventEmitter=require('events');var SmsInteraction=require('../../mysqldb')['db'][_0x85eb('0x0')];var SmsMessage=require(_0x85eb('0x1'))['db'][_0x85eb('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x85eb('0x3')](0x0);var events={'afterCreate':_0x85eb('0x4'),'afterUpdate':_0x85eb('0x5'),'afterDestroy':_0x85eb('0x6')};function emitEvent(_0x44e313){return function(_0x3c5798,_0x1fde1a,_0x2bf83c){_0x3c5798[_0x85eb('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x16d7b9){_0x3c5798[_0x85eb('0x8')](_0x85eb('0x9'),_0x16d7b9['map'](function(_0x2da3b0){return{'id':_0x2da3b0['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x3c5798['id'],'direction':'in','read':![]},'raw':!![]});})[_0x85eb('0xa')](function(_0x40d6b6){_0x3c5798[_0x85eb('0x8')](_0x85eb('0xb'),_0x40d6b6[_0x85eb('0xc')]);SmsInteractionEvents[_0x85eb('0xd')](_0x44e313+':'+_0x3c5798['id'],_0x3c5798);SmsInteractionEvents[_0x85eb('0xd')](_0x44e313,_0x3c5798);_0x2bf83c(null);})['catch'](_0x2bf83c(null));};}for(var e in events){if(events[_0x85eb('0xe')](e)){var event=events[e];SmsInteraction[_0x85eb('0xf')](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file +var _0x32f4=['remove','setDataValue','map','findAll','then','unreadMessages','emit','catch','hook','exports','events','../../mysqldb','SmsInteraction','setMaxListeners','save'];(function(_0x21de95,_0x71ff49){var _0x8689ea=function(_0x3cfb56){while(--_0x3cfb56){_0x21de95['push'](_0x21de95['shift']());}};_0x8689ea(++_0x71ff49);}(_0x32f4,0x154));var _0x432f=function(_0x1df4dc,_0x16fdc1){_0x1df4dc=_0x1df4dc-0x0;var _0x3fff15=_0x32f4[_0x1df4dc];return _0x3fff15;};'use strict';var EventEmitter=require(_0x432f('0x0'));var SmsInteraction=require(_0x432f('0x1'))['db'][_0x432f('0x2')];var SmsMessage=require(_0x432f('0x1'))['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x432f('0x3')](0x0);var events={'afterCreate':_0x432f('0x4'),'afterUpdate':'update','afterDestroy':_0x432f('0x5')};function emitEvent(_0x1eabac){return function(_0x344a29,_0x355b02,_0x2f5f03){_0x344a29['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x2f66fd){_0x344a29[_0x432f('0x6')]('Users',_0x2f66fd[_0x432f('0x7')](function(_0x5aaf1a){return{'id':_0x5aaf1a['id']};}));return SmsMessage[_0x432f('0x8')]({'where':{'SmsInteractionId':_0x344a29['id'],'direction':'in','read':![]},'raw':!![]});})[_0x432f('0x9')](function(_0x3a0d4b){_0x344a29[_0x432f('0x6')](_0x432f('0xa'),_0x3a0d4b['length']);SmsInteractionEvents[_0x432f('0xb')](_0x1eabac+':'+_0x344a29['id'],_0x344a29);SmsInteractionEvents['emit'](_0x1eabac,_0x344a29);_0x2f5f03(null);})[_0x432f('0xc')](_0x2f5f03(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction[_0x432f('0xd')](e,emitEvent(event));}}module[_0x432f('0xe')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 8e1fd7e..0320a66 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 _0x367d=['../../config/environment','./smsInteraction.attributes','exports','define','SmsInteraction','sms_interactions','changed','closedAt','format','lodash','api','moment','request-promise','path','rimraf'];(function(_0xecc93b,_0xc0dab9){var _0x5b1795=function(_0x203244){while(--_0x203244){_0xecc93b['push'](_0xecc93b['shift']());}};_0x5b1795(++_0xc0dab9);}(_0x367d,0x108));var _0xd367=function(_0x1d4387,_0x3cb06a){_0x1d4387=_0x1d4387-0x0;var _0x5a991b=_0x367d[_0x1d4387];return _0x5a991b;};'use strict';var _=require(_0xd367('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd367('0x1'));var moment=require(_0xd367('0x2'));var BPromise=require('bluebird');var rp=require(_0xd367('0x3'));var fs=require('fs');var path=require(_0xd367('0x4'));var rimraf=require(_0xd367('0x5'));var config=require(_0xd367('0x6'));var attributes=require(_0xd367('0x7'));module[_0xd367('0x8')]=function(_0x207c6a,_0x14ace6){return _0x207c6a[_0xd367('0x9')](_0xd367('0xa'),attributes,{'tableName':_0xd367('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4418da,_0x136cd1,_0x440056){if(_0x4418da[_0xd367('0xc')]('closed')){_0x4418da[_0xd367('0xd')]=moment()[_0xd367('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x440056(null,_0x4418da);}}});}; \ No newline at end of file +var _0xc565=['closedAt','format','lodash','bluebird','request-promise','path','rimraf','./smsInteraction.attributes','exports','define','sms_interactions','changed','closed'];(function(_0x50564e,_0x47a578){var _0x77e80a=function(_0x298894){while(--_0x298894){_0x50564e['push'](_0x50564e['shift']());}};_0x77e80a(++_0x47a578);}(_0xc565,0x113));var _0x5c56=function(_0x2f716c,_0x27c610){_0x2f716c=_0x2f716c-0x0;var _0x14aad6=_0xc565[_0x2f716c];return _0x14aad6;};'use strict';var _=require(_0x5c56('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x5c56('0x1'));var rp=require(_0x5c56('0x2'));var fs=require('fs');var path=require(_0x5c56('0x3'));var rimraf=require(_0x5c56('0x4'));var config=require('../../config/environment');var attributes=require(_0x5c56('0x5'));module[_0x5c56('0x6')]=function(_0x5a77ff,_0x582507){return _0x5a77ff[_0x5c56('0x7')]('SmsInteraction',attributes,{'tableName':_0x5c56('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4a7cc5,_0x2d12b6,_0x45469f){if(_0x4a7cc5[_0x5c56('0x9')](_0x5c56('0xa'))){_0x4a7cc5[_0x5c56('0xb')]=moment()[_0x5c56('0xc')]('YYYY-MM-DD\x20HH:mm:ss');}_0x45469f(null,_0x4a7cc5);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 7aec921..9dc8b23 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 _0x5ca3=['update','body','options','raw','where','attributes','limit','stringify','catch','AddTagsToSmsInteraction','SmsInteraction','addTags','omit','ids','AddTags','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','request','then','info','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','error','code','SmsInteraction,\x20%s,\x20%s','message','UpdateSmsInteraction'];(function(_0x170cd2,_0x4df925){var _0x618743=function(_0x3315c4){while(--_0x3315c4){_0x170cd2['push'](_0x170cd2['shift']());}};_0x618743(++_0x4df925);}(_0x5ca3,0xbf));var _0x35ca=function(_0x1d8f23,_0x1d4573){_0x1d8f23=_0x1d8f23-0x0;var _0x9499d7=_0x5ca3[_0x1d8f23];return _0x9499d7;};'use strict';var _=require(_0x35ca('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x35ca('0x1'));var rs=require(_0x35ca('0x2'));var fs=require('fs');var Redis=require(_0x35ca('0x3'));var db=require(_0x35ca('0x4'))['db'];var utils=require(_0x35ca('0x5'));var logger=require(_0x35ca('0x6'))(_0x35ca('0x7'));var config=require(_0x35ca('0x8'));var jayson=require(_0x35ca('0x9'));var client=jayson[_0x35ca('0xa')][_0x35ca('0xb')]({'port':0x232a});config[_0x35ca('0xc')]=_[_0x35ca('0xd')](config['redis'],{'host':_0x35ca('0xe'),'port':0x18eb});var socket=require(_0x35ca('0xf'))(new Redis(config[_0x35ca('0xc')]));require(_0x35ca('0x10'))[_0x35ca('0x11')](socket);function respondWithRpcPromise(_0x290bc6,_0x2efae9,_0x382a6f){return new BPromise(function(_0x2b09f2,_0x1e6bcf){return client[_0x35ca('0x12')](_0x290bc6,_0x382a6f)[_0x35ca('0x13')](function(_0xb29dad){logger[_0x35ca('0x14')]('SmsInteraction,\x20%s,\x20%s',_0x2efae9,_0x35ca('0x15'));logger[_0x35ca('0x16')](_0x35ca('0x17'),_0x2efae9,_0x35ca('0x15'),JSON['stringify'](_0xb29dad));if(_0xb29dad[_0x35ca('0x18')]){if(_0xb29dad['error'][_0x35ca('0x19')]===0x1f4){logger[_0x35ca('0x18')](_0x35ca('0x1a'),_0x2efae9,_0xb29dad[_0x35ca('0x18')]['message']);return _0x1e6bcf(_0xb29dad['error'][_0x35ca('0x1b')]);}logger[_0x35ca('0x18')](_0x35ca('0x1a'),_0x2efae9,_0xb29dad[_0x35ca('0x18')]['message']);return _0x2b09f2(_0xb29dad['error'][_0x35ca('0x1b')]);}else{logger[_0x35ca('0x14')]('SmsInteraction,\x20%s,\x20%s',_0x2efae9,_0x35ca('0x15'));_0x2b09f2(_0xb29dad['result']['message']);}})['catch'](function(_0x5ebdb4){logger[_0x35ca('0x18')](_0x35ca('0x1a'),_0x2efae9,_0x5ebdb4);_0x1e6bcf(_0x5ebdb4);});});}exports[_0x35ca('0x1c')]=function(_0x5e69c2){var _0x280a5c=this;return new Promise(function(_0x3788a0,_0x57e539){return db['SmsInteraction'][_0x35ca('0x1d')](_0x5e69c2[_0x35ca('0x1e')],{'raw':_0x5e69c2[_0x35ca('0x1f')]?_0x5e69c2[_0x35ca('0x1f')][_0x35ca('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5e69c2[_0x35ca('0x1f')]?_0x5e69c2[_0x35ca('0x1f')][_0x35ca('0x21')]||null:null,'attributes':_0x5e69c2[_0x35ca('0x1f')]?_0x5e69c2[_0x35ca('0x1f')][_0x35ca('0x22')]||null:null,'limit':_0x5e69c2[_0x35ca('0x1f')]?_0x5e69c2[_0x35ca('0x1f')][_0x35ca('0x23')]||null:null})[_0x35ca('0x13')](function(_0x3384ac){logger[_0x35ca('0x14')]('UpdateSmsInteraction',_0x5e69c2);logger[_0x35ca('0x16')](_0x35ca('0x1c'),_0x5e69c2,JSON[_0x35ca('0x24')](_0x3384ac));_0x3788a0(_0x3384ac);})[_0x35ca('0x25')](function(_0x4ad0da){logger['error']('UpdateSmsInteraction',_0x4ad0da[_0x35ca('0x1b')],_0x5e69c2);_0x57e539(_0x280a5c[_0x35ca('0x18')](0x1f4,_0x4ad0da['message']));});});};exports[_0x35ca('0x26')]=function(_0x486994){return new Promise(function(_0x37ca02,_0x160260){return db[_0x35ca('0x27')]['find']({'where':_0x486994[_0x35ca('0x1f')]?_0x486994[_0x35ca('0x1f')]['where']||null:null})[_0x35ca('0x13')](function(_0x50e274){if(_0x50e274){return _0x50e274[_0x35ca('0x28')](_0x486994['body']['ids'],_[_0x35ca('0x29')](_0x486994[_0x35ca('0x1e')],[_0x35ca('0x2a'),'id'])||{});}})['spread'](function(_0x2961ea){logger[_0x35ca('0x14')](_0x35ca('0x2b'),_0x486994);logger['debug'](_0x35ca('0x2b'),_0x486994,JSON[_0x35ca('0x24')](_0x2961ea));_0x37ca02(_0x2961ea);})[_0x35ca('0x25')](function(_0x2a9408){logger[_0x35ca('0x18')](_0x35ca('0x2b'),_0x2a9408[_0x35ca('0x1b')],_0x486994);_0x160260(_this[_0x35ca('0x18')](0x1f4,_0x2a9408[_0x35ca('0x1b')]));});});}; \ No newline at end of file +var _0x86bf=['http','socket.io-emitter','redis','./smsInteraction.socket','request','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','UpdateSmsInteraction','SmsInteraction','update','options','raw','where','attributes','catch','AddTagsToSmsInteraction','addTags','omit','ids','spread','AddTags','stringify','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x42f629,_0x4cf69f){var _0x5339a1=function(_0x26ab3b){while(--_0x26ab3b){_0x42f629['push'](_0x42f629['shift']());}};_0x5339a1(++_0x4cf69f);}(_0x86bf,0x6c));var _0xf86b=function(_0x37afb6,_0x5c41ed){_0x37afb6=_0x37afb6-0x0;var _0x4f487f=_0x86bf[_0x37afb6];return _0x4f487f;};'use strict';var _=require(_0xf86b('0x0'));var util=require(_0xf86b('0x1'));var moment=require('moment');var BPromise=require(_0xf86b('0x2'));var rs=require(_0xf86b('0x3'));var fs=require('fs');var Redis=require(_0xf86b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf86b('0x5'));var logger=require('../../config/logger')(_0xf86b('0x6'));var config=require(_0xf86b('0x7'));var jayson=require(_0xf86b('0x8'));var client=jayson['client'][_0xf86b('0x9')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xf86b('0xa'))(new Redis(config[_0xf86b('0xb')]));require(_0xf86b('0xc'))['register'](socket);function respondWithRpcPromise(_0x1bf270,_0x2d59ad,_0x5964d8){return new BPromise(function(_0x591e7c,_0x501eb7){return client[_0xf86b('0xd')](_0x1bf270,_0x5964d8)[_0xf86b('0xe')](function(_0x4a856a){logger[_0xf86b('0xf')](_0xf86b('0x10'),_0x2d59ad,_0xf86b('0x11'));logger[_0xf86b('0x12')](_0xf86b('0x13'),_0x2d59ad,_0xf86b('0x11'),JSON['stringify'](_0x4a856a));if(_0x4a856a[_0xf86b('0x14')]){if(_0x4a856a['error'][_0xf86b('0x15')]===0x1f4){logger['error'](_0xf86b('0x10'),_0x2d59ad,_0x4a856a[_0xf86b('0x14')][_0xf86b('0x16')]);return _0x501eb7(_0x4a856a['error'][_0xf86b('0x16')]);}logger[_0xf86b('0x14')]('SmsInteraction,\x20%s,\x20%s',_0x2d59ad,_0x4a856a[_0xf86b('0x14')][_0xf86b('0x16')]);return _0x591e7c(_0x4a856a[_0xf86b('0x14')][_0xf86b('0x16')]);}else{logger[_0xf86b('0xf')](_0xf86b('0x10'),_0x2d59ad,_0xf86b('0x11'));_0x591e7c(_0x4a856a[_0xf86b('0x17')][_0xf86b('0x16')]);}})['catch'](function(_0x2b02de){logger[_0xf86b('0x14')](_0xf86b('0x10'),_0x2d59ad,_0x2b02de);_0x501eb7(_0x2b02de);});});}exports[_0xf86b('0x18')]=function(_0x3ce60e){var _0x459f60=this;return new Promise(function(_0x164368,_0x1dac2f){return db[_0xf86b('0x19')][_0xf86b('0x1a')](_0x3ce60e['body'],{'raw':_0x3ce60e[_0xf86b('0x1b')]?_0x3ce60e['options'][_0xf86b('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3ce60e[_0xf86b('0x1b')]?_0x3ce60e[_0xf86b('0x1b')][_0xf86b('0x1d')]||null:null,'attributes':_0x3ce60e['options']?_0x3ce60e[_0xf86b('0x1b')][_0xf86b('0x1e')]||null:null,'limit':_0x3ce60e['options']?_0x3ce60e['options']['limit']||null:null})[_0xf86b('0xe')](function(_0x2483e0){logger[_0xf86b('0xf')](_0xf86b('0x18'),_0x3ce60e);logger[_0xf86b('0x12')]('UpdateSmsInteraction',_0x3ce60e,JSON['stringify'](_0x2483e0));_0x164368(_0x2483e0);})[_0xf86b('0x1f')](function(_0x2e1771){logger['error'](_0xf86b('0x18'),_0x2e1771[_0xf86b('0x16')],_0x3ce60e);_0x1dac2f(_0x459f60[_0xf86b('0x14')](0x1f4,_0x2e1771[_0xf86b('0x16')]));});});};exports[_0xf86b('0x20')]=function(_0x278a82){return new Promise(function(_0x53380c,_0x40e209){return db['SmsInteraction']['find']({'where':_0x278a82[_0xf86b('0x1b')]?_0x278a82[_0xf86b('0x1b')][_0xf86b('0x1d')]||null:null})['then'](function(_0x4be915){if(_0x4be915){return _0x4be915[_0xf86b('0x21')](_0x278a82['body']['ids'],_[_0xf86b('0x22')](_0x278a82['body'],[_0xf86b('0x23'),'id'])||{});}})[_0xf86b('0x24')](function(_0x48134e){logger[_0xf86b('0xf')]('AddTags',_0x278a82);logger['debug'](_0xf86b('0x25'),_0x278a82,JSON[_0xf86b('0x26')](_0x48134e));_0x53380c(_0x48134e);})[_0xf86b('0x1f')](function(_0x2270c6){logger[_0xf86b('0x14')](_0xf86b('0x25'),_0x2270c6[_0xf86b('0x16')],_0x278a82);_0x40e209(_this[_0xf86b('0x14')](0x1f4,_0x2270c6[_0xf86b('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index f0638f5..a9cb4ee 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 _0xab17=['register','length','smsInteraction:','./smsInteraction.events','save','update','emit','removeListener'];(function(_0x4a7631,_0x2c85b9){var _0x1a5a6f=function(_0x1ee3fd){while(--_0x1ee3fd){_0x4a7631['push'](_0x4a7631['shift']());}};_0x1a5a6f(++_0x2c85b9);}(_0xab17,0x123));var _0x7ab1=function(_0xe626f,_0x1afb32){_0xe626f=_0xe626f-0x0;var _0x4d7b7a=_0xab17[_0xe626f];return _0x4d7b7a;};'use strict';var SmsInteractionEvents=require(_0x7ab1('0x0'));var events=[_0x7ab1('0x1'),'remove',_0x7ab1('0x2')];function createListener(_0x21a9fc,_0x507325){return function(_0x372c97){_0x507325[_0x7ab1('0x3')](_0x21a9fc,_0x372c97);};}function removeListener(_0x2ea01f,_0x1cc668){return function(){SmsInteractionEvents[_0x7ab1('0x4')](_0x2ea01f,_0x1cc668);};}exports[_0x7ab1('0x5')]=function(_0x8a7c04){for(var _0x45818b=0x0,_0xe9e5d0=events[_0x7ab1('0x6')];_0x45818b<_0xe9e5d0;_0x45818b++){var _0x56e75c=events[_0x45818b];var _0x2db21d=createListener(_0x7ab1('0x7')+_0x56e75c,_0x8a7c04);SmsInteractionEvents['on'](_0x56e75c,_0x2db21d);}}; \ No newline at end of file +var _0x325a=['removeListener','register','length','remove','update'];(function(_0x1b42e8,_0x4ef0d7){var _0x50b5b6=function(_0x377eec){while(--_0x377eec){_0x1b42e8['push'](_0x1b42e8['shift']());}};_0x50b5b6(++_0x4ef0d7);}(_0x325a,0x1d9));var _0xa325=function(_0x1d2bdf,_0x4c6f64){_0x1d2bdf=_0x1d2bdf-0x0;var _0x532c9f=_0x325a[_0x1d2bdf];return _0x532c9f;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=['save',_0xa325('0x0'),_0xa325('0x1')];function createListener(_0x3af9ea,_0xf793d){return function(_0x271930){_0xf793d['emit'](_0x3af9ea,_0x271930);};}function removeListener(_0x53dd75,_0x3d75c4){return function(){SmsInteractionEvents[_0xa325('0x2')](_0x53dd75,_0x3d75c4);};}exports[_0xa325('0x3')]=function(_0x2e2497){for(var _0x54abee=0x0,_0x5459bc=events[_0xa325('0x4')];_0x54abee<_0x5459bc;_0x54abee++){var _0x4083e1=events[_0x54abee];var _0x318b9b=createListener('smsInteraction:'+_0x4083e1,_0x2e2497);SmsInteractionEvents['on'](_0x4083e1,_0x318b9b);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index ed241ae..c3f7413 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 _0xcaa3=['show','post','tracked','sms','smsmessage:create','create','/:id/status','put','/:id/reject','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','/describe','/:id'];(function(_0x5beffd,_0x55e38c){var _0x4f4545=function(_0x5ef115){while(--_0x5ef115){_0x5beffd['push'](_0x5beffd['shift']());}};_0x4f4545(++_0x55e38c);}(_0xcaa3,0xcb));var _0x3caa=function(_0x17928f,_0x4ad33f){_0x17928f=_0x17928f-0x0;var _0x500b63=_0xcaa3[_0x17928f];return _0x500b63;};'use strict';var multer=require(_0x3caa('0x0'));var util=require(_0x3caa('0x1'));var path=require(_0x3caa('0x2'));var timeout=require(_0x3caa('0x3'));var express=require(_0x3caa('0x4'));var router=express[_0x3caa('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x3caa('0x6'));var config=require(_0x3caa('0x7'));var controller=require(_0x3caa('0x8'));router[_0x3caa('0x9')]('/',auth[_0x3caa('0xa')](),controller['index']);router[_0x3caa('0x9')](_0x3caa('0xb'),auth[_0x3caa('0xa')](),controller['describe']);router[_0x3caa('0x9')](_0x3caa('0xc'),auth[_0x3caa('0xa')](),controller[_0x3caa('0xd')]);router[_0x3caa('0xe')]('/',auth[_0x3caa('0xa')](),interaction[_0x3caa('0xf')](_0x3caa('0x10'),_0x3caa('0x11')),controller[_0x3caa('0x12')]);router[_0x3caa('0xe')](_0x3caa('0x13'),controller['status']);router['put'](_0x3caa('0xc'),auth[_0x3caa('0xa')](),controller['update']);router[_0x3caa('0x14')]('/:id/accept',auth[_0x3caa('0xa')](),controller['accept']);router[_0x3caa('0x14')](_0x3caa('0x15'),auth[_0x3caa('0xa')](),controller['reject']);router[_0x3caa('0x16')]('/:id',auth[_0x3caa('0xa')](),controller[_0x3caa('0x17')]);module['exports']=router; \ No newline at end of file +var _0xd125=['Router','../../components/auth/service','../../components/interaction/service','./smsMessage.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','tracked','sms','smsmessage:create','create','/:id/status','status','update','put','/:id/accept','accept','/:id/reject','reject','delete','destroy','util','path','connect-timeout','express'];(function(_0x4aa8da,_0x319dcc){var _0x309596=function(_0x29da82){while(--_0x29da82){_0x4aa8da['push'](_0x4aa8da['shift']());}};_0x309596(++_0x319dcc);}(_0xd125,0x92));var _0x5d12=function(_0x49f229,_0x192c6c){_0x49f229=_0x49f229-0x0;var _0x46a80a=_0xd125[_0x49f229];return _0x46a80a;};'use strict';var multer=require('multer');var util=require(_0x5d12('0x0'));var path=require(_0x5d12('0x1'));var timeout=require(_0x5d12('0x2'));var express=require(_0x5d12('0x3'));var router=express[_0x5d12('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x5d12('0x5'));var interaction=require(_0x5d12('0x6'));var config=require('../../config/environment');var controller=require(_0x5d12('0x7'));router['get']('/',auth[_0x5d12('0x8')](),controller[_0x5d12('0x9')]);router[_0x5d12('0xa')](_0x5d12('0xb'),auth[_0x5d12('0x8')](),controller[_0x5d12('0xc')]);router['get'](_0x5d12('0xd'),auth['isAuthenticated'](),controller[_0x5d12('0xe')]);router[_0x5d12('0xf')]('/',auth[_0x5d12('0x8')](),interaction[_0x5d12('0x10')](_0x5d12('0x11'),_0x5d12('0x12')),controller[_0x5d12('0x13')]);router[_0x5d12('0xf')](_0x5d12('0x14'),controller[_0x5d12('0x15')]);router['put']('/:id',auth[_0x5d12('0x8')](),controller[_0x5d12('0x16')]);router[_0x5d12('0x17')](_0x5d12('0x18'),auth[_0x5d12('0x8')](),controller[_0x5d12('0x19')]);router[_0x5d12('0x17')](_0x5d12('0x1a'),auth[_0x5d12('0x8')](),controller[_0x5d12('0x1b')]);router[_0x5d12('0x1c')](_0x5d12('0xd'),auth[_0x5d12('0x8')](),controller[_0x5d12('0x1d')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 41f8328..7b1b0d4 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 _0xb2fa=['medium','BOOLEAN','ENUM','out','STRING','DATE','sequelize','exports'];(function(_0x1f505d,_0x4c031d){var _0x4ecc55=function(_0x1002fd){while(--_0x1002fd){_0x1f505d['push'](_0x1f505d['shift']());}};_0x4ecc55(++_0x4c031d);}(_0xb2fa,0x1de));var _0xab2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xb2fa[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xab2f('0x0'));module[_0xab2f('0x1')]={'body':{'type':Sequelize['TEXT'](_0xab2f('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xab2f('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xab2f('0x4')]('in',_0xab2f('0x5')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0xab2f('0x6')]},'readAt':{'type':Sequelize[_0xab2f('0x7')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0xab2f('0x6')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x7024=['DATE','sequelize','TEXT','medium','BOOLEAN','ENUM','out','STRING'];(function(_0x9fe2ce,_0x2d44f4){var _0x2e74a2=function(_0x526230){while(--_0x526230){_0x9fe2ce['push'](_0x9fe2ce['shift']());}};_0x2e74a2(++_0x2d44f4);}(_0x7024,0xa1));var _0x4702=function(_0x52ead4,_0x3f876b){_0x52ead4=_0x52ead4-0x0;var _0x43c4d8=_0x7024[_0x52ead4];return _0x43c4d8;};'use strict';var Sequelize=require(_0x4702('0x0'));module['exports']={'body':{'type':Sequelize[_0x4702('0x1')](_0x4702('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x4702('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x4702('0x4')]('in',_0x4702('0x5')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x4702('0x6')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x4702('0x7')]},'secret':{'type':Sequelize[_0x4702('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x4702('0x1')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index dc4fed5..de13917 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 _0x0561=['role','RejectMessage','rejectMessage','contact','User','email','event','rejectmessage','SmsAccount','SmsAccountId','SmsMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','messageId','indexOf','sent','delivered','Status','plivio','infobip','results','groupName','DELIVERED','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','http','client','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','end','status','json','offset','undefined','limit','count','apply','reject','update','destroy','sendStatus','stack','name','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','SmsMessage','include','show','fields','includeAll','find','create','body','params','describe','../../config/logger','sms-interactions','accept','read','readAt','UserId','user','agent','get','SmsInteraction','SmsInteractionId','format','YYYY-MM-DD\x20HH:mm:ss','interaction','[SMSMESSAGE: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','QueryTypes','SELECT','fullname','internal','interface','channel','motionChannel','EventManager','sms','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0561,0x1e4));var _0x1056=function(_0x5d8022,_0x4c24b8){_0x5d8022=_0x5d8022-0x0;var _0x4eb1d4=_0x0561[_0x5d8022];return _0x4eb1d4;};'use strict';var emlformat=require(_0x1056('0x0'));var rimraf=require(_0x1056('0x1'));var zipdir=require(_0x1056('0x2'));var jsonpatch=require(_0x1056('0x3'));var rp=require('request-promise');var moment=require(_0x1056('0x4'));var BPromise=require(_0x1056('0x5'));var Mustache=require('mustache');var util=require(_0x1056('0x6'));var path=require(_0x1056('0x7'));var sox=require(_0x1056('0x8'));var csv=require(_0x1056('0x9'));var ejs=require(_0x1056('0xa'));var fs=require('fs');var fs_extra=require(_0x1056('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x1056('0xc'));var jsforce=require(_0x1056('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x1056('0x9'));var querystring=require(_0x1056('0xe'));var Papa=require(_0x1056('0xf'));var Redis=require(_0x1056('0x10'));var authService=require(_0x1056('0x11'));var qs=require(_0x1056('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1056('0x13'));var logger=require('../../config/logger')(_0x1056('0x14'));var utils=require(_0x1056('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1056('0x16'));var db=require(_0x1056('0x17'))['db'];config['redis']=_[_0x1056('0x18')](config[_0x1056('0x19')],{'host':_0x1056('0x1a'),'port':0x18eb});var socket=require(_0x1056('0x1b'))(new Redis(config[_0x1056('0x19')]));require(_0x1056('0x1c'))[_0x1056('0x1d')](socket);var jayson=require(_0x1056('0x1e'));var client=jayson['client'][_0x1056('0x1f')]({'port':0x232c});var client9002=jayson[_0x1056('0x20')][_0x1056('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x3fce72,_0x1e4fdf,_0x28b2a4,_0x2843e2){return new BPromise(function(_0x19458d,_0x177a88){var _0x47c54a=_0x2843e2||client;return _0x47c54a[_0x1056('0x21')](_0x3fce72,_0x28b2a4)[_0x1056('0x22')](function(_0x12b2b4){logger[_0x1056('0x23')](_0x1056('0x24'),_0x1e4fdf,_0x1056('0x25'));logger[_0x1056('0x26')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1e4fdf,'request\x20sent',JSON[_0x1056('0x27')](_0x12b2b4));if(_0x12b2b4[_0x1056('0x28')]){if(_0x12b2b4[_0x1056('0x28')][_0x1056('0x29')]===0x1f4){logger[_0x1056('0x28')](_0x1056('0x24'),_0x1e4fdf,_0x12b2b4[_0x1056('0x28')][_0x1056('0x2a')]);return _0x177a88(_0x12b2b4[_0x1056('0x28')][_0x1056('0x2a')]);}logger[_0x1056('0x28')]('SmsMessage,\x20%s,\x20%s',_0x1e4fdf,_0x12b2b4[_0x1056('0x28')][_0x1056('0x2a')]);return _0x19458d(_0x12b2b4[_0x1056('0x28')][_0x1056('0x2a')]);}else{logger['info'](_0x1056('0x24'),_0x1e4fdf,'request\x20sent');_0x19458d(_0x12b2b4[_0x1056('0x2b')][_0x1056('0x2a')]);}})[_0x1056('0x2c')](function(_0x5464f6){logger[_0x1056('0x28')]('SmsMessage,\x20%s,\x20%s',_0x1e4fdf,_0x5464f6);_0x177a88(_0x5464f6);});});}function respondWithStatusCode(_0x33bb13,_0x8444b){_0x8444b=_0x8444b||0xcc;return function(_0xe7cfa0){if(_0xe7cfa0){return _0x33bb13['sendStatus'](_0x8444b);}return _0x33bb13['status'](_0x8444b)[_0x1056('0x2d')]();};}function respondWithResult(_0xe89ddf,_0x15c06e){_0x15c06e=_0x15c06e||0xc8;return function(_0x92217e){if(_0x92217e){return _0xe89ddf[_0x1056('0x2e')](_0x15c06e)[_0x1056('0x2f')](_0x92217e);}};}function respondWithFilteredResult(_0x242a75,_0xf058eb){return function(_0x1434ce){if(_0x1434ce){var _0x146732=typeof _0xf058eb[_0x1056('0x30')]===_0x1056('0x31')&&typeof _0xf058eb[_0x1056('0x32')]===_0x1056('0x31');var _0x345b78=_0x1434ce[_0x1056('0x33')];var _0x316dd7=_0x146732?0x0:_0xf058eb[_0x1056('0x30')];var _0x27d593=_0x146732?_0x1434ce['count']:_0xf058eb[_0x1056('0x30')]+_0xf058eb[_0x1056('0x32')];var _0x3b0600;if(_0x27d593>=_0x345b78){_0x27d593=_0x345b78;_0x3b0600=0xc8;}else{_0x3b0600=0xce;}_0x242a75[_0x1056('0x2e')](_0x3b0600);return _0x242a75['set']('Content-Range',_0x316dd7+'-'+_0x27d593+'/'+_0x345b78)[_0x1056('0x2f')](_0x1434ce);}return null;};}function patchUpdates(_0x25020e){return function(_0x3d3f90){try{jsonpatch[_0x1056('0x34')](_0x3d3f90,_0x25020e,!![]);}catch(_0x469825){return BPromise[_0x1056('0x35')](_0x469825);}return _0x3d3f90['save']();};}function saveUpdates(_0x378cdf,_0x9faef1){return function(_0x14054f){if(_0x14054f){return _0x14054f[_0x1056('0x36')](_0x378cdf)['then'](function(_0x1ec9a1){return _0x1ec9a1;});}return null;};}function removeEntity(_0x46fc5f,_0xb82cf8){return function(_0x1506da){if(_0x1506da){return _0x1506da[_0x1056('0x37')]()['then'](function(){_0x46fc5f['status'](0xcc)[_0x1056('0x2d')]();});}};}function handleEntityNotFound(_0x20d057,_0x2aa16e){return function(_0x14f525){if(!_0x14f525){_0x20d057[_0x1056('0x38')](0x194);}return _0x14f525;};}function handleError(_0x352cde,_0x5d2173){_0x5d2173=_0x5d2173||0x1f4;return function(_0x3a2f5a){logger['error'](_0x3a2f5a[_0x1056('0x39')]);if(_0x3a2f5a[_0x1056('0x3a')]){delete _0x3a2f5a[_0x1056('0x3a')];}_0x352cde[_0x1056('0x2e')](_0x5d2173)['send'](_0x3a2f5a);};}exports[_0x1056('0x3b')]=function(_0x421531,_0x1c5d68){var _0x2aa700={},_0x966ae5={},_0x27885a={'count':0x0,'rows':[]};var _0x52ba8f=_[_0x1056('0x3c')](db['SmsMessage'][_0x1056('0x3d')],function(_0x1c32a5){return{'name':_0x1c32a5[_0x1056('0x3e')],'type':_0x1c32a5[_0x1056('0x3f')][_0x1056('0x40')]};});_0x966ae5['model']=_[_0x1056('0x3c')](_0x52ba8f,_0x1056('0x3a'));_0x966ae5[_0x1056('0x41')]=_[_0x1056('0x42')](_0x421531['query']);_0x966ae5[_0x1056('0x43')]=_[_0x1056('0x44')](_0x966ae5[_0x1056('0x45')],_0x966ae5[_0x1056('0x41')]);_0x2aa700[_0x1056('0x46')]=_[_0x1056('0x44')](_0x966ae5['model'],qs['fields'](_0x421531[_0x1056('0x41')]['fields']));_0x2aa700['attributes']=_0x2aa700[_0x1056('0x46')][_0x1056('0x47')]?_0x2aa700[_0x1056('0x46')]:_0x966ae5[_0x1056('0x45')];if(!_0x421531[_0x1056('0x41')][_0x1056('0x48')](_0x1056('0x49'))){_0x2aa700['limit']=qs['limit'](_0x421531[_0x1056('0x41')][_0x1056('0x32')]);_0x2aa700[_0x1056('0x30')]=qs[_0x1056('0x30')](_0x421531[_0x1056('0x41')][_0x1056('0x30')]);}_0x2aa700[_0x1056('0x4a')]=qs[_0x1056('0x4b')](_0x421531[_0x1056('0x41')]['sort']);_0x2aa700['where']=qs[_0x1056('0x43')](_[_0x1056('0x4c')](_0x421531[_0x1056('0x41')],_0x966ae5[_0x1056('0x43')]),_0x52ba8f);if(_0x421531[_0x1056('0x41')][_0x1056('0x4d')]){_0x2aa700['where']=_[_0x1056('0x4e')](_0x2aa700[_0x1056('0x4f')],{'$or':_[_0x1056('0x3c')](_0x52ba8f,function(_0x248528){if(_0x248528[_0x1056('0x3f')]!==_0x1056('0x50')){var _0x1f8e5a={};_0x1f8e5a[_0x248528['name']]={'$like':'%'+_0x421531[_0x1056('0x41')][_0x1056('0x4d')]+'%'};return _0x1f8e5a;}})});}_0x2aa700=_['merge']({},_0x2aa700,_0x421531[_0x1056('0x51')]);var _0x454c19={'where':_0x2aa700[_0x1056('0x4f')]};return db[_0x1056('0x52')]['count'](_0x454c19)[_0x1056('0x22')](function(_0x2a2548){_0x27885a[_0x1056('0x33')]=_0x2a2548;if(_0x421531[_0x1056('0x41')]['includeAll']){_0x2aa700[_0x1056('0x53')]=[{'all':!![]}];}return db[_0x1056('0x52')]['findAll'](_0x2aa700);})[_0x1056('0x22')](function(_0xd902eb){_0x27885a['rows']=_0xd902eb;return _0x27885a;})[_0x1056('0x22')](respondWithFilteredResult(_0x1c5d68,_0x2aa700))[_0x1056('0x2c')](handleError(_0x1c5d68,null));};exports[_0x1056('0x54')]=function(_0x5c75f2,_0x4aa309){var _0x49b5e2={'raw':!![],'where':{'id':_0x5c75f2['params']['id']}},_0x30340d={};_0x30340d['model']=_[_0x1056('0x42')](db[_0x1056('0x52')]['rawAttributes']);_0x30340d[_0x1056('0x41')]=_[_0x1056('0x42')](_0x5c75f2['query']);_0x30340d[_0x1056('0x43')]=_[_0x1056('0x44')](_0x30340d[_0x1056('0x45')],_0x30340d[_0x1056('0x41')]);_0x49b5e2[_0x1056('0x46')]=_[_0x1056('0x44')](_0x30340d['model'],qs[_0x1056('0x55')](_0x5c75f2[_0x1056('0x41')]['fields']));_0x49b5e2['attributes']=_0x49b5e2[_0x1056('0x46')][_0x1056('0x47')]?_0x49b5e2[_0x1056('0x46')]:_0x30340d[_0x1056('0x45')];if(_0x5c75f2[_0x1056('0x41')][_0x1056('0x56')]){_0x49b5e2['include']=[{'all':!![]}];}_0x49b5e2=_[_0x1056('0x4e')]({},_0x49b5e2,_0x5c75f2[_0x1056('0x51')]);return db[_0x1056('0x52')][_0x1056('0x57')](_0x49b5e2)['then'](handleEntityNotFound(_0x4aa309,null))[_0x1056('0x22')](respondWithResult(_0x4aa309,null))[_0x1056('0x2c')](handleError(_0x4aa309,null));};exports[_0x1056('0x58')]=function(_0x3d1a0d,_0x256e6a){return db[_0x1056('0x52')][_0x1056('0x58')](_0x3d1a0d[_0x1056('0x59')],{})['then'](respondWithResult(_0x256e6a,0xc9))[_0x1056('0x2c')](handleError(_0x256e6a,null));};exports[_0x1056('0x36')]=function(_0x239ef4,_0x49eae6){if(_0x239ef4['body']['id']){delete _0x239ef4[_0x1056('0x59')]['id'];}return db['SmsMessage']['find']({'where':{'id':_0x239ef4[_0x1056('0x5a')]['id']}})[_0x1056('0x22')](handleEntityNotFound(_0x49eae6,null))[_0x1056('0x22')](saveUpdates(_0x239ef4[_0x1056('0x59')],null))[_0x1056('0x22')](respondWithResult(_0x49eae6,null))[_0x1056('0x2c')](handleError(_0x49eae6,null));};exports['destroy']=function(_0x54593c,_0x18b388){return db[_0x1056('0x52')][_0x1056('0x57')]({'where':{'id':_0x54593c[_0x1056('0x5a')]['id']}})[_0x1056('0x22')](handleEntityNotFound(_0x18b388,null))[_0x1056('0x22')](removeEntity(_0x18b388,null))[_0x1056('0x2c')](handleError(_0x18b388,null));};exports[_0x1056('0x5b')]=function(_0x43c0e5,_0x25ec94){return db['SmsMessage'][_0x1056('0x5b')]()[_0x1056('0x22')](respondWithResult(_0x25ec94,null))[_0x1056('0x2c')](handleError(_0x25ec94,null));};var interaction_log=require(_0x1056('0x5c'))(_0x1056('0x5d'));exports[_0x1056('0x5e')]=function(_0x31700e,_0x5b5ddf,_0x5e797f){var _0x4a1642={'agent':{},'channel':'sms'};if(_0x31700e[_0x1056('0x59')]['id']){delete _0x31700e[_0x1056('0x59')]['id'];}_0x31700e[_0x1056('0x59')][_0x1056('0x5f')]=!![];_0x31700e[_0x1056('0x59')][_0x1056('0x60')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x31700e[_0x1056('0x59')][_0x1056('0x61')]=_0x31700e[_0x1056('0x59')][_0x1056('0x61')]||_0x31700e[_0x1056('0x62')]['id'];_0x4a1642[_0x1056('0x63')]['id']=_0x31700e[_0x1056('0x59')][_0x1056('0x61')];return db[_0x1056('0x52')][_0x1056('0x57')]({'where':{'id':_0x31700e[_0x1056('0x5a')]['id'],'UserId':null}})[_0x1056('0x22')](handleEntityNotFound(_0x5b5ddf,null))[_0x1056('0x22')](saveUpdates(_0x31700e[_0x1056('0x59')],null))['then'](function(_0x1efa92){if(_0x1efa92){_0x4a1642[_0x1056('0x2a')]=_0x1efa92[_0x1056('0x64')]({'plain':!![]});return db[_0x1056('0x65')][_0x1056('0x57')]({'where':{'id':_0x1efa92[_0x1056('0x66')]}});}return null;})[_0x1056('0x22')](handleEntityNotFound(_0x5b5ddf,null))[_0x1056('0x22')](function(_0x5e1096){if(_0x5e1096){return _0x5e1096[_0x1056('0x36')]({'UserId':_0x31700e[_0x1056('0x59')][_0x1056('0x61')],'read1stAt':_['isNil'](_0x5e1096['read1stAt'])?moment()[_0x1056('0x67')](_0x1056('0x68')):undefined});}return null;})[_0x1056('0x22')](function(_0x364824){if(_0x364824){_0x4a1642[_0x1056('0x69')]=_0x364824['get']({'plain':!![]});interaction_log[_0x1056('0x23')](_0x1056('0x6a'),_0x31700e[_0x1056('0x62')]['id'],_0x31700e[_0x1056('0x62')][_0x1056('0x3a')],_0x31700e[_0x1056('0x62')]['role'],_0x4a1642['interaction']['id'],_0x31700e[_0x1056('0x59')]?JSON['stringify'](_0x31700e[_0x1056('0x59')]):_0x1056('0x6b'));return respondWithRpcPromise(_0x1056('0x6c'),_0x1056('0x6d'),_0x4a1642);}return null;})[_0x1056('0x22')](function(_0x1c4833){var _0x51ea9b=_0x1056('0x6e')+_0x1c4833[_0x1056('0x2a')][_0x1056('0x6f')];return db[_0x1056('0x70')][_0x1056('0x41')](_0x51ea9b,{'type':db[_0x1056('0x71')][_0x1056('0x72')][_0x1056('0x73')],'raw':!![]})['then'](function(_0x3c99e1){return _0x3c99e1;});})[_0x1056('0x22')](function(_0x1f3cfd){if(_0x1f3cfd){_0x4a1642[_0x1056('0x2a')]['contact']=_0x1f3cfd[0x0];if(!_0x31700e['body'][_0x1056('0x61')])return;return db['User'][_0x1056('0x57')]({'where':{'id':_0x31700e[_0x1056('0x59')][_0x1056('0x61')],'role':_0x1056('0x63')},'attributes':['id',_0x1056('0x3a'),_0x1056('0x74'),'email',_0x1056('0x75')],'raw':!![]});}return null;})['then'](function(_0x398d26){if(!_0x398d26)return null;_0x4a1642[_0x1056('0x2a')][_0x1056('0x63')]=_0x398d26;return _0x4a1642;})['then'](function(_0x564cf4){if(_0x564cf4){if(_0x31700e[_0x1056('0x59')]['manual']){_0x4a1642['message'][_0x1056('0x76')]=util[_0x1056('0x67')]('SIP/%s',_0x31700e[_0x1056('0x62')][_0x1056('0x3a')]);_0x4a1642[_0x1056('0x2a')][_0x1056('0x77')]=_0x4a1642['channel'];_0x4a1642[_0x1056('0x2a')][_0x1056('0x78')]=_0x4a1642['channel'];_0x4a1642['message']['event']='accept';return respondWithRpcPromise(_0x1056('0x79'),_0x1056('0x79'),{'event':'acceptmessage','message':_0x4a1642[_0x1056('0x2a')]},client9002)['then'](function(){return _0x4a1642;});}return _0x4a1642;}return null;})[_0x1056('0x22')](respondWithResult(_0x5b5ddf,null))[_0x1056('0x2c')](handleError(_0x5b5ddf,null));};var interaction_log=require(_0x1056('0x5c'))(_0x1056('0x5d'));exports[_0x1056('0x35')]=function(_0x226d84,_0xa8ec5a,_0x8214d8){var _0x36fef1={'agent':{},'channel':_0x1056('0x7a')};if(_0x226d84[_0x1056('0x59')]['id']){delete _0x226d84[_0x1056('0x59')]['id'];}_0x226d84[_0x1056('0x59')]['UserId']=_0x226d84['body'][_0x1056('0x61')]||_0x226d84['user']['id'];_0x36fef1[_0x1056('0x63')]['id']=_0x226d84[_0x1056('0x59')][_0x1056('0x61')];return db[_0x1056('0x52')]['find']({'where':{'id':_0x226d84[_0x1056('0x5a')]['id'],'UserId':null}})[_0x1056('0x22')](handleEntityNotFound(_0xa8ec5a,null))['then'](function(_0x2eb219){if(_0x2eb219){_0x36fef1[_0x1056('0x2a')]=_0x2eb219[_0x1056('0x64')]({'plain':!![]});return db[_0x1056('0x65')]['find']({'where':{'id':_0x2eb219['SmsInteractionId']}});}return null;})['then'](handleEntityNotFound(_0xa8ec5a,null))[_0x1056('0x22')](function(_0x589e){if(_0x589e){_0x36fef1[_0x1056('0x69')]=_0x589e[_0x1056('0x64')]({'plain':!![]});interaction_log[_0x1056('0x23')](_0x1056('0x7b'),_0x226d84[_0x1056('0x62')]['id'],_0x226d84[_0x1056('0x62')]['name'],_0x226d84[_0x1056('0x62')][_0x1056('0x7c')],_0x36fef1[_0x1056('0x69')]['id'],_0x226d84[_0x1056('0x59')]?JSON[_0x1056('0x27')](_0x226d84[_0x1056('0x59')]):'null');return respondWithRpcPromise(_0x1056('0x7d'),_0x1056('0x7e'),_0x36fef1);}return null;})[_0x1056('0x22')](function(_0x103c66){var _0x13aead=_0x1056('0x6e')+_0x103c66['message'][_0x1056('0x6f')];return db[_0x1056('0x70')]['query'](_0x13aead,{'type':db[_0x1056('0x71')]['QueryTypes'][_0x1056('0x73')],'raw':!![]})[_0x1056('0x22')](function(_0x4971b5){return _0x4971b5;});})[_0x1056('0x22')](function(_0x396b3e){if(_0x396b3e){_0x36fef1['message'][_0x1056('0x7f')]=_0x396b3e[0x0];if(!_0x226d84[_0x1056('0x59')][_0x1056('0x61')])return;return db[_0x1056('0x80')][_0x1056('0x57')]({'where':{'id':_0x226d84[_0x1056('0x59')][_0x1056('0x61')],'role':_0x1056('0x63')},'attributes':['id',_0x1056('0x3a'),_0x1056('0x74'),_0x1056('0x81'),_0x1056('0x75')],'raw':!![]});}return null;})[_0x1056('0x22')](function(_0x1f329a){if(!_0x1f329a)return null;_0x36fef1[_0x1056('0x2a')]['agent']=_0x1f329a;return _0x36fef1;})[_0x1056('0x22')](function(_0x27654c){if(_0x27654c){_0x27654c['message']['interface']=util['format']('SIP/%s',_0x226d84[_0x1056('0x62')][_0x1056('0x3a')]);_0x27654c[_0x1056('0x2a')][_0x1056('0x77')]=_0x36fef1[_0x1056('0x77')];_0x27654c[_0x1056('0x2a')]['motionChannel']=_0x36fef1[_0x1056('0x77')];_0x27654c['message'][_0x1056('0x82')]=_0x1056('0x35');respondWithRpcPromise(_0x1056('0x79'),_0x1056('0x79'),{'event':_0x1056('0x83'),'message':_0x27654c[_0x1056('0x2a')]},client9002);return _0x36fef1;}return null;})[_0x1056('0x22')](respondWithResult(_0xa8ec5a,null))[_0x1056('0x2c')](handleError(_0xa8ec5a,null));};exports[_0x1056('0x2e')]=function(_0x4d9bad,_0x3ef995,_0x1e051e){if(_0x4d9bad[_0x1056('0x59')]['id']){delete _0x4d9bad[_0x1056('0x59')]['id'];}var _0x515b85;return db[_0x1056('0x52')]['find']({'where':{'id':_0x4d9bad[_0x1056('0x5a')]['id']}})[_0x1056('0x22')](handleEntityNotFound(_0x3ef995,null))[_0x1056('0x22')](function(_0x54633f){if(_0x54633f){_0x515b85=_0x54633f;return db[_0x1056('0x84')][_0x1056('0x57')]({'where':{'id':_0x54633f[_0x1056('0x85')]}});}})['then'](handleEntityNotFound(_0x3ef995,null))[_0x1056('0x22')](function(_0x448bad){if(_0x448bad){logger[_0x1056('0x26')](_0x1056('0x86'),_0x1056('0x2e'),_0x1056('0x87'),_0x448bad['type'],util[_0x1056('0x88')](_0x4d9bad['body'],{'showHidden':![],'depth':null}));switch(_0x448bad[_0x1056('0x3f')]){case _0x1056('0x89'):if(_0x4d9bad[_0x1056('0x59')][_0x1056('0x8a')]&&_0x4d9bad[_0x1056('0x59')]['MessageSid']===_0x515b85['messageId']){return _0x515b85[_0x1056('0x36')]({'read':!![]});}else{logger['error'](_0x1056('0x8b'),_0x1056('0x2e'),_0x1056('0x89'),util[_0x1056('0x88')](_0x4d9bad[_0x1056('0x59')],{'showHidden':![],'depth':null}));}break;case _0x1056('0x8c'):if(_0x4d9bad[_0x1056('0x59')][_0x1056('0x8d')]&&_0x4d9bad[_0x1056('0x59')][_0x1056('0x8d')]===_0x515b85[_0x1056('0x8e')]&&_[_0x1056('0x8f')]([_0x1056('0x90'),_0x1056('0x91')],_0x4d9bad[_0x1056('0x59')][_0x1056('0x92')])>=0x0){return _0x515b85[_0x1056('0x36')]({'read':!![]});}else{logger[_0x1056('0x28')](_0x1056('0x8b'),_0x1056('0x2e'),_0x1056('0x93'),util[_0x1056('0x88')](_0x4d9bad[_0x1056('0x59')],{'showHidden':![],'depth':null}));}break;case _0x1056('0x94'):var _0x5a72e0=_0x4d9bad[_0x1056('0x59')][_0x1056('0x95')][0x0];if(_0x5a72e0[_0x1056('0x2e')][_0x1056('0x96')]===_0x1056('0x97')){return _0x515b85[_0x1056('0x36')]({'read':!![]});}else{logger[_0x1056('0x28')](_0x1056('0x8b'),_0x1056('0x2e'),_0x1056('0x94'),util[_0x1056('0x88')](_0x4d9bad[_0x1056('0x59')],{'showHidden':![],'depth':null}));}break;}return _0x515b85;}})['then'](respondWithResult(_0x3ef995,null))[_0x1056('0x2c')](handleError(_0x3ef995,null));}; \ No newline at end of file +var _0x0d64=['QueryTypes','SELECT','contact','User','internal','manual','SIP/%s','channel','motionChannel','event','acceptmessage','reject','SmsInteraction','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','rejectMessage','interface','EventManager','rejectmessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','sent','infobip','groupName','DELIVERED','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','register','jayson/promise','client','http','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','offset','undefined','count','limit','set','Content-Range','apply','save','update','destroy','end','name','index','SmsMessage','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','merge','where','options','includeAll','include','findAll','rows','show','params','find','create','body','describe','sms-interactions','accept','readAt','format','UserId','user','agent','get','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize'];(function(_0x2a2a98,_0x55087a){var _0x27e6ba=function(_0x4e6675){while(--_0x4e6675){_0x2a2a98['push'](_0x2a2a98['shift']());}};_0x27e6ba(++_0x55087a);}(_0x0d64,0xad));var _0x40d6=function(_0x535fc2,_0x823367){_0x535fc2=_0x535fc2-0x0;var _0x22c8a3=_0x0d64[_0x535fc2];return _0x22c8a3;};'use strict';var emlformat=require(_0x40d6('0x0'));var rimraf=require(_0x40d6('0x1'));var zipdir=require(_0x40d6('0x2'));var jsonpatch=require(_0x40d6('0x3'));var rp=require('request-promise');var moment=require(_0x40d6('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x40d6('0x5'));var util=require(_0x40d6('0x6'));var path=require(_0x40d6('0x7'));var sox=require(_0x40d6('0x8'));var csv=require(_0x40d6('0x9'));var ejs=require(_0x40d6('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x40d6('0xb'));var squel=require(_0x40d6('0xc'));var crypto=require(_0x40d6('0xd'));var jsforce=require(_0x40d6('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x40d6('0x9'));var querystring=require(_0x40d6('0xf'));var Papa=require(_0x40d6('0x10'));var Redis=require('ioredis');var authService=require(_0x40d6('0x11'));var qs=require(_0x40d6('0x12'));var as=require(_0x40d6('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x40d6('0x14'))('api');var utils=require(_0x40d6('0x15'));var config=require(_0x40d6('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x40d6('0x17'))['db'];config[_0x40d6('0x18')]=_[_0x40d6('0x19')](config[_0x40d6('0x18')],{'host':_0x40d6('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./smsMessage.socket')[_0x40d6('0x1b')](socket);var jayson=require(_0x40d6('0x1c'));var client=jayson[_0x40d6('0x1d')][_0x40d6('0x1e')]({'port':0x232c});var client9002=jayson[_0x40d6('0x1d')][_0x40d6('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x34d57b,_0x357a92,_0x32aca8,_0x716315){return new BPromise(function(_0x4092f3,_0x1ca626){var _0x30b23d=_0x716315||client;return _0x30b23d[_0x40d6('0x1f')](_0x34d57b,_0x32aca8)[_0x40d6('0x20')](function(_0x368c70){logger[_0x40d6('0x21')](_0x40d6('0x22'),_0x357a92,_0x40d6('0x23'));logger[_0x40d6('0x24')](_0x40d6('0x25'),_0x357a92,_0x40d6('0x23'),JSON[_0x40d6('0x26')](_0x368c70));if(_0x368c70[_0x40d6('0x27')]){if(_0x368c70[_0x40d6('0x27')]['code']===0x1f4){logger[_0x40d6('0x27')]('SmsMessage,\x20%s,\x20%s',_0x357a92,_0x368c70['error']['message']);return _0x1ca626(_0x368c70[_0x40d6('0x27')][_0x40d6('0x28')]);}logger['error'](_0x40d6('0x22'),_0x357a92,_0x368c70['error'][_0x40d6('0x28')]);return _0x4092f3(_0x368c70[_0x40d6('0x27')]['message']);}else{logger[_0x40d6('0x21')](_0x40d6('0x22'),_0x357a92,_0x40d6('0x23'));_0x4092f3(_0x368c70[_0x40d6('0x29')][_0x40d6('0x28')]);}})[_0x40d6('0x2a')](function(_0x38cd4d){logger[_0x40d6('0x27')](_0x40d6('0x22'),_0x357a92,_0x38cd4d);_0x1ca626(_0x38cd4d);});});}function respondWithStatusCode(_0x27c524,_0x55be54){_0x55be54=_0x55be54||0xcc;return function(_0x5395bc){if(_0x5395bc){return _0x27c524[_0x40d6('0x2b')](_0x55be54);}return _0x27c524[_0x40d6('0x2c')](_0x55be54)['end']();};}function respondWithResult(_0xc5d8ee,_0x3136c5){_0x3136c5=_0x3136c5||0xc8;return function(_0x45c521){if(_0x45c521){return _0xc5d8ee[_0x40d6('0x2c')](_0x3136c5)['json'](_0x45c521);}};}function respondWithFilteredResult(_0x4ddb86,_0x5491f0){return function(_0x5142eb){if(_0x5142eb){var _0x3670f7=typeof _0x5491f0[_0x40d6('0x2d')]===_0x40d6('0x2e')&&typeof _0x5491f0['limit']===_0x40d6('0x2e');var _0x4623bf=_0x5142eb[_0x40d6('0x2f')];var _0x21f5c9=_0x3670f7?0x0:_0x5491f0[_0x40d6('0x2d')];var _0x3947ac=_0x3670f7?_0x5142eb[_0x40d6('0x2f')]:_0x5491f0[_0x40d6('0x2d')]+_0x5491f0[_0x40d6('0x30')];var _0x494342;if(_0x3947ac>=_0x4623bf){_0x3947ac=_0x4623bf;_0x494342=0xc8;}else{_0x494342=0xce;}_0x4ddb86[_0x40d6('0x2c')](_0x494342);return _0x4ddb86[_0x40d6('0x31')](_0x40d6('0x32'),_0x21f5c9+'-'+_0x3947ac+'/'+_0x4623bf)['json'](_0x5142eb);}return null;};}function patchUpdates(_0x376341){return function(_0x4d7a36){try{jsonpatch[_0x40d6('0x33')](_0x4d7a36,_0x376341,!![]);}catch(_0x3359bb){return BPromise['reject'](_0x3359bb);}return _0x4d7a36[_0x40d6('0x34')]();};}function saveUpdates(_0x281050,_0x45f7b4){return function(_0x17faf3){if(_0x17faf3){return _0x17faf3[_0x40d6('0x35')](_0x281050)[_0x40d6('0x20')](function(_0x4410d3){return _0x4410d3;});}return null;};}function removeEntity(_0x139a00,_0x4311c8){return function(_0x24fcb8){if(_0x24fcb8){return _0x24fcb8[_0x40d6('0x36')]()[_0x40d6('0x20')](function(){_0x139a00['status'](0xcc)[_0x40d6('0x37')]();});}};}function handleEntityNotFound(_0x81ac83,_0x5a2747){return function(_0x3232c2){if(!_0x3232c2){_0x81ac83[_0x40d6('0x2b')](0x194);}return _0x3232c2;};}function handleError(_0x1b1d05,_0x501dc1){_0x501dc1=_0x501dc1||0x1f4;return function(_0x23f4d7){logger[_0x40d6('0x27')](_0x23f4d7['stack']);if(_0x23f4d7[_0x40d6('0x38')]){delete _0x23f4d7[_0x40d6('0x38')];}_0x1b1d05[_0x40d6('0x2c')](_0x501dc1)['send'](_0x23f4d7);};}exports[_0x40d6('0x39')]=function(_0x1c5168,_0x8d7c47){var _0x25ff08={},_0x223287={},_0x2f5b65={'count':0x0,'rows':[]};var _0x74e435=_['map'](db[_0x40d6('0x3a')][_0x40d6('0x3b')],function(_0x49519a){return{'name':_0x49519a[_0x40d6('0x3c')],'type':_0x49519a[_0x40d6('0x3d')]['key']};});_0x223287[_0x40d6('0x3e')]=_[_0x40d6('0x3f')](_0x74e435,_0x40d6('0x38'));_0x223287[_0x40d6('0x40')]=_[_0x40d6('0x41')](_0x1c5168[_0x40d6('0x40')]);_0x223287[_0x40d6('0x42')]=_[_0x40d6('0x43')](_0x223287['model'],_0x223287[_0x40d6('0x40')]);_0x25ff08[_0x40d6('0x44')]=_[_0x40d6('0x43')](_0x223287['model'],qs[_0x40d6('0x45')](_0x1c5168[_0x40d6('0x40')][_0x40d6('0x45')]));_0x25ff08[_0x40d6('0x44')]=_0x25ff08[_0x40d6('0x44')][_0x40d6('0x46')]?_0x25ff08['attributes']:_0x223287[_0x40d6('0x3e')];if(!_0x1c5168[_0x40d6('0x40')][_0x40d6('0x47')](_0x40d6('0x48'))){_0x25ff08[_0x40d6('0x30')]=qs['limit'](_0x1c5168[_0x40d6('0x40')][_0x40d6('0x30')]);_0x25ff08[_0x40d6('0x2d')]=qs[_0x40d6('0x2d')](_0x1c5168['query'][_0x40d6('0x2d')]);}_0x25ff08['order']=qs[_0x40d6('0x49')](_0x1c5168[_0x40d6('0x40')]['sort']);_0x25ff08['where']=qs[_0x40d6('0x42')](_[_0x40d6('0x4a')](_0x1c5168[_0x40d6('0x40')],_0x223287['filters']),_0x74e435);if(_0x1c5168['query'][_0x40d6('0x4b')]){_0x25ff08['where']=_[_0x40d6('0x4c')](_0x25ff08[_0x40d6('0x4d')],{'$or':_[_0x40d6('0x3f')](_0x74e435,function(_0x28414f){if(_0x28414f['type']!=='VIRTUAL'){var _0x21a675={};_0x21a675[_0x28414f[_0x40d6('0x38')]]={'$like':'%'+_0x1c5168[_0x40d6('0x40')]['filter']+'%'};return _0x21a675;}})});}_0x25ff08=_[_0x40d6('0x4c')]({},_0x25ff08,_0x1c5168[_0x40d6('0x4e')]);var _0x50a80a={'where':_0x25ff08['where']};return db[_0x40d6('0x3a')][_0x40d6('0x2f')](_0x50a80a)[_0x40d6('0x20')](function(_0x1e8f21){_0x2f5b65['count']=_0x1e8f21;if(_0x1c5168[_0x40d6('0x40')][_0x40d6('0x4f')]){_0x25ff08[_0x40d6('0x50')]=[{'all':!![]}];}return db[_0x40d6('0x3a')][_0x40d6('0x51')](_0x25ff08);})['then'](function(_0x8746c8){_0x2f5b65[_0x40d6('0x52')]=_0x8746c8;return _0x2f5b65;})[_0x40d6('0x20')](respondWithFilteredResult(_0x8d7c47,_0x25ff08))[_0x40d6('0x2a')](handleError(_0x8d7c47,null));};exports[_0x40d6('0x53')]=function(_0x3bb2e5,_0x271542){var _0x36ba34={'raw':!![],'where':{'id':_0x3bb2e5[_0x40d6('0x54')]['id']}},_0x567b86={};_0x567b86[_0x40d6('0x3e')]=_[_0x40d6('0x41')](db[_0x40d6('0x3a')]['rawAttributes']);_0x567b86[_0x40d6('0x40')]=_[_0x40d6('0x41')](_0x3bb2e5[_0x40d6('0x40')]);_0x567b86[_0x40d6('0x42')]=_[_0x40d6('0x43')](_0x567b86[_0x40d6('0x3e')],_0x567b86[_0x40d6('0x40')]);_0x36ba34['attributes']=_[_0x40d6('0x43')](_0x567b86['model'],qs[_0x40d6('0x45')](_0x3bb2e5[_0x40d6('0x40')][_0x40d6('0x45')]));_0x36ba34[_0x40d6('0x44')]=_0x36ba34['attributes'][_0x40d6('0x46')]?_0x36ba34[_0x40d6('0x44')]:_0x567b86['model'];if(_0x3bb2e5[_0x40d6('0x40')][_0x40d6('0x4f')]){_0x36ba34[_0x40d6('0x50')]=[{'all':!![]}];}_0x36ba34=_[_0x40d6('0x4c')]({},_0x36ba34,_0x3bb2e5[_0x40d6('0x4e')]);return db[_0x40d6('0x3a')][_0x40d6('0x55')](_0x36ba34)['then'](handleEntityNotFound(_0x271542,null))['then'](respondWithResult(_0x271542,null))[_0x40d6('0x2a')](handleError(_0x271542,null));};exports['create']=function(_0x482a8c,_0x3bad4c){return db[_0x40d6('0x3a')][_0x40d6('0x56')](_0x482a8c[_0x40d6('0x57')],{})[_0x40d6('0x20')](respondWithResult(_0x3bad4c,0xc9))[_0x40d6('0x2a')](handleError(_0x3bad4c,null));};exports['update']=function(_0x56ef68,_0x252705){if(_0x56ef68[_0x40d6('0x57')]['id']){delete _0x56ef68[_0x40d6('0x57')]['id'];}return db[_0x40d6('0x3a')][_0x40d6('0x55')]({'where':{'id':_0x56ef68['params']['id']}})['then'](handleEntityNotFound(_0x252705,null))[_0x40d6('0x20')](saveUpdates(_0x56ef68[_0x40d6('0x57')],null))['then'](respondWithResult(_0x252705,null))[_0x40d6('0x2a')](handleError(_0x252705,null));};exports[_0x40d6('0x36')]=function(_0x534a73,_0x5e1ac9){return db['SmsMessage'][_0x40d6('0x55')]({'where':{'id':_0x534a73[_0x40d6('0x54')]['id']}})[_0x40d6('0x20')](handleEntityNotFound(_0x5e1ac9,null))['then'](removeEntity(_0x5e1ac9,null))[_0x40d6('0x2a')](handleError(_0x5e1ac9,null));};exports['describe']=function(_0x44ab1f,_0x1310ca){return db[_0x40d6('0x3a')][_0x40d6('0x58')]()[_0x40d6('0x20')](respondWithResult(_0x1310ca,null))['catch'](handleError(_0x1310ca,null));};var interaction_log=require(_0x40d6('0x14'))(_0x40d6('0x59'));exports[_0x40d6('0x5a')]=function(_0x431bcf,_0x241e11,_0x136cef){var _0x3d3fba={'agent':{},'channel':'sms'};if(_0x431bcf['body']['id']){delete _0x431bcf[_0x40d6('0x57')]['id'];}_0x431bcf[_0x40d6('0x57')]['read']=!![];_0x431bcf[_0x40d6('0x57')][_0x40d6('0x5b')]=moment()[_0x40d6('0x5c')]('YYYY-MM-DD\x20HH:mm:ss');_0x431bcf[_0x40d6('0x57')][_0x40d6('0x5d')]=_0x431bcf[_0x40d6('0x57')]['UserId']||_0x431bcf[_0x40d6('0x5e')]['id'];_0x3d3fba[_0x40d6('0x5f')]['id']=_0x431bcf[_0x40d6('0x57')][_0x40d6('0x5d')];return db[_0x40d6('0x3a')][_0x40d6('0x55')]({'where':{'id':_0x431bcf[_0x40d6('0x54')]['id'],'UserId':null}})[_0x40d6('0x20')](handleEntityNotFound(_0x241e11,null))[_0x40d6('0x20')](saveUpdates(_0x431bcf[_0x40d6('0x57')],null))[_0x40d6('0x20')](function(_0x471d55){if(_0x471d55){_0x3d3fba[_0x40d6('0x28')]=_0x471d55[_0x40d6('0x60')]({'plain':!![]});return db['SmsInteraction'][_0x40d6('0x55')]({'where':{'id':_0x471d55['SmsInteractionId']}});}return null;})[_0x40d6('0x20')](handleEntityNotFound(_0x241e11,null))[_0x40d6('0x20')](function(_0x16b37a){if(_0x16b37a){return _0x16b37a[_0x40d6('0x35')]({'UserId':_0x431bcf[_0x40d6('0x57')][_0x40d6('0x5d')],'read1stAt':_['isNil'](_0x16b37a[_0x40d6('0x61')])?moment()[_0x40d6('0x5c')](_0x40d6('0x62')):undefined});}return null;})['then'](function(_0x3c1ae0){if(_0x3c1ae0){_0x3d3fba['interaction']=_0x3c1ae0[_0x40d6('0x60')]({'plain':!![]});interaction_log['info']('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x431bcf['user']['id'],_0x431bcf[_0x40d6('0x5e')][_0x40d6('0x38')],_0x431bcf[_0x40d6('0x5e')]['role'],_0x3d3fba[_0x40d6('0x63')]['id'],_0x431bcf['body']?JSON[_0x40d6('0x26')](_0x431bcf[_0x40d6('0x57')]):_0x40d6('0x64'));return respondWithRpcPromise(_0x40d6('0x65'),_0x40d6('0x66'),_0x3d3fba);}return null;})['then'](function(_0x80e7da){var _0x5b259a=_0x40d6('0x67')+_0x80e7da[_0x40d6('0x28')][_0x40d6('0x68')];return db[_0x40d6('0x69')][_0x40d6('0x40')](_0x5b259a,{'type':db[_0x40d6('0x6a')][_0x40d6('0x6b')][_0x40d6('0x6c')],'raw':!![]})[_0x40d6('0x20')](function(_0x20e3f7){return _0x20e3f7;});})[_0x40d6('0x20')](function(_0x5c321c){if(_0x5c321c){_0x3d3fba['message'][_0x40d6('0x6d')]=_0x5c321c[0x0];if(!_0x431bcf['body'][_0x40d6('0x5d')])return;return db[_0x40d6('0x6e')][_0x40d6('0x55')]({'where':{'id':_0x431bcf[_0x40d6('0x57')]['UserId'],'role':_0x40d6('0x5f')},'attributes':['id',_0x40d6('0x38'),'fullname','email',_0x40d6('0x6f')],'raw':!![]});}return null;})['then'](function(_0x4d8f28){if(!_0x4d8f28)return null;_0x3d3fba['message']['agent']=_0x4d8f28;return _0x3d3fba;})[_0x40d6('0x20')](function(_0x52d4dc){if(_0x52d4dc){if(_0x431bcf[_0x40d6('0x57')][_0x40d6('0x70')]){_0x3d3fba['message']['interface']=util[_0x40d6('0x5c')](_0x40d6('0x71'),_0x431bcf[_0x40d6('0x5e')][_0x40d6('0x38')]);_0x3d3fba['message'][_0x40d6('0x72')]=_0x3d3fba[_0x40d6('0x72')];_0x3d3fba[_0x40d6('0x28')][_0x40d6('0x73')]=_0x3d3fba[_0x40d6('0x72')];_0x3d3fba[_0x40d6('0x28')][_0x40d6('0x74')]='accept';return respondWithRpcPromise('EventManager','EventManager',{'event':_0x40d6('0x75'),'message':_0x3d3fba[_0x40d6('0x28')]},client9002)[_0x40d6('0x20')](function(){return _0x3d3fba;});}return _0x3d3fba;}return null;})['then'](respondWithResult(_0x241e11,null))[_0x40d6('0x2a')](handleError(_0x241e11,null));};var interaction_log=require(_0x40d6('0x14'))(_0x40d6('0x59'));exports[_0x40d6('0x76')]=function(_0x106d2a,_0x4afc7c,_0x6a3736){var _0x4528b1={'agent':{},'channel':'sms'};if(_0x106d2a[_0x40d6('0x57')]['id']){delete _0x106d2a['body']['id'];}_0x106d2a[_0x40d6('0x57')]['UserId']=_0x106d2a[_0x40d6('0x57')]['UserId']||_0x106d2a['user']['id'];_0x4528b1[_0x40d6('0x5f')]['id']=_0x106d2a[_0x40d6('0x57')]['UserId'];return db['SmsMessage']['find']({'where':{'id':_0x106d2a['params']['id'],'UserId':null}})[_0x40d6('0x20')](handleEntityNotFound(_0x4afc7c,null))[_0x40d6('0x20')](function(_0x23bf5c){if(_0x23bf5c){_0x4528b1[_0x40d6('0x28')]=_0x23bf5c[_0x40d6('0x60')]({'plain':!![]});return db[_0x40d6('0x77')][_0x40d6('0x55')]({'where':{'id':_0x23bf5c['SmsInteractionId']}});}return null;})[_0x40d6('0x20')](handleEntityNotFound(_0x4afc7c,null))[_0x40d6('0x20')](function(_0x470869){if(_0x470869){_0x4528b1[_0x40d6('0x63')]=_0x470869[_0x40d6('0x60')]({'plain':!![]});interaction_log[_0x40d6('0x21')](_0x40d6('0x78'),_0x106d2a['user']['id'],_0x106d2a[_0x40d6('0x5e')]['name'],_0x106d2a[_0x40d6('0x5e')][_0x40d6('0x79')],_0x4528b1['interaction']['id'],_0x106d2a[_0x40d6('0x57')]?JSON[_0x40d6('0x26')](_0x106d2a['body']):_0x40d6('0x64'));return respondWithRpcPromise('RejectMessage',_0x40d6('0x7a'),_0x4528b1);}return null;})[_0x40d6('0x20')](function(_0x5f1d9b){var _0x27eb81=_0x40d6('0x67')+_0x5f1d9b[_0x40d6('0x28')][_0x40d6('0x68')];return db[_0x40d6('0x69')][_0x40d6('0x40')](_0x27eb81,{'type':db[_0x40d6('0x6a')]['QueryTypes'][_0x40d6('0x6c')],'raw':!![]})[_0x40d6('0x20')](function(_0x452436){return _0x452436;});})[_0x40d6('0x20')](function(_0x1b264c){if(_0x1b264c){_0x4528b1[_0x40d6('0x28')][_0x40d6('0x6d')]=_0x1b264c[0x0];if(!_0x106d2a['body'][_0x40d6('0x5d')])return;return db[_0x40d6('0x6e')][_0x40d6('0x55')]({'where':{'id':_0x106d2a[_0x40d6('0x57')][_0x40d6('0x5d')],'role':_0x40d6('0x5f')},'attributes':['id','name','fullname','email','internal'],'raw':!![]});}return null;})[_0x40d6('0x20')](function(_0x553ad0){if(!_0x553ad0)return null;_0x4528b1[_0x40d6('0x28')][_0x40d6('0x5f')]=_0x553ad0;return _0x4528b1;})[_0x40d6('0x20')](function(_0x288693){if(_0x288693){_0x288693[_0x40d6('0x28')][_0x40d6('0x7b')]=util[_0x40d6('0x5c')](_0x40d6('0x71'),_0x106d2a[_0x40d6('0x5e')][_0x40d6('0x38')]);_0x288693[_0x40d6('0x28')][_0x40d6('0x72')]=_0x4528b1[_0x40d6('0x72')];_0x288693[_0x40d6('0x28')]['motionChannel']=_0x4528b1[_0x40d6('0x72')];_0x288693[_0x40d6('0x28')][_0x40d6('0x74')]=_0x40d6('0x76');respondWithRpcPromise(_0x40d6('0x7c'),'EventManager',{'event':_0x40d6('0x7d'),'message':_0x288693[_0x40d6('0x28')]},client9002);return _0x4528b1;}return null;})['then'](respondWithResult(_0x4afc7c,null))[_0x40d6('0x2a')](handleError(_0x4afc7c,null));};exports[_0x40d6('0x2c')]=function(_0x4e1264,_0x5a78d2,_0x235db0){if(_0x4e1264[_0x40d6('0x57')]['id']){delete _0x4e1264[_0x40d6('0x57')]['id'];}var _0x11862a;return db['SmsMessage'][_0x40d6('0x55')]({'where':{'id':_0x4e1264[_0x40d6('0x54')]['id']}})[_0x40d6('0x20')](handleEntityNotFound(_0x5a78d2,null))[_0x40d6('0x20')](function(_0x1db7da){if(_0x1db7da){_0x11862a=_0x1db7da;return db[_0x40d6('0x7e')]['find']({'where':{'id':_0x1db7da[_0x40d6('0x7f')]}});}})['then'](handleEntityNotFound(_0x5a78d2,null))[_0x40d6('0x20')](function(_0xe1cbe0){if(_0xe1cbe0){logger[_0x40d6('0x24')](_0x40d6('0x25'),_0x40d6('0x2c'),_0x40d6('0x80'),_0xe1cbe0['type'],util[_0x40d6('0x81')](_0x4e1264[_0x40d6('0x57')],{'showHidden':![],'depth':null}));switch(_0xe1cbe0[_0x40d6('0x3d')]){case _0x40d6('0x82'):if(_0x4e1264[_0x40d6('0x57')][_0x40d6('0x83')]&&_0x4e1264[_0x40d6('0x57')]['MessageSid']===_0x11862a[_0x40d6('0x84')]){return _0x11862a['update']({'read':!![]});}else{logger['error'](_0x40d6('0x85'),_0x40d6('0x2c'),_0x40d6('0x82'),util[_0x40d6('0x81')](_0x4e1264[_0x40d6('0x57')],{'showHidden':![],'depth':null}));}break;case _0x40d6('0x86'):if(_0x4e1264['body'][_0x40d6('0x87')]&&_0x4e1264['body'][_0x40d6('0x87')]===_0x11862a[_0x40d6('0x84')]&&_['indexOf']([_0x40d6('0x88'),'delivered'],_0x4e1264[_0x40d6('0x57')]['Status'])>=0x0){return _0x11862a[_0x40d6('0x35')]({'read':!![]});}else{logger[_0x40d6('0x27')](_0x40d6('0x85'),_0x40d6('0x2c'),'plivio',util[_0x40d6('0x81')](_0x4e1264['body'],{'showHidden':![],'depth':null}));}break;case _0x40d6('0x89'):var _0x2d521a=_0x4e1264[_0x40d6('0x57')]['results'][0x0];if(_0x2d521a[_0x40d6('0x2c')][_0x40d6('0x8a')]===_0x40d6('0x8b')){return _0x11862a[_0x40d6('0x35')]({'read':!![]});}else{logger[_0x40d6('0x27')](_0x40d6('0x85'),_0x40d6('0x2c'),_0x40d6('0x89'),util[_0x40d6('0x81')](_0x4e1264['body'],{'showHidden':![],'depth':null}));}break;}return _0x11862a;}})[_0x40d6('0x20')](respondWithResult(_0x5a78d2,null))[_0x40d6('0x2a')](handleError(_0x5a78d2,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 86eaae6..b1b659f 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 _0x1a2a=['update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','SmsMessage','save'];(function(_0x51c819,_0xd812db){var _0x15c5d2=function(_0x2977f0){while(--_0x2977f0){_0x51c819['push'](_0x51c819['shift']());}};_0x15c5d2(++_0xd812db);}(_0x1a2a,0x71));var _0xa1a2=function(_0x591e11,_0x363e09){_0x591e11=_0x591e11-0x0;var _0x23a0a=_0x1a2a[_0x591e11];return _0x23a0a;};'use strict';var EventEmitter=require(_0xa1a2('0x0'));var SmsMessage=require(_0xa1a2('0x1'))['db'][_0xa1a2('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa1a2('0x3'),'afterUpdate':_0xa1a2('0x4'),'afterDestroy':_0xa1a2('0x5')};function emitEvent(_0x2c5d65){return function(_0xf0bdce,_0x164686,_0x350f7f){SmsMessageEvents['emit'](_0x2c5d65+':'+_0xf0bdce['id'],_0xf0bdce);SmsMessageEvents[_0xa1a2('0x6')](_0x2c5d65,_0xf0bdce);_0x350f7f(null);};}for(var e in events){if(events[_0xa1a2('0x7')](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module[_0xa1a2('0x8')]=SmsMessageEvents; \ No newline at end of file +var _0x7ed8=['../../mysqldb','setMaxListeners','update','remove','emit','exports','events'];(function(_0x31ced5,_0x5d5415){var _0x10d9e5=function(_0x2e51a5){while(--_0x2e51a5){_0x31ced5['push'](_0x31ced5['shift']());}};_0x10d9e5(++_0x5d5415);}(_0x7ed8,0x1e2));var _0x87ed=function(_0x261b26,_0x520d0e){_0x261b26=_0x261b26-0x0;var _0x63d49d=_0x7ed8[_0x261b26];return _0x63d49d;};'use strict';var EventEmitter=require(_0x87ed('0x0'));var SmsMessage=require(_0x87ed('0x1'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x87ed('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x87ed('0x3'),'afterDestroy':_0x87ed('0x4')};function emitEvent(_0x365add){return function(_0x5da643,_0x12b10d,_0x3e2e69){SmsMessageEvents[_0x87ed('0x5')](_0x365add+':'+_0x5da643['id'],_0x5da643);SmsMessageEvents['emit'](_0x365add,_0x5da643);_0x3e2e69(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module[_0x87ed('0x6')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 67ef1c3..3e425e9 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 _0xe87c=['sms_messages','fti_sms_messages','body','FULLTEXT','models','get','toLowerCase','out','isNil','UserId','SmsInteractionId','then','update','direction','error','secret','SmsAccount','SmsAccountId','type','twilio','accountSid','authToken','phone','messages','remote','/api/sms/messages/','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','https://api.skebby.it/API/v1.0/REST/','smsMethod','&password=','password','GET','split','sms','POST','session_key','deliveryReport','read','skebby','inspect','catch','connectel','senderString','Missing\x20parameters:\x20authToken','format','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','http_code','data','queued_count','head','clickSend','authId','token','https://api.plivo.com/v1/Account/%s/Message/','base64','message_uuid','plivo','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','username','/sms/2/text/advanced','/status?token=','IBSSO\x20','messageId','Missing\x20parameters:\x20base_url','Missing\x20parameters:\x20username,\x20password','crypto','apiKey','login','sender','text','timestamp','keys','createHash','md5','digest','hex','/external/get/send.php?','id_sms','csc','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','bandwidth','%s:%s','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','application/json','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','status','refid','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SmsMessage'];(function(_0x4c1ec2,_0x4f42b7){var _0x3f6f1c=function(_0xc82652){while(--_0xc82652){_0x4c1ec2['push'](_0x4c1ec2['shift']());}};_0x3f6f1c(++_0x4f42b7);}(_0xe87c,0x6a));var _0xce87=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xe87c[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0xce87('0x0'));var util=require(_0xce87('0x1'));var logger=require(_0xce87('0x2'))(_0xce87('0x3'));var moment=require('moment');var BPromise=require(_0xce87('0x4'));var rp=require(_0xce87('0x5'));var fs=require('fs');var path=require(_0xce87('0x6'));var rimraf=require(_0xce87('0x7'));var config=require(_0xce87('0x8'));var attributes=require('./smsMessage.attributes');module[_0xce87('0x9')]=function(_0x3cdc53,_0x517b60){return _0x3cdc53[_0xce87('0xa')](_0xce87('0xb'),attributes,{'tableName':_0xce87('0xc'),'paranoid':![],'indexes':[{'name':'messageId','fields':['messageId']},{'name':_0xce87('0xd'),'fields':[_0xce87('0xe')],'type':_0xce87('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x306360,_0x18b0c8,_0x340045){var _0x3137fa=_0x3cdc53[_0xce87('0x10')];var _0x1bc8ea=_0x306360[_0xce87('0x11')]({'plain':!![]});if(_0x1bc8ea['direction'][_0xce87('0x12')]()==='in'||_0x1bc8ea['direction']['toLowerCase']()===_0xce87('0x13')&&!_0x1bc8ea['secret']&&!_[_0xce87('0x14')](_0x1bc8ea[_0xce87('0x15')])&&!_['isNil'](_0x1bc8ea[_0xce87('0x16')])){_0x3137fa['SmsInteraction']['findOne']({'where':{'id':_0x1bc8ea[_0xce87('0x16')]}})[_0xce87('0x17')](function(_0x2267f9){if(_0x2267f9){_0x2267f9[_0xce87('0x18')]({'lastMsgAt':_0x1bc8ea['createdAt'],'lastMsgDirection':_0x1bc8ea[_0xce87('0x19')][_0xce87('0x12')]()});}})['catch'](function(_0x11dc36){console[_0xce87('0x1a')](_0x11dc36);});}if(_0x1bc8ea[_0xce87('0x19')]===_0xce87('0x13')&&!_0x1bc8ea[_0xce87('0x1b')]){var _0x1f6d4c;_0x3137fa[_0xce87('0x1c')]['find']({'where':{'id':_0x1bc8ea[_0xce87('0x1d')]},'raw':!![]})[_0xce87('0x17')](function(_0x40f14b){_0x1f6d4c=_0x40f14b;if(_0x1f6d4c&&_0x1f6d4c[_0xce87('0x1e')]){switch(_0x1f6d4c[_0xce87('0x1e')]){case _0xce87('0x1f'):var _0x3d3d54=require(_0xce87('0x1f'));if(_0x1f6d4c[_0xce87('0x20')]&&_0x1f6d4c[_0xce87('0x21')]&&_0x1f6d4c[_0xce87('0x22')]){var _0x1cb6d8=new _0x3d3d54(_0x1f6d4c['accountSid'],_0x1f6d4c[_0xce87('0x21')]);_0x1cb6d8[_0xce87('0x23')]['create']({'body':_0x1bc8ea['body'],'to':_0x1bc8ea[_0xce87('0x22')],'from':_0x1f6d4c[_0xce87('0x22')],'statusCallback':_0x1f6d4c[_0xce87('0x24')]+_0xce87('0x25')+_0x1bc8ea['id']+'/status?token='+_0x1f6d4c['token']})[_0xce87('0x17')](function(_0x7c8647){if(_0x7c8647[_0xce87('0x26')]){return _0x306360[_0xce87('0x18')]({'messageId':_0x7c8647[_0xce87('0x26')]});}})['catch'](function(_0x15d91a){logger['error'](_0xce87('0x27'),_0xce87('0x28'),_0xce87('0x1f'),util['inspect'](_0x15d91a,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xce87('0x27'),_0xce87('0x28'),_0xce87('0x1f'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case'skebby':var _0x3aca8d=_0xce87('0x29');if(_0x1f6d4c['username']&&_0x1f6d4c['password']){var _0x545d32={'recipient':[_0x1bc8ea['phone']],'message':_0x1bc8ea[_0xce87('0xe')],'message_type':_0x1f6d4c['smsMethod']};if(_0x1f6d4c[_0xce87('0x2a')]&&_0x1f6d4c[_0xce87('0x2a')]!=='SI'){_0x545d32['sender']=_0x1f6d4c[_0xce87('0x22')];}var _0x87eaa9={'url':_0x3aca8d+'login?username='+_0x1f6d4c['username']+_0xce87('0x2b')+_0x1f6d4c[_0xce87('0x2c')],'method':_0xce87('0x2d')};rp(_0x87eaa9)[_0xce87('0x17')](function(_0x2ab488){var _0x1e8250=_0x2ab488[_0xce87('0x2e')](';');var _0x3c13a3={'user_key':_0x1e8250[0x0],'session_key':_0x1e8250[0x1]};_0x87eaa9={'url':_0x3aca8d+_0xce87('0x2f'),'method':_0xce87('0x30'),'headers':{'user_key':_0x3c13a3['user_key'],'Session_key':_0x3c13a3[_0xce87('0x31')]},'json':!![],'body':_0x545d32};return rp(_0x87eaa9);})[_0xce87('0x17')](function(_0x295921){if(_0x295921['total_sent']>=0x1){var _0xe0dd26={'messageId':_0x295921['internal_order_id']};if(_0x1f6d4c[_0xce87('0x2a')]!=='GP'||!_0x1f6d4c[_0xce87('0x32')]){_0xe0dd26[_0xce87('0x33')]=!![];}return _0x306360[_0xce87('0x18')](_0xe0dd26);}else{return logger[_0xce87('0x1a')](_0xce87('0x27'),_0xce87('0x28'),_0xce87('0x34'),util[_0xce87('0x35')](_0x295921,{'showHidden':![],'depth':null}));}})[_0xce87('0x36')](function(_0x2b40de){return logger[_0xce87('0x1a')](_0xce87('0x27'),_0xce87('0x28'),_0xce87('0x34'),util[_0xce87('0x35')](_0x2b40de,{'showHidden':![],'depth':null}));});}else{logger[_0xce87('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xce87('0x34'),'Missing\x20parameters:\x20username,\x20password');}break;case _0xce87('0x37'):if(_0x1f6d4c[_0xce87('0x21')]){var _0x4c4f8e={'recipient':_0x1bc8ea[_0xce87('0x22')],'message':_0x1bc8ea[_0xce87('0xe')],'sender':_0x1f6d4c[_0xce87('0x38')]||_0x1f6d4c[_0xce87('0x22')],'authorization':_0x1f6d4c[_0xce87('0x21')]};var _0x18b0c8={'method':_0xce87('0x30'),'uri':'https://smsapi.connectel.se/api/v2/send/','body':_0x4c4f8e,'json':!![]};rp(_0x18b0c8)[_0xce87('0x17')](function(_0x333fb5){var _0x3b8c22={'messageId':_0x333fb5['requestid']};if(!_0x1f6d4c[_0xce87('0x32')]){_0x3b8c22['read']=!![];}return _0x306360[_0xce87('0x18')](_0x3b8c22);})['catch'](function(_0x113644){logger[_0xce87('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xce87('0x28'),_0xce87('0x37'),util['inspect'](_0x113644,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xce87('0x27'),_0xce87('0x28'),'connectel',_0xce87('0x39'));}break;case'clicksend':if(_0x1f6d4c['username']&&_0x1f6d4c['password']){var _0x4c4f8e={'messages':[{'source':'xCALLY\x20Motion','to':_0x1bc8ea[_0xce87('0x22')],'body':_0x1bc8ea[_0xce87('0xe')],'from':_0x1f6d4c[_0xce87('0x38')]||_0x1f6d4c[_0xce87('0x22')]}]};var _0x1f8209=util[_0xce87('0x3a')]('%s:%s',_0x1f6d4c['username'],_0x1f6d4c['password']);var _0x18b0c8={'method':_0xce87('0x30'),'uri':_0xce87('0x3b'),'body':_0x4c4f8e,'headers':{'Authorization':util[_0xce87('0x3a')](_0xce87('0x3c'),new Buffer(_0x1f8209)[_0xce87('0x3d')]('base64'))},'json':!![]};rp(_0x18b0c8)[_0xce87('0x17')](function(_0x5aa624){if(_0x5aa624[_0xce87('0x3e')]>=0xc8&&_0x5aa624[_0xce87('0x3e')]<=0xce){if(_0x5aa624[_0xce87('0x3f')]&&_0x5aa624['data'][_0xce87('0x40')]>0x0){var _0x1970e4=_[_0xce87('0x41')](_0x5aa624[_0xce87('0x3f')]['messages']);var _0xf7e7b8={'messageId':_0x1970e4['message_id']};if(!_0x1f6d4c[_0xce87('0x32')]){_0xf7e7b8[_0xce87('0x33')]=!![];}return _0x306360['update'](_0xf7e7b8);}else{logger[_0xce87('0x1a')](_0xce87('0x27'),_0xce87('0x28'),_0xce87('0x42'),util[_0xce87('0x35')](_0x5aa624,{'showHidden':![],'depth':null}));}}else{logger[_0xce87('0x1a')](_0xce87('0x27'),_0xce87('0x28'),_0xce87('0x42'),util['inspect'](_0x5aa624,{'showHidden':![],'depth':null}));}})[_0xce87('0x36')](function(_0x4246bd){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xce87('0x28'),_0xce87('0x42'),util[_0xce87('0x35')](_0x4246bd,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xce87('0x27'),_0xce87('0x28'),'clickSend','Missing\x20parameters:\x20username,\x20password');}break;case'plivo':if(_0x1f6d4c[_0xce87('0x43')]&&_0x1f6d4c[_0xce87('0x21')]){var _0x4c4f8e={'dst':_0x1bc8ea[_0xce87('0x22')],'text':_0x1bc8ea['body'],'src':_0x1f6d4c[_0xce87('0x38')]||_0x1f6d4c[_0xce87('0x22')],'url':_0x1f6d4c[_0xce87('0x24')]+_0xce87('0x25')+_0x1bc8ea['id']+'/status?token='+_0x1f6d4c[_0xce87('0x44')]};var _0x1f8209=util[_0xce87('0x3a')]('%s:%s',_0x1f6d4c[_0xce87('0x43')],_0x1f6d4c[_0xce87('0x21')]);var _0x18b0c8={'method':'POST','uri':util['format'](_0xce87('0x45'),_0x1f6d4c[_0xce87('0x43')]),'body':_0x4c4f8e,'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(_0x1f8209)[_0xce87('0x3d')](_0xce87('0x46')))},'json':!![]};rp(_0x18b0c8)['then'](function(_0x5b3c14){var _0x3ea4f7={'messageId':_0x5b3c14[_0xce87('0x47')][0x0]};return _0x306360[_0xce87('0x18')](_0x3ea4f7);})[_0xce87('0x36')](function(_0x81d3a0){logger['error'](_0xce87('0x27'),'afterCreate','plivo',util[_0xce87('0x35')](_0x81d3a0,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xce87('0x27'),_0xce87('0x28'),_0xce87('0x48'),_0xce87('0x49'));}break;case _0xce87('0x4a'):if(_0x1f6d4c['username']&&_0x1f6d4c[_0xce87('0x2c')]){if(_0x1f6d4c[_0xce87('0x4b')]){var _0xe22f00={'method':'POST','uri':_0x1f6d4c[_0xce87('0x4b')]+_0xce87('0x4c'),'body':{'username':_0x1f6d4c[_0xce87('0x4d')],'password':_0x1f6d4c['password']},'json':!![]};return rp(_0xe22f00)['then'](function(_0x6872eb){var _0x466736={'method':_0xce87('0x30'),'uri':_0x1f6d4c['baseUrl']+_0xce87('0x4e'),'body':{'messages':[{'from':_0x1f6d4c[_0xce87('0x22')],'destinations':[{'to':_0x1bc8ea[_0xce87('0x22')]}],'text':_0x1bc8ea['body'],'notifyUrl':_0x1f6d4c['remote']+_0xce87('0x25')+_0x1bc8ea['id']+_0xce87('0x4f')+_0x1f6d4c[_0xce87('0x44')],'notifyContentType':'application/json','callbackData':_0x1f6d4c['phone']+';'+_0x1bc8ea['body']}]},'headers':{'Authorization':_0xce87('0x50')+_0x6872eb[_0xce87('0x44')]},'json':!![]};return rp(_0x466736)['then'](function(_0x500c6f){if(_0x500c6f[_0xce87('0x23')]){var _0xc3a861={'messageId':_0x500c6f[_0xce87('0x23')][0x0][_0xce87('0x51')]};if(!_0x1f6d4c[_0xce87('0x32')]){_0xc3a861['read']=!![];}return _0x306360['update'](_0xc3a861);}else{return logger[_0xce87('0x1a')](_0xce87('0x27'),_0xce87('0x28'),_0xce87('0x4a'),util[_0xce87('0x35')](_0x500c6f,{'showHidden':![],'depth':null}));}});})[_0xce87('0x36')](function(_0x53cab0){return logger['error'](_0xce87('0x27'),'afterCreate',_0xce87('0x4a'),util['inspect'](_0x53cab0,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xce87('0x27'),_0xce87('0x28'),_0xce87('0x4a'),_0xce87('0x52'));}}else{logger[_0xce87('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xce87('0x28'),_0xce87('0x4a'),_0xce87('0x53'));}break;case'csc':var _0x26e61f=require(_0xce87('0x54'));if(_0x1f6d4c[_0xce87('0x55')]){var _0x13e13e={};_0x13e13e[_0xce87('0x56')]=_0x1f6d4c[_0xce87('0x4d')];_0x13e13e['phone']=_0x1bc8ea[_0xce87('0x22')];_0x13e13e[_0xce87('0x57')]=_0x1f6d4c[_0xce87('0x22')];_0x13e13e[_0xce87('0x58')]=_0x1bc8ea[_0xce87('0xe')];_0x13e13e[_0xce87('0x59')]=+new Date();var _0x2b9c3a='';var _0x1af016='';var _0x275adb=Object[_0xce87('0x5a')](_0x13e13e);_0x275adb['sort']();for(var _0x113067=0x0;_0x113067<_0x275adb['length'];_0x113067++){if(_0x2b9c3a!=''){_0x2b9c3a+='&';}_0x2b9c3a+=_0x275adb[_0x113067]+'='+encodeURIComponent(_0x13e13e[_0x275adb[_0x113067]]);_0x1af016+=_0x13e13e[_0x275adb[_0x113067]];}_0x1af016+=_0x1f6d4c[_0xce87('0x55')];_0x1af016=_0x26e61f[_0xce87('0x5b')](_0xce87('0x5c'))[_0xce87('0x18')](_0x1af016)[_0xce87('0x5d')](_0xce87('0x5e'));if(_0x2b9c3a!==''){_0x2b9c3a+='&';}_0x2b9c3a+='signature='+_0x1af016;var _0x87eaa9={'method':'GET','uri':_0x1f6d4c[_0xce87('0x4b')]+_0xce87('0x5f')+_0x2b9c3a,'json':!![]};return rp(_0x87eaa9)[_0xce87('0x17')](function(_0x34e2aa){var _0x4c83f1=Object['keys'](_0x34e2aa);if(_0x34e2aa[_0x4c83f1[0x0]][_0xce87('0x1a')]&&parseInt(_0x34e2aa[_0x4c83f1[0x0]][_0xce87('0x1a')])===0x0){var _0x44a99f={'messageId':_0x34e2aa[_0x4c83f1[0x0]][_0xce87('0x60')]};if(!_0x1f6d4c[_0xce87('0x32')]){_0x44a99f['read']=!![];}return _0x306360[_0xce87('0x18')](_0x44a99f);}else{return logger[_0xce87('0x1a')](_0xce87('0x27'),_0xce87('0x28'),'csc',util[_0xce87('0x35')](_0x34e2aa[_0xce87('0x1a')],{'showHidden':![],'depth':null}));}})[_0xce87('0x36')](function(_0x36c6aa){return logger[_0xce87('0x1a')](_0xce87('0x27'),'afterCreate','csc',util[_0xce87('0x35')](_0x36c6aa,{'showHidden':![],'depth':null}));});}else{logger[_0xce87('0x1a')](_0xce87('0x27'),_0xce87('0x28'),_0xce87('0x61'),_0xce87('0x62'));}break;case _0xce87('0x63'):if(_0x1f6d4c['apiKey']){var _0x2f031f={'method':_0xce87('0x30'),'uri':_0xce87('0x64'),'headers':{'Authorization':_0x1f6d4c[_0xce87('0x55')]},'body':{'content':_0x1bc8ea['body'],'to':[_0x1bc8ea['phone']],'from':_0x1f6d4c['phone'],'binary':![],'clientMessageId':'uuid','charset':'UTF-8'},'json':!![]};rp(_0x2f031f)[_0xce87('0x17')](function(_0x26131f){if(!_0x26131f[_0xce87('0x1a')]){var _0x27e612={'messageId':_0x26131f[_0xce87('0x23')][0x0]['apiMessageId']};if(!_0x1f6d4c[_0xce87('0x32')]){_0x27e612[_0xce87('0x33')]=!![];}return _0x306360['update'](_0x27e612);}else{return logger[_0xce87('0x1a')](_0xce87('0x27'),_0xce87('0x28'),_0xce87('0x63'),util[_0xce87('0x35')](_0x26131f['error'],{'showHidden':![],'depth':null}));}})[_0xce87('0x36')](function(_0x349891){return logger['error'](_0xce87('0x27'),'afterCreate',_0xce87('0x63'),util['inspect'](_0x349891,{'showHidden':![],'depth':null}));});}else{logger[_0xce87('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xce87('0x28'),_0xce87('0x63'),_0xce87('0x62'));}break;case _0xce87('0x65'):if(_0x1f6d4c['username']&&_0x1f6d4c[_0xce87('0x2c')]){var _0x1f8209=util[_0xce87('0x3a')](_0xce87('0x66'),_0x1f6d4c[_0xce87('0x4d')],_0x1f6d4c[_0xce87('0x2c')]);var _0x18b0c8={'method':_0xce87('0x30'),'uri':_0xce87('0x67')+_0x1f6d4c[_0xce87('0x68')]+_0xce87('0x69'),'body':{'to':[_0x1bc8ea[_0xce87('0x22')]],'text':_0x1bc8ea[_0xce87('0xe')],'from':_0x1f6d4c['phone'],'applicationId':_0x1f6d4c['applicationId']},'headers':{'Authorization':util[_0xce87('0x3a')](_0xce87('0x3c'),new Buffer(_0x1f8209)[_0xce87('0x3d')]('base64'))},'json':!![]};rp(_0x18b0c8)[_0xce87('0x17')](function(_0x58aadb){if(_0x58aadb['id']){var _0x167e18={'messageId':_0x58aadb['id']};return _0x306360[_0xce87('0x18')](_0x167e18);}else{logger[_0xce87('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xce87('0x65'),util[_0xce87('0x35')](_0x58aadb,{'showHidden':![],'depth':null}));}})[_0xce87('0x36')](function(_0x565cee){logger[_0xce87('0x1a')](_0xce87('0x27'),_0xce87('0x28'),_0xce87('0x65'),util[_0xce87('0x35')](_0x565cee,{'showHidden':![],'depth':null}));});}else{logger[_0xce87('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xce87('0x28'),'bandwidth','Missing\x20parameters:\x20username,\x20password');}break;case _0xce87('0x6a'):if(_0x1f6d4c[_0xce87('0x55')]){var _0x4a171a={};var _0x87eaa9={'method':_0xce87('0x30'),'uri':_0xce87('0x6b'),'headers':{'Authorization':_0xce87('0x6c')+_0x1f6d4c[_0xce87('0x55')],'Content-Type':_0xce87('0x6d')},'body':{'from':_0x1f6d4c['phone'],'to':_0x1bc8ea['phone'],'text':_0x1bc8ea[_0xce87('0xe')]},'json':!![]};return rp(_0x87eaa9)[_0xce87('0x17')](function(_0x12ad58){if(_0x12ad58['code']==0xca){_0x4a171a[_0xce87('0x6e')]=_0x12ad58;var _0x15550f={'method':_0xce87('0x30'),'uri':_0xce87('0x6f'),'headers':{'Authorization':_0xce87('0x6c')+_0x1f6d4c[_0xce87('0x55')],'Content-Type':_0xce87('0x6d')},'body':{'refid':_0x4a171a['message']['refid']},'json':!![]};return rp(_0x15550f)['then'](function(_0x1bc864){_0x4a171a[_0xce87('0x70')]=_0x1bc864;var _0x12d6fb={'messageId':_0x4a171a['message'][_0xce87('0x71')],'read':!![]};return _0x306360['update'](_0x12d6fb);});}else{return logger['error'](_0xce87('0x27'),_0xce87('0x28'),_0xce87('0x6a'),util[_0xce87('0x35')](_0x12ad58,{'showHidden':![],'depth':null}));}})[_0xce87('0x36')](function(_0x2b9128){return logger[_0xce87('0x1a')](_0xce87('0x27'),'afterCreate','intelepeer',util[_0xce87('0x35')](_0x2b9128,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0xce87('0x27'),'afterCreate','intelepeer',_0xce87('0x72'));}break;}}})[_0xce87('0x73')](function(){_0x340045();});}else{_0x340045();}}},'charset':_0xce87('0x74'),'collate':_0xce87('0x75')});}; \ No newline at end of file +var _0xeb2b=['SmsInteractionId','findOne','then','update','createdAt','catch','error','secret','SmsAccount','find','SmsAccountId','type','twilio','accountSid','authToken','create','phone','remote','/status?token=','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','username','password','smsMethod','sender','login?username=','&password=','split','sms','POST','user_key','session_key','total_sent','internal_order_id','deliveryReport','read','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','%s:%s','Basic\x20%s','toString','base64','http_code','data','queued_count','head','messages','message_id','clickSend','plivo','/api/sms/messages/','authId','format','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/sms/2/text/advanced','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','timestamp','keys','sort','length','createHash','md5','digest','hex','signature=','GET','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','status','finally','utf8mb4','util','moment','bluebird','request-promise','rimraf','../../config/environment','./smsMessage.attributes','define','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models','get','toLowerCase','direction','out','isNil','UserId'];(function(_0x423867,_0x142eb3){var _0x20bedf=function(_0x54cc2b){while(--_0x54cc2b){_0x423867['push'](_0x423867['shift']());}};_0x20bedf(++_0x142eb3);}(_0xeb2b,0x15d));var _0xbeb2=function(_0x20d19b,_0x13d0df){_0x20d19b=_0x20d19b-0x0;var _0x3f8fad=_0xeb2b[_0x20d19b];return _0x3f8fad;};'use strict';var _=require('lodash');var util=require(_0xbeb2('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xbeb2('0x1'));var BPromise=require(_0xbeb2('0x2'));var rp=require(_0xbeb2('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbeb2('0x4'));var config=require(_0xbeb2('0x5'));var attributes=require(_0xbeb2('0x6'));module['exports']=function(_0x468971,_0x539e7f){return _0x468971[_0xbeb2('0x7')]('SmsMessage',attributes,{'tableName':_0xbeb2('0x8'),'paranoid':![],'indexes':[{'name':_0xbeb2('0x9'),'fields':[_0xbeb2('0x9')]},{'name':_0xbeb2('0xa'),'fields':[_0xbeb2('0xb')],'type':_0xbeb2('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x570710,_0x46d06b,_0x120c1f){var _0x12e8e1=_0x468971[_0xbeb2('0xd')];var _0x76ff03=_0x570710[_0xbeb2('0xe')]({'plain':!![]});if(_0x76ff03['direction'][_0xbeb2('0xf')]()==='in'||_0x76ff03[_0xbeb2('0x10')][_0xbeb2('0xf')]()===_0xbeb2('0x11')&&!_0x76ff03['secret']&&!_[_0xbeb2('0x12')](_0x76ff03[_0xbeb2('0x13')])&&!_[_0xbeb2('0x12')](_0x76ff03[_0xbeb2('0x14')])){_0x12e8e1['SmsInteraction'][_0xbeb2('0x15')]({'where':{'id':_0x76ff03[_0xbeb2('0x14')]}})[_0xbeb2('0x16')](function(_0x5d46fa){if(_0x5d46fa){_0x5d46fa[_0xbeb2('0x17')]({'lastMsgAt':_0x76ff03[_0xbeb2('0x18')],'lastMsgDirection':_0x76ff03[_0xbeb2('0x10')]['toLowerCase']()});}})[_0xbeb2('0x19')](function(_0x19c6cc){console[_0xbeb2('0x1a')](_0x19c6cc);});}if(_0x76ff03[_0xbeb2('0x10')]==='out'&&!_0x76ff03[_0xbeb2('0x1b')]){var _0x3f5d86;_0x12e8e1[_0xbeb2('0x1c')][_0xbeb2('0x1d')]({'where':{'id':_0x76ff03[_0xbeb2('0x1e')]},'raw':!![]})[_0xbeb2('0x16')](function(_0x5ea1d7){_0x3f5d86=_0x5ea1d7;if(_0x3f5d86&&_0x3f5d86[_0xbeb2('0x1f')]){switch(_0x3f5d86['type']){case _0xbeb2('0x20'):var _0x4daba1=require(_0xbeb2('0x20'));if(_0x3f5d86[_0xbeb2('0x21')]&&_0x3f5d86[_0xbeb2('0x22')]&&_0x3f5d86['phone']){var _0x4bd3a1=new _0x4daba1(_0x3f5d86[_0xbeb2('0x21')],_0x3f5d86['authToken']);_0x4bd3a1['messages'][_0xbeb2('0x23')]({'body':_0x76ff03[_0xbeb2('0xb')],'to':_0x76ff03[_0xbeb2('0x24')],'from':_0x3f5d86[_0xbeb2('0x24')],'statusCallback':_0x3f5d86[_0xbeb2('0x25')]+'/api/sms/messages/'+_0x76ff03['id']+_0xbeb2('0x26')+_0x3f5d86[_0xbeb2('0x27')]})['then'](function(_0x34bdd3){if(_0x34bdd3['sid']){return _0x570710[_0xbeb2('0x17')]({'messageId':_0x34bdd3[_0xbeb2('0x28')]});}})[_0xbeb2('0x19')](function(_0x50e6f6){logger[_0xbeb2('0x1a')](_0xbeb2('0x29'),_0xbeb2('0x2a'),_0xbeb2('0x20'),util[_0xbeb2('0x2b')](_0x50e6f6,{'showHidden':![],'depth':null}));});}else{logger[_0xbeb2('0x1a')](_0xbeb2('0x29'),_0xbeb2('0x2a'),'twilio',_0xbeb2('0x2c'));}break;case _0xbeb2('0x2d'):var _0x5a1b57='https://api.skebby.it/API/v1.0/REST/';if(_0x3f5d86[_0xbeb2('0x2e')]&&_0x3f5d86[_0xbeb2('0x2f')]){var _0x215e31={'recipient':[_0x76ff03[_0xbeb2('0x24')]],'message':_0x76ff03[_0xbeb2('0xb')],'message_type':_0x3f5d86[_0xbeb2('0x30')]};if(_0x3f5d86[_0xbeb2('0x30')]&&_0x3f5d86[_0xbeb2('0x30')]!=='SI'){_0x215e31[_0xbeb2('0x31')]=_0x3f5d86[_0xbeb2('0x24')];}var _0xa6199b={'url':_0x5a1b57+_0xbeb2('0x32')+_0x3f5d86[_0xbeb2('0x2e')]+_0xbeb2('0x33')+_0x3f5d86['password'],'method':'GET'};rp(_0xa6199b)[_0xbeb2('0x16')](function(_0x437d37){var _0x147675=_0x437d37[_0xbeb2('0x34')](';');var _0x1f2cf2={'user_key':_0x147675[0x0],'session_key':_0x147675[0x1]};_0xa6199b={'url':_0x5a1b57+_0xbeb2('0x35'),'method':_0xbeb2('0x36'),'headers':{'user_key':_0x1f2cf2[_0xbeb2('0x37')],'Session_key':_0x1f2cf2[_0xbeb2('0x38')]},'json':!![],'body':_0x215e31};return rp(_0xa6199b);})[_0xbeb2('0x16')](function(_0x51877e){if(_0x51877e[_0xbeb2('0x39')]>=0x1){var _0x12c9df={'messageId':_0x51877e[_0xbeb2('0x3a')]};if(_0x3f5d86[_0xbeb2('0x30')]!=='GP'||!_0x3f5d86[_0xbeb2('0x3b')]){_0x12c9df[_0xbeb2('0x3c')]=!![];}return _0x570710[_0xbeb2('0x17')](_0x12c9df);}else{return logger[_0xbeb2('0x1a')](_0xbeb2('0x29'),_0xbeb2('0x2a'),_0xbeb2('0x2d'),util[_0xbeb2('0x2b')](_0x51877e,{'showHidden':![],'depth':null}));}})[_0xbeb2('0x19')](function(_0x57c2cc){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xbeb2('0x2a'),_0xbeb2('0x2d'),util[_0xbeb2('0x2b')](_0x57c2cc,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xbeb2('0x29'),_0xbeb2('0x2a'),_0xbeb2('0x2d'),_0xbeb2('0x3d'));}break;case _0xbeb2('0x3e'):if(_0x3f5d86[_0xbeb2('0x22')]){var _0x5be065={'recipient':_0x76ff03[_0xbeb2('0x24')],'message':_0x76ff03[_0xbeb2('0xb')],'sender':_0x3f5d86[_0xbeb2('0x3f')]||_0x3f5d86[_0xbeb2('0x24')],'authorization':_0x3f5d86[_0xbeb2('0x22')]};var _0x46d06b={'method':'POST','uri':_0xbeb2('0x40'),'body':_0x5be065,'json':!![]};rp(_0x46d06b)[_0xbeb2('0x16')](function(_0xe9167d){var _0x36bd03={'messageId':_0xe9167d[_0xbeb2('0x41')]};if(!_0x3f5d86[_0xbeb2('0x3b')]){_0x36bd03[_0xbeb2('0x3c')]=!![];}return _0x570710[_0xbeb2('0x17')](_0x36bd03);})[_0xbeb2('0x19')](function(_0x244258){logger[_0xbeb2('0x1a')](_0xbeb2('0x29'),_0xbeb2('0x2a'),'connectel',util[_0xbeb2('0x2b')](_0x244258,{'showHidden':![],'depth':null}));});}else{logger[_0xbeb2('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','connectel',_0xbeb2('0x42'));}break;case _0xbeb2('0x43'):if(_0x3f5d86[_0xbeb2('0x2e')]&&_0x3f5d86[_0xbeb2('0x2f')]){var _0x5be065={'messages':[{'source':_0xbeb2('0x44'),'to':_0x76ff03[_0xbeb2('0x24')],'body':_0x76ff03['body'],'from':_0x3f5d86[_0xbeb2('0x3f')]||_0x3f5d86[_0xbeb2('0x24')]}]};var _0x3aa7b1=util['format'](_0xbeb2('0x45'),_0x3f5d86[_0xbeb2('0x2e')],_0x3f5d86[_0xbeb2('0x2f')]);var _0x46d06b={'method':_0xbeb2('0x36'),'uri':'https://rest.clicksend.com/v3/sms/send','body':_0x5be065,'headers':{'Authorization':util['format'](_0xbeb2('0x46'),new Buffer(_0x3aa7b1)[_0xbeb2('0x47')](_0xbeb2('0x48')))},'json':!![]};rp(_0x46d06b)[_0xbeb2('0x16')](function(_0x204406){if(_0x204406[_0xbeb2('0x49')]>=0xc8&&_0x204406[_0xbeb2('0x49')]<=0xce){if(_0x204406[_0xbeb2('0x4a')]&&_0x204406[_0xbeb2('0x4a')][_0xbeb2('0x4b')]>0x0){var _0x1a9d05=_[_0xbeb2('0x4c')](_0x204406[_0xbeb2('0x4a')][_0xbeb2('0x4d')]);var _0x25df9c={'messageId':_0x1a9d05[_0xbeb2('0x4e')]};if(!_0x3f5d86[_0xbeb2('0x3b')]){_0x25df9c[_0xbeb2('0x3c')]=!![];}return _0x570710[_0xbeb2('0x17')](_0x25df9c);}else{logger[_0xbeb2('0x1a')](_0xbeb2('0x29'),_0xbeb2('0x2a'),_0xbeb2('0x4f'),util['inspect'](_0x204406,{'showHidden':![],'depth':null}));}}else{logger[_0xbeb2('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xbeb2('0x2a'),_0xbeb2('0x4f'),util[_0xbeb2('0x2b')](_0x204406,{'showHidden':![],'depth':null}));}})['catch'](function(_0x185c8a){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xbeb2('0x2a'),_0xbeb2('0x4f'),util[_0xbeb2('0x2b')](_0x185c8a,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xbeb2('0x4f'),_0xbeb2('0x3d'));}break;case _0xbeb2('0x50'):if(_0x3f5d86['authId']&&_0x3f5d86['authToken']){var _0x5be065={'dst':_0x76ff03[_0xbeb2('0x24')],'text':_0x76ff03[_0xbeb2('0xb')],'src':_0x3f5d86[_0xbeb2('0x3f')]||_0x3f5d86[_0xbeb2('0x24')],'url':_0x3f5d86['remote']+_0xbeb2('0x51')+_0x76ff03['id']+'/status?token='+_0x3f5d86[_0xbeb2('0x27')]};var _0x3aa7b1=util['format'](_0xbeb2('0x45'),_0x3f5d86[_0xbeb2('0x52')],_0x3f5d86[_0xbeb2('0x22')]);var _0x46d06b={'method':_0xbeb2('0x36'),'uri':util[_0xbeb2('0x53')]('https://api.plivo.com/v1/Account/%s/Message/',_0x3f5d86[_0xbeb2('0x52')]),'body':_0x5be065,'headers':{'Authorization':util['format'](_0xbeb2('0x46'),new Buffer(_0x3aa7b1)['toString'](_0xbeb2('0x48')))},'json':!![]};rp(_0x46d06b)['then'](function(_0x3c553d){var _0x20ef03={'messageId':_0x3c553d['message_uuid'][0x0]};return _0x570710[_0xbeb2('0x17')](_0x20ef03);})[_0xbeb2('0x19')](function(_0x24c4cb){logger[_0xbeb2('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xbeb2('0x50'),util[_0xbeb2('0x2b')](_0x24c4cb,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xbeb2('0x29'),_0xbeb2('0x2a'),_0xbeb2('0x50'),_0xbeb2('0x54'));}break;case _0xbeb2('0x55'):if(_0x3f5d86[_0xbeb2('0x2e')]&&_0x3f5d86[_0xbeb2('0x2f')]){if(_0x3f5d86['baseUrl']){var _0x4652cd={'method':_0xbeb2('0x36'),'uri':_0x3f5d86['baseUrl']+'/auth/1/session','body':{'username':_0x3f5d86[_0xbeb2('0x2e')],'password':_0x3f5d86[_0xbeb2('0x2f')]},'json':!![]};return rp(_0x4652cd)[_0xbeb2('0x16')](function(_0x540fa4){var _0x23a5dd={'method':'POST','uri':_0x3f5d86[_0xbeb2('0x56')]+_0xbeb2('0x57'),'body':{'messages':[{'from':_0x3f5d86[_0xbeb2('0x24')],'destinations':[{'to':_0x76ff03['phone']}],'text':_0x76ff03[_0xbeb2('0xb')],'notifyUrl':_0x3f5d86[_0xbeb2('0x25')]+_0xbeb2('0x51')+_0x76ff03['id']+_0xbeb2('0x26')+_0x3f5d86[_0xbeb2('0x27')],'notifyContentType':_0xbeb2('0x58'),'callbackData':_0x3f5d86[_0xbeb2('0x24')]+';'+_0x76ff03[_0xbeb2('0xb')]}]},'headers':{'Authorization':_0xbeb2('0x59')+_0x540fa4[_0xbeb2('0x27')]},'json':!![]};return rp(_0x23a5dd)[_0xbeb2('0x16')](function(_0x4bba0f){if(_0x4bba0f['messages']){var _0x2a6770={'messageId':_0x4bba0f[_0xbeb2('0x4d')][0x0][_0xbeb2('0x9')]};if(!_0x3f5d86[_0xbeb2('0x3b')]){_0x2a6770[_0xbeb2('0x3c')]=!![];}return _0x570710[_0xbeb2('0x17')](_0x2a6770);}else{return logger['error'](_0xbeb2('0x29'),_0xbeb2('0x2a'),_0xbeb2('0x55'),util[_0xbeb2('0x2b')](_0x4bba0f,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x4f7936){return logger[_0xbeb2('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xbeb2('0x55'),util[_0xbeb2('0x2b')](_0x4f7936,{'showHidden':![],'depth':null}));});}else{logger[_0xbeb2('0x1a')](_0xbeb2('0x29'),_0xbeb2('0x2a'),_0xbeb2('0x55'),_0xbeb2('0x5a'));}}else{logger[_0xbeb2('0x1a')](_0xbeb2('0x29'),'afterCreate','infobip',_0xbeb2('0x3d'));}break;case _0xbeb2('0x5b'):var _0x48f027=require(_0xbeb2('0x5c'));if(_0x3f5d86[_0xbeb2('0x5d')]){var _0x376eee={};_0x376eee[_0xbeb2('0x5e')]=_0x3f5d86[_0xbeb2('0x2e')];_0x376eee['phone']=_0x76ff03['phone'];_0x376eee[_0xbeb2('0x31')]=_0x3f5d86['phone'];_0x376eee['text']=_0x76ff03[_0xbeb2('0xb')];_0x376eee[_0xbeb2('0x5f')]=+new Date();var _0x4fca1f='';var _0x41f570='';var _0x1faa53=Object[_0xbeb2('0x60')](_0x376eee);_0x1faa53[_0xbeb2('0x61')]();for(var _0xa1a0e6=0x0;_0xa1a0e6<_0x1faa53[_0xbeb2('0x62')];_0xa1a0e6++){if(_0x4fca1f!=''){_0x4fca1f+='&';}_0x4fca1f+=_0x1faa53[_0xa1a0e6]+'='+encodeURIComponent(_0x376eee[_0x1faa53[_0xa1a0e6]]);_0x41f570+=_0x376eee[_0x1faa53[_0xa1a0e6]];}_0x41f570+=_0x3f5d86[_0xbeb2('0x5d')];_0x41f570=_0x48f027[_0xbeb2('0x63')](_0xbeb2('0x64'))[_0xbeb2('0x17')](_0x41f570)[_0xbeb2('0x65')](_0xbeb2('0x66'));if(_0x4fca1f!==''){_0x4fca1f+='&';}_0x4fca1f+=_0xbeb2('0x67')+_0x41f570;var _0xa6199b={'method':_0xbeb2('0x68'),'uri':_0x3f5d86['baseUrl']+_0xbeb2('0x69')+_0x4fca1f,'json':!![]};return rp(_0xa6199b)['then'](function(_0xa2c29a){var _0xde0162=Object[_0xbeb2('0x60')](_0xa2c29a);if(_0xa2c29a[_0xde0162[0x0]][_0xbeb2('0x1a')]&&parseInt(_0xa2c29a[_0xde0162[0x0]][_0xbeb2('0x1a')])===0x0){var _0x33bfce={'messageId':_0xa2c29a[_0xde0162[0x0]][_0xbeb2('0x6a')]};if(!_0x3f5d86['deliveryReport']){_0x33bfce['read']=!![];}return _0x570710['update'](_0x33bfce);}else{return logger[_0xbeb2('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xbeb2('0x2a'),'csc',util['inspect'](_0xa2c29a[_0xbeb2('0x1a')],{'showHidden':![],'depth':null}));}})[_0xbeb2('0x19')](function(_0x15d965){return logger[_0xbeb2('0x1a')](_0xbeb2('0x29'),'afterCreate',_0xbeb2('0x5b'),util[_0xbeb2('0x2b')](_0x15d965,{'showHidden':![],'depth':null}));});}else{logger[_0xbeb2('0x1a')](_0xbeb2('0x29'),'afterCreate',_0xbeb2('0x5b'),_0xbeb2('0x6b'));}break;case _0xbeb2('0x6c'):if(_0x3f5d86[_0xbeb2('0x5d')]){var _0x462c32={'method':_0xbeb2('0x36'),'uri':_0xbeb2('0x6d'),'headers':{'Authorization':_0x3f5d86[_0xbeb2('0x5d')]},'body':{'content':_0x76ff03[_0xbeb2('0xb')],'to':[_0x76ff03[_0xbeb2('0x24')]],'from':_0x3f5d86['phone'],'binary':![],'clientMessageId':'uuid','charset':'UTF-8'},'json':!![]};rp(_0x462c32)['then'](function(_0x242dd8){if(!_0x242dd8[_0xbeb2('0x1a')]){var _0x5b85da={'messageId':_0x242dd8['messages'][0x0]['apiMessageId']};if(!_0x3f5d86[_0xbeb2('0x3b')]){_0x5b85da['read']=!![];}return _0x570710[_0xbeb2('0x17')](_0x5b85da);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xbeb2('0x2a'),'clickatell',util[_0xbeb2('0x2b')](_0x242dd8['error'],{'showHidden':![],'depth':null}));}})[_0xbeb2('0x19')](function(_0x204c39){return logger[_0xbeb2('0x1a')](_0xbeb2('0x29'),_0xbeb2('0x2a'),_0xbeb2('0x6c'),util[_0xbeb2('0x2b')](_0x204c39,{'showHidden':![],'depth':null}));});}else{logger[_0xbeb2('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xbeb2('0x2a'),_0xbeb2('0x6c'),_0xbeb2('0x6b'));}break;case _0xbeb2('0x6e'):if(_0x3f5d86[_0xbeb2('0x2e')]&&_0x3f5d86[_0xbeb2('0x2f')]){var _0x3aa7b1=util[_0xbeb2('0x53')]('%s:%s',_0x3f5d86[_0xbeb2('0x2e')],_0x3f5d86[_0xbeb2('0x2f')]);var _0x46d06b={'method':_0xbeb2('0x36'),'uri':_0xbeb2('0x6f')+_0x3f5d86[_0xbeb2('0x70')]+_0xbeb2('0x71'),'body':{'to':[_0x76ff03['phone']],'text':_0x76ff03[_0xbeb2('0xb')],'from':_0x3f5d86[_0xbeb2('0x24')],'applicationId':_0x3f5d86['applicationId']},'headers':{'Authorization':util[_0xbeb2('0x53')]('Basic\x20%s',new Buffer(_0x3aa7b1)[_0xbeb2('0x47')](_0xbeb2('0x48')))},'json':!![]};rp(_0x46d06b)[_0xbeb2('0x16')](function(_0x4ca00a){if(_0x4ca00a['id']){var _0x21191a={'messageId':_0x4ca00a['id']};return _0x570710['update'](_0x21191a);}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xbeb2('0x2a'),_0xbeb2('0x6e'),util[_0xbeb2('0x2b')](_0x4ca00a,{'showHidden':![],'depth':null}));}})[_0xbeb2('0x19')](function(_0x563f33){logger['error'](_0xbeb2('0x29'),'afterCreate',_0xbeb2('0x6e'),util[_0xbeb2('0x2b')](_0x563f33,{'showHidden':![],'depth':null}));});}else{logger[_0xbeb2('0x1a')](_0xbeb2('0x29'),_0xbeb2('0x2a'),_0xbeb2('0x6e'),'Missing\x20parameters:\x20username,\x20password');}break;case _0xbeb2('0x72'):if(_0x3f5d86[_0xbeb2('0x5d')]){var _0x4b911a={};var _0xa6199b={'method':'POST','uri':_0xbeb2('0x73'),'headers':{'Authorization':_0xbeb2('0x74')+_0x3f5d86[_0xbeb2('0x5d')],'Content-Type':_0xbeb2('0x58')},'body':{'from':_0x3f5d86['phone'],'to':_0x76ff03[_0xbeb2('0x24')],'text':_0x76ff03[_0xbeb2('0xb')]},'json':!![]};return rp(_0xa6199b)['then'](function(_0x211215){if(_0x211215[_0xbeb2('0x75')]==0xca){_0x4b911a[_0xbeb2('0x76')]=_0x211215;var _0x1c8dee={'method':'POST','uri':_0xbeb2('0x77'),'headers':{'Authorization':_0xbeb2('0x74')+_0x3f5d86[_0xbeb2('0x5d')],'Content-Type':_0xbeb2('0x58')},'body':{'refid':_0x4b911a['message']['refid']},'json':!![]};return rp(_0x1c8dee)['then'](function(_0x1be967){_0x4b911a[_0xbeb2('0x78')]=_0x1be967;var _0x4664ee={'messageId':_0x4b911a['message']['refid'],'read':!![]};return _0x570710['update'](_0x4664ee);});}else{return logger[_0xbeb2('0x1a')](_0xbeb2('0x29'),_0xbeb2('0x2a'),_0xbeb2('0x72'),util[_0xbeb2('0x2b')](_0x211215,{'showHidden':![],'depth':null}));}})['catch'](function(_0x2b77d6){return logger[_0xbeb2('0x1a')](_0xbeb2('0x29'),_0xbeb2('0x2a'),_0xbeb2('0x72'),util[_0xbeb2('0x2b')](_0x2b77d6,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0xbeb2('0x29'),_0xbeb2('0x2a'),_0xbeb2('0x72'),'Token\x20not\x20received');}break;}}})[_0xbeb2('0x79')](function(){_0x120c1f();});}else{_0x120c1f();}}},'charset':_0xbeb2('0x7a'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 222bfda..a0028ff 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 _0x21f7=['options','raw','debug','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','redis','socket.io-emitter','register','info','SmsMessage,\x20%s,\x20%s','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','CreateSmsMessage','create','body'];(function(_0x3e0393,_0x460ec4){var _0x3099bc=function(_0x147b30){while(--_0x147b30){_0x3e0393['push'](_0x3e0393['shift']());}};_0x3099bc(++_0x460ec4);}(_0x21f7,0x122));var _0x721f=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x21f7[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x721f('0x0'));var util=require(_0x721f('0x1'));var moment=require(_0x721f('0x2'));var BPromise=require(_0x721f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x721f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x721f('0x5'));var logger=require('../../config/logger')(_0x721f('0x6'));var config=require(_0x721f('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x721f('0x8')]=_['defaults'](config[_0x721f('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x721f('0x9'))(new Redis(config['redis']));require('./smsMessage.socket')[_0x721f('0xa')](socket);function respondWithRpcPromise(_0x4381a1,_0x3960d8,_0x3969af){return new BPromise(function(_0x2a9bfa,_0x3c36c2){return client['request'](_0x4381a1,_0x3969af)['then'](function(_0x3d4cfe){logger[_0x721f('0xb')](_0x721f('0xc'),_0x3960d8,_0x721f('0xd'));logger['debug'](_0x721f('0xe'),_0x3960d8,_0x721f('0xd'),JSON[_0x721f('0xf')](_0x3d4cfe));if(_0x3d4cfe[_0x721f('0x10')]){if(_0x3d4cfe[_0x721f('0x10')]['code']===0x1f4){logger['error']('SmsMessage,\x20%s,\x20%s',_0x3960d8,_0x3d4cfe[_0x721f('0x10')][_0x721f('0x11')]);return _0x3c36c2(_0x3d4cfe['error'][_0x721f('0x11')]);}logger[_0x721f('0x10')]('SmsMessage,\x20%s,\x20%s',_0x3960d8,_0x3d4cfe[_0x721f('0x10')][_0x721f('0x11')]);return _0x2a9bfa(_0x3d4cfe[_0x721f('0x10')]['message']);}else{logger[_0x721f('0xb')](_0x721f('0xc'),_0x3960d8,_0x721f('0xd'));_0x2a9bfa(_0x3d4cfe[_0x721f('0x12')]['message']);}})['catch'](function(_0x437581){logger[_0x721f('0x10')](_0x721f('0xc'),_0x3960d8,_0x437581);_0x3c36c2(_0x437581);});});}exports[_0x721f('0x13')]=function(_0x2a2c1e){var _0x3bed17=this;return new Promise(function(_0x3fcd72,_0x2212b6){return db['SmsMessage'][_0x721f('0x14')](_0x2a2c1e[_0x721f('0x15')],{'raw':_0x2a2c1e[_0x721f('0x16')]?_0x2a2c1e[_0x721f('0x16')][_0x721f('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x3fcd6f){logger[_0x721f('0xb')]('CreateSmsMessage',_0x2a2c1e);logger[_0x721f('0x18')](_0x721f('0x13'),_0x2a2c1e,JSON[_0x721f('0xf')](_0x3fcd6f));_0x3fcd72(_0x3fcd6f);})[_0x721f('0x19')](function(_0x58f9b8){logger[_0x721f('0x10')](_0x721f('0x13'),_0x58f9b8['message'],_0x2a2c1e);_0x2212b6(_0x3bed17[_0x721f('0x10')](0x1f4,_0x58f9b8[_0x721f('0x11')]));});});}; \ No newline at end of file +var _0xbfc1=['error','code','SmsMessage,\x20%s,\x20%s','message','result','catch','CreateSmsMessage','SmsMessage','create','body','options','then','stringify','lodash','util','moment','ioredis','../../config/utils','rpc','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./smsMessage.socket','request','info','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s'];(function(_0x92f447,_0xa8b55b){var _0x37f599=function(_0x25f0fd){while(--_0x25f0fd){_0x92f447['push'](_0x92f447['shift']());}};_0x37f599(++_0xa8b55b);}(_0xbfc1,0x89));var _0x1bfc=function(_0x2b3053,_0x1e237){_0x2b3053=_0x2b3053-0x0;var _0x21ba88=_0xbfc1[_0x2b3053];return _0x21ba88;};'use strict';var _=require(_0x1bfc('0x0'));var util=require(_0x1bfc('0x1'));var moment=require(_0x1bfc('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1bfc('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1bfc('0x4'));var logger=require('../../config/logger')(_0x1bfc('0x5'));var config=require('../../config/environment');var jayson=require(_0x1bfc('0x6'));var client=jayson['client'][_0x1bfc('0x7')]({'port':0x232a});config['redis']=_[_0x1bfc('0x8')](config[_0x1bfc('0x9')],{'host':_0x1bfc('0xa'),'port':0x18eb});var socket=require(_0x1bfc('0xb'))(new Redis(config[_0x1bfc('0x9')]));require(_0x1bfc('0xc'))['register'](socket);function respondWithRpcPromise(_0x3a771e,_0x8df809,_0x1c5d64){return new BPromise(function(_0x122a42,_0x32931f){return client[_0x1bfc('0xd')](_0x3a771e,_0x1c5d64)['then'](function(_0x2d275c){logger[_0x1bfc('0xe')]('SmsMessage,\x20%s,\x20%s',_0x8df809,_0x1bfc('0xf'));logger[_0x1bfc('0x10')](_0x1bfc('0x11'),_0x8df809,_0x1bfc('0xf'),JSON['stringify'](_0x2d275c));if(_0x2d275c[_0x1bfc('0x12')]){if(_0x2d275c['error'][_0x1bfc('0x13')]===0x1f4){logger['error'](_0x1bfc('0x14'),_0x8df809,_0x2d275c['error']['message']);return _0x32931f(_0x2d275c[_0x1bfc('0x12')]['message']);}logger['error'](_0x1bfc('0x14'),_0x8df809,_0x2d275c['error']['message']);return _0x122a42(_0x2d275c[_0x1bfc('0x12')][_0x1bfc('0x15')]);}else{logger[_0x1bfc('0xe')](_0x1bfc('0x14'),_0x8df809,'request\x20sent');_0x122a42(_0x2d275c[_0x1bfc('0x16')]['message']);}})[_0x1bfc('0x17')](function(_0x4426f7){logger[_0x1bfc('0x12')](_0x1bfc('0x14'),_0x8df809,_0x4426f7);_0x32931f(_0x4426f7);});});}exports[_0x1bfc('0x18')]=function(_0x54f5fd){var _0x5b13df=this;return new Promise(function(_0xad54c4,_0x42a45b){return db[_0x1bfc('0x19')][_0x1bfc('0x1a')](_0x54f5fd[_0x1bfc('0x1b')],{'raw':_0x54f5fd[_0x1bfc('0x1c')]?_0x54f5fd[_0x1bfc('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0x1bfc('0x1d')](function(_0x3da380){logger['info'](_0x1bfc('0x18'),_0x54f5fd);logger['debug']('CreateSmsMessage',_0x54f5fd,JSON[_0x1bfc('0x1e')](_0x3da380));_0xad54c4(_0x3da380);})[_0x1bfc('0x17')](function(_0x5e33b7){logger[_0x1bfc('0x12')](_0x1bfc('0x18'),_0x5e33b7[_0x1bfc('0x15')],_0x54f5fd);_0x42a45b(_0x5b13df['error'](0x1f4,_0x5e33b7[_0x1bfc('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 1f47b97..2a2bda2 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 _0x5f30=['removeListener','length','smsMessage:','save','remove','update','emit'];(function(_0x13f5fe,_0x460a12){var _0x481c05=function(_0x1a9749){while(--_0x1a9749){_0x13f5fe['push'](_0x13f5fe['shift']());}};_0x481c05(++_0x460a12);}(_0x5f30,0xb2));var _0x05f3=function(_0x5574ba,_0xe59e20){_0x5574ba=_0x5574ba-0x0;var _0x2f5c55=_0x5f30[_0x5574ba];return _0x2f5c55;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0x05f3('0x0'),_0x05f3('0x1'),_0x05f3('0x2')];function createListener(_0x1944b7,_0x1d7a31){return function(_0x306a8d){_0x1d7a31[_0x05f3('0x3')](_0x1944b7,_0x306a8d);};}function removeListener(_0x378564,_0x5057b2){return function(){SmsMessageEvents[_0x05f3('0x4')](_0x378564,_0x5057b2);};}exports['register']=function(_0x2f4903){for(var _0x5261eb=0x0,_0x50d567=events[_0x05f3('0x5')];_0x5261eb<_0x50d567;_0x5261eb++){var _0x843c9=events[_0x5261eb];var _0x5e4a16=createListener(_0x05f3('0x6')+_0x843c9,_0x2f4903);SmsMessageEvents['on'](_0x843c9,_0x5e4a16);}}; \ No newline at end of file +var _0x5989=['smsMessage:','./smsMessage.events','save','remove','update','emit','removeListener','register','length'];(function(_0x570d69,_0x249040){var _0x388a08=function(_0x57ef40){while(--_0x57ef40){_0x570d69['push'](_0x570d69['shift']());}};_0x388a08(++_0x249040);}(_0x5989,0x64));var _0x9598=function(_0x2f0635,_0x561286){_0x2f0635=_0x2f0635-0x0;var _0x1873ab=_0x5989[_0x2f0635];return _0x1873ab;};'use strict';var SmsMessageEvents=require(_0x9598('0x0'));var events=[_0x9598('0x1'),_0x9598('0x2'),_0x9598('0x3')];function createListener(_0xee7aae,_0x54491f){return function(_0x5b3f19){_0x54491f[_0x9598('0x4')](_0xee7aae,_0x5b3f19);};}function removeListener(_0x33c0c2,_0x4a9383){return function(){SmsMessageEvents[_0x9598('0x5')](_0x33c0c2,_0x4a9383);};}exports[_0x9598('0x6')]=function(_0x308dcd){for(var _0x2831b3=0x0,_0x3209a2=events[_0x9598('0x7')];_0x2831b3<_0x3209a2;_0x2831b3++){var _0x4dfbd7=events[_0x2831b3];var _0x44707c=createListener(_0x9598('0x8')+_0x4dfbd7,_0x308dcd);SmsMessageEvents['on'](_0x4dfbd7,_0x44707c);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index ceb4b0c..919487b 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 _0x4cbd=['index','/describe','describe','/:id','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','/:id/teams','addAgents','put','update','delete','removeTeams','removeAgents','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4cbd,0x90));var _0xd4cb=function(_0x111c47,_0x2c867b){_0x111c47=_0x111c47-0x0;var _0x30790f=_0x4cbd[_0x111c47];return _0x30790f;};'use strict';var multer=require(_0xd4cb('0x0'));var util=require(_0xd4cb('0x1'));var path=require(_0xd4cb('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd4cb('0x3')]();var fs_extra=require(_0xd4cb('0x4'));var auth=require(_0xd4cb('0x5'));var interaction=require(_0xd4cb('0x6'));var config=require(_0xd4cb('0x7'));var controller=require(_0xd4cb('0x8'));router[_0xd4cb('0x9')]('/',auth[_0xd4cb('0xa')](),controller[_0xd4cb('0xb')]);router['get'](_0xd4cb('0xc'),auth[_0xd4cb('0xa')](),controller[_0xd4cb('0xd')]);router[_0xd4cb('0x9')](_0xd4cb('0xe'),auth[_0xd4cb('0xa')](),controller[_0xd4cb('0xf')]);router['get'](_0xd4cb('0x10'),auth[_0xd4cb('0xa')](),controller[_0xd4cb('0x11')]);router[_0xd4cb('0x9')]('/:id/teams',auth['isAuthenticated'](),controller[_0xd4cb('0x12')]);router['get'](_0xd4cb('0x13'),auth[_0xd4cb('0xa')](),controller[_0xd4cb('0x14')]);router[_0xd4cb('0x15')]('/',auth[_0xd4cb('0xa')](),controller[_0xd4cb('0x16')]);router[_0xd4cb('0x15')](_0xd4cb('0x17'),auth[_0xd4cb('0xa')](),controller['addTeams']);router[_0xd4cb('0x15')]('/:id/users',auth[_0xd4cb('0xa')](),controller[_0xd4cb('0x18')]);router[_0xd4cb('0x19')](_0xd4cb('0xe'),auth[_0xd4cb('0xa')](),controller[_0xd4cb('0x1a')]);router[_0xd4cb('0x1b')](_0xd4cb('0xe'),auth['isAuthenticated'](),controller['destroy']);router[_0xd4cb('0x1b')](_0xd4cb('0x17'),auth[_0xd4cb('0xa')](),controller[_0xd4cb('0x1c')]);router['delete'](_0xd4cb('0x13'),auth[_0xd4cb('0xa')](),controller[_0xd4cb('0x1d')]);module[_0xd4cb('0x1e')]=router; \ No newline at end of file +var _0x1d0e=['isAuthenticated','index','describe','/:id','show','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./smsQueue.controller','get'];(function(_0x504035,_0x39b5b6){var _0x527355=function(_0x3a6b55){while(--_0x3a6b55){_0x504035['push'](_0x504035['shift']());}};_0x527355(++_0x39b5b6);}(_0x1d0e,0x1de));var _0xe1d0=function(_0x5361c5,_0x1e8cdc){_0x5361c5=_0x5361c5-0x0;var _0x103727=_0x1d0e[_0x5361c5];return _0x103727;};'use strict';var multer=require(_0xe1d0('0x0'));var util=require(_0xe1d0('0x1'));var path=require('path');var timeout=require(_0xe1d0('0x2'));var express=require('express');var router=express[_0xe1d0('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xe1d0('0x4'));var interaction=require(_0xe1d0('0x5'));var config=require('../../config/environment');var controller=require(_0xe1d0('0x6'));router[_0xe1d0('0x7')]('/',auth[_0xe1d0('0x8')](),controller[_0xe1d0('0x9')]);router[_0xe1d0('0x7')]('/describe',auth[_0xe1d0('0x8')](),controller[_0xe1d0('0xa')]);router['get'](_0xe1d0('0xb'),auth[_0xe1d0('0x8')](),controller[_0xe1d0('0xc')]);router['get'](_0xe1d0('0xd'),auth['isAuthenticated'](),controller[_0xe1d0('0xe')]);router['get'](_0xe1d0('0xf'),auth['isAuthenticated'](),controller['getTeams']);router[_0xe1d0('0x7')](_0xe1d0('0x10'),auth[_0xe1d0('0x8')](),controller[_0xe1d0('0x11')]);router[_0xe1d0('0x12')]('/',auth[_0xe1d0('0x8')](),controller[_0xe1d0('0x13')]);router[_0xe1d0('0x12')](_0xe1d0('0xf'),auth[_0xe1d0('0x8')](),controller[_0xe1d0('0x14')]);router[_0xe1d0('0x12')](_0xe1d0('0x10'),auth['isAuthenticated'](),controller[_0xe1d0('0x15')]);router[_0xe1d0('0x16')]('/:id',auth[_0xe1d0('0x8')](),controller[_0xe1d0('0x17')]);router[_0xe1d0('0x18')](_0xe1d0('0xb'),auth[_0xe1d0('0x8')](),controller[_0xe1d0('0x19')]);router[_0xe1d0('0x18')](_0xe1d0('0xf'),auth[_0xe1d0('0x8')](),controller['removeTeams']);router[_0xe1d0('0x18')]('/:id/users',auth[_0xe1d0('0x8')](),controller['removeAgents']);module[_0xe1d0('0x1a')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 7eff37c..43cda81 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 _0x8152=['rrmemory','beepall','sequelize','exports','STRING','name','ENUM'];(function(_0x56aa12,_0x224ee4){var _0x3a710a=function(_0x96c962){while(--_0x96c962){_0x56aa12['push'](_0x56aa12['shift']());}};_0x3a710a(++_0x224ee4);}(_0x8152,0x64));var _0x2815=function(_0x559108,_0x4c08a4){_0x559108=_0x559108-0x0;var _0x9053f0=_0x8152[_0x559108];return _0x9053f0;};'use strict';var Sequelize=require(_0x2815('0x0'));module[_0x2815('0x1')]={'name':{'type':Sequelize[_0x2815('0x2')],'unique':_0x2815('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x2815('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x2815('0x4')](_0x2815('0x5'),_0x2815('0x6'),'roundrobin')}}; \ No newline at end of file +var _0x1d31=['rrmemory','beepall','roundrobin','sequelize','exports','name','STRING','ENUM'];(function(_0x16776d,_0x318a9c){var _0x529c25=function(_0x5da3cb){while(--_0x5da3cb){_0x16776d['push'](_0x16776d['shift']());}};_0x529c25(++_0x318a9c);}(_0x1d31,0x12b));var _0x11d3=function(_0x5a2285,_0x3212d1){_0x5a2285=_0x5a2285-0x0;var _0x48f6ed=_0x1d31[_0x5a2285];return _0x48f6ed;};'use strict';var Sequelize=require(_0x11d3('0x0'));module[_0x11d3('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x11d3('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x11d3('0x3')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x11d3('0x4')](_0x11d3('0x5'),_0x11d3('0x6'),_0x11d3('0x7'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 597987e..d2c601d 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 _0x5f66=['show','params','model','keys','intersection','attributes','fields','includeAll','merge','options','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SmsQueues','find','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','rawAttributes','filters','hasOwnProperty','order','sort','pick','map','UserSmsQueue','User','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','%s/%s','SIP','getTeams','length','filter','nolimit','ids','Team','Agents','interface','flatMap','sequelize','transaction','addTeams','forEach','emit','userSmsQueue:save','removeTeams','select','tq.TeamId','team_has_sms_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','includes','all','compact','value','isEmpty','removeAgents','userSmsQueue:remove','addAgents','spread','isArray','findOne','getAgents','util','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','defaults','redis','./smsQueue.socket','register','end','json','offset','limit','undefined','count','status','update','then','UserProfileResource','destroy','sendStatus','stack','name','send','index','fieldName','key','getOptions','where','SmsQueue','include','query','findAll','catch'];(function(_0x3ac31a,_0x18f1b9){var _0x4caa11=function(_0x2d2211){while(--_0x2d2211){_0x3ac31a['push'](_0x3ac31a['shift']());}};_0x4caa11(++_0x18f1b9);}(_0x5f66,0x1a0));var _0x65f6=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x5f66[_0x5d4607];return _0x5e4a86;};'use strict';var BPromise=require('bluebird');var util=require(_0x65f6('0x0'));var _=require('lodash');var squel=require(_0x65f6('0x1'));var Redis=require(_0x65f6('0x2'));var qs=require(_0x65f6('0x3'));var logger=require(_0x65f6('0x4'))(_0x65f6('0x5'));var config=require('../../config/environment');var db=require(_0x65f6('0x6'))['db'];config['redis']=_[_0x65f6('0x7')](config[_0x65f6('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x65f6('0x8')]));require(_0x65f6('0x9'))[_0x65f6('0xa')](socket);function respondWithStatusCode(_0x8f6451,_0xc44c70){_0xc44c70=_0xc44c70||0xcc;return function(_0x14f4c7){if(_0x14f4c7){return _0x8f6451['sendStatus'](_0xc44c70);}return _0x8f6451['status'](_0xc44c70)[_0x65f6('0xb')]();};}function respondWithResult(_0x2f6d5b,_0x264647){_0x264647=_0x264647||0xc8;return function(_0x25c416){if(_0x25c416){return _0x2f6d5b['status'](_0x264647)[_0x65f6('0xc')](_0x25c416);}};}function respondWithFilteredResult(_0x571436,_0x497cf3){return function(_0x2d2dfa){if(_0x2d2dfa){var _0x576875=typeof _0x497cf3[_0x65f6('0xd')]==='undefined'&&typeof _0x497cf3[_0x65f6('0xe')]===_0x65f6('0xf');var _0x2c4ee5=_0x2d2dfa[_0x65f6('0x10')];var _0x369f96=_0x576875?0x0:_0x497cf3[_0x65f6('0xd')];var _0x44144b=_0x576875?_0x2d2dfa[_0x65f6('0x10')]:_0x497cf3[_0x65f6('0xd')]+_0x497cf3[_0x65f6('0xe')];var _0x59154e;if(_0x44144b>=_0x2c4ee5){_0x44144b=_0x2c4ee5;_0x59154e=0xc8;}else{_0x59154e=0xce;}_0x571436[_0x65f6('0x11')](_0x59154e);return _0x571436['set']('Content-Range',_0x369f96+'-'+_0x44144b+'/'+_0x2c4ee5)[_0x65f6('0xc')](_0x2d2dfa);}return null;};}function saveUpdates(_0x5c69f8){return function(_0x37330d){if(_0x37330d){return _0x37330d[_0x65f6('0x12')](_0x5c69f8)[_0x65f6('0x13')](function(_0x1f974c){return _0x1f974c;});}return null;};}function removeEntity(_0xc8660c){return function(_0x18380e){if(_0x18380e){return _0x18380e['destroy']()['then'](function(){var _0x2d538c=_0x18380e['get']({'plain':!![]});var _0x4c81f3='SmsQueues';return db[_0x65f6('0x14')][_0x65f6('0x15')]({'where':{'type':_0x4c81f3,'resourceId':_0x2d538c['id']}})['then'](function(){return _0x18380e;});})[_0x65f6('0x13')](function(){_0xc8660c[_0x65f6('0x11')](0xcc)[_0x65f6('0xb')]();});}};}function handleEntityNotFound(_0x3876ed){return function(_0x219ab2){if(!_0x219ab2){_0x3876ed[_0x65f6('0x16')](0x194);}return _0x219ab2;};}function handleError(_0x581374,_0x197a49){_0x197a49=_0x197a49||0x1f4;return function(_0x4bb39e){logger['error'](_0x4bb39e[_0x65f6('0x17')]);if(_0x4bb39e[_0x65f6('0x18')]){delete _0x4bb39e['name'];}_0x581374[_0x65f6('0x11')](_0x197a49)[_0x65f6('0x19')](_0x4bb39e);};}exports[_0x65f6('0x1a')]=function(_0x2774a1,_0x4f5a69){var _0x9d7bb0={};var _0x59ea32={'count':0x0,'rows':[]};var _0x20a161=_['map'](db['SmsQueue']['rawAttributes'],function(_0x29abdb){return{'name':_0x29abdb[_0x65f6('0x1b')],'type':_0x29abdb['type'][_0x65f6('0x1c')]};});_0x9d7bb0=qs[_0x65f6('0x1d')](_0x20a161,_0x2774a1);var _0x52277c={'where':_0x9d7bb0[_0x65f6('0x1e')]};return db[_0x65f6('0x1f')][_0x65f6('0x10')](_0x52277c)['then'](function(_0x4ac04b){_0x59ea32['count']=_0x4ac04b;_0x9d7bb0[_0x65f6('0x20')]=qs[_0x65f6('0x20')](_0x2774a1[_0x65f6('0x21')]);return db[_0x65f6('0x1f')][_0x65f6('0x22')](_0x9d7bb0);})[_0x65f6('0x13')](function(_0x144e55){_0x59ea32['rows']=_0x144e55;return _0x59ea32;})['then'](respondWithFilteredResult(_0x4f5a69,_0x9d7bb0))[_0x65f6('0x23')](handleError(_0x4f5a69,null));};exports[_0x65f6('0x24')]=function(_0x5878bc,_0x4e50c0){var _0x10b368={'raw':!![],'where':{'id':_0x5878bc[_0x65f6('0x25')]['id']}},_0x1ce43c={};_0x1ce43c[_0x65f6('0x26')]=_[_0x65f6('0x27')](db[_0x65f6('0x1f')]['rawAttributes']);_0x1ce43c[_0x65f6('0x21')]=_[_0x65f6('0x27')](_0x5878bc[_0x65f6('0x21')]);_0x1ce43c['filters']=_[_0x65f6('0x28')](_0x1ce43c[_0x65f6('0x26')],_0x1ce43c[_0x65f6('0x21')]);_0x10b368[_0x65f6('0x29')]=_[_0x65f6('0x28')](_0x1ce43c[_0x65f6('0x26')],qs['fields'](_0x5878bc[_0x65f6('0x21')][_0x65f6('0x2a')]));_0x10b368['attributes']=_0x10b368[_0x65f6('0x29')]['length']?_0x10b368[_0x65f6('0x29')]:_0x1ce43c['model'];if(_0x5878bc[_0x65f6('0x21')][_0x65f6('0x2b')]){_0x10b368['include']=[{'all':!![]}];}_0x10b368=_[_0x65f6('0x2c')]({},_0x10b368,_0x5878bc[_0x65f6('0x2d')]);return db[_0x65f6('0x1f')]['find'](_0x10b368)['then'](handleEntityNotFound(_0x4e50c0,null))[_0x65f6('0x13')](respondWithResult(_0x4e50c0,null))['catch'](handleError(_0x4e50c0,null));};exports[_0x65f6('0x2e')]=function(_0x4e6653,_0x22d760){return db[_0x65f6('0x1f')]['create'](_0x4e6653[_0x65f6('0x2f')],{})['then'](function(_0x5edd04){var _0x71b16b=_0x4e6653[_0x65f6('0x30')][_0x65f6('0x31')]({'plain':!![]});if(!_0x71b16b)throw new Error(_0x65f6('0x32'));if(_0x71b16b[_0x65f6('0x33')]===_0x65f6('0x30')){var _0x1a55da=_0x5edd04[_0x65f6('0x31')]({'plain':!![]});var _0x4f933b=_0x65f6('0x34');return db['UserProfileSection'][_0x65f6('0x35')]({'where':{'name':_0x4f933b,'userProfileId':_0x71b16b[_0x65f6('0x36')]},'raw':!![]})[_0x65f6('0x13')](function(_0x2ea7f7){if(_0x2ea7f7&&_0x2ea7f7['autoAssociation']===0x0){return db[_0x65f6('0x14')][_0x65f6('0x2e')]({'name':_0x1a55da[_0x65f6('0x18')],'resourceId':_0x1a55da['id'],'type':_0x2ea7f7[_0x65f6('0x18')],'sectionId':_0x2ea7f7['id']},{})[_0x65f6('0x13')](function(){return _0x5edd04;});}else{return _0x5edd04;}})[_0x65f6('0x23')](function(_0xed4c96){logger[_0x65f6('0x37')](_0x65f6('0x38'),_0xed4c96);throw _0xed4c96;});}return _0x5edd04;})['then'](respondWithResult(_0x22d760,0xc9))[_0x65f6('0x23')](handleError(_0x22d760,null));};exports[_0x65f6('0x12')]=function(_0x377ae5,_0x181798){if(_0x377ae5[_0x65f6('0x2f')]['id']){delete _0x377ae5[_0x65f6('0x2f')]['id'];}return db[_0x65f6('0x1f')][_0x65f6('0x35')]({'where':{'id':_0x377ae5[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x181798,null))[_0x65f6('0x13')](saveUpdates(_0x377ae5[_0x65f6('0x2f')],null))[_0x65f6('0x13')](respondWithResult(_0x181798,null))[_0x65f6('0x23')](handleError(_0x181798,null));};exports[_0x65f6('0x15')]=function(_0x2cb38d,_0x5119ee){return db[_0x65f6('0x1f')][_0x65f6('0x35')]({'where':{'id':_0x2cb38d[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x5119ee,null))['then'](removeEntity(_0x5119ee,null))[_0x65f6('0x23')](handleError(_0x5119ee,null));};exports[_0x65f6('0x39')]=function(_0x2b01eb,_0x5e69b4){return db[_0x65f6('0x1f')][_0x65f6('0x39')]()[_0x65f6('0x13')](respondWithResult(_0x5e69b4,null))[_0x65f6('0x23')](handleError(_0x5e69b4,null));};exports['getMembers']=function(_0x2ec114,_0x512527){var _0x3f1baa={'raw':!![],'where':{}},_0x6968b={},_0x577c93;return db[_0x65f6('0x1f')]['findOne']({'where':{'id':_0x2ec114[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x512527,null))[_0x65f6('0x13')](function(_0xc0db01){if(_0xc0db01){_0x577c93=_0xc0db01[_0x65f6('0x31')]({'plain':!![]});_0x6968b[_0x65f6('0x26')]=_['keys'](db['UserSmsQueue'][_0x65f6('0x3a')]);_0x6968b[_0x65f6('0x21')]=_[_0x65f6('0x27')](_0x2ec114[_0x65f6('0x21')]);_0x6968b[_0x65f6('0x3b')]=_[_0x65f6('0x28')](_0x6968b[_0x65f6('0x26')],_0x6968b[_0x65f6('0x21')]);_0x3f1baa[_0x65f6('0x29')]=_['intersection'](_0x6968b[_0x65f6('0x26')],qs[_0x65f6('0x2a')](_0x2ec114[_0x65f6('0x21')]['fields']));_0x3f1baa[_0x65f6('0x29')]=_0x3f1baa[_0x65f6('0x29')]['length']?_0x3f1baa[_0x65f6('0x29')]:_0x6968b[_0x65f6('0x26')];if(!_0x2ec114['query'][_0x65f6('0x3c')]('nolimit')){_0x3f1baa[_0x65f6('0xe')]=qs[_0x65f6('0xe')](_0x2ec114[_0x65f6('0x21')]['limit']);_0x3f1baa[_0x65f6('0xd')]=qs[_0x65f6('0xd')](_0x2ec114['query'][_0x65f6('0xd')]);}_0x3f1baa[_0x65f6('0x3d')]=qs['sort'](_0x2ec114[_0x65f6('0x21')][_0x65f6('0x3e')]);_0x3f1baa[_0x65f6('0x1e')]=qs[_0x65f6('0x3b')](_[_0x65f6('0x3f')](_0x2ec114[_0x65f6('0x21')],_0x6968b[_0x65f6('0x3b')]));_0x3f1baa[_0x65f6('0x1e')]['SmsQueueId']=_0xc0db01['id'];if(_0x2ec114['query']['filter']){_0x3f1baa[_0x65f6('0x1e')]=_[_0x65f6('0x2c')](_0x3f1baa[_0x65f6('0x1e')],{'$or':_[_0x65f6('0x40')](_0x3f1baa['attributes'],function(_0x183c08){var _0x2032b9={};_0x2032b9[_0x183c08]={'$like':'%'+_0x2ec114[_0x65f6('0x21')]['filter']+'%'};return _0x2032b9;})});}_0x3f1baa=_[_0x65f6('0x2c')]({},_0x3f1baa,_0x2ec114[_0x65f6('0x2d')]);return db[_0x65f6('0x41')]['findAll'](_0x3f1baa);}})['then'](function(_0x1d337d){if(_0x1d337d){return db[_0x65f6('0x42')][_0x65f6('0x43')]({'where':{'id':_[_0x65f6('0x40')](_0x1d337d,_0x65f6('0x44')),'role':_0x65f6('0x45')},'attributes':['id',_0x65f6('0x18'),_0x65f6('0x46'),_0x65f6('0x47'),_0x65f6('0x48')]});}})[_0x65f6('0x13')](function(_0x141fcc){if(_0x141fcc){return{'count':_0x141fcc[_0x65f6('0x10')],'rows':_[_0x65f6('0x40')](_0x141fcc['rows'],function(_0x47610a){return{'membername':_0x47610a[_0x65f6('0x18')],'UserId':_0x47610a['id'],'queue_name':_0x577c93[_0x65f6('0x18')],'SmsQueueId':_0x577c93['id'],'interface':util['format'](_0x65f6('0x49'),_0x65f6('0x4a'),_0x47610a[_0x65f6('0x18')]),'penalty':0x0,'paused':_0x47610a[_0x65f6('0x46')],'createdAt':_0x47610a['createdAt'],'updatedAt':_0x47610a[_0x65f6('0x47')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x65f6('0x13')](respondWithFilteredResult(_0x512527,_0x3f1baa))[_0x65f6('0x23')](handleError(_0x512527,null));};exports[_0x65f6('0x4b')]=function(_0x553ff0,_0x2923ff){var _0x2fc20f={};var _0x5c55e4={};var _0x28682b;var _0x26481e;return db[_0x65f6('0x1f')]['findOne']({'where':{'id':_0x553ff0[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x2923ff,null))[_0x65f6('0x13')](function(_0x3c23e3){if(_0x3c23e3){_0x28682b=_0x3c23e3;_0x5c55e4[_0x65f6('0x26')]=_[_0x65f6('0x27')](db['Team']['rawAttributes']);_0x5c55e4['query']=_[_0x65f6('0x27')](_0x553ff0[_0x65f6('0x21')]);_0x5c55e4[_0x65f6('0x3b')]=_[_0x65f6('0x28')](_0x5c55e4[_0x65f6('0x26')],_0x5c55e4[_0x65f6('0x21')]);_0x2fc20f['attributes']=_[_0x65f6('0x28')](_0x5c55e4[_0x65f6('0x26')],qs['fields'](_0x553ff0[_0x65f6('0x21')][_0x65f6('0x2a')]));_0x2fc20f[_0x65f6('0x29')]=_0x2fc20f['attributes'][_0x65f6('0x4c')]?_0x2fc20f[_0x65f6('0x29')]:_0x5c55e4['model'];_0x2fc20f[_0x65f6('0x3d')]=qs[_0x65f6('0x3e')](_0x553ff0[_0x65f6('0x21')][_0x65f6('0x3e')]);_0x2fc20f[_0x65f6('0x1e')]=qs[_0x65f6('0x3b')](_[_0x65f6('0x3f')](_0x553ff0['query'],_0x5c55e4['filters']));if(_0x553ff0[_0x65f6('0x21')][_0x65f6('0x4d')]){_0x2fc20f['where']=_[_0x65f6('0x2c')](_0x2fc20f['where'],{'$or':_[_0x65f6('0x40')](_0x2fc20f['attributes'],function(_0x440df1){var _0xdc8989={};_0xdc8989[_0x440df1]={'$like':'%'+_0x553ff0[_0x65f6('0x21')][_0x65f6('0x4d')]+'%'};return _0xdc8989;})});}_0x2fc20f=_[_0x65f6('0x2c')]({},_0x2fc20f,_0x553ff0[_0x65f6('0x2d')]);return _0x28682b[_0x65f6('0x4b')](_0x2fc20f);}})[_0x65f6('0x13')](function(_0x2405a7){if(_0x2405a7){_0x26481e=_0x2405a7['length'];if(!_0x553ff0['query'][_0x65f6('0x3c')](_0x65f6('0x4e'))){_0x2fc20f[_0x65f6('0xe')]=qs['limit'](_0x553ff0['query'][_0x65f6('0xe')]);_0x2fc20f[_0x65f6('0xd')]=qs[_0x65f6('0xd')](_0x553ff0[_0x65f6('0x21')][_0x65f6('0xd')]);}return _0x28682b[_0x65f6('0x4b')](_0x2fc20f);}})['then'](function(_0x4f42ae){if(_0x4f42ae){return _0x4f42ae?{'count':_0x26481e,'rows':_0x4f42ae}:null;}})[_0x65f6('0x13')](respondWithResult(_0x2923ff,null))[_0x65f6('0x23')](handleError(_0x2923ff,null));};exports['addTeams']=function(_0x219bf8,_0x4a8b60){var _0x254e9f=_0x219bf8[_0x65f6('0x2f')][_0x65f6('0x4f')];return db[_0x65f6('0x50')]['findAll']({'where':{'id':_0x254e9f},'attributes':['id'],'include':[{'model':db[_0x65f6('0x42')],'as':_0x65f6('0x51'),'attributes':['id',_0x65f6('0x18'),'online','voicePause',_0x65f6('0x52')],'raw':!![]}]})['then'](function(_0x305967){if(_0x305967){var _0xf6de=_[_0x65f6('0x53')](_0x305967,function(_0x354b90){var _0x512776=_0x354b90['get']({'plain':!![]});return _0x512776['Agents'];});return db[_0x65f6('0x1f')][_0x65f6('0x35')]({'where':{'id':_0x219bf8[_0x65f6('0x25')]['id']}})['then'](function(_0x46cbde){return db[_0x65f6('0x54')][_0x65f6('0x55')](function(_0x49cee2){return _0x46cbde[_0x65f6('0x56')](_0x254e9f,{'transaction':_0x49cee2})[_0x65f6('0x13')](function(){return BPromise['each'](_0xf6de,function(_0x758e80){return db[_0x65f6('0x41')]['findOrCreate']({'where':{'UserId':_0x758e80['id'],'SmsQueueId':_0x219bf8[_0x65f6('0x25')]['id']},'transaction':_0x49cee2});});})['then'](function(){_0xf6de[_0x65f6('0x57')](function(_0x55ea91){socket[_0x65f6('0x58')](_0x65f6('0x59'),{'UserId':_0x55ea91['id'],'SmsQueueId':_0x46cbde['id']});});});});});}})['then'](respondWithStatusCode(_0x4a8b60,null))[_0x65f6('0x23')](handleError(_0x4a8b60,null));};exports[_0x65f6('0x5a')]=function(_0x2a700b,_0x299b85){return db[_0x65f6('0x50')][_0x65f6('0x22')]({'where':{'id':_0x2a700b[_0x65f6('0x21')][_0x65f6('0x4f')]},'attributes':['id'],'include':[{'model':db[_0x65f6('0x42')],'as':_0x65f6('0x51'),'attributes':['id'],'raw':!![]}]})[_0x65f6('0x13')](handleEntityNotFound(_0x299b85,null))['then'](function(_0x10a661){var _0x1cf1bd=_[_0x65f6('0x40')](_0x10a661,'id');var _0x219e42=[];var _0x5694f9=[];var _0x453080=squel[_0x65f6('0x5b')]();_0x453080['field'](_0x65f6('0x5c'))['from'](_0x65f6('0x5d'),'tq')['join'](_0x65f6('0x5e'),'ut',_0x65f6('0x5f'))['where']('SmsQueueId\x20=\x20?',_0x2a700b[_0x65f6('0x25')]['id']);for(var _0x413c21=0x0;_0x413c21<_0x10a661['length'];_0x413c21+=0x1){let _0x2d86c8=_0x10a661[_0x413c21];for(var _0x3b3bd5=0x0;_0x3b3bd5<_0x2d86c8[_0x65f6('0x51')]['length'];_0x3b3bd5+=0x1){let _0x1348ec=_0x2d86c8[_0x65f6('0x51')][_0x3b3bd5];var _0x5889dc=_0x453080[_0x65f6('0x60')]();_0x5889dc['where'](_0x65f6('0x61'),_0x1348ec['id']);_0x5694f9['push'](db['sequelize'][_0x65f6('0x21')](_0x5889dc[_0x65f6('0x62')](),{'type':db[_0x65f6('0x54')][_0x65f6('0x63')][_0x65f6('0x64')]})[_0x65f6('0x13')](function(_0x1ac46f){if(_0x1ac46f[_0x65f6('0x4c')]===0x1){return _0x1348ec['id'];}else{var _0x4d66fe=_['every'](_[_0x65f6('0x40')](_0x1ac46f,'TeamId'),function(_0x1ee28a){return _[_0x65f6('0x65')](_0x1cf1bd,_0x1ee28a);});if(_0x4d66fe){return _0x1348ec['id'];}}}));}}return BPromise[_0x65f6('0x66')](_0x5694f9)[_0x65f6('0x13')](function(_0x43127b){_0x219e42=_(_0x219e42)['union'](_0x43127b)[_0x65f6('0x67')]()[_0x65f6('0x68')]();return db[_0x65f6('0x1f')]['find']({'where':{'id':_0x2a700b[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](function(_0x4254c2){return db[_0x65f6('0x54')][_0x65f6('0x55')](function(_0x16bf93){return _0x4254c2['removeTeams'](_0x2a700b['query'][_0x65f6('0x4f')],{'transaction':_0x16bf93})[_0x65f6('0x13')](function(){if(!_[_0x65f6('0x69')](_0x219e42)){return _0x4254c2[_0x65f6('0x6a')](_0x219e42,{'transaction':_0x16bf93});}})['then'](function(){_0x219e42['forEach'](function(_0x336076){socket[_0x65f6('0x58')](_0x65f6('0x6b'),{'UserId':_0x336076,'SmsQueueId':_0x4254c2['id']});});});});});});})[_0x65f6('0x13')](respondWithStatusCode(_0x299b85,null))[_0x65f6('0x23')](handleError(_0x299b85,null));};exports[_0x65f6('0x6c')]=function(_0x5daaf4,_0x4d607a){return db['SmsQueue'][_0x65f6('0x35')]({'where':{'id':_0x5daaf4[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x4d607a,null))[_0x65f6('0x13')](function(_0x53b11c){if(_0x53b11c){return _0x53b11c['addAgents'](_0x5daaf4[_0x65f6('0x2f')][_0x65f6('0x4f')],_['omit'](_0x5daaf4[_0x65f6('0x2f')],['ids','id'])||{})[_0x65f6('0x6d')](function(_0x4f3ef8){for(var _0x3a30ed=0x0;_0x3a30ed<_0x5daaf4[_0x65f6('0x2f')]['ids'][_0x65f6('0x4c')];_0x3a30ed+=0x1){socket[_0x65f6('0x58')](_0x65f6('0x59'),{'UserId':Number(_0x5daaf4[_0x65f6('0x2f')][_0x65f6('0x4f')][_0x3a30ed]),'SmsQueueId':Number(_0x5daaf4[_0x65f6('0x25')]['id'])});}return _0x4f3ef8;});}})['then'](respondWithResult(_0x4d607a,null))[_0x65f6('0x23')](handleError(_0x4d607a,null));};exports['removeAgents']=function(_0x24495c,_0x56336a){return db[_0x65f6('0x1f')][_0x65f6('0x35')]({'where':{'id':_0x24495c[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x56336a,null))['then'](function(_0x2b6f98){if(_0x2b6f98){return _0x2b6f98[_0x65f6('0x6a')](_0x24495c[_0x65f6('0x21')]['ids'])['then'](function(){if(_[_0x65f6('0x6e')](_0x24495c[_0x65f6('0x21')]['ids'])){for(var _0x180cde=0x0;_0x180cde<_0x24495c[_0x65f6('0x21')][_0x65f6('0x4f')]['length'];_0x180cde+=0x1){socket[_0x65f6('0x58')](_0x65f6('0x6b'),{'UserId':Number(_0x24495c['query'][_0x65f6('0x4f')][_0x180cde]),'SmsQueueId':Number(_0x24495c[_0x65f6('0x25')]['id'])});}}else{socket[_0x65f6('0x58')]('userSmsQueue:remove',{'UserId':Number(_0x24495c[_0x65f6('0x21')][_0x65f6('0x4f')]),'SmsQueueId':Number(_0x24495c[_0x65f6('0x25')]['id'])});}});}})['then'](respondWithStatusCode(_0x56336a,null))[_0x65f6('0x23')](handleError(_0x56336a,null));};exports['getAgents']=function(_0x1beaa7,_0x87a9e4){var _0x31ec61={};var _0x22be6e={};var _0x29b2de;var _0x430fb8;return db['SmsQueue'][_0x65f6('0x6f')]({'where':{'id':_0x1beaa7[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x87a9e4,null))[_0x65f6('0x13')](function(_0x207d15){if(_0x207d15){_0x29b2de=_0x207d15;_0x22be6e['model']=_['keys'](db['User'][_0x65f6('0x3a')]);_0x22be6e[_0x65f6('0x21')]=_[_0x65f6('0x27')](_0x1beaa7['query']);_0x22be6e[_0x65f6('0x3b')]=_['intersection'](_0x22be6e['model'],_0x22be6e[_0x65f6('0x21')]);_0x31ec61[_0x65f6('0x29')]=_['intersection'](_0x22be6e[_0x65f6('0x26')],qs[_0x65f6('0x2a')](_0x1beaa7[_0x65f6('0x21')][_0x65f6('0x2a')]));_0x31ec61[_0x65f6('0x29')]=_0x31ec61[_0x65f6('0x29')][_0x65f6('0x4c')]?_0x31ec61[_0x65f6('0x29')]:_0x22be6e[_0x65f6('0x26')];_0x31ec61[_0x65f6('0x3d')]=qs[_0x65f6('0x3e')](_0x1beaa7[_0x65f6('0x21')]['sort']);_0x31ec61[_0x65f6('0x1e')]=qs['filters'](_['pick'](_0x1beaa7[_0x65f6('0x21')],_0x22be6e[_0x65f6('0x3b')]));if(_0x1beaa7[_0x65f6('0x21')][_0x65f6('0x4d')]){_0x31ec61['where']=_[_0x65f6('0x2c')](_0x31ec61['where'],{'$or':_['map'](_0x31ec61[_0x65f6('0x29')],function(_0x99fe6e){var _0x1a7e52={};_0x1a7e52[_0x99fe6e]={'$like':'%'+_0x1beaa7[_0x65f6('0x21')][_0x65f6('0x4d')]+'%'};return _0x1a7e52;})});}_0x31ec61=_[_0x65f6('0x2c')]({},_0x31ec61,_0x1beaa7['options']);return _0x29b2de[_0x65f6('0x70')](_0x31ec61);}})['then'](function(_0x1ef2a0){if(_0x1ef2a0){_0x430fb8=_0x1ef2a0[_0x65f6('0x4c')];if(!_0x1beaa7[_0x65f6('0x21')]['hasOwnProperty'](_0x65f6('0x4e'))){_0x31ec61['limit']=qs['limit'](_0x1beaa7[_0x65f6('0x21')][_0x65f6('0xe')]);_0x31ec61[_0x65f6('0xd')]=qs[_0x65f6('0xd')](_0x1beaa7[_0x65f6('0x21')]['offset']);}return _0x29b2de[_0x65f6('0x70')](_0x31ec61);}})[_0x65f6('0x13')](function(_0x3bebe3){if(_0x3bebe3){return _0x3bebe3?{'count':_0x430fb8,'rows':_0x3bebe3}:null;}})[_0x65f6('0x13')](respondWithResult(_0x87a9e4,null))['catch'](handleError(_0x87a9e4,null));}; \ No newline at end of file +var _0xdb28=['userSmsQueue:save','removeTeams','select','field','from','team_has_sms_queues','join','SmsQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','QueryTypes','TeamId','includes','all','union','value','isEmpty','removeAgents','forEach','addAgents','omit','spread','userSmsQueue:remove','getAgents','bluebird','util','lodash','squel','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','./smsQueue.socket','register','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','update','then','get','SmsQueues','destroy','error','stack','name','map','SmsQueue','fieldName','type','key','where','include','rows','show','keys','query','filters','intersection','model','attributes','fields','length','includeAll','merge','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','catch','body','params','describe','getMembers','findOne','UserSmsQueue','rawAttributes','hasOwnProperty','nolimit','order','sort','SmsQueueId','filter','findAll','User','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','format','%s/%s','getTeams','Team','pick','ids','Agents','online','voicePause','interface','sequelize','transaction','addTeams','each','emit'];(function(_0x48b6ef,_0x1cdf0b){var _0x98e969=function(_0x157082){while(--_0x157082){_0x48b6ef['push'](_0x48b6ef['shift']());}};_0x98e969(++_0x1cdf0b);}(_0xdb28,0x106));var _0x8db2=function(_0x60113f,_0x4c61a2){_0x60113f=_0x60113f-0x0;var _0x3bc8d3=_0xdb28[_0x60113f];return _0x3bc8d3;};'use strict';var BPromise=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var _=require(_0x8db2('0x2'));var squel=require(_0x8db2('0x3'));var Redis=require('ioredis');var qs=require(_0x8db2('0x4'));var logger=require(_0x8db2('0x5'))(_0x8db2('0x6'));var config=require(_0x8db2('0x7'));var db=require(_0x8db2('0x8'))['db'];config['redis']=_[_0x8db2('0x9')](config[_0x8db2('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8db2('0xa')]));require(_0x8db2('0xb'))[_0x8db2('0xc')](socket);function respondWithStatusCode(_0x29f698,_0x2f3f2f){_0x2f3f2f=_0x2f3f2f||0xcc;return function(_0x1ff362){if(_0x1ff362){return _0x29f698[_0x8db2('0xd')](_0x2f3f2f);}return _0x29f698['status'](_0x2f3f2f)[_0x8db2('0xe')]();};}function respondWithResult(_0x476216,_0x1f62af){_0x1f62af=_0x1f62af||0xc8;return function(_0x57015f){if(_0x57015f){return _0x476216[_0x8db2('0xf')](_0x1f62af)[_0x8db2('0x10')](_0x57015f);}};}function respondWithFilteredResult(_0x576475,_0x41beda){return function(_0x3b2faa){if(_0x3b2faa){var _0x1349f6=typeof _0x41beda[_0x8db2('0x11')]===_0x8db2('0x12')&&typeof _0x41beda['limit']==='undefined';var _0x15070d=_0x3b2faa[_0x8db2('0x13')];var _0x350d61=_0x1349f6?0x0:_0x41beda[_0x8db2('0x11')];var _0x227355=_0x1349f6?_0x3b2faa[_0x8db2('0x13')]:_0x41beda[_0x8db2('0x11')]+_0x41beda[_0x8db2('0x14')];var _0x131252;if(_0x227355>=_0x15070d){_0x227355=_0x15070d;_0x131252=0xc8;}else{_0x131252=0xce;}_0x576475[_0x8db2('0xf')](_0x131252);return _0x576475['set'](_0x8db2('0x15'),_0x350d61+'-'+_0x227355+'/'+_0x15070d)[_0x8db2('0x10')](_0x3b2faa);}return null;};}function saveUpdates(_0x48101e){return function(_0x2b3f73){if(_0x2b3f73){return _0x2b3f73[_0x8db2('0x16')](_0x48101e)[_0x8db2('0x17')](function(_0x3fddc2){return _0x3fddc2;});}return null;};}function removeEntity(_0x2efd06){return function(_0x46ce14){if(_0x46ce14){return _0x46ce14['destroy']()['then'](function(){var _0x77789=_0x46ce14[_0x8db2('0x18')]({'plain':!![]});var _0x1310d3=_0x8db2('0x19');return db['UserProfileResource'][_0x8db2('0x1a')]({'where':{'type':_0x1310d3,'resourceId':_0x77789['id']}})[_0x8db2('0x17')](function(){return _0x46ce14;});})[_0x8db2('0x17')](function(){_0x2efd06[_0x8db2('0xf')](0xcc)[_0x8db2('0xe')]();});}};}function handleEntityNotFound(_0x597260){return function(_0x124467){if(!_0x124467){_0x597260[_0x8db2('0xd')](0x194);}return _0x124467;};}function handleError(_0x18f69c,_0x125be2){_0x125be2=_0x125be2||0x1f4;return function(_0x2260d8){logger[_0x8db2('0x1b')](_0x2260d8[_0x8db2('0x1c')]);if(_0x2260d8['name']){delete _0x2260d8[_0x8db2('0x1d')];}_0x18f69c['status'](_0x125be2)['send'](_0x2260d8);};}exports['index']=function(_0x4d923c,_0xec8cd2){var _0x29b5cd={};var _0x3be281={'count':0x0,'rows':[]};var _0x2baed0=_[_0x8db2('0x1e')](db[_0x8db2('0x1f')]['rawAttributes'],function(_0x3544ba){return{'name':_0x3544ba[_0x8db2('0x20')],'type':_0x3544ba[_0x8db2('0x21')][_0x8db2('0x22')]};});_0x29b5cd=qs['getOptions'](_0x2baed0,_0x4d923c);var _0x2e0691={'where':_0x29b5cd[_0x8db2('0x23')]};return db[_0x8db2('0x1f')][_0x8db2('0x13')](_0x2e0691)[_0x8db2('0x17')](function(_0x21bae5){_0x3be281[_0x8db2('0x13')]=_0x21bae5;_0x29b5cd[_0x8db2('0x24')]=qs[_0x8db2('0x24')](_0x4d923c['query']);return db[_0x8db2('0x1f')]['findAll'](_0x29b5cd);})['then'](function(_0x302188){_0x3be281[_0x8db2('0x25')]=_0x302188;return _0x3be281;})[_0x8db2('0x17')](respondWithFilteredResult(_0xec8cd2,_0x29b5cd))['catch'](handleError(_0xec8cd2,null));};exports[_0x8db2('0x26')]=function(_0x56b71a,_0x3f7aac){var _0x2b653b={'raw':!![],'where':{'id':_0x56b71a['params']['id']}},_0x14bd12={};_0x14bd12['model']=_[_0x8db2('0x27')](db[_0x8db2('0x1f')]['rawAttributes']);_0x14bd12['query']=_[_0x8db2('0x27')](_0x56b71a[_0x8db2('0x28')]);_0x14bd12[_0x8db2('0x29')]=_[_0x8db2('0x2a')](_0x14bd12[_0x8db2('0x2b')],_0x14bd12[_0x8db2('0x28')]);_0x2b653b[_0x8db2('0x2c')]=_[_0x8db2('0x2a')](_0x14bd12[_0x8db2('0x2b')],qs[_0x8db2('0x2d')](_0x56b71a['query'][_0x8db2('0x2d')]));_0x2b653b[_0x8db2('0x2c')]=_0x2b653b['attributes'][_0x8db2('0x2e')]?_0x2b653b[_0x8db2('0x2c')]:_0x14bd12['model'];if(_0x56b71a['query'][_0x8db2('0x2f')]){_0x2b653b['include']=[{'all':!![]}];}_0x2b653b=_[_0x8db2('0x30')]({},_0x2b653b,_0x56b71a[_0x8db2('0x31')]);return db[_0x8db2('0x1f')][_0x8db2('0x32')](_0x2b653b)['then'](handleEntityNotFound(_0x3f7aac,null))[_0x8db2('0x17')](respondWithResult(_0x3f7aac,null))['catch'](handleError(_0x3f7aac,null));};exports[_0x8db2('0x33')]=function(_0xd550ae,_0x2c8bc9){return db[_0x8db2('0x1f')]['create'](_0xd550ae['body'],{})[_0x8db2('0x17')](function(_0x2c0507){var _0x5dc2b4=_0xd550ae[_0x8db2('0x34')][_0x8db2('0x18')]({'plain':!![]});if(!_0x5dc2b4)throw new Error(_0x8db2('0x35'));if(_0x5dc2b4['role']===_0x8db2('0x34')){var _0x149186=_0x2c0507[_0x8db2('0x18')]({'plain':!![]});var _0x279e74=_0x8db2('0x19');return db[_0x8db2('0x36')][_0x8db2('0x32')]({'where':{'name':_0x279e74,'userProfileId':_0x5dc2b4[_0x8db2('0x37')]},'raw':!![]})[_0x8db2('0x17')](function(_0x63c561){if(_0x63c561&&_0x63c561[_0x8db2('0x38')]===0x0){return db[_0x8db2('0x39')][_0x8db2('0x33')]({'name':_0x149186['name'],'resourceId':_0x149186['id'],'type':_0x63c561[_0x8db2('0x1d')],'sectionId':_0x63c561['id']},{})[_0x8db2('0x17')](function(){return _0x2c0507;});}else{return _0x2c0507;}})['catch'](function(_0x49a7ae){logger[_0x8db2('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x49a7ae);throw _0x49a7ae;});}return _0x2c0507;})[_0x8db2('0x17')](respondWithResult(_0x2c8bc9,0xc9))[_0x8db2('0x3a')](handleError(_0x2c8bc9,null));};exports[_0x8db2('0x16')]=function(_0x307783,_0xb4fe2c){if(_0x307783[_0x8db2('0x3b')]['id']){delete _0x307783[_0x8db2('0x3b')]['id'];}return db['SmsQueue'][_0x8db2('0x32')]({'where':{'id':_0x307783[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0xb4fe2c,null))[_0x8db2('0x17')](saveUpdates(_0x307783['body'],null))[_0x8db2('0x17')](respondWithResult(_0xb4fe2c,null))[_0x8db2('0x3a')](handleError(_0xb4fe2c,null));};exports[_0x8db2('0x1a')]=function(_0x2c47cc,_0x5427af){return db[_0x8db2('0x1f')]['find']({'where':{'id':_0x2c47cc[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x5427af,null))[_0x8db2('0x17')](removeEntity(_0x5427af,null))['catch'](handleError(_0x5427af,null));};exports['describe']=function(_0x1ec3d0,_0x47c556){return db[_0x8db2('0x1f')][_0x8db2('0x3d')]()[_0x8db2('0x17')](respondWithResult(_0x47c556,null))[_0x8db2('0x3a')](handleError(_0x47c556,null));};exports[_0x8db2('0x3e')]=function(_0x40c6e6,_0x4355e2){var _0xab6bdd={'raw':!![],'where':{}},_0x4291e3={},_0x12a1ef;return db[_0x8db2('0x1f')][_0x8db2('0x3f')]({'where':{'id':_0x40c6e6['params']['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x4355e2,null))[_0x8db2('0x17')](function(_0xdbba64){if(_0xdbba64){_0x12a1ef=_0xdbba64[_0x8db2('0x18')]({'plain':!![]});_0x4291e3['model']=_['keys'](db[_0x8db2('0x40')][_0x8db2('0x41')]);_0x4291e3[_0x8db2('0x28')]=_['keys'](_0x40c6e6['query']);_0x4291e3['filters']=_[_0x8db2('0x2a')](_0x4291e3[_0x8db2('0x2b')],_0x4291e3[_0x8db2('0x28')]);_0xab6bdd[_0x8db2('0x2c')]=_[_0x8db2('0x2a')](_0x4291e3[_0x8db2('0x2b')],qs[_0x8db2('0x2d')](_0x40c6e6['query']['fields']));_0xab6bdd[_0x8db2('0x2c')]=_0xab6bdd[_0x8db2('0x2c')][_0x8db2('0x2e')]?_0xab6bdd[_0x8db2('0x2c')]:_0x4291e3[_0x8db2('0x2b')];if(!_0x40c6e6[_0x8db2('0x28')][_0x8db2('0x42')](_0x8db2('0x43'))){_0xab6bdd[_0x8db2('0x14')]=qs[_0x8db2('0x14')](_0x40c6e6[_0x8db2('0x28')][_0x8db2('0x14')]);_0xab6bdd[_0x8db2('0x11')]=qs[_0x8db2('0x11')](_0x40c6e6[_0x8db2('0x28')]['offset']);}_0xab6bdd[_0x8db2('0x44')]=qs[_0x8db2('0x45')](_0x40c6e6['query'][_0x8db2('0x45')]);_0xab6bdd[_0x8db2('0x23')]=qs[_0x8db2('0x29')](_['pick'](_0x40c6e6[_0x8db2('0x28')],_0x4291e3[_0x8db2('0x29')]));_0xab6bdd[_0x8db2('0x23')][_0x8db2('0x46')]=_0xdbba64['id'];if(_0x40c6e6[_0x8db2('0x28')]['filter']){_0xab6bdd[_0x8db2('0x23')]=_[_0x8db2('0x30')](_0xab6bdd[_0x8db2('0x23')],{'$or':_['map'](_0xab6bdd[_0x8db2('0x2c')],function(_0x18cc13){var _0x33dddd={};_0x33dddd[_0x18cc13]={'$like':'%'+_0x40c6e6[_0x8db2('0x28')][_0x8db2('0x47')]+'%'};return _0x33dddd;})});}_0xab6bdd=_[_0x8db2('0x30')]({},_0xab6bdd,_0x40c6e6[_0x8db2('0x31')]);return db['UserSmsQueue'][_0x8db2('0x48')](_0xab6bdd);}})[_0x8db2('0x17')](function(_0x4d3c19){if(_0x4d3c19){return db[_0x8db2('0x49')][_0x8db2('0x4a')]({'where':{'id':_['map'](_0x4d3c19,_0x8db2('0x4b')),'role':_0x8db2('0x4c')},'attributes':['id',_0x8db2('0x1d'),_0x8db2('0x4d'),_0x8db2('0x4e'),_0x8db2('0x4f')]});}})[_0x8db2('0x17')](function(_0x33a600){if(_0x33a600){return{'count':_0x33a600[_0x8db2('0x13')],'rows':_[_0x8db2('0x1e')](_0x33a600[_0x8db2('0x25')],function(_0x447a47){return{'membername':_0x447a47[_0x8db2('0x1d')],'UserId':_0x447a47['id'],'queue_name':_0x12a1ef[_0x8db2('0x1d')],'SmsQueueId':_0x12a1ef['id'],'interface':util[_0x8db2('0x50')](_0x8db2('0x51'),'SIP',_0x447a47[_0x8db2('0x1d')]),'penalty':0x0,'paused':_0x447a47[_0x8db2('0x4d')],'createdAt':_0x447a47[_0x8db2('0x4f')],'updatedAt':_0x447a47[_0x8db2('0x4e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x8db2('0x17')](respondWithFilteredResult(_0x4355e2,_0xab6bdd))['catch'](handleError(_0x4355e2,null));};exports[_0x8db2('0x52')]=function(_0x2c3087,_0x3ab670){var _0x1e1c0d={};var _0x2ad70f={};var _0x348da8;var _0x17341d;return db[_0x8db2('0x1f')][_0x8db2('0x3f')]({'where':{'id':_0x2c3087[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x3ab670,null))[_0x8db2('0x17')](function(_0x170a72){if(_0x170a72){_0x348da8=_0x170a72;_0x2ad70f[_0x8db2('0x2b')]=_[_0x8db2('0x27')](db[_0x8db2('0x53')][_0x8db2('0x41')]);_0x2ad70f[_0x8db2('0x28')]=_['keys'](_0x2c3087[_0x8db2('0x28')]);_0x2ad70f['filters']=_[_0x8db2('0x2a')](_0x2ad70f['model'],_0x2ad70f[_0x8db2('0x28')]);_0x1e1c0d[_0x8db2('0x2c')]=_[_0x8db2('0x2a')](_0x2ad70f[_0x8db2('0x2b')],qs[_0x8db2('0x2d')](_0x2c3087['query']['fields']));_0x1e1c0d[_0x8db2('0x2c')]=_0x1e1c0d[_0x8db2('0x2c')][_0x8db2('0x2e')]?_0x1e1c0d[_0x8db2('0x2c')]:_0x2ad70f[_0x8db2('0x2b')];_0x1e1c0d[_0x8db2('0x44')]=qs[_0x8db2('0x45')](_0x2c3087[_0x8db2('0x28')]['sort']);_0x1e1c0d[_0x8db2('0x23')]=qs[_0x8db2('0x29')](_[_0x8db2('0x54')](_0x2c3087[_0x8db2('0x28')],_0x2ad70f[_0x8db2('0x29')]));if(_0x2c3087[_0x8db2('0x28')][_0x8db2('0x47')]){_0x1e1c0d[_0x8db2('0x23')]=_['merge'](_0x1e1c0d['where'],{'$or':_[_0x8db2('0x1e')](_0x1e1c0d[_0x8db2('0x2c')],function(_0x1d2dfc){var _0x27f4cd={};_0x27f4cd[_0x1d2dfc]={'$like':'%'+_0x2c3087[_0x8db2('0x28')]['filter']+'%'};return _0x27f4cd;})});}_0x1e1c0d=_['merge']({},_0x1e1c0d,_0x2c3087[_0x8db2('0x31')]);return _0x348da8[_0x8db2('0x52')](_0x1e1c0d);}})['then'](function(_0xa698bd){if(_0xa698bd){_0x17341d=_0xa698bd[_0x8db2('0x2e')];if(!_0x2c3087[_0x8db2('0x28')]['hasOwnProperty'](_0x8db2('0x43'))){_0x1e1c0d[_0x8db2('0x14')]=qs[_0x8db2('0x14')](_0x2c3087['query'][_0x8db2('0x14')]);_0x1e1c0d[_0x8db2('0x11')]=qs[_0x8db2('0x11')](_0x2c3087[_0x8db2('0x28')][_0x8db2('0x11')]);}return _0x348da8['getTeams'](_0x1e1c0d);}})[_0x8db2('0x17')](function(_0x3023fe){if(_0x3023fe){return _0x3023fe?{'count':_0x17341d,'rows':_0x3023fe}:null;}})[_0x8db2('0x17')](respondWithResult(_0x3ab670,null))['catch'](handleError(_0x3ab670,null));};exports['addTeams']=function(_0x2cdf3c,_0xbe05ca){var _0x487dcb=_0x2cdf3c[_0x8db2('0x3b')][_0x8db2('0x55')];return db[_0x8db2('0x53')][_0x8db2('0x48')]({'where':{'id':_0x487dcb},'attributes':['id'],'include':[{'model':db[_0x8db2('0x49')],'as':_0x8db2('0x56'),'attributes':['id',_0x8db2('0x1d'),_0x8db2('0x57'),_0x8db2('0x58'),_0x8db2('0x59')],'raw':!![]}]})[_0x8db2('0x17')](function(_0x3e1478){if(_0x3e1478){var _0x24a52d=_['flatMap'](_0x3e1478,function(_0x2ba42d){var _0x4f29f1=_0x2ba42d[_0x8db2('0x18')]({'plain':!![]});return _0x4f29f1[_0x8db2('0x56')];});return db['SmsQueue'][_0x8db2('0x32')]({'where':{'id':_0x2cdf3c[_0x8db2('0x3c')]['id']}})['then'](function(_0x2159c4){return db[_0x8db2('0x5a')][_0x8db2('0x5b')](function(_0x25a3ab){return _0x2159c4[_0x8db2('0x5c')](_0x487dcb,{'transaction':_0x25a3ab})[_0x8db2('0x17')](function(){return BPromise[_0x8db2('0x5d')](_0x24a52d,function(_0x3ac0fa){return db[_0x8db2('0x40')]['findOrCreate']({'where':{'UserId':_0x3ac0fa['id'],'SmsQueueId':_0x2cdf3c['params']['id']},'transaction':_0x25a3ab});});})[_0x8db2('0x17')](function(){_0x24a52d['forEach'](function(_0xf8afa5){socket[_0x8db2('0x5e')](_0x8db2('0x5f'),{'UserId':_0xf8afa5['id'],'SmsQueueId':_0x2159c4['id']});});});});});}})['then'](respondWithStatusCode(_0xbe05ca,null))[_0x8db2('0x3a')](handleError(_0xbe05ca,null));};exports[_0x8db2('0x60')]=function(_0x3e37e7,_0x591c5d){return db[_0x8db2('0x53')][_0x8db2('0x48')]({'where':{'id':_0x3e37e7[_0x8db2('0x28')][_0x8db2('0x55')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x8db2('0x56'),'attributes':['id'],'raw':!![]}]})[_0x8db2('0x17')](handleEntityNotFound(_0x591c5d,null))[_0x8db2('0x17')](function(_0x1edb1a){var _0xcf1c42=_[_0x8db2('0x1e')](_0x1edb1a,'id');var _0x1aadfb=[];var _0x3682bf=[];var _0x358f48=squel[_0x8db2('0x61')]();_0x358f48[_0x8db2('0x62')]('tq.TeamId')[_0x8db2('0x63')](_0x8db2('0x64'),'tq')[_0x8db2('0x65')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x8db2('0x66'),_0x3e37e7[_0x8db2('0x3c')]['id']);for(var _0x3191c8=0x0;_0x3191c8<_0x1edb1a[_0x8db2('0x2e')];_0x3191c8+=0x1){let _0x2ad024=_0x1edb1a[_0x3191c8];for(var _0x313918=0x0;_0x313918<_0x2ad024[_0x8db2('0x56')][_0x8db2('0x2e')];_0x313918+=0x1){let _0x3b1929=_0x2ad024[_0x8db2('0x56')][_0x313918];var _0x46eb80=_0x358f48['clone']();_0x46eb80[_0x8db2('0x23')](_0x8db2('0x67'),_0x3b1929['id']);_0x3682bf[_0x8db2('0x68')](db[_0x8db2('0x5a')]['query'](_0x46eb80['toString'](),{'type':db[_0x8db2('0x5a')][_0x8db2('0x69')]['SELECT']})[_0x8db2('0x17')](function(_0x121f31){if(_0x121f31[_0x8db2('0x2e')]===0x1){return _0x3b1929['id'];}else{var _0x5f2ece=_['every'](_['map'](_0x121f31,_0x8db2('0x6a')),function(_0x18b4a6){return _[_0x8db2('0x6b')](_0xcf1c42,_0x18b4a6);});if(_0x5f2ece){return _0x3b1929['id'];}}}));}}return BPromise[_0x8db2('0x6c')](_0x3682bf)[_0x8db2('0x17')](function(_0x4e8aac){_0x1aadfb=_(_0x1aadfb)[_0x8db2('0x6d')](_0x4e8aac)['compact']()[_0x8db2('0x6e')]();return db[_0x8db2('0x1f')][_0x8db2('0x32')]({'where':{'id':_0x3e37e7[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](function(_0x5d5380){return db['sequelize'][_0x8db2('0x5b')](function(_0x51afcf){return _0x5d5380[_0x8db2('0x60')](_0x3e37e7[_0x8db2('0x28')][_0x8db2('0x55')],{'transaction':_0x51afcf})[_0x8db2('0x17')](function(){if(!_[_0x8db2('0x6f')](_0x1aadfb)){return _0x5d5380[_0x8db2('0x70')](_0x1aadfb,{'transaction':_0x51afcf});}})['then'](function(){_0x1aadfb[_0x8db2('0x71')](function(_0x222ea2){socket[_0x8db2('0x5e')]('userSmsQueue:remove',{'UserId':_0x222ea2,'SmsQueueId':_0x5d5380['id']});});});});});});})[_0x8db2('0x17')](respondWithStatusCode(_0x591c5d,null))[_0x8db2('0x3a')](handleError(_0x591c5d,null));};exports['addAgents']=function(_0x2d7abf,_0x7cb97d){return db[_0x8db2('0x1f')][_0x8db2('0x32')]({'where':{'id':_0x2d7abf[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x7cb97d,null))[_0x8db2('0x17')](function(_0x19e25b){if(_0x19e25b){return _0x19e25b[_0x8db2('0x72')](_0x2d7abf['body'][_0x8db2('0x55')],_[_0x8db2('0x73')](_0x2d7abf[_0x8db2('0x3b')],[_0x8db2('0x55'),'id'])||{})[_0x8db2('0x74')](function(_0x345ff9){for(var _0x16d1c5=0x0;_0x16d1c5<_0x2d7abf[_0x8db2('0x3b')][_0x8db2('0x55')][_0x8db2('0x2e')];_0x16d1c5+=0x1){socket['emit'](_0x8db2('0x5f'),{'UserId':Number(_0x2d7abf[_0x8db2('0x3b')][_0x8db2('0x55')][_0x16d1c5]),'SmsQueueId':Number(_0x2d7abf[_0x8db2('0x3c')]['id'])});}return _0x345ff9;});}})['then'](respondWithResult(_0x7cb97d,null))[_0x8db2('0x3a')](handleError(_0x7cb97d,null));};exports[_0x8db2('0x70')]=function(_0x46476e,_0x4f653e){return db['SmsQueue'][_0x8db2('0x32')]({'where':{'id':_0x46476e[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x4f653e,null))[_0x8db2('0x17')](function(_0x4f9ce4){if(_0x4f9ce4){return _0x4f9ce4[_0x8db2('0x70')](_0x46476e[_0x8db2('0x28')][_0x8db2('0x55')])[_0x8db2('0x17')](function(){if(_['isArray'](_0x46476e[_0x8db2('0x28')][_0x8db2('0x55')])){for(var _0x3e7b24=0x0;_0x3e7b24<_0x46476e['query']['ids']['length'];_0x3e7b24+=0x1){socket[_0x8db2('0x5e')](_0x8db2('0x75'),{'UserId':Number(_0x46476e[_0x8db2('0x28')][_0x8db2('0x55')][_0x3e7b24]),'SmsQueueId':Number(_0x46476e['params']['id'])});}}else{socket['emit'](_0x8db2('0x75'),{'UserId':Number(_0x46476e[_0x8db2('0x28')][_0x8db2('0x55')]),'SmsQueueId':Number(_0x46476e[_0x8db2('0x3c')]['id'])});}});}})[_0x8db2('0x17')](respondWithStatusCode(_0x4f653e,null))[_0x8db2('0x3a')](handleError(_0x4f653e,null));};exports['getAgents']=function(_0x2942eb,_0x5f32ce){var _0x432780={};var _0x23457b={};var _0x1ef898;var _0x39f2d3;return db[_0x8db2('0x1f')]['findOne']({'where':{'id':_0x2942eb[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x5f32ce,null))['then'](function(_0x28beec){if(_0x28beec){_0x1ef898=_0x28beec;_0x23457b[_0x8db2('0x2b')]=_[_0x8db2('0x27')](db[_0x8db2('0x49')]['rawAttributes']);_0x23457b[_0x8db2('0x28')]=_['keys'](_0x2942eb['query']);_0x23457b[_0x8db2('0x29')]=_[_0x8db2('0x2a')](_0x23457b[_0x8db2('0x2b')],_0x23457b[_0x8db2('0x28')]);_0x432780[_0x8db2('0x2c')]=_[_0x8db2('0x2a')](_0x23457b[_0x8db2('0x2b')],qs['fields'](_0x2942eb[_0x8db2('0x28')]['fields']));_0x432780['attributes']=_0x432780[_0x8db2('0x2c')]['length']?_0x432780['attributes']:_0x23457b[_0x8db2('0x2b')];_0x432780[_0x8db2('0x44')]=qs[_0x8db2('0x45')](_0x2942eb['query'][_0x8db2('0x45')]);_0x432780[_0x8db2('0x23')]=qs[_0x8db2('0x29')](_['pick'](_0x2942eb[_0x8db2('0x28')],_0x23457b[_0x8db2('0x29')]));if(_0x2942eb[_0x8db2('0x28')][_0x8db2('0x47')]){_0x432780[_0x8db2('0x23')]=_[_0x8db2('0x30')](_0x432780[_0x8db2('0x23')],{'$or':_[_0x8db2('0x1e')](_0x432780['attributes'],function(_0xa7b208){var _0x3cb456={};_0x3cb456[_0xa7b208]={'$like':'%'+_0x2942eb[_0x8db2('0x28')][_0x8db2('0x47')]+'%'};return _0x3cb456;})});}_0x432780=_[_0x8db2('0x30')]({},_0x432780,_0x2942eb[_0x8db2('0x31')]);return _0x1ef898[_0x8db2('0x76')](_0x432780);}})[_0x8db2('0x17')](function(_0x3a53e2){if(_0x3a53e2){_0x39f2d3=_0x3a53e2[_0x8db2('0x2e')];if(!_0x2942eb[_0x8db2('0x28')]['hasOwnProperty'](_0x8db2('0x43'))){_0x432780[_0x8db2('0x14')]=qs[_0x8db2('0x14')](_0x2942eb['query'][_0x8db2('0x14')]);_0x432780[_0x8db2('0x11')]=qs[_0x8db2('0x11')](_0x2942eb['query']['offset']);}return _0x1ef898[_0x8db2('0x76')](_0x432780);}})[_0x8db2('0x17')](function(_0x296966){if(_0x296966){return _0x296966?{'count':_0x39f2d3,'rows':_0x296966}:null;}})[_0x8db2('0x17')](respondWithResult(_0x5f32ce,null))[_0x8db2('0x3a')](handleError(_0x5f32ce,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 61a01f2..749ddc2 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 _0x45c5=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','save','update'];(function(_0x490502,_0x3fed24){var _0x5ee5ea=function(_0x4bf427){while(--_0x4bf427){_0x490502['push'](_0x490502['shift']());}};_0x5ee5ea(++_0x3fed24);}(_0x45c5,0x17e));var _0x545c=function(_0xad3284,_0x16cf60){_0xad3284=_0xad3284-0x0;var _0x495ece=_0x45c5[_0xad3284];return _0x495ece;};'use strict';var EventEmitter=require(_0x545c('0x0'));var SmsQueue=require(_0x545c('0x1'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x545c('0x2')](0x0);var events={'afterCreate':_0x545c('0x3'),'afterUpdate':_0x545c('0x4'),'afterDestroy':_0x545c('0x5')};function emitEvent(_0x300c62){return function(_0x1f567b,_0x3829ce,_0x16a907){SmsQueueEvents[_0x545c('0x6')](_0x300c62+':'+_0x1f567b['id'],_0x1f567b);SmsQueueEvents[_0x545c('0x6')](_0x300c62,_0x1f567b);_0x16a907(null);};}for(var e in events){if(events[_0x545c('0x7')](e)){var event=events[e];SmsQueue[_0x545c('0x8')](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file +var _0x5289=['hook','exports','events','SmsQueue','update','emit','hasOwnProperty'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5289,0x191));var _0x9528=function(_0x4f4c46,_0x3bf816){_0x4f4c46=_0x4f4c46-0x0;var _0x3c2314=_0x5289[_0x4f4c46];return _0x3c2314;};'use strict';var EventEmitter=require(_0x9528('0x0'));var SmsQueue=require('../../mysqldb')['db'][_0x9528('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x9528('0x2'),'afterDestroy':'remove'};function emitEvent(_0x20233a){return function(_0x52c24d,_0xde4c75,_0x58a4d8){SmsQueueEvents[_0x9528('0x3')](_0x20233a+':'+_0x52c24d['id'],_0x52c24d);SmsQueueEvents['emit'](_0x20233a,_0x52c24d);_0x58a4d8(null);};}for(var e in events){if(events[_0x9528('0x4')](e)){var event=events[e];SmsQueue[_0x9528('0x5')](e,emitEvent(event));}}module[_0x9528('0x6')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 8f52db1..4df7732 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 _0x708f=['moment','bluebird','request-promise','path','../../config/environment','./smsQueue.attributes','exports','define','SmsQueue','lodash','util','../../config/logger','api'];(function(_0x5d5003,_0x1471d1){var _0x45d5eb=function(_0x3984c2){while(--_0x3984c2){_0x5d5003['push'](_0x5d5003['shift']());}};_0x45d5eb(++_0x1471d1);}(_0x708f,0x10d));var _0xf708=function(_0x4c98f2,_0x347152){_0x4c98f2=_0x4c98f2-0x0;var _0x32694f=_0x708f[_0x4c98f2];return _0x32694f;};'use strict';var _=require(_0xf708('0x0'));var util=require(_0xf708('0x1'));var logger=require(_0xf708('0x2'))(_0xf708('0x3'));var moment=require(_0xf708('0x4'));var BPromise=require(_0xf708('0x5'));var rp=require(_0xf708('0x6'));var fs=require('fs');var path=require(_0xf708('0x7'));var rimraf=require('rimraf');var config=require(_0xf708('0x8'));var attributes=require(_0xf708('0x9'));module[_0xf708('0xa')]=function(_0x22bfa8,_0x1b84f0){return _0x22bfa8[_0xf708('0xb')](_0xf708('0xc'),attributes,{'tableName':'sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc3e4=['sms_queues','lodash','util','../../config/logger','api','request-promise','path','rimraf','./smsQueue.attributes','exports','SmsQueue'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xc3e4,0x140));var _0x4c3e=function(_0x3b2424,_0x586538){_0x3b2424=_0x3b2424-0x0;var _0x12a396=_0xc3e4[_0x3b2424];return _0x12a396;};'use strict';var _=require(_0x4c3e('0x0'));var util=require(_0x4c3e('0x1'));var logger=require(_0x4c3e('0x2'))(_0x4c3e('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4c3e('0x4'));var fs=require('fs');var path=require(_0x4c3e('0x5'));var rimraf=require(_0x4c3e('0x6'));var config=require('../../config/environment');var attributes=require(_0x4c3e('0x7'));module[_0x4c3e('0x8')]=function(_0x454b9a,_0x482b7b){return _0x454b9a['define'](_0x4c3e('0x9'),attributes,{'tableName':_0x4c3e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.rpc.js b/server/api/smsQueue/smsQueue.rpc.js index a12c9d8..14ac1d5 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 _0x161d=['SmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','SmsQueue,\x20%s,\x20%s','message','catch','GetSmsQueue','SmsQueue','findAll','options','raw','where','attributes','limit','include','map','model','then','debug','find','ShowSmsQueue','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./smsQueue.socket','register','request','info'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0x161d,0x15e));var _0xd161=function(_0x25478d,_0x5b6c8b){_0x25478d=_0x25478d-0x0;var _0x17a799=_0x161d[_0x25478d];return _0x17a799;};'use strict';var _=require('lodash');var util=require(_0xd161('0x0'));var moment=require(_0xd161('0x1'));var BPromise=require('bluebird');var rs=require(_0xd161('0x2'));var fs=require('fs');var Redis=require(_0xd161('0x3'));var db=require(_0xd161('0x4'))['db'];var utils=require(_0xd161('0x5'));var logger=require(_0xd161('0x6'))(_0xd161('0x7'));var config=require(_0xd161('0x8'));var jayson=require(_0xd161('0x9'));var client=jayson[_0xd161('0xa')][_0xd161('0xb')]({'port':0x232a});config[_0xd161('0xc')]=_[_0xd161('0xd')](config[_0xd161('0xc')],{'host':_0xd161('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xd161('0xf'))[_0xd161('0x10')](socket);function respondWithRpcPromise(_0x2d4233,_0x588568,_0x512460){return new BPromise(function(_0x10e659,_0x483929){return client[_0xd161('0x11')](_0x2d4233,_0x512460)['then'](function(_0x3d0e8e){logger[_0xd161('0x12')]('SmsQueue,\x20%s,\x20%s',_0x588568,'request\x20sent');logger['debug'](_0xd161('0x13'),_0x588568,_0xd161('0x14'),JSON['stringify'](_0x3d0e8e));if(_0x3d0e8e[_0xd161('0x15')]){if(_0x3d0e8e[_0xd161('0x15')][_0xd161('0x16')]===0x1f4){logger['error'](_0xd161('0x17'),_0x588568,_0x3d0e8e[_0xd161('0x15')]['message']);return _0x483929(_0x3d0e8e[_0xd161('0x15')][_0xd161('0x18')]);}logger[_0xd161('0x15')](_0xd161('0x17'),_0x588568,_0x3d0e8e[_0xd161('0x15')][_0xd161('0x18')]);return _0x10e659(_0x3d0e8e[_0xd161('0x15')]['message']);}else{logger[_0xd161('0x12')]('SmsQueue,\x20%s,\x20%s',_0x588568,_0xd161('0x14'));_0x10e659(_0x3d0e8e['result'][_0xd161('0x18')]);}})[_0xd161('0x19')](function(_0x4268c3){logger[_0xd161('0x15')](_0xd161('0x17'),_0x588568,_0x4268c3);_0x483929(_0x4268c3);});});}exports[_0xd161('0x1a')]=function(_0x370950){var _0xa577d8=this;return new Promise(function(_0x38c7e6,_0x5e41ac){return db[_0xd161('0x1b')][_0xd161('0x1c')]({'raw':_0x370950[_0xd161('0x1d')]?_0x370950['options'][_0xd161('0x1e')]===undefined?!![]:![]:!![],'where':_0x370950[_0xd161('0x1d')]?_0x370950['options'][_0xd161('0x1f')]||null:null,'attributes':_0x370950[_0xd161('0x1d')]?_0x370950['options'][_0xd161('0x20')]||null:null,'limit':_0x370950[_0xd161('0x1d')]?_0x370950['options'][_0xd161('0x21')]||null:null,'include':_0x370950['options']?_0x370950[_0xd161('0x1d')][_0xd161('0x22')]?_[_0xd161('0x23')](_0x370950[_0xd161('0x1d')]['include'],function(_0xe08eae){return{'model':db[_0xe08eae[_0xd161('0x24')]],'as':_0xe08eae['as'],'attributes':_0xe08eae[_0xd161('0x20')],'include':_0xe08eae[_0xd161('0x22')]?_[_0xd161('0x23')](_0xe08eae[_0xd161('0x22')],function(_0x182e47){return{'model':db[_0x182e47[_0xd161('0x24')]],'as':_0x182e47['as'],'attributes':_0x182e47[_0xd161('0x20')],'include':_0x182e47['include']?_[_0xd161('0x23')](_0x182e47[_0xd161('0x22')],function(_0x697d3e){return{'model':db[_0x697d3e['model']],'as':_0x697d3e['as'],'attributes':_0x697d3e['attributes']};}):[]};}):[]};}):[]:[]})[_0xd161('0x25')](function(_0x3b153e){logger['info'](_0xd161('0x1a'),_0x370950);logger[_0xd161('0x26')](_0xd161('0x1a'),_0x370950,JSON['stringify'](_0x3b153e));_0x38c7e6(_0x3b153e);})[_0xd161('0x19')](function(_0x4bd877){logger[_0xd161('0x15')](_0xd161('0x1a'),_0x4bd877[_0xd161('0x18')],_0x370950);_0x5e41ac(_0xa577d8[_0xd161('0x15')](0x1f4,_0x4bd877[_0xd161('0x18')]));});});};exports['ShowSmsQueue']=function(_0x5d09bc){var _0x233028=this;return new Promise(function(_0x1c342c,_0xb19237){return db[_0xd161('0x1b')][_0xd161('0x27')]({'raw':_0x5d09bc[_0xd161('0x1d')]?_0x5d09bc[_0xd161('0x1d')][_0xd161('0x1e')]===undefined?!![]:![]:!![],'where':_0x5d09bc[_0xd161('0x1d')]?_0x5d09bc[_0xd161('0x1d')][_0xd161('0x1f')]||null:null,'attributes':_0x5d09bc[_0xd161('0x1d')]?_0x5d09bc[_0xd161('0x1d')][_0xd161('0x20')]||null:null,'include':_0x5d09bc[_0xd161('0x1d')]?_0x5d09bc[_0xd161('0x1d')][_0xd161('0x22')]?_['map'](_0x5d09bc[_0xd161('0x1d')][_0xd161('0x22')],function(_0x283841){return{'model':db[_0x283841['model']],'as':_0x283841['as'],'attributes':_0x283841[_0xd161('0x20')],'include':_0x283841[_0xd161('0x22')]?_['map'](_0x283841[_0xd161('0x22')],function(_0x11b5ca){return{'model':db[_0x11b5ca[_0xd161('0x24')]],'as':_0x11b5ca['as'],'attributes':_0x11b5ca['attributes'],'include':_0x11b5ca[_0xd161('0x22')]?_['map'](_0x11b5ca[_0xd161('0x22')],function(_0x998515){return{'model':db[_0x998515[_0xd161('0x24')]],'as':_0x998515['as'],'attributes':_0x998515['attributes']};}):[]};}):[]};}):[]:[]})[_0xd161('0x25')](function(_0x501dcd){logger[_0xd161('0x12')](_0xd161('0x28'),_0x5d09bc);logger[_0xd161('0x26')](_0xd161('0x28'),_0x5d09bc,JSON['stringify'](_0x501dcd));_0x1c342c(_0x501dcd);})['catch'](function(_0x5756f8){logger[_0xd161('0x15')](_0xd161('0x28'),_0x5756f8[_0xd161('0x18')],_0x5d09bc);_0xb19237(_0x233028['error'](0x1f4,_0x5756f8[_0xd161('0x18')]));});});}; \ No newline at end of file +var _0x60fa=['result','catch','GetSmsQueue','SmsQueue','findAll','options','where','attributes','limit','include','model','map','ShowSmsQueue','find','raw','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','register','request','then','info','SmsQueue,\x20%s,\x20%s','debug','SmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x4943f1,_0x24035b){var _0x6eb1d5=function(_0x49861f){while(--_0x49861f){_0x4943f1['push'](_0x4943f1['shift']());}};_0x6eb1d5(++_0x24035b);}(_0x60fa,0x127));var _0xa60f=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x60fa[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xa60f('0x0'));var util=require(_0xa60f('0x1'));var moment=require(_0xa60f('0x2'));var BPromise=require(_0xa60f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa60f('0x4'));var db=require(_0xa60f('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xa60f('0x6'));var jayson=require(_0xa60f('0x7'));var client=jayson[_0xa60f('0x8')]['http']({'port':0x232a});config['redis']=_[_0xa60f('0x9')](config[_0xa60f('0xa')],{'host':_0xa60f('0xb'),'port':0x18eb});var socket=require(_0xa60f('0xc'))(new Redis(config[_0xa60f('0xa')]));require('./smsQueue.socket')[_0xa60f('0xd')](socket);function respondWithRpcPromise(_0x1f94ef,_0x3f742e,_0x3d3bac){return new BPromise(function(_0x4f288d,_0x484445){return client[_0xa60f('0xe')](_0x1f94ef,_0x3d3bac)[_0xa60f('0xf')](function(_0x53c8c7){logger[_0xa60f('0x10')](_0xa60f('0x11'),_0x3f742e,'request\x20sent');logger[_0xa60f('0x12')](_0xa60f('0x13'),_0x3f742e,_0xa60f('0x14'),JSON[_0xa60f('0x15')](_0x53c8c7));if(_0x53c8c7['error']){if(_0x53c8c7[_0xa60f('0x16')][_0xa60f('0x17')]===0x1f4){logger[_0xa60f('0x16')](_0xa60f('0x11'),_0x3f742e,_0x53c8c7[_0xa60f('0x16')]['message']);return _0x484445(_0x53c8c7['error'][_0xa60f('0x18')]);}logger[_0xa60f('0x16')](_0xa60f('0x11'),_0x3f742e,_0x53c8c7[_0xa60f('0x16')][_0xa60f('0x18')]);return _0x4f288d(_0x53c8c7[_0xa60f('0x16')][_0xa60f('0x18')]);}else{logger['info']('SmsQueue,\x20%s,\x20%s',_0x3f742e,_0xa60f('0x14'));_0x4f288d(_0x53c8c7[_0xa60f('0x19')][_0xa60f('0x18')]);}})[_0xa60f('0x1a')](function(_0x1ad14d){logger['error'](_0xa60f('0x11'),_0x3f742e,_0x1ad14d);_0x484445(_0x1ad14d);});});}exports[_0xa60f('0x1b')]=function(_0x933844){var _0x3c77aa=this;return new Promise(function(_0x23192a,_0x398c4a){return db[_0xa60f('0x1c')][_0xa60f('0x1d')]({'raw':_0x933844[_0xa60f('0x1e')]?_0x933844[_0xa60f('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x933844[_0xa60f('0x1e')]?_0x933844[_0xa60f('0x1e')][_0xa60f('0x1f')]||null:null,'attributes':_0x933844[_0xa60f('0x1e')]?_0x933844[_0xa60f('0x1e')][_0xa60f('0x20')]||null:null,'limit':_0x933844[_0xa60f('0x1e')]?_0x933844[_0xa60f('0x1e')][_0xa60f('0x21')]||null:null,'include':_0x933844[_0xa60f('0x1e')]?_0x933844[_0xa60f('0x1e')][_0xa60f('0x22')]?_['map'](_0x933844[_0xa60f('0x1e')][_0xa60f('0x22')],function(_0x48fd28){return{'model':db[_0x48fd28[_0xa60f('0x23')]],'as':_0x48fd28['as'],'attributes':_0x48fd28[_0xa60f('0x20')],'include':_0x48fd28[_0xa60f('0x22')]?_[_0xa60f('0x24')](_0x48fd28['include'],function(_0x1ccbf5){return{'model':db[_0x1ccbf5[_0xa60f('0x23')]],'as':_0x1ccbf5['as'],'attributes':_0x1ccbf5[_0xa60f('0x20')],'include':_0x1ccbf5['include']?_[_0xa60f('0x24')](_0x1ccbf5[_0xa60f('0x22')],function(_0x510576){return{'model':db[_0x510576['model']],'as':_0x510576['as'],'attributes':_0x510576['attributes']};}):[]};}):[]};}):[]:[]})[_0xa60f('0xf')](function(_0x17a70d){logger['info'](_0xa60f('0x1b'),_0x933844);logger[_0xa60f('0x12')](_0xa60f('0x1b'),_0x933844,JSON[_0xa60f('0x15')](_0x17a70d));_0x23192a(_0x17a70d);})[_0xa60f('0x1a')](function(_0x5d297b){logger[_0xa60f('0x16')](_0xa60f('0x1b'),_0x5d297b[_0xa60f('0x18')],_0x933844);_0x398c4a(_0x3c77aa[_0xa60f('0x16')](0x1f4,_0x5d297b[_0xa60f('0x18')]));});});};exports[_0xa60f('0x25')]=function(_0x465e82){var _0x1ae3e8=this;return new Promise(function(_0x1d57cd,_0x57e803){return db['SmsQueue'][_0xa60f('0x26')]({'raw':_0x465e82['options']?_0x465e82[_0xa60f('0x1e')][_0xa60f('0x27')]===undefined?!![]:![]:!![],'where':_0x465e82[_0xa60f('0x1e')]?_0x465e82['options']['where']||null:null,'attributes':_0x465e82[_0xa60f('0x1e')]?_0x465e82[_0xa60f('0x1e')]['attributes']||null:null,'include':_0x465e82[_0xa60f('0x1e')]?_0x465e82[_0xa60f('0x1e')][_0xa60f('0x22')]?_[_0xa60f('0x24')](_0x465e82['options']['include'],function(_0x46b473){return{'model':db[_0x46b473[_0xa60f('0x23')]],'as':_0x46b473['as'],'attributes':_0x46b473[_0xa60f('0x20')],'include':_0x46b473['include']?_[_0xa60f('0x24')](_0x46b473['include'],function(_0x40f365){return{'model':db[_0x40f365[_0xa60f('0x23')]],'as':_0x40f365['as'],'attributes':_0x40f365['attributes'],'include':_0x40f365[_0xa60f('0x22')]?_[_0xa60f('0x24')](_0x40f365[_0xa60f('0x22')],function(_0x31535f){return{'model':db[_0x31535f[_0xa60f('0x23')]],'as':_0x31535f['as'],'attributes':_0x31535f[_0xa60f('0x20')]};}):[]};}):[]};}):[]:[]})[_0xa60f('0xf')](function(_0x119ff7){logger[_0xa60f('0x10')]('ShowSmsQueue',_0x465e82);logger[_0xa60f('0x12')](_0xa60f('0x25'),_0x465e82,JSON[_0xa60f('0x15')](_0x119ff7));_0x1d57cd(_0x119ff7);})[_0xa60f('0x1a')](function(_0x4e8049){logger['error'](_0xa60f('0x25'),_0x4e8049['message'],_0x465e82);_0x57e803(_0x1ae3e8[_0xa60f('0x16')](0x1f4,_0x4e8049[_0xa60f('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index fc93482..f4aaf4d 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 _0xa5c5=['removeListener','smsQueue:','remove','emit'];(function(_0xe0b4e0,_0xfaee71){var _0x58c2a2=function(_0x130a95){while(--_0x130a95){_0xe0b4e0['push'](_0xe0b4e0['shift']());}};_0x58c2a2(++_0xfaee71);}(_0xa5c5,0x13a));var _0x5a5c=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa5c5[_0x501510];return _0x1e6ee5;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=['save',_0x5a5c('0x0'),'update'];function createListener(_0xffeac6,_0x5ec0f9){return function(_0x442764){_0x5ec0f9[_0x5a5c('0x1')](_0xffeac6,_0x442764);};}function removeListener(_0x235451,_0x19662c){return function(){SmsQueueEvents[_0x5a5c('0x2')](_0x235451,_0x19662c);};}exports['register']=function(_0x49e180){for(var _0x2fdc58=0x0,_0x26d386=events['length'];_0x2fdc58<_0x26d386;_0x2fdc58++){var _0x1d5841=events[_0x2fdc58];var _0x29edb6=createListener(_0x5a5c('0x3')+_0x1d5841,_0x49e180);SmsQueueEvents['on'](_0x1d5841,_0x29edb6);}}; \ No newline at end of file +var _0xc6da=['length','smsQueue:','./smsQueue.events','save','remove','emit','removeListener','register'];(function(_0x2fd065,_0x5757f7){var _0x281864=function(_0x2775e6){while(--_0x2775e6){_0x2fd065['push'](_0x2fd065['shift']());}};_0x281864(++_0x5757f7);}(_0xc6da,0x72));var _0xac6d=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0xc6da[_0x1d24eb];return _0x1dc576;};'use strict';var SmsQueueEvents=require(_0xac6d('0x0'));var events=[_0xac6d('0x1'),_0xac6d('0x2'),'update'];function createListener(_0x173315,_0x193295){return function(_0x245d2b){_0x193295[_0xac6d('0x3')](_0x173315,_0x245d2b);};}function removeListener(_0x311de4,_0x541925){return function(){SmsQueueEvents[_0xac6d('0x4')](_0x311de4,_0x541925);};}exports[_0xac6d('0x5')]=function(_0x9a710e){for(var _0x3b4d97=0x0,_0x523f98=events[_0xac6d('0x6')];_0x3b4d97<_0x523f98;_0x3b4d97++){var _0x52ae5b=events[_0x3b4d97];var _0xe2e8bf=createListener(_0xac6d('0x7')+_0x52ae5b,_0x9a710e);SmsQueueEvents['on'](_0x52ae5b,_0xe2e8bf);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index f9b6a08..fff043c 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 _0x5f1f=['../../components/interaction/service','../../config/environment','./smsQueueReport.controller','index','isAuthenticated','describe','get','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','Router','fs-extra'];(function(_0x449834,_0x234158){var _0x3239b3=function(_0x57496d){while(--_0x57496d){_0x449834['push'](_0x449834['shift']());}};_0x3239b3(++_0x234158);}(_0x5f1f,0x1a0));var _0xf5f1=function(_0x3875b1,_0x47cf1a){_0x3875b1=_0x3875b1-0x0;var _0x1e9c55=_0x5f1f[_0x3875b1];return _0x1e9c55;};'use strict';var multer=require(_0xf5f1('0x0'));var util=require(_0xf5f1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf5f1('0x2')]();var fs_extra=require(_0xf5f1('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xf5f1('0x4'));var config=require(_0xf5f1('0x5'));var controller=require(_0xf5f1('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xf5f1('0x7')]);router['get']('/describe',auth[_0xf5f1('0x8')](),controller[_0xf5f1('0x9')]);router[_0xf5f1('0xa')](_0xf5f1('0xb'),auth[_0xf5f1('0x8')](),controller[_0xf5f1('0xc')]);router[_0xf5f1('0xd')]('/',auth[_0xf5f1('0x8')](),controller[_0xf5f1('0xe')]);router[_0xf5f1('0xf')]('/:id',auth[_0xf5f1('0x8')](),controller[_0xf5f1('0x10')]);router[_0xf5f1('0x11')](_0xf5f1('0xb'),auth[_0xf5f1('0x8')](),controller[_0xf5f1('0x12')]);module[_0xf5f1('0x13')]=router; \ No newline at end of file +var _0x497d=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','isAuthenticated','index','get','/describe','describe','show','post','create','/:id','update','delete','exports','util','path','connect-timeout','Router'];(function(_0x36c6df,_0x5bac54){var _0x2e5075=function(_0xf3f404){while(--_0xf3f404){_0x36c6df['push'](_0x36c6df['shift']());}};_0x2e5075(++_0x5bac54);}(_0x497d,0x1a0));var _0xd497=function(_0x50eea4,_0x5ceac5){_0x50eea4=_0x50eea4-0x0;var _0xa60d80=_0x497d[_0x50eea4];return _0xa60d80;};'use strict';var multer=require('multer');var util=require(_0xd497('0x0'));var path=require(_0xd497('0x1'));var timeout=require(_0xd497('0x2'));var express=require('express');var router=express[_0xd497('0x3')]();var fs_extra=require(_0xd497('0x4'));var auth=require(_0xd497('0x5'));var interaction=require(_0xd497('0x6'));var config=require(_0xd497('0x7'));var controller=require(_0xd497('0x8'));router['get']('/',auth[_0xd497('0x9')](),controller[_0xd497('0xa')]);router[_0xd497('0xb')](_0xd497('0xc'),auth[_0xd497('0x9')](),controller[_0xd497('0xd')]);router[_0xd497('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xd497('0xe')]);router[_0xd497('0xf')]('/',auth['isAuthenticated'](),controller[_0xd497('0x10')]);router['put'](_0xd497('0x11'),auth[_0xd497('0x9')](),controller[_0xd497('0x12')]);router[_0xd497('0x13')](_0xd497('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0xd497('0x14')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index f335b56..6121cb8 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 _0xabd2=['exports','STRING','DATE','moment'];(function(_0x29588b,_0x582f54){var _0x1192bf=function(_0x17df27){while(--_0x17df27){_0x29588b['push'](_0x29588b['shift']());}};_0x1192bf(++_0x582f54);}(_0xabd2,0x93));var _0x2abd=function(_0x185fb1,_0x30ad2f){_0x185fb1=_0x185fb1-0x0;var _0x3ab848=_0xabd2[_0x185fb1];return _0x3ab848;};'use strict';var moment=require(_0x2abd('0x0'));var Sequelize=require('sequelize');module[_0x2abd('0x1')]={'uniqueid':{'type':Sequelize[_0x2abd('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x2abd('0x2')]},'joinAt':{'type':Sequelize[_0x2abd('0x3')]},'leaveAt':{'type':Sequelize[_0x2abd('0x3')]},'acceptAt':{'type':Sequelize[_0x2abd('0x3')]},'exitAt':{'type':Sequelize[_0x2abd('0x3')]},'reason':{'type':Sequelize[_0x2abd('0x2')]}}; \ No newline at end of file +var _0x6cff=['DATE','STRING'];(function(_0x329664,_0x130748){var _0x4e346e=function(_0x172b0d){while(--_0x172b0d){_0x329664['push'](_0x329664['shift']());}};_0x4e346e(++_0x130748);}(_0x6cff,0x1db));var _0xf6cf=function(_0x1ad93b,_0x56bee2){_0x1ad93b=_0x1ad93b-0x0;var _0x5c83a3=_0x6cff[_0x1ad93b];return _0x5c83a3;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xf6cf('0x0')],'allowNull':![]},'from':{'type':Sequelize[_0xf6cf('0x0')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xf6cf('0x1')]},'acceptAt':{'type':Sequelize[_0xf6cf('0x1')]},'exitAt':{'type':Sequelize[_0xf6cf('0x1')]},'reason':{'type':Sequelize[_0xf6cf('0x0')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 897c14c..c9ec53d 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 _0xdbd4=['attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','rows','catch','show','params','rawAttributes','length','options','find','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','then','destroy','error','stack','name','send','index','map','SmsQueueReport','fieldName','type','key','model','query','keys','filters','intersection','fields'];(function(_0x2947a2,_0x193327){var _0x291041=function(_0x53931e){while(--_0x53931e){_0x2947a2['push'](_0x2947a2['shift']());}};_0x291041(++_0x193327);}(_0xdbd4,0x143));var _0x4dbd=function(_0xbbaeb0,_0x1ee1de){_0xbbaeb0=_0xbbaeb0-0x0;var _0x2060c2=_0xdbd4[_0xbbaeb0];return _0x2060c2;};'use strict';var emlformat=require(_0x4dbd('0x0'));var rimraf=require(_0x4dbd('0x1'));var zipdir=require(_0x4dbd('0x2'));var jsonpatch=require(_0x4dbd('0x3'));var rp=require('request-promise');var moment=require(_0x4dbd('0x4'));var BPromise=require(_0x4dbd('0x5'));var Mustache=require(_0x4dbd('0x6'));var util=require(_0x4dbd('0x7'));var path=require(_0x4dbd('0x8'));var sox=require(_0x4dbd('0x9'));var csv=require(_0x4dbd('0xa'));var ejs=require(_0x4dbd('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4dbd('0xc'));var squel=require(_0x4dbd('0xd'));var crypto=require('crypto');var jsforce=require(_0x4dbd('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4dbd('0xf'));var Papa=require(_0x4dbd('0x10'));var Redis=require(_0x4dbd('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x4dbd('0x12'));var hardwareService=require(_0x4dbd('0x13'));var logger=require(_0x4dbd('0x14'))(_0x4dbd('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4dbd('0x16'));var db=require(_0x4dbd('0x17'))['db'];function respondWithStatusCode(_0x44422d,_0x494f71){_0x494f71=_0x494f71||0xcc;return function(_0x11b652){if(_0x11b652){return _0x44422d[_0x4dbd('0x18')](_0x494f71);}return _0x44422d[_0x4dbd('0x19')](_0x494f71)[_0x4dbd('0x1a')]();};}function respondWithResult(_0xc9a6b3,_0xdfefa4){_0xdfefa4=_0xdfefa4||0xc8;return function(_0x501e71){if(_0x501e71){return _0xc9a6b3[_0x4dbd('0x19')](_0xdfefa4)[_0x4dbd('0x1b')](_0x501e71);}};}function respondWithFilteredResult(_0x2627d3,_0x3ade9a){return function(_0x6243c7){if(_0x6243c7){var _0x24be9c=typeof _0x3ade9a[_0x4dbd('0x1c')]==='undefined'&&typeof _0x3ade9a[_0x4dbd('0x1d')]===_0x4dbd('0x1e');var _0x14f227=_0x6243c7[_0x4dbd('0x1f')];var _0x4cfe02=_0x24be9c?0x0:_0x3ade9a['offset'];var _0x5ca537=_0x24be9c?_0x6243c7[_0x4dbd('0x1f')]:_0x3ade9a[_0x4dbd('0x1c')]+_0x3ade9a[_0x4dbd('0x1d')];var _0x1d41e8;if(_0x5ca537>=_0x14f227){_0x5ca537=_0x14f227;_0x1d41e8=0xc8;}else{_0x1d41e8=0xce;}_0x2627d3[_0x4dbd('0x19')](_0x1d41e8);return _0x2627d3['set'](_0x4dbd('0x20'),_0x4cfe02+'-'+_0x5ca537+'/'+_0x14f227)[_0x4dbd('0x1b')](_0x6243c7);}return null;};}function patchUpdates(_0x3c2a7a){return function(_0x5d54e3){try{jsonpatch[_0x4dbd('0x21')](_0x5d54e3,_0x3c2a7a,!![]);}catch(_0x211c9c){return BPromise['reject'](_0x211c9c);}return _0x5d54e3['save']();};}function saveUpdates(_0x54e56e,_0x14b690){return function(_0x44467e){if(_0x44467e){return _0x44467e['update'](_0x54e56e)[_0x4dbd('0x22')](function(_0x381aea){return _0x381aea;});}return null;};}function removeEntity(_0x447a5f,_0x584294){return function(_0x5938ca){if(_0x5938ca){return _0x5938ca[_0x4dbd('0x23')]()[_0x4dbd('0x22')](function(){_0x447a5f[_0x4dbd('0x19')](0xcc)[_0x4dbd('0x1a')]();});}};}function handleEntityNotFound(_0x308743,_0x2bbab7){return function(_0x90075b){if(!_0x90075b){_0x308743['sendStatus'](0x194);}return _0x90075b;};}function handleError(_0x548d62,_0x581200){_0x581200=_0x581200||0x1f4;return function(_0x1075b8){logger[_0x4dbd('0x24')](_0x1075b8[_0x4dbd('0x25')]);if(_0x1075b8[_0x4dbd('0x26')]){delete _0x1075b8['name'];}_0x548d62[_0x4dbd('0x19')](_0x581200)[_0x4dbd('0x27')](_0x1075b8);};}exports[_0x4dbd('0x28')]=function(_0x159a66,_0x28fb81){var _0x457c27={},_0x200ee8={},_0x3a54fd={'count':0x0,'rows':[]};var _0x28caa0=_[_0x4dbd('0x29')](db[_0x4dbd('0x2a')]['rawAttributes'],function(_0x47010d){return{'name':_0x47010d[_0x4dbd('0x2b')],'type':_0x47010d[_0x4dbd('0x2c')][_0x4dbd('0x2d')]};});_0x200ee8[_0x4dbd('0x2e')]=_[_0x4dbd('0x29')](_0x28caa0,_0x4dbd('0x26'));_0x200ee8[_0x4dbd('0x2f')]=_[_0x4dbd('0x30')](_0x159a66[_0x4dbd('0x2f')]);_0x200ee8[_0x4dbd('0x31')]=_['intersection'](_0x200ee8[_0x4dbd('0x2e')],_0x200ee8[_0x4dbd('0x2f')]);_0x457c27['attributes']=_[_0x4dbd('0x32')](_0x200ee8[_0x4dbd('0x2e')],qs[_0x4dbd('0x33')](_0x159a66[_0x4dbd('0x2f')][_0x4dbd('0x33')]));_0x457c27['attributes']=_0x457c27[_0x4dbd('0x34')]['length']?_0x457c27[_0x4dbd('0x34')]:_0x200ee8[_0x4dbd('0x2e')];if(!_0x159a66[_0x4dbd('0x2f')][_0x4dbd('0x35')](_0x4dbd('0x36'))){_0x457c27[_0x4dbd('0x1d')]=qs['limit'](_0x159a66[_0x4dbd('0x2f')][_0x4dbd('0x1d')]);_0x457c27[_0x4dbd('0x1c')]=qs[_0x4dbd('0x1c')](_0x159a66[_0x4dbd('0x2f')][_0x4dbd('0x1c')]);}_0x457c27[_0x4dbd('0x37')]=qs['sort'](_0x159a66[_0x4dbd('0x2f')][_0x4dbd('0x38')]);_0x457c27['where']=qs['filters'](_[_0x4dbd('0x39')](_0x159a66[_0x4dbd('0x2f')],_0x200ee8[_0x4dbd('0x31')]),_0x28caa0);if(_0x159a66['query'][_0x4dbd('0x3a')]){_0x457c27[_0x4dbd('0x3b')]=_[_0x4dbd('0x3c')](_0x457c27[_0x4dbd('0x3b')],{'$or':_[_0x4dbd('0x29')](_0x28caa0,function(_0x406a74){if(_0x406a74[_0x4dbd('0x2c')]!==_0x4dbd('0x3d')){var _0x5d521a={};_0x5d521a[_0x406a74[_0x4dbd('0x26')]]={'$like':'%'+_0x159a66[_0x4dbd('0x2f')][_0x4dbd('0x3a')]+'%'};return _0x5d521a;}})});}_0x457c27=_['merge']({},_0x457c27,_0x159a66['options']);var _0x5cb8b1={'where':_0x457c27[_0x4dbd('0x3b')]};return db[_0x4dbd('0x2a')][_0x4dbd('0x1f')](_0x5cb8b1)['then'](function(_0x35b6e0){_0x3a54fd['count']=_0x35b6e0;if(_0x159a66['query'][_0x4dbd('0x3e')]){_0x457c27[_0x4dbd('0x3f')]=[{'all':!![]}];}return db[_0x4dbd('0x2a')]['findAll'](_0x457c27);})[_0x4dbd('0x22')](function(_0x3461c7){_0x3a54fd[_0x4dbd('0x40')]=_0x3461c7;return _0x3a54fd;})[_0x4dbd('0x22')](respondWithFilteredResult(_0x28fb81,_0x457c27))[_0x4dbd('0x41')](handleError(_0x28fb81,null));};exports[_0x4dbd('0x42')]=function(_0x3930c5,_0x98c4ed){var _0x363e17={'raw':!![],'where':{'id':_0x3930c5[_0x4dbd('0x43')]['id']}},_0x5c11c0={};_0x5c11c0['model']=_[_0x4dbd('0x30')](db[_0x4dbd('0x2a')][_0x4dbd('0x44')]);_0x5c11c0[_0x4dbd('0x2f')]=_[_0x4dbd('0x30')](_0x3930c5[_0x4dbd('0x2f')]);_0x5c11c0[_0x4dbd('0x31')]=_[_0x4dbd('0x32')](_0x5c11c0[_0x4dbd('0x2e')],_0x5c11c0[_0x4dbd('0x2f')]);_0x363e17[_0x4dbd('0x34')]=_[_0x4dbd('0x32')](_0x5c11c0[_0x4dbd('0x2e')],qs[_0x4dbd('0x33')](_0x3930c5[_0x4dbd('0x2f')][_0x4dbd('0x33')]));_0x363e17[_0x4dbd('0x34')]=_0x363e17[_0x4dbd('0x34')][_0x4dbd('0x45')]?_0x363e17[_0x4dbd('0x34')]:_0x5c11c0[_0x4dbd('0x2e')];if(_0x3930c5[_0x4dbd('0x2f')][_0x4dbd('0x3e')]){_0x363e17['include']=[{'all':!![]}];}_0x363e17=_['merge']({},_0x363e17,_0x3930c5[_0x4dbd('0x46')]);return db[_0x4dbd('0x2a')][_0x4dbd('0x47')](_0x363e17)[_0x4dbd('0x22')](handleEntityNotFound(_0x98c4ed,null))[_0x4dbd('0x22')](respondWithResult(_0x98c4ed,null))[_0x4dbd('0x41')](handleError(_0x98c4ed,null));};exports['create']=function(_0xc20214,_0x32e53d){return db['SmsQueueReport']['create'](_0xc20214[_0x4dbd('0x48')],{})[_0x4dbd('0x22')](respondWithResult(_0x32e53d,0xc9))['catch'](handleError(_0x32e53d,null));};exports[_0x4dbd('0x49')]=function(_0x5b1629,_0x110478){if(_0x5b1629[_0x4dbd('0x48')]['id']){delete _0x5b1629['body']['id'];}return db[_0x4dbd('0x2a')][_0x4dbd('0x47')]({'where':{'id':_0x5b1629[_0x4dbd('0x43')]['id']}})[_0x4dbd('0x22')](handleEntityNotFound(_0x110478,null))[_0x4dbd('0x22')](saveUpdates(_0x5b1629['body'],null))[_0x4dbd('0x22')](respondWithResult(_0x110478,null))[_0x4dbd('0x41')](handleError(_0x110478,null));};exports['destroy']=function(_0x315a21,_0x1f60cd){return db['SmsQueueReport']['find']({'where':{'id':_0x315a21[_0x4dbd('0x43')]['id']}})[_0x4dbd('0x22')](handleEntityNotFound(_0x1f60cd,null))[_0x4dbd('0x22')](removeEntity(_0x1f60cd,null))[_0x4dbd('0x41')](handleError(_0x1f60cd,null));};exports[_0x4dbd('0x4a')]=function(_0x583ff1,_0x44b4cb){return db[_0x4dbd('0x2a')][_0x4dbd('0x4a')]()['then'](respondWithResult(_0x44b4cb,null))[_0x4dbd('0x41')](handleError(_0x44b4cb,null));}; \ No newline at end of file +var _0x3bd2=['to-csv','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','SmsQueueReport','fieldName','type','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','where','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','sox'];(function(_0x3eb969,_0x11c187){var _0x5e62e0=function(_0x4eb12d){while(--_0x4eb12d){_0x3eb969['push'](_0x3eb969['shift']());}};_0x5e62e0(++_0x11c187);}(_0x3bd2,0x1f0));var _0x23bd=function(_0x18a40d,_0x5d12ce){_0x18a40d=_0x18a40d-0x0;var _0x2b2e14=_0x3bd2[_0x18a40d];return _0x2b2e14;};'use strict';var emlformat=require(_0x23bd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x23bd('0x1'));var jsonpatch=require(_0x23bd('0x2'));var rp=require(_0x23bd('0x3'));var moment=require(_0x23bd('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x23bd('0x5'));var path=require(_0x23bd('0x6'));var sox=require(_0x23bd('0x7'));var csv=require(_0x23bd('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x23bd('0x9'));var _=require(_0x23bd('0xa'));var squel=require('squel');var crypto=require(_0x23bd('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x23bd('0xc'));var toCsv=require(_0x23bd('0x8'));var querystring=require(_0x23bd('0xd'));var Papa=require('papaparse');var Redis=require(_0x23bd('0xe'));var authService=require(_0x23bd('0xf'));var qs=require(_0x23bd('0x10'));var as=require(_0x23bd('0x11'));var hardwareService=require(_0x23bd('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x23bd('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x23bd('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4b5ce5,_0x4cee36){_0x4cee36=_0x4cee36||0xcc;return function(_0x92846b){if(_0x92846b){return _0x4b5ce5[_0x23bd('0x15')](_0x4cee36);}return _0x4b5ce5[_0x23bd('0x16')](_0x4cee36)[_0x23bd('0x17')]();};}function respondWithResult(_0x2b1399,_0x456a3c){_0x456a3c=_0x456a3c||0xc8;return function(_0x2396da){if(_0x2396da){return _0x2b1399[_0x23bd('0x16')](_0x456a3c)[_0x23bd('0x18')](_0x2396da);}};}function respondWithFilteredResult(_0x5304a2,_0x3bff00){return function(_0x292bf6){if(_0x292bf6){var _0x263323=typeof _0x3bff00[_0x23bd('0x19')]===_0x23bd('0x1a')&&typeof _0x3bff00[_0x23bd('0x1b')]===_0x23bd('0x1a');var _0x32e1f5=_0x292bf6[_0x23bd('0x1c')];var _0x45e427=_0x263323?0x0:_0x3bff00[_0x23bd('0x19')];var _0x1f1a83=_0x263323?_0x292bf6[_0x23bd('0x1c')]:_0x3bff00['offset']+_0x3bff00[_0x23bd('0x1b')];var _0x97dbf4;if(_0x1f1a83>=_0x32e1f5){_0x1f1a83=_0x32e1f5;_0x97dbf4=0xc8;}else{_0x97dbf4=0xce;}_0x5304a2['status'](_0x97dbf4);return _0x5304a2[_0x23bd('0x1d')](_0x23bd('0x1e'),_0x45e427+'-'+_0x1f1a83+'/'+_0x32e1f5)[_0x23bd('0x18')](_0x292bf6);}return null;};}function patchUpdates(_0x3e97d6){return function(_0xf8b748){try{jsonpatch[_0x23bd('0x1f')](_0xf8b748,_0x3e97d6,!![]);}catch(_0x4a2a8f){return BPromise['reject'](_0x4a2a8f);}return _0xf8b748[_0x23bd('0x20')]();};}function saveUpdates(_0x1bf2ec,_0x1c4bfd){return function(_0x2d3da5){if(_0x2d3da5){return _0x2d3da5[_0x23bd('0x21')](_0x1bf2ec)[_0x23bd('0x22')](function(_0x27782b){return _0x27782b;});}return null;};}function removeEntity(_0x3f77d8,_0xd7d340){return function(_0x41c6f5){if(_0x41c6f5){return _0x41c6f5[_0x23bd('0x23')]()[_0x23bd('0x22')](function(){_0x3f77d8['status'](0xcc)[_0x23bd('0x17')]();});}};}function handleEntityNotFound(_0x2b23e3,_0x7109a){return function(_0x1c2e3e){if(!_0x1c2e3e){_0x2b23e3[_0x23bd('0x15')](0x194);}return _0x1c2e3e;};}function handleError(_0x3385df,_0xecd4ff){_0xecd4ff=_0xecd4ff||0x1f4;return function(_0x3c0f16){logger[_0x23bd('0x24')](_0x3c0f16[_0x23bd('0x25')]);if(_0x3c0f16['name']){delete _0x3c0f16[_0x23bd('0x26')];}_0x3385df['status'](_0xecd4ff)[_0x23bd('0x27')](_0x3c0f16);};}exports['index']=function(_0x4c6d93,_0x46a371){var _0x9297c0={},_0x131264={},_0x30ee5e={'count':0x0,'rows':[]};var _0xc85627=_['map'](db[_0x23bd('0x28')]['rawAttributes'],function(_0x7c49){return{'name':_0x7c49[_0x23bd('0x29')],'type':_0x7c49[_0x23bd('0x2a')]['key']};});_0x131264[_0x23bd('0x2b')]=_[_0x23bd('0x2c')](_0xc85627,_0x23bd('0x26'));_0x131264[_0x23bd('0x2d')]=_['keys'](_0x4c6d93[_0x23bd('0x2d')]);_0x131264[_0x23bd('0x2e')]=_[_0x23bd('0x2f')](_0x131264[_0x23bd('0x2b')],_0x131264['query']);_0x9297c0[_0x23bd('0x30')]=_[_0x23bd('0x2f')](_0x131264[_0x23bd('0x2b')],qs[_0x23bd('0x31')](_0x4c6d93[_0x23bd('0x2d')]['fields']));_0x9297c0['attributes']=_0x9297c0[_0x23bd('0x30')][_0x23bd('0x32')]?_0x9297c0[_0x23bd('0x30')]:_0x131264['model'];if(!_0x4c6d93[_0x23bd('0x2d')][_0x23bd('0x33')]('nolimit')){_0x9297c0[_0x23bd('0x1b')]=qs[_0x23bd('0x1b')](_0x4c6d93[_0x23bd('0x2d')][_0x23bd('0x1b')]);_0x9297c0[_0x23bd('0x19')]=qs['offset'](_0x4c6d93['query'][_0x23bd('0x19')]);}_0x9297c0[_0x23bd('0x34')]=qs[_0x23bd('0x35')](_0x4c6d93[_0x23bd('0x2d')][_0x23bd('0x35')]);_0x9297c0['where']=qs[_0x23bd('0x2e')](_[_0x23bd('0x36')](_0x4c6d93[_0x23bd('0x2d')],_0x131264[_0x23bd('0x2e')]),_0xc85627);if(_0x4c6d93[_0x23bd('0x2d')]['filter']){_0x9297c0['where']=_['merge'](_0x9297c0[_0x23bd('0x37')],{'$or':_[_0x23bd('0x2c')](_0xc85627,function(_0x3a1018){if(_0x3a1018[_0x23bd('0x2a')]!==_0x23bd('0x38')){var _0x19b09d={};_0x19b09d[_0x3a1018[_0x23bd('0x26')]]={'$like':'%'+_0x4c6d93[_0x23bd('0x2d')][_0x23bd('0x39')]+'%'};return _0x19b09d;}})});}_0x9297c0=_[_0x23bd('0x3a')]({},_0x9297c0,_0x4c6d93[_0x23bd('0x3b')]);var _0x5bbd3e={'where':_0x9297c0['where']};return db['SmsQueueReport'][_0x23bd('0x1c')](_0x5bbd3e)[_0x23bd('0x22')](function(_0x19cd06){_0x30ee5e[_0x23bd('0x1c')]=_0x19cd06;if(_0x4c6d93[_0x23bd('0x2d')][_0x23bd('0x3c')]){_0x9297c0[_0x23bd('0x3d')]=[{'all':!![]}];}return db[_0x23bd('0x28')][_0x23bd('0x3e')](_0x9297c0);})[_0x23bd('0x22')](function(_0x2d1863){_0x30ee5e[_0x23bd('0x3f')]=_0x2d1863;return _0x30ee5e;})[_0x23bd('0x22')](respondWithFilteredResult(_0x46a371,_0x9297c0))[_0x23bd('0x40')](handleError(_0x46a371,null));};exports[_0x23bd('0x41')]=function(_0x5be048,_0xc749f3){var _0x591d9d={'raw':!![],'where':{'id':_0x5be048[_0x23bd('0x42')]['id']}},_0x36bce6={};_0x36bce6[_0x23bd('0x2b')]=_[_0x23bd('0x43')](db['SmsQueueReport']['rawAttributes']);_0x36bce6[_0x23bd('0x2d')]=_[_0x23bd('0x43')](_0x5be048[_0x23bd('0x2d')]);_0x36bce6[_0x23bd('0x2e')]=_[_0x23bd('0x2f')](_0x36bce6[_0x23bd('0x2b')],_0x36bce6[_0x23bd('0x2d')]);_0x591d9d[_0x23bd('0x30')]=_[_0x23bd('0x2f')](_0x36bce6[_0x23bd('0x2b')],qs[_0x23bd('0x31')](_0x5be048[_0x23bd('0x2d')][_0x23bd('0x31')]));_0x591d9d['attributes']=_0x591d9d[_0x23bd('0x30')][_0x23bd('0x32')]?_0x591d9d[_0x23bd('0x30')]:_0x36bce6['model'];if(_0x5be048['query'][_0x23bd('0x3c')]){_0x591d9d[_0x23bd('0x3d')]=[{'all':!![]}];}_0x591d9d=_['merge']({},_0x591d9d,_0x5be048[_0x23bd('0x3b')]);return db['SmsQueueReport'][_0x23bd('0x44')](_0x591d9d)[_0x23bd('0x22')](handleEntityNotFound(_0xc749f3,null))['then'](respondWithResult(_0xc749f3,null))[_0x23bd('0x40')](handleError(_0xc749f3,null));};exports[_0x23bd('0x45')]=function(_0x3f9ff3,_0x379f46){return db[_0x23bd('0x28')][_0x23bd('0x45')](_0x3f9ff3['body'],{})[_0x23bd('0x22')](respondWithResult(_0x379f46,0xc9))[_0x23bd('0x40')](handleError(_0x379f46,null));};exports['update']=function(_0x2b3537,_0x1cc5de){if(_0x2b3537[_0x23bd('0x46')]['id']){delete _0x2b3537[_0x23bd('0x46')]['id'];}return db[_0x23bd('0x28')][_0x23bd('0x44')]({'where':{'id':_0x2b3537['params']['id']}})[_0x23bd('0x22')](handleEntityNotFound(_0x1cc5de,null))[_0x23bd('0x22')](saveUpdates(_0x2b3537[_0x23bd('0x46')],null))[_0x23bd('0x22')](respondWithResult(_0x1cc5de,null))[_0x23bd('0x40')](handleError(_0x1cc5de,null));};exports[_0x23bd('0x23')]=function(_0x4607b3,_0x2bb069){return db[_0x23bd('0x28')]['find']({'where':{'id':_0x4607b3[_0x23bd('0x42')]['id']}})[_0x23bd('0x22')](handleEntityNotFound(_0x2bb069,null))[_0x23bd('0x22')](removeEntity(_0x2bb069,null))[_0x23bd('0x40')](handleError(_0x2bb069,null));};exports[_0x23bd('0x47')]=function(_0x1810ba,_0x208b91){return db[_0x23bd('0x28')][_0x23bd('0x47')]()['then'](respondWithResult(_0x208b91,null))[_0x23bd('0x40')](handleError(_0x208b91,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 2654816..7504902 100644 --- a/server/api/smsQueueReport/smsQueueReport.model.js +++ b/server/api/smsQueueReport/smsQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['define','report_sms_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x544068,_0x137d98){var _0x29ab93=function(_0xe01eb1){while(--_0xe01eb1){_0x544068['push'](_0x544068['shift']());}};_0x29ab93(++_0x137d98);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./smsQueueReport.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('SmsQueueReport',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[{'name':_0x0d8b('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xbaf0=['define','SmsQueueReport','report_sms_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','exports'];(function(_0x101f34,_0x87f0c1){var _0x35a94c=function(_0x35b928){while(--_0x35b928){_0x101f34['push'](_0x101f34['shift']());}};_0x35a94c(++_0x87f0c1);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xbaf0[_0x2b4411];return _0x8e41ef;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0baf('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index d6d5ae0..52951e5 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 _0xacc7=['client','http','request','then','info','request\x20sent','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsQueueReport,\x20%s,\x20%s','message','result','catch','CreateSmsQueueReport','SmsQueueReport','body','options','raw','debug','update','where','attributes','limit','UpdateSmsQueueReport','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x199bc4,_0x338105){var _0x136ffb=function(_0x3e7ced){while(--_0x3e7ced){_0x199bc4['push'](_0x199bc4['shift']());}};_0x136ffb(++_0x338105);}(_0xacc7,0x7f));var _0x7acc=function(_0x36de10,_0xfe25e8){_0x36de10=_0x36de10-0x0;var _0x58100f=_0xacc7[_0x36de10];return _0x58100f;};'use strict';var _=require('lodash');var util=require(_0x7acc('0x0'));var moment=require(_0x7acc('0x1'));var BPromise=require(_0x7acc('0x2'));var rs=require(_0x7acc('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7acc('0x4'))['db'];var utils=require(_0x7acc('0x5'));var logger=require(_0x7acc('0x6'))('rpc');var config=require(_0x7acc('0x7'));var jayson=require(_0x7acc('0x8'));var client=jayson[_0x7acc('0x9')][_0x7acc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x45fb49,_0x2f81f4,_0x2edbf3){return new BPromise(function(_0x1d2b46,_0x4a0cfb){return client[_0x7acc('0xb')](_0x45fb49,_0x2edbf3)[_0x7acc('0xc')](function(_0x127b94){logger[_0x7acc('0xd')]('SmsQueueReport,\x20%s,\x20%s',_0x2f81f4,_0x7acc('0xe'));logger['debug'](_0x7acc('0xf'),_0x2f81f4,_0x7acc('0xe'),JSON[_0x7acc('0x10')](_0x127b94));if(_0x127b94[_0x7acc('0x11')]){if(_0x127b94[_0x7acc('0x11')][_0x7acc('0x12')]===0x1f4){logger[_0x7acc('0x11')](_0x7acc('0x13'),_0x2f81f4,_0x127b94['error'][_0x7acc('0x14')]);return _0x4a0cfb(_0x127b94[_0x7acc('0x11')][_0x7acc('0x14')]);}logger['error'](_0x7acc('0x13'),_0x2f81f4,_0x127b94[_0x7acc('0x11')][_0x7acc('0x14')]);return _0x1d2b46(_0x127b94[_0x7acc('0x11')]['message']);}else{logger[_0x7acc('0xd')](_0x7acc('0x13'),_0x2f81f4,_0x7acc('0xe'));_0x1d2b46(_0x127b94[_0x7acc('0x15')][_0x7acc('0x14')]);}})[_0x7acc('0x16')](function(_0x26739e){logger['error'](_0x7acc('0x13'),_0x2f81f4,_0x26739e);_0x4a0cfb(_0x26739e);});});}exports[_0x7acc('0x17')]=function(_0x12748f){var _0x4115f9=this;return new Promise(function(_0x3b80e7,_0xc17f51){return db[_0x7acc('0x18')]['create'](_0x12748f[_0x7acc('0x19')],{'raw':_0x12748f[_0x7acc('0x1a')]?_0x12748f[_0x7acc('0x1a')][_0x7acc('0x1b')]===undefined?!![]:![]:!![]})[_0x7acc('0xc')](function(_0xa4b4b8){logger['info'](_0x7acc('0x17'),_0x12748f);logger[_0x7acc('0x1c')](_0x7acc('0x17'),_0x12748f,JSON[_0x7acc('0x10')](_0xa4b4b8));_0x3b80e7(_0xa4b4b8);})[_0x7acc('0x16')](function(_0x3c1596){logger[_0x7acc('0x11')](_0x7acc('0x17'),_0x3c1596[_0x7acc('0x14')],_0x12748f);_0xc17f51(_0x4115f9[_0x7acc('0x11')](0x1f4,_0x3c1596[_0x7acc('0x14')]));});});};exports['UpdateSmsQueueReport']=function(_0x24318d){var _0xded1ea=this;return new Promise(function(_0x292a6d,_0xbde530){return db[_0x7acc('0x18')][_0x7acc('0x1d')](_0x24318d[_0x7acc('0x19')],{'raw':_0x24318d[_0x7acc('0x1a')]?_0x24318d['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x24318d[_0x7acc('0x1a')]?_0x24318d[_0x7acc('0x1a')][_0x7acc('0x1e')]||null:null,'attributes':_0x24318d[_0x7acc('0x1a')]?_0x24318d[_0x7acc('0x1a')][_0x7acc('0x1f')]||null:null,'limit':_0x24318d[_0x7acc('0x1a')]?_0x24318d[_0x7acc('0x1a')][_0x7acc('0x20')]||null:null})[_0x7acc('0xc')](function(_0xb0bac2){logger[_0x7acc('0xd')](_0x7acc('0x21'),_0x24318d);logger[_0x7acc('0x1c')](_0x7acc('0x21'),_0x24318d,JSON['stringify'](_0xb0bac2));_0x292a6d(_0xb0bac2);})[_0x7acc('0x16')](function(_0x585dce){logger[_0x7acc('0x11')](_0x7acc('0x21'),_0x585dce[_0x7acc('0x14')],_0x24318d);_0xbde530(_0xded1ea[_0x7acc('0x11')](0x1f4,_0x585dce[_0x7acc('0x14')]));});});}; \ No newline at end of file +var _0xc220=['moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','SmsQueueReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','CreateSmsQueueReport','SmsQueueReport','options','then','UpdateSmsQueueReport','update','body','raw','where','limit'];(function(_0x568d44,_0x317e25){var _0x1303f5=function(_0x37d1bd){while(--_0x37d1bd){_0x568d44['push'](_0x568d44['shift']());}};_0x1303f5(++_0x317e25);}(_0xc220,0x1b3));var _0x0c22=function(_0x497eee,_0x4691e6){_0x497eee=_0x497eee-0x0;var _0x5d5027=_0xc220[_0x497eee];return _0x5d5027;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0c22('0x0'));var BPromise=require(_0x0c22('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0c22('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x0c22('0x3'));var logger=require(_0x0c22('0x4'))('rpc');var config=require(_0x0c22('0x5'));var jayson=require(_0x0c22('0x6'));var client=jayson[_0x0c22('0x7')][_0x0c22('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4810f9,_0x534ef0,_0x36295c){return new BPromise(function(_0x24b5de,_0x94bf29){return client[_0x0c22('0x9')](_0x4810f9,_0x36295c)['then'](function(_0x5a48d1){logger[_0x0c22('0xa')](_0x0c22('0xb'),_0x534ef0,'request\x20sent');logger[_0x0c22('0xc')]('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x534ef0,_0x0c22('0xd'),JSON[_0x0c22('0xe')](_0x5a48d1));if(_0x5a48d1[_0x0c22('0xf')]){if(_0x5a48d1[_0x0c22('0xf')]['code']===0x1f4){logger[_0x0c22('0xf')](_0x0c22('0xb'),_0x534ef0,_0x5a48d1[_0x0c22('0xf')]['message']);return _0x94bf29(_0x5a48d1['error']['message']);}logger[_0x0c22('0xf')](_0x0c22('0xb'),_0x534ef0,_0x5a48d1[_0x0c22('0xf')][_0x0c22('0x10')]);return _0x24b5de(_0x5a48d1[_0x0c22('0xf')]['message']);}else{logger[_0x0c22('0xa')]('SmsQueueReport,\x20%s,\x20%s',_0x534ef0,'request\x20sent');_0x24b5de(_0x5a48d1[_0x0c22('0x11')][_0x0c22('0x10')]);}})[_0x0c22('0x12')](function(_0x341dee){logger['error'](_0x0c22('0xb'),_0x534ef0,_0x341dee);_0x94bf29(_0x341dee);});});}exports[_0x0c22('0x13')]=function(_0x32d691){var _0x315d0b=this;return new Promise(function(_0x4d9163,_0x177648){return db[_0x0c22('0x14')]['create'](_0x32d691['body'],{'raw':_0x32d691['options']?_0x32d691[_0x0c22('0x15')]['raw']===undefined?!![]:![]:!![]})[_0x0c22('0x16')](function(_0x591e0c){logger[_0x0c22('0xa')]('CreateSmsQueueReport',_0x32d691);logger['debug'](_0x0c22('0x13'),_0x32d691,JSON[_0x0c22('0xe')](_0x591e0c));_0x4d9163(_0x591e0c);})[_0x0c22('0x12')](function(_0x68ba98){logger['error'](_0x0c22('0x13'),_0x68ba98[_0x0c22('0x10')],_0x32d691);_0x177648(_0x315d0b[_0x0c22('0xf')](0x1f4,_0x68ba98[_0x0c22('0x10')]));});});};exports[_0x0c22('0x17')]=function(_0x399253){var _0x5042b7=this;return new Promise(function(_0x45d9db,_0x5113a2){return db[_0x0c22('0x14')][_0x0c22('0x18')](_0x399253[_0x0c22('0x19')],{'raw':_0x399253[_0x0c22('0x15')]?_0x399253[_0x0c22('0x15')][_0x0c22('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x399253[_0x0c22('0x15')]?_0x399253['options'][_0x0c22('0x1b')]||null:null,'attributes':_0x399253['options']?_0x399253[_0x0c22('0x15')]['attributes']||null:null,'limit':_0x399253[_0x0c22('0x15')]?_0x399253[_0x0c22('0x15')][_0x0c22('0x1c')]||null:null})[_0x0c22('0x16')](function(_0x114781){logger[_0x0c22('0xa')](_0x0c22('0x17'),_0x399253);logger[_0x0c22('0xc')](_0x0c22('0x17'),_0x399253,JSON[_0x0c22('0xe')](_0x114781));_0x45d9db(_0x114781);})[_0x0c22('0x12')](function(_0x2d242a){logger[_0x0c22('0xf')](_0x0c22('0x17'),_0x2d242a['message'],_0x399253);_0x5113a2(_0x5042b7[_0x0c22('0xf')](0x1f4,_0x2d242a[_0x0c22('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index c0b922e..878a976 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 _0x79a8=['fs-extra','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','destroy','exports','multer','path','connect-timeout','express'];(function(_0x49fa8c,_0x30bf01){var _0x2666bc=function(_0x662857){while(--_0x662857){_0x49fa8c['push'](_0x49fa8c['shift']());}};_0x2666bc(++_0x30bf01);}(_0x79a8,0x1d0));var _0x879a=function(_0x421d1f,_0x103891){_0x421d1f=_0x421d1f-0x0;var _0x4228bf=_0x79a8[_0x421d1f];return _0x4228bf;};'use strict';var multer=require(_0x879a('0x0'));var util=require('util');var path=require(_0x879a('0x1'));var timeout=require(_0x879a('0x2'));var express=require(_0x879a('0x3'));var router=express['Router']();var fs_extra=require(_0x879a('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x879a('0x5'));var config=require(_0x879a('0x6'));var controller=require(_0x879a('0x7'));router[_0x879a('0x8')]('/',auth[_0x879a('0x9')](),controller[_0x879a('0xa')]);router[_0x879a('0x8')](_0x879a('0xb'),auth['isAuthenticated'](),controller[_0x879a('0xc')]);router['get'](_0x879a('0xd'),auth[_0x879a('0x9')](),controller['show']);router[_0x879a('0xe')]('/',auth[_0x879a('0x9')](),controller[_0x879a('0xf')]);router['put'](_0x879a('0xd'),auth[_0x879a('0x9')](),controller['update']);router['delete'](_0x879a('0xd'),auth[_0x879a('0x9')](),controller[_0x879a('0x10')]);module[_0x879a('0x11')]=router; \ No newline at end of file +var _0x43fd=['create','put','update','delete','destroy','exports','util','express','Router','../../components/auth/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','post'];(function(_0x4642ab,_0x289453){var _0x28c63b=function(_0x20d879){while(--_0x20d879){_0x4642ab['push'](_0x4642ab['shift']());}};_0x28c63b(++_0x289453);}(_0x43fd,0x1ec));var _0xd43f=function(_0x41dd01,_0x38936d){_0x41dd01=_0x41dd01-0x0;var _0x9c5584=_0x43fd[_0x41dd01];return _0x9c5584;};'use strict';var multer=require('multer');var util=require(_0xd43f('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd43f('0x1'));var router=express[_0xd43f('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xd43f('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xd43f('0x4'));var controller=require(_0xd43f('0x5'));router[_0xd43f('0x6')]('/',auth[_0xd43f('0x7')](),controller['index']);router[_0xd43f('0x6')](_0xd43f('0x8'),auth[_0xd43f('0x7')](),controller[_0xd43f('0x9')]);router['get'](_0xd43f('0xa'),auth[_0xd43f('0x7')](),controller['show']);router[_0xd43f('0xb')]('/',auth[_0xd43f('0x7')](),controller[_0xd43f('0xc')]);router[_0xd43f('0xd')](_0xd43f('0xa'),auth['isAuthenticated'](),controller[_0xd43f('0xe')]);router[_0xd43f('0xf')](_0xd43f('0xa'),auth[_0xd43f('0x7')](),controller[_0xd43f('0x10')]);module[_0xd43f('0x11')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index a275d27..10846c6 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 _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x483afe,_0x4f6d9c){var _0x2303e5=function(_0xf95348){while(--_0xf95348){_0x483afe['push'](_0x483afe['shift']());}};_0x2303e5(++_0x4f6d9c);}(_0x54ef,0x112));var _0xf54e=function(_0x424684,_0x5efcfc){_0x424684=_0x424684-0x0;var _0x3853f0=_0x54ef[_0x424684];return _0x3853f0;};'use strict';var moment=require(_0xf54e('0x0'));var Sequelize=require(_0xf54e('0x1'));module[_0xf54e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf54e('0x3')](_0xf54e('0x4'),_0xf54e('0x5'),_0xf54e('0x6')),'allowNull':![],'defaultValue':_0xf54e('0x6')},'transferredAt':{'type':Sequelize[_0xf54e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xf54e('0x8')]}}; \ No newline at end of file +var _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x4b0722,_0x582296){var _0x808ebe=function(_0x46188d){while(--_0x46188d){_0x4b0722['push'](_0x4b0722['shift']());}};_0x808ebe(++_0x582296);}(_0xaa88,0x137));var _0x8aa8=function(_0x4e4f0e,_0x1c3892){_0x4e4f0e=_0x4e4f0e-0x0;var _0x1a7219=_0xaa88[_0x4e4f0e];return _0x1a7219;};'use strict';var moment=require(_0x8aa8('0x0'));var Sequelize=require(_0x8aa8('0x1'));module[_0x8aa8('0x2')]={'uniqueid':{'type':Sequelize[_0x8aa8('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x8aa8('0x4'),_0x8aa8('0x5'),_0x8aa8('0x6')),'allowNull':![],'defaultValue':_0x8aa8('0x6')},'transferredAt':{'type':Sequelize[_0x8aa8('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x8aa8('0x8')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index fabda2d..baccc06 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 _0xdca0=['show','include','create','catch','body','find','params','describe','eml-format','rimraf','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','index','map','SmsTransferReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xdca0,0x98));var _0x0dca=function(_0x10a480,_0x282218){_0x10a480=_0x10a480-0x0;var _0x2975c5=_0xdca0[_0x10a480];return _0x2975c5;};'use strict';var emlformat=require(_0x0dca('0x0'));var rimraf=require(_0x0dca('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0dca('0x2'));var BPromise=require(_0x0dca('0x3'));var Mustache=require(_0x0dca('0x4'));var util=require('util');var path=require(_0x0dca('0x5'));var sox=require('sox');var csv=require(_0x0dca('0x6'));var ejs=require(_0x0dca('0x7'));var fs=require('fs');var fs_extra=require(_0x0dca('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0dca('0x9'));var deskjs=require(_0x0dca('0xa'));var toCsv=require(_0x0dca('0x6'));var querystring=require(_0x0dca('0xb'));var Papa=require(_0x0dca('0xc'));var Redis=require(_0x0dca('0xd'));var authService=require(_0x0dca('0xe'));var qs=require(_0x0dca('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0dca('0x10'));var logger=require(_0x0dca('0x11'))(_0x0dca('0x12'));var utils=require(_0x0dca('0x13'));var config=require(_0x0dca('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x0dca('0x15'))['db'];function respondWithStatusCode(_0x5dfde0,_0x237bae){_0x237bae=_0x237bae||0xcc;return function(_0x1c9b80){if(_0x1c9b80){return _0x5dfde0['sendStatus'](_0x237bae);}return _0x5dfde0[_0x0dca('0x16')](_0x237bae)['end']();};}function respondWithResult(_0x2189c1,_0x46a571){_0x46a571=_0x46a571||0xc8;return function(_0x2a63b3){if(_0x2a63b3){return _0x2189c1['status'](_0x46a571)[_0x0dca('0x17')](_0x2a63b3);}};}function respondWithFilteredResult(_0x1c1fb9,_0x82ee21){return function(_0x20effe){if(_0x20effe){var _0x325fcd=typeof _0x82ee21[_0x0dca('0x18')]===_0x0dca('0x19')&&typeof _0x82ee21[_0x0dca('0x1a')]===_0x0dca('0x19');var _0x3f1cd4=_0x20effe['count'];var _0x35e818=_0x325fcd?0x0:_0x82ee21[_0x0dca('0x18')];var _0x36f4c1=_0x325fcd?_0x20effe[_0x0dca('0x1b')]:_0x82ee21[_0x0dca('0x18')]+_0x82ee21[_0x0dca('0x1a')];var _0x15aba3;if(_0x36f4c1>=_0x3f1cd4){_0x36f4c1=_0x3f1cd4;_0x15aba3=0xc8;}else{_0x15aba3=0xce;}_0x1c1fb9[_0x0dca('0x16')](_0x15aba3);return _0x1c1fb9[_0x0dca('0x1c')]('Content-Range',_0x35e818+'-'+_0x36f4c1+'/'+_0x3f1cd4)[_0x0dca('0x17')](_0x20effe);}return null;};}function patchUpdates(_0x388297){return function(_0x5cb86e){try{jsonpatch[_0x0dca('0x1d')](_0x5cb86e,_0x388297,!![]);}catch(_0xdf7500){return BPromise[_0x0dca('0x1e')](_0xdf7500);}return _0x5cb86e[_0x0dca('0x1f')]();};}function saveUpdates(_0x190f32,_0x392a10){return function(_0x57ecd0){if(_0x57ecd0){return _0x57ecd0[_0x0dca('0x20')](_0x190f32)[_0x0dca('0x21')](function(_0xda5646){return _0xda5646;});}return null;};}function removeEntity(_0x502bc1,_0x544cf6){return function(_0x255b95){if(_0x255b95){return _0x255b95[_0x0dca('0x22')]()['then'](function(){_0x502bc1[_0x0dca('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x125e98,_0x4382a8){return function(_0x3e855c){if(!_0x3e855c){_0x125e98['sendStatus'](0x194);}return _0x3e855c;};}function handleError(_0x2211dd,_0x550ecc){_0x550ecc=_0x550ecc||0x1f4;return function(_0xdd5b50){logger[_0x0dca('0x23')](_0xdd5b50[_0x0dca('0x24')]);if(_0xdd5b50[_0x0dca('0x25')]){delete _0xdd5b50['name'];}_0x2211dd[_0x0dca('0x16')](_0x550ecc)['send'](_0xdd5b50);};}exports[_0x0dca('0x26')]=function(_0x2f0bd2,_0x2272e8){var _0xac25ad={},_0x56993d={},_0x50b254={'count':0x0,'rows':[]};var _0x1aa597=_[_0x0dca('0x27')](db[_0x0dca('0x28')][_0x0dca('0x29')],function(_0x53e557){return{'name':_0x53e557[_0x0dca('0x2a')],'type':_0x53e557[_0x0dca('0x2b')][_0x0dca('0x2c')]};});_0x56993d[_0x0dca('0x2d')]=_[_0x0dca('0x27')](_0x1aa597,_0x0dca('0x25'));_0x56993d['query']=_[_0x0dca('0x2e')](_0x2f0bd2[_0x0dca('0x2f')]);_0x56993d[_0x0dca('0x30')]=_[_0x0dca('0x31')](_0x56993d['model'],_0x56993d[_0x0dca('0x2f')]);_0xac25ad['attributes']=_[_0x0dca('0x31')](_0x56993d[_0x0dca('0x2d')],qs['fields'](_0x2f0bd2['query'][_0x0dca('0x32')]));_0xac25ad['attributes']=_0xac25ad[_0x0dca('0x33')][_0x0dca('0x34')]?_0xac25ad['attributes']:_0x56993d[_0x0dca('0x2d')];if(!_0x2f0bd2[_0x0dca('0x2f')]['hasOwnProperty'](_0x0dca('0x35'))){_0xac25ad[_0x0dca('0x1a')]=qs[_0x0dca('0x1a')](_0x2f0bd2[_0x0dca('0x2f')][_0x0dca('0x1a')]);_0xac25ad[_0x0dca('0x18')]=qs['offset'](_0x2f0bd2[_0x0dca('0x2f')][_0x0dca('0x18')]);}_0xac25ad['order']=qs['sort'](_0x2f0bd2[_0x0dca('0x2f')][_0x0dca('0x36')]);_0xac25ad[_0x0dca('0x37')]=qs[_0x0dca('0x30')](_[_0x0dca('0x38')](_0x2f0bd2['query'],_0x56993d[_0x0dca('0x30')]),_0x1aa597);if(_0x2f0bd2['query'][_0x0dca('0x39')]){_0xac25ad[_0x0dca('0x37')]=_[_0x0dca('0x3a')](_0xac25ad[_0x0dca('0x37')],{'$or':_[_0x0dca('0x27')](_0x1aa597,function(_0x44b229){if(_0x44b229[_0x0dca('0x2b')]!==_0x0dca('0x3b')){var _0x2da519={};_0x2da519[_0x44b229['name']]={'$like':'%'+_0x2f0bd2['query']['filter']+'%'};return _0x2da519;}})});}_0xac25ad=_[_0x0dca('0x3a')]({},_0xac25ad,_0x2f0bd2[_0x0dca('0x3c')]);var _0x2c0345={'where':_0xac25ad[_0x0dca('0x37')]};return db['SmsTransferReport'][_0x0dca('0x1b')](_0x2c0345)[_0x0dca('0x21')](function(_0x408d2a){_0x50b254[_0x0dca('0x1b')]=_0x408d2a;if(_0x2f0bd2[_0x0dca('0x2f')][_0x0dca('0x3d')]){_0xac25ad['include']=[{'all':!![]}];}return db[_0x0dca('0x28')][_0x0dca('0x3e')](_0xac25ad);})[_0x0dca('0x21')](function(_0x20bef2){_0x50b254[_0x0dca('0x3f')]=_0x20bef2;return _0x50b254;})[_0x0dca('0x21')](respondWithFilteredResult(_0x2272e8,_0xac25ad))['catch'](handleError(_0x2272e8,null));};exports[_0x0dca('0x40')]=function(_0x52f6ad,_0x1f4e99){var _0x2145f8={'raw':!![],'where':{'id':_0x52f6ad['params']['id']}},_0x3075f4={};_0x3075f4['model']=_[_0x0dca('0x2e')](db[_0x0dca('0x28')][_0x0dca('0x29')]);_0x3075f4[_0x0dca('0x2f')]=_[_0x0dca('0x2e')](_0x52f6ad['query']);_0x3075f4[_0x0dca('0x30')]=_['intersection'](_0x3075f4[_0x0dca('0x2d')],_0x3075f4[_0x0dca('0x2f')]);_0x2145f8['attributes']=_[_0x0dca('0x31')](_0x3075f4[_0x0dca('0x2d')],qs[_0x0dca('0x32')](_0x52f6ad[_0x0dca('0x2f')][_0x0dca('0x32')]));_0x2145f8[_0x0dca('0x33')]=_0x2145f8[_0x0dca('0x33')]['length']?_0x2145f8['attributes']:_0x3075f4[_0x0dca('0x2d')];if(_0x52f6ad[_0x0dca('0x2f')]['includeAll']){_0x2145f8[_0x0dca('0x41')]=[{'all':!![]}];}_0x2145f8=_[_0x0dca('0x3a')]({},_0x2145f8,_0x52f6ad['options']);return db[_0x0dca('0x28')]['find'](_0x2145f8)[_0x0dca('0x21')](handleEntityNotFound(_0x1f4e99,null))[_0x0dca('0x21')](respondWithResult(_0x1f4e99,null))['catch'](handleError(_0x1f4e99,null));};exports[_0x0dca('0x42')]=function(_0x11baf5,_0x1d79cc){return db[_0x0dca('0x28')][_0x0dca('0x42')](_0x11baf5['body'],{})[_0x0dca('0x21')](respondWithResult(_0x1d79cc,0xc9))[_0x0dca('0x43')](handleError(_0x1d79cc,null));};exports[_0x0dca('0x20')]=function(_0xa553c1,_0x5ec45a){if(_0xa553c1[_0x0dca('0x44')]['id']){delete _0xa553c1[_0x0dca('0x44')]['id'];}return db[_0x0dca('0x28')][_0x0dca('0x45')]({'where':{'id':_0xa553c1['params']['id']}})['then'](handleEntityNotFound(_0x5ec45a,null))[_0x0dca('0x21')](saveUpdates(_0xa553c1[_0x0dca('0x44')],null))[_0x0dca('0x21')](respondWithResult(_0x5ec45a,null))[_0x0dca('0x43')](handleError(_0x5ec45a,null));};exports[_0x0dca('0x22')]=function(_0xa9ec9c,_0x39185d){return db[_0x0dca('0x28')][_0x0dca('0x45')]({'where':{'id':_0xa9ec9c[_0x0dca('0x46')]['id']}})[_0x0dca('0x21')](handleEntityNotFound(_0x39185d,null))['then'](removeEntity(_0x39185d,null))[_0x0dca('0x43')](handleError(_0x39185d,null));};exports[_0x0dca('0x47')]=function(_0x2be936,_0x187fbd){return db['SmsTransferReport']['describe']()['then'](respondWithResult(_0x187fbd,null))[_0x0dca('0x43')](handleError(_0x187fbd,null));}; \ No newline at end of file +var _0x6240=['fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','send','map','rawAttributes','fieldName','type','key','name','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','merge','VIRTUAL','filter','options','SmsTransferReport','includeAll','findAll','rows','catch','show','include','create','body','find','params','describe','eml-format','rimraf','zip-dir'];(function(_0x4f320f,_0x56c1f6){var _0x341c69=function(_0x1241d8){while(--_0x1241d8){_0x4f320f['push'](_0x4f320f['shift']());}};_0x341c69(++_0x56c1f6);}(_0x6240,0xe4));var _0x0624=function(_0x563a58,_0x40eab9){_0x563a58=_0x563a58-0x0;var _0x485ec6=_0x6240[_0x563a58];return _0x485ec6;};'use strict';var emlformat=require(_0x0624('0x0'));var rimraf=require(_0x0624('0x1'));var zipdir=require(_0x0624('0x2'));var jsonpatch=require(_0x0624('0x3'));var rp=require(_0x0624('0x4'));var moment=require(_0x0624('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0624('0x6'));var util=require(_0x0624('0x7'));var path=require(_0x0624('0x8'));var sox=require(_0x0624('0x9'));var csv=require(_0x0624('0xa'));var ejs=require(_0x0624('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0624('0xc'));var squel=require(_0x0624('0xd'));var crypto=require(_0x0624('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0624('0xa'));var querystring=require(_0x0624('0xf'));var Papa=require('papaparse');var Redis=require(_0x0624('0x10'));var authService=require(_0x0624('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x0624('0x12'));var hardwareService=require(_0x0624('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x0624('0x14'));var config=require(_0x0624('0x15'));var licenseUtil=require(_0x0624('0x16'));var db=require(_0x0624('0x17'))['db'];function respondWithStatusCode(_0x56b937,_0x2cc650){_0x2cc650=_0x2cc650||0xcc;return function(_0x4de469){if(_0x4de469){return _0x56b937['sendStatus'](_0x2cc650);}return _0x56b937['status'](_0x2cc650)[_0x0624('0x18')]();};}function respondWithResult(_0x22bcd2,_0x21df54){_0x21df54=_0x21df54||0xc8;return function(_0x257880){if(_0x257880){return _0x22bcd2[_0x0624('0x19')](_0x21df54)[_0x0624('0x1a')](_0x257880);}};}function respondWithFilteredResult(_0x2973f9,_0x4fb19a){return function(_0x7e2e0e){if(_0x7e2e0e){var _0x5d717b=typeof _0x4fb19a['offset']===_0x0624('0x1b')&&typeof _0x4fb19a[_0x0624('0x1c')]===_0x0624('0x1b');var _0x1047bb=_0x7e2e0e[_0x0624('0x1d')];var _0x3c0b53=_0x5d717b?0x0:_0x4fb19a[_0x0624('0x1e')];var _0xc6ba22=_0x5d717b?_0x7e2e0e['count']:_0x4fb19a[_0x0624('0x1e')]+_0x4fb19a[_0x0624('0x1c')];var _0xa9aeab;if(_0xc6ba22>=_0x1047bb){_0xc6ba22=_0x1047bb;_0xa9aeab=0xc8;}else{_0xa9aeab=0xce;}_0x2973f9[_0x0624('0x19')](_0xa9aeab);return _0x2973f9[_0x0624('0x1f')](_0x0624('0x20'),_0x3c0b53+'-'+_0xc6ba22+'/'+_0x1047bb)[_0x0624('0x1a')](_0x7e2e0e);}return null;};}function patchUpdates(_0x1327d7){return function(_0x5eb1cf){try{jsonpatch['apply'](_0x5eb1cf,_0x1327d7,!![]);}catch(_0x346d1b){return BPromise[_0x0624('0x21')](_0x346d1b);}return _0x5eb1cf[_0x0624('0x22')]();};}function saveUpdates(_0x5aaedf,_0x51bc9b){return function(_0x213ca4){if(_0x213ca4){return _0x213ca4[_0x0624('0x23')](_0x5aaedf)[_0x0624('0x24')](function(_0x4ab74e){return _0x4ab74e;});}return null;};}function removeEntity(_0x16fb83,_0x2d7de0){return function(_0x3020ad){if(_0x3020ad){return _0x3020ad[_0x0624('0x25')]()[_0x0624('0x24')](function(){_0x16fb83['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f2060,_0x2ffe8c){return function(_0x30533b){if(!_0x30533b){_0x4f2060[_0x0624('0x26')](0x194);}return _0x30533b;};}function handleError(_0x54ec9a,_0x5c10f4){_0x5c10f4=_0x5c10f4||0x1f4;return function(_0x251828){logger[_0x0624('0x27')](_0x251828[_0x0624('0x28')]);if(_0x251828['name']){delete _0x251828['name'];}_0x54ec9a['status'](_0x5c10f4)[_0x0624('0x29')](_0x251828);};}exports['index']=function(_0x4940f6,_0x5d5763){var _0x2cc7c7={},_0x1f4b57={},_0xb15deb={'count':0x0,'rows':[]};var _0x3f4398=_[_0x0624('0x2a')](db['SmsTransferReport'][_0x0624('0x2b')],function(_0x2b8e17){return{'name':_0x2b8e17[_0x0624('0x2c')],'type':_0x2b8e17[_0x0624('0x2d')][_0x0624('0x2e')]};});_0x1f4b57['model']=_[_0x0624('0x2a')](_0x3f4398,_0x0624('0x2f'));_0x1f4b57[_0x0624('0x30')]=_[_0x0624('0x31')](_0x4940f6['query']);_0x1f4b57['filters']=_[_0x0624('0x32')](_0x1f4b57['model'],_0x1f4b57[_0x0624('0x30')]);_0x2cc7c7[_0x0624('0x33')]=_['intersection'](_0x1f4b57[_0x0624('0x34')],qs[_0x0624('0x35')](_0x4940f6['query'][_0x0624('0x35')]));_0x2cc7c7[_0x0624('0x33')]=_0x2cc7c7[_0x0624('0x33')][_0x0624('0x36')]?_0x2cc7c7[_0x0624('0x33')]:_0x1f4b57[_0x0624('0x34')];if(!_0x4940f6[_0x0624('0x30')][_0x0624('0x37')](_0x0624('0x38'))){_0x2cc7c7[_0x0624('0x1c')]=qs[_0x0624('0x1c')](_0x4940f6[_0x0624('0x30')][_0x0624('0x1c')]);_0x2cc7c7['offset']=qs[_0x0624('0x1e')](_0x4940f6[_0x0624('0x30')][_0x0624('0x1e')]);}_0x2cc7c7['order']=qs[_0x0624('0x39')](_0x4940f6['query'][_0x0624('0x39')]);_0x2cc7c7[_0x0624('0x3a')]=qs[_0x0624('0x3b')](_[_0x0624('0x3c')](_0x4940f6[_0x0624('0x30')],_0x1f4b57[_0x0624('0x3b')]),_0x3f4398);if(_0x4940f6[_0x0624('0x30')]['filter']){_0x2cc7c7[_0x0624('0x3a')]=_[_0x0624('0x3d')](_0x2cc7c7[_0x0624('0x3a')],{'$or':_['map'](_0x3f4398,function(_0x3d06fd){if(_0x3d06fd[_0x0624('0x2d')]!==_0x0624('0x3e')){var _0x5a811d={};_0x5a811d[_0x3d06fd[_0x0624('0x2f')]]={'$like':'%'+_0x4940f6[_0x0624('0x30')][_0x0624('0x3f')]+'%'};return _0x5a811d;}})});}_0x2cc7c7=_[_0x0624('0x3d')]({},_0x2cc7c7,_0x4940f6[_0x0624('0x40')]);var _0x42d9c3={'where':_0x2cc7c7[_0x0624('0x3a')]};return db[_0x0624('0x41')][_0x0624('0x1d')](_0x42d9c3)[_0x0624('0x24')](function(_0x29f83f){_0xb15deb['count']=_0x29f83f;if(_0x4940f6['query'][_0x0624('0x42')]){_0x2cc7c7['include']=[{'all':!![]}];}return db[_0x0624('0x41')][_0x0624('0x43')](_0x2cc7c7);})[_0x0624('0x24')](function(_0x1f1663){_0xb15deb[_0x0624('0x44')]=_0x1f1663;return _0xb15deb;})['then'](respondWithFilteredResult(_0x5d5763,_0x2cc7c7))[_0x0624('0x45')](handleError(_0x5d5763,null));};exports[_0x0624('0x46')]=function(_0x85f7b3,_0x1193a8){var _0x5f0790={'raw':!![],'where':{'id':_0x85f7b3['params']['id']}},_0x41f42e={};_0x41f42e['model']=_[_0x0624('0x31')](db[_0x0624('0x41')]['rawAttributes']);_0x41f42e['query']=_[_0x0624('0x31')](_0x85f7b3[_0x0624('0x30')]);_0x41f42e[_0x0624('0x3b')]=_[_0x0624('0x32')](_0x41f42e['model'],_0x41f42e[_0x0624('0x30')]);_0x5f0790[_0x0624('0x33')]=_[_0x0624('0x32')](_0x41f42e[_0x0624('0x34')],qs[_0x0624('0x35')](_0x85f7b3[_0x0624('0x30')]['fields']));_0x5f0790['attributes']=_0x5f0790[_0x0624('0x33')][_0x0624('0x36')]?_0x5f0790[_0x0624('0x33')]:_0x41f42e[_0x0624('0x34')];if(_0x85f7b3[_0x0624('0x30')][_0x0624('0x42')]){_0x5f0790[_0x0624('0x47')]=[{'all':!![]}];}_0x5f0790=_[_0x0624('0x3d')]({},_0x5f0790,_0x85f7b3[_0x0624('0x40')]);return db[_0x0624('0x41')]['find'](_0x5f0790)[_0x0624('0x24')](handleEntityNotFound(_0x1193a8,null))[_0x0624('0x24')](respondWithResult(_0x1193a8,null))[_0x0624('0x45')](handleError(_0x1193a8,null));};exports[_0x0624('0x48')]=function(_0x181625,_0x45b8bd){return db[_0x0624('0x41')][_0x0624('0x48')](_0x181625[_0x0624('0x49')],{})['then'](respondWithResult(_0x45b8bd,0xc9))[_0x0624('0x45')](handleError(_0x45b8bd,null));};exports[_0x0624('0x23')]=function(_0x511bf5,_0x27c3d1){if(_0x511bf5[_0x0624('0x49')]['id']){delete _0x511bf5[_0x0624('0x49')]['id'];}return db['SmsTransferReport']['find']({'where':{'id':_0x511bf5['params']['id']}})[_0x0624('0x24')](handleEntityNotFound(_0x27c3d1,null))[_0x0624('0x24')](saveUpdates(_0x511bf5[_0x0624('0x49')],null))[_0x0624('0x24')](respondWithResult(_0x27c3d1,null))[_0x0624('0x45')](handleError(_0x27c3d1,null));};exports[_0x0624('0x25')]=function(_0x4792d4,_0x34165a){return db['SmsTransferReport'][_0x0624('0x4a')]({'where':{'id':_0x4792d4[_0x0624('0x4b')]['id']}})[_0x0624('0x24')](handleEntityNotFound(_0x34165a,null))[_0x0624('0x24')](removeEntity(_0x34165a,null))['catch'](handleError(_0x34165a,null));};exports[_0x0624('0x4c')]=function(_0x19570a,_0x45d22a){return db[_0x0624('0x41')][_0x0624('0x4c')]()[_0x0624('0x24')](respondWithResult(_0x45d22a,null))['catch'](handleError(_0x45d22a,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index fb4eb7c..c7a3f05 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 _0x3de9=['request-promise','rimraf','../../config/environment','./smsTransferReport.attributes','define','SmsTransferReport','report_sms_transfer','uniqueid','lodash','util','api'];(function(_0xee8aaa,_0x1e1eef){var _0x277a95=function(_0x1b795f){while(--_0x1b795f){_0xee8aaa['push'](_0xee8aaa['shift']());}};_0x277a95(++_0x1e1eef);}(_0x3de9,0x147));var _0x93de=function(_0x3125e2,_0x188fc3){_0x3125e2=_0x3125e2-0x0;var _0x50ba58=_0x3de9[_0x3125e2];return _0x50ba58;};'use strict';var _=require(_0x93de('0x0'));var util=require(_0x93de('0x1'));var logger=require('../../config/logger')(_0x93de('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x93de('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x93de('0x4'));var config=require(_0x93de('0x5'));var attributes=require(_0x93de('0x6'));module['exports']=function(_0x4e3fad,_0x190be1){return _0x4e3fad[_0x93de('0x7')](_0x93de('0x8'),attributes,{'tableName':_0x93de('0x9'),'paranoid':![],'indexes':[{'name':_0x93de('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x7d9a=['define','SmsTransferReport','report_sms_transfer','uniqueid','lodash','util','api','request-promise','path','rimraf','../../config/environment','./smsTransferReport.attributes','exports'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x7d9a,0x1be));var _0xa7d9=function(_0x71df8d,_0x119d73){_0x71df8d=_0x71df8d-0x0;var _0x3a74f8=_0x7d9a[_0x71df8d];return _0x3a74f8;};'use strict';var _=require(_0xa7d9('0x0'));var util=require(_0xa7d9('0x1'));var logger=require('../../config/logger')(_0xa7d9('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa7d9('0x3'));var fs=require('fs');var path=require(_0xa7d9('0x4'));var rimraf=require(_0xa7d9('0x5'));var config=require(_0xa7d9('0x6'));var attributes=require(_0xa7d9('0x7'));module[_0xa7d9('0x8')]=function(_0x33823d,_0x35bce1){return _0x33823d[_0xa7d9('0x9')](_0xa7d9('0xa'),attributes,{'tableName':_0xa7d9('0xb'),'paranoid':![],'indexes':[{'name':_0xa7d9('0xc'),'fields':[_0xa7d9('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 7e56db1..04dbea9 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 _0x4c4e=['result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x20408f,_0x580e46){var _0x31dcbf=function(_0x363981){while(--_0x363981){_0x20408f['push'](_0x20408f['shift']());}};_0x31dcbf(++_0x580e46);}(_0x4c4e,0x152));var _0xe4c4=function(_0x12d082,_0x533a11){_0x12d082=_0x12d082-0x0;var _0x2660b3=_0x4c4e[_0x12d082];return _0x2660b3;};'use strict';var _=require(_0xe4c4('0x0'));var util=require('util');var moment=require(_0xe4c4('0x1'));var BPromise=require(_0xe4c4('0x2'));var rs=require(_0xe4c4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe4c4('0x4'))['db'];var utils=require(_0xe4c4('0x5'));var logger=require(_0xe4c4('0x6'))('rpc');var config=require(_0xe4c4('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe4c4('0x8')][_0xe4c4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x262b64,_0xad105,_0x22085a){return new BPromise(function(_0x329d29,_0x28a42e){return client[_0xe4c4('0xa')](_0x262b64,_0x22085a)['then'](function(_0x589b2e){logger[_0xe4c4('0xb')](_0xe4c4('0xc'),_0xad105,_0xe4c4('0xd'));logger[_0xe4c4('0xe')](_0xe4c4('0xf'),_0xad105,_0xe4c4('0xd'),JSON['stringify'](_0x589b2e));if(_0x589b2e[_0xe4c4('0x10')]){if(_0x589b2e[_0xe4c4('0x10')][_0xe4c4('0x11')]===0x1f4){logger[_0xe4c4('0x10')]('SmsTransferReport,\x20%s,\x20%s',_0xad105,_0x589b2e[_0xe4c4('0x10')][_0xe4c4('0x12')]);return _0x28a42e(_0x589b2e['error'][_0xe4c4('0x12')]);}logger[_0xe4c4('0x10')]('SmsTransferReport,\x20%s,\x20%s',_0xad105,_0x589b2e[_0xe4c4('0x10')][_0xe4c4('0x12')]);return _0x329d29(_0x589b2e['error'][_0xe4c4('0x12')]);}else{logger[_0xe4c4('0xb')](_0xe4c4('0xc'),_0xad105,_0xe4c4('0xd'));_0x329d29(_0x589b2e[_0xe4c4('0x13')][_0xe4c4('0x12')]);}})[_0xe4c4('0x14')](function(_0x1038cb){logger[_0xe4c4('0x10')](_0xe4c4('0xc'),_0xad105,_0x1038cb);_0x28a42e(_0x1038cb);});});} \ No newline at end of file +var _0x1061=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','randomstring','ioredis'];(function(_0x4311aa,_0x4a5856){var _0x343634=function(_0x5d8919){while(--_0x5d8919){_0x4311aa['push'](_0x4311aa['shift']());}};_0x343634(++_0x4a5856);}(_0x1061,0x1b5));var _0x1106=function(_0xe7615c,_0x2a57e3){_0xe7615c=_0xe7615c-0x0;var _0x57e58b=_0x1061[_0xe7615c];return _0x57e58b;};'use strict';var _=require(_0x1106('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1106('0x1'));var fs=require('fs');var Redis=require(_0x1106('0x2'));var db=require(_0x1106('0x3'))['db'];var utils=require(_0x1106('0x4'));var logger=require(_0x1106('0x5'))(_0x1106('0x6'));var config=require(_0x1106('0x7'));var jayson=require(_0x1106('0x8'));var client=jayson['client'][_0x1106('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x36bfb3,_0x54d2d5,_0x523f0f){return new BPromise(function(_0x287336,_0x3056e0){return client['request'](_0x36bfb3,_0x523f0f)['then'](function(_0x223c85){logger[_0x1106('0xa')](_0x1106('0xb'),_0x54d2d5,_0x1106('0xc'));logger[_0x1106('0xd')](_0x1106('0xe'),_0x54d2d5,_0x1106('0xc'),JSON[_0x1106('0xf')](_0x223c85));if(_0x223c85[_0x1106('0x10')]){if(_0x223c85[_0x1106('0x10')]['code']===0x1f4){logger[_0x1106('0x10')](_0x1106('0xb'),_0x54d2d5,_0x223c85[_0x1106('0x10')][_0x1106('0x11')]);return _0x3056e0(_0x223c85[_0x1106('0x10')][_0x1106('0x11')]);}logger[_0x1106('0x10')](_0x1106('0xb'),_0x54d2d5,_0x223c85[_0x1106('0x10')][_0x1106('0x11')]);return _0x287336(_0x223c85[_0x1106('0x10')][_0x1106('0x11')]);}else{logger[_0x1106('0xa')](_0x1106('0xb'),_0x54d2d5,_0x1106('0xc'));_0x287336(_0x223c85[_0x1106('0x12')][_0x1106('0x11')]);}})[_0x1106('0x13')](function(_0x547ca3){logger['error'](_0x1106('0xb'),_0x54d2d5,_0x547ca3);_0x3056e0(_0x547ca3);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index a0583d5..7cc3426 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 _0x13f4=['../../components/interaction/service','../../config/environment','isAuthenticated','index','/:id','get','/:id/download','download','diskStorage','join','root','originalname','replace','format','%s-%s%s','basename','extname','now','single','file','put','update','delete','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x2713fc,_0x2d6afc){var _0x2cdd07=function(_0x4d061d){while(--_0x4d061d){_0x2713fc['push'](_0x2713fc['shift']());}};_0x2cdd07(++_0x2d6afc);}(_0x13f4,0x144));var _0x413f=function(_0x54d5ba,_0x1f1ba9){_0x54d5ba=_0x54d5ba-0x0;var _0x6a592e=_0x13f4[_0x54d5ba];return _0x6a592e;};'use strict';var multer=require(_0x413f('0x0'));var util=require('util');var path=require(_0x413f('0x1'));var timeout=require(_0x413f('0x2'));var express=require('express');var router=express[_0x413f('0x3')]();var fs_extra=require(_0x413f('0x4'));var auth=require(_0x413f('0x5'));var interaction=require(_0x413f('0x6'));var config=require(_0x413f('0x7'));var controller=require('./sound.controller');router['get']('/',auth[_0x413f('0x8')](),controller[_0x413f('0x9')]);router['get'](_0x413f('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x413f('0xb')](_0x413f('0xc'),auth[_0x413f('0x8')](),controller[_0x413f('0xd')]);var upload=multer({'storage':multer[_0x413f('0xe')]({'destination':function(_0x462821,_0x2e1ac2,_0xe07ec8){_0xe07ec8(null,path[_0x413f('0xf')](config[_0x413f('0x10')],'server/files/sounds/original/'));},'filename':function(_0x20a82c,_0x548d2c,_0x31ce09){_0x548d2c['originalname']=_0x548d2c[_0x413f('0x11')][_0x413f('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x31ce09(null,util[_0x413f('0x13')](_0x413f('0x14'),path[_0x413f('0x15')](_0x548d2c[_0x413f('0x11')],path[_0x413f('0x16')](_0x548d2c[_0x413f('0x11')])),Date[_0x413f('0x17')](),path['extname'](_0x548d2c[_0x413f('0x11')])));}})});router['post']('/',upload[_0x413f('0x18')](_0x413f('0x19')),controller['create']);router[_0x413f('0x1a')]('/:id',auth['isAuthenticated'](),controller[_0x413f('0x1b')]);router[_0x413f('0x1c')]('/:id',auth[_0x413f('0x8')](),controller[_0x413f('0x1c')]);module[_0x413f('0x1d')]=router; \ No newline at end of file +var _0xdc7b=['index','/:id','show','isAuthenticated','download','join','root','server/files/sounds/original/','originalname','replace','%s-%s%s','basename','extname','now','post','single','file','create','put','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','get'];(function(_0x20f786,_0x3dbe43){var _0x1f9fd8=function(_0x35fb59){while(--_0x35fb59){_0x20f786['push'](_0x20f786['shift']());}};_0x1f9fd8(++_0x3dbe43);}(_0xdc7b,0x1a2));var _0xbdc7=function(_0x434c81,_0x4dde1e){_0x434c81=_0x434c81-0x0;var _0x42f96f=_0xdc7b[_0x434c81];return _0x42f96f;};'use strict';var multer=require('multer');var util=require(_0xbdc7('0x0'));var path=require(_0xbdc7('0x1'));var timeout=require(_0xbdc7('0x2'));var express=require(_0xbdc7('0x3'));var router=express[_0xbdc7('0x4')]();var fs_extra=require(_0xbdc7('0x5'));var auth=require(_0xbdc7('0x6'));var interaction=require(_0xbdc7('0x7'));var config=require(_0xbdc7('0x8'));var controller=require(_0xbdc7('0x9'));router[_0xbdc7('0xa')]('/',auth['isAuthenticated'](),controller[_0xbdc7('0xb')]);router[_0xbdc7('0xa')](_0xbdc7('0xc'),auth['isAuthenticated'](),controller[_0xbdc7('0xd')]);router[_0xbdc7('0xa')]('/:id/download',auth[_0xbdc7('0xe')](),controller[_0xbdc7('0xf')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xf2c692,_0x57d590,_0xc9d14e){_0xc9d14e(null,path[_0xbdc7('0x10')](config[_0xbdc7('0x11')],_0xbdc7('0x12')));},'filename':function(_0x30a22e,_0x2b805e,_0x8b4f16){_0x2b805e[_0xbdc7('0x13')]=_0x2b805e[_0xbdc7('0x13')][_0xbdc7('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x8b4f16(null,util['format'](_0xbdc7('0x15'),path[_0xbdc7('0x16')](_0x2b805e[_0xbdc7('0x13')],path[_0xbdc7('0x17')](_0x2b805e[_0xbdc7('0x13')])),Date[_0xbdc7('0x18')](),path[_0xbdc7('0x17')](_0x2b805e[_0xbdc7('0x13')])));}})});router[_0xbdc7('0x19')]('/',upload[_0xbdc7('0x1a')](_0xbdc7('0x1b')),controller[_0xbdc7('0x1c')]);router[_0xbdc7('0x1d')](_0xbdc7('0xc'),auth['isAuthenticated'](),controller[_0xbdc7('0x1e')]);router[_0xbdc7('0x1f')](_0xbdc7('0xc'),auth[_0xbdc7('0xe')](),controller[_0xbdc7('0x1f')]);module[_0xbdc7('0x20')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 39c8663..c930cce 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 _0x7faf=['INTEGER','sequelize','STRING','FLOAT'];(function(_0x3a65a1,_0x26a192){var _0x331ac5=function(_0xa74001){while(--_0xa74001){_0x3a65a1['push'](_0x3a65a1['shift']());}};_0x331ac5(++_0x26a192);}(_0x7faf,0x12d));var _0xf7fa=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7faf[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xf7fa('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0xf7fa('0x1')]},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize[_0xf7fa('0x1')]},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize[_0xf7fa('0x2')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize[_0xf7fa('0x3')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0xf7fa('0x3')]},'converted_format':{'type':Sequelize[_0xf7fa('0x1')]},'converted_duration':{'type':Sequelize[_0xf7fa('0x2')]},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0xf7fa('0x3')]}}; \ No newline at end of file +var _0x9236=['INTEGER','sequelize','STRING','FLOAT','BIGINT'];(function(_0x1e99e8,_0x1af034){var _0x59cfa7=function(_0xe33557){while(--_0xe33557){_0x1e99e8['push'](_0x1e99e8['shift']());}};_0x59cfa7(++_0x1af034);}(_0x9236,0x114));var _0x6923=function(_0x5dc067,_0x3446d0){_0x5dc067=_0x5dc067-0x0;var _0x25f40b=_0x9236[_0x5dc067];return _0x25f40b;};'use strict';var Sequelize=require(_0x6923('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0x6923('0x1')]},'display_name':{'type':Sequelize[_0x6923('0x1')],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize[_0x6923('0x2')]},'original_sampleCount':{'type':Sequelize[_0x6923('0x3')]},'original_channelCount':{'type':Sequelize[_0x6923('0x4')]},'original_bitRate':{'type':Sequelize[_0x6923('0x3')]},'original_sampleRate':{'type':Sequelize[_0x6923('0x4')]},'converted_format':{'type':Sequelize[_0x6923('0x1')]},'converted_duration':{'type':Sequelize[_0x6923('0x2')]},'converted_sampleCount':{'type':Sequelize[_0x6923('0x3')]},'converted_channelCount':{'type':Sequelize[_0x6923('0x4')]},'converted_bitRate':{'type':Sequelize[_0x6923('0x3')]},'converted_sampleRate':{'type':Sequelize[_0x6923('0x4')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 546ce16..44cad2f 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 _0xb553=['sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','undefined','count','offset','limit','json','apply','reject','save','update','then','Sounds','UserProfileResource','destroy','end','error','stack','name','send','map','Sound','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','includeAll','rows','show','include','options','params','converted_format','existsSync','root','server/files/sounds/converted','save_name','Sequelize','ValidationError','Sound\x20not\x20found','download','format','%s.%s','create','file','originalname','extname','basename','filename','substring','wav','join','server/files/sounds/original','info','Sound\x20upload\x20destination:\x20%s','0777','transcode','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','bitRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','chmodSync','body','role','userProfileId','user','get','UserProfileSection','find','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','delete','original_format','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path'];(function(_0x12c6b6,_0x150b2c){var _0x201a02=function(_0x437bbc){while(--_0x437bbc){_0x12c6b6['push'](_0x12c6b6['shift']());}};_0x201a02(++_0x150b2c);}(_0xb553,0x17b));var _0x3b55=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0xb553[_0x5f0089];return _0x193892;};'use strict';var emlformat=require(_0x3b55('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3b55('0x1'));var jsonpatch=require(_0x3b55('0x2'));var rp=require('request-promise');var moment=require(_0x3b55('0x3'));var BPromise=require(_0x3b55('0x4'));var Mustache=require(_0x3b55('0x5'));var util=require(_0x3b55('0x6'));var path=require(_0x3b55('0x7'));var sox=require(_0x3b55('0x8'));var csv=require(_0x3b55('0x9'));var ejs=require(_0x3b55('0xa'));var fs=require('fs');var fs_extra=require(_0x3b55('0xb'));var _=require(_0x3b55('0xc'));var squel=require(_0x3b55('0xd'));var crypto=require(_0x3b55('0xe'));var jsforce=require(_0x3b55('0xf'));var deskjs=require(_0x3b55('0x10'));var toCsv=require(_0x3b55('0x9'));var querystring=require(_0x3b55('0x11'));var Papa=require('papaparse');var Redis=require(_0x3b55('0x12'));var authService=require(_0x3b55('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x3b55('0x14'));var hardwareService=require(_0x3b55('0x15'));var logger=require(_0x3b55('0x16'))(_0x3b55('0x17'));var utils=require(_0x3b55('0x18'));var config=require(_0x3b55('0x19'));var licenseUtil=require(_0x3b55('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5bc8ca,_0x524caf){_0x524caf=_0x524caf||0xcc;return function(_0x3ac038){if(_0x3ac038){return _0x5bc8ca[_0x3b55('0x1b')](_0x524caf);}return _0x5bc8ca[_0x3b55('0x1c')](_0x524caf)['end']();};}function respondWithResult(_0xa67ad9,_0x137f16){_0x137f16=_0x137f16||0xc8;return function(_0xf1bb0e){if(_0xf1bb0e){return _0xa67ad9[_0x3b55('0x1c')](_0x137f16)['json'](_0xf1bb0e);}};}function respondWithFilteredResult(_0x5a125c,_0x46c0a0){return function(_0x2bc806){if(_0x2bc806){var _0x3ce050=typeof _0x46c0a0['offset']===_0x3b55('0x1d')&&typeof _0x46c0a0['limit']==='undefined';var _0x3d8be9=_0x2bc806[_0x3b55('0x1e')];var _0x655f74=_0x3ce050?0x0:_0x46c0a0[_0x3b55('0x1f')];var _0xb304f3=_0x3ce050?_0x2bc806[_0x3b55('0x1e')]:_0x46c0a0[_0x3b55('0x1f')]+_0x46c0a0[_0x3b55('0x20')];var _0x1ecdfc;if(_0xb304f3>=_0x3d8be9){_0xb304f3=_0x3d8be9;_0x1ecdfc=0xc8;}else{_0x1ecdfc=0xce;}_0x5a125c['status'](_0x1ecdfc);return _0x5a125c['set']('Content-Range',_0x655f74+'-'+_0xb304f3+'/'+_0x3d8be9)[_0x3b55('0x21')](_0x2bc806);}return null;};}function patchUpdates(_0x3f9830){return function(_0x4ee9ea){try{jsonpatch[_0x3b55('0x22')](_0x4ee9ea,_0x3f9830,!![]);}catch(_0x330e73){return BPromise[_0x3b55('0x23')](_0x330e73);}return _0x4ee9ea[_0x3b55('0x24')]();};}function saveUpdates(_0x3d4632,_0x11d2b5){return function(_0x328186){if(_0x328186){return _0x328186[_0x3b55('0x25')](_0x3d4632)[_0x3b55('0x26')](function(_0x173f3d){return _0x173f3d;});}return null;};}function removeEntity(_0x3eb850,_0x3e3dee){return function(_0x3f6c2f){if(_0x3f6c2f){return _0x3f6c2f['destroy']()['then'](function(){var _0x4261b0=_0x3f6c2f['get']({'plain':!![]});var _0x2e1d28=_0x3b55('0x27');return db[_0x3b55('0x28')][_0x3b55('0x29')]({'where':{'type':_0x2e1d28,'resourceId':_0x4261b0['id']}})[_0x3b55('0x26')](function(){return _0x3f6c2f;});})[_0x3b55('0x26')](function(){_0x3eb850[_0x3b55('0x1c')](0xcc)[_0x3b55('0x2a')]();});}};}function handleEntityNotFound(_0xc971bf,_0x1eca1b){return function(_0x55e313){if(!_0x55e313){_0xc971bf[_0x3b55('0x1b')](0x194);}return _0x55e313;};}function handleError(_0x10f683,_0x4bb702){_0x4bb702=_0x4bb702||0x1f4;return function(_0x5c9d61){logger[_0x3b55('0x2b')](_0x5c9d61[_0x3b55('0x2c')]);if(_0x5c9d61[_0x3b55('0x2d')]){delete _0x5c9d61[_0x3b55('0x2d')];}_0x10f683[_0x3b55('0x1c')](_0x4bb702)[_0x3b55('0x2e')](_0x5c9d61);};}exports['index']=function(_0x31210b,_0x3879a5){var _0x2f9e1a={},_0xbf70e2={},_0x1f3b8b={'count':0x0,'rows':[]};var _0x50930e=_[_0x3b55('0x2f')](db[_0x3b55('0x30')][_0x3b55('0x31')],function(_0x593137){return{'name':_0x593137[_0x3b55('0x32')],'type':_0x593137['type'][_0x3b55('0x33')]};});_0xbf70e2['model']=_['map'](_0x50930e,_0x3b55('0x2d'));_0xbf70e2[_0x3b55('0x34')]=_[_0x3b55('0x35')](_0x31210b[_0x3b55('0x34')]);_0xbf70e2['filters']=_[_0x3b55('0x36')](_0xbf70e2[_0x3b55('0x37')],_0xbf70e2[_0x3b55('0x34')]);_0x2f9e1a[_0x3b55('0x38')]=_[_0x3b55('0x36')](_0xbf70e2['model'],qs[_0x3b55('0x39')](_0x31210b[_0x3b55('0x34')][_0x3b55('0x39')]));_0x2f9e1a[_0x3b55('0x38')]=_0x2f9e1a[_0x3b55('0x38')][_0x3b55('0x3a')]?_0x2f9e1a[_0x3b55('0x38')]:_0xbf70e2[_0x3b55('0x37')];if(!_0x31210b[_0x3b55('0x34')][_0x3b55('0x3b')](_0x3b55('0x3c'))){_0x2f9e1a[_0x3b55('0x20')]=qs['limit'](_0x31210b[_0x3b55('0x34')][_0x3b55('0x20')]);_0x2f9e1a[_0x3b55('0x1f')]=qs[_0x3b55('0x1f')](_0x31210b[_0x3b55('0x34')]['offset']);}_0x2f9e1a[_0x3b55('0x3d')]=qs[_0x3b55('0x3e')](_0x31210b[_0x3b55('0x34')][_0x3b55('0x3e')]);_0x2f9e1a[_0x3b55('0x3f')]=qs[_0x3b55('0x40')](_[_0x3b55('0x41')](_0x31210b[_0x3b55('0x34')],_0xbf70e2[_0x3b55('0x40')]),_0x50930e);if(_0x31210b[_0x3b55('0x34')][_0x3b55('0x42')]){_0x2f9e1a[_0x3b55('0x3f')]=_[_0x3b55('0x43')](_0x2f9e1a[_0x3b55('0x3f')],{'$or':_['map'](_0x50930e,function(_0x15775c){if(_0x15775c[_0x3b55('0x44')]!==_0x3b55('0x45')){var _0x474b4a={};_0x474b4a[_0x15775c[_0x3b55('0x2d')]]={'$like':'%'+_0x31210b['query'][_0x3b55('0x42')]+'%'};return _0x474b4a;}})});}_0x2f9e1a=_[_0x3b55('0x43')]({},_0x2f9e1a,_0x31210b['options']);var _0x278dab={'where':_0x2f9e1a[_0x3b55('0x3f')]};return db[_0x3b55('0x30')]['count'](_0x278dab)[_0x3b55('0x26')](function(_0x4faf37){_0x1f3b8b[_0x3b55('0x1e')]=_0x4faf37;if(_0x31210b[_0x3b55('0x34')][_0x3b55('0x46')]){_0x2f9e1a['include']=[{'all':!![]}];}return db['Sound']['findAll'](_0x2f9e1a);})[_0x3b55('0x26')](function(_0x55cd46){_0x1f3b8b[_0x3b55('0x47')]=_0x55cd46;return _0x1f3b8b;})['then'](respondWithFilteredResult(_0x3879a5,_0x2f9e1a))['catch'](handleError(_0x3879a5,null));};exports[_0x3b55('0x48')]=function(_0x10b790,_0x3054ca){var _0x27b4a5={'raw':!![],'where':{'id':_0x10b790['params']['id']}},_0x77a618={};_0x77a618[_0x3b55('0x37')]=_[_0x3b55('0x35')](db[_0x3b55('0x30')]['rawAttributes']);_0x77a618['query']=_[_0x3b55('0x35')](_0x10b790[_0x3b55('0x34')]);_0x77a618[_0x3b55('0x40')]=_['intersection'](_0x77a618['model'],_0x77a618[_0x3b55('0x34')]);_0x27b4a5[_0x3b55('0x38')]=_[_0x3b55('0x36')](_0x77a618['model'],qs['fields'](_0x10b790[_0x3b55('0x34')][_0x3b55('0x39')]));_0x27b4a5[_0x3b55('0x38')]=_0x27b4a5[_0x3b55('0x38')][_0x3b55('0x3a')]?_0x27b4a5[_0x3b55('0x38')]:_0x77a618[_0x3b55('0x37')];if(_0x10b790[_0x3b55('0x34')][_0x3b55('0x46')]){_0x27b4a5[_0x3b55('0x49')]=[{'all':!![]}];}_0x27b4a5=_['merge']({},_0x27b4a5,_0x10b790[_0x3b55('0x4a')]);return db['Sound']['find'](_0x27b4a5)[_0x3b55('0x26')](handleEntityNotFound(_0x3054ca,null))['then'](respondWithResult(_0x3054ca,null))['catch'](handleError(_0x3054ca,null));};exports['download']=function(_0x272839,_0x5c6d4,_0x2ac395){return db[_0x3b55('0x30')]['find']({'where':{'id':_0x272839[_0x3b55('0x4b')]['id']},'attributes':[_0x3b55('0x2d'),'save_name',_0x3b55('0x4c')],'raw':!![]})['then'](handleEntityNotFound(_0x5c6d4,null))[_0x3b55('0x26')](function(_0x531c68){if(_0x531c68){if(!fs[_0x3b55('0x4d')](path['join'](config[_0x3b55('0x4e')],_0x3b55('0x4f'),_0x531c68[_0x3b55('0x50')]+'.'+_0x531c68[_0x3b55('0x4c')]))){throw new db[(_0x3b55('0x51'))][(_0x3b55('0x52'))](_0x3b55('0x53'));}return _0x5c6d4[_0x3b55('0x54')](path['join'](config[_0x3b55('0x4e')],_0x3b55('0x4f'),util[_0x3b55('0x55')](_0x3b55('0x56'),_0x531c68[_0x3b55('0x50')],_0x531c68[_0x3b55('0x4c')])),util[_0x3b55('0x55')](_0x3b55('0x56'),_0x531c68[_0x3b55('0x2d')],_0x531c68[_0x3b55('0x4c')]));}return null;})['catch'](handleError(_0x5c6d4,null));};exports[_0x3b55('0x57')]=function(_0x4ef290,_0x4c8938,_0x30189f){var _0x576910={'name':path['basename'](_0x4ef290[_0x3b55('0x58')][_0x3b55('0x59')],path[_0x3b55('0x5a')](_0x4ef290[_0x3b55('0x58')][_0x3b55('0x59')])),'save_name':path[_0x3b55('0x5b')](_0x4ef290[_0x3b55('0x58')][_0x3b55('0x5c')],path[_0x3b55('0x5a')](_0x4ef290[_0x3b55('0x58')][_0x3b55('0x5c')])),'original_format':path['extname'](_0x4ef290['file'][_0x3b55('0x59')])[_0x3b55('0x5d')](0x1),'converted_format':_0x3b55('0x5e')};var _0xf46d32=path[_0x3b55('0x5f')](config['root'],_0x3b55('0x60'),_0x4ef290['file']['filename']);var _0x1229f7=path[_0x3b55('0x5f')](config[_0x3b55('0x4e')],_0x3b55('0x4f'),util[_0x3b55('0x55')]('%s.%s',path['basename'](_0x4ef290[_0x3b55('0x58')]['filename'],path[_0x3b55('0x5a')](_0x4ef290[_0x3b55('0x58')][_0x3b55('0x5c')])),_0x576910[_0x3b55('0x4c')]));logger[_0x3b55('0x61')]('Sound\x20upload\x20filepath:\x20%s',_0xf46d32);logger['info'](_0x3b55('0x62'),_0x1229f7);try{fs['chmodSync'](_0xf46d32,parseInt(_0x3b55('0x63'),0x8));var _0x3e6295=sox[_0x3b55('0x64')](_0xf46d32,_0x1229f7,{'sampleRate':0x1f40,'format':_0x3b55('0x5e'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x3e6295['on'](_0x3b55('0x2b'),function(_0x1d1100){fs[_0x3b55('0x65')](_0xf46d32);_0x4c8938[_0x3b55('0x1c')](0x1f4)['send'](_0x1d1100);});_0x3e6295['on'](_0x3b55('0x66'),function(_0x527045){_0x576910[_0x3b55('0x67')]=isNaN(_0x527045['duration'])?null:_0x527045[_0x3b55('0x68')]*0x3e8;_0x576910[_0x3b55('0x69')]=isNaN(_0x527045[_0x3b55('0x6a')])?null:_0x527045[_0x3b55('0x6a')];_0x576910[_0x3b55('0x6b')]=isNaN(_0x527045[_0x3b55('0x6c')])?null:_0x527045[_0x3b55('0x6c')];_0x576910['original_bitRate']=isNaN(_0x527045['bitRate'])?null:_0x527045[_0x3b55('0x6d')];_0x576910['original_sampleRate']=isNaN(_0x527045[_0x3b55('0x6e')])?null:_0x527045[_0x3b55('0x6e')];});_0x3e6295['on'](_0x3b55('0x6f'),function(_0x4166d2){_0x576910[_0x3b55('0x70')]=isNaN(_0x4166d2['duration'])?null:_0x4166d2[_0x3b55('0x68')]*0x3e8;_0x576910[_0x3b55('0x71')]=isNaN(_0x4166d2['sampleCount'])?null:_0x4166d2['sampleCount'];_0x576910[_0x3b55('0x72')]=isNaN(_0x4166d2[_0x3b55('0x6c')])?null:_0x4166d2['channelCount'];_0x576910[_0x3b55('0x73')]=isNaN(_0x4166d2[_0x3b55('0x6d')])?null:_0x4166d2[_0x3b55('0x6d')];_0x576910['converted_sampleRate']=isNaN(_0x4166d2['sampleRate'])?null:_0x4166d2['sampleRate'];});_0x3e6295['on']('end',function(){fs[_0x3b55('0x74')](_0x1229f7,parseInt(_0x3b55('0x63'),0x8));return db['Sound'][_0x3b55('0x57')](_0x576910)['then'](function(_0x4036b2){var _0x134619={'role':_0x4ef290[_0x3b55('0x75')][_0x3b55('0x76')],'userProfileId':_0x4ef290[_0x3b55('0x75')][_0x3b55('0x77')]};if(!_0x134619)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x134619[_0x3b55('0x76')]===_0x3b55('0x78')){var _0x1d020a=_0x4036b2[_0x3b55('0x79')]({'plain':!![]});return db[_0x3b55('0x7a')][_0x3b55('0x7b')]({'where':{'name':_0x3b55('0x27'),'userProfileId':_0x134619[_0x3b55('0x77')]},'raw':!![]})[_0x3b55('0x26')](function(_0x2f6e57){if(_0x2f6e57&&_0x2f6e57[_0x3b55('0x7c')]===0x0){return db[_0x3b55('0x28')][_0x3b55('0x57')]({'name':_0x1d020a[_0x3b55('0x2d')],'resourceId':_0x1d020a['id'],'type':_0x2f6e57[_0x3b55('0x2d')],'sectionId':_0x2f6e57['id']},{})[_0x3b55('0x26')](function(){return _0x4036b2;});}else{return _0x4036b2;}})[_0x3b55('0x7d')](function(_0x565b84){logger['error'](_0x3b55('0x7e'),_0x565b84);throw _0x565b84;});}return _0x4036b2;})[_0x3b55('0x26')](respondWithResult(_0x4c8938,null))['catch'](handleError(_0x4c8938,null));});_0x3e6295['start']();}catch(_0x1cddec){_0x4c8938[_0x3b55('0x1c')](0x1f4)[_0x3b55('0x2e')](_0x1cddec);}};exports[_0x3b55('0x25')]=function(_0x15e817,_0x36002f,_0x3f46d4){return db['Sound']['find']({'where':{'id':_0x15e817[_0x3b55('0x4b')]['id']}})['then'](handleEntityNotFound(_0x36002f,null))[_0x3b55('0x26')](saveUpdates(_[_0x3b55('0x41')](_0x15e817[_0x3b55('0x75')],[_0x3b55('0x2d'),'description']),null))[_0x3b55('0x26')](respondWithResult(_0x36002f,null))[_0x3b55('0x7d')](handleError(_0x36002f,null));};exports[_0x3b55('0x7f')]=function(_0x4204d1,_0x3e3c5a,_0x2b40c0){return db[_0x3b55('0x30')][_0x3b55('0x7b')]({'where':{'id':_0x4204d1[_0x3b55('0x4b')]['id']}})[_0x3b55('0x26')](function(_0x2355ac){if(_0x2355ac){return _0x2355ac[_0x3b55('0x29')]();}})['then'](function(_0x4f19b8){var _0x3158a5=path[_0x3b55('0x5f')](config[_0x3b55('0x4e')],_0x3b55('0x60'),util[_0x3b55('0x55')](_0x3b55('0x56'),_0x4f19b8[_0x3b55('0x50')],_0x4f19b8[_0x3b55('0x80')]));var _0x1751e6=path[_0x3b55('0x5f')](config[_0x3b55('0x4e')],_0x3b55('0x4f'),util[_0x3b55('0x55')]('%s.%s',_0x4f19b8[_0x3b55('0x50')],_0x4f19b8[_0x3b55('0x4c')]));fs[_0x3b55('0x65')](_0x3158a5);fs['unlinkSync'](_0x1751e6);return _0x4f19b8;})[_0x3b55('0x26')](function(_0x59d3f2){if(_0x59d3f2){return _0x3e3c5a['status'](0xcc)[_0x3b55('0x2a')]();}})[_0x3b55('0x26')](handleEntityNotFound(_0x3e3c5a,null))[_0x3b55('0x7d')](handleError(_0x3e3c5a,null));}; \ No newline at end of file +var _0xde6a=['userProfileId','role','user','get','UserProfileSection','Sounds','autoAssociation','create','start','description','delete','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','offset','set','Content-Range','reject','update','destroy','then','UserProfileResource','end','error','stack','name','send','index','Sound','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','map','VIRTUAL','options','count','includeAll','include','rows','params','find','download','save_name','existsSync','join','root','server/files/sounds/converted','converted_format','Sequelize','ValidationError','format','%s.%s','catch','basename','file','originalname','extname','filename','substring','wav','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','chmodSync','transcode','src','original_duration','duration','original_sampleCount','sampleCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','converted_duration','converted_channelCount','converted_bitRate','converted_sampleRate','0777','body'];(function(_0x34e2a4,_0x15362b){var _0x53ba5b=function(_0x1cfaef){while(--_0x1cfaef){_0x34e2a4['push'](_0x34e2a4['shift']());}};_0x53ba5b(++_0x15362b);}(_0xde6a,0x104));var _0xade6=function(_0x285c69,_0x27bf32){_0x285c69=_0x285c69-0x0;var _0x36e54c=_0xde6a[_0x285c69];return _0x36e54c;};'use strict';var emlformat=require(_0xade6('0x0'));var rimraf=require(_0xade6('0x1'));var zipdir=require(_0xade6('0x2'));var jsonpatch=require(_0xade6('0x3'));var rp=require(_0xade6('0x4'));var moment=require(_0xade6('0x5'));var BPromise=require(_0xade6('0x6'));var Mustache=require(_0xade6('0x7'));var util=require(_0xade6('0x8'));var path=require(_0xade6('0x9'));var sox=require(_0xade6('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xade6('0xb'));var squel=require(_0xade6('0xc'));var crypto=require(_0xade6('0xd'));var jsforce=require(_0xade6('0xe'));var deskjs=require(_0xade6('0xf'));var toCsv=require(_0xade6('0x10'));var querystring=require('querystring');var Papa=require(_0xade6('0x11'));var Redis=require(_0xade6('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xade6('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xade6('0x14'))(_0xade6('0x15'));var utils=require('../../config/utils');var config=require(_0xade6('0x16'));var licenseUtil=require(_0xade6('0x17'));var db=require(_0xade6('0x18'))['db'];function respondWithStatusCode(_0xc98e60,_0x42f30e){_0x42f30e=_0x42f30e||0xcc;return function(_0x52089a){if(_0x52089a){return _0xc98e60[_0xade6('0x19')](_0x42f30e);}return _0xc98e60['status'](_0x42f30e)['end']();};}function respondWithResult(_0x1c32e9,_0x44ef0a){_0x44ef0a=_0x44ef0a||0xc8;return function(_0x1b5203){if(_0x1b5203){return _0x1c32e9[_0xade6('0x1a')](_0x44ef0a)[_0xade6('0x1b')](_0x1b5203);}};}function respondWithFilteredResult(_0x367382,_0x483853){return function(_0x3e3c95){if(_0x3e3c95){var _0x5390eb=typeof _0x483853['offset']===_0xade6('0x1c')&&typeof _0x483853[_0xade6('0x1d')]===_0xade6('0x1c');var _0x2550ef=_0x3e3c95['count'];var _0x1fee78=_0x5390eb?0x0:_0x483853['offset'];var _0x20e58d=_0x5390eb?_0x3e3c95['count']:_0x483853[_0xade6('0x1e')]+_0x483853['limit'];var _0x372bf0;if(_0x20e58d>=_0x2550ef){_0x20e58d=_0x2550ef;_0x372bf0=0xc8;}else{_0x372bf0=0xce;}_0x367382[_0xade6('0x1a')](_0x372bf0);return _0x367382[_0xade6('0x1f')](_0xade6('0x20'),_0x1fee78+'-'+_0x20e58d+'/'+_0x2550ef)[_0xade6('0x1b')](_0x3e3c95);}return null;};}function patchUpdates(_0x23f554){return function(_0x12b870){try{jsonpatch['apply'](_0x12b870,_0x23f554,!![]);}catch(_0x4b97a5){return BPromise[_0xade6('0x21')](_0x4b97a5);}return _0x12b870['save']();};}function saveUpdates(_0x157641,_0x4d4c47){return function(_0x52c935){if(_0x52c935){return _0x52c935[_0xade6('0x22')](_0x157641)['then'](function(_0x44961a){return _0x44961a;});}return null;};}function removeEntity(_0x45b16b,_0x5e941a){return function(_0x3ec5cc){if(_0x3ec5cc){return _0x3ec5cc[_0xade6('0x23')]()[_0xade6('0x24')](function(){var _0x4f2ba2=_0x3ec5cc['get']({'plain':!![]});var _0x36b8a3='Sounds';return db[_0xade6('0x25')][_0xade6('0x23')]({'where':{'type':_0x36b8a3,'resourceId':_0x4f2ba2['id']}})[_0xade6('0x24')](function(){return _0x3ec5cc;});})[_0xade6('0x24')](function(){_0x45b16b[_0xade6('0x1a')](0xcc)[_0xade6('0x26')]();});}};}function handleEntityNotFound(_0x2b4b32,_0xcc8711){return function(_0x3dd30c){if(!_0x3dd30c){_0x2b4b32[_0xade6('0x19')](0x194);}return _0x3dd30c;};}function handleError(_0x4e099c,_0x3771c4){_0x3771c4=_0x3771c4||0x1f4;return function(_0x53ae35){logger[_0xade6('0x27')](_0x53ae35[_0xade6('0x28')]);if(_0x53ae35[_0xade6('0x29')]){delete _0x53ae35[_0xade6('0x29')];}_0x4e099c[_0xade6('0x1a')](_0x3771c4)[_0xade6('0x2a')](_0x53ae35);};}exports[_0xade6('0x2b')]=function(_0x42b234,_0x236d52){var _0x2d970e={},_0x5f21c1={},_0xa04ceb={'count':0x0,'rows':[]};var _0x5574a6=_['map'](db[_0xade6('0x2c')][_0xade6('0x2d')],function(_0x439378){return{'name':_0x439378[_0xade6('0x2e')],'type':_0x439378[_0xade6('0x2f')][_0xade6('0x30')]};});_0x5f21c1['model']=_['map'](_0x5574a6,_0xade6('0x29'));_0x5f21c1[_0xade6('0x31')]=_[_0xade6('0x32')](_0x42b234[_0xade6('0x31')]);_0x5f21c1[_0xade6('0x33')]=_[_0xade6('0x34')](_0x5f21c1[_0xade6('0x35')],_0x5f21c1[_0xade6('0x31')]);_0x2d970e[_0xade6('0x36')]=_[_0xade6('0x34')](_0x5f21c1[_0xade6('0x35')],qs[_0xade6('0x37')](_0x42b234[_0xade6('0x31')][_0xade6('0x37')]));_0x2d970e[_0xade6('0x36')]=_0x2d970e['attributes']['length']?_0x2d970e[_0xade6('0x36')]:_0x5f21c1['model'];if(!_0x42b234[_0xade6('0x31')][_0xade6('0x38')](_0xade6('0x39'))){_0x2d970e['limit']=qs[_0xade6('0x1d')](_0x42b234[_0xade6('0x31')][_0xade6('0x1d')]);_0x2d970e['offset']=qs['offset'](_0x42b234['query'][_0xade6('0x1e')]);}_0x2d970e['order']=qs[_0xade6('0x3a')](_0x42b234[_0xade6('0x31')]['sort']);_0x2d970e[_0xade6('0x3b')]=qs['filters'](_[_0xade6('0x3c')](_0x42b234[_0xade6('0x31')],_0x5f21c1[_0xade6('0x33')]),_0x5574a6);if(_0x42b234['query'][_0xade6('0x3d')]){_0x2d970e['where']=_[_0xade6('0x3e')](_0x2d970e[_0xade6('0x3b')],{'$or':_[_0xade6('0x3f')](_0x5574a6,function(_0x5ec47e){if(_0x5ec47e['type']!==_0xade6('0x40')){var _0x5ce8f5={};_0x5ce8f5[_0x5ec47e[_0xade6('0x29')]]={'$like':'%'+_0x42b234[_0xade6('0x31')]['filter']+'%'};return _0x5ce8f5;}})});}_0x2d970e=_[_0xade6('0x3e')]({},_0x2d970e,_0x42b234[_0xade6('0x41')]);var _0x2b51b5={'where':_0x2d970e[_0xade6('0x3b')]};return db[_0xade6('0x2c')][_0xade6('0x42')](_0x2b51b5)['then'](function(_0x25f1c3){_0xa04ceb[_0xade6('0x42')]=_0x25f1c3;if(_0x42b234['query'][_0xade6('0x43')]){_0x2d970e[_0xade6('0x44')]=[{'all':!![]}];}return db['Sound']['findAll'](_0x2d970e);})['then'](function(_0x2d50b4){_0xa04ceb[_0xade6('0x45')]=_0x2d50b4;return _0xa04ceb;})['then'](respondWithFilteredResult(_0x236d52,_0x2d970e))['catch'](handleError(_0x236d52,null));};exports['show']=function(_0x49cb4c,_0x5d205c){var _0x50deaf={'raw':!![],'where':{'id':_0x49cb4c[_0xade6('0x46')]['id']}},_0x2f1cd6={};_0x2f1cd6['model']=_[_0xade6('0x32')](db[_0xade6('0x2c')][_0xade6('0x2d')]);_0x2f1cd6['query']=_[_0xade6('0x32')](_0x49cb4c[_0xade6('0x31')]);_0x2f1cd6[_0xade6('0x33')]=_['intersection'](_0x2f1cd6[_0xade6('0x35')],_0x2f1cd6[_0xade6('0x31')]);_0x50deaf[_0xade6('0x36')]=_[_0xade6('0x34')](_0x2f1cd6['model'],qs['fields'](_0x49cb4c[_0xade6('0x31')][_0xade6('0x37')]));_0x50deaf[_0xade6('0x36')]=_0x50deaf[_0xade6('0x36')]['length']?_0x50deaf[_0xade6('0x36')]:_0x2f1cd6[_0xade6('0x35')];if(_0x49cb4c[_0xade6('0x31')]['includeAll']){_0x50deaf['include']=[{'all':!![]}];}_0x50deaf=_[_0xade6('0x3e')]({},_0x50deaf,_0x49cb4c[_0xade6('0x41')]);return db['Sound'][_0xade6('0x47')](_0x50deaf)[_0xade6('0x24')](handleEntityNotFound(_0x5d205c,null))[_0xade6('0x24')](respondWithResult(_0x5d205c,null))['catch'](handleError(_0x5d205c,null));};exports[_0xade6('0x48')]=function(_0x29775f,_0x5ac3a9,_0x48ca53){return db[_0xade6('0x2c')]['find']({'where':{'id':_0x29775f[_0xade6('0x46')]['id']},'attributes':['name',_0xade6('0x49'),'converted_format'],'raw':!![]})[_0xade6('0x24')](handleEntityNotFound(_0x5ac3a9,null))[_0xade6('0x24')](function(_0x1f848a){if(_0x1f848a){if(!fs[_0xade6('0x4a')](path[_0xade6('0x4b')](config[_0xade6('0x4c')],_0xade6('0x4d'),_0x1f848a[_0xade6('0x49')]+'.'+_0x1f848a[_0xade6('0x4e')]))){throw new db[(_0xade6('0x4f'))][(_0xade6('0x50'))]('Sound\x20not\x20found');}return _0x5ac3a9[_0xade6('0x48')](path[_0xade6('0x4b')](config[_0xade6('0x4c')],_0xade6('0x4d'),util[_0xade6('0x51')]('%s.%s',_0x1f848a['save_name'],_0x1f848a[_0xade6('0x4e')])),util['format'](_0xade6('0x52'),_0x1f848a[_0xade6('0x29')],_0x1f848a[_0xade6('0x4e')]));}return null;})[_0xade6('0x53')](handleError(_0x5ac3a9,null));};exports['create']=function(_0x207113,_0x338730,_0x1b2132){var _0xf81dfe={'name':path[_0xade6('0x54')](_0x207113[_0xade6('0x55')][_0xade6('0x56')],path[_0xade6('0x57')](_0x207113[_0xade6('0x55')][_0xade6('0x56')])),'save_name':path[_0xade6('0x54')](_0x207113[_0xade6('0x55')][_0xade6('0x58')],path[_0xade6('0x57')](_0x207113['file'][_0xade6('0x58')])),'original_format':path[_0xade6('0x57')](_0x207113[_0xade6('0x55')][_0xade6('0x56')])[_0xade6('0x59')](0x1),'converted_format':_0xade6('0x5a')};var _0x4f71ba=path[_0xade6('0x4b')](config[_0xade6('0x4c')],_0xade6('0x5b'),_0x207113[_0xade6('0x55')]['filename']);var _0xcd35f1=path[_0xade6('0x4b')](config['root'],_0xade6('0x4d'),util[_0xade6('0x51')](_0xade6('0x52'),path[_0xade6('0x54')](_0x207113[_0xade6('0x55')]['filename'],path[_0xade6('0x57')](_0x207113[_0xade6('0x55')][_0xade6('0x58')])),_0xf81dfe[_0xade6('0x4e')]));logger[_0xade6('0x5c')](_0xade6('0x5d'),_0x4f71ba);logger[_0xade6('0x5c')]('Sound\x20upload\x20destination:\x20%s',_0xcd35f1);try{fs[_0xade6('0x5e')](_0x4f71ba,parseInt('0777',0x8));var _0x3104e5=sox[_0xade6('0x5f')](_0x4f71ba,_0xcd35f1,{'sampleRate':0x1f40,'format':_0xade6('0x5a'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x3104e5['on']('error',function(_0x2e301f){fs['unlinkSync'](_0x4f71ba);_0x338730[_0xade6('0x1a')](0x1f4)[_0xade6('0x2a')](_0x2e301f);});_0x3104e5['on'](_0xade6('0x60'),function(_0x2e9c87){_0xf81dfe[_0xade6('0x61')]=isNaN(_0x2e9c87[_0xade6('0x62')])?null:_0x2e9c87[_0xade6('0x62')]*0x3e8;_0xf81dfe[_0xade6('0x63')]=isNaN(_0x2e9c87[_0xade6('0x64')])?null:_0x2e9c87[_0xade6('0x64')];_0xf81dfe['original_channelCount']=isNaN(_0x2e9c87['channelCount'])?null:_0x2e9c87[_0xade6('0x65')];_0xf81dfe[_0xade6('0x66')]=isNaN(_0x2e9c87[_0xade6('0x67')])?null:_0x2e9c87[_0xade6('0x67')];_0xf81dfe[_0xade6('0x68')]=isNaN(_0x2e9c87[_0xade6('0x69')])?null:_0x2e9c87['sampleRate'];});_0x3104e5['on']('dest',function(_0x1a5be7){_0xf81dfe[_0xade6('0x6a')]=isNaN(_0x1a5be7[_0xade6('0x62')])?null:_0x1a5be7[_0xade6('0x62')]*0x3e8;_0xf81dfe['converted_sampleCount']=isNaN(_0x1a5be7[_0xade6('0x64')])?null:_0x1a5be7[_0xade6('0x64')];_0xf81dfe[_0xade6('0x6b')]=isNaN(_0x1a5be7[_0xade6('0x65')])?null:_0x1a5be7['channelCount'];_0xf81dfe[_0xade6('0x6c')]=isNaN(_0x1a5be7[_0xade6('0x67')])?null:_0x1a5be7[_0xade6('0x67')];_0xf81dfe[_0xade6('0x6d')]=isNaN(_0x1a5be7[_0xade6('0x69')])?null:_0x1a5be7['sampleRate'];});_0x3104e5['on']('end',function(){fs[_0xade6('0x5e')](_0xcd35f1,parseInt(_0xade6('0x6e'),0x8));return db['Sound']['create'](_0xf81dfe)[_0xade6('0x24')](function(_0x318c39){var _0x96bd45={'role':_0x207113[_0xade6('0x6f')]['role'],'userProfileId':_0x207113[_0xade6('0x6f')][_0xade6('0x70')]};if(!_0x96bd45)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x96bd45[_0xade6('0x71')]===_0xade6('0x72')){var _0x411f8f=_0x318c39[_0xade6('0x73')]({'plain':!![]});return db[_0xade6('0x74')][_0xade6('0x47')]({'where':{'name':_0xade6('0x75'),'userProfileId':_0x96bd45[_0xade6('0x70')]},'raw':!![]})[_0xade6('0x24')](function(_0x4e0419){if(_0x4e0419&&_0x4e0419[_0xade6('0x76')]===0x0){return db['UserProfileResource'][_0xade6('0x77')]({'name':_0x411f8f['name'],'resourceId':_0x411f8f['id'],'type':_0x4e0419['name'],'sectionId':_0x4e0419['id']},{})[_0xade6('0x24')](function(){return _0x318c39;});}else{return _0x318c39;}})['catch'](function(_0xbd2ccb){logger[_0xade6('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xbd2ccb);throw _0xbd2ccb;});}return _0x318c39;})[_0xade6('0x24')](respondWithResult(_0x338730,null))[_0xade6('0x53')](handleError(_0x338730,null));});_0x3104e5[_0xade6('0x78')]();}catch(_0x4c08ca){_0x338730[_0xade6('0x1a')](0x1f4)[_0xade6('0x2a')](_0x4c08ca);}};exports[_0xade6('0x22')]=function(_0x4b5e8d,_0x443b0b,_0x3af504){return db[_0xade6('0x2c')][_0xade6('0x47')]({'where':{'id':_0x4b5e8d[_0xade6('0x46')]['id']}})[_0xade6('0x24')](handleEntityNotFound(_0x443b0b,null))[_0xade6('0x24')](saveUpdates(_[_0xade6('0x3c')](_0x4b5e8d[_0xade6('0x6f')],[_0xade6('0x29'),_0xade6('0x79')]),null))[_0xade6('0x24')](respondWithResult(_0x443b0b,null))[_0xade6('0x53')](handleError(_0x443b0b,null));};exports[_0xade6('0x7a')]=function(_0x4ac2aa,_0x128f13,_0x1d0bd1){return db['Sound'][_0xade6('0x47')]({'where':{'id':_0x4ac2aa[_0xade6('0x46')]['id']}})[_0xade6('0x24')](function(_0x14cd15){if(_0x14cd15){return _0x14cd15[_0xade6('0x23')]();}})[_0xade6('0x24')](function(_0x1fb39b){var _0x38c12c=path[_0xade6('0x4b')](config[_0xade6('0x4c')],_0xade6('0x5b'),util['format'](_0xade6('0x52'),_0x1fb39b[_0xade6('0x49')],_0x1fb39b['original_format']));var _0x4f4005=path['join'](config[_0xade6('0x4c')],'server/files/sounds/converted',util[_0xade6('0x51')](_0xade6('0x52'),_0x1fb39b[_0xade6('0x49')],_0x1fb39b[_0xade6('0x4e')]));fs['unlinkSync'](_0x38c12c);fs[_0xade6('0x7b')](_0x4f4005);return _0x1fb39b;})[_0xade6('0x24')](function(_0x447bd1){if(_0x447bd1){return _0x128f13['status'](0xcc)[_0xade6('0x26')]();}})[_0xade6('0x24')](handleEntityNotFound(_0x128f13,null))[_0xade6('0x53')](handleError(_0x128f13,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index c93d618..e5349f4 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 _0x12cb=['./sound.attributes','define','util','../../config/logger','request-promise','path','rimraf','../../config/environment'];(function(_0x20229e,_0xa59f8a){var _0x317377=function(_0x290697){while(--_0x290697){_0x20229e['push'](_0x20229e['shift']());}};_0x317377(++_0xa59f8a);}(_0x12cb,0x1d2));var _0xb12c=function(_0x3dee6a,_0x47f072){_0x3dee6a=_0x3dee6a-0x0;var _0x18d17c=_0x12cb[_0x3dee6a];return _0x18d17c;};'use strict';var _=require('lodash');var util=require(_0xb12c('0x0'));var logger=require(_0xb12c('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb12c('0x2'));var fs=require('fs');var path=require(_0xb12c('0x3'));var rimraf=require(_0xb12c('0x4'));var config=require(_0xb12c('0x5'));var attributes=require(_0xb12c('0x6'));module['exports']=function(_0x42aa69,_0x5001aa){return _0x42aa69[_0xb12c('0x7')]('Sound',attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6d93=['../../config/logger','api','moment','bluebird','path','rimraf','./sound.attributes','exports','define','Sound','tools_sounds','lodash','util'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0x6d93,0x73));var _0x36d9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6d93[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x36d9('0x0'));var util=require(_0x36d9('0x1'));var logger=require(_0x36d9('0x2'))(_0x36d9('0x3'));var moment=require(_0x36d9('0x4'));var BPromise=require(_0x36d9('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x36d9('0x6'));var rimraf=require(_0x36d9('0x7'));var config=require('../../config/environment');var attributes=require(_0x36d9('0x8'));module[_0x36d9('0x9')]=function(_0x3a25e9,_0x4e1d48){return _0x3a25e9[_0x36d9('0xa')](_0x36d9('0xb'),attributes,{'tableName':_0x36d9('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 8061702..6d8797d 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 _0xa865=['map','model','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','then','info','Sound,\x20%s,\x20%s','request\x20sent','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSound','options','where','attributes','include'];(function(_0x10791d,_0x2562b6){var _0x1b4f9c=function(_0x3b2815){while(--_0x3b2815){_0x10791d['push'](_0x10791d['shift']());}};_0x1b4f9c(++_0x2562b6);}(_0xa865,0x161));var _0x5a86=function(_0x28d8e5,_0x5277ea){_0x28d8e5=_0x28d8e5-0x0;var _0x24dfa1=_0xa865[_0x28d8e5];return _0x24dfa1;};'use strict';var _=require(_0x5a86('0x0'));var util=require(_0x5a86('0x1'));var moment=require(_0x5a86('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5a86('0x3'));var db=require(_0x5a86('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5a86('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x5a86('0x6'));var client=jayson[_0x5a86('0x7')][_0x5a86('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x48c026,_0x545a0b,_0x3e20a9){return new BPromise(function(_0x51405c,_0x445ee6){return client['request'](_0x48c026,_0x3e20a9)[_0x5a86('0x9')](function(_0x33aba7){logger[_0x5a86('0xa')](_0x5a86('0xb'),_0x545a0b,_0x5a86('0xc'));logger['debug'](_0x5a86('0xd'),_0x545a0b,_0x5a86('0xc'),JSON[_0x5a86('0xe')](_0x33aba7));if(_0x33aba7['error']){if(_0x33aba7[_0x5a86('0xf')][_0x5a86('0x10')]===0x1f4){logger['error']('Sound,\x20%s,\x20%s',_0x545a0b,_0x33aba7['error'][_0x5a86('0x11')]);return _0x445ee6(_0x33aba7[_0x5a86('0xf')][_0x5a86('0x11')]);}logger[_0x5a86('0xf')]('Sound,\x20%s,\x20%s',_0x545a0b,_0x33aba7[_0x5a86('0xf')][_0x5a86('0x11')]);return _0x51405c(_0x33aba7[_0x5a86('0xf')][_0x5a86('0x11')]);}else{logger[_0x5a86('0xa')]('Sound,\x20%s,\x20%s',_0x545a0b,_0x5a86('0xc'));_0x51405c(_0x33aba7[_0x5a86('0x12')][_0x5a86('0x11')]);}})[_0x5a86('0x13')](function(_0x1d1c8e){logger['error'](_0x5a86('0xb'),_0x545a0b,_0x1d1c8e);_0x445ee6(_0x1d1c8e);});});}exports[_0x5a86('0x14')]=function(_0x4280e9){var _0x51cd1c=this;return new Promise(function(_0x4e9e92,_0x20ec0e){return db['Sound']['find']({'raw':_0x4280e9[_0x5a86('0x15')]?_0x4280e9[_0x5a86('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x4280e9[_0x5a86('0x15')]?_0x4280e9['options'][_0x5a86('0x16')]||null:null,'attributes':_0x4280e9[_0x5a86('0x15')]?_0x4280e9[_0x5a86('0x15')][_0x5a86('0x17')]||null:null,'include':_0x4280e9[_0x5a86('0x15')]?_0x4280e9[_0x5a86('0x15')][_0x5a86('0x18')]?_[_0x5a86('0x19')](_0x4280e9[_0x5a86('0x15')]['include'],function(_0x518fe7){return{'model':db[_0x518fe7[_0x5a86('0x1a')]],'as':_0x518fe7['as'],'attributes':_0x518fe7[_0x5a86('0x17')],'include':_0x518fe7['include']?_['map'](_0x518fe7[_0x5a86('0x18')],function(_0x23bdfb){return{'model':db[_0x23bdfb[_0x5a86('0x1a')]],'as':_0x23bdfb['as'],'attributes':_0x23bdfb[_0x5a86('0x17')],'include':_0x23bdfb[_0x5a86('0x18')]?_[_0x5a86('0x19')](_0x23bdfb[_0x5a86('0x18')],function(_0x58204c){return{'model':db[_0x58204c[_0x5a86('0x1a')]],'as':_0x58204c['as'],'attributes':_0x58204c[_0x5a86('0x17')]};}):[]};}):[]};}):[]:[]})[_0x5a86('0x9')](function(_0x15078b){logger[_0x5a86('0xa')]('ShowSound',_0x4280e9);logger['debug'](_0x5a86('0x14'),_0x4280e9,JSON[_0x5a86('0xe')](_0x15078b));_0x4e9e92(_0x15078b);})['catch'](function(_0x3cfc15){logger[_0x5a86('0xf')]('ShowSound',_0x3cfc15[_0x5a86('0x11')],_0x4280e9);_0x20ec0e(_0x51cd1c[_0x5a86('0xf')](0x1f4,_0x3cfc15['message']));});});}; \ No newline at end of file +var _0x32dd=['code','message','result','ShowSound','Sound','find','options','raw','where','attributes','include','model','map','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','then','info','Sound,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x4a3a19,_0x42e5f9){var _0x2e1fa9=function(_0x519b9a){while(--_0x519b9a){_0x4a3a19['push'](_0x4a3a19['shift']());}};_0x2e1fa9(++_0x42e5f9);}(_0x32dd,0x1ce));var _0xd32d=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0x32dd[_0x243b2f];return _0xcb3c2d;};'use strict';var _=require(_0xd32d('0x0'));var util=require(_0xd32d('0x1'));var moment=require(_0xd32d('0x2'));var BPromise=require(_0xd32d('0x3'));var rs=require(_0xd32d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd32d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd32d('0x6'))(_0xd32d('0x7'));var config=require(_0xd32d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd32d('0x9')][_0xd32d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b515a,_0xdb2f1d,_0x18acc6){return new BPromise(function(_0x3a2e58,_0x54a745){return client['request'](_0x3b515a,_0x18acc6)[_0xd32d('0xb')](function(_0x205bc0){logger[_0xd32d('0xc')](_0xd32d('0xd'),_0xdb2f1d,_0xd32d('0xe'));logger[_0xd32d('0xf')]('Sound,\x20%s,\x20%s,\x20%s',_0xdb2f1d,_0xd32d('0xe'),JSON[_0xd32d('0x10')](_0x205bc0));if(_0x205bc0[_0xd32d('0x11')]){if(_0x205bc0[_0xd32d('0x11')][_0xd32d('0x12')]===0x1f4){logger['error'](_0xd32d('0xd'),_0xdb2f1d,_0x205bc0['error'][_0xd32d('0x13')]);return _0x54a745(_0x205bc0['error'][_0xd32d('0x13')]);}logger[_0xd32d('0x11')](_0xd32d('0xd'),_0xdb2f1d,_0x205bc0[_0xd32d('0x11')][_0xd32d('0x13')]);return _0x3a2e58(_0x205bc0[_0xd32d('0x11')]['message']);}else{logger[_0xd32d('0xc')](_0xd32d('0xd'),_0xdb2f1d,_0xd32d('0xe'));_0x3a2e58(_0x205bc0[_0xd32d('0x14')][_0xd32d('0x13')]);}})['catch'](function(_0x36ebe4){logger[_0xd32d('0x11')]('Sound,\x20%s,\x20%s',_0xdb2f1d,_0x36ebe4);_0x54a745(_0x36ebe4);});});}exports[_0xd32d('0x15')]=function(_0xa0fff4){var _0x71e47a=this;return new Promise(function(_0x18fab1,_0x2ff31b){return db[_0xd32d('0x16')][_0xd32d('0x17')]({'raw':_0xa0fff4['options']?_0xa0fff4[_0xd32d('0x18')][_0xd32d('0x19')]===undefined?!![]:![]:!![],'where':_0xa0fff4['options']?_0xa0fff4[_0xd32d('0x18')][_0xd32d('0x1a')]||null:null,'attributes':_0xa0fff4[_0xd32d('0x18')]?_0xa0fff4['options'][_0xd32d('0x1b')]||null:null,'include':_0xa0fff4[_0xd32d('0x18')]?_0xa0fff4[_0xd32d('0x18')][_0xd32d('0x1c')]?_['map'](_0xa0fff4[_0xd32d('0x18')][_0xd32d('0x1c')],function(_0x76976e){return{'model':db[_0x76976e[_0xd32d('0x1d')]],'as':_0x76976e['as'],'attributes':_0x76976e[_0xd32d('0x1b')],'include':_0x76976e[_0xd32d('0x1c')]?_[_0xd32d('0x1e')](_0x76976e['include'],function(_0x2b8b41){return{'model':db[_0x2b8b41[_0xd32d('0x1d')]],'as':_0x2b8b41['as'],'attributes':_0x2b8b41[_0xd32d('0x1b')],'include':_0x2b8b41[_0xd32d('0x1c')]?_[_0xd32d('0x1e')](_0x2b8b41[_0xd32d('0x1c')],function(_0x92bd4e){return{'model':db[_0x92bd4e[_0xd32d('0x1d')]],'as':_0x92bd4e['as'],'attributes':_0x92bd4e[_0xd32d('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xd32d('0xb')](function(_0x14b100){logger['info'](_0xd32d('0x15'),_0xa0fff4);logger[_0xd32d('0xf')](_0xd32d('0x15'),_0xa0fff4,JSON[_0xd32d('0x10')](_0x14b100));_0x18fab1(_0x14b100);})[_0xd32d('0x1f')](function(_0x9a8993){logger[_0xd32d('0x11')](_0xd32d('0x15'),_0x9a8993[_0xd32d('0x13')],_0xa0fff4);_0x2ff31b(_0x71e47a[_0xd32d('0x11')](0x1f4,_0x9a8993['message']));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 7dd6c56..fb02be2 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 _0x8603=['../../components/interaction/service','./squareMessage.controller','isAuthenticated','index','get','/:id','create','put','update','exports','util','path','connect-timeout','fs-extra','../../components/auth/service'];(function(_0xfb02c9,_0x43c274){var _0x9afb71=function(_0x56dff0){while(--_0x56dff0){_0xfb02c9['push'](_0xfb02c9['shift']());}};_0x9afb71(++_0x43c274);}(_0x8603,0x190));var _0x3860=function(_0xd04139,_0x47094a){_0xd04139=_0xd04139-0x0;var _0x2afb4a=_0x8603[_0xd04139];return _0x2afb4a;};'use strict';var multer=require('multer');var util=require(_0x3860('0x0'));var path=require(_0x3860('0x1'));var timeout=require(_0x3860('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x3860('0x3'));var auth=require(_0x3860('0x4'));var interaction=require(_0x3860('0x5'));var config=require('../../config/environment');var controller=require(_0x3860('0x6'));router['get']('/',auth[_0x3860('0x7')](),controller[_0x3860('0x8')]);router[_0x3860('0x9')](_0x3860('0xa'),auth[_0x3860('0x7')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x3860('0xb')]);router[_0x3860('0xc')]('/:id',auth[_0x3860('0x7')](),controller[_0x3860('0xd')]);router['delete'](_0x3860('0xa'),auth[_0x3860('0x7')](),controller['destroy']);module[_0x3860('0xe')]=router; \ No newline at end of file +var _0x2032=['exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete'];(function(_0x410dcc,_0xca2172){var _0x3e799a=function(_0x8289e6){while(--_0x8289e6){_0x410dcc['push'](_0x410dcc['shift']());}};_0x3e799a(++_0xca2172);}(_0x2032,0xd9));var _0x2203=function(_0x4d97ca,_0x2a7aea){_0x4d97ca=_0x4d97ca-0x0;var _0xf9111a=_0x2032[_0x4d97ca];return _0xf9111a;};'use strict';var multer=require('multer');var util=require(_0x2203('0x0'));var path=require(_0x2203('0x1'));var timeout=require(_0x2203('0x2'));var express=require('express');var router=express[_0x2203('0x3')]();var fs_extra=require(_0x2203('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var controller=require(_0x2203('0x7'));router[_0x2203('0x8')]('/',auth[_0x2203('0x9')](),controller[_0x2203('0xa')]);router[_0x2203('0x8')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0xc')]);router[_0x2203('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2203('0xe')]('/:id',auth[_0x2203('0x9')](),controller[_0x2203('0xf')]);router[_0x2203('0x10')]('/:id',auth[_0x2203('0x9')](),controller['destroy']);module[_0x2203('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index a79aaec..1bbc1eb 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 _0x6b13=['ENUM','sequelize','exports','STRING','TEXT'];(function(_0x3aa28e,_0x4905f2){var _0x5a11cd=function(_0x5708ab){while(--_0x5708ab){_0x3aa28e['push'](_0x3aa28e['shift']());}};_0x5a11cd(++_0x4905f2);}(_0x6b13,0x191));var _0x36b1=function(_0x55b86a,_0x9f9772){_0x55b86a=_0x55b86a-0x0;var _0x46f950=_0x6b13[_0x55b86a];return _0x46f950;};'use strict';var Sequelize=require(_0x36b1('0x0'));module[_0x36b1('0x1')]={'uniqueid':{'type':Sequelize[_0x36b1('0x2')]},'body':{'type':Sequelize[_0x36b1('0x3')]('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0x36b1('0x4')]('in','out'),'defaultValue':'out','allowNull':![]},'providerName':{'type':Sequelize[_0x36b1('0x2')]},'providerResponse':{'type':Sequelize[_0x36b1('0x3')]}}; \ No newline at end of file +var _0x2930=['TEXT','medium','ENUM','out','STRING','sequelize','exports'];(function(_0x4ad414,_0x1831f8){var _0x4e142b=function(_0x2ce641){while(--_0x2ce641){_0x4ad414['push'](_0x4ad414['shift']());}};_0x4e142b(++_0x1831f8);}(_0x2930,0x1b7));var _0x0293=function(_0x46dd18,_0x14c1f2){_0x46dd18=_0x46dd18-0x0;var _0x4ce6e6=_0x2930[_0x46dd18];return _0x4ce6e6;};'use strict';var Sequelize=require(_0x0293('0x0'));module[_0x0293('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize[_0x0293('0x2')](_0x0293('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0x0293('0x4')]('in',_0x0293('0x5')),'defaultValue':_0x0293('0x5'),'allowNull':![]},'providerName':{'type':Sequelize[_0x0293('0x6')]},'providerResponse':{'type':Sequelize[_0x0293('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index cfb8462..c584790 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 _0x3eca=['error','stack','name','send','index','SquareMessage','rawAttributes','fieldName','type','key','map','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','count','includeAll','include','findAll','catch','show','params','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','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','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','limit','undefined','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus'];(function(_0x280428,_0x16b1db){var _0x280f2e=function(_0x5651ce){while(--_0x5651ce){_0x280428['push'](_0x280428['shift']());}};_0x280f2e(++_0x16b1db);}(_0x3eca,0x1a5));var _0xa3ec=function(_0x3e32a8,_0x255953){_0x3e32a8=_0x3e32a8-0x0;var _0x2997b0=_0x3eca[_0x3e32a8];return _0x2997b0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa3ec('0x0'));var zipdir=require(_0xa3ec('0x1'));var jsonpatch=require(_0xa3ec('0x2'));var rp=require(_0xa3ec('0x3'));var moment=require(_0xa3ec('0x4'));var BPromise=require(_0xa3ec('0x5'));var Mustache=require(_0xa3ec('0x6'));var util=require(_0xa3ec('0x7'));var path=require('path');var sox=require(_0xa3ec('0x8'));var csv=require('to-csv');var ejs=require(_0xa3ec('0x9'));var fs=require('fs');var fs_extra=require(_0xa3ec('0xa'));var _=require('lodash');var squel=require(_0xa3ec('0xb'));var crypto=require('crypto');var jsforce=require(_0xa3ec('0xc'));var deskjs=require(_0xa3ec('0xd'));var toCsv=require(_0xa3ec('0xe'));var querystring=require(_0xa3ec('0xf'));var Papa=require(_0xa3ec('0x10'));var Redis=require(_0xa3ec('0x11'));var authService=require(_0xa3ec('0x12'));var qs=require(_0xa3ec('0x13'));var as=require(_0xa3ec('0x14'));var hardwareService=require(_0xa3ec('0x15'));var logger=require('../../config/logger')(_0xa3ec('0x16'));var utils=require(_0xa3ec('0x17'));var config=require(_0xa3ec('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xa3ec('0x19'))['db'];function respondWithStatusCode(_0xf7dc8f,_0x5230f6){_0x5230f6=_0x5230f6||0xcc;return function(_0x20d08b){if(_0x20d08b){return _0xf7dc8f['sendStatus'](_0x5230f6);}return _0xf7dc8f['status'](_0x5230f6)[_0xa3ec('0x1a')]();};}function respondWithResult(_0x1838e6,_0x3717af){_0x3717af=_0x3717af||0xc8;return function(_0x8bcdf1){if(_0x8bcdf1){return _0x1838e6[_0xa3ec('0x1b')](_0x3717af)[_0xa3ec('0x1c')](_0x8bcdf1);}};}function respondWithFilteredResult(_0x1e6c63,_0xd80e09){return function(_0x6176b0){if(_0x6176b0){var _0x46e102=typeof _0xd80e09[_0xa3ec('0x1d')]==='undefined'&&typeof _0xd80e09[_0xa3ec('0x1e')]===_0xa3ec('0x1f');var _0x487e80=_0x6176b0['count'];var _0x182336=_0x46e102?0x0:_0xd80e09[_0xa3ec('0x1d')];var _0x2dcf05=_0x46e102?_0x6176b0['count']:_0xd80e09['offset']+_0xd80e09[_0xa3ec('0x1e')];var _0x22ac05;if(_0x2dcf05>=_0x487e80){_0x2dcf05=_0x487e80;_0x22ac05=0xc8;}else{_0x22ac05=0xce;}_0x1e6c63[_0xa3ec('0x1b')](_0x22ac05);return _0x1e6c63[_0xa3ec('0x20')](_0xa3ec('0x21'),_0x182336+'-'+_0x2dcf05+'/'+_0x487e80)[_0xa3ec('0x1c')](_0x6176b0);}return null;};}function patchUpdates(_0x51e65a){return function(_0x1dbdc7){try{jsonpatch[_0xa3ec('0x22')](_0x1dbdc7,_0x51e65a,!![]);}catch(_0x537623){return BPromise[_0xa3ec('0x23')](_0x537623);}return _0x1dbdc7[_0xa3ec('0x24')]();};}function saveUpdates(_0x3e73b1,_0x5c4fd6){return function(_0x5012f6){if(_0x5012f6){return _0x5012f6[_0xa3ec('0x25')](_0x3e73b1)[_0xa3ec('0x26')](function(_0x36150d){return _0x36150d;});}return null;};}function removeEntity(_0x294a33,_0x3ae0a5){return function(_0x3620c5){if(_0x3620c5){return _0x3620c5[_0xa3ec('0x27')]()[_0xa3ec('0x26')](function(){_0x294a33[_0xa3ec('0x1b')](0xcc)[_0xa3ec('0x1a')]();});}};}function handleEntityNotFound(_0x3f1c01,_0x40f135){return function(_0x103363){if(!_0x103363){_0x3f1c01[_0xa3ec('0x28')](0x194);}return _0x103363;};}function handleError(_0x1c4cba,_0x5450b8){_0x5450b8=_0x5450b8||0x1f4;return function(_0x39af25){logger[_0xa3ec('0x29')](_0x39af25[_0xa3ec('0x2a')]);if(_0x39af25[_0xa3ec('0x2b')]){delete _0x39af25[_0xa3ec('0x2b')];}_0x1c4cba['status'](_0x5450b8)[_0xa3ec('0x2c')](_0x39af25);};}exports[_0xa3ec('0x2d')]=function(_0xa295de,_0x8d741e){var _0x436976={},_0x1e086a={},_0x1fb259={'count':0x0,'rows':[]};var _0x9d0cf6=_['map'](db[_0xa3ec('0x2e')][_0xa3ec('0x2f')],function(_0x2f3dc7){return{'name':_0x2f3dc7[_0xa3ec('0x30')],'type':_0x2f3dc7[_0xa3ec('0x31')][_0xa3ec('0x32')]};});_0x1e086a['model']=_[_0xa3ec('0x33')](_0x9d0cf6,'name');_0x1e086a['query']=_[_0xa3ec('0x34')](_0xa295de[_0xa3ec('0x35')]);_0x1e086a[_0xa3ec('0x36')]=_[_0xa3ec('0x37')](_0x1e086a[_0xa3ec('0x38')],_0x1e086a[_0xa3ec('0x35')]);_0x436976[_0xa3ec('0x39')]=_[_0xa3ec('0x37')](_0x1e086a[_0xa3ec('0x38')],qs[_0xa3ec('0x3a')](_0xa295de[_0xa3ec('0x35')][_0xa3ec('0x3a')]));_0x436976[_0xa3ec('0x39')]=_0x436976[_0xa3ec('0x39')][_0xa3ec('0x3b')]?_0x436976[_0xa3ec('0x39')]:_0x1e086a[_0xa3ec('0x38')];if(!_0xa295de[_0xa3ec('0x35')][_0xa3ec('0x3c')](_0xa3ec('0x3d'))){_0x436976[_0xa3ec('0x1e')]=qs[_0xa3ec('0x1e')](_0xa295de['query'][_0xa3ec('0x1e')]);_0x436976[_0xa3ec('0x1d')]=qs['offset'](_0xa295de[_0xa3ec('0x35')][_0xa3ec('0x1d')]);}_0x436976['order']=qs[_0xa3ec('0x3e')](_0xa295de[_0xa3ec('0x35')][_0xa3ec('0x3e')]);_0x436976[_0xa3ec('0x3f')]=qs['filters'](_[_0xa3ec('0x40')](_0xa295de[_0xa3ec('0x35')],_0x1e086a[_0xa3ec('0x36')]),_0x9d0cf6);if(_0xa295de[_0xa3ec('0x35')][_0xa3ec('0x41')]){_0x436976[_0xa3ec('0x3f')]=_[_0xa3ec('0x42')](_0x436976[_0xa3ec('0x3f')],{'$or':_[_0xa3ec('0x33')](_0x9d0cf6,function(_0x5c3b6e){if(_0x5c3b6e[_0xa3ec('0x31')]!=='VIRTUAL'){var _0xca2c83={};_0xca2c83[_0x5c3b6e[_0xa3ec('0x2b')]]={'$like':'%'+_0xa295de[_0xa3ec('0x35')][_0xa3ec('0x41')]+'%'};return _0xca2c83;}})});}_0x436976=_[_0xa3ec('0x42')]({},_0x436976,_0xa295de[_0xa3ec('0x43')]);var _0x53b0c7={'where':_0x436976[_0xa3ec('0x3f')]};return db[_0xa3ec('0x2e')][_0xa3ec('0x44')](_0x53b0c7)[_0xa3ec('0x26')](function(_0x31ceab){_0x1fb259[_0xa3ec('0x44')]=_0x31ceab;if(_0xa295de[_0xa3ec('0x35')][_0xa3ec('0x45')]){_0x436976[_0xa3ec('0x46')]=[{'all':!![]}];}return db['SquareMessage'][_0xa3ec('0x47')](_0x436976);})[_0xa3ec('0x26')](function(_0x27fa57){_0x1fb259['rows']=_0x27fa57;return _0x1fb259;})[_0xa3ec('0x26')](respondWithFilteredResult(_0x8d741e,_0x436976))[_0xa3ec('0x48')](handleError(_0x8d741e,null));};exports[_0xa3ec('0x49')]=function(_0x50b799,_0x1a4593){var _0xfb6059={'raw':!![],'where':{'id':_0x50b799[_0xa3ec('0x4a')]['id']}},_0x298e76={};_0x298e76[_0xa3ec('0x38')]=_[_0xa3ec('0x34')](db[_0xa3ec('0x2e')][_0xa3ec('0x2f')]);_0x298e76['query']=_[_0xa3ec('0x34')](_0x50b799['query']);_0x298e76['filters']=_[_0xa3ec('0x37')](_0x298e76[_0xa3ec('0x38')],_0x298e76[_0xa3ec('0x35')]);_0xfb6059[_0xa3ec('0x39')]=_[_0xa3ec('0x37')](_0x298e76[_0xa3ec('0x38')],qs[_0xa3ec('0x3a')](_0x50b799[_0xa3ec('0x35')][_0xa3ec('0x3a')]));_0xfb6059['attributes']=_0xfb6059[_0xa3ec('0x39')]['length']?_0xfb6059[_0xa3ec('0x39')]:_0x298e76[_0xa3ec('0x38')];if(_0x50b799[_0xa3ec('0x35')][_0xa3ec('0x45')]){_0xfb6059[_0xa3ec('0x46')]=[{'all':!![]}];}_0xfb6059=_[_0xa3ec('0x42')]({},_0xfb6059,_0x50b799[_0xa3ec('0x43')]);return db[_0xa3ec('0x2e')]['find'](_0xfb6059)[_0xa3ec('0x26')](handleEntityNotFound(_0x1a4593,null))[_0xa3ec('0x26')](respondWithResult(_0x1a4593,null))[_0xa3ec('0x48')](handleError(_0x1a4593,null));};exports['create']=function(_0x151bd1,_0x2549a8){return db[_0xa3ec('0x2e')][_0xa3ec('0x4b')](_0x151bd1[_0xa3ec('0x4c')],{})[_0xa3ec('0x26')](respondWithResult(_0x2549a8,0xc9))[_0xa3ec('0x48')](handleError(_0x2549a8,null));};exports[_0xa3ec('0x25')]=function(_0x4b4dc0,_0x4c5895){if(_0x4b4dc0[_0xa3ec('0x4c')]['id']){delete _0x4b4dc0[_0xa3ec('0x4c')]['id'];}return db[_0xa3ec('0x2e')]['find']({'where':{'id':_0x4b4dc0['params']['id']}})['then'](handleEntityNotFound(_0x4c5895,null))[_0xa3ec('0x26')](saveUpdates(_0x4b4dc0[_0xa3ec('0x4c')],null))[_0xa3ec('0x26')](respondWithResult(_0x4c5895,null))['catch'](handleError(_0x4c5895,null));};exports[_0xa3ec('0x27')]=function(_0x45111d,_0x40f017){return db['SquareMessage']['find']({'where':{'id':_0x45111d[_0xa3ec('0x4a')]['id']}})[_0xa3ec('0x26')](handleEntityNotFound(_0x40f017,null))[_0xa3ec('0x26')](removeEntity(_0x40f017,null))[_0xa3ec('0x48')](handleError(_0x40f017,null));}; \ No newline at end of file +var _0x4a41=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','error','stack','send','SquareMessage','rawAttributes','fieldName','type','key','model','map','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','show','includeAll','options','create','body','find','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment'];(function(_0x37d1fd,_0x2c38be){var _0x3977fd=function(_0x4e6d9f){while(--_0x4e6d9f){_0x37d1fd['push'](_0x37d1fd['shift']());}};_0x3977fd(++_0x2c38be);}(_0x4a41,0x1b8));var _0x14a4=function(_0x43f489,_0x2b4fea){_0x43f489=_0x43f489-0x0;var _0x4134b4=_0x4a41[_0x43f489];return _0x4134b4;};'use strict';var emlformat=require(_0x14a4('0x0'));var rimraf=require(_0x14a4('0x1'));var zipdir=require(_0x14a4('0x2'));var jsonpatch=require(_0x14a4('0x3'));var rp=require(_0x14a4('0x4'));var moment=require(_0x14a4('0x5'));var BPromise=require(_0x14a4('0x6'));var Mustache=require(_0x14a4('0x7'));var util=require(_0x14a4('0x8'));var path=require(_0x14a4('0x9'));var sox=require('sox');var csv=require(_0x14a4('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x14a4('0xb'));var _=require(_0x14a4('0xc'));var squel=require('squel');var crypto=require(_0x14a4('0xd'));var jsforce=require(_0x14a4('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x14a4('0xf'));var Papa=require(_0x14a4('0x10'));var Redis=require(_0x14a4('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x14a4('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x14a4('0x13'));var logger=require(_0x14a4('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x14a4('0x15'));var licenseUtil=require(_0x14a4('0x16'));var db=require(_0x14a4('0x17'))['db'];function respondWithStatusCode(_0x54bd98,_0x43cbf3){_0x43cbf3=_0x43cbf3||0xcc;return function(_0x4346d3){if(_0x4346d3){return _0x54bd98[_0x14a4('0x18')](_0x43cbf3);}return _0x54bd98[_0x14a4('0x19')](_0x43cbf3)[_0x14a4('0x1a')]();};}function respondWithResult(_0x3741ca,_0x5edd9c){_0x5edd9c=_0x5edd9c||0xc8;return function(_0x3dfa1f){if(_0x3dfa1f){return _0x3741ca[_0x14a4('0x19')](_0x5edd9c)[_0x14a4('0x1b')](_0x3dfa1f);}};}function respondWithFilteredResult(_0xc17254,_0x399f5c){return function(_0x35c414){if(_0x35c414){var _0x2634c2=typeof _0x399f5c[_0x14a4('0x1c')]===_0x14a4('0x1d')&&typeof _0x399f5c[_0x14a4('0x1e')]===_0x14a4('0x1d');var _0x138475=_0x35c414['count'];var _0x4c51e6=_0x2634c2?0x0:_0x399f5c[_0x14a4('0x1c')];var _0x2b23b5=_0x2634c2?_0x35c414[_0x14a4('0x1f')]:_0x399f5c[_0x14a4('0x1c')]+_0x399f5c[_0x14a4('0x1e')];var _0x34deb8;if(_0x2b23b5>=_0x138475){_0x2b23b5=_0x138475;_0x34deb8=0xc8;}else{_0x34deb8=0xce;}_0xc17254[_0x14a4('0x19')](_0x34deb8);return _0xc17254[_0x14a4('0x20')](_0x14a4('0x21'),_0x4c51e6+'-'+_0x2b23b5+'/'+_0x138475)['json'](_0x35c414);}return null;};}function patchUpdates(_0x1fff9b){return function(_0x14ac74){try{jsonpatch[_0x14a4('0x22')](_0x14ac74,_0x1fff9b,!![]);}catch(_0x5c384f){return BPromise[_0x14a4('0x23')](_0x5c384f);}return _0x14ac74[_0x14a4('0x24')]();};}function saveUpdates(_0x50b2d8,_0x1b170d){return function(_0x247a51){if(_0x247a51){return _0x247a51['update'](_0x50b2d8)['then'](function(_0x104925){return _0x104925;});}return null;};}function removeEntity(_0x22165f,_0x286015){return function(_0x1ae5b0){if(_0x1ae5b0){return _0x1ae5b0[_0x14a4('0x25')]()[_0x14a4('0x26')](function(){_0x22165f[_0x14a4('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e36f6,_0xfda4dc){return function(_0xb94f71){if(!_0xb94f71){_0x4e36f6[_0x14a4('0x18')](0x194);}return _0xb94f71;};}function handleError(_0x35dca6,_0x15e93d){_0x15e93d=_0x15e93d||0x1f4;return function(_0x1e139c){logger[_0x14a4('0x27')](_0x1e139c[_0x14a4('0x28')]);if(_0x1e139c['name']){delete _0x1e139c['name'];}_0x35dca6[_0x14a4('0x19')](_0x15e93d)[_0x14a4('0x29')](_0x1e139c);};}exports['index']=function(_0x1bed8f,_0x2706d7){var _0x51e366={},_0x2edbd7={},_0x103be0={'count':0x0,'rows':[]};var _0x468e2f=_['map'](db[_0x14a4('0x2a')][_0x14a4('0x2b')],function(_0x28b1f1){return{'name':_0x28b1f1[_0x14a4('0x2c')],'type':_0x28b1f1[_0x14a4('0x2d')][_0x14a4('0x2e')]};});_0x2edbd7[_0x14a4('0x2f')]=_[_0x14a4('0x30')](_0x468e2f,_0x14a4('0x31'));_0x2edbd7[_0x14a4('0x32')]=_[_0x14a4('0x33')](_0x1bed8f[_0x14a4('0x32')]);_0x2edbd7[_0x14a4('0x34')]=_[_0x14a4('0x35')](_0x2edbd7[_0x14a4('0x2f')],_0x2edbd7[_0x14a4('0x32')]);_0x51e366['attributes']=_[_0x14a4('0x35')](_0x2edbd7[_0x14a4('0x2f')],qs[_0x14a4('0x36')](_0x1bed8f[_0x14a4('0x32')][_0x14a4('0x36')]));_0x51e366[_0x14a4('0x37')]=_0x51e366[_0x14a4('0x37')][_0x14a4('0x38')]?_0x51e366[_0x14a4('0x37')]:_0x2edbd7[_0x14a4('0x2f')];if(!_0x1bed8f[_0x14a4('0x32')][_0x14a4('0x39')](_0x14a4('0x3a'))){_0x51e366[_0x14a4('0x1e')]=qs[_0x14a4('0x1e')](_0x1bed8f[_0x14a4('0x32')][_0x14a4('0x1e')]);_0x51e366['offset']=qs[_0x14a4('0x1c')](_0x1bed8f['query']['offset']);}_0x51e366[_0x14a4('0x3b')]=qs[_0x14a4('0x3c')](_0x1bed8f[_0x14a4('0x32')][_0x14a4('0x3c')]);_0x51e366[_0x14a4('0x3d')]=qs[_0x14a4('0x34')](_[_0x14a4('0x3e')](_0x1bed8f[_0x14a4('0x32')],_0x2edbd7[_0x14a4('0x34')]),_0x468e2f);if(_0x1bed8f[_0x14a4('0x32')][_0x14a4('0x3f')]){_0x51e366[_0x14a4('0x3d')]=_[_0x14a4('0x40')](_0x51e366[_0x14a4('0x3d')],{'$or':_['map'](_0x468e2f,function(_0x286fd0){if(_0x286fd0[_0x14a4('0x2d')]!==_0x14a4('0x41')){var _0x5a934d={};_0x5a934d[_0x286fd0[_0x14a4('0x31')]]={'$like':'%'+_0x1bed8f[_0x14a4('0x32')][_0x14a4('0x3f')]+'%'};return _0x5a934d;}})});}_0x51e366=_['merge']({},_0x51e366,_0x1bed8f['options']);var _0x2344a7={'where':_0x51e366[_0x14a4('0x3d')]};return db[_0x14a4('0x2a')][_0x14a4('0x1f')](_0x2344a7)[_0x14a4('0x26')](function(_0x23320d){_0x103be0[_0x14a4('0x1f')]=_0x23320d;if(_0x1bed8f[_0x14a4('0x32')]['includeAll']){_0x51e366[_0x14a4('0x42')]=[{'all':!![]}];}return db[_0x14a4('0x2a')][_0x14a4('0x43')](_0x51e366);})[_0x14a4('0x26')](function(_0x3822ef){_0x103be0[_0x14a4('0x44')]=_0x3822ef;return _0x103be0;})[_0x14a4('0x26')](respondWithFilteredResult(_0x2706d7,_0x51e366))[_0x14a4('0x45')](handleError(_0x2706d7,null));};exports[_0x14a4('0x46')]=function(_0x3dbd60,_0x2d19e5){var _0x16a8af={'raw':!![],'where':{'id':_0x3dbd60['params']['id']}},_0x40e797={};_0x40e797[_0x14a4('0x2f')]=_['keys'](db[_0x14a4('0x2a')]['rawAttributes']);_0x40e797[_0x14a4('0x32')]=_[_0x14a4('0x33')](_0x3dbd60[_0x14a4('0x32')]);_0x40e797['filters']=_[_0x14a4('0x35')](_0x40e797[_0x14a4('0x2f')],_0x40e797[_0x14a4('0x32')]);_0x16a8af['attributes']=_['intersection'](_0x40e797[_0x14a4('0x2f')],qs['fields'](_0x3dbd60[_0x14a4('0x32')][_0x14a4('0x36')]));_0x16a8af['attributes']=_0x16a8af[_0x14a4('0x37')]['length']?_0x16a8af['attributes']:_0x40e797[_0x14a4('0x2f')];if(_0x3dbd60[_0x14a4('0x32')][_0x14a4('0x47')]){_0x16a8af[_0x14a4('0x42')]=[{'all':!![]}];}_0x16a8af=_[_0x14a4('0x40')]({},_0x16a8af,_0x3dbd60[_0x14a4('0x48')]);return db[_0x14a4('0x2a')]['find'](_0x16a8af)['then'](handleEntityNotFound(_0x2d19e5,null))['then'](respondWithResult(_0x2d19e5,null))[_0x14a4('0x45')](handleError(_0x2d19e5,null));};exports[_0x14a4('0x49')]=function(_0x12ecb2,_0x1ca630){return db[_0x14a4('0x2a')][_0x14a4('0x49')](_0x12ecb2[_0x14a4('0x4a')],{})['then'](respondWithResult(_0x1ca630,0xc9))[_0x14a4('0x45')](handleError(_0x1ca630,null));};exports['update']=function(_0x8862c5,_0x2ae083){if(_0x8862c5[_0x14a4('0x4a')]['id']){delete _0x8862c5['body']['id'];}return db[_0x14a4('0x2a')]['find']({'where':{'id':_0x8862c5['params']['id']}})[_0x14a4('0x26')](handleEntityNotFound(_0x2ae083,null))[_0x14a4('0x26')](saveUpdates(_0x8862c5[_0x14a4('0x4a')],null))[_0x14a4('0x26')](respondWithResult(_0x2ae083,null))['catch'](handleError(_0x2ae083,null));};exports[_0x14a4('0x25')]=function(_0x5d89b0,_0x1f1cff){return db['SquareMessage'][_0x14a4('0x4b')]({'where':{'id':_0x5d89b0[_0x14a4('0x4c')]['id']}})[_0x14a4('0x26')](handleEntityNotFound(_0x1f1cff,null))[_0x14a4('0x26')](removeEntity(_0x1f1cff,null))[_0x14a4('0x45')](handleError(_0x1f1cff,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 353a442..cfc97c3 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 _0x323f=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareMessage.attributes','exports','define','SquareMessage','square_messages','lodash','../../config/logger','api'];(function(_0x421263,_0x18187d){var _0x34e4b5=function(_0x4e7978){while(--_0x4e7978){_0x421263['push'](_0x421263['shift']());}};_0x34e4b5(++_0x18187d);}(_0x323f,0x185));var _0xf323=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x323f[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0xf323('0x0'));var util=require('util');var logger=require(_0xf323('0x1'))(_0xf323('0x2'));var moment=require(_0xf323('0x3'));var BPromise=require(_0xf323('0x4'));var rp=require(_0xf323('0x5'));var fs=require('fs');var path=require(_0xf323('0x6'));var rimraf=require(_0xf323('0x7'));var config=require(_0xf323('0x8'));var attributes=require(_0xf323('0x9'));module[_0xf323('0xa')]=function(_0x3e86dd,_0x317fc6){return _0x3e86dd[_0xf323('0xb')](_0xf323('0xc'),attributes,{'tableName':_0xf323('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc636=['request-promise','path','rimraf','../../config/environment','./squareMessage.attributes','exports','SquareMessage','square_messages','lodash','../../config/logger','moment','bluebird'];(function(_0x2047ed,_0x529716){var _0x2bfa3f=function(_0x1fdc62){while(--_0x1fdc62){_0x2047ed['push'](_0x2047ed['shift']());}};_0x2bfa3f(++_0x529716);}(_0xc636,0xc8));var _0x6c63=function(_0x3c8843,_0xeb83f5){_0x3c8843=_0x3c8843-0x0;var _0x1db153=_0xc636[_0x3c8843];return _0x1db153;};'use strict';var _=require(_0x6c63('0x0'));var util=require('util');var logger=require(_0x6c63('0x1'))('api');var moment=require(_0x6c63('0x2'));var BPromise=require(_0x6c63('0x3'));var rp=require(_0x6c63('0x4'));var fs=require('fs');var path=require(_0x6c63('0x5'));var rimraf=require(_0x6c63('0x6'));var config=require(_0x6c63('0x7'));var attributes=require(_0x6c63('0x8'));module[_0x6c63('0x9')]=function(_0x2f77e0,_0x456936){return _0x2f77e0['define'](_0x6c63('0xa'),attributes,{'tableName':_0x6c63('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index b2a4733..49362e8 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 _0x273c=['options','raw','catch','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','CreateSquareMessage','SquareMessage','create'];(function(_0x1b4919,_0x52cbc2){var _0x28d386=function(_0x1a7e92){while(--_0x1a7e92){_0x1b4919['push'](_0x1b4919['shift']());}};_0x28d386(++_0x52cbc2);}(_0x273c,0x13b));var _0xc273=function(_0x22aa61,_0x45e107){_0x22aa61=_0x22aa61-0x0;var _0x51500a=_0x273c[_0x22aa61];return _0x51500a;};'use strict';var _=require('lodash');var util=require(_0xc273('0x0'));var moment=require(_0xc273('0x1'));var BPromise=require('bluebird');var rs=require(_0xc273('0x2'));var fs=require('fs');var Redis=require(_0xc273('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc273('0x4'));var logger=require(_0xc273('0x5'))(_0xc273('0x6'));var config=require('../../config/environment');var jayson=require(_0xc273('0x7'));var client=jayson[_0xc273('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x433a5e,_0xbfc2fd,_0x1dd9bf){return new BPromise(function(_0x3d4a4f,_0x3dfc83){return client[_0xc273('0x9')](_0x433a5e,_0x1dd9bf)[_0xc273('0xa')](function(_0x177787){logger[_0xc273('0xb')](_0xc273('0xc'),_0xbfc2fd,_0xc273('0xd'));logger[_0xc273('0xe')](_0xc273('0xf'),_0xbfc2fd,_0xc273('0xd'),JSON[_0xc273('0x10')](_0x177787));if(_0x177787['error']){if(_0x177787[_0xc273('0x11')]['code']===0x1f4){logger[_0xc273('0x11')]('SquareMessage,\x20%s,\x20%s',_0xbfc2fd,_0x177787[_0xc273('0x11')]['message']);return _0x3dfc83(_0x177787['error'][_0xc273('0x12')]);}logger[_0xc273('0x11')](_0xc273('0xc'),_0xbfc2fd,_0x177787['error']['message']);return _0x3d4a4f(_0x177787[_0xc273('0x11')][_0xc273('0x12')]);}else{logger[_0xc273('0xb')]('SquareMessage,\x20%s,\x20%s',_0xbfc2fd,'request\x20sent');_0x3d4a4f(_0x177787[_0xc273('0x13')][_0xc273('0x12')]);}})['catch'](function(_0x3cb764){logger['error'](_0xc273('0xc'),_0xbfc2fd,_0x3cb764);_0x3dfc83(_0x3cb764);});});}exports[_0xc273('0x14')]=function(_0x5c7d14){var _0x5240e4=this;return new Promise(function(_0xaeb42e,_0x26a328){return db[_0xc273('0x15')][_0xc273('0x16')](_0x5c7d14['body'],{'raw':_0x5c7d14[_0xc273('0x17')]?_0x5c7d14[_0xc273('0x17')][_0xc273('0x18')]===undefined?!![]:![]:!![]})[_0xc273('0xa')](function(_0x443428){logger[_0xc273('0xb')](_0xc273('0x14'),_0x5c7d14);logger[_0xc273('0xe')]('CreateSquareMessage',_0x5c7d14,JSON[_0xc273('0x10')](_0x443428));_0xaeb42e(_0x443428);})[_0xc273('0x19')](function(_0x15dca6){logger[_0xc273('0x11')](_0xc273('0x14'),_0x15dca6[_0xc273('0x12')],_0x5c7d14);_0x26a328(_0x5240e4[_0xc273('0x11')](0x1f4,_0x15dca6[_0xc273('0x12')]));});});}; \ No newline at end of file +var _0x2aff=['code','SquareMessage,\x20%s,\x20%s','message','result','catch','CreateSquareMessage','SquareMessage','create','body','options','raw','debug','stringify','util','moment','bluebird','ioredis','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','SquareMessage,\x20%s,\x20%s,\x20%s','error'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0x2aff,0x11b));var _0xf2af=function(_0x5f48a8,_0x33200e){_0x5f48a8=_0x5f48a8-0x0;var _0x108757=_0x2aff[_0x5f48a8];return _0x108757;};'use strict';var _=require('lodash');var util=require(_0xf2af('0x0'));var moment=require(_0xf2af('0x1'));var BPromise=require(_0xf2af('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf2af('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf2af('0x4'))('rpc');var config=require(_0xf2af('0x5'));var jayson=require(_0xf2af('0x6'));var client=jayson[_0xf2af('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x23a37f,_0x2e7867,_0x4dc661){return new BPromise(function(_0x3058a7,_0x53486e){return client[_0xf2af('0x8')](_0x23a37f,_0x4dc661)[_0xf2af('0x9')](function(_0x41122c){logger[_0xf2af('0xa')]('SquareMessage,\x20%s,\x20%s',_0x2e7867,_0xf2af('0xb'));logger['debug'](_0xf2af('0xc'),_0x2e7867,_0xf2af('0xb'),JSON['stringify'](_0x41122c));if(_0x41122c[_0xf2af('0xd')]){if(_0x41122c['error'][_0xf2af('0xe')]===0x1f4){logger[_0xf2af('0xd')](_0xf2af('0xf'),_0x2e7867,_0x41122c['error']['message']);return _0x53486e(_0x41122c['error']['message']);}logger['error'](_0xf2af('0xf'),_0x2e7867,_0x41122c[_0xf2af('0xd')][_0xf2af('0x10')]);return _0x3058a7(_0x41122c[_0xf2af('0xd')]['message']);}else{logger[_0xf2af('0xa')](_0xf2af('0xf'),_0x2e7867,_0xf2af('0xb'));_0x3058a7(_0x41122c[_0xf2af('0x11')][_0xf2af('0x10')]);}})[_0xf2af('0x12')](function(_0x627128){logger[_0xf2af('0xd')]('SquareMessage,\x20%s,\x20%s',_0x2e7867,_0x627128);_0x53486e(_0x627128);});});}exports[_0xf2af('0x13')]=function(_0x33aa1e){var _0x47907c=this;return new Promise(function(_0x3dd25c,_0x150896){return db[_0xf2af('0x14')][_0xf2af('0x15')](_0x33aa1e[_0xf2af('0x16')],{'raw':_0x33aa1e['options']?_0x33aa1e[_0xf2af('0x17')][_0xf2af('0x18')]===undefined?!![]:![]:!![]})[_0xf2af('0x9')](function(_0x1b5e7d){logger[_0xf2af('0xa')](_0xf2af('0x13'),_0x33aa1e);logger[_0xf2af('0x19')](_0xf2af('0x13'),_0x33aa1e,JSON[_0xf2af('0x1a')](_0x1b5e7d));_0x3dd25c(_0x1b5e7d);})[_0xf2af('0x12')](function(_0x3b9510){logger['error']('CreateSquareMessage',_0x3b9510[_0xf2af('0x10')],_0x33aa1e);_0x150896(_0x47907c[_0xf2af('0xd')](0x1f4,_0x3b9510[_0xf2af('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index a50615c..ba11015 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 _0x8c93=['../../components/interaction/service','../../config/environment','./squareOdbc.controller','isAuthenticated','index','get','/:id','show','/:id/test','15s','test','create','put','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x117fc2,_0x171a6e){var _0x291915=function(_0x35d2fe){while(--_0x35d2fe){_0x117fc2['push'](_0x117fc2['shift']());}};_0x291915(++_0x171a6e);}(_0x8c93,0x13b));var _0x38c9=function(_0x4f4973,_0x14c6ee){_0x4f4973=_0x4f4973-0x0;var _0xe0505d=_0x8c93[_0x4f4973];return _0xe0505d;};'use strict';var multer=require(_0x38c9('0x0'));var util=require(_0x38c9('0x1'));var path=require('path');var timeout=require(_0x38c9('0x2'));var express=require(_0x38c9('0x3'));var router=express[_0x38c9('0x4')]();var fs_extra=require(_0x38c9('0x5'));var auth=require(_0x38c9('0x6'));var interaction=require(_0x38c9('0x7'));var config=require(_0x38c9('0x8'));var controller=require(_0x38c9('0x9'));router['get']('/',auth[_0x38c9('0xa')](),controller[_0x38c9('0xb')]);router[_0x38c9('0xc')](_0x38c9('0xd'),auth[_0x38c9('0xa')](),controller[_0x38c9('0xe')]);router[_0x38c9('0xc')](_0x38c9('0xf'),auth[_0x38c9('0xa')](),timeout(_0x38c9('0x10')),controller[_0x38c9('0x11')]);router['post']('/',auth[_0x38c9('0xa')](),controller[_0x38c9('0x12')]);router[_0x38c9('0x13')](_0x38c9('0xd'),auth[_0x38c9('0xa')](),controller[_0x38c9('0x14')]);router['delete'](_0x38c9('0xd'),auth[_0x38c9('0xa')](),controller[_0x38c9('0x15')]);module[_0x38c9('0x16')]=router; \ No newline at end of file +var _0xf8a1=['../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','index','/:id','show','/:id/test','15s','test','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x126f47,_0x2199e9){var _0x49508a=function(_0x20ba36){while(--_0x20ba36){_0x126f47['push'](_0x126f47['shift']());}};_0x49508a(++_0x2199e9);}(_0xf8a1,0x1f4));var _0x1f8a=function(_0x4cbe98,_0x576f7b){_0x4cbe98=_0x4cbe98-0x0;var _0x49c755=_0xf8a1[_0x4cbe98];return _0x49c755;};'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['Router']();var fs_extra=require(_0x1f8a('0x5'));var auth=require(_0x1f8a('0x6'));var interaction=require(_0x1f8a('0x7'));var config=require(_0x1f8a('0x8'));var controller=require(_0x1f8a('0x9'));router[_0x1f8a('0xa')]('/',auth[_0x1f8a('0xb')](),controller[_0x1f8a('0xc')]);router[_0x1f8a('0xa')](_0x1f8a('0xd'),auth['isAuthenticated'](),controller[_0x1f8a('0xe')]);router[_0x1f8a('0xa')](_0x1f8a('0xf'),auth[_0x1f8a('0xb')](),timeout(_0x1f8a('0x10')),controller[_0x1f8a('0x11')]);router['post']('/',auth[_0x1f8a('0xb')](),controller['create']);router[_0x1f8a('0x12')]('/:id',auth[_0x1f8a('0xb')](),controller[_0x1f8a('0x13')]);router[_0x1f8a('0x14')](_0x1f8a('0xd'),auth[_0x1f8a('0xb')](),controller[_0x1f8a('0x15')]);module[_0x1f8a('0x16')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 31e30d8..259eab4 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 _0xc703=['sequelize','exports','STRING','name'];(function(_0x32b542,_0x4512fa){var _0x554d54=function(_0x35cdfc){while(--_0x35cdfc){_0x32b542['push'](_0x32b542['shift']());}};_0x554d54(++_0x4512fa);}(_0xc703,0x188));var _0x3c70=function(_0x4bbe00,_0x1d2f14){_0x4bbe00=_0x4bbe00-0x0;var _0x3999d2=_0xc703[_0x4bbe00];return _0x3999d2;};'use strict';var Sequelize=require(_0x3c70('0x0'));module[_0x3c70('0x1')]={'name':{'type':Sequelize[_0x3c70('0x2')],'unique':_0x3c70('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0x3c70('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9c2e=['exports','STRING','sequelize'];(function(_0x338af1,_0x5e02a8){var _0x1bedd2=function(_0x3cc678){while(--_0x3cc678){_0x338af1['push'](_0x338af1['shift']());}};_0x1bedd2(++_0x5e02a8);}(_0x9c2e,0x1be));var _0xe9c2=function(_0x2fa3c8,_0x8db6be){_0x2fa3c8=_0x2fa3c8-0x0;var _0x59a222=_0x9c2e[_0x2fa3c8];return _0x59a222;};'use strict';var Sequelize=require(_0xe9c2('0x0'));module[_0xe9c2('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize[_0xe9c2('0x2')]},'description':{'type':Sequelize[_0xe9c2('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 12cfa32..d042343 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 _0x1bd4=['VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','SquareOdbc','find','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ODBC','UserProfileSection','userProfileId','create','update','body','test','dsn','odbc','closeSync','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','destroy','then','get','UserProfileResource','error','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','nolimit','sort','filters','pick','filter','where'];(function(_0x23991f,_0x3cf4ee){var _0x536c7b=function(_0x1b9249){while(--_0x1b9249){_0x23991f['push'](_0x23991f['shift']());}};_0x536c7b(++_0x3cf4ee);}(_0x1bd4,0x117));var _0x41bd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1bd4[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x41bd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x41bd('0x1'));var jsonpatch=require(_0x41bd('0x2'));var rp=require(_0x41bd('0x3'));var moment=require(_0x41bd('0x4'));var BPromise=require(_0x41bd('0x5'));var Mustache=require(_0x41bd('0x6'));var util=require(_0x41bd('0x7'));var path=require(_0x41bd('0x8'));var sox=require('sox');var csv=require(_0x41bd('0x9'));var ejs=require(_0x41bd('0xa'));var fs=require('fs');var fs_extra=require(_0x41bd('0xb'));var _=require(_0x41bd('0xc'));var squel=require(_0x41bd('0xd'));var crypto=require(_0x41bd('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x41bd('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x41bd('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x41bd('0x10'));var as=require(_0x41bd('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x41bd('0x12'))(_0x41bd('0x13'));var utils=require(_0x41bd('0x14'));var config=require(_0x41bd('0x15'));var licenseUtil=require(_0x41bd('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x186c41,_0x512f44){_0x512f44=_0x512f44||0xcc;return function(_0x591396){if(_0x591396){return _0x186c41[_0x41bd('0x17')](_0x512f44);}return _0x186c41[_0x41bd('0x18')](_0x512f44)[_0x41bd('0x19')]();};}function respondWithResult(_0x30b9d2,_0x46e12b){_0x46e12b=_0x46e12b||0xc8;return function(_0x1e1740){if(_0x1e1740){return _0x30b9d2[_0x41bd('0x18')](_0x46e12b)[_0x41bd('0x1a')](_0x1e1740);}};}function respondWithFilteredResult(_0x11c5b6,_0x272c87){return function(_0x3798cc){if(_0x3798cc){var _0x331ed9=typeof _0x272c87[_0x41bd('0x1b')]===_0x41bd('0x1c')&&typeof _0x272c87[_0x41bd('0x1d')]===_0x41bd('0x1c');var _0x4ed4e3=_0x3798cc['count'];var _0x59e5fe=_0x331ed9?0x0:_0x272c87[_0x41bd('0x1b')];var _0x19666a=_0x331ed9?_0x3798cc[_0x41bd('0x1e')]:_0x272c87['offset']+_0x272c87[_0x41bd('0x1d')];var _0x273302;if(_0x19666a>=_0x4ed4e3){_0x19666a=_0x4ed4e3;_0x273302=0xc8;}else{_0x273302=0xce;}_0x11c5b6[_0x41bd('0x18')](_0x273302);return _0x11c5b6[_0x41bd('0x1f')]('Content-Range',_0x59e5fe+'-'+_0x19666a+'/'+_0x4ed4e3)[_0x41bd('0x1a')](_0x3798cc);}return null;};}function patchUpdates(_0x28d3cb){return function(_0x2f12b3){try{jsonpatch[_0x41bd('0x20')](_0x2f12b3,_0x28d3cb,!![]);}catch(_0x2847a0){return BPromise[_0x41bd('0x21')](_0x2847a0);}return _0x2f12b3[_0x41bd('0x22')]();};}function saveUpdates(_0x33b127,_0x12d2c9){return function(_0x563263){if(_0x563263){return _0x563263['update'](_0x33b127)['then'](function(_0x47effe){return _0x47effe;});}return null;};}function removeEntity(_0x2ae5e9,_0x5783ae){return function(_0x3d20d5){if(_0x3d20d5){return _0x3d20d5[_0x41bd('0x23')]()[_0x41bd('0x24')](function(){var _0x5d78e7=_0x3d20d5[_0x41bd('0x25')]({'plain':!![]});var _0x441a68='ODBC';return db[_0x41bd('0x26')][_0x41bd('0x23')]({'where':{'type':_0x441a68,'resourceId':_0x5d78e7['id']}})[_0x41bd('0x24')](function(){return _0x3d20d5;});})[_0x41bd('0x24')](function(){_0x2ae5e9[_0x41bd('0x18')](0xcc)[_0x41bd('0x19')]();});}};}function handleEntityNotFound(_0x41395b,_0x5b3cc8){return function(_0x3e0734){if(!_0x3e0734){_0x41395b[_0x41bd('0x17')](0x194);}return _0x3e0734;};}function handleError(_0x49078c,_0x8d2f07){_0x8d2f07=_0x8d2f07||0x1f4;return function(_0x1e1545){logger[_0x41bd('0x27')](_0x1e1545['stack']);if(_0x1e1545[_0x41bd('0x28')]){delete _0x1e1545[_0x41bd('0x28')];}_0x49078c[_0x41bd('0x18')](_0x8d2f07)[_0x41bd('0x29')](_0x1e1545);};}exports[_0x41bd('0x2a')]=function(_0x161f1b,_0x4f1dda){var _0x22986b={},_0x3bde64={},_0x42799f={'count':0x0,'rows':[]};var _0x213a9c=_['map'](db['SquareOdbc'][_0x41bd('0x2b')],function(_0x5b5f18){return{'name':_0x5b5f18[_0x41bd('0x2c')],'type':_0x5b5f18[_0x41bd('0x2d')][_0x41bd('0x2e')]};});_0x3bde64[_0x41bd('0x2f')]=_[_0x41bd('0x30')](_0x213a9c,_0x41bd('0x28'));_0x3bde64[_0x41bd('0x31')]=_[_0x41bd('0x32')](_0x161f1b[_0x41bd('0x31')]);_0x3bde64['filters']=_[_0x41bd('0x33')](_0x3bde64[_0x41bd('0x2f')],_0x3bde64[_0x41bd('0x31')]);_0x22986b[_0x41bd('0x34')]=_[_0x41bd('0x33')](_0x3bde64[_0x41bd('0x2f')],qs[_0x41bd('0x35')](_0x161f1b[_0x41bd('0x31')][_0x41bd('0x35')]));_0x22986b[_0x41bd('0x34')]=_0x22986b[_0x41bd('0x34')][_0x41bd('0x36')]?_0x22986b[_0x41bd('0x34')]:_0x3bde64[_0x41bd('0x2f')];if(!_0x161f1b[_0x41bd('0x31')]['hasOwnProperty'](_0x41bd('0x37'))){_0x22986b[_0x41bd('0x1d')]=qs['limit'](_0x161f1b[_0x41bd('0x31')]['limit']);_0x22986b[_0x41bd('0x1b')]=qs[_0x41bd('0x1b')](_0x161f1b[_0x41bd('0x31')][_0x41bd('0x1b')]);}_0x22986b['order']=qs[_0x41bd('0x38')](_0x161f1b[_0x41bd('0x31')][_0x41bd('0x38')]);_0x22986b['where']=qs[_0x41bd('0x39')](_[_0x41bd('0x3a')](_0x161f1b[_0x41bd('0x31')],_0x3bde64['filters']),_0x213a9c);if(_0x161f1b[_0x41bd('0x31')][_0x41bd('0x3b')]){_0x22986b['where']=_['merge'](_0x22986b[_0x41bd('0x3c')],{'$or':_[_0x41bd('0x30')](_0x213a9c,function(_0x3435a5){if(_0x3435a5[_0x41bd('0x2d')]!==_0x41bd('0x3d')){var _0x38c8f4={};_0x38c8f4[_0x3435a5[_0x41bd('0x28')]]={'$like':'%'+_0x161f1b['query'][_0x41bd('0x3b')]+'%'};return _0x38c8f4;}})});}_0x22986b=_[_0x41bd('0x3e')]({},_0x22986b,_0x161f1b[_0x41bd('0x3f')]);var _0x27e8e1={'where':_0x22986b[_0x41bd('0x3c')]};return db['SquareOdbc']['count'](_0x27e8e1)[_0x41bd('0x24')](function(_0x1fb398){_0x42799f['count']=_0x1fb398;if(_0x161f1b[_0x41bd('0x31')][_0x41bd('0x40')]){_0x22986b[_0x41bd('0x41')]=[{'all':!![]}];}return db['SquareOdbc'][_0x41bd('0x42')](_0x22986b);})[_0x41bd('0x24')](function(_0x3ffcd3){_0x42799f['rows']=_0x3ffcd3;return _0x42799f;})[_0x41bd('0x24')](respondWithFilteredResult(_0x4f1dda,_0x22986b))[_0x41bd('0x43')](handleError(_0x4f1dda,null));};exports[_0x41bd('0x44')]=function(_0x37f6cb,_0x113955){var _0x5188a5={'raw':!![],'where':{'id':_0x37f6cb[_0x41bd('0x45')]['id']}},_0x18ea1c={};_0x18ea1c[_0x41bd('0x2f')]=_[_0x41bd('0x32')](db['SquareOdbc'][_0x41bd('0x2b')]);_0x18ea1c[_0x41bd('0x31')]=_['keys'](_0x37f6cb[_0x41bd('0x31')]);_0x18ea1c['filters']=_[_0x41bd('0x33')](_0x18ea1c[_0x41bd('0x2f')],_0x18ea1c[_0x41bd('0x31')]);_0x5188a5[_0x41bd('0x34')]=_[_0x41bd('0x33')](_0x18ea1c[_0x41bd('0x2f')],qs[_0x41bd('0x35')](_0x37f6cb[_0x41bd('0x31')][_0x41bd('0x35')]));_0x5188a5[_0x41bd('0x34')]=_0x5188a5[_0x41bd('0x34')]['length']?_0x5188a5[_0x41bd('0x34')]:_0x18ea1c[_0x41bd('0x2f')];if(_0x37f6cb[_0x41bd('0x31')][_0x41bd('0x40')]){_0x5188a5['include']=[{'all':!![]}];}_0x5188a5=_[_0x41bd('0x3e')]({},_0x5188a5,_0x37f6cb[_0x41bd('0x3f')]);return db[_0x41bd('0x46')][_0x41bd('0x47')](_0x5188a5)[_0x41bd('0x24')](handleEntityNotFound(_0x113955,null))[_0x41bd('0x24')](respondWithResult(_0x113955,null))['catch'](handleError(_0x113955,null));};exports['create']=function(_0x5a750e,_0x123a11){return db[_0x41bd('0x46')]['create'](_0x5a750e['body'],{})['then'](function(_0x5103e8){var _0x518843=_0x5a750e[_0x41bd('0x48')][_0x41bd('0x25')]({'plain':!![]});if(!_0x518843)throw new Error(_0x41bd('0x49'));if(_0x518843[_0x41bd('0x4a')]===_0x41bd('0x48')){var _0x481da6=_0x5103e8['get']({'plain':!![]});var _0x1fe6dd=_0x41bd('0x4b');return db[_0x41bd('0x4c')]['find']({'where':{'name':_0x1fe6dd,'userProfileId':_0x518843[_0x41bd('0x4d')]},'raw':!![]})['then'](function(_0x285226){if(_0x285226&&_0x285226['autoAssociation']===0x0){return db['UserProfileResource'][_0x41bd('0x4e')]({'name':_0x481da6[_0x41bd('0x28')],'resourceId':_0x481da6['id'],'type':_0x285226[_0x41bd('0x28')],'sectionId':_0x285226['id']},{})['then'](function(){return _0x5103e8;});}else{return _0x5103e8;}})[_0x41bd('0x43')](function(_0x115ca7){logger[_0x41bd('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x115ca7);throw _0x115ca7;});}return _0x5103e8;})[_0x41bd('0x24')](respondWithResult(_0x123a11,0xc9))[_0x41bd('0x43')](handleError(_0x123a11,null));};exports[_0x41bd('0x4f')]=function(_0x33bcd2,_0xf04b0f){if(_0x33bcd2[_0x41bd('0x50')]['id']){delete _0x33bcd2['body']['id'];}return db[_0x41bd('0x46')][_0x41bd('0x47')]({'where':{'id':_0x33bcd2[_0x41bd('0x45')]['id']}})[_0x41bd('0x24')](handleEntityNotFound(_0xf04b0f,null))[_0x41bd('0x24')](saveUpdates(_0x33bcd2[_0x41bd('0x50')],null))['then'](respondWithResult(_0xf04b0f,null))[_0x41bd('0x43')](handleError(_0xf04b0f,null));};exports[_0x41bd('0x23')]=function(_0x5d00ce,_0x186039){return db['SquareOdbc'][_0x41bd('0x47')]({'where':{'id':_0x5d00ce[_0x41bd('0x45')]['id']}})['then'](handleEntityNotFound(_0x186039,null))[_0x41bd('0x24')](removeEntity(_0x186039,null))[_0x41bd('0x43')](handleError(_0x186039,null));};exports[_0x41bd('0x51')]=function(_0x1afa98,_0x5c5863,_0x12a2ab){var _0x3892ce;return db[_0x41bd('0x46')][_0x41bd('0x47')]({'where':{'id':_0x1afa98[_0x41bd('0x45')]['id']},'attributes':['id',_0x41bd('0x52')]})[_0x41bd('0x24')](handleEntityNotFound(_0x5c5863,null))[_0x41bd('0x24')](function(_0x573ae1){if(_0x573ae1){var _0x55b92e=require(_0x41bd('0x53'))();_0x55b92e['openSync'](_0x573ae1['dsn']);_0x55b92e[_0x41bd('0x54')]();return _0x573ae1;}})[_0x41bd('0x24')](respondWithResult(_0x5c5863,null))[_0x41bd('0x43')](handleError(_0x5c5863,null));}; \ No newline at end of file +var _0x5eae=['openSync','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','end','status','offset','undefined','count','limit','set','Content-Range','json','apply','update','then','destroy','ODBC','UserProfileResource','error','stack','name','send','SquareOdbc','rawAttributes','type','key','model','map','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','filter','options','includeAll','catch','show','params','length','include','find','create','body','get','user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x5eae,0x1db));var _0xe5ea=function(_0x50cb90,_0x4e3e0b){_0x50cb90=_0x50cb90-0x0;var _0x425797=_0x5eae[_0x50cb90];return _0x425797;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe5ea('0x0'));var zipdir=require(_0xe5ea('0x1'));var jsonpatch=require(_0xe5ea('0x2'));var rp=require(_0xe5ea('0x3'));var moment=require(_0xe5ea('0x4'));var BPromise=require(_0xe5ea('0x5'));var Mustache=require('mustache');var util=require(_0xe5ea('0x6'));var path=require('path');var sox=require(_0xe5ea('0x7'));var csv=require(_0xe5ea('0x8'));var ejs=require(_0xe5ea('0x9'));var fs=require('fs');var fs_extra=require(_0xe5ea('0xa'));var _=require(_0xe5ea('0xb'));var squel=require(_0xe5ea('0xc'));var crypto=require(_0xe5ea('0xd'));var jsforce=require(_0xe5ea('0xe'));var deskjs=require(_0xe5ea('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xe5ea('0x10'));var Redis=require(_0xe5ea('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xe5ea('0x12'));var as=require(_0xe5ea('0x13'));var hardwareService=require(_0xe5ea('0x14'));var logger=require(_0xe5ea('0x15'))('api');var utils=require(_0xe5ea('0x16'));var config=require(_0xe5ea('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x45252a,_0x2f067b){_0x2f067b=_0x2f067b||0xcc;return function(_0x41a0ce){if(_0x41a0ce){return _0x45252a[_0xe5ea('0x18')](_0x2f067b);}return _0x45252a['status'](_0x2f067b)[_0xe5ea('0x19')]();};}function respondWithResult(_0x5d6576,_0x394e51){_0x394e51=_0x394e51||0xc8;return function(_0x59e0bd){if(_0x59e0bd){return _0x5d6576[_0xe5ea('0x1a')](_0x394e51)['json'](_0x59e0bd);}};}function respondWithFilteredResult(_0x1b0b02,_0x118448){return function(_0x5bccce){if(_0x5bccce){var _0x2c2bfd=typeof _0x118448[_0xe5ea('0x1b')]===_0xe5ea('0x1c')&&typeof _0x118448['limit']==='undefined';var _0x2498fa=_0x5bccce[_0xe5ea('0x1d')];var _0x22304d=_0x2c2bfd?0x0:_0x118448[_0xe5ea('0x1b')];var _0x8586d9=_0x2c2bfd?_0x5bccce['count']:_0x118448['offset']+_0x118448[_0xe5ea('0x1e')];var _0x422e8c;if(_0x8586d9>=_0x2498fa){_0x8586d9=_0x2498fa;_0x422e8c=0xc8;}else{_0x422e8c=0xce;}_0x1b0b02[_0xe5ea('0x1a')](_0x422e8c);return _0x1b0b02[_0xe5ea('0x1f')](_0xe5ea('0x20'),_0x22304d+'-'+_0x8586d9+'/'+_0x2498fa)[_0xe5ea('0x21')](_0x5bccce);}return null;};}function patchUpdates(_0x3f6115){return function(_0x51dd1e){try{jsonpatch[_0xe5ea('0x22')](_0x51dd1e,_0x3f6115,!![]);}catch(_0x3ae197){return BPromise['reject'](_0x3ae197);}return _0x51dd1e['save']();};}function saveUpdates(_0x465ca9,_0x169530){return function(_0x3186f8){if(_0x3186f8){return _0x3186f8[_0xe5ea('0x23')](_0x465ca9)[_0xe5ea('0x24')](function(_0x55acc4){return _0x55acc4;});}return null;};}function removeEntity(_0x2c9940,_0x256e98){return function(_0x23fb2a){if(_0x23fb2a){return _0x23fb2a[_0xe5ea('0x25')]()[_0xe5ea('0x24')](function(){var _0xb51e28=_0x23fb2a['get']({'plain':!![]});var _0x276905=_0xe5ea('0x26');return db[_0xe5ea('0x27')]['destroy']({'where':{'type':_0x276905,'resourceId':_0xb51e28['id']}})[_0xe5ea('0x24')](function(){return _0x23fb2a;});})['then'](function(){_0x2c9940[_0xe5ea('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xbb3b30,_0x20df6b){return function(_0xe9f616){if(!_0xe9f616){_0xbb3b30[_0xe5ea('0x18')](0x194);}return _0xe9f616;};}function handleError(_0x3ad1a5,_0x4f4ab9){_0x4f4ab9=_0x4f4ab9||0x1f4;return function(_0x2765cb){logger[_0xe5ea('0x28')](_0x2765cb[_0xe5ea('0x29')]);if(_0x2765cb[_0xe5ea('0x2a')]){delete _0x2765cb['name'];}_0x3ad1a5[_0xe5ea('0x1a')](_0x4f4ab9)[_0xe5ea('0x2b')](_0x2765cb);};}exports['index']=function(_0x2a7420,_0x1a4e06){var _0x5f3ea2={},_0x1fdf64={},_0x3192e9={'count':0x0,'rows':[]};var _0x1e7cbe=_['map'](db[_0xe5ea('0x2c')][_0xe5ea('0x2d')],function(_0x2225ae){return{'name':_0x2225ae['fieldName'],'type':_0x2225ae[_0xe5ea('0x2e')][_0xe5ea('0x2f')]};});_0x1fdf64[_0xe5ea('0x30')]=_[_0xe5ea('0x31')](_0x1e7cbe,_0xe5ea('0x2a'));_0x1fdf64[_0xe5ea('0x32')]=_[_0xe5ea('0x33')](_0x2a7420[_0xe5ea('0x32')]);_0x1fdf64['filters']=_[_0xe5ea('0x34')](_0x1fdf64[_0xe5ea('0x30')],_0x1fdf64['query']);_0x5f3ea2[_0xe5ea('0x35')]=_['intersection'](_0x1fdf64[_0xe5ea('0x30')],qs['fields'](_0x2a7420['query'][_0xe5ea('0x36')]));_0x5f3ea2['attributes']=_0x5f3ea2[_0xe5ea('0x35')]['length']?_0x5f3ea2[_0xe5ea('0x35')]:_0x1fdf64[_0xe5ea('0x30')];if(!_0x2a7420[_0xe5ea('0x32')][_0xe5ea('0x37')](_0xe5ea('0x38'))){_0x5f3ea2[_0xe5ea('0x1e')]=qs[_0xe5ea('0x1e')](_0x2a7420[_0xe5ea('0x32')][_0xe5ea('0x1e')]);_0x5f3ea2[_0xe5ea('0x1b')]=qs[_0xe5ea('0x1b')](_0x2a7420['query']['offset']);}_0x5f3ea2[_0xe5ea('0x39')]=qs['sort'](_0x2a7420[_0xe5ea('0x32')][_0xe5ea('0x3a')]);_0x5f3ea2['where']=qs[_0xe5ea('0x3b')](_[_0xe5ea('0x3c')](_0x2a7420[_0xe5ea('0x32')],_0x1fdf64[_0xe5ea('0x3b')]),_0x1e7cbe);if(_0x2a7420[_0xe5ea('0x32')]['filter']){_0x5f3ea2[_0xe5ea('0x3d')]=_[_0xe5ea('0x3e')](_0x5f3ea2[_0xe5ea('0x3d')],{'$or':_[_0xe5ea('0x31')](_0x1e7cbe,function(_0x382d33){if(_0x382d33[_0xe5ea('0x2e')]!=='VIRTUAL'){var _0x36194e={};_0x36194e[_0x382d33[_0xe5ea('0x2a')]]={'$like':'%'+_0x2a7420[_0xe5ea('0x32')][_0xe5ea('0x3f')]+'%'};return _0x36194e;}})});}_0x5f3ea2=_[_0xe5ea('0x3e')]({},_0x5f3ea2,_0x2a7420[_0xe5ea('0x40')]);var _0x36fac8={'where':_0x5f3ea2[_0xe5ea('0x3d')]};return db[_0xe5ea('0x2c')][_0xe5ea('0x1d')](_0x36fac8)[_0xe5ea('0x24')](function(_0x4197bb){_0x3192e9[_0xe5ea('0x1d')]=_0x4197bb;if(_0x2a7420[_0xe5ea('0x32')][_0xe5ea('0x41')]){_0x5f3ea2['include']=[{'all':!![]}];}return db['SquareOdbc']['findAll'](_0x5f3ea2);})['then'](function(_0x16de72){_0x3192e9['rows']=_0x16de72;return _0x3192e9;})[_0xe5ea('0x24')](respondWithFilteredResult(_0x1a4e06,_0x5f3ea2))[_0xe5ea('0x42')](handleError(_0x1a4e06,null));};exports[_0xe5ea('0x43')]=function(_0x57e975,_0xff7656){var _0x2004a6={'raw':!![],'where':{'id':_0x57e975[_0xe5ea('0x44')]['id']}},_0x4c43a1={};_0x4c43a1[_0xe5ea('0x30')]=_[_0xe5ea('0x33')](db[_0xe5ea('0x2c')][_0xe5ea('0x2d')]);_0x4c43a1[_0xe5ea('0x32')]=_['keys'](_0x57e975[_0xe5ea('0x32')]);_0x4c43a1[_0xe5ea('0x3b')]=_[_0xe5ea('0x34')](_0x4c43a1['model'],_0x4c43a1['query']);_0x2004a6[_0xe5ea('0x35')]=_[_0xe5ea('0x34')](_0x4c43a1[_0xe5ea('0x30')],qs['fields'](_0x57e975[_0xe5ea('0x32')][_0xe5ea('0x36')]));_0x2004a6[_0xe5ea('0x35')]=_0x2004a6[_0xe5ea('0x35')][_0xe5ea('0x45')]?_0x2004a6[_0xe5ea('0x35')]:_0x4c43a1['model'];if(_0x57e975['query'][_0xe5ea('0x41')]){_0x2004a6[_0xe5ea('0x46')]=[{'all':!![]}];}_0x2004a6=_[_0xe5ea('0x3e')]({},_0x2004a6,_0x57e975[_0xe5ea('0x40')]);return db['SquareOdbc'][_0xe5ea('0x47')](_0x2004a6)[_0xe5ea('0x24')](handleEntityNotFound(_0xff7656,null))[_0xe5ea('0x24')](respondWithResult(_0xff7656,null))[_0xe5ea('0x42')](handleError(_0xff7656,null));};exports[_0xe5ea('0x48')]=function(_0x996c5a,_0x41b92d){return db[_0xe5ea('0x2c')][_0xe5ea('0x48')](_0x996c5a[_0xe5ea('0x49')],{})['then'](function(_0x469b93){var _0xabfa33=_0x996c5a['user'][_0xe5ea('0x4a')]({'plain':!![]});if(!_0xabfa33)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xabfa33['role']===_0xe5ea('0x4b')){var _0x472e06=_0x469b93[_0xe5ea('0x4a')]({'plain':!![]});var _0x28994c=_0xe5ea('0x26');return db['UserProfileSection']['find']({'where':{'name':_0x28994c,'userProfileId':_0xabfa33['userProfileId']},'raw':!![]})[_0xe5ea('0x24')](function(_0x25b224){if(_0x25b224&&_0x25b224[_0xe5ea('0x4c')]===0x0){return db['UserProfileResource'][_0xe5ea('0x48')]({'name':_0x472e06[_0xe5ea('0x2a')],'resourceId':_0x472e06['id'],'type':_0x25b224[_0xe5ea('0x2a')],'sectionId':_0x25b224['id']},{})[_0xe5ea('0x24')](function(){return _0x469b93;});}else{return _0x469b93;}})[_0xe5ea('0x42')](function(_0x7f426){logger[_0xe5ea('0x28')](_0xe5ea('0x4d'),_0x7f426);throw _0x7f426;});}return _0x469b93;})['then'](respondWithResult(_0x41b92d,0xc9))[_0xe5ea('0x42')](handleError(_0x41b92d,null));};exports['update']=function(_0x3c8d9e,_0x27b329){if(_0x3c8d9e[_0xe5ea('0x49')]['id']){delete _0x3c8d9e['body']['id'];}return db[_0xe5ea('0x2c')]['find']({'where':{'id':_0x3c8d9e[_0xe5ea('0x44')]['id']}})[_0xe5ea('0x24')](handleEntityNotFound(_0x27b329,null))['then'](saveUpdates(_0x3c8d9e['body'],null))[_0xe5ea('0x24')](respondWithResult(_0x27b329,null))[_0xe5ea('0x42')](handleError(_0x27b329,null));};exports[_0xe5ea('0x25')]=function(_0x33e50b,_0x2e16a2){return db[_0xe5ea('0x2c')][_0xe5ea('0x47')]({'where':{'id':_0x33e50b[_0xe5ea('0x44')]['id']}})[_0xe5ea('0x24')](handleEntityNotFound(_0x2e16a2,null))[_0xe5ea('0x24')](removeEntity(_0x2e16a2,null))[_0xe5ea('0x42')](handleError(_0x2e16a2,null));};exports['test']=function(_0x2284e7,_0x56c703,_0x36e317){var _0x2861d5;return db[_0xe5ea('0x2c')][_0xe5ea('0x47')]({'where':{'id':_0x2284e7[_0xe5ea('0x44')]['id']},'attributes':['id','dsn']})['then'](handleEntityNotFound(_0x56c703,null))[_0xe5ea('0x24')](function(_0x56b1ec){if(_0x56b1ec){var _0x77408b=require('odbc')();_0x77408b[_0xe5ea('0x4e')](_0x56b1ec['dsn']);_0x77408b['closeSync']();return _0x56b1ec;}})[_0xe5ea('0x24')](respondWithResult(_0x56c703,null))[_0xe5ea('0x42')](handleError(_0x56c703,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index a011f78..0ec4a46 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 _0x6cd6=['square_odbc','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./squareOdbc.attributes','exports','define','SquareOdbc'];(function(_0x318eb7,_0x27a32f){var _0x49162a=function(_0xdf582f){while(--_0xdf582f){_0x318eb7['push'](_0x318eb7['shift']());}};_0x49162a(++_0x27a32f);}(_0x6cd6,0xb7));var _0x66cd=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x6cd6[_0x4e676e];return _0x336a3c;};'use strict';var _=require(_0x66cd('0x0'));var util=require(_0x66cd('0x1'));var logger=require(_0x66cd('0x2'))(_0x66cd('0x3'));var moment=require(_0x66cd('0x4'));var BPromise=require(_0x66cd('0x5'));var rp=require(_0x66cd('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x66cd('0x7'));var config=require(_0x66cd('0x8'));var attributes=require(_0x66cd('0x9'));module[_0x66cd('0xa')]=function(_0x40c512,_0x22584d){return _0x40c512[_0x66cd('0xb')](_0x66cd('0xc'),attributes,{'tableName':_0x66cd('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x897c=['square_odbc','../../config/logger','api','moment','bluebird','request-promise','rimraf','./squareOdbc.attributes','exports','define'];(function(_0x1318f7,_0x3ebc05){var _0x4f9d43=function(_0x3243c8){while(--_0x3243c8){_0x1318f7['push'](_0x1318f7['shift']());}};_0x4f9d43(++_0x3ebc05);}(_0x897c,0xa1));var _0xc897=function(_0x420d1d,_0x54e1be){_0x420d1d=_0x420d1d-0x0;var _0x494ec7=_0x897c[_0x420d1d];return _0x494ec7;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc897('0x0'))(_0xc897('0x1'));var moment=require(_0xc897('0x2'));var BPromise=require(_0xc897('0x3'));var rp=require(_0xc897('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc897('0x5'));var config=require('../../config/environment');var attributes=require(_0xc897('0x6'));module[_0xc897('0x7')]=function(_0x51fee2,_0x5b203f){return _0x51fee2[_0xc897('0x8')]('SquareOdbc',attributes,{'tableName':_0xc897('0x9'),'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 07ab71d..24ccc45 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 _0x1dc7=['rpc','client','http','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','error','message','result','catch','ShowSquareOdbc','SquareOdbc','find','options','raw','include','map','model','attributes','then','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger'];(function(_0x26e727,_0x3e65be){var _0x563800=function(_0xbcf999){while(--_0xbcf999){_0x26e727['push'](_0x26e727['shift']());}};_0x563800(++_0x3e65be);}(_0x1dc7,0x1bb));var _0x71dc=function(_0x1c6cfb,_0x5e8a13){_0x1c6cfb=_0x1c6cfb-0x0;var _0x1a0027=_0x1dc7[_0x1c6cfb];return _0x1a0027;};'use strict';var _=require(_0x71dc('0x0'));var util=require(_0x71dc('0x1'));var moment=require(_0x71dc('0x2'));var BPromise=require(_0x71dc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x71dc('0x4'));var db=require(_0x71dc('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x71dc('0x6'))(_0x71dc('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x71dc('0x8')][_0x71dc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1e9c08,_0xf44a66,_0x1bc1d8){return new BPromise(function(_0x44ead0,_0x3bd320){return client['request'](_0x1e9c08,_0x1bc1d8)['then'](function(_0x243000){logger[_0x71dc('0xa')](_0x71dc('0xb'),_0xf44a66,_0x71dc('0xc'));logger[_0x71dc('0xd')](_0x71dc('0xe'),_0xf44a66,'request\x20sent',JSON['stringify'](_0x243000));if(_0x243000['error']){if(_0x243000[_0x71dc('0xf')]['code']===0x1f4){logger[_0x71dc('0xf')]('SquareOdbc,\x20%s,\x20%s',_0xf44a66,_0x243000['error'][_0x71dc('0x10')]);return _0x3bd320(_0x243000[_0x71dc('0xf')][_0x71dc('0x10')]);}logger['error']('SquareOdbc,\x20%s,\x20%s',_0xf44a66,_0x243000[_0x71dc('0xf')][_0x71dc('0x10')]);return _0x44ead0(_0x243000['error'][_0x71dc('0x10')]);}else{logger[_0x71dc('0xa')]('SquareOdbc,\x20%s,\x20%s',_0xf44a66,_0x71dc('0xc'));_0x44ead0(_0x243000[_0x71dc('0x11')]['message']);}})[_0x71dc('0x12')](function(_0x476007){logger['error'](_0x71dc('0xb'),_0xf44a66,_0x476007);_0x3bd320(_0x476007);});});}exports[_0x71dc('0x13')]=function(_0x5875ae){var _0x212ac6=this;return new Promise(function(_0x246884,_0x2be4c7){return db[_0x71dc('0x14')][_0x71dc('0x15')]({'raw':_0x5875ae[_0x71dc('0x16')]?_0x5875ae[_0x71dc('0x16')][_0x71dc('0x17')]===undefined?!![]:![]:!![],'where':_0x5875ae[_0x71dc('0x16')]?_0x5875ae[_0x71dc('0x16')]['where']||null:null,'attributes':_0x5875ae[_0x71dc('0x16')]?_0x5875ae[_0x71dc('0x16')]['attributes']||null:null,'include':_0x5875ae[_0x71dc('0x16')]?_0x5875ae[_0x71dc('0x16')][_0x71dc('0x18')]?_[_0x71dc('0x19')](_0x5875ae['options'][_0x71dc('0x18')],function(_0x2926b3){return{'model':db[_0x2926b3[_0x71dc('0x1a')]],'as':_0x2926b3['as'],'attributes':_0x2926b3[_0x71dc('0x1b')],'include':_0x2926b3['include']?_['map'](_0x2926b3['include'],function(_0x47ff87){return{'model':db[_0x47ff87[_0x71dc('0x1a')]],'as':_0x47ff87['as'],'attributes':_0x47ff87[_0x71dc('0x1b')],'include':_0x47ff87[_0x71dc('0x18')]?_['map'](_0x47ff87['include'],function(_0x2ee642){return{'model':db[_0x2ee642[_0x71dc('0x1a')]],'as':_0x2ee642['as'],'attributes':_0x2ee642[_0x71dc('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x71dc('0x1c')](function(_0x22436d){logger[_0x71dc('0xa')](_0x71dc('0x13'),_0x5875ae);logger[_0x71dc('0xd')](_0x71dc('0x13'),_0x5875ae,JSON[_0x71dc('0x1d')](_0x22436d));_0x246884(_0x22436d);})[_0x71dc('0x12')](function(_0x4333c5){logger[_0x71dc('0xf')](_0x71dc('0x13'),_0x4333c5[_0x71dc('0x10')],_0x5875ae);_0x2be4c7(_0x212ac6['error'](0x1f4,_0x4333c5[_0x71dc('0x10')]));});});}; \ No newline at end of file +var _0xcb00=['request','SquareOdbc,\x20%s,\x20%s','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','message','info','request\x20sent','catch','ShowSquareOdbc','SquareOdbc','find','options','raw','where','include','model','attributes','map','then','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment'];(function(_0xa8883,_0x1f107f){var _0x479426=function(_0x4e56b9){while(--_0x4e56b9){_0xa8883['push'](_0xa8883['shift']());}};_0x479426(++_0x1f107f);}(_0xcb00,0x18e));var _0x0cb0=function(_0x54eab6,_0x5e262f){_0x54eab6=_0x54eab6-0x0;var _0x1e7435=_0xcb00[_0x54eab6];return _0x1e7435;};'use strict';var _=require(_0x0cb0('0x0'));var util=require(_0x0cb0('0x1'));var moment=require('moment');var BPromise=require(_0x0cb0('0x2'));var rs=require(_0x0cb0('0x3'));var fs=require('fs');var Redis=require(_0x0cb0('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0cb0('0x5'));var logger=require('../../config/logger')(_0x0cb0('0x6'));var config=require(_0x0cb0('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3a762f,_0xa4976c,_0x3f5b06){return new BPromise(function(_0x1bbd4d,_0x8df2fb){return client[_0x0cb0('0x8')](_0x3a762f,_0x3f5b06)['then'](function(_0x3fd17b){logger['info'](_0x0cb0('0x9'),_0xa4976c,'request\x20sent');logger[_0x0cb0('0xa')](_0x0cb0('0xb'),_0xa4976c,'request\x20sent',JSON[_0x0cb0('0xc')](_0x3fd17b));if(_0x3fd17b[_0x0cb0('0xd')]){if(_0x3fd17b[_0x0cb0('0xd')]['code']===0x1f4){logger[_0x0cb0('0xd')]('SquareOdbc,\x20%s,\x20%s',_0xa4976c,_0x3fd17b[_0x0cb0('0xd')][_0x0cb0('0xe')]);return _0x8df2fb(_0x3fd17b[_0x0cb0('0xd')][_0x0cb0('0xe')]);}logger[_0x0cb0('0xd')]('SquareOdbc,\x20%s,\x20%s',_0xa4976c,_0x3fd17b['error'][_0x0cb0('0xe')]);return _0x1bbd4d(_0x3fd17b[_0x0cb0('0xd')][_0x0cb0('0xe')]);}else{logger[_0x0cb0('0xf')](_0x0cb0('0x9'),_0xa4976c,_0x0cb0('0x10'));_0x1bbd4d(_0x3fd17b['result'][_0x0cb0('0xe')]);}})[_0x0cb0('0x11')](function(_0x2d8efe){logger[_0x0cb0('0xd')](_0x0cb0('0x9'),_0xa4976c,_0x2d8efe);_0x8df2fb(_0x2d8efe);});});}exports[_0x0cb0('0x12')]=function(_0x55396a){var _0x1c22c0=this;return new Promise(function(_0x5e4729,_0x15580b){return db[_0x0cb0('0x13')][_0x0cb0('0x14')]({'raw':_0x55396a[_0x0cb0('0x15')]?_0x55396a[_0x0cb0('0x15')][_0x0cb0('0x16')]===undefined?!![]:![]:!![],'where':_0x55396a[_0x0cb0('0x15')]?_0x55396a[_0x0cb0('0x15')][_0x0cb0('0x17')]||null:null,'attributes':_0x55396a[_0x0cb0('0x15')]?_0x55396a[_0x0cb0('0x15')]['attributes']||null:null,'include':_0x55396a[_0x0cb0('0x15')]?_0x55396a[_0x0cb0('0x15')][_0x0cb0('0x18')]?_['map'](_0x55396a[_0x0cb0('0x15')][_0x0cb0('0x18')],function(_0x28ed55){return{'model':db[_0x28ed55[_0x0cb0('0x19')]],'as':_0x28ed55['as'],'attributes':_0x28ed55[_0x0cb0('0x1a')],'include':_0x28ed55[_0x0cb0('0x18')]?_[_0x0cb0('0x1b')](_0x28ed55[_0x0cb0('0x18')],function(_0xeceb05){return{'model':db[_0xeceb05[_0x0cb0('0x19')]],'as':_0xeceb05['as'],'attributes':_0xeceb05['attributes'],'include':_0xeceb05[_0x0cb0('0x18')]?_[_0x0cb0('0x1b')](_0xeceb05[_0x0cb0('0x18')],function(_0xd20cb8){return{'model':db[_0xd20cb8[_0x0cb0('0x19')]],'as':_0xd20cb8['as'],'attributes':_0xd20cb8[_0x0cb0('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x0cb0('0x1c')](function(_0x54ac2a){logger[_0x0cb0('0xf')](_0x0cb0('0x12'),_0x55396a);logger['debug'](_0x0cb0('0x12'),_0x55396a,JSON['stringify'](_0x54ac2a));_0x5e4729(_0x54ac2a);})[_0x0cb0('0x11')](function(_0x3bb9bc){logger[_0x0cb0('0xd')](_0x0cb0('0x12'),_0x3bb9bc[_0x0cb0('0xe')],_0x55396a);_0x15580b(_0x1c22c0[_0x0cb0('0xd')](0x1f4,_0x3bb9bc['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 2d56fe5..1eafe47 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 _0x33bb=['express','fs-extra','../../components/auth/service','../../config/environment','./squareProject.controller','get','index','/:id','isAuthenticated','create','put','update','delete','destroy','exports','multer','util','connect-timeout'];(function(_0x1a1b31,_0x2e76c9){var _0x10a48d=function(_0x75fffc){while(--_0x75fffc){_0x1a1b31['push'](_0x1a1b31['shift']());}};_0x10a48d(++_0x2e76c9);}(_0x33bb,0x141));var _0xb33b=function(_0x54a3f2,_0x441ff5){_0x54a3f2=_0x54a3f2-0x0;var _0x146fe7=_0x33bb[_0x54a3f2];return _0x146fe7;};'use strict';var multer=require(_0xb33b('0x0'));var util=require(_0xb33b('0x1'));var path=require('path');var timeout=require(_0xb33b('0x2'));var express=require(_0xb33b('0x3'));var router=express['Router']();var fs_extra=require(_0xb33b('0x4'));var auth=require(_0xb33b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb33b('0x6'));var controller=require(_0xb33b('0x7'));router[_0xb33b('0x8')]('/',auth['isAuthenticated'](),controller[_0xb33b('0x9')]);router[_0xb33b('0x8')](_0xb33b('0xa'),auth[_0xb33b('0xb')](),controller['show']);router['post']('/',auth[_0xb33b('0xb')](),controller[_0xb33b('0xc')]);router[_0xb33b('0xd')](_0xb33b('0xa'),auth['isAuthenticated'](),controller[_0xb33b('0xe')]);router[_0xb33b('0xf')](_0xb33b('0xa'),auth[_0xb33b('0xb')](),controller[_0xb33b('0x10')]);module[_0xb33b('0x11')]=router; \ No newline at end of file +var _0xcbcb=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','create','put','update','delete','destroy','exports','util','connect-timeout','Router'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xcbcb,0x10d));var _0xbcbc=function(_0x3317c5,_0x387c8a){_0x3317c5=_0x3317c5-0x0;var _0x6624d3=_0xcbcb[_0x3317c5];return _0x6624d3;};'use strict';var multer=require('multer');var util=require(_0xbcbc('0x0'));var path=require('path');var timeout=require(_0xbcbc('0x1'));var express=require('express');var router=express[_0xbcbc('0x2')]();var fs_extra=require(_0xbcbc('0x3'));var auth=require(_0xbcbc('0x4'));var interaction=require(_0xbcbc('0x5'));var config=require(_0xbcbc('0x6'));var controller=require('./squareProject.controller');router[_0xbcbc('0x7')]('/',auth[_0xbcbc('0x8')](),controller[_0xbcbc('0x9')]);router[_0xbcbc('0x7')](_0xbcbc('0xa'),auth[_0xbcbc('0x8')](),controller['show']);router['post']('/',auth[_0xbcbc('0x8')](),controller[_0xbcbc('0xb')]);router[_0xbcbc('0xc')]('/:id',auth[_0xbcbc('0x8')](),controller[_0xbcbc('0xd')]);router[_0xbcbc('0xe')](_0xbcbc('0xa'),auth[_0xbcbc('0x8')](),controller[_0xbcbc('0xf')]);module[_0xbcbc('0x10')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index dbc0b1a..8947cf7 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 _0x1698=['production','DATE','name','STRING','long','getDataValue','toString','utf8','BLOB'];(function(_0x2d54b4,_0x394a59){var _0x5514c1=function(_0x5e0a48){while(--_0x5e0a48){_0x2d54b4['push'](_0x2d54b4['shift']());}};_0x5514c1(++_0x394a59);}(_0x1698,0x1c4));var _0x8169=function(_0x2cc569,_0x4e9568){_0x2cc569=_0x2cc569-0x0;var _0x1bfc2e=_0x1698[_0x2cc569];return _0x1bfc2e;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x8169('0x0'),'allowNull':![]},'description':{'type':Sequelize[_0x8169('0x1')]},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize['BLOB'](_0x8169('0x2')),'get':function(){if(this[_0x8169('0x3')]('preproduction')){return this[_0x8169('0x3')]('preproduction')[_0x8169('0x4')](_0x8169('0x5'));}}},'production':{'type':Sequelize[_0x8169('0x6')](_0x8169('0x2')),'get':function(){if(this[_0x8169('0x3')](_0x8169('0x7'))){return this[_0x8169('0x3')]('production')[_0x8169('0x4')]('utf8');}}},'savedAt':{'type':Sequelize[_0x8169('0x8')]},'publishedAt':{'type':Sequelize[_0x8169('0x8')]}}; \ No newline at end of file +var _0x2b1b=['exports','STRING','TEXT','BLOB','preproduction','getDataValue','long','production','toString','utf8','DATE','sequelize'];(function(_0x2e68a9,_0x1c6dd8){var _0x199e5b=function(_0x2046f2){while(--_0x2046f2){_0x2e68a9['push'](_0x2e68a9['shift']());}};_0x199e5b(++_0x1c6dd8);}(_0x2b1b,0x11f));var _0xb2b1=function(_0x271eca,_0x1ddf17){_0x271eca=_0x271eca-0x0;var _0x4fbed9=_0x2b1b[_0x271eca];return _0x4fbed9;};'use strict';var Sequelize=require(_0xb2b1('0x0'));module[_0xb2b1('0x1')]={'name':{'type':Sequelize[_0xb2b1('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xb2b1('0x2')]},'notes':{'type':Sequelize[_0xb2b1('0x3')]},'preproduction':{'type':Sequelize[_0xb2b1('0x4')]('long'),'get':function(){if(this['getDataValue'](_0xb2b1('0x5'))){return this[_0xb2b1('0x6')](_0xb2b1('0x5'))['toString']('utf8');}}},'production':{'type':Sequelize[_0xb2b1('0x4')](_0xb2b1('0x7')),'get':function(){if(this[_0xb2b1('0x6')]('production')){return this['getDataValue'](_0xb2b1('0x8'))[_0xb2b1('0x9')](_0xb2b1('0xa'));}}},'savedAt':{'type':Sequelize[_0xb2b1('0xb')]},'publishedAt':{'type':Sequelize[_0xb2b1('0xb')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 84fef09..fb8f273 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 _0xdaec=['update','lodash','ioredis','../../components/parsers/qs','../../config/logger','../../mysqldb','redis','defaults','register','status','undefined','count','offset','limit','set','then','SquareProjects','UserProfileResource','destroy','agi','stringify','end','sendStatus','stack','name','index','map','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','filter','merge','options','include','SquareProject','findAll','show','params','length','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x3628f4,_0x93661e){var _0x23758c=function(_0x31efa7){while(--_0x31efa7){_0x3628f4['push'](_0x3628f4['shift']());}};_0x23758c(++_0x93661e);}(_0xdaec,0x123));var _0xcdae=function(_0x59f5a2,_0x1a15eb){_0x59f5a2=_0x59f5a2-0x0;var _0x1038a8=_0xdaec[_0x59f5a2];return _0x1038a8;};'use strict';var _=require(_0xcdae('0x0'));var Redis=require(_0xcdae('0x1'));var qs=require(_0xcdae('0x2'));var logger=require(_0xcdae('0x3'))('api');var config=require('../../config/environment');var db=require(_0xcdae('0x4'))['db'];config[_0xcdae('0x5')]=_[_0xcdae('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcdae('0x5')]));require('./squareProject.socket')[_0xcdae('0x7')](socket);function respondWithResult(_0x202409,_0x4f80f0){_0x4f80f0=_0x4f80f0||0xc8;return function(_0x5add4a){if(_0x5add4a){return _0x202409[_0xcdae('0x8')](_0x4f80f0)['json'](_0x5add4a);}};}function respondWithFilteredResult(_0x1ebaa5,_0x584597){return function(_0x5d1ed9){if(_0x5d1ed9){var _0x5d211e=typeof _0x584597['offset']===_0xcdae('0x9')&&typeof _0x584597['limit']===_0xcdae('0x9');var _0x127f71=_0x5d1ed9[_0xcdae('0xa')];var _0x5b9578=_0x5d211e?0x0:_0x584597[_0xcdae('0xb')];var _0xf9200a=_0x5d211e?_0x5d1ed9[_0xcdae('0xa')]:_0x584597[_0xcdae('0xb')]+_0x584597[_0xcdae('0xc')];var _0x4e251c;if(_0xf9200a>=_0x127f71){_0xf9200a=_0x127f71;_0x4e251c=0xc8;}else{_0x4e251c=0xce;}_0x1ebaa5[_0xcdae('0x8')](_0x4e251c);return _0x1ebaa5[_0xcdae('0xd')]('Content-Range',_0x5b9578+'-'+_0xf9200a+'/'+_0x127f71)['json'](_0x5d1ed9);}return null;};}function saveUpdates(_0x3eaa14){return function(_0x2967b7){if(_0x2967b7){return _0x2967b7['update'](_0x3eaa14)[_0xcdae('0xe')](function(_0x37d495){return _0x37d495;});}return null;};}function removeEntity(_0x15e7f2){return function(_0x54a6f0){if(_0x54a6f0){return _0x54a6f0['destroy']()['then'](function(){var _0x16210a=_0x54a6f0['get']({'plain':!![]});var _0x26bff1=_0xcdae('0xf');return db[_0xcdae('0x10')][_0xcdae('0x11')]({'where':{'type':_0x26bff1,'resourceId':_0x16210a['id']}})[_0xcdae('0xe')](function(){return _0x54a6f0;});})[_0xcdae('0xe')](function(){var _0x5a4d7c=new Redis(config['redis']);_0x5a4d7c['publish'](_0xcdae('0x12'),JSON[_0xcdae('0x13')]({'id':_0x54a6f0['id'],'deleted':!![]}));})[_0xcdae('0xe')](function(){_0x15e7f2['status'](0xcc)[_0xcdae('0x14')]();});}};}function handleEntityNotFound(_0x4a21e6){return function(_0x599ff5){if(!_0x599ff5){_0x4a21e6[_0xcdae('0x15')](0x194);}return _0x599ff5;};}function handleError(_0x2198eb,_0x1d3575){_0x1d3575=_0x1d3575||0x1f4;return function(_0x98e1cd){logger['error'](_0x98e1cd[_0xcdae('0x16')]);if(_0x98e1cd[_0xcdae('0x17')]){delete _0x98e1cd[_0xcdae('0x17')];}_0x2198eb[_0xcdae('0x8')](_0x1d3575)['send'](_0x98e1cd);};}exports[_0xcdae('0x18')]=function(_0x1bbe05,_0x51ba35){var _0x11dcba={},_0x3cc789={},_0x1847ad={'count':0x0,'rows':[]};var _0x7d4701=_[_0xcdae('0x19')](db['SquareProject'][_0xcdae('0x1a')],function(_0x1208fa){return{'name':_0x1208fa['fieldName'],'type':_0x1208fa['type'][_0xcdae('0x1b')]};});_0x3cc789[_0xcdae('0x1c')]=_[_0xcdae('0x19')](_0x7d4701,_0xcdae('0x17'));_0x3cc789[_0xcdae('0x1d')]=_[_0xcdae('0x1e')](_0x1bbe05[_0xcdae('0x1d')]);_0x3cc789[_0xcdae('0x1f')]=_[_0xcdae('0x20')](_0x3cc789[_0xcdae('0x1c')],_0x3cc789['query']);_0x11dcba['attributes']=_[_0xcdae('0x20')](_0x3cc789[_0xcdae('0x1c')],qs[_0xcdae('0x21')](_0x1bbe05[_0xcdae('0x1d')][_0xcdae('0x21')]));_0x11dcba[_0xcdae('0x22')]=_0x11dcba[_0xcdae('0x22')]['length']?_0x11dcba['attributes']:_0x3cc789['model'];if(!_0x1bbe05[_0xcdae('0x1d')][_0xcdae('0x23')](_0xcdae('0x24'))){_0x11dcba[_0xcdae('0xc')]=qs['limit'](_0x1bbe05[_0xcdae('0x1d')][_0xcdae('0xc')]);_0x11dcba[_0xcdae('0xb')]=qs[_0xcdae('0xb')](_0x1bbe05[_0xcdae('0x1d')][_0xcdae('0xb')]);}_0x11dcba['order']=qs['sort'](_0x1bbe05[_0xcdae('0x1d')][_0xcdae('0x25')]);_0x11dcba[_0xcdae('0x26')]=qs['filters'](_['pick'](_0x1bbe05[_0xcdae('0x1d')],_0x3cc789[_0xcdae('0x1f')]),_0x7d4701);if(_0x1bbe05[_0xcdae('0x1d')][_0xcdae('0x27')]){_0x11dcba[_0xcdae('0x26')]=_[_0xcdae('0x28')](_0x11dcba['where'],{'$or':_[_0xcdae('0x19')](_0x7d4701,function(_0x45871e){if(_0x45871e['type']!=='VIRTUAL'){var _0x1fc886={};_0x1fc886[_0x45871e[_0xcdae('0x17')]]={'$like':'%'+_0x1bbe05['query']['filter']+'%'};return _0x1fc886;}})});}_0x11dcba=_['merge']({},_0x11dcba,_0x1bbe05[_0xcdae('0x29')]);var _0x432e62={'where':_0x11dcba[_0xcdae('0x26')]};return db['SquareProject'][_0xcdae('0xa')](_0x432e62)[_0xcdae('0xe')](function(_0x25335e){_0x1847ad[_0xcdae('0xa')]=_0x25335e;if(_0x1bbe05['query']['includeAll']){_0x11dcba[_0xcdae('0x2a')]=[{'all':!![]}];}return db[_0xcdae('0x2b')][_0xcdae('0x2c')](_0x11dcba);})[_0xcdae('0xe')](function(_0x594917){_0x1847ad['rows']=_0x594917;return _0x1847ad;})[_0xcdae('0xe')](respondWithFilteredResult(_0x51ba35,_0x11dcba))['catch'](handleError(_0x51ba35,null));};exports[_0xcdae('0x2d')]=function(_0x274372,_0x55b1d3){var _0x31f11a={'raw':![],'where':{'id':_0x274372[_0xcdae('0x2e')]['id']}},_0x573f9f={};_0x573f9f['model']=_[_0xcdae('0x1e')](db[_0xcdae('0x2b')][_0xcdae('0x1a')]);_0x573f9f[_0xcdae('0x1d')]=_[_0xcdae('0x1e')](_0x274372[_0xcdae('0x1d')]);_0x573f9f[_0xcdae('0x1f')]=_['intersection'](_0x573f9f[_0xcdae('0x1c')],_0x573f9f[_0xcdae('0x1d')]);_0x31f11a[_0xcdae('0x22')]=_[_0xcdae('0x20')](_0x573f9f[_0xcdae('0x1c')],qs[_0xcdae('0x21')](_0x274372[_0xcdae('0x1d')][_0xcdae('0x21')]));_0x31f11a[_0xcdae('0x22')]=_0x31f11a[_0xcdae('0x22')][_0xcdae('0x2f')]?_0x31f11a[_0xcdae('0x22')]:_0x573f9f[_0xcdae('0x1c')];if(_0x274372[_0xcdae('0x1d')]['includeAll']){_0x31f11a[_0xcdae('0x2a')]=[{'all':!![]}];}_0x31f11a=_[_0xcdae('0x28')]({},_0x31f11a,_0x274372[_0xcdae('0x29')]);return db['SquareProject']['find'](_0x31f11a)['then'](handleEntityNotFound(_0x55b1d3,null))['then'](respondWithResult(_0x55b1d3,null))[_0xcdae('0x30')](handleError(_0x55b1d3,null));};exports[_0xcdae('0x31')]=function(_0x4e70ad,_0x5292ca){return db[_0xcdae('0x2b')][_0xcdae('0x31')](_0x4e70ad[_0xcdae('0x32')],{})[_0xcdae('0xe')](function(_0x76dd1f){var _0x19b77e=_0x4e70ad[_0xcdae('0x33')][_0xcdae('0x34')]({'plain':!![]});if(!_0x19b77e)throw new Error(_0xcdae('0x35'));if(_0x19b77e['role']===_0xcdae('0x33')){var _0x26c7c7=_0x76dd1f[_0xcdae('0x34')]({'plain':!![]});var _0x4b57be='SquareProjects';return db['UserProfileSection'][_0xcdae('0x36')]({'where':{'name':_0x4b57be,'userProfileId':_0x19b77e['userProfileId']},'raw':!![]})[_0xcdae('0xe')](function(_0x57c1dc){if(_0x57c1dc&&_0x57c1dc[_0xcdae('0x37')]===0x0){return db[_0xcdae('0x10')][_0xcdae('0x31')]({'name':_0x26c7c7['name'],'resourceId':_0x26c7c7['id'],'type':_0x57c1dc['name'],'sectionId':_0x57c1dc['id']},{})[_0xcdae('0xe')](function(){return _0x76dd1f;});}else{return _0x76dd1f;}})[_0xcdae('0x30')](function(_0x1cd3dc){logger['error'](_0xcdae('0x38'),_0x1cd3dc);throw _0x1cd3dc;});}return _0x76dd1f;})[_0xcdae('0xe')](respondWithResult(_0x5292ca,0xc9))[_0xcdae('0x30')](handleError(_0x5292ca,null));};exports[_0xcdae('0x39')]=function(_0x283903,_0x17e427){if(_0x283903['body']['id']){delete _0x283903[_0xcdae('0x32')]['id'];}return db[_0xcdae('0x2b')][_0xcdae('0x36')]({'where':{'id':_0x283903[_0xcdae('0x2e')]['id']}})['then'](handleEntityNotFound(_0x17e427,null))[_0xcdae('0xe')](saveUpdates(_0x283903[_0xcdae('0x32')],null))[_0xcdae('0xe')](function(_0x3d84fb){if(!_0x3d84fb)return;var _0x5b04f8=_0x3d84fb[_0xcdae('0x34')]({'plain':!![]});return _0x5b04f8;})[_0xcdae('0xe')](function(_0x4755a3){var _0x591ae1=new Redis(config[_0xcdae('0x5')]);_0x591ae1['publish'](_0xcdae('0x12'),JSON[_0xcdae('0x13')](_['pick'](_0x4755a3,['id',_0xcdae('0x17'),'production'])));return _0x4755a3;})[_0xcdae('0xe')](respondWithResult(_0x17e427,null))['catch'](handleError(_0x17e427,null));};exports['destroy']=function(_0x19cff7,_0x49f7fe){return db['SquareProject']['find']({'where':{'id':_0x19cff7['params']['id']}})[_0xcdae('0xe')](handleEntityNotFound(_0x49f7fe,null))[_0xcdae('0xe')](removeEntity(_0x49f7fe,null))[_0xcdae('0x30')](handleError(_0x49f7fe,null));}; \ No newline at end of file +var _0x7cd5=['../../components/parsers/qs','../../config/environment','redis','localhost','socket.io-emitter','./squareProject.socket','register','status','json','undefined','limit','count','offset','set','Content-Range','update','then','destroy','get','SquareProjects','UserProfileResource','publish','agi','stringify','end','error','stack','name','send','map','SquareProject','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','show','params','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','pick','production','lodash','ioredis'];(function(_0x5c38ae,_0x1f165a){var _0x51a6e2=function(_0x37ccd3){while(--_0x37ccd3){_0x5c38ae['push'](_0x5c38ae['shift']());}};_0x51a6e2(++_0x1f165a);}(_0x7cd5,0xd0));var _0x57cd=function(_0x3287a6,_0x889189){_0x3287a6=_0x3287a6-0x0;var _0xd533d=_0x7cd5[_0x3287a6];return _0xd533d;};'use strict';var _=require(_0x57cd('0x0'));var Redis=require(_0x57cd('0x1'));var qs=require(_0x57cd('0x2'));var logger=require('../../config/logger')('api');var config=require(_0x57cd('0x3'));var db=require('../../mysqldb')['db'];config[_0x57cd('0x4')]=_['defaults'](config[_0x57cd('0x4')],{'host':_0x57cd('0x5'),'port':0x18eb});var socket=require(_0x57cd('0x6'))(new Redis(config['redis']));require(_0x57cd('0x7'))[_0x57cd('0x8')](socket);function respondWithResult(_0x5474a2,_0x4baa37){_0x4baa37=_0x4baa37||0xc8;return function(_0x1a11ba){if(_0x1a11ba){return _0x5474a2[_0x57cd('0x9')](_0x4baa37)[_0x57cd('0xa')](_0x1a11ba);}};}function respondWithFilteredResult(_0x8d62d7,_0x4e4940){return function(_0x6f0cc4){if(_0x6f0cc4){var _0x4c5957=typeof _0x4e4940['offset']===_0x57cd('0xb')&&typeof _0x4e4940[_0x57cd('0xc')]==='undefined';var _0x3675d1=_0x6f0cc4[_0x57cd('0xd')];var _0x3f17dd=_0x4c5957?0x0:_0x4e4940[_0x57cd('0xe')];var _0x145233=_0x4c5957?_0x6f0cc4[_0x57cd('0xd')]:_0x4e4940[_0x57cd('0xe')]+_0x4e4940[_0x57cd('0xc')];var _0x28f94d;if(_0x145233>=_0x3675d1){_0x145233=_0x3675d1;_0x28f94d=0xc8;}else{_0x28f94d=0xce;}_0x8d62d7['status'](_0x28f94d);return _0x8d62d7[_0x57cd('0xf')](_0x57cd('0x10'),_0x3f17dd+'-'+_0x145233+'/'+_0x3675d1)[_0x57cd('0xa')](_0x6f0cc4);}return null;};}function saveUpdates(_0x49b124){return function(_0x12fe81){if(_0x12fe81){return _0x12fe81[_0x57cd('0x11')](_0x49b124)[_0x57cd('0x12')](function(_0x251d50){return _0x251d50;});}return null;};}function removeEntity(_0x19466c){return function(_0x2f29ff){if(_0x2f29ff){return _0x2f29ff[_0x57cd('0x13')]()[_0x57cd('0x12')](function(){var _0x32f574=_0x2f29ff[_0x57cd('0x14')]({'plain':!![]});var _0xd270ce=_0x57cd('0x15');return db[_0x57cd('0x16')][_0x57cd('0x13')]({'where':{'type':_0xd270ce,'resourceId':_0x32f574['id']}})[_0x57cd('0x12')](function(){return _0x2f29ff;});})[_0x57cd('0x12')](function(){var _0x55682b=new Redis(config[_0x57cd('0x4')]);_0x55682b[_0x57cd('0x17')](_0x57cd('0x18'),JSON[_0x57cd('0x19')]({'id':_0x2f29ff['id'],'deleted':!![]}));})[_0x57cd('0x12')](function(){_0x19466c[_0x57cd('0x9')](0xcc)[_0x57cd('0x1a')]();});}};}function handleEntityNotFound(_0x261995){return function(_0x8cbb0b){if(!_0x8cbb0b){_0x261995['sendStatus'](0x194);}return _0x8cbb0b;};}function handleError(_0x52c3be,_0x5d1f9f){_0x5d1f9f=_0x5d1f9f||0x1f4;return function(_0x557d0a){logger[_0x57cd('0x1b')](_0x557d0a[_0x57cd('0x1c')]);if(_0x557d0a[_0x57cd('0x1d')]){delete _0x557d0a[_0x57cd('0x1d')];}_0x52c3be[_0x57cd('0x9')](_0x5d1f9f)[_0x57cd('0x1e')](_0x557d0a);};}exports['index']=function(_0x59fc0b,_0x52aea3){var _0x45237f={},_0x183d70={},_0x35407b={'count':0x0,'rows':[]};var _0x5bea60=_[_0x57cd('0x1f')](db[_0x57cd('0x20')][_0x57cd('0x21')],function(_0x5aa059){return{'name':_0x5aa059[_0x57cd('0x22')],'type':_0x5aa059[_0x57cd('0x23')]['key']};});_0x183d70[_0x57cd('0x24')]=_[_0x57cd('0x1f')](_0x5bea60,_0x57cd('0x1d'));_0x183d70[_0x57cd('0x25')]=_[_0x57cd('0x26')](_0x59fc0b[_0x57cd('0x25')]);_0x183d70[_0x57cd('0x27')]=_['intersection'](_0x183d70['model'],_0x183d70[_0x57cd('0x25')]);_0x45237f['attributes']=_[_0x57cd('0x28')](_0x183d70[_0x57cd('0x24')],qs[_0x57cd('0x29')](_0x59fc0b[_0x57cd('0x25')][_0x57cd('0x29')]));_0x45237f['attributes']=_0x45237f[_0x57cd('0x2a')][_0x57cd('0x2b')]?_0x45237f[_0x57cd('0x2a')]:_0x183d70[_0x57cd('0x24')];if(!_0x59fc0b[_0x57cd('0x25')][_0x57cd('0x2c')](_0x57cd('0x2d'))){_0x45237f[_0x57cd('0xc')]=qs['limit'](_0x59fc0b[_0x57cd('0x25')]['limit']);_0x45237f[_0x57cd('0xe')]=qs['offset'](_0x59fc0b[_0x57cd('0x25')]['offset']);}_0x45237f['order']=qs[_0x57cd('0x2e')](_0x59fc0b[_0x57cd('0x25')][_0x57cd('0x2e')]);_0x45237f[_0x57cd('0x2f')]=qs[_0x57cd('0x27')](_['pick'](_0x59fc0b[_0x57cd('0x25')],_0x183d70[_0x57cd('0x27')]),_0x5bea60);if(_0x59fc0b[_0x57cd('0x25')][_0x57cd('0x30')]){_0x45237f[_0x57cd('0x2f')]=_[_0x57cd('0x31')](_0x45237f['where'],{'$or':_[_0x57cd('0x1f')](_0x5bea60,function(_0x4c010a){if(_0x4c010a[_0x57cd('0x23')]!==_0x57cd('0x32')){var _0x2623af={};_0x2623af[_0x4c010a[_0x57cd('0x1d')]]={'$like':'%'+_0x59fc0b['query'][_0x57cd('0x30')]+'%'};return _0x2623af;}})});}_0x45237f=_['merge']({},_0x45237f,_0x59fc0b['options']);var _0x3e6fa1={'where':_0x45237f['where']};return db[_0x57cd('0x20')]['count'](_0x3e6fa1)[_0x57cd('0x12')](function(_0x2077a3){_0x35407b['count']=_0x2077a3;if(_0x59fc0b[_0x57cd('0x25')][_0x57cd('0x33')]){_0x45237f[_0x57cd('0x34')]=[{'all':!![]}];}return db['SquareProject'][_0x57cd('0x35')](_0x45237f);})[_0x57cd('0x12')](function(_0x2e7451){_0x35407b['rows']=_0x2e7451;return _0x35407b;})[_0x57cd('0x12')](respondWithFilteredResult(_0x52aea3,_0x45237f))['catch'](handleError(_0x52aea3,null));};exports[_0x57cd('0x36')]=function(_0x53fdfb,_0x5ae4c4){var _0x490e71={'raw':![],'where':{'id':_0x53fdfb[_0x57cd('0x37')]['id']}},_0x5e91c5={};_0x5e91c5[_0x57cd('0x24')]=_['keys'](db[_0x57cd('0x20')][_0x57cd('0x21')]);_0x5e91c5[_0x57cd('0x25')]=_[_0x57cd('0x26')](_0x53fdfb[_0x57cd('0x25')]);_0x5e91c5[_0x57cd('0x27')]=_[_0x57cd('0x28')](_0x5e91c5['model'],_0x5e91c5[_0x57cd('0x25')]);_0x490e71['attributes']=_['intersection'](_0x5e91c5[_0x57cd('0x24')],qs[_0x57cd('0x29')](_0x53fdfb['query'][_0x57cd('0x29')]));_0x490e71[_0x57cd('0x2a')]=_0x490e71[_0x57cd('0x2a')]['length']?_0x490e71['attributes']:_0x5e91c5['model'];if(_0x53fdfb['query'][_0x57cd('0x33')]){_0x490e71[_0x57cd('0x34')]=[{'all':!![]}];}_0x490e71=_[_0x57cd('0x31')]({},_0x490e71,_0x53fdfb[_0x57cd('0x38')]);return db['SquareProject'][_0x57cd('0x39')](_0x490e71)['then'](handleEntityNotFound(_0x5ae4c4,null))[_0x57cd('0x12')](respondWithResult(_0x5ae4c4,null))[_0x57cd('0x3a')](handleError(_0x5ae4c4,null));};exports['create']=function(_0x336b4b,_0x361206){return db['SquareProject'][_0x57cd('0x3b')](_0x336b4b[_0x57cd('0x3c')],{})['then'](function(_0x54935e){var _0x5ec701=_0x336b4b[_0x57cd('0x3d')]['get']({'plain':!![]});if(!_0x5ec701)throw new Error(_0x57cd('0x3e'));if(_0x5ec701[_0x57cd('0x3f')]===_0x57cd('0x3d')){var _0x3f0213=_0x54935e[_0x57cd('0x14')]({'plain':!![]});var _0x5465d9='SquareProjects';return db[_0x57cd('0x40')][_0x57cd('0x39')]({'where':{'name':_0x5465d9,'userProfileId':_0x5ec701[_0x57cd('0x41')]},'raw':!![]})['then'](function(_0x10734c){if(_0x10734c&&_0x10734c[_0x57cd('0x42')]===0x0){return db[_0x57cd('0x16')][_0x57cd('0x3b')]({'name':_0x3f0213[_0x57cd('0x1d')],'resourceId':_0x3f0213['id'],'type':_0x10734c[_0x57cd('0x1d')],'sectionId':_0x10734c['id']},{})[_0x57cd('0x12')](function(){return _0x54935e;});}else{return _0x54935e;}})[_0x57cd('0x3a')](function(_0x10687d){logger['error'](_0x57cd('0x43'),_0x10687d);throw _0x10687d;});}return _0x54935e;})[_0x57cd('0x12')](respondWithResult(_0x361206,0xc9))[_0x57cd('0x3a')](handleError(_0x361206,null));};exports[_0x57cd('0x11')]=function(_0x205317,_0x3f84c6){if(_0x205317[_0x57cd('0x3c')]['id']){delete _0x205317['body']['id'];}return db[_0x57cd('0x20')]['find']({'where':{'id':_0x205317[_0x57cd('0x37')]['id']}})[_0x57cd('0x12')](handleEntityNotFound(_0x3f84c6,null))[_0x57cd('0x12')](saveUpdates(_0x205317['body'],null))[_0x57cd('0x12')](function(_0xf2a2bd){if(!_0xf2a2bd)return;var _0x3f5a1c=_0xf2a2bd[_0x57cd('0x14')]({'plain':!![]});return _0x3f5a1c;})[_0x57cd('0x12')](function(_0x19c9d3){var _0x171b48=new Redis(config[_0x57cd('0x4')]);_0x171b48[_0x57cd('0x17')](_0x57cd('0x18'),JSON[_0x57cd('0x19')](_[_0x57cd('0x44')](_0x19c9d3,['id',_0x57cd('0x1d'),_0x57cd('0x45')])));return _0x19c9d3;})[_0x57cd('0x12')](respondWithResult(_0x3f84c6,null))[_0x57cd('0x3a')](handleError(_0x3f84c6,null));};exports[_0x57cd('0x13')]=function(_0x2c975b,_0x7d0dc1){return db['SquareProject']['find']({'where':{'id':_0x2c975b[_0x57cd('0x37')]['id']}})['then'](handleEntityNotFound(_0x7d0dc1,null))[_0x57cd('0x12')](removeEntity(_0x7d0dc1,null))[_0x57cd('0x3a')](handleError(_0x7d0dc1,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index fa38667..b12e372 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 _0xa0c5=['hasOwnProperty','exports','events','../../mysqldb','SquareProject','setMaxListeners','save','update','remove','emit'];(function(_0x249e57,_0x5188b3){var _0x5994f0=function(_0x16216d){while(--_0x16216d){_0x249e57['push'](_0x249e57['shift']());}};_0x5994f0(++_0x5188b3);}(_0xa0c5,0x1d8));var _0x5a0c=function(_0x3b4861,_0x59d989){_0x3b4861=_0x3b4861-0x0;var _0x4c5b77=_0xa0c5[_0x3b4861];return _0x4c5b77;};'use strict';var EventEmitter=require(_0x5a0c('0x0'));var SquareProject=require(_0x5a0c('0x1'))['db'][_0x5a0c('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x5a0c('0x3')](0x0);var events={'afterCreate':_0x5a0c('0x4'),'afterUpdate':_0x5a0c('0x5'),'afterDestroy':_0x5a0c('0x6')};function emitEvent(_0x1765c5){return function(_0x22159e,_0xfd426c,_0x521f21){SquareProjectEvents[_0x5a0c('0x7')](_0x1765c5+':'+_0x22159e['id'],_0x22159e);SquareProjectEvents[_0x5a0c('0x7')](_0x1765c5,_0x22159e);_0x521f21(null);};}for(var e in events){if(events[_0x5a0c('0x8')](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module[_0x5a0c('0x9')]=SquareProjectEvents; \ No newline at end of file +var _0x5fd8=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','SquareProject','setMaxListeners','update','remove'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x5fd8,0x68));var _0x85fd=function(_0x18ecb6,_0x53c3dd){_0x18ecb6=_0x18ecb6-0x0;var _0x1ba556=_0x5fd8[_0x18ecb6];return _0x1ba556;};'use strict';var EventEmitter=require(_0x85fd('0x0'));var SquareProject=require(_0x85fd('0x1'))['db'][_0x85fd('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x85fd('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x85fd('0x4'),'afterDestroy':_0x85fd('0x5')};function emitEvent(_0x171e14){return function(_0x2cfabe,_0x5ead7f,_0x21cd33){SquareProjectEvents[_0x85fd('0x6')](_0x171e14+':'+_0x2cfabe['id'],_0x2cfabe);SquareProjectEvents[_0x85fd('0x6')](_0x171e14,_0x2cfabe);_0x21cd33(null);};}for(var e in events){if(events[_0x85fd('0x7')](e)){var event=events[e];SquareProject[_0x85fd('0x8')](e,emitEvent(event));}}module[_0x85fd('0x9')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index cbc122d..8651571 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 _0x2e7d=['changed','preproduction','savedAt','YYYY-MM-DD\x20HH:mm:ss','production','format','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./squareProject.attributes','exports','define','SquareProject'];(function(_0x18ff02,_0x8d1caf){var _0x4f3115=function(_0x284ed2){while(--_0x284ed2){_0x18ff02['push'](_0x18ff02['shift']());}};_0x4f3115(++_0x8d1caf);}(_0x2e7d,0x18d));var _0xd2e7=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0x2e7d[_0x411017];return _0x2adeea;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd2e7('0x0'))(_0xd2e7('0x1'));var moment=require('moment');var BPromise=require(_0xd2e7('0x2'));var rp=require(_0xd2e7('0x3'));var fs=require('fs');var path=require(_0xd2e7('0x4'));var rimraf=require(_0xd2e7('0x5'));var config=require(_0xd2e7('0x6'));var attributes=require(_0xd2e7('0x7'));module[_0xd2e7('0x8')]=function(_0x1c85be,_0x4304a1){return _0x1c85be[_0xd2e7('0x9')](_0xd2e7('0xa'),attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1beb44,_0xe22694,_0x4e48a2){if(_0x1beb44[_0xd2e7('0xb')](_0xd2e7('0xc'))){_0x1beb44[_0xd2e7('0xd')]=moment()['format'](_0xd2e7('0xe'));}if(_0x1beb44[_0xd2e7('0xb')](_0xd2e7('0xf'))){_0x1beb44['publishedAt']=moment()[_0xd2e7('0x10')](_0xd2e7('0xe'));}_0x4e48a2(null,_0x1beb44);}}});}; \ No newline at end of file +var _0x9fb9=['../../config/environment','./squareProject.attributes','exports','define','SquareProject','square_projects','changed','preproduction','format','YYYY-MM-DD\x20HH:mm:ss','publishedAt','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x3f994d,_0x249d72){var _0x5309b4=function(_0x545307){while(--_0x545307){_0x3f994d['push'](_0x3f994d['shift']());}};_0x5309b4(++_0x249d72);}(_0x9fb9,0xab));var _0x99fb=function(_0xed6995,_0x2425ba){_0xed6995=_0xed6995-0x0;var _0x5d3f82=_0x9fb9[_0xed6995];return _0x5d3f82;};'use strict';var _=require(_0x99fb('0x0'));var util=require(_0x99fb('0x1'));var logger=require(_0x99fb('0x2'))(_0x99fb('0x3'));var moment=require(_0x99fb('0x4'));var BPromise=require(_0x99fb('0x5'));var rp=require(_0x99fb('0x6'));var fs=require('fs');var path=require(_0x99fb('0x7'));var rimraf=require(_0x99fb('0x8'));var config=require(_0x99fb('0x9'));var attributes=require(_0x99fb('0xa'));module[_0x99fb('0xb')]=function(_0x3fb84b,_0x5b57a8){return _0x3fb84b[_0x99fb('0xc')](_0x99fb('0xd'),attributes,{'tableName':_0x99fb('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x516c81,_0x7f0770,_0x5d194a){if(_0x516c81[_0x99fb('0xf')](_0x99fb('0x10'))){_0x516c81['savedAt']=moment()[_0x99fb('0x11')](_0x99fb('0x12'));}if(_0x516c81[_0x99fb('0xf')]('production')){_0x516c81[_0x99fb('0x13')]=moment()['format'](_0x99fb('0x12'));}_0x5d194a(null,_0x516c81);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 20ecdba..aed0fb9 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 _0xfa12=['catch','../../mysqldb','../../config/logger','rpc','redis','localhost','./squareProject.socket','register','SquareProject','options','where','attributes','include','map','model','then','debug','GetSquareProjects','stringify','error','message','raw','info','ShowSquareProject'];(function(_0x2ef490,_0x3acfe3){var _0x359b07=function(_0x3aa422){while(--_0x3aa422){_0x2ef490['push'](_0x2ef490['shift']());}};_0x359b07(++_0x3acfe3);}(_0xfa12,0xf1));var _0x2fa1=function(_0x535b98,_0x864391){_0x535b98=_0x535b98-0x0;var _0x7f8180=_0xfa12[_0x535b98];return _0x7f8180;};'use strict';var _=require('lodash');var Redis=require('ioredis');var db=require(_0x2fa1('0x0'))['db'];var logger=require(_0x2fa1('0x1'))(_0x2fa1('0x2'));var config=require('../../config/environment');config[_0x2fa1('0x3')]=_['defaults'](config[_0x2fa1('0x3')],{'host':_0x2fa1('0x4'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2fa1('0x3')]));require(_0x2fa1('0x5'))[_0x2fa1('0x6')](socket);exports['GetSquareProjects']=function(_0x1cd7bd){var _0x1f60f3=this;return new Promise(function(_0x35ea0c,_0x27fb54){return db[_0x2fa1('0x7')]['findAll']({'raw':_0x1cd7bd[_0x2fa1('0x8')]?_0x1cd7bd[_0x2fa1('0x8')]['raw']===undefined?!![]:![]:!![],'where':_0x1cd7bd['options']?_0x1cd7bd['options'][_0x2fa1('0x9')]||null:null,'attributes':_0x1cd7bd[_0x2fa1('0x8')]?_0x1cd7bd[_0x2fa1('0x8')][_0x2fa1('0xa')]||null:null,'limit':_0x1cd7bd[_0x2fa1('0x8')]?_0x1cd7bd[_0x2fa1('0x8')]['limit']||null:null,'include':_0x1cd7bd['options']?_0x1cd7bd[_0x2fa1('0x8')][_0x2fa1('0xb')]?_[_0x2fa1('0xc')](_0x1cd7bd[_0x2fa1('0x8')][_0x2fa1('0xb')],function(_0x59829b){return{'model':db[_0x59829b['model']],'as':_0x59829b['as'],'attributes':_0x59829b[_0x2fa1('0xa')],'include':_0x59829b[_0x2fa1('0xb')]?_['map'](_0x59829b['include'],function(_0x27da7f){return{'model':db[_0x27da7f[_0x2fa1('0xd')]],'as':_0x27da7f['as'],'attributes':_0x27da7f[_0x2fa1('0xa')],'include':_0x27da7f[_0x2fa1('0xb')]?_[_0x2fa1('0xc')](_0x27da7f[_0x2fa1('0xb')],function(_0xd6903d){return{'model':db[_0xd6903d[_0x2fa1('0xd')]],'as':_0xd6903d['as'],'attributes':_0xd6903d[_0x2fa1('0xa')]};}):[]};}):[]};}):[]:[]})[_0x2fa1('0xe')](function(_0x25bd63){logger['info']('GetSquareProjects',_0x1cd7bd);logger[_0x2fa1('0xf')](_0x2fa1('0x10'),_0x1cd7bd,JSON[_0x2fa1('0x11')](_0x25bd63));_0x35ea0c(_0x25bd63);})['catch'](function(_0x4c2fca){logger[_0x2fa1('0x12')]('GetSquareProjects',_0x4c2fca[_0x2fa1('0x13')],_0x1cd7bd);_0x27fb54(_0x1f60f3['error'](0x1f4,_0x4c2fca['message']));});});};exports['ShowSquareProject']=function(_0x252c6d){var _0x33a228=this;return new Promise(function(_0xb76e53,_0x1c4e68){return db[_0x2fa1('0x7')]['find']({'raw':_0x252c6d['options']?_0x252c6d[_0x2fa1('0x8')][_0x2fa1('0x14')]===undefined?!![]:![]:!![],'where':_0x252c6d[_0x2fa1('0x8')]?_0x252c6d[_0x2fa1('0x8')]['where']||null:null,'attributes':_0x252c6d[_0x2fa1('0x8')]?_0x252c6d[_0x2fa1('0x8')]['attributes']||null:null,'include':_0x252c6d['options']?_0x252c6d[_0x2fa1('0x8')][_0x2fa1('0xb')]?_[_0x2fa1('0xc')](_0x252c6d['options']['include'],function(_0xf37148){return{'model':db[_0xf37148[_0x2fa1('0xd')]],'as':_0xf37148['as'],'attributes':_0xf37148[_0x2fa1('0xa')],'include':_0xf37148[_0x2fa1('0xb')]?_[_0x2fa1('0xc')](_0xf37148['include'],function(_0x363196){return{'model':db[_0x363196['model']],'as':_0x363196['as'],'attributes':_0x363196['attributes'],'include':_0x363196[_0x2fa1('0xb')]?_[_0x2fa1('0xc')](_0x363196['include'],function(_0x406c48){return{'model':db[_0x406c48[_0x2fa1('0xd')]],'as':_0x406c48['as'],'attributes':_0x406c48['attributes']};}):[]};}):[]};}):[]:[]})[_0x2fa1('0xe')](function(_0x39f5de){logger[_0x2fa1('0x15')](_0x2fa1('0x16'),_0x252c6d);logger['debug']('ShowSquareProject',_0x252c6d,JSON['stringify'](_0x39f5de));_0xb76e53(_0x39f5de);})[_0x2fa1('0x17')](function(_0x2d4ec5){logger[_0x2fa1('0x12')](_0x2fa1('0x16'),_0x2d4ec5[_0x2fa1('0x13')],_0x252c6d);_0x1c4e68(_0x33a228[_0x2fa1('0x12')](0x1f4,_0x2d4ec5[_0x2fa1('0x13')]));});});}; \ No newline at end of file +var _0x1c71=['register','GetSquareProjects','SquareProject','options','raw','where','attributes','include','map','model','then','info','debug','stringify','catch','error','message','find','ShowSquareProject','lodash','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','redis','localhost','socket.io-emitter','./squareProject.socket'];(function(_0x271c5e,_0x176497){var _0x1c376b=function(_0x11d4b3){while(--_0x11d4b3){_0x271c5e['push'](_0x271c5e['shift']());}};_0x1c376b(++_0x176497);}(_0x1c71,0x135));var _0x11c7=function(_0x1d302e,_0x8443a){_0x1d302e=_0x1d302e-0x0;var _0x2e6995=_0x1c71[_0x1d302e];return _0x2e6995;};'use strict';var _=require(_0x11c7('0x0'));var Redis=require(_0x11c7('0x1'));var db=require(_0x11c7('0x2'))['db'];var logger=require(_0x11c7('0x3'))(_0x11c7('0x4'));var config=require(_0x11c7('0x5'));config['redis']=_['defaults'](config[_0x11c7('0x6')],{'host':_0x11c7('0x7'),'port':0x18eb});var socket=require(_0x11c7('0x8'))(new Redis(config[_0x11c7('0x6')]));require(_0x11c7('0x9'))[_0x11c7('0xa')](socket);exports[_0x11c7('0xb')]=function(_0x16315a){var _0x1c3046=this;return new Promise(function(_0x4a3da0,_0x3416dc){return db[_0x11c7('0xc')]['findAll']({'raw':_0x16315a[_0x11c7('0xd')]?_0x16315a['options'][_0x11c7('0xe')]===undefined?!![]:![]:!![],'where':_0x16315a['options']?_0x16315a[_0x11c7('0xd')][_0x11c7('0xf')]||null:null,'attributes':_0x16315a[_0x11c7('0xd')]?_0x16315a[_0x11c7('0xd')][_0x11c7('0x10')]||null:null,'limit':_0x16315a[_0x11c7('0xd')]?_0x16315a[_0x11c7('0xd')]['limit']||null:null,'include':_0x16315a['options']?_0x16315a[_0x11c7('0xd')][_0x11c7('0x11')]?_[_0x11c7('0x12')](_0x16315a['options'][_0x11c7('0x11')],function(_0x3100c0){return{'model':db[_0x3100c0['model']],'as':_0x3100c0['as'],'attributes':_0x3100c0[_0x11c7('0x10')],'include':_0x3100c0['include']?_[_0x11c7('0x12')](_0x3100c0['include'],function(_0x3b9d78){return{'model':db[_0x3b9d78[_0x11c7('0x13')]],'as':_0x3b9d78['as'],'attributes':_0x3b9d78['attributes'],'include':_0x3b9d78['include']?_[_0x11c7('0x12')](_0x3b9d78['include'],function(_0x1b772f){return{'model':db[_0x1b772f['model']],'as':_0x1b772f['as'],'attributes':_0x1b772f[_0x11c7('0x10')]};}):[]};}):[]};}):[]:[]})[_0x11c7('0x14')](function(_0x2306be){logger[_0x11c7('0x15')](_0x11c7('0xb'),_0x16315a);logger[_0x11c7('0x16')](_0x11c7('0xb'),_0x16315a,JSON[_0x11c7('0x17')](_0x2306be));_0x4a3da0(_0x2306be);})[_0x11c7('0x18')](function(_0x9852a1){logger[_0x11c7('0x19')]('GetSquareProjects',_0x9852a1[_0x11c7('0x1a')],_0x16315a);_0x3416dc(_0x1c3046[_0x11c7('0x19')](0x1f4,_0x9852a1['message']));});});};exports['ShowSquareProject']=function(_0x302cc2){var _0x47d446=this;return new Promise(function(_0x4a5d50,_0x39e85e){return db[_0x11c7('0xc')][_0x11c7('0x1b')]({'raw':_0x302cc2['options']?_0x302cc2[_0x11c7('0xd')][_0x11c7('0xe')]===undefined?!![]:![]:!![],'where':_0x302cc2[_0x11c7('0xd')]?_0x302cc2[_0x11c7('0xd')]['where']||null:null,'attributes':_0x302cc2['options']?_0x302cc2[_0x11c7('0xd')][_0x11c7('0x10')]||null:null,'include':_0x302cc2[_0x11c7('0xd')]?_0x302cc2[_0x11c7('0xd')][_0x11c7('0x11')]?_[_0x11c7('0x12')](_0x302cc2[_0x11c7('0xd')][_0x11c7('0x11')],function(_0x18d4a4){return{'model':db[_0x18d4a4['model']],'as':_0x18d4a4['as'],'attributes':_0x18d4a4[_0x11c7('0x10')],'include':_0x18d4a4[_0x11c7('0x11')]?_['map'](_0x18d4a4[_0x11c7('0x11')],function(_0xd9faf4){return{'model':db[_0xd9faf4[_0x11c7('0x13')]],'as':_0xd9faf4['as'],'attributes':_0xd9faf4['attributes'],'include':_0xd9faf4[_0x11c7('0x11')]?_[_0x11c7('0x12')](_0xd9faf4['include'],function(_0x4af630){return{'model':db[_0x4af630['model']],'as':_0x4af630['as'],'attributes':_0x4af630['attributes']};}):[]};}):[]};}):[]:[]})[_0x11c7('0x14')](function(_0x32fb7a){logger[_0x11c7('0x15')](_0x11c7('0x1c'),_0x302cc2);logger[_0x11c7('0x16')](_0x11c7('0x1c'),_0x302cc2,JSON[_0x11c7('0x17')](_0x32fb7a));_0x4a5d50(_0x32fb7a);})[_0x11c7('0x18')](function(_0x17869a){logger[_0x11c7('0x19')]('ShowSquareProject',_0x17869a[_0x11c7('0x1a')],_0x302cc2);_0x39e85e(_0x47d446[_0x11c7('0x19')](0x1f4,_0x17869a[_0x11c7('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index b92a44f..37ea692 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 _0xf7b9=['removeListener','register','length','squareProject:','./squareProject.events','save','emit'];(function(_0x497b1e,_0x586379){var _0x3f72e1=function(_0x4c227d){while(--_0x4c227d){_0x497b1e['push'](_0x497b1e['shift']());}};_0x3f72e1(++_0x586379);}(_0xf7b9,0x11c));var _0x9f7b=function(_0xd28290,_0x48ddfd){_0xd28290=_0xd28290-0x0;var _0x1fed08=_0xf7b9[_0xd28290];return _0x1fed08;};'use strict';var SquareProjectEvents=require(_0x9f7b('0x0'));var events=[_0x9f7b('0x1'),'remove','update'];function createListener(_0x4aabcc,_0x36ce73){return function(_0x5261a3){_0x36ce73[_0x9f7b('0x2')](_0x4aabcc,_0x5261a3);};}function removeListener(_0xdf3496,_0x9be53){return function(){SquareProjectEvents[_0x9f7b('0x3')](_0xdf3496,_0x9be53);};}exports[_0x9f7b('0x4')]=function(_0x13b947){for(var _0x3cd3c1=0x0,_0x51d09e=events[_0x9f7b('0x5')];_0x3cd3c1<_0x51d09e;_0x3cd3c1++){var _0x17b718=events[_0x3cd3c1];var _0x5c0baf=createListener(_0x9f7b('0x6')+_0x17b718,_0x13b947);SquareProjectEvents['on'](_0x17b718,_0x5c0baf);}}; \ No newline at end of file +var _0x1dfc=['emit','length','save'];(function(_0x4217f4,_0x3ce0ee){var _0x10a201=function(_0x1ac9ad){while(--_0x1ac9ad){_0x4217f4['push'](_0x4217f4['shift']());}};_0x10a201(++_0x3ce0ee);}(_0x1dfc,0x125));var _0xc1df=function(_0x3b0165,_0x3b9ed5){_0x3b0165=_0x3b0165-0x0;var _0x11fee4=_0x1dfc[_0x3b0165];return _0x11fee4;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0xc1df('0x0'),'remove','update'];function createListener(_0x14471e,_0x3b7ccc){return function(_0x889708){_0x3b7ccc[_0xc1df('0x1')](_0x14471e,_0x889708);};}function removeListener(_0x37de8d,_0x46f38b){return function(){SquareProjectEvents['removeListener'](_0x37de8d,_0x46f38b);};}exports['register']=function(_0x5eb770){for(var _0x16ac37=0x0,_0x41e6b0=events[_0xc1df('0x2')];_0x16ac37<_0x41e6b0;_0x16ac37++){var _0x57934f=events[_0x16ac37];var _0x3cbeb4=createListener('squareProject:'+_0x57934f,_0x5eb770);SquareProjectEvents['on'](_0x57934f,_0x3cbeb4);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 174a75d..1a4db19 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 _0x53ec=['update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./squareRecording.controller','isAuthenticated','get','/:id','show','/:id/download','download','post','create','put'];(function(_0x3a5dc0,_0x438d16){var _0x3ff1a0=function(_0x5c2f52){while(--_0x5c2f52){_0x3a5dc0['push'](_0x3a5dc0['shift']());}};_0x3ff1a0(++_0x438d16);}(_0x53ec,0x192));var _0xc53e=function(_0x4cb231,_0x3d3c5b){_0x4cb231=_0x4cb231-0x0;var _0x4d5063=_0x53ec[_0x4cb231];return _0x4d5063;};'use strict';var multer=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var path=require(_0xc53e('0x2'));var timeout=require(_0xc53e('0x3'));var express=require(_0xc53e('0x4'));var router=express[_0xc53e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc53e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc53e('0x7'));var controller=require(_0xc53e('0x8'));router['get']('/',auth[_0xc53e('0x9')](),controller['index']);router[_0xc53e('0xa')](_0xc53e('0xb'),auth['isAuthenticated'](),controller[_0xc53e('0xc')]);router[_0xc53e('0xa')](_0xc53e('0xd'),auth[_0xc53e('0x9')](),controller[_0xc53e('0xe')]);router[_0xc53e('0xf')]('/',auth[_0xc53e('0x9')](),controller[_0xc53e('0x10')]);router[_0xc53e('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xc53e('0x12')]);router['delete']('/:id',auth[_0xc53e('0x9')](),controller[_0xc53e('0x13')]);module[_0xc53e('0x14')]=router; \ No newline at end of file +var _0xf494=['../../config/environment','./squareRecording.controller','get','isAuthenticated','index','show','/:id/download','download','post','create','/:id','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0xe0e248,_0x3166c5){var _0x391ff3=function(_0x3f322b){while(--_0x3f322b){_0xe0e248['push'](_0xe0e248['shift']());}};_0x391ff3(++_0x3166c5);}(_0xf494,0x1c6));var _0x4f49=function(_0x4cab9c,_0xf772d9){_0x4cab9c=_0x4cab9c-0x0;var _0x578898=_0xf494[_0x4cab9c];return _0x578898;};'use strict';var multer=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var path=require(_0x4f49('0x2'));var timeout=require('connect-timeout');var express=require(_0x4f49('0x3'));var router=express[_0x4f49('0x4')]();var fs_extra=require(_0x4f49('0x5'));var auth=require(_0x4f49('0x6'));var interaction=require(_0x4f49('0x7'));var config=require(_0x4f49('0x8'));var controller=require(_0x4f49('0x9'));router[_0x4f49('0xa')]('/',auth[_0x4f49('0xb')](),controller[_0x4f49('0xc')]);router[_0x4f49('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x4f49('0xd')]);router[_0x4f49('0xa')](_0x4f49('0xe'),auth[_0x4f49('0xb')](),controller[_0x4f49('0xf')]);router[_0x4f49('0x10')]('/',auth[_0x4f49('0xb')](),controller[_0x4f49('0x11')]);router['put'](_0x4f49('0x12'),auth[_0x4f49('0xb')](),controller['update']);router[_0x4f49('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x4f49('0x14')]);module[_0x4f49('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 1ac0c62..879bfaf 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 _0x038b=['lastIndexOf','exports','STRING','VIRTUAL','substring'];(function(_0x4d7bad,_0x494fed){var _0x243b88=function(_0x52a5bb){while(--_0x52a5bb){_0x4d7bad['push'](_0x4d7bad['shift']());}};_0x243b88(++_0x494fed);}(_0x038b,0x114));var _0xb038=function(_0x1353b3,_0x5ea5ce){_0x1353b3=_0x1353b3-0x0;var _0x324e33=_0x038b[_0x1353b3];return _0x324e33;};'use strict';var Sequelize=require('sequelize');module[_0xb038('0x0')]={'uniqueid':{'type':Sequelize[_0xb038('0x1')]},'callerid':{'type':Sequelize[_0xb038('0x1')]},'calleridname':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xb038('0x1')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xb038('0x1')]},'accountcode':{'type':Sequelize[_0xb038('0x1')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0xb038('0x1')]},'saveName':{'type':Sequelize[_0xb038('0x1')]},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0xb038('0x2')],'get':function(){var _0x1b077a='';var _0x1534a9=this['getDataValue']('savePath');if(_0x1534a9){_0x1b077a=_0x1534a9[_0xb038('0x3')](_0x1534a9[_0xb038('0x4')]('.'));}return _0x1b077a;}}}; \ No newline at end of file +var _0x326f=['getDataValue','sequelize','STRING','VIRTUAL'];(function(_0x187bb2,_0x2f59bf){var _0x4af854=function(_0x1c91ce){while(--_0x1c91ce){_0x187bb2['push'](_0x187bb2['shift']());}};_0x4af854(++_0x2f59bf);}(_0x326f,0xd1));var _0xf326=function(_0x2818ec,_0x1cd44f){_0x2818ec=_0x2818ec-0x0;var _0x36dcb3=_0x326f[_0x2818ec];return _0x36dcb3;};'use strict';var Sequelize=require(_0xf326('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xf326('0x1')]},'calleridname':{'type':Sequelize[_0xf326('0x1')]},'context':{'type':Sequelize[_0xf326('0x1')]},'extension':{'type':Sequelize[_0xf326('0x1')]},'priority':{'type':Sequelize[_0xf326('0x1')]},'accountcode':{'type':Sequelize[_0xf326('0x1')]},'dnid':{'type':Sequelize[_0xf326('0x1')]},'projectName':{'type':Sequelize[_0xf326('0x1')]},'saveName':{'type':Sequelize[_0xf326('0x1')]},'filename':{'type':Sequelize[_0xf326('0x1')]},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0xf326('0x2')],'get':function(){var _0x3851eb='';var _0x165f95=this[_0xf326('0x3')]('savePath');if(_0x165f95){_0x3851eb=_0x165f95['substring'](_0x165f95['lastIndexOf']('.'));}return _0x3851eb;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 70215eb..ffa1b12 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 _0x76c3=['reject','save','then','destroy','error','stack','name','send','index','SquareRecording','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','update','params','../../components/encryptor','savePath','format','%s.cypher','existsSync','decryptFile','secrets','Sequelize','SquareRecording\x20not\x20found','filename','download','unlink','message','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','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set'];(function(_0x463483,_0x422280){var _0x41de4d=function(_0x59828d){while(--_0x59828d){_0x463483['push'](_0x463483['shift']());}};_0x41de4d(++_0x422280);}(_0x76c3,0x15e));var _0x376c=function(_0x434485,_0x214577){_0x434485=_0x434485-0x0;var _0x4cd31e=_0x76c3[_0x434485];return _0x4cd31e;};'use strict';var emlformat=require(_0x376c('0x0'));var rimraf=require(_0x376c('0x1'));var zipdir=require(_0x376c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x376c('0x3'));var moment=require(_0x376c('0x4'));var BPromise=require(_0x376c('0x5'));var Mustache=require(_0x376c('0x6'));var util=require('util');var path=require(_0x376c('0x7'));var sox=require(_0x376c('0x8'));var csv=require(_0x376c('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x376c('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x376c('0xb'));var jsforce=require(_0x376c('0xc'));var deskjs=require(_0x376c('0xd'));var toCsv=require(_0x376c('0x9'));var querystring=require(_0x376c('0xe'));var Papa=require(_0x376c('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x376c('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x376c('0x11'));var utils=require(_0x376c('0x12'));var config=require(_0x376c('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x376c('0x14'))['db'];function respondWithStatusCode(_0x3706c7,_0xadc4dc){_0xadc4dc=_0xadc4dc||0xcc;return function(_0x5cfbcf){if(_0x5cfbcf){return _0x3706c7[_0x376c('0x15')](_0xadc4dc);}return _0x3706c7[_0x376c('0x16')](_0xadc4dc)[_0x376c('0x17')]();};}function respondWithResult(_0x2c2e,_0x4a18ec){_0x4a18ec=_0x4a18ec||0xc8;return function(_0x5d2fe2){if(_0x5d2fe2){return _0x2c2e[_0x376c('0x16')](_0x4a18ec)[_0x376c('0x18')](_0x5d2fe2);}};}function respondWithFilteredResult(_0x24edaf,_0x3f0d63){return function(_0x49bf4d){if(_0x49bf4d){var _0x4e3e40=typeof _0x3f0d63[_0x376c('0x19')]===_0x376c('0x1a')&&typeof _0x3f0d63['limit']===_0x376c('0x1a');var _0x12a31a=_0x49bf4d[_0x376c('0x1b')];var _0x3e246a=_0x4e3e40?0x0:_0x3f0d63['offset'];var _0x11d755=_0x4e3e40?_0x49bf4d[_0x376c('0x1b')]:_0x3f0d63['offset']+_0x3f0d63[_0x376c('0x1c')];var _0x4ad3b8;if(_0x11d755>=_0x12a31a){_0x11d755=_0x12a31a;_0x4ad3b8=0xc8;}else{_0x4ad3b8=0xce;}_0x24edaf[_0x376c('0x16')](_0x4ad3b8);return _0x24edaf[_0x376c('0x1d')]('Content-Range',_0x3e246a+'-'+_0x11d755+'/'+_0x12a31a)['json'](_0x49bf4d);}return null;};}function patchUpdates(_0x5c818d){return function(_0x505bc6){try{jsonpatch['apply'](_0x505bc6,_0x5c818d,!![]);}catch(_0x3e3f7f){return BPromise[_0x376c('0x1e')](_0x3e3f7f);}return _0x505bc6[_0x376c('0x1f')]();};}function saveUpdates(_0x4749f6,_0x76f0b){return function(_0x1f6883){if(_0x1f6883){return _0x1f6883['update'](_0x4749f6)[_0x376c('0x20')](function(_0xcdc17c){return _0xcdc17c;});}return null;};}function removeEntity(_0xe27999,_0x13d716){return function(_0x12a52f){if(_0x12a52f){return _0x12a52f[_0x376c('0x21')]()[_0x376c('0x20')](function(){_0xe27999[_0x376c('0x16')](0xcc)[_0x376c('0x17')]();});}};}function handleEntityNotFound(_0x4f77e0,_0x3bf3a2){return function(_0x5efdfc){if(!_0x5efdfc){_0x4f77e0['sendStatus'](0x194);}return _0x5efdfc;};}function handleError(_0x530eb1,_0x970bd6){_0x970bd6=_0x970bd6||0x1f4;return function(_0x52e6c8){logger[_0x376c('0x22')](_0x52e6c8[_0x376c('0x23')]);if(_0x52e6c8['name']){delete _0x52e6c8[_0x376c('0x24')];}_0x530eb1[_0x376c('0x16')](_0x970bd6)[_0x376c('0x25')](_0x52e6c8);};}exports[_0x376c('0x26')]=function(_0x10efbf,_0x5058e7){var _0x19c33b={},_0x2d1a9b={},_0x2e56a6={'count':0x0,'rows':[]};var _0x47d44e=_['map'](db[_0x376c('0x27')][_0x376c('0x28')],function(_0x1131af){return{'name':_0x1131af[_0x376c('0x29')],'type':_0x1131af[_0x376c('0x2a')][_0x376c('0x2b')]};});_0x2d1a9b[_0x376c('0x2c')]=_[_0x376c('0x2d')](_0x47d44e,_0x376c('0x24'));_0x2d1a9b[_0x376c('0x2e')]=_[_0x376c('0x2f')](_0x10efbf['query']);_0x2d1a9b[_0x376c('0x30')]=_[_0x376c('0x31')](_0x2d1a9b[_0x376c('0x2c')],_0x2d1a9b[_0x376c('0x2e')]);_0x19c33b[_0x376c('0x32')]=_[_0x376c('0x31')](_0x2d1a9b[_0x376c('0x2c')],qs[_0x376c('0x33')](_0x10efbf[_0x376c('0x2e')][_0x376c('0x33')]));_0x19c33b['attributes']=_0x19c33b[_0x376c('0x32')][_0x376c('0x34')]?_0x19c33b[_0x376c('0x32')]:_0x2d1a9b['model'];if(!_0x10efbf['query'][_0x376c('0x35')](_0x376c('0x36'))){_0x19c33b[_0x376c('0x1c')]=qs['limit'](_0x10efbf[_0x376c('0x2e')][_0x376c('0x1c')]);_0x19c33b['offset']=qs[_0x376c('0x19')](_0x10efbf[_0x376c('0x2e')][_0x376c('0x19')]);}_0x19c33b['order']=qs[_0x376c('0x37')](_0x10efbf[_0x376c('0x2e')][_0x376c('0x37')]);_0x19c33b[_0x376c('0x38')]=qs[_0x376c('0x30')](_[_0x376c('0x39')](_0x10efbf[_0x376c('0x2e')],_0x2d1a9b[_0x376c('0x30')]),_0x47d44e);if(_0x10efbf['query'][_0x376c('0x3a')]){_0x19c33b[_0x376c('0x38')]=_[_0x376c('0x3b')](_0x19c33b[_0x376c('0x38')],{'$or':_[_0x376c('0x2d')](_0x47d44e,function(_0x3181ba){if(_0x3181ba[_0x376c('0x2a')]!==_0x376c('0x3c')){var _0x134acd={};_0x134acd[_0x3181ba[_0x376c('0x24')]]={'$like':'%'+_0x10efbf['query'][_0x376c('0x3a')]+'%'};return _0x134acd;}})});}_0x19c33b=_[_0x376c('0x3b')]({},_0x19c33b,_0x10efbf[_0x376c('0x3d')]);var _0x1f73d5={'where':_0x19c33b[_0x376c('0x38')]};return db['SquareRecording'][_0x376c('0x1b')](_0x1f73d5)[_0x376c('0x20')](function(_0x2f08f7){_0x2e56a6['count']=_0x2f08f7;if(_0x10efbf[_0x376c('0x2e')][_0x376c('0x3e')]){_0x19c33b[_0x376c('0x3f')]=[{'all':!![]}];}return db[_0x376c('0x27')][_0x376c('0x40')](_0x19c33b);})[_0x376c('0x20')](function(_0x54fd59){_0x2e56a6[_0x376c('0x41')]=_0x54fd59;return _0x2e56a6;})[_0x376c('0x20')](respondWithFilteredResult(_0x5058e7,_0x19c33b))[_0x376c('0x42')](handleError(_0x5058e7,null));};exports[_0x376c('0x43')]=function(_0x5021a3,_0x28acb5){var _0x61f871={'raw':!![],'where':{'id':_0x5021a3['params']['id']}},_0x63cfad={};_0x63cfad[_0x376c('0x2c')]=_[_0x376c('0x2f')](db['SquareRecording'][_0x376c('0x28')]);_0x63cfad['query']=_[_0x376c('0x2f')](_0x5021a3['query']);_0x63cfad[_0x376c('0x30')]=_[_0x376c('0x31')](_0x63cfad['model'],_0x63cfad[_0x376c('0x2e')]);_0x61f871['attributes']=_['intersection'](_0x63cfad[_0x376c('0x2c')],qs['fields'](_0x5021a3[_0x376c('0x2e')][_0x376c('0x33')]));_0x61f871['attributes']=_0x61f871[_0x376c('0x32')][_0x376c('0x34')]?_0x61f871[_0x376c('0x32')]:_0x63cfad[_0x376c('0x2c')];if(_0x5021a3[_0x376c('0x2e')][_0x376c('0x3e')]){_0x61f871['include']=[{'all':!![]}];}_0x61f871=_[_0x376c('0x3b')]({},_0x61f871,_0x5021a3['options']);return db[_0x376c('0x27')][_0x376c('0x44')](_0x61f871)['then'](handleEntityNotFound(_0x28acb5,null))[_0x376c('0x20')](respondWithResult(_0x28acb5,null))[_0x376c('0x42')](handleError(_0x28acb5,null));};exports['create']=function(_0x13a4e8,_0x1da7a9){return db[_0x376c('0x27')][_0x376c('0x45')](_0x13a4e8[_0x376c('0x46')],{})[_0x376c('0x20')](respondWithResult(_0x1da7a9,0xc9))[_0x376c('0x42')](handleError(_0x1da7a9,null));};exports[_0x376c('0x47')]=function(_0x4ecc4e,_0x155712){if(_0x4ecc4e[_0x376c('0x46')]['id']){delete _0x4ecc4e['body']['id'];}return db[_0x376c('0x27')][_0x376c('0x44')]({'where':{'id':_0x4ecc4e[_0x376c('0x48')]['id']}})['then'](handleEntityNotFound(_0x155712,null))[_0x376c('0x20')](saveUpdates(_0x4ecc4e[_0x376c('0x46')],null))[_0x376c('0x20')](respondWithResult(_0x155712,null))['catch'](handleError(_0x155712,null));};exports['download']=function(_0x24cbf2,_0x340df6,_0x214933){var _0x3d7e0a=require(_0x376c('0x49'));var _0x284358=![];var _0x4623b6={};if(_0x24cbf2[_0x376c('0x2e')]['type']&&_0x24cbf2[_0x376c('0x2e')][_0x376c('0x2a')]==='uniqueid'){_0x4623b6['uniqueid']=_0x24cbf2[_0x376c('0x48')]['id'];}else{_0x4623b6['id']=_0x24cbf2[_0x376c('0x48')]['id'];}return db[_0x376c('0x27')]['find']({'where':_0x4623b6,'attributes':['id','savePath','filename'],'raw':!![]})[_0x376c('0x20')](handleEntityNotFound(_0x340df6,null))[_0x376c('0x20')](function(_0x2179ea){if(_0x2179ea){var _0x4a4651=_0x2179ea[_0x376c('0x4a')];var _0x353dee=util[_0x376c('0x4b')](_0x376c('0x4c'),_0x4a4651);if(fs[_0x376c('0x4d')](_0x353dee)){_0x284358=!![];return _0x3d7e0a[_0x376c('0x4e')](_0x353dee,_0x4a4651,config[_0x376c('0x4f')]['recording'])['then'](function(){return _0x2179ea;});}return _0x2179ea;}})[_0x376c('0x20')](function(_0x5876f7){if(_0x5876f7){var _0x5208fe=_0x5876f7[_0x376c('0x4a')];if(!fs['existsSync'](_0x5208fe)){throw new db[(_0x376c('0x50'))]['ValidationError'](_0x376c('0x51'));}if(_0x5876f7[_0x376c('0x52')]){return _0x340df6[_0x376c('0x53')](_0x5208fe,_0x5876f7['filename']+path['extname'](_0x5208fe),function(){if(_0x284358){fs['unlink'](_0x5208fe);}});}else{return _0x340df6[_0x376c('0x53')](_0x5208fe,function(_0x4438ee){if(_0x284358){fs[_0x376c('0x54')](_0x5208fe);}});}}})[_0x376c('0x42')](function(_0x24bbc4){if(_0x24bbc4[_0x376c('0x55')]===_0x376c('0x51')){_0x340df6[_0x376c('0x16')](0x194)['send'](_0x376c('0x56'));}else{return handleError(_0x340df6,null);}});};exports['destroy']=function(_0x214e97,_0x35555e){return db[_0x376c('0x27')]['find']({'where':{'id':_0x214e97['params']['id']}})[_0x376c('0x20')](function(_0x16aba6){if(_[_0x376c('0x57')](_0x16aba6)){throw new ReferenceError(_0x376c('0x58'));}return _0x16aba6;})[_0x376c('0x20')](function(_0xc8af9a){var _0x58fcd5=_0xc8af9a[_0x376c('0x4a')];logger[_0x376c('0x59')](_0x376c('0x5a'),_0x58fcd5);if(!_[_0x376c('0x57')](_0xc8af9a['savePath'])&&fs[_0x376c('0x4d')](_0x58fcd5)){logger['info'](_0x376c('0x5b')+_0x58fcd5+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x376c('0x5c')](_0x58fcd5);}_0x58fcd5=_0x58fcd5+_0x376c('0x5d');if(!_[_0x376c('0x57')](_0xc8af9a[_0x376c('0x4a')])&&fs[_0x376c('0x4d')](_0x58fcd5)){logger['info']('File:\x20\x22'+_0x58fcd5+_0x376c('0x5e'));fs[_0x376c('0x5c')](_0x58fcd5);}return _0xc8af9a;})[_0x376c('0x20')](function(_0x574931){if(!_0x574931)throw new InternalError();return _0x574931[_0x376c('0x21')]();})[_0x376c('0x20')](function(){_0x35555e[_0x376c('0x16')](0xcc)[_0x376c('0x17')]();})[_0x376c('0x42')](handleError(_0x35555e,null));}; \ No newline at end of file +var _0x8489=['apply','save','update','then','destroy','sendStatus','error','stack','name','send','SquareRecording','rawAttributes','fieldName','key','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','filters','pick','where','merge','type','filter','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','../../components/encryptor','uniqueid','filename','savePath','format','%s.cypher','existsSync','Sequelize','SquareRecording\x20not\x20found','download','extname','unlink','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','count','set'];(function(_0x1928c1,_0x3a2fa9){var _0x5083d1=function(_0x1e7a40){while(--_0x1e7a40){_0x1928c1['push'](_0x1928c1['shift']());}};_0x5083d1(++_0x3a2fa9);}(_0x8489,0xf7));var _0x9848=function(_0x19614f,_0x7a6f1){_0x19614f=_0x19614f-0x0;var _0x18ae14=_0x8489[_0x19614f];return _0x18ae14;};'use strict';var emlformat=require(_0x9848('0x0'));var rimraf=require(_0x9848('0x1'));var zipdir=require(_0x9848('0x2'));var jsonpatch=require(_0x9848('0x3'));var rp=require(_0x9848('0x4'));var moment=require('moment');var BPromise=require(_0x9848('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x9848('0x6'));var sox=require(_0x9848('0x7'));var csv=require('to-csv');var ejs=require(_0x9848('0x8'));var fs=require('fs');var fs_extra=require(_0x9848('0x9'));var _=require(_0x9848('0xa'));var squel=require(_0x9848('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9848('0xc'));var toCsv=require('to-csv');var querystring=require(_0x9848('0xd'));var Papa=require(_0x9848('0xe'));var Redis=require(_0x9848('0xf'));var authService=require(_0x9848('0x10'));var qs=require(_0x9848('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9848('0x12'))('api');var utils=require(_0x9848('0x13'));var config=require(_0x9848('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x9848('0x15'))['db'];function respondWithStatusCode(_0x39b642,_0x2d8a6d){_0x2d8a6d=_0x2d8a6d||0xcc;return function(_0x19c0e3){if(_0x19c0e3){return _0x39b642['sendStatus'](_0x2d8a6d);}return _0x39b642[_0x9848('0x16')](_0x2d8a6d)[_0x9848('0x17')]();};}function respondWithResult(_0x4412d9,_0x4961ad){_0x4961ad=_0x4961ad||0xc8;return function(_0x41a889){if(_0x41a889){return _0x4412d9[_0x9848('0x16')](_0x4961ad)[_0x9848('0x18')](_0x41a889);}};}function respondWithFilteredResult(_0x288b19,_0x5440dc){return function(_0x404cff){if(_0x404cff){var _0x2bb3a8=typeof _0x5440dc[_0x9848('0x19')]===_0x9848('0x1a')&&typeof _0x5440dc['limit']===_0x9848('0x1a');var _0x54107b=_0x404cff[_0x9848('0x1b')];var _0x519341=_0x2bb3a8?0x0:_0x5440dc[_0x9848('0x19')];var _0x400077=_0x2bb3a8?_0x404cff[_0x9848('0x1b')]:_0x5440dc[_0x9848('0x19')]+_0x5440dc['limit'];var _0x497be6;if(_0x400077>=_0x54107b){_0x400077=_0x54107b;_0x497be6=0xc8;}else{_0x497be6=0xce;}_0x288b19[_0x9848('0x16')](_0x497be6);return _0x288b19[_0x9848('0x1c')]('Content-Range',_0x519341+'-'+_0x400077+'/'+_0x54107b)[_0x9848('0x18')](_0x404cff);}return null;};}function patchUpdates(_0x349a5f){return function(_0x162088){try{jsonpatch[_0x9848('0x1d')](_0x162088,_0x349a5f,!![]);}catch(_0x5c2ee6){return BPromise['reject'](_0x5c2ee6);}return _0x162088[_0x9848('0x1e')]();};}function saveUpdates(_0x102bce,_0x4489a0){return function(_0x15948b){if(_0x15948b){return _0x15948b[_0x9848('0x1f')](_0x102bce)[_0x9848('0x20')](function(_0x2076bc){return _0x2076bc;});}return null;};}function removeEntity(_0x72124a,_0x5939a6){return function(_0x525072){if(_0x525072){return _0x525072[_0x9848('0x21')]()['then'](function(){_0x72124a[_0x9848('0x16')](0xcc)[_0x9848('0x17')]();});}};}function handleEntityNotFound(_0x563e60,_0x19f543){return function(_0x3a76ce){if(!_0x3a76ce){_0x563e60[_0x9848('0x22')](0x194);}return _0x3a76ce;};}function handleError(_0x56ac3e,_0x39d00b){_0x39d00b=_0x39d00b||0x1f4;return function(_0x237d3f){logger[_0x9848('0x23')](_0x237d3f[_0x9848('0x24')]);if(_0x237d3f[_0x9848('0x25')]){delete _0x237d3f[_0x9848('0x25')];}_0x56ac3e[_0x9848('0x16')](_0x39d00b)[_0x9848('0x26')](_0x237d3f);};}exports['index']=function(_0x379457,_0x372deb){var _0x52286c={},_0x9a25b4={},_0x3dfe6d={'count':0x0,'rows':[]};var _0x57fe82=_['map'](db[_0x9848('0x27')][_0x9848('0x28')],function(_0x449481){return{'name':_0x449481[_0x9848('0x29')],'type':_0x449481['type'][_0x9848('0x2a')]};});_0x9a25b4[_0x9848('0x2b')]=_[_0x9848('0x2c')](_0x57fe82,_0x9848('0x25'));_0x9a25b4[_0x9848('0x2d')]=_[_0x9848('0x2e')](_0x379457[_0x9848('0x2d')]);_0x9a25b4['filters']=_[_0x9848('0x2f')](_0x9a25b4[_0x9848('0x2b')],_0x9a25b4[_0x9848('0x2d')]);_0x52286c['attributes']=_[_0x9848('0x2f')](_0x9a25b4[_0x9848('0x2b')],qs[_0x9848('0x30')](_0x379457[_0x9848('0x2d')][_0x9848('0x30')]));_0x52286c[_0x9848('0x31')]=_0x52286c[_0x9848('0x31')][_0x9848('0x32')]?_0x52286c['attributes']:_0x9a25b4[_0x9848('0x2b')];if(!_0x379457[_0x9848('0x2d')][_0x9848('0x33')](_0x9848('0x34'))){_0x52286c[_0x9848('0x35')]=qs[_0x9848('0x35')](_0x379457[_0x9848('0x2d')][_0x9848('0x35')]);_0x52286c[_0x9848('0x19')]=qs[_0x9848('0x19')](_0x379457[_0x9848('0x2d')][_0x9848('0x19')]);}_0x52286c[_0x9848('0x36')]=qs[_0x9848('0x37')](_0x379457[_0x9848('0x2d')][_0x9848('0x37')]);_0x52286c['where']=qs[_0x9848('0x38')](_[_0x9848('0x39')](_0x379457[_0x9848('0x2d')],_0x9a25b4[_0x9848('0x38')]),_0x57fe82);if(_0x379457['query']['filter']){_0x52286c[_0x9848('0x3a')]=_[_0x9848('0x3b')](_0x52286c['where'],{'$or':_[_0x9848('0x2c')](_0x57fe82,function(_0xcacf38){if(_0xcacf38[_0x9848('0x3c')]!=='VIRTUAL'){var _0x20b71f={};_0x20b71f[_0xcacf38[_0x9848('0x25')]]={'$like':'%'+_0x379457[_0x9848('0x2d')][_0x9848('0x3d')]+'%'};return _0x20b71f;}})});}_0x52286c=_[_0x9848('0x3b')]({},_0x52286c,_0x379457[_0x9848('0x3e')]);var _0x42be00={'where':_0x52286c[_0x9848('0x3a')]};return db[_0x9848('0x27')][_0x9848('0x1b')](_0x42be00)['then'](function(_0x364380){_0x3dfe6d[_0x9848('0x1b')]=_0x364380;if(_0x379457['query'][_0x9848('0x3f')]){_0x52286c[_0x9848('0x40')]=[{'all':!![]}];}return db[_0x9848('0x27')][_0x9848('0x41')](_0x52286c);})[_0x9848('0x20')](function(_0x3dd08f){_0x3dfe6d[_0x9848('0x42')]=_0x3dd08f;return _0x3dfe6d;})[_0x9848('0x20')](respondWithFilteredResult(_0x372deb,_0x52286c))[_0x9848('0x43')](handleError(_0x372deb,null));};exports[_0x9848('0x44')]=function(_0x4d7676,_0x463341){var _0x5376ec={'raw':!![],'where':{'id':_0x4d7676['params']['id']}},_0x2aa9c9={};_0x2aa9c9[_0x9848('0x2b')]=_[_0x9848('0x2e')](db[_0x9848('0x27')][_0x9848('0x28')]);_0x2aa9c9[_0x9848('0x2d')]=_[_0x9848('0x2e')](_0x4d7676[_0x9848('0x2d')]);_0x2aa9c9[_0x9848('0x38')]=_[_0x9848('0x2f')](_0x2aa9c9[_0x9848('0x2b')],_0x2aa9c9['query']);_0x5376ec[_0x9848('0x31')]=_[_0x9848('0x2f')](_0x2aa9c9[_0x9848('0x2b')],qs[_0x9848('0x30')](_0x4d7676[_0x9848('0x2d')]['fields']));_0x5376ec['attributes']=_0x5376ec[_0x9848('0x31')][_0x9848('0x32')]?_0x5376ec[_0x9848('0x31')]:_0x2aa9c9[_0x9848('0x2b')];if(_0x4d7676[_0x9848('0x2d')][_0x9848('0x3f')]){_0x5376ec[_0x9848('0x40')]=[{'all':!![]}];}_0x5376ec=_[_0x9848('0x3b')]({},_0x5376ec,_0x4d7676[_0x9848('0x3e')]);return db[_0x9848('0x27')][_0x9848('0x45')](_0x5376ec)[_0x9848('0x20')](handleEntityNotFound(_0x463341,null))[_0x9848('0x20')](respondWithResult(_0x463341,null))[_0x9848('0x43')](handleError(_0x463341,null));};exports['create']=function(_0xffdaa9,_0x56dc5d){return db[_0x9848('0x27')][_0x9848('0x46')](_0xffdaa9[_0x9848('0x47')],{})[_0x9848('0x20')](respondWithResult(_0x56dc5d,0xc9))['catch'](handleError(_0x56dc5d,null));};exports[_0x9848('0x1f')]=function(_0x3bc935,_0x1867c1){if(_0x3bc935[_0x9848('0x47')]['id']){delete _0x3bc935[_0x9848('0x47')]['id'];}return db[_0x9848('0x27')][_0x9848('0x45')]({'where':{'id':_0x3bc935[_0x9848('0x48')]['id']}})[_0x9848('0x20')](handleEntityNotFound(_0x1867c1,null))['then'](saveUpdates(_0x3bc935['body'],null))[_0x9848('0x20')](respondWithResult(_0x1867c1,null))[_0x9848('0x43')](handleError(_0x1867c1,null));};exports['download']=function(_0x26a479,_0x1e92a6,_0x521d5a){var _0x5cd82f=require(_0x9848('0x49'));var _0xb998e1=![];var _0x3a9808={};if(_0x26a479[_0x9848('0x2d')][_0x9848('0x3c')]&&_0x26a479['query'][_0x9848('0x3c')]==='uniqueid'){_0x3a9808[_0x9848('0x4a')]=_0x26a479[_0x9848('0x48')]['id'];}else{_0x3a9808['id']=_0x26a479[_0x9848('0x48')]['id'];}return db['SquareRecording'][_0x9848('0x45')]({'where':_0x3a9808,'attributes':['id','savePath',_0x9848('0x4b')],'raw':!![]})[_0x9848('0x20')](handleEntityNotFound(_0x1e92a6,null))['then'](function(_0x1727cf){if(_0x1727cf){var _0x3f0a12=_0x1727cf[_0x9848('0x4c')];var _0x1a4a59=util[_0x9848('0x4d')](_0x9848('0x4e'),_0x3f0a12);if(fs[_0x9848('0x4f')](_0x1a4a59)){_0xb998e1=!![];return _0x5cd82f['decryptFile'](_0x1a4a59,_0x3f0a12,config['secrets']['recording'])[_0x9848('0x20')](function(){return _0x1727cf;});}return _0x1727cf;}})[_0x9848('0x20')](function(_0x155dda){if(_0x155dda){var _0x408f50=_0x155dda[_0x9848('0x4c')];if(!fs[_0x9848('0x4f')](_0x408f50)){throw new db[(_0x9848('0x50'))]['ValidationError'](_0x9848('0x51'));}if(_0x155dda['filename']){return _0x1e92a6[_0x9848('0x52')](_0x408f50,_0x155dda[_0x9848('0x4b')]+path[_0x9848('0x53')](_0x408f50),function(){if(_0xb998e1){fs[_0x9848('0x54')](_0x408f50);}});}else{return _0x1e92a6[_0x9848('0x52')](_0x408f50,function(_0x3e7455){if(_0xb998e1){fs[_0x9848('0x54')](_0x408f50);}});}}})[_0x9848('0x43')](function(_0x375ed4){if(_0x375ed4['message']===_0x9848('0x51')){_0x1e92a6[_0x9848('0x16')](0x194)[_0x9848('0x26')]('Not\x20found');}else{return handleError(_0x1e92a6,null);}});};exports[_0x9848('0x21')]=function(_0x81feba,_0x3049a4){return db['SquareRecording'][_0x9848('0x45')]({'where':{'id':_0x81feba['params']['id']}})['then'](function(_0x222651){if(_[_0x9848('0x55')](_0x222651)){throw new ReferenceError(_0x9848('0x56'));}return _0x222651;})[_0x9848('0x20')](function(_0x236a2d){var _0x264735=_0x236a2d[_0x9848('0x4c')];logger[_0x9848('0x57')](_0x9848('0x58'),_0x264735);if(!_[_0x9848('0x55')](_0x236a2d[_0x9848('0x4c')])&&fs[_0x9848('0x4f')](_0x264735)){logger['info'](_0x9848('0x59')+_0x264735+_0x9848('0x5a'));fs['unlinkSync'](_0x264735);}_0x264735=_0x264735+'.cypher';if(!_[_0x9848('0x55')](_0x236a2d[_0x9848('0x4c')])&&fs[_0x9848('0x4f')](_0x264735)){logger['info'](_0x9848('0x59')+_0x264735+_0x9848('0x5a'));fs[_0x9848('0x5b')](_0x264735);}return _0x236a2d;})['then'](function(_0x340ced){if(!_0x340ced)throw new InternalError();return _0x340ced['destroy']();})[_0x9848('0x20')](function(){_0x3049a4['status'](0xcc)[_0x9848('0x17')]();})[_0x9848('0x43')](handleError(_0x3049a4,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 0f2242c..9cdce98 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 _0x7880=['square_recordings','lodash','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','exports','SquareRecording'];(function(_0x4e05c4,_0x423a3c){var _0x206884=function(_0x103892){while(--_0x103892){_0x4e05c4['push'](_0x4e05c4['shift']());}};_0x206884(++_0x423a3c);}(_0x7880,0x10f));var _0x0788=function(_0x14ea32,_0x262909){_0x14ea32=_0x14ea32-0x0;var _0x137bbb=_0x7880[_0x14ea32];return _0x137bbb;};'use strict';var _=require(_0x0788('0x0'));var util=require('util');var logger=require(_0x0788('0x1'))(_0x0788('0x2'));var moment=require(_0x0788('0x3'));var BPromise=require(_0x0788('0x4'));var rp=require(_0x0788('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x0788('0x6'));var attributes=require('./squareRecording.attributes');module[_0x0788('0x7')]=function(_0x2deca2,_0x34f9f1){return _0x2deca2['define'](_0x0788('0x8'),attributes,{'tableName':_0x0788('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc1d3=['SquareRecording','square_recordings','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./squareRecording.attributes','exports','define'];(function(_0x2a0a38,_0x4a6de5){var _0x4a200e=function(_0x2ef26b){while(--_0x2ef26b){_0x2a0a38['push'](_0x2a0a38['shift']());}};_0x4a200e(++_0x4a6de5);}(_0xc1d3,0x147));var _0x3c1d=function(_0xd8d241,_0x1469e8){_0xd8d241=_0xd8d241-0x0;var _0x24a589=_0xc1d3[_0xd8d241];return _0x24a589;};'use strict';var _=require(_0x3c1d('0x0'));var util=require(_0x3c1d('0x1'));var logger=require(_0x3c1d('0x2'))(_0x3c1d('0x3'));var moment=require(_0x3c1d('0x4'));var BPromise=require(_0x3c1d('0x5'));var rp=require(_0x3c1d('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3c1d('0x7'));var attributes=require(_0x3c1d('0x8'));module[_0x3c1d('0x9')]=function(_0x4d483a,_0x1b0abf){return _0x4d483a[_0x3c1d('0xa')](_0x3c1d('0xb'),attributes,{'tableName':_0x3c1d('0xc'),'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 7918a53..4e67f24 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 _0xbc03=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','code','SquareRecording,\x20%s,\x20%s','error','message','result','CreateSquareRecording','SquareRecording','create','body','options','raw'];(function(_0x1226c6,_0x2b62c8){var _0x5e007e=function(_0x53e3f1){while(--_0x53e3f1){_0x1226c6['push'](_0x1226c6['shift']());}};_0x5e007e(++_0x2b62c8);}(_0xbc03,0xe8));var _0x3bc0=function(_0x59d471,_0x2b1e92){_0x59d471=_0x59d471-0x0;var _0x5e23b1=_0xbc03[_0x59d471];return _0x5e23b1;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3bc0('0x0'));var BPromise=require('bluebird');var rs=require(_0x3bc0('0x1'));var fs=require('fs');var Redis=require(_0x3bc0('0x2'));var db=require(_0x3bc0('0x3'))['db'];var utils=require(_0x3bc0('0x4'));var logger=require(_0x3bc0('0x5'))(_0x3bc0('0x6'));var config=require(_0x3bc0('0x7'));var jayson=require(_0x3bc0('0x8'));var client=jayson[_0x3bc0('0x9')][_0x3bc0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4592fb,_0x5504bc,_0x28e9ef){return new BPromise(function(_0xcf0656,_0x3d99b9){return client[_0x3bc0('0xb')](_0x4592fb,_0x28e9ef)[_0x3bc0('0xc')](function(_0x47face){logger[_0x3bc0('0xd')]('SquareRecording,\x20%s,\x20%s',_0x5504bc,_0x3bc0('0xe'));logger[_0x3bc0('0xf')](_0x3bc0('0x10'),_0x5504bc,_0x3bc0('0xe'),JSON[_0x3bc0('0x11')](_0x47face));if(_0x47face['error']){if(_0x47face['error'][_0x3bc0('0x12')]===0x1f4){logger['error'](_0x3bc0('0x13'),_0x5504bc,_0x47face['error']['message']);return _0x3d99b9(_0x47face[_0x3bc0('0x14')][_0x3bc0('0x15')]);}logger[_0x3bc0('0x14')]('SquareRecording,\x20%s,\x20%s',_0x5504bc,_0x47face[_0x3bc0('0x14')]['message']);return _0xcf0656(_0x47face[_0x3bc0('0x14')][_0x3bc0('0x15')]);}else{logger[_0x3bc0('0xd')]('SquareRecording,\x20%s,\x20%s',_0x5504bc,_0x3bc0('0xe'));_0xcf0656(_0x47face[_0x3bc0('0x16')]['message']);}})['catch'](function(_0x13a5b9){logger[_0x3bc0('0x14')](_0x3bc0('0x13'),_0x5504bc,_0x13a5b9);_0x3d99b9(_0x13a5b9);});});}exports[_0x3bc0('0x17')]=function(_0x13669b){var _0x17968d=this;return new Promise(function(_0x248911,_0x46721f){return db[_0x3bc0('0x18')][_0x3bc0('0x19')](_0x13669b[_0x3bc0('0x1a')],{'raw':_0x13669b[_0x3bc0('0x1b')]?_0x13669b[_0x3bc0('0x1b')][_0x3bc0('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x2cd17a){logger['info'](_0x3bc0('0x17'),_0x13669b);logger[_0x3bc0('0xf')]('CreateSquareRecording',_0x13669b,JSON[_0x3bc0('0x11')](_0x2cd17a));_0x248911(_0x2cd17a);})['catch'](function(_0x2f51ba){logger[_0x3bc0('0x14')](_0x3bc0('0x17'),_0x2f51ba[_0x3bc0('0x15')],_0x13669b);_0x46721f(_0x17968d[_0x3bc0('0x14')](0x1f4,_0x2f51ba[_0x3bc0('0x15')]));});});}; \ No newline at end of file +var _0xd0cd=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','SquareRecording','create','options','CreateSquareRecording','lodash'];(function(_0x4b0060,_0x4bab37){var _0x13b9af=function(_0x347cbe){while(--_0x347cbe){_0x4b0060['push'](_0x4b0060['shift']());}};_0x13b9af(++_0x4bab37);}(_0xd0cd,0xa1));var _0xdd0c=function(_0xd299c3,_0x4ba0f1){_0xd299c3=_0xd299c3-0x0;var _0x376574=_0xd0cd[_0xd299c3];return _0x376574;};'use strict';var _=require(_0xdd0c('0x0'));var util=require('util');var moment=require(_0xdd0c('0x1'));var BPromise=require(_0xdd0c('0x2'));var rs=require(_0xdd0c('0x3'));var fs=require('fs');var Redis=require(_0xdd0c('0x4'));var db=require(_0xdd0c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xdd0c('0x6'))(_0xdd0c('0x7'));var config=require(_0xdd0c('0x8'));var jayson=require(_0xdd0c('0x9'));var client=jayson[_0xdd0c('0xa')][_0xdd0c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x497e74,_0x553b57,_0x1c04df){return new BPromise(function(_0x58dd49,_0x1ac621){return client['request'](_0x497e74,_0x1c04df)[_0xdd0c('0xc')](function(_0x30ce22){logger[_0xdd0c('0xd')](_0xdd0c('0xe'),_0x553b57,_0xdd0c('0xf'));logger[_0xdd0c('0x10')]('SquareRecording,\x20%s,\x20%s,\x20%s',_0x553b57,'request\x20sent',JSON[_0xdd0c('0x11')](_0x30ce22));if(_0x30ce22[_0xdd0c('0x12')]){if(_0x30ce22['error'][_0xdd0c('0x13')]===0x1f4){logger[_0xdd0c('0x12')]('SquareRecording,\x20%s,\x20%s',_0x553b57,_0x30ce22[_0xdd0c('0x12')]['message']);return _0x1ac621(_0x30ce22[_0xdd0c('0x12')]['message']);}logger[_0xdd0c('0x12')](_0xdd0c('0xe'),_0x553b57,_0x30ce22[_0xdd0c('0x12')][_0xdd0c('0x14')]);return _0x58dd49(_0x30ce22[_0xdd0c('0x12')][_0xdd0c('0x14')]);}else{logger[_0xdd0c('0xd')](_0xdd0c('0xe'),_0x553b57,_0xdd0c('0xf'));_0x58dd49(_0x30ce22[_0xdd0c('0x15')][_0xdd0c('0x14')]);}})[_0xdd0c('0x16')](function(_0x47a528){logger['error']('SquareRecording,\x20%s,\x20%s',_0x553b57,_0x47a528);_0x1ac621(_0x47a528);});});}exports['CreateSquareRecording']=function(_0x250387){var _0x170fbd=this;return new Promise(function(_0x1db103,_0x27aded){return db[_0xdd0c('0x17')][_0xdd0c('0x18')](_0x250387['body'],{'raw':_0x250387[_0xdd0c('0x19')]?_0x250387['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x4161cc){logger[_0xdd0c('0xd')](_0xdd0c('0x1a'),_0x250387);logger['debug'](_0xdd0c('0x1a'),_0x250387,JSON[_0xdd0c('0x11')](_0x4161cc));_0x1db103(_0x4161cc);})[_0xdd0c('0x16')](function(_0x321822){logger[_0xdd0c('0x12')](_0xdd0c('0x1a'),_0x321822[_0xdd0c('0x14')],_0x250387);_0x27aded(_0x170fbd[_0xdd0c('0x12')](0x1f4,_0x321822[_0xdd0c('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index d3d7902..f052a5b 100644 --- a/server/api/squareReport/index.js +++ b/server/api/squareReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['/describe','describe','/:id','show','post','create','put','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index'];(function(_0x701a2b,_0x27df5d){var _0x1978ad=function(_0x36ee96){while(--_0x36ee96){_0x701a2b['push'](_0x701a2b['shift']());}};_0x1978ad(++_0x27df5d);}(_0xe706,0xa3));var _0x6e70=function(_0x470711,_0x415ae0){_0x470711=_0x470711-0x0;var _0x33b3aa=_0xe706[_0x470711];return _0x33b3aa;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0x12')]);router[_0x6e70('0x13')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller['update']);router['delete'](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x14')]);module[_0x6e70('0x15')]=router; \ No newline at end of file +var _0xe706=['/describe','describe','/:id','show','post','create','put','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index'];(function(_0x1d99cc,_0x1a99c7){var _0x546595=function(_0x465b0e){while(--_0x465b0e){_0x1d99cc['push'](_0x1d99cc['shift']());}};_0x546595(++_0x1a99c7);}(_0xe706,0xa3));var _0x6e70=function(_0x4a310d,_0x33322d){_0x4a310d=_0x4a310d-0x0;var _0x5eaf36=_0xe706[_0x4a310d];return _0x5eaf36;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0x12')]);router[_0x6e70('0x13')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller['update']);router['delete'](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x14')]);module[_0x6e70('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index e4909db..1875bea 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 _0x6c1d=['STRING','sequelize','exports'];(function(_0x4d260e,_0x348f4c){var _0x3aeda5=function(_0x487301){while(--_0x487301){_0x4d260e['push'](_0x4d260e['shift']());}};_0x3aeda5(++_0x348f4c);}(_0x6c1d,0x124));var _0xd6c1=function(_0x127e88,_0x5042c6){_0x127e88=_0x127e88-0x0;var _0x4a4b68=_0x6c1d[_0x127e88];return _0x4a4b68;};'use strict';var Sequelize=require(_0xd6c1('0x0'));module[_0xd6c1('0x1')]={'network':{'type':Sequelize[_0xd6c1('0x2')]},'network_script':{'type':Sequelize[_0xd6c1('0x2')]},'request':{'type':Sequelize[_0xd6c1('0x2')]},'channel':{'type':Sequelize[_0xd6c1('0x2')]},'language':{'type':Sequelize[_0xd6c1('0x2')]},'type':{'type':Sequelize[_0xd6c1('0x2')]},'uniqueid':{'type':Sequelize[_0xd6c1('0x2')]},'version':{'type':Sequelize[_0xd6c1('0x2')]},'callerid':{'type':Sequelize[_0xd6c1('0x2')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize[_0xd6c1('0x2')]},'callingani2':{'type':Sequelize[_0xd6c1('0x2')]},'callington':{'type':Sequelize[_0xd6c1('0x2')]},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0xd6c1('0x2')]},'rdnis':{'type':Sequelize[_0xd6c1('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0xd6c1('0x2')]},'priority':{'type':Sequelize[_0xd6c1('0x2')]},'enhanced':{'type':Sequelize[_0xd6c1('0x2')]},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize[_0xd6c1('0x2')]},'project_name':{'type':Sequelize[_0xd6c1('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xaa83=['DATE','BOOLEAN','sequelize','exports','STRING'];(function(_0x372b38,_0xe55918){var _0x5d2186=function(_0xfafe7d){while(--_0xfafe7d){_0x372b38['push'](_0x372b38['shift']());}};_0x5d2186(++_0xe55918);}(_0xaa83,0x16a));var _0x3aa8=function(_0x2faf54,_0x12159a){_0x2faf54=_0x2faf54-0x0;var _0x27a3b6=_0xaa83[_0x2faf54];return _0x27a3b6;};'use strict';var Sequelize=require(_0x3aa8('0x0'));module[_0x3aa8('0x1')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0x3aa8('0x2')]},'request':{'type':Sequelize[_0x3aa8('0x2')]},'channel':{'type':Sequelize[_0x3aa8('0x2')]},'language':{'type':Sequelize[_0x3aa8('0x2')]},'type':{'type':Sequelize[_0x3aa8('0x2')]},'uniqueid':{'type':Sequelize[_0x3aa8('0x2')]},'version':{'type':Sequelize[_0x3aa8('0x2')]},'callerid':{'type':Sequelize[_0x3aa8('0x2')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0x3aa8('0x2')]},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize[_0x3aa8('0x2')]},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize[_0x3aa8('0x2')]},'context':{'type':Sequelize[_0x3aa8('0x2')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize[_0x3aa8('0x2')]},'accountcode':{'type':Sequelize[_0x3aa8('0x2')]},'threadid':{'type':Sequelize[_0x3aa8('0x2')]},'project_name':{'type':Sequelize[_0x3aa8('0x2')]},'joinAt':{'type':Sequelize[_0x3aa8('0x3')]},'leaveAt':{'type':Sequelize[_0x3aa8('0x3')]},'bot':{'type':Sequelize[_0x3aa8('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 ae744b7..1962c56 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 _0x3db9=['request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','Content-Range','json','apply','reject','save','update','destroy','then','stack','name','send','index','map','SquareReport','rawAttributes','type','key','model','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','include','findAll','rows','show','params','catch','create','body','find','describe','eml-format','rimraf','fast-json-patch'];(function(_0x5763e6,_0x48de82){var _0x5db34f=function(_0x3cd824){while(--_0x3cd824){_0x5763e6['push'](_0x5763e6['shift']());}};_0x5db34f(++_0x48de82);}(_0x3db9,0x8f));var _0x93db=function(_0x1d83a2,_0x2921d5){_0x1d83a2=_0x1d83a2-0x0;var _0x353203=_0x3db9[_0x1d83a2];return _0x353203;};'use strict';var emlformat=require(_0x93db('0x0'));var rimraf=require(_0x93db('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x93db('0x2'));var rp=require(_0x93db('0x3'));var moment=require(_0x93db('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x93db('0x5'));var path=require(_0x93db('0x6'));var sox=require(_0x93db('0x7'));var csv=require(_0x93db('0x8'));var ejs=require(_0x93db('0x9'));var fs=require('fs');var fs_extra=require(_0x93db('0xa'));var _=require(_0x93db('0xb'));var squel=require(_0x93db('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x93db('0xd'));var toCsv=require(_0x93db('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x93db('0xe'));var authService=require(_0x93db('0xf'));var qs=require(_0x93db('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x93db('0x11'));var logger=require(_0x93db('0x12'))(_0x93db('0x13'));var utils=require(_0x93db('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x93db('0x15'));var db=require(_0x93db('0x16'))['db'];function respondWithStatusCode(_0x3989ec,_0x2e8768){_0x2e8768=_0x2e8768||0xcc;return function(_0x4b80ce){if(_0x4b80ce){return _0x3989ec[_0x93db('0x17')](_0x2e8768);}return _0x3989ec[_0x93db('0x18')](_0x2e8768)[_0x93db('0x19')]();};}function respondWithResult(_0xfcfd81,_0x4a8af3){_0x4a8af3=_0x4a8af3||0xc8;return function(_0x1c1b87){if(_0x1c1b87){return _0xfcfd81[_0x93db('0x18')](_0x4a8af3)['json'](_0x1c1b87);}};}function respondWithFilteredResult(_0x368506,_0x5bf442){return function(_0x4b7e58){if(_0x4b7e58){var _0x2f7dd0=typeof _0x5bf442[_0x93db('0x1a')]===_0x93db('0x1b')&&typeof _0x5bf442['limit']===_0x93db('0x1b');var _0x263ed2=_0x4b7e58[_0x93db('0x1c')];var _0x266a8f=_0x2f7dd0?0x0:_0x5bf442[_0x93db('0x1a')];var _0x2e958d=_0x2f7dd0?_0x4b7e58[_0x93db('0x1c')]:_0x5bf442[_0x93db('0x1a')]+_0x5bf442[_0x93db('0x1d')];var _0xa4bd0e;if(_0x2e958d>=_0x263ed2){_0x2e958d=_0x263ed2;_0xa4bd0e=0xc8;}else{_0xa4bd0e=0xce;}_0x368506[_0x93db('0x18')](_0xa4bd0e);return _0x368506['set'](_0x93db('0x1e'),_0x266a8f+'-'+_0x2e958d+'/'+_0x263ed2)[_0x93db('0x1f')](_0x4b7e58);}return null;};}function patchUpdates(_0x126d8e){return function(_0x3bbf98){try{jsonpatch[_0x93db('0x20')](_0x3bbf98,_0x126d8e,!![]);}catch(_0x169088){return BPromise[_0x93db('0x21')](_0x169088);}return _0x3bbf98[_0x93db('0x22')]();};}function saveUpdates(_0x5aa6c2,_0x343965){return function(_0x552625){if(_0x552625){return _0x552625[_0x93db('0x23')](_0x5aa6c2)['then'](function(_0x3a762f){return _0x3a762f;});}return null;};}function removeEntity(_0x24f136,_0x57fba3){return function(_0x2ec92f){if(_0x2ec92f){return _0x2ec92f[_0x93db('0x24')]()[_0x93db('0x25')](function(){_0x24f136[_0x93db('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ea2e8,_0x493194){return function(_0x37086b){if(!_0x37086b){_0x2ea2e8[_0x93db('0x17')](0x194);}return _0x37086b;};}function handleError(_0x222a49,_0x2f9f87){_0x2f9f87=_0x2f9f87||0x1f4;return function(_0x20ebfd){logger['error'](_0x20ebfd[_0x93db('0x26')]);if(_0x20ebfd['name']){delete _0x20ebfd[_0x93db('0x27')];}_0x222a49['status'](_0x2f9f87)[_0x93db('0x28')](_0x20ebfd);};}exports[_0x93db('0x29')]=function(_0x49d534,_0x466f43){var _0x49171e={},_0x5d892a={},_0x1c41d4={'count':0x0,'rows':[]};var _0x49878f=_[_0x93db('0x2a')](db[_0x93db('0x2b')][_0x93db('0x2c')],function(_0x47dd29){return{'name':_0x47dd29['fieldName'],'type':_0x47dd29[_0x93db('0x2d')][_0x93db('0x2e')]};});_0x5d892a[_0x93db('0x2f')]=_['map'](_0x49878f,_0x93db('0x27'));_0x5d892a[_0x93db('0x30')]=_[_0x93db('0x31')](_0x49d534[_0x93db('0x30')]);_0x5d892a[_0x93db('0x32')]=_[_0x93db('0x33')](_0x5d892a[_0x93db('0x2f')],_0x5d892a[_0x93db('0x30')]);_0x49171e['attributes']=_[_0x93db('0x33')](_0x5d892a['model'],qs[_0x93db('0x34')](_0x49d534[_0x93db('0x30')][_0x93db('0x34')]));_0x49171e['attributes']=_0x49171e['attributes'][_0x93db('0x35')]?_0x49171e[_0x93db('0x36')]:_0x5d892a[_0x93db('0x2f')];if(!_0x49d534['query'][_0x93db('0x37')](_0x93db('0x38'))){_0x49171e[_0x93db('0x1d')]=qs[_0x93db('0x1d')](_0x49d534[_0x93db('0x30')][_0x93db('0x1d')]);_0x49171e[_0x93db('0x1a')]=qs[_0x93db('0x1a')](_0x49d534[_0x93db('0x30')]['offset']);}_0x49171e[_0x93db('0x39')]=qs[_0x93db('0x3a')](_0x49d534['query'][_0x93db('0x3a')]);_0x49171e['where']=qs[_0x93db('0x32')](_['pick'](_0x49d534['query'],_0x5d892a[_0x93db('0x32')]),_0x49878f);if(_0x49d534['query']['filter']){_0x49171e[_0x93db('0x3b')]=_[_0x93db('0x3c')](_0x49171e[_0x93db('0x3b')],{'$or':_[_0x93db('0x2a')](_0x49878f,function(_0xbacc53){if(_0xbacc53['type']!==_0x93db('0x3d')){var _0x27ae06={};_0x27ae06[_0xbacc53[_0x93db('0x27')]]={'$like':'%'+_0x49d534['query'][_0x93db('0x3e')]+'%'};return _0x27ae06;}})});}_0x49171e=_[_0x93db('0x3c')]({},_0x49171e,_0x49d534['options']);var _0x2d8b2b={'where':_0x49171e[_0x93db('0x3b')]};return db[_0x93db('0x2b')][_0x93db('0x1c')](_0x2d8b2b)['then'](function(_0x3ff7e1){_0x1c41d4[_0x93db('0x1c')]=_0x3ff7e1;if(_0x49d534[_0x93db('0x30')]['includeAll']){_0x49171e[_0x93db('0x3f')]=[{'all':!![]}];}return db[_0x93db('0x2b')][_0x93db('0x40')](_0x49171e);})[_0x93db('0x25')](function(_0x3696fb){_0x1c41d4[_0x93db('0x41')]=_0x3696fb;return _0x1c41d4;})['then'](respondWithFilteredResult(_0x466f43,_0x49171e))['catch'](handleError(_0x466f43,null));};exports[_0x93db('0x42')]=function(_0x3fc913,_0x1f290b){var _0x2de6f8={'raw':!![],'where':{'id':_0x3fc913[_0x93db('0x43')]['id']}},_0x8bf35d={};_0x8bf35d[_0x93db('0x2f')]=_[_0x93db('0x31')](db[_0x93db('0x2b')][_0x93db('0x2c')]);_0x8bf35d[_0x93db('0x30')]=_[_0x93db('0x31')](_0x3fc913['query']);_0x8bf35d[_0x93db('0x32')]=_[_0x93db('0x33')](_0x8bf35d[_0x93db('0x2f')],_0x8bf35d['query']);_0x2de6f8[_0x93db('0x36')]=_[_0x93db('0x33')](_0x8bf35d['model'],qs[_0x93db('0x34')](_0x3fc913[_0x93db('0x30')][_0x93db('0x34')]));_0x2de6f8[_0x93db('0x36')]=_0x2de6f8[_0x93db('0x36')][_0x93db('0x35')]?_0x2de6f8['attributes']:_0x8bf35d['model'];if(_0x3fc913[_0x93db('0x30')]['includeAll']){_0x2de6f8[_0x93db('0x3f')]=[{'all':!![]}];}_0x2de6f8=_[_0x93db('0x3c')]({},_0x2de6f8,_0x3fc913['options']);return db[_0x93db('0x2b')]['find'](_0x2de6f8)[_0x93db('0x25')](handleEntityNotFound(_0x1f290b,null))[_0x93db('0x25')](respondWithResult(_0x1f290b,null))[_0x93db('0x44')](handleError(_0x1f290b,null));};exports[_0x93db('0x45')]=function(_0x544059,_0x2e3b9a){return db[_0x93db('0x2b')][_0x93db('0x45')](_0x544059[_0x93db('0x46')],{})[_0x93db('0x25')](respondWithResult(_0x2e3b9a,0xc9))[_0x93db('0x44')](handleError(_0x2e3b9a,null));};exports['update']=function(_0x38cba2,_0x2a5181){if(_0x38cba2[_0x93db('0x46')]['id']){delete _0x38cba2[_0x93db('0x46')]['id'];}return db[_0x93db('0x2b')][_0x93db('0x47')]({'where':{'id':_0x38cba2[_0x93db('0x43')]['id']}})[_0x93db('0x25')](handleEntityNotFound(_0x2a5181,null))['then'](saveUpdates(_0x38cba2['body'],null))[_0x93db('0x25')](respondWithResult(_0x2a5181,null))[_0x93db('0x44')](handleError(_0x2a5181,null));};exports[_0x93db('0x24')]=function(_0x1f068e,_0x43d194){return db[_0x93db('0x2b')][_0x93db('0x47')]({'where':{'id':_0x1f068e[_0x93db('0x43')]['id']}})[_0x93db('0x25')](handleEntityNotFound(_0x43d194,null))[_0x93db('0x25')](removeEntity(_0x43d194,null))[_0x93db('0x44')](handleError(_0x43d194,null));};exports[_0x93db('0x48')]=function(_0xd1e9dd,_0x9e3647){return db[_0x93db('0x2b')]['describe']()['then'](respondWithResult(_0x9e3647,null))[_0x93db('0x44')](handleError(_0x9e3647,null));}; \ No newline at end of file +var _0xe6ab=['fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','filter','VIRTUAL','name','merge','SquareReport','includeAll','show','rawAttributes','include','options','catch','create','body','params','find','describe','eml-format','zip-dir','request-promise','bluebird','mustache','util','sox','to-csv','fs-extra','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','set','Content-Range','json','apply','update','then','destroy','end','stack','index','fieldName','type','key','model','query','keys','filters','intersection'];(function(_0x396933,_0x3d3769){var _0x3455bf=function(_0xbedf0b){while(--_0xbedf0b){_0x396933['push'](_0x396933['shift']());}};_0x3455bf(++_0x3d3769);}(_0xe6ab,0x130));var _0xbe6a=function(_0xaa0156,_0x8ce7d4){_0xaa0156=_0xaa0156-0x0;var _0x1c02d7=_0xe6ab[_0xaa0156];return _0x1c02d7;};'use strict';var emlformat=require(_0xbe6a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbe6a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbe6a('0x2'));var moment=require('moment');var BPromise=require(_0xbe6a('0x3'));var Mustache=require(_0xbe6a('0x4'));var util=require(_0xbe6a('0x5'));var path=require('path');var sox=require(_0xbe6a('0x6'));var csv=require(_0xbe6a('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbe6a('0x8'));var _=require('lodash');var squel=require(_0xbe6a('0x9'));var crypto=require('crypto');var jsforce=require(_0xbe6a('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xbe6a('0x7'));var querystring=require(_0xbe6a('0xb'));var Papa=require('papaparse');var Redis=require(_0xbe6a('0xc'));var authService=require(_0xbe6a('0xd'));var qs=require(_0xbe6a('0xe'));var as=require(_0xbe6a('0xf'));var hardwareService=require(_0xbe6a('0x10'));var logger=require(_0xbe6a('0x11'))(_0xbe6a('0x12'));var utils=require(_0xbe6a('0x13'));var config=require(_0xbe6a('0x14'));var licenseUtil=require(_0xbe6a('0x15'));var db=require(_0xbe6a('0x16'))['db'];function respondWithStatusCode(_0x2328f8,_0xed75d9){_0xed75d9=_0xed75d9||0xcc;return function(_0x51d3b0){if(_0x51d3b0){return _0x2328f8[_0xbe6a('0x17')](_0xed75d9);}return _0x2328f8[_0xbe6a('0x18')](_0xed75d9)['end']();};}function respondWithResult(_0x55486b,_0x3f4b5b){_0x3f4b5b=_0x3f4b5b||0xc8;return function(_0x1acbd3){if(_0x1acbd3){return _0x55486b[_0xbe6a('0x18')](_0x3f4b5b)['json'](_0x1acbd3);}};}function respondWithFilteredResult(_0x1e613e,_0xcefc81){return function(_0x47b6c0){if(_0x47b6c0){var _0x1a6bbb=typeof _0xcefc81[_0xbe6a('0x19')]===_0xbe6a('0x1a')&&typeof _0xcefc81['limit']==='undefined';var _0x1c5000=_0x47b6c0['count'];var _0x172ee9=_0x1a6bbb?0x0:_0xcefc81[_0xbe6a('0x19')];var _0x40f7c5=_0x1a6bbb?_0x47b6c0[_0xbe6a('0x1b')]:_0xcefc81['offset']+_0xcefc81['limit'];var _0x3b8482;if(_0x40f7c5>=_0x1c5000){_0x40f7c5=_0x1c5000;_0x3b8482=0xc8;}else{_0x3b8482=0xce;}_0x1e613e['status'](_0x3b8482);return _0x1e613e[_0xbe6a('0x1c')](_0xbe6a('0x1d'),_0x172ee9+'-'+_0x40f7c5+'/'+_0x1c5000)[_0xbe6a('0x1e')](_0x47b6c0);}return null;};}function patchUpdates(_0x2d98a3){return function(_0x249f76){try{jsonpatch[_0xbe6a('0x1f')](_0x249f76,_0x2d98a3,!![]);}catch(_0x112632){return BPromise['reject'](_0x112632);}return _0x249f76['save']();};}function saveUpdates(_0x289141,_0x574ad6){return function(_0x418e23){if(_0x418e23){return _0x418e23[_0xbe6a('0x20')](_0x289141)[_0xbe6a('0x21')](function(_0x48a7e4){return _0x48a7e4;});}return null;};}function removeEntity(_0x53cd51,_0x48a7c9){return function(_0x19e718){if(_0x19e718){return _0x19e718[_0xbe6a('0x22')]()[_0xbe6a('0x21')](function(){_0x53cd51[_0xbe6a('0x18')](0xcc)[_0xbe6a('0x23')]();});}};}function handleEntityNotFound(_0x1d5628,_0x52dc80){return function(_0x28b329){if(!_0x28b329){_0x1d5628[_0xbe6a('0x17')](0x194);}return _0x28b329;};}function handleError(_0x523822,_0x4bcf5a){_0x4bcf5a=_0x4bcf5a||0x1f4;return function(_0x3c6856){logger['error'](_0x3c6856[_0xbe6a('0x24')]);if(_0x3c6856['name']){delete _0x3c6856['name'];}_0x523822[_0xbe6a('0x18')](_0x4bcf5a)['send'](_0x3c6856);};}exports[_0xbe6a('0x25')]=function(_0x4ef6b5,_0x2afdb5){var _0x345581={},_0x312da3={},_0x1f3781={'count':0x0,'rows':[]};var _0x320fc4=_['map'](db['SquareReport']['rawAttributes'],function(_0x17249c){return{'name':_0x17249c[_0xbe6a('0x26')],'type':_0x17249c[_0xbe6a('0x27')][_0xbe6a('0x28')]};});_0x312da3[_0xbe6a('0x29')]=_['map'](_0x320fc4,'name');_0x312da3[_0xbe6a('0x2a')]=_[_0xbe6a('0x2b')](_0x4ef6b5['query']);_0x312da3[_0xbe6a('0x2c')]=_[_0xbe6a('0x2d')](_0x312da3[_0xbe6a('0x29')],_0x312da3[_0xbe6a('0x2a')]);_0x345581['attributes']=_[_0xbe6a('0x2d')](_0x312da3['model'],qs['fields'](_0x4ef6b5[_0xbe6a('0x2a')][_0xbe6a('0x2e')]));_0x345581[_0xbe6a('0x2f')]=_0x345581[_0xbe6a('0x2f')][_0xbe6a('0x30')]?_0x345581[_0xbe6a('0x2f')]:_0x312da3[_0xbe6a('0x29')];if(!_0x4ef6b5[_0xbe6a('0x2a')][_0xbe6a('0x31')](_0xbe6a('0x32'))){_0x345581[_0xbe6a('0x33')]=qs[_0xbe6a('0x33')](_0x4ef6b5[_0xbe6a('0x2a')][_0xbe6a('0x33')]);_0x345581[_0xbe6a('0x19')]=qs[_0xbe6a('0x19')](_0x4ef6b5[_0xbe6a('0x2a')][_0xbe6a('0x19')]);}_0x345581['order']=qs[_0xbe6a('0x34')](_0x4ef6b5[_0xbe6a('0x2a')][_0xbe6a('0x34')]);_0x345581[_0xbe6a('0x35')]=qs['filters'](_['pick'](_0x4ef6b5[_0xbe6a('0x2a')],_0x312da3[_0xbe6a('0x2c')]),_0x320fc4);if(_0x4ef6b5[_0xbe6a('0x2a')][_0xbe6a('0x36')]){_0x345581[_0xbe6a('0x35')]=_['merge'](_0x345581['where'],{'$or':_['map'](_0x320fc4,function(_0x1802b2){if(_0x1802b2[_0xbe6a('0x27')]!==_0xbe6a('0x37')){var _0x27a4eb={};_0x27a4eb[_0x1802b2[_0xbe6a('0x38')]]={'$like':'%'+_0x4ef6b5['query'][_0xbe6a('0x36')]+'%'};return _0x27a4eb;}})});}_0x345581=_[_0xbe6a('0x39')]({},_0x345581,_0x4ef6b5['options']);var _0x15fa2b={'where':_0x345581[_0xbe6a('0x35')]};return db[_0xbe6a('0x3a')]['count'](_0x15fa2b)[_0xbe6a('0x21')](function(_0x380828){_0x1f3781[_0xbe6a('0x1b')]=_0x380828;if(_0x4ef6b5[_0xbe6a('0x2a')][_0xbe6a('0x3b')]){_0x345581['include']=[{'all':!![]}];}return db[_0xbe6a('0x3a')]['findAll'](_0x345581);})[_0xbe6a('0x21')](function(_0x2ff133){_0x1f3781['rows']=_0x2ff133;return _0x1f3781;})[_0xbe6a('0x21')](respondWithFilteredResult(_0x2afdb5,_0x345581))['catch'](handleError(_0x2afdb5,null));};exports[_0xbe6a('0x3c')]=function(_0x30f069,_0x294b26){var _0x3643fa={'raw':!![],'where':{'id':_0x30f069['params']['id']}},_0xa54027={};_0xa54027['model']=_['keys'](db[_0xbe6a('0x3a')][_0xbe6a('0x3d')]);_0xa54027[_0xbe6a('0x2a')]=_[_0xbe6a('0x2b')](_0x30f069[_0xbe6a('0x2a')]);_0xa54027[_0xbe6a('0x2c')]=_[_0xbe6a('0x2d')](_0xa54027[_0xbe6a('0x29')],_0xa54027[_0xbe6a('0x2a')]);_0x3643fa['attributes']=_[_0xbe6a('0x2d')](_0xa54027['model'],qs[_0xbe6a('0x2e')](_0x30f069[_0xbe6a('0x2a')][_0xbe6a('0x2e')]));_0x3643fa['attributes']=_0x3643fa['attributes'][_0xbe6a('0x30')]?_0x3643fa[_0xbe6a('0x2f')]:_0xa54027[_0xbe6a('0x29')];if(_0x30f069[_0xbe6a('0x2a')][_0xbe6a('0x3b')]){_0x3643fa[_0xbe6a('0x3e')]=[{'all':!![]}];}_0x3643fa=_['merge']({},_0x3643fa,_0x30f069[_0xbe6a('0x3f')]);return db[_0xbe6a('0x3a')]['find'](_0x3643fa)[_0xbe6a('0x21')](handleEntityNotFound(_0x294b26,null))[_0xbe6a('0x21')](respondWithResult(_0x294b26,null))[_0xbe6a('0x40')](handleError(_0x294b26,null));};exports[_0xbe6a('0x41')]=function(_0x1893e1,_0x4b3ea8){return db[_0xbe6a('0x3a')][_0xbe6a('0x41')](_0x1893e1[_0xbe6a('0x42')],{})[_0xbe6a('0x21')](respondWithResult(_0x4b3ea8,0xc9))[_0xbe6a('0x40')](handleError(_0x4b3ea8,null));};exports[_0xbe6a('0x20')]=function(_0x30a37e,_0x3ad895){if(_0x30a37e[_0xbe6a('0x42')]['id']){delete _0x30a37e[_0xbe6a('0x42')]['id'];}return db['SquareReport']['find']({'where':{'id':_0x30a37e[_0xbe6a('0x43')]['id']}})[_0xbe6a('0x21')](handleEntityNotFound(_0x3ad895,null))[_0xbe6a('0x21')](saveUpdates(_0x30a37e[_0xbe6a('0x42')],null))['then'](respondWithResult(_0x3ad895,null))[_0xbe6a('0x40')](handleError(_0x3ad895,null));};exports[_0xbe6a('0x22')]=function(_0x5b725f,_0x2bea05){return db[_0xbe6a('0x3a')][_0xbe6a('0x44')]({'where':{'id':_0x5b725f[_0xbe6a('0x43')]['id']}})[_0xbe6a('0x21')](handleEntityNotFound(_0x2bea05,null))[_0xbe6a('0x21')](removeEntity(_0x2bea05,null))[_0xbe6a('0x40')](handleError(_0x2bea05,null));};exports['describe']=function(_0x190066,_0x232bb9){return db[_0xbe6a('0x3a')][_0xbe6a('0x45')]()[_0xbe6a('0x21')](respondWithResult(_0x232bb9,null))['catch'](handleError(_0x232bb9,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index abcdf8e..c424ba2 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 _0x11c3=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','report_square','uid_pname','uniqueid','leaveAt','lodash'];(function(_0x56cb90,_0x2ea91e){var _0x4187e6=function(_0x3911fc){while(--_0x3911fc){_0x56cb90['push'](_0x56cb90['shift']());}};_0x4187e6(++_0x2ea91e);}(_0x11c3,0x167));var _0x311c=function(_0xd49f1d,_0x289c27){_0xd49f1d=_0xd49f1d-0x0;var _0x49dd4b=_0x11c3[_0xd49f1d];return _0x49dd4b;};'use strict';var _=require(_0x311c('0x0'));var util=require(_0x311c('0x1'));var logger=require(_0x311c('0x2'))(_0x311c('0x3'));var moment=require(_0x311c('0x4'));var BPromise=require(_0x311c('0x5'));var rp=require(_0x311c('0x6'));var fs=require('fs');var path=require(_0x311c('0x7'));var rimraf=require(_0x311c('0x8'));var config=require(_0x311c('0x9'));var attributes=require('./squareReport.attributes');module[_0x311c('0xa')]=function(_0xda4ce9,_0x53e2ee){return _0xda4ce9['define']('SquareReport',attributes,{'tableName':_0x311c('0xb'),'paranoid':![],'indexes':[{'name':_0x311c('0xc'),'fields':[_0x311c('0xd'),'project_name']},{'name':_0x311c('0xe'),'fields':[_0x311c('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdba9=['report_square','uniqueid','project_name','leaveAt','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./squareReport.attributes','define','SquareReport'];(function(_0x12ef39,_0x18d320){var _0x47a734=function(_0x112dcf){while(--_0x112dcf){_0x12ef39['push'](_0x12ef39['shift']());}};_0x47a734(++_0x18d320);}(_0xdba9,0xd4));var _0x9dba=function(_0x21b359,_0x4dc80e){_0x21b359=_0x21b359-0x0;var _0x57b8e7=_0xdba9[_0x21b359];return _0x57b8e7;};'use strict';var _=require(_0x9dba('0x0'));var util=require(_0x9dba('0x1'));var logger=require(_0x9dba('0x2'))(_0x9dba('0x3'));var moment=require(_0x9dba('0x4'));var BPromise=require('bluebird');var rp=require(_0x9dba('0x5'));var fs=require('fs');var path=require(_0x9dba('0x6'));var rimraf=require(_0x9dba('0x7'));var config=require(_0x9dba('0x8'));var attributes=require(_0x9dba('0x9'));module['exports']=function(_0x1f32a8,_0x3fc37e){return _0x1f32a8[_0x9dba('0xa')](_0x9dba('0xb'),attributes,{'tableName':_0x9dba('0xc'),'paranoid':![],'indexes':[{'name':'uid_pname','fields':[_0x9dba('0xd'),_0x9dba('0xe')]},{'name':_0x9dba('0xf'),'fields':[_0x9dba('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 66ad3af..565b263 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 _0xef22=['../../config/environment','client','http','request','then','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','SquareReport','body','options','info','CreateSquareReport','catch','UpdateSquareReport','update','raw','where','attributes','limit','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x51c726,_0x332b95){var _0x23fe86=function(_0x3145c8){while(--_0x3145c8){_0x51c726['push'](_0x51c726['shift']());}};_0x23fe86(++_0x332b95);}(_0xef22,0x164));var _0x2ef2=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xef22[_0x92c450];return _0x2a9599;};'use strict';var _=require(_0x2ef2('0x0'));var util=require(_0x2ef2('0x1'));var moment=require('moment');var BPromise=require(_0x2ef2('0x2'));var rs=require(_0x2ef2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2ef2('0x4'))['db'];var utils=require(_0x2ef2('0x5'));var logger=require(_0x2ef2('0x6'))('rpc');var config=require(_0x2ef2('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x2ef2('0x8')][_0x2ef2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3776dc,_0x3aea38,_0x1496a5){return new BPromise(function(_0x3864e9,_0x4d5000){return client[_0x2ef2('0xa')](_0x3776dc,_0x1496a5)[_0x2ef2('0xb')](function(_0x44bbd8){logger['info'](_0x2ef2('0xc'),_0x3aea38,_0x2ef2('0xd'));logger[_0x2ef2('0xe')](_0x2ef2('0xf'),_0x3aea38,_0x2ef2('0xd'),JSON[_0x2ef2('0x10')](_0x44bbd8));if(_0x44bbd8[_0x2ef2('0x11')]){if(_0x44bbd8['error'][_0x2ef2('0x12')]===0x1f4){logger[_0x2ef2('0x11')](_0x2ef2('0xc'),_0x3aea38,_0x44bbd8[_0x2ef2('0x11')][_0x2ef2('0x13')]);return _0x4d5000(_0x44bbd8[_0x2ef2('0x11')][_0x2ef2('0x13')]);}logger['error'](_0x2ef2('0xc'),_0x3aea38,_0x44bbd8[_0x2ef2('0x11')]['message']);return _0x3864e9(_0x44bbd8[_0x2ef2('0x11')][_0x2ef2('0x13')]);}else{logger['info'](_0x2ef2('0xc'),_0x3aea38,'request\x20sent');_0x3864e9(_0x44bbd8[_0x2ef2('0x14')][_0x2ef2('0x13')]);}})['catch'](function(_0x2f75b8){logger[_0x2ef2('0x11')]('SquareReport,\x20%s,\x20%s',_0x3aea38,_0x2f75b8);_0x4d5000(_0x2f75b8);});});}exports['CreateSquareReport']=function(_0x74ba7c){var _0x534da4=this;return new Promise(function(_0x5a4ef4,_0x2835ab){return db[_0x2ef2('0x15')]['create'](_0x74ba7c[_0x2ef2('0x16')],{'raw':_0x74ba7c[_0x2ef2('0x17')]?_0x74ba7c['options']['raw']===undefined?!![]:![]:!![]})[_0x2ef2('0xb')](function(_0x9312e6){logger[_0x2ef2('0x18')]('CreateSquareReport',_0x74ba7c);logger[_0x2ef2('0xe')](_0x2ef2('0x19'),_0x74ba7c,JSON[_0x2ef2('0x10')](_0x9312e6));_0x5a4ef4(_0x9312e6);})[_0x2ef2('0x1a')](function(_0x44db64){logger[_0x2ef2('0x11')](_0x2ef2('0x19'),_0x44db64['message'],_0x74ba7c);_0x2835ab(_0x534da4['error'](0x1f4,_0x44db64[_0x2ef2('0x13')]));});});};exports[_0x2ef2('0x1b')]=function(_0x541cb5){var _0x50572e=this;return new Promise(function(_0x1c2fb3,_0x3a7d45){return db['SquareReport'][_0x2ef2('0x1c')](_0x541cb5[_0x2ef2('0x16')],{'raw':_0x541cb5[_0x2ef2('0x17')]?_0x541cb5[_0x2ef2('0x17')][_0x2ef2('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x541cb5[_0x2ef2('0x17')]?_0x541cb5[_0x2ef2('0x17')][_0x2ef2('0x1e')]||null:null,'attributes':_0x541cb5[_0x2ef2('0x17')]?_0x541cb5['options'][_0x2ef2('0x1f')]||null:null,'limit':_0x541cb5[_0x2ef2('0x17')]?_0x541cb5[_0x2ef2('0x17')][_0x2ef2('0x20')]||null:null})['then'](function(_0x36abd0){logger['info']('UpdateSquareReport',_0x541cb5);logger['debug'](_0x2ef2('0x1b'),_0x541cb5,JSON['stringify'](_0x36abd0));_0x1c2fb3(_0x36abd0);})['catch'](function(_0x2e5c06){logger[_0x2ef2('0x11')]('UpdateSquareReport',_0x2e5c06['message'],_0x541cb5);_0x3a7d45(_0x50572e[_0x2ef2('0x11')](0x1f4,_0x2e5c06[_0x2ef2('0x13')]));});});}; \ No newline at end of file +var _0x71f7=['stringify','error','message','info','result','catch','CreateSquareReport','SquareReport','create','options','raw','update','where','UpdateSquareReport','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','SquareReport,\x20%s,\x20%s','debug','SquareReport,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x537674,_0x2f9372){var _0x3f0e86=function(_0x1a1aa8){while(--_0x1a1aa8){_0x537674['push'](_0x537674['shift']());}};_0x3f0e86(++_0x2f9372);}(_0x71f7,0xbc));var _0x771f=function(_0x14f305,_0x251207){_0x14f305=_0x14f305-0x0;var _0x447c35=_0x71f7[_0x14f305];return _0x447c35;};'use strict';var _=require('lodash');var util=require(_0x771f('0x0'));var moment=require(_0x771f('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x771f('0x2'));var db=require(_0x771f('0x3'))['db'];var utils=require(_0x771f('0x4'));var logger=require(_0x771f('0x5'))('rpc');var config=require(_0x771f('0x6'));var jayson=require(_0x771f('0x7'));var client=jayson[_0x771f('0x8')][_0x771f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x47d2bb,_0x458497,_0x5e386b){return new BPromise(function(_0x2a6a57,_0x3bddf9){return client['request'](_0x47d2bb,_0x5e386b)[_0x771f('0xa')](function(_0x44710d){logger['info'](_0x771f('0xb'),_0x458497,'request\x20sent');logger[_0x771f('0xc')](_0x771f('0xd'),_0x458497,_0x771f('0xe'),JSON[_0x771f('0xf')](_0x44710d));if(_0x44710d['error']){if(_0x44710d[_0x771f('0x10')]['code']===0x1f4){logger[_0x771f('0x10')](_0x771f('0xb'),_0x458497,_0x44710d[_0x771f('0x10')][_0x771f('0x11')]);return _0x3bddf9(_0x44710d['error'][_0x771f('0x11')]);}logger[_0x771f('0x10')]('SquareReport,\x20%s,\x20%s',_0x458497,_0x44710d[_0x771f('0x10')][_0x771f('0x11')]);return _0x2a6a57(_0x44710d[_0x771f('0x10')]['message']);}else{logger[_0x771f('0x12')]('SquareReport,\x20%s,\x20%s',_0x458497,_0x771f('0xe'));_0x2a6a57(_0x44710d[_0x771f('0x13')][_0x771f('0x11')]);}})[_0x771f('0x14')](function(_0x340066){logger[_0x771f('0x10')](_0x771f('0xb'),_0x458497,_0x340066);_0x3bddf9(_0x340066);});});}exports[_0x771f('0x15')]=function(_0x56154c){var _0x3816f0=this;return new Promise(function(_0x23bc9f,_0xb44a4c){return db[_0x771f('0x16')][_0x771f('0x17')](_0x56154c['body'],{'raw':_0x56154c[_0x771f('0x18')]?_0x56154c[_0x771f('0x18')][_0x771f('0x19')]===undefined?!![]:![]:!![]})[_0x771f('0xa')](function(_0x2af359){logger[_0x771f('0x12')](_0x771f('0x15'),_0x56154c);logger[_0x771f('0xc')](_0x771f('0x15'),_0x56154c,JSON['stringify'](_0x2af359));_0x23bc9f(_0x2af359);})['catch'](function(_0x3286de){logger['error'](_0x771f('0x15'),_0x3286de[_0x771f('0x11')],_0x56154c);_0xb44a4c(_0x3816f0['error'](0x1f4,_0x3286de[_0x771f('0x11')]));});});};exports['UpdateSquareReport']=function(_0xc8d298){var _0x1b3146=this;return new Promise(function(_0x4845d8,_0x4b48f1){return db[_0x771f('0x16')][_0x771f('0x1a')](_0xc8d298['body'],{'raw':_0xc8d298[_0x771f('0x18')]?_0xc8d298[_0x771f('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xc8d298[_0x771f('0x18')]?_0xc8d298['options'][_0x771f('0x1b')]||null:null,'attributes':_0xc8d298['options']?_0xc8d298[_0x771f('0x18')]['attributes']||null:null,'limit':_0xc8d298['options']?_0xc8d298[_0x771f('0x18')]['limit']||null:null})[_0x771f('0xa')](function(_0x3ced9b){logger[_0x771f('0x12')](_0x771f('0x1c'),_0xc8d298);logger[_0x771f('0xc')](_0x771f('0x1c'),_0xc8d298,JSON[_0x771f('0xf')](_0x3ced9b));_0x4845d8(_0x3ced9b);})[_0x771f('0x14')](function(_0x1f97be){logger[_0x771f('0x10')](_0x771f('0x1c'),_0x1f97be[_0x771f('0x11')],_0xc8d298);_0x4b48f1(_0x1b3146[_0x771f('0x10')](0x1f4,_0x1f97be['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index a839cdf..5c37b25 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 _0xefe5=['/describe','isAuthenticated','describe','show','post','create','put','/:id','update','exports','path','connect-timeout','../../components/auth/service','./squareReportDetail.controller','get'];(function(_0x24696b,_0x12de19){var _0x3f86b0=function(_0x11f2eb){while(--_0x11f2eb){_0x24696b['push'](_0x24696b['shift']());}};_0x3f86b0(++_0x12de19);}(_0xefe5,0xbe));var _0x5efe=function(_0x496d61,_0x365d4d){_0x496d61=_0x496d61-0x0;var _0x42bd8f=_0xefe5[_0x496d61];return _0x42bd8f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5efe('0x0'));var timeout=require(_0x5efe('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x5efe('0x2'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5efe('0x3'));router[_0x5efe('0x4')]('/',auth['isAuthenticated'](),controller['index']);router[_0x5efe('0x4')](_0x5efe('0x5'),auth[_0x5efe('0x6')](),controller[_0x5efe('0x7')]);router[_0x5efe('0x4')]('/:id',auth['isAuthenticated'](),controller[_0x5efe('0x8')]);router[_0x5efe('0x9')]('/',auth[_0x5efe('0x6')](),controller[_0x5efe('0xa')]);router[_0x5efe('0xb')](_0x5efe('0xc'),auth['isAuthenticated'](),controller[_0x5efe('0xd')]);router['delete'](_0x5efe('0xc'),auth[_0x5efe('0x6')](),controller['destroy']);module[_0x5efe('0xe')]=router; \ No newline at end of file +var _0x919a=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','post','put','update','delete','destroy','exports','multer','util','express','Router'];(function(_0x5c2cd5,_0x1c2fbb){var _0x5180e9=function(_0x12ceed){while(--_0x12ceed){_0x5c2cd5['push'](_0x5c2cd5['shift']());}};_0x5180e9(++_0x1c2fbb);}(_0x919a,0x100));var _0xa919=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x919a[_0x1cc8fe];return _0x230054;};'use strict';var multer=require(_0xa919('0x0'));var util=require(_0xa919('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa919('0x2'));var router=express[_0xa919('0x3')]();var fs_extra=require(_0xa919('0x4'));var auth=require(_0xa919('0x5'));var interaction=require(_0xa919('0x6'));var config=require(_0xa919('0x7'));var controller=require('./squareReportDetail.controller');router[_0xa919('0x8')]('/',auth[_0xa919('0x9')](),controller[_0xa919('0xa')]);router[_0xa919('0x8')]('/describe',auth[_0xa919('0x9')](),controller[_0xa919('0xb')]);router[_0xa919('0x8')](_0xa919('0xc'),auth[_0xa919('0x9')](),controller[_0xa919('0xd')]);router[_0xa919('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa919('0xf')](_0xa919('0xc'),auth[_0xa919('0x9')](),controller[_0xa919('0x10')]);router[_0xa919('0x11')](_0xa919('0xc'),auth['isAuthenticated'](),controller[_0xa919('0x12')]);module[_0xa919('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index a0fb194..f20dfe9 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 _0x4730=['STRING','TEXT'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x4730,0xde));var _0x0473=function(_0x57fc06,_0x127721){_0x57fc06=_0x57fc06-0x0;var _0x2162a9=_0x4730[_0x57fc06];return _0x2162a9;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize[_0x0473('0x0')]},'application':{'type':Sequelize[_0x0473('0x0')]},'data':{'type':Sequelize[_0x0473('0x1')]},'project_name':{'type':Sequelize[_0x0473('0x0')]},'callerid':{'type':Sequelize[_0x0473('0x0')]}}; \ No newline at end of file +var _0x0163=['sequelize','exports','STRING','TEXT'];(function(_0x45abe4,_0x2d08dc){var _0x59c8a7=function(_0x1139c2){while(--_0x1139c2){_0x45abe4['push'](_0x45abe4['shift']());}};_0x59c8a7(++_0x2d08dc);}(_0x0163,0xa4));var _0x3016=function(_0x97f563,_0x34e66c){_0x97f563=_0x97f563-0x0;var _0x143899=_0x0163[_0x97f563];return _0x143899;};'use strict';var Sequelize=require(_0x3016('0x0'));module[_0x3016('0x1')]={'uniqueid':{'type':Sequelize[_0x3016('0x2')]},'node':{'type':Sequelize[_0x3016('0x2')]},'application':{'type':Sequelize[_0x3016('0x2')]},'data':{'type':Sequelize[_0x3016('0x3')]},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index a1b26c3..7997e5a 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 _0xb1eb=['filters','intersection','attributes','fields','length','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','create','body','find','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','name','index','map','SquareDetailsReport','rawAttributes','fieldName','type','model','query'];(function(_0x2fe010,_0x26c8e5){var _0x519b18=function(_0x437750){while(--_0x437750){_0x2fe010['push'](_0x2fe010['shift']());}};_0x519b18(++_0x26c8e5);}(_0xb1eb,0x185));var _0xbb1e=function(_0x5d806f,_0x55ab2b){_0x5d806f=_0x5d806f-0x0;var _0x23bb82=_0xb1eb[_0x5d806f];return _0x23bb82;};'use strict';var emlformat=require(_0xbb1e('0x0'));var rimraf=require(_0xbb1e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbb1e('0x2'));var rp=require(_0xbb1e('0x3'));var moment=require(_0xbb1e('0x4'));var BPromise=require(_0xbb1e('0x5'));var Mustache=require(_0xbb1e('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xbb1e('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb1e('0x8'));var _=require(_0xbb1e('0x9'));var squel=require(_0xbb1e('0xa'));var crypto=require('crypto');var jsforce=require(_0xbb1e('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbb1e('0xc'));var Papa=require(_0xbb1e('0xd'));var Redis=require(_0xbb1e('0xe'));var authService=require(_0xbb1e('0xf'));var qs=require(_0xbb1e('0x10'));var as=require(_0xbb1e('0x11'));var hardwareService=require(_0xbb1e('0x12'));var logger=require(_0xbb1e('0x13'))(_0xbb1e('0x14'));var utils=require(_0xbb1e('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xbb1e('0x16'));var db=require(_0xbb1e('0x17'))['db'];function respondWithStatusCode(_0x5257ec,_0xfe75f5){_0xfe75f5=_0xfe75f5||0xcc;return function(_0x117670){if(_0x117670){return _0x5257ec[_0xbb1e('0x18')](_0xfe75f5);}return _0x5257ec[_0xbb1e('0x19')](_0xfe75f5)[_0xbb1e('0x1a')]();};}function respondWithResult(_0x5b99b7,_0x43dd05){_0x43dd05=_0x43dd05||0xc8;return function(_0x5f39cc){if(_0x5f39cc){return _0x5b99b7[_0xbb1e('0x19')](_0x43dd05)[_0xbb1e('0x1b')](_0x5f39cc);}};}function respondWithFilteredResult(_0x212af7,_0x16f2f7){return function(_0x1375d7){if(_0x1375d7){var _0x4ee15b=typeof _0x16f2f7[_0xbb1e('0x1c')]===_0xbb1e('0x1d')&&typeof _0x16f2f7[_0xbb1e('0x1e')]===_0xbb1e('0x1d');var _0x3fab12=_0x1375d7['count'];var _0x2fa163=_0x4ee15b?0x0:_0x16f2f7['offset'];var _0x2f7108=_0x4ee15b?_0x1375d7[_0xbb1e('0x1f')]:_0x16f2f7[_0xbb1e('0x1c')]+_0x16f2f7[_0xbb1e('0x1e')];var _0x6d6689;if(_0x2f7108>=_0x3fab12){_0x2f7108=_0x3fab12;_0x6d6689=0xc8;}else{_0x6d6689=0xce;}_0x212af7[_0xbb1e('0x19')](_0x6d6689);return _0x212af7[_0xbb1e('0x20')](_0xbb1e('0x21'),_0x2fa163+'-'+_0x2f7108+'/'+_0x3fab12)[_0xbb1e('0x1b')](_0x1375d7);}return null;};}function patchUpdates(_0x1d6c16){return function(_0x46cb3b){try{jsonpatch[_0xbb1e('0x22')](_0x46cb3b,_0x1d6c16,!![]);}catch(_0x3e3904){return BPromise[_0xbb1e('0x23')](_0x3e3904);}return _0x46cb3b[_0xbb1e('0x24')]();};}function saveUpdates(_0x26f070,_0x1b7be5){return function(_0x4b0c63){if(_0x4b0c63){return _0x4b0c63[_0xbb1e('0x25')](_0x26f070)[_0xbb1e('0x26')](function(_0x1317fd){return _0x1317fd;});}return null;};}function removeEntity(_0xaf0844,_0x2fd8ab){return function(_0x56757f){if(_0x56757f){return _0x56757f[_0xbb1e('0x27')]()[_0xbb1e('0x26')](function(){_0xaf0844[_0xbb1e('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59c1e7,_0x5d67ea){return function(_0x4e45c3){if(!_0x4e45c3){_0x59c1e7['sendStatus'](0x194);}return _0x4e45c3;};}function handleError(_0x3fa658,_0x213f69){_0x213f69=_0x213f69||0x1f4;return function(_0x51300a){logger['error'](_0x51300a['stack']);if(_0x51300a[_0xbb1e('0x28')]){delete _0x51300a[_0xbb1e('0x28')];}_0x3fa658['status'](_0x213f69)['send'](_0x51300a);};}exports[_0xbb1e('0x29')]=function(_0x493bf0,_0x33051d){var _0x2c6481={},_0x40630c={},_0x22c5e1={'count':0x0,'rows':[]};var _0x255934=_[_0xbb1e('0x2a')](db[_0xbb1e('0x2b')][_0xbb1e('0x2c')],function(_0x5c04d1){return{'name':_0x5c04d1[_0xbb1e('0x2d')],'type':_0x5c04d1[_0xbb1e('0x2e')]['key']};});_0x40630c[_0xbb1e('0x2f')]=_[_0xbb1e('0x2a')](_0x255934,_0xbb1e('0x28'));_0x40630c[_0xbb1e('0x30')]=_['keys'](_0x493bf0[_0xbb1e('0x30')]);_0x40630c[_0xbb1e('0x31')]=_[_0xbb1e('0x32')](_0x40630c[_0xbb1e('0x2f')],_0x40630c[_0xbb1e('0x30')]);_0x2c6481[_0xbb1e('0x33')]=_['intersection'](_0x40630c[_0xbb1e('0x2f')],qs['fields'](_0x493bf0['query'][_0xbb1e('0x34')]));_0x2c6481[_0xbb1e('0x33')]=_0x2c6481['attributes'][_0xbb1e('0x35')]?_0x2c6481[_0xbb1e('0x33')]:_0x40630c[_0xbb1e('0x2f')];if(!_0x493bf0[_0xbb1e('0x30')]['hasOwnProperty']('nolimit')){_0x2c6481[_0xbb1e('0x1e')]=qs[_0xbb1e('0x1e')](_0x493bf0['query'][_0xbb1e('0x1e')]);_0x2c6481['offset']=qs[_0xbb1e('0x1c')](_0x493bf0[_0xbb1e('0x30')][_0xbb1e('0x1c')]);}_0x2c6481['order']=qs[_0xbb1e('0x36')](_0x493bf0[_0xbb1e('0x30')][_0xbb1e('0x36')]);_0x2c6481[_0xbb1e('0x37')]=qs['filters'](_[_0xbb1e('0x38')](_0x493bf0[_0xbb1e('0x30')],_0x40630c[_0xbb1e('0x31')]),_0x255934);if(_0x493bf0['query'][_0xbb1e('0x39')]){_0x2c6481[_0xbb1e('0x37')]=_[_0xbb1e('0x3a')](_0x2c6481['where'],{'$or':_[_0xbb1e('0x2a')](_0x255934,function(_0x3f9acb){if(_0x3f9acb['type']!==_0xbb1e('0x3b')){var _0xbb86f0={};_0xbb86f0[_0x3f9acb[_0xbb1e('0x28')]]={'$like':'%'+_0x493bf0[_0xbb1e('0x30')][_0xbb1e('0x39')]+'%'};return _0xbb86f0;}})});}_0x2c6481=_[_0xbb1e('0x3a')]({},_0x2c6481,_0x493bf0[_0xbb1e('0x3c')]);var _0x4512f4={'where':_0x2c6481[_0xbb1e('0x37')]};return db[_0xbb1e('0x2b')][_0xbb1e('0x1f')](_0x4512f4)[_0xbb1e('0x26')](function(_0x68d28a){_0x22c5e1['count']=_0x68d28a;if(_0x493bf0[_0xbb1e('0x30')][_0xbb1e('0x3d')]){_0x2c6481[_0xbb1e('0x3e')]=[{'all':!![]}];}return db[_0xbb1e('0x2b')][_0xbb1e('0x3f')](_0x2c6481);})[_0xbb1e('0x26')](function(_0x2578e7){_0x22c5e1[_0xbb1e('0x40')]=_0x2578e7;return _0x22c5e1;})[_0xbb1e('0x26')](respondWithFilteredResult(_0x33051d,_0x2c6481))[_0xbb1e('0x41')](handleError(_0x33051d,null));};exports[_0xbb1e('0x42')]=function(_0x1b8c0e,_0x3c2e26){var _0x1ff1d6={'raw':!![],'where':{'id':_0x1b8c0e[_0xbb1e('0x43')]['id']}},_0x135a18={};_0x135a18['model']=_['keys'](db[_0xbb1e('0x2b')][_0xbb1e('0x2c')]);_0x135a18['query']=_[_0xbb1e('0x44')](_0x1b8c0e[_0xbb1e('0x30')]);_0x135a18['filters']=_['intersection'](_0x135a18[_0xbb1e('0x2f')],_0x135a18[_0xbb1e('0x30')]);_0x1ff1d6['attributes']=_[_0xbb1e('0x32')](_0x135a18[_0xbb1e('0x2f')],qs['fields'](_0x1b8c0e['query']['fields']));_0x1ff1d6[_0xbb1e('0x33')]=_0x1ff1d6[_0xbb1e('0x33')]['length']?_0x1ff1d6[_0xbb1e('0x33')]:_0x135a18[_0xbb1e('0x2f')];if(_0x1b8c0e['query'][_0xbb1e('0x3d')]){_0x1ff1d6['include']=[{'all':!![]}];}_0x1ff1d6=_[_0xbb1e('0x3a')]({},_0x1ff1d6,_0x1b8c0e[_0xbb1e('0x3c')]);return db['SquareDetailsReport']['find'](_0x1ff1d6)[_0xbb1e('0x26')](handleEntityNotFound(_0x3c2e26,null))[_0xbb1e('0x26')](respondWithResult(_0x3c2e26,null))[_0xbb1e('0x41')](handleError(_0x3c2e26,null));};exports[_0xbb1e('0x45')]=function(_0x498468,_0x53ef68){return db['SquareDetailsReport'][_0xbb1e('0x45')](_0x498468[_0xbb1e('0x46')],{})[_0xbb1e('0x26')](respondWithResult(_0x53ef68,0xc9))[_0xbb1e('0x41')](handleError(_0x53ef68,null));};exports['update']=function(_0x305e14,_0x300b6e){if(_0x305e14[_0xbb1e('0x46')]['id']){delete _0x305e14[_0xbb1e('0x46')]['id'];}return db['SquareDetailsReport'][_0xbb1e('0x47')]({'where':{'id':_0x305e14[_0xbb1e('0x43')]['id']}})[_0xbb1e('0x26')](handleEntityNotFound(_0x300b6e,null))[_0xbb1e('0x26')](saveUpdates(_0x305e14['body'],null))['then'](respondWithResult(_0x300b6e,null))[_0xbb1e('0x41')](handleError(_0x300b6e,null));};exports['destroy']=function(_0x160016,_0x626ef){return db['SquareDetailsReport'][_0xbb1e('0x47')]({'where':{'id':_0x160016[_0xbb1e('0x43')]['id']}})['then'](handleEntityNotFound(_0x626ef,null))[_0xbb1e('0x26')](removeEntity(_0x626ef,null))[_0xbb1e('0x41')](handleError(_0x626ef,null));};exports[_0xbb1e('0x48')]=function(_0x3a42f4,_0x436464){return db[_0xbb1e('0x2b')][_0xbb1e('0x48')]()[_0xbb1e('0x26')](respondWithResult(_0x436464,null))['catch'](handleError(_0x436464,null));}; \ No newline at end of file +var _0xcb9f=['catch','show','params','rawAttributes','keys','intersection','length','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','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','sendStatus','status','end','json','limit','count','offset','Content-Range','apply','save','update','then','name','send','index','map','SquareDetailsReport','key','query','filters','model','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','rows'];(function(_0xbdcf9b,_0x23c058){var _0x12f7ed=function(_0x409a7a){while(--_0x409a7a){_0xbdcf9b['push'](_0xbdcf9b['shift']());}};_0x12f7ed(++_0x23c058);}(_0xcb9f,0x9d));var _0xfcb9=function(_0xbf207e,_0x3fcfac){_0xbf207e=_0xbf207e-0x0;var _0x4c129b=_0xcb9f[_0xbf207e];return _0x4c129b;};'use strict';var emlformat=require(_0xfcb9('0x0'));var rimraf=require(_0xfcb9('0x1'));var zipdir=require(_0xfcb9('0x2'));var jsonpatch=require(_0xfcb9('0x3'));var rp=require(_0xfcb9('0x4'));var moment=require(_0xfcb9('0x5'));var BPromise=require(_0xfcb9('0x6'));var Mustache=require(_0xfcb9('0x7'));var util=require(_0xfcb9('0x8'));var path=require(_0xfcb9('0x9'));var sox=require('sox');var csv=require(_0xfcb9('0xa'));var ejs=require(_0xfcb9('0xb'));var fs=require('fs');var fs_extra=require(_0xfcb9('0xc'));var _=require(_0xfcb9('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xfcb9('0xe'));var deskjs=require(_0xfcb9('0xf'));var toCsv=require(_0xfcb9('0xa'));var querystring=require(_0xfcb9('0x10'));var Papa=require('papaparse');var Redis=require(_0xfcb9('0x11'));var authService=require(_0xfcb9('0x12'));var qs=require(_0xfcb9('0x13'));var as=require(_0xfcb9('0x14'));var hardwareService=require(_0xfcb9('0x15'));var logger=require(_0xfcb9('0x16'))('api');var utils=require(_0xfcb9('0x17'));var config=require(_0xfcb9('0x18'));var licenseUtil=require(_0xfcb9('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4e9d67,_0x465fd1){_0x465fd1=_0x465fd1||0xcc;return function(_0x78f517){if(_0x78f517){return _0x4e9d67[_0xfcb9('0x1a')](_0x465fd1);}return _0x4e9d67[_0xfcb9('0x1b')](_0x465fd1)[_0xfcb9('0x1c')]();};}function respondWithResult(_0x4914cd,_0x1834f3){_0x1834f3=_0x1834f3||0xc8;return function(_0x1dc095){if(_0x1dc095){return _0x4914cd[_0xfcb9('0x1b')](_0x1834f3)[_0xfcb9('0x1d')](_0x1dc095);}};}function respondWithFilteredResult(_0x4da97c,_0x209b98){return function(_0x5e0ac6){if(_0x5e0ac6){var _0x63030d=typeof _0x209b98['offset']==='undefined'&&typeof _0x209b98[_0xfcb9('0x1e')]==='undefined';var _0x4aa982=_0x5e0ac6[_0xfcb9('0x1f')];var _0x207b32=_0x63030d?0x0:_0x209b98[_0xfcb9('0x20')];var _0x42a134=_0x63030d?_0x5e0ac6[_0xfcb9('0x1f')]:_0x209b98[_0xfcb9('0x20')]+_0x209b98['limit'];var _0x2ee603;if(_0x42a134>=_0x4aa982){_0x42a134=_0x4aa982;_0x2ee603=0xc8;}else{_0x2ee603=0xce;}_0x4da97c[_0xfcb9('0x1b')](_0x2ee603);return _0x4da97c['set'](_0xfcb9('0x21'),_0x207b32+'-'+_0x42a134+'/'+_0x4aa982)[_0xfcb9('0x1d')](_0x5e0ac6);}return null;};}function patchUpdates(_0x5b5784){return function(_0x18a1a4){try{jsonpatch[_0xfcb9('0x22')](_0x18a1a4,_0x5b5784,!![]);}catch(_0x1d5a66){return BPromise['reject'](_0x1d5a66);}return _0x18a1a4[_0xfcb9('0x23')]();};}function saveUpdates(_0x5ea72e,_0x540464){return function(_0x245fe3){if(_0x245fe3){return _0x245fe3[_0xfcb9('0x24')](_0x5ea72e)[_0xfcb9('0x25')](function(_0x381976){return _0x381976;});}return null;};}function removeEntity(_0x135954,_0x1ee8fc){return function(_0x377f2a){if(_0x377f2a){return _0x377f2a['destroy']()[_0xfcb9('0x25')](function(){_0x135954[_0xfcb9('0x1b')](0xcc)[_0xfcb9('0x1c')]();});}};}function handleEntityNotFound(_0x346ea9,_0x141f96){return function(_0x53d36d){if(!_0x53d36d){_0x346ea9[_0xfcb9('0x1a')](0x194);}return _0x53d36d;};}function handleError(_0x33e589,_0x20a5b8){_0x20a5b8=_0x20a5b8||0x1f4;return function(_0x51bff4){logger['error'](_0x51bff4['stack']);if(_0x51bff4[_0xfcb9('0x26')]){delete _0x51bff4[_0xfcb9('0x26')];}_0x33e589[_0xfcb9('0x1b')](_0x20a5b8)[_0xfcb9('0x27')](_0x51bff4);};}exports[_0xfcb9('0x28')]=function(_0x497a2e,_0x27f3ce){var _0x1724d4={},_0x4c5c9a={},_0x432c66={'count':0x0,'rows':[]};var _0x223b8d=_[_0xfcb9('0x29')](db[_0xfcb9('0x2a')]['rawAttributes'],function(_0x5e46ba){return{'name':_0x5e46ba['fieldName'],'type':_0x5e46ba['type'][_0xfcb9('0x2b')]};});_0x4c5c9a['model']=_[_0xfcb9('0x29')](_0x223b8d,_0xfcb9('0x26'));_0x4c5c9a[_0xfcb9('0x2c')]=_['keys'](_0x497a2e[_0xfcb9('0x2c')]);_0x4c5c9a[_0xfcb9('0x2d')]=_['intersection'](_0x4c5c9a[_0xfcb9('0x2e')],_0x4c5c9a[_0xfcb9('0x2c')]);_0x1724d4[_0xfcb9('0x2f')]=_['intersection'](_0x4c5c9a['model'],qs[_0xfcb9('0x30')](_0x497a2e['query'][_0xfcb9('0x30')]));_0x1724d4[_0xfcb9('0x2f')]=_0x1724d4[_0xfcb9('0x2f')]['length']?_0x1724d4[_0xfcb9('0x2f')]:_0x4c5c9a[_0xfcb9('0x2e')];if(!_0x497a2e[_0xfcb9('0x2c')][_0xfcb9('0x31')](_0xfcb9('0x32'))){_0x1724d4[_0xfcb9('0x1e')]=qs['limit'](_0x497a2e[_0xfcb9('0x2c')][_0xfcb9('0x1e')]);_0x1724d4[_0xfcb9('0x20')]=qs[_0xfcb9('0x20')](_0x497a2e['query']['offset']);}_0x1724d4['order']=qs[_0xfcb9('0x33')](_0x497a2e[_0xfcb9('0x2c')][_0xfcb9('0x33')]);_0x1724d4[_0xfcb9('0x34')]=qs[_0xfcb9('0x2d')](_[_0xfcb9('0x35')](_0x497a2e['query'],_0x4c5c9a[_0xfcb9('0x2d')]),_0x223b8d);if(_0x497a2e[_0xfcb9('0x2c')][_0xfcb9('0x36')]){_0x1724d4[_0xfcb9('0x34')]=_[_0xfcb9('0x37')](_0x1724d4['where'],{'$or':_[_0xfcb9('0x29')](_0x223b8d,function(_0x34d40e){if(_0x34d40e[_0xfcb9('0x38')]!=='VIRTUAL'){var _0x4cdad0={};_0x4cdad0[_0x34d40e[_0xfcb9('0x26')]]={'$like':'%'+_0x497a2e[_0xfcb9('0x2c')][_0xfcb9('0x36')]+'%'};return _0x4cdad0;}})});}_0x1724d4=_[_0xfcb9('0x37')]({},_0x1724d4,_0x497a2e[_0xfcb9('0x39')]);var _0x5477ba={'where':_0x1724d4[_0xfcb9('0x34')]};return db[_0xfcb9('0x2a')][_0xfcb9('0x1f')](_0x5477ba)[_0xfcb9('0x25')](function(_0x287e42){_0x432c66['count']=_0x287e42;if(_0x497a2e[_0xfcb9('0x2c')][_0xfcb9('0x3a')]){_0x1724d4[_0xfcb9('0x3b')]=[{'all':!![]}];}return db['SquareDetailsReport'][_0xfcb9('0x3c')](_0x1724d4);})[_0xfcb9('0x25')](function(_0x385a4c){_0x432c66[_0xfcb9('0x3d')]=_0x385a4c;return _0x432c66;})[_0xfcb9('0x25')](respondWithFilteredResult(_0x27f3ce,_0x1724d4))[_0xfcb9('0x3e')](handleError(_0x27f3ce,null));};exports[_0xfcb9('0x3f')]=function(_0x3a511e,_0x366b72){var _0x5c8543={'raw':!![],'where':{'id':_0x3a511e[_0xfcb9('0x40')]['id']}},_0x11c1b7={};_0x11c1b7['model']=_['keys'](db['SquareDetailsReport'][_0xfcb9('0x41')]);_0x11c1b7['query']=_[_0xfcb9('0x42')](_0x3a511e[_0xfcb9('0x2c')]);_0x11c1b7[_0xfcb9('0x2d')]=_[_0xfcb9('0x43')](_0x11c1b7[_0xfcb9('0x2e')],_0x11c1b7['query']);_0x5c8543[_0xfcb9('0x2f')]=_[_0xfcb9('0x43')](_0x11c1b7[_0xfcb9('0x2e')],qs[_0xfcb9('0x30')](_0x3a511e['query'][_0xfcb9('0x30')]));_0x5c8543[_0xfcb9('0x2f')]=_0x5c8543['attributes'][_0xfcb9('0x44')]?_0x5c8543[_0xfcb9('0x2f')]:_0x11c1b7[_0xfcb9('0x2e')];if(_0x3a511e[_0xfcb9('0x2c')]['includeAll']){_0x5c8543['include']=[{'all':!![]}];}_0x5c8543=_[_0xfcb9('0x37')]({},_0x5c8543,_0x3a511e[_0xfcb9('0x39')]);return db['SquareDetailsReport'][_0xfcb9('0x45')](_0x5c8543)[_0xfcb9('0x25')](handleEntityNotFound(_0x366b72,null))[_0xfcb9('0x25')](respondWithResult(_0x366b72,null))[_0xfcb9('0x3e')](handleError(_0x366b72,null));};exports[_0xfcb9('0x46')]=function(_0x462d28,_0xd99760){return db['SquareDetailsReport']['create'](_0x462d28['body'],{})[_0xfcb9('0x25')](respondWithResult(_0xd99760,0xc9))[_0xfcb9('0x3e')](handleError(_0xd99760,null));};exports[_0xfcb9('0x24')]=function(_0x1c0849,_0x37e3de){if(_0x1c0849[_0xfcb9('0x47')]['id']){delete _0x1c0849['body']['id'];}return db[_0xfcb9('0x2a')][_0xfcb9('0x45')]({'where':{'id':_0x1c0849[_0xfcb9('0x40')]['id']}})[_0xfcb9('0x25')](handleEntityNotFound(_0x37e3de,null))[_0xfcb9('0x25')](saveUpdates(_0x1c0849['body'],null))[_0xfcb9('0x25')](respondWithResult(_0x37e3de,null))[_0xfcb9('0x3e')](handleError(_0x37e3de,null));};exports['destroy']=function(_0x229ce7,_0xf7da72){return db[_0xfcb9('0x2a')][_0xfcb9('0x45')]({'where':{'id':_0x229ce7[_0xfcb9('0x40')]['id']}})[_0xfcb9('0x25')](handleEntityNotFound(_0xf7da72,null))['then'](removeEntity(_0xf7da72,null))[_0xfcb9('0x3e')](handleError(_0xf7da72,null));};exports[_0xfcb9('0x48')]=function(_0x397a8b,_0x4f3dbc){return db['SquareDetailsReport'][_0xfcb9('0x48')]()[_0xfcb9('0x25')](respondWithResult(_0x4f3dbc,null))[_0xfcb9('0x3e')](handleError(_0x4f3dbc,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 31c6947..cf75c83 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 _0xb402=['../../config/environment','./squareReportDetail.attributes','SquareDetailsReport','report_square_details','lodash','util','moment','bluebird','request-promise','path','rimraf'];(function(_0x45e98e,_0x169b60){var _0x374dba=function(_0x597612){while(--_0x597612){_0x45e98e['push'](_0x45e98e['shift']());}};_0x374dba(++_0x169b60);}(_0xb402,0x12d));var _0x2b40=function(_0x1f530d,_0x18a19e){_0x1f530d=_0x1f530d-0x0;var _0x22103f=_0xb402[_0x1f530d];return _0x22103f;};'use strict';var _=require(_0x2b40('0x0'));var util=require(_0x2b40('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x2b40('0x2'));var BPromise=require(_0x2b40('0x3'));var rp=require(_0x2b40('0x4'));var fs=require('fs');var path=require(_0x2b40('0x5'));var rimraf=require(_0x2b40('0x6'));var config=require(_0x2b40('0x7'));var attributes=require(_0x2b40('0x8'));module['exports']=function(_0x377576,_0x5458c0){return _0x377576['define'](_0x2b40('0x9'),attributes,{'tableName':_0x2b40('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaab1=['SquareDetailsReport','report_square_details','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./squareReportDetail.attributes','define'];(function(_0x3109f1,_0x31e90d){var _0x1b041b=function(_0x876ac8){while(--_0x876ac8){_0x3109f1['push'](_0x3109f1['shift']());}};_0x1b041b(++_0x31e90d);}(_0xaab1,0x1d6));var _0x1aab=function(_0x5d9bd3,_0x7f2736){_0x5d9bd3=_0x5d9bd3-0x0;var _0x563b90=_0xaab1[_0x5d9bd3];return _0x563b90;};'use strict';var _=require('lodash');var util=require(_0x1aab('0x0'));var logger=require(_0x1aab('0x1'))(_0x1aab('0x2'));var moment=require(_0x1aab('0x3'));var BPromise=require(_0x1aab('0x4'));var rp=require(_0x1aab('0x5'));var fs=require('fs');var path=require(_0x1aab('0x6'));var rimraf=require(_0x1aab('0x7'));var config=require('../../config/environment');var attributes=require(_0x1aab('0x8'));module['exports']=function(_0x5cb9c8,_0x4caa47){return _0x5cb9c8[_0x1aab('0x9')](_0x1aab('0xa'),attributes,{'tableName':_0x1aab('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index 3a2c122..c5a4c65 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 _0x58a4=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateSquareDetailsReport','body','options','raw','lodash','util','moment','bluebird','randomstring'];(function(_0x16b69c,_0x2e4d15){var _0x280e8d=function(_0x24d69d){while(--_0x24d69d){_0x16b69c['push'](_0x16b69c['shift']());}};_0x280e8d(++_0x2e4d15);}(_0x58a4,0xbf));var _0x458a=function(_0x115785,_0x4d16fa){_0x115785=_0x115785-0x0;var _0x35224b=_0x58a4[_0x115785];return _0x35224b;};'use strict';var _=require(_0x458a('0x0'));var util=require(_0x458a('0x1'));var moment=require(_0x458a('0x2'));var BPromise=require(_0x458a('0x3'));var rs=require(_0x458a('0x4'));var fs=require('fs');var Redis=require(_0x458a('0x5'));var db=require(_0x458a('0x6'))['db'];var utils=require(_0x458a('0x7'));var logger=require(_0x458a('0x8'))(_0x458a('0x9'));var config=require(_0x458a('0xa'));var jayson=require(_0x458a('0xb'));var client=jayson[_0x458a('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5358c2,_0x30b095,_0x11fcaa){return new BPromise(function(_0x2029bc,_0x1e658e){return client[_0x458a('0xd')](_0x5358c2,_0x11fcaa)['then'](function(_0x4bedce){logger[_0x458a('0xe')](_0x458a('0xf'),_0x30b095,_0x458a('0x10'));logger[_0x458a('0x11')](_0x458a('0x12'),_0x30b095,'request\x20sent',JSON[_0x458a('0x13')](_0x4bedce));if(_0x4bedce[_0x458a('0x14')]){if(_0x4bedce['error'][_0x458a('0x15')]===0x1f4){logger[_0x458a('0x14')](_0x458a('0xf'),_0x30b095,_0x4bedce[_0x458a('0x14')][_0x458a('0x16')]);return _0x1e658e(_0x4bedce['error']['message']);}logger[_0x458a('0x14')]('SquareDetailsReport,\x20%s,\x20%s',_0x30b095,_0x4bedce[_0x458a('0x14')][_0x458a('0x16')]);return _0x2029bc(_0x4bedce[_0x458a('0x14')][_0x458a('0x16')]);}else{logger[_0x458a('0xe')](_0x458a('0xf'),_0x30b095,'request\x20sent');_0x2029bc(_0x4bedce['result']['message']);}})[_0x458a('0x17')](function(_0x3fd6d4){logger[_0x458a('0x14')]('SquareDetailsReport,\x20%s,\x20%s',_0x30b095,_0x3fd6d4);_0x1e658e(_0x3fd6d4);});});}exports[_0x458a('0x18')]=function(_0x260c87){var _0x18504d=this;return new Promise(function(_0x392986,_0xa91473){return db['SquareDetailsReport']['create'](_0x260c87[_0x458a('0x19')],{'raw':_0x260c87['options']?_0x260c87[_0x458a('0x1a')][_0x458a('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x468416){logger['info'](_0x458a('0x18'),_0x260c87);logger[_0x458a('0x11')]('CreateSquareDetailsReport',_0x260c87,JSON[_0x458a('0x13')](_0x468416));_0x392986(_0x468416);})[_0x458a('0x17')](function(_0x5a2bcb){logger[_0x458a('0x14')]('CreateSquareDetailsReport',_0x5a2bcb[_0x458a('0x16')],_0x260c87);_0xa91473(_0x18504d['error'](0x1f4,_0x5a2bcb[_0x458a('0x16')]));});});}; \ No newline at end of file +var _0xc900=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','CreateSquareDetailsReport','SquareDetailsReport','create','options','raw','moment','bluebird','randomstring'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc900,0xb3));var _0x0c90=function(_0x2791c6,_0x579306){_0x2791c6=_0x2791c6-0x0;var _0x52932e=_0xc900[_0x2791c6];return _0x52932e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0c90('0x0'));var BPromise=require(_0x0c90('0x1'));var rs=require(_0x0c90('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0c90('0x3'))['db'];var utils=require(_0x0c90('0x4'));var logger=require('../../config/logger')(_0x0c90('0x5'));var config=require(_0x0c90('0x6'));var jayson=require(_0x0c90('0x7'));var client=jayson[_0x0c90('0x8')][_0x0c90('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x302ab1,_0x5b1a5c,_0x24e5be){return new BPromise(function(_0x1c1996,_0x23daed){return client[_0x0c90('0xa')](_0x302ab1,_0x24e5be)[_0x0c90('0xb')](function(_0x3d0f49){logger[_0x0c90('0xc')](_0x0c90('0xd'),_0x5b1a5c,_0x0c90('0xe'));logger[_0x0c90('0xf')](_0x0c90('0x10'),_0x5b1a5c,_0x0c90('0xe'),JSON[_0x0c90('0x11')](_0x3d0f49));if(_0x3d0f49['error']){if(_0x3d0f49[_0x0c90('0x12')]['code']===0x1f4){logger[_0x0c90('0x12')]('SquareDetailsReport,\x20%s,\x20%s',_0x5b1a5c,_0x3d0f49[_0x0c90('0x12')][_0x0c90('0x13')]);return _0x23daed(_0x3d0f49[_0x0c90('0x12')][_0x0c90('0x13')]);}logger[_0x0c90('0x12')]('SquareDetailsReport,\x20%s,\x20%s',_0x5b1a5c,_0x3d0f49[_0x0c90('0x12')][_0x0c90('0x13')]);return _0x1c1996(_0x3d0f49['error'][_0x0c90('0x13')]);}else{logger[_0x0c90('0xc')](_0x0c90('0xd'),_0x5b1a5c,'request\x20sent');_0x1c1996(_0x3d0f49['result'][_0x0c90('0x13')]);}})[_0x0c90('0x14')](function(_0x2b8135){logger[_0x0c90('0x12')](_0x0c90('0xd'),_0x5b1a5c,_0x2b8135);_0x23daed(_0x2b8135);});});}exports[_0x0c90('0x15')]=function(_0x42321a){var _0x57b9a6=this;return new Promise(function(_0xc3bb47,_0x38becc){return db[_0x0c90('0x16')][_0x0c90('0x17')](_0x42321a['body'],{'raw':_0x42321a[_0x0c90('0x18')]?_0x42321a[_0x0c90('0x18')][_0x0c90('0x19')]===undefined?!![]:![]:!![]})[_0x0c90('0xb')](function(_0x315932){logger[_0x0c90('0xc')]('CreateSquareDetailsReport',_0x42321a);logger[_0x0c90('0xf')]('CreateSquareDetailsReport',_0x42321a,JSON[_0x0c90('0x11')](_0x315932));_0xc3bb47(_0x315932);})[_0x0c90('0x14')](function(_0x47b13c){logger[_0x0c90('0x12')](_0x0c90('0x15'),_0x47b13c[_0x0c90('0x13')],_0x42321a);_0x38becc(_0x57b9a6[_0x0c90('0x12')](0x1f4,_0x47b13c[_0x0c90('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index a8e7e15..64ea2fd 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 _0x95eb=['./system.controller','get','index','/process/:pid/kill','isAuthenticated','killProcess','Router','../../components/auth/service'];(function(_0x9ade59,_0x105c38){var _0x12bb7c=function(_0x1f6fef){while(--_0x1f6fef){_0x9ade59['push'](_0x9ade59['shift']());}};_0x12bb7c(++_0x105c38);}(_0x95eb,0x1ae));var _0xb95e=function(_0x45059a,_0x238214){_0x45059a=_0x45059a-0x0;var _0x485116=_0x95eb[_0x45059a];return _0x485116;};'use strict';var express=require('express');var router=express[_0xb95e('0x0')]();var auth=require(_0xb95e('0x1'));var controller=require(_0xb95e('0x2'));router[_0xb95e('0x3')]('/',auth['isAuthenticated'](),controller[_0xb95e('0x4')]);router[_0xb95e('0x3')](_0xb95e('0x5'),auth[_0xb95e('0x6')](),controller[_0xb95e('0x7')]);module['exports']=router; \ No newline at end of file +var _0x0e90=['express','Router','./system.controller','isAuthenticated','get','exports'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x0e90,0x1ce));var _0x00e9=function(_0x8a3661,_0x1e8a6d){_0x8a3661=_0x8a3661-0x0;var _0x4fc290=_0x0e90[_0x8a3661];return _0x4fc290;};'use strict';var express=require(_0x00e9('0x0'));var router=express[_0x00e9('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x00e9('0x2'));router['get']('/',auth[_0x00e9('0x3')](),controller['index']);router[_0x00e9('0x4')]('/process/:pid/kill',auth[_0x00e9('0x3')](),controller['killProcess']);module[_0x00e9('0x5')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index e0e4b99..acf3525 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 _0x5a80=['systeminformation','child_process','../../config/logger','api','util','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','send','index','getAllData','json','catch','status','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','pid','then','split','length','indexOf','kill','params','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','killProcess'];(function(_0x355e85,_0x1805e1){var _0x5c44b6=function(_0x43b3f6){while(--_0x43b3f6){_0x355e85['push'](_0x355e85['shift']());}};_0x5c44b6(++_0x1805e1);}(_0x5a80,0x1a4));var _0x05a8=function(_0xff3d3b,_0x40c60e){_0xff3d3b=_0xff3d3b-0x0;var _0x5200b3=_0x5a80[_0xff3d3b];return _0x5200b3;};'use strict';var info=require(_0x05a8('0x0'));var exec=require(_0x05a8('0x1'))['exec'];var logger=require(_0x05a8('0x2'))(_0x05a8('0x3'));var util=require(_0x05a8('0x4'));var BPromise=require('bluebird');var _=require(_0x05a8('0x5'));function handleError(_0x2aedb8,_0x2da2de,_0x24bd73){_0x2da2de=_0x2da2de||0x1f4;return function(_0x48924a){logger[_0x05a8('0x6')](_0x05a8('0x7'),_0x24bd73,_0x2da2de,util[_0x05a8('0x8')](_0x48924a,{'showHidden':![],'depth':null}));delete _0x48924a[_0x05a8('0x9')];_0x2aedb8['status'](_0x2da2de)[_0x05a8('0xa')](_0x48924a);};}exports[_0x05a8('0xb')]=function(_0xbfc467,_0x45af55){return info[_0x05a8('0xc')]()['then'](function(_0x36ae15){return _0x45af55['status'](0xc8)[_0x05a8('0xd')](_0x36ae15);})[_0x05a8('0xe')](function(_0x139846){return _0x45af55[_0x05a8('0xf')](0x1f4)['json'](_0x139846);});};exports['killProcess']=function(_0x335610,_0x25ec0e){var _0x37ad37=['components/import/cm'];return new BPromise(function(_0x278581,_0x55c202){return exec(util[_0x05a8('0x10')](_0x05a8('0x11'),_0x335610['params'][_0x05a8('0x12')]),function(_0x2df742,_0x29c497,_0x320866){if(_0x2df742){return _0x55c202(_0x2df742);}return _0x278581(_0x29c497);});})[_0x05a8('0x13')](function(_0x21f337){var _0x3b0269=![];var _0x1090c0=_0x21f337[_0x05a8('0x14')](/\n/);for(var _0x16dc73=0x0,_0x5c8deb=_0x37ad37[_0x05a8('0x15')];_0x16dc73<_0x5c8deb,_0x3b0269===![];_0x16dc73+=0x1){if(_0x21f337[_0x05a8('0x16')](_0x37ad37[_0x16dc73])>=0x0){_0x3b0269=!![];}}if(!_0x3b0269){throw new Error(util['format']('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x335610['params'][_0x05a8('0x12')]));}process[_0x05a8('0x17')](_0x335610[_0x05a8('0x18')][_0x05a8('0x12')],_0x05a8('0x19'));return _0x25ec0e[_0x05a8('0xf')](0xc8)[_0x05a8('0xd')]({'message':util[_0x05a8('0x10')](_0x05a8('0x1a'),_0x335610[_0x05a8('0x18')][_0x05a8('0x12')])});})['catch'](handleError(_0x25ec0e,null,_0x05a8('0x1b')));}; \ No newline at end of file +var _0x302e=['exec','../../config/logger','api','util','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','status','index','getAllData','then','catch','json','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','pid','split','length','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','params','Process\x20with\x20pid\x20%s\x20killed\x20correctly','child_process'];(function(_0x26f2a3,_0x324e2d){var _0x2a9969=function(_0x3cc464){while(--_0x3cc464){_0x26f2a3['push'](_0x26f2a3['shift']());}};_0x2a9969(++_0x324e2d);}(_0x302e,0x6b));var _0xe302=function(_0x56c4e6,_0xb1ca09){_0x56c4e6=_0x56c4e6-0x0;var _0x34859b=_0x302e[_0x56c4e6];return _0x34859b;};'use strict';var info=require('systeminformation');var exec=require(_0xe302('0x0'))[_0xe302('0x1')];var logger=require(_0xe302('0x2'))(_0xe302('0x3'));var util=require(_0xe302('0x4'));var BPromise=require(_0xe302('0x5'));var _=require(_0xe302('0x6'));function handleError(_0xe57169,_0x427172,_0x148178){_0x427172=_0x427172||0x1f4;return function(_0x5d252b){logger[_0xe302('0x7')](_0xe302('0x8'),_0x148178,_0x427172,util[_0xe302('0x9')](_0x5d252b,{'showHidden':![],'depth':null}));delete _0x5d252b['name'];_0xe57169[_0xe302('0xa')](_0x427172)['send'](_0x5d252b);};}exports[_0xe302('0xb')]=function(_0xba6d90,_0x455c26){return info[_0xe302('0xc')]()[_0xe302('0xd')](function(_0x590df3){return _0x455c26[_0xe302('0xa')](0xc8)['json'](_0x590df3);})[_0xe302('0xe')](function(_0x80a8bc){return _0x455c26[_0xe302('0xa')](0x1f4)[_0xe302('0xf')](_0x80a8bc);});};exports[_0xe302('0x10')]=function(_0x947b1,_0x1804e){var _0x1ed3dd=[_0xe302('0x11')];return new BPromise(function(_0x3a88e4,_0x3547e4){return exec(util[_0xe302('0x12')](_0xe302('0x13'),_0x947b1['params'][_0xe302('0x14')]),function(_0x577c5b,_0x3526f3,_0x3142c2){if(_0x577c5b){return _0x3547e4(_0x577c5b);}return _0x3a88e4(_0x3526f3);});})['then'](function(_0x54b155){var _0x26b8e0=![];var _0x16750a=_0x54b155[_0xe302('0x15')](/\n/);for(var _0x31f4ad=0x0,_0x2021e1=_0x1ed3dd[_0xe302('0x16')];_0x31f4ad<_0x2021e1,_0x26b8e0===![];_0x31f4ad+=0x1){if(_0x54b155['indexOf'](_0x1ed3dd[_0x31f4ad])>=0x0){_0x26b8e0=!![];}}if(!_0x26b8e0){throw new Error(util['format'](_0xe302('0x17'),_0x947b1['params'][_0xe302('0x14')]));}process[_0xe302('0x18')](_0x947b1[_0xe302('0x19')][_0xe302('0x14')],'SIGINT');return _0x1804e[_0xe302('0xa')](0xc8)[_0xe302('0xf')]({'message':util['format'](_0xe302('0x1a'),_0x947b1[_0xe302('0x19')]['pid'])});})[_0xe302('0xe')](handleError(_0x1804e,null,'killProcess'));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 581fe8f..1c62cda 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 _0x81bd=['../../config/environment','./tag.controller','isAuthenticated','index','get','describe','/:id','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x4e7551,_0x398ee5){var _0x2c2ae8=function(_0x31f000){while(--_0x31f000){_0x4e7551['push'](_0x4e7551['shift']());}};_0x2c2ae8(++_0x398ee5);}(_0x81bd,0x7c));var _0xd81b=function(_0x30af23,_0x1b9d6a){_0x30af23=_0x30af23-0x0;var _0x5cea96=_0x81bd[_0x30af23];return _0x5cea96;};'use strict';var multer=require(_0xd81b('0x0'));var util=require(_0xd81b('0x1'));var path=require(_0xd81b('0x2'));var timeout=require(_0xd81b('0x3'));var express=require(_0xd81b('0x4'));var router=express[_0xd81b('0x5')]();var fs_extra=require(_0xd81b('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xd81b('0x7'));var config=require(_0xd81b('0x8'));var controller=require(_0xd81b('0x9'));router['get']('/',auth[_0xd81b('0xa')](),controller[_0xd81b('0xb')]);router[_0xd81b('0xc')]('/describe',auth['isAuthenticated'](),controller[_0xd81b('0xd')]);router['get'](_0xd81b('0xe'),auth[_0xd81b('0xa')](),controller[_0xd81b('0xf')]);router[_0xd81b('0x10')]('/',auth[_0xd81b('0xa')](),controller[_0xd81b('0x11')]);router[_0xd81b('0x12')](_0xd81b('0xe'),auth[_0xd81b('0xa')](),controller[_0xd81b('0x13')]);router[_0xd81b('0x14')](_0xd81b('0xe'),auth[_0xd81b('0xa')](),controller['destroy']);module[_0xd81b('0x15')]=router; \ No newline at end of file +var _0xe14d=['isAuthenticated','index','describe','/:id','show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./tag.controller','get'];(function(_0x355aa3,_0x2ee8f7){var _0x52cdfb=function(_0x3105a6){while(--_0x3105a6){_0x355aa3['push'](_0x355aa3['shift']());}};_0x52cdfb(++_0x2ee8f7);}(_0xe14d,0x1ee));var _0xde14=function(_0x257642,_0x270a80){_0x257642=_0x257642-0x0;var _0x3d813b=_0xe14d[_0x257642];return _0x3d813b;};'use strict';var multer=require(_0xde14('0x0'));var util=require(_0xde14('0x1'));var path=require(_0xde14('0x2'));var timeout=require(_0xde14('0x3'));var express=require('express');var router=express[_0xde14('0x4')]();var fs_extra=require(_0xde14('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xde14('0x6'));var config=require(_0xde14('0x7'));var controller=require(_0xde14('0x8'));router[_0xde14('0x9')]('/',auth[_0xde14('0xa')](),controller[_0xde14('0xb')]);router['get']('/describe',auth[_0xde14('0xa')](),controller[_0xde14('0xc')]);router[_0xde14('0x9')](_0xde14('0xd'),auth[_0xde14('0xa')](),controller[_0xde14('0xe')]);router[_0xde14('0xf')]('/',auth[_0xde14('0xa')](),controller['create']);router[_0xde14('0x10')](_0xde14('0xd'),auth[_0xde14('0xa')](),controller[_0xde14('0x11')]);router[_0xde14('0x12')](_0xde14('0xd'),auth[_0xde14('0xa')](),controller[_0xde14('0x13')]);module[_0xde14('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 627eaf1..d4a9016 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 _0x5867=['name','#0091EA','sequelize','exports','STRING'];(function(_0x4c7b49,_0x1e1cf7){var _0xe4f4a1=function(_0x30f855){while(--_0x30f855){_0x4c7b49['push'](_0x4c7b49['shift']());}};_0xe4f4a1(++_0x1e1cf7);}(_0x5867,0x1e2));var _0x7586=function(_0x3a521e,_0x557783){_0x3a521e=_0x3a521e-0x0;var _0xda3190=_0x5867[_0x3a521e];return _0xda3190;};'use strict';var Sequelize=require(_0x7586('0x0'));module[_0x7586('0x1')]={'name':{'type':Sequelize[_0x7586('0x2')],'unique':_0x7586('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x7586('0x2')],'defaultValue':_0x7586('0x4')},'description':{'type':Sequelize[_0x7586('0x2')]}}; \ No newline at end of file +var _0x1c8a=['sequelize','exports','STRING','name'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1c8a,0x140));var _0xa1c8=function(_0x5a2408,_0x278391){_0x5a2408=_0x5a2408-0x0;var _0x5c4342=_0x1c8a[_0x5a2408];return _0x5c4342;};'use strict';var Sequelize=require(_0xa1c8('0x0'));module[_0xa1c8('0x1')]={'name':{'type':Sequelize[_0xa1c8('0x2')],'unique':_0xa1c8('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xa1c8('0x2')],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0xa1c8('0x2')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 99f09c7..9ff245a 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 _0x7abe=['lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','UserProfileResource','error','send','index','Tag','fieldName','type','key','model','map','name','query','keys','filters','attributes','fields','length','nolimit','order','sort','where','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','intersection','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Tags','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs'];(function(_0x204243,_0x38b7b0){var _0x51c3a7=function(_0x119aec){while(--_0x119aec){_0x204243['push'](_0x204243['shift']());}};_0x51c3a7(++_0x38b7b0);}(_0x7abe,0xa0));var _0xe7ab=function(_0x161c97,_0x1775cb){_0x161c97=_0x161c97-0x0;var _0x305962=_0x7abe[_0x161c97];return _0x305962;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe7ab('0x0'));var zipdir=require(_0xe7ab('0x1'));var jsonpatch=require(_0xe7ab('0x2'));var rp=require(_0xe7ab('0x3'));var moment=require(_0xe7ab('0x4'));var BPromise=require(_0xe7ab('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xe7ab('0x6'));var sox=require(_0xe7ab('0x7'));var csv=require(_0xe7ab('0x8'));var ejs=require(_0xe7ab('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe7ab('0xa'));var squel=require('squel');var crypto=require(_0xe7ab('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xe7ab('0xc'));var toCsv=require('to-csv');var querystring=require(_0xe7ab('0xd'));var Papa=require(_0xe7ab('0xe'));var Redis=require(_0xe7ab('0xf'));var authService=require(_0xe7ab('0x10'));var qs=require(_0xe7ab('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe7ab('0x12'));var logger=require(_0xe7ab('0x13'))(_0xe7ab('0x14'));var utils=require(_0xe7ab('0x15'));var config=require(_0xe7ab('0x16'));var licenseUtil=require(_0xe7ab('0x17'));var db=require(_0xe7ab('0x18'))['db'];function respondWithStatusCode(_0x1ffb9d,_0xe565d8){_0xe565d8=_0xe565d8||0xcc;return function(_0x9d137a){if(_0x9d137a){return _0x1ffb9d[_0xe7ab('0x19')](_0xe565d8);}return _0x1ffb9d[_0xe7ab('0x1a')](_0xe565d8)[_0xe7ab('0x1b')]();};}function respondWithResult(_0x3f0f4c,_0x500238){_0x500238=_0x500238||0xc8;return function(_0x100334){if(_0x100334){return _0x3f0f4c['status'](_0x500238)[_0xe7ab('0x1c')](_0x100334);}};}function respondWithFilteredResult(_0x1482f3,_0x2acedc){return function(_0x762fb0){if(_0x762fb0){var _0x610e7b=typeof _0x2acedc[_0xe7ab('0x1d')]==='undefined'&&typeof _0x2acedc[_0xe7ab('0x1e')]===_0xe7ab('0x1f');var _0x4e1cbf=_0x762fb0[_0xe7ab('0x20')];var _0x46d5bd=_0x610e7b?0x0:_0x2acedc['offset'];var _0x42e40b=_0x610e7b?_0x762fb0[_0xe7ab('0x20')]:_0x2acedc[_0xe7ab('0x1d')]+_0x2acedc[_0xe7ab('0x1e')];var _0x53db3c;if(_0x42e40b>=_0x4e1cbf){_0x42e40b=_0x4e1cbf;_0x53db3c=0xc8;}else{_0x53db3c=0xce;}_0x1482f3[_0xe7ab('0x1a')](_0x53db3c);return _0x1482f3[_0xe7ab('0x21')](_0xe7ab('0x22'),_0x46d5bd+'-'+_0x42e40b+'/'+_0x4e1cbf)[_0xe7ab('0x1c')](_0x762fb0);}return null;};}function patchUpdates(_0x1c8bd3){return function(_0x29fa26){try{jsonpatch[_0xe7ab('0x23')](_0x29fa26,_0x1c8bd3,!![]);}catch(_0x2fca36){return BPromise[_0xe7ab('0x24')](_0x2fca36);}return _0x29fa26[_0xe7ab('0x25')]();};}function saveUpdates(_0x3bfe66,_0x3ffb95){return function(_0x19fa7d){if(_0x19fa7d){return _0x19fa7d['update'](_0x3bfe66)[_0xe7ab('0x26')](function(_0x55a45f){return _0x55a45f;});}return null;};}function removeEntity(_0x6f0cd0,_0x443f5e){return function(_0x5c5b62){if(_0x5c5b62){return _0x5c5b62[_0xe7ab('0x27')]()[_0xe7ab('0x26')](function(){var _0xd8a5cc=_0x5c5b62['get']({'plain':!![]});var _0x2ea325='Tags';return db[_0xe7ab('0x28')]['destroy']({'where':{'type':_0x2ea325,'resourceId':_0xd8a5cc['id']}})['then'](function(){return _0x5c5b62;});})[_0xe7ab('0x26')](function(){_0x6f0cd0[_0xe7ab('0x1a')](0xcc)[_0xe7ab('0x1b')]();});}};}function handleEntityNotFound(_0x28207,_0x62e145){return function(_0x43cb1d){if(!_0x43cb1d){_0x28207['sendStatus'](0x194);}return _0x43cb1d;};}function handleError(_0x3345ec,_0x406ae6){_0x406ae6=_0x406ae6||0x1f4;return function(_0x592723){logger[_0xe7ab('0x29')](_0x592723['stack']);if(_0x592723['name']){delete _0x592723['name'];}_0x3345ec[_0xe7ab('0x1a')](_0x406ae6)[_0xe7ab('0x2a')](_0x592723);};}exports[_0xe7ab('0x2b')]=function(_0x3821ae,_0x44f2b4){var _0x264c55={},_0x533646={},_0x5c3422={'count':0x0,'rows':[]};var _0x4a9eb6=_['map'](db[_0xe7ab('0x2c')]['rawAttributes'],function(_0xfd1546){return{'name':_0xfd1546[_0xe7ab('0x2d')],'type':_0xfd1546[_0xe7ab('0x2e')][_0xe7ab('0x2f')]};});_0x533646[_0xe7ab('0x30')]=_[_0xe7ab('0x31')](_0x4a9eb6,_0xe7ab('0x32'));_0x533646[_0xe7ab('0x33')]=_[_0xe7ab('0x34')](_0x3821ae[_0xe7ab('0x33')]);_0x533646[_0xe7ab('0x35')]=_['intersection'](_0x533646['model'],_0x533646[_0xe7ab('0x33')]);_0x264c55[_0xe7ab('0x36')]=_['intersection'](_0x533646[_0xe7ab('0x30')],qs[_0xe7ab('0x37')](_0x3821ae['query']['fields']));_0x264c55['attributes']=_0x264c55[_0xe7ab('0x36')][_0xe7ab('0x38')]?_0x264c55[_0xe7ab('0x36')]:_0x533646[_0xe7ab('0x30')];if(!_0x3821ae['query']['hasOwnProperty'](_0xe7ab('0x39'))){_0x264c55[_0xe7ab('0x1e')]=qs[_0xe7ab('0x1e')](_0x3821ae[_0xe7ab('0x33')][_0xe7ab('0x1e')]);_0x264c55['offset']=qs[_0xe7ab('0x1d')](_0x3821ae['query'][_0xe7ab('0x1d')]);}_0x264c55[_0xe7ab('0x3a')]=qs[_0xe7ab('0x3b')](_0x3821ae[_0xe7ab('0x33')][_0xe7ab('0x3b')]);_0x264c55[_0xe7ab('0x3c')]=qs[_0xe7ab('0x35')](_['pick'](_0x3821ae['query'],_0x533646[_0xe7ab('0x35')]),_0x4a9eb6);if(_0x3821ae[_0xe7ab('0x33')]['filter']){_0x264c55[_0xe7ab('0x3c')]=_[_0xe7ab('0x3d')](_0x264c55[_0xe7ab('0x3c')],{'$or':_[_0xe7ab('0x31')](_0x4a9eb6,function(_0x38baf1){if(_0x38baf1[_0xe7ab('0x2e')]!=='VIRTUAL'){var _0x247e4c={};_0x247e4c[_0x38baf1[_0xe7ab('0x32')]]={'$like':'%'+_0x3821ae[_0xe7ab('0x33')]['filter']+'%'};return _0x247e4c;}})});}_0x264c55=_[_0xe7ab('0x3d')]({},_0x264c55,_0x3821ae[_0xe7ab('0x3e')]);var _0x345b49={'where':_0x264c55[_0xe7ab('0x3c')]};return db[_0xe7ab('0x2c')][_0xe7ab('0x20')](_0x345b49)[_0xe7ab('0x26')](function(_0x5565e4){_0x5c3422[_0xe7ab('0x20')]=_0x5565e4;if(_0x3821ae[_0xe7ab('0x33')][_0xe7ab('0x3f')]){_0x264c55[_0xe7ab('0x40')]=[{'all':!![]}];}return db[_0xe7ab('0x2c')][_0xe7ab('0x41')](_0x264c55);})[_0xe7ab('0x26')](function(_0x18273b){_0x5c3422[_0xe7ab('0x42')]=_0x18273b;return _0x5c3422;})[_0xe7ab('0x26')](respondWithFilteredResult(_0x44f2b4,_0x264c55))[_0xe7ab('0x43')](handleError(_0x44f2b4,null));};exports[_0xe7ab('0x44')]=function(_0xb1a76f,_0x2846e4){var _0x21dd49={'raw':!![],'where':{'id':_0xb1a76f[_0xe7ab('0x45')]['id']}},_0x3386b6={};_0x3386b6[_0xe7ab('0x30')]=_[_0xe7ab('0x34')](db[_0xe7ab('0x2c')][_0xe7ab('0x46')]);_0x3386b6[_0xe7ab('0x33')]=_[_0xe7ab('0x34')](_0xb1a76f[_0xe7ab('0x33')]);_0x3386b6[_0xe7ab('0x35')]=_[_0xe7ab('0x47')](_0x3386b6[_0xe7ab('0x30')],_0x3386b6['query']);_0x21dd49[_0xe7ab('0x36')]=_[_0xe7ab('0x47')](_0x3386b6[_0xe7ab('0x30')],qs[_0xe7ab('0x37')](_0xb1a76f[_0xe7ab('0x33')][_0xe7ab('0x37')]));_0x21dd49[_0xe7ab('0x36')]=_0x21dd49[_0xe7ab('0x36')][_0xe7ab('0x38')]?_0x21dd49[_0xe7ab('0x36')]:_0x3386b6[_0xe7ab('0x30')];if(_0xb1a76f[_0xe7ab('0x33')][_0xe7ab('0x3f')]){_0x21dd49[_0xe7ab('0x40')]=[{'all':!![]}];}_0x21dd49=_[_0xe7ab('0x3d')]({},_0x21dd49,_0xb1a76f[_0xe7ab('0x3e')]);return db[_0xe7ab('0x2c')][_0xe7ab('0x48')](_0x21dd49)[_0xe7ab('0x26')](handleEntityNotFound(_0x2846e4,null))[_0xe7ab('0x26')](respondWithResult(_0x2846e4,null))['catch'](handleError(_0x2846e4,null));};exports[_0xe7ab('0x49')]=function(_0x3f2d4d,_0xed77b6){return db['Tag']['create'](_0x3f2d4d[_0xe7ab('0x4a')],{})['then'](function(_0x142d2d){var _0x2ef14a=_0x3f2d4d['user'][_0xe7ab('0x4b')]({'plain':!![]});if(!_0x2ef14a)throw new Error(_0xe7ab('0x4c'));if(_0x2ef14a[_0xe7ab('0x4d')]===_0xe7ab('0x4e')){var _0x11c969=_0x142d2d[_0xe7ab('0x4b')]({'plain':!![]});var _0x1013e8=_0xe7ab('0x4f');return db[_0xe7ab('0x50')][_0xe7ab('0x48')]({'where':{'name':_0x1013e8,'userProfileId':_0x2ef14a['userProfileId']},'raw':!![]})[_0xe7ab('0x26')](function(_0xdd44b4){if(_0xdd44b4&&_0xdd44b4[_0xe7ab('0x51')]===0x0){return db[_0xe7ab('0x28')][_0xe7ab('0x49')]({'name':_0x11c969['name'],'resourceId':_0x11c969['id'],'type':_0xdd44b4[_0xe7ab('0x32')],'sectionId':_0xdd44b4['id']},{})[_0xe7ab('0x26')](function(){return _0x142d2d;});}else{return _0x142d2d;}})[_0xe7ab('0x43')](function(_0x2edabb){logger['error'](_0xe7ab('0x52'),_0x2edabb);throw _0x2edabb;});}return _0x142d2d;})['then'](respondWithResult(_0xed77b6,0xc9))[_0xe7ab('0x43')](handleError(_0xed77b6,null));};exports[_0xe7ab('0x53')]=function(_0x2d8ad6,_0x1bb9cd){if(_0x2d8ad6['body']['id']){delete _0x2d8ad6[_0xe7ab('0x4a')]['id'];}return db[_0xe7ab('0x2c')][_0xe7ab('0x48')]({'where':{'id':_0x2d8ad6[_0xe7ab('0x45')]['id']}})['then'](handleEntityNotFound(_0x1bb9cd,null))[_0xe7ab('0x26')](saveUpdates(_0x2d8ad6['body'],null))[_0xe7ab('0x26')](respondWithResult(_0x1bb9cd,null))['catch'](handleError(_0x1bb9cd,null));};exports[_0xe7ab('0x27')]=function(_0x1958d1,_0x505300){return db[_0xe7ab('0x2c')][_0xe7ab('0x48')]({'where':{'id':_0x1958d1[_0xe7ab('0x45')]['id']}})[_0xe7ab('0x26')](handleEntityNotFound(_0x505300,null))[_0xe7ab('0x26')](removeEntity(_0x505300,null))['catch'](handleError(_0x505300,null));};exports[_0xe7ab('0x54')]=function(_0xc00891,_0x544e4d){return db[_0xe7ab('0x2c')][_0xe7ab('0x54')]()[_0xe7ab('0x26')](respondWithResult(_0x544e4d,null))[_0xe7ab('0x43')](handleError(_0x544e4d,null));}; \ No newline at end of file +var _0x299c=['crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','get','UserProfileResource','stack','name','send','index','map','Tag','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','keys','rawAttributes','include','find','create','body','user','UserProfileSection','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','squel'];(function(_0x391032,_0x41bbf8){var _0xae271=function(_0x113842){while(--_0x113842){_0x391032['push'](_0x391032['shift']());}};_0xae271(++_0x41bbf8);}(_0x299c,0x180));var _0xc299=function(_0x484b24,_0x5f34ad){_0x484b24=_0x484b24-0x0;var _0x379fbb=_0x299c[_0x484b24];return _0x379fbb;};'use strict';var emlformat=require(_0xc299('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc299('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc299('0x2'));var moment=require(_0xc299('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xc299('0x4'));var util=require(_0xc299('0x5'));var path=require(_0xc299('0x6'));var sox=require('sox');var csv=require(_0xc299('0x7'));var ejs=require(_0xc299('0x8'));var fs=require('fs');var fs_extra=require(_0xc299('0x9'));var _=require('lodash');var squel=require(_0xc299('0xa'));var crypto=require(_0xc299('0xb'));var jsforce=require(_0xc299('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xc299('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xc299('0xd'));var authService=require(_0xc299('0xe'));var qs=require(_0xc299('0xf'));var as=require(_0xc299('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc299('0x11'))('api');var utils=require('../../config/utils');var config=require(_0xc299('0x12'));var licenseUtil=require(_0xc299('0x13'));var db=require(_0xc299('0x14'))['db'];function respondWithStatusCode(_0x1c8ba2,_0x24cfa4){_0x24cfa4=_0x24cfa4||0xcc;return function(_0x4bf78c){if(_0x4bf78c){return _0x1c8ba2[_0xc299('0x15')](_0x24cfa4);}return _0x1c8ba2[_0xc299('0x16')](_0x24cfa4)[_0xc299('0x17')]();};}function respondWithResult(_0x409bc3,_0x2cbb09){_0x2cbb09=_0x2cbb09||0xc8;return function(_0x3c0671){if(_0x3c0671){return _0x409bc3[_0xc299('0x16')](_0x2cbb09)[_0xc299('0x18')](_0x3c0671);}};}function respondWithFilteredResult(_0x433249,_0x1f99b2){return function(_0x37b816){if(_0x37b816){var _0x562647=typeof _0x1f99b2[_0xc299('0x19')]==='undefined'&&typeof _0x1f99b2[_0xc299('0x1a')]===_0xc299('0x1b');var _0x28c255=_0x37b816[_0xc299('0x1c')];var _0x8239dc=_0x562647?0x0:_0x1f99b2[_0xc299('0x19')];var _0xd29c4b=_0x562647?_0x37b816[_0xc299('0x1c')]:_0x1f99b2[_0xc299('0x19')]+_0x1f99b2[_0xc299('0x1a')];var _0x5f84dd;if(_0xd29c4b>=_0x28c255){_0xd29c4b=_0x28c255;_0x5f84dd=0xc8;}else{_0x5f84dd=0xce;}_0x433249[_0xc299('0x16')](_0x5f84dd);return _0x433249[_0xc299('0x1d')](_0xc299('0x1e'),_0x8239dc+'-'+_0xd29c4b+'/'+_0x28c255)[_0xc299('0x18')](_0x37b816);}return null;};}function patchUpdates(_0x506de2){return function(_0x169a53){try{jsonpatch[_0xc299('0x1f')](_0x169a53,_0x506de2,!![]);}catch(_0x383b41){return BPromise[_0xc299('0x20')](_0x383b41);}return _0x169a53['save']();};}function saveUpdates(_0x2652ad,_0x3969ee){return function(_0x410ec9){if(_0x410ec9){return _0x410ec9[_0xc299('0x21')](_0x2652ad)[_0xc299('0x22')](function(_0x3bc216){return _0x3bc216;});}return null;};}function removeEntity(_0x46987a,_0x3d7dca){return function(_0x55316e){if(_0x55316e){return _0x55316e[_0xc299('0x23')]()['then'](function(){var _0x58e3a8=_0x55316e[_0xc299('0x24')]({'plain':!![]});var _0x568014='Tags';return db[_0xc299('0x25')]['destroy']({'where':{'type':_0x568014,'resourceId':_0x58e3a8['id']}})[_0xc299('0x22')](function(){return _0x55316e;});})[_0xc299('0x22')](function(){_0x46987a[_0xc299('0x16')](0xcc)[_0xc299('0x17')]();});}};}function handleEntityNotFound(_0x39934d,_0x5a4366){return function(_0x50e0b2){if(!_0x50e0b2){_0x39934d[_0xc299('0x15')](0x194);}return _0x50e0b2;};}function handleError(_0x549e24,_0x4c1dea){_0x4c1dea=_0x4c1dea||0x1f4;return function(_0x2c6323){logger['error'](_0x2c6323[_0xc299('0x26')]);if(_0x2c6323[_0xc299('0x27')]){delete _0x2c6323[_0xc299('0x27')];}_0x549e24['status'](_0x4c1dea)[_0xc299('0x28')](_0x2c6323);};}exports[_0xc299('0x29')]=function(_0x1d7b22,_0x6655fe){var _0xadb70b={},_0x46ad1d={},_0x107ea0={'count':0x0,'rows':[]};var _0x91f74d=_[_0xc299('0x2a')](db[_0xc299('0x2b')]['rawAttributes'],function(_0x4504b5){return{'name':_0x4504b5[_0xc299('0x2c')],'type':_0x4504b5[_0xc299('0x2d')]['key']};});_0x46ad1d[_0xc299('0x2e')]=_[_0xc299('0x2a')](_0x91f74d,'name');_0x46ad1d[_0xc299('0x2f')]=_['keys'](_0x1d7b22['query']);_0x46ad1d[_0xc299('0x30')]=_[_0xc299('0x31')](_0x46ad1d[_0xc299('0x2e')],_0x46ad1d[_0xc299('0x2f')]);_0xadb70b[_0xc299('0x32')]=_[_0xc299('0x31')](_0x46ad1d['model'],qs[_0xc299('0x33')](_0x1d7b22[_0xc299('0x2f')][_0xc299('0x33')]));_0xadb70b[_0xc299('0x32')]=_0xadb70b[_0xc299('0x32')][_0xc299('0x34')]?_0xadb70b[_0xc299('0x32')]:_0x46ad1d[_0xc299('0x2e')];if(!_0x1d7b22[_0xc299('0x2f')][_0xc299('0x35')](_0xc299('0x36'))){_0xadb70b[_0xc299('0x1a')]=qs['limit'](_0x1d7b22[_0xc299('0x2f')]['limit']);_0xadb70b[_0xc299('0x19')]=qs[_0xc299('0x19')](_0x1d7b22[_0xc299('0x2f')]['offset']);}_0xadb70b[_0xc299('0x37')]=qs[_0xc299('0x38')](_0x1d7b22[_0xc299('0x2f')]['sort']);_0xadb70b[_0xc299('0x39')]=qs[_0xc299('0x30')](_[_0xc299('0x3a')](_0x1d7b22[_0xc299('0x2f')],_0x46ad1d[_0xc299('0x30')]),_0x91f74d);if(_0x1d7b22[_0xc299('0x2f')][_0xc299('0x3b')]){_0xadb70b[_0xc299('0x39')]=_[_0xc299('0x3c')](_0xadb70b[_0xc299('0x39')],{'$or':_[_0xc299('0x2a')](_0x91f74d,function(_0x53ddeb){if(_0x53ddeb[_0xc299('0x2d')]!==_0xc299('0x3d')){var _0x4b71a7={};_0x4b71a7[_0x53ddeb[_0xc299('0x27')]]={'$like':'%'+_0x1d7b22['query'][_0xc299('0x3b')]+'%'};return _0x4b71a7;}})});}_0xadb70b=_[_0xc299('0x3c')]({},_0xadb70b,_0x1d7b22[_0xc299('0x3e')]);var _0x53b40a={'where':_0xadb70b[_0xc299('0x39')]};return db[_0xc299('0x2b')]['count'](_0x53b40a)['then'](function(_0x43705e){_0x107ea0[_0xc299('0x1c')]=_0x43705e;if(_0x1d7b22[_0xc299('0x2f')][_0xc299('0x3f')]){_0xadb70b['include']=[{'all':!![]}];}return db[_0xc299('0x2b')][_0xc299('0x40')](_0xadb70b);})[_0xc299('0x22')](function(_0x4fc47f){_0x107ea0[_0xc299('0x41')]=_0x4fc47f;return _0x107ea0;})[_0xc299('0x22')](respondWithFilteredResult(_0x6655fe,_0xadb70b))[_0xc299('0x42')](handleError(_0x6655fe,null));};exports[_0xc299('0x43')]=function(_0x142944,_0x3aaa98){var _0x34fd19={'raw':!![],'where':{'id':_0x142944[_0xc299('0x44')]['id']}},_0x35e917={};_0x35e917[_0xc299('0x2e')]=_[_0xc299('0x45')](db[_0xc299('0x2b')][_0xc299('0x46')]);_0x35e917[_0xc299('0x2f')]=_[_0xc299('0x45')](_0x142944['query']);_0x35e917[_0xc299('0x30')]=_[_0xc299('0x31')](_0x35e917[_0xc299('0x2e')],_0x35e917[_0xc299('0x2f')]);_0x34fd19['attributes']=_[_0xc299('0x31')](_0x35e917[_0xc299('0x2e')],qs['fields'](_0x142944[_0xc299('0x2f')]['fields']));_0x34fd19[_0xc299('0x32')]=_0x34fd19[_0xc299('0x32')]['length']?_0x34fd19[_0xc299('0x32')]:_0x35e917[_0xc299('0x2e')];if(_0x142944[_0xc299('0x2f')]['includeAll']){_0x34fd19[_0xc299('0x47')]=[{'all':!![]}];}_0x34fd19=_[_0xc299('0x3c')]({},_0x34fd19,_0x142944['options']);return db[_0xc299('0x2b')][_0xc299('0x48')](_0x34fd19)[_0xc299('0x22')](handleEntityNotFound(_0x3aaa98,null))['then'](respondWithResult(_0x3aaa98,null))[_0xc299('0x42')](handleError(_0x3aaa98,null));};exports[_0xc299('0x49')]=function(_0x2e0b1b,_0x50fdd4){return db[_0xc299('0x2b')][_0xc299('0x49')](_0x2e0b1b[_0xc299('0x4a')],{})[_0xc299('0x22')](function(_0x157ad8){var _0x3b93c5=_0x2e0b1b[_0xc299('0x4b')]['get']({'plain':!![]});if(!_0x3b93c5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3b93c5['role']===_0xc299('0x4b')){var _0x253f5c=_0x157ad8[_0xc299('0x24')]({'plain':!![]});var _0x23c954='Tags';return db[_0xc299('0x4c')][_0xc299('0x48')]({'where':{'name':_0x23c954,'userProfileId':_0x3b93c5['userProfileId']},'raw':!![]})['then'](function(_0x33951a){if(_0x33951a&&_0x33951a['autoAssociation']===0x0){return db['UserProfileResource'][_0xc299('0x49')]({'name':_0x253f5c['name'],'resourceId':_0x253f5c['id'],'type':_0x33951a['name'],'sectionId':_0x33951a['id']},{})[_0xc299('0x22')](function(){return _0x157ad8;});}else{return _0x157ad8;}})[_0xc299('0x42')](function(_0x56a23e){logger[_0xc299('0x4d')](_0xc299('0x4e'),_0x56a23e);throw _0x56a23e;});}return _0x157ad8;})[_0xc299('0x22')](respondWithResult(_0x50fdd4,0xc9))[_0xc299('0x42')](handleError(_0x50fdd4,null));};exports[_0xc299('0x21')]=function(_0x2cca94,_0x481ce3){if(_0x2cca94['body']['id']){delete _0x2cca94[_0xc299('0x4a')]['id'];}return db[_0xc299('0x2b')]['find']({'where':{'id':_0x2cca94[_0xc299('0x44')]['id']}})[_0xc299('0x22')](handleEntityNotFound(_0x481ce3,null))['then'](saveUpdates(_0x2cca94['body'],null))[_0xc299('0x22')](respondWithResult(_0x481ce3,null))['catch'](handleError(_0x481ce3,null));};exports['destroy']=function(_0x3c1377,_0x35ffab){return db['Tag']['find']({'where':{'id':_0x3c1377[_0xc299('0x44')]['id']}})[_0xc299('0x22')](handleEntityNotFound(_0x35ffab,null))[_0xc299('0x22')](removeEntity(_0x35ffab,null))[_0xc299('0x42')](handleError(_0x35ffab,null));};exports['describe']=function(_0x620c1,_0x10e21e){return db[_0xc299('0x2b')]['describe']()['then'](respondWithResult(_0x10e21e,null))[_0xc299('0x42')](handleError(_0x10e21e,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index f70b503..ed6867a 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 _0x331c=['define','Tag','tools_tags','util','bluebird','request-promise','rimraf','../../config/environment','./tag.attributes'];(function(_0x134113,_0x33c944){var _0x4e6118=function(_0x61fb07){while(--_0x61fb07){_0x134113['push'](_0x134113['shift']());}};_0x4e6118(++_0x33c944);}(_0x331c,0xe4));var _0xc331=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x331c[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require('lodash');var util=require(_0xc331('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xc331('0x1'));var rp=require(_0xc331('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc331('0x3'));var config=require(_0xc331('0x4'));var attributes=require(_0xc331('0x5'));module['exports']=function(_0x1f6f78,_0x588301){return _0x1f6f78[_0xc331('0x6')](_0xc331('0x7'),attributes,{'tableName':_0xc331('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3685=['bluebird','request-promise','path','rimraf','../../config/environment','./tag.attributes','exports','define','Tag','tools_tags','lodash','../../config/logger','api','moment'];(function(_0x223461,_0x2bca70){var _0x4dbe0a=function(_0x3c3cb6){while(--_0x3c3cb6){_0x223461['push'](_0x223461['shift']());}};_0x4dbe0a(++_0x2bca70);}(_0x3685,0xf8));var _0x5368=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3685[_0x20a584];return _0x4b41a8;};'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':!![]});}; \ No newline at end of file diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index 971c79b..9fb6d55 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 _0x9c44=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','request\x20sent','debug','stringify','code','error','message','Tag,\x20%s,\x20%s','info','result','catch','moment','bluebird'];(function(_0x70096a,_0x92ae20){var _0x5b0d73=function(_0x27e373){while(--_0x27e373){_0x70096a['push'](_0x70096a['shift']());}};_0x5b0d73(++_0x92ae20);}(_0x9c44,0x178));var _0x49c4=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x9c44[_0x16b9ed];return _0x66b1f8;};'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']('Tag,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));logger[_0x49c4('0xc')]('Tag,\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')]('Tag,\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')]('Tag,\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 +var _0x4bc3=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','debug','Tag,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','Tag,\x20%s,\x20%s','message','result','catch','lodash','util'];(function(_0x756ec,_0x42a924){var _0x1d52ce=function(_0x58e720){while(--_0x58e720){_0x756ec['push'](_0x756ec['shift']());}};_0x1d52ce(++_0x42a924);}(_0x4bc3,0x16e));var _0x34bc=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0x4bc3[_0x2e4aa2];return _0x5e6092;};'use strict';var _=require(_0x34bc('0x0'));var util=require(_0x34bc('0x1'));var moment=require('moment');var BPromise=require(_0x34bc('0x2'));var rs=require(_0x34bc('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x34bc('0x4'))['db'];var utils=require(_0x34bc('0x5'));var logger=require(_0x34bc('0x6'))(_0x34bc('0x7'));var config=require(_0x34bc('0x8'));var jayson=require(_0x34bc('0x9'));var client=jayson[_0x34bc('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x21451b,_0x50320d,_0x502087){return new BPromise(function(_0x18a01c,_0x474108){return client[_0x34bc('0xb')](_0x21451b,_0x502087)[_0x34bc('0xc')](function(_0x409105){logger[_0x34bc('0xd')]('Tag,\x20%s,\x20%s',_0x50320d,'request\x20sent');logger[_0x34bc('0xe')](_0x34bc('0xf'),_0x50320d,_0x34bc('0x10'),JSON['stringify'](_0x409105));if(_0x409105[_0x34bc('0x11')]){if(_0x409105['error'][_0x34bc('0x12')]===0x1f4){logger[_0x34bc('0x11')](_0x34bc('0x13'),_0x50320d,_0x409105['error'][_0x34bc('0x14')]);return _0x474108(_0x409105['error'][_0x34bc('0x14')]);}logger[_0x34bc('0x11')](_0x34bc('0x13'),_0x50320d,_0x409105['error']['message']);return _0x18a01c(_0x409105[_0x34bc('0x11')]['message']);}else{logger[_0x34bc('0xd')](_0x34bc('0x13'),_0x50320d,_0x34bc('0x10'));_0x18a01c(_0x409105[_0x34bc('0x15')][_0x34bc('0x14')]);}})[_0x34bc('0x16')](function(_0x5e132d){logger['error']('Tag,\x20%s,\x20%s',_0x50320d,_0x5e132d);_0x474108(_0x5e132d);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 66443ef..0d17568 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(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa9e0[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/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(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_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/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 430e392..1d9f396 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 _0xb7e7=['STRING','sequelize'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0xb7e7,0x121));var _0x7b7e=function(_0x710815,_0x520da8){_0x710815=_0x710815-0x0;var _0x5b3b89=_0xb7e7[_0x710815];return _0x5b3b89;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'name':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x7b7e('0x1')]}}; \ No newline at end of file +var _0x0713=['STRING','name'];(function(_0x178b2e,_0xa83f44){var _0x42b0ec=function(_0x4afe1a){while(--_0x4afe1a){_0x178b2e['push'](_0x178b2e['shift']());}};_0x42b0ec(++_0xa83f44);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1')},'description':{'type':Sequelize[_0x3071('0x0')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 361adeb..eeecb2b 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 _0xdeb2=['key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','where','filter','merge','options','include','catch','show','params','includeAll','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','QueryTypes','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','VoiceQueueId','UserVoiceQueue','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','UserProfileResource','findOne','channel','isValidChannel','ValidationError','capitalize','Queue','sort','pick','toLowerCase','addQueues','Unknown\x20channel','removeQueues','remove','Queues','addAgents','ids','Voice','Chat','Mail','Sms','Fax','Whatsapp','penalty','QueueId','defaults','findOrCreate','emit','Queue:save','User','findAll','online','voicePause','UserVoiceQueueRt','upsert','isNil','interface','format','TeamVoiceQueue','all','spread','removeAgents','Queue:remove','getAgents','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./team.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','save','update','then','stack','name','send','map','Team','rawAttributes','fieldName','type'];(function(_0x4aed4b,_0x1d5032){var _0x32628d=function(_0x56210b){while(--_0x56210b){_0x4aed4b['push'](_0x4aed4b['shift']());}};_0x32628d(++_0x1d5032);}(_0xdeb2,0x107));var _0x2deb=function(_0x44a796,_0x889888){_0x44a796=_0x44a796-0x0;var _0x4795f5=_0xdeb2[_0x44a796];return _0x4795f5;};'use strict';var emlformat=require(_0x2deb('0x0'));var rimraf=require(_0x2deb('0x1'));var zipdir=require(_0x2deb('0x2'));var jsonpatch=require(_0x2deb('0x3'));var rp=require(_0x2deb('0x4'));var moment=require(_0x2deb('0x5'));var BPromise=require(_0x2deb('0x6'));var Mustache=require(_0x2deb('0x7'));var util=require(_0x2deb('0x8'));var path=require(_0x2deb('0x9'));var sox=require('sox');var csv=require(_0x2deb('0xa'));var ejs=require(_0x2deb('0xb'));var fs=require('fs');var fs_extra=require(_0x2deb('0xc'));var _=require(_0x2deb('0xd'));var squel=require('squel');var crypto=require(_0x2deb('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2deb('0xa'));var querystring=require(_0x2deb('0xf'));var Papa=require('papaparse');var Redis=require(_0x2deb('0x10'));var authService=require(_0x2deb('0x11'));var qs=require(_0x2deb('0x12'));var as=require(_0x2deb('0x13'));var hardwareService=require(_0x2deb('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x2deb('0x15'));var licenseUtil=require(_0x2deb('0x16'));var db=require(_0x2deb('0x17'))['db'];config[_0x2deb('0x18')]=_['defaults'](config[_0x2deb('0x18')],{'host':_0x2deb('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2deb('0x18')]));require(_0x2deb('0x1a'))[_0x2deb('0x1b')](socket);function respondWithStatusCode(_0x4ca1de,_0x27f3a9){_0x27f3a9=_0x27f3a9||0xcc;return function(_0x4c285e){if(_0x4c285e){return _0x4ca1de[_0x2deb('0x1c')](_0x27f3a9);}return _0x4ca1de[_0x2deb('0x1d')](_0x27f3a9)[_0x2deb('0x1e')]();};}function respondWithResult(_0x497b81,_0x5b496c){_0x5b496c=_0x5b496c||0xc8;return function(_0x566f85){if(_0x566f85){return _0x497b81[_0x2deb('0x1d')](_0x5b496c)[_0x2deb('0x1f')](_0x566f85);}};}function respondWithFilteredResult(_0x1d3008,_0x5cb942){return function(_0x51503a){if(_0x51503a){var _0x734490=typeof _0x5cb942[_0x2deb('0x20')]==='undefined'&&typeof _0x5cb942[_0x2deb('0x21')]===_0x2deb('0x22');var _0x52f6dd=_0x51503a['count'];var _0x2382e2=_0x734490?0x0:_0x5cb942[_0x2deb('0x20')];var _0x38f24f=_0x734490?_0x51503a[_0x2deb('0x23')]:_0x5cb942[_0x2deb('0x20')]+_0x5cb942[_0x2deb('0x21')];var _0x3cef3c;if(_0x38f24f>=_0x52f6dd){_0x38f24f=_0x52f6dd;_0x3cef3c=0xc8;}else{_0x3cef3c=0xce;}_0x1d3008['status'](_0x3cef3c);return _0x1d3008['set'](_0x2deb('0x24'),_0x2382e2+'-'+_0x38f24f+'/'+_0x52f6dd)[_0x2deb('0x1f')](_0x51503a);}return null;};}function patchUpdates(_0x3381ab){return function(_0x49ba05){try{jsonpatch[_0x2deb('0x25')](_0x49ba05,_0x3381ab,!![]);}catch(_0x2014c8){return BPromise['reject'](_0x2014c8);}return _0x49ba05[_0x2deb('0x26')]();};}function saveUpdates(_0x46be80,_0x59be33){return function(_0x14a185){if(_0x14a185){return _0x14a185[_0x2deb('0x27')](_0x46be80)[_0x2deb('0x28')](function(_0x2412a4){return _0x2412a4;});}return null;};}function handleEntityNotFound(_0x1e1a26,_0x29cd24){return function(_0x45bcb5){if(!_0x45bcb5){_0x1e1a26['sendStatus'](0x194);}return _0x45bcb5;};}function handleError(_0xec2daf,_0x1e9ae9){_0x1e9ae9=_0x1e9ae9||0x1f4;return function(_0x1a54e1){logger['error'](_0x1a54e1[_0x2deb('0x29')]);if(_0x1a54e1['name']){delete _0x1a54e1[_0x2deb('0x2a')];}_0xec2daf['status'](_0x1e9ae9)[_0x2deb('0x2b')](_0x1a54e1);};}exports['index']=function(_0x160b8d,_0x41185e){var _0x5d9f07={},_0xd4f48d={},_0x52f54a={'count':0x0,'rows':[]};var _0x885a78=_[_0x2deb('0x2c')](db[_0x2deb('0x2d')][_0x2deb('0x2e')],function(_0x5e653d){return{'name':_0x5e653d[_0x2deb('0x2f')],'type':_0x5e653d[_0x2deb('0x30')][_0x2deb('0x31')]};});_0xd4f48d[_0x2deb('0x32')]=_[_0x2deb('0x2c')](_0x885a78,'name');_0xd4f48d['query']=_[_0x2deb('0x33')](_0x160b8d[_0x2deb('0x34')]);_0xd4f48d[_0x2deb('0x35')]=_[_0x2deb('0x36')](_0xd4f48d[_0x2deb('0x32')],_0xd4f48d['query']);_0x5d9f07[_0x2deb('0x37')]=_['intersection'](_0xd4f48d[_0x2deb('0x32')],qs['fields'](_0x160b8d[_0x2deb('0x34')][_0x2deb('0x38')]));_0x5d9f07[_0x2deb('0x37')]=_0x5d9f07['attributes'][_0x2deb('0x39')]?_0x5d9f07['attributes']:_0xd4f48d[_0x2deb('0x32')];if(!_0x160b8d[_0x2deb('0x34')]['hasOwnProperty'](_0x2deb('0x3a'))){_0x5d9f07[_0x2deb('0x21')]=qs['limit'](_0x160b8d['query'][_0x2deb('0x21')]);_0x5d9f07[_0x2deb('0x20')]=qs[_0x2deb('0x20')](_0x160b8d['query'][_0x2deb('0x20')]);}_0x5d9f07[_0x2deb('0x3b')]=qs['sort'](_0x160b8d[_0x2deb('0x34')]['sort']);_0x5d9f07[_0x2deb('0x3c')]=qs[_0x2deb('0x35')](_['pick'](_0x160b8d[_0x2deb('0x34')],_0xd4f48d[_0x2deb('0x35')]),_0x885a78);if(_0x160b8d[_0x2deb('0x34')]['filter']){_0x5d9f07['where']=_['merge'](_0x5d9f07[_0x2deb('0x3c')],{'$or':_['map'](_0x885a78,function(_0x12051f){if(_0x12051f[_0x2deb('0x30')]!=='VIRTUAL'){var _0x343c60={};_0x343c60[_0x12051f['name']]={'$like':'%'+_0x160b8d['query'][_0x2deb('0x3d')]+'%'};return _0x343c60;}})});}_0x5d9f07=_[_0x2deb('0x3e')]({},_0x5d9f07,_0x160b8d[_0x2deb('0x3f')]);var _0x3b6207={'where':_0x5d9f07[_0x2deb('0x3c')]};return db['Team'][_0x2deb('0x23')](_0x3b6207)[_0x2deb('0x28')](function(_0xc016be){_0x52f54a[_0x2deb('0x23')]=_0xc016be;if(_0x160b8d[_0x2deb('0x34')]['includeAll']){_0x5d9f07[_0x2deb('0x40')]=[{'all':!![]}];}return db[_0x2deb('0x2d')]['findAll'](_0x5d9f07);})[_0x2deb('0x28')](function(_0x1ae5a9){_0x52f54a['rows']=_0x1ae5a9;return _0x52f54a;})[_0x2deb('0x28')](respondWithFilteredResult(_0x41185e,_0x5d9f07))[_0x2deb('0x41')](handleError(_0x41185e,null));};exports[_0x2deb('0x42')]=function(_0x3333f8,_0x405ac7){var _0x1c8175={'raw':![],'where':{'id':_0x3333f8[_0x2deb('0x43')]['id']}},_0x193c53={};_0x193c53['model']=_['keys'](db['Team'][_0x2deb('0x2e')]);_0x193c53[_0x2deb('0x34')]=_[_0x2deb('0x33')](_0x3333f8[_0x2deb('0x34')]);_0x193c53['filters']=_[_0x2deb('0x36')](_0x193c53[_0x2deb('0x32')],_0x193c53[_0x2deb('0x34')]);_0x1c8175['attributes']=_[_0x2deb('0x36')](_0x193c53[_0x2deb('0x32')],qs[_0x2deb('0x38')](_0x3333f8[_0x2deb('0x34')][_0x2deb('0x38')]));_0x1c8175['attributes']=_0x1c8175[_0x2deb('0x37')][_0x2deb('0x39')]?_0x1c8175['attributes']:_0x193c53[_0x2deb('0x32')];if(_0x3333f8[_0x2deb('0x34')][_0x2deb('0x44')]){_0x1c8175[_0x2deb('0x40')]=[{'all':!![]}];}_0x1c8175=_[_0x2deb('0x3e')]({},_0x1c8175,_0x3333f8[_0x2deb('0x3f')]);return db[_0x2deb('0x2d')][_0x2deb('0x45')](_0x1c8175)['then'](handleEntityNotFound(_0x405ac7,null))['then'](respondWithResult(_0x405ac7,null))[_0x2deb('0x41')](handleError(_0x405ac7,null));};exports[_0x2deb('0x46')]=function(_0x111f55,_0x2dd925){return db[_0x2deb('0x2d')][_0x2deb('0x46')](_0x111f55[_0x2deb('0x47')],{})['then'](function(_0x1e32a0){var _0x3a7897=_0x111f55[_0x2deb('0x48')][_0x2deb('0x49')]({'plain':!![]});if(!_0x3a7897)throw new Error(_0x2deb('0x4a'));if(_0x3a7897[_0x2deb('0x4b')]==='user'){var _0x4f7ea3=_0x1e32a0[_0x2deb('0x49')]({'plain':!![]});var _0x5a1f7e=_0x2deb('0x4c');return db[_0x2deb('0x4d')][_0x2deb('0x45')]({'where':{'name':_0x5a1f7e,'userProfileId':_0x3a7897[_0x2deb('0x4e')]},'raw':!![]})[_0x2deb('0x28')](function(_0x277a39){if(_0x277a39&&_0x277a39[_0x2deb('0x4f')]===0x0){return db['UserProfileResource'][_0x2deb('0x46')]({'name':_0x4f7ea3[_0x2deb('0x2a')],'resourceId':_0x4f7ea3['id'],'type':_0x277a39[_0x2deb('0x2a')],'sectionId':_0x277a39['id']},{})[_0x2deb('0x28')](function(){return _0x1e32a0;});}else{return _0x1e32a0;}})['catch'](function(_0x3f4c3e){logger['error'](_0x2deb('0x50'),_0x3f4c3e);throw _0x3f4c3e;});}return _0x1e32a0;})[_0x2deb('0x28')](respondWithResult(_0x2dd925,0xc9))[_0x2deb('0x41')](handleError(_0x2dd925,null));};exports[_0x2deb('0x27')]=function(_0x918d1e,_0x1f9e90){if(_0x918d1e[_0x2deb('0x47')]['id']){delete _0x918d1e[_0x2deb('0x47')]['id'];}return db[_0x2deb('0x2d')]['find']({'where':{'id':_0x918d1e[_0x2deb('0x43')]['id']}})[_0x2deb('0x28')](handleEntityNotFound(_0x1f9e90,null))[_0x2deb('0x28')](saveUpdates(_0x918d1e[_0x2deb('0x47')],null))[_0x2deb('0x28')](respondWithResult(_0x1f9e90,null))['catch'](handleError(_0x1f9e90,null));};exports[_0x2deb('0x51')]=function(_0x23826e,_0x108283){var _0x36ac58=_0x23826e[_0x2deb('0x43')]['id'];var _0x6091b9=[];return db[_0x2deb('0x52')][_0x2deb('0x53')](function(_0x551da0){var _0x4d874d=_0x2deb('0x54')+_0x36ac58;return db[_0x2deb('0x52')]['query'](_0x4d874d,{'type':db[_0x2deb('0x55')][_0x2deb('0x56')][_0x2deb('0x57')],'raw':!![],'transaction':_0x551da0})[_0x2deb('0x28')](function(_0x589edf){_0x6091b9=_[_0x2deb('0x2c')](_0x589edf,function(_0x3f4dc7){return Number(_0x3f4dc7[_0x2deb('0x58')]);});})['then'](function(){var _0x45bf1c=_0x2deb('0x59')+_0x36ac58;return db['sequelize'][_0x2deb('0x34')](_0x45bf1c,{'type':db[_0x2deb('0x55')][_0x2deb('0x56')][_0x2deb('0x57')],'raw':!![],'transaction':_0x551da0});})[_0x2deb('0x28')](function(_0x260b00){var _0x3c61ad=_[_0x2deb('0x2c')](_0x260b00,function(_0x2ac536){return Number(_0x2ac536[_0x2deb('0x5a')]);});return db[_0x2deb('0x5b')][_0x2deb('0x51')]({'where':{'UserId':{'$in':_0x6091b9},'VoiceQueueId':{'$in':_0x3c61ad}},'transaction':_0x551da0});})[_0x2deb('0x28')](function(){var _0xd4dbec='SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20'+_0x36ac58;return db[_0x2deb('0x52')][_0x2deb('0x34')](_0xd4dbec,{'type':db[_0x2deb('0x55')][_0x2deb('0x56')]['SELECT'],'raw':!![],'transaction':_0x551da0});})[_0x2deb('0x28')](function(_0x42caf8){var _0x1b4588=_[_0x2deb('0x2c')](_0x42caf8,function(_0xb7ffa5){return Number(_0xb7ffa5[_0x2deb('0x5c')]);});return db[_0x2deb('0x5d')][_0x2deb('0x51')]({'where':{'UserId':{'$in':_0x6091b9},'MailQueueId':{'$in':_0x1b4588}},'transaction':_0x551da0});})[_0x2deb('0x28')](function(){var _0x20dcdf=_0x2deb('0x5e')+_0x36ac58;return db[_0x2deb('0x52')][_0x2deb('0x34')](_0x20dcdf,{'type':db[_0x2deb('0x55')]['QueryTypes'][_0x2deb('0x57')],'raw':!![],'transaction':_0x551da0});})[_0x2deb('0x28')](function(_0x167511){var _0x55102d=_[_0x2deb('0x2c')](_0x167511,function(_0x27e274){return Number(_0x27e274['SmsQueueId']);});return db[_0x2deb('0x5f')][_0x2deb('0x51')]({'where':{'UserId':{'$in':_0x6091b9},'SmsQueueId':{'$in':_0x55102d}},'transaction':_0x551da0});})[_0x2deb('0x28')](function(){var _0x206c47=_0x2deb('0x60')+_0x36ac58;return db['sequelize']['query'](_0x206c47,{'type':db[_0x2deb('0x55')][_0x2deb('0x56')]['SELECT'],'raw':!![],'transaction':_0x551da0});})[_0x2deb('0x28')](function(_0xf26b69){var _0x9379fe=_['map'](_0xf26b69,function(_0x557147){return Number(_0x557147[_0x2deb('0x61')]);});return db[_0x2deb('0x62')][_0x2deb('0x51')]({'where':{'UserId':{'$in':_0x6091b9},'ChatQueueId':{'$in':_0x9379fe}},'transaction':_0x551da0});})[_0x2deb('0x28')](function(){var _0x49b4ed=_0x2deb('0x63')+_0x36ac58;return db[_0x2deb('0x52')][_0x2deb('0x34')](_0x49b4ed,{'type':db[_0x2deb('0x55')]['QueryTypes'][_0x2deb('0x57')],'raw':!![],'transaction':_0x551da0});})[_0x2deb('0x28')](function(_0x15592a){var _0x4f2175=_[_0x2deb('0x2c')](_0x15592a,function(_0x43ab27){return Number(_0x43ab27[_0x2deb('0x64')]);});return db[_0x2deb('0x65')][_0x2deb('0x51')]({'where':{'UserId':{'$in':_0x6091b9},'FaxQueueId':{'$in':_0x4f2175}},'transaction':_0x551da0});})['then'](function(){var _0x5b33a3=_0x2deb('0x66')+_0x36ac58;return db[_0x2deb('0x52')]['query'](_0x5b33a3,{'type':db[_0x2deb('0x55')][_0x2deb('0x56')][_0x2deb('0x57')],'raw':!![],'transaction':_0x551da0});})[_0x2deb('0x28')](function(_0x28dab9){var _0x54d7a2=_[_0x2deb('0x2c')](_0x28dab9,function(_0x5905f3){return Number(_0x5905f3[_0x2deb('0x67')]);});return db[_0x2deb('0x68')][_0x2deb('0x51')]({'where':{'UserId':{'$in':_0x6091b9},'OpenchannelQueueId':{'$in':_0x54d7a2}},'transaction':_0x551da0});})[_0x2deb('0x28')](function(){var _0x25d29a=_0x2deb('0x69')+_0x36ac58;return db['sequelize'][_0x2deb('0x34')](_0x25d29a,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x551da0});})[_0x2deb('0x28')](function(_0x124c51){var _0x333427=_['map'](_0x124c51,function(_0x49cd05){return Number(_0x49cd05[_0x2deb('0x6a')]);});return db[_0x2deb('0x6b')][_0x2deb('0x51')]({'where':{'UserId':{'$in':_0x6091b9},'WhatsappQueueId':{'$in':_0x333427}},'transaction':_0x551da0});})['then'](function(){return db[_0x2deb('0x6c')][_0x2deb('0x45')]({'where':{'TeamId':_0x36ac58}});})['then'](function(_0x3affdd){if(_0x3affdd===null){return;}return db[_0x2deb('0x6d')][_0x2deb('0x51')]({'where':{'UserId':{'$in':_0x6091b9},'VoicePrefixId':_0x3affdd[_0x2deb('0x6e')]},'transaction':_0x551da0});})[_0x2deb('0x28')](function(){return db['Team']['destroy']({'where':{'id':_0x36ac58},'cascade':!![],'transaction':_0x551da0});})[_0x2deb('0x28')](function(_0x3185cb){if(_0x3185cb===0x0){_0x108283['sendStatus'](0x194);}else{return db[_0x2deb('0x6f')]['destroy']({'where':{'type':_0x2deb('0x4c'),'resourceId':_0x36ac58},'cascade':!![],'transaction':_0x551da0})[_0x2deb('0x28')](function(){_0x108283['status'](0xcc)[_0x2deb('0x1e')]();});}})[_0x2deb('0x41')](function(_0x2e1cb1){_0x108283[_0x2deb('0x1d')](0x1f4)['send'](_0x2e1cb1);});});};exports['getQueues']=function(_0x20b6e1,_0x2be149,_0x73b6ee){return db[_0x2deb('0x2d')][_0x2deb('0x70')]({'where':{'id':_0x20b6e1['params']['id']}})[_0x2deb('0x28')](handleEntityNotFound(_0x2be149,null))[_0x2deb('0x28')](function(_0x2959d1){if(!_0x20b6e1[_0x2deb('0x34')][_0x2deb('0x71')]||!utils[_0x2deb('0x72')](_0x20b6e1[_0x2deb('0x34')][_0x2deb('0x71')])){throw new db[(_0x2deb('0x55'))][(_0x2deb('0x73'))]('Unknown\x20channel');}var _0x1f831d={};var _0xf28f7={};_0xf28f7['model']=_[_0x2deb('0x33')](db[_[_0x2deb('0x74')](_0x20b6e1[_0x2deb('0x34')][_0x2deb('0x71')]['toLowerCase']())+_0x2deb('0x75')]['rawAttributes']);_0xf28f7[_0x2deb('0x34')]=_[_0x2deb('0x33')](_0x20b6e1[_0x2deb('0x34')]);_0xf28f7[_0x2deb('0x35')]=_[_0x2deb('0x36')](_0xf28f7[_0x2deb('0x32')],_0xf28f7[_0x2deb('0x34')]);_0x1f831d[_0x2deb('0x37')]=_[_0x2deb('0x36')](_0xf28f7['model'],qs[_0x2deb('0x38')](_0x20b6e1[_0x2deb('0x34')][_0x2deb('0x38')]));_0x1f831d[_0x2deb('0x37')]=_0x1f831d[_0x2deb('0x37')][_0x2deb('0x39')]?_0x1f831d[_0x2deb('0x37')]:_0xf28f7[_0x2deb('0x32')];_0x1f831d[_0x2deb('0x21')]=qs['limit'](_0x20b6e1['query']['limit']);_0x1f831d[_0x2deb('0x20')]=qs['offset'](_0x20b6e1[_0x2deb('0x34')][_0x2deb('0x20')]);_0x1f831d[_0x2deb('0x3b')]=qs['sort'](_0x20b6e1[_0x2deb('0x34')][_0x2deb('0x76')]);_0x1f831d[_0x2deb('0x3c')]=qs[_0x2deb('0x35')](_[_0x2deb('0x77')](_0x20b6e1[_0x2deb('0x34')],_0xf28f7['filters']));_0x1f831d=_[_0x2deb('0x3e')]({},_0x1f831d,_0x20b6e1[_0x2deb('0x3f')]);return _0x2959d1[_0x2deb('0x49')+_[_0x2deb('0x74')](_0x20b6e1[_0x2deb('0x34')]['channel'][_0x2deb('0x78')]())+'Queues'](_0x1f831d);})[_0x2deb('0x28')](respondWithResult(_0x2be149,null))[_0x2deb('0x41')](handleError(_0x2be149,null));};exports[_0x2deb('0x79')]=function(_0x53d08f,_0x64a307,_0x27f53c){return db['Team']['findOne']({'where':{'id':_0x53d08f['params']['id']}})['then'](function(_0x1605aa){if(_0x1605aa){if(!_0x53d08f[_0x2deb('0x47')][_0x2deb('0x71')]||!utils[_0x2deb('0x72')](_0x53d08f[_0x2deb('0x47')][_0x2deb('0x71')])){throw new db[(_0x2deb('0x55'))][(_0x2deb('0x73'))](_0x2deb('0x7a'));}return _0x1605aa['add'+_[_0x2deb('0x74')](_0x53d08f[_0x2deb('0x47')][_0x2deb('0x71')][_0x2deb('0x78')]())+'Queues'](_0x53d08f[_0x2deb('0x47')]['ids']);}return null;})[_0x2deb('0x28')](handleEntityNotFound(_0x64a307,null))['then'](respondWithStatusCode(_0x64a307,null))['catch'](handleError(_0x64a307,null));};exports[_0x2deb('0x7b')]=function(_0x4a5bc5,_0x419bb1,_0x43d84d){return db[_0x2deb('0x2d')]['findOne']({'where':{'id':_0x4a5bc5['params']['id']}})['then'](function(_0x8c3af4){if(_0x8c3af4){if(!_0x4a5bc5[_0x2deb('0x34')][_0x2deb('0x71')]||!utils['isValidChannel'](_0x4a5bc5[_0x2deb('0x34')]['channel'])){throw new db[(_0x2deb('0x55'))][(_0x2deb('0x73'))](_0x2deb('0x7a'));}return _0x8c3af4[_0x2deb('0x7c')+_[_0x2deb('0x74')](_0x4a5bc5['query'][_0x2deb('0x71')][_0x2deb('0x78')]())+_0x2deb('0x7d')](_0x4a5bc5[_0x2deb('0x34')]['ids']);}return null;})[_0x2deb('0x28')](handleEntityNotFound(_0x419bb1,null))[_0x2deb('0x28')](respondWithStatusCode(_0x419bb1,null))['catch'](handleError(_0x419bb1,null));};exports[_0x2deb('0x7e')]=function(_0xea4449,_0x21519a){var _0x1de780=_['isArray'](_0xea4449[_0x2deb('0x47')][_0x2deb('0x7f')])?_0xea4449['body'][_0x2deb('0x7f')]:[_0xea4449[_0x2deb('0x47')][_0x2deb('0x7f')]];var _0x1d8bc6=_0xea4449[_0x2deb('0x43')]['id'];return db['Team'][_0x2deb('0x45')]({'where':{'id':_0x1d8bc6}})['then'](handleEntityNotFound(_0x21519a,null))[_0x2deb('0x28')](function(_0x1e331c){if(_0x1e331c){var _0x367bae=[_0x2deb('0x80'),_0x2deb('0x81'),_0x2deb('0x82'),_0x2deb('0x83'),_0x2deb('0x84'),'Openchannel',_0x2deb('0x85')];return db[_0x2deb('0x52')][_0x2deb('0x53')](function(_0x1be574){var _0xd7741=_[_0x2deb('0x2c')](_0x367bae,function(_0x5a5171){var _0xf51c73={'attributes':['id',_0x2deb('0x2a')]};if(_0x5a5171===_0x2deb('0x80')){_0xf51c73['through']={'attributes':[_0x2deb('0x86')]};}return _0x1e331c[_0x2deb('0x49')+_0x5a5171+_0x2deb('0x7d')](_0xf51c73)[_0x2deb('0x28')](function(_0x2c3560){var _0x2e5533=_[_0x2deb('0x2c')](_0x2c3560,function(_0x21bfe5){var _0x255493=_[_0x2deb('0x2c')](_0x1de780,function(_0x3d381f){var _0x5c9186={'where':{'UserId':_0x3d381f,[_0x5a5171+_0x2deb('0x87')]:_0x21bfe5['id']},'transaction':_0x1be574};if(_0x5a5171==='Voice'){_0x5c9186[_0x2deb('0x88')]={'penalty':_0x21bfe5['TeamVoiceQueue'][_0x2deb('0x86')]};}return db['User'+_0x5a5171+'Queue'][_0x2deb('0x89')](_0x5c9186)[_0x2deb('0x28')](function(){socket[_0x2deb('0x8a')](_0x2deb('0x48')+_0x5a5171+_0x2deb('0x8b'),{'UserId':_0x3d381f,[_0x5a5171+_0x2deb('0x87')]:_0x21bfe5['id']});if(_0x5a5171!==_0x2deb('0x80')){return;}return db[_0x2deb('0x8c')][_0x2deb('0x8d')]({'where':{'id':_0x1de780,'online':0x1},'attributes':['id',_0x2deb('0x2a'),_0x2deb('0x8e'),_0x2deb('0x8f'),'interface'],'raw':!![]})[_0x2deb('0x28')](function(_0x260d27){var _0x4bfcad=_[_0x2deb('0x2c')](_0x260d27,function(_0x4c57e1){return db[_0x2deb('0x90')][_0x2deb('0x91')]({'membername':_0x4c57e1[_0x2deb('0x2a')],'UserId':_0x4c57e1['id'],'queue_name':_0x21bfe5[_0x2deb('0x2a')],'VoiceQueueId':_0x21bfe5['id'],'interface':_[_0x2deb('0x92')](_0x4c57e1[_0x2deb('0x93')])?util[_0x2deb('0x94')]('SIP/%s',_0x4c57e1['name']):_0x4c57e1[_0x2deb('0x93')],'paused':_0x4c57e1[_0x2deb('0x8f')]||![],'penalty':_0x21bfe5[_0x2deb('0x95')]['penalty']},{'transaction':_0x1be574});});return Promise['all'](_0x4bfcad);});});});return Promise['all'](_0x255493);});return Promise[_0x2deb('0x96')](_0x2e5533);})[_0x2deb('0x28')](function(){return db[_0x2deb('0x6c')][_0x2deb('0x70')]({'where':{'teamId':_0x1d8bc6}})['then'](function(_0x2e75d7){if(_0x2e75d7){var _0x297703=_[_0x2deb('0x2c')](_0x1de780,function(_0x320213){db[_0x2deb('0x6d')]['upsert']({'UserId':_0x320213,'VoicePrefixId':_0x2e75d7[_0x2deb('0x6e')]});});return Promise['all'](_0x297703);}});});});return Promise[_0x2deb('0x96')](_0xd7741)[_0x2deb('0x28')](function(){return _0x1e331c[_0x2deb('0x7e')](_0x1de780,{'transaction':_0x1be574})[_0x2deb('0x97')](function(_0x29790d){return _0x29790d;});});});}})[_0x2deb('0x28')](respondWithResult(_0x21519a,null))[_0x2deb('0x41')](handleError(_0x21519a,null));};exports[_0x2deb('0x98')]=function(_0x5d30c5,_0x5612d2){var _0x4c7c14=_['isArray'](_0x5d30c5[_0x2deb('0x34')]['ids'])?_0x5d30c5[_0x2deb('0x34')][_0x2deb('0x7f')]:[_0x5d30c5[_0x2deb('0x34')][_0x2deb('0x7f')]];var _0x244d32=_0x5d30c5[_0x2deb('0x43')]['id'];return db[_0x2deb('0x2d')]['find']({'where':{'id':_0x244d32}})[_0x2deb('0x28')](handleEntityNotFound(_0x5612d2,null))[_0x2deb('0x28')](function(_0x4c0f23){if(_0x4c0f23){var _0x5be340=['Voice','Chat',_0x2deb('0x82'),_0x2deb('0x83'),_0x2deb('0x84'),'Openchannel',_0x2deb('0x85')];return db[_0x2deb('0x52')][_0x2deb('0x53')](function(_0x521fce){var _0x32bbf7=_['map'](_0x5be340,function(_0x38c76f){var _0x4a4a3e={'attributes':['id',_0x2deb('0x2a')]};return _0x4c0f23[_0x2deb('0x49')+_0x38c76f+_0x2deb('0x7d')](_0x4a4a3e)['then'](function(_0x18a3f6){var _0x862c1a=_[_0x2deb('0x2c')](_0x18a3f6,function(_0x8e84f2){return _0x8e84f2[_0x2deb('0x98')](_0x4c7c14,{'transaction':_0x521fce})['then'](function(){var _0x5e5e1d=_[_0x2deb('0x2c')](_0x4c7c14,function(_0x4275de){socket['emit']('user'+_0x38c76f+_0x2deb('0x99'),{'UserId':Number(_0x4275de),[_0x38c76f+_0x2deb('0x87')]:_0x8e84f2['id']});if(_0x38c76f!=='Voice'){return;}return db[_0x2deb('0x90')][_0x2deb('0x51')]({'where':{'VoiceQueueId':_0x8e84f2['id'],'UserId':_0x4275de},'transaction':_0x521fce});});return Promise['all'](_0x5e5e1d);});});return Promise['all'](_0x862c1a);});});return Promise['all'](_0x32bbf7)[_0x2deb('0x28')](function(){return _0x4c0f23['removeAgents'](_0x4c7c14,{'transaction':_0x521fce});})[_0x2deb('0x28')](function(){return db['TeamVoicePrefix'][_0x2deb('0x70')]({'where':{'teamId':_0x244d32}})[_0x2deb('0x28')](function(_0x52d93e){if(_0x52d93e){var _0x4758de=_[_0x2deb('0x2c')](_0x4c7c14,function(_0x40f69b){db[_0x2deb('0x6d')][_0x2deb('0x51')]({'where':{'UserId':_0x40f69b,'VoicePrefixId':_0x52d93e[_0x2deb('0x6e')]}});});return Promise['all'](_0x4758de);}});});});}})[_0x2deb('0x28')](respondWithStatusCode(_0x5612d2,null))['catch'](handleError(_0x5612d2,null));};exports[_0x2deb('0x9a')]=function(_0x3f81e3,_0x3d2ecb,_0x364c7b){var _0x5aeadb={};var _0x12e3d9={};var _0x497e20;var _0x1652f1;return db[_0x2deb('0x2d')][_0x2deb('0x70')]({'where':{'id':_0x3f81e3[_0x2deb('0x43')]['id']}})[_0x2deb('0x28')](handleEntityNotFound(_0x3d2ecb,null))['then'](function(_0x166c2b){if(_0x166c2b){_0x497e20=_0x166c2b;_0x12e3d9['model']=_[_0x2deb('0x33')](db[_0x2deb('0x8c')][_0x2deb('0x2e')]);_0x12e3d9[_0x2deb('0x34')]=_[_0x2deb('0x33')](_0x3f81e3[_0x2deb('0x34')]);_0x12e3d9['filters']=_[_0x2deb('0x36')](_0x12e3d9[_0x2deb('0x32')],_0x12e3d9[_0x2deb('0x34')]);_0x5aeadb[_0x2deb('0x37')]=_[_0x2deb('0x36')](_0x12e3d9[_0x2deb('0x32')],qs[_0x2deb('0x38')](_0x3f81e3['query'][_0x2deb('0x38')]));_0x5aeadb[_0x2deb('0x37')]=_0x5aeadb['attributes'][_0x2deb('0x39')]?_0x5aeadb[_0x2deb('0x37')]:_0x12e3d9['model'];_0x5aeadb['order']=qs[_0x2deb('0x76')](_0x3f81e3[_0x2deb('0x34')][_0x2deb('0x76')]);_0x5aeadb[_0x2deb('0x3c')]=qs['filters'](_[_0x2deb('0x77')](_0x3f81e3[_0x2deb('0x34')],_0x12e3d9[_0x2deb('0x35')]));if(_0x3f81e3[_0x2deb('0x34')][_0x2deb('0x3d')]){_0x5aeadb[_0x2deb('0x3c')]=_[_0x2deb('0x3e')](_0x5aeadb[_0x2deb('0x3c')],{'$or':_['map'](_0x5aeadb[_0x2deb('0x37')],function(_0x4c770f){var _0x306020={};_0x306020[_0x4c770f]={'$like':'%'+_0x3f81e3[_0x2deb('0x34')]['filter']+'%'};return _0x306020;})});}_0x5aeadb=_['merge']({},_0x5aeadb,_0x3f81e3['options']);return _0x497e20[_0x2deb('0x9a')](_0x5aeadb);}})[_0x2deb('0x28')](function(_0x1870de){if(_0x1870de){_0x1652f1=_0x1870de[_0x2deb('0x39')];if(!_0x3f81e3['query'][_0x2deb('0x9b')](_0x2deb('0x3a'))){_0x5aeadb[_0x2deb('0x21')]=qs[_0x2deb('0x21')](_0x3f81e3[_0x2deb('0x34')][_0x2deb('0x21')]);_0x5aeadb[_0x2deb('0x20')]=qs[_0x2deb('0x20')](_0x3f81e3[_0x2deb('0x34')]['offset']);}return _0x497e20[_0x2deb('0x9a')](_0x5aeadb);}})[_0x2deb('0x28')](function(_0x47ea7b){if(_0x47ea7b){return _0x47ea7b?{'count':_0x1652f1,'rows':_0x47ea7b}:null;}})[_0x2deb('0x28')](respondWithResult(_0x3d2ecb,null))[_0x2deb('0x41')](handleError(_0x3d2ecb,null));}; \ No newline at end of file +var _0x1671=['Openchannel','Whatsapp','through','penalty','QueueId','defaults','TeamVoiceQueue','User','findOrCreate','emit','Queue:save','findAll','voicePause','interface','upsert','isNil','format','SIP/%s','all','spread','removeAgents','Queue:remove','UserVoiceQueueRt','VoicePrefixId','getAgents','nolimit','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','update','then','error','stack','name','send','index','map','Team','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','include','rows','show','params','includeAll','find','catch','create','body','user','get','role','Teams','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','destroy','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','UserId','VoiceQueueId','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','UserFaxQueue','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','TeamVoicePrefix','UserVoicePrefix','getQueues','findOne','channel','isValidChannel','ValidationError','Unknown\x20channel','toLowerCase','Queue','length','capitalize','Queues','addQueues','add','removeQueues','ids','addAgents','isArray','Voice','Mail','Sms','Fax'];(function(_0x48f4bb,_0x582160){var _0xdf78cb=function(_0x36da52){while(--_0x36da52){_0x48f4bb['push'](_0x48f4bb['shift']());}};_0xdf78cb(++_0x582160);}(_0x1671,0xb6));var _0x1167=function(_0x14aad1,_0x5350e4){_0x14aad1=_0x14aad1-0x0;var _0x2b3163=_0x1671[_0x14aad1];return _0x2b3163;};'use strict';var emlformat=require(_0x1167('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1167('0x1'));var jsonpatch=require(_0x1167('0x2'));var rp=require('request-promise');var moment=require(_0x1167('0x3'));var BPromise=require(_0x1167('0x4'));var Mustache=require(_0x1167('0x5'));var util=require(_0x1167('0x6'));var path=require(_0x1167('0x7'));var sox=require('sox');var csv=require(_0x1167('0x8'));var ejs=require(_0x1167('0x9'));var fs=require('fs');var fs_extra=require(_0x1167('0xa'));var _=require('lodash');var squel=require(_0x1167('0xb'));var crypto=require(_0x1167('0xc'));var jsforce=require(_0x1167('0xd'));var deskjs=require(_0x1167('0xe'));var toCsv=require('to-csv');var querystring=require(_0x1167('0xf'));var Papa=require(_0x1167('0x10'));var Redis=require(_0x1167('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x1167('0x12'));var as=require(_0x1167('0x13'));var hardwareService=require(_0x1167('0x14'));var logger=require(_0x1167('0x15'))(_0x1167('0x16'));var utils=require('../../config/utils');var config=require(_0x1167('0x17'));var licenseUtil=require(_0x1167('0x18'));var db=require(_0x1167('0x19'))['db'];config[_0x1167('0x1a')]=_['defaults'](config['redis'],{'host':_0x1167('0x1b'),'port':0x18eb});var socket=require(_0x1167('0x1c'))(new Redis(config[_0x1167('0x1a')]));require('./team.socket')['register'](socket);function respondWithStatusCode(_0x5378c6,_0x26100b){_0x26100b=_0x26100b||0xcc;return function(_0x2513c5){if(_0x2513c5){return _0x5378c6[_0x1167('0x1d')](_0x26100b);}return _0x5378c6[_0x1167('0x1e')](_0x26100b)[_0x1167('0x1f')]();};}function respondWithResult(_0x2ecb2a,_0x4db7e1){_0x4db7e1=_0x4db7e1||0xc8;return function(_0x444fbe){if(_0x444fbe){return _0x2ecb2a['status'](_0x4db7e1)[_0x1167('0x20')](_0x444fbe);}};}function respondWithFilteredResult(_0x5e25e1,_0x38c5cb){return function(_0x41c310){if(_0x41c310){var _0x5b91da=typeof _0x38c5cb[_0x1167('0x21')]===_0x1167('0x22')&&typeof _0x38c5cb[_0x1167('0x23')]===_0x1167('0x22');var _0x34ac53=_0x41c310[_0x1167('0x24')];var _0x4f943d=_0x5b91da?0x0:_0x38c5cb[_0x1167('0x21')];var _0x4afd6b=_0x5b91da?_0x41c310[_0x1167('0x24')]:_0x38c5cb[_0x1167('0x21')]+_0x38c5cb[_0x1167('0x23')];var _0x29fc2b;if(_0x4afd6b>=_0x34ac53){_0x4afd6b=_0x34ac53;_0x29fc2b=0xc8;}else{_0x29fc2b=0xce;}_0x5e25e1['status'](_0x29fc2b);return _0x5e25e1[_0x1167('0x25')]('Content-Range',_0x4f943d+'-'+_0x4afd6b+'/'+_0x34ac53)[_0x1167('0x20')](_0x41c310);}return null;};}function patchUpdates(_0x32ba22){return function(_0x3e73fb){try{jsonpatch['apply'](_0x3e73fb,_0x32ba22,!![]);}catch(_0x2c4fe2){return BPromise[_0x1167('0x26')](_0x2c4fe2);}return _0x3e73fb[_0x1167('0x27')]();};}function saveUpdates(_0x39b25f,_0x52c5e5){return function(_0x5d6351){if(_0x5d6351){return _0x5d6351[_0x1167('0x28')](_0x39b25f)[_0x1167('0x29')](function(_0x16436f){return _0x16436f;});}return null;};}function handleEntityNotFound(_0x2797d3,_0x3ad12e){return function(_0x17f21b){if(!_0x17f21b){_0x2797d3[_0x1167('0x1d')](0x194);}return _0x17f21b;};}function handleError(_0x5a3e2d,_0xd9b2b6){_0xd9b2b6=_0xd9b2b6||0x1f4;return function(_0x3556b9){logger[_0x1167('0x2a')](_0x3556b9[_0x1167('0x2b')]);if(_0x3556b9[_0x1167('0x2c')]){delete _0x3556b9[_0x1167('0x2c')];}_0x5a3e2d[_0x1167('0x1e')](_0xd9b2b6)[_0x1167('0x2d')](_0x3556b9);};}exports[_0x1167('0x2e')]=function(_0x1388a5,_0x8fcdc){var _0x293b3a={},_0x1402c8={},_0x140e69={'count':0x0,'rows':[]};var _0x46e4cd=_[_0x1167('0x2f')](db[_0x1167('0x30')][_0x1167('0x31')],function(_0x31d6f0){return{'name':_0x31d6f0[_0x1167('0x32')],'type':_0x31d6f0[_0x1167('0x33')][_0x1167('0x34')]};});_0x1402c8[_0x1167('0x35')]=_[_0x1167('0x2f')](_0x46e4cd,'name');_0x1402c8['query']=_[_0x1167('0x36')](_0x1388a5[_0x1167('0x37')]);_0x1402c8[_0x1167('0x38')]=_[_0x1167('0x39')](_0x1402c8[_0x1167('0x35')],_0x1402c8['query']);_0x293b3a[_0x1167('0x3a')]=_['intersection'](_0x1402c8[_0x1167('0x35')],qs[_0x1167('0x3b')](_0x1388a5['query']['fields']));_0x293b3a[_0x1167('0x3a')]=_0x293b3a[_0x1167('0x3a')]['length']?_0x293b3a['attributes']:_0x1402c8[_0x1167('0x35')];if(!_0x1388a5[_0x1167('0x37')][_0x1167('0x3c')]('nolimit')){_0x293b3a[_0x1167('0x23')]=qs[_0x1167('0x23')](_0x1388a5[_0x1167('0x37')][_0x1167('0x23')]);_0x293b3a[_0x1167('0x21')]=qs[_0x1167('0x21')](_0x1388a5[_0x1167('0x37')][_0x1167('0x21')]);}_0x293b3a[_0x1167('0x3d')]=qs[_0x1167('0x3e')](_0x1388a5['query'][_0x1167('0x3e')]);_0x293b3a[_0x1167('0x3f')]=qs[_0x1167('0x38')](_[_0x1167('0x40')](_0x1388a5[_0x1167('0x37')],_0x1402c8[_0x1167('0x38')]),_0x46e4cd);if(_0x1388a5[_0x1167('0x37')][_0x1167('0x41')]){_0x293b3a[_0x1167('0x3f')]=_['merge'](_0x293b3a[_0x1167('0x3f')],{'$or':_[_0x1167('0x2f')](_0x46e4cd,function(_0x3bb019){if(_0x3bb019[_0x1167('0x33')]!==_0x1167('0x42')){var _0x38f363={};_0x38f363[_0x3bb019['name']]={'$like':'%'+_0x1388a5['query'][_0x1167('0x41')]+'%'};return _0x38f363;}})});}_0x293b3a=_[_0x1167('0x43')]({},_0x293b3a,_0x1388a5[_0x1167('0x44')]);var _0xed39ab={'where':_0x293b3a[_0x1167('0x3f')]};return db[_0x1167('0x30')]['count'](_0xed39ab)[_0x1167('0x29')](function(_0x32dd4d){_0x140e69[_0x1167('0x24')]=_0x32dd4d;if(_0x1388a5[_0x1167('0x37')]['includeAll']){_0x293b3a[_0x1167('0x45')]=[{'all':!![]}];}return db[_0x1167('0x30')]['findAll'](_0x293b3a);})[_0x1167('0x29')](function(_0x4733c1){_0x140e69[_0x1167('0x46')]=_0x4733c1;return _0x140e69;})['then'](respondWithFilteredResult(_0x8fcdc,_0x293b3a))['catch'](handleError(_0x8fcdc,null));};exports[_0x1167('0x47')]=function(_0x22dcb2,_0x166913){var _0x33fb02={'raw':![],'where':{'id':_0x22dcb2[_0x1167('0x48')]['id']}},_0x46f999={};_0x46f999[_0x1167('0x35')]=_[_0x1167('0x36')](db['Team']['rawAttributes']);_0x46f999[_0x1167('0x37')]=_[_0x1167('0x36')](_0x22dcb2[_0x1167('0x37')]);_0x46f999[_0x1167('0x38')]=_[_0x1167('0x39')](_0x46f999[_0x1167('0x35')],_0x46f999['query']);_0x33fb02['attributes']=_['intersection'](_0x46f999[_0x1167('0x35')],qs['fields'](_0x22dcb2[_0x1167('0x37')][_0x1167('0x3b')]));_0x33fb02[_0x1167('0x3a')]=_0x33fb02['attributes']['length']?_0x33fb02[_0x1167('0x3a')]:_0x46f999[_0x1167('0x35')];if(_0x22dcb2[_0x1167('0x37')][_0x1167('0x49')]){_0x33fb02[_0x1167('0x45')]=[{'all':!![]}];}_0x33fb02=_[_0x1167('0x43')]({},_0x33fb02,_0x22dcb2['options']);return db[_0x1167('0x30')][_0x1167('0x4a')](_0x33fb02)[_0x1167('0x29')](handleEntityNotFound(_0x166913,null))[_0x1167('0x29')](respondWithResult(_0x166913,null))[_0x1167('0x4b')](handleError(_0x166913,null));};exports[_0x1167('0x4c')]=function(_0xa0e9a4,_0x30a464){return db[_0x1167('0x30')][_0x1167('0x4c')](_0xa0e9a4[_0x1167('0x4d')],{})[_0x1167('0x29')](function(_0x702698){var _0x331acc=_0xa0e9a4[_0x1167('0x4e')][_0x1167('0x4f')]({'plain':!![]});if(!_0x331acc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x331acc[_0x1167('0x50')]===_0x1167('0x4e')){var _0x24de8d=_0x702698[_0x1167('0x4f')]({'plain':!![]});var _0x3d54d9=_0x1167('0x51');return db[_0x1167('0x52')]['find']({'where':{'name':_0x3d54d9,'userProfileId':_0x331acc[_0x1167('0x53')]},'raw':!![]})[_0x1167('0x29')](function(_0x4c4c35){if(_0x4c4c35&&_0x4c4c35[_0x1167('0x54')]===0x0){return db[_0x1167('0x55')]['create']({'name':_0x24de8d['name'],'resourceId':_0x24de8d['id'],'type':_0x4c4c35[_0x1167('0x2c')],'sectionId':_0x4c4c35['id']},{})[_0x1167('0x29')](function(){return _0x702698;});}else{return _0x702698;}})[_0x1167('0x4b')](function(_0x361050){logger[_0x1167('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x361050);throw _0x361050;});}return _0x702698;})[_0x1167('0x29')](respondWithResult(_0x30a464,0xc9))['catch'](handleError(_0x30a464,null));};exports[_0x1167('0x28')]=function(_0x5da66b,_0x17954d){if(_0x5da66b[_0x1167('0x4d')]['id']){delete _0x5da66b[_0x1167('0x4d')]['id'];}return db[_0x1167('0x30')][_0x1167('0x4a')]({'where':{'id':_0x5da66b[_0x1167('0x48')]['id']}})[_0x1167('0x29')](handleEntityNotFound(_0x17954d,null))[_0x1167('0x29')](saveUpdates(_0x5da66b[_0x1167('0x4d')],null))[_0x1167('0x29')](respondWithResult(_0x17954d,null))['catch'](handleError(_0x17954d,null));};exports[_0x1167('0x56')]=function(_0x10c8c4,_0x401c21){var _0x433bf5=_0x10c8c4[_0x1167('0x48')]['id'];var _0x1d1e2d=[];return db['sequelize'][_0x1167('0x57')](function(_0x190386){var _0x147e85=_0x1167('0x58')+_0x433bf5;return db[_0x1167('0x59')]['query'](_0x147e85,{'type':db[_0x1167('0x5a')][_0x1167('0x5b')][_0x1167('0x5c')],'raw':!![],'transaction':_0x190386})[_0x1167('0x29')](function(_0x2d4c2a){_0x1d1e2d=_[_0x1167('0x2f')](_0x2d4c2a,function(_0x57535a){return Number(_0x57535a[_0x1167('0x5d')]);});})['then'](function(){var _0x318ae1='SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20'+_0x433bf5;return db[_0x1167('0x59')][_0x1167('0x37')](_0x318ae1,{'type':db['Sequelize'][_0x1167('0x5b')][_0x1167('0x5c')],'raw':!![],'transaction':_0x190386});})[_0x1167('0x29')](function(_0x5ee0eb){var _0x182fc5=_[_0x1167('0x2f')](_0x5ee0eb,function(_0x2092a2){return Number(_0x2092a2[_0x1167('0x5e')]);});return db['UserVoiceQueue'][_0x1167('0x56')]({'where':{'UserId':{'$in':_0x1d1e2d},'VoiceQueueId':{'$in':_0x182fc5}},'transaction':_0x190386});})['then'](function(){var _0x2b3408='SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20'+_0x433bf5;return db[_0x1167('0x59')]['query'](_0x2b3408,{'type':db['Sequelize'][_0x1167('0x5b')][_0x1167('0x5c')],'raw':!![],'transaction':_0x190386});})[_0x1167('0x29')](function(_0x355361){var _0x2daaa5=_[_0x1167('0x2f')](_0x355361,function(_0x41518d){return Number(_0x41518d[_0x1167('0x5f')]);});return db[_0x1167('0x60')]['destroy']({'where':{'UserId':{'$in':_0x1d1e2d},'MailQueueId':{'$in':_0x2daaa5}},'transaction':_0x190386});})[_0x1167('0x29')](function(){var _0xa91878=_0x1167('0x61')+_0x433bf5;return db[_0x1167('0x59')]['query'](_0xa91878,{'type':db[_0x1167('0x5a')][_0x1167('0x5b')][_0x1167('0x5c')],'raw':!![],'transaction':_0x190386});})[_0x1167('0x29')](function(_0x1deeab){var _0x3d9e08=_[_0x1167('0x2f')](_0x1deeab,function(_0x572771){return Number(_0x572771['SmsQueueId']);});return db[_0x1167('0x62')][_0x1167('0x56')]({'where':{'UserId':{'$in':_0x1d1e2d},'SmsQueueId':{'$in':_0x3d9e08}},'transaction':_0x190386});})[_0x1167('0x29')](function(){var _0x4355df=_0x1167('0x63')+_0x433bf5;return db[_0x1167('0x59')][_0x1167('0x37')](_0x4355df,{'type':db[_0x1167('0x5a')][_0x1167('0x5b')][_0x1167('0x5c')],'raw':!![],'transaction':_0x190386});})[_0x1167('0x29')](function(_0x8c9983){var _0x4fe90b=_[_0x1167('0x2f')](_0x8c9983,function(_0x2049c5){return Number(_0x2049c5[_0x1167('0x64')]);});return db[_0x1167('0x65')][_0x1167('0x56')]({'where':{'UserId':{'$in':_0x1d1e2d},'ChatQueueId':{'$in':_0x4fe90b}},'transaction':_0x190386});})['then'](function(){var _0x444538=_0x1167('0x66')+_0x433bf5;return db[_0x1167('0x59')][_0x1167('0x37')](_0x444538,{'type':db[_0x1167('0x5a')][_0x1167('0x5b')]['SELECT'],'raw':!![],'transaction':_0x190386});})['then'](function(_0x36c335){var _0x2f019a=_[_0x1167('0x2f')](_0x36c335,function(_0x3856a2){return Number(_0x3856a2[_0x1167('0x67')]);});return db[_0x1167('0x68')]['destroy']({'where':{'UserId':{'$in':_0x1d1e2d},'FaxQueueId':{'$in':_0x2f019a}},'transaction':_0x190386});})['then'](function(){var _0x50b278='SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20'+_0x433bf5;return db['sequelize'][_0x1167('0x37')](_0x50b278,{'type':db[_0x1167('0x5a')][_0x1167('0x5b')][_0x1167('0x5c')],'raw':!![],'transaction':_0x190386});})[_0x1167('0x29')](function(_0x8201e7){var _0x3b3255=_[_0x1167('0x2f')](_0x8201e7,function(_0x5065ee){return Number(_0x5065ee['OpenchannelQueueId']);});return db[_0x1167('0x69')][_0x1167('0x56')]({'where':{'UserId':{'$in':_0x1d1e2d},'OpenchannelQueueId':{'$in':_0x3b3255}},'transaction':_0x190386});})[_0x1167('0x29')](function(){var _0x53a427=_0x1167('0x6a')+_0x433bf5;return db[_0x1167('0x59')][_0x1167('0x37')](_0x53a427,{'type':db[_0x1167('0x5a')]['QueryTypes'][_0x1167('0x5c')],'raw':!![],'transaction':_0x190386});})[_0x1167('0x29')](function(_0x2cda43){var _0x4daa1d=_[_0x1167('0x2f')](_0x2cda43,function(_0x5f4f11){return Number(_0x5f4f11['WhatsappQueueId']);});return db['UserWhatsappQueue'][_0x1167('0x56')]({'where':{'UserId':{'$in':_0x1d1e2d},'WhatsappQueueId':{'$in':_0x4daa1d}},'transaction':_0x190386});})[_0x1167('0x29')](function(){return db[_0x1167('0x6b')][_0x1167('0x4a')]({'where':{'TeamId':_0x433bf5}});})['then'](function(_0x2651f3){if(_0x2651f3===null){return;}return db[_0x1167('0x6c')]['destroy']({'where':{'UserId':{'$in':_0x1d1e2d},'VoicePrefixId':_0x2651f3['VoicePrefixId']},'transaction':_0x190386});})[_0x1167('0x29')](function(){return db['Team'][_0x1167('0x56')]({'where':{'id':_0x433bf5},'cascade':!![],'transaction':_0x190386});})[_0x1167('0x29')](function(_0x5887d2){if(_0x5887d2===0x0){_0x401c21['sendStatus'](0x194);}else{return db['UserProfileResource'][_0x1167('0x56')]({'where':{'type':_0x1167('0x51'),'resourceId':_0x433bf5},'cascade':!![],'transaction':_0x190386})['then'](function(){_0x401c21[_0x1167('0x1e')](0xcc)['end']();});}})['catch'](function(_0x14ace0){_0x401c21[_0x1167('0x1e')](0x1f4)[_0x1167('0x2d')](_0x14ace0);});});};exports[_0x1167('0x6d')]=function(_0x3e906f,_0x276c15,_0x1bd4ba){return db['Team'][_0x1167('0x6e')]({'where':{'id':_0x3e906f['params']['id']}})['then'](handleEntityNotFound(_0x276c15,null))[_0x1167('0x29')](function(_0x32ca89){if(!_0x3e906f[_0x1167('0x37')][_0x1167('0x6f')]||!utils[_0x1167('0x70')](_0x3e906f[_0x1167('0x37')]['channel'])){throw new db['Sequelize'][(_0x1167('0x71'))](_0x1167('0x72'));}var _0x49172a={};var _0x12af9d={};_0x12af9d[_0x1167('0x35')]=_['keys'](db[_['capitalize'](_0x3e906f[_0x1167('0x37')][_0x1167('0x6f')][_0x1167('0x73')]())+_0x1167('0x74')][_0x1167('0x31')]);_0x12af9d['query']=_[_0x1167('0x36')](_0x3e906f[_0x1167('0x37')]);_0x12af9d[_0x1167('0x38')]=_[_0x1167('0x39')](_0x12af9d[_0x1167('0x35')],_0x12af9d['query']);_0x49172a[_0x1167('0x3a')]=_[_0x1167('0x39')](_0x12af9d[_0x1167('0x35')],qs[_0x1167('0x3b')](_0x3e906f['query'][_0x1167('0x3b')]));_0x49172a['attributes']=_0x49172a[_0x1167('0x3a')][_0x1167('0x75')]?_0x49172a[_0x1167('0x3a')]:_0x12af9d[_0x1167('0x35')];_0x49172a[_0x1167('0x23')]=qs[_0x1167('0x23')](_0x3e906f[_0x1167('0x37')][_0x1167('0x23')]);_0x49172a[_0x1167('0x21')]=qs[_0x1167('0x21')](_0x3e906f[_0x1167('0x37')]['offset']);_0x49172a[_0x1167('0x3d')]=qs[_0x1167('0x3e')](_0x3e906f['query'][_0x1167('0x3e')]);_0x49172a['where']=qs[_0x1167('0x38')](_[_0x1167('0x40')](_0x3e906f['query'],_0x12af9d[_0x1167('0x38')]));_0x49172a=_['merge']({},_0x49172a,_0x3e906f[_0x1167('0x44')]);return _0x32ca89[_0x1167('0x4f')+_[_0x1167('0x76')](_0x3e906f[_0x1167('0x37')][_0x1167('0x6f')][_0x1167('0x73')]())+_0x1167('0x77')](_0x49172a);})[_0x1167('0x29')](respondWithResult(_0x276c15,null))[_0x1167('0x4b')](handleError(_0x276c15,null));};exports[_0x1167('0x78')]=function(_0x1a1fa6,_0xcce5ea,_0x519749){return db['Team'][_0x1167('0x6e')]({'where':{'id':_0x1a1fa6[_0x1167('0x48')]['id']}})['then'](function(_0x552f8e){if(_0x552f8e){if(!_0x1a1fa6[_0x1167('0x4d')][_0x1167('0x6f')]||!utils[_0x1167('0x70')](_0x1a1fa6[_0x1167('0x4d')]['channel'])){throw new db[(_0x1167('0x5a'))][(_0x1167('0x71'))](_0x1167('0x72'));}return _0x552f8e[_0x1167('0x79')+_[_0x1167('0x76')](_0x1a1fa6[_0x1167('0x4d')]['channel'][_0x1167('0x73')]())+_0x1167('0x77')](_0x1a1fa6[_0x1167('0x4d')]['ids']);}return null;})[_0x1167('0x29')](handleEntityNotFound(_0xcce5ea,null))[_0x1167('0x29')](respondWithStatusCode(_0xcce5ea,null))[_0x1167('0x4b')](handleError(_0xcce5ea,null));};exports[_0x1167('0x7a')]=function(_0x52511d,_0xa5e641,_0x43fedc){return db['Team'][_0x1167('0x6e')]({'where':{'id':_0x52511d[_0x1167('0x48')]['id']}})[_0x1167('0x29')](function(_0xf88a79){if(_0xf88a79){if(!_0x52511d['query'][_0x1167('0x6f')]||!utils[_0x1167('0x70')](_0x52511d[_0x1167('0x37')][_0x1167('0x6f')])){throw new db[(_0x1167('0x5a'))][(_0x1167('0x71'))](_0x1167('0x72'));}return _0xf88a79['remove'+_[_0x1167('0x76')](_0x52511d[_0x1167('0x37')][_0x1167('0x6f')][_0x1167('0x73')]())+'Queues'](_0x52511d[_0x1167('0x37')][_0x1167('0x7b')]);}return null;})['then'](handleEntityNotFound(_0xa5e641,null))[_0x1167('0x29')](respondWithStatusCode(_0xa5e641,null))['catch'](handleError(_0xa5e641,null));};exports[_0x1167('0x7c')]=function(_0x1c935c,_0x22ed19){var _0x4c699e=_[_0x1167('0x7d')](_0x1c935c['body'][_0x1167('0x7b')])?_0x1c935c[_0x1167('0x4d')][_0x1167('0x7b')]:[_0x1c935c[_0x1167('0x4d')]['ids']];var _0x9381e7=_0x1c935c['params']['id'];return db[_0x1167('0x30')][_0x1167('0x4a')]({'where':{'id':_0x9381e7}})[_0x1167('0x29')](handleEntityNotFound(_0x22ed19,null))[_0x1167('0x29')](function(_0x20184e){if(_0x20184e){var _0x58d707=[_0x1167('0x7e'),'Chat',_0x1167('0x7f'),_0x1167('0x80'),_0x1167('0x81'),_0x1167('0x82'),_0x1167('0x83')];return db['sequelize'][_0x1167('0x57')](function(_0x29dbab){var _0x4b95d0=_[_0x1167('0x2f')](_0x58d707,function(_0x13ce78){var _0x3c42c2={'attributes':['id',_0x1167('0x2c')]};if(_0x13ce78==='Voice'){_0x3c42c2[_0x1167('0x84')]={'attributes':[_0x1167('0x85')]};}return _0x20184e[_0x1167('0x4f')+_0x13ce78+_0x1167('0x77')](_0x3c42c2)[_0x1167('0x29')](function(_0x65f50b){var _0x6c9f3=_[_0x1167('0x2f')](_0x65f50b,function(_0xb028b1){var _0x523791=_[_0x1167('0x2f')](_0x4c699e,function(_0x407ce9){var _0x1fc390={'where':{'UserId':_0x407ce9,[_0x13ce78+_0x1167('0x86')]:_0xb028b1['id']},'transaction':_0x29dbab};if(_0x13ce78===_0x1167('0x7e')){_0x1fc390[_0x1167('0x87')]={'penalty':_0xb028b1[_0x1167('0x88')]['penalty']};}return db[_0x1167('0x89')+_0x13ce78+'Queue'][_0x1167('0x8a')](_0x1fc390)[_0x1167('0x29')](function(){socket[_0x1167('0x8b')](_0x1167('0x4e')+_0x13ce78+_0x1167('0x8c'),{'UserId':_0x407ce9,[_0x13ce78+'QueueId']:_0xb028b1['id']});if(_0x13ce78!=='Voice'){return;}return db[_0x1167('0x89')][_0x1167('0x8d')]({'where':{'id':_0x4c699e,'online':0x1},'attributes':['id',_0x1167('0x2c'),'online',_0x1167('0x8e'),_0x1167('0x8f')],'raw':!![]})['then'](function(_0x267705){var _0x20d994=_[_0x1167('0x2f')](_0x267705,function(_0x5be755){return db['UserVoiceQueueRt'][_0x1167('0x90')]({'membername':_0x5be755[_0x1167('0x2c')],'UserId':_0x5be755['id'],'queue_name':_0xb028b1['name'],'VoiceQueueId':_0xb028b1['id'],'interface':_[_0x1167('0x91')](_0x5be755[_0x1167('0x8f')])?util[_0x1167('0x92')](_0x1167('0x93'),_0x5be755['name']):_0x5be755[_0x1167('0x8f')],'paused':_0x5be755['voicePause']||![],'penalty':_0xb028b1['TeamVoiceQueue'][_0x1167('0x85')]},{'transaction':_0x29dbab});});return Promise['all'](_0x20d994);});});});return Promise[_0x1167('0x94')](_0x523791);});return Promise['all'](_0x6c9f3);})[_0x1167('0x29')](function(){return db[_0x1167('0x6b')][_0x1167('0x6e')]({'where':{'teamId':_0x9381e7}})[_0x1167('0x29')](function(_0x130100){if(_0x130100){var _0x1caf1e=_[_0x1167('0x2f')](_0x4c699e,function(_0x159145){db[_0x1167('0x6c')][_0x1167('0x90')]({'UserId':_0x159145,'VoicePrefixId':_0x130100['VoicePrefixId']});});return Promise[_0x1167('0x94')](_0x1caf1e);}});});});return Promise[_0x1167('0x94')](_0x4b95d0)[_0x1167('0x29')](function(){return _0x20184e['addAgents'](_0x4c699e,{'transaction':_0x29dbab})[_0x1167('0x95')](function(_0x1671c3){return _0x1671c3;});});});}})[_0x1167('0x29')](respondWithResult(_0x22ed19,null))[_0x1167('0x4b')](handleError(_0x22ed19,null));};exports[_0x1167('0x96')]=function(_0x50d210,_0x2bb159){var _0x106b2c=_['isArray'](_0x50d210[_0x1167('0x37')][_0x1167('0x7b')])?_0x50d210[_0x1167('0x37')][_0x1167('0x7b')]:[_0x50d210[_0x1167('0x37')][_0x1167('0x7b')]];var _0x53be59=_0x50d210[_0x1167('0x48')]['id'];return db[_0x1167('0x30')][_0x1167('0x4a')]({'where':{'id':_0x53be59}})['then'](handleEntityNotFound(_0x2bb159,null))[_0x1167('0x29')](function(_0x290331){if(_0x290331){var _0xce21ab=[_0x1167('0x7e'),'Chat',_0x1167('0x7f'),_0x1167('0x80'),_0x1167('0x81'),_0x1167('0x82'),_0x1167('0x83')];return db[_0x1167('0x59')]['transaction'](function(_0x1a3f33){var _0x14eb0b=_[_0x1167('0x2f')](_0xce21ab,function(_0x48a60d){var _0x4ebe77={'attributes':['id','name']};return _0x290331[_0x1167('0x4f')+_0x48a60d+_0x1167('0x77')](_0x4ebe77)[_0x1167('0x29')](function(_0xce1f43){var _0xa6825f=_[_0x1167('0x2f')](_0xce1f43,function(_0x491a19){return _0x491a19[_0x1167('0x96')](_0x106b2c,{'transaction':_0x1a3f33})[_0x1167('0x29')](function(){var _0xea2aa=_[_0x1167('0x2f')](_0x106b2c,function(_0x1f7301){socket[_0x1167('0x8b')]('user'+_0x48a60d+_0x1167('0x97'),{'UserId':Number(_0x1f7301),[_0x48a60d+'QueueId']:_0x491a19['id']});if(_0x48a60d!==_0x1167('0x7e')){return;}return db[_0x1167('0x98')]['destroy']({'where':{'VoiceQueueId':_0x491a19['id'],'UserId':_0x1f7301},'transaction':_0x1a3f33});});return Promise[_0x1167('0x94')](_0xea2aa);});});return Promise[_0x1167('0x94')](_0xa6825f);});});return Promise['all'](_0x14eb0b)[_0x1167('0x29')](function(){return _0x290331['removeAgents'](_0x106b2c,{'transaction':_0x1a3f33});})[_0x1167('0x29')](function(){return db['TeamVoicePrefix']['findOne']({'where':{'teamId':_0x53be59}})[_0x1167('0x29')](function(_0x5c0619){if(_0x5c0619){var _0x2d7f1f=_[_0x1167('0x2f')](_0x106b2c,function(_0x411ac7){db[_0x1167('0x6c')]['destroy']({'where':{'UserId':_0x411ac7,'VoicePrefixId':_0x5c0619[_0x1167('0x99')]}});});return Promise[_0x1167('0x94')](_0x2d7f1f);}});});});}})['then'](respondWithStatusCode(_0x2bb159,null))[_0x1167('0x4b')](handleError(_0x2bb159,null));};exports[_0x1167('0x9a')]=function(_0x18987f,_0x57eaac,_0xf61813){var _0x20dbeb={};var _0x397065={};var _0x1c9154;var _0x140a21;return db[_0x1167('0x30')][_0x1167('0x6e')]({'where':{'id':_0x18987f['params']['id']}})['then'](handleEntityNotFound(_0x57eaac,null))[_0x1167('0x29')](function(_0x739f6a){if(_0x739f6a){_0x1c9154=_0x739f6a;_0x397065[_0x1167('0x35')]=_[_0x1167('0x36')](db[_0x1167('0x89')][_0x1167('0x31')]);_0x397065[_0x1167('0x37')]=_[_0x1167('0x36')](_0x18987f[_0x1167('0x37')]);_0x397065[_0x1167('0x38')]=_[_0x1167('0x39')](_0x397065[_0x1167('0x35')],_0x397065[_0x1167('0x37')]);_0x20dbeb[_0x1167('0x3a')]=_[_0x1167('0x39')](_0x397065[_0x1167('0x35')],qs[_0x1167('0x3b')](_0x18987f['query'][_0x1167('0x3b')]));_0x20dbeb[_0x1167('0x3a')]=_0x20dbeb['attributes'][_0x1167('0x75')]?_0x20dbeb[_0x1167('0x3a')]:_0x397065[_0x1167('0x35')];_0x20dbeb[_0x1167('0x3d')]=qs[_0x1167('0x3e')](_0x18987f[_0x1167('0x37')][_0x1167('0x3e')]);_0x20dbeb[_0x1167('0x3f')]=qs[_0x1167('0x38')](_[_0x1167('0x40')](_0x18987f[_0x1167('0x37')],_0x397065[_0x1167('0x38')]));if(_0x18987f[_0x1167('0x37')]['filter']){_0x20dbeb[_0x1167('0x3f')]=_[_0x1167('0x43')](_0x20dbeb[_0x1167('0x3f')],{'$or':_[_0x1167('0x2f')](_0x20dbeb[_0x1167('0x3a')],function(_0x4172aa){var _0x842d5a={};_0x842d5a[_0x4172aa]={'$like':'%'+_0x18987f[_0x1167('0x37')][_0x1167('0x41')]+'%'};return _0x842d5a;})});}_0x20dbeb=_[_0x1167('0x43')]({},_0x20dbeb,_0x18987f[_0x1167('0x44')]);return _0x1c9154[_0x1167('0x9a')](_0x20dbeb);}})[_0x1167('0x29')](function(_0x14956d){if(_0x14956d){_0x140a21=_0x14956d[_0x1167('0x75')];if(!_0x18987f[_0x1167('0x37')]['hasOwnProperty'](_0x1167('0x9b'))){_0x20dbeb[_0x1167('0x23')]=qs[_0x1167('0x23')](_0x18987f[_0x1167('0x37')][_0x1167('0x23')]);_0x20dbeb['offset']=qs[_0x1167('0x21')](_0x18987f[_0x1167('0x37')][_0x1167('0x21')]);}return _0x1c9154[_0x1167('0x9a')](_0x20dbeb);}})['then'](function(_0x5b88ef){if(_0x5b88ef){return _0x5b88ef?{'count':_0x140a21,'rows':_0x5b88ef}:null;}})[_0x1167('0x29')](respondWithResult(_0x57eaac,null))[_0x1167('0x4b')](handleError(_0x57eaac,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index ac17866..9380ebd 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 _0xa090=['events','../../mysqldb','Team','setMaxListeners','remove','emit','hasOwnProperty','hook','exports'];(function(_0x2b6aa8,_0x3fc9f0){var _0x4cce17=function(_0x53b421){while(--_0x53b421){_0x2b6aa8['push'](_0x2b6aa8['shift']());}};_0x4cce17(++_0x3fc9f0);}(_0xa090,0x19e));var _0x0a09=function(_0x5f49c0,_0x27a1b4){_0x5f49c0=_0x5f49c0-0x0;var _0x5ab653=_0xa090[_0x5f49c0];return _0x5ab653;};'use strict';var EventEmitter=require(_0x0a09('0x0'));var Team=require(_0x0a09('0x1'))['db'][_0x0a09('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0x0a09('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x0a09('0x4')};function emitEvent(_0x158170){return function(_0x3c94a5,_0x52d517,_0x183855){TeamEvents[_0x0a09('0x5')](_0x158170+':'+_0x3c94a5['id'],_0x3c94a5);TeamEvents['emit'](_0x158170,_0x3c94a5);_0x183855(null);};}for(var e in events){if(events[_0x0a09('0x6')](e)){var event=events[e];Team[_0x0a09('0x7')](e,emitEvent(event));}}module[_0x0a09('0x8')]=TeamEvents; \ No newline at end of file +var _0xc37d=['save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','Team','setMaxListeners'];(function(_0x4de877,_0x340170){var _0xb2cfeb=function(_0x488634){while(--_0x488634){_0x4de877['push'](_0x4de877['shift']());}};_0xb2cfeb(++_0x340170);}(_0xc37d,0x114));var _0xdc37=function(_0x777d60,_0x2e2677){_0x777d60=_0x777d60-0x0;var _0x2691a7=_0xc37d[_0x777d60];return _0x2691a7;};'use strict';var EventEmitter=require(_0xdc37('0x0'));var Team=require(_0xdc37('0x1'))['db'][_0xdc37('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0xdc37('0x3')](0x0);var events={'afterCreate':_0xdc37('0x4'),'afterUpdate':_0xdc37('0x5'),'afterDestroy':_0xdc37('0x6')};function emitEvent(_0x14c0df){return function(_0x4b1aab,_0x10a38e,_0x284642){TeamEvents[_0xdc37('0x7')](_0x14c0df+':'+_0x4b1aab['id'],_0x4b1aab);TeamEvents['emit'](_0x14c0df,_0x4b1aab);_0x284642(null);};}for(var e in events){if(events[_0xdc37('0x8')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module[_0xdc37('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 392fc9f..a8bc0aa 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 _0x00ce=['Whatsapp','all','lodash','./team.attributes','get','Queues','then','setDataValue','channel','catch','define','teams','Chat','Fax','Mail','Openchannel','Voice'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x00ce,0x8a));var _0xe00c=function(_0x2f8dbf,_0x3c52f7){_0x2f8dbf=_0x2f8dbf-0x0;var _0x44ae82=_0x00ce[_0x2f8dbf];return _0x44ae82;};'use strict';var _=require(_0xe00c('0x0'));var attributes=require(_0xe00c('0x1'));function getQueuesByChannel(_0x465e63,_0x894caa){var _0x5a0e22=_0xe00c('0x2')+_0x894caa+_0xe00c('0x3');return _0x465e63[_0x5a0e22]()[_0xe00c('0x4')](function(_0x498e2b){return _['map'](_0x498e2b,function(_0x3135c1){_0x3135c1[_0xe00c('0x5')](_0xe00c('0x6'),_0x894caa);return _0x3135c1;});})[_0xe00c('0x7')](function(_0x36aa59){throw _0x36aa59;});}module['exports']=function(_0x48f6ee){return _0x48f6ee[_0xe00c('0x8')]('Team',attributes,{'tableName':_0xe00c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x4b594e=this;var _0x34be7b=[_0xe00c('0xa'),_0xe00c('0xb'),_0xe00c('0xc'),_0xe00c('0xd'),'Sms',_0xe00c('0xe'),_0xe00c('0xf')];return Promise['resolve']()[_0xe00c('0x4')](function(){var _0x4eb524=_['map'](_0x34be7b,function(_0x201b42){return getQueuesByChannel(_0x4b594e,_0x201b42);});return Promise[_0xe00c('0x10')](_0x4eb524);})[_0xe00c('0x7')](function(_0xf2316c){throw _0xf2316c;});}}});}; \ No newline at end of file +var _0x5060=['Team','teams','Chat','Mail','Openchannel','Sms','Whatsapp','resolve','catch','./team.attributes','get','then','map','channel','exports','define'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5060,0x169));var _0x0506=function(_0x1cec22,_0x34766e){_0x1cec22=_0x1cec22-0x0;var _0x547137=_0x5060[_0x1cec22];return _0x547137;};'use strict';var _=require('lodash');var attributes=require(_0x0506('0x0'));function getQueuesByChannel(_0x1761f5,_0x570710){var _0x239a26=_0x0506('0x1')+_0x570710+'Queues';return _0x1761f5[_0x239a26]()[_0x0506('0x2')](function(_0x16870d){return _[_0x0506('0x3')](_0x16870d,function(_0x4e4814){_0x4e4814['setDataValue'](_0x0506('0x4'),_0x570710);return _0x4e4814;});})['catch'](function(_0x1b84e9){throw _0x1b84e9;});}module[_0x0506('0x5')]=function(_0xebbfaf){return _0xebbfaf[_0x0506('0x6')](_0x0506('0x7'),attributes,{'tableName':_0x0506('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x54c333=this;var _0x4a76a1=[_0x0506('0x9'),'Fax',_0x0506('0xa'),_0x0506('0xb'),_0x0506('0xc'),'Voice',_0x0506('0xd')];return Promise[_0x0506('0xe')]()[_0x0506('0x2')](function(){var _0x2a22d3=_['map'](_0x4a76a1,function(_0x4d2dfd){return getQueuesByChannel(_0x54c333,_0x4d2dfd);});return Promise['all'](_0x2a22d3);})[_0x0506('0xf')](function(_0x1d4393){throw _0x1d4393;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 1842bea..ad5cddb 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 _0x79f0=['../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','./team.socket','request','then','info','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x348465,_0x5e91db){var _0x528c27=function(_0x2cac94){while(--_0x2cac94){_0x348465['push'](_0x348465['shift']());}};_0x528c27(++_0x5e91db);}(_0x79f0,0x1bd));var _0x079f=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0x79f0[_0x37bd26];return _0xe83dc4;};'use strict';var _=require(_0x079f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x079f('0x1'));var rs=require(_0x079f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x079f('0x3'))['db'];var utils=require(_0x079f('0x4'));var logger=require(_0x079f('0x5'))(_0x079f('0x6'));var config=require(_0x079f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x079f('0x8')]['http']({'port':0x232a});config[_0x079f('0x9')]=_[_0x079f('0xa')](config[_0x079f('0x9')],{'host':_0x079f('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x079f('0x9')]));require(_0x079f('0xc'))['register'](socket);function respondWithRpcPromise(_0x439d62,_0x5567bc,_0x13bd59){return new BPromise(function(_0x290e33,_0x499c34){return client[_0x079f('0xd')](_0x439d62,_0x13bd59)[_0x079f('0xe')](function(_0x36258a){logger[_0x079f('0xf')](_0x079f('0x10'),_0x5567bc,_0x079f('0x11'));logger[_0x079f('0x12')](_0x079f('0x13'),_0x5567bc,_0x079f('0x11'),JSON[_0x079f('0x14')](_0x36258a));if(_0x36258a[_0x079f('0x15')]){if(_0x36258a['error'][_0x079f('0x16')]===0x1f4){logger[_0x079f('0x15')](_0x079f('0x10'),_0x5567bc,_0x36258a['error'][_0x079f('0x17')]);return _0x499c34(_0x36258a[_0x079f('0x15')][_0x079f('0x17')]);}logger[_0x079f('0x15')](_0x079f('0x10'),_0x5567bc,_0x36258a[_0x079f('0x15')][_0x079f('0x17')]);return _0x290e33(_0x36258a[_0x079f('0x15')][_0x079f('0x17')]);}else{logger[_0x079f('0xf')](_0x079f('0x10'),_0x5567bc,_0x079f('0x11'));_0x290e33(_0x36258a['result']['message']);}})[_0x079f('0x18')](function(_0x167cdd){logger[_0x079f('0x15')](_0x079f('0x10'),_0x5567bc,_0x167cdd);_0x499c34(_0x167cdd);});});} \ No newline at end of file +var _0x7ecd=['ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','redis','localhost','socket.io-emitter','./team.socket','request','info','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring'];(function(_0x11d16e,_0x2db04e){var _0x15f553=function(_0x1af47d){while(--_0x1af47d){_0x11d16e['push'](_0x11d16e['shift']());}};_0x15f553(++_0x2db04e);}(_0x7ecd,0x1ea));var _0xd7ec=function(_0x5440f5,_0x53f0a7){_0x5440f5=_0x5440f5-0x0;var _0x5f4694=_0x7ecd[_0x5440f5];return _0x5f4694;};'use strict';var _=require(_0xd7ec('0x0'));var util=require(_0xd7ec('0x1'));var moment=require(_0xd7ec('0x2'));var BPromise=require('bluebird');var rs=require(_0xd7ec('0x3'));var fs=require('fs');var Redis=require(_0xd7ec('0x4'));var db=require(_0xd7ec('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd7ec('0x6'))(_0xd7ec('0x7'));var config=require('../../config/environment');var jayson=require(_0xd7ec('0x8'));var client=jayson[_0xd7ec('0x9')]['http']({'port':0x232a});config[_0xd7ec('0xa')]=_['defaults'](config[_0xd7ec('0xa')],{'host':_0xd7ec('0xb'),'port':0x18eb});var socket=require(_0xd7ec('0xc'))(new Redis(config[_0xd7ec('0xa')]));require(_0xd7ec('0xd'))['register'](socket);function respondWithRpcPromise(_0x5d4a4,_0x4b77ef,_0x3f2239){return new BPromise(function(_0x5e4037,_0x5ab5ae){return client[_0xd7ec('0xe')](_0x5d4a4,_0x3f2239)['then'](function(_0x23265e){logger[_0xd7ec('0xf')](_0xd7ec('0x10'),_0x4b77ef,_0xd7ec('0x11'));logger[_0xd7ec('0x12')](_0xd7ec('0x13'),_0x4b77ef,_0xd7ec('0x11'),JSON[_0xd7ec('0x14')](_0x23265e));if(_0x23265e['error']){if(_0x23265e[_0xd7ec('0x15')][_0xd7ec('0x16')]===0x1f4){logger[_0xd7ec('0x15')](_0xd7ec('0x10'),_0x4b77ef,_0x23265e[_0xd7ec('0x15')][_0xd7ec('0x17')]);return _0x5ab5ae(_0x23265e[_0xd7ec('0x15')]['message']);}logger[_0xd7ec('0x15')]('Team,\x20%s,\x20%s',_0x4b77ef,_0x23265e[_0xd7ec('0x15')][_0xd7ec('0x17')]);return _0x5e4037(_0x23265e[_0xd7ec('0x15')][_0xd7ec('0x17')]);}else{logger[_0xd7ec('0xf')](_0xd7ec('0x10'),_0x4b77ef,_0xd7ec('0x11'));_0x5e4037(_0x23265e[_0xd7ec('0x18')][_0xd7ec('0x17')]);}})[_0xd7ec('0x19')](function(_0x3cfbe0){logger[_0xd7ec('0x15')](_0xd7ec('0x10'),_0x4b77ef,_0x3cfbe0);_0x5ab5ae(_0x3cfbe0);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index e094f22..a86cc62 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 _0xc302=['remove','emit','removeListener','register','length','team:','save'];(function(_0x54de0f,_0x44768f){var _0xb63f2f=function(_0x57a2eb){while(--_0x57a2eb){_0x54de0f['push'](_0x54de0f['shift']());}};_0xb63f2f(++_0x44768f);}(_0xc302,0x187));var _0x2c30=function(_0x5cdc51,_0x55d150){_0x5cdc51=_0x5cdc51-0x0;var _0xffac50=_0xc302[_0x5cdc51];return _0xffac50;};'use strict';var TeamEvents=require('./team.events');var events=[_0x2c30('0x0'),_0x2c30('0x1'),'update'];function createListener(_0x2c1646,_0x1b34ac){return function(_0x4a1bbd){_0x1b34ac[_0x2c30('0x2')](_0x2c1646,_0x4a1bbd);};}function removeListener(_0xfbc477,_0x3e25d2){return function(){TeamEvents[_0x2c30('0x3')](_0xfbc477,_0x3e25d2);};}exports[_0x2c30('0x4')]=function(_0x704356){for(var _0x15a0f3=0x0,_0x220aeb=events[_0x2c30('0x5')];_0x15a0f3<_0x220aeb;_0x15a0f3++){var _0x2bc1ff=events[_0x15a0f3];var _0x8ff690=createListener(_0x2c30('0x6')+_0x2bc1ff,_0x704356);TeamEvents['on'](_0x2bc1ff,_0x8ff690);}}; \ No newline at end of file +var _0xa79a=['removeListener','length','team:','./team.events','save','remove','update'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0xa79a,0x1df));var _0xaa79=function(_0x413970,_0x11edf5){_0x413970=_0x413970-0x0;var _0x1f8282=_0xa79a[_0x413970];return _0x1f8282;};'use strict';var TeamEvents=require(_0xaa79('0x0'));var events=[_0xaa79('0x1'),_0xaa79('0x2'),_0xaa79('0x3')];function createListener(_0x3731a3,_0x42e9d5){return function(_0x2f394c){_0x42e9d5['emit'](_0x3731a3,_0x2f394c);};}function removeListener(_0x277f15,_0x22dd6b){return function(){TeamEvents[_0xaa79('0x4')](_0x277f15,_0x22dd6b);};}exports['register']=function(_0x53193a){for(var _0x5b45c9=0x0,_0x287425=events[_0xaa79('0x5')];_0x5b45c9<_0x287425;_0x5b45c9++){var _0x3c4bec=events[_0x5b45c9];var _0x2a64ac=createListener(_0xaa79('0x6')+_0x3c4bec,_0x53193a);TeamEvents['on'](_0x3c4bec,_0x2a64ac);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 2790c1d..79c50d8 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 _0x9063=['INTEGER','sequelize','exports'];(function(_0xd89bb8,_0x3518bf){var _0x9c8957=function(_0x4b0a22){while(--_0x4b0a22){_0xd89bb8['push'](_0xd89bb8['shift']());}};_0x9c8957(++_0x3518bf);}(_0x9063,0x1a2));var _0x3906=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0x9063[_0x34bc30];return _0x5706de;};'use strict';var Sequelize=require(_0x3906('0x0'));module[_0x3906('0x1')]={'TeamId':{'type':Sequelize[_0x3906('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x3906('0x2')]}}; \ No newline at end of file +var _0xbca8=['sequelize','exports','INTEGER'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbca8,0xcc));var _0x8bca=function(_0x34d561,_0x559233){_0x34d561=_0x34d561-0x0;var _0x5c9a79=_0xbca8[_0x34d561];return _0x5c9a79;};'use strict';var Sequelize=require(_0x8bca('0x0'));module[_0x8bca('0x1')]={'TeamId':{'type':Sequelize[_0x8bca('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x8bca('0x2')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index a636af9..9e5ce50 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 _0x7894=['exports','define','TeamVoicePrefix','team_has_voice_prefixes','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./teamVoicePrefix.attributes'];(function(_0x1ee089,_0x25e3a3){var _0x4680d8=function(_0x499fd0){while(--_0x499fd0){_0x1ee089['push'](_0x1ee089['shift']());}};_0x4680d8(++_0x25e3a3);}(_0x7894,0x170));var _0x4789=function(_0x4eadb3,_0x28b6d8){_0x4eadb3=_0x4eadb3-0x0;var _0x355b55=_0x7894[_0x4eadb3];return _0x355b55;};'use strict';var _=require(_0x4789('0x0'));var util=require(_0x4789('0x1'));var logger=require(_0x4789('0x2'))(_0x4789('0x3'));var moment=require(_0x4789('0x4'));var BPromise=require(_0x4789('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4789('0x6'));var rimraf=require(_0x4789('0x7'));var config=require('../../config/environment');var attributes=require(_0x4789('0x8'));module[_0x4789('0x9')]=function(_0x1b4e02,_0x12ef33){return _0x1b4e02[_0x4789('0xa')](_0x4789('0xb'),attributes,{'tableName':_0x4789('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdd6e=['request-promise','path','rimraf','TeamVoicePrefix','team_has_voice_prefixes','lodash','util','../../config/logger','api','bluebird'];(function(_0x25f1ac,_0x13844e){var _0x168804=function(_0x4fc8ea){while(--_0x4fc8ea){_0x25f1ac['push'](_0x25f1ac['shift']());}};_0x168804(++_0x13844e);}(_0xdd6e,0xa5));var _0xedd6=function(_0x2db59a,_0x1bcb0d){_0x2db59a=_0x2db59a-0x0;var _0x2018a6=_0xdd6e[_0x2db59a];return _0x2018a6;};'use strict';var _=require(_0xedd6('0x0'));var util=require(_0xedd6('0x1'));var logger=require(_0xedd6('0x2'))(_0xedd6('0x3'));var moment=require('moment');var BPromise=require(_0xedd6('0x4'));var rp=require(_0xedd6('0x5'));var fs=require('fs');var path=require(_0xedd6('0x6'));var rimraf=require(_0xedd6('0x7'));var config=require('../../config/environment');var attributes=require('./teamVoicePrefix.attributes');module['exports']=function(_0x3430b2,_0x27b159){return _0x3430b2['define'](_0xedd6('0x8'),attributes,{'tableName':_0xedd6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 2dbdeec..183366d 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0xa1f5c4,_0x247496){var _0x3f2f74=function(_0x3dae53){while(--_0x3dae53){_0xa1f5c4['push'](_0xa1f5c4['shift']());}};_0x3f2f74(++_0x247496);}(_0x9c44,0x178));var _0x49c4=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x9c44[_0x1694f5];return _0x5b4321;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x5eb740,_0x3a064c){var _0x4b1c99=function(_0x178410){while(--_0x178410){_0x5eb740['push'](_0x5eb740['shift']());}};_0x4b1c99(++_0x3a064c);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x46a3e8,_0x2e1b35){_0x46a3e8=_0x46a3e8-0x0;var _0xf1442e=_0xcb91[_0x46a3e8];return _0xf1442e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 8d369a8..dc51ecd 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 _0x1f63=['sequelize','exports'];(function(_0x571bbc,_0x242132){var _0x3e8edb=function(_0x5cc0a2){while(--_0x5cc0a2){_0x571bbc['push'](_0x571bbc['shift']());}};_0x3e8edb(++_0x242132);}(_0x1f63,0x7a));var _0x31f6=function(_0x37800d,_0x7e3bba){_0x37800d=_0x37800d-0x0;var _0x44dff7=_0x1f63[_0x37800d];return _0x44dff7;};'use strict';var Sequelize=require(_0x31f6('0x0'));module[_0x31f6('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xadb5=['exports','INTEGER'];(function(_0x3e15e7,_0x305f98){var _0x33cc4e=function(_0x51410e){while(--_0x51410e){_0x3e15e7['push'](_0x3e15e7['shift']());}};_0x33cc4e(++_0x305f98);}(_0xadb5,0x1c2));var _0x5adb=function(_0x59fe33,_0x383753){_0x59fe33=_0x59fe33-0x0;var _0x3bb0b5=_0xadb5[_0x59fe33];return _0x3bb0b5;};'use strict';var Sequelize=require('sequelize');module[_0x5adb('0x0')]={'penalty':{'type':Sequelize[_0x5adb('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 d97f40a..eb10ef6 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 _0x579c=['define','team_has_voice_queues','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./teamVoiceQueue.attributes','exports'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0x579c,0xda));var _0xc579=function(_0xc437bc,_0x751999){_0xc437bc=_0xc437bc-0x0;var _0x1519f6=_0x579c[_0xc437bc];return _0x1519f6;};'use strict';var _=require(_0xc579('0x0'));var util=require(_0xc579('0x1'));var logger=require(_0xc579('0x2'))(_0xc579('0x3'));var moment=require(_0xc579('0x4'));var BPromise=require('bluebird');var rp=require(_0xc579('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc579('0x6'));var config=require(_0xc579('0x7'));var attributes=require(_0xc579('0x8'));module[_0xc579('0x9')]=function(_0x124ee5,_0x1bd276){return _0x124ee5[_0xc579('0xa')]('TeamVoiceQueue',attributes,{'tableName':_0xc579('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb903=['rimraf','../../config/environment','./teamVoiceQueue.attributes','exports','team_has_voice_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x339c23,_0x541ff6){var _0x5bf134=function(_0x46c91d){while(--_0x46c91d){_0x339c23['push'](_0x339c23['shift']());}};_0x5bf134(++_0x541ff6);}(_0xb903,0x185));var _0x3b90=function(_0x5155aa,_0x9235dd){_0x5155aa=_0x5155aa-0x0;var _0x14c1d4=_0xb903[_0x5155aa];return _0x14c1d4;};'use strict';var _=require(_0x3b90('0x0'));var util=require(_0x3b90('0x1'));var logger=require(_0x3b90('0x2'))(_0x3b90('0x3'));var moment=require('moment');var BPromise=require(_0x3b90('0x4'));var rp=require(_0x3b90('0x5'));var fs=require('fs');var path=require(_0x3b90('0x6'));var rimraf=require(_0x3b90('0x7'));var config=require(_0x3b90('0x8'));var attributes=require(_0x3b90('0x9'));module[_0x3b90('0xa')]=function(_0x5acd76,_0x15b68f){return _0x5acd76['define']('TeamVoiceQueue',attributes,{'tableName':_0x3b90('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js b/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js index b2ab474..275fd24 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 _0x192f=['../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','TeamVoiceQueue,\x20%s,\x20%s','message','info','result','catch','lodash','moment','randomstring','../../config/utils','../../config/logger','rpc'];(function(_0x74912e,_0x25c8c9){var _0x54e755=function(_0x46c8f1){while(--_0x46c8f1){_0x74912e['push'](_0x74912e['shift']());}};_0x54e755(++_0x25c8c9);}(_0x192f,0xd6));var _0xf192=function(_0x2f6d15,_0x337177){_0x2f6d15=_0x2f6d15-0x0;var _0x3db200=_0x192f[_0x2f6d15];return _0x3db200;};'use strict';var _=require(_0xf192('0x0'));var util=require('util');var moment=require(_0xf192('0x1'));var BPromise=require('bluebird');var rs=require(_0xf192('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf192('0x3'));var logger=require(_0xf192('0x4'))(_0xf192('0x5'));var config=require(_0xf192('0x6'));var jayson=require(_0xf192('0x7'));var client=jayson[_0xf192('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x38dcbf,_0x4171d9,_0x5743c9){return new BPromise(function(_0x2c4102,_0x16bf2e){return client[_0xf192('0x9')](_0x38dcbf,_0x5743c9)[_0xf192('0xa')](function(_0x2cdfa0){logger['info']('TeamVoiceQueue,\x20%s,\x20%s',_0x4171d9,_0xf192('0xb'));logger[_0xf192('0xc')](_0xf192('0xd'),_0x4171d9,_0xf192('0xb'),JSON[_0xf192('0xe')](_0x2cdfa0));if(_0x2cdfa0[_0xf192('0xf')]){if(_0x2cdfa0[_0xf192('0xf')][_0xf192('0x10')]===0x1f4){logger['error'](_0xf192('0x11'),_0x4171d9,_0x2cdfa0[_0xf192('0xf')][_0xf192('0x12')]);return _0x16bf2e(_0x2cdfa0[_0xf192('0xf')][_0xf192('0x12')]);}logger[_0xf192('0xf')](_0xf192('0x11'),_0x4171d9,_0x2cdfa0[_0xf192('0xf')][_0xf192('0x12')]);return _0x2c4102(_0x2cdfa0[_0xf192('0xf')][_0xf192('0x12')]);}else{logger[_0xf192('0x13')]('TeamVoiceQueue,\x20%s,\x20%s',_0x4171d9,_0xf192('0xb'));_0x2c4102(_0x2cdfa0[_0xf192('0x14')]['message']);}})[_0xf192('0x15')](function(_0x2ea5f4){logger[_0xf192('0xf')](_0xf192('0x11'),_0x4171d9,_0x2ea5f4);_0x16bf2e(_0x2ea5f4);});});} \ No newline at end of file +var _0xf149=['stringify','error','code','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','TeamVoiceQueue,\x20%s,\x20%s,\x20%s'];(function(_0x537c78,_0x4f882e){var _0x41ac0d=function(_0x2e49df){while(--_0x2e49df){_0x537c78['push'](_0x537c78['shift']());}};_0x41ac0d(++_0x4f882e);}(_0xf149,0xe1));var _0x9f14=function(_0x350796,_0x1bf21f){_0x350796=_0x350796-0x0;var _0x126f19=_0xf149[_0x350796];return _0x126f19;};'use strict';var _=require(_0x9f14('0x0'));var util=require(_0x9f14('0x1'));var moment=require(_0x9f14('0x2'));var BPromise=require('bluebird');var rs=require(_0x9f14('0x3'));var fs=require('fs');var Redis=require(_0x9f14('0x4'));var db=require(_0x9f14('0x5'))['db'];var utils=require(_0x9f14('0x6'));var logger=require(_0x9f14('0x7'))(_0x9f14('0x8'));var config=require(_0x9f14('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x9f14('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x33bf35,_0xf38c70,_0x1fbed3){return new BPromise(function(_0x317ece,_0x1a9f8b){return client['request'](_0x33bf35,_0x1fbed3)['then'](function(_0x4f5e64){logger[_0x9f14('0xb')](_0x9f14('0xc'),_0xf38c70,_0x9f14('0xd'));logger['debug'](_0x9f14('0xe'),_0xf38c70,_0x9f14('0xd'),JSON[_0x9f14('0xf')](_0x4f5e64));if(_0x4f5e64[_0x9f14('0x10')]){if(_0x4f5e64[_0x9f14('0x10')][_0x9f14('0x11')]===0x1f4){logger['error'](_0x9f14('0xc'),_0xf38c70,_0x4f5e64[_0x9f14('0x10')][_0x9f14('0x12')]);return _0x1a9f8b(_0x4f5e64[_0x9f14('0x10')][_0x9f14('0x12')]);}logger[_0x9f14('0x10')](_0x9f14('0xc'),_0xf38c70,_0x4f5e64[_0x9f14('0x10')][_0x9f14('0x12')]);return _0x317ece(_0x4f5e64[_0x9f14('0x10')][_0x9f14('0x12')]);}else{logger[_0x9f14('0xb')](_0x9f14('0xc'),_0xf38c70,_0x9f14('0xd'));_0x317ece(_0x4f5e64[_0x9f14('0x13')][_0x9f14('0x12')]);}})['catch'](function(_0x380e67){logger[_0x9f14('0x10')](_0x9f14('0xc'),_0xf38c70,_0x380e67);_0x1a9f8b(_0x380e67);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 9b9e194..0b0b2a9 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 _0xda2d=['isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../config/environment','./template.controller','get'];(function(_0x6b4f52,_0x4a17d1){var _0xa387e5=function(_0x2643b8){while(--_0x2643b8){_0x6b4f52['push'](_0x6b4f52['shift']());}};_0xa387e5(++_0x4a17d1);}(_0xda2d,0x102));var _0xdda2=function(_0x4a1e56,_0x5344ee){_0x4a1e56=_0x4a1e56-0x0;var _0x3283c3=_0xda2d[_0x4a1e56];return _0x3283c3;};'use strict';var multer=require('multer');var util=require(_0xdda2('0x0'));var path=require(_0xdda2('0x1'));var timeout=require(_0xdda2('0x2'));var express=require(_0xdda2('0x3'));var router=express[_0xdda2('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xdda2('0x5'));var controller=require(_0xdda2('0x6'));router[_0xdda2('0x7')]('/',auth[_0xdda2('0x8')](),controller[_0xdda2('0x9')]);router[_0xdda2('0x7')](_0xdda2('0xa'),auth[_0xdda2('0x8')](),controller[_0xdda2('0xb')]);router[_0xdda2('0xc')]('/',auth['isAuthenticated'](),controller[_0xdda2('0xd')]);router[_0xdda2('0xe')]('/:id',auth[_0xdda2('0x8')](),controller[_0xdda2('0xf')]);router[_0xdda2('0x10')](_0xdda2('0xa'),auth[_0xdda2('0x8')](),controller[_0xdda2('0x11')]);module[_0xdda2('0x12')]=router; \ No newline at end of file +var _0x8768=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','/:id','show','post','put','delete','destroy'];(function(_0x31588c,_0x540097){var _0x2e37d3=function(_0x44d4cb){while(--_0x44d4cb){_0x31588c['push'](_0x31588c['shift']());}};_0x2e37d3(++_0x540097);}(_0x8768,0xa1));var _0x8876=function(_0x1b11d1,_0x37d4c5){_0x1b11d1=_0x1b11d1-0x0;var _0x12ed97=_0x8768[_0x1b11d1];return _0x12ed97;};'use strict';var multer=require(_0x8876('0x0'));var util=require(_0x8876('0x1'));var path=require(_0x8876('0x2'));var timeout=require(_0x8876('0x3'));var express=require(_0x8876('0x4'));var router=express[_0x8876('0x5')]();var fs_extra=require(_0x8876('0x6'));var auth=require(_0x8876('0x7'));var interaction=require(_0x8876('0x8'));var config=require(_0x8876('0x9'));var controller=require(_0x8876('0xa'));router[_0x8876('0xb')]('/',auth[_0x8876('0xc')](),controller['index']);router[_0x8876('0xb')](_0x8876('0xd'),auth[_0x8876('0xc')](),controller[_0x8876('0xe')]);router[_0x8876('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x8876('0x10')](_0x8876('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x8876('0x11')](_0x8876('0xd'),auth[_0x8876('0xc')](),controller[_0x8876('0x12')]);module[_0x8876('0x13')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 8409ad4..8b84cdb 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 _0x32d5=['STRING','TEXT','sequelize','exports'];(function(_0x37b31c,_0x19ffd5){var _0x18cccc=function(_0x29f594){while(--_0x29f594){_0x37b31c['push'](_0x37b31c['shift']());}};_0x18cccc(++_0x19ffd5);}(_0x32d5,0x19e));var _0x532d=function(_0x270f99,_0x23a6e8){_0x270f99=_0x270f99-0x0;var _0x2668e5=_0x32d5[_0x270f99];return _0x2668e5;};'use strict';var Sequelize=require(_0x532d('0x0'));module[_0x532d('0x1')]={'name':{'type':Sequelize[_0x532d('0x2')]},'description':{'type':Sequelize[_0x532d('0x2')]},'html':{'type':Sequelize[_0x532d('0x3')]}}; \ No newline at end of file +var _0xc9e9=['sequelize','STRING','TEXT'];(function(_0x1ebd1d,_0x1525bb){var _0x59f149=function(_0x3e4355){while(--_0x3e4355){_0x1ebd1d['push'](_0x1ebd1d['shift']());}};_0x59f149(++_0x1525bb);}(_0xc9e9,0xf9));var _0x9c9e=function(_0x2984d0,_0x1a7211){_0x2984d0=_0x2984d0-0x0;var _0x2885f2=_0xc9e9[_0x2984d0];return _0x2885f2;};'use strict';var Sequelize=require(_0x9c9e('0x0'));module['exports']={'name':{'type':Sequelize[_0x9c9e('0x1')]},'description':{'type':Sequelize[_0x9c9e('0x1')]},'html':{'type':Sequelize[_0x9c9e('0x2')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 7d3f30b..65fb6f5 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 _0xae9a=['send','index','map','Template','type','query','intersection','attributes','model','fields','length','nolimit','order','sort','where','filters','pick','merge','options','includeAll','findAll','show','params','keys','rawAttributes','include','find','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','autoAssociation','UserProfileResource','error','body','eml-format','rimraf','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','end','undefined','limit','count','offset','status','set','Content-Range','apply','reject','update','then','get','Templates','destroy','sendStatus','name'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xae9a,0x1a4));var _0xaae9=function(_0x7fab73,_0x10fd59){_0x7fab73=_0x7fab73-0x0;var _0x49b545=_0xae9a[_0x7fab73];return _0x49b545;};'use strict';var emlformat=require(_0xaae9('0x0'));var rimraf=require(_0xaae9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaae9('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xaae9('0x3'));var Mustache=require(_0xaae9('0x4'));var util=require('util');var path=require(_0xaae9('0x5'));var sox=require(_0xaae9('0x6'));var csv=require(_0xaae9('0x7'));var ejs=require(_0xaae9('0x8'));var fs=require('fs');var fs_extra=require(_0xaae9('0x9'));var _=require(_0xaae9('0xa'));var squel=require(_0xaae9('0xb'));var crypto=require(_0xaae9('0xc'));var jsforce=require(_0xaae9('0xd'));var deskjs=require(_0xaae9('0xe'));var toCsv=require('to-csv');var querystring=require(_0xaae9('0xf'));var Papa=require(_0xaae9('0x10'));var Redis=require(_0xaae9('0x11'));var authService=require(_0xaae9('0x12'));var qs=require(_0xaae9('0x13'));var as=require(_0xaae9('0x14'));var hardwareService=require(_0xaae9('0x15'));var logger=require(_0xaae9('0x16'))(_0xaae9('0x17'));var utils=require('../../config/utils');var config=require(_0xaae9('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x38909f,_0x4c0111){_0x4c0111=_0x4c0111||0xcc;return function(_0xeb5825){if(_0xeb5825){return _0x38909f['sendStatus'](_0x4c0111);}return _0x38909f['status'](_0x4c0111)[_0xaae9('0x19')]();};}function respondWithResult(_0x50574b,_0x202c5a){_0x202c5a=_0x202c5a||0xc8;return function(_0x4af7eb){if(_0x4af7eb){return _0x50574b['status'](_0x202c5a)['json'](_0x4af7eb);}};}function respondWithFilteredResult(_0x29f6eb,_0x28229e){return function(_0x4a04c3){if(_0x4a04c3){var _0x5ca57c=typeof _0x28229e['offset']===_0xaae9('0x1a')&&typeof _0x28229e[_0xaae9('0x1b')]===_0xaae9('0x1a');var _0x5e9bc4=_0x4a04c3['count'];var _0x57a853=_0x5ca57c?0x0:_0x28229e['offset'];var _0x1569cc=_0x5ca57c?_0x4a04c3[_0xaae9('0x1c')]:_0x28229e[_0xaae9('0x1d')]+_0x28229e[_0xaae9('0x1b')];var _0x51b69f;if(_0x1569cc>=_0x5e9bc4){_0x1569cc=_0x5e9bc4;_0x51b69f=0xc8;}else{_0x51b69f=0xce;}_0x29f6eb[_0xaae9('0x1e')](_0x51b69f);return _0x29f6eb[_0xaae9('0x1f')](_0xaae9('0x20'),_0x57a853+'-'+_0x1569cc+'/'+_0x5e9bc4)['json'](_0x4a04c3);}return null;};}function patchUpdates(_0x55153f){return function(_0x56a158){try{jsonpatch[_0xaae9('0x21')](_0x56a158,_0x55153f,!![]);}catch(_0x2b35c0){return BPromise[_0xaae9('0x22')](_0x2b35c0);}return _0x56a158['save']();};}function saveUpdates(_0x3b9059,_0x5d2bb1){return function(_0x5dd869){if(_0x5dd869){return _0x5dd869[_0xaae9('0x23')](_0x3b9059)[_0xaae9('0x24')](function(_0x36af1d){return _0x36af1d;});}return null;};}function removeEntity(_0x3e9212,_0x488336){return function(_0x2f1aa6){if(_0x2f1aa6){return _0x2f1aa6['destroy']()['then'](function(){var _0x5726a3=_0x2f1aa6[_0xaae9('0x25')]({'plain':!![]});var _0x100dff=_0xaae9('0x26');return db['UserProfileResource'][_0xaae9('0x27')]({'where':{'type':_0x100dff,'resourceId':_0x5726a3['id']}})['then'](function(){return _0x2f1aa6;});})['then'](function(){_0x3e9212[_0xaae9('0x1e')](0xcc)[_0xaae9('0x19')]();});}};}function handleEntityNotFound(_0x7ba7cf,_0x4f9738){return function(_0x4957ff){if(!_0x4957ff){_0x7ba7cf[_0xaae9('0x28')](0x194);}return _0x4957ff;};}function handleError(_0x159b49,_0x1f37c9){_0x1f37c9=_0x1f37c9||0x1f4;return function(_0xdb8933){logger['error'](_0xdb8933['stack']);if(_0xdb8933[_0xaae9('0x29')]){delete _0xdb8933[_0xaae9('0x29')];}_0x159b49[_0xaae9('0x1e')](_0x1f37c9)[_0xaae9('0x2a')](_0xdb8933);};}exports[_0xaae9('0x2b')]=function(_0x32eee5,_0x46ed8a){var _0x2a484d={},_0x3421cb={},_0x6ff9c6={'count':0x0,'rows':[]};var _0x42b3d5=_[_0xaae9('0x2c')](db[_0xaae9('0x2d')]['rawAttributes'],function(_0x2a6ba4){return{'name':_0x2a6ba4['fieldName'],'type':_0x2a6ba4[_0xaae9('0x2e')]['key']};});_0x3421cb['model']=_[_0xaae9('0x2c')](_0x42b3d5,_0xaae9('0x29'));_0x3421cb[_0xaae9('0x2f')]=_['keys'](_0x32eee5[_0xaae9('0x2f')]);_0x3421cb['filters']=_[_0xaae9('0x30')](_0x3421cb['model'],_0x3421cb[_0xaae9('0x2f')]);_0x2a484d[_0xaae9('0x31')]=_[_0xaae9('0x30')](_0x3421cb[_0xaae9('0x32')],qs[_0xaae9('0x33')](_0x32eee5[_0xaae9('0x2f')][_0xaae9('0x33')]));_0x2a484d[_0xaae9('0x31')]=_0x2a484d[_0xaae9('0x31')][_0xaae9('0x34')]?_0x2a484d[_0xaae9('0x31')]:_0x3421cb['model'];if(!_0x32eee5['query']['hasOwnProperty'](_0xaae9('0x35'))){_0x2a484d[_0xaae9('0x1b')]=qs[_0xaae9('0x1b')](_0x32eee5['query'][_0xaae9('0x1b')]);_0x2a484d[_0xaae9('0x1d')]=qs[_0xaae9('0x1d')](_0x32eee5['query'][_0xaae9('0x1d')]);}_0x2a484d[_0xaae9('0x36')]=qs[_0xaae9('0x37')](_0x32eee5[_0xaae9('0x2f')][_0xaae9('0x37')]);_0x2a484d[_0xaae9('0x38')]=qs[_0xaae9('0x39')](_[_0xaae9('0x3a')](_0x32eee5[_0xaae9('0x2f')],_0x3421cb[_0xaae9('0x39')]),_0x42b3d5);if(_0x32eee5['query']['filter']){_0x2a484d[_0xaae9('0x38')]=_['merge'](_0x2a484d['where'],{'$or':_[_0xaae9('0x2c')](_0x42b3d5,function(_0x2aaeee){if(_0x2aaeee[_0xaae9('0x2e')]!=='VIRTUAL'){var _0x498224={};_0x498224[_0x2aaeee[_0xaae9('0x29')]]={'$like':'%'+_0x32eee5[_0xaae9('0x2f')]['filter']+'%'};return _0x498224;}})});}_0x2a484d=_[_0xaae9('0x3b')]({},_0x2a484d,_0x32eee5[_0xaae9('0x3c')]);var _0x552301={'where':_0x2a484d[_0xaae9('0x38')]};return db[_0xaae9('0x2d')][_0xaae9('0x1c')](_0x552301)[_0xaae9('0x24')](function(_0x5884e0){_0x6ff9c6[_0xaae9('0x1c')]=_0x5884e0;if(_0x32eee5['query'][_0xaae9('0x3d')]){_0x2a484d['include']=[{'all':!![]}];}return db[_0xaae9('0x2d')][_0xaae9('0x3e')](_0x2a484d);})['then'](function(_0x525353){_0x6ff9c6['rows']=_0x525353;return _0x6ff9c6;})[_0xaae9('0x24')](respondWithFilteredResult(_0x46ed8a,_0x2a484d))['catch'](handleError(_0x46ed8a,null));};exports[_0xaae9('0x3f')]=function(_0x38cc3d,_0x3edad4){var _0x56ffa8={'raw':!![],'where':{'id':_0x38cc3d[_0xaae9('0x40')]['id']}},_0x4cafc9={};_0x4cafc9['model']=_[_0xaae9('0x41')](db['Template'][_0xaae9('0x42')]);_0x4cafc9['query']=_[_0xaae9('0x41')](_0x38cc3d[_0xaae9('0x2f')]);_0x4cafc9[_0xaae9('0x39')]=_[_0xaae9('0x30')](_0x4cafc9['model'],_0x4cafc9['query']);_0x56ffa8['attributes']=_[_0xaae9('0x30')](_0x4cafc9['model'],qs[_0xaae9('0x33')](_0x38cc3d[_0xaae9('0x2f')]['fields']));_0x56ffa8[_0xaae9('0x31')]=_0x56ffa8[_0xaae9('0x31')][_0xaae9('0x34')]?_0x56ffa8[_0xaae9('0x31')]:_0x4cafc9[_0xaae9('0x32')];if(_0x38cc3d['query']['includeAll']){_0x56ffa8[_0xaae9('0x43')]=[{'all':!![]}];}_0x56ffa8=_[_0xaae9('0x3b')]({},_0x56ffa8,_0x38cc3d[_0xaae9('0x3c')]);return db[_0xaae9('0x2d')][_0xaae9('0x44')](_0x56ffa8)['then'](handleEntityNotFound(_0x3edad4,null))[_0xaae9('0x24')](respondWithResult(_0x3edad4,null))[_0xaae9('0x45')](handleError(_0x3edad4,null));};exports[_0xaae9('0x46')]=function(_0x1512cf,_0x5d7742){return db['Template'][_0xaae9('0x46')](_0x1512cf['body'],{})['then'](function(_0x169986){var _0x4ed1a5=_0x1512cf['user'][_0xaae9('0x25')]({'plain':!![]});if(!_0x4ed1a5)throw new Error(_0xaae9('0x47'));if(_0x4ed1a5['role']===_0xaae9('0x48')){var _0x51ebf3=_0x169986[_0xaae9('0x25')]({'plain':!![]});var _0x12f24d=_0xaae9('0x26');return db['UserProfileSection']['find']({'where':{'name':_0x12f24d,'userProfileId':_0x4ed1a5['userProfileId']},'raw':!![]})[_0xaae9('0x24')](function(_0x11f7f9){if(_0x11f7f9&&_0x11f7f9[_0xaae9('0x49')]===0x0){return db[_0xaae9('0x4a')][_0xaae9('0x46')]({'name':_0x51ebf3[_0xaae9('0x29')],'resourceId':_0x51ebf3['id'],'type':_0x11f7f9[_0xaae9('0x29')],'sectionId':_0x11f7f9['id']},{})[_0xaae9('0x24')](function(){return _0x169986;});}else{return _0x169986;}})['catch'](function(_0x37eee0){logger[_0xaae9('0x4b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x37eee0);throw _0x37eee0;});}return _0x169986;})[_0xaae9('0x24')](respondWithResult(_0x5d7742,0xc9))[_0xaae9('0x45')](handleError(_0x5d7742,null));};exports[_0xaae9('0x23')]=function(_0x141116,_0x210130){if(_0x141116[_0xaae9('0x4c')]['id']){delete _0x141116[_0xaae9('0x4c')]['id'];}return db[_0xaae9('0x2d')][_0xaae9('0x44')]({'where':{'id':_0x141116['params']['id']}})[_0xaae9('0x24')](handleEntityNotFound(_0x210130,null))[_0xaae9('0x24')](saveUpdates(_0x141116['body'],null))[_0xaae9('0x24')](respondWithResult(_0x210130,null))[_0xaae9('0x45')](handleError(_0x210130,null));};exports[_0xaae9('0x27')]=function(_0x2aa407,_0x3bf192){return db[_0xaae9('0x2d')][_0xaae9('0x44')]({'where':{'id':_0x2aa407[_0xaae9('0x40')]['id']}})['then'](handleEntityNotFound(_0x3bf192,null))[_0xaae9('0x24')](removeEntity(_0x3bf192,null))['catch'](handleError(_0x3bf192,null));}; \ No newline at end of file +var _0x965c=['rimraf','zip-dir','fast-json-patch','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','then','destroy','get','UserProfileResource','stack','name','send','index','map','Template','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','find','create','body','user','role','Templates','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','eml-format'];(function(_0xd2649f,_0x50b81b){var _0x56adfb=function(_0x23e039){while(--_0x23e039){_0xd2649f['push'](_0xd2649f['shift']());}};_0x56adfb(++_0x50b81b);}(_0x965c,0xf2));var _0xc965=function(_0x42e4e0,_0x57ab9c){_0x42e4e0=_0x42e4e0-0x0;var _0x5ea33c=_0x965c[_0x42e4e0];return _0x5ea33c;};'use strict';var emlformat=require(_0xc965('0x0'));var rimraf=require(_0xc965('0x1'));var zipdir=require(_0xc965('0x2'));var jsonpatch=require(_0xc965('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc965('0x4'));var path=require(_0xc965('0x5'));var sox=require(_0xc965('0x6'));var csv=require(_0xc965('0x7'));var ejs=require(_0xc965('0x8'));var fs=require('fs');var fs_extra=require(_0xc965('0x9'));var _=require(_0xc965('0xa'));var squel=require(_0xc965('0xb'));var crypto=require(_0xc965('0xc'));var jsforce=require(_0xc965('0xd'));var deskjs=require(_0xc965('0xe'));var toCsv=require('to-csv');var querystring=require(_0xc965('0xf'));var Papa=require(_0xc965('0x10'));var Redis=require('ioredis');var authService=require(_0xc965('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xc965('0x12'));var hardwareService=require(_0xc965('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xc965('0x14'));var config=require(_0xc965('0x15'));var licenseUtil=require(_0xc965('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1ecd70,_0x34f862){_0x34f862=_0x34f862||0xcc;return function(_0x5bad2e){if(_0x5bad2e){return _0x1ecd70[_0xc965('0x17')](_0x34f862);}return _0x1ecd70['status'](_0x34f862)[_0xc965('0x18')]();};}function respondWithResult(_0x476efd,_0x26d4f9){_0x26d4f9=_0x26d4f9||0xc8;return function(_0x5ffdc9){if(_0x5ffdc9){return _0x476efd[_0xc965('0x19')](_0x26d4f9)[_0xc965('0x1a')](_0x5ffdc9);}};}function respondWithFilteredResult(_0x1e82b0,_0x4186e5){return function(_0xfb7a81){if(_0xfb7a81){var _0x4cab88=typeof _0x4186e5[_0xc965('0x1b')]===_0xc965('0x1c')&&typeof _0x4186e5[_0xc965('0x1d')]===_0xc965('0x1c');var _0x3fda09=_0xfb7a81['count'];var _0xfecb0=_0x4cab88?0x0:_0x4186e5[_0xc965('0x1b')];var _0x2c8dba=_0x4cab88?_0xfb7a81['count']:_0x4186e5[_0xc965('0x1b')]+_0x4186e5[_0xc965('0x1d')];var _0x51e1c9;if(_0x2c8dba>=_0x3fda09){_0x2c8dba=_0x3fda09;_0x51e1c9=0xc8;}else{_0x51e1c9=0xce;}_0x1e82b0[_0xc965('0x19')](_0x51e1c9);return _0x1e82b0[_0xc965('0x1e')](_0xc965('0x1f'),_0xfecb0+'-'+_0x2c8dba+'/'+_0x3fda09)[_0xc965('0x1a')](_0xfb7a81);}return null;};}function patchUpdates(_0x3758d7){return function(_0x5a9f4d){try{jsonpatch[_0xc965('0x20')](_0x5a9f4d,_0x3758d7,!![]);}catch(_0x40fa1c){return BPromise[_0xc965('0x21')](_0x40fa1c);}return _0x5a9f4d[_0xc965('0x22')]();};}function saveUpdates(_0x5291f7,_0x47b6b6){return function(_0x16baa8){if(_0x16baa8){return _0x16baa8['update'](_0x5291f7)[_0xc965('0x23')](function(_0x348e4e){return _0x348e4e;});}return null;};}function removeEntity(_0x57febd,_0x18a7ce){return function(_0x384b16){if(_0x384b16){return _0x384b16[_0xc965('0x24')]()['then'](function(){var _0x28bfe6=_0x384b16[_0xc965('0x25')]({'plain':!![]});var _0x1ff7c0='Templates';return db[_0xc965('0x26')]['destroy']({'where':{'type':_0x1ff7c0,'resourceId':_0x28bfe6['id']}})['then'](function(){return _0x384b16;});})[_0xc965('0x23')](function(){_0x57febd[_0xc965('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c992e,_0x20fcfc){return function(_0xb7b818){if(!_0xb7b818){_0x2c992e[_0xc965('0x17')](0x194);}return _0xb7b818;};}function handleError(_0x35fddb,_0x587979){_0x587979=_0x587979||0x1f4;return function(_0x30222c){logger['error'](_0x30222c[_0xc965('0x27')]);if(_0x30222c[_0xc965('0x28')]){delete _0x30222c['name'];}_0x35fddb[_0xc965('0x19')](_0x587979)[_0xc965('0x29')](_0x30222c);};}exports[_0xc965('0x2a')]=function(_0x1df3c2,_0x49e613){var _0x559fe6={},_0x1c61f6={},_0x30455a={'count':0x0,'rows':[]};var _0xd554ae=_[_0xc965('0x2b')](db[_0xc965('0x2c')][_0xc965('0x2d')],function(_0x2b26ea){return{'name':_0x2b26ea[_0xc965('0x2e')],'type':_0x2b26ea[_0xc965('0x2f')]['key']};});_0x1c61f6[_0xc965('0x30')]=_['map'](_0xd554ae,'name');_0x1c61f6[_0xc965('0x31')]=_['keys'](_0x1df3c2['query']);_0x1c61f6[_0xc965('0x32')]=_[_0xc965('0x33')](_0x1c61f6[_0xc965('0x30')],_0x1c61f6[_0xc965('0x31')]);_0x559fe6[_0xc965('0x34')]=_[_0xc965('0x33')](_0x1c61f6[_0xc965('0x30')],qs[_0xc965('0x35')](_0x1df3c2[_0xc965('0x31')][_0xc965('0x35')]));_0x559fe6[_0xc965('0x34')]=_0x559fe6[_0xc965('0x34')]['length']?_0x559fe6[_0xc965('0x34')]:_0x1c61f6[_0xc965('0x30')];if(!_0x1df3c2['query'][_0xc965('0x36')](_0xc965('0x37'))){_0x559fe6[_0xc965('0x1d')]=qs[_0xc965('0x1d')](_0x1df3c2['query'][_0xc965('0x1d')]);_0x559fe6['offset']=qs[_0xc965('0x1b')](_0x1df3c2['query'][_0xc965('0x1b')]);}_0x559fe6['order']=qs['sort'](_0x1df3c2[_0xc965('0x31')][_0xc965('0x38')]);_0x559fe6[_0xc965('0x39')]=qs[_0xc965('0x32')](_[_0xc965('0x3a')](_0x1df3c2[_0xc965('0x31')],_0x1c61f6[_0xc965('0x32')]),_0xd554ae);if(_0x1df3c2[_0xc965('0x31')][_0xc965('0x3b')]){_0x559fe6[_0xc965('0x39')]=_['merge'](_0x559fe6[_0xc965('0x39')],{'$or':_[_0xc965('0x2b')](_0xd554ae,function(_0x476f3a){if(_0x476f3a[_0xc965('0x2f')]!==_0xc965('0x3c')){var _0x187f9b={};_0x187f9b[_0x476f3a[_0xc965('0x28')]]={'$like':'%'+_0x1df3c2['query'][_0xc965('0x3b')]+'%'};return _0x187f9b;}})});}_0x559fe6=_[_0xc965('0x3d')]({},_0x559fe6,_0x1df3c2[_0xc965('0x3e')]);var _0x3f7a77={'where':_0x559fe6[_0xc965('0x39')]};return db[_0xc965('0x2c')]['count'](_0x3f7a77)[_0xc965('0x23')](function(_0x4b2c50){_0x30455a['count']=_0x4b2c50;if(_0x1df3c2[_0xc965('0x31')][_0xc965('0x3f')]){_0x559fe6[_0xc965('0x40')]=[{'all':!![]}];}return db[_0xc965('0x2c')][_0xc965('0x41')](_0x559fe6);})[_0xc965('0x23')](function(_0x515cd6){_0x30455a['rows']=_0x515cd6;return _0x30455a;})[_0xc965('0x23')](respondWithFilteredResult(_0x49e613,_0x559fe6))[_0xc965('0x42')](handleError(_0x49e613,null));};exports[_0xc965('0x43')]=function(_0x47933e,_0x350fb9){var _0x4b618c={'raw':!![],'where':{'id':_0x47933e['params']['id']}},_0x281b6f={};_0x281b6f[_0xc965('0x30')]=_['keys'](db[_0xc965('0x2c')]['rawAttributes']);_0x281b6f[_0xc965('0x31')]=_['keys'](_0x47933e['query']);_0x281b6f[_0xc965('0x32')]=_[_0xc965('0x33')](_0x281b6f[_0xc965('0x30')],_0x281b6f['query']);_0x4b618c['attributes']=_['intersection'](_0x281b6f['model'],qs['fields'](_0x47933e[_0xc965('0x31')][_0xc965('0x35')]));_0x4b618c[_0xc965('0x34')]=_0x4b618c[_0xc965('0x34')]['length']?_0x4b618c[_0xc965('0x34')]:_0x281b6f[_0xc965('0x30')];if(_0x47933e[_0xc965('0x31')][_0xc965('0x3f')]){_0x4b618c[_0xc965('0x40')]=[{'all':!![]}];}_0x4b618c=_[_0xc965('0x3d')]({},_0x4b618c,_0x47933e[_0xc965('0x3e')]);return db[_0xc965('0x2c')][_0xc965('0x44')](_0x4b618c)[_0xc965('0x23')](handleEntityNotFound(_0x350fb9,null))[_0xc965('0x23')](respondWithResult(_0x350fb9,null))[_0xc965('0x42')](handleError(_0x350fb9,null));};exports[_0xc965('0x45')]=function(_0x287614,_0x1aacbf){return db[_0xc965('0x2c')]['create'](_0x287614[_0xc965('0x46')],{})[_0xc965('0x23')](function(_0x5bdf15){var _0x1bdc9e=_0x287614[_0xc965('0x47')][_0xc965('0x25')]({'plain':!![]});if(!_0x1bdc9e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1bdc9e[_0xc965('0x48')]===_0xc965('0x47')){var _0x5349fb=_0x5bdf15['get']({'plain':!![]});var _0x2a0696=_0xc965('0x49');return db[_0xc965('0x4a')][_0xc965('0x44')]({'where':{'name':_0x2a0696,'userProfileId':_0x1bdc9e[_0xc965('0x4b')]},'raw':!![]})[_0xc965('0x23')](function(_0x2fc0e0){if(_0x2fc0e0&&_0x2fc0e0[_0xc965('0x4c')]===0x0){return db[_0xc965('0x26')][_0xc965('0x45')]({'name':_0x5349fb['name'],'resourceId':_0x5349fb['id'],'type':_0x2fc0e0[_0xc965('0x28')],'sectionId':_0x2fc0e0['id']},{})[_0xc965('0x23')](function(){return _0x5bdf15;});}else{return _0x5bdf15;}})['catch'](function(_0x1bffe5){logger[_0xc965('0x4d')](_0xc965('0x4e'),_0x1bffe5);throw _0x1bffe5;});}return _0x5bdf15;})['then'](respondWithResult(_0x1aacbf,0xc9))[_0xc965('0x42')](handleError(_0x1aacbf,null));};exports[_0xc965('0x4f')]=function(_0x391f36,_0x3bc267){if(_0x391f36[_0xc965('0x46')]['id']){delete _0x391f36[_0xc965('0x46')]['id'];}return db[_0xc965('0x2c')][_0xc965('0x44')]({'where':{'id':_0x391f36[_0xc965('0x50')]['id']}})[_0xc965('0x23')](handleEntityNotFound(_0x3bc267,null))[_0xc965('0x23')](saveUpdates(_0x391f36[_0xc965('0x46')],null))['then'](respondWithResult(_0x3bc267,null))['catch'](handleError(_0x3bc267,null));};exports[_0xc965('0x24')]=function(_0x4119f1,_0x4deeaa){return db[_0xc965('0x2c')][_0xc965('0x44')]({'where':{'id':_0x4119f1[_0xc965('0x50')]['id']}})[_0xc965('0x23')](handleEntityNotFound(_0x4deeaa,null))['then'](removeEntity(_0x4deeaa,null))['catch'](handleError(_0x4deeaa,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 7f4d274..18a38a3 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 _0x5e94=['../../config/logger','moment','request-promise','path','rimraf','../../config/environment','exports','Template','util'];(function(_0x11cb1d,_0x4782da){var _0x353d97=function(_0x5b9e31){while(--_0x5b9e31){_0x11cb1d['push'](_0x11cb1d['shift']());}};_0x353d97(++_0x4782da);}(_0x5e94,0x170));var _0x45e9=function(_0x65b059,_0xcb5a8a){_0x65b059=_0x65b059-0x0;var _0x25bd8c=_0x5e94[_0x65b059];return _0x25bd8c;};'use strict';var _=require('lodash');var util=require(_0x45e9('0x0'));var logger=require(_0x45e9('0x1'))('api');var moment=require(_0x45e9('0x2'));var BPromise=require('bluebird');var rp=require(_0x45e9('0x3'));var fs=require('fs');var path=require(_0x45e9('0x4'));var rimraf=require(_0x45e9('0x5'));var config=require(_0x45e9('0x6'));var attributes=require('./template.attributes');module[_0x45e9('0x7')]=function(_0xf82fbb,_0x2eebf1){return _0xf82fbb['define'](_0x45e9('0x8'),attributes,{'tableName':'tools_templates','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8090=['define','Template','tools_templates','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./template.attributes'];(function(_0x3d3e9e,_0x11b915){var _0x264d43=function(_0x1b8e76){while(--_0x1b8e76){_0x3d3e9e['push'](_0x3d3e9e['shift']());}};_0x264d43(++_0x11b915);}(_0x8090,0x1b3));var _0x0809=function(_0x510c60,_0x50247e){_0x510c60=_0x510c60-0x0;var _0x49c4aa=_0x8090[_0x510c60];return _0x49c4aa;};'use strict';var _=require(_0x0809('0x0'));var util=require('util');var logger=require(_0x0809('0x1'))('api');var moment=require(_0x0809('0x2'));var BPromise=require(_0x0809('0x3'));var rp=require(_0x0809('0x4'));var fs=require('fs');var path=require(_0x0809('0x5'));var rimraf=require(_0x0809('0x6'));var config=require(_0x0809('0x7'));var attributes=require(_0x0809('0x8'));module['exports']=function(_0x59d5c2,_0x465496){return _0x59d5c2[_0x0809('0x9')](_0x0809('0xa'),attributes,{'tableName':_0x0809('0xb'),'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 a13d4d8..d9587fd 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 _0x8ff4=['attributes','include','map','model','then','GetTemplate','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','Template','findAll','options','raw','where'];(function(_0x5f76e3,_0x977880){var _0x4a5558=function(_0x1340d4){while(--_0x1340d4){_0x5f76e3['push'](_0x5f76e3['shift']());}};_0x4a5558(++_0x977880);}(_0x8ff4,0x1b3));var _0x48ff=function(_0x358fb5,_0x4407b8){_0x358fb5=_0x358fb5-0x0;var _0x4abfeb=_0x8ff4[_0x358fb5];return _0x4abfeb;};'use strict';var _=require(_0x48ff('0x0'));var util=require(_0x48ff('0x1'));var moment=require('moment');var BPromise=require(_0x48ff('0x2'));var rs=require(_0x48ff('0x3'));var fs=require('fs');var Redis=require(_0x48ff('0x4'));var db=require(_0x48ff('0x5'))['db'];var utils=require(_0x48ff('0x6'));var logger=require(_0x48ff('0x7'))('rpc');var config=require(_0x48ff('0x8'));var jayson=require(_0x48ff('0x9'));var client=jayson[_0x48ff('0xa')][_0x48ff('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x168580,_0x4001ff,_0x4ea073){return new BPromise(function(_0x1b50b8,_0x1bd2d8){return client[_0x48ff('0xc')](_0x168580,_0x4ea073)['then'](function(_0x5e7fa0){logger['info'](_0x48ff('0xd'),_0x4001ff,_0x48ff('0xe'));logger[_0x48ff('0xf')](_0x48ff('0x10'),_0x4001ff,_0x48ff('0xe'),JSON['stringify'](_0x5e7fa0));if(_0x5e7fa0[_0x48ff('0x11')]){if(_0x5e7fa0[_0x48ff('0x11')][_0x48ff('0x12')]===0x1f4){logger[_0x48ff('0x11')]('Template,\x20%s,\x20%s',_0x4001ff,_0x5e7fa0[_0x48ff('0x11')][_0x48ff('0x13')]);return _0x1bd2d8(_0x5e7fa0[_0x48ff('0x11')][_0x48ff('0x13')]);}logger['error']('Template,\x20%s,\x20%s',_0x4001ff,_0x5e7fa0['error'][_0x48ff('0x13')]);return _0x1b50b8(_0x5e7fa0[_0x48ff('0x11')][_0x48ff('0x13')]);}else{logger[_0x48ff('0x14')](_0x48ff('0xd'),_0x4001ff,'request\x20sent');_0x1b50b8(_0x5e7fa0['result']['message']);}})[_0x48ff('0x15')](function(_0x5ef47a){logger[_0x48ff('0x11')](_0x48ff('0xd'),_0x4001ff,_0x5ef47a);_0x1bd2d8(_0x5ef47a);});});}exports['GetTemplate']=function(_0x38bf9b){var _0x41f4ef=this;return new Promise(function(_0x2e0bb1,_0x39955f){return db[_0x48ff('0x16')][_0x48ff('0x17')]({'raw':_0x38bf9b[_0x48ff('0x18')]?_0x38bf9b[_0x48ff('0x18')][_0x48ff('0x19')]===undefined?!![]:![]:!![],'where':_0x38bf9b[_0x48ff('0x18')]?_0x38bf9b[_0x48ff('0x18')][_0x48ff('0x1a')]||null:null,'attributes':_0x38bf9b[_0x48ff('0x18')]?_0x38bf9b[_0x48ff('0x18')][_0x48ff('0x1b')]||null:null,'limit':_0x38bf9b[_0x48ff('0x18')]?_0x38bf9b['options']['limit']||null:null,'include':_0x38bf9b[_0x48ff('0x18')]?_0x38bf9b[_0x48ff('0x18')][_0x48ff('0x1c')]?_[_0x48ff('0x1d')](_0x38bf9b['options']['include'],function(_0x5ad29a){return{'model':db[_0x5ad29a[_0x48ff('0x1e')]],'as':_0x5ad29a['as'],'attributes':_0x5ad29a[_0x48ff('0x1b')],'include':_0x5ad29a[_0x48ff('0x1c')]?_[_0x48ff('0x1d')](_0x5ad29a[_0x48ff('0x1c')],function(_0x479d3a){return{'model':db[_0x479d3a[_0x48ff('0x1e')]],'as':_0x479d3a['as'],'attributes':_0x479d3a['attributes'],'include':_0x479d3a[_0x48ff('0x1c')]?_[_0x48ff('0x1d')](_0x479d3a[_0x48ff('0x1c')],function(_0x11139a){return{'model':db[_0x11139a['model']],'as':_0x11139a['as'],'attributes':_0x11139a[_0x48ff('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x48ff('0x1f')](function(_0x4e6fae){logger['info'](_0x48ff('0x20'),_0x38bf9b);logger[_0x48ff('0xf')](_0x48ff('0x20'),_0x38bf9b,JSON['stringify'](_0x4e6fae));_0x2e0bb1(_0x4e6fae);})[_0x48ff('0x15')](function(_0x1863df){logger[_0x48ff('0x11')](_0x48ff('0x20'),_0x1863df[_0x48ff('0x13')],_0x38bf9b);_0x39955f(_0x41f4ef[_0x48ff('0x11')](0x1f4,_0x1863df[_0x48ff('0x13')]));});});}; \ No newline at end of file +var _0x6569=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','error','code','message','result','findAll','options','raw','where','attributes','limit','map','model','include','GetTemplate','stringify','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x358663,_0x1948da){var _0x224f21=function(_0x4e9985){while(--_0x4e9985){_0x358663['push'](_0x358663['shift']());}};_0x224f21(++_0x1948da);}(_0x6569,0xcb));var _0x9656=function(_0x68b976,_0x522af7){_0x68b976=_0x68b976-0x0;var _0x1fdd7b=_0x6569[_0x68b976];return _0x1fdd7b;};'use strict';var _=require(_0x9656('0x0'));var util=require(_0x9656('0x1'));var moment=require(_0x9656('0x2'));var BPromise=require(_0x9656('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9656('0x4'))['db'];var utils=require(_0x9656('0x5'));var logger=require(_0x9656('0x6'))(_0x9656('0x7'));var config=require(_0x9656('0x8'));var jayson=require(_0x9656('0x9'));var client=jayson[_0x9656('0xa')][_0x9656('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x81a33f,_0xe5a421,_0x5a76ff){return new BPromise(function(_0xd6bd49,_0x50d4fe){return client[_0x9656('0xc')](_0x81a33f,_0x5a76ff)[_0x9656('0xd')](function(_0x503304){logger[_0x9656('0xe')](_0x9656('0xf'),_0xe5a421,_0x9656('0x10'));logger[_0x9656('0x11')](_0x9656('0x12'),_0xe5a421,_0x9656('0x10'),JSON['stringify'](_0x503304));if(_0x503304[_0x9656('0x13')]){if(_0x503304[_0x9656('0x13')][_0x9656('0x14')]===0x1f4){logger[_0x9656('0x13')](_0x9656('0xf'),_0xe5a421,_0x503304[_0x9656('0x13')][_0x9656('0x15')]);return _0x50d4fe(_0x503304[_0x9656('0x13')][_0x9656('0x15')]);}logger[_0x9656('0x13')](_0x9656('0xf'),_0xe5a421,_0x503304[_0x9656('0x13')]['message']);return _0xd6bd49(_0x503304['error'][_0x9656('0x15')]);}else{logger[_0x9656('0xe')]('Template,\x20%s,\x20%s',_0xe5a421,_0x9656('0x10'));_0xd6bd49(_0x503304[_0x9656('0x16')][_0x9656('0x15')]);}})['catch'](function(_0x4f0f08){logger[_0x9656('0x13')](_0x9656('0xf'),_0xe5a421,_0x4f0f08);_0x50d4fe(_0x4f0f08);});});}exports['GetTemplate']=function(_0x104367){var _0x54d99b=this;return new Promise(function(_0x56697b,_0x556785){return db['Template'][_0x9656('0x17')]({'raw':_0x104367[_0x9656('0x18')]?_0x104367[_0x9656('0x18')][_0x9656('0x19')]===undefined?!![]:![]:!![],'where':_0x104367[_0x9656('0x18')]?_0x104367['options'][_0x9656('0x1a')]||null:null,'attributes':_0x104367[_0x9656('0x18')]?_0x104367['options'][_0x9656('0x1b')]||null:null,'limit':_0x104367[_0x9656('0x18')]?_0x104367[_0x9656('0x18')][_0x9656('0x1c')]||null:null,'include':_0x104367[_0x9656('0x18')]?_0x104367[_0x9656('0x18')]['include']?_[_0x9656('0x1d')](_0x104367[_0x9656('0x18')]['include'],function(_0x33a749){return{'model':db[_0x33a749[_0x9656('0x1e')]],'as':_0x33a749['as'],'attributes':_0x33a749[_0x9656('0x1b')],'include':_0x33a749[_0x9656('0x1f')]?_[_0x9656('0x1d')](_0x33a749[_0x9656('0x1f')],function(_0x3369b0){return{'model':db[_0x3369b0[_0x9656('0x1e')]],'as':_0x3369b0['as'],'attributes':_0x3369b0[_0x9656('0x1b')],'include':_0x3369b0[_0x9656('0x1f')]?_[_0x9656('0x1d')](_0x3369b0[_0x9656('0x1f')],function(_0x5f1301){return{'model':db[_0x5f1301['model']],'as':_0x5f1301['as'],'attributes':_0x5f1301[_0x9656('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x9656('0xd')](function(_0x114823){logger[_0x9656('0xe')](_0x9656('0x20'),_0x104367);logger['debug']('GetTemplate',_0x104367,JSON[_0x9656('0x21')](_0x114823));_0x56697b(_0x114823);})[_0x9656('0x22')](function(_0x22149b){logger['error'](_0x9656('0x20'),_0x22149b['message'],_0x104367);_0x556785(_0x54d99b[_0x9656('0x13')](0x1f4,_0x22149b[_0x9656('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index d1f4a25..d380c10 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 _0xdc22=['express','Router','fs-extra','../../components/auth/service','./trigger.controller','get','isAuthenticated','index','/:id','show','/:id/all_conditions','/:id/any_conditions','getAnyConditions','post','create','addAllCondition','/:id/actions','addAction','put','destroy','exports','multer','util','path'];(function(_0x4695ba,_0x5a7f2a){var _0x524b7d=function(_0xfc9707){while(--_0xfc9707){_0x4695ba['push'](_0x4695ba['shift']());}};_0x524b7d(++_0x5a7f2a);}(_0xdc22,0xed));var _0x2dc2=function(_0x5cd51d,_0x20d4fa){_0x5cd51d=_0x5cd51d-0x0;var _0x444608=_0xdc22[_0x5cd51d];return _0x444608;};'use strict';var multer=require(_0x2dc2('0x0'));var util=require(_0x2dc2('0x1'));var path=require(_0x2dc2('0x2'));var timeout=require('connect-timeout');var express=require(_0x2dc2('0x3'));var router=express[_0x2dc2('0x4')]();var fs_extra=require(_0x2dc2('0x5'));var auth=require(_0x2dc2('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x2dc2('0x7'));router[_0x2dc2('0x8')]('/',auth[_0x2dc2('0x9')](),controller[_0x2dc2('0xa')]);router['get'](_0x2dc2('0xb'),auth['isAuthenticated'](),controller[_0x2dc2('0xc')]);router['get'](_0x2dc2('0xd'),auth['isAuthenticated'](),controller['getAllConditions']);router['get'](_0x2dc2('0xe'),auth[_0x2dc2('0x9')](),controller[_0x2dc2('0xf')]);router['get']('/:id/actions',auth[_0x2dc2('0x9')](),controller['getActions']);router[_0x2dc2('0x10')]('/',auth['isAuthenticated'](),controller[_0x2dc2('0x11')]);router[_0x2dc2('0x10')](_0x2dc2('0xd'),auth[_0x2dc2('0x9')](),controller[_0x2dc2('0x12')]);router[_0x2dc2('0x10')](_0x2dc2('0xe'),auth['isAuthenticated'](),controller['addAnyCondition']);router[_0x2dc2('0x10')](_0x2dc2('0x13'),auth[_0x2dc2('0x9')](),controller[_0x2dc2('0x14')]);router[_0x2dc2('0x15')](_0x2dc2('0xb'),auth[_0x2dc2('0x9')](),controller['update']);router['delete'](_0x2dc2('0xb'),auth[_0x2dc2('0x9')](),controller[_0x2dc2('0x16')]);module[_0x2dc2('0x17')]=router; \ No newline at end of file +var _0xfbf1=['../../components/auth/service','../../config/environment','get','index','/:id','/:id/all_conditions','isAuthenticated','getAllConditions','getActions','post','create','addAnyCondition','/:id/actions','addAction','put','update','delete','exports','multer','util','path','express','Router'];(function(_0x47ee23,_0x58aad2){var _0x5b4718=function(_0x25cd81){while(--_0x25cd81){_0x47ee23['push'](_0x47ee23['shift']());}};_0x5b4718(++_0x58aad2);}(_0xfbf1,0x16b));var _0x1fbf=function(_0x3469f5,_0x241159){_0x3469f5=_0x3469f5-0x0;var _0x4b962c=_0xfbf1[_0x3469f5];return _0x4b962c;};'use strict';var multer=require(_0x1fbf('0x0'));var util=require(_0x1fbf('0x1'));var path=require(_0x1fbf('0x2'));var timeout=require('connect-timeout');var express=require(_0x1fbf('0x3'));var router=express[_0x1fbf('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x1fbf('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1fbf('0x6'));var controller=require('./trigger.controller');router[_0x1fbf('0x7')]('/',auth['isAuthenticated'](),controller[_0x1fbf('0x8')]);router['get'](_0x1fbf('0x9'),auth['isAuthenticated'](),controller['show']);router['get'](_0x1fbf('0xa'),auth[_0x1fbf('0xb')](),controller[_0x1fbf('0xc')]);router['get']('/:id/any_conditions',auth['isAuthenticated'](),controller['getAnyConditions']);router[_0x1fbf('0x7')]('/:id/actions',auth[_0x1fbf('0xb')](),controller[_0x1fbf('0xd')]);router[_0x1fbf('0xe')]('/',auth['isAuthenticated'](),controller[_0x1fbf('0xf')]);router['post']('/:id/all_conditions',auth['isAuthenticated'](),controller['addAllCondition']);router['post']('/:id/any_conditions',auth[_0x1fbf('0xb')](),controller[_0x1fbf('0x10')]);router[_0x1fbf('0xe')](_0x1fbf('0x11'),auth[_0x1fbf('0xb')](),controller[_0x1fbf('0x12')]);router[_0x1fbf('0x13')]('/:id',auth[_0x1fbf('0xb')](),controller[_0x1fbf('0x14')]);router[_0x1fbf('0x15')]('/:id',auth[_0x1fbf('0xb')](),controller['destroy']);module[_0x1fbf('0x16')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 4d20ac2..02439de 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 _0x42bd=['STRING','BOOLEAN','sequelize'];(function(_0x98ee7c,_0x499bff){var _0xe4d709=function(_0x12791a){while(--_0x12791a){_0x98ee7c['push'](_0x98ee7c['shift']());}};_0xe4d709(++_0x499bff);}(_0x42bd,0xcb));var _0xd42b=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x42bd[_0x2c91e9];return _0x13f0ff;};'use strict';var Sequelize=require(_0xd42b('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd42b('0x1')]},'status':{'type':Sequelize[_0xd42b('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x4ccd=['STRING','BOOLEAN'];(function(_0x3b732e,_0x355ad2){var _0xf019f1=function(_0x1a0e96){while(--_0x1a0e96){_0x3b732e['push'](_0x3b732e['shift']());}};_0xf019f1(++_0x355ad2);}(_0x4ccd,0x174));var _0xd4cc=function(_0x651909,_0x15c6b4){_0x651909=_0x651909-0x0;var _0x572299=_0x4ccd[_0x651909];return _0x572299;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xd4cc('0x0')]},'channel':{'type':Sequelize[_0xd4cc('0x0')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0xd4cc('0x1')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 499bfc2..7056008 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 _0x1733=['zip-dir','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','set','Content-Range','apply','reject','save','then','get','Triggers','UserProfileResource','error','stack','name','send','index','Trigger','rawAttributes','fieldName','type','model','map','query','intersection','fields','attributes','length','hasOwnProperty','order','sort','filters','pick','filter','merge','options','count','includeAll','include','findAll','rows','catch','show','params','keys','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','addAllCondition','TriggerAllId','addAnyCondition','Condition','getAllConditions','findOne','nolimit','where','getAnyConditions','addAction','TriggerId','Action','getActions','rimraf'];(function(_0x51341b,_0x1f7435){var _0x11cd33=function(_0x5a0a2c){while(--_0x5a0a2c){_0x51341b['push'](_0x51341b['shift']());}};_0x11cd33(++_0x1f7435);}(_0x1733,0x17f));var _0x3173=function(_0x2f1eea,_0x42db0b){_0x2f1eea=_0x2f1eea-0x0;var _0x11a398=_0x1733[_0x2f1eea];return _0x11a398;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3173('0x0'));var zipdir=require(_0x3173('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3173('0x2'));var Mustache=require(_0x3173('0x3'));var util=require(_0x3173('0x4'));var path=require(_0x3173('0x5'));var sox=require(_0x3173('0x6'));var csv=require(_0x3173('0x7'));var ejs=require(_0x3173('0x8'));var fs=require('fs');var fs_extra=require(_0x3173('0x9'));var _=require(_0x3173('0xa'));var squel=require(_0x3173('0xb'));var crypto=require(_0x3173('0xc'));var jsforce=require(_0x3173('0xd'));var deskjs=require(_0x3173('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3173('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x3173('0x10'));var as=require(_0x3173('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3173('0x12'));var utils=require(_0x3173('0x13'));var config=require(_0x3173('0x14'));var licenseUtil=require(_0x3173('0x15'));var db=require(_0x3173('0x16'))['db'];function respondWithStatusCode(_0x45811e,_0x466e49){_0x466e49=_0x466e49||0xcc;return function(_0x64192a){if(_0x64192a){return _0x45811e[_0x3173('0x17')](_0x466e49);}return _0x45811e[_0x3173('0x18')](_0x466e49)[_0x3173('0x19')]();};}function respondWithResult(_0x29d2bb,_0x1db486){_0x1db486=_0x1db486||0xc8;return function(_0x35d530){if(_0x35d530){return _0x29d2bb['status'](_0x1db486)[_0x3173('0x1a')](_0x35d530);}};}function respondWithFilteredResult(_0x1442f4,_0x489b8c){return function(_0x4f9650){if(_0x4f9650){var _0x477856=typeof _0x489b8c[_0x3173('0x1b')]==='undefined'&&typeof _0x489b8c[_0x3173('0x1c')]===_0x3173('0x1d');var _0x5a299b=_0x4f9650['count'];var _0x3587c0=_0x477856?0x0:_0x489b8c[_0x3173('0x1b')];var _0x5a3443=_0x477856?_0x4f9650['count']:_0x489b8c[_0x3173('0x1b')]+_0x489b8c['limit'];var _0x37b4fe;if(_0x5a3443>=_0x5a299b){_0x5a3443=_0x5a299b;_0x37b4fe=0xc8;}else{_0x37b4fe=0xce;}_0x1442f4[_0x3173('0x18')](_0x37b4fe);return _0x1442f4[_0x3173('0x1e')](_0x3173('0x1f'),_0x3587c0+'-'+_0x5a3443+'/'+_0x5a299b)[_0x3173('0x1a')](_0x4f9650);}return null;};}function patchUpdates(_0x21ed34){return function(_0x594953){try{jsonpatch[_0x3173('0x20')](_0x594953,_0x21ed34,!![]);}catch(_0x3fb4ec){return BPromise[_0x3173('0x21')](_0x3fb4ec);}return _0x594953[_0x3173('0x22')]();};}function saveUpdates(_0x59f1cb,_0x44096a){return function(_0x30fb51){if(_0x30fb51){return _0x30fb51['update'](_0x59f1cb)[_0x3173('0x23')](function(_0x381a18){return _0x381a18;});}return null;};}function removeEntity(_0x6e9d67,_0x672f81){return function(_0x337dce){if(_0x337dce){return _0x337dce['destroy']()['then'](function(){var _0x1f3edd=_0x337dce[_0x3173('0x24')]({'plain':!![]});var _0xc1168e=_0x3173('0x25');return db[_0x3173('0x26')]['destroy']({'where':{'type':_0xc1168e,'resourceId':_0x1f3edd['id']}})['then'](function(){return _0x337dce;});})['then'](function(){_0x6e9d67[_0x3173('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x40cd7e,_0x37d443){return function(_0x2b8c0c){if(!_0x2b8c0c){_0x40cd7e[_0x3173('0x17')](0x194);}return _0x2b8c0c;};}function handleError(_0x5520cd,_0x3bf178){_0x3bf178=_0x3bf178||0x1f4;return function(_0x508251){logger[_0x3173('0x27')](_0x508251[_0x3173('0x28')]);if(_0x508251[_0x3173('0x29')]){delete _0x508251[_0x3173('0x29')];}_0x5520cd[_0x3173('0x18')](_0x3bf178)[_0x3173('0x2a')](_0x508251);};}exports[_0x3173('0x2b')]=function(_0x404165,_0x5a93f6){var _0xff5d57={},_0x41f397={},_0x37d98b={'count':0x0,'rows':[]};var _0x3700d7=_['map'](db[_0x3173('0x2c')][_0x3173('0x2d')],function(_0x9f8d58){return{'name':_0x9f8d58[_0x3173('0x2e')],'type':_0x9f8d58[_0x3173('0x2f')]['key']};});_0x41f397[_0x3173('0x30')]=_[_0x3173('0x31')](_0x3700d7,_0x3173('0x29'));_0x41f397[_0x3173('0x32')]=_['keys'](_0x404165[_0x3173('0x32')]);_0x41f397['filters']=_[_0x3173('0x33')](_0x41f397[_0x3173('0x30')],_0x41f397[_0x3173('0x32')]);_0xff5d57['attributes']=_[_0x3173('0x33')](_0x41f397[_0x3173('0x30')],qs[_0x3173('0x34')](_0x404165['query'][_0x3173('0x34')]));_0xff5d57[_0x3173('0x35')]=_0xff5d57[_0x3173('0x35')][_0x3173('0x36')]?_0xff5d57[_0x3173('0x35')]:_0x41f397[_0x3173('0x30')];if(!_0x404165['query'][_0x3173('0x37')]('nolimit')){_0xff5d57[_0x3173('0x1c')]=qs[_0x3173('0x1c')](_0x404165[_0x3173('0x32')]['limit']);_0xff5d57[_0x3173('0x1b')]=qs[_0x3173('0x1b')](_0x404165[_0x3173('0x32')][_0x3173('0x1b')]);}_0xff5d57[_0x3173('0x38')]=qs[_0x3173('0x39')](_0x404165['query'][_0x3173('0x39')]);_0xff5d57['where']=qs[_0x3173('0x3a')](_[_0x3173('0x3b')](_0x404165[_0x3173('0x32')],_0x41f397['filters']),_0x3700d7);if(_0x404165[_0x3173('0x32')][_0x3173('0x3c')]){_0xff5d57['where']=_[_0x3173('0x3d')](_0xff5d57['where'],{'$or':_[_0x3173('0x31')](_0x3700d7,function(_0x141b44){if(_0x141b44[_0x3173('0x2f')]!=='VIRTUAL'){var _0xd819f3={};_0xd819f3[_0x141b44[_0x3173('0x29')]]={'$like':'%'+_0x404165[_0x3173('0x32')][_0x3173('0x3c')]+'%'};return _0xd819f3;}})});}_0xff5d57=_[_0x3173('0x3d')]({},_0xff5d57,_0x404165[_0x3173('0x3e')]);var _0x4ac0a8={'where':_0xff5d57['where']};return db[_0x3173('0x2c')]['count'](_0x4ac0a8)[_0x3173('0x23')](function(_0x14be45){_0x37d98b[_0x3173('0x3f')]=_0x14be45;if(_0x404165['query'][_0x3173('0x40')]){_0xff5d57[_0x3173('0x41')]=[{'all':!![]}];}return db[_0x3173('0x2c')][_0x3173('0x42')](_0xff5d57);})['then'](function(_0x2a5b19){_0x37d98b[_0x3173('0x43')]=_0x2a5b19;return _0x37d98b;})[_0x3173('0x23')](respondWithFilteredResult(_0x5a93f6,_0xff5d57))[_0x3173('0x44')](handleError(_0x5a93f6,null));};exports[_0x3173('0x45')]=function(_0x33feb1,_0x23af57){var _0x1e207a={'raw':![],'where':{'id':_0x33feb1[_0x3173('0x46')]['id']}},_0x4f60cf={};_0x4f60cf[_0x3173('0x30')]=_[_0x3173('0x47')](db['Trigger'][_0x3173('0x2d')]);_0x4f60cf[_0x3173('0x32')]=_[_0x3173('0x47')](_0x33feb1[_0x3173('0x32')]);_0x4f60cf['filters']=_['intersection'](_0x4f60cf[_0x3173('0x30')],_0x4f60cf[_0x3173('0x32')]);_0x1e207a[_0x3173('0x35')]=_['intersection'](_0x4f60cf[_0x3173('0x30')],qs[_0x3173('0x34')](_0x33feb1[_0x3173('0x32')]['fields']));_0x1e207a[_0x3173('0x35')]=_0x1e207a[_0x3173('0x35')][_0x3173('0x36')]?_0x1e207a[_0x3173('0x35')]:_0x4f60cf[_0x3173('0x30')];if(_0x33feb1['query'][_0x3173('0x40')]){_0x1e207a[_0x3173('0x41')]=[{'all':!![]}];}_0x1e207a=_['merge']({},_0x1e207a,_0x33feb1[_0x3173('0x3e')]);return db[_0x3173('0x2c')][_0x3173('0x48')](_0x1e207a)['then'](handleEntityNotFound(_0x23af57,null))[_0x3173('0x23')](respondWithResult(_0x23af57,null))[_0x3173('0x44')](handleError(_0x23af57,null));};exports[_0x3173('0x49')]=function(_0x249b6f,_0x247140){return db[_0x3173('0x2c')][_0x3173('0x49')](_0x249b6f['body'],{})[_0x3173('0x23')](function(_0x190b73){var _0x531764=_0x249b6f['user'][_0x3173('0x24')]({'plain':!![]});if(!_0x531764)throw new Error(_0x3173('0x4a'));if(_0x531764[_0x3173('0x4b')]===_0x3173('0x4c')){var _0x5da2dc=_0x190b73[_0x3173('0x24')]({'plain':!![]});var _0x3b998c=_0x3173('0x25');return db[_0x3173('0x4d')][_0x3173('0x48')]({'where':{'name':_0x3b998c,'userProfileId':_0x531764[_0x3173('0x4e')]},'raw':!![]})[_0x3173('0x23')](function(_0x57a5b6){if(_0x57a5b6&&_0x57a5b6[_0x3173('0x4f')]===0x0){return db['UserProfileResource'][_0x3173('0x49')]({'name':_0x5da2dc[_0x3173('0x29')],'resourceId':_0x5da2dc['id'],'type':_0x57a5b6[_0x3173('0x29')],'sectionId':_0x57a5b6['id']},{})[_0x3173('0x23')](function(){return _0x190b73;});}else{return _0x190b73;}})[_0x3173('0x44')](function(_0x486dbc){logger[_0x3173('0x27')](_0x3173('0x50'),_0x486dbc);throw _0x486dbc;});}return _0x190b73;})['then'](respondWithResult(_0x247140,0xc9))['catch'](handleError(_0x247140,null));};exports['update']=function(_0x34f5,_0x2018bc){if(_0x34f5[_0x3173('0x51')]['id']){delete _0x34f5[_0x3173('0x51')]['id'];}return db[_0x3173('0x2c')][_0x3173('0x48')]({'where':{'id':_0x34f5['params']['id']}})[_0x3173('0x23')](handleEntityNotFound(_0x2018bc,null))[_0x3173('0x23')](saveUpdates(_0x34f5[_0x3173('0x51')],null))[_0x3173('0x23')](respondWithResult(_0x2018bc,null))[_0x3173('0x44')](handleError(_0x2018bc,null));};exports[_0x3173('0x52')]=function(_0x46f507,_0x4886d6){return db[_0x3173('0x2c')][_0x3173('0x48')]({'where':{'id':_0x46f507['params']['id']}})[_0x3173('0x23')](handleEntityNotFound(_0x4886d6,null))[_0x3173('0x23')](removeEntity(_0x4886d6,null))[_0x3173('0x44')](handleError(_0x4886d6,null));};exports[_0x3173('0x53')]=function(_0x5741e8,_0x3866a9,_0x34d545){if(_0x5741e8[_0x3173('0x51')]['id']){delete _0x5741e8[_0x3173('0x51')]['id'];}return db['Trigger'][_0x3173('0x48')]({'where':{'id':_0x5741e8[_0x3173('0x46')]['id']}})[_0x3173('0x23')](handleEntityNotFound(_0x3866a9,null))[_0x3173('0x23')](function(_0x32c1aa){if(_0x32c1aa){_0x5741e8[_0x3173('0x51')][_0x3173('0x54')]=_0x32c1aa['id'];return db['Condition']['create'](_0x5741e8[_0x3173('0x51')]);}})[_0x3173('0x23')](respondWithResult(_0x3866a9,null))[_0x3173('0x44')](handleError(_0x3866a9,null));};exports[_0x3173('0x55')]=function(_0x54cbf8,_0x1299de,_0x5841ed){if(_0x54cbf8[_0x3173('0x51')]['id']){delete _0x54cbf8[_0x3173('0x51')]['id'];}return db['Trigger'][_0x3173('0x48')]({'where':{'id':_0x54cbf8[_0x3173('0x46')]['id']}})[_0x3173('0x23')](handleEntityNotFound(_0x1299de,null))[_0x3173('0x23')](function(_0x407d93){if(_0x407d93){_0x54cbf8['body']['TriggerAnyId']=_0x407d93['id'];return db[_0x3173('0x56')][_0x3173('0x49')](_0x54cbf8[_0x3173('0x51')]);}})[_0x3173('0x23')](respondWithResult(_0x1299de,null))[_0x3173('0x44')](handleError(_0x1299de,null));};exports[_0x3173('0x57')]=function(_0x2646dd,_0x2aac71,_0x32ea09){var _0x4a604c={};var _0x3b09bd={};var _0x549ae3;var _0x3a88eb;return db[_0x3173('0x2c')][_0x3173('0x58')]({'where':{'id':_0x2646dd[_0x3173('0x46')]['id']}})[_0x3173('0x23')](handleEntityNotFound(_0x2aac71,null))[_0x3173('0x23')](function(_0x47aa7a){if(_0x47aa7a){_0x549ae3=_0x47aa7a;_0x3b09bd[_0x3173('0x30')]=_['keys'](db[_0x3173('0x56')]['rawAttributes']);_0x3b09bd[_0x3173('0x32')]=_[_0x3173('0x47')](_0x2646dd[_0x3173('0x32')]);_0x3b09bd[_0x3173('0x3a')]=_[_0x3173('0x33')](_0x3b09bd['model'],_0x3b09bd[_0x3173('0x32')]);_0x4a604c['attributes']=_[_0x3173('0x33')](_0x3b09bd[_0x3173('0x30')],qs[_0x3173('0x34')](_0x2646dd[_0x3173('0x32')][_0x3173('0x34')]));_0x4a604c['attributes']=_0x4a604c[_0x3173('0x35')][_0x3173('0x36')]?_0x4a604c[_0x3173('0x35')]:_0x3b09bd['model'];_0x4a604c['order']=qs[_0x3173('0x39')](_0x2646dd[_0x3173('0x32')][_0x3173('0x39')]);_0x4a604c['where']=qs[_0x3173('0x3a')](_[_0x3173('0x3b')](_0x2646dd[_0x3173('0x32')],_0x3b09bd[_0x3173('0x3a')]));if(_0x2646dd[_0x3173('0x32')][_0x3173('0x3c')]){_0x4a604c['where']=_[_0x3173('0x3d')](_0x4a604c['where'],{'$or':_[_0x3173('0x31')](_0x4a604c[_0x3173('0x35')],function(_0x514f11){var _0x4aceb1={};_0x4aceb1[_0x514f11]={'$like':'%'+_0x2646dd['query'][_0x3173('0x3c')]+'%'};return _0x4aceb1;})});}_0x4a604c=_[_0x3173('0x3d')]({},_0x4a604c,_0x2646dd[_0x3173('0x3e')]);return _0x549ae3[_0x3173('0x57')](_0x4a604c);}})[_0x3173('0x23')](function(_0x51e161){if(_0x51e161){_0x3a88eb=_0x51e161['length'];if(!_0x2646dd[_0x3173('0x32')][_0x3173('0x37')](_0x3173('0x59'))){_0x4a604c[_0x3173('0x1c')]=qs[_0x3173('0x1c')](_0x2646dd[_0x3173('0x32')][_0x3173('0x1c')]);_0x4a604c['offset']=qs['offset'](_0x2646dd[_0x3173('0x32')][_0x3173('0x1b')]);}return _0x549ae3['getAllConditions'](_0x4a604c);}})[_0x3173('0x23')](function(_0x3e1f63){if(_0x3e1f63){return _0x3e1f63?{'count':_0x3a88eb,'rows':_0x3e1f63}:null;}})[_0x3173('0x23')](respondWithResult(_0x2aac71,null))[_0x3173('0x44')](handleError(_0x2aac71,null));};exports['getAnyConditions']=function(_0x304e26,_0x15d49d,_0x36f92d){var _0x4c679a={};var _0x273539={};var _0x4952f9;var _0x3474d9;return db[_0x3173('0x2c')]['findOne']({'where':{'id':_0x304e26[_0x3173('0x46')]['id']}})[_0x3173('0x23')](handleEntityNotFound(_0x15d49d,null))[_0x3173('0x23')](function(_0x294ece){if(_0x294ece){_0x4952f9=_0x294ece;_0x273539[_0x3173('0x30')]=_[_0x3173('0x47')](db['Condition'][_0x3173('0x2d')]);_0x273539[_0x3173('0x32')]=_['keys'](_0x304e26[_0x3173('0x32')]);_0x273539[_0x3173('0x3a')]=_[_0x3173('0x33')](_0x273539[_0x3173('0x30')],_0x273539[_0x3173('0x32')]);_0x4c679a[_0x3173('0x35')]=_['intersection'](_0x273539[_0x3173('0x30')],qs['fields'](_0x304e26['query']['fields']));_0x4c679a[_0x3173('0x35')]=_0x4c679a['attributes'][_0x3173('0x36')]?_0x4c679a[_0x3173('0x35')]:_0x273539['model'];_0x4c679a[_0x3173('0x38')]=qs[_0x3173('0x39')](_0x304e26[_0x3173('0x32')][_0x3173('0x39')]);_0x4c679a[_0x3173('0x5a')]=qs['filters'](_[_0x3173('0x3b')](_0x304e26[_0x3173('0x32')],_0x273539['filters']));if(_0x304e26['query'][_0x3173('0x3c')]){_0x4c679a[_0x3173('0x5a')]=_[_0x3173('0x3d')](_0x4c679a[_0x3173('0x5a')],{'$or':_[_0x3173('0x31')](_0x4c679a[_0x3173('0x35')],function(_0xe5cf3){var _0x57e61f={};_0x57e61f[_0xe5cf3]={'$like':'%'+_0x304e26[_0x3173('0x32')][_0x3173('0x3c')]+'%'};return _0x57e61f;})});}_0x4c679a=_[_0x3173('0x3d')]({},_0x4c679a,_0x304e26['options']);return _0x4952f9[_0x3173('0x5b')](_0x4c679a);}})[_0x3173('0x23')](function(_0x5dce1e){if(_0x5dce1e){_0x3474d9=_0x5dce1e[_0x3173('0x36')];if(!_0x304e26['query'][_0x3173('0x37')](_0x3173('0x59'))){_0x4c679a[_0x3173('0x1c')]=qs[_0x3173('0x1c')](_0x304e26[_0x3173('0x32')][_0x3173('0x1c')]);_0x4c679a[_0x3173('0x1b')]=qs['offset'](_0x304e26[_0x3173('0x32')][_0x3173('0x1b')]);}return _0x4952f9[_0x3173('0x5b')](_0x4c679a);}})[_0x3173('0x23')](function(_0x205ff6){if(_0x205ff6){return _0x205ff6?{'count':_0x3474d9,'rows':_0x205ff6}:null;}})[_0x3173('0x23')](respondWithResult(_0x15d49d,null))[_0x3173('0x44')](handleError(_0x15d49d,null));};exports[_0x3173('0x5c')]=function(_0x16fd7d,_0x3a2f31,_0x41ae65){if(_0x16fd7d[_0x3173('0x51')]['id']){delete _0x16fd7d[_0x3173('0x51')]['id'];}return db[_0x3173('0x2c')][_0x3173('0x48')]({'where':{'id':_0x16fd7d[_0x3173('0x46')]['id']}})['then'](handleEntityNotFound(_0x3a2f31,null))[_0x3173('0x23')](function(_0x145aa6){if(_0x145aa6){_0x16fd7d['body'][_0x3173('0x5d')]=_0x145aa6['id'];return db[_0x3173('0x5e')][_0x3173('0x49')](_0x16fd7d[_0x3173('0x51')]);}})[_0x3173('0x23')](respondWithResult(_0x3a2f31,null))[_0x3173('0x44')](handleError(_0x3a2f31,null));};exports[_0x3173('0x5f')]=function(_0x556744,_0x10a6af,_0x145ba3){var _0x4934c7={};var _0x45850e={};var _0x35b918;var _0x2cfb0f;return db[_0x3173('0x2c')][_0x3173('0x58')]({'where':{'id':_0x556744['params']['id']}})[_0x3173('0x23')](handleEntityNotFound(_0x10a6af,null))[_0x3173('0x23')](function(_0xdba9b9){if(_0xdba9b9){_0x35b918=_0xdba9b9;_0x45850e[_0x3173('0x30')]=_[_0x3173('0x47')](db[_0x3173('0x5e')][_0x3173('0x2d')]);_0x45850e[_0x3173('0x32')]=_[_0x3173('0x47')](_0x556744[_0x3173('0x32')]);_0x45850e[_0x3173('0x3a')]=_[_0x3173('0x33')](_0x45850e[_0x3173('0x30')],_0x45850e[_0x3173('0x32')]);_0x4934c7[_0x3173('0x35')]=_[_0x3173('0x33')](_0x45850e[_0x3173('0x30')],qs[_0x3173('0x34')](_0x556744[_0x3173('0x32')]['fields']));_0x4934c7[_0x3173('0x35')]=_0x4934c7['attributes'][_0x3173('0x36')]?_0x4934c7['attributes']:_0x45850e[_0x3173('0x30')];_0x4934c7[_0x3173('0x38')]=qs['sort'](_0x556744['query'][_0x3173('0x39')]);_0x4934c7[_0x3173('0x5a')]=qs[_0x3173('0x3a')](_[_0x3173('0x3b')](_0x556744[_0x3173('0x32')],_0x45850e[_0x3173('0x3a')]));if(_0x556744[_0x3173('0x32')]['filter']){_0x4934c7['where']=_[_0x3173('0x3d')](_0x4934c7[_0x3173('0x5a')],{'$or':_[_0x3173('0x31')](_0x4934c7['attributes'],function(_0xd21682){var _0x1fb4d6={};_0x1fb4d6[_0xd21682]={'$like':'%'+_0x556744[_0x3173('0x32')][_0x3173('0x3c')]+'%'};return _0x1fb4d6;})});}_0x4934c7=_[_0x3173('0x3d')]({},_0x4934c7,_0x556744[_0x3173('0x3e')]);return _0x35b918['getActions'](_0x4934c7);}})[_0x3173('0x23')](function(_0x3ec125){if(_0x3ec125){_0x2cfb0f=_0x3ec125['length'];if(!_0x556744['query']['hasOwnProperty'](_0x3173('0x59'))){_0x4934c7[_0x3173('0x1c')]=qs[_0x3173('0x1c')](_0x556744[_0x3173('0x32')][_0x3173('0x1c')]);_0x4934c7[_0x3173('0x1b')]=qs[_0x3173('0x1b')](_0x556744[_0x3173('0x32')]['offset']);}return _0x35b918[_0x3173('0x5f')](_0x4934c7);}})[_0x3173('0x23')](function(_0x39dd00){if(_0x39dd00){return _0x39dd00?{'count':_0x2cfb0f,'rows':_0x39dd00}:null;}})[_0x3173('0x23')](respondWithResult(_0x10a6af,null))['catch'](handleError(_0x10a6af,null));}; \ No newline at end of file +var _0xa415=['zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','then','destroy','get','Triggers','UserProfileResource','error','stack','name','index','map','Trigger','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','params','include','create','body','user','role','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','Condition','addAnyCondition','TriggerAnyId','getAllConditions','order','getAnyConditions','findOne','addAction','getActions','Action','eml-format','rimraf'];(function(_0x3e6b73,_0x531d4e){var _0x1192ba=function(_0x1b4c5d){while(--_0x1b4c5d){_0x3e6b73['push'](_0x3e6b73['shift']());}};_0x1192ba(++_0x531d4e);}(_0xa415,0x166));var _0x5a41=function(_0x35cbbd,_0x5ee19a){_0x35cbbd=_0x35cbbd-0x0;var _0x308fd4=_0xa415[_0x35cbbd];return _0x308fd4;};'use strict';var emlformat=require(_0x5a41('0x0'));var rimraf=require(_0x5a41('0x1'));var zipdir=require(_0x5a41('0x2'));var jsonpatch=require(_0x5a41('0x3'));var rp=require(_0x5a41('0x4'));var moment=require(_0x5a41('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x5a41('0x6'));var util=require('util');var path=require(_0x5a41('0x7'));var sox=require(_0x5a41('0x8'));var csv=require(_0x5a41('0x9'));var ejs=require(_0x5a41('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5a41('0xb'));var squel=require(_0x5a41('0xc'));var crypto=require('crypto');var jsforce=require(_0x5a41('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x5a41('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5a41('0xe'));var authService=require(_0x5a41('0xf'));var qs=require(_0x5a41('0x10'));var as=require(_0x5a41('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5a41('0x12'))(_0x5a41('0x13'));var utils=require(_0x5a41('0x14'));var config=require(_0x5a41('0x15'));var licenseUtil=require(_0x5a41('0x16'));var db=require(_0x5a41('0x17'))['db'];function respondWithStatusCode(_0x45556f,_0xb8c779){_0xb8c779=_0xb8c779||0xcc;return function(_0x2239b6){if(_0x2239b6){return _0x45556f[_0x5a41('0x18')](_0xb8c779);}return _0x45556f['status'](_0xb8c779)[_0x5a41('0x19')]();};}function respondWithResult(_0x5abc8d,_0x49668a){_0x49668a=_0x49668a||0xc8;return function(_0x1b128c){if(_0x1b128c){return _0x5abc8d[_0x5a41('0x1a')](_0x49668a)[_0x5a41('0x1b')](_0x1b128c);}};}function respondWithFilteredResult(_0x47c62c,_0x20be3a){return function(_0x11b8d4){if(_0x11b8d4){var _0x4ed194=typeof _0x20be3a[_0x5a41('0x1c')]===_0x5a41('0x1d')&&typeof _0x20be3a[_0x5a41('0x1e')]===_0x5a41('0x1d');var _0x40d1e9=_0x11b8d4['count'];var _0x348448=_0x4ed194?0x0:_0x20be3a[_0x5a41('0x1c')];var _0x255d36=_0x4ed194?_0x11b8d4[_0x5a41('0x1f')]:_0x20be3a[_0x5a41('0x1c')]+_0x20be3a['limit'];var _0x2511c2;if(_0x255d36>=_0x40d1e9){_0x255d36=_0x40d1e9;_0x2511c2=0xc8;}else{_0x2511c2=0xce;}_0x47c62c[_0x5a41('0x1a')](_0x2511c2);return _0x47c62c[_0x5a41('0x20')](_0x5a41('0x21'),_0x348448+'-'+_0x255d36+'/'+_0x40d1e9)[_0x5a41('0x1b')](_0x11b8d4);}return null;};}function patchUpdates(_0x52bd39){return function(_0xc0c93c){try{jsonpatch['apply'](_0xc0c93c,_0x52bd39,!![]);}catch(_0x1c5cc3){return BPromise[_0x5a41('0x22')](_0x1c5cc3);}return _0xc0c93c['save']();};}function saveUpdates(_0x251004,_0x175632){return function(_0x1461af){if(_0x1461af){return _0x1461af['update'](_0x251004)[_0x5a41('0x23')](function(_0x49e2f7){return _0x49e2f7;});}return null;};}function removeEntity(_0xe5ba02,_0x205d8b){return function(_0x2de596){if(_0x2de596){return _0x2de596[_0x5a41('0x24')]()['then'](function(){var _0x5ebe54=_0x2de596[_0x5a41('0x25')]({'plain':!![]});var _0x237a81=_0x5a41('0x26');return db[_0x5a41('0x27')]['destroy']({'where':{'type':_0x237a81,'resourceId':_0x5ebe54['id']}})[_0x5a41('0x23')](function(){return _0x2de596;});})[_0x5a41('0x23')](function(){_0xe5ba02[_0x5a41('0x1a')](0xcc)[_0x5a41('0x19')]();});}};}function handleEntityNotFound(_0xf68913,_0x5adde4){return function(_0xb75180){if(!_0xb75180){_0xf68913['sendStatus'](0x194);}return _0xb75180;};}function handleError(_0x16b479,_0x3e4cb7){_0x3e4cb7=_0x3e4cb7||0x1f4;return function(_0xdf1cd2){logger[_0x5a41('0x28')](_0xdf1cd2[_0x5a41('0x29')]);if(_0xdf1cd2[_0x5a41('0x2a')]){delete _0xdf1cd2[_0x5a41('0x2a')];}_0x16b479[_0x5a41('0x1a')](_0x3e4cb7)['send'](_0xdf1cd2);};}exports[_0x5a41('0x2b')]=function(_0x37f3b3,_0x2fd5bd){var _0x49778b={},_0x3625bd={},_0x25352b={'count':0x0,'rows':[]};var _0x58399b=_[_0x5a41('0x2c')](db[_0x5a41('0x2d')][_0x5a41('0x2e')],function(_0x2dd74c){return{'name':_0x2dd74c[_0x5a41('0x2f')],'type':_0x2dd74c[_0x5a41('0x30')]['key']};});_0x3625bd[_0x5a41('0x31')]=_[_0x5a41('0x2c')](_0x58399b,_0x5a41('0x2a'));_0x3625bd[_0x5a41('0x32')]=_[_0x5a41('0x33')](_0x37f3b3[_0x5a41('0x32')]);_0x3625bd[_0x5a41('0x34')]=_[_0x5a41('0x35')](_0x3625bd[_0x5a41('0x31')],_0x3625bd['query']);_0x49778b[_0x5a41('0x36')]=_['intersection'](_0x3625bd['model'],qs[_0x5a41('0x37')](_0x37f3b3[_0x5a41('0x32')]['fields']));_0x49778b[_0x5a41('0x36')]=_0x49778b[_0x5a41('0x36')][_0x5a41('0x38')]?_0x49778b[_0x5a41('0x36')]:_0x3625bd[_0x5a41('0x31')];if(!_0x37f3b3[_0x5a41('0x32')][_0x5a41('0x39')](_0x5a41('0x3a'))){_0x49778b[_0x5a41('0x1e')]=qs['limit'](_0x37f3b3['query']['limit']);_0x49778b[_0x5a41('0x1c')]=qs[_0x5a41('0x1c')](_0x37f3b3[_0x5a41('0x32')][_0x5a41('0x1c')]);}_0x49778b['order']=qs[_0x5a41('0x3b')](_0x37f3b3[_0x5a41('0x32')]['sort']);_0x49778b[_0x5a41('0x3c')]=qs['filters'](_[_0x5a41('0x3d')](_0x37f3b3[_0x5a41('0x32')],_0x3625bd[_0x5a41('0x34')]),_0x58399b);if(_0x37f3b3[_0x5a41('0x32')][_0x5a41('0x3e')]){_0x49778b[_0x5a41('0x3c')]=_[_0x5a41('0x3f')](_0x49778b[_0x5a41('0x3c')],{'$or':_[_0x5a41('0x2c')](_0x58399b,function(_0x51b3e1){if(_0x51b3e1[_0x5a41('0x30')]!==_0x5a41('0x40')){var _0x120cb5={};_0x120cb5[_0x51b3e1[_0x5a41('0x2a')]]={'$like':'%'+_0x37f3b3['query'][_0x5a41('0x3e')]+'%'};return _0x120cb5;}})});}_0x49778b=_['merge']({},_0x49778b,_0x37f3b3[_0x5a41('0x41')]);var _0x168002={'where':_0x49778b[_0x5a41('0x3c')]};return db[_0x5a41('0x2d')][_0x5a41('0x1f')](_0x168002)[_0x5a41('0x23')](function(_0x21bf96){_0x25352b['count']=_0x21bf96;if(_0x37f3b3[_0x5a41('0x32')][_0x5a41('0x42')]){_0x49778b['include']=[{'all':!![]}];}return db[_0x5a41('0x2d')]['findAll'](_0x49778b);})['then'](function(_0x3ccd05){_0x25352b[_0x5a41('0x43')]=_0x3ccd05;return _0x25352b;})[_0x5a41('0x23')](respondWithFilteredResult(_0x2fd5bd,_0x49778b))[_0x5a41('0x44')](handleError(_0x2fd5bd,null));};exports['show']=function(_0x4b0d68,_0x27fc08){var _0x5de7c7={'raw':![],'where':{'id':_0x4b0d68[_0x5a41('0x45')]['id']}},_0x5bc6a3={};_0x5bc6a3[_0x5a41('0x31')]=_[_0x5a41('0x33')](db[_0x5a41('0x2d')][_0x5a41('0x2e')]);_0x5bc6a3[_0x5a41('0x32')]=_[_0x5a41('0x33')](_0x4b0d68['query']);_0x5bc6a3[_0x5a41('0x34')]=_[_0x5a41('0x35')](_0x5bc6a3[_0x5a41('0x31')],_0x5bc6a3[_0x5a41('0x32')]);_0x5de7c7[_0x5a41('0x36')]=_[_0x5a41('0x35')](_0x5bc6a3[_0x5a41('0x31')],qs[_0x5a41('0x37')](_0x4b0d68[_0x5a41('0x32')]['fields']));_0x5de7c7[_0x5a41('0x36')]=_0x5de7c7['attributes']['length']?_0x5de7c7[_0x5a41('0x36')]:_0x5bc6a3[_0x5a41('0x31')];if(_0x4b0d68['query']['includeAll']){_0x5de7c7[_0x5a41('0x46')]=[{'all':!![]}];}_0x5de7c7=_[_0x5a41('0x3f')]({},_0x5de7c7,_0x4b0d68['options']);return db[_0x5a41('0x2d')]['find'](_0x5de7c7)[_0x5a41('0x23')](handleEntityNotFound(_0x27fc08,null))['then'](respondWithResult(_0x27fc08,null))[_0x5a41('0x44')](handleError(_0x27fc08,null));};exports[_0x5a41('0x47')]=function(_0x1f1b77,_0x1bc031){return db['Trigger']['create'](_0x1f1b77[_0x5a41('0x48')],{})[_0x5a41('0x23')](function(_0x226e19){var _0x34b6e8=_0x1f1b77[_0x5a41('0x49')][_0x5a41('0x25')]({'plain':!![]});if(!_0x34b6e8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x34b6e8[_0x5a41('0x4a')]==='user'){var _0x1506ec=_0x226e19[_0x5a41('0x25')]({'plain':!![]});var _0x1f0456='Triggers';return db[_0x5a41('0x4b')][_0x5a41('0x4c')]({'where':{'name':_0x1f0456,'userProfileId':_0x34b6e8[_0x5a41('0x4d')]},'raw':!![]})[_0x5a41('0x23')](function(_0x27727f){if(_0x27727f&&_0x27727f['autoAssociation']===0x0){return db[_0x5a41('0x27')][_0x5a41('0x47')]({'name':_0x1506ec[_0x5a41('0x2a')],'resourceId':_0x1506ec['id'],'type':_0x27727f[_0x5a41('0x2a')],'sectionId':_0x27727f['id']},{})[_0x5a41('0x23')](function(){return _0x226e19;});}else{return _0x226e19;}})['catch'](function(_0x4881f6){logger['error'](_0x5a41('0x4e'),_0x4881f6);throw _0x4881f6;});}return _0x226e19;})['then'](respondWithResult(_0x1bc031,0xc9))[_0x5a41('0x44')](handleError(_0x1bc031,null));};exports[_0x5a41('0x4f')]=function(_0x3b5105,_0x2bf138){if(_0x3b5105['body']['id']){delete _0x3b5105[_0x5a41('0x48')]['id'];}return db[_0x5a41('0x2d')][_0x5a41('0x4c')]({'where':{'id':_0x3b5105['params']['id']}})[_0x5a41('0x23')](handleEntityNotFound(_0x2bf138,null))[_0x5a41('0x23')](saveUpdates(_0x3b5105[_0x5a41('0x48')],null))['then'](respondWithResult(_0x2bf138,null))[_0x5a41('0x44')](handleError(_0x2bf138,null));};exports['destroy']=function(_0x2996e3,_0x1c7822){return db[_0x5a41('0x2d')][_0x5a41('0x4c')]({'where':{'id':_0x2996e3['params']['id']}})[_0x5a41('0x23')](handleEntityNotFound(_0x1c7822,null))[_0x5a41('0x23')](removeEntity(_0x1c7822,null))[_0x5a41('0x44')](handleError(_0x1c7822,null));};exports['addAllCondition']=function(_0xf329e5,_0xeecfb6,_0xce8dc6){if(_0xf329e5[_0x5a41('0x48')]['id']){delete _0xf329e5[_0x5a41('0x48')]['id'];}return db[_0x5a41('0x2d')]['find']({'where':{'id':_0xf329e5[_0x5a41('0x45')]['id']}})[_0x5a41('0x23')](handleEntityNotFound(_0xeecfb6,null))['then'](function(_0x4261ab){if(_0x4261ab){_0xf329e5[_0x5a41('0x48')]['TriggerAllId']=_0x4261ab['id'];return db[_0x5a41('0x50')][_0x5a41('0x47')](_0xf329e5[_0x5a41('0x48')]);}})[_0x5a41('0x23')](respondWithResult(_0xeecfb6,null))['catch'](handleError(_0xeecfb6,null));};exports[_0x5a41('0x51')]=function(_0x75ddc5,_0x37e8ce,_0x4770d6){if(_0x75ddc5[_0x5a41('0x48')]['id']){delete _0x75ddc5[_0x5a41('0x48')]['id'];}return db['Trigger'][_0x5a41('0x4c')]({'where':{'id':_0x75ddc5[_0x5a41('0x45')]['id']}})['then'](handleEntityNotFound(_0x37e8ce,null))['then'](function(_0x31c72b){if(_0x31c72b){_0x75ddc5['body'][_0x5a41('0x52')]=_0x31c72b['id'];return db[_0x5a41('0x50')][_0x5a41('0x47')](_0x75ddc5[_0x5a41('0x48')]);}})['then'](respondWithResult(_0x37e8ce,null))[_0x5a41('0x44')](handleError(_0x37e8ce,null));};exports[_0x5a41('0x53')]=function(_0x1389d9,_0x137189,_0x3ec2a2){var _0x4707da={};var _0x6605cc={};var _0x54ef10;var _0xc6f2ea;return db['Trigger']['findOne']({'where':{'id':_0x1389d9[_0x5a41('0x45')]['id']}})[_0x5a41('0x23')](handleEntityNotFound(_0x137189,null))['then'](function(_0x191fa9){if(_0x191fa9){_0x54ef10=_0x191fa9;_0x6605cc[_0x5a41('0x31')]=_[_0x5a41('0x33')](db[_0x5a41('0x50')]['rawAttributes']);_0x6605cc[_0x5a41('0x32')]=_['keys'](_0x1389d9['query']);_0x6605cc[_0x5a41('0x34')]=_[_0x5a41('0x35')](_0x6605cc['model'],_0x6605cc[_0x5a41('0x32')]);_0x4707da[_0x5a41('0x36')]=_[_0x5a41('0x35')](_0x6605cc[_0x5a41('0x31')],qs[_0x5a41('0x37')](_0x1389d9[_0x5a41('0x32')][_0x5a41('0x37')]));_0x4707da[_0x5a41('0x36')]=_0x4707da[_0x5a41('0x36')][_0x5a41('0x38')]?_0x4707da[_0x5a41('0x36')]:_0x6605cc[_0x5a41('0x31')];_0x4707da[_0x5a41('0x54')]=qs[_0x5a41('0x3b')](_0x1389d9['query']['sort']);_0x4707da['where']=qs['filters'](_[_0x5a41('0x3d')](_0x1389d9['query'],_0x6605cc[_0x5a41('0x34')]));if(_0x1389d9['query'][_0x5a41('0x3e')]){_0x4707da[_0x5a41('0x3c')]=_[_0x5a41('0x3f')](_0x4707da[_0x5a41('0x3c')],{'$or':_[_0x5a41('0x2c')](_0x4707da['attributes'],function(_0x69f76f){var _0x2a441b={};_0x2a441b[_0x69f76f]={'$like':'%'+_0x1389d9[_0x5a41('0x32')][_0x5a41('0x3e')]+'%'};return _0x2a441b;})});}_0x4707da=_[_0x5a41('0x3f')]({},_0x4707da,_0x1389d9['options']);return _0x54ef10[_0x5a41('0x53')](_0x4707da);}})['then'](function(_0x3afb39){if(_0x3afb39){_0xc6f2ea=_0x3afb39[_0x5a41('0x38')];if(!_0x1389d9[_0x5a41('0x32')][_0x5a41('0x39')](_0x5a41('0x3a'))){_0x4707da[_0x5a41('0x1e')]=qs[_0x5a41('0x1e')](_0x1389d9[_0x5a41('0x32')][_0x5a41('0x1e')]);_0x4707da[_0x5a41('0x1c')]=qs[_0x5a41('0x1c')](_0x1389d9['query'][_0x5a41('0x1c')]);}return _0x54ef10['getAllConditions'](_0x4707da);}})['then'](function(_0x25a58f){if(_0x25a58f){return _0x25a58f?{'count':_0xc6f2ea,'rows':_0x25a58f}:null;}})[_0x5a41('0x23')](respondWithResult(_0x137189,null))[_0x5a41('0x44')](handleError(_0x137189,null));};exports[_0x5a41('0x55')]=function(_0x20a577,_0x328c27,_0x1083fd){var _0x3bc563={};var _0x180e3e={};var _0x3175a0;var _0x591a06;return db['Trigger'][_0x5a41('0x56')]({'where':{'id':_0x20a577['params']['id']}})[_0x5a41('0x23')](handleEntityNotFound(_0x328c27,null))[_0x5a41('0x23')](function(_0x32b465){if(_0x32b465){_0x3175a0=_0x32b465;_0x180e3e[_0x5a41('0x31')]=_['keys'](db['Condition']['rawAttributes']);_0x180e3e[_0x5a41('0x32')]=_[_0x5a41('0x33')](_0x20a577[_0x5a41('0x32')]);_0x180e3e[_0x5a41('0x34')]=_[_0x5a41('0x35')](_0x180e3e[_0x5a41('0x31')],_0x180e3e[_0x5a41('0x32')]);_0x3bc563[_0x5a41('0x36')]=_['intersection'](_0x180e3e[_0x5a41('0x31')],qs[_0x5a41('0x37')](_0x20a577['query'][_0x5a41('0x37')]));_0x3bc563['attributes']=_0x3bc563[_0x5a41('0x36')][_0x5a41('0x38')]?_0x3bc563[_0x5a41('0x36')]:_0x180e3e[_0x5a41('0x31')];_0x3bc563['order']=qs[_0x5a41('0x3b')](_0x20a577[_0x5a41('0x32')][_0x5a41('0x3b')]);_0x3bc563[_0x5a41('0x3c')]=qs[_0x5a41('0x34')](_[_0x5a41('0x3d')](_0x20a577[_0x5a41('0x32')],_0x180e3e[_0x5a41('0x34')]));if(_0x20a577[_0x5a41('0x32')][_0x5a41('0x3e')]){_0x3bc563['where']=_['merge'](_0x3bc563['where'],{'$or':_[_0x5a41('0x2c')](_0x3bc563[_0x5a41('0x36')],function(_0x32e3ff){var _0xf3b813={};_0xf3b813[_0x32e3ff]={'$like':'%'+_0x20a577[_0x5a41('0x32')][_0x5a41('0x3e')]+'%'};return _0xf3b813;})});}_0x3bc563=_[_0x5a41('0x3f')]({},_0x3bc563,_0x20a577[_0x5a41('0x41')]);return _0x3175a0[_0x5a41('0x55')](_0x3bc563);}})[_0x5a41('0x23')](function(_0xd8402c){if(_0xd8402c){_0x591a06=_0xd8402c[_0x5a41('0x38')];if(!_0x20a577[_0x5a41('0x32')][_0x5a41('0x39')](_0x5a41('0x3a'))){_0x3bc563['limit']=qs['limit'](_0x20a577[_0x5a41('0x32')][_0x5a41('0x1e')]);_0x3bc563[_0x5a41('0x1c')]=qs[_0x5a41('0x1c')](_0x20a577[_0x5a41('0x32')][_0x5a41('0x1c')]);}return _0x3175a0[_0x5a41('0x55')](_0x3bc563);}})[_0x5a41('0x23')](function(_0x16dd7d){if(_0x16dd7d){return _0x16dd7d?{'count':_0x591a06,'rows':_0x16dd7d}:null;}})[_0x5a41('0x23')](respondWithResult(_0x328c27,null))[_0x5a41('0x44')](handleError(_0x328c27,null));};exports[_0x5a41('0x57')]=function(_0x289dc4,_0x120353,_0x305b18){if(_0x289dc4['body']['id']){delete _0x289dc4['body']['id'];}return db[_0x5a41('0x2d')]['find']({'where':{'id':_0x289dc4[_0x5a41('0x45')]['id']}})['then'](handleEntityNotFound(_0x120353,null))['then'](function(_0x3099b4){if(_0x3099b4){_0x289dc4[_0x5a41('0x48')]['TriggerId']=_0x3099b4['id'];return db['Action'][_0x5a41('0x47')](_0x289dc4['body']);}})[_0x5a41('0x23')](respondWithResult(_0x120353,null))[_0x5a41('0x44')](handleError(_0x120353,null));};exports[_0x5a41('0x58')]=function(_0x17a1a2,_0x2fe7f1,_0x3bfad0){var _0x1da450={};var _0x23defe={};var _0x5af765;var _0x3d4f35;return db[_0x5a41('0x2d')]['findOne']({'where':{'id':_0x17a1a2['params']['id']}})['then'](handleEntityNotFound(_0x2fe7f1,null))[_0x5a41('0x23')](function(_0x42cf7e){if(_0x42cf7e){_0x5af765=_0x42cf7e;_0x23defe['model']=_[_0x5a41('0x33')](db[_0x5a41('0x59')][_0x5a41('0x2e')]);_0x23defe[_0x5a41('0x32')]=_['keys'](_0x17a1a2[_0x5a41('0x32')]);_0x23defe[_0x5a41('0x34')]=_[_0x5a41('0x35')](_0x23defe[_0x5a41('0x31')],_0x23defe[_0x5a41('0x32')]);_0x1da450[_0x5a41('0x36')]=_[_0x5a41('0x35')](_0x23defe[_0x5a41('0x31')],qs[_0x5a41('0x37')](_0x17a1a2[_0x5a41('0x32')][_0x5a41('0x37')]));_0x1da450[_0x5a41('0x36')]=_0x1da450[_0x5a41('0x36')][_0x5a41('0x38')]?_0x1da450[_0x5a41('0x36')]:_0x23defe['model'];_0x1da450[_0x5a41('0x54')]=qs['sort'](_0x17a1a2[_0x5a41('0x32')][_0x5a41('0x3b')]);_0x1da450[_0x5a41('0x3c')]=qs[_0x5a41('0x34')](_[_0x5a41('0x3d')](_0x17a1a2[_0x5a41('0x32')],_0x23defe[_0x5a41('0x34')]));if(_0x17a1a2['query'][_0x5a41('0x3e')]){_0x1da450[_0x5a41('0x3c')]=_[_0x5a41('0x3f')](_0x1da450[_0x5a41('0x3c')],{'$or':_[_0x5a41('0x2c')](_0x1da450[_0x5a41('0x36')],function(_0x5e4dd0){var _0x52e0ca={};_0x52e0ca[_0x5e4dd0]={'$like':'%'+_0x17a1a2[_0x5a41('0x32')][_0x5a41('0x3e')]+'%'};return _0x52e0ca;})});}_0x1da450=_[_0x5a41('0x3f')]({},_0x1da450,_0x17a1a2[_0x5a41('0x41')]);return _0x5af765[_0x5a41('0x58')](_0x1da450);}})[_0x5a41('0x23')](function(_0x5cc758){if(_0x5cc758){_0x3d4f35=_0x5cc758[_0x5a41('0x38')];if(!_0x17a1a2['query'][_0x5a41('0x39')](_0x5a41('0x3a'))){_0x1da450['limit']=qs[_0x5a41('0x1e')](_0x17a1a2[_0x5a41('0x32')][_0x5a41('0x1e')]);_0x1da450['offset']=qs[_0x5a41('0x1c')](_0x17a1a2[_0x5a41('0x32')][_0x5a41('0x1c')]);}return _0x5af765['getActions'](_0x1da450);}})['then'](function(_0x2b9635){if(_0x2b9635){return _0x2b9635?{'count':_0x3d4f35,'rows':_0x2b9635}:null;}})[_0x5a41('0x23')](respondWithResult(_0x2fe7f1,null))[_0x5a41('0x44')](handleError(_0x2fe7f1,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 3d7e5e1..e2be886 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 _0xc678=['path','rimraf','../../config/environment','exports','define','tools_triggers','../../config/logger','api','moment','request-promise'];(function(_0x5e3466,_0x510ec9){var _0x2037e5=function(_0x255d4f){while(--_0x255d4f){_0x5e3466['push'](_0x5e3466['shift']());}};_0x2037e5(++_0x510ec9);}(_0xc678,0x1b4));var _0x8c67=function(_0x2f7a16,_0x5aed23){_0x2f7a16=_0x2f7a16-0x0;var _0x500e05=_0xc678[_0x2f7a16];return _0x500e05;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8c67('0x0'))(_0x8c67('0x1'));var moment=require(_0x8c67('0x2'));var BPromise=require('bluebird');var rp=require(_0x8c67('0x3'));var fs=require('fs');var path=require(_0x8c67('0x4'));var rimraf=require(_0x8c67('0x5'));var config=require(_0x8c67('0x6'));var attributes=require('./trigger.attributes');module[_0x8c67('0x7')]=function(_0x5cdb40,_0x351c21){return _0x5cdb40[_0x8c67('0x8')]('Trigger',attributes,{'tableName':_0x8c67('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaf5a=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./trigger.attributes','define','Trigger','tools_triggers'];(function(_0x50aa74,_0x2f65cd){var _0x3344bb=function(_0x300c3f){while(--_0x300c3f){_0x50aa74['push'](_0x50aa74['shift']());}};_0x3344bb(++_0x2f65cd);}(_0xaf5a,0x144));var _0xaaf5=function(_0x5bfb00,_0x52ffc4){_0x5bfb00=_0x5bfb00-0x0;var _0x24885f=_0xaf5a[_0x5bfb00];return _0x24885f;};'use strict';var _=require('lodash');var util=require(_0xaaf5('0x0'));var logger=require('../../config/logger')(_0xaaf5('0x1'));var moment=require(_0xaaf5('0x2'));var BPromise=require(_0xaaf5('0x3'));var rp=require(_0xaaf5('0x4'));var fs=require('fs');var path=require(_0xaaf5('0x5'));var rimraf=require(_0xaaf5('0x6'));var config=require(_0xaaf5('0x7'));var attributes=require(_0xaaf5('0x8'));module['exports']=function(_0x3b1281,_0x5b9ec4){return _0x3b1281[_0xaaf5('0x9')](_0xaaf5('0xa'),attributes,{'tableName':_0xaaf5('0xb'),'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 e341445..44274be 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 _0x01b1=['request','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetTrigger','Trigger','findAll','options','limit','include','map','model','attributes','then','ShowTrigger','find','raw','where','lodash','util','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x5cb157,_0x26a384){var _0x233e33=function(_0x5001ce){while(--_0x5001ce){_0x5cb157['push'](_0x5cb157['shift']());}};_0x233e33(++_0x26a384);}(_0x01b1,0xeb));var _0x101b=function(_0x1ca993,_0x243c1e){_0x1ca993=_0x1ca993-0x0;var _0x150e5e=_0x01b1[_0x1ca993];return _0x150e5e;};'use strict';var _=require(_0x101b('0x0'));var util=require(_0x101b('0x1'));var moment=require('moment');var BPromise=require(_0x101b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x101b('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x101b('0x4'));var logger=require('../../config/logger')(_0x101b('0x5'));var config=require(_0x101b('0x6'));var jayson=require(_0x101b('0x7'));var client=jayson[_0x101b('0x8')][_0x101b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5b161e,_0x5634bb,_0x4d68cb){return new BPromise(function(_0x5710cf,_0x4d38bf){return client[_0x101b('0xa')](_0x5b161e,_0x4d68cb)['then'](function(_0x1ab662){logger[_0x101b('0xb')](_0x101b('0xc'),_0x5634bb,_0x101b('0xd'));logger[_0x101b('0xe')](_0x101b('0xf'),_0x5634bb,_0x101b('0xd'),JSON[_0x101b('0x10')](_0x1ab662));if(_0x1ab662[_0x101b('0x11')]){if(_0x1ab662['error']['code']===0x1f4){logger['error'](_0x101b('0xc'),_0x5634bb,_0x1ab662['error'][_0x101b('0x12')]);return _0x4d38bf(_0x1ab662[_0x101b('0x11')][_0x101b('0x12')]);}logger[_0x101b('0x11')]('Trigger,\x20%s,\x20%s',_0x5634bb,_0x1ab662[_0x101b('0x11')][_0x101b('0x12')]);return _0x5710cf(_0x1ab662[_0x101b('0x11')][_0x101b('0x12')]);}else{logger['info'](_0x101b('0xc'),_0x5634bb,_0x101b('0xd'));_0x5710cf(_0x1ab662[_0x101b('0x13')]['message']);}})[_0x101b('0x14')](function(_0x51e134){logger[_0x101b('0x11')](_0x101b('0xc'),_0x5634bb,_0x51e134);_0x4d38bf(_0x51e134);});});}exports[_0x101b('0x15')]=function(_0x1b7183){var _0x383458=this;return new Promise(function(_0x1346fa,_0x23921e){return db[_0x101b('0x16')][_0x101b('0x17')]({'raw':_0x1b7183[_0x101b('0x18')]?_0x1b7183[_0x101b('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x1b7183[_0x101b('0x18')]?_0x1b7183['options']['where']||null:null,'attributes':_0x1b7183[_0x101b('0x18')]?_0x1b7183[_0x101b('0x18')]['attributes']||null:null,'limit':_0x1b7183[_0x101b('0x18')]?_0x1b7183[_0x101b('0x18')][_0x101b('0x19')]||null:null,'include':_0x1b7183['options']?_0x1b7183['options'][_0x101b('0x1a')]?_[_0x101b('0x1b')](_0x1b7183[_0x101b('0x18')][_0x101b('0x1a')],function(_0x113436){return{'model':db[_0x113436[_0x101b('0x1c')]],'as':_0x113436['as'],'attributes':_0x113436[_0x101b('0x1d')],'include':_0x113436['include']?_[_0x101b('0x1b')](_0x113436[_0x101b('0x1a')],function(_0x47acd4){return{'model':db[_0x47acd4[_0x101b('0x1c')]],'as':_0x47acd4['as'],'attributes':_0x47acd4[_0x101b('0x1d')],'include':_0x47acd4[_0x101b('0x1a')]?_[_0x101b('0x1b')](_0x47acd4[_0x101b('0x1a')],function(_0xefdd81){return{'model':db[_0xefdd81[_0x101b('0x1c')]],'as':_0xefdd81['as'],'attributes':_0xefdd81[_0x101b('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x101b('0x1e')](function(_0x575185){logger[_0x101b('0xb')]('GetTrigger',_0x1b7183);logger[_0x101b('0xe')](_0x101b('0x15'),_0x1b7183,JSON[_0x101b('0x10')](_0x575185));_0x1346fa(_0x575185);})['catch'](function(_0x11e890){logger['error']('GetTrigger',_0x11e890[_0x101b('0x12')],_0x1b7183);_0x23921e(_0x383458[_0x101b('0x11')](0x1f4,_0x11e890[_0x101b('0x12')]));});});};exports[_0x101b('0x1f')]=function(_0x2488f6){var _0x2b66de=this;return new Promise(function(_0x4b81fd,_0x114e44){return db['Trigger'][_0x101b('0x20')]({'raw':_0x2488f6['options']?_0x2488f6['options'][_0x101b('0x21')]===undefined?!![]:![]:!![],'where':_0x2488f6[_0x101b('0x18')]?_0x2488f6['options'][_0x101b('0x22')]||null:null,'attributes':_0x2488f6[_0x101b('0x18')]?_0x2488f6[_0x101b('0x18')][_0x101b('0x1d')]||null:null,'include':_0x2488f6[_0x101b('0x18')]?_0x2488f6['options'][_0x101b('0x1a')]?_[_0x101b('0x1b')](_0x2488f6[_0x101b('0x18')][_0x101b('0x1a')],function(_0x821a46){return{'model':db[_0x821a46[_0x101b('0x1c')]],'as':_0x821a46['as'],'attributes':_0x821a46[_0x101b('0x1d')],'include':_0x821a46['include']?_[_0x101b('0x1b')](_0x821a46['include'],function(_0x354ddd){return{'model':db[_0x354ddd[_0x101b('0x1c')]],'as':_0x354ddd['as'],'attributes':_0x354ddd[_0x101b('0x1d')],'include':_0x354ddd[_0x101b('0x1a')]?_['map'](_0x354ddd[_0x101b('0x1a')],function(_0x3a9fc0){return{'model':db[_0x3a9fc0[_0x101b('0x1c')]],'as':_0x3a9fc0['as'],'attributes':_0x3a9fc0['attributes']};}):[]};}):[]};}):[]:[]})[_0x101b('0x1e')](function(_0xd49918){logger['info']('ShowTrigger',_0x2488f6);logger['debug'](_0x101b('0x1f'),_0x2488f6,JSON[_0x101b('0x10')](_0xd49918));_0x4b81fd(_0xd49918);})[_0x101b('0x14')](function(_0x5a5b74){logger[_0x101b('0x11')](_0x101b('0x1f'),_0x5a5b74[_0x101b('0x12')],_0x2488f6);_0x114e44(_0x2b66de[_0x101b('0x11')](0x1f4,_0x5a5b74[_0x101b('0x12')]));});});}; \ No newline at end of file +var _0x1b26=['debug','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','request\x20sent','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','Trigger,\x20%s,\x20%s','message','info','result','GetTrigger','Trigger','findAll','options','where','attributes','limit','map','include','model','catch','ShowTrigger','find'];(function(_0x29a08d,_0x551eca){var _0x10fc1a=function(_0x4a2117){while(--_0x4a2117){_0x29a08d['push'](_0x29a08d['shift']());}};_0x10fc1a(++_0x551eca);}(_0x1b26,0x15f));var _0x61b2=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x1b26[_0x3e5086];return _0xfeb102;};'use strict';var _=require(_0x61b2('0x0'));var util=require('util');var moment=require(_0x61b2('0x1'));var BPromise=require('bluebird');var rs=require(_0x61b2('0x2'));var fs=require('fs');var Redis=require(_0x61b2('0x3'));var db=require(_0x61b2('0x4'))['db'];var utils=require(_0x61b2('0x5'));var logger=require(_0x61b2('0x6'))(_0x61b2('0x7'));var config=require('../../config/environment');var jayson=require(_0x61b2('0x8'));var client=jayson[_0x61b2('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5e6d2f,_0x129567,_0xe7836e){return new BPromise(function(_0x4c5419,_0x1505bf){return client[_0x61b2('0xa')](_0x5e6d2f,_0xe7836e)[_0x61b2('0xb')](function(_0x2232cf){logger['info']('Trigger,\x20%s,\x20%s',_0x129567,_0x61b2('0xc'));logger['debug'](_0x61b2('0xd'),_0x129567,'request\x20sent',JSON[_0x61b2('0xe')](_0x2232cf));if(_0x2232cf[_0x61b2('0xf')]){if(_0x2232cf[_0x61b2('0xf')][_0x61b2('0x10')]===0x1f4){logger[_0x61b2('0xf')](_0x61b2('0x11'),_0x129567,_0x2232cf['error'][_0x61b2('0x12')]);return _0x1505bf(_0x2232cf['error'][_0x61b2('0x12')]);}logger['error']('Trigger,\x20%s,\x20%s',_0x129567,_0x2232cf[_0x61b2('0xf')][_0x61b2('0x12')]);return _0x4c5419(_0x2232cf[_0x61b2('0xf')][_0x61b2('0x12')]);}else{logger[_0x61b2('0x13')](_0x61b2('0x11'),_0x129567,_0x61b2('0xc'));_0x4c5419(_0x2232cf[_0x61b2('0x14')][_0x61b2('0x12')]);}})['catch'](function(_0x3616f7){logger[_0x61b2('0xf')]('Trigger,\x20%s,\x20%s',_0x129567,_0x3616f7);_0x1505bf(_0x3616f7);});});}exports[_0x61b2('0x15')]=function(_0x5a038b){var _0x4be31c=this;return new Promise(function(_0x1de1a6,_0x261c4d){return db[_0x61b2('0x16')][_0x61b2('0x17')]({'raw':_0x5a038b[_0x61b2('0x18')]?_0x5a038b[_0x61b2('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x5a038b['options']?_0x5a038b[_0x61b2('0x18')][_0x61b2('0x19')]||null:null,'attributes':_0x5a038b[_0x61b2('0x18')]?_0x5a038b[_0x61b2('0x18')][_0x61b2('0x1a')]||null:null,'limit':_0x5a038b[_0x61b2('0x18')]?_0x5a038b[_0x61b2('0x18')][_0x61b2('0x1b')]||null:null,'include':_0x5a038b[_0x61b2('0x18')]?_0x5a038b[_0x61b2('0x18')]['include']?_[_0x61b2('0x1c')](_0x5a038b[_0x61b2('0x18')][_0x61b2('0x1d')],function(_0x40f9eb){return{'model':db[_0x40f9eb[_0x61b2('0x1e')]],'as':_0x40f9eb['as'],'attributes':_0x40f9eb[_0x61b2('0x1a')],'include':_0x40f9eb[_0x61b2('0x1d')]?_['map'](_0x40f9eb[_0x61b2('0x1d')],function(_0x28587b){return{'model':db[_0x28587b[_0x61b2('0x1e')]],'as':_0x28587b['as'],'attributes':_0x28587b['attributes'],'include':_0x28587b[_0x61b2('0x1d')]?_[_0x61b2('0x1c')](_0x28587b[_0x61b2('0x1d')],function(_0x5e3dd3){return{'model':db[_0x5e3dd3[_0x61b2('0x1e')]],'as':_0x5e3dd3['as'],'attributes':_0x5e3dd3[_0x61b2('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x61b2('0xb')](function(_0x516df0){logger[_0x61b2('0x13')](_0x61b2('0x15'),_0x5a038b);logger['debug'](_0x61b2('0x15'),_0x5a038b,JSON['stringify'](_0x516df0));_0x1de1a6(_0x516df0);})[_0x61b2('0x1f')](function(_0x175c85){logger['error'](_0x61b2('0x15'),_0x175c85[_0x61b2('0x12')],_0x5a038b);_0x261c4d(_0x4be31c[_0x61b2('0xf')](0x1f4,_0x175c85[_0x61b2('0x12')]));});});};exports[_0x61b2('0x20')]=function(_0x4409f3){var _0x389ea6=this;return new Promise(function(_0x41baa1,_0x859409){return db['Trigger'][_0x61b2('0x21')]({'raw':_0x4409f3[_0x61b2('0x18')]?_0x4409f3[_0x61b2('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x4409f3[_0x61b2('0x18')]?_0x4409f3[_0x61b2('0x18')]['where']||null:null,'attributes':_0x4409f3[_0x61b2('0x18')]?_0x4409f3[_0x61b2('0x18')][_0x61b2('0x1a')]||null:null,'include':_0x4409f3[_0x61b2('0x18')]?_0x4409f3[_0x61b2('0x18')][_0x61b2('0x1d')]?_['map'](_0x4409f3[_0x61b2('0x18')]['include'],function(_0x1d8274){return{'model':db[_0x1d8274[_0x61b2('0x1e')]],'as':_0x1d8274['as'],'attributes':_0x1d8274[_0x61b2('0x1a')],'include':_0x1d8274[_0x61b2('0x1d')]?_[_0x61b2('0x1c')](_0x1d8274[_0x61b2('0x1d')],function(_0x5c0fe7){return{'model':db[_0x5c0fe7['model']],'as':_0x5c0fe7['as'],'attributes':_0x5c0fe7[_0x61b2('0x1a')],'include':_0x5c0fe7[_0x61b2('0x1d')]?_['map'](_0x5c0fe7[_0x61b2('0x1d')],function(_0x44c07d){return{'model':db[_0x44c07d[_0x61b2('0x1e')]],'as':_0x44c07d['as'],'attributes':_0x44c07d[_0x61b2('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3f943a){logger[_0x61b2('0x13')](_0x61b2('0x20'),_0x4409f3);logger[_0x61b2('0x22')](_0x61b2('0x20'),_0x4409f3,JSON[_0x61b2('0xe')](_0x3f943a));_0x41baa1(_0x3f943a);})['catch'](function(_0xc06b8){logger[_0x61b2('0xf')](_0x61b2('0x20'),_0xc06b8[_0x61b2('0x12')],_0x4409f3);_0x859409(_0x389ea6[_0x61b2('0xf')](0x1f4,_0xc06b8[_0x61b2('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index f7b3661..475a98a 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 _0xaab2=['path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./trunk.controller','get','isAuthenticated','index','/:id','post','/:id/clone','clone','create','put','delete','destroy','exports','multer','util'];(function(_0xcc4484,_0x1cc88f){var _0x554705=function(_0x5d11c5){while(--_0x5d11c5){_0xcc4484['push'](_0xcc4484['shift']());}};_0x554705(++_0x1cc88f);}(_0xaab2,0x139));var _0x2aab=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0xaab2[_0x5bd426];return _0x23a7eb;};'use strict';var multer=require(_0x2aab('0x0'));var util=require(_0x2aab('0x1'));var path=require(_0x2aab('0x2'));var timeout=require('connect-timeout');var express=require(_0x2aab('0x3'));var router=express[_0x2aab('0x4')]();var fs_extra=require(_0x2aab('0x5'));var auth=require(_0x2aab('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x2aab('0x7'));var controller=require(_0x2aab('0x8'));router[_0x2aab('0x9')]('/',auth[_0x2aab('0xa')](),controller[_0x2aab('0xb')]);router[_0x2aab('0x9')](_0x2aab('0xc'),auth[_0x2aab('0xa')](),controller['show']);router[_0x2aab('0xd')](_0x2aab('0xe'),auth[_0x2aab('0xa')](),controller[_0x2aab('0xf')]);router[_0x2aab('0xd')]('/',auth[_0x2aab('0xa')](),controller[_0x2aab('0x10')]);router[_0x2aab('0x11')]('/:id',auth[_0x2aab('0xa')](),controller['update']);router[_0x2aab('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x2aab('0x13')]);module[_0x2aab('0x14')]=router; \ No newline at end of file +var _0x0c28=['create','put','update','delete','exports','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./trunk.controller','get','index','/:id','isAuthenticated','show','/:id/clone','clone','post'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0x0c28,0x1cd));var _0x80c2=function(_0x2b5d31,_0x32c154){_0x2b5d31=_0x2b5d31-0x0;var _0x3a637a=_0x0c28[_0x2b5d31];return _0x3a637a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x80c2('0x0'));var timeout=require(_0x80c2('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x80c2('0x2'));var auth=require(_0x80c2('0x3'));var interaction=require(_0x80c2('0x4'));var config=require('../../config/environment');var controller=require(_0x80c2('0x5'));router[_0x80c2('0x6')]('/',auth['isAuthenticated'](),controller[_0x80c2('0x7')]);router[_0x80c2('0x6')](_0x80c2('0x8'),auth[_0x80c2('0x9')](),controller[_0x80c2('0xa')]);router['post'](_0x80c2('0xb'),auth['isAuthenticated'](),controller[_0x80c2('0xc')]);router[_0x80c2('0xd')]('/',auth['isAuthenticated'](),controller[_0x80c2('0xe')]);router[_0x80c2('0xf')](_0x80c2('0x8'),auth[_0x80c2('0x9')](),controller[_0x80c2('0x10')]);router[_0x80c2('0x11')](_0x80c2('0x8'),auth[_0x80c2('0x9')](),controller['destroy']);module[_0x80c2('0x12')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 802c045..3d2e6d4 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 _0xe490=['String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','\x22\x22\x20<>','INTEGER','always','uac','uas','pai','fingerprint','certificate','active','actpass','dynamic','nonat','update,nonat','BOOLEAN','sequelize','exports','ENUM','friend','user','peer','STRING','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','setDataValue','transport','join','getDataValue','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','auto','yes','update','nat','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\x22alaw\x22]','insecure'];(function(_0x493dc8,_0x41d614){var _0x2471b1=function(_0xe796f0){while(--_0xe796f0){_0x493dc8['push'](_0x493dc8['shift']());}};_0x2471b1(++_0x41d614);}(_0xe490,0x99));var _0x0e49=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xe490[_0x491a7f];return _0x3d8f44;};'use strict';var Sequelize=require(_0x0e49('0x0'));module[_0x0e49('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x0e49('0x2')](_0x0e49('0x3'),_0x0e49('0x4'),_0x0e49('0x5')),'allowNull':![],'defaultValue':_0x0e49('0x3')},'context':{'type':Sequelize[_0x0e49('0x6')],'allowNull':![],'defaultValue':_0x0e49('0x7')},'callingpres':{'type':Sequelize[_0x0e49('0x2')](_0x0e49('0x8'),'ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN',_0x0e49('0x9'),'PROHIB_NOT_SCREENED',_0x0e49('0xa'),_0x0e49('0xb'),'PROHIB')},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize[_0x0e49('0x6')]},'secret':{'type':Sequelize[_0x0e49('0x6')]},'md5secret':{'type':Sequelize[_0x0e49('0x6')]},'remotesecret':{'type':Sequelize[_0x0e49('0x6')]},'transport':{'type':Sequelize['STRING'],'defaultValue':_0x0e49('0xc'),'set':function(_0x3428f2){this[_0x0e49('0xd')](_0x0e49('0xe'),_0x3428f2?_0x3428f2[_0x0e49('0xf')](','):null);},'get':function(){return this[_0x0e49('0x10')](_0x0e49('0xe'))?this[_0x0e49('0x10')]('transport')['split'](','):null;},'comment':_0x0e49('0x11')},'dtmfmode':{'type':Sequelize[_0x0e49('0x2')](_0x0e49('0x12'),_0x0e49('0x13'),_0x0e49('0x14'),'inband',_0x0e49('0x15')),'defaultValue':_0x0e49('0x12')},'directmedia':{'type':Sequelize[_0x0e49('0x2')](_0x0e49('0x16'),'no','nonat',_0x0e49('0x17'),'outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x0e49('0x2')](_0x0e49('0x16'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x0e49('0x6')]},'directmediadeny':{'type':Sequelize[_0x0e49('0x6')]},'nat':{'type':Sequelize[_0x0e49('0x6')],'defaultValue':'force_rport,comedia','set':function(_0x5da026){this[_0x0e49('0xd')]('nat',_0x5da026?_0x5da026[_0x0e49('0xf')](','):null);},'get':function(){return this[_0x0e49('0x10')]('nat')?this['getDataValue'](_0x0e49('0x18'))[_0x0e49('0x19')](','):null;},'comment':_0x0e49('0x1a')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x0e49('0x6')]},'pickupgroup':{'type':Sequelize[_0x0e49('0x6')]},'namedpickupgroup':{'type':Sequelize[_0x0e49('0x6')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x0e49('0x6')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x0e49('0x6')],'defaultValue':'all'},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x363941){this['setDataValue'](_0x0e49('0x1b'),_0x363941?_0x363941['join'](';'):_0x0e49('0x1c'));},'get':function(){return this[_0x0e49('0x10')](_0x0e49('0x1b'))?this[_0x0e49('0x10')](_0x0e49('0x1b'))[_0x0e49('0x19')](';'):null;},'comment':_0x0e49('0x1d')},'autoframing':{'type':Sequelize[_0x0e49('0x2')](_0x0e49('0x16'),'no')},'insecure':{'type':Sequelize[_0x0e49('0x6')],'defaultValue':'port,invite','set':function(_0x576f71){this[_0x0e49('0xd')](_0x0e49('0x1e'),_0x576f71?_0x576f71[_0x0e49('0xf')](','):null);},'get':function(){return this['getDataValue'](_0x0e49('0x1e'))?this[_0x0e49('0x10')]('insecure')[_0x0e49('0x19')](','):null;},'comment':_0x0e49('0x1f')},'trustrpid':{'type':Sequelize[_0x0e49('0x2')](_0x0e49('0x16'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0x0e49('0x16'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x0e49('0x2')](_0x0e49('0x16'),'no','never')},'promiscredir':{'type':Sequelize['ENUM'](_0x0e49('0x16'),'no')},'useclientcode':{'type':Sequelize[_0x0e49('0x2')](_0x0e49('0x16'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize[_0x0e49('0x6')]},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0x0e49('0x20')},'amaflags':{'type':Sequelize[_0x0e49('0x6')]},'callcounter':{'type':Sequelize[_0x0e49('0x2')](_0x0e49('0x16'),'no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x0e49('0x21')](0xb)},'allowoverlap':{'type':Sequelize[_0x0e49('0x2')](_0x0e49('0x16'),'no')},'allowsubscribe':{'type':Sequelize['ENUM'](_0x0e49('0x16'),'no')},'allowtransfer':{'type':Sequelize['ENUM'](_0x0e49('0x16'),'no')},'ignoresdpversion':{'type':Sequelize[_0x0e49('0x2')]('yes','no')},'subscribecontext':{'type':Sequelize[_0x0e49('0x6')]},'template':{'type':Sequelize[_0x0e49('0x6')]},'videosupport':{'type':Sequelize[_0x0e49('0x2')]('yes','no',_0x0e49('0x22')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x0e49('0x21')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x0e49('0x2')](_0x0e49('0x16'),'no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize[_0x0e49('0x2')]('accept','refuse','originate')},'session_expires':{'type':Sequelize[_0x0e49('0x21')](0xb)},'session_minse':{'type':Sequelize[_0x0e49('0x21')](0xb)},'session_refresher':{'type':Sequelize['ENUM'](_0x0e49('0x23'),_0x0e49('0x24')),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x0e49('0x6')]},'regexten':{'type':Sequelize[_0x0e49('0x6')]},'fromdomain':{'type':Sequelize[_0x0e49('0x6')]},'fromuser':{'type':Sequelize[_0x0e49('0x6')]},'port':{'type':Sequelize[_0x0e49('0x21')](0x5)},'qualify':{'type':Sequelize[_0x0e49('0x2')](_0x0e49('0x16'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x0e49('0x21')](0xb)},'defaultip':{'type':Sequelize[_0x0e49('0x6')]},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x0e49('0x21')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x0e49('0x21')](0xb)},'sendrpid':{'type':Sequelize[_0x0e49('0x2')](_0x0e49('0x16'),'no',_0x0e49('0x25')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x0e49('0x6')]},'callbackextension':{'type':Sequelize[_0x0e49('0x6')]},'timert1':{'type':Sequelize[_0x0e49('0x21')](0xb)},'timerb':{'type':Sequelize[_0x0e49('0x21')](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize[_0x0e49('0x6')]},'contactdeny':{'type':Sequelize[_0x0e49('0x6')]},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize[_0x0e49('0x6')]},'maxforwards':{'type':Sequelize[_0x0e49('0x21')](0xb)},'encryption':{'type':Sequelize['ENUM'](_0x0e49('0x16'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x0e49('0x16'),'no')},'force_avp':{'type':Sequelize[_0x0e49('0x2')](_0x0e49('0x16'),'no')},'icesupport':{'type':Sequelize[_0x0e49('0x2')](_0x0e49('0x16'),'no')},'dtlsenable':{'type':Sequelize[_0x0e49('0x2')](_0x0e49('0x16'),'no')},'dtlsverify':{'type':Sequelize[_0x0e49('0x2')]('yes','no',_0x0e49('0x26'),_0x0e49('0x27'))},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize[_0x0e49('0x6')]},'dtlsprivatekey':{'type':Sequelize[_0x0e49('0x6')]},'dtlscipher':{'type':Sequelize[_0x0e49('0x6')]},'dtlscafile':{'type':Sequelize[_0x0e49('0x6')]},'dtlscapath':{'type':Sequelize[_0x0e49('0x6')]},'dtlssetup':{'type':Sequelize[_0x0e49('0x2')](_0x0e49('0x28'),'passive',_0x0e49('0x29')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0x0e49('0x2')](_0x0e49('0x16'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x0e49('0x6')]},'recordofffeature':{'type':Sequelize[_0x0e49('0x6')]},'call_limit':{'type':Sequelize[_0x0e49('0x21')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0x0e49('0x16'),'no')},'subscribemwi':{'type':Sequelize['ENUM'](_0x0e49('0x16'),'no')},'vmexten':{'type':Sequelize[_0x0e49('0x6')]},'mohinterpret':{'type':Sequelize[_0x0e49('0x6')]},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x0e49('0x6')]},'host':{'type':Sequelize['STRING'],'defaultValue':_0x0e49('0x2a')},'canreinvite':{'type':Sequelize[_0x0e49('0x2')](_0x0e49('0x16'),'no',_0x0e49('0x2b'),'update',_0x0e49('0x2c')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x0e49('0x6')]},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x0e49('0x2d')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x0e49('0x6')],'defaultValue':'no'}}; \ No newline at end of file +var _0x6e96=['String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','\x22\x22\x20<>','INTEGER','always','accept','refuse','originate','uac','uas','pai','active','passive','actpass','dynamic','update','update,nonat','sequelize','exports','STRING','name','ENUM','friend','user','peer','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','auto','nonat','outgoing','yes','force_rport,comedia','nat','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'];(function(_0x245fea,_0x56f70f){var _0x57a896=function(_0x58da06){while(--_0x58da06){_0x245fea['push'](_0x245fea['shift']());}};_0x57a896(++_0x56f70f);}(_0x6e96,0x17c));var _0x66e9=function(_0x6cdf31,_0x3b496b){_0x6cdf31=_0x6cdf31-0x0;var _0x21de32=_0x6e96[_0x6cdf31];return _0x21de32;};'use strict';var Sequelize=require(_0x66e9('0x0'));module[_0x66e9('0x1')]={'name':{'type':Sequelize[_0x66e9('0x2')],'allowNull':![],'unique':_0x66e9('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x66e9('0x4')](_0x66e9('0x5'),_0x66e9('0x6'),_0x66e9('0x7')),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0x66e9('0x4')](_0x66e9('0x8'),'ALLOWED_PASSED_SCREEN',_0x66e9('0x9'),_0x66e9('0xa'),'PROHIB_NOT_SCREENED',_0x66e9('0xb'),_0x66e9('0xc'),_0x66e9('0xd'))},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize[_0x66e9('0x2')]},'secret':{'type':Sequelize[_0x66e9('0x2')]},'md5secret':{'type':Sequelize[_0x66e9('0x2')]},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize[_0x66e9('0x2')],'defaultValue':_0x66e9('0xe'),'set':function(_0x2bfa2e){this[_0x66e9('0xf')](_0x66e9('0x10'),_0x2bfa2e?_0x2bfa2e[_0x66e9('0x11')](','):null);},'get':function(){return this[_0x66e9('0x12')](_0x66e9('0x10'))?this['getDataValue'](_0x66e9('0x10'))[_0x66e9('0x13')](','):null;},'comment':_0x66e9('0x14')},'dtmfmode':{'type':Sequelize[_0x66e9('0x4')](_0x66e9('0x15'),_0x66e9('0x16'),_0x66e9('0x17'),'inband',_0x66e9('0x18')),'defaultValue':_0x66e9('0x15')},'directmedia':{'type':Sequelize[_0x66e9('0x4')]('yes','no',_0x66e9('0x19'),'update',_0x66e9('0x1a')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x66e9('0x4')](_0x66e9('0x1b'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x66e9('0x2')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize[_0x66e9('0x2')],'defaultValue':_0x66e9('0x1c'),'set':function(_0x3ce315){this[_0x66e9('0xf')]('nat',_0x3ce315?_0x3ce315['join'](','):null);},'get':function(){return this[_0x66e9('0x12')](_0x66e9('0x1d'))?this[_0x66e9('0x12')](_0x66e9('0x1d'))[_0x66e9('0x13')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x66e9('0x2')]},'namedcallgroup':{'type':Sequelize[_0x66e9('0x2')]},'pickupgroup':{'type':Sequelize[_0x66e9('0x2')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x66e9('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x66e9('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x66e9('0x2')],'defaultValue':_0x66e9('0x1e')},'allow':{'type':Sequelize[_0x66e9('0x2')],'allowNull':![],'defaultValue':_0x66e9('0x1f'),'set':function(_0x22ac6b){this['setDataValue'](_0x66e9('0x20'),_0x22ac6b?_0x22ac6b[_0x66e9('0x11')](';'):_0x66e9('0x1f'));},'get':function(){return this[_0x66e9('0x12')](_0x66e9('0x20'))?this['getDataValue'](_0x66e9('0x20'))[_0x66e9('0x13')](';'):null;},'comment':_0x66e9('0x21')},'autoframing':{'type':Sequelize['ENUM'](_0x66e9('0x1b'),'no')},'insecure':{'type':Sequelize[_0x66e9('0x2')],'defaultValue':_0x66e9('0x22'),'set':function(_0x55b151){this['setDataValue'](_0x66e9('0x23'),_0x55b151?_0x55b151[_0x66e9('0x11')](','):null);},'get':function(){return this['getDataValue'](_0x66e9('0x23'))?this[_0x66e9('0x12')](_0x66e9('0x23'))[_0x66e9('0x13')](','):null;},'comment':_0x66e9('0x24')},'trustrpid':{'type':Sequelize[_0x66e9('0x4')](_0x66e9('0x1b'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x66e9('0x4')](_0x66e9('0x1b'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x66e9('0x4')]('yes','no','never')},'promiscredir':{'type':Sequelize['ENUM'](_0x66e9('0x1b'),'no')},'useclientcode':{'type':Sequelize[_0x66e9('0x4')](_0x66e9('0x1b'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize[_0x66e9('0x2')]},'callerid':{'type':Sequelize[_0x66e9('0x2')],'defaultValue':_0x66e9('0x25')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0x66e9('0x4')](_0x66e9('0x1b'),'no'),'defaultValue':_0x66e9('0x1b')},'busylevel':{'type':Sequelize[_0x66e9('0x26')](0xb)},'allowoverlap':{'type':Sequelize['ENUM'](_0x66e9('0x1b'),'no')},'allowsubscribe':{'type':Sequelize['ENUM'](_0x66e9('0x1b'),'no')},'allowtransfer':{'type':Sequelize[_0x66e9('0x4')](_0x66e9('0x1b'),'no')},'ignoresdpversion':{'type':Sequelize[_0x66e9('0x4')]('yes','no')},'subscribecontext':{'type':Sequelize[_0x66e9('0x2')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0x66e9('0x4')]('yes','no',_0x66e9('0x27')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x66e9('0x26')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x66e9('0x4')]('yes','no')},'mailbox':{'type':Sequelize[_0x66e9('0x2')]},'session_timers':{'type':Sequelize['ENUM'](_0x66e9('0x28'),_0x66e9('0x29'),_0x66e9('0x2a'))},'session_expires':{'type':Sequelize[_0x66e9('0x26')](0xb)},'session_minse':{'type':Sequelize[_0x66e9('0x26')](0xb)},'session_refresher':{'type':Sequelize[_0x66e9('0x4')](_0x66e9('0x2b'),_0x66e9('0x2c')),'defaultValue':_0x66e9('0x2c')},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize[_0x66e9('0x2')]},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x66e9('0x26')](0x5)},'qualify':{'type':Sequelize['ENUM'](_0x66e9('0x1b'),'no'),'defaultValue':_0x66e9('0x1b')},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x66e9('0x26')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x66e9('0x26')](0xb)},'sendrpid':{'type':Sequelize['ENUM'](_0x66e9('0x1b'),'no',_0x66e9('0x2d')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize[_0x66e9('0x2')]},'timert1':{'type':Sequelize[_0x66e9('0x26')](0xb)},'timerb':{'type':Sequelize[_0x66e9('0x26')](0xb)},'qualifyfreq':{'type':Sequelize[_0x66e9('0x26')](0xb)},'contactpermit':{'type':Sequelize[_0x66e9('0x2')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0x66e9('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0x66e9('0x2')]},'use_q850_reason':{'type':Sequelize[_0x66e9('0x2')]},'maxforwards':{'type':Sequelize[_0x66e9('0x26')](0xb)},'encryption':{'type':Sequelize['ENUM'](_0x66e9('0x1b'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x66e9('0x4')](_0x66e9('0x1b'),'no')},'force_avp':{'type':Sequelize['ENUM']('yes','no')},'icesupport':{'type':Sequelize[_0x66e9('0x4')](_0x66e9('0x1b'),'no')},'dtlsenable':{'type':Sequelize[_0x66e9('0x4')]('yes','no')},'dtlsverify':{'type':Sequelize['ENUM'](_0x66e9('0x1b'),'no','fingerprint','certificate')},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize[_0x66e9('0x2')]},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize[_0x66e9('0x2')]},'dtlscafile':{'type':Sequelize[_0x66e9('0x2')]},'dtlscapath':{'type':Sequelize[_0x66e9('0x2')]},'dtlssetup':{'type':Sequelize[_0x66e9('0x4')](_0x66e9('0x2e'),_0x66e9('0x2f'),_0x66e9('0x30')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x66e9('0x2')]},'usereqphone':{'type':Sequelize[_0x66e9('0x4')](_0x66e9('0x1b'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x66e9('0x2')]},'recordofffeature':{'type':Sequelize[_0x66e9('0x2')]},'call_limit':{'type':Sequelize[_0x66e9('0x26')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x66e9('0x4')](_0x66e9('0x1b'),'no')},'subscribemwi':{'type':Sequelize['ENUM'](_0x66e9('0x1b'),'no')},'vmexten':{'type':Sequelize[_0x66e9('0x2')]},'mohinterpret':{'type':Sequelize[_0x66e9('0x2')]},'mohsuggest':{'type':Sequelize[_0x66e9('0x2')]},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x66e9('0x2')]},'host':{'type':Sequelize['STRING'],'defaultValue':_0x66e9('0x31')},'canreinvite':{'type':Sequelize[_0x66e9('0x4')](_0x66e9('0x1b'),'no','nonat',_0x66e9('0x32'),_0x66e9('0x33')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x66e9('0x2')]},'otherFields':{'type':Sequelize[_0x66e9('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x66e9('0x2')],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index 1e90f23..8079b7b 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 _0x8ef6=['userProfileId','autoAssociation','UserProfileResource','readFileSync','join','root','server/files/templates/trunk.ejs','server/files/templates/registry.ejs','utf8','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','render','/etc/asterisk/sip_xcally_registers.conf','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Reload','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','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','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','apply','update','destroy','Trunks','stack','name','send','map','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','options','Trunk','includeAll','include','findAll','rows','show','params','rawAttributes','merge','find','catch','clone','omit','createdAt','updatedAt','create','body','get','role','UserProfileSection'];(function(_0x5c289c,_0x339067){var _0x1abc2d=function(_0x4a9da9){while(--_0x4a9da9){_0x5c289c['push'](_0x5c289c['shift']());}};_0x1abc2d(++_0x339067);}(_0x8ef6,0xf2));var _0x68ef=function(_0x324c6e,_0xda78a4){_0x324c6e=_0x324c6e-0x0;var _0x4504ec=_0x8ef6[_0x324c6e];return _0x4504ec;};'use strict';var emlformat=require(_0x68ef('0x0'));var rimraf=require(_0x68ef('0x1'));var zipdir=require(_0x68ef('0x2'));var jsonpatch=require(_0x68ef('0x3'));var rp=require(_0x68ef('0x4'));var moment=require(_0x68ef('0x5'));var BPromise=require(_0x68ef('0x6'));var Mustache=require('mustache');var util=require(_0x68ef('0x7'));var path=require(_0x68ef('0x8'));var sox=require(_0x68ef('0x9'));var csv=require(_0x68ef('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x68ef('0xb'));var squel=require(_0x68ef('0xc'));var crypto=require(_0x68ef('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x68ef('0xe'));var toCsv=require(_0x68ef('0xa'));var querystring=require(_0x68ef('0xf'));var Papa=require(_0x68ef('0x10'));var Redis=require(_0x68ef('0x11'));var authService=require(_0x68ef('0x12'));var qs=require(_0x68ef('0x13'));var as=require(_0x68ef('0x14'));var hardwareService=require(_0x68ef('0x15'));var logger=require(_0x68ef('0x16'))(_0x68ef('0x17'));var utils=require(_0x68ef('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x68ef('0x19'));var db=require(_0x68ef('0x1a'))['db'];var jayson=require(_0x68ef('0x1b'));var client=jayson[_0x68ef('0x1c')][_0x68ef('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x288cc9,_0x508671,_0x3b48dd,_0xc50cce){return new BPromise(function(_0x2657c5,_0x47fbb5){var _0x22fe96=_0xc50cce||client;return _0x22fe96[_0x68ef('0x1e')](_0x288cc9,_0x3b48dd)[_0x68ef('0x1f')](function(_0x5005ba){logger[_0x68ef('0x20')](_0x68ef('0x21'),_0x508671,_0x68ef('0x22'));logger[_0x68ef('0x23')]('Trunk,\x20%s,\x20%s,\x20%s',_0x508671,_0x68ef('0x22'),JSON['stringify'](_0x5005ba));if(_0x5005ba['error']){if(_0x5005ba[_0x68ef('0x24')][_0x68ef('0x25')]===0x1f4){logger['error']('Trunk,\x20%s,\x20%s',_0x508671,_0x5005ba[_0x68ef('0x24')][_0x68ef('0x26')]);return _0x47fbb5(_0x5005ba[_0x68ef('0x24')]['message']);}logger[_0x68ef('0x24')](_0x68ef('0x21'),_0x508671,_0x5005ba[_0x68ef('0x24')]['message']);return _0x2657c5(_0x5005ba[_0x68ef('0x24')][_0x68ef('0x26')]);}else{logger['info'](_0x68ef('0x21'),_0x508671,_0x68ef('0x22'));_0x2657c5(_0x5005ba[_0x68ef('0x27')]['message']);}})['catch'](function(_0x59bebc){logger[_0x68ef('0x24')](_0x68ef('0x21'),_0x508671,_0x59bebc);_0x47fbb5(_0x59bebc);});});}function respondWithStatusCode(_0x312cc9,_0x2e6e39){_0x2e6e39=_0x2e6e39||0xcc;return function(_0x438b4c){if(_0x438b4c){return _0x312cc9[_0x68ef('0x28')](_0x2e6e39);}return _0x312cc9[_0x68ef('0x29')](_0x2e6e39)[_0x68ef('0x2a')]();};}function respondWithResult(_0x65fd09,_0x13280b){_0x13280b=_0x13280b||0xc8;return function(_0x5e4dbe){if(_0x5e4dbe){return _0x65fd09[_0x68ef('0x29')](_0x13280b)['json'](_0x5e4dbe);}};}function respondWithFilteredResult(_0x599243,_0x55d8b0){return function(_0x1a7ce1){if(_0x1a7ce1){var _0x268f32=typeof _0x55d8b0[_0x68ef('0x2b')]===_0x68ef('0x2c')&&typeof _0x55d8b0['limit']==='undefined';var _0x1cbe4f=_0x1a7ce1[_0x68ef('0x2d')];var _0x7bf96=_0x268f32?0x0:_0x55d8b0[_0x68ef('0x2b')];var _0x22ef25=_0x268f32?_0x1a7ce1[_0x68ef('0x2d')]:_0x55d8b0[_0x68ef('0x2b')]+_0x55d8b0[_0x68ef('0x2e')];var _0x5a6dfd;if(_0x22ef25>=_0x1cbe4f){_0x22ef25=_0x1cbe4f;_0x5a6dfd=0xc8;}else{_0x5a6dfd=0xce;}_0x599243[_0x68ef('0x29')](_0x5a6dfd);return _0x599243[_0x68ef('0x2f')](_0x68ef('0x30'),_0x7bf96+'-'+_0x22ef25+'/'+_0x1cbe4f)['json'](_0x1a7ce1);}return null;};}function patchUpdates(_0x370a8f){return function(_0x523120){try{jsonpatch[_0x68ef('0x31')](_0x523120,_0x370a8f,!![]);}catch(_0x17588a){return BPromise['reject'](_0x17588a);}return _0x523120['save']();};}function saveUpdates(_0x159395,_0x5fa72a){return function(_0x4b8fc8){if(_0x4b8fc8){return _0x4b8fc8[_0x68ef('0x32')](_0x159395)[_0x68ef('0x1f')](function(_0x2d67be){return _0x2d67be;});}return null;};}function removeEntity(_0x2d1e9f,_0x59e9fb){return function(_0x2c8bd0){if(_0x2c8bd0){return _0x2c8bd0[_0x68ef('0x33')]()['then'](function(){var _0x2f8de2=_0x2c8bd0['get']({'plain':!![]});var _0x14581d=_0x68ef('0x34');return db['UserProfileResource'][_0x68ef('0x33')]({'where':{'type':_0x14581d,'resourceId':_0x2f8de2['id']}})['then'](function(){return _0x2c8bd0;});})[_0x68ef('0x1f')](function(){_0x2d1e9f['status'](0xcc)[_0x68ef('0x2a')]();});}};}function handleEntityNotFound(_0x1444e0,_0x798276){return function(_0x569949){if(!_0x569949){_0x1444e0[_0x68ef('0x28')](0x194);}return _0x569949;};}function handleError(_0x485dc3,_0x476938){_0x476938=_0x476938||0x1f4;return function(_0x4c9506){logger[_0x68ef('0x24')](_0x4c9506[_0x68ef('0x35')]);if(_0x4c9506[_0x68ef('0x36')]){delete _0x4c9506[_0x68ef('0x36')];}_0x485dc3[_0x68ef('0x29')](_0x476938)[_0x68ef('0x37')](_0x4c9506);};}exports['index']=function(_0x294fba,_0x15a6ab){var _0x32074a={},_0x52a8b9={},_0x32eddd={'count':0x0,'rows':[]};var _0x3c5de6=_[_0x68ef('0x38')](db['Trunk']['rawAttributes'],function(_0x14f0fc){return{'name':_0x14f0fc[_0x68ef('0x39')],'type':_0x14f0fc[_0x68ef('0x3a')][_0x68ef('0x3b')]};});_0x52a8b9[_0x68ef('0x3c')]=_[_0x68ef('0x38')](_0x3c5de6,_0x68ef('0x36'));_0x52a8b9['query']=_[_0x68ef('0x3d')](_0x294fba[_0x68ef('0x3e')]);_0x52a8b9[_0x68ef('0x3f')]=_[_0x68ef('0x40')](_0x52a8b9['model'],_0x52a8b9[_0x68ef('0x3e')]);_0x32074a[_0x68ef('0x41')]=_[_0x68ef('0x40')](_0x52a8b9[_0x68ef('0x3c')],qs[_0x68ef('0x42')](_0x294fba[_0x68ef('0x3e')]['fields']));_0x32074a[_0x68ef('0x41')]=_0x32074a[_0x68ef('0x41')][_0x68ef('0x43')]?_0x32074a[_0x68ef('0x41')]:_0x52a8b9[_0x68ef('0x3c')];if(!_0x294fba[_0x68ef('0x3e')][_0x68ef('0x44')](_0x68ef('0x45'))){_0x32074a[_0x68ef('0x2e')]=qs['limit'](_0x294fba[_0x68ef('0x3e')][_0x68ef('0x2e')]);_0x32074a[_0x68ef('0x2b')]=qs[_0x68ef('0x2b')](_0x294fba[_0x68ef('0x3e')][_0x68ef('0x2b')]);}_0x32074a[_0x68ef('0x46')]=qs['sort'](_0x294fba[_0x68ef('0x3e')]['sort']);_0x32074a[_0x68ef('0x47')]=qs[_0x68ef('0x3f')](_[_0x68ef('0x48')](_0x294fba[_0x68ef('0x3e')],_0x52a8b9['filters']),_0x3c5de6);if(_0x294fba[_0x68ef('0x3e')]['filter']){_0x32074a[_0x68ef('0x47')]=_['merge'](_0x32074a[_0x68ef('0x47')],{'$or':_[_0x68ef('0x38')](_0x3c5de6,function(_0x105e8c){if(_0x105e8c['type']!=='VIRTUAL'){var _0x4044d5={};_0x4044d5[_0x105e8c[_0x68ef('0x36')]]={'$like':'%'+_0x294fba['query']['filter']+'%'};return _0x4044d5;}})});}_0x32074a=_['merge']({},_0x32074a,_0x294fba[_0x68ef('0x49')]);var _0x15c753={'where':_0x32074a[_0x68ef('0x47')]};return db[_0x68ef('0x4a')][_0x68ef('0x2d')](_0x15c753)['then'](function(_0x55f385){_0x32eddd[_0x68ef('0x2d')]=_0x55f385;if(_0x294fba[_0x68ef('0x3e')][_0x68ef('0x4b')]){_0x32074a[_0x68ef('0x4c')]=[{'all':!![]}];}return db['Trunk'][_0x68ef('0x4d')](_0x32074a);})[_0x68ef('0x1f')](function(_0x1c9b6f){_0x32eddd[_0x68ef('0x4e')]=_0x1c9b6f;return _0x32eddd;})['then'](respondWithFilteredResult(_0x15a6ab,_0x32074a))['catch'](handleError(_0x15a6ab,null));};exports[_0x68ef('0x4f')]=function(_0x3c3074,_0x566e7c){var _0xfc7a74={'raw':![],'where':{'id':_0x3c3074[_0x68ef('0x50')]['id']}},_0x12fff3={};_0x12fff3[_0x68ef('0x3c')]=_[_0x68ef('0x3d')](db['Trunk'][_0x68ef('0x51')]);_0x12fff3[_0x68ef('0x3e')]=_[_0x68ef('0x3d')](_0x3c3074['query']);_0x12fff3[_0x68ef('0x3f')]=_[_0x68ef('0x40')](_0x12fff3[_0x68ef('0x3c')],_0x12fff3['query']);_0xfc7a74[_0x68ef('0x41')]=_['intersection'](_0x12fff3['model'],qs[_0x68ef('0x42')](_0x3c3074['query'][_0x68ef('0x42')]));_0xfc7a74[_0x68ef('0x41')]=_0xfc7a74[_0x68ef('0x41')][_0x68ef('0x43')]?_0xfc7a74[_0x68ef('0x41')]:_0x12fff3[_0x68ef('0x3c')];if(_0x3c3074[_0x68ef('0x3e')][_0x68ef('0x4b')]){_0xfc7a74[_0x68ef('0x4c')]=[{'all':!![]}];}_0xfc7a74=_[_0x68ef('0x52')]({},_0xfc7a74,_0x3c3074['options']);return db['Trunk'][_0x68ef('0x53')](_0xfc7a74)[_0x68ef('0x1f')](handleEntityNotFound(_0x566e7c,null))[_0x68ef('0x1f')](respondWithResult(_0x566e7c,null))[_0x68ef('0x54')](handleError(_0x566e7c,null));};exports[_0x68ef('0x55')]=function(_0x1d11d7,_0x15400c){var _0x300a64={'where':{'id':_0x1d11d7['params']['id']}},_0x40c784={};_0x40c784['model']=_[_0x68ef('0x3d')](db['Trunk'][_0x68ef('0x51')]);_0x300a64['attributes']=_[_0x68ef('0x40')](_0x40c784[_0x68ef('0x3c')],qs['fields'](_0x1d11d7[_0x68ef('0x3e')]['fields']));_0x300a64[_0x68ef('0x41')]=_0x300a64[_0x68ef('0x41')][_0x68ef('0x43')]?_0x300a64[_0x68ef('0x41')]:_0x40c784[_0x68ef('0x3c')];if(_0x1d11d7[_0x68ef('0x3e')]['includeAll']){_0x300a64[_0x68ef('0x4c')]=[{'all':!![]}];}_0x300a64=_[_0x68ef('0x52')]({},_0x300a64,_0x1d11d7[_0x68ef('0x49')]);return db[_0x68ef('0x4a')][_0x68ef('0x53')](_0x300a64)[_0x68ef('0x1f')](handleEntityNotFound(_0x15400c,null))['then'](function(_0x9a978f){if(_0x9a978f){var _0x42d2a3=_0x9a978f['get']({'plain':!![]});_0x42d2a3=qs[_0x68ef('0x56')](_0x42d2a3,['id',_0x68ef('0x57'),_0x68ef('0x58')]);_0x1d11d7['body']=_[_0x68ef('0x56')](_0x1d11d7['body'],['id','createdAt',_0x68ef('0x58')]);return db['Trunk'][_0x68ef('0x59')](_['merge'](_0x42d2a3,_0x1d11d7[_0x68ef('0x5a')]),{'include':_0x1d11d7[_0x68ef('0x3e')][_0x68ef('0x4b')]?[{'all':!![]}]:undefined})[_0x68ef('0x1f')](function(_0x19ce17){var _0x19a9c4=_0x1d11d7['user'][_0x68ef('0x5b')]({'plain':!![]});if(!_0x19a9c4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x19a9c4[_0x68ef('0x5c')]==='user'){var _0x2f97c5=_0x19ce17[_0x68ef('0x5b')]({'plain':!![]});var _0x212ec4=_0x68ef('0x34');return db[_0x68ef('0x5d')][_0x68ef('0x53')]({'where':{'name':_0x212ec4,'userProfileId':_0x19a9c4[_0x68ef('0x5e')]},'raw':!![]})['then'](function(_0x3ea4e7){if(_0x3ea4e7&&_0x3ea4e7[_0x68ef('0x5f')]===0x0){return db[_0x68ef('0x60')][_0x68ef('0x59')]({'name':_0x2f97c5[_0x68ef('0x36')],'resourceId':_0x2f97c5['id'],'type':_0x3ea4e7['name'],'sectionId':_0x3ea4e7['id']},{})[_0x68ef('0x1f')](function(){return _0x19ce17;});}else{return _0x19ce17;}})['catch'](function(_0x1ed172){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1ed172);throw _0x1ed172;});}return _0x19ce17;});}})[_0x68ef('0x1f')](respondWithResult(_0x15400c,0xc9))[_0x68ef('0x54')](handleError(_0x15400c,null));};exports[_0x68ef('0x59')]=function(_0x21b2ce,_0x51f905,_0x124b49){var _0x570e0c;return db[_0x68ef('0x4a')][_0x68ef('0x59')](_0x21b2ce[_0x68ef('0x5a')],{'raw':!![]})['then'](function(_0x541e35){_0x570e0c=_0x541e35;return db[_0x68ef('0x4a')][_0x68ef('0x4d')]({'raw':!![]});})[_0x68ef('0x1f')](function(_0x454c6f){var _0x5b41e1=fs[_0x68ef('0x61')](path[_0x68ef('0x62')](config[_0x68ef('0x63')],_0x68ef('0x64')),'utf8');var _0x3f56a7=fs['readFileSync'](path[_0x68ef('0x62')](config[_0x68ef('0x63')],_0x68ef('0x65')),_0x68ef('0x66'));var _0xed16d1=ejs['render'](_0x5b41e1,{'trunks':_0x454c6f||[]});fs[_0x68ef('0x67')](_0x68ef('0x68'),_0xed16d1);if(_0x570e0c[_0x68ef('0x69')]){var _0x595e79=ejs[_0x68ef('0x6a')](_0x3f56a7,{'trunks':_0x454c6f||[]});fs['writeFileSync'](_0x68ef('0x6b'),_0x595e79);}})['then'](function(){return respondWithRpcPromise('Reload',_0x68ef('0x59'),{'module':_0x68ef('0x6c')});})[_0x68ef('0x1f')](function(){var _0x405971=_0x21b2ce['user'][_0x68ef('0x5b')]({'plain':!![]});if(!_0x405971)throw new Error(_0x68ef('0x6d'));if(_0x405971[_0x68ef('0x5c')]==='user'){var _0x3e14a4=_0x570e0c[_0x68ef('0x5b')]({'plain':!![]});return db[_0x68ef('0x5d')][_0x68ef('0x53')]({'where':{'name':_0x68ef('0x34'),'userProfileId':_0x405971[_0x68ef('0x5e')]},'raw':!![]})[_0x68ef('0x1f')](function(_0xfe72dc){if(_0xfe72dc&&_0xfe72dc[_0x68ef('0x5f')]===0x0){return db[_0x68ef('0x60')][_0x68ef('0x59')]({'name':_0x3e14a4[_0x68ef('0x36')],'resourceId':_0x3e14a4['id'],'type':_0xfe72dc['name'],'sectionId':_0xfe72dc['id']},{})[_0x68ef('0x1f')](function(){return _0x570e0c;});}else{return _0x570e0c;}})[_0x68ef('0x54')](function(_0x5db443){logger['error'](_0x68ef('0x6e'),_0x5db443);throw _0x5db443;});}return _0x570e0c;})['then'](respondWithResult(_0x51f905,0xc9))[_0x68ef('0x54')](handleError(_0x51f905,null));};exports[_0x68ef('0x32')]=function(_0x5f1b12,_0x4e0874,_0x31a336){var _0x5c500c;return db[_0x68ef('0x4a')]['find']({'where':{'id':_0x5f1b12[_0x68ef('0x50')]['id']}})['then'](handleEntityNotFound(_0x4e0874,null))[_0x68ef('0x1f')](saveUpdates(_0x5f1b12[_0x68ef('0x5a')],null))['then'](function(_0x3c5e35){if(_0x3c5e35){_0x5c500c=_0x3c5e35;return db[_0x68ef('0x4a')][_0x68ef('0x4d')]({'raw':!![]});}})[_0x68ef('0x1f')](function(_0x50c308){if(_0x50c308){var _0x2bebdc=fs[_0x68ef('0x61')](path['join'](config[_0x68ef('0x63')],_0x68ef('0x64')),_0x68ef('0x66'));var _0x4de1d1=fs[_0x68ef('0x61')](path['join'](config[_0x68ef('0x63')],_0x68ef('0x65')),'utf8');var _0x4b0fb4=ejs['render'](_0x2bebdc,{'trunks':_0x50c308||[]});fs['writeFileSync'](_0x68ef('0x68'),_0x4b0fb4);var _0x28ad22=ejs[_0x68ef('0x6a')](_0x4de1d1,{'trunks':_0x50c308||[]});fs[_0x68ef('0x67')](_0x68ef('0x6b'),_0x28ad22);return respondWithRpcPromise(_0x68ef('0x6f'),_0x68ef('0x32'),{'module':_0x68ef('0x6c')});}return null;})[_0x68ef('0x1f')](function(_0x3ae3e9){if(_0x3ae3e9){return _0x5c500c;}})[_0x68ef('0x1f')](respondWithResult(_0x4e0874,null))[_0x68ef('0x54')](handleError(_0x4e0874,null));};exports[_0x68ef('0x33')]=function(_0x4bd5c3,_0x2b20dc,_0x556dfc){var _0x791181;return db['Trunk']['find']({'where':{'id':_0x4bd5c3[_0x68ef('0x50')]['id']}})[_0x68ef('0x1f')](handleEntityNotFound(_0x2b20dc,null))[_0x68ef('0x1f')](removeEntity(_0x2b20dc,null))[_0x68ef('0x1f')](function(){return db['Trunk']['findAll']({'raw':!![]});})[_0x68ef('0x1f')](function(_0x308997){var _0x1f1dfd=fs['readFileSync'](path[_0x68ef('0x62')](config[_0x68ef('0x63')],_0x68ef('0x64')),_0x68ef('0x66'));var _0x4dc885=fs[_0x68ef('0x61')](path[_0x68ef('0x62')](config[_0x68ef('0x63')],_0x68ef('0x65')),_0x68ef('0x66'));var _0x346049=ejs['render'](_0x1f1dfd,{'trunks':_0x308997});var _0x2a72e8=ejs['render'](_0x4dc885,{'trunks':_0x308997});fs[_0x68ef('0x67')](_0x68ef('0x68'),_0x346049);fs[_0x68ef('0x67')](_0x68ef('0x6b'),_0x2a72e8);return respondWithRpcPromise('Reload',_0x68ef('0x33'),{'module':'chan_sip.so'});})[_0x68ef('0x54')](handleError(_0x2b20dc,null));}; \ No newline at end of file +var _0x425d=['readFileSync','root','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','UserProfileSection','userProfileId','/etc/asterisk/sip_xcally_trunks.conf','destroy','eml-format','zip-dir','fast-json-patch','request-promise','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','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','code','message','Trunk,\x20%s,\x20%s','result','catch','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','get','Trunks','UserProfileResource','stack','name','send','index','map','Trunk','rawAttributes','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','where','pick','filters','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','clone','find','omit','updatedAt','body','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','server/files/templates/trunk.ejs','utf8'];(function(_0x56f86b,_0x29d76a){var _0x250a6a=function(_0x4429ab){while(--_0x4429ab){_0x56f86b['push'](_0x56f86b['shift']());}};_0x250a6a(++_0x29d76a);}(_0x425d,0x1e0));var _0xd425=function(_0x52f4fd,_0x431ef4){_0x52f4fd=_0x52f4fd-0x0;var _0x35ea43=_0x425d[_0x52f4fd];return _0x35ea43;};'use strict';var emlformat=require(_0xd425('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd425('0x1'));var jsonpatch=require(_0xd425('0x2'));var rp=require(_0xd425('0x3'));var moment=require(_0xd425('0x4'));var BPromise=require(_0xd425('0x5'));var Mustache=require(_0xd425('0x6'));var util=require(_0xd425('0x7'));var path=require('path');var sox=require(_0xd425('0x8'));var csv=require(_0xd425('0x9'));var ejs=require(_0xd425('0xa'));var fs=require('fs');var fs_extra=require(_0xd425('0xb'));var _=require(_0xd425('0xc'));var squel=require(_0xd425('0xd'));var crypto=require('crypto');var jsforce=require(_0xd425('0xe'));var deskjs=require(_0xd425('0xf'));var toCsv=require(_0xd425('0x9'));var querystring=require(_0xd425('0x10'));var Papa=require(_0xd425('0x11'));var Redis=require(_0xd425('0x12'));var authService=require(_0xd425('0x13'));var qs=require(_0xd425('0x14'));var as=require(_0xd425('0x15'));var hardwareService=require(_0xd425('0x16'));var logger=require(_0xd425('0x17'))(_0xd425('0x18'));var utils=require(_0xd425('0x19'));var config=require(_0xd425('0x1a'));var licenseUtil=require(_0xd425('0x1b'));var db=require(_0xd425('0x1c'))['db'];var jayson=require(_0xd425('0x1d'));var client=jayson[_0xd425('0x1e')][_0xd425('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x18eafb,_0x51263f,_0x27318c,_0x17a498){return new BPromise(function(_0x336dc3,_0x5d3d60){var _0x309263=_0x17a498||client;return _0x309263[_0xd425('0x20')](_0x18eafb,_0x27318c)[_0xd425('0x21')](function(_0x41f34d){logger[_0xd425('0x22')]('Trunk,\x20%s,\x20%s',_0x51263f,_0xd425('0x23'));logger[_0xd425('0x24')](_0xd425('0x25'),_0x51263f,_0xd425('0x23'),JSON['stringify'](_0x41f34d));if(_0x41f34d[_0xd425('0x26')]){if(_0x41f34d[_0xd425('0x26')][_0xd425('0x27')]===0x1f4){logger[_0xd425('0x26')]('Trunk,\x20%s,\x20%s',_0x51263f,_0x41f34d['error']['message']);return _0x5d3d60(_0x41f34d['error'][_0xd425('0x28')]);}logger[_0xd425('0x26')](_0xd425('0x29'),_0x51263f,_0x41f34d['error'][_0xd425('0x28')]);return _0x336dc3(_0x41f34d[_0xd425('0x26')]['message']);}else{logger[_0xd425('0x22')](_0xd425('0x29'),_0x51263f,_0xd425('0x23'));_0x336dc3(_0x41f34d[_0xd425('0x2a')][_0xd425('0x28')]);}})[_0xd425('0x2b')](function(_0x2480a0){logger[_0xd425('0x26')](_0xd425('0x29'),_0x51263f,_0x2480a0);_0x5d3d60(_0x2480a0);});});}function respondWithStatusCode(_0x2b030b,_0x151ad9){_0x151ad9=_0x151ad9||0xcc;return function(_0x40e84b){if(_0x40e84b){return _0x2b030b['sendStatus'](_0x151ad9);}return _0x2b030b[_0xd425('0x2c')](_0x151ad9)[_0xd425('0x2d')]();};}function respondWithResult(_0x398985,_0x1908a5){_0x1908a5=_0x1908a5||0xc8;return function(_0x2afcdb){if(_0x2afcdb){return _0x398985[_0xd425('0x2c')](_0x1908a5)[_0xd425('0x2e')](_0x2afcdb);}};}function respondWithFilteredResult(_0x577e4b,_0x12f951){return function(_0x177de2){if(_0x177de2){var _0x1d8861=typeof _0x12f951['offset']===_0xd425('0x2f')&&typeof _0x12f951[_0xd425('0x30')]===_0xd425('0x2f');var _0x999fb9=_0x177de2[_0xd425('0x31')];var _0x185d7e=_0x1d8861?0x0:_0x12f951[_0xd425('0x32')];var _0x37b63c=_0x1d8861?_0x177de2[_0xd425('0x31')]:_0x12f951[_0xd425('0x32')]+_0x12f951['limit'];var _0x471e3e;if(_0x37b63c>=_0x999fb9){_0x37b63c=_0x999fb9;_0x471e3e=0xc8;}else{_0x471e3e=0xce;}_0x577e4b[_0xd425('0x2c')](_0x471e3e);return _0x577e4b[_0xd425('0x33')](_0xd425('0x34'),_0x185d7e+'-'+_0x37b63c+'/'+_0x999fb9)[_0xd425('0x2e')](_0x177de2);}return null;};}function patchUpdates(_0x1abf33){return function(_0x47405f){try{jsonpatch[_0xd425('0x35')](_0x47405f,_0x1abf33,!![]);}catch(_0x3ec51b){return BPromise[_0xd425('0x36')](_0x3ec51b);}return _0x47405f[_0xd425('0x37')]();};}function saveUpdates(_0x5f3dab,_0x316493){return function(_0x2a2a9b){if(_0x2a2a9b){return _0x2a2a9b[_0xd425('0x38')](_0x5f3dab)[_0xd425('0x21')](function(_0x28870f){return _0x28870f;});}return null;};}function removeEntity(_0x4eddbc,_0x4aa168){return function(_0x3badcc){if(_0x3badcc){return _0x3badcc['destroy']()['then'](function(){var _0x51669d=_0x3badcc[_0xd425('0x39')]({'plain':!![]});var _0xfb0c8=_0xd425('0x3a');return db[_0xd425('0x3b')]['destroy']({'where':{'type':_0xfb0c8,'resourceId':_0x51669d['id']}})[_0xd425('0x21')](function(){return _0x3badcc;});})[_0xd425('0x21')](function(){_0x4eddbc[_0xd425('0x2c')](0xcc)[_0xd425('0x2d')]();});}};}function handleEntityNotFound(_0x27b9e2,_0x1e12f2){return function(_0x35bbec){if(!_0x35bbec){_0x27b9e2['sendStatus'](0x194);}return _0x35bbec;};}function handleError(_0x363fb0,_0x59b3d3){_0x59b3d3=_0x59b3d3||0x1f4;return function(_0x22df81){logger[_0xd425('0x26')](_0x22df81[_0xd425('0x3c')]);if(_0x22df81['name']){delete _0x22df81[_0xd425('0x3d')];}_0x363fb0[_0xd425('0x2c')](_0x59b3d3)[_0xd425('0x3e')](_0x22df81);};}exports[_0xd425('0x3f')]=function(_0x58f36d,_0x1d38fa){var _0x3cf540={},_0x59e326={},_0x5d310e={'count':0x0,'rows':[]};var _0x48fc85=_[_0xd425('0x40')](db[_0xd425('0x41')][_0xd425('0x42')],function(_0x588688){return{'name':_0x588688['fieldName'],'type':_0x588688['type'][_0xd425('0x43')]};});_0x59e326[_0xd425('0x44')]=_[_0xd425('0x40')](_0x48fc85,_0xd425('0x3d'));_0x59e326[_0xd425('0x45')]=_[_0xd425('0x46')](_0x58f36d[_0xd425('0x45')]);_0x59e326['filters']=_[_0xd425('0x47')](_0x59e326[_0xd425('0x44')],_0x59e326[_0xd425('0x45')]);_0x3cf540['attributes']=_[_0xd425('0x47')](_0x59e326[_0xd425('0x44')],qs[_0xd425('0x48')](_0x58f36d['query'][_0xd425('0x48')]));_0x3cf540[_0xd425('0x49')]=_0x3cf540[_0xd425('0x49')][_0xd425('0x4a')]?_0x3cf540['attributes']:_0x59e326[_0xd425('0x44')];if(!_0x58f36d[_0xd425('0x45')][_0xd425('0x4b')](_0xd425('0x4c'))){_0x3cf540[_0xd425('0x30')]=qs[_0xd425('0x30')](_0x58f36d[_0xd425('0x45')]['limit']);_0x3cf540[_0xd425('0x32')]=qs[_0xd425('0x32')](_0x58f36d['query'][_0xd425('0x32')]);}_0x3cf540['order']=qs['sort'](_0x58f36d[_0xd425('0x45')]['sort']);_0x3cf540[_0xd425('0x4d')]=qs['filters'](_[_0xd425('0x4e')](_0x58f36d[_0xd425('0x45')],_0x59e326[_0xd425('0x4f')]),_0x48fc85);if(_0x58f36d[_0xd425('0x45')][_0xd425('0x50')]){_0x3cf540['where']=_[_0xd425('0x51')](_0x3cf540['where'],{'$or':_[_0xd425('0x40')](_0x48fc85,function(_0x55a15d){if(_0x55a15d[_0xd425('0x52')]!==_0xd425('0x53')){var _0x3fd2ce={};_0x3fd2ce[_0x55a15d[_0xd425('0x3d')]]={'$like':'%'+_0x58f36d[_0xd425('0x45')]['filter']+'%'};return _0x3fd2ce;}})});}_0x3cf540=_[_0xd425('0x51')]({},_0x3cf540,_0x58f36d[_0xd425('0x54')]);var _0x35e77b={'where':_0x3cf540[_0xd425('0x4d')]};return db[_0xd425('0x41')]['count'](_0x35e77b)[_0xd425('0x21')](function(_0x177704){_0x5d310e[_0xd425('0x31')]=_0x177704;if(_0x58f36d[_0xd425('0x45')][_0xd425('0x55')]){_0x3cf540[_0xd425('0x56')]=[{'all':!![]}];}return db['Trunk'][_0xd425('0x57')](_0x3cf540);})[_0xd425('0x21')](function(_0x5bfac6){_0x5d310e[_0xd425('0x58')]=_0x5bfac6;return _0x5d310e;})[_0xd425('0x21')](respondWithFilteredResult(_0x1d38fa,_0x3cf540))[_0xd425('0x2b')](handleError(_0x1d38fa,null));};exports[_0xd425('0x59')]=function(_0x5c0219,_0x54f1d){var _0x2b8882={'raw':![],'where':{'id':_0x5c0219[_0xd425('0x5a')]['id']}},_0x4552cd={};_0x4552cd[_0xd425('0x44')]=_['keys'](db['Trunk'][_0xd425('0x42')]);_0x4552cd['query']=_[_0xd425('0x46')](_0x5c0219[_0xd425('0x45')]);_0x4552cd['filters']=_[_0xd425('0x47')](_0x4552cd['model'],_0x4552cd['query']);_0x2b8882[_0xd425('0x49')]=_[_0xd425('0x47')](_0x4552cd[_0xd425('0x44')],qs[_0xd425('0x48')](_0x5c0219[_0xd425('0x45')][_0xd425('0x48')]));_0x2b8882[_0xd425('0x49')]=_0x2b8882[_0xd425('0x49')]['length']?_0x2b8882[_0xd425('0x49')]:_0x4552cd[_0xd425('0x44')];if(_0x5c0219[_0xd425('0x45')][_0xd425('0x55')]){_0x2b8882[_0xd425('0x56')]=[{'all':!![]}];}_0x2b8882=_[_0xd425('0x51')]({},_0x2b8882,_0x5c0219[_0xd425('0x54')]);return db[_0xd425('0x41')]['find'](_0x2b8882)['then'](handleEntityNotFound(_0x54f1d,null))['then'](respondWithResult(_0x54f1d,null))[_0xd425('0x2b')](handleError(_0x54f1d,null));};exports[_0xd425('0x5b')]=function(_0x3dec61,_0x3c6b49){var _0x59c286={'where':{'id':_0x3dec61['params']['id']}},_0x4fedc0={};_0x4fedc0['model']=_[_0xd425('0x46')](db[_0xd425('0x41')]['rawAttributes']);_0x59c286[_0xd425('0x49')]=_[_0xd425('0x47')](_0x4fedc0[_0xd425('0x44')],qs['fields'](_0x3dec61['query'][_0xd425('0x48')]));_0x59c286['attributes']=_0x59c286['attributes']['length']?_0x59c286[_0xd425('0x49')]:_0x4fedc0[_0xd425('0x44')];if(_0x3dec61[_0xd425('0x45')]['includeAll']){_0x59c286[_0xd425('0x56')]=[{'all':!![]}];}_0x59c286=_['merge']({},_0x59c286,_0x3dec61[_0xd425('0x54')]);return db[_0xd425('0x41')][_0xd425('0x5c')](_0x59c286)[_0xd425('0x21')](handleEntityNotFound(_0x3c6b49,null))[_0xd425('0x21')](function(_0xd261a){if(_0xd261a){var _0xa21f7c=_0xd261a[_0xd425('0x39')]({'plain':!![]});_0xa21f7c=qs[_0xd425('0x5d')](_0xa21f7c,['id','createdAt',_0xd425('0x5e')]);_0x3dec61[_0xd425('0x5f')]=_[_0xd425('0x5d')](_0x3dec61[_0xd425('0x5f')],['id','createdAt','updatedAt']);return db[_0xd425('0x41')][_0xd425('0x60')](_[_0xd425('0x51')](_0xa21f7c,_0x3dec61[_0xd425('0x5f')]),{'include':_0x3dec61[_0xd425('0x45')][_0xd425('0x55')]?[{'all':!![]}]:undefined})[_0xd425('0x21')](function(_0x44782a){var _0x1fcde4=_0x3dec61[_0xd425('0x61')][_0xd425('0x39')]({'plain':!![]});if(!_0x1fcde4)throw new Error(_0xd425('0x62'));if(_0x1fcde4[_0xd425('0x63')]===_0xd425('0x61')){var _0x5e72db=_0x44782a[_0xd425('0x39')]({'plain':!![]});var _0x343cc1=_0xd425('0x3a');return db['UserProfileSection']['find']({'where':{'name':_0x343cc1,'userProfileId':_0x1fcde4['userProfileId']},'raw':!![]})[_0xd425('0x21')](function(_0x34d065){if(_0x34d065&&_0x34d065[_0xd425('0x64')]===0x0){return db['UserProfileResource'][_0xd425('0x60')]({'name':_0x5e72db['name'],'resourceId':_0x5e72db['id'],'type':_0x34d065[_0xd425('0x3d')],'sectionId':_0x34d065['id']},{})[_0xd425('0x21')](function(){return _0x44782a;});}else{return _0x44782a;}})[_0xd425('0x2b')](function(_0x5113fc){logger[_0xd425('0x26')](_0xd425('0x65'),_0x5113fc);throw _0x5113fc;});}return _0x44782a;});}})[_0xd425('0x21')](respondWithResult(_0x3c6b49,0xc9))[_0xd425('0x2b')](handleError(_0x3c6b49,null));};exports[_0xd425('0x60')]=function(_0x43b1a9,_0x38a762,_0x44db7f){var _0xcb1a64;return db[_0xd425('0x41')][_0xd425('0x60')](_0x43b1a9[_0xd425('0x5f')],{'raw':!![]})[_0xd425('0x21')](function(_0x285d54){_0xcb1a64=_0x285d54;return db[_0xd425('0x41')][_0xd425('0x57')]({'raw':!![]});})[_0xd425('0x21')](function(_0x25cae6){var _0x541218=fs['readFileSync'](path[_0xd425('0x66')](config['root'],_0xd425('0x67')),_0xd425('0x68'));var _0xb407bb=fs[_0xd425('0x69')](path['join'](config[_0xd425('0x6a')],_0xd425('0x6b')),_0xd425('0x68'));var _0x689332=ejs[_0xd425('0x6c')](_0x541218,{'trunks':_0x25cae6||[]});fs[_0xd425('0x6d')]('/etc/asterisk/sip_xcally_trunks.conf',_0x689332);if(_0xcb1a64['registry']){var _0x3ccffe=ejs[_0xd425('0x6c')](_0xb407bb,{'trunks':_0x25cae6||[]});fs['writeFileSync'](_0xd425('0x6e'),_0x3ccffe);}})['then'](function(){return respondWithRpcPromise(_0xd425('0x6f'),_0xd425('0x60'),{'module':_0xd425('0x70')});})[_0xd425('0x21')](function(){var _0x376134=_0x43b1a9[_0xd425('0x61')][_0xd425('0x39')]({'plain':!![]});if(!_0x376134)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x376134[_0xd425('0x63')]===_0xd425('0x61')){var _0x24af3=_0xcb1a64[_0xd425('0x39')]({'plain':!![]});return db[_0xd425('0x71')]['find']({'where':{'name':_0xd425('0x3a'),'userProfileId':_0x376134[_0xd425('0x72')]},'raw':!![]})['then'](function(_0x2bb36f){if(_0x2bb36f&&_0x2bb36f[_0xd425('0x64')]===0x0){return db['UserProfileResource'][_0xd425('0x60')]({'name':_0x24af3[_0xd425('0x3d')],'resourceId':_0x24af3['id'],'type':_0x2bb36f[_0xd425('0x3d')],'sectionId':_0x2bb36f['id']},{})[_0xd425('0x21')](function(){return _0xcb1a64;});}else{return _0xcb1a64;}})[_0xd425('0x2b')](function(_0x572f23){logger[_0xd425('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x572f23);throw _0x572f23;});}return _0xcb1a64;})[_0xd425('0x21')](respondWithResult(_0x38a762,0xc9))[_0xd425('0x2b')](handleError(_0x38a762,null));};exports['update']=function(_0x2bf8e6,_0xcf7b51,_0x66d87b){var _0x1fc64d;return db['Trunk']['find']({'where':{'id':_0x2bf8e6[_0xd425('0x5a')]['id']}})[_0xd425('0x21')](handleEntityNotFound(_0xcf7b51,null))[_0xd425('0x21')](saveUpdates(_0x2bf8e6['body'],null))[_0xd425('0x21')](function(_0xb1479e){if(_0xb1479e){_0x1fc64d=_0xb1479e;return db['Trunk'][_0xd425('0x57')]({'raw':!![]});}})['then'](function(_0x998ad1){if(_0x998ad1){var _0x46346c=fs[_0xd425('0x69')](path[_0xd425('0x66')](config['root'],'server/files/templates/trunk.ejs'),_0xd425('0x68'));var _0x413a65=fs['readFileSync'](path[_0xd425('0x66')](config[_0xd425('0x6a')],'server/files/templates/registry.ejs'),_0xd425('0x68'));var _0x369f8b=ejs[_0xd425('0x6c')](_0x46346c,{'trunks':_0x998ad1||[]});fs[_0xd425('0x6d')](_0xd425('0x73'),_0x369f8b);var _0xf251e6=ejs[_0xd425('0x6c')](_0x413a65,{'trunks':_0x998ad1||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0xf251e6);return respondWithRpcPromise(_0xd425('0x6f'),'update',{'module':_0xd425('0x70')});}return null;})[_0xd425('0x21')](function(_0x58cad5){if(_0x58cad5){return _0x1fc64d;}})[_0xd425('0x21')](respondWithResult(_0xcf7b51,null))[_0xd425('0x2b')](handleError(_0xcf7b51,null));};exports['destroy']=function(_0x592c40,_0x750685,_0x242ed8){var _0x16eac6;return db[_0xd425('0x41')][_0xd425('0x5c')]({'where':{'id':_0x592c40[_0xd425('0x5a')]['id']}})[_0xd425('0x21')](handleEntityNotFound(_0x750685,null))[_0xd425('0x21')](removeEntity(_0x750685,null))['then'](function(){return db[_0xd425('0x41')][_0xd425('0x57')]({'raw':!![]});})['then'](function(_0x2bbcf3){var _0x1d386c=fs[_0xd425('0x69')](path[_0xd425('0x66')](config[_0xd425('0x6a')],_0xd425('0x67')),_0xd425('0x68'));var _0x2c3995=fs[_0xd425('0x69')](path[_0xd425('0x66')](config[_0xd425('0x6a')],'server/files/templates/registry.ejs'),_0xd425('0x68'));var _0x498e81=ejs['render'](_0x1d386c,{'trunks':_0x2bbcf3});var _0x2c8d63=ejs['render'](_0x2c3995,{'trunks':_0x2bbcf3});fs[_0xd425('0x6d')](_0xd425('0x73'),_0x498e81);fs[_0xd425('0x6d')](_0xd425('0x6e'),_0x2c8d63);return respondWithRpcPromise(_0xd425('0x6f'),_0xd425('0x74'),{'module':_0xd425('0x70')});})['catch'](handleError(_0x750685,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 84a1fa8..0b36f72 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 _0xb545=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','exports','define','Trunk'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb545,0x6e));var _0x5b54=function(_0x4ee1b0,_0x18a0a8){_0x4ee1b0=_0x4ee1b0-0x0;var _0xdc9587=_0xb545[_0x4ee1b0];return _0xdc9587;};'use strict';var _=require(_0x5b54('0x0'));var util=require(_0x5b54('0x1'));var logger=require('../../config/logger')(_0x5b54('0x2'));var moment=require(_0x5b54('0x3'));var BPromise=require(_0x5b54('0x4'));var rp=require(_0x5b54('0x5'));var fs=require('fs');var path=require(_0x5b54('0x6'));var rimraf=require(_0x5b54('0x7'));var config=require('../../config/environment');var attributes=require('./trunk.attributes');module[_0x5b54('0x8')]=function(_0x4360dd,_0xb75032){return _0x4360dd[_0x5b54('0x9')](_0x5b54('0xa'),attributes,{'tableName':'tools_trunks','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0b67=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./trunk.attributes','exports','define','Trunk','tools_trunks'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0x0b67,0x188));var _0x70b6=function(_0x3e7a2d,_0x3556c7){_0x3e7a2d=_0x3e7a2d-0x0;var _0x1e5a40=_0x0b67[_0x3e7a2d];return _0x1e5a40;};'use strict';var _=require(_0x70b6('0x0'));var util=require(_0x70b6('0x1'));var logger=require(_0x70b6('0x2'))(_0x70b6('0x3'));var moment=require(_0x70b6('0x4'));var BPromise=require(_0x70b6('0x5'));var rp=require(_0x70b6('0x6'));var fs=require('fs');var path=require(_0x70b6('0x7'));var rimraf=require(_0x70b6('0x8'));var config=require('../../config/environment');var attributes=require(_0x70b6('0x9'));module[_0x70b6('0xa')]=function(_0x1f5dde,_0xa063c9){return _0x1f5dde[_0x70b6('0xb')](_0x70b6('0xc'),attributes,{'tableName':_0x70b6('0xd'),'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 5da958f..4654d12 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 _0xe181=['limit','include','map','model','ShowTrunk','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetTrunk','Trunk','findAll','options','raw','where','attributes'];(function(_0x12cf2b,_0x5aecb3){var _0x1cf246=function(_0x188ae6){while(--_0x188ae6){_0x12cf2b['push'](_0x12cf2b['shift']());}};_0x1cf246(++_0x5aecb3);}(_0xe181,0x68));var _0x1e18=function(_0x1ef911,_0x32a38b){_0x1ef911=_0x1ef911-0x0;var _0x5297f4=_0xe181[_0x1ef911];return _0x5297f4;};'use strict';var _=require(_0x1e18('0x0'));var util=require('util');var moment=require(_0x1e18('0x1'));var BPromise=require(_0x1e18('0x2'));var rs=require(_0x1e18('0x3'));var fs=require('fs');var Redis=require(_0x1e18('0x4'));var db=require(_0x1e18('0x5'))['db'];var utils=require(_0x1e18('0x6'));var logger=require(_0x1e18('0x7'))('rpc');var config=require(_0x1e18('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1e18('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x182c98,_0x46ba95,_0x25b786){return new BPromise(function(_0x9f9541,_0x398f77){return client['request'](_0x182c98,_0x25b786)[_0x1e18('0xa')](function(_0x40fda9){logger[_0x1e18('0xb')](_0x1e18('0xc'),_0x46ba95,_0x1e18('0xd'));logger[_0x1e18('0xe')]('Trunk,\x20%s,\x20%s,\x20%s',_0x46ba95,_0x1e18('0xd'),JSON[_0x1e18('0xf')](_0x40fda9));if(_0x40fda9[_0x1e18('0x10')]){if(_0x40fda9[_0x1e18('0x10')][_0x1e18('0x11')]===0x1f4){logger[_0x1e18('0x10')](_0x1e18('0xc'),_0x46ba95,_0x40fda9[_0x1e18('0x10')]['message']);return _0x398f77(_0x40fda9[_0x1e18('0x10')]['message']);}logger[_0x1e18('0x10')]('Trunk,\x20%s,\x20%s',_0x46ba95,_0x40fda9[_0x1e18('0x10')][_0x1e18('0x12')]);return _0x9f9541(_0x40fda9[_0x1e18('0x10')][_0x1e18('0x12')]);}else{logger[_0x1e18('0xb')](_0x1e18('0xc'),_0x46ba95,_0x1e18('0xd'));_0x9f9541(_0x40fda9[_0x1e18('0x13')][_0x1e18('0x12')]);}})[_0x1e18('0x14')](function(_0x12ef98){logger[_0x1e18('0x10')](_0x1e18('0xc'),_0x46ba95,_0x12ef98);_0x398f77(_0x12ef98);});});}exports[_0x1e18('0x15')]=function(_0x21b851){var _0x5b2888=this;return new Promise(function(_0x1c91d2,_0x17f558){return db[_0x1e18('0x16')][_0x1e18('0x17')]({'raw':_0x21b851[_0x1e18('0x18')]?_0x21b851[_0x1e18('0x18')][_0x1e18('0x19')]===undefined?!![]:![]:!![],'where':_0x21b851[_0x1e18('0x18')]?_0x21b851[_0x1e18('0x18')][_0x1e18('0x1a')]||null:null,'attributes':_0x21b851[_0x1e18('0x18')]?_0x21b851[_0x1e18('0x18')][_0x1e18('0x1b')]||null:null,'limit':_0x21b851[_0x1e18('0x18')]?_0x21b851[_0x1e18('0x18')][_0x1e18('0x1c')]||null:null,'include':_0x21b851[_0x1e18('0x18')]?_0x21b851['options'][_0x1e18('0x1d')]?_[_0x1e18('0x1e')](_0x21b851[_0x1e18('0x18')]['include'],function(_0xf74622){return{'model':db[_0xf74622[_0x1e18('0x1f')]],'as':_0xf74622['as'],'attributes':_0xf74622[_0x1e18('0x1b')],'include':_0xf74622[_0x1e18('0x1d')]?_['map'](_0xf74622['include'],function(_0x6fa4db){return{'model':db[_0x6fa4db['model']],'as':_0x6fa4db['as'],'attributes':_0x6fa4db['attributes'],'include':_0x6fa4db['include']?_[_0x1e18('0x1e')](_0x6fa4db[_0x1e18('0x1d')],function(_0x41b67d){return{'model':db[_0x41b67d[_0x1e18('0x1f')]],'as':_0x41b67d['as'],'attributes':_0x41b67d[_0x1e18('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x1e18('0xa')](function(_0x167f67){logger[_0x1e18('0xb')](_0x1e18('0x15'),_0x21b851);logger[_0x1e18('0xe')](_0x1e18('0x15'),_0x21b851,JSON[_0x1e18('0xf')](_0x167f67));_0x1c91d2(_0x167f67);})[_0x1e18('0x14')](function(_0x1be225){logger['error'](_0x1e18('0x15'),_0x1be225['message'],_0x21b851);_0x17f558(_0x5b2888[_0x1e18('0x10')](0x1f4,_0x1be225[_0x1e18('0x12')]));});});};exports[_0x1e18('0x20')]=function(_0x230bb1){var _0x2828dc=this;return new Promise(function(_0x93dd11,_0x2d47c8){return db[_0x1e18('0x16')]['find']({'raw':_0x230bb1[_0x1e18('0x18')]?_0x230bb1[_0x1e18('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x230bb1[_0x1e18('0x18')]?_0x230bb1[_0x1e18('0x18')][_0x1e18('0x1a')]||null:null,'attributes':_0x230bb1['options']?_0x230bb1[_0x1e18('0x18')]['attributes']||null:null,'include':_0x230bb1['options']?_0x230bb1['options'][_0x1e18('0x1d')]?_['map'](_0x230bb1[_0x1e18('0x18')][_0x1e18('0x1d')],function(_0x3b7556){return{'model':db[_0x3b7556['model']],'as':_0x3b7556['as'],'attributes':_0x3b7556['attributes'],'include':_0x3b7556[_0x1e18('0x1d')]?_[_0x1e18('0x1e')](_0x3b7556[_0x1e18('0x1d')],function(_0x24eecf){return{'model':db[_0x24eecf[_0x1e18('0x1f')]],'as':_0x24eecf['as'],'attributes':_0x24eecf[_0x1e18('0x1b')],'include':_0x24eecf[_0x1e18('0x1d')]?_[_0x1e18('0x1e')](_0x24eecf[_0x1e18('0x1d')],function(_0xe1d2e2){return{'model':db[_0xe1d2e2[_0x1e18('0x1f')]],'as':_0xe1d2e2['as'],'attributes':_0xe1d2e2[_0x1e18('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x51d59f){logger[_0x1e18('0xb')](_0x1e18('0x20'),_0x230bb1);logger[_0x1e18('0xe')]('ShowTrunk',_0x230bb1,JSON[_0x1e18('0xf')](_0x51d59f));_0x93dd11(_0x51d59f);})['catch'](function(_0x743201){logger['error']('ShowTrunk',_0x743201[_0x1e18('0x12')],_0x230bb1);_0x2d47c8(_0x2828dc[_0x1e18('0x10')](0x1f4,_0x743201[_0x1e18('0x12')]));});});}; \ No newline at end of file +var _0xd1d1=['map','include','model','attributes','debug','catch','ShowTrunk','then','util','bluebird','ioredis','../../config/logger','rpc','jayson/promise','http','request','info','Trunk,\x20%s,\x20%s','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','GetTrunk','Trunk','findAll','options','where','limit'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xd1d1,0xe1));var _0x1d1d=function(_0x520139,_0x5a4d63){_0x520139=_0x520139-0x0;var _0x113f2d=_0xd1d1[_0x520139];return _0x113f2d;};'use strict';var _=require('lodash');var util=require(_0x1d1d('0x0'));var moment=require('moment');var BPromise=require(_0x1d1d('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1d1d('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1d1d('0x3'))(_0x1d1d('0x4'));var config=require('../../config/environment');var jayson=require(_0x1d1d('0x5'));var client=jayson['client'][_0x1d1d('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x5f00db,_0x2313eb,_0x4b67a8){return new BPromise(function(_0x3e6520,_0x3cc3dc){return client[_0x1d1d('0x7')](_0x5f00db,_0x4b67a8)['then'](function(_0x1b3c75){logger[_0x1d1d('0x8')](_0x1d1d('0x9'),_0x2313eb,'request\x20sent');logger['debug'](_0x1d1d('0xa'),_0x2313eb,_0x1d1d('0xb'),JSON[_0x1d1d('0xc')](_0x1b3c75));if(_0x1b3c75['error']){if(_0x1b3c75['error'][_0x1d1d('0xd')]===0x1f4){logger[_0x1d1d('0xe')](_0x1d1d('0x9'),_0x2313eb,_0x1b3c75[_0x1d1d('0xe')][_0x1d1d('0xf')]);return _0x3cc3dc(_0x1b3c75['error'][_0x1d1d('0xf')]);}logger['error']('Trunk,\x20%s,\x20%s',_0x2313eb,_0x1b3c75[_0x1d1d('0xe')][_0x1d1d('0xf')]);return _0x3e6520(_0x1b3c75[_0x1d1d('0xe')][_0x1d1d('0xf')]);}else{logger[_0x1d1d('0x8')](_0x1d1d('0x9'),_0x2313eb,_0x1d1d('0xb'));_0x3e6520(_0x1b3c75[_0x1d1d('0x10')]['message']);}})['catch'](function(_0x16e595){logger[_0x1d1d('0xe')](_0x1d1d('0x9'),_0x2313eb,_0x16e595);_0x3cc3dc(_0x16e595);});});}exports[_0x1d1d('0x11')]=function(_0x3b3a1e){var _0xafb144=this;return new Promise(function(_0x48566f,_0x1284a1){return db[_0x1d1d('0x12')][_0x1d1d('0x13')]({'raw':_0x3b3a1e[_0x1d1d('0x14')]?_0x3b3a1e[_0x1d1d('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x3b3a1e[_0x1d1d('0x14')]?_0x3b3a1e[_0x1d1d('0x14')][_0x1d1d('0x15')]||null:null,'attributes':_0x3b3a1e[_0x1d1d('0x14')]?_0x3b3a1e[_0x1d1d('0x14')]['attributes']||null:null,'limit':_0x3b3a1e[_0x1d1d('0x14')]?_0x3b3a1e[_0x1d1d('0x14')][_0x1d1d('0x16')]||null:null,'include':_0x3b3a1e['options']?_0x3b3a1e[_0x1d1d('0x14')]['include']?_[_0x1d1d('0x17')](_0x3b3a1e['options'][_0x1d1d('0x18')],function(_0x21af57){return{'model':db[_0x21af57[_0x1d1d('0x19')]],'as':_0x21af57['as'],'attributes':_0x21af57['attributes'],'include':_0x21af57[_0x1d1d('0x18')]?_[_0x1d1d('0x17')](_0x21af57['include'],function(_0x340ca8){return{'model':db[_0x340ca8[_0x1d1d('0x19')]],'as':_0x340ca8['as'],'attributes':_0x340ca8[_0x1d1d('0x1a')],'include':_0x340ca8[_0x1d1d('0x18')]?_[_0x1d1d('0x17')](_0x340ca8[_0x1d1d('0x18')],function(_0x3e5267){return{'model':db[_0x3e5267[_0x1d1d('0x19')]],'as':_0x3e5267['as'],'attributes':_0x3e5267[_0x1d1d('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x11a382){logger[_0x1d1d('0x8')](_0x1d1d('0x11'),_0x3b3a1e);logger[_0x1d1d('0x1b')](_0x1d1d('0x11'),_0x3b3a1e,JSON[_0x1d1d('0xc')](_0x11a382));_0x48566f(_0x11a382);})[_0x1d1d('0x1c')](function(_0x709b92){logger['error'](_0x1d1d('0x11'),_0x709b92['message'],_0x3b3a1e);_0x1284a1(_0xafb144['error'](0x1f4,_0x709b92[_0x1d1d('0xf')]));});});};exports[_0x1d1d('0x1d')]=function(_0x23e743){var _0x12fbae=this;return new Promise(function(_0x1cc9a2,_0x567b67){return db[_0x1d1d('0x12')]['find']({'raw':_0x23e743['options']?_0x23e743[_0x1d1d('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x23e743[_0x1d1d('0x14')]?_0x23e743[_0x1d1d('0x14')][_0x1d1d('0x15')]||null:null,'attributes':_0x23e743[_0x1d1d('0x14')]?_0x23e743[_0x1d1d('0x14')][_0x1d1d('0x1a')]||null:null,'include':_0x23e743['options']?_0x23e743[_0x1d1d('0x14')]['include']?_[_0x1d1d('0x17')](_0x23e743['options'][_0x1d1d('0x18')],function(_0x38eb89){return{'model':db[_0x38eb89[_0x1d1d('0x19')]],'as':_0x38eb89['as'],'attributes':_0x38eb89[_0x1d1d('0x1a')],'include':_0x38eb89[_0x1d1d('0x18')]?_[_0x1d1d('0x17')](_0x38eb89['include'],function(_0x34d3ec){return{'model':db[_0x34d3ec[_0x1d1d('0x19')]],'as':_0x34d3ec['as'],'attributes':_0x34d3ec[_0x1d1d('0x1a')],'include':_0x34d3ec[_0x1d1d('0x18')]?_[_0x1d1d('0x17')](_0x34d3ec[_0x1d1d('0x18')],function(_0x2432ca){return{'model':db[_0x2432ca[_0x1d1d('0x19')]],'as':_0x2432ca['as'],'attributes':_0x2432ca[_0x1d1d('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x1d1d('0x1e')](function(_0x401d6a){logger['info'](_0x1d1d('0x1d'),_0x23e743);logger[_0x1d1d('0x1b')](_0x1d1d('0x1d'),_0x23e743,JSON[_0x1d1d('0xc')](_0x401d6a));_0x1cc9a2(_0x401d6a);})[_0x1d1d('0x1c')](function(_0x5e1dbd){logger[_0x1d1d('0xe')](_0x1d1d('0x1d'),_0x5e1dbd[_0x1d1d('0xf')],_0x23e743);_0x567b67(_0x12fbae[_0x1d1d('0xe')](0x1f4,_0x5e1dbd[_0x1d1d('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index 857dd3d..2edd476 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 _0x2229=['exports','Router','../../components/auth/service','./user-setting.controller','put','/:id','update'];(function(_0x53f0db,_0x35c67c){var _0xae0a5c=function(_0x4bd6fb){while(--_0x4bd6fb){_0x53f0db['push'](_0x53f0db['shift']());}};_0xae0a5c(++_0x35c67c);}(_0x2229,0xd3));var _0x9222=function(_0x43506e,_0x671bd7){_0x43506e=_0x43506e-0x0;var _0x88dd16=_0x2229[_0x43506e];return _0x88dd16;};'use strict';var express=require('express');var router=express[_0x9222('0x0')]();var auth=require(_0x9222('0x1'));var controller=require(_0x9222('0x2'));router[_0x9222('0x3')](_0x9222('0x4'),auth['isAuthenticated'](),controller[_0x9222('0x5')]);module[_0x9222('0x6')]=router; \ No newline at end of file +var _0xbef0=['put','/:id','isAuthenticated','update','exports','Router','../../components/auth/service','./user-setting.controller'];(function(_0x4ec0f7,_0xa1106f){var _0x34c64b=function(_0x50a01a){while(--_0x50a01a){_0x4ec0f7['push'](_0x4ec0f7['shift']());}};_0x34c64b(++_0xa1106f);}(_0xbef0,0x195));var _0x0bef=function(_0x43a409,_0x21794e){_0x43a409=_0x43a409-0x0;var _0x4d9f0e=_0xbef0[_0x43a409];return _0x4d9f0e;};'use strict';var express=require('express');var router=express[_0x0bef('0x0')]();var auth=require(_0x0bef('0x1'));var controller=require(_0x0bef('0x2'));router[_0x0bef('0x3')](_0x0bef('0x4'),auth[_0x0bef('0x5')](),controller[_0x0bef('0x6')]);module[_0x0bef('0x7')]=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 2bc6915..ea9b026 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 _0x09ca=['INTEGER','sequelize','error','warning','debug','exports','ENUM','BOOLEAN'];(function(_0x2b3d18,_0x49c10b){var _0x46a9d0=function(_0x1bc08d){while(--_0x1bc08d){_0x2b3d18['push'](_0x2b3d18['shift']());}};_0x46a9d0(++_0x49c10b);}(_0x09ca,0x1f1));var _0xa09c=function(_0x3d3f91,_0x2b034e){_0x3d3f91=_0x3d3f91-0x0;var _0x57cf7f=_0x09ca[_0x3d3f91];return _0x57cf7f;};'use strict';var Sequelize=require(_0xa09c('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0xa09c('0x1'),_0xa09c('0x2'),'info',_0xa09c('0x3')];module[_0xa09c('0x4')]={'clientSideLoggingLevel':{'type':Sequelize[_0xa09c('0x5')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0xa09c('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0xa09c('0x6')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize['TEXT'],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0xa09c('0x7')],'unique':'UserId'}}; \ No newline at end of file +var _0x0a2a=['exports','ENUM','BOOLEAN','DATE','UserId','error','warning','info','debug'];(function(_0x4843f9,_0x4af459){var _0x193c6a=function(_0x51eca9){while(--_0x51eca9){_0x4843f9['push'](_0x4843f9['shift']());}};_0x193c6a(++_0x4af459);}(_0x0a2a,0xf8));var _0xa0a2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0a2a[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');const CLIENT_SIDE_LOG_LEVELS=[_0xa0a2('0x0'),_0xa0a2('0x1'),_0xa0a2('0x2'),_0xa0a2('0x3')];module[_0xa0a2('0x4')]={'clientSideLoggingLevel':{'type':Sequelize[_0xa0a2('0x5')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':'error','validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0xa0a2('0x6')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize['TEXT'],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0xa0a2('0x7')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize['INTEGER'],'unique':_0xa0a2('0x8')}}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.controller.js b/server/api/user-setting/user-setting.controller.js index bf29038..c997523 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 _0x871e=['json','update','then','sendStatus','error','stack','name','status','send','user','role','admin','params','find','body','catch','lodash','../../config/logger','api','../../config/environment','../../mysqldb','redis','./user-setting.socket','register','defaults','localhost'];(function(_0x2034a6,_0x106a1b){var _0x10e687=function(_0xbb667e){while(--_0xbb667e){_0x2034a6['push'](_0x2034a6['shift']());}};_0x10e687(++_0x106a1b);}(_0x871e,0x1b0));var _0xe871=function(_0x57d1b8,_0x4ca116){_0x57d1b8=_0x57d1b8-0x0;var _0x569b64=_0x871e[_0x57d1b8];return _0x569b64;};'use strict';var _=require(_0xe871('0x0'));var Redis=require('ioredis');var logger=require(_0xe871('0x1'))(_0xe871('0x2'));var config=require(_0xe871('0x3'));var db=require(_0xe871('0x4'))['db'];var socket=require('socket.io-emitter')(new Redis(config[_0xe871('0x5')]));require(_0xe871('0x6'))[_0xe871('0x7')](socket);config[_0xe871('0x5')]=_[_0xe871('0x8')](config[_0xe871('0x5')],{'host':_0xe871('0x9'),'port':0x18eb});function respondWithResult(_0x13ed0e,_0x289308){_0x289308=_0x289308||0xc8;return function(_0x1d773f){if(_0x1d773f){return _0x13ed0e['status'](_0x289308)[_0xe871('0xa')](_0x1d773f);}};}function saveUpdates(_0x5c4eda){return function(_0x5eb389){if(_0x5eb389){return _0x5eb389[_0xe871('0xb')](_0x5c4eda)[_0xe871('0xc')](function(_0x17a913){return _0x17a913;});}return null;};}function handleEntityNotFound(_0x5bdd86){return function(_0x8871ff){if(!_0x8871ff){_0x5bdd86[_0xe871('0xd')](0x194);}return _0x8871ff;};}function handleError(_0x33881e,_0x1b23d1){_0x1b23d1=_0x1b23d1||0x1f4;return function(_0x3c85a8){logger[_0xe871('0xe')](_0x3c85a8[_0xe871('0xf')]);if(_0x3c85a8['name']){delete _0x3c85a8[_0xe871('0x10')];}_0x33881e[_0xe871('0x11')](_0x1b23d1)[_0xe871('0x12')](_0x3c85a8);};}exports[_0xe871('0xb')]=function(_0xe6bfa3,_0x3f226c){if(_0xe6bfa3[_0xe871('0x13')][_0xe871('0x14')]!==_0xe871('0x15'))throw new Error('Unauthorized');if(isNaN(Number(_0xe6bfa3[_0xe871('0x16')]['id'])))throw new Error('Invalid\x20user\x20setting\x20id');return db['UserSetting'][_0xe871('0x17')]({'where':{'id':_0xe6bfa3[_0xe871('0x16')]['id']}})[_0xe871('0xc')](handleEntityNotFound(_0x3f226c,null))[_0xe871('0xc')](saveUpdates(_0xe6bfa3[_0xe871('0x18')],null))[_0xe871('0xc')](respondWithResult(_0x3f226c,null))[_0xe871('0x19')](handleError(_0x3f226c,null));}; \ No newline at end of file +var _0x7266=['role','admin','params','UserSetting','find','body','lodash','ioredis','../../config/logger','api','../../config/environment','redis','./user-setting.socket','defaults','localhost','status','json','update','then','sendStatus','error','name','send'];(function(_0x38a6b5,_0x5b6002){var _0x1ce21c=function(_0x541671){while(--_0x541671){_0x38a6b5['push'](_0x38a6b5['shift']());}};_0x1ce21c(++_0x5b6002);}(_0x7266,0xec));var _0x6726=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x7266[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x6726('0x0'));var Redis=require(_0x6726('0x1'));var logger=require(_0x6726('0x2'))(_0x6726('0x3'));var config=require(_0x6726('0x4'));var db=require('../../mysqldb')['db'];var socket=require('socket.io-emitter')(new Redis(config[_0x6726('0x5')]));require(_0x6726('0x6'))['register'](socket);config['redis']=_[_0x6726('0x7')](config[_0x6726('0x5')],{'host':_0x6726('0x8'),'port':0x18eb});function respondWithResult(_0x180502,_0x217972){_0x217972=_0x217972||0xc8;return function(_0x3c8020){if(_0x3c8020){return _0x180502[_0x6726('0x9')](_0x217972)[_0x6726('0xa')](_0x3c8020);}};}function saveUpdates(_0x196ebd){return function(_0x252b9d){if(_0x252b9d){return _0x252b9d[_0x6726('0xb')](_0x196ebd)[_0x6726('0xc')](function(_0xdda3e6){return _0xdda3e6;});}return null;};}function handleEntityNotFound(_0x5e8efb){return function(_0x44ff0c){if(!_0x44ff0c){_0x5e8efb[_0x6726('0xd')](0x194);}return _0x44ff0c;};}function handleError(_0x1c6377,_0x16786f){_0x16786f=_0x16786f||0x1f4;return function(_0x4919c5){logger[_0x6726('0xe')](_0x4919c5['stack']);if(_0x4919c5[_0x6726('0xf')]){delete _0x4919c5[_0x6726('0xf')];}_0x1c6377['status'](_0x16786f)[_0x6726('0x10')](_0x4919c5);};}exports[_0x6726('0xb')]=function(_0x1182b2,_0x1377f6){if(_0x1182b2['user'][_0x6726('0x11')]!==_0x6726('0x12'))throw new Error('Unauthorized');if(isNaN(Number(_0x1182b2[_0x6726('0x13')]['id'])))throw new Error('Invalid\x20user\x20setting\x20id');return db[_0x6726('0x14')][_0x6726('0x15')]({'where':{'id':_0x1182b2[_0x6726('0x13')]['id']}})[_0x6726('0xc')](handleEntityNotFound(_0x1377f6,null))['then'](saveUpdates(_0x1182b2[_0x6726('0x16')],null))[_0x6726('0xc')](respondWithResult(_0x1377f6,null))['catch'](handleError(_0x1377f6,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 7d11a00..37a9bd9 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 _0x81e0=['save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserSetting','setMaxListeners'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x81e0,0x1a0));var _0x081e=function(_0x397d27,_0x36083b){_0x397d27=_0x397d27-0x0;var _0x51e111=_0x81e0[_0x397d27];return _0x51e111;};'use strict';var EventEmitter=require(_0x081e('0x0'));var UserSetting=require(_0x081e('0x1'))['db'][_0x081e('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x081e('0x3')](0x0);var events={'afterCreate':_0x081e('0x4'),'afterUpdate':_0x081e('0x5'),'afterDestroy':'remove'};function emitEvent(_0x9ac6d){return function(_0x197e30,_0x277e55,_0x3b3e6e){UserSettingEvents['emit'](_0x9ac6d+':'+_0x197e30['id'],_0x197e30);UserSettingEvents[_0x081e('0x6')](_0x9ac6d,_0x197e30);_0x3b3e6e(null);};}for(var e in events){if(events[_0x081e('0x7')](e)){var event=events[e];UserSetting[_0x081e('0x8')](e,emitEvent(event));}}module[_0x081e('0x9')]=UserSettingEvents; \ No newline at end of file +var _0xe5ef=['save','update','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x454ac4,_0x45f797){var _0x143177=function(_0x5b28c9){while(--_0x5b28c9){_0x454ac4['push'](_0x454ac4['shift']());}};_0x143177(++_0x45f797);}(_0xe5ef,0x169));var _0xfe5e=function(_0x3014a4,_0x56b5aa){_0x3014a4=_0x3014a4-0x0;var _0x4ff3da=_0xe5ef[_0x3014a4];return _0x4ff3da;};'use strict';var EventEmitter=require(_0xfe5e('0x0'));var UserSetting=require(_0xfe5e('0x1'))['db']['UserSetting'];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0xfe5e('0x2')](0x0);var events={'afterCreate':_0xfe5e('0x3'),'afterUpdate':_0xfe5e('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2863e7){return function(_0x8c41b9,_0xcf6875,_0x258f06){UserSettingEvents['emit'](_0x2863e7+':'+_0x8c41b9['id'],_0x8c41b9);UserSettingEvents['emit'](_0x2863e7,_0x8c41b9);_0x258f06(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserSetting[_0xfe5e('0x5')](e,emitEvent(event));}}module[_0xfe5e('0x6')]=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 c402a6b..8a3d97a 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 _0x9086=['clientSideLoggingEnabledSince','./user-setting.attributes','exports','define','UserSetting','user_settings','clientSideLoggingEnabled'];(function(_0x110da3,_0x767d97){var _0x146473=function(_0x3a1eeb){while(--_0x3a1eeb){_0x110da3['push'](_0x110da3['shift']());}};_0x146473(++_0x767d97);}(_0x9086,0x10b));var _0x6908=function(_0x53fafb,_0x599411){_0x53fafb=_0x53fafb-0x0;var _0x661b0=_0x9086[_0x53fafb];return _0x661b0;};'use strict';var attributes=require(_0x6908('0x0'));module[_0x6908('0x1')]=function(_0x48787c){return _0x48787c[_0x6908('0x2')](_0x6908('0x3'),attributes,{'tableName':_0x6908('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x230e29){if(!_0x230e29[_0x6908('0x5')])_0x230e29[_0x6908('0x6')]=null;else if(_0x230e29['clientSideLoggingEnabledSince']===null)_0x230e29[_0x6908('0x6')]=new Date();}}});}; \ No newline at end of file +var _0x2cbd=['clientSideLoggingEnabledSince','./user-setting.attributes','exports','define','UserSetting','user_settings','clientSideLoggingEnabled'];(function(_0x179c4a,_0x10eb06){var _0x5d1879=function(_0x1f1dcd){while(--_0x1f1dcd){_0x179c4a['push'](_0x179c4a['shift']());}};_0x5d1879(++_0x10eb06);}(_0x2cbd,0x19e));var _0xd2cb=function(_0x4d79bc,_0x32c905){_0x4d79bc=_0x4d79bc-0x0;var _0x4b4760=_0x2cbd[_0x4d79bc];return _0x4b4760;};'use strict';var attributes=require(_0xd2cb('0x0'));module[_0xd2cb('0x1')]=function(_0x5dbb01){return _0x5dbb01[_0xd2cb('0x2')](_0xd2cb('0x3'),attributes,{'tableName':_0xd2cb('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4b1b3f){if(!_0x4b1b3f[_0xd2cb('0x5')])_0x4b1b3f[_0xd2cb('0x6')]=null;else if(_0x4b1b3f['clientSideLoggingEnabledSince']===null)_0x4b1b3f['clientSideLoggingEnabledSince']=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 4b74fc8..7b8a962 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 _0x2f25=['length','user-setting:','./user-setting.events','save','remove','update','emit','user-setting:update','user-setting:update:user-','UserId','register'];(function(_0x2976c6,_0x56e488){var _0x41139b=function(_0x433197){while(--_0x433197){_0x2976c6['push'](_0x2976c6['shift']());}};_0x41139b(++_0x56e488);}(_0x2f25,0x178));var _0x52f2=function(_0x565615,_0x4b37f7){_0x565615=_0x565615-0x0;var _0x293967=_0x2f25[_0x565615];return _0x293967;};'use strict';var UserSettingEvents=require(_0x52f2('0x0'));var events=[_0x52f2('0x1'),_0x52f2('0x2'),_0x52f2('0x3')];function createListener(_0x23bdf0,_0x23e953){return function(_0x51b334){_0x23e953[_0x52f2('0x4')](_0x23bdf0,_0x51b334);if(_0x23bdf0===_0x52f2('0x5')){_0x23e953[_0x52f2('0x4')](_0x52f2('0x6')+_0x51b334[_0x52f2('0x7')],_0x51b334);}};}exports[_0x52f2('0x8')]=function(_0x405039){for(var _0x221632=0x0,_0x18d8a9=events[_0x52f2('0x9')];_0x221632<_0x18d8a9;_0x221632++){var _0x28f459=events[_0x221632];var _0x226151=createListener(_0x52f2('0xa')+_0x28f459,_0x405039);UserSettingEvents['on'](_0x28f459,_0x226151);}}; \ No newline at end of file +var _0x733a=['user-setting:update','user-setting:update:user-','length','user-setting:','./user-setting.events','save','remove','update','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x733a,0x70));var _0xa733=function(_0x44946b,_0xf874ec){_0x44946b=_0x44946b-0x0;var _0x249bc4=_0x733a[_0x44946b];return _0x249bc4;};'use strict';var UserSettingEvents=require(_0xa733('0x0'));var events=[_0xa733('0x1'),_0xa733('0x2'),_0xa733('0x3')];function createListener(_0x27fcb3,_0x14abf1){return function(_0xde364c){_0x14abf1[_0xa733('0x4')](_0x27fcb3,_0xde364c);if(_0x27fcb3===_0xa733('0x5')){_0x14abf1['emit'](_0xa733('0x6')+_0xde364c['UserId'],_0xde364c);}};}exports['register']=function(_0x50e28c){for(var _0x3255ec=0x0,_0x41bbe2=events[_0xa733('0x7')];_0x3255ec<_0x41bbe2;_0x3255ec++){var _0x11bfd8=events[_0x3255ec];var _0x3d5261=createListener(_0xa733('0x8')+_0x11bfd8,_0x50e28c);UserSettingEvents['on'](_0x11bfd8,_0x3d5261);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 9fa9adf..bd1818d 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 _0xc080=['/:id/mail_accounts','addMailAccounts','addSmsAccounts','addChatWebsites','put','update','/:id/password','changePassword','removeQueues','delete','removeTeams','/:id','removeChatInteractions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeApiKey','/:id/messengerSoundNotification','messengerSoundNotification','exports','multer','util','express','Router','../../components/interaction/service','../../config/environment','./user.controller','get','/describe','isAuthenticated','describe','whoami','/presence','getPresence','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','/:id/recordings','getRecordings','/:id/screen_recordings','getChatInteractions','/:id/openchannel/interactions','/:id/mail/interactions','/:id/sms/interactions','getSmsInteractions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getLists','/:id/agents','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/openchannel_accounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','/:id/scheduled_calls','/:id/api_key','getApiKey','post','addContacts','create','bulkCreate','addQueues','diskStorage','join','root','server/files/images/','format','%s-%s','now','originalname','file','addAvatar','/:id/login','login','/:id/logout','logout','pause','/:id/unpause','unpause','addTeams','/:id/chat_interactions','/:id/mail_interactions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addFaxAccounts'];(function(_0x5ad89a,_0x4f50bb){var _0x3b37c2=function(_0x45ae60){while(--_0x45ae60){_0x5ad89a['push'](_0x5ad89a['shift']());}};_0x3b37c2(++_0x4f50bb);}(_0xc080,0x16b));var _0x0c08=function(_0x19cd90,_0x5ad1e8){_0x19cd90=_0x19cd90-0x0;var _0xb3cd4b=_0xc080[_0x19cd90];return _0xb3cd4b;};'use strict';var multer=require(_0x0c08('0x0'));var util=require(_0x0c08('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0c08('0x2'));var router=express[_0x0c08('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x0c08('0x4'));var config=require(_0x0c08('0x5'));var controller=require(_0x0c08('0x6'));router[_0x0c08('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x0c08('0x7')](_0x0c08('0x8'),auth[_0x0c08('0x9')](),controller[_0x0c08('0xa')]);router[_0x0c08('0x7')]('/whoami',auth['isAuthenticated'](),controller[_0x0c08('0xb')]);router[_0x0c08('0x7')](_0x0c08('0xc'),auth[_0x0c08('0x9')](),controller[_0x0c08('0xd')]);router[_0x0c08('0x7')]('/:id',auth[_0x0c08('0x9')](),controller['show']);router[_0x0c08('0x7')](_0x0c08('0xe'),controller[_0x0c08('0xf')]);router[_0x0c08('0x7')](_0x0c08('0x10'),auth[_0x0c08('0x9')](),controller[_0x0c08('0x11')]);router[_0x0c08('0x7')](_0x0c08('0x12'),auth[_0x0c08('0x9')](),controller['getContacts']);router[_0x0c08('0x7')](_0x0c08('0x13'),auth[_0x0c08('0x9')](),controller[_0x0c08('0x14')]);router[_0x0c08('0x7')](_0x0c08('0x15'),auth[_0x0c08('0x9')](),controller[_0x0c08('0x16')]);router[_0x0c08('0x7')](_0x0c08('0x17'),auth[_0x0c08('0x9')](),controller['getGroups']);router[_0x0c08('0x7')](_0x0c08('0x18'),auth[_0x0c08('0x9')](),controller[_0x0c08('0x19')]);router[_0x0c08('0x7')](_0x0c08('0x1a'),auth[_0x0c08('0x9')](),controller['getScreenRecordings']);router[_0x0c08('0x7')]('/:id/chat/interactions',auth[_0x0c08('0x9')](),controller[_0x0c08('0x1b')]);router['get'](_0x0c08('0x1c'),auth[_0x0c08('0x9')](),controller['getOpenchannelInteractions']);router[_0x0c08('0x7')](_0x0c08('0x1d'),auth[_0x0c08('0x9')](),controller['getMailInteractions']);router[_0x0c08('0x7')](_0x0c08('0x1e'),auth['isAuthenticated'](),controller[_0x0c08('0x1f')]);router[_0x0c08('0x7')]('/:id/fax/interactions',auth[_0x0c08('0x9')](),controller[_0x0c08('0x20')]);router[_0x0c08('0x7')](_0x0c08('0x21'),auth[_0x0c08('0x9')](),controller[_0x0c08('0x22')]);router[_0x0c08('0x7')](_0x0c08('0x23'),auth[_0x0c08('0x9')](),controller[_0x0c08('0x24')]);router[_0x0c08('0x7')](_0x0c08('0x25'),auth[_0x0c08('0x9')](),controller[_0x0c08('0x26')]);router[_0x0c08('0x7')](_0x0c08('0x27'),auth[_0x0c08('0x9')](),controller['getAgents']);router['get']('/:id/prefixes',auth['isAuthenticated'](),controller[_0x0c08('0x28')]);router['get'](_0x0c08('0x29'),auth[_0x0c08('0x9')](),controller[_0x0c08('0x2a')]);router['get']('/:id/mail_accounts',auth[_0x0c08('0x9')](),controller['getMailAccounts']);router[_0x0c08('0x7')](_0x0c08('0x2b'),auth[_0x0c08('0x9')](),controller['getOpenchannelAccounts']);router[_0x0c08('0x7')](_0x0c08('0x2c'),auth[_0x0c08('0x9')](),controller[_0x0c08('0x2d')]);router[_0x0c08('0x7')](_0x0c08('0x2e'),auth[_0x0c08('0x9')](),controller[_0x0c08('0x2f')]);router[_0x0c08('0x7')](_0x0c08('0x30'),auth['isAuthenticated'](),controller['getWhatsappAccounts']);router[_0x0c08('0x7')](_0x0c08('0x31'),auth[_0x0c08('0x9')](),controller['getScheduledCalls']);router[_0x0c08('0x7')](_0x0c08('0x32'),auth[_0x0c08('0x9')](),controller[_0x0c08('0x33')]);router[_0x0c08('0x34')](_0x0c08('0x12'),auth['isAuthenticated'](),controller[_0x0c08('0x35')]);router[_0x0c08('0x34')]('/',auth['isAuthenticated'](),controller[_0x0c08('0x36')]);router['post']('/create_many',auth['isAuthenticated'](),controller[_0x0c08('0x37')]);router[_0x0c08('0x34')](_0x0c08('0x13'),auth['isAuthenticated'](),controller[_0x0c08('0x38')]);var upload=multer({'storage':multer[_0x0c08('0x39')]({'destination':function(_0x5ae501,_0xc2bb74,_0x2e4c38){_0x2e4c38(null,path[_0x0c08('0x3a')](config[_0x0c08('0x3b')],_0x0c08('0x3c')));},'filename':function(_0x351103,_0x12a9fa,_0x426a3f){_0x426a3f(null,util[_0x0c08('0x3d')](_0x0c08('0x3e'),Date[_0x0c08('0x3f')](),_0x12a9fa[_0x0c08('0x40')]));}})});router[_0x0c08('0x34')](_0x0c08('0xe'),upload['single'](_0x0c08('0x41')),controller[_0x0c08('0x42')]);router[_0x0c08('0x34')](_0x0c08('0x43'),auth[_0x0c08('0x9')](),controller[_0x0c08('0x44')]);router[_0x0c08('0x34')](_0x0c08('0x45'),auth[_0x0c08('0x9')](),controller[_0x0c08('0x46')]);router[_0x0c08('0x34')]('/:id/pause',auth[_0x0c08('0x9')](),controller[_0x0c08('0x47')]);router['post'](_0x0c08('0x48'),auth[_0x0c08('0x9')](),controller[_0x0c08('0x49')]);router[_0x0c08('0x34')](_0x0c08('0x23'),auth[_0x0c08('0x9')](),controller[_0x0c08('0x4a')]);router[_0x0c08('0x34')](_0x0c08('0x4b'),auth[_0x0c08('0x9')](),controller['addChatInteractions']);router[_0x0c08('0x34')](_0x0c08('0x4c'),auth[_0x0c08('0x9')](),controller['addMailInteractions']);router[_0x0c08('0x34')](_0x0c08('0x4d'),auth[_0x0c08('0x9')](),controller[_0x0c08('0x4e')]);router[_0x0c08('0x34')](_0x0c08('0x4f'),auth[_0x0c08('0x9')](),controller[_0x0c08('0x50')]);router['post'](_0x0c08('0x51'),auth['isAuthenticated'](),controller[_0x0c08('0x52')]);router[_0x0c08('0x34')](_0x0c08('0x53'),auth[_0x0c08('0x9')](),controller['addWhatsappInteractions']);router[_0x0c08('0x34')](_0x0c08('0x29'),auth[_0x0c08('0x9')](),controller[_0x0c08('0x54')]);router[_0x0c08('0x34')](_0x0c08('0x55'),auth[_0x0c08('0x9')](),controller[_0x0c08('0x56')]);router[_0x0c08('0x34')](_0x0c08('0x2b'),auth[_0x0c08('0x9')](),controller['addOpenchannelAccounts']);router[_0x0c08('0x34')](_0x0c08('0x2c'),auth[_0x0c08('0x9')](),controller[_0x0c08('0x57')]);router[_0x0c08('0x34')](_0x0c08('0x2e'),auth[_0x0c08('0x9')](),controller[_0x0c08('0x58')]);router[_0x0c08('0x34')]('/:id/whatsapp_accounts',auth['isAuthenticated'](),controller['addWhatsappAccounts']);router[_0x0c08('0x34')]('/:id/api_key',auth[_0x0c08('0x9')](),controller['createApiKey']);router[_0x0c08('0x59')]('/:id',auth['isAuthenticated'](),controller[_0x0c08('0x5a')]);router['put'](_0x0c08('0x5b'),auth[_0x0c08('0x9')](),controller[_0x0c08('0x5c')]);router['delete'](_0x0c08('0x13'),auth[_0x0c08('0x9')](),controller[_0x0c08('0x5d')]);router[_0x0c08('0x5e')](_0x0c08('0x23'),auth[_0x0c08('0x9')](),controller[_0x0c08('0x5f')]);router[_0x0c08('0x5e')](_0x0c08('0x60'),auth[_0x0c08('0x9')](),controller['destroy']);router[_0x0c08('0x5e')]('/:id/chat_interactions',auth[_0x0c08('0x9')](),controller[_0x0c08('0x61')]);router['delete'](_0x0c08('0x4c'),auth[_0x0c08('0x9')](),controller[_0x0c08('0x62')]);router[_0x0c08('0x5e')](_0x0c08('0x4d'),auth[_0x0c08('0x9')](),controller[_0x0c08('0x63')]);router[_0x0c08('0x5e')](_0x0c08('0x4f'),auth[_0x0c08('0x9')](),controller[_0x0c08('0x64')]);router[_0x0c08('0x5e')]('/:id/openchannel_interactions',auth['isAuthenticated'](),controller[_0x0c08('0x65')]);router[_0x0c08('0x5e')]('/:id/whatsapp_interactions',auth[_0x0c08('0x9')](),controller[_0x0c08('0x66')]);router['delete'](_0x0c08('0x29'),auth[_0x0c08('0x9')](),controller[_0x0c08('0x67')]);router[_0x0c08('0x5e')]('/:id/mail_accounts',auth[_0x0c08('0x9')](),controller['removeMailAccounts']);router[_0x0c08('0x5e')](_0x0c08('0x2b'),auth[_0x0c08('0x9')](),controller[_0x0c08('0x68')]);router[_0x0c08('0x5e')](_0x0c08('0x2c'),auth[_0x0c08('0x9')](),controller[_0x0c08('0x69')]);router[_0x0c08('0x5e')](_0x0c08('0x2e'),auth['isAuthenticated'](),controller[_0x0c08('0x6a')]);router[_0x0c08('0x5e')](_0x0c08('0x30'),auth[_0x0c08('0x9')](),controller[_0x0c08('0x6b')]);router[_0x0c08('0x5e')](_0x0c08('0x32'),auth[_0x0c08('0x9')](),controller[_0x0c08('0x6c')]);router[_0x0c08('0x34')](_0x0c08('0x6d'),auth[_0x0c08('0x9')](),controller[_0x0c08('0x6e')]);module[_0x0c08('0x6f')]=router; \ No newline at end of file +var _0x6eaa=['/:id/queues','addQueues','diskStorage','join','server/files/images/','format','%s-%s','now','single','file','addAvatar','login','/:id/logout','pause','addTeams','addChatInteractions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addFaxAccounts','/:id/mail_accounts','addMailAccounts','addOpenchannelAccounts','/:id/sms_accounts','addSmsAccounts','addWhatsappAccounts','createApiKey','put','update','/:id/password','delete','removeQueues','removeTeams','destroy','/:id/chat_interactions','removeChatInteractions','/:id/mail_interactions','removeFaxInteractions','removeOpenchannelInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeChatWebsites','removeWhatsappAccounts','removeApiKey','/:id/messengerSoundNotification','messengerSoundNotification','exports','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./user.controller','get','isAuthenticated','/describe','/whoami','/presence','getPresence','/:id','show','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','getQueues','/:id/queues_rt','/:id/groups','/:id/recordings','getRecordings','/:id/screen_recordings','/:id/chat/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','/:id/fax/interactions','getFaxInteractions','getWhatsappInteractions','/:id/teams','getLists','/:id/agents','getAgents','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','create','/create_many','bulkCreate'];(function(_0x5e39ba,_0x3a45c3){var _0x1289b4=function(_0x277ef0){while(--_0x277ef0){_0x5e39ba['push'](_0x5e39ba['shift']());}};_0x1289b4(++_0x3a45c3);}(_0x6eaa,0x1ed));var _0xa6ea=function(_0x101a17,_0x5d047a){_0x101a17=_0x101a17-0x0;var _0x3b76ee=_0x6eaa[_0x101a17];return _0x3b76ee;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xa6ea('0x0'));var timeout=require('connect-timeout');var express=require(_0xa6ea('0x1'));var router=express[_0xa6ea('0x2')]();var fs_extra=require(_0xa6ea('0x3'));var auth=require(_0xa6ea('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xa6ea('0x5'));var controller=require(_0xa6ea('0x6'));router[_0xa6ea('0x7')]('/',auth[_0xa6ea('0x8')](),controller['index']);router[_0xa6ea('0x7')](_0xa6ea('0x9'),auth[_0xa6ea('0x8')](),controller['describe']);router[_0xa6ea('0x7')](_0xa6ea('0xa'),auth[_0xa6ea('0x8')](),controller['whoami']);router[_0xa6ea('0x7')](_0xa6ea('0xb'),auth['isAuthenticated'](),controller[_0xa6ea('0xc')]);router[_0xa6ea('0x7')](_0xa6ea('0xd'),auth[_0xa6ea('0x8')](),controller[_0xa6ea('0xe')]);router['get'](_0xa6ea('0xf'),controller[_0xa6ea('0x10')]);router[_0xa6ea('0x7')](_0xa6ea('0x11'),auth['isAuthenticated'](),controller[_0xa6ea('0x12')]);router[_0xa6ea('0x7')](_0xa6ea('0x13'),auth[_0xa6ea('0x8')](),controller[_0xa6ea('0x14')]);router[_0xa6ea('0x7')]('/:id/queues',auth['isAuthenticated'](),controller[_0xa6ea('0x15')]);router['get'](_0xa6ea('0x16'),auth[_0xa6ea('0x8')](),controller['getVoiceQueuesRt']);router[_0xa6ea('0x7')](_0xa6ea('0x17'),auth[_0xa6ea('0x8')](),controller['getGroups']);router['get'](_0xa6ea('0x18'),auth['isAuthenticated'](),controller[_0xa6ea('0x19')]);router[_0xa6ea('0x7')](_0xa6ea('0x1a'),auth[_0xa6ea('0x8')](),controller['getScreenRecordings']);router[_0xa6ea('0x7')](_0xa6ea('0x1b'),auth[_0xa6ea('0x8')](),controller['getChatInteractions']);router[_0xa6ea('0x7')]('/:id/openchannel/interactions',auth[_0xa6ea('0x8')](),controller[_0xa6ea('0x1c')]);router[_0xa6ea('0x7')](_0xa6ea('0x1d'),auth['isAuthenticated'](),controller[_0xa6ea('0x1e')]);router['get'](_0xa6ea('0x1f'),auth[_0xa6ea('0x8')](),controller['getSmsInteractions']);router[_0xa6ea('0x7')](_0xa6ea('0x20'),auth[_0xa6ea('0x8')](),controller[_0xa6ea('0x21')]);router[_0xa6ea('0x7')]('/:id/whatsapp/interactions',auth[_0xa6ea('0x8')](),controller[_0xa6ea('0x22')]);router[_0xa6ea('0x7')](_0xa6ea('0x23'),auth[_0xa6ea('0x8')](),controller['getTeams']);router['get']('/:id/lists',auth['isAuthenticated'](),controller[_0xa6ea('0x24')]);router[_0xa6ea('0x7')](_0xa6ea('0x25'),auth[_0xa6ea('0x8')](),controller[_0xa6ea('0x26')]);router['get']('/:id/prefixes',auth[_0xa6ea('0x8')](),controller[_0xa6ea('0x27')]);router[_0xa6ea('0x7')](_0xa6ea('0x28'),auth[_0xa6ea('0x8')](),controller[_0xa6ea('0x29')]);router[_0xa6ea('0x7')]('/:id/mail_accounts',auth['isAuthenticated'](),controller[_0xa6ea('0x2a')]);router['get'](_0xa6ea('0x2b'),auth[_0xa6ea('0x8')](),controller[_0xa6ea('0x2c')]);router[_0xa6ea('0x7')]('/:id/sms_accounts',auth[_0xa6ea('0x8')](),controller[_0xa6ea('0x2d')]);router[_0xa6ea('0x7')](_0xa6ea('0x2e'),auth[_0xa6ea('0x8')](),controller[_0xa6ea('0x2f')]);router['get'](_0xa6ea('0x30'),auth[_0xa6ea('0x8')](),controller['getWhatsappAccounts']);router[_0xa6ea('0x7')](_0xa6ea('0x31'),auth['isAuthenticated'](),controller[_0xa6ea('0x32')]);router['get'](_0xa6ea('0x33'),auth[_0xa6ea('0x8')](),controller[_0xa6ea('0x34')]);router[_0xa6ea('0x35')](_0xa6ea('0x13'),auth['isAuthenticated'](),controller['addContacts']);router['post']('/',auth[_0xa6ea('0x8')](),controller[_0xa6ea('0x36')]);router[_0xa6ea('0x35')](_0xa6ea('0x37'),auth[_0xa6ea('0x8')](),controller[_0xa6ea('0x38')]);router['post'](_0xa6ea('0x39'),auth[_0xa6ea('0x8')](),controller[_0xa6ea('0x3a')]);var upload=multer({'storage':multer[_0xa6ea('0x3b')]({'destination':function(_0x46f3cf,_0x4fbf99,_0x4aaf97){_0x4aaf97(null,path[_0xa6ea('0x3c')](config['root'],_0xa6ea('0x3d')));},'filename':function(_0x38ad84,_0x34f174,_0x47321d){_0x47321d(null,util[_0xa6ea('0x3e')](_0xa6ea('0x3f'),Date[_0xa6ea('0x40')](),_0x34f174['originalname']));}})});router[_0xa6ea('0x35')]('/:id/avatar',upload[_0xa6ea('0x41')](_0xa6ea('0x42')),controller[_0xa6ea('0x43')]);router['post']('/:id/login',auth[_0xa6ea('0x8')](),controller[_0xa6ea('0x44')]);router['post'](_0xa6ea('0x45'),auth[_0xa6ea('0x8')](),controller['logout']);router['post']('/:id/pause',auth[_0xa6ea('0x8')](),controller[_0xa6ea('0x46')]);router['post']('/:id/unpause',auth[_0xa6ea('0x8')](),controller['unpause']);router[_0xa6ea('0x35')]('/:id/teams',auth[_0xa6ea('0x8')](),controller[_0xa6ea('0x47')]);router[_0xa6ea('0x35')]('/:id/chat_interactions',auth[_0xa6ea('0x8')](),controller[_0xa6ea('0x48')]);router['post']('/:id/mail_interactions',auth[_0xa6ea('0x8')](),controller[_0xa6ea('0x49')]);router['post'](_0xa6ea('0x4a'),auth[_0xa6ea('0x8')](),controller[_0xa6ea('0x4b')]);router[_0xa6ea('0x35')](_0xa6ea('0x4c'),auth[_0xa6ea('0x8')](),controller[_0xa6ea('0x4d')]);router[_0xa6ea('0x35')](_0xa6ea('0x4e'),auth[_0xa6ea('0x8')](),controller[_0xa6ea('0x4f')]);router[_0xa6ea('0x35')](_0xa6ea('0x50'),auth[_0xa6ea('0x8')](),controller['addWhatsappInteractions']);router[_0xa6ea('0x35')]('/:id/fax_accounts',auth[_0xa6ea('0x8')](),controller[_0xa6ea('0x51')]);router[_0xa6ea('0x35')](_0xa6ea('0x52'),auth[_0xa6ea('0x8')](),controller[_0xa6ea('0x53')]);router[_0xa6ea('0x35')](_0xa6ea('0x2b'),auth[_0xa6ea('0x8')](),controller[_0xa6ea('0x54')]);router[_0xa6ea('0x35')](_0xa6ea('0x55'),auth[_0xa6ea('0x8')](),controller[_0xa6ea('0x56')]);router[_0xa6ea('0x35')](_0xa6ea('0x2e'),auth['isAuthenticated'](),controller['addChatWebsites']);router[_0xa6ea('0x35')](_0xa6ea('0x30'),auth[_0xa6ea('0x8')](),controller[_0xa6ea('0x57')]);router[_0xa6ea('0x35')](_0xa6ea('0x33'),auth[_0xa6ea('0x8')](),controller[_0xa6ea('0x58')]);router[_0xa6ea('0x59')](_0xa6ea('0xd'),auth[_0xa6ea('0x8')](),controller[_0xa6ea('0x5a')]);router[_0xa6ea('0x59')](_0xa6ea('0x5b'),auth[_0xa6ea('0x8')](),controller['changePassword']);router[_0xa6ea('0x5c')](_0xa6ea('0x39'),auth['isAuthenticated'](),controller[_0xa6ea('0x5d')]);router[_0xa6ea('0x5c')]('/:id/teams',auth[_0xa6ea('0x8')](),controller[_0xa6ea('0x5e')]);router[_0xa6ea('0x5c')]('/:id',auth[_0xa6ea('0x8')](),controller[_0xa6ea('0x5f')]);router[_0xa6ea('0x5c')](_0xa6ea('0x60'),auth[_0xa6ea('0x8')](),controller[_0xa6ea('0x61')]);router[_0xa6ea('0x5c')](_0xa6ea('0x62'),auth[_0xa6ea('0x8')](),controller['removeMailInteractions']);router[_0xa6ea('0x5c')](_0xa6ea('0x4a'),auth[_0xa6ea('0x8')](),controller[_0xa6ea('0x63')]);router[_0xa6ea('0x5c')]('/:id/sms_interactions',auth['isAuthenticated'](),controller['removeSmsInteractions']);router[_0xa6ea('0x5c')](_0xa6ea('0x4e'),auth[_0xa6ea('0x8')](),controller[_0xa6ea('0x64')]);router[_0xa6ea('0x5c')]('/:id/whatsapp_interactions',auth['isAuthenticated'](),controller['removeWhatsappInteractions']);router[_0xa6ea('0x5c')]('/:id/fax_accounts',auth[_0xa6ea('0x8')](),controller[_0xa6ea('0x65')]);router[_0xa6ea('0x5c')](_0xa6ea('0x52'),auth[_0xa6ea('0x8')](),controller[_0xa6ea('0x66')]);router['delete'](_0xa6ea('0x2b'),auth[_0xa6ea('0x8')](),controller[_0xa6ea('0x67')]);router[_0xa6ea('0x5c')]('/:id/sms_accounts',auth[_0xa6ea('0x8')](),controller['removeSmsAccounts']);router[_0xa6ea('0x5c')](_0xa6ea('0x2e'),auth[_0xa6ea('0x8')](),controller[_0xa6ea('0x68')]);router['delete'](_0xa6ea('0x30'),auth['isAuthenticated'](),controller[_0xa6ea('0x69')]);router['delete'](_0xa6ea('0x33'),auth[_0xa6ea('0x8')](),controller[_0xa6ea('0x6a')]);router[_0xa6ea('0x35')](_0xa6ea('0x6b'),auth[_0xa6ea('0x8')](),controller[_0xa6ea('0x6c')]);module[_0xa6ea('0x6d')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 98dac2e..494ae99 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 _0xf241=['from-sip','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','info','shortinfo','inband','yes','nonat','update','force_rport,comedia','join','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm','allow','split','insecure','\x22\x22\x20<>','always','refuse','originate','uac','uas','fingerprint','certificate','active','actpass','update,nonat','TEXT','showWebBar','wss','encryption','avpf','force_avp','icesupport','dtlsenable','dtlssetup','dtlsprivatekey','rtcp_mux','dtlscertfile','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','string','false','screenrecording','blocked','blockedAt','UNSIGNED','moment','util','lodash','exports','STRING','name','setDataValue','The\x20name\x20of\x20the\x20user','fullname','callerid','\x22%s\x22\x20<%s>','internal','email','toLowerCase','ENUM','user','telephone','local','INTEGER','getDataValue','DATE','BOOLEAN','dynamic','friend','peer'];(function(_0x59db2d,_0x5171dd){var _0x2bfe70=function(_0x4d141b){while(--_0x4d141b){_0x59db2d['push'](_0x59db2d['shift']());}};_0x2bfe70(++_0x5171dd);}(_0xf241,0x181));var _0x1f24=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xf241[_0x59ee6f];return _0x4c0979;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x1f24('0x0'));var util=require(_0x1f24('0x1'));var _=require(_0x1f24('0x2'));module[_0x1f24('0x3')]={'name':{'type':Sequelize[_0x1f24('0x4')],'allowNull':![],'unique':_0x1f24('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0xdc5e70){this[_0x1f24('0x6')](_0x1f24('0x5'),_0xdc5e70);this[_0x1f24('0x6')]('defaultuser',_0xdc5e70);},'comment':_0x1f24('0x7')},'fullname':{'type':Sequelize[_0x1f24('0x4')],'allowNull':![],'set':function(_0x2e53a1){this[_0x1f24('0x6')](_0x1f24('0x8'),_0x2e53a1);this[_0x1f24('0x6')](_0x1f24('0x9'),util['format'](_0x1f24('0xa'),_0x2e53a1,this['getDataValue'](_0x1f24('0xb'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':'email','validate':{'isEmail':!![]},'set':function(_0x39b92d){if(_0x39b92d){this[_0x1f24('0x6')](_0x1f24('0xc'),_0x39b92d[_0x1f24('0xd')]());}}},'role':{'type':Sequelize[_0x1f24('0xe')]('admin',_0x1f24('0xf'),'agent',_0x1f24('0x10')),'allowNull':![]},'password':{'type':Sequelize[_0x1f24('0x4')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x1f24('0x4')],'defaultValue':_0x1f24('0x11')},'internal':{'type':Sequelize[_0x1f24('0x12')](0xb),'allowNull':![],'unique':'internal','set':function(_0x223171){this[_0x1f24('0x6')](_0x1f24('0xb'),_0x223171);this[_0x1f24('0x6')]('accountcode',_0x223171);this[_0x1f24('0x6')](_0x1f24('0x9'),util['format'](_0x1f24('0xa'),this[_0x1f24('0x13')](_0x1f24('0x8')),_0x223171));}},'salt':{'type':Sequelize[_0x1f24('0x4')]},'phone':{'type':Sequelize[_0x1f24('0x4')]},'mobile':{'type':Sequelize[_0x1f24('0x4')]},'address':{'type':Sequelize[_0x1f24('0x4')]},'zipcode':{'type':Sequelize[_0x1f24('0x4')]},'userpic':{'type':Sequelize['STRING']},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x1f24('0x4')]},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x1f24('0x14')]},'voicePause':{'type':Sequelize[_0x1f24('0x15')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x1f24('0x15')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x1f24('0x15')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x1f24('0x15')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x1f24('0x15')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x1f24('0x15')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x1f24('0x15')],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0x1f24('0x14')]},'chatCapacity':{'type':Sequelize[_0x1f24('0x12')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x1f24('0x12')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x1f24('0x12')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x1f24('0x12')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x1f24('0x12')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x1f24('0x15')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x1f24('0x12')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x1f24('0x12')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x1f24('0x15')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x1f24('0x12')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x1f24('0x15')],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x1f24('0x16')},'ipaddr':{'type':Sequelize[_0x1f24('0x4')],'allowNull':!![]},'port':{'type':Sequelize[_0x1f24('0x12')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x1f24('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x1f24('0x4')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x1f24('0x12')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x1f24('0xe')](_0x1f24('0x17'),_0x1f24('0xf'),_0x1f24('0x18')),'allowNull':!![],'defaultValue':_0x1f24('0x17')},'context':{'type':Sequelize[_0x1f24('0x4')],'allowNull':!![],'defaultValue':_0x1f24('0x19')},'callingpres':{'type':Sequelize[_0x1f24('0xe')]('ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN',_0x1f24('0x1a'),_0x1f24('0x1b'),_0x1f24('0x1c'),_0x1f24('0x1d'),_0x1f24('0x1e'),_0x1f24('0x1f')),'allowNull':!![]},'deny':{'type':Sequelize[_0x1f24('0x4')],'allowNull':!![]},'permit':{'type':Sequelize[_0x1f24('0x4')],'allowNull':!![]},'secret':{'type':Sequelize[_0x1f24('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x1f24('0x4')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x1f24('0x4')],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x1f24('0x20'),'set':function(_0x497fbe){this[_0x1f24('0x6')](_0x1f24('0x21'),_0x497fbe?_0x497fbe['join'](','):null);},'get':function(){return this[_0x1f24('0x13')](_0x1f24('0x21'))?this['getDataValue'](_0x1f24('0x21'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x1f24('0xe')]('rfc2833',_0x1f24('0x22'),_0x1f24('0x23'),_0x1f24('0x24'),'auto'),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x1f24('0xe')](_0x1f24('0x25'),'no',_0x1f24('0x26'),_0x1f24('0x27'),'outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x1f24('0xe')](_0x1f24('0x25'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x1f24('0x4')],'allowNull':!![]},'directmediadeny':{'type':Sequelize['STRING'],'allowNull':!![]},'nat':{'type':Sequelize[_0x1f24('0x4')],'allowNull':!![],'defaultValue':_0x1f24('0x28'),'set':function(_0x126a38){this['setDataValue']('nat',_0x126a38?_0x126a38[_0x1f24('0x29')](','):null);},'get':function(){return this[_0x1f24('0x13')](_0x1f24('0x2a'))?this[_0x1f24('0x13')]('nat')['split'](','):null;},'comment':_0x1f24('0x2b')},'callgroup':{'type':Sequelize[_0x1f24('0x4')]},'namedcallgroup':{'type':Sequelize[_0x1f24('0x4')]},'pickupgroup':{'type':Sequelize[_0x1f24('0x4')]},'namedpickupgroup':{'type':Sequelize[_0x1f24('0x4')]},'language':{'type':Sequelize[_0x1f24('0x4')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x1f24('0x4')]},'disallow':{'type':Sequelize[_0x1f24('0x4')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize[_0x1f24('0x4')],'allowNull':![],'defaultValue':_0x1f24('0x2c'),'set':function(_0x4106db){this[_0x1f24('0x6')](_0x1f24('0x2d'),_0x4106db?_0x4106db[_0x1f24('0x29')](';'):'ulaw;alaw;gsm');},'get':function(){return this['getDataValue'](_0x1f24('0x2d'))?this[_0x1f24('0x13')](_0x1f24('0x2d'))[_0x1f24('0x2e')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0x1f24('0xe')](_0x1f24('0x25'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x1f24('0x4')],'allowNull':!![],'set':function(_0xe68404){this[_0x1f24('0x6')](_0x1f24('0x2f'),_0xe68404?_0xe68404[_0x1f24('0x29')](','):null);},'get':function(){return this['getDataValue'](_0x1f24('0x2f'))?this[_0x1f24('0x13')]('insecure')[_0x1f24('0x2e')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x1f24('0xe')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x1f24('0xe')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM']('yes','no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x1f24('0xe')](_0x1f24('0x25'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0x1f24('0x25'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x1f24('0x12')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize[_0x1f24('0x4')],'allowNull':!![],'defaultValue':_0x1f24('0x30')},'amaflags':{'type':Sequelize[_0x1f24('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x1f24('0xe')](_0x1f24('0x25'),'no'),'allowNull':!![],'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x1f24('0x12')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x1f24('0xe')](_0x1f24('0x25'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x1f24('0xe')](_0x1f24('0x25'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x1f24('0xe')](_0x1f24('0x25'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x1f24('0xe')](_0x1f24('0x25'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x1f24('0x4')],'allowNull':!![]},'template':{'type':Sequelize[_0x1f24('0x4')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x1f24('0xe')]('yes','no',_0x1f24('0x31')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x1f24('0x12')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x1f24('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x1f24('0xe')]('accept',_0x1f24('0x32'),_0x1f24('0x33')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x1f24('0x12')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x1f24('0x12')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x1f24('0xe')](_0x1f24('0x34'),'uas'),'allowNull':!![],'defaultValue':_0x1f24('0x35')},'t38pt_usertpsource':{'type':Sequelize[_0x1f24('0x4')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x1f24('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x1f24('0x4')],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize[_0x1f24('0xe')](_0x1f24('0x25'),'no'),'allowNull':!![],'defaultValue':_0x1f24('0x25')},'keepalive':{'type':Sequelize[_0x1f24('0x12')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x1f24('0x4')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x1f24('0x12')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x1f24('0x12')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x1f24('0xe')](_0x1f24('0x25'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING'],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize[_0x1f24('0x12')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x1f24('0x12')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x1f24('0x12')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x1f24('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x1f24('0x4')],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x1f24('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x1f24('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x1f24('0x12')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x1f24('0xe')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x1f24('0xe')](_0x1f24('0x25'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x1f24('0xe')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x1f24('0xe')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x1f24('0xe')](_0x1f24('0x25'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x1f24('0xe')](_0x1f24('0x25'),'no',_0x1f24('0x36'),_0x1f24('0x37')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x1f24('0x4')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x1f24('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x1f24('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x1f24('0xe')](_0x1f24('0x38'),'passive',_0x1f24('0x39')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x1f24('0xe')](_0x1f24('0x25'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x1f24('0x4')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x1f24('0x4')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x1f24('0x12')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0x1f24('0x25'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x1f24('0xe')](_0x1f24('0x25'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize['STRING'],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x1f24('0x4')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x1f24('0x4')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x1f24('0xe')]('yes','no','nonat',_0x1f24('0x27'),_0x1f24('0x3a')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x1f24('0x4')]},'resetPasswordExpires':{'type':Sequelize[_0x1f24('0x14')]},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x1f24('0x3b')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x5916b0){this[_0x1f24('0x6')](_0x1f24('0x3c'),_0x5916b0);var _0x9d1dfa=this['get']({'plain':!![]});switch(_0x5916b0){case 0x0:case 0x1:var _0x16231b=_0x9d1dfa[_0x1f24('0x21')]?_['isArray'](_0x9d1dfa[_0x1f24('0x21')])?_0x9d1dfa['transport'][_0x1f24('0x29')]():_0x9d1dfa[_0x1f24('0x21')]:_0x1f24('0x20');if(_0x16231b===_0x1f24('0x3d')){_0x16231b=_0x1f24('0x20');}this['setDataValue']('transport',_0x16231b);this[_0x1f24('0x6')](_0x1f24('0x3e'),'no');this[_0x1f24('0x6')](_0x1f24('0x3f'),null);this['setDataValue'](_0x1f24('0x40'),null);this[_0x1f24('0x6')](_0x1f24('0x41'),null);this[_0x1f24('0x6')](_0x1f24('0x42'),null);this[_0x1f24('0x6')]('dtlsverify',null);this[_0x1f24('0x6')](_0x1f24('0x43'),null);this[_0x1f24('0x6')]('dtlscertfile',null);this[_0x1f24('0x6')](_0x1f24('0x44'),null);this[_0x1f24('0x6')](_0x1f24('0x45'),'no');break;case 0x2:this[_0x1f24('0x6')](_0x1f24('0x21'),'wss');this[_0x1f24('0x6')](_0x1f24('0x3e'),_0x1f24('0x25'));this[_0x1f24('0x6')]('avpf',_0x1f24('0x25'));this['setDataValue'](_0x1f24('0x40'),_0x1f24('0x25'));this[_0x1f24('0x6')](_0x1f24('0x41'),_0x1f24('0x25'));this['setDataValue'](_0x1f24('0x42'),'yes');this['setDataValue']('dtlsverify','no');this['setDataValue'](_0x1f24('0x43'),_0x1f24('0x39'));this['setDataValue']('dtlscertfile',_0x9d1dfa[_0x1f24('0x46')]||_0x1f24('0x47'));this[_0x1f24('0x6')](_0x1f24('0x44'),_0x9d1dfa[_0x1f24('0x44')]||_0x1f24('0x48'));this[_0x1f24('0x6')](_0x1f24('0x45'),_0x1f24('0x25'));break;default:}}},'permissions':{'type':Sequelize[_0x1f24('0x3b')],'set':function(_0x4c8a5c){this[_0x1f24('0x6')](_0x1f24('0x49'),_0x4c8a5c?_0x4c8a5c[_0x1f24('0x29')](','):[]);},'get':function(){return this[_0x1f24('0x13')](_0x1f24('0x49'))?_[_0x1f24('0x4a')](this[_0x1f24('0x13')](_0x1f24('0x49'))[_0x1f24('0x2e')](','),function(_0xfa3508){return parseInt(_0xfa3508,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x1f24('0x4')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x1f24('0x4')]},'phoneBarBusyNumber':{'type':Sequelize[_0x1f24('0x4')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x1f24('0x15')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x1f24('0x15')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x1f24('0x15')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x1f24('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x1f24('0x12')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x1f24('0xe')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x1f24('0x15')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x1f24('0x4')]},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x1f24('0x15')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x1f24('0x4b')],'get':function(){return this[_0x1f24('0x13')]('phoneBarEnableScreenRecordingByAgent')?this[_0x1f24('0x13')]('phoneBarEnableScreenRecordingByAgent'):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x1f24('0x15')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x1f24('0x15')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x1f24('0x15')],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x1f24('0x15')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x1f24('0x15')],'defaultValue':![],'set':function(_0x15656c){if(typeof _0x15656c===_0x1f24('0x4c')){var _0x5a3909=_0x15656c==='1'?!![]:_0x15656c==='0'?![]:_0x15656c==='true'?!![]:_0x15656c===_0x1f24('0x4d')?![]:![];this[_0x1f24('0x6')](_0x1f24('0x4e'),_0x5a3909);}else{this[_0x1f24('0x6')](_0x1f24('0x4e'),_0x15656c);}}},'blocked':{'type':Sequelize[_0x1f24('0x15')],'defaultValue':![],'set':function(_0x35d5ab){this['setDataValue'](_0x1f24('0x4f'),_0x35d5ab);if(_0x35d5ab===!![]){this['setDataValue'](_0x1f24('0x50'),moment());this[_0x1f24('0x6')]('loginAttempts',0x0);}else{this[_0x1f24('0x6')](_0x1f24('0x50'),null);}}},'blockedAt':{'type':Sequelize[_0x1f24('0x14')],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x1f24('0x15')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x1f24('0x15')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x1f24('0x12')](0x5)[_0x1f24('0x51')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x1f24('0x15')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x1f24('0x15')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x1f24('0x15')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x1f24('0x15')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x1f24('0x15')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x1f24('0x12')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x1f24('0x15')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x1f24('0x15')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x1f24('0x12')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x1f24('0x12')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x1f24('0x15')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x1f24('0x12')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x1f24('0x15')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0x1f24('0x15')],'defaultValue':![]}}; \ No newline at end of file +var _0x7872=['friend','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','shortinfo','auto','rfc2833','yes','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','always','accept','refuse','originate','uac','uas','active','passive','actpass','nonat','update,nonat','TEXT','get','isArray','avpf','force_avp','dtlsenable','dtlsverify','dtlscertfile','dtlsprivatekey','wss','encryption','icesupport','dtlssetup','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','rtcp_mux','permissions','map','string','true','false','screenrecording','blocked','blockedAt','moment','util','lodash','exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','format','\x22%s\x22\x20<%s>','email','toLowerCase','ENUM','admin','agent','telephone','local','internal','callerid','BOOLEAN','DATE','INTEGER','user','peer'];(function(_0x4f6f84,_0x31e197){var _0x20d989=function(_0x34db70){while(--_0x34db70){_0x4f6f84['push'](_0x4f6f84['shift']());}};_0x20d989(++_0x31e197);}(_0x7872,0x1ad));var _0x2787=function(_0x4d3b13,_0x543c1d){_0x4d3b13=_0x4d3b13-0x0;var _0x443051=_0x7872[_0x4d3b13];return _0x443051;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x2787('0x0'));var util=require(_0x2787('0x1'));var _=require(_0x2787('0x2'));module[_0x2787('0x3')]={'name':{'type':Sequelize[_0x2787('0x4')],'allowNull':![],'unique':_0x2787('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x29f8db){this[_0x2787('0x6')]('name',_0x29f8db);this[_0x2787('0x6')](_0x2787('0x7'),_0x29f8db);},'comment':_0x2787('0x8')},'fullname':{'type':Sequelize[_0x2787('0x4')],'allowNull':![],'set':function(_0x5e1ddc){this[_0x2787('0x6')](_0x2787('0x9'),_0x5e1ddc);this[_0x2787('0x6')]('callerid',util[_0x2787('0xa')](_0x2787('0xb'),_0x5e1ddc,this['getDataValue']('internal')));}},'alias':{'type':Sequelize[_0x2787('0x4')]},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x2787('0xc'),'validate':{'isEmail':!![]},'set':function(_0x3a7c5f){if(_0x3a7c5f){this[_0x2787('0x6')](_0x2787('0xc'),_0x3a7c5f[_0x2787('0xd')]());}}},'role':{'type':Sequelize[_0x2787('0xe')](_0x2787('0xf'),'user',_0x2787('0x10'),_0x2787('0x11')),'allowNull':![]},'password':{'type':Sequelize[_0x2787('0x4')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':_0x2787('0x12')},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':_0x2787('0x13'),'set':function(_0x3722b6){this['setDataValue'](_0x2787('0x13'),_0x3722b6);this['setDataValue']('accountcode',_0x3722b6);this[_0x2787('0x6')](_0x2787('0x14'),util['format']('\x22%s\x22\x20<%s>',this['getDataValue']('fullname'),_0x3722b6));}},'salt':{'type':Sequelize[_0x2787('0x4')]},'phone':{'type':Sequelize[_0x2787('0x4')]},'mobile':{'type':Sequelize[_0x2787('0x4')]},'address':{'type':Sequelize[_0x2787('0x4')]},'zipcode':{'type':Sequelize[_0x2787('0x4')]},'userpic':{'type':Sequelize[_0x2787('0x4')]},'city':{'type':Sequelize[_0x2787('0x4')]},'country':{'type':Sequelize[_0x2787('0x4')]},'online':{'type':Sequelize[_0x2787('0x15')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x2787('0x15')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x2787('0x15')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x2787('0x15')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x2787('0x15')],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x2787('0x15')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x2787('0x4')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0x2787('0x16')]},'chatCapacity':{'type':Sequelize[_0x2787('0x17')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x2787('0x17')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x2787('0x17')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x2787('0x17')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x2787('0x15')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x2787('0x15')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x2787('0x17')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x2787('0x15')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x2787('0x17')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x2787('0x15')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x2787('0x15')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x2787('0x15')],'defaultValue':![]},'description':{'type':Sequelize[_0x2787('0x4')],'allowNull':!![]},'host':{'type':Sequelize[_0x2787('0x4')],'allowNull':!![],'defaultValue':'dynamic'},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize[_0x2787('0x17')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x2787('0x17')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x2787('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x2787('0x4')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x2787('0x4')],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize['ENUM']('friend',_0x2787('0x18'),_0x2787('0x19')),'allowNull':!![],'defaultValue':_0x2787('0x1a')},'context':{'type':Sequelize[_0x2787('0x4')],'allowNull':!![],'defaultValue':_0x2787('0x1b')},'callingpres':{'type':Sequelize['ENUM'](_0x2787('0x1c'),_0x2787('0x1d'),'ALLOWED_FAILED_SCREEN',_0x2787('0x1e'),'PROHIB_NOT_SCREENED',_0x2787('0x1f'),_0x2787('0x20'),_0x2787('0x21')),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize[_0x2787('0x4')],'allowNull':!![]},'secret':{'type':Sequelize[_0x2787('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x2787('0x4')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x2787('0x4')],'allowNull':!![]},'transport':{'type':Sequelize[_0x2787('0x4')],'allowNull':!![],'defaultValue':_0x2787('0x22'),'set':function(_0x4ab24b){this[_0x2787('0x6')](_0x2787('0x23'),_0x4ab24b?_0x4ab24b[_0x2787('0x24')](','):null);},'get':function(){return this[_0x2787('0x25')](_0x2787('0x23'))?this[_0x2787('0x25')](_0x2787('0x23'))[_0x2787('0x26')](','):null;},'comment':_0x2787('0x27')},'dtmfmode':{'type':Sequelize[_0x2787('0xe')]('rfc2833','info',_0x2787('0x28'),'inband',_0x2787('0x29')),'allowNull':!![],'defaultValue':_0x2787('0x2a')},'directmedia':{'type':Sequelize[_0x2787('0xe')](_0x2787('0x2b'),'no','nonat',_0x2787('0x2c'),_0x2787('0x2d')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x2787('0xe')](_0x2787('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x2787('0x4')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x2787('0x4')],'allowNull':!![]},'nat':{'type':Sequelize[_0x2787('0x4')],'allowNull':!![],'defaultValue':_0x2787('0x2e'),'set':function(_0x519a55){this['setDataValue'](_0x2787('0x2f'),_0x519a55?_0x519a55['join'](','):null);},'get':function(){return this[_0x2787('0x25')](_0x2787('0x2f'))?this[_0x2787('0x25')](_0x2787('0x2f'))[_0x2787('0x26')](','):null;},'comment':_0x2787('0x30')},'callgroup':{'type':Sequelize[_0x2787('0x4')]},'namedcallgroup':{'type':Sequelize[_0x2787('0x4')]},'pickupgroup':{'type':Sequelize[_0x2787('0x4')]},'namedpickupgroup':{'type':Sequelize[_0x2787('0x4')]},'language':{'type':Sequelize[_0x2787('0x4')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x2787('0x4')]},'disallow':{'type':Sequelize[_0x2787('0x4')],'allowNull':![],'defaultValue':_0x2787('0x31')},'allow':{'type':Sequelize[_0x2787('0x4')],'allowNull':![],'defaultValue':_0x2787('0x32'),'set':function(_0x3aff4f){this[_0x2787('0x6')](_0x2787('0x33'),_0x3aff4f?_0x3aff4f[_0x2787('0x24')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x2787('0x25')](_0x2787('0x33'))?this[_0x2787('0x25')]('allow')[_0x2787('0x26')](';'):null;},'comment':_0x2787('0x34')},'autoframing':{'type':Sequelize[_0x2787('0xe')](_0x2787('0x2b'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x2787('0x4')],'allowNull':!![],'set':function(_0x2948b5){this[_0x2787('0x6')](_0x2787('0x35'),_0x2948b5?_0x2948b5[_0x2787('0x24')](','):null);},'get':function(){return this['getDataValue'](_0x2787('0x35'))?this[_0x2787('0x25')](_0x2787('0x35'))[_0x2787('0x26')](','):null;},'comment':_0x2787('0x36')},'trustrpid':{'type':Sequelize[_0x2787('0xe')](_0x2787('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0x2787('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x2787('0xe')](_0x2787('0x2b'),'no',_0x2787('0x37')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x2787('0xe')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0x2787('0x2b'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x2787('0x17')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x2787('0x4')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x2787('0x4')],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0x2787('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x2787('0xe')]('yes','no'),'allowNull':!![],'defaultValue':_0x2787('0x2b')},'busylevel':{'type':Sequelize[_0x2787('0x17')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x2787('0xe')](_0x2787('0x2b'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0x2787('0x2b'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x2787('0xe')](_0x2787('0x2b'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x2787('0xe')]('yes','no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize['STRING'],'allowNull':!![]},'template':{'type':Sequelize[_0x2787('0x4')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x2787('0xe')](_0x2787('0x2b'),'no',_0x2787('0x38')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x2787('0x17')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x2787('0xe')]('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x2787('0xe')](_0x2787('0x39'),_0x2787('0x3a'),_0x2787('0x3b')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x2787('0x17')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x2787('0x17')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x2787('0xe')](_0x2787('0x3c'),_0x2787('0x3d')),'allowNull':!![],'defaultValue':_0x2787('0x3d')},'t38pt_usertpsource':{'type':Sequelize[_0x2787('0x4')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x2787('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize['STRING'],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize[_0x2787('0xe')](_0x2787('0x2b'),'no'),'allowNull':!![],'defaultValue':_0x2787('0x2b')},'keepalive':{'type':Sequelize[_0x2787('0x17')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x2787('0x4')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x2787('0x17')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x2787('0x17')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x2787('0x17')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x2787('0xe')](_0x2787('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x2787('0x4')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x2787('0x4')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x2787('0x17')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x2787('0x17')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x2787('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x2787('0x4')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x2787('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x2787('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x2787('0x17')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x2787('0xe')](_0x2787('0x2b'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x2787('0xe')](_0x2787('0x2b'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x2787('0xe')](_0x2787('0x2b'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x2787('0xe')](_0x2787('0x2b'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x2787('0xe')](_0x2787('0x2b'),'no','fingerprint','certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x2787('0x17')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x2787('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x2787('0x4')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x2787('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x2787('0xe')](_0x2787('0x3e'),_0x2787('0x3f'),_0x2787('0x40')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x2787('0x4')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM'](_0x2787('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x2787('0x4')],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x2787('0xe')]('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x2787('0xe')]('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x2787('0x4')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x2787('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x2787('0x4')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x2787('0xe')](_0x2787('0x2b'),'no',_0x2787('0x41'),_0x2787('0x2c'),_0x2787('0x42')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x2787('0x4')]},'resetPasswordExpires':{'type':Sequelize[_0x2787('0x16')]},'passwordResetAt':{'type':Sequelize[_0x2787('0x16')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x2787('0x43')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x494bbf){this[_0x2787('0x6')]('showWebBar',_0x494bbf);var _0x2d99a2=this[_0x2787('0x44')]({'plain':!![]});switch(_0x494bbf){case 0x0:case 0x1:var _0x3ac99f=_0x2d99a2['transport']?_[_0x2787('0x45')](_0x2d99a2[_0x2787('0x23')])?_0x2d99a2['transport'][_0x2787('0x24')]():_0x2d99a2['transport']:_0x2787('0x22');if(_0x3ac99f==='wss'){_0x3ac99f=_0x2787('0x22');}this[_0x2787('0x6')](_0x2787('0x23'),_0x3ac99f);this[_0x2787('0x6')]('encryption','no');this[_0x2787('0x6')](_0x2787('0x46'),null);this[_0x2787('0x6')](_0x2787('0x47'),null);this['setDataValue']('icesupport',null);this[_0x2787('0x6')](_0x2787('0x48'),null);this[_0x2787('0x6')](_0x2787('0x49'),null);this[_0x2787('0x6')]('dtlssetup',null);this['setDataValue'](_0x2787('0x4a'),null);this[_0x2787('0x6')](_0x2787('0x4b'),null);this[_0x2787('0x6')]('rtcp_mux','no');break;case 0x2:this[_0x2787('0x6')](_0x2787('0x23'),_0x2787('0x4c'));this[_0x2787('0x6')](_0x2787('0x4d'),'yes');this['setDataValue'](_0x2787('0x46'),_0x2787('0x2b'));this[_0x2787('0x6')]('force_avp',_0x2787('0x2b'));this['setDataValue'](_0x2787('0x4e'),_0x2787('0x2b'));this['setDataValue']('dtlsenable',_0x2787('0x2b'));this[_0x2787('0x6')]('dtlsverify','no');this[_0x2787('0x6')](_0x2787('0x4f'),_0x2787('0x40'));this[_0x2787('0x6')](_0x2787('0x4a'),_0x2d99a2[_0x2787('0x4a')]||_0x2787('0x50'));this['setDataValue'](_0x2787('0x4b'),_0x2d99a2[_0x2787('0x4b')]||_0x2787('0x51'));this['setDataValue'](_0x2787('0x52'),_0x2787('0x2b'));break;default:}}},'permissions':{'type':Sequelize[_0x2787('0x43')],'set':function(_0x23ae73){this[_0x2787('0x6')](_0x2787('0x53'),_0x23ae73?_0x23ae73[_0x2787('0x24')](','):[]);},'get':function(){return this[_0x2787('0x25')](_0x2787('0x53'))?_[_0x2787('0x54')](this['getDataValue'](_0x2787('0x53'))['split'](','),function(_0x8c41a4){return parseInt(_0x8c41a4,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x2787('0x4')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x2787('0x4')]},'phoneBarBusyNumber':{'type':Sequelize[_0x2787('0x4')]},'phoneBarUnconditional':{'type':Sequelize[_0x2787('0x15')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x2787('0x15')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x2787('0x15')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x2787('0x15')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x2787('0x15')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x2787('0x17')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x2787('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x2787('0x17')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x2787('0xe')](_0x2787('0x2b'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x2787('0x15')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x2787('0x4')]},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x2787('0x25')]('phoneBarEnableScreenRecordingByAgent')?this[_0x2787('0x25')]('phoneBarEnableScreenRecordingByAgent'):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x2787('0x15')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x2787('0x15')],'defaultValue':![]},'interface':{'type':Sequelize[_0x2787('0x4')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x2787('0x15')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x2787('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x2787('0x4')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x2787('0x15')],'defaultValue':![],'set':function(_0xc5a8bb){if(typeof _0xc5a8bb===_0x2787('0x55')){var _0x4f715e=_0xc5a8bb==='1'?!![]:_0xc5a8bb==='0'?![]:_0xc5a8bb===_0x2787('0x56')?!![]:_0xc5a8bb===_0x2787('0x57')?![]:![];this[_0x2787('0x6')]('screenrecording',_0x4f715e);}else{this[_0x2787('0x6')](_0x2787('0x58'),_0xc5a8bb);}}},'blocked':{'type':Sequelize[_0x2787('0x15')],'defaultValue':![],'set':function(_0x179832){this[_0x2787('0x6')](_0x2787('0x59'),_0x179832);if(_0x179832===!![]){this[_0x2787('0x6')](_0x2787('0x5a'),moment());this[_0x2787('0x6')]('loginAttempts',0x0);}else{this['setDataValue']('blockedAt',null);}}},'blockedAt':{'type':Sequelize[_0x2787('0x16')],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x2787('0x15')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x2787('0x15')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x2787('0x17')](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x2787('0x15')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x2787('0x15')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x2787('0x15')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x2787('0x15')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x2787('0x15')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x2787('0x15')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x2787('0x15')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x2787('0x17')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x2787('0x15')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x2787('0x17')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x2787('0x15')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x2787('0x15')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x2787('0x15')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x2787('0x17')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0x2787('0x15')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 50a8ccf..a2e6863 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 _0xa3d9=['offline','voiceStatus','unavailable','busy','slice','charAt','field','ui.','InteractionId','ui.createdAt','_interactions','ui.UserId\x20=\x20?','OpenTabs','enabled','moment','util','lodash','squel','jayson/promise','../../components/contacts','../../components/realtime/agents','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../errors/api','APIBadRequestError','APINotFoundError','APIForbiddenrror','handleError','../../mysqldb','socket.io-emitter','redis','register','defaults','localhost','http','end','status','json','offset','undefined','limit','count','set','Content-Range','request','then','User,\x20%s,\x20%s','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','update','role','agent','userNotification:recalc:','destroy','get','Users','user','Agents','Telephones','telephone','filter','ignore','map','value','find','name','UserProfileResource','sendStatus','stack','send','User','rawAttributes','fieldName','type','key','salt','previousPasswords','resetPasswordToken','resetPasswordExpires','md5secret','includes','index','getOptions','where','query','userSetting','include','attributes','push','findAll','rows','length','chat','dataValues','sms','fax','mail','openchannel','whatsapp','all','catch','show','includeAll','true','UserSetting','options','body','params','describe','addContacts','internal','Setting','securePassword','validatePasswordPattern','password','isNil','min_internal','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','SELECT','from','voicemail','VoiceMail','email','permissions','101','103','110','104','106','107','109','100','111','115','create','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','admin','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','checkUserLimits','settingsEnabled','userProfileId','UserProfileSection','bulkCreate','Unauthorized','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','isEmpty','autoAssociation','changePassword','newPassword','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','oldPassword','Sequelize','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','enforcePasswordHistory','passwordHistoryLimit','validatePasswordHistory','channel','loginInPause','voicePause','isValidChannel','Unknown\x20channel','add','capitalize','toLowerCase','Queues','ids','penalty','spread','emit','Queue:save','voice','VoiceQueue','online','interface','SIP/%s','removeQueues','remove','isArray','QueueId','Queue:remove','UserVoiceQueueRt','addAvatar','file','filename','getAvatar','root','server/files/images/logos/default_profile.png','userpic','download','existsSync','join','server/files/images/','getOpenTabs','ChatOpenTabs','createdAt','FAX','OpenchannelOpenTabs','OPENCHANNEL','MailOpenTabs','MAIL','SmsOpenTabs','WHATSAPP','concat','getContacts','format','User\x20with\x20id\x20%s\x20not\x20found','CmList','Tag','Tags','color','tag','getQueues','model','keys','intersection','fields','filters','merge','Queue','Unknown\x20role','hasOwnProperty','nolimit','order','sort','pick','getVoiceQueuesRt','getGroups','ChatGroup','getRecordings','VoiceRecording','getScreenRecordings','UserId','ScreenRecording','getChatInteractions','ChatInteraction','OpenchannelInteraction','getOpenchannelInteractions','getMailInteractions','MailInteraction','getSmsInteractions','SmsInteraction','FaxInteraction','getWhatsappInteractions','WhatsappInteraction','login','mobile','intrf','user:%s','user:forcelogout','headers','x-forwarded-for','connection','remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','upsert','forEach','getChannels','YYYY-MM-DD\x20HH:mm:ss','LOGIN','device','PAUSE','LOGININPAUSE','MemberReport','resolve','pause','QueuePause','DEFAULT\x20PAUSE','mailPause','faxPause','openchannelPause','smsPause','whatsappPause','pauseType','lastPauseAt','unpause','getTeams','Team','addTeams','sequelize','flattenDeep','addAgent','getDataValue','TeamVoicePrefix','UserVoicePrefix','removeTeams','Query\x20parameter\x20\x27ids\x27\x20is\x20required','transaction','getAssociatedQueues','removeAgent','Voice','VoicePrefixId','getLists','getAgents','values','You\x20can\x27t\x20delete\x20yourself','CmHopper','omit','user_has_chat_interactions:save','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','getFaxAccounts','FaxAccount','removeFaxAccounts','MailAccount','getMailAccounts','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','addSmsAccounts','removeSmsAccounts','ChatWebsite','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','$or','$gt','$gte','$lt','$lte','$ne','$eq','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contains','$contained','$any','firstName','lastName','CmContact','Contact','getApiKey','retrieveApiKey','No\x20API\x20access\x20key\x20found!','generateApiKey','iat','nonce','token','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','apiKeyIat','API\x20key\x20not\x20available','whoami','getUserSetting','getPresence','idle','unknown','ringing','queues','inbound','flatten','toString','lower','col','asc','substring','uniqBy','orderBy','getRealtimeAgents'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xa3d9,0x1a2));var _0x9a3d=function(_0x20b18f,_0xf29421){_0x20b18f=_0x20b18f-0x0;var _0x510ea8=_0xa3d9[_0x20b18f];return _0x510ea8;};'use strict';var moment=require(_0x9a3d('0x0'));var util=require(_0x9a3d('0x1'));var path=require('path');var fs=require('fs');var _=require(_0x9a3d('0x2'));var squel=require(_0x9a3d('0x3'));var Redis=require('ioredis');var jayson=require(_0x9a3d('0x4'));var authService=require('../../components/auth/service');var contacts=require(_0x9a3d('0x5'));var qs=require('../../components/parsers/qs');var rta=require(_0x9a3d('0x6'));var logger=require(_0x9a3d('0x7'))('api');var utils=require(_0x9a3d('0x8'));var config=require(_0x9a3d('0x9'));var licenseUtil=require(_0x9a3d('0xa'));var APIBadRequestError=require(_0x9a3d('0xb'))[_0x9a3d('0xc')];var APINotFoundError=require(_0x9a3d('0xb'))[_0x9a3d('0xd')];var APIForbiddenError=require(_0x9a3d('0xb'))[_0x9a3d('0xe')];var APIHandleError=require(_0x9a3d('0xb'))[_0x9a3d('0xf')];var db=require(_0x9a3d('0x10'))['db'];var socket=require(_0x9a3d('0x11'))(new Redis(config[_0x9a3d('0x12')]));require('./user.socket')[_0x9a3d('0x13')](socket);config[_0x9a3d('0x12')]=_[_0x9a3d('0x14')](config[_0x9a3d('0x12')],{'host':_0x9a3d('0x15'),'port':0x18eb});var amiClient=jayson['client'][_0x9a3d('0x16')]({'port':0x232a});var values;function respondWithStatusCode(_0x44775a,_0xb2046a){_0xb2046a=_0xb2046a||0xcc;return function(_0x423723){if(_0x423723){return _0x44775a['sendStatus'](_0xb2046a);}return _0x44775a['status'](_0xb2046a)[_0x9a3d('0x17')]();};}function respondWithResult(_0x5eb496,_0x451158){_0x451158=_0x451158||0xc8;return function(_0x2f0ad9){if(_0x2f0ad9){return _0x5eb496[_0x9a3d('0x18')](_0x451158)[_0x9a3d('0x19')](_0x2f0ad9);}};}function respondWithFilteredResult(_0x551de7,_0x58ad75){return function(_0x4e42b2){if(_0x4e42b2){var _0x2544c7=typeof _0x58ad75[_0x9a3d('0x1a')]===_0x9a3d('0x1b')&&typeof _0x58ad75[_0x9a3d('0x1c')]===_0x9a3d('0x1b');var _0x32bede=_0x4e42b2['count'];var _0xd5348c=_0x2544c7?0x0:_0x58ad75[_0x9a3d('0x1a')];var _0x3f2de2=_0x2544c7?_0x4e42b2[_0x9a3d('0x1d')]:_0x58ad75['offset']+_0x58ad75['limit'];var _0x1b671a;if(_0x3f2de2>=_0x32bede){_0x3f2de2=_0x32bede;_0x1b671a=0xc8;}else{_0x1b671a=0xce;}_0x551de7['status'](_0x1b671a);return _0x551de7[_0x9a3d('0x1e')](_0x9a3d('0x1f'),_0xd5348c+'-'+_0x3f2de2+'/'+_0x32bede)['json'](_0x4e42b2);}return null;};}function respondWithRpcPromise(_0x509c00,_0x71bb76,_0x553053,_0xc14fe1){return new Promise(function(_0x51cbee,_0x4e3b4b){var _0x1c72de=_0xc14fe1||amiClient;return _0x1c72de[_0x9a3d('0x20')](_0x509c00,_0x553053)[_0x9a3d('0x21')](function(_0x59475b){logger['info'](_0x9a3d('0x22'),_0x71bb76,'request\x20sent');logger[_0x9a3d('0x23')](_0x9a3d('0x24'),_0x71bb76,'request\x20sent',JSON[_0x9a3d('0x25')](_0x59475b));if(_0x59475b[_0x9a3d('0x26')]){if(_0x59475b[_0x9a3d('0x26')][_0x9a3d('0x27')]===0x1f4){logger[_0x9a3d('0x26')](_0x9a3d('0x22'),_0x71bb76,_0x59475b[_0x9a3d('0x26')][_0x9a3d('0x28')]);return _0x4e3b4b(_0x59475b[_0x9a3d('0x26')][_0x9a3d('0x28')]);}logger[_0x9a3d('0x26')](_0x9a3d('0x22'),_0x71bb76,_0x59475b[_0x9a3d('0x26')][_0x9a3d('0x28')]);return _0x51cbee(_0x59475b[_0x9a3d('0x26')][_0x9a3d('0x28')]);}else{logger[_0x9a3d('0x29')](_0x9a3d('0x22'),_0x71bb76,'request\x20sent');_0x51cbee(_0x59475b[_0x9a3d('0x2a')]['message']);}})['catch'](function(_0x46808a){logger[_0x9a3d('0x26')]('User,\x20%s,\x20%s',_0x71bb76,_0x46808a);_0x4e3b4b(_0x46808a);});});}function saveUpdates(_0x1465c0){return function(_0x355ac7){if(_0x355ac7){return _0x355ac7[_0x9a3d('0x2b')](_0x1465c0)[_0x9a3d('0x21')](function(_0x24bcc5){if(_0x24bcc5[_0x9a3d('0x2c')]===_0x9a3d('0x2d')){socket['emit'](_0x9a3d('0x2e')+_0x24bcc5['id'],_0x24bcc5);}return _0x24bcc5;});}return null;};}function removeEntity(_0x234b9e,_0x442f9c){return function(_0x1403b2){if(_0x1403b2){return _0x1403b2[_0x9a3d('0x2f')]({'transaction':_0x442f9c})[_0x9a3d('0x21')](function(){var _0x15d124=_0x1403b2[_0x9a3d('0x30')]({'plain':!![]});if(_0x15d124[_0x9a3d('0x2c')]==='admin')return;var _0x240d0e=[{'name':_0x9a3d('0x31'),'value':_0x9a3d('0x32'),'ignore':!![]},{'name':_0x9a3d('0x33'),'value':'agent','ignore':![]},{'name':_0x9a3d('0x34'),'value':_0x9a3d('0x35'),'ignore':![]}];var _0x258aaa=_(_0x240d0e)[_0x9a3d('0x36')](_0x9a3d('0x37'))[_0x9a3d('0x38')](_0x9a3d('0x39'))['value']();if(_['includes'](_0x258aaa,_0x15d124[_0x9a3d('0x2c')])){return;}var _0xe5600e=_[_0x9a3d('0x3a')](_0x240d0e,[_0x9a3d('0x39'),_0x15d124[_0x9a3d('0x2c')]])[_0x9a3d('0x3b')];return db[_0x9a3d('0x3c')][_0x9a3d('0x2f')]({'where':{'type':_0xe5600e,'resourceId':_0x15d124['id']},'transaction':_0x442f9c})[_0x9a3d('0x21')](function(){return _0x1403b2;});})[_0x9a3d('0x21')](function(){_0x234b9e[_0x9a3d('0x18')](0xcc)[_0x9a3d('0x17')]();});}};}function handleEntityNotFound(_0x2df49f){return function(_0x50dbdf){if(!_0x50dbdf){_0x2df49f[_0x9a3d('0x3d')](0x194);}return _0x50dbdf;};}function handleError(_0x5dc31c,_0x2b6796){_0x2b6796=_0x2b6796||0x1f4;return function(_0x3d7f6c){logger[_0x9a3d('0x26')](_0x3d7f6c[_0x9a3d('0x3e')]);if(_0x3d7f6c[_0x9a3d('0x3b')]){delete _0x3d7f6c[_0x9a3d('0x3b')];}_0x5dc31c[_0x9a3d('0x18')](_0x2b6796)[_0x9a3d('0x3f')](_0x3d7f6c);};}function getUserAttributes(){return _(db[_0x9a3d('0x40')][_0x9a3d('0x41')])[_0x9a3d('0x38')](function(_0x47aaa3){return{'name':_0x47aaa3[_0x9a3d('0x42')],'type':_0x47aaa3[_0x9a3d('0x43')][_0x9a3d('0x44')]};})['filter'](function(_0x3b0758){return!['password',_0x9a3d('0x45'),_0x9a3d('0x46'),_0x9a3d('0x47'),_0x9a3d('0x48'),_0x9a3d('0x49')][_0x9a3d('0x4a')](_0x3b0758['name']);})[_0x9a3d('0x39')]();}exports[_0x9a3d('0x4b')]=function(_0x1c00e4,_0x2771ae){var _0xe742d8={},_0xa7d003={'count':0x0,'rows':[]};var _0x42b7de=getUserAttributes();_0xe742d8=qs[_0x9a3d('0x4c')](_0x42b7de,_0x1c00e4);var _0x3b68ae={'where':_0xe742d8[_0x9a3d('0x4d')]};return db[_0x9a3d('0x40')][_0x9a3d('0x1d')](_0x3b68ae)['then'](function(_0x129895){_0xa7d003['count']=_0x129895;if(_0x1c00e4[_0x9a3d('0x4e')]['includeAll']){_0xe742d8['include']=[{'all':!![]}];}if(_0x1c00e4[_0x9a3d('0x4e')][_0x9a3d('0x4f')]==='true'){_0xe742d8[_0x9a3d('0x50')]=[{'model':db['UserSetting'],'as':_0x9a3d('0x4f')}];}if(!_[_0x9a3d('0x4a')](_0xe742d8[_0x9a3d('0x51')],'id')){_0xe742d8[_0x9a3d('0x51')][_0x9a3d('0x52')]('id');}return db[_0x9a3d('0x40')][_0x9a3d('0x53')](_0xe742d8);})[_0x9a3d('0x21')](function(_0x210bbe){_0xa7d003[_0x9a3d('0x54')]=_0x210bbe;if(_0x1c00e4['query']['openTabs']==='true'){var _0x8a89e4=[];for(var _0x37a00c=0x0;_0x37a00c<_0xa7d003[_0x9a3d('0x54')][_0x9a3d('0x55')];_0x37a00c++){_0x8a89e4['push'](get_open_tabs(_0x9a3d('0x56'),_0xa7d003[_0x9a3d('0x54')][_0x37a00c][_0x9a3d('0x57')]));_0x8a89e4[_0x9a3d('0x52')](get_open_tabs(_0x9a3d('0x58'),_0xa7d003['rows'][_0x37a00c]['dataValues']));_0x8a89e4[_0x9a3d('0x52')](get_open_tabs(_0x9a3d('0x59'),_0xa7d003['rows'][_0x37a00c]['dataValues']));_0x8a89e4['push'](get_open_tabs(_0x9a3d('0x5a'),_0xa7d003[_0x9a3d('0x54')][_0x37a00c]['dataValues']));_0x8a89e4[_0x9a3d('0x52')](get_open_tabs(_0x9a3d('0x5b'),_0xa7d003['rows'][_0x37a00c][_0x9a3d('0x57')]));_0x8a89e4[_0x9a3d('0x52')](get_open_tabs(_0x9a3d('0x5c'),_0xa7d003[_0x9a3d('0x54')][_0x37a00c][_0x9a3d('0x57')]));}return Promise[_0x9a3d('0x5d')](_0x8a89e4)['then'](function(){return _0xa7d003;});}else{return _0xa7d003;}})['then'](respondWithFilteredResult(_0x2771ae,_0xe742d8))[_0x9a3d('0x5e')](handleError(_0x2771ae,null));};exports[_0x9a3d('0x5f')]=function(_0x1dcaf6,_0x1caefd){var _0x149a99=getUserAttributes();_0x1dcaf6[_0x9a3d('0x4e')]['id']=_0x1dcaf6['params']['id'];var _0x59952b=qs[_0x9a3d('0x4c')](_0x149a99,_0x1dcaf6);if(_0x1dcaf6[_0x9a3d('0x4e')][_0x9a3d('0x60')]){_0x59952b[_0x9a3d('0x50')]=[{'all':!![]}];}if(_0x1dcaf6[_0x9a3d('0x4e')]['userSetting']===_0x9a3d('0x61')){_0x59952b[_0x9a3d('0x50')]=[{'model':db[_0x9a3d('0x62')],'as':'userSetting'}];}_0x59952b=_['merge']({},_0x59952b,_0x1dcaf6[_0x9a3d('0x63')]);if(!_[_0x9a3d('0x4a')](_0x59952b[_0x9a3d('0x51')],'id')){_0x59952b[_0x9a3d('0x51')]['push']('id');}return db[_0x9a3d('0x40')][_0x9a3d('0x3a')](_0x59952b)['then'](handleEntityNotFound(_0x1caefd,null))['then'](function(_0x480e62){var _0x3922d3=[];values=_0x480e62;if(_0x1dcaf6[_0x9a3d('0x4e')]['openTabs']===_0x9a3d('0x61')){_0x3922d3['push'](get_open_tabs(_0x9a3d('0x56'),_0x480e62[_0x9a3d('0x57')]));_0x3922d3[_0x9a3d('0x52')](get_open_tabs(_0x9a3d('0x58'),_0x480e62[_0x9a3d('0x57')]));_0x3922d3[_0x9a3d('0x52')](get_open_tabs(_0x9a3d('0x5b'),_0x480e62[_0x9a3d('0x57')]));_0x3922d3[_0x9a3d('0x52')](get_open_tabs(_0x9a3d('0x5c'),_0x480e62[_0x9a3d('0x57')]));_0x3922d3[_0x9a3d('0x52')](get_open_tabs(_0x9a3d('0x59'),_0x480e62[_0x9a3d('0x57')]));_0x3922d3[_0x9a3d('0x52')](get_open_tabs('mail',_0x480e62[_0x9a3d('0x57')]));return Promise['all'](_0x3922d3);}else{return values;}})['then'](function(){return values;})[_0x9a3d('0x21')](respondWithResult(_0x1caefd,null))[_0x9a3d('0x5e')](handleError(_0x1caefd,null));};exports[_0x9a3d('0x2b')]=function(_0x202ab4,_0x2b8975){if(_0x202ab4[_0x9a3d('0x64')]['id']){delete _0x202ab4[_0x9a3d('0x64')]['id'];}delete _0x202ab4[_0x9a3d('0x64')][_0x9a3d('0x2c')];return db['User'][_0x9a3d('0x3a')]({'where':{'id':_0x202ab4[_0x9a3d('0x65')]['id']}})[_0x9a3d('0x21')](handleEntityNotFound(_0x2b8975,null))[_0x9a3d('0x21')](saveUpdates(_0x202ab4[_0x9a3d('0x64')],null))[_0x9a3d('0x21')](respondWithResult(_0x2b8975,null))[_0x9a3d('0x5e')](handleError(_0x2b8975,null));};exports[_0x9a3d('0x66')]=function(_0x59f18b,_0x548dbd){return db[_0x9a3d('0x40')][_0x9a3d('0x66')]()[_0x9a3d('0x21')](respondWithResult(_0x548dbd,null))[_0x9a3d('0x5e')](handleError(_0x548dbd,null));};exports[_0x9a3d('0x67')]=function(_0x26e99f,_0x17584d){return db['User']['find']({'where':{'id':_0x26e99f[_0x9a3d('0x65')]['id']}})[_0x9a3d('0x21')](handleEntityNotFound(_0x17584d,null))[_0x9a3d('0x21')](function(_0xd05d5f){if(_0xd05d5f){return _0xd05d5f[_0x9a3d('0x67')](_0x26e99f[_0x9a3d('0x64')]['ids'],_['omit'](_0x26e99f['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x17584d,null))[_0x9a3d('0x5e')](handleError(_0x17584d,null));};function validateUser(_0x32fb8a){return new Promise(function(_0x190d27,_0x1fad6d){if(_0x32fb8a[_0x9a3d('0x68')])return _0x190d27(_0x32fb8a);return db[_0x9a3d('0x69')]['findById'](0x1)[_0x9a3d('0x21')](function(_0x1e1890){if(_0x1e1890[_0x9a3d('0x6a')])authService[_0x9a3d('0x6b')](_0x32fb8a[_0x9a3d('0x6c')]);db[_0x9a3d('0x40')]['max']('internal')[_0x9a3d('0x21')](function(_0x173566){if(_[_0x9a3d('0x6d')](_0x173566)){_0x32fb8a[_0x9a3d('0x68')]=_0x1e1890[_0x9a3d('0x6e')]||0x1;return;}if(_[_0x9a3d('0x6d')](_0x1e1890[_0x9a3d('0x6e')])||_0x1e1890['min_internal']===_0x173566){_0x32fb8a[_0x9a3d('0x68')]=_0x173566+0x1;return;}if(_0x1e1890[_0x9a3d('0x6e')]>_0x173566){_0x32fb8a[_0x9a3d('0x68')]=_0x1e1890[_0x9a3d('0x6e')];return;}return db['sequelize'][_0x9a3d('0x4e')](_0x9a3d('0x6f'),{'type':db['sequelize'][_0x9a3d('0x70')][_0x9a3d('0x71')]})[_0x9a3d('0x21')](function(_0x1adb8d){if(_0x1adb8d&&_0x1adb8d[_0x9a3d('0x55')]){for(var _0x26d1f7=0x0,_0x4a11f5=_0x1adb8d['length'];_0x26d1f7<_0x4a11f5&&_[_0x9a3d('0x6d')](_0x32fb8a[_0x9a3d('0x68')]);_0x26d1f7++){if(_0x1e1890['min_internal']<=_0x1adb8d[_0x26d1f7]['from']){_0x32fb8a[_0x9a3d('0x68')]=_0x1adb8d[_0x26d1f7][_0x9a3d('0x72')];}else if(_0x1e1890[_0x9a3d('0x6e')]>_0x1adb8d[_0x26d1f7][_0x9a3d('0x72')]&&_0x1e1890[_0x9a3d('0x6e')]<=_0x1adb8d[_0x26d1f7]['to']){_0x32fb8a[_0x9a3d('0x68')]=_0x1e1890[_0x9a3d('0x6e')];}}}if(_[_0x9a3d('0x6d')](_0x32fb8a[_0x9a3d('0x68')])){_0x32fb8a['internal']=_0x173566+0x1;}return _0x190d27(_0x32fb8a);});});})[_0x9a3d('0x5e')](function(_0x30bdfa){_0x1fad6d(_0x30bdfa);});});}function updateUser(_0x35335d){return new Promise(function(_0x24d080,_0x54249f){try{if(_0x35335d[_0x9a3d('0x73')]){_0x35335d['mailbox']=_0x35335d[_0x9a3d('0x68')];_0x35335d[_0x9a3d('0x74')]={'mailbox':_0x35335d[_0x9a3d('0x68')],'password':_0x35335d[_0x9a3d('0x6c')],'fullname':_0x35335d['fullname'],'email':_0x35335d[_0x9a3d('0x75')]};}if(_0x35335d[_0x9a3d('0x2c')]===_0x9a3d('0x2d')){if(!_0x35335d[_0x9a3d('0x76')])_0x35335d[_0x9a3d('0x76')]=[_0x9a3d('0x77'),'102',_0x9a3d('0x78'),'113',_0x9a3d('0x79'),_0x9a3d('0x7a'),'105',_0x9a3d('0x7b'),_0x9a3d('0x7c'),'108',_0x9a3d('0x7d'),_0x9a3d('0x7e'),_0x9a3d('0x7f'),'114',_0x9a3d('0x80')];}_0x24d080(_0x35335d);}catch(_0x170950){_0x54249f(_0x170950);}});}exports[_0x9a3d('0x81')]=function(_0xeeaaf0,_0x1e54e9){if(_0xeeaaf0['user'][_0x9a3d('0x2c')]==='agent')throw new Error('Unauthorized');if(_0xeeaaf0[_0x9a3d('0x64')][_0x9a3d('0x2c')]==='user'&&_0xeeaaf0[_0x9a3d('0x32')]['role']!=='admin'){throw new Error(_0x9a3d('0x82'));}if(_0xeeaaf0[_0x9a3d('0x64')][_0x9a3d('0x2c')]===_0x9a3d('0x83')&&_0xeeaaf0[_0x9a3d('0x32')]['role']!==_0x9a3d('0x83')){throw new Error(_0x9a3d('0x84'));}return licenseUtil[_0x9a3d('0x85')]([_0xeeaaf0[_0x9a3d('0x64')]])['then'](function(){return validateUser(_0xeeaaf0['body']);})['then'](function(_0x1bd599){return updateUser(_0x1bd599)[_0x9a3d('0x21')](function(_0x3d6b5c){if(_0x3d6b5c[_0x9a3d('0x2c')]===_0x9a3d('0x83')){_0x3d6b5c[_0x9a3d('0x86')]=_0xeeaaf0[_0x9a3d('0x32')][_0x9a3d('0x86')];delete _0x3d6b5c[_0x9a3d('0x87')];}return _0x3d6b5c;});})[_0x9a3d('0x21')](function(_0x43c207){return db['User'][_0x9a3d('0x81')](_0x43c207,{'include':[{'model':db[_0x9a3d('0x74')],'as':_0x9a3d('0x74')}]});})[_0x9a3d('0x21')](function(_0x100fbe){if(_0xeeaaf0[_0x9a3d('0x64')][_0x9a3d('0x2c')]===_0x9a3d('0x32'))return _0x100fbe;if(_0xeeaaf0['user']['role']!=='user')return _0x100fbe;return db[_0x9a3d('0x88')][_0x9a3d('0x3a')]({'where':{'name':_0x100fbe[_0x9a3d('0x2c')]==='agent'?_0x9a3d('0x33'):'Telephones','userProfileId':_0xeeaaf0[_0x9a3d('0x32')][_0x9a3d('0x87')]},'raw':!![]})[_0x9a3d('0x21')](function(_0x3cc91d){if(!_0x3cc91d||_0x3cc91d['autoAssociation']!=0x0)return _0x100fbe;return db[_0x9a3d('0x3c')][_0x9a3d('0x81')]({'name':_0x100fbe[_0x9a3d('0x3b')],'resourceId':_0x100fbe['id'],'type':_0x3cc91d[_0x9a3d('0x3b')],'sectionId':_0x3cc91d['id']},{})[_0x9a3d('0x21')](function(){return _0x100fbe;});})[_0x9a3d('0x5e')](function(_0x481f4d){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x481f4d);throw _0x481f4d;});})[_0x9a3d('0x21')](respondWithResult(_0x1e54e9,0xc9))[_0x9a3d('0x5e')](handleError(_0x1e54e9,null));};exports[_0x9a3d('0x89')]=function(_0x2019c2,_0x4f78ea){var _0x3150ac=_0x2019c2['body'];var _0x47ae62=[];if(_0x2019c2['user'][_0x9a3d('0x2c')]===_0x9a3d('0x2d'))throw new Error(_0x9a3d('0x8a'));if(_[_0x9a3d('0x8b')](_0x3150ac,[_0x9a3d('0x2c'),_0x9a3d('0x32')])&&_0x2019c2['user'][_0x9a3d('0x2c')]!==_0x9a3d('0x83')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_[_0x9a3d('0x8b')](_0x3150ac,[_0x9a3d('0x2c'),'admin'])&&_0x2019c2[_0x9a3d('0x32')][_0x9a3d('0x2c')]!==_0x9a3d('0x83')){throw new Error(_0x9a3d('0x8c'));}return licenseUtil['checkUserLimits'](_0x3150ac)[_0x9a3d('0x21')](function(){return validateUser(_0x3150ac[0x0]);})[_0x9a3d('0x21')](function(){for(var _0x6208ed=0x1;_0x6208ed<_0x3150ac[_0x9a3d('0x55')];_0x6208ed++){var _0x35f920=_0x3150ac[_0x6208ed-0x1]['internal'];if(!_0x3150ac[_0x6208ed][_0x9a3d('0x68')])_0x3150ac[_0x6208ed][_0x9a3d('0x68')]=_0x35f920+0x1;_0x47ae62[_0x9a3d('0x52')](validateUser(_0x3150ac[_0x6208ed]));}return Promise[_0x9a3d('0x5d')](_0x47ae62);})[_0x9a3d('0x21')](function(){_0x47ae62=[];for(var _0x16696d=0x0;_0x16696d<_0x3150ac[_0x9a3d('0x55')];_0x16696d++){_0x47ae62[_0x9a3d('0x52')](updateUser(_0x3150ac[_0x16696d]));}return Promise['all'](_0x47ae62);})[_0x9a3d('0x21')](function(){_0x47ae62=_0x3150ac[_0x9a3d('0x38')](function(_0x5a2d71){return db[_0x9a3d('0x40')]['create'](_0x5a2d71,{'include':[{'model':db[_0x9a3d('0x74')],'as':'VoiceMail'}]})['then'](function(_0x2ae547){_0x5a2d71['id']=_0x2ae547['id'];return _0x5a2d71;});});return Promise[_0x9a3d('0x5d')](_0x47ae62);})['then'](function(_0x2fc15e){if(_0x2019c2[_0x9a3d('0x64')][_0x9a3d('0x2c')]===_0x9a3d('0x32'))return _0x2fc15e;if(_0x2019c2['user'][_0x9a3d('0x2c')]!==_0x9a3d('0x32'))return _0x2fc15e;var _0x1da058=_[_0x9a3d('0x8b')](_0x2fc15e,function(_0x50a351){return _0x50a351[_0x9a3d('0x2c')]==='agent'||_0x50a351[_0x9a3d('0x2c')]==='telephone';});if(!_0x1da058)return _0x2fc15e;return db[_0x9a3d('0x88')][_0x9a3d('0x53')]({'where':{'name':{'$or':[_0x9a3d('0x33'),_0x9a3d('0x34')]},'userProfileId':_0x2019c2[_0x9a3d('0x32')]['userProfileId']},'raw':!![]})[_0x9a3d('0x21')](function(_0x32abea){if(_[_0x9a3d('0x8d')](_0x32abea)||!_[_0x9a3d('0x8b')](_0x32abea,[_0x9a3d('0x8e'),0x0]))return _0x2fc15e;_0x47ae62=[];var _0x94323e=_(_0x32abea)[_0x9a3d('0x38')](function(_0x54d089){if(_0x54d089[_0x9a3d('0x8e')]===0x1)return;return _0x54d089[_0x9a3d('0x3b')]===_0x9a3d('0x33')?_0x9a3d('0x2d'):'telephone';})['compact']()[_0x9a3d('0x39')]();for(var _0xab531e=0x0;_0xab531e<_0x2fc15e[_0x9a3d('0x55')];_0xab531e++){if(!_[_0x9a3d('0x4a')](_0x94323e,_0x2fc15e[_0xab531e][_0x9a3d('0x2c')]))return;var _0x170ea5=_0x2fc15e[_0xab531e][_0x9a3d('0x2c')]===_0x9a3d('0x2d')?_0x9a3d('0x33'):_0x9a3d('0x34');_0x47ae62['push'](db[_0x9a3d('0x3c')][_0x9a3d('0x81')]({'name':_0x2fc15e[_0xab531e][_0x9a3d('0x3b')],'resourceId':_0x2fc15e[_0xab531e]['id'],'type':_0x170ea5,'sectionId':_[_0x9a3d('0x3a')](_0x32abea,[_0x9a3d('0x3b'),_0x170ea5])['id']},{}));}return Promise[_0x9a3d('0x5d')](_0x47ae62);});})[_0x9a3d('0x21')](respondWithResult(_0x4f78ea,0xc9))[_0x9a3d('0x5e')](handleError(_0x4f78ea,null));};exports[_0x9a3d('0x8f')]=function(_0x48d3c9,_0x2cd75b){if(_0x48d3c9[_0x9a3d('0x64')]['id']){delete _0x48d3c9['body']['id'];}return db['User']['find']({'where':{'id':_0x48d3c9[_0x9a3d('0x65')]['id']}})[_0x9a3d('0x21')](function(_0xd198f8){if(!_0xd198f8)return null;if(_0xd198f8['id']===_0x48d3c9[_0x9a3d('0x32')]['id']){if(!_0x48d3c9[_0x9a3d('0x64')]['oldPassword']||!_0x48d3c9[_0x9a3d('0x64')][_0x9a3d('0x90')]){throw new db['Sequelize'][(_0x9a3d('0x91'))](_0x9a3d('0x92'));}if(!_0xd198f8['authenticate'](_0x48d3c9[_0x9a3d('0x64')][_0x9a3d('0x93')])){throw new db[(_0x9a3d('0x94'))]['ValidationError'](_0x9a3d('0x95'));}if(_0x48d3c9[_0x9a3d('0x64')][_0x9a3d('0x93')]===_0x48d3c9['body']['newPassword']){throw new db[(_0x9a3d('0x94'))]['ValidationError'](_0x9a3d('0x96'));}}else if(_0x48d3c9[_0x9a3d('0x32')]['role']===_0x9a3d('0x83')){if(!_0x48d3c9[_0x9a3d('0x64')][_0x9a3d('0x90')]){throw new db[(_0x9a3d('0x94'))]['ValidationError'](_0x9a3d('0x97'));}}else if(_0x48d3c9[_0x9a3d('0x32')][_0x9a3d('0x2c')]===_0x9a3d('0x32')){if(!_0x48d3c9['body'][_0x9a3d('0x90')]){throw new db[(_0x9a3d('0x94'))]['ValidationError'](_0x9a3d('0x97'));}if(_0xd198f8[_0x9a3d('0x2c')]!==_0x9a3d('0x2d')){throw new db[(_0x9a3d('0x94'))]['ValidationError'](_0x9a3d('0x8a'));}}else{throw new db[(_0x9a3d('0x94'))][(_0x9a3d('0x91'))](_0x9a3d('0x8a'));}return _0xd198f8;})['then'](handleEntityNotFound(_0x2cd75b,null))[_0x9a3d('0x21')](function(_0xa2f7cc){return db['Setting'][_0x9a3d('0x98')]({'attributes':['id',_0x9a3d('0x6a'),_0x9a3d('0x99'),_0x9a3d('0x9a')]})[_0x9a3d('0x21')](function(_0x2f4c34){if(_0x2f4c34[_0x9a3d('0x6a')])authService[_0x9a3d('0x6b')](_0x48d3c9['body']['newPassword']);if(!_0x2f4c34['enforcePasswordHistory']||!_0xa2f7cc[_0x9a3d('0x46')])return _0xa2f7cc;authService[_0x9a3d('0x9b')](_0x48d3c9[_0x9a3d('0x64')]['newPassword'],_0xa2f7cc['previousPasswords'],_0x2f4c34[_0x9a3d('0x9a')]);return _0xa2f7cc;})[_0x9a3d('0x21')](saveUpdates({'password':_0x48d3c9['body']['newPassword'],'passwordResetAt':_0x48d3c9['user']['id']==_0x48d3c9[_0x9a3d('0x65')]['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0x48d3c9['body'][_0x9a3d('0x90')],_0xa2f7cc[_0x9a3d('0x46')])},null));})[_0x9a3d('0x21')](respondWithResult(_0x2cd75b,null))[_0x9a3d('0x5e')](handleError(_0x2cd75b,null));};exports['addQueues']=function(_0x29d240,_0x480c3a){var _0x27a673=_0x29d240[_0x9a3d('0x64')][_0x9a3d('0x9c')];return db[_0x9a3d('0x40')][_0x9a3d('0x3a')]({'where':{'id':_0x29d240[_0x9a3d('0x65')]['id']},'attributes':['id',_0x9a3d('0x3b'),'role','online',_0x9a3d('0x9d'),_0x9a3d('0x9e'),'interface']})[_0x9a3d('0x21')](handleEntityNotFound(_0x480c3a,null))[_0x9a3d('0x21')](function(_0x1052bb){if(_0x1052bb){if(!utils[_0x9a3d('0x9f')](_0x27a673)){throw new db[(_0x9a3d('0x94'))][(_0x9a3d('0x91'))](_0x9a3d('0xa0'));}return _0x1052bb[_0x9a3d('0xa1')+_[_0x9a3d('0xa2')](_0x27a673[_0x9a3d('0xa3')]())+_0x9a3d('0xa4')](_0x29d240[_0x9a3d('0x64')][_0x9a3d('0xa5')],{'penalty':_0x29d240[_0x9a3d('0x64')][_0x9a3d('0xa6')]||0x0})[_0x9a3d('0xa7')](function(_0x28ffd9){for(var _0x5c3608=0x0;_0x5c3608<_0x29d240[_0x9a3d('0x64')][_0x9a3d('0xa5')][_0x9a3d('0x55')];_0x5c3608+=0x1){var _0x1676a5={'UserId':Number(_0x29d240[_0x9a3d('0x65')]['id'])};_0x1676a5[_[_0x9a3d('0xa2')](_0x27a673[_0x9a3d('0xa3')]())+'QueueId']=Number(_0x29d240[_0x9a3d('0x64')][_0x9a3d('0xa5')][_0x5c3608]);socket[_0x9a3d('0xa8')](_0x9a3d('0x32')+_[_0x9a3d('0xa2')](_0x27a673['toLowerCase']())+_0x9a3d('0xa9'),_0x1676a5);}return _0x28ffd9;})[_0x9a3d('0x21')](function(){if(_0x27a673===_0x9a3d('0xaa')){return db[_0x9a3d('0xab')][_0x9a3d('0x53')]({'where':{'id':_0x29d240['body'][_0x9a3d('0xa5')]||[]},'raw':!![],'attributes':['id','name']});}})[_0x9a3d('0x21')](function(_0x320b5d){var _0x49506c=_0x1052bb[_0x9a3d('0x30')]({'plain':!![]});var _0x42c8b=[];if(_0x27a673===_0x9a3d('0xaa')&&_0x49506c['role']===_0x9a3d('0x2d')&&_0x49506c[_0x9a3d('0xac')]){for(let _0x176097=0x0;_0x176097<_0x320b5d[_0x9a3d('0x55')];_0x176097+=0x1){_0x42c8b['push']({'membername':_0x49506c[_0x9a3d('0x3b')],'UserId':_0x49506c['id'],'queue_name':_0x320b5d[_0x176097][_0x9a3d('0x3b')],'VoiceQueueId':_0x320b5d[_0x176097]['id'],'interface':_['isNil'](_0x49506c[_0x9a3d('0xad')])?util['format'](_0x9a3d('0xae'),_0x49506c[_0x9a3d('0x3b')]):_0x49506c[_0x9a3d('0xad')],'paused':_0x49506c[_0x9a3d('0x9e')]||![],'penalty':_0x29d240[_0x9a3d('0x64')][_0x9a3d('0xa6')]||0x0});}return Promise[_0x9a3d('0x5d')](_0x42c8b['map'](function(_0x592670){return db['UserVoiceQueueRt']['upsert'](_0x592670);}));}return _0x1052bb;});}})[_0x9a3d('0x21')](respondWithStatusCode(_0x480c3a,null))['catch'](handleError(_0x480c3a,null));};exports[_0x9a3d('0xaf')]=function(_0x13b191,_0x5d56ac){var _0x5e1a30,_0x34fbfc;return db[_0x9a3d('0x40')][_0x9a3d('0x3a')]({'where':{'id':_0x13b191['params']['id']},'attributes':['id','name',_0x9a3d('0x2c')]})[_0x9a3d('0x21')](handleEntityNotFound(_0x5d56ac,null))[_0x9a3d('0x21')](function(_0x451933){if(_0x451933){_0x5e1a30=_0x451933;if(!_0x13b191[_0x9a3d('0x4e')][_0x9a3d('0x9c')]||!utils[_0x9a3d('0x9f')](_0x13b191['query']['channel'])){throw new db[(_0x9a3d('0x94'))]['ValidationError'](_0x9a3d('0xa0'));}return _0x451933[_0x9a3d('0xb0')+_[_0x9a3d('0xa2')](_0x13b191[_0x9a3d('0x4e')][_0x9a3d('0x9c')][_0x9a3d('0xa3')]())+_0x9a3d('0xa4')](_0x13b191[_0x9a3d('0x4e')][_0x9a3d('0xa5')]);}})['then'](function(_0x4a75eb){if(_[_0x9a3d('0xb1')](_0x13b191[_0x9a3d('0x4e')][_0x9a3d('0xa5')])){for(var _0x259a51=0x0;_0x259a51<_0x13b191['query'][_0x9a3d('0xa5')][_0x9a3d('0x55')];_0x259a51+=0x1){_0x34fbfc={'UserId':Number(_0x13b191[_0x9a3d('0x65')]['id'])};_0x34fbfc[_[_0x9a3d('0xa2')](_0x13b191[_0x9a3d('0x4e')]['channel'][_0x9a3d('0xa3')]())+_0x9a3d('0xb2')]=Number(_0x13b191['query'][_0x9a3d('0xa5')][_0x259a51]);socket[_0x9a3d('0xa8')](_0x9a3d('0x32')+_[_0x9a3d('0xa2')](_0x13b191[_0x9a3d('0x4e')]['channel']['toLowerCase']())+_0x9a3d('0xb3'),_0x34fbfc);}}else{_0x34fbfc={'UserId':Number(_0x13b191[_0x9a3d('0x65')]['id'])};_0x34fbfc[_[_0x9a3d('0xa2')](_0x13b191[_0x9a3d('0x4e')][_0x9a3d('0x9c')]['toLowerCase']())+_0x9a3d('0xb2')]=Number(_0x13b191['query'][_0x9a3d('0xa5')]);socket[_0x9a3d('0xa8')]('user'+_[_0x9a3d('0xa2')](_0x13b191['query']['channel'][_0x9a3d('0xa3')]())+_0x9a3d('0xb3'),_0x34fbfc);}return _0x4a75eb;})[_0x9a3d('0x21')](function(){if(_0x13b191[_0x9a3d('0x4e')][_0x9a3d('0x9c')]===_0x9a3d('0xaa')){return db[_0x9a3d('0xb4')][_0x9a3d('0x2f')]({'where':{'UserId':_0x13b191[_0x9a3d('0x65')]['id'],'VoiceQueueId':_0x13b191[_0x9a3d('0x4e')]['ids']},'individualHooks':!![]})[_0x9a3d('0x21')](function(){return _0x5e1a30;});}return _0x5e1a30;})[_0x9a3d('0x21')](respondWithStatusCode(_0x5d56ac,null))['catch'](handleError(_0x5d56ac,null));};exports[_0x9a3d('0xb5')]=function(_0x5b254b,_0x42a489){_0x5b254b[_0x9a3d('0x64')]['userpic']=_0x5b254b[_0x9a3d('0xb6')][_0x9a3d('0xb7')];return db[_0x9a3d('0x40')][_0x9a3d('0x3a')]({'where':{'id':_0x5b254b[_0x9a3d('0x65')]['id']}})[_0x9a3d('0x21')](handleEntityNotFound(_0x42a489,null))['then'](saveUpdates(_0x5b254b[_0x9a3d('0x64')],null))[_0x9a3d('0x21')](respondWithResult(_0x42a489,null))[_0x9a3d('0x5e')](handleError(_0x42a489,null));};exports[_0x9a3d('0xb8')]=function(_0x320801,_0x2e9259){var _0x533e95=path['join'](config[_0x9a3d('0xb9')],_0x9a3d('0xba'));return db[_0x9a3d('0x40')]['find']({'where':{'id':_0x320801[_0x9a3d('0x65')]['id']},'attributes':['id',_0x9a3d('0xbb')],'raw':!![]})[_0x9a3d('0x21')](handleEntityNotFound(_0x2e9259,null))[_0x9a3d('0x21')](function(_0x45a4a4){if(_0x45a4a4){if(_[_0x9a3d('0x6d')](_0x45a4a4[_0x9a3d('0xbb')])){return _0x2e9259[_0x9a3d('0xbc')](_0x533e95);}else{if(!fs[_0x9a3d('0xbd')](path[_0x9a3d('0xbe')](config[_0x9a3d('0xb9')],_0x9a3d('0xbf'),_0x45a4a4['userpic']))){return _0x2e9259[_0x9a3d('0xbc')](_0x533e95);}return _0x2e9259[_0x9a3d('0xbc')](path[_0x9a3d('0xbe')](config[_0x9a3d('0xb9')],'server/files/images/',_0x45a4a4[_0x9a3d('0xbb')]));}}})[_0x9a3d('0x5e')](handleError(_0x2e9259,null));};exports[_0x9a3d('0xc0')]=function(_0x1b6c22,_0x1ca640){return db[_0x9a3d('0x40')][_0x9a3d('0x3a')]({'where':{'id':_0x1b6c22[_0x9a3d('0x65')]['id']},'attributes':['id']})[_0x9a3d('0x21')](handleEntityNotFound(_0x1ca640,null))[_0x9a3d('0x21')](function(_0x3a7c66){var _0x1d1cb9=[];values=_0x3a7c66[_0x9a3d('0x57')];_0x1d1cb9['push'](get_open_tabs(_0x9a3d('0x56'),_0x3a7c66[_0x9a3d('0x57')]));_0x1d1cb9[_0x9a3d('0x52')](get_open_tabs('sms',_0x3a7c66[_0x9a3d('0x57')]));_0x1d1cb9[_0x9a3d('0x52')](get_open_tabs(_0x9a3d('0x5b'),_0x3a7c66['dataValues']));_0x1d1cb9['push'](get_open_tabs('whatsapp',_0x3a7c66[_0x9a3d('0x57')]));_0x1d1cb9[_0x9a3d('0x52')](get_open_tabs(_0x9a3d('0x59'),_0x3a7c66[_0x9a3d('0x57')]));_0x1d1cb9[_0x9a3d('0x52')](get_open_tabs('mail',_0x3a7c66['dataValues']));return Promise['all'](_0x1d1cb9);})[_0x9a3d('0x21')](function(_0x28ecf0){if(_0x28ecf0){var _0x50d87e=_['map'](values[_0x9a3d('0xc1')],function(_0x2edf7c){return{'channel':'CHAT','id':_0x2edf7c['id'],'createdAt':_0x2edf7c[_0x9a3d('0xc2')]};});var _0x558b41=_[_0x9a3d('0x38')](values['FaxOpenTabs'],function(_0xed7c2f){return{'channel':_0x9a3d('0xc3'),'id':_0xed7c2f['id'],'createdAt':_0xed7c2f['createdAt']};});var _0xedf18e=_[_0x9a3d('0x38')](values[_0x9a3d('0xc4')],function(_0x552bf8){return{'channel':_0x9a3d('0xc5'),'id':_0x552bf8['id'],'createdAt':_0x552bf8[_0x9a3d('0xc2')]};});var _0x3c7566=_[_0x9a3d('0x38')](values[_0x9a3d('0xc6')],function(_0x4a25fa){return{'channel':_0x9a3d('0xc7'),'id':_0x4a25fa['id'],'createdAt':_0x4a25fa[_0x9a3d('0xc2')]};});var _0x2b5767=_[_0x9a3d('0x38')](values[_0x9a3d('0xc8')],function(_0x30cd95){return{'channel':'SMS','id':_0x30cd95['id'],'createdAt':_0x30cd95[_0x9a3d('0xc2')]};});var _0x4b36b9=_['map'](values['WhatsappOpenTabs'],function(_0x295eec){return{'channel':_0x9a3d('0xc9'),'id':_0x295eec['id'],'createdAt':_0x295eec[_0x9a3d('0xc2')]};});var _0x4a62f7=_[_0x9a3d('0xca')](_0x50d87e,_0x558b41,_0xedf18e,_0x3c7566,_0x2b5767,_0x4b36b9);var _0x480744={'count':_0x4a62f7[_0x9a3d('0x55')],'rows':_0x4a62f7};return _0x480744;}else return null;})[_0x9a3d('0x21')](respondWithResult(_0x1ca640,null))[_0x9a3d('0x5e')](handleError(_0x1ca640,null));};exports[_0x9a3d('0xcb')]=function(_0x3ee738,_0x510366){var _0xbd1d1b={};return db['User'][_0x9a3d('0x98')]({'where':{'id':_0x3ee738['params']['id']}})[_0x9a3d('0x21')](function(_0x214739){if(!_0x214739){throw new APINotFoundError(util[_0x9a3d('0xcc')](_0x9a3d('0xcd'),_0x3ee738[_0x9a3d('0x65')]['id']));}return contacts[_0x9a3d('0x66')]();})['then'](function(_0xb6b426){_0x3ee738[_0x9a3d('0x4e')][_0x9a3d('0x40')]=_0x3ee738['params']['id'];_0xbd1d1b=qs[_0x9a3d('0x4c')](_0xb6b426,_0x3ee738);if(_0x3ee738[_0x9a3d('0x4e')]['hasOwnProperty']('includeAll')){_0xbd1d1b[_0x9a3d('0x50')]=[{'model':db[_0x9a3d('0xce')],'as':'List','required':![]},{'model':db[_0x9a3d('0xcf')],'as':_0x9a3d('0xd0'),'attributes':['id',_0x9a3d('0x3b'),_0x9a3d('0xd1')],'where':_0x3ee738[_0x9a3d('0x4e')][_0x9a3d('0xd2')]?{'id':_0x3ee738['query']['tag']}:undefined,'required':_0x3ee738[_0x9a3d('0x4e')][_0x9a3d('0xd2')]?!![]:![]}];}return contacts['findAll'](_0x3ee738['query'],_0x3ee738[_0x9a3d('0x32')],_0xbd1d1b,_0xb6b426);})[_0x9a3d('0x21')](respondWithFilteredResult(_0x510366,_0xbd1d1b))[_0x9a3d('0x5e')](APIHandleError(_0x510366));};exports[_0x9a3d('0xd3')]=function(_0x146ce7,_0x3803cc){var _0x571b49;var _0x5659c2={};var _0x2078b7;return db[_0x9a3d('0x40')][_0x9a3d('0x98')]({'where':{'id':_0x146ce7[_0x9a3d('0x65')]['id']},'attributes':['id','name',_0x9a3d('0x2c')]})[_0x9a3d('0x21')](handleEntityNotFound(_0x3803cc,null))[_0x9a3d('0x21')](function(_0x58568e){if(!utils[_0x9a3d('0x9f')](_0x146ce7[_0x9a3d('0x4e')][_0x9a3d('0x9c')])){throw new db[(_0x9a3d('0x94'))][(_0x9a3d('0x91'))](_0x9a3d('0xa0'));}_0x571b49=_0x58568e;var _0x40af57={};_0x40af57[_0x9a3d('0xd4')]=_[_0x9a3d('0xd5')](db[_[_0x9a3d('0xa2')](_0x146ce7[_0x9a3d('0x4e')][_0x9a3d('0x9c')])+'Queue'][_0x9a3d('0x41')]);_0x40af57[_0x9a3d('0x4e')]=_['keys'](_0x146ce7['query']);_0x40af57['filters']=_[_0x9a3d('0xd6')](_0x40af57[_0x9a3d('0xd4')],_0x40af57[_0x9a3d('0x4e')]);_0x5659c2['attributes']=_[_0x9a3d('0xd6')](_0x40af57[_0x9a3d('0xd4')],qs['fields'](_0x146ce7[_0x9a3d('0x4e')][_0x9a3d('0xd7')]));_0x5659c2[_0x9a3d('0x51')]=_0x5659c2['attributes'][_0x9a3d('0x55')]?_0x5659c2[_0x9a3d('0x51')]:_0x40af57['model'];_0x5659c2['order']=qs['sort'](_0x146ce7['query']['sort']);_0x5659c2['where']=qs[_0x9a3d('0xd8')](_['pick'](_0x146ce7['query'],_0x40af57[_0x9a3d('0xd8')]));if(_0x146ce7[_0x9a3d('0x4e')][_0x9a3d('0x36')]){_0x5659c2[_0x9a3d('0x4d')]=_[_0x9a3d('0xd9')](_0x5659c2[_0x9a3d('0x4d')],{'$or':_[_0x9a3d('0x38')](_0x5659c2[_0x9a3d('0x51')],function(_0x238704){var _0x111af0={};_0x111af0[_0x238704]={'$like':'%'+_0x146ce7[_0x9a3d('0x4e')][_0x9a3d('0x36')]+'%'};return _0x111af0;})});}_0x5659c2=_[_0x9a3d('0xd9')]({},_0x5659c2,_0x146ce7[_0x9a3d('0x63')]);switch(_0x571b49[_0x9a3d('0x2c')]){case _0x9a3d('0x83'):return db[_[_0x9a3d('0xa2')](_0x146ce7['query'][_0x9a3d('0x9c')])+_0x9a3d('0xda')][_0x9a3d('0x53')](_0x5659c2);case'user':case _0x9a3d('0x2d'):return _0x571b49[_0x9a3d('0x30')+_[_0x9a3d('0xa2')](_0x146ce7['query'][_0x9a3d('0x9c')])+_0x9a3d('0xa4')](_0x5659c2);default:throw new db[(_0x9a3d('0x94'))][(_0x9a3d('0x91'))](_0x9a3d('0xdb'));}})['then'](function(_0x136006){_0x2078b7=_0x136006[_0x9a3d('0x55')];if(!_0x146ce7['query'][_0x9a3d('0xdc')](_0x9a3d('0xdd'))){_0x5659c2[_0x9a3d('0x1c')]=qs['limit'](_0x146ce7[_0x9a3d('0x4e')][_0x9a3d('0x1c')]);_0x5659c2[_0x9a3d('0x1a')]=qs['offset'](_0x146ce7[_0x9a3d('0x4e')][_0x9a3d('0x1a')]);}switch(_0x571b49[_0x9a3d('0x2c')]){case'admin':return db[_[_0x9a3d('0xa2')](_0x146ce7[_0x9a3d('0x4e')][_0x9a3d('0x9c')])+_0x9a3d('0xda')][_0x9a3d('0x53')](_0x5659c2);case'user':case _0x9a3d('0x2d'):return _0x571b49['get'+_['capitalize'](_0x146ce7[_0x9a3d('0x4e')][_0x9a3d('0x9c')])+'Queues'](_0x5659c2);}})['then'](function(_0x1c71e5){return{'count':_0x2078b7,'rows':_0x1c71e5};})['then'](respondWithResult(_0x3803cc,null))[_0x9a3d('0x5e')](handleError(_0x3803cc,null));};exports['getVoiceQueuesRt']=function(_0x3d0f66,_0x164276){var _0x3c3ef9={};var _0x58a67b={};var _0x1d3441;var _0x9794;return db['User']['findOne']({'where':{'id':_0x3d0f66[_0x9a3d('0x65')]['id']}})['then'](handleEntityNotFound(_0x164276,null))[_0x9a3d('0x21')](function(_0x1dc7b6){if(_0x1dc7b6){_0x1d3441=_0x1dc7b6;_0x58a67b['model']=_[_0x9a3d('0xd5')](db['UserVoiceQueueRt'][_0x9a3d('0x41')]);_0x58a67b['query']=_[_0x9a3d('0xd5')](_0x3d0f66['query']);_0x58a67b[_0x9a3d('0xd8')]=_[_0x9a3d('0xd6')](_0x58a67b['model'],_0x58a67b['query']);_0x3c3ef9[_0x9a3d('0x51')]=_[_0x9a3d('0xd6')](_0x58a67b[_0x9a3d('0xd4')],qs['fields'](_0x3d0f66[_0x9a3d('0x4e')]['fields']));_0x3c3ef9['attributes']=_0x3c3ef9[_0x9a3d('0x51')][_0x9a3d('0x55')]?_0x3c3ef9[_0x9a3d('0x51')]:_0x58a67b['model'];_0x3c3ef9[_0x9a3d('0xde')]=qs[_0x9a3d('0xdf')](_0x3d0f66[_0x9a3d('0x4e')]['sort']);_0x3c3ef9[_0x9a3d('0x4d')]=qs['filters'](_[_0x9a3d('0xe0')](_0x3d0f66[_0x9a3d('0x4e')],_0x58a67b['filters']));if(_0x3d0f66[_0x9a3d('0x4e')][_0x9a3d('0x36')]){_0x3c3ef9[_0x9a3d('0x4d')]=_[_0x9a3d('0xd9')](_0x3c3ef9['where'],{'$or':_[_0x9a3d('0x38')](_0x3c3ef9[_0x9a3d('0x51')],function(_0x4809de){var _0x101c33={};_0x101c33[_0x4809de]={'$like':'%'+_0x3d0f66[_0x9a3d('0x4e')][_0x9a3d('0x36')]+'%'};return _0x101c33;})});}_0x3c3ef9=_['merge']({},_0x3c3ef9,_0x3d0f66['options']);return _0x1d3441[_0x9a3d('0xe1')](_0x3c3ef9);}})[_0x9a3d('0x21')](function(_0x44192a){if(_0x44192a){_0x9794=_0x44192a[_0x9a3d('0x55')];if(!_0x3d0f66['query'][_0x9a3d('0xdc')](_0x9a3d('0xdd'))){_0x3c3ef9['limit']=qs['limit'](_0x3d0f66[_0x9a3d('0x4e')][_0x9a3d('0x1c')]);_0x3c3ef9['offset']=qs['offset'](_0x3d0f66['query'][_0x9a3d('0x1a')]);}return _0x1d3441[_0x9a3d('0xe1')](_0x3c3ef9);}})['then'](function(_0x3267cc){if(_0x3267cc){return _0x3267cc?{'count':_0x9794,'rows':_0x3267cc}:null;}})[_0x9a3d('0x21')](respondWithResult(_0x164276,null))['catch'](handleError(_0x164276,null));};exports[_0x9a3d('0xe2')]=function(_0x55300d,_0x13e8c9){var _0x335b5f={};var _0x13594={};var _0x180867;var _0x25a785;return db['User'][_0x9a3d('0x98')]({'where':{'id':_0x55300d[_0x9a3d('0x65')]['id']}})[_0x9a3d('0x21')](handleEntityNotFound(_0x13e8c9,null))[_0x9a3d('0x21')](function(_0x58aca4){if(_0x58aca4){_0x180867=_0x58aca4;_0x13594['model']=_['keys'](db[_0x9a3d('0xe3')][_0x9a3d('0x41')]);_0x13594[_0x9a3d('0x4e')]=_[_0x9a3d('0xd5')](_0x55300d[_0x9a3d('0x4e')]);_0x13594[_0x9a3d('0xd8')]=_['intersection'](_0x13594[_0x9a3d('0xd4')],_0x13594[_0x9a3d('0x4e')]);_0x335b5f[_0x9a3d('0x51')]=_[_0x9a3d('0xd6')](_0x13594[_0x9a3d('0xd4')],qs[_0x9a3d('0xd7')](_0x55300d[_0x9a3d('0x4e')][_0x9a3d('0xd7')]));_0x335b5f[_0x9a3d('0x51')]=_0x335b5f['attributes'][_0x9a3d('0x55')]?_0x335b5f[_0x9a3d('0x51')]:_0x13594[_0x9a3d('0xd4')];_0x335b5f[_0x9a3d('0xde')]=qs[_0x9a3d('0xdf')](_0x55300d[_0x9a3d('0x4e')][_0x9a3d('0xdf')]);_0x335b5f['where']=qs[_0x9a3d('0xd8')](_[_0x9a3d('0xe0')](_0x55300d[_0x9a3d('0x4e')],_0x13594[_0x9a3d('0xd8')]));if(_0x55300d[_0x9a3d('0x4e')][_0x9a3d('0x36')]){_0x335b5f[_0x9a3d('0x4d')]=_[_0x9a3d('0xd9')](_0x335b5f[_0x9a3d('0x4d')],{'$or':_[_0x9a3d('0x38')](_0x335b5f[_0x9a3d('0x51')],function(_0x950857){var _0x3cc699={};_0x3cc699[_0x950857]={'$like':'%'+_0x55300d['query'][_0x9a3d('0x36')]+'%'};return _0x3cc699;})});}_0x335b5f=_[_0x9a3d('0xd9')]({},_0x335b5f,_0x55300d[_0x9a3d('0x63')]);return _0x180867['getGroups'](_0x335b5f);}})['then'](function(_0x5d999c){if(_0x5d999c){_0x25a785=_0x5d999c[_0x9a3d('0x55')];if(!_0x55300d[_0x9a3d('0x4e')]['hasOwnProperty'](_0x9a3d('0xdd'))){_0x335b5f['limit']=qs[_0x9a3d('0x1c')](_0x55300d[_0x9a3d('0x4e')]['limit']);_0x335b5f[_0x9a3d('0x1a')]=qs['offset'](_0x55300d['query'][_0x9a3d('0x1a')]);}return _0x180867['getGroups'](_0x335b5f);}})['then'](function(_0x2669f1){if(_0x2669f1){return _0x2669f1?{'count':_0x25a785,'rows':_0x2669f1}:null;}})[_0x9a3d('0x21')](respondWithResult(_0x13e8c9,null))[_0x9a3d('0x5e')](handleError(_0x13e8c9,null));};exports[_0x9a3d('0xe4')]=function(_0x5f03d1,_0x313f59){var _0x4b0133={'raw':!![],'where':{}};var _0x5478af={};var _0x26a22b={'count':0x0,'rows':[]};return db['User']['findOne']({'where':{'id':_0x5f03d1[_0x9a3d('0x65')]['id']}})['then'](handleEntityNotFound(_0x313f59,null))['then'](function(_0x73cc8){if(_0x73cc8){_0x5478af[_0x9a3d('0xd4')]=_[_0x9a3d('0xd5')](db[_0x9a3d('0xe5')]['rawAttributes']);_0x5478af[_0x9a3d('0x4e')]=_['keys'](_0x5f03d1['query']);_0x5478af[_0x9a3d('0xd8')]=_['intersection'](_0x5478af[_0x9a3d('0xd4')],_0x5478af[_0x9a3d('0x4e')]);_0x4b0133['attributes']=_['intersection'](_0x5478af[_0x9a3d('0xd4')],qs[_0x9a3d('0xd7')](_0x5f03d1[_0x9a3d('0x4e')][_0x9a3d('0xd7')]));_0x4b0133[_0x9a3d('0x51')]=_0x4b0133[_0x9a3d('0x51')][_0x9a3d('0x55')]?_0x4b0133['attributes']:_0x5478af[_0x9a3d('0xd4')];if(!_0x5f03d1['query'][_0x9a3d('0xdc')](_0x9a3d('0xdd'))){_0x4b0133[_0x9a3d('0x1c')]=qs[_0x9a3d('0x1c')](_0x5f03d1[_0x9a3d('0x4e')][_0x9a3d('0x1c')]);_0x4b0133[_0x9a3d('0x1a')]=qs[_0x9a3d('0x1a')](_0x5f03d1[_0x9a3d('0x4e')][_0x9a3d('0x1a')]);}_0x4b0133[_0x9a3d('0xde')]=qs['sort'](_0x5f03d1[_0x9a3d('0x4e')][_0x9a3d('0xdf')]);_0x4b0133[_0x9a3d('0x4d')]=qs[_0x9a3d('0xd8')](_[_0x9a3d('0xe0')](_0x5f03d1[_0x9a3d('0x4e')],_0x5478af[_0x9a3d('0xd8')]));_0x4b0133[_0x9a3d('0x4d')]['UserId']=_0x73cc8['id'];if(_0x5f03d1[_0x9a3d('0x4e')][_0x9a3d('0x36')]){_0x4b0133[_0x9a3d('0x4d')]=_[_0x9a3d('0xd9')](_0x4b0133[_0x9a3d('0x4d')],{'$or':_[_0x9a3d('0x38')](_0x4b0133[_0x9a3d('0x51')],function(_0x17c044){var _0x574bb9={};_0x574bb9[_0x17c044]={'$like':'%'+_0x5f03d1[_0x9a3d('0x4e')][_0x9a3d('0x36')]+'%'};return _0x574bb9;})});}_0x4b0133=_[_0x9a3d('0xd9')]({},_0x4b0133,_0x5f03d1[_0x9a3d('0x63')]);return db[_0x9a3d('0xe5')]['count']({'where':_0x4b0133[_0x9a3d('0x4d')]})[_0x9a3d('0x21')](function(_0x47adc1){_0x26a22b[_0x9a3d('0x1d')]=_0x47adc1;if(_0x5f03d1['query']['includeAll']){_0x4b0133['include']=[{'all':!![]}];}return db[_0x9a3d('0xe5')][_0x9a3d('0x53')](_0x4b0133);})['then'](function(_0x4ebdc7){_0x26a22b[_0x9a3d('0x54')]=_0x4ebdc7;return _0x26a22b;});}})[_0x9a3d('0x21')](respondWithFilteredResult(_0x313f59,_0x4b0133))[_0x9a3d('0x5e')](handleError(_0x313f59,null));};exports[_0x9a3d('0xe6')]=function(_0x4c05cc,_0x42a839){var _0x538275={'raw':!![],'where':{}};var _0x5401c4={};var _0x17e8af={'count':0x0,'rows':[]};return db[_0x9a3d('0x40')][_0x9a3d('0x98')]({'where':{'id':_0x4c05cc[_0x9a3d('0x65')]['id']}})[_0x9a3d('0x21')](handleEntityNotFound(_0x42a839,null))[_0x9a3d('0x21')](function(_0x24616d){if(_0x24616d){_0x5401c4[_0x9a3d('0xd4')]=_['keys'](db['ScreenRecording'][_0x9a3d('0x41')]);_0x5401c4[_0x9a3d('0x4e')]=_[_0x9a3d('0xd5')](_0x4c05cc[_0x9a3d('0x4e')]);_0x5401c4[_0x9a3d('0xd8')]=_[_0x9a3d('0xd6')](_0x5401c4[_0x9a3d('0xd4')],_0x5401c4[_0x9a3d('0x4e')]);_0x538275['attributes']=_[_0x9a3d('0xd6')](_0x5401c4[_0x9a3d('0xd4')],qs[_0x9a3d('0xd7')](_0x4c05cc[_0x9a3d('0x4e')][_0x9a3d('0xd7')]));_0x538275[_0x9a3d('0x51')]=_0x538275[_0x9a3d('0x51')]['length']?_0x538275['attributes']:_0x5401c4[_0x9a3d('0xd4')];if(!_0x4c05cc[_0x9a3d('0x4e')][_0x9a3d('0xdc')](_0x9a3d('0xdd'))){_0x538275[_0x9a3d('0x1c')]=qs[_0x9a3d('0x1c')](_0x4c05cc[_0x9a3d('0x4e')]['limit']);_0x538275[_0x9a3d('0x1a')]=qs['offset'](_0x4c05cc[_0x9a3d('0x4e')]['offset']);}_0x538275['order']=qs[_0x9a3d('0xdf')](_0x4c05cc[_0x9a3d('0x4e')][_0x9a3d('0xdf')]);_0x538275[_0x9a3d('0x4d')]=qs[_0x9a3d('0xd8')](_[_0x9a3d('0xe0')](_0x4c05cc['query'],_0x5401c4[_0x9a3d('0xd8')]));_0x538275['where'][_0x9a3d('0xe7')]=_0x24616d['id'];if(_0x4c05cc['query'][_0x9a3d('0x36')]){_0x538275[_0x9a3d('0x4d')]=_[_0x9a3d('0xd9')](_0x538275[_0x9a3d('0x4d')],{'$or':_['map'](_0x538275[_0x9a3d('0x51')],function(_0x17e3dd){var _0x56ccc4={};_0x56ccc4[_0x17e3dd]={'$like':'%'+_0x4c05cc[_0x9a3d('0x4e')][_0x9a3d('0x36')]+'%'};return _0x56ccc4;})});}_0x538275=_[_0x9a3d('0xd9')]({},_0x538275,_0x4c05cc[_0x9a3d('0x63')]);return db['ScreenRecording'][_0x9a3d('0x1d')]({'where':_0x538275[_0x9a3d('0x4d')]})['then'](function(_0x7c8b07){_0x17e8af[_0x9a3d('0x1d')]=_0x7c8b07;if(_0x4c05cc[_0x9a3d('0x4e')]['includeAll']){_0x538275[_0x9a3d('0x50')]=[{'all':!![]}];}return db[_0x9a3d('0xe8')][_0x9a3d('0x53')](_0x538275);})[_0x9a3d('0x21')](function(_0x1be08c){_0x17e8af[_0x9a3d('0x54')]=_0x1be08c;return _0x17e8af;});}})[_0x9a3d('0x21')](respondWithFilteredResult(_0x42a839,_0x538275))[_0x9a3d('0x5e')](handleError(_0x42a839,null));};exports[_0x9a3d('0xe9')]=function(_0xe477fa,_0x2b2186){var _0x14621a={};var _0x34df5c={};var _0xa3240a;var _0x3f7f44;return db[_0x9a3d('0x40')][_0x9a3d('0x98')]({'where':{'id':_0xe477fa[_0x9a3d('0x65')]['id']}})[_0x9a3d('0x21')](handleEntityNotFound(_0x2b2186,null))[_0x9a3d('0x21')](function(_0x3d6c8f){if(_0x3d6c8f){_0xa3240a=_0x3d6c8f;_0x34df5c['model']=_[_0x9a3d('0xd5')](db[_0x9a3d('0xea')][_0x9a3d('0x41')]);_0x34df5c[_0x9a3d('0x4e')]=_['keys'](_0xe477fa[_0x9a3d('0x4e')]);_0x34df5c['filters']=_[_0x9a3d('0xd6')](_0x34df5c['model'],_0x34df5c['query']);_0x14621a[_0x9a3d('0x51')]=_[_0x9a3d('0xd6')](_0x34df5c[_0x9a3d('0xd4')],qs[_0x9a3d('0xd7')](_0xe477fa[_0x9a3d('0x4e')]['fields']));_0x14621a[_0x9a3d('0x51')]=_0x14621a[_0x9a3d('0x51')][_0x9a3d('0x55')]?_0x14621a[_0x9a3d('0x51')]:_0x34df5c[_0x9a3d('0xd4')];_0x14621a[_0x9a3d('0xde')]=qs[_0x9a3d('0xdf')](_0xe477fa[_0x9a3d('0x4e')][_0x9a3d('0xdf')]);_0x14621a[_0x9a3d('0x4d')]=qs['filters'](_['pick'](_0xe477fa[_0x9a3d('0x4e')],_0x34df5c[_0x9a3d('0xd8')]));if(_0xe477fa[_0x9a3d('0x4e')][_0x9a3d('0x36')]){_0x14621a[_0x9a3d('0x4d')]=_[_0x9a3d('0xd9')](_0x14621a[_0x9a3d('0x4d')],{'$or':_[_0x9a3d('0x38')](_0x14621a[_0x9a3d('0x51')],function(_0x371e8c){var _0x3303ae={};_0x3303ae[_0x371e8c]={'$like':'%'+_0xe477fa['query']['filter']+'%'};return _0x3303ae;})});}_0x14621a=_[_0x9a3d('0xd9')]({},_0x14621a,_0xe477fa[_0x9a3d('0x63')]);return _0xa3240a[_0x9a3d('0xe9')](_0x14621a);}})['then'](function(_0x3959be){if(_0x3959be){_0x3f7f44=_0x3959be[_0x9a3d('0x55')];if(!_0xe477fa[_0x9a3d('0x4e')][_0x9a3d('0xdc')](_0x9a3d('0xdd'))){_0x14621a[_0x9a3d('0x1c')]=qs[_0x9a3d('0x1c')](_0xe477fa[_0x9a3d('0x4e')]['limit']);_0x14621a['offset']=qs[_0x9a3d('0x1a')](_0xe477fa['query'][_0x9a3d('0x1a')]);}return _0xa3240a[_0x9a3d('0xe9')](_0x14621a);}})[_0x9a3d('0x21')](function(_0x512dd4){if(_0x512dd4){return _0x512dd4?{'count':_0x3f7f44,'rows':_0x512dd4}:null;}})[_0x9a3d('0x21')](respondWithResult(_0x2b2186,null))[_0x9a3d('0x5e')](handleError(_0x2b2186,null));};exports['getOpenchannelInteractions']=function(_0x1cea5d,_0x40c342){var _0x405313={};var _0x570fd9={};var _0x21f820;var _0x522b1b;return db[_0x9a3d('0x40')][_0x9a3d('0x98')]({'where':{'id':_0x1cea5d[_0x9a3d('0x65')]['id']}})['then'](handleEntityNotFound(_0x40c342,null))[_0x9a3d('0x21')](function(_0x3ff241){if(_0x3ff241){_0x21f820=_0x3ff241;_0x570fd9[_0x9a3d('0xd4')]=_[_0x9a3d('0xd5')](db[_0x9a3d('0xeb')][_0x9a3d('0x41')]);_0x570fd9[_0x9a3d('0x4e')]=_[_0x9a3d('0xd5')](_0x1cea5d[_0x9a3d('0x4e')]);_0x570fd9[_0x9a3d('0xd8')]=_['intersection'](_0x570fd9[_0x9a3d('0xd4')],_0x570fd9[_0x9a3d('0x4e')]);_0x405313['attributes']=_[_0x9a3d('0xd6')](_0x570fd9[_0x9a3d('0xd4')],qs[_0x9a3d('0xd7')](_0x1cea5d[_0x9a3d('0x4e')][_0x9a3d('0xd7')]));_0x405313[_0x9a3d('0x51')]=_0x405313['attributes'][_0x9a3d('0x55')]?_0x405313[_0x9a3d('0x51')]:_0x570fd9['model'];_0x405313[_0x9a3d('0xde')]=qs['sort'](_0x1cea5d[_0x9a3d('0x4e')][_0x9a3d('0xdf')]);_0x405313[_0x9a3d('0x4d')]=qs[_0x9a3d('0xd8')](_['pick'](_0x1cea5d[_0x9a3d('0x4e')],_0x570fd9[_0x9a3d('0xd8')]));if(_0x1cea5d[_0x9a3d('0x4e')][_0x9a3d('0x36')]){_0x405313[_0x9a3d('0x4d')]=_['merge'](_0x405313[_0x9a3d('0x4d')],{'$or':_[_0x9a3d('0x38')](_0x405313['attributes'],function(_0x246d44){var _0x3a0244={};_0x3a0244[_0x246d44]={'$like':'%'+_0x1cea5d[_0x9a3d('0x4e')]['filter']+'%'};return _0x3a0244;})});}_0x405313=_[_0x9a3d('0xd9')]({},_0x405313,_0x1cea5d[_0x9a3d('0x63')]);return _0x21f820[_0x9a3d('0xec')](_0x405313);}})[_0x9a3d('0x21')](function(_0x431999){if(_0x431999){_0x522b1b=_0x431999[_0x9a3d('0x55')];if(!_0x1cea5d[_0x9a3d('0x4e')]['hasOwnProperty'](_0x9a3d('0xdd'))){_0x405313[_0x9a3d('0x1c')]=qs['limit'](_0x1cea5d[_0x9a3d('0x4e')][_0x9a3d('0x1c')]);_0x405313[_0x9a3d('0x1a')]=qs[_0x9a3d('0x1a')](_0x1cea5d['query']['offset']);}return _0x21f820[_0x9a3d('0xec')](_0x405313);}})[_0x9a3d('0x21')](function(_0x4de79b){if(_0x4de79b){return _0x4de79b?{'count':_0x522b1b,'rows':_0x4de79b}:null;}})[_0x9a3d('0x21')](respondWithResult(_0x40c342,null))[_0x9a3d('0x5e')](handleError(_0x40c342,null));};exports[_0x9a3d('0xed')]=function(_0x47d120,_0x4c1e65){var _0x227f17={'raw':!![],'where':{}};var _0x8f3da4={};var _0x220f2d={'count':0x0,'rows':[]};return db[_0x9a3d('0x40')][_0x9a3d('0x98')]({'where':{'id':_0x47d120[_0x9a3d('0x65')]['id']}})['then'](handleEntityNotFound(_0x4c1e65,null))[_0x9a3d('0x21')](function(_0x2b1223){if(_0x2b1223){_0x8f3da4[_0x9a3d('0xd4')]=_['keys'](db[_0x9a3d('0xee')][_0x9a3d('0x41')]);_0x8f3da4[_0x9a3d('0x4e')]=_['keys'](_0x47d120[_0x9a3d('0x4e')]);_0x8f3da4[_0x9a3d('0xd8')]=_[_0x9a3d('0xd6')](_0x8f3da4['model'],_0x8f3da4[_0x9a3d('0x4e')]);_0x227f17[_0x9a3d('0x51')]=_['intersection'](_0x8f3da4[_0x9a3d('0xd4')],qs[_0x9a3d('0xd7')](_0x47d120[_0x9a3d('0x4e')]['fields']));_0x227f17['attributes']=_0x227f17[_0x9a3d('0x51')][_0x9a3d('0x55')]?_0x227f17[_0x9a3d('0x51')]:_0x8f3da4[_0x9a3d('0xd4')];if(!_0x47d120[_0x9a3d('0x4e')]['hasOwnProperty'](_0x9a3d('0xdd'))){_0x227f17[_0x9a3d('0x1c')]=qs['limit'](_0x47d120['query'][_0x9a3d('0x1c')]);_0x227f17[_0x9a3d('0x1a')]=qs[_0x9a3d('0x1a')](_0x47d120[_0x9a3d('0x4e')][_0x9a3d('0x1a')]);}_0x227f17[_0x9a3d('0xde')]=qs[_0x9a3d('0xdf')](_0x47d120[_0x9a3d('0x4e')][_0x9a3d('0xdf')]);_0x227f17['where']=qs['filters'](_[_0x9a3d('0xe0')](_0x47d120['query'],_0x8f3da4[_0x9a3d('0xd8')]));_0x227f17[_0x9a3d('0x4d')][_0x9a3d('0xe7')]=_0x2b1223['id'];if(_0x47d120[_0x9a3d('0x4e')]['filter']){_0x227f17['where']=_['merge'](_0x227f17['where'],{'$or':_['map'](_0x227f17['attributes'],function(_0x5b8447){var _0x455888={};_0x455888[_0x5b8447]={'$like':'%'+_0x47d120[_0x9a3d('0x4e')][_0x9a3d('0x36')]+'%'};return _0x455888;})});}_0x227f17=_[_0x9a3d('0xd9')]({},_0x227f17,_0x47d120[_0x9a3d('0x63')]);return db[_0x9a3d('0xee')][_0x9a3d('0x1d')]({'where':_0x227f17[_0x9a3d('0x4d')]})[_0x9a3d('0x21')](function(_0x49a525){_0x220f2d[_0x9a3d('0x1d')]=_0x49a525;if(_0x47d120[_0x9a3d('0x4e')]['includeAll']){_0x227f17[_0x9a3d('0x50')]=[{'all':!![]}];}return db[_0x9a3d('0xee')][_0x9a3d('0x53')](_0x227f17);})[_0x9a3d('0x21')](function(_0x1ea6ba){_0x220f2d[_0x9a3d('0x54')]=_0x1ea6ba;return _0x220f2d;});}})[_0x9a3d('0x21')](respondWithFilteredResult(_0x4c1e65,_0x227f17))[_0x9a3d('0x5e')](handleError(_0x4c1e65,null));};exports[_0x9a3d('0xef')]=function(_0x12224e,_0x4bfbb3){var _0x75e195={};var _0x51e62a={};var _0x19237a;var _0x4d7dbe;return db[_0x9a3d('0x40')][_0x9a3d('0x98')]({'where':{'id':_0x12224e[_0x9a3d('0x65')]['id']}})[_0x9a3d('0x21')](handleEntityNotFound(_0x4bfbb3,null))[_0x9a3d('0x21')](function(_0x45163a){if(_0x45163a){_0x19237a=_0x45163a;_0x51e62a[_0x9a3d('0xd4')]=_[_0x9a3d('0xd5')](db[_0x9a3d('0xf0')][_0x9a3d('0x41')]);_0x51e62a[_0x9a3d('0x4e')]=_[_0x9a3d('0xd5')](_0x12224e['query']);_0x51e62a[_0x9a3d('0xd8')]=_[_0x9a3d('0xd6')](_0x51e62a[_0x9a3d('0xd4')],_0x51e62a[_0x9a3d('0x4e')]);_0x75e195[_0x9a3d('0x51')]=_['intersection'](_0x51e62a[_0x9a3d('0xd4')],qs['fields'](_0x12224e[_0x9a3d('0x4e')][_0x9a3d('0xd7')]));_0x75e195[_0x9a3d('0x51')]=_0x75e195[_0x9a3d('0x51')][_0x9a3d('0x55')]?_0x75e195[_0x9a3d('0x51')]:_0x51e62a['model'];_0x75e195[_0x9a3d('0xde')]=qs[_0x9a3d('0xdf')](_0x12224e[_0x9a3d('0x4e')][_0x9a3d('0xdf')]);_0x75e195['where']=qs['filters'](_[_0x9a3d('0xe0')](_0x12224e['query'],_0x51e62a['filters']));if(_0x12224e[_0x9a3d('0x4e')][_0x9a3d('0x36')]){_0x75e195[_0x9a3d('0x4d')]=_['merge'](_0x75e195['where'],{'$or':_['map'](_0x75e195['attributes'],function(_0x5dd99f){var _0x2b8d05={};_0x2b8d05[_0x5dd99f]={'$like':'%'+_0x12224e['query'][_0x9a3d('0x36')]+'%'};return _0x2b8d05;})});}_0x75e195=_[_0x9a3d('0xd9')]({},_0x75e195,_0x12224e[_0x9a3d('0x63')]);return _0x19237a[_0x9a3d('0xef')](_0x75e195);}})[_0x9a3d('0x21')](function(_0x5793c3){if(_0x5793c3){_0x4d7dbe=_0x5793c3[_0x9a3d('0x55')];if(!_0x12224e[_0x9a3d('0x4e')][_0x9a3d('0xdc')](_0x9a3d('0xdd'))){_0x75e195['limit']=qs[_0x9a3d('0x1c')](_0x12224e[_0x9a3d('0x4e')][_0x9a3d('0x1c')]);_0x75e195[_0x9a3d('0x1a')]=qs['offset'](_0x12224e[_0x9a3d('0x4e')][_0x9a3d('0x1a')]);}return _0x19237a[_0x9a3d('0xef')](_0x75e195);}})[_0x9a3d('0x21')](function(_0x53b1a6){if(_0x53b1a6){return _0x53b1a6?{'count':_0x4d7dbe,'rows':_0x53b1a6}:null;}})[_0x9a3d('0x21')](respondWithResult(_0x4bfbb3,null))[_0x9a3d('0x5e')](handleError(_0x4bfbb3,null));};exports['getFaxInteractions']=function(_0x2b39e9,_0x9324ef){var _0x33d7be={};var _0x3c8bec={};var _0x44b826;var _0x50b6e9;return db[_0x9a3d('0x40')]['findOne']({'where':{'id':_0x2b39e9['params']['id']}})[_0x9a3d('0x21')](handleEntityNotFound(_0x9324ef,null))[_0x9a3d('0x21')](function(_0xe7f9a6){if(_0xe7f9a6){_0x44b826=_0xe7f9a6;_0x3c8bec[_0x9a3d('0xd4')]=_[_0x9a3d('0xd5')](db[_0x9a3d('0xf1')]['rawAttributes']);_0x3c8bec[_0x9a3d('0x4e')]=_[_0x9a3d('0xd5')](_0x2b39e9[_0x9a3d('0x4e')]);_0x3c8bec['filters']=_[_0x9a3d('0xd6')](_0x3c8bec[_0x9a3d('0xd4')],_0x3c8bec[_0x9a3d('0x4e')]);_0x33d7be[_0x9a3d('0x51')]=_[_0x9a3d('0xd6')](_0x3c8bec[_0x9a3d('0xd4')],qs['fields'](_0x2b39e9['query'][_0x9a3d('0xd7')]));_0x33d7be['attributes']=_0x33d7be[_0x9a3d('0x51')][_0x9a3d('0x55')]?_0x33d7be[_0x9a3d('0x51')]:_0x3c8bec[_0x9a3d('0xd4')];_0x33d7be[_0x9a3d('0xde')]=qs[_0x9a3d('0xdf')](_0x2b39e9[_0x9a3d('0x4e')][_0x9a3d('0xdf')]);_0x33d7be[_0x9a3d('0x4d')]=qs['filters'](_[_0x9a3d('0xe0')](_0x2b39e9[_0x9a3d('0x4e')],_0x3c8bec['filters']));if(_0x2b39e9[_0x9a3d('0x4e')]['filter']){_0x33d7be['where']=_[_0x9a3d('0xd9')](_0x33d7be[_0x9a3d('0x4d')],{'$or':_[_0x9a3d('0x38')](_0x33d7be['attributes'],function(_0x135b17){var _0x8f6ac4={};_0x8f6ac4[_0x135b17]={'$like':'%'+_0x2b39e9[_0x9a3d('0x4e')]['filter']+'%'};return _0x8f6ac4;})});}_0x33d7be=_[_0x9a3d('0xd9')]({},_0x33d7be,_0x2b39e9[_0x9a3d('0x63')]);return _0x44b826['getFaxInteractions'](_0x33d7be);}})['then'](function(_0x25abfa){if(_0x25abfa){_0x50b6e9=_0x25abfa['length'];if(!_0x2b39e9[_0x9a3d('0x4e')]['hasOwnProperty'](_0x9a3d('0xdd'))){_0x33d7be['limit']=qs[_0x9a3d('0x1c')](_0x2b39e9[_0x9a3d('0x4e')][_0x9a3d('0x1c')]);_0x33d7be[_0x9a3d('0x1a')]=qs[_0x9a3d('0x1a')](_0x2b39e9[_0x9a3d('0x4e')]['offset']);}return _0x44b826['getFaxInteractions'](_0x33d7be);}})[_0x9a3d('0x21')](function(_0x48cbd4){if(_0x48cbd4){return _0x48cbd4?{'count':_0x50b6e9,'rows':_0x48cbd4}:null;}})['then'](respondWithResult(_0x9324ef,null))[_0x9a3d('0x5e')](handleError(_0x9324ef,null));};exports[_0x9a3d('0xf2')]=function(_0x57da81,_0x24bcdd){var _0x15bc72={};var _0xe7ec50={};var _0x3bc40a;var _0x2dc8c0;return db[_0x9a3d('0x40')][_0x9a3d('0x98')]({'where':{'id':_0x57da81[_0x9a3d('0x65')]['id']}})[_0x9a3d('0x21')](handleEntityNotFound(_0x24bcdd,null))[_0x9a3d('0x21')](function(_0x1b21fd){if(_0x1b21fd){_0x3bc40a=_0x1b21fd;_0xe7ec50[_0x9a3d('0xd4')]=_[_0x9a3d('0xd5')](db[_0x9a3d('0xf3')][_0x9a3d('0x41')]);_0xe7ec50[_0x9a3d('0x4e')]=_[_0x9a3d('0xd5')](_0x57da81['query']);_0xe7ec50[_0x9a3d('0xd8')]=_[_0x9a3d('0xd6')](_0xe7ec50[_0x9a3d('0xd4')],_0xe7ec50[_0x9a3d('0x4e')]);_0x15bc72[_0x9a3d('0x51')]=_[_0x9a3d('0xd6')](_0xe7ec50[_0x9a3d('0xd4')],qs[_0x9a3d('0xd7')](_0x57da81[_0x9a3d('0x4e')][_0x9a3d('0xd7')]));_0x15bc72[_0x9a3d('0x51')]=_0x15bc72[_0x9a3d('0x51')][_0x9a3d('0x55')]?_0x15bc72[_0x9a3d('0x51')]:_0xe7ec50[_0x9a3d('0xd4')];_0x15bc72['order']=qs[_0x9a3d('0xdf')](_0x57da81[_0x9a3d('0x4e')][_0x9a3d('0xdf')]);_0x15bc72[_0x9a3d('0x4d')]=qs[_0x9a3d('0xd8')](_[_0x9a3d('0xe0')](_0x57da81['query'],_0xe7ec50[_0x9a3d('0xd8')]));if(_0x57da81[_0x9a3d('0x4e')][_0x9a3d('0x36')]){_0x15bc72[_0x9a3d('0x4d')]=_['merge'](_0x15bc72['where'],{'$or':_['map'](_0x15bc72['attributes'],function(_0x5dbdf7){var _0x416690={};_0x416690[_0x5dbdf7]={'$like':'%'+_0x57da81[_0x9a3d('0x4e')]['filter']+'%'};return _0x416690;})});}_0x15bc72=_[_0x9a3d('0xd9')]({},_0x15bc72,_0x57da81['options']);return _0x3bc40a[_0x9a3d('0xf2')](_0x15bc72);}})[_0x9a3d('0x21')](function(_0x5c76c7){if(_0x5c76c7){_0x2dc8c0=_0x5c76c7[_0x9a3d('0x55')];if(!_0x57da81[_0x9a3d('0x4e')]['hasOwnProperty'](_0x9a3d('0xdd'))){_0x15bc72[_0x9a3d('0x1c')]=qs['limit'](_0x57da81[_0x9a3d('0x4e')][_0x9a3d('0x1c')]);_0x15bc72[_0x9a3d('0x1a')]=qs[_0x9a3d('0x1a')](_0x57da81[_0x9a3d('0x4e')][_0x9a3d('0x1a')]);}return _0x3bc40a[_0x9a3d('0xf2')](_0x15bc72);}})[_0x9a3d('0x21')](function(_0x478241){if(_0x478241){return _0x478241?{'count':_0x2dc8c0,'rows':_0x478241}:null;}})[_0x9a3d('0x21')](respondWithResult(_0x24bcdd,null))[_0x9a3d('0x5e')](handleError(_0x24bcdd,null));};exports[_0x9a3d('0xf4')]=function(_0x1d7ccd,_0x1aa943,_0x44cd88){var _0x7f507d;var _0xe55406;var _0x159487;var _0x49f77e=!_[_0x9a3d('0x6d')](_0x1d7ccd[_0x9a3d('0x65')]['id'])?_0x1d7ccd[_0x9a3d('0x65')]['id']:!_[_0x9a3d('0x6d')](_0x1d7ccd[_0x9a3d('0x32')]['id'])?_0x1d7ccd[_0x9a3d('0x32')]['id']:null;return db[_0x9a3d('0x40')][_0x9a3d('0x3a')]({'where':{'id':_0x49f77e,'role':{'$or':[_0x9a3d('0x83'),_0x9a3d('0x32'),_0x9a3d('0x2d')]}},'attributes':['id','name','phone',_0x9a3d('0xf5'),_0x9a3d('0x2c'),_0x9a3d('0x68'),_0x9a3d('0x9d')]})['then'](function(_0x2f45b9){if(_0x2f45b9){if(_0x2f45b9[_0x9a3d('0x2c')]===_0x9a3d('0x2d')){_0x7f507d=_0x2f45b9;if(_0x1d7ccd[_0x9a3d('0x64')][_0x9a3d('0xad')]){_0x159487=util[_0x9a3d('0xcc')]('LOCAL/%s@from-sip/n',_0x7f507d[_0x1d7ccd[_0x9a3d('0x64')]['interface']]);}else if(_0x1d7ccd['body'][_0x9a3d('0xf6')]){_0x159487=util['format']('SIP/%s',_0x1d7ccd[_0x9a3d('0x64')][_0x9a3d('0xf6')]);}else{_0x159487=util[_0x9a3d('0xcc')](_0x9a3d('0xae'),_0x7f507d[_0x9a3d('0x3b')]);}socket['to'](util['format'](_0x9a3d('0xf7'),_0x7f507d['name']))[_0x9a3d('0xa8')](_0x9a3d('0xf8'),{'user':{'id':_0x7f507d['id'],'name':_0x7f507d[_0x9a3d('0x3b')]},'ip':_0x1d7ccd[_0x9a3d('0xf9')][_0x9a3d('0xfa')]||_0x1d7ccd[_0x9a3d('0xfb')][_0x9a3d('0xfc')]||_0x1d7ccd[_0x9a3d('0xfd')][_0x9a3d('0xfc')]||_0x1d7ccd[_0x9a3d('0xfb')]['socket'][_0x9a3d('0xfc')]});return db['UserVoiceQueueRt']['destroy']({'where':{'membername':_0x7f507d[_0x9a3d('0x3b')]},'individualHooks':!![]});}}else{throw new db[(_0x9a3d('0x94'))][(_0x9a3d('0x91'))](_0x9a3d('0xfe'));}})['then'](function(){if(_0x7f507d){return _0x7f507d[_0x9a3d('0xff')]({'raw':!![]});}})[_0x9a3d('0x21')](function(_0x5ec79b){if(_0x7f507d){if(_0x5ec79b){_0xe55406=_0x5ec79b;if(_0xe55406['length']){var _0x1cb26e=_0xe55406[_0x9a3d('0x38')](function(_0x4f2cca){var _0x27359f={'membername':_0x7f507d[_0x9a3d('0x3b')],'UserId':_0x7f507d['id'],'queue_name':_0x4f2cca['name'],'VoiceQueueId':_0x4f2cca['id'],'interface':_0x159487,'paused':_0x7f507d[_0x9a3d('0x9d')]||![],'penalty':_0x4f2cca[_0x9a3d('0x100')]||0x0};return db['UserVoiceQueueRt'][_0x9a3d('0x101')](_0x27359f);});return Promise[_0x9a3d('0x5d')](_0x1cb26e);}}}})[_0x9a3d('0x21')](function(){if(_0x7f507d){return db['MemberReport']['findAll']({'where':{'membername':_0x7f507d['name'],'exitAt':null}});}})['then'](function(_0x14ab6e){if(_0x7f507d){var _0x119388=[];_0x14ab6e[_0x9a3d('0x102')](function(_0x1dc1a2){_0x119388[_0x9a3d('0x52')](_0x1dc1a2[_0x9a3d('0x2b')]({'exitAt':moment()[_0x9a3d('0xcc')]('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise[_0x9a3d('0x5d')](_0x119388);}})[_0x9a3d('0x21')](function(){if(_0x7f507d){var _0x439745=[];var _0x5d8db1=[];var _0x9722e0=utils[_0x9a3d('0x103')]();var _0x3f3868={'membername':_0x7f507d[_0x9a3d('0x3b')],'interface':_0x159487,'enterAt':moment()[_0x9a3d('0xcc')](_0x9a3d('0x104')),'role':_0x7f507d['role'],'internal':_0x7f507d[_0x9a3d('0x68')]};_0x9722e0[_0x9a3d('0x102')](function(_0xe1131d){_0x439745[_0x9a3d('0x52')](_[_0x9a3d('0xd9')]({'channel':_0xe1131d,'type':_0x9a3d('0x105'),'data1':_0x1d7ccd[_0x9a3d('0x64')][_0x9a3d('0x106')],'data2':_0x159487},_0x3f3868));if(_0x7f507d[_0x9a3d('0x9d')]){_0x5d8db1['push'](_[_0x9a3d('0xd9')]({'channel':_0xe1131d,'type':_0x9a3d('0x107'),'data1':_0x9a3d('0x108')},_0x3f3868));}});return db[_0x9a3d('0x109')]['bulkCreate'](_0x439745[_0x9a3d('0xca')](_0x5d8db1),{'individualHooks':!![]});}})[_0x9a3d('0x21')](function(){if(_0x7f507d){return _0x7f507d['update']({'online':!![],'lastLoginAt':moment()[_0x9a3d('0xcc')](_0x9a3d('0x104')),'voicePause':_0x7f507d[_0x9a3d('0x9d')]||![],'mailPause':_0x7f507d[_0x9a3d('0x9d')]||![],'chatPause':_0x7f507d[_0x9a3d('0x9d')]||![],'faxPause':_0x7f507d[_0x9a3d('0x9d')]||![],'smsPause':_0x7f507d[_0x9a3d('0x9d')]||![],'openchannelPause':_0x7f507d[_0x9a3d('0x9d')]||![],'whatsappPause':_0x7f507d[_0x9a3d('0x9d')]||![],'pauseType':_0x7f507d[_0x9a3d('0x9d')]?'LOGININPAUSE':null,'interface':_0x159487,'lastPauseAt':moment()[_0x9a3d('0xcc')](_0x9a3d('0x104'))});}})[_0x9a3d('0x21')](function(_0x3517be){if(_0x1d7ccd['isMiddleware']){return _0x44cd88();}else{return Promise[_0x9a3d('0x10a')](_0x3517be)[_0x9a3d('0x21')](respondWithResult(_0x1aa943,null));}})[_0x9a3d('0x5e')](handleError(_0x1aa943,null));};exports['logout']=function(_0x277516,_0x45430a){var _0x223cd1;return db[_0x9a3d('0x40')]['find']({'where':{'id':_0x277516[_0x9a3d('0x65')]['id'],'role':_0x9a3d('0x2d')},'attributes':['id',_0x9a3d('0x3b'),_0x9a3d('0x2c')]})[_0x9a3d('0x21')](handleEntityNotFound(_0x45430a,null))[_0x9a3d('0x21')](function(_0x41e3bf){if(_0x41e3bf){_0x223cd1=_0x41e3bf;return db[_0x9a3d('0xb4')][_0x9a3d('0x2f')]({'where':{'membername':_0x223cd1[_0x9a3d('0x3b')]},'individualHooks':!![]});}})[_0x9a3d('0x21')](function(){return db['MemberReport'][_0x9a3d('0x53')]({'where':{'membername':_0x223cd1[_0x9a3d('0x3b')],'exitAt':null}});})[_0x9a3d('0x21')](function(_0x4a8d53){var _0x2ee396=[];_0x4a8d53['forEach'](function(_0x5a5c1a){_0x2ee396[_0x9a3d('0x52')](_0x5a5c1a[_0x9a3d('0x2b')]({'exitAt':moment()[_0x9a3d('0xcc')]('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise[_0x9a3d('0x5d')](_0x2ee396);})[_0x9a3d('0x21')](function(){return _0x223cd1[_0x9a3d('0x2b')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})['then'](respondWithResult(_0x45430a,null))[_0x9a3d('0x5e')](handleError(_0x45430a,null));};exports[_0x9a3d('0x10b')]=function(_0x4fd74e,_0x5b451d){var _0x3a9c2f;return db[_0x9a3d('0xb4')][_0x9a3d('0x2b')]({'paused':0x1},{'where':{'UserId':_0x4fd74e['params']['id']},'individualHooks':!![]})[_0x9a3d('0x21')](function(){return db[_0x9a3d('0x40')][_0x9a3d('0x3a')]({'where':{'id':_0x4fd74e[_0x9a3d('0x65')]['id'],'role':_0x9a3d('0x2d')},'attributes':['id','name',_0x9a3d('0x2c'),_0x9a3d('0x68'),_0x9a3d('0xad'),_0x9a3d('0xac')]});})['then'](handleEntityNotFound(_0x5b451d,null))[_0x9a3d('0x21')](function(_0x3f4850){if(_0x3f4850){_0x3a9c2f=_0x3f4850;return respondWithRpcPromise(_0x9a3d('0x10c'),'pause',{'id':_0x3a9c2f['id'],'name':_0x3a9c2f[_0x9a3d('0x3b')],'pause':!![]});}})['then'](function(){if(_0x3a9c2f){return db[_0x9a3d('0x109')][_0x9a3d('0x53')]({'where':{'membername':_0x3a9c2f[_0x9a3d('0x3b')],'type':_0x9a3d('0x107'),'exitAt':null}});}})[_0x9a3d('0x21')](function(_0x275d83){if(_0x275d83[_0x9a3d('0x55')]){var _0x15d470=moment()[_0x9a3d('0xcc')](_0x9a3d('0x104'));for(var _0x316e81=0x0,_0x4b6dc8=_0x275d83[_0x9a3d('0x55')];_0x316e81<_0x4b6dc8;_0x316e81++){_0x275d83[_0x316e81]['updateAttributes']({'exitAt':_0x15d470});}}})[_0x9a3d('0x21')](function(){var _0x127a6c=[];var _0x2fd671=utils['getChannels']();_0x2fd671[_0x9a3d('0x102')](function(_0x3fc63e){_0x127a6c[_0x9a3d('0x52')]({'channel':_0x3fc63e,'membername':_0x3a9c2f[_0x9a3d('0x3b')],'interface':_[_0x9a3d('0x6d')](_0x3a9c2f[_0x9a3d('0xad')])?util['format'](_0x9a3d('0xae'),_0x3a9c2f[_0x9a3d('0x3b')]):_0x3a9c2f['interface'],'type':'PAUSE','enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x4fd74e[_0x9a3d('0x64')][_0x9a3d('0x43')]||_0x9a3d('0x10d'),'role':_0x3a9c2f[_0x9a3d('0x2c')],'internal':_0x3a9c2f[_0x9a3d('0x68')]});});return db[_0x9a3d('0x109')][_0x9a3d('0x89')](_0x127a6c,{'individualHooks':!![]});})[_0x9a3d('0x21')](function(){return _0x3a9c2f[_0x9a3d('0x2b')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x4fd74e['body']['type']||_0x9a3d('0x10d'),'lastPauseAt':moment()[_0x9a3d('0xcc')](_0x9a3d('0x104'))});})[_0x9a3d('0x21')](respondWithResult(_0x5b451d,null))['catch'](handleError(_0x5b451d,null));};exports['unpause']=function(_0x1880b7,_0x30d0cc){if(_0x1880b7[_0x9a3d('0x64')]['channel']&&!utils['isValidChannel'](_0x1880b7[_0x9a3d('0x64')][_0x9a3d('0x9c')])){throw new APIBadRequestError(util['format']('Channel\x20parameter\x20%s\x20is\x20invalid',_0x1880b7[_0x9a3d('0x64')][_0x9a3d('0x9c')]));}return db[_0x9a3d('0x40')][_0x9a3d('0x3a')]({'where':{'id':_0x1880b7[_0x9a3d('0x65')]['id']},'attributes':['id',_0x9a3d('0x3b'),_0x9a3d('0x2c'),_0x9a3d('0x68'),'interface',_0x9a3d('0xac'),_0x9a3d('0x9e'),_0x9a3d('0x10e'),'chatPause',_0x9a3d('0x10f'),_0x9a3d('0x110'),_0x9a3d('0x111'),_0x9a3d('0x112'),_0x9a3d('0x113'),_0x9a3d('0x114')]})[_0x9a3d('0x21')](function(_0xf9aa13){if(!_0xf9aa13){throw new APINotFoundError(util['format'](_0x9a3d('0xcd'),_0x1880b7[_0x9a3d('0x65')]['id']));}return _0xf9aa13[_0x9a3d('0x115')](_0x1880b7[_0x9a3d('0x64')][_0x9a3d('0x9c')]);})[_0x9a3d('0x21')](respondWithResult(_0x30d0cc,null))['catch'](APIHandleError(_0x30d0cc));};exports[_0x9a3d('0x116')]=function(_0x367e0d,_0x43dd63){var _0x8301ea={};var _0x40bed0={};var _0x36c19c;var _0x2a98e9;return db[_0x9a3d('0x40')][_0x9a3d('0x98')]({'where':{'id':_0x367e0d['params']['id']}})[_0x9a3d('0x21')](handleEntityNotFound(_0x43dd63,null))[_0x9a3d('0x21')](function(_0x11263c){if(_0x11263c){_0x36c19c=_0x11263c;_0x40bed0[_0x9a3d('0xd4')]=_['keys'](db[_0x9a3d('0x117')]['rawAttributes']);_0x40bed0['query']=_[_0x9a3d('0xd5')](_0x367e0d['query']);_0x40bed0[_0x9a3d('0xd8')]=_[_0x9a3d('0xd6')](_0x40bed0['model'],_0x40bed0[_0x9a3d('0x4e')]);_0x8301ea['attributes']=_[_0x9a3d('0xd6')](_0x40bed0[_0x9a3d('0xd4')],qs[_0x9a3d('0xd7')](_0x367e0d[_0x9a3d('0x4e')]['fields']));_0x8301ea['attributes']=_0x8301ea['attributes'][_0x9a3d('0x55')]?_0x8301ea[_0x9a3d('0x51')]:_0x40bed0['model'];_0x8301ea['order']=qs[_0x9a3d('0xdf')](_0x367e0d[_0x9a3d('0x4e')]['sort']);_0x8301ea[_0x9a3d('0x4d')]=qs[_0x9a3d('0xd8')](_[_0x9a3d('0xe0')](_0x367e0d['query'],_0x40bed0['filters']));if(_0x367e0d[_0x9a3d('0x4e')][_0x9a3d('0x36')]){_0x8301ea[_0x9a3d('0x4d')]=_['merge'](_0x8301ea[_0x9a3d('0x4d')],{'$or':_[_0x9a3d('0x38')](_0x8301ea[_0x9a3d('0x51')],function(_0x2c86c2){var _0x3ae9d9={};_0x3ae9d9[_0x2c86c2]={'$like':'%'+_0x367e0d['query'][_0x9a3d('0x36')]+'%'};return _0x3ae9d9;})});}_0x8301ea=_[_0x9a3d('0xd9')]({},_0x8301ea,_0x367e0d['options']);return _0x36c19c[_0x9a3d('0x116')](_0x8301ea);}})['then'](function(_0x2d6a31){if(_0x2d6a31){_0x2a98e9=_0x2d6a31[_0x9a3d('0x55')];if(!_0x367e0d[_0x9a3d('0x4e')][_0x9a3d('0xdc')]('nolimit')){_0x8301ea['limit']=qs[_0x9a3d('0x1c')](_0x367e0d[_0x9a3d('0x4e')][_0x9a3d('0x1c')]);_0x8301ea['offset']=qs[_0x9a3d('0x1a')](_0x367e0d[_0x9a3d('0x4e')][_0x9a3d('0x1a')]);}return _0x36c19c[_0x9a3d('0x116')](_0x8301ea);}})['then'](function(_0x17141c){if(_0x17141c){return _0x17141c?{'count':_0x2a98e9,'rows':_0x17141c}:null;}})[_0x9a3d('0x21')](respondWithResult(_0x43dd63,null))[_0x9a3d('0x5e')](handleError(_0x43dd63,null));};exports[_0x9a3d('0x118')]=function(_0x27c0ee,_0x44aa2e){var _0x2f4149=_0x27c0ee[_0x9a3d('0x65')]['id'];var _0x380334=_0x27c0ee[_0x9a3d('0x64')]?_0x27c0ee[_0x9a3d('0x64')][_0x9a3d('0xa5')]:null;var _0x503725=[];return Promise[_0x9a3d('0x10a')]()['then'](function(){if(!_0x380334)throw new APIBadRequestError('Body\x20parameter\x20\x27ids\x27\x20is\x20required');})[_0x9a3d('0x21')](function(){return db[_0x9a3d('0x40')][_0x9a3d('0x98')]({'where':{'id':_0x2f4149}});})[_0x9a3d('0x21')](function(_0x364c08){if(!_0x364c08)throw new APINotFoundError(util[_0x9a3d('0xcc')](_0x9a3d('0xcd'),_0x27c0ee[_0x9a3d('0x65')]['id']));return db[_0x9a3d('0x119')]['transaction'](function(_0x1d36b9){return _0x364c08[_0x9a3d('0x118')](_0x380334,{'transaction':_0x1d36b9})[_0x9a3d('0x21')](function(){return db['Team'][_0x9a3d('0x53')]({'where':{'id':{'$in':_0x380334}}});})[_0x9a3d('0x21')](function(_0x5b9ac9){var _0x21ba0b=_[_0x9a3d('0x38')](_0x5b9ac9,function(_0x2b966f){return _0x2b966f['getAssociatedQueues']();});return Promise[_0x9a3d('0x5d')](_0x21ba0b);})[_0x9a3d('0x21')](function(_0x4c74ea){_0x503725=_[_0x9a3d('0x11a')](_0x4c74ea);var _0x434710=_['map'](_0x503725,function(_0x1fc62c){return _0x1fc62c[_0x9a3d('0x11b')](_0x364c08['id'],{'transaction':_0x1d36b9});});return Promise[_0x9a3d('0x5d')](_0x434710);})[_0x9a3d('0x21')](function(){if(!_0x364c08[_0x9a3d('0xac')])return;var _0x3f7327=_['filter'](_0x503725,function(_0x4dd7ec){return _0x4dd7ec[_0x9a3d('0x11c')](_0x9a3d('0x9c'))==='Voice';});var _0x1feb6e=_[_0x9a3d('0x38')](_0x3f7327,function(_0x352499){return db[_0x9a3d('0xb4')][_0x9a3d('0x101')]({'membername':_0x364c08[_0x9a3d('0x3b')],'UserId':_0x364c08['id'],'queue_name':_0x352499[_0x9a3d('0x3b')],'VoiceQueueId':_0x352499['id'],'interface':_[_0x9a3d('0x6d')](_0x364c08[_0x9a3d('0xad')])?util[_0x9a3d('0xcc')](_0x9a3d('0xae'),_0x364c08[_0x9a3d('0x3b')]):_0x364c08[_0x9a3d('0xad')],'paused':_0x364c08[_0x9a3d('0x9e')]||![],'penalty':_0x364c08[_0x9a3d('0xa6')]},{'transaction':_0x1d36b9});});return Promise[_0x9a3d('0x5d')](_0x1feb6e);})[_0x9a3d('0x21')](function(){return db[_0x9a3d('0x11d')][_0x9a3d('0x53')]({'where':{'teamId':{'$in':_0x380334}}});})['then'](function(_0x5d38fe){var _0x4cf0d4=_[_0x9a3d('0x38')](_0x5d38fe,function(_0x1a76ba){return db[_0x9a3d('0x11e')][_0x9a3d('0x81')]({'UserId':_0x364c08['id'],'VoicePrefixId':_0x1a76ba['VoicePrefixId']},{'transaction':_0x1d36b9});});return Promise[_0x9a3d('0x5d')](_0x4cf0d4);});});})[_0x9a3d('0x21')](function(){for(var _0x15f941=0x0;_0x15f941<_0x503725[_0x9a3d('0x55')];_0x15f941++){var _0x30959a=_0x503725[_0x15f941][_0x9a3d('0x11c')](_0x9a3d('0x9c'));var _0x33f72e=_0x30959a+_0x9a3d('0xb2');socket[_0x9a3d('0xa8')](_0x9a3d('0x32')+_0x30959a+'Queue:save',{'UserId':_0x2f4149,['queueField']:_0x503725[_0x15f941]['id']});}})['then'](respondWithStatusCode(_0x44aa2e,null))[_0x9a3d('0x5e')](APIHandleError(_0x44aa2e));};exports[_0x9a3d('0x11f')]=function(_0x56b81e,_0x283fa3){var _0x4da276=_0x56b81e[_0x9a3d('0x65')]['id'];var _0x5cf7b3=null;if(_0x56b81e[_0x9a3d('0x4e')]['ids']){_0x5cf7b3=_[_0x9a3d('0xb1')](_0x56b81e['query'][_0x9a3d('0xa5')])?_0x56b81e['query'][_0x9a3d('0xa5')]:[_0x56b81e[_0x9a3d('0x4e')][_0x9a3d('0xa5')]];}var _0x4dc6fb=[];return Promise[_0x9a3d('0x10a')]()[_0x9a3d('0x21')](function(){if(!_0x5cf7b3)throw new APIBadRequestError(_0x9a3d('0x120'));})[_0x9a3d('0x21')](function(){return db[_0x9a3d('0x40')][_0x9a3d('0x98')]({'where':{'id':_0x4da276}});})[_0x9a3d('0x21')](function(_0x33d37c){if(!_0x33d37c)throw new APINotFoundError(util['format'](_0x9a3d('0xcd'),_0x56b81e[_0x9a3d('0x65')]['id']));return db[_0x9a3d('0x119')][_0x9a3d('0x121')](function(_0x473657){return _0x33d37c[_0x9a3d('0x11f')](_0x5cf7b3,{'transaction':_0x473657})[_0x9a3d('0x21')](function(){return db[_0x9a3d('0x117')][_0x9a3d('0x53')]({'where':{'id':{'$in':_0x5cf7b3}}});})['then'](function(_0x333b87){var _0x50d842=_['map'](_0x333b87,function(_0x1def1b){return _0x1def1b[_0x9a3d('0x122')]();});return Promise['all'](_0x50d842);})[_0x9a3d('0x21')](function(_0x18c3cb){_0x4dc6fb=_[_0x9a3d('0x11a')](_0x18c3cb);var _0x58803b=_[_0x9a3d('0x38')](_0x4dc6fb,function(_0x10f3e4){return _0x10f3e4[_0x9a3d('0x123')](_0x33d37c['id'],{'transaction':_0x473657});});return Promise[_0x9a3d('0x5d')](_0x58803b);})[_0x9a3d('0x21')](function(){if(!_0x33d37c['online'])return;var _0x54b1ab=_['filter'](_0x4dc6fb,function(_0x4c28b6){return _0x4c28b6[_0x9a3d('0x11c')](_0x9a3d('0x9c'))===_0x9a3d('0x124');});var _0x4f120a=_[_0x9a3d('0x38')](_0x54b1ab,function(_0x260d0b){return db[_0x9a3d('0xb4')][_0x9a3d('0x2f')]({'where':{'VoiceQueueId':_0x260d0b['id'],'UserId':_0x33d37c['id']},'transaction':_0x473657});});return Promise['all'](_0x4f120a);})['then'](function(){return db['TeamVoicePrefix'][_0x9a3d('0x53')]({'where':{'teamId':{'$in':_0x5cf7b3}}});})['then'](function(_0x13d5e7){var _0x34dabb=_[_0x9a3d('0x38')](_0x13d5e7,function(_0xfd2fc6){return db['UserVoicePrefix'][_0x9a3d('0x2f')]({'where':{'UserId':_0x33d37c['id'],'VoicePrefixId':_0xfd2fc6[_0x9a3d('0x125')]}},{'transaction':_0x473657});});return Promise[_0x9a3d('0x5d')](_0x34dabb);});});})[_0x9a3d('0x21')](function(){for(var _0x493404=0x0;_0x493404<_0x4dc6fb[_0x9a3d('0x55')];_0x493404++){var _0x543062=_0x4dc6fb[_0x493404][_0x9a3d('0x11c')](_0x9a3d('0x9c'));var _0x6d5030=_0x543062+_0x9a3d('0xb2');socket[_0x9a3d('0xa8')](_0x9a3d('0x32')+_0x543062+'Queue:remove',{'UserId':_0x4da276,['queueField']:_0x4dc6fb[_0x493404]['id']});}})[_0x9a3d('0x21')](respondWithStatusCode(_0x283fa3,null))[_0x9a3d('0x5e')](APIHandleError(_0x283fa3));};exports[_0x9a3d('0x126')]=function(_0x2e0f90,_0x56b951){var _0x3fd4b2={};var _0x562d71={};var _0xd4ec06;var _0x5cbd4d;return db['User'][_0x9a3d('0x98')]({'where':{'id':_0x2e0f90[_0x9a3d('0x65')]['id']}})[_0x9a3d('0x21')](handleEntityNotFound(_0x56b951,null))[_0x9a3d('0x21')](function(_0x1525b9){if(_0x1525b9){_0xd4ec06=_0x1525b9;_0x562d71['model']=_['keys'](db['CmList'][_0x9a3d('0x41')]);_0x562d71[_0x9a3d('0x4e')]=_[_0x9a3d('0xd5')](_0x2e0f90[_0x9a3d('0x4e')]);_0x562d71[_0x9a3d('0xd8')]=_[_0x9a3d('0xd6')](_0x562d71[_0x9a3d('0xd4')],_0x562d71[_0x9a3d('0x4e')]);_0x3fd4b2[_0x9a3d('0x51')]=_['intersection'](_0x562d71['model'],qs['fields'](_0x2e0f90[_0x9a3d('0x4e')][_0x9a3d('0xd7')]));_0x3fd4b2[_0x9a3d('0x51')]=_0x3fd4b2[_0x9a3d('0x51')][_0x9a3d('0x55')]?_0x3fd4b2[_0x9a3d('0x51')]:_0x562d71[_0x9a3d('0xd4')];_0x3fd4b2[_0x9a3d('0xde')]=qs['sort'](_0x2e0f90[_0x9a3d('0x4e')][_0x9a3d('0xdf')]);_0x3fd4b2['where']=qs[_0x9a3d('0xd8')](_['pick'](_0x2e0f90[_0x9a3d('0x4e')],_0x562d71[_0x9a3d('0xd8')]));if(_0x2e0f90['query'][_0x9a3d('0x36')]){_0x3fd4b2[_0x9a3d('0x4d')]=_['merge'](_0x3fd4b2[_0x9a3d('0x4d')],{'$or':_[_0x9a3d('0x38')](_0x3fd4b2[_0x9a3d('0x51')],function(_0x1e0b90){var _0x23daee={};_0x23daee[_0x1e0b90]={'$like':'%'+_0x2e0f90[_0x9a3d('0x4e')][_0x9a3d('0x36')]+'%'};return _0x23daee;})});}_0x3fd4b2=_['merge']({},_0x3fd4b2,_0x2e0f90[_0x9a3d('0x63')]);return _0xd4ec06[_0x9a3d('0x126')](_0x3fd4b2);}})[_0x9a3d('0x21')](function(_0x4430df){if(_0x4430df){_0x5cbd4d=_0x4430df[_0x9a3d('0x55')];if(!_0x2e0f90[_0x9a3d('0x4e')]['hasOwnProperty']('nolimit')){_0x3fd4b2['limit']=qs[_0x9a3d('0x1c')](_0x2e0f90[_0x9a3d('0x4e')][_0x9a3d('0x1c')]);_0x3fd4b2[_0x9a3d('0x1a')]=qs[_0x9a3d('0x1a')](_0x2e0f90['query'][_0x9a3d('0x1a')]);}return _0xd4ec06[_0x9a3d('0x126')](_0x3fd4b2);}})['then'](function(_0x50cb23){if(_0x50cb23){return _0x50cb23?{'count':_0x5cbd4d,'rows':_0x50cb23}:null;}})['then'](respondWithResult(_0x56b951,null))['catch'](handleError(_0x56b951,null));};exports[_0x9a3d('0x127')]=function(_0x5a780c,_0x3abd1a){var _0x2d520b={};var _0x3a1cb8={};var _0x53a540;return db[_0x9a3d('0x40')][_0x9a3d('0x98')]({'where':{'id':_0x5a780c[_0x9a3d('0x65')]['id']}})[_0x9a3d('0x21')](handleEntityNotFound(_0x3abd1a,null))[_0x9a3d('0x21')](function(_0x22ccb4){if(_0x22ccb4){_0x53a540=_0x22ccb4;_0x3a1cb8[_0x9a3d('0xd4')]=_[_0x9a3d('0xd5')](db['User'][_0x9a3d('0x41')]);_0x3a1cb8['query']=_[_0x9a3d('0xd5')](_0x5a780c[_0x9a3d('0x4e')]);_0x3a1cb8['filters']=_['intersection'](_0x3a1cb8[_0x9a3d('0xd4')],_0x3a1cb8[_0x9a3d('0x4e')]);_0x2d520b[_0x9a3d('0x51')]=_[_0x9a3d('0xd6')](_0x3a1cb8[_0x9a3d('0xd4')],qs[_0x9a3d('0xd7')](_0x5a780c[_0x9a3d('0x4e')]['fields']));_0x2d520b[_0x9a3d('0x51')]=_0x2d520b[_0x9a3d('0x51')][_0x9a3d('0x55')]?_0x2d520b[_0x9a3d('0x51')]:_0x3a1cb8['model'];_0x2d520b[_0x9a3d('0xde')]=qs['sort'](_0x5a780c[_0x9a3d('0x4e')][_0x9a3d('0xdf')]);_0x2d520b[_0x9a3d('0x4d')]=qs[_0x9a3d('0xd8')](_[_0x9a3d('0xe0')](_0x5a780c[_0x9a3d('0x4e')],_0x3a1cb8[_0x9a3d('0xd8')]));if(_0x5a780c[_0x9a3d('0x4e')]['filter']){_0x2d520b[_0x9a3d('0x4d')]=_[_0x9a3d('0xd9')](_0x2d520b[_0x9a3d('0x4d')],{'$or':_[_0x9a3d('0x38')](_0x2d520b[_0x9a3d('0x51')],function(_0x42728f){var _0x2ae321={};_0x2ae321[_0x42728f]={'$like':'%'+_0x5a780c[_0x9a3d('0x4e')][_0x9a3d('0x36')]+'%'};return _0x2ae321;})});}_0x2d520b[_0x9a3d('0xd4')]=db[_0x9a3d('0x40')];_0x2d520b['as']=_0x9a3d('0x33');_0x2d520b=_[_0x9a3d('0xd9')]({},_0x2d520b,_0x5a780c[_0x9a3d('0x63')]);return _0x53a540[_0x9a3d('0xff')]({'include':[_0x2d520b]});}})[_0x9a3d('0x21')](function(_0x2a8721){if(_0x2a8721){var _0x17b7e5={},_0x53463d=[];for(var _0x58c32d=0x0;_0x58c32d<_0x2a8721[_0x9a3d('0x55')];_0x58c32d+=0x1){for(var _0x4f56e0=0x0,_0x107030;_0x4f56e0<_0x2a8721[_0x58c32d][_0x9a3d('0x33')]['length'];_0x4f56e0+=0x1){_0x107030=_0x2a8721[_0x58c32d][_0x9a3d('0x33')][_0x4f56e0][_0x9a3d('0x30')]({'plain':!![]});_0x17b7e5[_0x107030['id']]=_0x107030;}}_0x17b7e5=_[_0x9a3d('0x128')](_0x17b7e5);for(var _0x7f88c5=qs['offset'](_0x5a780c[_0x9a3d('0x4e')]['offset']);_0x7f88c5<_0x17b7e5[_0x9a3d('0x55')]&&_0x53463d[_0x9a3d('0x55')]=_0x4f7ce6){_0x34385a=_0x4f7ce6;_0xb82ef=0xc8;}else{_0xb82ef=0xce;}_0x57dd0e[_0xdfb3('0x15')](_0xb82ef);return _0x57dd0e[_0xdfb3('0x1c')](_0xdfb3('0x1d'),_0x533b4a+'-'+_0x34385a+'/'+_0x4f7ce6)['json'](_0x3a8c5f);}return null;};}function respondWithRpcPromise(_0x52cb07,_0x15f3ce,_0x4ab717,_0x2d4508){return new Promise(function(_0x17bf42,_0xc41cd7){var _0x41c1ee=_0x2d4508||amiClient;return _0x41c1ee['request'](_0x52cb07,_0x4ab717)[_0xdfb3('0x1e')](function(_0x118164){logger[_0xdfb3('0x1f')]('User,\x20%s,\x20%s',_0x15f3ce,'request\x20sent');logger[_0xdfb3('0x20')]('User,\x20%s,\x20%s,\x20%s',_0x15f3ce,_0xdfb3('0x21'),JSON[_0xdfb3('0x22')](_0x118164));if(_0x118164[_0xdfb3('0x23')]){if(_0x118164['error'][_0xdfb3('0x24')]===0x1f4){logger[_0xdfb3('0x23')](_0xdfb3('0x25'),_0x15f3ce,_0x118164[_0xdfb3('0x23')][_0xdfb3('0x26')]);return _0xc41cd7(_0x118164[_0xdfb3('0x23')]['message']);}logger[_0xdfb3('0x23')](_0xdfb3('0x25'),_0x15f3ce,_0x118164[_0xdfb3('0x23')][_0xdfb3('0x26')]);return _0x17bf42(_0x118164[_0xdfb3('0x23')][_0xdfb3('0x26')]);}else{logger[_0xdfb3('0x1f')](_0xdfb3('0x25'),_0x15f3ce,_0xdfb3('0x21'));_0x17bf42(_0x118164[_0xdfb3('0x27')][_0xdfb3('0x26')]);}})[_0xdfb3('0x28')](function(_0x205173){logger[_0xdfb3('0x23')](_0xdfb3('0x25'),_0x15f3ce,_0x205173);_0xc41cd7(_0x205173);});});}function saveUpdates(_0x812d18){return function(_0x435d6d){if(_0x435d6d){return _0x435d6d[_0xdfb3('0x29')](_0x812d18)[_0xdfb3('0x1e')](function(_0x3d1753){if(_0x3d1753[_0xdfb3('0x2a')]===_0xdfb3('0x2b')){socket['emit'](_0xdfb3('0x2c')+_0x3d1753['id'],_0x3d1753);}return _0x3d1753;});}return null;};}function removeEntity(_0x1f7c94,_0x44556b){return function(_0x5eee31){if(_0x5eee31){return _0x5eee31['destroy']({'transaction':_0x44556b})[_0xdfb3('0x1e')](function(){var _0x3c9f01=_0x5eee31[_0xdfb3('0x2d')]({'plain':!![]});if(_0x3c9f01[_0xdfb3('0x2a')]===_0xdfb3('0x2e'))return;var _0x2e79e4=[{'name':'Users','value':_0xdfb3('0x2f'),'ignore':!![]},{'name':_0xdfb3('0x30'),'value':_0xdfb3('0x2b'),'ignore':![]},{'name':_0xdfb3('0x31'),'value':'telephone','ignore':![]}];var _0x4344f8=_(_0x2e79e4)[_0xdfb3('0x32')](_0xdfb3('0x33'))[_0xdfb3('0x34')](_0xdfb3('0x35'))['value']();if(_['includes'](_0x4344f8,_0x3c9f01[_0xdfb3('0x2a')])){return;}var _0x423e03=_['find'](_0x2e79e4,[_0xdfb3('0x35'),_0x3c9f01[_0xdfb3('0x2a')]])[_0xdfb3('0x36')];return db['UserProfileResource'][_0xdfb3('0x37')]({'where':{'type':_0x423e03,'resourceId':_0x3c9f01['id']},'transaction':_0x44556b})['then'](function(){return _0x5eee31;});})[_0xdfb3('0x1e')](function(){_0x1f7c94[_0xdfb3('0x15')](0xcc)[_0xdfb3('0x16')]();});}};}function handleEntityNotFound(_0x3f12e9){return function(_0x1df47e){if(!_0x1df47e){_0x3f12e9['sendStatus'](0x194);}return _0x1df47e;};}function handleError(_0x21a085,_0x5e77b3){_0x5e77b3=_0x5e77b3||0x1f4;return function(_0x46fd40){logger[_0xdfb3('0x23')](_0x46fd40[_0xdfb3('0x38')]);if(_0x46fd40[_0xdfb3('0x36')]){delete _0x46fd40[_0xdfb3('0x36')];}_0x21a085[_0xdfb3('0x15')](_0x5e77b3)[_0xdfb3('0x39')](_0x46fd40);};}function getUserAttributes(){return _(db['User']['rawAttributes'])[_0xdfb3('0x34')](function(_0x6b8141){return{'name':_0x6b8141['fieldName'],'type':_0x6b8141['type'][_0xdfb3('0x3a')]};})[_0xdfb3('0x32')](function(_0x11ba74){return!['password',_0xdfb3('0x3b'),_0xdfb3('0x3c'),_0xdfb3('0x3d'),_0xdfb3('0x3e'),_0xdfb3('0x3f')]['includes'](_0x11ba74['name']);})[_0xdfb3('0x35')]();}exports[_0xdfb3('0x40')]=function(_0x477c22,_0x54afb0){var _0x509d8c={},_0x1e4096={'count':0x0,'rows':[]};var _0x27eba5=getUserAttributes();_0x509d8c=qs[_0xdfb3('0x41')](_0x27eba5,_0x477c22);var _0x1cd9f6={'where':_0x509d8c[_0xdfb3('0x42')]};return db[_0xdfb3('0x43')][_0xdfb3('0x1b')](_0x1cd9f6)['then'](function(_0x52fb49){_0x1e4096[_0xdfb3('0x1b')]=_0x52fb49;if(_0x477c22['query'][_0xdfb3('0x44')]){_0x509d8c[_0xdfb3('0x45')]=[{'all':!![]}];}if(_0x477c22[_0xdfb3('0x46')]['userSetting']===_0xdfb3('0x47')){_0x509d8c[_0xdfb3('0x45')]=[{'model':db[_0xdfb3('0x48')],'as':_0xdfb3('0x49')}];}if(!_[_0xdfb3('0x4a')](_0x509d8c[_0xdfb3('0x4b')],'id')){_0x509d8c[_0xdfb3('0x4b')][_0xdfb3('0x4c')]('id');}return db[_0xdfb3('0x43')][_0xdfb3('0x4d')](_0x509d8c);})[_0xdfb3('0x1e')](function(_0x5b8dfb){_0x1e4096[_0xdfb3('0x4e')]=_0x5b8dfb;if(_0x477c22[_0xdfb3('0x46')][_0xdfb3('0x4f')]===_0xdfb3('0x47')){var _0x294542=[];for(var _0x2e4693=0x0;_0x2e4693<_0x1e4096['rows'][_0xdfb3('0x50')];_0x2e4693++){_0x294542['push'](get_open_tabs('chat',_0x1e4096[_0xdfb3('0x4e')][_0x2e4693][_0xdfb3('0x51')]));_0x294542[_0xdfb3('0x4c')](get_open_tabs(_0xdfb3('0x52'),_0x1e4096[_0xdfb3('0x4e')][_0x2e4693][_0xdfb3('0x51')]));_0x294542[_0xdfb3('0x4c')](get_open_tabs(_0xdfb3('0x53'),_0x1e4096['rows'][_0x2e4693][_0xdfb3('0x51')]));_0x294542[_0xdfb3('0x4c')](get_open_tabs(_0xdfb3('0x54'),_0x1e4096['rows'][_0x2e4693]['dataValues']));_0x294542[_0xdfb3('0x4c')](get_open_tabs('openchannel',_0x1e4096[_0xdfb3('0x4e')][_0x2e4693]['dataValues']));_0x294542[_0xdfb3('0x4c')](get_open_tabs(_0xdfb3('0x55'),_0x1e4096[_0xdfb3('0x4e')][_0x2e4693][_0xdfb3('0x51')]));}return Promise['all'](_0x294542)[_0xdfb3('0x1e')](function(){return _0x1e4096;});}else{return _0x1e4096;}})[_0xdfb3('0x1e')](respondWithFilteredResult(_0x54afb0,_0x509d8c))[_0xdfb3('0x28')](handleError(_0x54afb0,null));};exports['show']=function(_0x2f55fc,_0x1dfdd9){var _0x46c176=getUserAttributes();_0x2f55fc['query']['id']=_0x2f55fc[_0xdfb3('0x56')]['id'];var _0x57b87c=qs[_0xdfb3('0x41')](_0x46c176,_0x2f55fc);if(_0x2f55fc['query'][_0xdfb3('0x44')]){_0x57b87c[_0xdfb3('0x45')]=[{'all':!![]}];}if(_0x2f55fc[_0xdfb3('0x46')][_0xdfb3('0x49')]===_0xdfb3('0x47')){_0x57b87c[_0xdfb3('0x45')]=[{'model':db['UserSetting'],'as':_0xdfb3('0x49')}];}_0x57b87c=_[_0xdfb3('0x57')]({},_0x57b87c,_0x2f55fc['options']);if(!_[_0xdfb3('0x4a')](_0x57b87c[_0xdfb3('0x4b')],'id')){_0x57b87c['attributes'][_0xdfb3('0x4c')]('id');}return db[_0xdfb3('0x43')][_0xdfb3('0x58')](_0x57b87c)[_0xdfb3('0x1e')](handleEntityNotFound(_0x1dfdd9,null))['then'](function(_0x20eebd){var _0x3d1cf=[];values=_0x20eebd;if(_0x2f55fc['query'][_0xdfb3('0x4f')]==='true'){_0x3d1cf[_0xdfb3('0x4c')](get_open_tabs(_0xdfb3('0x59'),_0x20eebd[_0xdfb3('0x51')]));_0x3d1cf[_0xdfb3('0x4c')](get_open_tabs(_0xdfb3('0x52'),_0x20eebd[_0xdfb3('0x51')]));_0x3d1cf['push'](get_open_tabs(_0xdfb3('0x5a'),_0x20eebd['dataValues']));_0x3d1cf[_0xdfb3('0x4c')](get_open_tabs('whatsapp',_0x20eebd[_0xdfb3('0x51')]));_0x3d1cf[_0xdfb3('0x4c')](get_open_tabs(_0xdfb3('0x53'),_0x20eebd[_0xdfb3('0x51')]));_0x3d1cf['push'](get_open_tabs(_0xdfb3('0x54'),_0x20eebd['dataValues']));return Promise['all'](_0x3d1cf);}else{return values;}})[_0xdfb3('0x1e')](function(){return values;})[_0xdfb3('0x1e')](respondWithResult(_0x1dfdd9,null))[_0xdfb3('0x28')](handleError(_0x1dfdd9,null));};exports[_0xdfb3('0x29')]=function(_0x437c59,_0x51a38e){if(_0x437c59[_0xdfb3('0x5b')]['id']){delete _0x437c59['body']['id'];}delete _0x437c59[_0xdfb3('0x5b')][_0xdfb3('0x2a')];return db[_0xdfb3('0x43')][_0xdfb3('0x58')]({'where':{'id':_0x437c59[_0xdfb3('0x56')]['id']}})[_0xdfb3('0x1e')](handleEntityNotFound(_0x51a38e,null))['then'](saveUpdates(_0x437c59[_0xdfb3('0x5b')],null))[_0xdfb3('0x1e')](respondWithResult(_0x51a38e,null))['catch'](handleError(_0x51a38e,null));};exports['describe']=function(_0x1dd7a1,_0x19d79a){return db['User'][_0xdfb3('0x5c')]()[_0xdfb3('0x1e')](respondWithResult(_0x19d79a,null))[_0xdfb3('0x28')](handleError(_0x19d79a,null));};exports[_0xdfb3('0x5d')]=function(_0x41a060,_0x593cb9){return db[_0xdfb3('0x43')][_0xdfb3('0x58')]({'where':{'id':_0x41a060[_0xdfb3('0x56')]['id']}})[_0xdfb3('0x1e')](handleEntityNotFound(_0x593cb9,null))[_0xdfb3('0x1e')](function(_0x2d3680){if(_0x2d3680){return _0x2d3680['addContacts'](_0x41a060[_0xdfb3('0x5b')][_0xdfb3('0x5e')],_['omit'](_0x41a060[_0xdfb3('0x5b')],[_0xdfb3('0x5e'),'id'])||{});}})['then'](respondWithResult(_0x593cb9,null))[_0xdfb3('0x28')](handleError(_0x593cb9,null));};function validateUser(_0xf6fe8f){return new Promise(function(_0x4037a7,_0x220ad7){if(_0xf6fe8f['internal'])return _0x4037a7(_0xf6fe8f);return db[_0xdfb3('0x5f')][_0xdfb3('0x60')](0x1)[_0xdfb3('0x1e')](function(_0x4e77ad){if(_0x4e77ad[_0xdfb3('0x61')])authService[_0xdfb3('0x62')](_0xf6fe8f[_0xdfb3('0x63')]);db[_0xdfb3('0x43')]['max'](_0xdfb3('0x64'))[_0xdfb3('0x1e')](function(_0x1f1cd9){if(_[_0xdfb3('0x65')](_0x1f1cd9)){_0xf6fe8f[_0xdfb3('0x64')]=_0x4e77ad['min_internal']||0x1;return;}if(_['isNil'](_0x4e77ad[_0xdfb3('0x66')])||_0x4e77ad[_0xdfb3('0x66')]===_0x1f1cd9){_0xf6fe8f[_0xdfb3('0x64')]=_0x1f1cd9+0x1;return;}if(_0x4e77ad[_0xdfb3('0x66')]>_0x1f1cd9){_0xf6fe8f[_0xdfb3('0x64')]=_0x4e77ad[_0xdfb3('0x66')];return;}return db[_0xdfb3('0x67')][_0xdfb3('0x46')](_0xdfb3('0x68'),{'type':db[_0xdfb3('0x67')][_0xdfb3('0x69')][_0xdfb3('0x6a')]})[_0xdfb3('0x1e')](function(_0x1de464){if(_0x1de464&&_0x1de464[_0xdfb3('0x50')]){for(var _0x389894=0x0,_0x121205=_0x1de464[_0xdfb3('0x50')];_0x389894<_0x121205&&_[_0xdfb3('0x65')](_0xf6fe8f[_0xdfb3('0x64')]);_0x389894++){if(_0x4e77ad[_0xdfb3('0x66')]<=_0x1de464[_0x389894]['from']){_0xf6fe8f[_0xdfb3('0x64')]=_0x1de464[_0x389894][_0xdfb3('0x6b')];}else if(_0x4e77ad[_0xdfb3('0x66')]>_0x1de464[_0x389894][_0xdfb3('0x6b')]&&_0x4e77ad['min_internal']<=_0x1de464[_0x389894]['to']){_0xf6fe8f['internal']=_0x4e77ad['min_internal'];}}}if(_[_0xdfb3('0x65')](_0xf6fe8f[_0xdfb3('0x64')])){_0xf6fe8f[_0xdfb3('0x64')]=_0x1f1cd9+0x1;}return _0x4037a7(_0xf6fe8f);});});})[_0xdfb3('0x28')](function(_0x39ba39){_0x220ad7(_0x39ba39);});});}function updateUser(_0x2c5076){return new Promise(function(_0x5504ce,_0x322efe){try{if(_0x2c5076[_0xdfb3('0x6c')]){_0x2c5076['mailbox']=_0x2c5076[_0xdfb3('0x64')];_0x2c5076[_0xdfb3('0x6d')]={'mailbox':_0x2c5076[_0xdfb3('0x64')],'password':_0x2c5076['password'],'fullname':_0x2c5076[_0xdfb3('0x6e')],'email':_0x2c5076[_0xdfb3('0x6f')]};}if(_0x2c5076['role']===_0xdfb3('0x2b')){if(!_0x2c5076[_0xdfb3('0x70')])_0x2c5076[_0xdfb3('0x70')]=[_0xdfb3('0x71'),_0xdfb3('0x72'),'103',_0xdfb3('0x73'),_0xdfb3('0x74'),'104',_0xdfb3('0x75'),_0xdfb3('0x76'),_0xdfb3('0x77'),_0xdfb3('0x78'),_0xdfb3('0x79'),_0xdfb3('0x7a'),_0xdfb3('0x7b'),_0xdfb3('0x7c'),_0xdfb3('0x7d')];}_0x5504ce(_0x2c5076);}catch(_0x4979ee){_0x322efe(_0x4979ee);}});}exports[_0xdfb3('0x7e')]=function(_0x5405e3,_0x3d9317){if(_0x5405e3[_0xdfb3('0x2f')][_0xdfb3('0x2a')]===_0xdfb3('0x2b'))throw new Error('Unauthorized');if(_0x5405e3[_0xdfb3('0x5b')][_0xdfb3('0x2a')]===_0xdfb3('0x2f')&&_0x5405e3[_0xdfb3('0x2f')]['role']!==_0xdfb3('0x2e')){throw new Error(_0xdfb3('0x7f'));}if(_0x5405e3[_0xdfb3('0x5b')][_0xdfb3('0x2a')]===_0xdfb3('0x2e')&&_0x5405e3['user']['role']!==_0xdfb3('0x2e')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil[_0xdfb3('0x80')]([_0x5405e3[_0xdfb3('0x5b')]])[_0xdfb3('0x1e')](function(){return validateUser(_0x5405e3[_0xdfb3('0x5b')]);})['then'](function(_0x43c9c3){return updateUser(_0x43c9c3)[_0xdfb3('0x1e')](function(_0x2580e1){if(_0x2580e1[_0xdfb3('0x2a')]==='admin'){_0x2580e1[_0xdfb3('0x81')]=_0x5405e3[_0xdfb3('0x2f')]['settingsEnabled'];delete _0x2580e1['userProfileId'];}return _0x2580e1;});})[_0xdfb3('0x1e')](function(_0x5c36d7){return db[_0xdfb3('0x43')]['create'](_0x5c36d7,{'include':[{'model':db[_0xdfb3('0x6d')],'as':_0xdfb3('0x6d')}]});})[_0xdfb3('0x1e')](function(_0x6d120f){if(_0x5405e3[_0xdfb3('0x5b')][_0xdfb3('0x2a')]==='user')return _0x6d120f;if(_0x5405e3[_0xdfb3('0x2f')][_0xdfb3('0x2a')]!==_0xdfb3('0x2f'))return _0x6d120f;return db[_0xdfb3('0x82')][_0xdfb3('0x58')]({'where':{'name':_0x6d120f[_0xdfb3('0x2a')]===_0xdfb3('0x2b')?_0xdfb3('0x30'):'Telephones','userProfileId':_0x5405e3['user']['userProfileId']},'raw':!![]})[_0xdfb3('0x1e')](function(_0x36788d){if(!_0x36788d||_0x36788d[_0xdfb3('0x83')]!=0x0)return _0x6d120f;return db[_0xdfb3('0x84')]['create']({'name':_0x6d120f[_0xdfb3('0x36')],'resourceId':_0x6d120f['id'],'type':_0x36788d['name'],'sectionId':_0x36788d['id']},{})[_0xdfb3('0x1e')](function(){return _0x6d120f;});})['catch'](function(_0x2153fe){logger[_0xdfb3('0x23')](_0xdfb3('0x85'),_0x2153fe);throw _0x2153fe;});})[_0xdfb3('0x1e')](respondWithResult(_0x3d9317,0xc9))[_0xdfb3('0x28')](handleError(_0x3d9317,null));};exports[_0xdfb3('0x86')]=function(_0x4ee4e2,_0xebf001){var _0x13a525=_0x4ee4e2[_0xdfb3('0x5b')];var _0x23af8e=[];if(_0x4ee4e2['user'][_0xdfb3('0x2a')]==='agent')throw new Error(_0xdfb3('0x87'));if(_[_0xdfb3('0x88')](_0x13a525,['role','user'])&&_0x4ee4e2[_0xdfb3('0x2f')]['role']!=='admin'){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_[_0xdfb3('0x88')](_0x13a525,['role',_0xdfb3('0x2e')])&&_0x4ee4e2[_0xdfb3('0x2f')][_0xdfb3('0x2a')]!==_0xdfb3('0x2e')){throw new Error(_0xdfb3('0x89'));}return licenseUtil[_0xdfb3('0x80')](_0x13a525)[_0xdfb3('0x1e')](function(){return validateUser(_0x13a525[0x0]);})[_0xdfb3('0x1e')](function(){for(var _0x1ca433=0x1;_0x1ca433<_0x13a525[_0xdfb3('0x50')];_0x1ca433++){var _0x1cbf12=_0x13a525[_0x1ca433-0x1][_0xdfb3('0x64')];if(!_0x13a525[_0x1ca433][_0xdfb3('0x64')])_0x13a525[_0x1ca433][_0xdfb3('0x64')]=_0x1cbf12+0x1;_0x23af8e[_0xdfb3('0x4c')](validateUser(_0x13a525[_0x1ca433]));}return Promise['all'](_0x23af8e);})[_0xdfb3('0x1e')](function(){_0x23af8e=[];for(var _0x1cc47c=0x0;_0x1cc47c<_0x13a525[_0xdfb3('0x50')];_0x1cc47c++){_0x23af8e[_0xdfb3('0x4c')](updateUser(_0x13a525[_0x1cc47c]));}return Promise[_0xdfb3('0x8a')](_0x23af8e);})['then'](function(){_0x23af8e=_0x13a525['map'](function(_0x48f924){return db[_0xdfb3('0x43')][_0xdfb3('0x7e')](_0x48f924,{'include':[{'model':db[_0xdfb3('0x6d')],'as':_0xdfb3('0x6d')}]})[_0xdfb3('0x1e')](function(_0x152615){_0x48f924['id']=_0x152615['id'];return _0x48f924;});});return Promise[_0xdfb3('0x8a')](_0x23af8e);})[_0xdfb3('0x1e')](function(_0x2c805f){if(_0x4ee4e2['body'][_0xdfb3('0x2a')]===_0xdfb3('0x2f'))return _0x2c805f;if(_0x4ee4e2[_0xdfb3('0x2f')][_0xdfb3('0x2a')]!=='user')return _0x2c805f;var _0x3c47f1=_[_0xdfb3('0x88')](_0x2c805f,function(_0x289f30){return _0x289f30['role']===_0xdfb3('0x2b')||_0x289f30[_0xdfb3('0x2a')]===_0xdfb3('0x8b');});if(!_0x3c47f1)return _0x2c805f;return db[_0xdfb3('0x82')]['findAll']({'where':{'name':{'$or':[_0xdfb3('0x30'),_0xdfb3('0x31')]},'userProfileId':_0x4ee4e2[_0xdfb3('0x2f')][_0xdfb3('0x8c')]},'raw':!![]})['then'](function(_0x2cb7c9){if(_[_0xdfb3('0x8d')](_0x2cb7c9)||!_[_0xdfb3('0x88')](_0x2cb7c9,[_0xdfb3('0x83'),0x0]))return _0x2c805f;_0x23af8e=[];var _0x5e67d8=_(_0x2cb7c9)[_0xdfb3('0x34')](function(_0x509b85){if(_0x509b85[_0xdfb3('0x83')]===0x1)return;return _0x509b85[_0xdfb3('0x36')]===_0xdfb3('0x30')?'agent':_0xdfb3('0x8b');})[_0xdfb3('0x8e')]()['value']();for(var _0x1c8b53=0x0;_0x1c8b53<_0x2c805f['length'];_0x1c8b53++){if(!_[_0xdfb3('0x4a')](_0x5e67d8,_0x2c805f[_0x1c8b53][_0xdfb3('0x2a')]))return;var _0x1ef381=_0x2c805f[_0x1c8b53][_0xdfb3('0x2a')]==='agent'?'Agents':_0xdfb3('0x31');_0x23af8e[_0xdfb3('0x4c')](db[_0xdfb3('0x84')][_0xdfb3('0x7e')]({'name':_0x2c805f[_0x1c8b53]['name'],'resourceId':_0x2c805f[_0x1c8b53]['id'],'type':_0x1ef381,'sectionId':_['find'](_0x2cb7c9,[_0xdfb3('0x36'),_0x1ef381])['id']},{}));}return Promise['all'](_0x23af8e);});})[_0xdfb3('0x1e')](respondWithResult(_0xebf001,0xc9))[_0xdfb3('0x28')](handleError(_0xebf001,null));};exports[_0xdfb3('0x8f')]=function(_0x44460c,_0x295181){if(_0x44460c[_0xdfb3('0x5b')]['id']){delete _0x44460c[_0xdfb3('0x5b')]['id'];}return db[_0xdfb3('0x43')][_0xdfb3('0x58')]({'where':{'id':_0x44460c[_0xdfb3('0x56')]['id']}})[_0xdfb3('0x1e')](function(_0x406053){if(!_0x406053)return null;if(_0x406053['id']===_0x44460c['user']['id']){if(!_0x44460c['body'][_0xdfb3('0x90')]||!_0x44460c[_0xdfb3('0x5b')]['newPassword']){throw new db[(_0xdfb3('0x91'))][(_0xdfb3('0x92'))](_0xdfb3('0x93'));}if(!_0x406053[_0xdfb3('0x94')](_0x44460c['body'][_0xdfb3('0x90')])){throw new db[(_0xdfb3('0x91'))][(_0xdfb3('0x92'))](_0xdfb3('0x95'));}if(_0x44460c[_0xdfb3('0x5b')][_0xdfb3('0x90')]===_0x44460c[_0xdfb3('0x5b')][_0xdfb3('0x96')]){throw new db[(_0xdfb3('0x91'))][(_0xdfb3('0x92'))](_0xdfb3('0x97'));}}else if(_0x44460c[_0xdfb3('0x2f')][_0xdfb3('0x2a')]===_0xdfb3('0x2e')){if(!_0x44460c[_0xdfb3('0x5b')][_0xdfb3('0x96')]){throw new db[(_0xdfb3('0x91'))][(_0xdfb3('0x92'))](_0xdfb3('0x98'));}}else if(_0x44460c[_0xdfb3('0x2f')]['role']==='user'){if(!_0x44460c[_0xdfb3('0x5b')]['newPassword']){throw new db[(_0xdfb3('0x91'))][(_0xdfb3('0x92'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x406053[_0xdfb3('0x2a')]!==_0xdfb3('0x2b')){throw new db[(_0xdfb3('0x91'))][(_0xdfb3('0x92'))]('Unauthorized');}}else{throw new db[(_0xdfb3('0x91'))][(_0xdfb3('0x92'))](_0xdfb3('0x87'));}return _0x406053;})[_0xdfb3('0x1e')](handleEntityNotFound(_0x295181,null))[_0xdfb3('0x1e')](function(_0x335eac){return db[_0xdfb3('0x5f')][_0xdfb3('0x99')]({'attributes':['id','securePassword',_0xdfb3('0x9a'),_0xdfb3('0x9b')]})[_0xdfb3('0x1e')](function(_0x5a31d1){if(_0x5a31d1[_0xdfb3('0x61')])authService['validatePasswordPattern'](_0x44460c[_0xdfb3('0x5b')][_0xdfb3('0x96')]);if(!_0x5a31d1[_0xdfb3('0x9a')]||!_0x335eac[_0xdfb3('0x3c')])return _0x335eac;authService[_0xdfb3('0x9c')](_0x44460c['body'][_0xdfb3('0x96')],_0x335eac[_0xdfb3('0x3c')],_0x5a31d1[_0xdfb3('0x9b')]);return _0x335eac;})['then'](saveUpdates({'password':_0x44460c[_0xdfb3('0x5b')][_0xdfb3('0x96')],'passwordResetAt':_0x44460c['user']['id']==_0x44460c[_0xdfb3('0x56')]['id']?moment():null,'previousPasswords':authService[_0xdfb3('0x9d')](_0x44460c[_0xdfb3('0x5b')]['newPassword'],_0x335eac[_0xdfb3('0x3c')])},null));})[_0xdfb3('0x1e')](respondWithResult(_0x295181,null))[_0xdfb3('0x28')](handleError(_0x295181,null));};exports[_0xdfb3('0x9e')]=function(_0x125c8c,_0x20a277){var _0x3a5b59=_0x125c8c[_0xdfb3('0x5b')]['channel'];return db[_0xdfb3('0x43')][_0xdfb3('0x58')]({'where':{'id':_0x125c8c[_0xdfb3('0x56')]['id']},'attributes':['id','name','role',_0xdfb3('0x9f'),_0xdfb3('0xa0'),_0xdfb3('0xa1'),_0xdfb3('0xa2')]})[_0xdfb3('0x1e')](handleEntityNotFound(_0x20a277,null))[_0xdfb3('0x1e')](function(_0xf3c5f5){if(_0xf3c5f5){if(!utils[_0xdfb3('0xa3')](_0x3a5b59)){throw new db[(_0xdfb3('0x91'))]['ValidationError'](_0xdfb3('0xa4'));}return _0xf3c5f5[_0xdfb3('0xa5')+_['capitalize'](_0x3a5b59[_0xdfb3('0xa6')]())+_0xdfb3('0xa7')](_0x125c8c[_0xdfb3('0x5b')][_0xdfb3('0x5e')],{'penalty':_0x125c8c[_0xdfb3('0x5b')][_0xdfb3('0xa8')]||0x0})[_0xdfb3('0xa9')](function(_0x2e2534){for(var _0x25b2d3=0x0;_0x25b2d3<_0x125c8c['body'][_0xdfb3('0x5e')][_0xdfb3('0x50')];_0x25b2d3+=0x1){var _0x53c6cd={'UserId':Number(_0x125c8c['params']['id'])};_0x53c6cd[_['capitalize'](_0x3a5b59[_0xdfb3('0xa6')]())+_0xdfb3('0xaa')]=Number(_0x125c8c[_0xdfb3('0x5b')][_0xdfb3('0x5e')][_0x25b2d3]);socket[_0xdfb3('0xab')]('user'+_[_0xdfb3('0xac')](_0x3a5b59[_0xdfb3('0xa6')]())+'Queue:save',_0x53c6cd);}return _0x2e2534;})['then'](function(){if(_0x3a5b59===_0xdfb3('0xad')){return db[_0xdfb3('0xae')][_0xdfb3('0x4d')]({'where':{'id':_0x125c8c[_0xdfb3('0x5b')][_0xdfb3('0x5e')]||[]},'raw':!![],'attributes':['id','name']});}})[_0xdfb3('0x1e')](function(_0x1b4215){var _0x56dc7f=_0xf3c5f5[_0xdfb3('0x2d')]({'plain':!![]});var _0x856249=[];if(_0x3a5b59===_0xdfb3('0xad')&&_0x56dc7f[_0xdfb3('0x2a')]===_0xdfb3('0x2b')&&_0x56dc7f[_0xdfb3('0x9f')]){for(let _0x3550aa=0x0;_0x3550aa<_0x1b4215[_0xdfb3('0x50')];_0x3550aa+=0x1){_0x856249[_0xdfb3('0x4c')]({'membername':_0x56dc7f[_0xdfb3('0x36')],'UserId':_0x56dc7f['id'],'queue_name':_0x1b4215[_0x3550aa][_0xdfb3('0x36')],'VoiceQueueId':_0x1b4215[_0x3550aa]['id'],'interface':_[_0xdfb3('0x65')](_0x56dc7f[_0xdfb3('0xa2')])?util['format'](_0xdfb3('0xaf'),_0x56dc7f[_0xdfb3('0x36')]):_0x56dc7f[_0xdfb3('0xa2')],'paused':_0x56dc7f[_0xdfb3('0xa1')]||![],'penalty':_0x125c8c['body'][_0xdfb3('0xa8')]||0x0});}return Promise['all'](_0x856249[_0xdfb3('0x34')](function(_0x5b7076){return db[_0xdfb3('0xb0')][_0xdfb3('0xb1')](_0x5b7076);}));}return _0xf3c5f5;});}})[_0xdfb3('0x1e')](respondWithStatusCode(_0x20a277,null))[_0xdfb3('0x28')](handleError(_0x20a277,null));};exports[_0xdfb3('0xb2')]=function(_0x36b21c,_0x4a0ae6){var _0x1de66b,_0x3e112d;return db['User'][_0xdfb3('0x58')]({'where':{'id':_0x36b21c[_0xdfb3('0x56')]['id']},'attributes':['id','name','role']})['then'](handleEntityNotFound(_0x4a0ae6,null))[_0xdfb3('0x1e')](function(_0x4314d9){if(_0x4314d9){_0x1de66b=_0x4314d9;if(!_0x36b21c[_0xdfb3('0x46')][_0xdfb3('0xb3')]||!utils[_0xdfb3('0xa3')](_0x36b21c[_0xdfb3('0x46')][_0xdfb3('0xb3')])){throw new db[(_0xdfb3('0x91'))][(_0xdfb3('0x92'))](_0xdfb3('0xa4'));}return _0x4314d9[_0xdfb3('0xb4')+_['capitalize'](_0x36b21c['query'][_0xdfb3('0xb3')][_0xdfb3('0xa6')]())+_0xdfb3('0xa7')](_0x36b21c['query']['ids']);}})[_0xdfb3('0x1e')](function(_0xde43b9){if(_[_0xdfb3('0xb5')](_0x36b21c[_0xdfb3('0x46')][_0xdfb3('0x5e')])){for(var _0x2a3798=0x0;_0x2a3798<_0x36b21c[_0xdfb3('0x46')][_0xdfb3('0x5e')]['length'];_0x2a3798+=0x1){_0x3e112d={'UserId':Number(_0x36b21c['params']['id'])};_0x3e112d[_['capitalize'](_0x36b21c[_0xdfb3('0x46')][_0xdfb3('0xb3')]['toLowerCase']())+_0xdfb3('0xaa')]=Number(_0x36b21c[_0xdfb3('0x46')][_0xdfb3('0x5e')][_0x2a3798]);socket['emit'](_0xdfb3('0x2f')+_['capitalize'](_0x36b21c[_0xdfb3('0x46')][_0xdfb3('0xb3')][_0xdfb3('0xa6')]())+_0xdfb3('0xb6'),_0x3e112d);}}else{_0x3e112d={'UserId':Number(_0x36b21c[_0xdfb3('0x56')]['id'])};_0x3e112d[_[_0xdfb3('0xac')](_0x36b21c['query'][_0xdfb3('0xb3')][_0xdfb3('0xa6')]())+_0xdfb3('0xaa')]=Number(_0x36b21c['query'][_0xdfb3('0x5e')]);socket[_0xdfb3('0xab')]('user'+_[_0xdfb3('0xac')](_0x36b21c[_0xdfb3('0x46')][_0xdfb3('0xb3')][_0xdfb3('0xa6')]())+_0xdfb3('0xb6'),_0x3e112d);}return _0xde43b9;})[_0xdfb3('0x1e')](function(){if(_0x36b21c['query'][_0xdfb3('0xb3')]===_0xdfb3('0xad')){return db[_0xdfb3('0xb0')][_0xdfb3('0x37')]({'where':{'UserId':_0x36b21c[_0xdfb3('0x56')]['id'],'VoiceQueueId':_0x36b21c['query'][_0xdfb3('0x5e')]},'individualHooks':!![]})['then'](function(){return _0x1de66b;});}return _0x1de66b;})[_0xdfb3('0x1e')](respondWithStatusCode(_0x4a0ae6,null))[_0xdfb3('0x28')](handleError(_0x4a0ae6,null));};exports['addAvatar']=function(_0x36e65c,_0x15f194){_0x36e65c[_0xdfb3('0x5b')][_0xdfb3('0xb7')]=_0x36e65c[_0xdfb3('0xb8')]['filename'];return db['User'][_0xdfb3('0x58')]({'where':{'id':_0x36e65c[_0xdfb3('0x56')]['id']}})[_0xdfb3('0x1e')](handleEntityNotFound(_0x15f194,null))[_0xdfb3('0x1e')](saveUpdates(_0x36e65c['body'],null))[_0xdfb3('0x1e')](respondWithResult(_0x15f194,null))['catch'](handleError(_0x15f194,null));};exports[_0xdfb3('0xb9')]=function(_0x31947c,_0xaf41bb){var _0x150b1b=path['join'](config[_0xdfb3('0xba')],_0xdfb3('0xbb'));return db[_0xdfb3('0x43')]['find']({'where':{'id':_0x31947c[_0xdfb3('0x56')]['id']},'attributes':['id','userpic'],'raw':!![]})['then'](handleEntityNotFound(_0xaf41bb,null))[_0xdfb3('0x1e')](function(_0x58d6a6){if(_0x58d6a6){if(_[_0xdfb3('0x65')](_0x58d6a6[_0xdfb3('0xb7')])){return _0xaf41bb[_0xdfb3('0xbc')](_0x150b1b);}else{if(!fs[_0xdfb3('0xbd')](path[_0xdfb3('0xbe')](config[_0xdfb3('0xba')],_0xdfb3('0xbf'),_0x58d6a6['userpic']))){return _0xaf41bb['download'](_0x150b1b);}return _0xaf41bb['download'](path[_0xdfb3('0xbe')](config['root'],_0xdfb3('0xbf'),_0x58d6a6[_0xdfb3('0xb7')]));}}})['catch'](handleError(_0xaf41bb,null));};exports['getOpenTabs']=function(_0x1ea12d,_0x2a4391){return db['User'][_0xdfb3('0x58')]({'where':{'id':_0x1ea12d['params']['id']},'attributes':['id']})['then'](handleEntityNotFound(_0x2a4391,null))['then'](function(_0x394f98){var _0x5d3fa4=[];values=_0x394f98[_0xdfb3('0x51')];_0x5d3fa4[_0xdfb3('0x4c')](get_open_tabs(_0xdfb3('0x59'),_0x394f98[_0xdfb3('0x51')]));_0x5d3fa4['push'](get_open_tabs('sms',_0x394f98['dataValues']));_0x5d3fa4[_0xdfb3('0x4c')](get_open_tabs('openchannel',_0x394f98['dataValues']));_0x5d3fa4[_0xdfb3('0x4c')](get_open_tabs(_0xdfb3('0x55'),_0x394f98[_0xdfb3('0x51')]));_0x5d3fa4[_0xdfb3('0x4c')](get_open_tabs(_0xdfb3('0x53'),_0x394f98['dataValues']));_0x5d3fa4[_0xdfb3('0x4c')](get_open_tabs(_0xdfb3('0x54'),_0x394f98[_0xdfb3('0x51')]));return Promise[_0xdfb3('0x8a')](_0x5d3fa4);})[_0xdfb3('0x1e')](function(_0x5ecd7c){if(_0x5ecd7c){var _0x3aaf57=_[_0xdfb3('0x34')](values['ChatOpenTabs'],function(_0xb2b681){return{'channel':_0xdfb3('0xc0'),'id':_0xb2b681['id'],'createdAt':_0xb2b681[_0xdfb3('0xc1')]};});var _0x44e957=_[_0xdfb3('0x34')](values['FaxOpenTabs'],function(_0x27858e){return{'channel':_0xdfb3('0xc2'),'id':_0x27858e['id'],'createdAt':_0x27858e[_0xdfb3('0xc1')]};});var _0x31c22c=_['map'](values[_0xdfb3('0xc3')],function(_0x1284a2){return{'channel':'OPENCHANNEL','id':_0x1284a2['id'],'createdAt':_0x1284a2[_0xdfb3('0xc1')]};});var _0x4cec26=_[_0xdfb3('0x34')](values['MailOpenTabs'],function(_0x34835b){return{'channel':_0xdfb3('0xc4'),'id':_0x34835b['id'],'createdAt':_0x34835b['createdAt']};});var _0xfa8db7=_[_0xdfb3('0x34')](values['SmsOpenTabs'],function(_0x3414d6){return{'channel':_0xdfb3('0xc5'),'id':_0x3414d6['id'],'createdAt':_0x3414d6[_0xdfb3('0xc1')]};});var _0x12ba51=_[_0xdfb3('0x34')](values[_0xdfb3('0xc6')],function(_0x323ac0){return{'channel':_0xdfb3('0xc7'),'id':_0x323ac0['id'],'createdAt':_0x323ac0['createdAt']};});var _0x5e41cf=_[_0xdfb3('0xc8')](_0x3aaf57,_0x44e957,_0x31c22c,_0x4cec26,_0xfa8db7,_0x12ba51);var _0x53341f={'count':_0x5e41cf[_0xdfb3('0x50')],'rows':_0x5e41cf};return _0x53341f;}else return null;})[_0xdfb3('0x1e')](respondWithResult(_0x2a4391,null))[_0xdfb3('0x28')](handleError(_0x2a4391,null));};exports[_0xdfb3('0xc9')]=function(_0x17d068,_0x3507c1){var _0x43b7a6={};return db['User'][_0xdfb3('0x99')]({'where':{'id':_0x17d068['params']['id']}})[_0xdfb3('0x1e')](function(_0x31b84a){if(!_0x31b84a){throw new APINotFoundError(util[_0xdfb3('0xca')](_0xdfb3('0xcb'),_0x17d068[_0xdfb3('0x56')]['id']));}return contacts[_0xdfb3('0x5c')]();})[_0xdfb3('0x1e')](function(_0x2fd9c3){_0x17d068[_0xdfb3('0x46')][_0xdfb3('0x43')]=_0x17d068[_0xdfb3('0x56')]['id'];_0x43b7a6=qs[_0xdfb3('0x41')](_0x2fd9c3,_0x17d068);if(_0x17d068['query'][_0xdfb3('0xcc')](_0xdfb3('0x44'))){_0x43b7a6[_0xdfb3('0x45')]=[{'model':db[_0xdfb3('0xcd')],'as':'List','required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0xdfb3('0x36'),_0xdfb3('0xce')],'where':_0x17d068['query'][_0xdfb3('0xcf')]?{'id':_0x17d068[_0xdfb3('0x46')]['tag']}:undefined,'required':_0x17d068['query'][_0xdfb3('0xcf')]?!![]:![]}];}return contacts[_0xdfb3('0x4d')](_0x17d068[_0xdfb3('0x46')],_0x17d068[_0xdfb3('0x2f')],_0x43b7a6,_0x2fd9c3);})[_0xdfb3('0x1e')](respondWithFilteredResult(_0x3507c1,_0x43b7a6))[_0xdfb3('0x28')](APIHandleError(_0x3507c1));};exports['getQueues']=function(_0x33baf8,_0x28eabb){var _0xd1feca;var _0xa1329e={};var _0x52b198;return db[_0xdfb3('0x43')][_0xdfb3('0x99')]({'where':{'id':_0x33baf8[_0xdfb3('0x56')]['id']},'attributes':['id',_0xdfb3('0x36'),_0xdfb3('0x2a')]})[_0xdfb3('0x1e')](handleEntityNotFound(_0x28eabb,null))[_0xdfb3('0x1e')](function(_0x1a1109){if(!utils[_0xdfb3('0xa3')](_0x33baf8['query']['channel'])){throw new db[(_0xdfb3('0x91'))]['ValidationError'](_0xdfb3('0xa4'));}_0xd1feca=_0x1a1109;var _0x9f7572={};_0x9f7572[_0xdfb3('0xd0')]=_[_0xdfb3('0xd1')](db[_[_0xdfb3('0xac')](_0x33baf8[_0xdfb3('0x46')][_0xdfb3('0xb3')])+'Queue']['rawAttributes']);_0x9f7572[_0xdfb3('0x46')]=_['keys'](_0x33baf8[_0xdfb3('0x46')]);_0x9f7572[_0xdfb3('0xd2')]=_[_0xdfb3('0xd3')](_0x9f7572[_0xdfb3('0xd0')],_0x9f7572[_0xdfb3('0x46')]);_0xa1329e['attributes']=_[_0xdfb3('0xd3')](_0x9f7572[_0xdfb3('0xd0')],qs[_0xdfb3('0xd4')](_0x33baf8[_0xdfb3('0x46')][_0xdfb3('0xd4')]));_0xa1329e['attributes']=_0xa1329e['attributes'][_0xdfb3('0x50')]?_0xa1329e[_0xdfb3('0x4b')]:_0x9f7572[_0xdfb3('0xd0')];_0xa1329e['order']=qs[_0xdfb3('0xd5')](_0x33baf8[_0xdfb3('0x46')][_0xdfb3('0xd5')]);_0xa1329e[_0xdfb3('0x42')]=qs[_0xdfb3('0xd2')](_[_0xdfb3('0xd6')](_0x33baf8[_0xdfb3('0x46')],_0x9f7572[_0xdfb3('0xd2')]));if(_0x33baf8[_0xdfb3('0x46')][_0xdfb3('0x32')]){_0xa1329e['where']=_[_0xdfb3('0x57')](_0xa1329e[_0xdfb3('0x42')],{'$or':_[_0xdfb3('0x34')](_0xa1329e[_0xdfb3('0x4b')],function(_0x2c04bc){var _0x32957c={};_0x32957c[_0x2c04bc]={'$like':'%'+_0x33baf8['query'][_0xdfb3('0x32')]+'%'};return _0x32957c;})});}_0xa1329e=_[_0xdfb3('0x57')]({},_0xa1329e,_0x33baf8[_0xdfb3('0xd7')]);switch(_0xd1feca['role']){case'admin':return db[_[_0xdfb3('0xac')](_0x33baf8['query'][_0xdfb3('0xb3')])+'Queue'][_0xdfb3('0x4d')](_0xa1329e);case _0xdfb3('0x2f'):case'agent':return _0xd1feca[_0xdfb3('0x2d')+_[_0xdfb3('0xac')](_0x33baf8['query'][_0xdfb3('0xb3')])+_0xdfb3('0xa7')](_0xa1329e);default:throw new db['Sequelize'][(_0xdfb3('0x92'))](_0xdfb3('0xd8'));}})[_0xdfb3('0x1e')](function(_0x1029fc){_0x52b198=_0x1029fc[_0xdfb3('0x50')];if(!_0x33baf8['query']['hasOwnProperty'](_0xdfb3('0xd9'))){_0xa1329e[_0xdfb3('0x19')]=qs[_0xdfb3('0x19')](_0x33baf8[_0xdfb3('0x46')][_0xdfb3('0x19')]);_0xa1329e['offset']=qs['offset'](_0x33baf8[_0xdfb3('0x46')][_0xdfb3('0x1a')]);}switch(_0xd1feca[_0xdfb3('0x2a')]){case _0xdfb3('0x2e'):return db[_[_0xdfb3('0xac')](_0x33baf8['query']['channel'])+_0xdfb3('0xda')][_0xdfb3('0x4d')](_0xa1329e);case _0xdfb3('0x2f'):case _0xdfb3('0x2b'):return _0xd1feca['get'+_[_0xdfb3('0xac')](_0x33baf8[_0xdfb3('0x46')][_0xdfb3('0xb3')])+_0xdfb3('0xa7')](_0xa1329e);}})[_0xdfb3('0x1e')](function(_0x1d5c05){return{'count':_0x52b198,'rows':_0x1d5c05};})['then'](respondWithResult(_0x28eabb,null))[_0xdfb3('0x28')](handleError(_0x28eabb,null));};exports[_0xdfb3('0xdb')]=function(_0x50a89f,_0xe7ab89){var _0x3b2748={};var _0x39c8be={};var _0xa54e37;var _0x36f6a3;return db['User'][_0xdfb3('0x99')]({'where':{'id':_0x50a89f[_0xdfb3('0x56')]['id']}})[_0xdfb3('0x1e')](handleEntityNotFound(_0xe7ab89,null))[_0xdfb3('0x1e')](function(_0x4c0abc){if(_0x4c0abc){_0xa54e37=_0x4c0abc;_0x39c8be[_0xdfb3('0xd0')]=_[_0xdfb3('0xd1')](db[_0xdfb3('0xb0')][_0xdfb3('0xdc')]);_0x39c8be[_0xdfb3('0x46')]=_[_0xdfb3('0xd1')](_0x50a89f[_0xdfb3('0x46')]);_0x39c8be['filters']=_[_0xdfb3('0xd3')](_0x39c8be[_0xdfb3('0xd0')],_0x39c8be[_0xdfb3('0x46')]);_0x3b2748['attributes']=_[_0xdfb3('0xd3')](_0x39c8be['model'],qs[_0xdfb3('0xd4')](_0x50a89f[_0xdfb3('0x46')][_0xdfb3('0xd4')]));_0x3b2748[_0xdfb3('0x4b')]=_0x3b2748[_0xdfb3('0x4b')][_0xdfb3('0x50')]?_0x3b2748[_0xdfb3('0x4b')]:_0x39c8be[_0xdfb3('0xd0')];_0x3b2748[_0xdfb3('0xdd')]=qs[_0xdfb3('0xd5')](_0x50a89f[_0xdfb3('0x46')][_0xdfb3('0xd5')]);_0x3b2748['where']=qs[_0xdfb3('0xd2')](_[_0xdfb3('0xd6')](_0x50a89f[_0xdfb3('0x46')],_0x39c8be['filters']));if(_0x50a89f['query'][_0xdfb3('0x32')]){_0x3b2748['where']=_[_0xdfb3('0x57')](_0x3b2748[_0xdfb3('0x42')],{'$or':_[_0xdfb3('0x34')](_0x3b2748[_0xdfb3('0x4b')],function(_0x2081a7){var _0x4c057b={};_0x4c057b[_0x2081a7]={'$like':'%'+_0x50a89f[_0xdfb3('0x46')][_0xdfb3('0x32')]+'%'};return _0x4c057b;})});}_0x3b2748=_['merge']({},_0x3b2748,_0x50a89f[_0xdfb3('0xd7')]);return _0xa54e37[_0xdfb3('0xdb')](_0x3b2748);}})[_0xdfb3('0x1e')](function(_0x412e7d){if(_0x412e7d){_0x36f6a3=_0x412e7d[_0xdfb3('0x50')];if(!_0x50a89f[_0xdfb3('0x46')][_0xdfb3('0xcc')](_0xdfb3('0xd9'))){_0x3b2748[_0xdfb3('0x19')]=qs[_0xdfb3('0x19')](_0x50a89f['query']['limit']);_0x3b2748['offset']=qs[_0xdfb3('0x1a')](_0x50a89f['query'][_0xdfb3('0x1a')]);}return _0xa54e37['getVoiceQueuesRt'](_0x3b2748);}})['then'](function(_0x49e665){if(_0x49e665){return _0x49e665?{'count':_0x36f6a3,'rows':_0x49e665}:null;}})['then'](respondWithResult(_0xe7ab89,null))[_0xdfb3('0x28')](handleError(_0xe7ab89,null));};exports['getGroups']=function(_0x2274ab,_0x947a94){var _0x4e13c3={};var _0x135a3a={};var _0x2ceec6;var _0x289ea3;return db['User'][_0xdfb3('0x99')]({'where':{'id':_0x2274ab['params']['id']}})[_0xdfb3('0x1e')](handleEntityNotFound(_0x947a94,null))[_0xdfb3('0x1e')](function(_0x291737){if(_0x291737){_0x2ceec6=_0x291737;_0x135a3a['model']=_[_0xdfb3('0xd1')](db['ChatGroup']['rawAttributes']);_0x135a3a[_0xdfb3('0x46')]=_[_0xdfb3('0xd1')](_0x2274ab[_0xdfb3('0x46')]);_0x135a3a['filters']=_['intersection'](_0x135a3a[_0xdfb3('0xd0')],_0x135a3a[_0xdfb3('0x46')]);_0x4e13c3['attributes']=_['intersection'](_0x135a3a[_0xdfb3('0xd0')],qs[_0xdfb3('0xd4')](_0x2274ab[_0xdfb3('0x46')][_0xdfb3('0xd4')]));_0x4e13c3[_0xdfb3('0x4b')]=_0x4e13c3[_0xdfb3('0x4b')][_0xdfb3('0x50')]?_0x4e13c3[_0xdfb3('0x4b')]:_0x135a3a[_0xdfb3('0xd0')];_0x4e13c3[_0xdfb3('0xdd')]=qs[_0xdfb3('0xd5')](_0x2274ab[_0xdfb3('0x46')][_0xdfb3('0xd5')]);_0x4e13c3[_0xdfb3('0x42')]=qs[_0xdfb3('0xd2')](_[_0xdfb3('0xd6')](_0x2274ab[_0xdfb3('0x46')],_0x135a3a[_0xdfb3('0xd2')]));if(_0x2274ab[_0xdfb3('0x46')][_0xdfb3('0x32')]){_0x4e13c3['where']=_[_0xdfb3('0x57')](_0x4e13c3['where'],{'$or':_[_0xdfb3('0x34')](_0x4e13c3[_0xdfb3('0x4b')],function(_0x21b721){var _0x29d027={};_0x29d027[_0x21b721]={'$like':'%'+_0x2274ab['query'][_0xdfb3('0x32')]+'%'};return _0x29d027;})});}_0x4e13c3=_['merge']({},_0x4e13c3,_0x2274ab[_0xdfb3('0xd7')]);return _0x2ceec6['getGroups'](_0x4e13c3);}})[_0xdfb3('0x1e')](function(_0xf8d620){if(_0xf8d620){_0x289ea3=_0xf8d620['length'];if(!_0x2274ab[_0xdfb3('0x46')][_0xdfb3('0xcc')](_0xdfb3('0xd9'))){_0x4e13c3[_0xdfb3('0x19')]=qs[_0xdfb3('0x19')](_0x2274ab[_0xdfb3('0x46')][_0xdfb3('0x19')]);_0x4e13c3[_0xdfb3('0x1a')]=qs[_0xdfb3('0x1a')](_0x2274ab['query'][_0xdfb3('0x1a')]);}return _0x2ceec6[_0xdfb3('0xde')](_0x4e13c3);}})[_0xdfb3('0x1e')](function(_0x2f0377){if(_0x2f0377){return _0x2f0377?{'count':_0x289ea3,'rows':_0x2f0377}:null;}})[_0xdfb3('0x1e')](respondWithResult(_0x947a94,null))[_0xdfb3('0x28')](handleError(_0x947a94,null));};exports[_0xdfb3('0xdf')]=function(_0x3637cf,_0x71249d){var _0x340c94={'raw':!![],'where':{}};var _0x19e00d={};var _0x10a32f={'count':0x0,'rows':[]};return db['User'][_0xdfb3('0x99')]({'where':{'id':_0x3637cf[_0xdfb3('0x56')]['id']}})[_0xdfb3('0x1e')](handleEntityNotFound(_0x71249d,null))[_0xdfb3('0x1e')](function(_0x47a26b){if(_0x47a26b){_0x19e00d[_0xdfb3('0xd0')]=_[_0xdfb3('0xd1')](db[_0xdfb3('0xe0')][_0xdfb3('0xdc')]);_0x19e00d[_0xdfb3('0x46')]=_[_0xdfb3('0xd1')](_0x3637cf['query']);_0x19e00d['filters']=_[_0xdfb3('0xd3')](_0x19e00d[_0xdfb3('0xd0')],_0x19e00d[_0xdfb3('0x46')]);_0x340c94['attributes']=_[_0xdfb3('0xd3')](_0x19e00d[_0xdfb3('0xd0')],qs[_0xdfb3('0xd4')](_0x3637cf['query'][_0xdfb3('0xd4')]));_0x340c94[_0xdfb3('0x4b')]=_0x340c94['attributes'][_0xdfb3('0x50')]?_0x340c94[_0xdfb3('0x4b')]:_0x19e00d[_0xdfb3('0xd0')];if(!_0x3637cf[_0xdfb3('0x46')][_0xdfb3('0xcc')](_0xdfb3('0xd9'))){_0x340c94['limit']=qs[_0xdfb3('0x19')](_0x3637cf[_0xdfb3('0x46')][_0xdfb3('0x19')]);_0x340c94['offset']=qs[_0xdfb3('0x1a')](_0x3637cf[_0xdfb3('0x46')]['offset']);}_0x340c94[_0xdfb3('0xdd')]=qs[_0xdfb3('0xd5')](_0x3637cf[_0xdfb3('0x46')][_0xdfb3('0xd5')]);_0x340c94[_0xdfb3('0x42')]=qs[_0xdfb3('0xd2')](_['pick'](_0x3637cf[_0xdfb3('0x46')],_0x19e00d['filters']));_0x340c94[_0xdfb3('0x42')]['UserId']=_0x47a26b['id'];if(_0x3637cf[_0xdfb3('0x46')][_0xdfb3('0x32')]){_0x340c94[_0xdfb3('0x42')]=_['merge'](_0x340c94[_0xdfb3('0x42')],{'$or':_[_0xdfb3('0x34')](_0x340c94[_0xdfb3('0x4b')],function(_0x23a5b9){var _0x524447={};_0x524447[_0x23a5b9]={'$like':'%'+_0x3637cf[_0xdfb3('0x46')]['filter']+'%'};return _0x524447;})});}_0x340c94=_[_0xdfb3('0x57')]({},_0x340c94,_0x3637cf['options']);return db['VoiceRecording'][_0xdfb3('0x1b')]({'where':_0x340c94[_0xdfb3('0x42')]})['then'](function(_0x3b13f2){_0x10a32f[_0xdfb3('0x1b')]=_0x3b13f2;if(_0x3637cf[_0xdfb3('0x46')][_0xdfb3('0x44')]){_0x340c94['include']=[{'all':!![]}];}return db[_0xdfb3('0xe0')][_0xdfb3('0x4d')](_0x340c94);})[_0xdfb3('0x1e')](function(_0x99bee7){_0x10a32f['rows']=_0x99bee7;return _0x10a32f;});}})[_0xdfb3('0x1e')](respondWithFilteredResult(_0x71249d,_0x340c94))[_0xdfb3('0x28')](handleError(_0x71249d,null));};exports['getScreenRecordings']=function(_0x1acf20,_0x2584a2){var _0x4cff80={'raw':!![],'where':{}};var _0x29c69c={};var _0xaeec66={'count':0x0,'rows':[]};return db[_0xdfb3('0x43')][_0xdfb3('0x99')]({'where':{'id':_0x1acf20[_0xdfb3('0x56')]['id']}})[_0xdfb3('0x1e')](handleEntityNotFound(_0x2584a2,null))[_0xdfb3('0x1e')](function(_0x371dde){if(_0x371dde){_0x29c69c['model']=_[_0xdfb3('0xd1')](db[_0xdfb3('0xe1')]['rawAttributes']);_0x29c69c[_0xdfb3('0x46')]=_['keys'](_0x1acf20[_0xdfb3('0x46')]);_0x29c69c[_0xdfb3('0xd2')]=_[_0xdfb3('0xd3')](_0x29c69c['model'],_0x29c69c[_0xdfb3('0x46')]);_0x4cff80[_0xdfb3('0x4b')]=_[_0xdfb3('0xd3')](_0x29c69c[_0xdfb3('0xd0')],qs[_0xdfb3('0xd4')](_0x1acf20[_0xdfb3('0x46')]['fields']));_0x4cff80[_0xdfb3('0x4b')]=_0x4cff80[_0xdfb3('0x4b')][_0xdfb3('0x50')]?_0x4cff80[_0xdfb3('0x4b')]:_0x29c69c[_0xdfb3('0xd0')];if(!_0x1acf20[_0xdfb3('0x46')][_0xdfb3('0xcc')](_0xdfb3('0xd9'))){_0x4cff80[_0xdfb3('0x19')]=qs['limit'](_0x1acf20[_0xdfb3('0x46')][_0xdfb3('0x19')]);_0x4cff80[_0xdfb3('0x1a')]=qs[_0xdfb3('0x1a')](_0x1acf20['query'][_0xdfb3('0x1a')]);}_0x4cff80[_0xdfb3('0xdd')]=qs[_0xdfb3('0xd5')](_0x1acf20[_0xdfb3('0x46')][_0xdfb3('0xd5')]);_0x4cff80[_0xdfb3('0x42')]=qs[_0xdfb3('0xd2')](_[_0xdfb3('0xd6')](_0x1acf20[_0xdfb3('0x46')],_0x29c69c['filters']));_0x4cff80[_0xdfb3('0x42')][_0xdfb3('0xe2')]=_0x371dde['id'];if(_0x1acf20['query'][_0xdfb3('0x32')]){_0x4cff80[_0xdfb3('0x42')]=_[_0xdfb3('0x57')](_0x4cff80[_0xdfb3('0x42')],{'$or':_[_0xdfb3('0x34')](_0x4cff80[_0xdfb3('0x4b')],function(_0x206c99){var _0x7dadc6={};_0x7dadc6[_0x206c99]={'$like':'%'+_0x1acf20['query'][_0xdfb3('0x32')]+'%'};return _0x7dadc6;})});}_0x4cff80=_[_0xdfb3('0x57')]({},_0x4cff80,_0x1acf20[_0xdfb3('0xd7')]);return db[_0xdfb3('0xe1')][_0xdfb3('0x1b')]({'where':_0x4cff80[_0xdfb3('0x42')]})[_0xdfb3('0x1e')](function(_0x1b35a0){_0xaeec66[_0xdfb3('0x1b')]=_0x1b35a0;if(_0x1acf20[_0xdfb3('0x46')]['includeAll']){_0x4cff80[_0xdfb3('0x45')]=[{'all':!![]}];}return db[_0xdfb3('0xe1')][_0xdfb3('0x4d')](_0x4cff80);})[_0xdfb3('0x1e')](function(_0x34c900){_0xaeec66[_0xdfb3('0x4e')]=_0x34c900;return _0xaeec66;});}})[_0xdfb3('0x1e')](respondWithFilteredResult(_0x2584a2,_0x4cff80))[_0xdfb3('0x28')](handleError(_0x2584a2,null));};exports[_0xdfb3('0xe3')]=function(_0x500457,_0x1d2f01){var _0x2397a0={};var _0x22d26c={};var _0xdfb36c;var _0x295ce2;return db['User'][_0xdfb3('0x99')]({'where':{'id':_0x500457['params']['id']}})[_0xdfb3('0x1e')](handleEntityNotFound(_0x1d2f01,null))[_0xdfb3('0x1e')](function(_0x32c263){if(_0x32c263){_0xdfb36c=_0x32c263;_0x22d26c[_0xdfb3('0xd0')]=_[_0xdfb3('0xd1')](db['ChatInteraction']['rawAttributes']);_0x22d26c[_0xdfb3('0x46')]=_[_0xdfb3('0xd1')](_0x500457['query']);_0x22d26c['filters']=_['intersection'](_0x22d26c[_0xdfb3('0xd0')],_0x22d26c[_0xdfb3('0x46')]);_0x2397a0[_0xdfb3('0x4b')]=_[_0xdfb3('0xd3')](_0x22d26c['model'],qs[_0xdfb3('0xd4')](_0x500457[_0xdfb3('0x46')][_0xdfb3('0xd4')]));_0x2397a0['attributes']=_0x2397a0[_0xdfb3('0x4b')]['length']?_0x2397a0[_0xdfb3('0x4b')]:_0x22d26c[_0xdfb3('0xd0')];_0x2397a0[_0xdfb3('0xdd')]=qs[_0xdfb3('0xd5')](_0x500457[_0xdfb3('0x46')][_0xdfb3('0xd5')]);_0x2397a0['where']=qs[_0xdfb3('0xd2')](_[_0xdfb3('0xd6')](_0x500457[_0xdfb3('0x46')],_0x22d26c[_0xdfb3('0xd2')]));if(_0x500457[_0xdfb3('0x46')][_0xdfb3('0x32')]){_0x2397a0[_0xdfb3('0x42')]=_[_0xdfb3('0x57')](_0x2397a0[_0xdfb3('0x42')],{'$or':_[_0xdfb3('0x34')](_0x2397a0['attributes'],function(_0x1c0fd6){var _0x417892={};_0x417892[_0x1c0fd6]={'$like':'%'+_0x500457['query'][_0xdfb3('0x32')]+'%'};return _0x417892;})});}_0x2397a0=_[_0xdfb3('0x57')]({},_0x2397a0,_0x500457['options']);return _0xdfb36c[_0xdfb3('0xe3')](_0x2397a0);}})[_0xdfb3('0x1e')](function(_0x33e0b8){if(_0x33e0b8){_0x295ce2=_0x33e0b8[_0xdfb3('0x50')];if(!_0x500457['query'][_0xdfb3('0xcc')](_0xdfb3('0xd9'))){_0x2397a0['limit']=qs['limit'](_0x500457['query'][_0xdfb3('0x19')]);_0x2397a0[_0xdfb3('0x1a')]=qs[_0xdfb3('0x1a')](_0x500457[_0xdfb3('0x46')]['offset']);}return _0xdfb36c[_0xdfb3('0xe3')](_0x2397a0);}})[_0xdfb3('0x1e')](function(_0x3c7e07){if(_0x3c7e07){return _0x3c7e07?{'count':_0x295ce2,'rows':_0x3c7e07}:null;}})['then'](respondWithResult(_0x1d2f01,null))[_0xdfb3('0x28')](handleError(_0x1d2f01,null));};exports['getOpenchannelInteractions']=function(_0x44e3e0,_0x124ea1){var _0x4ef4b4={};var _0x5a3e21={};var _0x53f655;var _0x1aadc2;return db[_0xdfb3('0x43')]['findOne']({'where':{'id':_0x44e3e0[_0xdfb3('0x56')]['id']}})[_0xdfb3('0x1e')](handleEntityNotFound(_0x124ea1,null))['then'](function(_0x39b7d9){if(_0x39b7d9){_0x53f655=_0x39b7d9;_0x5a3e21['model']=_[_0xdfb3('0xd1')](db[_0xdfb3('0xe4')]['rawAttributes']);_0x5a3e21[_0xdfb3('0x46')]=_[_0xdfb3('0xd1')](_0x44e3e0[_0xdfb3('0x46')]);_0x5a3e21['filters']=_['intersection'](_0x5a3e21['model'],_0x5a3e21['query']);_0x4ef4b4[_0xdfb3('0x4b')]=_[_0xdfb3('0xd3')](_0x5a3e21[_0xdfb3('0xd0')],qs[_0xdfb3('0xd4')](_0x44e3e0[_0xdfb3('0x46')][_0xdfb3('0xd4')]));_0x4ef4b4[_0xdfb3('0x4b')]=_0x4ef4b4['attributes'][_0xdfb3('0x50')]?_0x4ef4b4[_0xdfb3('0x4b')]:_0x5a3e21[_0xdfb3('0xd0')];_0x4ef4b4[_0xdfb3('0xdd')]=qs[_0xdfb3('0xd5')](_0x44e3e0['query'][_0xdfb3('0xd5')]);_0x4ef4b4['where']=qs[_0xdfb3('0xd2')](_[_0xdfb3('0xd6')](_0x44e3e0['query'],_0x5a3e21['filters']));if(_0x44e3e0[_0xdfb3('0x46')][_0xdfb3('0x32')]){_0x4ef4b4[_0xdfb3('0x42')]=_[_0xdfb3('0x57')](_0x4ef4b4[_0xdfb3('0x42')],{'$or':_[_0xdfb3('0x34')](_0x4ef4b4[_0xdfb3('0x4b')],function(_0x15d82c){var _0x4f199d={};_0x4f199d[_0x15d82c]={'$like':'%'+_0x44e3e0[_0xdfb3('0x46')]['filter']+'%'};return _0x4f199d;})});}_0x4ef4b4=_['merge']({},_0x4ef4b4,_0x44e3e0[_0xdfb3('0xd7')]);return _0x53f655['getOpenchannelInteractions'](_0x4ef4b4);}})['then'](function(_0x5ddef2){if(_0x5ddef2){_0x1aadc2=_0x5ddef2[_0xdfb3('0x50')];if(!_0x44e3e0[_0xdfb3('0x46')][_0xdfb3('0xcc')](_0xdfb3('0xd9'))){_0x4ef4b4[_0xdfb3('0x19')]=qs['limit'](_0x44e3e0[_0xdfb3('0x46')]['limit']);_0x4ef4b4[_0xdfb3('0x1a')]=qs[_0xdfb3('0x1a')](_0x44e3e0[_0xdfb3('0x46')][_0xdfb3('0x1a')]);}return _0x53f655[_0xdfb3('0xe5')](_0x4ef4b4);}})[_0xdfb3('0x1e')](function(_0x4ad96f){if(_0x4ad96f){return _0x4ad96f?{'count':_0x1aadc2,'rows':_0x4ad96f}:null;}})['then'](respondWithResult(_0x124ea1,null))[_0xdfb3('0x28')](handleError(_0x124ea1,null));};exports[_0xdfb3('0xe6')]=function(_0x45d7ca,_0x572d70){var _0x49ea70={'raw':!![],'where':{}};var _0x57693c={};var _0x243716={'count':0x0,'rows':[]};return db[_0xdfb3('0x43')][_0xdfb3('0x99')]({'where':{'id':_0x45d7ca[_0xdfb3('0x56')]['id']}})[_0xdfb3('0x1e')](handleEntityNotFound(_0x572d70,null))[_0xdfb3('0x1e')](function(_0x3a6556){if(_0x3a6556){_0x57693c['model']=_[_0xdfb3('0xd1')](db[_0xdfb3('0xe7')][_0xdfb3('0xdc')]);_0x57693c[_0xdfb3('0x46')]=_[_0xdfb3('0xd1')](_0x45d7ca['query']);_0x57693c[_0xdfb3('0xd2')]=_['intersection'](_0x57693c[_0xdfb3('0xd0')],_0x57693c[_0xdfb3('0x46')]);_0x49ea70[_0xdfb3('0x4b')]=_['intersection'](_0x57693c[_0xdfb3('0xd0')],qs[_0xdfb3('0xd4')](_0x45d7ca[_0xdfb3('0x46')][_0xdfb3('0xd4')]));_0x49ea70[_0xdfb3('0x4b')]=_0x49ea70[_0xdfb3('0x4b')][_0xdfb3('0x50')]?_0x49ea70[_0xdfb3('0x4b')]:_0x57693c[_0xdfb3('0xd0')];if(!_0x45d7ca[_0xdfb3('0x46')][_0xdfb3('0xcc')](_0xdfb3('0xd9'))){_0x49ea70['limit']=qs[_0xdfb3('0x19')](_0x45d7ca[_0xdfb3('0x46')][_0xdfb3('0x19')]);_0x49ea70[_0xdfb3('0x1a')]=qs[_0xdfb3('0x1a')](_0x45d7ca[_0xdfb3('0x46')][_0xdfb3('0x1a')]);}_0x49ea70[_0xdfb3('0xdd')]=qs[_0xdfb3('0xd5')](_0x45d7ca[_0xdfb3('0x46')][_0xdfb3('0xd5')]);_0x49ea70[_0xdfb3('0x42')]=qs[_0xdfb3('0xd2')](_[_0xdfb3('0xd6')](_0x45d7ca[_0xdfb3('0x46')],_0x57693c[_0xdfb3('0xd2')]));_0x49ea70[_0xdfb3('0x42')]['UserId']=_0x3a6556['id'];if(_0x45d7ca[_0xdfb3('0x46')][_0xdfb3('0x32')]){_0x49ea70[_0xdfb3('0x42')]=_['merge'](_0x49ea70['where'],{'$or':_[_0xdfb3('0x34')](_0x49ea70[_0xdfb3('0x4b')],function(_0x3763c4){var _0x37e605={};_0x37e605[_0x3763c4]={'$like':'%'+_0x45d7ca[_0xdfb3('0x46')][_0xdfb3('0x32')]+'%'};return _0x37e605;})});}_0x49ea70=_['merge']({},_0x49ea70,_0x45d7ca[_0xdfb3('0xd7')]);return db[_0xdfb3('0xe7')][_0xdfb3('0x1b')]({'where':_0x49ea70[_0xdfb3('0x42')]})[_0xdfb3('0x1e')](function(_0x4a9c3a){_0x243716[_0xdfb3('0x1b')]=_0x4a9c3a;if(_0x45d7ca[_0xdfb3('0x46')][_0xdfb3('0x44')]){_0x49ea70[_0xdfb3('0x45')]=[{'all':!![]}];}return db[_0xdfb3('0xe7')][_0xdfb3('0x4d')](_0x49ea70);})[_0xdfb3('0x1e')](function(_0x4c6172){_0x243716[_0xdfb3('0x4e')]=_0x4c6172;return _0x243716;});}})['then'](respondWithFilteredResult(_0x572d70,_0x49ea70))[_0xdfb3('0x28')](handleError(_0x572d70,null));};exports[_0xdfb3('0xe8')]=function(_0xe35ef7,_0xdc7b18){var _0x4833e3={};var _0xd966fe={};var _0x4acb75;var _0x53c800;return db[_0xdfb3('0x43')][_0xdfb3('0x99')]({'where':{'id':_0xe35ef7[_0xdfb3('0x56')]['id']}})[_0xdfb3('0x1e')](handleEntityNotFound(_0xdc7b18,null))[_0xdfb3('0x1e')](function(_0x3691b1){if(_0x3691b1){_0x4acb75=_0x3691b1;_0xd966fe['model']=_['keys'](db[_0xdfb3('0xe9')][_0xdfb3('0xdc')]);_0xd966fe['query']=_[_0xdfb3('0xd1')](_0xe35ef7['query']);_0xd966fe[_0xdfb3('0xd2')]=_[_0xdfb3('0xd3')](_0xd966fe[_0xdfb3('0xd0')],_0xd966fe[_0xdfb3('0x46')]);_0x4833e3[_0xdfb3('0x4b')]=_[_0xdfb3('0xd3')](_0xd966fe[_0xdfb3('0xd0')],qs[_0xdfb3('0xd4')](_0xe35ef7[_0xdfb3('0x46')]['fields']));_0x4833e3['attributes']=_0x4833e3[_0xdfb3('0x4b')]['length']?_0x4833e3[_0xdfb3('0x4b')]:_0xd966fe[_0xdfb3('0xd0')];_0x4833e3[_0xdfb3('0xdd')]=qs[_0xdfb3('0xd5')](_0xe35ef7[_0xdfb3('0x46')][_0xdfb3('0xd5')]);_0x4833e3[_0xdfb3('0x42')]=qs[_0xdfb3('0xd2')](_[_0xdfb3('0xd6')](_0xe35ef7[_0xdfb3('0x46')],_0xd966fe[_0xdfb3('0xd2')]));if(_0xe35ef7[_0xdfb3('0x46')][_0xdfb3('0x32')]){_0x4833e3[_0xdfb3('0x42')]=_['merge'](_0x4833e3[_0xdfb3('0x42')],{'$or':_['map'](_0x4833e3[_0xdfb3('0x4b')],function(_0x11d85b){var _0x4ff3c6={};_0x4ff3c6[_0x11d85b]={'$like':'%'+_0xe35ef7[_0xdfb3('0x46')][_0xdfb3('0x32')]+'%'};return _0x4ff3c6;})});}_0x4833e3=_[_0xdfb3('0x57')]({},_0x4833e3,_0xe35ef7[_0xdfb3('0xd7')]);return _0x4acb75['getSmsInteractions'](_0x4833e3);}})[_0xdfb3('0x1e')](function(_0x224ed5){if(_0x224ed5){_0x53c800=_0x224ed5[_0xdfb3('0x50')];if(!_0xe35ef7[_0xdfb3('0x46')][_0xdfb3('0xcc')]('nolimit')){_0x4833e3['limit']=qs[_0xdfb3('0x19')](_0xe35ef7[_0xdfb3('0x46')]['limit']);_0x4833e3[_0xdfb3('0x1a')]=qs['offset'](_0xe35ef7[_0xdfb3('0x46')][_0xdfb3('0x1a')]);}return _0x4acb75['getSmsInteractions'](_0x4833e3);}})[_0xdfb3('0x1e')](function(_0x4ca1c8){if(_0x4ca1c8){return _0x4ca1c8?{'count':_0x53c800,'rows':_0x4ca1c8}:null;}})[_0xdfb3('0x1e')](respondWithResult(_0xdc7b18,null))[_0xdfb3('0x28')](handleError(_0xdc7b18,null));};exports[_0xdfb3('0xea')]=function(_0x20c5c1,_0x405bc0){var _0x4660e3={};var _0x2768bd={};var _0x359518;var _0x3544ff;return db['User'][_0xdfb3('0x99')]({'where':{'id':_0x20c5c1['params']['id']}})[_0xdfb3('0x1e')](handleEntityNotFound(_0x405bc0,null))['then'](function(_0x177bab){if(_0x177bab){_0x359518=_0x177bab;_0x2768bd[_0xdfb3('0xd0')]=_[_0xdfb3('0xd1')](db['FaxInteraction']['rawAttributes']);_0x2768bd['query']=_[_0xdfb3('0xd1')](_0x20c5c1[_0xdfb3('0x46')]);_0x2768bd[_0xdfb3('0xd2')]=_['intersection'](_0x2768bd['model'],_0x2768bd[_0xdfb3('0x46')]);_0x4660e3[_0xdfb3('0x4b')]=_[_0xdfb3('0xd3')](_0x2768bd[_0xdfb3('0xd0')],qs[_0xdfb3('0xd4')](_0x20c5c1[_0xdfb3('0x46')][_0xdfb3('0xd4')]));_0x4660e3[_0xdfb3('0x4b')]=_0x4660e3[_0xdfb3('0x4b')][_0xdfb3('0x50')]?_0x4660e3['attributes']:_0x2768bd[_0xdfb3('0xd0')];_0x4660e3[_0xdfb3('0xdd')]=qs[_0xdfb3('0xd5')](_0x20c5c1[_0xdfb3('0x46')][_0xdfb3('0xd5')]);_0x4660e3['where']=qs[_0xdfb3('0xd2')](_['pick'](_0x20c5c1[_0xdfb3('0x46')],_0x2768bd[_0xdfb3('0xd2')]));if(_0x20c5c1[_0xdfb3('0x46')][_0xdfb3('0x32')]){_0x4660e3[_0xdfb3('0x42')]=_[_0xdfb3('0x57')](_0x4660e3['where'],{'$or':_['map'](_0x4660e3['attributes'],function(_0x1437c2){var _0x45b7ce={};_0x45b7ce[_0x1437c2]={'$like':'%'+_0x20c5c1[_0xdfb3('0x46')][_0xdfb3('0x32')]+'%'};return _0x45b7ce;})});}_0x4660e3=_[_0xdfb3('0x57')]({},_0x4660e3,_0x20c5c1[_0xdfb3('0xd7')]);return _0x359518[_0xdfb3('0xea')](_0x4660e3);}})[_0xdfb3('0x1e')](function(_0x447ee6){if(_0x447ee6){_0x3544ff=_0x447ee6['length'];if(!_0x20c5c1['query'][_0xdfb3('0xcc')](_0xdfb3('0xd9'))){_0x4660e3[_0xdfb3('0x19')]=qs[_0xdfb3('0x19')](_0x20c5c1[_0xdfb3('0x46')][_0xdfb3('0x19')]);_0x4660e3['offset']=qs[_0xdfb3('0x1a')](_0x20c5c1['query'][_0xdfb3('0x1a')]);}return _0x359518['getFaxInteractions'](_0x4660e3);}})[_0xdfb3('0x1e')](function(_0x13ff2a){if(_0x13ff2a){return _0x13ff2a?{'count':_0x3544ff,'rows':_0x13ff2a}:null;}})[_0xdfb3('0x1e')](respondWithResult(_0x405bc0,null))['catch'](handleError(_0x405bc0,null));};exports['getWhatsappInteractions']=function(_0x31db6c,_0x13d9e8){var _0xa2bb29={};var _0x21d992={};var _0x51f606;var _0x343cfc;return db[_0xdfb3('0x43')]['findOne']({'where':{'id':_0x31db6c[_0xdfb3('0x56')]['id']}})[_0xdfb3('0x1e')](handleEntityNotFound(_0x13d9e8,null))[_0xdfb3('0x1e')](function(_0x4c43b9){if(_0x4c43b9){_0x51f606=_0x4c43b9;_0x21d992['model']=_['keys'](db['WhatsappInteraction'][_0xdfb3('0xdc')]);_0x21d992['query']=_[_0xdfb3('0xd1')](_0x31db6c['query']);_0x21d992[_0xdfb3('0xd2')]=_['intersection'](_0x21d992['model'],_0x21d992[_0xdfb3('0x46')]);_0xa2bb29[_0xdfb3('0x4b')]=_[_0xdfb3('0xd3')](_0x21d992[_0xdfb3('0xd0')],qs[_0xdfb3('0xd4')](_0x31db6c['query'][_0xdfb3('0xd4')]));_0xa2bb29[_0xdfb3('0x4b')]=_0xa2bb29['attributes'][_0xdfb3('0x50')]?_0xa2bb29[_0xdfb3('0x4b')]:_0x21d992[_0xdfb3('0xd0')];_0xa2bb29[_0xdfb3('0xdd')]=qs['sort'](_0x31db6c[_0xdfb3('0x46')][_0xdfb3('0xd5')]);_0xa2bb29[_0xdfb3('0x42')]=qs[_0xdfb3('0xd2')](_['pick'](_0x31db6c[_0xdfb3('0x46')],_0x21d992[_0xdfb3('0xd2')]));if(_0x31db6c[_0xdfb3('0x46')][_0xdfb3('0x32')]){_0xa2bb29[_0xdfb3('0x42')]=_[_0xdfb3('0x57')](_0xa2bb29[_0xdfb3('0x42')],{'$or':_[_0xdfb3('0x34')](_0xa2bb29[_0xdfb3('0x4b')],function(_0xd8c1f6){var _0x1d38fe={};_0x1d38fe[_0xd8c1f6]={'$like':'%'+_0x31db6c[_0xdfb3('0x46')][_0xdfb3('0x32')]+'%'};return _0x1d38fe;})});}_0xa2bb29=_[_0xdfb3('0x57')]({},_0xa2bb29,_0x31db6c[_0xdfb3('0xd7')]);return _0x51f606[_0xdfb3('0xeb')](_0xa2bb29);}})[_0xdfb3('0x1e')](function(_0x2f873f){if(_0x2f873f){_0x343cfc=_0x2f873f[_0xdfb3('0x50')];if(!_0x31db6c['query'][_0xdfb3('0xcc')](_0xdfb3('0xd9'))){_0xa2bb29[_0xdfb3('0x19')]=qs[_0xdfb3('0x19')](_0x31db6c[_0xdfb3('0x46')][_0xdfb3('0x19')]);_0xa2bb29[_0xdfb3('0x1a')]=qs[_0xdfb3('0x1a')](_0x31db6c[_0xdfb3('0x46')][_0xdfb3('0x1a')]);}return _0x51f606[_0xdfb3('0xeb')](_0xa2bb29);}})[_0xdfb3('0x1e')](function(_0x4e0d18){if(_0x4e0d18){return _0x4e0d18?{'count':_0x343cfc,'rows':_0x4e0d18}:null;}})[_0xdfb3('0x1e')](respondWithResult(_0x13d9e8,null))['catch'](handleError(_0x13d9e8,null));};exports['login']=function(_0x50b5bf,_0x2f9b91,_0x18b770){var _0x43a7e0;var _0x5e3d2b;var _0x19a12c;var _0x395723=!_[_0xdfb3('0x65')](_0x50b5bf[_0xdfb3('0x56')]['id'])?_0x50b5bf[_0xdfb3('0x56')]['id']:!_[_0xdfb3('0x65')](_0x50b5bf[_0xdfb3('0x2f')]['id'])?_0x50b5bf[_0xdfb3('0x2f')]['id']:null;return db[_0xdfb3('0x43')]['find']({'where':{'id':_0x395723,'role':{'$or':['admin','user',_0xdfb3('0x2b')]}},'attributes':['id',_0xdfb3('0x36'),_0xdfb3('0xec'),_0xdfb3('0xed'),'role',_0xdfb3('0x64'),'loginInPause']})['then'](function(_0x76a1d8){if(_0x76a1d8){if(_0x76a1d8[_0xdfb3('0x2a')]===_0xdfb3('0x2b')){_0x43a7e0=_0x76a1d8;if(_0x50b5bf[_0xdfb3('0x5b')][_0xdfb3('0xa2')]){_0x19a12c=util[_0xdfb3('0xca')](_0xdfb3('0xee'),_0x43a7e0[_0x50b5bf[_0xdfb3('0x5b')][_0xdfb3('0xa2')]]);}else if(_0x50b5bf[_0xdfb3('0x5b')][_0xdfb3('0xef')]){_0x19a12c=util[_0xdfb3('0xca')](_0xdfb3('0xaf'),_0x50b5bf[_0xdfb3('0x5b')][_0xdfb3('0xef')]);}else{_0x19a12c=util[_0xdfb3('0xca')](_0xdfb3('0xaf'),_0x43a7e0[_0xdfb3('0x36')]);}socket['to'](util['format'](_0xdfb3('0xf0'),_0x43a7e0[_0xdfb3('0x36')]))[_0xdfb3('0xab')]('user:forcelogout',{'user':{'id':_0x43a7e0['id'],'name':_0x43a7e0['name']},'ip':_0x50b5bf[_0xdfb3('0xf1')][_0xdfb3('0xf2')]||_0x50b5bf[_0xdfb3('0xf3')][_0xdfb3('0xf4')]||_0x50b5bf[_0xdfb3('0xf5')][_0xdfb3('0xf4')]||_0x50b5bf[_0xdfb3('0xf3')][_0xdfb3('0xf5')]['remoteAddress']});return db['UserVoiceQueueRt'][_0xdfb3('0x37')]({'where':{'membername':_0x43a7e0[_0xdfb3('0x36')]},'individualHooks':!![]});}}else{throw new db[(_0xdfb3('0x91'))]['ValidationError']('User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method');}})[_0xdfb3('0x1e')](function(){if(_0x43a7e0){return _0x43a7e0['getVoiceQueues']({'raw':!![]});}})[_0xdfb3('0x1e')](function(_0x4e13d9){if(_0x43a7e0){if(_0x4e13d9){_0x5e3d2b=_0x4e13d9;if(_0x5e3d2b['length']){var _0x923ac7=_0x5e3d2b[_0xdfb3('0x34')](function(_0x3f2dee){var _0x4c2b0f={'membername':_0x43a7e0[_0xdfb3('0x36')],'UserId':_0x43a7e0['id'],'queue_name':_0x3f2dee[_0xdfb3('0x36')],'VoiceQueueId':_0x3f2dee['id'],'interface':_0x19a12c,'paused':_0x43a7e0[_0xdfb3('0xa0')]||![],'penalty':_0x3f2dee[_0xdfb3('0xf6')]||0x0};return db[_0xdfb3('0xb0')][_0xdfb3('0xb1')](_0x4c2b0f);});return Promise[_0xdfb3('0x8a')](_0x923ac7);}}}})[_0xdfb3('0x1e')](function(){if(_0x43a7e0){return db[_0xdfb3('0xf7')][_0xdfb3('0x4d')]({'where':{'membername':_0x43a7e0[_0xdfb3('0x36')],'exitAt':null}});}})[_0xdfb3('0x1e')](function(_0x495257){if(_0x43a7e0){var _0x19ff46=[];_0x495257[_0xdfb3('0xf8')](function(_0x303d81){_0x19ff46[_0xdfb3('0x4c')](_0x303d81[_0xdfb3('0x29')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise[_0xdfb3('0x8a')](_0x19ff46);}})[_0xdfb3('0x1e')](function(){if(_0x43a7e0){var _0x5549da=[];var _0x2013ac=[];var _0x2f1f5b=utils[_0xdfb3('0xf9')]();var _0x550a11={'membername':_0x43a7e0[_0xdfb3('0x36')],'interface':_0x19a12c,'enterAt':moment()[_0xdfb3('0xca')](_0xdfb3('0xfa')),'role':_0x43a7e0[_0xdfb3('0x2a')],'internal':_0x43a7e0[_0xdfb3('0x64')]};_0x2f1f5b[_0xdfb3('0xf8')](function(_0x3c00d4){_0x5549da[_0xdfb3('0x4c')](_[_0xdfb3('0x57')]({'channel':_0x3c00d4,'type':'LOGIN','data1':_0x50b5bf['body'][_0xdfb3('0xfb')],'data2':_0x19a12c},_0x550a11));if(_0x43a7e0[_0xdfb3('0xa0')]){_0x2013ac['push'](_[_0xdfb3('0x57')]({'channel':_0x3c00d4,'type':_0xdfb3('0xfc'),'data1':_0xdfb3('0xfd')},_0x550a11));}});return db[_0xdfb3('0xf7')][_0xdfb3('0x86')](_0x5549da[_0xdfb3('0xc8')](_0x2013ac),{'individualHooks':!![]});}})[_0xdfb3('0x1e')](function(){if(_0x43a7e0){return _0x43a7e0[_0xdfb3('0x29')]({'online':!![],'lastLoginAt':moment()['format'](_0xdfb3('0xfa')),'voicePause':_0x43a7e0['loginInPause']||![],'mailPause':_0x43a7e0[_0xdfb3('0xa0')]||![],'chatPause':_0x43a7e0[_0xdfb3('0xa0')]||![],'faxPause':_0x43a7e0[_0xdfb3('0xa0')]||![],'smsPause':_0x43a7e0[_0xdfb3('0xa0')]||![],'openchannelPause':_0x43a7e0[_0xdfb3('0xa0')]||![],'whatsappPause':_0x43a7e0[_0xdfb3('0xa0')]||![],'pauseType':_0x43a7e0[_0xdfb3('0xa0')]?'LOGININPAUSE':null,'interface':_0x19a12c,'lastPauseAt':moment()[_0xdfb3('0xca')]('YYYY-MM-DD\x20HH:mm:ss')});}})[_0xdfb3('0x1e')](function(_0x1de18f){if(_0x50b5bf[_0xdfb3('0xfe')]){return _0x18b770();}else{return Promise['resolve'](_0x1de18f)['then'](respondWithResult(_0x2f9b91,null));}})[_0xdfb3('0x28')](handleError(_0x2f9b91,null));};exports[_0xdfb3('0xff')]=function(_0x36519e,_0x2a10e8){var _0x4de8bf;return db['User'][_0xdfb3('0x58')]({'where':{'id':_0x36519e[_0xdfb3('0x56')]['id'],'role':'agent'},'attributes':['id',_0xdfb3('0x36'),'role']})[_0xdfb3('0x1e')](handleEntityNotFound(_0x2a10e8,null))['then'](function(_0x468986){if(_0x468986){_0x4de8bf=_0x468986;return db[_0xdfb3('0xb0')][_0xdfb3('0x37')]({'where':{'membername':_0x4de8bf[_0xdfb3('0x36')]},'individualHooks':!![]});}})[_0xdfb3('0x1e')](function(){return db[_0xdfb3('0xf7')][_0xdfb3('0x4d')]({'where':{'membername':_0x4de8bf['name'],'exitAt':null}});})[_0xdfb3('0x1e')](function(_0x350964){var _0xb6bc9=[];_0x350964[_0xdfb3('0xf8')](function(_0x3a47db){_0xb6bc9[_0xdfb3('0x4c')](_0x3a47db[_0xdfb3('0x29')]({'exitAt':moment()[_0xdfb3('0xca')]('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise[_0xdfb3('0x8a')](_0xb6bc9);})['then'](function(){return _0x4de8bf[_0xdfb3('0x29')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})['then'](respondWithResult(_0x2a10e8,null))[_0xdfb3('0x28')](handleError(_0x2a10e8,null));};exports[_0xdfb3('0x100')]=function(_0x582eac,_0x3f4c49){var _0x464887;return db[_0xdfb3('0xb0')][_0xdfb3('0x29')]({'paused':0x1},{'where':{'UserId':_0x582eac[_0xdfb3('0x56')]['id']},'individualHooks':!![]})[_0xdfb3('0x1e')](function(){return db[_0xdfb3('0x43')][_0xdfb3('0x58')]({'where':{'id':_0x582eac[_0xdfb3('0x56')]['id'],'role':_0xdfb3('0x2b')},'attributes':['id','name',_0xdfb3('0x2a'),_0xdfb3('0x64'),'interface',_0xdfb3('0x9f')]});})['then'](handleEntityNotFound(_0x3f4c49,null))['then'](function(_0x518ab7){if(_0x518ab7){_0x464887=_0x518ab7;return respondWithRpcPromise(_0xdfb3('0x101'),_0xdfb3('0x100'),{'id':_0x464887['id'],'name':_0x464887['name'],'pause':!![]});}})[_0xdfb3('0x1e')](function(){if(_0x464887){return db[_0xdfb3('0xf7')][_0xdfb3('0x4d')]({'where':{'membername':_0x464887[_0xdfb3('0x36')],'type':_0xdfb3('0xfc'),'exitAt':null}});}})[_0xdfb3('0x1e')](function(_0x1d1932){if(_0x1d1932[_0xdfb3('0x50')]){var _0x5ae103=moment()['format'](_0xdfb3('0xfa'));for(var _0x4cc965=0x0,_0x2f4cab=_0x1d1932[_0xdfb3('0x50')];_0x4cc965<_0x2f4cab;_0x4cc965++){_0x1d1932[_0x4cc965][_0xdfb3('0x102')]({'exitAt':_0x5ae103});}}})[_0xdfb3('0x1e')](function(){var _0xbe39da=[];var _0x4adac2=utils[_0xdfb3('0xf9')]();_0x4adac2['forEach'](function(_0x573264){_0xbe39da[_0xdfb3('0x4c')]({'channel':_0x573264,'membername':_0x464887[_0xdfb3('0x36')],'interface':_[_0xdfb3('0x65')](_0x464887[_0xdfb3('0xa2')])?util[_0xdfb3('0xca')](_0xdfb3('0xaf'),_0x464887[_0xdfb3('0x36')]):_0x464887[_0xdfb3('0xa2')],'type':_0xdfb3('0xfc'),'enterAt':moment()[_0xdfb3('0xca')](_0xdfb3('0xfa')),'data1':_0x582eac[_0xdfb3('0x5b')]['type']||_0xdfb3('0x103'),'role':_0x464887[_0xdfb3('0x2a')],'internal':_0x464887['internal']});});return db[_0xdfb3('0xf7')][_0xdfb3('0x86')](_0xbe39da,{'individualHooks':!![]});})['then'](function(){return _0x464887[_0xdfb3('0x29')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x582eac['body'][_0xdfb3('0x104')]||_0xdfb3('0x103'),'lastPauseAt':moment()['format'](_0xdfb3('0xfa'))});})[_0xdfb3('0x1e')](respondWithResult(_0x3f4c49,null))[_0xdfb3('0x28')](handleError(_0x3f4c49,null));};exports['unpause']=function(_0x34cf68,_0x35443a){if(_0x34cf68[_0xdfb3('0x5b')][_0xdfb3('0xb3')]&&!utils[_0xdfb3('0xa3')](_0x34cf68[_0xdfb3('0x5b')][_0xdfb3('0xb3')])){throw new APIBadRequestError(util[_0xdfb3('0xca')](_0xdfb3('0x105'),_0x34cf68['body'][_0xdfb3('0xb3')]));}return db[_0xdfb3('0x43')][_0xdfb3('0x58')]({'where':{'id':_0x34cf68['params']['id']},'attributes':['id','name','role','internal',_0xdfb3('0xa2'),'online','voicePause',_0xdfb3('0x106'),_0xdfb3('0x107'),'faxPause',_0xdfb3('0x108'),_0xdfb3('0x109'),_0xdfb3('0x10a'),_0xdfb3('0x10b'),_0xdfb3('0x10c')]})[_0xdfb3('0x1e')](function(_0x5bb598){if(!_0x5bb598){throw new APINotFoundError(util[_0xdfb3('0xca')]('User\x20with\x20id\x20%s\x20not\x20found',_0x34cf68[_0xdfb3('0x56')]['id']));}return _0x5bb598[_0xdfb3('0x10d')](_0x34cf68[_0xdfb3('0x5b')][_0xdfb3('0xb3')]);})[_0xdfb3('0x1e')](respondWithResult(_0x35443a,null))[_0xdfb3('0x28')](APIHandleError(_0x35443a));};exports['getTeams']=function(_0x166309,_0x2db897){var _0x4f950e={};var _0x13b2a1={};var _0x47d974;var _0x23d778;return db[_0xdfb3('0x43')][_0xdfb3('0x99')]({'where':{'id':_0x166309[_0xdfb3('0x56')]['id']}})[_0xdfb3('0x1e')](handleEntityNotFound(_0x2db897,null))[_0xdfb3('0x1e')](function(_0xdcfb45){if(_0xdcfb45){_0x47d974=_0xdcfb45;_0x13b2a1[_0xdfb3('0xd0')]=_[_0xdfb3('0xd1')](db['Team'][_0xdfb3('0xdc')]);_0x13b2a1['query']=_['keys'](_0x166309[_0xdfb3('0x46')]);_0x13b2a1[_0xdfb3('0xd2')]=_[_0xdfb3('0xd3')](_0x13b2a1[_0xdfb3('0xd0')],_0x13b2a1[_0xdfb3('0x46')]);_0x4f950e[_0xdfb3('0x4b')]=_[_0xdfb3('0xd3')](_0x13b2a1[_0xdfb3('0xd0')],qs[_0xdfb3('0xd4')](_0x166309['query'][_0xdfb3('0xd4')]));_0x4f950e[_0xdfb3('0x4b')]=_0x4f950e[_0xdfb3('0x4b')][_0xdfb3('0x50')]?_0x4f950e[_0xdfb3('0x4b')]:_0x13b2a1['model'];_0x4f950e['order']=qs['sort'](_0x166309[_0xdfb3('0x46')]['sort']);_0x4f950e[_0xdfb3('0x42')]=qs[_0xdfb3('0xd2')](_[_0xdfb3('0xd6')](_0x166309[_0xdfb3('0x46')],_0x13b2a1['filters']));if(_0x166309[_0xdfb3('0x46')][_0xdfb3('0x32')]){_0x4f950e['where']=_['merge'](_0x4f950e[_0xdfb3('0x42')],{'$or':_['map'](_0x4f950e['attributes'],function(_0x55d1c9){var _0x3bffd3={};_0x3bffd3[_0x55d1c9]={'$like':'%'+_0x166309[_0xdfb3('0x46')][_0xdfb3('0x32')]+'%'};return _0x3bffd3;})});}_0x4f950e=_[_0xdfb3('0x57')]({},_0x4f950e,_0x166309[_0xdfb3('0xd7')]);return _0x47d974[_0xdfb3('0x10e')](_0x4f950e);}})['then'](function(_0x5b5967){if(_0x5b5967){_0x23d778=_0x5b5967['length'];if(!_0x166309[_0xdfb3('0x46')][_0xdfb3('0xcc')](_0xdfb3('0xd9'))){_0x4f950e[_0xdfb3('0x19')]=qs[_0xdfb3('0x19')](_0x166309['query']['limit']);_0x4f950e[_0xdfb3('0x1a')]=qs[_0xdfb3('0x1a')](_0x166309[_0xdfb3('0x46')][_0xdfb3('0x1a')]);}return _0x47d974[_0xdfb3('0x10e')](_0x4f950e);}})[_0xdfb3('0x1e')](function(_0x1501d4){if(_0x1501d4){return _0x1501d4?{'count':_0x23d778,'rows':_0x1501d4}:null;}})[_0xdfb3('0x1e')](respondWithResult(_0x2db897,null))[_0xdfb3('0x28')](handleError(_0x2db897,null));};exports[_0xdfb3('0x10f')]=function(_0x111b8a,_0x42e70a){var _0x3c1a5b=_0x111b8a[_0xdfb3('0x56')]['id'];var _0x53f544=_0x111b8a['body']?_0x111b8a[_0xdfb3('0x5b')][_0xdfb3('0x5e')]:null;var _0x1d5877=[];return Promise[_0xdfb3('0x110')]()[_0xdfb3('0x1e')](function(){if(!_0x53f544)throw new APIBadRequestError(_0xdfb3('0x111'));})[_0xdfb3('0x1e')](function(){return db[_0xdfb3('0x43')][_0xdfb3('0x99')]({'where':{'id':_0x3c1a5b}});})['then'](function(_0x567cdb){if(!_0x567cdb)throw new APINotFoundError(util[_0xdfb3('0xca')](_0xdfb3('0xcb'),_0x111b8a[_0xdfb3('0x56')]['id']));return db[_0xdfb3('0x67')]['transaction'](function(_0x5b0670){return _0x567cdb[_0xdfb3('0x10f')](_0x53f544,{'transaction':_0x5b0670})[_0xdfb3('0x1e')](function(){return db[_0xdfb3('0x112')][_0xdfb3('0x4d')]({'where':{'id':{'$in':_0x53f544}}});})[_0xdfb3('0x1e')](function(_0x234fde){var _0x4df28d=_[_0xdfb3('0x34')](_0x234fde,function(_0x376986){return _0x376986[_0xdfb3('0x113')]();});return Promise[_0xdfb3('0x8a')](_0x4df28d);})['then'](function(_0x41abbd){_0x1d5877=_[_0xdfb3('0x114')](_0x41abbd);var _0x2b51cc=_[_0xdfb3('0x34')](_0x1d5877,function(_0x59cded){return _0x59cded[_0xdfb3('0x115')](_0x567cdb['id'],{'transaction':_0x5b0670});});return Promise[_0xdfb3('0x8a')](_0x2b51cc);})[_0xdfb3('0x1e')](function(){if(!_0x567cdb[_0xdfb3('0x9f')])return;var _0x3fb1b2=_[_0xdfb3('0x32')](_0x1d5877,function(_0x2c2d21){return _0x2c2d21[_0xdfb3('0x116')]('channel')===_0xdfb3('0x117');});var _0x3821ff=_[_0xdfb3('0x34')](_0x3fb1b2,function(_0x2dcb18){return db['UserVoiceQueueRt'][_0xdfb3('0xb1')]({'membername':_0x567cdb[_0xdfb3('0x36')],'UserId':_0x567cdb['id'],'queue_name':_0x2dcb18[_0xdfb3('0x36')],'VoiceQueueId':_0x2dcb18['id'],'interface':_['isNil'](_0x567cdb[_0xdfb3('0xa2')])?util['format'](_0xdfb3('0xaf'),_0x567cdb[_0xdfb3('0x36')]):_0x567cdb[_0xdfb3('0xa2')],'paused':_0x567cdb[_0xdfb3('0xa1')]||![],'penalty':_0x567cdb[_0xdfb3('0xa8')]},{'transaction':_0x5b0670});});return Promise['all'](_0x3821ff);})[_0xdfb3('0x1e')](function(){return db[_0xdfb3('0x118')][_0xdfb3('0x4d')]({'where':{'teamId':{'$in':_0x53f544}}});})['then'](function(_0x42c111){var _0x2f1b35=_[_0xdfb3('0x34')](_0x42c111,function(_0x19b7f1){return db[_0xdfb3('0x119')][_0xdfb3('0x7e')]({'UserId':_0x567cdb['id'],'VoicePrefixId':_0x19b7f1['VoicePrefixId']},{'transaction':_0x5b0670});});return Promise[_0xdfb3('0x8a')](_0x2f1b35);});});})['then'](function(){for(var _0x423aff=0x0;_0x423aff<_0x1d5877[_0xdfb3('0x50')];_0x423aff++){var _0x5b342a=_0x1d5877[_0x423aff][_0xdfb3('0x116')]('channel');var _0x39c365=_0x5b342a+_0xdfb3('0xaa');socket['emit'](_0xdfb3('0x2f')+_0x5b342a+_0xdfb3('0x11a'),{'UserId':_0x3c1a5b,['queueField']:_0x1d5877[_0x423aff]['id']});}})[_0xdfb3('0x1e')](respondWithStatusCode(_0x42e70a,null))[_0xdfb3('0x28')](APIHandleError(_0x42e70a));};exports[_0xdfb3('0x11b')]=function(_0x1f51b2,_0x56fcbe){var _0x20f79f=_0x1f51b2['params']['id'];var _0x1e48ff=null;if(_0x1f51b2[_0xdfb3('0x46')][_0xdfb3('0x5e')]){_0x1e48ff=_[_0xdfb3('0xb5')](_0x1f51b2[_0xdfb3('0x46')][_0xdfb3('0x5e')])?_0x1f51b2['query']['ids']:[_0x1f51b2[_0xdfb3('0x46')][_0xdfb3('0x5e')]];}var _0x30fc12=[];return Promise[_0xdfb3('0x110')]()[_0xdfb3('0x1e')](function(){if(!_0x1e48ff)throw new APIBadRequestError('Query\x20parameter\x20\x27ids\x27\x20is\x20required');})[_0xdfb3('0x1e')](function(){return db[_0xdfb3('0x43')][_0xdfb3('0x99')]({'where':{'id':_0x20f79f}});})[_0xdfb3('0x1e')](function(_0x3080ea){if(!_0x3080ea)throw new APINotFoundError(util[_0xdfb3('0xca')](_0xdfb3('0xcb'),_0x1f51b2[_0xdfb3('0x56')]['id']));return db['sequelize'][_0xdfb3('0x11c')](function(_0x5aaca9){return _0x3080ea[_0xdfb3('0x11b')](_0x1e48ff,{'transaction':_0x5aaca9})[_0xdfb3('0x1e')](function(){return db[_0xdfb3('0x112')][_0xdfb3('0x4d')]({'where':{'id':{'$in':_0x1e48ff}}});})[_0xdfb3('0x1e')](function(_0x49ab22){var _0x537c99=_[_0xdfb3('0x34')](_0x49ab22,function(_0x3470a9){return _0x3470a9['getAssociatedQueues']();});return Promise[_0xdfb3('0x8a')](_0x537c99);})[_0xdfb3('0x1e')](function(_0x57fd24){_0x30fc12=_['flattenDeep'](_0x57fd24);var _0x466c4d=_[_0xdfb3('0x34')](_0x30fc12,function(_0x320f7c){return _0x320f7c[_0xdfb3('0x11d')](_0x3080ea['id'],{'transaction':_0x5aaca9});});return Promise['all'](_0x466c4d);})['then'](function(){if(!_0x3080ea[_0xdfb3('0x9f')])return;var _0x45c4b3=_[_0xdfb3('0x32')](_0x30fc12,function(_0x4a280c){return _0x4a280c[_0xdfb3('0x116')](_0xdfb3('0xb3'))==='Voice';});var _0x1d369e=_[_0xdfb3('0x34')](_0x45c4b3,function(_0x43d81e){return db['UserVoiceQueueRt'][_0xdfb3('0x37')]({'where':{'VoiceQueueId':_0x43d81e['id'],'UserId':_0x3080ea['id']},'transaction':_0x5aaca9});});return Promise['all'](_0x1d369e);})['then'](function(){return db['TeamVoicePrefix'][_0xdfb3('0x4d')]({'where':{'teamId':{'$in':_0x1e48ff}}});})[_0xdfb3('0x1e')](function(_0x3739b3){var _0x48c73=_[_0xdfb3('0x34')](_0x3739b3,function(_0x3fd4a6){return db[_0xdfb3('0x119')][_0xdfb3('0x37')]({'where':{'UserId':_0x3080ea['id'],'VoicePrefixId':_0x3fd4a6[_0xdfb3('0x11e')]}},{'transaction':_0x5aaca9});});return Promise[_0xdfb3('0x8a')](_0x48c73);});});})['then'](function(){for(var _0x8afe4b=0x0;_0x8afe4b<_0x30fc12[_0xdfb3('0x50')];_0x8afe4b++){var _0xb089df=_0x30fc12[_0x8afe4b]['getDataValue'](_0xdfb3('0xb3'));var _0x5e55c8=_0xb089df+_0xdfb3('0xaa');socket[_0xdfb3('0xab')]('user'+_0xb089df+'Queue:remove',{'UserId':_0x20f79f,['queueField']:_0x30fc12[_0x8afe4b]['id']});}})[_0xdfb3('0x1e')](respondWithStatusCode(_0x56fcbe,null))[_0xdfb3('0x28')](APIHandleError(_0x56fcbe));};exports[_0xdfb3('0x11f')]=function(_0x31cef6,_0x5ce3da){var _0x27c9c8={};var _0xab47f0={};var _0x2141c5;var _0x5a2931;return db[_0xdfb3('0x43')][_0xdfb3('0x99')]({'where':{'id':_0x31cef6['params']['id']}})[_0xdfb3('0x1e')](handleEntityNotFound(_0x5ce3da,null))[_0xdfb3('0x1e')](function(_0x59e7f1){if(_0x59e7f1){_0x2141c5=_0x59e7f1;_0xab47f0[_0xdfb3('0xd0')]=_[_0xdfb3('0xd1')](db[_0xdfb3('0xcd')]['rawAttributes']);_0xab47f0[_0xdfb3('0x46')]=_['keys'](_0x31cef6[_0xdfb3('0x46')]);_0xab47f0[_0xdfb3('0xd2')]=_[_0xdfb3('0xd3')](_0xab47f0[_0xdfb3('0xd0')],_0xab47f0[_0xdfb3('0x46')]);_0x27c9c8[_0xdfb3('0x4b')]=_[_0xdfb3('0xd3')](_0xab47f0[_0xdfb3('0xd0')],qs[_0xdfb3('0xd4')](_0x31cef6[_0xdfb3('0x46')][_0xdfb3('0xd4')]));_0x27c9c8[_0xdfb3('0x4b')]=_0x27c9c8['attributes'][_0xdfb3('0x50')]?_0x27c9c8[_0xdfb3('0x4b')]:_0xab47f0[_0xdfb3('0xd0')];_0x27c9c8[_0xdfb3('0xdd')]=qs[_0xdfb3('0xd5')](_0x31cef6['query'][_0xdfb3('0xd5')]);_0x27c9c8['where']=qs[_0xdfb3('0xd2')](_[_0xdfb3('0xd6')](_0x31cef6[_0xdfb3('0x46')],_0xab47f0[_0xdfb3('0xd2')]));if(_0x31cef6['query'][_0xdfb3('0x32')]){_0x27c9c8[_0xdfb3('0x42')]=_[_0xdfb3('0x57')](_0x27c9c8[_0xdfb3('0x42')],{'$or':_[_0xdfb3('0x34')](_0x27c9c8[_0xdfb3('0x4b')],function(_0x1ff495){var _0x1bf43e={};_0x1bf43e[_0x1ff495]={'$like':'%'+_0x31cef6[_0xdfb3('0x46')][_0xdfb3('0x32')]+'%'};return _0x1bf43e;})});}_0x27c9c8=_[_0xdfb3('0x57')]({},_0x27c9c8,_0x31cef6[_0xdfb3('0xd7')]);return _0x2141c5[_0xdfb3('0x11f')](_0x27c9c8);}})['then'](function(_0x23e036){if(_0x23e036){_0x5a2931=_0x23e036[_0xdfb3('0x50')];if(!_0x31cef6[_0xdfb3('0x46')]['hasOwnProperty'](_0xdfb3('0xd9'))){_0x27c9c8['limit']=qs[_0xdfb3('0x19')](_0x31cef6['query']['limit']);_0x27c9c8[_0xdfb3('0x1a')]=qs['offset'](_0x31cef6[_0xdfb3('0x46')]['offset']);}return _0x2141c5[_0xdfb3('0x11f')](_0x27c9c8);}})[_0xdfb3('0x1e')](function(_0x3a02c3){if(_0x3a02c3){return _0x3a02c3?{'count':_0x5a2931,'rows':_0x3a02c3}:null;}})['then'](respondWithResult(_0x5ce3da,null))[_0xdfb3('0x28')](handleError(_0x5ce3da,null));};exports[_0xdfb3('0x120')]=function(_0x4d9a84,_0x8d9061){var _0x4aa167={};var _0x595176={};var _0x431df7;return db[_0xdfb3('0x43')]['findOne']({'where':{'id':_0x4d9a84[_0xdfb3('0x56')]['id']}})[_0xdfb3('0x1e')](handleEntityNotFound(_0x8d9061,null))[_0xdfb3('0x1e')](function(_0x47716a){if(_0x47716a){_0x431df7=_0x47716a;_0x595176[_0xdfb3('0xd0')]=_[_0xdfb3('0xd1')](db['User'][_0xdfb3('0xdc')]);_0x595176[_0xdfb3('0x46')]=_['keys'](_0x4d9a84[_0xdfb3('0x46')]);_0x595176[_0xdfb3('0xd2')]=_['intersection'](_0x595176[_0xdfb3('0xd0')],_0x595176[_0xdfb3('0x46')]);_0x4aa167['attributes']=_['intersection'](_0x595176[_0xdfb3('0xd0')],qs['fields'](_0x4d9a84[_0xdfb3('0x46')][_0xdfb3('0xd4')]));_0x4aa167[_0xdfb3('0x4b')]=_0x4aa167[_0xdfb3('0x4b')][_0xdfb3('0x50')]?_0x4aa167[_0xdfb3('0x4b')]:_0x595176[_0xdfb3('0xd0')];_0x4aa167[_0xdfb3('0xdd')]=qs[_0xdfb3('0xd5')](_0x4d9a84['query'][_0xdfb3('0xd5')]);_0x4aa167[_0xdfb3('0x42')]=qs[_0xdfb3('0xd2')](_[_0xdfb3('0xd6')](_0x4d9a84['query'],_0x595176['filters']));if(_0x4d9a84[_0xdfb3('0x46')][_0xdfb3('0x32')]){_0x4aa167['where']=_[_0xdfb3('0x57')](_0x4aa167[_0xdfb3('0x42')],{'$or':_['map'](_0x4aa167[_0xdfb3('0x4b')],function(_0x5256ac){var _0x1dc64f={};_0x1dc64f[_0x5256ac]={'$like':'%'+_0x4d9a84[_0xdfb3('0x46')]['filter']+'%'};return _0x1dc64f;})});}_0x4aa167['model']=db[_0xdfb3('0x43')];_0x4aa167['as']=_0xdfb3('0x30');_0x4aa167=_[_0xdfb3('0x57')]({},_0x4aa167,_0x4d9a84[_0xdfb3('0xd7')]);return _0x431df7[_0xdfb3('0x121')]({'include':[_0x4aa167]});}})[_0xdfb3('0x1e')](function(_0x3917ca){if(_0x3917ca){var _0x523b5f={},_0x17c61b=[];for(var _0x23c3d2=0x0;_0x23c3d2<_0x3917ca[_0xdfb3('0x50')];_0x23c3d2+=0x1){for(var _0x3a3834=0x0,_0x33c409;_0x3a3834<_0x3917ca[_0x23c3d2][_0xdfb3('0x30')]['length'];_0x3a3834+=0x1){_0x33c409=_0x3917ca[_0x23c3d2][_0xdfb3('0x30')][_0x3a3834][_0xdfb3('0x2d')]({'plain':!![]});_0x523b5f[_0x33c409['id']]=_0x33c409;}}_0x523b5f=_[_0xdfb3('0x122')](_0x523b5f);for(var _0x500815=qs[_0xdfb3('0x1a')](_0x4d9a84['query']['offset']);_0x500815<_0x523b5f[_0xdfb3('0x50')]&&_0x17c61b[_0xdfb3('0x50')]=_0x2b81da[_0xf204('0x48')]){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})[_0xf204('0x12')](function(){if(_0x658a16){return db[_0xf204('0x22')][_0xf204('0x40')]({'where':{'membername':_0x658a16['name']},'individualHooks':!![]});}})[_0xf204('0x12')](function(){if(_0x658a16){return _0x658a16['getVoiceQueues']({'raw':!![]});}})[_0xf204('0x12')](function(_0x5df637){if(_0x658a16){if(_0x5df637){var _0x302db7=[];_0x50dbef=_0x5df637;if(_0x50dbef[_0xf204('0x25')]){for(var _0x1c8d65=0x0;_0x1c8d65<_0x50dbef['length'];_0x1c8d65++){_0x302db7[_0xf204('0x29')](db[_0xf204('0x22')][_0xf204('0x49')]({'membername':_0x658a16[_0xf204('0x1c')],'UserId':_0x658a16['id'],'queue_name':_0x50dbef[_0x1c8d65]['name'],'VoiceQueueId':_0x50dbef[_0x1c8d65]['id'],'interface':_0x5b7482,'paused':_0x658a16[_0xf204('0x4a')]||![],'penalty':_0x50dbef[_0x1c8d65][_0xf204('0x4b')]||0x0}));}return BPromise['all'](_0x302db7);}}}})[_0xf204('0x12')](function(){if(_0x658a16){return db['MemberReport'][_0xf204('0x4c')]({'where':{'membername':_0x658a16['name'],'exitAt':null}});}})['then'](function(_0x373627){if(_0x658a16){if(_0x373627&&_0x373627[_0xf204('0x25')]){var _0x337b4a=[];_0x373627['forEach'](function(_0x2ed725){_0x337b4a[_0xf204('0x29')](_0x2ed725[_0xf204('0x23')]({'exitAt':moment()['format'](_0xf204('0x2d'))}));});return BPromise[_0xf204('0x41')](_0x337b4a);}}})[_0xf204('0x12')](function(){if(_0x658a16){var _0xa65262=[];var _0x11469c=[];var _0x4527b3=utils[_0xf204('0x27')]();var _0x402d17={'membername':_0x658a16['name'],'interface':_0x5b7482,'enterAt':moment()[_0xf204('0x1f')](_0xf204('0x2d')),'role':_0x658a16[_0xf204('0x1d')],'internal':_0x658a16['internal']};_0x4527b3[_0xf204('0x28')](function(_0x3840b8){_0xa65262[_0xf204('0x29')](_['merge']({'channel':_0x3840b8,'type':_0xf204('0x4d'),'data1':_0xf204('0x4e'),'data2':_0x5b7482},_0x402d17));if(_0x658a16['loginInPause']){_0x11469c[_0xf204('0x29')](_[_0xf204('0x4f')]({'channel':_0x3840b8,'type':_0xf204('0x2c'),'data1':_0xf204('0x50')},_0x402d17));}});return db[_0xf204('0x24')][_0xf204('0x31')](_0xa65262[_0xf204('0x51')](_0x11469c),{'individualHooks':!![]});}})[_0xf204('0x12')](function(){if(_0x658a16){return _0x658a16[_0xf204('0x23')]({'online':!![],'lastLoginAt':moment()[_0xf204('0x1f')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x658a16[_0xf204('0x4a')]||![],'mailPause':_0x658a16['loginInPause']||![],'chatPause':_0x658a16[_0xf204('0x4a')]||![],'faxPause':_0x658a16['loginInPause']||![],'smsPause':_0x658a16[_0xf204('0x4a')]||![],'openchannelPause':_0x658a16['loginInPause']||![],'pauseType':_0x658a16[_0xf204('0x4a')]?_0xf204('0x50'):null,'lastPauseAt':moment()[_0xf204('0x1f')](_0xf204('0x2d')),'interface':_0x5b7482});}})[_0xf204('0x12')](function(_0x91db3a){_0x2d6a32(_0x91db3a);})['catch'](function(_0x833769){_0x490144(_0x2f1e5a[_0xf204('0x16')](0x1f4,_0x833769[_0xf204('0x17')]));});});}; \ No newline at end of file +var _0x7702=['raw','info','stringify','catch','PauseUser','name','role','interface','User\x20with\x20id\x20%s\x20not\x20found','params','MemberReport','PAUSE','format','YYYY-MM-DD\x20HH:mm:ss','length','updateAttributes','forEach','push','isNil','SIP/%s','type','DEFAULT\x20PAUSE','internal','uniqueid','bulkCreate','update','body','UnpauseUser','channel','Channel\x20parameter\x20%s\x20is\x20invalid','findOne','online','voicePause','mailPause','chatPause','faxPause','pauseType','lastPauseAt','unpause','system','UserVoiceQueueRt','LoginUser','mobile','phone','loginInPause','agent','../../config/license/util','getLicense','agents','destroy','getVoiceQueues','UserVoiceQueue.penalty','all','getChannels','merge','LOGIN','callysquare','LOGININPAUSE','concat','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','redis','defaults','localhost','socket.io-emitter','./user.socket','register','GetUser','User','findAll','options','where','attributes','limit','include','map','model','then','debug','error','message','ShowUser','find'];(function(_0x1d0b74,_0x2b9295){var _0x1c18e7=function(_0x2c06e0){while(--_0x2c06e0){_0x1d0b74['push'](_0x1d0b74['shift']());}};_0x1c18e7(++_0x2b9295);}(_0x7702,0x94));var _0x2770=function(_0x37737c,_0x2ff3e3){_0x37737c=_0x37737c-0x0;var _0x37d24d=_0x7702[_0x37737c];return _0x37d24d;};'use strict';var _=require(_0x2770('0x0'));var util=require(_0x2770('0x1'));var moment=require(_0x2770('0x2'));var BPromise=require(_0x2770('0x3'));var Redis=require(_0x2770('0x4'));var db=require(_0x2770('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2770('0x6'))('rpc');var config=require(_0x2770('0x7'));config[_0x2770('0x8')]=_[_0x2770('0x9')](config[_0x2770('0x8')],{'host':_0x2770('0xa'),'port':0x18eb});var socket=require(_0x2770('0xb'))(new Redis(config[_0x2770('0x8')]));require(_0x2770('0xc'))[_0x2770('0xd')](socket);exports[_0x2770('0xe')]=function(_0x1a17d7){var _0x2d072e=this;return new Promise(function(_0x3f2e1b,_0x306864){return db[_0x2770('0xf')][_0x2770('0x10')]({'raw':_0x1a17d7[_0x2770('0x11')]?_0x1a17d7['options']['raw']===undefined?!![]:![]:!![],'where':_0x1a17d7['options']?_0x1a17d7[_0x2770('0x11')][_0x2770('0x12')]||null:null,'attributes':_0x1a17d7[_0x2770('0x11')]?_0x1a17d7[_0x2770('0x11')][_0x2770('0x13')]||null:null,'limit':_0x1a17d7[_0x2770('0x11')]?_0x1a17d7[_0x2770('0x11')][_0x2770('0x14')]||null:null,'include':_0x1a17d7['options']?_0x1a17d7[_0x2770('0x11')][_0x2770('0x15')]?_[_0x2770('0x16')](_0x1a17d7[_0x2770('0x11')][_0x2770('0x15')],function(_0x511fbb){return{'model':db[_0x511fbb[_0x2770('0x17')]],'as':_0x511fbb['as'],'attributes':_0x511fbb[_0x2770('0x13')],'include':_0x511fbb[_0x2770('0x15')]?_[_0x2770('0x16')](_0x511fbb[_0x2770('0x15')],function(_0x499fc4){return{'model':db[_0x499fc4[_0x2770('0x17')]],'as':_0x499fc4['as'],'attributes':_0x499fc4[_0x2770('0x13')],'include':_0x499fc4[_0x2770('0x15')]?_[_0x2770('0x16')](_0x499fc4[_0x2770('0x15')],function(_0x380164){return{'model':db[_0x380164[_0x2770('0x17')]],'as':_0x380164['as'],'attributes':_0x380164[_0x2770('0x13')]};}):[]};}):[]};}):[]:[]})[_0x2770('0x18')](function(_0x3c5e71){logger['info'](_0x2770('0xe'),_0x1a17d7);logger[_0x2770('0x19')](_0x2770('0xe'),_0x1a17d7,JSON['stringify'](_0x3c5e71));_0x3f2e1b(_0x3c5e71);})['catch'](function(_0x367d34){logger[_0x2770('0x1a')](_0x2770('0xe'),_0x367d34[_0x2770('0x1b')],_0x1a17d7);_0x306864(_0x2d072e[_0x2770('0x1a')](0x1f4,_0x367d34['message']));});});};exports[_0x2770('0x1c')]=function(_0x15fca1){var _0x13b0c6=this;return new Promise(function(_0x45ade9,_0x127e5b){return db[_0x2770('0xf')][_0x2770('0x1d')]({'raw':_0x15fca1[_0x2770('0x11')]?_0x15fca1['options'][_0x2770('0x1e')]===undefined?!![]:![]:!![],'where':_0x15fca1[_0x2770('0x11')]?_0x15fca1[_0x2770('0x11')][_0x2770('0x12')]||null:null,'attributes':_0x15fca1['options']?_0x15fca1['options'][_0x2770('0x13')]||null:null,'include':_0x15fca1[_0x2770('0x11')]?_0x15fca1['options']['include']?_[_0x2770('0x16')](_0x15fca1[_0x2770('0x11')][_0x2770('0x15')],function(_0x2319dd){return{'model':db[_0x2319dd['model']],'as':_0x2319dd['as'],'attributes':_0x2319dd[_0x2770('0x13')],'include':_0x2319dd['include']?_[_0x2770('0x16')](_0x2319dd[_0x2770('0x15')],function(_0x8ed842){return{'model':db[_0x8ed842[_0x2770('0x17')]],'as':_0x8ed842['as'],'attributes':_0x8ed842['attributes'],'include':_0x8ed842['include']?_['map'](_0x8ed842[_0x2770('0x15')],function(_0x486d4c){return{'model':db[_0x486d4c[_0x2770('0x17')]],'as':_0x486d4c['as'],'attributes':_0x486d4c['attributes']};}):[]};}):[]};}):[]:[]})[_0x2770('0x18')](function(_0x1bd72f){logger[_0x2770('0x1f')](_0x2770('0x1c'),_0x15fca1);logger['debug'](_0x2770('0x1c'),_0x15fca1,JSON[_0x2770('0x20')](_0x1bd72f));_0x45ade9(_0x1bd72f);})[_0x2770('0x21')](function(_0x3a805e){logger['error'](_0x2770('0x1c'),_0x3a805e['message'],_0x15fca1);_0x127e5b(_0x13b0c6[_0x2770('0x1a')](0x1f4,_0x3a805e[_0x2770('0x1b')]));});});};exports[_0x2770('0x22')]=function(_0x2a816b){var _0x5b64b4;return db[_0x2770('0xf')][_0x2770('0x1d')]({'where':_0x2a816b[_0x2770('0x11')][_0x2770('0x12')]||{},'attributes':['id',_0x2770('0x23'),_0x2770('0x24'),'internal',_0x2770('0x25')]})['then'](function(_0xb743c){if(!_0xb743c){throw new Error(util['format'](_0x2770('0x26'),_0x2a816b[_0x2770('0x27')]['id']));}_0x5b64b4=_0xb743c;return db['UserVoiceQueueRt']['update']({'paused':0x1},{'where':{'UserId':_0x5b64b4['id']},'individualHooks':!![]});})[_0x2770('0x18')](function(){return db[_0x2770('0x28')][_0x2770('0x10')]({'where':{'membername':_0x5b64b4[_0x2770('0x23')],'type':_0x2770('0x29'),'exitAt':null}});})[_0x2770('0x18')](function(_0x33b5ea){if(_0x33b5ea&&_0x33b5ea['length']){var _0x226cfe=moment()[_0x2770('0x2a')](_0x2770('0x2b'));for(var _0x13c9ec=0x0,_0x57a09a=_0x33b5ea[_0x2770('0x2c')];_0x13c9ec<_0x57a09a;_0x13c9ec++){_0x33b5ea[_0x13c9ec][_0x2770('0x2d')]({'exitAt':_0x226cfe});}}})['then'](function(){var _0x4e2bec=[];var _0x58935a=utils['getChannels']();_0x58935a[_0x2770('0x2e')](function(_0x31acc9){_0x4e2bec[_0x2770('0x2f')]({'channel':_0x31acc9,'membername':_0x5b64b4[_0x2770('0x23')],'interface':_[_0x2770('0x30')](_0x5b64b4[_0x2770('0x25')])?util[_0x2770('0x2a')](_0x2770('0x31'),_0x5b64b4[_0x2770('0x23')]):_0x5b64b4[_0x2770('0x25')],'type':_0x2770('0x29'),'enterAt':moment()['format'](_0x2770('0x2b')),'data1':_0x2a816b['body'][_0x2770('0x32')]||_0x2770('0x33'),'role':_0x5b64b4[_0x2770('0x24')],'internal':_0x5b64b4[_0x2770('0x34')],'uniqueid':_0x2a816b['body'][_0x2770('0x35')]||null});});return db[_0x2770('0x28')][_0x2770('0x36')](_0x4e2bec,{'individualHooks':!![]});})[_0x2770('0x18')](function(){return _0x5b64b4[_0x2770('0x37')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x2a816b[_0x2770('0x38')][_0x2770('0x32')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0x2770('0x2a')](_0x2770('0x2b'))});})[_0x2770('0x21')](function(_0x548e50){throw _0x548e50;});};exports[_0x2770('0x39')]=function(_0x1bade1){return Promise['resolve']()[_0x2770('0x18')](function(){if(_0x1bade1[_0x2770('0x38')][_0x2770('0x3a')]&&!utils['isValidChannel'](_0x1bade1['body'][_0x2770('0x3a')])){throw new Error(util[_0x2770('0x2a')](_0x2770('0x3b'),_0x1bade1['body'][_0x2770('0x3a')]));}return db['User'][_0x2770('0x3c')]({'where':_0x1bade1[_0x2770('0x11')][_0x2770('0x12')]||{},'attributes':['id',_0x2770('0x23'),_0x2770('0x24'),_0x2770('0x34'),_0x2770('0x25'),_0x2770('0x3d'),_0x2770('0x3e'),_0x2770('0x3f'),_0x2770('0x40'),_0x2770('0x41'),'openchannelPause','smsPause','whatsappPause',_0x2770('0x42'),_0x2770('0x43')]});})[_0x2770('0x18')](function(_0x5e0634){if(!_0x5e0634){throw new Error(util[_0x2770('0x2a')](_0x2770('0x26'),_0x1bade1[_0x2770('0x27')]['id']));}return _0x5e0634[_0x2770('0x44')](_0x1bade1[_0x2770('0x38')]['channel'],_0x2770('0x45'));})[_0x2770('0x21')](function(_0x21b830){throw _0x21b830;});};exports['LogoutUser']=function(_0x3daf93){var _0x47db35=this;return new Promise(function(_0x2a2ca7,_0x3a27f0){var _0x2714e9;return db[_0x2770('0xf')][_0x2770('0x3c')]({'where':_0x3daf93[_0x2770('0x11')][_0x2770('0x12')]||{},'attributes':['id','name']})[_0x2770('0x18')](function(_0xf78a89){if(_0xf78a89){_0x2714e9=_0xf78a89;return db[_0x2770('0x46')]['destroy']({'where':{'membername':_0x2714e9[_0x2770('0x23')]},'individualHooks':!![]});}})[_0x2770('0x18')](function(){if(_0x2714e9){return db[_0x2770('0x28')][_0x2770('0x10')]({'where':{'membername':_0x2714e9[_0x2770('0x23')],'exitAt':null}});}})[_0x2770('0x18')](function(_0x59bba4){if(_0x2714e9){if(_0x59bba4&&_0x59bba4[_0x2770('0x2c')]){var _0x1912c8=[];_0x59bba4[_0x2770('0x2e')](function(_0x24078d){_0x1912c8[_0x2770('0x2f')](_0x24078d[_0x2770('0x37')]({'exitAt':moment()[_0x2770('0x2a')](_0x2770('0x2b'))}));});return BPromise['all'](_0x1912c8);}}})[_0x2770('0x18')](function(){if(_0x2714e9){return _0x2714e9[_0x2770('0x37')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x2770('0x18')](function(_0x2bfd7f){_0x2a2ca7(_0x2bfd7f);})['catch'](function(_0x1685d5){_0x3a27f0(_0x47db35[_0x2770('0x1a')](0x1f4,_0x1685d5[_0x2770('0x1b')]));});});};exports[_0x2770('0x47')]=function(_0x5d99dc){var _0x5914de=this;return new Promise(function(_0x4849ba,_0x1b0eea){var _0x2ffe2f;var _0x26a629;var _0x5b0d77;var _0x59fd5d;return db['User'][_0x2770('0x3c')]({'where':_0x5d99dc[_0x2770('0x11')][_0x2770('0x12')]||{},'attributes':['id','name','role',_0x2770('0x48'),_0x2770('0x49'),'internal',_0x2770('0x4a'),'interface']})[_0x2770('0x18')](function(_0x5f1594){if(_0x5f1594){_0x2ffe2f=_0x5f1594;_0x59fd5d=_0x5d99dc[_0x2770('0x38')][_0x2770('0x25')]?_0x5d99dc[_0x2770('0x38')][_0x2770('0x25')]:util['format']('SIP/%s',_0x2ffe2f['name']);return db[_0x2770('0xf')]['count']({'where':{'role':_0x2770('0x4b'),'online':!![],'id':{'$ne':_0x2ffe2f['id']}}});}})[_0x2770('0x18')](function(_0x4c3913){if(_0x4c3913){_0x5b0d77=_0x4c3913;return require(_0x2770('0x4c'))[_0x2770('0x4d')]();}})[_0x2770('0x18')](function(_0x3f1e34){if(_0x3f1e34&&_0x3f1e34[_0x2770('0x4e')]&&_0x5b0d77>=_0x3f1e34['agents']){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})['then'](function(){if(_0x2ffe2f){return db[_0x2770('0x46')][_0x2770('0x4f')]({'where':{'membername':_0x2ffe2f[_0x2770('0x23')]},'individualHooks':!![]});}})['then'](function(){if(_0x2ffe2f){return _0x2ffe2f[_0x2770('0x50')]({'raw':!![]});}})['then'](function(_0x3675d8){if(_0x2ffe2f){if(_0x3675d8){var _0x425949=[];_0x26a629=_0x3675d8;if(_0x26a629[_0x2770('0x2c')]){for(var _0x259d47=0x0;_0x259d47<_0x26a629[_0x2770('0x2c')];_0x259d47++){_0x425949['push'](db[_0x2770('0x46')]['upsert']({'membername':_0x2ffe2f[_0x2770('0x23')],'UserId':_0x2ffe2f['id'],'queue_name':_0x26a629[_0x259d47]['name'],'VoiceQueueId':_0x26a629[_0x259d47]['id'],'interface':_0x59fd5d,'paused':_0x2ffe2f['loginInPause']||![],'penalty':_0x26a629[_0x259d47][_0x2770('0x51')]||0x0}));}return BPromise[_0x2770('0x52')](_0x425949);}}}})[_0x2770('0x18')](function(){if(_0x2ffe2f){return db[_0x2770('0x28')][_0x2770('0x10')]({'where':{'membername':_0x2ffe2f['name'],'exitAt':null}});}})[_0x2770('0x18')](function(_0x2e5aff){if(_0x2ffe2f){if(_0x2e5aff&&_0x2e5aff[_0x2770('0x2c')]){var _0x8bbe93=[];_0x2e5aff[_0x2770('0x2e')](function(_0x319a4e){_0x8bbe93[_0x2770('0x2f')](_0x319a4e['update']({'exitAt':moment()[_0x2770('0x2a')](_0x2770('0x2b'))}));});return BPromise[_0x2770('0x52')](_0x8bbe93);}}})[_0x2770('0x18')](function(){if(_0x2ffe2f){var _0x3e1fc6=[];var _0x4be44d=[];var _0x594427=utils[_0x2770('0x53')]();var _0xf5524a={'membername':_0x2ffe2f['name'],'interface':_0x59fd5d,'enterAt':moment()[_0x2770('0x2a')](_0x2770('0x2b')),'role':_0x2ffe2f[_0x2770('0x24')],'internal':_0x2ffe2f['internal']};_0x594427[_0x2770('0x2e')](function(_0x27b88b){_0x3e1fc6[_0x2770('0x2f')](_[_0x2770('0x54')]({'channel':_0x27b88b,'type':_0x2770('0x55'),'data1':_0x2770('0x56'),'data2':_0x59fd5d},_0xf5524a));if(_0x2ffe2f[_0x2770('0x4a')]){_0x4be44d[_0x2770('0x2f')](_[_0x2770('0x54')]({'channel':_0x27b88b,'type':_0x2770('0x29'),'data1':_0x2770('0x57')},_0xf5524a));}});return db[_0x2770('0x28')][_0x2770('0x36')](_0x3e1fc6[_0x2770('0x58')](_0x4be44d),{'individualHooks':!![]});}})['then'](function(){if(_0x2ffe2f){return _0x2ffe2f['update']({'online':!![],'lastLoginAt':moment()[_0x2770('0x2a')](_0x2770('0x2b')),'voicePause':_0x2ffe2f[_0x2770('0x4a')]||![],'mailPause':_0x2ffe2f['loginInPause']||![],'chatPause':_0x2ffe2f[_0x2770('0x4a')]||![],'faxPause':_0x2ffe2f[_0x2770('0x4a')]||![],'smsPause':_0x2ffe2f[_0x2770('0x4a')]||![],'openchannelPause':_0x2ffe2f[_0x2770('0x4a')]||![],'pauseType':_0x2ffe2f[_0x2770('0x4a')]?_0x2770('0x57'):null,'lastPauseAt':moment()[_0x2770('0x2a')]('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x59fd5d});}})['then'](function(_0xa636e6){_0x4849ba(_0xa636e6);})['catch'](function(_0x1af81e){_0x1b0eea(_0x5914de[_0x2770('0x1a')](0x1f4,_0x1af81e['message']));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index a5f7aa0..20ba65f 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 _0x4ba9=['length','user:','./user.events','update','emit','removeListener','register'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x4ba9,0x1bb));var _0x94ba=function(_0x336376,_0xe4b28d){_0x336376=_0x336376-0x0;var _0x1d2a8e=_0x4ba9[_0x336376];return _0x1d2a8e;};'use strict';var UserEvents=require(_0x94ba('0x0'));var events=['save','remove',_0x94ba('0x1')];function createListener(_0x57fcd9,_0x2cd604){return function(_0xaa4a61){_0x2cd604[_0x94ba('0x2')](_0x57fcd9,_0xaa4a61);};}function removeListener(_0x3fd02b,_0x1d56a0){return function(){UserEvents[_0x94ba('0x3')](_0x3fd02b,_0x1d56a0);};}exports[_0x94ba('0x4')]=function(_0x4dc350){for(var _0x45dce9=0x0,_0x4a0182=events[_0x94ba('0x5')];_0x45dce9<_0x4a0182;_0x45dce9++){var _0x390930=events[_0x45dce9];var _0x4f8293=createListener(_0x94ba('0x6')+_0x390930,_0x4dc350);UserEvents['on'](_0x390930,_0x4f8293);}}; \ No newline at end of file +var _0x88ee=['length','user:','./user.events','save','remove','emit','register'];(function(_0xfb619d,_0x139e8a){var _0x357299=function(_0x481d75){while(--_0x481d75){_0xfb619d['push'](_0xfb619d['shift']());}};_0x357299(++_0x139e8a);}(_0x88ee,0x1c2));var _0xe88e=function(_0x2ba57e,_0x5eeec9){_0x2ba57e=_0x2ba57e-0x0;var _0x2e29d0=_0x88ee[_0x2ba57e];return _0x2e29d0;};'use strict';var UserEvents=require(_0xe88e('0x0'));var events=[_0xe88e('0x1'),_0xe88e('0x2'),'update'];function createListener(_0x41ea51,_0x39b182){return function(_0x30f853){_0x39b182[_0xe88e('0x3')](_0x41ea51,_0x30f853);};}function removeListener(_0x29628a,_0x251651){return function(){UserEvents['removeListener'](_0x29628a,_0x251651);};}exports[_0xe88e('0x4')]=function(_0x48d69c){for(var _0x59c44e=0x0,_0x38fd66=events[_0xe88e('0x5')];_0x59c44e<_0x38fd66;_0x59c44e++){var _0x4b4ced=events[_0x59c44e];var _0x5c2094=createListener(_0xe88e('0x6')+_0x4b4ced,_0x48d69c);UserEvents['on'](_0x4b4ced,_0x5c2094);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index e80eb9a..b00d24e 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0xe411e8,_0x5c57c7){var _0x4b8f31=function(_0x4b4c86){while(--_0x4b4c86){_0xe411e8['push'](_0xe411e8['shift']());}};_0x4b8f31(++_0x5c57c7);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x5979e7,_0x2a8391){var _0x5b08be=function(_0x524d1c){while(--_0x524d1c){_0x5979e7['push'](_0x5979e7['shift']());}};_0x5b08be(++_0x2a8391);}(_0x9c44,0x178));var _0x49c4=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0x9c44[_0x17b6e3];return _0x3906f3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index abcdf87..6b63151 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 _0xe421=['INTEGER','sequelize','exports'];(function(_0x4dab14,_0x164ea0){var _0xf41aa=function(_0x305d50){while(--_0x305d50){_0x4dab14['push'](_0x4dab14['shift']());}};_0xf41aa(++_0x164ea0);}(_0xe421,0x18d));var _0x1e42=function(_0x1f3c62,_0x2211a6){_0x1f3c62=_0x1f3c62-0x0;var _0xac3484=_0xe421[_0x1f3c62];return _0xac3484;};'use strict';var Sequelize=require(_0x1e42('0x0'));module[_0x1e42('0x1')]={'penalty':{'type':Sequelize[_0x1e42('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xfead=['INTEGER','sequelize','exports'];(function(_0x37f59c,_0xa6b71c){var _0x2f9516=function(_0x1413eb){while(--_0x1413eb){_0x37f59c['push'](_0x37f59c['shift']());}};_0x2f9516(++_0xa6b71c);}(_0xfead,0x1d8));var _0xdfea=function(_0x2c0b9a,_0x460698){_0x2c0b9a=_0x2c0b9a-0x0;var _0xb2cf70=_0xfead[_0x2c0b9a];return _0xb2cf70;};'use strict';var Sequelize=require(_0xdfea('0x0'));module[_0xdfea('0x1')]={'penalty':{'type':Sequelize[_0xdfea('0x2')],'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 7f79fdb..8f54efd 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 _0xf3b1=['util','../../config/logger','api','moment','request-promise','path','./userChatQueue.attributes','exports','lodash'];(function(_0x378068,_0x49640b){var _0x373cf0=function(_0x2f416a){while(--_0x2f416a){_0x378068['push'](_0x378068['shift']());}};_0x373cf0(++_0x49640b);}(_0xf3b1,0x170));var _0x1f3b=function(_0x27bda0,_0x2af263){_0x27bda0=_0x27bda0-0x0;var _0x2f457c=_0xf3b1[_0x27bda0];return _0x2f457c;};'use strict';var _=require(_0x1f3b('0x0'));var util=require(_0x1f3b('0x1'));var logger=require(_0x1f3b('0x2'))(_0x1f3b('0x3'));var moment=require(_0x1f3b('0x4'));var BPromise=require('bluebird');var rp=require(_0x1f3b('0x5'));var fs=require('fs');var path=require(_0x1f3b('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1f3b('0x7'));module[_0x1f3b('0x8')]=function(_0xfe02df,_0x57c717){return _0xfe02df['define']('UserChatQueue',attributes,{'tableName':'user_has_chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x952d=['api','moment','path','define','UserChatQueue','user_has_chat_queues','lodash','../../config/logger'];(function(_0x6abec6,_0x311ddf){var _0x308987=function(_0x5c810e){while(--_0x5c810e){_0x6abec6['push'](_0x6abec6['shift']());}};_0x308987(++_0x311ddf);}(_0x952d,0x8e));var _0xd952=function(_0x4a7013,_0x5da066){_0x4a7013=_0x4a7013-0x0;var _0x33ef83=_0x952d[_0x4a7013];return _0x33ef83;};'use strict';var _=require(_0xd952('0x0'));var util=require('util');var logger=require(_0xd952('0x1'))(_0xd952('0x2'));var moment=require(_0xd952('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd952('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./userChatQueue.attributes');module['exports']=function(_0x16442d,_0x42ce80){return _0x16442d[_0xd952('0x5')](_0xd952('0x6'),attributes,{'tableName':_0xd952('0x7'),'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 3854dd8..af79a04 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 _0xf0f6=['moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','debug','stringify','error','code','UserChatQueue,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','util'];(function(_0x5af886,_0x9957a3){var _0x170052=function(_0x2dc6fa){while(--_0x2dc6fa){_0x5af886['push'](_0x5af886['shift']());}};_0x170052(++_0x9957a3);}(_0xf0f6,0x10f));var _0x6f0f=function(_0x13336b,_0xaaab48){_0x13336b=_0x13336b-0x0;var _0x1a862a=_0xf0f6[_0x13336b];return _0x1a862a;};'use strict';var _=require(_0x6f0f('0x0'));var util=require(_0x6f0f('0x1'));var moment=require(_0x6f0f('0x2'));var BPromise=require(_0x6f0f('0x3'));var rs=require(_0x6f0f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6f0f('0x5'));var logger=require(_0x6f0f('0x6'))('rpc');var config=require(_0x6f0f('0x7'));var jayson=require(_0x6f0f('0x8'));var client=jayson['client'][_0x6f0f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2496a3,_0x387cde,_0x4275a5){return new BPromise(function(_0x510887,_0x7f7a1e){return client['request'](_0x2496a3,_0x4275a5)[_0x6f0f('0xa')](function(_0x2dfd0f){logger[_0x6f0f('0xb')]('UserChatQueue,\x20%s,\x20%s',_0x387cde,'request\x20sent');logger[_0x6f0f('0xc')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x387cde,'request\x20sent',JSON[_0x6f0f('0xd')](_0x2dfd0f));if(_0x2dfd0f[_0x6f0f('0xe')]){if(_0x2dfd0f[_0x6f0f('0xe')][_0x6f0f('0xf')]===0x1f4){logger[_0x6f0f('0xe')](_0x6f0f('0x10'),_0x387cde,_0x2dfd0f[_0x6f0f('0xe')][_0x6f0f('0x11')]);return _0x7f7a1e(_0x2dfd0f[_0x6f0f('0xe')][_0x6f0f('0x11')]);}logger[_0x6f0f('0xe')](_0x6f0f('0x10'),_0x387cde,_0x2dfd0f[_0x6f0f('0xe')][_0x6f0f('0x11')]);return _0x510887(_0x2dfd0f[_0x6f0f('0xe')][_0x6f0f('0x11')]);}else{logger[_0x6f0f('0xb')](_0x6f0f('0x10'),_0x387cde,_0x6f0f('0x12'));_0x510887(_0x2dfd0f[_0x6f0f('0x13')]['message']);}})[_0x6f0f('0x14')](function(_0x9a2030){logger[_0x6f0f('0xe')](_0x6f0f('0x10'),_0x387cde,_0x9a2030);_0x7f7a1e(_0x9a2030);});});} \ No newline at end of file +var _0xd340=['catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result'];(function(_0x1ff778,_0x48d7c9){var _0x1d6937=function(_0x240d98){while(--_0x240d98){_0x1ff778['push'](_0x1ff778['shift']());}};_0x1d6937(++_0x48d7c9);}(_0xd340,0x1ba));var _0x0d34=function(_0x2fb4d0,_0x2d65dd){_0x2fb4d0=_0x2fb4d0-0x0;var _0x9401a7=_0xd340[_0x2fb4d0];return _0x9401a7;};'use strict';var _=require(_0x0d34('0x0'));var util=require(_0x0d34('0x1'));var moment=require(_0x0d34('0x2'));var BPromise=require('bluebird');var rs=require(_0x0d34('0x3'));var fs=require('fs');var Redis=require(_0x0d34('0x4'));var db=require(_0x0d34('0x5'))['db'];var utils=require(_0x0d34('0x6'));var logger=require(_0x0d34('0x7'))('rpc');var config=require(_0x0d34('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0d34('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x50e7f3,_0x2a9720,_0x49fb1e){return new BPromise(function(_0x31e212,_0x1c9e77){return client[_0x0d34('0xa')](_0x50e7f3,_0x49fb1e)[_0x0d34('0xb')](function(_0x2cc186){logger[_0x0d34('0xc')](_0x0d34('0xd'),_0x2a9720,_0x0d34('0xe'));logger[_0x0d34('0xf')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x2a9720,_0x0d34('0xe'),JSON['stringify'](_0x2cc186));if(_0x2cc186[_0x0d34('0x10')]){if(_0x2cc186[_0x0d34('0x10')][_0x0d34('0x11')]===0x1f4){logger[_0x0d34('0x10')](_0x0d34('0xd'),_0x2a9720,_0x2cc186[_0x0d34('0x10')][_0x0d34('0x12')]);return _0x1c9e77(_0x2cc186[_0x0d34('0x10')][_0x0d34('0x12')]);}logger[_0x0d34('0x10')](_0x0d34('0xd'),_0x2a9720,_0x2cc186[_0x0d34('0x10')][_0x0d34('0x12')]);return _0x31e212(_0x2cc186['error'][_0x0d34('0x12')]);}else{logger[_0x0d34('0xc')](_0x0d34('0xd'),_0x2a9720,_0x0d34('0xe'));_0x31e212(_0x2cc186[_0x0d34('0x13')][_0x0d34('0x12')]);}})[_0x0d34('0x14')](function(_0x1e6abe){logger[_0x0d34('0x10')](_0x0d34('0xd'),_0x2a9720,_0x1e6abe);_0x1c9e77(_0x1e6abe);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 67a479c..886997a 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(_0x54f7c0,_0x27af83){var _0x245d03=function(_0x1ad6c4){while(--_0x1ad6c4){_0x54f7c0['push'](_0x54f7c0['shift']());}};_0x245d03(++_0x27af83);}(_0x9c44,0x178));var _0x49c4=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0x9c44[_0x3d42d8];return _0x27fc41;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');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(_0x33c42d,_0x55ea22){var _0x570f2f=function(_0x5f317b){while(--_0x5f317b){_0x33c42d['push'](_0x33c42d['shift']());}};_0x570f2f(++_0x55ea22);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x500c0,_0xdb6a03){_0x500c0=_0x500c0-0x0;var _0xdd146f=_0xcb91[_0x500c0];return _0xdd146f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index b1e8fe2..5287ea5 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 _0xbf61=['sequelize','exports','INTEGER','STRING'];(function(_0x31c480,_0x13f64a){var _0x3687ce=function(_0x46fbc0){while(--_0x46fbc0){_0x31c480['push'](_0x31c480['shift']());}};_0x3687ce(++_0x13f64a);}(_0xbf61,0x100));var _0x1bf6=function(_0x33bd4a,_0x327182){_0x33bd4a=_0x33bd4a-0x0;var _0x2e3966=_0xbf61[_0x33bd4a];return _0x2e3966;};'use strict';var Sequelize=require(_0x1bf6('0x0'));module[_0x1bf6('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x1bf6('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x1bf6('0x3')]}}; \ No newline at end of file +var _0x9a4d=['exports','INTEGER','STRING','sequelize'];(function(_0x348219,_0xdd367a){var _0xc1133d=function(_0x4e3cb9){while(--_0x4e3cb9){_0x348219['push'](_0x348219['shift']());}};_0xc1133d(++_0xdd367a);}(_0x9a4d,0x13f));var _0xd9a4=function(_0xc1d691,_0x166b6e){_0xc1d691=_0xc1d691-0x0;var _0x16ac7=_0x9a4d[_0xc1d691];return _0x16ac7;};'use strict';var Sequelize=require(_0xd9a4('0x0'));module[_0xd9a4('0x1')]={'penalty':{'type':Sequelize[_0xd9a4('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xd9a4('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0xd9a4('0x3')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 9d06771..b3a05de 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 _0x6f34=['UserFaxQueue','user_has_fax_queues','lodash','util','api','moment','bluebird','request-promise','../../config/environment','exports','define'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0x6f34,0x86));var _0x46f3=function(_0x174f56,_0x5f3887){_0x174f56=_0x174f56-0x0;var _0x1c99c5=_0x6f34[_0x174f56];return _0x1c99c5;};'use strict';var _=require(_0x46f3('0x0'));var util=require(_0x46f3('0x1'));var logger=require('../../config/logger')(_0x46f3('0x2'));var moment=require(_0x46f3('0x3'));var BPromise=require(_0x46f3('0x4'));var rp=require(_0x46f3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x46f3('0x6'));var attributes=require('./userFaxQueue.attributes');module[_0x46f3('0x7')]=function(_0x239416,_0x1adec7){return _0x239416[_0x46f3('0x8')](_0x46f3('0x9'),attributes,{'tableName':_0x46f3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe0c1=['lodash','util','bluebird','request-promise','path','rimraf','../../config/environment','./userFaxQueue.attributes','UserFaxQueue','user_has_fax_queues'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0xe0c1,0x82));var _0x1e0c=function(_0x3fc975,_0x138991){_0x3fc975=_0x3fc975-0x0;var _0x5146d2=_0xe0c1[_0x3fc975];return _0x5146d2;};'use strict';var _=require(_0x1e0c('0x0'));var util=require(_0x1e0c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x1e0c('0x2'));var rp=require(_0x1e0c('0x3'));var fs=require('fs');var path=require(_0x1e0c('0x4'));var rimraf=require(_0x1e0c('0x5'));var config=require(_0x1e0c('0x6'));var attributes=require(_0x1e0c('0x7'));module['exports']=function(_0x295dce,_0x5347b1){return _0x295dce['define'](_0x1e0c('0x8'),attributes,{'tableName':_0x1e0c('0x9'),'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 f734eb7..00da589 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 _0x81df=['http','request','then','info','UserFaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','UserFaxQueue,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x81df,0xc8));var _0xf81d=function(_0x48650b,_0x2cfdcb){_0x48650b=_0x48650b-0x0;var _0x520b19=_0x81df[_0x48650b];return _0x520b19;};'use strict';var _=require(_0xf81d('0x0'));var util=require(_0xf81d('0x1'));var moment=require(_0xf81d('0x2'));var BPromise=require(_0xf81d('0x3'));var rs=require(_0xf81d('0x4'));var fs=require('fs');var Redis=require(_0xf81d('0x5'));var db=require(_0xf81d('0x6'))['db'];var utils=require(_0xf81d('0x7'));var logger=require(_0xf81d('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xf81d('0x9'));var client=jayson['client'][_0xf81d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x498265,_0x890d09,_0x5018a3){return new BPromise(function(_0xaa7d4e,_0x3fc364){return client[_0xf81d('0xb')](_0x498265,_0x5018a3)[_0xf81d('0xc')](function(_0x5eed66){logger[_0xf81d('0xd')]('UserFaxQueue,\x20%s,\x20%s',_0x890d09,'request\x20sent');logger['debug'](_0xf81d('0xe'),_0x890d09,_0xf81d('0xf'),JSON[_0xf81d('0x10')](_0x5eed66));if(_0x5eed66[_0xf81d('0x11')]){if(_0x5eed66[_0xf81d('0x11')]['code']===0x1f4){logger[_0xf81d('0x11')](_0xf81d('0x12'),_0x890d09,_0x5eed66[_0xf81d('0x11')][_0xf81d('0x13')]);return _0x3fc364(_0x5eed66['error'][_0xf81d('0x13')]);}logger[_0xf81d('0x11')](_0xf81d('0x12'),_0x890d09,_0x5eed66[_0xf81d('0x11')][_0xf81d('0x13')]);return _0xaa7d4e(_0x5eed66[_0xf81d('0x11')][_0xf81d('0x13')]);}else{logger[_0xf81d('0xd')]('UserFaxQueue,\x20%s,\x20%s',_0x890d09,_0xf81d('0xf'));_0xaa7d4e(_0x5eed66[_0xf81d('0x14')][_0xf81d('0x13')]);}})['catch'](function(_0x3dac3a){logger[_0xf81d('0x11')](_0xf81d('0x12'),_0x890d09,_0x3dac3a);_0x3fc364(_0x3dac3a);});});} \ No newline at end of file +var _0x8fb0=['moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','code','error','message','catch','lodash','util'];(function(_0x48cdd7,_0x35736d){var _0x368692=function(_0x2e0f3e){while(--_0x2e0f3e){_0x48cdd7['push'](_0x48cdd7['shift']());}};_0x368692(++_0x35736d);}(_0x8fb0,0xda));var _0x08fb=function(_0x35885a,_0x42fed7){_0x35885a=_0x35885a-0x0;var _0xe86249=_0x8fb0[_0x35885a];return _0xe86249;};'use strict';var _=require(_0x08fb('0x0'));var util=require(_0x08fb('0x1'));var moment=require(_0x08fb('0x2'));var BPromise=require(_0x08fb('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x08fb('0x4'))['db'];var utils=require(_0x08fb('0x5'));var logger=require(_0x08fb('0x6'))(_0x08fb('0x7'));var config=require(_0x08fb('0x8'));var jayson=require(_0x08fb('0x9'));var client=jayson[_0x08fb('0xa')][_0x08fb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x41a03e,_0x1d16a8,_0x12d015){return new BPromise(function(_0x15bbce,_0x18a20a){return client[_0x08fb('0xc')](_0x41a03e,_0x12d015)[_0x08fb('0xd')](function(_0x1a6657){logger[_0x08fb('0xe')](_0x08fb('0xf'),_0x1d16a8,_0x08fb('0x10'));logger[_0x08fb('0x11')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x1d16a8,_0x08fb('0x10'),JSON['stringify'](_0x1a6657));if(_0x1a6657['error']){if(_0x1a6657['error'][_0x08fb('0x12')]===0x1f4){logger[_0x08fb('0x13')]('UserFaxQueue,\x20%s,\x20%s',_0x1d16a8,_0x1a6657[_0x08fb('0x13')][_0x08fb('0x14')]);return _0x18a20a(_0x1a6657[_0x08fb('0x13')][_0x08fb('0x14')]);}logger[_0x08fb('0x13')](_0x08fb('0xf'),_0x1d16a8,_0x1a6657['error'][_0x08fb('0x14')]);return _0x15bbce(_0x1a6657['error'][_0x08fb('0x14')]);}else{logger[_0x08fb('0xe')]('UserFaxQueue,\x20%s,\x20%s',_0x1d16a8,_0x08fb('0x10'));_0x15bbce(_0x1a6657['result']['message']);}})[_0x08fb('0x15')](function(_0x2e1961){logger[_0x08fb('0x13')](_0x08fb('0xf'),_0x1d16a8,_0x2e1961);_0x18a20a(_0x2e1961);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 438cc7a..850e476 100644 --- a/server/api/userMailQueue/index.js +++ b/server/api/userMailQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x1aba30,_0x35d084){var _0x3646cb=function(_0x67b92b){while(--_0x67b92b){_0x1aba30['push'](_0x1aba30['shift']());}};_0x3646cb(++_0x35d084);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0xcb91[_0x1caf6a];return _0x1bf493;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x11591f,_0x59f48c){var _0x2eeea9=function(_0x34d5c6){while(--_0x34d5c6){_0x11591f['push'](_0x11591f['shift']());}};_0x2eeea9(++_0x59f48c);}(_0xe706,0xa3));var _0x6e70=function(_0x5b0741,_0x438df7){_0x5b0741=_0x5b0741-0x0;var _0x3ee9c9=_0xe706[_0x5b0741];return _0x3ee9c9;};'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/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 2889e05..fb00369 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 _0xf45d=['INTEGER','sequelize','exports'];(function(_0x33cf32,_0x787c8c){var _0x3324f9=function(_0x590018){while(--_0x590018){_0x33cf32['push'](_0x33cf32['shift']());}};_0x3324f9(++_0x787c8c);}(_0xf45d,0x9a));var _0xdf45=function(_0x50fd32,_0x13d6f1){_0x50fd32=_0x50fd32-0x0;var _0x21f466=_0xf45d[_0x50fd32];return _0x21f466;};'use strict';var Sequelize=require(_0xdf45('0x0'));module[_0xdf45('0x1')]={'penalty':{'type':Sequelize[_0xdf45('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb38e=['exports','INTEGER','sequelize'];(function(_0x28e291,_0x18d9e1){var _0x345627=function(_0x59ede8){while(--_0x59ede8){_0x28e291['push'](_0x28e291['shift']());}};_0x345627(++_0x18d9e1);}(_0xb38e,0xa7));var _0xeb38=function(_0x2e4c0,_0x19695f){_0x2e4c0=_0x2e4c0-0x0;var _0xaf5153=_0xb38e[_0x2e4c0];return _0xaf5153;};'use strict';var Sequelize=require(_0xeb38('0x0'));module[_0xeb38('0x1')]={'penalty':{'type':Sequelize[_0xeb38('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index 5d27eb9..c422ee0 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 _0xff5b=['path','../../config/environment','./userMailQueue.attributes','exports','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3b5ad6,_0xd89dae){var _0xa377e9=function(_0x3bcc2f){while(--_0x3bcc2f){_0x3b5ad6['push'](_0x3b5ad6['shift']());}};_0xa377e9(++_0xd89dae);}(_0xff5b,0x7c));var _0xbff5=function(_0x3a2e75,_0x2124e7){_0x3a2e75=_0x3a2e75-0x0;var _0x4780ca=_0xff5b[_0x3a2e75];return _0x4780ca;};'use strict';var _=require(_0xbff5('0x0'));var util=require('util');var logger=require(_0xbff5('0x1'))(_0xbff5('0x2'));var moment=require(_0xbff5('0x3'));var BPromise=require(_0xbff5('0x4'));var rp=require(_0xbff5('0x5'));var fs=require('fs');var path=require(_0xbff5('0x6'));var rimraf=require('rimraf');var config=require(_0xbff5('0x7'));var attributes=require(_0xbff5('0x8'));module[_0xbff5('0x9')]=function(_0x30c889,_0x5e1c87){return _0x30c889['define']('UserMailQueue',attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9365=['define','UserMailQueue','user_has_mail_queues','lodash','util','../../config/logger','moment','rimraf','../../config/environment','exports'];(function(_0x10ccba,_0x567e8e){var _0x379124=function(_0x41f5b1){while(--_0x41f5b1){_0x10ccba['push'](_0x10ccba['shift']());}};_0x379124(++_0x567e8e);}(_0x9365,0x7b));var _0x5936=function(_0x2b5eaa,_0x5cf20b){_0x2b5eaa=_0x2b5eaa-0x0;var _0x176a56=_0x9365[_0x2b5eaa];return _0x176a56;};'use strict';var _=require(_0x5936('0x0'));var util=require(_0x5936('0x1'));var logger=require(_0x5936('0x2'))('api');var moment=require(_0x5936('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5936('0x4'));var config=require(_0x5936('0x5'));var attributes=require('./userMailQueue.attributes');module[_0x5936('0x6')]=function(_0x13c986,_0x4ffc88){return _0x13c986[_0x5936('0x7')](_0x5936('0x8'),attributes,{'tableName':_0x5936('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index d21b606..7c73409 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 _0xa41a=['rpc','../../config/environment','client','http','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x5af3a7,_0x2c6830){var _0x125667=function(_0x59fe5a){while(--_0x59fe5a){_0x5af3a7['push'](_0x5af3a7['shift']());}};_0x125667(++_0x2c6830);}(_0xa41a,0x6b));var _0xaa41=function(_0x2d76bb,_0x2a3b86){_0x2d76bb=_0x2d76bb-0x0;var _0x307671=_0xa41a[_0x2d76bb];return _0x307671;};'use strict';var _=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var moment=require('moment');var BPromise=require(_0xaa41('0x2'));var rs=require(_0xaa41('0x3'));var fs=require('fs');var Redis=require(_0xaa41('0x4'));var db=require(_0xaa41('0x5'))['db'];var utils=require(_0xaa41('0x6'));var logger=require(_0xaa41('0x7'))(_0xaa41('0x8'));var config=require(_0xaa41('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xaa41('0xa')][_0xaa41('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x54bc5a,_0x5b1fff,_0x179545){return new BPromise(function(_0x202cce,_0x588ab4){return client[_0xaa41('0xc')](_0x54bc5a,_0x179545)[_0xaa41('0xd')](function(_0x409dab){logger[_0xaa41('0xe')](_0xaa41('0xf'),_0x5b1fff,_0xaa41('0x10'));logger[_0xaa41('0x11')](_0xaa41('0x12'),_0x5b1fff,_0xaa41('0x10'),JSON['stringify'](_0x409dab));if(_0x409dab[_0xaa41('0x13')]){if(_0x409dab[_0xaa41('0x13')]['code']===0x1f4){logger['error'](_0xaa41('0xf'),_0x5b1fff,_0x409dab['error'][_0xaa41('0x14')]);return _0x588ab4(_0x409dab[_0xaa41('0x13')][_0xaa41('0x14')]);}logger[_0xaa41('0x13')](_0xaa41('0xf'),_0x5b1fff,_0x409dab['error'][_0xaa41('0x14')]);return _0x202cce(_0x409dab[_0xaa41('0x13')][_0xaa41('0x14')]);}else{logger[_0xaa41('0xe')](_0xaa41('0xf'),_0x5b1fff,_0xaa41('0x10'));_0x202cce(_0x409dab[_0xaa41('0x15')]['message']);}})[_0xaa41('0x16')](function(_0x16b930){logger[_0xaa41('0x13')](_0xaa41('0xf'),_0x5b1fff,_0x16b930);_0x588ab4(_0x16b930);});});} \ No newline at end of file +var _0x4b84=['../../config/logger','rpc','http','then','info','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','UserMailQueue,\x20%s,\x20%s','message','lodash','util','randomstring','../../config/utils'];(function(_0x3a27b7,_0x25052b){var _0x192e3b=function(_0x497c44){while(--_0x497c44){_0x3a27b7['push'](_0x3a27b7['shift']());}};_0x192e3b(++_0x25052b);}(_0x4b84,0x1cc));var _0x44b8=function(_0x34c553,_0x3e7dfc){_0x34c553=_0x34c553-0x0;var _0x1357d2=_0x4b84[_0x34c553];return _0x1357d2;};'use strict';var _=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x44b8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x44b8('0x3'));var logger=require(_0x44b8('0x4'))(_0x44b8('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x44b8('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x54274b,_0x327f59,_0x5947f7){return new BPromise(function(_0x3e87c5,_0x5a2353){return client['request'](_0x54274b,_0x5947f7)[_0x44b8('0x7')](function(_0x42319d){logger[_0x44b8('0x8')]('UserMailQueue,\x20%s,\x20%s',_0x327f59,_0x44b8('0x9'));logger[_0x44b8('0xa')](_0x44b8('0xb'),_0x327f59,_0x44b8('0x9'),JSON[_0x44b8('0xc')](_0x42319d));if(_0x42319d[_0x44b8('0xd')]){if(_0x42319d[_0x44b8('0xd')]['code']===0x1f4){logger[_0x44b8('0xd')](_0x44b8('0xe'),_0x327f59,_0x42319d['error'][_0x44b8('0xf')]);return _0x5a2353(_0x42319d['error'][_0x44b8('0xf')]);}logger[_0x44b8('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x327f59,_0x42319d[_0x44b8('0xd')]['message']);return _0x3e87c5(_0x42319d['error'][_0x44b8('0xf')]);}else{logger[_0x44b8('0x8')](_0x44b8('0xe'),_0x327f59,_0x44b8('0x9'));_0x3e87c5(_0x42319d['result']['message']);}})['catch'](function(_0x3fe9fb){logger['error'](_0x44b8('0xe'),_0x327f59,_0x3fe9fb);_0x5a2353(_0x3fe9fb);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 6405018..300d815 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 _0x80ad=['../../config/environment','./userNotification.controller','post','isAuthenticated','sendUserNotification','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x183256,_0x1a596d){var _0x5394a2=function(_0x192025){while(--_0x192025){_0x183256['push'](_0x183256['shift']());}};_0x5394a2(++_0x1a596d);}(_0x80ad,0x123));var _0xd80a=function(_0x1f0d91,_0x24b032){_0x1f0d91=_0x1f0d91-0x0;var _0xafee7a=_0x80ad[_0x1f0d91];return _0xafee7a;};'use strict';var multer=require(_0xd80a('0x0'));var util=require(_0xd80a('0x1'));var path=require('path');var timeout=require(_0xd80a('0x2'));var express=require(_0xd80a('0x3'));var router=express[_0xd80a('0x4')]();var fs_extra=require(_0xd80a('0x5'));var auth=require(_0xd80a('0x6'));var interaction=require(_0xd80a('0x7'));var config=require(_0xd80a('0x8'));var controller=require(_0xd80a('0x9'));router[_0xd80a('0xa')]('/',auth[_0xd80a('0xb')](),controller[_0xd80a('0xc')]);module['exports']=router; \ No newline at end of file +var _0xd2ce=['isAuthenticated','sendUserNotification','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./userNotification.controller','post'];(function(_0x57ead2,_0x417700){var _0x55b8c3=function(_0x47333a){while(--_0x47333a){_0x57ead2['push'](_0x57ead2['shift']());}};_0x55b8c3(++_0x417700);}(_0xd2ce,0x14c));var _0xed2c=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xd2ce[_0xbe200f];return _0x192597;};'use strict';var multer=require(_0xed2c('0x0'));var util=require('util');var path=require(_0xed2c('0x1'));var timeout=require(_0xed2c('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xed2c('0x3'));var auth=require(_0xed2c('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xed2c('0x5'));var controller=require(_0xed2c('0x6'));router[_0xed2c('0x7')]('/',auth[_0xed2c('0x8')](),controller[_0xed2c('0x9')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index c94bf5b..8c50d9f 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 _0xd157=['sequelize','TEXT','STRING','BOOLEAN'];(function(_0x9ae685,_0x2c6652){var _0x4c492e=function(_0xde76ce){while(--_0xde76ce){_0x9ae685['push'](_0x9ae685['shift']());}};_0x4c492e(++_0x2c6652);}(_0xd157,0x1e8));var _0x7d15=function(_0xe0342,_0x7114a9){_0xe0342=_0xe0342-0x0;var _0xed9810=_0xd157[_0xe0342];return _0xed9810;};'use strict';var Sequelize=require(_0x7d15('0x0'));module['exports']={'body':{'type':Sequelize[_0x7d15('0x1')]},'senderName':{'type':Sequelize[_0x7d15('0x2')]},'recipientsId':{'type':Sequelize[_0x7d15('0x1')]},'recipientsDescription':{'type':Sequelize[_0x7d15('0x2')]},'beep':{'type':Sequelize[_0x7d15('0x3')]}}; \ No newline at end of file +var _0xff93=['STRING','sequelize'];(function(_0x31bd38,_0x15d8b9){var _0x157502=function(_0xcde68d){while(--_0xcde68d){_0x31bd38['push'](_0x31bd38['shift']());}};_0x157502(++_0x15d8b9);}(_0xff93,0x93));var _0x3ff9=function(_0x5a8583,_0x2d6817){_0x5a8583=_0x5a8583-0x0;var _0x1f3851=_0xff93[_0x5a8583];return _0x1f3851;};'use strict';var Sequelize=require(_0x3ff9('0x0'));module['exports']={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize[_0x3ff9('0x1')]},'beep':{'type':Sequelize['BOOLEAN']}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 728da18..c9df434 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 _0xf0d2=['then','destroy','stack','name','send','sendUserNotification','body','text','hasOwnProperty','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Missing\x20\x27recipients\x27\x20parameter','parse','error','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','smsqueue','voicequeue','whatsappqueue','team','user','some','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','recipientsDescription','beep','SenderId','recipientsId','sortBy','join','sequelize','UserNotification','create','userNotification:send','catch','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','forEach','startCase','User','ids','replace','queue','Queue','push','all','union','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./userNotification.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','reject','save','update'];(function(_0x1943d9,_0x245bb8){var _0x4b4f3f=function(_0x3bba90){while(--_0x3bba90){_0x1943d9['push'](_0x1943d9['shift']());}};_0x4b4f3f(++_0x245bb8);}(_0xf0d2,0x15f));var _0x2f0d=function(_0x529b3e,_0x585395){_0x529b3e=_0x529b3e-0x0;var _0x7baff6=_0xf0d2[_0x529b3e];return _0x7baff6;};'use strict';var emlformat=require(_0x2f0d('0x0'));var rimraf=require(_0x2f0d('0x1'));var zipdir=require(_0x2f0d('0x2'));var jsonpatch=require(_0x2f0d('0x3'));var rp=require(_0x2f0d('0x4'));var moment=require(_0x2f0d('0x5'));var BPromise=require(_0x2f0d('0x6'));var Mustache=require('mustache');var util=require(_0x2f0d('0x7'));var path=require(_0x2f0d('0x8'));var sox=require(_0x2f0d('0x9'));var csv=require(_0x2f0d('0xa'));var ejs=require(_0x2f0d('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2f0d('0xc'));var squel=require(_0x2f0d('0xd'));var crypto=require(_0x2f0d('0xe'));var jsforce=require(_0x2f0d('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x2f0d('0xa'));var querystring=require(_0x2f0d('0x10'));var Papa=require('papaparse');var Redis=require(_0x2f0d('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2f0d('0x12'));var hardwareService=require(_0x2f0d('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x2f0d('0x14'));var config=require(_0x2f0d('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x2f0d('0x16'))['db'];config['redis']=_[_0x2f0d('0x17')](config[_0x2f0d('0x18')],{'host':_0x2f0d('0x19'),'port':0x18eb});var socket=require(_0x2f0d('0x1a'))(new Redis(config[_0x2f0d('0x18')]));require(_0x2f0d('0x1b'))[_0x2f0d('0x1c')](socket);function respondWithStatusCode(_0x2e53f1,_0x47fbc6){_0x47fbc6=_0x47fbc6||0xcc;return function(_0x427e80){if(_0x427e80){return _0x2e53f1[_0x2f0d('0x1d')](_0x47fbc6);}return _0x2e53f1[_0x2f0d('0x1e')](_0x47fbc6)[_0x2f0d('0x1f')]();};}function respondWithResult(_0x24c9a0,_0x4b8f69){_0x4b8f69=_0x4b8f69||0xc8;return function(_0x49d531){if(_0x49d531){return _0x24c9a0['status'](_0x4b8f69)[_0x2f0d('0x20')](_0x49d531);}};}function respondWithFilteredResult(_0x491c63,_0x112358){return function(_0x2ec11f){if(_0x2ec11f){var _0x465cba=typeof _0x112358['offset']===_0x2f0d('0x21')&&typeof _0x112358[_0x2f0d('0x22')]===_0x2f0d('0x21');var _0x39a93a=_0x2ec11f[_0x2f0d('0x23')];var _0x51c090=_0x465cba?0x0:_0x112358[_0x2f0d('0x24')];var _0x154adf=_0x465cba?_0x2ec11f[_0x2f0d('0x23')]:_0x112358[_0x2f0d('0x24')]+_0x112358['limit'];var _0x43a02c;if(_0x154adf>=_0x39a93a){_0x154adf=_0x39a93a;_0x43a02c=0xc8;}else{_0x43a02c=0xce;}_0x491c63[_0x2f0d('0x1e')](_0x43a02c);return _0x491c63[_0x2f0d('0x25')]('Content-Range',_0x51c090+'-'+_0x154adf+'/'+_0x39a93a)['json'](_0x2ec11f);}return null;};}function patchUpdates(_0x48e029){return function(_0x3aa51e){try{jsonpatch['apply'](_0x3aa51e,_0x48e029,!![]);}catch(_0x5768bc){return BPromise[_0x2f0d('0x26')](_0x5768bc);}return _0x3aa51e[_0x2f0d('0x27')]();};}function saveUpdates(_0x34b62c,_0x581e54){return function(_0x7252d){if(_0x7252d){return _0x7252d[_0x2f0d('0x28')](_0x34b62c)[_0x2f0d('0x29')](function(_0x51212f){return _0x51212f;});}return null;};}function removeEntity(_0x81c2b2,_0x5df098){return function(_0x5a38db){if(_0x5a38db){return _0x5a38db[_0x2f0d('0x2a')]()[_0x2f0d('0x29')](function(){_0x81c2b2[_0x2f0d('0x1e')](0xcc)[_0x2f0d('0x1f')]();});}};}function handleEntityNotFound(_0xfcbdfc,_0x4bd6a5){return function(_0x58f0db){if(!_0x58f0db){_0xfcbdfc[_0x2f0d('0x1d')](0x194);}return _0x58f0db;};}function handleError(_0x5eea95,_0x36721a){_0x36721a=_0x36721a||0x1f4;return function(_0x2d7d11){logger['error'](_0x2d7d11[_0x2f0d('0x2b')]);if(_0x2d7d11[_0x2f0d('0x2c')]){delete _0x2d7d11['name'];}_0x5eea95['status'](_0x36721a)[_0x2f0d('0x2d')](_0x2d7d11);};}exports[_0x2f0d('0x2e')]=function(_0x18ec7c,_0x45cde0,_0x1d5bc3){if(!_0x18ec7c[_0x2f0d('0x2f')]['hasOwnProperty'](_0x2f0d('0x30'))&&!_0x18ec7c[_0x2f0d('0x2f')][_0x2f0d('0x31')](_0x2f0d('0x32'))){throw new db[(_0x2f0d('0x33'))][(_0x2f0d('0x34'))](_0x2f0d('0x35'));}else{if(_0x18ec7c[_0x2f0d('0x2f')][_0x2f0d('0x31')](_0x2f0d('0x32'))&&!_0x18ec7c[_0x2f0d('0x2f')][_0x2f0d('0x31')](_0x2f0d('0x36'))){throw new db[(_0x2f0d('0x33'))][(_0x2f0d('0x34'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0x18ec7c['body']['hasOwnProperty']('recipients')){throw new db[(_0x2f0d('0x33'))][(_0x2f0d('0x34'))](_0x2f0d('0x37'));}else{try{var _0x2e93a0=JSON[_0x2f0d('0x38')](_0x18ec7c[_0x2f0d('0x2f')]['recipients']);}catch(_0x5ae5c3){logger[_0x2f0d('0x39')](_0x5ae5c3);throw new db[(_0x2f0d('0x33'))]['ValidationError'](_0x2f0d('0x3a'));}var _0xa488a9=[_0x2f0d('0x3b'),_0x2f0d('0x3c'),_0x2f0d('0x3d'),'openchannelqueue',_0x2f0d('0x3e'),_0x2f0d('0x3f'),_0x2f0d('0x40'),_0x2f0d('0x41'),_0x2f0d('0x42')];if(_[_0x2f0d('0x43')](_0x2e93a0,function(_0x328733){return!_['includes'](_0xa488a9,_0x328733[_0x2f0d('0x44')][_0x2f0d('0x45')]());})){throw new db[(_0x2f0d('0x33'))][(_0x2f0d('0x34'))](_0x2f0d('0x46'));}}}var _0x573370={};_0x573370[_0x2f0d('0x47')]=_0x18ec7c[_0x2f0d('0x2f')]['hasOwnProperty'](_0x2f0d('0x47'))?_0x18ec7c['body'][_0x2f0d('0x47')]:_0x18ec7c[_0x2f0d('0x42')]['fullname'];_0x573370[_0x2f0d('0x48')]=_['isEmpty'](_0x18ec7c[_0x2f0d('0x2f')]['recipientsDescription'])?null:_0x18ec7c[_0x2f0d('0x2f')][_0x2f0d('0x48')];_0x573370[_0x2f0d('0x49')]=_0x18ec7c[_0x2f0d('0x2f')][_0x2f0d('0x49')]||![];_0x573370[_0x2f0d('0x4a')]=_0x18ec7c[_0x2f0d('0x42')]['id'];return getContent(_0x18ec7c[_0x2f0d('0x2f')])['then'](function(_0x256499){_0x573370[_0x2f0d('0x2f')]=_0x256499;return getRecipients(_0x2e93a0);})[_0x2f0d('0x29')](function(_0x34237b){_0x573370[_0x2f0d('0x4b')]=_[_0x2f0d('0x4c')](_0x34237b)[_0x2f0d('0x4d')](',');return db[_0x2f0d('0x4e')]['transaction'](function(_0x24db8e){return db[_0x2f0d('0x4f')][_0x2f0d('0x50')](_0x573370,{'raw':!![],'transaction':_0x24db8e})[_0x2f0d('0x29')](function(_0x56f039){var _0x192039={'sender':_0x573370[_0x2f0d('0x47')],'description':_0x573370['recipientsDescription'],'content':_0x573370[_0x2f0d('0x2f')],'beep':_0x573370[_0x2f0d('0x49')]};_0x34237b['forEach'](function(_0x51d89f){_0x192039['recipient']=_0x51d89f;socket['emit'](_0x2f0d('0x51'),_0x192039);});return _0x56f039;});});})[_0x2f0d('0x29')](respondWithResult(_0x45cde0,0xc9))[_0x2f0d('0x52')](handleError(_0x45cde0,null));};function getContent(_0x5c3f2b){return new BPromise(function(_0x4c2d0b,_0x4d55d2){if(_0x5c3f2b['text']){_0x4c2d0b(_0x5c3f2b[_0x2f0d('0x30')]);return;}return db[_0x2f0d('0x53')][_0x2f0d('0x54')]({'attributes':[_0x2f0d('0x55')],'where':{'id':_0x5c3f2b[_0x2f0d('0x32')]},'raw':!![]})[_0x2f0d('0x29')](function(_0x525970){if(!_0x525970)throw new db[(_0x2f0d('0x33'))][(_0x2f0d('0x34'))](_0x2f0d('0x56'));var _0x839849=Mustache['render'](_0x525970[_0x2f0d('0x55')],_0x5c3f2b[_0x2f0d('0x36')]);_0x4c2d0b(_0x839849);})[_0x2f0d('0x52')](function(_0x263a60){_0x4d55d2(_0x263a60);});});}function getRecipients(_0xc582ed){return new BPromise(function(_0x2d5b33,_0x50da54){var _0x2f7970=[];var _0x2027ee=[];_0xc582ed[_0x2f0d('0x57')](function(_0xf6c2bc){var _0x507733=_[_0x2f0d('0x58')](_0xf6c2bc[_0x2f0d('0x44')][_0x2f0d('0x45')]());if(_0x507733===_0x2f0d('0x59')){_0x2f7970=_['union'](_0x2f7970,_0xf6c2bc[_0x2f0d('0x5a')]);}else{if(_['includes'](_0x507733,'queue'))_0x507733=_0x507733[_0x2f0d('0x5b')](_0x2f0d('0x5c'),_0x2f0d('0x5d'));_0xf6c2bc[_0x2f0d('0x5a')][_0x2f0d('0x57')](function(_0x40c661){_0x2027ee[_0x2f0d('0x5e')](getAgents(_0x507733,_0x40c661));});}});return BPromise[_0x2f0d('0x5f')](_0x2027ee)[_0x2f0d('0x29')](function(_0x1e3ffb){_0x2f7970=_[_0x2f0d('0x60')](_0x2f7970,_['flatten'](_0x1e3ffb));_0x2d5b33(_0x2f7970);})[_0x2f0d('0x52')](function(_0x7f5c0a){_0x50da54(_0x7f5c0a);});});}function getAgents(_0x39eefe,_0x2fe398){return new BPromise(function(_0xb8c922,_0x4a58c2){return db[_0x39eefe][_0x2f0d('0x54')]({'where':{'id':_0x2fe398}})[_0x2f0d('0x29')](function(_0x55e0cd){return _0x55e0cd[_0x2f0d('0x61')]({'attributes':['id'],'raw':!![]})[_0x2f0d('0x29')](function(_0x37f1a8){var _0x2cf146=_['map'](_0x37f1a8,'id');_0xb8c922(_0x2cf146);});})[_0x2f0d('0x52')](function(_0x56d4fe){_0x4a58c2(_0x56d4fe);});});} \ No newline at end of file +var _0xf703=['getAgents','map','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','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','api','redis','defaults','register','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','sendUserNotification','body','text','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','hasOwnProperty','TemplateId','Sequelize','ValidationError','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','user','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','isEmpty','recipientsDescription','beep','SenderId','recipientsId','sortBy','join','transaction','UserNotification','create','forEach','recipient','userNotification:send','catch','Template','findOne','html','render','view','startCase','union','ids','queue','Queue','push','all','flatten'];(function(_0x57d7f7,_0x335c81){var _0x1a6800=function(_0x251345){while(--_0x251345){_0x57d7f7['push'](_0x57d7f7['shift']());}};_0x1a6800(++_0x335c81);}(_0xf703,0x196));var _0x3f70=function(_0x363639,_0x16f367){_0x363639=_0x363639-0x0;var _0x3d653f=_0xf703[_0x363639];return _0x3d653f;};'use strict';var emlformat=require(_0x3f70('0x0'));var rimraf=require(_0x3f70('0x1'));var zipdir=require(_0x3f70('0x2'));var jsonpatch=require(_0x3f70('0x3'));var rp=require(_0x3f70('0x4'));var moment=require('moment');var BPromise=require(_0x3f70('0x5'));var Mustache=require(_0x3f70('0x6'));var util=require(_0x3f70('0x7'));var path=require(_0x3f70('0x8'));var sox=require(_0x3f70('0x9'));var csv=require(_0x3f70('0xa'));var ejs=require(_0x3f70('0xb'));var fs=require('fs');var fs_extra=require(_0x3f70('0xc'));var _=require('lodash');var squel=require(_0x3f70('0xd'));var crypto=require(_0x3f70('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x3f70('0xf'));var toCsv=require(_0x3f70('0xa'));var querystring=require(_0x3f70('0x10'));var Papa=require(_0x3f70('0x11'));var Redis=require(_0x3f70('0x12'));var authService=require(_0x3f70('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x3f70('0x14'));var hardwareService=require(_0x3f70('0x15'));var logger=require(_0x3f70('0x16'))(_0x3f70('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x3f70('0x18')]=_[_0x3f70('0x19')](config[_0x3f70('0x18')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3f70('0x18')]));require('./userNotification.socket')[_0x3f70('0x1a')](socket);function respondWithStatusCode(_0x348f84,_0x52c9bf){_0x52c9bf=_0x52c9bf||0xcc;return function(_0x8fb58c){if(_0x8fb58c){return _0x348f84['sendStatus'](_0x52c9bf);}return _0x348f84[_0x3f70('0x1b')](_0x52c9bf)[_0x3f70('0x1c')]();};}function respondWithResult(_0x387a67,_0x54ed35){_0x54ed35=_0x54ed35||0xc8;return function(_0x417fa5){if(_0x417fa5){return _0x387a67[_0x3f70('0x1b')](_0x54ed35)[_0x3f70('0x1d')](_0x417fa5);}};}function respondWithFilteredResult(_0x1a15c7,_0x3fcb29){return function(_0x19c722){if(_0x19c722){var _0x2ef8ce=typeof _0x3fcb29[_0x3f70('0x1e')]===_0x3f70('0x1f')&&typeof _0x3fcb29['limit']==='undefined';var _0x362429=_0x19c722[_0x3f70('0x20')];var _0x361eb9=_0x2ef8ce?0x0:_0x3fcb29[_0x3f70('0x1e')];var _0x4ff4e3=_0x2ef8ce?_0x19c722[_0x3f70('0x20')]:_0x3fcb29['offset']+_0x3fcb29[_0x3f70('0x21')];var _0x34e371;if(_0x4ff4e3>=_0x362429){_0x4ff4e3=_0x362429;_0x34e371=0xc8;}else{_0x34e371=0xce;}_0x1a15c7[_0x3f70('0x1b')](_0x34e371);return _0x1a15c7['set'](_0x3f70('0x22'),_0x361eb9+'-'+_0x4ff4e3+'/'+_0x362429)[_0x3f70('0x1d')](_0x19c722);}return null;};}function patchUpdates(_0x5f29e8){return function(_0x397c96){try{jsonpatch[_0x3f70('0x23')](_0x397c96,_0x5f29e8,!![]);}catch(_0x2f1999){return BPromise[_0x3f70('0x24')](_0x2f1999);}return _0x397c96[_0x3f70('0x25')]();};}function saveUpdates(_0x21e70c,_0x15606f){return function(_0x5dac05){if(_0x5dac05){return _0x5dac05[_0x3f70('0x26')](_0x21e70c)[_0x3f70('0x27')](function(_0xad2e4d){return _0xad2e4d;});}return null;};}function removeEntity(_0x3eb9cc,_0x3469f6){return function(_0x4b69c9){if(_0x4b69c9){return _0x4b69c9[_0x3f70('0x28')]()[_0x3f70('0x27')](function(){_0x3eb9cc['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x47a329,_0x41642f){return function(_0x5d7081){if(!_0x5d7081){_0x47a329[_0x3f70('0x29')](0x194);}return _0x5d7081;};}function handleError(_0x379366,_0x1d35b7){_0x1d35b7=_0x1d35b7||0x1f4;return function(_0x712ea6){logger[_0x3f70('0x2a')](_0x712ea6[_0x3f70('0x2b')]);if(_0x712ea6[_0x3f70('0x2c')]){delete _0x712ea6[_0x3f70('0x2c')];}_0x379366[_0x3f70('0x1b')](_0x1d35b7)['send'](_0x712ea6);};}exports[_0x3f70('0x2d')]=function(_0x494d22,_0x4b57aa,_0x1d5c40){if(!_0x494d22[_0x3f70('0x2e')]['hasOwnProperty'](_0x3f70('0x2f'))&&!_0x494d22['body']['hasOwnProperty']('TemplateId')){throw new db['Sequelize']['ValidationError'](_0x3f70('0x30'));}else{if(_0x494d22['body'][_0x3f70('0x31')](_0x3f70('0x32'))&&!_0x494d22[_0x3f70('0x2e')][_0x3f70('0x31')]('view')){throw new db[(_0x3f70('0x33'))][(_0x3f70('0x34'))](_0x3f70('0x35'));}if(!_0x494d22[_0x3f70('0x2e')][_0x3f70('0x31')](_0x3f70('0x36'))){throw new db[(_0x3f70('0x33'))][(_0x3f70('0x34'))](_0x3f70('0x37'));}else{try{var _0x26176c=JSON[_0x3f70('0x38')](_0x494d22[_0x3f70('0x2e')][_0x3f70('0x36')]);}catch(_0x185e2b){logger[_0x3f70('0x2a')](_0x185e2b);throw new db[(_0x3f70('0x33'))][(_0x3f70('0x34'))]('Invalid\x20\x27recipients\x27\x20object');}var _0x408737=[_0x3f70('0x39'),_0x3f70('0x3a'),_0x3f70('0x3b'),_0x3f70('0x3c'),_0x3f70('0x3d'),_0x3f70('0x3e'),_0x3f70('0x3f'),_0x3f70('0x40'),_0x3f70('0x41')];if(_[_0x3f70('0x42')](_0x26176c,function(_0x53f0ae){return!_[_0x3f70('0x43')](_0x408737,_0x53f0ae[_0x3f70('0x44')][_0x3f70('0x45')]());})){throw new db[(_0x3f70('0x33'))][(_0x3f70('0x34'))](_0x3f70('0x46'));}}}var _0x281afc={};_0x281afc[_0x3f70('0x47')]=_0x494d22[_0x3f70('0x2e')][_0x3f70('0x31')](_0x3f70('0x47'))?_0x494d22[_0x3f70('0x2e')][_0x3f70('0x47')]:_0x494d22[_0x3f70('0x41')]['fullname'];_0x281afc['recipientsDescription']=_[_0x3f70('0x48')](_0x494d22['body'][_0x3f70('0x49')])?null:_0x494d22[_0x3f70('0x2e')][_0x3f70('0x49')];_0x281afc['beep']=_0x494d22[_0x3f70('0x2e')][_0x3f70('0x4a')]||![];_0x281afc[_0x3f70('0x4b')]=_0x494d22[_0x3f70('0x41')]['id'];return getContent(_0x494d22['body'])[_0x3f70('0x27')](function(_0x50aa2d){_0x281afc['body']=_0x50aa2d;return getRecipients(_0x26176c);})[_0x3f70('0x27')](function(_0xe346fd){_0x281afc[_0x3f70('0x4c')]=_[_0x3f70('0x4d')](_0xe346fd)[_0x3f70('0x4e')](',');return db['sequelize'][_0x3f70('0x4f')](function(_0x26bcb7){return db[_0x3f70('0x50')][_0x3f70('0x51')](_0x281afc,{'raw':!![],'transaction':_0x26bcb7})[_0x3f70('0x27')](function(_0x523d27){var _0x4994e3={'sender':_0x281afc[_0x3f70('0x47')],'description':_0x281afc[_0x3f70('0x49')],'content':_0x281afc['body'],'beep':_0x281afc['beep']};_0xe346fd[_0x3f70('0x52')](function(_0xdb477e){_0x4994e3[_0x3f70('0x53')]=_0xdb477e;socket['emit'](_0x3f70('0x54'),_0x4994e3);});return _0x523d27;});});})['then'](respondWithResult(_0x4b57aa,0xc9))[_0x3f70('0x55')](handleError(_0x4b57aa,null));};function getContent(_0x4221c6){return new BPromise(function(_0x1551af,_0x578b52){if(_0x4221c6[_0x3f70('0x2f')]){_0x1551af(_0x4221c6[_0x3f70('0x2f')]);return;}return db[_0x3f70('0x56')][_0x3f70('0x57')]({'attributes':[_0x3f70('0x58')],'where':{'id':_0x4221c6[_0x3f70('0x32')]},'raw':!![]})[_0x3f70('0x27')](function(_0x19b627){if(!_0x19b627)throw new db['Sequelize'][(_0x3f70('0x34'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x3f9624=Mustache[_0x3f70('0x59')](_0x19b627['html'],_0x4221c6[_0x3f70('0x5a')]);_0x1551af(_0x3f9624);})[_0x3f70('0x55')](function(_0x4bde55){_0x578b52(_0x4bde55);});});}function getRecipients(_0x232992){return new BPromise(function(_0x485995,_0x534b56){var _0x16edcf=[];var _0x5800ab=[];_0x232992['forEach'](function(_0x211daf){var _0x2c8f3e=_[_0x3f70('0x5b')](_0x211daf['model']['toLowerCase']());if(_0x2c8f3e==='User'){_0x16edcf=_[_0x3f70('0x5c')](_0x16edcf,_0x211daf[_0x3f70('0x5d')]);}else{if(_['includes'](_0x2c8f3e,_0x3f70('0x5e')))_0x2c8f3e=_0x2c8f3e['replace']('queue',_0x3f70('0x5f'));_0x211daf[_0x3f70('0x5d')][_0x3f70('0x52')](function(_0x1bf7e3){_0x5800ab[_0x3f70('0x60')](getAgents(_0x2c8f3e,_0x1bf7e3));});}});return BPromise[_0x3f70('0x61')](_0x5800ab)['then'](function(_0x287ad4){_0x16edcf=_[_0x3f70('0x5c')](_0x16edcf,_[_0x3f70('0x62')](_0x287ad4));_0x485995(_0x16edcf);})[_0x3f70('0x55')](function(_0x2da690){_0x534b56(_0x2da690);});});}function getAgents(_0xf2aa16,_0x41ab7d){return new BPromise(function(_0x1d35fa,_0x155e99){return db[_0xf2aa16]['findOne']({'where':{'id':_0x41ab7d}})['then'](function(_0x37c1b5){return _0x37c1b5[_0x3f70('0x63')]({'attributes':['id'],'raw':!![]})[_0x3f70('0x27')](function(_0x15a8e7){var _0x471879=_[_0x3f70('0x64')](_0x15a8e7,'id');_0x1d35fa(_0x471879);});})[_0x3f70('0x55')](function(_0x12a2e0){_0x155e99(_0x12a2e0);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 741dba6..5c7e834 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 _0xfd16=['update','remove','hasOwnProperty','exports','../../mysqldb','UserNotification','save'];(function(_0x3b125e,_0x4ab0af){var _0x3e90d1=function(_0x1d32df){while(--_0x1d32df){_0x3b125e['push'](_0x3b125e['shift']());}};_0x3e90d1(++_0x4ab0af);}(_0xfd16,0x6d));var _0x6fd1=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0xfd16[_0x263a74];return _0x2aa86c;};'use strict';var EventEmitter=require('events');var UserNotification=require(_0x6fd1('0x0'))['db'][_0x6fd1('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6fd1('0x2'),'afterUpdate':_0x6fd1('0x3'),'afterDestroy':_0x6fd1('0x4')};function emitEvent(_0x119410){return function(_0x4a24a5,_0x36f29f,_0x59c349){UserNotificationEvents['emit'](_0x119410+':'+_0x4a24a5['id'],_0x4a24a5);UserNotificationEvents['emit'](_0x119410,_0x4a24a5);_0x59c349(null);};}for(var e in events){if(events[_0x6fd1('0x5')](e)){var event=events[e];UserNotification['hook'](e,emitEvent(event));}}module[_0x6fd1('0x6')]=UserNotificationEvents; \ No newline at end of file +var _0x2c73=['save','remove','emit','hook','exports','events','../../mysqldb','UserNotification','setMaxListeners'];(function(_0x3ab3f4,_0xf8d006){var _0x53dc2d=function(_0x3abb5b){while(--_0x3abb5b){_0x3ab3f4['push'](_0x3ab3f4['shift']());}};_0x53dc2d(++_0xf8d006);}(_0x2c73,0x1d9));var _0x32c7=function(_0x413df6,_0x484825){_0x413df6=_0x413df6-0x0;var _0x337171=_0x2c73[_0x413df6];return _0x337171;};'use strict';var EventEmitter=require(_0x32c7('0x0'));var UserNotification=require(_0x32c7('0x1'))['db'][_0x32c7('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x32c7('0x3')](0x0);var events={'afterCreate':_0x32c7('0x4'),'afterUpdate':'update','afterDestroy':_0x32c7('0x5')};function emitEvent(_0x180b84){return function(_0x3eb172,_0x17ea9b,_0x4d0307){UserNotificationEvents[_0x32c7('0x6')](_0x180b84+':'+_0x3eb172['id'],_0x3eb172);UserNotificationEvents[_0x32c7('0x6')](_0x180b84,_0x3eb172);_0x4d0307(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserNotification[_0x32c7('0x7')](e,emitEvent(event));}}module[_0x32c7('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 4f6d125..adf900d 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 _0x4952=['api','path','../../config/environment','./userNotification.attributes','exports','define','UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4952,0x142));var _0x2495=function(_0x580b15,_0x28afa4){_0x580b15=_0x580b15-0x0;var _0x1adb1b=_0x4952[_0x580b15];return _0x1adb1b;};'use strict';var _=require(_0x2495('0x0'));var util=require('util');var logger=require(_0x2495('0x1'))(_0x2495('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2495('0x3'));var rimraf=require('rimraf');var config=require(_0x2495('0x4'));var attributes=require(_0x2495('0x5'));module[_0x2495('0x6')]=function(_0x415b5a,_0x2a0035){return _0x415b5a[_0x2495('0x7')](_0x2495('0x8'),attributes,{'tableName':_0x2495('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2495('0xa'),'collate':_0x2495('0xb')});}; \ No newline at end of file +var _0x4614=['UserNotification','userNotifications','utf8mb4','lodash','util','../../config/logger','api','bluebird','rimraf','../../config/environment','./userNotification.attributes','exports','define'];(function(_0x3e34f3,_0x3315ff){var _0xadd7fe=function(_0x57aeef){while(--_0x57aeef){_0x3e34f3['push'](_0x3e34f3['shift']());}};_0xadd7fe(++_0x3315ff);}(_0x4614,0x85));var _0x4461=function(_0x33dfdb,_0x29f04f){_0x33dfdb=_0x33dfdb-0x0;var _0x104f18=_0x4614[_0x33dfdb];return _0x104f18;};'use strict';var _=require(_0x4461('0x0'));var util=require(_0x4461('0x1'));var logger=require(_0x4461('0x2'))(_0x4461('0x3'));var moment=require('moment');var BPromise=require(_0x4461('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4461('0x5'));var config=require(_0x4461('0x6'));var attributes=require(_0x4461('0x7'));module[_0x4461('0x8')]=function(_0xb5af4d,_0xf4e5bc){return _0xb5af4d[_0x4461('0x9')](_0x4461('0xa'),attributes,{'tableName':_0x4461('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4461('0xc'),'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 21a4766..b5b5882 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 _0xac4d=['code','message','catch','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./userNotification.socket','register','request','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x35da42,_0x5c2610){var _0x370035=function(_0x546db5){while(--_0x546db5){_0x35da42['push'](_0x35da42['shift']());}};_0x370035(++_0x5c2610);}(_0xac4d,0x17c));var _0xdac4=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xac4d[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0xdac4('0x0'));var util=require(_0xdac4('0x1'));var moment=require(_0xdac4('0x2'));var BPromise=require('bluebird');var rs=require(_0xdac4('0x3'));var fs=require('fs');var Redis=require(_0xdac4('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xdac4('0x5'))(_0xdac4('0x6'));var config=require(_0xdac4('0x7'));var jayson=require(_0xdac4('0x8'));var client=jayson[_0xdac4('0x9')][_0xdac4('0xa')]({'port':0x232a});config['redis']=_[_0xdac4('0xb')](config[_0xdac4('0xc')],{'host':_0xdac4('0xd'),'port':0x18eb});var socket=require(_0xdac4('0xe'))(new Redis(config[_0xdac4('0xc')]));require(_0xdac4('0xf'))[_0xdac4('0x10')](socket);function respondWithRpcPromise(_0xba1141,_0xfed4b9,_0x2a5605){return new BPromise(function(_0x23ac95,_0x414ad4){return client[_0xdac4('0x11')](_0xba1141,_0x2a5605)[_0xdac4('0x12')](function(_0x47b5a8){logger[_0xdac4('0x13')](_0xdac4('0x14'),_0xfed4b9,_0xdac4('0x15'));logger[_0xdac4('0x16')](_0xdac4('0x17'),_0xfed4b9,'request\x20sent',JSON[_0xdac4('0x18')](_0x47b5a8));if(_0x47b5a8[_0xdac4('0x19')]){if(_0x47b5a8[_0xdac4('0x19')][_0xdac4('0x1a')]===0x1f4){logger[_0xdac4('0x19')](_0xdac4('0x14'),_0xfed4b9,_0x47b5a8[_0xdac4('0x19')][_0xdac4('0x1b')]);return _0x414ad4(_0x47b5a8[_0xdac4('0x19')][_0xdac4('0x1b')]);}logger[_0xdac4('0x19')](_0xdac4('0x14'),_0xfed4b9,_0x47b5a8[_0xdac4('0x19')][_0xdac4('0x1b')]);return _0x23ac95(_0x47b5a8[_0xdac4('0x19')][_0xdac4('0x1b')]);}else{logger[_0xdac4('0x13')](_0xdac4('0x14'),_0xfed4b9,_0xdac4('0x15'));_0x23ac95(_0x47b5a8['result'][_0xdac4('0x1b')]);}})[_0xdac4('0x1c')](function(_0x355ac5){logger[_0xdac4('0x19')]('UserNotification,\x20%s,\x20%s',_0xfed4b9,_0x355ac5);_0x414ad4(_0x355ac5);});});} \ No newline at end of file +var _0x754a=['client','http','redis','defaults','localhost','socket.io-emitter','register','info','debug','UserNotification,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','UserNotification,\x20%s,\x20%s','message','result','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x38c5e9,_0x3acbfc){var _0xeb2252=function(_0x1faeed){while(--_0x1faeed){_0x38c5e9['push'](_0x38c5e9['shift']());}};_0xeb2252(++_0x3acbfc);}(_0x754a,0x188));var _0xa754=function(_0x2fc012,_0x503e5b){_0x2fc012=_0x2fc012-0x0;var _0x2891f9=_0x754a[_0x2fc012];return _0x2891f9;};'use strict';var _=require('lodash');var util=require(_0xa754('0x0'));var moment=require('moment');var BPromise=require(_0xa754('0x1'));var rs=require(_0xa754('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa754('0x3'));var logger=require(_0xa754('0x4'))(_0xa754('0x5'));var config=require(_0xa754('0x6'));var jayson=require(_0xa754('0x7'));var client=jayson[_0xa754('0x8')][_0xa754('0x9')]({'port':0x232a});config[_0xa754('0xa')]=_[_0xa754('0xb')](config[_0xa754('0xa')],{'host':_0xa754('0xc'),'port':0x18eb});var socket=require(_0xa754('0xd'))(new Redis(config[_0xa754('0xa')]));require('./userNotification.socket')[_0xa754('0xe')](socket);function respondWithRpcPromise(_0xd46fbc,_0x120264,_0x32ed0d){return new BPromise(function(_0x417f44,_0x26b4eb){return client['request'](_0xd46fbc,_0x32ed0d)['then'](function(_0x20876e){logger[_0xa754('0xf')]('UserNotification,\x20%s,\x20%s',_0x120264,'request\x20sent');logger[_0xa754('0x10')](_0xa754('0x11'),_0x120264,_0xa754('0x12'),JSON[_0xa754('0x13')](_0x20876e));if(_0x20876e[_0xa754('0x14')]){if(_0x20876e['error'][_0xa754('0x15')]===0x1f4){logger[_0xa754('0x14')](_0xa754('0x16'),_0x120264,_0x20876e['error'][_0xa754('0x17')]);return _0x26b4eb(_0x20876e[_0xa754('0x14')][_0xa754('0x17')]);}logger[_0xa754('0x14')](_0xa754('0x16'),_0x120264,_0x20876e[_0xa754('0x14')][_0xa754('0x17')]);return _0x417f44(_0x20876e[_0xa754('0x14')][_0xa754('0x17')]);}else{logger[_0xa754('0xf')]('UserNotification,\x20%s,\x20%s',_0x120264,_0xa754('0x12'));_0x417f44(_0x20876e[_0xa754('0x18')][_0xa754('0x17')]);}})['catch'](function(_0x51dc39){logger[_0xa754('0x14')](_0xa754('0x16'),_0x120264,_0x51dc39);_0x26b4eb(_0x51dc39);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 49924bd..3a92097 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 _0xafda=['removeListener','register','userNotification:','./userNotification.events','save','remove','emit'];(function(_0x43a0a9,_0x567f0a){var _0x542777=function(_0x19580d){while(--_0x19580d){_0x43a0a9['push'](_0x43a0a9['shift']());}};_0x542777(++_0x567f0a);}(_0xafda,0x137));var _0xaafd=function(_0x2fd69d,_0xeb1037){_0x2fd69d=_0x2fd69d-0x0;var _0x5d5ef3=_0xafda[_0x2fd69d];return _0x5d5ef3;};'use strict';var UserNotificationEvents=require(_0xaafd('0x0'));var events=[_0xaafd('0x1'),_0xaafd('0x2'),'update'];function createListener(_0x98c38a,_0x3d9a39){return function(_0x5713c2){_0x3d9a39[_0xaafd('0x3')](_0x98c38a,_0x5713c2);};}function removeListener(_0x17bceb,_0x10b981){return function(){UserNotificationEvents[_0xaafd('0x4')](_0x17bceb,_0x10b981);};}exports[_0xaafd('0x5')]=function(_0x3d6d14){for(var _0x2742ed=0x0,_0x4c8b22=events['length'];_0x2742ed<_0x4c8b22;_0x2742ed++){var _0x26baa6=events[_0x2742ed];var _0x34810f=createListener(_0xaafd('0x6')+_0x26baa6,_0x3d6d14);UserNotificationEvents['on'](_0x26baa6,_0x34810f);}}; \ No newline at end of file +var _0x3d2a=['register','userNotification:','save','update','removeListener'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x3d2a,0xa2));var _0xa3d2=function(_0x16eb13,_0x3d592f){_0x16eb13=_0x16eb13-0x0;var _0x2b6230=_0x3d2a[_0x16eb13];return _0x2b6230;};'use strict';var UserNotificationEvents=require('./userNotification.events');var events=[_0xa3d2('0x0'),'remove',_0xa3d2('0x1')];function createListener(_0x296cac,_0xff5b6c){return function(_0x383723){_0xff5b6c['emit'](_0x296cac,_0x383723);};}function removeListener(_0x2c3c78,_0x1e6fad){return function(){UserNotificationEvents[_0xa3d2('0x2')](_0x2c3c78,_0x1e6fad);};}exports[_0xa3d2('0x3')]=function(_0x4625d8){for(var _0x57dd49=0x0,_0x547547=events['length'];_0x57dd49<_0x547547;_0x57dd49++){var _0x3ca794=events[_0x57dd49];var _0x1fed3e=createListener(_0xa3d2('0x4')+_0x3ca794,_0x4625d8);UserNotificationEvents['on'](_0x3ca794,_0x1fed3e);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index e48ae2f..2e3265b 100644 --- a/server/api/userOpenchannelQueue/index.js +++ b/server/api/userOpenchannelQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x30a86a,_0x20c777){var _0x569a62=function(_0x5287c4){while(--_0x5287c4){_0x30a86a['push'](_0x30a86a['shift']());}};_0x569a62(++_0x20c777);}(_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(_0x876e44,_0x2ca9cf){var _0x4bb8f2=function(_0x434d4c){while(--_0x434d4c){_0x876e44['push'](_0x876e44['shift']());}};_0x4bb8f2(++_0x2ca9cf);}(_0x70e0,0x17b));var _0x070e=function(_0x5b0cc9,_0x44d1b3){_0x5b0cc9=_0x5b0cc9-0x0;var _0x1c3d87=_0x70e0[_0x5b0cc9];return _0x1c3d87;};'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/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index b4fa0f1..5be3984 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 _0xce0a=['INTEGER'];(function(_0x55d7b0,_0x2a82dc){var _0x2a376c=function(_0x367662){while(--_0x367662){_0x55d7b0['push'](_0x55d7b0['shift']());}};_0x2a376c(++_0x2a82dc);}(_0xce0a,0xbb));var _0xace0=function(_0x21b762,_0xc8ef11){_0x21b762=_0x21b762-0x0;var _0x2ea6d4=_0xce0a[_0x21b762];return _0x2ea6d4;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0xace0('0x0')],'defaultValue':0x0}}; \ No newline at end of file +var _0x3d11=['INTEGER','exports'];(function(_0x345251,_0x338c8a){var _0x1aef6d=function(_0x2d7a8a){while(--_0x2d7a8a){_0x345251['push'](_0x345251['shift']());}};_0x1aef6d(++_0x338c8a);}(_0x3d11,0x18d));var _0x13d1=function(_0x4d00b4,_0x14b069){_0x4d00b4=_0x4d00b4-0x0;var _0x2bd12f=_0x3d11[_0x4d00b4];return _0x2bd12f;};'use strict';var Sequelize=require('sequelize');module[_0x13d1('0x0')]={'penalty':{'type':Sequelize[_0x13d1('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index 105f573..3bd6afb 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 _0x04f4=['request-promise','path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','util','../../config/logger'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0x04f4,0x184));var _0x404f=function(_0x2ea70e,_0x5bdf2c){_0x2ea70e=_0x2ea70e-0x0;var _0x995523=_0x04f4[_0x2ea70e];return _0x995523;};'use strict';var _=require('lodash');var util=require(_0x404f('0x0'));var logger=require(_0x404f('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x404f('0x2'));var fs=require('fs');var path=require(_0x404f('0x3'));var rimraf=require(_0x404f('0x4'));var config=require(_0x404f('0x5'));var attributes=require(_0x404f('0x6'));module[_0x404f('0x7')]=function(_0x58cadb,_0x36d5e0){return _0x58cadb[_0x404f('0x8')](_0x404f('0x9'),attributes,{'tableName':'user_has_openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x50ad=['rimraf','../../config/environment','./userOpenchannelQueue.attributes','define','UserOpenchannelQueue','user_has_openchannel_queues','util','api','bluebird','path'];(function(_0x6242a9,_0x5c3414){var _0x47b7b6=function(_0x3361c9){while(--_0x3361c9){_0x6242a9['push'](_0x6242a9['shift']());}};_0x47b7b6(++_0x5c3414);}(_0x50ad,0x6a));var _0xd50a=function(_0x3dc190,_0xa6c975){_0x3dc190=_0x3dc190-0x0;var _0x5bde76=_0x50ad[_0x3dc190];return _0x5bde76;};'use strict';var _=require('lodash');var util=require(_0xd50a('0x0'));var logger=require('../../config/logger')(_0xd50a('0x1'));var moment=require('moment');var BPromise=require(_0xd50a('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd50a('0x3'));var rimraf=require(_0xd50a('0x4'));var config=require(_0xd50a('0x5'));var attributes=require(_0xd50a('0x6'));module['exports']=function(_0x400e39,_0x57082e){return _0x400e39[_0xd50a('0x7')](_0xd50a('0x8'),attributes,{'tableName':_0xd50a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index d91fd36..558db60 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 _0x2d87=['stringify','error','message','request\x20sent','catch','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2d87,0x9d));var _0x72d8=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x2d87[_0x4154a6];return _0x3b2786;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x72d8('0x0'));var BPromise=require(_0x72d8('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x72d8('0x2'))['db'];var utils=require(_0x72d8('0x3'));var logger=require(_0x72d8('0x4'))(_0x72d8('0x5'));var config=require(_0x72d8('0x6'));var jayson=require(_0x72d8('0x7'));var client=jayson[_0x72d8('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x53cceb,_0x1cd0a6,_0x233d2f){return new BPromise(function(_0x4f373f,_0x101dbf){return client[_0x72d8('0x9')](_0x53cceb,_0x233d2f)[_0x72d8('0xa')](function(_0xb8eb2e){logger[_0x72d8('0xb')](_0x72d8('0xc'),_0x1cd0a6,'request\x20sent');logger['debug'](_0x72d8('0xd'),_0x1cd0a6,'request\x20sent',JSON[_0x72d8('0xe')](_0xb8eb2e));if(_0xb8eb2e[_0x72d8('0xf')]){if(_0xb8eb2e[_0x72d8('0xf')]['code']===0x1f4){logger[_0x72d8('0xf')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x1cd0a6,_0xb8eb2e[_0x72d8('0xf')][_0x72d8('0x10')]);return _0x101dbf(_0xb8eb2e[_0x72d8('0xf')]['message']);}logger['error'](_0x72d8('0xc'),_0x1cd0a6,_0xb8eb2e[_0x72d8('0xf')]['message']);return _0x4f373f(_0xb8eb2e[_0x72d8('0xf')][_0x72d8('0x10')]);}else{logger[_0x72d8('0xb')](_0x72d8('0xc'),_0x1cd0a6,_0x72d8('0x11'));_0x4f373f(_0xb8eb2e['result'][_0x72d8('0x10')]);}})[_0x72d8('0x12')](function(_0x38c767){logger[_0x72d8('0xf')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x1cd0a6,_0x38c767);_0x101dbf(_0x38c767);});});} \ No newline at end of file +var _0xd293=['moment','bluebird','randomstring','../../config/logger','rpc','jayson/promise','client','http','request','info','request\x20sent','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','UserOpenchannelQueue,\x20%s,\x20%s','result','catch','lodash','util'];(function(_0x5eb753,_0x54216b){var _0x236af3=function(_0x290275){while(--_0x290275){_0x5eb753['push'](_0x5eb753['shift']());}};_0x236af3(++_0x54216b);}(_0xd293,0x139));var _0x3d29=function(_0x2a1958,_0x1fa6e0){_0x2a1958=_0x2a1958-0x0;var _0x3ea7ef=_0xd293[_0x2a1958];return _0x3ea7ef;};'use strict';var _=require(_0x3d29('0x0'));var util=require(_0x3d29('0x1'));var moment=require(_0x3d29('0x2'));var BPromise=require(_0x3d29('0x3'));var rs=require(_0x3d29('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3d29('0x5'))(_0x3d29('0x6'));var config=require('../../config/environment');var jayson=require(_0x3d29('0x7'));var client=jayson[_0x3d29('0x8')][_0x3d29('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x16f7e4,_0x591cb5,_0x124d34){return new BPromise(function(_0x3c408d,_0x4c5f1e){return client[_0x3d29('0xa')](_0x16f7e4,_0x124d34)['then'](function(_0x424fe8){logger[_0x3d29('0xb')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x591cb5,_0x3d29('0xc'));logger['debug'](_0x3d29('0xd'),_0x591cb5,_0x3d29('0xc'),JSON[_0x3d29('0xe')](_0x424fe8));if(_0x424fe8[_0x3d29('0xf')]){if(_0x424fe8[_0x3d29('0xf')][_0x3d29('0x10')]===0x1f4){logger[_0x3d29('0xf')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x591cb5,_0x424fe8[_0x3d29('0xf')][_0x3d29('0x11')]);return _0x4c5f1e(_0x424fe8[_0x3d29('0xf')][_0x3d29('0x11')]);}logger['error'](_0x3d29('0x12'),_0x591cb5,_0x424fe8['error']['message']);return _0x3c408d(_0x424fe8[_0x3d29('0xf')][_0x3d29('0x11')]);}else{logger['info'](_0x3d29('0x12'),_0x591cb5,_0x3d29('0xc'));_0x3c408d(_0x424fe8[_0x3d29('0x13')][_0x3d29('0x11')]);}})[_0x3d29('0x14')](function(_0x3974ce){logger[_0x3d29('0xf')](_0x3d29('0x12'),_0x591cb5,_0x3974ce);_0x4c5f1e(_0x3974ce);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index bc8600d..51b5775 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 _0x7a04=['create','/:id/clone','addSections','put','delete','destroy','removeSections','removeResources','multer','util','path','express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','getSections','/:id/resources','getResources','post'];(function(_0x4e3e0c,_0x325357){var _0x456035=function(_0x387c97){while(--_0x387c97){_0x4e3e0c['push'](_0x4e3e0c['shift']());}};_0x456035(++_0x325357);}(_0x7a04,0x18e));var _0x47a0=function(_0x3e0058,_0xcb5844){_0x3e0058=_0x3e0058-0x0;var _0x307c16=_0x7a04[_0x3e0058];return _0x307c16;};'use strict';var multer=require(_0x47a0('0x0'));var util=require(_0x47a0('0x1'));var path=require(_0x47a0('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a0('0x3'));var router=express['Router']();var fs_extra=require(_0x47a0('0x4'));var auth=require(_0x47a0('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x47a0('0x6'));var controller=require('./userProfile.controller');router[_0x47a0('0x7')]('/',auth[_0x47a0('0x8')](),controller[_0x47a0('0x9')]);router['get'](_0x47a0('0xa'),auth['isAuthenticated'](),controller[_0x47a0('0xb')]);router[_0x47a0('0x7')](_0x47a0('0xc'),auth[_0x47a0('0x8')](),controller[_0x47a0('0xd')]);router[_0x47a0('0x7')]('/:id/sections',auth['isAuthenticated'](),controller[_0x47a0('0xe')]);router[_0x47a0('0x7')](_0x47a0('0xf'),auth[_0x47a0('0x8')](),controller[_0x47a0('0x10')]);router[_0x47a0('0x11')]('/',auth[_0x47a0('0x8')](),controller[_0x47a0('0x12')]);router[_0x47a0('0x11')](_0x47a0('0x13'),auth['isAuthenticated'](),controller['clone']);router[_0x47a0('0x11')]('/:id/sections',auth[_0x47a0('0x8')](),controller[_0x47a0('0x14')]);router['post'](_0x47a0('0xf'),auth[_0x47a0('0x8')](),controller['addResources']);router[_0x47a0('0x15')](_0x47a0('0xc'),auth[_0x47a0('0x8')](),controller['update']);router[_0x47a0('0x16')](_0x47a0('0xc'),auth[_0x47a0('0x8')](),controller[_0x47a0('0x17')]);router[_0x47a0('0x16')]('/:id/sections',auth[_0x47a0('0x8')](),controller[_0x47a0('0x18')]);router[_0x47a0('0x16')](_0x47a0('0xf'),auth[_0x47a0('0x8')](),controller[_0x47a0('0x19')]);module['exports']=router; \ No newline at end of file +var _0x41f4=['describe','show','getSections','/:id/resources','getResources','post','create','/:id/clone','clone','addSections','put','delete','/:id','destroy','/:id/sections','removeSections','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./userProfile.controller','get','isAuthenticated'];(function(_0x4bd807,_0x409c9e){var _0x29fdfe=function(_0x268ee7){while(--_0x268ee7){_0x4bd807['push'](_0x4bd807['shift']());}};_0x29fdfe(++_0x409c9e);}(_0x41f4,0xa2));var _0x441f=function(_0x24d02c,_0x56d13d){_0x24d02c=_0x24d02c-0x0;var _0x3ffb55=_0x41f4[_0x24d02c];return _0x3ffb55;};'use strict';var multer=require(_0x441f('0x0'));var util=require(_0x441f('0x1'));var path=require(_0x441f('0x2'));var timeout=require(_0x441f('0x3'));var express=require(_0x441f('0x4'));var router=express[_0x441f('0x5')]();var fs_extra=require(_0x441f('0x6'));var auth=require(_0x441f('0x7'));var interaction=require(_0x441f('0x8'));var config=require('../../config/environment');var controller=require(_0x441f('0x9'));router[_0x441f('0xa')]('/',auth[_0x441f('0xb')](),controller['index']);router[_0x441f('0xa')]('/describe',auth[_0x441f('0xb')](),controller[_0x441f('0xc')]);router[_0x441f('0xa')]('/:id',auth[_0x441f('0xb')](),controller[_0x441f('0xd')]);router['get']('/:id/sections',auth['isAuthenticated'](),controller[_0x441f('0xe')]);router['get'](_0x441f('0xf'),auth[_0x441f('0xb')](),controller[_0x441f('0x10')]);router[_0x441f('0x11')]('/',auth['isAuthenticated'](),controller[_0x441f('0x12')]);router['post'](_0x441f('0x13'),auth['isAuthenticated'](),controller[_0x441f('0x14')]);router['post']('/:id/sections',auth[_0x441f('0xb')](),controller[_0x441f('0x15')]);router[_0x441f('0x11')](_0x441f('0xf'),auth[_0x441f('0xb')](),controller['addResources']);router[_0x441f('0x16')]('/:id',auth[_0x441f('0xb')](),controller['update']);router[_0x441f('0x17')](_0x441f('0x18'),auth[_0x441f('0xb')](),controller[_0x441f('0x19')]);router[_0x441f('0x17')](_0x441f('0x1a'),auth['isAuthenticated'](),controller[_0x441f('0x1b')]);router[_0x441f('0x17')](_0x441f('0xf'),auth[_0x441f('0xb')](),controller['removeResources']);module[_0x441f('0x1c')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 8705a3b..e767a2e 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 _0x8d91=['name','setDataValue','crudPermissions','join','getDataValue','split','BOOLEAN','sequelize','exports','STRING'];(function(_0xb1b050,_0x12a1f9){var _0x384156=function(_0x2eae35){while(--_0x2eae35){_0xb1b050['push'](_0xb1b050['shift']());}};_0x384156(++_0x12a1f9);}(_0x8d91,0x129));var _0x18d9=function(_0x116f70,_0x4e5db8){_0x116f70=_0x116f70-0x0;var _0x24181b=_0x8d91[_0x116f70];return _0x24181b;};'use strict';var Sequelize=require(_0x18d9('0x0'));module[_0x18d9('0x1')]={'name':{'type':Sequelize[_0x18d9('0x2')],'allowNull':![],'unique':_0x18d9('0x3')},'crudPermissions':{'type':Sequelize[_0x18d9('0x2')],'set':function(_0x46eca1){this[_0x18d9('0x4')](_0x18d9('0x5'),_0x46eca1?_0x46eca1[_0x18d9('0x6')](''):[]);},'get':function(){return this[_0x18d9('0x7')]('crudPermissions')?this[_0x18d9('0x7')](_0x18d9('0x5'))[_0x18d9('0x8')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x18d9('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x18d9('0x9')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x18d9('0x9')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x18d9('0x9')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x18d9('0x9')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x18d9('0x9')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x18d9('0x9')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x18d9('0x9')],'defaultValue':!![]}}; \ No newline at end of file +var _0x6119=['setDataValue','crudPermissions','join','getDataValue','BOOLEAN','exports','STRING'];(function(_0x5c5e98,_0x1557c5){var _0x5d40d6=function(_0xf4414a){while(--_0xf4414a){_0x5c5e98['push'](_0x5c5e98['shift']());}};_0x5d40d6(++_0x1557c5);}(_0x6119,0x1b0));var _0x9611=function(_0x1c3e7a,_0x400412){_0x1c3e7a=_0x1c3e7a-0x0;var _0x5c3343=_0x6119[_0x1c3e7a];return _0x5c3343;};'use strict';var Sequelize=require('sequelize');module[_0x9611('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize[_0x9611('0x1')],'set':function(_0x209387){this[_0x9611('0x2')](_0x9611('0x3'),_0x209387?_0x209387[_0x9611('0x4')](''):[]);},'get':function(){return this[_0x9611('0x5')](_0x9611('0x3'))?this[_0x9611('0x5')]('crudPermissions')['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x9611('0x1')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x9611('0x6')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x9611('0x6')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x9611('0x6')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x9611('0x6')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x9611('0x6')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x9611('0x6')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x9611('0x6')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 4b9ed0b..f26abd3 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 _0x2fa8=['defaults','redis','localhost','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','map','UserProfile','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','show','params','find','catch','create','clone','get','omit','createdAt','updatedAt','crudPermissions','body','sequelize','transaction','UserProfileSection','each','autoAssociation','sectionId','userProfileId','Resources','UserProfileResource','describe','push','ids','getSections','includes','subsections','concat','enabled','findOne','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','getResources','Missing\x20section\x20parameter','hasOwnProperty','No\x20User\x20Profile\x20found\x20for\x20id\x20','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0x2fa8,0x1af));var _0x82fa=function(_0x4a931e,_0x251191){_0x4a931e=_0x4a931e-0x0;var _0x571309=_0x2fa8[_0x4a931e];return _0x571309;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x82fa('0x0'));var zipdir=require(_0x82fa('0x1'));var jsonpatch=require(_0x82fa('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x82fa('0x3'));var Mustache=require(_0x82fa('0x4'));var util=require(_0x82fa('0x5'));var path=require(_0x82fa('0x6'));var sox=require('sox');var csv=require(_0x82fa('0x7'));var ejs=require(_0x82fa('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x82fa('0x9'));var squel=require(_0x82fa('0xa'));var crypto=require('crypto');var jsforce=require(_0x82fa('0xb'));var deskjs=require(_0x82fa('0xc'));var toCsv=require(_0x82fa('0x7'));var querystring=require(_0x82fa('0xd'));var Papa=require(_0x82fa('0xe'));var Redis=require(_0x82fa('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x82fa('0x10'));var as=require(_0x82fa('0x11'));var hardwareService=require(_0x82fa('0x12'));var logger=require(_0x82fa('0x13'))(_0x82fa('0x14'));var utils=require(_0x82fa('0x15'));var config=require(_0x82fa('0x16'));var licenseUtil=require(_0x82fa('0x17'));var db=require(_0x82fa('0x18'))['db'];config['redis']=_[_0x82fa('0x19')](config[_0x82fa('0x1a')],{'host':_0x82fa('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./userProfile.socket')['register'](socket);function respondWithStatusCode(_0x158880,_0x23d785){_0x23d785=_0x23d785||0xcc;return function(_0x8700){if(_0x8700){return _0x158880['sendStatus'](_0x23d785);}return _0x158880[_0x82fa('0x1c')](_0x23d785)[_0x82fa('0x1d')]();};}function respondWithResult(_0x31976a,_0xc82039){_0xc82039=_0xc82039||0xc8;return function(_0x4a5129){if(_0x4a5129){return _0x31976a['status'](_0xc82039)['json'](_0x4a5129);}};}function respondWithFilteredResult(_0x53bc86,_0x23c0b6){return function(_0x477a7e){if(_0x477a7e){var _0x38c61f=typeof _0x23c0b6[_0x82fa('0x1e')]===_0x82fa('0x1f')&&typeof _0x23c0b6[_0x82fa('0x20')]===_0x82fa('0x1f');var _0x4b701e=_0x477a7e[_0x82fa('0x21')];var _0x135916=_0x38c61f?0x0:_0x23c0b6[_0x82fa('0x1e')];var _0x50725e=_0x38c61f?_0x477a7e['count']:_0x23c0b6['offset']+_0x23c0b6[_0x82fa('0x20')];var _0x1e45d6;if(_0x50725e>=_0x4b701e){_0x50725e=_0x4b701e;_0x1e45d6=0xc8;}else{_0x1e45d6=0xce;}_0x53bc86[_0x82fa('0x1c')](_0x1e45d6);return _0x53bc86[_0x82fa('0x22')](_0x82fa('0x23'),_0x135916+'-'+_0x50725e+'/'+_0x4b701e)[_0x82fa('0x24')](_0x477a7e);}return null;};}function patchUpdates(_0x192990){return function(_0x523139){try{jsonpatch[_0x82fa('0x25')](_0x523139,_0x192990,!![]);}catch(_0x374ba1){return BPromise[_0x82fa('0x26')](_0x374ba1);}return _0x523139[_0x82fa('0x27')]();};}function saveUpdates(_0x2cdff1,_0xe38ef1){return function(_0x10fa84){if(_0x10fa84){return _0x10fa84[_0x82fa('0x28')](_0x2cdff1)[_0x82fa('0x29')](function(_0x2ce1de){return _0x2ce1de;});}return null;};}function removeEntity(_0x7e0283,_0x31d51e){return function(_0x2795aa){if(_0x2795aa){return _0x2795aa[_0x82fa('0x2a')]()[_0x82fa('0x29')](function(){_0x7e0283[_0x82fa('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x219874,_0x37f08b){return function(_0x582eb7){if(!_0x582eb7){_0x219874[_0x82fa('0x2b')](0x194);}return _0x582eb7;};}function handleError(_0x3fc2b4,_0x4af464){_0x4af464=_0x4af464||0x1f4;return function(_0x37f1f3){logger['error'](_0x37f1f3[_0x82fa('0x2c')]);if(_0x37f1f3['name']){delete _0x37f1f3[_0x82fa('0x2d')];}_0x3fc2b4[_0x82fa('0x1c')](_0x4af464)[_0x82fa('0x2e')](_0x37f1f3);};}exports[_0x82fa('0x2f')]=function(_0x4228fe,_0x102d79){var _0x3ecc60={},_0x2c9e3d={},_0x24b8bb={'count':0x0,'rows':[]};var _0x29d151=_[_0x82fa('0x30')](db[_0x82fa('0x31')][_0x82fa('0x32')],function(_0xfc7cec){return{'name':_0xfc7cec[_0x82fa('0x33')],'type':_0xfc7cec[_0x82fa('0x34')][_0x82fa('0x35')]};});_0x2c9e3d['model']=_[_0x82fa('0x30')](_0x29d151,_0x82fa('0x2d'));_0x2c9e3d[_0x82fa('0x36')]=_[_0x82fa('0x37')](_0x4228fe['query']);_0x2c9e3d[_0x82fa('0x38')]=_[_0x82fa('0x39')](_0x2c9e3d['model'],_0x2c9e3d[_0x82fa('0x36')]);_0x3ecc60[_0x82fa('0x3a')]=_[_0x82fa('0x39')](_0x2c9e3d[_0x82fa('0x3b')],qs['fields'](_0x4228fe[_0x82fa('0x36')][_0x82fa('0x3c')]));_0x3ecc60[_0x82fa('0x3a')]=_0x3ecc60[_0x82fa('0x3a')][_0x82fa('0x3d')]?_0x3ecc60[_0x82fa('0x3a')]:_0x2c9e3d[_0x82fa('0x3b')];if(!_0x4228fe[_0x82fa('0x36')]['hasOwnProperty'](_0x82fa('0x3e'))){_0x3ecc60[_0x82fa('0x20')]=qs[_0x82fa('0x20')](_0x4228fe[_0x82fa('0x36')][_0x82fa('0x20')]);_0x3ecc60[_0x82fa('0x1e')]=qs[_0x82fa('0x1e')](_0x4228fe[_0x82fa('0x36')][_0x82fa('0x1e')]);}_0x3ecc60[_0x82fa('0x3f')]=qs[_0x82fa('0x40')](_0x4228fe[_0x82fa('0x36')][_0x82fa('0x40')]);_0x3ecc60['where']=qs[_0x82fa('0x38')](_[_0x82fa('0x41')](_0x4228fe['query'],_0x2c9e3d['filters']),_0x29d151);if(_0x4228fe[_0x82fa('0x36')][_0x82fa('0x42')]){_0x3ecc60[_0x82fa('0x43')]=_[_0x82fa('0x44')](_0x3ecc60[_0x82fa('0x43')],{'$or':_[_0x82fa('0x30')](_0x29d151,function(_0x3fe8df){if(_0x3fe8df['type']!==_0x82fa('0x45')){var _0xa0cdf2={};_0xa0cdf2[_0x3fe8df[_0x82fa('0x2d')]]={'$like':'%'+_0x4228fe[_0x82fa('0x36')][_0x82fa('0x42')]+'%'};return _0xa0cdf2;}})});}_0x3ecc60=_[_0x82fa('0x44')]({},_0x3ecc60,_0x4228fe[_0x82fa('0x46')]);var _0x11b4d1={'where':_0x3ecc60['where']};return db[_0x82fa('0x31')]['count'](_0x11b4d1)['then'](function(_0x547fdd){_0x24b8bb[_0x82fa('0x21')]=_0x547fdd;if(_0x4228fe[_0x82fa('0x36')][_0x82fa('0x47')]){_0x3ecc60[_0x82fa('0x48')]=[{'all':!![]}];}return db['UserProfile'][_0x82fa('0x49')](_0x3ecc60);})[_0x82fa('0x29')](function(_0x207448){_0x24b8bb['rows']=_0x207448;return _0x24b8bb;})[_0x82fa('0x29')](respondWithFilteredResult(_0x102d79,_0x3ecc60))['catch'](handleError(_0x102d79,null));};exports[_0x82fa('0x4a')]=function(_0x1cffa0,_0x58b40c){var _0x5cc7a6={'raw':![],'where':{'id':_0x1cffa0[_0x82fa('0x4b')]['id']}},_0x568153={};_0x568153[_0x82fa('0x3b')]=_[_0x82fa('0x37')](db[_0x82fa('0x31')]['rawAttributes']);_0x568153[_0x82fa('0x36')]=_['keys'](_0x1cffa0[_0x82fa('0x36')]);_0x568153['filters']=_['intersection'](_0x568153[_0x82fa('0x3b')],_0x568153[_0x82fa('0x36')]);_0x5cc7a6[_0x82fa('0x3a')]=_[_0x82fa('0x39')](_0x568153[_0x82fa('0x3b')],qs[_0x82fa('0x3c')](_0x1cffa0[_0x82fa('0x36')][_0x82fa('0x3c')]));_0x5cc7a6[_0x82fa('0x3a')]=_0x5cc7a6['attributes']['length']?_0x5cc7a6[_0x82fa('0x3a')]:_0x568153['model'];if(_0x1cffa0[_0x82fa('0x36')][_0x82fa('0x47')]){_0x5cc7a6[_0x82fa('0x48')]=[{'all':!![]}];}_0x5cc7a6=_[_0x82fa('0x44')]({},_0x5cc7a6,_0x1cffa0[_0x82fa('0x46')]);return db['UserProfile'][_0x82fa('0x4c')](_0x5cc7a6)[_0x82fa('0x29')](handleEntityNotFound(_0x58b40c,null))[_0x82fa('0x29')](respondWithResult(_0x58b40c,null))[_0x82fa('0x4d')](handleError(_0x58b40c,null));};exports[_0x82fa('0x4e')]=function(_0x598adc,_0x1ed162){return db[_0x82fa('0x31')][_0x82fa('0x4e')](_0x598adc['body'],{})[_0x82fa('0x29')](respondWithResult(_0x1ed162,0xc9))[_0x82fa('0x4d')](handleError(_0x1ed162,null));};exports[_0x82fa('0x4f')]=function(_0x393c3b,_0x2c074d){var _0x2b899c={'where':{'id':_0x393c3b[_0x82fa('0x4b')]['id']}},_0x4b04b0={};_0x4b04b0[_0x82fa('0x3b')]=_['keys'](db['UserProfile'][_0x82fa('0x32')]);_0x2b899c[_0x82fa('0x3a')]=_['intersection'](_0x4b04b0['model'],qs[_0x82fa('0x3c')](_0x393c3b[_0x82fa('0x36')][_0x82fa('0x3c')]));_0x2b899c[_0x82fa('0x3a')]=_0x2b899c[_0x82fa('0x3a')][_0x82fa('0x3d')]?_0x2b899c[_0x82fa('0x3a')]:_0x4b04b0[_0x82fa('0x3b')];if(_0x393c3b[_0x82fa('0x36')]['includeAll']){_0x2b899c[_0x82fa('0x48')]=[{'all':!![]}];}_0x2b899c=_['merge']({},_0x2b899c,_0x393c3b[_0x82fa('0x46')]);return db[_0x82fa('0x31')]['find'](_0x2b899c)['then'](handleEntityNotFound(_0x2c074d,null))[_0x82fa('0x29')](function(_0x20739a){if(_0x20739a){var _0x85e5f3=_0x20739a[_0x82fa('0x50')]({'plain':!![]});_0x85e5f3=qs[_0x82fa('0x51')](_0x85e5f3,['id',_0x82fa('0x52'),_0x82fa('0x53'),_0x82fa('0x54')]);_0x393c3b[_0x82fa('0x55')]=_[_0x82fa('0x51')](_0x393c3b[_0x82fa('0x55')],['id','createdAt',_0x82fa('0x53')]);return db[_0x82fa('0x56')][_0x82fa('0x57')](function(_0x44d570){return db[_0x82fa('0x31')]['create'](_['merge'](_0x85e5f3,_0x393c3b[_0x82fa('0x55')]),{'include':_0x393c3b[_0x82fa('0x36')][_0x82fa('0x47')]?[{'all':!![]}]:undefined,'transaction':_0x44d570})[_0x82fa('0x29')](function(_0x274dcf){var _0x20bc5c=_0x274dcf[_0x82fa('0x50')]({'plain':!![]});return db[_0x82fa('0x58')][_0x82fa('0x49')]({'where':{'userProfileId':_0x393c3b[_0x82fa('0x4b')]['id']},'raw':!![]})[_0x82fa('0x29')](function(_0xe52e94){if(_0xe52e94){return BPromise[_0x82fa('0x59')](_0xe52e94,function(_0x4e72de){return new BPromise(function(_0x115556,_0x400d7a){if(_0x4e72de[_0x82fa('0x5a')]===null||_0x4e72de[_0x82fa('0x5a')]===0x1)_0x115556(null);return db['UserProfileResource'][_0x82fa('0x49')]({'where':{'sectionId':_0x4e72de['id']},'raw':!![]})[_0x82fa('0x29')](function(_0xde5f73){var _0x1a9c48=_['map'](_0xde5f73,function(_0x58610d){return qs[_0x82fa('0x51')](_0x58610d,['id',_0x82fa('0x52'),_0x82fa('0x53'),_0x82fa('0x5b')]);});_0x115556(_0x1a9c48);})['catch'](function(_0x5c3874){_0x400d7a(_0x5c3874);});})[_0x82fa('0x29')](function(_0x55359c){var _0x2c9a81=qs[_0x82fa('0x51')](_0x4e72de,['id',_0x82fa('0x52'),_0x82fa('0x53')]);_0x2c9a81[_0x82fa('0x5c')]=_0x20bc5c['id'];if(_0x55359c)_0x2c9a81[_0x82fa('0x5d')]=_0x55359c;return _0x2c9a81;})[_0x82fa('0x29')](function(_0x575cac){return db['UserProfileSection'][_0x82fa('0x4e')](_0x575cac,{'include':[{'model':db[_0x82fa('0x5e')],'as':_0x82fa('0x5d')}],'raw':!![],'transaction':_0x44d570});});})['then'](function(){return _0x20bc5c;});}});});});}})['then'](respondWithResult(_0x2c074d,0xc9))['catch'](handleError(_0x2c074d,null));};exports[_0x82fa('0x28')]=function(_0x1be194,_0x1742ca){if(_0x1be194['body']['id']){delete _0x1be194['body']['id'];}return db[_0x82fa('0x31')][_0x82fa('0x4c')]({'where':{'id':_0x1be194[_0x82fa('0x4b')]['id']}})[_0x82fa('0x29')](handleEntityNotFound(_0x1742ca,null))[_0x82fa('0x29')](saveUpdates(_0x1be194[_0x82fa('0x55')],null))['then'](respondWithResult(_0x1742ca,null))[_0x82fa('0x4d')](handleError(_0x1742ca,null));};exports['destroy']=function(_0x54ca18,_0x32bbb0){return db[_0x82fa('0x31')][_0x82fa('0x4c')]({'where':{'id':_0x54ca18[_0x82fa('0x4b')]['id']}})[_0x82fa('0x29')](handleEntityNotFound(_0x32bbb0,null))[_0x82fa('0x29')](removeEntity(_0x32bbb0,null))['catch'](handleError(_0x32bbb0,null));};exports[_0x82fa('0x5f')]=function(_0x5354c5,_0x2d4dc5){return db[_0x82fa('0x31')]['describe']()[_0x82fa('0x29')](respondWithResult(_0x2d4dc5,null))[_0x82fa('0x4d')](handleError(_0x2d4dc5,null));};exports['addSections']=function(_0x39ea85,_0x5979cb){var _0x3f9491=_0x39ea85['body'];return db[_0x82fa('0x31')][_0x82fa('0x4c')]({'where':{'id':_0x39ea85[_0x82fa('0x4b')]['id']}})[_0x82fa('0x29')](handleEntityNotFound(_0x5979cb,null))[_0x82fa('0x29')](function(_0x3e0c8a){if(_0x3e0c8a){return db[_0x82fa('0x56')][_0x82fa('0x57')](function(_0x4fbfe5){return db[_0x82fa('0x58')][_0x82fa('0x2a')]({'where':{'userProfileId':_0x39ea85[_0x82fa('0x4b')]['id'],'sectionId':_[_0x82fa('0x30')](_0x3f9491,function(_0x3427fe){return _0x3427fe[_0x82fa('0x5b')];})},'transaction':_0x4fbfe5})['then'](function(){var _0x5b4f30=_[_0x82fa('0x30')](_0x3f9491,function(_0x4aa84b){_0x4aa84b[_0x82fa('0x5c')]=_0x39ea85[_0x82fa('0x4b')]['id'];return _0x4aa84b;});var _0x320c34=[];return BPromise[_0x82fa('0x59')](_0x5b4f30,function(_0x4c344b){return db[_0x82fa('0x58')]['create'](_0x4c344b,{'include':[{'model':db[_0x82fa('0x5e')],'as':_0x82fa('0x5d')}],'raw':!![],'transaction':_0x4fbfe5})['then'](function(_0x1f5ed8){_0x320c34[_0x82fa('0x60')](_0x1f5ed8[_0x82fa('0x50')]({'plain':!![]}));});})[_0x82fa('0x29')](function(){return _0x320c34;});});});}})[_0x82fa('0x29')](function(_0x5a7f2e){return _0x5a7f2e;})['then'](respondWithResult(_0x5979cb,null))['catch'](handleError(_0x5979cb,null));};exports['removeSections']=function(_0x13f8a7,_0x578c1c){var _0x176fff;return db[_0x82fa('0x31')][_0x82fa('0x4c')]({'where':{'id':_0x13f8a7[_0x82fa('0x4b')]['id']},'attributes':['id',_0x82fa('0x2d')]})[_0x82fa('0x29')](handleEntityNotFound(_0x578c1c,null))[_0x82fa('0x29')](function(_0x3b1524){if(_0x3b1524){_0x176fff=_0x3b1524;return db[_0x82fa('0x58')][_0x82fa('0x2a')]({'where':{'userProfileId':_0x13f8a7[_0x82fa('0x4b')]['id'],'sectionId':_0x13f8a7['query'][_0x82fa('0x61')]}});}})['then'](function(){return _0x176fff;})[_0x82fa('0x29')](respondWithStatusCode(_0x578c1c,null))[_0x82fa('0x4d')](handleError(_0x578c1c,null));};exports[_0x82fa('0x62')]=function(_0x32aa0b,_0x4e55c4){var _0x4cfe5f=[];var _0x1fe45c=[];return db['UserProfileSection'][_0x82fa('0x49')]({'where':{'userProfileId':_0x32aa0b[_0x82fa('0x4b')]['id']},'raw':!![]})[_0x82fa('0x29')](function(_0x497b66){_0x4cfe5f=_[_0x82fa('0x42')](_0x497b66,function(_0x13ab3d){return _0x13ab3d['enabled']===0x1||_[_0x82fa('0x63')]([0x3eb,0x709],_0x13ab3d[_0x82fa('0x5b')]);});if(!_['isEmpty'](_0x4cfe5f)){return _[_0x82fa('0x30')](_0x4cfe5f,function(_0x21b223){return _0x21b223[_0x82fa('0x5b')];});}else{return;}})['then'](function(_0x283682){if(_0x283682)_0x1fe45c=_0x283682;if(_[_0x82fa('0x63')](_0x1fe45c,0x64)){var _0x4e1024=_[_0x82fa('0x4c')](_0x4cfe5f,{'sectionId':0x64});return hasDefaultDashboard(_0x4e1024)[_0x82fa('0x29')](function(_0x45698c){return _[_0x82fa('0x30')](_0x4cfe5f,function(_0x52ac7b){if(_0x52ac7b['sectionId']===0x64){_0x52ac7b[_0x82fa('0x64')]=_0x45698c;}return _0x52ac7b;});});}else{return;}})[_0x82fa('0x29')](function(_0x879092){if(_0x879092)_0x4cfe5f=_0x879092;if(_[_0x82fa('0x63')](_0x1fe45c,0x3eb)){var _0x1cd886=_[_0x82fa('0x4c')](_0x4cfe5f,{'sectionId':0x3eb});return getCustomDashboards(_0x1cd886)[_0x82fa('0x29')](function(_0x448e91){return _['map'](_0x4cfe5f,function(_0x2acbc7){if(_0x1cd886['enabled']){if(_0x2acbc7[_0x82fa('0x5b')]===0x3eb){_0x2acbc7[_0x82fa('0x64')]=_0x448e91;}}else{if(_0x2acbc7['sectionId']===0x64){if(!_0x2acbc7[_0x82fa('0x64')]){_0x2acbc7[_0x82fa('0x64')]=[];}_0x2acbc7[_0x82fa('0x64')]=_0x2acbc7['subsections'][_0x82fa('0x65')](_0x448e91);}}return _0x2acbc7;});});}else{return;}})['then'](function(_0x224fa9){if(_0x224fa9)_0x4cfe5f=_0x224fa9;if(_['includes'](_0x1fe45c,0x709)){var _0x4128d5=_['find'](_0x4cfe5f,{'sectionId':0x709});return getPlugins(_0x4128d5)[_0x82fa('0x29')](function(_0x45cd79){if(_0x4128d5[_0x82fa('0x66')]){return _[_0x82fa('0x30')](_0x4cfe5f,function(_0x10d8b0){if(_0x10d8b0[_0x82fa('0x5b')]===0x709){_0x10d8b0['subsections']=_0x45cd79;}return _0x10d8b0;});}else{var _0x8a4cc4={'sectionId':0x76c,'enabled':0x1,'subsections':_0x45cd79};var _0x5f1633=_[_0x82fa('0x30')](_0x4cfe5f);_0x5f1633['push'](_0x8a4cc4);return _0x5f1633;}});}else{return;}})[_0x82fa('0x29')](function(_0x3acbaf){if(_0x3acbaf)_0x4cfe5f=_0x3acbaf;return _[_0x82fa('0x42')](_0x4cfe5f,[_0x82fa('0x66'),0x1]);})[_0x82fa('0x29')](respondWithResult(_0x4e55c4,null))[_0x82fa('0x4d')](handleError(_0x4e55c4,null));};function hasDefaultDashboard(_0x2c3b1f){var _0x44f0a0=[0x65];return new BPromise(function(_0x3e82a5,_0x34e931){try{if(_0x2c3b1f[_0x82fa('0x5a')]){_0x3e82a5(_0x44f0a0);}else{return db[_0x82fa('0x5e')][_0x82fa('0x67')]({'where':{'sectionId':_0x2c3b1f['id']},'raw':!![]})[_0x82fa('0x29')](function(_0x2e5935){_0x2e5935?_0x3e82a5(_0x44f0a0):_0x3e82a5();});}}catch(_0x3ed3a2){_0x34e931(_0x3ed3a2);}});}function getCustomDashboards(_0xa2b0ff){var _0x5e603a=[];return new BPromise(function(_0x42eeeb,_0x3b1269){try{if(_0xa2b0ff[_0x82fa('0x5a')]){return db['Dashboard'][_0x82fa('0x49')]({'raw':!![]})[_0x82fa('0x29')](function(_0x2af717){_0x2af717[_0x82fa('0x68')](function(_0x20093e){_0x5e603a[_0x82fa('0x60')](_0x20093e['id']+0x1869f);});_0x42eeeb(_0x5e603a);});}else{return db[_0x82fa('0x5e')][_0x82fa('0x49')]({'where':{'sectionId':_0xa2b0ff['id']},'raw':!![]})[_0x82fa('0x29')](function(_0x541650){_0x541650[_0x82fa('0x68')](function(_0x3eaf73){_0x5e603a[_0x82fa('0x60')](_0x3eaf73[_0x82fa('0x69')]+0x1869f);});_0x42eeeb(_0x5e603a);});}}catch(_0x329f1d){_0x3b1269(_0x329f1d);}});}function getPlugins(_0x319ac8){var _0x3c3c32=[];return new BPromise(function(_0x4b6ccd,_0x425b4f){try{if(_0x319ac8[_0x82fa('0x5a')]){return db[_0x82fa('0x6a')]['findAll']({'raw':!![]})['then'](function(_0x10e0ee){_0x10e0ee[_0x82fa('0x68')](function(_0x429d1a){_0x3c3c32[_0x82fa('0x60')](_0x429d1a['id']+0x15b38);});_0x4b6ccd(_0x3c3c32);});}else{return db[_0x82fa('0x5e')][_0x82fa('0x49')]({'where':{'sectionId':_0x319ac8['id']},'raw':!![]})[_0x82fa('0x29')](function(_0x1d2ce7){_0x1d2ce7[_0x82fa('0x68')](function(_0x47765c){_0x3c3c32[_0x82fa('0x60')](_0x47765c[_0x82fa('0x69')]+0x15b38);});_0x4b6ccd(_0x3c3c32);});}}catch(_0x4a4b2e){_0x425b4f(_0x4a4b2e);}});}exports[_0x82fa('0x6b')]=function(_0x47043a,_0x3fa121){return db[_0x82fa('0x31')][_0x82fa('0x4c')]({'where':{'id':_0x47043a[_0x82fa('0x4b')]['id']}})[_0x82fa('0x29')](handleEntityNotFound(_0x3fa121,null))[_0x82fa('0x29')](function(_0x2c7ae4){if(_0x2c7ae4){return db[_0x82fa('0x56')]['transaction'](function(_0x5540b0){return db[_0x82fa('0x58')]['findAll']({'where':{'userProfileId':_0x47043a[_0x82fa('0x4b')]['id']},'attributes':['id'],'raw':!![]})[_0x82fa('0x29')](function(_0x40ec1f){if(_0x40ec1f){return db[_0x82fa('0x58')]['destroy']({'where':{'userProfileId':_0x47043a[_0x82fa('0x4b')]['id'],'id':_['map'](_0x40ec1f,function(_0x22a9cb){return _0x22a9cb['id'];})},'transaction':_0x5540b0});}})[_0x82fa('0x29')](function(_0x4d0e57){var _0x587b42=_['map'](_0x47043a[_0x82fa('0x55')],function(_0x4b7d7b){_0x4b7d7b[_0x82fa('0x5c')]=_0x47043a[_0x82fa('0x4b')]['id'];return _0x4b7d7b;});return db['UserProfileSection'][_0x82fa('0x6c')](_0x587b42,{'raw':!![],'transaction':_0x5540b0});})['then'](function(_0x5a130a){var _0x547bcd=_[_0x82fa('0x42')](_[_0x82fa('0x30')](_0x5a130a,function(_0x26ce34){return _0x26ce34[_0x82fa('0x50')]({'plain':!![]});}),{'includeAll':![]});if(_0x547bcd){return db[_0x82fa('0x58')]['findAll']({'where':{'userProfileId':_0x47043a[_0x82fa('0x4b')]['id'],'sectionId':_[_0x82fa('0x30')](_0x547bcd,function(_0x47e971){return _0x47e971[_0x82fa('0x5b')];})},'attributes':['id',_0x82fa('0x5b')],'raw':!![]})[_0x82fa('0x29')](function(_0x113d02){var _0x1c3649=_['map'](_0x47043a[_0x82fa('0x55')],function(_0x36df45){_0x36df45['userProfileId']=_0x47043a[_0x82fa('0x4b')]['id'];return _0x36df45;});return db['UserProfileResource']['bulkCreate'](_0x1c3649,{'raw':!![],'transaction':_0x5540b0});});}})['catch'](handleError(_0x3fa121,null));});}})[_0x82fa('0x29')](function(_0x3db8cc){var _0x17ff58=_[_0x82fa('0x30')](_0x3db8cc,function(_0xffcf26){return _0xffcf26['get']({'plain':!![]});});})[_0x82fa('0x29')](respondWithResult(_0x3fa121,null))[_0x82fa('0x4d')](handleError(_0x3fa121,null));};exports[_0x82fa('0x6d')]=function(_0x13054f,_0x4540fc,_0x1f862c){return db[_0x82fa('0x31')][_0x82fa('0x4c')]({'where':{'id':_0x13054f['params']['id']}})[_0x82fa('0x29')](handleEntityNotFound(_0x4540fc,null))[_0x82fa('0x29')](function(_0x576579){if(_0x576579){return _0x576579[_0x82fa('0x6d')](_0x13054f[_0x82fa('0x36')]['ids']);}})['then'](respondWithStatusCode(_0x4540fc,null))[_0x82fa('0x4d')](handleError(_0x4540fc,null));};exports[_0x82fa('0x6e')]=function(_0x2a4050,_0x508a50){var _0xf4804={};if(!_0x2a4050[_0x82fa('0x36')]['section'])throw new Error(_0x82fa('0x6f'));if(!_0x2a4050[_0x82fa('0x36')][_0x82fa('0x70')](_0x82fa('0x3e'))){_0xf4804[_0x82fa('0x20')]=qs[_0x82fa('0x20')](_0x2a4050['query'][_0x82fa('0x20')]);_0xf4804[_0x82fa('0x1e')]=qs[_0x82fa('0x1e')](_0x2a4050['query'][_0x82fa('0x1e')]);}return db[_0x82fa('0x31')]['find']({'where':{'id':_0x2a4050['params']['id']}})['then'](function(_0x166977){if(!_0x166977)throw new Error(_0x82fa('0x71')+_0x2a4050[_0x82fa('0x4b')]['id']);return db[_0x82fa('0x31')][_0x82fa('0x6e')](_0x2a4050);})[_0x82fa('0x29')](respondWithFilteredResult(_0x508a50,_0xf4804))['catch'](handleError(_0x508a50,null));}; \ No newline at end of file +var _0x7199=['removeSections','ids','getSections','filter','enabled','includes','isEmpty','subsections','findOne','Dashboard','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','hasOwnProperty','No\x20User\x20Profile\x20found\x20for\x20id\x20','getResources','rimraf','zip-dir','moment','mustache','util','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./userProfile.socket','sendStatus','status','offset','undefined','limit','count','set','reject','save','update','then','destroy','end','error','stack','name','send','index','map','UserProfile','rawAttributes','type','model','keys','filters','intersection','query','attributes','fields','length','nolimit','order','sort','where','pick','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','clone','get','omit','updatedAt','crudPermissions','createdAt','sequelize','UserProfileSection','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','describe','addSections','transaction','each','push'];(function(_0x56018e,_0x309ad5){var _0x5cb725=function(_0x5c90cd){while(--_0x5c90cd){_0x56018e['push'](_0x56018e['shift']());}};_0x5cb725(++_0x309ad5);}(_0x7199,0xf1));var _0x9719=function(_0x2b851a,_0x3a652e){_0x2b851a=_0x2b851a-0x0;var _0x56e251=_0x7199[_0x2b851a];return _0x56e251;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9719('0x0'));var zipdir=require(_0x9719('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9719('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x9719('0x3'));var util=require(_0x9719('0x4'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x9719('0x5'));var fs=require('fs');var fs_extra=require(_0x9719('0x6'));var _=require(_0x9719('0x7'));var squel=require(_0x9719('0x8'));var crypto=require(_0x9719('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x9719('0xa'));var toCsv=require(_0x9719('0xb'));var querystring=require(_0x9719('0xc'));var Papa=require('papaparse');var Redis=require(_0x9719('0xd'));var authService=require(_0x9719('0xe'));var qs=require(_0x9719('0xf'));var as=require(_0x9719('0x10'));var hardwareService=require(_0x9719('0x11'));var logger=require(_0x9719('0x12'))('api');var utils=require(_0x9719('0x13'));var config=require(_0x9719('0x14'));var licenseUtil=require(_0x9719('0x15'));var db=require(_0x9719('0x16'))['db'];config[_0x9719('0x17')]=_[_0x9719('0x18')](config[_0x9719('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x9719('0x19'))(new Redis(config[_0x9719('0x17')]));require(_0x9719('0x1a'))['register'](socket);function respondWithStatusCode(_0x34c69d,_0x33a4b2){_0x33a4b2=_0x33a4b2||0xcc;return function(_0x3ccafa){if(_0x3ccafa){return _0x34c69d[_0x9719('0x1b')](_0x33a4b2);}return _0x34c69d[_0x9719('0x1c')](_0x33a4b2)['end']();};}function respondWithResult(_0xe8debb,_0x2940d4){_0x2940d4=_0x2940d4||0xc8;return function(_0x30a053){if(_0x30a053){return _0xe8debb[_0x9719('0x1c')](_0x2940d4)['json'](_0x30a053);}};}function respondWithFilteredResult(_0x48ae93,_0x197e15){return function(_0x227811){if(_0x227811){var _0x59199d=typeof _0x197e15[_0x9719('0x1d')]===_0x9719('0x1e')&&typeof _0x197e15[_0x9719('0x1f')]===_0x9719('0x1e');var _0x5e30a6=_0x227811['count'];var _0x177e98=_0x59199d?0x0:_0x197e15[_0x9719('0x1d')];var _0x214b89=_0x59199d?_0x227811[_0x9719('0x20')]:_0x197e15[_0x9719('0x1d')]+_0x197e15['limit'];var _0x27309c;if(_0x214b89>=_0x5e30a6){_0x214b89=_0x5e30a6;_0x27309c=0xc8;}else{_0x27309c=0xce;}_0x48ae93['status'](_0x27309c);return _0x48ae93[_0x9719('0x21')]('Content-Range',_0x177e98+'-'+_0x214b89+'/'+_0x5e30a6)['json'](_0x227811);}return null;};}function patchUpdates(_0x4619ae){return function(_0x1a8e76){try{jsonpatch['apply'](_0x1a8e76,_0x4619ae,!![]);}catch(_0x257857){return BPromise[_0x9719('0x22')](_0x257857);}return _0x1a8e76[_0x9719('0x23')]();};}function saveUpdates(_0xb5628d,_0x43baf9){return function(_0x334418){if(_0x334418){return _0x334418[_0x9719('0x24')](_0xb5628d)[_0x9719('0x25')](function(_0x3fb877){return _0x3fb877;});}return null;};}function removeEntity(_0x54e177,_0xbffa5a){return function(_0x4656c3){if(_0x4656c3){return _0x4656c3[_0x9719('0x26')]()['then'](function(){_0x54e177[_0x9719('0x1c')](0xcc)[_0x9719('0x27')]();});}};}function handleEntityNotFound(_0x1cbe30,_0x58b063){return function(_0x374324){if(!_0x374324){_0x1cbe30[_0x9719('0x1b')](0x194);}return _0x374324;};}function handleError(_0x43f48b,_0x2a7ef6){_0x2a7ef6=_0x2a7ef6||0x1f4;return function(_0x334ce8){logger[_0x9719('0x28')](_0x334ce8[_0x9719('0x29')]);if(_0x334ce8[_0x9719('0x2a')]){delete _0x334ce8[_0x9719('0x2a')];}_0x43f48b[_0x9719('0x1c')](_0x2a7ef6)[_0x9719('0x2b')](_0x334ce8);};}exports[_0x9719('0x2c')]=function(_0x1a501f,_0x3ec1f8){var _0x1e1291={},_0x3419b7={},_0x4f429d={'count':0x0,'rows':[]};var _0x35f8fc=_[_0x9719('0x2d')](db[_0x9719('0x2e')][_0x9719('0x2f')],function(_0x241e59){return{'name':_0x241e59['fieldName'],'type':_0x241e59[_0x9719('0x30')]['key']};});_0x3419b7[_0x9719('0x31')]=_[_0x9719('0x2d')](_0x35f8fc,_0x9719('0x2a'));_0x3419b7['query']=_[_0x9719('0x32')](_0x1a501f['query']);_0x3419b7[_0x9719('0x33')]=_[_0x9719('0x34')](_0x3419b7['model'],_0x3419b7[_0x9719('0x35')]);_0x1e1291[_0x9719('0x36')]=_[_0x9719('0x34')](_0x3419b7[_0x9719('0x31')],qs['fields'](_0x1a501f[_0x9719('0x35')][_0x9719('0x37')]));_0x1e1291['attributes']=_0x1e1291[_0x9719('0x36')][_0x9719('0x38')]?_0x1e1291[_0x9719('0x36')]:_0x3419b7['model'];if(!_0x1a501f[_0x9719('0x35')]['hasOwnProperty'](_0x9719('0x39'))){_0x1e1291['limit']=qs[_0x9719('0x1f')](_0x1a501f['query'][_0x9719('0x1f')]);_0x1e1291['offset']=qs['offset'](_0x1a501f[_0x9719('0x35')]['offset']);}_0x1e1291[_0x9719('0x3a')]=qs['sort'](_0x1a501f[_0x9719('0x35')][_0x9719('0x3b')]);_0x1e1291[_0x9719('0x3c')]=qs[_0x9719('0x33')](_[_0x9719('0x3d')](_0x1a501f[_0x9719('0x35')],_0x3419b7[_0x9719('0x33')]),_0x35f8fc);if(_0x1a501f[_0x9719('0x35')]['filter']){_0x1e1291[_0x9719('0x3c')]=_[_0x9719('0x3e')](_0x1e1291[_0x9719('0x3c')],{'$or':_[_0x9719('0x2d')](_0x35f8fc,function(_0x1340e7){if(_0x1340e7[_0x9719('0x30')]!=='VIRTUAL'){var _0x35be31={};_0x35be31[_0x1340e7[_0x9719('0x2a')]]={'$like':'%'+_0x1a501f['query']['filter']+'%'};return _0x35be31;}})});}_0x1e1291=_[_0x9719('0x3e')]({},_0x1e1291,_0x1a501f[_0x9719('0x3f')]);var _0x32e008={'where':_0x1e1291[_0x9719('0x3c')]};return db['UserProfile'][_0x9719('0x20')](_0x32e008)['then'](function(_0x42ca1a){_0x4f429d[_0x9719('0x20')]=_0x42ca1a;if(_0x1a501f[_0x9719('0x35')][_0x9719('0x40')]){_0x1e1291[_0x9719('0x41')]=[{'all':!![]}];}return db[_0x9719('0x2e')][_0x9719('0x42')](_0x1e1291);})[_0x9719('0x25')](function(_0x4efa7f){_0x4f429d[_0x9719('0x43')]=_0x4efa7f;return _0x4f429d;})['then'](respondWithFilteredResult(_0x3ec1f8,_0x1e1291))[_0x9719('0x44')](handleError(_0x3ec1f8,null));};exports[_0x9719('0x45')]=function(_0x39549d,_0x42058d){var _0x96a4eb={'raw':![],'where':{'id':_0x39549d[_0x9719('0x46')]['id']}},_0xccbe1d={};_0xccbe1d[_0x9719('0x31')]=_[_0x9719('0x32')](db[_0x9719('0x2e')][_0x9719('0x2f')]);_0xccbe1d[_0x9719('0x35')]=_[_0x9719('0x32')](_0x39549d[_0x9719('0x35')]);_0xccbe1d[_0x9719('0x33')]=_[_0x9719('0x34')](_0xccbe1d[_0x9719('0x31')],_0xccbe1d[_0x9719('0x35')]);_0x96a4eb[_0x9719('0x36')]=_['intersection'](_0xccbe1d[_0x9719('0x31')],qs[_0x9719('0x37')](_0x39549d[_0x9719('0x35')][_0x9719('0x37')]));_0x96a4eb[_0x9719('0x36')]=_0x96a4eb['attributes'][_0x9719('0x38')]?_0x96a4eb[_0x9719('0x36')]:_0xccbe1d[_0x9719('0x31')];if(_0x39549d[_0x9719('0x35')][_0x9719('0x40')]){_0x96a4eb[_0x9719('0x41')]=[{'all':!![]}];}_0x96a4eb=_['merge']({},_0x96a4eb,_0x39549d[_0x9719('0x3f')]);return db[_0x9719('0x2e')][_0x9719('0x47')](_0x96a4eb)[_0x9719('0x25')](handleEntityNotFound(_0x42058d,null))['then'](respondWithResult(_0x42058d,null))[_0x9719('0x44')](handleError(_0x42058d,null));};exports['create']=function(_0x582417,_0x571612){return db[_0x9719('0x2e')][_0x9719('0x48')](_0x582417[_0x9719('0x49')],{})[_0x9719('0x25')](respondWithResult(_0x571612,0xc9))[_0x9719('0x44')](handleError(_0x571612,null));};exports[_0x9719('0x4a')]=function(_0x1a8d23,_0x43e7f0){var _0x2d9d44={'where':{'id':_0x1a8d23[_0x9719('0x46')]['id']}},_0x411fc6={};_0x411fc6[_0x9719('0x31')]=_[_0x9719('0x32')](db[_0x9719('0x2e')][_0x9719('0x2f')]);_0x2d9d44[_0x9719('0x36')]=_[_0x9719('0x34')](_0x411fc6[_0x9719('0x31')],qs[_0x9719('0x37')](_0x1a8d23[_0x9719('0x35')][_0x9719('0x37')]));_0x2d9d44[_0x9719('0x36')]=_0x2d9d44[_0x9719('0x36')][_0x9719('0x38')]?_0x2d9d44[_0x9719('0x36')]:_0x411fc6[_0x9719('0x31')];if(_0x1a8d23['query']['includeAll']){_0x2d9d44[_0x9719('0x41')]=[{'all':!![]}];}_0x2d9d44=_[_0x9719('0x3e')]({},_0x2d9d44,_0x1a8d23['options']);return db[_0x9719('0x2e')][_0x9719('0x47')](_0x2d9d44)[_0x9719('0x25')](handleEntityNotFound(_0x43e7f0,null))[_0x9719('0x25')](function(_0x4279cb){if(_0x4279cb){var _0x40e411=_0x4279cb[_0x9719('0x4b')]({'plain':!![]});_0x40e411=qs[_0x9719('0x4c')](_0x40e411,['id','createdAt',_0x9719('0x4d'),_0x9719('0x4e')]);_0x1a8d23['body']=_['omit'](_0x1a8d23[_0x9719('0x49')],['id',_0x9719('0x4f'),_0x9719('0x4d')]);return db[_0x9719('0x50')]['transaction'](function(_0x1ccd8e){return db[_0x9719('0x2e')][_0x9719('0x48')](_[_0x9719('0x3e')](_0x40e411,_0x1a8d23['body']),{'include':_0x1a8d23[_0x9719('0x35')][_0x9719('0x40')]?[{'all':!![]}]:undefined,'transaction':_0x1ccd8e})[_0x9719('0x25')](function(_0x434135){var _0x5ab6bb=_0x434135[_0x9719('0x4b')]({'plain':!![]});return db[_0x9719('0x51')][_0x9719('0x42')]({'where':{'userProfileId':_0x1a8d23[_0x9719('0x46')]['id']},'raw':!![]})[_0x9719('0x25')](function(_0xefbe3c){if(_0xefbe3c){return BPromise['each'](_0xefbe3c,function(_0x2bacde){return new BPromise(function(_0x2d6a45,_0x377dee){if(_0x2bacde[_0x9719('0x52')]===null||_0x2bacde[_0x9719('0x52')]===0x1)_0x2d6a45(null);return db[_0x9719('0x53')]['findAll']({'where':{'sectionId':_0x2bacde['id']},'raw':!![]})[_0x9719('0x25')](function(_0xd4ff07){var _0x4c488d=_['map'](_0xd4ff07,function(_0x4ccb93){return qs[_0x9719('0x4c')](_0x4ccb93,['id','createdAt',_0x9719('0x4d'),_0x9719('0x54')]);});_0x2d6a45(_0x4c488d);})[_0x9719('0x44')](function(_0x5dd4ca){_0x377dee(_0x5dd4ca);});})[_0x9719('0x25')](function(_0x5d46bd){var _0x187e55=qs['omit'](_0x2bacde,['id','createdAt',_0x9719('0x4d')]);_0x187e55[_0x9719('0x55')]=_0x5ab6bb['id'];if(_0x5d46bd)_0x187e55[_0x9719('0x56')]=_0x5d46bd;return _0x187e55;})['then'](function(_0x1e4bfb){return db[_0x9719('0x51')][_0x9719('0x48')](_0x1e4bfb,{'include':[{'model':db[_0x9719('0x53')],'as':_0x9719('0x56')}],'raw':!![],'transaction':_0x1ccd8e});});})['then'](function(){return _0x5ab6bb;});}});});});}})[_0x9719('0x25')](respondWithResult(_0x43e7f0,0xc9))[_0x9719('0x44')](handleError(_0x43e7f0,null));};exports['update']=function(_0x3e0114,_0x1aab4c){if(_0x3e0114[_0x9719('0x49')]['id']){delete _0x3e0114[_0x9719('0x49')]['id'];}return db['UserProfile'][_0x9719('0x47')]({'where':{'id':_0x3e0114['params']['id']}})[_0x9719('0x25')](handleEntityNotFound(_0x1aab4c,null))['then'](saveUpdates(_0x3e0114[_0x9719('0x49')],null))[_0x9719('0x25')](respondWithResult(_0x1aab4c,null))['catch'](handleError(_0x1aab4c,null));};exports[_0x9719('0x26')]=function(_0x12aaaa,_0x52faaa){return db['UserProfile']['find']({'where':{'id':_0x12aaaa['params']['id']}})['then'](handleEntityNotFound(_0x52faaa,null))[_0x9719('0x25')](removeEntity(_0x52faaa,null))[_0x9719('0x44')](handleError(_0x52faaa,null));};exports[_0x9719('0x57')]=function(_0x2341d5,_0x54c1ec){return db[_0x9719('0x2e')][_0x9719('0x57')]()['then'](respondWithResult(_0x54c1ec,null))['catch'](handleError(_0x54c1ec,null));};exports[_0x9719('0x58')]=function(_0x15461a,_0x1d76dd){var _0x6dbfb2=_0x15461a[_0x9719('0x49')];return db[_0x9719('0x2e')]['find']({'where':{'id':_0x15461a[_0x9719('0x46')]['id']}})[_0x9719('0x25')](handleEntityNotFound(_0x1d76dd,null))[_0x9719('0x25')](function(_0x18eb16){if(_0x18eb16){return db[_0x9719('0x50')][_0x9719('0x59')](function(_0x5464d0){return db[_0x9719('0x51')][_0x9719('0x26')]({'where':{'userProfileId':_0x15461a[_0x9719('0x46')]['id'],'sectionId':_[_0x9719('0x2d')](_0x6dbfb2,function(_0x54f160){return _0x54f160['sectionId'];})},'transaction':_0x5464d0})[_0x9719('0x25')](function(){var _0x1b90d4=_[_0x9719('0x2d')](_0x6dbfb2,function(_0x5e9bdb){_0x5e9bdb[_0x9719('0x55')]=_0x15461a[_0x9719('0x46')]['id'];return _0x5e9bdb;});var _0x2122b1=[];return BPromise[_0x9719('0x5a')](_0x1b90d4,function(_0x364691){return db[_0x9719('0x51')][_0x9719('0x48')](_0x364691,{'include':[{'model':db[_0x9719('0x53')],'as':_0x9719('0x56')}],'raw':!![],'transaction':_0x5464d0})[_0x9719('0x25')](function(_0x41816d){_0x2122b1[_0x9719('0x5b')](_0x41816d[_0x9719('0x4b')]({'plain':!![]}));});})['then'](function(){return _0x2122b1;});});});}})[_0x9719('0x25')](function(_0x1e8589){return _0x1e8589;})['then'](respondWithResult(_0x1d76dd,null))[_0x9719('0x44')](handleError(_0x1d76dd,null));};exports[_0x9719('0x5c')]=function(_0x3b5980,_0xd177fe){var _0xb1f390;return db[_0x9719('0x2e')][_0x9719('0x47')]({'where':{'id':_0x3b5980[_0x9719('0x46')]['id']},'attributes':['id',_0x9719('0x2a')]})[_0x9719('0x25')](handleEntityNotFound(_0xd177fe,null))[_0x9719('0x25')](function(_0x719717){if(_0x719717){_0xb1f390=_0x719717;return db[_0x9719('0x51')][_0x9719('0x26')]({'where':{'userProfileId':_0x3b5980['params']['id'],'sectionId':_0x3b5980[_0x9719('0x35')][_0x9719('0x5d')]}});}})['then'](function(){return _0xb1f390;})['then'](respondWithStatusCode(_0xd177fe,null))[_0x9719('0x44')](handleError(_0xd177fe,null));};exports[_0x9719('0x5e')]=function(_0x490e94,_0x3c4e8b){var _0x3f4eed=[];var _0x22d936=[];return db[_0x9719('0x51')][_0x9719('0x42')]({'where':{'userProfileId':_0x490e94[_0x9719('0x46')]['id']},'raw':!![]})[_0x9719('0x25')](function(_0x1b99bd){_0x3f4eed=_[_0x9719('0x5f')](_0x1b99bd,function(_0x524c77){return _0x524c77[_0x9719('0x60')]===0x1||_[_0x9719('0x61')]([0x3eb,0x709],_0x524c77[_0x9719('0x54')]);});if(!_[_0x9719('0x62')](_0x3f4eed)){return _[_0x9719('0x2d')](_0x3f4eed,function(_0x5dc73c){return _0x5dc73c['sectionId'];});}else{return;}})[_0x9719('0x25')](function(_0x23bb0c){if(_0x23bb0c)_0x22d936=_0x23bb0c;if(_[_0x9719('0x61')](_0x22d936,0x64)){var _0x1d3c91=_[_0x9719('0x47')](_0x3f4eed,{'sectionId':0x64});return hasDefaultDashboard(_0x1d3c91)[_0x9719('0x25')](function(_0x493d5c){return _[_0x9719('0x2d')](_0x3f4eed,function(_0x54b488){if(_0x54b488[_0x9719('0x54')]===0x64){_0x54b488['subsections']=_0x493d5c;}return _0x54b488;});});}else{return;}})[_0x9719('0x25')](function(_0x3b33e7){if(_0x3b33e7)_0x3f4eed=_0x3b33e7;if(_[_0x9719('0x61')](_0x22d936,0x3eb)){var _0x55fb70=_[_0x9719('0x47')](_0x3f4eed,{'sectionId':0x3eb});return getCustomDashboards(_0x55fb70)['then'](function(_0x192aa0){return _[_0x9719('0x2d')](_0x3f4eed,function(_0x30f772){if(_0x55fb70[_0x9719('0x60')]){if(_0x30f772['sectionId']===0x3eb){_0x30f772[_0x9719('0x63')]=_0x192aa0;}}else{if(_0x30f772[_0x9719('0x54')]===0x64){if(!_0x30f772[_0x9719('0x63')]){_0x30f772[_0x9719('0x63')]=[];}_0x30f772[_0x9719('0x63')]=_0x30f772['subsections']['concat'](_0x192aa0);}}return _0x30f772;});});}else{return;}})[_0x9719('0x25')](function(_0x32aa4c){if(_0x32aa4c)_0x3f4eed=_0x32aa4c;if(_[_0x9719('0x61')](_0x22d936,0x709)){var _0x5ba2a6=_[_0x9719('0x47')](_0x3f4eed,{'sectionId':0x709});return getPlugins(_0x5ba2a6)[_0x9719('0x25')](function(_0x2f1df9){if(_0x5ba2a6['enabled']){return _[_0x9719('0x2d')](_0x3f4eed,function(_0xe6da1c){if(_0xe6da1c[_0x9719('0x54')]===0x709){_0xe6da1c[_0x9719('0x63')]=_0x2f1df9;}return _0xe6da1c;});}else{var _0x3520f4={'sectionId':0x76c,'enabled':0x1,'subsections':_0x2f1df9};var _0x4fbd00=_[_0x9719('0x2d')](_0x3f4eed);_0x4fbd00[_0x9719('0x5b')](_0x3520f4);return _0x4fbd00;}});}else{return;}})['then'](function(_0x3ef764){if(_0x3ef764)_0x3f4eed=_0x3ef764;return _['filter'](_0x3f4eed,[_0x9719('0x60'),0x1]);})['then'](respondWithResult(_0x3c4e8b,null))[_0x9719('0x44')](handleError(_0x3c4e8b,null));};function hasDefaultDashboard(_0x363eb0){var _0x4bcf6a=[0x65];return new BPromise(function(_0x5a9f99,_0x2bc5bb){try{if(_0x363eb0['autoAssociation']){_0x5a9f99(_0x4bcf6a);}else{return db[_0x9719('0x53')][_0x9719('0x64')]({'where':{'sectionId':_0x363eb0['id']},'raw':!![]})['then'](function(_0x351a45){_0x351a45?_0x5a9f99(_0x4bcf6a):_0x5a9f99();});}}catch(_0x10d201){_0x2bc5bb(_0x10d201);}});}function getCustomDashboards(_0x319d72){var _0x466803=[];return new BPromise(function(_0x12df68,_0x4f8b33){try{if(_0x319d72['autoAssociation']){return db[_0x9719('0x65')][_0x9719('0x42')]({'raw':!![]})['then'](function(_0x4b1125){_0x4b1125['forEach'](function(_0x3f38b6){_0x466803['push'](_0x3f38b6['id']+0x1869f);});_0x12df68(_0x466803);});}else{return db[_0x9719('0x53')]['findAll']({'where':{'sectionId':_0x319d72['id']},'raw':!![]})['then'](function(_0x5715dc){_0x5715dc[_0x9719('0x66')](function(_0x296da7){_0x466803[_0x9719('0x5b')](_0x296da7[_0x9719('0x67')]+0x1869f);});_0x12df68(_0x466803);});}}catch(_0x27d1cf){_0x4f8b33(_0x27d1cf);}});}function getPlugins(_0x4bc15a){var _0x42900f=[];return new BPromise(function(_0x39963e,_0x2d7b5d){try{if(_0x4bc15a['autoAssociation']){return db[_0x9719('0x68')]['findAll']({'raw':!![]})[_0x9719('0x25')](function(_0x37fd3d){_0x37fd3d[_0x9719('0x66')](function(_0x599149){_0x42900f[_0x9719('0x5b')](_0x599149['id']+0x15b38);});_0x39963e(_0x42900f);});}else{return db[_0x9719('0x53')][_0x9719('0x42')]({'where':{'sectionId':_0x4bc15a['id']},'raw':!![]})[_0x9719('0x25')](function(_0x49f2f6){_0x49f2f6[_0x9719('0x66')](function(_0x15286c){_0x42900f[_0x9719('0x5b')](_0x15286c[_0x9719('0x67')]+0x15b38);});_0x39963e(_0x42900f);});}}catch(_0x5c56b8){_0x2d7b5d(_0x5c56b8);}});}exports[_0x9719('0x69')]=function(_0x30ff91,_0xfcbb55){return db[_0x9719('0x2e')][_0x9719('0x47')]({'where':{'id':_0x30ff91['params']['id']}})['then'](handleEntityNotFound(_0xfcbb55,null))['then'](function(_0x4410a8){if(_0x4410a8){return db[_0x9719('0x50')][_0x9719('0x59')](function(_0x1b5c8a){return db[_0x9719('0x51')]['findAll']({'where':{'userProfileId':_0x30ff91[_0x9719('0x46')]['id']},'attributes':['id'],'raw':!![]})[_0x9719('0x25')](function(_0x241419){if(_0x241419){return db[_0x9719('0x51')][_0x9719('0x26')]({'where':{'userProfileId':_0x30ff91[_0x9719('0x46')]['id'],'id':_[_0x9719('0x2d')](_0x241419,function(_0x1b168f){return _0x1b168f['id'];})},'transaction':_0x1b5c8a});}})[_0x9719('0x25')](function(_0x39b594){var _0x3ea47f=_[_0x9719('0x2d')](_0x30ff91[_0x9719('0x49')],function(_0x1c8038){_0x1c8038[_0x9719('0x55')]=_0x30ff91[_0x9719('0x46')]['id'];return _0x1c8038;});return db[_0x9719('0x51')][_0x9719('0x6a')](_0x3ea47f,{'raw':!![],'transaction':_0x1b5c8a});})['then'](function(_0x2a9c39){var _0x3cd3e9=_['filter'](_[_0x9719('0x2d')](_0x2a9c39,function(_0x5830f8){return _0x5830f8[_0x9719('0x4b')]({'plain':!![]});}),{'includeAll':![]});if(_0x3cd3e9){return db[_0x9719('0x51')][_0x9719('0x42')]({'where':{'userProfileId':_0x30ff91[_0x9719('0x46')]['id'],'sectionId':_[_0x9719('0x2d')](_0x3cd3e9,function(_0x3ea3c2){return _0x3ea3c2[_0x9719('0x54')];})},'attributes':['id',_0x9719('0x54')],'raw':!![]})[_0x9719('0x25')](function(_0x120e18){var _0x42aefd=_[_0x9719('0x2d')](_0x30ff91['body'],function(_0x59f4a5){_0x59f4a5['userProfileId']=_0x30ff91[_0x9719('0x46')]['id'];return _0x59f4a5;});return db[_0x9719('0x53')][_0x9719('0x6a')](_0x42aefd,{'raw':!![],'transaction':_0x1b5c8a});});}})[_0x9719('0x44')](handleError(_0xfcbb55,null));});}})['then'](function(_0x59ab0f){var _0x60b01f=_[_0x9719('0x2d')](_0x59ab0f,function(_0x49ba67){return _0x49ba67[_0x9719('0x4b')]({'plain':!![]});});})[_0x9719('0x25')](respondWithResult(_0xfcbb55,null))[_0x9719('0x44')](handleError(_0xfcbb55,null));};exports[_0x9719('0x6b')]=function(_0x120dc5,_0x4e057f,_0x8f8cab){return db[_0x9719('0x2e')]['find']({'where':{'id':_0x120dc5['params']['id']}})[_0x9719('0x25')](handleEntityNotFound(_0x4e057f,null))['then'](function(_0x3ad4b7){if(_0x3ad4b7){return _0x3ad4b7[_0x9719('0x6b')](_0x120dc5[_0x9719('0x35')][_0x9719('0x5d')]);}})['then'](respondWithStatusCode(_0x4e057f,null))[_0x9719('0x44')](handleError(_0x4e057f,null));};exports['getResources']=function(_0x591aa1,_0x52d14f){var _0x4debfe={};if(!_0x591aa1[_0x9719('0x35')]['section'])throw new Error('Missing\x20section\x20parameter');if(!_0x591aa1[_0x9719('0x35')][_0x9719('0x6c')]('nolimit')){_0x4debfe[_0x9719('0x1f')]=qs[_0x9719('0x1f')](_0x591aa1['query']['limit']);_0x4debfe[_0x9719('0x1d')]=qs[_0x9719('0x1d')](_0x591aa1['query']['offset']);}return db[_0x9719('0x2e')][_0x9719('0x47')]({'where':{'id':_0x591aa1[_0x9719('0x46')]['id']}})[_0x9719('0x25')](function(_0x160024){if(!_0x160024)throw new Error(_0x9719('0x6d')+_0x591aa1[_0x9719('0x46')]['id']);return db['UserProfile'][_0x9719('0x6e')](_0x591aa1);})[_0x9719('0x25')](respondWithFilteredResult(_0x52d14f,_0x4debfe))[_0x9719('0x44')](handleError(_0x52d14f,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 8b540c9..45e2b69 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 _0x341c=['update','remove','emit','hasOwnProperty','hook','exports','events','UserProfile','save'];(function(_0x4e81a4,_0xf68174){var _0x20e78a=function(_0x397209){while(--_0x397209){_0x4e81a4['push'](_0x4e81a4['shift']());}};_0x20e78a(++_0xf68174);}(_0x341c,0xcc));var _0xc341=function(_0x3d075a,_0x507f04){_0x3d075a=_0x3d075a-0x0;var _0x418be1=_0x341c[_0x3d075a];return _0x418be1;};'use strict';var EventEmitter=require(_0xc341('0x0'));var UserProfile=require('../../mysqldb')['db'][_0xc341('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc341('0x2'),'afterUpdate':_0xc341('0x3'),'afterDestroy':_0xc341('0x4')};function emitEvent(_0x40d92f){return function(_0x4c74c5,_0x3e07f8,_0x3ab689){UserProfileEvents[_0xc341('0x5')](_0x40d92f+':'+_0x4c74c5['id'],_0x4c74c5);UserProfileEvents['emit'](_0x40d92f,_0x4c74c5);_0x3ab689(null);};}for(var e in events){if(events[_0xc341('0x6')](e)){var event=events[e];UserProfile[_0xc341('0x7')](e,emitEvent(event));}}module[_0xc341('0x8')]=UserProfileEvents; \ No newline at end of file +var _0xef66=['UserProfile','setMaxListeners','save','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x44cd76,_0x39317a){var _0x5717dd=function(_0x26b91f){while(--_0x26b91f){_0x44cd76['push'](_0x44cd76['shift']());}};_0x5717dd(++_0x39317a);}(_0xef66,0x1db));var _0x6ef6=function(_0x3c92bd,_0x19f112){_0x3c92bd=_0x3c92bd-0x0;var _0x2f0c18=_0xef66[_0x3c92bd];return _0x2f0c18;};'use strict';var EventEmitter=require(_0x6ef6('0x0'));var UserProfile=require(_0x6ef6('0x1'))['db'][_0x6ef6('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x6ef6('0x3')](0x0);var events={'afterCreate':_0x6ef6('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x447651){return function(_0x2443db,_0x337718,_0x1cc212){UserProfileEvents[_0x6ef6('0x5')](_0x447651+':'+_0x2443db['id'],_0x2443db);UserProfileEvents[_0x6ef6('0x5')](_0x447651,_0x2443db);_0x1cc212(null);};}for(var e in events){if(events[_0x6ef6('0x6')](e)){var event=events[e];UserProfile[_0x6ef6('0x7')](e,emitEvent(event));}}module[_0x6ef6('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 0f8d4e3..d2bb65d 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 _0x8ede=['AnalyticExtractedReport','resourceId','squareprojects','childModel','SquareProject','odbc','SquareOdbc','squarerecordings','parentSections','SquareProjects','projectName','projects','JscriptyProject','contacts','CmContact','Lists','ListId','lists','companies','CmCompany','globalcustomfields','CmCustomField','ChatQueue','faxqueues','FaxQueue','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','VoiceContext','voicemails','VoiceMail','Agents','membername','User','role','Telephones','telephone','VoiceQueues','inbound','QueueCampaigns','VoiceQueue','type','outbound','musiconholds','chanspies','VoiceChanSpy','voiceprefixes','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','Team','queuecampaigns','agents','telephones','Users','admin','user','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','intervals','Interval','pauses','Pause','scheduler','Schedule','sounds','Sound','tags','templates','Template','Trigger','trunks','Trunk','variables','Variable','plugins','Plugin','extractedreports','Reports','reportId','metrics','charAt','toUpperCase','slice','Sequelize','QueryTypes','ui.','ui.createdAt','from','user_has_','_interactions','where','ui.UserId\x20=\x20?','sequelize','query','define','UserProfile','user_profiles','raw','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','UserProfileSection','params','all','ignore','union','find','push','autoAssociation','rawAttributes','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','order','sort','pick','merge','key','VIRTUAL','foreignKey','forEach','includeAll','include','reportType','default','DefaultReports','CustomReports','count','rows','ids','customSorting','extraQueryConditions','Tags','tag','Tag','openTabs','chat','dataValues','mail','lodash','./userProfile.attributes','squel','models','filter','value','findAll','map','catch','field','model','then','name','resolve','associatedResources'];(function(_0x41e974,_0x58491c){var _0x2f8cd2=function(_0x12b7d2){while(--_0x12b7d2){_0x41e974['push'](_0x41e974['shift']());}};_0x2f8cd2(++_0x58491c);}(_0x8ede,0xb2));var _0xe8ed=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8ede[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xe8ed('0x0'));var attributes=require(_0xe8ed('0x1'));var squel=require(_0xe8ed('0x2'));module['exports']=function(_0x1ed343){var _0xe7434e=_0x1ed343[_0xe8ed('0x3')];function _0x4005cb(_0x56ebef,_0x29c133){return new Promise(function(_0x3583f4,_0x2478b9){if(!_0x29c133)return _0x3583f4(null);var _0x1fa66b=_0x29c133[_0xe8ed('0x4')]?{[_0x29c133[_0xe8ed('0x4')]['field']]:_0x29c133[_0xe8ed('0x4')][_0xe8ed('0x5')]}:undefined;return _0xe7434e[_0x56ebef][_0xe8ed('0x6')]({'where':_0x1fa66b,'raw':!![]})['then'](function(_0x1afb1b){_0x29c133['associatedResources']=_[_0xe8ed('0x7')](_0x1afb1b,'id');_0x3583f4(_0x29c133);})[_0xe8ed('0x8')](function(_0x2c7fef){_0x2478b9(_0x2c7fef);});});}function _0x4e78d4(_0x44246a,_0x3b6cdc){return new Promise(function(_0x50599b,_0xa936d7){var _0xf2ac4d=_0x44246a[_0xe8ed('0x4')]?{[_0x44246a[_0xe8ed('0x4')][_0xe8ed('0x9')]]:_0x44246a[_0xe8ed('0x4')][_0xe8ed('0x5')]}:undefined;return _0xe7434e[_0x44246a[_0xe8ed('0xa')]][_0xe8ed('0x6')]({'where':_0xf2ac4d,'raw':!![]})[_0xe8ed('0xb')](function(_0x2b7ce8){_0x3b6cdc['associatedResources']=_[_0xe8ed('0x7')](_0x2b7ce8,function(_0x4a2ea5){return _0x4a2ea5[_0xe8ed('0xc')];});_0x50599b(_0x3b6cdc);})[_0xe8ed('0x8')](function(_0x5e353a){_0xa936d7(_0x5e353a);});});}function _0x4fe900(_0x2a5a54,_0x2cd2f4,_0x25815d){if(!_0x2cd2f4)return Promise[_0xe8ed('0xd')](null);return new Promise(function(_0x3fc405,_0x40a980){return _0xe7434e['UserProfileResource']['findAll']({'where':{'sectionId':_0x2cd2f4['id']},'raw':!![]})['then'](function(_0x52b3d6){if(_0x2a5a54['field']&&_0x2a5a54[_0xe8ed('0x9')]!=='id'){_0x2cd2f4[_0xe8ed('0xe')]=_['map'](_0x52b3d6,function(_0x584c69){return _0x584c69[_0x2a5a54[_0xe8ed('0x9')]];});}else{if(_0x25815d===_0xe8ed('0xf')){_0x2cd2f4['associatedResources']=_['map'](_0x52b3d6,function(_0x1ade7e){return{'id':_0x1ade7e[_0xe8ed('0x10')],'type':_0x1ade7e['type']};});}else{_0x2cd2f4[_0xe8ed('0xe')]=_[_0xe8ed('0x7')](_0x52b3d6,function(_0x47119c){return _0x47119c[_0xe8ed('0x10')];});}}_0x3fc405(_0x2cd2f4);})['catch'](function(_0xd287f5){_0x40a980(_0xd287f5);});});}function _0x117fdf(_0x3df63b,_0x26ebf4){var _0x3b9d3e={'parentSections':[]};switch(_0x3df63b['toLowerCase']()){case _0xe8ed('0x11'):_0x3b9d3e[_0xe8ed('0x12')]=_0xe8ed('0x13');break;case _0xe8ed('0x14'):_0x3b9d3e['childModel']=_0xe8ed('0x15');break;case _0xe8ed('0x16'):_0x3b9d3e[_0xe8ed('0x12')]='SquareRecording';_0x3b9d3e[_0xe8ed('0x17')]=[{'name':_0xe8ed('0x18'),'field':'name','foreignKey':_0xe8ed('0x19')}];break;case _0xe8ed('0x1a'):_0x3b9d3e[_0xe8ed('0x12')]=_0xe8ed('0x1b');break;case _0xe8ed('0x1c'):_0x3b9d3e[_0xe8ed('0x12')]=_0xe8ed('0x1d');_0x3b9d3e[_0xe8ed('0x17')]=[{'name':_0xe8ed('0x1e'),'field':'id','foreignKey':_0xe8ed('0x1f')}];break;case _0xe8ed('0x20'):_0x3b9d3e['childModel']='CmList';break;case _0xe8ed('0x21'):_0x3b9d3e[_0xe8ed('0x12')]=_0xe8ed('0x22');break;case _0xe8ed('0x23'):_0x3b9d3e[_0xe8ed('0x12')]=_0xe8ed('0x24');break;case'chatqueues':_0x3b9d3e[_0xe8ed('0x12')]=_0xe8ed('0x25');break;case'chatwebsites':_0x3b9d3e['childModel']='ChatWebsite';break;case _0xe8ed('0x26'):_0x3b9d3e[_0xe8ed('0x12')]=_0xe8ed('0x27');break;case'faxaccounts':_0x3b9d3e[_0xe8ed('0x12')]=_0xe8ed('0x28');break;case _0xe8ed('0x29'):case _0xe8ed('0x2a'):case _0xe8ed('0x2b'):_0x3b9d3e['childModel']=_0xe8ed('0x2c');break;case'contexts':_0x3b9d3e['childModel']=_0xe8ed('0x2d');break;case _0xe8ed('0x2e'):_0x3b9d3e[_0xe8ed('0x12')]=_0xe8ed('0x2f');break;case'voicerecordings':_0x3b9d3e['childModel']='VoiceRecording';_0x3b9d3e[_0xe8ed('0x17')]=[{'name':_0xe8ed('0x30'),'field':_0xe8ed('0xc'),'foreignKey':_0xe8ed('0x31'),'model':_0xe8ed('0x32'),'filter':{'field':_0xe8ed('0x33'),'value':['agent']}},{'name':_0xe8ed('0x34'),'field':_0xe8ed('0xc'),'foreignKey':'membername','model':_0xe8ed('0x32'),'filter':{'field':_0xe8ed('0x33'),'value':[_0xe8ed('0x35')]}},{'name':_0xe8ed('0x36'),'field':'name','foreignKey':'queue','model':'VoiceQueue','filter':{'field':'type','value':[_0xe8ed('0x37')]}},{'name':_0xe8ed('0x38'),'field':_0xe8ed('0xc'),'foreignKey':'queue','model':_0xe8ed('0x39'),'filter':{'field':_0xe8ed('0x3a'),'value':[_0xe8ed('0x3b')]}}];break;case _0xe8ed('0x3c'):_0x3b9d3e[_0xe8ed('0x12')]='VoiceMusicOnHold';break;case _0xe8ed('0x3d'):_0x3b9d3e[_0xe8ed('0x12')]=_0xe8ed('0x3e');break;case _0xe8ed('0x3f'):_0x3b9d3e[_0xe8ed('0x12')]='VoicePrefix';break;case _0xe8ed('0x40'):_0x3b9d3e[_0xe8ed('0x12')]=_0xe8ed('0x41');break;case _0xe8ed('0x42'):_0x3b9d3e[_0xe8ed('0x12')]=_0xe8ed('0x43');break;case _0xe8ed('0x44'):_0x3b9d3e[_0xe8ed('0x12')]=_0xe8ed('0x45');break;case _0xe8ed('0x46'):_0x3b9d3e[_0xe8ed('0x12')]=_0xe8ed('0x47');break;case _0xe8ed('0x48'):_0x3b9d3e[_0xe8ed('0x12')]=_0xe8ed('0x49');break;case _0xe8ed('0x4a'):_0x3b9d3e[_0xe8ed('0x12')]=_0xe8ed('0x4b');break;case _0xe8ed('0x4c'):_0x3b9d3e['childModel']=_0xe8ed('0x4d');break;case _0xe8ed('0x4e'):_0x3b9d3e[_0xe8ed('0x12')]='SmsAccount';break;case _0xe8ed('0x4f'):_0x3b9d3e[_0xe8ed('0x12')]=_0xe8ed('0x50');break;case _0xe8ed('0x51'):_0x3b9d3e['childModel']=_0xe8ed('0x52');break;case'teams':_0x3b9d3e['childModel']=_0xe8ed('0x53');break;case'voicequeues':case _0xe8ed('0x54'):_0x3b9d3e['childModel']=_0xe8ed('0x39');if(_0x26ebf4){_0x3b9d3e[_0xe8ed('0x17')]=[{'name':_0xe8ed('0x36')},{'name':_0xe8ed('0x38')}];}break;case'users':case _0xe8ed('0x55'):case _0xe8ed('0x56'):_0x3b9d3e['childModel']=_0xe8ed('0x32');if(_0x26ebf4){_0x3b9d3e['parentSections']=[{'name':_0xe8ed('0x57'),'filter':{'field':_0xe8ed('0x33'),'value':[_0xe8ed('0x58'),_0xe8ed('0x59')]},'ignore':!![]},{'name':_0xe8ed('0x30')},{'name':'Telephones'}];}break;case _0xe8ed('0x5a'):_0x3b9d3e[_0xe8ed('0x12')]=_0xe8ed('0x5b');break;case _0xe8ed('0x5c'):_0x3b9d3e['childModel']=_0xe8ed('0x5d');break;case _0xe8ed('0x5e'):_0x3b9d3e[_0xe8ed('0x12')]='FreshdeskAccount';break;case'sugarcrmaccounts':_0x3b9d3e['childModel']='SugarcrmAccount';break;case _0xe8ed('0x5f'):_0x3b9d3e[_0xe8ed('0x12')]=_0xe8ed('0x60');break;case _0xe8ed('0x61'):_0x3b9d3e[_0xe8ed('0x12')]=_0xe8ed('0x62');break;case'vtigeraccounts':_0x3b9d3e[_0xe8ed('0x12')]=_0xe8ed('0x32');break;case _0xe8ed('0x63'):_0x3b9d3e[_0xe8ed('0x12')]=_0xe8ed('0x64');break;case _0xe8ed('0x65'):_0x3b9d3e['childModel']=_0xe8ed('0x66');break;case _0xe8ed('0x67'):_0x3b9d3e[_0xe8ed('0x12')]='Dashboard';break;case _0xe8ed('0x68'):_0x3b9d3e[_0xe8ed('0x12')]=_0xe8ed('0x69');break;case _0xe8ed('0x6a'):_0x3b9d3e[_0xe8ed('0x12')]=_0xe8ed('0x6b');break;case _0xe8ed('0x6c'):_0x3b9d3e[_0xe8ed('0x12')]=_0xe8ed('0x6d');break;case _0xe8ed('0x6e'):_0x3b9d3e[_0xe8ed('0x12')]=_0xe8ed('0x6f');break;case _0xe8ed('0x70'):_0x3b9d3e[_0xe8ed('0x12')]='Tag';break;case _0xe8ed('0x71'):_0x3b9d3e['childModel']=_0xe8ed('0x72');break;case'triggers':_0x3b9d3e[_0xe8ed('0x12')]=_0xe8ed('0x73');break;case _0xe8ed('0x74'):_0x3b9d3e[_0xe8ed('0x12')]=_0xe8ed('0x75');break;case _0xe8ed('0x76'):_0x3b9d3e[_0xe8ed('0x12')]=_0xe8ed('0x77');break;case _0xe8ed('0x78'):_0x3b9d3e['childModel']=_0xe8ed('0x79');break;case _0xe8ed('0x7a'):_0x3b9d3e['childModel']=_0xe8ed('0xf');_0x3b9d3e[_0xe8ed('0x17')]=[{'name':_0xe8ed('0x7b'),'field':'id','foreignKey':_0xe8ed('0x7c')}];break;case _0xe8ed('0x7d'):_0x3b9d3e[_0xe8ed('0x12')]='AnalyticMetric';break;}return _0x3b9d3e;}function _0x12fd3b(_0x4385f7,_0x500f15){var _0x538e38=_0x4385f7[_0xe8ed('0x7e')](0x0)[_0xe8ed('0x7f')]()+_0x4385f7[_0xe8ed('0x80')](0x1);var _0x215300={'type':_0xe7434e[_0xe8ed('0x81')][_0xe8ed('0x82')]['SELECT'],'raw':!![]};return new Promise(function(_0x2b5c10,_0x3ed207){var _0x517f41=squel['select']()[_0xe8ed('0x9')](_0xe8ed('0x83')+_0x538e38+'InteractionId','id')['field'](_0xe8ed('0x84'))[_0xe8ed('0x85')](_0xe8ed('0x86')+_0x4385f7+_0xe8ed('0x87'),'ui')[_0xe8ed('0x88')](_0xe8ed('0x89'),_0x500f15['id']);return _0xe7434e[_0xe8ed('0x8a')][_0xe8ed('0x8b')](_0x517f41['toString'](),_0x215300)['then'](function(_0x31c84b){_0x500f15[_0x538e38+'OpenTabs']=_0x31c84b;_0x2b5c10(_0x31c84b);})[_0xe8ed('0x8')](function(_0x24a001){_0x3ed207(_0x24a001);});});}return _0x1ed343[_0xe8ed('0x8c')](_0xe8ed('0x8d'),attributes,{'tableName':_0xe8ed('0x8e'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x45407f){var _0x1ce7be=require('../../components/parsers/qs');var _0x12c28c={'raw':_0x45407f[_0xe8ed('0x8b')][_0xe8ed('0x8f')],'where':{}};var _0xb606ec={};var _0x49b006={'count':0x0,'rows':[]};var _0x5eb0f5=_0x45407f['query'][_0xe8ed('0x90')];var _0x2f9250=_0x45407f[_0xe8ed('0x8b')][_0xe8ed('0x91')]||![];var _0x28ee12=_0x117fdf(_0x5eb0f5,_0x2f9250);if(!_0x28ee12[_0xe8ed('0x12')])throw new Error(_0xe8ed('0x92')+_0x5eb0f5+'\x27');var _0x48af11=[{'name':_0x5eb0f5}];if(!_[_0xe8ed('0x93')](_0x28ee12[_0xe8ed('0x17')]))_0x48af11=_0x28ee12['parentSections'];var _0xe46d77=[];for(var _0x1e61eb=0x0;_0x1e61eb<_0x48af11[_0xe8ed('0x94')];_0x1e61eb++){_0xe46d77['push'](_0xe7434e[_0xe8ed('0x95')]['find']({'where':{'userProfileId':_0x45407f[_0xe8ed('0x96')]['id'],'name':_0x48af11[_0x1e61eb][_0xe8ed('0xc')]},'raw':!![]}));}return Promise[_0xe8ed('0x97')](_0xe46d77)['then'](function(_0x2a6ec7){var _0x362a79=_[_0xe8ed('0x4')](_0x2a6ec7,function(_0x239d52){return _0x239d52?_0x239d52:undefined;});var _0x4bdcfa=_[_0xe8ed('0x4')](_0x48af11,[_0xe8ed('0x98'),!![]]);var _0x509c50=_[_0xe8ed('0x93')](_0x362a79)&&_[_0xe8ed('0x93')](_0x4bdcfa)?null:_[_0xe8ed('0x99')](_0x4bdcfa,_0x362a79);if(!_0x509c50)return null;var _0x2ae847=[];for(var _0x57c305=0x0;_0x57c305<_0x509c50[_0xe8ed('0x94')];_0x57c305++){var _0x4ff156=_[_0xe8ed('0x9a')](_0x48af11,function(_0x34607c){return _0x509c50[_0x57c305]?_0x34607c[_0xe8ed('0xc')]===_0x509c50[_0x57c305][_0xe8ed('0xc')]:null;});if(_0x4ff156){if(_0x509c50[_0x57c305][_0xe8ed('0x98')]){_0x2ae847[_0xe8ed('0x9b')](_0x4005cb(_0x28ee12[_0xe8ed('0x12')],_0x509c50[_0x57c305]));}else{if(!_0x509c50[_0x57c305][_0xe8ed('0x9c')]){_0x2ae847['push'](_0x4fe900(_0x4ff156,_0x509c50[_0x57c305],_0x28ee12[_0xe8ed('0x12')]));}else{if(_0x4ff156['model']){_0x2ae847[_0xe8ed('0x9b')](_0x4e78d4(_0x4ff156,_0x509c50[_0x57c305]));}}}}}return Promise[_0xe8ed('0x97')](_0x2ae847);})[_0xe8ed('0xb')](function(_0x3c08d9){var _0x43dc84=_0x3c08d9;var _0x21ddf1=null;if(_0x43dc84){_0x21ddf1=_0x43dc84[_0xe8ed('0x94')]===0x1?_0x43dc84[0x0]:null;}if(!_0x21ddf1&&!_0x43dc84)return _0x49b006;var _0x4b5811=_0xe7434e[_0x28ee12[_0xe8ed('0x12')]][_0xe8ed('0x9d')];_0xb606ec['model']=_['keys'](_0x4b5811);_0xb606ec[_0xe8ed('0x8b')]=_[_0xe8ed('0x9e')](_0x45407f[_0xe8ed('0x8b')]);_0xb606ec[_0xe8ed('0x9f')]=_[_0xe8ed('0xa0')](_0xb606ec[_0xe8ed('0xa')],_0xb606ec['query']);_0x12c28c[_0xe8ed('0xa1')]=_[_0xe8ed('0xa0')](_0xb606ec[_0xe8ed('0xa')],_0x1ce7be['fields'](_0x45407f['query'][_0xe8ed('0xa2')]));_0x12c28c[_0xe8ed('0xa1')]=_0x12c28c[_0xe8ed('0xa1')][_0xe8ed('0x94')]?_0x12c28c[_0xe8ed('0xa1')]:_0xb606ec[_0xe8ed('0xa')];if(!_0x45407f[_0xe8ed('0x8b')][_0xe8ed('0xa3')](_0xe8ed('0xa4'))){_0x12c28c[_0xe8ed('0xa5')]=_0x1ce7be['limit'](_0x45407f['query']['limit']);_0x12c28c[_0xe8ed('0xa6')]=_0x1ce7be[_0xe8ed('0xa6')](_0x45407f[_0xe8ed('0x8b')][_0xe8ed('0xa6')]);}_0x12c28c[_0xe8ed('0xa7')]=_0x1ce7be[_0xe8ed('0xa8')](_0x45407f[_0xe8ed('0x8b')][_0xe8ed('0xa8')]);_0x12c28c[_0xe8ed('0x88')]=_0x1ce7be[_0xe8ed('0x9f')](_[_0xe8ed('0xa9')](_0x45407f[_0xe8ed('0x8b')],_0xb606ec['filters']));if(_0x45407f[_0xe8ed('0x8b')][_0xe8ed('0x4')]){_0x12c28c[_0xe8ed('0x88')]=_[_0xe8ed('0xaa')](_0x12c28c['where'],{'$or':_['map'](_0x4b5811,function(_0x30b067){if(_0x30b067[_0xe8ed('0x3a')][_0xe8ed('0xab')]!==_0xe8ed('0xac')){var _0x1c5196={};_0x1c5196[_0x30b067[_0xe8ed('0x9')]]={'$like':'%'+_0x45407f['query']['filter']+'%'};return _0x1c5196;}})});}var _0x2c92c6=[];var _0x5cbf9b=null;var _0x50da93={};if(_0x21ddf1){_0x5cbf9b=_['find'](_0x48af11,[_0xe8ed('0xc'),_0x21ddf1[_0xe8ed('0xc')]]);if(_0x5cbf9b[_0xe8ed('0x9')]){_0x50da93={};if(_0x28ee12['childModel']==='AnalyticExtractedReport'){_0x50da93[_0x5cbf9b['foreignKey']]=_[_0xe8ed('0x7')](_0x21ddf1['associatedResources'],'id');}else{_0x50da93[_0x5cbf9b[_0xe8ed('0xad')]]=_0x21ddf1[_0xe8ed('0xe')];}_0x2c92c6[_0xe8ed('0x9b')](_0x50da93);}else{_0x12c28c['where']['id']=_0x21ddf1['associatedResources'];}}else{for(var _0x475bef=0x0;_0x475bef<_0x43dc84['length'];_0x475bef++){_0x5cbf9b=_[_0xe8ed('0x9a')](_0x48af11,[_0xe8ed('0xc'),_0x43dc84[_0x475bef]['name']]);if(_0x5cbf9b[_0xe8ed('0x9')]){_0x50da93={};_0x50da93[_0x5cbf9b[_0xe8ed('0xad')]]=_0x43dc84[_0x475bef][_0xe8ed('0xe')];_0x2c92c6[_0xe8ed('0x9b')](_0x50da93);}else{if(!_0x12c28c['where']['id'])_0x12c28c[_0xe8ed('0x88')]['id']=[];_0x43dc84[_0x475bef][_0xe8ed('0xe')][_0xe8ed('0xae')](function(_0x44b789){_0x12c28c[_0xe8ed('0x88')]['id'][_0xe8ed('0x9b')](_0x44b789);});}}}if(!_[_0xe8ed('0x93')](_0x2c92c6)){_0x12c28c[_0xe8ed('0x88')]=_[_0xe8ed('0xaa')](_0x12c28c[_0xe8ed('0x88')],{'$and':{'$or':_0x2c92c6}});}_0x12c28c=_[_0xe8ed('0xaa')]({},_0x12c28c,_0x45407f['options']);if(_0x21ddf1&&!_0x21ddf1[_0xe8ed('0x9c')]&&_0x28ee12['childModel']===_0xe8ed('0xf')){if(_0x45407f['query'][_0xe8ed('0xaf')]){_0x12c28c[_0xe8ed('0xb0')]=[{'all':!![]}];}return _0xe7434e[_0x28ee12[_0xe8ed('0x12')]][_0xe8ed('0x6')](_0x12c28c)[_0xe8ed('0xb')](function(_0x14358f){var _0xfde5d3=[];_0x14358f[_0xe8ed('0xae')](function(_0x4c5466){var _0x49321b;switch(_0x4c5466[_0xe8ed('0xb1')]){case _0xe8ed('0xb2'):_0x49321b=_[_0xe8ed('0x9a')](_0x21ddf1[_0xe8ed('0xe')],function(_0x5dd8e7){return _0x5dd8e7['id']===_0x4c5466[_0xe8ed('0x7c')]&&_0x5dd8e7[_0xe8ed('0x3a')]===_0xe8ed('0xb3');});break;case'custom':_0x49321b=_[_0xe8ed('0x9a')](_0x21ddf1[_0xe8ed('0xe')],function(_0x1749d4){return _0x1749d4['id']===_0x4c5466[_0xe8ed('0x7c')]&&_0x1749d4['type']===_0xe8ed('0xb4');});break;}if(_0x49321b)_0xfde5d3[_0xe8ed('0x9b')](_0x4c5466);});_0x49b006[_0xe8ed('0xb5')]=_0xfde5d3[_0xe8ed('0x94')];_0x49b006[_0xe8ed('0xb6')]=_0xfde5d3;return _0x49b006;});}else{if(!_['isEmpty'](_0x45407f['query']['ids'])){_0x12c28c[_0xe8ed('0x88')]['id']=_0x12c28c['where']['id']?_[_0xe8ed('0xa0')](_0x12c28c[_0xe8ed('0x88')]['id'],_0x45407f[_0xe8ed('0x8b')][_0xe8ed('0xb7')]):_0x45407f['query'][_0xe8ed('0xb7')];if(_0x45407f[_0xe8ed('0x8b')]['customSorting']){_0x12c28c[_0xe8ed('0xa7')]=_0x45407f[_0xe8ed('0x8b')][_0xe8ed('0xb8')];}}if(_0x45407f['query']['extraQueryConditions']){_0x12c28c['where']=_[_0xe8ed('0xaa')](_0x12c28c[_0xe8ed('0x88')],{'$and':_0x45407f[_0xe8ed('0x8b')][_0xe8ed('0xb9')]});}return _0xe7434e[_0x28ee12['childModel']][_0xe8ed('0xb5')]({'where':_0x12c28c['where']})[_0xe8ed('0xb')](function(_0x3bc4e4){_0x49b006['count']=_0x3bc4e4;if(_0x45407f[_0xe8ed('0x8b')][_0xe8ed('0xaf')]){if(_0x28ee12[_0xe8ed('0x12')]===_0xe8ed('0x1d')){_0x12c28c[_0xe8ed('0xb0')]=[{'model':_0xe7434e['Tag'],'as':_0xe8ed('0xba'),'attributes':['id',_0xe8ed('0xc'),'color'],'required':_0x45407f['query'][_0xe8ed('0xbb')]?!![]:![]},{'model':_0xe7434e[_0xe8ed('0xbc')],'as':'ThroughTags','attributes':['id',_0xe8ed('0xc'),'color'],'through':_0x45407f[_0xe8ed('0x8b')][_0xe8ed('0xbb')]?{'attributes':[],'where':{'TagId':_0x45407f[_0xe8ed('0x8b')][_0xe8ed('0xbb')]||undefined}}:{},'required':_0x45407f[_0xe8ed('0x8b')][_0xe8ed('0xbb')]?!![]:![]}];}else{_0x12c28c[_0xe8ed('0xb0')]=[{'all':!![]}];}}return _0xe7434e[_0x28ee12['childModel']][_0xe8ed('0x6')](_0x12c28c);})['then'](function(_0x4d70dc){_0x49b006[_0xe8ed('0xb6')]=_0x4d70dc;if(_0x5eb0f5==='Agents'&&_0x45407f['query'][_0xe8ed('0xbd')]==='true'){var _0x345f85=[];for(var _0xdd4a06=0x0;_0xdd4a06<_0x49b006[_0xe8ed('0xb6')][_0xe8ed('0x94')];_0xdd4a06++){_0x345f85[_0xe8ed('0x9b')](_0x12fd3b(_0xe8ed('0xbe'),_0x49b006[_0xe8ed('0xb6')][_0xdd4a06][_0xe8ed('0xbf')]));_0x345f85['push'](_0x12fd3b('sms',_0x49b006[_0xe8ed('0xb6')][_0xdd4a06][_0xe8ed('0xbf')]));_0x345f85[_0xe8ed('0x9b')](_0x12fd3b('fax',_0x49b006[_0xe8ed('0xb6')][_0xdd4a06]['dataValues']));_0x345f85[_0xe8ed('0x9b')](_0x12fd3b(_0xe8ed('0xc0'),_0x49b006['rows'][_0xdd4a06][_0xe8ed('0xbf')]));_0x345f85[_0xe8ed('0x9b')](_0x12fd3b('openchannel',_0x49b006['rows'][_0xdd4a06][_0xe8ed('0xbf')]));_0x345f85[_0xe8ed('0x9b')](_0x12fd3b('whatsapp',_0x49b006['rows'][_0xdd4a06][_0xe8ed('0xbf')]));}return Promise[_0xe8ed('0x97')](_0x345f85)['then'](function(){return _0x49b006;});}return _0x49b006;});}});}}});}; \ No newline at end of file +var _0x8c7f=['query','toString','OpenTabs','UserProfile','user_profiles','../../components/parsers/qs','raw','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','push','UserProfileSection','find','params','all','ignore','union','rawAttributes','keys','intersection','fields','attributes','limit','offset','order','sort','filters','pick','merge','key','VIRTUAL','foreignKey','forEach','options','autoAssociation','includeAll','include','reportType','default','reportId','DefaultReports','custom','CustomReports','count','ids','customSorting','extraQueryConditions','CmContact','Tags','color','tag','ThroughTags','findAll','openTabs','true','chat','rows','dataValues','fax','openchannel','whatsapp','squel','models','filter','then','map','field','value','model','name','resolve','UserProfileResource','AnalyticExtractedReport','associatedResources','resourceId','type','catch','toLowerCase','childModel','odbc','SquareOdbc','squarerecordings','SquareRecording','SquareProjects','projectName','projects','JscriptyProject','contacts','parentSections','Lists','ListId','lists','CmList','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','faxqueues','FaxQueue','faxaccounts','inboundroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','VoiceRecording','Agents','membername','User','role','telephone','VoiceQueues','queue','VoiceQueue','QueueCampaigns','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','VoicePrefix','ivrcampaigns','MailQueue','mailaccounts','MailAccount','MailSubstatus','openchannelqueues','openchannelaccounts','OpenchannelAccount','smsqueues','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','teams','Team','queuecampaigns','agents','telephones','Users','admin','user','ZendeskAccount','salesforceaccounts','SalesforceAccount','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','intervals','pauses','Pause','scheduler','Schedule','sounds','Tag','Template','triggers','trunks','Trunk','variables','Variable','plugins','Plugin','extractedreports','Reports','metrics','AnalyticMetric','charAt','toUpperCase','slice','Sequelize','QueryTypes','SELECT','select','InteractionId','ui.createdAt','user_has_','_interactions','where','sequelize'];(function(_0x5b6937,_0x53154f){var _0x26c339=function(_0x20400d){while(--_0x20400d){_0x5b6937['push'](_0x5b6937['shift']());}};_0x26c339(++_0x53154f);}(_0x8c7f,0x103));var _0xf8c7=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8c7f[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var attributes=require('./userProfile.attributes');var squel=require(_0xf8c7('0x0'));module['exports']=function(_0x1cd5a5){var _0x4a6fbd=_0x1cd5a5[_0xf8c7('0x1')];function _0x3ca562(_0x392ac0,_0x55a054){return new Promise(function(_0x523339,_0xc25261){if(!_0x55a054)return _0x523339(null);var _0x251095=_0x55a054['filter']?{[_0x55a054[_0xf8c7('0x2')]['field']]:_0x55a054[_0xf8c7('0x2')]['value']}:undefined;return _0x4a6fbd[_0x392ac0]['findAll']({'where':_0x251095,'raw':!![]})[_0xf8c7('0x3')](function(_0x10514d){_0x55a054['associatedResources']=_[_0xf8c7('0x4')](_0x10514d,'id');_0x523339(_0x55a054);})['catch'](function(_0x1ecbe4){_0xc25261(_0x1ecbe4);});});}function _0x3de4ab(_0x9cc075,_0x42a0bf){return new Promise(function(_0x268e4b,_0xc875d3){var _0x5d2273=_0x9cc075[_0xf8c7('0x2')]?{[_0x9cc075[_0xf8c7('0x2')][_0xf8c7('0x5')]]:_0x9cc075['filter'][_0xf8c7('0x6')]}:undefined;return _0x4a6fbd[_0x9cc075[_0xf8c7('0x7')]]['findAll']({'where':_0x5d2273,'raw':!![]})[_0xf8c7('0x3')](function(_0x5a8dda){_0x42a0bf['associatedResources']=_[_0xf8c7('0x4')](_0x5a8dda,function(_0x3d8933){return _0x3d8933[_0xf8c7('0x8')];});_0x268e4b(_0x42a0bf);})['catch'](function(_0x291785){_0xc875d3(_0x291785);});});}function _0x585459(_0x1cebf5,_0x368786,_0x4d76ec){if(!_0x368786)return Promise[_0xf8c7('0x9')](null);return new Promise(function(_0x504e26,_0x365ce0){return _0x4a6fbd[_0xf8c7('0xa')]['findAll']({'where':{'sectionId':_0x368786['id']},'raw':!![]})['then'](function(_0x481a13){if(_0x1cebf5[_0xf8c7('0x5')]&&_0x1cebf5['field']!=='id'){_0x368786['associatedResources']=_[_0xf8c7('0x4')](_0x481a13,function(_0x1747af){return _0x1747af[_0x1cebf5[_0xf8c7('0x5')]];});}else{if(_0x4d76ec===_0xf8c7('0xb')){_0x368786[_0xf8c7('0xc')]=_['map'](_0x481a13,function(_0x53dee2){return{'id':_0x53dee2[_0xf8c7('0xd')],'type':_0x53dee2[_0xf8c7('0xe')]};});}else{_0x368786[_0xf8c7('0xc')]=_[_0xf8c7('0x4')](_0x481a13,function(_0x537d13){return _0x537d13[_0xf8c7('0xd')];});}}_0x504e26(_0x368786);})[_0xf8c7('0xf')](function(_0x38dc4d){_0x365ce0(_0x38dc4d);});});}function _0x16e0e0(_0x196eba,_0x25734a){var _0xf8b4ae={'parentSections':[]};switch(_0x196eba[_0xf8c7('0x10')]()){case'squareprojects':_0xf8b4ae[_0xf8c7('0x11')]='SquareProject';break;case _0xf8c7('0x12'):_0xf8b4ae[_0xf8c7('0x11')]=_0xf8c7('0x13');break;case _0xf8c7('0x14'):_0xf8b4ae[_0xf8c7('0x11')]=_0xf8c7('0x15');_0xf8b4ae['parentSections']=[{'name':_0xf8c7('0x16'),'field':_0xf8c7('0x8'),'foreignKey':_0xf8c7('0x17')}];break;case _0xf8c7('0x18'):_0xf8b4ae[_0xf8c7('0x11')]=_0xf8c7('0x19');break;case _0xf8c7('0x1a'):_0xf8b4ae['childModel']='CmContact';_0xf8b4ae[_0xf8c7('0x1b')]=[{'name':_0xf8c7('0x1c'),'field':'id','foreignKey':_0xf8c7('0x1d')}];break;case _0xf8c7('0x1e'):_0xf8b4ae[_0xf8c7('0x11')]=_0xf8c7('0x1f');break;case'companies':_0xf8b4ae[_0xf8c7('0x11')]=_0xf8c7('0x20');break;case _0xf8c7('0x21'):_0xf8b4ae[_0xf8c7('0x11')]=_0xf8c7('0x22');break;case _0xf8c7('0x23'):_0xf8b4ae[_0xf8c7('0x11')]=_0xf8c7('0x24');break;case'chatwebsites':_0xf8b4ae[_0xf8c7('0x11')]='ChatWebsite';break;case _0xf8c7('0x25'):_0xf8b4ae[_0xf8c7('0x11')]=_0xf8c7('0x26');break;case _0xf8c7('0x27'):_0xf8b4ae[_0xf8c7('0x11')]='FaxAccount';break;case _0xf8c7('0x28'):case'internalroutes':case _0xf8c7('0x29'):_0xf8b4ae[_0xf8c7('0x11')]=_0xf8c7('0x2a');break;case _0xf8c7('0x2b'):_0xf8b4ae[_0xf8c7('0x11')]=_0xf8c7('0x2c');break;case _0xf8c7('0x2d'):_0xf8b4ae['childModel']=_0xf8c7('0x2e');break;case'voicerecordings':_0xf8b4ae['childModel']=_0xf8c7('0x2f');_0xf8b4ae[_0xf8c7('0x1b')]=[{'name':_0xf8c7('0x30'),'field':_0xf8c7('0x8'),'foreignKey':_0xf8c7('0x31'),'model':_0xf8c7('0x32'),'filter':{'field':_0xf8c7('0x33'),'value':['agent']}},{'name':'Telephones','field':_0xf8c7('0x8'),'foreignKey':_0xf8c7('0x31'),'model':_0xf8c7('0x32'),'filter':{'field':_0xf8c7('0x33'),'value':[_0xf8c7('0x34')]}},{'name':_0xf8c7('0x35'),'field':_0xf8c7('0x8'),'foreignKey':_0xf8c7('0x36'),'model':_0xf8c7('0x37'),'filter':{'field':_0xf8c7('0xe'),'value':['inbound']}},{'name':_0xf8c7('0x38'),'field':'name','foreignKey':_0xf8c7('0x36'),'model':'VoiceQueue','filter':{'field':_0xf8c7('0xe'),'value':[_0xf8c7('0x39')]}}];break;case _0xf8c7('0x3a'):_0xf8b4ae['childModel']=_0xf8c7('0x3b');break;case _0xf8c7('0x3c'):_0xf8b4ae[_0xf8c7('0x11')]=_0xf8c7('0x3d');break;case'voiceprefixes':_0xf8b4ae[_0xf8c7('0x11')]=_0xf8c7('0x3e');break;case _0xf8c7('0x3f'):_0xf8b4ae['childModel']='Campaign';break;case'mailqueues':_0xf8b4ae[_0xf8c7('0x11')]=_0xf8c7('0x40');break;case _0xf8c7('0x41'):_0xf8b4ae[_0xf8c7('0x11')]=_0xf8c7('0x42');break;case'mailsubstatuses':_0xf8b4ae[_0xf8c7('0x11')]=_0xf8c7('0x43');break;case _0xf8c7('0x44'):_0xf8b4ae['childModel']='OpenchannelQueue';break;case _0xf8c7('0x45'):_0xf8b4ae[_0xf8c7('0x11')]=_0xf8c7('0x46');break;case _0xf8c7('0x47'):_0xf8b4ae[_0xf8c7('0x11')]='SmsQueue';break;case _0xf8c7('0x48'):_0xf8b4ae['childModel']=_0xf8c7('0x49');break;case _0xf8c7('0x4a'):_0xf8b4ae[_0xf8c7('0x11')]=_0xf8c7('0x4b');break;case _0xf8c7('0x4c'):_0xf8b4ae['childModel']='WhatsappAccount';break;case _0xf8c7('0x4d'):_0xf8b4ae[_0xf8c7('0x11')]=_0xf8c7('0x4e');break;case'voicequeues':case _0xf8c7('0x4f'):_0xf8b4ae['childModel']='VoiceQueue';if(_0x25734a){_0xf8b4ae[_0xf8c7('0x1b')]=[{'name':_0xf8c7('0x35')},{'name':_0xf8c7('0x38')}];}break;case'users':case _0xf8c7('0x50'):case _0xf8c7('0x51'):_0xf8b4ae[_0xf8c7('0x11')]=_0xf8c7('0x32');if(_0x25734a){_0xf8b4ae[_0xf8c7('0x1b')]=[{'name':_0xf8c7('0x52'),'filter':{'field':_0xf8c7('0x33'),'value':[_0xf8c7('0x53'),_0xf8c7('0x54')]},'ignore':!![]},{'name':_0xf8c7('0x30')},{'name':'Telephones'}];}break;case'zendeskaccounts':_0xf8b4ae[_0xf8c7('0x11')]=_0xf8c7('0x55');break;case _0xf8c7('0x56'):_0xf8b4ae[_0xf8c7('0x11')]=_0xf8c7('0x57');break;case'freshdeskaccounts':_0xf8b4ae[_0xf8c7('0x11')]=_0xf8c7('0x58');break;case _0xf8c7('0x59'):_0xf8b4ae['childModel']=_0xf8c7('0x5a');break;case _0xf8c7('0x5b'):_0xf8b4ae['childModel']=_0xf8c7('0x5c');break;case'zohoaccounts':_0xf8b4ae[_0xf8c7('0x11')]=_0xf8c7('0x5d');break;case _0xf8c7('0x5e'):_0xf8b4ae[_0xf8c7('0x11')]=_0xf8c7('0x32');break;case _0xf8c7('0x5f'):_0xf8b4ae[_0xf8c7('0x11')]=_0xf8c7('0x60');break;case _0xf8c7('0x61'):_0xf8b4ae['childModel']=_0xf8c7('0x62');break;case _0xf8c7('0x63'):_0xf8b4ae['childModel']=_0xf8c7('0x64');break;case _0xf8c7('0x65'):_0xf8b4ae[_0xf8c7('0x11')]='Interval';break;case _0xf8c7('0x66'):_0xf8b4ae['childModel']=_0xf8c7('0x67');break;case _0xf8c7('0x68'):_0xf8b4ae['childModel']=_0xf8c7('0x69');break;case _0xf8c7('0x6a'):_0xf8b4ae['childModel']='Sound';break;case'tags':_0xf8b4ae[_0xf8c7('0x11')]=_0xf8c7('0x6b');break;case'templates':_0xf8b4ae['childModel']=_0xf8c7('0x6c');break;case _0xf8c7('0x6d'):_0xf8b4ae['childModel']='Trigger';break;case _0xf8c7('0x6e'):_0xf8b4ae[_0xf8c7('0x11')]=_0xf8c7('0x6f');break;case _0xf8c7('0x70'):_0xf8b4ae[_0xf8c7('0x11')]=_0xf8c7('0x71');break;case _0xf8c7('0x72'):_0xf8b4ae[_0xf8c7('0x11')]=_0xf8c7('0x73');break;case _0xf8c7('0x74'):_0xf8b4ae[_0xf8c7('0x11')]=_0xf8c7('0xb');_0xf8b4ae[_0xf8c7('0x1b')]=[{'name':_0xf8c7('0x75'),'field':'id','foreignKey':'reportId'}];break;case _0xf8c7('0x76'):_0xf8b4ae[_0xf8c7('0x11')]=_0xf8c7('0x77');break;}return _0xf8b4ae;}function _0x555ea3(_0x163a8c,_0x2679c8){var _0x16f9b9=_0x163a8c[_0xf8c7('0x78')](0x0)[_0xf8c7('0x79')]()+_0x163a8c[_0xf8c7('0x7a')](0x1);var _0x54b0df={'type':_0x4a6fbd[_0xf8c7('0x7b')][_0xf8c7('0x7c')][_0xf8c7('0x7d')],'raw':!![]};return new Promise(function(_0x5e0058,_0x2ea19c){var _0x2734cf=squel[_0xf8c7('0x7e')]()[_0xf8c7('0x5')]('ui.'+_0x16f9b9+_0xf8c7('0x7f'),'id')[_0xf8c7('0x5')](_0xf8c7('0x80'))['from'](_0xf8c7('0x81')+_0x163a8c+_0xf8c7('0x82'),'ui')[_0xf8c7('0x83')]('ui.UserId\x20=\x20?',_0x2679c8['id']);return _0x4a6fbd[_0xf8c7('0x84')][_0xf8c7('0x85')](_0x2734cf[_0xf8c7('0x86')](),_0x54b0df)[_0xf8c7('0x3')](function(_0x36f980){_0x2679c8[_0x16f9b9+_0xf8c7('0x87')]=_0x36f980;_0x5e0058(_0x36f980);})[_0xf8c7('0xf')](function(_0x4ae198){_0x2ea19c(_0x4ae198);});});}return _0x1cd5a5['define'](_0xf8c7('0x88'),attributes,{'tableName':_0xf8c7('0x89'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x46c728){var _0x4e3319=require(_0xf8c7('0x8a'));var _0xf21eeb={'raw':_0x46c728[_0xf8c7('0x85')][_0xf8c7('0x8b')],'where':{}};var _0x56846b={};var _0x654f8d={'count':0x0,'rows':[]};var _0x18a384=_0x46c728[_0xf8c7('0x85')][_0xf8c7('0x8c')];var _0x3b232f=_0x46c728[_0xf8c7('0x85')][_0xf8c7('0x8d')]||![];var _0x3b3e0b=_0x16e0e0(_0x18a384,_0x3b232f);if(!_0x3b3e0b[_0xf8c7('0x11')])throw new Error(_0xf8c7('0x8e')+_0x18a384+'\x27');var _0x1ab5c3=[{'name':_0x18a384}];if(!_[_0xf8c7('0x8f')](_0x3b3e0b[_0xf8c7('0x1b')]))_0x1ab5c3=_0x3b3e0b[_0xf8c7('0x1b')];var _0x25faf5=[];for(var _0x26f62f=0x0;_0x26f62f<_0x1ab5c3[_0xf8c7('0x90')];_0x26f62f++){_0x25faf5[_0xf8c7('0x91')](_0x4a6fbd[_0xf8c7('0x92')][_0xf8c7('0x93')]({'where':{'userProfileId':_0x46c728[_0xf8c7('0x94')]['id'],'name':_0x1ab5c3[_0x26f62f][_0xf8c7('0x8')]},'raw':!![]}));}return Promise[_0xf8c7('0x95')](_0x25faf5)[_0xf8c7('0x3')](function(_0x40af24){var _0x2034af=_[_0xf8c7('0x2')](_0x40af24,function(_0x523914){return _0x523914?_0x523914:undefined;});var _0x4687af=_[_0xf8c7('0x2')](_0x1ab5c3,[_0xf8c7('0x96'),!![]]);var _0x7f9964=_['isEmpty'](_0x2034af)&&_['isEmpty'](_0x4687af)?null:_[_0xf8c7('0x97')](_0x4687af,_0x2034af);if(!_0x7f9964)return null;var _0x810059=[];for(var _0x50d568=0x0;_0x50d568<_0x7f9964['length'];_0x50d568++){var _0x1bb661=_['find'](_0x1ab5c3,function(_0x51f7e4){return _0x7f9964[_0x50d568]?_0x51f7e4[_0xf8c7('0x8')]===_0x7f9964[_0x50d568][_0xf8c7('0x8')]:null;});if(_0x1bb661){if(_0x7f9964[_0x50d568][_0xf8c7('0x96')]){_0x810059['push'](_0x3ca562(_0x3b3e0b[_0xf8c7('0x11')],_0x7f9964[_0x50d568]));}else{if(!_0x7f9964[_0x50d568]['autoAssociation']){_0x810059[_0xf8c7('0x91')](_0x585459(_0x1bb661,_0x7f9964[_0x50d568],_0x3b3e0b['childModel']));}else{if(_0x1bb661[_0xf8c7('0x7')]){_0x810059[_0xf8c7('0x91')](_0x3de4ab(_0x1bb661,_0x7f9964[_0x50d568]));}}}}}return Promise[_0xf8c7('0x95')](_0x810059);})[_0xf8c7('0x3')](function(_0x52288f){var _0x3044d5=_0x52288f;var _0x57b3b8=null;if(_0x3044d5){_0x57b3b8=_0x3044d5[_0xf8c7('0x90')]===0x1?_0x3044d5[0x0]:null;}if(!_0x57b3b8&&!_0x3044d5)return _0x654f8d;var _0xd4cae7=_0x4a6fbd[_0x3b3e0b['childModel']][_0xf8c7('0x98')];_0x56846b['model']=_['keys'](_0xd4cae7);_0x56846b[_0xf8c7('0x85')]=_[_0xf8c7('0x99')](_0x46c728[_0xf8c7('0x85')]);_0x56846b['filters']=_[_0xf8c7('0x9a')](_0x56846b[_0xf8c7('0x7')],_0x56846b['query']);_0xf21eeb['attributes']=_[_0xf8c7('0x9a')](_0x56846b['model'],_0x4e3319[_0xf8c7('0x9b')](_0x46c728[_0xf8c7('0x85')][_0xf8c7('0x9b')]));_0xf21eeb['attributes']=_0xf21eeb[_0xf8c7('0x9c')][_0xf8c7('0x90')]?_0xf21eeb['attributes']:_0x56846b[_0xf8c7('0x7')];if(!_0x46c728['query']['hasOwnProperty']('nolimit')){_0xf21eeb['limit']=_0x4e3319[_0xf8c7('0x9d')](_0x46c728[_0xf8c7('0x85')][_0xf8c7('0x9d')]);_0xf21eeb[_0xf8c7('0x9e')]=_0x4e3319[_0xf8c7('0x9e')](_0x46c728[_0xf8c7('0x85')][_0xf8c7('0x9e')]);}_0xf21eeb[_0xf8c7('0x9f')]=_0x4e3319[_0xf8c7('0xa0')](_0x46c728[_0xf8c7('0x85')][_0xf8c7('0xa0')]);_0xf21eeb[_0xf8c7('0x83')]=_0x4e3319[_0xf8c7('0xa1')](_[_0xf8c7('0xa2')](_0x46c728[_0xf8c7('0x85')],_0x56846b[_0xf8c7('0xa1')]));if(_0x46c728['query'][_0xf8c7('0x2')]){_0xf21eeb[_0xf8c7('0x83')]=_[_0xf8c7('0xa3')](_0xf21eeb[_0xf8c7('0x83')],{'$or':_[_0xf8c7('0x4')](_0xd4cae7,function(_0x48f3e3){if(_0x48f3e3['type'][_0xf8c7('0xa4')]!==_0xf8c7('0xa5')){var _0x4daa66={};_0x4daa66[_0x48f3e3['field']]={'$like':'%'+_0x46c728[_0xf8c7('0x85')][_0xf8c7('0x2')]+'%'};return _0x4daa66;}})});}var _0x5cedd7=[];var _0x15138c=null;var _0x2ef10e={};if(_0x57b3b8){_0x15138c=_[_0xf8c7('0x93')](_0x1ab5c3,['name',_0x57b3b8[_0xf8c7('0x8')]]);if(_0x15138c[_0xf8c7('0x5')]){_0x2ef10e={};if(_0x3b3e0b[_0xf8c7('0x11')]===_0xf8c7('0xb')){_0x2ef10e[_0x15138c['foreignKey']]=_[_0xf8c7('0x4')](_0x57b3b8['associatedResources'],'id');}else{_0x2ef10e[_0x15138c['foreignKey']]=_0x57b3b8[_0xf8c7('0xc')];}_0x5cedd7['push'](_0x2ef10e);}else{_0xf21eeb[_0xf8c7('0x83')]['id']=_0x57b3b8[_0xf8c7('0xc')];}}else{for(var _0x31c7d6=0x0;_0x31c7d6<_0x3044d5[_0xf8c7('0x90')];_0x31c7d6++){_0x15138c=_[_0xf8c7('0x93')](_0x1ab5c3,[_0xf8c7('0x8'),_0x3044d5[_0x31c7d6]['name']]);if(_0x15138c[_0xf8c7('0x5')]){_0x2ef10e={};_0x2ef10e[_0x15138c[_0xf8c7('0xa6')]]=_0x3044d5[_0x31c7d6]['associatedResources'];_0x5cedd7[_0xf8c7('0x91')](_0x2ef10e);}else{if(!_0xf21eeb[_0xf8c7('0x83')]['id'])_0xf21eeb['where']['id']=[];_0x3044d5[_0x31c7d6][_0xf8c7('0xc')][_0xf8c7('0xa7')](function(_0x35958c){_0xf21eeb['where']['id'][_0xf8c7('0x91')](_0x35958c);});}}}if(!_[_0xf8c7('0x8f')](_0x5cedd7)){_0xf21eeb[_0xf8c7('0x83')]=_[_0xf8c7('0xa3')](_0xf21eeb[_0xf8c7('0x83')],{'$and':{'$or':_0x5cedd7}});}_0xf21eeb=_[_0xf8c7('0xa3')]({},_0xf21eeb,_0x46c728[_0xf8c7('0xa8')]);if(_0x57b3b8&&!_0x57b3b8[_0xf8c7('0xa9')]&&_0x3b3e0b[_0xf8c7('0x11')]===_0xf8c7('0xb')){if(_0x46c728[_0xf8c7('0x85')][_0xf8c7('0xaa')]){_0xf21eeb[_0xf8c7('0xab')]=[{'all':!![]}];}return _0x4a6fbd[_0x3b3e0b[_0xf8c7('0x11')]]['findAll'](_0xf21eeb)['then'](function(_0x2cf77c){var _0x5c7555=[];_0x2cf77c[_0xf8c7('0xa7')](function(_0x52cbbd){var _0x25038d;switch(_0x52cbbd[_0xf8c7('0xac')]){case _0xf8c7('0xad'):_0x25038d=_[_0xf8c7('0x93')](_0x57b3b8[_0xf8c7('0xc')],function(_0x2836d6){return _0x2836d6['id']===_0x52cbbd[_0xf8c7('0xae')]&&_0x2836d6[_0xf8c7('0xe')]===_0xf8c7('0xaf');});break;case _0xf8c7('0xb0'):_0x25038d=_['find'](_0x57b3b8[_0xf8c7('0xc')],function(_0x4b5da8){return _0x4b5da8['id']===_0x52cbbd[_0xf8c7('0xae')]&&_0x4b5da8[_0xf8c7('0xe')]===_0xf8c7('0xb1');});break;}if(_0x25038d)_0x5c7555[_0xf8c7('0x91')](_0x52cbbd);});_0x654f8d[_0xf8c7('0xb2')]=_0x5c7555[_0xf8c7('0x90')];_0x654f8d['rows']=_0x5c7555;return _0x654f8d;});}else{if(!_[_0xf8c7('0x8f')](_0x46c728['query'][_0xf8c7('0xb3')])){_0xf21eeb[_0xf8c7('0x83')]['id']=_0xf21eeb['where']['id']?_[_0xf8c7('0x9a')](_0xf21eeb[_0xf8c7('0x83')]['id'],_0x46c728[_0xf8c7('0x85')][_0xf8c7('0xb3')]):_0x46c728[_0xf8c7('0x85')]['ids'];if(_0x46c728['query'][_0xf8c7('0xb4')]){_0xf21eeb[_0xf8c7('0x9f')]=_0x46c728['query'][_0xf8c7('0xb4')];}}if(_0x46c728[_0xf8c7('0x85')][_0xf8c7('0xb5')]){_0xf21eeb[_0xf8c7('0x83')]=_[_0xf8c7('0xa3')](_0xf21eeb[_0xf8c7('0x83')],{'$and':_0x46c728[_0xf8c7('0x85')][_0xf8c7('0xb5')]});}return _0x4a6fbd[_0x3b3e0b['childModel']]['count']({'where':_0xf21eeb['where']})[_0xf8c7('0x3')](function(_0x563b68){_0x654f8d[_0xf8c7('0xb2')]=_0x563b68;if(_0x46c728['query'][_0xf8c7('0xaa')]){if(_0x3b3e0b[_0xf8c7('0x11')]===_0xf8c7('0xb6')){_0xf21eeb[_0xf8c7('0xab')]=[{'model':_0x4a6fbd['Tag'],'as':_0xf8c7('0xb7'),'attributes':['id',_0xf8c7('0x8'),_0xf8c7('0xb8')],'required':_0x46c728[_0xf8c7('0x85')][_0xf8c7('0xb9')]?!![]:![]},{'model':_0x4a6fbd[_0xf8c7('0x6b')],'as':_0xf8c7('0xba'),'attributes':['id','name',_0xf8c7('0xb8')],'through':_0x46c728[_0xf8c7('0x85')]['tag']?{'attributes':[],'where':{'TagId':_0x46c728['query'][_0xf8c7('0xb9')]||undefined}}:{},'required':_0x46c728[_0xf8c7('0x85')][_0xf8c7('0xb9')]?!![]:![]}];}else{_0xf21eeb[_0xf8c7('0xab')]=[{'all':!![]}];}}return _0x4a6fbd[_0x3b3e0b[_0xf8c7('0x11')]][_0xf8c7('0xbb')](_0xf21eeb);})[_0xf8c7('0x3')](function(_0xe19cdf){_0x654f8d['rows']=_0xe19cdf;if(_0x18a384===_0xf8c7('0x30')&&_0x46c728[_0xf8c7('0x85')][_0xf8c7('0xbc')]===_0xf8c7('0xbd')){var _0x5c1203=[];for(var _0x59b1c5=0x0;_0x59b1c5<_0x654f8d['rows'][_0xf8c7('0x90')];_0x59b1c5++){_0x5c1203[_0xf8c7('0x91')](_0x555ea3(_0xf8c7('0xbe'),_0x654f8d[_0xf8c7('0xbf')][_0x59b1c5][_0xf8c7('0xc0')]));_0x5c1203['push'](_0x555ea3('sms',_0x654f8d['rows'][_0x59b1c5][_0xf8c7('0xc0')]));_0x5c1203[_0xf8c7('0x91')](_0x555ea3(_0xf8c7('0xc1'),_0x654f8d[_0xf8c7('0xbf')][_0x59b1c5]['dataValues']));_0x5c1203[_0xf8c7('0x91')](_0x555ea3('mail',_0x654f8d[_0xf8c7('0xbf')][_0x59b1c5][_0xf8c7('0xc0')]));_0x5c1203[_0xf8c7('0x91')](_0x555ea3(_0xf8c7('0xc2'),_0x654f8d[_0xf8c7('0xbf')][_0x59b1c5]['dataValues']));_0x5c1203[_0xf8c7('0x91')](_0x555ea3(_0xf8c7('0xc3'),_0x654f8d[_0xf8c7('0xbf')][_0x59b1c5][_0xf8c7('0xc0')]));}return Promise[_0xf8c7('0x95')](_0x5c1203)[_0xf8c7('0x3')](function(){return _0x654f8d;});}return _0x654f8d;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 6ba59f5..f17026d 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 _0x13f5=['debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent'];(function(_0xf26ff9,_0x19db58){var _0xcc478b=function(_0x477168){while(--_0x477168){_0xf26ff9['push'](_0xf26ff9['shift']());}};_0xcc478b(++_0x19db58);}(_0x13f5,0xc3));var _0x513f=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x13f5[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x513f('0x0'));var util=require(_0x513f('0x1'));var moment=require(_0x513f('0x2'));var BPromise=require(_0x513f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x513f('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x513f('0x5'))(_0x513f('0x6'));var config=require(_0x513f('0x7'));var jayson=require(_0x513f('0x8'));var client=jayson[_0x513f('0x9')][_0x513f('0xa')]({'port':0x232a});config[_0x513f('0xb')]=_[_0x513f('0xc')](config[_0x513f('0xb')],{'host':_0x513f('0xd'),'port':0x18eb});var socket=require(_0x513f('0xe'))(new Redis(config[_0x513f('0xb')]));require('./userProfile.socket')[_0x513f('0xf')](socket);function respondWithRpcPromise(_0x38bd4b,_0x443bde,_0x4efd8b){return new BPromise(function(_0x88288b,_0x4aa878){return client[_0x513f('0x10')](_0x38bd4b,_0x4efd8b)[_0x513f('0x11')](function(_0x484ab1){logger[_0x513f('0x12')](_0x513f('0x13'),_0x443bde,_0x513f('0x14'));logger[_0x513f('0x15')](_0x513f('0x16'),_0x443bde,_0x513f('0x14'),JSON[_0x513f('0x17')](_0x484ab1));if(_0x484ab1[_0x513f('0x18')]){if(_0x484ab1[_0x513f('0x18')][_0x513f('0x19')]===0x1f4){logger[_0x513f('0x18')](_0x513f('0x13'),_0x443bde,_0x484ab1[_0x513f('0x18')][_0x513f('0x1a')]);return _0x4aa878(_0x484ab1['error'][_0x513f('0x1a')]);}logger['error'](_0x513f('0x13'),_0x443bde,_0x484ab1[_0x513f('0x18')][_0x513f('0x1a')]);return _0x88288b(_0x484ab1[_0x513f('0x18')][_0x513f('0x1a')]);}else{logger['info'](_0x513f('0x13'),_0x443bde,_0x513f('0x14'));_0x88288b(_0x484ab1['result'][_0x513f('0x1a')]);}})['catch'](function(_0x2c13d6){logger[_0x513f('0x18')]('UserProfile,\x20%s,\x20%s',_0x443bde,_0x2c13d6);_0x4aa878(_0x2c13d6);});});} \ No newline at end of file +var _0xa3eb=['./userProfile.socket','register','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\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','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x45ec0b,_0x260c5d){var _0x99a3d8=function(_0x524391){while(--_0x524391){_0x45ec0b['push'](_0x45ec0b['shift']());}};_0x99a3d8(++_0x260c5d);}(_0xa3eb,0x1ed));var _0xba3e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa3eb[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0xba3e('0x0'));var util=require(_0xba3e('0x1'));var moment=require(_0xba3e('0x2'));var BPromise=require('bluebird');var rs=require(_0xba3e('0x3'));var fs=require('fs');var Redis=require(_0xba3e('0x4'));var db=require(_0xba3e('0x5'))['db'];var utils=require(_0xba3e('0x6'));var logger=require(_0xba3e('0x7'))(_0xba3e('0x8'));var config=require(_0xba3e('0x9'));var jayson=require(_0xba3e('0xa'));var client=jayson[_0xba3e('0xb')][_0xba3e('0xc')]({'port':0x232a});config[_0xba3e('0xd')]=_[_0xba3e('0xe')](config[_0xba3e('0xd')],{'host':_0xba3e('0xf'),'port':0x18eb});var socket=require(_0xba3e('0x10'))(new Redis(config[_0xba3e('0xd')]));require(_0xba3e('0x11'))[_0xba3e('0x12')](socket);function respondWithRpcPromise(_0x307c74,_0x49e6da,_0xbf982b){return new BPromise(function(_0x400389,_0x132dde){return client['request'](_0x307c74,_0xbf982b)[_0xba3e('0x13')](function(_0x1dd004){logger[_0xba3e('0x14')](_0xba3e('0x15'),_0x49e6da,_0xba3e('0x16'));logger[_0xba3e('0x17')](_0xba3e('0x18'),_0x49e6da,_0xba3e('0x16'),JSON['stringify'](_0x1dd004));if(_0x1dd004['error']){if(_0x1dd004[_0xba3e('0x19')][_0xba3e('0x1a')]===0x1f4){logger[_0xba3e('0x19')]('UserProfile,\x20%s,\x20%s',_0x49e6da,_0x1dd004[_0xba3e('0x19')][_0xba3e('0x1b')]);return _0x132dde(_0x1dd004['error'][_0xba3e('0x1b')]);}logger[_0xba3e('0x19')](_0xba3e('0x15'),_0x49e6da,_0x1dd004['error']['message']);return _0x400389(_0x1dd004[_0xba3e('0x19')]['message']);}else{logger[_0xba3e('0x14')](_0xba3e('0x15'),_0x49e6da,_0xba3e('0x16'));_0x400389(_0x1dd004[_0xba3e('0x1c')][_0xba3e('0x1b')]);}})[_0xba3e('0x1d')](function(_0xca91){logger[_0xba3e('0x19')]('UserProfile,\x20%s,\x20%s',_0x49e6da,_0xca91);_0x132dde(_0xca91);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 903e926..3fb8685 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 _0xd5b8=['register','userProfile:','update','emit','removeListener'];(function(_0x360b0b,_0x512996){var _0x27b779=function(_0x3bf0eb){while(--_0x3bf0eb){_0x360b0b['push'](_0x360b0b['shift']());}};_0x27b779(++_0x512996);}(_0xd5b8,0x156));var _0x8d5b=function(_0x2c7597,_0x649129){_0x2c7597=_0x2c7597-0x0;var _0x444713=_0xd5b8[_0x2c7597];return _0x444713;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=['save','remove',_0x8d5b('0x0')];function createListener(_0x437edf,_0x2aba17){return function(_0x2e2a4c){_0x2aba17[_0x8d5b('0x1')](_0x437edf,_0x2e2a4c);};}function removeListener(_0x243be7,_0x128af2){return function(){UserProfileEvents[_0x8d5b('0x2')](_0x243be7,_0x128af2);};}exports[_0x8d5b('0x3')]=function(_0x4ba492){for(var _0x432852=0x0,_0x276aab=events['length'];_0x432852<_0x276aab;_0x432852++){var _0x2af593=events[_0x432852];var _0x59a52f=createListener(_0x8d5b('0x4')+_0x2af593,_0x4ba492);UserProfileEvents['on'](_0x2af593,_0x59a52f);}}; \ No newline at end of file +var _0xd38e=['register','userProfile:','save','remove','update','emit','removeListener'];(function(_0x5fd828,_0xa7ede9){var _0x3c1eaa=function(_0x55a405){while(--_0x55a405){_0x5fd828['push'](_0x5fd828['shift']());}};_0x3c1eaa(++_0xa7ede9);}(_0xd38e,0x1de));var _0xed38=function(_0x2b4dc9,_0x22c21a){_0x2b4dc9=_0x2b4dc9-0x0;var _0x76b443=_0xd38e[_0x2b4dc9];return _0x76b443;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=[_0xed38('0x0'),_0xed38('0x1'),_0xed38('0x2')];function createListener(_0x430b3e,_0xd28c4a){return function(_0x35d631){_0xd28c4a[_0xed38('0x3')](_0x430b3e,_0x35d631);};}function removeListener(_0x1dd6cb,_0x53f4eb){return function(){UserProfileEvents[_0xed38('0x4')](_0x1dd6cb,_0x53f4eb);};}exports[_0xed38('0x5')]=function(_0x446e3f){for(var _0x187f9d=0x0,_0x26fdff=events['length'];_0x187f9d<_0x26fdff;_0x187f9d++){var _0x375c50=events[_0x187f9d];var _0x317ba4=createListener(_0xed38('0x6')+_0x375c50,_0x446e3f);UserProfileEvents['on'](_0x375c50,_0x317ba4);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 2c42eea..dbae53a 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 _0x42c1=['isAuthenticated','get','/describe','describe','/:id','show','post','create','put','update','delete','exports','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','./userProfileResource.controller'];(function(_0xe09631,_0x25aaa4){var _0x32fe24=function(_0x15dcb6){while(--_0x15dcb6){_0xe09631['push'](_0xe09631['shift']());}};_0x32fe24(++_0x25aaa4);}(_0x42c1,0x9c));var _0x142c=function(_0x35ebd1,_0x21ecda){_0x35ebd1=_0x35ebd1-0x0;var _0x14f2a3=_0x42c1[_0x35ebd1];return _0x14f2a3;};'use strict';var multer=require('multer');var util=require(_0x142c('0x0'));var path=require(_0x142c('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x142c('0x2'));var auth=require(_0x142c('0x3'));var interaction=require(_0x142c('0x4'));var config=require('../../config/environment');var controller=require(_0x142c('0x5'));router['get']('/',auth[_0x142c('0x6')](),controller['index']);router[_0x142c('0x7')](_0x142c('0x8'),auth[_0x142c('0x6')](),controller[_0x142c('0x9')]);router[_0x142c('0x7')](_0x142c('0xa'),auth['isAuthenticated'](),controller[_0x142c('0xb')]);router[_0x142c('0xc')]('/',auth[_0x142c('0x6')](),controller[_0x142c('0xd')]);router[_0x142c('0xe')](_0x142c('0xa'),auth['isAuthenticated'](),controller[_0x142c('0xf')]);router[_0x142c('0x10')](_0x142c('0xa'),auth[_0x142c('0x6')](),controller['destroy']);module[_0x142c('0x11')]=router; \ No newline at end of file +var _0x2d7d=['isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./userProfileResource.controller','get'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0x2d7d,0x114));var _0xd2d7=function(_0x857439,_0x207406){_0x857439=_0x857439-0x0;var _0x197c2=_0x2d7d[_0x857439];return _0x197c2;};'use strict';var multer=require(_0xd2d7('0x0'));var util=require(_0xd2d7('0x1'));var path=require(_0xd2d7('0x2'));var timeout=require(_0xd2d7('0x3'));var express=require('express');var router=express[_0xd2d7('0x4')]();var fs_extra=require(_0xd2d7('0x5'));var auth=require(_0xd2d7('0x6'));var interaction=require(_0xd2d7('0x7'));var config=require('../../config/environment');var controller=require(_0xd2d7('0x8'));router[_0xd2d7('0x9')]('/',auth[_0xd2d7('0xa')](),controller[_0xd2d7('0xb')]);router[_0xd2d7('0x9')](_0xd2d7('0xc'),auth[_0xd2d7('0xa')](),controller[_0xd2d7('0xd')]);router[_0xd2d7('0x9')](_0xd2d7('0xe'),auth[_0xd2d7('0xa')](),controller[_0xd2d7('0xf')]);router[_0xd2d7('0x10')]('/',auth[_0xd2d7('0xa')](),controller[_0xd2d7('0x11')]);router[_0xd2d7('0x12')](_0xd2d7('0xe'),auth[_0xd2d7('0xa')](),controller[_0xd2d7('0x13')]);router['delete'](_0xd2d7('0xe'),auth['isAuthenticated'](),controller[_0xd2d7('0x14')]);module[_0xd2d7('0x15')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index bd3c1f2..b3c7593 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 _0x5386=['sequelize','exports','STRING','INTEGER'];(function(_0x330414,_0x4f3207){var _0x99dbff=function(_0x166f85){while(--_0x166f85){_0x330414['push'](_0x330414['shift']());}};_0x99dbff(++_0x4f3207);}(_0x5386,0x12c));var _0x6538=function(_0x3bbd1f,_0x119571){_0x3bbd1f=_0x3bbd1f-0x0;var _0x4cb1fe=_0x5386[_0x3bbd1f];return _0x4cb1fe;};'use strict';var Sequelize=require(_0x6538('0x0'));module[_0x6538('0x1')]={'name':{'type':Sequelize[_0x6538('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x6538('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x6538('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xac45=['STRING','INTEGER','sequelize','exports'];(function(_0x20070a,_0x3a1abc){var _0x59ca49=function(_0x47d3e7){while(--_0x47d3e7){_0x20070a['push'](_0x20070a['shift']());}};_0x59ca49(++_0x3a1abc);}(_0xac45,0x1b6));var _0x5ac4=function(_0x327811,_0x37ae26){_0x327811=_0x327811-0x0;var _0x1bb2a4=_0xac45[_0x327811];return _0x1bb2a4;};'use strict';var Sequelize=require(_0x5ac4('0x0'));module[_0x5ac4('0x1')]={'name':{'type':Sequelize[_0x5ac4('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x5ac4('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x5ac4('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 ca43f29..71e8823 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 _0x57ca=['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','end','sendStatus','error','stack','name','index','map','UserProfileResource','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','options','includeAll','include','findAll','params','find','catch','create','body','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox'];(function(_0x12f838,_0x3ee44a){var _0x2c03a5=function(_0x211f5b){while(--_0x211f5b){_0x12f838['push'](_0x12f838['shift']());}};_0x2c03a5(++_0x3ee44a);}(_0x57ca,0x108));var _0xa57c=function(_0x45ff3f,_0x2d0760){_0x45ff3f=_0x45ff3f-0x0;var _0x4e5362=_0x57ca[_0x45ff3f];return _0x4e5362;};'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(){_0x42038e[_0xa57c('0x17')](0xcc)[_0xa57c('0x23')]();});}};}function handleEntityNotFound(_0x431bec,_0x511a26){return function(_0x2db443){if(!_0x2db443){_0x431bec[_0xa57c('0x24')](0x194);}return _0x2db443;};}function handleError(_0x27884d,_0x5228b9){_0x5228b9=_0x5228b9||0x1f4;return function(_0x315ad7){logger[_0xa57c('0x25')](_0x315ad7[_0xa57c('0x26')]);if(_0x315ad7[_0xa57c('0x27')]){delete _0x315ad7[_0xa57c('0x27')];}_0x27884d[_0xa57c('0x17')](_0x5228b9)['send'](_0x315ad7);};}exports[_0xa57c('0x28')]=function(_0x4c1478,_0x54a18b){var _0x257661={},_0x7d10ec={},_0x5a3e03={'count':0x0,'rows':[]};var _0x12898b=_[_0xa57c('0x29')](db[_0xa57c('0x2a')]['rawAttributes'],function(_0xd779f1){return{'name':_0xd779f1['fieldName'],'type':_0xd779f1[_0xa57c('0x2b')]['key']};});_0x7d10ec[_0xa57c('0x2c')]=_['map'](_0x12898b,_0xa57c('0x27'));_0x7d10ec['query']=_[_0xa57c('0x2d')](_0x4c1478[_0xa57c('0x2e')]);_0x7d10ec[_0xa57c('0x2f')]=_[_0xa57c('0x30')](_0x7d10ec[_0xa57c('0x2c')],_0x7d10ec[_0xa57c('0x2e')]);_0x257661[_0xa57c('0x31')]=_['intersection'](_0x7d10ec[_0xa57c('0x2c')],qs['fields'](_0x4c1478[_0xa57c('0x2e')][_0xa57c('0x32')]));_0x257661[_0xa57c('0x31')]=_0x257661['attributes'][_0xa57c('0x33')]?_0x257661['attributes']:_0x7d10ec[_0xa57c('0x2c')];if(!_0x4c1478['query'][_0xa57c('0x34')]('nolimit')){_0x257661[_0xa57c('0x1c')]=qs[_0xa57c('0x1c')](_0x4c1478['query'][_0xa57c('0x1c')]);_0x257661['offset']=qs[_0xa57c('0x19')](_0x4c1478['query'][_0xa57c('0x19')]);}_0x257661[_0xa57c('0x35')]=qs[_0xa57c('0x36')](_0x4c1478[_0xa57c('0x2e')][_0xa57c('0x36')]);_0x257661[_0xa57c('0x37')]=qs['filters'](_['pick'](_0x4c1478[_0xa57c('0x2e')],_0x7d10ec[_0xa57c('0x2f')]),_0x12898b);if(_0x4c1478[_0xa57c('0x2e')]['filter']){_0x257661[_0xa57c('0x37')]=_['merge'](_0x257661[_0xa57c('0x37')],{'$or':_[_0xa57c('0x29')](_0x12898b,function(_0x5c8256){if(_0x5c8256['type']!=='VIRTUAL'){var _0x3be888={};_0x3be888[_0x5c8256[_0xa57c('0x27')]]={'$like':'%'+_0x4c1478[_0xa57c('0x2e')][_0xa57c('0x38')]+'%'};return _0x3be888;}})});}_0x257661=_[_0xa57c('0x39')]({},_0x257661,_0x4c1478[_0xa57c('0x3a')]);var _0x5a444a={'where':_0x257661[_0xa57c('0x37')]};return db[_0xa57c('0x2a')]['count'](_0x5a444a)['then'](function(_0x5e10b){_0x5a3e03[_0xa57c('0x1b')]=_0x5e10b;if(_0x4c1478['query'][_0xa57c('0x3b')]){_0x257661[_0xa57c('0x3c')]=[{'all':!![]}];}return db[_0xa57c('0x2a')][_0xa57c('0x3d')](_0x257661);})[_0xa57c('0x21')](function(_0x43c1d7){_0x5a3e03['rows']=_0x43c1d7;return _0x5a3e03;})[_0xa57c('0x21')](respondWithFilteredResult(_0x54a18b,_0x257661))['catch'](handleError(_0x54a18b,null));};exports['show']=function(_0x5b3300,_0x520383){var _0x588199={'raw':![],'where':{'id':_0x5b3300[_0xa57c('0x3e')]['id']}},_0x39b20f={};_0x39b20f[_0xa57c('0x2c')]=_['keys'](db['UserProfileResource']['rawAttributes']);_0x39b20f[_0xa57c('0x2e')]=_[_0xa57c('0x2d')](_0x5b3300[_0xa57c('0x2e')]);_0x39b20f[_0xa57c('0x2f')]=_[_0xa57c('0x30')](_0x39b20f[_0xa57c('0x2c')],_0x39b20f['query']);_0x588199[_0xa57c('0x31')]=_[_0xa57c('0x30')](_0x39b20f[_0xa57c('0x2c')],qs[_0xa57c('0x32')](_0x5b3300[_0xa57c('0x2e')][_0xa57c('0x32')]));_0x588199['attributes']=_0x588199[_0xa57c('0x31')][_0xa57c('0x33')]?_0x588199[_0xa57c('0x31')]:_0x39b20f[_0xa57c('0x2c')];if(_0x5b3300[_0xa57c('0x2e')]['includeAll']){_0x588199[_0xa57c('0x3c')]=[{'all':!![]}];}_0x588199=_[_0xa57c('0x39')]({},_0x588199,_0x5b3300[_0xa57c('0x3a')]);return db[_0xa57c('0x2a')][_0xa57c('0x3f')](_0x588199)[_0xa57c('0x21')](handleEntityNotFound(_0x520383,null))['then'](respondWithResult(_0x520383,null))[_0xa57c('0x40')](handleError(_0x520383,null));};exports[_0xa57c('0x41')]=function(_0x247906,_0x44ea0a){return db[_0xa57c('0x2a')][_0xa57c('0x41')](_0x247906['body'],{})['then'](respondWithResult(_0x44ea0a,0xc9))['catch'](handleError(_0x44ea0a,null));};exports['update']=function(_0x232675,_0x49492f){if(_0x232675[_0xa57c('0x42')]['id']){delete _0x232675[_0xa57c('0x42')]['id'];}return db['UserProfileResource'][_0xa57c('0x3f')]({'where':{'id':_0x232675[_0xa57c('0x3e')]['id']}})[_0xa57c('0x21')](handleEntityNotFound(_0x49492f,null))[_0xa57c('0x21')](saveUpdates(_0x232675[_0xa57c('0x42')],null))['then'](respondWithResult(_0x49492f,null))[_0xa57c('0x40')](handleError(_0x49492f,null));};exports[_0xa57c('0x22')]=function(_0x4584e8,_0xd57bac){return db[_0xa57c('0x2a')]['find']({'where':{'id':_0x4584e8[_0xa57c('0x3e')]['id']}})['then'](handleEntityNotFound(_0xd57bac,null))['then'](removeEntity(_0xd57bac,null))[_0xa57c('0x40')](handleError(_0xd57bac,null));};exports[_0xa57c('0x43')]=function(_0x5ded49,_0x5bf336){return db['UserProfileResource'][_0xa57c('0x43')]()[_0xa57c('0x21')](respondWithResult(_0x5bf336,null))[_0xa57c('0x40')](handleError(_0x5bf336,null));}; \ No newline at end of file +var _0x6343=['VIRTUAL','options','UserProfileResource','then','rows','catch','show','params','keys','includeAll','include','create','body','find','describe','zip-dir','fast-json-patch','util','path','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','destroy','stack','send','map','rawAttributes','fieldName','type','key','model','name','filters','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','where','filter','merge'];(function(_0xf9a6cf,_0x11870e){var _0x59e2bc=function(_0x1cd606){while(--_0x1cd606){_0xf9a6cf['push'](_0xf9a6cf['shift']());}};_0x59e2bc(++_0x11870e);}(_0x6343,0x168));var _0x3634=function(_0x4c579f,_0xc2b922){_0x4c579f=_0x4c579f-0x0;var _0x326ad1=_0x6343[_0x4c579f];return _0x326ad1;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3634('0x0'));var jsonpatch=require(_0x3634('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3634('0x2'));var path=require(_0x3634('0x3'));var sox=require('sox');var csv=require(_0x3634('0x4'));var ejs=require(_0x3634('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3634('0x6'));var squel=require(_0x3634('0x7'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3634('0x8'));var toCsv=require(_0x3634('0x4'));var querystring=require(_0x3634('0x9'));var Papa=require(_0x3634('0xa'));var Redis=require(_0x3634('0xb'));var authService=require(_0x3634('0xc'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3634('0xd'));var logger=require(_0x3634('0xe'))('api');var utils=require(_0x3634('0xf'));var config=require(_0x3634('0x10'));var licenseUtil=require(_0x3634('0x11'));var db=require(_0x3634('0x12'))['db'];function respondWithStatusCode(_0x1e6a04,_0x151c8c){_0x151c8c=_0x151c8c||0xcc;return function(_0x35ae07){if(_0x35ae07){return _0x1e6a04[_0x3634('0x13')](_0x151c8c);}return _0x1e6a04[_0x3634('0x14')](_0x151c8c)[_0x3634('0x15')]();};}function respondWithResult(_0x299e53,_0x71d09b){_0x71d09b=_0x71d09b||0xc8;return function(_0x7e4801){if(_0x7e4801){return _0x299e53[_0x3634('0x14')](_0x71d09b)['json'](_0x7e4801);}};}function respondWithFilteredResult(_0x167247,_0x48787f){return function(_0x69609d){if(_0x69609d){var _0x18285c=typeof _0x48787f[_0x3634('0x16')]===_0x3634('0x17')&&typeof _0x48787f[_0x3634('0x18')]==='undefined';var _0x3121a3=_0x69609d['count'];var _0x50350d=_0x18285c?0x0:_0x48787f[_0x3634('0x16')];var _0x4b2115=_0x18285c?_0x69609d[_0x3634('0x19')]:_0x48787f[_0x3634('0x16')]+_0x48787f[_0x3634('0x18')];var _0x5603d2;if(_0x4b2115>=_0x3121a3){_0x4b2115=_0x3121a3;_0x5603d2=0xc8;}else{_0x5603d2=0xce;}_0x167247[_0x3634('0x14')](_0x5603d2);return _0x167247[_0x3634('0x1a')]('Content-Range',_0x50350d+'-'+_0x4b2115+'/'+_0x3121a3)[_0x3634('0x1b')](_0x69609d);}return null;};}function patchUpdates(_0x506281){return function(_0x742e56){try{jsonpatch[_0x3634('0x1c')](_0x742e56,_0x506281,!![]);}catch(_0x5b77a7){return BPromise[_0x3634('0x1d')](_0x5b77a7);}return _0x742e56[_0x3634('0x1e')]();};}function saveUpdates(_0x206c8e,_0x505026){return function(_0x22b7ef){if(_0x22b7ef){return _0x22b7ef[_0x3634('0x1f')](_0x206c8e)['then'](function(_0x3936ee){return _0x3936ee;});}return null;};}function removeEntity(_0x596acb,_0x5e9188){return function(_0x3a8c41){if(_0x3a8c41){return _0x3a8c41[_0x3634('0x20')]()['then'](function(){_0x596acb[_0x3634('0x14')](0xcc)[_0x3634('0x15')]();});}};}function handleEntityNotFound(_0x17db44,_0x225ddc){return function(_0x363ca2){if(!_0x363ca2){_0x17db44[_0x3634('0x13')](0x194);}return _0x363ca2;};}function handleError(_0x38e863,_0x4762b1){_0x4762b1=_0x4762b1||0x1f4;return function(_0x22f1f1){logger['error'](_0x22f1f1[_0x3634('0x21')]);if(_0x22f1f1['name']){delete _0x22f1f1['name'];}_0x38e863['status'](_0x4762b1)[_0x3634('0x22')](_0x22f1f1);};}exports['index']=function(_0x3bf28b,_0x12b80e){var _0x49804f={},_0x55a77f={},_0x282f73={'count':0x0,'rows':[]};var _0x5bd4e0=_[_0x3634('0x23')](db['UserProfileResource'][_0x3634('0x24')],function(_0x3d7322){return{'name':_0x3d7322[_0x3634('0x25')],'type':_0x3d7322[_0x3634('0x26')][_0x3634('0x27')]};});_0x55a77f[_0x3634('0x28')]=_[_0x3634('0x23')](_0x5bd4e0,_0x3634('0x29'));_0x55a77f['query']=_['keys'](_0x3bf28b['query']);_0x55a77f[_0x3634('0x2a')]=_['intersection'](_0x55a77f[_0x3634('0x28')],_0x55a77f[_0x3634('0x2b')]);_0x49804f[_0x3634('0x2c')]=_[_0x3634('0x2d')](_0x55a77f[_0x3634('0x28')],qs[_0x3634('0x2e')](_0x3bf28b['query'][_0x3634('0x2e')]));_0x49804f[_0x3634('0x2c')]=_0x49804f[_0x3634('0x2c')][_0x3634('0x2f')]?_0x49804f[_0x3634('0x2c')]:_0x55a77f[_0x3634('0x28')];if(!_0x3bf28b[_0x3634('0x2b')][_0x3634('0x30')](_0x3634('0x31'))){_0x49804f['limit']=qs[_0x3634('0x18')](_0x3bf28b[_0x3634('0x2b')][_0x3634('0x18')]);_0x49804f[_0x3634('0x16')]=qs['offset'](_0x3bf28b[_0x3634('0x2b')][_0x3634('0x16')]);}_0x49804f[_0x3634('0x32')]=qs['sort'](_0x3bf28b['query']['sort']);_0x49804f[_0x3634('0x33')]=qs[_0x3634('0x2a')](_['pick'](_0x3bf28b[_0x3634('0x2b')],_0x55a77f[_0x3634('0x2a')]),_0x5bd4e0);if(_0x3bf28b[_0x3634('0x2b')][_0x3634('0x34')]){_0x49804f[_0x3634('0x33')]=_[_0x3634('0x35')](_0x49804f[_0x3634('0x33')],{'$or':_['map'](_0x5bd4e0,function(_0x416987){if(_0x416987['type']!==_0x3634('0x36')){var _0x3ae966={};_0x3ae966[_0x416987[_0x3634('0x29')]]={'$like':'%'+_0x3bf28b[_0x3634('0x2b')][_0x3634('0x34')]+'%'};return _0x3ae966;}})});}_0x49804f=_['merge']({},_0x49804f,_0x3bf28b[_0x3634('0x37')]);var _0x33af29={'where':_0x49804f[_0x3634('0x33')]};return db[_0x3634('0x38')][_0x3634('0x19')](_0x33af29)[_0x3634('0x39')](function(_0x28c8d0){_0x282f73[_0x3634('0x19')]=_0x28c8d0;if(_0x3bf28b[_0x3634('0x2b')]['includeAll']){_0x49804f['include']=[{'all':!![]}];}return db[_0x3634('0x38')]['findAll'](_0x49804f);})['then'](function(_0x5948db){_0x282f73[_0x3634('0x3a')]=_0x5948db;return _0x282f73;})['then'](respondWithFilteredResult(_0x12b80e,_0x49804f))[_0x3634('0x3b')](handleError(_0x12b80e,null));};exports[_0x3634('0x3c')]=function(_0x53c1ea,_0x505be7){var _0x4896ab={'raw':![],'where':{'id':_0x53c1ea[_0x3634('0x3d')]['id']}},_0x324970={};_0x324970['model']=_[_0x3634('0x3e')](db[_0x3634('0x38')][_0x3634('0x24')]);_0x324970[_0x3634('0x2b')]=_[_0x3634('0x3e')](_0x53c1ea['query']);_0x324970['filters']=_[_0x3634('0x2d')](_0x324970[_0x3634('0x28')],_0x324970[_0x3634('0x2b')]);_0x4896ab[_0x3634('0x2c')]=_[_0x3634('0x2d')](_0x324970[_0x3634('0x28')],qs['fields'](_0x53c1ea[_0x3634('0x2b')][_0x3634('0x2e')]));_0x4896ab[_0x3634('0x2c')]=_0x4896ab['attributes']['length']?_0x4896ab[_0x3634('0x2c')]:_0x324970[_0x3634('0x28')];if(_0x53c1ea[_0x3634('0x2b')][_0x3634('0x3f')]){_0x4896ab[_0x3634('0x40')]=[{'all':!![]}];}_0x4896ab=_[_0x3634('0x35')]({},_0x4896ab,_0x53c1ea[_0x3634('0x37')]);return db[_0x3634('0x38')]['find'](_0x4896ab)[_0x3634('0x39')](handleEntityNotFound(_0x505be7,null))[_0x3634('0x39')](respondWithResult(_0x505be7,null))[_0x3634('0x3b')](handleError(_0x505be7,null));};exports[_0x3634('0x41')]=function(_0x615276,_0x151654){return db[_0x3634('0x38')][_0x3634('0x41')](_0x615276[_0x3634('0x42')],{})['then'](respondWithResult(_0x151654,0xc9))[_0x3634('0x3b')](handleError(_0x151654,null));};exports[_0x3634('0x1f')]=function(_0x4a4a94,_0x3c356b){if(_0x4a4a94[_0x3634('0x42')]['id']){delete _0x4a4a94[_0x3634('0x42')]['id'];}return db[_0x3634('0x38')][_0x3634('0x43')]({'where':{'id':_0x4a4a94[_0x3634('0x3d')]['id']}})['then'](handleEntityNotFound(_0x3c356b,null))[_0x3634('0x39')](saveUpdates(_0x4a4a94[_0x3634('0x42')],null))[_0x3634('0x39')](respondWithResult(_0x3c356b,null))[_0x3634('0x3b')](handleError(_0x3c356b,null));};exports[_0x3634('0x20')]=function(_0x582475,_0x66f6a4){return db[_0x3634('0x38')]['find']({'where':{'id':_0x582475['params']['id']}})[_0x3634('0x39')](handleEntityNotFound(_0x66f6a4,null))['then'](removeEntity(_0x66f6a4,null))[_0x3634('0x3b')](handleError(_0x66f6a4,null));};exports[_0x3634('0x44')]=function(_0x1943a5,_0x1834a3){return db['UserProfileResource'][_0x3634('0x44')]()[_0x3634('0x39')](respondWithResult(_0x1834a3,null))[_0x3634('0x3b')](handleError(_0x1834a3,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 2c23544..32f143b 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 _0xf982=['bluebird','request-promise','path','rimraf','exports','define','UserProfileResource','compositeIndex','resourceId','sectionId','lodash','util','../../config/logger','api','moment'];(function(_0x27e3e4,_0x439e79){var _0x266507=function(_0x2a6057){while(--_0x2a6057){_0x27e3e4['push'](_0x27e3e4['shift']());}};_0x266507(++_0x439e79);}(_0xf982,0x19f));var _0x2f98=function(_0x3fd457,_0x504ec9){_0x3fd457=_0x3fd457-0x0;var _0x443ce9=_0xf982[_0x3fd457];return _0x443ce9;};'use strict';var _=require(_0x2f98('0x0'));var util=require(_0x2f98('0x1'));var logger=require(_0x2f98('0x2'))(_0x2f98('0x3'));var moment=require(_0x2f98('0x4'));var BPromise=require(_0x2f98('0x5'));var rp=require(_0x2f98('0x6'));var fs=require('fs');var path=require(_0x2f98('0x7'));var rimraf=require(_0x2f98('0x8'));var config=require('../../config/environment');var attributes=require('./userProfileResource.attributes');module[_0x2f98('0x9')]=function(_0x4baee2,_0x2d5106){return _0x4baee2[_0x2f98('0xa')](_0x2f98('0xb'),attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':_0x2f98('0xc'),'fields':[_0x2f98('0xd'),_0x2f98('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0e10=['./userProfileResource.attributes','exports','define','UserProfileResource','user_profile_has_resources','compositeIndex','sectionId','lodash','util','../../config/logger','api','bluebird','request-promise','../../config/environment'];(function(_0x384e6f,_0x1e8ca1){var _0x1e00d4=function(_0x5782de){while(--_0x5782de){_0x384e6f['push'](_0x384e6f['shift']());}};_0x1e00d4(++_0x1e8ca1);}(_0x0e10,0x103));var _0x00e1=function(_0x3639a4,_0x3a614){_0x3639a4=_0x3639a4-0x0;var _0x545333=_0x0e10[_0x3639a4];return _0x545333;};'use strict';var _=require(_0x00e1('0x0'));var util=require(_0x00e1('0x1'));var logger=require(_0x00e1('0x2'))(_0x00e1('0x3'));var moment=require('moment');var BPromise=require(_0x00e1('0x4'));var rp=require(_0x00e1('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x00e1('0x6'));var attributes=require(_0x00e1('0x7'));module[_0x00e1('0x8')]=function(_0xfac205,_0x48c883){return _0xfac205[_0x00e1('0x9')](_0x00e1('0xa'),attributes,{'tableName':_0x00e1('0xb'),'paranoid':![],'indexes':[{'name':_0x00e1('0xc'),'fields':['resourceId',_0x00e1('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index c92b3f3..1b5261f 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 _0x6ebd=['../../config/environment','jayson/promise','client','http','request','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x47b999,_0x4a0575){var _0x1099dc=function(_0x49f6c0){while(--_0x49f6c0){_0x47b999['push'](_0x47b999['shift']());}};_0x1099dc(++_0x4a0575);}(_0x6ebd,0x9b));var _0xd6eb=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x6ebd[_0x4243a3];return _0x1b2a33;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd6eb('0x0'));var BPromise=require(_0xd6eb('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd6eb('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xd6eb('0x3'));var logger=require(_0xd6eb('0x4'))(_0xd6eb('0x5'));var config=require(_0xd6eb('0x6'));var jayson=require(_0xd6eb('0x7'));var client=jayson[_0xd6eb('0x8')][_0xd6eb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2c8f39,_0x43ff77,_0x21bfe6){return new BPromise(function(_0x5d5230,_0x4c66fe){return client[_0xd6eb('0xa')](_0x2c8f39,_0x21bfe6)[_0xd6eb('0xb')](function(_0x4b05ef){logger[_0xd6eb('0xc')](_0xd6eb('0xd'),_0x43ff77,_0xd6eb('0xe'));logger[_0xd6eb('0xf')](_0xd6eb('0x10'),_0x43ff77,_0xd6eb('0xe'),JSON[_0xd6eb('0x11')](_0x4b05ef));if(_0x4b05ef[_0xd6eb('0x12')]){if(_0x4b05ef[_0xd6eb('0x12')][_0xd6eb('0x13')]===0x1f4){logger['error'](_0xd6eb('0xd'),_0x43ff77,_0x4b05ef[_0xd6eb('0x12')][_0xd6eb('0x14')]);return _0x4c66fe(_0x4b05ef[_0xd6eb('0x12')]['message']);}logger['error'](_0xd6eb('0xd'),_0x43ff77,_0x4b05ef[_0xd6eb('0x12')][_0xd6eb('0x14')]);return _0x5d5230(_0x4b05ef[_0xd6eb('0x12')][_0xd6eb('0x14')]);}else{logger[_0xd6eb('0xc')](_0xd6eb('0xd'),_0x43ff77,_0xd6eb('0xe'));_0x5d5230(_0x4b05ef[_0xd6eb('0x15')]['message']);}})[_0xd6eb('0x16')](function(_0x128be3){logger[_0xd6eb('0x12')](_0xd6eb('0xd'),_0x43ff77,_0x128be3);_0x4c66fe(_0x128be3);});});} \ No newline at end of file +var _0x4037=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','info','UserProfileResource,\x20%s,\x20%s','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x4037,0x110));var _0x7403=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x4037[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x7403('0x0'));var util=require('util');var moment=require(_0x7403('0x1'));var BPromise=require('bluebird');var rs=require(_0x7403('0x2'));var fs=require('fs');var Redis=require(_0x7403('0x3'));var db=require(_0x7403('0x4'))['db'];var utils=require(_0x7403('0x5'));var logger=require('../../config/logger')(_0x7403('0x6'));var config=require(_0x7403('0x7'));var jayson=require(_0x7403('0x8'));var client=jayson[_0x7403('0x9')][_0x7403('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x12be74,_0x1ef63c,_0x38d4f0){return new BPromise(function(_0x54a707,_0x2cbb00){return client['request'](_0x12be74,_0x38d4f0)['then'](function(_0x5d3e05){logger[_0x7403('0xb')](_0x7403('0xc'),_0x1ef63c,'request\x20sent');logger[_0x7403('0xd')](_0x7403('0xe'),_0x1ef63c,_0x7403('0xf'),JSON['stringify'](_0x5d3e05));if(_0x5d3e05[_0x7403('0x10')]){if(_0x5d3e05['error'][_0x7403('0x11')]===0x1f4){logger[_0x7403('0x10')](_0x7403('0xc'),_0x1ef63c,_0x5d3e05[_0x7403('0x10')][_0x7403('0x12')]);return _0x2cbb00(_0x5d3e05[_0x7403('0x10')][_0x7403('0x12')]);}logger[_0x7403('0x10')]('UserProfileResource,\x20%s,\x20%s',_0x1ef63c,_0x5d3e05['error'][_0x7403('0x12')]);return _0x54a707(_0x5d3e05[_0x7403('0x10')][_0x7403('0x12')]);}else{logger[_0x7403('0xb')]('UserProfileResource,\x20%s,\x20%s',_0x1ef63c,_0x7403('0xf'));_0x54a707(_0x5d3e05[_0x7403('0x13')][_0x7403('0x12')]);}})[_0x7403('0x14')](function(_0x5cc43d){logger[_0x7403('0x10')]('UserProfileResource,\x20%s,\x20%s',_0x1ef63c,_0x5cc43d);_0x2cbb00(_0x5cc43d);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 3afe41c..521204b 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 _0xada1=['./userProfileSection.controller','get','isAuthenticated','/describe','describe','show','post','put','/:id','update','destroy','exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x328681,_0x5c8d83){var _0x4f618d=function(_0x302194){while(--_0x302194){_0x328681['push'](_0x328681['shift']());}};_0x4f618d(++_0x5c8d83);}(_0xada1,0x13c));var _0x1ada=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0xada1[_0x1deb03];return _0x189fe7;};'use strict';var multer=require(_0x1ada('0x0'));var util=require(_0x1ada('0x1'));var path=require('path');var timeout=require(_0x1ada('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x1ada('0x3'));var auth=require(_0x1ada('0x4'));var interaction=require(_0x1ada('0x5'));var config=require(_0x1ada('0x6'));var controller=require(_0x1ada('0x7'));router[_0x1ada('0x8')]('/',auth[_0x1ada('0x9')](),controller['index']);router['get'](_0x1ada('0xa'),auth[_0x1ada('0x9')](),controller[_0x1ada('0xb')]);router[_0x1ada('0x8')]('/:id',auth[_0x1ada('0x9')](),controller[_0x1ada('0xc')]);router[_0x1ada('0xd')]('/',auth[_0x1ada('0x9')](),controller['create']);router[_0x1ada('0xe')](_0x1ada('0xf'),auth['isAuthenticated'](),controller[_0x1ada('0x10')]);router['delete'](_0x1ada('0xf'),auth[_0x1ada('0x9')](),controller[_0x1ada('0x11')]);module[_0x1ada('0x12')]=router; \ No newline at end of file +var _0x50e9=['../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','index','/describe','describe','show','post','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','Router'];(function(_0x3b865d,_0x380a7f){var _0xa36bdd=function(_0x117456){while(--_0x117456){_0x3b865d['push'](_0x3b865d['shift']());}};_0xa36bdd(++_0x380a7f);}(_0x50e9,0x69));var _0x950e=function(_0x217f37,_0x3489bf){_0x217f37=_0x217f37-0x0;var _0x2bf37e=_0x50e9[_0x217f37];return _0x2bf37e;};'use strict';var multer=require(_0x950e('0x0'));var util=require(_0x950e('0x1'));var path=require(_0x950e('0x2'));var timeout=require(_0x950e('0x3'));var express=require('express');var router=express[_0x950e('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x950e('0x5'));var interaction=require(_0x950e('0x6'));var config=require(_0x950e('0x7'));var controller=require(_0x950e('0x8'));router[_0x950e('0x9')]('/',auth[_0x950e('0xa')](),controller[_0x950e('0xb')]);router[_0x950e('0x9')](_0x950e('0xc'),auth[_0x950e('0xa')](),controller[_0x950e('0xd')]);router[_0x950e('0x9')]('/:id',auth[_0x950e('0xa')](),controller[_0x950e('0xe')]);router[_0x950e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x950e('0x10')](_0x950e('0x11'),auth[_0x950e('0xa')](),controller[_0x950e('0x12')]);router[_0x950e('0x13')](_0x950e('0x11'),auth['isAuthenticated'](),controller[_0x950e('0x14')]);module[_0x950e('0x15')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index e6601de..38d1c9c 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 _0x9348=['exports','STRING','INTEGER','BOOLEAN','setDataValue','crudPermissions','join','getDataValue','split','sequelize'];(function(_0x50ccc5,_0x582889){var _0x3f961e=function(_0x3601a8){while(--_0x3601a8){_0x50ccc5['push'](_0x50ccc5['shift']());}};_0x3f961e(++_0x582889);}(_0x9348,0x10d));var _0x8934=function(_0x34b0fc,_0x30eb12){_0x34b0fc=_0x34b0fc-0x0;var _0x11deb0=_0x9348[_0x34b0fc];return _0x11deb0;};'use strict';var Sequelize=require(_0x8934('0x0'));module[_0x8934('0x1')]={'name':{'type':Sequelize[_0x8934('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0x8934('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x8934('0x3')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x8934('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x8934('0x2')],'set':function(_0x5f34d7){this[_0x8934('0x5')](_0x8934('0x6'),_0x5f34d7?_0x5f34d7[_0x8934('0x7')](''):[]);},'get':function(){return this[_0x8934('0x8')](_0x8934('0x6'))?this[_0x8934('0x8')]('crudPermissions')[_0x8934('0x9')](''):[];}}}; \ No newline at end of file +var _0xbc9d=['sequelize','exports','STRING','INTEGER','setDataValue','crudPermissions','join','getDataValue','split'];(function(_0x23e6bb,_0x5c2d69){var _0x1e3b4c=function(_0x1afc46){while(--_0x1afc46){_0x23e6bb['push'](_0x23e6bb['shift']());}};_0x1e3b4c(++_0x5c2d69);}(_0xbc9d,0xb4));var _0xdbc9=function(_0x48e885,_0x1b7f8a){_0x48e885=_0x48e885-0x0;var _0x3830a4=_0xbc9d[_0x48e885];return _0x3830a4;};'use strict';var Sequelize=require(_0xdbc9('0x0'));module[_0xdbc9('0x1')]={'name':{'type':Sequelize[_0xdbc9('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0xdbc9('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0xdbc9('0x3')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x2aba48){this[_0xdbc9('0x4')](_0xdbc9('0x5'),_0x2aba48?_0x2aba48[_0xdbc9('0x6')](''):[]);},'get':function(){return this[_0xdbc9('0x7')](_0xdbc9('0x5'))?this[_0xdbc9('0x7')]('crudPermissions')[_0xdbc9('0x8')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 1bc7f54..55ddcbe 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 _0xf49d=['body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','squel','jsforce','desk.js','papaparse','ioredis','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','UserProfileSection','rawAttributes','type','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','VIRTUAL','options','includeAll','rows','catch','show','params','include','merge','find'];(function(_0x33118f,_0x22ae0f){var _0xc37216=function(_0x4cc32c){while(--_0x4cc32c){_0x33118f['push'](_0x33118f['shift']());}};_0xc37216(++_0x22ae0f);}(_0xf49d,0x1ec));var _0xdf49=function(_0x6662db,_0x429184){_0x6662db=_0x6662db-0x0;var _0x1f9c5d=_0xf49d[_0x6662db];return _0x1f9c5d;};'use strict';var emlformat=require(_0xdf49('0x0'));var rimraf=require(_0xdf49('0x1'));var zipdir=require(_0xdf49('0x2'));var jsonpatch=require(_0xdf49('0x3'));var rp=require(_0xdf49('0x4'));var moment=require(_0xdf49('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xdf49('0x6'));var util=require('util');var path=require(_0xdf49('0x7'));var sox=require(_0xdf49('0x8'));var csv=require(_0xdf49('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xdf49('0xa'));var crypto=require('crypto');var jsforce=require(_0xdf49('0xb'));var deskjs=require(_0xdf49('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xdf49('0xd'));var Redis=require(_0xdf49('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xdf49('0xf'));var utils=require(_0xdf49('0x10'));var config=require(_0xdf49('0x11'));var licenseUtil=require(_0xdf49('0x12'));var db=require(_0xdf49('0x13'))['db'];function respondWithStatusCode(_0x34a3da,_0x306b63){_0x306b63=_0x306b63||0xcc;return function(_0x10e1e2){if(_0x10e1e2){return _0x34a3da[_0xdf49('0x14')](_0x306b63);}return _0x34a3da[_0xdf49('0x15')](_0x306b63)['end']();};}function respondWithResult(_0x321478,_0x5f121d){_0x5f121d=_0x5f121d||0xc8;return function(_0x17fadb){if(_0x17fadb){return _0x321478[_0xdf49('0x15')](_0x5f121d)[_0xdf49('0x16')](_0x17fadb);}};}function respondWithFilteredResult(_0x95f337,_0x28e687){return function(_0x517a6f){if(_0x517a6f){var _0x380a84=typeof _0x28e687['offset']===_0xdf49('0x17')&&typeof _0x28e687[_0xdf49('0x18')]===_0xdf49('0x17');var _0x1d2eb2=_0x517a6f['count'];var _0x539688=_0x380a84?0x0:_0x28e687[_0xdf49('0x19')];var _0x5c3f7e=_0x380a84?_0x517a6f[_0xdf49('0x1a')]:_0x28e687[_0xdf49('0x19')]+_0x28e687[_0xdf49('0x18')];var _0xeae015;if(_0x5c3f7e>=_0x1d2eb2){_0x5c3f7e=_0x1d2eb2;_0xeae015=0xc8;}else{_0xeae015=0xce;}_0x95f337[_0xdf49('0x15')](_0xeae015);return _0x95f337[_0xdf49('0x1b')](_0xdf49('0x1c'),_0x539688+'-'+_0x5c3f7e+'/'+_0x1d2eb2)['json'](_0x517a6f);}return null;};}function patchUpdates(_0x59576c){return function(_0x18edeb){try{jsonpatch[_0xdf49('0x1d')](_0x18edeb,_0x59576c,!![]);}catch(_0x2e1bdb){return BPromise[_0xdf49('0x1e')](_0x2e1bdb);}return _0x18edeb[_0xdf49('0x1f')]();};}function saveUpdates(_0x3935fc,_0x3702aa){return function(_0xd55591){if(_0xd55591){return _0xd55591[_0xdf49('0x20')](_0x3935fc)[_0xdf49('0x21')](function(_0x1df2e7){return _0x1df2e7;});}return null;};}function removeEntity(_0x564804,_0x3401a3){return function(_0x296ad9){if(_0x296ad9){return _0x296ad9[_0xdf49('0x22')]()[_0xdf49('0x21')](function(){_0x564804[_0xdf49('0x15')](0xcc)[_0xdf49('0x23')]();});}};}function handleEntityNotFound(_0x12a0da,_0x535632){return function(_0x47fe48){if(!_0x47fe48){_0x12a0da['sendStatus'](0x194);}return _0x47fe48;};}function handleError(_0x3eee14,_0x44ef8d){_0x44ef8d=_0x44ef8d||0x1f4;return function(_0x1cfacc){logger[_0xdf49('0x24')](_0x1cfacc[_0xdf49('0x25')]);if(_0x1cfacc[_0xdf49('0x26')]){delete _0x1cfacc[_0xdf49('0x26')];}_0x3eee14[_0xdf49('0x15')](_0x44ef8d)[_0xdf49('0x27')](_0x1cfacc);};}exports[_0xdf49('0x28')]=function(_0x38a039,_0x2e18c8){var _0x1a6252={},_0x4c6ff5={},_0x2bec5d={'count':0x0,'rows':[]};var _0x23504b=_[_0xdf49('0x29')](db[_0xdf49('0x2a')][_0xdf49('0x2b')],function(_0x433613){return{'name':_0x433613['fieldName'],'type':_0x433613[_0xdf49('0x2c')]['key']};});_0x4c6ff5['model']=_[_0xdf49('0x29')](_0x23504b,_0xdf49('0x26'));_0x4c6ff5[_0xdf49('0x2d')]=_[_0xdf49('0x2e')](_0x38a039[_0xdf49('0x2d')]);_0x4c6ff5['filters']=_[_0xdf49('0x2f')](_0x4c6ff5[_0xdf49('0x30')],_0x4c6ff5[_0xdf49('0x2d')]);_0x1a6252[_0xdf49('0x31')]=_[_0xdf49('0x2f')](_0x4c6ff5[_0xdf49('0x30')],qs[_0xdf49('0x32')](_0x38a039[_0xdf49('0x2d')][_0xdf49('0x32')]));_0x1a6252['attributes']=_0x1a6252[_0xdf49('0x31')][_0xdf49('0x33')]?_0x1a6252[_0xdf49('0x31')]:_0x4c6ff5[_0xdf49('0x30')];if(!_0x38a039['query'][_0xdf49('0x34')](_0xdf49('0x35'))){_0x1a6252[_0xdf49('0x18')]=qs[_0xdf49('0x18')](_0x38a039['query'][_0xdf49('0x18')]);_0x1a6252[_0xdf49('0x19')]=qs[_0xdf49('0x19')](_0x38a039[_0xdf49('0x2d')][_0xdf49('0x19')]);}_0x1a6252['order']=qs[_0xdf49('0x36')](_0x38a039[_0xdf49('0x2d')][_0xdf49('0x36')]);_0x1a6252[_0xdf49('0x37')]=qs[_0xdf49('0x38')](_['pick'](_0x38a039['query'],_0x4c6ff5[_0xdf49('0x38')]),_0x23504b);if(_0x38a039['query'][_0xdf49('0x39')]){_0x1a6252[_0xdf49('0x37')]=_['merge'](_0x1a6252['where'],{'$or':_[_0xdf49('0x29')](_0x23504b,function(_0x3665f9){if(_0x3665f9[_0xdf49('0x2c')]!==_0xdf49('0x3a')){var _0x5e20f0={};_0x5e20f0[_0x3665f9['name']]={'$like':'%'+_0x38a039['query']['filter']+'%'};return _0x5e20f0;}})});}_0x1a6252=_['merge']({},_0x1a6252,_0x38a039[_0xdf49('0x3b')]);var _0x2d8668={'where':_0x1a6252[_0xdf49('0x37')]};return db[_0xdf49('0x2a')][_0xdf49('0x1a')](_0x2d8668)[_0xdf49('0x21')](function(_0x4f0fa4){_0x2bec5d[_0xdf49('0x1a')]=_0x4f0fa4;if(_0x38a039[_0xdf49('0x2d')][_0xdf49('0x3c')]){_0x1a6252['include']=[{'all':!![]}];}return db['UserProfileSection']['findAll'](_0x1a6252);})[_0xdf49('0x21')](function(_0x6f78fd){_0x2bec5d[_0xdf49('0x3d')]=_0x6f78fd;return _0x2bec5d;})['then'](respondWithFilteredResult(_0x2e18c8,_0x1a6252))[_0xdf49('0x3e')](handleError(_0x2e18c8,null));};exports[_0xdf49('0x3f')]=function(_0x158a64,_0x14c097){var _0x4f3496={'raw':![],'where':{'id':_0x158a64[_0xdf49('0x40')]['id']}},_0x33e56a={};_0x33e56a[_0xdf49('0x30')]=_[_0xdf49('0x2e')](db[_0xdf49('0x2a')]['rawAttributes']);_0x33e56a['query']=_[_0xdf49('0x2e')](_0x158a64[_0xdf49('0x2d')]);_0x33e56a[_0xdf49('0x38')]=_['intersection'](_0x33e56a[_0xdf49('0x30')],_0x33e56a[_0xdf49('0x2d')]);_0x4f3496[_0xdf49('0x31')]=_['intersection'](_0x33e56a[_0xdf49('0x30')],qs[_0xdf49('0x32')](_0x158a64[_0xdf49('0x2d')][_0xdf49('0x32')]));_0x4f3496['attributes']=_0x4f3496['attributes'][_0xdf49('0x33')]?_0x4f3496[_0xdf49('0x31')]:_0x33e56a[_0xdf49('0x30')];if(_0x158a64['query']['includeAll']){_0x4f3496[_0xdf49('0x41')]=[{'all':!![]}];}_0x4f3496=_[_0xdf49('0x42')]({},_0x4f3496,_0x158a64['options']);return db[_0xdf49('0x2a')][_0xdf49('0x43')](_0x4f3496)['then'](handleEntityNotFound(_0x14c097,null))[_0xdf49('0x21')](respondWithResult(_0x14c097,null))[_0xdf49('0x3e')](handleError(_0x14c097,null));};exports['create']=function(_0x5a7958,_0x4dc513){return db['UserProfileSection']['create'](_0x5a7958[_0xdf49('0x44')],{})['then'](respondWithResult(_0x4dc513,0xc9))['catch'](handleError(_0x4dc513,null));};exports[_0xdf49('0x20')]=function(_0xa2d832,_0x388320){if(_0xa2d832[_0xdf49('0x44')]['id']){delete _0xa2d832[_0xdf49('0x44')]['id'];}return db['UserProfileSection']['find']({'where':{'id':_0xa2d832[_0xdf49('0x40')]['id']}})[_0xdf49('0x21')](handleEntityNotFound(_0x388320,null))[_0xdf49('0x21')](saveUpdates(_0xa2d832['body'],null))[_0xdf49('0x21')](respondWithResult(_0x388320,null))[_0xdf49('0x3e')](handleError(_0x388320,null));};exports[_0xdf49('0x22')]=function(_0x3fd690,_0x47f62f){return db[_0xdf49('0x2a')][_0xdf49('0x43')]({'where':{'id':_0x3fd690[_0xdf49('0x40')]['id']}})[_0xdf49('0x21')](handleEntityNotFound(_0x47f62f,null))[_0xdf49('0x21')](removeEntity(_0x47f62f,null))[_0xdf49('0x3e')](handleError(_0x47f62f,null));};exports[_0xdf49('0x45')]=function(_0x56675e,_0x396778){return db['UserProfileSection']['describe']()[_0xdf49('0x21')](respondWithResult(_0x396778,null))[_0xdf49('0x3e')](handleError(_0x396778,null));}; \ No newline at end of file +var _0xb0e0=['params','include','create','body','update','find','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','type','VIRTUAL','filter','merge','options','UserProfileSection','includeAll','findAll','rows','catch'];(function(_0x385e08,_0x1032bd){var _0x101de3=function(_0xbfcf77){while(--_0xbfcf77){_0x385e08['push'](_0x385e08['shift']());}};_0x101de3(++_0x1032bd);}(_0xb0e0,0xe5));var _0x0b0e=function(_0x587fb7,_0x5149f2){_0x587fb7=_0x587fb7-0x0;var _0x3aec15=_0xb0e0[_0x587fb7];return _0x3aec15;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0b0e('0x0'));var zipdir=require(_0x0b0e('0x1'));var jsonpatch=require(_0x0b0e('0x2'));var rp=require(_0x0b0e('0x3'));var moment=require('moment');var BPromise=require(_0x0b0e('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x0b0e('0x5'));var sox=require(_0x0b0e('0x6'));var csv=require(_0x0b0e('0x7'));var ejs=require(_0x0b0e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0b0e('0x9'));var squel=require(_0x0b0e('0xa'));var crypto=require(_0x0b0e('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x0b0e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0b0e('0xd'));var Redis=require(_0x0b0e('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x0b0e('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0b0e('0x10'));var logger=require('../../config/logger')(_0x0b0e('0x11'));var utils=require(_0x0b0e('0x12'));var config=require(_0x0b0e('0x13'));var licenseUtil=require(_0x0b0e('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x522540,_0x4b3eee){_0x4b3eee=_0x4b3eee||0xcc;return function(_0x1a81ef){if(_0x1a81ef){return _0x522540[_0x0b0e('0x15')](_0x4b3eee);}return _0x522540[_0x0b0e('0x16')](_0x4b3eee)[_0x0b0e('0x17')]();};}function respondWithResult(_0x5c54b7,_0x18c79b){_0x18c79b=_0x18c79b||0xc8;return function(_0x42ad64){if(_0x42ad64){return _0x5c54b7[_0x0b0e('0x16')](_0x18c79b)['json'](_0x42ad64);}};}function respondWithFilteredResult(_0x383c8a,_0x3a2eab){return function(_0x3f246b){if(_0x3f246b){var _0x45947b=typeof _0x3a2eab[_0x0b0e('0x18')]===_0x0b0e('0x19')&&typeof _0x3a2eab[_0x0b0e('0x1a')]===_0x0b0e('0x19');var _0x392fb0=_0x3f246b[_0x0b0e('0x1b')];var _0x5b704f=_0x45947b?0x0:_0x3a2eab[_0x0b0e('0x18')];var _0x51400c=_0x45947b?_0x3f246b[_0x0b0e('0x1b')]:_0x3a2eab['offset']+_0x3a2eab['limit'];var _0xf14930;if(_0x51400c>=_0x392fb0){_0x51400c=_0x392fb0;_0xf14930=0xc8;}else{_0xf14930=0xce;}_0x383c8a[_0x0b0e('0x16')](_0xf14930);return _0x383c8a[_0x0b0e('0x1c')](_0x0b0e('0x1d'),_0x5b704f+'-'+_0x51400c+'/'+_0x392fb0)[_0x0b0e('0x1e')](_0x3f246b);}return null;};}function patchUpdates(_0x93eeeb){return function(_0x465495){try{jsonpatch[_0x0b0e('0x1f')](_0x465495,_0x93eeeb,!![]);}catch(_0x1d15f1){return BPromise['reject'](_0x1d15f1);}return _0x465495[_0x0b0e('0x20')]();};}function saveUpdates(_0x2d1c8b,_0xe0f4df){return function(_0x4516fc){if(_0x4516fc){return _0x4516fc['update'](_0x2d1c8b)[_0x0b0e('0x21')](function(_0x1c331b){return _0x1c331b;});}return null;};}function removeEntity(_0x2f7462,_0x10b544){return function(_0x5685ae){if(_0x5685ae){return _0x5685ae[_0x0b0e('0x22')]()['then'](function(){_0x2f7462['status'](0xcc)[_0x0b0e('0x17')]();});}};}function handleEntityNotFound(_0xcb7b64,_0x3a8528){return function(_0x14076a){if(!_0x14076a){_0xcb7b64[_0x0b0e('0x15')](0x194);}return _0x14076a;};}function handleError(_0x1a4fc9,_0x41b78c){_0x41b78c=_0x41b78c||0x1f4;return function(_0x3495fb){logger[_0x0b0e('0x23')](_0x3495fb[_0x0b0e('0x24')]);if(_0x3495fb[_0x0b0e('0x25')]){delete _0x3495fb[_0x0b0e('0x25')];}_0x1a4fc9[_0x0b0e('0x16')](_0x41b78c)[_0x0b0e('0x26')](_0x3495fb);};}exports[_0x0b0e('0x27')]=function(_0x49e5c6,_0x592cd3){var _0xbad3bd={},_0x2ce427={},_0x24c4e8={'count':0x0,'rows':[]};var _0x5230d2=_[_0x0b0e('0x28')](db['UserProfileSection'][_0x0b0e('0x29')],function(_0x1d5e9c){return{'name':_0x1d5e9c[_0x0b0e('0x2a')],'type':_0x1d5e9c['type'][_0x0b0e('0x2b')]};});_0x2ce427['model']=_[_0x0b0e('0x28')](_0x5230d2,_0x0b0e('0x25'));_0x2ce427[_0x0b0e('0x2c')]=_[_0x0b0e('0x2d')](_0x49e5c6[_0x0b0e('0x2c')]);_0x2ce427[_0x0b0e('0x2e')]=_[_0x0b0e('0x2f')](_0x2ce427[_0x0b0e('0x30')],_0x2ce427[_0x0b0e('0x2c')]);_0xbad3bd[_0x0b0e('0x31')]=_[_0x0b0e('0x2f')](_0x2ce427[_0x0b0e('0x30')],qs['fields'](_0x49e5c6[_0x0b0e('0x2c')][_0x0b0e('0x32')]));_0xbad3bd['attributes']=_0xbad3bd[_0x0b0e('0x31')][_0x0b0e('0x33')]?_0xbad3bd['attributes']:_0x2ce427['model'];if(!_0x49e5c6['query'][_0x0b0e('0x34')](_0x0b0e('0x35'))){_0xbad3bd[_0x0b0e('0x1a')]=qs['limit'](_0x49e5c6[_0x0b0e('0x2c')][_0x0b0e('0x1a')]);_0xbad3bd[_0x0b0e('0x18')]=qs[_0x0b0e('0x18')](_0x49e5c6[_0x0b0e('0x2c')][_0x0b0e('0x18')]);}_0xbad3bd[_0x0b0e('0x36')]=qs['sort'](_0x49e5c6['query']['sort']);_0xbad3bd[_0x0b0e('0x37')]=qs[_0x0b0e('0x2e')](_[_0x0b0e('0x38')](_0x49e5c6[_0x0b0e('0x2c')],_0x2ce427[_0x0b0e('0x2e')]),_0x5230d2);if(_0x49e5c6[_0x0b0e('0x2c')]['filter']){_0xbad3bd[_0x0b0e('0x37')]=_['merge'](_0xbad3bd[_0x0b0e('0x37')],{'$or':_[_0x0b0e('0x28')](_0x5230d2,function(_0x87f257){if(_0x87f257[_0x0b0e('0x39')]!==_0x0b0e('0x3a')){var _0x33e79c={};_0x33e79c[_0x87f257[_0x0b0e('0x25')]]={'$like':'%'+_0x49e5c6[_0x0b0e('0x2c')][_0x0b0e('0x3b')]+'%'};return _0x33e79c;}})});}_0xbad3bd=_[_0x0b0e('0x3c')]({},_0xbad3bd,_0x49e5c6[_0x0b0e('0x3d')]);var _0x3ed74d={'where':_0xbad3bd[_0x0b0e('0x37')]};return db[_0x0b0e('0x3e')][_0x0b0e('0x1b')](_0x3ed74d)[_0x0b0e('0x21')](function(_0x42d034){_0x24c4e8[_0x0b0e('0x1b')]=_0x42d034;if(_0x49e5c6[_0x0b0e('0x2c')][_0x0b0e('0x3f')]){_0xbad3bd['include']=[{'all':!![]}];}return db[_0x0b0e('0x3e')][_0x0b0e('0x40')](_0xbad3bd);})[_0x0b0e('0x21')](function(_0x4c7e48){_0x24c4e8[_0x0b0e('0x41')]=_0x4c7e48;return _0x24c4e8;})[_0x0b0e('0x21')](respondWithFilteredResult(_0x592cd3,_0xbad3bd))[_0x0b0e('0x42')](handleError(_0x592cd3,null));};exports['show']=function(_0x2dafe9,_0x3a6387){var _0x588f35={'raw':![],'where':{'id':_0x2dafe9[_0x0b0e('0x43')]['id']}},_0x4520c7={};_0x4520c7[_0x0b0e('0x30')]=_[_0x0b0e('0x2d')](db[_0x0b0e('0x3e')]['rawAttributes']);_0x4520c7['query']=_[_0x0b0e('0x2d')](_0x2dafe9[_0x0b0e('0x2c')]);_0x4520c7[_0x0b0e('0x2e')]=_[_0x0b0e('0x2f')](_0x4520c7[_0x0b0e('0x30')],_0x4520c7['query']);_0x588f35['attributes']=_['intersection'](_0x4520c7[_0x0b0e('0x30')],qs['fields'](_0x2dafe9['query'][_0x0b0e('0x32')]));_0x588f35['attributes']=_0x588f35[_0x0b0e('0x31')][_0x0b0e('0x33')]?_0x588f35[_0x0b0e('0x31')]:_0x4520c7[_0x0b0e('0x30')];if(_0x2dafe9[_0x0b0e('0x2c')][_0x0b0e('0x3f')]){_0x588f35[_0x0b0e('0x44')]=[{'all':!![]}];}_0x588f35=_[_0x0b0e('0x3c')]({},_0x588f35,_0x2dafe9['options']);return db['UserProfileSection']['find'](_0x588f35)[_0x0b0e('0x21')](handleEntityNotFound(_0x3a6387,null))[_0x0b0e('0x21')](respondWithResult(_0x3a6387,null))[_0x0b0e('0x42')](handleError(_0x3a6387,null));};exports[_0x0b0e('0x45')]=function(_0x41410c,_0x374c96){return db['UserProfileSection'][_0x0b0e('0x45')](_0x41410c[_0x0b0e('0x46')],{})['then'](respondWithResult(_0x374c96,0xc9))[_0x0b0e('0x42')](handleError(_0x374c96,null));};exports[_0x0b0e('0x47')]=function(_0x74daa7,_0x255c9b){if(_0x74daa7['body']['id']){delete _0x74daa7[_0x0b0e('0x46')]['id'];}return db[_0x0b0e('0x3e')][_0x0b0e('0x48')]({'where':{'id':_0x74daa7['params']['id']}})['then'](handleEntityNotFound(_0x255c9b,null))[_0x0b0e('0x21')](saveUpdates(_0x74daa7[_0x0b0e('0x46')],null))[_0x0b0e('0x21')](respondWithResult(_0x255c9b,null))[_0x0b0e('0x42')](handleError(_0x255c9b,null));};exports['destroy']=function(_0x322892,_0xf5673f){return db['UserProfileSection']['find']({'where':{'id':_0x322892[_0x0b0e('0x43')]['id']}})['then'](handleEntityNotFound(_0xf5673f,null))['then'](removeEntity(_0xf5673f,null))[_0x0b0e('0x42')](handleError(_0xf5673f,null));};exports[_0x0b0e('0x49')]=function(_0xaa3821,_0x1e7230){return db[_0x0b0e('0x3e')][_0x0b0e('0x49')]()[_0x0b0e('0x21')](respondWithResult(_0x1e7230,null))['catch'](handleError(_0x1e7230,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 94c4d7d..d375097 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 _0x4415=['../../config/environment','exports','define','user_profile_has_sections','compositeIndex','sectionId','util','moment','bluebird','path','rimraf'];(function(_0x7ab3ba,_0x2592b0){var _0x11b92b=function(_0x10aafc){while(--_0x10aafc){_0x7ab3ba['push'](_0x7ab3ba['shift']());}};_0x11b92b(++_0x2592b0);}(_0x4415,0x69));var _0x5441=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0x4415[_0x5f3f88];return _0xd08119;};'use strict';var _=require('lodash');var util=require(_0x5441('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x5441('0x1'));var BPromise=require(_0x5441('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5441('0x3'));var rimraf=require(_0x5441('0x4'));var config=require(_0x5441('0x5'));var attributes=require('./userProfileSection.attributes');module[_0x5441('0x6')]=function(_0x3b4d77,_0x167c19){return _0x3b4d77[_0x5441('0x7')]('UserProfileSection',attributes,{'tableName':_0x5441('0x8'),'paranoid':![],'indexes':[{'name':_0x5441('0x9'),'fields':[_0x5441('0xa'),'userProfileId']}],'timestamps':!![]});}; \ No newline at end of file +var _0xbe54=['api','bluebird','./userProfileSection.attributes','define','user_profile_has_sections','compositeIndex','sectionId','userProfileId','lodash','util'];(function(_0x51f67c,_0x1977ec){var _0x3888c5=function(_0x5469be){while(--_0x5469be){_0x51f67c['push'](_0x51f67c['shift']());}};_0x3888c5(++_0x1977ec);}(_0xbe54,0x9e));var _0x4be5=function(_0x19c2bd,_0x31073f){_0x19c2bd=_0x19c2bd-0x0;var _0x2782e7=_0xbe54[_0x19c2bd];return _0x2782e7;};'use strict';var _=require(_0x4be5('0x0'));var util=require(_0x4be5('0x1'));var logger=require('../../config/logger')(_0x4be5('0x2'));var moment=require('moment');var BPromise=require(_0x4be5('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4be5('0x4'));module['exports']=function(_0x3a221f,_0xf70238){return _0x3a221f[_0x4be5('0x5')]('UserProfileSection',attributes,{'tableName':_0x4be5('0x6'),'paranoid':![],'indexes':[{'name':_0x4be5('0x7'),'fields':[_0x4be5('0x8'),_0x4be5('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index aab0d69..2267919 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 _0xc7b2=['moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','http','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0xc7b2,0x68));var _0x2c7b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc7b2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x2c7b('0x0'));var moment=require(_0x2c7b('0x1'));var BPromise=require(_0x2c7b('0x2'));var rs=require(_0x2c7b('0x3'));var fs=require('fs');var Redis=require(_0x2c7b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2c7b('0x5'));var logger=require('../../config/logger')(_0x2c7b('0x6'));var config=require(_0x2c7b('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x2c7b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x40061f,_0x471037,_0x298ab1){return new BPromise(function(_0x2490dd,_0x98d9a4){return client[_0x2c7b('0x9')](_0x40061f,_0x298ab1)[_0x2c7b('0xa')](function(_0x154351){logger[_0x2c7b('0xb')](_0x2c7b('0xc'),_0x471037,_0x2c7b('0xd'));logger[_0x2c7b('0xe')](_0x2c7b('0xf'),_0x471037,_0x2c7b('0xd'),JSON[_0x2c7b('0x10')](_0x154351));if(_0x154351[_0x2c7b('0x11')]){if(_0x154351[_0x2c7b('0x11')]['code']===0x1f4){logger[_0x2c7b('0x11')](_0x2c7b('0xc'),_0x471037,_0x154351['error'][_0x2c7b('0x12')]);return _0x98d9a4(_0x154351['error'][_0x2c7b('0x12')]);}logger['error'](_0x2c7b('0xc'),_0x471037,_0x154351[_0x2c7b('0x11')]['message']);return _0x2490dd(_0x154351[_0x2c7b('0x11')]['message']);}else{logger['info'](_0x2c7b('0xc'),_0x471037,_0x2c7b('0xd'));_0x2490dd(_0x154351[_0x2c7b('0x13')][_0x2c7b('0x12')]);}})[_0x2c7b('0x14')](function(_0x4fc068){logger[_0x2c7b('0x11')](_0x2c7b('0xc'),_0x471037,_0x4fc068);_0x98d9a4(_0x4fc068);});});} \ No newline at end of file +var _0xb8a8=['error','code','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x45e2cc,_0x5ec39a){var _0x284759=function(_0x3a5f9c){while(--_0x3a5f9c){_0x45e2cc['push'](_0x45e2cc['shift']());}};_0x284759(++_0x5ec39a);}(_0xb8a8,0x15d));var _0x8b8a=function(_0x376a33,_0x18bbf4){_0x376a33=_0x376a33-0x0;var _0x37e448=_0xb8a8[_0x376a33];return _0x37e448;};'use strict';var _=require(_0x8b8a('0x0'));var util=require(_0x8b8a('0x1'));var moment=require(_0x8b8a('0x2'));var BPromise=require(_0x8b8a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8b8a('0x4'));var db=require(_0x8b8a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8b8a('0x6'))(_0x8b8a('0x7'));var config=require(_0x8b8a('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8b8a('0x9')][_0x8b8a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x44fd2b,_0x4423f3,_0x4096cd){return new BPromise(function(_0x2c914,_0xce2179){return client[_0x8b8a('0xb')](_0x44fd2b,_0x4096cd)[_0x8b8a('0xc')](function(_0x47bd37){logger[_0x8b8a('0xd')](_0x8b8a('0xe'),_0x4423f3,_0x8b8a('0xf'));logger[_0x8b8a('0x10')](_0x8b8a('0x11'),_0x4423f3,'request\x20sent',JSON[_0x8b8a('0x12')](_0x47bd37));if(_0x47bd37[_0x8b8a('0x13')]){if(_0x47bd37['error'][_0x8b8a('0x14')]===0x1f4){logger['error'](_0x8b8a('0xe'),_0x4423f3,_0x47bd37[_0x8b8a('0x13')][_0x8b8a('0x15')]);return _0xce2179(_0x47bd37[_0x8b8a('0x13')][_0x8b8a('0x15')]);}logger['error']('UserProfileSection,\x20%s,\x20%s',_0x4423f3,_0x47bd37['error'][_0x8b8a('0x15')]);return _0x2c914(_0x47bd37['error'][_0x8b8a('0x15')]);}else{logger['info'](_0x8b8a('0xe'),_0x4423f3,'request\x20sent');_0x2c914(_0x47bd37[_0x8b8a('0x16')][_0x8b8a('0x15')]);}})['catch'](function(_0xdfce2b){logger[_0x8b8a('0x13')](_0x8b8a('0xe'),_0x4423f3,_0xdfce2b);_0xce2179(_0xdfce2b);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index e8e416c..17bd916 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(_0x467d3b,_0x4225ba){var _0x1a35ec=function(_0x46673c){while(--_0x46673c){_0x467d3b['push'](_0x467d3b['shift']());}};_0x1a35ec(++_0x4225ba);}(_0xa9e0,0x123));var _0x0a9e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa9e0[_0x28947d];return _0x12d2ee;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('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(_0x4e77fa,_0x3412f5){var _0x375467=function(_0x410499){while(--_0x410499){_0x4e77fa['push'](_0x4e77fa['shift']());}};_0x375467(++_0x3412f5);}(_0xe706,0xa3));var _0x6e70=function(_0x185f7f,_0x42aa8b){_0x185f7f=_0x185f7f-0x0;var _0x15d436=_0xe706[_0x185f7f];return _0x15d436;};'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/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 222b9be..625da5e 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 _0xc271=['sequelize','exports','INTEGER'];(function(_0x49218d,_0x4a590d){var _0x55264e=function(_0x118b0c){while(--_0x118b0c){_0x49218d['push'](_0x49218d['shift']());}};_0x55264e(++_0x4a590d);}(_0xc271,0x165));var _0x1c27=function(_0x1d2665,_0x16e099){_0x1d2665=_0x1d2665-0x0;var _0x1431b7=_0xc271[_0x1d2665];return _0x1431b7;};'use strict';var Sequelize=require(_0x1c27('0x0'));module[_0x1c27('0x1')]={'penalty':{'type':Sequelize[_0x1c27('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb315=['INTEGER','sequelize','exports'];(function(_0x24a5d6,_0x19ede7){var _0x4db832=function(_0x449135){while(--_0x449135){_0x24a5d6['push'](_0x24a5d6['shift']());}};_0x4db832(++_0x19ede7);}(_0xb315,0x1a2));var _0x5b31=function(_0x9edfd5,_0x286486){_0x9edfd5=_0x9edfd5-0x0;var _0x330738=_0xb315[_0x9edfd5];return _0x330738;};'use strict';var Sequelize=require(_0x5b31('0x0'));module[_0x5b31('0x1')]={'penalty':{'type':Sequelize[_0x5b31('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index 1ff159c..f16d4d3 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 _0x6f44=['bluebird','request-promise','path','rimraf','../../config/environment','./userSmsQueue.attributes','exports','define','UserSmsQueue','lodash','util','api','moment'];(function(_0x2970bf,_0xc5e266){var _0x18386b=function(_0xe14fa9){while(--_0xe14fa9){_0x2970bf['push'](_0x2970bf['shift']());}};_0x18386b(++_0xc5e266);}(_0x6f44,0x1ea));var _0x46f4=function(_0x52bbb5,_0xd62754){_0x52bbb5=_0x52bbb5-0x0;var _0x47ebb4=_0x6f44[_0x52bbb5];return _0x47ebb4;};'use strict';var _=require(_0x46f4('0x0'));var util=require(_0x46f4('0x1'));var logger=require('../../config/logger')(_0x46f4('0x2'));var moment=require(_0x46f4('0x3'));var BPromise=require(_0x46f4('0x4'));var rp=require(_0x46f4('0x5'));var fs=require('fs');var path=require(_0x46f4('0x6'));var rimraf=require(_0x46f4('0x7'));var config=require(_0x46f4('0x8'));var attributes=require(_0x46f4('0x9'));module[_0x46f4('0xa')]=function(_0x57f1a9,_0x169a5a){return _0x57f1a9[_0x46f4('0xb')](_0x46f4('0xc'),attributes,{'tableName':'user_has_sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb016=['../../config/environment','exports','user_has_sms_queues','lodash','util','moment','request-promise','path','rimraf'];(function(_0xb85f9,_0x3f77f8){var _0x1f38bc=function(_0x470cc4){while(--_0x470cc4){_0xb85f9['push'](_0xb85f9['shift']());}};_0x1f38bc(++_0x3f77f8);}(_0xb016,0x159));var _0x6b01=function(_0xc4d1fc,_0x2b66b0){_0xc4d1fc=_0xc4d1fc-0x0;var _0x312b59=_0xb016[_0xc4d1fc];return _0x312b59;};'use strict';var _=require(_0x6b01('0x0'));var util=require(_0x6b01('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x6b01('0x2'));var BPromise=require('bluebird');var rp=require(_0x6b01('0x3'));var fs=require('fs');var path=require(_0x6b01('0x4'));var rimraf=require(_0x6b01('0x5'));var config=require(_0x6b01('0x6'));var attributes=require('./userSmsQueue.attributes');module[_0x6b01('0x7')]=function(_0x65407a,_0x192b2d){return _0x65407a['define']('UserSmsQueue',attributes,{'tableName':_0x6b01('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 ab1c5b0..f90d9f0 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 _0xff16=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','info','request\x20sent','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserSmsQueue,\x20%s,\x20%s','message','catch','lodash'];(function(_0x1679cc,_0x242c53){var _0x4aaec8=function(_0x303c5f){while(--_0x303c5f){_0x1679cc['push'](_0x1679cc['shift']());}};_0x4aaec8(++_0x242c53);}(_0xff16,0xb3));var _0x6ff1=function(_0x3c5a11,_0xf7308e){_0x3c5a11=_0x3c5a11-0x0;var _0x3e426d=_0xff16[_0x3c5a11];return _0x3e426d;};'use strict';var _=require(_0x6ff1('0x0'));var util=require('util');var moment=require(_0x6ff1('0x1'));var BPromise=require(_0x6ff1('0x2'));var rs=require(_0x6ff1('0x3'));var fs=require('fs');var Redis=require(_0x6ff1('0x4'));var db=require(_0x6ff1('0x5'))['db'];var utils=require(_0x6ff1('0x6'));var logger=require(_0x6ff1('0x7'))('rpc');var config=require(_0x6ff1('0x8'));var jayson=require(_0x6ff1('0x9'));var client=jayson[_0x6ff1('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x9ef03b,_0x452cfb,_0x120fa7){return new BPromise(function(_0x51ba98,_0x2eef89){return client['request'](_0x9ef03b,_0x120fa7)['then'](function(_0x27eef2){logger[_0x6ff1('0xb')]('UserSmsQueue,\x20%s,\x20%s',_0x452cfb,_0x6ff1('0xc'));logger['debug'](_0x6ff1('0xd'),_0x452cfb,_0x6ff1('0xc'),JSON[_0x6ff1('0xe')](_0x27eef2));if(_0x27eef2[_0x6ff1('0xf')]){if(_0x27eef2['error'][_0x6ff1('0x10')]===0x1f4){logger[_0x6ff1('0xf')](_0x6ff1('0x11'),_0x452cfb,_0x27eef2[_0x6ff1('0xf')][_0x6ff1('0x12')]);return _0x2eef89(_0x27eef2['error'][_0x6ff1('0x12')]);}logger[_0x6ff1('0xf')](_0x6ff1('0x11'),_0x452cfb,_0x27eef2[_0x6ff1('0xf')][_0x6ff1('0x12')]);return _0x51ba98(_0x27eef2['error'][_0x6ff1('0x12')]);}else{logger[_0x6ff1('0xb')](_0x6ff1('0x11'),_0x452cfb,'request\x20sent');_0x51ba98(_0x27eef2['result'][_0x6ff1('0x12')]);}})[_0x6ff1('0x13')](function(_0x22d215){logger[_0x6ff1('0xf')](_0x6ff1('0x11'),_0x452cfb,_0x22d215);_0x2eef89(_0x22d215);});});} \ No newline at end of file +var _0xd9f4=['code','UserSmsQueue,\x20%s,\x20%s','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x810e4d,_0x909ef4){var _0x13f01c=function(_0x12fd89){while(--_0x12fd89){_0x810e4d['push'](_0x810e4d['shift']());}};_0x13f01c(++_0x909ef4);}(_0xd9f4,0x7e));var _0x4d9f=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xd9f4[_0x46aff0];return _0x9d78cf;};'use strict';var _=require(_0x4d9f('0x0'));var util=require(_0x4d9f('0x1'));var moment=require('moment');var BPromise=require(_0x4d9f('0x2'));var rs=require(_0x4d9f('0x3'));var fs=require('fs');var Redis=require(_0x4d9f('0x4'));var db=require(_0x4d9f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4d9f('0x6'))(_0x4d9f('0x7'));var config=require(_0x4d9f('0x8'));var jayson=require(_0x4d9f('0x9'));var client=jayson[_0x4d9f('0xa')][_0x4d9f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4e0688,_0x316fc8,_0x504185){return new BPromise(function(_0x2700a8,_0x45bc6d){return client[_0x4d9f('0xc')](_0x4e0688,_0x504185)[_0x4d9f('0xd')](function(_0x18cd4e){logger['info']('UserSmsQueue,\x20%s,\x20%s',_0x316fc8,'request\x20sent');logger[_0x4d9f('0xe')](_0x4d9f('0xf'),_0x316fc8,_0x4d9f('0x10'),JSON['stringify'](_0x18cd4e));if(_0x18cd4e[_0x4d9f('0x11')]){if(_0x18cd4e[_0x4d9f('0x11')][_0x4d9f('0x12')]===0x1f4){logger['error'](_0x4d9f('0x13'),_0x316fc8,_0x18cd4e[_0x4d9f('0x11')]['message']);return _0x45bc6d(_0x18cd4e['error'][_0x4d9f('0x14')]);}logger['error']('UserSmsQueue,\x20%s,\x20%s',_0x316fc8,_0x18cd4e['error']['message']);return _0x2700a8(_0x18cd4e['error'][_0x4d9f('0x14')]);}else{logger[_0x4d9f('0x15')](_0x4d9f('0x13'),_0x316fc8,_0x4d9f('0x10'));_0x2700a8(_0x18cd4e[_0x4d9f('0x16')][_0x4d9f('0x14')]);}})[_0x4d9f('0x17')](function(_0x3f74fa){logger['error'](_0x4d9f('0x13'),_0x316fc8,_0x3f74fa);_0x45bc6d(_0x3f74fa);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 48254f8..22efbeb 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 _0x2247=['INTEGER','sequelize'];(function(_0x4996d5,_0x123daf){var _0x4793f9=function(_0x30c7ec){while(--_0x30c7ec){_0x4996d5['push'](_0x4996d5['shift']());}};_0x4793f9(++_0x123daf);}(_0x2247,0x197));var _0x7224=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x2247[_0x4b055c];return _0x4b62bb;};'use strict';var Sequelize=require(_0x7224('0x0'));module['exports']={'UserId':{'type':Sequelize[_0x7224('0x1')]},'VoicePrefixId':{'type':Sequelize[_0x7224('0x1')]}}; \ No newline at end of file +var _0x8041=['INTEGER','sequelize','exports'];(function(_0x2d3b97,_0x5e6b87){var _0x586e84=function(_0x62d455){while(--_0x62d455){_0x2d3b97['push'](_0x2d3b97['shift']());}};_0x586e84(++_0x5e6b87);}(_0x8041,0x76));var _0x1804=function(_0x2d0757,_0x19b74){_0x2d0757=_0x2d0757-0x0;var _0x3429ce=_0x8041[_0x2d0757];return _0x3429ce;};'use strict';var Sequelize=require(_0x1804('0x0'));module[_0x1804('0x1')]={'UserId':{'type':Sequelize[_0x1804('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x1804('0x2')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 99cce41..9d2b0a6 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(_0x13d26e,_0x302571){var _0x59cf5c=function(_0x5a4db6){while(--_0x5a4db6){_0x13d26e['push'](_0x13d26e['shift']());}};_0x59cf5c(++_0x302571);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'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(_0xae3f8f,_0x144d50){var _0x5e2a2f=function(_0x5333af){while(--_0x5333af){_0xae3f8f['push'](_0xae3f8f['shift']());}};_0x5e2a2f(++_0x144d50);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'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 627dc14..a40a972 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x483d7c,_0x236af6){var _0x42b978=function(_0x27004b){while(--_0x27004b){_0x483d7c['push'](_0x483d7c['shift']());}};_0x42b978(++_0x236af6);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x2550ce,_0x45209b){var _0x25748d=function(_0x806ad5){while(--_0x806ad5){_0x2550ce['push'](_0x2550ce['shift']());}};_0x25748d(++_0x45209b);}(_0x9c44,0x178));var _0x49c4=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0x9c44[_0x4fde08];return _0x12e725;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 6c454df..39fad23 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 _0xfa75=['INTEGER','sequelize','exports'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xfa75,0xfd));var _0x5fa7=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xfa75[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x5fa7('0x0'));module[_0x5fa7('0x1')]={'penalty':{'type':Sequelize[_0x5fa7('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd69b=['exports','sequelize'];(function(_0x2bacd0,_0x4a300a){var _0x4e0fc5=function(_0x1797d8){while(--_0x1797d8){_0x2bacd0['push'](_0x2bacd0['shift']());}};_0x4e0fc5(++_0x4a300a);}(_0xd69b,0x1d9));var _0xbd69=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0xd69b[_0x36884e];return _0x1cc367;};'use strict';var Sequelize=require(_0xbd69('0x0'));module[_0xbd69('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 f4e4033..21cb542 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 _0xa7f4=['./userVoiceQueue.attributes','exports','lodash','util','../../config/logger','api','moment','bluebird','rimraf'];(function(_0x391c55,_0x168617){var _0xa434e0=function(_0x51fa5c){while(--_0x51fa5c){_0x391c55['push'](_0x391c55['shift']());}};_0xa434e0(++_0x168617);}(_0xa7f4,0x1e8));var _0x4a7f=function(_0x5eb7bf,_0x37e90d){_0x5eb7bf=_0x5eb7bf-0x0;var _0x4a3685=_0xa7f4[_0x5eb7bf];return _0x4a3685;};'use strict';var _=require(_0x4a7f('0x0'));var util=require(_0x4a7f('0x1'));var logger=require(_0x4a7f('0x2'))(_0x4a7f('0x3'));var moment=require(_0x4a7f('0x4'));var BPromise=require(_0x4a7f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4a7f('0x6'));var config=require('../../config/environment');var attributes=require(_0x4a7f('0x7'));module[_0x4a7f('0x8')]=function(_0x5bb89d,_0x284e33){return _0x5bb89d['define']('UserVoiceQueue',attributes,{'tableName':'user_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xafbb=['request-promise','../../config/environment','./userVoiceQueue.attributes','UserVoiceQueue','user_has_voice_queues','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x336363,_0x3692cc){var _0x531060=function(_0x4bd04d){while(--_0x4bd04d){_0x336363['push'](_0x336363['shift']());}};_0x531060(++_0x3692cc);}(_0xafbb,0xcb));var _0xbafb=function(_0x19a9ac,_0x1a53f3){_0x19a9ac=_0x19a9ac-0x0;var _0x54b448=_0xafbb[_0x19a9ac];return _0x54b448;};'use strict';var _=require(_0xbafb('0x0'));var util=require(_0xbafb('0x1'));var logger=require(_0xbafb('0x2'))(_0xbafb('0x3'));var moment=require(_0xbafb('0x4'));var BPromise=require(_0xbafb('0x5'));var rp=require(_0xbafb('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xbafb('0x7'));var attributes=require(_0xbafb('0x8'));module['exports']=function(_0x1159b0,_0x3a7872){return _0x1159b0['define'](_0xbafb('0x9'),attributes,{'tableName':_0xbafb('0xa'),'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 c7ff76c..ef6a9fa 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 _0xcd26=['UserVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','UserVoiceQueue,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0xf7173e,_0x8ec916){var _0x5644a3=function(_0x53394f){while(--_0x53394f){_0xf7173e['push'](_0xf7173e['shift']());}};_0x5644a3(++_0x8ec916);}(_0xcd26,0xb8));var _0x6cd2=function(_0x31e5cb,_0x2f5adf){_0x31e5cb=_0x31e5cb-0x0;var _0x4170df=_0xcd26[_0x31e5cb];return _0x4170df;};'use strict';var _=require('lodash');var util=require(_0x6cd2('0x0'));var moment=require(_0x6cd2('0x1'));var BPromise=require(_0x6cd2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6cd2('0x3'))['db'];var utils=require(_0x6cd2('0x4'));var logger=require(_0x6cd2('0x5'))(_0x6cd2('0x6'));var config=require(_0x6cd2('0x7'));var jayson=require(_0x6cd2('0x8'));var client=jayson[_0x6cd2('0x9')][_0x6cd2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4536d4,_0x21eb2c,_0x1e1415){return new BPromise(function(_0x1f8eb0,_0xd3480a){return client[_0x6cd2('0xb')](_0x4536d4,_0x1e1415)[_0x6cd2('0xc')](function(_0xd2b8e6){logger[_0x6cd2('0xd')]('UserVoiceQueue,\x20%s,\x20%s',_0x21eb2c,'request\x20sent');logger['debug'](_0x6cd2('0xe'),_0x21eb2c,_0x6cd2('0xf'),JSON[_0x6cd2('0x10')](_0xd2b8e6));if(_0xd2b8e6[_0x6cd2('0x11')]){if(_0xd2b8e6[_0x6cd2('0x11')]['code']===0x1f4){logger[_0x6cd2('0x11')](_0x6cd2('0x12'),_0x21eb2c,_0xd2b8e6[_0x6cd2('0x11')][_0x6cd2('0x13')]);return _0xd3480a(_0xd2b8e6[_0x6cd2('0x11')][_0x6cd2('0x13')]);}logger['error'](_0x6cd2('0x12'),_0x21eb2c,_0xd2b8e6[_0x6cd2('0x11')]['message']);return _0x1f8eb0(_0xd2b8e6[_0x6cd2('0x11')][_0x6cd2('0x13')]);}else{logger[_0x6cd2('0xd')]('UserVoiceQueue,\x20%s,\x20%s',_0x21eb2c,'request\x20sent');_0x1f8eb0(_0xd2b8e6[_0x6cd2('0x14')][_0x6cd2('0x13')]);}})[_0x6cd2('0x15')](function(_0x52df06){logger[_0x6cd2('0x11')]('UserVoiceQueue,\x20%s,\x20%s',_0x21eb2c,_0x52df06);_0xd3480a(_0x52df06);});});} \ No newline at end of file +var _0x76b9=['then','UserVoiceQueue,\x20%s,\x20%s','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','info','result','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0x76b9,0x16a));var _0x976b=function(_0x5301b9,_0x438dd2){_0x5301b9=_0x5301b9-0x0;var _0xe1fe8c=_0x76b9[_0x5301b9];return _0xe1fe8c;};'use strict';var _=require(_0x976b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x976b('0x1'));var rs=require(_0x976b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x976b('0x3'))['db'];var utils=require(_0x976b('0x4'));var logger=require(_0x976b('0x5'))(_0x976b('0x6'));var config=require(_0x976b('0x7'));var jayson=require(_0x976b('0x8'));var client=jayson[_0x976b('0x9')][_0x976b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xb6b0e0,_0x3c3565,_0x3311c7){return new BPromise(function(_0x1ef2f9,_0x6c790b){return client[_0x976b('0xb')](_0xb6b0e0,_0x3311c7)[_0x976b('0xc')](function(_0x25ee8c){logger['info'](_0x976b('0xd'),_0x3c3565,'request\x20sent');logger[_0x976b('0xe')](_0x976b('0xf'),_0x3c3565,_0x976b('0x10'),JSON['stringify'](_0x25ee8c));if(_0x25ee8c['error']){if(_0x25ee8c[_0x976b('0x11')]['code']===0x1f4){logger[_0x976b('0x11')]('UserVoiceQueue,\x20%s,\x20%s',_0x3c3565,_0x25ee8c[_0x976b('0x11')][_0x976b('0x12')]);return _0x6c790b(_0x25ee8c[_0x976b('0x11')]['message']);}logger[_0x976b('0x11')]('UserVoiceQueue,\x20%s,\x20%s',_0x3c3565,_0x25ee8c[_0x976b('0x11')]['message']);return _0x1ef2f9(_0x25ee8c[_0x976b('0x11')]['message']);}else{logger[_0x976b('0x13')]('UserVoiceQueue,\x20%s,\x20%s',_0x3c3565,_0x976b('0x10'));_0x1ef2f9(_0x25ee8c[_0x976b('0x14')][_0x976b('0x12')]);}})[_0x976b('0x15')](function(_0x1ec99e){logger['error'](_0x976b('0xd'),_0x3c3565,_0x1ec99e);_0x6c790b(_0x1ec99e);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index a3ed3db..54c4133 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x26158a,_0x35e5ab){var _0x1cf4ac=function(_0x37da77){while(--_0x37da77){_0x26158a['push'](_0x26158a['shift']());}};_0x1cf4ac(++_0x35e5ab);}(_0x9c44,0x178));var _0x49c4=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x9c44[_0x5d2803];return _0xdcad2c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0xc8ac1f,_0x4fd5d1){var _0x5798fd=function(_0x46bede){while(--_0x46bede){_0xc8ac1f['push'](_0xc8ac1f['shift']());}};_0x5798fd(++_0x4fd5d1);}(_0xedd9,0xfc));var _0x9edd=function(_0x137f49,_0xb32f69){_0x137f49=_0x137f49-0x0;var _0x37e612=_0xedd9[_0x137f49];return _0x37e612;};'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/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index f22cceb..969c198 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 _0x8711=['INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface','sequelize','exports'];(function(_0x577169,_0x42e882){var _0x41e5fb=function(_0x1844d8){while(--_0x1844d8){_0x577169['push'](_0x577169['shift']());}};_0x41e5fb(++_0x42e882);}(_0x8711,0x1de));var _0x1871=function(_0x59e364,_0x13f10c){_0x59e364=_0x59e364-0x0;var _0x43c5a0=_0x8711[_0x59e364];return _0x43c5a0;};'use strict';var Sequelize=require(_0x1871('0x0'));module[_0x1871('0x1')]={'uniqueid':{'type':Sequelize[_0x1871('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x1871('0x3')},'membername':{'type':Sequelize[_0x1871('0x4')],'allowNull':![],'comment':_0x1871('0x3')},'UserId':{'type':Sequelize[_0x1871('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x1871('0x4')],'allowNull':![],'unique':_0x1871('0x5'),'comment':_0x1871('0x3')},'VoiceQueueId':{'type':Sequelize[_0x1871('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0x1871('0x4')],'allowNull':![],'unique':_0x1871('0x5'),'comment':_0x1871('0x3')},'penalty':{'type':Sequelize[_0x1871('0x2')](0xb),'defaultValue':0x0,'comment':_0x1871('0x3')},'paused':{'type':Sequelize[_0x1871('0x2')](0xb),'defaultValue':0x0,'comment':_0x1871('0x3')}}; \ No newline at end of file +var _0x9f7a=['Required\x20by\x20Asterisk','sequelize','exports','INTEGER'];(function(_0x27cbf1,_0x14613c){var _0x1cfb81=function(_0x2c001a){while(--_0x2c001a){_0x27cbf1['push'](_0x27cbf1['shift']());}};_0x1cfb81(++_0x14613c);}(_0x9f7a,0xf1));var _0xa9f7=function(_0x39d544,_0x35c14f){_0x39d544=_0x39d544-0x0;var _0x5a5ff2=_0x9f7a[_0x39d544];return _0x5a5ff2;};'use strict';var Sequelize=require(_0xa9f7('0x0'));module[_0xa9f7('0x1')]={'uniqueid':{'type':Sequelize[_0xa9f7('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0xa9f7('0x3')},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':_0xa9f7('0x3')},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'queue_interface','comment':_0xa9f7('0x3')},'VoiceQueueId':{'type':Sequelize[_0xa9f7('0x2')],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':'queue_interface','comment':_0xa9f7('0x3')},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0xa9f7('0x3')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 5b12af9..7a707a1 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 _0xbe64=['hook','exports','events','../../mysqldb','UserVoiceQueueRt','save','remove','emit','hasOwnProperty'];(function(_0x142993,_0xc51307){var _0x46e02b=function(_0x3eb143){while(--_0x3eb143){_0x142993['push'](_0x142993['shift']());}};_0x46e02b(++_0xc51307);}(_0xbe64,0x65));var _0x4be6=function(_0x20cb20,_0x256051){_0x20cb20=_0x20cb20-0x0;var _0x2fcf4b=_0xbe64[_0x20cb20];return _0x2fcf4b;};'use strict';var EventEmitter=require(_0x4be6('0x0'));var UserVoiceQueueRt=require(_0x4be6('0x1'))['db'][_0x4be6('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4be6('0x3'),'afterUpdate':'update','afterDestroy':_0x4be6('0x4')};function emitEvent(_0x4d5b04){return function(_0x3ee814,_0x2107d9,_0x1f8eca){UserVoiceQueueRtEvents[_0x4be6('0x5')](_0x4d5b04+':'+_0x3ee814['id'],_0x3ee814);UserVoiceQueueRtEvents['emit'](_0x4d5b04,_0x3ee814);_0x1f8eca(null);};}for(var e in events){if(events[_0x4be6('0x6')](e)){var event=events[e];UserVoiceQueueRt[_0x4be6('0x7')](e,emitEvent(event));}}module[_0x4be6('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x4dfe=['../../mysqldb','UserVoiceQueueRt','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0xba2fcc,_0x337a22){var _0x18faeb=function(_0x2e7fbf){while(--_0x2e7fbf){_0xba2fcc['push'](_0xba2fcc['shift']());}};_0x18faeb(++_0x337a22);}(_0x4dfe,0x12b));var _0xe4df=function(_0x50eadb,_0x469621){_0x50eadb=_0x50eadb-0x0;var _0x11935e=_0x4dfe[_0x50eadb];return _0x11935e;};'use strict';var EventEmitter=require(_0xe4df('0x0'));var UserVoiceQueueRt=require(_0xe4df('0x1'))['db'][_0xe4df('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe4df('0x3'),'afterUpdate':_0xe4df('0x4'),'afterDestroy':_0xe4df('0x5')};function emitEvent(_0x38b81){return function(_0x513dba,_0x51de73,_0x14c376){UserVoiceQueueRtEvents[_0xe4df('0x6')](_0x38b81+':'+_0x513dba['id'],_0x513dba);UserVoiceQueueRtEvents['emit'](_0x38b81,_0x513dba);_0x14c376(null);};}for(var e in events){if(events[_0xe4df('0x7')](e)){var event=events[e];UserVoiceQueueRt[_0xe4df('0x8')](e,emitEvent(event));}}module[_0xe4df('0x9')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 927521d..6fedceb 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 _0x707a=['../../config/environment','./userVoiceQueueRt.attributes','exports','user_has_voice_queues_rt','lodash','util','../../config/logger','api','request-promise','path'];(function(_0xbf6d27,_0x3e1eb3){var _0x1d89b6=function(_0x5a15c3){while(--_0x5a15c3){_0xbf6d27['push'](_0xbf6d27['shift']());}};_0x1d89b6(++_0x3e1eb3);}(_0x707a,0x1c6));var _0xa707=function(_0x15ac95,_0x3530d6){_0x15ac95=_0x15ac95-0x0;var _0x40f02a=_0x707a[_0x15ac95];return _0x40f02a;};'use strict';var _=require(_0xa707('0x0'));var util=require(_0xa707('0x1'));var logger=require(_0xa707('0x2'))(_0xa707('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa707('0x4'));var fs=require('fs');var path=require(_0xa707('0x5'));var rimraf=require('rimraf');var config=require(_0xa707('0x6'));var attributes=require(_0xa707('0x7'));module[_0xa707('0x8')]=function(_0x4dacfd,_0x2f6960){return _0x4dacfd['define']('UserVoiceQueueRt',attributes,{'tableName':_0xa707('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9873=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','UserVoiceQueueRt','lodash','util','../../config/logger'];(function(_0x3aa12d,_0x46637f){var _0x19ee16=function(_0x3a8e27){while(--_0x3a8e27){_0x3aa12d['push'](_0x3aa12d['shift']());}};_0x19ee16(++_0x46637f);}(_0x9873,0xcd));var _0x3987=function(_0x11bb54,_0x597a23){_0x11bb54=_0x11bb54-0x0;var _0x3e8cd7=_0x9873[_0x11bb54];return _0x3e8cd7;};'use strict';var _=require(_0x3987('0x0'));var util=require(_0x3987('0x1'));var logger=require(_0x3987('0x2'))(_0x3987('0x3'));var moment=require(_0x3987('0x4'));var BPromise=require(_0x3987('0x5'));var rp=require(_0x3987('0x6'));var fs=require('fs');var path=require(_0x3987('0x7'));var rimraf=require(_0x3987('0x8'));var config=require(_0x3987('0x9'));var attributes=require(_0x3987('0xa'));module[_0x3987('0xb')]=function(_0x294f82,_0x22a301){return _0x294f82['define'](_0x3987('0xc'),attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index 1708c25..768fb70 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 _0x0b07=['options','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','GetVoiceQueueRtPauses','stringify','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','client','http','redis','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','request','then','info','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','UserVoiceQueueRt,\x20%s,\x20%s','message','result','UserVoiceQueueRt','findAll'];(function(_0xaf29da,_0x117f5a){var _0x295c51=function(_0x3feaf4){while(--_0x3feaf4){_0xaf29da['push'](_0xaf29da['shift']());}};_0x295c51(++_0x117f5a);}(_0x0b07,0x15b));var _0x70b0=function(_0x20d08e,_0x4cc575){_0x20d08e=_0x20d08e-0x0;var _0x2cbd12=_0x0b07[_0x20d08e];return _0x2cbd12;};'use strict';var _=require('lodash');var util=require(_0x70b0('0x0'));var moment=require('moment');var BPromise=require(_0x70b0('0x1'));var rs=require(_0x70b0('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x70b0('0x3'))['db'];var utils=require(_0x70b0('0x4'));var logger=require('../../config/logger')(_0x70b0('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x70b0('0x6')][_0x70b0('0x7')]({'port':0x232a});config[_0x70b0('0x8')]=_[_0x70b0('0x9')](config[_0x70b0('0x8')],{'host':_0x70b0('0xa'),'port':0x18eb});var socket=require(_0x70b0('0xb'))(new Redis(config['redis']));require(_0x70b0('0xc'))[_0x70b0('0xd')](socket);function respondWithRpcPromise(_0x379e30,_0xfed8b,_0x13b3f5){return new BPromise(function(_0x383ec1,_0x4d8480){return client[_0x70b0('0xe')](_0x379e30,_0x13b3f5)[_0x70b0('0xf')](function(_0x35d7ea){logger[_0x70b0('0x10')]('UserVoiceQueueRt,\x20%s,\x20%s',_0xfed8b,'request\x20sent');logger[_0x70b0('0x11')](_0x70b0('0x12'),_0xfed8b,_0x70b0('0x13'),JSON['stringify'](_0x35d7ea));if(_0x35d7ea[_0x70b0('0x14')]){if(_0x35d7ea[_0x70b0('0x14')][_0x70b0('0x15')]===0x1f4){logger[_0x70b0('0x14')](_0x70b0('0x16'),_0xfed8b,_0x35d7ea[_0x70b0('0x14')][_0x70b0('0x17')]);return _0x4d8480(_0x35d7ea['error'][_0x70b0('0x17')]);}logger['error'](_0x70b0('0x16'),_0xfed8b,_0x35d7ea[_0x70b0('0x14')][_0x70b0('0x17')]);return _0x383ec1(_0x35d7ea[_0x70b0('0x14')][_0x70b0('0x17')]);}else{logger['info'](_0x70b0('0x16'),_0xfed8b,_0x70b0('0x13'));_0x383ec1(_0x35d7ea[_0x70b0('0x18')]['message']);}})['catch'](function(_0x4f00de){logger[_0x70b0('0x14')](_0x70b0('0x16'),_0xfed8b,_0x4f00de);_0x4d8480(_0x4f00de);});});}exports['GetVoiceQueueRtPauses']=function(_0x41f812){var _0x353c3d=this;return new Promise(function(_0x5851d7,_0x547118){return db[_0x70b0('0x19')][_0x70b0('0x1a')]({'raw':_0x41f812[_0x70b0('0x1b')]?_0x41f812['options']['raw']===undefined?!![]:![]:!![],'where':_0x41f812[_0x70b0('0x1b')]?_0x41f812['options']['where']||null:null,'attributes':[[db[_0x70b0('0x1c')]['fn'](_0x70b0('0x1d'),db[_0x70b0('0x1c')]['fn']('IF',db[_0x70b0('0x1c')][_0x70b0('0x1e')](_0x70b0('0x1f')))),'outboundQueuePauses']]})[_0x70b0('0xf')](function(_0x4ef34c){logger[_0x70b0('0x10')](_0x70b0('0x20'),_0x41f812);logger[_0x70b0('0x11')]('GetVoiceQueueRtPauses',_0x41f812,JSON[_0x70b0('0x21')](_0x4ef34c));_0x5851d7(_0x4ef34c);})['catch'](function(_0x525ca6){logger['error'](_0x70b0('0x20'),_0x525ca6[_0x70b0('0x17')],_0x41f812);_0x547118(_0x353c3d['error'](0x1f4,_0x525ca6[_0x70b0('0x17')]));});});}; \ No newline at end of file +var _0x84df=['../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','GetVoiceQueueRtPauses','UserVoiceQueueRt','options','raw','where','COUNT','sequelize','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','catch','moment','bluebird','ioredis','../../config/utils'];(function(_0x5be263,_0x10c51b){var _0x222130=function(_0x12b966){while(--_0x12b966){_0x5be263['push'](_0x5be263['shift']());}};_0x222130(++_0x10c51b);}(_0x84df,0x125));var _0xf84d=function(_0x19b351,_0x547358){_0x19b351=_0x19b351-0x0;var _0x104803=_0x84df[_0x19b351];return _0x104803;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf84d('0x0'));var BPromise=require(_0xf84d('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf84d('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xf84d('0x3'));var logger=require(_0xf84d('0x4'))('rpc');var config=require(_0xf84d('0x5'));var jayson=require(_0xf84d('0x6'));var client=jayson[_0xf84d('0x7')]['http']({'port':0x232a});config[_0xf84d('0x8')]=_[_0xf84d('0x9')](config['redis'],{'host':_0xf84d('0xa'),'port':0x18eb});var socket=require(_0xf84d('0xb'))(new Redis(config[_0xf84d('0x8')]));require('./userVoiceQueueRt.socket')['register'](socket);function respondWithRpcPromise(_0x371da9,_0x540f42,_0x593246){return new BPromise(function(_0xadcbca,_0xedff96){return client[_0xf84d('0xc')](_0x371da9,_0x593246)[_0xf84d('0xd')](function(_0x4c01aa){logger[_0xf84d('0xe')](_0xf84d('0xf'),_0x540f42,'request\x20sent');logger['debug'](_0xf84d('0x10'),_0x540f42,_0xf84d('0x11'),JSON[_0xf84d('0x12')](_0x4c01aa));if(_0x4c01aa['error']){if(_0x4c01aa[_0xf84d('0x13')]['code']===0x1f4){logger[_0xf84d('0x13')](_0xf84d('0xf'),_0x540f42,_0x4c01aa[_0xf84d('0x13')]['message']);return _0xedff96(_0x4c01aa[_0xf84d('0x13')]['message']);}logger[_0xf84d('0x13')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x540f42,_0x4c01aa[_0xf84d('0x13')][_0xf84d('0x14')]);return _0xadcbca(_0x4c01aa[_0xf84d('0x13')][_0xf84d('0x14')]);}else{logger[_0xf84d('0xe')](_0xf84d('0xf'),_0x540f42,_0xf84d('0x11'));_0xadcbca(_0x4c01aa[_0xf84d('0x15')][_0xf84d('0x14')]);}})['catch'](function(_0x5c71da){logger[_0xf84d('0x13')](_0xf84d('0xf'),_0x540f42,_0x5c71da);_0xedff96(_0x5c71da);});});}exports[_0xf84d('0x16')]=function(_0x4f327c){var _0x2a12b9=this;return new Promise(function(_0xc157d,_0x3652f4){return db[_0xf84d('0x17')]['findAll']({'raw':_0x4f327c[_0xf84d('0x18')]?_0x4f327c[_0xf84d('0x18')][_0xf84d('0x19')]===undefined?!![]:![]:!![],'where':_0x4f327c['options']?_0x4f327c[_0xf84d('0x18')][_0xf84d('0x1a')]||null:null,'attributes':[[db['sequelize']['fn'](_0xf84d('0x1b'),db['sequelize']['fn']('IF',db[_0xf84d('0x1c')][_0xf84d('0x1d')](_0xf84d('0x1e')))),_0xf84d('0x1f')]]})[_0xf84d('0xd')](function(_0xe1b9a5){logger[_0xf84d('0xe')](_0xf84d('0x16'),_0x4f327c);logger['debug']('GetVoiceQueueRtPauses',_0x4f327c,JSON[_0xf84d('0x12')](_0xe1b9a5));_0xc157d(_0xe1b9a5);})[_0xf84d('0x20')](function(_0x1119e2){logger[_0xf84d('0x13')](_0xf84d('0x16'),_0x1119e2[_0xf84d('0x14')],_0x4f327c);_0x3652f4(_0x2a12b9[_0xf84d('0x13')](0x1f4,_0x1119e2[_0xf84d('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 9d558e6..a178f6a 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 _0xe5e0=['emit','removeListener','register','length','userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove','update'];(function(_0x514b7f,_0xf9691d){var _0x85eb1d=function(_0x324345){while(--_0x324345){_0x514b7f['push'](_0x514b7f['shift']());}};_0x85eb1d(++_0xf9691d);}(_0xe5e0,0x1be));var _0x0e5e=function(_0xc9b15b,_0xd4a679){_0xc9b15b=_0xc9b15b-0x0;var _0x8e1ffd=_0xe5e0[_0xc9b15b];return _0x8e1ffd;};'use strict';var UserVoiceQueueRtEvents=require(_0x0e5e('0x0'));var events=[_0x0e5e('0x1'),_0x0e5e('0x2'),_0x0e5e('0x3')];function createListener(_0x3ec1ea,_0x110cf9){return function(_0x127e22){_0x110cf9[_0x0e5e('0x4')](_0x3ec1ea,_0x127e22);};}function removeListener(_0xe914ff,_0x57244d){return function(){UserVoiceQueueRtEvents[_0x0e5e('0x5')](_0xe914ff,_0x57244d);};}exports[_0x0e5e('0x6')]=function(_0x14afb0){for(var _0x5f044c=0x0,_0x4b9800=events[_0x0e5e('0x7')];_0x5f044c<_0x4b9800;_0x5f044c++){var _0x827738=events[_0x5f044c];var _0x4093cc=createListener(_0x0e5e('0x8')+_0x827738,_0x14afb0);UserVoiceQueueRtEvents['on'](_0x827738,_0x4093cc);}}; \ No newline at end of file +var _0xecb2=['userVoiceQueueRt:','./userVoiceQueueRt.events','update','emit','removeListener','register','length'];(function(_0x4c9d95,_0x5a76f0){var _0x444fd2=function(_0x37a558){while(--_0x37a558){_0x4c9d95['push'](_0x4c9d95['shift']());}};_0x444fd2(++_0x5a76f0);}(_0xecb2,0xf6));var _0x2ecb=function(_0x1d4fa5,_0x1f101c){_0x1d4fa5=_0x1d4fa5-0x0;var _0xa11a42=_0xecb2[_0x1d4fa5];return _0xa11a42;};'use strict';var UserVoiceQueueRtEvents=require(_0x2ecb('0x0'));var events=['save','remove',_0x2ecb('0x1')];function createListener(_0x548b3c,_0x59d894){return function(_0x1bb230){_0x59d894[_0x2ecb('0x2')](_0x548b3c,_0x1bb230);};}function removeListener(_0x393e7c,_0x2a4fe5){return function(){UserVoiceQueueRtEvents[_0x2ecb('0x3')](_0x393e7c,_0x2a4fe5);};}exports[_0x2ecb('0x4')]=function(_0x4c169f){for(var _0x51b28c=0x0,_0x49de99=events[_0x2ecb('0x5')];_0x51b28c<_0x49de99;_0x51b28c++){var _0x3df4a0=events[_0x51b28c];var _0x15a959=createListener(_0x2ecb('0x6')+_0x3df4a0,_0x4c169f);UserVoiceQueueRtEvents['on'](_0x3df4a0,_0x15a959);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index e7910c2..1c6ef10 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x16d1b6,_0x5912db){var _0x2ca1f5=function(_0x219bda){while(--_0x219bda){_0x16d1b6['push'](_0x16d1b6['shift']());}};_0x2ca1f5(++_0x5912db);}(_0x9c44,0x178));var _0x49c4=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x9c44[_0x53ccf2];return _0x5a2964;};'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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x49ca83,_0x1a0151){var _0x44e261=function(_0x3c8ccd){while(--_0x3c8ccd){_0x49ca83['push'](_0x49ca83['shift']());}};_0x44e261(++_0x1a0151);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'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/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index a7e4d05..374959e 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 _0x9b08=['sequelize','exports'];(function(_0x3f437c,_0x3c9653){var _0x375df3=function(_0x20d303){while(--_0x20d303){_0x3f437c['push'](_0x3f437c['shift']());}};_0x375df3(++_0x3c9653);}(_0x9b08,0x1ea));var _0x89b0=function(_0x3e7e96,_0x5683ca){_0x3e7e96=_0x3e7e96-0x0;var _0x13f6f0=_0x9b08[_0x3e7e96];return _0x13f6f0;};'use strict';var Sequelize=require(_0x89b0('0x0'));module[_0x89b0('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x04f3=['INTEGER','sequelize','exports'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0x04f3,0x181));var _0x304f=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x04f3[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require(_0x304f('0x0'));module[_0x304f('0x1')]={'penalty':{'type':Sequelize[_0x304f('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index 596da48..0742a56 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 _0xd160=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','user_has_whatsapp_queues','util'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xd160,0x103));var _0x0d16=function(_0xb6e2ea,_0x3b26e9){_0xb6e2ea=_0xb6e2ea-0x0;var _0x2a57bb=_0xd160[_0xb6e2ea];return _0x2a57bb;};'use strict';var _=require('lodash');var util=require(_0x0d16('0x0'));var logger=require(_0x0d16('0x1'))(_0x0d16('0x2'));var moment=require(_0x0d16('0x3'));var BPromise=require(_0x0d16('0x4'));var rp=require(_0x0d16('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0d16('0x6'));var config=require(_0x0d16('0x7'));var attributes=require('./userWhatsappQueue.attributes');module[_0x0d16('0x8')]=function(_0x2b51ba,_0x325a98){return _0x2b51ba['define']('UserWhatsappQueue',attributes,{'tableName':_0x0d16('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4f49=['UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports'];(function(_0x4c506e,_0x81d98d){var _0x42a808=function(_0x55313c){while(--_0x55313c){_0x4c506e['push'](_0x4c506e['shift']());}};_0x42a808(++_0x81d98d);}(_0x4f49,0x12e));var _0x94f4=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x4f49[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x94f4('0x0'));var util=require(_0x94f4('0x1'));var logger=require(_0x94f4('0x2'))(_0x94f4('0x3'));var moment=require('moment');var BPromise=require(_0x94f4('0x4'));var rp=require(_0x94f4('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x94f4('0x6'));var config=require(_0x94f4('0x7'));var attributes=require(_0x94f4('0x8'));module[_0x94f4('0x9')]=function(_0x2666e8,_0x49ef53){return _0x2666e8['define'](_0x94f4('0xa'),attributes,{'tableName':_0x94f4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index 2c65143..94b5295 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 _0x127b=['UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x42fb9a,_0x906eed){var _0x137a58=function(_0x5a6ab2){while(--_0x5a6ab2){_0x42fb9a['push'](_0x42fb9a['shift']());}};_0x137a58(++_0x906eed);}(_0x127b,0x190));var _0xb127=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x127b[_0x199572];return _0x13cfa3;};'use strict';var _=require(_0xb127('0x0'));var util=require(_0xb127('0x1'));var moment=require(_0xb127('0x2'));var BPromise=require('bluebird');var rs=require(_0xb127('0x3'));var fs=require('fs');var Redis=require(_0xb127('0x4'));var db=require(_0xb127('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb127('0x6'))('rpc');var config=require(_0xb127('0x7'));var jayson=require(_0xb127('0x8'));var client=jayson[_0xb127('0x9')][_0xb127('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2fbad0,_0x2f2e70,_0x53a871){return new BPromise(function(_0x137512,_0x4504f5){return client[_0xb127('0xb')](_0x2fbad0,_0x53a871)[_0xb127('0xc')](function(_0xf2a30a){logger[_0xb127('0xd')](_0xb127('0xe'),_0x2f2e70,_0xb127('0xf'));logger['debug'](_0xb127('0x10'),_0x2f2e70,'request\x20sent',JSON[_0xb127('0x11')](_0xf2a30a));if(_0xf2a30a[_0xb127('0x12')]){if(_0xf2a30a['error'][_0xb127('0x13')]===0x1f4){logger[_0xb127('0x12')](_0xb127('0xe'),_0x2f2e70,_0xf2a30a[_0xb127('0x12')][_0xb127('0x14')]);return _0x4504f5(_0xf2a30a[_0xb127('0x12')]['message']);}logger[_0xb127('0x12')](_0xb127('0xe'),_0x2f2e70,_0xf2a30a[_0xb127('0x12')][_0xb127('0x14')]);return _0x137512(_0xf2a30a[_0xb127('0x12')][_0xb127('0x14')]);}else{logger['info'](_0xb127('0xe'),_0x2f2e70,_0xb127('0xf'));_0x137512(_0xf2a30a[_0xb127('0x15')][_0xb127('0x14')]);}})[_0xb127('0x16')](function(_0x291986){logger[_0xb127('0x12')]('UserWhatsappQueue,\x20%s,\x20%s',_0x2f2e70,_0x291986);_0x4504f5(_0x291986);});});} \ No newline at end of file +var _0xfef2=['message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x283cf6,_0x14e096){var _0x4b40e5=function(_0xd340e5){while(--_0xd340e5){_0x283cf6['push'](_0x283cf6['shift']());}};_0x4b40e5(++_0x14e096);}(_0xfef2,0x19b));var _0x2fef=function(_0x28876d,_0x46f49d){_0x28876d=_0x28876d-0x0;var _0x1eb326=_0xfef2[_0x28876d];return _0x1eb326;};'use strict';var _=require(_0x2fef('0x0'));var util=require(_0x2fef('0x1'));var moment=require(_0x2fef('0x2'));var BPromise=require(_0x2fef('0x3'));var rs=require(_0x2fef('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2fef('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2fef('0x6'))('rpc');var config=require(_0x2fef('0x7'));var jayson=require(_0x2fef('0x8'));var client=jayson[_0x2fef('0x9')][_0x2fef('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x78677d,_0x158db4,_0x18b865){return new BPromise(function(_0x47e5f3,_0x3008a6){return client[_0x2fef('0xb')](_0x78677d,_0x18b865)[_0x2fef('0xc')](function(_0x57f772){logger[_0x2fef('0xd')](_0x2fef('0xe'),_0x158db4,'request\x20sent');logger[_0x2fef('0xf')](_0x2fef('0x10'),_0x158db4,_0x2fef('0x11'),JSON[_0x2fef('0x12')](_0x57f772));if(_0x57f772[_0x2fef('0x13')]){if(_0x57f772[_0x2fef('0x13')][_0x2fef('0x14')]===0x1f4){logger[_0x2fef('0x13')]('UserWhatsappQueue,\x20%s,\x20%s',_0x158db4,_0x57f772['error']['message']);return _0x3008a6(_0x57f772[_0x2fef('0x13')][_0x2fef('0x15')]);}logger[_0x2fef('0x13')]('UserWhatsappQueue,\x20%s,\x20%s',_0x158db4,_0x57f772[_0x2fef('0x13')]['message']);return _0x47e5f3(_0x57f772[_0x2fef('0x13')]['message']);}else{logger['info'](_0x2fef('0xe'),_0x158db4,_0x2fef('0x11'));_0x47e5f3(_0x57f772[_0x2fef('0x16')][_0x2fef('0x15')]);}})[_0x2fef('0x17')](function(_0x16afbc){logger['error']('UserWhatsappQueue,\x20%s,\x20%s',_0x158db4,_0x16afbc);_0x3008a6(_0x16afbc);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 8986b70..4c645dc 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 _0xcee8=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','isAuthenticated','index','post','create','put','update','/:id','exports','multer','util','path'];(function(_0xae719b,_0x1828bd){var _0x6c89e9=function(_0x5c2867){while(--_0x5c2867){_0xae719b['push'](_0xae719b['shift']());}};_0x6c89e9(++_0x1828bd);}(_0xcee8,0xb1));var _0x8cee=function(_0x21dbcb,_0x3572a0){_0x21dbcb=_0x21dbcb-0x0;var _0x59243f=_0xcee8[_0x21dbcb];return _0x59243f;};'use strict';var multer=require(_0x8cee('0x0'));var util=require(_0x8cee('0x1'));var path=require(_0x8cee('0x2'));var timeout=require(_0x8cee('0x3'));var express=require(_0x8cee('0x4'));var router=express[_0x8cee('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x8cee('0x6'));var interaction=require(_0x8cee('0x7'));var config=require(_0x8cee('0x8'));var controller=require(_0x8cee('0x9'));router['get']('/',auth[_0x8cee('0xa')](),controller[_0x8cee('0xb')]);router['get']('/:id',auth[_0x8cee('0xa')](),controller['show']);router[_0x8cee('0xc')]('/',auth[_0x8cee('0xa')](),controller[_0x8cee('0xd')]);router[_0x8cee('0xe')]('/:id',auth[_0x8cee('0xa')](),controller[_0x8cee('0xf')]);router['delete'](_0x8cee('0x10'),auth[_0x8cee('0xa')](),controller['destroy']);module[_0x8cee('0x11')]=router; \ No newline at end of file +var _0xc7e9=['destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','index','/:id','isAuthenticated','post','create','put','update'];(function(_0xa326de,_0x141954){var _0x33f0f0=function(_0x47e6ad){while(--_0x47e6ad){_0xa326de['push'](_0xa326de['shift']());}};_0x33f0f0(++_0x141954);}(_0xc7e9,0x1ef));var _0x9c7e=function(_0x22b68a,_0x2bffc3){_0x22b68a=_0x22b68a-0x0;var _0x1ac67a=_0xc7e9[_0x22b68a];return _0x1ac67a;};'use strict';var multer=require(_0x9c7e('0x0'));var util=require(_0x9c7e('0x1'));var path=require('path');var timeout=require(_0x9c7e('0x2'));var express=require(_0x9c7e('0x3'));var router=express[_0x9c7e('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9c7e('0x5'));var interaction=require(_0x9c7e('0x6'));var config=require('../../config/environment');var controller=require('./variable.controller');router[_0x9c7e('0x7')]('/',auth['isAuthenticated'](),controller[_0x9c7e('0x8')]);router[_0x9c7e('0x7')](_0x9c7e('0x9'),auth[_0x9c7e('0xa')](),controller['show']);router[_0x9c7e('0xb')]('/',auth[_0x9c7e('0xa')](),controller[_0x9c7e('0xc')]);router[_0x9c7e('0xd')]('/:id',auth[_0x9c7e('0xa')](),controller[_0x9c7e('0xe')]);router['delete'](_0x9c7e('0x9'),auth['isAuthenticated'](),controller[_0x9c7e('0xf')]);module[_0x9c7e('0x10')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index d807fe2..78bf1cd 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 _0x3d9e=['name','exports','STRING'];(function(_0x4ab2f0,_0x562ee8){var _0x56429d=function(_0x210a71){while(--_0x210a71){_0x4ab2f0['push'](_0x4ab2f0['shift']());}};_0x56429d(++_0x562ee8);}(_0x3d9e,0x181));var _0xe3d9=function(_0x25b4a4,_0x2e081b){_0x25b4a4=_0x25b4a4-0x0;var _0x707267=_0x3d9e[_0x25b4a4];return _0x707267;};'use strict';var Sequelize=require('sequelize');module[_0xe3d9('0x0')]={'name':{'type':Sequelize[_0xe3d9('0x1')],'unique':_0xe3d9('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xe3d9('0x1')]}}; \ No newline at end of file +var _0x87fc=['exports','STRING'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x87fc,0x172));var _0xc87f=function(_0x53e395,_0x4e96c8){_0x53e395=_0x53e395-0x0;var _0x11a33a=_0x87fc[_0x53e395];return _0x11a33a;};'use strict';var Sequelize=require('sequelize');module[_0xc87f('0x0')]={'name':{'type':Sequelize[_0xc87f('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xc87f('0x1')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 3fa21ad..3118595 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 _0x7a84=['model','attributes','fields','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','length','find','catch','body','user','get','role','Variables','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','Variable','rawAttributes','fieldName','type','key','query','keys','filters','intersection'];(function(_0x199edf,_0x51a123){var _0x371080=function(_0x13200b){while(--_0x13200b){_0x199edf['push'](_0x199edf['shift']());}};_0x371080(++_0x51a123);}(_0x7a84,0x17b));var _0x47a8=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x7a84[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0x47a8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x47a8('0x1'));var jsonpatch=require(_0x47a8('0x2'));var rp=require('request-promise');var moment=require(_0x47a8('0x3'));var BPromise=require(_0x47a8('0x4'));var Mustache=require(_0x47a8('0x5'));var util=require(_0x47a8('0x6'));var path=require(_0x47a8('0x7'));var sox=require(_0x47a8('0x8'));var csv=require(_0x47a8('0x9'));var ejs=require(_0x47a8('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x47a8('0xb'));var squel=require(_0x47a8('0xc'));var crypto=require('crypto');var jsforce=require(_0x47a8('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x47a8('0x9'));var querystring=require('querystring');var Papa=require(_0x47a8('0xe'));var Redis=require(_0x47a8('0xf'));var authService=require(_0x47a8('0x10'));var qs=require(_0x47a8('0x11'));var as=require(_0x47a8('0x12'));var hardwareService=require(_0x47a8('0x13'));var logger=require(_0x47a8('0x14'))(_0x47a8('0x15'));var utils=require(_0x47a8('0x16'));var config=require(_0x47a8('0x17'));var licenseUtil=require(_0x47a8('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x444bc8,_0xd82fbe){_0xd82fbe=_0xd82fbe||0xcc;return function(_0x529cb2){if(_0x529cb2){return _0x444bc8[_0x47a8('0x19')](_0xd82fbe);}return _0x444bc8['status'](_0xd82fbe)[_0x47a8('0x1a')]();};}function respondWithResult(_0x58e494,_0x197bbf){_0x197bbf=_0x197bbf||0xc8;return function(_0x4d850a){if(_0x4d850a){return _0x58e494[_0x47a8('0x1b')](_0x197bbf)[_0x47a8('0x1c')](_0x4d850a);}};}function respondWithFilteredResult(_0x1656e8,_0x4bad7c){return function(_0x590dae){if(_0x590dae){var _0x3d7c6d=typeof _0x4bad7c['offset']===_0x47a8('0x1d')&&typeof _0x4bad7c[_0x47a8('0x1e')]===_0x47a8('0x1d');var _0x1a056c=_0x590dae[_0x47a8('0x1f')];var _0xfd4105=_0x3d7c6d?0x0:_0x4bad7c['offset'];var _0x1aeb08=_0x3d7c6d?_0x590dae[_0x47a8('0x1f')]:_0x4bad7c[_0x47a8('0x20')]+_0x4bad7c[_0x47a8('0x1e')];var _0xe96b33;if(_0x1aeb08>=_0x1a056c){_0x1aeb08=_0x1a056c;_0xe96b33=0xc8;}else{_0xe96b33=0xce;}_0x1656e8['status'](_0xe96b33);return _0x1656e8[_0x47a8('0x21')](_0x47a8('0x22'),_0xfd4105+'-'+_0x1aeb08+'/'+_0x1a056c)['json'](_0x590dae);}return null;};}function patchUpdates(_0x5159aa){return function(_0x5962a5){try{jsonpatch[_0x47a8('0x23')](_0x5962a5,_0x5159aa,!![]);}catch(_0x3aa1bb){return BPromise[_0x47a8('0x24')](_0x3aa1bb);}return _0x5962a5[_0x47a8('0x25')]();};}function saveUpdates(_0x110e3c,_0x252b27){return function(_0x946090){if(_0x946090){return _0x946090[_0x47a8('0x26')](_0x110e3c)['then'](function(_0x3733b7){return _0x3733b7;});}return null;};}function removeEntity(_0x10f331,_0x254b7a){return function(_0x4307cc){if(_0x4307cc){return _0x4307cc[_0x47a8('0x27')]()[_0x47a8('0x28')](function(){var _0x458156=_0x4307cc['get']({'plain':!![]});var _0x385fe2='Variables';return db['UserProfileResource'][_0x47a8('0x27')]({'where':{'type':_0x385fe2,'resourceId':_0x458156['id']}})['then'](function(){return _0x4307cc;});})[_0x47a8('0x28')](function(){_0x10f331[_0x47a8('0x1b')](0xcc)[_0x47a8('0x1a')]();});}};}function handleEntityNotFound(_0x157629,_0x21c68c){return function(_0xe01a65){if(!_0xe01a65){_0x157629[_0x47a8('0x19')](0x194);}return _0xe01a65;};}function handleError(_0x549c19,_0x4efa10){_0x4efa10=_0x4efa10||0x1f4;return function(_0xbf4911){logger[_0x47a8('0x29')](_0xbf4911[_0x47a8('0x2a')]);if(_0xbf4911[_0x47a8('0x2b')]){delete _0xbf4911['name'];}_0x549c19['status'](_0x4efa10)[_0x47a8('0x2c')](_0xbf4911);};}exports[_0x47a8('0x2d')]=function(_0x211011,_0x130625){var _0x228bb2={},_0x19f331={},_0x59a7af={'count':0x0,'rows':[]};var _0x22a83c=_[_0x47a8('0x2e')](db[_0x47a8('0x2f')][_0x47a8('0x30')],function(_0x1489a2){return{'name':_0x1489a2[_0x47a8('0x31')],'type':_0x1489a2[_0x47a8('0x32')][_0x47a8('0x33')]};});_0x19f331['model']=_['map'](_0x22a83c,_0x47a8('0x2b'));_0x19f331[_0x47a8('0x34')]=_[_0x47a8('0x35')](_0x211011['query']);_0x19f331[_0x47a8('0x36')]=_[_0x47a8('0x37')](_0x19f331[_0x47a8('0x38')],_0x19f331[_0x47a8('0x34')]);_0x228bb2[_0x47a8('0x39')]=_[_0x47a8('0x37')](_0x19f331[_0x47a8('0x38')],qs[_0x47a8('0x3a')](_0x211011[_0x47a8('0x34')][_0x47a8('0x3a')]));_0x228bb2[_0x47a8('0x39')]=_0x228bb2['attributes']['length']?_0x228bb2[_0x47a8('0x39')]:_0x19f331['model'];if(!_0x211011[_0x47a8('0x34')][_0x47a8('0x3b')](_0x47a8('0x3c'))){_0x228bb2['limit']=qs[_0x47a8('0x1e')](_0x211011[_0x47a8('0x34')][_0x47a8('0x1e')]);_0x228bb2[_0x47a8('0x20')]=qs[_0x47a8('0x20')](_0x211011[_0x47a8('0x34')][_0x47a8('0x20')]);}_0x228bb2['order']=qs[_0x47a8('0x3d')](_0x211011[_0x47a8('0x34')]['sort']);_0x228bb2[_0x47a8('0x3e')]=qs['filters'](_['pick'](_0x211011[_0x47a8('0x34')],_0x19f331['filters']),_0x22a83c);if(_0x211011[_0x47a8('0x34')][_0x47a8('0x3f')]){_0x228bb2[_0x47a8('0x3e')]=_['merge'](_0x228bb2[_0x47a8('0x3e')],{'$or':_[_0x47a8('0x2e')](_0x22a83c,function(_0x275d0f){if(_0x275d0f[_0x47a8('0x32')]!==_0x47a8('0x40')){var _0x4d6fe8={};_0x4d6fe8[_0x275d0f[_0x47a8('0x2b')]]={'$like':'%'+_0x211011[_0x47a8('0x34')][_0x47a8('0x3f')]+'%'};return _0x4d6fe8;}})});}_0x228bb2=_[_0x47a8('0x41')]({},_0x228bb2,_0x211011[_0x47a8('0x42')]);var _0x30dc86={'where':_0x228bb2[_0x47a8('0x3e')]};return db[_0x47a8('0x2f')][_0x47a8('0x1f')](_0x30dc86)[_0x47a8('0x28')](function(_0x498327){_0x59a7af[_0x47a8('0x1f')]=_0x498327;if(_0x211011[_0x47a8('0x34')][_0x47a8('0x43')]){_0x228bb2[_0x47a8('0x44')]=[{'all':!![]}];}return db[_0x47a8('0x2f')][_0x47a8('0x45')](_0x228bb2);})[_0x47a8('0x28')](function(_0x3e5c0c){_0x59a7af[_0x47a8('0x46')]=_0x3e5c0c;return _0x59a7af;})['then'](respondWithFilteredResult(_0x130625,_0x228bb2))['catch'](handleError(_0x130625,null));};exports[_0x47a8('0x47')]=function(_0x15de4c,_0xbbbb78){var _0x376bef={'raw':!![],'where':{'id':_0x15de4c[_0x47a8('0x48')]['id']}},_0x1f87d9={};_0x1f87d9[_0x47a8('0x38')]=_[_0x47a8('0x35')](db[_0x47a8('0x2f')][_0x47a8('0x30')]);_0x1f87d9[_0x47a8('0x34')]=_[_0x47a8('0x35')](_0x15de4c[_0x47a8('0x34')]);_0x1f87d9[_0x47a8('0x36')]=_[_0x47a8('0x37')](_0x1f87d9['model'],_0x1f87d9[_0x47a8('0x34')]);_0x376bef['attributes']=_[_0x47a8('0x37')](_0x1f87d9[_0x47a8('0x38')],qs['fields'](_0x15de4c[_0x47a8('0x34')]['fields']));_0x376bef[_0x47a8('0x39')]=_0x376bef[_0x47a8('0x39')][_0x47a8('0x49')]?_0x376bef[_0x47a8('0x39')]:_0x1f87d9[_0x47a8('0x38')];if(_0x15de4c[_0x47a8('0x34')][_0x47a8('0x43')]){_0x376bef[_0x47a8('0x44')]=[{'all':!![]}];}_0x376bef=_[_0x47a8('0x41')]({},_0x376bef,_0x15de4c[_0x47a8('0x42')]);return db['Variable'][_0x47a8('0x4a')](_0x376bef)[_0x47a8('0x28')](handleEntityNotFound(_0xbbbb78,null))[_0x47a8('0x28')](respondWithResult(_0xbbbb78,null))[_0x47a8('0x4b')](handleError(_0xbbbb78,null));};exports['create']=function(_0x5a8f0c,_0x2bd84d){return db['Variable']['create'](_0x5a8f0c[_0x47a8('0x4c')],{})[_0x47a8('0x28')](function(_0x334efb){var _0x1beccb=_0x5a8f0c[_0x47a8('0x4d')][_0x47a8('0x4e')]({'plain':!![]});if(!_0x1beccb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1beccb[_0x47a8('0x4f')]===_0x47a8('0x4d')){var _0x243394=_0x334efb[_0x47a8('0x4e')]({'plain':!![]});var _0x3a6faa=_0x47a8('0x50');return db[_0x47a8('0x51')]['find']({'where':{'name':_0x3a6faa,'userProfileId':_0x1beccb[_0x47a8('0x52')]},'raw':!![]})[_0x47a8('0x28')](function(_0x5823e1){if(_0x5823e1&&_0x5823e1[_0x47a8('0x53')]===0x0){return db[_0x47a8('0x54')][_0x47a8('0x55')]({'name':_0x243394[_0x47a8('0x2b')],'resourceId':_0x243394['id'],'type':_0x5823e1[_0x47a8('0x2b')],'sectionId':_0x5823e1['id']},{})[_0x47a8('0x28')](function(){return _0x334efb;});}else{return _0x334efb;}})[_0x47a8('0x4b')](function(_0x9a3e45){logger['error'](_0x47a8('0x56'),_0x9a3e45);throw _0x9a3e45;});}return _0x334efb;})['then'](respondWithResult(_0x2bd84d,0xc9))[_0x47a8('0x4b')](handleError(_0x2bd84d,null));};exports[_0x47a8('0x26')]=function(_0x38fb4e,_0x2a9a5e){if(_0x38fb4e[_0x47a8('0x4c')]['id']){delete _0x38fb4e[_0x47a8('0x4c')]['id'];}return db[_0x47a8('0x2f')]['find']({'where':{'id':_0x38fb4e['params']['id']}})['then'](handleEntityNotFound(_0x2a9a5e,null))[_0x47a8('0x28')](saveUpdates(_0x38fb4e[_0x47a8('0x4c')],null))['then'](respondWithResult(_0x2a9a5e,null))[_0x47a8('0x4b')](handleError(_0x2a9a5e,null));};exports[_0x47a8('0x27')]=function(_0x5a932b,_0x3a103c){return db[_0x47a8('0x2f')][_0x47a8('0x4a')]({'where':{'id':_0x5a932b[_0x47a8('0x48')]['id']}})[_0x47a8('0x28')](handleEntityNotFound(_0x3a103c,null))[_0x47a8('0x28')](removeEntity(_0x3a103c,null))[_0x47a8('0x4b')](handleError(_0x3a103c,null));}; \ No newline at end of file +var _0xaaf0=['jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Variables','UserProfileResource','end','stack','name','index','map','Variable','rawAttributes','fieldName','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto'];(function(_0x3fbbdf,_0x168c77){var _0x5677df=function(_0x5110ab){while(--_0x5110ab){_0x3fbbdf['push'](_0x3fbbdf['shift']());}};_0x5677df(++_0x168c77);}(_0xaaf0,0x147));var _0x0aaf=function(_0xf8e0c5,_0x226f29){_0xf8e0c5=_0xf8e0c5-0x0;var _0x1d0875=_0xaaf0[_0xf8e0c5];return _0x1d0875;};'use strict';var emlformat=require(_0x0aaf('0x0'));var rimraf=require(_0x0aaf('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0aaf('0x2'));var rp=require('request-promise');var moment=require(_0x0aaf('0x3'));var BPromise=require(_0x0aaf('0x4'));var Mustache=require(_0x0aaf('0x5'));var util=require('util');var path=require(_0x0aaf('0x6'));var sox=require(_0x0aaf('0x7'));var csv=require('to-csv');var ejs=require(_0x0aaf('0x8'));var fs=require('fs');var fs_extra=require(_0x0aaf('0x9'));var _=require(_0x0aaf('0xa'));var squel=require(_0x0aaf('0xb'));var crypto=require(_0x0aaf('0xc'));var jsforce=require(_0x0aaf('0xd'));var deskjs=require(_0x0aaf('0xe'));var toCsv=require(_0x0aaf('0xf'));var querystring=require('querystring');var Papa=require(_0x0aaf('0x10'));var Redis=require(_0x0aaf('0x11'));var authService=require(_0x0aaf('0x12'));var qs=require(_0x0aaf('0x13'));var as=require(_0x0aaf('0x14'));var hardwareService=require(_0x0aaf('0x15'));var logger=require('../../config/logger')(_0x0aaf('0x16'));var utils=require(_0x0aaf('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x0aaf('0x18'));var db=require(_0x0aaf('0x19'))['db'];function respondWithStatusCode(_0x55c390,_0x83d5c0){_0x83d5c0=_0x83d5c0||0xcc;return function(_0x1aefe8){if(_0x1aefe8){return _0x55c390[_0x0aaf('0x1a')](_0x83d5c0);}return _0x55c390[_0x0aaf('0x1b')](_0x83d5c0)['end']();};}function respondWithResult(_0x6311d3,_0x45d128){_0x45d128=_0x45d128||0xc8;return function(_0x53254f){if(_0x53254f){return _0x6311d3[_0x0aaf('0x1b')](_0x45d128)[_0x0aaf('0x1c')](_0x53254f);}};}function respondWithFilteredResult(_0x3a53f4,_0x5aead0){return function(_0x425830){if(_0x425830){var _0x359695=typeof _0x5aead0[_0x0aaf('0x1d')]===_0x0aaf('0x1e')&&typeof _0x5aead0[_0x0aaf('0x1f')]===_0x0aaf('0x1e');var _0xea8f5f=_0x425830['count'];var _0x26e052=_0x359695?0x0:_0x5aead0[_0x0aaf('0x1d')];var _0x88371a=_0x359695?_0x425830[_0x0aaf('0x20')]:_0x5aead0[_0x0aaf('0x1d')]+_0x5aead0['limit'];var _0x41fa13;if(_0x88371a>=_0xea8f5f){_0x88371a=_0xea8f5f;_0x41fa13=0xc8;}else{_0x41fa13=0xce;}_0x3a53f4['status'](_0x41fa13);return _0x3a53f4[_0x0aaf('0x21')](_0x0aaf('0x22'),_0x26e052+'-'+_0x88371a+'/'+_0xea8f5f)[_0x0aaf('0x1c')](_0x425830);}return null;};}function patchUpdates(_0x3b5bed){return function(_0x41cdb2){try{jsonpatch[_0x0aaf('0x23')](_0x41cdb2,_0x3b5bed,!![]);}catch(_0x487f2d){return BPromise[_0x0aaf('0x24')](_0x487f2d);}return _0x41cdb2[_0x0aaf('0x25')]();};}function saveUpdates(_0x7294c1,_0x39e6f4){return function(_0x817aea){if(_0x817aea){return _0x817aea[_0x0aaf('0x26')](_0x7294c1)[_0x0aaf('0x27')](function(_0x1b3a1f){return _0x1b3a1f;});}return null;};}function removeEntity(_0x3ca544,_0x5cd734){return function(_0x4fe833){if(_0x4fe833){return _0x4fe833[_0x0aaf('0x28')]()[_0x0aaf('0x27')](function(){var _0x3af8ad=_0x4fe833[_0x0aaf('0x29')]({'plain':!![]});var _0x462682=_0x0aaf('0x2a');return db[_0x0aaf('0x2b')][_0x0aaf('0x28')]({'where':{'type':_0x462682,'resourceId':_0x3af8ad['id']}})[_0x0aaf('0x27')](function(){return _0x4fe833;});})[_0x0aaf('0x27')](function(){_0x3ca544['status'](0xcc)[_0x0aaf('0x2c')]();});}};}function handleEntityNotFound(_0x298f06,_0x19a6b1){return function(_0x4628ba){if(!_0x4628ba){_0x298f06['sendStatus'](0x194);}return _0x4628ba;};}function handleError(_0x5b8382,_0x2263b8){_0x2263b8=_0x2263b8||0x1f4;return function(_0x3e6768){logger['error'](_0x3e6768[_0x0aaf('0x2d')]);if(_0x3e6768[_0x0aaf('0x2e')]){delete _0x3e6768[_0x0aaf('0x2e')];}_0x5b8382[_0x0aaf('0x1b')](_0x2263b8)['send'](_0x3e6768);};}exports[_0x0aaf('0x2f')]=function(_0x50126a,_0x43feb3){var _0x3f5753={},_0x34346f={},_0x417d4f={'count':0x0,'rows':[]};var _0x34e7bb=_[_0x0aaf('0x30')](db[_0x0aaf('0x31')][_0x0aaf('0x32')],function(_0x1554be){return{'name':_0x1554be[_0x0aaf('0x33')],'type':_0x1554be['type'][_0x0aaf('0x34')]};});_0x34346f['model']=_[_0x0aaf('0x30')](_0x34e7bb,_0x0aaf('0x2e'));_0x34346f[_0x0aaf('0x35')]=_[_0x0aaf('0x36')](_0x50126a[_0x0aaf('0x35')]);_0x34346f[_0x0aaf('0x37')]=_[_0x0aaf('0x38')](_0x34346f[_0x0aaf('0x39')],_0x34346f[_0x0aaf('0x35')]);_0x3f5753['attributes']=_[_0x0aaf('0x38')](_0x34346f[_0x0aaf('0x39')],qs[_0x0aaf('0x3a')](_0x50126a['query'][_0x0aaf('0x3a')]));_0x3f5753[_0x0aaf('0x3b')]=_0x3f5753[_0x0aaf('0x3b')][_0x0aaf('0x3c')]?_0x3f5753[_0x0aaf('0x3b')]:_0x34346f[_0x0aaf('0x39')];if(!_0x50126a[_0x0aaf('0x35')][_0x0aaf('0x3d')](_0x0aaf('0x3e'))){_0x3f5753[_0x0aaf('0x1f')]=qs[_0x0aaf('0x1f')](_0x50126a[_0x0aaf('0x35')][_0x0aaf('0x1f')]);_0x3f5753[_0x0aaf('0x1d')]=qs[_0x0aaf('0x1d')](_0x50126a['query'][_0x0aaf('0x1d')]);}_0x3f5753['order']=qs[_0x0aaf('0x3f')](_0x50126a[_0x0aaf('0x35')][_0x0aaf('0x3f')]);_0x3f5753['where']=qs[_0x0aaf('0x37')](_[_0x0aaf('0x40')](_0x50126a[_0x0aaf('0x35')],_0x34346f['filters']),_0x34e7bb);if(_0x50126a['query'][_0x0aaf('0x41')]){_0x3f5753[_0x0aaf('0x42')]=_[_0x0aaf('0x43')](_0x3f5753[_0x0aaf('0x42')],{'$or':_[_0x0aaf('0x30')](_0x34e7bb,function(_0x33d19){if(_0x33d19['type']!=='VIRTUAL'){var _0x80295a={};_0x80295a[_0x33d19[_0x0aaf('0x2e')]]={'$like':'%'+_0x50126a[_0x0aaf('0x35')][_0x0aaf('0x41')]+'%'};return _0x80295a;}})});}_0x3f5753=_[_0x0aaf('0x43')]({},_0x3f5753,_0x50126a[_0x0aaf('0x44')]);var _0x2a9677={'where':_0x3f5753['where']};return db['Variable'][_0x0aaf('0x20')](_0x2a9677)[_0x0aaf('0x27')](function(_0x1d3941){_0x417d4f['count']=_0x1d3941;if(_0x50126a['query'][_0x0aaf('0x45')]){_0x3f5753[_0x0aaf('0x46')]=[{'all':!![]}];}return db[_0x0aaf('0x31')][_0x0aaf('0x47')](_0x3f5753);})[_0x0aaf('0x27')](function(_0x2dd9d0){_0x417d4f[_0x0aaf('0x48')]=_0x2dd9d0;return _0x417d4f;})[_0x0aaf('0x27')](respondWithFilteredResult(_0x43feb3,_0x3f5753))[_0x0aaf('0x49')](handleError(_0x43feb3,null));};exports[_0x0aaf('0x4a')]=function(_0x385636,_0xdc20d){var _0x1f873b={'raw':!![],'where':{'id':_0x385636[_0x0aaf('0x4b')]['id']}},_0x3e1692={};_0x3e1692[_0x0aaf('0x39')]=_[_0x0aaf('0x36')](db[_0x0aaf('0x31')][_0x0aaf('0x32')]);_0x3e1692[_0x0aaf('0x35')]=_[_0x0aaf('0x36')](_0x385636[_0x0aaf('0x35')]);_0x3e1692[_0x0aaf('0x37')]=_[_0x0aaf('0x38')](_0x3e1692['model'],_0x3e1692[_0x0aaf('0x35')]);_0x1f873b['attributes']=_['intersection'](_0x3e1692[_0x0aaf('0x39')],qs['fields'](_0x385636[_0x0aaf('0x35')][_0x0aaf('0x3a')]));_0x1f873b[_0x0aaf('0x3b')]=_0x1f873b[_0x0aaf('0x3b')][_0x0aaf('0x3c')]?_0x1f873b[_0x0aaf('0x3b')]:_0x3e1692[_0x0aaf('0x39')];if(_0x385636[_0x0aaf('0x35')]['includeAll']){_0x1f873b[_0x0aaf('0x46')]=[{'all':!![]}];}_0x1f873b=_[_0x0aaf('0x43')]({},_0x1f873b,_0x385636[_0x0aaf('0x44')]);return db[_0x0aaf('0x31')][_0x0aaf('0x4c')](_0x1f873b)[_0x0aaf('0x27')](handleEntityNotFound(_0xdc20d,null))[_0x0aaf('0x27')](respondWithResult(_0xdc20d,null))[_0x0aaf('0x49')](handleError(_0xdc20d,null));};exports[_0x0aaf('0x4d')]=function(_0x340de8,_0x2cb0a5){return db[_0x0aaf('0x31')][_0x0aaf('0x4d')](_0x340de8[_0x0aaf('0x4e')],{})[_0x0aaf('0x27')](function(_0x252d88){var _0x53e06a=_0x340de8[_0x0aaf('0x4f')]['get']({'plain':!![]});if(!_0x53e06a)throw new Error(_0x0aaf('0x50'));if(_0x53e06a['role']===_0x0aaf('0x4f')){var _0x5e2ebe=_0x252d88['get']({'plain':!![]});var _0x34a98a=_0x0aaf('0x2a');return db[_0x0aaf('0x51')][_0x0aaf('0x4c')]({'where':{'name':_0x34a98a,'userProfileId':_0x53e06a[_0x0aaf('0x52')]},'raw':!![]})[_0x0aaf('0x27')](function(_0x1f1f4f){if(_0x1f1f4f&&_0x1f1f4f['autoAssociation']===0x0){return db[_0x0aaf('0x2b')][_0x0aaf('0x4d')]({'name':_0x5e2ebe['name'],'resourceId':_0x5e2ebe['id'],'type':_0x1f1f4f[_0x0aaf('0x2e')],'sectionId':_0x1f1f4f['id']},{})[_0x0aaf('0x27')](function(){return _0x252d88;});}else{return _0x252d88;}})[_0x0aaf('0x49')](function(_0x1d9e37){logger[_0x0aaf('0x53')](_0x0aaf('0x54'),_0x1d9e37);throw _0x1d9e37;});}return _0x252d88;})[_0x0aaf('0x27')](respondWithResult(_0x2cb0a5,0xc9))['catch'](handleError(_0x2cb0a5,null));};exports[_0x0aaf('0x26')]=function(_0x1b46cc,_0x117eef){if(_0x1b46cc[_0x0aaf('0x4e')]['id']){delete _0x1b46cc['body']['id'];}return db[_0x0aaf('0x31')][_0x0aaf('0x4c')]({'where':{'id':_0x1b46cc['params']['id']}})[_0x0aaf('0x27')](handleEntityNotFound(_0x117eef,null))[_0x0aaf('0x27')](saveUpdates(_0x1b46cc[_0x0aaf('0x4e')],null))['then'](respondWithResult(_0x117eef,null))['catch'](handleError(_0x117eef,null));};exports['destroy']=function(_0x80fb5a,_0x503497){return db[_0x0aaf('0x31')][_0x0aaf('0x4c')]({'where':{'id':_0x80fb5a['params']['id']}})[_0x0aaf('0x27')](handleEntityNotFound(_0x503497,null))[_0x0aaf('0x27')](removeEntity(_0x503497,null))['catch'](handleError(_0x503497,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 2f0f100..f0df46b 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 _0x3be2=['./variable.attributes','exports','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0xdda919,_0x2fc5d1){var _0x4c91ff=function(_0x281865){while(--_0x281865){_0xdda919['push'](_0xdda919['shift']());}};_0x4c91ff(++_0x2fc5d1);}(_0x3be2,0x1b0));var _0x23be=function(_0x3a7b97,_0x54201f){_0x3a7b97=_0x3a7b97-0x0;var _0x4fd9ea=_0x3be2[_0x3a7b97];return _0x4fd9ea;};'use strict';var _=require(_0x23be('0x0'));var util=require(_0x23be('0x1'));var logger=require(_0x23be('0x2'))(_0x23be('0x3'));var moment=require(_0x23be('0x4'));var BPromise=require(_0x23be('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x23be('0x6'));var rimraf=require(_0x23be('0x7'));var config=require('../../config/environment');var attributes=require(_0x23be('0x8'));module[_0x23be('0x9')]=function(_0x4b17f2,_0x38442a){return _0x4b17f2['define']('Variable',attributes,{'tableName':'tools_variables','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbdd0=['moment','request-promise','path','rimraf','./variable.attributes','exports','Variable','../../config/logger','api'];(function(_0xbc3102,_0xb85f4d){var _0x388ca7=function(_0x1ade78){while(--_0x1ade78){_0xbc3102['push'](_0xbc3102['shift']());}};_0x388ca7(++_0xb85f4d);}(_0xbdd0,0x7c));var _0x0bdd=function(_0x2a59af,_0x18d558){_0x2a59af=_0x2a59af-0x0;var _0x3af243=_0xbdd0[_0x2a59af];return _0x3af243;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0bdd('0x0'))(_0x0bdd('0x1'));var moment=require(_0x0bdd('0x2'));var BPromise=require('bluebird');var rp=require(_0x0bdd('0x3'));var fs=require('fs');var path=require(_0x0bdd('0x4'));var rimraf=require(_0x0bdd('0x5'));var config=require('../../config/environment');var attributes=require(_0x0bdd('0x6'));module[_0x0bdd('0x7')]=function(_0x305bb2,_0x3343c6){return _0x305bb2['define'](_0x0bdd('0x8'),attributes,{'tableName':'tools_variables','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index 0d0d9d4..5a88919 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 _0x7217=['where','attributes','map','include','model','ShowVariable','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Variable,\x20%s,\x20%s','debug','Variable,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','Variable','find','options','raw'];(function(_0x56772a,_0x43682f){var _0x4f6606=function(_0x5f5337){while(--_0x5f5337){_0x56772a['push'](_0x56772a['shift']());}};_0x4f6606(++_0x43682f);}(_0x7217,0x19e));var _0x7721=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7217[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var moment=require(_0x7721('0x1'));var BPromise=require(_0x7721('0x2'));var rs=require(_0x7721('0x3'));var fs=require('fs');var Redis=require(_0x7721('0x4'));var db=require(_0x7721('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7721('0x6'));var config=require(_0x7721('0x7'));var jayson=require(_0x7721('0x8'));var client=jayson[_0x7721('0x9')][_0x7721('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf7ff37,_0x18ab6b,_0x21f680){return new BPromise(function(_0x225610,_0x2f99ed){return client[_0x7721('0xb')](_0xf7ff37,_0x21f680)[_0x7721('0xc')](function(_0xfa8835){logger[_0x7721('0xd')](_0x7721('0xe'),_0x18ab6b,'request\x20sent');logger[_0x7721('0xf')](_0x7721('0x10'),_0x18ab6b,_0x7721('0x11'),JSON[_0x7721('0x12')](_0xfa8835));if(_0xfa8835[_0x7721('0x13')]){if(_0xfa8835[_0x7721('0x13')][_0x7721('0x14')]===0x1f4){logger[_0x7721('0x13')]('Variable,\x20%s,\x20%s',_0x18ab6b,_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);return _0x2f99ed(_0xfa8835['error'][_0x7721('0x15')]);}logger[_0x7721('0x13')](_0x7721('0xe'),_0x18ab6b,_0xfa8835[_0x7721('0x13')]['message']);return _0x225610(_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);}else{logger['info']('Variable,\x20%s,\x20%s',_0x18ab6b,'request\x20sent');_0x225610(_0xfa8835[_0x7721('0x16')][_0x7721('0x15')]);}})[_0x7721('0x17')](function(_0x32550d){logger['error'](_0x7721('0xe'),_0x18ab6b,_0x32550d);_0x2f99ed(_0x32550d);});});}exports['ShowVariable']=function(_0x3fc09e){var _0x5cb0e6=this;return new Promise(function(_0xfec626,_0x4e96fb){return db[_0x7721('0x18')][_0x7721('0x19')]({'raw':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1b')]===undefined?!![]:![]:!![],'where':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1c')]||null:null,'attributes':_0x3fc09e['options']?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1d')]||null:null,'include':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')]['include']?_[_0x7721('0x1e')](_0x3fc09e['options'][_0x7721('0x1f')],function(_0x288e3a){return{'model':db[_0x288e3a[_0x7721('0x20')]],'as':_0x288e3a['as'],'attributes':_0x288e3a[_0x7721('0x1d')],'include':_0x288e3a[_0x7721('0x1f')]?_[_0x7721('0x1e')](_0x288e3a[_0x7721('0x1f')],function(_0x5b4d74){return{'model':db[_0x5b4d74[_0x7721('0x20')]],'as':_0x5b4d74['as'],'attributes':_0x5b4d74[_0x7721('0x1d')],'include':_0x5b4d74[_0x7721('0x1f')]?_[_0x7721('0x1e')](_0x5b4d74[_0x7721('0x1f')],function(_0x16355a){return{'model':db[_0x16355a[_0x7721('0x20')]],'as':_0x16355a['as'],'attributes':_0x16355a[_0x7721('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x7721('0xc')](function(_0x52316e){logger[_0x7721('0xd')]('ShowVariable',_0x3fc09e);logger['debug'](_0x7721('0x21'),_0x3fc09e,JSON[_0x7721('0x12')](_0x52316e));_0xfec626(_0x52316e);})[_0x7721('0x17')](function(_0x158d98){logger[_0x7721('0x13')](_0x7721('0x21'),_0x158d98[_0x7721('0x15')],_0x3fc09e);_0x4e96fb(_0x5cb0e6[_0x7721('0x13')](0x1f4,_0x158d98['message']));});});}; \ No newline at end of file +var _0x7217=['where','attributes','map','include','model','ShowVariable','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Variable,\x20%s,\x20%s','debug','Variable,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','Variable','find','options','raw'];(function(_0x431c93,_0x9f12c8){var _0x33a4a9=function(_0x3e2164){while(--_0x3e2164){_0x431c93['push'](_0x431c93['shift']());}};_0x33a4a9(++_0x9f12c8);}(_0x7217,0x19e));var _0x7721=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0x7217[_0x34bc30];return _0x5706de;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var moment=require(_0x7721('0x1'));var BPromise=require(_0x7721('0x2'));var rs=require(_0x7721('0x3'));var fs=require('fs');var Redis=require(_0x7721('0x4'));var db=require(_0x7721('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7721('0x6'));var config=require(_0x7721('0x7'));var jayson=require(_0x7721('0x8'));var client=jayson[_0x7721('0x9')][_0x7721('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf7ff37,_0x18ab6b,_0x21f680){return new BPromise(function(_0x225610,_0x2f99ed){return client[_0x7721('0xb')](_0xf7ff37,_0x21f680)[_0x7721('0xc')](function(_0xfa8835){logger[_0x7721('0xd')](_0x7721('0xe'),_0x18ab6b,'request\x20sent');logger[_0x7721('0xf')](_0x7721('0x10'),_0x18ab6b,_0x7721('0x11'),JSON[_0x7721('0x12')](_0xfa8835));if(_0xfa8835[_0x7721('0x13')]){if(_0xfa8835[_0x7721('0x13')][_0x7721('0x14')]===0x1f4){logger[_0x7721('0x13')]('Variable,\x20%s,\x20%s',_0x18ab6b,_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);return _0x2f99ed(_0xfa8835['error'][_0x7721('0x15')]);}logger[_0x7721('0x13')](_0x7721('0xe'),_0x18ab6b,_0xfa8835[_0x7721('0x13')]['message']);return _0x225610(_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);}else{logger['info']('Variable,\x20%s,\x20%s',_0x18ab6b,'request\x20sent');_0x225610(_0xfa8835[_0x7721('0x16')][_0x7721('0x15')]);}})[_0x7721('0x17')](function(_0x32550d){logger['error'](_0x7721('0xe'),_0x18ab6b,_0x32550d);_0x2f99ed(_0x32550d);});});}exports['ShowVariable']=function(_0x3fc09e){var _0x5cb0e6=this;return new Promise(function(_0xfec626,_0x4e96fb){return db[_0x7721('0x18')][_0x7721('0x19')]({'raw':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1b')]===undefined?!![]:![]:!![],'where':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1c')]||null:null,'attributes':_0x3fc09e['options']?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1d')]||null:null,'include':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')]['include']?_[_0x7721('0x1e')](_0x3fc09e['options'][_0x7721('0x1f')],function(_0x288e3a){return{'model':db[_0x288e3a[_0x7721('0x20')]],'as':_0x288e3a['as'],'attributes':_0x288e3a[_0x7721('0x1d')],'include':_0x288e3a[_0x7721('0x1f')]?_[_0x7721('0x1e')](_0x288e3a[_0x7721('0x1f')],function(_0x5b4d74){return{'model':db[_0x5b4d74[_0x7721('0x20')]],'as':_0x5b4d74['as'],'attributes':_0x5b4d74[_0x7721('0x1d')],'include':_0x5b4d74[_0x7721('0x1f')]?_[_0x7721('0x1e')](_0x5b4d74[_0x7721('0x1f')],function(_0x16355a){return{'model':db[_0x16355a[_0x7721('0x20')]],'as':_0x16355a['as'],'attributes':_0x16355a[_0x7721('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x7721('0xc')](function(_0x52316e){logger[_0x7721('0xd')]('ShowVariable',_0x3fc09e);logger['debug'](_0x7721('0x21'),_0x3fc09e,JSON[_0x7721('0x12')](_0x52316e));_0xfec626(_0x52316e);})[_0x7721('0x17')](function(_0x158d98){logger[_0x7721('0x13')](_0x7721('0x21'),_0x158d98[_0x7721('0x15')],_0x3fc09e);_0x4e96fb(_0x5cb0e6[_0x7721('0x13')](0x1f4,_0x158d98['message']));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index f203cc0..02d0abd 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 _0x96df=['migrations','exports','Router','../../components/auth/service','./version.controller','get','isAuthenticated','canUpdate','fetch','/reset','reset','/pull','pull','/restart','/migrations'];(function(_0x215393,_0x4c406d){var _0x595198=function(_0x5d641f){while(--_0x5d641f){_0x215393['push'](_0x215393['shift']());}};_0x595198(++_0x4c406d);}(_0x96df,0x13d));var _0xf96d=function(_0x350744,_0x7d9b13){_0x350744=_0x350744-0x0;var _0x14ad39=_0x96df[_0x350744];return _0x14ad39;};'use strict';var express=require('express');var router=express[_0xf96d('0x0')]();var auth=require(_0xf96d('0x1'));var controller=require(_0xf96d('0x2'));router[_0xf96d('0x3')]('/',controller['index']);router[_0xf96d('0x3')]('/fetch',auth[_0xf96d('0x4')](),auth[_0xf96d('0x5')](),controller[_0xf96d('0x6')]);router[_0xf96d('0x3')](_0xf96d('0x7'),auth[_0xf96d('0x4')](),auth[_0xf96d('0x5')](),controller[_0xf96d('0x8')]);router['get'](_0xf96d('0x9'),auth[_0xf96d('0x4')](),auth['canUpdate'](),controller[_0xf96d('0xa')]);router[_0xf96d('0x3')](_0xf96d('0xb'),auth[_0xf96d('0x4')](),controller['restart']);router['get'](_0xf96d('0xc'),controller[_0xf96d('0xd')]);module[_0xf96d('0xe')]=router; \ No newline at end of file +var _0x6f4f=['canUpdate','/reset','reset','/pull','pull','/restart','/migrations','exports','Router','../../components/auth/service','index','get','isAuthenticated'];(function(_0x5229af,_0x580c65){var _0x368c5f=function(_0x1ca14c){while(--_0x1ca14c){_0x5229af['push'](_0x5229af['shift']());}};_0x368c5f(++_0x580c65);}(_0x6f4f,0x1c2));var _0xf6f4=function(_0x1599c0,_0x813878){_0x1599c0=_0x1599c0-0x0;var _0x32ff71=_0x6f4f[_0x1599c0];return _0x32ff71;};'use strict';var express=require('express');var router=express[_0xf6f4('0x0')]();var auth=require(_0xf6f4('0x1'));var controller=require('./version.controller');router['get']('/',controller[_0xf6f4('0x2')]);router[_0xf6f4('0x3')]('/fetch',auth[_0xf6f4('0x4')](),auth[_0xf6f4('0x5')](),controller['fetch']);router[_0xf6f4('0x3')](_0xf6f4('0x6'),auth[_0xf6f4('0x4')](),auth['canUpdate'](),controller[_0xf6f4('0x7')]);router[_0xf6f4('0x3')](_0xf6f4('0x8'),auth[_0xf6f4('0x4')](),auth[_0xf6f4('0x5')](),controller[_0xf6f4('0x9')]);router[_0xf6f4('0x3')](_0xf6f4('0xa'),auth['isAuthenticated'](),controller['restart']);router[_0xf6f4('0x3')](_0xf6f4('0xb'),controller['migrations']);module[_0xf6f4('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 96ad34f..cef652e 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 _0x1892=['query','latest','tags','2.0.0','status','json','fetch','master','error','info','git\x20fetch\x20origin\x20master','reset','--hard','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','server','length','replace','sort','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','.js','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','path','pkginfo','version','child_process','../../config/environment','../../config/logger','update','simple-git','root','exports'];(function(_0x159c4c,_0x584f78){var _0x3091c0=function(_0x76e87){while(--_0x76e87){_0x159c4c['push'](_0x159c4c['shift']());}};_0x3091c0(++_0x584f78);}(_0x1892,0x186));var _0x2189=function(_0x5553b3,_0x36a21c){_0x5553b3=_0x5553b3-0x0;var _0xb1decf=_0x1892[_0x5553b3];return _0xb1decf;};'use strict';var Umzug=require('umzug');var path=require(_0x2189('0x0'));var fs=require('fs');var _=require('lodash');var pkginfo=require(_0x2189('0x1'))(module,_0x2189('0x2'));var compareVersions=require('compare-versions');var exec=require(_0x2189('0x3'))['exec'];var db=require('../../mysqldb')['db'];var config=require(_0x2189('0x4'));var pm2=require('../../config/pm2');var logger=require(_0x2189('0x5'))(_0x2189('0x6'));var git=require(_0x2189('0x7'))(config[_0x2189('0x8')]);exports['index']=function(_0x11f545,_0x205869){var _0x2372ca={'current':module[_0x2189('0x9')][_0x2189('0x2')],'phonebar':0x2};if(_0x11f545['query']&&_0x11f545[_0x2189('0xa')][_0x2189('0xb')]){return git['fetch']()[_0x2189('0xc')](function(_0x186348,_0x3b2de4){_0x2372ca[_0x2189('0xb')]=(_0x186348?module['exports']['version']:_0x3b2de4[_0x2189('0xb')])||_0x2189('0xd');return _0x205869[_0x2189('0xe')](0xc8)[_0x2189('0xf')](_0x2372ca);});}else{return _0x205869['status'](0xc8)[_0x2189('0xf')](_0x2372ca);}};exports[_0x2189('0x10')]=function(_0x124cdd,_0x1b0ebf){return git['fetch'](['origin',_0x2189('0x11')],function(_0x2f65d4){if(_0x2f65d4){logger[_0x2189('0x12')](_0x2f65d4);return _0x1b0ebf['status'](0x1f4)[_0x2189('0xf')](_0x2f65d4);}logger[_0x2189('0x13')]('git\x20fetch');return _0x1b0ebf[_0x2189('0xe')](0xc8)[_0x2189('0xf')]({'output':_0x2189('0x14')});});};exports[_0x2189('0x15')]=function(_0xce7bc2,_0x1d06a7){return git[_0x2189('0x15')]([_0x2189('0x16'),'FETCH_HEAD'],function(_0x1326ef){if(_0x1326ef){logger[_0x2189('0x12')](_0x1326ef);return _0x1d06a7[_0x2189('0xe')](0x1f4)[_0x2189('0xf')](_0x1326ef);}logger[_0x2189('0x13')]('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x1d06a7['status'](0xc8)['json']({'output':_0x2189('0x17')});});};exports[_0x2189('0x18')]=function(_0x2c9157,_0x5d95de){exec(_0x2189('0x19'),function(_0x2dbf0b,_0x19928d,_0x1c15d2){logger[_0x2189('0x13')](_0x19928d);logger['info'](_0x1c15d2);if(_0x2dbf0b){logger[_0x2189('0x12')](_0x2dbf0b);return _0x5d95de[_0x2189('0xe')](0x1f4)[_0x2189('0xf')](_0x2dbf0b);}return _0x5d95de['status'](0xc8)[_0x2189('0xf')]({'output':_0x19928d});});};exports[_0x2189('0x1a')]=function(_0x36da27,_0x7ef5e0){return pm2[_0x2189('0x1a')](_0x2189('0x1b'))[_0x2189('0x1c')](function(_0x44102c){logger[_0x2189('0x13')]('pm2\x20restart\x20motion\x20%s',_0x44102c);return _0x7ef5e0[_0x2189('0xe')](0xc8)[_0x2189('0xf')]({'output':_0x2189('0x1d')});})[_0x2189('0x1e')](function(_0x2551d3){logger[_0x2189('0x12')](_0x2551d3);return _0x7ef5e0['status'](0x1f4)['json'](_0x2551d3);});};exports[_0x2189('0x1f')]=function(_0x2c62ac,_0x1755fa){var _0x26fcd6=fs[_0x2189('0x20')](path[_0x2189('0x21')](config[_0x2189('0x8')],_0x2189('0x22'),_0x2189('0x1f')));var _0x589ff9=[];for(var _0x4ab4bb=0x0;_0x4ab4bb<_0x26fcd6[_0x2189('0x23')];_0x4ab4bb++){var _0x2b0cdb=_0x26fcd6[_0x4ab4bb][_0x2189('0x24')]('.js','');if(compareVersions(module['exports']['version'],_0x2b0cdb)===-0x1){_0x589ff9['push'](_0x2b0cdb);}}if(_0x589ff9[_0x2189('0x23')]){var _0x31d2d1=_0x589ff9[_0x2189('0x25')](compareVersions);var _0x211245=new Umzug({'storage':_0x2189('0x26'),'storageOptions':{'model':db[_0x2189('0x27')],'modelName':_0x2189('0x27'),'columnName':_0x2189('0x2')},'migrations':{'params':[db[_0x2189('0x26')][_0x2189('0x28')](),db[_0x2189('0x26')][_0x2189('0x29')],function(){throw new Error(_0x2189('0x2a'));}],'path':path[_0x2189('0x21')](config[_0x2189('0x8')],_0x2189('0x22'),_0x2189('0x1f')),'pattern':/\.js$/}});_0x211245['up']({'migrations':_[_0x2189('0x2b')](_0x31d2d1,function(_0x3cb83b){return _0x3cb83b+_0x2189('0x2c');})})['then'](function(){return _0x1755fa[_0x2189('0xe')](0xc8)[_0x2189('0xf')]({'output':_0x2189('0x2d')+module[_0x2189('0x9')]['version']+_0x2189('0x2e')+_[_0x2189('0x2f')](_0x31d2d1),'migrations':_[_0x2189('0x21')](_0x31d2d1)});})[_0x2189('0x1e')](function(_0x500092){if(_0x500092 instanceof db[_0x2189('0x26')][_0x2189('0x30')]){return _0x1755fa[_0x2189('0xe')](0xc8)[_0x2189('0xf')]({'output':_0x2189('0x31')});}else{return _0x1755fa[_0x2189('0xe')](0x1f4)[_0x2189('0xf')](_0x500092);}});}else{return _0x1755fa[_0x2189('0xe')](0xc8)[_0x2189('0xf')]({'output':'Database\x20already\x20up-to-date'});}}; \ No newline at end of file +var _0x1f0b=['umzug','path','pkginfo','version','../../config/environment','../../config/pm2','update','simple-git','root','exports','query','latest','fetch','tags','status','json','info','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','npm\x20install\x20--production','error','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','server','replace','.js','push','sort','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','join','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','UniqueConstraintError','Database\x20already\x20up-to-date'];(function(_0x4ceb13,_0x5e70f7){var _0x11f6e7=function(_0x1ffe46){while(--_0x1ffe46){_0x4ceb13['push'](_0x4ceb13['shift']());}};_0x11f6e7(++_0x5e70f7);}(_0x1f0b,0xc0));var _0xb1f0=function(_0x13c4eb,_0x5d218c){_0x13c4eb=_0x13c4eb-0x0;var _0x421546=_0x1f0b[_0x13c4eb];return _0x421546;};'use strict';var Umzug=require(_0xb1f0('0x0'));var path=require(_0xb1f0('0x1'));var fs=require('fs');var _=require('lodash');var pkginfo=require(_0xb1f0('0x2'))(module,_0xb1f0('0x3'));var compareVersions=require('compare-versions');var exec=require('child_process')['exec'];var db=require('../../mysqldb')['db'];var config=require(_0xb1f0('0x4'));var pm2=require(_0xb1f0('0x5'));var logger=require('../../config/logger')(_0xb1f0('0x6'));var git=require(_0xb1f0('0x7'))(config[_0xb1f0('0x8')]);exports['index']=function(_0x10b139,_0x4a1b15){var _0x58d0a6={'current':module[_0xb1f0('0x9')][_0xb1f0('0x3')],'phonebar':0x2};if(_0x10b139[_0xb1f0('0xa')]&&_0x10b139['query'][_0xb1f0('0xb')]){return git[_0xb1f0('0xc')]()[_0xb1f0('0xd')](function(_0x40417e,_0x585fa6){_0x58d0a6['latest']=(_0x40417e?module[_0xb1f0('0x9')]['version']:_0x585fa6[_0xb1f0('0xb')])||'2.0.0';return _0x4a1b15[_0xb1f0('0xe')](0xc8)[_0xb1f0('0xf')](_0x58d0a6);});}else{return _0x4a1b15[_0xb1f0('0xe')](0xc8)[_0xb1f0('0xf')](_0x58d0a6);}};exports[_0xb1f0('0xc')]=function(_0xccedb5,_0x18b93d){return git['fetch'](['origin','master'],function(_0x13f281){if(_0x13f281){logger['error'](_0x13f281);return _0x18b93d[_0xb1f0('0xe')](0x1f4)[_0xb1f0('0xf')](_0x13f281);}logger[_0xb1f0('0x10')]('git\x20fetch');return _0x18b93d[_0xb1f0('0xe')](0xc8)['json']({'output':_0xb1f0('0x11')});});};exports[_0xb1f0('0x12')]=function(_0x477e68,_0x39c094){return git[_0xb1f0('0x12')]([_0xb1f0('0x13'),_0xb1f0('0x14')],function(_0x1496ab){if(_0x1496ab){logger['error'](_0x1496ab);return _0x39c094[_0xb1f0('0xe')](0x1f4)['json'](_0x1496ab);}logger['info'](_0xb1f0('0x15'));return _0x39c094[_0xb1f0('0xe')](0xc8)[_0xb1f0('0xf')]({'output':_0xb1f0('0x16')});});};exports['pull']=function(_0x4bc343,_0x81d1fc){exec(_0xb1f0('0x17'),function(_0x45d4b0,_0x5b6f9f,_0x54ac96){logger['info'](_0x5b6f9f);logger[_0xb1f0('0x10')](_0x54ac96);if(_0x45d4b0){logger[_0xb1f0('0x18')](_0x45d4b0);return _0x81d1fc[_0xb1f0('0xe')](0x1f4)[_0xb1f0('0xf')](_0x45d4b0);}return _0x81d1fc[_0xb1f0('0xe')](0xc8)[_0xb1f0('0xf')]({'output':_0x5b6f9f});});};exports['restart']=function(_0x14be71,_0x430d39){return pm2[_0xb1f0('0x19')](_0xb1f0('0x1a'))[_0xb1f0('0x1b')](function(_0x4ee1bf){logger[_0xb1f0('0x10')](_0xb1f0('0x1c'),_0x4ee1bf);return _0x430d39['status'](0xc8)['json']({'output':_0xb1f0('0x1d')});})[_0xb1f0('0x1e')](function(_0x772211){logger[_0xb1f0('0x18')](_0x772211);return _0x430d39[_0xb1f0('0xe')](0x1f4)[_0xb1f0('0xf')](_0x772211);});};exports[_0xb1f0('0x1f')]=function(_0x3ba2dd,_0x1d8ce6){var _0x1ef1cb=fs[_0xb1f0('0x20')](path['join'](config[_0xb1f0('0x8')],_0xb1f0('0x21'),_0xb1f0('0x1f')));var _0x36c1ed=[];for(var _0x22cbbc=0x0;_0x22cbbc<_0x1ef1cb['length'];_0x22cbbc++){var _0x13d553=_0x1ef1cb[_0x22cbbc][_0xb1f0('0x22')](_0xb1f0('0x23'),'');if(compareVersions(module[_0xb1f0('0x9')][_0xb1f0('0x3')],_0x13d553)===-0x1){_0x36c1ed[_0xb1f0('0x24')](_0x13d553);}}if(_0x36c1ed['length']){var _0xe14521=_0x36c1ed[_0xb1f0('0x25')](compareVersions);var _0xfde398=new Umzug({'storage':_0xb1f0('0x26'),'storageOptions':{'model':db['Migration'],'modelName':_0xb1f0('0x27'),'columnName':_0xb1f0('0x3')},'migrations':{'params':[db[_0xb1f0('0x26')][_0xb1f0('0x28')](),db[_0xb1f0('0x26')][_0xb1f0('0x29')],function(){throw new Error(_0xb1f0('0x2a'));}],'path':path[_0xb1f0('0x2b')](config[_0xb1f0('0x8')],'server','migrations'),'pattern':/\.js$/}});_0xfde398['up']({'migrations':_['map'](_0xe14521,function(_0x2baa93){return _0x2baa93+_0xb1f0('0x23');})})[_0xb1f0('0x1b')](function(){return _0x1d8ce6[_0xb1f0('0xe')](0xc8)['json']({'output':_0xb1f0('0x2c')+module[_0xb1f0('0x9')][_0xb1f0('0x3')]+_0xb1f0('0x2d')+_['last'](_0xe14521),'migrations':_['join'](_0xe14521)});})[_0xb1f0('0x1e')](function(_0x506ab0){if(_0x506ab0 instanceof db['sequelize'][_0xb1f0('0x2e')]){return _0x1d8ce6['status'](0xc8)[_0xb1f0('0xf')]({'output':_0xb1f0('0x2f')});}else{return _0x1d8ce6[_0xb1f0('0xe')](0x1f4)[_0xb1f0('0xf')](_0x506ab0);}});}else{return _0x1d8ce6[_0xb1f0('0xe')](0xc8)[_0xb1f0('0xf')]({'output':_0xb1f0('0x2f')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index b5c3524..d739c8e 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 _0x56e4=['put','update','delete','/:id','destroy','exports','util','path','Router','../../components/auth/service','../../components/interaction/service','./voiceAgentReport.controller','get','isAuthenticated','index','/describe','describe','show','post','create'];(function(_0x2803b1,_0x406f56){var _0x23ad8e=function(_0x440ad5){while(--_0x440ad5){_0x2803b1['push'](_0x2803b1['shift']());}};_0x23ad8e(++_0x406f56);}(_0x56e4,0x92));var _0x456e=function(_0xc9bd8f,_0xddde22){_0xc9bd8f=_0xc9bd8f-0x0;var _0x4fe6ca=_0x56e4[_0xc9bd8f];return _0x4fe6ca;};'use strict';var multer=require('multer');var util=require(_0x456e('0x0'));var path=require(_0x456e('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x456e('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x456e('0x3'));var interaction=require(_0x456e('0x4'));var config=require('../../config/environment');var controller=require(_0x456e('0x5'));router[_0x456e('0x6')]('/',auth[_0x456e('0x7')](),controller[_0x456e('0x8')]);router['get'](_0x456e('0x9'),auth['isAuthenticated'](),controller[_0x456e('0xa')]);router[_0x456e('0x6')]('/:id',auth[_0x456e('0x7')](),controller[_0x456e('0xb')]);router[_0x456e('0xc')]('/',auth[_0x456e('0x7')](),controller[_0x456e('0xd')]);router[_0x456e('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x456e('0xf')]);router[_0x456e('0x10')](_0x456e('0x11'),auth[_0x456e('0x7')](),controller[_0x456e('0x12')]);module[_0x456e('0x13')]=router; \ No newline at end of file +var _0x6064=['put','update','delete','destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','describe','/:id','show','create'];(function(_0x403c20,_0x4a7b99){var _0x2b271a=function(_0x106ecb){while(--_0x106ecb){_0x403c20['push'](_0x403c20['shift']());}};_0x2b271a(++_0x4a7b99);}(_0x6064,0x77));var _0x4606=function(_0x1d40d3,_0x171f07){_0x1d40d3=_0x1d40d3-0x0;var _0x1c268e=_0x6064[_0x1d40d3];return _0x1c268e;};'use strict';var multer=require(_0x4606('0x0'));var util=require(_0x4606('0x1'));var path=require(_0x4606('0x2'));var timeout=require('connect-timeout');var express=require(_0x4606('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4606('0x4'));var interaction=require(_0x4606('0x5'));var config=require(_0x4606('0x6'));var controller=require(_0x4606('0x7'));router[_0x4606('0x8')]('/',auth[_0x4606('0x9')](),controller['index']);router[_0x4606('0x8')]('/describe',auth[_0x4606('0x9')](),controller[_0x4606('0xa')]);router['get'](_0x4606('0xb'),auth[_0x4606('0x9')](),controller[_0x4606('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x4606('0xd')]);router[_0x4606('0xe')]('/:id',auth[_0x4606('0x9')](),controller[_0x4606('0xf')]);router[_0x4606('0x10')](_0x4606('0xb'),auth[_0x4606('0x9')](),controller[_0x4606('0x11')]);module[_0x4606('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 8603c06..7f3ece6 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 _0xa5c9=['FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE','INTEGER','BOOLEAN'];(function(_0x55ef8b,_0x5deb5e){var _0x359c84=function(_0x437673){while(--_0x437673){_0x55ef8b['push'](_0x55ef8b['shift']());}};_0x359c84(++_0x5deb5e);}(_0xa5c9,0x143));var _0x9a5c=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0xa5c9[_0x16b9ed];return _0x66b1f8;};'use strict';var Sequelize=require(_0x9a5c('0x0'));module[_0x9a5c('0x1')]={'type':{'type':Sequelize[_0x9a5c('0x2')]},'uniqueid':{'type':Sequelize[_0x9a5c('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x9a5c('0x2')]},'interface':{'type':Sequelize[_0x9a5c('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize[_0x9a5c('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0x9a5c('0x3')]},'agentdumpAt':{'type':Sequelize[_0x9a5c('0x3')]},'holdtime':{'type':Sequelize[_0x9a5c('0x4')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x9a5c('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0x9a5c('0x4')]},'agentacw':{'type':Sequelize[_0x9a5c('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x9a5c('0x2')]},'lastevent':{'type':Sequelize[_0x9a5c('0x2')]},'channel':{'type':Sequelize[_0x9a5c('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x9a5c('0x2')]},'connectedlinename':{'type':Sequelize[_0x9a5c('0x2')]},'language':{'type':Sequelize[_0x9a5c('0x2')]},'accountcode':{'type':Sequelize[_0x9a5c('0x2')]},'context':{'type':Sequelize[_0x9a5c('0x2')]},'exten':{'type':Sequelize[_0x9a5c('0x2')]},'priority':{'type':Sequelize[_0x9a5c('0x2')]},'destchannel':{'type':Sequelize[_0x9a5c('0x2')]},'destchannelstate':{'type':Sequelize[_0x9a5c('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x9a5c('0x2')]},'destcalleridnum':{'type':Sequelize[_0x9a5c('0x2')]},'destcalleridname':{'type':Sequelize[_0x9a5c('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x9a5c('0x2')]},'destlanguage':{'type':Sequelize[_0x9a5c('0x2')]},'destaccountcode':{'type':Sequelize[_0x9a5c('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x9a5c('0x2')]},'destpriority':{'type':Sequelize[_0x9a5c('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x9a5c('0x2')]},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x9a5c('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x9a5c('0x6')},'transferexten':{'type':Sequelize[_0x9a5c('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize[_0x9a5c('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb91a=['FORWARD,\x20BLIND,\x20ATTENDED','exports','STRING','DATE','BOOLEAN','INTEGER'];(function(_0x7a2ce6,_0x4353ef){var _0xb1930e=function(_0x575d62){while(--_0x575d62){_0x7a2ce6['push'](_0x7a2ce6['shift']());}};_0xb1930e(++_0x4353ef);}(_0xb91a,0xe5));var _0xab91=function(_0x11cbf0,_0x4a8e35){_0x11cbf0=_0x11cbf0-0x0;var _0x1d5696=_0xb91a[_0x11cbf0];return _0x1d5696;};'use strict';var Sequelize=require('sequelize');module[_0xab91('0x0')]={'type':{'type':Sequelize[_0xab91('0x1')]},'uniqueid':{'type':Sequelize[_0xab91('0x1')]},'calleridnum':{'type':Sequelize[_0xab91('0x1')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xab91('0x1')]},'interface':{'type':Sequelize[_0xab91('0x1')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0xab91('0x2')]},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0xab91('0x2')]},'agentdumpAt':{'type':Sequelize[_0xab91('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0xab91('0x3')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xab91('0x3')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0xab91('0x4')]},'agentacw':{'type':Sequelize[_0xab91('0x3')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xab91('0x1')]},'channelstate':{'type':Sequelize[_0xab91('0x4')]},'channelstatedesc':{'type':Sequelize[_0xab91('0x1')]},'connectedlinenum':{'type':Sequelize[_0xab91('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xab91('0x1')]},'accountcode':{'type':Sequelize[_0xab91('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xab91('0x1')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xab91('0x1')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xab91('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xab91('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xab91('0x1')]},'destlanguage':{'type':Sequelize[_0xab91('0x1')]},'destaccountcode':{'type':Sequelize[_0xab91('0x1')]},'destcontext':{'type':Sequelize[_0xab91('0x1')]},'destexten':{'type':Sequelize[_0xab91('0x1')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0xab91('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize[_0xab91('0x1')]},'transfer':{'type':Sequelize[_0xab91('0x3')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xab91('0x1')],'comment':_0xab91('0x5')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0xab91('0x1')]},'agententerreason':{'type':Sequelize[_0xab91('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 d3ba444..e532e16 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(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'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(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=typeof _0x22dccb['offset']===_0x0a9e('0x19')&&typeof _0x22dccb[_0x0a9e('0x1a')]==='undefined';var _0x225616=_0x5d0880['count'];var _0x459eb1=_0x1985b6?0x0:_0x22dccb[_0x0a9e('0x1b')];var _0x106033=_0x1985b6?_0x5d0880[_0x0a9e('0x1c')]:_0x22dccb[_0x0a9e('0x1b')]+_0x22dccb[_0x0a9e('0x1a')];var _0x530eb7;if(_0x106033>=_0x225616){_0x106033=_0x225616;_0x530eb7=0xc8;}else{_0x530eb7=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x530eb7);return _0x52a03d[_0x0a9e('0x1d')](_0x0a9e('0x1e'),_0x459eb1+'-'+_0x106033+'/'+_0x225616)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x1f')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x20')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')](_0x5a09ef)[_0x0a9e('0x22')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x23')]()[_0x0a9e('0x22')](function(){_0x4abc77[_0x0a9e('0x17')](0xcc)[_0x0a9e('0x16')]();});}};}function handleEntityNotFound(_0x16b1ca,_0x5ea472){return function(_0x59181e){if(!_0x59181e){_0x16b1ca[_0x0a9e('0x15')](0x194);}return _0x59181e;};}function handleError(_0x3a8e58,_0x40c424){_0x40c424=_0x40c424||0x1f4;return function(_0x33161b){logger['error'](_0x33161b[_0x0a9e('0x24')]);if(_0x33161b['name']){delete _0x33161b[_0x0a9e('0x25')];}_0x3a8e58['status'](_0x40c424)[_0x0a9e('0x26')](_0x33161b);};}exports[_0x0a9e('0x27')]=function(_0x25fba9,_0x14433c){var _0x140511={},_0x1538a4={},_0x11c3b6={'count':0x0,'rows':[]};var _0x14de77=_['map'](db[_0x0a9e('0x28')][_0x0a9e('0x29')],function(_0x2b1f27){return{'name':_0x2b1f27[_0x0a9e('0x2a')],'type':_0x2b1f27['type'][_0x0a9e('0x2b')]};});_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x14de77,_0x0a9e('0x25'));_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x25fba9[_0x0a9e('0x2e')]);_0x1538a4[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x1538a4['model'],_0x1538a4[_0x0a9e('0x2e')]);_0x140511['attributes']=_[_0x0a9e('0x31')](_0x1538a4[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0x140511['attributes']=_0x140511[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0x140511[_0x0a9e('0x33')]:_0x1538a4[_0x0a9e('0x2c')];if(!_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x35')](_0x0a9e('0x36'))){_0x140511[_0x0a9e('0x1a')]=qs['limit'](_0x25fba9[_0x0a9e('0x2e')]['limit']);_0x140511[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x1b')]);}_0x140511['order']=qs[_0x0a9e('0x37')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x37')]);_0x140511[_0x0a9e('0x38')]=qs['filters'](_['pick'](_0x25fba9[_0x0a9e('0x2e')],_0x1538a4['filters']),_0x14de77);if(_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x39')]){_0x140511[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](_0x140511['where'],{'$or':_[_0x0a9e('0x2d')](_0x14de77,function(_0x3bfce8){if(_0x3bfce8[_0x0a9e('0x3b')]!=='VIRTUAL'){var _0x1dbf74={};_0x1dbf74[_0x3bfce8[_0x0a9e('0x25')]]={'$like':'%'+_0x25fba9[_0x0a9e('0x2e')]['filter']+'%'};return _0x1dbf74;}})});}_0x140511=_['merge']({},_0x140511,_0x25fba9[_0x0a9e('0x3c')]);var _0x40d766={'where':_0x140511['where']};return db[_0x0a9e('0x28')][_0x0a9e('0x1c')](_0x40d766)[_0x0a9e('0x22')](function(_0x148f55){_0x11c3b6['count']=_0x148f55;if(_0x25fba9['query'][_0x0a9e('0x3d')]){_0x140511[_0x0a9e('0x3e')]=[{'all':!![]}];}return db['VoiceAgentReport'][_0x0a9e('0x3f')](_0x140511);})[_0x0a9e('0x22')](function(_0x1459bb){_0x11c3b6['rows']=_0x1459bb;return _0x11c3b6;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x14433c,_0x140511))[_0x0a9e('0x40')](handleError(_0x14433c,null));};exports[_0x0a9e('0x41')]=function(_0x43dd5b,_0x13cb1f){var _0xeaa5e5={'raw':![],'where':{'id':_0x43dd5b[_0x0a9e('0x42')]['id']}},_0x2881b3={};_0x2881b3[_0x0a9e('0x2c')]=_[_0x0a9e('0x2f')](db[_0x0a9e('0x28')][_0x0a9e('0x29')]);_0x2881b3[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x43dd5b[_0x0a9e('0x2e')]);_0x2881b3['filters']=_['intersection'](_0x2881b3[_0x0a9e('0x2c')],_0x2881b3[_0x0a9e('0x2e')]);_0xeaa5e5[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](_0x2881b3[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0xeaa5e5[_0x0a9e('0x33')]=_0xeaa5e5[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0xeaa5e5[_0x0a9e('0x33')]:_0x2881b3['model'];if(_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x3d')]){_0xeaa5e5[_0x0a9e('0x3e')]=[{'all':!![]}];}_0xeaa5e5=_[_0x0a9e('0x3a')]({},_0xeaa5e5,_0x43dd5b[_0x0a9e('0x3c')]);return db[_0x0a9e('0x28')][_0x0a9e('0x43')](_0xeaa5e5)[_0x0a9e('0x22')](handleEntityNotFound(_0x13cb1f,null))['then'](respondWithResult(_0x13cb1f,null))[_0x0a9e('0x40')](handleError(_0x13cb1f,null));};exports['create']=function(_0x473dc8,_0x476688){return db[_0x0a9e('0x28')]['create'](_0x473dc8[_0x0a9e('0x44')],{})[_0x0a9e('0x22')](respondWithResult(_0x476688,0xc9))[_0x0a9e('0x40')](handleError(_0x476688,null));};exports[_0x0a9e('0x21')]=function(_0x45c845,_0x37be73){if(_0x45c845[_0x0a9e('0x44')]['id']){delete _0x45c845['body']['id'];}return db[_0x0a9e('0x28')][_0x0a9e('0x43')]({'where':{'id':_0x45c845[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x37be73,null))[_0x0a9e('0x22')](saveUpdates(_0x45c845[_0x0a9e('0x44')],null))[_0x0a9e('0x22')](respondWithResult(_0x37be73,null))[_0x0a9e('0x40')](handleError(_0x37be73,null));};exports[_0x0a9e('0x23')]=function(_0x58a5c2,_0xe401a){return db[_0x0a9e('0x28')]['find']({'where':{'id':_0x58a5c2['params']['id']}})['then'](handleEntityNotFound(_0xe401a,null))[_0x0a9e('0x22')](removeEntity(_0xe401a,null))[_0x0a9e('0x40')](handleError(_0xe401a,null));};exports[_0x0a9e('0x45')]=function(_0x11545a,_0x61bb17){return db[_0x0a9e('0x28')][_0x0a9e('0x45')]()[_0x0a9e('0x22')](respondWithResult(_0x61bb17,null))['catch'](handleError(_0x61bb17,null));}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.model.js b/server/api/voiceAgentReport/voiceAgentReport.model.js index 9ad26c2..7c87b8b 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 _0xab86=['exports','define','VoiceAgentReport','report_agent','uniqueid','destuniqueid','lodash','util','../../config/logger','bluebird','path','../../config/environment','./voiceAgentReport.attributes'];(function(_0xbc550a,_0x2bb605){var _0xd16ba4=function(_0x5e55e5){while(--_0x5e55e5){_0xbc550a['push'](_0xbc550a['shift']());}};_0xd16ba4(++_0x2bb605);}(_0xab86,0x13e));var _0x6ab8=function(_0x316d5f,_0x1b1286){_0x316d5f=_0x316d5f-0x0;var _0x4220c0=_0xab86[_0x316d5f];return _0x4220c0;};'use strict';var _=require(_0x6ab8('0x0'));var util=require(_0x6ab8('0x1'));var logger=require(_0x6ab8('0x2'))('api');var moment=require('moment');var BPromise=require(_0x6ab8('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6ab8('0x4'));var rimraf=require('rimraf');var config=require(_0x6ab8('0x5'));var attributes=require(_0x6ab8('0x6'));module[_0x6ab8('0x7')]=function(_0x154d17,_0x6f41f){return _0x154d17[_0x6ab8('0x8')](_0x6ab8('0x9'),attributes,{'tableName':_0x6ab8('0xa'),'paranoid':![],'indexes':[{'fields':[_0x6ab8('0xb'),_0x6ab8('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8819=['../../config/environment','./voiceAgentReport.attributes','exports','VoiceAgentReport','destuniqueid','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x4580d4,_0xb4514f){var _0x48ce72=function(_0x35194e){while(--_0x35194e){_0x4580d4['push'](_0x4580d4['shift']());}};_0x48ce72(++_0xb4514f);}(_0x8819,0x94));var _0x9881=function(_0x30a3cf,_0x18be1f){_0x30a3cf=_0x30a3cf-0x0;var _0x4b3192=_0x8819[_0x30a3cf];return _0x4b3192;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9881('0x0'))(_0x9881('0x1'));var moment=require(_0x9881('0x2'));var BPromise=require(_0x9881('0x3'));var rp=require(_0x9881('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9881('0x5'));var config=require(_0x9881('0x6'));var attributes=require(_0x9881('0x7'));module[_0x9881('0x8')]=function(_0x1791fd,_0x2a3664){return _0x1791fd['define'](_0x9881('0x9'),attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':['uniqueid',_0x9881('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 92da41e..fa90e45 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 _0xd589=['catch','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','raw','stringify','where','attributes','limit','UpdateVoiceAgentReport','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x3c2f0d,_0x45dcd8){var _0x2a118a=function(_0x4d0987){while(--_0x4d0987){_0x3c2f0d['push'](_0x3c2f0d['shift']());}};_0x2a118a(++_0x45dcd8);}(_0xd589,0x72));var _0x9d58=function(_0x188c6f,_0x51cc15){_0x188c6f=_0x188c6f-0x0;var _0x39f2b0=_0xd589[_0x188c6f];return _0x39f2b0;};'use strict';var _=require(_0x9d58('0x0'));var util=require(_0x9d58('0x1'));var moment=require(_0x9d58('0x2'));var BPromise=require(_0x9d58('0x3'));var rs=require(_0x9d58('0x4'));var fs=require('fs');var Redis=require(_0x9d58('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x9d58('0x6'));var logger=require(_0x9d58('0x7'))(_0x9d58('0x8'));var config=require('../../config/environment');var jayson=require(_0x9d58('0x9'));var client=jayson[_0x9d58('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x57c635,_0x200007,_0x166a93){return new BPromise(function(_0x22614b,_0x5059f0){return client[_0x9d58('0xb')](_0x57c635,_0x166a93)[_0x9d58('0xc')](function(_0x598fcf){logger[_0x9d58('0xd')](_0x9d58('0xe'),_0x200007,_0x9d58('0xf'));logger[_0x9d58('0x10')](_0x9d58('0x11'),_0x200007,_0x9d58('0xf'),JSON['stringify'](_0x598fcf));if(_0x598fcf[_0x9d58('0x12')]){if(_0x598fcf[_0x9d58('0x12')][_0x9d58('0x13')]===0x1f4){logger[_0x9d58('0x12')]('VoiceAgentReport,\x20%s,\x20%s',_0x200007,_0x598fcf[_0x9d58('0x12')][_0x9d58('0x14')]);return _0x5059f0(_0x598fcf[_0x9d58('0x12')][_0x9d58('0x14')]);}logger[_0x9d58('0x12')]('VoiceAgentReport,\x20%s,\x20%s',_0x200007,_0x598fcf['error'][_0x9d58('0x14')]);return _0x22614b(_0x598fcf[_0x9d58('0x12')][_0x9d58('0x14')]);}else{logger[_0x9d58('0xd')](_0x9d58('0xe'),_0x200007,'request\x20sent');_0x22614b(_0x598fcf[_0x9d58('0x15')][_0x9d58('0x14')]);}})[_0x9d58('0x16')](function(_0x49f5e4){logger[_0x9d58('0x12')](_0x9d58('0xe'),_0x200007,_0x49f5e4);_0x5059f0(_0x49f5e4);});});}exports[_0x9d58('0x17')]=function(_0x2540ab){var _0x5e1c79=this;return new Promise(function(_0x4dae97,_0x5f86db){return db[_0x9d58('0x18')][_0x9d58('0x19')](_0x2540ab[_0x9d58('0x1a')],{'raw':_0x2540ab[_0x9d58('0x1b')]?_0x2540ab[_0x9d58('0x1b')][_0x9d58('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x3232d6){logger[_0x9d58('0xd')]('CreateVoiceAgentReport',_0x2540ab);logger[_0x9d58('0x10')](_0x9d58('0x17'),_0x2540ab,JSON[_0x9d58('0x1d')](_0x3232d6));_0x4dae97(_0x3232d6);})[_0x9d58('0x16')](function(_0x209115){logger['error'](_0x9d58('0x17'),_0x209115['message'],_0x2540ab);_0x5f86db(_0x5e1c79[_0x9d58('0x12')](0x1f4,_0x209115[_0x9d58('0x14')]));});});};exports['UpdateVoiceAgentReport']=function(_0x5ce519){var _0x1c73b9=this;return new Promise(function(_0x351bfd,_0x3afb46){return db[_0x9d58('0x18')]['update'](_0x5ce519['body'],{'raw':_0x5ce519[_0x9d58('0x1b')]?_0x5ce519[_0x9d58('0x1b')][_0x9d58('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5ce519['options']?_0x5ce519['options'][_0x9d58('0x1e')]||null:null,'attributes':_0x5ce519[_0x9d58('0x1b')]?_0x5ce519[_0x9d58('0x1b')][_0x9d58('0x1f')]||null:null,'limit':_0x5ce519[_0x9d58('0x1b')]?_0x5ce519[_0x9d58('0x1b')][_0x9d58('0x20')]||null:null})[_0x9d58('0xc')](function(_0xc94367){logger[_0x9d58('0xd')](_0x9d58('0x21'),_0x5ce519);logger[_0x9d58('0x10')](_0x9d58('0x21'),_0x5ce519,JSON[_0x9d58('0x1d')](_0xc94367));_0x351bfd(_0xc94367);})[_0x9d58('0x16')](function(_0x3b7072){logger[_0x9d58('0x12')]('UpdateVoiceAgentReport',_0x3b7072[_0x9d58('0x14')],_0x5ce519);_0x3afb46(_0x1c73b9[_0x9d58('0x12')](0x1f4,_0x3b7072[_0x9d58('0x14')]));});});}; \ No newline at end of file +var _0xe678=['util','moment','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','error','message','result','CreateVoiceAgentReport','create','body','options','raw','stringify','catch','update','where','attributes','UpdateVoiceAgentReport','lodash'];(function(_0xb66b0,_0x4423f9){var _0x53eec8=function(_0x42c761){while(--_0x42c761){_0xb66b0['push'](_0xb66b0['shift']());}};_0x53eec8(++_0x4423f9);}(_0xe678,0x178));var _0x8e67=function(_0x2b69f1,_0x337a6e){_0x2b69f1=_0x2b69f1-0x0;var _0x2edf2d=_0xe678[_0x2b69f1];return _0x2edf2d;};'use strict';var _=require(_0x8e67('0x0'));var util=require(_0x8e67('0x1'));var moment=require(_0x8e67('0x2'));var BPromise=require('bluebird');var rs=require(_0x8e67('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8e67('0x4'));var logger=require(_0x8e67('0x5'))(_0x8e67('0x6'));var config=require('../../config/environment');var jayson=require(_0x8e67('0x7'));var client=jayson[_0x8e67('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x18cbbd,_0x28e359,_0x3d92d2){return new BPromise(function(_0x323a31,_0x2d16f9){return client[_0x8e67('0x9')](_0x18cbbd,_0x3d92d2)[_0x8e67('0xa')](function(_0xfdc355){logger[_0x8e67('0xb')](_0x8e67('0xc'),_0x28e359,_0x8e67('0xd'));logger[_0x8e67('0xe')]('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x28e359,_0x8e67('0xd'),JSON['stringify'](_0xfdc355));if(_0xfdc355[_0x8e67('0xf')]){if(_0xfdc355['error']['code']===0x1f4){logger['error'](_0x8e67('0xc'),_0x28e359,_0xfdc355[_0x8e67('0xf')][_0x8e67('0x10')]);return _0x2d16f9(_0xfdc355[_0x8e67('0xf')][_0x8e67('0x10')]);}logger['error'](_0x8e67('0xc'),_0x28e359,_0xfdc355[_0x8e67('0xf')][_0x8e67('0x10')]);return _0x323a31(_0xfdc355[_0x8e67('0xf')][_0x8e67('0x10')]);}else{logger[_0x8e67('0xb')](_0x8e67('0xc'),_0x28e359,_0x8e67('0xd'));_0x323a31(_0xfdc355[_0x8e67('0x11')]['message']);}})['catch'](function(_0x22a791){logger[_0x8e67('0xf')](_0x8e67('0xc'),_0x28e359,_0x22a791);_0x2d16f9(_0x22a791);});});}exports[_0x8e67('0x12')]=function(_0x2aa51a){var _0x4898f3=this;return new Promise(function(_0x77c422,_0x5203c8){return db['VoiceAgentReport'][_0x8e67('0x13')](_0x2aa51a[_0x8e67('0x14')],{'raw':_0x2aa51a[_0x8e67('0x15')]?_0x2aa51a[_0x8e67('0x15')][_0x8e67('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x3906f9){logger[_0x8e67('0xb')](_0x8e67('0x12'),_0x2aa51a);logger[_0x8e67('0xe')](_0x8e67('0x12'),_0x2aa51a,JSON[_0x8e67('0x17')](_0x3906f9));_0x77c422(_0x3906f9);})[_0x8e67('0x18')](function(_0x158ca9){logger[_0x8e67('0xf')](_0x8e67('0x12'),_0x158ca9['message'],_0x2aa51a);_0x5203c8(_0x4898f3[_0x8e67('0xf')](0x1f4,_0x158ca9[_0x8e67('0x10')]));});});};exports['UpdateVoiceAgentReport']=function(_0x451221){var _0xe3b136=this;return new Promise(function(_0x401e13,_0x303fe5){return db['VoiceAgentReport'][_0x8e67('0x19')](_0x451221['body'],{'raw':_0x451221[_0x8e67('0x15')]?_0x451221[_0x8e67('0x15')][_0x8e67('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x451221[_0x8e67('0x15')]?_0x451221['options'][_0x8e67('0x1a')]||null:null,'attributes':_0x451221[_0x8e67('0x15')]?_0x451221[_0x8e67('0x15')][_0x8e67('0x1b')]||null:null,'limit':_0x451221[_0x8e67('0x15')]?_0x451221[_0x8e67('0x15')]['limit']||null:null})[_0x8e67('0xa')](function(_0x238214){logger[_0x8e67('0xb')](_0x8e67('0x1c'),_0x451221);logger[_0x8e67('0xe')](_0x8e67('0x1c'),_0x451221,JSON['stringify'](_0x238214));_0x401e13(_0x238214);})[_0x8e67('0x18')](function(_0x55373b){logger['error']('UpdateVoiceAgentReport',_0x55373b[_0x8e67('0x10')],_0x451221);_0x303fe5(_0xe3b136[_0x8e67('0xf')](0x1f4,_0x55373b[_0x8e67('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 5224197..3a5f6f8 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 _0xe189=['Router','../../components/auth/service','./voiceCallReport.controller','index','isAuthenticated','get','/:id','create','delete','exports'];(function(_0x8fada2,_0x19850e){var _0x216a6e=function(_0x163b28){while(--_0x163b28){_0x8fada2['push'](_0x8fada2['shift']());}};_0x216a6e(++_0x19850e);}(_0xe189,0x154));var _0x9e18=function(_0x4c9b6b,_0x5377ac){_0x4c9b6b=_0x4c9b6b-0x0;var _0x1c46f3=_0xe189[_0x4c9b6b];return _0x1c46f3;};'use strict';var express=require('express');var router=express[_0x9e18('0x0')]();var auth=require(_0x9e18('0x1'));var controller=require(_0x9e18('0x2'));router['get']('/',auth['isAuthenticated'](),controller[_0x9e18('0x3')]);router['get']('/describe',auth[_0x9e18('0x4')](),controller['describe']);router[_0x9e18('0x5')](_0x9e18('0x6'),auth[_0x9e18('0x4')](),controller['show']);router['post']('/',auth[_0x9e18('0x4')](),controller[_0x9e18('0x7')]);router['put'](_0x9e18('0x6'),auth[_0x9e18('0x4')](),controller['update']);router['put']('/with-retry/:id',auth[_0x9e18('0x4')](),controller['updateWithRetry']);router[_0x9e18('0x8')](_0x9e18('0x6'),auth[_0x9e18('0x4')](),controller['destroy']);module[_0x9e18('0x9')]=router; \ No newline at end of file +var _0x8e63=['./voiceCallReport.controller','get','isAuthenticated','index','/describe','post','put','/:id','/with-retry/:id','updateWithRetry','delete','destroy','exports','express','Router','../../components/auth/service'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x8e63,0x10d));var _0x38e6=function(_0x28b18f,_0x4e78bf){_0x28b18f=_0x28b18f-0x0;var _0x56ef26=_0x8e63[_0x28b18f];return _0x56ef26;};'use strict';var express=require(_0x38e6('0x0'));var router=express[_0x38e6('0x1')]();var auth=require(_0x38e6('0x2'));var controller=require(_0x38e6('0x3'));router[_0x38e6('0x4')]('/',auth[_0x38e6('0x5')](),controller[_0x38e6('0x6')]);router['get'](_0x38e6('0x7'),auth[_0x38e6('0x5')](),controller['describe']);router[_0x38e6('0x4')]('/:id',auth[_0x38e6('0x5')](),controller['show']);router[_0x38e6('0x8')]('/',auth[_0x38e6('0x5')](),controller['create']);router[_0x38e6('0x9')](_0x38e6('0xa'),auth[_0x38e6('0x5')](),controller['update']);router[_0x38e6('0x9')](_0x38e6('0xb'),auth['isAuthenticated'](),controller[_0x38e6('0xc')]);router[_0x38e6('0xd')](_0x38e6('0xa'),auth[_0x38e6('0x5')](),controller[_0x38e6('0xe')]);module[_0x38e6('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 6be420e..d956561 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 _0x3c99=['inbound-fax','outbound-fax','TEXT','DATE','INTEGER','sequelize','exports','STRING','ENUM','inbound','internal'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x3c99,0x118));var _0x93c9=function(_0xfaa86c,_0x1cfa44){_0xfaa86c=_0xfaa86c-0x0;var _0x24ed03=_0x3c99[_0xfaa86c];return _0x24ed03;};'use strict';var Sequelize=require(_0x93c9('0x0'));module[_0x93c9('0x1')]={'uniqueid':{'type':Sequelize[_0x93c9('0x2')]},'type':{'type':Sequelize[_0x93c9('0x3')](_0x93c9('0x4'),_0x93c9('0x5'),'outbound',_0x93c9('0x6'),_0x93c9('0x7'),'dialer')},'tag':{'type':Sequelize[_0x93c9('0x2')]},'accountcode':{'type':Sequelize[_0x93c9('0x2')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize[_0x93c9('0x2')]},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x93c9('0x2')]},'channel':{'type':Sequelize[_0x93c9('0x2')]},'destinationchannel':{'type':Sequelize[_0x93c9('0x2')]},'lastapplication':{'type':Sequelize[_0x93c9('0x2')]},'lastdata':{'type':Sequelize[_0x93c9('0x8')]},'starttime':{'type':Sequelize[_0x93c9('0x9')]},'systemanswertime':{'type':Sequelize[_0x93c9('0x9')]},'answertime':{'type':Sequelize[_0x93c9('0x9')]},'endtime':{'type':Sequelize[_0x93c9('0x9')]},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0x93c9('0xa')]},'mohtime':{'type':Sequelize[_0x93c9('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x93c9('0x2')]},'amaflags':{'type':Sequelize[_0x93c9('0x2')]},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize[_0x93c9('0x2')]},'userSecondDisposition':{'type':Sequelize[_0x93c9('0x2')]},'userThirdDisposition':{'type':Sequelize[_0x93c9('0x2')]},'note':{'type':Sequelize[_0x93c9('0x2')]},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize[_0x93c9('0xa')]},'sipcallid':{'type':Sequelize[_0x93c9('0x2')]}}; \ No newline at end of file +var _0x1131=['inbound','outbound','inbound-fax','outbound-fax','dialer','TEXT','DATE','INTEGER','sequelize','exports','STRING','ENUM'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1131,0x1c4));var _0x1113=function(_0x463f29,_0x552bca){_0x463f29=_0x463f29-0x0;var _0x28d735=_0x1131[_0x463f29];return _0x28d735;};'use strict';var Sequelize=require(_0x1113('0x0'));module[_0x1113('0x1')]={'uniqueid':{'type':Sequelize[_0x1113('0x2')]},'type':{'type':Sequelize[_0x1113('0x3')](_0x1113('0x4'),'internal',_0x1113('0x5'),_0x1113('0x6'),_0x1113('0x7'),_0x1113('0x8'))},'tag':{'type':Sequelize[_0x1113('0x2')]},'accountcode':{'type':Sequelize[_0x1113('0x2')]},'source':{'type':Sequelize[_0x1113('0x2')]},'destination':{'type':Sequelize[_0x1113('0x2')]},'destinationcontext':{'type':Sequelize[_0x1113('0x2')]},'callerid':{'type':Sequelize[_0x1113('0x2')]},'channel':{'type':Sequelize[_0x1113('0x2')]},'destinationchannel':{'type':Sequelize[_0x1113('0x2')]},'lastapplication':{'type':Sequelize[_0x1113('0x2')]},'lastdata':{'type':Sequelize[_0x1113('0x9')]},'starttime':{'type':Sequelize[_0x1113('0xa')]},'systemanswertime':{'type':Sequelize[_0x1113('0xa')]},'answertime':{'type':Sequelize[_0x1113('0xa')]},'endtime':{'type':Sequelize[_0x1113('0xa')]},'duration':{'type':Sequelize[_0x1113('0xb')]},'billableseconds':{'type':Sequelize[_0x1113('0xb')]},'mohtime':{'type':Sequelize[_0x1113('0xb')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x1113('0x2')]},'amaflags':{'type':Sequelize[_0x1113('0x2')]},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize[_0x1113('0x2')]},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize[_0x1113('0x2')]},'note':{'type':Sequelize[_0x1113('0x2')]},'prefix':{'type':Sequelize[_0x1113('0x2')]},'routeid':{'type':Sequelize[_0x1113('0xb')]},'sipcallid':{'type':Sequelize[_0x1113('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 24a60ad..5d8b193 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\x20Voice\x20Call\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(_0x34ca43,_0x200420){var _0x47bf98=function(_0x5d1f0e){while(--_0x5d1f0e){_0x34ca43['push'](_0x34ca43['shift']());}};_0x47bf98(++_0x200420);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xa9e0[_0x4b7b62];return _0x2280df;};'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,_0x4774f4){if(_0x14bec2[_0x0a9e('0x34')][_0x0a9e('0x37')]){delete _0x14bec2[_0x0a9e('0x34')][_0x0a9e('0x37')];}promiseRetry(function(){return findForUpdate(_0x14bec2);},{'retries':0x6,'minTimeout':0xfa})['then'](function(_0x13f44d){if(!_0x13f44d){return new Promise(function(_0x1bde3c){_0x1bde3c(handleEntityNotFound(_0x7f6eb1)({'message':_0x0a9e('0x38')}));});}else{return _0x13f44d[_0x0a9e('0xa')](_0x14bec2[_0x0a9e('0x34')])[_0x0a9e('0xb')](function(_0x6054ee){return respondWithResult(_0x7f6eb1)(_0x6054ee);});}})[_0x0a9e('0x30')](_0x4774f4);}; \ No newline at end of file +var _0x3a73=['show','params','rawAttributes','intersection','length','includeAll','catch','create','body','find','describe','uniqueid','updateWithRetry','No\x20such\x20Voice\x20Call\x20Report','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','promise-retry','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','status','end','sendStatus','stack','name','send','index','VoiceCallReport','fieldName','type','key','model','map','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','include','User','findAll','rows'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0x3a73,0x17c));var _0x33a7=function(_0x5450ef,_0x35959a){_0x5450ef=_0x5450ef-0x0;var _0x12c10b=_0x3a73[_0x5450ef];return _0x12c10b;};'use strict';var _=require(_0x33a7('0x0'));var qs=require(_0x33a7('0x1'));var logger=require(_0x33a7('0x2'))(_0x33a7('0x3'));var db=require(_0x33a7('0x4'))['db'];const promiseRetry=require(_0x33a7('0x5'));function respondWithResult(_0x5ca797,_0xd3ff83){_0xd3ff83=_0xd3ff83||0xc8;return function(_0x3e458d){if(_0x3e458d){return _0x5ca797['status'](_0xd3ff83)[_0x33a7('0x6')](_0x3e458d);}};}function respondWithFilteredResult(_0x465ff0,_0x2383d0){return function(_0x2072f6){if(_0x2072f6){var _0x5c64c3=typeof _0x2383d0[_0x33a7('0x7')]==='undefined'&&typeof _0x2383d0['limit']===_0x33a7('0x8');var _0x5805c2=_0x2072f6[_0x33a7('0x9')];var _0x41c18a=_0x5c64c3?0x0:_0x2383d0['offset'];var _0x5a4aba=_0x5c64c3?_0x2072f6['count']:_0x2383d0[_0x33a7('0x7')]+_0x2383d0[_0x33a7('0xa')];var _0xeaf03f;if(_0x5a4aba>=_0x5805c2){_0x5a4aba=_0x5805c2;_0xeaf03f=0xc8;}else{_0xeaf03f=0xce;}_0x465ff0['status'](_0xeaf03f);return _0x465ff0[_0x33a7('0xb')](_0x33a7('0xc'),_0x41c18a+'-'+_0x5a4aba+'/'+_0x5805c2)[_0x33a7('0x6')](_0x2072f6);}return null;};}function saveUpdates(_0x3c9a26){return function(_0x34ac65){if(_0x34ac65){return _0x34ac65[_0x33a7('0xd')](_0x3c9a26)[_0x33a7('0xe')](function(_0x3b376a){return _0x3b376a;});}return null;};}function removeEntity(_0x3cd29a){return function(_0x2b0e86){if(_0x2b0e86){return _0x2b0e86[_0x33a7('0xf')]()[_0x33a7('0xe')](function(){_0x3cd29a[_0x33a7('0x10')](0xcc)[_0x33a7('0x11')]();});}};}function handleEntityNotFound(_0x4ed03b){return function(_0x285d7f){if(!_0x285d7f){_0x4ed03b[_0x33a7('0x12')](0x194);}return _0x285d7f;};}function handleError(_0x350852,_0x31231e){_0x31231e=_0x31231e||0x1f4;return function(_0x3bf191){logger['error'](_0x3bf191[_0x33a7('0x13')]);if(_0x3bf191[_0x33a7('0x14')]){delete _0x3bf191[_0x33a7('0x14')];}_0x350852[_0x33a7('0x10')](_0x31231e)[_0x33a7('0x15')](_0x3bf191);};}exports[_0x33a7('0x16')]=function(_0x46d87d,_0x55147b){var _0x2c703a={},_0x3ce829={},_0x42542f={'count':0x0,'rows':[]};var _0x2e14cf=_['map'](db[_0x33a7('0x17')]['rawAttributes'],function(_0x21b564){return{'name':_0x21b564[_0x33a7('0x18')],'type':_0x21b564[_0x33a7('0x19')][_0x33a7('0x1a')]};});_0x3ce829[_0x33a7('0x1b')]=_[_0x33a7('0x1c')](_0x2e14cf,'name');_0x3ce829[_0x33a7('0x1d')]=_[_0x33a7('0x1e')](_0x46d87d['query']);_0x3ce829[_0x33a7('0x1f')]=_['intersection'](_0x3ce829['model'],_0x3ce829[_0x33a7('0x1d')]);_0x2c703a[_0x33a7('0x20')]=_['intersection'](_0x3ce829['model'],qs[_0x33a7('0x21')](_0x46d87d[_0x33a7('0x1d')]['fields']));_0x2c703a[_0x33a7('0x20')]=_0x2c703a[_0x33a7('0x20')]['length']?_0x2c703a[_0x33a7('0x20')]:_0x3ce829[_0x33a7('0x1b')];if(!_0x46d87d[_0x33a7('0x1d')][_0x33a7('0x22')](_0x33a7('0x23'))){_0x2c703a[_0x33a7('0xa')]=qs[_0x33a7('0xa')](_0x46d87d['query']['limit']);_0x2c703a[_0x33a7('0x7')]=qs['offset'](_0x46d87d[_0x33a7('0x1d')][_0x33a7('0x7')]);}_0x2c703a[_0x33a7('0x24')]=qs[_0x33a7('0x25')](_0x46d87d[_0x33a7('0x1d')]['sort']);_0x2c703a[_0x33a7('0x26')]=qs[_0x33a7('0x1f')](_['pick'](_0x46d87d['query'],_0x3ce829['filters']),_0x2e14cf);if(_0x46d87d[_0x33a7('0x1d')][_0x33a7('0x27')]){_0x2c703a[_0x33a7('0x26')]=_['merge'](_0x2c703a[_0x33a7('0x26')],{'$or':_[_0x33a7('0x1c')](_0x2e14cf,function(_0x24c5c9){if(_0x24c5c9['type']!==_0x33a7('0x28')){var _0x32524c={};_0x32524c[_0x24c5c9[_0x33a7('0x14')]]={'$like':'%'+_0x46d87d['query'][_0x33a7('0x27')]+'%'};return _0x32524c;}})});}_0x2c703a=_[_0x33a7('0x29')]({},_0x2c703a,_0x46d87d[_0x33a7('0x2a')]);var _0x541eb7={'where':_0x2c703a[_0x33a7('0x26')]};return db[_0x33a7('0x17')][_0x33a7('0x9')](_0x541eb7)[_0x33a7('0xe')](function(_0x2f9e0a){_0x42542f[_0x33a7('0x9')]=_0x2f9e0a;if(_0x46d87d[_0x33a7('0x1d')]['includeAll']){_0x2c703a[_0x33a7('0x2b')]=[{'attributes':['id','name','fullname','alias'],'model':db[_0x33a7('0x2c')],'as':_0x33a7('0x2c')}];}return db[_0x33a7('0x17')][_0x33a7('0x2d')](_0x2c703a);})[_0x33a7('0xe')](function(_0xbab489){_0x42542f[_0x33a7('0x2e')]=_0xbab489;return _0x42542f;})[_0x33a7('0xe')](respondWithFilteredResult(_0x55147b,_0x2c703a))['catch'](handleError(_0x55147b,null));};exports[_0x33a7('0x2f')]=function(_0x112577,_0x160ccf){var _0x438f2c={'raw':!![],'where':{'id':_0x112577[_0x33a7('0x30')]['id']}},_0x64cf77={};_0x64cf77['model']=_[_0x33a7('0x1e')](db[_0x33a7('0x17')][_0x33a7('0x31')]);_0x64cf77[_0x33a7('0x1d')]=_['keys'](_0x112577[_0x33a7('0x1d')]);_0x64cf77[_0x33a7('0x1f')]=_[_0x33a7('0x32')](_0x64cf77[_0x33a7('0x1b')],_0x64cf77[_0x33a7('0x1d')]);_0x438f2c[_0x33a7('0x20')]=_[_0x33a7('0x32')](_0x64cf77[_0x33a7('0x1b')],qs[_0x33a7('0x21')](_0x112577[_0x33a7('0x1d')][_0x33a7('0x21')]));_0x438f2c[_0x33a7('0x20')]=_0x438f2c['attributes'][_0x33a7('0x33')]?_0x438f2c[_0x33a7('0x20')]:_0x64cf77[_0x33a7('0x1b')];if(_0x112577['query'][_0x33a7('0x34')]){_0x438f2c[_0x33a7('0x2b')]=[{'all':!![]}];}_0x438f2c=_[_0x33a7('0x29')]({},_0x438f2c,_0x112577['options']);return db[_0x33a7('0x17')]['find'](_0x438f2c)[_0x33a7('0xe')](handleEntityNotFound(_0x160ccf,null))[_0x33a7('0xe')](respondWithResult(_0x160ccf,null))[_0x33a7('0x35')](handleError(_0x160ccf,null));};exports[_0x33a7('0x36')]=function(_0x1da2cf,_0x261cce){return db['VoiceCallReport'][_0x33a7('0x36')](_0x1da2cf[_0x33a7('0x37')],{})[_0x33a7('0xe')](respondWithResult(_0x261cce,0xc9))['catch'](handleError(_0x261cce,null));};exports[_0x33a7('0xf')]=function(_0x21a5a1,_0x13b255){return db[_0x33a7('0x17')][_0x33a7('0x38')]({'where':{'id':_0x21a5a1[_0x33a7('0x30')]['id']}})[_0x33a7('0xe')](handleEntityNotFound(_0x13b255,null))[_0x33a7('0xe')](removeEntity(_0x13b255,null))[_0x33a7('0x35')](handleError(_0x13b255,null));};exports['describe']=function(_0x4a3f0e,_0x27679a){return db[_0x33a7('0x17')][_0x33a7('0x39')]()[_0x33a7('0xe')](respondWithResult(_0x27679a,null))[_0x33a7('0x35')](handleError(_0x27679a,null));};function findForUpdate(_0xc0c574){return db[_0x33a7('0x17')][_0x33a7('0x38')]({'where':{'uniqueid':_0xc0c574['params']['id'],'UserId':{'$or':[null,_0xc0c574['user']['id']]}}});}exports[_0x33a7('0xd')]=function(_0x5884ac,_0x3fbcff){if(_0x5884ac[_0x33a7('0x37')][_0x33a7('0x3a')]){delete _0x5884ac[_0x33a7('0x37')][_0x33a7('0x3a')];}return findForUpdate(_0x5884ac)['then'](handleEntityNotFound(_0x3fbcff,null))[_0x33a7('0xe')](saveUpdates(_0x5884ac[_0x33a7('0x37')],null))['then'](respondWithResult(_0x3fbcff,null))[_0x33a7('0x35')](handleError(_0x3fbcff,null));};exports[_0x33a7('0x3b')]=function(_0x16a1f3,_0x55bb83,_0x4c70cb){if(_0x16a1f3[_0x33a7('0x37')][_0x33a7('0x3a')]){delete _0x16a1f3[_0x33a7('0x37')][_0x33a7('0x3a')];}promiseRetry(function(){return findForUpdate(_0x16a1f3);},{'retries':0x6,'minTimeout':0xfa})[_0x33a7('0xe')](function(_0x9bc19a){if(!_0x9bc19a){return new Promise(function(_0x4824d3){_0x4824d3(handleEntityNotFound(_0x55bb83)({'message':_0x33a7('0x3c')}));});}else{return _0x9bc19a['update'](_0x16a1f3[_0x33a7('0x37')])[_0x33a7('0xe')](function(_0x284c6b){return respondWithResult(_0x55bb83)(_0x284c6b);});}},_0x4c70cb)['catch'](_0x4c70cb);}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 417bb8c..a43cc49 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 _0xdbc7=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceCallReport.attributes','define','VoiceCallReport'];(function(_0x5decec,_0x4e5761){var _0x35e1b4=function(_0x27066d){while(--_0x27066d){_0x5decec['push'](_0x5decec['shift']());}};_0x35e1b4(++_0x4e5761);}(_0xdbc7,0xe4));var _0x7dbc=function(_0x5eb22e,_0x27cbac){_0x5eb22e=_0x5eb22e-0x0;var _0x27fed5=_0xdbc7[_0x5eb22e];return _0x27fed5;};'use strict';var _=require(_0x7dbc('0x0'));var util=require(_0x7dbc('0x1'));var logger=require(_0x7dbc('0x2'))(_0x7dbc('0x3'));var moment=require(_0x7dbc('0x4'));var BPromise=require('bluebird');var rp=require(_0x7dbc('0x5'));var fs=require('fs');var path=require(_0x7dbc('0x6'));var rimraf=require(_0x7dbc('0x7'));var config=require(_0x7dbc('0x8'));var attributes=require(_0x7dbc('0x9'));module['exports']=function(_0x209e2e,_0x151e82){return _0x209e2e[_0x7dbc('0xa')](_0x7dbc('0xb'),attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x4096=['../../config/logger','api','moment','bluebird','request-promise','path','./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call','uniqueid','lodash'];(function(_0x454018,_0x46e33a){var _0x24697d=function(_0x3ec647){while(--_0x3ec647){_0x454018['push'](_0x454018['shift']());}};_0x24697d(++_0x46e33a);}(_0x4096,0x110));var _0x6409=function(_0x16e5ed,_0x517480){_0x16e5ed=_0x16e5ed-0x0;var _0xf6949c=_0x4096[_0x16e5ed];return _0xf6949c;};'use strict';var _=require(_0x6409('0x0'));var util=require('util');var logger=require(_0x6409('0x1'))(_0x6409('0x2'));var moment=require(_0x6409('0x3'));var BPromise=require(_0x6409('0x4'));var rp=require(_0x6409('0x5'));var fs=require('fs');var path=require(_0x6409('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6409('0x7'));module[_0x6409('0x8')]=function(_0x37d8fa,_0x50ea0f){return _0x37d8fa[_0x6409('0x9')](_0x6409('0xa'),attributes,{'tableName':_0x6409('0xb'),'paranoid':![],'indexes':[{'fields':[_0x6409('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 51feb9e..a63d919 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 _0x425d=['findAll','options','raw','where','attributes','limit','include','map','model','GetVoiceCallReport','CreateVoiceCallReport','create','body','catch','UpdateVoiceCallReport','update','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','VoiceCallReport'];(function(_0x48043a,_0x2b99c1){var _0x7d92d2=function(_0xe18174){while(--_0xe18174){_0x48043a['push'](_0x48043a['shift']());}};_0x7d92d2(++_0x2b99c1);}(_0x425d,0x150));var _0xd425=function(_0x2d3a8d,_0x18a73e){_0x2d3a8d=_0x2d3a8d-0x0;var _0x25e35e=_0x425d[_0x2d3a8d];return _0x25e35e;};'use strict';var _=require(_0xd425('0x0'));var util=require(_0xd425('0x1'));var moment=require(_0xd425('0x2'));var BPromise=require('bluebird');var rs=require(_0xd425('0x3'));var fs=require('fs');var Redis=require(_0xd425('0x4'));var db=require(_0xd425('0x5'))['db'];var utils=require(_0xd425('0x6'));var logger=require(_0xd425('0x7'))('rpc');var config=require(_0xd425('0x8'));var jayson=require(_0xd425('0x9'));var client=jayson[_0xd425('0xa')][_0xd425('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1dfd10,_0x217750,_0x42d25d){return new BPromise(function(_0x3aa60f,_0x436548){return client[_0xd425('0xc')](_0x1dfd10,_0x42d25d)[_0xd425('0xd')](function(_0x452b25){logger['info'](_0xd425('0xe'),_0x217750,_0xd425('0xf'));logger[_0xd425('0x10')](_0xd425('0x11'),_0x217750,_0xd425('0xf'),JSON[_0xd425('0x12')](_0x452b25));if(_0x452b25[_0xd425('0x13')]){if(_0x452b25[_0xd425('0x13')]['code']===0x1f4){logger['error'](_0xd425('0xe'),_0x217750,_0x452b25['error'][_0xd425('0x14')]);return _0x436548(_0x452b25['error'][_0xd425('0x14')]);}logger[_0xd425('0x13')](_0xd425('0xe'),_0x217750,_0x452b25[_0xd425('0x13')]['message']);return _0x3aa60f(_0x452b25[_0xd425('0x13')][_0xd425('0x14')]);}else{logger[_0xd425('0x15')]('VoiceCallReport,\x20%s,\x20%s',_0x217750,_0xd425('0xf'));_0x3aa60f(_0x452b25[_0xd425('0x16')]['message']);}})['catch'](function(_0x53880e){logger[_0xd425('0x13')](_0xd425('0xe'),_0x217750,_0x53880e);_0x436548(_0x53880e);});});}exports['GetVoiceCallReport']=function(_0x4cd485){var _0x3eb3b2=this;return new Promise(function(_0x5dfaae,_0x3bfd4b){return db[_0xd425('0x17')][_0xd425('0x18')]({'raw':_0x4cd485[_0xd425('0x19')]?_0x4cd485[_0xd425('0x19')][_0xd425('0x1a')]===undefined?!![]:![]:!![],'where':_0x4cd485['options']?_0x4cd485['options'][_0xd425('0x1b')]||null:null,'attributes':_0x4cd485['options']?_0x4cd485[_0xd425('0x19')][_0xd425('0x1c')]||null:null,'limit':_0x4cd485[_0xd425('0x19')]?_0x4cd485[_0xd425('0x19')][_0xd425('0x1d')]||null:null,'include':_0x4cd485[_0xd425('0x19')]?_0x4cd485[_0xd425('0x19')][_0xd425('0x1e')]?_['map'](_0x4cd485[_0xd425('0x19')]['include'],function(_0x573126){return{'model':db[_0x573126['model']],'as':_0x573126['as'],'attributes':_0x573126[_0xd425('0x1c')],'include':_0x573126[_0xd425('0x1e')]?_[_0xd425('0x1f')](_0x573126[_0xd425('0x1e')],function(_0x58b27d){return{'model':db[_0x58b27d[_0xd425('0x20')]],'as':_0x58b27d['as'],'attributes':_0x58b27d[_0xd425('0x1c')],'include':_0x58b27d[_0xd425('0x1e')]?_[_0xd425('0x1f')](_0x58b27d['include'],function(_0x2796bf){return{'model':db[_0x2796bf['model']],'as':_0x2796bf['as'],'attributes':_0x2796bf[_0xd425('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x324c43){logger[_0xd425('0x15')](_0xd425('0x21'),_0x4cd485);logger[_0xd425('0x10')](_0xd425('0x21'),_0x4cd485,JSON[_0xd425('0x12')](_0x324c43));_0x5dfaae(_0x324c43);})['catch'](function(_0x14b7ff){logger[_0xd425('0x13')](_0xd425('0x21'),_0x14b7ff[_0xd425('0x14')],_0x4cd485);_0x3bfd4b(_0x3eb3b2[_0xd425('0x13')](0x1f4,_0x14b7ff[_0xd425('0x14')]));});});};exports[_0xd425('0x22')]=function(_0x129832){var _0x49c850=this;return new Promise(function(_0x2ebede,_0x47c0b2){return db['VoiceCallReport'][_0xd425('0x23')](_0x129832[_0xd425('0x24')],{'raw':_0x129832[_0xd425('0x19')]?_0x129832[_0xd425('0x19')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x679f97){logger['info'](_0xd425('0x22'),_0x129832);logger['debug']('CreateVoiceCallReport',_0x129832,JSON[_0xd425('0x12')](_0x679f97));_0x2ebede(_0x679f97);})[_0xd425('0x25')](function(_0x37d08f){logger[_0xd425('0x13')](_0xd425('0x22'),_0x37d08f[_0xd425('0x14')],_0x129832);_0x47c0b2(_0x49c850[_0xd425('0x13')](0x1f4,_0x37d08f['message']));});});};exports[_0xd425('0x26')]=function(_0xabda3){var _0xc3bba4=this;return new Promise(function(_0x579325,_0x355d53){return db[_0xd425('0x17')][_0xd425('0x27')](_0xabda3[_0xd425('0x24')],{'raw':_0xabda3[_0xd425('0x19')]?_0xabda3[_0xd425('0x19')][_0xd425('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xabda3['options']?_0xabda3['options'][_0xd425('0x1b')]||null:null,'attributes':_0xabda3[_0xd425('0x19')]?_0xabda3[_0xd425('0x19')][_0xd425('0x1c')]||null:null,'limit':_0xabda3[_0xd425('0x19')]?_0xabda3['options']['limit']||null:null})[_0xd425('0xd')](function(_0x42e1e9){logger[_0xd425('0x15')](_0xd425('0x26'),_0xabda3);logger['debug'](_0xd425('0x26'),_0xabda3,JSON[_0xd425('0x12')](_0x42e1e9));_0x579325(_0x42e1e9);})[_0xd425('0x25')](function(_0x5cdbbd){logger[_0xd425('0x13')](_0xd425('0x26'),_0x5cdbbd[_0xd425('0x14')],_0xabda3);_0x355d53(_0xc3bba4[_0xd425('0x13')](0x1f4,_0x5cdbbd[_0xd425('0x14')]));});});}; \ No newline at end of file +var _0xf346=['code','message','catch','VoiceCallReport','options','where','limit','include','map','model','attributes','GetVoiceCallReport','debug','stringify','create','body','CreateVoiceCallReport','UpdateVoiceCallReport','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','VoiceCallReport,\x20%s,\x20%s,\x20%s','error'];(function(_0x2dbcef,_0x1cfecb){var _0x5a90ea=function(_0x189054){while(--_0x189054){_0x2dbcef['push'](_0x2dbcef['shift']());}};_0x5a90ea(++_0x1cfecb);}(_0xf346,0x184));var _0x6f34=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0xf346[_0x16b9ed];return _0x66b1f8;};'use strict';var _=require(_0x6f34('0x0'));var util=require(_0x6f34('0x1'));var moment=require(_0x6f34('0x2'));var BPromise=require(_0x6f34('0x3'));var rs=require(_0x6f34('0x4'));var fs=require('fs');var Redis=require(_0x6f34('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x6f34('0x6'));var logger=require('../../config/logger')(_0x6f34('0x7'));var config=require(_0x6f34('0x8'));var jayson=require(_0x6f34('0x9'));var client=jayson[_0x6f34('0xa')][_0x6f34('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x47d7b5,_0x401db4,_0x359c9a){return new BPromise(function(_0x1067e7,_0x58239a){return client[_0x6f34('0xc')](_0x47d7b5,_0x359c9a)[_0x6f34('0xd')](function(_0x577a17){logger[_0x6f34('0xe')](_0x6f34('0xf'),_0x401db4,_0x6f34('0x10'));logger['debug'](_0x6f34('0x11'),_0x401db4,_0x6f34('0x10'),JSON['stringify'](_0x577a17));if(_0x577a17[_0x6f34('0x12')]){if(_0x577a17['error'][_0x6f34('0x13')]===0x1f4){logger[_0x6f34('0x12')](_0x6f34('0xf'),_0x401db4,_0x577a17[_0x6f34('0x12')]['message']);return _0x58239a(_0x577a17['error']['message']);}logger[_0x6f34('0x12')]('VoiceCallReport,\x20%s,\x20%s',_0x401db4,_0x577a17[_0x6f34('0x12')][_0x6f34('0x14')]);return _0x1067e7(_0x577a17['error'][_0x6f34('0x14')]);}else{logger[_0x6f34('0xe')](_0x6f34('0xf'),_0x401db4,'request\x20sent');_0x1067e7(_0x577a17['result'][_0x6f34('0x14')]);}})[_0x6f34('0x15')](function(_0x398b42){logger[_0x6f34('0x12')](_0x6f34('0xf'),_0x401db4,_0x398b42);_0x58239a(_0x398b42);});});}exports['GetVoiceCallReport']=function(_0x643d33){var _0x324bfc=this;return new Promise(function(_0x285532,_0x4ed491){return db[_0x6f34('0x16')]['findAll']({'raw':_0x643d33[_0x6f34('0x17')]?_0x643d33['options']['raw']===undefined?!![]:![]:!![],'where':_0x643d33[_0x6f34('0x17')]?_0x643d33[_0x6f34('0x17')][_0x6f34('0x18')]||null:null,'attributes':_0x643d33[_0x6f34('0x17')]?_0x643d33[_0x6f34('0x17')]['attributes']||null:null,'limit':_0x643d33[_0x6f34('0x17')]?_0x643d33['options'][_0x6f34('0x19')]||null:null,'include':_0x643d33[_0x6f34('0x17')]?_0x643d33[_0x6f34('0x17')][_0x6f34('0x1a')]?_[_0x6f34('0x1b')](_0x643d33['options'][_0x6f34('0x1a')],function(_0x479bc6){return{'model':db[_0x479bc6[_0x6f34('0x1c')]],'as':_0x479bc6['as'],'attributes':_0x479bc6[_0x6f34('0x1d')],'include':_0x479bc6[_0x6f34('0x1a')]?_['map'](_0x479bc6[_0x6f34('0x1a')],function(_0x2c6830){return{'model':db[_0x2c6830[_0x6f34('0x1c')]],'as':_0x2c6830['as'],'attributes':_0x2c6830[_0x6f34('0x1d')],'include':_0x2c6830[_0x6f34('0x1a')]?_[_0x6f34('0x1b')](_0x2c6830[_0x6f34('0x1a')],function(_0x231a00){return{'model':db[_0x231a00['model']],'as':_0x231a00['as'],'attributes':_0x231a00[_0x6f34('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x6f34('0xd')](function(_0x2a201f){logger['info'](_0x6f34('0x1e'),_0x643d33);logger[_0x6f34('0x1f')](_0x6f34('0x1e'),_0x643d33,JSON[_0x6f34('0x20')](_0x2a201f));_0x285532(_0x2a201f);})['catch'](function(_0x42e3da){logger[_0x6f34('0x12')](_0x6f34('0x1e'),_0x42e3da[_0x6f34('0x14')],_0x643d33);_0x4ed491(_0x324bfc[_0x6f34('0x12')](0x1f4,_0x42e3da[_0x6f34('0x14')]));});});};exports['CreateVoiceCallReport']=function(_0x130de0){var _0x2bb1f6=this;return new Promise(function(_0x1b5fa2,_0x1a2229){return db[_0x6f34('0x16')][_0x6f34('0x21')](_0x130de0[_0x6f34('0x22')],{'raw':_0x130de0['options']?_0x130de0[_0x6f34('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x6f34('0xd')](function(_0x4c06e9){logger['info']('CreateVoiceCallReport',_0x130de0);logger[_0x6f34('0x1f')](_0x6f34('0x23'),_0x130de0,JSON[_0x6f34('0x20')](_0x4c06e9));_0x1b5fa2(_0x4c06e9);})['catch'](function(_0x22f48d){logger['error'](_0x6f34('0x23'),_0x22f48d['message'],_0x130de0);_0x1a2229(_0x2bb1f6[_0x6f34('0x12')](0x1f4,_0x22f48d[_0x6f34('0x14')]));});});};exports[_0x6f34('0x24')]=function(_0x440349){var _0x4550ba=this;return new Promise(function(_0x2c1990,_0x34bcb4){return db[_0x6f34('0x16')]['update'](_0x440349[_0x6f34('0x22')],{'raw':_0x440349[_0x6f34('0x17')]?_0x440349[_0x6f34('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x440349[_0x6f34('0x17')]?_0x440349[_0x6f34('0x17')]['where']||null:null,'attributes':_0x440349['options']?_0x440349[_0x6f34('0x17')]['attributes']||null:null,'limit':_0x440349[_0x6f34('0x17')]?_0x440349[_0x6f34('0x17')][_0x6f34('0x19')]||null:null})[_0x6f34('0xd')](function(_0x76c69d){logger[_0x6f34('0xe')](_0x6f34('0x24'),_0x440349);logger['debug'](_0x6f34('0x24'),_0x440349,JSON[_0x6f34('0x20')](_0x76c69d));_0x2c1990(_0x76c69d);})[_0x6f34('0x15')](function(_0x4a8144){logger[_0x6f34('0x12')]('UpdateVoiceCallReport',_0x4a8144['message'],_0x440349);_0x34bcb4(_0x4550ba['error'](0x1f4,_0x4a8144[_0x6f34('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index c8c44fa..9065c32 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 _0xd9c0=['fs-extra','../../components/auth/service','../../components/interaction/service','./voiceChanSpy.controller','get','isAuthenticated','/:id','show','create','put','update','destroy','multer','util','path','connect-timeout','express','Router'];(function(_0x5b7311,_0x13ad9e){var _0x2c5a92=function(_0x32c861){while(--_0x32c861){_0x5b7311['push'](_0x5b7311['shift']());}};_0x2c5a92(++_0x13ad9e);}(_0xd9c0,0x174));var _0x0d9c=function(_0x2fde47,_0x2f61c2){_0x2fde47=_0x2fde47-0x0;var _0x35d873=_0xd9c0[_0x2fde47];return _0x35d873;};'use strict';var multer=require(_0x0d9c('0x0'));var util=require(_0x0d9c('0x1'));var path=require(_0x0d9c('0x2'));var timeout=require(_0x0d9c('0x3'));var express=require(_0x0d9c('0x4'));var router=express[_0x0d9c('0x5')]();var fs_extra=require(_0x0d9c('0x6'));var auth=require(_0x0d9c('0x7'));var interaction=require(_0x0d9c('0x8'));var config=require('../../config/environment');var controller=require(_0x0d9c('0x9'));router[_0x0d9c('0xa')]('/',auth[_0x0d9c('0xb')](),controller['index']);router[_0x0d9c('0xa')](_0x0d9c('0xc'),auth[_0x0d9c('0xb')](),controller[_0x0d9c('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x0d9c('0xe')]);router[_0x0d9c('0xf')](_0x0d9c('0xc'),auth[_0x0d9c('0xb')](),controller[_0x0d9c('0x10')]);router['delete'](_0x0d9c('0xc'),auth[_0x0d9c('0xb')](),controller[_0x0d9c('0x11')]);module['exports']=router; \ No newline at end of file +var _0x64ad=['create','put','update','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./voiceChanSpy.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x39148a,_0x1e744a){var _0x11deb1=function(_0x3dd082){while(--_0x3dd082){_0x39148a['push'](_0x39148a['shift']());}};_0x11deb1(++_0x1e744a);}(_0x64ad,0x111));var _0xd64a=function(_0x3b19ea,_0x518b6b){_0x3b19ea=_0x3b19ea-0x0;var _0x40ece9=_0x64ad[_0x3b19ea];return _0x40ece9;};'use strict';var multer=require(_0xd64a('0x0'));var util=require(_0xd64a('0x1'));var path=require(_0xd64a('0x2'));var timeout=require(_0xd64a('0x3'));var express=require(_0xd64a('0x4'));var router=express[_0xd64a('0x5')]();var fs_extra=require(_0xd64a('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xd64a('0x7'));var config=require('../../config/environment');var controller=require(_0xd64a('0x8'));router[_0xd64a('0x9')]('/',auth[_0xd64a('0xa')](),controller[_0xd64a('0xb')]);router[_0xd64a('0x9')](_0xd64a('0xc'),auth[_0xd64a('0xa')](),controller[_0xd64a('0xd')]);router[_0xd64a('0xe')]('/',auth[_0xd64a('0xa')](),controller[_0xd64a('0xf')]);router[_0xd64a('0x10')](_0xd64a('0xc'),auth[_0xd64a('0xa')](),controller[_0xd64a('0x11')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 5f52ce7..7163fd1 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 _0x5745=['STRING','name','options','getDataValue','split','BOOLEAN','sequelize','exports'];(function(_0x21c69c,_0x1b7535){var _0x2acd03=function(_0x4c70f0){while(--_0x4c70f0){_0x21c69c['push'](_0x21c69c['shift']());}};_0x2acd03(++_0x1b7535);}(_0x5745,0x176));var _0x5574=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x5745[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x5574('0x0'));module[_0x5574('0x1')]={'name':{'type':Sequelize[_0x5574('0x2')]},'prefix':{'type':Sequelize[_0x5574('0x2')],'unique':_0x5574('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0x5574('0x2')],'set':function(_0x3dfa64){this['setDataValue'](_0x5574('0x4'),_0x3dfa64?_0x3dfa64['join'](''):[]);},'get':function(){return this[_0x5574('0x5')](_0x5574('0x4'))?this[_0x5574('0x5')]('options')[_0x5574('0x6')](''):[];}},'auth':{'type':Sequelize[_0x5574('0x7')],'defaultValue':![]},'password':{'type':Sequelize[_0x5574('0x2')]},'record':{'type':Sequelize[_0x5574('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x5574('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x512e=['setDataValue','join','getDataValue','options','split','sequelize','exports','STRING','name'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x512e,0x125));var _0xe512=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x512e[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xe512('0x0'));module[_0xe512('0x1')]={'name':{'type':Sequelize[_0xe512('0x2')]},'prefix':{'type':Sequelize[_0xe512('0x2')],'unique':_0xe512('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0xe512('0x2')],'set':function(_0xe9d7b3){this[_0xe512('0x4')]('options',_0xe9d7b3?_0xe9d7b3[_0xe512('0x5')](''):[]);},'get':function(){return this[_0xe512('0x6')](_0xe512('0x7'))?this[_0xe512('0x6')]('options')[_0xe512('0x8')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0xe512('0x2')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xe512('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 6d2c614..5d80e86 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 _0x8f7d=['util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','get','ChanSpies','UserProfileResource','error','stack','send','index','VoiceChanSpy','fieldName','type','key','model','map','keys','query','intersection','attributes','fields','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','name','includeAll','include','findAll','rows','params','rawAttributes','length','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','fast-json-patch','bluebird'];(function(_0x536c49,_0x23665c){var _0x44d759=function(_0x5d1e8c){while(--_0x5d1e8c){_0x536c49['push'](_0x536c49['shift']());}};_0x44d759(++_0x23665c);}(_0x8f7d,0xf5));var _0xd8f7=function(_0x3881a2,_0x3f6ad1){_0x3881a2=_0x3881a2-0x0;var _0x746941=_0x8f7d[_0x3881a2];return _0x746941;};'use strict';var emlformat=require(_0xd8f7('0x0'));var rimraf=require(_0xd8f7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd8f7('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd8f7('0x3'));var Mustache=require('mustache');var util=require(_0xd8f7('0x4'));var path=require(_0xd8f7('0x5'));var sox=require(_0xd8f7('0x6'));var csv=require(_0xd8f7('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd8f7('0x8'));var _=require(_0xd8f7('0x9'));var squel=require(_0xd8f7('0xa'));var crypto=require(_0xd8f7('0xb'));var jsforce=require(_0xd8f7('0xc'));var deskjs=require(_0xd8f7('0xd'));var toCsv=require(_0xd8f7('0x7'));var querystring=require(_0xd8f7('0xe'));var Papa=require('papaparse');var Redis=require(_0xd8f7('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xd8f7('0x10'));var as=require(_0xd8f7('0x11'));var hardwareService=require(_0xd8f7('0x12'));var logger=require(_0xd8f7('0x13'))(_0xd8f7('0x14'));var utils=require(_0xd8f7('0x15'));var config=require(_0xd8f7('0x16'));var licenseUtil=require(_0xd8f7('0x17'));var db=require(_0xd8f7('0x18'))['db'];function respondWithStatusCode(_0x41ebd3,_0x29467b){_0x29467b=_0x29467b||0xcc;return function(_0x21ee60){if(_0x21ee60){return _0x41ebd3[_0xd8f7('0x19')](_0x29467b);}return _0x41ebd3[_0xd8f7('0x1a')](_0x29467b)[_0xd8f7('0x1b')]();};}function respondWithResult(_0x4406c7,_0x4b4114){_0x4b4114=_0x4b4114||0xc8;return function(_0x5c1177){if(_0x5c1177){return _0x4406c7['status'](_0x4b4114)[_0xd8f7('0x1c')](_0x5c1177);}};}function respondWithFilteredResult(_0x2b58c1,_0x341152){return function(_0x109488){if(_0x109488){var _0x299208=typeof _0x341152[_0xd8f7('0x1d')]===_0xd8f7('0x1e')&&typeof _0x341152[_0xd8f7('0x1f')]==='undefined';var _0x478e46=_0x109488['count'];var _0x202298=_0x299208?0x0:_0x341152[_0xd8f7('0x1d')];var _0x5d31c5=_0x299208?_0x109488[_0xd8f7('0x20')]:_0x341152[_0xd8f7('0x1d')]+_0x341152[_0xd8f7('0x1f')];var _0x48a97b;if(_0x5d31c5>=_0x478e46){_0x5d31c5=_0x478e46;_0x48a97b=0xc8;}else{_0x48a97b=0xce;}_0x2b58c1[_0xd8f7('0x1a')](_0x48a97b);return _0x2b58c1['set'](_0xd8f7('0x21'),_0x202298+'-'+_0x5d31c5+'/'+_0x478e46)[_0xd8f7('0x1c')](_0x109488);}return null;};}function patchUpdates(_0x4e0ec4){return function(_0xcbc2a5){try{jsonpatch[_0xd8f7('0x22')](_0xcbc2a5,_0x4e0ec4,!![]);}catch(_0x57bf17){return BPromise[_0xd8f7('0x23')](_0x57bf17);}return _0xcbc2a5[_0xd8f7('0x24')]();};}function saveUpdates(_0x54bc78,_0x2fc6cb){return function(_0x58469a){if(_0x58469a){return _0x58469a['update'](_0x54bc78)[_0xd8f7('0x25')](function(_0x4e1e10){return _0x4e1e10;});}return null;};}function removeEntity(_0x148d6f,_0x1bbe84){return function(_0x4d84bb){if(_0x4d84bb){return _0x4d84bb[_0xd8f7('0x26')]()[_0xd8f7('0x25')](function(){var _0x145bbe=_0x4d84bb[_0xd8f7('0x27')]({'plain':!![]});var _0x8874d4=_0xd8f7('0x28');return db[_0xd8f7('0x29')][_0xd8f7('0x26')]({'where':{'type':_0x8874d4,'resourceId':_0x145bbe['id']}})[_0xd8f7('0x25')](function(){return _0x4d84bb;});})[_0xd8f7('0x25')](function(){_0x148d6f[_0xd8f7('0x1a')](0xcc)[_0xd8f7('0x1b')]();});}};}function handleEntityNotFound(_0x309d4a,_0x54d242){return function(_0x535f78){if(!_0x535f78){_0x309d4a[_0xd8f7('0x19')](0x194);}return _0x535f78;};}function handleError(_0x3dadbb,_0x1293f7){_0x1293f7=_0x1293f7||0x1f4;return function(_0x20ef3a){logger[_0xd8f7('0x2a')](_0x20ef3a[_0xd8f7('0x2b')]);if(_0x20ef3a['name']){delete _0x20ef3a['name'];}_0x3dadbb[_0xd8f7('0x1a')](_0x1293f7)[_0xd8f7('0x2c')](_0x20ef3a);};}exports[_0xd8f7('0x2d')]=function(_0x2f4ebc,_0x3e2f76){var _0x44fb03={},_0x4f46d5={},_0x5b5dd4={'count':0x0,'rows':[]};var _0x3a60d8=_['map'](db[_0xd8f7('0x2e')]['rawAttributes'],function(_0x1b2008){return{'name':_0x1b2008[_0xd8f7('0x2f')],'type':_0x1b2008[_0xd8f7('0x30')][_0xd8f7('0x31')]};});_0x4f46d5[_0xd8f7('0x32')]=_[_0xd8f7('0x33')](_0x3a60d8,'name');_0x4f46d5['query']=_[_0xd8f7('0x34')](_0x2f4ebc[_0xd8f7('0x35')]);_0x4f46d5['filters']=_[_0xd8f7('0x36')](_0x4f46d5[_0xd8f7('0x32')],_0x4f46d5[_0xd8f7('0x35')]);_0x44fb03[_0xd8f7('0x37')]=_[_0xd8f7('0x36')](_0x4f46d5[_0xd8f7('0x32')],qs[_0xd8f7('0x38')](_0x2f4ebc[_0xd8f7('0x35')][_0xd8f7('0x38')]));_0x44fb03[_0xd8f7('0x37')]=_0x44fb03[_0xd8f7('0x37')]['length']?_0x44fb03['attributes']:_0x4f46d5[_0xd8f7('0x32')];if(!_0x2f4ebc['query']['hasOwnProperty'](_0xd8f7('0x39'))){_0x44fb03[_0xd8f7('0x1f')]=qs[_0xd8f7('0x1f')](_0x2f4ebc[_0xd8f7('0x35')][_0xd8f7('0x1f')]);_0x44fb03[_0xd8f7('0x1d')]=qs['offset'](_0x2f4ebc['query'][_0xd8f7('0x1d')]);}_0x44fb03['order']=qs[_0xd8f7('0x3a')](_0x2f4ebc[_0xd8f7('0x35')][_0xd8f7('0x3a')]);_0x44fb03[_0xd8f7('0x3b')]=qs[_0xd8f7('0x3c')](_[_0xd8f7('0x3d')](_0x2f4ebc[_0xd8f7('0x35')],_0x4f46d5[_0xd8f7('0x3c')]),_0x3a60d8);if(_0x2f4ebc[_0xd8f7('0x35')][_0xd8f7('0x3e')]){_0x44fb03[_0xd8f7('0x3b')]=_[_0xd8f7('0x3f')](_0x44fb03[_0xd8f7('0x3b')],{'$or':_['map'](_0x3a60d8,function(_0x31fc42){if(_0x31fc42[_0xd8f7('0x30')]!==_0xd8f7('0x40')){var _0x120a65={};_0x120a65[_0x31fc42[_0xd8f7('0x41')]]={'$like':'%'+_0x2f4ebc[_0xd8f7('0x35')][_0xd8f7('0x3e')]+'%'};return _0x120a65;}})});}_0x44fb03=_[_0xd8f7('0x3f')]({},_0x44fb03,_0x2f4ebc['options']);var _0xead6c={'where':_0x44fb03[_0xd8f7('0x3b')]};return db[_0xd8f7('0x2e')][_0xd8f7('0x20')](_0xead6c)[_0xd8f7('0x25')](function(_0x254c15){_0x5b5dd4['count']=_0x254c15;if(_0x2f4ebc[_0xd8f7('0x35')][_0xd8f7('0x42')]){_0x44fb03[_0xd8f7('0x43')]=[{'all':!![]}];}return db['VoiceChanSpy'][_0xd8f7('0x44')](_0x44fb03);})[_0xd8f7('0x25')](function(_0x5cadee){_0x5b5dd4[_0xd8f7('0x45')]=_0x5cadee;return _0x5b5dd4;})[_0xd8f7('0x25')](respondWithFilteredResult(_0x3e2f76,_0x44fb03))['catch'](handleError(_0x3e2f76,null));};exports['show']=function(_0x54c353,_0x2a03b0){var _0x14ac7f={'raw':![],'where':{'id':_0x54c353[_0xd8f7('0x46')]['id']}},_0x3149b3={};_0x3149b3['model']=_[_0xd8f7('0x34')](db[_0xd8f7('0x2e')][_0xd8f7('0x47')]);_0x3149b3[_0xd8f7('0x35')]=_[_0xd8f7('0x34')](_0x54c353[_0xd8f7('0x35')]);_0x3149b3[_0xd8f7('0x3c')]=_[_0xd8f7('0x36')](_0x3149b3[_0xd8f7('0x32')],_0x3149b3[_0xd8f7('0x35')]);_0x14ac7f[_0xd8f7('0x37')]=_[_0xd8f7('0x36')](_0x3149b3[_0xd8f7('0x32')],qs[_0xd8f7('0x38')](_0x54c353[_0xd8f7('0x35')][_0xd8f7('0x38')]));_0x14ac7f['attributes']=_0x14ac7f['attributes'][_0xd8f7('0x48')]?_0x14ac7f[_0xd8f7('0x37')]:_0x3149b3[_0xd8f7('0x32')];if(_0x54c353['query'][_0xd8f7('0x42')]){_0x14ac7f[_0xd8f7('0x43')]=[{'all':!![]}];}_0x14ac7f=_[_0xd8f7('0x3f')]({},_0x14ac7f,_0x54c353[_0xd8f7('0x49')]);return db['VoiceChanSpy'][_0xd8f7('0x4a')](_0x14ac7f)[_0xd8f7('0x25')](handleEntityNotFound(_0x2a03b0,null))[_0xd8f7('0x25')](respondWithResult(_0x2a03b0,null))[_0xd8f7('0x4b')](handleError(_0x2a03b0,null));};exports[_0xd8f7('0x4c')]=function(_0x3a317c,_0x522fb2){return db[_0xd8f7('0x2e')][_0xd8f7('0x4c')](_0x3a317c[_0xd8f7('0x4d')],{})[_0xd8f7('0x25')](function(_0x69bfff){var _0x2bad56=_0x3a317c[_0xd8f7('0x4e')]['get']({'plain':!![]});if(!_0x2bad56)throw new Error(_0xd8f7('0x4f'));if(_0x2bad56['role']===_0xd8f7('0x4e')){var _0x2a797d=_0x69bfff[_0xd8f7('0x27')]({'plain':!![]});var _0x59f6da='ChanSpies';return db['UserProfileSection']['find']({'where':{'name':_0x59f6da,'userProfileId':_0x2bad56['userProfileId']},'raw':!![]})['then'](function(_0x2eea52){if(_0x2eea52&&_0x2eea52[_0xd8f7('0x50')]===0x0){return db[_0xd8f7('0x29')][_0xd8f7('0x4c')]({'name':_0x2a797d[_0xd8f7('0x41')],'resourceId':_0x2a797d['id'],'type':_0x2eea52[_0xd8f7('0x41')],'sectionId':_0x2eea52['id']},{})[_0xd8f7('0x25')](function(){return _0x69bfff;});}else{return _0x69bfff;}})[_0xd8f7('0x4b')](function(_0x1ef4d8){logger[_0xd8f7('0x2a')](_0xd8f7('0x51'),_0x1ef4d8);throw _0x1ef4d8;});}return _0x69bfff;})[_0xd8f7('0x25')](respondWithResult(_0x522fb2,0xc9))[_0xd8f7('0x4b')](handleError(_0x522fb2,null));};exports[_0xd8f7('0x52')]=function(_0x52f47e,_0x3f0ced){if(_0x52f47e[_0xd8f7('0x4d')]['id']){delete _0x52f47e[_0xd8f7('0x4d')]['id'];}return db[_0xd8f7('0x2e')][_0xd8f7('0x4a')]({'where':{'id':_0x52f47e[_0xd8f7('0x46')]['id']}})[_0xd8f7('0x25')](handleEntityNotFound(_0x3f0ced,null))[_0xd8f7('0x25')](saveUpdates(_0x52f47e[_0xd8f7('0x4d')],null))[_0xd8f7('0x25')](respondWithResult(_0x3f0ced,null))[_0xd8f7('0x4b')](handleError(_0x3f0ced,null));};exports[_0xd8f7('0x26')]=function(_0x130417,_0x493413){return db['VoiceChanSpy'][_0xd8f7('0x4a')]({'where':{'id':_0x130417[_0xd8f7('0x46')]['id']}})[_0xd8f7('0x25')](handleEntityNotFound(_0x493413,null))[_0xd8f7('0x25')](removeEntity(_0x493413,null))[_0xd8f7('0x4b')](handleError(_0x493413,null));}; \ No newline at end of file +var _0x6ff1=['options','VoiceChanSpy','includeAll','include','findAll','rows','params','find','catch','create','body','get','role','user','ChanSpies','UserProfileSection','userProfileId','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','UserProfileResource','sendStatus','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','pick','filter','merge'];(function(_0x154088,_0x20db2a){var _0x987f13=function(_0x2d4a61){while(--_0x2d4a61){_0x154088['push'](_0x154088['shift']());}};_0x987f13(++_0x20db2a);}(_0x6ff1,0x10a));var _0x16ff=function(_0x52c6f3,_0x513814){_0x52c6f3=_0x52c6f3-0x0;var _0x6d8938=_0x6ff1[_0x52c6f3];return _0x6d8938;};'use strict';var emlformat=require(_0x16ff('0x0'));var rimraf=require(_0x16ff('0x1'));var zipdir=require(_0x16ff('0x2'));var jsonpatch=require(_0x16ff('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x16ff('0x4'));var Mustache=require('mustache');var util=require(_0x16ff('0x5'));var path=require(_0x16ff('0x6'));var sox=require(_0x16ff('0x7'));var csv=require(_0x16ff('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x16ff('0x9'));var jsforce=require(_0x16ff('0xa'));var deskjs=require(_0x16ff('0xb'));var toCsv=require(_0x16ff('0x8'));var querystring=require(_0x16ff('0xc'));var Papa=require(_0x16ff('0xd'));var Redis=require(_0x16ff('0xe'));var authService=require(_0x16ff('0xf'));var qs=require(_0x16ff('0x10'));var as=require(_0x16ff('0x11'));var hardwareService=require(_0x16ff('0x12'));var logger=require(_0x16ff('0x13'))(_0x16ff('0x14'));var utils=require(_0x16ff('0x15'));var config=require(_0x16ff('0x16'));var licenseUtil=require(_0x16ff('0x17'));var db=require(_0x16ff('0x18'))['db'];function respondWithStatusCode(_0x1da947,_0x217189){_0x217189=_0x217189||0xcc;return function(_0x3f0744){if(_0x3f0744){return _0x1da947['sendStatus'](_0x217189);}return _0x1da947['status'](_0x217189)[_0x16ff('0x19')]();};}function respondWithResult(_0x4351cb,_0x358da3){_0x358da3=_0x358da3||0xc8;return function(_0x30bfc2){if(_0x30bfc2){return _0x4351cb[_0x16ff('0x1a')](_0x358da3)[_0x16ff('0x1b')](_0x30bfc2);}};}function respondWithFilteredResult(_0x4dd6ba,_0x769a85){return function(_0x14b622){if(_0x14b622){var _0xc2043d=typeof _0x769a85['offset']===_0x16ff('0x1c')&&typeof _0x769a85[_0x16ff('0x1d')]===_0x16ff('0x1c');var _0x4950ef=_0x14b622[_0x16ff('0x1e')];var _0x45bc78=_0xc2043d?0x0:_0x769a85['offset'];var _0x18045f=_0xc2043d?_0x14b622['count']:_0x769a85[_0x16ff('0x1f')]+_0x769a85['limit'];var _0xe0d67c;if(_0x18045f>=_0x4950ef){_0x18045f=_0x4950ef;_0xe0d67c=0xc8;}else{_0xe0d67c=0xce;}_0x4dd6ba[_0x16ff('0x1a')](_0xe0d67c);return _0x4dd6ba[_0x16ff('0x20')](_0x16ff('0x21'),_0x45bc78+'-'+_0x18045f+'/'+_0x4950ef)[_0x16ff('0x1b')](_0x14b622);}return null;};}function patchUpdates(_0x5cf9d1){return function(_0x69964d){try{jsonpatch['apply'](_0x69964d,_0x5cf9d1,!![]);}catch(_0x28961a){return BPromise[_0x16ff('0x22')](_0x28961a);}return _0x69964d[_0x16ff('0x23')]();};}function saveUpdates(_0x5a6d82,_0x43a001){return function(_0x249db2){if(_0x249db2){return _0x249db2[_0x16ff('0x24')](_0x5a6d82)[_0x16ff('0x25')](function(_0x36faad){return _0x36faad;});}return null;};}function removeEntity(_0x3014da,_0x42a5c7){return function(_0x20ee7b){if(_0x20ee7b){return _0x20ee7b[_0x16ff('0x26')]()[_0x16ff('0x25')](function(){var _0x3f241e=_0x20ee7b['get']({'plain':!![]});var _0x28ed5e='ChanSpies';return db[_0x16ff('0x27')][_0x16ff('0x26')]({'where':{'type':_0x28ed5e,'resourceId':_0x3f241e['id']}})['then'](function(){return _0x20ee7b;});})[_0x16ff('0x25')](function(){_0x3014da[_0x16ff('0x1a')](0xcc)[_0x16ff('0x19')]();});}};}function handleEntityNotFound(_0x239a18,_0x56d00b){return function(_0x3ff65c){if(!_0x3ff65c){_0x239a18[_0x16ff('0x28')](0x194);}return _0x3ff65c;};}function handleError(_0x5a6e5f,_0x26699b){_0x26699b=_0x26699b||0x1f4;return function(_0x151428){logger[_0x16ff('0x29')](_0x151428[_0x16ff('0x2a')]);if(_0x151428[_0x16ff('0x2b')]){delete _0x151428[_0x16ff('0x2b')];}_0x5a6e5f['status'](_0x26699b)[_0x16ff('0x2c')](_0x151428);};}exports[_0x16ff('0x2d')]=function(_0x2e08d7,_0x160a6d){var _0x37bc70={},_0xa25e39={},_0x1b5047={'count':0x0,'rows':[]};var _0x5a32f7=_['map'](db['VoiceChanSpy'][_0x16ff('0x2e')],function(_0xb51097){return{'name':_0xb51097[_0x16ff('0x2f')],'type':_0xb51097[_0x16ff('0x30')][_0x16ff('0x31')]};});_0xa25e39[_0x16ff('0x32')]=_[_0x16ff('0x33')](_0x5a32f7,_0x16ff('0x2b'));_0xa25e39[_0x16ff('0x34')]=_[_0x16ff('0x35')](_0x2e08d7['query']);_0xa25e39[_0x16ff('0x36')]=_[_0x16ff('0x37')](_0xa25e39[_0x16ff('0x32')],_0xa25e39['query']);_0x37bc70['attributes']=_['intersection'](_0xa25e39[_0x16ff('0x32')],qs[_0x16ff('0x38')](_0x2e08d7[_0x16ff('0x34')][_0x16ff('0x38')]));_0x37bc70[_0x16ff('0x39')]=_0x37bc70['attributes'][_0x16ff('0x3a')]?_0x37bc70[_0x16ff('0x39')]:_0xa25e39['model'];if(!_0x2e08d7['query'][_0x16ff('0x3b')](_0x16ff('0x3c'))){_0x37bc70[_0x16ff('0x1d')]=qs[_0x16ff('0x1d')](_0x2e08d7[_0x16ff('0x34')]['limit']);_0x37bc70[_0x16ff('0x1f')]=qs[_0x16ff('0x1f')](_0x2e08d7[_0x16ff('0x34')]['offset']);}_0x37bc70[_0x16ff('0x3d')]=qs['sort'](_0x2e08d7[_0x16ff('0x34')]['sort']);_0x37bc70[_0x16ff('0x3e')]=qs[_0x16ff('0x36')](_[_0x16ff('0x3f')](_0x2e08d7[_0x16ff('0x34')],_0xa25e39[_0x16ff('0x36')]),_0x5a32f7);if(_0x2e08d7[_0x16ff('0x34')][_0x16ff('0x40')]){_0x37bc70[_0x16ff('0x3e')]=_['merge'](_0x37bc70[_0x16ff('0x3e')],{'$or':_['map'](_0x5a32f7,function(_0x52c3c7){if(_0x52c3c7['type']!=='VIRTUAL'){var _0x1b2a1f={};_0x1b2a1f[_0x52c3c7[_0x16ff('0x2b')]]={'$like':'%'+_0x2e08d7[_0x16ff('0x34')]['filter']+'%'};return _0x1b2a1f;}})});}_0x37bc70=_[_0x16ff('0x41')]({},_0x37bc70,_0x2e08d7[_0x16ff('0x42')]);var _0x4cffe7={'where':_0x37bc70[_0x16ff('0x3e')]};return db[_0x16ff('0x43')][_0x16ff('0x1e')](_0x4cffe7)[_0x16ff('0x25')](function(_0x3d6492){_0x1b5047[_0x16ff('0x1e')]=_0x3d6492;if(_0x2e08d7[_0x16ff('0x34')][_0x16ff('0x44')]){_0x37bc70[_0x16ff('0x45')]=[{'all':!![]}];}return db[_0x16ff('0x43')][_0x16ff('0x46')](_0x37bc70);})[_0x16ff('0x25')](function(_0x120a49){_0x1b5047[_0x16ff('0x47')]=_0x120a49;return _0x1b5047;})['then'](respondWithFilteredResult(_0x160a6d,_0x37bc70))['catch'](handleError(_0x160a6d,null));};exports['show']=function(_0x169527,_0x2c4d5b){var _0x36444f={'raw':![],'where':{'id':_0x169527[_0x16ff('0x48')]['id']}},_0x12e2ec={};_0x12e2ec[_0x16ff('0x32')]=_['keys'](db[_0x16ff('0x43')][_0x16ff('0x2e')]);_0x12e2ec[_0x16ff('0x34')]=_[_0x16ff('0x35')](_0x169527[_0x16ff('0x34')]);_0x12e2ec[_0x16ff('0x36')]=_[_0x16ff('0x37')](_0x12e2ec[_0x16ff('0x32')],_0x12e2ec[_0x16ff('0x34')]);_0x36444f['attributes']=_[_0x16ff('0x37')](_0x12e2ec['model'],qs[_0x16ff('0x38')](_0x169527['query'][_0x16ff('0x38')]));_0x36444f[_0x16ff('0x39')]=_0x36444f[_0x16ff('0x39')][_0x16ff('0x3a')]?_0x36444f[_0x16ff('0x39')]:_0x12e2ec[_0x16ff('0x32')];if(_0x169527['query'][_0x16ff('0x44')]){_0x36444f[_0x16ff('0x45')]=[{'all':!![]}];}_0x36444f=_[_0x16ff('0x41')]({},_0x36444f,_0x169527['options']);return db[_0x16ff('0x43')][_0x16ff('0x49')](_0x36444f)['then'](handleEntityNotFound(_0x2c4d5b,null))[_0x16ff('0x25')](respondWithResult(_0x2c4d5b,null))[_0x16ff('0x4a')](handleError(_0x2c4d5b,null));};exports[_0x16ff('0x4b')]=function(_0x2308bf,_0x3d52c1){return db[_0x16ff('0x43')][_0x16ff('0x4b')](_0x2308bf[_0x16ff('0x4c')],{})[_0x16ff('0x25')](function(_0x452c0f){var _0xa89d59=_0x2308bf['user'][_0x16ff('0x4d')]({'plain':!![]});if(!_0xa89d59)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xa89d59[_0x16ff('0x4e')]===_0x16ff('0x4f')){var _0x4e4714=_0x452c0f[_0x16ff('0x4d')]({'plain':!![]});var _0x13faec=_0x16ff('0x50');return db[_0x16ff('0x51')][_0x16ff('0x49')]({'where':{'name':_0x13faec,'userProfileId':_0xa89d59[_0x16ff('0x52')]},'raw':!![]})[_0x16ff('0x25')](function(_0x95f460){if(_0x95f460&&_0x95f460['autoAssociation']===0x0){return db[_0x16ff('0x27')]['create']({'name':_0x4e4714[_0x16ff('0x2b')],'resourceId':_0x4e4714['id'],'type':_0x95f460['name'],'sectionId':_0x95f460['id']},{})['then'](function(){return _0x452c0f;});}else{return _0x452c0f;}})['catch'](function(_0x3a7df8){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3a7df8);throw _0x3a7df8;});}return _0x452c0f;})[_0x16ff('0x25')](respondWithResult(_0x3d52c1,0xc9))[_0x16ff('0x4a')](handleError(_0x3d52c1,null));};exports[_0x16ff('0x24')]=function(_0x567ce7,_0x898e51){if(_0x567ce7[_0x16ff('0x4c')]['id']){delete _0x567ce7['body']['id'];}return db[_0x16ff('0x43')][_0x16ff('0x49')]({'where':{'id':_0x567ce7['params']['id']}})[_0x16ff('0x25')](handleEntityNotFound(_0x898e51,null))[_0x16ff('0x25')](saveUpdates(_0x567ce7[_0x16ff('0x4c')],null))[_0x16ff('0x25')](respondWithResult(_0x898e51,null))[_0x16ff('0x4a')](handleError(_0x898e51,null));};exports[_0x16ff('0x26')]=function(_0x3c388a,_0x544cb3){return db[_0x16ff('0x43')][_0x16ff('0x49')]({'where':{'id':_0x3c388a[_0x16ff('0x48')]['id']}})[_0x16ff('0x25')](handleEntityNotFound(_0x544cb3,null))[_0x16ff('0x25')](removeEntity(_0x544cb3,null))[_0x16ff('0x4a')](handleError(_0x544cb3,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index f19f964..cba0b5d 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 _0x7399=['util','bluebird','./voiceChanSpy.attributes','from-sip','%s%s','prefix','push','merge','Set','format','CDR(type)=%s','chanspy','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','Authenticate','ChanSpy','SIP/%s,%s','name','options','join','record','length','internal','concat','User','findAll','agent','then','catch','models','define','VoiceChanSpy','VoiceExtension','bulkCreate','lodash'];(function(_0x383f90,_0x42edf5){var _0x101752=function(_0x2669c9){while(--_0x2669c9){_0x383f90['push'](_0x383f90['shift']());}};_0x101752(++_0x42edf5);}(_0x7399,0x18b));var _0x9739=function(_0x1dc5a7,_0x448a9f){_0x1dc5a7=_0x1dc5a7-0x0;var _0x4b3f3e=_0x7399[_0x1dc5a7];return _0x4b3f3e;};'use strict';var _=require(_0x9739('0x0'));var util=require(_0x9739('0x1'));var BPromise=require(_0x9739('0x2'));var attributes=require(_0x9739('0x3'));var getUserApplications=function(_0x41504d,_0x162e5a,_0x5cc461){var _0x2e9728=0x1;var _0x11b44d=[];var _0x4b598d={'context':_0x162e5a['context']||_0x9739('0x4'),'exten':util['format'](_0x9739('0x5'),_0x41504d[_0x9739('0x6')],_0x5cc461),'type':'system','isApp':![],'ChanSpyId':_0x41504d['id'],'UserId':_0x162e5a['id']};_0x11b44d[_0x9739('0x7')](_[_0x9739('0x8')]({'app':_0x9739('0x9'),'appdata':util[_0x9739('0xa')](_0x9739('0xb'),_0x9739('0xc')),'priority':_0x2e9728++},_0x4b598d));if(_0x41504d['record']){_0x11b44d[_0x9739('0x7')](_['merge']({'app':_0x9739('0xd'),'appdata':util[_0x9739('0xa')](_0x9739('0xe'),_0x41504d[_0x9739('0xf')]),'priority':_0x2e9728++},_0x4b598d));}if(_0x41504d['auth']){_0x11b44d[_0x9739('0x7')](_[_0x9739('0x8')]({'app':_0x9739('0x10'),'appdata':_0x41504d['password'],'priority':_0x2e9728++},_0x4b598d));}_0x11b44d[_0x9739('0x7')](_[_0x9739('0x8')]({'app':_0x9739('0x11'),'appdata':util[_0x9739('0xa')](_0x9739('0x12'),_0x162e5a[_0x9739('0x13')],_0x41504d[_0x9739('0x14')]?_0x41504d[_0x9739('0x14')][_0x9739('0x15')](''):''),'priority':_0x2e9728++},_0x4b598d));if(_0x41504d[_0x9739('0x16')]){_0x11b44d[_0x9739('0x7')](_[_0x9739('0x8')]({'app':'StopMixMonitor','priority':_0x2e9728++},_0x4b598d));}return _0x11b44d;};var getChanSpyApplications=function(_0x3da1ae,_0x38ee44){var _0x52d1bc=[];for(var _0x4b8605=0x0,_0x3e4132=0x1;_0x4b8605<_0x38ee44[_0x9739('0x17')];_0x4b8605++,_0x3e4132=0x1){_0x52d1bc=_0x52d1bc['concat'](getUserApplications(_0x3da1ae,_0x38ee44[_0x4b8605],_0x38ee44[_0x4b8605][_0x9739('0x18')]));if(_0x38ee44[_0x4b8605][_0x9739('0x18')]!=_0x38ee44[_0x4b8605]['name']){_0x52d1bc=_0x52d1bc[_0x9739('0x19')](getUserApplications(_0x3da1ae,_0x38ee44[_0x4b8605],_0x38ee44[_0x4b8605][_0x9739('0x13')]));}}return _0x52d1bc;};var getChanSpyPromise=function(_0x247730,_0x39f33c){return new BPromise(function(_0x5efc4f,_0x5beb02){return _0x247730[_0x9739('0x1a')][_0x9739('0x1b')]({'attributes':['id','name',_0x9739('0x18')],'where':{'role':_0x9739('0x1c'),'chanspy':!![]},'raw':!![]})[_0x9739('0x1d')](function(_0xeb72fa){if(_0xeb72fa){return _0x5efc4f(getChanSpyApplications(_0x39f33c,_0xeb72fa));}return _0x5efc4f([]);})[_0x9739('0x1e')](function(_0x1c1f90){_0x5beb02(_0x1c1f90);});});};module['exports']=function(_0x1fba06,_0x43633e){var _0x4d033e=_0x1fba06[_0x9739('0x1f')];return _0x1fba06[_0x9739('0x20')](_0x9739('0x21'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x4054a4,_0x4c7e29,_0x4d9af9){return getChanSpyPromise(_0x4d033e,_0x4054a4)[_0x9739('0x1d')](function(_0x1b08db){if(_0x1b08db&&_0x1b08db[_0x9739('0x17')]){return _0x4d033e[_0x9739('0x22')][_0x9739('0x23')](_0x1b08db);}})['then'](function(){_0x4d9af9();})['catch'](function(_0x29c858){_0x4d9af9(_0x29c858);});},'afterUpdate':function(_0x3c823c,_0x13e6eb,_0x1cc8a9){return _0x4d033e[_0x9739('0x22')]['destroy']({'where':{'ChanSpyId':_0x3c823c['id']}})[_0x9739('0x1d')](function(){return getChanSpyPromise(_0x4d033e,_0x3c823c);})[_0x9739('0x1d')](function(_0x282ff6){if(_0x282ff6&&_0x282ff6[_0x9739('0x17')]){return _0x4d033e[_0x9739('0x22')][_0x9739('0x23')](_0x282ff6);}})[_0x9739('0x1d')](function(){_0x1cc8a9();})['catch'](function(_0x338a0f){_0x1cc8a9(_0x338a0f);});},'afterDestroy':function(_0xef00df,_0x37bf43,_0xdb0aaf){return _0x4d033e[_0x9739('0x22')]['destroy']({'where':{'ChanSpyId':_0xef00df['id']}})[_0x9739('0x1d')](function(){_0xdb0aaf();})[_0x9739('0x1e')](function(_0xf4bb4e){_0xdb0aaf(_0xf4bb4e);});}}});}; \ No newline at end of file +var _0x211c=['merge','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','password','push','SIP/%s,%s','options','join','record','StopMixMonitor','length','concat','internal','name','findAll','agent','then','catch','exports','models','define','bulkCreate','VoiceExtension','destroy','lodash','bluebird','./voiceChanSpy.attributes','context','from-sip','format','%s%s','prefix','system','CDR(type)=%s','chanspy'];(function(_0x59166d,_0x415c2d){var _0x2184e1=function(_0xb7af45){while(--_0xb7af45){_0x59166d['push'](_0x59166d['shift']());}};_0x2184e1(++_0x415c2d);}(_0x211c,0x1e3));var _0xc211=function(_0x2a7b9a,_0x5e7fe5){_0x2a7b9a=_0x2a7b9a-0x0;var _0x446fa0=_0x211c[_0x2a7b9a];return _0x446fa0;};'use strict';var _=require(_0xc211('0x0'));var util=require('util');var BPromise=require(_0xc211('0x1'));var attributes=require(_0xc211('0x2'));var getUserApplications=function(_0x17ad14,_0x429f76,_0x1d6d93){var _0x527a9f=0x1;var _0x64a43c=[];var _0x151bf7={'context':_0x429f76[_0xc211('0x3')]||_0xc211('0x4'),'exten':util[_0xc211('0x5')](_0xc211('0x6'),_0x17ad14[_0xc211('0x7')],_0x1d6d93),'type':_0xc211('0x8'),'isApp':![],'ChanSpyId':_0x17ad14['id'],'UserId':_0x429f76['id']};_0x64a43c['push'](_['merge']({'app':'Set','appdata':util['format'](_0xc211('0x9'),_0xc211('0xa')),'priority':_0x527a9f++},_0x151bf7));if(_0x17ad14['record']){_0x64a43c['push'](_[_0xc211('0xb')]({'app':_0xc211('0xc'),'appdata':util['format'](_0xc211('0xd'),_0x17ad14[_0xc211('0xe')]),'priority':_0x527a9f++},_0x151bf7));}if(_0x17ad14[_0xc211('0xf')]){_0x64a43c['push'](_[_0xc211('0xb')]({'app':_0xc211('0x10'),'appdata':_0x17ad14[_0xc211('0x11')],'priority':_0x527a9f++},_0x151bf7));}_0x64a43c[_0xc211('0x12')](_[_0xc211('0xb')]({'app':'ChanSpy','appdata':util[_0xc211('0x5')](_0xc211('0x13'),_0x429f76['name'],_0x17ad14['options']?_0x17ad14[_0xc211('0x14')][_0xc211('0x15')](''):''),'priority':_0x527a9f++},_0x151bf7));if(_0x17ad14[_0xc211('0x16')]){_0x64a43c[_0xc211('0x12')](_[_0xc211('0xb')]({'app':_0xc211('0x17'),'priority':_0x527a9f++},_0x151bf7));}return _0x64a43c;};var getChanSpyApplications=function(_0x311ec3,_0x9e1473){var _0x5ce98b=[];for(var _0x12ad46=0x0,_0x19f33e=0x1;_0x12ad46<_0x9e1473[_0xc211('0x18')];_0x12ad46++,_0x19f33e=0x1){_0x5ce98b=_0x5ce98b[_0xc211('0x19')](getUserApplications(_0x311ec3,_0x9e1473[_0x12ad46],_0x9e1473[_0x12ad46][_0xc211('0x1a')]));if(_0x9e1473[_0x12ad46][_0xc211('0x1a')]!=_0x9e1473[_0x12ad46]['name']){_0x5ce98b=_0x5ce98b[_0xc211('0x19')](getUserApplications(_0x311ec3,_0x9e1473[_0x12ad46],_0x9e1473[_0x12ad46][_0xc211('0x1b')]));}}return _0x5ce98b;};var getChanSpyPromise=function(_0x10f3a4,_0x37c9d4){return new BPromise(function(_0x88213e,_0x19d621){return _0x10f3a4['User'][_0xc211('0x1c')]({'attributes':['id',_0xc211('0x1b'),_0xc211('0x1a')],'where':{'role':_0xc211('0x1d'),'chanspy':!![]},'raw':!![]})[_0xc211('0x1e')](function(_0x4601bc){if(_0x4601bc){return _0x88213e(getChanSpyApplications(_0x37c9d4,_0x4601bc));}return _0x88213e([]);})[_0xc211('0x1f')](function(_0x476345){_0x19d621(_0x476345);});});};module[_0xc211('0x20')]=function(_0x2973f5,_0x147fb2){var _0x4f4d2e=_0x2973f5[_0xc211('0x21')];return _0x2973f5[_0xc211('0x22')]('VoiceChanSpy',attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0xd70678,_0x92a2c0,_0x46923d){return getChanSpyPromise(_0x4f4d2e,_0xd70678)[_0xc211('0x1e')](function(_0xbec80f){if(_0xbec80f&&_0xbec80f[_0xc211('0x18')]){return _0x4f4d2e['VoiceExtension'][_0xc211('0x23')](_0xbec80f);}})[_0xc211('0x1e')](function(){_0x46923d();})[_0xc211('0x1f')](function(_0x1048c8){_0x46923d(_0x1048c8);});},'afterUpdate':function(_0x4d7761,_0x32a397,_0x5262f3){return _0x4f4d2e[_0xc211('0x24')][_0xc211('0x25')]({'where':{'ChanSpyId':_0x4d7761['id']}})[_0xc211('0x1e')](function(){return getChanSpyPromise(_0x4f4d2e,_0x4d7761);})[_0xc211('0x1e')](function(_0x1e1fa5){if(_0x1e1fa5&&_0x1e1fa5[_0xc211('0x18')]){return _0x4f4d2e[_0xc211('0x24')]['bulkCreate'](_0x1e1fa5);}})[_0xc211('0x1e')](function(){_0x5262f3();})['catch'](function(_0x306ff9){_0x5262f3(_0x306ff9);});},'afterDestroy':function(_0x5e9ba4,_0x530c2f,_0x1cc023){return _0x4f4d2e['VoiceExtension'][_0xc211('0x25')]({'where':{'ChanSpyId':_0x5e9ba4['id']}})[_0xc211('0x1e')](function(){_0x1cc023();})['catch'](function(_0x10c412){_0x1cc023(_0x10c412);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index c1db481..4b7908f 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 _0x6308=['stringify','error','code','message','catch','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6308,0x1f2));var _0x8630=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x6308[_0x1035c1];return _0x308d67;};'use strict';var _=require(_0x8630('0x0'));var util=require('util');var moment=require(_0x8630('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8630('0x2'));var db=require(_0x8630('0x3'))['db'];var utils=require(_0x8630('0x4'));var logger=require(_0x8630('0x5'))(_0x8630('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8630('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x337086,_0x3d5a10,_0x1bcfea){return new BPromise(function(_0x2b87ea,_0x10cc17){return client[_0x8630('0x8')](_0x337086,_0x1bcfea)['then'](function(_0x8b3652){logger['info'](_0x8630('0x9'),_0x3d5a10,_0x8630('0xa'));logger[_0x8630('0xb')]('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x3d5a10,_0x8630('0xa'),JSON[_0x8630('0xc')](_0x8b3652));if(_0x8b3652[_0x8630('0xd')]){if(_0x8b3652['error'][_0x8630('0xe')]===0x1f4){logger[_0x8630('0xd')]('VoiceChanSpy,\x20%s,\x20%s',_0x3d5a10,_0x8b3652['error'][_0x8630('0xf')]);return _0x10cc17(_0x8b3652[_0x8630('0xd')]['message']);}logger[_0x8630('0xd')]('VoiceChanSpy,\x20%s,\x20%s',_0x3d5a10,_0x8b3652[_0x8630('0xd')]['message']);return _0x2b87ea(_0x8b3652[_0x8630('0xd')]['message']);}else{logger['info'](_0x8630('0x9'),_0x3d5a10,_0x8630('0xa'));_0x2b87ea(_0x8b3652['result']['message']);}})[_0x8630('0x10')](function(_0x547667){logger[_0x8630('0xd')](_0x8630('0x9'),_0x3d5a10,_0x547667);_0x10cc17(_0x547667);});});} \ No newline at end of file +var _0xbfcc=['VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','bluebird','randomstring','ioredis','../../mysqldb','jayson/promise','client','request','info'];(function(_0x35b142,_0x4e5e6d){var _0x49dc32=function(_0x39a17d){while(--_0x39a17d){_0x35b142['push'](_0x35b142['shift']());}};_0x49dc32(++_0x4e5e6d);}(_0xbfcc,0x1dd));var _0xcbfc=function(_0x142020,_0x1f7233){_0x142020=_0x142020-0x0;var _0x40da8f=_0xbfcc[_0x142020];return _0x40da8f;};'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')]('VoiceChanSpy,\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);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index d2c4e30..7c91efd 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 _0x8947=['../../components/auth/service','../../components/interaction/service','./voiceContext.controller','get','index','/:id','isAuthenticated','show','post','put','update','destroy','multer','util','path','express','fs-extra'];(function(_0xfdb710,_0x371155){var _0xea2e98=function(_0x50fa64){while(--_0x50fa64){_0xfdb710['push'](_0xfdb710['shift']());}};_0xea2e98(++_0x371155);}(_0x8947,0x12d));var _0x7894=function(_0x2d4686,_0x3d6dbb){_0x2d4686=_0x2d4686-0x0;var _0x16f68b=_0x8947[_0x2d4686];return _0x16f68b;};'use strict';var multer=require(_0x7894('0x0'));var util=require(_0x7894('0x1'));var path=require(_0x7894('0x2'));var timeout=require('connect-timeout');var express=require(_0x7894('0x3'));var router=express['Router']();var fs_extra=require(_0x7894('0x4'));var auth=require(_0x7894('0x5'));var interaction=require(_0x7894('0x6'));var config=require('../../config/environment');var controller=require(_0x7894('0x7'));router[_0x7894('0x8')]('/',auth['isAuthenticated'](),controller[_0x7894('0x9')]);router[_0x7894('0x8')](_0x7894('0xa'),auth[_0x7894('0xb')](),controller[_0x7894('0xc')]);router[_0x7894('0xd')]('/',auth[_0x7894('0xb')](),controller['create']);router[_0x7894('0xe')](_0x7894('0xa'),auth['isAuthenticated'](),controller[_0x7894('0xf')]);router['delete'](_0x7894('0xa'),auth[_0x7894('0xb')](),controller[_0x7894('0x10')]);module['exports']=router; \ No newline at end of file +var _0x0bb0=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','/:id','post','create','put','delete','destroy'];(function(_0x43f8fd,_0x46a1d7){var _0x4cd740=function(_0x448997){while(--_0x448997){_0x43f8fd['push'](_0x43f8fd['shift']());}};_0x4cd740(++_0x46a1d7);}(_0x0bb0,0x1c3));var _0x00bb=function(_0x4107c8,_0x473d29){_0x4107c8=_0x4107c8-0x0;var _0x30dec7=_0x0bb0[_0x4107c8];return _0x30dec7;};'use strict';var multer=require(_0x00bb('0x0'));var util=require(_0x00bb('0x1'));var path=require(_0x00bb('0x2'));var timeout=require(_0x00bb('0x3'));var express=require(_0x00bb('0x4'));var router=express[_0x00bb('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x00bb('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x00bb('0x7'));var controller=require(_0x00bb('0x8'));router[_0x00bb('0x9')]('/',auth[_0x00bb('0xa')](),controller['index']);router[_0x00bb('0x9')](_0x00bb('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x00bb('0xc')]('/',auth[_0x00bb('0xa')](),controller[_0x00bb('0xd')]);router[_0x00bb('0xe')](_0x00bb('0xb'),auth[_0x00bb('0xa')](),controller['update']);router[_0x00bb('0xf')](_0x00bb('0xb'),auth[_0x00bb('0xa')](),controller[_0x00bb('0x10')]);module[_0x00bb('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index a0729e6..15785c6 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 _0x6ed4=['exports','STRING','name','BOOLEAN','sequelize'];(function(_0x288052,_0x13b409){var _0x4300c2=function(_0x4707b0){while(--_0x4707b0){_0x288052['push'](_0x288052['shift']());}};_0x4300c2(++_0x13b409);}(_0x6ed4,0x14e));var _0x46ed=function(_0x40f37f,_0x315c73){_0x40f37f=_0x40f37f-0x0;var _0x4171f0=_0x6ed4[_0x40f37f];return _0x4171f0;};'use strict';var Sequelize=require(_0x46ed('0x0'));module[_0x46ed('0x1')]={'name':{'type':Sequelize[_0x46ed('0x2')],'unique':_0x46ed('0x3')},'description':{'type':Sequelize[_0x46ed('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x46ed('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0176=['name','BOOLEAN','exports','STRING'];(function(_0x952708,_0x4fd8e0){var _0x17724f=function(_0x1616a7){while(--_0x1616a7){_0x952708['push'](_0x952708['shift']());}};_0x17724f(++_0x4fd8e0);}(_0x0176,0x1ae));var _0x6017=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x0176[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require('sequelize');module[_0x6017('0x0')]={'name':{'type':Sequelize[_0x6017('0x1')],'unique':_0x6017('0x2')},'description':{'type':Sequelize[_0x6017('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x6017('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 ef04b0a..aa33164 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 _0x010d=['utf8','render','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','readFileSync','writeFileSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','destroy','Contexts','UserProfileResource','stack','name','send','index','map','VoiceContext','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','length','create','body','join','root','server/files/templates/context.ejs'];(function(_0x17e8d2,_0x53c4b7){var _0x1ab05d=function(_0x561531){while(--_0x561531){_0x17e8d2['push'](_0x17e8d2['shift']());}};_0x1ab05d(++_0x53c4b7);}(_0x010d,0x1ba));var _0xd010=function(_0x2f0ae4,_0x157cd7){_0x2f0ae4=_0x2f0ae4-0x0;var _0x10b965=_0x010d[_0x2f0ae4];return _0x10b965;};'use strict';var emlformat=require(_0xd010('0x0'));var rimraf=require(_0xd010('0x1'));var zipdir=require(_0xd010('0x2'));var jsonpatch=require(_0xd010('0x3'));var rp=require(_0xd010('0x4'));var moment=require('moment');var BPromise=require(_0xd010('0x5'));var Mustache=require('mustache');var util=require(_0xd010('0x6'));var path=require(_0xd010('0x7'));var sox=require(_0xd010('0x8'));var csv=require(_0xd010('0x9'));var ejs=require(_0xd010('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd010('0xb'));var squel=require(_0xd010('0xc'));var crypto=require(_0xd010('0xd'));var jsforce=require(_0xd010('0xe'));var deskjs=require(_0xd010('0xf'));var toCsv=require(_0xd010('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd010('0x10'));var qs=require(_0xd010('0x11'));var as=require(_0xd010('0x12'));var hardwareService=require(_0xd010('0x13'));var logger=require(_0xd010('0x14'))(_0xd010('0x15'));var utils=require(_0xd010('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xd010('0x17'));var db=require(_0xd010('0x18'))['db'];var jayson=require(_0xd010('0x19'));var client=jayson['client'][_0xd010('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x29f20a,_0x53036a,_0x26ce48,_0x19e903){return new BPromise(function(_0x16d51b,_0x1625c8){var _0x1ef6d2=_0x19e903||client;return _0x1ef6d2[_0xd010('0x1b')](_0x29f20a,_0x26ce48)[_0xd010('0x1c')](function(_0x36f4ac){logger[_0xd010('0x1d')](_0xd010('0x1e'),_0x53036a,_0xd010('0x1f'));logger[_0xd010('0x20')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x53036a,_0xd010('0x1f'),JSON[_0xd010('0x21')](_0x36f4ac));if(_0x36f4ac[_0xd010('0x22')]){if(_0x36f4ac[_0xd010('0x22')][_0xd010('0x23')]===0x1f4){logger[_0xd010('0x22')](_0xd010('0x1e'),_0x53036a,_0x36f4ac[_0xd010('0x22')]['message']);return _0x1625c8(_0x36f4ac[_0xd010('0x22')][_0xd010('0x24')]);}logger['error'](_0xd010('0x1e'),_0x53036a,_0x36f4ac[_0xd010('0x22')][_0xd010('0x24')]);return _0x16d51b(_0x36f4ac[_0xd010('0x22')]['message']);}else{logger['info'](_0xd010('0x1e'),_0x53036a,_0xd010('0x1f'));_0x16d51b(_0x36f4ac[_0xd010('0x25')][_0xd010('0x24')]);}})['catch'](function(_0x2c1481){logger[_0xd010('0x22')](_0xd010('0x1e'),_0x53036a,_0x2c1481);_0x1625c8(_0x2c1481);});});}function respondWithStatusCode(_0x4a8b46,_0x2a0ccc){_0x2a0ccc=_0x2a0ccc||0xcc;return function(_0x430af5){if(_0x430af5){return _0x4a8b46[_0xd010('0x26')](_0x2a0ccc);}return _0x4a8b46[_0xd010('0x27')](_0x2a0ccc)[_0xd010('0x28')]();};}function respondWithResult(_0x2b01e3,_0x5d56c0){_0x5d56c0=_0x5d56c0||0xc8;return function(_0x593efc){if(_0x593efc){return _0x2b01e3[_0xd010('0x27')](_0x5d56c0)[_0xd010('0x29')](_0x593efc);}};}function respondWithFilteredResult(_0x40afe5,_0xb9787e){return function(_0x45f18f){if(_0x45f18f){var _0x146b23=typeof _0xb9787e[_0xd010('0x2a')]===_0xd010('0x2b')&&typeof _0xb9787e['limit']===_0xd010('0x2b');var _0x274d21=_0x45f18f[_0xd010('0x2c')];var _0x39200d=_0x146b23?0x0:_0xb9787e[_0xd010('0x2a')];var _0x245cc6=_0x146b23?_0x45f18f[_0xd010('0x2c')]:_0xb9787e[_0xd010('0x2a')]+_0xb9787e['limit'];var _0x33e1e2;if(_0x245cc6>=_0x274d21){_0x245cc6=_0x274d21;_0x33e1e2=0xc8;}else{_0x33e1e2=0xce;}_0x40afe5[_0xd010('0x27')](_0x33e1e2);return _0x40afe5[_0xd010('0x2d')](_0xd010('0x2e'),_0x39200d+'-'+_0x245cc6+'/'+_0x274d21)[_0xd010('0x29')](_0x45f18f);}return null;};}function patchUpdates(_0x9bfa1c){return function(_0x211043){try{jsonpatch[_0xd010('0x2f')](_0x211043,_0x9bfa1c,!![]);}catch(_0x5b218f){return BPromise[_0xd010('0x30')](_0x5b218f);}return _0x211043[_0xd010('0x31')]();};}function saveUpdates(_0x37aa84,_0x38d10a){return function(_0x3642c3){if(_0x3642c3){return _0x3642c3[_0xd010('0x32')](_0x37aa84)[_0xd010('0x1c')](function(_0x1c8fed){return _0x1c8fed;});}return null;};}function removeEntity(_0x2c82b8,_0x1ad39f){return function(_0x14d556){if(_0x14d556){return _0x14d556[_0xd010('0x33')]()[_0xd010('0x1c')](function(){var _0x30d04d=_0x14d556['get']({'plain':!![]});var _0x12e70a=_0xd010('0x34');return db[_0xd010('0x35')]['destroy']({'where':{'type':_0x12e70a,'resourceId':_0x30d04d['id']}})['then'](function(){return _0x14d556;});})['then'](function(){_0x2c82b8[_0xd010('0x27')](0xcc)[_0xd010('0x28')]();});}};}function handleEntityNotFound(_0x25c38b,_0x25bbd2){return function(_0x308680){if(!_0x308680){_0x25c38b[_0xd010('0x26')](0x194);}return _0x308680;};}function handleError(_0x5e49c6,_0xa73302){_0xa73302=_0xa73302||0x1f4;return function(_0x21e7ef){logger[_0xd010('0x22')](_0x21e7ef[_0xd010('0x36')]);if(_0x21e7ef['name']){delete _0x21e7ef[_0xd010('0x37')];}_0x5e49c6[_0xd010('0x27')](_0xa73302)[_0xd010('0x38')](_0x21e7ef);};}exports[_0xd010('0x39')]=function(_0x4a17f3,_0x2a9d9e){var _0x67aee3={},_0x1a20f={},_0x76e234={'count':0x0,'rows':[]};var _0x43845b=_[_0xd010('0x3a')](db[_0xd010('0x3b')][_0xd010('0x3c')],function(_0xd8d2e6){return{'name':_0xd8d2e6[_0xd010('0x3d')],'type':_0xd8d2e6[_0xd010('0x3e')][_0xd010('0x3f')]};});_0x1a20f[_0xd010('0x40')]=_[_0xd010('0x3a')](_0x43845b,_0xd010('0x37'));_0x1a20f[_0xd010('0x41')]=_[_0xd010('0x42')](_0x4a17f3[_0xd010('0x41')]);_0x1a20f[_0xd010('0x43')]=_[_0xd010('0x44')](_0x1a20f[_0xd010('0x40')],_0x1a20f['query']);_0x67aee3[_0xd010('0x45')]=_[_0xd010('0x44')](_0x1a20f['model'],qs[_0xd010('0x46')](_0x4a17f3['query']['fields']));_0x67aee3[_0xd010('0x45')]=_0x67aee3['attributes']['length']?_0x67aee3[_0xd010('0x45')]:_0x1a20f[_0xd010('0x40')];if(!_0x4a17f3['query'][_0xd010('0x47')](_0xd010('0x48'))){_0x67aee3[_0xd010('0x49')]=qs[_0xd010('0x49')](_0x4a17f3[_0xd010('0x41')][_0xd010('0x49')]);_0x67aee3[_0xd010('0x2a')]=qs['offset'](_0x4a17f3[_0xd010('0x41')][_0xd010('0x2a')]);}_0x67aee3['order']=qs[_0xd010('0x4a')](_0x4a17f3[_0xd010('0x41')]['sort']);_0x67aee3[_0xd010('0x4b')]=qs['filters'](_['pick'](_0x4a17f3[_0xd010('0x41')],_0x1a20f[_0xd010('0x43')]),_0x43845b);if(_0x4a17f3[_0xd010('0x41')][_0xd010('0x4c')]){_0x67aee3[_0xd010('0x4b')]=_['merge'](_0x67aee3[_0xd010('0x4b')],{'$or':_['map'](_0x43845b,function(_0x32e4f1){if(_0x32e4f1[_0xd010('0x3e')]!==_0xd010('0x4d')){var _0x1d2bf5={};_0x1d2bf5[_0x32e4f1['name']]={'$like':'%'+_0x4a17f3[_0xd010('0x41')][_0xd010('0x4c')]+'%'};return _0x1d2bf5;}})});}_0x67aee3=_[_0xd010('0x4e')]({},_0x67aee3,_0x4a17f3[_0xd010('0x4f')]);var _0x22ac10={'where':_0x67aee3[_0xd010('0x4b')]};return db[_0xd010('0x3b')][_0xd010('0x2c')](_0x22ac10)[_0xd010('0x1c')](function(_0x38200e){_0x76e234[_0xd010('0x2c')]=_0x38200e;if(_0x4a17f3[_0xd010('0x41')][_0xd010('0x50')]){_0x67aee3[_0xd010('0x51')]=[{'all':!![]}];}return db[_0xd010('0x3b')][_0xd010('0x52')](_0x67aee3);})[_0xd010('0x1c')](function(_0x45305d){_0x76e234[_0xd010('0x53')]=_0x45305d;return _0x76e234;})[_0xd010('0x1c')](respondWithFilteredResult(_0x2a9d9e,_0x67aee3))[_0xd010('0x54')](handleError(_0x2a9d9e,null));};exports[_0xd010('0x55')]=function(_0xf98b5a,_0xa5f5e7){var _0x165ba9={'raw':![],'where':{'id':_0xf98b5a[_0xd010('0x56')]['id']}},_0x39d893={};_0x39d893[_0xd010('0x40')]=_[_0xd010('0x42')](db['VoiceContext'][_0xd010('0x3c')]);_0x39d893['query']=_['keys'](_0xf98b5a[_0xd010('0x41')]);_0x39d893[_0xd010('0x43')]=_[_0xd010('0x44')](_0x39d893[_0xd010('0x40')],_0x39d893[_0xd010('0x41')]);_0x165ba9['attributes']=_[_0xd010('0x44')](_0x39d893[_0xd010('0x40')],qs[_0xd010('0x46')](_0xf98b5a[_0xd010('0x41')][_0xd010('0x46')]));_0x165ba9[_0xd010('0x45')]=_0x165ba9[_0xd010('0x45')][_0xd010('0x57')]?_0x165ba9[_0xd010('0x45')]:_0x39d893[_0xd010('0x40')];if(_0xf98b5a[_0xd010('0x41')]['includeAll']){_0x165ba9[_0xd010('0x51')]=[{'all':!![]}];}_0x165ba9=_['merge']({},_0x165ba9,_0xf98b5a[_0xd010('0x4f')]);return db[_0xd010('0x3b')]['find'](_0x165ba9)[_0xd010('0x1c')](handleEntityNotFound(_0xa5f5e7,null))[_0xd010('0x1c')](respondWithResult(_0xa5f5e7,null))['catch'](handleError(_0xa5f5e7,null));};exports[_0xd010('0x58')]=function(_0x308478,_0x1c648e,_0x4538f6){var _0x3926ad;return db['VoiceContext'][_0xd010('0x58')](_0x308478[_0xd010('0x59')],{'raw':!![]})[_0xd010('0x1c')](function(_0x4d1bc5){_0x3926ad=_0x4d1bc5;return db[_0xd010('0x3b')][_0xd010('0x52')]({'raw':!![]});})[_0xd010('0x1c')](function(_0x521684){var _0x50cdfc=fs['readFileSync'](path[_0xd010('0x5a')](config[_0xd010('0x5b')],_0xd010('0x5c')),_0xd010('0x5d'));var _0x11cc8b=ejs[_0xd010('0x5e')](_0x50cdfc,{'contexts':_0x521684||[]});fs['writeFileSync'](_0xd010('0x5f'),_0x11cc8b);})[_0xd010('0x1c')](function(){return respondWithRpcPromise(_0xd010('0x60'),_0xd010('0x58'),{'module':_0xd010('0x61')});})[_0xd010('0x1c')](function(){var _0x9d7b5c=_0x308478[_0xd010('0x62')][_0xd010('0x63')]({'plain':!![]});if(!_0x9d7b5c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x9d7b5c['role']==='user'){var _0x517fe2=_0x3926ad[_0xd010('0x63')]({'plain':!![]});return db[_0xd010('0x64')]['find']({'where':{'name':_0xd010('0x34'),'userProfileId':_0x9d7b5c[_0xd010('0x65')]},'raw':!![]})[_0xd010('0x1c')](function(_0x906f2f){if(_0x906f2f&&_0x906f2f[_0xd010('0x66')]===0x0){return db['UserProfileResource'][_0xd010('0x58')]({'name':_0x517fe2[_0xd010('0x37')],'resourceId':_0x517fe2['id'],'type':_0x906f2f['name'],'sectionId':_0x906f2f['id']},{})[_0xd010('0x1c')](function(){return _0x3926ad;});}else{return _0x3926ad;}})[_0xd010('0x54')](function(_0x20edf6){logger['error'](_0xd010('0x67'),_0x20edf6);throw _0x20edf6;});}return _0x3926ad;})['then'](respondWithResult(_0x1c648e,0xc9))[_0xd010('0x54')](handleError(_0x1c648e,null));};exports[_0xd010('0x32')]=function(_0x4cc8cc,_0x261bad,_0x2d0e3e){var _0x41c5d9;return db[_0xd010('0x3b')][_0xd010('0x68')]({'where':{'id':_0x4cc8cc['params']['id']}})['then'](handleEntityNotFound(_0x261bad,null))[_0xd010('0x1c')](saveUpdates(_0x4cc8cc['body'],null))['then'](function(_0x5555e8){if(_0x5555e8){_0x41c5d9=_0x5555e8;return db[_0xd010('0x3b')]['findAll']({'raw':!![]});}})[_0xd010('0x1c')](function(_0x19b119){var _0x131853=fs[_0xd010('0x69')](path[_0xd010('0x5a')](config['root'],'server/files/templates/context.ejs'),_0xd010('0x5d'));var _0x5d42d0=ejs[_0xd010('0x5e')](_0x131853,{'contexts':_0x19b119||[]});fs[_0xd010('0x6a')](_0xd010('0x5f'),_0x5d42d0);})['then'](function(){return respondWithRpcPromise(_0xd010('0x60'),_0xd010('0x32'),{'module':'chan_sip.so'});})['then'](function(){return _0x41c5d9;})[_0xd010('0x1c')](respondWithResult(_0x261bad,null))[_0xd010('0x54')](handleError(_0x261bad,null));};exports[_0xd010('0x33')]=function(_0x4b0968,_0x4df259,_0x1b6a7e){var _0x61beda;return db[_0xd010('0x3b')]['find']({'where':{'id':_0x4b0968[_0xd010('0x56')]['id']}})[_0xd010('0x1c')](handleEntityNotFound(_0x4df259,null))[_0xd010('0x1c')](removeEntity(_0x4df259,null))[_0xd010('0x1c')](function(){return db[_0xd010('0x3b')][_0xd010('0x52')]({'raw':!![]});})['then'](function(_0x361846){var _0x1ecad1=fs['readFileSync'](path['join'](config['root'],_0xd010('0x5c')),'utf8');var _0x3c05b5=ejs['render'](_0x1ecad1,{'contexts':_0x361846});fs[_0xd010('0x6a')](_0xd010('0x5f'),_0x3c05b5);return respondWithRpcPromise('Reload','destroy',{'module':_0xd010('0x61')});})[_0xd010('0x54')](handleError(_0x4df259,null));}; \ No newline at end of file +var _0xf405=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','findAll','utf8','chan_sip.so','eml-format','zip-dir','request-promise','moment','mustache','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','request','info','VoiceContext,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','status','undefined','limit','count','Content-Range','apply','save','update','then','get','Contexts','UserProfileResource','destroy','end','stack','name','index','rawAttributes','fieldName','type','key','map','keys','filters','intersection','model','query','fields','attributes','length','nolimit','offset','sort','merge','where','VIRTUAL','filter','options','VoiceContext','includeAll','include','rows','show','params','find','create','readFileSync','join','root','server/files/templates/context.ejs','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId'];(function(_0x96691d,_0x544a9d){var _0x5a79ca=function(_0x48421a){while(--_0x48421a){_0x96691d['push'](_0x96691d['shift']());}};_0x5a79ca(++_0x544a9d);}(_0xf405,0xc9));var _0x5f40=function(_0x4e00b7,_0x59e15a){_0x4e00b7=_0x4e00b7-0x0;var _0x297f6f=_0xf405[_0x4e00b7];return _0x297f6f;};'use strict';var emlformat=require(_0x5f40('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5f40('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5f40('0x2'));var moment=require(_0x5f40('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5f40('0x4'));var util=require('util');var path=require('path');var sox=require(_0x5f40('0x5'));var csv=require('to-csv');var ejs=require(_0x5f40('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5f40('0x7'));var squel=require(_0x5f40('0x8'));var crypto=require('crypto');var jsforce=require(_0x5f40('0x9'));var deskjs=require(_0x5f40('0xa'));var toCsv=require(_0x5f40('0xb'));var querystring=require(_0x5f40('0xc'));var Papa=require(_0x5f40('0xd'));var Redis=require(_0x5f40('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x5f40('0xf'));var as=require(_0x5f40('0x10'));var hardwareService=require(_0x5f40('0x11'));var logger=require('../../config/logger')(_0x5f40('0x12'));var utils=require(_0x5f40('0x13'));var config=require(_0x5f40('0x14'));var licenseUtil=require(_0x5f40('0x15'));var db=require(_0x5f40('0x16'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x5f40('0x17')]['http']({'port':0x232a});function respondWithRpcPromise(_0x19fcea,_0x1acde8,_0x5a20e1,_0x37ee8e){return new BPromise(function(_0x1205ae,_0x32e5c0){var _0x3e55aa=_0x37ee8e||client;return _0x3e55aa[_0x5f40('0x18')](_0x19fcea,_0x5a20e1)['then'](function(_0x2e6fce){logger[_0x5f40('0x19')](_0x5f40('0x1a'),_0x1acde8,'request\x20sent');logger['debug']('VoiceContext,\x20%s,\x20%s,\x20%s',_0x1acde8,_0x5f40('0x1b'),JSON[_0x5f40('0x1c')](_0x2e6fce));if(_0x2e6fce[_0x5f40('0x1d')]){if(_0x2e6fce[_0x5f40('0x1d')][_0x5f40('0x1e')]===0x1f4){logger['error'](_0x5f40('0x1a'),_0x1acde8,_0x2e6fce[_0x5f40('0x1d')][_0x5f40('0x1f')]);return _0x32e5c0(_0x2e6fce[_0x5f40('0x1d')][_0x5f40('0x1f')]);}logger[_0x5f40('0x1d')](_0x5f40('0x1a'),_0x1acde8,_0x2e6fce[_0x5f40('0x1d')]['message']);return _0x1205ae(_0x2e6fce[_0x5f40('0x1d')]['message']);}else{logger[_0x5f40('0x19')]('VoiceContext,\x20%s,\x20%s',_0x1acde8,_0x5f40('0x1b'));_0x1205ae(_0x2e6fce[_0x5f40('0x20')][_0x5f40('0x1f')]);}})[_0x5f40('0x21')](function(_0x402666){logger[_0x5f40('0x1d')](_0x5f40('0x1a'),_0x1acde8,_0x402666);_0x32e5c0(_0x402666);});});}function respondWithStatusCode(_0x556aa0,_0x2906e6){_0x2906e6=_0x2906e6||0xcc;return function(_0x16cd9e){if(_0x16cd9e){return _0x556aa0['sendStatus'](_0x2906e6);}return _0x556aa0[_0x5f40('0x22')](_0x2906e6)['end']();};}function respondWithResult(_0x13e26a,_0x455df9){_0x455df9=_0x455df9||0xc8;return function(_0x473bc9){if(_0x473bc9){return _0x13e26a[_0x5f40('0x22')](_0x455df9)['json'](_0x473bc9);}};}function respondWithFilteredResult(_0x2382e5,_0x7a6a61){return function(_0x38320a){if(_0x38320a){var _0x9fe561=typeof _0x7a6a61['offset']===_0x5f40('0x23')&&typeof _0x7a6a61[_0x5f40('0x24')]===_0x5f40('0x23');var _0x366b26=_0x38320a[_0x5f40('0x25')];var _0x3b9bc9=_0x9fe561?0x0:_0x7a6a61['offset'];var _0xcf5f8b=_0x9fe561?_0x38320a[_0x5f40('0x25')]:_0x7a6a61['offset']+_0x7a6a61[_0x5f40('0x24')];var _0x3848a;if(_0xcf5f8b>=_0x366b26){_0xcf5f8b=_0x366b26;_0x3848a=0xc8;}else{_0x3848a=0xce;}_0x2382e5[_0x5f40('0x22')](_0x3848a);return _0x2382e5['set'](_0x5f40('0x26'),_0x3b9bc9+'-'+_0xcf5f8b+'/'+_0x366b26)['json'](_0x38320a);}return null;};}function patchUpdates(_0x370aed){return function(_0x54ea24){try{jsonpatch[_0x5f40('0x27')](_0x54ea24,_0x370aed,!![]);}catch(_0x4bd8ec){return BPromise['reject'](_0x4bd8ec);}return _0x54ea24[_0x5f40('0x28')]();};}function saveUpdates(_0x4fc44a,_0x12615b){return function(_0x359cf8){if(_0x359cf8){return _0x359cf8[_0x5f40('0x29')](_0x4fc44a)[_0x5f40('0x2a')](function(_0x333350){return _0x333350;});}return null;};}function removeEntity(_0x21afcf,_0x53edb0){return function(_0x3fe4cc){if(_0x3fe4cc){return _0x3fe4cc['destroy']()[_0x5f40('0x2a')](function(){var _0x3217ec=_0x3fe4cc[_0x5f40('0x2b')]({'plain':!![]});var _0x532f79=_0x5f40('0x2c');return db[_0x5f40('0x2d')][_0x5f40('0x2e')]({'where':{'type':_0x532f79,'resourceId':_0x3217ec['id']}})[_0x5f40('0x2a')](function(){return _0x3fe4cc;});})[_0x5f40('0x2a')](function(){_0x21afcf['status'](0xcc)[_0x5f40('0x2f')]();});}};}function handleEntityNotFound(_0x508cb4,_0x51f7d9){return function(_0x266488){if(!_0x266488){_0x508cb4['sendStatus'](0x194);}return _0x266488;};}function handleError(_0x5bc510,_0x442cf4){_0x442cf4=_0x442cf4||0x1f4;return function(_0x342fe5){logger['error'](_0x342fe5[_0x5f40('0x30')]);if(_0x342fe5[_0x5f40('0x31')]){delete _0x342fe5[_0x5f40('0x31')];}_0x5bc510[_0x5f40('0x22')](_0x442cf4)['send'](_0x342fe5);};}exports[_0x5f40('0x32')]=function(_0x3f6cd3,_0x366934){var _0xf5753d={},_0x2380e0={},_0x360b54={'count':0x0,'rows':[]};var _0x131ef9=_['map'](db['VoiceContext'][_0x5f40('0x33')],function(_0x232eb5){return{'name':_0x232eb5[_0x5f40('0x34')],'type':_0x232eb5[_0x5f40('0x35')][_0x5f40('0x36')]};});_0x2380e0['model']=_[_0x5f40('0x37')](_0x131ef9,_0x5f40('0x31'));_0x2380e0['query']=_[_0x5f40('0x38')](_0x3f6cd3['query']);_0x2380e0[_0x5f40('0x39')]=_[_0x5f40('0x3a')](_0x2380e0[_0x5f40('0x3b')],_0x2380e0[_0x5f40('0x3c')]);_0xf5753d['attributes']=_['intersection'](_0x2380e0['model'],qs[_0x5f40('0x3d')](_0x3f6cd3[_0x5f40('0x3c')]['fields']));_0xf5753d[_0x5f40('0x3e')]=_0xf5753d[_0x5f40('0x3e')][_0x5f40('0x3f')]?_0xf5753d[_0x5f40('0x3e')]:_0x2380e0[_0x5f40('0x3b')];if(!_0x3f6cd3['query']['hasOwnProperty'](_0x5f40('0x40'))){_0xf5753d['limit']=qs['limit'](_0x3f6cd3[_0x5f40('0x3c')]['limit']);_0xf5753d[_0x5f40('0x41')]=qs[_0x5f40('0x41')](_0x3f6cd3[_0x5f40('0x3c')]['offset']);}_0xf5753d['order']=qs[_0x5f40('0x42')](_0x3f6cd3[_0x5f40('0x3c')][_0x5f40('0x42')]);_0xf5753d['where']=qs[_0x5f40('0x39')](_['pick'](_0x3f6cd3[_0x5f40('0x3c')],_0x2380e0[_0x5f40('0x39')]),_0x131ef9);if(_0x3f6cd3[_0x5f40('0x3c')]['filter']){_0xf5753d['where']=_[_0x5f40('0x43')](_0xf5753d[_0x5f40('0x44')],{'$or':_[_0x5f40('0x37')](_0x131ef9,function(_0x100cb2){if(_0x100cb2[_0x5f40('0x35')]!==_0x5f40('0x45')){var _0x433af0={};_0x433af0[_0x100cb2[_0x5f40('0x31')]]={'$like':'%'+_0x3f6cd3[_0x5f40('0x3c')][_0x5f40('0x46')]+'%'};return _0x433af0;}})});}_0xf5753d=_[_0x5f40('0x43')]({},_0xf5753d,_0x3f6cd3[_0x5f40('0x47')]);var _0x295697={'where':_0xf5753d[_0x5f40('0x44')]};return db[_0x5f40('0x48')][_0x5f40('0x25')](_0x295697)[_0x5f40('0x2a')](function(_0x103c16){_0x360b54['count']=_0x103c16;if(_0x3f6cd3[_0x5f40('0x3c')][_0x5f40('0x49')]){_0xf5753d[_0x5f40('0x4a')]=[{'all':!![]}];}return db[_0x5f40('0x48')]['findAll'](_0xf5753d);})[_0x5f40('0x2a')](function(_0x45fa0f){_0x360b54[_0x5f40('0x4b')]=_0x45fa0f;return _0x360b54;})[_0x5f40('0x2a')](respondWithFilteredResult(_0x366934,_0xf5753d))[_0x5f40('0x21')](handleError(_0x366934,null));};exports[_0x5f40('0x4c')]=function(_0x40a6a7,_0x3bd459){var _0x1f9e8b={'raw':![],'where':{'id':_0x40a6a7[_0x5f40('0x4d')]['id']}},_0x5799a2={};_0x5799a2[_0x5f40('0x3b')]=_[_0x5f40('0x38')](db[_0x5f40('0x48')][_0x5f40('0x33')]);_0x5799a2[_0x5f40('0x3c')]=_[_0x5f40('0x38')](_0x40a6a7[_0x5f40('0x3c')]);_0x5799a2['filters']=_['intersection'](_0x5799a2[_0x5f40('0x3b')],_0x5799a2['query']);_0x1f9e8b[_0x5f40('0x3e')]=_[_0x5f40('0x3a')](_0x5799a2[_0x5f40('0x3b')],qs[_0x5f40('0x3d')](_0x40a6a7['query'][_0x5f40('0x3d')]));_0x1f9e8b[_0x5f40('0x3e')]=_0x1f9e8b[_0x5f40('0x3e')][_0x5f40('0x3f')]?_0x1f9e8b[_0x5f40('0x3e')]:_0x5799a2[_0x5f40('0x3b')];if(_0x40a6a7[_0x5f40('0x3c')][_0x5f40('0x49')]){_0x1f9e8b[_0x5f40('0x4a')]=[{'all':!![]}];}_0x1f9e8b=_[_0x5f40('0x43')]({},_0x1f9e8b,_0x40a6a7[_0x5f40('0x47')]);return db[_0x5f40('0x48')][_0x5f40('0x4e')](_0x1f9e8b)['then'](handleEntityNotFound(_0x3bd459,null))['then'](respondWithResult(_0x3bd459,null))[_0x5f40('0x21')](handleError(_0x3bd459,null));};exports[_0x5f40('0x4f')]=function(_0x2d6280,_0x4196a2,_0x1d12b3){var _0x16dee6;return db['VoiceContext'][_0x5f40('0x4f')](_0x2d6280['body'],{'raw':!![]})['then'](function(_0x1a6ccc){_0x16dee6=_0x1a6ccc;return db[_0x5f40('0x48')]['findAll']({'raw':!![]});})[_0x5f40('0x2a')](function(_0x3d0185){var _0x251bcf=fs[_0x5f40('0x50')](path[_0x5f40('0x51')](config[_0x5f40('0x52')],_0x5f40('0x53')),'utf8');var _0x3b9708=ejs[_0x5f40('0x54')](_0x251bcf,{'contexts':_0x3d0185||[]});fs[_0x5f40('0x55')](_0x5f40('0x56'),_0x3b9708);})[_0x5f40('0x2a')](function(){return respondWithRpcPromise(_0x5f40('0x57'),'create',{'module':'chan_sip.so'});})['then'](function(){var _0x5786e1=_0x2d6280[_0x5f40('0x58')]['get']({'plain':!![]});if(!_0x5786e1)throw new Error(_0x5f40('0x59'));if(_0x5786e1[_0x5f40('0x5a')]===_0x5f40('0x58')){var _0x2bf30e=_0x16dee6['get']({'plain':!![]});return db[_0x5f40('0x5b')][_0x5f40('0x4e')]({'where':{'name':_0x5f40('0x2c'),'userProfileId':_0x5786e1[_0x5f40('0x5c')]},'raw':!![]})[_0x5f40('0x2a')](function(_0xb22f0a){if(_0xb22f0a&&_0xb22f0a['autoAssociation']===0x0){return db[_0x5f40('0x2d')][_0x5f40('0x4f')]({'name':_0x2bf30e['name'],'resourceId':_0x2bf30e['id'],'type':_0xb22f0a[_0x5f40('0x31')],'sectionId':_0xb22f0a['id']},{})['then'](function(){return _0x16dee6;});}else{return _0x16dee6;}})['catch'](function(_0x246416){logger['error'](_0x5f40('0x5d'),_0x246416);throw _0x246416;});}return _0x16dee6;})[_0x5f40('0x2a')](respondWithResult(_0x4196a2,0xc9))['catch'](handleError(_0x4196a2,null));};exports['update']=function(_0x23d836,_0x1b2f3e,_0x5dd535){var _0x3eda55;return db[_0x5f40('0x48')][_0x5f40('0x4e')]({'where':{'id':_0x23d836[_0x5f40('0x4d')]['id']}})[_0x5f40('0x2a')](handleEntityNotFound(_0x1b2f3e,null))['then'](saveUpdates(_0x23d836[_0x5f40('0x5e')],null))['then'](function(_0x3327ca){if(_0x3327ca){_0x3eda55=_0x3327ca;return db[_0x5f40('0x48')][_0x5f40('0x5f')]({'raw':!![]});}})['then'](function(_0x1ae4aa){var _0xc5615a=fs[_0x5f40('0x50')](path[_0x5f40('0x51')](config[_0x5f40('0x52')],_0x5f40('0x53')),_0x5f40('0x60'));var _0x1f1224=ejs[_0x5f40('0x54')](_0xc5615a,{'contexts':_0x1ae4aa||[]});fs[_0x5f40('0x55')](_0x5f40('0x56'),_0x1f1224);})[_0x5f40('0x2a')](function(){return respondWithRpcPromise('Reload',_0x5f40('0x29'),{'module':_0x5f40('0x61')});})[_0x5f40('0x2a')](function(){return _0x3eda55;})[_0x5f40('0x2a')](respondWithResult(_0x1b2f3e,null))[_0x5f40('0x21')](handleError(_0x1b2f3e,null));};exports[_0x5f40('0x2e')]=function(_0x21f901,_0x54a2ae,_0x5216dd){var _0x13aafb;return db[_0x5f40('0x48')][_0x5f40('0x4e')]({'where':{'id':_0x21f901[_0x5f40('0x4d')]['id']}})[_0x5f40('0x2a')](handleEntityNotFound(_0x54a2ae,null))[_0x5f40('0x2a')](removeEntity(_0x54a2ae,null))[_0x5f40('0x2a')](function(){return db[_0x5f40('0x48')][_0x5f40('0x5f')]({'raw':!![]});})[_0x5f40('0x2a')](function(_0x545124){var _0x4cf03f=fs[_0x5f40('0x50')](path[_0x5f40('0x51')](config[_0x5f40('0x52')],_0x5f40('0x53')),_0x5f40('0x60'));var _0x4fbde4=ejs[_0x5f40('0x54')](_0x4cf03f,{'contexts':_0x545124});fs['writeFileSync'](_0x5f40('0x56'),_0x4fbde4);return respondWithRpcPromise('Reload',_0x5f40('0x2e'),{'module':_0x5f40('0x61')});})[_0x5f40('0x21')](handleError(_0x54a2ae,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 46f0da2..d9ec79a 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 _0x01bd=['moment','bluebird','request-promise','rimraf','../../config/environment','./voiceContext.attributes','VoiceContext','voice_contexts','lodash','util','api'];(function(_0x35f7f5,_0x4e2ee1){var _0x5567a4=function(_0x3e5df0){while(--_0x3e5df0){_0x35f7f5['push'](_0x35f7f5['shift']());}};_0x5567a4(++_0x4e2ee1);}(_0x01bd,0x1aa));var _0xd01b=function(_0x95112c,_0x2c7371){_0x95112c=_0x95112c-0x0;var _0x24789b=_0x01bd[_0x95112c];return _0x24789b;};'use strict';var _=require(_0xd01b('0x0'));var util=require(_0xd01b('0x1'));var logger=require('../../config/logger')(_0xd01b('0x2'));var moment=require(_0xd01b('0x3'));var BPromise=require(_0xd01b('0x4'));var rp=require(_0xd01b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd01b('0x6'));var config=require(_0xd01b('0x7'));var attributes=require(_0xd01b('0x8'));module['exports']=function(_0xbedaff,_0x2af660){return _0xbedaff['define'](_0xd01b('0x9'),attributes,{'tableName':_0xd01b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2dac=['define','VoiceContext','voice_contexts','util','../../config/logger','moment','bluebird','request-promise','./voiceContext.attributes','exports'];(function(_0x5d3338,_0x25da12){var _0x405dd0=function(_0x1a1b78){while(--_0x1a1b78){_0x5d3338['push'](_0x5d3338['shift']());}};_0x405dd0(++_0x25da12);}(_0x2dac,0x107));var _0xc2da=function(_0x20acaf,_0x571590){_0x20acaf=_0x20acaf-0x0;var _0xe06fed=_0x2dac[_0x20acaf];return _0xe06fed;};'use strict';var _=require('lodash');var util=require(_0xc2da('0x0'));var logger=require(_0xc2da('0x1'))('api');var moment=require(_0xc2da('0x2'));var BPromise=require(_0xc2da('0x3'));var rp=require(_0xc2da('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc2da('0x5'));module[_0xc2da('0x6')]=function(_0x2affd3,_0x3c879c){return _0x2affd3[_0xc2da('0x7')](_0xc2da('0x8'),attributes,{'tableName':_0xc2da('0x9'),'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 83e411c..f86c13f 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 _0xe0dd=['../../config/utils','../../config/logger','jayson/promise','client','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xe0dd,0x163));var _0xde0d=function(_0x1057a3,_0x28d9b7){_0x1057a3=_0x1057a3-0x0;var _0x131cdb=_0xe0dd[_0x1057a3];return _0x131cdb;};'use strict';var _=require(_0xde0d('0x0'));var util=require(_0xde0d('0x1'));var moment=require('moment');var BPromise=require(_0xde0d('0x2'));var rs=require(_0xde0d('0x3'));var fs=require('fs');var Redis=require(_0xde0d('0x4'));var db=require(_0xde0d('0x5'))['db'];var utils=require(_0xde0d('0x6'));var logger=require(_0xde0d('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xde0d('0x8'));var client=jayson[_0xde0d('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x323200,_0x3ce23c,_0x33a644){return new BPromise(function(_0x570b78,_0x25f0fe){return client['request'](_0x323200,_0x33a644)[_0xde0d('0xa')](function(_0x5e6588){logger[_0xde0d('0xb')](_0xde0d('0xc'),_0x3ce23c,_0xde0d('0xd'));logger['debug']('VoiceContext,\x20%s,\x20%s,\x20%s',_0x3ce23c,'request\x20sent',JSON[_0xde0d('0xe')](_0x5e6588));if(_0x5e6588[_0xde0d('0xf')]){if(_0x5e6588[_0xde0d('0xf')]['code']===0x1f4){logger[_0xde0d('0xf')](_0xde0d('0xc'),_0x3ce23c,_0x5e6588['error'][_0xde0d('0x10')]);return _0x25f0fe(_0x5e6588[_0xde0d('0xf')][_0xde0d('0x10')]);}logger[_0xde0d('0xf')](_0xde0d('0xc'),_0x3ce23c,_0x5e6588['error'][_0xde0d('0x10')]);return _0x570b78(_0x5e6588['error'][_0xde0d('0x10')]);}else{logger['info'](_0xde0d('0xc'),_0x3ce23c,'request\x20sent');_0x570b78(_0x5e6588[_0xde0d('0x11')][_0xde0d('0x10')]);}})[_0xde0d('0x12')](function(_0x228666){logger[_0xde0d('0xf')](_0xde0d('0xc'),_0x3ce23c,_0x228666);_0x25f0fe(_0x228666);});});} \ No newline at end of file +var _0x1f3c=['VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','jayson/promise','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x4efedf,_0x1a3ad2){var _0x189351=function(_0x4921e3){while(--_0x4921e3){_0x4efedf['push'](_0x4efedf['shift']());}};_0x189351(++_0x1a3ad2);}(_0x1f3c,0xd7));var _0xc1f3=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x1f3c[_0x4c12ec];return _0x3ae42c;};'use strict';var _=require(_0xc1f3('0x0'));var util=require(_0xc1f3('0x1'));var moment=require(_0xc1f3('0x2'));var BPromise=require(_0xc1f3('0x3'));var rs=require(_0xc1f3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xc1f3('0x5'));var client=jayson['client'][_0xc1f3('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x245eff,_0x47949a,_0x1ecd80){return new BPromise(function(_0x3d0978,_0x48c5a7){return client[_0xc1f3('0x7')](_0x245eff,_0x1ecd80)[_0xc1f3('0x8')](function(_0x3ad994){logger[_0xc1f3('0x9')](_0xc1f3('0xa'),_0x47949a,_0xc1f3('0xb'));logger[_0xc1f3('0xc')](_0xc1f3('0xd'),_0x47949a,_0xc1f3('0xb'),JSON[_0xc1f3('0xe')](_0x3ad994));if(_0x3ad994[_0xc1f3('0xf')]){if(_0x3ad994[_0xc1f3('0xf')]['code']===0x1f4){logger[_0xc1f3('0xf')]('VoiceContext,\x20%s,\x20%s',_0x47949a,_0x3ad994[_0xc1f3('0xf')]['message']);return _0x48c5a7(_0x3ad994[_0xc1f3('0xf')][_0xc1f3('0x10')]);}logger[_0xc1f3('0xf')](_0xc1f3('0xa'),_0x47949a,_0x3ad994[_0xc1f3('0xf')][_0xc1f3('0x10')]);return _0x3d0978(_0x3ad994[_0xc1f3('0xf')][_0xc1f3('0x10')]);}else{logger[_0xc1f3('0x9')](_0xc1f3('0xa'),_0x47949a,_0xc1f3('0xb'));_0x3d0978(_0x3ad994[_0xc1f3('0x11')][_0xc1f3('0x10')]);}})[_0xc1f3('0x12')](function(_0x1d0bbf){logger[_0xc1f3('0xf')](_0xc1f3('0xa'),_0x47949a,_0x1d0bbf);_0x48c5a7(_0x1d0bbf);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index a8c6c00..0e4b8c3 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 _0x76bb=['exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./voiceDialReport.controller','isAuthenticated','index','get','/describe','/:id','show','create','put','update','delete'];(function(_0x2e68aa,_0x52a212){var _0x2f6870=function(_0x187933){while(--_0x187933){_0x2e68aa['push'](_0x2e68aa['shift']());}};_0x2f6870(++_0x52a212);}(_0x76bb,0x16a));var _0xb76b=function(_0x5a2d95,_0xb362e5){_0x5a2d95=_0x5a2d95-0x0;var _0x2c3986=_0x76bb[_0x5a2d95];return _0x2c3986;};'use strict';var multer=require('multer');var util=require(_0xb76b('0x0'));var path=require(_0xb76b('0x1'));var timeout=require(_0xb76b('0x2'));var express=require(_0xb76b('0x3'));var router=express['Router']();var fs_extra=require(_0xb76b('0x4'));var auth=require(_0xb76b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb76b('0x6'));var controller=require(_0xb76b('0x7'));router['get']('/',auth[_0xb76b('0x8')](),controller[_0xb76b('0x9')]);router[_0xb76b('0xa')](_0xb76b('0xb'),auth[_0xb76b('0x8')](),controller['describe']);router[_0xb76b('0xa')](_0xb76b('0xc'),auth[_0xb76b('0x8')](),controller[_0xb76b('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb76b('0xe')]);router[_0xb76b('0xf')](_0xb76b('0xc'),auth[_0xb76b('0x8')](),controller[_0xb76b('0x10')]);router[_0xb76b('0x11')](_0xb76b('0xc'),auth[_0xb76b('0x8')](),controller['destroy']);module[_0xb76b('0x12')]=router; \ No newline at end of file +var _0x8723=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','isAuthenticated','get','describe','/:id','show','post','create','delete'];(function(_0x32729c,_0xf5afd8){var _0x482cfd=function(_0x231471){while(--_0x231471){_0x32729c['push'](_0x32729c['shift']());}};_0x482cfd(++_0xf5afd8);}(_0x8723,0x106));var _0x3872=function(_0x5546e1,_0x313604){_0x5546e1=_0x5546e1-0x0;var _0x3575b4=_0x8723[_0x5546e1];return _0x3575b4;};'use strict';var multer=require(_0x3872('0x0'));var util=require(_0x3872('0x1'));var path=require(_0x3872('0x2'));var timeout=require(_0x3872('0x3'));var express=require(_0x3872('0x4'));var router=express[_0x3872('0x5')]();var fs_extra=require(_0x3872('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x3872('0x7'));var config=require(_0x3872('0x8'));var controller=require(_0x3872('0x9'));router['get']('/',auth[_0x3872('0xa')](),controller['index']);router[_0x3872('0xb')]('/describe',auth[_0x3872('0xa')](),controller[_0x3872('0xc')]);router[_0x3872('0xb')](_0x3872('0xd'),auth[_0x3872('0xa')](),controller[_0x3872('0xe')]);router[_0x3872('0xf')]('/',auth['isAuthenticated'](),controller[_0x3872('0x10')]);router['put'](_0x3872('0xd'),auth[_0x3872('0xa')](),controller['update']);router[_0x3872('0x11')](_0x3872('0xd'),auth[_0x3872('0xa')](),controller[_0x3872('0x12')]);module[_0x3872('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index a862826..95968b6 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 _0x84ab=['INTEGER','DATE','called,connect,complete','sequelize','exports','STRING'];(function(_0x12d93a,_0x460b08){var _0x5e0913=function(_0x353783){while(--_0x353783){_0x12d93a['push'](_0x12d93a['shift']());}};_0x5e0913(++_0x460b08);}(_0x84ab,0x12f));var _0xb84a=function(_0x124f88,_0x3ad501){_0x124f88=_0x124f88-0x0;var _0xed0e3b=_0x84ab[_0x124f88];return _0xed0e3b;};'use strict';var Sequelize=require(_0xb84a('0x0'));module[_0xb84a('0x1')]={'privilege':{'type':Sequelize[_0xb84a('0x2')]},'channel':{'type':Sequelize[_0xb84a('0x2')]},'channelstate':{'type':Sequelize[_0xb84a('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xb84a('0x2')]},'calleridname':{'type':Sequelize[_0xb84a('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xb84a('0x2')]},'language':{'type':Sequelize[_0xb84a('0x2')]},'accountcode':{'type':Sequelize[_0xb84a('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0xb84a('0x2')]},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xb84a('0x2')]},'destchannelstate':{'type':Sequelize[_0xb84a('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xb84a('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xb84a('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xb84a('0x2')]},'destlanguage':{'type':Sequelize[_0xb84a('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xb84a('0x3')]},'destuniqueid':{'type':Sequelize[_0xb84a('0x2')]},'destlinkedid':{'type':Sequelize[_0xb84a('0x2')]},'dialstring':{'type':Sequelize[_0xb84a('0x2')]},'dialstatus':{'type':Sequelize[_0xb84a('0x2')]},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xb84a('0x4')]},'endtime':{'type':Sequelize[_0xb84a('0x4')]},'lastevent':{'type':Sequelize[_0xb84a('0x2')],'comment':_0xb84a('0x5')},'routeId':{'type':Sequelize[_0xb84a('0x3')]},'duration':{'type':Sequelize[_0xb84a('0x3')]},'holdtime':{'type':Sequelize[_0xb84a('0x3')]},'billableseconds':{'type':Sequelize[_0xb84a('0x3')]}}; \ No newline at end of file +var _0x98a8=['sequelize','exports','STRING','INTEGER','DATE'];(function(_0x3616e8,_0x6fa8b7){var _0x361422=function(_0x4caf7e){while(--_0x4caf7e){_0x3616e8['push'](_0x3616e8['shift']());}};_0x361422(++_0x6fa8b7);}(_0x98a8,0x12c));var _0x898a=function(_0x2018cb,_0x27e7cd){_0x2018cb=_0x2018cb-0x0;var _0x2ce23e=_0x98a8[_0x2018cb];return _0x2ce23e;};'use strict';var Sequelize=require(_0x898a('0x0'));module[_0x898a('0x1')]={'privilege':{'type':Sequelize[_0x898a('0x2')]},'channel':{'type':Sequelize[_0x898a('0x2')]},'channelstate':{'type':Sequelize[_0x898a('0x3')]},'channelstatedesc':{'type':Sequelize[_0x898a('0x2')]},'calleridnum':{'type':Sequelize[_0x898a('0x2')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x898a('0x2')]},'connectedlinename':{'type':Sequelize[_0x898a('0x2')]},'language':{'type':Sequelize[_0x898a('0x2')]},'accountcode':{'type':Sequelize[_0x898a('0x2')]},'context':{'type':Sequelize[_0x898a('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x898a('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0x898a('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x898a('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x898a('0x2')]},'destcalleridnum':{'type':Sequelize[_0x898a('0x2')]},'destcalleridname':{'type':Sequelize[_0x898a('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x898a('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x898a('0x2')]},'destlanguage':{'type':Sequelize[_0x898a('0x2')]},'destaccountcode':{'type':Sequelize[_0x898a('0x2')]},'destcontext':{'type':Sequelize[_0x898a('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x898a('0x3')]},'destuniqueid':{'type':Sequelize['STRING']},'destlinkedid':{'type':Sequelize[_0x898a('0x2')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0x898a('0x2')]},'starttime':{'type':Sequelize[_0x898a('0x4')]},'answertime':{'type':Sequelize[_0x898a('0x4')]},'endtime':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize['STRING'],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0x898a('0x3')]},'duration':{'type':Sequelize[_0x898a('0x3')]},'holdtime':{'type':Sequelize[_0x898a('0x3')]},'billableseconds':{'type':Sequelize[_0x898a('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index b8da15d..02b30bb 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 _0x1d9e=['create','body','params','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','error','name','send','index','fieldName','key','model','map','query','filters','intersection','attributes','fields','sort','where','filter','merge','type','options','VoiceDialReport','includeAll','findAll','rows','catch','show','keys','length','find'];(function(_0x5a7dd3,_0x26b7cf){var _0x2f4d07=function(_0x280510){while(--_0x280510){_0x5a7dd3['push'](_0x5a7dd3['shift']());}};_0x2f4d07(++_0x26b7cf);}(_0x1d9e,0x168));var _0xe1d9=function(_0x2d12c3,_0xd4736f){_0x2d12c3=_0x2d12c3-0x0;var _0xe81f6a=_0x1d9e[_0x2d12c3];return _0xe81f6a;};'use strict';var emlformat=require(_0xe1d9('0x0'));var rimraf=require(_0xe1d9('0x1'));var zipdir=require(_0xe1d9('0x2'));var jsonpatch=require(_0xe1d9('0x3'));var rp=require('request-promise');var moment=require(_0xe1d9('0x4'));var BPromise=require(_0xe1d9('0x5'));var Mustache=require(_0xe1d9('0x6'));var util=require(_0xe1d9('0x7'));var path=require(_0xe1d9('0x8'));var sox=require(_0xe1d9('0x9'));var csv=require(_0xe1d9('0xa'));var ejs=require(_0xe1d9('0xb'));var fs=require('fs');var fs_extra=require(_0xe1d9('0xc'));var _=require('lodash');var squel=require(_0xe1d9('0xd'));var crypto=require(_0xe1d9('0xe'));var jsforce=require(_0xe1d9('0xf'));var deskjs=require(_0xe1d9('0x10'));var toCsv=require(_0xe1d9('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe1d9('0x11'));var authService=require(_0xe1d9('0x12'));var qs=require(_0xe1d9('0x13'));var as=require(_0xe1d9('0x14'));var hardwareService=require(_0xe1d9('0x15'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xe1d9('0x16'));var licenseUtil=require(_0xe1d9('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2ecc6e,_0x1b99ee){_0x1b99ee=_0x1b99ee||0xcc;return function(_0xc8e36c){if(_0xc8e36c){return _0x2ecc6e[_0xe1d9('0x18')](_0x1b99ee);}return _0x2ecc6e[_0xe1d9('0x19')](_0x1b99ee)[_0xe1d9('0x1a')]();};}function respondWithResult(_0x1641a1,_0x23a46f){_0x23a46f=_0x23a46f||0xc8;return function(_0x198eed){if(_0x198eed){return _0x1641a1['status'](_0x23a46f)['json'](_0x198eed);}};}function respondWithFilteredResult(_0x83f330,_0x4835cd){return function(_0x3adbea){if(_0x3adbea){var _0x3e0483=typeof _0x4835cd[_0xe1d9('0x1b')]===_0xe1d9('0x1c')&&typeof _0x4835cd[_0xe1d9('0x1d')]===_0xe1d9('0x1c');var _0x155c46=_0x3adbea[_0xe1d9('0x1e')];var _0x7bbb7c=_0x3e0483?0x0:_0x4835cd[_0xe1d9('0x1b')];var _0x3d7d87=_0x3e0483?_0x3adbea[_0xe1d9('0x1e')]:_0x4835cd[_0xe1d9('0x1b')]+_0x4835cd['limit'];var _0x99f179;if(_0x3d7d87>=_0x155c46){_0x3d7d87=_0x155c46;_0x99f179=0xc8;}else{_0x99f179=0xce;}_0x83f330[_0xe1d9('0x19')](_0x99f179);return _0x83f330[_0xe1d9('0x1f')](_0xe1d9('0x20'),_0x7bbb7c+'-'+_0x3d7d87+'/'+_0x155c46)[_0xe1d9('0x21')](_0x3adbea);}return null;};}function patchUpdates(_0x10c438){return function(_0x13ce64){try{jsonpatch['apply'](_0x13ce64,_0x10c438,!![]);}catch(_0x12b439){return BPromise[_0xe1d9('0x22')](_0x12b439);}return _0x13ce64[_0xe1d9('0x23')]();};}function saveUpdates(_0x507607,_0x567e1c){return function(_0x2e183a){if(_0x2e183a){return _0x2e183a[_0xe1d9('0x24')](_0x507607)[_0xe1d9('0x25')](function(_0x217b76){return _0x217b76;});}return null;};}function removeEntity(_0x4ea220,_0x1689d3){return function(_0x14634a){if(_0x14634a){return _0x14634a['destroy']()['then'](function(){_0x4ea220[_0xe1d9('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x465a2c,_0x81aeac){return function(_0x399f5f){if(!_0x399f5f){_0x465a2c[_0xe1d9('0x18')](0x194);}return _0x399f5f;};}function handleError(_0x2d586c,_0x3750bb){_0x3750bb=_0x3750bb||0x1f4;return function(_0x183c3a){logger[_0xe1d9('0x26')](_0x183c3a['stack']);if(_0x183c3a[_0xe1d9('0x27')]){delete _0x183c3a[_0xe1d9('0x27')];}_0x2d586c['status'](_0x3750bb)[_0xe1d9('0x28')](_0x183c3a);};}exports[_0xe1d9('0x29')]=function(_0x3c93b6,_0x163d68){var _0xd847b1={},_0x70df9c={},_0x3510d5={'count':0x0,'rows':[]};var _0x5133d0=_['map'](db['VoiceDialReport']['rawAttributes'],function(_0x5dcdce){return{'name':_0x5dcdce[_0xe1d9('0x2a')],'type':_0x5dcdce['type'][_0xe1d9('0x2b')]};});_0x70df9c[_0xe1d9('0x2c')]=_[_0xe1d9('0x2d')](_0x5133d0,_0xe1d9('0x27'));_0x70df9c[_0xe1d9('0x2e')]=_['keys'](_0x3c93b6[_0xe1d9('0x2e')]);_0x70df9c[_0xe1d9('0x2f')]=_[_0xe1d9('0x30')](_0x70df9c['model'],_0x70df9c['query']);_0xd847b1[_0xe1d9('0x31')]=_[_0xe1d9('0x30')](_0x70df9c['model'],qs[_0xe1d9('0x32')](_0x3c93b6[_0xe1d9('0x2e')][_0xe1d9('0x32')]));_0xd847b1[_0xe1d9('0x31')]=_0xd847b1['attributes']['length']?_0xd847b1['attributes']:_0x70df9c['model'];if(!_0x3c93b6[_0xe1d9('0x2e')]['hasOwnProperty']('nolimit')){_0xd847b1[_0xe1d9('0x1d')]=qs['limit'](_0x3c93b6[_0xe1d9('0x2e')][_0xe1d9('0x1d')]);_0xd847b1[_0xe1d9('0x1b')]=qs['offset'](_0x3c93b6[_0xe1d9('0x2e')][_0xe1d9('0x1b')]);}_0xd847b1['order']=qs['sort'](_0x3c93b6[_0xe1d9('0x2e')][_0xe1d9('0x33')]);_0xd847b1[_0xe1d9('0x34')]=qs[_0xe1d9('0x2f')](_['pick'](_0x3c93b6['query'],_0x70df9c['filters']),_0x5133d0);if(_0x3c93b6[_0xe1d9('0x2e')][_0xe1d9('0x35')]){_0xd847b1[_0xe1d9('0x34')]=_[_0xe1d9('0x36')](_0xd847b1[_0xe1d9('0x34')],{'$or':_[_0xe1d9('0x2d')](_0x5133d0,function(_0x4a63e5){if(_0x4a63e5[_0xe1d9('0x37')]!=='VIRTUAL'){var _0x3c13b8={};_0x3c13b8[_0x4a63e5['name']]={'$like':'%'+_0x3c93b6[_0xe1d9('0x2e')][_0xe1d9('0x35')]+'%'};return _0x3c13b8;}})});}_0xd847b1=_['merge']({},_0xd847b1,_0x3c93b6[_0xe1d9('0x38')]);var _0x36a98e={'where':_0xd847b1[_0xe1d9('0x34')]};return db[_0xe1d9('0x39')][_0xe1d9('0x1e')](_0x36a98e)[_0xe1d9('0x25')](function(_0x2e34c2){_0x3510d5['count']=_0x2e34c2;if(_0x3c93b6[_0xe1d9('0x2e')][_0xe1d9('0x3a')]){_0xd847b1['include']=[{'all':!![]}];}return db[_0xe1d9('0x39')][_0xe1d9('0x3b')](_0xd847b1);})[_0xe1d9('0x25')](function(_0x328ef3){_0x3510d5[_0xe1d9('0x3c')]=_0x328ef3;return _0x3510d5;})[_0xe1d9('0x25')](respondWithFilteredResult(_0x163d68,_0xd847b1))[_0xe1d9('0x3d')](handleError(_0x163d68,null));};exports[_0xe1d9('0x3e')]=function(_0x4735e1,_0x385cb9){var _0x79a938={'raw':!![],'where':{'id':_0x4735e1['params']['id']}},_0x4d2ac5={};_0x4d2ac5[_0xe1d9('0x2c')]=_['keys'](db[_0xe1d9('0x39')]['rawAttributes']);_0x4d2ac5[_0xe1d9('0x2e')]=_[_0xe1d9('0x3f')](_0x4735e1[_0xe1d9('0x2e')]);_0x4d2ac5[_0xe1d9('0x2f')]=_[_0xe1d9('0x30')](_0x4d2ac5['model'],_0x4d2ac5[_0xe1d9('0x2e')]);_0x79a938[_0xe1d9('0x31')]=_['intersection'](_0x4d2ac5[_0xe1d9('0x2c')],qs[_0xe1d9('0x32')](_0x4735e1[_0xe1d9('0x2e')]['fields']));_0x79a938[_0xe1d9('0x31')]=_0x79a938[_0xe1d9('0x31')][_0xe1d9('0x40')]?_0x79a938[_0xe1d9('0x31')]:_0x4d2ac5['model'];if(_0x4735e1[_0xe1d9('0x2e')][_0xe1d9('0x3a')]){_0x79a938['include']=[{'all':!![]}];}_0x79a938=_[_0xe1d9('0x36')]({},_0x79a938,_0x4735e1['options']);return db[_0xe1d9('0x39')][_0xe1d9('0x41')](_0x79a938)['then'](handleEntityNotFound(_0x385cb9,null))['then'](respondWithResult(_0x385cb9,null))[_0xe1d9('0x3d')](handleError(_0x385cb9,null));};exports[_0xe1d9('0x42')]=function(_0x362b64,_0x29a850){return db[_0xe1d9('0x39')][_0xe1d9('0x42')](_0x362b64[_0xe1d9('0x43')],{})[_0xe1d9('0x25')](respondWithResult(_0x29a850,0xc9))[_0xe1d9('0x3d')](handleError(_0x29a850,null));};exports[_0xe1d9('0x24')]=function(_0x4d4977,_0xcd28e2){if(_0x4d4977[_0xe1d9('0x43')]['id']){delete _0x4d4977['body']['id'];}return db[_0xe1d9('0x39')][_0xe1d9('0x41')]({'where':{'id':_0x4d4977[_0xe1d9('0x44')]['id']}})[_0xe1d9('0x25')](handleEntityNotFound(_0xcd28e2,null))[_0xe1d9('0x25')](saveUpdates(_0x4d4977[_0xe1d9('0x43')],null))[_0xe1d9('0x25')](respondWithResult(_0xcd28e2,null))['catch'](handleError(_0xcd28e2,null));};exports[_0xe1d9('0x45')]=function(_0x256be5,_0x47f4ae){return db[_0xe1d9('0x39')][_0xe1d9('0x41')]({'where':{'id':_0x256be5['params']['id']}})[_0xe1d9('0x25')](handleEntityNotFound(_0x47f4ae,null))['then'](removeEntity(_0x47f4ae,null))[_0xe1d9('0x3d')](handleError(_0x47f4ae,null));};exports['describe']=function(_0x193f10,_0x8e9369){return db['VoiceDialReport'][_0xe1d9('0x46')]()[_0xe1d9('0x25')](respondWithResult(_0x8e9369,null))[_0xe1d9('0x3d')](handleError(_0x8e9369,null));}; \ No newline at end of file +var _0x257d=['hasOwnProperty','nolimit','order','sort','where','type','VIRTUAL','filter','merge','options','include','findAll','rows','catch','show','keys','includeAll','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','VoiceDialReport','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields','length'];(function(_0x26d836,_0x5b9c8d){var _0x160071=function(_0x2e0195){while(--_0x2e0195){_0x26d836['push'](_0x26d836['shift']());}};_0x160071(++_0x5b9c8d);}(_0x257d,0x109));var _0xd257=function(_0x2a69c1,_0x520d93){_0x2a69c1=_0x2a69c1-0x0;var _0xc2b2e4=_0x257d[_0x2a69c1];return _0xc2b2e4;};'use strict';var emlformat=require(_0xd257('0x0'));var rimraf=require(_0xd257('0x1'));var zipdir=require(_0xd257('0x2'));var jsonpatch=require(_0xd257('0x3'));var rp=require('request-promise');var moment=require(_0xd257('0x4'));var BPromise=require(_0xd257('0x5'));var Mustache=require(_0xd257('0x6'));var util=require(_0xd257('0x7'));var path=require(_0xd257('0x8'));var sox=require(_0xd257('0x9'));var csv=require(_0xd257('0xa'));var ejs=require(_0xd257('0xb'));var fs=require('fs');var fs_extra=require(_0xd257('0xc'));var _=require(_0xd257('0xd'));var squel=require(_0xd257('0xe'));var crypto=require('crypto');var jsforce=require(_0xd257('0xf'));var deskjs=require(_0xd257('0x10'));var toCsv=require(_0xd257('0xa'));var querystring=require(_0xd257('0x11'));var Papa=require(_0xd257('0x12'));var Redis=require(_0xd257('0x13'));var authService=require(_0xd257('0x14'));var qs=require(_0xd257('0x15'));var as=require(_0xd257('0x16'));var hardwareService=require(_0xd257('0x17'));var logger=require(_0xd257('0x18'))(_0xd257('0x19'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd257('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2b9e3f,_0x383e3b){_0x383e3b=_0x383e3b||0xcc;return function(_0x15f218){if(_0x15f218){return _0x2b9e3f['sendStatus'](_0x383e3b);}return _0x2b9e3f[_0xd257('0x1b')](_0x383e3b)['end']();};}function respondWithResult(_0x137896,_0x50f567){_0x50f567=_0x50f567||0xc8;return function(_0x309d76){if(_0x309d76){return _0x137896[_0xd257('0x1b')](_0x50f567)['json'](_0x309d76);}};}function respondWithFilteredResult(_0x4a48e1,_0x197ce2){return function(_0x27fe2e){if(_0x27fe2e){var _0x25c6e4=typeof _0x197ce2[_0xd257('0x1c')]===_0xd257('0x1d')&&typeof _0x197ce2[_0xd257('0x1e')]===_0xd257('0x1d');var _0x907223=_0x27fe2e[_0xd257('0x1f')];var _0xac150d=_0x25c6e4?0x0:_0x197ce2[_0xd257('0x1c')];var _0x419de9=_0x25c6e4?_0x27fe2e[_0xd257('0x1f')]:_0x197ce2[_0xd257('0x1c')]+_0x197ce2[_0xd257('0x1e')];var _0x53644e;if(_0x419de9>=_0x907223){_0x419de9=_0x907223;_0x53644e=0xc8;}else{_0x53644e=0xce;}_0x4a48e1[_0xd257('0x1b')](_0x53644e);return _0x4a48e1[_0xd257('0x20')](_0xd257('0x21'),_0xac150d+'-'+_0x419de9+'/'+_0x907223)[_0xd257('0x22')](_0x27fe2e);}return null;};}function patchUpdates(_0x17cd92){return function(_0x1f386e){try{jsonpatch[_0xd257('0x23')](_0x1f386e,_0x17cd92,!![]);}catch(_0x35f661){return BPromise[_0xd257('0x24')](_0x35f661);}return _0x1f386e[_0xd257('0x25')]();};}function saveUpdates(_0x38a342,_0x502282){return function(_0x327972){if(_0x327972){return _0x327972[_0xd257('0x26')](_0x38a342)[_0xd257('0x27')](function(_0x12fbf6){return _0x12fbf6;});}return null;};}function removeEntity(_0x431bcd,_0xc0a031){return function(_0x3139f6){if(_0x3139f6){return _0x3139f6[_0xd257('0x28')]()[_0xd257('0x27')](function(){_0x431bcd[_0xd257('0x1b')](0xcc)[_0xd257('0x29')]();});}};}function handleEntityNotFound(_0x119806,_0x44b47c){return function(_0x4b91ac){if(!_0x4b91ac){_0x119806['sendStatus'](0x194);}return _0x4b91ac;};}function handleError(_0xb59dd,_0x28fb7c){_0x28fb7c=_0x28fb7c||0x1f4;return function(_0x18b4ed){logger[_0xd257('0x2a')](_0x18b4ed[_0xd257('0x2b')]);if(_0x18b4ed[_0xd257('0x2c')]){delete _0x18b4ed['name'];}_0xb59dd[_0xd257('0x1b')](_0x28fb7c)[_0xd257('0x2d')](_0x18b4ed);};}exports[_0xd257('0x2e')]=function(_0x33fd9f,_0x41c770){var _0x92e6ff={},_0x7eb63={},_0x49a0a8={'count':0x0,'rows':[]};var _0x1e93e3=_['map'](db[_0xd257('0x2f')][_0xd257('0x30')],function(_0x5e9e66){return{'name':_0x5e9e66[_0xd257('0x31')],'type':_0x5e9e66['type'][_0xd257('0x32')]};});_0x7eb63[_0xd257('0x33')]=_[_0xd257('0x34')](_0x1e93e3,'name');_0x7eb63['query']=_['keys'](_0x33fd9f[_0xd257('0x35')]);_0x7eb63[_0xd257('0x36')]=_[_0xd257('0x37')](_0x7eb63[_0xd257('0x33')],_0x7eb63[_0xd257('0x35')]);_0x92e6ff[_0xd257('0x38')]=_['intersection'](_0x7eb63[_0xd257('0x33')],qs[_0xd257('0x39')](_0x33fd9f[_0xd257('0x35')][_0xd257('0x39')]));_0x92e6ff[_0xd257('0x38')]=_0x92e6ff['attributes'][_0xd257('0x3a')]?_0x92e6ff[_0xd257('0x38')]:_0x7eb63[_0xd257('0x33')];if(!_0x33fd9f[_0xd257('0x35')][_0xd257('0x3b')](_0xd257('0x3c'))){_0x92e6ff['limit']=qs['limit'](_0x33fd9f[_0xd257('0x35')]['limit']);_0x92e6ff['offset']=qs[_0xd257('0x1c')](_0x33fd9f['query'][_0xd257('0x1c')]);}_0x92e6ff[_0xd257('0x3d')]=qs[_0xd257('0x3e')](_0x33fd9f[_0xd257('0x35')]['sort']);_0x92e6ff['where']=qs[_0xd257('0x36')](_['pick'](_0x33fd9f['query'],_0x7eb63[_0xd257('0x36')]),_0x1e93e3);if(_0x33fd9f[_0xd257('0x35')]['filter']){_0x92e6ff[_0xd257('0x3f')]=_['merge'](_0x92e6ff[_0xd257('0x3f')],{'$or':_[_0xd257('0x34')](_0x1e93e3,function(_0x50a5d3){if(_0x50a5d3[_0xd257('0x40')]!==_0xd257('0x41')){var _0xa4d6fd={};_0xa4d6fd[_0x50a5d3[_0xd257('0x2c')]]={'$like':'%'+_0x33fd9f['query'][_0xd257('0x42')]+'%'};return _0xa4d6fd;}})});}_0x92e6ff=_[_0xd257('0x43')]({},_0x92e6ff,_0x33fd9f[_0xd257('0x44')]);var _0x2fcccf={'where':_0x92e6ff[_0xd257('0x3f')]};return db[_0xd257('0x2f')][_0xd257('0x1f')](_0x2fcccf)[_0xd257('0x27')](function(_0x545748){_0x49a0a8[_0xd257('0x1f')]=_0x545748;if(_0x33fd9f[_0xd257('0x35')]['includeAll']){_0x92e6ff[_0xd257('0x45')]=[{'all':!![]}];}return db[_0xd257('0x2f')][_0xd257('0x46')](_0x92e6ff);})['then'](function(_0x45fde7){_0x49a0a8[_0xd257('0x47')]=_0x45fde7;return _0x49a0a8;})[_0xd257('0x27')](respondWithFilteredResult(_0x41c770,_0x92e6ff))[_0xd257('0x48')](handleError(_0x41c770,null));};exports[_0xd257('0x49')]=function(_0x3b317a,_0x125325){var _0x22f64a={'raw':!![],'where':{'id':_0x3b317a['params']['id']}},_0xa71e7b={};_0xa71e7b[_0xd257('0x33')]=_[_0xd257('0x4a')](db['VoiceDialReport']['rawAttributes']);_0xa71e7b[_0xd257('0x35')]=_[_0xd257('0x4a')](_0x3b317a[_0xd257('0x35')]);_0xa71e7b[_0xd257('0x36')]=_['intersection'](_0xa71e7b[_0xd257('0x33')],_0xa71e7b[_0xd257('0x35')]);_0x22f64a['attributes']=_['intersection'](_0xa71e7b[_0xd257('0x33')],qs[_0xd257('0x39')](_0x3b317a[_0xd257('0x35')][_0xd257('0x39')]));_0x22f64a[_0xd257('0x38')]=_0x22f64a[_0xd257('0x38')]['length']?_0x22f64a[_0xd257('0x38')]:_0xa71e7b['model'];if(_0x3b317a['query'][_0xd257('0x4b')]){_0x22f64a[_0xd257('0x45')]=[{'all':!![]}];}_0x22f64a=_[_0xd257('0x43')]({},_0x22f64a,_0x3b317a[_0xd257('0x44')]);return db[_0xd257('0x2f')][_0xd257('0x4c')](_0x22f64a)[_0xd257('0x27')](handleEntityNotFound(_0x125325,null))[_0xd257('0x27')](respondWithResult(_0x125325,null))[_0xd257('0x48')](handleError(_0x125325,null));};exports[_0xd257('0x4d')]=function(_0x366e5a,_0x31c26f){return db[_0xd257('0x2f')][_0xd257('0x4d')](_0x366e5a[_0xd257('0x4e')],{})[_0xd257('0x27')](respondWithResult(_0x31c26f,0xc9))[_0xd257('0x48')](handleError(_0x31c26f,null));};exports[_0xd257('0x26')]=function(_0x268c20,_0xfe306){if(_0x268c20[_0xd257('0x4e')]['id']){delete _0x268c20[_0xd257('0x4e')]['id'];}return db[_0xd257('0x2f')]['find']({'where':{'id':_0x268c20['params']['id']}})[_0xd257('0x27')](handleEntityNotFound(_0xfe306,null))[_0xd257('0x27')](saveUpdates(_0x268c20['body'],null))['then'](respondWithResult(_0xfe306,null))[_0xd257('0x48')](handleError(_0xfe306,null));};exports[_0xd257('0x28')]=function(_0x26c253,_0x2f43eb){return db[_0xd257('0x2f')]['find']({'where':{'id':_0x26c253[_0xd257('0x4f')]['id']}})[_0xd257('0x27')](handleEntityNotFound(_0x2f43eb,null))[_0xd257('0x27')](removeEntity(_0x2f43eb,null))[_0xd257('0x48')](handleError(_0x2f43eb,null));};exports['describe']=function(_0x20ab94,_0x13fbd5){return db['VoiceDialReport'][_0xd257('0x50')]()[_0xd257('0x27')](respondWithResult(_0x13fbd5,null))[_0xd257('0x48')](handleError(_0x13fbd5,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 6a76ddc..5e043b2 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 _0x36f1=['path','rimraf','../../config/environment','./voiceDialReport.attributes','exports','report_dial','uniqueid','lodash','util','../../config/logger','moment','bluebird'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x36f1,0x19f));var _0x136f=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0x36f1[_0x33032e];return _0x13316b;};'use strict';var _=require(_0x136f('0x0'));var util=require(_0x136f('0x1'));var logger=require(_0x136f('0x2'))('api');var moment=require(_0x136f('0x3'));var BPromise=require(_0x136f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x136f('0x5'));var rimraf=require(_0x136f('0x6'));var config=require(_0x136f('0x7'));var attributes=require(_0x136f('0x8'));module[_0x136f('0x9')]=function(_0x4f8e5c,_0x11b000){return _0x4f8e5c['define']('VoiceDialReport',attributes,{'tableName':_0x136f('0xa'),'paranoid':![],'indexes':[{'fields':[_0x136f('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8e0c=['moment','bluebird','request-promise','../../config/environment','exports','report_dial','uniqueid','lodash','util','../../config/logger'];(function(_0x463705,_0x42a093){var _0x201bf8=function(_0x4dc00a){while(--_0x4dc00a){_0x463705['push'](_0x463705['shift']());}};_0x201bf8(++_0x42a093);}(_0x8e0c,0x1e7));var _0xc8e0=function(_0x4f1fac,_0x6075ee){_0x4f1fac=_0x4f1fac-0x0;var _0x18d5e2=_0x8e0c[_0x4f1fac];return _0x18d5e2;};'use strict';var _=require(_0xc8e0('0x0'));var util=require(_0xc8e0('0x1'));var logger=require(_0xc8e0('0x2'))('api');var moment=require(_0xc8e0('0x3'));var BPromise=require(_0xc8e0('0x4'));var rp=require(_0xc8e0('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc8e0('0x6'));var attributes=require('./voiceDialReport.attributes');module[_0xc8e0('0x7')]=function(_0x5bd21e,_0x1488bc){return _0x5bd21e['define']('VoiceDialReport',attributes,{'tableName':_0xc8e0('0x8'),'paranoid':![],'indexes':[{'fields':[_0xc8e0('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 38c3cb0..34b000c 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 _0xb83c=['update','raw','where','attributes','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','VoiceDialReport,\x20%s,\x20%s','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','CreateVoiceDialReport','VoiceDialReport','create','body','options','stringify','UpdateVoiceDialReport'];(function(_0x2080a3,_0x48acfa){var _0x8d7d17=function(_0x2dbc06){while(--_0x2dbc06){_0x2080a3['push'](_0x2080a3['shift']());}};_0x8d7d17(++_0x48acfa);}(_0xb83c,0x136));var _0xcb83=function(_0x451a1f,_0x19651c){_0x451a1f=_0x451a1f-0x0;var _0x2d2b2e=_0xb83c[_0x451a1f];return _0x2d2b2e;};'use strict';var _=require(_0xcb83('0x0'));var util=require('util');var moment=require(_0xcb83('0x1'));var BPromise=require(_0xcb83('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcb83('0x3'));var db=require(_0xcb83('0x4'))['db'];var utils=require(_0xcb83('0x5'));var logger=require(_0xcb83('0x6'))(_0xcb83('0x7'));var config=require(_0xcb83('0x8'));var jayson=require(_0xcb83('0x9'));var client=jayson[_0xcb83('0xa')][_0xcb83('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x990851,_0x112a7b,_0x2905a4){return new BPromise(function(_0x876f44,_0x3e052a){return client['request'](_0x990851,_0x2905a4)[_0xcb83('0xc')](function(_0x20959b){logger[_0xcb83('0xd')](_0xcb83('0xe'),_0x112a7b,'request\x20sent');logger[_0xcb83('0xf')](_0xcb83('0x10'),_0x112a7b,_0xcb83('0x11'),JSON['stringify'](_0x20959b));if(_0x20959b[_0xcb83('0x12')]){if(_0x20959b[_0xcb83('0x12')][_0xcb83('0x13')]===0x1f4){logger['error'](_0xcb83('0xe'),_0x112a7b,_0x20959b['error'][_0xcb83('0x14')]);return _0x3e052a(_0x20959b[_0xcb83('0x12')][_0xcb83('0x14')]);}logger[_0xcb83('0x12')](_0xcb83('0xe'),_0x112a7b,_0x20959b[_0xcb83('0x12')]['message']);return _0x876f44(_0x20959b[_0xcb83('0x12')]['message']);}else{logger[_0xcb83('0xd')](_0xcb83('0xe'),_0x112a7b,_0xcb83('0x11'));_0x876f44(_0x20959b[_0xcb83('0x15')][_0xcb83('0x14')]);}})[_0xcb83('0x16')](function(_0x3b0e3e){logger[_0xcb83('0x12')](_0xcb83('0xe'),_0x112a7b,_0x3b0e3e);_0x3e052a(_0x3b0e3e);});});}exports[_0xcb83('0x17')]=function(_0xc07250){var _0x11e797=this;return new Promise(function(_0x3d37ac,_0x3c52cf){return db[_0xcb83('0x18')][_0xcb83('0x19')](_0xc07250[_0xcb83('0x1a')],{'raw':_0xc07250[_0xcb83('0x1b')]?_0xc07250[_0xcb83('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0xcb83('0xc')](function(_0xabc640){logger[_0xcb83('0xd')]('CreateVoiceDialReport',_0xc07250);logger[_0xcb83('0xf')](_0xcb83('0x17'),_0xc07250,JSON[_0xcb83('0x1c')](_0xabc640));_0x3d37ac(_0xabc640);})[_0xcb83('0x16')](function(_0x470d95){logger[_0xcb83('0x12')](_0xcb83('0x17'),_0x470d95[_0xcb83('0x14')],_0xc07250);_0x3c52cf(_0x11e797[_0xcb83('0x12')](0x1f4,_0x470d95[_0xcb83('0x14')]));});});};exports[_0xcb83('0x1d')]=function(_0x3c9ab0){var _0x5f4cc9=this;return new Promise(function(_0x28275a,_0x2cd583){return db['VoiceDialReport'][_0xcb83('0x1e')](_0x3c9ab0['body'],{'raw':_0x3c9ab0[_0xcb83('0x1b')]?_0x3c9ab0[_0xcb83('0x1b')][_0xcb83('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3c9ab0[_0xcb83('0x1b')]?_0x3c9ab0[_0xcb83('0x1b')][_0xcb83('0x20')]||null:null,'attributes':_0x3c9ab0['options']?_0x3c9ab0[_0xcb83('0x1b')][_0xcb83('0x21')]||null:null,'limit':_0x3c9ab0['options']?_0x3c9ab0[_0xcb83('0x1b')]['limit']||null:null})[_0xcb83('0xc')](function(_0x456e71){logger['info'](_0xcb83('0x1d'),_0x3c9ab0);logger[_0xcb83('0xf')]('UpdateVoiceDialReport',_0x3c9ab0,JSON[_0xcb83('0x1c')](_0x456e71));_0x28275a(_0x456e71);})['catch'](function(_0x3407e4){logger[_0xcb83('0x12')](_0xcb83('0x1d'),_0x3407e4[_0xcb83('0x14')],_0x3c9ab0);_0x2cd583(_0x5f4cc9[_0xcb83('0x12')](0x1f4,_0x3407e4['message']));});});}; \ No newline at end of file +var _0xd6a6=['randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','CreateVoiceDialReport','VoiceDialReport','body','options','stringify','UpdateVoiceDialReport','update','raw','where','limit','lodash','moment','bluebird'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd6a6,0xfd));var _0x6d6a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd6a6[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x6d6a('0x0'));var util=require('util');var moment=require(_0x6d6a('0x1'));var BPromise=require(_0x6d6a('0x2'));var rs=require(_0x6d6a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6d6a('0x4'))['db'];var utils=require(_0x6d6a('0x5'));var logger=require('../../config/logger')(_0x6d6a('0x6'));var config=require(_0x6d6a('0x7'));var jayson=require(_0x6d6a('0x8'));var client=jayson[_0x6d6a('0x9')][_0x6d6a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1b3369,_0x5cde94,_0x51f19f){return new BPromise(function(_0x52b53c,_0x3718c4){return client[_0x6d6a('0xb')](_0x1b3369,_0x51f19f)[_0x6d6a('0xc')](function(_0x459936){logger[_0x6d6a('0xd')](_0x6d6a('0xe'),_0x5cde94,_0x6d6a('0xf'));logger[_0x6d6a('0x10')](_0x6d6a('0x11'),_0x5cde94,_0x6d6a('0xf'),JSON['stringify'](_0x459936));if(_0x459936[_0x6d6a('0x12')]){if(_0x459936[_0x6d6a('0x12')]['code']===0x1f4){logger['error'](_0x6d6a('0xe'),_0x5cde94,_0x459936['error'][_0x6d6a('0x13')]);return _0x3718c4(_0x459936[_0x6d6a('0x12')][_0x6d6a('0x13')]);}logger[_0x6d6a('0x12')]('VoiceDialReport,\x20%s,\x20%s',_0x5cde94,_0x459936[_0x6d6a('0x12')][_0x6d6a('0x13')]);return _0x52b53c(_0x459936['error'][_0x6d6a('0x13')]);}else{logger['info'](_0x6d6a('0xe'),_0x5cde94,_0x6d6a('0xf'));_0x52b53c(_0x459936[_0x6d6a('0x14')][_0x6d6a('0x13')]);}})[_0x6d6a('0x15')](function(_0x2e93cf){logger['error'](_0x6d6a('0xe'),_0x5cde94,_0x2e93cf);_0x3718c4(_0x2e93cf);});});}exports[_0x6d6a('0x16')]=function(_0x154680){var _0x46d05e=this;return new Promise(function(_0x20f387,_0x2e2b39){return db[_0x6d6a('0x17')]['create'](_0x154680[_0x6d6a('0x18')],{'raw':_0x154680[_0x6d6a('0x19')]?_0x154680[_0x6d6a('0x19')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1998a0){logger[_0x6d6a('0xd')](_0x6d6a('0x16'),_0x154680);logger[_0x6d6a('0x10')](_0x6d6a('0x16'),_0x154680,JSON[_0x6d6a('0x1a')](_0x1998a0));_0x20f387(_0x1998a0);})[_0x6d6a('0x15')](function(_0x14eeb9){logger['error'](_0x6d6a('0x16'),_0x14eeb9[_0x6d6a('0x13')],_0x154680);_0x2e2b39(_0x46d05e['error'](0x1f4,_0x14eeb9['message']));});});};exports[_0x6d6a('0x1b')]=function(_0x463361){var _0x4f6ce6=this;return new Promise(function(_0x52c31c,_0x1e9c0b){return db['VoiceDialReport'][_0x6d6a('0x1c')](_0x463361[_0x6d6a('0x18')],{'raw':_0x463361['options']?_0x463361[_0x6d6a('0x19')][_0x6d6a('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x463361['options']?_0x463361[_0x6d6a('0x19')][_0x6d6a('0x1e')]||null:null,'attributes':_0x463361[_0x6d6a('0x19')]?_0x463361[_0x6d6a('0x19')]['attributes']||null:null,'limit':_0x463361['options']?_0x463361[_0x6d6a('0x19')][_0x6d6a('0x1f')]||null:null})[_0x6d6a('0xc')](function(_0x2338ac){logger[_0x6d6a('0xd')](_0x6d6a('0x1b'),_0x463361);logger['debug']('UpdateVoiceDialReport',_0x463361,JSON[_0x6d6a('0x1a')](_0x2338ac));_0x52c31c(_0x2338ac);})[_0x6d6a('0x15')](function(_0x1a58a9){logger[_0x6d6a('0x12')](_0x6d6a('0x1b'),_0x1a58a9['message'],_0x463361);_0x1e9c0b(_0x4f6ce6['error'](0x1f4,_0x1a58a9[_0x6d6a('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index e264272..52ac776 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 _0x29a2=['../../config/environment','./voiceExtension.controller','isAuthenticated','index','get','/:id','show','post','/:id/applications','addApplications','update','delete','exports','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x5b34c0,_0x3ad403){var _0x242bd3=function(_0x51d0ce){while(--_0x51d0ce){_0x5b34c0['push'](_0x5b34c0['shift']());}};_0x242bd3(++_0x3ad403);}(_0x29a2,0x13f));var _0x229a=function(_0x386c3e,_0x44a375){_0x386c3e=_0x386c3e-0x0;var _0x4b8e13=_0x29a2[_0x386c3e];return _0x4b8e13;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x229a('0x0'));var express=require(_0x229a('0x1'));var router=express[_0x229a('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x229a('0x3'));var interaction=require(_0x229a('0x4'));var config=require(_0x229a('0x5'));var controller=require(_0x229a('0x6'));router['get']('/',auth[_0x229a('0x7')](),controller[_0x229a('0x8')]);router[_0x229a('0x9')](_0x229a('0xa'),auth['isAuthenticated'](),controller[_0x229a('0xb')]);router[_0x229a('0xc')]('/',auth[_0x229a('0x7')](),controller['create']);router[_0x229a('0xc')](_0x229a('0xd'),auth[_0x229a('0x7')](),controller[_0x229a('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x229a('0xf')]);router[_0x229a('0x10')]('/:id',auth[_0x229a('0x7')](),controller['destroy']);module[_0x229a('0x11')]=router; \ No newline at end of file +var _0x0919=['get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceExtension.controller'];(function(_0x43ee7e,_0x1441b1){var _0x4e8deb=function(_0x512e31){while(--_0x512e31){_0x43ee7e['push'](_0x43ee7e['shift']());}};_0x4e8deb(++_0x1441b1);}(_0x0919,0x123));var _0x9091=function(_0x2df387,_0x1d3ea1){_0x2df387=_0x2df387-0x0;var _0x3b1708=_0x0919[_0x2df387];return _0x3b1708;};'use strict';var multer=require(_0x9091('0x0'));var util=require(_0x9091('0x1'));var path=require(_0x9091('0x2'));var timeout=require(_0x9091('0x3'));var express=require(_0x9091('0x4'));var router=express[_0x9091('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x9091('0x6'));var config=require(_0x9091('0x7'));var controller=require(_0x9091('0x8'));router[_0x9091('0x9')]('/',auth[_0x9091('0xa')](),controller['index']);router[_0x9091('0x9')](_0x9091('0xb'),auth[_0x9091('0xa')](),controller[_0x9091('0xc')]);router[_0x9091('0xd')]('/',auth['isAuthenticated'](),controller[_0x9091('0xe')]);router['post']('/:id/applications',auth[_0x9091('0xa')](),controller['addApplications']);router[_0x9091('0xf')](_0x9091('0xb'),auth['isAuthenticated'](),controller[_0x9091('0x10')]);router[_0x9091('0x11')](_0x9091('0xb'),auth['isAuthenticated'](),controller[_0x9091('0x12')]);module[_0x9091('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 741dd69..e0f527d 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 _0xbaf0=['outbound','internal','inbound-fax','system','*,*,*,*','INTEGER','BOOLEAN','wav','getDataValue','exten','exports','STRING','compositeIndex','NoOp','ENUM','inbound'];(function(_0x4abd8f,_0x38543b){var _0x3feb23=function(_0x36bb75){while(--_0x36bb75){_0x4abd8f['push'](_0x4abd8f['shift']());}};_0x3feb23(++_0x38543b);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xbaf0[_0x2b4411];return _0x8e41ef;};'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 +var _0x70e0=['INTEGER','wav','VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','ENUM','inbound-fax','outbound-fax','system','any','*,*,*,*','BOOLEAN'];(function(_0x456032,_0x1a799d){var _0x1a53cd=function(_0x162cc8){while(--_0x162cc8){_0x456032['push'](_0x456032['shift']());}};_0x1a53cd(++_0x1a799d);}(_0x70e0,0x17b));var _0x070e=function(_0x32002e,_0x218f24){_0x32002e=_0x32002e-0x0;var _0x33ec8c=_0x70e0[_0x32002e];return _0x33ec8c;};'use strict';var Sequelize=require(_0x070e('0x0'));module[_0x070e('0x1')]={'context':{'type':Sequelize[_0x070e('0x2')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x070e('0x3')},'priority':{'type':Sequelize[_0x070e('0x2')],'allowNull':![],'defaultValue':'1','unique':_0x070e('0x3')},'tag':{'type':Sequelize[_0x070e('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x070e('0x4')},'appdata':{'type':Sequelize['STRING'](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x070e('0x5')]('inbound','outbound','internal',_0x070e('0x6'),_0x070e('0x7'),_0x070e('0x8'),_0x070e('0x9')),'allowNull':![]},'description':{'type':Sequelize[_0x070e('0x2')]},'interval':{'type':Sequelize[_0x070e('0x2')],'allowNull':![],'defaultValue':_0x070e('0xa')},'IntervalId':{'type':Sequelize['INTEGER']},'isApp':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x070e('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x070e('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0x070e('0xb')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x070e('0xc')]},'recordingFormat':{'type':Sequelize[_0x070e('0x2')],'defaultValue':_0x070e('0xd')},'answer':{'type':Sequelize[_0x070e('0xb')],'defaultValue':!![]},'name':{'type':Sequelize[_0x070e('0xe')],'get':function(){return this[_0x070e('0xf')](_0x070e('0x10'));}}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index eac6ad6..7f3d368 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 _0xff89=['end','json','undefined','limit','count','offset','set','Content-Range','destroy','then','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','internal','ignore','map','value','type','name','UserProfileResource','error','stack','send','index','VoiceExtension','rawAttributes','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','startsWith','exten','concat','user','get','role','UserProfileSection','userProfileId','autoAssociation','update','context','cutdigits','mandatoryDisposition','alias','addApplications','transaction','sequelize','Transaction','findOne','VoiceExtensionId','createRouting','bulkCreate','cast(priority\x20as\x20unsigned)','status','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','register','sendStatus'];(function(_0x8f240f,_0x4542ea){var _0x5510b6=function(_0x2fa7c4){while(--_0x2fa7c4){_0x8f240f['push'](_0x8f240f['shift']());}};_0x5510b6(++_0x4542ea);}(_0xff89,0x15f));var _0x9ff8=function(_0x5d26f5,_0x574917){_0x5d26f5=_0x5d26f5-0x0;var _0x4a9012=_0xff89[_0x5d26f5];return _0x4a9012;};'use strict';var _=require('lodash');var Redis=require(_0x9ff8('0x0'));var qs=require('../../components/parsers/qs');var logger=require(_0x9ff8('0x1'))(_0x9ff8('0x2'));var config=require(_0x9ff8('0x3'));var db=require(_0x9ff8('0x4'))['db'];config[_0x9ff8('0x5')]=_['defaults'](config[_0x9ff8('0x5')],{'host':_0x9ff8('0x6'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./voiceExtension.socket')[_0x9ff8('0x7')](socket);function respondWithStatusCode(_0x553601,_0x4a13d8){_0x4a13d8=_0x4a13d8||0xcc;return function(_0x23b7f9){if(_0x23b7f9){return _0x553601[_0x9ff8('0x8')](_0x4a13d8);}return _0x553601['status'](_0x4a13d8)[_0x9ff8('0x9')]();};}function respondWithResult(_0x5cf6b4,_0x1f1b69){_0x1f1b69=_0x1f1b69||0xc8;return function(_0xe8c2cd){if(_0xe8c2cd){return _0x5cf6b4['status'](_0x1f1b69)[_0x9ff8('0xa')](_0xe8c2cd);}};}function respondWithFilteredResult(_0x528fcb,_0x1b6e0d){return function(_0x555478){if(_0x555478){var _0x59f7b3=typeof _0x1b6e0d['offset']===_0x9ff8('0xb')&&typeof _0x1b6e0d[_0x9ff8('0xc')]===_0x9ff8('0xb');var _0x45a97c=_0x555478[_0x9ff8('0xd')];var _0x31c747=_0x59f7b3?0x0:_0x1b6e0d[_0x9ff8('0xe')];var _0x3bbeb5=_0x59f7b3?_0x555478['count']:_0x1b6e0d[_0x9ff8('0xe')]+_0x1b6e0d[_0x9ff8('0xc')];var _0x2b5772;if(_0x3bbeb5>=_0x45a97c){_0x3bbeb5=_0x45a97c;_0x2b5772=0xc8;}else{_0x2b5772=0xce;}_0x528fcb['status'](_0x2b5772);return _0x528fcb[_0x9ff8('0xf')](_0x9ff8('0x10'),_0x31c747+'-'+_0x3bbeb5+'/'+_0x45a97c)[_0x9ff8('0xa')](_0x555478);}return null;};}function removeEntity(_0x35065a){return function(_0x23d5c2){if(_0x23d5c2){return _0x23d5c2[_0x9ff8('0x11')]()[_0x9ff8('0x12')](function(){var _0x523d7f=_0x23d5c2['get']({'plain':!![]});var _0x136436=[{'name':_0x9ff8('0x13'),'value':_0x9ff8('0x14'),'ignore':![]},{'name':_0x9ff8('0x15'),'value':_0x9ff8('0x16'),'ignore':![]},{'name':_0x9ff8('0x17'),'value':_0x9ff8('0x18'),'ignore':![]}];var _0x385e6d=_(_0x136436)['filter'](_0x9ff8('0x19'))[_0x9ff8('0x1a')](_0x9ff8('0x1b'))[_0x9ff8('0x1b')]();if(_['includes'](_0x385e6d,_0x523d7f[_0x9ff8('0x1c')])){return;}var _0x2bf66d=_['find'](_0x136436,[_0x9ff8('0x1b'),_0x523d7f[_0x9ff8('0x1c')]])[_0x9ff8('0x1d')];return db[_0x9ff8('0x1e')][_0x9ff8('0x11')]({'where':{'type':_0x2bf66d,'resourceId':_0x523d7f['id']}})['then'](function(){return _0x23d5c2;});})['then'](function(){_0x35065a['status'](0xcc)[_0x9ff8('0x9')]();});}};}function handleEntityNotFound(_0x9d2323){return function(_0x30ae39){if(!_0x30ae39){_0x9d2323[_0x9ff8('0x8')](0x194);}return _0x30ae39;};}function handleError(_0x1a0bfc,_0x490ed8){_0x490ed8=_0x490ed8||0x1f4;return function(_0x4c46c2){logger[_0x9ff8('0x1f')](_0x4c46c2[_0x9ff8('0x20')]);if(_0x4c46c2[_0x9ff8('0x1d')]){delete _0x4c46c2['name'];}_0x1a0bfc['status'](_0x490ed8)[_0x9ff8('0x21')](_0x4c46c2);};}exports[_0x9ff8('0x22')]=function(_0x38c421,_0x24f380){var _0x602615={},_0x35e18b={},_0x5dd227={'count':0x0,'rows':[]};var _0x49443d=_[_0x9ff8('0x1a')](db[_0x9ff8('0x23')][_0x9ff8('0x24')],function(_0x32c43d){return{'name':_0x32c43d['fieldName'],'type':_0x32c43d['type'][_0x9ff8('0x25')]};});_0x35e18b[_0x9ff8('0x26')]=_['map'](_0x49443d,_0x9ff8('0x1d'));_0x35e18b['query']=_[_0x9ff8('0x27')](_0x38c421[_0x9ff8('0x28')]);_0x35e18b['filters']=_[_0x9ff8('0x29')](_0x35e18b['model'],_0x35e18b['query']);_0x602615[_0x9ff8('0x2a')]=_[_0x9ff8('0x29')](_0x35e18b[_0x9ff8('0x26')],qs[_0x9ff8('0x2b')](_0x38c421[_0x9ff8('0x28')][_0x9ff8('0x2b')]));_0x602615['attributes']=_0x602615[_0x9ff8('0x2a')][_0x9ff8('0x2c')]?_0x602615['attributes']:_0x35e18b['model'];if(!_0x38c421[_0x9ff8('0x28')][_0x9ff8('0x2d')](_0x9ff8('0x2e'))){_0x602615[_0x9ff8('0xc')]=qs['limit'](_0x38c421[_0x9ff8('0x28')][_0x9ff8('0xc')]);_0x602615['offset']=qs[_0x9ff8('0xe')](_0x38c421[_0x9ff8('0x28')][_0x9ff8('0xe')]);}_0x602615[_0x9ff8('0x2f')]=qs[_0x9ff8('0x30')](_0x38c421[_0x9ff8('0x28')][_0x9ff8('0x30')]);_0x602615['where']=qs[_0x9ff8('0x31')](_[_0x9ff8('0x32')](_0x38c421[_0x9ff8('0x28')],_0x35e18b[_0x9ff8('0x31')]),_0x49443d);if(_0x38c421[_0x9ff8('0x28')][_0x9ff8('0x33')]){_0x602615['where']=_[_0x9ff8('0x34')](_0x602615[_0x9ff8('0x35')],{'$or':_[_0x9ff8('0x1a')](_0x49443d,function(_0x5e962b){if(_0x5e962b['type']!==_0x9ff8('0x36')){var _0x174fe6={};_0x174fe6[_0x5e962b['name']]={'$like':'%'+_0x38c421[_0x9ff8('0x28')][_0x9ff8('0x33')]+'%'};return _0x174fe6;}})});}_0x602615=_['merge']({},_0x602615,_0x38c421[_0x9ff8('0x37')]);var _0x3b4deb={'where':_0x602615[_0x9ff8('0x35')]};return db[_0x9ff8('0x23')][_0x9ff8('0xd')](_0x3b4deb)[_0x9ff8('0x12')](function(_0x1f9876){_0x5dd227[_0x9ff8('0xd')]=_0x1f9876;if(_0x38c421[_0x9ff8('0x28')][_0x9ff8('0x38')]){_0x602615[_0x9ff8('0x39')]=[{'all':!![]}];}return db[_0x9ff8('0x23')][_0x9ff8('0x3a')](_0x602615);})[_0x9ff8('0x12')](function(_0x4a981c){_0x5dd227[_0x9ff8('0x3b')]=_0x4a981c;return _0x5dd227;})[_0x9ff8('0x12')](respondWithFilteredResult(_0x24f380,_0x602615))[_0x9ff8('0x3c')](handleError(_0x24f380,null));};exports[_0x9ff8('0x3d')]=function(_0xd3bfd9,_0x1a10bf){var _0x21ba2b={'raw':![],'where':{'id':_0xd3bfd9[_0x9ff8('0x3e')]['id']}},_0x313cce={};_0x313cce[_0x9ff8('0x26')]=_[_0x9ff8('0x27')](db[_0x9ff8('0x23')][_0x9ff8('0x24')]);_0x313cce[_0x9ff8('0x28')]=_[_0x9ff8('0x27')](_0xd3bfd9['query']);_0x313cce[_0x9ff8('0x31')]=_['intersection'](_0x313cce[_0x9ff8('0x26')],_0x313cce[_0x9ff8('0x28')]);_0x21ba2b[_0x9ff8('0x2a')]=_[_0x9ff8('0x29')](_0x313cce[_0x9ff8('0x26')],qs[_0x9ff8('0x2b')](_0xd3bfd9[_0x9ff8('0x28')]['fields']));_0x21ba2b['attributes']=_0x21ba2b[_0x9ff8('0x2a')][_0x9ff8('0x2c')]?_0x21ba2b['attributes']:_0x313cce[_0x9ff8('0x26')];if(_0xd3bfd9['query'][_0x9ff8('0x38')]){_0x21ba2b[_0x9ff8('0x39')]=[{'all':!![]}];}_0x21ba2b=_[_0x9ff8('0x34')]({},_0x21ba2b,_0xd3bfd9['options']);return db[_0x9ff8('0x23')][_0x9ff8('0x3f')](_0x21ba2b)[_0x9ff8('0x12')](handleEntityNotFound(_0x1a10bf,null))['then'](respondWithResult(_0x1a10bf,null))[_0x9ff8('0x3c')](handleError(_0x1a10bf,null));};exports['destroy']=function(_0x39987f,_0x1127a7){return db['VoiceExtension'][_0x9ff8('0x3f')]({'where':{'id':_0x39987f[_0x9ff8('0x3e')]['id']}})[_0x9ff8('0x12')](handleEntityNotFound(_0x1127a7,null))[_0x9ff8('0x12')](removeEntity(_0x1127a7,null))[_0x9ff8('0x3c')](handleError(_0x1127a7,null));};exports[_0x9ff8('0x40')]=function(_0x41ec6e,_0x354ae5){if(_0x41ec6e[_0x9ff8('0x41')][_0x9ff8('0x1c')]===_0x9ff8('0x16')&&!_[_0x9ff8('0x42')](_0x41ec6e[_0x9ff8('0x41')][_0x9ff8('0x43')],'_')){_0x41ec6e[_0x9ff8('0x41')][_0x9ff8('0x43')]='_'[_0x9ff8('0x44')](_0x41ec6e[_0x9ff8('0x41')][_0x9ff8('0x43')]);}return db[_0x9ff8('0x23')][_0x9ff8('0x40')](_0x41ec6e[_0x9ff8('0x41')],{'raw':![]})[_0x9ff8('0x12')](function(_0x1ad764){var _0x29ca1a=_0x41ec6e[_0x9ff8('0x45')][_0x9ff8('0x46')]({'plain':!![]});if(!_0x29ca1a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x29ca1a[_0x9ff8('0x47')]===_0x9ff8('0x45')){var _0x46dd4b=_0x1ad764['get']({'plain':!![]});var _0x3bb712=[{'name':_0x9ff8('0x13'),'value':_0x9ff8('0x14')},{'name':'OutboundRoutes','value':'outbound'},{'name':_0x9ff8('0x17'),'value':_0x9ff8('0x18')}];var _0x22d791=_[_0x9ff8('0x3f')](_0x3bb712,[_0x9ff8('0x1b'),_0x46dd4b[_0x9ff8('0x1c')]])[_0x9ff8('0x1d')];return db[_0x9ff8('0x48')]['find']({'where':{'name':_0x22d791,'userProfileId':_0x29ca1a[_0x9ff8('0x49')]},'raw':!![]})['then'](function(_0x59b879){if(_0x59b879&&_0x59b879[_0x9ff8('0x4a')]===0x0){return db['UserProfileResource'][_0x9ff8('0x40')]({'name':_0x46dd4b[_0x9ff8('0x1d')],'resourceId':_0x46dd4b['id'],'type':_0x59b879[_0x9ff8('0x1d')],'sectionId':_0x59b879['id']},{})[_0x9ff8('0x12')](function(){return _0x1ad764;});}else{return _0x1ad764;}})[_0x9ff8('0x3c')](function(_0x36aa72){logger[_0x9ff8('0x1f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x36aa72);throw _0x36aa72;});}return _0x1ad764;})['then'](respondWithResult(_0x354ae5,0xc9))[_0x9ff8('0x3c')](handleError(_0x354ae5,null));};exports[_0x9ff8('0x4b')]=function(_0xb7c28e,_0x3b2329){if(_0xb7c28e['body']['id']){delete _0xb7c28e[_0x9ff8('0x41')]['id'];}return db[_0x9ff8('0x23')][_0x9ff8('0x3f')]({'where':{'id':_0xb7c28e['params']['id']}})[_0x9ff8('0x12')](handleEntityNotFound(_0x3b2329,null))[_0x9ff8('0x12')](function(_0x18e563){if(_0x18e563){return db[_0x9ff8('0x23')][_0x9ff8('0x4b')](_[_0x9ff8('0x32')](_0xb7c28e[_0x9ff8('0x41')],[_0x9ff8('0x43'),_0x9ff8('0x4c'),'description','recordingFormat',_0x9ff8('0x4d'),_0x9ff8('0x4e'),_0x9ff8('0x4f')]),{'where':{'context':_0x18e563[_0x9ff8('0x4c')],'exten':_0x18e563[_0x9ff8('0x43')]},'individualHooks':!![]})[_0x9ff8('0x12')](function(_0x48c1d4){return _0x48c1d4;});}return null;})[_0x9ff8('0x12')](respondWithStatusCode(_0x3b2329,null))['catch'](handleError(_0x3b2329,null));};exports[_0x9ff8('0x50')]=function(_0x3823d8,_0x168d7f){var _0x465365=_0x3823d8['params']['id'];var _0x154fc3=_0x3823d8[_0x9ff8('0x41')];var _0x8c4b1c=0xc8;var _0x14253a=null;return db['sequelize'][_0x9ff8('0x51')]({'isolationLevel':db[_0x9ff8('0x52')][_0x9ff8('0x53')]['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x3902f1){return db[_0x9ff8('0x23')][_0x9ff8('0x54')]({'where':{'id':_0x465365},'transaction':_0x3902f1})['then'](function(_0x4ec7b8){if(_0x4ec7b8){return db[_0x9ff8('0x23')]['destroy']({'where':{'VoiceExtensionId':_0x465365},'transaction':_0x3902f1})[_0x9ff8('0x12')](function(){var _0x39d8d0=_[_0x9ff8('0x1a')](_0x154fc3,function(_0x146c5e){_0x146c5e[_0x9ff8('0x55')]=_0x465365;_0x146c5e['isApp']=!![];return _0x146c5e;});return _0x4ec7b8[_0x9ff8('0x56')](_0x39d8d0);})['then'](function(_0x9f7dba){return db['VoiceExtension'][_0x9ff8('0x57')](_0x9f7dba,{'transaction':_0x3902f1});});}else{_0x8c4b1c=0x194;_0x14253a=[];}});})[_0x9ff8('0x12')](function(){if(_0x8c4b1c!==0x194){return db['VoiceExtension']['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x465365},'order':_0x9ff8('0x58')})[_0x9ff8('0x12')](function(_0x7d174b){_0x14253a=_0x7d174b;});}})[_0x9ff8('0x3c')](function(_0x1c9519){_0x8c4b1c=0x1f4;logger[_0x9ff8('0x1f')](_0x1c9519[_0x9ff8('0x20')]);if(_0x1c9519['name']){delete _0x1c9519['name'];}_0x14253a=_0x1c9519;})['finally'](function(){if(_0x14253a===null){_0x168d7f['sendStatus'](_0x8c4b1c);}else{if(_0x8c4b1c===0x1f4){_0x168d7f[_0x9ff8('0x59')](_0x8c4b1c)[_0x9ff8('0x21')](_0x14253a);}else{_0x168d7f[_0x9ff8('0x59')](_0x8c4b1c)[_0x9ff8('0xa')](_0x14253a);}}});}; \ No newline at end of file +var _0xa493=['value','type','find','then','error','stack','name','send','index','VoiceExtension','fieldName','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','where','pick','filter','VIRTUAL','merge','options','includeAll','rows','show','rawAttributes','length','catch','params','create','startsWith','body','exten','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','InternalRoutes','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','description','cutdigits','alias','addApplications','sequelize','ISOLATION_LEVELS','READ_COMMITTED','findOne','VoiceExtensionId','isApp','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','json','undefined','limit','count','offset','set','destroy','InboundRoutes','inbound','outbound','ignore','map'];(function(_0x504cf9,_0xdb5f7d){var _0x127065=function(_0x5b4c40){while(--_0x5b4c40){_0x504cf9['push'](_0x504cf9['shift']());}};_0x127065(++_0xdb5f7d);}(_0xa493,0xe6));var _0x3a49=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xa493[_0xfae23b];return _0x200640;};'use strict';var _=require('lodash');var Redis=require('ioredis');var qs=require(_0x3a49('0x0'));var logger=require(_0x3a49('0x1'))('api');var config=require(_0x3a49('0x2'));var db=require(_0x3a49('0x3'))['db'];config[_0x3a49('0x4')]=_['defaults'](config['redis'],{'host':_0x3a49('0x5'),'port':0x18eb});var socket=require(_0x3a49('0x6'))(new Redis(config['redis']));require('./voiceExtension.socket')[_0x3a49('0x7')](socket);function respondWithStatusCode(_0x2d32c2,_0x39ce08){_0x39ce08=_0x39ce08||0xcc;return function(_0x42dd1c){if(_0x42dd1c){return _0x2d32c2[_0x3a49('0x8')](_0x39ce08);}return _0x2d32c2['status'](_0x39ce08)['end']();};}function respondWithResult(_0x2aa3eb,_0xb40472){_0xb40472=_0xb40472||0xc8;return function(_0x5a669f){if(_0x5a669f){return _0x2aa3eb[_0x3a49('0x9')](_0xb40472)[_0x3a49('0xa')](_0x5a669f);}};}function respondWithFilteredResult(_0x19161b,_0x382e5b){return function(_0x7459f5){if(_0x7459f5){var _0x1eb080=typeof _0x382e5b['offset']===_0x3a49('0xb')&&typeof _0x382e5b[_0x3a49('0xc')]===_0x3a49('0xb');var _0xa8bce2=_0x7459f5[_0x3a49('0xd')];var _0x5df0b3=_0x1eb080?0x0:_0x382e5b[_0x3a49('0xe')];var _0x439c7b=_0x1eb080?_0x7459f5[_0x3a49('0xd')]:_0x382e5b[_0x3a49('0xe')]+_0x382e5b[_0x3a49('0xc')];var _0x382444;if(_0x439c7b>=_0xa8bce2){_0x439c7b=_0xa8bce2;_0x382444=0xc8;}else{_0x382444=0xce;}_0x19161b[_0x3a49('0x9')](_0x382444);return _0x19161b[_0x3a49('0xf')]('Content-Range',_0x5df0b3+'-'+_0x439c7b+'/'+_0xa8bce2)[_0x3a49('0xa')](_0x7459f5);}return null;};}function removeEntity(_0x480ed3){return function(_0xd762c){if(_0xd762c){return _0xd762c[_0x3a49('0x10')]()['then'](function(){var _0x11504f=_0xd762c['get']({'plain':!![]});var _0x475df6=[{'name':_0x3a49('0x11'),'value':_0x3a49('0x12'),'ignore':![]},{'name':'OutboundRoutes','value':_0x3a49('0x13'),'ignore':![]},{'name':'InternalRoutes','value':'internal','ignore':![]}];var _0x365a40=_(_0x475df6)['filter'](_0x3a49('0x14'))[_0x3a49('0x15')](_0x3a49('0x16'))[_0x3a49('0x16')]();if(_['includes'](_0x365a40,_0x11504f[_0x3a49('0x17')])){return;}var _0x514c80=_[_0x3a49('0x18')](_0x475df6,['value',_0x11504f[_0x3a49('0x17')]])['name'];return db['UserProfileResource']['destroy']({'where':{'type':_0x514c80,'resourceId':_0x11504f['id']}})[_0x3a49('0x19')](function(){return _0xd762c;});})[_0x3a49('0x19')](function(){_0x480ed3[_0x3a49('0x9')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5cd3cc){return function(_0x1dc34c){if(!_0x1dc34c){_0x5cd3cc['sendStatus'](0x194);}return _0x1dc34c;};}function handleError(_0x20e07a,_0x5120b4){_0x5120b4=_0x5120b4||0x1f4;return function(_0x55b0fe){logger[_0x3a49('0x1a')](_0x55b0fe[_0x3a49('0x1b')]);if(_0x55b0fe[_0x3a49('0x1c')]){delete _0x55b0fe['name'];}_0x20e07a[_0x3a49('0x9')](_0x5120b4)[_0x3a49('0x1d')](_0x55b0fe);};}exports[_0x3a49('0x1e')]=function(_0x54162d,_0x2321ab){var _0x37b9cd={},_0x69e574={},_0x250aa7={'count':0x0,'rows':[]};var _0x2ecf5b=_[_0x3a49('0x15')](db[_0x3a49('0x1f')]['rawAttributes'],function(_0x17c14a){return{'name':_0x17c14a[_0x3a49('0x20')],'type':_0x17c14a[_0x3a49('0x17')]['key']};});_0x69e574['model']=_[_0x3a49('0x15')](_0x2ecf5b,'name');_0x69e574[_0x3a49('0x21')]=_[_0x3a49('0x22')](_0x54162d[_0x3a49('0x21')]);_0x69e574[_0x3a49('0x23')]=_[_0x3a49('0x24')](_0x69e574[_0x3a49('0x25')],_0x69e574[_0x3a49('0x21')]);_0x37b9cd[_0x3a49('0x26')]=_[_0x3a49('0x24')](_0x69e574['model'],qs[_0x3a49('0x27')](_0x54162d[_0x3a49('0x21')][_0x3a49('0x27')]));_0x37b9cd[_0x3a49('0x26')]=_0x37b9cd['attributes']['length']?_0x37b9cd[_0x3a49('0x26')]:_0x69e574[_0x3a49('0x25')];if(!_0x54162d['query'][_0x3a49('0x28')](_0x3a49('0x29'))){_0x37b9cd['limit']=qs[_0x3a49('0xc')](_0x54162d['query'][_0x3a49('0xc')]);_0x37b9cd[_0x3a49('0xe')]=qs[_0x3a49('0xe')](_0x54162d[_0x3a49('0x21')][_0x3a49('0xe')]);}_0x37b9cd[_0x3a49('0x2a')]=qs['sort'](_0x54162d[_0x3a49('0x21')]['sort']);_0x37b9cd[_0x3a49('0x2b')]=qs[_0x3a49('0x23')](_[_0x3a49('0x2c')](_0x54162d['query'],_0x69e574[_0x3a49('0x23')]),_0x2ecf5b);if(_0x54162d[_0x3a49('0x21')][_0x3a49('0x2d')]){_0x37b9cd[_0x3a49('0x2b')]=_['merge'](_0x37b9cd['where'],{'$or':_['map'](_0x2ecf5b,function(_0x4a0531){if(_0x4a0531[_0x3a49('0x17')]!==_0x3a49('0x2e')){var _0x38efed={};_0x38efed[_0x4a0531[_0x3a49('0x1c')]]={'$like':'%'+_0x54162d[_0x3a49('0x21')][_0x3a49('0x2d')]+'%'};return _0x38efed;}})});}_0x37b9cd=_[_0x3a49('0x2f')]({},_0x37b9cd,_0x54162d[_0x3a49('0x30')]);var _0x379aa5={'where':_0x37b9cd['where']};return db[_0x3a49('0x1f')]['count'](_0x379aa5)[_0x3a49('0x19')](function(_0x2d79fd){_0x250aa7[_0x3a49('0xd')]=_0x2d79fd;if(_0x54162d['query'][_0x3a49('0x31')]){_0x37b9cd['include']=[{'all':!![]}];}return db[_0x3a49('0x1f')]['findAll'](_0x37b9cd);})[_0x3a49('0x19')](function(_0x4c1cb7){_0x250aa7[_0x3a49('0x32')]=_0x4c1cb7;return _0x250aa7;})[_0x3a49('0x19')](respondWithFilteredResult(_0x2321ab,_0x37b9cd))['catch'](handleError(_0x2321ab,null));};exports[_0x3a49('0x33')]=function(_0x33666a,_0x297833){var _0xcdd787={'raw':![],'where':{'id':_0x33666a['params']['id']}},_0x59498a={};_0x59498a[_0x3a49('0x25')]=_['keys'](db[_0x3a49('0x1f')][_0x3a49('0x34')]);_0x59498a[_0x3a49('0x21')]=_[_0x3a49('0x22')](_0x33666a[_0x3a49('0x21')]);_0x59498a[_0x3a49('0x23')]=_[_0x3a49('0x24')](_0x59498a[_0x3a49('0x25')],_0x59498a[_0x3a49('0x21')]);_0xcdd787[_0x3a49('0x26')]=_[_0x3a49('0x24')](_0x59498a['model'],qs[_0x3a49('0x27')](_0x33666a[_0x3a49('0x21')][_0x3a49('0x27')]));_0xcdd787['attributes']=_0xcdd787[_0x3a49('0x26')][_0x3a49('0x35')]?_0xcdd787['attributes']:_0x59498a[_0x3a49('0x25')];if(_0x33666a[_0x3a49('0x21')][_0x3a49('0x31')]){_0xcdd787['include']=[{'all':!![]}];}_0xcdd787=_[_0x3a49('0x2f')]({},_0xcdd787,_0x33666a['options']);return db[_0x3a49('0x1f')]['find'](_0xcdd787)[_0x3a49('0x19')](handleEntityNotFound(_0x297833,null))[_0x3a49('0x19')](respondWithResult(_0x297833,null))[_0x3a49('0x36')](handleError(_0x297833,null));};exports['destroy']=function(_0x75155c,_0x42d2ca){return db[_0x3a49('0x1f')][_0x3a49('0x18')]({'where':{'id':_0x75155c[_0x3a49('0x37')]['id']}})[_0x3a49('0x19')](handleEntityNotFound(_0x42d2ca,null))['then'](removeEntity(_0x42d2ca,null))['catch'](handleError(_0x42d2ca,null));};exports[_0x3a49('0x38')]=function(_0x3170f2,_0x5af349){if(_0x3170f2['body']['type']===_0x3a49('0x13')&&!_[_0x3a49('0x39')](_0x3170f2[_0x3a49('0x3a')][_0x3a49('0x3b')],'_')){_0x3170f2[_0x3a49('0x3a')][_0x3a49('0x3b')]='_'['concat'](_0x3170f2['body']['exten']);}return db['VoiceExtension'][_0x3a49('0x38')](_0x3170f2['body'],{'raw':![]})[_0x3a49('0x19')](function(_0x29e8b5){var _0x587e45=_0x3170f2['user']['get']({'plain':!![]});if(!_0x587e45)throw new Error(_0x3a49('0x3c'));if(_0x587e45['role']===_0x3a49('0x3d')){var _0x46a24b=_0x29e8b5[_0x3a49('0x3e')]({'plain':!![]});var _0x1313e9=[{'name':_0x3a49('0x11'),'value':_0x3a49('0x12')},{'name':'OutboundRoutes','value':_0x3a49('0x13')},{'name':_0x3a49('0x3f'),'value':'internal'}];var _0x444935=_['find'](_0x1313e9,[_0x3a49('0x16'),_0x46a24b[_0x3a49('0x17')]])[_0x3a49('0x1c')];return db[_0x3a49('0x40')][_0x3a49('0x18')]({'where':{'name':_0x444935,'userProfileId':_0x587e45[_0x3a49('0x41')]},'raw':!![]})[_0x3a49('0x19')](function(_0x393179){if(_0x393179&&_0x393179[_0x3a49('0x42')]===0x0){return db['UserProfileResource'][_0x3a49('0x38')]({'name':_0x46a24b['name'],'resourceId':_0x46a24b['id'],'type':_0x393179['name'],'sectionId':_0x393179['id']},{})[_0x3a49('0x19')](function(){return _0x29e8b5;});}else{return _0x29e8b5;}})[_0x3a49('0x36')](function(_0x489c2f){logger[_0x3a49('0x1a')](_0x3a49('0x43'),_0x489c2f);throw _0x489c2f;});}return _0x29e8b5;})[_0x3a49('0x19')](respondWithResult(_0x5af349,0xc9))[_0x3a49('0x36')](handleError(_0x5af349,null));};exports[_0x3a49('0x44')]=function(_0x49ad80,_0xb3e3f9){if(_0x49ad80['body']['id']){delete _0x49ad80[_0x3a49('0x3a')]['id'];}return db[_0x3a49('0x1f')][_0x3a49('0x18')]({'where':{'id':_0x49ad80[_0x3a49('0x37')]['id']}})['then'](handleEntityNotFound(_0xb3e3f9,null))[_0x3a49('0x19')](function(_0x1e44b8){if(_0x1e44b8){return db[_0x3a49('0x1f')][_0x3a49('0x44')](_[_0x3a49('0x2c')](_0x49ad80[_0x3a49('0x3a')],[_0x3a49('0x3b'),_0x3a49('0x45'),_0x3a49('0x46'),'recordingFormat',_0x3a49('0x47'),'mandatoryDisposition',_0x3a49('0x48')]),{'where':{'context':_0x1e44b8['context'],'exten':_0x1e44b8[_0x3a49('0x3b')]},'individualHooks':!![]})[_0x3a49('0x19')](function(_0x3f7a1c){return _0x3f7a1c;});}return null;})['then'](respondWithStatusCode(_0xb3e3f9,null))[_0x3a49('0x36')](handleError(_0xb3e3f9,null));};exports[_0x3a49('0x49')]=function(_0x1221cc,_0x3fbb50){var _0x203bb3=_0x1221cc[_0x3a49('0x37')]['id'];var _0x2442a8=_0x1221cc[_0x3a49('0x3a')];var _0x1b17b6=0xc8;var _0x2dc34b=null;return db[_0x3a49('0x4a')]['transaction']({'isolationLevel':db[_0x3a49('0x4a')]['Transaction'][_0x3a49('0x4b')][_0x3a49('0x4c')]},function(_0x23d23c){return db[_0x3a49('0x1f')][_0x3a49('0x4d')]({'where':{'id':_0x203bb3},'transaction':_0x23d23c})[_0x3a49('0x19')](function(_0xe9cea4){if(_0xe9cea4){return db['VoiceExtension'][_0x3a49('0x10')]({'where':{'VoiceExtensionId':_0x203bb3},'transaction':_0x23d23c})[_0x3a49('0x19')](function(){var _0x216a1d=_[_0x3a49('0x15')](_0x2442a8,function(_0x350622){_0x350622[_0x3a49('0x4e')]=_0x203bb3;_0x350622[_0x3a49('0x4f')]=!![];return _0x350622;});return _0xe9cea4['createRouting'](_0x216a1d);})[_0x3a49('0x19')](function(_0x4e14ea){return db[_0x3a49('0x1f')][_0x3a49('0x50')](_0x4e14ea,{'transaction':_0x23d23c});});}else{_0x1b17b6=0x194;_0x2dc34b=[];}});})['then'](function(){if(_0x1b17b6!==0x194){return db[_0x3a49('0x1f')][_0x3a49('0x51')]({'where':{'isApp':!![],'VoiceExtensionId':_0x203bb3},'order':_0x3a49('0x52')})[_0x3a49('0x19')](function(_0xfa4021){_0x2dc34b=_0xfa4021;});}})['catch'](function(_0x3f1ab9){_0x1b17b6=0x1f4;logger[_0x3a49('0x1a')](_0x3f1ab9[_0x3a49('0x1b')]);if(_0x3f1ab9[_0x3a49('0x1c')]){delete _0x3f1ab9[_0x3a49('0x1c')];}_0x2dc34b=_0x3f1ab9;})[_0x3a49('0x53')](function(){if(_0x2dc34b===null){_0x3fbb50[_0x3a49('0x8')](_0x1b17b6);}else{if(_0x1b17b6===0x1f4){_0x3fbb50[_0x3a49('0x9')](_0x1b17b6)[_0x3a49('0x1d')](_0x2dc34b);}else{_0x3fbb50[_0x3a49('0x9')](_0x1b17b6)[_0x3a49('0xa')](_0x2dc34b);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 86150d0..b0e694c 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 _0xae5c=['emit','hasOwnProperty','exports','events','../../mysqldb','VoiceExtension','setMaxListeners','save','update','remove'];(function(_0x7656c7,_0x29d479){var _0x4d4ca5=function(_0x46cd82){while(--_0x46cd82){_0x7656c7['push'](_0x7656c7['shift']());}};_0x4d4ca5(++_0x29d479);}(_0xae5c,0x7b));var _0xcae5=function(_0x4a8da4,_0x332484){_0x4a8da4=_0x4a8da4-0x0;var _0xe6a853=_0xae5c[_0x4a8da4];return _0xe6a853;};'use strict';var EventEmitter=require(_0xcae5('0x0'));var VoiceExtension=require(_0xcae5('0x1'))['db'][_0xcae5('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xcae5('0x3')](0x0);var events={'afterCreate':_0xcae5('0x4'),'afterUpdate':_0xcae5('0x5'),'afterDestroy':_0xcae5('0x6')};function emitEvent(_0x42ef94){return function(_0x485419,_0x1b751f,_0x309cdb){VoiceExtensionEvents[_0xcae5('0x7')](_0x42ef94+':'+_0x485419['id'],_0x485419);VoiceExtensionEvents[_0xcae5('0x7')](_0x42ef94,_0x485419);_0x309cdb(null);};}for(var e in events){if(events[_0xcae5('0x8')](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module[_0xcae5('0x9')]=VoiceExtensionEvents; \ No newline at end of file +var _0x508a=['emit','hasOwnProperty','exports','VoiceExtension','setMaxListeners','remove'];(function(_0x3794a3,_0x10ba20){var _0x51e4a4=function(_0x2bab8f){while(--_0x2bab8f){_0x3794a3['push'](_0x3794a3['shift']());}};_0x51e4a4(++_0x10ba20);}(_0x508a,0xdb));var _0xa508=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x508a[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var VoiceExtension=require('../../mysqldb')['db'][_0xa508('0x0')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xa508('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xa508('0x2')};function emitEvent(_0x477de2){return function(_0x2901ad,_0x330079,_0x2d35a5){VoiceExtensionEvents[_0xa508('0x3')](_0x477de2+':'+_0x2901ad['id'],_0x2901ad);VoiceExtensionEvents[_0xa508('0x3')](_0x477de2,_0x2901ad);_0x2d35a5(null);};}for(var e in events){if(events[_0xa508('0x4')](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module[_0xa508('0x5')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index e51fe82..e1a5dd5 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 _0x3ef4=['join','options','none','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','findAll','interval','IntervalId','then','intervals','map','filter','tag','toLowerCase','CDR(tag)=','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','queue','playback','includes','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','splice','GotoIfTime',',${EXTEN},','appdata','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','priority','last','catch','define','voice_extensions','get','concat','Hangup','lodash','./voiceExtension.attributes','models','type','CDR(type)=','exten','inbound','push','Set','XCALLY-MOTION-ANSWER=0','context','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','CDR(routeid)=','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=noprefix','hasOwnProperty','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','timeout','split','length','trunk','param','prefix','phone','SIP'];(function(_0x3b5094,_0x405a91){var _0x2fc64d=function(_0x1b3b68){while(--_0x1b3b68){_0x3b5094['push'](_0x3b5094['shift']());}};_0x2fc64d(++_0x405a91);}(_0x3ef4,0xc4));var _0x43ef=function(_0x1d116b,_0x4924ec){_0x1d116b=_0x1d116b-0x0;var _0x13db0c=_0x3ef4[_0x1d116b];return _0x13db0c;};'use strict';var _=require(_0x43ef('0x0'));var attributes=require(_0x43ef('0x1'));module['exports']=function(_0x3bec06){var _0x2432b4=_0x3bec06[_0x43ef('0x2')];function _0x2e7b0e(_0x26fd9c){var _0xa2a1d0=0x2;var _0x3d9a42=[{'type':_0x26fd9c[_0x43ef('0x3')],'app':'Set','appdata':_0x43ef('0x4')+_0x26fd9c[_0x43ef('0x3')],'context':_0x26fd9c['context'],'exten':_0x26fd9c[_0x43ef('0x5')],'priority':_0xa2a1d0++,'VoiceExtensionId':_0x26fd9c['id']}];if(_0x26fd9c[_0x43ef('0x3')]===_0x43ef('0x6')){_0x3d9a42[_0x43ef('0x7')]({'type':_0x43ef('0x6'),'app':'Set','appdata':'CDR(routeid)='+_0x26fd9c['id'],'context':_0x26fd9c['context'],'exten':_0x26fd9c[_0x43ef('0x5')],'priority':_0xa2a1d0++,'VoiceExtensionId':_0x26fd9c['id']});}_0x3d9a42[_0x43ef('0x7')]({'type':_0x26fd9c[_0x43ef('0x3')],'app':_0x43ef('0x8'),'appdata':_0x43ef('0x9'),'context':_0x26fd9c[_0x43ef('0xa')],'exten':_0x26fd9c[_0x43ef('0x5')],'priority':_0xa2a1d0++,'VoiceExtensionId':_0x26fd9c['id']},{'type':_0x26fd9c[_0x43ef('0x3')],'app':_0x43ef('0x8'),'appdata':_0x43ef('0xb'),'context':_0x26fd9c[_0x43ef('0xa')],'exten':_0x26fd9c[_0x43ef('0x5')],'priority':_0xa2a1d0++,'VoiceExtensionId':_0x26fd9c['id']},{'type':_0x26fd9c[_0x43ef('0x3')],'app':_0x43ef('0x8'),'appdata':_0x43ef('0xc'),'context':_0x26fd9c['context'],'exten':_0x26fd9c[_0x43ef('0x5')],'priority':_0xa2a1d0++,'VoiceExtensionId':_0x26fd9c['id']});return _0x3d9a42;}function _0x174846(_0x106bc3){var _0x292fd7=0x2;var _0x41db5b=[{'type':_0x43ef('0xd'),'app':_0x43ef('0x8'),'appdata':'CDR(type)=outbound','context':_0x106bc3[_0x43ef('0xa')],'exten':_0x106bc3[_0x43ef('0x5')],'priority':_0x292fd7++,'VoiceExtensionId':_0x106bc3['id']},{'type':_0x43ef('0xd'),'app':_0x43ef('0x8'),'appdata':_0x43ef('0xe')+(_0x106bc3[_0x43ef('0xf')]?_0x43ef('0x10')+_0x106bc3['cutdigits']+'}':_0x43ef('0x11')),'context':_0x106bc3['context'],'exten':_0x106bc3[_0x43ef('0x5')],'priority':_0x292fd7++,'VoiceExtensionId':_0x106bc3['id']},{'type':'outbound','app':_0x43ef('0x8'),'appdata':_0x43ef('0x12')+_0x106bc3['id'],'context':_0x106bc3[_0x43ef('0xa')],'exten':_0x106bc3[_0x43ef('0x5')],'priority':_0x292fd7++,'VoiceExtensionId':_0x106bc3['id']},{'type':_0x43ef('0xd'),'app':'ExecIf','appdata':_0x43ef('0x13')+(_0x292fd7+0x2)+_0x43ef('0x14')+(_0x292fd7+0x1)+')','context':_0x106bc3[_0x43ef('0xa')],'exten':_0x106bc3[_0x43ef('0x5')],'priority':_0x292fd7++,'VoiceExtensionId':_0x106bc3['id']},{'type':_0x43ef('0xd'),'app':_0x43ef('0x8'),'appdata':_0x106bc3['cutdigits']?'CDR(prefix)=${EXTEN:0:'+_0x106bc3['cutdigits']+'}':_0x43ef('0x15'),'context':_0x106bc3['context'],'exten':_0x106bc3[_0x43ef('0x5')],'priority':_0x292fd7++,'VoiceExtensionId':_0x106bc3['id']},{'type':_0x43ef('0xd'),'app':_0x43ef('0x8'),'appdata':_0x43ef('0x9'),'context':_0x106bc3[_0x43ef('0xa')],'exten':_0x106bc3[_0x43ef('0x5')],'priority':_0x292fd7++,'VoiceExtensionId':_0x106bc3['id']},{'type':'outbound','app':_0x43ef('0x8'),'appdata':_0x43ef('0xb'),'context':_0x106bc3[_0x43ef('0xa')],'exten':_0x106bc3[_0x43ef('0x5')],'priority':_0x292fd7++,'VoiceExtensionId':_0x106bc3['id']},{'type':_0x43ef('0xd'),'app':'Set','appdata':_0x43ef('0xc'),'context':_0x106bc3[_0x43ef('0xa')],'exten':_0x106bc3['exten'],'priority':_0x292fd7++,'VoiceExtensionId':_0x106bc3['id']},{'type':'outbound','app':_0x43ef('0x8'),'appdata':'outboundrouteid='+_0x106bc3['id'],'context':_0x106bc3['context'],'exten':_0x106bc3[_0x43ef('0x5')],'priority':_0x292fd7++,'VoiceExtensionId':_0x106bc3['id']}];if(_0x106bc3[_0x43ef('0x16')](_0x43ef('0x17'))&&_0x106bc3[_0x43ef('0x17')]!=='none'){_0x41db5b[_0x43ef('0x7')]({'type':_0x43ef('0xd'),'app':'Set','appdata':_0x43ef('0x18'),'context':_0x106bc3[_0x43ef('0xa')],'exten':_0x106bc3[_0x43ef('0x5')],'priority':_0x292fd7++,'VoiceExtensionId':_0x106bc3['id']},{'type':_0x43ef('0xd'),'app':_0x43ef('0x8'),'appdata':_0x43ef('0x19')+_0x106bc3[_0x43ef('0x17')]||_0x43ef('0x1a'),'context':_0x106bc3[_0x43ef('0xa')],'exten':_0x106bc3[_0x43ef('0x5')],'priority':_0x292fd7++,'VoiceExtensionId':_0x106bc3['id']});}return _0x41db5b;}function _0x15737c(_0x309954,_0x7ed268){var _0x26612e=[{'name':'trunk','param':0x0},{'name':_0x43ef('0x1b'),'param':0x1},{'name':'options','param':0x2},{'name':'url','param':0x3}];var _0x399098={};var _0x2e5ed0=_0x7ed268[_0x43ef('0x1c')](',');var _0x2fd374=[];for(var _0x387d29=0x0;_0x387d29<_0x26612e[_0x43ef('0x1d')];_0x387d29++){switch(_0x26612e[_0x387d29]['name']){case _0x43ef('0x1e'):_0x399098[_0x43ef('0x1e')]=_0x2e5ed0[_0x26612e[_0x387d29][_0x43ef('0x1f')]][_0x43ef('0x1c')]('/')[0x1];_0x399098['phone']=_0x2e5ed0[_0x26612e[_0x387d29]['param']][_0x43ef('0x1c')]('/')[0x2];_0x399098[_0x43ef('0x20')]=_0x399098['phone']?_0x399098[_0x43ef('0x21')][_0x43ef('0x1c')]('$')[0x0]:undefined;_0x399098[_0x43ef('0x21')]=_0x309954[_0x43ef('0xf')]?(_0x399098[_0x43ef('0x20')]||'')+_0x43ef('0x10')+_0x309954[_0x43ef('0xf')]+'}':(_0x399098[_0x43ef('0x20')]||'')+'${EXTEN}';_0x2fd374[_0x26612e[_0x387d29][_0x43ef('0x1f')]]=[_0x43ef('0x22'),_0x399098[_0x43ef('0x1e')],_0x399098[_0x43ef('0x21')]][_0x43ef('0x23')]('/');break;case _0x43ef('0x24'):_0x399098[_0x43ef('0x24')]=_0x2e5ed0[_0x26612e[_0x387d29][_0x43ef('0x1f')]];if(_0x309954['recordingFormat']!==_0x43ef('0x25')){if(_0x399098[_0x43ef('0x24')][_0x43ef('0x26')](_0x43ef('0x27'))<0x0){_0x399098['options']+=_0x43ef('0x27');}}else{_0x399098[_0x43ef('0x24')]=_0x399098[_0x43ef('0x24')][_0x43ef('0x28')](_0x43ef('0x27'),'');}_0x2fd374[_0x26612e[_0x387d29][_0x43ef('0x1f')]]=_0x399098[_0x43ef('0x24')];break;default:_0x2fd374[_0x26612e[_0x387d29][_0x43ef('0x1f')]]=_0x2e5ed0[_0x26612e[_0x387d29][_0x43ef('0x1f')]];}}return _0x2fd374['join'](',');}function _0x54c886(_0x453e8e,_0x6a072c,_0x35843a){return new Promise(function(_0x52ca1f,_0x598c69){var _0x595f0d=[];if(_[_0x43ef('0x29')](_0x6a072c))return _0x52ca1f(_0x595f0d);_0x2432b4['Interval'][_0x43ef('0x2a')]({'attributes':['id',_0x43ef('0x2b'),_0x43ef('0x2c')],'raw':!![]})[_0x43ef('0x2d')](function(_0x4518d2){for(var _0x218b77=0x0,_0x20d1f4=0x0;_0x218b77<_0x6a072c[_0x43ef('0x1d')];_0x218b77++,_0x20d1f4=0x0){var _0x36d23d=_0x6a072c[_0x218b77];var _0x5bfb02=[];var _0x227c5a=[];delete _0x36d23d['id'];if(_0x36d23d['interval']!=='*,*,*,*'){_0x36d23d[_0x43ef('0x2e')]=[_0x36d23d[_0x43ef('0x2b')]];}else{_0x36d23d[_0x43ef('0x2e')]=_0x36d23d[_0x43ef('0x2c')]?_[_0x43ef('0x2f')](_[_0x43ef('0x30')](_0x4518d2,{'IntervalId':_0x36d23d[_0x43ef('0x2c')]}),_0x43ef('0x2b')):[];}_0x36d23d[_0x43ef('0xa')]=_0x453e8e[_0x43ef('0xa')];_0x36d23d[_0x43ef('0x5')]=_0x453e8e[_0x43ef('0x5')];if(_0x36d23d[_0x43ef('0x3')])_0x36d23d['type']=_0x36d23d[_0x43ef('0x3')]['toLowerCase']();if(_0x453e8e['type']===_0x43ef('0xd')){if(_0x36d23d[_0x43ef('0x16')](_0x43ef('0x31'))&&_0x36d23d[_0x43ef('0x31')]&&_0x36d23d[_0x43ef('0x31')]!=='--'){_0x5bfb02[_0x43ef('0x7')]({'type':_0x36d23d['type'][_0x43ef('0x32')](),'app':'Set','appdata':_0x43ef('0x33')+_0x36d23d['tag'],'context':_0x453e8e[_0x43ef('0xa')],'exten':_0x453e8e[_0x43ef('0x5')],'priority':_0x36d23d['intervals']['length']+_0x35843a+_0x20d1f4++,'VoiceExtensionId':_0x453e8e['id']});}_0x5bfb02[_0x43ef('0x7')]({'type':_0x36d23d[_0x43ef('0x3')]['toLowerCase'](),'app':_0x43ef('0x34'),'appdata':_0x43ef('0x35')+(_0x36d23d[_0x43ef('0x36')]?_0x43ef('0x37')+_0x36d23d['callerID']+')':_0x43ef('0x38')),'context':_0x453e8e['context'],'exten':_0x453e8e[_0x43ef('0x5')],'priority':_0x36d23d['intervals'][_0x43ef('0x1d')]+_0x35843a+_0x20d1f4++,'VoiceExtensionId':_0x453e8e['id']});}else{if(_0x36d23d[_0x43ef('0x16')](_0x43ef('0x39'))){if([_0x43ef('0x3a'),_0x43ef('0x3b')][_0x43ef('0x3c')](_0x36d23d['app'][_0x43ef('0x32')]())&&_0x36d23d[_0x43ef('0x3d')]!==_0x43ef('0x3e')){if(_0x36d23d[_0x43ef('0x39')]){_0x5bfb02[_0x43ef('0x7')]({'type':_0x36d23d[_0x43ef('0x3')][_0x43ef('0x32')](),'app':_0x43ef('0x34'),'appdata':_0x43ef('0x3f'),'context':_0x453e8e[_0x43ef('0xa')],'exten':_0x453e8e['exten'],'priority':_0x36d23d['intervals'][_0x43ef('0x1d')]+_0x35843a+_0x20d1f4++,'VoiceExtensionId':_0x453e8e['id']});_0x5bfb02[_0x43ef('0x7')]({'type':_0x36d23d[_0x43ef('0x3')][_0x43ef('0x32')](),'app':'Set','appdata':'XCALLY-MOTION-ANSWER=1','context':_0x453e8e['context'],'exten':_0x453e8e['exten'],'priority':_0x36d23d[_0x43ef('0x2e')][_0x43ef('0x1d')]+_0x35843a+_0x20d1f4++,'VoiceExtensionId':_0x453e8e['id']});}else{_0x5bfb02[_0x43ef('0x7')]({'type':_0x36d23d[_0x43ef('0x3')][_0x43ef('0x32')](),'app':_0x43ef('0x34'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x453e8e[_0x43ef('0xa')],'exten':_0x453e8e[_0x43ef('0x5')],'priority':_0x36d23d[_0x43ef('0x2e')][_0x43ef('0x1d')]+_0x35843a+_0x20d1f4++,'VoiceExtensionId':_0x453e8e['id']});_0x5bfb02[_0x43ef('0x7')]({'type':_0x36d23d[_0x43ef('0x3')][_0x43ef('0x32')](),'app':_0x43ef('0x8'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x453e8e['context'],'exten':_0x453e8e[_0x43ef('0x5')],'priority':_0x36d23d['intervals'][_0x43ef('0x1d')]+_0x35843a+_0x20d1f4++,'VoiceExtensionId':_0x453e8e['id']});}}}}for(var _0x13c3e9=0x0;_0x13c3e9<_0x36d23d['intervals'][_0x43ef('0x1d')];_0x13c3e9++){var _0x413cee=_0x35843a+_0x36d23d[_0x43ef('0x2e')]['length'];var _0x55cc64=_0x13c3e9===_0x36d23d[_0x43ef('0x2e')]['length']-0x1?_0x35843a+_0x5bfb02[_0x43ef('0x1d')]+_0x227c5a[_0x43ef('0x1d')]+0x2:_0x35843a+_0x13c3e9+0x1;_0x5bfb02[_0x43ef('0x40')](_0x13c3e9,0x0,{'type':_0x453e8e[_0x43ef('0x3')],'app':_0x43ef('0x41'),'appdata':_0x36d23d[_0x43ef('0x2e')][_0x13c3e9]+'?'+_0x453e8e[_0x43ef('0xa')]+',${EXTEN},'+_0x413cee+':'+_0x453e8e[_0x43ef('0xa')]+_0x43ef('0x42')+_0x55cc64,'exten':_0x453e8e['exten'],'context':_0x453e8e['context'],'priority':_0x35843a+_0x13c3e9,'VoiceExtensionId':_0x453e8e['id']});}if(_0x36d23d['appType']==='outboundDial'){_0x36d23d[_0x43ef('0x43')]=_0x15737c(_0x453e8e,_0x36d23d[_0x43ef('0x43')]);}if(_0x36d23d[_0x43ef('0x3d')]==='agi'){_0x5bfb02[_0x43ef('0x7')]({'type':_0x36d23d[_0x43ef('0x3')][_0x43ef('0x32')](),'app':_0x43ef('0x8'),'appdata':_0x43ef('0x44'),'context':_0x453e8e['context'],'exten':_0x453e8e[_0x43ef('0x5')],'priority':_0x36d23d[_0x43ef('0x2e')][_0x43ef('0x1d')]+_0x35843a+_0x20d1f4++,'VoiceExtensionId':_0x453e8e['id']});}_0x36d23d[_0x43ef('0x45')]=_0x5bfb02[_0x43ef('0x1d')]?_[_0x43ef('0x46')](_0x5bfb02)['priority']+0x1:_0x35843a;_0x595f0d=_['concat'](_0x595f0d,_0x5bfb02,[_0x36d23d],_0x227c5a);_0x35843a=_['last'](_0x595f0d)[_0x43ef('0x45')]+0x1;}return _0x52ca1f(_0x595f0d);})[_0x43ef('0x47')](function(_0xbc67ef){_0x598c69(_0xbc67ef);});});}return _0x3bec06[_0x43ef('0x48')]('VoiceExtension',attributes,{'tableName':_0x43ef('0x49'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x19664a){var _0x2a573f=this[_0x43ef('0x4a')]({'plain':!![]});var _0x27e093=_0x2a573f[_0x43ef('0x3')]==='outbound'?_0x174846(_0x2a573f):_0x2e7b0e(_0x2a573f);return _0x54c886(_0x2a573f,_0x19664a,_['last'](_0x27e093)['priority']+0x1)[_0x43ef('0x2d')](function(_0x4caf3c){var _0x4280e3=_[_0x43ef('0x4b')](_0x27e093,_0x4caf3c);_0x4280e3[_0x43ef('0x7')]({'type':_0x2a573f['type'],'app':_0x43ef('0x4c'),'exten':_0x2a573f[_0x43ef('0x5')],'context':_0x2a573f[_0x43ef('0xa')],'priority':_[_0x43ef('0x46')](_0x4280e3)[_0x43ef('0x45')]+0x1,'VoiceExtensionId':_0x2a573f['id']});return _0x4280e3;});}}});}; \ No newline at end of file +var _0x8dfe=['Set','CDR(type)=','context','exten','inbound','CDR(routeid)=','push','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','CDR(type)=outbound','outbound','CDR(destination)=','cutdigits','${EXTEN}','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','timeout','options','url','length','name','trunk','param','split','phone','prefix','${EXTEN:','join','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','findAll','interval','IntervalId','then','*,*,*,*','intervals','map','toLowerCase','hasOwnProperty','tag','CDR(tag)=','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','queue','playback','includes','appType','custom','answer','XCALLY-MOTION-ANSWER=1','splice','GotoIfTime',',${EXTEN},','appdata','agi','priority','last','catch','define','VoiceExtension','voice_extensions','concat','Hangup','lodash','./voiceExtension.attributes','exports','models','type'];(function(_0x494756,_0x2deaa7){var _0x30c0e7=function(_0x285cbd){while(--_0x285cbd){_0x494756['push'](_0x494756['shift']());}};_0x30c0e7(++_0x2deaa7);}(_0x8dfe,0x9b));var _0xe8df=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x8dfe[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0xe8df('0x0'));var attributes=require(_0xe8df('0x1'));module[_0xe8df('0x2')]=function(_0x419e71){var _0x471062=_0x419e71[_0xe8df('0x3')];function _0x8a381f(_0x16db28){var _0x5f14e3=0x2;var _0x20c225=[{'type':_0x16db28[_0xe8df('0x4')],'app':_0xe8df('0x5'),'appdata':_0xe8df('0x6')+_0x16db28[_0xe8df('0x4')],'context':_0x16db28[_0xe8df('0x7')],'exten':_0x16db28[_0xe8df('0x8')],'priority':_0x5f14e3++,'VoiceExtensionId':_0x16db28['id']}];if(_0x16db28[_0xe8df('0x4')]===_0xe8df('0x9')){_0x20c225['push']({'type':'inbound','app':'Set','appdata':_0xe8df('0xa')+_0x16db28['id'],'context':_0x16db28[_0xe8df('0x7')],'exten':_0x16db28[_0xe8df('0x8')],'priority':_0x5f14e3++,'VoiceExtensionId':_0x16db28['id']});}_0x20c225[_0xe8df('0xb')]({'type':_0x16db28[_0xe8df('0x4')],'app':_0xe8df('0x5'),'appdata':_0xe8df('0xc'),'context':_0x16db28[_0xe8df('0x7')],'exten':_0x16db28['exten'],'priority':_0x5f14e3++,'VoiceExtensionId':_0x16db28['id']},{'type':_0x16db28[_0xe8df('0x4')],'app':_0xe8df('0x5'),'appdata':_0xe8df('0xd'),'context':_0x16db28[_0xe8df('0x7')],'exten':_0x16db28[_0xe8df('0x8')],'priority':_0x5f14e3++,'VoiceExtensionId':_0x16db28['id']},{'type':_0x16db28[_0xe8df('0x4')],'app':_0xe8df('0x5'),'appdata':_0xe8df('0xe'),'context':_0x16db28['context'],'exten':_0x16db28[_0xe8df('0x8')],'priority':_0x5f14e3++,'VoiceExtensionId':_0x16db28['id']});return _0x20c225;}function _0x980d79(_0x563b0f){var _0xaeadbe=0x2;var _0x3c5903=[{'type':'outbound','app':_0xe8df('0x5'),'appdata':_0xe8df('0xf'),'context':_0x563b0f[_0xe8df('0x7')],'exten':_0x563b0f[_0xe8df('0x8')],'priority':_0xaeadbe++,'VoiceExtensionId':_0x563b0f['id']},{'type':_0xe8df('0x10'),'app':'Set','appdata':_0xe8df('0x11')+(_0x563b0f[_0xe8df('0x12')]?'${EXTEN:'+_0x563b0f['cutdigits']+'}':_0xe8df('0x13')),'context':_0x563b0f[_0xe8df('0x7')],'exten':_0x563b0f[_0xe8df('0x8')],'priority':_0xaeadbe++,'VoiceExtensionId':_0x563b0f['id']},{'type':_0xe8df('0x10'),'app':'Set','appdata':_0xe8df('0xa')+_0x563b0f['id'],'context':_0x563b0f[_0xe8df('0x7')],'exten':_0x563b0f['exten'],'priority':_0xaeadbe++,'VoiceExtensionId':_0x563b0f['id']},{'type':_0xe8df('0x10'),'app':'ExecIf','appdata':_0xe8df('0x14')+(_0xaeadbe+0x2)+_0xe8df('0x15')+(_0xaeadbe+0x1)+')','context':_0x563b0f[_0xe8df('0x7')],'exten':_0x563b0f[_0xe8df('0x8')],'priority':_0xaeadbe++,'VoiceExtensionId':_0x563b0f['id']},{'type':_0xe8df('0x10'),'app':'Set','appdata':_0x563b0f[_0xe8df('0x12')]?_0xe8df('0x16')+_0x563b0f[_0xe8df('0x12')]+'}':_0xe8df('0x17'),'context':_0x563b0f[_0xe8df('0x7')],'exten':_0x563b0f[_0xe8df('0x8')],'priority':_0xaeadbe++,'VoiceExtensionId':_0x563b0f['id']},{'type':_0xe8df('0x10'),'app':'Set','appdata':_0xe8df('0xc'),'context':_0x563b0f[_0xe8df('0x7')],'exten':_0x563b0f[_0xe8df('0x8')],'priority':_0xaeadbe++,'VoiceExtensionId':_0x563b0f['id']},{'type':_0xe8df('0x10'),'app':_0xe8df('0x5'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x563b0f[_0xe8df('0x7')],'exten':_0x563b0f[_0xe8df('0x8')],'priority':_0xaeadbe++,'VoiceExtensionId':_0x563b0f['id']},{'type':_0xe8df('0x10'),'app':'Set','appdata':_0xe8df('0xe'),'context':_0x563b0f[_0xe8df('0x7')],'exten':_0x563b0f[_0xe8df('0x8')],'priority':_0xaeadbe++,'VoiceExtensionId':_0x563b0f['id']},{'type':_0xe8df('0x10'),'app':_0xe8df('0x5'),'appdata':'outboundrouteid='+_0x563b0f['id'],'context':_0x563b0f[_0xe8df('0x7')],'exten':_0x563b0f[_0xe8df('0x8')],'priority':_0xaeadbe++,'VoiceExtensionId':_0x563b0f['id']}];if(_0x563b0f['hasOwnProperty'](_0xe8df('0x18'))&&_0x563b0f[_0xe8df('0x18')]!==_0xe8df('0x19')){_0x3c5903[_0xe8df('0xb')]({'type':_0xe8df('0x10'),'app':_0xe8df('0x5'),'appdata':_0xe8df('0x1a'),'context':_0x563b0f[_0xe8df('0x7')],'exten':_0x563b0f['exten'],'priority':_0xaeadbe++,'VoiceExtensionId':_0x563b0f['id']},{'type':_0xe8df('0x10'),'app':_0xe8df('0x5'),'appdata':_0xe8df('0x1b')+_0x563b0f[_0xe8df('0x18')]||_0xe8df('0x1c'),'context':_0x563b0f[_0xe8df('0x7')],'exten':_0x563b0f[_0xe8df('0x8')],'priority':_0xaeadbe++,'VoiceExtensionId':_0x563b0f['id']});}return _0x3c5903;}function _0x213249(_0x51c684,_0x23ee36){var _0x1e36de=[{'name':'trunk','param':0x0},{'name':_0xe8df('0x1d'),'param':0x1},{'name':_0xe8df('0x1e'),'param':0x2},{'name':_0xe8df('0x1f'),'param':0x3}];var _0x2b3ba8={};var _0x51aa84=_0x23ee36['split'](',');var _0x1d0527=[];for(var _0x3a4fcc=0x0;_0x3a4fcc<_0x1e36de[_0xe8df('0x20')];_0x3a4fcc++){switch(_0x1e36de[_0x3a4fcc][_0xe8df('0x21')]){case _0xe8df('0x22'):_0x2b3ba8['trunk']=_0x51aa84[_0x1e36de[_0x3a4fcc][_0xe8df('0x23')]][_0xe8df('0x24')]('/')[0x1];_0x2b3ba8[_0xe8df('0x25')]=_0x51aa84[_0x1e36de[_0x3a4fcc][_0xe8df('0x23')]]['split']('/')[0x2];_0x2b3ba8[_0xe8df('0x26')]=_0x2b3ba8['phone']?_0x2b3ba8[_0xe8df('0x25')][_0xe8df('0x24')]('$')[0x0]:undefined;_0x2b3ba8['phone']=_0x51c684[_0xe8df('0x12')]?(_0x2b3ba8[_0xe8df('0x26')]||'')+_0xe8df('0x27')+_0x51c684['cutdigits']+'}':(_0x2b3ba8['prefix']||'')+_0xe8df('0x13');_0x1d0527[_0x1e36de[_0x3a4fcc][_0xe8df('0x23')]]=['SIP',_0x2b3ba8[_0xe8df('0x22')],_0x2b3ba8[_0xe8df('0x25')]][_0xe8df('0x28')]('/');break;case _0xe8df('0x1e'):_0x2b3ba8[_0xe8df('0x1e')]=_0x51aa84[_0x1e36de[_0x3a4fcc][_0xe8df('0x23')]];if(_0x51c684[_0xe8df('0x18')]!==_0xe8df('0x19')){if(_0x2b3ba8[_0xe8df('0x1e')][_0xe8df('0x29')](_0xe8df('0x2a'))<0x0){_0x2b3ba8[_0xe8df('0x1e')]+=_0xe8df('0x2a');}}else{_0x2b3ba8[_0xe8df('0x1e')]=_0x2b3ba8[_0xe8df('0x1e')][_0xe8df('0x2b')](_0xe8df('0x2a'),'');}_0x1d0527[_0x1e36de[_0x3a4fcc][_0xe8df('0x23')]]=_0x2b3ba8[_0xe8df('0x1e')];break;default:_0x1d0527[_0x1e36de[_0x3a4fcc][_0xe8df('0x23')]]=_0x51aa84[_0x1e36de[_0x3a4fcc][_0xe8df('0x23')]];}}return _0x1d0527[_0xe8df('0x28')](',');}function _0x4f8632(_0x417d54,_0xbeda54,_0x203106){return new Promise(function(_0xd3011a,_0x23c702){var _0x52d5b7=[];if(_[_0xe8df('0x2c')](_0xbeda54))return _0xd3011a(_0x52d5b7);_0x471062['Interval'][_0xe8df('0x2d')]({'attributes':['id',_0xe8df('0x2e'),_0xe8df('0x2f')],'raw':!![]})[_0xe8df('0x30')](function(_0x3cd3a1){for(var _0x1f7a93=0x0,_0x11f78e=0x0;_0x1f7a93<_0xbeda54['length'];_0x1f7a93++,_0x11f78e=0x0){var _0x39ae9b=_0xbeda54[_0x1f7a93];var _0x1f5202=[];var _0x37df25=[];delete _0x39ae9b['id'];if(_0x39ae9b[_0xe8df('0x2e')]!==_0xe8df('0x31')){_0x39ae9b[_0xe8df('0x32')]=[_0x39ae9b[_0xe8df('0x2e')]];}else{_0x39ae9b[_0xe8df('0x32')]=_0x39ae9b[_0xe8df('0x2f')]?_[_0xe8df('0x33')](_['filter'](_0x3cd3a1,{'IntervalId':_0x39ae9b['IntervalId']}),'interval'):[];}_0x39ae9b[_0xe8df('0x7')]=_0x417d54[_0xe8df('0x7')];_0x39ae9b[_0xe8df('0x8')]=_0x417d54[_0xe8df('0x8')];if(_0x39ae9b[_0xe8df('0x4')])_0x39ae9b['type']=_0x39ae9b['type'][_0xe8df('0x34')]();if(_0x417d54[_0xe8df('0x4')]==='outbound'){if(_0x39ae9b[_0xe8df('0x35')](_0xe8df('0x36'))&&_0x39ae9b[_0xe8df('0x36')]&&_0x39ae9b[_0xe8df('0x36')]!=='--'){_0x1f5202[_0xe8df('0xb')]({'type':_0x39ae9b[_0xe8df('0x4')]['toLowerCase'](),'app':_0xe8df('0x5'),'appdata':_0xe8df('0x37')+_0x39ae9b[_0xe8df('0x36')],'context':_0x417d54[_0xe8df('0x7')],'exten':_0x417d54[_0xe8df('0x8')],'priority':_0x39ae9b[_0xe8df('0x32')][_0xe8df('0x20')]+_0x203106+_0x11f78e++,'VoiceExtensionId':_0x417d54['id']});}_0x1f5202[_0xe8df('0xb')]({'type':_0x39ae9b['type'][_0xe8df('0x34')](),'app':_0xe8df('0x38'),'appdata':_0xe8df('0x39')+(_0x39ae9b[_0xe8df('0x3a')]?_0xe8df('0x3b')+_0x39ae9b['callerID']+')':'NoOp(No\x20number\x20available)'),'context':_0x417d54[_0xe8df('0x7')],'exten':_0x417d54[_0xe8df('0x8')],'priority':_0x39ae9b[_0xe8df('0x32')]['length']+_0x203106+_0x11f78e++,'VoiceExtensionId':_0x417d54['id']});}else{if(_0x39ae9b[_0xe8df('0x35')]('answer')){if([_0xe8df('0x3c'),_0xe8df('0x3d')][_0xe8df('0x3e')](_0x39ae9b['app'][_0xe8df('0x34')]())&&_0x39ae9b[_0xe8df('0x3f')]!==_0xe8df('0x40')){if(_0x39ae9b[_0xe8df('0x41')]){_0x1f5202[_0xe8df('0xb')]({'type':_0x39ae9b['type']['toLowerCase'](),'app':_0xe8df('0x38'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x417d54['context'],'exten':_0x417d54[_0xe8df('0x8')],'priority':_0x39ae9b[_0xe8df('0x32')][_0xe8df('0x20')]+_0x203106+_0x11f78e++,'VoiceExtensionId':_0x417d54['id']});_0x1f5202[_0xe8df('0xb')]({'type':_0x39ae9b[_0xe8df('0x4')][_0xe8df('0x34')](),'app':_0xe8df('0x5'),'appdata':_0xe8df('0x42'),'context':_0x417d54[_0xe8df('0x7')],'exten':_0x417d54['exten'],'priority':_0x39ae9b['intervals'][_0xe8df('0x20')]+_0x203106+_0x11f78e++,'VoiceExtensionId':_0x417d54['id']});}else{_0x1f5202[_0xe8df('0xb')]({'type':_0x39ae9b[_0xe8df('0x4')][_0xe8df('0x34')](),'app':_0xe8df('0x38'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x417d54[_0xe8df('0x7')],'exten':_0x417d54[_0xe8df('0x8')],'priority':_0x39ae9b[_0xe8df('0x32')]['length']+_0x203106+_0x11f78e++,'VoiceExtensionId':_0x417d54['id']});_0x1f5202['push']({'type':_0x39ae9b[_0xe8df('0x4')]['toLowerCase'](),'app':_0xe8df('0x5'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x417d54[_0xe8df('0x7')],'exten':_0x417d54[_0xe8df('0x8')],'priority':_0x39ae9b[_0xe8df('0x32')][_0xe8df('0x20')]+_0x203106+_0x11f78e++,'VoiceExtensionId':_0x417d54['id']});}}}}for(var _0x4fffc3=0x0;_0x4fffc3<_0x39ae9b[_0xe8df('0x32')]['length'];_0x4fffc3++){var _0xaa882=_0x203106+_0x39ae9b['intervals'][_0xe8df('0x20')];var _0x47d91a=_0x4fffc3===_0x39ae9b[_0xe8df('0x32')][_0xe8df('0x20')]-0x1?_0x203106+_0x1f5202['length']+_0x37df25['length']+0x2:_0x203106+_0x4fffc3+0x1;_0x1f5202[_0xe8df('0x43')](_0x4fffc3,0x0,{'type':_0x417d54[_0xe8df('0x4')],'app':_0xe8df('0x44'),'appdata':_0x39ae9b[_0xe8df('0x32')][_0x4fffc3]+'?'+_0x417d54[_0xe8df('0x7')]+_0xe8df('0x45')+_0xaa882+':'+_0x417d54[_0xe8df('0x7')]+_0xe8df('0x45')+_0x47d91a,'exten':_0x417d54[_0xe8df('0x8')],'context':_0x417d54[_0xe8df('0x7')],'priority':_0x203106+_0x4fffc3,'VoiceExtensionId':_0x417d54['id']});}if(_0x39ae9b[_0xe8df('0x3f')]==='outboundDial'){_0x39ae9b[_0xe8df('0x46')]=_0x213249(_0x417d54,_0x39ae9b[_0xe8df('0x46')]);}if(_0x39ae9b['appType']===_0xe8df('0x47')){_0x1f5202[_0xe8df('0xb')]({'type':_0x39ae9b[_0xe8df('0x4')][_0xe8df('0x34')](),'app':_0xe8df('0x5'),'appdata':'XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','context':_0x417d54[_0xe8df('0x7')],'exten':_0x417d54['exten'],'priority':_0x39ae9b[_0xe8df('0x32')][_0xe8df('0x20')]+_0x203106+_0x11f78e++,'VoiceExtensionId':_0x417d54['id']});}_0x39ae9b[_0xe8df('0x48')]=_0x1f5202[_0xe8df('0x20')]?_['last'](_0x1f5202)[_0xe8df('0x48')]+0x1:_0x203106;_0x52d5b7=_['concat'](_0x52d5b7,_0x1f5202,[_0x39ae9b],_0x37df25);_0x203106=_[_0xe8df('0x49')](_0x52d5b7)[_0xe8df('0x48')]+0x1;}return _0xd3011a(_0x52d5b7);})[_0xe8df('0x4a')](function(_0x2dc93f){_0x23c702(_0x2dc93f);});});}return _0x419e71[_0xe8df('0x4b')](_0xe8df('0x4c'),attributes,{'tableName':_0xe8df('0x4d'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x205ee8){var _0xae6217=this['get']({'plain':!![]});var _0x5199d6=_0xae6217[_0xe8df('0x4')]==='outbound'?_0x980d79(_0xae6217):_0x8a381f(_0xae6217);return _0x4f8632(_0xae6217,_0x205ee8,_['last'](_0x5199d6)['priority']+0x1)['then'](function(_0x31847d){var _0x5df32d=_[_0xe8df('0x4e')](_0x5199d6,_0x31847d);_0x5df32d[_0xe8df('0xb')]({'type':_0xae6217[_0xe8df('0x4')],'app':_0xe8df('0x4f'),'exten':_0xae6217[_0xe8df('0x8')],'context':_0xae6217[_0xe8df('0x7')],'priority':_[_0xe8df('0x49')](_0x5df32d)[_0xe8df('0x48')]+0x1,'VoiceExtensionId':_0xae6217['id']});return _0x5df32d;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 49cf69c..634dc7d 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 _0x5db2=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','register','request','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceExtension','VoiceExtension','raw','options','where','attributes','limit','include','map','model','debug','lodash','util','moment'];(function(_0x427632,_0x369bfd){var _0xbbec22=function(_0x29de8d){while(--_0x29de8d){_0x427632['push'](_0x427632['shift']());}};_0xbbec22(++_0x369bfd);}(_0x5db2,0xf3));var _0x25db=function(_0x49c824,_0x18e9be){_0x49c824=_0x49c824-0x0;var _0x29dc99=_0x5db2[_0x49c824];return _0x29dc99;};'use strict';var _=require(_0x25db('0x0'));var util=require(_0x25db('0x1'));var moment=require(_0x25db('0x2'));var BPromise=require('bluebird');var rs=require(_0x25db('0x3'));var fs=require('fs');var Redis=require(_0x25db('0x4'));var db=require(_0x25db('0x5'))['db'];var utils=require(_0x25db('0x6'));var logger=require(_0x25db('0x7'))(_0x25db('0x8'));var config=require(_0x25db('0x9'));var jayson=require(_0x25db('0xa'));var client=jayson[_0x25db('0xb')][_0x25db('0xc')]({'port':0x232a});config['redis']=_[_0x25db('0xd')](config[_0x25db('0xe')],{'host':_0x25db('0xf'),'port':0x18eb});var socket=require(_0x25db('0x10'))(new Redis(config['redis']));require('./voiceExtension.socket')[_0x25db('0x11')](socket);function respondWithRpcPromise(_0x10ad48,_0x9fe2d1,_0xabab8f){return new BPromise(function(_0x321fde,_0x4567e7){return client[_0x25db('0x12')](_0x10ad48,_0xabab8f)[_0x25db('0x13')](function(_0x35467e){logger[_0x25db('0x14')](_0x25db('0x15'),_0x9fe2d1,_0x25db('0x16'));logger['debug'](_0x25db('0x17'),_0x9fe2d1,_0x25db('0x16'),JSON[_0x25db('0x18')](_0x35467e));if(_0x35467e['error']){if(_0x35467e[_0x25db('0x19')][_0x25db('0x1a')]===0x1f4){logger[_0x25db('0x19')](_0x25db('0x15'),_0x9fe2d1,_0x35467e[_0x25db('0x19')][_0x25db('0x1b')]);return _0x4567e7(_0x35467e[_0x25db('0x19')][_0x25db('0x1b')]);}logger[_0x25db('0x19')](_0x25db('0x15'),_0x9fe2d1,_0x35467e['error'][_0x25db('0x1b')]);return _0x321fde(_0x35467e['error']['message']);}else{logger[_0x25db('0x14')](_0x25db('0x15'),_0x9fe2d1,_0x25db('0x16'));_0x321fde(_0x35467e[_0x25db('0x1c')][_0x25db('0x1b')]);}})[_0x25db('0x1d')](function(_0x409b68){logger[_0x25db('0x19')](_0x25db('0x15'),_0x9fe2d1,_0x409b68);_0x4567e7(_0x409b68);});});}exports[_0x25db('0x1e')]=function(_0x414b41){var _0x24af67=this;return new Promise(function(_0x292df5,_0x159b9f){return db[_0x25db('0x1f')]['findAll']({'raw':_0x414b41['options']?_0x414b41['options'][_0x25db('0x20')]===undefined?!![]:![]:!![],'where':_0x414b41[_0x25db('0x21')]?_0x414b41['options'][_0x25db('0x22')]||null:null,'attributes':_0x414b41[_0x25db('0x21')]?_0x414b41[_0x25db('0x21')][_0x25db('0x23')]||null:null,'limit':_0x414b41['options']?_0x414b41[_0x25db('0x21')][_0x25db('0x24')]||null:null,'include':_0x414b41[_0x25db('0x21')]?_0x414b41[_0x25db('0x21')][_0x25db('0x25')]?_[_0x25db('0x26')](_0x414b41[_0x25db('0x21')]['include'],function(_0x246871){return{'model':db[_0x246871[_0x25db('0x27')]],'as':_0x246871['as'],'attributes':_0x246871['attributes'],'include':_0x246871[_0x25db('0x25')]?_[_0x25db('0x26')](_0x246871[_0x25db('0x25')],function(_0x220939){return{'model':db[_0x220939[_0x25db('0x27')]],'as':_0x220939['as'],'attributes':_0x220939[_0x25db('0x23')],'include':_0x220939[_0x25db('0x25')]?_[_0x25db('0x26')](_0x220939[_0x25db('0x25')],function(_0x4e6aee){return{'model':db[_0x4e6aee[_0x25db('0x27')]],'as':_0x4e6aee['as'],'attributes':_0x4e6aee['attributes']};}):[]};}):[]};}):[]:[]})[_0x25db('0x13')](function(_0x49a8d){logger[_0x25db('0x14')](_0x25db('0x1e'),_0x414b41);logger[_0x25db('0x28')](_0x25db('0x1e'),_0x414b41,JSON[_0x25db('0x18')](_0x49a8d));_0x292df5(_0x49a8d);})[_0x25db('0x1d')](function(_0x510f03){logger[_0x25db('0x19')](_0x25db('0x1e'),_0x510f03['message'],_0x414b41);_0x159b9f(_0x24af67[_0x25db('0x19')](0x1f4,_0x510f03['message']));});});}; \ No newline at end of file +var _0x9a22=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','request','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceExtension','VoiceExtension','findAll','options','raw','attributes','limit','include','model','map','debug'];(function(_0x1a51f4,_0x19ef62){var _0x12a05d=function(_0x5dc00f){while(--_0x5dc00f){_0x1a51f4['push'](_0x1a51f4['shift']());}};_0x12a05d(++_0x19ef62);}(_0x9a22,0x75));var _0x29a2=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0x9a22[_0x12d033];return _0x3b4e80;};'use strict';var _=require(_0x29a2('0x0'));var util=require(_0x29a2('0x1'));var moment=require(_0x29a2('0x2'));var BPromise=require(_0x29a2('0x3'));var rs=require(_0x29a2('0x4'));var fs=require('fs');var Redis=require(_0x29a2('0x5'));var db=require(_0x29a2('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x29a2('0x7'));var config=require(_0x29a2('0x8'));var jayson=require(_0x29a2('0x9'));var client=jayson[_0x29a2('0xa')][_0x29a2('0xb')]({'port':0x232a});config[_0x29a2('0xc')]=_[_0x29a2('0xd')](config[_0x29a2('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x29a2('0xe'))(new Redis(config[_0x29a2('0xc')]));require('./voiceExtension.socket')[_0x29a2('0xf')](socket);function respondWithRpcPromise(_0x336236,_0x4bcc9c,_0x3140c7){return new BPromise(function(_0x47439a,_0x4dded3){return client[_0x29a2('0x10')](_0x336236,_0x3140c7)[_0x29a2('0x11')](function(_0x1442b6){logger[_0x29a2('0x12')](_0x29a2('0x13'),_0x4bcc9c,_0x29a2('0x14'));logger['debug'](_0x29a2('0x15'),_0x4bcc9c,_0x29a2('0x14'),JSON[_0x29a2('0x16')](_0x1442b6));if(_0x1442b6[_0x29a2('0x17')]){if(_0x1442b6[_0x29a2('0x17')][_0x29a2('0x18')]===0x1f4){logger[_0x29a2('0x17')]('VoiceExtension,\x20%s,\x20%s',_0x4bcc9c,_0x1442b6[_0x29a2('0x17')][_0x29a2('0x19')]);return _0x4dded3(_0x1442b6[_0x29a2('0x17')][_0x29a2('0x19')]);}logger['error']('VoiceExtension,\x20%s,\x20%s',_0x4bcc9c,_0x1442b6[_0x29a2('0x17')][_0x29a2('0x19')]);return _0x47439a(_0x1442b6[_0x29a2('0x17')][_0x29a2('0x19')]);}else{logger[_0x29a2('0x12')]('VoiceExtension,\x20%s,\x20%s',_0x4bcc9c,_0x29a2('0x14'));_0x47439a(_0x1442b6[_0x29a2('0x1a')]['message']);}})[_0x29a2('0x1b')](function(_0x4ca5ee){logger[_0x29a2('0x17')](_0x29a2('0x13'),_0x4bcc9c,_0x4ca5ee);_0x4dded3(_0x4ca5ee);});});}exports[_0x29a2('0x1c')]=function(_0x31f1a5){var _0x5a7eb2=this;return new Promise(function(_0x5766bf,_0x542a10){return db[_0x29a2('0x1d')][_0x29a2('0x1e')]({'raw':_0x31f1a5[_0x29a2('0x1f')]?_0x31f1a5[_0x29a2('0x1f')][_0x29a2('0x20')]===undefined?!![]:![]:!![],'where':_0x31f1a5[_0x29a2('0x1f')]?_0x31f1a5[_0x29a2('0x1f')]['where']||null:null,'attributes':_0x31f1a5[_0x29a2('0x1f')]?_0x31f1a5[_0x29a2('0x1f')][_0x29a2('0x21')]||null:null,'limit':_0x31f1a5[_0x29a2('0x1f')]?_0x31f1a5[_0x29a2('0x1f')][_0x29a2('0x22')]||null:null,'include':_0x31f1a5[_0x29a2('0x1f')]?_0x31f1a5[_0x29a2('0x1f')]['include']?_['map'](_0x31f1a5[_0x29a2('0x1f')][_0x29a2('0x23')],function(_0x1d328f){return{'model':db[_0x1d328f[_0x29a2('0x24')]],'as':_0x1d328f['as'],'attributes':_0x1d328f[_0x29a2('0x21')],'include':_0x1d328f[_0x29a2('0x23')]?_[_0x29a2('0x25')](_0x1d328f[_0x29a2('0x23')],function(_0x3063f3){return{'model':db[_0x3063f3[_0x29a2('0x24')]],'as':_0x3063f3['as'],'attributes':_0x3063f3[_0x29a2('0x21')],'include':_0x3063f3[_0x29a2('0x23')]?_[_0x29a2('0x25')](_0x3063f3['include'],function(_0x1c191b){return{'model':db[_0x1c191b[_0x29a2('0x24')]],'as':_0x1c191b['as'],'attributes':_0x1c191b[_0x29a2('0x21')]};}):[]};}):[]};}):[]:[]})[_0x29a2('0x11')](function(_0x59a253){logger['info'](_0x29a2('0x1c'),_0x31f1a5);logger[_0x29a2('0x26')]('GetVoiceExtension',_0x31f1a5,JSON[_0x29a2('0x16')](_0x59a253));_0x5766bf(_0x59a253);})['catch'](function(_0x1f9bef){logger['error'](_0x29a2('0x1c'),_0x1f9bef['message'],_0x31f1a5);_0x542a10(_0x5a7eb2[_0x29a2('0x17')](0x1f4,_0x1f9bef[_0x29a2('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 4e044e4..5b466dd 100644 --- a/server/api/voiceExtension/voiceExtension.socket.js +++ b/server/api/voiceExtension/voiceExtension.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fab=['emit','removeListener','register','length','./voiceExtension.events','save','update'];(function(_0x2f95db,_0x24b2af){var _0x5a8014=function(_0x54d01f){while(--_0x54d01f){_0x2f95db['push'](_0x2f95db['shift']());}};_0x5a8014(++_0x24b2af);}(_0x5fab,0x177));var _0xb5fa=function(_0x54e9cd,_0x16ae73){_0x54e9cd=_0x54e9cd-0x0;var _0x343ae7=_0x5fab[_0x54e9cd];return _0x343ae7;};'use strict';var VoiceExtensionEvents=require(_0xb5fa('0x0'));var events=[_0xb5fa('0x1'),'remove',_0xb5fa('0x2')];function createListener(_0x2e2a50,_0x3fc227){return function(_0x316ad0){_0x3fc227[_0xb5fa('0x3')](_0x2e2a50,_0x316ad0);};}function removeListener(_0x595d8b,_0x29390a){return function(){VoiceExtensionEvents[_0xb5fa('0x4')](_0x595d8b,_0x29390a);};}exports[_0xb5fa('0x5')]=function(_0x44df89){for(var _0x4a0249=0x0,_0x5d70f6=events[_0xb5fa('0x6')];_0x4a0249<_0x5d70f6;_0x4a0249++){var _0x1aec3e=events[_0x4a0249];var _0x9c7bce=createListener('voiceExtension:'+_0x1aec3e,_0x44df89);VoiceExtensionEvents['on'](_0x1aec3e,_0x9c7bce);}}; \ No newline at end of file +var _0xabce=['voiceExtension:','./voiceExtension.events','save','remove','update','emit'];(function(_0x53ff3b,_0x58f396){var _0x4d7ac2=function(_0x13e433){while(--_0x13e433){_0x53ff3b['push'](_0x53ff3b['shift']());}};_0x4d7ac2(++_0x58f396);}(_0xabce,0x103));var _0xeabc=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0xabce[_0xb0f7c3];return _0x28ea68;};'use strict';var VoiceExtensionEvents=require(_0xeabc('0x0'));var events=[_0xeabc('0x1'),_0xeabc('0x2'),_0xeabc('0x3')];function createListener(_0x49dbcc,_0x5bd1a4){return function(_0x5ebc95){_0x5bd1a4[_0xeabc('0x4')](_0x49dbcc,_0x5ebc95);};}function removeListener(_0x1d9f37,_0x1a88a7){return function(){VoiceExtensionEvents['removeListener'](_0x1d9f37,_0x1a88a7);};}exports['register']=function(_0x1b07a8){for(var _0x52a4d7=0x0,_0x229ba4=events['length'];_0x52a4d7<_0x229ba4;_0x52a4d7++){var _0x3bdc29=events[_0x52a4d7];var _0x9417af=createListener(_0xeabc('0x5')+_0x3bdc29,_0x1b07a8);VoiceExtensionEvents['on'](_0x3bdc29,_0x9417af);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 9fda5c3..124140c 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 _0x0424=['delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','./voiceMail.controller','get','isAuthenticated','index','/:id','/:id/messages','getMessages','create','put','update'];(function(_0x1477ef,_0x54a5d6){var _0x164acd=function(_0x139149){while(--_0x139149){_0x1477ef['push'](_0x1477ef['shift']());}};_0x164acd(++_0x54a5d6);}(_0x0424,0x159));var _0x4042=function(_0x1ebb10,_0x156b3e){_0x1ebb10=_0x1ebb10-0x0;var _0x20d709=_0x0424[_0x1ebb10];return _0x20d709;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4042('0x0'));var timeout=require(_0x4042('0x1'));var express=require(_0x4042('0x2'));var router=express[_0x4042('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x4042('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4042('0x5'));router[_0x4042('0x6')]('/',auth[_0x4042('0x7')](),controller[_0x4042('0x8')]);router[_0x4042('0x6')](_0x4042('0x9'),auth[_0x4042('0x7')](),controller['show']);router['get'](_0x4042('0xa'),auth[_0x4042('0x7')](),controller[_0x4042('0xb')]);router['post']('/',auth[_0x4042('0x7')](),controller[_0x4042('0xc')]);router[_0x4042('0xd')](_0x4042('0x9'),auth[_0x4042('0x7')](),controller[_0x4042('0xe')]);router[_0x4042('0xf')](_0x4042('0x9'),auth['isAuthenticated'](),controller[_0x4042('0x10')]);module[_0x4042('0x11')]=router; \ No newline at end of file +var _0x4975=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','index','/:id','isAuthenticated','show','/:id/messages','getMessages','post','create','put','update','destroy','exports','multer','path','connect-timeout','express'];(function(_0x3ae8c6,_0x4623ed){var _0x3ecbfa=function(_0x2ec526){while(--_0x2ec526){_0x3ae8c6['push'](_0x3ae8c6['shift']());}};_0x3ecbfa(++_0x4623ed);}(_0x4975,0x86));var _0x5497=function(_0x569385,_0x83a946){_0x569385=_0x569385-0x0;var _0x1e2a17=_0x4975[_0x569385];return _0x1e2a17;};'use strict';var multer=require(_0x5497('0x0'));var util=require('util');var path=require(_0x5497('0x1'));var timeout=require(_0x5497('0x2'));var express=require(_0x5497('0x3'));var router=express[_0x5497('0x4')]();var fs_extra=require(_0x5497('0x5'));var auth=require(_0x5497('0x6'));var interaction=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var controller=require(_0x5497('0x9'));router[_0x5497('0xa')]('/',auth['isAuthenticated'](),controller[_0x5497('0xb')]);router['get'](_0x5497('0xc'),auth[_0x5497('0xd')](),controller[_0x5497('0xe')]);router['get'](_0x5497('0xf'),auth['isAuthenticated'](),controller[_0x5497('0x10')]);router[_0x5497('0x11')]('/',auth[_0x5497('0xd')](),controller[_0x5497('0x12')]);router[_0x5497('0x13')](_0x5497('0xc'),auth[_0x5497('0xd')](),controller[_0x5497('0x14')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x5497('0x15')]);module[_0x5497('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 438b243..eca11cf 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 _0xe7b8=['central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','fullname','\x20-\x20','getDataValue','mailbox','STRING','from-voicemail','contest_mailbox','setDataValue','trim'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xe7b8,0xa0));var _0x8e7b=function(_0x3ba1ec,_0x947cea){_0x3ba1ec=_0x3ba1ec-0x0;var _0x367eb1=_0xe7b8[_0x3ba1ec];return _0x367eb1;};'use strict';var Sequelize=require('sequelize');module['exports']={'customer_id':{'type':Sequelize[_0x8e7b('0x0')]},'context':{'type':Sequelize[_0x8e7b('0x0')],'defaultValue':_0x8e7b('0x1'),'unique':_0x8e7b('0x2')},'mailbox':{'type':Sequelize[_0x8e7b('0x0')],'defaultValue':'','allowNull':![],'unique':_0x8e7b('0x2')},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize[_0x8e7b('0x0')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x5656b0){this[_0x8e7b('0x3')]('email',typeof _0x5656b0==='string'&&_0x5656b0[_0x8e7b('0x4')]()?_0x5656b0[_0x8e7b('0x4')]():null);}},'pager':{'type':Sequelize[_0x8e7b('0x0')]},'tz':{'type':Sequelize[_0x8e7b('0x0')],'defaultValue':_0x8e7b('0x5')},'attach':{'type':Sequelize[_0x8e7b('0x6')](_0x8e7b('0x7'),'no'),'defaultValue':_0x8e7b('0x7'),'allowNull':![]},'saycid':{'type':Sequelize['ENUM'](_0x8e7b('0x7'),'no'),'defaultValue':_0x8e7b('0x7'),'allowNull':![]},'dialout':{'type':Sequelize[_0x8e7b('0x0')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize['ENUM'](_0x8e7b('0x7'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x8e7b('0x6')](_0x8e7b('0x7'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x8e7b('0x6')](_0x8e7b('0x7'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x8e7b('0x6')](_0x8e7b('0x7'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x8e7b('0x8'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x8e7b('0x6')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x8e7b('0x6')](_0x8e7b('0x7'),'no'),'defaultValue':_0x8e7b('0x7'),'allowNull':![]},'forcename':{'type':Sequelize[_0x8e7b('0x6')](_0x8e7b('0x7'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x8e7b('0x6')](_0x8e7b('0x7'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x8e7b('0x6')](_0x8e7b('0x7'),'no'),'defaultValue':_0x8e7b('0x7'),'allowNull':![]},'stamp':{'type':_0x8e7b('0x9')},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize[_0x8e7b('0x0')]},'maxsecs':{'type':Sequelize[_0x8e7b('0xa')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x8e7b('0xa')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue'](_0x8e7b('0xb'))+_0x8e7b('0xc')+this[_0x8e7b('0xd')](_0x8e7b('0xe'));}}}; \ No newline at end of file +var _0x98b6=['setDataValue','email','string','trim','central','yes','ENUM','TIMESTAMP','INTEGER','getDataValue','fullname','sequelize','exports','STRING','from-voicemail'];(function(_0x2a3c7c,_0x2cb9ff){var _0x2e0d84=function(_0x1da965){while(--_0x1da965){_0x2a3c7c['push'](_0x2a3c7c['shift']());}};_0x2e0d84(++_0x2cb9ff);}(_0x98b6,0x83));var _0x698b=function(_0x31faff,_0x51155d){_0x31faff=_0x31faff-0x0;var _0x5304b9=_0x98b6[_0x31faff];return _0x5304b9;};'use strict';var Sequelize=require(_0x698b('0x0'));module[_0x698b('0x1')]={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x698b('0x2')],'defaultValue':_0x698b('0x3'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0x698b('0x2')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0x698b('0x2')]},'fullname':{'type':Sequelize[_0x698b('0x2')]},'email':{'type':Sequelize[_0x698b('0x2')],'validate':{'isEmail':!![]},'set':function(_0x4304db){this[_0x698b('0x4')](_0x698b('0x5'),typeof _0x4304db===_0x698b('0x6')&&_0x4304db[_0x698b('0x7')]()?_0x4304db[_0x698b('0x7')]():null);}},'pager':{'type':Sequelize[_0x698b('0x2')]},'tz':{'type':Sequelize[_0x698b('0x2')],'defaultValue':_0x698b('0x8')},'attach':{'type':Sequelize['ENUM'](_0x698b('0x9'),'no'),'defaultValue':_0x698b('0x9'),'allowNull':![]},'saycid':{'type':Sequelize[_0x698b('0xa')](_0x698b('0x9'),'no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0x698b('0x2')]},'callback':{'type':Sequelize[_0x698b('0x2')]},'review':{'type':Sequelize[_0x698b('0xa')](_0x698b('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x698b('0xa')](_0x698b('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x698b('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x698b('0xa')](_0x698b('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x698b('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x698b('0xa')](_0x698b('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x698b('0xa')](_0x698b('0x9'),'no'),'defaultValue':_0x698b('0x9'),'allowNull':![]},'forcename':{'type':Sequelize['ENUM'](_0x698b('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x698b('0xa')](_0x698b('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x698b('0xa')](_0x698b('0x9'),'no'),'defaultValue':_0x698b('0x9'),'allowNull':![]},'stamp':{'type':_0x698b('0xb')},'emailsubject':{'type':Sequelize[_0x698b('0x2')]},'emailbody':{'type':Sequelize[_0x698b('0x2')]},'maxsecs':{'type':Sequelize[_0x698b('0xc')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x698b('0xd')](_0x698b('0xe'))+'\x20-\x20'+this[_0x698b('0xd')]('mailbox');}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index cb98b12..f01c8a8 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 _0x9c00=['name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','offset','order','sort','pick','filter','merge','where','VIRTUAL','options','VoiceMail','includeAll','include','rows','catch','show','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','getMessages','findOne','VoiceMailMessage','mailbox','findAndCountAll','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','Content-Range','apply','reject','update','destroy','get','Voicemails','UserProfileResource','then','stack'];(function(_0x3a8b41,_0x122312){var _0x19cb35=function(_0x133570){while(--_0x133570){_0x3a8b41['push'](_0x3a8b41['shift']());}};_0x19cb35(++_0x122312);}(_0x9c00,0x1a0));var _0x09c0=function(_0x118da4,_0x2e192e){_0x118da4=_0x118da4-0x0;var _0x40dfbb=_0x9c00[_0x118da4];return _0x40dfbb;};'use strict';var emlformat=require(_0x09c0('0x0'));var rimraf=require(_0x09c0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x09c0('0x2'));var moment=require(_0x09c0('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x09c0('0x4'));var util=require(_0x09c0('0x5'));var path=require(_0x09c0('0x6'));var sox=require(_0x09c0('0x7'));var csv=require(_0x09c0('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x09c0('0x9'));var squel=require(_0x09c0('0xa'));var crypto=require(_0x09c0('0xb'));var jsforce=require(_0x09c0('0xc'));var deskjs=require(_0x09c0('0xd'));var toCsv=require('to-csv');var querystring=require(_0x09c0('0xe'));var Papa=require(_0x09c0('0xf'));var Redis=require(_0x09c0('0x10'));var authService=require(_0x09c0('0x11'));var qs=require(_0x09c0('0x12'));var as=require(_0x09c0('0x13'));var hardwareService=require(_0x09c0('0x14'));var logger=require(_0x09c0('0x15'))(_0x09c0('0x16'));var utils=require(_0x09c0('0x17'));var config=require(_0x09c0('0x18'));var licenseUtil=require(_0x09c0('0x19'));var db=require(_0x09c0('0x1a'))['db'];function respondWithStatusCode(_0x144271,_0x3b95cc){_0x3b95cc=_0x3b95cc||0xcc;return function(_0x331905){if(_0x331905){return _0x144271[_0x09c0('0x1b')](_0x3b95cc);}return _0x144271[_0x09c0('0x1c')](_0x3b95cc)[_0x09c0('0x1d')]();};}function respondWithResult(_0x3649d2,_0x16e490){_0x16e490=_0x16e490||0xc8;return function(_0x254598){if(_0x254598){return _0x3649d2[_0x09c0('0x1c')](_0x16e490)[_0x09c0('0x1e')](_0x254598);}};}function respondWithFilteredResult(_0x33c3d6,_0x2fdf11){return function(_0x4ff6b7){if(_0x4ff6b7){var _0x590129=typeof _0x2fdf11['offset']===_0x09c0('0x1f')&&typeof _0x2fdf11[_0x09c0('0x20')]===_0x09c0('0x1f');var _0x628272=_0x4ff6b7['count'];var _0x2c4440=_0x590129?0x0:_0x2fdf11['offset'];var _0x4c29a7=_0x590129?_0x4ff6b7[_0x09c0('0x21')]:_0x2fdf11['offset']+_0x2fdf11[_0x09c0('0x20')];var _0x319c36;if(_0x4c29a7>=_0x628272){_0x4c29a7=_0x628272;_0x319c36=0xc8;}else{_0x319c36=0xce;}_0x33c3d6[_0x09c0('0x1c')](_0x319c36);return _0x33c3d6['set'](_0x09c0('0x22'),_0x2c4440+'-'+_0x4c29a7+'/'+_0x628272)[_0x09c0('0x1e')](_0x4ff6b7);}return null;};}function patchUpdates(_0x8ad645){return function(_0x3447c5){try{jsonpatch[_0x09c0('0x23')](_0x3447c5,_0x8ad645,!![]);}catch(_0xa5d16f){return BPromise[_0x09c0('0x24')](_0xa5d16f);}return _0x3447c5['save']();};}function saveUpdates(_0x1695e8,_0x46f171){return function(_0x473fbd){if(_0x473fbd){return _0x473fbd[_0x09c0('0x25')](_0x1695e8)['then'](function(_0x4f6824){return _0x4f6824;});}return null;};}function removeEntity(_0x321bcc,_0x25fdb5){return function(_0x1e8a1c){if(_0x1e8a1c){return _0x1e8a1c[_0x09c0('0x26')]()['then'](function(){var _0x42ebfc=_0x1e8a1c[_0x09c0('0x27')]({'plain':!![]});var _0x56d883=_0x09c0('0x28');return db[_0x09c0('0x29')][_0x09c0('0x26')]({'where':{'type':_0x56d883,'resourceId':_0x42ebfc['id']}})[_0x09c0('0x2a')](function(){return _0x1e8a1c;});})[_0x09c0('0x2a')](function(){_0x321bcc[_0x09c0('0x1c')](0xcc)[_0x09c0('0x1d')]();});}};}function handleEntityNotFound(_0x35b61c,_0x1ea951){return function(_0x1aa80e){if(!_0x1aa80e){_0x35b61c[_0x09c0('0x1b')](0x194);}return _0x1aa80e;};}function handleError(_0x5e53ac,_0x15a667){_0x15a667=_0x15a667||0x1f4;return function(_0x1bdde9){logger['error'](_0x1bdde9[_0x09c0('0x2b')]);if(_0x1bdde9['name']){delete _0x1bdde9[_0x09c0('0x2c')];}_0x5e53ac['status'](_0x15a667)[_0x09c0('0x2d')](_0x1bdde9);};}exports[_0x09c0('0x2e')]=function(_0x108409,_0x4159bc){var _0x4e999a={},_0x5478b7={},_0x17c374={'count':0x0,'rows':[]};var _0x38a315=_[_0x09c0('0x2f')](db['VoiceMail'][_0x09c0('0x30')],function(_0x4bdae9){return{'name':_0x4bdae9[_0x09c0('0x31')],'type':_0x4bdae9[_0x09c0('0x32')][_0x09c0('0x33')]};});_0x5478b7['model']=_[_0x09c0('0x2f')](_0x38a315,_0x09c0('0x2c'));_0x5478b7[_0x09c0('0x34')]=_[_0x09c0('0x35')](_0x108409[_0x09c0('0x34')]);_0x5478b7[_0x09c0('0x36')]=_[_0x09c0('0x37')](_0x5478b7['model'],_0x5478b7[_0x09c0('0x34')]);_0x4e999a[_0x09c0('0x38')]=_[_0x09c0('0x37')](_0x5478b7[_0x09c0('0x39')],qs[_0x09c0('0x3a')](_0x108409['query'][_0x09c0('0x3a')]));_0x4e999a[_0x09c0('0x38')]=_0x4e999a[_0x09c0('0x38')][_0x09c0('0x3b')]?_0x4e999a[_0x09c0('0x38')]:_0x5478b7['model'];if(!_0x108409[_0x09c0('0x34')][_0x09c0('0x3c')](_0x09c0('0x3d'))){_0x4e999a[_0x09c0('0x20')]=qs[_0x09c0('0x20')](_0x108409[_0x09c0('0x34')][_0x09c0('0x20')]);_0x4e999a['offset']=qs[_0x09c0('0x3e')](_0x108409[_0x09c0('0x34')][_0x09c0('0x3e')]);}_0x4e999a[_0x09c0('0x3f')]=qs[_0x09c0('0x40')](_0x108409['query']['sort']);_0x4e999a['where']=qs['filters'](_[_0x09c0('0x41')](_0x108409[_0x09c0('0x34')],_0x5478b7[_0x09c0('0x36')]),_0x38a315);if(_0x108409[_0x09c0('0x34')][_0x09c0('0x42')]){_0x4e999a['where']=_[_0x09c0('0x43')](_0x4e999a[_0x09c0('0x44')],{'$or':_['map'](_0x38a315,function(_0x1067cf){if(_0x1067cf['type']!==_0x09c0('0x45')){var _0x5c80a2={};_0x5c80a2[_0x1067cf[_0x09c0('0x2c')]]={'$like':'%'+_0x108409[_0x09c0('0x34')]['filter']+'%'};return _0x5c80a2;}})});}_0x4e999a=_[_0x09c0('0x43')]({},_0x4e999a,_0x108409[_0x09c0('0x46')]);var _0x5d69fd={'where':_0x4e999a[_0x09c0('0x44')]};return db[_0x09c0('0x47')][_0x09c0('0x21')](_0x5d69fd)[_0x09c0('0x2a')](function(_0xeb8191){_0x17c374[_0x09c0('0x21')]=_0xeb8191;if(_0x108409['query'][_0x09c0('0x48')]){_0x4e999a[_0x09c0('0x49')]=[{'all':!![]}];}return db[_0x09c0('0x47')]['findAll'](_0x4e999a);})[_0x09c0('0x2a')](function(_0x30c0c5){_0x17c374[_0x09c0('0x4a')]=_0x30c0c5;return _0x17c374;})['then'](respondWithFilteredResult(_0x4159bc,_0x4e999a))[_0x09c0('0x4b')](handleError(_0x4159bc,null));};exports[_0x09c0('0x4c')]=function(_0x52cd5c,_0x5bbf4e){var _0x397e73={'raw':!![],'where':{'id':_0x52cd5c['params']['id']}},_0x471078={};_0x471078[_0x09c0('0x39')]=_[_0x09c0('0x35')](db['VoiceMail'][_0x09c0('0x30')]);_0x471078[_0x09c0('0x34')]=_[_0x09c0('0x35')](_0x52cd5c[_0x09c0('0x34')]);_0x471078[_0x09c0('0x36')]=_['intersection'](_0x471078[_0x09c0('0x39')],_0x471078['query']);_0x397e73['attributes']=_[_0x09c0('0x37')](_0x471078[_0x09c0('0x39')],qs[_0x09c0('0x3a')](_0x52cd5c[_0x09c0('0x34')][_0x09c0('0x3a')]));_0x397e73[_0x09c0('0x38')]=_0x397e73['attributes']['length']?_0x397e73['attributes']:_0x471078[_0x09c0('0x39')];if(_0x52cd5c[_0x09c0('0x34')][_0x09c0('0x48')]){_0x397e73['include']=[{'all':!![]}];}_0x397e73=_[_0x09c0('0x43')]({},_0x397e73,_0x52cd5c[_0x09c0('0x46')]);return db[_0x09c0('0x47')][_0x09c0('0x4d')](_0x397e73)[_0x09c0('0x2a')](handleEntityNotFound(_0x5bbf4e,null))[_0x09c0('0x2a')](respondWithResult(_0x5bbf4e,null))[_0x09c0('0x4b')](handleError(_0x5bbf4e,null));};exports[_0x09c0('0x4e')]=function(_0x3f6d14,_0x38085c){return db[_0x09c0('0x47')][_0x09c0('0x4e')](_0x3f6d14[_0x09c0('0x4f')],{})[_0x09c0('0x2a')](function(_0x332b69){var _0x32abbe=_0x3f6d14[_0x09c0('0x50')][_0x09c0('0x27')]({'plain':!![]});if(!_0x32abbe)throw new Error(_0x09c0('0x51'));if(_0x32abbe[_0x09c0('0x52')]==='user'){var _0x4acf54=_0x332b69[_0x09c0('0x27')]({'plain':!![]});var _0x15b0a2=_0x09c0('0x28');return db[_0x09c0('0x53')]['find']({'where':{'name':_0x15b0a2,'userProfileId':_0x32abbe[_0x09c0('0x54')]},'raw':!![]})[_0x09c0('0x2a')](function(_0x1823c2){if(_0x1823c2&&_0x1823c2['autoAssociation']===0x0){return db[_0x09c0('0x29')][_0x09c0('0x4e')]({'name':_0x4acf54[_0x09c0('0x2c')],'resourceId':_0x4acf54['id'],'type':_0x1823c2[_0x09c0('0x2c')],'sectionId':_0x1823c2['id']},{})[_0x09c0('0x2a')](function(){return _0x332b69;});}else{return _0x332b69;}})[_0x09c0('0x4b')](function(_0x45ecd0){logger['error'](_0x09c0('0x55'),_0x45ecd0);throw _0x45ecd0;});}return _0x332b69;})[_0x09c0('0x2a')](respondWithResult(_0x38085c,0xc9))[_0x09c0('0x4b')](handleError(_0x38085c,null));};exports[_0x09c0('0x25')]=function(_0x21fe00,_0x316fbd){if(_0x21fe00[_0x09c0('0x4f')]['id']){delete _0x21fe00['body']['id'];}return db['VoiceMail'][_0x09c0('0x4d')]({'where':{'id':_0x21fe00[_0x09c0('0x56')]['id']}})[_0x09c0('0x2a')](handleEntityNotFound(_0x316fbd,null))['then'](saveUpdates(_0x21fe00[_0x09c0('0x4f')],null))['then'](respondWithResult(_0x316fbd,null))[_0x09c0('0x4b')](handleError(_0x316fbd,null));};exports[_0x09c0('0x26')]=function(_0x42d4dd,_0x290618){return db[_0x09c0('0x47')][_0x09c0('0x4d')]({'where':{'id':_0x42d4dd[_0x09c0('0x56')]['id']}})['then'](handleEntityNotFound(_0x290618,null))[_0x09c0('0x2a')](removeEntity(_0x290618,null))[_0x09c0('0x4b')](handleError(_0x290618,null));};exports[_0x09c0('0x57')]=function(_0x270ff2,_0x3a6845,_0x219195){return db[_0x09c0('0x47')][_0x09c0('0x58')]({'where':{'id':_0x270ff2[_0x09c0('0x56')]['id']}})[_0x09c0('0x2a')](handleEntityNotFound(_0x3a6845,null))[_0x09c0('0x2a')](function(_0x4c4339){var _0x34cc0a;var _0x3564e6={},_0x26dc22={};_0x26dc22[_0x09c0('0x39')]=_['keys'](db[_0x09c0('0x59')]['rawAttributes']);_0x26dc22[_0x09c0('0x34')]=_[_0x09c0('0x35')](_0x270ff2[_0x09c0('0x34')]);_0x26dc22['filters']=_['intersection'](_0x26dc22[_0x09c0('0x39')],_0x26dc22[_0x09c0('0x34')]);_0x3564e6[_0x09c0('0x38')]=_[_0x09c0('0x37')](_0x26dc22['model'],qs[_0x09c0('0x3a')](_0x270ff2[_0x09c0('0x34')]['fields']));_0x3564e6[_0x09c0('0x38')]=_0x3564e6[_0x09c0('0x38')][_0x09c0('0x3b')]?_0x3564e6[_0x09c0('0x38')]:_0x26dc22['model'];if(!_0x270ff2[_0x09c0('0x34')][_0x09c0('0x3c')](_0x09c0('0x3d'))){_0x3564e6[_0x09c0('0x20')]=qs[_0x09c0('0x20')](_0x270ff2[_0x09c0('0x34')][_0x09c0('0x20')]);_0x3564e6[_0x09c0('0x3e')]=qs[_0x09c0('0x3e')](_0x270ff2[_0x09c0('0x34')][_0x09c0('0x3e')]);}_0x3564e6[_0x09c0('0x3f')]=qs[_0x09c0('0x40')](_0x270ff2['query'][_0x09c0('0x40')]);_0x3564e6[_0x09c0('0x44')]=qs[_0x09c0('0x36')](_[_0x09c0('0x41')](_0x270ff2[_0x09c0('0x34')],_0x26dc22['filters']));if(_0x270ff2[_0x09c0('0x34')][_0x09c0('0x42')]){_0x3564e6[_0x09c0('0x44')]=_[_0x09c0('0x43')](_0x3564e6['where'],{'$or':_[_0x09c0('0x2f')](_0x3564e6[_0x09c0('0x38')],function(_0x569462){var _0x325013={};_0x325013[_0x569462]={'$like':'%'+_0x270ff2[_0x09c0('0x34')][_0x09c0('0x42')]+'%'};return _0x325013;})});}_0x3564e6[_0x09c0('0x44')]=_[_0x09c0('0x43')](_0x3564e6['where'],{'mailboxuser':_0x4c4339[_0x09c0('0x5a')]});_0x3564e6=_[_0x09c0('0x43')]({},_0x3564e6,_0x270ff2[_0x09c0('0x46')]);return db[_0x09c0('0x59')][_0x09c0('0x5b')](_0x3564e6)['then'](respondWithFilteredResult(_0x3a6845,_0x3564e6));})[_0x09c0('0x4b')](handleError(_0x3a6845,null));}; \ No newline at end of file +var _0xf4eb=['fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','then','destroy','Voicemails','UserProfileResource','error','stack','name','send','index','map','VoiceMail','fieldName','key','model','keys','filters','intersection','attributes','fields','query','length','order','sort','pick','where','merge','type','VIRTUAL','filter','options','include','rows','catch','show','rawAttributes','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','update','getMessages','VoiceMailMessage','hasOwnProperty','nolimit','mailbox','eml-format','moment','util','path','sox','to-csv','ejs'];(function(_0x5765bb,_0x45998c){var _0x452a60=function(_0x23d107){while(--_0x23d107){_0x5765bb['push'](_0x5765bb['shift']());}};_0x452a60(++_0x45998c);}(_0xf4eb,0xec));var _0xbf4e=function(_0x2d437,_0x3041f7){_0x2d437=_0x2d437-0x0;var _0x2abe9c=_0xf4eb[_0x2d437];return _0x2abe9c;};'use strict';var emlformat=require(_0xbf4e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xbf4e('0x1'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xbf4e('0x2'));var path=require(_0xbf4e('0x3'));var sox=require(_0xbf4e('0x4'));var csv=require(_0xbf4e('0x5'));var ejs=require(_0xbf4e('0x6'));var fs=require('fs');var fs_extra=require(_0xbf4e('0x7'));var _=require(_0xbf4e('0x8'));var squel=require('squel');var crypto=require(_0xbf4e('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbf4e('0x5'));var querystring=require(_0xbf4e('0xa'));var Papa=require(_0xbf4e('0xb'));var Redis=require(_0xbf4e('0xc'));var authService=require(_0xbf4e('0xd'));var qs=require(_0xbf4e('0xe'));var as=require(_0xbf4e('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xbf4e('0x10'));var utils=require('../../config/utils');var config=require(_0xbf4e('0x11'));var licenseUtil=require(_0xbf4e('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x17fd01,_0x5a3035){_0x5a3035=_0x5a3035||0xcc;return function(_0x56d185){if(_0x56d185){return _0x17fd01[_0xbf4e('0x13')](_0x5a3035);}return _0x17fd01[_0xbf4e('0x14')](_0x5a3035)[_0xbf4e('0x15')]();};}function respondWithResult(_0x302841,_0x3b74bd){_0x3b74bd=_0x3b74bd||0xc8;return function(_0x61bd54){if(_0x61bd54){return _0x302841['status'](_0x3b74bd)['json'](_0x61bd54);}};}function respondWithFilteredResult(_0x180432,_0x1735ae){return function(_0x28fc6b){if(_0x28fc6b){var _0x542909=typeof _0x1735ae[_0xbf4e('0x16')]===_0xbf4e('0x17')&&typeof _0x1735ae[_0xbf4e('0x18')]===_0xbf4e('0x17');var _0x5a631e=_0x28fc6b[_0xbf4e('0x19')];var _0x577c27=_0x542909?0x0:_0x1735ae['offset'];var _0x566ec3=_0x542909?_0x28fc6b['count']:_0x1735ae[_0xbf4e('0x16')]+_0x1735ae[_0xbf4e('0x18')];var _0x1fc800;if(_0x566ec3>=_0x5a631e){_0x566ec3=_0x5a631e;_0x1fc800=0xc8;}else{_0x1fc800=0xce;}_0x180432['status'](_0x1fc800);return _0x180432['set'](_0xbf4e('0x1a'),_0x577c27+'-'+_0x566ec3+'/'+_0x5a631e)[_0xbf4e('0x1b')](_0x28fc6b);}return null;};}function patchUpdates(_0x3be138){return function(_0x3a875b){try{jsonpatch[_0xbf4e('0x1c')](_0x3a875b,_0x3be138,!![]);}catch(_0x1e2a68){return BPromise[_0xbf4e('0x1d')](_0x1e2a68);}return _0x3a875b[_0xbf4e('0x1e')]();};}function saveUpdates(_0xd09e12,_0x376832){return function(_0x30539b){if(_0x30539b){return _0x30539b['update'](_0xd09e12)[_0xbf4e('0x1f')](function(_0x2e7673){return _0x2e7673;});}return null;};}function removeEntity(_0x51648c,_0x31e3f5){return function(_0x30994d){if(_0x30994d){return _0x30994d[_0xbf4e('0x20')]()[_0xbf4e('0x1f')](function(){var _0x3a5d72=_0x30994d['get']({'plain':!![]});var _0x90635e=_0xbf4e('0x21');return db[_0xbf4e('0x22')]['destroy']({'where':{'type':_0x90635e,'resourceId':_0x3a5d72['id']}})[_0xbf4e('0x1f')](function(){return _0x30994d;});})['then'](function(){_0x51648c['status'](0xcc)[_0xbf4e('0x15')]();});}};}function handleEntityNotFound(_0x5a0a9b,_0x38c923){return function(_0x315df3){if(!_0x315df3){_0x5a0a9b[_0xbf4e('0x13')](0x194);}return _0x315df3;};}function handleError(_0x41f918,_0x5c912f){_0x5c912f=_0x5c912f||0x1f4;return function(_0x2d4686){logger[_0xbf4e('0x23')](_0x2d4686[_0xbf4e('0x24')]);if(_0x2d4686['name']){delete _0x2d4686[_0xbf4e('0x25')];}_0x41f918['status'](_0x5c912f)[_0xbf4e('0x26')](_0x2d4686);};}exports[_0xbf4e('0x27')]=function(_0xb8b58e,_0x498dbd){var _0x1d12e2={},_0x362716={},_0x2f3cf8={'count':0x0,'rows':[]};var _0xc7ca87=_[_0xbf4e('0x28')](db[_0xbf4e('0x29')]['rawAttributes'],function(_0x35c82d){return{'name':_0x35c82d[_0xbf4e('0x2a')],'type':_0x35c82d['type'][_0xbf4e('0x2b')]};});_0x362716[_0xbf4e('0x2c')]=_['map'](_0xc7ca87,_0xbf4e('0x25'));_0x362716['query']=_[_0xbf4e('0x2d')](_0xb8b58e['query']);_0x362716[_0xbf4e('0x2e')]=_[_0xbf4e('0x2f')](_0x362716[_0xbf4e('0x2c')],_0x362716['query']);_0x1d12e2[_0xbf4e('0x30')]=_[_0xbf4e('0x2f')](_0x362716[_0xbf4e('0x2c')],qs[_0xbf4e('0x31')](_0xb8b58e[_0xbf4e('0x32')][_0xbf4e('0x31')]));_0x1d12e2['attributes']=_0x1d12e2[_0xbf4e('0x30')][_0xbf4e('0x33')]?_0x1d12e2[_0xbf4e('0x30')]:_0x362716[_0xbf4e('0x2c')];if(!_0xb8b58e[_0xbf4e('0x32')]['hasOwnProperty']('nolimit')){_0x1d12e2['limit']=qs['limit'](_0xb8b58e[_0xbf4e('0x32')][_0xbf4e('0x18')]);_0x1d12e2[_0xbf4e('0x16')]=qs[_0xbf4e('0x16')](_0xb8b58e[_0xbf4e('0x32')][_0xbf4e('0x16')]);}_0x1d12e2[_0xbf4e('0x34')]=qs[_0xbf4e('0x35')](_0xb8b58e[_0xbf4e('0x32')]['sort']);_0x1d12e2['where']=qs[_0xbf4e('0x2e')](_[_0xbf4e('0x36')](_0xb8b58e[_0xbf4e('0x32')],_0x362716['filters']),_0xc7ca87);if(_0xb8b58e[_0xbf4e('0x32')]['filter']){_0x1d12e2[_0xbf4e('0x37')]=_[_0xbf4e('0x38')](_0x1d12e2[_0xbf4e('0x37')],{'$or':_[_0xbf4e('0x28')](_0xc7ca87,function(_0x5ce339){if(_0x5ce339[_0xbf4e('0x39')]!==_0xbf4e('0x3a')){var _0x3aa308={};_0x3aa308[_0x5ce339[_0xbf4e('0x25')]]={'$like':'%'+_0xb8b58e['query'][_0xbf4e('0x3b')]+'%'};return _0x3aa308;}})});}_0x1d12e2=_[_0xbf4e('0x38')]({},_0x1d12e2,_0xb8b58e[_0xbf4e('0x3c')]);var _0x29fe9d={'where':_0x1d12e2[_0xbf4e('0x37')]};return db[_0xbf4e('0x29')][_0xbf4e('0x19')](_0x29fe9d)['then'](function(_0x176166){_0x2f3cf8[_0xbf4e('0x19')]=_0x176166;if(_0xb8b58e['query']['includeAll']){_0x1d12e2[_0xbf4e('0x3d')]=[{'all':!![]}];}return db[_0xbf4e('0x29')]['findAll'](_0x1d12e2);})['then'](function(_0x2b1bf4){_0x2f3cf8[_0xbf4e('0x3e')]=_0x2b1bf4;return _0x2f3cf8;})[_0xbf4e('0x1f')](respondWithFilteredResult(_0x498dbd,_0x1d12e2))[_0xbf4e('0x3f')](handleError(_0x498dbd,null));};exports[_0xbf4e('0x40')]=function(_0x3ad0a4,_0x5a03c6){var _0x3ecc15={'raw':!![],'where':{'id':_0x3ad0a4['params']['id']}},_0x7bd91={};_0x7bd91['model']=_['keys'](db['VoiceMail'][_0xbf4e('0x41')]);_0x7bd91['query']=_[_0xbf4e('0x2d')](_0x3ad0a4[_0xbf4e('0x32')]);_0x7bd91['filters']=_['intersection'](_0x7bd91[_0xbf4e('0x2c')],_0x7bd91[_0xbf4e('0x32')]);_0x3ecc15[_0xbf4e('0x30')]=_[_0xbf4e('0x2f')](_0x7bd91[_0xbf4e('0x2c')],qs['fields'](_0x3ad0a4[_0xbf4e('0x32')][_0xbf4e('0x31')]));_0x3ecc15[_0xbf4e('0x30')]=_0x3ecc15[_0xbf4e('0x30')][_0xbf4e('0x33')]?_0x3ecc15[_0xbf4e('0x30')]:_0x7bd91[_0xbf4e('0x2c')];if(_0x3ad0a4[_0xbf4e('0x32')]['includeAll']){_0x3ecc15[_0xbf4e('0x3d')]=[{'all':!![]}];}_0x3ecc15=_[_0xbf4e('0x38')]({},_0x3ecc15,_0x3ad0a4[_0xbf4e('0x3c')]);return db[_0xbf4e('0x29')][_0xbf4e('0x42')](_0x3ecc15)[_0xbf4e('0x1f')](handleEntityNotFound(_0x5a03c6,null))[_0xbf4e('0x1f')](respondWithResult(_0x5a03c6,null))[_0xbf4e('0x3f')](handleError(_0x5a03c6,null));};exports[_0xbf4e('0x43')]=function(_0x3447ab,_0x2fdba9){return db[_0xbf4e('0x29')][_0xbf4e('0x43')](_0x3447ab[_0xbf4e('0x44')],{})[_0xbf4e('0x1f')](function(_0x2892ce){var _0x10bc23=_0x3447ab['user'][_0xbf4e('0x45')]({'plain':!![]});if(!_0x10bc23)throw new Error(_0xbf4e('0x46'));if(_0x10bc23[_0xbf4e('0x47')]==='user'){var _0x33ab9a=_0x2892ce['get']({'plain':!![]});var _0x4a050e=_0xbf4e('0x21');return db[_0xbf4e('0x48')]['find']({'where':{'name':_0x4a050e,'userProfileId':_0x10bc23[_0xbf4e('0x49')]},'raw':!![]})[_0xbf4e('0x1f')](function(_0x31d779){if(_0x31d779&&_0x31d779[_0xbf4e('0x4a')]===0x0){return db[_0xbf4e('0x22')][_0xbf4e('0x43')]({'name':_0x33ab9a[_0xbf4e('0x25')],'resourceId':_0x33ab9a['id'],'type':_0x31d779[_0xbf4e('0x25')],'sectionId':_0x31d779['id']},{})[_0xbf4e('0x1f')](function(){return _0x2892ce;});}else{return _0x2892ce;}})[_0xbf4e('0x3f')](function(_0x271ad2){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x271ad2);throw _0x271ad2;});}return _0x2892ce;})[_0xbf4e('0x1f')](respondWithResult(_0x2fdba9,0xc9))[_0xbf4e('0x3f')](handleError(_0x2fdba9,null));};exports[_0xbf4e('0x4b')]=function(_0x586f5d,_0x339ce6){if(_0x586f5d[_0xbf4e('0x44')]['id']){delete _0x586f5d['body']['id'];}return db['VoiceMail'][_0xbf4e('0x42')]({'where':{'id':_0x586f5d['params']['id']}})['then'](handleEntityNotFound(_0x339ce6,null))[_0xbf4e('0x1f')](saveUpdates(_0x586f5d[_0xbf4e('0x44')],null))[_0xbf4e('0x1f')](respondWithResult(_0x339ce6,null))[_0xbf4e('0x3f')](handleError(_0x339ce6,null));};exports[_0xbf4e('0x20')]=function(_0x5ec2d9,_0x242a75){return db['VoiceMail'][_0xbf4e('0x42')]({'where':{'id':_0x5ec2d9['params']['id']}})[_0xbf4e('0x1f')](handleEntityNotFound(_0x242a75,null))['then'](removeEntity(_0x242a75,null))[_0xbf4e('0x3f')](handleError(_0x242a75,null));};exports[_0xbf4e('0x4c')]=function(_0x3e60e7,_0x16592f,_0xfd54c){return db['VoiceMail']['findOne']({'where':{'id':_0x3e60e7['params']['id']}})['then'](handleEntityNotFound(_0x16592f,null))[_0xbf4e('0x1f')](function(_0x453411){var _0x5cfc26;var _0x200096={},_0x23c335={};_0x23c335[_0xbf4e('0x2c')]=_[_0xbf4e('0x2d')](db[_0xbf4e('0x4d')][_0xbf4e('0x41')]);_0x23c335[_0xbf4e('0x32')]=_['keys'](_0x3e60e7[_0xbf4e('0x32')]);_0x23c335[_0xbf4e('0x2e')]=_[_0xbf4e('0x2f')](_0x23c335['model'],_0x23c335['query']);_0x200096[_0xbf4e('0x30')]=_[_0xbf4e('0x2f')](_0x23c335[_0xbf4e('0x2c')],qs['fields'](_0x3e60e7[_0xbf4e('0x32')][_0xbf4e('0x31')]));_0x200096[_0xbf4e('0x30')]=_0x200096[_0xbf4e('0x30')][_0xbf4e('0x33')]?_0x200096[_0xbf4e('0x30')]:_0x23c335[_0xbf4e('0x2c')];if(!_0x3e60e7[_0xbf4e('0x32')][_0xbf4e('0x4e')](_0xbf4e('0x4f'))){_0x200096[_0xbf4e('0x18')]=qs[_0xbf4e('0x18')](_0x3e60e7['query'][_0xbf4e('0x18')]);_0x200096['offset']=qs[_0xbf4e('0x16')](_0x3e60e7[_0xbf4e('0x32')][_0xbf4e('0x16')]);}_0x200096[_0xbf4e('0x34')]=qs[_0xbf4e('0x35')](_0x3e60e7[_0xbf4e('0x32')][_0xbf4e('0x35')]);_0x200096[_0xbf4e('0x37')]=qs['filters'](_[_0xbf4e('0x36')](_0x3e60e7[_0xbf4e('0x32')],_0x23c335[_0xbf4e('0x2e')]));if(_0x3e60e7[_0xbf4e('0x32')][_0xbf4e('0x3b')]){_0x200096['where']=_[_0xbf4e('0x38')](_0x200096[_0xbf4e('0x37')],{'$or':_[_0xbf4e('0x28')](_0x200096[_0xbf4e('0x30')],function(_0x12f19f){var _0x2c606b={};_0x2c606b[_0x12f19f]={'$like':'%'+_0x3e60e7['query'][_0xbf4e('0x3b')]+'%'};return _0x2c606b;})});}_0x200096['where']=_[_0xbf4e('0x38')](_0x200096[_0xbf4e('0x37')],{'mailboxuser':_0x453411[_0xbf4e('0x50')]});_0x200096=_[_0xbf4e('0x38')]({},_0x200096,_0x3e60e7['options']);return db[_0xbf4e('0x4d')]['findAndCountAll'](_0x200096)['then'](respondWithFilteredResult(_0x16592f,_0x200096));})[_0xbf4e('0x3f')](handleError(_0x16592f,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index da27ee9..70103e4 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 _0xdc04=['VoiceMail','voice_voicemail','mailbox_context','mailbox','lodash','util','api','moment','bluebird','rimraf','../../config/environment','./voiceMail.attributes','exports','define'];(function(_0x21f79a,_0x270644){var _0x5c511e=function(_0xea8680){while(--_0xea8680){_0x21f79a['push'](_0x21f79a['shift']());}};_0x5c511e(++_0x270644);}(_0xdc04,0xe4));var _0x4dc0=function(_0x56d158,_0x48df9d){_0x56d158=_0x56d158-0x0;var _0xa546f9=_0xdc04[_0x56d158];return _0xa546f9;};'use strict';var _=require(_0x4dc0('0x0'));var util=require(_0x4dc0('0x1'));var logger=require('../../config/logger')(_0x4dc0('0x2'));var moment=require(_0x4dc0('0x3'));var BPromise=require(_0x4dc0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4dc0('0x5'));var config=require(_0x4dc0('0x6'));var attributes=require(_0x4dc0('0x7'));module[_0x4dc0('0x8')]=function(_0xf4472d,_0x4ab966){return _0xf4472d[_0x4dc0('0x9')](_0x4dc0('0xa'),attributes,{'tableName':_0x4dc0('0xb'),'paranoid':![],'indexes':[{'name':_0x4dc0('0xc'),'fields':[_0x4dc0('0xd'),'context']}],'timestamps':!![]});}; \ No newline at end of file +var _0x48dd=['define','VoiceMail','mailbox_context','mailbox','context','lodash','util','../../config/logger','api','path','rimraf','../../config/environment','./voiceMail.attributes','exports'];(function(_0x1b5442,_0x36d41b){var _0x3b6d0e=function(_0x322bb5){while(--_0x322bb5){_0x1b5442['push'](_0x1b5442['shift']());}};_0x3b6d0e(++_0x36d41b);}(_0x48dd,0xc9));var _0xd48d=function(_0x19c72a,_0x5c0ee6){_0x19c72a=_0x19c72a-0x0;var _0x3329b8=_0x48dd[_0x19c72a];return _0x3329b8;};'use strict';var _=require(_0xd48d('0x0'));var util=require(_0xd48d('0x1'));var logger=require(_0xd48d('0x2'))(_0xd48d('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd48d('0x4'));var rimraf=require(_0xd48d('0x5'));var config=require(_0xd48d('0x6'));var attributes=require(_0xd48d('0x7'));module[_0xd48d('0x8')]=function(_0x312535,_0xb97e68){return _0x312535[_0xd48d('0x9')](_0xd48d('0xa'),attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':_0xd48d('0xb'),'fields':[_0xd48d('0xc'),_0xd48d('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index fa176bb..0878d5d 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 _0xa6b4=['catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x319a61,_0x2f7bdf){var _0x591802=function(_0x3df792){while(--_0x3df792){_0x319a61['push'](_0x319a61['shift']());}};_0x591802(++_0x2f7bdf);}(_0xa6b4,0x178));var _0x4a6b=function(_0x4a2ba2,_0x5901b9){_0x4a2ba2=_0x4a2ba2-0x0;var _0x1d09fd=_0xa6b4[_0x4a2ba2];return _0x1d09fd;};'use strict';var _=require(_0x4a6b('0x0'));var util=require(_0x4a6b('0x1'));var moment=require(_0x4a6b('0x2'));var BPromise=require('bluebird');var rs=require(_0x4a6b('0x3'));var fs=require('fs');var Redis=require(_0x4a6b('0x4'));var db=require(_0x4a6b('0x5'))['db'];var utils=require(_0x4a6b('0x6'));var logger=require(_0x4a6b('0x7'))(_0x4a6b('0x8'));var config=require(_0x4a6b('0x9'));var jayson=require(_0x4a6b('0xa'));var client=jayson[_0x4a6b('0xb')][_0x4a6b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2b3946,_0x292924,_0x19b48d){return new BPromise(function(_0x16a49d,_0x1d5727){return client[_0x4a6b('0xd')](_0x2b3946,_0x19b48d)[_0x4a6b('0xe')](function(_0xd03ff0){logger[_0x4a6b('0xf')](_0x4a6b('0x10'),_0x292924,_0x4a6b('0x11'));logger[_0x4a6b('0x12')](_0x4a6b('0x13'),_0x292924,'request\x20sent',JSON['stringify'](_0xd03ff0));if(_0xd03ff0[_0x4a6b('0x14')]){if(_0xd03ff0[_0x4a6b('0x14')][_0x4a6b('0x15')]===0x1f4){logger[_0x4a6b('0x14')](_0x4a6b('0x10'),_0x292924,_0xd03ff0[_0x4a6b('0x14')]['message']);return _0x1d5727(_0xd03ff0[_0x4a6b('0x14')][_0x4a6b('0x16')]);}logger['error'](_0x4a6b('0x10'),_0x292924,_0xd03ff0[_0x4a6b('0x14')][_0x4a6b('0x16')]);return _0x16a49d(_0xd03ff0['error'][_0x4a6b('0x16')]);}else{logger[_0x4a6b('0xf')](_0x4a6b('0x10'),_0x292924,_0x4a6b('0x11'));_0x16a49d(_0xd03ff0[_0x4a6b('0x17')]['message']);}})[_0x4a6b('0x18')](function(_0x38937e){logger[_0x4a6b('0x14')](_0x4a6b('0x10'),_0x292924,_0x38937e);_0x1d5727(_0x38937e);});});} \ No newline at end of file +var _0xd290=['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','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','then'];(function(_0x11ced4,_0x44ac13){var _0x1e687f=function(_0x1dd632){while(--_0x1dd632){_0x11ced4['push'](_0x11ced4['shift']());}};_0x1e687f(++_0x44ac13);}(_0xd290,0x1bb));var _0x0d29=function(_0x5a6eeb,_0x2cff2c){_0x5a6eeb=_0x5a6eeb-0x0;var _0x324916=_0xd290[_0x5a6eeb];return _0x324916;};'use strict';var _=require(_0x0d29('0x0'));var util=require(_0x0d29('0x1'));var moment=require(_0x0d29('0x2'));var BPromise=require(_0x0d29('0x3'));var rs=require(_0x0d29('0x4'));var fs=require('fs');var Redis=require(_0x0d29('0x5'));var db=require(_0x0d29('0x6'))['db'];var utils=require(_0x0d29('0x7'));var logger=require('../../config/logger')(_0x0d29('0x8'));var config=require(_0x0d29('0x9'));var jayson=require(_0x0d29('0xa'));var client=jayson['client'][_0x0d29('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2a0179,_0x3b9efd,_0x106d36){return new BPromise(function(_0x4f4adf,_0x386f21){return client['request'](_0x2a0179,_0x106d36)[_0x0d29('0xc')](function(_0x27ae6a){logger[_0x0d29('0xd')](_0x0d29('0xe'),_0x3b9efd,_0x0d29('0xf'));logger[_0x0d29('0x10')](_0x0d29('0x11'),_0x3b9efd,_0x0d29('0xf'),JSON[_0x0d29('0x12')](_0x27ae6a));if(_0x27ae6a[_0x0d29('0x13')]){if(_0x27ae6a[_0x0d29('0x13')][_0x0d29('0x14')]===0x1f4){logger[_0x0d29('0x13')](_0x0d29('0xe'),_0x3b9efd,_0x27ae6a[_0x0d29('0x13')]['message']);return _0x386f21(_0x27ae6a[_0x0d29('0x13')][_0x0d29('0x15')]);}logger[_0x0d29('0x13')](_0x0d29('0xe'),_0x3b9efd,_0x27ae6a[_0x0d29('0x13')][_0x0d29('0x15')]);return _0x4f4adf(_0x27ae6a[_0x0d29('0x13')][_0x0d29('0x15')]);}else{logger['info'](_0x0d29('0xe'),_0x3b9efd,_0x0d29('0xf'));_0x4f4adf(_0x27ae6a[_0x0d29('0x16')][_0x0d29('0x15')]);}})[_0x0d29('0x17')](function(_0x81f5a2){logger[_0x0d29('0x13')]('VoiceMail,\x20%s,\x20%s',_0x3b9efd,_0x81f5a2);_0x386f21(_0x81f5a2);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index f6bb4c1..c7e82cf 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 _0x0ffa=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','./voiceMailMessage.controller','get','index','/:id','isAuthenticated','show','/:id/download','download','post','put','update','delete','destroy','exports','multer','path'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x0ffa,0x10f));var _0xa0ff=function(_0x4bc06e,_0xb9db1f){_0x4bc06e=_0x4bc06e-0x0;var _0x429c6e=_0x0ffa[_0x4bc06e];return _0x429c6e;};'use strict';var multer=require(_0xa0ff('0x0'));var util=require('util');var path=require(_0xa0ff('0x1'));var timeout=require(_0xa0ff('0x2'));var express=require(_0xa0ff('0x3'));var router=express[_0xa0ff('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xa0ff('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa0ff('0x6'));var controller=require(_0xa0ff('0x7'));router[_0xa0ff('0x8')]('/',auth['isAuthenticated'](),controller[_0xa0ff('0x9')]);router[_0xa0ff('0x8')](_0xa0ff('0xa'),auth[_0xa0ff('0xb')](),controller[_0xa0ff('0xc')]);router[_0xa0ff('0x8')](_0xa0ff('0xd'),auth['isAuthenticated'](),controller[_0xa0ff('0xe')]);router[_0xa0ff('0xf')]('/',auth[_0xa0ff('0xb')](),controller['create']);router[_0xa0ff('0x10')]('/:id',auth[_0xa0ff('0xb')](),controller[_0xa0ff('0x11')]);router[_0xa0ff('0x12')](_0xa0ff('0xa'),auth[_0xa0ff('0xb')](),controller[_0xa0ff('0x13')]);module[_0xa0ff('0x14')]=router; \ No newline at end of file +var _0x68f0=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','isAuthenticated','get','/:id','show','/:id/download','download','create','update','delete','destroy','exports','multer','util','connect-timeout'];(function(_0x10ce4d,_0x3517cd){var _0x2efc6f=function(_0x1775de){while(--_0x1775de){_0x10ce4d['push'](_0x10ce4d['shift']());}};_0x2efc6f(++_0x3517cd);}(_0x68f0,0xa5));var _0x068f=function(_0x44b04c,_0x5786a3){_0x44b04c=_0x44b04c-0x0;var _0x1d2442=_0x68f0[_0x44b04c];return _0x1d2442;};'use strict';var multer=require(_0x068f('0x0'));var util=require(_0x068f('0x1'));var path=require('path');var timeout=require(_0x068f('0x2'));var express=require(_0x068f('0x3'));var router=express[_0x068f('0x4')]();var fs_extra=require(_0x068f('0x5'));var auth=require(_0x068f('0x6'));var interaction=require(_0x068f('0x7'));var config=require(_0x068f('0x8'));var controller=require(_0x068f('0x9'));router['get']('/',auth[_0x068f('0xa')](),controller['index']);router[_0x068f('0xb')](_0x068f('0xc'),auth[_0x068f('0xa')](),controller[_0x068f('0xd')]);router['get'](_0x068f('0xe'),auth[_0x068f('0xa')](),controller[_0x068f('0xf')]);router['post']('/',auth[_0x068f('0xa')](),controller[_0x068f('0x10')]);router['put'](_0x068f('0xc'),auth[_0x068f('0xa')](),controller[_0x068f('0x11')]);router[_0x068f('0x12')](_0x068f('0xc'),auth[_0x068f('0xa')](),controller[_0x068f('0x13')]);module[_0x068f('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index f30bfb1..d91125a 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 _0x6610=['getDataValue','STRING','BLOB','long','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','VIRTUAL'];(function(_0x53cb3e,_0x221d40){var _0x3b87b1=function(_0x1e7151){while(--_0x1e7151){_0x53cb3e['push'](_0x53cb3e['shift']());}};_0x3b87b1(++_0x221d40);}(_0x6610,0x1da));var _0x0661=function(_0x1226c2,_0x3dc25c){_0x1226c2=_0x1226c2-0x0;var _0x1843b5=_0x6610[_0x1226c2];return _0x1843b5;};'use strict';var Sequelize=require(_0x0661('0x0'));module[_0x0661('0x1')]={'name':{'type':Sequelize[_0x0661('0x2')],'get':function(_0x9c7bbf){return this[_0x0661('0x3')]('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize[_0x0661('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0x0661('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0x0661('0x4')],'defaultValue':''},'duration':{'type':Sequelize[_0x0661('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x0661('0x4')],'defaultValue':''},'recording':{'type':Sequelize[_0x0661('0x5')](_0x0661('0x6')),'defaultValue':null},'flag':{'type':Sequelize[_0x0661('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':'TIMESTAMP','defaultValue':Sequelize[_0x0661('0x7')](_0x0661('0x8'))}}; \ No newline at end of file +var _0x5696=['getDataValue','STRING','BLOB','long','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','exports','VIRTUAL'];(function(_0x412c2f,_0x465005){var _0x5b858e=function(_0x49116e){while(--_0x49116e){_0x412c2f['push'](_0x412c2f['shift']());}};_0x5b858e(++_0x465005);}(_0x5696,0x7c));var _0x6569=function(_0x10864c,_0x49ca5e){_0x10864c=_0x10864c-0x0;var _0x4484ce=_0x5696[_0x10864c];return _0x4484ce;};'use strict';var Sequelize=require('sequelize');module[_0x6569('0x0')]={'name':{'type':Sequelize[_0x6569('0x1')],'get':function(_0x22fa7c){return this[_0x6569('0x2')]('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x6569('0x3')],'defaultValue':''},'context':{'type':Sequelize[_0x6569('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x6569('0x3')],'defaultValue':''},'callerid':{'type':Sequelize[_0x6569('0x3')],'defaultValue':''},'origtime':{'type':Sequelize[_0x6569('0x3')],'defaultValue':''},'duration':{'type':Sequelize[_0x6569('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x6569('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x6569('0x3')],'defaultValue':''},'recording':{'type':Sequelize[_0x6569('0x4')](_0x6569('0x5')),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize[_0x6569('0x3')],'defaultValue':''},'stamp':{'type':_0x6569('0x6'),'defaultValue':Sequelize[_0x6569('0x7')](_0x6569('0x8'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 067fd38..503f19d 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 _0x60a7=['options','includeAll','include','rows','show','params','find','catch','create','body','download','recording','msg_id','Sequelize','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','.wav\x22','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count','set','json','apply','save','update','then','destroy','sendStatus','error','name','send','map','VoiceMailMessage','rawAttributes','fieldName','type','key','differenceBy','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','where','merge','VIRTUAL'];(function(_0x346dc6,_0x284013){var _0x3925b2=function(_0x20ade6){while(--_0x20ade6){_0x346dc6['push'](_0x346dc6['shift']());}};_0x3925b2(++_0x284013);}(_0x60a7,0x1ad));var _0x760a=function(_0x4d35c8,_0x1ce8f2){_0x4d35c8=_0x4d35c8-0x0;var _0x2ebc18=_0x60a7[_0x4d35c8];return _0x2ebc18;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x760a('0x0'));var jsonpatch=require(_0x760a('0x1'));var rp=require(_0x760a('0x2'));var moment=require(_0x760a('0x3'));var BPromise=require(_0x760a('0x4'));var Mustache=require(_0x760a('0x5'));var util=require(_0x760a('0x6'));var path=require(_0x760a('0x7'));var sox=require(_0x760a('0x8'));var csv=require(_0x760a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x760a('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x760a('0xb'));var jsforce=require(_0x760a('0xc'));var deskjs=require(_0x760a('0xd'));var toCsv=require('to-csv');var querystring=require(_0x760a('0xe'));var Papa=require(_0x760a('0xf'));var Redis=require(_0x760a('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x760a('0x11'));var as=require(_0x760a('0x12'));var hardwareService=require(_0x760a('0x13'));var logger=require(_0x760a('0x14'))('api');var utils=require(_0x760a('0x15'));var config=require(_0x760a('0x16'));var licenseUtil=require(_0x760a('0x17'));var db=require(_0x760a('0x18'))['db'];function respondWithStatusCode(_0x356f61,_0x1e8961){_0x1e8961=_0x1e8961||0xcc;return function(_0x3d0c34){if(_0x3d0c34){return _0x356f61['sendStatus'](_0x1e8961);}return _0x356f61[_0x760a('0x19')](_0x1e8961)['end']();};}function respondWithResult(_0x5c84ef,_0xa1fb0d){_0xa1fb0d=_0xa1fb0d||0xc8;return function(_0x525817){if(_0x525817){return _0x5c84ef[_0x760a('0x19')](_0xa1fb0d)['json'](_0x525817);}};}function respondWithFilteredResult(_0x47e82d,_0x44165f){return function(_0x35ed7a){if(_0x35ed7a){var _0x1677bf=typeof _0x44165f[_0x760a('0x1a')]===_0x760a('0x1b')&&typeof _0x44165f[_0x760a('0x1c')]===_0x760a('0x1b');var _0x3cdb33=_0x35ed7a[_0x760a('0x1d')];var _0x56dfc2=_0x1677bf?0x0:_0x44165f['offset'];var _0x239f00=_0x1677bf?_0x35ed7a[_0x760a('0x1d')]:_0x44165f[_0x760a('0x1a')]+_0x44165f[_0x760a('0x1c')];var _0x58b12b;if(_0x239f00>=_0x3cdb33){_0x239f00=_0x3cdb33;_0x58b12b=0xc8;}else{_0x58b12b=0xce;}_0x47e82d['status'](_0x58b12b);return _0x47e82d[_0x760a('0x1e')]('Content-Range',_0x56dfc2+'-'+_0x239f00+'/'+_0x3cdb33)[_0x760a('0x1f')](_0x35ed7a);}return null;};}function patchUpdates(_0x2c1ec1){return function(_0x1a2b58){try{jsonpatch[_0x760a('0x20')](_0x1a2b58,_0x2c1ec1,!![]);}catch(_0x558d47){return BPromise['reject'](_0x558d47);}return _0x1a2b58[_0x760a('0x21')]();};}function saveUpdates(_0x257edf,_0x1e48b4){return function(_0x5d430a){if(_0x5d430a){return _0x5d430a[_0x760a('0x22')](_0x257edf)[_0x760a('0x23')](function(_0x9e09c7){return _0x9e09c7;});}return null;};}function removeEntity(_0x212504,_0xf81445){return function(_0x3a766f){if(_0x3a766f){return _0x3a766f[_0x760a('0x24')]()['then'](function(){_0x212504['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x34524f,_0x5f0712){return function(_0x53b04f){if(!_0x53b04f){_0x34524f[_0x760a('0x25')](0x194);}return _0x53b04f;};}function handleError(_0x321c6f,_0x492eff){_0x492eff=_0x492eff||0x1f4;return function(_0x21bd60){logger[_0x760a('0x26')](_0x21bd60['stack']);if(_0x21bd60['name']){delete _0x21bd60[_0x760a('0x27')];}_0x321c6f[_0x760a('0x19')](_0x492eff)[_0x760a('0x28')](_0x21bd60);};}exports['index']=function(_0x400197,_0x3b0582){var _0x3b851e={},_0x5418fe={},_0x53dd9d={'count':0x0,'rows':[]};var _0x3cec4a=_[_0x760a('0x29')](db[_0x760a('0x2a')][_0x760a('0x2b')],function(_0x1e9614){return{'name':_0x1e9614[_0x760a('0x2c')],'type':_0x1e9614[_0x760a('0x2d')][_0x760a('0x2e')]};});_0x5418fe['model']=_[_0x760a('0x2f')](_['map'](_0x3cec4a,_0x760a('0x27')),[_0x760a('0x27')]);_0x5418fe[_0x760a('0x30')]=_[_0x760a('0x31')](_0x400197[_0x760a('0x30')]);_0x5418fe[_0x760a('0x32')]=_[_0x760a('0x33')](_0x5418fe[_0x760a('0x34')],_0x5418fe[_0x760a('0x30')]);_0x3b851e[_0x760a('0x35')]=_[_0x760a('0x33')](_0x5418fe[_0x760a('0x34')],qs[_0x760a('0x36')](_0x400197[_0x760a('0x30')][_0x760a('0x36')]));_0x3b851e[_0x760a('0x35')]=_0x3b851e[_0x760a('0x35')][_0x760a('0x37')]?_0x3b851e[_0x760a('0x35')]:_0x5418fe[_0x760a('0x34')];if(!_0x400197[_0x760a('0x30')][_0x760a('0x38')](_0x760a('0x39'))){_0x3b851e[_0x760a('0x1c')]=qs['limit'](_0x400197[_0x760a('0x30')]['limit']);_0x3b851e[_0x760a('0x1a')]=qs[_0x760a('0x1a')](_0x400197[_0x760a('0x30')]['offset']);}_0x3b851e['order']=qs['sort'](_0x400197['query'][_0x760a('0x3a')]);_0x3b851e['where']=qs[_0x760a('0x32')](_['pick'](_0x400197[_0x760a('0x30')],_0x5418fe[_0x760a('0x32')]),_0x3cec4a);if(_0x400197[_0x760a('0x30')][_0x760a('0x3b')]){_0x3b851e[_0x760a('0x3c')]=_[_0x760a('0x3d')](_0x3b851e[_0x760a('0x3c')],{'$or':_[_0x760a('0x29')](_0x3cec4a,function(_0xd2627f){if(_0xd2627f['type']!==_0x760a('0x3e')){var _0x29b008={};_0x29b008[_0xd2627f[_0x760a('0x27')]]={'$like':'%'+_0x400197['query'][_0x760a('0x3b')]+'%'};return _0x29b008;}})});}_0x3b851e=_[_0x760a('0x3d')]({},_0x3b851e,_0x400197[_0x760a('0x3f')]);var _0xbeacee={'where':_0x3b851e[_0x760a('0x3c')]};return db[_0x760a('0x2a')][_0x760a('0x1d')](_0xbeacee)[_0x760a('0x23')](function(_0x49a040){_0x53dd9d[_0x760a('0x1d')]=_0x49a040;if(_0x400197['query'][_0x760a('0x40')]){_0x3b851e[_0x760a('0x41')]=[{'all':!![]}];}return db['VoiceMailMessage']['findAll'](_0x3b851e);})[_0x760a('0x23')](function(_0x3731c2){_0x53dd9d[_0x760a('0x42')]=_0x3731c2;return _0x53dd9d;})['then'](respondWithFilteredResult(_0x3b0582,_0x3b851e))['catch'](handleError(_0x3b0582,null));};exports[_0x760a('0x43')]=function(_0x443b0b,_0x28bab5){var _0x3c9ae9={'raw':!![],'where':{'id':_0x443b0b[_0x760a('0x44')]['id']}},_0x255d6f={};_0x255d6f[_0x760a('0x34')]=_['keys'](db['VoiceMailMessage'][_0x760a('0x2b')]);_0x255d6f[_0x760a('0x30')]=_[_0x760a('0x31')](_0x443b0b[_0x760a('0x30')]);_0x255d6f[_0x760a('0x32')]=_[_0x760a('0x33')](_0x255d6f['model'],_0x255d6f[_0x760a('0x30')]);_0x3c9ae9[_0x760a('0x35')]=_[_0x760a('0x33')](_0x255d6f[_0x760a('0x34')],qs[_0x760a('0x36')](_0x443b0b[_0x760a('0x30')]['fields']));_0x3c9ae9[_0x760a('0x35')]=_0x3c9ae9[_0x760a('0x35')][_0x760a('0x37')]?_0x3c9ae9['attributes']:_0x255d6f[_0x760a('0x34')];if(_0x443b0b[_0x760a('0x30')][_0x760a('0x40')]){_0x3c9ae9[_0x760a('0x41')]=[{'all':!![]}];}_0x3c9ae9=_[_0x760a('0x3d')]({},_0x3c9ae9,_0x443b0b[_0x760a('0x3f')]);return db[_0x760a('0x2a')][_0x760a('0x45')](_0x3c9ae9)[_0x760a('0x23')](handleEntityNotFound(_0x28bab5,null))[_0x760a('0x23')](respondWithResult(_0x28bab5,null))[_0x760a('0x46')](handleError(_0x28bab5,null));};exports[_0x760a('0x47')]=function(_0x558769,_0x807417){return db[_0x760a('0x2a')][_0x760a('0x47')](_0x558769[_0x760a('0x48')],{})[_0x760a('0x23')](respondWithResult(_0x807417,0xc9))[_0x760a('0x46')](handleError(_0x807417,null));};exports[_0x760a('0x22')]=function(_0x198d8a,_0x5a3260){if(_0x198d8a['body']['id']){delete _0x198d8a[_0x760a('0x48')]['id'];}return db[_0x760a('0x2a')][_0x760a('0x45')]({'where':{'id':_0x198d8a[_0x760a('0x44')]['id']}})[_0x760a('0x23')](handleEntityNotFound(_0x5a3260,null))[_0x760a('0x23')](saveUpdates(_0x198d8a[_0x760a('0x48')],null))['then'](respondWithResult(_0x5a3260,null))['catch'](handleError(_0x5a3260,null));};exports[_0x760a('0x24')]=function(_0x1ec57b,_0x864013){return db[_0x760a('0x2a')][_0x760a('0x45')]({'where':{'id':_0x1ec57b[_0x760a('0x44')]['id']}})[_0x760a('0x23')](handleEntityNotFound(_0x864013,null))[_0x760a('0x23')](removeEntity(_0x864013,null))[_0x760a('0x46')](handleError(_0x864013,null));};exports[_0x760a('0x49')]=function(_0xe792a3,_0x5ea028,_0xe3ea73){return db['VoiceMailMessage'][_0x760a('0x45')]({'where':{'id':_0xe792a3['params']['id']},'attributes':['id',_0x760a('0x4a'),_0x760a('0x4b')]})[_0x760a('0x23')](handleEntityNotFound(_0x5ea028,null))[_0x760a('0x23')](function(_0x4f5435){if(_0x4f5435){if(!_0x4f5435[_0x760a('0x4a')]){throw new db[(_0x760a('0x4c'))]['ValidationError'](_0x760a('0x4d'));}var _0x57ac3c={'Content-Type':_0x760a('0x4e'),'Content-Disposition':_0x760a('0x4f')};if(_0x4f5435[_0x760a('0x4b')]){_0x57ac3c[_0x760a('0x50')]='attachment;\x20filename=\x22'+_0x4f5435[_0x760a('0x4b')]+_0x760a('0x51');}_0x5ea028[_0x760a('0x1e')](_0x57ac3c);return _0x5ea028[_0x760a('0x28')](new Buffer(_0x4f5435[_0x760a('0x4a')]));}})[_0x760a('0x46')](handleError(_0x5ea028,null));}; \ No newline at end of file +var _0xfc42=['fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','includeAll','findAll','rows','show','params','include','options','find','create','body','catch','download','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment;\x20filename=\x22','.wav\x22','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','VoiceMailMessage','rawAttributes','fieldName','model','keys','query','filters','intersection','attributes'];(function(_0x3f135c,_0x2f4301){var _0x537152=function(_0x13a352){while(--_0x13a352){_0x3f135c['push'](_0x3f135c['shift']());}};_0x537152(++_0x2f4301);}(_0xfc42,0x128));var _0x2fc4=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xfc42[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x2fc4('0x0'));var rimraf=require(_0x2fc4('0x1'));var zipdir=require(_0x2fc4('0x2'));var jsonpatch=require(_0x2fc4('0x3'));var rp=require(_0x2fc4('0x4'));var moment=require(_0x2fc4('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x2fc4('0x6'));var util=require('util');var path=require(_0x2fc4('0x7'));var sox=require(_0x2fc4('0x8'));var csv=require(_0x2fc4('0x9'));var ejs=require(_0x2fc4('0xa'));var fs=require('fs');var fs_extra=require(_0x2fc4('0xb'));var _=require(_0x2fc4('0xc'));var squel=require(_0x2fc4('0xd'));var crypto=require('crypto');var jsforce=require(_0x2fc4('0xe'));var deskjs=require(_0x2fc4('0xf'));var toCsv=require(_0x2fc4('0x9'));var querystring=require(_0x2fc4('0x10'));var Papa=require(_0x2fc4('0x11'));var Redis=require('ioredis');var authService=require(_0x2fc4('0x12'));var qs=require(_0x2fc4('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2fc4('0x14'));var logger=require(_0x2fc4('0x15'))(_0x2fc4('0x16'));var utils=require(_0x2fc4('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x2fc4('0x18'));var db=require(_0x2fc4('0x19'))['db'];function respondWithStatusCode(_0x30a05f,_0x1cd940){_0x1cd940=_0x1cd940||0xcc;return function(_0x3f2bcc){if(_0x3f2bcc){return _0x30a05f['sendStatus'](_0x1cd940);}return _0x30a05f['status'](_0x1cd940)['end']();};}function respondWithResult(_0x2f203a,_0x469aa2){_0x469aa2=_0x469aa2||0xc8;return function(_0x432b67){if(_0x432b67){return _0x2f203a[_0x2fc4('0x1a')](_0x469aa2)[_0x2fc4('0x1b')](_0x432b67);}};}function respondWithFilteredResult(_0x47435c,_0x4619ac){return function(_0x49117c){if(_0x49117c){var _0xa1ac77=typeof _0x4619ac[_0x2fc4('0x1c')]===_0x2fc4('0x1d')&&typeof _0x4619ac[_0x2fc4('0x1e')]===_0x2fc4('0x1d');var _0x2c45dd=_0x49117c[_0x2fc4('0x1f')];var _0x111411=_0xa1ac77?0x0:_0x4619ac['offset'];var _0x582302=_0xa1ac77?_0x49117c[_0x2fc4('0x1f')]:_0x4619ac[_0x2fc4('0x1c')]+_0x4619ac[_0x2fc4('0x1e')];var _0x558a9f;if(_0x582302>=_0x2c45dd){_0x582302=_0x2c45dd;_0x558a9f=0xc8;}else{_0x558a9f=0xce;}_0x47435c[_0x2fc4('0x1a')](_0x558a9f);return _0x47435c[_0x2fc4('0x20')]('Content-Range',_0x111411+'-'+_0x582302+'/'+_0x2c45dd)['json'](_0x49117c);}return null;};}function patchUpdates(_0x53482e){return function(_0x22d871){try{jsonpatch[_0x2fc4('0x21')](_0x22d871,_0x53482e,!![]);}catch(_0x93d624){return BPromise[_0x2fc4('0x22')](_0x93d624);}return _0x22d871[_0x2fc4('0x23')]();};}function saveUpdates(_0x1445fd,_0x123763){return function(_0x3abd0b){if(_0x3abd0b){return _0x3abd0b[_0x2fc4('0x24')](_0x1445fd)[_0x2fc4('0x25')](function(_0x39efbc){return _0x39efbc;});}return null;};}function removeEntity(_0x4e7f07,_0x4c0c61){return function(_0x338e95){if(_0x338e95){return _0x338e95[_0x2fc4('0x26')]()[_0x2fc4('0x25')](function(){_0x4e7f07[_0x2fc4('0x1a')](0xcc)[_0x2fc4('0x27')]();});}};}function handleEntityNotFound(_0x564791,_0x3eabda){return function(_0x153a5b){if(!_0x153a5b){_0x564791[_0x2fc4('0x28')](0x194);}return _0x153a5b;};}function handleError(_0x1c5073,_0x178b56){_0x178b56=_0x178b56||0x1f4;return function(_0x2743ce){logger[_0x2fc4('0x29')](_0x2743ce[_0x2fc4('0x2a')]);if(_0x2743ce[_0x2fc4('0x2b')]){delete _0x2743ce[_0x2fc4('0x2b')];}_0x1c5073[_0x2fc4('0x1a')](_0x178b56)[_0x2fc4('0x2c')](_0x2743ce);};}exports[_0x2fc4('0x2d')]=function(_0x517e2e,_0x2141b8){var _0x45404f={},_0x1a0d67={},_0x34841a={'count':0x0,'rows':[]};var _0x2966cc=_[_0x2fc4('0x2e')](db[_0x2fc4('0x2f')][_0x2fc4('0x30')],function(_0x54e0b6){return{'name':_0x54e0b6[_0x2fc4('0x31')],'type':_0x54e0b6['type']['key']};});_0x1a0d67[_0x2fc4('0x32')]=_['differenceBy'](_[_0x2fc4('0x2e')](_0x2966cc,'name'),[_0x2fc4('0x2b')]);_0x1a0d67['query']=_[_0x2fc4('0x33')](_0x517e2e[_0x2fc4('0x34')]);_0x1a0d67[_0x2fc4('0x35')]=_[_0x2fc4('0x36')](_0x1a0d67[_0x2fc4('0x32')],_0x1a0d67[_0x2fc4('0x34')]);_0x45404f[_0x2fc4('0x37')]=_[_0x2fc4('0x36')](_0x1a0d67[_0x2fc4('0x32')],qs[_0x2fc4('0x38')](_0x517e2e[_0x2fc4('0x34')][_0x2fc4('0x38')]));_0x45404f[_0x2fc4('0x37')]=_0x45404f[_0x2fc4('0x37')][_0x2fc4('0x39')]?_0x45404f[_0x2fc4('0x37')]:_0x1a0d67[_0x2fc4('0x32')];if(!_0x517e2e[_0x2fc4('0x34')][_0x2fc4('0x3a')](_0x2fc4('0x3b'))){_0x45404f[_0x2fc4('0x1e')]=qs[_0x2fc4('0x1e')](_0x517e2e[_0x2fc4('0x34')]['limit']);_0x45404f['offset']=qs[_0x2fc4('0x1c')](_0x517e2e[_0x2fc4('0x34')][_0x2fc4('0x1c')]);}_0x45404f[_0x2fc4('0x3c')]=qs[_0x2fc4('0x3d')](_0x517e2e[_0x2fc4('0x34')]['sort']);_0x45404f[_0x2fc4('0x3e')]=qs[_0x2fc4('0x35')](_[_0x2fc4('0x3f')](_0x517e2e[_0x2fc4('0x34')],_0x1a0d67['filters']),_0x2966cc);if(_0x517e2e[_0x2fc4('0x34')][_0x2fc4('0x40')]){_0x45404f[_0x2fc4('0x3e')]=_['merge'](_0x45404f[_0x2fc4('0x3e')],{'$or':_[_0x2fc4('0x2e')](_0x2966cc,function(_0x4bfb45){if(_0x4bfb45[_0x2fc4('0x41')]!==_0x2fc4('0x42')){var _0x5bdcb8={};_0x5bdcb8[_0x4bfb45['name']]={'$like':'%'+_0x517e2e[_0x2fc4('0x34')]['filter']+'%'};return _0x5bdcb8;}})});}_0x45404f=_[_0x2fc4('0x43')]({},_0x45404f,_0x517e2e['options']);var _0x1b6acf={'where':_0x45404f['where']};return db[_0x2fc4('0x2f')][_0x2fc4('0x1f')](_0x1b6acf)[_0x2fc4('0x25')](function(_0x48422f){_0x34841a[_0x2fc4('0x1f')]=_0x48422f;if(_0x517e2e[_0x2fc4('0x34')][_0x2fc4('0x44')]){_0x45404f['include']=[{'all':!![]}];}return db['VoiceMailMessage'][_0x2fc4('0x45')](_0x45404f);})[_0x2fc4('0x25')](function(_0x5cf521){_0x34841a[_0x2fc4('0x46')]=_0x5cf521;return _0x34841a;})[_0x2fc4('0x25')](respondWithFilteredResult(_0x2141b8,_0x45404f))['catch'](handleError(_0x2141b8,null));};exports[_0x2fc4('0x47')]=function(_0x29cb19,_0x58e588){var _0x19a67f={'raw':!![],'where':{'id':_0x29cb19[_0x2fc4('0x48')]['id']}},_0xa9a8f7={};_0xa9a8f7[_0x2fc4('0x32')]=_['keys'](db['VoiceMailMessage'][_0x2fc4('0x30')]);_0xa9a8f7[_0x2fc4('0x34')]=_[_0x2fc4('0x33')](_0x29cb19[_0x2fc4('0x34')]);_0xa9a8f7[_0x2fc4('0x35')]=_[_0x2fc4('0x36')](_0xa9a8f7['model'],_0xa9a8f7[_0x2fc4('0x34')]);_0x19a67f[_0x2fc4('0x37')]=_[_0x2fc4('0x36')](_0xa9a8f7[_0x2fc4('0x32')],qs[_0x2fc4('0x38')](_0x29cb19['query'][_0x2fc4('0x38')]));_0x19a67f['attributes']=_0x19a67f[_0x2fc4('0x37')]['length']?_0x19a67f[_0x2fc4('0x37')]:_0xa9a8f7[_0x2fc4('0x32')];if(_0x29cb19[_0x2fc4('0x34')][_0x2fc4('0x44')]){_0x19a67f[_0x2fc4('0x49')]=[{'all':!![]}];}_0x19a67f=_['merge']({},_0x19a67f,_0x29cb19[_0x2fc4('0x4a')]);return db[_0x2fc4('0x2f')][_0x2fc4('0x4b')](_0x19a67f)[_0x2fc4('0x25')](handleEntityNotFound(_0x58e588,null))['then'](respondWithResult(_0x58e588,null))['catch'](handleError(_0x58e588,null));};exports[_0x2fc4('0x4c')]=function(_0x33315e,_0xb067eb){return db[_0x2fc4('0x2f')]['create'](_0x33315e[_0x2fc4('0x4d')],{})[_0x2fc4('0x25')](respondWithResult(_0xb067eb,0xc9))[_0x2fc4('0x4e')](handleError(_0xb067eb,null));};exports[_0x2fc4('0x24')]=function(_0x46f6f4,_0x46b3fc){if(_0x46f6f4['body']['id']){delete _0x46f6f4[_0x2fc4('0x4d')]['id'];}return db[_0x2fc4('0x2f')][_0x2fc4('0x4b')]({'where':{'id':_0x46f6f4[_0x2fc4('0x48')]['id']}})[_0x2fc4('0x25')](handleEntityNotFound(_0x46b3fc,null))[_0x2fc4('0x25')](saveUpdates(_0x46f6f4[_0x2fc4('0x4d')],null))['then'](respondWithResult(_0x46b3fc,null))['catch'](handleError(_0x46b3fc,null));};exports[_0x2fc4('0x26')]=function(_0xdd5c7f,_0x1f70df){return db[_0x2fc4('0x2f')][_0x2fc4('0x4b')]({'where':{'id':_0xdd5c7f['params']['id']}})['then'](handleEntityNotFound(_0x1f70df,null))['then'](removeEntity(_0x1f70df,null))[_0x2fc4('0x4e')](handleError(_0x1f70df,null));};exports[_0x2fc4('0x4f')]=function(_0x2c876c,_0x203255,_0x2fb16e){return db['VoiceMailMessage'][_0x2fc4('0x4b')]({'where':{'id':_0x2c876c[_0x2fc4('0x48')]['id']},'attributes':['id',_0x2fc4('0x50'),_0x2fc4('0x51')]})[_0x2fc4('0x25')](handleEntityNotFound(_0x203255,null))[_0x2fc4('0x25')](function(_0x356181){if(_0x356181){if(!_0x356181['recording']){throw new db[(_0x2fc4('0x52'))][(_0x2fc4('0x53'))](_0x2fc4('0x54'));}var _0x39d4e6={'Content-Type':_0x2fc4('0x55'),'Content-Disposition':'attachment'};if(_0x356181[_0x2fc4('0x51')]){_0x39d4e6['Content-Disposition']=_0x2fc4('0x56')+_0x356181[_0x2fc4('0x51')]+_0x2fc4('0x57');}_0x203255[_0x2fc4('0x20')](_0x39d4e6);return _0x203255[_0x2fc4('0x2c')](new Buffer(_0x356181[_0x2fc4('0x50')]));}})['catch'](handleError(_0x203255,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index deb3303..e769a89 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 _0x9ea8=['api','moment','bluebird','request-promise','path','rimraf','exports','define','VoiceMailMessage','dir','lodash','util','../../config/logger'];(function(_0x52a258,_0x354c0a){var _0x2f20c8=function(_0x52b10b){while(--_0x52b10b){_0x52a258['push'](_0x52a258['shift']());}};_0x2f20c8(++_0x354c0a);}(_0x9ea8,0x65));var _0x89ea=function(_0x216450,_0x5d25aa){_0x216450=_0x216450-0x0;var _0x105a05=_0x9ea8[_0x216450];return _0x105a05;};'use strict';var _=require(_0x89ea('0x0'));var util=require(_0x89ea('0x1'));var logger=require(_0x89ea('0x2'))(_0x89ea('0x3'));var moment=require(_0x89ea('0x4'));var BPromise=require(_0x89ea('0x5'));var rp=require(_0x89ea('0x6'));var fs=require('fs');var path=require(_0x89ea('0x7'));var rimraf=require(_0x89ea('0x8'));var config=require('../../config/environment');var attributes=require('./voiceMailMessage.attributes');module[_0x89ea('0x9')]=function(_0x4b8be7,_0x14d3e9){return _0x4b8be7[_0x89ea('0xa')](_0x89ea('0xb'),attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':'dir','fields':[_0x89ea('0xc')]}],'timestamps':![]});}; \ No newline at end of file +var _0x77c2=['api','moment','bluebird','path','rimraf','./voiceMailMessage.attributes','define','dir','lodash','util','../../config/logger'];(function(_0x3823be,_0xd64149){var _0x1c2ea2=function(_0x10ba8e){while(--_0x10ba8e){_0x3823be['push'](_0x3823be['shift']());}};_0x1c2ea2(++_0xd64149);}(_0x77c2,0xa2));var _0x277c=function(_0x651c32,_0x554df9){_0x651c32=_0x651c32-0x0;var _0x25c174=_0x77c2[_0x651c32];return _0x25c174;};'use strict';var _=require(_0x277c('0x0'));var util=require(_0x277c('0x1'));var logger=require(_0x277c('0x2'))(_0x277c('0x3'));var moment=require(_0x277c('0x4'));var BPromise=require(_0x277c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x277c('0x6'));var rimraf=require(_0x277c('0x7'));var config=require('../../config/environment');var attributes=require(_0x277c('0x8'));module['exports']=function(_0xbd18af,_0x492223){return _0xbd18af[_0x277c('0x9')]('VoiceMailMessage',attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':'dir','fields':[_0x277c('0xa')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 8f556b1..fcfd9d6 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 _0x51d0=['../../config/environment','jayson/promise','http','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x1a4e40,_0x496bb2){var _0xb4486c=function(_0x254f7b){while(--_0x254f7b){_0x1a4e40['push'](_0x1a4e40['shift']());}};_0xb4486c(++_0x496bb2);}(_0x51d0,0x1b1));var _0x051d=function(_0x28611e,_0x586726){_0x28611e=_0x28611e-0x0;var _0x530f69=_0x51d0[_0x28611e];return _0x530f69;};'use strict';var _=require('lodash');var util=require(_0x051d('0x0'));var moment=require(_0x051d('0x1'));var BPromise=require('bluebird');var rs=require(_0x051d('0x2'));var fs=require('fs');var Redis=require(_0x051d('0x3'));var db=require(_0x051d('0x4'))['db'];var utils=require(_0x051d('0x5'));var logger=require(_0x051d('0x6'))('rpc');var config=require(_0x051d('0x7'));var jayson=require(_0x051d('0x8'));var client=jayson['client'][_0x051d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x48427b,_0x33d46d,_0x22d9da){return new BPromise(function(_0x5e0003,_0x421544){return client['request'](_0x48427b,_0x22d9da)[_0x051d('0xa')](function(_0x40b6c0){logger[_0x051d('0xb')](_0x051d('0xc'),_0x33d46d,_0x051d('0xd'));logger[_0x051d('0xe')](_0x051d('0xf'),_0x33d46d,_0x051d('0xd'),JSON[_0x051d('0x10')](_0x40b6c0));if(_0x40b6c0[_0x051d('0x11')]){if(_0x40b6c0[_0x051d('0x11')][_0x051d('0x12')]===0x1f4){logger[_0x051d('0x11')](_0x051d('0xc'),_0x33d46d,_0x40b6c0['error'][_0x051d('0x13')]);return _0x421544(_0x40b6c0[_0x051d('0x11')][_0x051d('0x13')]);}logger[_0x051d('0x11')]('VoiceMailMessage,\x20%s,\x20%s',_0x33d46d,_0x40b6c0['error'][_0x051d('0x13')]);return _0x5e0003(_0x40b6c0[_0x051d('0x11')][_0x051d('0x13')]);}else{logger['info'](_0x051d('0xc'),_0x33d46d,'request\x20sent');_0x5e0003(_0x40b6c0[_0x051d('0x14')][_0x051d('0x13')]);}})[_0x051d('0x15')](function(_0x488fb8){logger['error'](_0x051d('0xc'),_0x33d46d,_0x488fb8);_0x421544(_0x488fb8);});});} \ No newline at end of file +var _0x87ed=['info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then'];(function(_0x2acb36,_0x33e672){var _0x4981b2=function(_0x2bf859){while(--_0x2bf859){_0x2acb36['push'](_0x2acb36['shift']());}};_0x4981b2(++_0x33e672);}(_0x87ed,0x1eb));var _0xd87e=function(_0x357bf5,_0x9a2af1){_0x357bf5=_0x357bf5-0x0;var _0x77c944=_0x87ed[_0x357bf5];return _0x77c944;};'use strict';var _=require(_0xd87e('0x0'));var util=require(_0xd87e('0x1'));var moment=require(_0xd87e('0x2'));var BPromise=require(_0xd87e('0x3'));var rs=require(_0xd87e('0x4'));var fs=require('fs');var Redis=require(_0xd87e('0x5'));var db=require(_0xd87e('0x6'))['db'];var utils=require(_0xd87e('0x7'));var logger=require(_0xd87e('0x8'))(_0xd87e('0x9'));var config=require(_0xd87e('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xd87e('0xb')][_0xd87e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x57ce4a,_0x55b18a,_0xaa911e){return new BPromise(function(_0x469694,_0x56dae0){return client[_0xd87e('0xd')](_0x57ce4a,_0xaa911e)[_0xd87e('0xe')](function(_0x30b11c){logger[_0xd87e('0xf')](_0xd87e('0x10'),_0x55b18a,_0xd87e('0x11'));logger['debug']('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x55b18a,'request\x20sent',JSON['stringify'](_0x30b11c));if(_0x30b11c['error']){if(_0x30b11c[_0xd87e('0x12')]['code']===0x1f4){logger[_0xd87e('0x12')](_0xd87e('0x10'),_0x55b18a,_0x30b11c[_0xd87e('0x12')][_0xd87e('0x13')]);return _0x56dae0(_0x30b11c['error']['message']);}logger['error'](_0xd87e('0x10'),_0x55b18a,_0x30b11c[_0xd87e('0x12')][_0xd87e('0x13')]);return _0x469694(_0x30b11c[_0xd87e('0x12')]['message']);}else{logger[_0xd87e('0xf')](_0xd87e('0x10'),_0x55b18a,_0xd87e('0x11'));_0x469694(_0x30b11c[_0xd87e('0x14')][_0xd87e('0x13')]);}})[_0xd87e('0x15')](function(_0x209312){logger['error'](_0xd87e('0x10'),_0x55b18a,_0x209312);_0x56dae0(_0x209312);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 126622f..335ac9f 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 _0xae52=['update','delete','destroy','/:id/sounds/:id2','removeSound','exports','multer','util','path','express','Router','fs-extra','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','show','/:id/sounds','getSounds','post','addSound','put'];(function(_0xd1c39b,_0x16f0c6){var _0x58f5bc=function(_0x412cf3){while(--_0x412cf3){_0xd1c39b['push'](_0xd1c39b['shift']());}};_0x58f5bc(++_0x16f0c6);}(_0xae52,0x156));var _0x2ae5=function(_0x1e3671,_0x9ae4fc){_0x1e3671=_0x1e3671-0x0;var _0x48d5f5=_0xae52[_0x1e3671];return _0x48d5f5;};'use strict';var multer=require(_0x2ae5('0x0'));var util=require(_0x2ae5('0x1'));var path=require(_0x2ae5('0x2'));var timeout=require('connect-timeout');var express=require(_0x2ae5('0x3'));var router=express[_0x2ae5('0x4')]();var fs_extra=require(_0x2ae5('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2ae5('0x6'));var controller=require(_0x2ae5('0x7'));router[_0x2ae5('0x8')]('/',auth[_0x2ae5('0x9')](),controller[_0x2ae5('0xa')]);router['get'](_0x2ae5('0xb'),auth['isAuthenticated'](),controller[_0x2ae5('0xc')]);router[_0x2ae5('0x8')](_0x2ae5('0xd'),auth['isAuthenticated'](),controller[_0x2ae5('0xe')]);router[_0x2ae5('0xf')]('/',auth[_0x2ae5('0x9')](),controller['create']);router['post']('/:id/sounds',auth['isAuthenticated'](),controller[_0x2ae5('0x10')]);router[_0x2ae5('0x11')](_0x2ae5('0xb'),auth[_0x2ae5('0x9')](),controller[_0x2ae5('0x12')]);router[_0x2ae5('0x13')](_0x2ae5('0xb'),auth[_0x2ae5('0x9')](),controller[_0x2ae5('0x14')]);router[_0x2ae5('0x13')](_0x2ae5('0x15'),auth[_0x2ae5('0x9')](),controller[_0x2ae5('0x16')]);module[_0x2ae5('0x17')]=router; \ No newline at end of file +var _0x05bf=['../../components/interaction/service','isAuthenticated','get','/:id','show','post','/:id/sounds','addSound','put','update','delete','destroy','removeSound','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x16ae8a,_0x39a45c){var _0x5be751=function(_0x495909){while(--_0x495909){_0x16ae8a['push'](_0x16ae8a['shift']());}};_0x5be751(++_0x39a45c);}(_0x05bf,0x176));var _0xf05b=function(_0x47107f,_0xd67b29){_0x47107f=_0x47107f-0x0;var _0x1cafd8=_0x05bf[_0x47107f];return _0x1cafd8;};'use strict';var multer=require(_0xf05b('0x0'));var util=require('util');var path=require(_0xf05b('0x1'));var timeout=require(_0xf05b('0x2'));var express=require('express');var router=express[_0xf05b('0x3')]();var fs_extra=require(_0xf05b('0x4'));var auth=require(_0xf05b('0x5'));var interaction=require(_0xf05b('0x6'));var config=require('../../config/environment');var controller=require('./voiceMusicOnHold.controller');router['get']('/',auth[_0xf05b('0x7')](),controller['index']);router[_0xf05b('0x8')](_0xf05b('0x9'),auth[_0xf05b('0x7')](),controller[_0xf05b('0xa')]);router['get']('/:id/sounds',auth[_0xf05b('0x7')](),controller['getSounds']);router['post']('/',auth[_0xf05b('0x7')](),controller['create']);router[_0xf05b('0xb')](_0xf05b('0xc'),auth[_0xf05b('0x7')](),controller[_0xf05b('0xd')]);router[_0xf05b('0xe')](_0xf05b('0x9'),auth[_0xf05b('0x7')](),controller[_0xf05b('0xf')]);router[_0xf05b('0x10')](_0xf05b('0x9'),auth[_0xf05b('0x7')](),controller[_0xf05b('0x11')]);router[_0xf05b('0x10')]('/:id/sounds/:id2',auth[_0xf05b('0x7')](),controller[_0xf05b('0x12')]);module[_0xf05b('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index d418a13..fc39cce 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 _0xe6f7=['mp3','BOOLEAN','sequelize','STRING','ENUM','custom','files','quietmp3nb','quietmp3'];(function(_0x5c96eb,_0x5404da){var _0x4ddbad=function(_0x5a1225){while(--_0x5a1225){_0x5c96eb['push'](_0x5c96eb['shift']());}};_0x4ddbad(++_0x5404da);}(_0xe6f7,0xb6));var _0x7e6f=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xe6f7[_0x298ed3];return _0x5aad28;};'use strict';var Sequelize=require(_0x7e6f('0x0'));module['exports']={'name':{'type':Sequelize[_0x7e6f('0x1')],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize[_0x7e6f('0x2')](_0x7e6f('0x3'),_0x7e6f('0x4'),'mp3nb',_0x7e6f('0x5'),_0x7e6f('0x6'),_0x7e6f('0x7')),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0x7e6f('0x1')],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize[_0x7e6f('0x1')],'allowNull':!![],'defaultValue':'alpha'},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize[_0x7e6f('0x8')],'defaultValue':0x0}}; \ No newline at end of file +var _0x31d7=['BOOLEAN','sequelize','exports','STRING','name','quietmp3nb','quietmp3','mp3','TIMESTAMP'];(function(_0x468421,_0x4bb344){var _0x49c532=function(_0x2cf3f9){while(--_0x2cf3f9){_0x468421['push'](_0x468421['shift']());}};_0x49c532(++_0x4bb344);}(_0x31d7,0x160));var _0x731d=function(_0x1490c9,_0x3255af){_0x1490c9=_0x1490c9-0x0;var _0x505429=_0x31d7[_0x1490c9];return _0x505429;};'use strict';var Sequelize=require(_0x731d('0x0'));module[_0x731d('0x1')]={'name':{'type':Sequelize[_0x731d('0x2')],'allowNull':![],'unique':_0x731d('0x3')},'mode':{'type':Sequelize['ENUM']('custom','files','mp3nb',_0x731d('0x4'),_0x731d('0x5'),_0x731d('0x6')),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize[_0x731d('0x2')],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize[_0x731d('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0x731d('0x2')],'allowNull':!![],'defaultValue':'alpha'},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':_0x731d('0x7')},'defaultEntry':{'type':Sequelize[_0x731d('0x8')],'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 3dbb9e5..893afbb 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 _0x2650=['lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','update','then','destroy','get','MusicOnHolds','UserProfileResource','name','index','map','VoiceMusicOnHold','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','rawAttributes','length','find','body','params','sequelize','transaction','files','join','root','server/files/moh','create','mode','mkdirSync','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','directory','readdirSync','forEach','unlinkSync','rmdirSync','ValidationError','message','addSound','Sound','findOne','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','save_name','extname','symlinkSync','Sequelize','removeSound','id2','getSounds','order','nolimit','eml-format','rimraf','zip-dir','moment','mustache','path','to-csv','ejs','fs-extra'];(function(_0x2e9f66,_0x1b0d7f){var _0x1e15d4=function(_0x3b8fcd){while(--_0x3b8fcd){_0x2e9f66['push'](_0x2e9f66['shift']());}};_0x1e15d4(++_0x1b0d7f);}(_0x2650,0x147));var _0x0265=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x2650[_0x199572];return _0x13cfa3;};'use strict';var emlformat=require(_0x0265('0x0'));var rimraf=require(_0x0265('0x1'));var zipdir=require(_0x0265('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0265('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0265('0x4'));var util=require('util');var path=require(_0x0265('0x5'));var sox=require('sox');var csv=require(_0x0265('0x6'));var ejs=require(_0x0265('0x7'));var fs=require('fs');var fs_extra=require(_0x0265('0x8'));var _=require(_0x0265('0x9'));var squel=require(_0x0265('0xa'));var crypto=require(_0x0265('0xb'));var jsforce=require(_0x0265('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x0265('0x6'));var querystring=require(_0x0265('0xd'));var Papa=require('papaparse');var Redis=require(_0x0265('0xe'));var authService=require(_0x0265('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0265('0x10'));var logger=require(_0x0265('0x11'))(_0x0265('0x12'));var utils=require(_0x0265('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0265('0x14'))['db'];function respondWithStatusCode(_0xc2f379,_0xf52159){_0xf52159=_0xf52159||0xcc;return function(_0x56d459){if(_0x56d459){return _0xc2f379[_0x0265('0x15')](_0xf52159);}return _0xc2f379[_0x0265('0x16')](_0xf52159)[_0x0265('0x17')]();};}function respondWithResult(_0x2ca31,_0xb3039e){_0xb3039e=_0xb3039e||0xc8;return function(_0x4159dc){if(_0x4159dc){return _0x2ca31[_0x0265('0x16')](_0xb3039e)[_0x0265('0x18')](_0x4159dc);}};}function respondWithFilteredResult(_0x1e1f9d,_0x700b4c){return function(_0x53e6e7){if(_0x53e6e7){var _0xda8309=typeof _0x700b4c[_0x0265('0x19')]===_0x0265('0x1a')&&typeof _0x700b4c[_0x0265('0x1b')]===_0x0265('0x1a');var _0x439aa4=_0x53e6e7['count'];var _0x11b942=_0xda8309?0x0:_0x700b4c[_0x0265('0x19')];var _0xb79592=_0xda8309?_0x53e6e7[_0x0265('0x1c')]:_0x700b4c[_0x0265('0x19')]+_0x700b4c[_0x0265('0x1b')];var _0x1fc74b;if(_0xb79592>=_0x439aa4){_0xb79592=_0x439aa4;_0x1fc74b=0xc8;}else{_0x1fc74b=0xce;}_0x1e1f9d['status'](_0x1fc74b);return _0x1e1f9d[_0x0265('0x1d')]('Content-Range',_0x11b942+'-'+_0xb79592+'/'+_0x439aa4)[_0x0265('0x18')](_0x53e6e7);}return null;};}function patchUpdates(_0x379f31){return function(_0x4719e7){try{jsonpatch['apply'](_0x4719e7,_0x379f31,!![]);}catch(_0x22e504){return BPromise[_0x0265('0x1e')](_0x22e504);}return _0x4719e7[_0x0265('0x1f')]();};}function saveUpdates(_0x5c8563,_0x2c9f95){return function(_0x20d72b){if(_0x20d72b){return _0x20d72b[_0x0265('0x20')](_0x5c8563)[_0x0265('0x21')](function(_0x4559e5){return _0x4559e5;});}return null;};}function removeEntity(_0x285eee,_0x145778){return function(_0x22c5cb){if(_0x22c5cb){return _0x22c5cb[_0x0265('0x22')]()[_0x0265('0x21')](function(){var _0x3e4052=_0x22c5cb[_0x0265('0x23')]({'plain':!![]});var _0x2a16e8=_0x0265('0x24');return db[_0x0265('0x25')][_0x0265('0x22')]({'where':{'type':_0x2a16e8,'resourceId':_0x3e4052['id']}})['then'](function(){return _0x22c5cb;});})['then'](function(){_0x285eee['status'](0xcc)[_0x0265('0x17')]();});}};}function handleEntityNotFound(_0x134717,_0x275319){return function(_0x156dc0){if(!_0x156dc0){_0x134717[_0x0265('0x15')](0x194);}return _0x156dc0;};}function handleError(_0x3c3589,_0x25a5b3){_0x25a5b3=_0x25a5b3||0x1f4;return function(_0x3091be){logger['error'](_0x3091be['stack']);if(_0x3091be[_0x0265('0x26')]){delete _0x3091be[_0x0265('0x26')];}_0x3c3589[_0x0265('0x16')](_0x25a5b3)['send'](_0x3091be);};}exports[_0x0265('0x27')]=function(_0x2f97d4,_0x417b2a){var _0x3f5483={},_0x5afe85={},_0x37845a={'count':0x0,'rows':[]};var _0x58940f=_[_0x0265('0x28')](db[_0x0265('0x29')]['rawAttributes'],function(_0x893b67){return{'name':_0x893b67[_0x0265('0x2a')],'type':_0x893b67[_0x0265('0x2b')]['key']};});_0x5afe85[_0x0265('0x2c')]=_[_0x0265('0x28')](_0x58940f,'name');_0x5afe85[_0x0265('0x2d')]=_[_0x0265('0x2e')](_0x2f97d4[_0x0265('0x2d')]);_0x5afe85[_0x0265('0x2f')]=_[_0x0265('0x30')](_0x5afe85['model'],_0x5afe85[_0x0265('0x2d')]);_0x3f5483[_0x0265('0x31')]=_[_0x0265('0x30')](_0x5afe85[_0x0265('0x2c')],qs['fields'](_0x2f97d4[_0x0265('0x2d')][_0x0265('0x32')]));_0x3f5483[_0x0265('0x31')]=_0x3f5483[_0x0265('0x31')]['length']?_0x3f5483[_0x0265('0x31')]:_0x5afe85['model'];if(!_0x2f97d4[_0x0265('0x2d')][_0x0265('0x33')]('nolimit')){_0x3f5483[_0x0265('0x1b')]=qs[_0x0265('0x1b')](_0x2f97d4[_0x0265('0x2d')][_0x0265('0x1b')]);_0x3f5483[_0x0265('0x19')]=qs[_0x0265('0x19')](_0x2f97d4[_0x0265('0x2d')]['offset']);}_0x3f5483['order']=qs[_0x0265('0x34')](_0x2f97d4['query']['sort']);delete _0x2f97d4['query'][_0x0265('0x34')];_0x3f5483[_0x0265('0x35')]=qs[_0x0265('0x2f')](_[_0x0265('0x36')](_0x2f97d4[_0x0265('0x2d')],_0x5afe85['filters']),_0x58940f);if(_0x2f97d4['query'][_0x0265('0x37')]){_0x3f5483['where']=_['merge'](_0x3f5483[_0x0265('0x35')],{'$or':_[_0x0265('0x28')](_0x58940f,function(_0x30c03f){if(_0x30c03f[_0x0265('0x2b')]!==_0x0265('0x38')){var _0x200b84={};_0x200b84[_0x30c03f['name']]={'$like':'%'+_0x2f97d4[_0x0265('0x2d')][_0x0265('0x37')]+'%'};return _0x200b84;}})});}_0x3f5483=_[_0x0265('0x39')]({},_0x3f5483,_0x2f97d4[_0x0265('0x3a')]);var _0xc5704b={'where':_0x3f5483['where']};return db[_0x0265('0x29')][_0x0265('0x1c')](_0xc5704b)[_0x0265('0x21')](function(_0x580f69){_0x37845a['count']=_0x580f69;if(_0x2f97d4['query'][_0x0265('0x3b')]){_0x3f5483[_0x0265('0x3c')]=[{'all':!![]}];}return db[_0x0265('0x29')][_0x0265('0x3d')](_0x3f5483);})[_0x0265('0x21')](function(_0x5bdfbe){_0x37845a[_0x0265('0x3e')]=_0x5bdfbe;return _0x37845a;})[_0x0265('0x21')](respondWithFilteredResult(_0x417b2a,_0x3f5483))[_0x0265('0x3f')](handleError(_0x417b2a,null));};exports[_0x0265('0x40')]=function(_0x5b0f57,_0x400a52){var _0xaee04={'raw':![],'where':{'id':_0x5b0f57['params']['id']}},_0x5b1f77={};_0x5b1f77[_0x0265('0x2c')]=_[_0x0265('0x2e')](db['VoiceMusicOnHold'][_0x0265('0x41')]);_0x5b1f77[_0x0265('0x2d')]=_[_0x0265('0x2e')](_0x5b0f57['query']);_0x5b1f77[_0x0265('0x2f')]=_[_0x0265('0x30')](_0x5b1f77[_0x0265('0x2c')],_0x5b1f77[_0x0265('0x2d')]);_0xaee04[_0x0265('0x31')]=_[_0x0265('0x30')](_0x5b1f77[_0x0265('0x2c')],qs[_0x0265('0x32')](_0x5b0f57[_0x0265('0x2d')][_0x0265('0x32')]));_0xaee04['attributes']=_0xaee04['attributes'][_0x0265('0x42')]?_0xaee04[_0x0265('0x31')]:_0x5b1f77['model'];if(_0x5b0f57[_0x0265('0x2d')][_0x0265('0x3b')]){_0xaee04[_0x0265('0x3c')]=[{'all':!![]}];}_0xaee04=_[_0x0265('0x39')]({},_0xaee04,_0x5b0f57[_0x0265('0x3a')]);return db[_0x0265('0x29')][_0x0265('0x43')](_0xaee04)[_0x0265('0x21')](handleEntityNotFound(_0x400a52,null))[_0x0265('0x21')](respondWithResult(_0x400a52,null))[_0x0265('0x3f')](handleError(_0x400a52,null));};exports['update']=function(_0x595765,_0x5bdbce){if(_0x595765['body']['id']){delete _0x595765[_0x0265('0x44')]['id'];}return db[_0x0265('0x29')][_0x0265('0x43')]({'where':{'id':_0x595765[_0x0265('0x45')]['id']}})['then'](handleEntityNotFound(_0x5bdbce,null))['then'](saveUpdates(_0x595765['body'],null))[_0x0265('0x21')](respondWithResult(_0x5bdbce,null))['catch'](handleError(_0x5bdbce,null));};exports['create']=function(_0x3dc1fc,_0x25e5d7,_0x30ec28){return db[_0x0265('0x46')][_0x0265('0x47')](function(_0x2c10ce){if(_0x3dc1fc[_0x0265('0x44')]['mode']===_0x0265('0x48')){_0x3dc1fc['body']['directory']=path[_0x0265('0x49')](config[_0x0265('0x4a')],_0x0265('0x4b'),_0x3dc1fc[_0x0265('0x44')][_0x0265('0x26')]);}return db['VoiceMusicOnHold'][_0x0265('0x4c')](_0x3dc1fc['body'],{'transaction':_0x2c10ce})[_0x0265('0x21')](function(_0x1a0597){if(_0x3dc1fc['body'][_0x0265('0x4d')]===_0x0265('0x48')){fs[_0x0265('0x4e')](_0x1a0597['directory'],parseInt(_0x0265('0x4f'),0x8));}var _0x3966d9=_0x3dc1fc[_0x0265('0x50')][_0x0265('0x23')]({'plain':!![]});if(!_0x3966d9)throw new Error(_0x0265('0x51'));if(_0x3966d9[_0x0265('0x52')]===_0x0265('0x50')){var _0x173152=_0x1a0597[_0x0265('0x23')]({'plain':!![]});return db[_0x0265('0x53')]['find']({'where':{'name':_0x0265('0x24'),'userProfileId':_0x3966d9[_0x0265('0x54')]},'raw':!![]})[_0x0265('0x21')](function(_0x218a91){if(_0x218a91&&_0x218a91[_0x0265('0x55')]===0x0){return db[_0x0265('0x25')][_0x0265('0x4c')]({'name':_0x173152[_0x0265('0x26')],'resourceId':_0x173152['id'],'type':_0x218a91[_0x0265('0x26')],'sectionId':_0x218a91['id']},{})[_0x0265('0x21')](function(){return _0x1a0597;});}else{return _0x1a0597;}})[_0x0265('0x3f')](function(_0x471120){logger[_0x0265('0x56')](_0x0265('0x57'),_0x471120);});}return _0x1a0597;});})[_0x0265('0x21')](respondWithResult(_0x25e5d7,0xc9))[_0x0265('0x3f')](handleError(_0x25e5d7,null));};exports[_0x0265('0x22')]=function(_0x7530f7,_0x323f11,_0x480009){var _0x3fb81c;return db['VoiceMusicOnHold'][_0x0265('0x43')]({'where':{'id':_0x7530f7['params']['id']}})['then'](function(_0x12b3a4){if(_0x12b3a4){return db['sequelize'][_0x0265('0x47')](function(_0x4e6c){return _0x12b3a4['destroy']({'transaction':_0x4e6c,'raw':!![]})[_0x0265('0x21')](function(_0x1de45f){if(_0x1de45f[_0x0265('0x58')]){fs[_0x0265('0x59')](_0x1de45f[_0x0265('0x58')])[_0x0265('0x5a')](function(_0x2d0eda){fs[_0x0265('0x5b')](path['join'](_0x1de45f[_0x0265('0x58')],_0x2d0eda));});fs[_0x0265('0x5c')](_0x1de45f[_0x0265('0x58')]);}return _0x1de45f;});})[_0x0265('0x3f')](function(_0x48175c){throw new db['Sequelize'][(_0x0265('0x5d'))](_0x48175c[_0x0265('0x5e')]);});}})['then'](handleEntityNotFound(_0x323f11,null))[_0x0265('0x21')](removeEntity(_0x323f11,null))['catch'](handleError(_0x323f11,null));};exports[_0x0265('0x5f')]=function(_0x1c0418,_0x415964,_0x5c5c29){return db['sequelize']['transaction'](function(_0x595fbb){var _0x14a8c5;return db[_0x0265('0x29')][_0x0265('0x43')]({'where':{'id':_0x1c0418['params']['id']}})['then'](function(_0x49ec9e){if(_0x49ec9e){_0x14a8c5=_0x49ec9e;return _0x49ec9e['addSound'](_0x1c0418['body']['id'],{'transaction':_0x595fbb});}})[_0x0265('0x21')](function(_0x415ada){if(_0x415ada){return db[_0x0265('0x60')][_0x0265('0x61')]({'where':{'id':_0x1c0418['body']['id']},'attributes':['id','name','save_name',_0x0265('0x62'),_0x0265('0x63')],'raw':!![]});}})[_0x0265('0x21')](function(_0x12d998){if(_0x12d998){var _0x2e6325=path[_0x0265('0x49')](config['root'],_0x0265('0x64'),util[_0x0265('0x65')](_0x0265('0x66'),path['basename'](_0x12d998[_0x0265('0x67')],path[_0x0265('0x68')](_0x12d998['save_name'])),_0x12d998[_0x0265('0x62')]));var _0x506a37=path['join'](config[_0x0265('0x4a')],_0x0265('0x4b'),_0x14a8c5[_0x0265('0x26')],util[_0x0265('0x65')](_0x0265('0x66'),_0x12d998['name'],_0x12d998[_0x0265('0x62')]));fs[_0x0265('0x69')](_0x2e6325,_0x506a37);return _0x12d998;}})[_0x0265('0x3f')](function(_0x277463){throw new db[(_0x0265('0x6a'))]['ValidationError'](_0x277463[_0x0265('0x5e')]);});})[_0x0265('0x21')](handleEntityNotFound(_0x415964,null))['then'](respondWithResult(_0x415964,0xc9))[_0x0265('0x3f')](handleError(_0x415964,null));};exports['removeSound']=function(_0x25a049,_0x581d09,_0x4767b7){return db[_0x0265('0x46')][_0x0265('0x47')](function(_0x2fce78){var _0x4222e9;return db[_0x0265('0x29')][_0x0265('0x61')]({'where':{'id':_0x25a049['params']['id']}})[_0x0265('0x21')](handleEntityNotFound(_0x581d09,null))[_0x0265('0x21')](function(_0x1eba67){if(_0x1eba67){_0x4222e9=_0x1eba67;return _0x1eba67[_0x0265('0x6b')](_0x25a049[_0x0265('0x45')]['id2']);}})[_0x0265('0x21')](function(_0x2ba476){if(_0x2ba476){return db[_0x0265('0x60')]['findOne']({'where':{'id':_0x25a049['params'][_0x0265('0x6c')]},'attributes':['id',_0x0265('0x26'),'save_name','converted_format',_0x0265('0x63')],'raw':!![]});}})[_0x0265('0x21')](function(_0x20c554){if(_0x20c554){fs[_0x0265('0x5b')](path[_0x0265('0x49')](_0x4222e9[_0x0265('0x58')],util[_0x0265('0x65')](_0x0265('0x66'),_0x20c554[_0x0265('0x26')],_0x20c554[_0x0265('0x62')])));return _0x20c554;}})[_0x0265('0x3f')](function(_0x5b3847){throw new db[(_0x0265('0x6a'))][(_0x0265('0x5d'))](_0x5b3847[_0x0265('0x5e')]);});})[_0x0265('0x21')](handleEntityNotFound(_0x581d09,null))[_0x0265('0x21')](respondWithStatusCode(_0x581d09,0xcc))[_0x0265('0x3f')](handleError(_0x581d09,null));};exports[_0x0265('0x6d')]=function(_0xc12334,_0x54a28c,_0x1ab47a){var _0x24418d={};var _0x4df925={};var _0x1e85ec;var _0x54f06e;return db[_0x0265('0x29')][_0x0265('0x61')]({'where':{'id':_0xc12334[_0x0265('0x45')]['id']}})[_0x0265('0x21')](handleEntityNotFound(_0x54a28c,null))[_0x0265('0x21')](function(_0x597a8c){if(_0x597a8c){_0x1e85ec=_0x597a8c;_0x4df925['model']=_[_0x0265('0x2e')](db['Sound']['rawAttributes']);_0x4df925[_0x0265('0x2d')]=_[_0x0265('0x2e')](_0xc12334['query']);_0x4df925[_0x0265('0x2f')]=_[_0x0265('0x30')](_0x4df925[_0x0265('0x2c')],_0x4df925['query']);_0x24418d[_0x0265('0x31')]=_['intersection'](_0x4df925[_0x0265('0x2c')],qs[_0x0265('0x32')](_0xc12334['query'][_0x0265('0x32')]));_0x24418d[_0x0265('0x31')]=_0x24418d[_0x0265('0x31')][_0x0265('0x42')]?_0x24418d[_0x0265('0x31')]:_0x4df925['model'];_0x24418d[_0x0265('0x6e')]=qs[_0x0265('0x34')](_0xc12334[_0x0265('0x2d')][_0x0265('0x34')]);_0x24418d[_0x0265('0x35')]=qs[_0x0265('0x2f')](_[_0x0265('0x36')](_0xc12334[_0x0265('0x2d')],_0x4df925[_0x0265('0x2f')]));if(_0xc12334[_0x0265('0x2d')][_0x0265('0x37')]){_0x24418d[_0x0265('0x35')]=_['merge'](_0x24418d[_0x0265('0x35')],{'$or':_[_0x0265('0x28')](_0x24418d['attributes'],function(_0x125ce6){var _0x58b03e={};_0x58b03e[_0x125ce6]={'$like':'%'+_0xc12334[_0x0265('0x2d')]['filter']+'%'};return _0x58b03e;})});}_0x24418d=_[_0x0265('0x39')]({},_0x24418d,_0xc12334[_0x0265('0x3a')]);return _0x1e85ec['getSounds'](_0x24418d);}})['then'](function(_0x540559){if(_0x540559){_0x54f06e=_0x540559[_0x0265('0x42')];if(!_0xc12334[_0x0265('0x2d')][_0x0265('0x33')](_0x0265('0x6f'))){_0x24418d[_0x0265('0x1b')]=qs['limit'](_0xc12334[_0x0265('0x2d')][_0x0265('0x1b')]);_0x24418d[_0x0265('0x19')]=qs['offset'](_0xc12334[_0x0265('0x2d')]['offset']);}return _0x1e85ec['getSounds'](_0x24418d);}})[_0x0265('0x21')](function(_0x11cb92){if(_0x11cb92){return _0x11cb92?{'count':_0x54f06e,'rows':_0x11cb92}:null;}})[_0x0265('0x21')](respondWithResult(_0x54a28c,null))['catch'](handleError(_0x54a28c,null));}; \ No newline at end of file +var _0x86f9=['options','includeAll','include','findAll','rows','catch','show','params','find','body','create','sequelize','directory','join','root','server/files/moh','mode','files','mkdirSync','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','unlinkSync','Sequelize','ValidationError','message','addSound','transaction','save_name','converted_format','createdAt','format','basename','extname','%s.%s','symlinkSync','removeSound','findOne','id2','Sound','getSounds','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','end','status','json','undefined','limit','offset','count','set','apply','reject','save','update','destroy','get','MusicOnHolds','UserProfileResource','then','stack','name','send','index','VoiceMusicOnHold','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL'];(function(_0x14715a,_0x3e1fb1){var _0x14055d=function(_0x4a968f){while(--_0x4a968f){_0x14715a['push'](_0x14715a['shift']());}};_0x14055d(++_0x3e1fb1);}(_0x86f9,0x10e));var _0x986f=function(_0x5d1044,_0x18f656){_0x5d1044=_0x5d1044-0x0;var _0x3cd90e=_0x86f9[_0x5d1044];return _0x3cd90e;};'use strict';var emlformat=require(_0x986f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x986f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x986f('0x2'));var moment=require(_0x986f('0x3'));var BPromise=require(_0x986f('0x4'));var Mustache=require(_0x986f('0x5'));var util=require(_0x986f('0x6'));var path=require(_0x986f('0x7'));var sox=require(_0x986f('0x8'));var csv=require(_0x986f('0x9'));var ejs=require(_0x986f('0xa'));var fs=require('fs');var fs_extra=require(_0x986f('0xb'));var _=require('lodash');var squel=require(_0x986f('0xc'));var crypto=require(_0x986f('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x986f('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x986f('0xe'));var qs=require(_0x986f('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x986f('0x10'));var logger=require(_0x986f('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x986f('0x12'));var licenseUtil=require(_0x986f('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3b5d5e,_0x1aa57f){_0x1aa57f=_0x1aa57f||0xcc;return function(_0x209cee){if(_0x209cee){return _0x3b5d5e[_0x986f('0x14')](_0x1aa57f);}return _0x3b5d5e['status'](_0x1aa57f)[_0x986f('0x15')]();};}function respondWithResult(_0x514ec2,_0x37abb0){_0x37abb0=_0x37abb0||0xc8;return function(_0x20c044){if(_0x20c044){return _0x514ec2[_0x986f('0x16')](_0x37abb0)[_0x986f('0x17')](_0x20c044);}};}function respondWithFilteredResult(_0x360516,_0x2052e0){return function(_0x4d9f9f){if(_0x4d9f9f){var _0x3e6513=typeof _0x2052e0['offset']===_0x986f('0x18')&&typeof _0x2052e0[_0x986f('0x19')]===_0x986f('0x18');var _0x3e082e=_0x4d9f9f['count'];var _0x207508=_0x3e6513?0x0:_0x2052e0[_0x986f('0x1a')];var _0x5beee0=_0x3e6513?_0x4d9f9f[_0x986f('0x1b')]:_0x2052e0['offset']+_0x2052e0[_0x986f('0x19')];var _0x56ad37;if(_0x5beee0>=_0x3e082e){_0x5beee0=_0x3e082e;_0x56ad37=0xc8;}else{_0x56ad37=0xce;}_0x360516[_0x986f('0x16')](_0x56ad37);return _0x360516[_0x986f('0x1c')]('Content-Range',_0x207508+'-'+_0x5beee0+'/'+_0x3e082e)['json'](_0x4d9f9f);}return null;};}function patchUpdates(_0x133fd8){return function(_0x5b58ad){try{jsonpatch[_0x986f('0x1d')](_0x5b58ad,_0x133fd8,!![]);}catch(_0x3e9579){return BPromise[_0x986f('0x1e')](_0x3e9579);}return _0x5b58ad[_0x986f('0x1f')]();};}function saveUpdates(_0x31b740,_0xa8c4ea){return function(_0x4eaabe){if(_0x4eaabe){return _0x4eaabe[_0x986f('0x20')](_0x31b740)['then'](function(_0x35b2d7){return _0x35b2d7;});}return null;};}function removeEntity(_0xf91331,_0xae3111){return function(_0x1ed72d){if(_0x1ed72d){return _0x1ed72d[_0x986f('0x21')]()['then'](function(){var _0x35ba80=_0x1ed72d[_0x986f('0x22')]({'plain':!![]});var _0x14fe1c=_0x986f('0x23');return db[_0x986f('0x24')][_0x986f('0x21')]({'where':{'type':_0x14fe1c,'resourceId':_0x35ba80['id']}})[_0x986f('0x25')](function(){return _0x1ed72d;});})[_0x986f('0x25')](function(){_0xf91331[_0x986f('0x16')](0xcc)[_0x986f('0x15')]();});}};}function handleEntityNotFound(_0x1b62bd,_0x4d142f){return function(_0x303239){if(!_0x303239){_0x1b62bd[_0x986f('0x14')](0x194);}return _0x303239;};}function handleError(_0x5410af,_0x365a10){_0x365a10=_0x365a10||0x1f4;return function(_0x32d5d1){logger['error'](_0x32d5d1[_0x986f('0x26')]);if(_0x32d5d1[_0x986f('0x27')]){delete _0x32d5d1[_0x986f('0x27')];}_0x5410af[_0x986f('0x16')](_0x365a10)[_0x986f('0x28')](_0x32d5d1);};}exports[_0x986f('0x29')]=function(_0x2f05cf,_0x58799d){var _0x12061e={},_0x50883c={},_0x3a6325={'count':0x0,'rows':[]};var _0x4e9540=_['map'](db[_0x986f('0x2a')][_0x986f('0x2b')],function(_0x49d645){return{'name':_0x49d645['fieldName'],'type':_0x49d645[_0x986f('0x2c')][_0x986f('0x2d')]};});_0x50883c[_0x986f('0x2e')]=_[_0x986f('0x2f')](_0x4e9540,_0x986f('0x27'));_0x50883c[_0x986f('0x30')]=_[_0x986f('0x31')](_0x2f05cf[_0x986f('0x30')]);_0x50883c[_0x986f('0x32')]=_[_0x986f('0x33')](_0x50883c[_0x986f('0x2e')],_0x50883c[_0x986f('0x30')]);_0x12061e[_0x986f('0x34')]=_[_0x986f('0x33')](_0x50883c[_0x986f('0x2e')],qs['fields'](_0x2f05cf['query'][_0x986f('0x35')]));_0x12061e[_0x986f('0x34')]=_0x12061e['attributes'][_0x986f('0x36')]?_0x12061e[_0x986f('0x34')]:_0x50883c[_0x986f('0x2e')];if(!_0x2f05cf[_0x986f('0x30')][_0x986f('0x37')](_0x986f('0x38'))){_0x12061e[_0x986f('0x19')]=qs['limit'](_0x2f05cf[_0x986f('0x30')]['limit']);_0x12061e[_0x986f('0x1a')]=qs[_0x986f('0x1a')](_0x2f05cf[_0x986f('0x30')][_0x986f('0x1a')]);}_0x12061e['order']=qs[_0x986f('0x39')](_0x2f05cf[_0x986f('0x30')][_0x986f('0x39')]);delete _0x2f05cf[_0x986f('0x30')][_0x986f('0x39')];_0x12061e['where']=qs[_0x986f('0x32')](_[_0x986f('0x3a')](_0x2f05cf['query'],_0x50883c[_0x986f('0x32')]),_0x4e9540);if(_0x2f05cf[_0x986f('0x30')][_0x986f('0x3b')]){_0x12061e[_0x986f('0x3c')]=_[_0x986f('0x3d')](_0x12061e[_0x986f('0x3c')],{'$or':_[_0x986f('0x2f')](_0x4e9540,function(_0x2589fb){if(_0x2589fb['type']!==_0x986f('0x3e')){var _0x7c2060={};_0x7c2060[_0x2589fb[_0x986f('0x27')]]={'$like':'%'+_0x2f05cf[_0x986f('0x30')][_0x986f('0x3b')]+'%'};return _0x7c2060;}})});}_0x12061e=_[_0x986f('0x3d')]({},_0x12061e,_0x2f05cf[_0x986f('0x3f')]);var _0x5db9d0={'where':_0x12061e[_0x986f('0x3c')]};return db[_0x986f('0x2a')][_0x986f('0x1b')](_0x5db9d0)[_0x986f('0x25')](function(_0x53ed55){_0x3a6325[_0x986f('0x1b')]=_0x53ed55;if(_0x2f05cf[_0x986f('0x30')][_0x986f('0x40')]){_0x12061e[_0x986f('0x41')]=[{'all':!![]}];}return db[_0x986f('0x2a')][_0x986f('0x42')](_0x12061e);})[_0x986f('0x25')](function(_0x5076db){_0x3a6325[_0x986f('0x43')]=_0x5076db;return _0x3a6325;})[_0x986f('0x25')](respondWithFilteredResult(_0x58799d,_0x12061e))[_0x986f('0x44')](handleError(_0x58799d,null));};exports[_0x986f('0x45')]=function(_0x37f056,_0x4031e5){var _0x39883b={'raw':![],'where':{'id':_0x37f056[_0x986f('0x46')]['id']}},_0x2df899={};_0x2df899[_0x986f('0x2e')]=_[_0x986f('0x31')](db[_0x986f('0x2a')][_0x986f('0x2b')]);_0x2df899['query']=_[_0x986f('0x31')](_0x37f056[_0x986f('0x30')]);_0x2df899[_0x986f('0x32')]=_[_0x986f('0x33')](_0x2df899[_0x986f('0x2e')],_0x2df899[_0x986f('0x30')]);_0x39883b[_0x986f('0x34')]=_[_0x986f('0x33')](_0x2df899[_0x986f('0x2e')],qs['fields'](_0x37f056[_0x986f('0x30')][_0x986f('0x35')]));_0x39883b[_0x986f('0x34')]=_0x39883b[_0x986f('0x34')][_0x986f('0x36')]?_0x39883b[_0x986f('0x34')]:_0x2df899[_0x986f('0x2e')];if(_0x37f056[_0x986f('0x30')][_0x986f('0x40')]){_0x39883b['include']=[{'all':!![]}];}_0x39883b=_['merge']({},_0x39883b,_0x37f056['options']);return db[_0x986f('0x2a')][_0x986f('0x47')](_0x39883b)[_0x986f('0x25')](handleEntityNotFound(_0x4031e5,null))[_0x986f('0x25')](respondWithResult(_0x4031e5,null))[_0x986f('0x44')](handleError(_0x4031e5,null));};exports[_0x986f('0x20')]=function(_0x1eb0c5,_0x35b0e9){if(_0x1eb0c5['body']['id']){delete _0x1eb0c5[_0x986f('0x48')]['id'];}return db[_0x986f('0x2a')]['find']({'where':{'id':_0x1eb0c5[_0x986f('0x46')]['id']}})[_0x986f('0x25')](handleEntityNotFound(_0x35b0e9,null))['then'](saveUpdates(_0x1eb0c5[_0x986f('0x48')],null))[_0x986f('0x25')](respondWithResult(_0x35b0e9,null))[_0x986f('0x44')](handleError(_0x35b0e9,null));};exports[_0x986f('0x49')]=function(_0x4c1521,_0x4060c1,_0x16d48b){return db[_0x986f('0x4a')]['transaction'](function(_0x1a7b31){if(_0x4c1521[_0x986f('0x48')]['mode']==='files'){_0x4c1521[_0x986f('0x48')][_0x986f('0x4b')]=path[_0x986f('0x4c')](config[_0x986f('0x4d')],_0x986f('0x4e'),_0x4c1521[_0x986f('0x48')][_0x986f('0x27')]);}return db[_0x986f('0x2a')]['create'](_0x4c1521['body'],{'transaction':_0x1a7b31})[_0x986f('0x25')](function(_0x571519){if(_0x4c1521[_0x986f('0x48')][_0x986f('0x4f')]===_0x986f('0x50')){fs[_0x986f('0x51')](_0x571519[_0x986f('0x4b')],parseInt(_0x986f('0x52'),0x8));}var _0x1c017f=_0x4c1521[_0x986f('0x53')]['get']({'plain':!![]});if(!_0x1c017f)throw new Error(_0x986f('0x54'));if(_0x1c017f['role']===_0x986f('0x53')){var _0x819805=_0x571519['get']({'plain':!![]});return db[_0x986f('0x55')][_0x986f('0x47')]({'where':{'name':_0x986f('0x23'),'userProfileId':_0x1c017f[_0x986f('0x56')]},'raw':!![]})[_0x986f('0x25')](function(_0x165b18){if(_0x165b18&&_0x165b18[_0x986f('0x57')]===0x0){return db[_0x986f('0x24')][_0x986f('0x49')]({'name':_0x819805[_0x986f('0x27')],'resourceId':_0x819805['id'],'type':_0x165b18[_0x986f('0x27')],'sectionId':_0x165b18['id']},{})[_0x986f('0x25')](function(){return _0x571519;});}else{return _0x571519;}})[_0x986f('0x44')](function(_0x266fa2){logger[_0x986f('0x58')](_0x986f('0x59'),_0x266fa2);});}return _0x571519;});})[_0x986f('0x25')](respondWithResult(_0x4060c1,0xc9))['catch'](handleError(_0x4060c1,null));};exports[_0x986f('0x21')]=function(_0x5c95c1,_0xa46e3,_0x3e68ba){var _0x23ec45;return db[_0x986f('0x2a')]['find']({'where':{'id':_0x5c95c1[_0x986f('0x46')]['id']}})[_0x986f('0x25')](function(_0xd44368){if(_0xd44368){return db['sequelize']['transaction'](function(_0x555c6a){return _0xd44368[_0x986f('0x21')]({'transaction':_0x555c6a,'raw':!![]})[_0x986f('0x25')](function(_0x10e74e){if(_0x10e74e[_0x986f('0x4b')]){fs[_0x986f('0x5a')](_0x10e74e['directory'])[_0x986f('0x5b')](function(_0x3ecf85){fs[_0x986f('0x5c')](path['join'](_0x10e74e[_0x986f('0x4b')],_0x3ecf85));});fs['rmdirSync'](_0x10e74e[_0x986f('0x4b')]);}return _0x10e74e;});})[_0x986f('0x44')](function(_0x3276e3){throw new db[(_0x986f('0x5d'))][(_0x986f('0x5e'))](_0x3276e3[_0x986f('0x5f')]);});}})['then'](handleEntityNotFound(_0xa46e3,null))[_0x986f('0x25')](removeEntity(_0xa46e3,null))[_0x986f('0x44')](handleError(_0xa46e3,null));};exports[_0x986f('0x60')]=function(_0x280fac,_0x5080a4,_0x14ef43){return db['sequelize'][_0x986f('0x61')](function(_0x1ba36a){var _0xb76efb;return db['VoiceMusicOnHold'][_0x986f('0x47')]({'where':{'id':_0x280fac[_0x986f('0x46')]['id']}})[_0x986f('0x25')](function(_0x3894f5){if(_0x3894f5){_0xb76efb=_0x3894f5;return _0x3894f5[_0x986f('0x60')](_0x280fac[_0x986f('0x48')]['id'],{'transaction':_0x1ba36a});}})['then'](function(_0x1fd5b7){if(_0x1fd5b7){return db['Sound']['findOne']({'where':{'id':_0x280fac[_0x986f('0x48')]['id']},'attributes':['id',_0x986f('0x27'),_0x986f('0x62'),_0x986f('0x63'),_0x986f('0x64')],'raw':!![]});}})['then'](function(_0x20a248){if(_0x20a248){var _0x5c8e27=path['join'](config[_0x986f('0x4d')],'server/files/sounds/converted',util[_0x986f('0x65')]('%s.%s',path[_0x986f('0x66')](_0x20a248['save_name'],path[_0x986f('0x67')](_0x20a248[_0x986f('0x62')])),_0x20a248['converted_format']));var _0x4db7d3=path['join'](config[_0x986f('0x4d')],_0x986f('0x4e'),_0xb76efb['name'],util['format'](_0x986f('0x68'),_0x20a248[_0x986f('0x27')],_0x20a248[_0x986f('0x63')]));fs[_0x986f('0x69')](_0x5c8e27,_0x4db7d3);return _0x20a248;}})[_0x986f('0x44')](function(_0x5adefc){throw new db[(_0x986f('0x5d'))][(_0x986f('0x5e'))](_0x5adefc[_0x986f('0x5f')]);});})[_0x986f('0x25')](handleEntityNotFound(_0x5080a4,null))['then'](respondWithResult(_0x5080a4,0xc9))[_0x986f('0x44')](handleError(_0x5080a4,null));};exports[_0x986f('0x6a')]=function(_0x4364bd,_0x188838,_0x55f477){return db[_0x986f('0x4a')][_0x986f('0x61')](function(_0x36816c){var _0x4b79f5;return db['VoiceMusicOnHold'][_0x986f('0x6b')]({'where':{'id':_0x4364bd[_0x986f('0x46')]['id']}})['then'](handleEntityNotFound(_0x188838,null))[_0x986f('0x25')](function(_0x4c51bf){if(_0x4c51bf){_0x4b79f5=_0x4c51bf;return _0x4c51bf['removeSound'](_0x4364bd[_0x986f('0x46')][_0x986f('0x6c')]);}})[_0x986f('0x25')](function(_0x2ae87e){if(_0x2ae87e){return db[_0x986f('0x6d')][_0x986f('0x6b')]({'where':{'id':_0x4364bd[_0x986f('0x46')][_0x986f('0x6c')]},'attributes':['id',_0x986f('0x27'),_0x986f('0x62'),_0x986f('0x63'),'createdAt'],'raw':!![]});}})[_0x986f('0x25')](function(_0x6557af){if(_0x6557af){fs['unlinkSync'](path[_0x986f('0x4c')](_0x4b79f5[_0x986f('0x4b')],util['format'](_0x986f('0x68'),_0x6557af[_0x986f('0x27')],_0x6557af[_0x986f('0x63')])));return _0x6557af;}})[_0x986f('0x44')](function(_0x519d54){throw new db['Sequelize'][(_0x986f('0x5e'))](_0x519d54[_0x986f('0x5f')]);});})[_0x986f('0x25')](handleEntityNotFound(_0x188838,null))[_0x986f('0x25')](respondWithStatusCode(_0x188838,0xcc))['catch'](handleError(_0x188838,null));};exports[_0x986f('0x6e')]=function(_0x30f847,_0x409e67,_0x1da512){var _0x2ce109={};var _0x31140c={};var _0x491cc2;var _0x464e1c;return db[_0x986f('0x2a')]['findOne']({'where':{'id':_0x30f847[_0x986f('0x46')]['id']}})['then'](handleEntityNotFound(_0x409e67,null))['then'](function(_0x32726a){if(_0x32726a){_0x491cc2=_0x32726a;_0x31140c[_0x986f('0x2e')]=_[_0x986f('0x31')](db['Sound'][_0x986f('0x2b')]);_0x31140c[_0x986f('0x30')]=_[_0x986f('0x31')](_0x30f847[_0x986f('0x30')]);_0x31140c[_0x986f('0x32')]=_['intersection'](_0x31140c['model'],_0x31140c['query']);_0x2ce109[_0x986f('0x34')]=_['intersection'](_0x31140c['model'],qs[_0x986f('0x35')](_0x30f847['query'][_0x986f('0x35')]));_0x2ce109[_0x986f('0x34')]=_0x2ce109[_0x986f('0x34')][_0x986f('0x36')]?_0x2ce109[_0x986f('0x34')]:_0x31140c[_0x986f('0x2e')];_0x2ce109['order']=qs[_0x986f('0x39')](_0x30f847['query'][_0x986f('0x39')]);_0x2ce109[_0x986f('0x3c')]=qs[_0x986f('0x32')](_[_0x986f('0x3a')](_0x30f847[_0x986f('0x30')],_0x31140c['filters']));if(_0x30f847[_0x986f('0x30')][_0x986f('0x3b')]){_0x2ce109[_0x986f('0x3c')]=_[_0x986f('0x3d')](_0x2ce109[_0x986f('0x3c')],{'$or':_[_0x986f('0x2f')](_0x2ce109[_0x986f('0x34')],function(_0x4805d5){var _0x32fbe1={};_0x32fbe1[_0x4805d5]={'$like':'%'+_0x30f847[_0x986f('0x30')]['filter']+'%'};return _0x32fbe1;})});}_0x2ce109=_[_0x986f('0x3d')]({},_0x2ce109,_0x30f847[_0x986f('0x3f')]);return _0x491cc2['getSounds'](_0x2ce109);}})['then'](function(_0x21cc1a){if(_0x21cc1a){_0x464e1c=_0x21cc1a['length'];if(!_0x30f847[_0x986f('0x30')][_0x986f('0x37')]('nolimit')){_0x2ce109[_0x986f('0x19')]=qs[_0x986f('0x19')](_0x30f847[_0x986f('0x30')][_0x986f('0x19')]);_0x2ce109[_0x986f('0x1a')]=qs[_0x986f('0x1a')](_0x30f847[_0x986f('0x30')][_0x986f('0x1a')]);}return _0x491cc2['getSounds'](_0x2ce109);}})[_0x986f('0x25')](function(_0x496019){if(_0x496019){return _0x496019?{'count':_0x464e1c,'rows':_0x496019}:null;}})[_0x986f('0x25')](respondWithResult(_0x409e67,null))['catch'](handleError(_0x409e67,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 2ca4ff9..680d5c9 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 _0x5e94=['request-promise','path','rimraf','./voiceMusicOnHold.attributes','define','lodash','util'];(function(_0x102c53,_0x1e36b2){var _0x37ee54=function(_0x469469){while(--_0x469469){_0x102c53['push'](_0x102c53['shift']());}};_0x37ee54(++_0x1e36b2);}(_0x5e94,0xe5));var _0x45e9=function(_0x5259d6,_0x1cd582){_0x5259d6=_0x5259d6-0x0;var _0x1704ff=_0x5e94[_0x5259d6];return _0x1704ff;};'use strict';var _=require(_0x45e9('0x0'));var util=require(_0x45e9('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x45e9('0x2'));var fs=require('fs');var path=require(_0x45e9('0x3'));var rimraf=require(_0x45e9('0x4'));var config=require('../../config/environment');var attributes=require(_0x45e9('0x5'));module['exports']=function(_0x4dfafe,_0x4ee2d8){return _0x4dfafe[_0x45e9('0x6')]('VoiceMusicOnHold',attributes,{'tableName':'voice_musiconhold','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2eea=['voice_musiconhold','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceMusicOnHold.attributes','exports','define'];(function(_0x54e4fd,_0x4059d4){var _0x50cbb2=function(_0x47549d){while(--_0x47549d){_0x54e4fd['push'](_0x54e4fd['shift']());}};_0x50cbb2(++_0x4059d4);}(_0x2eea,0xa9));var _0xa2ee=function(_0x256025,_0xdc73f6){_0x256025=_0x256025-0x0;var _0x2967af=_0x2eea[_0x256025];return _0x2967af;};'use strict';var _=require(_0xa2ee('0x0'));var util=require('util');var logger=require(_0xa2ee('0x1'))(_0xa2ee('0x2'));var moment=require(_0xa2ee('0x3'));var BPromise=require(_0xa2ee('0x4'));var rp=require(_0xa2ee('0x5'));var fs=require('fs');var path=require(_0xa2ee('0x6'));var rimraf=require(_0xa2ee('0x7'));var config=require('../../config/environment');var attributes=require(_0xa2ee('0x8'));module[_0xa2ee('0x9')]=function(_0x305717,_0x3eabc3){return _0x305717[_0xa2ee('0xa')]('VoiceMusicOnHold',attributes,{'tableName':_0xa2ee('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js index 12fc0bf..68de360 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 _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s'];(function(_0x48ef82,_0x34cedc){var _0x33ad23=function(_0x45dea3){while(--_0x45dea3){_0x48ef82['push'](_0x48ef82['shift']());}};_0x33ad23(++_0x34cedc);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2c3255,_0x4e00ae){_0x2c3255=_0x2c3255-0x0;var _0x282aba=_0xcb91[_0x2c3255];return _0x282aba;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});} \ No newline at end of file +var _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s'];(function(_0x26f606,_0x4d649b){var _0x524ea3=function(_0x631f7b){while(--_0x631f7b){_0x26f606['push'](_0x26f606['shift']());}};_0x524ea3(++_0x4d649b);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x273dc5,_0x268a81){_0x273dc5=_0x273dc5-0x0;var _0x46dae7=_0xcb91[_0x273dc5];return _0x46dae7;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index acac71a..e4e2b1a 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 _0xd7ed=['delete','/:id/users','removeTeams','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getAgents','getTeams','post','create','addAgents','/:id/teams','addTeams','put'];(function(_0x2c1dcd,_0x350452){var _0x158ce5=function(_0x5c1c57){while(--_0x5c1c57){_0x2c1dcd['push'](_0x2c1dcd['shift']());}};_0x158ce5(++_0x350452);}(_0xd7ed,0x1a8));var _0xdd7e=function(_0x340380,_0x4bd2a8){_0x340380=_0x340380-0x0;var _0x49ce1c=_0xd7ed[_0x340380];return _0x49ce1c;};'use strict';var multer=require('multer');var util=require(_0xdd7e('0x0'));var path=require(_0xdd7e('0x1'));var timeout=require(_0xdd7e('0x2'));var express=require(_0xdd7e('0x3'));var router=express[_0xdd7e('0x4')]();var fs_extra=require(_0xdd7e('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xdd7e('0x6'));var config=require(_0xdd7e('0x7'));var controller=require(_0xdd7e('0x8'));router[_0xdd7e('0x9')]('/',auth[_0xdd7e('0xa')](),controller[_0xdd7e('0xb')]);router['get'](_0xdd7e('0xc'),auth['isAuthenticated'](),controller[_0xdd7e('0xd')]);router[_0xdd7e('0x9')](_0xdd7e('0xe'),auth[_0xdd7e('0xa')](),controller[_0xdd7e('0xf')]);router['get']('/:id/users',auth[_0xdd7e('0xa')](),controller[_0xdd7e('0x10')]);router[_0xdd7e('0x9')]('/:id/teams',auth[_0xdd7e('0xa')](),controller[_0xdd7e('0x11')]);router[_0xdd7e('0x12')]('/',auth[_0xdd7e('0xa')](),controller[_0xdd7e('0x13')]);router[_0xdd7e('0x12')]('/:id/users',auth[_0xdd7e('0xa')](),controller[_0xdd7e('0x14')]);router[_0xdd7e('0x12')](_0xdd7e('0x15'),auth[_0xdd7e('0xa')](),controller[_0xdd7e('0x16')]);router[_0xdd7e('0x17')](_0xdd7e('0xe'),auth[_0xdd7e('0xa')](),controller['update']);router[_0xdd7e('0x18')]('/:id',auth[_0xdd7e('0xa')](),controller['destroy']);router[_0xdd7e('0x18')](_0xdd7e('0x19'),auth['isAuthenticated'](),controller['removeAgents']);router['delete'](_0xdd7e('0x15'),auth['isAuthenticated'](),controller[_0xdd7e('0x1a')]);module[_0xdd7e('0x1b')]=router; \ No newline at end of file +var _0x58ef=['/:id','show','/:id/teams','getTeams','post','create','/:id/users','addAgents','put','update','delete','destroy','removeAgents','removeTeams','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x58ef,0x1ce));var _0xf58e=function(_0x1d11a3,_0x3982f2){_0x1d11a3=_0x1d11a3-0x0;var _0x17ab57=_0x58ef[_0x1d11a3];return _0x17ab57;};'use strict';var multer=require(_0xf58e('0x0'));var util=require('util');var path=require(_0xf58e('0x1'));var timeout=require(_0xf58e('0x2'));var express=require(_0xf58e('0x3'));var router=express[_0xf58e('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf58e('0x5'));var interaction=require(_0xf58e('0x6'));var config=require(_0xf58e('0x7'));var controller=require(_0xf58e('0x8'));router[_0xf58e('0x9')]('/',auth[_0xf58e('0xa')](),controller[_0xf58e('0xb')]);router[_0xf58e('0x9')](_0xf58e('0xc'),auth['isAuthenticated'](),controller[_0xf58e('0xd')]);router['get'](_0xf58e('0xe'),auth[_0xf58e('0xa')](),controller[_0xf58e('0xf')]);router[_0xf58e('0x9')]('/:id/users',auth[_0xf58e('0xa')](),controller['getAgents']);router[_0xf58e('0x9')](_0xf58e('0x10'),auth['isAuthenticated'](),controller[_0xf58e('0x11')]);router[_0xf58e('0x12')]('/',auth[_0xf58e('0xa')](),controller[_0xf58e('0x13')]);router[_0xf58e('0x12')](_0xf58e('0x14'),auth[_0xf58e('0xa')](),controller[_0xf58e('0x15')]);router['post'](_0xf58e('0x10'),auth[_0xf58e('0xa')](),controller['addTeams']);router[_0xf58e('0x16')](_0xf58e('0xe'),auth[_0xf58e('0xa')](),controller[_0xf58e('0x17')]);router[_0xf58e('0x18')](_0xf58e('0xe'),auth[_0xf58e('0xa')](),controller[_0xf58e('0x19')]);router[_0xf58e('0x18')](_0xf58e('0x14'),auth['isAuthenticated'](),controller[_0xf58e('0x1a')]);router[_0xf58e('0x18')](_0xf58e('0x10'),auth[_0xf58e('0xa')](),controller[_0xf58e('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 6a7eadb..6efb36d 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 _0x8cd4=['INTEGER','sequelize','exports','STRING','name','getDataValue'];(function(_0x2eb4e3,_0x20a35f){var _0x4af8f6=function(_0x465c44){while(--_0x465c44){_0x2eb4e3['push'](_0x2eb4e3['shift']());}};_0x4af8f6(++_0x20a35f);}(_0x8cd4,0xc1));var _0x48cd=function(_0x3a9758,_0x5e54c3){_0x3a9758=_0x3a9758-0x0;var _0x57bde8=_0x8cd4[_0x3a9758];return _0x57bde8;};'use strict';var Sequelize=require(_0x48cd('0x0'));module[_0x48cd('0x1')]={'name':{'type':Sequelize[_0x48cd('0x2')],'allowNull':![],'unique':_0x48cd('0x3')},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x2d1cb1){return'system-'+this[_0x48cd('0x4')](_0x48cd('0x3'))+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize[_0x48cd('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0x48cd('0x5')]}}; \ No newline at end of file +var _0x4fe6=['sequelize','STRING','name','VIRTUAL','system-','getDataValue','INTEGER'];(function(_0x100fdb,_0x2ed03a){var _0x545cb2=function(_0x248528){while(--_0x248528){_0x100fdb['push'](_0x100fdb['shift']());}};_0x545cb2(++_0x2ed03a);}(_0x4fe6,0xd2));var _0x64fe=function(_0x2f255a,_0x37aed1){_0x2f255a=_0x2f255a-0x0;var _0x551181=_0x4fe6[_0x2f255a];return _0x551181;};'use strict';var Sequelize=require(_0x64fe('0x0'));module['exports']={'name':{'type':Sequelize[_0x64fe('0x1')],'allowNull':![],'unique':_0x64fe('0x2')},'prefix':{'type':Sequelize[_0x64fe('0x3')],'get':function(_0x1f9681){return _0x64fe('0x4')+this[_0x64fe('0x5')](_0x64fe('0x2'))+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize[_0x64fe('0x1')]},'VoiceExtensionId':{'type':Sequelize[_0x64fe('0x6')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index c2409f2..153f6b7 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 _0xb03e=['from','team_has_voice_prefixes','join','user_has_teams','clone','toString','SELECT','every','TeamId','all','union','compact','value','isEmpty','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/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','VoicePrefixes','error','stack','index','VoicePrefix','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','name','options','includeAll','include','findAll','rows','catch','show','keys','fields','find','params','describe','create','sequelize','transaction','body','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','app','system','Voice\x20Prefix\x20Extension','priority','prefix','NoOp','VoicePrefixId','Extensions\x20creation\x20failed','push','callerIdAll','Set','PREFIX-CALLERIDALL=','goto','${EXTEN:','charAt','system-','findById','addAgents','omit','ids','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','User','Team','getTeams','addTeams','Agents','online','flatMap','TeamVoicePrefix','upsert','each','findOrCreate','forEach','removeTeams','select','field','tq.TeamId'];(function(_0x4ae853,_0x5920fc){var _0x198d25=function(_0x69ab88){while(--_0x69ab88){_0x4ae853['push'](_0x4ae853['shift']());}};_0x198d25(++_0x5920fc);}(_0xb03e,0x1eb));var _0xeb03=function(_0x25f1e0,_0x183afc){_0x25f1e0=_0x25f1e0-0x0;var _0x28f183=_0xb03e[_0x25f1e0];return _0x28f183;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xeb03('0x0'));var zipdir=require(_0xeb03('0x1'));var jsonpatch=require(_0xeb03('0x2'));var rp=require(_0xeb03('0x3'));var moment=require(_0xeb03('0x4'));var BPromise=require(_0xeb03('0x5'));var Mustache=require(_0xeb03('0x6'));var util=require(_0xeb03('0x7'));var path=require(_0xeb03('0x8'));var sox=require(_0xeb03('0x9'));var csv=require(_0xeb03('0xa'));var ejs=require(_0xeb03('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xeb03('0xc'));var squel=require(_0xeb03('0xd'));var crypto=require(_0xeb03('0xe'));var jsforce=require(_0xeb03('0xf'));var deskjs=require(_0xeb03('0x10'));var toCsv=require(_0xeb03('0xa'));var querystring=require('querystring');var Papa=require(_0xeb03('0x11'));var Redis=require(_0xeb03('0x12'));var authService=require(_0xeb03('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xeb03('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xeb03('0x15'))(_0xeb03('0x16'));var utils=require(_0xeb03('0x17'));var config=require(_0xeb03('0x18'));var licenseUtil=require(_0xeb03('0x19'));var db=require(_0xeb03('0x1a'))['db'];config[_0xeb03('0x1b')]=_[_0xeb03('0x1c')](config[_0xeb03('0x1b')],{'host':_0xeb03('0x1d'),'port':0x18eb});var socket=require(_0xeb03('0x1e'))(new Redis(config[_0xeb03('0x1b')]));require('./voicePrefix.socket')[_0xeb03('0x1f')](socket);function respondWithStatusCode(_0x100bef,_0x372c71){_0x372c71=_0x372c71||0xcc;return function(_0x33f9ba){if(_0x33f9ba){return _0x100bef['sendStatus'](_0x372c71);}return _0x100bef[_0xeb03('0x20')](_0x372c71)[_0xeb03('0x21')]();};}function respondWithResult(_0x3f26ef,_0x478989){_0x478989=_0x478989||0xc8;return function(_0x7ce874){if(_0x7ce874){return _0x3f26ef[_0xeb03('0x20')](_0x478989)[_0xeb03('0x22')](_0x7ce874);}};}function respondWithFilteredResult(_0x44716c,_0x42fa4e){return function(_0x1b4cbd){if(_0x1b4cbd){var _0x167a33=typeof _0x42fa4e[_0xeb03('0x23')]===_0xeb03('0x24')&&typeof _0x42fa4e[_0xeb03('0x25')]===_0xeb03('0x24');var _0x2c238d=_0x1b4cbd[_0xeb03('0x26')];var _0x19bddf=_0x167a33?0x0:_0x42fa4e['offset'];var _0x1bea3f=_0x167a33?_0x1b4cbd[_0xeb03('0x26')]:_0x42fa4e[_0xeb03('0x23')]+_0x42fa4e[_0xeb03('0x25')];var _0xe5a1c2;if(_0x1bea3f>=_0x2c238d){_0x1bea3f=_0x2c238d;_0xe5a1c2=0xc8;}else{_0xe5a1c2=0xce;}_0x44716c[_0xeb03('0x20')](_0xe5a1c2);return _0x44716c[_0xeb03('0x27')](_0xeb03('0x28'),_0x19bddf+'-'+_0x1bea3f+'/'+_0x2c238d)[_0xeb03('0x22')](_0x1b4cbd);}return null;};}function patchUpdates(_0x5a704b){return function(_0x712ac2){try{jsonpatch[_0xeb03('0x29')](_0x712ac2,_0x5a704b,!![]);}catch(_0x11ea85){return BPromise[_0xeb03('0x2a')](_0x11ea85);}return _0x712ac2[_0xeb03('0x2b')]();};}function saveUpdates(_0x5dcda3,_0x638353){return function(_0x406864){if(_0x406864){return _0x406864[_0xeb03('0x2c')](_0x5dcda3)[_0xeb03('0x2d')](function(_0x3f276a){return _0x3f276a;});}return null;};}function removeEntity(_0x119697,_0xb04f34){return function(_0x3f68f3){if(_0x3f68f3){return _0x3f68f3[_0xeb03('0x2e')]()['then'](function(){var _0x832372=_0x3f68f3[_0xeb03('0x2f')]({'plain':!![]});var _0x2683f9=_0xeb03('0x30');return db['UserProfileResource']['destroy']({'where':{'type':_0x2683f9,'resourceId':_0x832372['id']}})[_0xeb03('0x2d')](function(){return _0x3f68f3;});})['then'](function(){_0x119697[_0xeb03('0x20')](0xcc)[_0xeb03('0x21')]();});}};}function handleEntityNotFound(_0x160a37,_0x5db8bb){return function(_0xd4c8ec){if(!_0xd4c8ec){_0x160a37['sendStatus'](0x194);}return _0xd4c8ec;};}function handleError(_0x5cb729,_0x49e316){_0x49e316=_0x49e316||0x1f4;return function(_0x538d19){logger[_0xeb03('0x31')](_0x538d19[_0xeb03('0x32')]);if(_0x538d19['name']){delete _0x538d19['name'];}_0x5cb729['status'](_0x49e316)['send'](_0x538d19);};}exports[_0xeb03('0x33')]=function(_0x3655c3,_0x32aff7){var _0x2d2ddd={},_0x19fa35={},_0x5234dc={'count':0x0,'rows':[]};var _0x13efc6=_['map'](db[_0xeb03('0x34')][_0xeb03('0x35')],function(_0x19ceae){return{'name':_0x19ceae[_0xeb03('0x36')],'type':_0x19ceae[_0xeb03('0x37')][_0xeb03('0x38')]};});_0x19fa35[_0xeb03('0x39')]=_[_0xeb03('0x3a')](_0x13efc6,'name');_0x19fa35[_0xeb03('0x3b')]=_['keys'](_0x3655c3[_0xeb03('0x3b')]);_0x19fa35[_0xeb03('0x3c')]=_[_0xeb03('0x3d')](_0x19fa35[_0xeb03('0x39')],_0x19fa35[_0xeb03('0x3b')]);_0x2d2ddd[_0xeb03('0x3e')]=_['intersection'](_0x19fa35[_0xeb03('0x39')],qs['fields'](_0x3655c3['query']['fields']));_0x2d2ddd[_0xeb03('0x3e')]=_0x2d2ddd[_0xeb03('0x3e')][_0xeb03('0x3f')]?_0x2d2ddd[_0xeb03('0x3e')]:_0x19fa35[_0xeb03('0x39')];if(!_0x3655c3['query'][_0xeb03('0x40')](_0xeb03('0x41'))){_0x2d2ddd[_0xeb03('0x25')]=qs['limit'](_0x3655c3['query'][_0xeb03('0x25')]);_0x2d2ddd[_0xeb03('0x23')]=qs[_0xeb03('0x23')](_0x3655c3['query'][_0xeb03('0x23')]);}_0x2d2ddd[_0xeb03('0x42')]=qs['sort'](_0x3655c3['query'][_0xeb03('0x43')]);_0x2d2ddd[_0xeb03('0x44')]=qs['filters'](_[_0xeb03('0x45')](_0x3655c3[_0xeb03('0x3b')],_0x19fa35[_0xeb03('0x3c')]),_0x13efc6);if(_0x3655c3[_0xeb03('0x3b')][_0xeb03('0x46')]){_0x2d2ddd[_0xeb03('0x44')]=_[_0xeb03('0x47')](_0x2d2ddd[_0xeb03('0x44')],{'$or':_[_0xeb03('0x3a')](_0x13efc6,function(_0x286f48){if(_0x286f48[_0xeb03('0x37')]!==_0xeb03('0x48')){var _0x2a9348={};_0x2a9348[_0x286f48[_0xeb03('0x49')]]={'$like':'%'+_0x3655c3[_0xeb03('0x3b')][_0xeb03('0x46')]+'%'};return _0x2a9348;}})});}_0x2d2ddd=_[_0xeb03('0x47')]({},_0x2d2ddd,_0x3655c3[_0xeb03('0x4a')]);var _0x35e53d={'where':_0x2d2ddd[_0xeb03('0x44')]};return db[_0xeb03('0x34')][_0xeb03('0x26')](_0x35e53d)[_0xeb03('0x2d')](function(_0x5bb7d9){_0x5234dc['count']=_0x5bb7d9;if(_0x3655c3[_0xeb03('0x3b')][_0xeb03('0x4b')]){_0x2d2ddd[_0xeb03('0x4c')]=[{'all':!![]}];}return db[_0xeb03('0x34')][_0xeb03('0x4d')](_0x2d2ddd);})[_0xeb03('0x2d')](function(_0x103c78){_0x5234dc[_0xeb03('0x4e')]=_0x103c78;return _0x5234dc;})['then'](respondWithFilteredResult(_0x32aff7,_0x2d2ddd))[_0xeb03('0x4f')](handleError(_0x32aff7,null));};exports[_0xeb03('0x50')]=function(_0x275d4d,_0xe9dcb0){var _0x528c0f={'raw':![],'where':{'id':_0x275d4d['params']['id']}},_0x57f59e={};_0x57f59e[_0xeb03('0x39')]=_['keys'](db['VoicePrefix']['rawAttributes']);_0x57f59e[_0xeb03('0x3b')]=_[_0xeb03('0x51')](_0x275d4d[_0xeb03('0x3b')]);_0x57f59e[_0xeb03('0x3c')]=_[_0xeb03('0x3d')](_0x57f59e[_0xeb03('0x39')],_0x57f59e['query']);_0x528c0f[_0xeb03('0x3e')]=_['intersection'](_0x57f59e['model'],qs[_0xeb03('0x52')](_0x275d4d[_0xeb03('0x3b')][_0xeb03('0x52')]));_0x528c0f['attributes']=_0x528c0f[_0xeb03('0x3e')][_0xeb03('0x3f')]?_0x528c0f[_0xeb03('0x3e')]:_0x57f59e[_0xeb03('0x39')];if(_0x275d4d[_0xeb03('0x3b')]['includeAll']){_0x528c0f[_0xeb03('0x4c')]=[{'all':!![]}];}_0x528c0f=_['merge']({},_0x528c0f,_0x275d4d[_0xeb03('0x4a')]);return db[_0xeb03('0x34')][_0xeb03('0x53')](_0x528c0f)[_0xeb03('0x2d')](handleEntityNotFound(_0xe9dcb0,null))[_0xeb03('0x2d')](respondWithResult(_0xe9dcb0,null))[_0xeb03('0x4f')](handleError(_0xe9dcb0,null));};exports[_0xeb03('0x2e')]=function(_0x292319,_0x38c993){return db[_0xeb03('0x34')][_0xeb03('0x53')]({'where':{'id':_0x292319[_0xeb03('0x54')]['id']}})[_0xeb03('0x2d')](handleEntityNotFound(_0x38c993,null))[_0xeb03('0x2d')](removeEntity(_0x38c993,null))[_0xeb03('0x4f')](handleError(_0x38c993,null));};exports[_0xeb03('0x55')]=function(_0xf5c1ab,_0x79b7c6){return db[_0xeb03('0x34')][_0xeb03('0x55')]()[_0xeb03('0x2d')](respondWithResult(_0x79b7c6,null))[_0xeb03('0x4f')](handleError(_0x79b7c6,null));};exports[_0xeb03('0x56')]=function(_0x365520,_0x509d79){var _0x17112e;return db[_0xeb03('0x57')][_0xeb03('0x58')](function(_0x5405b4){return db[_0xeb03('0x34')][_0xeb03('0x56')](_0x365520[_0xeb03('0x59')],{'transaction':_0x5405b4})[_0xeb03('0x2d')](function(_0x103da5){_0x17112e=_0x103da5[_0xeb03('0x2f')]({'plain':!![]});return db[_0xeb03('0x5a')][_0xeb03('0x53')]({'where':{'id':_0x17112e[_0xeb03('0x5b')]},'raw':!![]})[_0xeb03('0x2d')](function(_0x46f52e){return createVoicePrefixExtensions(_0x17112e,_0x46f52e,_0x5405b4);});});})[_0xeb03('0x2d')](function(){var _0xf9beaf=_0x365520[_0xeb03('0x5c')]['get']({'plain':!![]});if(!_0xf9beaf)throw new Error(_0xeb03('0x5d'));if(_0xf9beaf[_0xeb03('0x5e')]===_0xeb03('0x5c')){var _0x259db7=_0x17112e;return db[_0xeb03('0x5f')][_0xeb03('0x53')]({'where':{'name':_0xeb03('0x30'),'userProfileId':_0xf9beaf[_0xeb03('0x60')]},'raw':!![]})[_0xeb03('0x2d')](function(_0x23406a){if(_0x23406a&&_0x23406a['autoAssociation']===0x0){return db[_0xeb03('0x61')][_0xeb03('0x56')]({'name':_0x259db7[_0xeb03('0x49')],'resourceId':_0x259db7['id'],'type':_0x23406a[_0xeb03('0x49')],'sectionId':_0x23406a['id']},{})['then'](function(){return _0x17112e;});}else{return _0x17112e;}})[_0xeb03('0x4f')](function(_0x68e1b7){logger[_0xeb03('0x31')](_0xeb03('0x62'),_0x68e1b7);throw _0x68e1b7;});}return _0x17112e;})[_0xeb03('0x2d')](respondWithResult(_0x509d79,null))['catch'](handleError(_0x509d79,null));};function Extension(_0x43efc3,_0x10beeb,_0x28e488,_0x5e1361){this[_0xeb03('0x63')]=_0xeb03('0x64');this['exten']=_0x43efc3;this[_0xeb03('0x65')]=_0x28e488;this[_0xeb03('0x37')]=_0xeb03('0x66');this['description']=_0xeb03('0x67');this[_0xeb03('0x68')]=_0x10beeb;this['appdata']=_0x5e1361;}function createVoicePrefixExtensions(_0x3eb482,_0xfeb8e2,_0x1972fb){return new BPromise(function(_0x3ac2de,_0x3963a7){var _0x38618e=new Extension(formatPrefixName(_0x3eb482[_0xeb03('0x69')]),0x1,_0xeb03('0x6a'),'Voice\x20Prefix');_0x38618e[_0xeb03('0x6b')]=_0x3eb482['id'];return db['VoiceExtension'][_0xeb03('0x56')](_0x38618e,{'transaction':_0x1972fb})[_0xeb03('0x2d')](function(_0x3a9518){var _0x59d0c7=_0x3a9518[_0xeb03('0x2f')]({'plain':!![]});var _0x1508f6=_[_0xeb03('0x3a')](addVoicePrefixExtensions(_0x3eb482,_0xfeb8e2),function(_0x467a9d){_0x467a9d['VoiceExtensionId']=_0x59d0c7['id'];_0x467a9d[_0xeb03('0x6b')]=_0x3eb482['id'];return _0x467a9d;});return db[_0xeb03('0x5a')]['bulkCreate'](_0x1508f6,{'transaction':_0x1972fb})['then'](function(_0x583518){if(!_0x583518){return _0x3963a7(_0xeb03('0x6c'));}else{return _0x3ac2de(_0x583518);}})[_0xeb03('0x4f')](function(_0x9148a6){return _0x3963a7(_0x9148a6);});});;});};function addVoicePrefixExtensions(_0x16ad3a,_0x3da5f4){var _0x461777=[];var _0x443fc9=formatPrefixName(_0x16ad3a[_0xeb03('0x69')]);_0x461777[_0xeb03('0x6d')](new Extension(_0x443fc9,0x2,'Set','CDR(prefix)='+_0x16ad3a[_0xeb03('0x49')]));if(_0x16ad3a[_0xeb03('0x6e')]){_0x461777['push'](new Extension(_0x443fc9,0x3,_0xeb03('0x6f'),_0xeb03('0x70')+_0x16ad3a[_0xeb03('0x6e')]));}else{_0x461777[_0xeb03('0x6d')](new Extension(_0x443fc9,0x3,'NoOp','No\x20callerid\x20available'));}_0x461777[_0xeb03('0x6d')](new Extension(_0x443fc9,0x4,_0xeb03('0x71'),_0x3da5f4[_0xeb03('0x63')]+','+_0xeb03('0x72')+(0x8+_0x16ad3a[_0xeb03('0x49')][_0xeb03('0x3f')])+'}'+','+0x1));return _0x461777;}function formatPrefixName(_0x1a8057){var _0x2ee5c1='_';for(var _0x2e67a4=0x0;_0x2e67a4<_0x1a8057[_0xeb03('0x3f')];_0x2e67a4++){if(_0x1a8057[_0xeb03('0x73')](_0x2e67a4)=='-'){_0x2ee5c1+=_0x1a8057['charAt'](_0x2e67a4);}else{_0x2ee5c1+='['+_0x1a8057['charAt'](_0x2e67a4)+']';}}_0x2ee5c1+='.';return _0x2ee5c1;}exports[_0xeb03('0x2c')]=function(_0x4e52a4,_0x1099ff,_0x4cf4f1){var _0x30623a=_0x4e52a4['body'];_0x30623a[_0xeb03('0x69')]=_0xeb03('0x74')+_0x30623a['name']+'-';return db[_0xeb03('0x57')]['transaction'](function(_0x45f0aa){return db['VoicePrefix'][_0xeb03('0x2c')](_0x30623a,{'where':{'id':_0x30623a['id']},'transaction':_0x45f0aa})['then'](function(){return db['VoiceExtension'][_0xeb03('0x2e')]({'where':{'VoicePrefixId':_0x30623a['id']},'transaction':_0x45f0aa})[_0xeb03('0x2d')](function(){return db[_0xeb03('0x5a')][_0xeb03('0x53')]({'where':{'id':_0x30623a[_0xeb03('0x5b')]},'raw':!![]})[_0xeb03('0x2d')](function(_0x39c15d){return createVoicePrefixExtensions(_0x30623a,_0x39c15d,_0x45f0aa);});});});})['then'](function(){return db[_0xeb03('0x34')][_0xeb03('0x75')](_0x30623a['id']);})[_0xeb03('0x2d')](respondWithResult(_0x1099ff,null))[_0xeb03('0x4f')](handleError(_0x1099ff,null));};exports[_0xeb03('0x76')]=function(_0x126a7f,_0x137a98,_0x4fff6e){return db[_0xeb03('0x34')][_0xeb03('0x53')]({'where':{'id':_0x126a7f[_0xeb03('0x54')]['id']}})[_0xeb03('0x2d')](handleEntityNotFound(_0x137a98,null))[_0xeb03('0x2d')](function(_0xcd7ab1){if(_0xcd7ab1){return _0xcd7ab1[_0xeb03('0x76')](_0x126a7f[_0xeb03('0x59')]['ids'],_[_0xeb03('0x77')](_0x126a7f[_0xeb03('0x59')],[_0xeb03('0x78'),'id'])||{})[_0xeb03('0x79')](function(_0x17c010){for(var _0x5ace77=0x0;_0x5ace77<_0x126a7f[_0xeb03('0x59')][_0xeb03('0x78')][_0xeb03('0x3f')];_0x5ace77+=0x1){socket[_0xeb03('0x7a')](_0xeb03('0x7b'),{'UserId':Number(_0x126a7f[_0xeb03('0x59')][_0xeb03('0x78')][_0x5ace77]),'VoicePrefixId':Number(_0x126a7f['params']['id'])});}return _0x17c010;});}})[_0xeb03('0x2d')](respondWithResult(_0x137a98,null))[_0xeb03('0x4f')](handleError(_0x137a98,null));};exports[_0xeb03('0x7c')]=function(_0x21dfab,_0x396329,_0x48dc21){return db[_0xeb03('0x34')][_0xeb03('0x53')]({'where':{'id':_0x21dfab[_0xeb03('0x54')]['id']}})[_0xeb03('0x2d')](handleEntityNotFound(_0x396329,null))[_0xeb03('0x2d')](function(_0x215759){if(_0x215759){return _0x215759[_0xeb03('0x7c')](_0x21dfab['query'][_0xeb03('0x78')])[_0xeb03('0x2d')](function(){if(_[_0xeb03('0x7d')](_0x21dfab[_0xeb03('0x3b')][_0xeb03('0x78')])){for(var _0x388fbd=0x0;_0x388fbd<_0x21dfab['query'][_0xeb03('0x78')][_0xeb03('0x3f')];_0x388fbd+=0x1){socket[_0xeb03('0x7a')]('userVoicePrefix:remove',{'UserId':Number(_0x21dfab[_0xeb03('0x3b')][_0xeb03('0x78')][_0x388fbd]),'VoicePrefixId':Number(_0x21dfab[_0xeb03('0x54')]['id'])});}}else{socket[_0xeb03('0x7a')](_0xeb03('0x7e'),{'UserId':Number(_0x21dfab[_0xeb03('0x3b')][_0xeb03('0x78')]),'VoicePrefixId':Number(_0x21dfab['params']['id'])});}});}})['then'](respondWithStatusCode(_0x396329,null))[_0xeb03('0x4f')](handleError(_0x396329,null));};exports[_0xeb03('0x7f')]=function(_0x3630a7,_0xe55200,_0x511e5a){var _0x8ba377={};var _0x42c477={};var _0x5b60a4;var _0x45fd83;return db[_0xeb03('0x34')][_0xeb03('0x80')]({'where':{'id':_0x3630a7[_0xeb03('0x54')]['id']}})[_0xeb03('0x2d')](handleEntityNotFound(_0xe55200,null))[_0xeb03('0x2d')](function(_0x5ea593){if(_0x5ea593){_0x5b60a4=_0x5ea593;_0x42c477[_0xeb03('0x39')]=_[_0xeb03('0x51')](db[_0xeb03('0x81')][_0xeb03('0x35')]);_0x42c477[_0xeb03('0x3b')]=_[_0xeb03('0x51')](_0x3630a7[_0xeb03('0x3b')]);_0x42c477[_0xeb03('0x3c')]=_[_0xeb03('0x3d')](_0x42c477[_0xeb03('0x39')],_0x42c477['query']);_0x8ba377[_0xeb03('0x3e')]=_[_0xeb03('0x3d')](_0x42c477['model'],qs[_0xeb03('0x52')](_0x3630a7[_0xeb03('0x3b')]['fields']));_0x8ba377[_0xeb03('0x3e')]=_0x8ba377[_0xeb03('0x3e')][_0xeb03('0x3f')]?_0x8ba377[_0xeb03('0x3e')]:_0x42c477[_0xeb03('0x39')];_0x8ba377['order']=qs['sort'](_0x3630a7['query'][_0xeb03('0x43')]);_0x8ba377['where']=qs[_0xeb03('0x3c')](_[_0xeb03('0x45')](_0x3630a7[_0xeb03('0x3b')],_0x42c477[_0xeb03('0x3c')]));if(_0x3630a7[_0xeb03('0x3b')][_0xeb03('0x46')]){_0x8ba377[_0xeb03('0x44')]=_[_0xeb03('0x47')](_0x8ba377[_0xeb03('0x44')],{'$or':_[_0xeb03('0x3a')](_0x8ba377[_0xeb03('0x3e')],function(_0x27a388){var _0x4ec45c={};_0x4ec45c[_0x27a388]={'$like':'%'+_0x3630a7['query'][_0xeb03('0x46')]+'%'};return _0x4ec45c;})});}_0x8ba377=_['merge']({},_0x8ba377,_0x3630a7['options']);return _0x5b60a4[_0xeb03('0x7f')](_0x8ba377);}})[_0xeb03('0x2d')](function(_0x502b25){if(_0x502b25){_0x45fd83=_0x502b25['length'];if(!_0x3630a7[_0xeb03('0x3b')][_0xeb03('0x40')]('nolimit')){_0x8ba377[_0xeb03('0x25')]=qs[_0xeb03('0x25')](_0x3630a7[_0xeb03('0x3b')][_0xeb03('0x25')]);_0x8ba377[_0xeb03('0x23')]=qs['offset'](_0x3630a7[_0xeb03('0x3b')]['offset']);}return _0x5b60a4['getAgents'](_0x8ba377);}})[_0xeb03('0x2d')](function(_0x2d12eb){if(_0x2d12eb){return _0x2d12eb?{'count':_0x45fd83,'rows':_0x2d12eb}:null;}})[_0xeb03('0x2d')](respondWithResult(_0xe55200,null))[_0xeb03('0x4f')](handleError(_0xe55200,null));};exports['getTeams']=function(_0x4b59f4,_0xf9f2d3,_0x847253){var _0x70343f={};var _0x2d6225={};var _0x388642;var _0x3dc483;return db[_0xeb03('0x34')][_0xeb03('0x80')]({'where':{'id':_0x4b59f4['params']['id']}})['then'](handleEntityNotFound(_0xf9f2d3,null))[_0xeb03('0x2d')](function(_0x5741d4){if(_0x5741d4){_0x388642=_0x5741d4;_0x2d6225[_0xeb03('0x39')]=_['keys'](db[_0xeb03('0x82')][_0xeb03('0x35')]);_0x2d6225[_0xeb03('0x3b')]=_[_0xeb03('0x51')](_0x4b59f4[_0xeb03('0x3b')]);_0x2d6225[_0xeb03('0x3c')]=_[_0xeb03('0x3d')](_0x2d6225[_0xeb03('0x39')],_0x2d6225['query']);_0x70343f['attributes']=_[_0xeb03('0x3d')](_0x2d6225[_0xeb03('0x39')],qs[_0xeb03('0x52')](_0x4b59f4[_0xeb03('0x3b')][_0xeb03('0x52')]));_0x70343f['attributes']=_0x70343f[_0xeb03('0x3e')][_0xeb03('0x3f')]?_0x70343f['attributes']:_0x2d6225[_0xeb03('0x39')];_0x70343f[_0xeb03('0x42')]=qs[_0xeb03('0x43')](_0x4b59f4[_0xeb03('0x3b')][_0xeb03('0x43')]);_0x70343f[_0xeb03('0x44')]=qs[_0xeb03('0x3c')](_[_0xeb03('0x45')](_0x4b59f4[_0xeb03('0x3b')],_0x2d6225[_0xeb03('0x3c')]));if(_0x4b59f4[_0xeb03('0x3b')][_0xeb03('0x46')]){_0x70343f[_0xeb03('0x44')]=_[_0xeb03('0x47')](_0x70343f['where'],{'$or':_[_0xeb03('0x3a')](_0x70343f[_0xeb03('0x3e')],function(_0x4c6b85){var _0x1f3ee1={};_0x1f3ee1[_0x4c6b85]={'$like':'%'+_0x4b59f4['query'][_0xeb03('0x46')]+'%'};return _0x1f3ee1;})});}_0x70343f=_['merge']({},_0x70343f,_0x4b59f4[_0xeb03('0x4a')]);return _0x388642[_0xeb03('0x83')](_0x70343f);}})[_0xeb03('0x2d')](function(_0x1df994){if(_0x1df994){_0x3dc483=_0x1df994[_0xeb03('0x3f')];if(!_0x4b59f4[_0xeb03('0x3b')][_0xeb03('0x40')](_0xeb03('0x41'))){_0x70343f['limit']=qs[_0xeb03('0x25')](_0x4b59f4[_0xeb03('0x3b')][_0xeb03('0x25')]);_0x70343f[_0xeb03('0x23')]=qs['offset'](_0x4b59f4[_0xeb03('0x3b')]['offset']);}return _0x388642[_0xeb03('0x83')](_0x70343f);}})[_0xeb03('0x2d')](function(_0x423ddd){if(_0x423ddd){return _0x423ddd?{'count':_0x3dc483,'rows':_0x423ddd}:null;}})[_0xeb03('0x2d')](respondWithResult(_0xf9f2d3,null))['catch'](handleError(_0xf9f2d3,null));};exports[_0xeb03('0x84')]=function(_0x473d63,_0x1fc15a,_0x45f4d3){var _0x5095a6=_0x473d63[_0xeb03('0x59')]['ids'];var _0x4e0fd8;return db['Team'][_0xeb03('0x4d')]({'where':{'id':_0x5095a6},'attributes':['id'],'include':[{'model':db['User'],'as':_0xeb03('0x85'),'attributes':['id',_0xeb03('0x49'),_0xeb03('0x86'),'voicePause','interface'],'raw':!![]}]})['then'](function(_0x50b2c5){if(_0x50b2c5){_0x4e0fd8=_0x50b2c5;var _0x5c7f6e=_[_0xeb03('0x87')](_0x50b2c5,function(_0x392aaa){var _0x117c5e=_0x392aaa[_0xeb03('0x2f')]({'plain':!![]});return _0x117c5e[_0xeb03('0x85')];});return db[_0xeb03('0x34')]['find']({'where':{'id':_0x473d63[_0xeb03('0x54')]['id']}})[_0xeb03('0x2d')](function(_0x2d8bca){return db[_0xeb03('0x57')]['transaction'](function(_0x5c49c9){return _0x2d8bca[_0xeb03('0x84')](_0x5095a6,{'transaction':_0x5c49c9})[_0xeb03('0x2d')](function(){return BPromise['each'](_0x4e0fd8,function(_0xc7a504){return db[_0xeb03('0x88')][_0xeb03('0x89')]({'TeamId':_0xc7a504['id'],'VoicePrefixId':_0x473d63[_0xeb03('0x54')]['id']},{'transaction':_0x5c49c9});});})[_0xeb03('0x2d')](function(){return BPromise[_0xeb03('0x8a')](_0x5c7f6e,function(_0x11cc99){return db['UserVoicePrefix'][_0xeb03('0x8b')]({'where':{'UserId':_0x11cc99['id'],'VoicePrefixId':_0x473d63[_0xeb03('0x54')]['id']},'transaction':_0x5c49c9});});})[_0xeb03('0x2d')](function(){_0x5c7f6e[_0xeb03('0x8c')](function(_0x1f2ebe){socket[_0xeb03('0x7a')](_0xeb03('0x7b'),{'UserId':_0x1f2ebe['id'],'VoicePrefixId':_0x2d8bca['id']});});});});});}})[_0xeb03('0x2d')](respondWithStatusCode(_0x1fc15a,null))['catch'](handleError(_0x1fc15a,null));};exports[_0xeb03('0x8d')]=function(_0x5e0e2b,_0x497a5b,_0x188d39){return db[_0xeb03('0x82')]['findAll']({'where':{'id':_0x5e0e2b[_0xeb03('0x3b')]['ids']},'attributes':['id'],'include':[{'model':db[_0xeb03('0x81')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xeb03('0x2d')](handleEntityNotFound(_0x497a5b,null))[_0xeb03('0x2d')](function(_0xd6f37b){var _0x1522d4=_[_0xeb03('0x3a')](_0xd6f37b,'id');var _0x47b648=[];var _0x15a726=[];var _0x226569=squel[_0xeb03('0x8e')]();_0x226569[_0xeb03('0x8f')](_0xeb03('0x90'))[_0xeb03('0x91')](_0xeb03('0x92'),'tq')[_0xeb03('0x93')](_0xeb03('0x94'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where']('VoicePrefixId\x20=\x20?',_0x5e0e2b[_0xeb03('0x54')]['id']);for(var _0x40a6ce=0x0;_0x40a6ce<_0xd6f37b[_0xeb03('0x3f')];_0x40a6ce+=0x1){let _0x2f640d=_0xd6f37b[_0x40a6ce];for(var _0x546ebe=0x0;_0x546ebe<_0x2f640d['Agents']['length'];_0x546ebe+=0x1){let _0x3d861f=_0x2f640d[_0xeb03('0x85')][_0x546ebe];var _0x2c89c4=_0x226569[_0xeb03('0x95')]();_0x2c89c4[_0xeb03('0x44')]('ut.UserId\x20=\x20?',_0x3d861f['id']);_0x15a726[_0xeb03('0x6d')](db[_0xeb03('0x57')]['query'](_0x2c89c4[_0xeb03('0x96')](),{'type':db['sequelize']['QueryTypes'][_0xeb03('0x97')]})[_0xeb03('0x2d')](function(_0x123742){if(_0x123742['length']===0x1){return _0x3d861f['id'];}else{var _0x243689=_[_0xeb03('0x98')](_['map'](_0x123742,_0xeb03('0x99')),function(_0x5eb15a){return _['includes'](_0x1522d4,_0x5eb15a);});if(_0x243689){return _0x3d861f['id'];}}}));}}return BPromise[_0xeb03('0x9a')](_0x15a726)[_0xeb03('0x2d')](function(_0x366054){_0x47b648=_(_0x47b648)[_0xeb03('0x9b')](_0x366054)[_0xeb03('0x9c')]()[_0xeb03('0x9d')]();return db['VoicePrefix'][_0xeb03('0x53')]({'where':{'id':_0x5e0e2b[_0xeb03('0x54')]['id']}})[_0xeb03('0x2d')](function(_0x1f0387){return db[_0xeb03('0x57')][_0xeb03('0x58')](function(_0xf0d912){return _0x1f0387[_0xeb03('0x8d')](_0x5e0e2b[_0xeb03('0x3b')][_0xeb03('0x78')],{'transaction':_0xf0d912})[_0xeb03('0x2d')](function(){if(!_[_0xeb03('0x9e')](_0x47b648)){return _0x1f0387[_0xeb03('0x7c')](_0x47b648,{'transaction':_0xf0d912});}})[_0xeb03('0x2d')](function(){_0x47b648[_0xeb03('0x8c')](function(_0x1a0bb5){socket[_0xeb03('0x7a')](_0xeb03('0x7e'),{'UserId':_0x1a0bb5,'VoicePrefixId':_0x1f0387['id']});});});});});});})[_0xeb03('0x2d')](respondWithStatusCode(_0x497a5b,null))[_0xeb03('0x4f')](handleError(_0x497a5b,null));}; \ No newline at end of file +var _0x5204=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','system','description','Voice\x20Prefix\x20Extension','appdata','prefix','NoOp','VoicePrefixId','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','goto','${EXTEN:','system-','findById','addAgents','ids','spread','emit','userVoicePrefix:save','removeAgents','userVoicePrefix:remove','getAgents','User','filter','findOne','Team','getTeams','Agents','online','voicePause','interface','flatMap','addTeams','TeamVoicePrefix','each','UserVoicePrefix','findOrCreate','forEach','field','tq.TeamId','from','team_has_voice_prefixes','join','user_has_teams','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','includes','all','union','compact','value','removeTeams','isEmpty','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','end','json','offset','undefined','limit','set','reject','save','update','then','destroy','get','VoicePrefixes','UserProfileResource','error','name','index','map','VoicePrefix','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','type','VIRTUAL','merge','options','count','includeAll','findAll','rows','catch','show','params','length','include','find','describe','create','sequelize','transaction','body','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId'];(function(_0x3d42aa,_0x8048c7){var _0x3e0515=function(_0x4762b2){while(--_0x4762b2){_0x3d42aa['push'](_0x3d42aa['shift']());}};_0x3e0515(++_0x8048c7);}(_0x5204,0xdf));var _0x4520=function(_0x568496,_0x565afd){_0x568496=_0x568496-0x0;var _0x26c5c1=_0x5204[_0x568496];return _0x26c5c1;};'use strict';var emlformat=require(_0x4520('0x0'));var rimraf=require(_0x4520('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4520('0x2'));var rp=require(_0x4520('0x3'));var moment=require(_0x4520('0x4'));var BPromise=require(_0x4520('0x5'));var Mustache=require(_0x4520('0x6'));var util=require('util');var path=require(_0x4520('0x7'));var sox=require('sox');var csv=require(_0x4520('0x8'));var ejs=require(_0x4520('0x9'));var fs=require('fs');var fs_extra=require(_0x4520('0xa'));var _=require(_0x4520('0xb'));var squel=require(_0x4520('0xc'));var crypto=require(_0x4520('0xd'));var jsforce=require(_0x4520('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x4520('0x8'));var querystring=require('querystring');var Papa=require(_0x4520('0xf'));var Redis=require(_0x4520('0x10'));var authService=require(_0x4520('0x11'));var qs=require(_0x4520('0x12'));var as=require(_0x4520('0x13'));var hardwareService=require(_0x4520('0x14'));var logger=require(_0x4520('0x15'))(_0x4520('0x16'));var utils=require(_0x4520('0x17'));var config=require(_0x4520('0x18'));var licenseUtil=require(_0x4520('0x19'));var db=require(_0x4520('0x1a'))['db'];config[_0x4520('0x1b')]=_[_0x4520('0x1c')](config[_0x4520('0x1b')],{'host':_0x4520('0x1d'),'port':0x18eb});var socket=require(_0x4520('0x1e'))(new Redis(config[_0x4520('0x1b')]));require(_0x4520('0x1f'))[_0x4520('0x20')](socket);function respondWithStatusCode(_0x32950a,_0x48b3e7){_0x48b3e7=_0x48b3e7||0xcc;return function(_0x3e53e5){if(_0x3e53e5){return _0x32950a[_0x4520('0x21')](_0x48b3e7);}return _0x32950a[_0x4520('0x22')](_0x48b3e7)[_0x4520('0x23')]();};}function respondWithResult(_0x32d8aa,_0x51d85f){_0x51d85f=_0x51d85f||0xc8;return function(_0x2c1805){if(_0x2c1805){return _0x32d8aa[_0x4520('0x22')](_0x51d85f)[_0x4520('0x24')](_0x2c1805);}};}function respondWithFilteredResult(_0x283ad4,_0x1b8b0f){return function(_0x2e00f4){if(_0x2e00f4){var _0x1dcf51=typeof _0x1b8b0f[_0x4520('0x25')]===_0x4520('0x26')&&typeof _0x1b8b0f[_0x4520('0x27')]===_0x4520('0x26');var _0x460521=_0x2e00f4['count'];var _0xc016a3=_0x1dcf51?0x0:_0x1b8b0f['offset'];var _0x5ceff6=_0x1dcf51?_0x2e00f4['count']:_0x1b8b0f[_0x4520('0x25')]+_0x1b8b0f['limit'];var _0x39e196;if(_0x5ceff6>=_0x460521){_0x5ceff6=_0x460521;_0x39e196=0xc8;}else{_0x39e196=0xce;}_0x283ad4[_0x4520('0x22')](_0x39e196);return _0x283ad4[_0x4520('0x28')]('Content-Range',_0xc016a3+'-'+_0x5ceff6+'/'+_0x460521)[_0x4520('0x24')](_0x2e00f4);}return null;};}function patchUpdates(_0x4000d4){return function(_0x3b2ede){try{jsonpatch['apply'](_0x3b2ede,_0x4000d4,!![]);}catch(_0x198c34){return BPromise[_0x4520('0x29')](_0x198c34);}return _0x3b2ede[_0x4520('0x2a')]();};}function saveUpdates(_0x3a4680,_0x2a8528){return function(_0x552da1){if(_0x552da1){return _0x552da1[_0x4520('0x2b')](_0x3a4680)[_0x4520('0x2c')](function(_0x3532aa){return _0x3532aa;});}return null;};}function removeEntity(_0x3e2906,_0x57306b){return function(_0x336c63){if(_0x336c63){return _0x336c63[_0x4520('0x2d')]()[_0x4520('0x2c')](function(){var _0x21e1f3=_0x336c63[_0x4520('0x2e')]({'plain':!![]});var _0x2c95ea=_0x4520('0x2f');return db[_0x4520('0x30')][_0x4520('0x2d')]({'where':{'type':_0x2c95ea,'resourceId':_0x21e1f3['id']}})[_0x4520('0x2c')](function(){return _0x336c63;});})['then'](function(){_0x3e2906[_0x4520('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x7ce8d2,_0x14778a){return function(_0x43b4a2){if(!_0x43b4a2){_0x7ce8d2[_0x4520('0x21')](0x194);}return _0x43b4a2;};}function handleError(_0x1da740,_0x4751d1){_0x4751d1=_0x4751d1||0x1f4;return function(_0x5bb163){logger[_0x4520('0x31')](_0x5bb163['stack']);if(_0x5bb163[_0x4520('0x32')]){delete _0x5bb163['name'];}_0x1da740[_0x4520('0x22')](_0x4751d1)['send'](_0x5bb163);};}exports[_0x4520('0x33')]=function(_0x4e6a5f,_0x5087dc){var _0x18d6e9={},_0x14cbb5={},_0x24d5b9={'count':0x0,'rows':[]};var _0x4af381=_[_0x4520('0x34')](db[_0x4520('0x35')][_0x4520('0x36')],function(_0x2ad47f){return{'name':_0x2ad47f['fieldName'],'type':_0x2ad47f['type'][_0x4520('0x37')]};});_0x14cbb5[_0x4520('0x38')]=_['map'](_0x4af381,_0x4520('0x32'));_0x14cbb5[_0x4520('0x39')]=_[_0x4520('0x3a')](_0x4e6a5f[_0x4520('0x39')]);_0x14cbb5[_0x4520('0x3b')]=_[_0x4520('0x3c')](_0x14cbb5['model'],_0x14cbb5[_0x4520('0x39')]);_0x18d6e9[_0x4520('0x3d')]=_['intersection'](_0x14cbb5[_0x4520('0x38')],qs['fields'](_0x4e6a5f[_0x4520('0x39')][_0x4520('0x3e')]));_0x18d6e9['attributes']=_0x18d6e9['attributes']['length']?_0x18d6e9[_0x4520('0x3d')]:_0x14cbb5[_0x4520('0x38')];if(!_0x4e6a5f[_0x4520('0x39')][_0x4520('0x3f')](_0x4520('0x40'))){_0x18d6e9[_0x4520('0x27')]=qs[_0x4520('0x27')](_0x4e6a5f['query'][_0x4520('0x27')]);_0x18d6e9[_0x4520('0x25')]=qs[_0x4520('0x25')](_0x4e6a5f['query'][_0x4520('0x25')]);}_0x18d6e9[_0x4520('0x41')]=qs['sort'](_0x4e6a5f['query'][_0x4520('0x42')]);_0x18d6e9[_0x4520('0x43')]=qs[_0x4520('0x3b')](_[_0x4520('0x44')](_0x4e6a5f[_0x4520('0x39')],_0x14cbb5['filters']),_0x4af381);if(_0x4e6a5f['query']['filter']){_0x18d6e9[_0x4520('0x43')]=_['merge'](_0x18d6e9[_0x4520('0x43')],{'$or':_['map'](_0x4af381,function(_0x517fcb){if(_0x517fcb[_0x4520('0x45')]!==_0x4520('0x46')){var _0x2e005d={};_0x2e005d[_0x517fcb[_0x4520('0x32')]]={'$like':'%'+_0x4e6a5f[_0x4520('0x39')]['filter']+'%'};return _0x2e005d;}})});}_0x18d6e9=_[_0x4520('0x47')]({},_0x18d6e9,_0x4e6a5f[_0x4520('0x48')]);var _0x4a39d4={'where':_0x18d6e9['where']};return db[_0x4520('0x35')][_0x4520('0x49')](_0x4a39d4)['then'](function(_0x2978d5){_0x24d5b9[_0x4520('0x49')]=_0x2978d5;if(_0x4e6a5f[_0x4520('0x39')][_0x4520('0x4a')]){_0x18d6e9['include']=[{'all':!![]}];}return db[_0x4520('0x35')][_0x4520('0x4b')](_0x18d6e9);})[_0x4520('0x2c')](function(_0xb92e25){_0x24d5b9[_0x4520('0x4c')]=_0xb92e25;return _0x24d5b9;})[_0x4520('0x2c')](respondWithFilteredResult(_0x5087dc,_0x18d6e9))[_0x4520('0x4d')](handleError(_0x5087dc,null));};exports[_0x4520('0x4e')]=function(_0x3a2b55,_0x6c07fe){var _0x1e6ac0={'raw':![],'where':{'id':_0x3a2b55[_0x4520('0x4f')]['id']}},_0x199565={};_0x199565[_0x4520('0x38')]=_[_0x4520('0x3a')](db[_0x4520('0x35')][_0x4520('0x36')]);_0x199565['query']=_[_0x4520('0x3a')](_0x3a2b55[_0x4520('0x39')]);_0x199565['filters']=_['intersection'](_0x199565['model'],_0x199565['query']);_0x1e6ac0[_0x4520('0x3d')]=_['intersection'](_0x199565[_0x4520('0x38')],qs[_0x4520('0x3e')](_0x3a2b55[_0x4520('0x39')][_0x4520('0x3e')]));_0x1e6ac0[_0x4520('0x3d')]=_0x1e6ac0[_0x4520('0x3d')][_0x4520('0x50')]?_0x1e6ac0[_0x4520('0x3d')]:_0x199565[_0x4520('0x38')];if(_0x3a2b55[_0x4520('0x39')][_0x4520('0x4a')]){_0x1e6ac0[_0x4520('0x51')]=[{'all':!![]}];}_0x1e6ac0=_[_0x4520('0x47')]({},_0x1e6ac0,_0x3a2b55[_0x4520('0x48')]);return db[_0x4520('0x35')][_0x4520('0x52')](_0x1e6ac0)[_0x4520('0x2c')](handleEntityNotFound(_0x6c07fe,null))[_0x4520('0x2c')](respondWithResult(_0x6c07fe,null))['catch'](handleError(_0x6c07fe,null));};exports['destroy']=function(_0x2f14c1,_0x29e14c){return db[_0x4520('0x35')]['find']({'where':{'id':_0x2f14c1[_0x4520('0x4f')]['id']}})[_0x4520('0x2c')](handleEntityNotFound(_0x29e14c,null))[_0x4520('0x2c')](removeEntity(_0x29e14c,null))['catch'](handleError(_0x29e14c,null));};exports[_0x4520('0x53')]=function(_0x2eb8c2,_0x32d950){return db['VoicePrefix']['describe']()[_0x4520('0x2c')](respondWithResult(_0x32d950,null))[_0x4520('0x4d')](handleError(_0x32d950,null));};exports[_0x4520('0x54')]=function(_0x379da4,_0x2d37ed){var _0x1549cc;return db[_0x4520('0x55')][_0x4520('0x56')](function(_0x4d30d3){return db[_0x4520('0x35')][_0x4520('0x54')](_0x379da4[_0x4520('0x57')],{'transaction':_0x4d30d3})[_0x4520('0x2c')](function(_0xff7d4b){_0x1549cc=_0xff7d4b[_0x4520('0x2e')]({'plain':!![]});return db[_0x4520('0x58')][_0x4520('0x52')]({'where':{'id':_0x1549cc[_0x4520('0x59')]},'raw':!![]})[_0x4520('0x2c')](function(_0x381e0b){return createVoicePrefixExtensions(_0x1549cc,_0x381e0b,_0x4d30d3);});});})[_0x4520('0x2c')](function(){var _0x2f11d9=_0x379da4[_0x4520('0x5a')][_0x4520('0x2e')]({'plain':!![]});if(!_0x2f11d9)throw new Error(_0x4520('0x5b'));if(_0x2f11d9[_0x4520('0x5c')]==='user'){var _0x52bb6c=_0x1549cc;return db[_0x4520('0x5d')][_0x4520('0x52')]({'where':{'name':_0x4520('0x2f'),'userProfileId':_0x2f11d9[_0x4520('0x5e')]},'raw':!![]})[_0x4520('0x2c')](function(_0x2f071e){if(_0x2f071e&&_0x2f071e['autoAssociation']===0x0){return db[_0x4520('0x30')][_0x4520('0x54')]({'name':_0x52bb6c['name'],'resourceId':_0x52bb6c['id'],'type':_0x2f071e[_0x4520('0x32')],'sectionId':_0x2f071e['id']},{})[_0x4520('0x2c')](function(){return _0x1549cc;});}else{return _0x1549cc;}})[_0x4520('0x4d')](function(_0x325edb){logger['error'](_0x4520('0x5f'),_0x325edb);throw _0x325edb;});}return _0x1549cc;})[_0x4520('0x2c')](respondWithResult(_0x2d37ed,null))['catch'](handleError(_0x2d37ed,null));};function Extension(_0x4c7172,_0x347130,_0x83cac1,_0xe07bd0){this[_0x4520('0x60')]=_0x4520('0x61');this[_0x4520('0x62')]=_0x4c7172;this['app']=_0x83cac1;this[_0x4520('0x45')]=_0x4520('0x63');this[_0x4520('0x64')]=_0x4520('0x65');this['priority']=_0x347130;this[_0x4520('0x66')]=_0xe07bd0;}function createVoicePrefixExtensions(_0x26f172,_0x4c9108,_0x20a517){return new BPromise(function(_0x5a55d6,_0x7215a3){var _0xadedd0=new Extension(formatPrefixName(_0x26f172[_0x4520('0x67')]),0x1,_0x4520('0x68'),'Voice\x20Prefix');_0xadedd0[_0x4520('0x69')]=_0x26f172['id'];return db[_0x4520('0x58')][_0x4520('0x54')](_0xadedd0,{'transaction':_0x20a517})[_0x4520('0x2c')](function(_0x4b6f71){var _0x28a0fd=_0x4b6f71[_0x4520('0x2e')]({'plain':!![]});var _0x3c7b9e=_[_0x4520('0x34')](addVoicePrefixExtensions(_0x26f172,_0x4c9108),function(_0x196763){_0x196763[_0x4520('0x59')]=_0x28a0fd['id'];_0x196763['VoicePrefixId']=_0x26f172['id'];return _0x196763;});return db[_0x4520('0x58')]['bulkCreate'](_0x3c7b9e,{'transaction':_0x20a517})[_0x4520('0x2c')](function(_0x22e363){if(!_0x22e363){return _0x7215a3(_0x4520('0x6a'));}else{return _0x5a55d6(_0x22e363);}})[_0x4520('0x4d')](function(_0x393da3){return _0x7215a3(_0x393da3);});});;});};function addVoicePrefixExtensions(_0x41a204,_0x5d100c){var _0x4d5085=[];var _0xa7461b=formatPrefixName(_0x41a204['prefix']);_0x4d5085[_0x4520('0x6b')](new Extension(_0xa7461b,0x2,_0x4520('0x6c'),_0x4520('0x6d')+_0x41a204[_0x4520('0x32')]));if(_0x41a204[_0x4520('0x6e')]){_0x4d5085[_0x4520('0x6b')](new Extension(_0xa7461b,0x3,_0x4520('0x6c'),_0x4520('0x6f')+_0x41a204[_0x4520('0x6e')]));}else{_0x4d5085['push'](new Extension(_0xa7461b,0x3,_0x4520('0x68'),'No\x20callerid\x20available'));}_0x4d5085[_0x4520('0x6b')](new Extension(_0xa7461b,0x4,_0x4520('0x70'),_0x5d100c[_0x4520('0x60')]+','+_0x4520('0x71')+(0x8+_0x41a204[_0x4520('0x32')]['length'])+'}'+','+0x1));return _0x4d5085;}function formatPrefixName(_0x1f7ccb){var _0x375f5d='_';for(var _0x3892fa=0x0;_0x3892fa<_0x1f7ccb[_0x4520('0x50')];_0x3892fa++){if(_0x1f7ccb['charAt'](_0x3892fa)=='-'){_0x375f5d+=_0x1f7ccb['charAt'](_0x3892fa);}else{_0x375f5d+='['+_0x1f7ccb['charAt'](_0x3892fa)+']';}}_0x375f5d+='.';return _0x375f5d;}exports[_0x4520('0x2b')]=function(_0x14bd13,_0x390835,_0x5cf8b9){var _0x2842dc=_0x14bd13[_0x4520('0x57')];_0x2842dc[_0x4520('0x67')]=_0x4520('0x72')+_0x2842dc[_0x4520('0x32')]+'-';return db['sequelize'][_0x4520('0x56')](function(_0x3fa1ac){return db[_0x4520('0x35')]['update'](_0x2842dc,{'where':{'id':_0x2842dc['id']},'transaction':_0x3fa1ac})[_0x4520('0x2c')](function(){return db[_0x4520('0x58')][_0x4520('0x2d')]({'where':{'VoicePrefixId':_0x2842dc['id']},'transaction':_0x3fa1ac})[_0x4520('0x2c')](function(){return db[_0x4520('0x58')][_0x4520('0x52')]({'where':{'id':_0x2842dc[_0x4520('0x59')]},'raw':!![]})[_0x4520('0x2c')](function(_0x524942){return createVoicePrefixExtensions(_0x2842dc,_0x524942,_0x3fa1ac);});});});})['then'](function(){return db[_0x4520('0x35')][_0x4520('0x73')](_0x2842dc['id']);})['then'](respondWithResult(_0x390835,null))[_0x4520('0x4d')](handleError(_0x390835,null));};exports['addAgents']=function(_0x2d2f31,_0x231843,_0x536e21){return db[_0x4520('0x35')][_0x4520('0x52')]({'where':{'id':_0x2d2f31['params']['id']}})[_0x4520('0x2c')](handleEntityNotFound(_0x231843,null))[_0x4520('0x2c')](function(_0x5330cf){if(_0x5330cf){return _0x5330cf[_0x4520('0x74')](_0x2d2f31[_0x4520('0x57')][_0x4520('0x75')],_['omit'](_0x2d2f31[_0x4520('0x57')],[_0x4520('0x75'),'id'])||{})[_0x4520('0x76')](function(_0x17d595){for(var _0x2d21e9=0x0;_0x2d21e9<_0x2d2f31[_0x4520('0x57')][_0x4520('0x75')][_0x4520('0x50')];_0x2d21e9+=0x1){socket[_0x4520('0x77')](_0x4520('0x78'),{'UserId':Number(_0x2d2f31[_0x4520('0x57')][_0x4520('0x75')][_0x2d21e9]),'VoicePrefixId':Number(_0x2d2f31['params']['id'])});}return _0x17d595;});}})['then'](respondWithResult(_0x231843,null))[_0x4520('0x4d')](handleError(_0x231843,null));};exports['removeAgents']=function(_0x15b5ae,_0x15fb9c,_0x17c779){return db[_0x4520('0x35')][_0x4520('0x52')]({'where':{'id':_0x15b5ae['params']['id']}})['then'](handleEntityNotFound(_0x15fb9c,null))[_0x4520('0x2c')](function(_0x2f4226){if(_0x2f4226){return _0x2f4226[_0x4520('0x79')](_0x15b5ae[_0x4520('0x39')][_0x4520('0x75')])[_0x4520('0x2c')](function(){if(_['isArray'](_0x15b5ae[_0x4520('0x39')][_0x4520('0x75')])){for(var _0x55f3ab=0x0;_0x55f3ab<_0x15b5ae[_0x4520('0x39')]['ids']['length'];_0x55f3ab+=0x1){socket['emit'](_0x4520('0x7a'),{'UserId':Number(_0x15b5ae[_0x4520('0x39')][_0x4520('0x75')][_0x55f3ab]),'VoicePrefixId':Number(_0x15b5ae[_0x4520('0x4f')]['id'])});}}else{socket[_0x4520('0x77')]('userVoicePrefix:remove',{'UserId':Number(_0x15b5ae[_0x4520('0x39')][_0x4520('0x75')]),'VoicePrefixId':Number(_0x15b5ae['params']['id'])});}});}})['then'](respondWithStatusCode(_0x15fb9c,null))[_0x4520('0x4d')](handleError(_0x15fb9c,null));};exports[_0x4520('0x7b')]=function(_0x34b640,_0x539644,_0xc9bc2){var _0x341b55={};var _0x1df90c={};var _0x4866b5;var _0x80496a;return db[_0x4520('0x35')]['findOne']({'where':{'id':_0x34b640[_0x4520('0x4f')]['id']}})['then'](handleEntityNotFound(_0x539644,null))[_0x4520('0x2c')](function(_0x388177){if(_0x388177){_0x4866b5=_0x388177;_0x1df90c[_0x4520('0x38')]=_[_0x4520('0x3a')](db[_0x4520('0x7c')][_0x4520('0x36')]);_0x1df90c[_0x4520('0x39')]=_['keys'](_0x34b640[_0x4520('0x39')]);_0x1df90c['filters']=_[_0x4520('0x3c')](_0x1df90c[_0x4520('0x38')],_0x1df90c['query']);_0x341b55[_0x4520('0x3d')]=_[_0x4520('0x3c')](_0x1df90c[_0x4520('0x38')],qs[_0x4520('0x3e')](_0x34b640[_0x4520('0x39')][_0x4520('0x3e')]));_0x341b55[_0x4520('0x3d')]=_0x341b55[_0x4520('0x3d')][_0x4520('0x50')]?_0x341b55[_0x4520('0x3d')]:_0x1df90c[_0x4520('0x38')];_0x341b55['order']=qs['sort'](_0x34b640['query']['sort']);_0x341b55['where']=qs[_0x4520('0x3b')](_[_0x4520('0x44')](_0x34b640[_0x4520('0x39')],_0x1df90c[_0x4520('0x3b')]));if(_0x34b640['query'][_0x4520('0x7d')]){_0x341b55['where']=_[_0x4520('0x47')](_0x341b55['where'],{'$or':_[_0x4520('0x34')](_0x341b55['attributes'],function(_0x2b334a){var _0x2e08ab={};_0x2e08ab[_0x2b334a]={'$like':'%'+_0x34b640[_0x4520('0x39')][_0x4520('0x7d')]+'%'};return _0x2e08ab;})});}_0x341b55=_['merge']({},_0x341b55,_0x34b640[_0x4520('0x48')]);return _0x4866b5['getAgents'](_0x341b55);}})[_0x4520('0x2c')](function(_0x322d47){if(_0x322d47){_0x80496a=_0x322d47[_0x4520('0x50')];if(!_0x34b640[_0x4520('0x39')][_0x4520('0x3f')]('nolimit')){_0x341b55[_0x4520('0x27')]=qs[_0x4520('0x27')](_0x34b640['query'][_0x4520('0x27')]);_0x341b55[_0x4520('0x25')]=qs['offset'](_0x34b640[_0x4520('0x39')]['offset']);}return _0x4866b5['getAgents'](_0x341b55);}})[_0x4520('0x2c')](function(_0x39af12){if(_0x39af12){return _0x39af12?{'count':_0x80496a,'rows':_0x39af12}:null;}})['then'](respondWithResult(_0x539644,null))[_0x4520('0x4d')](handleError(_0x539644,null));};exports['getTeams']=function(_0x2739c5,_0x3b29de,_0x41b2d7){var _0x1ea71c={};var _0x47273c={};var _0x1c5bf5;var _0x1079e1;return db[_0x4520('0x35')][_0x4520('0x7e')]({'where':{'id':_0x2739c5[_0x4520('0x4f')]['id']}})[_0x4520('0x2c')](handleEntityNotFound(_0x3b29de,null))[_0x4520('0x2c')](function(_0x42a394){if(_0x42a394){_0x1c5bf5=_0x42a394;_0x47273c[_0x4520('0x38')]=_['keys'](db[_0x4520('0x7f')][_0x4520('0x36')]);_0x47273c['query']=_[_0x4520('0x3a')](_0x2739c5[_0x4520('0x39')]);_0x47273c['filters']=_[_0x4520('0x3c')](_0x47273c[_0x4520('0x38')],_0x47273c[_0x4520('0x39')]);_0x1ea71c[_0x4520('0x3d')]=_[_0x4520('0x3c')](_0x47273c[_0x4520('0x38')],qs['fields'](_0x2739c5[_0x4520('0x39')][_0x4520('0x3e')]));_0x1ea71c[_0x4520('0x3d')]=_0x1ea71c[_0x4520('0x3d')][_0x4520('0x50')]?_0x1ea71c['attributes']:_0x47273c['model'];_0x1ea71c[_0x4520('0x41')]=qs[_0x4520('0x42')](_0x2739c5[_0x4520('0x39')][_0x4520('0x42')]);_0x1ea71c[_0x4520('0x43')]=qs[_0x4520('0x3b')](_[_0x4520('0x44')](_0x2739c5[_0x4520('0x39')],_0x47273c[_0x4520('0x3b')]));if(_0x2739c5[_0x4520('0x39')]['filter']){_0x1ea71c[_0x4520('0x43')]=_[_0x4520('0x47')](_0x1ea71c['where'],{'$or':_[_0x4520('0x34')](_0x1ea71c[_0x4520('0x3d')],function(_0x54d969){var _0x14724f={};_0x14724f[_0x54d969]={'$like':'%'+_0x2739c5[_0x4520('0x39')]['filter']+'%'};return _0x14724f;})});}_0x1ea71c=_['merge']({},_0x1ea71c,_0x2739c5[_0x4520('0x48')]);return _0x1c5bf5[_0x4520('0x80')](_0x1ea71c);}})[_0x4520('0x2c')](function(_0xf3ef3f){if(_0xf3ef3f){_0x1079e1=_0xf3ef3f['length'];if(!_0x2739c5[_0x4520('0x39')][_0x4520('0x3f')](_0x4520('0x40'))){_0x1ea71c[_0x4520('0x27')]=qs[_0x4520('0x27')](_0x2739c5[_0x4520('0x39')][_0x4520('0x27')]);_0x1ea71c[_0x4520('0x25')]=qs[_0x4520('0x25')](_0x2739c5['query'][_0x4520('0x25')]);}return _0x1c5bf5[_0x4520('0x80')](_0x1ea71c);}})[_0x4520('0x2c')](function(_0x5e273e){if(_0x5e273e){return _0x5e273e?{'count':_0x1079e1,'rows':_0x5e273e}:null;}})['then'](respondWithResult(_0x3b29de,null))[_0x4520('0x4d')](handleError(_0x3b29de,null));};exports['addTeams']=function(_0x770d66,_0xe8aa53,_0xd57838){var _0x12b063=_0x770d66[_0x4520('0x57')][_0x4520('0x75')];var _0x1b2c01;return db[_0x4520('0x7f')][_0x4520('0x4b')]({'where':{'id':_0x12b063},'attributes':['id'],'include':[{'model':db['User'],'as':_0x4520('0x81'),'attributes':['id',_0x4520('0x32'),_0x4520('0x82'),_0x4520('0x83'),_0x4520('0x84')],'raw':!![]}]})[_0x4520('0x2c')](function(_0x3d21a1){if(_0x3d21a1){_0x1b2c01=_0x3d21a1;var _0x53acec=_[_0x4520('0x85')](_0x3d21a1,function(_0x249502){var _0x3780ad=_0x249502[_0x4520('0x2e')]({'plain':!![]});return _0x3780ad[_0x4520('0x81')];});return db['VoicePrefix']['find']({'where':{'id':_0x770d66[_0x4520('0x4f')]['id']}})[_0x4520('0x2c')](function(_0x36b481){return db['sequelize']['transaction'](function(_0x321c4b){return _0x36b481[_0x4520('0x86')](_0x12b063,{'transaction':_0x321c4b})[_0x4520('0x2c')](function(){return BPromise['each'](_0x1b2c01,function(_0x509de6){return db[_0x4520('0x87')]['upsert']({'TeamId':_0x509de6['id'],'VoicePrefixId':_0x770d66[_0x4520('0x4f')]['id']},{'transaction':_0x321c4b});});})[_0x4520('0x2c')](function(){return BPromise[_0x4520('0x88')](_0x53acec,function(_0x3c5501){return db[_0x4520('0x89')][_0x4520('0x8a')]({'where':{'UserId':_0x3c5501['id'],'VoicePrefixId':_0x770d66[_0x4520('0x4f')]['id']},'transaction':_0x321c4b});});})[_0x4520('0x2c')](function(){_0x53acec[_0x4520('0x8b')](function(_0x3eb1fd){socket['emit'](_0x4520('0x78'),{'UserId':_0x3eb1fd['id'],'VoicePrefixId':_0x36b481['id']});});});});});}})['then'](respondWithStatusCode(_0xe8aa53,null))[_0x4520('0x4d')](handleError(_0xe8aa53,null));};exports['removeTeams']=function(_0x3262ef,_0x31ab69,_0x245180){return db[_0x4520('0x7f')]['findAll']({'where':{'id':_0x3262ef[_0x4520('0x39')][_0x4520('0x75')]},'attributes':['id'],'include':[{'model':db[_0x4520('0x7c')],'as':_0x4520('0x81'),'attributes':['id'],'raw':!![]}]})[_0x4520('0x2c')](handleEntityNotFound(_0x31ab69,null))[_0x4520('0x2c')](function(_0x22a5cd){var _0x4d108f=_[_0x4520('0x34')](_0x22a5cd,'id');var _0x56f398=[];var _0x4ab423=[];var _0x320603=squel['select']();_0x320603[_0x4520('0x8c')](_0x4520('0x8d'))[_0x4520('0x8e')](_0x4520('0x8f'),'tq')[_0x4520('0x90')](_0x4520('0x91'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x4520('0x43')](_0x4520('0x92'),_0x3262ef[_0x4520('0x4f')]['id']);for(var _0x353b3e=0x0;_0x353b3e<_0x22a5cd['length'];_0x353b3e+=0x1){let _0x21bb01=_0x22a5cd[_0x353b3e];for(var _0x4e7421=0x0;_0x4e7421<_0x21bb01[_0x4520('0x81')][_0x4520('0x50')];_0x4e7421+=0x1){let _0x490a08=_0x21bb01[_0x4520('0x81')][_0x4e7421];var _0x1872d2=_0x320603[_0x4520('0x93')]();_0x1872d2['where'](_0x4520('0x94'),_0x490a08['id']);_0x4ab423[_0x4520('0x6b')](db['sequelize'][_0x4520('0x39')](_0x1872d2[_0x4520('0x95')](),{'type':db[_0x4520('0x55')][_0x4520('0x96')][_0x4520('0x97')]})['then'](function(_0x7058b0){if(_0x7058b0[_0x4520('0x50')]===0x1){return _0x490a08['id'];}else{var _0x3398e2=_['every'](_[_0x4520('0x34')](_0x7058b0,'TeamId'),function(_0x408dff){return _[_0x4520('0x98')](_0x4d108f,_0x408dff);});if(_0x3398e2){return _0x490a08['id'];}}}));}}return BPromise[_0x4520('0x99')](_0x4ab423)[_0x4520('0x2c')](function(_0x2f0c56){_0x56f398=_(_0x56f398)[_0x4520('0x9a')](_0x2f0c56)[_0x4520('0x9b')]()[_0x4520('0x9c')]();return db[_0x4520('0x35')]['find']({'where':{'id':_0x3262ef[_0x4520('0x4f')]['id']}})[_0x4520('0x2c')](function(_0x4b7ffd){return db['sequelize'][_0x4520('0x56')](function(_0x11709d){return _0x4b7ffd[_0x4520('0x9d')](_0x3262ef[_0x4520('0x39')][_0x4520('0x75')],{'transaction':_0x11709d})[_0x4520('0x2c')](function(){if(!_[_0x4520('0x9e')](_0x56f398)){return _0x4b7ffd[_0x4520('0x79')](_0x56f398,{'transaction':_0x11709d});}})[_0x4520('0x2c')](function(){_0x56f398[_0x4520('0x8b')](function(_0x43e7c7){socket['emit'](_0x4520('0x7a'),{'UserId':_0x43e7c7,'VoicePrefixId':_0x4b7ffd['id']});});});});});});})[_0x4520('0x2c')](respondWithStatusCode(_0x31ab69,null))[_0x4520('0x4d')](handleError(_0x31ab69,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index be6c73c..1ea6b09 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 _0x27c7=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','events','../../mysqldb','VoicePrefix'];(function(_0x872b02,_0x4f4458){var _0x1a6b24=function(_0x1dfb4e){while(--_0x1dfb4e){_0x872b02['push'](_0x872b02['shift']());}};_0x1a6b24(++_0x4f4458);}(_0x27c7,0xb1));var _0x727c=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x27c7[_0x1ac595];return _0x455fff;};'use strict';var EventEmitter=require(_0x727c('0x0'));var VoicePrefix=require(_0x727c('0x1'))['db'][_0x727c('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x727c('0x3')](0x0);var events={'afterCreate':_0x727c('0x4'),'afterUpdate':'update','afterDestroy':_0x727c('0x5')};function emitEvent(_0x5ac4d7){return function(_0x5202b2,_0x2b8dfa,_0x1e6688){VoicePrefixEvents[_0x727c('0x6')](_0x5ac4d7+':'+_0x5202b2['id'],_0x5202b2);VoicePrefixEvents[_0x727c('0x6')](_0x5ac4d7,_0x5202b2);_0x1e6688(null);};}for(var e in events){if(events[_0x727c('0x7')](e)){var event=events[e];VoicePrefix[_0x727c('0x8')](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file +var _0x469d=['remove','emit','hook','exports','events','../../mysqldb','setMaxListeners','save','update'];(function(_0x307296,_0x49b881){var _0x32f975=function(_0x4ed150){while(--_0x4ed150){_0x307296['push'](_0x307296['shift']());}};_0x32f975(++_0x49b881);}(_0x469d,0x94));var _0xd469=function(_0x30f1b4,_0x4095bb){_0x30f1b4=_0x30f1b4-0x0;var _0x50211c=_0x469d[_0x30f1b4];return _0x50211c;};'use strict';var EventEmitter=require(_0xd469('0x0'));var VoicePrefix=require(_0xd469('0x1'))['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xd469('0x2')](0x0);var events={'afterCreate':_0xd469('0x3'),'afterUpdate':_0xd469('0x4'),'afterDestroy':_0xd469('0x5')};function emitEvent(_0xa90e48){return function(_0x578cba,_0x5bd29e,_0x29dd21){VoicePrefixEvents[_0xd469('0x6')](_0xa90e48+':'+_0x578cba['id'],_0x578cba);VoicePrefixEvents['emit'](_0xa90e48,_0x578cba);_0x29dd21(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix[_0xd469('0x7')](e,emitEvent(event));}}module[_0xd469('0x8')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 469f499..bc19598 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 _0x509b=['rimraf','../../config/environment','./voicePrefix.attributes','exports','voice_prefixes','api','moment','bluebird','request-promise','path'];(function(_0x12d26b,_0x3f0148){var _0x4cb021=function(_0xe2c808){while(--_0xe2c808){_0x12d26b['push'](_0x12d26b['shift']());}};_0x4cb021(++_0x3f0148);}(_0x509b,0xc3));var _0xb509=function(_0x21720f,_0x3c0896){_0x21720f=_0x21720f-0x0;var _0x5c7ec5=_0x509b[_0x21720f];return _0x5c7ec5;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xb509('0x0'));var moment=require(_0xb509('0x1'));var BPromise=require(_0xb509('0x2'));var rp=require(_0xb509('0x3'));var fs=require('fs');var path=require(_0xb509('0x4'));var rimraf=require(_0xb509('0x5'));var config=require(_0xb509('0x6'));var attributes=require(_0xb509('0x7'));module[_0xb509('0x8')]=function(_0x342739,_0x385631){return _0x342739['define']('VoicePrefix',attributes,{'tableName':_0xb509('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdb00=['rimraf','../../config/environment','./voicePrefix.attributes','define','VoicePrefix','lodash','api','bluebird','request-promise','path'];(function(_0x20721e,_0x23c185){var _0x4ccd68=function(_0x3d3a21){while(--_0x3d3a21){_0x20721e['push'](_0x20721e['shift']());}};_0x4ccd68(++_0x23c185);}(_0xdb00,0x1d1));var _0x0db0=function(_0x17e653,_0x4c21e9){_0x17e653=_0x17e653-0x0;var _0x4341a1=_0xdb00[_0x17e653];return _0x4341a1;};'use strict';var _=require(_0x0db0('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x0db0('0x1'));var moment=require('moment');var BPromise=require(_0x0db0('0x2'));var rp=require(_0x0db0('0x3'));var fs=require('fs');var path=require(_0x0db0('0x4'));var rimraf=require(_0x0db0('0x5'));var config=require(_0x0db0('0x6'));var attributes=require(_0x0db0('0x7'));module['exports']=function(_0xb7c7a3,_0x161708){return _0xb7c7a3[_0x0db0('0x8')](_0x0db0('0x9'),attributes,{'tableName':'voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index 3c925f8..c754c66 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 _0xd448=['request\x20sent','stringify','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','defaults','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','then','info','VoicePrefix,\x20%s,\x20%s','debug','VoicePrefix,\x20%s,\x20%s,\x20%s'];(function(_0x191037,_0x3337e9){var _0x571a29=function(_0x22fe35){while(--_0x22fe35){_0x191037['push'](_0x191037['shift']());}};_0x571a29(++_0x3337e9);}(_0xd448,0x172));var _0x8d44=function(_0x449385,_0x4543e1){_0x449385=_0x449385-0x0;var _0x234dd4=_0xd448[_0x449385];return _0x234dd4;};'use strict';var _=require('lodash');var util=require(_0x8d44('0x0'));var moment=require(_0x8d44('0x1'));var BPromise=require(_0x8d44('0x2'));var rs=require(_0x8d44('0x3'));var fs=require('fs');var Redis=require(_0x8d44('0x4'));var db=require(_0x8d44('0x5'))['db'];var utils=require(_0x8d44('0x6'));var logger=require(_0x8d44('0x7'))(_0x8d44('0x8'));var config=require(_0x8d44('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x8d44('0xa')]['http']({'port':0x232a});config['redis']=_[_0x8d44('0xb')](config[_0x8d44('0xc')],{'host':_0x8d44('0xd'),'port':0x18eb});var socket=require(_0x8d44('0xe'))(new Redis(config['redis']));require(_0x8d44('0xf'))[_0x8d44('0x10')](socket);function respondWithRpcPromise(_0x52f047,_0x506c89,_0x220502){return new BPromise(function(_0x362ed8,_0xe2dd72){return client['request'](_0x52f047,_0x220502)[_0x8d44('0x11')](function(_0x2e2fd3){logger[_0x8d44('0x12')](_0x8d44('0x13'),_0x506c89,'request\x20sent');logger[_0x8d44('0x14')](_0x8d44('0x15'),_0x506c89,_0x8d44('0x16'),JSON[_0x8d44('0x17')](_0x2e2fd3));if(_0x2e2fd3[_0x8d44('0x18')]){if(_0x2e2fd3['error'][_0x8d44('0x19')]===0x1f4){logger[_0x8d44('0x18')](_0x8d44('0x13'),_0x506c89,_0x2e2fd3[_0x8d44('0x18')][_0x8d44('0x1a')]);return _0xe2dd72(_0x2e2fd3['error'][_0x8d44('0x1a')]);}logger[_0x8d44('0x18')](_0x8d44('0x13'),_0x506c89,_0x2e2fd3[_0x8d44('0x18')][_0x8d44('0x1a')]);return _0x362ed8(_0x2e2fd3[_0x8d44('0x18')][_0x8d44('0x1a')]);}else{logger[_0x8d44('0x12')](_0x8d44('0x13'),_0x506c89,_0x8d44('0x16'));_0x362ed8(_0x2e2fd3['result'][_0x8d44('0x1a')]);}})[_0x8d44('0x1b')](function(_0x57a4f4){logger[_0x8d44('0x18')](_0x8d44('0x13'),_0x506c89,_0x57a4f4);_0xe2dd72(_0x57a4f4);});});} \ No newline at end of file +var _0x1c75=['http','redis','localhost','socket.io-emitter','register','then','info','VoicePrefix,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','VoicePrefix,\x20%s,\x20%s','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x2bd6a4,_0x3332cb){var _0x44da66=function(_0x513023){while(--_0x513023){_0x2bd6a4['push'](_0x2bd6a4['shift']());}};_0x44da66(++_0x3332cb);}(_0x1c75,0xce));var _0x51c7=function(_0x18ea99,_0x5d0dc6){_0x18ea99=_0x18ea99-0x0;var _0x4e1a63=_0x1c75[_0x18ea99];return _0x4e1a63;};'use strict';var _=require(_0x51c7('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x51c7('0x1'));var fs=require('fs');var Redis=require(_0x51c7('0x2'));var db=require(_0x51c7('0x3'))['db'];var utils=require(_0x51c7('0x4'));var logger=require(_0x51c7('0x5'))(_0x51c7('0x6'));var config=require(_0x51c7('0x7'));var jayson=require(_0x51c7('0x8'));var client=jayson[_0x51c7('0x9')][_0x51c7('0xa')]({'port':0x232a});config[_0x51c7('0xb')]=_['defaults'](config[_0x51c7('0xb')],{'host':_0x51c7('0xc'),'port':0x18eb});var socket=require(_0x51c7('0xd'))(new Redis(config[_0x51c7('0xb')]));require('./voicePrefix.socket')[_0x51c7('0xe')](socket);function respondWithRpcPromise(_0x4b02a5,_0x45c45e,_0x5692a7){return new BPromise(function(_0x179902,_0x1830a0){return client['request'](_0x4b02a5,_0x5692a7)[_0x51c7('0xf')](function(_0x115baa){logger[_0x51c7('0x10')]('VoicePrefix,\x20%s,\x20%s',_0x45c45e,'request\x20sent');logger['debug'](_0x51c7('0x11'),_0x45c45e,_0x51c7('0x12'),JSON[_0x51c7('0x13')](_0x115baa));if(_0x115baa['error']){if(_0x115baa[_0x51c7('0x14')]['code']===0x1f4){logger[_0x51c7('0x14')]('VoicePrefix,\x20%s,\x20%s',_0x45c45e,_0x115baa[_0x51c7('0x14')]['message']);return _0x1830a0(_0x115baa[_0x51c7('0x14')][_0x51c7('0x15')]);}logger[_0x51c7('0x14')](_0x51c7('0x16'),_0x45c45e,_0x115baa['error'][_0x51c7('0x15')]);return _0x179902(_0x115baa[_0x51c7('0x14')][_0x51c7('0x15')]);}else{logger[_0x51c7('0x10')](_0x51c7('0x16'),_0x45c45e,_0x51c7('0x12'));_0x179902(_0x115baa['result'][_0x51c7('0x15')]);}})[_0x51c7('0x17')](function(_0x6960a9){logger['error'](_0x51c7('0x16'),_0x45c45e,_0x6960a9);_0x1830a0(_0x6960a9);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index b3e86ea..bcc4c5c 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 _0x90db=['save','remove','update','removeListener','register','length','voicePrefix:'];(function(_0x17e92c,_0x1407e9){var _0x398639=function(_0x4ec3ee){while(--_0x4ec3ee){_0x17e92c['push'](_0x17e92c['shift']());}};_0x398639(++_0x1407e9);}(_0x90db,0x1c0));var _0xb90d=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0x90db[_0x37bd26];return _0xe83dc4;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=[_0xb90d('0x0'),_0xb90d('0x1'),_0xb90d('0x2')];function createListener(_0x5050f4,_0x4fc4c2){return function(_0x4faf3d){_0x4fc4c2['emit'](_0x5050f4,_0x4faf3d);};}function removeListener(_0x4aaef1,_0x17e9b9){return function(){VoicePrefixEvents[_0xb90d('0x3')](_0x4aaef1,_0x17e9b9);};}exports[_0xb90d('0x4')]=function(_0x380149){for(var _0x1e7a52=0x0,_0x2d8398=events[_0xb90d('0x5')];_0x1e7a52<_0x2d8398;_0x1e7a52++){var _0x126e17=events[_0x1e7a52];var _0x2ef5e6=createListener(_0xb90d('0x6')+_0x126e17,_0x380149);VoicePrefixEvents['on'](_0x126e17,_0x2ef5e6);}}; \ No newline at end of file +var _0x6a24=['save','update','emit','removeListener','./voicePrefix.events'];(function(_0x36f157,_0x433402){var _0x45335d=function(_0x4db0c6){while(--_0x4db0c6){_0x36f157['push'](_0x36f157['shift']());}};_0x45335d(++_0x433402);}(_0x6a24,0xd1));var _0x46a2=function(_0x25b32a,_0x1a5d70){_0x25b32a=_0x25b32a-0x0;var _0x596b6c=_0x6a24[_0x25b32a];return _0x596b6c;};'use strict';var VoicePrefixEvents=require(_0x46a2('0x0'));var events=[_0x46a2('0x1'),'remove',_0x46a2('0x2')];function createListener(_0x3be5d8,_0x1186b2){return function(_0x237c8b){_0x1186b2[_0x46a2('0x3')](_0x3be5d8,_0x237c8b);};}function removeListener(_0x59a55c,_0x30bf8b){return function(){VoicePrefixEvents[_0x46a2('0x4')](_0x59a55c,_0x30bf8b);};}exports['register']=function(_0x22de0d){for(var _0x8b6541=0x0,_0x506698=events['length'];_0x8b6541<_0x506698;_0x8b6541++){var _0x2092f3=events[_0x8b6541];var _0x321b88=createListener('voicePrefix:'+_0x2092f3,_0x22de0d);VoicePrefixEvents['on'](_0x2092f3,_0x321b88);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 3c3a240..799a87c 100644 --- a/server/api/voiceQueue/index.js +++ b/server/api/voiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['addAgents','/:id/blacklists','addBlackLists','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','/:id','getHoppers','/:id/hopper_histories','isAuthenticated','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','post','create','/:id/clone','clone','addTeams'];(function(_0x3e38eb,_0x241a8d){var _0x3cdbd9=function(_0x5f1fc7){while(--_0x5f1fc7){_0x3e38eb['push'](_0x3e38eb['shift']());}};_0x3cdbd9(++_0x241a8d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file +var _0xb10b=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addTeams','addAgents','addLists','addBlackLists','put','/:id','update','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','path','connect-timeout'];(function(_0x4a325a,_0x2c154c){var _0x2597a1=function(_0x437af3){while(--_0x437af3){_0x4a325a['push'](_0x4a325a['shift']());}};_0x2597a1(++_0x2c154c);}(_0xb10b,0x12a));var _0xbb10=function(_0x699200,_0x39c101){_0x699200=_0x699200-0x0;var _0x266fd1=_0xb10b[_0x699200];return _0x266fd1;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getHopperFinals']);router[_0xbb10('0x9')]('/:id/hopper_black',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x9')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router['get'](_0xbb10('0x14'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x15')]);router[_0xbb10('0x9')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x9')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller['getLists']);router[_0xbb10('0x9')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x1c')]);router[_0xbb10('0x1b')](_0xbb10('0x1d'),auth[_0xbb10('0xb')](),controller['clone']);router[_0xbb10('0x1b')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x1b')](_0xbb10('0x14'),auth['isAuthenticated'](),controller[_0xbb10('0x1f')]);router[_0xbb10('0x1b')]('/:id/lists',auth['isAuthenticated'](),controller[_0xbb10('0x20')]);router[_0xbb10('0x1b')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x21')]);router[_0xbb10('0x22')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x24')]);router[_0xbb10('0x25')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xbb10('0xb')](),controller[_0xbb10('0x26')]);router[_0xbb10('0x25')]('/:id/users',auth[_0xbb10('0xb')](),controller[_0xbb10('0x27')]);router[_0xbb10('0x25')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x28')]);router[_0xbb10('0x25')]('/:id/blacklists',auth[_0xbb10('0xb')](),controller[_0xbb10('0x29')]);module[_0xbb10('0x2a')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 705a91f..b3f3519 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 _0x4dad=['periodic_announce','split','joinempty','join','leavewhenempty','BOOLEAN','wrapuptime','preview','booked','Dial\x20Method.','Max\x209999\x20channels,\x200\x20means\x20unlimited.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','tTxX','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','STRING','name','ENUM','inbound','outbound','default','ringall','fewestcalls','random','wrandom','rrordered','rrmemory','getDataValue','dialMethod','strategy','roundrobin','includes','INTEGER','yes','all','once','TEXT','setDataValue'];(function(_0x57cf94,_0x36c738){var _0x4b6df5=function(_0x40b2da){while(--_0x40b2da){_0x57cf94['push'](_0x57cf94['shift']());}};_0x4b6df5(++_0x36c738);}(_0x4dad,0xd5));var _0xd4da=function(_0xe0ad72,_0x449bdb){_0xe0ad72=_0xe0ad72-0x0;var _0x53b458=_0x4dad[_0xe0ad72];return _0x53b458;};'use strict';var Sequelize=require(_0xd4da('0x0'));module['exports']={'name':{'type':Sequelize[_0xd4da('0x1')],'allowNull':![],'unique':_0xd4da('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xd4da('0x3')](_0xd4da('0x4'),_0xd4da('0x5')),'allowNull':![],'defaultValue':_0xd4da('0x4')},'musiconhold':{'type':Sequelize['STRING'],'defaultValue':_0xd4da('0x6')},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr',_0xd4da('0x7'),'leastrecent',_0xd4da('0x8'),_0xd4da('0x9'),'rrmemory','linear',_0xd4da('0xa'),_0xd4da('0xb')),'allowNull':![],'defaultValue':_0xd4da('0x7'),'set':function(_0x4154d0){this['setDataValue']('strategy',_0x4154d0?_0x4154d0:_0xd4da('0xc'));},'get':function(){var _0x13d939=this[_0xd4da('0xd')]('type');var _0x219651=this[_0xd4da('0xd')](_0xd4da('0xe'));var _0xb03b97=this[_0xd4da('0xd')](_0xd4da('0xf'));if(_0x13d939===_0xd4da('0x5')){if(_0x219651==='preview'){return null;}if(_0x219651==='booked'&&![_0xd4da('0xc'),_0xd4da('0x10')][_0xd4da('0x11')](_0xb03b97)){this['setDataValue'](_0xd4da('0xf'),_0xd4da('0xc'));}}return _0xb03b97;}},'servicelevel':{'type':Sequelize[_0xd4da('0x12')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xd4da('0x1')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xd4da('0x12')](0xb)},'timeout':{'type':Sequelize[_0xd4da('0x12')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xd4da('0x12')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xd4da('0x1')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0xd4da('0x12')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xd4da('0x3')]('yes','no'),'defaultValue':_0xd4da('0x13')},'autopause':{'type':Sequelize[_0xd4da('0x3')]('yes','no',_0xd4da('0x14')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xd4da('0x12')](0xb)},'autopausebusy':{'type':Sequelize[_0xd4da('0x3')]('yes','no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xd4da('0x3')]('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xd4da('0x12')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xd4da('0x3')](_0xd4da('0x13'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xd4da('0x3')](_0xd4da('0x13'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0xd4da('0x13'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xd4da('0x3')](_0xd4da('0x13'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xd4da('0x1')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xd4da('0x1')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xd4da('0x12')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xd4da('0x12')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xd4da('0x3')]('yes','no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xd4da('0x3')](_0xd4da('0x13'),'no'),'defaultValue':_0xd4da('0x13')},'announce_holdtime':{'type':Sequelize[_0xd4da('0x3')](_0xd4da('0x13'),'no',_0xd4da('0x15')),'defaultValue':'no'},'announce_position':{'type':Sequelize['STRING'],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0xd4da('0x3')](_0xd4da('0x13'),'no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0xd4da('0x3')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xd4da('0x1')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xd4da('0x1')]},'queue_youarenext':{'type':Sequelize[_0xd4da('0x1')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xd4da('0x1')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0xd4da('0x1')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xd4da('0x1')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xd4da('0x1')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xd4da('0x1')],'defaultValue':null},'queue_seconds':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xd4da('0x1')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xd4da('0x1')]},'queue_quantity1':{'type':Sequelize[_0xd4da('0x1')]},'queue_quantity2':{'type':Sequelize[_0xd4da('0x1')]},'queue_periodic_announce':{'type':Sequelize['STRING']},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize[_0xd4da('0x16')],'set':function(_0x18eb13){this[_0xd4da('0x17')](_0xd4da('0x18'),_0x18eb13?_0x18eb13['join'](','):[]);},'get':function(){return this[_0xd4da('0xd')](_0xd4da('0x18'))?this[_0xd4da('0xd')]('periodic_announce')[_0xd4da('0x19')](','):[];}},'joinempty':{'type':Sequelize[_0xd4da('0x1')],'defaultValue':_0xd4da('0x13'),'set':function(_0x283527){this[_0xd4da('0x17')](_0xd4da('0x1a'),_0x283527?_0x283527[_0xd4da('0x1b')](','):undefined);},'get':function(){return this[_0xd4da('0xd')]('joinempty')?this[_0xd4da('0xd')](_0xd4da('0x1a'))[_0xd4da('0x19')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xd4da('0x1')],'defaultValue':'no','set':function(_0x424a24){this[_0xd4da('0x17')](_0xd4da('0x1c'),_0x424a24?_0x424a24[_0xd4da('0x1b')](','):undefined);},'get':function(){return this['getDataValue']('leavewhenempty')?this['getDataValue'](_0xd4da('0x1c'))[_0xd4da('0x19')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xd4da('0x3')]('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xd4da('0x3')]('yes','no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0xd4da('0x12')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xd4da('0x3')](_0xd4da('0x13'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xd4da('0x1')]},'description':{'type':Sequelize['STRING']},'acw':{'type':Sequelize[_0xd4da('0x1d')],'defaultValue':0x0,'set':function(_0x3e0c7c){this[_0xd4da('0x17')]('acw',_0x3e0c7c);if(_0x3e0c7c){if(this[_0xd4da('0xd')]('wrapuptime')<0x2){this[_0xd4da('0x17')](_0xd4da('0x1e'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0xd4da('0x12')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xd4da('0x1d')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize[_0xd4da('0x3')](_0xd4da('0x1f'),'progressive','power','predictive',_0xd4da('0x20')),'defaultValue':'progressive','comment':_0xd4da('0x21')},'dialLimitChannel':{'type':Sequelize[_0xd4da('0x12')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xd4da('0x22')},'dialLimitQueue':{'type':Sequelize[_0xd4da('0x12')](0x4)[_0xd4da('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xd4da('0x24')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0xd4da('0x23')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xd4da('0x25')},'dialPredictiveOptimization':{'type':Sequelize[_0xd4da('0x3')](_0xd4da('0x26'),_0xd4da('0x27')),'defaultValue':'dropRate','comment':_0xd4da('0x28')},'dialPredictiveOptimizationPercentage':{'type':Sequelize['FLOAT'](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xd4da('0x29')},'dialPredictiveInterval':{'type':Sequelize[_0xd4da('0x12')](0x3)[_0xd4da('0x23')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xd4da('0x2a')},'dialOriginateCallerIdName':{'type':Sequelize[_0xd4da('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0xd4da('0x12')](0x3)[_0xd4da('0x23')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueOptions':{'type':Sequelize[_0xd4da('0x1')],'defaultValue':_0xd4da('0x2b'),'comment':'https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'},'dialQueueTimeout':{'type':Sequelize[_0xd4da('0x12')](0x3)[_0xd4da('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueProject':{'type':Sequelize[_0xd4da('0x1')],'comment':_0xd4da('0x2c')},'dialCongestionMaxRetry':{'type':Sequelize[_0xd4da('0x12')](0x3)[_0xd4da('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd4da('0x2d')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xd4da('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd4da('0x2e')},'dialBusyMaxRetry':{'type':Sequelize[_0xd4da('0x12')](0x3)[_0xd4da('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd4da('0x2f')},'dialBusyRetryFrequency':{'type':Sequelize[_0xd4da('0x12')](0x5)[_0xd4da('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd4da('0x30')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xd4da('0x12')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0xd4da('0x31')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xd4da('0x12')](0x5)[_0xd4da('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd4da('0x32')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xd4da('0x23')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xd4da('0x33')},'dialTimezone':{'type':Sequelize[_0xd4da('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0xd4da('0x34')},'dialPrefix':{'type':Sequelize[_0xd4da('0x1')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xd4da('0x3')](_0xd4da('0x35'),_0xd4da('0x36'),_0xd4da('0x37')),'defaultValue':_0xd4da('0x35')},'dialAMDActive':{'type':Sequelize[_0xd4da('0x1d')],'defaultValue':0x0,'comment':_0xd4da('0x38')},'dialAMDInitialSilence':{'type':Sequelize[_0xd4da('0x12')](0x9)[_0xd4da('0x23')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xd4da('0x39')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0xd4da('0x23')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xd4da('0x12')](0x9)[_0xd4da('0x23')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xd4da('0x3a')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xd4da('0x12')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xd4da('0x3b')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xd4da('0x23')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xd4da('0x12')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xd4da('0x3c')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xd4da('0x12')](0x9)[_0xd4da('0x23')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0xd4da('0x12')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xd4da('0x3d')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xd4da('0x12')](0x9)[_0xd4da('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xd4da('0x3e')},'dialRecallMeTimeout':{'type':Sequelize[_0xd4da('0x12')](0x5)['UNSIGNED'],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xd4da('0x3f')},'dialRecallInQueue':{'type':Sequelize[_0xd4da('0x1d')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0xd4da('0x40'),'ASC'),'defaultValue':_0xd4da('0x40')},'dialQueueProject2':{'type':Sequelize[_0xd4da('0x1')],'comment':_0xd4da('0x2c')},'dialAgiAfterHangupClient':{'type':Sequelize[_0xd4da('0x1d')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xd4da('0x1d')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xd4da('0x12')](0x3)[_0xd4da('0x23')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xd4da('0x41')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xd4da('0x42')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xd4da('0x12')](0x3)[_0xd4da('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd4da('0x43')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xd4da('0x12')](0x5)[_0xd4da('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd4da('0x44')},'dialDropMaxRetry':{'type':Sequelize[_0xd4da('0x12')](0x3)[_0xd4da('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd4da('0x45')},'dialDropRetryFrequency':{'type':Sequelize[_0xd4da('0x12')](0x5)[_0xd4da('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd4da('0x46')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd4da('0x47')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xd4da('0x12')](0x5)[_0xd4da('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0xd4da('0x12')](0x3)[_0xd4da('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd4da('0x48')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xd4da('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd4da('0x49')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xd4da('0x12')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd4da('0x4a')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xd4da('0x12')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd4da('0x4b')},'mandatoryDispositionPauseId':{'type':Sequelize[_0xd4da('0x12')],'allowNull':!![],'comment':_0xd4da('0x4c')},'mandatoryDisposition':{'type':Sequelize[_0xd4da('0x1d')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0xef8b22){if(!_0xef8b22)this[_0xd4da('0x17')](_0xd4da('0x4d'),null);this[_0xd4da('0x17')](_0xd4da('0x4e'),_0xef8b22);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0xd4da('0x12')](0x3)[_0xd4da('0x23')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0xd4da('0x12')](0x3)[_0xd4da('0x23')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0xd4da('0x1d')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0xd4da('0x12')](0x3)['UNSIGNED'],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0xd4da('0x1d')],'defaultValue':![]}}; \ No newline at end of file +var _0xb0b5=['periodic_announce','join','joinempty','split','leavewhenempty','acw','wrapuptime','BOOLEAN','Active/Disactive\x20Campaign','progressive','Dial\x20Method.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','never','onlyIfOpen','always','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#RecallMe\x20Timeout\x20(min:1)','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','STRING','name','ENUM','inbound','outbound','default','ringall','leastrecent','rrmemory','wrandom','setDataValue','getDataValue','dialMethod','strategy','preview','booked','roundrobin','INTEGER','yes','all','TEXT'];(function(_0x21f743,_0x1275cc){var _0x1af27e=function(_0x42deb7){while(--_0x42deb7){_0x21f743['push'](_0x21f743['shift']());}};_0x1af27e(++_0x1275cc);}(_0xb0b5,0x170));var _0x5b0b=function(_0x322306,_0x31fc80){_0x322306=_0x322306-0x0;var _0x4f9152=_0xb0b5[_0x322306];return _0x4f9152;};'use strict';var Sequelize=require(_0x5b0b('0x0'));module['exports']={'name':{'type':Sequelize[_0x5b0b('0x1')],'allowNull':![],'unique':_0x5b0b('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x5b0b('0x3')](_0x5b0b('0x4'),_0x5b0b('0x5')),'allowNull':![],'defaultValue':_0x5b0b('0x4')},'musiconhold':{'type':Sequelize[_0x5b0b('0x1')],'defaultValue':_0x5b0b('0x6')},'announce':{'type':Sequelize[_0x5b0b('0x1')],'defaultValue':''},'strategy':{'type':Sequelize[_0x5b0b('0x3')]('rr',_0x5b0b('0x7'),_0x5b0b('0x8'),'fewestcalls','random',_0x5b0b('0x9'),'linear',_0x5b0b('0xa'),'rrordered'),'allowNull':![],'defaultValue':_0x5b0b('0x7'),'set':function(_0x430465){this[_0x5b0b('0xb')]('strategy',_0x430465?_0x430465:'rrmemory');},'get':function(){var _0x5a2602=this['getDataValue']('type');var _0x1d3a88=this[_0x5b0b('0xc')](_0x5b0b('0xd'));var _0x218932=this[_0x5b0b('0xc')](_0x5b0b('0xe'));if(_0x5a2602===_0x5b0b('0x5')){if(_0x1d3a88===_0x5b0b('0xf')){return null;}if(_0x1d3a88===_0x5b0b('0x10')&&![_0x5b0b('0x9'),_0x5b0b('0x11')]['includes'](_0x218932)){this[_0x5b0b('0xb')](_0x5b0b('0xe'),'rrmemory');}}return _0x218932;}},'servicelevel':{'type':Sequelize[_0x5b0b('0x12')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x5b0b('0x1')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x5b0b('0x12')](0xb)},'timeout':{'type':Sequelize[_0x5b0b('0x12')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x5b0b('0x1')]},'weight':{'type':Sequelize[_0x5b0b('0x12')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x5b0b('0x12')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize['ENUM'](_0x5b0b('0x13'),'no'),'defaultValue':_0x5b0b('0x13')},'autopause':{'type':Sequelize['ENUM'](_0x5b0b('0x13'),'no',_0x5b0b('0x14')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x5b0b('0x12')](0xb)},'autopausebusy':{'type':Sequelize[_0x5b0b('0x3')](_0x5b0b('0x13'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x5b0b('0x12')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x5b0b('0x3')](_0x5b0b('0x13'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x5b0b('0x3')](_0x5b0b('0x13'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x5b0b('0x3')](_0x5b0b('0x13'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x5b0b('0x1')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x5b0b('0x1')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x5b0b('0x12')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x5b0b('0x12')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x5b0b('0x12')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x5b0b('0x3')](_0x5b0b('0x13'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x5b0b('0x3')](_0x5b0b('0x13'),'no'),'defaultValue':_0x5b0b('0x13')},'announce_holdtime':{'type':Sequelize[_0x5b0b('0x3')](_0x5b0b('0x13'),'no','once'),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x5b0b('0x1')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x5b0b('0x3')](_0x5b0b('0x13'),'no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize['ENUM']('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x5b0b('0x1')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x5b0b('0x1')]},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x5b0b('0x1')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x5b0b('0x1')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x5b0b('0x1')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x5b0b('0x1')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x5b0b('0x1')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x5b0b('0x1')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x5b0b('0x1')]},'queue_quantity1':{'type':Sequelize[_0x5b0b('0x1')]},'queue_quantity2':{'type':Sequelize[_0x5b0b('0x1')]},'queue_periodic_announce':{'type':Sequelize['STRING']},'queue_less_than':{'type':Sequelize[_0x5b0b('0x1')]},'periodic_announce':{'type':Sequelize[_0x5b0b('0x15')],'set':function(_0xed1cf0){this[_0x5b0b('0xb')](_0x5b0b('0x16'),_0xed1cf0?_0xed1cf0[_0x5b0b('0x17')](','):[]);},'get':function(){return this[_0x5b0b('0xc')](_0x5b0b('0x16'))?this[_0x5b0b('0xc')](_0x5b0b('0x16'))['split'](','):[];}},'joinempty':{'type':Sequelize[_0x5b0b('0x1')],'defaultValue':_0x5b0b('0x13'),'set':function(_0x30f031){this[_0x5b0b('0xb')]('joinempty',_0x30f031?_0x30f031[_0x5b0b('0x17')](','):undefined);},'get':function(){return this['getDataValue'](_0x5b0b('0x18'))?this['getDataValue'](_0x5b0b('0x18'))[_0x5b0b('0x19')](','):undefined;}},'leavewhenempty':{'type':Sequelize['STRING'],'defaultValue':'no','set':function(_0x47e932){this['setDataValue'](_0x5b0b('0x1a'),_0x47e932?_0x47e932[_0x5b0b('0x17')](','):undefined);},'get':function(){return this['getDataValue'](_0x5b0b('0x1a'))?this[_0x5b0b('0xc')](_0x5b0b('0x1a'))['split'](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x5b0b('0x3')](_0x5b0b('0x13'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0x5b0b('0x13'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x5b0b('0x12')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x5b0b('0x1')]},'description':{'type':Sequelize[_0x5b0b('0x1')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x37908b){this[_0x5b0b('0xb')](_0x5b0b('0x1b'),_0x37908b);if(_0x37908b){if(this[_0x5b0b('0xc')](_0x5b0b('0x1c'))<0x2){this[_0x5b0b('0xb')]('wrapuptime',0x2);}}}},'acwTimeout':{'type':Sequelize[_0x5b0b('0x12')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x5b0b('0x1d')],'defaultValue':0x0,'comment':_0x5b0b('0x1e')},'dialMethod':{'type':Sequelize[_0x5b0b('0x3')](_0x5b0b('0xf'),'progressive','power','predictive',_0x5b0b('0x10')),'defaultValue':_0x5b0b('0x1f'),'comment':_0x5b0b('0x20')},'dialLimitChannel':{'type':Sequelize[_0x5b0b('0x12')](0x4)[_0x5b0b('0x21')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize[_0x5b0b('0x12')](0x4)[_0x5b0b('0x21')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x5b0b('0x22')},'dialPowerLevel':{'type':Sequelize[_0x5b0b('0x23')](0x2)[_0x5b0b('0x21')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':'Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).'},'dialPredictiveOptimization':{'type':Sequelize[_0x5b0b('0x3')](_0x5b0b('0x24'),_0x5b0b('0x25')),'defaultValue':_0x5b0b('0x25'),'comment':_0x5b0b('0x26')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x5b0b('0x23')](0x2)[_0x5b0b('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x5b0b('0x27')},'dialPredictiveInterval':{'type':Sequelize[_0x5b0b('0x12')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x5b0b('0x28')},'dialOriginateCallerIdName':{'type':Sequelize[_0x5b0b('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x5b0b('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0x5b0b('0x12')](0x3)[_0x5b0b('0x21')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5b0b('0x29')},'dialQueueOptions':{'type':Sequelize[_0x5b0b('0x1')],'defaultValue':_0x5b0b('0x2a'),'comment':_0x5b0b('0x2b')},'dialQueueTimeout':{'type':Sequelize[_0x5b0b('0x12')](0x3)[_0x5b0b('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueProject':{'type':Sequelize[_0x5b0b('0x1')],'comment':_0x5b0b('0x2c')},'dialCongestionMaxRetry':{'type':Sequelize[_0x5b0b('0x12')](0x3)[_0x5b0b('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5b0b('0x2d')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x5b0b('0x12')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5b0b('0x2e')},'dialBusyMaxRetry':{'type':Sequelize[_0x5b0b('0x12')](0x3)[_0x5b0b('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x5b0b('0x12')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x5b0b('0x12')](0x3)[_0x5b0b('0x21')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x5b0b('0x12')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5b0b('0x2f')},'dialGlobalMaxRetry':{'type':Sequelize[_0x5b0b('0x12')](0x3)[_0x5b0b('0x21')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x5b0b('0x30')},'dialTimezone':{'type':Sequelize[_0x5b0b('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0x5b0b('0x31')},'dialPrefix':{'type':Sequelize[_0x5b0b('0x1')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x5b0b('0x3')]('always',_0x5b0b('0x32'),_0x5b0b('0x33')),'defaultValue':_0x5b0b('0x34')},'dialAMDActive':{'type':Sequelize[_0x5b0b('0x1d')],'defaultValue':0x0,'comment':_0x5b0b('0x35')},'dialAMDInitialSilence':{'type':Sequelize[_0x5b0b('0x12')](0x9)[_0x5b0b('0x21')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x5b0b('0x36')},'dialAMDGreeting':{'type':Sequelize[_0x5b0b('0x12')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0x5b0b('0x21')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x5b0b('0x12')](0x9)[_0x5b0b('0x21')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x5b0b('0x37')},'dialAMDMinWordLength':{'type':Sequelize[_0x5b0b('0x12')](0x9)[_0x5b0b('0x21')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x5b0b('0x38')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x5b0b('0x12')](0x9)[_0x5b0b('0x21')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x5b0b('0x39')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x5b0b('0x12')](0x9)[_0x5b0b('0x21')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x5b0b('0x3a')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x5b0b('0x12')](0x5)[_0x5b0b('0x21')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x5b0b('0x3b')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x5b0b('0x12')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize['INTEGER'](0x5)[_0x5b0b('0x21')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x5b0b('0x3c')},'dialRecallInQueue':{'type':Sequelize[_0x5b0b('0x1d')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize[_0x5b0b('0x3')]('DESC',_0x5b0b('0x3d')),'defaultValue':_0x5b0b('0x3e')},'dialQueueProject2':{'type':Sequelize[_0x5b0b('0x1')],'comment':_0x5b0b('0x2c')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x5b0b('0x1d')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x5b0b('0x1d')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x5b0b('0x12')](0x3)[_0x5b0b('0x21')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x5b0b('0x3f')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x5b0b('0x21')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x5b0b('0x40')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x5b0b('0x12')](0x3)[_0x5b0b('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5b0b('0x41')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5b0b('0x42')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5b0b('0x43')},'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[_0x5b0b('0x12')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5b0b('0x44')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x5b0b('0x12')](0x5)[_0x5b0b('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5b0b('0x45')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x5b0b('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5b0b('0x46')},'dialMachineRetryFrequency':{'type':Sequelize[_0x5b0b('0x12')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5b0b('0x47')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x5b0b('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5b0b('0x48')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x5b0b('0x12')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5b0b('0x49')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x5b0b('0x12')],'allowNull':!![],'comment':_0x5b0b('0x4a')},'mandatoryDisposition':{'type':Sequelize[_0x5b0b('0x1d')],'defaultValue':![],'comment':_0x5b0b('0x4b'),'set':function(_0x45d4fe){if(!_0x45d4fe)this[_0x5b0b('0xb')](_0x5b0b('0x4c'),null);this[_0x5b0b('0xb')](_0x5b0b('0x4d'),_0x45d4fe);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x5b0b('0x12')](0x3)[_0x5b0b('0x21')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x5b0b('0x21')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x5b0b('0x1d')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x5b0b('0x12')](0x3)[_0x5b0b('0x21')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 691b246..b16afe3 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 _0x008c=['deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','cm_hopper','onlyIfOpen','into','fromQuery','COALESCE(phone,\x27\x27)','all','cm_hopper_additional_phones','CmHopperId','OrderBy','h.id','ci.item','ci.OrderBy+1','cm_contact_has_items','join','h.ContactId=ci.CmContactId','h.scheduledat=?','ci.ItemClass=?','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','moment','bluebird','util','lodash','squel','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','register','sendStatus','json','offset','undefined','count','set','Content-Range','then','inbound','map','value','includes','type','UserProfileResource','destroy','status','send','index','VoiceQueue','rawAttributes','key','getOptions','where','include','query','findAll','rows','catch','show','params','keys','filters','model','intersection','fields','attributes','includeAll','merge','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','VoiceQueues','QueueCampaigns','outbound','name','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','body','createdAt','updatedAt','autoAssociation','getHoppers','findOne','CmHopper','length','hasOwnProperty','nolimit','limit','sort','pick','VoiceQueueId','filter','getHopperHistories','CmHopperHistory','order','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','Team','getTeams','addTeams','teams','Agents','online','voicePause','flatMap','forEach','penalty','sequelize','transaction','each','TeamVoiceQueue','UserVoiceQueue','findOrCreate','upsert','isNil','interface','format','SIP/%s','userVoiceQueue:save','removeTeams','ids','User','select','tq.TeamId','from','team_has_voice_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','TeamId','union','compact','removeAgents','userVoiceQueue:remove','addAgents','spread','emit','isEmpty','UserVoiceQueueRt','isArray','getAgents','getMembers','getLists','CmList','addLists','YYYY-MM-DD\x20HH:mm:ss','dialCheckDuplicateType','insert','phone','scheduledAt','ContactId','ListId','field','CmListId','toString','cm_contacts'];(function(_0x1169d6,_0x2c3f98){var _0x1cbd2c=function(_0xf6639c){while(--_0xf6639c){_0x1169d6['push'](_0x1169d6['shift']());}};_0x1cbd2c(++_0x2c3f98);}(_0x008c,0x188));var _0xc008=function(_0x489b87,_0xd51c93){_0x489b87=_0x489b87-0x0;var _0x1823b6=_0x008c[_0x489b87];return _0x1823b6;};'use strict';var moment=require(_0xc008('0x0'));var BPromise=require(_0xc008('0x1'));var util=require(_0xc008('0x2'));var _=require(_0xc008('0x3'));var squel=require(_0xc008('0x4'));var Redis=require('ioredis');var qs=require(_0xc008('0x5'));var logger=require(_0xc008('0x6'))(_0xc008('0x7'));var config=require(_0xc008('0x8'));var db=require(_0xc008('0x9'))['db'];config[_0xc008('0xa')]=_[_0xc008('0xb')](config[_0xc008('0xa')],{'host':_0xc008('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc008('0xa')]));require('./voiceQueue.socket')[_0xc008('0xd')](socket);function respondWithStatusCode(_0x5b64f8,_0x52041f){_0x52041f=_0x52041f||0xcc;return function(_0x27830d){if(_0x27830d){return _0x5b64f8[_0xc008('0xe')](_0x52041f);}return _0x5b64f8['status'](_0x52041f)['end']();};}function respondWithResult(_0x543eb8,_0x1eacfa){_0x1eacfa=_0x1eacfa||0xc8;return function(_0xc881aa){if(_0xc881aa){return _0x543eb8['status'](_0x1eacfa)[_0xc008('0xf')](_0xc881aa);}};}function respondWithFilteredResult(_0x332fd4,_0x2ea200){return function(_0x2a5b4e){if(_0x2a5b4e){var _0x9ffa93=typeof _0x2ea200[_0xc008('0x10')]===_0xc008('0x11')&&typeof _0x2ea200['limit']==='undefined';var _0x33f44c=_0x2a5b4e['count'];var _0x25e13f=_0x9ffa93?0x0:_0x2ea200[_0xc008('0x10')];var _0x2073ef=_0x9ffa93?_0x2a5b4e[_0xc008('0x12')]:_0x2ea200[_0xc008('0x10')]+_0x2ea200['limit'];var _0x5e894e;if(_0x2073ef>=_0x33f44c){_0x2073ef=_0x33f44c;_0x5e894e=0xc8;}else{_0x5e894e=0xce;}_0x332fd4['status'](_0x5e894e);return _0x332fd4[_0xc008('0x13')](_0xc008('0x14'),_0x25e13f+'-'+_0x2073ef+'/'+_0x33f44c)[_0xc008('0xf')](_0x2a5b4e);}return null;};}function saveUpdates(_0x3eb12a){return function(_0x4fe771){if(_0x4fe771){return _0x4fe771['update'](_0x3eb12a)['then'](function(_0x5c2668){return _0x5c2668;});}return null;};}function removeEntity(_0x46042b){return function(_0x462af5){if(_0x462af5){return _0x462af5['destroy']()[_0xc008('0x15')](function(){var _0x5906e6=_0x462af5['get']({'plain':!![]});var _0x543e5d=[{'name':'VoiceQueues','value':_0xc008('0x16'),'ignore':![]},{'name':'QueueCampaigns','value':'outbound','ignore':![]}];var _0x590a71=_(_0x543e5d)['filter']('ignore')[_0xc008('0x17')](_0xc008('0x18'))[_0xc008('0x18')]();if(_[_0xc008('0x19')](_0x590a71,_0x5906e6[_0xc008('0x1a')])){return;}var _0x110128=_['find'](_0x543e5d,[_0xc008('0x18'),_0x5906e6['type']])['name'];return db[_0xc008('0x1b')][_0xc008('0x1c')]({'where':{'type':_0x110128,'resourceId':_0x5906e6['id']}})[_0xc008('0x15')](function(){return _0x462af5;});})[_0xc008('0x15')](function(){_0x46042b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5de1e9){return function(_0x3f7b07){if(!_0x3f7b07){_0x5de1e9[_0xc008('0xe')](0x194);}return _0x3f7b07;};}function handleError(_0x92c582,_0x2e31c2){_0x2e31c2=_0x2e31c2||0x1f4;return function(_0x5bebd9){logger['error'](_0x5bebd9['stack']);if(_0x5bebd9['name']){delete _0x5bebd9['name'];}_0x92c582[_0xc008('0x1d')](_0x2e31c2)[_0xc008('0x1e')](_0x5bebd9);};}exports[_0xc008('0x1f')]=function(_0x529961,_0x24c14c){var _0x32390d={};var _0x209591={'count':0x0,'rows':[]};var _0x2a7d4f=_['map'](db[_0xc008('0x20')][_0xc008('0x21')],function(_0x53ed35){return{'name':_0x53ed35['fieldName'],'type':_0x53ed35['type'][_0xc008('0x22')]};});_0x32390d=qs[_0xc008('0x23')](_0x2a7d4f,_0x529961);var _0xf831f2={'where':_0x32390d[_0xc008('0x24')]};return db[_0xc008('0x20')][_0xc008('0x12')](_0xf831f2)[_0xc008('0x15')](function(_0x22d8e8){_0x209591[_0xc008('0x12')]=_0x22d8e8;_0x32390d[_0xc008('0x25')]=qs[_0xc008('0x25')](_0x529961[_0xc008('0x26')]);return db['VoiceQueue'][_0xc008('0x27')](_0x32390d);})[_0xc008('0x15')](function(_0x499754){_0x209591[_0xc008('0x28')]=_0x499754;return _0x209591;})[_0xc008('0x15')](respondWithFilteredResult(_0x24c14c,_0x32390d))[_0xc008('0x29')](handleError(_0x24c14c,null));};exports[_0xc008('0x2a')]=function(_0xd0e05a,_0x3cd878){var _0x7cfbc5={'raw':![],'where':{'id':_0xd0e05a[_0xc008('0x2b')]['id']}},_0x470e79={};_0x470e79['model']=_[_0xc008('0x2c')](db[_0xc008('0x20')][_0xc008('0x21')]);_0x470e79[_0xc008('0x26')]=_[_0xc008('0x2c')](_0xd0e05a[_0xc008('0x26')]);_0x470e79[_0xc008('0x2d')]=_['intersection'](_0x470e79[_0xc008('0x2e')],_0x470e79[_0xc008('0x26')]);_0x7cfbc5['attributes']=_[_0xc008('0x2f')](_0x470e79[_0xc008('0x2e')],qs['fields'](_0xd0e05a[_0xc008('0x26')][_0xc008('0x30')]));_0x7cfbc5[_0xc008('0x31')]=_0x7cfbc5['attributes']['length']?_0x7cfbc5['attributes']:_0x470e79[_0xc008('0x2e')];if(_0xd0e05a['query'][_0xc008('0x32')]){_0x7cfbc5[_0xc008('0x25')]=[{'all':!![]}];}_0x7cfbc5=_[_0xc008('0x33')]({},_0x7cfbc5,_0xd0e05a[_0xc008('0x34')]);return db[_0xc008('0x20')][_0xc008('0x35')](_0x7cfbc5)[_0xc008('0x15')](handleEntityNotFound(_0x3cd878,null))[_0xc008('0x15')](respondWithResult(_0x3cd878,null))[_0xc008('0x29')](handleError(_0x3cd878,null));};exports[_0xc008('0x36')]=function(_0x3ebb83,_0xdfca2e){return db[_0xc008('0x20')][_0xc008('0x36')](_0x3ebb83['body'],{})[_0xc008('0x15')](function(_0x23c4db){var _0x30b7df=_0x3ebb83[_0xc008('0x37')]['get']({'plain':!![]});if(!_0x30b7df)throw new Error(_0xc008('0x38'));if(_0x30b7df[_0xc008('0x39')]===_0xc008('0x37')){var _0x36e7ae=_0x23c4db[_0xc008('0x3a')]({'plain':!![]});var _0x5706bb=[{'name':_0xc008('0x3b'),'value':_0xc008('0x16')},{'name':_0xc008('0x3c'),'value':_0xc008('0x3d')}];var _0x7279e8=_['find'](_0x5706bb,[_0xc008('0x18'),_0x36e7ae[_0xc008('0x1a')]])[_0xc008('0x3e')];return db[_0xc008('0x3f')]['find']({'where':{'name':_0x7279e8,'userProfileId':_0x30b7df[_0xc008('0x40')]},'raw':!![]})[_0xc008('0x15')](function(_0x351d5c){if(_0x351d5c&&_0x351d5c['autoAssociation']===0x0){return db[_0xc008('0x1b')]['create']({'name':_0x36e7ae[_0xc008('0x3e')],'resourceId':_0x36e7ae['id'],'type':_0x351d5c['name'],'sectionId':_0x351d5c['id']},{})[_0xc008('0x15')](function(){return _0x23c4db;});}else{return _0x23c4db;}})[_0xc008('0x29')](function(_0x5a5d85){logger[_0xc008('0x41')](_0xc008('0x42'),_0x5a5d85);throw _0x5a5d85;});}return _0x23c4db;})[_0xc008('0x15')](respondWithResult(_0xdfca2e,0xc9))['catch'](handleError(_0xdfca2e,null));};exports[_0xc008('0x43')]=function(_0x2a9b5c,_0x200469){var _0x44fc5d={'where':{'id':_0x2a9b5c[_0xc008('0x2b')]['id']}},_0x347629={};_0x347629['model']=_['keys'](db['VoiceQueue'][_0xc008('0x21')]);_0x44fc5d[_0xc008('0x31')]=_[_0xc008('0x2f')](_0x347629[_0xc008('0x2e')],qs[_0xc008('0x30')](_0x2a9b5c[_0xc008('0x26')][_0xc008('0x30')]));_0x44fc5d[_0xc008('0x31')]=_0x44fc5d['attributes']['length']?_0x44fc5d['attributes']:_0x347629[_0xc008('0x2e')];if(_0x2a9b5c[_0xc008('0x26')][_0xc008('0x32')]){_0x44fc5d['include']=[{'all':!![]}];}_0x44fc5d=_[_0xc008('0x33')]({},_0x44fc5d,_0x2a9b5c[_0xc008('0x34')]);return db[_0xc008('0x20')][_0xc008('0x35')](_0x44fc5d)[_0xc008('0x15')](handleEntityNotFound(_0x200469,null))[_0xc008('0x15')](function(_0x17ec90){if(_0x17ec90){var _0x405e87=_0x17ec90[_0xc008('0x3a')]({'plain':!![]});_0x405e87=qs[_0xc008('0x44')](_0x405e87,['id','createdAt','updatedAt']);_0x2a9b5c[_0xc008('0x45')]=_['omit'](_0x2a9b5c[_0xc008('0x45')],['id',_0xc008('0x46'),_0xc008('0x47')]);return db['VoiceQueue'][_0xc008('0x36')](_[_0xc008('0x33')](_0x405e87,_0x2a9b5c[_0xc008('0x45')]),{'include':_0x2a9b5c[_0xc008('0x26')][_0xc008('0x32')]?[{'all':!![]}]:undefined})['then'](function(_0x3a7b3b){var _0x27b022=_0x2a9b5c['user'][_0xc008('0x3a')]({'plain':!![]});if(!_0x27b022)throw new Error(_0xc008('0x38'));if(_0x27b022['role']==='user'){var _0x2df905=_0x3a7b3b[_0xc008('0x3a')]({'plain':!![]});var _0x20947b=[{'name':_0xc008('0x3b'),'value':_0xc008('0x16')},{'name':'QueueCampaigns','value':'outbound'}];var _0x34b72a=_['find'](_0x20947b,[_0xc008('0x18'),_0x2df905[_0xc008('0x1a')]])[_0xc008('0x3e')];return db[_0xc008('0x3f')][_0xc008('0x35')]({'where':{'name':_0x34b72a,'userProfileId':_0x27b022[_0xc008('0x40')]},'raw':!![]})['then'](function(_0x2ea742){if(_0x2ea742&&_0x2ea742[_0xc008('0x48')]===0x0){return db[_0xc008('0x1b')][_0xc008('0x36')]({'name':_0x2df905[_0xc008('0x3e')],'resourceId':_0x2df905['id'],'type':_0x2ea742['name'],'sectionId':_0x2ea742['id']},{})[_0xc008('0x15')](function(){return _0x3a7b3b;});}else{return _0x3a7b3b;}})['catch'](function(_0x535e6e){logger['error'](_0xc008('0x42'),_0x535e6e);throw _0x535e6e;});}return _0x3a7b3b;});}})[_0xc008('0x15')](respondWithResult(_0x200469,0xc9))[_0xc008('0x29')](handleError(_0x200469,null));};exports['update']=function(_0x3aeeab,_0x2d8361){if(_0x3aeeab[_0xc008('0x45')]['id']){delete _0x3aeeab['body']['id'];}return db[_0xc008('0x20')][_0xc008('0x35')]({'where':{'id':_0x3aeeab[_0xc008('0x2b')]['id']}})[_0xc008('0x15')](handleEntityNotFound(_0x2d8361,null))['then'](saveUpdates(_0x3aeeab[_0xc008('0x45')],null))['then'](respondWithResult(_0x2d8361,null))[_0xc008('0x29')](handleError(_0x2d8361,null));};exports[_0xc008('0x1c')]=function(_0x2ae14e,_0x943c91){return db[_0xc008('0x20')][_0xc008('0x35')]({'where':{'id':_0x2ae14e['params']['id']}})[_0xc008('0x15')](handleEntityNotFound(_0x943c91,null))['then'](removeEntity(_0x943c91,null))['catch'](handleError(_0x943c91,null));};exports[_0xc008('0x49')]=function(_0x30aa1e,_0x56e755){var _0xb1befa={'raw':![],'where':{}};var _0xb8ba7={};var _0x3e373e={'count':0x0,'rows':[]};return db[_0xc008('0x20')][_0xc008('0x4a')]({'where':{'id':_0x30aa1e[_0xc008('0x2b')]['id']}})[_0xc008('0x15')](handleEntityNotFound(_0x56e755,null))['then'](function(_0x16e052){if(_0x16e052){_0xb8ba7[_0xc008('0x2e')]=_[_0xc008('0x2c')](db[_0xc008('0x4b')][_0xc008('0x21')]);_0xb8ba7[_0xc008('0x26')]=_[_0xc008('0x2c')](_0x30aa1e[_0xc008('0x26')]);_0xb8ba7[_0xc008('0x2d')]=_[_0xc008('0x2f')](_0xb8ba7[_0xc008('0x2e')],_0xb8ba7[_0xc008('0x26')]);_0xb1befa[_0xc008('0x31')]=_[_0xc008('0x2f')](_0xb8ba7['model'],qs[_0xc008('0x30')](_0x30aa1e[_0xc008('0x26')][_0xc008('0x30')]));_0xb1befa['attributes']=_0xb1befa[_0xc008('0x31')][_0xc008('0x4c')]?_0xb1befa['attributes']:_0xb8ba7['model'];if(!_0x30aa1e[_0xc008('0x26')][_0xc008('0x4d')](_0xc008('0x4e'))){_0xb1befa[_0xc008('0x4f')]=qs[_0xc008('0x4f')](_0x30aa1e[_0xc008('0x26')][_0xc008('0x4f')]);_0xb1befa[_0xc008('0x10')]=qs[_0xc008('0x10')](_0x30aa1e[_0xc008('0x26')][_0xc008('0x10')]);}_0xb1befa['order']=qs[_0xc008('0x50')](_0x30aa1e[_0xc008('0x26')][_0xc008('0x50')]);_0xb1befa[_0xc008('0x24')]=qs['filters'](_[_0xc008('0x51')](_0x30aa1e['query'],_0xb8ba7[_0xc008('0x2d')]));_0xb1befa[_0xc008('0x24')][_0xc008('0x52')]=_0x16e052['id'];if(_0x30aa1e['query'][_0xc008('0x53')]){_0xb1befa[_0xc008('0x24')]=_[_0xc008('0x33')](_0xb1befa['where'],{'$or':_[_0xc008('0x17')](_0xb1befa['attributes'],function(_0x50ee03){var _0xee7a85={};_0xee7a85[_0x50ee03]={'$like':'%'+_0x30aa1e[_0xc008('0x26')][_0xc008('0x53')]+'%'};return _0xee7a85;})});}_0xb1befa=_[_0xc008('0x33')]({},_0xb1befa,_0x30aa1e['options']);return db[_0xc008('0x4b')][_0xc008('0x12')]({'where':_0xb1befa['where']})[_0xc008('0x15')](function(_0x5233bb){_0x3e373e[_0xc008('0x12')]=_0x5233bb;if(_0x30aa1e['query'][_0xc008('0x32')]){_0xb1befa['include']=[{'all':!![]}];}return db[_0xc008('0x4b')][_0xc008('0x27')](_0xb1befa);})[_0xc008('0x15')](function(_0x47337b){_0x3e373e['rows']=_0x47337b;return _0x3e373e;});}})[_0xc008('0x15')](respondWithFilteredResult(_0x56e755,_0xb1befa))[_0xc008('0x29')](handleError(_0x56e755,null));};exports[_0xc008('0x54')]=function(_0x1d49db,_0x321500){var _0x13ef78={'raw':!![],'where':{}};var _0xd9e3fd={};var _0x3b46e4={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xc008('0x4a')]({'where':{'id':_0x1d49db['params']['id']}})['then'](handleEntityNotFound(_0x321500,null))['then'](function(_0x406ead){if(_0x406ead){_0xd9e3fd[_0xc008('0x2e')]=_[_0xc008('0x2c')](db[_0xc008('0x55')][_0xc008('0x21')]);_0xd9e3fd[_0xc008('0x26')]=_[_0xc008('0x2c')](_0x1d49db[_0xc008('0x26')]);_0xd9e3fd[_0xc008('0x2d')]=_['intersection'](_0xd9e3fd[_0xc008('0x2e')],_0xd9e3fd[_0xc008('0x26')]);_0x13ef78[_0xc008('0x31')]=_[_0xc008('0x2f')](_0xd9e3fd[_0xc008('0x2e')],qs[_0xc008('0x30')](_0x1d49db[_0xc008('0x26')][_0xc008('0x30')]));_0x13ef78[_0xc008('0x31')]=_0x13ef78[_0xc008('0x31')][_0xc008('0x4c')]?_0x13ef78[_0xc008('0x31')]:_0xd9e3fd['model'];if(!_0x1d49db['query'][_0xc008('0x4d')](_0xc008('0x4e'))){_0x13ef78[_0xc008('0x4f')]=qs['limit'](_0x1d49db[_0xc008('0x26')][_0xc008('0x4f')]);_0x13ef78['offset']=qs['offset'](_0x1d49db['query'][_0xc008('0x10')]);}_0x13ef78[_0xc008('0x56')]=qs[_0xc008('0x50')](_0x1d49db[_0xc008('0x26')][_0xc008('0x50')]);_0x13ef78[_0xc008('0x24')]=qs[_0xc008('0x2d')](_[_0xc008('0x51')](_0x1d49db[_0xc008('0x26')],_0xd9e3fd[_0xc008('0x2d')]));_0x13ef78['where']['VoiceQueueId']=_0x406ead['id'];if(_0x1d49db[_0xc008('0x26')][_0xc008('0x53')]){_0x13ef78[_0xc008('0x24')]=_[_0xc008('0x33')](_0x13ef78[_0xc008('0x24')],{'$or':_[_0xc008('0x17')](_0x13ef78['attributes'],function(_0x5794fe){var _0x68372f={};_0x68372f[_0x5794fe]={'$like':'%'+_0x1d49db[_0xc008('0x26')][_0xc008('0x53')]+'%'};return _0x68372f;})});}_0x13ef78=_['merge']({},_0x13ef78,_0x1d49db['options']);return db['CmHopperHistory']['count']({'where':_0x13ef78['where']})['then'](function(_0x276de2){_0x3b46e4['count']=_0x276de2;if(_0x1d49db[_0xc008('0x26')]['includeAll']){_0x13ef78[_0xc008('0x25')]=[{'all':!![]}];}return db[_0xc008('0x55')][_0xc008('0x27')](_0x13ef78);})['then'](function(_0x58f348){_0x3b46e4[_0xc008('0x28')]=_0x58f348;return _0x3b46e4;});}})['then'](respondWithFilteredResult(_0x321500,_0x13ef78))[_0xc008('0x29')](handleError(_0x321500,null));};exports[_0xc008('0x57')]=function(_0x544519,_0x7b7246){var _0x4db90b={'raw':!![],'where':{}};var _0x554cf4={};var _0x23bece={'count':0x0,'rows':[]};return db[_0xc008('0x20')]['findOne']({'where':{'id':_0x544519[_0xc008('0x2b')]['id']}})[_0xc008('0x15')](handleEntityNotFound(_0x7b7246,null))[_0xc008('0x15')](function(_0x4bd290){if(_0x4bd290){_0x554cf4[_0xc008('0x2e')]=_[_0xc008('0x2c')](db[_0xc008('0x58')][_0xc008('0x21')]);_0x554cf4[_0xc008('0x26')]=_[_0xc008('0x2c')](_0x544519['query']);_0x554cf4[_0xc008('0x2d')]=_[_0xc008('0x2f')](_0x554cf4[_0xc008('0x2e')],_0x554cf4['query']);_0x4db90b[_0xc008('0x31')]=_[_0xc008('0x2f')](_0x554cf4[_0xc008('0x2e')],qs['fields'](_0x544519['query']['fields']));_0x4db90b[_0xc008('0x31')]=_0x4db90b[_0xc008('0x31')][_0xc008('0x4c')]?_0x4db90b[_0xc008('0x31')]:_0x554cf4[_0xc008('0x2e')];if(!_0x544519[_0xc008('0x26')][_0xc008('0x4d')](_0xc008('0x4e'))){_0x4db90b['limit']=qs[_0xc008('0x4f')](_0x544519[_0xc008('0x26')]['limit']);_0x4db90b['offset']=qs[_0xc008('0x10')](_0x544519[_0xc008('0x26')][_0xc008('0x10')]);}_0x4db90b[_0xc008('0x56')]=qs[_0xc008('0x50')](_0x544519['query'][_0xc008('0x50')]);_0x4db90b[_0xc008('0x24')]=qs['filters'](_[_0xc008('0x51')](_0x544519[_0xc008('0x26')],_0x554cf4[_0xc008('0x2d')]));_0x4db90b[_0xc008('0x24')]['VoiceQueueId']=_0x4bd290['id'];if(_0x544519[_0xc008('0x26')][_0xc008('0x53')]){_0x4db90b[_0xc008('0x24')]=_[_0xc008('0x33')](_0x4db90b['where'],{'$or':_[_0xc008('0x17')](_0x4db90b[_0xc008('0x31')],function(_0x57cf19){var _0x555e8a={};_0x555e8a[_0x57cf19]={'$like':'%'+_0x544519[_0xc008('0x26')]['filter']+'%'};return _0x555e8a;})});}_0x4db90b=_[_0xc008('0x33')]({},_0x4db90b,_0x544519[_0xc008('0x34')]);return db['CmHopperFinal'][_0xc008('0x12')]({'where':_0x4db90b[_0xc008('0x24')]})[_0xc008('0x15')](function(_0xbe42a2){_0x23bece[_0xc008('0x12')]=_0xbe42a2;if(_0x544519[_0xc008('0x26')][_0xc008('0x32')]){_0x4db90b[_0xc008('0x25')]=[{'all':!![]}];}return db[_0xc008('0x58')][_0xc008('0x27')](_0x4db90b);})['then'](function(_0x49e6d5){_0x23bece[_0xc008('0x28')]=_0x49e6d5;return _0x23bece;});}})[_0xc008('0x15')](respondWithFilteredResult(_0x7b7246,_0x4db90b))['catch'](handleError(_0x7b7246,null));};exports[_0xc008('0x59')]=function(_0x1bdaa9,_0x698d5c){var _0x5f1e48={'raw':!![],'where':{}};var _0x303cdd={};var _0x38239a={'count':0x0,'rows':[]};return db[_0xc008('0x20')][_0xc008('0x4a')]({'where':{'id':_0x1bdaa9[_0xc008('0x2b')]['id']}})[_0xc008('0x15')](handleEntityNotFound(_0x698d5c,null))[_0xc008('0x15')](function(_0x5bd010){if(_0x5bd010){_0x303cdd[_0xc008('0x2e')]=_['keys'](db[_0xc008('0x5a')][_0xc008('0x21')]);_0x303cdd[_0xc008('0x26')]=_['keys'](_0x1bdaa9[_0xc008('0x26')]);_0x303cdd[_0xc008('0x2d')]=_[_0xc008('0x2f')](_0x303cdd[_0xc008('0x2e')],_0x303cdd[_0xc008('0x26')]);_0x5f1e48[_0xc008('0x31')]=_[_0xc008('0x2f')](_0x303cdd[_0xc008('0x2e')],qs[_0xc008('0x30')](_0x1bdaa9[_0xc008('0x26')]['fields']));_0x5f1e48[_0xc008('0x31')]=_0x5f1e48[_0xc008('0x31')][_0xc008('0x4c')]?_0x5f1e48[_0xc008('0x31')]:_0x303cdd[_0xc008('0x2e')];if(!_0x1bdaa9['query'][_0xc008('0x4d')](_0xc008('0x4e'))){_0x5f1e48[_0xc008('0x4f')]=qs[_0xc008('0x4f')](_0x1bdaa9[_0xc008('0x26')][_0xc008('0x4f')]);_0x5f1e48[_0xc008('0x10')]=qs[_0xc008('0x10')](_0x1bdaa9[_0xc008('0x26')][_0xc008('0x10')]);}_0x5f1e48[_0xc008('0x56')]=qs[_0xc008('0x50')](_0x1bdaa9[_0xc008('0x26')][_0xc008('0x50')]);_0x5f1e48[_0xc008('0x24')]=qs['filters'](_['pick'](_0x1bdaa9[_0xc008('0x26')],_0x303cdd[_0xc008('0x2d')]));_0x5f1e48[_0xc008('0x24')][_0xc008('0x52')]=_0x5bd010['id'];if(_0x1bdaa9[_0xc008('0x26')][_0xc008('0x53')]){_0x5f1e48[_0xc008('0x24')]=_[_0xc008('0x33')](_0x5f1e48[_0xc008('0x24')],{'$or':_['map'](_0x5f1e48[_0xc008('0x31')],function(_0x2bbadf){var _0x54fd75={};_0x54fd75[_0x2bbadf]={'$like':'%'+_0x1bdaa9[_0xc008('0x26')][_0xc008('0x53')]+'%'};return _0x54fd75;})});}_0x5f1e48=_[_0xc008('0x33')]({},_0x5f1e48,_0x1bdaa9[_0xc008('0x34')]);return db[_0xc008('0x5a')][_0xc008('0x12')]({'where':_0x5f1e48['where']})[_0xc008('0x15')](function(_0x321532){_0x38239a[_0xc008('0x12')]=_0x321532;if(_0x1bdaa9[_0xc008('0x26')]['includeAll']){_0x5f1e48[_0xc008('0x25')]=[{'all':!![]}];}return db['CmHopperBlack'][_0xc008('0x27')](_0x5f1e48);})[_0xc008('0x15')](function(_0x5b47c3){_0x38239a[_0xc008('0x28')]=_0x5b47c3;return _0x38239a;});}})['then'](respondWithFilteredResult(_0x698d5c,_0x5f1e48))[_0xc008('0x29')](handleError(_0x698d5c,null));};exports['getTeams']=function(_0x5b387d,_0x5351f7){var _0x79dfea={};var _0x402b67={};var _0x48f40f;var _0x4fda8;return db[_0xc008('0x20')]['findOne']({'where':{'id':_0x5b387d[_0xc008('0x2b')]['id']}})[_0xc008('0x15')](handleEntityNotFound(_0x5351f7,null))[_0xc008('0x15')](function(_0x5843ee){if(_0x5843ee){_0x48f40f=_0x5843ee;_0x402b67[_0xc008('0x2e')]=_[_0xc008('0x2c')](db[_0xc008('0x5b')][_0xc008('0x21')]);_0x402b67[_0xc008('0x26')]=_[_0xc008('0x2c')](_0x5b387d[_0xc008('0x26')]);_0x402b67[_0xc008('0x2d')]=_[_0xc008('0x2f')](_0x402b67[_0xc008('0x2e')],_0x402b67[_0xc008('0x26')]);_0x79dfea['attributes']=_[_0xc008('0x2f')](_0x402b67[_0xc008('0x2e')],qs[_0xc008('0x30')](_0x5b387d['query'][_0xc008('0x30')]));_0x79dfea[_0xc008('0x31')]=_0x79dfea[_0xc008('0x31')]['length']?_0x79dfea[_0xc008('0x31')]:_0x402b67['model'];_0x79dfea[_0xc008('0x56')]=qs[_0xc008('0x50')](_0x5b387d[_0xc008('0x26')]['sort']);_0x79dfea[_0xc008('0x24')]=qs[_0xc008('0x2d')](_[_0xc008('0x51')](_0x5b387d[_0xc008('0x26')],_0x402b67[_0xc008('0x2d')]));if(_0x5b387d[_0xc008('0x26')][_0xc008('0x53')]){_0x79dfea['where']=_[_0xc008('0x33')](_0x79dfea[_0xc008('0x24')],{'$or':_[_0xc008('0x17')](_0x79dfea[_0xc008('0x31')],function(_0x5a61d6){var _0x46fba5={};_0x46fba5[_0x5a61d6]={'$like':'%'+_0x5b387d['query'][_0xc008('0x53')]+'%'};return _0x46fba5;})});}_0x79dfea=_[_0xc008('0x33')]({},_0x79dfea,_0x5b387d[_0xc008('0x34')]);return _0x48f40f[_0xc008('0x5c')](_0x79dfea);}})[_0xc008('0x15')](function(_0x9f266e){if(_0x9f266e){_0x4fda8=_0x9f266e[_0xc008('0x4c')];if(!_0x5b387d['query'][_0xc008('0x4d')](_0xc008('0x4e'))){_0x79dfea[_0xc008('0x4f')]=qs[_0xc008('0x4f')](_0x5b387d['query'][_0xc008('0x4f')]);_0x79dfea['offset']=qs[_0xc008('0x10')](_0x5b387d[_0xc008('0x26')][_0xc008('0x10')]);}return _0x48f40f['getTeams'](_0x79dfea);}})['then'](function(_0x39bfc0){if(_0x39bfc0){return _0x39bfc0?{'count':_0x4fda8,'rows':_0x39bfc0}:null;}})['then'](respondWithResult(_0x5351f7,null))[_0xc008('0x29')](handleError(_0x5351f7,null));};exports[_0xc008('0x5d')]=function(_0x1c2e63,_0xaf3bed){var _0x58ae7b=_0x1c2e63[_0xc008('0x45')][_0xc008('0x5e')];var _0x537e5e=_['map'](_0x58ae7b,'id');return db[_0xc008('0x5b')][_0xc008('0x27')]({'where':{'id':_0x537e5e},'attributes':['id'],'include':[{'model':db['User'],'as':_0xc008('0x5f'),'attributes':['id',_0xc008('0x3e'),_0xc008('0x60'),_0xc008('0x61'),'interface'],'raw':!![]}]})[_0xc008('0x15')](function(_0x3721e8){if(_0x3721e8){var _0xc344a7=_[_0xc008('0x62')](_0x3721e8,function(_0x78b833){var _0x177733=_0x78b833[_0xc008('0x3a')]({'plain':!![]});_0x177733[_0xc008('0x5f')][_0xc008('0x63')](function(_0xa332b1){_0xa332b1[_0xc008('0x64')]=_[_0xc008('0x35')](_0x58ae7b,{'id':_0x177733['id']})[_0xc008('0x64')];});return _0x177733['Agents'];});return db['VoiceQueue'][_0xc008('0x35')]({'where':{'id':_0x1c2e63[_0xc008('0x2b')]['id']}})[_0xc008('0x15')](function(_0x4447ba){return db[_0xc008('0x65')][_0xc008('0x66')](function(_0xe5d226){return _0x4447ba['addTeams'](_0x537e5e,{'transaction':_0xe5d226})['then'](function(){return BPromise[_0xc008('0x67')](_0x58ae7b,function(_0x3d33ed){return db[_0xc008('0x68')]['upsert']({'TeamId':_0x3d33ed['id'],'VoiceQueueId':_0x1c2e63[_0xc008('0x2b')]['id'],'penalty':_0x3d33ed[_0xc008('0x64')]},{'transaction':_0xe5d226});});})[_0xc008('0x15')](function(){return BPromise[_0xc008('0x67')](_0xc344a7,function(_0x156ec3){return db[_0xc008('0x69')][_0xc008('0x6a')]({'where':{'UserId':_0x156ec3['id'],'VoiceQueueId':_0x1c2e63[_0xc008('0x2b')]['id']},'defaults':{'penalty':_0x156ec3[_0xc008('0x64')]},'transaction':_0xe5d226});});})[_0xc008('0x15')](function(){return BPromise[_0xc008('0x67')](_[_0xc008('0x53')](_0xc344a7,{'online':!![]}),function(_0x4ffaa3){return db['UserVoiceQueueRt'][_0xc008('0x6b')]({'membername':_0x4ffaa3[_0xc008('0x3e')],'UserId':_0x4ffaa3['id'],'queue_name':_0x4447ba['name'],'VoiceQueueId':_0x4447ba['id'],'interface':_[_0xc008('0x6c')](_0x4ffaa3[_0xc008('0x6d')])?util[_0xc008('0x6e')](_0xc008('0x6f'),_0x4ffaa3[_0xc008('0x3e')]):_0x4ffaa3[_0xc008('0x6d')],'paused':_0x4ffaa3[_0xc008('0x61')]||![],'penalty':_0x4ffaa3[_0xc008('0x64')]},{'transaction':_0xe5d226});});})[_0xc008('0x15')](function(){_0xc344a7['forEach'](function(_0x51b305){socket['emit'](_0xc008('0x70'),{'UserId':_0x51b305['id'],'VoiceQueueId':_0x4447ba['id']});});});});});}})['then'](respondWithStatusCode(_0xaf3bed,null))[_0xc008('0x29')](handleError(_0xaf3bed,null));};exports[_0xc008('0x71')]=function(_0x2c6a48,_0x177e8e){return db[_0xc008('0x5b')][_0xc008('0x27')]({'where':{'id':_0x2c6a48[_0xc008('0x26')][_0xc008('0x72')]},'attributes':['id'],'include':[{'model':db[_0xc008('0x73')],'as':_0xc008('0x5f'),'attributes':['id'],'raw':!![]}]})[_0xc008('0x15')](handleEntityNotFound(_0x177e8e,null))[_0xc008('0x15')](function(_0x1fea74){var _0x304083=_[_0xc008('0x17')](_0x1fea74,'id');var _0x473f44=[];var _0x41d1ea=[];var _0x5c2ca1=squel[_0xc008('0x74')]();_0x5c2ca1['field'](_0xc008('0x75'))[_0xc008('0x76')](_0xc008('0x77'),'tq')['join'](_0xc008('0x78'),'ut',_0xc008('0x79'))[_0xc008('0x24')](_0xc008('0x7a'),_0x2c6a48[_0xc008('0x2b')]['id']);for(var _0x377754=0x0;_0x377754<_0x1fea74[_0xc008('0x4c')];_0x377754+=0x1){let _0x57b8da=_0x1fea74[_0x377754];for(var _0x1cad4b=0x0;_0x1cad4b<_0x57b8da[_0xc008('0x5f')][_0xc008('0x4c')];_0x1cad4b+=0x1){let _0xdb4cef=_0x57b8da['Agents'][_0x1cad4b];var _0x555e8c=_0x5c2ca1['clone']();_0x555e8c['where'](_0xc008('0x7b'),_0xdb4cef['id']);_0x41d1ea[_0xc008('0x7c')](db[_0xc008('0x65')][_0xc008('0x26')](_0x555e8c['toString'](),{'type':db[_0xc008('0x65')][_0xc008('0x7d')][_0xc008('0x7e')]})['then'](function(_0x438195){if(_0x438195['length']===0x1){return _0xdb4cef['id'];}else{var _0x3d76b7=_['every'](_[_0xc008('0x17')](_0x438195,_0xc008('0x7f')),function(_0x1aaf89){return _[_0xc008('0x19')](_0x304083,_0x1aaf89);});if(_0x3d76b7){return _0xdb4cef['id'];}}}));}}return BPromise['all'](_0x41d1ea)[_0xc008('0x15')](function(_0x19dcb7){_0x473f44=_(_0x473f44)[_0xc008('0x80')](_0x19dcb7)[_0xc008('0x81')]()[_0xc008('0x18')]();return db[_0xc008('0x20')][_0xc008('0x35')]({'where':{'id':_0x2c6a48['params']['id']}})[_0xc008('0x15')](function(_0x30b6af){return db[_0xc008('0x65')]['transaction'](function(_0x5ba04f){return _0x30b6af[_0xc008('0x71')](_0x2c6a48[_0xc008('0x26')][_0xc008('0x72')],{'transaction':_0x5ba04f})[_0xc008('0x15')](function(){if(!_['isEmpty'](_0x473f44)){return _0x30b6af[_0xc008('0x82')](_0x473f44,{'transaction':_0x5ba04f})[_0xc008('0x15')](function(){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x2c6a48['params']['id'],'UserId':_0x473f44},'transaction':_0x5ba04f});});}})[_0xc008('0x15')](function(){_0x473f44['forEach'](function(_0x3744e1){socket['emit'](_0xc008('0x83'),{'UserId':_0x3744e1,'VoiceQueueId':_0x30b6af['id']});});});});});});})[_0xc008('0x15')](respondWithStatusCode(_0x177e8e,null))[_0xc008('0x29')](handleError(_0x177e8e,null));};exports[_0xc008('0x84')]=function(_0x5c24cd,_0x5effd6){var _0x23ba7e,_0x274739;return db[_0xc008('0x20')]['find']({'where':{'id':_0x5c24cd[_0xc008('0x2b')]['id']}})[_0xc008('0x15')](handleEntityNotFound(_0x5effd6,null))[_0xc008('0x15')](function(_0x272d98){if(_0x272d98){_0x274739=_0x272d98;return _0x272d98[_0xc008('0x84')](_0x5c24cd[_0xc008('0x45')][_0xc008('0x72')],_[_0xc008('0x44')](_0x5c24cd[_0xc008('0x45')],[_0xc008('0x72'),'id'])||{})[_0xc008('0x85')](function(_0x57687f){for(var _0x5ea13a=0x0;_0x5ea13a<_0x5c24cd[_0xc008('0x45')]['ids'][_0xc008('0x4c')];_0x5ea13a+=0x1){socket[_0xc008('0x86')]('userVoiceQueue:save',{'UserId':Number(_0x5c24cd['body'][_0xc008('0x72')][_0x5ea13a]),'VoiceQueueId':Number(_0x5c24cd[_0xc008('0x2b')]['id'])});}return _0x57687f;});}})[_0xc008('0x15')](function(_0x129cbf){_0x23ba7e=_0x129cbf||[];if(_0x274739){return db[_0xc008('0x73')][_0xc008('0x27')]({'where':{'id':_0x5c24cd['body'][_0xc008('0x72')]},'attributes':['id',_0xc008('0x3e'),_0xc008('0x60'),'voicePause',_0xc008('0x6d')],'raw':!![]});}})[_0xc008('0x15')](function(_0xcef0e4){if(!_[_0xc008('0x87')](_0xcef0e4)){var _0x49f92e=[];for(var _0x4ae026=0x0;_0x4ae026<_0xcef0e4[_0xc008('0x4c')];_0x4ae026++){if(_0xcef0e4[_0x4ae026]['online']){_0x49f92e[_0xc008('0x7c')](db[_0xc008('0x88')][_0xc008('0x6b')]({'membername':_0xcef0e4[_0x4ae026][_0xc008('0x3e')],'UserId':_0xcef0e4[_0x4ae026]['id'],'queue_name':_0x274739[_0xc008('0x3e')],'VoiceQueueId':_0x274739['id'],'interface':_['isNil'](_0xcef0e4[_0x4ae026]['interface'])?util[_0xc008('0x6e')](_0xc008('0x6f'),_0xcef0e4[_0x4ae026][_0xc008('0x3e')]):_0xcef0e4[_0x4ae026][_0xc008('0x6d')],'paused':_0xcef0e4[_0x4ae026][_0xc008('0x61')]||![],'penalty':_0x5c24cd[_0xc008('0x45')][_0xc008('0x64')]||0x0}));}}return BPromise['all'](_0x49f92e);}})[_0xc008('0x15')](function(){return _0x23ba7e;})[_0xc008('0x15')](respondWithResult(_0x5effd6,null))[_0xc008('0x29')](handleError(_0x5effd6,null));};exports[_0xc008('0x82')]=function(_0x1afb32,_0x1c2263){return db[_0xc008('0x20')][_0xc008('0x35')]({'where':{'id':_0x1afb32[_0xc008('0x2b')]['id']}})[_0xc008('0x15')](handleEntityNotFound(_0x1c2263,null))[_0xc008('0x15')](function(_0x328284){if(_0x328284){return _0x328284['removeAgents'](_0x1afb32[_0xc008('0x26')][_0xc008('0x72')])['then'](function(){if(_[_0xc008('0x89')](_0x1afb32[_0xc008('0x26')][_0xc008('0x72')])){for(var _0x2598be=0x0;_0x2598be<_0x1afb32[_0xc008('0x26')][_0xc008('0x72')][_0xc008('0x4c')];_0x2598be+=0x1){socket[_0xc008('0x86')](_0xc008('0x83'),{'UserId':Number(_0x1afb32[_0xc008('0x26')][_0xc008('0x72')][_0x2598be]),'VoiceQueueId':Number(_0x1afb32['params']['id'])});}}else{socket[_0xc008('0x86')](_0xc008('0x83'),{'UserId':Number(_0x1afb32[_0xc008('0x26')][_0xc008('0x72')]),'VoiceQueueId':Number(_0x1afb32[_0xc008('0x2b')]['id'])});}});}})[_0xc008('0x15')](function(_0x12f5d1){return db[_0xc008('0x88')][_0xc008('0x1c')]({'where':{'VoiceQueueId':_0x1afb32[_0xc008('0x2b')]['id'],'UserId':_0x1afb32[_0xc008('0x26')][_0xc008('0x72')]}})[_0xc008('0x15')](function(){return _0x12f5d1;});})[_0xc008('0x15')](respondWithStatusCode(_0x1c2263,null))[_0xc008('0x29')](handleError(_0x1c2263,null));};exports[_0xc008('0x8a')]=function(_0x5c358b,_0x49688b){var _0x51fd86={};var _0x10778f={};var _0x237ffb;var _0x3f80f4;return db[_0xc008('0x20')][_0xc008('0x4a')]({'where':{'id':_0x5c358b[_0xc008('0x2b')]['id']}})[_0xc008('0x15')](handleEntityNotFound(_0x49688b,null))['then'](function(_0x3e7099){if(_0x3e7099){_0x237ffb=_0x3e7099;_0x10778f['model']=_['keys'](db[_0xc008('0x73')][_0xc008('0x21')]);_0x10778f['query']=_[_0xc008('0x2c')](_0x5c358b[_0xc008('0x26')]);_0x10778f[_0xc008('0x2d')]=_['intersection'](_0x10778f[_0xc008('0x2e')],_0x10778f[_0xc008('0x26')]);_0x51fd86[_0xc008('0x31')]=_['intersection'](_0x10778f[_0xc008('0x2e')],qs[_0xc008('0x30')](_0x5c358b[_0xc008('0x26')][_0xc008('0x30')]));_0x51fd86[_0xc008('0x31')]=_0x51fd86[_0xc008('0x31')][_0xc008('0x4c')]?_0x51fd86[_0xc008('0x31')]:_0x10778f['model'];_0x51fd86[_0xc008('0x56')]=qs[_0xc008('0x50')](_0x5c358b[_0xc008('0x26')][_0xc008('0x50')]);_0x51fd86[_0xc008('0x24')]=qs['filters'](_[_0xc008('0x51')](_0x5c358b[_0xc008('0x26')],_0x10778f[_0xc008('0x2d')]));if(_0x5c358b[_0xc008('0x26')][_0xc008('0x53')]){_0x51fd86[_0xc008('0x24')]=_[_0xc008('0x33')](_0x51fd86[_0xc008('0x24')],{'$or':_['map'](_0x51fd86[_0xc008('0x31')],function(_0x231318){var _0x3df369={};_0x3df369[_0x231318]={'$like':'%'+_0x5c358b[_0xc008('0x26')]['filter']+'%'};return _0x3df369;})});}_0x51fd86=_['merge']({},_0x51fd86,_0x5c358b[_0xc008('0x34')]);return _0x237ffb[_0xc008('0x8a')](_0x51fd86);}})['then'](function(_0x30e433){if(_0x30e433){_0x3f80f4=_0x30e433[_0xc008('0x4c')];if(!_0x5c358b[_0xc008('0x26')][_0xc008('0x4d')](_0xc008('0x4e'))){_0x51fd86[_0xc008('0x4f')]=qs[_0xc008('0x4f')](_0x5c358b['query']['limit']);_0x51fd86[_0xc008('0x10')]=qs['offset'](_0x5c358b[_0xc008('0x26')][_0xc008('0x10')]);}return _0x237ffb[_0xc008('0x8a')](_0x51fd86);}})[_0xc008('0x15')](function(_0x2ea1db){if(_0x2ea1db){return _0x2ea1db?{'count':_0x3f80f4,'rows':_0x2ea1db}:null;}})[_0xc008('0x15')](respondWithResult(_0x49688b,null))[_0xc008('0x29')](handleError(_0x49688b,null));};exports[_0xc008('0x8b')]=function(_0x367873,_0x356a82){var _0x368c1f={};var _0x4fd0ff={};var _0x22772e;var _0x39fd43;return db[_0xc008('0x20')][_0xc008('0x4a')]({'where':{'id':_0x367873[_0xc008('0x2b')]['id']}})[_0xc008('0x15')](handleEntityNotFound(_0x356a82,null))[_0xc008('0x15')](function(_0x506dc0){if(_0x506dc0){_0x22772e=_0x506dc0;_0x4fd0ff[_0xc008('0x2e')]=_[_0xc008('0x2c')](db[_0xc008('0x88')]['rawAttributes']);_0x4fd0ff[_0xc008('0x26')]=_[_0xc008('0x2c')](_0x367873[_0xc008('0x26')]);_0x4fd0ff[_0xc008('0x2d')]=_[_0xc008('0x2f')](_0x4fd0ff[_0xc008('0x2e')],_0x4fd0ff['query']);_0x368c1f['attributes']=_[_0xc008('0x2f')](_0x4fd0ff[_0xc008('0x2e')],qs[_0xc008('0x30')](_0x367873[_0xc008('0x26')][_0xc008('0x30')]));_0x368c1f['attributes']=_0x368c1f[_0xc008('0x31')]['length']?_0x368c1f[_0xc008('0x31')]:_0x4fd0ff[_0xc008('0x2e')];_0x368c1f['order']=qs[_0xc008('0x50')](_0x367873[_0xc008('0x26')][_0xc008('0x50')]);_0x368c1f[_0xc008('0x24')]=qs['filters'](_[_0xc008('0x51')](_0x367873[_0xc008('0x26')],_0x4fd0ff[_0xc008('0x2d')]));if(_0x367873[_0xc008('0x26')][_0xc008('0x53')]){_0x368c1f['where']=_[_0xc008('0x33')](_0x368c1f[_0xc008('0x24')],{'$or':_[_0xc008('0x17')](_0x368c1f['attributes'],function(_0x43f96e){var _0x353cd5={};_0x353cd5[_0x43f96e]={'$like':'%'+_0x367873[_0xc008('0x26')][_0xc008('0x53')]+'%'};return _0x353cd5;})});}_0x368c1f=_['merge']({},_0x368c1f,_0x367873[_0xc008('0x34')]);return _0x22772e[_0xc008('0x8b')](_0x368c1f);}})[_0xc008('0x15')](function(_0x9afcd6){if(_0x9afcd6){_0x39fd43=_0x9afcd6[_0xc008('0x4c')];if(!_0x367873['query'][_0xc008('0x4d')]('nolimit')){_0x368c1f['limit']=qs[_0xc008('0x4f')](_0x367873['query'][_0xc008('0x4f')]);_0x368c1f[_0xc008('0x10')]=qs[_0xc008('0x10')](_0x367873[_0xc008('0x26')][_0xc008('0x10')]);}return _0x22772e[_0xc008('0x8b')](_0x368c1f);}})[_0xc008('0x15')](function(_0x5e9e9c){return _0x5e9e9c?{'count':_0x39fd43,'rows':_0x5e9e9c}:null;})[_0xc008('0x15')](respondWithResult(_0x356a82,null))[_0xc008('0x29')](handleError(_0x356a82,null));};exports[_0xc008('0x8c')]=function(_0x45fe90,_0xc046ce){var _0x46fc75={};var _0x59b5b9={};var _0x3c3ead;var _0x3c8a79;return db[_0xc008('0x20')][_0xc008('0x4a')]({'where':{'id':_0x45fe90[_0xc008('0x2b')]['id']}})[_0xc008('0x15')](handleEntityNotFound(_0xc046ce,null))[_0xc008('0x15')](function(_0x3aa9b4){if(_0x3aa9b4){_0x3c3ead=_0x3aa9b4;_0x59b5b9['model']=_['keys'](db[_0xc008('0x8d')][_0xc008('0x21')]);_0x59b5b9['query']=_[_0xc008('0x2c')](_0x45fe90['query']);_0x59b5b9[_0xc008('0x2d')]=_[_0xc008('0x2f')](_0x59b5b9[_0xc008('0x2e')],_0x59b5b9[_0xc008('0x26')]);_0x46fc75[_0xc008('0x31')]=_[_0xc008('0x2f')](_0x59b5b9[_0xc008('0x2e')],qs['fields'](_0x45fe90[_0xc008('0x26')]['fields']));_0x46fc75[_0xc008('0x31')]=_0x46fc75[_0xc008('0x31')][_0xc008('0x4c')]?_0x46fc75[_0xc008('0x31')]:_0x59b5b9[_0xc008('0x2e')];_0x46fc75[_0xc008('0x56')]=qs[_0xc008('0x50')](_0x45fe90['query'][_0xc008('0x50')]);_0x46fc75[_0xc008('0x24')]=qs['filters'](_[_0xc008('0x51')](_0x45fe90[_0xc008('0x26')],_0x59b5b9[_0xc008('0x2d')]));if(_0x45fe90[_0xc008('0x26')][_0xc008('0x53')]){_0x46fc75[_0xc008('0x24')]=_['merge'](_0x46fc75[_0xc008('0x24')],{'$or':_[_0xc008('0x17')](_0x46fc75[_0xc008('0x31')],function(_0x3e7c19){var _0x47d263={};_0x47d263[_0x3e7c19]={'$like':'%'+_0x45fe90['query']['filter']+'%'};return _0x47d263;})});}_0x46fc75=_[_0xc008('0x33')]({},_0x46fc75,_0x45fe90[_0xc008('0x34')]);return _0x3c3ead['getLists'](_0x46fc75);}})['then'](function(_0x5035ca){if(_0x5035ca){_0x3c8a79=_0x5035ca['length'];if(!_0x45fe90[_0xc008('0x26')][_0xc008('0x4d')]('nolimit')){_0x46fc75[_0xc008('0x4f')]=qs[_0xc008('0x4f')](_0x45fe90[_0xc008('0x26')][_0xc008('0x4f')]);_0x46fc75[_0xc008('0x10')]=qs['offset'](_0x45fe90['query'][_0xc008('0x10')]);}return _0x3c3ead[_0xc008('0x8c')](_0x46fc75);}})[_0xc008('0x15')](function(_0x46f9ab){if(_0x46f9ab){return _0x46f9ab?{'count':_0x3c8a79,'rows':_0x46f9ab}:null;}})[_0xc008('0x15')](respondWithResult(_0xc046ce,null))[_0xc008('0x29')](handleError(_0xc046ce,null));};exports[_0xc008('0x8e')]=function(_0x5645bb,_0x2ebe07){var _0x3d6f0d=moment()[_0xc008('0x6e')](_0xc008('0x8f'));var _0x3be328,_0x3bcf94;return db[_0xc008('0x20')]['find']({'where':{'id':_0x5645bb['params']['id']}})[_0xc008('0x15')](handleEntityNotFound(_0x2ebe07,null))[_0xc008('0x15')](function(_0x11bcba){if(_0x11bcba){_0x3bcf94=_0x11bcba;return _0x11bcba[_0xc008('0x8e')](_0x5645bb[_0xc008('0x45')][_0xc008('0x72')],_[_0xc008('0x44')](_0x5645bb[_0xc008('0x45')],[_0xc008('0x72'),'id'])||{});}return null;})[_0xc008('0x85')](function(_0xefba5){var _0x202826;_0x3be328=_0xefba5||[];var _0x37e1f2=[];if(_0xefba5){for(var _0x5161f3=0x0;_0x5161f3<_0xefba5['length'];_0x5161f3+=0x1){var _0x43ec81=_0xefba5[_0x5161f3][_0xc008('0x3a')]({'plain':!![]});_0x3bcf94[_0xc008('0x90')]=_0x5645bb[_0xc008('0x45')][_0xc008('0x90')]?_0x5645bb[_0xc008('0x45')][_0xc008('0x90')]:_0x3bcf94['dialCheckDuplicateType'];switch(_0x3bcf94['dialCheckDuplicateType']){case'always':_0x202826=squel[_0xc008('0x91')]()['into']('cm_hopper')['fromQuery']([_0xc008('0x92'),_0xc008('0x93'),_0xc008('0x94'),_0xc008('0x95'),_0xc008('0x52'),_0xc008('0x46'),_0xc008('0x47')],squel[_0xc008('0x74')]()[_0xc008('0x96')](_0xc008('0x92'),_0xc008('0x92'))[_0xc008('0x96')]('\x27'+_0x3d6f0d+'\x27','scheduledAt')['field']('id',_0xc008('0x94'))[_0xc008('0x96')](_0x43ec81[_0xc008('0x97')][_0xc008('0x98')](),_0xc008('0x95'))[_0xc008('0x96')](_0x5645bb[_0xc008('0x2b')]['id'][_0xc008('0x98')](),'VoiceQueueId')[_0xc008('0x96')]('\x27'+_0x3d6f0d+'\x27','createdAt')['field']('\x27'+_0x3d6f0d+'\x27','updatedAt')['from'](_0xc008('0x99'))['where'](_0xc008('0x9a'))[_0xc008('0x24')](_0xc008('0x9b'),_0x43ec81['CmListId']['toString']())[_0xc008('0x24')](_0xc008('0x9c'))['where'](_0xc008('0x9d'),squel[_0xc008('0x74')]()[_0xc008('0x96')](_0xc008('0x9e'))[_0xc008('0x76')](_0xc008('0x9f'))[_0xc008('0x24')](_0xc008('0x7a'),_0x5645bb[_0xc008('0x2b')]['id'][_0xc008('0x98')]()))['where'](_0xc008('0x9d'),squel[_0xc008('0x74')]()['field']('COALESCE(phone,\x27\x27)')[_0xc008('0x76')](_0xc008('0xa0'))[_0xc008('0x24')]('VoiceQueueId\x20=\x20?',_0x5645bb['params']['id']['toString']())))['toString']();break;case _0xc008('0xa1'):_0x202826=squel[_0xc008('0x91')]()[_0xc008('0xa2')](_0xc008('0xa0'))[_0xc008('0xa3')]([_0xc008('0x92'),_0xc008('0x93'),'ContactId',_0xc008('0x95'),_0xc008('0x52'),_0xc008('0x46'),_0xc008('0x47')],squel[_0xc008('0x74')]()['field'](_0xc008('0x92'),_0xc008('0x92'))['field']('\x27'+_0x3d6f0d+'\x27',_0xc008('0x93'))[_0xc008('0x96')]('id',_0xc008('0x94'))[_0xc008('0x96')](_0x43ec81['CmListId'][_0xc008('0x98')](),'ListId')[_0xc008('0x96')](_0x5645bb[_0xc008('0x2b')]['id'][_0xc008('0x98')](),_0xc008('0x52'))[_0xc008('0x96')]('\x27'+_0x3d6f0d+'\x27','createdAt')[_0xc008('0x96')]('\x27'+_0x3d6f0d+'\x27',_0xc008('0x47'))[_0xc008('0x76')](_0xc008('0x99'))['where'](_0xc008('0x9a'))['where']('ListId\x20=\x20?',_0x43ec81[_0xc008('0x97')][_0xc008('0x98')]())[_0xc008('0x24')]('phone\x20IS\x20NOT\x20NULL')[_0xc008('0x24')](_0xc008('0x9d'),squel['select']()[_0xc008('0x96')](_0xc008('0xa4'))['from']('cm_hopper')[_0xc008('0x24')]('VoiceQueueId\x20=\x20?',_0x5645bb['params']['id'][_0xc008('0x98')]())))['toString']();break;default:_0x202826=squel[_0xc008('0x91')]()[_0xc008('0xa2')](_0xc008('0xa0'))[_0xc008('0xa3')]([_0xc008('0x92'),'scheduledAt','ContactId',_0xc008('0x95'),'VoiceQueueId',_0xc008('0x46'),'updatedAt'],squel['select']()['field'](_0xc008('0x92'),'phone')[_0xc008('0x96')]('\x27'+_0x3d6f0d+'\x27',_0xc008('0x93'))['field']('id','ContactId')[_0xc008('0x96')](_0x43ec81[_0xc008('0x97')][_0xc008('0x98')](),_0xc008('0x95'))['field'](_0x5645bb['params']['id'][_0xc008('0x98')](),'VoiceQueueId')['field']('\x27'+_0x3d6f0d+'\x27',_0xc008('0x46'))[_0xc008('0x96')]('\x27'+_0x3d6f0d+'\x27','updatedAt')['from']('cm_contacts')[_0xc008('0x24')]('deletedAt\x20IS\x20NULL')[_0xc008('0x24')](_0xc008('0x9b'),_0x43ec81[_0xc008('0x97')][_0xc008('0x98')]())[_0xc008('0x24')]('phone\x20IS\x20NOT\x20NULL'))['toString']();}_0x37e1f2[_0xc008('0x7c')](db[_0xc008('0x65')][_0xc008('0x26')](_0x202826));}return BPromise[_0xc008('0xa5')](_0x37e1f2);}})[_0xc008('0x15')](function(){var _0x262b79=[];var _0x15c5a2=squel[_0xc008('0x91')]()[_0xc008('0xa2')](_0xc008('0xa6'))[_0xc008('0xa3')]([_0xc008('0xa7'),'phone',_0xc008('0xa8'),_0xc008('0x46'),_0xc008('0x47')],squel[_0xc008('0x74')]()['field'](_0xc008('0xa9'))[_0xc008('0x96')](_0xc008('0xaa'))[_0xc008('0x96')](_0xc008('0xab'))[_0xc008('0x96')]('\x27'+_0x3d6f0d+'\x27',_0xc008('0x46'))[_0xc008('0x96')]('\x27'+_0x3d6f0d+'\x27','updatedAt')[_0xc008('0x76')](_0xc008('0xac'),'ci')[_0xc008('0xad')](_0xc008('0xa0'),'h',_0xc008('0xae'))[_0xc008('0x24')](_0xc008('0xaf'),_0x3d6f0d)['where'](_0xc008('0xb0'),'PHONE'))[_0xc008('0x98')]();_0x262b79[_0xc008('0x7c')](db[_0xc008('0x65')][_0xc008('0x26')](_0x15c5a2));return BPromise[_0xc008('0xa5')](_0x262b79);})[_0xc008('0x15')](function(){return _0x3be328;})[_0xc008('0x15')](respondWithResult(_0x2ebe07,null))[_0xc008('0x29')](handleError(_0x2ebe07,null));};exports[_0xc008('0xb1')]=function(_0x471780,_0x4fae34){return db[_0xc008('0x20')][_0xc008('0x35')]({'where':{'id':_0x471780[_0xc008('0x2b')]['id']}})[_0xc008('0x15')](handleEntityNotFound(_0x4fae34,null))[_0xc008('0x15')](function(_0x1cc6a6){if(_0x1cc6a6){return _0x1cc6a6[_0xc008('0xb1')](_0x471780[_0xc008('0x26')][_0xc008('0x72')]);}})[_0xc008('0x15')](function(_0x471618){if(_0x471618){return db[_0xc008('0x4b')][_0xc008('0x1c')]({'where':{'ListId':_0x471780['query'][_0xc008('0x72')],'VoiceQueueId':_0x471780['params']['id']}})[_0xc008('0x15')](function(){return _0x471618;});}})[_0xc008('0x15')](respondWithStatusCode(_0x4fae34,null))[_0xc008('0x29')](handleError(_0x4fae34,null));};exports[_0xc008('0xb2')]=function(_0x370234,_0x3ff7d2){var _0x478794={};var _0x406de6={};var _0x34cbce;var _0x337acd;return db['VoiceQueue']['findOne']({'where':{'id':_0x370234['params']['id']}})[_0xc008('0x15')](handleEntityNotFound(_0x3ff7d2,null))[_0xc008('0x15')](function(_0x2ccfcf){if(_0x2ccfcf){_0x34cbce=_0x2ccfcf;_0x406de6[_0xc008('0x2e')]=_[_0xc008('0x2c')](db[_0xc008('0x8d')][_0xc008('0x21')]);_0x406de6['query']=_[_0xc008('0x2c')](_0x370234[_0xc008('0x26')]);_0x406de6[_0xc008('0x2d')]=_[_0xc008('0x2f')](_0x406de6[_0xc008('0x2e')],_0x406de6['query']);_0x478794[_0xc008('0x31')]=_[_0xc008('0x2f')](_0x406de6[_0xc008('0x2e')],qs[_0xc008('0x30')](_0x370234[_0xc008('0x26')][_0xc008('0x30')]));_0x478794[_0xc008('0x31')]=_0x478794[_0xc008('0x31')][_0xc008('0x4c')]?_0x478794[_0xc008('0x31')]:_0x406de6[_0xc008('0x2e')];_0x478794['order']=qs[_0xc008('0x50')](_0x370234['query'][_0xc008('0x50')]);_0x478794[_0xc008('0x24')]=qs[_0xc008('0x2d')](_['pick'](_0x370234[_0xc008('0x26')],_0x406de6['filters']));if(_0x370234[_0xc008('0x26')][_0xc008('0x53')]){_0x478794[_0xc008('0x24')]=_[_0xc008('0x33')](_0x478794[_0xc008('0x24')],{'$or':_[_0xc008('0x17')](_0x478794[_0xc008('0x31')],function(_0x89601c){var _0x22bb2a={};_0x22bb2a[_0x89601c]={'$like':'%'+_0x370234[_0xc008('0x26')]['filter']+'%'};return _0x22bb2a;})});}_0x478794=_[_0xc008('0x33')]({},_0x478794,_0x370234['options']);return _0x34cbce['getBlackLists'](_0x478794);}})[_0xc008('0x15')](function(_0x55ad1f){if(_0x55ad1f){_0x337acd=_0x55ad1f[_0xc008('0x4c')];if(!_0x370234[_0xc008('0x26')][_0xc008('0x4d')](_0xc008('0x4e'))){_0x478794['limit']=qs[_0xc008('0x4f')](_0x370234[_0xc008('0x26')][_0xc008('0x4f')]);_0x478794[_0xc008('0x10')]=qs[_0xc008('0x10')](_0x370234['query'][_0xc008('0x10')]);}return _0x34cbce[_0xc008('0xb2')](_0x478794);}})['then'](function(_0x247e3a){if(_0x247e3a){return _0x247e3a?{'count':_0x337acd,'rows':_0x247e3a}:null;}})[_0xc008('0x15')](respondWithResult(_0x3ff7d2,null))[_0xc008('0x29')](handleError(_0x3ff7d2,null));};exports[_0xc008('0xb3')]=function(_0x252c44,_0x3b46db){var _0x482efd;return db[_0xc008('0x20')][_0xc008('0x35')]({'where':{'id':_0x252c44[_0xc008('0x2b')]['id']}})[_0xc008('0x15')](handleEntityNotFound(_0x3b46db,null))[_0xc008('0x15')](function(_0x2f217e){if(_0x2f217e){return _0x2f217e[_0xc008('0xb3')](_0x252c44[_0xc008('0x45')][_0xc008('0x72')],_[_0xc008('0x44')](_0x252c44['body'],[_0xc008('0x72'),'id'])||{});}return null;})[_0xc008('0x85')](function(_0x298783){var _0xe349bd;_0x482efd=_0x298783||[];var _0x50db48=[];if(_0x298783){for(var _0x384f2f=0x0;_0x384f2f<_0x298783[_0xc008('0x4c')];_0x384f2f+=0x1){var _0x367581=_0x298783[_0x384f2f][_0xc008('0x3a')]({'plain':!![]});_0xe349bd=squel[_0xc008('0x91')]()[_0xc008('0xa2')](_0xc008('0xb4'))[_0xc008('0xa3')]([_0xc008('0x92'),_0xc008('0x94'),_0xc008('0x95'),_0xc008('0x52'),_0xc008('0x46'),_0xc008('0x47')],squel['select']()[_0xc008('0x96')](_0xc008('0x92'),_0xc008('0x92'))[_0xc008('0x96')]('id',_0xc008('0x94'))['field'](_0x367581[_0xc008('0x97')][_0xc008('0x98')](),'ListId')[_0xc008('0x96')](_0x252c44[_0xc008('0x2b')]['id']['toString'](),'VoiceQueueId')['field']('NOW()',_0xc008('0x46'))['field']('NOW()',_0xc008('0x47'))[_0xc008('0x76')](_0xc008('0x99'))['where']('deletedAt\x20IS\x20NULL')[_0xc008('0x24')](_0xc008('0x9b'),_0x367581[_0xc008('0x97')][_0xc008('0x98')]())['where'](_0xc008('0x9c')))[_0xc008('0x98')]();_0x50db48['push'](db[_0xc008('0x65')]['query'](_0xe349bd));}return BPromise['all'](_0x50db48);}})[_0xc008('0x15')](function(){return _0x482efd;})[_0xc008('0x15')](respondWithResult(_0x3b46db,null))['catch'](handleError(_0x3b46db,null));};exports['removeBlackLists']=function(_0x1e3098,_0x9b997d){return db['VoiceQueue'][_0xc008('0x35')]({'where':{'id':_0x1e3098['params']['id']}})[_0xc008('0x15')](handleEntityNotFound(_0x9b997d,null))[_0xc008('0x15')](function(_0x1422ab){if(_0x1422ab){return _0x1422ab[_0xc008('0xb5')](_0x1e3098[_0xc008('0x26')][_0xc008('0x72')]);}})[_0xc008('0x15')](function(_0x41a8a6){if(_0x41a8a6){return db['CmHopperBlack'][_0xc008('0x1c')]({'where':{'ListId':_0x1e3098['query'][_0xc008('0x72')],'VoiceQueueId':_0x1e3098['params']['id']}})['then'](function(){return _0x41a8a6;});}})[_0xc008('0x15')](respondWithStatusCode(_0x9b997d,null))[_0xc008('0x29')](handleError(_0x9b997d,null));}; \ No newline at end of file +var _0xa41a=['createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','getHoppers','CmHopper','filters','nolimit','order','sort','pick','VoiceQueueId','getHopperHistories','CmHopperHistory','hasOwnProperty','getHopperFinals','findOne','CmHopperFinal','getHopperBlacks','CmHopperBlack','Team','getTeams','teams','User','Agents','online','voicePause','interface','forEach','penalty','sequelize','transaction','addTeams','each','TeamVoiceQueue','upsert','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','isNil','format','SIP/%s','emit','ids','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','removeTeams','isEmpty','removeAgents','addAgents','spread','userVoiceQueue:remove','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','select','CmListId','cm_contacts','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','deletedAt\x20IS\x20NULL','CmHopperId','OrderBy','h.id','ci.item','ci.OrderBy+1','cm_contact_has_items','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','moment','bluebird','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','./voiceQueue.socket','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','update','then','get','inbound','QueueCampaigns','filter','map','value','includes','type','find','name','UserProfileResource','destroy','error','stack','send','index','rawAttributes','key','where','include','VoiceQueue','findAll','rows','catch','params','model','query','keys','attributes','intersection','fields','length','merge','options','create','body','user','role','VoiceQueues','outbound','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','includeAll','omit'];(function(_0x41eee4,_0x81444b){var _0x62c5a8=function(_0x1b232d){while(--_0x1b232d){_0x41eee4['push'](_0x41eee4['shift']());}};_0x62c5a8(++_0x81444b);}(_0xa41a,0x6b));var _0xaa41=function(_0x2e4fc2,_0x1b3528){_0x2e4fc2=_0x2e4fc2-0x0;var _0x1121f7=_0xa41a[_0x2e4fc2];return _0x1121f7;};'use strict';var moment=require(_0xaa41('0x0'));var BPromise=require(_0xaa41('0x1'));var util=require('util');var _=require(_0xaa41('0x2'));var squel=require(_0xaa41('0x3'));var Redis=require(_0xaa41('0x4'));var qs=require(_0xaa41('0x5'));var logger=require(_0xaa41('0x6'))(_0xaa41('0x7'));var config=require(_0xaa41('0x8'));var db=require(_0xaa41('0x9'))['db'];config['redis']=_[_0xaa41('0xa')](config[_0xaa41('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xaa41('0xb')]));require(_0xaa41('0xc'))['register'](socket);function respondWithStatusCode(_0x31df43,_0x33f66b){_0x33f66b=_0x33f66b||0xcc;return function(_0x409dab){if(_0x409dab){return _0x31df43[_0xaa41('0xd')](_0x33f66b);}return _0x31df43[_0xaa41('0xe')](_0x33f66b)[_0xaa41('0xf')]();};}function respondWithResult(_0x806f08,_0x423a19){_0x423a19=_0x423a19||0xc8;return function(_0x1c291e){if(_0x1c291e){return _0x806f08['status'](_0x423a19)[_0xaa41('0x10')](_0x1c291e);}};}function respondWithFilteredResult(_0x10cda9,_0x524cab){return function(_0x54827c){if(_0x54827c){var _0x1d0a54=typeof _0x524cab['offset']===_0xaa41('0x11')&&typeof _0x524cab[_0xaa41('0x12')]===_0xaa41('0x11');var _0x889d44=_0x54827c[_0xaa41('0x13')];var _0x4eaf81=_0x1d0a54?0x0:_0x524cab[_0xaa41('0x14')];var _0x178170=_0x1d0a54?_0x54827c[_0xaa41('0x13')]:_0x524cab[_0xaa41('0x14')]+_0x524cab[_0xaa41('0x12')];var _0x2005ae;if(_0x178170>=_0x889d44){_0x178170=_0x889d44;_0x2005ae=0xc8;}else{_0x2005ae=0xce;}_0x10cda9[_0xaa41('0xe')](_0x2005ae);return _0x10cda9['set'](_0xaa41('0x15'),_0x4eaf81+'-'+_0x178170+'/'+_0x889d44)[_0xaa41('0x10')](_0x54827c);}return null;};}function saveUpdates(_0x4210fa){return function(_0x391b01){if(_0x391b01){return _0x391b01[_0xaa41('0x16')](_0x4210fa)[_0xaa41('0x17')](function(_0x29efe5){return _0x29efe5;});}return null;};}function removeEntity(_0x46e6d3){return function(_0x150ddf){if(_0x150ddf){return _0x150ddf['destroy']()['then'](function(){var _0x1f502a=_0x150ddf[_0xaa41('0x18')]({'plain':!![]});var _0x35c753=[{'name':'VoiceQueues','value':_0xaa41('0x19'),'ignore':![]},{'name':_0xaa41('0x1a'),'value':'outbound','ignore':![]}];var _0x513c61=_(_0x35c753)[_0xaa41('0x1b')]('ignore')[_0xaa41('0x1c')](_0xaa41('0x1d'))[_0xaa41('0x1d')]();if(_[_0xaa41('0x1e')](_0x513c61,_0x1f502a[_0xaa41('0x1f')])){return;}var _0x4eb01f=_[_0xaa41('0x20')](_0x35c753,[_0xaa41('0x1d'),_0x1f502a[_0xaa41('0x1f')]])[_0xaa41('0x21')];return db[_0xaa41('0x22')][_0xaa41('0x23')]({'where':{'type':_0x4eb01f,'resourceId':_0x1f502a['id']}})['then'](function(){return _0x150ddf;});})['then'](function(){_0x46e6d3[_0xaa41('0xe')](0xcc)['end']();});}};}function handleEntityNotFound(_0x493a10){return function(_0x12e362){if(!_0x12e362){_0x493a10['sendStatus'](0x194);}return _0x12e362;};}function handleError(_0x536bed,_0x2d0ac0){_0x2d0ac0=_0x2d0ac0||0x1f4;return function(_0x9c8c21){logger[_0xaa41('0x24')](_0x9c8c21[_0xaa41('0x25')]);if(_0x9c8c21[_0xaa41('0x21')]){delete _0x9c8c21[_0xaa41('0x21')];}_0x536bed['status'](_0x2d0ac0)[_0xaa41('0x26')](_0x9c8c21);};}exports[_0xaa41('0x27')]=function(_0x63c18c,_0x9a16e3){var _0x1d8c2b={};var _0x4466a3={'count':0x0,'rows':[]};var _0x30f88e=_[_0xaa41('0x1c')](db['VoiceQueue'][_0xaa41('0x28')],function(_0x48b48b){return{'name':_0x48b48b['fieldName'],'type':_0x48b48b[_0xaa41('0x1f')][_0xaa41('0x29')]};});_0x1d8c2b=qs['getOptions'](_0x30f88e,_0x63c18c);var _0x392b5d={'where':_0x1d8c2b[_0xaa41('0x2a')]};return db['VoiceQueue']['count'](_0x392b5d)['then'](function(_0x1cf3da){_0x4466a3[_0xaa41('0x13')]=_0x1cf3da;_0x1d8c2b[_0xaa41('0x2b')]=qs[_0xaa41('0x2b')](_0x63c18c['query']);return db[_0xaa41('0x2c')][_0xaa41('0x2d')](_0x1d8c2b);})[_0xaa41('0x17')](function(_0x4de770){_0x4466a3[_0xaa41('0x2e')]=_0x4de770;return _0x4466a3;})[_0xaa41('0x17')](respondWithFilteredResult(_0x9a16e3,_0x1d8c2b))[_0xaa41('0x2f')](handleError(_0x9a16e3,null));};exports['show']=function(_0x252c62,_0x374117){var _0x57fe1d={'raw':![],'where':{'id':_0x252c62[_0xaa41('0x30')]['id']}},_0x23eb50={};_0x23eb50[_0xaa41('0x31')]=_['keys'](db[_0xaa41('0x2c')]['rawAttributes']);_0x23eb50[_0xaa41('0x32')]=_[_0xaa41('0x33')](_0x252c62[_0xaa41('0x32')]);_0x23eb50['filters']=_['intersection'](_0x23eb50['model'],_0x23eb50[_0xaa41('0x32')]);_0x57fe1d[_0xaa41('0x34')]=_[_0xaa41('0x35')](_0x23eb50[_0xaa41('0x31')],qs['fields'](_0x252c62['query'][_0xaa41('0x36')]));_0x57fe1d[_0xaa41('0x34')]=_0x57fe1d[_0xaa41('0x34')][_0xaa41('0x37')]?_0x57fe1d[_0xaa41('0x34')]:_0x23eb50[_0xaa41('0x31')];if(_0x252c62[_0xaa41('0x32')]['includeAll']){_0x57fe1d[_0xaa41('0x2b')]=[{'all':!![]}];}_0x57fe1d=_[_0xaa41('0x38')]({},_0x57fe1d,_0x252c62[_0xaa41('0x39')]);return db[_0xaa41('0x2c')]['find'](_0x57fe1d)['then'](handleEntityNotFound(_0x374117,null))[_0xaa41('0x17')](respondWithResult(_0x374117,null))[_0xaa41('0x2f')](handleError(_0x374117,null));};exports['create']=function(_0x4101ab,_0x563687){return db[_0xaa41('0x2c')][_0xaa41('0x3a')](_0x4101ab[_0xaa41('0x3b')],{})[_0xaa41('0x17')](function(_0x3e6cac){var _0x12ba1a=_0x4101ab[_0xaa41('0x3c')][_0xaa41('0x18')]({'plain':!![]});if(!_0x12ba1a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x12ba1a[_0xaa41('0x3d')]===_0xaa41('0x3c')){var _0x35c685=_0x3e6cac[_0xaa41('0x18')]({'plain':!![]});var _0xc84fb8=[{'name':_0xaa41('0x3e'),'value':'inbound'},{'name':'QueueCampaigns','value':_0xaa41('0x3f')}];var _0x4f9086=_[_0xaa41('0x20')](_0xc84fb8,[_0xaa41('0x1d'),_0x35c685[_0xaa41('0x1f')]])[_0xaa41('0x21')];return db[_0xaa41('0x40')][_0xaa41('0x20')]({'where':{'name':_0x4f9086,'userProfileId':_0x12ba1a[_0xaa41('0x41')]},'raw':!![]})['then'](function(_0x124992){if(_0x124992&&_0x124992['autoAssociation']===0x0){return db['UserProfileResource'][_0xaa41('0x3a')]({'name':_0x35c685['name'],'resourceId':_0x35c685['id'],'type':_0x124992['name'],'sectionId':_0x124992['id']},{})['then'](function(){return _0x3e6cac;});}else{return _0x3e6cac;}})[_0xaa41('0x2f')](function(_0x525b09){logger[_0xaa41('0x24')](_0xaa41('0x42'),_0x525b09);throw _0x525b09;});}return _0x3e6cac;})['then'](respondWithResult(_0x563687,0xc9))['catch'](handleError(_0x563687,null));};exports[_0xaa41('0x43')]=function(_0x1b7b97,_0x1bb973){var _0x2af8ba={'where':{'id':_0x1b7b97[_0xaa41('0x30')]['id']}},_0x3fe1a9={};_0x3fe1a9[_0xaa41('0x31')]=_[_0xaa41('0x33')](db[_0xaa41('0x2c')]['rawAttributes']);_0x2af8ba[_0xaa41('0x34')]=_[_0xaa41('0x35')](_0x3fe1a9[_0xaa41('0x31')],qs[_0xaa41('0x36')](_0x1b7b97[_0xaa41('0x32')][_0xaa41('0x36')]));_0x2af8ba['attributes']=_0x2af8ba[_0xaa41('0x34')][_0xaa41('0x37')]?_0x2af8ba[_0xaa41('0x34')]:_0x3fe1a9[_0xaa41('0x31')];if(_0x1b7b97['query'][_0xaa41('0x44')]){_0x2af8ba['include']=[{'all':!![]}];}_0x2af8ba=_['merge']({},_0x2af8ba,_0x1b7b97[_0xaa41('0x39')]);return db[_0xaa41('0x2c')][_0xaa41('0x20')](_0x2af8ba)['then'](handleEntityNotFound(_0x1bb973,null))[_0xaa41('0x17')](function(_0x3e1a73){if(_0x3e1a73){var _0x853ccb=_0x3e1a73['get']({'plain':!![]});_0x853ccb=qs[_0xaa41('0x45')](_0x853ccb,['id',_0xaa41('0x46'),_0xaa41('0x47')]);_0x1b7b97[_0xaa41('0x3b')]=_[_0xaa41('0x45')](_0x1b7b97[_0xaa41('0x3b')],['id',_0xaa41('0x46'),_0xaa41('0x47')]);return db['VoiceQueue'][_0xaa41('0x3a')](_['merge'](_0x853ccb,_0x1b7b97['body']),{'include':_0x1b7b97[_0xaa41('0x32')][_0xaa41('0x44')]?[{'all':!![]}]:undefined})[_0xaa41('0x17')](function(_0x11f7d9){var _0x14aab0=_0x1b7b97[_0xaa41('0x3c')][_0xaa41('0x18')]({'plain':!![]});if(!_0x14aab0)throw new Error(_0xaa41('0x48'));if(_0x14aab0['role']===_0xaa41('0x3c')){var _0x14b0f0=_0x11f7d9[_0xaa41('0x18')]({'plain':!![]});var _0x4f9e92=[{'name':_0xaa41('0x3e'),'value':_0xaa41('0x19')},{'name':'QueueCampaigns','value':_0xaa41('0x3f')}];var _0xd36d1a=_[_0xaa41('0x20')](_0x4f9e92,['value',_0x14b0f0[_0xaa41('0x1f')]])[_0xaa41('0x21')];return db['UserProfileSection']['find']({'where':{'name':_0xd36d1a,'userProfileId':_0x14aab0[_0xaa41('0x41')]},'raw':!![]})[_0xaa41('0x17')](function(_0x3a29d2){if(_0x3a29d2&&_0x3a29d2['autoAssociation']===0x0){return db[_0xaa41('0x22')][_0xaa41('0x3a')]({'name':_0x14b0f0[_0xaa41('0x21')],'resourceId':_0x14b0f0['id'],'type':_0x3a29d2[_0xaa41('0x21')],'sectionId':_0x3a29d2['id']},{})[_0xaa41('0x17')](function(){return _0x11f7d9;});}else{return _0x11f7d9;}})['catch'](function(_0x2ae70c){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2ae70c);throw _0x2ae70c;});}return _0x11f7d9;});}})[_0xaa41('0x17')](respondWithResult(_0x1bb973,0xc9))['catch'](handleError(_0x1bb973,null));};exports[_0xaa41('0x16')]=function(_0xbbf261,_0x169ddf){if(_0xbbf261['body']['id']){delete _0xbbf261[_0xaa41('0x3b')]['id'];}return db[_0xaa41('0x2c')][_0xaa41('0x20')]({'where':{'id':_0xbbf261[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x169ddf,null))[_0xaa41('0x17')](saveUpdates(_0xbbf261[_0xaa41('0x3b')],null))[_0xaa41('0x17')](respondWithResult(_0x169ddf,null))[_0xaa41('0x2f')](handleError(_0x169ddf,null));};exports['destroy']=function(_0x35a09e,_0x40cdfc){return db[_0xaa41('0x2c')]['find']({'where':{'id':_0x35a09e[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x40cdfc,null))[_0xaa41('0x17')](removeEntity(_0x40cdfc,null))[_0xaa41('0x2f')](handleError(_0x40cdfc,null));};exports[_0xaa41('0x49')]=function(_0xfbe748,_0x320ce7){var _0x5ea056={'raw':![],'where':{}};var _0x55a85c={};var _0x5cb34d={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0xfbe748['params']['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x320ce7,null))['then'](function(_0x576e6e){if(_0x576e6e){_0x55a85c[_0xaa41('0x31')]=_[_0xaa41('0x33')](db[_0xaa41('0x4a')][_0xaa41('0x28')]);_0x55a85c['query']=_[_0xaa41('0x33')](_0xfbe748[_0xaa41('0x32')]);_0x55a85c[_0xaa41('0x4b')]=_[_0xaa41('0x35')](_0x55a85c[_0xaa41('0x31')],_0x55a85c[_0xaa41('0x32')]);_0x5ea056[_0xaa41('0x34')]=_[_0xaa41('0x35')](_0x55a85c[_0xaa41('0x31')],qs['fields'](_0xfbe748[_0xaa41('0x32')][_0xaa41('0x36')]));_0x5ea056['attributes']=_0x5ea056['attributes']['length']?_0x5ea056[_0xaa41('0x34')]:_0x55a85c['model'];if(!_0xfbe748[_0xaa41('0x32')]['hasOwnProperty'](_0xaa41('0x4c'))){_0x5ea056[_0xaa41('0x12')]=qs['limit'](_0xfbe748[_0xaa41('0x32')][_0xaa41('0x12')]);_0x5ea056[_0xaa41('0x14')]=qs[_0xaa41('0x14')](_0xfbe748['query']['offset']);}_0x5ea056[_0xaa41('0x4d')]=qs[_0xaa41('0x4e')](_0xfbe748['query']['sort']);_0x5ea056[_0xaa41('0x2a')]=qs[_0xaa41('0x4b')](_[_0xaa41('0x4f')](_0xfbe748[_0xaa41('0x32')],_0x55a85c[_0xaa41('0x4b')]));_0x5ea056['where'][_0xaa41('0x50')]=_0x576e6e['id'];if(_0xfbe748['query']['filter']){_0x5ea056['where']=_[_0xaa41('0x38')](_0x5ea056[_0xaa41('0x2a')],{'$or':_[_0xaa41('0x1c')](_0x5ea056['attributes'],function(_0x229297){var _0x2adf93={};_0x2adf93[_0x229297]={'$like':'%'+_0xfbe748[_0xaa41('0x32')][_0xaa41('0x1b')]+'%'};return _0x2adf93;})});}_0x5ea056=_[_0xaa41('0x38')]({},_0x5ea056,_0xfbe748[_0xaa41('0x39')]);return db[_0xaa41('0x4a')]['count']({'where':_0x5ea056[_0xaa41('0x2a')]})[_0xaa41('0x17')](function(_0x40b47c){_0x5cb34d[_0xaa41('0x13')]=_0x40b47c;if(_0xfbe748['query'][_0xaa41('0x44')]){_0x5ea056['include']=[{'all':!![]}];}return db[_0xaa41('0x4a')][_0xaa41('0x2d')](_0x5ea056);})[_0xaa41('0x17')](function(_0x143ef0){_0x5cb34d['rows']=_0x143ef0;return _0x5cb34d;});}})[_0xaa41('0x17')](respondWithFilteredResult(_0x320ce7,_0x5ea056))[_0xaa41('0x2f')](handleError(_0x320ce7,null));};exports[_0xaa41('0x51')]=function(_0x304aad,_0x59052d){var _0x140d78={'raw':!![],'where':{}};var _0x50197b={};var _0x55d380={'count':0x0,'rows':[]};return db[_0xaa41('0x2c')]['findOne']({'where':{'id':_0x304aad[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x59052d,null))[_0xaa41('0x17')](function(_0x582d79){if(_0x582d79){_0x50197b[_0xaa41('0x31')]=_[_0xaa41('0x33')](db[_0xaa41('0x52')][_0xaa41('0x28')]);_0x50197b[_0xaa41('0x32')]=_[_0xaa41('0x33')](_0x304aad[_0xaa41('0x32')]);_0x50197b['filters']=_[_0xaa41('0x35')](_0x50197b[_0xaa41('0x31')],_0x50197b[_0xaa41('0x32')]);_0x140d78['attributes']=_['intersection'](_0x50197b[_0xaa41('0x31')],qs[_0xaa41('0x36')](_0x304aad['query'][_0xaa41('0x36')]));_0x140d78[_0xaa41('0x34')]=_0x140d78['attributes'][_0xaa41('0x37')]?_0x140d78[_0xaa41('0x34')]:_0x50197b[_0xaa41('0x31')];if(!_0x304aad[_0xaa41('0x32')][_0xaa41('0x53')](_0xaa41('0x4c'))){_0x140d78[_0xaa41('0x12')]=qs[_0xaa41('0x12')](_0x304aad['query']['limit']);_0x140d78[_0xaa41('0x14')]=qs['offset'](_0x304aad[_0xaa41('0x32')][_0xaa41('0x14')]);}_0x140d78[_0xaa41('0x4d')]=qs['sort'](_0x304aad[_0xaa41('0x32')][_0xaa41('0x4e')]);_0x140d78[_0xaa41('0x2a')]=qs['filters'](_[_0xaa41('0x4f')](_0x304aad[_0xaa41('0x32')],_0x50197b['filters']));_0x140d78[_0xaa41('0x2a')]['VoiceQueueId']=_0x582d79['id'];if(_0x304aad['query'][_0xaa41('0x1b')]){_0x140d78[_0xaa41('0x2a')]=_['merge'](_0x140d78['where'],{'$or':_[_0xaa41('0x1c')](_0x140d78[_0xaa41('0x34')],function(_0x3c189d){var _0x447183={};_0x447183[_0x3c189d]={'$like':'%'+_0x304aad['query'][_0xaa41('0x1b')]+'%'};return _0x447183;})});}_0x140d78=_[_0xaa41('0x38')]({},_0x140d78,_0x304aad[_0xaa41('0x39')]);return db['CmHopperHistory'][_0xaa41('0x13')]({'where':_0x140d78[_0xaa41('0x2a')]})[_0xaa41('0x17')](function(_0x5697b6){_0x55d380[_0xaa41('0x13')]=_0x5697b6;if(_0x304aad['query']['includeAll']){_0x140d78[_0xaa41('0x2b')]=[{'all':!![]}];}return db[_0xaa41('0x52')]['findAll'](_0x140d78);})[_0xaa41('0x17')](function(_0x9e8ebb){_0x55d380[_0xaa41('0x2e')]=_0x9e8ebb;return _0x55d380;});}})['then'](respondWithFilteredResult(_0x59052d,_0x140d78))[_0xaa41('0x2f')](handleError(_0x59052d,null));};exports[_0xaa41('0x54')]=function(_0x1a2deb,_0x16dcac){var _0x38f5d0={'raw':!![],'where':{}};var _0x4e087d={};var _0x24eb2e={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xaa41('0x55')]({'where':{'id':_0x1a2deb[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x16dcac,null))[_0xaa41('0x17')](function(_0x33ec81){if(_0x33ec81){_0x4e087d[_0xaa41('0x31')]=_[_0xaa41('0x33')](db[_0xaa41('0x56')][_0xaa41('0x28')]);_0x4e087d[_0xaa41('0x32')]=_[_0xaa41('0x33')](_0x1a2deb['query']);_0x4e087d[_0xaa41('0x4b')]=_[_0xaa41('0x35')](_0x4e087d['model'],_0x4e087d[_0xaa41('0x32')]);_0x38f5d0['attributes']=_[_0xaa41('0x35')](_0x4e087d[_0xaa41('0x31')],qs[_0xaa41('0x36')](_0x1a2deb[_0xaa41('0x32')][_0xaa41('0x36')]));_0x38f5d0[_0xaa41('0x34')]=_0x38f5d0[_0xaa41('0x34')]['length']?_0x38f5d0[_0xaa41('0x34')]:_0x4e087d[_0xaa41('0x31')];if(!_0x1a2deb[_0xaa41('0x32')][_0xaa41('0x53')]('nolimit')){_0x38f5d0[_0xaa41('0x12')]=qs['limit'](_0x1a2deb[_0xaa41('0x32')][_0xaa41('0x12')]);_0x38f5d0[_0xaa41('0x14')]=qs[_0xaa41('0x14')](_0x1a2deb[_0xaa41('0x32')]['offset']);}_0x38f5d0[_0xaa41('0x4d')]=qs[_0xaa41('0x4e')](_0x1a2deb['query'][_0xaa41('0x4e')]);_0x38f5d0[_0xaa41('0x2a')]=qs[_0xaa41('0x4b')](_[_0xaa41('0x4f')](_0x1a2deb[_0xaa41('0x32')],_0x4e087d[_0xaa41('0x4b')]));_0x38f5d0[_0xaa41('0x2a')][_0xaa41('0x50')]=_0x33ec81['id'];if(_0x1a2deb['query'][_0xaa41('0x1b')]){_0x38f5d0[_0xaa41('0x2a')]=_[_0xaa41('0x38')](_0x38f5d0[_0xaa41('0x2a')],{'$or':_[_0xaa41('0x1c')](_0x38f5d0[_0xaa41('0x34')],function(_0x5489be){var _0x56f5ff={};_0x56f5ff[_0x5489be]={'$like':'%'+_0x1a2deb['query'][_0xaa41('0x1b')]+'%'};return _0x56f5ff;})});}_0x38f5d0=_[_0xaa41('0x38')]({},_0x38f5d0,_0x1a2deb['options']);return db[_0xaa41('0x56')][_0xaa41('0x13')]({'where':_0x38f5d0['where']})[_0xaa41('0x17')](function(_0x1da898){_0x24eb2e[_0xaa41('0x13')]=_0x1da898;if(_0x1a2deb[_0xaa41('0x32')]['includeAll']){_0x38f5d0[_0xaa41('0x2b')]=[{'all':!![]}];}return db['CmHopperFinal'][_0xaa41('0x2d')](_0x38f5d0);})[_0xaa41('0x17')](function(_0x374873){_0x24eb2e[_0xaa41('0x2e')]=_0x374873;return _0x24eb2e;});}})[_0xaa41('0x17')](respondWithFilteredResult(_0x16dcac,_0x38f5d0))[_0xaa41('0x2f')](handleError(_0x16dcac,null));};exports[_0xaa41('0x57')]=function(_0x27363e,_0x25cac8){var _0x5381d5={'raw':!![],'where':{}};var _0x276013={};var _0x3135c3={'count':0x0,'rows':[]};return db[_0xaa41('0x2c')]['findOne']({'where':{'id':_0x27363e[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x25cac8,null))[_0xaa41('0x17')](function(_0x408d95){if(_0x408d95){_0x276013[_0xaa41('0x31')]=_[_0xaa41('0x33')](db[_0xaa41('0x58')][_0xaa41('0x28')]);_0x276013[_0xaa41('0x32')]=_[_0xaa41('0x33')](_0x27363e[_0xaa41('0x32')]);_0x276013['filters']=_[_0xaa41('0x35')](_0x276013[_0xaa41('0x31')],_0x276013[_0xaa41('0x32')]);_0x5381d5[_0xaa41('0x34')]=_[_0xaa41('0x35')](_0x276013['model'],qs['fields'](_0x27363e[_0xaa41('0x32')][_0xaa41('0x36')]));_0x5381d5['attributes']=_0x5381d5[_0xaa41('0x34')][_0xaa41('0x37')]?_0x5381d5['attributes']:_0x276013['model'];if(!_0x27363e['query'][_0xaa41('0x53')](_0xaa41('0x4c'))){_0x5381d5[_0xaa41('0x12')]=qs[_0xaa41('0x12')](_0x27363e[_0xaa41('0x32')][_0xaa41('0x12')]);_0x5381d5[_0xaa41('0x14')]=qs[_0xaa41('0x14')](_0x27363e[_0xaa41('0x32')][_0xaa41('0x14')]);}_0x5381d5[_0xaa41('0x4d')]=qs['sort'](_0x27363e['query'][_0xaa41('0x4e')]);_0x5381d5[_0xaa41('0x2a')]=qs['filters'](_[_0xaa41('0x4f')](_0x27363e['query'],_0x276013[_0xaa41('0x4b')]));_0x5381d5[_0xaa41('0x2a')][_0xaa41('0x50')]=_0x408d95['id'];if(_0x27363e[_0xaa41('0x32')][_0xaa41('0x1b')]){_0x5381d5[_0xaa41('0x2a')]=_[_0xaa41('0x38')](_0x5381d5[_0xaa41('0x2a')],{'$or':_[_0xaa41('0x1c')](_0x5381d5['attributes'],function(_0x56bd21){var _0x56661a={};_0x56661a[_0x56bd21]={'$like':'%'+_0x27363e[_0xaa41('0x32')][_0xaa41('0x1b')]+'%'};return _0x56661a;})});}_0x5381d5=_['merge']({},_0x5381d5,_0x27363e['options']);return db[_0xaa41('0x58')][_0xaa41('0x13')]({'where':_0x5381d5['where']})['then'](function(_0xf651b7){_0x3135c3['count']=_0xf651b7;if(_0x27363e[_0xaa41('0x32')][_0xaa41('0x44')]){_0x5381d5[_0xaa41('0x2b')]=[{'all':!![]}];}return db[_0xaa41('0x58')][_0xaa41('0x2d')](_0x5381d5);})[_0xaa41('0x17')](function(_0x211455){_0x3135c3[_0xaa41('0x2e')]=_0x211455;return _0x3135c3;});}})[_0xaa41('0x17')](respondWithFilteredResult(_0x25cac8,_0x5381d5))['catch'](handleError(_0x25cac8,null));};exports['getTeams']=function(_0x38884d,_0x25d938){var _0x337655={};var _0x415705={};var _0x3efb43;var _0xae746;return db[_0xaa41('0x2c')][_0xaa41('0x55')]({'where':{'id':_0x38884d[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x25d938,null))[_0xaa41('0x17')](function(_0x17442e){if(_0x17442e){_0x3efb43=_0x17442e;_0x415705[_0xaa41('0x31')]=_[_0xaa41('0x33')](db[_0xaa41('0x59')]['rawAttributes']);_0x415705[_0xaa41('0x32')]=_['keys'](_0x38884d[_0xaa41('0x32')]);_0x415705[_0xaa41('0x4b')]=_[_0xaa41('0x35')](_0x415705[_0xaa41('0x31')],_0x415705[_0xaa41('0x32')]);_0x337655[_0xaa41('0x34')]=_[_0xaa41('0x35')](_0x415705[_0xaa41('0x31')],qs['fields'](_0x38884d[_0xaa41('0x32')][_0xaa41('0x36')]));_0x337655[_0xaa41('0x34')]=_0x337655[_0xaa41('0x34')][_0xaa41('0x37')]?_0x337655[_0xaa41('0x34')]:_0x415705[_0xaa41('0x31')];_0x337655[_0xaa41('0x4d')]=qs[_0xaa41('0x4e')](_0x38884d[_0xaa41('0x32')]['sort']);_0x337655['where']=qs[_0xaa41('0x4b')](_[_0xaa41('0x4f')](_0x38884d[_0xaa41('0x32')],_0x415705[_0xaa41('0x4b')]));if(_0x38884d[_0xaa41('0x32')][_0xaa41('0x1b')]){_0x337655[_0xaa41('0x2a')]=_[_0xaa41('0x38')](_0x337655[_0xaa41('0x2a')],{'$or':_[_0xaa41('0x1c')](_0x337655['attributes'],function(_0x49b468){var _0x17018e={};_0x17018e[_0x49b468]={'$like':'%'+_0x38884d[_0xaa41('0x32')]['filter']+'%'};return _0x17018e;})});}_0x337655=_[_0xaa41('0x38')]({},_0x337655,_0x38884d['options']);return _0x3efb43[_0xaa41('0x5a')](_0x337655);}})[_0xaa41('0x17')](function(_0x50e03d){if(_0x50e03d){_0xae746=_0x50e03d['length'];if(!_0x38884d[_0xaa41('0x32')][_0xaa41('0x53')](_0xaa41('0x4c'))){_0x337655['limit']=qs['limit'](_0x38884d[_0xaa41('0x32')]['limit']);_0x337655[_0xaa41('0x14')]=qs['offset'](_0x38884d[_0xaa41('0x32')][_0xaa41('0x14')]);}return _0x3efb43[_0xaa41('0x5a')](_0x337655);}})[_0xaa41('0x17')](function(_0x182b0b){if(_0x182b0b){return _0x182b0b?{'count':_0xae746,'rows':_0x182b0b}:null;}})[_0xaa41('0x17')](respondWithResult(_0x25d938,null))[_0xaa41('0x2f')](handleError(_0x25d938,null));};exports['addTeams']=function(_0x4363b5,_0x1fa1f5){var _0x50883c=_0x4363b5[_0xaa41('0x3b')][_0xaa41('0x5b')];var _0x1c3d7f=_[_0xaa41('0x1c')](_0x50883c,'id');return db['Team'][_0xaa41('0x2d')]({'where':{'id':_0x1c3d7f},'attributes':['id'],'include':[{'model':db[_0xaa41('0x5c')],'as':_0xaa41('0x5d'),'attributes':['id',_0xaa41('0x21'),_0xaa41('0x5e'),_0xaa41('0x5f'),_0xaa41('0x60')],'raw':!![]}]})[_0xaa41('0x17')](function(_0xe2574a){if(_0xe2574a){var _0x4d83ce=_['flatMap'](_0xe2574a,function(_0x214ebe){var _0x2df75c=_0x214ebe[_0xaa41('0x18')]({'plain':!![]});_0x2df75c[_0xaa41('0x5d')][_0xaa41('0x61')](function(_0x401586){_0x401586['penalty']=_[_0xaa41('0x20')](_0x50883c,{'id':_0x2df75c['id']})[_0xaa41('0x62')];});return _0x2df75c[_0xaa41('0x5d')];});return db[_0xaa41('0x2c')][_0xaa41('0x20')]({'where':{'id':_0x4363b5[_0xaa41('0x30')]['id']}})['then'](function(_0xe8076e){return db[_0xaa41('0x63')][_0xaa41('0x64')](function(_0x4cf0c5){return _0xe8076e[_0xaa41('0x65')](_0x1c3d7f,{'transaction':_0x4cf0c5})[_0xaa41('0x17')](function(){return BPromise[_0xaa41('0x66')](_0x50883c,function(_0x255e76){return db[_0xaa41('0x67')][_0xaa41('0x68')]({'TeamId':_0x255e76['id'],'VoiceQueueId':_0x4363b5[_0xaa41('0x30')]['id'],'penalty':_0x255e76[_0xaa41('0x62')]},{'transaction':_0x4cf0c5});});})[_0xaa41('0x17')](function(){return BPromise[_0xaa41('0x66')](_0x4d83ce,function(_0x19a42c){return db[_0xaa41('0x69')][_0xaa41('0x6a')]({'where':{'UserId':_0x19a42c['id'],'VoiceQueueId':_0x4363b5['params']['id']},'defaults':{'penalty':_0x19a42c['penalty']},'transaction':_0x4cf0c5});});})[_0xaa41('0x17')](function(){return BPromise[_0xaa41('0x66')](_[_0xaa41('0x1b')](_0x4d83ce,{'online':!![]}),function(_0x2c4595){return db[_0xaa41('0x6b')][_0xaa41('0x68')]({'membername':_0x2c4595[_0xaa41('0x21')],'UserId':_0x2c4595['id'],'queue_name':_0xe8076e['name'],'VoiceQueueId':_0xe8076e['id'],'interface':_[_0xaa41('0x6c')](_0x2c4595[_0xaa41('0x60')])?util[_0xaa41('0x6d')](_0xaa41('0x6e'),_0x2c4595[_0xaa41('0x21')]):_0x2c4595[_0xaa41('0x60')],'paused':_0x2c4595[_0xaa41('0x5f')]||![],'penalty':_0x2c4595[_0xaa41('0x62')]},{'transaction':_0x4cf0c5});});})[_0xaa41('0x17')](function(){_0x4d83ce[_0xaa41('0x61')](function(_0x3f2dbb){socket[_0xaa41('0x6f')]('userVoiceQueue:save',{'UserId':_0x3f2dbb['id'],'VoiceQueueId':_0xe8076e['id']});});});});});}})[_0xaa41('0x17')](respondWithStatusCode(_0x1fa1f5,null))[_0xaa41('0x2f')](handleError(_0x1fa1f5,null));};exports['removeTeams']=function(_0x33f008,_0x1489fe){return db[_0xaa41('0x59')][_0xaa41('0x2d')]({'where':{'id':_0x33f008['query'][_0xaa41('0x70')]},'attributes':['id'],'include':[{'model':db[_0xaa41('0x5c')],'as':_0xaa41('0x5d'),'attributes':['id'],'raw':!![]}]})[_0xaa41('0x17')](handleEntityNotFound(_0x1489fe,null))[_0xaa41('0x17')](function(_0x4baae3){var _0xc59a12=_['map'](_0x4baae3,'id');var _0x50a526=[];var _0x3dd3fa=[];var _0x552493=squel['select']();_0x552493[_0xaa41('0x71')](_0xaa41('0x72'))[_0xaa41('0x73')]('team_has_voice_queues','tq')[_0xaa41('0x74')](_0xaa41('0x75'),'ut',_0xaa41('0x76'))[_0xaa41('0x2a')](_0xaa41('0x77'),_0x33f008[_0xaa41('0x30')]['id']);for(var _0x29d34a=0x0;_0x29d34a<_0x4baae3[_0xaa41('0x37')];_0x29d34a+=0x1){let _0x48e2cf=_0x4baae3[_0x29d34a];for(var _0x410d6e=0x0;_0x410d6e<_0x48e2cf[_0xaa41('0x5d')][_0xaa41('0x37')];_0x410d6e+=0x1){let _0x3361f5=_0x48e2cf[_0xaa41('0x5d')][_0x410d6e];var _0x4f1bcb=_0x552493['clone']();_0x4f1bcb[_0xaa41('0x2a')](_0xaa41('0x78'),_0x3361f5['id']);_0x3dd3fa[_0xaa41('0x79')](db[_0xaa41('0x63')][_0xaa41('0x32')](_0x4f1bcb[_0xaa41('0x7a')](),{'type':db['sequelize'][_0xaa41('0x7b')][_0xaa41('0x7c')]})['then'](function(_0x40f4ce){if(_0x40f4ce[_0xaa41('0x37')]===0x1){return _0x3361f5['id'];}else{var _0x95300a=_[_0xaa41('0x7d')](_[_0xaa41('0x1c')](_0x40f4ce,_0xaa41('0x7e')),function(_0x1926bd){return _['includes'](_0xc59a12,_0x1926bd);});if(_0x95300a){return _0x3361f5['id'];}}}));}}return BPromise[_0xaa41('0x7f')](_0x3dd3fa)[_0xaa41('0x17')](function(_0x5404cd){_0x50a526=_(_0x50a526)[_0xaa41('0x80')](_0x5404cd)[_0xaa41('0x81')]()[_0xaa41('0x1d')]();return db[_0xaa41('0x2c')]['find']({'where':{'id':_0x33f008[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](function(_0x339537){return db[_0xaa41('0x63')][_0xaa41('0x64')](function(_0x4b84bc){return _0x339537[_0xaa41('0x82')](_0x33f008[_0xaa41('0x32')]['ids'],{'transaction':_0x4b84bc})['then'](function(){if(!_[_0xaa41('0x83')](_0x50a526)){return _0x339537[_0xaa41('0x84')](_0x50a526,{'transaction':_0x4b84bc})[_0xaa41('0x17')](function(){return db[_0xaa41('0x6b')][_0xaa41('0x23')]({'where':{'VoiceQueueId':_0x33f008[_0xaa41('0x30')]['id'],'UserId':_0x50a526},'transaction':_0x4b84bc});});}})['then'](function(){_0x50a526['forEach'](function(_0x395323){socket[_0xaa41('0x6f')]('userVoiceQueue:remove',{'UserId':_0x395323,'VoiceQueueId':_0x339537['id']});});});});});});})['then'](respondWithStatusCode(_0x1489fe,null))[_0xaa41('0x2f')](handleError(_0x1489fe,null));};exports[_0xaa41('0x85')]=function(_0x2fe50f,_0x520b50){var _0x50122d,_0x1d609e;return db[_0xaa41('0x2c')][_0xaa41('0x20')]({'where':{'id':_0x2fe50f['params']['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x520b50,null))[_0xaa41('0x17')](function(_0x5a0791){if(_0x5a0791){_0x1d609e=_0x5a0791;return _0x5a0791['addAgents'](_0x2fe50f[_0xaa41('0x3b')]['ids'],_[_0xaa41('0x45')](_0x2fe50f[_0xaa41('0x3b')],[_0xaa41('0x70'),'id'])||{})[_0xaa41('0x86')](function(_0x1d7c2e){for(var _0xdc0493=0x0;_0xdc0493<_0x2fe50f[_0xaa41('0x3b')]['ids'][_0xaa41('0x37')];_0xdc0493+=0x1){socket[_0xaa41('0x6f')]('userVoiceQueue:save',{'UserId':Number(_0x2fe50f[_0xaa41('0x3b')][_0xaa41('0x70')][_0xdc0493]),'VoiceQueueId':Number(_0x2fe50f[_0xaa41('0x30')]['id'])});}return _0x1d7c2e;});}})[_0xaa41('0x17')](function(_0x2af16e){_0x50122d=_0x2af16e||[];if(_0x1d609e){return db[_0xaa41('0x5c')]['findAll']({'where':{'id':_0x2fe50f[_0xaa41('0x3b')][_0xaa41('0x70')]},'attributes':['id',_0xaa41('0x21'),_0xaa41('0x5e'),_0xaa41('0x5f'),_0xaa41('0x60')],'raw':!![]});}})[_0xaa41('0x17')](function(_0x5083ff){if(!_[_0xaa41('0x83')](_0x5083ff)){var _0x3c4e89=[];for(var _0x415acc=0x0;_0x415acc<_0x5083ff['length'];_0x415acc++){if(_0x5083ff[_0x415acc]['online']){_0x3c4e89['push'](db[_0xaa41('0x6b')][_0xaa41('0x68')]({'membername':_0x5083ff[_0x415acc][_0xaa41('0x21')],'UserId':_0x5083ff[_0x415acc]['id'],'queue_name':_0x1d609e[_0xaa41('0x21')],'VoiceQueueId':_0x1d609e['id'],'interface':_[_0xaa41('0x6c')](_0x5083ff[_0x415acc]['interface'])?util[_0xaa41('0x6d')](_0xaa41('0x6e'),_0x5083ff[_0x415acc][_0xaa41('0x21')]):_0x5083ff[_0x415acc][_0xaa41('0x60')],'paused':_0x5083ff[_0x415acc][_0xaa41('0x5f')]||![],'penalty':_0x2fe50f[_0xaa41('0x3b')][_0xaa41('0x62')]||0x0}));}}return BPromise['all'](_0x3c4e89);}})[_0xaa41('0x17')](function(){return _0x50122d;})[_0xaa41('0x17')](respondWithResult(_0x520b50,null))[_0xaa41('0x2f')](handleError(_0x520b50,null));};exports['removeAgents']=function(_0x16a173,_0x53a519){return db['VoiceQueue'][_0xaa41('0x20')]({'where':{'id':_0x16a173['params']['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x53a519,null))[_0xaa41('0x17')](function(_0x366705){if(_0x366705){return _0x366705[_0xaa41('0x84')](_0x16a173[_0xaa41('0x32')][_0xaa41('0x70')])[_0xaa41('0x17')](function(){if(_['isArray'](_0x16a173[_0xaa41('0x32')][_0xaa41('0x70')])){for(var _0x3ee9e3=0x0;_0x3ee9e3<_0x16a173[_0xaa41('0x32')][_0xaa41('0x70')][_0xaa41('0x37')];_0x3ee9e3+=0x1){socket[_0xaa41('0x6f')](_0xaa41('0x87'),{'UserId':Number(_0x16a173[_0xaa41('0x32')][_0xaa41('0x70')][_0x3ee9e3]),'VoiceQueueId':Number(_0x16a173[_0xaa41('0x30')]['id'])});}}else{socket[_0xaa41('0x6f')](_0xaa41('0x87'),{'UserId':Number(_0x16a173[_0xaa41('0x32')][_0xaa41('0x70')]),'VoiceQueueId':Number(_0x16a173[_0xaa41('0x30')]['id'])});}});}})['then'](function(_0x29b27e){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x16a173['params']['id'],'UserId':_0x16a173[_0xaa41('0x32')][_0xaa41('0x70')]}})['then'](function(){return _0x29b27e;});})[_0xaa41('0x17')](respondWithStatusCode(_0x53a519,null))[_0xaa41('0x2f')](handleError(_0x53a519,null));};exports[_0xaa41('0x88')]=function(_0x15bb60,_0x232732){var _0x34d857={};var _0x239f1b={};var _0x445925;var _0x1e8591;return db[_0xaa41('0x2c')][_0xaa41('0x55')]({'where':{'id':_0x15bb60[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x232732,null))[_0xaa41('0x17')](function(_0x7bae82){if(_0x7bae82){_0x445925=_0x7bae82;_0x239f1b[_0xaa41('0x31')]=_[_0xaa41('0x33')](db['User'][_0xaa41('0x28')]);_0x239f1b[_0xaa41('0x32')]=_[_0xaa41('0x33')](_0x15bb60[_0xaa41('0x32')]);_0x239f1b['filters']=_[_0xaa41('0x35')](_0x239f1b[_0xaa41('0x31')],_0x239f1b['query']);_0x34d857[_0xaa41('0x34')]=_[_0xaa41('0x35')](_0x239f1b[_0xaa41('0x31')],qs[_0xaa41('0x36')](_0x15bb60[_0xaa41('0x32')][_0xaa41('0x36')]));_0x34d857[_0xaa41('0x34')]=_0x34d857[_0xaa41('0x34')][_0xaa41('0x37')]?_0x34d857[_0xaa41('0x34')]:_0x239f1b['model'];_0x34d857[_0xaa41('0x4d')]=qs[_0xaa41('0x4e')](_0x15bb60[_0xaa41('0x32')][_0xaa41('0x4e')]);_0x34d857[_0xaa41('0x2a')]=qs[_0xaa41('0x4b')](_['pick'](_0x15bb60[_0xaa41('0x32')],_0x239f1b['filters']));if(_0x15bb60[_0xaa41('0x32')][_0xaa41('0x1b')]){_0x34d857[_0xaa41('0x2a')]=_[_0xaa41('0x38')](_0x34d857[_0xaa41('0x2a')],{'$or':_['map'](_0x34d857[_0xaa41('0x34')],function(_0x345002){var _0x5f39b4={};_0x5f39b4[_0x345002]={'$like':'%'+_0x15bb60[_0xaa41('0x32')][_0xaa41('0x1b')]+'%'};return _0x5f39b4;})});}_0x34d857=_[_0xaa41('0x38')]({},_0x34d857,_0x15bb60[_0xaa41('0x39')]);return _0x445925[_0xaa41('0x88')](_0x34d857);}})[_0xaa41('0x17')](function(_0x38b3be){if(_0x38b3be){_0x1e8591=_0x38b3be[_0xaa41('0x37')];if(!_0x15bb60[_0xaa41('0x32')][_0xaa41('0x53')]('nolimit')){_0x34d857[_0xaa41('0x12')]=qs[_0xaa41('0x12')](_0x15bb60[_0xaa41('0x32')]['limit']);_0x34d857['offset']=qs[_0xaa41('0x14')](_0x15bb60['query']['offset']);}return _0x445925[_0xaa41('0x88')](_0x34d857);}})[_0xaa41('0x17')](function(_0xa4dbd3){if(_0xa4dbd3){return _0xa4dbd3?{'count':_0x1e8591,'rows':_0xa4dbd3}:null;}})[_0xaa41('0x17')](respondWithResult(_0x232732,null))['catch'](handleError(_0x232732,null));};exports['getMembers']=function(_0xa63e60,_0xf4f13f){var _0xef0e44={};var _0x46d37f={};var _0x6a6081;var _0x5e3bb2;return db[_0xaa41('0x2c')][_0xaa41('0x55')]({'where':{'id':_0xa63e60['params']['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0xf4f13f,null))[_0xaa41('0x17')](function(_0x4b4a4a){if(_0x4b4a4a){_0x6a6081=_0x4b4a4a;_0x46d37f[_0xaa41('0x31')]=_[_0xaa41('0x33')](db['UserVoiceQueueRt'][_0xaa41('0x28')]);_0x46d37f[_0xaa41('0x32')]=_['keys'](_0xa63e60[_0xaa41('0x32')]);_0x46d37f['filters']=_['intersection'](_0x46d37f[_0xaa41('0x31')],_0x46d37f[_0xaa41('0x32')]);_0xef0e44[_0xaa41('0x34')]=_[_0xaa41('0x35')](_0x46d37f[_0xaa41('0x31')],qs['fields'](_0xa63e60[_0xaa41('0x32')]['fields']));_0xef0e44['attributes']=_0xef0e44[_0xaa41('0x34')][_0xaa41('0x37')]?_0xef0e44[_0xaa41('0x34')]:_0x46d37f[_0xaa41('0x31')];_0xef0e44[_0xaa41('0x4d')]=qs[_0xaa41('0x4e')](_0xa63e60[_0xaa41('0x32')]['sort']);_0xef0e44[_0xaa41('0x2a')]=qs[_0xaa41('0x4b')](_[_0xaa41('0x4f')](_0xa63e60[_0xaa41('0x32')],_0x46d37f[_0xaa41('0x4b')]));if(_0xa63e60[_0xaa41('0x32')][_0xaa41('0x1b')]){_0xef0e44[_0xaa41('0x2a')]=_[_0xaa41('0x38')](_0xef0e44[_0xaa41('0x2a')],{'$or':_[_0xaa41('0x1c')](_0xef0e44[_0xaa41('0x34')],function(_0x5a2ba0){var _0x4fc7d6={};_0x4fc7d6[_0x5a2ba0]={'$like':'%'+_0xa63e60[_0xaa41('0x32')][_0xaa41('0x1b')]+'%'};return _0x4fc7d6;})});}_0xef0e44=_[_0xaa41('0x38')]({},_0xef0e44,_0xa63e60['options']);return _0x6a6081[_0xaa41('0x89')](_0xef0e44);}})[_0xaa41('0x17')](function(_0x15bc15){if(_0x15bc15){_0x5e3bb2=_0x15bc15[_0xaa41('0x37')];if(!_0xa63e60[_0xaa41('0x32')][_0xaa41('0x53')](_0xaa41('0x4c'))){_0xef0e44[_0xaa41('0x12')]=qs[_0xaa41('0x12')](_0xa63e60[_0xaa41('0x32')][_0xaa41('0x12')]);_0xef0e44[_0xaa41('0x14')]=qs[_0xaa41('0x14')](_0xa63e60[_0xaa41('0x32')][_0xaa41('0x14')]);}return _0x6a6081['getMembers'](_0xef0e44);}})[_0xaa41('0x17')](function(_0x28c109){return _0x28c109?{'count':_0x5e3bb2,'rows':_0x28c109}:null;})[_0xaa41('0x17')](respondWithResult(_0xf4f13f,null))['catch'](handleError(_0xf4f13f,null));};exports[_0xaa41('0x8a')]=function(_0xfc1e24,_0x35c48f){var _0x2b0bf9={};var _0x21c0c6={};var _0x1138d0;var _0x394987;return db[_0xaa41('0x2c')]['findOne']({'where':{'id':_0xfc1e24[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x35c48f,null))[_0xaa41('0x17')](function(_0x2fc4b1){if(_0x2fc4b1){_0x1138d0=_0x2fc4b1;_0x21c0c6[_0xaa41('0x31')]=_['keys'](db[_0xaa41('0x8b')]['rawAttributes']);_0x21c0c6[_0xaa41('0x32')]=_[_0xaa41('0x33')](_0xfc1e24[_0xaa41('0x32')]);_0x21c0c6[_0xaa41('0x4b')]=_[_0xaa41('0x35')](_0x21c0c6[_0xaa41('0x31')],_0x21c0c6[_0xaa41('0x32')]);_0x2b0bf9[_0xaa41('0x34')]=_[_0xaa41('0x35')](_0x21c0c6[_0xaa41('0x31')],qs[_0xaa41('0x36')](_0xfc1e24[_0xaa41('0x32')]['fields']));_0x2b0bf9['attributes']=_0x2b0bf9[_0xaa41('0x34')][_0xaa41('0x37')]?_0x2b0bf9[_0xaa41('0x34')]:_0x21c0c6[_0xaa41('0x31')];_0x2b0bf9[_0xaa41('0x4d')]=qs[_0xaa41('0x4e')](_0xfc1e24['query'][_0xaa41('0x4e')]);_0x2b0bf9['where']=qs[_0xaa41('0x4b')](_[_0xaa41('0x4f')](_0xfc1e24[_0xaa41('0x32')],_0x21c0c6[_0xaa41('0x4b')]));if(_0xfc1e24[_0xaa41('0x32')][_0xaa41('0x1b')]){_0x2b0bf9['where']=_['merge'](_0x2b0bf9[_0xaa41('0x2a')],{'$or':_['map'](_0x2b0bf9[_0xaa41('0x34')],function(_0x3f8296){var _0x438fcf={};_0x438fcf[_0x3f8296]={'$like':'%'+_0xfc1e24[_0xaa41('0x32')][_0xaa41('0x1b')]+'%'};return _0x438fcf;})});}_0x2b0bf9=_[_0xaa41('0x38')]({},_0x2b0bf9,_0xfc1e24[_0xaa41('0x39')]);return _0x1138d0[_0xaa41('0x8a')](_0x2b0bf9);}})[_0xaa41('0x17')](function(_0x2667bd){if(_0x2667bd){_0x394987=_0x2667bd[_0xaa41('0x37')];if(!_0xfc1e24[_0xaa41('0x32')][_0xaa41('0x53')](_0xaa41('0x4c'))){_0x2b0bf9['limit']=qs[_0xaa41('0x12')](_0xfc1e24['query'][_0xaa41('0x12')]);_0x2b0bf9['offset']=qs[_0xaa41('0x14')](_0xfc1e24[_0xaa41('0x32')][_0xaa41('0x14')]);}return _0x1138d0[_0xaa41('0x8a')](_0x2b0bf9);}})[_0xaa41('0x17')](function(_0x3dafc6){if(_0x3dafc6){return _0x3dafc6?{'count':_0x394987,'rows':_0x3dafc6}:null;}})[_0xaa41('0x17')](respondWithResult(_0x35c48f,null))['catch'](handleError(_0x35c48f,null));};exports[_0xaa41('0x8c')]=function(_0x533f4b,_0x47ca9d){var _0xd1f9ba=moment()[_0xaa41('0x6d')]('YYYY-MM-DD\x20HH:mm:ss');var _0x2c4930,_0x1285ed;return db['VoiceQueue'][_0xaa41('0x20')]({'where':{'id':_0x533f4b[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x47ca9d,null))['then'](function(_0x3ecde6){if(_0x3ecde6){_0x1285ed=_0x3ecde6;return _0x3ecde6['addLists'](_0x533f4b[_0xaa41('0x3b')][_0xaa41('0x70')],_[_0xaa41('0x45')](_0x533f4b[_0xaa41('0x3b')],['ids','id'])||{});}return null;})[_0xaa41('0x86')](function(_0x32a07e){var _0x2b8b73;_0x2c4930=_0x32a07e||[];var _0x49e4a5=[];if(_0x32a07e){for(var _0xda8e73=0x0;_0xda8e73<_0x32a07e[_0xaa41('0x37')];_0xda8e73+=0x1){var _0x25f5ba=_0x32a07e[_0xda8e73][_0xaa41('0x18')]({'plain':!![]});_0x1285ed[_0xaa41('0x8d')]=_0x533f4b[_0xaa41('0x3b')][_0xaa41('0x8d')]?_0x533f4b[_0xaa41('0x3b')]['dialCheckDuplicateType']:_0x1285ed[_0xaa41('0x8d')];switch(_0x1285ed['dialCheckDuplicateType']){case _0xaa41('0x8e'):_0x2b8b73=squel[_0xaa41('0x8f')]()[_0xaa41('0x90')](_0xaa41('0x91'))[_0xaa41('0x92')]([_0xaa41('0x93'),_0xaa41('0x94'),_0xaa41('0x95'),_0xaa41('0x96'),_0xaa41('0x50'),_0xaa41('0x46'),_0xaa41('0x47')],squel[_0xaa41('0x97')]()['field'](_0xaa41('0x93'),_0xaa41('0x93'))[_0xaa41('0x71')]('\x27'+_0xd1f9ba+'\x27',_0xaa41('0x94'))[_0xaa41('0x71')]('id',_0xaa41('0x95'))[_0xaa41('0x71')](_0x25f5ba[_0xaa41('0x98')][_0xaa41('0x7a')](),'ListId')[_0xaa41('0x71')](_0x533f4b[_0xaa41('0x30')]['id'][_0xaa41('0x7a')](),_0xaa41('0x50'))[_0xaa41('0x71')]('\x27'+_0xd1f9ba+'\x27',_0xaa41('0x46'))[_0xaa41('0x71')]('\x27'+_0xd1f9ba+'\x27',_0xaa41('0x47'))[_0xaa41('0x73')](_0xaa41('0x99'))['where']('deletedAt\x20IS\x20NULL')['where'](_0xaa41('0x9a'),_0x25f5ba[_0xaa41('0x98')]['toString']())[_0xaa41('0x2a')](_0xaa41('0x9b'))['where'](_0xaa41('0x9c'),squel['select']()[_0xaa41('0x71')](_0xaa41('0x9d'))[_0xaa41('0x73')](_0xaa41('0x9e'))[_0xaa41('0x2a')]('VoiceQueueId\x20=\x20?',_0x533f4b[_0xaa41('0x30')]['id'][_0xaa41('0x7a')]()))[_0xaa41('0x2a')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0xaa41('0x71')](_0xaa41('0x9f'))['from'](_0xaa41('0x91'))[_0xaa41('0x2a')](_0xaa41('0x77'),_0x533f4b['params']['id'][_0xaa41('0x7a')]())))[_0xaa41('0x7a')]();break;case _0xaa41('0xa0'):_0x2b8b73=squel['insert']()[_0xaa41('0x90')](_0xaa41('0x91'))['fromQuery'](['phone',_0xaa41('0x94'),_0xaa41('0x95'),_0xaa41('0x96'),_0xaa41('0x50'),'createdAt',_0xaa41('0x47')],squel[_0xaa41('0x97')]()['field'](_0xaa41('0x93'),_0xaa41('0x93'))[_0xaa41('0x71')]('\x27'+_0xd1f9ba+'\x27',_0xaa41('0x94'))['field']('id',_0xaa41('0x95'))[_0xaa41('0x71')](_0x25f5ba[_0xaa41('0x98')][_0xaa41('0x7a')](),_0xaa41('0x96'))[_0xaa41('0x71')](_0x533f4b[_0xaa41('0x30')]['id'][_0xaa41('0x7a')](),_0xaa41('0x50'))[_0xaa41('0x71')]('\x27'+_0xd1f9ba+'\x27','createdAt')[_0xaa41('0x71')]('\x27'+_0xd1f9ba+'\x27',_0xaa41('0x47'))[_0xaa41('0x73')](_0xaa41('0x99'))[_0xaa41('0x2a')]('deletedAt\x20IS\x20NULL')[_0xaa41('0x2a')]('ListId\x20=\x20?',_0x25f5ba[_0xaa41('0x98')]['toString']())['where'](_0xaa41('0x9b'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0xaa41('0x97')]()[_0xaa41('0x71')](_0xaa41('0x9f'))[_0xaa41('0x73')](_0xaa41('0x91'))[_0xaa41('0x2a')]('VoiceQueueId\x20=\x20?',_0x533f4b[_0xaa41('0x30')]['id'][_0xaa41('0x7a')]())))[_0xaa41('0x7a')]();break;default:_0x2b8b73=squel['insert']()[_0xaa41('0x90')]('cm_hopper')[_0xaa41('0x92')]([_0xaa41('0x93'),_0xaa41('0x94'),_0xaa41('0x95'),'ListId','VoiceQueueId',_0xaa41('0x46'),_0xaa41('0x47')],squel['select']()['field'](_0xaa41('0x93'),_0xaa41('0x93'))[_0xaa41('0x71')]('\x27'+_0xd1f9ba+'\x27',_0xaa41('0x94'))[_0xaa41('0x71')]('id',_0xaa41('0x95'))[_0xaa41('0x71')](_0x25f5ba[_0xaa41('0x98')]['toString'](),_0xaa41('0x96'))[_0xaa41('0x71')](_0x533f4b[_0xaa41('0x30')]['id'][_0xaa41('0x7a')](),_0xaa41('0x50'))['field']('\x27'+_0xd1f9ba+'\x27',_0xaa41('0x46'))['field']('\x27'+_0xd1f9ba+'\x27',_0xaa41('0x47'))['from'](_0xaa41('0x99'))[_0xaa41('0x2a')](_0xaa41('0xa1'))['where'](_0xaa41('0x9a'),_0x25f5ba[_0xaa41('0x98')][_0xaa41('0x7a')]())[_0xaa41('0x2a')](_0xaa41('0x9b')))[_0xaa41('0x7a')]();}_0x49e4a5[_0xaa41('0x79')](db[_0xaa41('0x63')][_0xaa41('0x32')](_0x2b8b73));}return BPromise[_0xaa41('0x7f')](_0x49e4a5);}})['then'](function(){var _0x58f009=[];var _0x405eba=squel[_0xaa41('0x8f')]()[_0xaa41('0x90')]('cm_hopper_additional_phones')[_0xaa41('0x92')]([_0xaa41('0xa2'),_0xaa41('0x93'),_0xaa41('0xa3'),_0xaa41('0x46'),_0xaa41('0x47')],squel['select']()[_0xaa41('0x71')](_0xaa41('0xa4'))[_0xaa41('0x71')](_0xaa41('0xa5'))['field'](_0xaa41('0xa6'))[_0xaa41('0x71')]('\x27'+_0xd1f9ba+'\x27',_0xaa41('0x46'))['field']('\x27'+_0xd1f9ba+'\x27','updatedAt')[_0xaa41('0x73')](_0xaa41('0xa7'),'ci')[_0xaa41('0x74')]('cm_hopper','h','h.ContactId=ci.CmContactId')[_0xaa41('0x2a')](_0xaa41('0xa8'),_0xd1f9ba)[_0xaa41('0x2a')](_0xaa41('0xa9'),_0xaa41('0xaa')))[_0xaa41('0x7a')]();_0x58f009['push'](db[_0xaa41('0x63')][_0xaa41('0x32')](_0x405eba));return BPromise[_0xaa41('0x7f')](_0x58f009);})[_0xaa41('0x17')](function(){return _0x2c4930;})[_0xaa41('0x17')](respondWithResult(_0x47ca9d,null))[_0xaa41('0x2f')](handleError(_0x47ca9d,null));};exports[_0xaa41('0xab')]=function(_0x718a84,_0x151c5f){return db[_0xaa41('0x2c')][_0xaa41('0x20')]({'where':{'id':_0x718a84['params']['id']}})['then'](handleEntityNotFound(_0x151c5f,null))[_0xaa41('0x17')](function(_0x293a1d){if(_0x293a1d){return _0x293a1d['removeLists'](_0x718a84[_0xaa41('0x32')][_0xaa41('0x70')]);}})['then'](function(_0x490a6c){if(_0x490a6c){return db[_0xaa41('0x4a')][_0xaa41('0x23')]({'where':{'ListId':_0x718a84[_0xaa41('0x32')]['ids'],'VoiceQueueId':_0x718a84[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](function(){return _0x490a6c;});}})['then'](respondWithStatusCode(_0x151c5f,null))[_0xaa41('0x2f')](handleError(_0x151c5f,null));};exports[_0xaa41('0xac')]=function(_0x536cdb,_0x431b75){var _0x18499f={};var _0x49cbd7={};var _0x515f91;var _0x4b5953;return db['VoiceQueue'][_0xaa41('0x55')]({'where':{'id':_0x536cdb[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x431b75,null))[_0xaa41('0x17')](function(_0x4ca8f7){if(_0x4ca8f7){_0x515f91=_0x4ca8f7;_0x49cbd7['model']=_[_0xaa41('0x33')](db['CmList'][_0xaa41('0x28')]);_0x49cbd7[_0xaa41('0x32')]=_[_0xaa41('0x33')](_0x536cdb[_0xaa41('0x32')]);_0x49cbd7['filters']=_[_0xaa41('0x35')](_0x49cbd7[_0xaa41('0x31')],_0x49cbd7[_0xaa41('0x32')]);_0x18499f[_0xaa41('0x34')]=_[_0xaa41('0x35')](_0x49cbd7[_0xaa41('0x31')],qs[_0xaa41('0x36')](_0x536cdb[_0xaa41('0x32')]['fields']));_0x18499f['attributes']=_0x18499f[_0xaa41('0x34')][_0xaa41('0x37')]?_0x18499f[_0xaa41('0x34')]:_0x49cbd7[_0xaa41('0x31')];_0x18499f[_0xaa41('0x4d')]=qs[_0xaa41('0x4e')](_0x536cdb[_0xaa41('0x32')][_0xaa41('0x4e')]);_0x18499f[_0xaa41('0x2a')]=qs[_0xaa41('0x4b')](_[_0xaa41('0x4f')](_0x536cdb[_0xaa41('0x32')],_0x49cbd7[_0xaa41('0x4b')]));if(_0x536cdb['query'][_0xaa41('0x1b')]){_0x18499f[_0xaa41('0x2a')]=_['merge'](_0x18499f[_0xaa41('0x2a')],{'$or':_[_0xaa41('0x1c')](_0x18499f[_0xaa41('0x34')],function(_0x5cd79d){var _0x558583={};_0x558583[_0x5cd79d]={'$like':'%'+_0x536cdb[_0xaa41('0x32')][_0xaa41('0x1b')]+'%'};return _0x558583;})});}_0x18499f=_['merge']({},_0x18499f,_0x536cdb['options']);return _0x515f91[_0xaa41('0xac')](_0x18499f);}})[_0xaa41('0x17')](function(_0x117841){if(_0x117841){_0x4b5953=_0x117841[_0xaa41('0x37')];if(!_0x536cdb[_0xaa41('0x32')]['hasOwnProperty'](_0xaa41('0x4c'))){_0x18499f[_0xaa41('0x12')]=qs['limit'](_0x536cdb['query'][_0xaa41('0x12')]);_0x18499f[_0xaa41('0x14')]=qs[_0xaa41('0x14')](_0x536cdb[_0xaa41('0x32')]['offset']);}return _0x515f91[_0xaa41('0xac')](_0x18499f);}})[_0xaa41('0x17')](function(_0x1be3c1){if(_0x1be3c1){return _0x1be3c1?{'count':_0x4b5953,'rows':_0x1be3c1}:null;}})[_0xaa41('0x17')](respondWithResult(_0x431b75,null))[_0xaa41('0x2f')](handleError(_0x431b75,null));};exports[_0xaa41('0xad')]=function(_0x42ae0c,_0x4fa4ca){var _0x1e41b5;return db[_0xaa41('0x2c')]['find']({'where':{'id':_0x42ae0c[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x4fa4ca,null))[_0xaa41('0x17')](function(_0x135f31){if(_0x135f31){return _0x135f31[_0xaa41('0xad')](_0x42ae0c[_0xaa41('0x3b')][_0xaa41('0x70')],_[_0xaa41('0x45')](_0x42ae0c['body'],[_0xaa41('0x70'),'id'])||{});}return null;})['spread'](function(_0x5eac30){var _0x3e28b7;_0x1e41b5=_0x5eac30||[];var _0x1ac854=[];if(_0x5eac30){for(var _0x187bf9=0x0;_0x187bf9<_0x5eac30['length'];_0x187bf9+=0x1){var _0x50fa22=_0x5eac30[_0x187bf9][_0xaa41('0x18')]({'plain':!![]});_0x3e28b7=squel[_0xaa41('0x8f')]()[_0xaa41('0x90')](_0xaa41('0xae'))['fromQuery']([_0xaa41('0x93'),'ContactId',_0xaa41('0x96'),_0xaa41('0x50'),_0xaa41('0x46'),'updatedAt'],squel[_0xaa41('0x97')]()['field'](_0xaa41('0x93'),_0xaa41('0x93'))[_0xaa41('0x71')]('id',_0xaa41('0x95'))[_0xaa41('0x71')](_0x50fa22['CmListId'][_0xaa41('0x7a')](),'ListId')['field'](_0x42ae0c['params']['id'][_0xaa41('0x7a')](),'VoiceQueueId')[_0xaa41('0x71')]('NOW()','createdAt')[_0xaa41('0x71')](_0xaa41('0xaf'),_0xaa41('0x47'))[_0xaa41('0x73')](_0xaa41('0x99'))[_0xaa41('0x2a')](_0xaa41('0xa1'))[_0xaa41('0x2a')](_0xaa41('0x9a'),_0x50fa22['CmListId'][_0xaa41('0x7a')]())[_0xaa41('0x2a')](_0xaa41('0x9b')))['toString']();_0x1ac854[_0xaa41('0x79')](db[_0xaa41('0x63')][_0xaa41('0x32')](_0x3e28b7));}return BPromise['all'](_0x1ac854);}})[_0xaa41('0x17')](function(){return _0x1e41b5;})[_0xaa41('0x17')](respondWithResult(_0x4fa4ca,null))['catch'](handleError(_0x4fa4ca,null));};exports[_0xaa41('0xb0')]=function(_0x2edb93,_0x4e34c2){return db[_0xaa41('0x2c')][_0xaa41('0x20')]({'where':{'id':_0x2edb93[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x4e34c2,null))[_0xaa41('0x17')](function(_0x17b359){if(_0x17b359){return _0x17b359['removeBlackLists'](_0x2edb93['query']['ids']);}})['then'](function(_0x5b820b){if(_0x5b820b){return db[_0xaa41('0x58')][_0xaa41('0x23')]({'where':{'ListId':_0x2edb93[_0xaa41('0x32')][_0xaa41('0x70')],'VoiceQueueId':_0x2edb93[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](function(){return _0x5b820b;});}})[_0xaa41('0x17')](respondWithStatusCode(_0x4e34c2,null))[_0xaa41('0x2f')](handleError(_0x4e34c2,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 82d5436..91ebf26 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 _0x8eb0=['update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save'];(function(_0x2354d0,_0x48e19d){var _0x374851=function(_0x3a385f){while(--_0x3a385f){_0x2354d0['push'](_0x2354d0['shift']());}};_0x374851(++_0x48e19d);}(_0x8eb0,0x1da));var _0x08eb=function(_0x277107,_0x3420dc){_0x277107=_0x277107-0x0;var _0x1da046=_0x8eb0[_0x277107];return _0x1da046;};'use strict';var EventEmitter=require('events');var VoiceQueue=require(_0x08eb('0x0'))['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x08eb('0x1')](0x0);var events={'afterCreate':_0x08eb('0x2'),'afterUpdate':_0x08eb('0x3'),'afterDestroy':_0x08eb('0x4')};function emitEvent(_0x5a0cbc){return function(_0x35cf26,_0x1d180b,_0x127ca8){VoiceQueueEvents[_0x08eb('0x5')](_0x5a0cbc+':'+_0x35cf26['id'],_0x35cf26);VoiceQueueEvents[_0x08eb('0x5')](_0x5a0cbc,_0x35cf26);_0x127ca8(null);};}for(var e in events){if(events[_0x08eb('0x6')](e)){var event=events[e];VoiceQueue[_0x08eb('0x7')](e,emitEvent(event));}}module[_0x08eb('0x8')]=VoiceQueueEvents; \ No newline at end of file +var _0x1c99=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0xef4cf0,_0x16c9c3){var _0x497ad2=function(_0xce63d4){while(--_0xce63d4){_0xef4cf0['push'](_0xef4cf0['shift']());}};_0x497ad2(++_0x16c9c3);}(_0x1c99,0xe7));var _0x91c9=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x1c99[_0x2641f9];return _0x585741;};'use strict';var EventEmitter=require(_0x91c9('0x0'));var VoiceQueue=require(_0x91c9('0x1'))['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x91c9('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x91c9('0x3'),'afterDestroy':_0x91c9('0x4')};function emitEvent(_0x27d3bd){return function(_0x29f5e4,_0x48ba73,_0xbf0f49){VoiceQueueEvents[_0x91c9('0x5')](_0x27d3bd+':'+_0x29f5e4['id'],_0x29f5e4);VoiceQueueEvents[_0x91c9('0x5')](_0x27d3bd,_0x29f5e4);_0xbf0f49(null);};}for(var e in events){if(events[_0x91c9('0x6')](e)){var event=events[e];VoiceQueue[_0x91c9('0x7')](e,emitEvent(event));}}module[_0x91c9('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 89b4514..b6c17cb 100644 --- a/server/api/voiceQueue/voiceQueue.model.js +++ b/server/api/voiceQueue/voiceQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../config/environment','./voiceQueue.attributes','exports','define','VoiceQueue','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0xd7df8c,_0x1ad430){var _0x305b71=function(_0x42c058){while(--_0x42c058){_0xd7df8c['push'](_0xd7df8c['shift']());}};_0x305b71(++_0x1ad430);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3e74=['exports','VoiceQueue','voice_queues','lodash','../../config/logger','api','moment','path','../../config/environment','./voiceQueue.attributes'];(function(_0x3713e2,_0x381fd6){var _0x4e81d8=function(_0x4835e5){while(--_0x4835e5){_0x3713e2['push'](_0x3713e2['shift']());}};_0x4e81d8(++_0x381fd6);}(_0x3e74,0x175));var _0x43e7=function(_0xbc6fe1,_0x891694){_0xbc6fe1=_0xbc6fe1-0x0;var _0x28cdde=_0x3e74[_0xbc6fe1];return _0x28cdde;};'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 77cc123..253ae78 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 _0xd331=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','./voiceQueue.socket','request','then','info','debug','error','code','VoiceQueue,\x20%s,\x20%s','message','result','catch','VoiceQueue','findAll','options','raw','attributes','include','map','model','GetVoiceQueue','ShowVoiceQueue','find','where','stringify','lodash','util','moment','bluebird'];(function(_0x2c2f1d,_0x25c466){var _0x459641=function(_0x718cb){while(--_0x718cb){_0x2c2f1d['push'](_0x2c2f1d['shift']());}};_0x459641(++_0x25c466);}(_0xd331,0x6e));var _0x1d33=function(_0x63828b,_0x583ada){_0x63828b=_0x63828b-0x0;var _0x25fba9=_0xd331[_0x63828b];return _0x25fba9;};'use strict';var _=require(_0x1d33('0x0'));var util=require(_0x1d33('0x1'));var moment=require(_0x1d33('0x2'));var BPromise=require(_0x1d33('0x3'));var rs=require(_0x1d33('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1d33('0x5'))['db'];var utils=require(_0x1d33('0x6'));var logger=require(_0x1d33('0x7'))(_0x1d33('0x8'));var config=require(_0x1d33('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1d33('0xa')]({'port':0x232a});config[_0x1d33('0xb')]=_[_0x1d33('0xc')](config[_0x1d33('0xb')],{'host':_0x1d33('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1d33('0xb')]));require(_0x1d33('0xe'))['register'](socket);function respondWithRpcPromise(_0x523e3f,_0x5c7ced,_0x127af3){return new BPromise(function(_0x2b8297,_0x35cf96){return client[_0x1d33('0xf')](_0x523e3f,_0x127af3)[_0x1d33('0x10')](function(_0x2938f5){logger[_0x1d33('0x11')]('VoiceQueue,\x20%s,\x20%s',_0x5c7ced,'request\x20sent');logger[_0x1d33('0x12')]('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x5c7ced,'request\x20sent',JSON['stringify'](_0x2938f5));if(_0x2938f5[_0x1d33('0x13')]){if(_0x2938f5[_0x1d33('0x13')][_0x1d33('0x14')]===0x1f4){logger[_0x1d33('0x13')](_0x1d33('0x15'),_0x5c7ced,_0x2938f5[_0x1d33('0x13')][_0x1d33('0x16')]);return _0x35cf96(_0x2938f5[_0x1d33('0x13')]['message']);}logger['error'](_0x1d33('0x15'),_0x5c7ced,_0x2938f5[_0x1d33('0x13')]['message']);return _0x2b8297(_0x2938f5[_0x1d33('0x13')][_0x1d33('0x16')]);}else{logger[_0x1d33('0x11')]('VoiceQueue,\x20%s,\x20%s',_0x5c7ced,'request\x20sent');_0x2b8297(_0x2938f5[_0x1d33('0x17')]['message']);}})[_0x1d33('0x18')](function(_0x5d6efc){logger['error'](_0x1d33('0x15'),_0x5c7ced,_0x5d6efc);_0x35cf96(_0x5d6efc);});});}exports['GetVoiceQueue']=function(_0xe3bb5){var _0xf6db85=this;return new Promise(function(_0x10aff2,_0x77dd26){return db[_0x1d33('0x19')][_0x1d33('0x1a')]({'raw':_0xe3bb5[_0x1d33('0x1b')]?_0xe3bb5[_0x1d33('0x1b')][_0x1d33('0x1c')]===undefined?!![]:![]:!![],'where':_0xe3bb5[_0x1d33('0x1b')]?_0xe3bb5[_0x1d33('0x1b')]['where']||null:null,'attributes':_0xe3bb5[_0x1d33('0x1b')]?_0xe3bb5[_0x1d33('0x1b')][_0x1d33('0x1d')]||null:null,'limit':_0xe3bb5[_0x1d33('0x1b')]?_0xe3bb5[_0x1d33('0x1b')]['limit']||null:null,'include':_0xe3bb5[_0x1d33('0x1b')]?_0xe3bb5[_0x1d33('0x1b')][_0x1d33('0x1e')]?_[_0x1d33('0x1f')](_0xe3bb5[_0x1d33('0x1b')][_0x1d33('0x1e')],function(_0xa6f380){return{'model':db[_0xa6f380['model']],'as':_0xa6f380['as'],'attributes':_0xa6f380[_0x1d33('0x1d')],'include':_0xa6f380[_0x1d33('0x1e')]?_[_0x1d33('0x1f')](_0xa6f380[_0x1d33('0x1e')],function(_0x30e560){return{'model':db[_0x30e560[_0x1d33('0x20')]],'as':_0x30e560['as'],'attributes':_0x30e560[_0x1d33('0x1d')],'include':_0x30e560['include']?_[_0x1d33('0x1f')](_0x30e560['include'],function(_0x474fcf){return{'model':db[_0x474fcf[_0x1d33('0x20')]],'as':_0x474fcf['as'],'attributes':_0x474fcf[_0x1d33('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x1d33('0x10')](function(_0xc44108){logger['info'](_0x1d33('0x21'),_0xe3bb5);logger[_0x1d33('0x12')](_0x1d33('0x21'),_0xe3bb5,JSON['stringify'](_0xc44108));_0x10aff2(_0xc44108);})[_0x1d33('0x18')](function(_0x527a37){logger[_0x1d33('0x13')](_0x1d33('0x21'),_0x527a37[_0x1d33('0x16')],_0xe3bb5);_0x77dd26(_0xf6db85['error'](0x1f4,_0x527a37[_0x1d33('0x16')]));});});};exports[_0x1d33('0x22')]=function(_0x58f7b9){var _0x2d8685=this;return new Promise(function(_0x4af7c3,_0x431688){return db[_0x1d33('0x19')][_0x1d33('0x23')]({'raw':_0x58f7b9[_0x1d33('0x1b')]?_0x58f7b9[_0x1d33('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x58f7b9[_0x1d33('0x1b')]?_0x58f7b9['options'][_0x1d33('0x24')]||null:null,'attributes':_0x58f7b9['options']?_0x58f7b9['options'][_0x1d33('0x1d')]||null:null,'include':_0x58f7b9['options']?_0x58f7b9['options'][_0x1d33('0x1e')]?_[_0x1d33('0x1f')](_0x58f7b9[_0x1d33('0x1b')][_0x1d33('0x1e')],function(_0x1a999b){return{'model':db[_0x1a999b[_0x1d33('0x20')]],'as':_0x1a999b['as'],'attributes':_0x1a999b['attributes'],'include':_0x1a999b[_0x1d33('0x1e')]?_[_0x1d33('0x1f')](_0x1a999b[_0x1d33('0x1e')],function(_0x4b9d1b){return{'model':db[_0x4b9d1b[_0x1d33('0x20')]],'as':_0x4b9d1b['as'],'attributes':_0x4b9d1b[_0x1d33('0x1d')],'include':_0x4b9d1b['include']?_[_0x1d33('0x1f')](_0x4b9d1b[_0x1d33('0x1e')],function(_0x4a1fb3){return{'model':db[_0x4a1fb3[_0x1d33('0x20')]],'as':_0x4a1fb3['as'],'attributes':_0x4a1fb3[_0x1d33('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x46f17f){logger['info'](_0x1d33('0x22'),_0x58f7b9);logger[_0x1d33('0x12')](_0x1d33('0x22'),_0x58f7b9,JSON[_0x1d33('0x25')](_0x46f17f));_0x4af7c3(_0x46f17f);})[_0x1d33('0x18')](function(_0x3a2c42){logger[_0x1d33('0x13')](_0x1d33('0x22'),_0x3a2c42[_0x1d33('0x16')],_0x58f7b9);_0x431688(_0x2d8685['error'](0x1f4,_0x3a2c42['message']));});});}; \ No newline at end of file +var _0xf4e4=['register','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','GetVoiceQueue','VoiceQueue','findAll','options','raw','where','attributes','limit','include','model','map','then','debug','ShowVoiceQueue','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./voiceQueue.socket'];(function(_0x40a6b5,_0x2ef12f){var _0x4bab77=function(_0x303e52){while(--_0x303e52){_0x40a6b5['push'](_0x40a6b5['shift']());}};_0x4bab77(++_0x2ef12f);}(_0xf4e4,0xe1));var _0x4f4e=function(_0x42326e,_0x3b19ab){_0x42326e=_0x42326e-0x0;var _0x44985c=_0xf4e4[_0x42326e];return _0x44985c;};'use strict';var _=require(_0x4f4e('0x0'));var util=require(_0x4f4e('0x1'));var moment=require(_0x4f4e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4f4e('0x3'));var db=require(_0x4f4e('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4f4e('0x5'))(_0x4f4e('0x6'));var config=require(_0x4f4e('0x7'));var jayson=require(_0x4f4e('0x8'));var client=jayson[_0x4f4e('0x9')][_0x4f4e('0xa')]({'port':0x232a});config[_0x4f4e('0xb')]=_[_0x4f4e('0xc')](config[_0x4f4e('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x4f4e('0xd'))(new Redis(config['redis']));require(_0x4f4e('0xe'))[_0x4f4e('0xf')](socket);function respondWithRpcPromise(_0x3ba1e9,_0x182d8c,_0x3c4bd6){return new BPromise(function(_0x1ce334,_0xc20909){return client['request'](_0x3ba1e9,_0x3c4bd6)['then'](function(_0x6ee5ec){logger[_0x4f4e('0x10')](_0x4f4e('0x11'),_0x182d8c,_0x4f4e('0x12'));logger['debug'](_0x4f4e('0x13'),_0x182d8c,'request\x20sent',JSON[_0x4f4e('0x14')](_0x6ee5ec));if(_0x6ee5ec['error']){if(_0x6ee5ec['error'][_0x4f4e('0x15')]===0x1f4){logger[_0x4f4e('0x16')]('VoiceQueue,\x20%s,\x20%s',_0x182d8c,_0x6ee5ec[_0x4f4e('0x16')]['message']);return _0xc20909(_0x6ee5ec[_0x4f4e('0x16')][_0x4f4e('0x17')]);}logger[_0x4f4e('0x16')](_0x4f4e('0x11'),_0x182d8c,_0x6ee5ec['error'][_0x4f4e('0x17')]);return _0x1ce334(_0x6ee5ec[_0x4f4e('0x16')]['message']);}else{logger[_0x4f4e('0x10')](_0x4f4e('0x11'),_0x182d8c,_0x4f4e('0x12'));_0x1ce334(_0x6ee5ec[_0x4f4e('0x18')][_0x4f4e('0x17')]);}})[_0x4f4e('0x19')](function(_0x405df7){logger[_0x4f4e('0x16')](_0x4f4e('0x11'),_0x182d8c,_0x405df7);_0xc20909(_0x405df7);});});}exports[_0x4f4e('0x1a')]=function(_0x19679f){var _0x3ec223=this;return new Promise(function(_0x551b6a,_0xd46cb7){return db[_0x4f4e('0x1b')][_0x4f4e('0x1c')]({'raw':_0x19679f[_0x4f4e('0x1d')]?_0x19679f[_0x4f4e('0x1d')][_0x4f4e('0x1e')]===undefined?!![]:![]:!![],'where':_0x19679f[_0x4f4e('0x1d')]?_0x19679f[_0x4f4e('0x1d')][_0x4f4e('0x1f')]||null:null,'attributes':_0x19679f[_0x4f4e('0x1d')]?_0x19679f[_0x4f4e('0x1d')][_0x4f4e('0x20')]||null:null,'limit':_0x19679f[_0x4f4e('0x1d')]?_0x19679f[_0x4f4e('0x1d')][_0x4f4e('0x21')]||null:null,'include':_0x19679f[_0x4f4e('0x1d')]?_0x19679f['options'][_0x4f4e('0x22')]?_['map'](_0x19679f[_0x4f4e('0x1d')][_0x4f4e('0x22')],function(_0x5c82de){return{'model':db[_0x5c82de[_0x4f4e('0x23')]],'as':_0x5c82de['as'],'attributes':_0x5c82de[_0x4f4e('0x20')],'include':_0x5c82de[_0x4f4e('0x22')]?_[_0x4f4e('0x24')](_0x5c82de['include'],function(_0x27ff69){return{'model':db[_0x27ff69['model']],'as':_0x27ff69['as'],'attributes':_0x27ff69[_0x4f4e('0x20')],'include':_0x27ff69[_0x4f4e('0x22')]?_[_0x4f4e('0x24')](_0x27ff69[_0x4f4e('0x22')],function(_0x145cd0){return{'model':db[_0x145cd0[_0x4f4e('0x23')]],'as':_0x145cd0['as'],'attributes':_0x145cd0['attributes']};}):[]};}):[]};}):[]:[]})[_0x4f4e('0x25')](function(_0x24cab2){logger[_0x4f4e('0x10')]('GetVoiceQueue',_0x19679f);logger[_0x4f4e('0x26')](_0x4f4e('0x1a'),_0x19679f,JSON[_0x4f4e('0x14')](_0x24cab2));_0x551b6a(_0x24cab2);})[_0x4f4e('0x19')](function(_0x245df7){logger[_0x4f4e('0x16')]('GetVoiceQueue',_0x245df7[_0x4f4e('0x17')],_0x19679f);_0xd46cb7(_0x3ec223[_0x4f4e('0x16')](0x1f4,_0x245df7[_0x4f4e('0x17')]));});});};exports['ShowVoiceQueue']=function(_0x2cd53a){var _0x2eef2b=this;return new Promise(function(_0x2d2d7a,_0x32c2f3){return db[_0x4f4e('0x1b')]['find']({'raw':_0x2cd53a[_0x4f4e('0x1d')]?_0x2cd53a['options'][_0x4f4e('0x1e')]===undefined?!![]:![]:!![],'where':_0x2cd53a[_0x4f4e('0x1d')]?_0x2cd53a[_0x4f4e('0x1d')][_0x4f4e('0x1f')]||null:null,'attributes':_0x2cd53a['options']?_0x2cd53a['options']['attributes']||null:null,'include':_0x2cd53a[_0x4f4e('0x1d')]?_0x2cd53a[_0x4f4e('0x1d')][_0x4f4e('0x22')]?_[_0x4f4e('0x24')](_0x2cd53a[_0x4f4e('0x1d')][_0x4f4e('0x22')],function(_0x1e8064){return{'model':db[_0x1e8064[_0x4f4e('0x23')]],'as':_0x1e8064['as'],'attributes':_0x1e8064[_0x4f4e('0x20')],'include':_0x1e8064[_0x4f4e('0x22')]?_[_0x4f4e('0x24')](_0x1e8064['include'],function(_0x4841db){return{'model':db[_0x4841db[_0x4f4e('0x23')]],'as':_0x4841db['as'],'attributes':_0x4841db[_0x4f4e('0x20')],'include':_0x4841db[_0x4f4e('0x22')]?_['map'](_0x4841db[_0x4f4e('0x22')],function(_0x299411){return{'model':db[_0x299411['model']],'as':_0x299411['as'],'attributes':_0x299411[_0x4f4e('0x20')]};}):[]};}):[]};}):[]:[]})[_0x4f4e('0x25')](function(_0x5196c9){logger[_0x4f4e('0x10')]('ShowVoiceQueue',_0x2cd53a);logger[_0x4f4e('0x26')](_0x4f4e('0x27'),_0x2cd53a,JSON[_0x4f4e('0x14')](_0x5196c9));_0x2d2d7a(_0x5196c9);})[_0x4f4e('0x19')](function(_0x13fe0e){logger[_0x4f4e('0x16')]('ShowVoiceQueue',_0x13fe0e[_0x4f4e('0x17')],_0x2cd53a);_0x32c2f3(_0x2eef2b[_0x4f4e('0x16')](0x1f4,_0x13fe0e[_0x4f4e('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 98b4bc5..e2f7b9b 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 _0xb965=['save','update','emit','removeListener','register','length'];(function(_0x4e74e3,_0x4d2627){var _0x228ff5=function(_0x297f8d){while(--_0x297f8d){_0x4e74e3['push'](_0x4e74e3['shift']());}};_0x228ff5(++_0x4d2627);}(_0xb965,0xc6));var _0x5b96=function(_0x381bff,_0x19d01f){_0x381bff=_0x381bff-0x0;var _0x201ab1=_0xb965[_0x381bff];return _0x201ab1;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=[_0x5b96('0x0'),'remove',_0x5b96('0x1')];function createListener(_0x1d04b5,_0x34b0f7){return function(_0x5dc2bf){_0x34b0f7[_0x5b96('0x2')](_0x1d04b5,_0x5dc2bf);};}function removeListener(_0x155364,_0x4225ff){return function(){VoiceQueueEvents[_0x5b96('0x3')](_0x155364,_0x4225ff);};}exports[_0x5b96('0x4')]=function(_0x26fd8f){for(var _0x3e13f0=0x0,_0x19910f=events[_0x5b96('0x5')];_0x3e13f0<_0x19910f;_0x3e13f0++){var _0x454af9=events[_0x3e13f0];var _0x496d74=createListener('voiceQueue:'+_0x454af9,_0x26fd8f);VoiceQueueEvents['on'](_0x454af9,_0x496d74);}}; \ No newline at end of file +var _0xb1fe=['register','length','update','emit','removeListener'];(function(_0x504e8c,_0x563d11){var _0xcae156=function(_0x359bb8){while(--_0x359bb8){_0x504e8c['push'](_0x504e8c['shift']());}};_0xcae156(++_0x563d11);}(_0xb1fe,0xd4));var _0xeb1f=function(_0x4d9044,_0x42b807){_0x4d9044=_0x4d9044-0x0;var _0x22330a=_0xb1fe[_0x4d9044];return _0x22330a;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=['save','remove',_0xeb1f('0x0')];function createListener(_0x438f64,_0x4c863b){return function(_0xb0f775){_0x4c863b[_0xeb1f('0x1')](_0x438f64,_0xb0f775);};}function removeListener(_0x4bb6c0,_0x160f80){return function(){VoiceQueueEvents[_0xeb1f('0x2')](_0x4bb6c0,_0x160f80);};}exports[_0xeb1f('0x3')]=function(_0x42fbd9){for(var _0x5b7f86=0x0,_0x2c6cfc=events[_0xeb1f('0x4')];_0x5b7f86<_0x2c6cfc;_0x5b7f86++){var _0xf9a8fa=events[_0x5b7f86];var _0x33f70c=createListener('voiceQueue:'+_0xf9a8fa,_0x42fbd9);VoiceQueueEvents['on'](_0xf9a8fa,_0x33f70c);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 81a328b..952604a 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 _0x21d3=['put','/:id','update','delete','exports','multer','path','connect-timeout','express','../../config/environment','get','isAuthenticated','index','/describe','describe','/index','getVoiceQueuesReport','show'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x21d3,0x113));var _0x321d=function(_0x243fdb,_0x22e944){_0x243fdb=_0x243fdb-0x0;var _0x82729f=_0x21d3[_0x243fdb];return _0x82729f;};'use strict';var multer=require(_0x321d('0x0'));var util=require('util');var path=require(_0x321d('0x1'));var timeout=require(_0x321d('0x2'));var express=require(_0x321d('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x321d('0x4'));var controller=require('./voiceQueueReport.controller');router[_0x321d('0x5')]('/',auth[_0x321d('0x6')](),controller[_0x321d('0x7')]);router[_0x321d('0x5')](_0x321d('0x8'),auth['isAuthenticated'](),controller[_0x321d('0x9')]);router[_0x321d('0x5')](_0x321d('0xa'),auth[_0x321d('0x6')](),controller[_0x321d('0xb')]);router[_0x321d('0x5')]('/:id',auth[_0x321d('0x6')](),controller[_0x321d('0xc')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x321d('0xd')](_0x321d('0xe'),auth[_0x321d('0x6')](),controller[_0x321d('0xf')]);router[_0x321d('0x10')](_0x321d('0xe'),auth[_0x321d('0x6')](),controller['destroy']);module[_0x321d('0x11')]=router; \ No newline at end of file +var _0xeaf7=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','index','/describe','isAuthenticated','describe','/:id','post','create','put','update','delete','destroy','exports'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xeaf7,0xf2));var _0x7eaf=function(_0x160a94,_0x31bcb9){_0x160a94=_0x160a94-0x0;var _0x30c36c=_0xeaf7[_0x160a94];return _0x30c36c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x7eaf('0x0'));var timeout=require(_0x7eaf('0x1'));var express=require(_0x7eaf('0x2'));var router=express[_0x7eaf('0x3')]();var fs_extra=require(_0x7eaf('0x4'));var auth=require(_0x7eaf('0x5'));var interaction=require(_0x7eaf('0x6'));var config=require(_0x7eaf('0x7'));var controller=require(_0x7eaf('0x8'));router[_0x7eaf('0x9')]('/',auth['isAuthenticated'](),controller[_0x7eaf('0xa')]);router['get'](_0x7eaf('0xb'),auth[_0x7eaf('0xc')](),controller[_0x7eaf('0xd')]);router[_0x7eaf('0x9')]('/index',auth[_0x7eaf('0xc')](),controller['getVoiceQueuesReport']);router['get'](_0x7eaf('0xe'),auth[_0x7eaf('0xc')](),controller['show']);router[_0x7eaf('0xf')]('/',auth[_0x7eaf('0xc')](),controller[_0x7eaf('0x10')]);router[_0x7eaf('0x11')](_0x7eaf('0xe'),auth[_0x7eaf('0xc')](),controller[_0x7eaf('0x12')]);router[_0x7eaf('0x13')](_0x7eaf('0xe'),auth[_0x7eaf('0xc')](),controller[_0x7eaf('0x14')]);module[_0x7eaf('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index e61c60a..b3069d4 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 _0x9aaf=['format','diff','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','DATE','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','STRING','getDataValue','queuecallerjoinAt'];(function(_0xc4665c,_0x429c36){var _0x1564fa=function(_0x3ad230){while(--_0x3ad230){_0xc4665c['push'](_0xc4665c['shift']());}};_0x1564fa(++_0x429c36);}(_0x9aaf,0x9b));var _0xf9aa=function(_0x2f45ea,_0x15c656){_0x2f45ea=_0x2f45ea-0x0;var _0x485a84=_0x9aaf[_0x2f45ea];return _0x485a84;};'use strict';var Sequelize=require(_0xf9aa('0x0'));var moment=require(_0xf9aa('0x1'));module['exports']={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xf9aa('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xf9aa('0x2')]},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x3f284b){var _0x16d16e=moment(_0x3f284b);var _0x35c7ab=moment(this[_0xf9aa('0x3')](_0xf9aa('0x4')))[_0xf9aa('0x5')]('YYYY-MM-DD\x20HH:mm:ss');var _0x56793b=_0x16d16e[_0xf9aa('0x6')](_0x35c7ab,_0xf9aa('0x7'));this[_0xf9aa('0x8')](_0xf9aa('0x9'),_0x3f284b);this[_0xf9aa('0x8')](_0xf9aa('0xa'),_0x56793b||null);}},'position':{'type':Sequelize[_0xf9aa('0xb')]},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0xf9aa('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0xf9aa('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xf9aa('0xd')]},'queuecallerexit':{'type':Sequelize[_0xf9aa('0xc')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize[_0xf9aa('0x2')],'comment':_0xf9aa('0xe')},'originalposition':{'type':Sequelize[_0xf9aa('0xb')]},'channel':{'type':Sequelize[_0xf9aa('0x2')]},'connectedlinenum':{'type':Sequelize[_0xf9aa('0x2')]},'connectedlinename':{'type':Sequelize[_0xf9aa('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xf9aa('0x2')]},'exten':{'type':Sequelize[_0xf9aa('0x2')]},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize[_0xf9aa('0xb')]},'mohtime':{'type':Sequelize[_0xf9aa('0xb')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xf9aa('0x2')]},'transfer':{'type':Sequelize[_0xf9aa('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xf9aa('0x2')],'comment':_0xf9aa('0xf')},'transferexten':{'type':Sequelize[_0xf9aa('0x2')]},'transferuniqueid':{'type':Sequelize[_0xf9aa('0x2')]},'disposition':{'type':Sequelize[_0xf9aa('0x2')]},'secondDisposition':{'type':Sequelize[_0xf9aa('0x2')]},'thirdDisposition':{'type':Sequelize[_0xf9aa('0x2')]},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'note':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe570=['INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','setDataValue','holdtime'];(function(_0x8b8564,_0x162976){var _0x360c61=function(_0x164cc9){while(--_0x164cc9){_0x8b8564['push'](_0x8b8564['shift']());}};_0x360c61(++_0x162976);}(_0xe570,0x103));var _0x0e57=function(_0x4c2436,_0x10f4b9){_0x4c2436=_0x4c2436-0x0;var _0x41e852=_0xe570[_0x4c2436];return _0x41e852;};'use strict';var Sequelize=require(_0x0e57('0x0'));var moment=require(_0x0e57('0x1'));module[_0x0e57('0x2')]={'type':{'type':Sequelize[_0x0e57('0x3')]},'uniqueid':{'type':Sequelize[_0x0e57('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x0e57('0x3')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0x0e57('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0x0e57('0x4')],'set':function(_0xabffee){var _0x2d17e0=moment(_0xabffee);var _0x346005=moment(this[_0x0e57('0x5')](_0x0e57('0x6')))[_0x0e57('0x7')](_0x0e57('0x8'));var _0x5fc066=_0x2d17e0['diff'](_0x346005,'seconds');this[_0x0e57('0x9')]('queuecallerleaveAt',_0xabffee);this['setDataValue'](_0x0e57('0xa'),_0x5fc066||null);}},'position':{'type':Sequelize[_0x0e57('0xb')]},'count':{'type':Sequelize[_0x0e57('0xb')]},'queuecallerabandon':{'type':Sequelize[_0x0e57('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0x0e57('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x0e57('0x4')]},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x0e57('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0x0e57('0x3')],'comment':_0x0e57('0xd')},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize[_0x0e57('0x3')]},'connectedlinenum':{'type':Sequelize[_0x0e57('0x3')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x0e57('0x3')]},'exten':{'type':Sequelize[_0x0e57('0x3')]},'priority':{'type':Sequelize[_0x0e57('0x3')]},'holdtime':{'type':Sequelize[_0x0e57('0xb')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x0e57('0xc')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x0e57('0x3')]},'transfer':{'type':Sequelize[_0x0e57('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x0e57('0x3')],'comment':_0x0e57('0xe')},'transferexten':{'type':Sequelize[_0x0e57('0x3')]},'transferuniqueid':{'type':Sequelize[_0x0e57('0x3')]},'disposition':{'type':Sequelize[_0x0e57('0x3')]},'secondDisposition':{'type':Sequelize[_0x0e57('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize[_0x0e57('0xb')],'defaultValue':0x0},'note':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index daf243c..f976b20 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 _0xedd8=['end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','then','destroy','sendStatus','error','stack','name','send','map','fieldName','type','model','query','keys','intersection','attributes','fields','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','VoiceQueueReport','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','update','describe','getVoiceQueuesReport','eml-format','rimraf','moment','mustache','sox','to-csv','ejs','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register','status'];(function(_0x4c00a3,_0x2d23e2){var _0x893854=function(_0x6f552c){while(--_0x6f552c){_0x4c00a3['push'](_0x4c00a3['shift']());}};_0x893854(++_0x2d23e2);}(_0xedd8,0x7f));var _0x8edd=function(_0x47408e,_0x481428){_0x47408e=_0x47408e-0x0;var _0x1636bc=_0xedd8[_0x47408e];return _0x1636bc;};'use strict';var emlformat=require(_0x8edd('0x0'));var rimraf=require(_0x8edd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8edd('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x8edd('0x3'));var util=require('util');var path=require('path');var sox=require(_0x8edd('0x4'));var csv=require(_0x8edd('0x5'));var ejs=require(_0x8edd('0x6'));var fs=require('fs');var fs_extra=require(_0x8edd('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x8edd('0x8'));var jsforce=require(_0x8edd('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x8edd('0x5'));var querystring=require(_0x8edd('0xa'));var Papa=require(_0x8edd('0xb'));var Redis=require(_0x8edd('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x8edd('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8edd('0xe'));var logger=require(_0x8edd('0xf'))(_0x8edd('0x10'));var utils=require(_0x8edd('0x11'));var config=require(_0x8edd('0x12'));var licenseUtil=require(_0x8edd('0x13'));var db=require(_0x8edd('0x14'))['db'];config[_0x8edd('0x15')]=_['defaults'](config[_0x8edd('0x15')],{'host':_0x8edd('0x16'),'port':0x18eb});var socket=require(_0x8edd('0x17'))(new Redis(config[_0x8edd('0x15')]));require(_0x8edd('0x18'))[_0x8edd('0x19')](socket);function respondWithStatusCode(_0x1a6ff2,_0x2e2d6f){_0x2e2d6f=_0x2e2d6f||0xcc;return function(_0x4ca809){if(_0x4ca809){return _0x1a6ff2['sendStatus'](_0x2e2d6f);}return _0x1a6ff2[_0x8edd('0x1a')](_0x2e2d6f)[_0x8edd('0x1b')]();};}function respondWithResult(_0x49b281,_0x53963d){_0x53963d=_0x53963d||0xc8;return function(_0x49acd0){if(_0x49acd0){return _0x49b281[_0x8edd('0x1a')](_0x53963d)[_0x8edd('0x1c')](_0x49acd0);}};}function respondWithFilteredResult(_0x3116b7,_0x583ff1){return function(_0x2c614f){if(_0x2c614f){var _0x2f63a0=typeof _0x583ff1['offset']===_0x8edd('0x1d')&&typeof _0x583ff1[_0x8edd('0x1e')]==='undefined';var _0x1f9f22=_0x2c614f[_0x8edd('0x1f')];var _0x138dbf=_0x2f63a0?0x0:_0x583ff1[_0x8edd('0x20')];var _0x2f641b=_0x2f63a0?_0x2c614f[_0x8edd('0x1f')]:_0x583ff1['offset']+_0x583ff1['limit'];var _0x2857b3;if(_0x2f641b>=_0x1f9f22){_0x2f641b=_0x1f9f22;_0x2857b3=0xc8;}else{_0x2857b3=0xce;}_0x3116b7['status'](_0x2857b3);return _0x3116b7[_0x8edd('0x21')](_0x8edd('0x22'),_0x138dbf+'-'+_0x2f641b+'/'+_0x1f9f22)[_0x8edd('0x1c')](_0x2c614f);}return null;};}function patchUpdates(_0x51d2d4){return function(_0x17b39e){try{jsonpatch[_0x8edd('0x23')](_0x17b39e,_0x51d2d4,!![]);}catch(_0x20bbdb){return BPromise[_0x8edd('0x24')](_0x20bbdb);}return _0x17b39e['save']();};}function saveUpdates(_0x596784,_0x48cff6){return function(_0xefb0a7){if(_0xefb0a7){return _0xefb0a7['update'](_0x596784)[_0x8edd('0x25')](function(_0x49874e){return _0x49874e;});}return null;};}function removeEntity(_0x10ea3f,_0x22bd44){return function(_0x143f6a){if(_0x143f6a){return _0x143f6a[_0x8edd('0x26')]()[_0x8edd('0x25')](function(){_0x10ea3f[_0x8edd('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x262871,_0x7c0dcd){return function(_0x3d3908){if(!_0x3d3908){_0x262871[_0x8edd('0x27')](0x194);}return _0x3d3908;};}function handleError(_0xb63cb6,_0x2b3c50){_0x2b3c50=_0x2b3c50||0x1f4;return function(_0x2149a3){logger[_0x8edd('0x28')](_0x2149a3[_0x8edd('0x29')]);if(_0x2149a3[_0x8edd('0x2a')]){delete _0x2149a3['name'];}_0xb63cb6[_0x8edd('0x1a')](_0x2b3c50)[_0x8edd('0x2b')](_0x2149a3);};}exports['index']=function(_0x4848fe,_0x54b02e){var _0x1a5115={},_0xe795f4={},_0x54c3eb={'count':0x0,'rows':[]};var _0x324a99=_[_0x8edd('0x2c')](db['VoiceQueueReport']['rawAttributes'],function(_0x4fb8bd){return{'name':_0x4fb8bd[_0x8edd('0x2d')],'type':_0x4fb8bd[_0x8edd('0x2e')]['key']};});_0xe795f4[_0x8edd('0x2f')]=_['map'](_0x324a99,_0x8edd('0x2a'));_0xe795f4[_0x8edd('0x30')]=_[_0x8edd('0x31')](_0x4848fe[_0x8edd('0x30')]);_0xe795f4['filters']=_[_0x8edd('0x32')](_0xe795f4[_0x8edd('0x2f')],_0xe795f4[_0x8edd('0x30')]);_0x1a5115[_0x8edd('0x33')]=_[_0x8edd('0x32')](_0xe795f4[_0x8edd('0x2f')],qs[_0x8edd('0x34')](_0x4848fe[_0x8edd('0x30')][_0x8edd('0x34')]));_0x1a5115[_0x8edd('0x33')]=_0x1a5115[_0x8edd('0x33')]['length']?_0x1a5115[_0x8edd('0x33')]:_0xe795f4[_0x8edd('0x2f')];if(!_0x4848fe[_0x8edd('0x30')]['hasOwnProperty']('nolimit')){_0x1a5115[_0x8edd('0x1e')]=qs[_0x8edd('0x1e')](_0x4848fe['query'][_0x8edd('0x1e')]);_0x1a5115[_0x8edd('0x20')]=qs[_0x8edd('0x20')](_0x4848fe[_0x8edd('0x30')]['offset']);}_0x1a5115[_0x8edd('0x35')]=qs[_0x8edd('0x36')](_0x4848fe['query'][_0x8edd('0x36')]);_0x1a5115['where']=qs[_0x8edd('0x37')](_[_0x8edd('0x38')](_0x4848fe[_0x8edd('0x30')],_0xe795f4[_0x8edd('0x37')]),_0x324a99);if(_0x4848fe[_0x8edd('0x30')][_0x8edd('0x39')]){_0x1a5115[_0x8edd('0x3a')]=_[_0x8edd('0x3b')](_0x1a5115[_0x8edd('0x3a')],{'$or':_['map'](_0x324a99,function(_0x38bd5f){if(_0x38bd5f[_0x8edd('0x2e')]!==_0x8edd('0x3c')){var _0x1a5e7e={};_0x1a5e7e[_0x38bd5f[_0x8edd('0x2a')]]={'$like':'%'+_0x4848fe['query'][_0x8edd('0x39')]+'%'};return _0x1a5e7e;}})});}_0x1a5115=_[_0x8edd('0x3b')]({},_0x1a5115,_0x4848fe[_0x8edd('0x3d')]);var _0x4b7895={'where':_0x1a5115[_0x8edd('0x3a')]};return db[_0x8edd('0x3e')][_0x8edd('0x1f')](_0x4b7895)[_0x8edd('0x25')](function(_0x4b2a2c){_0x54c3eb[_0x8edd('0x1f')]=_0x4b2a2c;if(_0x4848fe[_0x8edd('0x30')][_0x8edd('0x3f')]){_0x1a5115[_0x8edd('0x40')]=[{'all':!![]}];}return db[_0x8edd('0x3e')][_0x8edd('0x41')](_0x1a5115);})['then'](function(_0x3cc959){_0x54c3eb[_0x8edd('0x42')]=_0x3cc959;return _0x54c3eb;})['then'](respondWithFilteredResult(_0x54b02e,_0x1a5115))[_0x8edd('0x43')](handleError(_0x54b02e,null));};exports[_0x8edd('0x44')]=function(_0xdbf230,_0xdc12e4){var _0x4e3f5d={'raw':![],'where':{'id':_0xdbf230[_0x8edd('0x45')]['id']}},_0x112740={};_0x112740['model']=_[_0x8edd('0x31')](db[_0x8edd('0x3e')][_0x8edd('0x46')]);_0x112740[_0x8edd('0x30')]=_[_0x8edd('0x31')](_0xdbf230[_0x8edd('0x30')]);_0x112740['filters']=_[_0x8edd('0x32')](_0x112740[_0x8edd('0x2f')],_0x112740[_0x8edd('0x30')]);_0x4e3f5d[_0x8edd('0x33')]=_[_0x8edd('0x32')](_0x112740[_0x8edd('0x2f')],qs[_0x8edd('0x34')](_0xdbf230[_0x8edd('0x30')]['fields']));_0x4e3f5d[_0x8edd('0x33')]=_0x4e3f5d[_0x8edd('0x33')]['length']?_0x4e3f5d[_0x8edd('0x33')]:_0x112740['model'];if(_0xdbf230['query']['includeAll']){_0x4e3f5d[_0x8edd('0x40')]=[{'all':!![]}];}_0x4e3f5d=_[_0x8edd('0x3b')]({},_0x4e3f5d,_0xdbf230['options']);return db[_0x8edd('0x3e')][_0x8edd('0x47')](_0x4e3f5d)[_0x8edd('0x25')](handleEntityNotFound(_0xdc12e4,null))[_0x8edd('0x25')](respondWithResult(_0xdc12e4,null))[_0x8edd('0x43')](handleError(_0xdc12e4,null));};exports[_0x8edd('0x48')]=function(_0x4b350c,_0x5ecfb7){return db['VoiceQueueReport'][_0x8edd('0x48')](_0x4b350c[_0x8edd('0x49')],{})[_0x8edd('0x25')](respondWithResult(_0x5ecfb7,0xc9))['catch'](handleError(_0x5ecfb7,null));};exports[_0x8edd('0x4a')]=function(_0x3564f3,_0x57188d){if(_0x3564f3[_0x8edd('0x49')]['id']){delete _0x3564f3['body']['id'];}return db[_0x8edd('0x3e')]['find']({'where':{'id':_0x3564f3[_0x8edd('0x45')]['id']}})[_0x8edd('0x25')](handleEntityNotFound(_0x57188d,null))[_0x8edd('0x25')](saveUpdates(_0x3564f3['body'],null))[_0x8edd('0x25')](respondWithResult(_0x57188d,null))[_0x8edd('0x43')](handleError(_0x57188d,null));};exports[_0x8edd('0x26')]=function(_0x5578bd,_0x4fd418){return db[_0x8edd('0x3e')][_0x8edd('0x47')]({'where':{'id':_0x5578bd['params']['id']}})[_0x8edd('0x25')](handleEntityNotFound(_0x4fd418,null))[_0x8edd('0x25')](removeEntity(_0x4fd418,null))[_0x8edd('0x43')](handleError(_0x4fd418,null));};exports[_0x8edd('0x4b')]=function(_0x6d02ff,_0x392bc7){return db['VoiceQueueReport'][_0x8edd('0x4b')]()['then'](respondWithResult(_0x392bc7,null))['catch'](handleError(_0x392bc7,null));};exports['getVoiceQueuesReport']=function(_0x31f2c5,_0x14e1f3){var _0x177c72={},_0x384d65={},_0x5de3a4={'count':0x0,'rows':[]};_0x384d65[_0x8edd('0x2f')]=_[_0x8edd('0x31')](db[_0x8edd('0x3e')]['rawAttributes']);_0x384d65['query']=_['keys'](_0x31f2c5[_0x8edd('0x30')]);_0x384d65[_0x8edd('0x37')]=_['intersection'](_0x384d65[_0x8edd('0x2f')],_0x384d65[_0x8edd('0x30')]);_0x177c72['attributes']=_[_0x8edd('0x32')](_0x384d65[_0x8edd('0x2f')],qs[_0x8edd('0x34')](_0x31f2c5[_0x8edd('0x30')][_0x8edd('0x34')]));_0x177c72[_0x8edd('0x33')]=_0x177c72['attributes']['length']?_0x177c72[_0x8edd('0x33')]:_0x384d65[_0x8edd('0x2f')];if(!_0x31f2c5[_0x8edd('0x30')]['hasOwnProperty']('nolimit')){_0x177c72[_0x8edd('0x1e')]=qs[_0x8edd('0x1e')](_0x31f2c5[_0x8edd('0x30')][_0x8edd('0x1e')]);_0x177c72[_0x8edd('0x20')]=qs[_0x8edd('0x20')](_0x31f2c5[_0x8edd('0x30')][_0x8edd('0x20')]);}_0x177c72[_0x8edd('0x35')]=qs['sort'](_0x31f2c5[_0x8edd('0x30')][_0x8edd('0x36')]);_0x177c72[_0x8edd('0x3a')]=qs[_0x8edd('0x37')](_['pick'](_0x31f2c5[_0x8edd('0x30')],_0x384d65['filters']));if(_0x31f2c5[_0x8edd('0x30')][_0x8edd('0x39')]){_0x177c72[_0x8edd('0x3a')]=_[_0x8edd('0x3b')](_0x177c72[_0x8edd('0x3a')],{'$or':_['map'](_0x177c72[_0x8edd('0x33')],function(_0x518c1e){var _0x3b505d={};_0x3b505d[_0x518c1e]={'$like':'%'+_0x31f2c5[_0x8edd('0x30')][_0x8edd('0x39')]+'%'};return _0x3b505d;})});}_0x177c72=_['merge']({},_0x177c72,_0x31f2c5[_0x8edd('0x3d')]);var _0x4a6c32={'where':_0x177c72[_0x8edd('0x3a')]};return db[_0x8edd('0x3e')][_0x8edd('0x1f')](_0x4a6c32)[_0x8edd('0x25')](function(_0x33c76e){_0x5de3a4['count']=_0x33c76e;if(_0x31f2c5['query'][_0x8edd('0x3f')]){_0x177c72[_0x8edd('0x40')]=[{'all':!![]}];}return db[_0x8edd('0x3e')][_0x8edd('0x41')](_0x177c72);})[_0x8edd('0x25')](function(_0x264177){_0x5de3a4[_0x8edd('0x42')]=_0x264177;return _0x5de3a4;})['then'](respondWithFilteredResult(_0x14e1f3,_0x177c72,_0x8edd('0x4c')))[_0x8edd('0x43')](handleError(_0x14e1f3,null,_0x8edd('0x4c')));}; \ No newline at end of file +var _0x36d4=['jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','sendStatus','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','status','error','stack','name','send','index','map','VoiceQueueReport','fieldName','query','keys','filters','intersection','attributes','fields','length','model','nolimit','order','sort','pick','where','merge','type','VIRTUAL','filter','options','includeAll','include','catch','params','rawAttributes','find','create','body','destroy','describe','hasOwnProperty','findAll','rows','getVoiceQueuesReport','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto'];(function(_0x5ff517,_0x3e4ee0){var _0x19a245=function(_0x4c00ac){while(--_0x4c00ac){_0x5ff517['push'](_0x5ff517['shift']());}};_0x19a245(++_0x3e4ee0);}(_0x36d4,0xe4));var _0x436d=function(_0x56f6c0,_0x37c097){_0x56f6c0=_0x56f6c0-0x0;var _0x249342=_0x36d4[_0x56f6c0];return _0x249342;};'use strict';var emlformat=require(_0x436d('0x0'));var rimraf=require(_0x436d('0x1'));var zipdir=require(_0x436d('0x2'));var jsonpatch=require(_0x436d('0x3'));var rp=require(_0x436d('0x4'));var moment=require(_0x436d('0x5'));var BPromise=require(_0x436d('0x6'));var Mustache=require(_0x436d('0x7'));var util=require('util');var path=require(_0x436d('0x8'));var sox=require(_0x436d('0x9'));var csv=require(_0x436d('0xa'));var ejs=require(_0x436d('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x436d('0xc'));var squel=require(_0x436d('0xd'));var crypto=require(_0x436d('0xe'));var jsforce=require(_0x436d('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x436d('0xa'));var querystring=require(_0x436d('0x10'));var Papa=require('papaparse');var Redis=require(_0x436d('0x11'));var authService=require(_0x436d('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x436d('0x13'));var hardwareService=require(_0x436d('0x14'));var logger=require(_0x436d('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x436d('0x16'));var licenseUtil=require(_0x436d('0x17'));var db=require('../../mysqldb')['db'];config[_0x436d('0x18')]=_[_0x436d('0x19')](config[_0x436d('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x436d('0x1a'))(new Redis(config[_0x436d('0x18')]));require('./voiceQueueReport.socket')['register'](socket);function respondWithStatusCode(_0x1ed52c,_0x31d504){_0x31d504=_0x31d504||0xcc;return function(_0x25cf2c){if(_0x25cf2c){return _0x1ed52c[_0x436d('0x1b')](_0x31d504);}return _0x1ed52c['status'](_0x31d504)[_0x436d('0x1c')]();};}function respondWithResult(_0x4aff07,_0x37ab23){_0x37ab23=_0x37ab23||0xc8;return function(_0x3600ec){if(_0x3600ec){return _0x4aff07['status'](_0x37ab23)[_0x436d('0x1d')](_0x3600ec);}};}function respondWithFilteredResult(_0x40d5c0,_0x2786e5){return function(_0x227eb1){if(_0x227eb1){var _0x2ef031=typeof _0x2786e5['offset']===_0x436d('0x1e')&&typeof _0x2786e5[_0x436d('0x1f')]===_0x436d('0x1e');var _0x5b11a3=_0x227eb1[_0x436d('0x20')];var _0x558a07=_0x2ef031?0x0:_0x2786e5[_0x436d('0x21')];var _0x1c99cf=_0x2ef031?_0x227eb1[_0x436d('0x20')]:_0x2786e5['offset']+_0x2786e5['limit'];var _0x3ea0a7;if(_0x1c99cf>=_0x5b11a3){_0x1c99cf=_0x5b11a3;_0x3ea0a7=0xc8;}else{_0x3ea0a7=0xce;}_0x40d5c0['status'](_0x3ea0a7);return _0x40d5c0[_0x436d('0x22')](_0x436d('0x23'),_0x558a07+'-'+_0x1c99cf+'/'+_0x5b11a3)['json'](_0x227eb1);}return null;};}function patchUpdates(_0x20d712){return function(_0x39c130){try{jsonpatch[_0x436d('0x24')](_0x39c130,_0x20d712,!![]);}catch(_0x4be50e){return BPromise[_0x436d('0x25')](_0x4be50e);}return _0x39c130['save']();};}function saveUpdates(_0x205833,_0x1560f0){return function(_0x21deae){if(_0x21deae){return _0x21deae[_0x436d('0x26')](_0x205833)[_0x436d('0x27')](function(_0x2fb7af){return _0x2fb7af;});}return null;};}function removeEntity(_0x130175,_0x228cfe){return function(_0x571620){if(_0x571620){return _0x571620['destroy']()[_0x436d('0x27')](function(){_0x130175[_0x436d('0x28')](0xcc)[_0x436d('0x1c')]();});}};}function handleEntityNotFound(_0x3c8dcd,_0x41fa50){return function(_0xd2cf9b){if(!_0xd2cf9b){_0x3c8dcd[_0x436d('0x1b')](0x194);}return _0xd2cf9b;};}function handleError(_0x4d4cc2,_0x459042){_0x459042=_0x459042||0x1f4;return function(_0x1914d9){logger[_0x436d('0x29')](_0x1914d9[_0x436d('0x2a')]);if(_0x1914d9[_0x436d('0x2b')]){delete _0x1914d9[_0x436d('0x2b')];}_0x4d4cc2[_0x436d('0x28')](_0x459042)[_0x436d('0x2c')](_0x1914d9);};}exports[_0x436d('0x2d')]=function(_0x2b8d31,_0x1fd680){var _0xe25061={},_0x5cfbc3={},_0x22bdc9={'count':0x0,'rows':[]};var _0x26ac2c=_[_0x436d('0x2e')](db[_0x436d('0x2f')]['rawAttributes'],function(_0x510761){return{'name':_0x510761[_0x436d('0x30')],'type':_0x510761['type']['key']};});_0x5cfbc3['model']=_[_0x436d('0x2e')](_0x26ac2c,_0x436d('0x2b'));_0x5cfbc3[_0x436d('0x31')]=_[_0x436d('0x32')](_0x2b8d31[_0x436d('0x31')]);_0x5cfbc3[_0x436d('0x33')]=_[_0x436d('0x34')](_0x5cfbc3['model'],_0x5cfbc3[_0x436d('0x31')]);_0xe25061[_0x436d('0x35')]=_[_0x436d('0x34')](_0x5cfbc3['model'],qs[_0x436d('0x36')](_0x2b8d31[_0x436d('0x31')]['fields']));_0xe25061['attributes']=_0xe25061[_0x436d('0x35')][_0x436d('0x37')]?_0xe25061[_0x436d('0x35')]:_0x5cfbc3[_0x436d('0x38')];if(!_0x2b8d31['query']['hasOwnProperty'](_0x436d('0x39'))){_0xe25061[_0x436d('0x1f')]=qs['limit'](_0x2b8d31[_0x436d('0x31')]['limit']);_0xe25061[_0x436d('0x21')]=qs[_0x436d('0x21')](_0x2b8d31[_0x436d('0x31')]['offset']);}_0xe25061[_0x436d('0x3a')]=qs[_0x436d('0x3b')](_0x2b8d31['query']['sort']);_0xe25061['where']=qs[_0x436d('0x33')](_[_0x436d('0x3c')](_0x2b8d31[_0x436d('0x31')],_0x5cfbc3[_0x436d('0x33')]),_0x26ac2c);if(_0x2b8d31[_0x436d('0x31')]['filter']){_0xe25061[_0x436d('0x3d')]=_[_0x436d('0x3e')](_0xe25061[_0x436d('0x3d')],{'$or':_[_0x436d('0x2e')](_0x26ac2c,function(_0x493773){if(_0x493773[_0x436d('0x3f')]!==_0x436d('0x40')){var _0x237e3b={};_0x237e3b[_0x493773[_0x436d('0x2b')]]={'$like':'%'+_0x2b8d31['query'][_0x436d('0x41')]+'%'};return _0x237e3b;}})});}_0xe25061=_[_0x436d('0x3e')]({},_0xe25061,_0x2b8d31[_0x436d('0x42')]);var _0x234922={'where':_0xe25061[_0x436d('0x3d')]};return db[_0x436d('0x2f')][_0x436d('0x20')](_0x234922)['then'](function(_0x21c7eb){_0x22bdc9[_0x436d('0x20')]=_0x21c7eb;if(_0x2b8d31['query'][_0x436d('0x43')]){_0xe25061[_0x436d('0x44')]=[{'all':!![]}];}return db[_0x436d('0x2f')]['findAll'](_0xe25061);})[_0x436d('0x27')](function(_0x4c5c57){_0x22bdc9['rows']=_0x4c5c57;return _0x22bdc9;})[_0x436d('0x27')](respondWithFilteredResult(_0x1fd680,_0xe25061))[_0x436d('0x45')](handleError(_0x1fd680,null));};exports['show']=function(_0x16af9b,_0x29baeb){var _0x2705a9={'raw':![],'where':{'id':_0x16af9b[_0x436d('0x46')]['id']}},_0xca8a6c={};_0xca8a6c['model']=_[_0x436d('0x32')](db[_0x436d('0x2f')][_0x436d('0x47')]);_0xca8a6c['query']=_[_0x436d('0x32')](_0x16af9b['query']);_0xca8a6c[_0x436d('0x33')]=_['intersection'](_0xca8a6c['model'],_0xca8a6c[_0x436d('0x31')]);_0x2705a9['attributes']=_['intersection'](_0xca8a6c['model'],qs[_0x436d('0x36')](_0x16af9b['query'][_0x436d('0x36')]));_0x2705a9[_0x436d('0x35')]=_0x2705a9[_0x436d('0x35')][_0x436d('0x37')]?_0x2705a9[_0x436d('0x35')]:_0xca8a6c['model'];if(_0x16af9b[_0x436d('0x31')][_0x436d('0x43')]){_0x2705a9[_0x436d('0x44')]=[{'all':!![]}];}_0x2705a9=_[_0x436d('0x3e')]({},_0x2705a9,_0x16af9b[_0x436d('0x42')]);return db[_0x436d('0x2f')][_0x436d('0x48')](_0x2705a9)[_0x436d('0x27')](handleEntityNotFound(_0x29baeb,null))['then'](respondWithResult(_0x29baeb,null))['catch'](handleError(_0x29baeb,null));};exports[_0x436d('0x49')]=function(_0x3202f4,_0x1eb3d9){return db[_0x436d('0x2f')]['create'](_0x3202f4['body'],{})[_0x436d('0x27')](respondWithResult(_0x1eb3d9,0xc9))[_0x436d('0x45')](handleError(_0x1eb3d9,null));};exports[_0x436d('0x26')]=function(_0x188c9f,_0x40f092){if(_0x188c9f['body']['id']){delete _0x188c9f[_0x436d('0x4a')]['id'];}return db[_0x436d('0x2f')][_0x436d('0x48')]({'where':{'id':_0x188c9f[_0x436d('0x46')]['id']}})['then'](handleEntityNotFound(_0x40f092,null))[_0x436d('0x27')](saveUpdates(_0x188c9f['body'],null))[_0x436d('0x27')](respondWithResult(_0x40f092,null))[_0x436d('0x45')](handleError(_0x40f092,null));};exports[_0x436d('0x4b')]=function(_0x11414e,_0x386d46){return db[_0x436d('0x2f')][_0x436d('0x48')]({'where':{'id':_0x11414e['params']['id']}})[_0x436d('0x27')](handleEntityNotFound(_0x386d46,null))[_0x436d('0x27')](removeEntity(_0x386d46,null))[_0x436d('0x45')](handleError(_0x386d46,null));};exports['describe']=function(_0x41a12a,_0x3e151e){return db['VoiceQueueReport'][_0x436d('0x4c')]()['then'](respondWithResult(_0x3e151e,null))[_0x436d('0x45')](handleError(_0x3e151e,null));};exports['getVoiceQueuesReport']=function(_0x5765fe,_0x18701c){var _0x4f8c43={},_0x45efaa={},_0x5b9508={'count':0x0,'rows':[]};_0x45efaa[_0x436d('0x38')]=_['keys'](db[_0x436d('0x2f')]['rawAttributes']);_0x45efaa['query']=_[_0x436d('0x32')](_0x5765fe[_0x436d('0x31')]);_0x45efaa['filters']=_['intersection'](_0x45efaa['model'],_0x45efaa[_0x436d('0x31')]);_0x4f8c43['attributes']=_[_0x436d('0x34')](_0x45efaa[_0x436d('0x38')],qs[_0x436d('0x36')](_0x5765fe[_0x436d('0x31')][_0x436d('0x36')]));_0x4f8c43[_0x436d('0x35')]=_0x4f8c43[_0x436d('0x35')]['length']?_0x4f8c43[_0x436d('0x35')]:_0x45efaa[_0x436d('0x38')];if(!_0x5765fe['query'][_0x436d('0x4d')](_0x436d('0x39'))){_0x4f8c43['limit']=qs[_0x436d('0x1f')](_0x5765fe[_0x436d('0x31')][_0x436d('0x1f')]);_0x4f8c43[_0x436d('0x21')]=qs[_0x436d('0x21')](_0x5765fe[_0x436d('0x31')][_0x436d('0x21')]);}_0x4f8c43[_0x436d('0x3a')]=qs[_0x436d('0x3b')](_0x5765fe[_0x436d('0x31')]['sort']);_0x4f8c43[_0x436d('0x3d')]=qs['filters'](_[_0x436d('0x3c')](_0x5765fe[_0x436d('0x31')],_0x45efaa['filters']));if(_0x5765fe['query'][_0x436d('0x41')]){_0x4f8c43[_0x436d('0x3d')]=_[_0x436d('0x3e')](_0x4f8c43[_0x436d('0x3d')],{'$or':_[_0x436d('0x2e')](_0x4f8c43[_0x436d('0x35')],function(_0x330bfb){var _0x59aa91={};_0x59aa91[_0x330bfb]={'$like':'%'+_0x5765fe['query'][_0x436d('0x41')]+'%'};return _0x59aa91;})});}_0x4f8c43=_[_0x436d('0x3e')]({},_0x4f8c43,_0x5765fe['options']);var _0x56cb28={'where':_0x4f8c43[_0x436d('0x3d')]};return db[_0x436d('0x2f')][_0x436d('0x20')](_0x56cb28)[_0x436d('0x27')](function(_0x2f7867){_0x5b9508[_0x436d('0x20')]=_0x2f7867;if(_0x5765fe[_0x436d('0x31')][_0x436d('0x43')]){_0x4f8c43['include']=[{'all':!![]}];}return db[_0x436d('0x2f')][_0x436d('0x4e')](_0x4f8c43);})[_0x436d('0x27')](function(_0x2e6654){_0x5b9508[_0x436d('0x4f')]=_0x2e6654;return _0x5b9508;})['then'](respondWithFilteredResult(_0x18701c,_0x4f8c43,_0x436d('0x50')))['catch'](handleError(_0x18701c,null,_0x436d('0x50')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index f92760c..6e24cc1 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 _0xaa9e=['save','emit','exports','events','VoiceQueueReport'];(function(_0x236f1d,_0x28e3ca){var _0x64ecb3=function(_0x21dd2e){while(--_0x21dd2e){_0x236f1d['push'](_0x236f1d['shift']());}};_0x64ecb3(++_0x28e3ca);}(_0xaa9e,0x1ed));var _0xeaa9=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0xaa9e[_0x5d4607];return _0x5e4a86;};'use strict';var EventEmitter=require(_0xeaa9('0x0'));var VoiceQueueReport=require('../../mysqldb')['db'][_0xeaa9('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xeaa9('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x7630e8){return function(_0x224528,_0x4219af,_0x119f7e){VoiceQueueReportEvents[_0xeaa9('0x3')](_0x7630e8+':'+_0x224528['id'],_0x224528);VoiceQueueReportEvents[_0xeaa9('0x3')](_0x7630e8,_0x224528);_0x119f7e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module[_0xeaa9('0x4')]=VoiceQueueReportEvents; \ No newline at end of file +var _0xaca1=['../../mysqldb','VoiceQueueReport','setMaxListeners','save','remove','emit','hasOwnProperty','exports','events'];(function(_0x1601ad,_0x4e4a92){var _0x3973aa=function(_0x39f34d){while(--_0x39f34d){_0x1601ad['push'](_0x1601ad['shift']());}};_0x3973aa(++_0x4e4a92);}(_0xaca1,0xb3));var _0x1aca=function(_0x349211,_0x5ddbff){_0x349211=_0x349211-0x0;var _0x1f308f=_0xaca1[_0x349211];return _0x1f308f;};'use strict';var EventEmitter=require(_0x1aca('0x0'));var VoiceQueueReport=require(_0x1aca('0x1'))['db'][_0x1aca('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x1aca('0x3')](0x0);var events={'afterCreate':_0x1aca('0x4'),'afterUpdate':'update','afterDestroy':_0x1aca('0x5')};function emitEvent(_0x1764b6){return function(_0x3def42,_0x1847d0,_0xfd8e9a){VoiceQueueReportEvents['emit'](_0x1764b6+':'+_0x3def42['id'],_0x3def42);VoiceQueueReportEvents[_0x1aca('0x6')](_0x1764b6,_0x3def42);_0xfd8e9a(null);};}for(var e in events){if(events[_0x1aca('0x7')](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module[_0x1aca('0x8')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 46c31c8..8922938 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 _0xffa6=['VoiceQueueReport','report_queue','uniqueid','calleridnum','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueueReport.attributes','exports','define'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0xffa6,0x19c));var _0x6ffa=function(_0x57a5e9,_0x23ff1a){_0x57a5e9=_0x57a5e9-0x0;var _0x276b6e=_0xffa6[_0x57a5e9];return _0x276b6e;};'use strict';var _=require(_0x6ffa('0x0'));var util=require(_0x6ffa('0x1'));var logger=require(_0x6ffa('0x2'))(_0x6ffa('0x3'));var moment=require(_0x6ffa('0x4'));var BPromise=require(_0x6ffa('0x5'));var rp=require(_0x6ffa('0x6'));var fs=require('fs');var path=require(_0x6ffa('0x7'));var rimraf=require(_0x6ffa('0x8'));var config=require(_0x6ffa('0x9'));var attributes=require(_0x6ffa('0xa'));module[_0x6ffa('0xb')]=function(_0x2f8390,_0x54bf37){return _0x2f8390[_0x6ffa('0xc')](_0x6ffa('0xd'),attributes,{'tableName':_0x6ffa('0xe'),'paranoid':![],'indexes':[{'fields':[_0x6ffa('0xf')]},{'fields':[_0x6ffa('0x10')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2ef7=['report_queue','uniqueid','calleridnum','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','exports','define','VoiceQueueReport'];(function(_0x211c74,_0x4b6011){var _0x1d4a82=function(_0x27a04b){while(--_0x27a04b){_0x211c74['push'](_0x211c74['shift']());}};_0x1d4a82(++_0x4b6011);}(_0x2ef7,0x1bd));var _0x72ef=function(_0x2bae27,_0x5c7aee){_0x2bae27=_0x2bae27-0x0;var _0x56897d=_0x2ef7[_0x2bae27];return _0x56897d;};'use strict';var _=require(_0x72ef('0x0'));var util=require(_0x72ef('0x1'));var logger=require(_0x72ef('0x2'))('api');var moment=require('moment');var BPromise=require(_0x72ef('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x72ef('0x4'));var rimraf=require(_0x72ef('0x5'));var config=require(_0x72ef('0x6'));var attributes=require('./voiceQueueReport.attributes');module[_0x72ef('0x7')]=function(_0x256395,_0x72ddcc){return _0x256395[_0x72ef('0x8')](_0x72ef('0x9'),attributes,{'tableName':_0x72ef('0xa'),'paranoid':![],'indexes':[{'fields':[_0x72ef('0xb')]},{'fields':[_0x72ef('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 91ed4be..a99d180 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 _0x34b9=['localhost','socket.io-emitter','redis','./voiceQueueReport.socket','register','then','info','request\x20sent','VoiceQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','VoiceQueueReport,\x20%s,\x20%s','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','where','attributes','limit','model','include','map','debug','stringify','CreateVoiceQueueReport','create','body','UpdateVoiceQueueReport','update','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','defaults'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x34b9,0x1a5));var _0x934b=function(_0x256893,_0x394bd3){_0x256893=_0x256893-0x0;var _0x558bb9=_0x34b9[_0x256893];return _0x558bb9;};'use strict';var _=require('lodash');var util=require(_0x934b('0x0'));var moment=require(_0x934b('0x1'));var BPromise=require(_0x934b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x934b('0x3'));var db=require(_0x934b('0x4'))['db'];var utils=require(_0x934b('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x934b('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x934b('0x7')](config['redis'],{'host':_0x934b('0x8'),'port':0x18eb});var socket=require(_0x934b('0x9'))(new Redis(config[_0x934b('0xa')]));require(_0x934b('0xb'))[_0x934b('0xc')](socket);function respondWithRpcPromise(_0x3a59c2,_0x3ef036,_0x397a9e){return new BPromise(function(_0x187f69,_0x3c86e3){return client['request'](_0x3a59c2,_0x397a9e)[_0x934b('0xd')](function(_0x47ca03){logger[_0x934b('0xe')]('VoiceQueueReport,\x20%s,\x20%s',_0x3ef036,_0x934b('0xf'));logger['debug'](_0x934b('0x10'),_0x3ef036,_0x934b('0xf'),JSON['stringify'](_0x47ca03));if(_0x47ca03[_0x934b('0x11')]){if(_0x47ca03[_0x934b('0x11')][_0x934b('0x12')]===0x1f4){logger[_0x934b('0x11')]('VoiceQueueReport,\x20%s,\x20%s',_0x3ef036,_0x47ca03[_0x934b('0x11')][_0x934b('0x13')]);return _0x3c86e3(_0x47ca03[_0x934b('0x11')]['message']);}logger[_0x934b('0x11')]('VoiceQueueReport,\x20%s,\x20%s',_0x3ef036,_0x47ca03[_0x934b('0x11')][_0x934b('0x13')]);return _0x187f69(_0x47ca03[_0x934b('0x11')][_0x934b('0x13')]);}else{logger['info'](_0x934b('0x14'),_0x3ef036,'request\x20sent');_0x187f69(_0x47ca03['result'][_0x934b('0x13')]);}})[_0x934b('0x15')](function(_0x17efb8){logger[_0x934b('0x11')](_0x934b('0x14'),_0x3ef036,_0x17efb8);_0x3c86e3(_0x17efb8);});});}exports[_0x934b('0x16')]=function(_0x51346c){var _0x226ca0=this;return new Promise(function(_0x845779,_0x1b41da){return db[_0x934b('0x17')][_0x934b('0x18')]({'raw':_0x51346c[_0x934b('0x19')]?_0x51346c[_0x934b('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x51346c[_0x934b('0x19')]?_0x51346c[_0x934b('0x19')][_0x934b('0x1a')]||null:null,'attributes':_0x51346c[_0x934b('0x19')]?_0x51346c[_0x934b('0x19')][_0x934b('0x1b')]||null:null,'limit':_0x51346c[_0x934b('0x19')]?_0x51346c['options'][_0x934b('0x1c')]||null:null,'include':_0x51346c[_0x934b('0x19')]?_0x51346c['options']['include']?_['map'](_0x51346c[_0x934b('0x19')]['include'],function(_0x62bd2b){return{'model':db[_0x62bd2b[_0x934b('0x1d')]],'as':_0x62bd2b['as'],'attributes':_0x62bd2b['attributes'],'include':_0x62bd2b[_0x934b('0x1e')]?_[_0x934b('0x1f')](_0x62bd2b['include'],function(_0x2d33e3){return{'model':db[_0x2d33e3[_0x934b('0x1d')]],'as':_0x2d33e3['as'],'attributes':_0x2d33e3[_0x934b('0x1b')],'include':_0x2d33e3[_0x934b('0x1e')]?_[_0x934b('0x1f')](_0x2d33e3[_0x934b('0x1e')],function(_0x4a7133){return{'model':db[_0x4a7133['model']],'as':_0x4a7133['as'],'attributes':_0x4a7133[_0x934b('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1e9c2c){logger['info'](_0x934b('0x16'),_0x51346c);logger[_0x934b('0x20')](_0x934b('0x16'),_0x51346c,JSON[_0x934b('0x21')](_0x1e9c2c));_0x845779(_0x1e9c2c);})['catch'](function(_0x38b555){logger['error']('GetVoiceQueueReport',_0x38b555[_0x934b('0x13')],_0x51346c);_0x1b41da(_0x226ca0[_0x934b('0x11')](0x1f4,_0x38b555['message']));});});};exports[_0x934b('0x22')]=function(_0xd5f584){var _0x13c5aa=this;return new Promise(function(_0x122969,_0x376ce3){return db['VoiceQueueReport'][_0x934b('0x23')](_0xd5f584[_0x934b('0x24')],{'raw':_0xd5f584['options']?_0xd5f584[_0x934b('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x934b('0xd')](function(_0x164b9e){logger[_0x934b('0xe')](_0x934b('0x22'),_0xd5f584);logger[_0x934b('0x20')]('CreateVoiceQueueReport',_0xd5f584,JSON['stringify'](_0x164b9e));_0x122969(_0x164b9e);})[_0x934b('0x15')](function(_0x5a2e72){logger[_0x934b('0x11')]('CreateVoiceQueueReport',_0x5a2e72[_0x934b('0x13')],_0xd5f584);_0x376ce3(_0x13c5aa[_0x934b('0x11')](0x1f4,_0x5a2e72[_0x934b('0x13')]));});});};exports[_0x934b('0x25')]=function(_0x413179){var _0x3135bc=this;return new Promise(function(_0x4f1c31,_0x26376c){return db['VoiceQueueReport'][_0x934b('0x26')](_0x413179['body'],{'raw':_0x413179[_0x934b('0x19')]?_0x413179['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x413179[_0x934b('0x19')]?_0x413179[_0x934b('0x19')]['where']||null:null,'attributes':_0x413179['options']?_0x413179['options'][_0x934b('0x1b')]||null:null,'limit':_0x413179['options']?_0x413179['options'][_0x934b('0x1c')]||null:null})['then'](function(_0x59e81e){logger[_0x934b('0xe')](_0x934b('0x25'),_0x413179);logger[_0x934b('0x20')](_0x934b('0x25'),_0x413179,JSON['stringify'](_0x59e81e));_0x4f1c31(_0x59e81e);})['catch'](function(_0x25c3c9){logger[_0x934b('0x11')](_0x934b('0x25'),_0x25c3c9[_0x934b('0x13')],_0x413179);_0x26376c(_0x3135bc[_0x934b('0x11')](0x1f4,_0x25c3c9[_0x934b('0x13')]));});});}; \ No newline at end of file +var _0x5cfd=['options','raw','where','attributes','limit','include','map','model','debug','CreateVoiceQueueReport','create','UpdateVoiceQueueReport','update','body','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','./voiceQueueReport.socket','register','request','then','info','request\x20sent','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceQueueReport,\x20%s,\x20%s','message','catch','GetVoiceQueueReport','VoiceQueueReport','findAll'];(function(_0x44a3e1,_0x4084b4){var _0x493faa=function(_0x406529){while(--_0x406529){_0x44a3e1['push'](_0x44a3e1['shift']());}};_0x493faa(++_0x4084b4);}(_0x5cfd,0x1a3));var _0xd5cf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5cfd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd5cf('0x0'));var util=require('util');var moment=require(_0xd5cf('0x1'));var BPromise=require(_0xd5cf('0x2'));var rs=require(_0xd5cf('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd5cf('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd5cf('0x5'))(_0xd5cf('0x6'));var config=require(_0xd5cf('0x7'));var jayson=require(_0xd5cf('0x8'));var client=jayson[_0xd5cf('0x9')][_0xd5cf('0xa')]({'port':0x232a});config['redis']=_[_0xd5cf('0xb')](config['redis'],{'host':_0xd5cf('0xc'),'port':0x18eb});var socket=require(_0xd5cf('0xd'))(new Redis(config[_0xd5cf('0xe')]));require(_0xd5cf('0xf'))[_0xd5cf('0x10')](socket);function respondWithRpcPromise(_0x5b0f85,_0xc58df1,_0x372c8a){return new BPromise(function(_0x1122d9,_0xf43076){return client[_0xd5cf('0x11')](_0x5b0f85,_0x372c8a)[_0xd5cf('0x12')](function(_0x1d8ae0){logger[_0xd5cf('0x13')]('VoiceQueueReport,\x20%s,\x20%s',_0xc58df1,_0xd5cf('0x14'));logger['debug'](_0xd5cf('0x15'),_0xc58df1,_0xd5cf('0x14'),JSON[_0xd5cf('0x16')](_0x1d8ae0));if(_0x1d8ae0[_0xd5cf('0x17')]){if(_0x1d8ae0['error'][_0xd5cf('0x18')]===0x1f4){logger[_0xd5cf('0x17')](_0xd5cf('0x19'),_0xc58df1,_0x1d8ae0['error'][_0xd5cf('0x1a')]);return _0xf43076(_0x1d8ae0[_0xd5cf('0x17')][_0xd5cf('0x1a')]);}logger[_0xd5cf('0x17')](_0xd5cf('0x19'),_0xc58df1,_0x1d8ae0[_0xd5cf('0x17')][_0xd5cf('0x1a')]);return _0x1122d9(_0x1d8ae0[_0xd5cf('0x17')][_0xd5cf('0x1a')]);}else{logger[_0xd5cf('0x13')](_0xd5cf('0x19'),_0xc58df1,'request\x20sent');_0x1122d9(_0x1d8ae0['result'][_0xd5cf('0x1a')]);}})[_0xd5cf('0x1b')](function(_0x387ab){logger[_0xd5cf('0x17')](_0xd5cf('0x19'),_0xc58df1,_0x387ab);_0xf43076(_0x387ab);});});}exports[_0xd5cf('0x1c')]=function(_0x3615af){var _0x6e2485=this;return new Promise(function(_0x3dc8a8,_0x2492ed){return db[_0xd5cf('0x1d')][_0xd5cf('0x1e')]({'raw':_0x3615af[_0xd5cf('0x1f')]?_0x3615af['options'][_0xd5cf('0x20')]===undefined?!![]:![]:!![],'where':_0x3615af['options']?_0x3615af[_0xd5cf('0x1f')][_0xd5cf('0x21')]||null:null,'attributes':_0x3615af[_0xd5cf('0x1f')]?_0x3615af[_0xd5cf('0x1f')][_0xd5cf('0x22')]||null:null,'limit':_0x3615af[_0xd5cf('0x1f')]?_0x3615af[_0xd5cf('0x1f')][_0xd5cf('0x23')]||null:null,'include':_0x3615af[_0xd5cf('0x1f')]?_0x3615af['options']['include']?_['map'](_0x3615af[_0xd5cf('0x1f')][_0xd5cf('0x24')],function(_0x36fb2c){return{'model':db[_0x36fb2c['model']],'as':_0x36fb2c['as'],'attributes':_0x36fb2c[_0xd5cf('0x22')],'include':_0x36fb2c[_0xd5cf('0x24')]?_[_0xd5cf('0x25')](_0x36fb2c[_0xd5cf('0x24')],function(_0x3788d4){return{'model':db[_0x3788d4[_0xd5cf('0x26')]],'as':_0x3788d4['as'],'attributes':_0x3788d4[_0xd5cf('0x22')],'include':_0x3788d4[_0xd5cf('0x24')]?_['map'](_0x3788d4['include'],function(_0x4a4c62){return{'model':db[_0x4a4c62[_0xd5cf('0x26')]],'as':_0x4a4c62['as'],'attributes':_0x4a4c62[_0xd5cf('0x22')]};}):[]};}):[]};}):[]:[]})[_0xd5cf('0x12')](function(_0x32b891){logger['info'](_0xd5cf('0x1c'),_0x3615af);logger[_0xd5cf('0x27')](_0xd5cf('0x1c'),_0x3615af,JSON[_0xd5cf('0x16')](_0x32b891));_0x3dc8a8(_0x32b891);})[_0xd5cf('0x1b')](function(_0x54a1fa){logger[_0xd5cf('0x17')](_0xd5cf('0x1c'),_0x54a1fa[_0xd5cf('0x1a')],_0x3615af);_0x2492ed(_0x6e2485['error'](0x1f4,_0x54a1fa[_0xd5cf('0x1a')]));});});};exports[_0xd5cf('0x28')]=function(_0x2ea5fb){var _0x3fb4f6=this;return new Promise(function(_0x51a4f8,_0x21585c){return db['VoiceQueueReport'][_0xd5cf('0x29')](_0x2ea5fb['body'],{'raw':_0x2ea5fb['options']?_0x2ea5fb[_0xd5cf('0x1f')][_0xd5cf('0x20')]===undefined?!![]:![]:!![]})[_0xd5cf('0x12')](function(_0x194623){logger[_0xd5cf('0x13')]('CreateVoiceQueueReport',_0x2ea5fb);logger[_0xd5cf('0x27')](_0xd5cf('0x28'),_0x2ea5fb,JSON['stringify'](_0x194623));_0x51a4f8(_0x194623);})[_0xd5cf('0x1b')](function(_0x193aff){logger[_0xd5cf('0x17')]('CreateVoiceQueueReport',_0x193aff[_0xd5cf('0x1a')],_0x2ea5fb);_0x21585c(_0x3fb4f6[_0xd5cf('0x17')](0x1f4,_0x193aff[_0xd5cf('0x1a')]));});});};exports[_0xd5cf('0x2a')]=function(_0x122c24){var _0x13002b=this;return new Promise(function(_0x2d9eac,_0x17e6de){return db[_0xd5cf('0x1d')][_0xd5cf('0x2b')](_0x122c24[_0xd5cf('0x2c')],{'raw':_0x122c24['options']?_0x122c24[_0xd5cf('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x122c24[_0xd5cf('0x1f')]?_0x122c24[_0xd5cf('0x1f')][_0xd5cf('0x21')]||null:null,'attributes':_0x122c24[_0xd5cf('0x1f')]?_0x122c24[_0xd5cf('0x1f')][_0xd5cf('0x22')]||null:null,'limit':_0x122c24['options']?_0x122c24['options'][_0xd5cf('0x23')]||null:null})[_0xd5cf('0x12')](function(_0x3a1142){logger[_0xd5cf('0x13')](_0xd5cf('0x2a'),_0x122c24);logger['debug'](_0xd5cf('0x2a'),_0x122c24,JSON[_0xd5cf('0x16')](_0x3a1142));_0x2d9eac(_0x3a1142);})['catch'](function(_0xa1df94){logger[_0xd5cf('0x17')]('UpdateVoiceQueueReport',_0xa1df94[_0xd5cf('0x1a')],_0x122c24);_0x17e6de(_0x13002b[_0xd5cf('0x17')](0x1f4,_0xa1df94['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index baacd63..75c90f7 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 _0x4a99=['removeListener','length','./voiceQueueReport.events','update'];(function(_0x5cd48d,_0x1b013a){var _0x381343=function(_0x100240){while(--_0x100240){_0x5cd48d['push'](_0x5cd48d['shift']());}};_0x381343(++_0x1b013a);}(_0x4a99,0x1aa));var _0x94a9=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x4a99[_0x31e29a];return _0x32d892;};'use strict';var VoiceQueueReportEvents=require(_0x94a9('0x0'));var events=['save','remove',_0x94a9('0x1')];function createListener(_0x8dad1b,_0x59933b){return function(_0x218edf){_0x59933b['emit'](_0x8dad1b,_0x218edf);};}function removeListener(_0x229b97,_0x46dcc3){return function(){VoiceQueueReportEvents[_0x94a9('0x2')](_0x229b97,_0x46dcc3);};}exports['register']=function(_0x3cad6a){for(var _0x1b86d8=0x0,_0x5ebacb=events[_0x94a9('0x3')];_0x1b86d8<_0x5ebacb;_0x1b86d8++){var _0x36b9f1=events[_0x1b86d8];var _0x5a2175=createListener('voiceQueueReport:'+_0x36b9f1,_0x3cad6a);VoiceQueueReportEvents['on'](_0x36b9f1,_0x5a2175);}}; \ No newline at end of file +var _0x47c7=['./voiceQueueReport.events','remove','update','removeListener','register','length','voiceQueueReport:'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0x47c7,0x1ab));var _0x747c=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x47c7[_0x178e48];return _0x440d7e;};'use strict';var VoiceQueueReportEvents=require(_0x747c('0x0'));var events=['save',_0x747c('0x1'),_0x747c('0x2')];function createListener(_0x4a6fc3,_0xbe1d88){return function(_0x2af847){_0xbe1d88['emit'](_0x4a6fc3,_0x2af847);};}function removeListener(_0x3313cd,_0x3c0c0){return function(){VoiceQueueReportEvents[_0x747c('0x3')](_0x3313cd,_0x3c0c0);};}exports[_0x747c('0x4')]=function(_0x5e991e){for(var _0xa1148a=0x0,_0x4eb6bc=events[_0x747c('0x5')];_0xa1148a<_0x4eb6bc;_0xa1148a++){var _0x24206f=events[_0xa1148a];var _0x10b9f0=createListener(_0x747c('0x6')+_0x24206f,_0x5e991e);VoiceQueueReportEvents['on'](_0x24206f,_0x10b9f0);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 0d77b81..47e30c8 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 _0x5d41=['./voiceQueuesLog.controller','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment'];(function(_0x561dcf,_0xef25e9){var _0x1d1754=function(_0x466f4d){while(--_0x466f4d){_0x561dcf['push'](_0x561dcf['shift']());}};_0x1d1754(++_0xef25e9);}(_0x5d41,0x77));var _0x15d4=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x5d41[_0x3ab9ee];return _0x82ee88;};'use strict';var multer=require(_0x15d4('0x0'));var util=require(_0x15d4('0x1'));var path=require(_0x15d4('0x2'));var timeout=require(_0x15d4('0x3'));var express=require('express');var router=express[_0x15d4('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x15d4('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x15d4('0x6'));var controller=require(_0x15d4('0x7'));router['get']('/',auth[_0x15d4('0x8')](),controller[_0x15d4('0x9')]);router['get'](_0x15d4('0xa'),auth[_0x15d4('0x8')](),controller[_0x15d4('0xb')]);router[_0x15d4('0xc')]('/',auth[_0x15d4('0x8')](),controller[_0x15d4('0xd')]);router[_0x15d4('0xe')](_0x15d4('0xa'),auth[_0x15d4('0x8')](),controller[_0x15d4('0xf')]);router['delete']('/:id',auth[_0x15d4('0x8')](),controller[_0x15d4('0x10')]);module[_0x15d4('0x11')]=router; \ No newline at end of file +var _0xccdd=['../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','index','show','post','put','/:id','update','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x5d9fc4,_0x29631c){var _0x42adb6=function(_0x1d2609){while(--_0x1d2609){_0x5d9fc4['push'](_0x5d9fc4['shift']());}};_0x42adb6(++_0x29631c);}(_0xccdd,0x71));var _0xdccd=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0xccdd[_0x3b0731];return _0x4204d7;};'use strict';var multer=require(_0xdccd('0x0'));var util=require('util');var path=require(_0xdccd('0x1'));var timeout=require(_0xdccd('0x2'));var express=require(_0xdccd('0x3'));var router=express[_0xdccd('0x4')]();var fs_extra=require(_0xdccd('0x5'));var auth=require(_0xdccd('0x6'));var interaction=require(_0xdccd('0x7'));var config=require(_0xdccd('0x8'));var controller=require(_0xdccd('0x9'));router[_0xdccd('0xa')]('/',auth[_0xdccd('0xb')](),controller[_0xdccd('0xc')]);router['get']('/:id',auth[_0xdccd('0xb')](),controller[_0xdccd('0xd')]);router[_0xdccd('0xe')]('/',auth[_0xdccd('0xb')](),controller['create']);router[_0xdccd('0xf')](_0xdccd('0x10'),auth[_0xdccd('0xb')](),controller[_0xdccd('0x11')]);router['delete'](_0xdccd('0x10'),auth['isAuthenticated'](),controller[_0xdccd('0x12')]);module[_0xdccd('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 707e527..97694b2 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 _0x49ab=['literal','sequelize','moment','STRING','DATE'];(function(_0x4a8bdd,_0xf0c749){var _0x5e25b2=function(_0x18d8ac){while(--_0x18d8ac){_0x4a8bdd['push'](_0x4a8bdd['shift']());}};_0x5e25b2(++_0xf0c749);}(_0x49ab,0x1be));var _0xb49a=function(_0x1c6c49,_0xb7ffa){_0x1c6c49=_0x1c6c49-0x0;var _0x5d726d=_0x49ab[_0x1c6c49];return _0x5d726d;};'use strict';var Sequelize=require(_0xb49a('0x0'));var moment=require(_0xb49a('0x1'));module['exports']={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize[_0xb49a('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xb49a('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xb49a('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xb49a('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xb49a('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xb49a('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xb49a('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xb49a('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xb49a('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xb49a('0x4')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file +var _0x3cb4=['literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','moment','exports','STRING','DATE'];(function(_0x346a7b,_0x58d886){var _0x49594c=function(_0x3212e9){while(--_0x3212e9){_0x346a7b['push'](_0x346a7b['shift']());}};_0x49594c(++_0x58d886);}(_0x3cb4,0x1ec));var _0x43cb=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x3cb4[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require(_0x43cb('0x0'));var moment=require(_0x43cb('0x1'));module[_0x43cb('0x2')]={'time':{'type':Sequelize[_0x43cb('0x3')]},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x43cb('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x43cb('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x43cb('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x43cb('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x43cb('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x43cb('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x43cb('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x43cb('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x43cb('0x4')],'allowNull':![],'defaultValue':Sequelize[_0x43cb('0x5')](_0x43cb('0x6'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index b3b51fd..a0fdfcb 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 _0x2a60=['filter','merge','VIRTUAL','options','includeAll','include','rows','catch','params','VoiceQueuesLog','rawAttributes','find','create','body','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','then','destroy','error','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort'];(function(_0x3e31a6,_0x4e6d7f){var _0x2ee1df=function(_0x2eb9e8){while(--_0x2eb9e8){_0x3e31a6['push'](_0x3e31a6['shift']());}};_0x2ee1df(++_0x4e6d7f);}(_0x2a60,0x1b2));var _0x02a6=function(_0x5dac3b,_0x1e0f66){_0x5dac3b=_0x5dac3b-0x0;var _0x35ae8b=_0x2a60[_0x5dac3b];return _0x35ae8b;};'use strict';var emlformat=require(_0x02a6('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x02a6('0x1'));var rp=require(_0x02a6('0x2'));var moment=require('moment');var BPromise=require(_0x02a6('0x3'));var Mustache=require(_0x02a6('0x4'));var util=require(_0x02a6('0x5'));var path=require(_0x02a6('0x6'));var sox=require(_0x02a6('0x7'));var csv=require(_0x02a6('0x8'));var ejs=require(_0x02a6('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x02a6('0xa'));var crypto=require(_0x02a6('0xb'));var jsforce=require(_0x02a6('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x02a6('0xd'));var Papa=require(_0x02a6('0xe'));var Redis=require(_0x02a6('0xf'));var authService=require(_0x02a6('0x10'));var qs=require(_0x02a6('0x11'));var as=require(_0x02a6('0x12'));var hardwareService=require(_0x02a6('0x13'));var logger=require('../../config/logger')(_0x02a6('0x14'));var utils=require(_0x02a6('0x15'));var config=require(_0x02a6('0x16'));var licenseUtil=require(_0x02a6('0x17'));var db=require(_0x02a6('0x18'))['db'];function respondWithStatusCode(_0x503b87,_0x4f89b2){_0x4f89b2=_0x4f89b2||0xcc;return function(_0x212225){if(_0x212225){return _0x503b87[_0x02a6('0x19')](_0x4f89b2);}return _0x503b87[_0x02a6('0x1a')](_0x4f89b2)[_0x02a6('0x1b')]();};}function respondWithResult(_0x23ea31,_0x5ad5a5){_0x5ad5a5=_0x5ad5a5||0xc8;return function(_0x17d5fa){if(_0x17d5fa){return _0x23ea31[_0x02a6('0x1a')](_0x5ad5a5)[_0x02a6('0x1c')](_0x17d5fa);}};}function respondWithFilteredResult(_0x34b869,_0x4c155a){return function(_0x123b30){if(_0x123b30){var _0x5a0c10=typeof _0x4c155a[_0x02a6('0x1d')]===_0x02a6('0x1e')&&typeof _0x4c155a['limit']==='undefined';var _0x1f2748=_0x123b30['count'];var _0x5bf919=_0x5a0c10?0x0:_0x4c155a[_0x02a6('0x1d')];var _0x29a2ee=_0x5a0c10?_0x123b30[_0x02a6('0x1f')]:_0x4c155a[_0x02a6('0x1d')]+_0x4c155a[_0x02a6('0x20')];var _0xdd3123;if(_0x29a2ee>=_0x1f2748){_0x29a2ee=_0x1f2748;_0xdd3123=0xc8;}else{_0xdd3123=0xce;}_0x34b869[_0x02a6('0x1a')](_0xdd3123);return _0x34b869['set'](_0x02a6('0x21'),_0x5bf919+'-'+_0x29a2ee+'/'+_0x1f2748)[_0x02a6('0x1c')](_0x123b30);}return null;};}function patchUpdates(_0x371824){return function(_0x28f0e0){try{jsonpatch[_0x02a6('0x22')](_0x28f0e0,_0x371824,!![]);}catch(_0x4d9c75){return BPromise['reject'](_0x4d9c75);}return _0x28f0e0['save']();};}function saveUpdates(_0x285152,_0x5bfdcb){return function(_0x230a05){if(_0x230a05){return _0x230a05['update'](_0x285152)[_0x02a6('0x23')](function(_0xa6f1e3){return _0xa6f1e3;});}return null;};}function removeEntity(_0xd3a214,_0x2c3dd0){return function(_0x345b08){if(_0x345b08){return _0x345b08[_0x02a6('0x24')]()['then'](function(){_0xd3a214['status'](0xcc)[_0x02a6('0x1b')]();});}};}function handleEntityNotFound(_0x84df0e,_0x56b262){return function(_0x3098a6){if(!_0x3098a6){_0x84df0e[_0x02a6('0x19')](0x194);}return _0x3098a6;};}function handleError(_0xd00076,_0x481faa){_0x481faa=_0x481faa||0x1f4;return function(_0x105541){logger[_0x02a6('0x25')](_0x105541['stack']);if(_0x105541[_0x02a6('0x26')]){delete _0x105541[_0x02a6('0x26')];}_0xd00076[_0x02a6('0x1a')](_0x481faa)[_0x02a6('0x27')](_0x105541);};}exports[_0x02a6('0x28')]=function(_0x4b7bf7,_0x259bd3){var _0x2c7bc8={},_0x433517={},_0x4654d9={'count':0x0,'rows':[]};var _0x35fcff=_[_0x02a6('0x29')](db['VoiceQueuesLog']['rawAttributes'],function(_0x1a72c0){return{'name':_0x1a72c0[_0x02a6('0x2a')],'type':_0x1a72c0[_0x02a6('0x2b')][_0x02a6('0x2c')]};});_0x433517[_0x02a6('0x2d')]=_[_0x02a6('0x29')](_0x35fcff,_0x02a6('0x26'));_0x433517[_0x02a6('0x2e')]=_[_0x02a6('0x2f')](_0x4b7bf7[_0x02a6('0x2e')]);_0x433517[_0x02a6('0x30')]=_[_0x02a6('0x31')](_0x433517['model'],_0x433517[_0x02a6('0x2e')]);_0x2c7bc8['attributes']=_[_0x02a6('0x31')](_0x433517['model'],qs[_0x02a6('0x32')](_0x4b7bf7[_0x02a6('0x2e')][_0x02a6('0x32')]));_0x2c7bc8[_0x02a6('0x33')]=_0x2c7bc8[_0x02a6('0x33')][_0x02a6('0x34')]?_0x2c7bc8[_0x02a6('0x33')]:_0x433517[_0x02a6('0x2d')];if(!_0x4b7bf7[_0x02a6('0x2e')]['hasOwnProperty'](_0x02a6('0x35'))){_0x2c7bc8[_0x02a6('0x20')]=qs[_0x02a6('0x20')](_0x4b7bf7[_0x02a6('0x2e')]['limit']);_0x2c7bc8[_0x02a6('0x1d')]=qs[_0x02a6('0x1d')](_0x4b7bf7[_0x02a6('0x2e')][_0x02a6('0x1d')]);}_0x2c7bc8[_0x02a6('0x36')]=qs[_0x02a6('0x37')](_0x4b7bf7['query'][_0x02a6('0x37')]);_0x2c7bc8['where']=qs[_0x02a6('0x30')](_['pick'](_0x4b7bf7['query'],_0x433517[_0x02a6('0x30')]),_0x35fcff);if(_0x4b7bf7[_0x02a6('0x2e')][_0x02a6('0x38')]){_0x2c7bc8['where']=_[_0x02a6('0x39')](_0x2c7bc8['where'],{'$or':_[_0x02a6('0x29')](_0x35fcff,function(_0x36a339){if(_0x36a339[_0x02a6('0x2b')]!==_0x02a6('0x3a')){var _0x46ce2c={};_0x46ce2c[_0x36a339[_0x02a6('0x26')]]={'$like':'%'+_0x4b7bf7[_0x02a6('0x2e')][_0x02a6('0x38')]+'%'};return _0x46ce2c;}})});}_0x2c7bc8=_[_0x02a6('0x39')]({},_0x2c7bc8,_0x4b7bf7[_0x02a6('0x3b')]);var _0x4a6269={'where':_0x2c7bc8['where']};return db['VoiceQueuesLog']['count'](_0x4a6269)[_0x02a6('0x23')](function(_0xb07ee9){_0x4654d9['count']=_0xb07ee9;if(_0x4b7bf7[_0x02a6('0x2e')][_0x02a6('0x3c')]){_0x2c7bc8[_0x02a6('0x3d')]=[{'all':!![]}];}return db['VoiceQueuesLog']['findAll'](_0x2c7bc8);})['then'](function(_0x579faf){_0x4654d9[_0x02a6('0x3e')]=_0x579faf;return _0x4654d9;})[_0x02a6('0x23')](respondWithFilteredResult(_0x259bd3,_0x2c7bc8))[_0x02a6('0x3f')](handleError(_0x259bd3,null));};exports['show']=function(_0x4bfe96,_0x23307e){var _0x27d12e={'raw':!![],'where':{'id':_0x4bfe96[_0x02a6('0x40')]['id']}},_0x10f6f1={};_0x10f6f1[_0x02a6('0x2d')]=_[_0x02a6('0x2f')](db[_0x02a6('0x41')][_0x02a6('0x42')]);_0x10f6f1[_0x02a6('0x2e')]=_[_0x02a6('0x2f')](_0x4bfe96[_0x02a6('0x2e')]);_0x10f6f1[_0x02a6('0x30')]=_['intersection'](_0x10f6f1[_0x02a6('0x2d')],_0x10f6f1[_0x02a6('0x2e')]);_0x27d12e[_0x02a6('0x33')]=_[_0x02a6('0x31')](_0x10f6f1[_0x02a6('0x2d')],qs['fields'](_0x4bfe96[_0x02a6('0x2e')][_0x02a6('0x32')]));_0x27d12e[_0x02a6('0x33')]=_0x27d12e[_0x02a6('0x33')]['length']?_0x27d12e[_0x02a6('0x33')]:_0x10f6f1[_0x02a6('0x2d')];if(_0x4bfe96[_0x02a6('0x2e')][_0x02a6('0x3c')]){_0x27d12e[_0x02a6('0x3d')]=[{'all':!![]}];}_0x27d12e=_['merge']({},_0x27d12e,_0x4bfe96['options']);return db[_0x02a6('0x41')][_0x02a6('0x43')](_0x27d12e)['then'](handleEntityNotFound(_0x23307e,null))[_0x02a6('0x23')](respondWithResult(_0x23307e,null))[_0x02a6('0x3f')](handleError(_0x23307e,null));};exports[_0x02a6('0x44')]=function(_0x3b481b,_0x5ce395){return db[_0x02a6('0x41')][_0x02a6('0x44')](_0x3b481b[_0x02a6('0x45')],{})[_0x02a6('0x23')](respondWithResult(_0x5ce395,0xc9))[_0x02a6('0x3f')](handleError(_0x5ce395,null));};exports['update']=function(_0x51ac93,_0x4a0a6c){if(_0x51ac93['body']['id']){delete _0x51ac93[_0x02a6('0x45')]['id'];}return db[_0x02a6('0x41')]['find']({'where':{'id':_0x51ac93['params']['id']}})[_0x02a6('0x23')](handleEntityNotFound(_0x4a0a6c,null))[_0x02a6('0x23')](saveUpdates(_0x51ac93[_0x02a6('0x45')],null))[_0x02a6('0x23')](respondWithResult(_0x4a0a6c,null))[_0x02a6('0x3f')](handleError(_0x4a0a6c,null));};exports['destroy']=function(_0x3d1be0,_0x22b413){return db['VoiceQueuesLog'][_0x02a6('0x43')]({'where':{'id':_0x3d1be0['params']['id']}})['then'](handleEntityNotFound(_0x22b413,null))[_0x02a6('0x23')](removeEntity(_0x22b413,null))[_0x02a6('0x3f')](handleError(_0x22b413,null));}; \ No newline at end of file +var _0xc9e0=['count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','VoiceQueuesLog','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xc9e0,0x1a5));var _0x0c9e=function(_0x7836f3,_0x17928f){_0x7836f3=_0x7836f3-0x0;var _0x20df56=_0xc9e0[_0x7836f3];return _0x20df56;};'use strict';var emlformat=require(_0x0c9e('0x0'));var rimraf=require(_0x0c9e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0c9e('0x2'));var rp=require(_0x0c9e('0x3'));var moment=require(_0x0c9e('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0c9e('0x5'));var path=require(_0x0c9e('0x6'));var sox=require(_0x0c9e('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0c9e('0x8'));var _=require(_0x0c9e('0x9'));var squel=require(_0x0c9e('0xa'));var crypto=require(_0x0c9e('0xb'));var jsforce=require(_0x0c9e('0xc'));var deskjs=require(_0x0c9e('0xd'));var toCsv=require('to-csv');var querystring=require(_0x0c9e('0xe'));var Papa=require('papaparse');var Redis=require(_0x0c9e('0xf'));var authService=require(_0x0c9e('0x10'));var qs=require(_0x0c9e('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0c9e('0x12'));var logger=require(_0x0c9e('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x0c9e('0x14'));var licenseUtil=require(_0x0c9e('0x15'));var db=require(_0x0c9e('0x16'))['db'];function respondWithStatusCode(_0x446125,_0x2783c8){_0x2783c8=_0x2783c8||0xcc;return function(_0x23c525){if(_0x23c525){return _0x446125[_0x0c9e('0x17')](_0x2783c8);}return _0x446125[_0x0c9e('0x18')](_0x2783c8)[_0x0c9e('0x19')]();};}function respondWithResult(_0xa19ae0,_0x1725e7){_0x1725e7=_0x1725e7||0xc8;return function(_0x2c9482){if(_0x2c9482){return _0xa19ae0[_0x0c9e('0x18')](_0x1725e7)[_0x0c9e('0x1a')](_0x2c9482);}};}function respondWithFilteredResult(_0x281a46,_0x34057e){return function(_0x2e4bc2){if(_0x2e4bc2){var _0x1c6661=typeof _0x34057e[_0x0c9e('0x1b')]===_0x0c9e('0x1c')&&typeof _0x34057e['limit']===_0x0c9e('0x1c');var _0x107c94=_0x2e4bc2['count'];var _0x388ae0=_0x1c6661?0x0:_0x34057e[_0x0c9e('0x1b')];var _0x378a4d=_0x1c6661?_0x2e4bc2[_0x0c9e('0x1d')]:_0x34057e[_0x0c9e('0x1b')]+_0x34057e[_0x0c9e('0x1e')];var _0x46f755;if(_0x378a4d>=_0x107c94){_0x378a4d=_0x107c94;_0x46f755=0xc8;}else{_0x46f755=0xce;}_0x281a46[_0x0c9e('0x18')](_0x46f755);return _0x281a46[_0x0c9e('0x1f')](_0x0c9e('0x20'),_0x388ae0+'-'+_0x378a4d+'/'+_0x107c94)[_0x0c9e('0x1a')](_0x2e4bc2);}return null;};}function patchUpdates(_0x31b9b5){return function(_0x2b4307){try{jsonpatch[_0x0c9e('0x21')](_0x2b4307,_0x31b9b5,!![]);}catch(_0x5b2b48){return BPromise[_0x0c9e('0x22')](_0x5b2b48);}return _0x2b4307[_0x0c9e('0x23')]();};}function saveUpdates(_0x3e8f99,_0x5554a4){return function(_0x590599){if(_0x590599){return _0x590599[_0x0c9e('0x24')](_0x3e8f99)[_0x0c9e('0x25')](function(_0x29b767){return _0x29b767;});}return null;};}function removeEntity(_0x3b4acf,_0x2564ac){return function(_0x5b4a0f){if(_0x5b4a0f){return _0x5b4a0f[_0x0c9e('0x26')]()[_0x0c9e('0x25')](function(){_0x3b4acf[_0x0c9e('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x48728b,_0x55abc5){return function(_0x13a261){if(!_0x13a261){_0x48728b[_0x0c9e('0x17')](0x194);}return _0x13a261;};}function handleError(_0x20a3a1,_0x2761d7){_0x2761d7=_0x2761d7||0x1f4;return function(_0x350a44){logger[_0x0c9e('0x27')](_0x350a44[_0x0c9e('0x28')]);if(_0x350a44['name']){delete _0x350a44[_0x0c9e('0x29')];}_0x20a3a1[_0x0c9e('0x18')](_0x2761d7)[_0x0c9e('0x2a')](_0x350a44);};}exports['index']=function(_0x1c44a0,_0x260feb){var _0x2aa7b2={},_0x1353e1={},_0x561d13={'count':0x0,'rows':[]};var _0x1634bb=_[_0x0c9e('0x2b')](db[_0x0c9e('0x2c')][_0x0c9e('0x2d')],function(_0x489eac){return{'name':_0x489eac[_0x0c9e('0x2e')],'type':_0x489eac['type'][_0x0c9e('0x2f')]};});_0x1353e1[_0x0c9e('0x30')]=_[_0x0c9e('0x2b')](_0x1634bb,_0x0c9e('0x29'));_0x1353e1[_0x0c9e('0x31')]=_[_0x0c9e('0x32')](_0x1c44a0['query']);_0x1353e1[_0x0c9e('0x33')]=_['intersection'](_0x1353e1['model'],_0x1353e1[_0x0c9e('0x31')]);_0x2aa7b2[_0x0c9e('0x34')]=_[_0x0c9e('0x35')](_0x1353e1[_0x0c9e('0x30')],qs[_0x0c9e('0x36')](_0x1c44a0[_0x0c9e('0x31')][_0x0c9e('0x36')]));_0x2aa7b2[_0x0c9e('0x34')]=_0x2aa7b2[_0x0c9e('0x34')][_0x0c9e('0x37')]?_0x2aa7b2['attributes']:_0x1353e1[_0x0c9e('0x30')];if(!_0x1c44a0[_0x0c9e('0x31')]['hasOwnProperty'](_0x0c9e('0x38'))){_0x2aa7b2['limit']=qs[_0x0c9e('0x1e')](_0x1c44a0[_0x0c9e('0x31')][_0x0c9e('0x1e')]);_0x2aa7b2[_0x0c9e('0x1b')]=qs[_0x0c9e('0x1b')](_0x1c44a0[_0x0c9e('0x31')][_0x0c9e('0x1b')]);}_0x2aa7b2[_0x0c9e('0x39')]=qs[_0x0c9e('0x3a')](_0x1c44a0[_0x0c9e('0x31')][_0x0c9e('0x3a')]);_0x2aa7b2[_0x0c9e('0x3b')]=qs['filters'](_[_0x0c9e('0x3c')](_0x1c44a0['query'],_0x1353e1[_0x0c9e('0x33')]),_0x1634bb);if(_0x1c44a0[_0x0c9e('0x31')][_0x0c9e('0x3d')]){_0x2aa7b2[_0x0c9e('0x3b')]=_[_0x0c9e('0x3e')](_0x2aa7b2[_0x0c9e('0x3b')],{'$or':_[_0x0c9e('0x2b')](_0x1634bb,function(_0x240453){if(_0x240453[_0x0c9e('0x3f')]!=='VIRTUAL'){var _0x28012a={};_0x28012a[_0x240453['name']]={'$like':'%'+_0x1c44a0[_0x0c9e('0x31')]['filter']+'%'};return _0x28012a;}})});}_0x2aa7b2=_[_0x0c9e('0x3e')]({},_0x2aa7b2,_0x1c44a0[_0x0c9e('0x40')]);var _0x226ea6={'where':_0x2aa7b2['where']};return db[_0x0c9e('0x2c')][_0x0c9e('0x1d')](_0x226ea6)[_0x0c9e('0x25')](function(_0x32818b){_0x561d13[_0x0c9e('0x1d')]=_0x32818b;if(_0x1c44a0[_0x0c9e('0x31')][_0x0c9e('0x41')]){_0x2aa7b2[_0x0c9e('0x42')]=[{'all':!![]}];}return db[_0x0c9e('0x2c')][_0x0c9e('0x43')](_0x2aa7b2);})[_0x0c9e('0x25')](function(_0x27d3ae){_0x561d13[_0x0c9e('0x44')]=_0x27d3ae;return _0x561d13;})['then'](respondWithFilteredResult(_0x260feb,_0x2aa7b2))[_0x0c9e('0x45')](handleError(_0x260feb,null));};exports[_0x0c9e('0x46')]=function(_0x442599,_0x1506f2){var _0x15adfd={'raw':!![],'where':{'id':_0x442599[_0x0c9e('0x47')]['id']}},_0x5a693e={};_0x5a693e[_0x0c9e('0x30')]=_[_0x0c9e('0x32')](db[_0x0c9e('0x2c')]['rawAttributes']);_0x5a693e[_0x0c9e('0x31')]=_['keys'](_0x442599[_0x0c9e('0x31')]);_0x5a693e['filters']=_['intersection'](_0x5a693e[_0x0c9e('0x30')],_0x5a693e[_0x0c9e('0x31')]);_0x15adfd[_0x0c9e('0x34')]=_[_0x0c9e('0x35')](_0x5a693e['model'],qs[_0x0c9e('0x36')](_0x442599[_0x0c9e('0x31')][_0x0c9e('0x36')]));_0x15adfd[_0x0c9e('0x34')]=_0x15adfd['attributes'][_0x0c9e('0x37')]?_0x15adfd[_0x0c9e('0x34')]:_0x5a693e['model'];if(_0x442599[_0x0c9e('0x31')]['includeAll']){_0x15adfd[_0x0c9e('0x42')]=[{'all':!![]}];}_0x15adfd=_[_0x0c9e('0x3e')]({},_0x15adfd,_0x442599[_0x0c9e('0x40')]);return db[_0x0c9e('0x2c')][_0x0c9e('0x48')](_0x15adfd)[_0x0c9e('0x25')](handleEntityNotFound(_0x1506f2,null))['then'](respondWithResult(_0x1506f2,null))[_0x0c9e('0x45')](handleError(_0x1506f2,null));};exports[_0x0c9e('0x49')]=function(_0x481820,_0x9b2737){return db[_0x0c9e('0x2c')][_0x0c9e('0x49')](_0x481820['body'],{})[_0x0c9e('0x25')](respondWithResult(_0x9b2737,0xc9))[_0x0c9e('0x45')](handleError(_0x9b2737,null));};exports[_0x0c9e('0x24')]=function(_0x8283c2,_0x564b6b){if(_0x8283c2[_0x0c9e('0x4a')]['id']){delete _0x8283c2[_0x0c9e('0x4a')]['id'];}return db[_0x0c9e('0x2c')][_0x0c9e('0x48')]({'where':{'id':_0x8283c2[_0x0c9e('0x47')]['id']}})['then'](handleEntityNotFound(_0x564b6b,null))[_0x0c9e('0x25')](saveUpdates(_0x8283c2[_0x0c9e('0x4a')],null))[_0x0c9e('0x25')](respondWithResult(_0x564b6b,null))[_0x0c9e('0x45')](handleError(_0x564b6b,null));};exports[_0x0c9e('0x26')]=function(_0x556646,_0x2a4809){return db[_0x0c9e('0x2c')][_0x0c9e('0x48')]({'where':{'id':_0x556646[_0x0c9e('0x47')]['id']}})[_0x0c9e('0x25')](handleEntityNotFound(_0x2a4809,null))[_0x0c9e('0x25')](removeEntity(_0x2a4809,null))[_0x0c9e('0x45')](handleError(_0x2a4809,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index d54d3ed..184d8c4 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 _0x3cec=['define','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports'];(function(_0x1c0fa0,_0x43e1e7){var _0x47525f=function(_0x2a2f5a){while(--_0x2a2f5a){_0x1c0fa0['push'](_0x1c0fa0['shift']());}};_0x47525f(++_0x43e1e7);}(_0x3cec,0xb0));var _0xc3ce=function(_0x4d6e0c,_0x34b2fa){_0x4d6e0c=_0x4d6e0c-0x0;var _0x1cdaa1=_0x3cec[_0x4d6e0c];return _0x1cdaa1;};'use strict';var _=require(_0xc3ce('0x0'));var util=require(_0xc3ce('0x1'));var logger=require(_0xc3ce('0x2'))(_0xc3ce('0x3'));var moment=require(_0xc3ce('0x4'));var BPromise=require(_0xc3ce('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc3ce('0x6'));var rimraf=require(_0xc3ce('0x7'));var config=require(_0xc3ce('0x8'));var attributes=require(_0xc3ce('0x9'));module[_0xc3ce('0xa')]=function(_0x1daa55,_0x464046){return _0x1daa55[_0xc3ce('0xb')](_0xc3ce('0xc'),attributes,{'tableName':_0xc3ce('0xd'),'paranoid':![],'indexes':[{'name':_0xc3ce('0xe'),'fields':[_0xc3ce('0xf'),_0xc3ce('0x10')]}],'timestamps':![]});}; \ No newline at end of file +var _0x247a=['voice_queues_log','event_dtm','event','dtm','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','exports','define','VoiceQueuesLog'];(function(_0x3d8304,_0x3a115c){var _0x1ca763=function(_0x1ebff2){while(--_0x1ebff2){_0x3d8304['push'](_0x3d8304['shift']());}};_0x1ca763(++_0x3a115c);}(_0x247a,0x162));var _0xa247=function(_0x1a887f,_0x28423c){_0x1a887f=_0x1a887f-0x0;var _0x1841ff=_0x247a[_0x1a887f];return _0x1841ff;};'use strict';var _=require(_0xa247('0x0'));var util=require('util');var logger=require(_0xa247('0x1'))('api');var moment=require(_0xa247('0x2'));var BPromise=require(_0xa247('0x3'));var rp=require(_0xa247('0x4'));var fs=require('fs');var path=require(_0xa247('0x5'));var rimraf=require(_0xa247('0x6'));var config=require('../../config/environment');var attributes=require('./voiceQueuesLog.attributes');module[_0xa247('0x7')]=function(_0x1f9ede,_0x75adeb){return _0x1f9ede[_0xa247('0x8')](_0xa247('0x9'),attributes,{'tableName':_0xa247('0xa'),'paranoid':![],'indexes':[{'name':_0xa247('0xb'),'fields':[_0xa247('0xc'),_0xa247('0xd')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 428b979..c3eedb0 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 _0xd20e=['../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis'];(function(_0x7275e9,_0x321fa5){var _0x17b99d=function(_0x54af41){while(--_0x54af41){_0x7275e9['push'](_0x7275e9['shift']());}};_0x17b99d(++_0x321fa5);}(_0xd20e,0xbb));var _0xed20=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xd20e[_0x4b055c];return _0x4b62bb;};'use strict';var _=require(_0xed20('0x0'));var util=require(_0xed20('0x1'));var moment=require(_0xed20('0x2'));var BPromise=require(_0xed20('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xed20('0x4'));var db=require(_0xed20('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xed20('0x6'))(_0xed20('0x7'));var config=require('../../config/environment');var jayson=require(_0xed20('0x8'));var client=jayson[_0xed20('0x9')][_0xed20('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4a2795,_0x14caf3,_0x5541da){return new BPromise(function(_0x4c5976,_0x2bcca5){return client[_0xed20('0xb')](_0x4a2795,_0x5541da)[_0xed20('0xc')](function(_0x528d96){logger[_0xed20('0xd')](_0xed20('0xe'),_0x14caf3,_0xed20('0xf'));logger[_0xed20('0x10')](_0xed20('0x11'),_0x14caf3,'request\x20sent',JSON[_0xed20('0x12')](_0x528d96));if(_0x528d96['error']){if(_0x528d96[_0xed20('0x13')][_0xed20('0x14')]===0x1f4){logger[_0xed20('0x13')](_0xed20('0xe'),_0x14caf3,_0x528d96[_0xed20('0x13')][_0xed20('0x15')]);return _0x2bcca5(_0x528d96[_0xed20('0x13')]['message']);}logger[_0xed20('0x13')](_0xed20('0xe'),_0x14caf3,_0x528d96[_0xed20('0x13')][_0xed20('0x15')]);return _0x4c5976(_0x528d96['error']['message']);}else{logger['info'](_0xed20('0xe'),_0x14caf3,_0xed20('0xf'));_0x4c5976(_0x528d96[_0xed20('0x16')][_0xed20('0x15')]);}})[_0xed20('0x17')](function(_0x520990){logger[_0xed20('0x13')](_0xed20('0xe'),_0x14caf3,_0x520990);_0x2bcca5(_0x520990);});});} \ No newline at end of file +var _0xf2a6=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceQueuesLog,\x20%s,\x20%s','result','catch','lodash','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x193e28,_0x3dac1d){var _0x20ef59=function(_0x48047e){while(--_0x48047e){_0x193e28['push'](_0x193e28['shift']());}};_0x20ef59(++_0x3dac1d);}(_0xf2a6,0x13d));var _0x6f2a=function(_0x56f386,_0x37b042){_0x56f386=_0x56f386-0x0;var _0x1c479a=_0xf2a6[_0x56f386];return _0x1c479a;};'use strict';var _=require(_0x6f2a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6f2a('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6f2a('0x2'))['db'];var utils=require(_0x6f2a('0x3'));var logger=require(_0x6f2a('0x4'))(_0x6f2a('0x5'));var config=require(_0x6f2a('0x6'));var jayson=require(_0x6f2a('0x7'));var client=jayson[_0x6f2a('0x8')][_0x6f2a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1efd8,_0x424ebd,_0x4b4fde){return new BPromise(function(_0x379b80,_0xda4179){return client[_0x6f2a('0xa')](_0x1efd8,_0x4b4fde)[_0x6f2a('0xb')](function(_0x5b1229){logger[_0x6f2a('0xc')]('VoiceQueuesLog,\x20%s,\x20%s',_0x424ebd,_0x6f2a('0xd'));logger[_0x6f2a('0xe')](_0x6f2a('0xf'),_0x424ebd,'request\x20sent',JSON[_0x6f2a('0x10')](_0x5b1229));if(_0x5b1229['error']){if(_0x5b1229[_0x6f2a('0x11')][_0x6f2a('0x12')]===0x1f4){logger[_0x6f2a('0x11')]('VoiceQueuesLog,\x20%s,\x20%s',_0x424ebd,_0x5b1229[_0x6f2a('0x11')]['message']);return _0xda4179(_0x5b1229[_0x6f2a('0x11')][_0x6f2a('0x13')]);}logger[_0x6f2a('0x11')](_0x6f2a('0x14'),_0x424ebd,_0x5b1229[_0x6f2a('0x11')]['message']);return _0x379b80(_0x5b1229[_0x6f2a('0x11')][_0x6f2a('0x13')]);}else{logger[_0x6f2a('0xc')](_0x6f2a('0x14'),_0x424ebd,_0x6f2a('0xd'));_0x379b80(_0x5b1229[_0x6f2a('0x15')][_0x6f2a('0x13')]);}})[_0x6f2a('0x16')](function(_0x2cf5de){logger[_0x6f2a('0x11')](_0x6f2a('0x14'),_0x424ebd,_0x2cf5de);_0xda4179(_0x2cf5de);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index c8a66ff..128df2c 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 _0x9f48=['path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','/describe','describe','/:id','show','download','/:id/downloads','downloads','/:id/transcribe','post','create','put','update','delete','destroy','exports','util'];(function(_0x31b5b2,_0x5ab927){var _0x364f13=function(_0x163bd0){while(--_0x163bd0){_0x31b5b2['push'](_0x31b5b2['shift']());}};_0x364f13(++_0x5ab927);}(_0x9f48,0xef));var _0x89f4=function(_0x6b47f9,_0x321549){_0x6b47f9=_0x6b47f9-0x0;var _0x1d7636=_0x9f48[_0x6b47f9];return _0x1d7636;};'use strict';var multer=require('multer');var util=require(_0x89f4('0x0'));var path=require(_0x89f4('0x1'));var timeout=require(_0x89f4('0x2'));var express=require('express');var router=express[_0x89f4('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x89f4('0x4'));var config=require(_0x89f4('0x5'));var controller=require(_0x89f4('0x6'));router[_0x89f4('0x7')]('/',auth[_0x89f4('0x8')](),controller['index']);router[_0x89f4('0x7')](_0x89f4('0x9'),auth[_0x89f4('0x8')](),controller[_0x89f4('0xa')]);router[_0x89f4('0x7')](_0x89f4('0xb'),auth[_0x89f4('0x8')](),controller[_0x89f4('0xc')]);router['get']('/:id/download',auth[_0x89f4('0x8')](),controller[_0x89f4('0xd')]);router[_0x89f4('0x7')](_0x89f4('0xe'),controller[_0x89f4('0xf')]);router[_0x89f4('0x7')](_0x89f4('0x10'),auth[_0x89f4('0x8')](),controller['downloadTranscribe']);router[_0x89f4('0x11')]('/',auth[_0x89f4('0x8')](),controller[_0x89f4('0x12')]);router[_0x89f4('0x11')](_0x89f4('0x10'),auth[_0x89f4('0x8')](),controller['runTranscribe']);router[_0x89f4('0x13')](_0x89f4('0xb'),auth[_0x89f4('0x8')](),controller[_0x89f4('0x14')]);router[_0x89f4('0x15')](_0x89f4('0xb'),auth[_0x89f4('0x8')](),controller[_0x89f4('0x16')]);module[_0x89f4('0x17')]=router; \ No newline at end of file +var _0xaae7=['/:id/download','download','downloads','/:id/transcribe','downloadTranscribe','post','create','runTranscribe','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceRecording.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x4f08dd,_0x3784ec){var _0x3017ee=function(_0x7d95be){while(--_0x7d95be){_0x4f08dd['push'](_0x4f08dd['shift']());}};_0x3017ee(++_0x3784ec);}(_0xaae7,0x128));var _0x7aae=function(_0x56ffa1,_0x38e6dd){_0x56ffa1=_0x56ffa1-0x0;var _0x2687d9=_0xaae7[_0x56ffa1];return _0x2687d9;};'use strict';var multer=require(_0x7aae('0x0'));var util=require(_0x7aae('0x1'));var path=require(_0x7aae('0x2'));var timeout=require(_0x7aae('0x3'));var express=require('express');var router=express[_0x7aae('0x4')]();var fs_extra=require(_0x7aae('0x5'));var auth=require(_0x7aae('0x6'));var interaction=require(_0x7aae('0x7'));var config=require('../../config/environment');var controller=require(_0x7aae('0x8'));router[_0x7aae('0x9')]('/',auth[_0x7aae('0xa')](),controller[_0x7aae('0xb')]);router[_0x7aae('0x9')](_0x7aae('0xc'),auth[_0x7aae('0xa')](),controller[_0x7aae('0xd')]);router[_0x7aae('0x9')](_0x7aae('0xe'),auth['isAuthenticated'](),controller[_0x7aae('0xf')]);router[_0x7aae('0x9')](_0x7aae('0x10'),auth[_0x7aae('0xa')](),controller[_0x7aae('0x11')]);router['get']('/:id/downloads',controller[_0x7aae('0x12')]);router['get'](_0x7aae('0x13'),auth[_0x7aae('0xa')](),controller[_0x7aae('0x14')]);router[_0x7aae('0x15')]('/',auth[_0x7aae('0xa')](),controller[_0x7aae('0x16')]);router[_0x7aae('0x15')](_0x7aae('0x13'),auth[_0x7aae('0xa')](),controller[_0x7aae('0x17')]);router['put'](_0x7aae('0xe'),auth[_0x7aae('0xa')](),controller['update']);router[_0x7aae('0x18')](_0x7aae('0xe'),auth[_0x7aae('0xa')](),controller[_0x7aae('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index ea65473..2d3248e 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(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'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(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'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 a2b9b18..887f8e7 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 _0xdbf3=['/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','limit','undefined','count','offset','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','index','map','VoiceRecording','rawAttributes','fieldName','type','differenceBy','format','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','order','sort','where','filter','merge','options','includeAll','findAll','rows','catch','show','length','include','find','create','body','params','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','decryptFile','recording','ValidationError','filename','unlink','message','VoiceRecording\x20not\x20found','send','Not\x20found','MD5','sequelize','token','push','$and','extname','isNil','Entity\x20not\x20found','info','.cypher','File:\x20\x22','unlinkSync','listBuckets','TranscribeService','startTranscriptionJob','basename','readFileSync','bucket','Bucket','location','Location','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','transcribeName','TranscriptionJobName','transcribeStatus','TranscriptionJobStatus','runTranscribe','secrets','Setting','transcribe','transcribeAccountId','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','Sequelize','Sentiment\x20Analysis\x20not\x20configured','data1','data2','transcribeRegion','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','updateAttributes','downloadTranscribe','findOne','fileText','root'];(function(_0x5bc4e2,_0x427ff9){var _0x4c93f9=function(_0x1e8546){while(--_0x1e8546){_0x5bc4e2['push'](_0x5bc4e2['shift']());}};_0x4c93f9(++_0x427ff9);}(_0xdbf3,0x1c5));var _0x3dbf=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0xdbf3[_0xaa0309];return _0x5de7ce;};'use strict';var emlformat=require(_0x3dbf('0x0'));var rimraf=require(_0x3dbf('0x1'));var zipdir=require(_0x3dbf('0x2'));var jsonpatch=require(_0x3dbf('0x3'));var rp=require('request-promise');var moment=require(_0x3dbf('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3dbf('0x5'));var util=require(_0x3dbf('0x6'));var path=require(_0x3dbf('0x7'));var sox=require(_0x3dbf('0x8'));var csv=require(_0x3dbf('0x9'));var ejs=require(_0x3dbf('0xa'));var fs=require('fs');var fs_extra=require(_0x3dbf('0xb'));var _=require(_0x3dbf('0xc'));var squel=require(_0x3dbf('0xd'));var crypto=require(_0x3dbf('0xe'));var jsforce=require(_0x3dbf('0xf'));var deskjs=require(_0x3dbf('0x10'));var toCsv=require('to-csv');var querystring=require(_0x3dbf('0x11'));var Papa=require(_0x3dbf('0x12'));var AWS=require('aws-sdk');var uuidv4=require('uuid/v4');var Redis=require('ioredis');var authService=require(_0x3dbf('0x13'));var qs=require(_0x3dbf('0x14'));var as=require(_0x3dbf('0x15'));var hardwareService=require(_0x3dbf('0x16'));var logger=require(_0x3dbf('0x17'))(_0x3dbf('0x18'));var utils=require(_0x3dbf('0x19'));var config=require(_0x3dbf('0x1a'));var licenseUtil=require(_0x3dbf('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4c036b,_0x5d9591){_0x5d9591=_0x5d9591||0xcc;return function(_0x20d168){if(_0x20d168){return _0x4c036b['sendStatus'](_0x5d9591);}return _0x4c036b[_0x3dbf('0x1c')](_0x5d9591)[_0x3dbf('0x1d')]();};}function respondWithResult(_0x20180b,_0x36cd68){_0x36cd68=_0x36cd68||0xc8;return function(_0x393ed8){if(_0x393ed8){return _0x20180b[_0x3dbf('0x1c')](_0x36cd68)[_0x3dbf('0x1e')](_0x393ed8);}};}function respondWithFilteredResult(_0x1ab20a,_0x23d4cd){return function(_0x4236dc){if(_0x4236dc){var _0x198b45=typeof _0x23d4cd['offset']==='undefined'&&typeof _0x23d4cd[_0x3dbf('0x1f')]===_0x3dbf('0x20');var _0x5985fa=_0x4236dc[_0x3dbf('0x21')];var _0x1c2ab4=_0x198b45?0x0:_0x23d4cd[_0x3dbf('0x22')];var _0x525912=_0x198b45?_0x4236dc[_0x3dbf('0x21')]:_0x23d4cd[_0x3dbf('0x22')]+_0x23d4cd['limit'];var _0x2bf18e;if(_0x525912>=_0x5985fa){_0x525912=_0x5985fa;_0x2bf18e=0xc8;}else{_0x2bf18e=0xce;}_0x1ab20a['status'](_0x2bf18e);return _0x1ab20a['set'](_0x3dbf('0x23'),_0x1c2ab4+'-'+_0x525912+'/'+_0x5985fa)[_0x3dbf('0x1e')](_0x4236dc);}return null;};}function patchUpdates(_0x1f5495){return function(_0x1d691a){try{jsonpatch[_0x3dbf('0x24')](_0x1d691a,_0x1f5495,!![]);}catch(_0x35f51d){return BPromise[_0x3dbf('0x25')](_0x35f51d);}return _0x1d691a['save']();};}function saveUpdates(_0x4d7c58,_0x19af4d){return function(_0x2f2be1){if(_0x2f2be1){return _0x2f2be1[_0x3dbf('0x26')](_0x4d7c58)[_0x3dbf('0x27')](function(_0x4be2fa){return _0x4be2fa;});}return null;};}function removeEntity(_0x2b5700,_0x8dec7f){return function(_0x4d7d64){if(_0x4d7d64){return _0x4d7d64[_0x3dbf('0x28')]()[_0x3dbf('0x27')](function(){_0x2b5700[_0x3dbf('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x878982,_0x48b62c){return function(_0x471e7d){if(!_0x471e7d){_0x878982[_0x3dbf('0x29')](0x194);}return _0x471e7d;};}function handleError(_0x5b77eb,_0x5f5b9d){_0x5f5b9d=_0x5f5b9d||0x1f4;return function(_0x6b6add){logger[_0x3dbf('0x2a')](_0x6b6add[_0x3dbf('0x2b')]);if(_0x6b6add[_0x3dbf('0x2c')]){delete _0x6b6add[_0x3dbf('0x2c')];}_0x5b77eb['status'](_0x5f5b9d)['send'](_0x6b6add);};}exports[_0x3dbf('0x2d')]=function(_0x10dcd6,_0x3099d2){var _0x36d492={},_0x5ac76d={},_0x10d506={'count':0x0,'rows':[]};var _0x23b406=_[_0x3dbf('0x2e')](db[_0x3dbf('0x2f')][_0x3dbf('0x30')],function(_0x1d602a){return{'name':_0x1d602a[_0x3dbf('0x31')],'type':_0x1d602a[_0x3dbf('0x32')]['key']};});_0x5ac76d['model']=_[_0x3dbf('0x33')](_[_0x3dbf('0x2e')](_0x23b406,'name'),[_0x3dbf('0x34')]);_0x5ac76d[_0x3dbf('0x35')]=_[_0x3dbf('0x36')](_0x10dcd6['query']);_0x5ac76d[_0x3dbf('0x37')]=_[_0x3dbf('0x38')](_0x5ac76d['model'],_0x5ac76d['query']);_0x36d492[_0x3dbf('0x39')]=_['intersection'](_0x5ac76d[_0x3dbf('0x3a')],qs['fields'](_0x10dcd6[_0x3dbf('0x35')][_0x3dbf('0x3b')]));_0x36d492[_0x3dbf('0x39')]=_0x36d492['attributes']['length']?_0x36d492['attributes']:_0x5ac76d[_0x3dbf('0x3a')];if(!_0x10dcd6[_0x3dbf('0x35')][_0x3dbf('0x3c')]('nolimit')){_0x36d492[_0x3dbf('0x1f')]=qs[_0x3dbf('0x1f')](_0x10dcd6[_0x3dbf('0x35')][_0x3dbf('0x1f')]);_0x36d492[_0x3dbf('0x22')]=qs['offset'](_0x10dcd6[_0x3dbf('0x35')][_0x3dbf('0x22')]);}_0x36d492[_0x3dbf('0x3d')]=qs[_0x3dbf('0x3e')](_0x10dcd6[_0x3dbf('0x35')]['sort']);_0x36d492[_0x3dbf('0x3f')]=qs[_0x3dbf('0x37')](_['pick'](_0x10dcd6[_0x3dbf('0x35')],_0x5ac76d['filters']),_0x23b406);if(_0x10dcd6[_0x3dbf('0x35')][_0x3dbf('0x40')]){_0x36d492[_0x3dbf('0x3f')]=_['merge'](_0x36d492['where'],{'$or':_[_0x3dbf('0x2e')](_0x23b406,function(_0x512d40){if(_0x512d40[_0x3dbf('0x32')]!=='VIRTUAL'){var _0xab7711={};_0xab7711[_0x512d40[_0x3dbf('0x2c')]]={'$like':'%'+_0x10dcd6['query']['filter']+'%'};return _0xab7711;}})});}_0x36d492=_[_0x3dbf('0x41')]({},_0x36d492,_0x10dcd6[_0x3dbf('0x42')]);var _0x490da4={'where':_0x36d492[_0x3dbf('0x3f')]};return db[_0x3dbf('0x2f')][_0x3dbf('0x21')](_0x490da4)[_0x3dbf('0x27')](function(_0x16fb89){_0x10d506[_0x3dbf('0x21')]=_0x16fb89;if(_0x10dcd6[_0x3dbf('0x35')][_0x3dbf('0x43')]){_0x36d492['include']=[{'all':!![]}];}return db[_0x3dbf('0x2f')][_0x3dbf('0x44')](_0x36d492);})[_0x3dbf('0x27')](function(_0x47b433){_0x10d506[_0x3dbf('0x45')]=_0x47b433;return _0x10d506;})['then'](respondWithFilteredResult(_0x3099d2,_0x36d492))[_0x3dbf('0x46')](handleError(_0x3099d2,null));};exports[_0x3dbf('0x47')]=function(_0x2b6b5a,_0x52e55d){var _0x5a53d6={'raw':![],'where':{'id':_0x2b6b5a['params']['id']}},_0x494d9c={};_0x494d9c[_0x3dbf('0x3a')]=_[_0x3dbf('0x36')](db[_0x3dbf('0x2f')][_0x3dbf('0x30')]);_0x494d9c[_0x3dbf('0x35')]=_[_0x3dbf('0x36')](_0x2b6b5a[_0x3dbf('0x35')]);_0x494d9c[_0x3dbf('0x37')]=_['intersection'](_0x494d9c[_0x3dbf('0x3a')],_0x494d9c[_0x3dbf('0x35')]);_0x5a53d6['attributes']=_[_0x3dbf('0x38')](_0x494d9c[_0x3dbf('0x3a')],qs['fields'](_0x2b6b5a['query'][_0x3dbf('0x3b')]));_0x5a53d6[_0x3dbf('0x39')]=_0x5a53d6[_0x3dbf('0x39')][_0x3dbf('0x48')]?_0x5a53d6[_0x3dbf('0x39')]:_0x494d9c[_0x3dbf('0x3a')];if(_0x2b6b5a[_0x3dbf('0x35')][_0x3dbf('0x43')]){_0x5a53d6[_0x3dbf('0x49')]=[{'all':!![]}];}_0x5a53d6=_[_0x3dbf('0x41')]({},_0x5a53d6,_0x2b6b5a[_0x3dbf('0x42')]);return db['VoiceRecording'][_0x3dbf('0x4a')](_0x5a53d6)[_0x3dbf('0x27')](handleEntityNotFound(_0x52e55d,null))[_0x3dbf('0x27')](respondWithResult(_0x52e55d,null))[_0x3dbf('0x46')](handleError(_0x52e55d,null));};exports[_0x3dbf('0x4b')]=function(_0x4cc0ad,_0x19a409){return db[_0x3dbf('0x2f')][_0x3dbf('0x4b')](_0x4cc0ad[_0x3dbf('0x4c')],{})[_0x3dbf('0x27')](respondWithResult(_0x19a409,0xc9))['catch'](handleError(_0x19a409,null));};exports[_0x3dbf('0x26')]=function(_0xbe3596,_0x1ec58e){if(_0xbe3596['body']['id']){delete _0xbe3596[_0x3dbf('0x4c')]['id'];}return db['VoiceRecording']['find']({'where':{'id':_0xbe3596[_0x3dbf('0x4d')]['id']}})[_0x3dbf('0x27')](handleEntityNotFound(_0x1ec58e,null))['then'](saveUpdates(_0xbe3596[_0x3dbf('0x4c')],null))[_0x3dbf('0x27')](respondWithResult(_0x1ec58e,null))[_0x3dbf('0x46')](handleError(_0x1ec58e,null));};exports[_0x3dbf('0x4e')]=function(_0x24f4b8,_0x5025a7){return db[_0x3dbf('0x2f')][_0x3dbf('0x4e')]()[_0x3dbf('0x27')](respondWithResult(_0x5025a7,null))['catch'](handleError(_0x5025a7,null));};exports[_0x3dbf('0x4f')]=function(_0x2881ad,_0x5bfbc1,_0x1c7557){var _0x2c97a8=require(_0x3dbf('0x50'));var _0x4b87d0=![];var _0x10c350={};if(_0x2881ad[_0x3dbf('0x35')][_0x3dbf('0x32')]&&_0x2881ad[_0x3dbf('0x35')][_0x3dbf('0x32')]===_0x3dbf('0x51')){_0x10c350[_0x3dbf('0x51')]=_0x2881ad[_0x3dbf('0x4d')]['id'];}else{_0x10c350['id']=_0x2881ad[_0x3dbf('0x4d')]['id'];}return db[_0x3dbf('0x2f')][_0x3dbf('0x4a')]({'where':_0x10c350,'attributes':['id','value'],'raw':!![]})['then'](handleEntityNotFound(_0x5bfbc1,null))[_0x3dbf('0x27')](function(_0x4f9fe7){if(_0x4f9fe7){var _0x5b8d9b=_0x4f9fe7[_0x3dbf('0x52')];var _0x5e0157=util['format'](_0x3dbf('0x53'),_0x5b8d9b);if(fs[_0x3dbf('0x54')](_0x5e0157)){_0x4b87d0=!![];return _0x2c97a8[_0x3dbf('0x55')](_0x5e0157,_0x5b8d9b,config['secrets'][_0x3dbf('0x56')])[_0x3dbf('0x27')](function(){return _0x4f9fe7;});}return _0x4f9fe7;}})[_0x3dbf('0x27')](function(_0x1d3ec8){if(_0x1d3ec8){var _0x54bf15=_0x1d3ec8['value'];if(!fs[_0x3dbf('0x54')](_0x54bf15)){throw new db['Sequelize'][(_0x3dbf('0x57'))]('VoiceRecording\x20not\x20found');}if(_0x1d3ec8[_0x3dbf('0x58')]){return _0x5bfbc1['download'](_0x54bf15,_0x1d3ec8[_0x3dbf('0x58')]+path['extname'](_0x54bf15),function(){if(_0x4b87d0){fs['unlink'](_0x54bf15);}});}else{return _0x5bfbc1[_0x3dbf('0x4f')](_0x54bf15,function(_0x384f32){if(_0x4b87d0){fs[_0x3dbf('0x59')](_0x54bf15);}});}}})['catch'](function(_0x564fdf){if(_0x564fdf[_0x3dbf('0x5a')]===_0x3dbf('0x5b')){_0x5bfbc1['status'](0x194)[_0x3dbf('0x5c')](_0x3dbf('0x5d'));}else{return handleError(_0x5bfbc1,null);}});};exports['downloads']=function(_0xe68cfd,_0x57942b,_0x5ab586){var _0x194a3b=require(_0x3dbf('0x50'));var _0x250f2e=![];var _0x48b863={'$and':[db['sequelize'][_0x3dbf('0x3f')](db['sequelize']['fn'](_0x3dbf('0x5e'),db[_0x3dbf('0x5f')]['col'](_0x3dbf('0x51'))),_0xe68cfd[_0x3dbf('0x35')][_0x3dbf('0x60')])]};if(_0xe68cfd['query'][_0x3dbf('0x32')]&&_0xe68cfd[_0x3dbf('0x35')][_0x3dbf('0x32')]===_0x3dbf('0x51')){_0x48b863['$and'][_0x3dbf('0x61')]({'uniqueid':_0xe68cfd[_0x3dbf('0x4d')]['id']});}else{_0x48b863[_0x3dbf('0x62')][_0x3dbf('0x61')]({'id':_0xe68cfd[_0x3dbf('0x4d')]['id']});}return db['VoiceRecording'][_0x3dbf('0x4a')]({'where':_0x48b863,'attributes':['id',_0x3dbf('0x52')],'raw':!![]})[_0x3dbf('0x27')](handleEntityNotFound(_0x57942b,null))[_0x3dbf('0x27')](function(_0x52c420){if(_0x52c420){var _0x54c749=util[_0x3dbf('0x34')](_0x3dbf('0x53'),_0x52c420['value']);if(fs['existsSync'](_0x54c749)){_0x250f2e=!![];return _0x194a3b['decryptFile'](_0x54c749,_0x52c420['value'],config['secrets']['recording'])[_0x3dbf('0x27')](function(){return _0x52c420;});}return _0x52c420;}})[_0x3dbf('0x27')](function(_0x1bdc6a){if(_0x1bdc6a){if(!fs['existsSync'](_0x1bdc6a['value'])){throw new db['Sequelize'][(_0x3dbf('0x57'))]('VoiceRecording\x20not\x20found');}if(_0x1bdc6a[_0x3dbf('0x58')]){return _0x57942b['download'](_0x1bdc6a[_0x3dbf('0x52')],_0x1bdc6a[_0x3dbf('0x58')]+path[_0x3dbf('0x63')](_0x1bdc6a[_0x3dbf('0x52')]),function(){if(_0x250f2e){fs[_0x3dbf('0x59')](_0x1bdc6a[_0x3dbf('0x52')]);}});}else{return _0x57942b['download'](_0x1bdc6a[_0x3dbf('0x52')],function(_0x37671c){if(_0x250f2e){fs['unlink'](_0x1bdc6a['value']);}});}}})[_0x3dbf('0x46')](handleError(_0x57942b,null));};exports[_0x3dbf('0x28')]=function(_0x112140,_0x44cd0d){return db[_0x3dbf('0x2f')]['find']({'where':{'id':_0x112140[_0x3dbf('0x4d')]['id']}})[_0x3dbf('0x27')](function(_0x358218){if(_[_0x3dbf('0x64')](_0x358218)){throw new ReferenceError(_0x3dbf('0x65'));}return _0x358218;})[_0x3dbf('0x27')](function(_0x534d00){var _0x768427=_0x534d00[_0x3dbf('0x52')];logger[_0x3dbf('0x66')]('cancellazione\x20fisica\x20documento\x20%s',_0x768427);if(!_[_0x3dbf('0x64')](_0x534d00[_0x3dbf('0x52')])&&fs[_0x3dbf('0x54')](_0x768427)){logger['info']('File:\x20\x22'+_0x768427+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x768427);}_0x768427=_0x768427+_0x3dbf('0x67');if(!_[_0x3dbf('0x64')](_0x534d00[_0x3dbf('0x52')])&&fs['existsSync'](_0x768427)){logger[_0x3dbf('0x66')](_0x3dbf('0x68')+_0x768427+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x3dbf('0x69')](_0x768427);}return _0x534d00;})[_0x3dbf('0x27')](function(_0x245ece){if(!_0x245ece)throw new InternalError();return _0x245ece['destroy']();})['then'](function(){_0x44cd0d[_0x3dbf('0x1c')](0xcc)[_0x3dbf('0x1d')]();})[_0x3dbf('0x46')](handleError(_0x44cd0d,null));};function getBucketslist(_0x3983c0,_0x112a72,_0x4d04c2){return new Promise(function(_0x4908ed,_0x36f4a7){var _0x2c3c3a=new AWS['S3']({'accessKeyId':_0x112a72,'secretAccessKey':_0x3983c0,'region':_0x4d04c2});_0x2c3c3a[_0x3dbf('0x6a')]({},function(_0x3adef9,_0x17d12d){if(_0x3adef9){return _0x36f4a7(_0x3adef9);}else{return _0x4908ed(_0x17d12d);}});});}function createBucket(_0x222034,_0x56c618,_0x2c8b02,_0x246412){return new Promise(function(_0x50d932,_0x1caaa3){var _0x24ac2c=new AWS['S3']({'accessKeyId':_0x56c618,'secretAccessKey':_0x222034,'region':_0x2c8b02});_0x24ac2c['createBucket']({'Bucket':_0x246412},function(_0x4c176f,_0x1b0fe3){if(_0x4c176f){return _0x1caaa3(_0x4c176f);}else{return _0x50d932(_0x1b0fe3);}});});}function uploadFile(_0x276873,_0x3d4a10,_0x245b08,_0x566a59,_0x4e7950,_0x5a23d5){return new Promise(function(_0x248590,_0x495acd){var _0x5a5f7f=new AWS['S3']({'accessKeyId':_0x3d4a10,'secretAccessKey':_0x276873,'region':_0x245b08});_0x5a5f7f['upload']({'Bucket':_0x566a59,'Key':_0x4e7950,'Body':_0x5a23d5},function(_0x1cbce1,_0x270128){if(_0x1cbce1){return _0x495acd(_0x1cbce1);}else{return _0x248590(_0x270128);}});});}function startTranscribe(_0x3cd8cb,_0x3d0565,_0x32fde7,_0x195a93,_0x396a0c,_0x4c363d){return new Promise(function(_0xcca7c9,_0x9fe85){var _0x4a89a3=new AWS[(_0x3dbf('0x6b'))]({'accessKeyId':_0x3d0565,'secretAccessKey':_0x3cd8cb,'region':_0x32fde7});_0x4a89a3[_0x3dbf('0x6c')]({'TranscriptionJobName':_0x195a93,'LanguageCode':_0x396a0c,'Media':{'MediaFileUri':_0x4c363d}},function(_0x3bc017,_0x15cd6a){if(_0x3bc017){return _0x9fe85(_0x3bc017);}else{return _0xcca7c9(_0x15cd6a);}});});}function transcribe(_0x27851a,_0x346882,_0x351d42,_0x361997,_0x1b32db,_0x4fdb0a,_0x260935){return new Promise(function(_0x25787f,_0x563b5e){var _0x392cfc={};logger[_0x3dbf('0x66')](util['format']('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x27851a,_0x1b32db));return uploadFile(_0x346882,_0x351d42,_0x361997,_0x1b32db,path[_0x3dbf('0x6d')](_0x4fdb0a),fs[_0x3dbf('0x6e')](_0x4fdb0a))[_0x3dbf('0x27')](function(_0x45e6ba){logger['info'](util[_0x3dbf('0x34')]('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x27851a,_0x1b32db,_0x45e6ba['Location']));_0x392cfc[_0x3dbf('0x6f')]=_0x45e6ba[_0x3dbf('0x70')];_0x392cfc[_0x3dbf('0x71')]=_0x45e6ba[_0x3dbf('0x72')];logger[_0x3dbf('0x66')](util[_0x3dbf('0x34')]('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x27851a));return startTranscribe(_0x346882,_0x351d42,_0x361997,uuidv4(),_0x260935,_0x45e6ba[_0x3dbf('0x72')]);})['then'](function(_0x5e5c42){logger[_0x3dbf('0x66')](util[_0x3dbf('0x34')](_0x3dbf('0x73'),_0x27851a,_0x5e5c42[_0x3dbf('0x74')]['TranscriptionJobName']));_0x392cfc[_0x3dbf('0x75')]=_0x5e5c42['TranscriptionJob'][_0x3dbf('0x76')];_0x392cfc[_0x3dbf('0x77')]=_0x5e5c42['TranscriptionJob'][_0x3dbf('0x78')];return _0x25787f(_0x392cfc);})[_0x3dbf('0x46')](function(_0x59b834){return _0x563b5e(_0x59b834);});});}exports[_0x3dbf('0x79')]=function(_0x1fb206,_0xb0afa,_0x456e96){var _0x272416;var _0x41d4bd;var _0x1b25fc;var _0x4a6f1c=require(_0x3dbf('0x50'));return db[_0x3dbf('0x2f')]['findOne']({'where':{'id':_0x1fb206[_0x3dbf('0x4d')]['id']}})[_0x3dbf('0x27')](function(_0xdf7983){if(_0xdf7983){var _0x21e6c1=util[_0x3dbf('0x34')]('%s.cypher',_0xdf7983[_0x3dbf('0x52')]);if(fs[_0x3dbf('0x54')](_0x21e6c1)){cypher=!![];return _0x4a6f1c[_0x3dbf('0x55')](_0x21e6c1,_0xdf7983[_0x3dbf('0x52')],config[_0x3dbf('0x7a')]['recording'])[_0x3dbf('0x27')](function(){return _0xdf7983;});}return _0xdf7983;}})[_0x3dbf('0x27')](function(_0x484893){if(!_0x484893){throw new db['Sequelize'][(_0x3dbf('0x57'))]('Voice\x20Recording\x20not\x20found');}_0x41d4bd=_0x484893;return db[_0x3dbf('0x7b')]['findOne']({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0xb0afa,null))[_0x3dbf('0x27')](function(_0x412c5e){if(_0x412c5e){_0x272416=_0x412c5e;if(!_0x272416[_0x3dbf('0x7c')]||!_0x272416[_0x3dbf('0x7d')]||!_0x272416['transcribeRegion']||!_0x272416[_0x3dbf('0x7e')]||!_0x272416[_0x3dbf('0x6f')]){throw new db['Sequelize'][(_0x3dbf('0x57'))](_0x3dbf('0x7f'));}if(_0x1fb206[_0x3dbf('0x4c')][_0x3dbf('0x80')]&&(!_0x272416[_0x3dbf('0x81')]||!_0x272416[_0x3dbf('0x82')]||!_0x272416[_0x3dbf('0x83')]||!_0x272416[_0x3dbf('0x7e')]||!_0x272416['bucket'])){throw new db[(_0x3dbf('0x84'))][(_0x3dbf('0x57'))](_0x3dbf('0x85'));}return db['CloudProvider']['findOne']({'where':{'id':_0x272416[_0x3dbf('0x7d')]}});}})['then'](function(_0x5e510b){if(!_0x5e510b){throw new db[(_0x3dbf('0x84'))][(_0x3dbf('0x57'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x5e510b[_0x3dbf('0x86')]||!_0x5e510b[_0x3dbf('0x87')]){throw new db[(_0x3dbf('0x84'))][(_0x3dbf('0x57'))]('Cloud\x20Provider\x20not\x20configured');}_0x1b25fc=_0x5e510b;return getBucketslist(_0x1b25fc['data1'],_0x1b25fc['data2'],_0x272416[_0x3dbf('0x88')]);})[_0x3dbf('0x27')](function(_0x180f40){if(_0x180f40&&_0x180f40[_0x3dbf('0x89')]){var _0x48deae=_[_0x3dbf('0x4a')](_0x180f40[_0x3dbf('0x89')],function(_0x249ba6){return _0x249ba6[_0x3dbf('0x8a')]===_0x272416[_0x3dbf('0x6f')];});if(!_0x48deae){logger[_0x3dbf('0x66')](util[_0x3dbf('0x34')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x1fb206[_0x3dbf('0x4d')]['id'],_0x272416['bucket']));return createBucket(_0x1b25fc[_0x3dbf('0x86')],_0x1b25fc['data2'],_0x272416[_0x3dbf('0x88')],_0x272416[_0x3dbf('0x6f')]);}logger['info'](util[_0x3dbf('0x34')](_0x3dbf('0x8b'),_0x1fb206[_0x3dbf('0x4d')]['id'],_0x272416[_0x3dbf('0x6f')]));return;}})[_0x3dbf('0x27')](function(_0xd9edaa){if(_0x41d4bd[_0x3dbf('0x77')]===_0x3dbf('0x8c')){return transcribe(_0x1fb206['params']['id'],_0x1b25fc[_0x3dbf('0x86')],_0x1b25fc[_0x3dbf('0x87')],_0x272416['transcribeRegion'],_0x272416[_0x3dbf('0x6f')],_0x41d4bd['value'],_0x272416[_0x3dbf('0x7e')]);}else{logger[_0x3dbf('0x66')](util[_0x3dbf('0x34')](_0x3dbf('0x8d'),_0x1fb206[_0x3dbf('0x4d')]['id']));return{'transcribeStatus':'IN_PROGRESS'};}})[_0x3dbf('0x27')](function(_0x25c6fb){if(_0x25c6fb){_0x25c6fb['tempSentiment']=_0x1fb206[_0x3dbf('0x4c')][_0x3dbf('0x80')];return _0x41d4bd[_0x3dbf('0x8e')](_0x25c6fb);}})['then'](respondWithResult(_0xb0afa,null))[_0x3dbf('0x46')](handleError(_0xb0afa,null));};function writeFile(_0xa95a32,_0x59d46a){return new Promise(function(_0x30c9ac,_0x2dc79b){fs['writeFile'](_0x59d46a,_0xa95a32,function(_0x17ea31,_0x507051){if(_0x17ea31){return _0x2dc79b(_0x17ea31);}else{return _0x30c9ac(_0x507051);}});});}exports[_0x3dbf('0x8f')]=function(_0x316c31,_0x41f4d7,_0x45cc2f){return db[_0x3dbf('0x2f')][_0x3dbf('0x90')]({'where':{'id':_0x316c31['params']['id']}})[_0x3dbf('0x27')](handleEntityNotFound(_0x41f4d7))['then'](function(_0x316e8f){if(_0x316e8f&&_0x316e8f[_0x3dbf('0x91')]){var _0x286b7d=_0x316e8f['fileText'];var _0x1a3049=config[_0x3dbf('0x92')]+_0x3dbf('0x93')+_0x316e8f['id']+_0x3dbf('0x94');if(fs['existsSync'](_0x1a3049)){return _0x1a3049;}return writeFile(_0x286b7d,_0x1a3049)['then'](function(){return _0x1a3049;});}else{throw new db[(_0x3dbf('0x84'))]['ValidationError'](_0x3dbf('0x95'));}})[_0x3dbf('0x27')](function(_0x486df2){return _0x41f4d7['download'](_0x486df2);})[_0x3dbf('0x46')](handleError(_0x41f4d7));}; \ No newline at end of file +var _0x5a6a=['format','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','VoiceRecording','then','includeAll','include','show','params','keys','catch','create','update','body','find','describe','download','uniqueid','value','%s.cypher','existsSync','secrets','recording','VoiceRecording\x20not\x20found','filename','unlink','Not\x20found','downloads','../../components/encryptor','sequelize','MD5','col','token','$and','push','Sequelize','ValidationError','extname','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','info','unlinkSync','.cypher','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','listBuckets','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','tempSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','destroy','end','error','stack','index','map','rawAttributes','fieldName','type','key','model','differenceBy','name'];(function(_0x838813,_0x448f0f){var _0x2bd32d=function(_0x57b589){while(--_0x57b589){_0x838813['push'](_0x838813['shift']());}};_0x2bd32d(++_0x448f0f);}(_0x5a6a,0x6c));var _0xa5a6=function(_0x15a172,_0x33cfdd){_0x15a172=_0x15a172-0x0;var _0x2ab7ce=_0x5a6a[_0x15a172];return _0x2ab7ce;};'use strict';var emlformat=require(_0xa5a6('0x0'));var rimraf=require(_0xa5a6('0x1'));var zipdir=require(_0xa5a6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa5a6('0x3'));var moment=require(_0xa5a6('0x4'));var BPromise=require(_0xa5a6('0x5'));var Mustache=require('mustache');var util=require(_0xa5a6('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xa5a6('0x7'));var ejs=require(_0xa5a6('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa5a6('0x9'));var squel=require(_0xa5a6('0xa'));var crypto=require(_0xa5a6('0xb'));var jsforce=require(_0xa5a6('0xc'));var deskjs=require(_0xa5a6('0xd'));var toCsv=require(_0xa5a6('0x7'));var querystring=require('querystring');var Papa=require(_0xa5a6('0xe'));var AWS=require(_0xa5a6('0xf'));var uuidv4=require(_0xa5a6('0x10'));var Redis=require(_0xa5a6('0x11'));var authService=require(_0xa5a6('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xa5a6('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa5a6('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xa5a6('0x15'));var licenseUtil=require(_0xa5a6('0x16'));var db=require(_0xa5a6('0x17'))['db'];function respondWithStatusCode(_0x219d7d,_0x191ef4){_0x191ef4=_0x191ef4||0xcc;return function(_0x478d4a){if(_0x478d4a){return _0x219d7d[_0xa5a6('0x18')](_0x191ef4);}return _0x219d7d[_0xa5a6('0x19')](_0x191ef4)['end']();};}function respondWithResult(_0x371f2a,_0x54c481){_0x54c481=_0x54c481||0xc8;return function(_0x4d06c2){if(_0x4d06c2){return _0x371f2a['status'](_0x54c481)[_0xa5a6('0x1a')](_0x4d06c2);}};}function respondWithFilteredResult(_0x3bcd75,_0x8add18){return function(_0x356474){if(_0x356474){var _0x4176a5=typeof _0x8add18[_0xa5a6('0x1b')]===_0xa5a6('0x1c')&&typeof _0x8add18[_0xa5a6('0x1d')]==='undefined';var _0x7e2d78=_0x356474[_0xa5a6('0x1e')];var _0x11bfbf=_0x4176a5?0x0:_0x8add18[_0xa5a6('0x1b')];var _0x47c86f=_0x4176a5?_0x356474[_0xa5a6('0x1e')]:_0x8add18['offset']+_0x8add18['limit'];var _0x19236e;if(_0x47c86f>=_0x7e2d78){_0x47c86f=_0x7e2d78;_0x19236e=0xc8;}else{_0x19236e=0xce;}_0x3bcd75[_0xa5a6('0x19')](_0x19236e);return _0x3bcd75['set'](_0xa5a6('0x1f'),_0x11bfbf+'-'+_0x47c86f+'/'+_0x7e2d78)[_0xa5a6('0x1a')](_0x356474);}return null;};}function patchUpdates(_0x520b9d){return function(_0x36dca0){try{jsonpatch[_0xa5a6('0x20')](_0x36dca0,_0x520b9d,!![]);}catch(_0x40dec3){return BPromise[_0xa5a6('0x21')](_0x40dec3);}return _0x36dca0[_0xa5a6('0x22')]();};}function saveUpdates(_0x4b9c7c,_0x3d53ac){return function(_0x2df7ee){if(_0x2df7ee){return _0x2df7ee['update'](_0x4b9c7c)['then'](function(_0x10ca92){return _0x10ca92;});}return null;};}function removeEntity(_0x3f490b,_0x20aae4){return function(_0x4a120e){if(_0x4a120e){return _0x4a120e[_0xa5a6('0x23')]()['then'](function(){_0x3f490b[_0xa5a6('0x19')](0xcc)[_0xa5a6('0x24')]();});}};}function handleEntityNotFound(_0x58163c,_0x54587a){return function(_0x3764c9){if(!_0x3764c9){_0x58163c[_0xa5a6('0x18')](0x194);}return _0x3764c9;};}function handleError(_0x317e97,_0xf7206b){_0xf7206b=_0xf7206b||0x1f4;return function(_0x1ea532){logger[_0xa5a6('0x25')](_0x1ea532[_0xa5a6('0x26')]);if(_0x1ea532['name']){delete _0x1ea532['name'];}_0x317e97['status'](_0xf7206b)['send'](_0x1ea532);};}exports[_0xa5a6('0x27')]=function(_0x29df27,_0x1ea2ab){var _0x17e351={},_0x39db4c={},_0x4af61a={'count':0x0,'rows':[]};var _0x4d6995=_[_0xa5a6('0x28')](db['VoiceRecording'][_0xa5a6('0x29')],function(_0x5b1f18){return{'name':_0x5b1f18[_0xa5a6('0x2a')],'type':_0x5b1f18[_0xa5a6('0x2b')][_0xa5a6('0x2c')]};});_0x39db4c[_0xa5a6('0x2d')]=_[_0xa5a6('0x2e')](_[_0xa5a6('0x28')](_0x4d6995,_0xa5a6('0x2f')),[_0xa5a6('0x30')]);_0x39db4c[_0xa5a6('0x31')]=_['keys'](_0x29df27['query']);_0x39db4c[_0xa5a6('0x32')]=_[_0xa5a6('0x33')](_0x39db4c[_0xa5a6('0x2d')],_0x39db4c[_0xa5a6('0x31')]);_0x17e351[_0xa5a6('0x34')]=_[_0xa5a6('0x33')](_0x39db4c['model'],qs[_0xa5a6('0x35')](_0x29df27[_0xa5a6('0x31')][_0xa5a6('0x35')]));_0x17e351['attributes']=_0x17e351[_0xa5a6('0x34')][_0xa5a6('0x36')]?_0x17e351['attributes']:_0x39db4c['model'];if(!_0x29df27['query'][_0xa5a6('0x37')](_0xa5a6('0x38'))){_0x17e351[_0xa5a6('0x1d')]=qs[_0xa5a6('0x1d')](_0x29df27[_0xa5a6('0x31')][_0xa5a6('0x1d')]);_0x17e351['offset']=qs[_0xa5a6('0x1b')](_0x29df27['query']['offset']);}_0x17e351[_0xa5a6('0x39')]=qs[_0xa5a6('0x3a')](_0x29df27['query'][_0xa5a6('0x3a')]);_0x17e351[_0xa5a6('0x3b')]=qs[_0xa5a6('0x32')](_[_0xa5a6('0x3c')](_0x29df27[_0xa5a6('0x31')],_0x39db4c[_0xa5a6('0x32')]),_0x4d6995);if(_0x29df27[_0xa5a6('0x31')][_0xa5a6('0x3d')]){_0x17e351['where']=_[_0xa5a6('0x3e')](_0x17e351['where'],{'$or':_['map'](_0x4d6995,function(_0x2732a9){if(_0x2732a9['type']!==_0xa5a6('0x3f')){var _0x2163ec={};_0x2163ec[_0x2732a9[_0xa5a6('0x2f')]]={'$like':'%'+_0x29df27['query']['filter']+'%'};return _0x2163ec;}})});}_0x17e351=_[_0xa5a6('0x3e')]({},_0x17e351,_0x29df27[_0xa5a6('0x40')]);var _0x54f087={'where':_0x17e351[_0xa5a6('0x3b')]};return db[_0xa5a6('0x41')]['count'](_0x54f087)[_0xa5a6('0x42')](function(_0x3e1bbb){_0x4af61a[_0xa5a6('0x1e')]=_0x3e1bbb;if(_0x29df27[_0xa5a6('0x31')][_0xa5a6('0x43')]){_0x17e351[_0xa5a6('0x44')]=[{'all':!![]}];}return db['VoiceRecording']['findAll'](_0x17e351);})[_0xa5a6('0x42')](function(_0x21c036){_0x4af61a['rows']=_0x21c036;return _0x4af61a;})[_0xa5a6('0x42')](respondWithFilteredResult(_0x1ea2ab,_0x17e351))['catch'](handleError(_0x1ea2ab,null));};exports[_0xa5a6('0x45')]=function(_0x1ae8a4,_0x5760d6){var _0x52b878={'raw':![],'where':{'id':_0x1ae8a4[_0xa5a6('0x46')]['id']}},_0x3b5c85={};_0x3b5c85[_0xa5a6('0x2d')]=_[_0xa5a6('0x47')](db[_0xa5a6('0x41')][_0xa5a6('0x29')]);_0x3b5c85[_0xa5a6('0x31')]=_['keys'](_0x1ae8a4['query']);_0x3b5c85['filters']=_[_0xa5a6('0x33')](_0x3b5c85[_0xa5a6('0x2d')],_0x3b5c85[_0xa5a6('0x31')]);_0x52b878[_0xa5a6('0x34')]=_[_0xa5a6('0x33')](_0x3b5c85['model'],qs['fields'](_0x1ae8a4['query']['fields']));_0x52b878['attributes']=_0x52b878[_0xa5a6('0x34')][_0xa5a6('0x36')]?_0x52b878['attributes']:_0x3b5c85[_0xa5a6('0x2d')];if(_0x1ae8a4[_0xa5a6('0x31')][_0xa5a6('0x43')]){_0x52b878[_0xa5a6('0x44')]=[{'all':!![]}];}_0x52b878=_['merge']({},_0x52b878,_0x1ae8a4[_0xa5a6('0x40')]);return db['VoiceRecording']['find'](_0x52b878)['then'](handleEntityNotFound(_0x5760d6,null))[_0xa5a6('0x42')](respondWithResult(_0x5760d6,null))[_0xa5a6('0x48')](handleError(_0x5760d6,null));};exports['create']=function(_0x2d65de,_0x2e97e1){return db[_0xa5a6('0x41')][_0xa5a6('0x49')](_0x2d65de['body'],{})[_0xa5a6('0x42')](respondWithResult(_0x2e97e1,0xc9))[_0xa5a6('0x48')](handleError(_0x2e97e1,null));};exports[_0xa5a6('0x4a')]=function(_0x490950,_0xe1c146){if(_0x490950[_0xa5a6('0x4b')]['id']){delete _0x490950['body']['id'];}return db[_0xa5a6('0x41')][_0xa5a6('0x4c')]({'where':{'id':_0x490950[_0xa5a6('0x46')]['id']}})[_0xa5a6('0x42')](handleEntityNotFound(_0xe1c146,null))[_0xa5a6('0x42')](saveUpdates(_0x490950['body'],null))['then'](respondWithResult(_0xe1c146,null))[_0xa5a6('0x48')](handleError(_0xe1c146,null));};exports[_0xa5a6('0x4d')]=function(_0x585168,_0xd907){return db[_0xa5a6('0x41')]['describe']()[_0xa5a6('0x42')](respondWithResult(_0xd907,null))['catch'](handleError(_0xd907,null));};exports[_0xa5a6('0x4e')]=function(_0x415291,_0x55396b,_0x3c7444){var _0x55064e=require('../../components/encryptor');var _0x52c9e7=![];var _0x542376={};if(_0x415291[_0xa5a6('0x31')][_0xa5a6('0x2b')]&&_0x415291[_0xa5a6('0x31')][_0xa5a6('0x2b')]===_0xa5a6('0x4f')){_0x542376['uniqueid']=_0x415291[_0xa5a6('0x46')]['id'];}else{_0x542376['id']=_0x415291['params']['id'];}return db[_0xa5a6('0x41')][_0xa5a6('0x4c')]({'where':_0x542376,'attributes':['id',_0xa5a6('0x50')],'raw':!![]})['then'](handleEntityNotFound(_0x55396b,null))[_0xa5a6('0x42')](function(_0x727c04){if(_0x727c04){var _0x3107f0=_0x727c04[_0xa5a6('0x50')];var _0x32e5c3=util[_0xa5a6('0x30')](_0xa5a6('0x51'),_0x3107f0);if(fs[_0xa5a6('0x52')](_0x32e5c3)){_0x52c9e7=!![];return _0x55064e['decryptFile'](_0x32e5c3,_0x3107f0,config[_0xa5a6('0x53')][_0xa5a6('0x54')])[_0xa5a6('0x42')](function(){return _0x727c04;});}return _0x727c04;}})['then'](function(_0x1d03fc){if(_0x1d03fc){var _0x22a7b6=_0x1d03fc[_0xa5a6('0x50')];if(!fs[_0xa5a6('0x52')](_0x22a7b6)){throw new db['Sequelize']['ValidationError'](_0xa5a6('0x55'));}if(_0x1d03fc[_0xa5a6('0x56')]){return _0x55396b['download'](_0x22a7b6,_0x1d03fc[_0xa5a6('0x56')]+path['extname'](_0x22a7b6),function(){if(_0x52c9e7){fs['unlink'](_0x22a7b6);}});}else{return _0x55396b[_0xa5a6('0x4e')](_0x22a7b6,function(_0x7283f7){if(_0x52c9e7){fs[_0xa5a6('0x57')](_0x22a7b6);}});}}})[_0xa5a6('0x48')](function(_0x2742b7){if(_0x2742b7['message']===_0xa5a6('0x55')){_0x55396b[_0xa5a6('0x19')](0x194)['send'](_0xa5a6('0x58'));}else{return handleError(_0x55396b,null);}});};exports[_0xa5a6('0x59')]=function(_0x5204ab,_0x3d8789,_0x58252b){var _0x13d0b4=require(_0xa5a6('0x5a'));var _0x19a64b=![];var _0x1761cb={'$and':[db[_0xa5a6('0x5b')][_0xa5a6('0x3b')](db[_0xa5a6('0x5b')]['fn'](_0xa5a6('0x5c'),db[_0xa5a6('0x5b')][_0xa5a6('0x5d')](_0xa5a6('0x4f'))),_0x5204ab['query'][_0xa5a6('0x5e')])]};if(_0x5204ab[_0xa5a6('0x31')]['type']&&_0x5204ab[_0xa5a6('0x31')][_0xa5a6('0x2b')]===_0xa5a6('0x4f')){_0x1761cb[_0xa5a6('0x5f')][_0xa5a6('0x60')]({'uniqueid':_0x5204ab[_0xa5a6('0x46')]['id']});}else{_0x1761cb['$and']['push']({'id':_0x5204ab[_0xa5a6('0x46')]['id']});}return db[_0xa5a6('0x41')][_0xa5a6('0x4c')]({'where':_0x1761cb,'attributes':['id',_0xa5a6('0x50')],'raw':!![]})[_0xa5a6('0x42')](handleEntityNotFound(_0x3d8789,null))[_0xa5a6('0x42')](function(_0x36c123){if(_0x36c123){var _0x590018=util['format']('%s.cypher',_0x36c123['value']);if(fs[_0xa5a6('0x52')](_0x590018)){_0x19a64b=!![];return _0x13d0b4['decryptFile'](_0x590018,_0x36c123[_0xa5a6('0x50')],config[_0xa5a6('0x53')][_0xa5a6('0x54')])[_0xa5a6('0x42')](function(){return _0x36c123;});}return _0x36c123;}})['then'](function(_0x41386b){if(_0x41386b){if(!fs[_0xa5a6('0x52')](_0x41386b[_0xa5a6('0x50')])){throw new db[(_0xa5a6('0x61'))][(_0xa5a6('0x62'))](_0xa5a6('0x55'));}if(_0x41386b[_0xa5a6('0x56')]){return _0x3d8789['download'](_0x41386b[_0xa5a6('0x50')],_0x41386b['filename']+path[_0xa5a6('0x63')](_0x41386b['value']),function(){if(_0x19a64b){fs[_0xa5a6('0x57')](_0x41386b['value']);}});}else{return _0x3d8789[_0xa5a6('0x4e')](_0x41386b['value'],function(_0x7725c0){if(_0x19a64b){fs[_0xa5a6('0x57')](_0x41386b[_0xa5a6('0x50')]);}});}}})[_0xa5a6('0x48')](handleError(_0x3d8789,null));};exports[_0xa5a6('0x23')]=function(_0x331952,_0x5c6fb3){return db[_0xa5a6('0x41')][_0xa5a6('0x4c')]({'where':{'id':_0x331952['params']['id']}})[_0xa5a6('0x42')](function(_0x39f77b){if(_[_0xa5a6('0x64')](_0x39f77b)){throw new ReferenceError(_0xa5a6('0x65'));}return _0x39f77b;})[_0xa5a6('0x42')](function(_0x4ab05b){var _0xae09ae=_0x4ab05b[_0xa5a6('0x50')];logger['info'](_0xa5a6('0x66'),_0xae09ae);if(!_[_0xa5a6('0x64')](_0x4ab05b['value'])&&fs[_0xa5a6('0x52')](_0xae09ae)){logger[_0xa5a6('0x67')]('File:\x20\x22'+_0xae09ae+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xa5a6('0x68')](_0xae09ae);}_0xae09ae=_0xae09ae+_0xa5a6('0x69');if(!_[_0xa5a6('0x64')](_0x4ab05b[_0xa5a6('0x50')])&&fs['existsSync'](_0xae09ae)){logger['info'](_0xa5a6('0x6a')+_0xae09ae+_0xa5a6('0x6b'));fs[_0xa5a6('0x68')](_0xae09ae);}return _0x4ab05b;})['then'](function(_0x5a3965){if(!_0x5a3965)throw new InternalError();return _0x5a3965[_0xa5a6('0x23')]();})['then'](function(){_0x5c6fb3[_0xa5a6('0x19')](0xcc)['end']();})[_0xa5a6('0x48')](handleError(_0x5c6fb3,null));};function getBucketslist(_0x1bae4d,_0x17f2e2,_0x368a1a){return new Promise(function(_0x2c7b63,_0x334cf7){var _0x452836=new AWS['S3']({'accessKeyId':_0x17f2e2,'secretAccessKey':_0x1bae4d,'region':_0x368a1a});_0x452836[_0xa5a6('0x6c')]({},function(_0x5b0bcb,_0x7e8227){if(_0x5b0bcb){return _0x334cf7(_0x5b0bcb);}else{return _0x2c7b63(_0x7e8227);}});});}function createBucket(_0x51289a,_0x5c5708,_0x45d4d5,_0x2a2ee1){return new Promise(function(_0xfeb5b0,_0x58a761){var _0x2318d6=new AWS['S3']({'accessKeyId':_0x5c5708,'secretAccessKey':_0x51289a,'region':_0x45d4d5});_0x2318d6['createBucket']({'Bucket':_0x2a2ee1},function(_0x8b7f9,_0x569730){if(_0x8b7f9){return _0x58a761(_0x8b7f9);}else{return _0xfeb5b0(_0x569730);}});});}function uploadFile(_0x32080a,_0x49b0e7,_0x1cb9d5,_0x55d7f5,_0x31bd3d,_0x558edb){return new Promise(function(_0x35c186,_0x3e9a99){var _0x52dc98=new AWS['S3']({'accessKeyId':_0x49b0e7,'secretAccessKey':_0x32080a,'region':_0x1cb9d5});_0x52dc98[_0xa5a6('0x6d')]({'Bucket':_0x55d7f5,'Key':_0x31bd3d,'Body':_0x558edb},function(_0x485fb4,_0x312a54){if(_0x485fb4){return _0x3e9a99(_0x485fb4);}else{return _0x35c186(_0x312a54);}});});}function startTranscribe(_0x59d22b,_0x509749,_0x148411,_0x36cfd8,_0x376065,_0x23d611){return new Promise(function(_0x289c24,_0x314055){var _0x2a1b51=new AWS[(_0xa5a6('0x6e'))]({'accessKeyId':_0x509749,'secretAccessKey':_0x59d22b,'region':_0x148411});_0x2a1b51[_0xa5a6('0x6f')]({'TranscriptionJobName':_0x36cfd8,'LanguageCode':_0x376065,'Media':{'MediaFileUri':_0x23d611}},function(_0x1a864e,_0x4c7c55){if(_0x1a864e){return _0x314055(_0x1a864e);}else{return _0x289c24(_0x4c7c55);}});});}function transcribe(_0x245fbd,_0x5777cf,_0x7ff3bf,_0x5bade4,_0x34542e,_0x34f17f,_0x20071a){return new Promise(function(_0x14261b,_0x296787){var _0xf16899={};logger[_0xa5a6('0x67')](util['format'](_0xa5a6('0x70'),_0x245fbd,_0x34542e));return uploadFile(_0x5777cf,_0x7ff3bf,_0x5bade4,_0x34542e,path[_0xa5a6('0x71')](_0x34f17f),fs[_0xa5a6('0x72')](_0x34f17f))[_0xa5a6('0x42')](function(_0x4d8267){logger[_0xa5a6('0x67')](util[_0xa5a6('0x30')]('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x245fbd,_0x34542e,_0x4d8267[_0xa5a6('0x73')]));_0xf16899[_0xa5a6('0x74')]=_0x4d8267[_0xa5a6('0x75')];_0xf16899[_0xa5a6('0x76')]=_0x4d8267[_0xa5a6('0x73')];logger['info'](util[_0xa5a6('0x30')](_0xa5a6('0x77'),_0x245fbd));return startTranscribe(_0x5777cf,_0x7ff3bf,_0x5bade4,uuidv4(),_0x20071a,_0x4d8267['Location']);})[_0xa5a6('0x42')](function(_0x2c14cc){logger[_0xa5a6('0x67')](util['format'](_0xa5a6('0x78'),_0x245fbd,_0x2c14cc[_0xa5a6('0x79')][_0xa5a6('0x7a')]));_0xf16899[_0xa5a6('0x7b')]=_0x2c14cc['TranscriptionJob'][_0xa5a6('0x7a')];_0xf16899[_0xa5a6('0x7c')]=_0x2c14cc['TranscriptionJob']['TranscriptionJobStatus'];return _0x14261b(_0xf16899);})['catch'](function(_0x2e9841){return _0x296787(_0x2e9841);});});}exports[_0xa5a6('0x7d')]=function(_0x4395c1,_0x4e7b99,_0x34cfed){var _0x14e8ec;var _0x2d3efb;var _0x1664d6;var _0x142991=require('../../components/encryptor');return db['VoiceRecording'][_0xa5a6('0x7e')]({'where':{'id':_0x4395c1['params']['id']}})[_0xa5a6('0x42')](function(_0x4cfe7b){if(_0x4cfe7b){var _0x4c6a96=util[_0xa5a6('0x30')]('%s.cypher',_0x4cfe7b[_0xa5a6('0x50')]);if(fs[_0xa5a6('0x52')](_0x4c6a96)){cypher=!![];return _0x142991['decryptFile'](_0x4c6a96,_0x4cfe7b[_0xa5a6('0x50')],config[_0xa5a6('0x53')]['recording'])[_0xa5a6('0x42')](function(){return _0x4cfe7b;});}return _0x4cfe7b;}})[_0xa5a6('0x42')](function(_0x5282a4){if(!_0x5282a4){throw new db[(_0xa5a6('0x61'))][(_0xa5a6('0x62'))](_0xa5a6('0x7f'));}_0x2d3efb=_0x5282a4;return db[_0xa5a6('0x80')][_0xa5a6('0x7e')]({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x4e7b99,null))[_0xa5a6('0x42')](function(_0x3f3a25){if(_0x3f3a25){_0x14e8ec=_0x3f3a25;if(!_0x14e8ec[_0xa5a6('0x81')]||!_0x14e8ec[_0xa5a6('0x82')]||!_0x14e8ec[_0xa5a6('0x83')]||!_0x14e8ec[_0xa5a6('0x84')]||!_0x14e8ec[_0xa5a6('0x74')]){throw new db[(_0xa5a6('0x61'))]['ValidationError'](_0xa5a6('0x85'));}if(_0x4395c1[_0xa5a6('0x4b')][_0xa5a6('0x86')]&&(!_0x14e8ec[_0xa5a6('0x87')]||!_0x14e8ec[_0xa5a6('0x88')]||!_0x14e8ec['sentimentRegion']||!_0x14e8ec[_0xa5a6('0x84')]||!_0x14e8ec[_0xa5a6('0x74')])){throw new db['Sequelize'][(_0xa5a6('0x62'))](_0xa5a6('0x89'));}return db[_0xa5a6('0x8a')][_0xa5a6('0x7e')]({'where':{'id':_0x14e8ec['transcribeAccountId']}});}})[_0xa5a6('0x42')](function(_0x1d2054){if(!_0x1d2054){throw new db[(_0xa5a6('0x61'))]['ValidationError'](_0xa5a6('0x8b'));}if(!_0x1d2054[_0xa5a6('0x8c')]||!_0x1d2054[_0xa5a6('0x8d')]){throw new db[(_0xa5a6('0x61'))]['ValidationError'](_0xa5a6('0x8e'));}_0x1664d6=_0x1d2054;return getBucketslist(_0x1664d6[_0xa5a6('0x8c')],_0x1664d6[_0xa5a6('0x8d')],_0x14e8ec[_0xa5a6('0x83')]);})['then'](function(_0x37c953){if(_0x37c953&&_0x37c953[_0xa5a6('0x8f')]){var _0x99e5bf=_[_0xa5a6('0x4c')](_0x37c953['Buckets'],function(_0x130ba9){return _0x130ba9['Name']===_0x14e8ec[_0xa5a6('0x74')];});if(!_0x99e5bf){logger[_0xa5a6('0x67')](util['format'](_0xa5a6('0x90'),_0x4395c1[_0xa5a6('0x46')]['id'],_0x14e8ec[_0xa5a6('0x74')]));return createBucket(_0x1664d6[_0xa5a6('0x8c')],_0x1664d6[_0xa5a6('0x8d')],_0x14e8ec[_0xa5a6('0x83')],_0x14e8ec[_0xa5a6('0x74')]);}logger[_0xa5a6('0x67')](util[_0xa5a6('0x30')](_0xa5a6('0x91'),_0x4395c1[_0xa5a6('0x46')]['id'],_0x14e8ec[_0xa5a6('0x74')]));return;}})['then'](function(_0x52fce7){if(_0x2d3efb[_0xa5a6('0x7c')]==='NEW'){return transcribe(_0x4395c1[_0xa5a6('0x46')]['id'],_0x1664d6[_0xa5a6('0x8c')],_0x1664d6[_0xa5a6('0x8d')],_0x14e8ec[_0xa5a6('0x83')],_0x14e8ec['bucket'],_0x2d3efb[_0xa5a6('0x50')],_0x14e8ec[_0xa5a6('0x84')]);}else{logger['info'](util[_0xa5a6('0x30')](_0xa5a6('0x92'),_0x4395c1[_0xa5a6('0x46')]['id']));return{'transcribeStatus':'IN_PROGRESS'};}})[_0xa5a6('0x42')](function(_0x223a70){if(_0x223a70){_0x223a70[_0xa5a6('0x93')]=_0x4395c1['body'][_0xa5a6('0x86')];return _0x2d3efb[_0xa5a6('0x94')](_0x223a70);}})['then'](respondWithResult(_0x4e7b99,null))['catch'](handleError(_0x4e7b99,null));};function writeFile(_0x52293f,_0x6d8ed0){return new Promise(function(_0x466225,_0x4ac778){fs[_0xa5a6('0x95')](_0x6d8ed0,_0x52293f,function(_0x482d13,_0x185ba9){if(_0x482d13){return _0x4ac778(_0x482d13);}else{return _0x466225(_0x185ba9);}});});}exports[_0xa5a6('0x96')]=function(_0x694a5f,_0x38bacd,_0x29e470){return db[_0xa5a6('0x41')]['findOne']({'where':{'id':_0x694a5f['params']['id']}})[_0xa5a6('0x42')](handleEntityNotFound(_0x38bacd))[_0xa5a6('0x42')](function(_0x3fa0e9){if(_0x3fa0e9&&_0x3fa0e9[_0xa5a6('0x97')]){var _0x1ee2a8=_0x3fa0e9[_0xa5a6('0x97')];var _0x43644b=config[_0xa5a6('0x98')]+_0xa5a6('0x99')+_0x3fa0e9['id']+_0xa5a6('0x9a');if(fs[_0xa5a6('0x52')](_0x43644b)){return _0x43644b;}return writeFile(_0x1ee2a8,_0x43644b)[_0xa5a6('0x42')](function(){return _0x43644b;});}else{throw new db[(_0xa5a6('0x61'))][(_0xa5a6('0x62'))](_0xa5a6('0x9b'));}})[_0xa5a6('0x42')](function(_0x44cae8){return _0x38bacd[_0xa5a6('0x4e')](_0x44cae8);})[_0xa5a6('0x48')](handleError(_0x38bacd));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 6641304..262d48e 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 _0x2137=['VoiceRecording','uniqueid','transcribeStatus','./voiceRecording.attributes','exports'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x2137,0x134));var _0x7213=function(_0x4f1651,_0xc4ac4f){_0x4f1651=_0x4f1651-0x0;var _0x44868e=_0x2137[_0x4f1651];return _0x44868e;};'use strict';var attributes=require(_0x7213('0x0'));module[_0x7213('0x1')]=function(_0x23e0c8,_0x4d04cb){return _0x23e0c8['define'](_0x7213('0x2'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0x7213('0x3'),'fields':[_0x7213('0x3')]},{'name':_0x7213('0x4'),'fields':['transcribeStatus']}],'timestamps':!![]});}; \ No newline at end of file +var _0x8696=['exports','VoiceRecording','voice_recordings','uniqueid','transcribeStatus','./voiceRecording.attributes'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x8696,0x143));var _0x6869=function(_0x9fcb43,_0x44044b){_0x9fcb43=_0x9fcb43-0x0;var _0x415e45=_0x8696[_0x9fcb43];return _0x415e45;};'use strict';var attributes=require(_0x6869('0x0'));module[_0x6869('0x1')]=function(_0x55d9c2,_0xd349fb){return _0x55d9c2['define'](_0x6869('0x2'),attributes,{'tableName':_0x6869('0x3'),'paranoid':![],'indexes':[{'name':_0x6869('0x4'),'fields':['uniqueid']},{'name':_0x6869('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 01fd102..1052a78 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 _0xd117=['create','callRecordingEncryption','value','format','encryptFile','recording','unlink','CreateVoiceRecording','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','VoiceRecording,\x20%s,\x20%s','debug','stringify','code','error','message','request\x20sent','catch','VoiceRecording','body','options','raw','where','attributes','UpdateVoiceRecording','Setting','findOne','then'];(function(_0x1783b9,_0x4e2292){var _0x1a8eb0=function(_0x1e5c4d){while(--_0x1e5c4d){_0x1783b9['push'](_0x1783b9['shift']());}};_0x1a8eb0(++_0x4e2292);}(_0xd117,0x182));var _0x7d11=function(_0x132399,_0x1c4b0f){_0x132399=_0x132399-0x0;var _0x2a27e9=_0xd117[_0x132399];return _0x2a27e9;};'use strict';var _=require(_0x7d11('0x0'));var util=require(_0x7d11('0x1'));var moment=require(_0x7d11('0x2'));var BPromise=require(_0x7d11('0x3'));var rs=require(_0x7d11('0x4'));var fs=require('fs');var Redis=require(_0x7d11('0x5'));var db=require(_0x7d11('0x6'))['db'];var utils=require(_0x7d11('0x7'));var logger=require(_0x7d11('0x8'))(_0x7d11('0x9'));var config=require(_0x7d11('0xa'));var jayson=require(_0x7d11('0xb'));var client=jayson[_0x7d11('0xc')][_0x7d11('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x345602,_0x3c8d66,_0x47b5e6){return new BPromise(function(_0x3803b5,_0xffd020){return client[_0x7d11('0xe')](_0x345602,_0x47b5e6)['then'](function(_0x305eef){logger[_0x7d11('0xf')](_0x7d11('0x10'),_0x3c8d66,'request\x20sent');logger[_0x7d11('0x11')]('VoiceRecording,\x20%s,\x20%s,\x20%s',_0x3c8d66,'request\x20sent',JSON[_0x7d11('0x12')](_0x305eef));if(_0x305eef['error']){if(_0x305eef['error'][_0x7d11('0x13')]===0x1f4){logger['error'](_0x7d11('0x10'),_0x3c8d66,_0x305eef[_0x7d11('0x14')]['message']);return _0xffd020(_0x305eef[_0x7d11('0x14')][_0x7d11('0x15')]);}logger['error'](_0x7d11('0x10'),_0x3c8d66,_0x305eef[_0x7d11('0x14')][_0x7d11('0x15')]);return _0x3803b5(_0x305eef[_0x7d11('0x14')][_0x7d11('0x15')]);}else{logger[_0x7d11('0xf')](_0x7d11('0x10'),_0x3c8d66,_0x7d11('0x16'));_0x3803b5(_0x305eef['result'][_0x7d11('0x15')]);}})[_0x7d11('0x17')](function(_0x169733){logger[_0x7d11('0x14')](_0x7d11('0x10'),_0x3c8d66,_0x169733);_0xffd020(_0x169733);});});}exports['UpdateVoiceRecording']=function(_0x456cb9){var _0x49a34b=this;return new Promise(function(_0x4d1306,_0x5459df){return db[_0x7d11('0x18')]['update'](_0x456cb9[_0x7d11('0x19')],{'raw':_0x456cb9['options']?_0x456cb9[_0x7d11('0x1a')][_0x7d11('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x456cb9[_0x7d11('0x1a')]?_0x456cb9[_0x7d11('0x1a')][_0x7d11('0x1c')]||null:null,'attributes':_0x456cb9[_0x7d11('0x1a')]?_0x456cb9[_0x7d11('0x1a')][_0x7d11('0x1d')]||null:null,'limit':_0x456cb9['options']?_0x456cb9[_0x7d11('0x1a')]['limit']||null:null})['then'](function(_0x5c3898){logger[_0x7d11('0xf')](_0x7d11('0x1e'),_0x456cb9);logger[_0x7d11('0x11')](_0x7d11('0x1e'),_0x456cb9,JSON[_0x7d11('0x12')](_0x5c3898));_0x4d1306(_0x5c3898);})[_0x7d11('0x17')](function(_0x282e5c){logger[_0x7d11('0x14')]('UpdateVoiceRecording',_0x282e5c[_0x7d11('0x15')],_0x456cb9);_0x5459df(_0x49a34b['error'](0x1f4,_0x282e5c['message']));});});};exports['CreateVoiceRecording']=function(_0x3ba092){var _0x59cdba=this;return new Promise(function(_0x180e1e,_0x30e4c6){var _0x328ab7=require('../../components/encryptor');var _0x46f76a;return db[_0x7d11('0x1f')][_0x7d11('0x20')]({'attributes':['id','callRecordingEncryption'],'where':{'id':0x1},'raw':!![]})[_0x7d11('0x21')](function(_0x35a789){_0x46f76a=_0x35a789;return db[_0x7d11('0x18')][_0x7d11('0x22')](_0x3ba092['body']);})[_0x7d11('0x21')](function(_0x512f7f){if(_0x46f76a[_0x7d11('0x23')]&&fs['existsSync'](_0x512f7f[_0x7d11('0x24')])){var _0xba4e80=util[_0x7d11('0x25')]('%s.cypher',_0x512f7f['value']);return _0x328ab7[_0x7d11('0x26')](_0x512f7f[_0x7d11('0x24')],_0xba4e80,config['secrets'][_0x7d11('0x27')])[_0x7d11('0x21')](function(){fs[_0x7d11('0x28')](_0x512f7f['value']);logger[_0x7d11('0xf')]('CreateVoiceRecording\x20file\x20encrypted');return _0x512f7f;});}return _0x512f7f;})['then'](function(_0x3a88c9){logger['info'](_0x7d11('0x29'),_0x3ba092);logger[_0x7d11('0x11')](_0x7d11('0x29'),_0x3ba092,JSON[_0x7d11('0x12')](_0x3a88c9));_0x180e1e(_0x3a88c9);})['catch'](function(_0x11d9e2){logger[_0x7d11('0x14')]('CreateVoiceRecording',_0x11d9e2['message'],_0x3ba092);_0x30e4c6(_0x59cdba[_0x7d11('0x14')](0x1f4,_0x11d9e2[_0x7d11('0x15')]));});});}; \ No newline at end of file +var _0x7a54=['../../components/encryptor','Setting','findOne','callRecordingEncryption','create','value','format','encryptFile','secrets','unlink','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','VoiceRecording,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','VoiceRecording','update','body','options','raw','where','attributes','limit','then','UpdateVoiceRecording','CreateVoiceRecording'];(function(_0xa98302,_0x844f27){var _0x1ad8e3=function(_0x57e51d){while(--_0x57e51d){_0xa98302['push'](_0xa98302['shift']());}};_0x1ad8e3(++_0x844f27);}(_0x7a54,0x106));var _0x47a5=function(_0x3256d9,_0x2932dc){_0x3256d9=_0x3256d9-0x0;var _0x1cdb77=_0x7a54[_0x3256d9];return _0x1cdb77;};'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')]('VoiceRecording,\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['UpdateVoiceRecording']=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?!![]:![]:!![],'individualHooks':!![],'where':_0x5247fd['options']?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x1a')]||null:null,'attributes':_0x5247fd['options']?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x1b')]||null:null,'limit':_0x5247fd[_0x47a5('0x18')]?_0x5247fd['options'][_0x47a5('0x1c')]||null:null})[_0x47a5('0x1d')](function(_0x23db32){logger[_0x47a5('0xb')]('UpdateVoiceRecording',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON['stringify'](_0x23db32));_0xaf70a6(_0x23db32);})[_0x47a5('0x14')](function(_0xc4cd63){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0xc4cd63[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xc4cd63['message']));});});};exports[_0x47a5('0x1f')]=function(_0x5686db){var _0x1ea9c8=this;return new Promise(function(_0x5b6c4e,_0x23cb77){var _0x378208=require(_0x47a5('0x20'));var _0x1dac65;return db[_0x47a5('0x21')][_0x47a5('0x22')]({'attributes':['id',_0x47a5('0x23')],'where':{'id':0x1},'raw':!![]})[_0x47a5('0x1d')](function(_0x16631f){_0x1dac65=_0x16631f;return db[_0x47a5('0x15')][_0x47a5('0x24')](_0x5686db[_0x47a5('0x17')]);})[_0x47a5('0x1d')](function(_0x528582){if(_0x1dac65[_0x47a5('0x23')]&&fs['existsSync'](_0x528582[_0x47a5('0x25')])){var _0x9ac908=util[_0x47a5('0x26')]('%s.cypher',_0x528582[_0x47a5('0x25')]);return _0x378208[_0x47a5('0x27')](_0x528582[_0x47a5('0x25')],_0x9ac908,config[_0x47a5('0x28')]['recording'])['then'](function(){fs[_0x47a5('0x29')](_0x528582[_0x47a5('0x25')]);logger['info']('CreateVoiceRecording\x20file\x20encrypted');return _0x528582;});}return _0x528582;})[_0x47a5('0x1d')](function(_0x51544e){logger['info'](_0x47a5('0x1f'),_0x5686db);logger['debug'](_0x47a5('0x1f'),_0x5686db,JSON[_0x47a5('0xe')](_0x51544e));_0x5b6c4e(_0x51544e);})['catch'](function(_0x4843c0){logger[_0x47a5('0xf')]('CreateVoiceRecording',_0x4843c0[_0x47a5('0x11')],_0x5686db);_0x23cb77(_0x1ea9c8[_0x47a5('0xf')](0x1f4,_0x4843c0[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 1ee6c46..c0037ac 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 _0x14a7=['put','update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceTransferReport.controller','isAuthenticated','index','/describe','/:id','show','post','create'];(function(_0x41f442,_0x26bf7b){var _0x279f5b=function(_0x157195){while(--_0x157195){_0x41f442['push'](_0x41f442['shift']());}};_0x279f5b(++_0x26bf7b);}(_0x14a7,0xb9));var _0x714a=function(_0x367725,_0x1888d4){_0x367725=_0x367725-0x0;var _0x2526f6=_0x14a7[_0x367725];return _0x2526f6;};'use strict';var multer=require(_0x714a('0x0'));var util=require(_0x714a('0x1'));var path=require('path');var timeout=require(_0x714a('0x2'));var express=require(_0x714a('0x3'));var router=express['Router']();var fs_extra=require(_0x714a('0x4'));var auth=require(_0x714a('0x5'));var interaction=require(_0x714a('0x6'));var config=require('../../config/environment');var controller=require(_0x714a('0x7'));router['get']('/',auth[_0x714a('0x8')](),controller[_0x714a('0x9')]);router['get'](_0x714a('0xa'),auth[_0x714a('0x8')](),controller['describe']);router['get'](_0x714a('0xb'),auth[_0x714a('0x8')](),controller[_0x714a('0xc')]);router[_0x714a('0xd')]('/',auth['isAuthenticated'](),controller[_0x714a('0xe')]);router[_0x714a('0xf')](_0x714a('0xb'),auth[_0x714a('0x8')](),controller[_0x714a('0x10')]);router[_0x714a('0x11')](_0x714a('0xb'),auth['isAuthenticated'](),controller[_0x714a('0x12')]);module[_0x714a('0x13')]=router; \ No newline at end of file +var _0x1f38=['/describe','/:id','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get'];(function(_0xe8efd4,_0xc208d9){var _0x293f7f=function(_0x14c343){while(--_0x14c343){_0xe8efd4['push'](_0xe8efd4['shift']());}};_0x293f7f(++_0xc208d9);}(_0x1f38,0xd9));var _0x81f3=function(_0x5f139c,_0x34abe0){_0x5f139c=_0x5f139c-0x0;var _0xd3bd61=_0x1f38[_0x5f139c];return _0xd3bd61;};'use strict';var multer=require(_0x81f3('0x0'));var util=require(_0x81f3('0x1'));var path=require('path');var timeout=require(_0x81f3('0x2'));var express=require(_0x81f3('0x3'));var router=express[_0x81f3('0x4')]();var fs_extra=require(_0x81f3('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x81f3('0x6'));var config=require(_0x81f3('0x7'));var controller=require('./voiceTransferReport.controller');router['get']('/',auth[_0x81f3('0x8')](),controller[_0x81f3('0x9')]);router[_0x81f3('0xa')](_0x81f3('0xb'),auth[_0x81f3('0x8')](),controller['describe']);router[_0x81f3('0xa')](_0x81f3('0xc'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x81f3('0x8')](),controller[_0x81f3('0xd')]);router[_0x81f3('0xe')](_0x81f3('0xc'),auth[_0x81f3('0x8')](),controller[_0x81f3('0xf')]);router[_0x81f3('0x10')](_0x81f3('0xc'),auth[_0x81f3('0x8')](),controller[_0x81f3('0x11')]);module[_0x81f3('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 79df980..2cfa022 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 _0x2c6a=['moment','blind','attended','STRING','Yes','sequelize'];(function(_0x3d40fd,_0x510ac2){var _0x183773=function(_0x204c4d){while(--_0x204c4d){_0x3d40fd['push'](_0x3d40fd['shift']());}};_0x183773(++_0x510ac2);}(_0x2c6a,0x10d));var _0xa2c6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2c6a[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xa2c6('0x0'));var moment=require(_0xa2c6('0x1'));module['exports']={'type':{'type':Sequelize['ENUM'](_0xa2c6('0x2'),_0xa2c6('0x3'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize[_0xa2c6('0x4')]},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize[_0xa2c6('0x4')]},'transfereraccountcode':{'type':Sequelize[_0xa2c6('0x4')]},'transferercontext':{'type':Sequelize[_0xa2c6('0x4')]},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize[_0xa2c6('0x4')]},'transfereechannel':{'type':Sequelize[_0xa2c6('0x4')]},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize[_0xa2c6('0x4')]},'transfereeaccountcode':{'type':Sequelize[_0xa2c6('0x4')]},'transfereecontext':{'type':Sequelize[_0xa2c6('0x4')]},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize['ENUM'](_0xa2c6('0x5'),'No')},'context':{'type':Sequelize[_0xa2c6('0x4')]},'extension':{'type':Sequelize[_0xa2c6('0x4')]}}; \ No newline at end of file +var _0x4de7=['ENUM','blind','attended','STRING','Yes','sequelize','moment','exports'];(function(_0x1911ed,_0x4e8c73){var _0x11edaa=function(_0x216008){while(--_0x216008){_0x1911ed['push'](_0x1911ed['shift']());}};_0x11edaa(++_0x4e8c73);}(_0x4de7,0x185));var _0x74de=function(_0x3a2598,_0x1f28f1){_0x3a2598=_0x3a2598-0x0;var _0x10c427=_0x4de7[_0x3a2598];return _0x10c427;};'use strict';var Sequelize=require(_0x74de('0x0'));var moment=require(_0x74de('0x1'));module[_0x74de('0x2')]={'type':{'type':Sequelize[_0x74de('0x3')](_0x74de('0x4'),_0x74de('0x5'))},'result':{'type':Sequelize[_0x74de('0x6')]},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize[_0x74de('0x6')]},'transfererconnectedlinenum':{'type':Sequelize[_0x74de('0x6')]},'transfererconnectedlinename':{'type':Sequelize[_0x74de('0x6')]},'transfereraccountcode':{'type':Sequelize[_0x74de('0x6')]},'transferercontext':{'type':Sequelize[_0x74de('0x6')]},'transfererexten':{'type':Sequelize[_0x74de('0x6')]},'transfererlinkedid':{'type':Sequelize[_0x74de('0x6')]},'transfereechannel':{'type':Sequelize[_0x74de('0x6')]},'transfereecalleridnum':{'type':Sequelize[_0x74de('0x6')]},'transfereecalleridname':{'type':Sequelize[_0x74de('0x6')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x74de('0x6')]},'transfereeconnectedlinename':{'type':Sequelize[_0x74de('0x6')]},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0x74de('0x6')]},'transfereeexten':{'type':Sequelize[_0x74de('0x6')]},'transfereelinkedid':{'type':Sequelize[_0x74de('0x6')]},'isexternal':{'type':Sequelize[_0x74de('0x3')](_0x74de('0x7'),'No')},'context':{'type':Sequelize[_0x74de('0x6')]},'extension':{'type':Sequelize[_0x74de('0x6')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index eb5f2ee..66ca2ea 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 _0x324b=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','then','sendStatus','error','name','send','map','VoiceTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','nolimit','order','sort','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','destroy','describe','eml-format','zip-dir','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','squel','crypto','querystring'];(function(_0x1b96ee,_0x32ffef){var _0x1aef42=function(_0x62d6e0){while(--_0x62d6e0){_0x1b96ee['push'](_0x1b96ee['shift']());}};_0x1aef42(++_0x32ffef);}(_0x324b,0xd4));var _0xb324=function(_0x4628c3,_0x5d4f80){_0x4628c3=_0x4628c3-0x0;var _0x50cb34=_0x324b[_0x4628c3];return _0x50cb34;};'use strict';var emlformat=require(_0xb324('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb324('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb324('0x2'));var moment=require(_0xb324('0x3'));var BPromise=require(_0xb324('0x4'));var Mustache=require(_0xb324('0x5'));var util=require('util');var path=require('path');var sox=require(_0xb324('0x6'));var csv=require(_0xb324('0x7'));var ejs=require(_0xb324('0x8'));var fs=require('fs');var fs_extra=require(_0xb324('0x9'));var _=require('lodash');var squel=require(_0xb324('0xa'));var crypto=require(_0xb324('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb324('0x7'));var querystring=require(_0xb324('0xc'));var Papa=require(_0xb324('0xd'));var Redis=require(_0xb324('0xe'));var authService=require(_0xb324('0xf'));var qs=require(_0xb324('0x10'));var as=require(_0xb324('0x11'));var hardwareService=require(_0xb324('0x12'));var logger=require('../../config/logger')(_0xb324('0x13'));var utils=require(_0xb324('0x14'));var config=require(_0xb324('0x15'));var licenseUtil=require(_0xb324('0x16'));var db=require(_0xb324('0x17'))['db'];function respondWithStatusCode(_0x303cc4,_0xf9f15a){_0xf9f15a=_0xf9f15a||0xcc;return function(_0x252da6){if(_0x252da6){return _0x303cc4['sendStatus'](_0xf9f15a);}return _0x303cc4[_0xb324('0x18')](_0xf9f15a)[_0xb324('0x19')]();};}function respondWithResult(_0x414a09,_0x213d49){_0x213d49=_0x213d49||0xc8;return function(_0x11da27){if(_0x11da27){return _0x414a09['status'](_0x213d49)['json'](_0x11da27);}};}function respondWithFilteredResult(_0x28ae28,_0xefbc53){return function(_0x423b4e){if(_0x423b4e){var _0x47d9d1=typeof _0xefbc53[_0xb324('0x1a')]===_0xb324('0x1b')&&typeof _0xefbc53['limit']===_0xb324('0x1b');var _0x25529e=_0x423b4e[_0xb324('0x1c')];var _0x58dd0=_0x47d9d1?0x0:_0xefbc53[_0xb324('0x1a')];var _0x464b4f=_0x47d9d1?_0x423b4e[_0xb324('0x1c')]:_0xefbc53[_0xb324('0x1a')]+_0xefbc53[_0xb324('0x1d')];var _0x4485f0;if(_0x464b4f>=_0x25529e){_0x464b4f=_0x25529e;_0x4485f0=0xc8;}else{_0x4485f0=0xce;}_0x28ae28[_0xb324('0x18')](_0x4485f0);return _0x28ae28[_0xb324('0x1e')](_0xb324('0x1f'),_0x58dd0+'-'+_0x464b4f+'/'+_0x25529e)[_0xb324('0x20')](_0x423b4e);}return null;};}function patchUpdates(_0xde9870){return function(_0x2b8070){try{jsonpatch[_0xb324('0x21')](_0x2b8070,_0xde9870,!![]);}catch(_0x4bd8fb){return BPromise[_0xb324('0x22')](_0x4bd8fb);}return _0x2b8070[_0xb324('0x23')]();};}function saveUpdates(_0x38cc05,_0x671c79){return function(_0x3089e0){if(_0x3089e0){return _0x3089e0[_0xb324('0x24')](_0x38cc05)[_0xb324('0x25')](function(_0x65948d){return _0x65948d;});}return null;};}function removeEntity(_0x36c3e7,_0x5008da){return function(_0x3e15ea){if(_0x3e15ea){return _0x3e15ea['destroy']()[_0xb324('0x25')](function(){_0x36c3e7[_0xb324('0x18')](0xcc)[_0xb324('0x19')]();});}};}function handleEntityNotFound(_0x185669,_0x252d33){return function(_0x11862f){if(!_0x11862f){_0x185669[_0xb324('0x26')](0x194);}return _0x11862f;};}function handleError(_0x398600,_0x15ced9){_0x15ced9=_0x15ced9||0x1f4;return function(_0x5522a5){logger[_0xb324('0x27')](_0x5522a5['stack']);if(_0x5522a5[_0xb324('0x28')]){delete _0x5522a5[_0xb324('0x28')];}_0x398600[_0xb324('0x18')](_0x15ced9)[_0xb324('0x29')](_0x5522a5);};}exports['index']=function(_0x10fc43,_0x3c653f){var _0x12100d={},_0x5d15b6={},_0x47b8b1={'count':0x0,'rows':[]};var _0x53ffea=_[_0xb324('0x2a')](db[_0xb324('0x2b')][_0xb324('0x2c')],function(_0x2c4501){return{'name':_0x2c4501[_0xb324('0x2d')],'type':_0x2c4501[_0xb324('0x2e')][_0xb324('0x2f')]};});_0x5d15b6[_0xb324('0x30')]=_[_0xb324('0x2a')](_0x53ffea,_0xb324('0x28'));_0x5d15b6[_0xb324('0x31')]=_[_0xb324('0x32')](_0x10fc43[_0xb324('0x31')]);_0x5d15b6[_0xb324('0x33')]=_['intersection'](_0x5d15b6['model'],_0x5d15b6[_0xb324('0x31')]);_0x12100d[_0xb324('0x34')]=_['intersection'](_0x5d15b6['model'],qs[_0xb324('0x35')](_0x10fc43[_0xb324('0x31')]['fields']));_0x12100d[_0xb324('0x34')]=_0x12100d[_0xb324('0x34')][_0xb324('0x36')]?_0x12100d[_0xb324('0x34')]:_0x5d15b6['model'];if(!_0x10fc43[_0xb324('0x31')]['hasOwnProperty'](_0xb324('0x37'))){_0x12100d[_0xb324('0x1d')]=qs['limit'](_0x10fc43[_0xb324('0x31')]['limit']);_0x12100d[_0xb324('0x1a')]=qs[_0xb324('0x1a')](_0x10fc43[_0xb324('0x31')][_0xb324('0x1a')]);}_0x12100d[_0xb324('0x38')]=qs['sort'](_0x10fc43[_0xb324('0x31')][_0xb324('0x39')]);_0x12100d['where']=qs['filters'](_['pick'](_0x10fc43['query'],_0x5d15b6[_0xb324('0x33')]),_0x53ffea);if(_0x10fc43[_0xb324('0x31')][_0xb324('0x3a')]){_0x12100d['where']=_['merge'](_0x12100d[_0xb324('0x3b')],{'$or':_[_0xb324('0x2a')](_0x53ffea,function(_0x10736f){if(_0x10736f['type']!==_0xb324('0x3c')){var _0x337af1={};_0x337af1[_0x10736f['name']]={'$like':'%'+_0x10fc43[_0xb324('0x31')]['filter']+'%'};return _0x337af1;}})});}_0x12100d=_[_0xb324('0x3d')]({},_0x12100d,_0x10fc43[_0xb324('0x3e')]);var _0x3cd99b={'where':_0x12100d[_0xb324('0x3b')]};return db['VoiceTransferReport'][_0xb324('0x1c')](_0x3cd99b)[_0xb324('0x25')](function(_0xf6a09a){_0x47b8b1[_0xb324('0x1c')]=_0xf6a09a;if(_0x10fc43[_0xb324('0x31')][_0xb324('0x3f')]){_0x12100d[_0xb324('0x40')]=[{'all':!![]}];}return db['VoiceTransferReport'][_0xb324('0x41')](_0x12100d);})['then'](function(_0x303f86){_0x47b8b1[_0xb324('0x42')]=_0x303f86;return _0x47b8b1;})[_0xb324('0x25')](respondWithFilteredResult(_0x3c653f,_0x12100d))['catch'](handleError(_0x3c653f,null));};exports[_0xb324('0x43')]=function(_0x3127be,_0x14ede7){var _0x268776={'raw':!![],'where':{'id':_0x3127be[_0xb324('0x44')]['id']}},_0x4762de={};_0x4762de['model']=_[_0xb324('0x32')](db['VoiceTransferReport'][_0xb324('0x2c')]);_0x4762de['query']=_[_0xb324('0x32')](_0x3127be[_0xb324('0x31')]);_0x4762de[_0xb324('0x33')]=_['intersection'](_0x4762de[_0xb324('0x30')],_0x4762de['query']);_0x268776[_0xb324('0x34')]=_['intersection'](_0x4762de[_0xb324('0x30')],qs[_0xb324('0x35')](_0x3127be[_0xb324('0x31')][_0xb324('0x35')]));_0x268776[_0xb324('0x34')]=_0x268776[_0xb324('0x34')]['length']?_0x268776[_0xb324('0x34')]:_0x4762de['model'];if(_0x3127be[_0xb324('0x31')][_0xb324('0x3f')]){_0x268776[_0xb324('0x40')]=[{'all':!![]}];}_0x268776=_[_0xb324('0x3d')]({},_0x268776,_0x3127be['options']);return db['VoiceTransferReport'][_0xb324('0x45')](_0x268776)[_0xb324('0x25')](handleEntityNotFound(_0x14ede7,null))[_0xb324('0x25')](respondWithResult(_0x14ede7,null))[_0xb324('0x46')](handleError(_0x14ede7,null));};exports[_0xb324('0x47')]=function(_0x229a48,_0x1173f1){return db[_0xb324('0x2b')][_0xb324('0x47')](_0x229a48[_0xb324('0x48')],{})['then'](respondWithResult(_0x1173f1,0xc9))[_0xb324('0x46')](handleError(_0x1173f1,null));};exports['update']=function(_0x2adf0f,_0xd2e9af){if(_0x2adf0f[_0xb324('0x48')]['id']){delete _0x2adf0f[_0xb324('0x48')]['id'];}return db['VoiceTransferReport'][_0xb324('0x45')]({'where':{'id':_0x2adf0f[_0xb324('0x44')]['id']}})[_0xb324('0x25')](handleEntityNotFound(_0xd2e9af,null))[_0xb324('0x25')](saveUpdates(_0x2adf0f['body'],null))['then'](respondWithResult(_0xd2e9af,null))[_0xb324('0x46')](handleError(_0xd2e9af,null));};exports[_0xb324('0x49')]=function(_0x5877ce,_0x188ea3){return db[_0xb324('0x2b')]['find']({'where':{'id':_0x5877ce[_0xb324('0x44')]['id']}})[_0xb324('0x25')](handleEntityNotFound(_0x188ea3,null))[_0xb324('0x25')](removeEntity(_0x188ea3,null))[_0xb324('0x46')](handleError(_0x188ea3,null));};exports[_0xb324('0x4a')]=function(_0x45d4b5,_0x515a40){return db['VoiceTransferReport'][_0xb324('0x4a')]()[_0xb324('0x25')](respondWithResult(_0x515a40,null))[_0xb324('0x46')](handleError(_0x515a40,null));}; \ No newline at end of file +var _0xf82b=['error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','includeAll','include','findAll','catch','show','keys','VoiceTransferReport','length','create','body','update','destroy','params','describe','eml-format','zip-dir','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','reject','save','then','end'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0xf82b,0x1e2));var _0xbf82=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xf82b[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0xbf82('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbf82('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbf82('0x2'));var moment=require(_0xbf82('0x3'));var BPromise=require(_0xbf82('0x4'));var Mustache=require(_0xbf82('0x5'));var util=require('util');var path=require('path');var sox=require(_0xbf82('0x6'));var csv=require(_0xbf82('0x7'));var ejs=require(_0xbf82('0x8'));var fs=require('fs');var fs_extra=require(_0xbf82('0x9'));var _=require(_0xbf82('0xa'));var squel=require(_0xbf82('0xb'));var crypto=require(_0xbf82('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xbf82('0xd'));var toCsv=require(_0xbf82('0x7'));var querystring=require(_0xbf82('0xe'));var Papa=require(_0xbf82('0xf'));var Redis=require(_0xbf82('0x10'));var authService=require(_0xbf82('0x11'));var qs=require(_0xbf82('0x12'));var as=require(_0xbf82('0x13'));var hardwareService=require(_0xbf82('0x14'));var logger=require(_0xbf82('0x15'))(_0xbf82('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xbf82('0x17'))['db'];function respondWithStatusCode(_0x1ec693,_0x417a9c){_0x417a9c=_0x417a9c||0xcc;return function(_0x4da181){if(_0x4da181){return _0x1ec693[_0xbf82('0x18')](_0x417a9c);}return _0x1ec693[_0xbf82('0x19')](_0x417a9c)['end']();};}function respondWithResult(_0x3e781,_0x2de64a){_0x2de64a=_0x2de64a||0xc8;return function(_0x52dfcc){if(_0x52dfcc){return _0x3e781[_0xbf82('0x19')](_0x2de64a)[_0xbf82('0x1a')](_0x52dfcc);}};}function respondWithFilteredResult(_0x2bbf3b,_0x1bf1a1){return function(_0xbe9acd){if(_0xbe9acd){var _0x2e4f65=typeof _0x1bf1a1[_0xbf82('0x1b')]===_0xbf82('0x1c')&&typeof _0x1bf1a1[_0xbf82('0x1d')]==='undefined';var _0x2aa160=_0xbe9acd[_0xbf82('0x1e')];var _0x4ce8e2=_0x2e4f65?0x0:_0x1bf1a1[_0xbf82('0x1b')];var _0x5b9a84=_0x2e4f65?_0xbe9acd[_0xbf82('0x1e')]:_0x1bf1a1['offset']+_0x1bf1a1[_0xbf82('0x1d')];var _0x5e28ce;if(_0x5b9a84>=_0x2aa160){_0x5b9a84=_0x2aa160;_0x5e28ce=0xc8;}else{_0x5e28ce=0xce;}_0x2bbf3b[_0xbf82('0x19')](_0x5e28ce);return _0x2bbf3b[_0xbf82('0x1f')]('Content-Range',_0x4ce8e2+'-'+_0x5b9a84+'/'+_0x2aa160)[_0xbf82('0x1a')](_0xbe9acd);}return null;};}function patchUpdates(_0x47c387){return function(_0x31b282){try{jsonpatch['apply'](_0x31b282,_0x47c387,!![]);}catch(_0x496880){return BPromise[_0xbf82('0x20')](_0x496880);}return _0x31b282[_0xbf82('0x21')]();};}function saveUpdates(_0x132bed,_0x10893d){return function(_0x888b28){if(_0x888b28){return _0x888b28['update'](_0x132bed)[_0xbf82('0x22')](function(_0xe4f278){return _0xe4f278;});}return null;};}function removeEntity(_0x2ef579,_0x14e47c){return function(_0xcfc5bd){if(_0xcfc5bd){return _0xcfc5bd['destroy']()['then'](function(){_0x2ef579[_0xbf82('0x19')](0xcc)[_0xbf82('0x23')]();});}};}function handleEntityNotFound(_0x3063dd,_0x56e984){return function(_0x571119){if(!_0x571119){_0x3063dd['sendStatus'](0x194);}return _0x571119;};}function handleError(_0xe7211f,_0x29a69d){_0x29a69d=_0x29a69d||0x1f4;return function(_0x483d48){logger[_0xbf82('0x24')](_0x483d48['stack']);if(_0x483d48['name']){delete _0x483d48[_0xbf82('0x25')];}_0xe7211f[_0xbf82('0x19')](_0x29a69d)[_0xbf82('0x26')](_0x483d48);};}exports[_0xbf82('0x27')]=function(_0x22fd1f,_0x995052){var _0x144634={},_0x24ba0f={},_0x51d808={'count':0x0,'rows':[]};var _0x221034=_[_0xbf82('0x28')](db['VoiceTransferReport'][_0xbf82('0x29')],function(_0x554dec){return{'name':_0x554dec[_0xbf82('0x2a')],'type':_0x554dec[_0xbf82('0x2b')][_0xbf82('0x2c')]};});_0x24ba0f[_0xbf82('0x2d')]=_[_0xbf82('0x28')](_0x221034,_0xbf82('0x25'));_0x24ba0f[_0xbf82('0x2e')]=_['keys'](_0x22fd1f['query']);_0x24ba0f[_0xbf82('0x2f')]=_[_0xbf82('0x30')](_0x24ba0f[_0xbf82('0x2d')],_0x24ba0f['query']);_0x144634['attributes']=_[_0xbf82('0x30')](_0x24ba0f[_0xbf82('0x2d')],qs[_0xbf82('0x31')](_0x22fd1f[_0xbf82('0x2e')][_0xbf82('0x31')]));_0x144634['attributes']=_0x144634[_0xbf82('0x32')]['length']?_0x144634[_0xbf82('0x32')]:_0x24ba0f[_0xbf82('0x2d')];if(!_0x22fd1f[_0xbf82('0x2e')][_0xbf82('0x33')](_0xbf82('0x34'))){_0x144634[_0xbf82('0x1d')]=qs[_0xbf82('0x1d')](_0x22fd1f[_0xbf82('0x2e')][_0xbf82('0x1d')]);_0x144634[_0xbf82('0x1b')]=qs[_0xbf82('0x1b')](_0x22fd1f[_0xbf82('0x2e')][_0xbf82('0x1b')]);}_0x144634[_0xbf82('0x35')]=qs[_0xbf82('0x36')](_0x22fd1f[_0xbf82('0x2e')][_0xbf82('0x36')]);_0x144634[_0xbf82('0x37')]=qs[_0xbf82('0x2f')](_[_0xbf82('0x38')](_0x22fd1f[_0xbf82('0x2e')],_0x24ba0f[_0xbf82('0x2f')]),_0x221034);if(_0x22fd1f[_0xbf82('0x2e')]['filter']){_0x144634[_0xbf82('0x37')]=_[_0xbf82('0x39')](_0x144634['where'],{'$or':_[_0xbf82('0x28')](_0x221034,function(_0x112fd7){if(_0x112fd7[_0xbf82('0x2b')]!=='VIRTUAL'){var _0x4e6b56={};_0x4e6b56[_0x112fd7[_0xbf82('0x25')]]={'$like':'%'+_0x22fd1f[_0xbf82('0x2e')][_0xbf82('0x3a')]+'%'};return _0x4e6b56;}})});}_0x144634=_[_0xbf82('0x39')]({},_0x144634,_0x22fd1f[_0xbf82('0x3b')]);var _0x514d4b={'where':_0x144634['where']};return db['VoiceTransferReport'][_0xbf82('0x1e')](_0x514d4b)[_0xbf82('0x22')](function(_0x4ee70b){_0x51d808[_0xbf82('0x1e')]=_0x4ee70b;if(_0x22fd1f[_0xbf82('0x2e')][_0xbf82('0x3c')]){_0x144634[_0xbf82('0x3d')]=[{'all':!![]}];}return db['VoiceTransferReport'][_0xbf82('0x3e')](_0x144634);})[_0xbf82('0x22')](function(_0x2dbad8){_0x51d808['rows']=_0x2dbad8;return _0x51d808;})[_0xbf82('0x22')](respondWithFilteredResult(_0x995052,_0x144634))[_0xbf82('0x3f')](handleError(_0x995052,null));};exports[_0xbf82('0x40')]=function(_0x142028,_0x753755){var _0x7384e7={'raw':!![],'where':{'id':_0x142028['params']['id']}},_0x249cfc={};_0x249cfc['model']=_[_0xbf82('0x41')](db[_0xbf82('0x42')][_0xbf82('0x29')]);_0x249cfc[_0xbf82('0x2e')]=_[_0xbf82('0x41')](_0x142028[_0xbf82('0x2e')]);_0x249cfc[_0xbf82('0x2f')]=_[_0xbf82('0x30')](_0x249cfc[_0xbf82('0x2d')],_0x249cfc[_0xbf82('0x2e')]);_0x7384e7['attributes']=_[_0xbf82('0x30')](_0x249cfc[_0xbf82('0x2d')],qs[_0xbf82('0x31')](_0x142028[_0xbf82('0x2e')][_0xbf82('0x31')]));_0x7384e7[_0xbf82('0x32')]=_0x7384e7[_0xbf82('0x32')][_0xbf82('0x43')]?_0x7384e7[_0xbf82('0x32')]:_0x249cfc['model'];if(_0x142028['query'][_0xbf82('0x3c')]){_0x7384e7[_0xbf82('0x3d')]=[{'all':!![]}];}_0x7384e7=_['merge']({},_0x7384e7,_0x142028['options']);return db[_0xbf82('0x42')]['find'](_0x7384e7)[_0xbf82('0x22')](handleEntityNotFound(_0x753755,null))['then'](respondWithResult(_0x753755,null))[_0xbf82('0x3f')](handleError(_0x753755,null));};exports[_0xbf82('0x44')]=function(_0x1a863c,_0x11d608){return db[_0xbf82('0x42')]['create'](_0x1a863c[_0xbf82('0x45')],{})[_0xbf82('0x22')](respondWithResult(_0x11d608,0xc9))[_0xbf82('0x3f')](handleError(_0x11d608,null));};exports[_0xbf82('0x46')]=function(_0x399209,_0x58c8ab){if(_0x399209[_0xbf82('0x45')]['id']){delete _0x399209['body']['id'];}return db['VoiceTransferReport']['find']({'where':{'id':_0x399209['params']['id']}})[_0xbf82('0x22')](handleEntityNotFound(_0x58c8ab,null))[_0xbf82('0x22')](saveUpdates(_0x399209[_0xbf82('0x45')],null))[_0xbf82('0x22')](respondWithResult(_0x58c8ab,null))[_0xbf82('0x3f')](handleError(_0x58c8ab,null));};exports[_0xbf82('0x47')]=function(_0x3caf76,_0x4c0813){return db[_0xbf82('0x42')]['find']({'where':{'id':_0x3caf76[_0xbf82('0x48')]['id']}})[_0xbf82('0x22')](handleEntityNotFound(_0x4c0813,null))[_0xbf82('0x22')](removeEntity(_0x4c0813,null))[_0xbf82('0x3f')](handleError(_0x4c0813,null));};exports[_0xbf82('0x49')]=function(_0x4c473e,_0x43b75b){return db[_0xbf82('0x42')]['describe']()[_0xbf82('0x22')](respondWithResult(_0x43b75b,null))[_0xbf82('0x3f')](handleError(_0x43b75b,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 23e690f..2b9ed17 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 _0x9aff=['request-promise','path','rimraf','../../config/environment','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','util','../../config/logger','api','moment','bluebird'];(function(_0x181451,_0x1331d1){var _0x165333=function(_0x1bdb3f){while(--_0x1bdb3f){_0x181451['push'](_0x181451['shift']());}};_0x165333(++_0x1331d1);}(_0x9aff,0x1e9));var _0xf9af=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0x9aff[_0x4f9b18];return _0x29f20c;};'use strict';var _=require('lodash');var util=require(_0xf9af('0x0'));var logger=require(_0xf9af('0x1'))(_0xf9af('0x2'));var moment=require(_0xf9af('0x3'));var BPromise=require(_0xf9af('0x4'));var rp=require(_0xf9af('0x5'));var fs=require('fs');var path=require(_0xf9af('0x6'));var rimraf=require(_0xf9af('0x7'));var config=require(_0xf9af('0x8'));var attributes=require(_0xf9af('0x9'));module[_0xf9af('0xa')]=function(_0x3b3c57,_0x10fdfd){return _0x3b3c57[_0xf9af('0xb')](_0xf9af('0xc'),attributes,{'tableName':'report_call_transfer','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd207=['exports','define','VoiceTransferReport','report_call_transfer','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment'];(function(_0x22b6f6,_0x2997cc){var _0xb99e6=function(_0x1eb465){while(--_0x1eb465){_0x22b6f6['push'](_0x22b6f6['shift']());}};_0xb99e6(++_0x2997cc);}(_0xd207,0x190));var _0x7d20=function(_0x2e069e,_0x1ab25d){_0x2e069e=_0x2e069e-0x0;var _0xa3fa6a=_0xd207[_0x2e069e];return _0xa3fa6a;};'use strict';var _=require(_0x7d20('0x0'));var util=require(_0x7d20('0x1'));var logger=require(_0x7d20('0x2'))(_0x7d20('0x3'));var moment=require(_0x7d20('0x4'));var BPromise=require(_0x7d20('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7d20('0x6'));var rimraf=require('rimraf');var config=require(_0x7d20('0x7'));var attributes=require('./voiceTransferReport.attributes');module[_0x7d20('0x8')]=function(_0x1a47b5,_0x437cb1){return _0x1a47b5[_0x7d20('0x9')](_0x7d20('0xa'),attributes,{'tableName':_0x7d20('0xb'),'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 823afe0..638b8af 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 _0xeeba=['catch','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','raw','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceTransferReport,\x20%s,\x20%s','info','result'];(function(_0x4b0c64,_0x318daa){var _0x3c5ebd=function(_0x56ea3d){while(--_0x56ea3d){_0x4b0c64['push'](_0x4b0c64['shift']());}};_0x3c5ebd(++_0x318daa);}(_0xeeba,0x133));var _0xaeeb=function(_0x31e4a4,_0x1e2141){_0x31e4a4=_0x31e4a4-0x0;var _0x4d3277=_0xeeba[_0x31e4a4];return _0x4d3277;};'use strict';var _=require(_0xaeeb('0x0'));var util=require('util');var moment=require(_0xaeeb('0x1'));var BPromise=require(_0xaeeb('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaeeb('0x3'));var db=require(_0xaeeb('0x4'))['db'];var utils=require(_0xaeeb('0x5'));var logger=require('../../config/logger')(_0xaeeb('0x6'));var config=require(_0xaeeb('0x7'));var jayson=require(_0xaeeb('0x8'));var client=jayson[_0xaeeb('0x9')][_0xaeeb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xa8ef15,_0x5da60f,_0x37c98a){return new BPromise(function(_0x4713aa,_0x2cadf7){return client[_0xaeeb('0xb')](_0xa8ef15,_0x37c98a)[_0xaeeb('0xc')](function(_0x487640){logger['info']('VoiceTransferReport,\x20%s,\x20%s',_0x5da60f,_0xaeeb('0xd'));logger[_0xaeeb('0xe')](_0xaeeb('0xf'),_0x5da60f,_0xaeeb('0xd'),JSON[_0xaeeb('0x10')](_0x487640));if(_0x487640[_0xaeeb('0x11')]){if(_0x487640[_0xaeeb('0x11')][_0xaeeb('0x12')]===0x1f4){logger['error']('VoiceTransferReport,\x20%s,\x20%s',_0x5da60f,_0x487640['error'][_0xaeeb('0x13')]);return _0x2cadf7(_0x487640['error'][_0xaeeb('0x13')]);}logger[_0xaeeb('0x11')](_0xaeeb('0x14'),_0x5da60f,_0x487640[_0xaeeb('0x11')]['message']);return _0x4713aa(_0x487640['error'][_0xaeeb('0x13')]);}else{logger[_0xaeeb('0x15')]('VoiceTransferReport,\x20%s,\x20%s',_0x5da60f,_0xaeeb('0xd'));_0x4713aa(_0x487640[_0xaeeb('0x16')][_0xaeeb('0x13')]);}})[_0xaeeb('0x17')](function(_0x5e0c44){logger[_0xaeeb('0x11')](_0xaeeb('0x14'),_0x5da60f,_0x5e0c44);_0x2cadf7(_0x5e0c44);});});}exports[_0xaeeb('0x18')]=function(_0x4aa762){var _0x3a7637=this;return new Promise(function(_0x49f4e3,_0x5bc4dc){return db[_0xaeeb('0x19')][_0xaeeb('0x1a')](_0x4aa762[_0xaeeb('0x1b')],{'raw':_0x4aa762[_0xaeeb('0x1c')]?_0x4aa762[_0xaeeb('0x1c')][_0xaeeb('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x470512){logger['info']('CreateVoiceTransferReport',_0x4aa762);logger[_0xaeeb('0xe')](_0xaeeb('0x18'),_0x4aa762,JSON[_0xaeeb('0x10')](_0x470512));_0x49f4e3(_0x470512);})[_0xaeeb('0x17')](function(_0x132654){logger['error'](_0xaeeb('0x18'),_0x132654[_0xaeeb('0x13')],_0x4aa762);_0x5bc4dc(_0x3a7637[_0xaeeb('0x11')](0x1f4,_0x132654['message']));});});}; \ No newline at end of file +var _0xa18f=['client','http','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise'];(function(_0x12eca8,_0x1d71d5){var _0x294a5f=function(_0x3e1d95){while(--_0x3e1d95){_0x12eca8['push'](_0x12eca8['shift']());}};_0x294a5f(++_0x1d71d5);}(_0xa18f,0x198));var _0xfa18=function(_0x3aa1e7,_0x443a08){_0x3aa1e7=_0x3aa1e7-0x0;var _0x3065b6=_0xa18f[_0x3aa1e7];return _0x3065b6;};'use strict';var _=require(_0xfa18('0x0'));var util=require(_0xfa18('0x1'));var moment=require(_0xfa18('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfa18('0x3'));var db=require(_0xfa18('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xfa18('0x5'))('rpc');var config=require(_0xfa18('0x6'));var jayson=require(_0xfa18('0x7'));var client=jayson[_0xfa18('0x8')][_0xfa18('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4d783a,_0x38d2c2,_0xd3bc34){return new BPromise(function(_0x423607,_0x50fc11){return client['request'](_0x4d783a,_0xd3bc34)[_0xfa18('0xa')](function(_0x3f9ff0){logger[_0xfa18('0xb')](_0xfa18('0xc'),_0x38d2c2,_0xfa18('0xd'));logger[_0xfa18('0xe')]('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x38d2c2,_0xfa18('0xd'),JSON[_0xfa18('0xf')](_0x3f9ff0));if(_0x3f9ff0[_0xfa18('0x10')]){if(_0x3f9ff0[_0xfa18('0x10')][_0xfa18('0x11')]===0x1f4){logger[_0xfa18('0x10')](_0xfa18('0xc'),_0x38d2c2,_0x3f9ff0[_0xfa18('0x10')][_0xfa18('0x12')]);return _0x50fc11(_0x3f9ff0[_0xfa18('0x10')][_0xfa18('0x12')]);}logger[_0xfa18('0x10')]('VoiceTransferReport,\x20%s,\x20%s',_0x38d2c2,_0x3f9ff0['error']['message']);return _0x423607(_0x3f9ff0[_0xfa18('0x10')][_0xfa18('0x12')]);}else{logger[_0xfa18('0xb')]('VoiceTransferReport,\x20%s,\x20%s',_0x38d2c2,_0xfa18('0xd'));_0x423607(_0x3f9ff0[_0xfa18('0x13')][_0xfa18('0x12')]);}})['catch'](function(_0x584fa3){logger[_0xfa18('0x10')](_0xfa18('0xc'),_0x38d2c2,_0x584fa3);_0x50fc11(_0x584fa3);});});}exports[_0xfa18('0x14')]=function(_0x3fdf05){var _0x4dd0e4=this;return new Promise(function(_0x33c7b4,_0x3268fe){return db[_0xfa18('0x15')][_0xfa18('0x16')](_0x3fdf05[_0xfa18('0x17')],{'raw':_0x3fdf05[_0xfa18('0x18')]?_0x3fdf05[_0xfa18('0x18')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x43a7dd){logger['info'](_0xfa18('0x14'),_0x3fdf05);logger[_0xfa18('0xe')](_0xfa18('0x14'),_0x3fdf05,JSON[_0xfa18('0xf')](_0x43a7dd));_0x33c7b4(_0x43a7dd);})[_0xfa18('0x19')](function(_0x3e08e3){logger[_0xfa18('0x10')](_0xfa18('0x14'),_0x3e08e3['message'],_0x3fdf05);_0x3268fe(_0x4dd0e4[_0xfa18('0x10')](0x1f4,_0x3e08e3[_0xfa18('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 63017df..95dad0e 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 _0xdace=['unhold','calls','/transfer','transfer','exports','express','../../components/auth/service','./webbar.controller','post','isAuthenticated','isWebrtcLicence','originate','hangup','/answer','/hold','/unhold'];(function(_0x5741c6,_0x46ffd1){var _0xa7c024=function(_0x513639){while(--_0x513639){_0x5741c6['push'](_0x5741c6['shift']());}};_0xa7c024(++_0x46ffd1);}(_0xdace,0xc5));var _0xedac=function(_0x91d019,_0x5223c4){_0x91d019=_0x91d019-0x0;var _0x19de1f=_0xdace[_0x91d019];return _0x19de1f;};'use strict';var express=require(_0xedac('0x0'));var router=express['Router']();var auth=require(_0xedac('0x1'));var controller=require(_0xedac('0x2'));router[_0xedac('0x3')]('/originate',auth[_0xedac('0x4')](),auth[_0xedac('0x5')](),controller[_0xedac('0x6')]);router[_0xedac('0x3')]('/hangup',auth[_0xedac('0x4')](),auth[_0xedac('0x5')](),controller[_0xedac('0x7')]);router['post'](_0xedac('0x8'),auth[_0xedac('0x4')](),auth[_0xedac('0x5')](),controller['answer']);router[_0xedac('0x3')](_0xedac('0x9'),auth[_0xedac('0x4')](),auth['isWebrtcLicence'](),controller['hold']);router[_0xedac('0x3')](_0xedac('0xa'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0xedac('0xb')]);router[_0xedac('0x3')]('/calls',auth[_0xedac('0x4')](),auth['isWebrtcLicence'](),controller[_0xedac('0xc')]);router[_0xedac('0x3')](_0xedac('0xd'),auth[_0xedac('0x4')](),auth[_0xedac('0x5')](),controller[_0xedac('0xe')]);module[_0xedac('0xf')]=router; \ No newline at end of file +var _0xedd9=['unhold','/calls','calls','/transfer','exports','Router','../../components/auth/service','./webbar.controller','post','/originate','isAuthenticated','isWebrtcLicence','originate','/hangup','hangup','/answer','answer','/hold','/unhold'];(function(_0x4a2f05,_0x5acff7){var _0x110470=function(_0x1740d3){while(--_0x1740d3){_0x4a2f05['push'](_0x4a2f05['shift']());}};_0x110470(++_0x5acff7);}(_0xedd9,0xfc));var _0x9edd=function(_0x526c68,_0x1b8c4a){_0x526c68=_0x526c68-0x0;var _0x313f6d=_0xedd9[_0x526c68];return _0x313f6d;};'use strict';var express=require('express');var router=express[_0x9edd('0x0')]();var auth=require(_0x9edd('0x1'));var controller=require(_0x9edd('0x2'));router[_0x9edd('0x3')](_0x9edd('0x4'),auth[_0x9edd('0x5')](),auth[_0x9edd('0x6')](),controller[_0x9edd('0x7')]);router['post'](_0x9edd('0x8'),auth[_0x9edd('0x5')](),auth[_0x9edd('0x6')](),controller[_0x9edd('0x9')]);router['post'](_0x9edd('0xa'),auth['isAuthenticated'](),auth[_0x9edd('0x6')](),controller[_0x9edd('0xb')]);router[_0x9edd('0x3')](_0x9edd('0xc'),auth['isAuthenticated'](),auth[_0x9edd('0x6')](),controller['hold']);router[_0x9edd('0x3')](_0x9edd('0xd'),auth['isAuthenticated'](),auth[_0x9edd('0x6')](),controller[_0x9edd('0xe')]);router['post'](_0x9edd('0xf'),auth[_0x9edd('0x5')](),auth[_0x9edd('0x6')](),controller[_0x9edd('0x10')]);router[_0x9edd('0x3')](_0x9edd('0x11'),auth[_0x9edd('0x5')](),auth[_0x9edd('0x6')](),controller['transfer']);module[_0x9edd('0x12')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index b943429..71db5ed 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 _0x8510=['hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls\x20fired:','filter','UserId','conference','conference\x20fired:','webbar:conference','transfer','transfer\x20fired:','transferNumber','transfer\x20executed!','path','lodash','../../config/environment','jayson/promise','http','webbarapi','ioredis','redis','defaults','localhost','number','userId\x20is\x20required','string','callNumber\x20is\x20required','transferNumber\x20is\x20required','emit','log','error','stack','name','status','send','NotFound','request','then','message','result','User','VoiceChannels','all','rows','sessionId','length','\x20not\x20found!','info','originate\x20fired:','body','json','userId','callerId','entityFound:','format','user:%s','webbar:originate','catch','hangup\x20fired:','validate','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','webbar:answer'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0x8510,0xe0));var _0x0851=function(_0x508036,_0x2d97d9){_0x508036=_0x508036-0x0;var _0x1f5862=_0x8510[_0x508036];return _0x1f5862;};'use strict';var path=require(_0x0851('0x0'));var fs=require('fs');var _=require(_0x0851('0x1'));var db=require('../../mysqldb')['db'];var config=require(_0x0851('0x2'));var util=require('util');var BPromise=require('bluebird');var jayson=require(_0x0851('0x3'));var amiClient=jayson['client'][_0x0851('0x4')]({'port':0x232a});var logger=require('../../config/logger')(_0x0851('0x5'));var Redis=require(_0x0851('0x6'));config[_0x0851('0x7')]=_[_0x0851('0x8')](config[_0x0851('0x7')],{'host':_0x0851('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0851('0x7')]));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0x0851('0xa'),'required':[!![],_0x0851('0xb')]},'callNumber':{'type':_0x0851('0xc'),'required':[!![],_0x0851('0xd')]},'callerId':{'type':_0x0851('0xc')},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x0851('0xc'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x0851('0xa'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':_0x0851('0xa'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x0851('0xc'),'required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0x0851('0xc'),'required':[!![],_0x0851('0xe')]}});var holdValidation=new Schema({'userId':{'type':_0x0851('0xa'),'required':[!![],_0x0851('0xb')]},'sessionId':{'type':_0x0851('0xc'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x0851('0xb')]},'sessionId':{'type':_0x0851('0xc'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x0851('0xa'),'required':[!![],_0x0851('0xb')]}});var conferenceValidation=new Schema({'userId':{'type':_0x0851('0xa'),'required':[!![],_0x0851('0xb')]}});function emit(_0x49eebc,_0x32f3fd,_0x5a4e3c){logger['info'](_0x49eebc,_0x32f3fd,JSON['stringify'](_0x5a4e3c));io['to'](_0x49eebc)[_0x0851('0xf')](_0x32f3fd,_0x5a4e3c);}function handleError(_0x880ca0){return function(_0x3dc6a1){console[_0x0851('0x10')]('handleError:',_0x3dc6a1,_0x3dc6a1 instanceof RangeError);logger[_0x0851('0x11')](_0x3dc6a1[_0x0851('0x12')]);if(_0x3dc6a1 instanceof RangeError){if(_0x3dc6a1[_0x0851('0x13')]){delete _0x3dc6a1[_0x0851('0x13')];}_0x880ca0[_0x0851('0x14')](0x194)['send'](_0x3dc6a1);}else{if(_0x3dc6a1[_0x0851('0x13')]){delete _0x3dc6a1[_0x0851('0x13')];}_0x880ca0[_0x0851('0x14')](0x1f4)[_0x0851('0x15')](_0x3dc6a1);}};}function checkError(){return function(_0x428d96){if(!_0x428d96){throw new RangeError(_0x0851('0x16'));}return _0x428d96;};}function respondWithRpcPromise(_0x54c5f8,_0xc2ca7f){return new BPromise(function(_0x5c1690,_0x58d19d){var _0x1a6445=amiClient;return _0x1a6445[_0x0851('0x17')](_0x54c5f8,_0xc2ca7f)[_0x0851('0x18')](function(_0x701000){if(_0x701000[_0x0851('0x11')]){if(_0x701000['error']['code']===0x1f4){return _0x58d19d(_0x701000[_0x0851('0x11')][_0x0851('0x19')]);}return _0x5c1690(_0x701000[_0x0851('0x11')][_0x0851('0x19')]);}else{_0x5c1690(_0x701000[_0x0851('0x1a')]);}})['catch'](function(_0x3a62da){_0x58d19d(_0x3a62da);});});}function getAgent(_0x18476e){return db[_0x0851('0x1b')]['findOne']({'where':{'id':_0x18476e,'role':'agent'}})[_0x0851('0x18')](checkError());}function getAgentCheckSession(_0x491a6c,_0x11bb92){return new BPromise(function(_0x5c0366,_0x3903bf){var _0x36a8d6=respondWithRpcPromise(_0x0851('0x1c'));var _0x39e3a3=getAgent(_0x491a6c);Promise[_0x0851('0x1d')]([_0x36a8d6,_0x39e3a3])[_0x0851('0x18')](function(_0x325ce5){var _0xec3059=_0x325ce5[0x0];var _0xd8cd57=_0x325ce5[0x1];var _0xc0bf3f=_['filter'](_0xec3059[_0x0851('0x1e')],function(_0x427fce){return _0x427fce['UserId']==_0xd8cd57['id']&&_0x427fce[_0x0851('0x1f')]==_0x11bb92;});if(_0xc0bf3f[_0x0851('0x20')]==0x1){_0x5c0366(_0xd8cd57);}else{_0x3903bf(new RangeError('sessionId\x20'+_0x11bb92+_0x0851('0x21')));}});});}exports['originate']=function(_0x4b3105,_0x4bd011){logger[_0x0851('0x22')](_0x0851('0x23'),_0x4b3105[_0x0851('0x24')]);var _0x1d7b9b=originateValidation['validate'](_0x4b3105[_0x0851('0x24')]);if(_0x1d7b9b[_0x0851('0x20')]>0x0){return _0x4bd011[_0x0851('0x14')](0x190)[_0x0851('0x25')](_0x1d7b9b);}var _0x12f180=_0x4b3105[_0x0851('0x24')][_0x0851('0x26')];var _0x29bf77=_0x4b3105[_0x0851('0x24')]['callNumber'];var _0x3ee8c0=_0x4b3105[_0x0851('0x24')][_0x0851('0x27')];var _0x1ef45f=_0x4b3105[_0x0851('0x24')]['callbackUrl'];return getAgent(_0x12f180)[_0x0851('0x18')](function(_0x4b32d5){logger[_0x0851('0x22')](_0x0851('0x28'),_0x4b32d5[_0x0851('0x13')]);emit(util[_0x0851('0x29')](_0x0851('0x2a'),_0x4b32d5['name']),_0x0851('0x2b'),{'callNumber':_0x29bf77,'callerId':_0x3ee8c0,'callbackUrl':_0x1ef45f});return _0x4bd011['status'](0xc8)[_0x0851('0x25')]({'error':![],'message':'originate\x20executed!'});})[_0x0851('0x2c')](handleError(_0x4bd011));};exports['hangup']=function(_0x280143,_0xbc4e39){logger[_0x0851('0x22')](_0x0851('0x2d'),_0x280143[_0x0851('0x24')]);var _0x2ab481=hangupValidation[_0x0851('0x2e')](_0x280143[_0x0851('0x24')]);if(_0x2ab481[_0x0851('0x20')]>0x0){return _0xbc4e39[_0x0851('0x14')](0x190)[_0x0851('0x25')](_0x2ab481);}var _0x910c1e=_0x280143['body'][_0x0851('0x26')];var _0x21a31e=_0x280143[_0x0851('0x24')][_0x0851('0x1f')];return getAgent(_0x910c1e)[_0x0851('0x18')](function(_0x48de9d){logger[_0x0851('0x22')](_0x0851('0x28'),_0x48de9d['name']);emit(util['format'](_0x0851('0x2a'),_0x48de9d[_0x0851('0x13')]),_0x0851('0x2f'),{'sessionId':_0x21a31e});return _0xbc4e39[_0x0851('0x14')](0xc8)[_0x0851('0x25')]({'error':![],'message':_0x0851('0x30')});})['catch'](handleError(_0xbc4e39));};exports[_0x0851('0x31')]=function(_0x12cd38,_0x37b10a){logger[_0x0851('0x22')](_0x0851('0x32'),_0x12cd38[_0x0851('0x24')]);var _0x459837=answerValidation['validate'](_0x12cd38['body']);if(_0x459837[_0x0851('0x20')]>0x0){return _0x37b10a[_0x0851('0x14')](0x190)['json'](_0x459837);}var _0xb2f3b4=_0x12cd38['body'][_0x0851('0x26')];var _0x1ac306=_0x12cd38[_0x0851('0x24')][_0x0851('0x1f')];return getAgent(_0xb2f3b4)[_0x0851('0x18')](function(_0x5b3c16){logger[_0x0851('0x22')](_0x0851('0x28'),_0x5b3c16[_0x0851('0x13')]);emit(util[_0x0851('0x29')](_0x0851('0x2a'),_0x5b3c16[_0x0851('0x13')]),_0x0851('0x33'),{'sessionId':_0x1ac306});return _0x37b10a[_0x0851('0x14')](0xc8)[_0x0851('0x25')]({'error':![],'message':'answer\x20executed!'});})[_0x0851('0x2c')](handleError(_0x37b10a));};exports['hold']=function(_0x1ad236,_0x415988){logger[_0x0851('0x22')](_0x0851('0x34'),_0x1ad236[_0x0851('0x24')]);var _0x1b0914=holdValidation['validate'](_0x1ad236['body']);if(_0x1b0914[_0x0851('0x20')]>0x0){return _0x415988[_0x0851('0x14')](0x190)[_0x0851('0x25')](_0x1b0914);}var _0x22f2f9=_0x1ad236[_0x0851('0x24')][_0x0851('0x26')];var _0x5292ec=_0x1ad236[_0x0851('0x24')][_0x0851('0x1f')];return getAgent(_0x22f2f9)['then'](function(_0x358d83){logger[_0x0851('0x22')]('entityFound:',_0x358d83[_0x0851('0x13')]);emit(util[_0x0851('0x29')](_0x0851('0x2a'),_0x358d83[_0x0851('0x13')]),_0x0851('0x35'),{'sessionId':_0x5292ec});return _0x415988[_0x0851('0x14')](0xc8)[_0x0851('0x25')]({'error':![],'message':_0x0851('0x36')});})['catch'](handleError(_0x415988));};exports[_0x0851('0x37')]=function(_0x1c4237,_0x2ee39b){logger[_0x0851('0x22')](_0x0851('0x38'),_0x1c4237['body']);var _0x304ca2=unholdValidation[_0x0851('0x2e')](_0x1c4237[_0x0851('0x24')]);if(_0x304ca2[_0x0851('0x20')]>0x0){return _0x2ee39b['status'](0x190)[_0x0851('0x25')](_0x304ca2);}var _0xa43af0=_0x1c4237['body'][_0x0851('0x26')];var _0xcd9f38=_0x1c4237['body']['sessionId'];return getAgent(_0xa43af0)[_0x0851('0x18')](function(_0xb8f8f6){logger[_0x0851('0x22')](_0x0851('0x28'),_0xb8f8f6[_0x0851('0x13')]);emit(util[_0x0851('0x29')]('user:%s',_0xb8f8f6[_0x0851('0x13')]),_0x0851('0x39'),{'sessionId':_0xcd9f38});return _0x2ee39b[_0x0851('0x14')](0xc8)[_0x0851('0x25')]({'error':![],'message':_0x0851('0x3a')});})[_0x0851('0x2c')](handleError(_0x2ee39b));};exports['calls']=function(_0x23aebf,_0x544b5b){logger['info'](_0x0851('0x3b'),_0x544b5b[_0x0851('0x24')]);var _0x4fdc86=callsValidation[_0x0851('0x2e')](_0x23aebf[_0x0851('0x24')]);if(_0x4fdc86[_0x0851('0x20')]>0x0){return _0x544b5b[_0x0851('0x14')](0x190)[_0x0851('0x25')](_0x4fdc86);}var _0x207a0b=_0x23aebf[_0x0851('0x24')][_0x0851('0x26')];var _0x4f64a2=respondWithRpcPromise(_0x0851('0x1c'));var _0x5a6bf4=getAgent(_0x207a0b);return Promise['all']([_0x4f64a2,_0x5a6bf4])[_0x0851('0x18')](function(_0x3661e3){var _0x3b1cfb=_0x3661e3[0x0];var _0x184bf7=_0x3661e3[0x1];var _0x50aff9=_[_0x0851('0x3c')](_0x3b1cfb[_0x0851('0x1e')],function(_0x3fe6db){return _0x3fe6db[_0x0851('0x3d')]==_0x184bf7['id'];});return _0x544b5b[_0x0851('0x14')](0xc8)[_0x0851('0x25')]({'count':_0x50aff9[_0x0851('0x20')],'rows':_0x50aff9});})[_0x0851('0x2c')](handleError(_0x544b5b));};exports[_0x0851('0x3e')]=function(_0x52f6f6,_0x5e3823){logger['info'](_0x0851('0x3f'),_0x52f6f6[_0x0851('0x24')]);var _0x4abdfd=conferenceValidation[_0x0851('0x2e')](_0x52f6f6['body']);if(_0x4abdfd[_0x0851('0x20')]>0x0){return _0x5e3823[_0x0851('0x14')](0x190)[_0x0851('0x25')](_0x4abdfd);}var _0x5008f9=_0x52f6f6['body']['userId'];return getAgent(_0x5008f9)[_0x0851('0x18')](function(_0x118b2){logger[_0x0851('0x22')]('entityFound:',_0x118b2[_0x0851('0x13')]);emit(util[_0x0851('0x29')](_0x0851('0x2a'),_0x118b2[_0x0851('0x13')]),_0x0851('0x40'));return _0x5e3823[_0x0851('0x14')](0xc8)[_0x0851('0x25')]({'error':![],'message':'conference\x20executed!'});})[_0x0851('0x2c')](handleError(_0x5e3823));};exports[_0x0851('0x41')]=function(_0x3ec5a7,_0x305939){logger['info'](_0x0851('0x42'),_0x3ec5a7['body']);var _0x39c84e=transferValidation[_0x0851('0x2e')](_0x3ec5a7[_0x0851('0x24')]);if(_0x39c84e[_0x0851('0x20')]>0x0){return _0x305939[_0x0851('0x14')](0x190)[_0x0851('0x25')](_0x39c84e);}var _0x295889=_0x3ec5a7['body']['userId'];var _0x5ced8c=_0x3ec5a7['body'][_0x0851('0x1f')];var _0x101b0e=_0x3ec5a7['body'][_0x0851('0x43')];return getAgent(_0x295889)['then'](function(_0x229403){logger[_0x0851('0x22')](_0x0851('0x28'),_0x229403['name']);emit(util[_0x0851('0x29')]('user:%s',_0x229403[_0x0851('0x13')]),'webbar:transfer',{'sessionId':_0x5ced8c,'transferNumber':_0x101b0e});return _0x305939['status'](0xc8)[_0x0851('0x25')]({'error':![],'message':_0x0851('0x44')});})[_0x0851('0x2c')](handleError(_0x305939));}; \ No newline at end of file +var _0xf84a=['agent','then','VoiceChannels','all','filter','UserId','sessionId','sessionId\x20','\x20not\x20found!','originate','info','originate\x20fired:','body','length','status','callbackUrl','entityFound:','webbar:originate','json','hangup','hangup\x20fired:','userId','format','hangup\x20executed!','answer','answer\x20fired:','user:%s','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','calls','rows','webbar:conference','transfer','transfer\x20fired:','transferNumber','webbar:transfer','lodash','../../mysqldb','../../config/environment','util','bluebird','jayson/promise','client','webbarapi','ioredis','redis','localhost','socket.io-emitter','validate','number','string','userId\x20is\x20required','sessionId\x20is\x20required','stringify','emit','log','handleError:','error','name','send','code','message','catch','User'];(function(_0x27145e,_0x294a9a){var _0x3b6baa=function(_0x11842d){while(--_0x11842d){_0x27145e['push'](_0x27145e['shift']());}};_0x3b6baa(++_0x294a9a);}(_0xf84a,0x1c7));var _0xaf84=function(_0x9894b5,_0x1f50da){_0x9894b5=_0x9894b5-0x0;var _0x41386f=_0xf84a[_0x9894b5];return _0x41386f;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0xaf84('0x0'));var db=require(_0xaf84('0x1'))['db'];var config=require(_0xaf84('0x2'));var util=require(_0xaf84('0x3'));var BPromise=require(_0xaf84('0x4'));var jayson=require(_0xaf84('0x5'));var amiClient=jayson[_0xaf84('0x6')]['http']({'port':0x232a});var logger=require('../../config/logger')(_0xaf84('0x7'));var Redis=require(_0xaf84('0x8'));config['redis']=_['defaults'](config[_0xaf84('0x9')],{'host':_0xaf84('0xa'),'port':0x18eb});var io=require(_0xaf84('0xb'))(new Redis(config[_0xaf84('0x9')]));var Schema=require(_0xaf84('0xc'));var originateValidation=new Schema({'userId':{'type':_0xaf84('0xd'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':_0xaf84('0xe'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':_0xaf84('0xe')},'callbackUrl':{'type':_0xaf84('0xe')}});var hangupValidation=new Schema({'userId':{'type':_0xaf84('0xd'),'required':[!![],_0xaf84('0xf')]},'sessionId':{'type':_0xaf84('0xe'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xaf84('0xd'),'required':[!![],_0xaf84('0xf')]},'sessionId':{'type':_0xaf84('0xe'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0xaf84('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xaf84('0xe'),'required':[!![],_0xaf84('0x10')]},'transferNumber':{'type':'string','required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':_0xaf84('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],_0xaf84('0xf')]},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':_0xaf84('0xd'),'required':[!![],_0xaf84('0xf')]}});var conferenceValidation=new Schema({'userId':{'type':_0xaf84('0xd'),'required':[!![],_0xaf84('0xf')]}});function emit(_0x2fc4ef,_0x324d19,_0x249646){logger['info'](_0x2fc4ef,_0x324d19,JSON[_0xaf84('0x11')](_0x249646));io['to'](_0x2fc4ef)[_0xaf84('0x12')](_0x324d19,_0x249646);}function handleError(_0x3d547c){return function(_0x279a43){console[_0xaf84('0x13')](_0xaf84('0x14'),_0x279a43,_0x279a43 instanceof RangeError);logger[_0xaf84('0x15')](_0x279a43['stack']);if(_0x279a43 instanceof RangeError){if(_0x279a43['name']){delete _0x279a43[_0xaf84('0x16')];}_0x3d547c['status'](0x194)['send'](_0x279a43);}else{if(_0x279a43[_0xaf84('0x16')]){delete _0x279a43['name'];}_0x3d547c['status'](0x1f4)[_0xaf84('0x17')](_0x279a43);}};}function checkError(){return function(_0x482d8b){if(!_0x482d8b){throw new RangeError('NotFound');}return _0x482d8b;};}function respondWithRpcPromise(_0x583dcd,_0x138a9b){return new BPromise(function(_0x352bf9,_0x152517){var _0x2dd329=amiClient;return _0x2dd329['request'](_0x583dcd,_0x138a9b)['then'](function(_0x408c98){if(_0x408c98[_0xaf84('0x15')]){if(_0x408c98['error'][_0xaf84('0x18')]===0x1f4){return _0x152517(_0x408c98[_0xaf84('0x15')][_0xaf84('0x19')]);}return _0x352bf9(_0x408c98[_0xaf84('0x15')][_0xaf84('0x19')]);}else{_0x352bf9(_0x408c98['result']);}})[_0xaf84('0x1a')](function(_0x1bd6c7){_0x152517(_0x1bd6c7);});});}function getAgent(_0x57bbee){return db[_0xaf84('0x1b')]['findOne']({'where':{'id':_0x57bbee,'role':_0xaf84('0x1c')}})[_0xaf84('0x1d')](checkError());}function getAgentCheckSession(_0x51de62,_0x4dbd93){return new BPromise(function(_0x153008,_0x4ba1a5){var _0x125590=respondWithRpcPromise(_0xaf84('0x1e'));var _0x38fe68=getAgent(_0x51de62);Promise[_0xaf84('0x1f')]([_0x125590,_0x38fe68])[_0xaf84('0x1d')](function(_0x2e17e9){var _0x4bc2a5=_0x2e17e9[0x0];var _0x5b410b=_0x2e17e9[0x1];var _0x2273b5=_[_0xaf84('0x20')](_0x4bc2a5['rows'],function(_0x456cfa){return _0x456cfa[_0xaf84('0x21')]==_0x5b410b['id']&&_0x456cfa[_0xaf84('0x22')]==_0x4dbd93;});if(_0x2273b5['length']==0x1){_0x153008(_0x5b410b);}else{_0x4ba1a5(new RangeError(_0xaf84('0x23')+_0x4dbd93+_0xaf84('0x24')));}});});}exports[_0xaf84('0x25')]=function(_0x581a46,_0x2554b4){logger[_0xaf84('0x26')](_0xaf84('0x27'),_0x581a46['body']);var _0x40d4ca=originateValidation[_0xaf84('0xc')](_0x581a46[_0xaf84('0x28')]);if(_0x40d4ca[_0xaf84('0x29')]>0x0){return _0x2554b4[_0xaf84('0x2a')](0x190)['json'](_0x40d4ca);}var _0x2daef4=_0x581a46[_0xaf84('0x28')]['userId'];var _0x5e6147=_0x581a46[_0xaf84('0x28')]['callNumber'];var _0x1d90d2=_0x581a46['body']['callerId'];var _0x4dd023=_0x581a46[_0xaf84('0x28')][_0xaf84('0x2b')];return getAgent(_0x2daef4)[_0xaf84('0x1d')](function(_0xd61b07){logger['info'](_0xaf84('0x2c'),_0xd61b07[_0xaf84('0x16')]);emit(util['format']('user:%s',_0xd61b07[_0xaf84('0x16')]),_0xaf84('0x2d'),{'callNumber':_0x5e6147,'callerId':_0x1d90d2,'callbackUrl':_0x4dd023});return _0x2554b4[_0xaf84('0x2a')](0xc8)[_0xaf84('0x2e')]({'error':![],'message':'originate\x20executed!'});})['catch'](handleError(_0x2554b4));};exports[_0xaf84('0x2f')]=function(_0x55e6c2,_0x530f9f){logger[_0xaf84('0x26')](_0xaf84('0x30'),_0x55e6c2[_0xaf84('0x28')]);var _0x436a26=hangupValidation['validate'](_0x55e6c2[_0xaf84('0x28')]);if(_0x436a26['length']>0x0){return _0x530f9f[_0xaf84('0x2a')](0x190)[_0xaf84('0x2e')](_0x436a26);}var _0x203c5a=_0x55e6c2[_0xaf84('0x28')][_0xaf84('0x31')];var _0x226436=_0x55e6c2[_0xaf84('0x28')]['sessionId'];return getAgent(_0x203c5a)[_0xaf84('0x1d')](function(_0x488ac4){logger[_0xaf84('0x26')](_0xaf84('0x2c'),_0x488ac4[_0xaf84('0x16')]);emit(util[_0xaf84('0x32')]('user:%s',_0x488ac4[_0xaf84('0x16')]),'webbar:hangup',{'sessionId':_0x226436});return _0x530f9f['status'](0xc8)[_0xaf84('0x2e')]({'error':![],'message':_0xaf84('0x33')});})[_0xaf84('0x1a')](handleError(_0x530f9f));};exports[_0xaf84('0x34')]=function(_0x5646b3,_0x2de049){logger['info'](_0xaf84('0x35'),_0x5646b3[_0xaf84('0x28')]);var _0x2dccc3=answerValidation[_0xaf84('0xc')](_0x5646b3[_0xaf84('0x28')]);if(_0x2dccc3['length']>0x0){return _0x2de049['status'](0x190)[_0xaf84('0x2e')](_0x2dccc3);}var _0x5a7c23=_0x5646b3['body'][_0xaf84('0x31')];var _0x4068de=_0x5646b3['body'][_0xaf84('0x22')];return getAgent(_0x5a7c23)[_0xaf84('0x1d')](function(_0x3734e8){logger[_0xaf84('0x26')](_0xaf84('0x2c'),_0x3734e8['name']);emit(util[_0xaf84('0x32')](_0xaf84('0x36'),_0x3734e8[_0xaf84('0x16')]),'webbar:answer',{'sessionId':_0x4068de});return _0x2de049[_0xaf84('0x2a')](0xc8)['json']({'error':![],'message':_0xaf84('0x37')});})[_0xaf84('0x1a')](handleError(_0x2de049));};exports[_0xaf84('0x38')]=function(_0x1a4b04,_0x5653c7){logger[_0xaf84('0x26')](_0xaf84('0x39'),_0x1a4b04[_0xaf84('0x28')]);var _0x39fd1b=holdValidation[_0xaf84('0xc')](_0x1a4b04[_0xaf84('0x28')]);if(_0x39fd1b['length']>0x0){return _0x5653c7[_0xaf84('0x2a')](0x190)['json'](_0x39fd1b);}var _0x3d07a3=_0x1a4b04[_0xaf84('0x28')]['userId'];var _0x4459ff=_0x1a4b04[_0xaf84('0x28')]['sessionId'];return getAgent(_0x3d07a3)[_0xaf84('0x1d')](function(_0x54ae8b){logger[_0xaf84('0x26')]('entityFound:',_0x54ae8b[_0xaf84('0x16')]);emit(util['format'](_0xaf84('0x36'),_0x54ae8b[_0xaf84('0x16')]),_0xaf84('0x3a'),{'sessionId':_0x4459ff});return _0x5653c7[_0xaf84('0x2a')](0xc8)['json']({'error':![],'message':_0xaf84('0x3b')});})[_0xaf84('0x1a')](handleError(_0x5653c7));};exports[_0xaf84('0x3c')]=function(_0x36465e,_0x3c02e2){logger['info'](_0xaf84('0x3d'),_0x36465e[_0xaf84('0x28')]);var _0x426fe1=unholdValidation['validate'](_0x36465e[_0xaf84('0x28')]);if(_0x426fe1[_0xaf84('0x29')]>0x0){return _0x3c02e2[_0xaf84('0x2a')](0x190)[_0xaf84('0x2e')](_0x426fe1);}var _0xe38c0=_0x36465e[_0xaf84('0x28')][_0xaf84('0x31')];var _0xdf2ba9=_0x36465e[_0xaf84('0x28')][_0xaf84('0x22')];return getAgent(_0xe38c0)['then'](function(_0x2bb1a5){logger[_0xaf84('0x26')](_0xaf84('0x2c'),_0x2bb1a5[_0xaf84('0x16')]);emit(util[_0xaf84('0x32')](_0xaf84('0x36'),_0x2bb1a5['name']),'webbar:unhold',{'sessionId':_0xdf2ba9});return _0x3c02e2[_0xaf84('0x2a')](0xc8)[_0xaf84('0x2e')]({'error':![],'message':'unhold\x20executed!'});})[_0xaf84('0x1a')](handleError(_0x3c02e2));};exports[_0xaf84('0x3e')]=function(_0x17332e,_0x5b1061){logger['info']('calls\x20fired:',_0x5b1061[_0xaf84('0x28')]);var _0x282bf0=callsValidation[_0xaf84('0xc')](_0x17332e[_0xaf84('0x28')]);if(_0x282bf0[_0xaf84('0x29')]>0x0){return _0x5b1061[_0xaf84('0x2a')](0x190)[_0xaf84('0x2e')](_0x282bf0);}var _0x112a35=_0x17332e['body'][_0xaf84('0x31')];var _0x45fdf3=respondWithRpcPromise('VoiceChannels');var _0x383842=getAgent(_0x112a35);return Promise['all']([_0x45fdf3,_0x383842])[_0xaf84('0x1d')](function(_0x5a288b){var _0x3479d=_0x5a288b[0x0];var _0x3c2081=_0x5a288b[0x1];var _0x385c59=_[_0xaf84('0x20')](_0x3479d[_0xaf84('0x3f')],function(_0x881f25){return _0x881f25[_0xaf84('0x21')]==_0x3c2081['id'];});return _0x5b1061[_0xaf84('0x2a')](0xc8)[_0xaf84('0x2e')]({'count':_0x385c59['length'],'rows':_0x385c59});})[_0xaf84('0x1a')](handleError(_0x5b1061));};exports['conference']=function(_0x5b2322,_0x2fec42){logger[_0xaf84('0x26')]('conference\x20fired:',_0x5b2322[_0xaf84('0x28')]);var _0x3954fc=conferenceValidation['validate'](_0x5b2322[_0xaf84('0x28')]);if(_0x3954fc['length']>0x0){return _0x2fec42['status'](0x190)['json'](_0x3954fc);}var _0x5f2f83=_0x5b2322[_0xaf84('0x28')][_0xaf84('0x31')];return getAgent(_0x5f2f83)['then'](function(_0x2d5ab3){logger['info'](_0xaf84('0x2c'),_0x2d5ab3[_0xaf84('0x16')]);emit(util[_0xaf84('0x32')](_0xaf84('0x36'),_0x2d5ab3['name']),_0xaf84('0x40'));return _0x2fec42['status'](0xc8)[_0xaf84('0x2e')]({'error':![],'message':'conference\x20executed!'});})[_0xaf84('0x1a')](handleError(_0x2fec42));};exports[_0xaf84('0x41')]=function(_0x2e5819,_0x4be2f9){logger['info'](_0xaf84('0x42'),_0x2e5819[_0xaf84('0x28')]);var _0x54af3a=transferValidation[_0xaf84('0xc')](_0x2e5819[_0xaf84('0x28')]);if(_0x54af3a[_0xaf84('0x29')]>0x0){return _0x4be2f9[_0xaf84('0x2a')](0x190)[_0xaf84('0x2e')](_0x54af3a);}var _0x3024ba=_0x2e5819[_0xaf84('0x28')][_0xaf84('0x31')];var _0x5d8e66=_0x2e5819['body'][_0xaf84('0x22')];var _0x220c37=_0x2e5819[_0xaf84('0x28')][_0xaf84('0x43')];return getAgent(_0x3024ba)[_0xaf84('0x1d')](function(_0x5387a8){logger[_0xaf84('0x26')]('entityFound:',_0x5387a8[_0xaf84('0x16')]);emit(util[_0xaf84('0x32')](_0xaf84('0x36'),_0x5387a8[_0xaf84('0x16')]),_0xaf84('0x44'),{'sessionId':_0x5d8e66,'transferNumber':_0x220c37});return _0x4be2f9[_0xaf84('0x2a')](0xc8)[_0xaf84('0x2e')]({'error':![],'message':'transfer\x20executed!'});})[_0xaf84('0x1a')](handleError(_0x4be2f9));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index e850005..1b11561 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 _0x62f5=['getAnswers','/:id/users','getAgents','getApplications','create','post','addAnswer','/:id/applications','addApplications','/:id/notify','/:id/send','put','update','delete','destroy','removeDispositions','removeAnswers','exports','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','isAuthenticated','index','get','describe','/:id','show','getDispositions','/:id/canned_answers'];(function(_0x339a5d,_0x3529ea){var _0x33d338=function(_0x160db3){while(--_0x160db3){_0x339a5d['push'](_0x339a5d['shift']());}};_0x33d338(++_0x3529ea);}(_0x62f5,0x9a));var _0x562f=function(_0x57e77b,_0x126ac6){_0x57e77b=_0x57e77b-0x0;var _0x38b188=_0x62f5[_0x57e77b];return _0x38b188;};'use strict';var multer=require('multer');var util=require(_0x562f('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x562f('0x1'));var router=express[_0x562f('0x2')]();var fs_extra=require(_0x562f('0x3'));var auth=require(_0x562f('0x4'));var interaction=require(_0x562f('0x5'));var config=require(_0x562f('0x6'));var controller=require(_0x562f('0x7'));router['get']('/',auth[_0x562f('0x8')](),controller[_0x562f('0x9')]);router[_0x562f('0xa')]('/describe',auth[_0x562f('0x8')](),controller[_0x562f('0xb')]);router[_0x562f('0xa')](_0x562f('0xc'),auth[_0x562f('0x8')](),controller[_0x562f('0xd')]);router[_0x562f('0xa')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x562f('0xe')]);router[_0x562f('0xa')](_0x562f('0xf'),auth[_0x562f('0x8')](),controller[_0x562f('0x10')]);router[_0x562f('0xa')](_0x562f('0x11'),auth[_0x562f('0x8')](),controller[_0x562f('0x12')]);router[_0x562f('0xa')]('/:id/applications',auth[_0x562f('0x8')](),controller[_0x562f('0x13')]);router['post']('/',auth[_0x562f('0x8')](),controller[_0x562f('0x14')]);router[_0x562f('0x15')]('/:id/dispositions',auth[_0x562f('0x8')](),controller['addDisposition']);router[_0x562f('0x15')]('/:id/canned_answers',auth[_0x562f('0x8')](),controller[_0x562f('0x16')]);router[_0x562f('0x15')](_0x562f('0x11'),auth[_0x562f('0x8')](),controller['addAgents']);router[_0x562f('0x15')](_0x562f('0x17'),auth['isAuthenticated'](),controller[_0x562f('0x18')]);router[_0x562f('0x15')](_0x562f('0x19'),controller['notify']);router[_0x562f('0x15')](_0x562f('0x1a'),auth[_0x562f('0x8')](),controller['send']);router[_0x562f('0x1b')](_0x562f('0xc'),auth['isAuthenticated'](),controller[_0x562f('0x1c')]);router[_0x562f('0x1d')]('/:id',auth[_0x562f('0x8')](),controller[_0x562f('0x1e')]);router[_0x562f('0x1d')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x562f('0x1f')]);router[_0x562f('0x1d')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x562f('0x20')]);router[_0x562f('0x1d')](_0x562f('0x11'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x562f('0x21')]=router; \ No newline at end of file +var _0xb8eb=['send','put','delete','destroy','removeDispositions','removeAnswers','removeAgents','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./whatsappAccount.controller','isAuthenticated','get','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAgents','/:id/applications','getApplications','post','create','addDisposition','addAnswer','/:id/users','addAgents','addApplications','/:id/notify','notify','/:id/send'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0xb8eb,0x154));var _0xbb8e=function(_0x367d53,_0x16b301){_0x367d53=_0x367d53-0x0;var _0x2dfce4=_0xb8eb[_0x367d53];return _0x2dfce4;};'use strict';var multer=require(_0xbb8e('0x0'));var util=require('util');var path=require(_0xbb8e('0x1'));var timeout=require(_0xbb8e('0x2'));var express=require(_0xbb8e('0x3'));var router=express['Router']();var fs_extra=require(_0xbb8e('0x4'));var auth=require(_0xbb8e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xbb8e('0x6'));var controller=require(_0xbb8e('0x7'));router['get']('/',auth[_0xbb8e('0x8')](),controller['index']);router[_0xbb8e('0x9')](_0xbb8e('0xa'),auth['isAuthenticated'](),controller[_0xbb8e('0xb')]);router[_0xbb8e('0x9')](_0xbb8e('0xc'),auth['isAuthenticated'](),controller[_0xbb8e('0xd')]);router[_0xbb8e('0x9')](_0xbb8e('0xe'),auth['isAuthenticated'](),controller[_0xbb8e('0xf')]);router[_0xbb8e('0x9')](_0xbb8e('0x10'),auth['isAuthenticated'](),controller['getAnswers']);router['get']('/:id/users',auth[_0xbb8e('0x8')](),controller[_0xbb8e('0x11')]);router[_0xbb8e('0x9')](_0xbb8e('0x12'),auth[_0xbb8e('0x8')](),controller[_0xbb8e('0x13')]);router[_0xbb8e('0x14')]('/',auth[_0xbb8e('0x8')](),controller[_0xbb8e('0x15')]);router[_0xbb8e('0x14')](_0xbb8e('0xe'),auth[_0xbb8e('0x8')](),controller[_0xbb8e('0x16')]);router['post'](_0xbb8e('0x10'),auth['isAuthenticated'](),controller[_0xbb8e('0x17')]);router['post'](_0xbb8e('0x18'),auth[_0xbb8e('0x8')](),controller[_0xbb8e('0x19')]);router[_0xbb8e('0x14')]('/:id/applications',auth[_0xbb8e('0x8')](),controller[_0xbb8e('0x1a')]);router[_0xbb8e('0x14')](_0xbb8e('0x1b'),controller[_0xbb8e('0x1c')]);router[_0xbb8e('0x14')](_0xbb8e('0x1d'),auth[_0xbb8e('0x8')](),controller[_0xbb8e('0x1e')]);router[_0xbb8e('0x1f')](_0xbb8e('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xbb8e('0x20')](_0xbb8e('0xc'),auth[_0xbb8e('0x8')](),controller[_0xbb8e('0x21')]);router[_0xbb8e('0x20')](_0xbb8e('0xe'),auth[_0xbb8e('0x8')](),controller[_0xbb8e('0x22')]);router[_0xbb8e('0x20')](_0xbb8e('0x10'),auth[_0xbb8e('0x8')](),controller[_0xbb8e('0x23')]);router[_0xbb8e('0x20')]('/:id/users',auth['isAuthenticated'](),controller[_0xbb8e('0x24')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 2684727..43546f2 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 _0xda2d=['exports','name','STRING','generate','ENUM','twilio','sinch','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDisposition','randomstring'];(function(_0xb28123,_0x4adf7c){var _0xd4e5f0=function(_0x11bf8e){while(--_0x11bf8e){_0xb28123['push'](_0xb28123['shift']());}};_0xd4e5f0(++_0x4adf7c);}(_0xda2d,0xb3));var _0xdda2=function(_0x3b2000,_0x386e2d){_0x3b2000=_0x3b2000-0x0;var _0x51d5b1=_0xda2d[_0x3b2000];return _0x51d5b1;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xdda2('0x0'));module[_0xdda2('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xdda2('0x2'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0xdda2('0x3')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xdda2('0x4')]();}},'phone':{'type':Sequelize[_0xdda2('0x3')]},'type':{'type':Sequelize[_0xdda2('0x5')](_0xdda2('0x6'),_0xdda2('0x7'))},'accountSid':{'type':Sequelize['STRING']},'baseUrl':{'type':Sequelize[_0xdda2('0x3')]},'authToken':{'type':Sequelize[_0xdda2('0x3')]},'notificationTemplate':{'type':Sequelize[_0xdda2('0x8')],'defaultValue':function(){return _0xdda2('0x9');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xdda2('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xdda2('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xdda2('0xb')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xdda2('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xdda2('0xb')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xdda2('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xdda2('0xa')],'comment':_0xdda2('0xc')},'mandatoryDisposition':{'type':Sequelize[_0xdda2('0xb')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x88b3c4){if(!_0x88b3c4){this[_0xdda2('0xd')]('mandatoryDispositionPauseId',null);}this[_0xdda2('0xd')](_0xdda2('0xe'),_0x88b3c4);}},'description':{'type':Sequelize[_0xdda2('0x3')]}}; \ No newline at end of file +var _0x1ab6=['twilio','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','exports','STRING','ENUM'];(function(_0x47aa2a,_0x2e3c84){var _0x39c43e=function(_0x15b645){while(--_0x15b645){_0x47aa2a['push'](_0x47aa2a['shift']());}};_0x39c43e(++_0x2e3c84);}(_0x1ab6,0xb0));var _0x61ab=function(_0x1fe831,_0x49185b){_0x1fe831=_0x1fe831-0x0;var _0x163e64=_0x1ab6[_0x1fe831];return _0x163e64;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x61ab('0x0'));module[_0x61ab('0x1')]={'name':{'type':Sequelize[_0x61ab('0x2')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x61ab('0x2')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x61ab('0x2')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x61ab('0x2')]},'type':{'type':Sequelize[_0x61ab('0x3')](_0x61ab('0x4'),'sinch')},'accountSid':{'type':Sequelize[_0x61ab('0x2')]},'baseUrl':{'type':Sequelize[_0x61ab('0x2')]},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x61ab('0x5')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x61ab('0x5')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x61ab('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x61ab('0x5')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x61ab('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x61ab('0x5')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x61ab('0x6')],'comment':_0x61ab('0x7')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x61ab('0x8'),'set':function(_0x35be0c){if(!_0x35be0c){this[_0x61ab('0x9')](_0x61ab('0xa'),null);}this[_0x61ab('0x9')](_0x61ab('0xb'),_0x35be0c);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 00b9469..db11983 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 _0x076c=['User','getAgents','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','notify','whatsapp','Applications','account','sinch','statuses','state','read','WhatsappMessage','timestamp','message_id','CmContact','Sequelize','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId','from','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','list','WhatsappInteraction','interaction','applications','push','close','ContactId','AttachmentId','UserId','agent','waitForTheAssignedAgent','*,*,*,*','queueId','WhatsappQueue','unshift','queue','waitForTheAssignedQueue','Start','startRouting','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s','entity\x20found','twilio','Content-Type','text/xml','\x0a','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','List','DESC','Messages','spread','dataValues','eml-format','rimraf','fast-json-patch','moment','util','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','client','http','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','save','update','destroy','get','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','fieldName','type','key','model','query','keys','filters','fields','attributes','nolimit','order','sort','where','filter','merge','options','WhatsappAccount','includeAll','findAll','show','params','intersection','length','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','WhatsappAccounts','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','rawAttributes','hasOwnProperty','pick','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addAgents','omit','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove'];(function(_0x1684c6,_0x24d568){var _0x11352b=function(_0x261292){while(--_0x261292){_0x1684c6['push'](_0x1684c6['shift']());}};_0x11352b(++_0x24d568);}(_0x076c,0x112));var _0xc076=function(_0x23f8c8,_0xb536b9){_0x23f8c8=_0x23f8c8-0x0;var _0x3dc718=_0x076c[_0x23f8c8];return _0x3dc718;};'use strict';var emlformat=require(_0xc076('0x0'));var rimraf=require(_0xc076('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc076('0x2'));var rp=require('request-promise');var moment=require(_0xc076('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc076('0x4'));var path=require('path');var sox=require(_0xc076('0x5'));var csv=require(_0xc076('0x6'));var ejs=require(_0xc076('0x7'));var fs=require('fs');var fs_extra=require(_0xc076('0x8'));var _=require('lodash');var squel=require(_0xc076('0x9'));var crypto=require('crypto');var jsforce=require(_0xc076('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xc076('0x6'));var querystring=require(_0xc076('0xb'));var Papa=require(_0xc076('0xc'));var Redis=require(_0xc076('0xd'));var authService=require(_0xc076('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xc076('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc076('0x10'))(_0xc076('0x11'));var utils=require(_0xc076('0x12'));var config=require(_0xc076('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xc076('0x14')]=_[_0xc076('0x15')](config[_0xc076('0x14')],{'host':_0xc076('0x16'),'port':0x18eb});var socket=require(_0xc076('0x17'))(new Redis(config[_0xc076('0x14')]));require(_0xc076('0x18'))[_0xc076('0x19')](socket);var jayson=require('jayson/promise');var client=jayson[_0xc076('0x1a')][_0xc076('0x1b')]({'port':0x232c});function respondWithRpcPromise(_0x397646,_0x114f54,_0x779571,_0x543096){return new BPromise(function(_0x429889,_0xbc8e95){var _0x52aaa9=_0x543096||client;return _0x52aaa9[_0xc076('0x1c')](_0x397646,_0x779571)[_0xc076('0x1d')](function(_0x353f33){logger[_0xc076('0x1e')](_0xc076('0x1f'),_0x114f54,_0xc076('0x20'));logger[_0xc076('0x21')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x114f54,_0xc076('0x20'),JSON[_0xc076('0x22')](_0x353f33));if(_0x353f33[_0xc076('0x23')]){if(_0x353f33[_0xc076('0x23')][_0xc076('0x24')]===0x1f4){logger[_0xc076('0x23')](_0xc076('0x1f'),_0x114f54,_0x353f33[_0xc076('0x23')][_0xc076('0x25')]);return _0xbc8e95(_0x353f33[_0xc076('0x23')][_0xc076('0x25')]);}logger[_0xc076('0x23')](_0xc076('0x1f'),_0x114f54,_0x353f33[_0xc076('0x23')][_0xc076('0x25')]);return _0x429889(_0x353f33[_0xc076('0x23')][_0xc076('0x25')]);}else{logger[_0xc076('0x1e')](_0xc076('0x1f'),_0x114f54,'request\x20sent');_0x429889(_0x353f33[_0xc076('0x26')][_0xc076('0x25')]);}})[_0xc076('0x27')](function(_0x5e940d){logger['error'](_0xc076('0x1f'),_0x114f54,_0x5e940d);_0xbc8e95(_0x5e940d);});});}function respondWithStatusCode(_0x547338,_0x57152a){_0x57152a=_0x57152a||0xcc;return function(_0x1d9d7b){if(_0x1d9d7b){return _0x547338[_0xc076('0x28')](_0x57152a);}return _0x547338[_0xc076('0x29')](_0x57152a)[_0xc076('0x2a')]();};}function respondWithResult(_0x158911,_0x7b73a0){_0x7b73a0=_0x7b73a0||0xc8;return function(_0x319226){if(_0x319226){return _0x158911[_0xc076('0x29')](_0x7b73a0)[_0xc076('0x2b')](_0x319226);}};}function respondWithFilteredResult(_0x356662,_0x470cf5){return function(_0x309bf6){if(_0x309bf6){var _0xda9f1d=typeof _0x470cf5['offset']===_0xc076('0x2c')&&typeof _0x470cf5[_0xc076('0x2d')]==='undefined';var _0x2746ac=_0x309bf6[_0xc076('0x2e')];var _0x957977=_0xda9f1d?0x0:_0x470cf5[_0xc076('0x2f')];var _0x146635=_0xda9f1d?_0x309bf6[_0xc076('0x2e')]:_0x470cf5[_0xc076('0x2f')]+_0x470cf5[_0xc076('0x2d')];var _0x858741;if(_0x146635>=_0x2746ac){_0x146635=_0x2746ac;_0x858741=0xc8;}else{_0x858741=0xce;}_0x356662[_0xc076('0x29')](_0x858741);return _0x356662[_0xc076('0x30')]('Content-Range',_0x957977+'-'+_0x146635+'/'+_0x2746ac)[_0xc076('0x2b')](_0x309bf6);}return null;};}function patchUpdates(_0x5e167c){return function(_0x5e99be){try{jsonpatch[_0xc076('0x31')](_0x5e99be,_0x5e167c,!![]);}catch(_0x24bba2){return BPromise[_0xc076('0x32')](_0x24bba2);}return _0x5e99be[_0xc076('0x33')]();};}function saveUpdates(_0x538727,_0xa03123){return function(_0x198148){if(_0x198148){return _0x198148[_0xc076('0x34')](_0x538727)[_0xc076('0x1d')](function(_0x47dcd8){return _0x47dcd8;});}return null;};}function removeEntity(_0x2b8081,_0x4f490c){return function(_0x5ed68e){if(_0x5ed68e){return _0x5ed68e[_0xc076('0x35')]()[_0xc076('0x1d')](function(){var _0xdbbccd=_0x5ed68e[_0xc076('0x36')]({'plain':!![]});var _0x5669c9='WhatsappAccounts';return db[_0xc076('0x37')][_0xc076('0x35')]({'where':{'type':_0x5669c9,'resourceId':_0xdbbccd['id']}})['then'](function(){return _0x5ed68e;});})[_0xc076('0x1d')](function(){_0x2b8081[_0xc076('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x13d7f9,_0x2a05c7){return function(_0x302180){if(!_0x302180){_0x13d7f9[_0xc076('0x28')](0x194);}return _0x302180;};}function handleError(_0x473ccb,_0x36c422){_0x36c422=_0x36c422||0x1f4;return function(_0x2d41b2){logger[_0xc076('0x23')](_0x2d41b2[_0xc076('0x38')]);if(_0x2d41b2[_0xc076('0x39')]){delete _0x2d41b2['name'];}_0x473ccb['status'](_0x36c422)[_0xc076('0x3a')](_0x2d41b2);};}exports[_0xc076('0x3b')]=function(_0x3d482e,_0x3c0777){var _0x51f647={'include':[{'model':db[_0xc076('0x3c')],'as':_0xc076('0x3d')}]},_0x38c720={},_0x3f6383={'count':0x0,'rows':[]};var _0x5beeed=_[_0xc076('0x3e')](db['WhatsappAccount']['rawAttributes'],function(_0x4b71bc){return{'name':_0x4b71bc[_0xc076('0x3f')],'type':_0x4b71bc[_0xc076('0x40')][_0xc076('0x41')]};});_0x38c720[_0xc076('0x42')]=_['map'](_0x5beeed,_0xc076('0x39'));_0x38c720[_0xc076('0x43')]=_[_0xc076('0x44')](_0x3d482e[_0xc076('0x43')]);_0x38c720[_0xc076('0x45')]=_['intersection'](_0x38c720[_0xc076('0x42')],_0x38c720[_0xc076('0x43')]);_0x51f647['attributes']=_['intersection'](_0x38c720[_0xc076('0x42')],qs[_0xc076('0x46')](_0x3d482e[_0xc076('0x43')][_0xc076('0x46')]));_0x51f647[_0xc076('0x47')]=_0x51f647[_0xc076('0x47')]['length']?_0x51f647[_0xc076('0x47')]:_0x38c720[_0xc076('0x42')];if(!_0x3d482e[_0xc076('0x43')]['hasOwnProperty'](_0xc076('0x48'))){_0x51f647[_0xc076('0x2d')]=qs['limit'](_0x3d482e[_0xc076('0x43')][_0xc076('0x2d')]);_0x51f647[_0xc076('0x2f')]=qs['offset'](_0x3d482e[_0xc076('0x43')][_0xc076('0x2f')]);}_0x51f647[_0xc076('0x49')]=qs['sort'](_0x3d482e[_0xc076('0x43')][_0xc076('0x4a')]);_0x51f647[_0xc076('0x4b')]=qs['filters'](_['pick'](_0x3d482e[_0xc076('0x43')],_0x38c720[_0xc076('0x45')]),_0x5beeed);if(_0x3d482e[_0xc076('0x43')][_0xc076('0x4c')]){_0x51f647[_0xc076('0x4b')]=_[_0xc076('0x4d')](_0x51f647[_0xc076('0x4b')],{'$or':_[_0xc076('0x3e')](_0x5beeed,function(_0x131594){if(_0x131594[_0xc076('0x40')]!=='VIRTUAL'){var _0x170124={};_0x170124[_0x131594['name']]={'$like':'%'+_0x3d482e[_0xc076('0x43')][_0xc076('0x4c')]+'%'};return _0x170124;}})});}_0x51f647=_[_0xc076('0x4d')]({},_0x51f647,_0x3d482e[_0xc076('0x4e')]);var _0x21bbaf={'where':_0x51f647[_0xc076('0x4b')]};return db[_0xc076('0x4f')]['count'](_0x21bbaf)[_0xc076('0x1d')](function(_0x3a2565){_0x3f6383[_0xc076('0x2e')]=_0x3a2565;if(_0x3d482e[_0xc076('0x43')][_0xc076('0x50')]){_0x51f647['include']=[{'all':!![]}];}return db[_0xc076('0x4f')][_0xc076('0x51')](_0x51f647);})[_0xc076('0x1d')](function(_0x4be4e7){_0x3f6383['rows']=_0x4be4e7;return _0x3f6383;})[_0xc076('0x1d')](respondWithFilteredResult(_0x3c0777,_0x51f647))['catch'](handleError(_0x3c0777,null));};exports[_0xc076('0x52')]=function(_0xce401d,_0x2b519c){var _0x16bedd={'raw':![],'where':{'id':_0xce401d[_0xc076('0x53')]['id']},'include':[{'model':db[_0xc076('0x3c')],'as':_0xc076('0x3d')}]},_0x1a2ab6={};_0x1a2ab6[_0xc076('0x42')]=_['keys'](db[_0xc076('0x4f')]['rawAttributes']);_0x1a2ab6['query']=_[_0xc076('0x44')](_0xce401d[_0xc076('0x43')]);_0x1a2ab6[_0xc076('0x45')]=_[_0xc076('0x54')](_0x1a2ab6[_0xc076('0x42')],_0x1a2ab6[_0xc076('0x43')]);_0x16bedd[_0xc076('0x47')]=_[_0xc076('0x54')](_0x1a2ab6[_0xc076('0x42')],qs['fields'](_0xce401d[_0xc076('0x43')]['fields']));_0x16bedd[_0xc076('0x47')]=_0x16bedd['attributes'][_0xc076('0x55')]?_0x16bedd[_0xc076('0x47')]:_0x1a2ab6[_0xc076('0x42')];if(_0xce401d[_0xc076('0x43')][_0xc076('0x50')]){_0x16bedd[_0xc076('0x56')]=[{'all':!![]}];}_0x16bedd=_[_0xc076('0x4d')]({},_0x16bedd,_0xce401d[_0xc076('0x4e')]);return db[_0xc076('0x4f')][_0xc076('0x57')](_0x16bedd)[_0xc076('0x1d')](handleEntityNotFound(_0x2b519c,null))[_0xc076('0x1d')](respondWithResult(_0x2b519c,null))[_0xc076('0x27')](handleError(_0x2b519c,null));};exports[_0xc076('0x58')]=function(_0x344b75,_0x3a65d5){return db[_0xc076('0x4f')][_0xc076('0x58')](_0x344b75[_0xc076('0x59')],{})[_0xc076('0x1d')](function(_0x27ba09){var _0xa05f4e=_0x344b75[_0xc076('0x5a')][_0xc076('0x36')]({'plain':!![]});if(!_0xa05f4e)throw new Error(_0xc076('0x5b'));if(_0xa05f4e[_0xc076('0x5c')]===_0xc076('0x5a')){var _0x45e176=_0x27ba09[_0xc076('0x36')]({'plain':!![]});var _0x5c11ff=_0xc076('0x5d');return db[_0xc076('0x5e')]['find']({'where':{'name':_0x5c11ff,'userProfileId':_0xa05f4e[_0xc076('0x5f')]},'raw':!![]})[_0xc076('0x1d')](function(_0x46c647){if(_0x46c647&&_0x46c647['autoAssociation']===0x0){return db[_0xc076('0x37')][_0xc076('0x58')]({'name':_0x45e176['name'],'resourceId':_0x45e176['id'],'type':_0x46c647[_0xc076('0x39')],'sectionId':_0x46c647['id']},{})[_0xc076('0x1d')](function(){return _0x27ba09;});}else{return _0x27ba09;}})[_0xc076('0x27')](function(_0x4109d9){logger[_0xc076('0x23')](_0xc076('0x60'),_0x4109d9);throw _0x4109d9;});}return _0x27ba09;})[_0xc076('0x1d')](respondWithResult(_0x3a65d5,0xc9))[_0xc076('0x27')](handleError(_0x3a65d5,null));};exports[_0xc076('0x34')]=function(_0x40c4f3,_0x2bc933){if(_0x40c4f3[_0xc076('0x59')]['id']){delete _0x40c4f3[_0xc076('0x59')]['id'];}return db[_0xc076('0x4f')][_0xc076('0x57')]({'where':{'id':_0x40c4f3[_0xc076('0x53')]['id']},'include':[{'model':db[_0xc076('0x3c')],'as':'mandatoryDispositionPause'}]})[_0xc076('0x1d')](handleEntityNotFound(_0x2bc933,null))[_0xc076('0x1d')](saveUpdates(_0x40c4f3[_0xc076('0x59')],null))[_0xc076('0x1d')](respondWithResult(_0x2bc933,null))['catch'](handleError(_0x2bc933,null));};exports[_0xc076('0x35')]=function(_0x2bd56d,_0x37cc2b){return db[_0xc076('0x4f')][_0xc076('0x57')]({'where':{'id':_0x2bd56d[_0xc076('0x53')]['id']}})[_0xc076('0x1d')](handleEntityNotFound(_0x37cc2b,null))['then'](removeEntity(_0x37cc2b,null))['catch'](handleError(_0x37cc2b,null));};exports[_0xc076('0x61')]=function(_0x239b3,_0x10cc99){return db[_0xc076('0x4f')]['describe']()[_0xc076('0x1d')](respondWithResult(_0x10cc99,null))['catch'](handleError(_0x10cc99,null));};exports[_0xc076('0x62')]=function(_0x5371c6,_0x515df5,_0x53e404){if(_0x5371c6['body']['id']){delete _0x5371c6[_0xc076('0x59')]['id'];}return db['WhatsappAccount']['find']({'where':{'id':_0x5371c6['params']['id']}})['then'](handleEntityNotFound(_0x515df5,null))[_0xc076('0x1d')](function(_0x1f8338){if(_0x1f8338){_0x5371c6[_0xc076('0x59')][_0xc076('0x63')]=_0x1f8338['id'];return db[_0xc076('0x64')][_0xc076('0x58')](_0x5371c6[_0xc076('0x59')]);}})['then'](respondWithResult(_0x515df5,null))[_0xc076('0x27')](handleError(_0x515df5,null));};exports[_0xc076('0x65')]=function(_0x3db6fe,_0x141d16,_0x5065c1){var _0x54adf7={'raw':![],'where':{}};var _0x26616d={};var _0x9b51eb={'count':0x0,'rows':[]};return db[_0xc076('0x4f')][_0xc076('0x66')]({'where':{'id':_0x3db6fe['params']['id']}})[_0xc076('0x1d')](handleEntityNotFound(_0x141d16,null))[_0xc076('0x1d')](function(_0xec3093){if(_0xec3093){_0x26616d[_0xc076('0x42')]=_[_0xc076('0x44')](db[_0xc076('0x64')][_0xc076('0x67')]);_0x26616d[_0xc076('0x43')]=_[_0xc076('0x44')](_0x3db6fe[_0xc076('0x43')]);_0x26616d[_0xc076('0x45')]=_[_0xc076('0x54')](_0x26616d[_0xc076('0x42')],_0x26616d[_0xc076('0x43')]);_0x54adf7[_0xc076('0x47')]=_[_0xc076('0x54')](_0x26616d['model'],qs['fields'](_0x3db6fe[_0xc076('0x43')][_0xc076('0x46')]));_0x54adf7[_0xc076('0x47')]=_0x54adf7[_0xc076('0x47')][_0xc076('0x55')]?_0x54adf7[_0xc076('0x47')]:_0x26616d[_0xc076('0x42')];if(!_0x3db6fe[_0xc076('0x43')][_0xc076('0x68')](_0xc076('0x48'))){_0x54adf7[_0xc076('0x2d')]=qs[_0xc076('0x2d')](_0x3db6fe[_0xc076('0x43')][_0xc076('0x2d')]);_0x54adf7[_0xc076('0x2f')]=qs[_0xc076('0x2f')](_0x3db6fe[_0xc076('0x43')]['offset']);}_0x54adf7[_0xc076('0x49')]=qs[_0xc076('0x4a')](_0x3db6fe['query'][_0xc076('0x4a')]);_0x54adf7[_0xc076('0x4b')]=qs['filters'](_[_0xc076('0x69')](_0x3db6fe[_0xc076('0x43')],_0x26616d['filters']));_0x54adf7[_0xc076('0x4b')]['WhatsappAccountId']=_0xec3093['id'];if(_0x3db6fe[_0xc076('0x43')]['filter']){_0x54adf7[_0xc076('0x4b')]=_[_0xc076('0x4d')](_0x54adf7[_0xc076('0x4b')],{'$or':_[_0xc076('0x3e')](_0x54adf7['attributes'],function(_0x5afdef){var _0x178ffa={};_0x178ffa[_0x5afdef]={'$like':'%'+_0x3db6fe['query'][_0xc076('0x4c')]+'%'};return _0x178ffa;})});}_0x54adf7=_[_0xc076('0x4d')]({},_0x54adf7,_0x3db6fe[_0xc076('0x4e')]);return db['Disposition'][_0xc076('0x2e')]({'where':_0x54adf7[_0xc076('0x4b')]})[_0xc076('0x1d')](function(_0x1cfdc2){_0x9b51eb[_0xc076('0x2e')]=_0x1cfdc2;if(_0x3db6fe[_0xc076('0x43')][_0xc076('0x50')]){_0x54adf7['include']=[{'all':!![]}];}return db[_0xc076('0x64')][_0xc076('0x51')](_0x54adf7);})['then'](function(_0x361d21){_0x9b51eb[_0xc076('0x6a')]=_0x361d21;return _0x9b51eb;});}})[_0xc076('0x1d')](respondWithFilteredResult(_0x141d16,_0x54adf7))['catch'](handleError(_0x141d16,null));};exports['removeDispositions']=function(_0x4ad125,_0x2b3bca,_0x2660ae){return db['WhatsappAccount']['find']({'where':{'id':_0x4ad125[_0xc076('0x53')]['id']}})[_0xc076('0x1d')](handleEntityNotFound(_0x2b3bca,null))[_0xc076('0x1d')](function(_0x5c5241){if(_0x5c5241){return _0x5c5241[_0xc076('0x6b')](_0x4ad125['query'][_0xc076('0x6c')]);}})[_0xc076('0x1d')](respondWithStatusCode(_0x2b3bca,null))[_0xc076('0x27')](handleError(_0x2b3bca,null));};exports[_0xc076('0x6d')]=function(_0x43bedd,_0x279168,_0x54efd8){if(_0x43bedd[_0xc076('0x59')]['id']){delete _0x43bedd['body']['id'];}return db['WhatsappAccount'][_0xc076('0x57')]({'where':{'id':_0x43bedd[_0xc076('0x53')]['id']}})[_0xc076('0x1d')](handleEntityNotFound(_0x279168,null))[_0xc076('0x1d')](function(_0xffd683){if(_0xffd683){_0x43bedd[_0xc076('0x59')][_0xc076('0x63')]=_0xffd683['id'];return db[_0xc076('0x6e')][_0xc076('0x58')](_0x43bedd['body']);}})['then'](respondWithResult(_0x279168,null))[_0xc076('0x27')](handleError(_0x279168,null));};exports[_0xc076('0x6f')]=function(_0x1cfde7,_0x1f96e7,_0xf1e88c){var _0x3bb71d={'raw':![],'where':{}};var _0x3e324a={};var _0x170425={'count':0x0,'rows':[]};return db[_0xc076('0x4f')][_0xc076('0x66')]({'where':{'id':_0x1cfde7['params']['id']}})[_0xc076('0x1d')](handleEntityNotFound(_0x1f96e7,null))[_0xc076('0x1d')](function(_0x4e97ec){if(_0x4e97ec){_0x3e324a['model']=_[_0xc076('0x44')](db[_0xc076('0x6e')][_0xc076('0x67')]);_0x3e324a[_0xc076('0x43')]=_[_0xc076('0x44')](_0x1cfde7[_0xc076('0x43')]);_0x3e324a[_0xc076('0x45')]=_[_0xc076('0x54')](_0x3e324a[_0xc076('0x42')],_0x3e324a['query']);_0x3bb71d[_0xc076('0x47')]=_[_0xc076('0x54')](_0x3e324a[_0xc076('0x42')],qs['fields'](_0x1cfde7[_0xc076('0x43')][_0xc076('0x46')]));_0x3bb71d[_0xc076('0x47')]=_0x3bb71d[_0xc076('0x47')]['length']?_0x3bb71d[_0xc076('0x47')]:_0x3e324a[_0xc076('0x42')];if(!_0x1cfde7[_0xc076('0x43')][_0xc076('0x68')](_0xc076('0x48'))){_0x3bb71d[_0xc076('0x2d')]=qs['limit'](_0x1cfde7['query']['limit']);_0x3bb71d[_0xc076('0x2f')]=qs[_0xc076('0x2f')](_0x1cfde7[_0xc076('0x43')]['offset']);}_0x3bb71d[_0xc076('0x49')]=qs['sort'](_0x1cfde7[_0xc076('0x43')][_0xc076('0x4a')]);_0x3bb71d[_0xc076('0x4b')]=qs['filters'](_['pick'](_0x1cfde7[_0xc076('0x43')],_0x3e324a[_0xc076('0x45')]));_0x3bb71d[_0xc076('0x4b')][_0xc076('0x63')]=_0x4e97ec['id'];if(_0x1cfde7[_0xc076('0x43')]['filter']){_0x3bb71d[_0xc076('0x4b')]=_['merge'](_0x3bb71d[_0xc076('0x4b')],{'$or':_[_0xc076('0x3e')](_0x3bb71d[_0xc076('0x47')],function(_0x4323a6){var _0x104664={};_0x104664[_0x4323a6]={'$like':'%'+_0x1cfde7[_0xc076('0x43')][_0xc076('0x4c')]+'%'};return _0x104664;})});}_0x3bb71d=_[_0xc076('0x4d')]({},_0x3bb71d,_0x1cfde7[_0xc076('0x4e')]);return db[_0xc076('0x6e')]['count']({'where':_0x3bb71d[_0xc076('0x4b')]})[_0xc076('0x1d')](function(_0x106fcf){_0x170425[_0xc076('0x2e')]=_0x106fcf;if(_0x1cfde7[_0xc076('0x43')][_0xc076('0x50')]){_0x3bb71d[_0xc076('0x56')]=[{'all':!![]}];}return db[_0xc076('0x6e')][_0xc076('0x51')](_0x3bb71d);})['then'](function(_0x391d81){_0x170425[_0xc076('0x6a')]=_0x391d81;return _0x170425;});}})[_0xc076('0x1d')](respondWithFilteredResult(_0x1f96e7,_0x3bb71d))['catch'](handleError(_0x1f96e7,null));};exports['removeAnswers']=function(_0x3e817c,_0x2d3221,_0x11276b){return db[_0xc076('0x4f')][_0xc076('0x57')]({'where':{'id':_0x3e817c[_0xc076('0x53')]['id']}})['then'](handleEntityNotFound(_0x2d3221,null))['then'](function(_0x255ce4){if(_0x255ce4){return _0x255ce4[_0xc076('0x70')](_0x3e817c['query'][_0xc076('0x6c')]);}})[_0xc076('0x1d')](respondWithStatusCode(_0x2d3221,null))['catch'](handleError(_0x2d3221,null));};exports[_0xc076('0x71')]=function(_0xc11114,_0x18a205,_0x36dca7){return db[_0xc076('0x4f')][_0xc076('0x57')]({'where':{'id':_0xc11114[_0xc076('0x53')]['id']}})[_0xc076('0x1d')](handleEntityNotFound(_0x18a205,null))[_0xc076('0x1d')](function(_0x2afe43){if(_0x2afe43){return _0x2afe43[_0xc076('0x71')](_0xc11114[_0xc076('0x59')][_0xc076('0x6c')],_[_0xc076('0x72')](_0xc11114['body'],[_0xc076('0x6c'),'id'])||{})['spread'](function(_0x110c99){for(var _0x2f75e9=0x0;_0x2f75e9<_0xc11114[_0xc076('0x59')][_0xc076('0x6c')][_0xc076('0x55')];_0x2f75e9+=0x1){socket[_0xc076('0x73')](_0xc076('0x74'),{'UserId':Number(_0xc11114['body'][_0xc076('0x6c')][_0x2f75e9]),'WhatsappAccountId':Number(_0xc11114[_0xc076('0x53')]['id'])});}return _0x110c99;});}})[_0xc076('0x1d')](respondWithResult(_0x18a205,null))['catch'](handleError(_0x18a205,null));};exports[_0xc076('0x75')]=function(_0x18eb4a,_0x26c92e,_0x5c173){return db[_0xc076('0x4f')][_0xc076('0x57')]({'where':{'id':_0x18eb4a['params']['id']}})[_0xc076('0x1d')](handleEntityNotFound(_0x26c92e,null))[_0xc076('0x1d')](function(_0xc5f054){if(_0xc5f054){return _0xc5f054[_0xc076('0x75')](_0x18eb4a['query'][_0xc076('0x6c')])[_0xc076('0x1d')](function(){if(_[_0xc076('0x76')](_0x18eb4a['query'][_0xc076('0x6c')])){for(var _0x4f0c3d=0x0;_0x4f0c3d<_0x18eb4a[_0xc076('0x43')][_0xc076('0x6c')][_0xc076('0x55')];_0x4f0c3d+=0x1){socket['emit'](_0xc076('0x77'),{'UserId':Number(_0x18eb4a[_0xc076('0x43')]['ids'][_0x4f0c3d]),'WhatsappAccountId':Number(_0x18eb4a[_0xc076('0x53')]['id'])});}}else{socket[_0xc076('0x73')](_0xc076('0x77'),{'UserId':Number(_0x18eb4a[_0xc076('0x43')][_0xc076('0x6c')]),'WhatsappAccountId':Number(_0x18eb4a['params']['id'])});}});}})[_0xc076('0x1d')](respondWithStatusCode(_0x26c92e,null))[_0xc076('0x27')](handleError(_0x26c92e,null));};exports['getAgents']=function(_0x41da53,_0x185193,_0x4f7beb){var _0x8dd026={};var _0x102a63={};var _0x4d8518;var _0x518dd8;return db['WhatsappAccount'][_0xc076('0x66')]({'where':{'id':_0x41da53[_0xc076('0x53')]['id']}})[_0xc076('0x1d')](handleEntityNotFound(_0x185193,null))['then'](function(_0x271014){if(_0x271014){_0x4d8518=_0x271014;_0x102a63[_0xc076('0x42')]=_[_0xc076('0x44')](db[_0xc076('0x78')]['rawAttributes']);_0x102a63['query']=_['keys'](_0x41da53[_0xc076('0x43')]);_0x102a63[_0xc076('0x45')]=_[_0xc076('0x54')](_0x102a63['model'],_0x102a63[_0xc076('0x43')]);_0x8dd026[_0xc076('0x47')]=_['intersection'](_0x102a63[_0xc076('0x42')],qs[_0xc076('0x46')](_0x41da53[_0xc076('0x43')]['fields']));_0x8dd026['attributes']=_0x8dd026['attributes']['length']?_0x8dd026[_0xc076('0x47')]:_0x102a63['model'];_0x8dd026[_0xc076('0x49')]=qs[_0xc076('0x4a')](_0x41da53[_0xc076('0x43')][_0xc076('0x4a')]);_0x8dd026[_0xc076('0x4b')]=qs[_0xc076('0x45')](_[_0xc076('0x69')](_0x41da53[_0xc076('0x43')],_0x102a63['filters']));if(_0x41da53[_0xc076('0x43')]['filter']){_0x8dd026[_0xc076('0x4b')]=_['merge'](_0x8dd026[_0xc076('0x4b')],{'$or':_[_0xc076('0x3e')](_0x8dd026[_0xc076('0x47')],function(_0x50e604){var _0x164087={};_0x164087[_0x50e604]={'$like':'%'+_0x41da53[_0xc076('0x43')][_0xc076('0x4c')]+'%'};return _0x164087;})});}_0x8dd026=_['merge']({},_0x8dd026,_0x41da53[_0xc076('0x4e')]);return _0x4d8518[_0xc076('0x79')](_0x8dd026);}})[_0xc076('0x1d')](function(_0x4c69a2){if(_0x4c69a2){_0x518dd8=_0x4c69a2[_0xc076('0x55')];if(!_0x41da53['query'][_0xc076('0x68')]('nolimit')){_0x8dd026[_0xc076('0x2d')]=qs[_0xc076('0x2d')](_0x41da53[_0xc076('0x43')][_0xc076('0x2d')]);_0x8dd026[_0xc076('0x2f')]=qs[_0xc076('0x2f')](_0x41da53[_0xc076('0x43')]['offset']);}return _0x4d8518[_0xc076('0x79')](_0x8dd026);}})[_0xc076('0x1d')](function(_0xad25cf){if(_0xad25cf){return _0xad25cf?{'count':_0x518dd8,'rows':_0xad25cf}:null;}})[_0xc076('0x1d')](respondWithResult(_0x185193,null))['catch'](handleError(_0x185193,null));};exports[_0xc076('0x7a')]=function(_0x9b4ab6,_0x1369be){var _0x2b81bb=_0x9b4ab6['params']['id'];var _0x31c22c=_0x9b4ab6[_0xc076('0x59')];var _0x212c59=0xc8;var _0x24f42b=null;return db['sequelize'][_0xc076('0x7b')]({'isolationLevel':db[_0xc076('0x7c')][_0xc076('0x7d')][_0xc076('0x7e')][_0xc076('0x7f')]},function(_0x4e31c1){return db[_0xc076('0x4f')]['findOne']({'where':{'id':_0x2b81bb},'transaction':_0x4e31c1})['then'](function(_0x2e3484){if(_0x2e3484){return db['WhatsappApplication'][_0xc076('0x35')]({'where':{'WhatsappAccountId':_0x2b81bb},'transaction':_0x4e31c1})[_0xc076('0x1d')](function(){var _0x397775=_[_0xc076('0x3e')](_0x31c22c,function(_0x5630ec){_0x5630ec[_0xc076('0x63')]=_0x2b81bb;return _0x5630ec;});return db[_0xc076('0x80')][_0xc076('0x81')](_0x397775,{'transaction':_0x4e31c1});});}else{_0x212c59=0x194;_0x24f42b=[];}});})[_0xc076('0x1d')](function(){if(_0x212c59!==0x194){return db[_0xc076('0x80')][_0xc076('0x82')]({'where':{'WhatsappAccountId':_0x2b81bb},'order':_0xc076('0x83')})['then'](function(_0x4b98e4){_0x24f42b=_0x4b98e4;});}})['catch'](function(_0x105d4d){_0x212c59=0x1f4;logger[_0xc076('0x23')](_0x105d4d['stack']);if(_0x105d4d[_0xc076('0x39')]){delete _0x105d4d[_0xc076('0x39')];}_0x24f42b=_0x105d4d;})[_0xc076('0x84')](function(){if(_0x24f42b===null){_0x1369be['sendStatus'](_0x212c59);}else{if(_0x212c59===0x1f4){_0x1369be['status'](_0x212c59)[_0xc076('0x3a')](_0x24f42b);}else{_0x1369be['status'](_0x212c59)[_0xc076('0x2b')](_0x24f42b);}}});};exports[_0xc076('0x85')]=function(_0x54634e,_0x356182,_0x4f7aac){var _0x5bc820={};var _0x162ddc={};var _0x3710b0;var _0x457559;return db[_0xc076('0x4f')][_0xc076('0x66')]({'where':{'id':_0x54634e[_0xc076('0x53')]['id']}})[_0xc076('0x1d')](handleEntityNotFound(_0x356182,null))[_0xc076('0x1d')](function(_0x3bf357){if(_0x3bf357){_0x3710b0=_0x3bf357;_0x162ddc[_0xc076('0x42')]=_['keys'](db[_0xc076('0x80')][_0xc076('0x67')]);_0x162ddc[_0xc076('0x43')]=_[_0xc076('0x44')](_0x54634e['query']);_0x162ddc[_0xc076('0x45')]=_[_0xc076('0x54')](_0x162ddc[_0xc076('0x42')],_0x162ddc[_0xc076('0x43')]);_0x5bc820[_0xc076('0x47')]=_['intersection'](_0x162ddc[_0xc076('0x42')],qs[_0xc076('0x46')](_0x54634e[_0xc076('0x43')][_0xc076('0x46')]));_0x5bc820['attributes']=_0x5bc820[_0xc076('0x47')][_0xc076('0x55')]?_0x5bc820['attributes']:_0x162ddc[_0xc076('0x42')];_0x5bc820[_0xc076('0x49')]=qs[_0xc076('0x4a')](_0x54634e[_0xc076('0x43')]['sort']);_0x5bc820['where']=qs[_0xc076('0x45')](_['pick'](_0x54634e['query'],_0x162ddc[_0xc076('0x45')]));if(_0x54634e[_0xc076('0x43')][_0xc076('0x4c')]){_0x5bc820[_0xc076('0x4b')]=_[_0xc076('0x4d')](_0x5bc820[_0xc076('0x4b')],{'$or':_[_0xc076('0x3e')](_0x5bc820[_0xc076('0x47')],function(_0x19babf){var _0x107f75={};_0x107f75[_0x19babf]={'$like':'%'+_0x54634e[_0xc076('0x43')][_0xc076('0x4c')]+'%'};return _0x107f75;})});}_0x5bc820=_[_0xc076('0x4d')]({},_0x5bc820,_0x54634e[_0xc076('0x4e')]);return _0x3710b0['getApplications'](_0x5bc820);}})[_0xc076('0x1d')](function(_0x26bf91){if(_0x26bf91){_0x457559=_0x26bf91['length'];if(!_0x54634e[_0xc076('0x43')][_0xc076('0x68')](_0xc076('0x48'))){_0x5bc820['limit']=qs[_0xc076('0x2d')](_0x54634e[_0xc076('0x43')][_0xc076('0x2d')]);_0x5bc820[_0xc076('0x2f')]=qs[_0xc076('0x2f')](_0x54634e[_0xc076('0x43')][_0xc076('0x2f')]);}return _0x3710b0[_0xc076('0x85')](_0x5bc820);}})['then'](function(_0x5b93c6){if(_0x5b93c6){return _0x5b93c6?{'count':_0x457559,'rows':_0x5b93c6}:null;}})[_0xc076('0x1d')](respondWithResult(_0x356182,null))[_0xc076('0x27')](handleError(_0x356182,null));};exports[_0xc076('0x86')]=function(_0x6eb0f6,_0xcce669,_0x2754b1){var _0x34a077={'channel':_0xc076('0x87')};var _0xd89706=[];var _0x5d35ae=[];var _0xd390b0={};return db[_0xc076('0x4f')][_0xc076('0x57')]({'where':{'id':_0x6eb0f6[_0xc076('0x53')]['id']},'include':[{'model':db['WhatsappApplication'],'as':_0xc076('0x88')}]})[_0xc076('0x1d')](handleEntityNotFound(_0xcce669,null))[_0xc076('0x1d')](function(_0x1c3a38){_0x34a077[_0xc076('0x89')]=_0x1c3a38;if(_0x34a077[_0xc076('0x89')]&&_0x34a077['account'][_0xc076('0x40')]===_0xc076('0x8a')&&_0x6eb0f6['body'][_0xc076('0x8b')]){if(_0x6eb0f6['body'][_0xc076('0x8b')][_0xc076('0x55')]===0x0)return;if(_0x6eb0f6['body']['statuses'][0x0][_0xc076('0x8c')]!==_0xc076('0x8d'))return;return db[_0xc076('0x8e')][_0xc076('0x34')]({'read':!![],'readAt':_0x6eb0f6['body']['statuses'][0x0][_0xc076('0x8f')]},{'where':{'messageId':_0x6eb0f6[_0xc076('0x59')][_0xc076('0x8b')][0x0][_0xc076('0x90')]},'individualHooks':!![]})[_0xc076('0x1d')](function(_0x52de6a){return _0xcce669[_0xc076('0x29')](0xc8)[_0xc076('0x2b')](_0x52de6a);});}_0x34a077['applications']=_['orderBy'](_0x1c3a38[_0xc076('0x88')],[_0xc076('0x83')],['asc']);if(_0x34a077[_0xc076('0x89')][_0xc076('0x88')]){delete _0x34a077['account']['Applications'];}return db[_0xc076('0x91')][_0xc076('0x61')]()[_0xc076('0x1d')](function(_0x5137a1){if(!_0x5137a1){throw new db[(_0xc076('0x92'))][(_0xc076('0x93'))]('no\x20available\x20attributes');}_0xd89706=_[_0xc076('0x94')](_['keys'](_0x5137a1),[_0xc076('0x95'),_0xc076('0x96')]);_0x5d35ae=_['difference'](_[_0xc076('0x44')](_0x5137a1),[_0xc076('0x95'),_0xc076('0x96'),_0xc076('0x97'),_0xc076('0x98')]);_0x34a077['body']={'mapKey':'mobile'};if(_0x34a077[_0xc076('0x89')]&&_0x34a077[_0xc076('0x89')][_0xc076('0x40')]==='twilio'){_0x34a077[_0xc076('0x59')][_0xc076('0x99')]=_0x6eb0f6['body']['From']['replace']('whatsapp:','');_0x34a077[_0xc076('0x59')][_0xc076('0x59')]=_0x6eb0f6[_0xc076('0x59')]['Body'];_0x34a077[_0xc076('0x59')][_0xc076('0x9a')]=_0x6eb0f6[_0xc076('0x59')]['MessageSid'];}if(_0x34a077[_0xc076('0x89')]&&_0x34a077[_0xc076('0x89')][_0xc076('0x40')]===_0xc076('0x8a')){_0x34a077[_0xc076('0x59')][_0xc076('0x99')]=_0x6eb0f6[_0xc076('0x59')][_0xc076('0x9b')][0x0][_0xc076('0x99')];_0x34a077[_0xc076('0x59')][_0xc076('0x59')]=_0x6eb0f6[_0xc076('0x59')]['notifications'][0x0][_0xc076('0x25')][_0xc076('0x59')];_0x34a077[_0xc076('0x59')][_0xc076('0x9a')]=_0x6eb0f6[_0xc076('0x59')][_0xc076('0x9b')][0x0][_0xc076('0x90')];}if(_0x34a077['body']['id']){delete _0x34a077['body']['id'];}if(_[_0xc076('0x9c')](_0x34a077['body'][_0xc076('0x99')])){throw new db[(_0xc076('0x92'))][(_0xc076('0x93'))](_0xc076('0x9d'));}if(_['isNil'](_0x34a077['body'][_0xc076('0x59')])||_0x34a077[_0xc076('0x59')]['body']===''){throw new db[(_0xc076('0x92'))][(_0xc076('0x93'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xc076('0x9c')](_0x34a077['body'][_0xc076('0x9e')])){throw new db[(_0xc076('0x92'))][(_0xc076('0x93'))](_0xc076('0x9f')+_0x5d35ae);}if(!_[_0xc076('0xa0')](_0x5d35ae,_0x34a077[_0xc076('0x59')][_0xc076('0x9e')])){throw new db['Sequelize']['ValidationError'](_0xc076('0xa1')+_0x5d35ae);}_0xd390b0[_0x34a077[_0xc076('0x59')][_0xc076('0x9e')]]=_0x34a077[_0xc076('0x59')][_0xc076('0x99')];return db[_0xc076('0xa2')]['find']({'where':{'id':_0x34a077['account'][_0xc076('0x98')]},'include':[{'model':db[_0xc076('0x91')],'as':_0xc076('0xa3'),'where':_0xd390b0,'limit':0x1,'order':[[_0xc076('0x96'),'DESC']]}]});})[_0xc076('0x1d')](handleEntityNotFound(_0xcce669,null))[_0xc076('0x1d')](function(_0x2436c2){if(_0x2436c2){_0x34a077[_0xc076('0xa4')]=_[_0xc076('0x72')](_0x2436c2,[_0xc076('0xa3')]);if(_0x2436c2[_0xc076('0xa3')][_0xc076('0x55')]){return _0x2436c2[_0xc076('0xa3')][0x0];}var _0x26f11c=_[_0xc076('0x15')](_0x34a077[_0xc076('0x59')],{'firstName':_0x34a077['body'][_0xc076('0x99')],'ListId':_0x2436c2['id']});_0x26f11c[_0x34a077[_0xc076('0x59')][_0xc076('0x9e')]]=_0x34a077[_0xc076('0x59')][_0xc076('0x99')];return db[_0xc076('0x91')]['create'](_0x26f11c,{'fields':_0xd89706,'raw':!![]});}})[_0xc076('0x1d')](handleEntityNotFound(_0xcce669,null))[_0xc076('0x1d')](function(_0x62e4e2){if(_0x62e4e2){_0x34a077['contact']=_0x62e4e2;var _0x16ced2={'ContactId':_0x62e4e2['id'],'phone':_0x34a077['body'][_0xc076('0x99')],'WhatsappAccountId':_0x6eb0f6[_0xc076('0x53')]['id']};var _0x31549f={'ContactId':_0x62e4e2['id'],'WhatsappAccountId':_0x6eb0f6[_0xc076('0x53')]['id'],'closed':![]};return db[_0xc076('0xa5')][_0xc076('0x57')]({'where':_0x31549f})[_0xc076('0x1d')](function(_0x44fa8d){if(_0x44fa8d){return[_0x44fa8d,![]];}return db[_0xc076('0xa5')][_0xc076('0x58')](_0x16ced2)[_0xc076('0x1d')](function(_0x8befee){return[_0x8befee,!![]];});});}})['spread'](function(_0x32807b,_0x77a8a6){_0x34a077[_0xc076('0xa6')]=_0x32807b[_0xc076('0x36')]({'plain':!![]});_0x34a077[_0xc076('0xa6')]['created']=![];if(_0x77a8a6){if(_0x34a077[_0xc076('0x89')]['autoclose']){_0x34a077[_0xc076('0xa7')][_0xc076('0xa8')]({'id':0x0,'priority':_0x34a077[_0xc076('0xa7')][_0xc076('0x55')]+0x1,'app':_0xc076('0xa9'),'appdata':'unmanaged','interval':'*,*,*,*'});}_0x34a077[_0xc076('0xa6')]['created']=!![];}return db[_0xc076('0x8e')][_0xc076('0x58')]({'phone':_0x34a077[_0xc076('0x59')][_0xc076('0x99')],'messageId':_0x34a077['body'][_0xc076('0x9a')],'body':_0x34a077['body'][_0xc076('0x59')],'WhatsappAccountId':_0x6eb0f6[_0xc076('0x53')]['id'],'WhatsappInteractionId':_0x32807b['id'],'direction':'in','ContactId':_0x32807b[_0xc076('0xaa')],'AttachmentId':_0x34a077[_0xc076('0x59')][_0xc076('0xab')]});})[_0xc076('0x1d')](function(_0x1f16bb){_0x34a077['message']=_0x1f16bb;if(!_0x34a077[_0xc076('0xa6')][_0xc076('0xac')])return;return db['User'][_0xc076('0x57')]({'attributes':['id','name'],'where':{'id':_0x34a077[_0xc076('0xa6')]['UserId']}});})[_0xc076('0x1d')](function(_0x1c67b4){if(_0x1c67b4){_0x34a077['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0xc076('0xad'),'appdata':_0x1c67b4[_0xc076('0x39')]+','+(_0x34a077['account'][_0xc076('0xae')]||0xa),'interval':_0xc076('0xaf')});}if(!_0x34a077[_0xc076('0xa6')][_0xc076('0xb0')])return;return db[_0xc076('0xb1')][_0xc076('0x57')]({'attributes':['id','name'],'where':{'id':_0x34a077[_0xc076('0xa6')][_0xc076('0xb0')]}});})['then'](function(_0x76fd7d){if(_0x76fd7d){_0x34a077['applications'][_0xc076('0xb2')]({'id':0x0,'priority':0x1,'app':_0xc076('0xb3'),'appdata':_0x76fd7d[_0xc076('0x39')]+','+(_0x34a077[_0xc076('0x89')][_0xc076('0xb4')]||0x12c),'interval':_0xc076('0xaf')});}return respondWithRpcPromise(_0xc076('0xb5'),_0xc076('0xb6'),_0x34a077);})['then'](function(_0x33c798){if(_0x33c798){var _0x2c08f2=0xc8;var _0x3aaaeb=_0xc076('0xb7');logger['info'](_0xc076('0xb8'),_0x3aaaeb,_0x2c08f2,_0xc076('0xb9'));logger[_0xc076('0x21')]('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x3aaaeb,_0x2c08f2,_0xc076('0xb9'),JSON[_0xc076('0x22')](_0x33c798));if(_0x34a077[_0xc076('0x89')][_0xc076('0x40')]===_0xc076('0xba')){return _0xcce669['status'](_0x2c08f2)['set'](_0xc076('0xbb'),_0xc076('0xbc'))[_0xc076('0x3a')](_0xc076('0xbd'));}else{return _0xcce669[_0xc076('0x29')](_0x2c08f2)['json'](_0x33c798);}}});})['catch'](handleError(_0xcce669,null));};exports['send']=function(_0x383151,_0x29fe40,_0x52c361){var _0x2df3f8,_0x480907,_0x15c56d;if(_[_0xc076('0x9c')](_0x383151[_0xc076('0x59')][_0xc076('0x59')])||_0x383151[_0xc076('0x59')]['body']===''){throw new db[(_0xc076('0x92'))][(_0xc076('0x93'))](_0xc076('0xbe'));}if(_[_0xc076('0x9c')](_0x383151[_0xc076('0x59')]['to'])){throw new db[(_0xc076('0x92'))][(_0xc076('0x93'))](_0xc076('0xbf'));}_0x2df3f8=_0x383151[_0xc076('0x59')]['to'];return db[_0xc076('0x4f')][_0xc076('0x57')]({'where':{'id':_0x383151['params']['id']},'include':[{'model':db['CmList'],'as':_0xc076('0xc0'),'include':[{'model':db['CmContact'],'as':_0xc076('0xa3'),'where':{'mobile':_0x2df3f8},'limit':0x1,'order':[[_0xc076('0x96'),_0xc076('0xc1')]]}]}]})[_0xc076('0x1d')](handleEntityNotFound(_0x29fe40,null))[_0xc076('0x1d')](function(_0x365246){if(_0x365246&&_0x365246[_0xc076('0xc0')]){_0x480907=_0x365246['get']({'plain':!![]});if(_0x480907[_0xc076('0xc0')]&&_0x480907[_0xc076('0xc0')][_0xc076('0xa3')][_0xc076('0x55')]){return _0x480907[_0xc076('0xc0')][_0xc076('0xa3')][0x0];}return db[_0xc076('0x91')][_0xc076('0x58')](_[_0xc076('0x15')](_0x383151[_0xc076('0x59')],{'firstName':_0x2df3f8,'mobile':_0x2df3f8,'phone':_0x2df3f8,'ListId':_0x480907[_0xc076('0x98')]}));}})['then'](handleEntityNotFound(_0x29fe40,null))[_0xc076('0x1d')](function(_0x2dec4e){if(_0x2dec4e){_0x15c56d=_0x2dec4e;return db[_0xc076('0xa5')][_0xc076('0x57')]({'where':{'ContactId':_0x15c56d['id'],'closed':![],'WhatsappAccountId':_0x480907['id']}})[_0xc076('0x1d')](function(_0x50f132){if(_0x50f132){return[_0x50f132,![]];}return db[_0xc076('0xa5')][_0xc076('0x58')]({'UserId':_0x383151[_0xc076('0x5a')]['id'],'ContactId':_0x15c56d['id'],'WhatsappAccountId':_0x480907['id'],'phone':_0x2df3f8,'firstMsgDirection':'out','Messages':[_[_0xc076('0x4d')](_0x383151[_0xc076('0x59')],{'read':![],'body':_0x383151['body'][_0xc076('0x59')],'phone':_0x2df3f8,'WhatsappAccountId':_0x480907['id'],'UserId':_0x383151[_0xc076('0x5a')]['id'],'ContactId':_0x15c56d['id']})]},{'include':[{'model':db[_0xc076('0x8e')],'as':_0xc076('0xc2')}]})[_0xc076('0x1d')](function(_0x152c5d){return[_0x152c5d,!![]];});});}})[_0xc076('0xc3')](function(_0x1241f4,_0x177426){if(_0x177426){return _0x1241f4;}return db['WhatsappMessage'][_0xc076('0x58')](_[_0xc076('0x4d')](_0x383151[_0xc076('0x59')],{'read':![],'body':_0x383151[_0xc076('0x59')][_0xc076('0x59')],'phone':_0x2df3f8,'WhatsappAccountId':_0x480907['id'],'WhatsappInteractionId':_0x1241f4['id'],'UserId':_0x383151[_0xc076('0x5a')]['id'],'ContactId':_0x15c56d['id']}))[_0xc076('0x1d')](function(_0x30d153){_0x1241f4[_0xc076('0xc4')][_0xc076('0xc2')]=[];_0x1241f4[_0xc076('0xc4')]['Messages'][_0xc076('0xa8')](_0x30d153['dataValues']);return _0x1241f4;});})[_0xc076('0x1d')](respondWithResult(_0x29fe40,null))[_0xc076('0x27')](handleError(_0x29fe40,null));}; \ No newline at end of file +var _0x9ffd=['./whatsappAccount.socket','jayson/promise','client','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','WhatsappAccounts','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','options','WhatsappAccount','includeAll','include','rows','catch','params','find','create','body','user','get','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','WhatsappAccountId','findOne','pick','Disposition','findAll','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','merge','removeAnswers','addAgents','omit','emit','isArray','userWhatsappAccount:remove','User','getAgents','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','findAndCountAll','priority','finally','getApplications','notify','Applications','account','sinch','statuses','state','read','WhatsappMessage','timestamp','message_id','applications','asc','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','twilio','from','From','replace','Body','MessageSid','notifications','messageId','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','CmContact','DESC','Contacts','WhatsappInteraction','spread','interaction','created','autoclose','push','close','ContactId','AttachmentId','UserId','unshift','agent','*,*,*,*','queueId','WhatsappQueue','queue','waitForTheAssignedQueue','Start','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','text/xml','\x0a','List','defaults','out','Messages','dataValues','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter'];(function(_0x536758,_0x4876cc){var _0x29a3b6=function(_0x46c17c){while(--_0x46c17c){_0x536758['push'](_0x536758['shift']());}};_0x29a3b6(++_0x4876cc);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x5d64b5,_0x25d107){_0x5d64b5=_0x5d64b5-0x0;var _0x46aa9b=_0x9ffd[_0x5d64b5];return _0x46aa9b;};'use strict';var emlformat=require(_0xd9ff('0x0'));var rimraf=require(_0xd9ff('0x1'));var zipdir=require(_0xd9ff('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd9ff('0x3'));var moment=require(_0xd9ff('0x4'));var BPromise=require(_0xd9ff('0x5'));var Mustache=require(_0xd9ff('0x6'));var util=require('util');var path=require(_0xd9ff('0x7'));var sox=require(_0xd9ff('0x8'));var csv=require('to-csv');var ejs=require(_0xd9ff('0x9'));var fs=require('fs');var fs_extra=require(_0xd9ff('0xa'));var _=require(_0xd9ff('0xb'));var squel=require(_0xd9ff('0xc'));var crypto=require(_0xd9ff('0xd'));var jsforce=require(_0xd9ff('0xe'));var deskjs=require(_0xd9ff('0xf'));var toCsv=require(_0xd9ff('0x10'));var querystring=require(_0xd9ff('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd9ff('0x12'));var hardwareService=require(_0xd9ff('0x13'));var logger=require(_0xd9ff('0x14'))(_0xd9ff('0x15'));var utils=require(_0xd9ff('0x16'));var config=require(_0xd9ff('0x17'));var licenseUtil=require(_0xd9ff('0x18'));var db=require(_0xd9ff('0x19'))['db'];config['redis']=_['defaults'](config[_0xd9ff('0x1a')],{'host':_0xd9ff('0x1b'),'port':0x18eb});var socket=require(_0xd9ff('0x1c'))(new Redis(config[_0xd9ff('0x1a')]));require(_0xd9ff('0x1d'))['register'](socket);var jayson=require(_0xd9ff('0x1e'));var client=jayson[_0xd9ff('0x1f')]['http']({'port':0x232c});function respondWithRpcPromise(_0xf14c9f,_0x5db010,_0x4ffe54,_0x547e28){return new BPromise(function(_0x4c5718,_0x271287){var _0x4f9d6d=_0x547e28||client;return _0x4f9d6d[_0xd9ff('0x20')](_0xf14c9f,_0x4ffe54)[_0xd9ff('0x21')](function(_0x39c6ce){logger[_0xd9ff('0x22')](_0xd9ff('0x23'),_0x5db010,_0xd9ff('0x24'));logger[_0xd9ff('0x25')](_0xd9ff('0x26'),_0x5db010,_0xd9ff('0x24'),JSON[_0xd9ff('0x27')](_0x39c6ce));if(_0x39c6ce[_0xd9ff('0x28')]){if(_0x39c6ce[_0xd9ff('0x28')][_0xd9ff('0x29')]===0x1f4){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x5db010,_0x39c6ce[_0xd9ff('0x28')][_0xd9ff('0x2a')]);return _0x271287(_0x39c6ce['error']['message']);}logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x5db010,_0x39c6ce[_0xd9ff('0x28')]['message']);return _0x4c5718(_0x39c6ce[_0xd9ff('0x28')][_0xd9ff('0x2a')]);}else{logger[_0xd9ff('0x22')](_0xd9ff('0x23'),_0x5db010,_0xd9ff('0x24'));_0x4c5718(_0x39c6ce[_0xd9ff('0x2b')]['message']);}})['catch'](function(_0x1136e9){logger['error'](_0xd9ff('0x23'),_0x5db010,_0x1136e9);_0x271287(_0x1136e9);});});}function respondWithStatusCode(_0x4d86fe,_0x285002){_0x285002=_0x285002||0xcc;return function(_0x5d45b3){if(_0x5d45b3){return _0x4d86fe[_0xd9ff('0x2c')](_0x285002);}return _0x4d86fe[_0xd9ff('0x2d')](_0x285002)[_0xd9ff('0x2e')]();};}function respondWithResult(_0x2970e8,_0x5d685e){_0x5d685e=_0x5d685e||0xc8;return function(_0x11a17b){if(_0x11a17b){return _0x2970e8[_0xd9ff('0x2d')](_0x5d685e)[_0xd9ff('0x2f')](_0x11a17b);}};}function respondWithFilteredResult(_0x4390f7,_0x5c1c1f){return function(_0x1d3684){if(_0x1d3684){var _0x3792d9=typeof _0x5c1c1f[_0xd9ff('0x30')]===_0xd9ff('0x31')&&typeof _0x5c1c1f[_0xd9ff('0x32')]===_0xd9ff('0x31');var _0x420ffa=_0x1d3684[_0xd9ff('0x33')];var _0x3dc443=_0x3792d9?0x0:_0x5c1c1f['offset'];var _0xcea5db=_0x3792d9?_0x1d3684['count']:_0x5c1c1f[_0xd9ff('0x30')]+_0x5c1c1f[_0xd9ff('0x32')];var _0xbdd352;if(_0xcea5db>=_0x420ffa){_0xcea5db=_0x420ffa;_0xbdd352=0xc8;}else{_0xbdd352=0xce;}_0x4390f7['status'](_0xbdd352);return _0x4390f7[_0xd9ff('0x34')](_0xd9ff('0x35'),_0x3dc443+'-'+_0xcea5db+'/'+_0x420ffa)[_0xd9ff('0x2f')](_0x1d3684);}return null;};}function patchUpdates(_0x436a55){return function(_0x509291){try{jsonpatch[_0xd9ff('0x36')](_0x509291,_0x436a55,!![]);}catch(_0x5743de){return BPromise[_0xd9ff('0x37')](_0x5743de);}return _0x509291[_0xd9ff('0x38')]();};}function saveUpdates(_0x323cb5,_0x206424){return function(_0x20685b){if(_0x20685b){return _0x20685b[_0xd9ff('0x39')](_0x323cb5)[_0xd9ff('0x21')](function(_0x281c7b){return _0x281c7b;});}return null;};}function removeEntity(_0x36749c,_0x190fac){return function(_0x4813a5){if(_0x4813a5){return _0x4813a5[_0xd9ff('0x3a')]()[_0xd9ff('0x21')](function(){var _0x66f4d=_0x4813a5['get']({'plain':!![]});var _0x13322f=_0xd9ff('0x3b');return db[_0xd9ff('0x3c')]['destroy']({'where':{'type':_0x13322f,'resourceId':_0x66f4d['id']}})[_0xd9ff('0x21')](function(){return _0x4813a5;});})['then'](function(){_0x36749c[_0xd9ff('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x20a021,_0x5db498){return function(_0x1a6c4d){if(!_0x1a6c4d){_0x20a021[_0xd9ff('0x2c')](0x194);}return _0x1a6c4d;};}function handleError(_0x11566b,_0x5e2391){_0x5e2391=_0x5e2391||0x1f4;return function(_0x4db3f6){logger['error'](_0x4db3f6[_0xd9ff('0x3d')]);if(_0x4db3f6[_0xd9ff('0x3e')]){delete _0x4db3f6[_0xd9ff('0x3e')];}_0x11566b[_0xd9ff('0x2d')](_0x5e2391)[_0xd9ff('0x3f')](_0x4db3f6);};}exports[_0xd9ff('0x40')]=function(_0x596d29,_0x4c00c2){var _0x4a9804={'include':[{'model':db[_0xd9ff('0x41')],'as':_0xd9ff('0x42')}]},_0x316d93={},_0x252edc={'count':0x0,'rows':[]};var _0x56b94d=_[_0xd9ff('0x43')](db['WhatsappAccount'][_0xd9ff('0x44')],function(_0x3e2beb){return{'name':_0x3e2beb[_0xd9ff('0x45')],'type':_0x3e2beb[_0xd9ff('0x46')]['key']};});_0x316d93[_0xd9ff('0x47')]=_[_0xd9ff('0x43')](_0x56b94d,'name');_0x316d93[_0xd9ff('0x48')]=_[_0xd9ff('0x49')](_0x596d29[_0xd9ff('0x48')]);_0x316d93[_0xd9ff('0x4a')]=_[_0xd9ff('0x4b')](_0x316d93[_0xd9ff('0x47')],_0x316d93['query']);_0x4a9804[_0xd9ff('0x4c')]=_[_0xd9ff('0x4b')](_0x316d93[_0xd9ff('0x47')],qs[_0xd9ff('0x4d')](_0x596d29[_0xd9ff('0x48')]['fields']));_0x4a9804[_0xd9ff('0x4c')]=_0x4a9804[_0xd9ff('0x4c')][_0xd9ff('0x4e')]?_0x4a9804['attributes']:_0x316d93['model'];if(!_0x596d29[_0xd9ff('0x48')][_0xd9ff('0x4f')](_0xd9ff('0x50'))){_0x4a9804[_0xd9ff('0x32')]=qs[_0xd9ff('0x32')](_0x596d29[_0xd9ff('0x48')]['limit']);_0x4a9804[_0xd9ff('0x30')]=qs[_0xd9ff('0x30')](_0x596d29['query'][_0xd9ff('0x30')]);}_0x4a9804[_0xd9ff('0x51')]=qs[_0xd9ff('0x52')](_0x596d29[_0xd9ff('0x48')][_0xd9ff('0x52')]);_0x4a9804['where']=qs['filters'](_['pick'](_0x596d29[_0xd9ff('0x48')],_0x316d93['filters']),_0x56b94d);if(_0x596d29[_0xd9ff('0x48')][_0xd9ff('0x53')]){_0x4a9804[_0xd9ff('0x54')]=_['merge'](_0x4a9804[_0xd9ff('0x54')],{'$or':_[_0xd9ff('0x43')](_0x56b94d,function(_0x536a3b){if(_0x536a3b[_0xd9ff('0x46')]!==_0xd9ff('0x55')){var _0x23b224={};_0x23b224[_0x536a3b[_0xd9ff('0x3e')]]={'$like':'%'+_0x596d29['query'][_0xd9ff('0x53')]+'%'};return _0x23b224;}})});}_0x4a9804=_['merge']({},_0x4a9804,_0x596d29[_0xd9ff('0x56')]);var _0x4dc0ae={'where':_0x4a9804[_0xd9ff('0x54')]};return db[_0xd9ff('0x57')][_0xd9ff('0x33')](_0x4dc0ae)[_0xd9ff('0x21')](function(_0xf21b7d){_0x252edc['count']=_0xf21b7d;if(_0x596d29[_0xd9ff('0x48')][_0xd9ff('0x58')]){_0x4a9804[_0xd9ff('0x59')]=[{'all':!![]}];}return db[_0xd9ff('0x57')]['findAll'](_0x4a9804);})['then'](function(_0x4c22dc){_0x252edc[_0xd9ff('0x5a')]=_0x4c22dc;return _0x252edc;})[_0xd9ff('0x21')](respondWithFilteredResult(_0x4c00c2,_0x4a9804))[_0xd9ff('0x5b')](handleError(_0x4c00c2,null));};exports['show']=function(_0x136bac,_0x61eec4){var _0x6d1082={'raw':![],'where':{'id':_0x136bac[_0xd9ff('0x5c')]['id']},'include':[{'model':db[_0xd9ff('0x41')],'as':_0xd9ff('0x42')}]},_0x25268e={};_0x25268e[_0xd9ff('0x47')]=_[_0xd9ff('0x49')](db[_0xd9ff('0x57')][_0xd9ff('0x44')]);_0x25268e[_0xd9ff('0x48')]=_[_0xd9ff('0x49')](_0x136bac['query']);_0x25268e[_0xd9ff('0x4a')]=_['intersection'](_0x25268e[_0xd9ff('0x47')],_0x25268e['query']);_0x6d1082[_0xd9ff('0x4c')]=_['intersection'](_0x25268e[_0xd9ff('0x47')],qs['fields'](_0x136bac[_0xd9ff('0x48')]['fields']));_0x6d1082[_0xd9ff('0x4c')]=_0x6d1082['attributes'][_0xd9ff('0x4e')]?_0x6d1082['attributes']:_0x25268e[_0xd9ff('0x47')];if(_0x136bac[_0xd9ff('0x48')][_0xd9ff('0x58')]){_0x6d1082[_0xd9ff('0x59')]=[{'all':!![]}];}_0x6d1082=_['merge']({},_0x6d1082,_0x136bac[_0xd9ff('0x56')]);return db[_0xd9ff('0x57')][_0xd9ff('0x5d')](_0x6d1082)['then'](handleEntityNotFound(_0x61eec4,null))[_0xd9ff('0x21')](respondWithResult(_0x61eec4,null))[_0xd9ff('0x5b')](handleError(_0x61eec4,null));};exports[_0xd9ff('0x5e')]=function(_0x2e29aa,_0x11dd0c){return db['WhatsappAccount'][_0xd9ff('0x5e')](_0x2e29aa[_0xd9ff('0x5f')],{})[_0xd9ff('0x21')](function(_0x5eddc1){var _0x29f36e=_0x2e29aa[_0xd9ff('0x60')][_0xd9ff('0x61')]({'plain':!![]});if(!_0x29f36e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x29f36e[_0xd9ff('0x62')]===_0xd9ff('0x60')){var _0x561a9b=_0x5eddc1[_0xd9ff('0x61')]({'plain':!![]});var _0x17c1b2='WhatsappAccounts';return db[_0xd9ff('0x63')][_0xd9ff('0x5d')]({'where':{'name':_0x17c1b2,'userProfileId':_0x29f36e[_0xd9ff('0x64')]},'raw':!![]})['then'](function(_0x4ea9c6){if(_0x4ea9c6&&_0x4ea9c6[_0xd9ff('0x65')]===0x0){return db['UserProfileResource'][_0xd9ff('0x5e')]({'name':_0x561a9b[_0xd9ff('0x3e')],'resourceId':_0x561a9b['id'],'type':_0x4ea9c6[_0xd9ff('0x3e')],'sectionId':_0x4ea9c6['id']},{})[_0xd9ff('0x21')](function(){return _0x5eddc1;});}else{return _0x5eddc1;}})['catch'](function(_0x543f5f){logger['error'](_0xd9ff('0x66'),_0x543f5f);throw _0x543f5f;});}return _0x5eddc1;})[_0xd9ff('0x21')](respondWithResult(_0x11dd0c,0xc9))[_0xd9ff('0x5b')](handleError(_0x11dd0c,null));};exports[_0xd9ff('0x39')]=function(_0x27dad3,_0x5b14fc){if(_0x27dad3[_0xd9ff('0x5f')]['id']){delete _0x27dad3['body']['id'];}return db[_0xd9ff('0x57')][_0xd9ff('0x5d')]({'where':{'id':_0x27dad3[_0xd9ff('0x5c')]['id']},'include':[{'model':db[_0xd9ff('0x41')],'as':_0xd9ff('0x42')}]})[_0xd9ff('0x21')](handleEntityNotFound(_0x5b14fc,null))[_0xd9ff('0x21')](saveUpdates(_0x27dad3[_0xd9ff('0x5f')],null))['then'](respondWithResult(_0x5b14fc,null))[_0xd9ff('0x5b')](handleError(_0x5b14fc,null));};exports[_0xd9ff('0x3a')]=function(_0x4f5338,_0x4a9902){return db[_0xd9ff('0x57')]['find']({'where':{'id':_0x4f5338[_0xd9ff('0x5c')]['id']}})[_0xd9ff('0x21')](handleEntityNotFound(_0x4a9902,null))['then'](removeEntity(_0x4a9902,null))[_0xd9ff('0x5b')](handleError(_0x4a9902,null));};exports[_0xd9ff('0x67')]=function(_0x54aca7,_0x16f68d){return db[_0xd9ff('0x57')]['describe']()[_0xd9ff('0x21')](respondWithResult(_0x16f68d,null))['catch'](handleError(_0x16f68d,null));};exports['addDisposition']=function(_0x3dabb1,_0x14e5a5,_0x1a08a9){if(_0x3dabb1[_0xd9ff('0x5f')]['id']){delete _0x3dabb1['body']['id'];}return db[_0xd9ff('0x57')][_0xd9ff('0x5d')]({'where':{'id':_0x3dabb1[_0xd9ff('0x5c')]['id']}})[_0xd9ff('0x21')](handleEntityNotFound(_0x14e5a5,null))[_0xd9ff('0x21')](function(_0x255edf){if(_0x255edf){_0x3dabb1[_0xd9ff('0x5f')][_0xd9ff('0x68')]=_0x255edf['id'];return db['Disposition']['create'](_0x3dabb1['body']);}})[_0xd9ff('0x21')](respondWithResult(_0x14e5a5,null))[_0xd9ff('0x5b')](handleError(_0x14e5a5,null));};exports['getDispositions']=function(_0x196670,_0x4697a9,_0xb40582){var _0xd42dcb={'raw':![],'where':{}};var _0x17884a={};var _0x471e03={'count':0x0,'rows':[]};return db[_0xd9ff('0x57')][_0xd9ff('0x69')]({'where':{'id':_0x196670['params']['id']}})[_0xd9ff('0x21')](handleEntityNotFound(_0x4697a9,null))[_0xd9ff('0x21')](function(_0x228413){if(_0x228413){_0x17884a['model']=_[_0xd9ff('0x49')](db['Disposition'][_0xd9ff('0x44')]);_0x17884a[_0xd9ff('0x48')]=_[_0xd9ff('0x49')](_0x196670['query']);_0x17884a[_0xd9ff('0x4a')]=_[_0xd9ff('0x4b')](_0x17884a[_0xd9ff('0x47')],_0x17884a[_0xd9ff('0x48')]);_0xd42dcb['attributes']=_[_0xd9ff('0x4b')](_0x17884a[_0xd9ff('0x47')],qs[_0xd9ff('0x4d')](_0x196670['query'][_0xd9ff('0x4d')]));_0xd42dcb[_0xd9ff('0x4c')]=_0xd42dcb[_0xd9ff('0x4c')]['length']?_0xd42dcb[_0xd9ff('0x4c')]:_0x17884a[_0xd9ff('0x47')];if(!_0x196670[_0xd9ff('0x48')][_0xd9ff('0x4f')](_0xd9ff('0x50'))){_0xd42dcb['limit']=qs[_0xd9ff('0x32')](_0x196670[_0xd9ff('0x48')]['limit']);_0xd42dcb[_0xd9ff('0x30')]=qs[_0xd9ff('0x30')](_0x196670[_0xd9ff('0x48')]['offset']);}_0xd42dcb[_0xd9ff('0x51')]=qs['sort'](_0x196670[_0xd9ff('0x48')]['sort']);_0xd42dcb[_0xd9ff('0x54')]=qs[_0xd9ff('0x4a')](_[_0xd9ff('0x6a')](_0x196670[_0xd9ff('0x48')],_0x17884a[_0xd9ff('0x4a')]));_0xd42dcb[_0xd9ff('0x54')][_0xd9ff('0x68')]=_0x228413['id'];if(_0x196670[_0xd9ff('0x48')][_0xd9ff('0x53')]){_0xd42dcb[_0xd9ff('0x54')]=_['merge'](_0xd42dcb[_0xd9ff('0x54')],{'$or':_[_0xd9ff('0x43')](_0xd42dcb[_0xd9ff('0x4c')],function(_0x170fe1){var _0xad8e5b={};_0xad8e5b[_0x170fe1]={'$like':'%'+_0x196670[_0xd9ff('0x48')]['filter']+'%'};return _0xad8e5b;})});}_0xd42dcb=_['merge']({},_0xd42dcb,_0x196670[_0xd9ff('0x56')]);return db[_0xd9ff('0x6b')][_0xd9ff('0x33')]({'where':_0xd42dcb[_0xd9ff('0x54')]})[_0xd9ff('0x21')](function(_0x183199){_0x471e03['count']=_0x183199;if(_0x196670[_0xd9ff('0x48')][_0xd9ff('0x58')]){_0xd42dcb[_0xd9ff('0x59')]=[{'all':!![]}];}return db[_0xd9ff('0x6b')][_0xd9ff('0x6c')](_0xd42dcb);})[_0xd9ff('0x21')](function(_0x498544){_0x471e03[_0xd9ff('0x5a')]=_0x498544;return _0x471e03;});}})[_0xd9ff('0x21')](respondWithFilteredResult(_0x4697a9,_0xd42dcb))[_0xd9ff('0x5b')](handleError(_0x4697a9,null));};exports[_0xd9ff('0x6d')]=function(_0x373a32,_0x1e1d1b,_0x1c4fb6){return db[_0xd9ff('0x57')]['find']({'where':{'id':_0x373a32[_0xd9ff('0x5c')]['id']}})['then'](handleEntityNotFound(_0x1e1d1b,null))[_0xd9ff('0x21')](function(_0x304d1e){if(_0x304d1e){return _0x304d1e[_0xd9ff('0x6d')](_0x373a32[_0xd9ff('0x48')][_0xd9ff('0x6e')]);}})[_0xd9ff('0x21')](respondWithStatusCode(_0x1e1d1b,null))[_0xd9ff('0x5b')](handleError(_0x1e1d1b,null));};exports[_0xd9ff('0x6f')]=function(_0x2492fa,_0x120742,_0x44b20b){if(_0x2492fa[_0xd9ff('0x5f')]['id']){delete _0x2492fa[_0xd9ff('0x5f')]['id'];}return db['WhatsappAccount'][_0xd9ff('0x5d')]({'where':{'id':_0x2492fa[_0xd9ff('0x5c')]['id']}})[_0xd9ff('0x21')](handleEntityNotFound(_0x120742,null))[_0xd9ff('0x21')](function(_0x4c9b1b){if(_0x4c9b1b){_0x2492fa[_0xd9ff('0x5f')][_0xd9ff('0x68')]=_0x4c9b1b['id'];return db['CannedAnswer'][_0xd9ff('0x5e')](_0x2492fa[_0xd9ff('0x5f')]);}})[_0xd9ff('0x21')](respondWithResult(_0x120742,null))[_0xd9ff('0x5b')](handleError(_0x120742,null));};exports[_0xd9ff('0x70')]=function(_0x6b2b42,_0x372747,_0x47e5fc){var _0x3ac557={'raw':![],'where':{}};var _0x4dcadb={};var _0x3b925f={'count':0x0,'rows':[]};return db[_0xd9ff('0x57')][_0xd9ff('0x69')]({'where':{'id':_0x6b2b42[_0xd9ff('0x5c')]['id']}})[_0xd9ff('0x21')](handleEntityNotFound(_0x372747,null))[_0xd9ff('0x21')](function(_0x2226bf){if(_0x2226bf){_0x4dcadb[_0xd9ff('0x47')]=_[_0xd9ff('0x49')](db[_0xd9ff('0x71')][_0xd9ff('0x44')]);_0x4dcadb['query']=_[_0xd9ff('0x49')](_0x6b2b42[_0xd9ff('0x48')]);_0x4dcadb['filters']=_[_0xd9ff('0x4b')](_0x4dcadb[_0xd9ff('0x47')],_0x4dcadb[_0xd9ff('0x48')]);_0x3ac557[_0xd9ff('0x4c')]=_[_0xd9ff('0x4b')](_0x4dcadb[_0xd9ff('0x47')],qs['fields'](_0x6b2b42['query'][_0xd9ff('0x4d')]));_0x3ac557['attributes']=_0x3ac557['attributes']['length']?_0x3ac557['attributes']:_0x4dcadb[_0xd9ff('0x47')];if(!_0x6b2b42[_0xd9ff('0x48')][_0xd9ff('0x4f')]('nolimit')){_0x3ac557['limit']=qs[_0xd9ff('0x32')](_0x6b2b42['query'][_0xd9ff('0x32')]);_0x3ac557['offset']=qs[_0xd9ff('0x30')](_0x6b2b42[_0xd9ff('0x48')][_0xd9ff('0x30')]);}_0x3ac557[_0xd9ff('0x51')]=qs[_0xd9ff('0x52')](_0x6b2b42['query']['sort']);_0x3ac557[_0xd9ff('0x54')]=qs[_0xd9ff('0x4a')](_[_0xd9ff('0x6a')](_0x6b2b42[_0xd9ff('0x48')],_0x4dcadb[_0xd9ff('0x4a')]));_0x3ac557['where'][_0xd9ff('0x68')]=_0x2226bf['id'];if(_0x6b2b42[_0xd9ff('0x48')][_0xd9ff('0x53')]){_0x3ac557[_0xd9ff('0x54')]=_[_0xd9ff('0x72')](_0x3ac557[_0xd9ff('0x54')],{'$or':_[_0xd9ff('0x43')](_0x3ac557[_0xd9ff('0x4c')],function(_0x28ba2c){var _0x41b7e3={};_0x41b7e3[_0x28ba2c]={'$like':'%'+_0x6b2b42[_0xd9ff('0x48')][_0xd9ff('0x53')]+'%'};return _0x41b7e3;})});}_0x3ac557=_[_0xd9ff('0x72')]({},_0x3ac557,_0x6b2b42['options']);return db[_0xd9ff('0x71')][_0xd9ff('0x33')]({'where':_0x3ac557['where']})['then'](function(_0x499020){_0x3b925f[_0xd9ff('0x33')]=_0x499020;if(_0x6b2b42['query'][_0xd9ff('0x58')]){_0x3ac557[_0xd9ff('0x59')]=[{'all':!![]}];}return db[_0xd9ff('0x71')][_0xd9ff('0x6c')](_0x3ac557);})[_0xd9ff('0x21')](function(_0x36b1d5){_0x3b925f[_0xd9ff('0x5a')]=_0x36b1d5;return _0x3b925f;});}})[_0xd9ff('0x21')](respondWithFilteredResult(_0x372747,_0x3ac557))['catch'](handleError(_0x372747,null));};exports['removeAnswers']=function(_0x5512aa,_0x709737,_0x610088){return db[_0xd9ff('0x57')]['find']({'where':{'id':_0x5512aa[_0xd9ff('0x5c')]['id']}})[_0xd9ff('0x21')](handleEntityNotFound(_0x709737,null))[_0xd9ff('0x21')](function(_0x2eec0d){if(_0x2eec0d){return _0x2eec0d[_0xd9ff('0x73')](_0x5512aa[_0xd9ff('0x48')]['ids']);}})[_0xd9ff('0x21')](respondWithStatusCode(_0x709737,null))['catch'](handleError(_0x709737,null));};exports[_0xd9ff('0x74')]=function(_0x5fc38d,_0x3d4b20,_0x2780bf){return db['WhatsappAccount'][_0xd9ff('0x5d')]({'where':{'id':_0x5fc38d[_0xd9ff('0x5c')]['id']}})['then'](handleEntityNotFound(_0x3d4b20,null))['then'](function(_0x4aa6d5){if(_0x4aa6d5){return _0x4aa6d5[_0xd9ff('0x74')](_0x5fc38d[_0xd9ff('0x5f')]['ids'],_[_0xd9ff('0x75')](_0x5fc38d[_0xd9ff('0x5f')],[_0xd9ff('0x6e'),'id'])||{})['spread'](function(_0x4a05f8){for(var _0x4c927d=0x0;_0x4c927d<_0x5fc38d[_0xd9ff('0x5f')]['ids'][_0xd9ff('0x4e')];_0x4c927d+=0x1){socket[_0xd9ff('0x76')]('userWhatsappAccount:save',{'UserId':Number(_0x5fc38d[_0xd9ff('0x5f')][_0xd9ff('0x6e')][_0x4c927d]),'WhatsappAccountId':Number(_0x5fc38d[_0xd9ff('0x5c')]['id'])});}return _0x4a05f8;});}})[_0xd9ff('0x21')](respondWithResult(_0x3d4b20,null))[_0xd9ff('0x5b')](handleError(_0x3d4b20,null));};exports['removeAgents']=function(_0xd46620,_0x5d0d2e,_0x4c0d78){return db['WhatsappAccount'][_0xd9ff('0x5d')]({'where':{'id':_0xd46620[_0xd9ff('0x5c')]['id']}})[_0xd9ff('0x21')](handleEntityNotFound(_0x5d0d2e,null))[_0xd9ff('0x21')](function(_0x547bf9){if(_0x547bf9){return _0x547bf9['removeAgents'](_0xd46620[_0xd9ff('0x48')][_0xd9ff('0x6e')])[_0xd9ff('0x21')](function(){if(_[_0xd9ff('0x77')](_0xd46620[_0xd9ff('0x48')]['ids'])){for(var _0x4fe5de=0x0;_0x4fe5de<_0xd46620[_0xd9ff('0x48')][_0xd9ff('0x6e')][_0xd9ff('0x4e')];_0x4fe5de+=0x1){socket[_0xd9ff('0x76')](_0xd9ff('0x78'),{'UserId':Number(_0xd46620[_0xd9ff('0x48')]['ids'][_0x4fe5de]),'WhatsappAccountId':Number(_0xd46620[_0xd9ff('0x5c')]['id'])});}}else{socket['emit']('userWhatsappAccount:remove',{'UserId':Number(_0xd46620[_0xd9ff('0x48')][_0xd9ff('0x6e')]),'WhatsappAccountId':Number(_0xd46620[_0xd9ff('0x5c')]['id'])});}});}})[_0xd9ff('0x21')](respondWithStatusCode(_0x5d0d2e,null))['catch'](handleError(_0x5d0d2e,null));};exports['getAgents']=function(_0x2cf8da,_0x567791,_0x4b8c75){var _0xaceec0={};var _0x4b3e5d={};var _0x1035ff;var _0x4828f4;return db[_0xd9ff('0x57')][_0xd9ff('0x69')]({'where':{'id':_0x2cf8da[_0xd9ff('0x5c')]['id']}})[_0xd9ff('0x21')](handleEntityNotFound(_0x567791,null))[_0xd9ff('0x21')](function(_0x46765b){if(_0x46765b){_0x1035ff=_0x46765b;_0x4b3e5d[_0xd9ff('0x47')]=_['keys'](db[_0xd9ff('0x79')]['rawAttributes']);_0x4b3e5d['query']=_[_0xd9ff('0x49')](_0x2cf8da[_0xd9ff('0x48')]);_0x4b3e5d['filters']=_[_0xd9ff('0x4b')](_0x4b3e5d['model'],_0x4b3e5d['query']);_0xaceec0[_0xd9ff('0x4c')]=_[_0xd9ff('0x4b')](_0x4b3e5d[_0xd9ff('0x47')],qs[_0xd9ff('0x4d')](_0x2cf8da[_0xd9ff('0x48')][_0xd9ff('0x4d')]));_0xaceec0[_0xd9ff('0x4c')]=_0xaceec0[_0xd9ff('0x4c')][_0xd9ff('0x4e')]?_0xaceec0[_0xd9ff('0x4c')]:_0x4b3e5d[_0xd9ff('0x47')];_0xaceec0[_0xd9ff('0x51')]=qs[_0xd9ff('0x52')](_0x2cf8da['query']['sort']);_0xaceec0['where']=qs[_0xd9ff('0x4a')](_['pick'](_0x2cf8da[_0xd9ff('0x48')],_0x4b3e5d[_0xd9ff('0x4a')]));if(_0x2cf8da[_0xd9ff('0x48')][_0xd9ff('0x53')]){_0xaceec0['where']=_[_0xd9ff('0x72')](_0xaceec0['where'],{'$or':_[_0xd9ff('0x43')](_0xaceec0['attributes'],function(_0x4ba809){var _0x5ab72f={};_0x5ab72f[_0x4ba809]={'$like':'%'+_0x2cf8da[_0xd9ff('0x48')]['filter']+'%'};return _0x5ab72f;})});}_0xaceec0=_[_0xd9ff('0x72')]({},_0xaceec0,_0x2cf8da['options']);return _0x1035ff[_0xd9ff('0x7a')](_0xaceec0);}})[_0xd9ff('0x21')](function(_0x696e18){if(_0x696e18){_0x4828f4=_0x696e18[_0xd9ff('0x4e')];if(!_0x2cf8da[_0xd9ff('0x48')][_0xd9ff('0x4f')]('nolimit')){_0xaceec0['limit']=qs[_0xd9ff('0x32')](_0x2cf8da[_0xd9ff('0x48')][_0xd9ff('0x32')]);_0xaceec0[_0xd9ff('0x30')]=qs[_0xd9ff('0x30')](_0x2cf8da['query'][_0xd9ff('0x30')]);}return _0x1035ff[_0xd9ff('0x7a')](_0xaceec0);}})[_0xd9ff('0x21')](function(_0x1bbbfe){if(_0x1bbbfe){return _0x1bbbfe?{'count':_0x4828f4,'rows':_0x1bbbfe}:null;}})[_0xd9ff('0x21')](respondWithResult(_0x567791,null))[_0xd9ff('0x5b')](handleError(_0x567791,null));};exports['addApplications']=function(_0x3a41a6,_0x2f5326){var _0x39aad6=_0x3a41a6[_0xd9ff('0x5c')]['id'];var _0x1b7050=_0x3a41a6[_0xd9ff('0x5f')];var _0x1c8e55=0xc8;var _0x1ae8b5=null;return db[_0xd9ff('0x7b')][_0xd9ff('0x7c')]({'isolationLevel':db[_0xd9ff('0x7b')][_0xd9ff('0x7d')][_0xd9ff('0x7e')][_0xd9ff('0x7f')]},function(_0x385787){return db[_0xd9ff('0x57')][_0xd9ff('0x69')]({'where':{'id':_0x39aad6},'transaction':_0x385787})[_0xd9ff('0x21')](function(_0x4e23d8){if(_0x4e23d8){return db[_0xd9ff('0x80')][_0xd9ff('0x3a')]({'where':{'WhatsappAccountId':_0x39aad6},'transaction':_0x385787})[_0xd9ff('0x21')](function(){var _0x352fc1=_[_0xd9ff('0x43')](_0x1b7050,function(_0x69b1c8){_0x69b1c8[_0xd9ff('0x68')]=_0x39aad6;return _0x69b1c8;});return db[_0xd9ff('0x80')]['bulkCreate'](_0x352fc1,{'transaction':_0x385787});});}else{_0x1c8e55=0x194;_0x1ae8b5=[];}});})[_0xd9ff('0x21')](function(){if(_0x1c8e55!==0x194){return db['WhatsappApplication'][_0xd9ff('0x81')]({'where':{'WhatsappAccountId':_0x39aad6},'order':_0xd9ff('0x82')})[_0xd9ff('0x21')](function(_0x99aa21){_0x1ae8b5=_0x99aa21;});}})[_0xd9ff('0x5b')](function(_0x204127){_0x1c8e55=0x1f4;logger[_0xd9ff('0x28')](_0x204127['stack']);if(_0x204127[_0xd9ff('0x3e')]){delete _0x204127[_0xd9ff('0x3e')];}_0x1ae8b5=_0x204127;})[_0xd9ff('0x83')](function(){if(_0x1ae8b5===null){_0x2f5326[_0xd9ff('0x2c')](_0x1c8e55);}else{if(_0x1c8e55===0x1f4){_0x2f5326['status'](_0x1c8e55)[_0xd9ff('0x3f')](_0x1ae8b5);}else{_0x2f5326[_0xd9ff('0x2d')](_0x1c8e55)['json'](_0x1ae8b5);}}});};exports[_0xd9ff('0x84')]=function(_0x21fdeb,_0x5294b5,_0x4ae192){var _0x5c4138={};var _0x560ea2={};var _0x1e6d5a;var _0x218279;return db[_0xd9ff('0x57')]['findOne']({'where':{'id':_0x21fdeb['params']['id']}})[_0xd9ff('0x21')](handleEntityNotFound(_0x5294b5,null))['then'](function(_0x43a941){if(_0x43a941){_0x1e6d5a=_0x43a941;_0x560ea2[_0xd9ff('0x47')]=_[_0xd9ff('0x49')](db['WhatsappApplication']['rawAttributes']);_0x560ea2['query']=_[_0xd9ff('0x49')](_0x21fdeb[_0xd9ff('0x48')]);_0x560ea2['filters']=_[_0xd9ff('0x4b')](_0x560ea2[_0xd9ff('0x47')],_0x560ea2[_0xd9ff('0x48')]);_0x5c4138[_0xd9ff('0x4c')]=_[_0xd9ff('0x4b')](_0x560ea2[_0xd9ff('0x47')],qs[_0xd9ff('0x4d')](_0x21fdeb[_0xd9ff('0x48')][_0xd9ff('0x4d')]));_0x5c4138[_0xd9ff('0x4c')]=_0x5c4138[_0xd9ff('0x4c')][_0xd9ff('0x4e')]?_0x5c4138[_0xd9ff('0x4c')]:_0x560ea2[_0xd9ff('0x47')];_0x5c4138[_0xd9ff('0x51')]=qs[_0xd9ff('0x52')](_0x21fdeb[_0xd9ff('0x48')][_0xd9ff('0x52')]);_0x5c4138[_0xd9ff('0x54')]=qs[_0xd9ff('0x4a')](_[_0xd9ff('0x6a')](_0x21fdeb[_0xd9ff('0x48')],_0x560ea2[_0xd9ff('0x4a')]));if(_0x21fdeb[_0xd9ff('0x48')][_0xd9ff('0x53')]){_0x5c4138[_0xd9ff('0x54')]=_[_0xd9ff('0x72')](_0x5c4138[_0xd9ff('0x54')],{'$or':_[_0xd9ff('0x43')](_0x5c4138['attributes'],function(_0x191cf3){var _0x24c947={};_0x24c947[_0x191cf3]={'$like':'%'+_0x21fdeb['query'][_0xd9ff('0x53')]+'%'};return _0x24c947;})});}_0x5c4138=_[_0xd9ff('0x72')]({},_0x5c4138,_0x21fdeb[_0xd9ff('0x56')]);return _0x1e6d5a[_0xd9ff('0x84')](_0x5c4138);}})[_0xd9ff('0x21')](function(_0xe15fe0){if(_0xe15fe0){_0x218279=_0xe15fe0['length'];if(!_0x21fdeb['query'][_0xd9ff('0x4f')]('nolimit')){_0x5c4138['limit']=qs[_0xd9ff('0x32')](_0x21fdeb[_0xd9ff('0x48')]['limit']);_0x5c4138[_0xd9ff('0x30')]=qs[_0xd9ff('0x30')](_0x21fdeb[_0xd9ff('0x48')][_0xd9ff('0x30')]);}return _0x1e6d5a['getApplications'](_0x5c4138);}})[_0xd9ff('0x21')](function(_0x4290e9){if(_0x4290e9){return _0x4290e9?{'count':_0x218279,'rows':_0x4290e9}:null;}})['then'](respondWithResult(_0x5294b5,null))[_0xd9ff('0x5b')](handleError(_0x5294b5,null));};exports[_0xd9ff('0x85')]=function(_0x5b3480,_0x62f1f3,_0xd188cf){var _0x33790d={'channel':'whatsapp'};var _0x1e42c7=[];var _0x1e2c2d=[];var _0x455245={};return db['WhatsappAccount'][_0xd9ff('0x5d')]({'where':{'id':_0x5b3480['params']['id']},'include':[{'model':db[_0xd9ff('0x80')],'as':_0xd9ff('0x86')}]})[_0xd9ff('0x21')](handleEntityNotFound(_0x62f1f3,null))[_0xd9ff('0x21')](function(_0x98bc61){_0x33790d[_0xd9ff('0x87')]=_0x98bc61;if(_0x33790d['account']&&_0x33790d[_0xd9ff('0x87')][_0xd9ff('0x46')]===_0xd9ff('0x88')&&_0x5b3480[_0xd9ff('0x5f')][_0xd9ff('0x89')]){if(_0x5b3480['body'][_0xd9ff('0x89')][_0xd9ff('0x4e')]===0x0)return;if(_0x5b3480['body'][_0xd9ff('0x89')][0x0][_0xd9ff('0x8a')]!==_0xd9ff('0x8b'))return;return db[_0xd9ff('0x8c')][_0xd9ff('0x39')]({'read':!![],'readAt':_0x5b3480[_0xd9ff('0x5f')][_0xd9ff('0x89')][0x0][_0xd9ff('0x8d')]},{'where':{'messageId':_0x5b3480[_0xd9ff('0x5f')][_0xd9ff('0x89')][0x0][_0xd9ff('0x8e')]},'individualHooks':!![]})[_0xd9ff('0x21')](function(_0x8be873){return _0x62f1f3[_0xd9ff('0x2d')](0xc8)[_0xd9ff('0x2f')](_0x8be873);});}_0x33790d[_0xd9ff('0x8f')]=_['orderBy'](_0x98bc61['Applications'],['priority'],[_0xd9ff('0x90')]);if(_0x33790d['account'][_0xd9ff('0x86')]){delete _0x33790d['account']['Applications'];}return db['CmContact'][_0xd9ff('0x67')]()['then'](function(_0x5998dd){if(!_0x5998dd){throw new db[(_0xd9ff('0x91'))][(_0xd9ff('0x92'))](_0xd9ff('0x93'));}_0x1e42c7=_[_0xd9ff('0x94')](_[_0xd9ff('0x49')](_0x5998dd),[_0xd9ff('0x95'),_0xd9ff('0x96')]);_0x1e2c2d=_[_0xd9ff('0x94')](_[_0xd9ff('0x49')](_0x5998dd),[_0xd9ff('0x95'),_0xd9ff('0x96'),_0xd9ff('0x97'),_0xd9ff('0x98')]);_0x33790d[_0xd9ff('0x5f')]={'mapKey':'mobile'};if(_0x33790d['account']&&_0x33790d[_0xd9ff('0x87')][_0xd9ff('0x46')]===_0xd9ff('0x99')){_0x33790d[_0xd9ff('0x5f')][_0xd9ff('0x9a')]=_0x5b3480[_0xd9ff('0x5f')][_0xd9ff('0x9b')][_0xd9ff('0x9c')]('whatsapp:','');_0x33790d[_0xd9ff('0x5f')][_0xd9ff('0x5f')]=_0x5b3480[_0xd9ff('0x5f')][_0xd9ff('0x9d')];_0x33790d['body']['messageId']=_0x5b3480[_0xd9ff('0x5f')][_0xd9ff('0x9e')];}if(_0x33790d['account']&&_0x33790d[_0xd9ff('0x87')][_0xd9ff('0x46')]==='sinch'){_0x33790d[_0xd9ff('0x5f')][_0xd9ff('0x9a')]=_0x5b3480[_0xd9ff('0x5f')][_0xd9ff('0x9f')][0x0][_0xd9ff('0x9a')];_0x33790d[_0xd9ff('0x5f')][_0xd9ff('0x5f')]=_0x5b3480['body'][_0xd9ff('0x9f')][0x0][_0xd9ff('0x2a')][_0xd9ff('0x5f')];_0x33790d[_0xd9ff('0x5f')][_0xd9ff('0xa0')]=_0x5b3480['body'][_0xd9ff('0x9f')][0x0][_0xd9ff('0x8e')];}if(_0x33790d[_0xd9ff('0x5f')]['id']){delete _0x33790d['body']['id'];}if(_[_0xd9ff('0xa1')](_0x33790d[_0xd9ff('0x5f')][_0xd9ff('0x9a')])){throw new db['Sequelize'][(_0xd9ff('0x92'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x33790d['body']['body'])||_0x33790d['body'][_0xd9ff('0x5f')]===''){throw new db[(_0xd9ff('0x91'))]['ValidationError'](_0xd9ff('0xa2'));}if(_[_0xd9ff('0xa1')](_0x33790d[_0xd9ff('0x5f')]['mapKey'])){throw new db[(_0xd9ff('0x91'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1e2c2d);}if(!_[_0xd9ff('0xa3')](_0x1e2c2d,_0x33790d[_0xd9ff('0x5f')][_0xd9ff('0xa4')])){throw new db['Sequelize']['ValidationError'](_0xd9ff('0xa5')+_0x1e2c2d);}_0x455245[_0x33790d[_0xd9ff('0x5f')]['mapKey']]=_0x33790d[_0xd9ff('0x5f')][_0xd9ff('0x9a')];return db[_0xd9ff('0xa6')][_0xd9ff('0x5d')]({'where':{'id':_0x33790d[_0xd9ff('0x87')][_0xd9ff('0x98')]},'include':[{'model':db[_0xd9ff('0xa7')],'as':'Contacts','where':_0x455245,'limit':0x1,'order':[[_0xd9ff('0x96'),_0xd9ff('0xa8')]]}]});})['then'](handleEntityNotFound(_0x62f1f3,null))[_0xd9ff('0x21')](function(_0x2461f1){if(_0x2461f1){_0x33790d['list']=_[_0xd9ff('0x75')](_0x2461f1,['Contacts']);if(_0x2461f1[_0xd9ff('0xa9')][_0xd9ff('0x4e')]){return _0x2461f1['Contacts'][0x0];}var _0x1b94b6=_['defaults'](_0x33790d[_0xd9ff('0x5f')],{'firstName':_0x33790d[_0xd9ff('0x5f')][_0xd9ff('0x9a')],'ListId':_0x2461f1['id']});_0x1b94b6[_0x33790d[_0xd9ff('0x5f')][_0xd9ff('0xa4')]]=_0x33790d[_0xd9ff('0x5f')]['from'];return db['CmContact'][_0xd9ff('0x5e')](_0x1b94b6,{'fields':_0x1e42c7,'raw':!![]});}})['then'](handleEntityNotFound(_0x62f1f3,null))[_0xd9ff('0x21')](function(_0x133061){if(_0x133061){_0x33790d['contact']=_0x133061;var _0x48bfb6={'ContactId':_0x133061['id'],'phone':_0x33790d['body'][_0xd9ff('0x9a')],'WhatsappAccountId':_0x5b3480[_0xd9ff('0x5c')]['id']};var _0x131752={'ContactId':_0x133061['id'],'WhatsappAccountId':_0x5b3480['params']['id'],'closed':![]};return db[_0xd9ff('0xaa')][_0xd9ff('0x5d')]({'where':_0x131752})[_0xd9ff('0x21')](function(_0x2832b7){if(_0x2832b7){return[_0x2832b7,![]];}return db[_0xd9ff('0xaa')][_0xd9ff('0x5e')](_0x48bfb6)[_0xd9ff('0x21')](function(_0x5e064d){return[_0x5e064d,!![]];});});}})[_0xd9ff('0xab')](function(_0x2c8ad7,_0x2a60de){_0x33790d[_0xd9ff('0xac')]=_0x2c8ad7[_0xd9ff('0x61')]({'plain':!![]});_0x33790d[_0xd9ff('0xac')][_0xd9ff('0xad')]=![];if(_0x2a60de){if(_0x33790d[_0xd9ff('0x87')][_0xd9ff('0xae')]){_0x33790d[_0xd9ff('0x8f')][_0xd9ff('0xaf')]({'id':0x0,'priority':_0x33790d['applications']['length']+0x1,'app':_0xd9ff('0xb0'),'appdata':'unmanaged','interval':'*,*,*,*'});}_0x33790d[_0xd9ff('0xac')][_0xd9ff('0xad')]=!![];}return db[_0xd9ff('0x8c')][_0xd9ff('0x5e')]({'phone':_0x33790d[_0xd9ff('0x5f')]['from'],'messageId':_0x33790d[_0xd9ff('0x5f')]['messageId'],'body':_0x33790d[_0xd9ff('0x5f')][_0xd9ff('0x5f')],'WhatsappAccountId':_0x5b3480['params']['id'],'WhatsappInteractionId':_0x2c8ad7['id'],'direction':'in','ContactId':_0x2c8ad7[_0xd9ff('0xb1')],'AttachmentId':_0x33790d[_0xd9ff('0x5f')][_0xd9ff('0xb2')]});})[_0xd9ff('0x21')](function(_0x1381f7){_0x33790d[_0xd9ff('0x2a')]=_0x1381f7;if(!_0x33790d[_0xd9ff('0xac')]['UserId'])return;return db[_0xd9ff('0x79')][_0xd9ff('0x5d')]({'attributes':['id',_0xd9ff('0x3e')],'where':{'id':_0x33790d[_0xd9ff('0xac')][_0xd9ff('0xb3')]}});})[_0xd9ff('0x21')](function(_0x4eceda){if(_0x4eceda){_0x33790d[_0xd9ff('0x8f')][_0xd9ff('0xb4')]({'id':0x0,'priority':0x0,'app':_0xd9ff('0xb5'),'appdata':_0x4eceda['name']+','+(_0x33790d[_0xd9ff('0x87')]['waitForTheAssignedAgent']||0xa),'interval':_0xd9ff('0xb6')});}if(!_0x33790d['interaction'][_0xd9ff('0xb7')])return;return db[_0xd9ff('0xb8')][_0xd9ff('0x5d')]({'attributes':['id','name'],'where':{'id':_0x33790d[_0xd9ff('0xac')]['queueId']}});})[_0xd9ff('0x21')](function(_0x220bce){if(_0x220bce){_0x33790d[_0xd9ff('0x8f')][_0xd9ff('0xb4')]({'id':0x0,'priority':0x1,'app':_0xd9ff('0xb9'),'appdata':_0x220bce['name']+','+(_0x33790d[_0xd9ff('0x87')][_0xd9ff('0xba')]||0x12c),'interval':_0xd9ff('0xb6')});}return respondWithRpcPromise(_0xd9ff('0xbb'),_0xd9ff('0xbc'),_0x33790d);})[_0xd9ff('0x21')](function(_0x5d95b1){if(_0x5d95b1){var _0x58faf9=0xc8;var _0x3e4481=_0xd9ff('0xbd');logger[_0xd9ff('0x22')](_0xd9ff('0x26'),_0x3e4481,_0x58faf9,_0xd9ff('0xbe'));logger[_0xd9ff('0x25')](_0xd9ff('0xbf'),_0x3e4481,_0x58faf9,'entity\x20found',JSON[_0xd9ff('0x27')](_0x5d95b1));if(_0x33790d[_0xd9ff('0x87')][_0xd9ff('0x46')]===_0xd9ff('0x99')){return _0x62f1f3[_0xd9ff('0x2d')](_0x58faf9)[_0xd9ff('0x34')]('Content-Type',_0xd9ff('0xc0'))[_0xd9ff('0x3f')](_0xd9ff('0xc1'));}else{return _0x62f1f3[_0xd9ff('0x2d')](_0x58faf9)[_0xd9ff('0x2f')](_0x5d95b1);}}});})[_0xd9ff('0x5b')](handleError(_0x62f1f3,null));};exports['send']=function(_0x59065f,_0xf3a93b,_0x473ecf){var _0x1213a4,_0x6f731a,_0x193c57;if(_[_0xd9ff('0xa1')](_0x59065f[_0xd9ff('0x5f')][_0xd9ff('0x5f')])||_0x59065f['body'][_0xd9ff('0x5f')]===''){throw new db[(_0xd9ff('0x91'))][(_0xd9ff('0x92'))](_0xd9ff('0xa2'));}if(_[_0xd9ff('0xa1')](_0x59065f[_0xd9ff('0x5f')]['to'])){throw new db['Sequelize'][(_0xd9ff('0x92'))]('to\x20is\x20mandatory');}_0x1213a4=_0x59065f['body']['to'];return db[_0xd9ff('0x57')][_0xd9ff('0x5d')]({'where':{'id':_0x59065f[_0xd9ff('0x5c')]['id']},'include':[{'model':db[_0xd9ff('0xa6')],'as':_0xd9ff('0xc2'),'include':[{'model':db[_0xd9ff('0xa7')],'as':_0xd9ff('0xa9'),'where':{'mobile':_0x1213a4},'limit':0x1,'order':[[_0xd9ff('0x96'),'DESC']]}]}]})[_0xd9ff('0x21')](handleEntityNotFound(_0xf3a93b,null))['then'](function(_0x1adac5){if(_0x1adac5&&_0x1adac5[_0xd9ff('0xc2')]){_0x6f731a=_0x1adac5[_0xd9ff('0x61')]({'plain':!![]});if(_0x6f731a[_0xd9ff('0xc2')]&&_0x6f731a['List'][_0xd9ff('0xa9')][_0xd9ff('0x4e')]){return _0x6f731a[_0xd9ff('0xc2')][_0xd9ff('0xa9')][0x0];}return db[_0xd9ff('0xa7')][_0xd9ff('0x5e')](_[_0xd9ff('0xc3')](_0x59065f[_0xd9ff('0x5f')],{'firstName':_0x1213a4,'mobile':_0x1213a4,'phone':_0x1213a4,'ListId':_0x6f731a[_0xd9ff('0x98')]}));}})['then'](handleEntityNotFound(_0xf3a93b,null))[_0xd9ff('0x21')](function(_0x51022f){if(_0x51022f){_0x193c57=_0x51022f;return db['WhatsappInteraction'][_0xd9ff('0x5d')]({'where':{'ContactId':_0x193c57['id'],'closed':![],'WhatsappAccountId':_0x6f731a['id']}})[_0xd9ff('0x21')](function(_0x3d2fd8){if(_0x3d2fd8){return[_0x3d2fd8,![]];}return db[_0xd9ff('0xaa')][_0xd9ff('0x5e')]({'UserId':_0x59065f[_0xd9ff('0x60')]['id'],'ContactId':_0x193c57['id'],'WhatsappAccountId':_0x6f731a['id'],'phone':_0x1213a4,'firstMsgDirection':_0xd9ff('0xc4'),'Messages':[_[_0xd9ff('0x72')](_0x59065f[_0xd9ff('0x5f')],{'read':![],'body':_0x59065f[_0xd9ff('0x5f')][_0xd9ff('0x5f')],'phone':_0x1213a4,'WhatsappAccountId':_0x6f731a['id'],'UserId':_0x59065f[_0xd9ff('0x60')]['id'],'ContactId':_0x193c57['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':_0xd9ff('0xc5')}]})['then'](function(_0x1bb980){return[_0x1bb980,!![]];});});}})[_0xd9ff('0xab')](function(_0x5b7e45,_0x5ed4b5){if(_0x5ed4b5){return _0x5b7e45;}return db[_0xd9ff('0x8c')][_0xd9ff('0x5e')](_['merge'](_0x59065f[_0xd9ff('0x5f')],{'read':![],'body':_0x59065f[_0xd9ff('0x5f')]['body'],'phone':_0x1213a4,'WhatsappAccountId':_0x6f731a['id'],'WhatsappInteractionId':_0x5b7e45['id'],'UserId':_0x59065f[_0xd9ff('0x60')]['id'],'ContactId':_0x193c57['id']}))['then'](function(_0x20f7dd){_0x5b7e45[_0xd9ff('0xc6')][_0xd9ff('0xc5')]=[];_0x5b7e45[_0xd9ff('0xc6')][_0xd9ff('0xc5')][_0xd9ff('0xaf')](_0x20f7dd[_0xd9ff('0xc6')]);return _0x5b7e45;});})[_0xd9ff('0x21')](respondWithResult(_0xf3a93b,null))[_0xd9ff('0x5b')](handleError(_0xf3a93b,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 5292a48..813c362 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 _0x434f=['emit','hook','exports','../../mysqldb','WhatsappAccount','setMaxListeners','save','update','remove'];(function(_0x204250,_0x4fc19c){var _0x337748=function(_0x3512d9){while(--_0x3512d9){_0x204250['push'](_0x204250['shift']());}};_0x337748(++_0x4fc19c);}(_0x434f,0x9c));var _0xf434=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x434f[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0xf434('0x0'))['db'][_0xf434('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xf434('0x2')](0x0);var events={'afterCreate':_0xf434('0x3'),'afterUpdate':_0xf434('0x4'),'afterDestroy':_0xf434('0x5')};function emitEvent(_0x5e8f65){return function(_0x10e6d5,_0x2b11f6,_0x2d33cb){WhatsappAccountEvents[_0xf434('0x6')](_0x5e8f65+':'+_0x10e6d5['id'],_0x10e6d5);WhatsappAccountEvents[_0xf434('0x6')](_0x5e8f65,_0x10e6d5);_0x2d33cb(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount[_0xf434('0x7')](e,emitEvent(event));}}module[_0xf434('0x8')]=WhatsappAccountEvents; \ No newline at end of file +var _0x5617=['update','remove','emit','hook','events','../../mysqldb','WhatsappAccount','setMaxListeners'];(function(_0x5c9307,_0x5b97e4){var _0x373e29=function(_0xefebbd){while(--_0xefebbd){_0x5c9307['push'](_0x5c9307['shift']());}};_0x373e29(++_0x5b97e4);}(_0x5617,0x8c));var _0x7561=function(_0x707bd,_0xa35918){_0x707bd=_0x707bd-0x0;var _0x454003=_0x5617[_0x707bd];return _0x454003;};'use strict';var EventEmitter=require(_0x7561('0x0'));var WhatsappAccount=require(_0x7561('0x1'))['db'][_0x7561('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x7561('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7561('0x4'),'afterDestroy':_0x7561('0x5')};function emitEvent(_0x59dc91){return function(_0x3b0046,_0x4a0464,_0x5d9172){WhatsappAccountEvents['emit'](_0x59dc91+':'+_0x3b0046['id'],_0x3b0046);WhatsappAccountEvents[_0x7561('0x6')](_0x59dc91,_0x3b0046);_0x5d9172(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount[_0x7561('0x7')](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 057fcca..e1e9e3f 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 _0x8c6d=['lodash','util','api','moment','bluebird','path','../../config/environment','./whatsappAccount.attributes','exports','define','WhatsappAccount','whatsapp_accounts'];(function(_0x4bd76e,_0x260c31){var _0x96a285=function(_0x28176d){while(--_0x28176d){_0x4bd76e['push'](_0x4bd76e['shift']());}};_0x96a285(++_0x260c31);}(_0x8c6d,0x6c));var _0xd8c6=function(_0x32d6aa,_0x336169){_0x32d6aa=_0x32d6aa-0x0;var _0x349d07=_0x8c6d[_0x32d6aa];return _0x349d07;};'use strict';var _=require(_0xd8c6('0x0'));var util=require(_0xd8c6('0x1'));var logger=require('../../config/logger')(_0xd8c6('0x2'));var moment=require(_0xd8c6('0x3'));var BPromise=require(_0xd8c6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd8c6('0x5'));var rimraf=require('rimraf');var config=require(_0xd8c6('0x6'));var attributes=require(_0xd8c6('0x7'));module[_0xd8c6('0x8')]=function(_0x5e8ee5,_0x10dcc4){return _0x5e8ee5[_0xd8c6('0x9')](_0xd8c6('0xa'),attributes,{'tableName':_0xd8c6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8c49=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./whatsappAccount.attributes','exports','WhatsappAccount','lodash'];(function(_0x1e1829,_0x13f52e){var _0x207bdb=function(_0x98e7d){while(--_0x98e7d){_0x1e1829['push'](_0x1e1829['shift']());}};_0x207bdb(++_0x13f52e);}(_0x8c49,0x1c2));var _0x98c4=function(_0x37a0ed,_0x399b23){_0x37a0ed=_0x37a0ed-0x0;var _0xba6f39=_0x8c49[_0x37a0ed];return _0xba6f39;};'use strict';var _=require(_0x98c4('0x0'));var util=require('util');var logger=require(_0x98c4('0x1'))(_0x98c4('0x2'));var moment=require(_0x98c4('0x3'));var BPromise=require(_0x98c4('0x4'));var rp=require(_0x98c4('0x5'));var fs=require('fs');var path=require(_0x98c4('0x6'));var rimraf=require(_0x98c4('0x7'));var config=require('../../config/environment');var attributes=require(_0x98c4('0x8'));module[_0x98c4('0x9')]=function(_0x4f0d6d,_0x3ce9ae){return _0x4f0d6d['define'](_0x98c4('0xa'),attributes,{'tableName':'whatsapp_accounts','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 2f505fe..68327dc 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 _0x98e7=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./whatsappAccount.socket','register','request','then','info','WhatsappAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','find','options','raw','attributes','include','map','model','ShowWhatsappAccount','util','moment','bluebird','randomstring','ioredis'];(function(_0x59664e,_0x5e95bd){var _0x3d2bce=function(_0x5c3566){while(--_0x5c3566){_0x59664e['push'](_0x59664e['shift']());}};_0x3d2bce(++_0x5e95bd);}(_0x98e7,0x1c2));var _0x798e=function(_0x229d99,_0x3f393a){_0x229d99=_0x229d99-0x0;var _0x4e8ec1=_0x98e7[_0x229d99];return _0x4e8ec1;};'use strict';var _=require('lodash');var util=require(_0x798e('0x0'));var moment=require(_0x798e('0x1'));var BPromise=require(_0x798e('0x2'));var rs=require(_0x798e('0x3'));var fs=require('fs');var Redis=require(_0x798e('0x4'));var db=require(_0x798e('0x5'))['db'];var utils=require(_0x798e('0x6'));var logger=require('../../config/logger')(_0x798e('0x7'));var config=require('../../config/environment');var jayson=require(_0x798e('0x8'));var client=jayson[_0x798e('0x9')][_0x798e('0xa')]({'port':0x232a});config[_0x798e('0xb')]=_[_0x798e('0xc')](config[_0x798e('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x798e('0xd'))(new Redis(config['redis']));require(_0x798e('0xe'))[_0x798e('0xf')](socket);function respondWithRpcPromise(_0x2f9675,_0x569204,_0x4538ba){return new BPromise(function(_0x41992a,_0x3eea7c){return client[_0x798e('0x10')](_0x2f9675,_0x4538ba)[_0x798e('0x11')](function(_0x53f6d2){logger[_0x798e('0x12')](_0x798e('0x13'),_0x569204,'request\x20sent');logger[_0x798e('0x14')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x569204,_0x798e('0x15'),JSON[_0x798e('0x16')](_0x53f6d2));if(_0x53f6d2['error']){if(_0x53f6d2[_0x798e('0x17')][_0x798e('0x18')]===0x1f4){logger[_0x798e('0x17')](_0x798e('0x13'),_0x569204,_0x53f6d2[_0x798e('0x17')][_0x798e('0x19')]);return _0x3eea7c(_0x53f6d2[_0x798e('0x17')][_0x798e('0x19')]);}logger[_0x798e('0x17')](_0x798e('0x13'),_0x569204,_0x53f6d2['error']['message']);return _0x41992a(_0x53f6d2[_0x798e('0x17')][_0x798e('0x19')]);}else{logger[_0x798e('0x12')]('WhatsappAccount,\x20%s,\x20%s',_0x569204,'request\x20sent');_0x41992a(_0x53f6d2['result'][_0x798e('0x19')]);}})[_0x798e('0x1a')](function(_0x76fef7){logger['error'](_0x798e('0x13'),_0x569204,_0x76fef7);_0x3eea7c(_0x76fef7);});});}exports['ShowWhatsappAccount']=function(_0x2202c6){var _0x2ac8d7=this;return new Promise(function(_0x1906ef,_0x37b060){return db['WhatsappAccount'][_0x798e('0x1b')]({'raw':_0x2202c6[_0x798e('0x1c')]?_0x2202c6[_0x798e('0x1c')][_0x798e('0x1d')]===undefined?!![]:![]:!![],'where':_0x2202c6[_0x798e('0x1c')]?_0x2202c6[_0x798e('0x1c')]['where']||null:null,'attributes':_0x2202c6[_0x798e('0x1c')]?_0x2202c6[_0x798e('0x1c')][_0x798e('0x1e')]||null:null,'include':_0x2202c6[_0x798e('0x1c')]?_0x2202c6['options'][_0x798e('0x1f')]?_[_0x798e('0x20')](_0x2202c6[_0x798e('0x1c')][_0x798e('0x1f')],function(_0x2f2ef7){return{'model':db[_0x2f2ef7[_0x798e('0x21')]],'as':_0x2f2ef7['as'],'attributes':_0x2f2ef7[_0x798e('0x1e')],'include':_0x2f2ef7[_0x798e('0x1f')]?_['map'](_0x2f2ef7[_0x798e('0x1f')],function(_0x32153b){return{'model':db[_0x32153b['model']],'as':_0x32153b['as'],'attributes':_0x32153b[_0x798e('0x1e')],'include':_0x32153b[_0x798e('0x1f')]?_['map'](_0x32153b['include'],function(_0x1334e7){return{'model':db[_0x1334e7[_0x798e('0x21')]],'as':_0x1334e7['as'],'attributes':_0x1334e7[_0x798e('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x798e('0x11')](function(_0x3cd5e7){logger[_0x798e('0x12')](_0x798e('0x22'),_0x2202c6);logger[_0x798e('0x14')](_0x798e('0x22'),_0x2202c6,JSON[_0x798e('0x16')](_0x3cd5e7));_0x1906ef(_0x3cd5e7);})['catch'](function(_0x6549dd){logger[_0x798e('0x17')](_0x798e('0x22'),_0x6549dd[_0x798e('0x19')],_0x2202c6);_0x37b060(_0x2ac8d7[_0x798e('0x17')](0x1f4,_0x6549dd['message']));});});}; \ No newline at end of file +var _0x346c=['lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','socket.io-emitter','./whatsappAccount.socket','register','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','ShowWhatsappAccount','WhatsappAccount','find','options','raw','where','include','map','attributes','model'];(function(_0x3df048,_0x78df8f){var _0x279b4d=function(_0x3bfec4){while(--_0x3bfec4){_0x3df048['push'](_0x3df048['shift']());}};_0x279b4d(++_0x78df8f);}(_0x346c,0x198));var _0xc346=function(_0x14396f,_0x140a9d){_0x14396f=_0x14396f-0x0;var _0x4687b5=_0x346c[_0x14396f];return _0x4687b5;};'use strict';var _=require(_0xc346('0x0'));var util=require(_0xc346('0x1'));var moment=require(_0xc346('0x2'));var BPromise=require('bluebird');var rs=require(_0xc346('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc346('0x4'))['db'];var utils=require(_0xc346('0x5'));var logger=require(_0xc346('0x6'))('rpc');var config=require(_0xc346('0x7'));var jayson=require(_0xc346('0x8'));var client=jayson[_0xc346('0x9')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0xc346('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xc346('0xb'))(new Redis(config[_0xc346('0xa')]));require(_0xc346('0xc'))[_0xc346('0xd')](socket);function respondWithRpcPromise(_0x4c204d,_0x32c615,_0x4644d3){return new BPromise(function(_0x5eaf38,_0x16acde){return client['request'](_0x4c204d,_0x4644d3)[_0xc346('0xe')](function(_0x892d9a){logger[_0xc346('0xf')](_0xc346('0x10'),_0x32c615,_0xc346('0x11'));logger[_0xc346('0x12')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x32c615,_0xc346('0x11'),JSON[_0xc346('0x13')](_0x892d9a));if(_0x892d9a[_0xc346('0x14')]){if(_0x892d9a[_0xc346('0x14')]['code']===0x1f4){logger['error'](_0xc346('0x10'),_0x32c615,_0x892d9a[_0xc346('0x14')][_0xc346('0x15')]);return _0x16acde(_0x892d9a[_0xc346('0x14')]['message']);}logger[_0xc346('0x14')](_0xc346('0x10'),_0x32c615,_0x892d9a[_0xc346('0x14')][_0xc346('0x15')]);return _0x5eaf38(_0x892d9a['error']['message']);}else{logger[_0xc346('0xf')]('WhatsappAccount,\x20%s,\x20%s',_0x32c615,_0xc346('0x11'));_0x5eaf38(_0x892d9a[_0xc346('0x16')][_0xc346('0x15')]);}})[_0xc346('0x17')](function(_0x1e80d5){logger[_0xc346('0x14')](_0xc346('0x10'),_0x32c615,_0x1e80d5);_0x16acde(_0x1e80d5);});});}exports[_0xc346('0x18')]=function(_0x50e37e){var _0x1f6ae8=this;return new Promise(function(_0x1c56e6,_0x1fc900){return db[_0xc346('0x19')][_0xc346('0x1a')]({'raw':_0x50e37e['options']?_0x50e37e[_0xc346('0x1b')][_0xc346('0x1c')]===undefined?!![]:![]:!![],'where':_0x50e37e[_0xc346('0x1b')]?_0x50e37e[_0xc346('0x1b')][_0xc346('0x1d')]||null:null,'attributes':_0x50e37e['options']?_0x50e37e['options']['attributes']||null:null,'include':_0x50e37e[_0xc346('0x1b')]?_0x50e37e[_0xc346('0x1b')][_0xc346('0x1e')]?_[_0xc346('0x1f')](_0x50e37e[_0xc346('0x1b')]['include'],function(_0x42dbea){return{'model':db[_0x42dbea['model']],'as':_0x42dbea['as'],'attributes':_0x42dbea[_0xc346('0x20')],'include':_0x42dbea['include']?_['map'](_0x42dbea[_0xc346('0x1e')],function(_0x20180e){return{'model':db[_0x20180e[_0xc346('0x21')]],'as':_0x20180e['as'],'attributes':_0x20180e['attributes'],'include':_0x20180e[_0xc346('0x1e')]?_[_0xc346('0x1f')](_0x20180e[_0xc346('0x1e')],function(_0x27a659){return{'model':db[_0x27a659[_0xc346('0x21')]],'as':_0x27a659['as'],'attributes':_0x27a659['attributes']};}):[]};}):[]};}):[]:[]})[_0xc346('0xe')](function(_0x290184){logger['info'](_0xc346('0x18'),_0x50e37e);logger['debug'](_0xc346('0x18'),_0x50e37e,JSON[_0xc346('0x13')](_0x290184));_0x1c56e6(_0x290184);})[_0xc346('0x17')](function(_0x5c4920){logger[_0xc346('0x14')]('ShowWhatsappAccount',_0x5c4920[_0xc346('0x15')],_0x50e37e);_0x1fc900(_0x1f6ae8[_0xc346('0x14')](0x1f4,_0x5c4920[_0xc346('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index ba914af..4f68215 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 _0x60c1=['emit','removeListener','register','whatsappAccount:','remove','update'];(function(_0x4e0115,_0x1692ea){var _0x45a16a=function(_0x2324e6){while(--_0x2324e6){_0x4e0115['push'](_0x4e0115['shift']());}};_0x45a16a(++_0x1692ea);}(_0x60c1,0x11e));var _0x160c=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x60c1[_0x4e676e];return _0x336a3c;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=['save',_0x160c('0x0'),_0x160c('0x1')];function createListener(_0x487794,_0x58fb2c){return function(_0xd94efc){_0x58fb2c[_0x160c('0x2')](_0x487794,_0xd94efc);};}function removeListener(_0x1039d2,_0x46bb13){return function(){WhatsappAccountEvents[_0x160c('0x3')](_0x1039d2,_0x46bb13);};}exports[_0x160c('0x4')]=function(_0x48267b){for(var _0x4c3788=0x0,_0x3219a8=events['length'];_0x4c3788<_0x3219a8;_0x4c3788++){var _0x3975c6=events[_0x4c3788];var _0x4d9e4b=createListener(_0x160c('0x5')+_0x3975c6,_0x48267b);WhatsappAccountEvents['on'](_0x3975c6,_0x4d9e4b);}}; \ No newline at end of file +var _0x207f=['remove','update','register','length','whatsappAccount:','./whatsappAccount.events','save'];(function(_0x5af812,_0x43d252){var _0x1489f2=function(_0x1c7fa9){while(--_0x1c7fa9){_0x5af812['push'](_0x5af812['shift']());}};_0x1489f2(++_0x43d252);}(_0x207f,0x124));var _0xf207=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x207f[_0x17d9e3];return _0x14192d;};'use strict';var WhatsappAccountEvents=require(_0xf207('0x0'));var events=[_0xf207('0x1'),_0xf207('0x2'),_0xf207('0x3')];function createListener(_0x5b0874,_0x5136ef){return function(_0x2c6a96){_0x5136ef['emit'](_0x5b0874,_0x2c6a96);};}function removeListener(_0x214b38,_0x21f6a6){return function(){WhatsappAccountEvents['removeListener'](_0x214b38,_0x21f6a6);};}exports[_0xf207('0x4')]=function(_0x3fb080){for(var _0x4a643c=0x0,_0x297a75=events[_0xf207('0x5')];_0x4a643c<_0x297a75;_0x4a643c++){var _0x3f0353=events[_0x4a643c];var _0x14573b=createListener(_0xf207('0x6')+_0x3f0353,_0x3fb080);WhatsappAccountEvents['on'](_0x3f0353,_0x14573b);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 2e4b12c..f0cd389 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 _0x0ba1=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','/:id','show','post','create','update','destroy','exports','multer','path','connect-timeout','express'];(function(_0xf23088,_0x26fa40){var _0x1f13b9=function(_0x647b47){while(--_0x647b47){_0xf23088['push'](_0xf23088['shift']());}};_0x1f13b9(++_0x26fa40);}(_0x0ba1,0x1a0));var _0x10ba=function(_0x1019d2,_0xaa722c){_0x1019d2=_0x1019d2-0x0;var _0x5c4e09=_0x0ba1[_0x1019d2];return _0x5c4e09;};'use strict';var multer=require(_0x10ba('0x0'));var util=require('util');var path=require(_0x10ba('0x1'));var timeout=require(_0x10ba('0x2'));var express=require(_0x10ba('0x3'));var router=express[_0x10ba('0x4')]();var fs_extra=require(_0x10ba('0x5'));var auth=require(_0x10ba('0x6'));var interaction=require(_0x10ba('0x7'));var config=require(_0x10ba('0x8'));var controller=require(_0x10ba('0x9'));router[_0x10ba('0xa')]('/',auth[_0x10ba('0xb')](),controller[_0x10ba('0xc')]);router[_0x10ba('0xa')](_0x10ba('0xd'),auth[_0x10ba('0xb')](),controller[_0x10ba('0xe')]);router[_0x10ba('0xf')]('/',auth[_0x10ba('0xb')](),controller[_0x10ba('0x10')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x10ba('0x11')]);router['delete']('/:id',auth[_0x10ba('0xb')](),controller[_0x10ba('0x12')]);module[_0x10ba('0x13')]=router; \ No newline at end of file +var _0x24b0=['/:id','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','index','post','isAuthenticated','create','put','update','delete'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x24b0,0xff));var _0x024b=function(_0xffbea1,_0xdceb0){_0xffbea1=_0xffbea1-0x0;var _0x9cf19c=_0x24b0[_0xffbea1];return _0x9cf19c;};'use strict';var multer=require(_0x024b('0x0'));var util=require(_0x024b('0x1'));var path=require('path');var timeout=require(_0x024b('0x2'));var express=require(_0x024b('0x3'));var router=express[_0x024b('0x4')]();var fs_extra=require(_0x024b('0x5'));var auth=require(_0x024b('0x6'));var interaction=require(_0x024b('0x7'));var config=require(_0x024b('0x8'));var controller=require(_0x024b('0x9'));router[_0x024b('0xa')]('/',auth['isAuthenticated'](),controller[_0x024b('0xb')]);router[_0x024b('0xa')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x024b('0xc')]('/',auth[_0x024b('0xd')](),controller[_0x024b('0xe')]);router[_0x024b('0xf')]('/:id',auth[_0x024b('0xd')](),controller[_0x024b('0x10')]);router[_0x024b('0x11')](_0x024b('0x12'),auth[_0x024b('0xd')](),controller[_0x024b('0x13')]);module[_0x024b('0x14')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 140e99b..777f96e 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 _0x696c=['STRING','*,*,*,*','exports','INTEGER','TEXT'];(function(_0x3381f6,_0x56e649){var _0x3c28dc=function(_0x38b1e2){while(--_0x38b1e2){_0x3381f6['push'](_0x3381f6['shift']());}};_0x3c28dc(++_0x56e649);}(_0x696c,0xf2));var _0xc696=function(_0x5105e8,_0x44a2e0){_0x5105e8=_0x5105e8-0x0;var _0x53bbf5=_0x696c[_0x5105e8];return _0x53bbf5;};'use strict';var Sequelize=require('sequelize');module[_0xc696('0x0')]={'priority':{'type':Sequelize[_0xc696('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xc696('0x2')]()},'description':{'type':Sequelize[_0xc696('0x3')]},'interval':{'type':Sequelize[_0xc696('0x3')],'defaultValue':_0xc696('0x4')}}; \ No newline at end of file +var _0x04e4=['STRING','TEXT','sequelize','INTEGER'];(function(_0x5e700d,_0x4c43fc){var _0x2cfe02=function(_0x100494){while(--_0x100494){_0x5e700d['push'](_0x5e700d['shift']());}};_0x2cfe02(++_0x4c43fc);}(_0x04e4,0x1a6));var _0x404e=function(_0x2df2d,_0x16d62a){_0x2df2d=_0x2df2d-0x0;var _0x328513=_0x04e4[_0x2df2d];return _0x328513;};'use strict';var Sequelize=require(_0x404e('0x0'));module['exports']={'priority':{'type':Sequelize[_0x404e('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x404e('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x404e('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x404e('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 4ecb2f8..2d0b163 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 _0x404d=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','error','stack','name','send','map','WhatsappApplication','rawAttributes','type','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','VIRTUAL','merge','options','includeAll','findAll','rows','show','params','include','find','catch','create','body','update','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x404d,0x1e9));var _0xd404=function(_0x7fdf6d,_0x47e631){_0x7fdf6d=_0x7fdf6d-0x0;var _0x8803e1=_0x404d[_0x7fdf6d];return _0x8803e1;};'use strict';var emlformat=require(_0xd404('0x0'));var rimraf=require(_0xd404('0x1'));var zipdir=require(_0xd404('0x2'));var jsonpatch=require(_0xd404('0x3'));var rp=require(_0xd404('0x4'));var moment=require(_0xd404('0x5'));var BPromise=require(_0xd404('0x6'));var Mustache=require(_0xd404('0x7'));var util=require(_0xd404('0x8'));var path=require('path');var sox=require(_0xd404('0x9'));var csv=require(_0xd404('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd404('0xb'));var _=require(_0xd404('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd404('0xd'));var deskjs=require(_0xd404('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd404('0xf'));var Redis=require(_0xd404('0x10'));var authService=require(_0xd404('0x11'));var qs=require(_0xd404('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd404('0x13'))(_0xd404('0x14'));var utils=require('../../config/utils');var config=require(_0xd404('0x15'));var licenseUtil=require(_0xd404('0x16'));var db=require(_0xd404('0x17'))['db'];function respondWithStatusCode(_0x2cc1ec,_0x1d6071){_0x1d6071=_0x1d6071||0xcc;return function(_0x9f7667){if(_0x9f7667){return _0x2cc1ec[_0xd404('0x18')](_0x1d6071);}return _0x2cc1ec[_0xd404('0x19')](_0x1d6071)[_0xd404('0x1a')]();};}function respondWithResult(_0x31c8f8,_0x2516c2){_0x2516c2=_0x2516c2||0xc8;return function(_0x2ff703){if(_0x2ff703){return _0x31c8f8[_0xd404('0x19')](_0x2516c2)[_0xd404('0x1b')](_0x2ff703);}};}function respondWithFilteredResult(_0xaf965f,_0x424467){return function(_0x2051e8){if(_0x2051e8){var _0xa4d1b2=typeof _0x424467[_0xd404('0x1c')]===_0xd404('0x1d')&&typeof _0x424467[_0xd404('0x1e')]==='undefined';var _0x1ad1c4=_0x2051e8[_0xd404('0x1f')];var _0x5e19e4=_0xa4d1b2?0x0:_0x424467[_0xd404('0x1c')];var _0x149fa5=_0xa4d1b2?_0x2051e8['count']:_0x424467[_0xd404('0x1c')]+_0x424467[_0xd404('0x1e')];var _0x387d0b;if(_0x149fa5>=_0x1ad1c4){_0x149fa5=_0x1ad1c4;_0x387d0b=0xc8;}else{_0x387d0b=0xce;}_0xaf965f['status'](_0x387d0b);return _0xaf965f[_0xd404('0x20')](_0xd404('0x21'),_0x5e19e4+'-'+_0x149fa5+'/'+_0x1ad1c4)[_0xd404('0x1b')](_0x2051e8);}return null;};}function patchUpdates(_0x3e8183){return function(_0x1d89e0){try{jsonpatch[_0xd404('0x22')](_0x1d89e0,_0x3e8183,!![]);}catch(_0x458f6e){return BPromise['reject'](_0x458f6e);}return _0x1d89e0[_0xd404('0x23')]();};}function saveUpdates(_0xcc7bf1,_0x50c0e2){return function(_0x17d0e6){if(_0x17d0e6){return _0x17d0e6['update'](_0xcc7bf1)['then'](function(_0x1005d1){return _0x1005d1;});}return null;};}function removeEntity(_0x476731,_0x133232){return function(_0x32b5f8){if(_0x32b5f8){return _0x32b5f8['destroy']()[_0xd404('0x24')](function(){_0x476731[_0xd404('0x19')](0xcc)[_0xd404('0x1a')]();});}};}function handleEntityNotFound(_0x55cfde,_0x557d0e){return function(_0x3e706a){if(!_0x3e706a){_0x55cfde[_0xd404('0x18')](0x194);}return _0x3e706a;};}function handleError(_0x2d7af8,_0x36fdb6){_0x36fdb6=_0x36fdb6||0x1f4;return function(_0x1ddf0d){logger[_0xd404('0x25')](_0x1ddf0d[_0xd404('0x26')]);if(_0x1ddf0d[_0xd404('0x27')]){delete _0x1ddf0d['name'];}_0x2d7af8['status'](_0x36fdb6)[_0xd404('0x28')](_0x1ddf0d);};}exports['index']=function(_0x2b14ec,_0x4f210c){var _0x23525b={},_0x1e6341={},_0x3e746e={'count':0x0,'rows':[]};var _0x2268d2=_[_0xd404('0x29')](db[_0xd404('0x2a')][_0xd404('0x2b')],function(_0x4ece21){return{'name':_0x4ece21['fieldName'],'type':_0x4ece21[_0xd404('0x2c')]['key']};});_0x1e6341['model']=_[_0xd404('0x29')](_0x2268d2,_0xd404('0x27'));_0x1e6341[_0xd404('0x2d')]=_['keys'](_0x2b14ec[_0xd404('0x2d')]);_0x1e6341['filters']=_[_0xd404('0x2e')](_0x1e6341[_0xd404('0x2f')],_0x1e6341['query']);_0x23525b[_0xd404('0x30')]=_[_0xd404('0x2e')](_0x1e6341[_0xd404('0x2f')],qs[_0xd404('0x31')](_0x2b14ec[_0xd404('0x2d')]['fields']));_0x23525b[_0xd404('0x30')]=_0x23525b[_0xd404('0x30')][_0xd404('0x32')]?_0x23525b['attributes']:_0x1e6341[_0xd404('0x2f')];if(!_0x2b14ec[_0xd404('0x2d')][_0xd404('0x33')](_0xd404('0x34'))){_0x23525b['limit']=qs['limit'](_0x2b14ec[_0xd404('0x2d')][_0xd404('0x1e')]);_0x23525b[_0xd404('0x1c')]=qs[_0xd404('0x1c')](_0x2b14ec[_0xd404('0x2d')][_0xd404('0x1c')]);}_0x23525b['order']=qs[_0xd404('0x35')](_0x2b14ec[_0xd404('0x2d')][_0xd404('0x35')]);_0x23525b['where']=qs[_0xd404('0x36')](_[_0xd404('0x37')](_0x2b14ec[_0xd404('0x2d')],_0x1e6341['filters']),_0x2268d2);if(_0x2b14ec[_0xd404('0x2d')][_0xd404('0x38')]){_0x23525b[_0xd404('0x39')]=_['merge'](_0x23525b[_0xd404('0x39')],{'$or':_[_0xd404('0x29')](_0x2268d2,function(_0x47a108){if(_0x47a108[_0xd404('0x2c')]!==_0xd404('0x3a')){var _0x237592={};_0x237592[_0x47a108[_0xd404('0x27')]]={'$like':'%'+_0x2b14ec[_0xd404('0x2d')][_0xd404('0x38')]+'%'};return _0x237592;}})});}_0x23525b=_[_0xd404('0x3b')]({},_0x23525b,_0x2b14ec[_0xd404('0x3c')]);var _0x58f0ad={'where':_0x23525b[_0xd404('0x39')]};return db['WhatsappApplication'][_0xd404('0x1f')](_0x58f0ad)[_0xd404('0x24')](function(_0x598f08){_0x3e746e[_0xd404('0x1f')]=_0x598f08;if(_0x2b14ec['query'][_0xd404('0x3d')]){_0x23525b['include']=[{'all':!![]}];}return db['WhatsappApplication'][_0xd404('0x3e')](_0x23525b);})[_0xd404('0x24')](function(_0x397f30){_0x3e746e[_0xd404('0x3f')]=_0x397f30;return _0x3e746e;})['then'](respondWithFilteredResult(_0x4f210c,_0x23525b))['catch'](handleError(_0x4f210c,null));};exports[_0xd404('0x40')]=function(_0x234876,_0x8c56bc){var _0x108cc3={'raw':!![],'where':{'id':_0x234876[_0xd404('0x41')]['id']}},_0x199d66={};_0x199d66[_0xd404('0x2f')]=_['keys'](db[_0xd404('0x2a')]['rawAttributes']);_0x199d66[_0xd404('0x2d')]=_['keys'](_0x234876[_0xd404('0x2d')]);_0x199d66[_0xd404('0x36')]=_[_0xd404('0x2e')](_0x199d66['model'],_0x199d66[_0xd404('0x2d')]);_0x108cc3[_0xd404('0x30')]=_[_0xd404('0x2e')](_0x199d66[_0xd404('0x2f')],qs['fields'](_0x234876[_0xd404('0x2d')][_0xd404('0x31')]));_0x108cc3[_0xd404('0x30')]=_0x108cc3[_0xd404('0x30')][_0xd404('0x32')]?_0x108cc3[_0xd404('0x30')]:_0x199d66[_0xd404('0x2f')];if(_0x234876[_0xd404('0x2d')][_0xd404('0x3d')]){_0x108cc3[_0xd404('0x42')]=[{'all':!![]}];}_0x108cc3=_[_0xd404('0x3b')]({},_0x108cc3,_0x234876['options']);return db[_0xd404('0x2a')][_0xd404('0x43')](_0x108cc3)[_0xd404('0x24')](handleEntityNotFound(_0x8c56bc,null))[_0xd404('0x24')](respondWithResult(_0x8c56bc,null))[_0xd404('0x44')](handleError(_0x8c56bc,null));};exports['create']=function(_0x175982,_0x30cc1c){return db['WhatsappApplication'][_0xd404('0x45')](_0x175982[_0xd404('0x46')],{})[_0xd404('0x24')](respondWithResult(_0x30cc1c,0xc9))[_0xd404('0x44')](handleError(_0x30cc1c,null));};exports[_0xd404('0x47')]=function(_0x169dc9,_0x21ff82){if(_0x169dc9[_0xd404('0x46')]['id']){delete _0x169dc9[_0xd404('0x46')]['id'];}return db['WhatsappApplication'][_0xd404('0x43')]({'where':{'id':_0x169dc9[_0xd404('0x41')]['id']}})['then'](handleEntityNotFound(_0x21ff82,null))[_0xd404('0x24')](saveUpdates(_0x169dc9[_0xd404('0x46')],null))[_0xd404('0x24')](respondWithResult(_0x21ff82,null))['catch'](handleError(_0x21ff82,null));};exports[_0xd404('0x48')]=function(_0x584a03,_0x16737a){return db[_0xd404('0x2a')][_0xd404('0x43')]({'where':{'id':_0x584a03[_0xd404('0x41')]['id']}})[_0xd404('0x24')](handleEntityNotFound(_0x16737a,null))['then'](removeEntity(_0x16737a,null))['catch'](handleError(_0x16737a,null));}; \ No newline at end of file +var _0xaac4=['send','index','WhatsappApplication','rawAttributes','fieldName','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','findAll','catch','show','params','includeAll','create','body','update','find','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','set','Content-Range','json','apply','save','then','destroy','error','name'];(function(_0x178aa7,_0x5463bb){var _0x334f6=function(_0x463b84){while(--_0x463b84){_0x178aa7['push'](_0x178aa7['shift']());}};_0x334f6(++_0x5463bb);}(_0xaac4,0x6c));var _0x4aac=function(_0x542ae7,_0x57332f){_0x542ae7=_0x542ae7-0x0;var _0x5a96a6=_0xaac4[_0x542ae7];return _0x5a96a6;};'use strict';var emlformat=require(_0x4aac('0x0'));var rimraf=require(_0x4aac('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4aac('0x2'));var rp=require(_0x4aac('0x3'));var moment=require(_0x4aac('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4aac('0x5'));var util=require(_0x4aac('0x6'));var path=require(_0x4aac('0x7'));var sox=require(_0x4aac('0x8'));var csv=require(_0x4aac('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4aac('0xa'));var _=require(_0x4aac('0xb'));var squel=require(_0x4aac('0xc'));var crypto=require('crypto');var jsforce=require(_0x4aac('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x4aac('0x9'));var querystring=require(_0x4aac('0xe'));var Papa=require(_0x4aac('0xf'));var Redis=require(_0x4aac('0x10'));var authService=require(_0x4aac('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x4aac('0x12'));var hardwareService=require(_0x4aac('0x13'));var logger=require(_0x4aac('0x14'))(_0x4aac('0x15'));var utils=require('../../config/utils');var config=require(_0x4aac('0x16'));var licenseUtil=require(_0x4aac('0x17'));var db=require(_0x4aac('0x18'))['db'];function respondWithStatusCode(_0xfec6bd,_0x323eb0){_0x323eb0=_0x323eb0||0xcc;return function(_0x30eefc){if(_0x30eefc){return _0xfec6bd[_0x4aac('0x19')](_0x323eb0);}return _0xfec6bd['status'](_0x323eb0)[_0x4aac('0x1a')]();};}function respondWithResult(_0x5b1b27,_0x35469f){_0x35469f=_0x35469f||0xc8;return function(_0x55cbf4){if(_0x55cbf4){return _0x5b1b27[_0x4aac('0x1b')](_0x35469f)['json'](_0x55cbf4);}};}function respondWithFilteredResult(_0x2c58d3,_0x442883){return function(_0x2dca5b){if(_0x2dca5b){var _0x593782=typeof _0x442883[_0x4aac('0x1c')]===_0x4aac('0x1d')&&typeof _0x442883['limit']==='undefined';var _0x5c02c6=_0x2dca5b['count'];var _0x1539fb=_0x593782?0x0:_0x442883[_0x4aac('0x1c')];var _0x44d2a1=_0x593782?_0x2dca5b['count']:_0x442883[_0x4aac('0x1c')]+_0x442883[_0x4aac('0x1e')];var _0x2f751b;if(_0x44d2a1>=_0x5c02c6){_0x44d2a1=_0x5c02c6;_0x2f751b=0xc8;}else{_0x2f751b=0xce;}_0x2c58d3[_0x4aac('0x1b')](_0x2f751b);return _0x2c58d3[_0x4aac('0x1f')](_0x4aac('0x20'),_0x1539fb+'-'+_0x44d2a1+'/'+_0x5c02c6)[_0x4aac('0x21')](_0x2dca5b);}return null;};}function patchUpdates(_0x2c26cc){return function(_0x331226){try{jsonpatch[_0x4aac('0x22')](_0x331226,_0x2c26cc,!![]);}catch(_0x39d457){return BPromise['reject'](_0x39d457);}return _0x331226[_0x4aac('0x23')]();};}function saveUpdates(_0x16eef9,_0x594ef1){return function(_0x192db5){if(_0x192db5){return _0x192db5['update'](_0x16eef9)[_0x4aac('0x24')](function(_0x23fb33){return _0x23fb33;});}return null;};}function removeEntity(_0x34a384,_0x3d4836){return function(_0x1a9cca){if(_0x1a9cca){return _0x1a9cca[_0x4aac('0x25')]()[_0x4aac('0x24')](function(){_0x34a384['status'](0xcc)[_0x4aac('0x1a')]();});}};}function handleEntityNotFound(_0x279c10,_0x431cd9){return function(_0x516261){if(!_0x516261){_0x279c10[_0x4aac('0x19')](0x194);}return _0x516261;};}function handleError(_0x1f135a,_0x1b57ed){_0x1b57ed=_0x1b57ed||0x1f4;return function(_0x18bafe){logger[_0x4aac('0x26')](_0x18bafe['stack']);if(_0x18bafe[_0x4aac('0x27')]){delete _0x18bafe['name'];}_0x1f135a['status'](_0x1b57ed)[_0x4aac('0x28')](_0x18bafe);};}exports[_0x4aac('0x29')]=function(_0x459028,_0x3a1bd3){var _0x37a98b={},_0x5133b8={},_0x2750f3={'count':0x0,'rows':[]};var _0xf7618d=_['map'](db[_0x4aac('0x2a')][_0x4aac('0x2b')],function(_0x59b69f){return{'name':_0x59b69f[_0x4aac('0x2c')],'type':_0x59b69f['type']['key']};});_0x5133b8[_0x4aac('0x2d')]=_[_0x4aac('0x2e')](_0xf7618d,_0x4aac('0x27'));_0x5133b8['query']=_[_0x4aac('0x2f')](_0x459028[_0x4aac('0x30')]);_0x5133b8[_0x4aac('0x31')]=_[_0x4aac('0x32')](_0x5133b8[_0x4aac('0x2d')],_0x5133b8['query']);_0x37a98b[_0x4aac('0x33')]=_[_0x4aac('0x32')](_0x5133b8[_0x4aac('0x2d')],qs[_0x4aac('0x34')](_0x459028['query'][_0x4aac('0x34')]));_0x37a98b[_0x4aac('0x33')]=_0x37a98b['attributes'][_0x4aac('0x35')]?_0x37a98b[_0x4aac('0x33')]:_0x5133b8['model'];if(!_0x459028[_0x4aac('0x30')][_0x4aac('0x36')](_0x4aac('0x37'))){_0x37a98b['limit']=qs['limit'](_0x459028[_0x4aac('0x30')][_0x4aac('0x1e')]);_0x37a98b['offset']=qs[_0x4aac('0x1c')](_0x459028[_0x4aac('0x30')]['offset']);}_0x37a98b[_0x4aac('0x38')]=qs[_0x4aac('0x39')](_0x459028[_0x4aac('0x30')][_0x4aac('0x39')]);_0x37a98b[_0x4aac('0x3a')]=qs[_0x4aac('0x31')](_[_0x4aac('0x3b')](_0x459028[_0x4aac('0x30')],_0x5133b8[_0x4aac('0x31')]),_0xf7618d);if(_0x459028['query'][_0x4aac('0x3c')]){_0x37a98b[_0x4aac('0x3a')]=_[_0x4aac('0x3d')](_0x37a98b['where'],{'$or':_[_0x4aac('0x2e')](_0xf7618d,function(_0x1717c0){if(_0x1717c0[_0x4aac('0x3e')]!==_0x4aac('0x3f')){var _0x2c9a8f={};_0x2c9a8f[_0x1717c0[_0x4aac('0x27')]]={'$like':'%'+_0x459028[_0x4aac('0x30')][_0x4aac('0x3c')]+'%'};return _0x2c9a8f;}})});}_0x37a98b=_[_0x4aac('0x3d')]({},_0x37a98b,_0x459028[_0x4aac('0x40')]);var _0x331514={'where':_0x37a98b['where']};return db[_0x4aac('0x2a')]['count'](_0x331514)[_0x4aac('0x24')](function(_0x1d1435){_0x2750f3['count']=_0x1d1435;if(_0x459028[_0x4aac('0x30')]['includeAll']){_0x37a98b['include']=[{'all':!![]}];}return db[_0x4aac('0x2a')][_0x4aac('0x41')](_0x37a98b);})[_0x4aac('0x24')](function(_0x3d1cd5){_0x2750f3['rows']=_0x3d1cd5;return _0x2750f3;})[_0x4aac('0x24')](respondWithFilteredResult(_0x3a1bd3,_0x37a98b))[_0x4aac('0x42')](handleError(_0x3a1bd3,null));};exports[_0x4aac('0x43')]=function(_0xf84265,_0x44fb73){var _0x354fed={'raw':!![],'where':{'id':_0xf84265[_0x4aac('0x44')]['id']}},_0x5d09f6={};_0x5d09f6['model']=_[_0x4aac('0x2f')](db[_0x4aac('0x2a')][_0x4aac('0x2b')]);_0x5d09f6['query']=_[_0x4aac('0x2f')](_0xf84265[_0x4aac('0x30')]);_0x5d09f6[_0x4aac('0x31')]=_[_0x4aac('0x32')](_0x5d09f6[_0x4aac('0x2d')],_0x5d09f6[_0x4aac('0x30')]);_0x354fed['attributes']=_['intersection'](_0x5d09f6[_0x4aac('0x2d')],qs['fields'](_0xf84265[_0x4aac('0x30')][_0x4aac('0x34')]));_0x354fed[_0x4aac('0x33')]=_0x354fed[_0x4aac('0x33')][_0x4aac('0x35')]?_0x354fed[_0x4aac('0x33')]:_0x5d09f6[_0x4aac('0x2d')];if(_0xf84265[_0x4aac('0x30')][_0x4aac('0x45')]){_0x354fed['include']=[{'all':!![]}];}_0x354fed=_[_0x4aac('0x3d')]({},_0x354fed,_0xf84265[_0x4aac('0x40')]);return db['WhatsappApplication']['find'](_0x354fed)[_0x4aac('0x24')](handleEntityNotFound(_0x44fb73,null))['then'](respondWithResult(_0x44fb73,null))['catch'](handleError(_0x44fb73,null));};exports['create']=function(_0x5191ba,_0x58c47b){return db['WhatsappApplication'][_0x4aac('0x46')](_0x5191ba[_0x4aac('0x47')],{})[_0x4aac('0x24')](respondWithResult(_0x58c47b,0xc9))[_0x4aac('0x42')](handleError(_0x58c47b,null));};exports[_0x4aac('0x48')]=function(_0x2d25f9,_0x74f0ad){if(_0x2d25f9[_0x4aac('0x47')]['id']){delete _0x2d25f9[_0x4aac('0x47')]['id'];}return db[_0x4aac('0x2a')]['find']({'where':{'id':_0x2d25f9[_0x4aac('0x44')]['id']}})[_0x4aac('0x24')](handleEntityNotFound(_0x74f0ad,null))['then'](saveUpdates(_0x2d25f9[_0x4aac('0x47')],null))[_0x4aac('0x24')](respondWithResult(_0x74f0ad,null))[_0x4aac('0x42')](handleError(_0x74f0ad,null));};exports[_0x4aac('0x25')]=function(_0x1b2179,_0x1164de){return db[_0x4aac('0x2a')][_0x4aac('0x49')]({'where':{'id':_0x1b2179[_0x4aac('0x44')]['id']}})[_0x4aac('0x24')](handleEntityNotFound(_0x1164de,null))[_0x4aac('0x24')](removeEntity(_0x1164de,null))[_0x4aac('0x42')](handleError(_0x1164de,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index c7c9e95..5b884be 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 _0xf874=['bluebird','request-promise','path','../../config/environment','./whatsappApplication.attributes','exports','define','whatsapp_applications','utf8mb4','../../config/logger','api','moment'];(function(_0x23d147,_0xeec48c){var _0x47ebf4=function(_0x9f687f){while(--_0x9f687f){_0x23d147['push'](_0x23d147['shift']());}};_0x47ebf4(++_0xeec48c);}(_0xf874,0xed));var _0x4f87=function(_0x1dfd5e,_0x4b7e5c){_0x1dfd5e=_0x1dfd5e-0x0;var _0xf3a5af=_0xf874[_0x1dfd5e];return _0xf3a5af;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4f87('0x0'))(_0x4f87('0x1'));var moment=require(_0x4f87('0x2'));var BPromise=require(_0x4f87('0x3'));var rp=require(_0x4f87('0x4'));var fs=require('fs');var path=require(_0x4f87('0x5'));var rimraf=require('rimraf');var config=require(_0x4f87('0x6'));var attributes=require(_0x4f87('0x7'));module[_0x4f87('0x8')]=function(_0xf0ffb3,_0x104682){return _0xf0ffb3[_0x4f87('0x9')]('WhatsappApplication',attributes,{'tableName':_0x4f87('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4f87('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x3937=['../../config/logger','api','bluebird','path','../../config/environment','./whatsappApplication.attributes','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4','lodash'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x3937,0xbf));var _0x7393=function(_0x57502b,_0x3a3a27){_0x57502b=_0x57502b-0x0;var _0x582c8e=_0x3937[_0x57502b];return _0x582c8e;};'use strict';var _=require(_0x7393('0x0'));var util=require('util');var logger=require(_0x7393('0x1'))(_0x7393('0x2'));var moment=require('moment');var BPromise=require(_0x7393('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7393('0x4'));var rimraf=require('rimraf');var config=require(_0x7393('0x5'));var attributes=require(_0x7393('0x6'));module[_0x7393('0x7')]=function(_0x1f538f,_0x15eabd){return _0x1f538f[_0x7393('0x8')](_0x7393('0x9'),attributes,{'tableName':_0x7393('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7393('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index cd677c2..2c1574d 100644 --- a/server/api/whatsappApplication/whatsappApplication.rpc.js +++ b/server/api/whatsappApplication/whatsappApplication.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xda55=['util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash'];(function(_0x357633,_0x254610){var _0x261faf=function(_0x18b745){while(--_0x18b745){_0x357633['push'](_0x357633['shift']());}};_0x261faf(++_0x254610);}(_0xda55,0x6d));var _0x5da5=function(_0x4dd566,_0xb70f5a){_0x4dd566=_0x4dd566-0x0;var _0x57a60f=_0xda55[_0x4dd566];return _0x57a60f;};'use strict';var _=require(_0x5da5('0x0'));var util=require(_0x5da5('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5da5('0x2'));var fs=require('fs');var Redis=require(_0x5da5('0x3'));var db=require(_0x5da5('0x4'))['db'];var utils=require(_0x5da5('0x5'));var logger=require(_0x5da5('0x6'))('rpc');var config=require(_0x5da5('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5da5('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2fd877,_0x267469,_0x71b187){return new BPromise(function(_0x46290d,_0x3debdf){return client[_0x5da5('0x9')](_0x2fd877,_0x71b187)[_0x5da5('0xa')](function(_0x302795){logger['info'](_0x5da5('0xb'),_0x267469,_0x5da5('0xc'));logger[_0x5da5('0xd')](_0x5da5('0xe'),_0x267469,_0x5da5('0xc'),JSON[_0x5da5('0xf')](_0x302795));if(_0x302795[_0x5da5('0x10')]){if(_0x302795['error'][_0x5da5('0x11')]===0x1f4){logger[_0x5da5('0x10')]('WhatsappApplication,\x20%s,\x20%s',_0x267469,_0x302795[_0x5da5('0x10')][_0x5da5('0x12')]);return _0x3debdf(_0x302795[_0x5da5('0x10')][_0x5da5('0x12')]);}logger[_0x5da5('0x10')](_0x5da5('0xb'),_0x267469,_0x302795['error']['message']);return _0x46290d(_0x302795['error'][_0x5da5('0x12')]);}else{logger[_0x5da5('0x13')](_0x5da5('0xb'),_0x267469,_0x5da5('0xc'));_0x46290d(_0x302795[_0x5da5('0x14')][_0x5da5('0x12')]);}})[_0x5da5('0x15')](function(_0x4a952a){logger[_0x5da5('0x10')](_0x5da5('0xb'),_0x267469,_0x4a952a);_0x3debdf(_0x4a952a);});});} \ No newline at end of file +var _0xd0bb=['debug','stringify','error','code','WhatsappApplication,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','request\x20sent'];(function(_0x3253f3,_0x1c57d8){var _0x598c26=function(_0x4c1251){while(--_0x4c1251){_0x3253f3['push'](_0x3253f3['shift']());}};_0x598c26(++_0x1c57d8);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0x4f83ca,_0x46f67a){_0x4f83ca=_0x4f83ca-0x0;var _0x1fbac3=_0xd0bb[_0x4f83ca];return _0x1fbac3;};'use strict';var _=require(_0xbd0b('0x0'));var util=require(_0xbd0b('0x1'));var moment=require(_0xbd0b('0x2'));var BPromise=require('bluebird');var rs=require(_0xbd0b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbd0b('0x4'))['db'];var utils=require(_0xbd0b('0x5'));var logger=require('../../config/logger')(_0xbd0b('0x6'));var config=require('../../config/environment');var jayson=require(_0xbd0b('0x7'));var client=jayson[_0xbd0b('0x8')][_0xbd0b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x37c205,_0x809599,_0x5eb975){return new BPromise(function(_0x2a4075,_0x4533ff){return client[_0xbd0b('0xa')](_0x37c205,_0x5eb975)[_0xbd0b('0xb')](function(_0x16e185){logger['info']('WhatsappApplication,\x20%s,\x20%s',_0x809599,_0xbd0b('0xc'));logger[_0xbd0b('0xd')]('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0x809599,_0xbd0b('0xc'),JSON[_0xbd0b('0xe')](_0x16e185));if(_0x16e185['error']){if(_0x16e185[_0xbd0b('0xf')][_0xbd0b('0x10')]===0x1f4){logger[_0xbd0b('0xf')](_0xbd0b('0x11'),_0x809599,_0x16e185[_0xbd0b('0xf')][_0xbd0b('0x12')]);return _0x4533ff(_0x16e185[_0xbd0b('0xf')][_0xbd0b('0x12')]);}logger[_0xbd0b('0xf')](_0xbd0b('0x11'),_0x809599,_0x16e185[_0xbd0b('0xf')]['message']);return _0x2a4075(_0x16e185[_0xbd0b('0xf')]['message']);}else{logger['info'](_0xbd0b('0x11'),_0x809599,_0xbd0b('0xc'));_0x2a4075(_0x16e185[_0xbd0b('0x13')][_0xbd0b('0x12')]);}})[_0xbd0b('0x14')](function(_0x546db3){logger['error'](_0xbd0b('0x11'),_0x809599,_0x546db3);_0x4533ff(_0x546db3);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index afba53f..a82d833 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 _0xb46f=['index','/describe','describe','/:id/messages','getMessages','/:id/download','download','post','create','tracked','whatsappinteraction:addtags','addTags','put','/:id','whatsapp','whatsappinteraction:update','delete','whatsappinteraction:destroy','destroy','/:id/tags','removeTags','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated'];(function(_0x5e1745,_0x5cd318){var _0x82fe5=function(_0xb3bdc3){while(--_0xb3bdc3){_0x5e1745['push'](_0x5e1745['shift']());}};_0x82fe5(++_0x5cd318);}(_0xb46f,0xb6));var _0xfb46=function(_0x51b13c,_0x2e8fe1){_0x51b13c=_0x51b13c-0x0;var _0x545397=_0xb46f[_0x51b13c];return _0x545397;};'use strict';var multer=require(_0xfb46('0x0'));var util=require(_0xfb46('0x1'));var path=require('path');var timeout=require(_0xfb46('0x2'));var express=require(_0xfb46('0x3'));var router=express[_0xfb46('0x4')]();var fs_extra=require(_0xfb46('0x5'));var auth=require(_0xfb46('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xfb46('0x7'));var controller=require('./whatsappInteraction.controller');router[_0xfb46('0x8')]('/',auth[_0xfb46('0x9')](),controller[_0xfb46('0xa')]);router[_0xfb46('0x8')](_0xfb46('0xb'),auth['isAuthenticated'](),controller[_0xfb46('0xc')]);router[_0xfb46('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router['get'](_0xfb46('0xd'),auth['isAuthenticated'](),controller[_0xfb46('0xe')]);router[_0xfb46('0x8')](_0xfb46('0xf'),auth[_0xfb46('0x9')](),controller[_0xfb46('0x10')]);router[_0xfb46('0x11')]('/',auth[_0xfb46('0x9')](),controller[_0xfb46('0x12')]);router[_0xfb46('0x11')](_0xfb46('0xd'),auth['isAuthenticated'](),controller['addMessage']);router[_0xfb46('0x11')]('/:id/tags',auth[_0xfb46('0x9')](),interaction[_0xfb46('0x13')]('whatsapp',_0xfb46('0x14')),controller[_0xfb46('0x15')]);router[_0xfb46('0x16')](_0xfb46('0x17'),auth['isAuthenticated'](),interaction[_0xfb46('0x13')](_0xfb46('0x18'),_0xfb46('0x19')),controller['update']);router[_0xfb46('0x1a')](_0xfb46('0x17'),auth['isAuthenticated'](),interaction['tracked'](_0xfb46('0x18'),_0xfb46('0x1b')),controller[_0xfb46('0x1c')]);router[_0xfb46('0x1a')](_0xfb46('0x1d'),auth[_0xfb46('0x9')](),controller[_0xfb46('0x1e')]);module[_0xfb46('0x1f')]=router; \ No newline at end of file +var _0x187d=['whatsapp','whatsappinteraction:addtags','addTags','put','whatsappinteraction:update','tracked','whatsappinteraction:destroy','destroy','delete','removeTags','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappInteraction.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/messages','getMessages','download','post','create','addMessage','/:id/tags'];(function(_0x208794,_0x1c0f46){var _0x4b58f1=function(_0x4accfe){while(--_0x4accfe){_0x208794['push'](_0x208794['shift']());}};_0x4b58f1(++_0x1c0f46);}(_0x187d,0x93));var _0xd187=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0x187d[_0x4709c0];return _0x13348b;};'use strict';var multer=require(_0xd187('0x0'));var util=require('util');var path=require(_0xd187('0x1'));var timeout=require(_0xd187('0x2'));var express=require(_0xd187('0x3'));var router=express[_0xd187('0x4')]();var fs_extra=require(_0xd187('0x5'));var auth=require(_0xd187('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd187('0x7'));var controller=require(_0xd187('0x8'));router['get']('/',auth[_0xd187('0x9')](),controller[_0xd187('0xa')]);router[_0xd187('0xb')](_0xd187('0xc'),auth[_0xd187('0x9')](),controller[_0xd187('0xd')]);router[_0xd187('0xb')](_0xd187('0xe'),auth['isAuthenticated'](),controller[_0xd187('0xf')]);router[_0xd187('0xb')](_0xd187('0x10'),auth[_0xd187('0x9')](),controller[_0xd187('0x11')]);router[_0xd187('0xb')]('/:id/download',auth[_0xd187('0x9')](),controller[_0xd187('0x12')]);router[_0xd187('0x13')]('/',auth['isAuthenticated'](),controller[_0xd187('0x14')]);router[_0xd187('0x13')](_0xd187('0x10'),auth['isAuthenticated'](),controller[_0xd187('0x15')]);router[_0xd187('0x13')](_0xd187('0x16'),auth[_0xd187('0x9')](),interaction['tracked'](_0xd187('0x17'),_0xd187('0x18')),controller[_0xd187('0x19')]);router[_0xd187('0x1a')]('/:id',auth[_0xd187('0x9')](),interaction['tracked']('whatsapp',_0xd187('0x1b')),controller['update']);router['delete'](_0xd187('0xe'),auth[_0xd187('0x9')](),interaction[_0xd187('0x1c')](_0xd187('0x17'),_0xd187('0x1d')),controller[_0xd187('0x1e')]);router[_0xd187('0x1f')](_0xd187('0x16'),auth[_0xd187('0x9')](),controller[_0xd187('0x20')]);module[_0xd187('0x21')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 470f8dc..421950e 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 _0xb19a=['STRING','DATE','ENUM','out','INTEGER','sequelize','BOOLEAN'];(function(_0x582974,_0x5968cb){var _0x364d64=function(_0xb2ac45){while(--_0xb2ac45){_0x582974['push'](_0x582974['shift']());}};_0x364d64(++_0x5968cb);}(_0xb19a,0xd0));var _0xab19=function(_0x29dd02,_0x10d75c){_0x29dd02=_0x29dd02-0x0;var _0x1fa293=_0xb19a[_0x29dd02];return _0x1fa293;};'use strict';var Sequelize=require(_0xab19('0x0'));var moment=require('moment');module['exports']={'closed':{'type':Sequelize[_0xab19('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xab19('0x2')]},'thirdDisposition':{'type':Sequelize[_0xab19('0x2')]},'note':{'type':Sequelize[_0xab19('0x2')]},'phone':{'type':Sequelize[_0xab19('0x2')]},'read1stAt':{'type':Sequelize[_0xab19('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xab19('0x4')]('in',_0xab19('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xab19('0x4')]('in',_0xab19('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0xab19('0x6')]}}; \ No newline at end of file +var _0x1c7c=['STRING','DATE','ENUM','out','INTEGER','sequelize','moment','exports','BOOLEAN'];(function(_0x5d770d,_0x4046d3){var _0x20d187=function(_0x3579a5){while(--_0x3579a5){_0x5d770d['push'](_0x5d770d['shift']());}};_0x20d187(++_0x4046d3);}(_0x1c7c,0x164));var _0xc1c7=function(_0x345e67,_0x57ebc5){_0x345e67=_0x345e67-0x0;var _0x43f4c8=_0x1c7c[_0x345e67];return _0x43f4c8;};'use strict';var Sequelize=require(_0xc1c7('0x0'));var moment=require(_0xc1c7('0x1'));module[_0xc1c7('0x2')]={'closed':{'type':Sequelize[_0xc1c7('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xc1c7('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xc1c7('0x4')]},'note':{'type':Sequelize[_0xc1c7('0x4')]},'phone':{'type':Sequelize[_0xc1c7('0x4')]},'read1stAt':{'type':Sequelize[_0xc1c7('0x5')]},'firstMsgDirection':{'type':Sequelize[_0xc1c7('0x6')]('in',_0xc1c7('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xc1c7('0x5')]},'lastMsgDirection':{'type':Sequelize[_0xc1c7('0x6')]('in',_0xc1c7('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xc1c7('0x3')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xc1c7('0x8')]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 2d39f30..2bfb55d 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 _0xf93e=['hasOwnProperty','nolimit','sort','pick','where','filter','map','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','include','rows','addTags','spread','Tag','color','emit','whatsappInteractionTags:save','removeTags','unix','toString','root','server','files','tmp','attachments','join','transcript-%d-%s.zip','User','fullname','push','CmContact','Contact','firstName','Attachment','Messages','createdAt','direction','secret','read','WhatsappAccount','Account','Owner','get','Whatsapp','closed','closedAt','disposition','basename','existsSync','pipe','createWriteStream','out','System','lastName','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','download','log','err','unlinkSync','rimraf','zip-dir','moment','bluebird','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','update','then','destroy','error','name','send','index','WhatsappInteraction','rawAttributes','type','key','getOptions','findAll','whatsapp','query','user','catch','show','params','keys','filters','intersection','attributes','model','fields','includeAll','merge','find','create','body','addMessage','WhatsappMessage','ids','omit','getMessages'];(function(_0x39ffd1,_0x299703){var _0x31267e=function(_0x11b420){while(--_0x11b420){_0x39ffd1['push'](_0x39ffd1['shift']());}};_0x31267e(++_0x299703);}(_0xf93e,0x1be));var _0xef93=function(_0x5f37a4,_0x376c6a){_0x5f37a4=_0x5f37a4-0x0;var _0x5df86f=_0xf93e[_0x5f37a4];return _0x5df86f;};'use strict';var rimraf=require(_0xef93('0x0'));var zipdir=require(_0xef93('0x1'));var moment=require(_0xef93('0x2'));var BPromise=require(_0xef93('0x3'));var util=require(_0xef93('0x4'));var path=require(_0xef93('0x5'));var ejs=require(_0xef93('0x6'));var fs=require('fs');var _=require(_0xef93('0x7'));var Redis=require(_0xef93('0x8'));var interaction=require(_0xef93('0x9'));var qs=require(_0xef93('0xa'));var pdf=require('../../components/export/pdf');var logger=require(_0xef93('0xb'))(_0xef93('0xc'));var config=require(_0xef93('0xd'));var db=require('../../mysqldb')['db'];config[_0xef93('0xe')]=_['defaults'](config[_0xef93('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0xef93('0xf'))(new Redis(config[_0xef93('0xe')]));require(_0xef93('0x10'))[_0xef93('0x11')](socket);function respondWithStatusCode(_0x3eeedd,_0x40584e){_0x40584e=_0x40584e||0xcc;return function(_0x33665c){if(_0x33665c){return _0x3eeedd[_0xef93('0x12')](_0x40584e);}return _0x3eeedd[_0xef93('0x13')](_0x40584e)[_0xef93('0x14')]();};}function respondWithResult(_0x330a22,_0x28c64c){_0x28c64c=_0x28c64c||0xc8;return function(_0xb1ed7){if(_0xb1ed7){return _0x330a22[_0xef93('0x13')](_0x28c64c)[_0xef93('0x15')](_0xb1ed7);}};}function respondWithFilteredResult(_0x48b1b9,_0x43b6c4){return function(_0xa24182){if(_0xa24182){var _0x1b49ae=typeof _0x43b6c4[_0xef93('0x16')]===_0xef93('0x17')&&typeof _0x43b6c4[_0xef93('0x18')]==='undefined';var _0x6bb580=_0xa24182[_0xef93('0x19')];var _0x40296c=_0x1b49ae?0x0:_0x43b6c4[_0xef93('0x16')];var _0x170e58=_0x1b49ae?_0xa24182[_0xef93('0x19')]:_0x43b6c4[_0xef93('0x16')]+_0x43b6c4[_0xef93('0x18')];var _0x5157de;if(_0x170e58>=_0x6bb580){_0x170e58=_0x6bb580;_0x5157de=0xc8;}else{_0x5157de=0xce;}_0x48b1b9[_0xef93('0x13')](_0x5157de);return _0x48b1b9['set'](_0xef93('0x1a'),_0x40296c+'-'+_0x170e58+'/'+_0x6bb580)[_0xef93('0x15')](_0xa24182);}return null;};}function saveUpdates(_0x2a783c){return function(_0x31d867){if(_0x31d867){return _0x31d867[_0xef93('0x1b')](_0x2a783c)[_0xef93('0x1c')](function(_0xb55399){return _0xb55399;});}return null;};}function removeEntity(_0x3ce96e){return function(_0x25458e){if(_0x25458e){return _0x25458e[_0xef93('0x1d')]()['then'](function(){_0x3ce96e[_0xef93('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d448c){return function(_0x1cb854){if(!_0x1cb854){_0x4d448c['sendStatus'](0x194);}return _0x1cb854;};}function handleError(_0x264ca1,_0x475eb2){_0x475eb2=_0x475eb2||0x1f4;return function(_0x4d0547){logger[_0xef93('0x1e')](_0x4d0547['stack']);if(_0x4d0547[_0xef93('0x1f')]){delete _0x4d0547['name'];}_0x264ca1['status'](_0x475eb2)[_0xef93('0x20')](_0x4d0547);};}exports[_0xef93('0x21')]=function(_0x236344,_0x445571){var _0x13b7a2={};var _0x496a97=_['map'](db[_0xef93('0x22')][_0xef93('0x23')],function(_0x530b62){return{'name':_0x530b62['fieldName'],'type':_0x530b62[_0xef93('0x24')][_0xef93('0x25')]};});_0x13b7a2=qs[_0xef93('0x26')](_0x496a97,_0x236344);return interaction[_0xef93('0x27')](_0xef93('0x28'),_0x236344[_0xef93('0x29')],_0x236344[_0xef93('0x2a')],_0x13b7a2,_0x496a97)[_0xef93('0x1c')](respondWithFilteredResult(_0x445571,_0x13b7a2))[_0xef93('0x2b')](handleError(_0x445571,null));};exports[_0xef93('0x2c')]=function(_0x2da40d,_0x257590){var _0x32edfb={'raw':![],'where':{'id':_0x2da40d[_0xef93('0x2d')]['id']}},_0x58a043={};_0x58a043['model']=_[_0xef93('0x2e')](db[_0xef93('0x22')][_0xef93('0x23')]);_0x58a043['query']=_[_0xef93('0x2e')](_0x2da40d['query']);_0x58a043[_0xef93('0x2f')]=_[_0xef93('0x30')](_0x58a043['model'],_0x58a043['query']);_0x32edfb[_0xef93('0x31')]=_['intersection'](_0x58a043[_0xef93('0x32')],qs[_0xef93('0x33')](_0x2da40d[_0xef93('0x29')][_0xef93('0x33')]));_0x32edfb[_0xef93('0x31')]=_0x32edfb[_0xef93('0x31')]['length']?_0x32edfb[_0xef93('0x31')]:_0x58a043[_0xef93('0x32')];if(_0x2da40d[_0xef93('0x29')][_0xef93('0x34')]){_0x32edfb['include']=[{'all':!![]}];}_0x32edfb=_[_0xef93('0x35')]({},_0x32edfb,_0x2da40d['options']);return db[_0xef93('0x22')][_0xef93('0x36')](_0x32edfb)[_0xef93('0x1c')](handleEntityNotFound(_0x257590,null))[_0xef93('0x1c')](respondWithResult(_0x257590,null))[_0xef93('0x2b')](handleError(_0x257590,null));};exports[_0xef93('0x37')]=function(_0x42885b,_0xd45fe){return db['WhatsappInteraction'][_0xef93('0x37')](_0x42885b[_0xef93('0x38')],{})[_0xef93('0x1c')](respondWithResult(_0xd45fe,0xc9))[_0xef93('0x2b')](handleError(_0xd45fe,null));};exports[_0xef93('0x1b')]=function(_0xd444c6,_0x26e0df){if(_0xd444c6[_0xef93('0x38')]['id']){delete _0xd444c6[_0xef93('0x38')]['id'];}return db[_0xef93('0x22')]['find']({'where':{'id':_0xd444c6[_0xef93('0x2d')]['id']}})['then'](handleEntityNotFound(_0x26e0df,null))[_0xef93('0x1c')](saveUpdates(_0xd444c6['body'],null))[_0xef93('0x1c')](respondWithResult(_0x26e0df,null))['catch'](handleError(_0x26e0df,null));};exports[_0xef93('0x1d')]=function(_0xed0788,_0x156973){return db['WhatsappInteraction'][_0xef93('0x36')]({'where':{'id':_0xed0788[_0xef93('0x2d')]['id']}})['then'](handleEntityNotFound(_0x156973,null))['then'](removeEntity(_0x156973,null))['catch'](handleError(_0x156973,null));};exports['describe']=function(_0x4ff32b,_0x589214){return db[_0xef93('0x22')]['describe']()[_0xef93('0x1c')](respondWithResult(_0x589214,null))[_0xef93('0x2b')](handleError(_0x589214,null));};exports[_0xef93('0x39')]=function(_0x1aa251,_0x56e15b){return db[_0xef93('0x3a')]['find']({'where':{'id':_0x1aa251['params']['id']}})[_0xef93('0x1c')](handleEntityNotFound(_0x56e15b,null))[_0xef93('0x1c')](function(_0x31ab43){if(_0x31ab43){return _0x31ab43[_0xef93('0x39')](_0x1aa251[_0xef93('0x38')][_0xef93('0x3b')],_[_0xef93('0x3c')](_0x1aa251[_0xef93('0x38')],['ids','id'])||{});}})[_0xef93('0x1c')](respondWithResult(_0x56e15b,null))[_0xef93('0x2b')](handleError(_0x56e15b,null));};exports[_0xef93('0x3d')]=function(_0x295157,_0x259fc8){var _0x3644b3={'raw':![],'where':{}};var _0x23de5d={};var _0x457cc8={'count':0x0,'rows':[]};return db[_0xef93('0x22')]['findOne']({'where':{'id':_0x295157[_0xef93('0x2d')]['id']}})['then'](handleEntityNotFound(_0x259fc8,null))['then'](function(_0x264f68){if(_0x264f68){_0x23de5d[_0xef93('0x32')]=_[_0xef93('0x2e')](db[_0xef93('0x3a')][_0xef93('0x23')]);_0x23de5d[_0xef93('0x29')]=_[_0xef93('0x2e')](_0x295157['query']);_0x23de5d[_0xef93('0x2f')]=_['intersection'](_0x23de5d[_0xef93('0x32')],_0x23de5d['query']);_0x3644b3['attributes']=_[_0xef93('0x30')](_0x23de5d[_0xef93('0x32')],qs['fields'](_0x295157[_0xef93('0x29')][_0xef93('0x33')]));_0x3644b3[_0xef93('0x31')]=_0x3644b3[_0xef93('0x31')]['length']?_0x3644b3[_0xef93('0x31')]:_0x23de5d[_0xef93('0x32')];if(!_0x295157[_0xef93('0x29')][_0xef93('0x3e')](_0xef93('0x3f'))){_0x3644b3[_0xef93('0x18')]=qs[_0xef93('0x18')](_0x295157[_0xef93('0x29')][_0xef93('0x18')]);_0x3644b3['offset']=qs[_0xef93('0x16')](_0x295157[_0xef93('0x29')][_0xef93('0x16')]);}_0x3644b3['order']=qs[_0xef93('0x40')](_0x295157['query']['sort']);_0x3644b3['where']=qs[_0xef93('0x2f')](_[_0xef93('0x41')](_0x295157['query'],_0x23de5d['filters']));_0x3644b3[_0xef93('0x42')]['WhatsappInteractionId']=_0x264f68['id'];if(_0x295157[_0xef93('0x29')][_0xef93('0x43')]){_0x3644b3['where']=_[_0xef93('0x35')](_0x3644b3[_0xef93('0x42')],{'$or':_[_0xef93('0x44')](_0x3644b3[_0xef93('0x31')],function(_0x433511){var _0x5bcec5={};_0x5bcec5[_0x433511]={'$like':'%'+_0x295157[_0xef93('0x29')][_0xef93('0x43')]+'%'};return _0x5bcec5;})});}if(_0x295157[_0xef93('0x29')][_0xef93('0x45')]){var _0x788714=_0x295157[_0xef93('0x29')][_0xef93('0x45')][_0xef93('0x46')](',');var _0x4819fd={};_0x4819fd[_0x788714[0x0]]={'$gte':moment(_0x788714[0x1])[_0xef93('0x47')](_0xef93('0x48'))};_0x3644b3[_0xef93('0x42')]=_['merge'](_0x3644b3[_0xef93('0x42')],_0x4819fd);}_0x3644b3=_[_0xef93('0x35')]({},_0x3644b3,_0x295157['options']);return db[_0xef93('0x3a')][_0xef93('0x19')]({'where':_0x3644b3[_0xef93('0x42')]})['then'](function(_0x533f21){_0x457cc8[_0xef93('0x19')]=_0x533f21;if(_0x295157['query'][_0xef93('0x34')]){_0x3644b3[_0xef93('0x49')]=[{'all':!![]}];}return db[_0xef93('0x3a')]['findAll'](_0x3644b3);})[_0xef93('0x1c')](function(_0x50167c){_0x457cc8[_0xef93('0x4a')]=_0x50167c;return _0x457cc8;});}})[_0xef93('0x1c')](respondWithFilteredResult(_0x259fc8,_0x3644b3))[_0xef93('0x2b')](handleError(_0x259fc8,null));};exports[_0xef93('0x4b')]=function(_0x5949c0,_0x4bcb82){return db[_0xef93('0x22')][_0xef93('0x36')]({'where':{'id':_0x5949c0[_0xef93('0x2d')]['id']}})['then'](handleEntityNotFound(_0x4bcb82,null))['then'](function(_0x58684d){if(_0x58684d){return _0x58684d['setTags'](_0x5949c0[_0xef93('0x38')]['ids'],_['omit'](_0x5949c0[_0xef93('0x38')],['ids','id'])||{})[_0xef93('0x4c')](function(){return db[_0xef93('0x4d')][_0xef93('0x27')]({'attributes':['id',_0xef93('0x1f'),_0xef93('0x4e')],'where':{'id':_0x5949c0[_0xef93('0x38')][_0xef93('0x3b')]}});})[_0xef93('0x1c')](function(_0x5d61fb){socket[_0xef93('0x4f')](_0xef93('0x50'),{'id':Number(_0x5949c0[_0xef93('0x2d')]['id']),'tags':_0x5d61fb||[]});return{'id':Number(_0x5949c0[_0xef93('0x2d')]['id']),'tags':_0x5d61fb||[]};});}})[_0xef93('0x1c')](respondWithResult(_0x4bcb82,null))['catch'](handleError(_0x4bcb82,null));};exports[_0xef93('0x51')]=function(_0x5f0634,_0x334923){return db[_0xef93('0x22')][_0xef93('0x36')]({'where':{'id':_0x5f0634[_0xef93('0x2d')]['id']}})['then'](handleEntityNotFound(_0x334923,null))[_0xef93('0x1c')](function(_0x37f2ba){if(_0x37f2ba){return _0x37f2ba[_0xef93('0x51')](_0x5f0634[_0xef93('0x29')][_0xef93('0x3b')]);}})[_0xef93('0x1c')](respondWithStatusCode(_0x334923,null))[_0xef93('0x2b')](handleError(_0x334923,null));};exports['download']=function(_0x3beb31,_0x3ff328){var _0x50aa7d=moment()[_0xef93('0x52')]()[_0xef93('0x53')]();var _0x230a06=path['join'](config[_0xef93('0x54')],_0xef93('0x55'),_0xef93('0x56'),_0xef93('0x57'));var _0x1af0df=path['join'](config[_0xef93('0x54')],'server',_0xef93('0x56'),_0xef93('0x58'));var _0x2e807d=path[_0xef93('0x59')](_0x230a06,_0x50aa7d);var _0x286873=util[_0xef93('0x47')](_0xef93('0x5a'),_0x3beb31['params']['id'],_0x50aa7d);var _0x39e267=path[_0xef93('0x59')](_0x230a06,_0x286873);var _0x491c80=[];_0x491c80['push']({'model':db[_0xef93('0x5b')],'as':_0xef93('0x5b'),'attributes':['id',_0xef93('0x5c')],'raw':!![]});_0x491c80[_0xef93('0x5d')]({'model':db[_0xef93('0x5e')],'as':_0xef93('0x5f'),'attributes':['id',_0xef93('0x60'),'lastName'],'raw':!![]});if(_0x3beb31['query'][_0xef93('0x58')]){_0x491c80[_0xef93('0x5d')]({'model':db['Attachment'],'as':_0xef93('0x61'),'raw':!![]});}var _0x6b0106=[{'model':db[_0xef93('0x3a')],'as':_0xef93('0x62'),'attributes':['id',_0xef93('0x38'),_0xef93('0x63'),_0xef93('0x64'),_0xef93('0x65'),_0xef93('0x66')],'include':_0x491c80}];_0x6b0106[_0xef93('0x5d')]({'model':db[_0xef93('0x67')],'as':_0xef93('0x68'),'attributes':['id',_0xef93('0x1f')]});_0x6b0106[_0xef93('0x5d')]({'model':db['User'],'as':_0xef93('0x69'),'attributes':['id',_0xef93('0x5c')]});return db[_0xef93('0x22')][_0xef93('0x36')]({'where':{'id':_0x3beb31[_0xef93('0x2d')]['id']},'include':_0x6b0106})[_0xef93('0x1c')](handleEntityNotFound(_0x3ff328,null))['then'](function(_0x3598c4){if(_0x3598c4){var _0x3e06e7=_0x3598c4[_0xef93('0x6a')]({'plain':!![]});fs['mkdirSync'](_0x2e807d);var _0x4df642={'channel':_0xef93('0x6b'),'account':_0x3e06e7['Account'][_0xef93('0x1f')],'agent':_0x3e06e7[_0xef93('0x69')]?_0x3e06e7[_0xef93('0x69')][_0xef93('0x5c')]:'N.A.','createdAt':moment(_0x3e06e7[_0xef93('0x63')])['format'](_0xef93('0x48'))['toString'](),'closedAt':_0x3e06e7[_0xef93('0x6c')]?moment(_0x3e06e7[_0xef93('0x6d')])[_0xef93('0x47')](_0xef93('0x48'))[_0xef93('0x53')]():'','disposition':_0x3e06e7[_0xef93('0x6e')],'messages':_(_0x3e06e7[_0xef93('0x62')])[_0xef93('0x43')]({'secret':![]})[_0xef93('0x44')](function(_0x681c9a){if(_0x681c9a[_0xef93('0x61')]){var _0x677d8e=path[_0xef93('0x59')](_0x1af0df,_0x681c9a[_0xef93('0x61')][_0xef93('0x6f')]);if(fs[_0xef93('0x70')](_0x677d8e)){fs['createReadStream'](_0x677d8e)[_0xef93('0x71')](fs[_0xef93('0x72')](path['join'](_0x2e807d,_0x681c9a[_0xef93('0x61')]['basename'])));}}return{'date':moment(_0x681c9a['createdAt'])[_0xef93('0x47')](_0xef93('0x48'))[_0xef93('0x53')](),'sender':_0x681c9a[_0xef93('0x64')]===_0xef93('0x73')?_0x681c9a[_0xef93('0x5b')]?_0x681c9a[_0xef93('0x5b')][_0xef93('0x5c')]:_0xef93('0x74'):_0x681c9a[_0xef93('0x5f')][_0xef93('0x60')]+(_0x681c9a[_0xef93('0x5f')]['lastName']?'\x20'+_0x681c9a[_0xef93('0x5f')][_0xef93('0x75')]:''),'body':_0x681c9a[_0xef93('0x61')]?_0x681c9a[_0xef93('0x61')]['basename']:_0x681c9a['body'],'direction':_0x681c9a['direction']===_0xef93('0x73')?'A':'C','secret':_0x681c9a[_0xef93('0x65')],'read':_0x681c9a[_0xef93('0x66')],'attachment':_0x681c9a['Attachment']};})['value']()};return ejs[_0xef93('0x76')](path['join'](config['root'],'server',_0xef93('0x77'),_0xef93('0x78')),{'interaction':_0x4df642})[_0xef93('0x1c')](function(_0x5bdd96){var _0x5348b7=path['join'](_0x2e807d,_0xef93('0x79')+_0x3e06e7['id']+'-'+_0x50aa7d+_0xef93('0x7a'));var _0x357970={'path':_0x5348b7,'channel':_0xef93('0x6b'),'interactionId':_0x3e06e7['id']};return pdf['createPdfFromHTML'](_0x5bdd96,_0x357970);})[_0xef93('0x1c')](function(){return new BPromise(function(_0x17b3ac,_0x4a6ad0){zipdir(_0x2e807d,{'saveTo':_0x39e267},function(_0x2f76fe,_0x11a84a){if(_0x2f76fe)return _0x4a6ad0(_0x2f76fe);return _0x17b3ac(_0x11a84a);});})[_0xef93('0x1c')](function(){return new BPromise(function(_0x5edfa5,_0x3c15a1){rimraf(_0x2e807d,function(_0x31b42e){if(_0x31b42e)_0x3c15a1(_0x31b42e);return _0x5edfa5();});});})[_0xef93('0x1c')](function(){return _0x3ff328[_0xef93('0x7b')](_0x39e267,_0x286873,function(_0x55a249){if(_0x55a249){console[_0xef93('0x7c')](_0xef93('0x7d'),_0x55a249);}else{fs[_0xef93('0x7e')](_0x39e267);}});});});}else{return _0x3ff328[_0xef93('0x12')](0xc8);}})[_0xef93('0x2b')](handleError(_0x3ff328,null));}; \ No newline at end of file +var _0x3521=['CmContact','Contact','lastName','Attachment','Messages','direction','read','WhatsappAccount','Account','Owner','fullname','mkdirSync','N.A.','closed','closedAt','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','firstName','secret','value','renderFile','views','transcript-','Whatsapp','createPdfFromHTML','err','unlinkSync','zip-dir','moment','bluebird','util','path','ejs','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','error','name','send','index','map','WhatsappInteraction','rawAttributes','fieldName','type','getOptions','whatsapp','query','user','catch','show','params','model','keys','filters','intersection','attributes','fields','includeAll','include','find','create','body','describe','addMessage','ids','getMessages','findOne','WhatsappMessage','length','order','sort','where','pick','WhatsappInteractionId','filter','merge','$gte','format','YYYY-MM-DD\x20HH:mm:ss','options','findAll','rows','addTags','omit','spread','Tag','color','whatsappInteractionTags:save','removeTags','download','unix','toString','join','server','files','tmp','root','transcript-%d-%s.zip','push','User'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x3521,0x19a));var _0x1352=function(_0xd57d77,_0x1fd355){_0xd57d77=_0xd57d77-0x0;var _0x23245e=_0x3521[_0xd57d77];return _0x23245e;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x1352('0x0'));var moment=require(_0x1352('0x1'));var BPromise=require(_0x1352('0x2'));var util=require(_0x1352('0x3'));var path=require(_0x1352('0x4'));var ejs=require(_0x1352('0x5'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x1352('0x6'));var interaction=require(_0x1352('0x7'));var qs=require(_0x1352('0x8'));var pdf=require('../../components/export/pdf');var logger=require(_0x1352('0x9'))(_0x1352('0xa'));var config=require(_0x1352('0xb'));var db=require('../../mysqldb')['db'];config[_0x1352('0xc')]=_['defaults'](config[_0x1352('0xc')],{'host':_0x1352('0xd'),'port':0x18eb});var socket=require(_0x1352('0xe'))(new Redis(config[_0x1352('0xc')]));require('./whatsappInteraction.socket')[_0x1352('0xf')](socket);function respondWithStatusCode(_0x5dad39,_0x5f1092){_0x5f1092=_0x5f1092||0xcc;return function(_0x10a1d9){if(_0x10a1d9){return _0x5dad39[_0x1352('0x10')](_0x5f1092);}return _0x5dad39[_0x1352('0x11')](_0x5f1092)[_0x1352('0x12')]();};}function respondWithResult(_0x7be9e7,_0x1a8bbd){_0x1a8bbd=_0x1a8bbd||0xc8;return function(_0x174fbb){if(_0x174fbb){return _0x7be9e7['status'](_0x1a8bbd)[_0x1352('0x13')](_0x174fbb);}};}function respondWithFilteredResult(_0x53e326,_0x345f81){return function(_0x556377){if(_0x556377){var _0x5ce905=typeof _0x345f81[_0x1352('0x14')]===_0x1352('0x15')&&typeof _0x345f81[_0x1352('0x16')]===_0x1352('0x15');var _0x160112=_0x556377[_0x1352('0x17')];var _0x28c34c=_0x5ce905?0x0:_0x345f81['offset'];var _0x3356e5=_0x5ce905?_0x556377[_0x1352('0x17')]:_0x345f81[_0x1352('0x14')]+_0x345f81[_0x1352('0x16')];var _0xeec7a0;if(_0x3356e5>=_0x160112){_0x3356e5=_0x160112;_0xeec7a0=0xc8;}else{_0xeec7a0=0xce;}_0x53e326[_0x1352('0x11')](_0xeec7a0);return _0x53e326[_0x1352('0x18')](_0x1352('0x19'),_0x28c34c+'-'+_0x3356e5+'/'+_0x160112)['json'](_0x556377);}return null;};}function saveUpdates(_0x580cd7){return function(_0x168121){if(_0x168121){return _0x168121[_0x1352('0x1a')](_0x580cd7)[_0x1352('0x1b')](function(_0x2f03f5){return _0x2f03f5;});}return null;};}function removeEntity(_0x283273){return function(_0x303aca){if(_0x303aca){return _0x303aca[_0x1352('0x1c')]()[_0x1352('0x1b')](function(){_0x283273[_0x1352('0x11')](0xcc)[_0x1352('0x12')]();});}};}function handleEntityNotFound(_0x2c070c){return function(_0x4d37dc){if(!_0x4d37dc){_0x2c070c[_0x1352('0x10')](0x194);}return _0x4d37dc;};}function handleError(_0x5c671f,_0x20913e){_0x20913e=_0x20913e||0x1f4;return function(_0x5d47da){logger[_0x1352('0x1d')](_0x5d47da['stack']);if(_0x5d47da['name']){delete _0x5d47da[_0x1352('0x1e')];}_0x5c671f[_0x1352('0x11')](_0x20913e)[_0x1352('0x1f')](_0x5d47da);};}exports[_0x1352('0x20')]=function(_0x50b9d2,_0x37e8e6){var _0x34d7a3={};var _0x32037d=_[_0x1352('0x21')](db[_0x1352('0x22')][_0x1352('0x23')],function(_0x17aa6b){return{'name':_0x17aa6b[_0x1352('0x24')],'type':_0x17aa6b[_0x1352('0x25')]['key']};});_0x34d7a3=qs[_0x1352('0x26')](_0x32037d,_0x50b9d2);return interaction['findAll'](_0x1352('0x27'),_0x50b9d2[_0x1352('0x28')],_0x50b9d2[_0x1352('0x29')],_0x34d7a3,_0x32037d)[_0x1352('0x1b')](respondWithFilteredResult(_0x37e8e6,_0x34d7a3))[_0x1352('0x2a')](handleError(_0x37e8e6,null));};exports[_0x1352('0x2b')]=function(_0x2d8764,_0x998fad){var _0x243577={'raw':![],'where':{'id':_0x2d8764[_0x1352('0x2c')]['id']}},_0x4751e6={};_0x4751e6[_0x1352('0x2d')]=_['keys'](db[_0x1352('0x22')]['rawAttributes']);_0x4751e6[_0x1352('0x28')]=_[_0x1352('0x2e')](_0x2d8764[_0x1352('0x28')]);_0x4751e6[_0x1352('0x2f')]=_[_0x1352('0x30')](_0x4751e6[_0x1352('0x2d')],_0x4751e6[_0x1352('0x28')]);_0x243577[_0x1352('0x31')]=_[_0x1352('0x30')](_0x4751e6[_0x1352('0x2d')],qs[_0x1352('0x32')](_0x2d8764[_0x1352('0x28')][_0x1352('0x32')]));_0x243577['attributes']=_0x243577[_0x1352('0x31')]['length']?_0x243577[_0x1352('0x31')]:_0x4751e6[_0x1352('0x2d')];if(_0x2d8764[_0x1352('0x28')][_0x1352('0x33')]){_0x243577[_0x1352('0x34')]=[{'all':!![]}];}_0x243577=_['merge']({},_0x243577,_0x2d8764['options']);return db[_0x1352('0x22')][_0x1352('0x35')](_0x243577)[_0x1352('0x1b')](handleEntityNotFound(_0x998fad,null))[_0x1352('0x1b')](respondWithResult(_0x998fad,null))[_0x1352('0x2a')](handleError(_0x998fad,null));};exports[_0x1352('0x36')]=function(_0x4edae1,_0x386961){return db[_0x1352('0x22')][_0x1352('0x36')](_0x4edae1[_0x1352('0x37')],{})['then'](respondWithResult(_0x386961,0xc9))[_0x1352('0x2a')](handleError(_0x386961,null));};exports[_0x1352('0x1a')]=function(_0x5c3d22,_0x4409fd){if(_0x5c3d22['body']['id']){delete _0x5c3d22[_0x1352('0x37')]['id'];}return db[_0x1352('0x22')][_0x1352('0x35')]({'where':{'id':_0x5c3d22[_0x1352('0x2c')]['id']}})[_0x1352('0x1b')](handleEntityNotFound(_0x4409fd,null))[_0x1352('0x1b')](saveUpdates(_0x5c3d22['body'],null))[_0x1352('0x1b')](respondWithResult(_0x4409fd,null))[_0x1352('0x2a')](handleError(_0x4409fd,null));};exports[_0x1352('0x1c')]=function(_0x3cd2d4,_0x2e54da){return db[_0x1352('0x22')][_0x1352('0x35')]({'where':{'id':_0x3cd2d4[_0x1352('0x2c')]['id']}})[_0x1352('0x1b')](handleEntityNotFound(_0x2e54da,null))['then'](removeEntity(_0x2e54da,null))[_0x1352('0x2a')](handleError(_0x2e54da,null));};exports[_0x1352('0x38')]=function(_0x14c80a,_0x24afdf){return db[_0x1352('0x22')]['describe']()[_0x1352('0x1b')](respondWithResult(_0x24afdf,null))[_0x1352('0x2a')](handleError(_0x24afdf,null));};exports['addMessage']=function(_0x4c1a25,_0x2ad93e){return db['WhatsappMessage'][_0x1352('0x35')]({'where':{'id':_0x4c1a25[_0x1352('0x2c')]['id']}})['then'](handleEntityNotFound(_0x2ad93e,null))['then'](function(_0x119b73){if(_0x119b73){return _0x119b73[_0x1352('0x39')](_0x4c1a25[_0x1352('0x37')][_0x1352('0x3a')],_['omit'](_0x4c1a25[_0x1352('0x37')],[_0x1352('0x3a'),'id'])||{});}})[_0x1352('0x1b')](respondWithResult(_0x2ad93e,null))[_0x1352('0x2a')](handleError(_0x2ad93e,null));};exports[_0x1352('0x3b')]=function(_0x3fe267,_0x46fad7){var _0x5e8063={'raw':![],'where':{}};var _0xd8bf02={};var _0x156f67={'count':0x0,'rows':[]};return db[_0x1352('0x22')][_0x1352('0x3c')]({'where':{'id':_0x3fe267['params']['id']}})['then'](handleEntityNotFound(_0x46fad7,null))[_0x1352('0x1b')](function(_0x5eabbb){if(_0x5eabbb){_0xd8bf02[_0x1352('0x2d')]=_[_0x1352('0x2e')](db[_0x1352('0x3d')]['rawAttributes']);_0xd8bf02[_0x1352('0x28')]=_['keys'](_0x3fe267[_0x1352('0x28')]);_0xd8bf02[_0x1352('0x2f')]=_[_0x1352('0x30')](_0xd8bf02[_0x1352('0x2d')],_0xd8bf02[_0x1352('0x28')]);_0x5e8063[_0x1352('0x31')]=_[_0x1352('0x30')](_0xd8bf02[_0x1352('0x2d')],qs[_0x1352('0x32')](_0x3fe267[_0x1352('0x28')]['fields']));_0x5e8063[_0x1352('0x31')]=_0x5e8063['attributes'][_0x1352('0x3e')]?_0x5e8063[_0x1352('0x31')]:_0xd8bf02[_0x1352('0x2d')];if(!_0x3fe267[_0x1352('0x28')]['hasOwnProperty']('nolimit')){_0x5e8063[_0x1352('0x16')]=qs[_0x1352('0x16')](_0x3fe267[_0x1352('0x28')][_0x1352('0x16')]);_0x5e8063[_0x1352('0x14')]=qs['offset'](_0x3fe267[_0x1352('0x28')]['offset']);}_0x5e8063[_0x1352('0x3f')]=qs[_0x1352('0x40')](_0x3fe267['query'][_0x1352('0x40')]);_0x5e8063[_0x1352('0x41')]=qs[_0x1352('0x2f')](_[_0x1352('0x42')](_0x3fe267[_0x1352('0x28')],_0xd8bf02[_0x1352('0x2f')]));_0x5e8063[_0x1352('0x41')][_0x1352('0x43')]=_0x5eabbb['id'];if(_0x3fe267['query'][_0x1352('0x44')]){_0x5e8063[_0x1352('0x41')]=_[_0x1352('0x45')](_0x5e8063[_0x1352('0x41')],{'$or':_[_0x1352('0x21')](_0x5e8063[_0x1352('0x31')],function(_0x32b38f){var _0x1d8d0d={};_0x1d8d0d[_0x32b38f]={'$like':'%'+_0x3fe267[_0x1352('0x28')][_0x1352('0x44')]+'%'};return _0x1d8d0d;})});}if(_0x3fe267[_0x1352('0x28')][_0x1352('0x46')]){var _0x3cfa80=_0x3fe267[_0x1352('0x28')]['$gte']['split'](',');var _0x1efdff={};_0x1efdff[_0x3cfa80[0x0]]={'$gte':moment(_0x3cfa80[0x1])[_0x1352('0x47')](_0x1352('0x48'))};_0x5e8063['where']=_[_0x1352('0x45')](_0x5e8063['where'],_0x1efdff);}_0x5e8063=_[_0x1352('0x45')]({},_0x5e8063,_0x3fe267[_0x1352('0x49')]);return db['WhatsappMessage'][_0x1352('0x17')]({'where':_0x5e8063[_0x1352('0x41')]})['then'](function(_0x313d74){_0x156f67[_0x1352('0x17')]=_0x313d74;if(_0x3fe267['query']['includeAll']){_0x5e8063[_0x1352('0x34')]=[{'all':!![]}];}return db[_0x1352('0x3d')][_0x1352('0x4a')](_0x5e8063);})[_0x1352('0x1b')](function(_0x122f13){_0x156f67[_0x1352('0x4b')]=_0x122f13;return _0x156f67;});}})['then'](respondWithFilteredResult(_0x46fad7,_0x5e8063))[_0x1352('0x2a')](handleError(_0x46fad7,null));};exports[_0x1352('0x4c')]=function(_0x859d13,_0x1bddd1){return db[_0x1352('0x22')][_0x1352('0x35')]({'where':{'id':_0x859d13['params']['id']}})['then'](handleEntityNotFound(_0x1bddd1,null))[_0x1352('0x1b')](function(_0x92ec70){if(_0x92ec70){return _0x92ec70['setTags'](_0x859d13['body'][_0x1352('0x3a')],_[_0x1352('0x4d')](_0x859d13[_0x1352('0x37')],[_0x1352('0x3a'),'id'])||{})[_0x1352('0x4e')](function(){return db[_0x1352('0x4f')][_0x1352('0x4a')]({'attributes':['id',_0x1352('0x1e'),_0x1352('0x50')],'where':{'id':_0x859d13[_0x1352('0x37')]['ids']}});})[_0x1352('0x1b')](function(_0x260d1d){socket['emit'](_0x1352('0x51'),{'id':Number(_0x859d13[_0x1352('0x2c')]['id']),'tags':_0x260d1d||[]});return{'id':Number(_0x859d13['params']['id']),'tags':_0x260d1d||[]};});}})['then'](respondWithResult(_0x1bddd1,null))[_0x1352('0x2a')](handleError(_0x1bddd1,null));};exports['removeTags']=function(_0x1ca604,_0x209529){return db[_0x1352('0x22')][_0x1352('0x35')]({'where':{'id':_0x1ca604[_0x1352('0x2c')]['id']}})[_0x1352('0x1b')](handleEntityNotFound(_0x209529,null))[_0x1352('0x1b')](function(_0x3d1920){if(_0x3d1920){return _0x3d1920[_0x1352('0x52')](_0x1ca604[_0x1352('0x28')][_0x1352('0x3a')]);}})[_0x1352('0x1b')](respondWithStatusCode(_0x209529,null))['catch'](handleError(_0x209529,null));};exports[_0x1352('0x53')]=function(_0x4dd166,_0x12114e){var _0x6755eb=moment()[_0x1352('0x54')]()[_0x1352('0x55')]();var _0xdf9a48=path[_0x1352('0x56')](config['root'],_0x1352('0x57'),_0x1352('0x58'),_0x1352('0x59'));var _0xef91bf=path[_0x1352('0x56')](config[_0x1352('0x5a')],_0x1352('0x57'),_0x1352('0x58'),'attachments');var _0x49e586=path['join'](_0xdf9a48,_0x6755eb);var _0x3e25c6=util['format'](_0x1352('0x5b'),_0x4dd166[_0x1352('0x2c')]['id'],_0x6755eb);var _0x4e4579=path[_0x1352('0x56')](_0xdf9a48,_0x3e25c6);var _0x79c414=[];_0x79c414[_0x1352('0x5c')]({'model':db[_0x1352('0x5d')],'as':_0x1352('0x5d'),'attributes':['id','fullname'],'raw':!![]});_0x79c414[_0x1352('0x5c')]({'model':db[_0x1352('0x5e')],'as':_0x1352('0x5f'),'attributes':['id','firstName',_0x1352('0x60')],'raw':!![]});if(_0x4dd166[_0x1352('0x28')]['attachments']){_0x79c414[_0x1352('0x5c')]({'model':db[_0x1352('0x61')],'as':_0x1352('0x61'),'raw':!![]});}var _0x4b928=[{'model':db[_0x1352('0x3d')],'as':_0x1352('0x62'),'attributes':['id',_0x1352('0x37'),'createdAt',_0x1352('0x63'),'secret',_0x1352('0x64')],'include':_0x79c414}];_0x4b928[_0x1352('0x5c')]({'model':db[_0x1352('0x65')],'as':_0x1352('0x66'),'attributes':['id',_0x1352('0x1e')]});_0x4b928['push']({'model':db[_0x1352('0x5d')],'as':_0x1352('0x67'),'attributes':['id',_0x1352('0x68')]});return db[_0x1352('0x22')][_0x1352('0x35')]({'where':{'id':_0x4dd166[_0x1352('0x2c')]['id']},'include':_0x4b928})[_0x1352('0x1b')](handleEntityNotFound(_0x12114e,null))['then'](function(_0x5e7033){if(_0x5e7033){var _0xd93dc9=_0x5e7033['get']({'plain':!![]});fs[_0x1352('0x69')](_0x49e586);var _0x488f7b={'channel':'Whatsapp','account':_0xd93dc9[_0x1352('0x66')]['name'],'agent':_0xd93dc9[_0x1352('0x67')]?_0xd93dc9[_0x1352('0x67')][_0x1352('0x68')]:_0x1352('0x6a'),'createdAt':moment(_0xd93dc9['createdAt'])[_0x1352('0x47')](_0x1352('0x48'))[_0x1352('0x55')](),'closedAt':_0xd93dc9[_0x1352('0x6b')]?moment(_0xd93dc9[_0x1352('0x6c')])[_0x1352('0x47')](_0x1352('0x48'))['toString']():'','disposition':_0xd93dc9['disposition'],'messages':_(_0xd93dc9[_0x1352('0x62')])['filter']({'secret':![]})[_0x1352('0x21')](function(_0x222b1e){if(_0x222b1e[_0x1352('0x61')]){var _0x229fb4=path[_0x1352('0x56')](_0xef91bf,_0x222b1e[_0x1352('0x61')][_0x1352('0x6d')]);if(fs[_0x1352('0x6e')](_0x229fb4)){fs[_0x1352('0x6f')](_0x229fb4)[_0x1352('0x70')](fs[_0x1352('0x71')](path['join'](_0x49e586,_0x222b1e[_0x1352('0x61')][_0x1352('0x6d')])));}}return{'date':moment(_0x222b1e['createdAt'])[_0x1352('0x47')](_0x1352('0x48'))[_0x1352('0x55')](),'sender':_0x222b1e[_0x1352('0x63')]===_0x1352('0x72')?_0x222b1e[_0x1352('0x5d')]?_0x222b1e[_0x1352('0x5d')][_0x1352('0x68')]:_0x1352('0x73'):_0x222b1e[_0x1352('0x5f')][_0x1352('0x74')]+(_0x222b1e['Contact']['lastName']?'\x20'+_0x222b1e[_0x1352('0x5f')][_0x1352('0x60')]:''),'body':_0x222b1e[_0x1352('0x61')]?_0x222b1e[_0x1352('0x61')]['basename']:_0x222b1e[_0x1352('0x37')],'direction':_0x222b1e[_0x1352('0x63')]===_0x1352('0x72')?'A':'C','secret':_0x222b1e[_0x1352('0x75')],'read':_0x222b1e[_0x1352('0x64')],'attachment':_0x222b1e['Attachment']};})[_0x1352('0x76')]()};return ejs[_0x1352('0x77')](path['join'](config['root'],'server',_0x1352('0x78'),'downloadInteraction.ejs'),{'interaction':_0x488f7b})[_0x1352('0x1b')](function(_0x570330){var _0x3a0a56=path['join'](_0x49e586,_0x1352('0x79')+_0xd93dc9['id']+'-'+_0x6755eb+'.pdf');var _0x46acdc={'path':_0x3a0a56,'channel':_0x1352('0x7a'),'interactionId':_0xd93dc9['id']};return pdf[_0x1352('0x7b')](_0x570330,_0x46acdc);})[_0x1352('0x1b')](function(){return new BPromise(function(_0x3a1b15,_0x22af65){zipdir(_0x49e586,{'saveTo':_0x4e4579},function(_0x264f72,_0x5ee078){if(_0x264f72)return _0x22af65(_0x264f72);return _0x3a1b15(_0x5ee078);});})['then'](function(){return new BPromise(function(_0x488125,_0x3111e3){rimraf(_0x49e586,function(_0x46f231){if(_0x46f231)_0x3111e3(_0x46f231);return _0x488125();});});})[_0x1352('0x1b')](function(){return _0x12114e[_0x1352('0x53')](_0x4e4579,_0x3e25c6,function(_0x371883){if(_0x371883){console['log'](_0x1352('0x7c'),_0x371883);}else{fs[_0x1352('0x7d')](_0x4e4579);}});});});}else{return _0x12114e[_0x1352('0x10')](0xc8);}})[_0x1352('0x2a')](handleError(_0x12114e,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index a9fe415..b38de4d 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 _0x9099=['catch','hook','exports','events','WhatsappInteraction','../../mysqldb','WhatsappMessage','setMaxListeners','save','update','remove','getUsers','then','Users','unreadMessages','length','emit'];(function(_0x1667df,_0x266940){var _0x341abf=function(_0x123c3f){while(--_0x123c3f){_0x1667df['push'](_0x1667df['shift']());}};_0x341abf(++_0x266940);}(_0x9099,0x1ac));var _0x9909=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0x9099[_0xea8947];return _0x2455e9;};'use strict';var EventEmitter=require(_0x9909('0x0'));var WhatsappInteraction=require('../../mysqldb')['db'][_0x9909('0x1')];var WhatsappMessage=require(_0x9909('0x2'))['db'][_0x9909('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x9909('0x4')](0x0);var events={'afterCreate':_0x9909('0x5'),'afterUpdate':_0x9909('0x6'),'afterDestroy':_0x9909('0x7')};function emitEvent(_0x6eb0ac){return function(_0x2369d1,_0x25cf23,_0x3947ed){_0x2369d1[_0x9909('0x8')]({'attributes':['id'],'raw':!![]})[_0x9909('0x9')](function(_0x3dc2dd){_0x2369d1['setDataValue'](_0x9909('0xa'),_0x3dc2dd['map'](function(_0x5a9063){return{'id':_0x5a9063['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x2369d1['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x2eebe7){_0x2369d1['setDataValue'](_0x9909('0xb'),_0x2eebe7[_0x9909('0xc')]);WhatsappInteractionEvents[_0x9909('0xd')](_0x6eb0ac+':'+_0x2369d1['id'],_0x2369d1);WhatsappInteractionEvents['emit'](_0x6eb0ac,_0x2369d1);_0x3947ed(null);})[_0x9909('0xe')](_0x3947ed(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction[_0x9909('0xf')](e,emitEvent(event));}}module[_0x9909('0x10')]=WhatsappInteractionEvents; \ No newline at end of file +var _0xcb18=['WhatsappInteraction','WhatsappMessage','save','update','remove','getUsers','then','setDataValue','map','unreadMessages','length','emit','catch','hasOwnProperty','exports'];(function(_0x3b02b7,_0x23201d){var _0x174dcd=function(_0x1ed9fc){while(--_0x1ed9fc){_0x3b02b7['push'](_0x3b02b7['shift']());}};_0x174dcd(++_0x23201d);}(_0xcb18,0x159));var _0x8cb1=function(_0x2fc860,_0x4fadc0){_0x2fc860=_0x2fc860-0x0;var _0x49395b=_0xcb18[_0x2fc860];return _0x49395b;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require('../../mysqldb')['db'][_0x8cb1('0x0')];var WhatsappMessage=require('../../mysqldb')['db'][_0x8cb1('0x1')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8cb1('0x2'),'afterUpdate':_0x8cb1('0x3'),'afterDestroy':_0x8cb1('0x4')};function emitEvent(_0x15d761){return function(_0xca0a21,_0x28be22,_0x503927){_0xca0a21[_0x8cb1('0x5')]({'attributes':['id'],'raw':!![]})[_0x8cb1('0x6')](function(_0x55ca24){_0xca0a21[_0x8cb1('0x7')]('Users',_0x55ca24[_0x8cb1('0x8')](function(_0x428b70){return{'id':_0x428b70['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0xca0a21['id'],'direction':'in','read':![]},'raw':!![]});})[_0x8cb1('0x6')](function(_0x747752){_0xca0a21[_0x8cb1('0x7')](_0x8cb1('0x9'),_0x747752[_0x8cb1('0xa')]);WhatsappInteractionEvents['emit'](_0x15d761+':'+_0xca0a21['id'],_0xca0a21);WhatsappInteractionEvents[_0x8cb1('0xb')](_0x15d761,_0xca0a21);_0x503927(null);})[_0x8cb1('0xc')](_0x503927(null));};}for(var e in events){if(events[_0x8cb1('0xd')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0x8cb1('0xe')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 21ede37..f49a448 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 _0x8578=['whatsapp_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','define'];(function(_0x446218,_0x149a6e){var _0x3bcf84=function(_0x59d7a9){while(--_0x59d7a9){_0x446218['push'](_0x446218['shift']());}};_0x3bcf84(++_0x149a6e);}(_0x8578,0xc6));var _0x8857=function(_0x57c059,_0x370b0f){_0x57c059=_0x57c059-0x0;var _0x35c9a0=_0x8578[_0x57c059];return _0x35c9a0;};'use strict';var _=require(_0x8857('0x0'));var util=require(_0x8857('0x1'));var logger=require(_0x8857('0x2'))(_0x8857('0x3'));var moment=require('moment');var BPromise=require(_0x8857('0x4'));var rp=require(_0x8857('0x5'));var fs=require('fs');var path=require(_0x8857('0x6'));var rimraf=require(_0x8857('0x7'));var config=require(_0x8857('0x8'));var attributes=require('./whatsappInteraction.attributes');module['exports']=function(_0x274b65,_0x51af02){return _0x274b65[_0x8857('0x9')]('WhatsappInteraction',attributes,{'tableName':_0x8857('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5b27f4,_0x3858e0,_0x499197){if(_0x5b27f4[_0x8857('0xb')](_0x8857('0xc'))){_0x5b27f4[_0x8857('0xd')]=moment()[_0x8857('0xe')](_0x8857('0xf'));}_0x499197(null,_0x5b27f4);}}});}; \ No newline at end of file +var _0xd755=['bluebird','request-promise','rimraf','../../config/environment','./whatsappInteraction.attributes','exports','define','whatsapp_interactions','format','YYYY-MM-DD\x20HH:mm:ss','lodash','api','moment'];(function(_0x4b84ab,_0x3611a1){var _0x387324=function(_0x4a7dba){while(--_0x4a7dba){_0x4b84ab['push'](_0x4b84ab['shift']());}};_0x387324(++_0x3611a1);}(_0xd755,0x10e));var _0x5d75=function(_0x450f09,_0x59561d){_0x450f09=_0x450f09-0x0;var _0x4e22ec=_0xd755[_0x450f09];return _0x4e22ec;};'use strict';var _=require(_0x5d75('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5d75('0x1'));var moment=require(_0x5d75('0x2'));var BPromise=require(_0x5d75('0x3'));var rp=require(_0x5d75('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5d75('0x5'));var config=require(_0x5d75('0x6'));var attributes=require(_0x5d75('0x7'));module[_0x5d75('0x8')]=function(_0x433569,_0x2825f6){return _0x433569[_0x5d75('0x9')]('WhatsappInteraction',attributes,{'tableName':_0x5d75('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4d7d0c,_0x20f1f2,_0x35320e){if(_0x4d7d0c['changed']('closed')){_0x4d7d0c['closedAt']=moment()[_0x5d75('0xb')](_0x5d75('0xc'));}_0x35320e(null,_0x4d7d0c);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index e8a05b8..190a5dd 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 _0x7e5c=['ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./whatsappInteraction.socket','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','error','message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','options','attributes','stringify','AddTagsToWhatsappInteraction','find','where','body','ids','AddTags','debug','randomstring'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7e5c,0xcb));var _0xc7e5=function(_0x4cd8d7,_0x283bbd){_0x4cd8d7=_0x4cd8d7-0x0;var _0x13593d=_0x7e5c[_0x4cd8d7];return _0x13593d;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc7e5('0x0'));var fs=require('fs');var Redis=require(_0xc7e5('0x1'));var db=require(_0xc7e5('0x2'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc7e5('0x3'));var config=require(_0xc7e5('0x4'));var jayson=require(_0xc7e5('0x5'));var client=jayson['client'][_0xc7e5('0x6')]({'port':0x232a});config[_0xc7e5('0x7')]=_[_0xc7e5('0x8')](config[_0xc7e5('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0xc7e5('0x9'))(new Redis(config[_0xc7e5('0x7')]));require(_0xc7e5('0xa'))[_0xc7e5('0xb')](socket);function respondWithRpcPromise(_0x2b1236,_0x3a2224,_0x4d1e88){return new BPromise(function(_0x33a10a,_0x1348bf){return client[_0xc7e5('0xc')](_0x2b1236,_0x4d1e88)[_0xc7e5('0xd')](function(_0xa7ff05){logger[_0xc7e5('0xe')](_0xc7e5('0xf'),_0x3a2224,_0xc7e5('0x10'));logger['debug']('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x3a2224,_0xc7e5('0x10'),JSON['stringify'](_0xa7ff05));if(_0xa7ff05[_0xc7e5('0x11')]){if(_0xa7ff05[_0xc7e5('0x11')]['code']===0x1f4){logger[_0xc7e5('0x11')](_0xc7e5('0xf'),_0x3a2224,_0xa7ff05['error']['message']);return _0x1348bf(_0xa7ff05['error']['message']);}logger[_0xc7e5('0x11')](_0xc7e5('0xf'),_0x3a2224,_0xa7ff05[_0xc7e5('0x11')][_0xc7e5('0x12')]);return _0x33a10a(_0xa7ff05['error'][_0xc7e5('0x12')]);}else{logger[_0xc7e5('0xe')]('WhatsappInteraction,\x20%s,\x20%s',_0x3a2224,'request\x20sent');_0x33a10a(_0xa7ff05[_0xc7e5('0x13')][_0xc7e5('0x12')]);}})[_0xc7e5('0x14')](function(_0x1786b6){logger[_0xc7e5('0x11')](_0xc7e5('0xf'),_0x3a2224,_0x1786b6);_0x1348bf(_0x1786b6);});});}exports[_0xc7e5('0x15')]=function(_0x41fe02){var _0x48bf81=this;return new Promise(function(_0x49c6e2,_0x1af012){return db[_0xc7e5('0x16')][_0xc7e5('0x17')](_0x41fe02['body'],{'raw':_0x41fe02['options']?_0x41fe02[_0xc7e5('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x41fe02['options']?_0x41fe02[_0xc7e5('0x18')]['where']||null:null,'attributes':_0x41fe02[_0xc7e5('0x18')]?_0x41fe02[_0xc7e5('0x18')][_0xc7e5('0x19')]||null:null,'limit':_0x41fe02['options']?_0x41fe02[_0xc7e5('0x18')]['limit']||null:null})[_0xc7e5('0xd')](function(_0x3dffa5){logger['info']('UpdateWhatsappInteraction',_0x41fe02);logger['debug']('UpdateWhatsappInteraction',_0x41fe02,JSON[_0xc7e5('0x1a')](_0x3dffa5));_0x49c6e2(_0x3dffa5);})[_0xc7e5('0x14')](function(_0x21b809){logger[_0xc7e5('0x11')](_0xc7e5('0x15'),_0x21b809[_0xc7e5('0x12')],_0x41fe02);_0x1af012(_0x48bf81[_0xc7e5('0x11')](0x1f4,_0x21b809['message']));});});};exports[_0xc7e5('0x1b')]=function(_0x3f9ded){return new Promise(function(_0x26c946,_0x233415){return db['WhatsappInteraction'][_0xc7e5('0x1c')]({'where':_0x3f9ded[_0xc7e5('0x18')]?_0x3f9ded[_0xc7e5('0x18')][_0xc7e5('0x1d')]||null:null})[_0xc7e5('0xd')](function(_0x6c8e1){if(_0x6c8e1){return _0x6c8e1['addTags'](_0x3f9ded[_0xc7e5('0x1e')][_0xc7e5('0x1f')],_['omit'](_0x3f9ded[_0xc7e5('0x1e')],[_0xc7e5('0x1f'),'id'])||{});}})['spread'](function(_0x396344){logger[_0xc7e5('0xe')](_0xc7e5('0x20'),_0x3f9ded);logger[_0xc7e5('0x21')](_0xc7e5('0x20'),_0x3f9ded,JSON[_0xc7e5('0x1a')](_0x396344));_0x26c946(_0x396344);})[_0xc7e5('0x14')](function(_0x30f812){logger[_0xc7e5('0x11')]('AddTags',_0x30f812[_0xc7e5('0x12')],_0x3f9ded);_0x233415(_this[_0xc7e5('0x11')](0x1f4,_0x30f812['message']));});});}; \ No newline at end of file +var _0x76d8=['where','addTags','ids','omit','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','request','then','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','body','options','attributes','debug','AddTagsToWhatsappInteraction'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x76d8,0xcd));var _0x876d=function(_0x3d6cee,_0x5aebda){_0x3d6cee=_0x3d6cee-0x0;var _0x51e9b6=_0x76d8[_0x3d6cee];return _0x51e9b6;};'use strict';var _=require(_0x876d('0x0'));var util=require(_0x876d('0x1'));var moment=require(_0x876d('0x2'));var BPromise=require(_0x876d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x876d('0x4'));var db=require(_0x876d('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x876d('0x6'));var config=require(_0x876d('0x7'));var jayson=require(_0x876d('0x8'));var client=jayson[_0x876d('0x9')][_0x876d('0xa')]({'port':0x232a});config['redis']=_[_0x876d('0xb')](config[_0x876d('0xc')],{'host':_0x876d('0xd'),'port':0x18eb});var socket=require(_0x876d('0xe'))(new Redis(config[_0x876d('0xc')]));require(_0x876d('0xf'))['register'](socket);function respondWithRpcPromise(_0x2687e1,_0x4821c1,_0x472649){return new BPromise(function(_0x28ff04,_0x36137d){return client[_0x876d('0x10')](_0x2687e1,_0x472649)[_0x876d('0x11')](function(_0x16f47b){logger['info'](_0x876d('0x12'),_0x4821c1,_0x876d('0x13'));logger['debug'](_0x876d('0x14'),_0x4821c1,_0x876d('0x13'),JSON[_0x876d('0x15')](_0x16f47b));if(_0x16f47b[_0x876d('0x16')]){if(_0x16f47b[_0x876d('0x16')][_0x876d('0x17')]===0x1f4){logger['error'](_0x876d('0x12'),_0x4821c1,_0x16f47b[_0x876d('0x16')][_0x876d('0x18')]);return _0x36137d(_0x16f47b[_0x876d('0x16')][_0x876d('0x18')]);}logger['error'](_0x876d('0x12'),_0x4821c1,_0x16f47b['error']['message']);return _0x28ff04(_0x16f47b[_0x876d('0x16')]['message']);}else{logger[_0x876d('0x19')]('WhatsappInteraction,\x20%s,\x20%s',_0x4821c1,_0x876d('0x13'));_0x28ff04(_0x16f47b[_0x876d('0x1a')][_0x876d('0x18')]);}})[_0x876d('0x1b')](function(_0x4ae1fd){logger['error'](_0x876d('0x12'),_0x4821c1,_0x4ae1fd);_0x36137d(_0x4ae1fd);});});}exports[_0x876d('0x1c')]=function(_0x8d3adb){var _0x397f53=this;return new Promise(function(_0x1ecde7,_0x44a9e2){return db[_0x876d('0x1d')]['update'](_0x8d3adb[_0x876d('0x1e')],{'raw':_0x8d3adb['options']?_0x8d3adb[_0x876d('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x8d3adb[_0x876d('0x1f')]?_0x8d3adb['options']['where']||null:null,'attributes':_0x8d3adb[_0x876d('0x1f')]?_0x8d3adb[_0x876d('0x1f')][_0x876d('0x20')]||null:null,'limit':_0x8d3adb[_0x876d('0x1f')]?_0x8d3adb[_0x876d('0x1f')]['limit']||null:null})[_0x876d('0x11')](function(_0x10d000){logger[_0x876d('0x19')](_0x876d('0x1c'),_0x8d3adb);logger[_0x876d('0x21')](_0x876d('0x1c'),_0x8d3adb,JSON[_0x876d('0x15')](_0x10d000));_0x1ecde7(_0x10d000);})[_0x876d('0x1b')](function(_0x3b8646){logger[_0x876d('0x16')]('UpdateWhatsappInteraction',_0x3b8646[_0x876d('0x18')],_0x8d3adb);_0x44a9e2(_0x397f53[_0x876d('0x16')](0x1f4,_0x3b8646['message']));});});};exports[_0x876d('0x22')]=function(_0x1fe78c){return new Promise(function(_0x197268,_0x272546){return db[_0x876d('0x1d')]['find']({'where':_0x1fe78c['options']?_0x1fe78c[_0x876d('0x1f')][_0x876d('0x23')]||null:null})[_0x876d('0x11')](function(_0x145099){if(_0x145099){return _0x145099[_0x876d('0x24')](_0x1fe78c['body'][_0x876d('0x25')],_[_0x876d('0x26')](_0x1fe78c[_0x876d('0x1e')],[_0x876d('0x25'),'id'])||{});}})['spread'](function(_0x498ce4){logger[_0x876d('0x19')](_0x876d('0x27'),_0x1fe78c);logger[_0x876d('0x21')]('AddTags',_0x1fe78c,JSON[_0x876d('0x15')](_0x498ce4));_0x197268(_0x498ce4);})[_0x876d('0x1b')](function(_0x44db17){logger[_0x876d('0x16')](_0x876d('0x27'),_0x44db17['message'],_0x1fe78c);_0x272546(_this[_0x876d('0x16')](0x1f4,_0x44db17[_0x876d('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 06c037c..4b167ee 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 _0x45f3=['./whatsappInteraction.events','save','remove','update','emit','register','length','whatsappInteraction:'];(function(_0x4e42a2,_0x2051ce){var _0x226b0d=function(_0x969e35){while(--_0x969e35){_0x4e42a2['push'](_0x4e42a2['shift']());}};_0x226b0d(++_0x2051ce);}(_0x45f3,0x1a8));var _0x345f=function(_0x2abaae,_0x29fd8b){_0x2abaae=_0x2abaae-0x0;var _0x5b5745=_0x45f3[_0x2abaae];return _0x5b5745;};'use strict';var WhatsappInteractionEvents=require(_0x345f('0x0'));var events=[_0x345f('0x1'),_0x345f('0x2'),_0x345f('0x3')];function createListener(_0x177a9a,_0x526fec){return function(_0x29f370){_0x526fec[_0x345f('0x4')](_0x177a9a,_0x29f370);};}function removeListener(_0x5e6fe5,_0x50a66d){return function(){WhatsappInteractionEvents['removeListener'](_0x5e6fe5,_0x50a66d);};}exports[_0x345f('0x5')]=function(_0x45a316){for(var _0x17c067=0x0,_0x1d53cd=events[_0x345f('0x6')];_0x17c067<_0x1d53cd;_0x17c067++){var _0x54d3ce=events[_0x17c067];var _0x173c1d=createListener(_0x345f('0x7')+_0x54d3ce,_0x45a316);WhatsappInteractionEvents['on'](_0x54d3ce,_0x173c1d);}}; \ No newline at end of file +var _0x72b4=['register','whatsappInteraction:','./whatsappInteraction.events','save','remove','emit','removeListener'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x72b4,0x1d7));var _0x472b=function(_0x4bf814,_0x431c38){_0x4bf814=_0x4bf814-0x0;var _0xd4452c=_0x72b4[_0x4bf814];return _0xd4452c;};'use strict';var WhatsappInteractionEvents=require(_0x472b('0x0'));var events=[_0x472b('0x1'),_0x472b('0x2'),'update'];function createListener(_0x3db650,_0x3ed5db){return function(_0x1ab5f6){_0x3ed5db[_0x472b('0x3')](_0x3db650,_0x1ab5f6);};}function removeListener(_0x380c93,_0x16c39e){return function(){WhatsappInteractionEvents[_0x472b('0x4')](_0x380c93,_0x16c39e);};}exports[_0x472b('0x5')]=function(_0x720291){for(var _0x560388=0x0,_0x85b6db=events['length'];_0x560388<_0x85b6db;_0x560388++){var _0x429b09=events[_0x560388];var _0x22c878=createListener(_0x472b('0x6')+_0x429b09,_0x720291);WhatsappInteractionEvents['on'](_0x429b09,_0x22c878);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 2e708df..11610cd 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 _0x1d14=['create','status','put','update','accept','/:id/reject','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','index','get','/describe','isAuthenticated','/:id','show','post','whatsapp','whatsappmessage:create'];(function(_0xbf6b12,_0x5b4c41){var _0x5e9111=function(_0x19ffde){while(--_0x19ffde){_0xbf6b12['push'](_0xbf6b12['shift']());}};_0x5e9111(++_0x5b4c41);}(_0x1d14,0x134));var _0x41d1=function(_0x50f636,_0x15ddcc){_0x50f636=_0x50f636-0x0;var _0x27f805=_0x1d14[_0x50f636];return _0x27f805;};'use strict';var multer=require(_0x41d1('0x0'));var util=require(_0x41d1('0x1'));var path=require(_0x41d1('0x2'));var timeout=require('connect-timeout');var express=require(_0x41d1('0x3'));var router=express[_0x41d1('0x4')]();var fs_extra=require(_0x41d1('0x5'));var auth=require(_0x41d1('0x6'));var interaction=require(_0x41d1('0x7'));var config=require('../../config/environment');var controller=require('./whatsappMessage.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x41d1('0x8')]);router[_0x41d1('0x9')](_0x41d1('0xa'),auth[_0x41d1('0xb')](),controller['describe']);router['get'](_0x41d1('0xc'),auth[_0x41d1('0xb')](),controller[_0x41d1('0xd')]);router[_0x41d1('0xe')]('/',auth[_0x41d1('0xb')](),interaction['tracked'](_0x41d1('0xf'),_0x41d1('0x10')),controller[_0x41d1('0x11')]);router['post']('/:id/status',controller[_0x41d1('0x12')]);router[_0x41d1('0x13')]('/:id',auth[_0x41d1('0xb')](),controller[_0x41d1('0x14')]);router[_0x41d1('0x13')]('/:id/accept',auth['isAuthenticated'](),controller[_0x41d1('0x15')]);router['put'](_0x41d1('0x16'),auth[_0x41d1('0xb')](),controller['reject']);router[_0x41d1('0x17')](_0x41d1('0xc'),auth['isAuthenticated'](),controller[_0x41d1('0x18')]);module['exports']=router; \ No newline at end of file +var _0x6124=['whatsappmessage:create','create','/:id/status','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','index','describe','/:id','show','post','tracked','whatsapp'];(function(_0x1229e2,_0xa6cde2){var _0xb1a73b=function(_0x279800){while(--_0x279800){_0x1229e2['push'](_0x1229e2['shift']());}};_0xb1a73b(++_0xa6cde2);}(_0x6124,0x1a2));var _0x4612=function(_0x541d87,_0x13f373){_0x541d87=_0x541d87-0x0;var _0x53b647=_0x6124[_0x541d87];return _0x53b647;};'use strict';var multer=require(_0x4612('0x0'));var util=require('util');var path=require(_0x4612('0x1'));var timeout=require(_0x4612('0x2'));var express=require('express');var router=express[_0x4612('0x3')]();var fs_extra=require(_0x4612('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x4612('0x5'));var config=require(_0x4612('0x6'));var controller=require(_0x4612('0x7'));router[_0x4612('0x8')]('/',auth[_0x4612('0x9')](),controller[_0x4612('0xa')]);router[_0x4612('0x8')]('/describe',auth[_0x4612('0x9')](),controller[_0x4612('0xb')]);router[_0x4612('0x8')](_0x4612('0xc'),auth[_0x4612('0x9')](),controller[_0x4612('0xd')]);router[_0x4612('0xe')]('/',auth[_0x4612('0x9')](),interaction[_0x4612('0xf')](_0x4612('0x10'),_0x4612('0x11')),controller[_0x4612('0x12')]);router[_0x4612('0xe')](_0x4612('0x13'),controller['status']);router[_0x4612('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x4612('0x15')]);router[_0x4612('0x14')](_0x4612('0x16'),auth[_0x4612('0x9')](),controller[_0x4612('0x17')]);router[_0x4612('0x14')](_0x4612('0x18'),auth['isAuthenticated'](),controller[_0x4612('0x19')]);router[_0x4612('0x1a')](_0x4612('0xc'),auth['isAuthenticated'](),controller[_0x4612('0x1b')]);module[_0x4612('0x1c')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 3e30e49..339e968 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 _0x84ed=['out','STRING','DATE','sequelize','exports','TEXT','medium','BOOLEAN','ENUM'];(function(_0x53e149,_0x2e5dff){var _0x16a2c5=function(_0x5cdab2){while(--_0x5cdab2){_0x53e149['push'](_0x53e149['shift']());}};_0x16a2c5(++_0x2e5dff);}(_0x84ed,0x1bc));var _0xd84e=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x84ed[_0x126558];return _0x1f6d14;};'use strict';var Sequelize=require(_0xd84e('0x0'));module[_0xd84e('0x1')]={'body':{'type':Sequelize[_0xd84e('0x2')](_0xd84e('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xd84e('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xd84e('0x5')]('in','out'),'defaultValue':_0xd84e('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0xd84e('0x7')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0xd84e('0x8')]},'secret':{'type':Sequelize[_0xd84e('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xd84e('0x2')]}}; \ No newline at end of file +var _0x5520=['BOOLEAN','ENUM','out','STRING','TEXT','sequelize','exports','medium'];(function(_0x26ae6f,_0x5b8f4b){var _0x170e26=function(_0x14e460){while(--_0x14e460){_0x26ae6f['push'](_0x26ae6f['shift']());}};_0x170e26(++_0x5b8f4b);}(_0x5520,0x165));var _0x0552=function(_0x28e2a7,_0x5ae5e9){_0x28e2a7=_0x28e2a7-0x0;var _0x58f155=_0x5520[_0x28e2a7];return _0x58f155;};'use strict';var Sequelize=require(_0x0552('0x0'));module[_0x0552('0x1')]={'body':{'type':Sequelize['TEXT'](_0x0552('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x0552('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x0552('0x4')]('in','out'),'defaultValue':_0x0552('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x0552('0x6')](0xbe)},'phone':{'type':Sequelize[_0x0552('0x6')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x0552('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x0552('0x6')]},'providerResponse':{'type':Sequelize[_0x0552('0x7')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index db1abfc..f7b408b 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 _0xfa53=['MessageStatus','read','inspect','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','client','http','request','info','WhatsappMessage,\x20%s,\x20%s','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','key','model','filters','intersection','query','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','WhatsappMessage','includeAll','include','findAll','rows','params','keys','find','body','describe','whatsapp-interactions','accept','whatsapp','readAt','format','YYYY-MM-DD\x20HH:mm:ss','agent','UserId','get','WhatsappInteractionId','isNil','read1stAt','interaction','user','stringify','null','AcceptMessage','acceptMessage','ContactId','sequelize','QueryTypes','contact','email','internal','interface','SIP/%s','channel','motionChannel','EventManager','acceptmessage','reject','role','RejectMessage','rejectMessage','Sequelize','SELECT','User','fullname','event','rejectmessage','WhatsappAccount','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','twilio','MessageSid','messageId'];(function(_0x54ca22,_0x13b0c6){var _0xe94a1f=function(_0x5a65cf){while(--_0x5a65cf){_0x54ca22['push'](_0x54ca22['shift']());}};_0xe94a1f(++_0x13b0c6);}(_0xfa53,0x1aa));var _0x3fa5=function(_0x278b7f,_0x25fd7d){_0x278b7f=_0x278b7f-0x0;var _0xa5d9e=_0xfa53[_0x278b7f];return _0xa5d9e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3fa5('0x0'));var zipdir=require(_0x3fa5('0x1'));var jsonpatch=require(_0x3fa5('0x2'));var rp=require(_0x3fa5('0x3'));var moment=require(_0x3fa5('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3fa5('0x5'));var path=require(_0x3fa5('0x6'));var sox=require('sox');var csv=require(_0x3fa5('0x7'));var ejs=require(_0x3fa5('0x8'));var fs=require('fs');var fs_extra=require(_0x3fa5('0x9'));var _=require(_0x3fa5('0xa'));var squel=require(_0x3fa5('0xb'));var crypto=require(_0x3fa5('0xc'));var jsforce=require(_0x3fa5('0xd'));var deskjs=require(_0x3fa5('0xe'));var toCsv=require(_0x3fa5('0x7'));var querystring=require(_0x3fa5('0xf'));var Papa=require(_0x3fa5('0x10'));var Redis=require(_0x3fa5('0x11'));var authService=require(_0x3fa5('0x12'));var qs=require(_0x3fa5('0x13'));var as=require(_0x3fa5('0x14'));var hardwareService=require(_0x3fa5('0x15'));var logger=require(_0x3fa5('0x16'))(_0x3fa5('0x17'));var utils=require('../../config/utils');var config=require(_0x3fa5('0x18'));var licenseUtil=require(_0x3fa5('0x19'));var db=require(_0x3fa5('0x1a'))['db'];config[_0x3fa5('0x1b')]=_['defaults'](config[_0x3fa5('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x3fa5('0x1c'))(new Redis(config['redis']));require(_0x3fa5('0x1d'))[_0x3fa5('0x1e')](socket);var jayson=require(_0x3fa5('0x1f'));var client=jayson[_0x3fa5('0x20')][_0x3fa5('0x21')]({'port':0x232c});var client9002=jayson[_0x3fa5('0x20')][_0x3fa5('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x194c1f,_0x905a54,_0xd9d191,_0x5490be){return new BPromise(function(_0x5685a4,_0x552652){var _0x1d4596=_0x5490be||client;return _0x1d4596[_0x3fa5('0x22')](_0x194c1f,_0xd9d191)['then'](function(_0x20e79d){logger[_0x3fa5('0x23')](_0x3fa5('0x24'),_0x905a54,'request\x20sent');logger[_0x3fa5('0x25')](_0x3fa5('0x26'),_0x905a54,_0x3fa5('0x27'),JSON['stringify'](_0x20e79d));if(_0x20e79d[_0x3fa5('0x28')]){if(_0x20e79d[_0x3fa5('0x28')][_0x3fa5('0x29')]===0x1f4){logger[_0x3fa5('0x28')](_0x3fa5('0x24'),_0x905a54,_0x20e79d[_0x3fa5('0x28')][_0x3fa5('0x2a')]);return _0x552652(_0x20e79d[_0x3fa5('0x28')][_0x3fa5('0x2a')]);}logger[_0x3fa5('0x28')]('WhatsappMessage,\x20%s,\x20%s',_0x905a54,_0x20e79d[_0x3fa5('0x28')][_0x3fa5('0x2a')]);return _0x5685a4(_0x20e79d[_0x3fa5('0x28')][_0x3fa5('0x2a')]);}else{logger[_0x3fa5('0x23')](_0x3fa5('0x24'),_0x905a54,_0x3fa5('0x27'));_0x5685a4(_0x20e79d['result'][_0x3fa5('0x2a')]);}})[_0x3fa5('0x2b')](function(_0x16587d){logger[_0x3fa5('0x28')](_0x3fa5('0x24'),_0x905a54,_0x16587d);_0x552652(_0x16587d);});});}function respondWithStatusCode(_0x333920,_0x1b5fca){_0x1b5fca=_0x1b5fca||0xcc;return function(_0x57dd62){if(_0x57dd62){return _0x333920['sendStatus'](_0x1b5fca);}return _0x333920[_0x3fa5('0x2c')](_0x1b5fca)[_0x3fa5('0x2d')]();};}function respondWithResult(_0x5103f3,_0x23a5f2){_0x23a5f2=_0x23a5f2||0xc8;return function(_0x1821ec){if(_0x1821ec){return _0x5103f3[_0x3fa5('0x2c')](_0x23a5f2)[_0x3fa5('0x2e')](_0x1821ec);}};}function respondWithFilteredResult(_0x45b9c2,_0x3212a3){return function(_0x9526cd){if(_0x9526cd){var _0x52d379=typeof _0x3212a3[_0x3fa5('0x2f')]===_0x3fa5('0x30')&&typeof _0x3212a3[_0x3fa5('0x31')]===_0x3fa5('0x30');var _0x1df7fa=_0x9526cd[_0x3fa5('0x32')];var _0x5a528f=_0x52d379?0x0:_0x3212a3[_0x3fa5('0x2f')];var _0x17d512=_0x52d379?_0x9526cd[_0x3fa5('0x32')]:_0x3212a3[_0x3fa5('0x2f')]+_0x3212a3[_0x3fa5('0x31')];var _0x16e567;if(_0x17d512>=_0x1df7fa){_0x17d512=_0x1df7fa;_0x16e567=0xc8;}else{_0x16e567=0xce;}_0x45b9c2[_0x3fa5('0x2c')](_0x16e567);return _0x45b9c2[_0x3fa5('0x33')]('Content-Range',_0x5a528f+'-'+_0x17d512+'/'+_0x1df7fa)[_0x3fa5('0x2e')](_0x9526cd);}return null;};}function patchUpdates(_0x173e9e){return function(_0x418c7a){try{jsonpatch[_0x3fa5('0x34')](_0x418c7a,_0x173e9e,!![]);}catch(_0x2ab5b0){return BPromise['reject'](_0x2ab5b0);}return _0x418c7a[_0x3fa5('0x35')]();};}function saveUpdates(_0x42b482,_0x3b9977){return function(_0x7480e){if(_0x7480e){return _0x7480e[_0x3fa5('0x36')](_0x42b482)[_0x3fa5('0x37')](function(_0x39385f){return _0x39385f;});}return null;};}function removeEntity(_0x33a7b6,_0x4392da){return function(_0xa71b9b){if(_0xa71b9b){return _0xa71b9b[_0x3fa5('0x38')]()[_0x3fa5('0x37')](function(){_0x33a7b6[_0x3fa5('0x2c')](0xcc)[_0x3fa5('0x2d')]();});}};}function handleEntityNotFound(_0x5929aa,_0x523666){return function(_0x5301f2){if(!_0x5301f2){_0x5929aa[_0x3fa5('0x39')](0x194);}return _0x5301f2;};}function handleError(_0x2563e9,_0x3b2653){_0x3b2653=_0x3b2653||0x1f4;return function(_0x51b0e5){logger[_0x3fa5('0x28')](_0x51b0e5[_0x3fa5('0x3a')]);if(_0x51b0e5['name']){delete _0x51b0e5[_0x3fa5('0x3b')];}_0x2563e9[_0x3fa5('0x2c')](_0x3b2653)[_0x3fa5('0x3c')](_0x51b0e5);};}exports[_0x3fa5('0x3d')]=function(_0x5161b5,_0x5384d0){var _0x86c83={},_0x443212={},_0x59c5e6={'count':0x0,'rows':[]};var _0x1d2936=_[_0x3fa5('0x3e')](db['WhatsappMessage'][_0x3fa5('0x3f')],function(_0x13a15a){return{'name':_0x13a15a[_0x3fa5('0x40')],'type':_0x13a15a['type'][_0x3fa5('0x41')]};});_0x443212[_0x3fa5('0x42')]=_[_0x3fa5('0x3e')](_0x1d2936,'name');_0x443212['query']=_['keys'](_0x5161b5['query']);_0x443212[_0x3fa5('0x43')]=_[_0x3fa5('0x44')](_0x443212[_0x3fa5('0x42')],_0x443212[_0x3fa5('0x45')]);_0x86c83[_0x3fa5('0x46')]=_[_0x3fa5('0x44')](_0x443212['model'],qs['fields'](_0x5161b5['query'][_0x3fa5('0x47')]));_0x86c83[_0x3fa5('0x46')]=_0x86c83['attributes'][_0x3fa5('0x48')]?_0x86c83['attributes']:_0x443212['model'];if(!_0x5161b5['query'][_0x3fa5('0x49')]('nolimit')){_0x86c83[_0x3fa5('0x31')]=qs[_0x3fa5('0x31')](_0x5161b5[_0x3fa5('0x45')][_0x3fa5('0x31')]);_0x86c83[_0x3fa5('0x2f')]=qs['offset'](_0x5161b5['query'][_0x3fa5('0x2f')]);}_0x86c83[_0x3fa5('0x4a')]=qs[_0x3fa5('0x4b')](_0x5161b5['query'][_0x3fa5('0x4b')]);_0x86c83[_0x3fa5('0x4c')]=qs[_0x3fa5('0x43')](_[_0x3fa5('0x4d')](_0x5161b5[_0x3fa5('0x45')],_0x443212[_0x3fa5('0x43')]),_0x1d2936);if(_0x5161b5['query'][_0x3fa5('0x4e')]){_0x86c83['where']=_[_0x3fa5('0x4f')](_0x86c83['where'],{'$or':_[_0x3fa5('0x3e')](_0x1d2936,function(_0xd3bc33){if(_0xd3bc33[_0x3fa5('0x50')]!==_0x3fa5('0x51')){var _0x3ce3ef={};_0x3ce3ef[_0xd3bc33[_0x3fa5('0x3b')]]={'$like':'%'+_0x5161b5[_0x3fa5('0x45')][_0x3fa5('0x4e')]+'%'};return _0x3ce3ef;}})});}_0x86c83=_[_0x3fa5('0x4f')]({},_0x86c83,_0x5161b5['options']);var _0x44d20d={'where':_0x86c83['where']};return db[_0x3fa5('0x52')][_0x3fa5('0x32')](_0x44d20d)[_0x3fa5('0x37')](function(_0x2d943e){_0x59c5e6[_0x3fa5('0x32')]=_0x2d943e;if(_0x5161b5[_0x3fa5('0x45')][_0x3fa5('0x53')]){_0x86c83[_0x3fa5('0x54')]=[{'all':!![]}];}return db['WhatsappMessage'][_0x3fa5('0x55')](_0x86c83);})[_0x3fa5('0x37')](function(_0x440f5f){_0x59c5e6[_0x3fa5('0x56')]=_0x440f5f;return _0x59c5e6;})[_0x3fa5('0x37')](respondWithFilteredResult(_0x5384d0,_0x86c83))[_0x3fa5('0x2b')](handleError(_0x5384d0,null));};exports['show']=function(_0x358228,_0x4cc9f2){var _0x548a1b={'raw':!![],'where':{'id':_0x358228[_0x3fa5('0x57')]['id']}},_0x52458b={};_0x52458b[_0x3fa5('0x42')]=_[_0x3fa5('0x58')](db[_0x3fa5('0x52')][_0x3fa5('0x3f')]);_0x52458b[_0x3fa5('0x45')]=_[_0x3fa5('0x58')](_0x358228[_0x3fa5('0x45')]);_0x52458b[_0x3fa5('0x43')]=_['intersection'](_0x52458b[_0x3fa5('0x42')],_0x52458b[_0x3fa5('0x45')]);_0x548a1b['attributes']=_[_0x3fa5('0x44')](_0x52458b['model'],qs['fields'](_0x358228[_0x3fa5('0x45')]['fields']));_0x548a1b[_0x3fa5('0x46')]=_0x548a1b['attributes']['length']?_0x548a1b[_0x3fa5('0x46')]:_0x52458b[_0x3fa5('0x42')];if(_0x358228[_0x3fa5('0x45')][_0x3fa5('0x53')]){_0x548a1b[_0x3fa5('0x54')]=[{'all':!![]}];}_0x548a1b=_[_0x3fa5('0x4f')]({},_0x548a1b,_0x358228['options']);return db[_0x3fa5('0x52')][_0x3fa5('0x59')](_0x548a1b)[_0x3fa5('0x37')](handleEntityNotFound(_0x4cc9f2,null))[_0x3fa5('0x37')](respondWithResult(_0x4cc9f2,null))[_0x3fa5('0x2b')](handleError(_0x4cc9f2,null));};exports['create']=function(_0x1477ac,_0x1efca3){return db['WhatsappMessage']['create'](_0x1477ac[_0x3fa5('0x5a')],{})['then'](respondWithResult(_0x1efca3,0xc9))[_0x3fa5('0x2b')](handleError(_0x1efca3,null));};exports[_0x3fa5('0x36')]=function(_0x2055a5,_0x5afd80){if(_0x2055a5['body']['id']){delete _0x2055a5[_0x3fa5('0x5a')]['id'];}return db[_0x3fa5('0x52')]['find']({'where':{'id':_0x2055a5[_0x3fa5('0x57')]['id']}})['then'](handleEntityNotFound(_0x5afd80,null))[_0x3fa5('0x37')](saveUpdates(_0x2055a5[_0x3fa5('0x5a')],null))['then'](respondWithResult(_0x5afd80,null))[_0x3fa5('0x2b')](handleError(_0x5afd80,null));};exports[_0x3fa5('0x38')]=function(_0x3b2b10,_0x36145d){return db[_0x3fa5('0x52')][_0x3fa5('0x59')]({'where':{'id':_0x3b2b10[_0x3fa5('0x57')]['id']}})[_0x3fa5('0x37')](handleEntityNotFound(_0x36145d,null))[_0x3fa5('0x37')](removeEntity(_0x36145d,null))['catch'](handleError(_0x36145d,null));};exports[_0x3fa5('0x5b')]=function(_0x536cc4,_0x578adb){return db[_0x3fa5('0x52')][_0x3fa5('0x5b')]()[_0x3fa5('0x37')](respondWithResult(_0x578adb,null))[_0x3fa5('0x2b')](handleError(_0x578adb,null));};var interaction_log=require(_0x3fa5('0x16'))(_0x3fa5('0x5c'));exports[_0x3fa5('0x5d')]=function(_0x3b77e7,_0x2a08ad,_0x150094){var _0x43b791={'agent':{},'channel':_0x3fa5('0x5e')};if(_0x3b77e7[_0x3fa5('0x5a')]['id']){delete _0x3b77e7['body']['id'];}_0x3b77e7['body']['read']=!![];_0x3b77e7[_0x3fa5('0x5a')][_0x3fa5('0x5f')]=moment()[_0x3fa5('0x60')](_0x3fa5('0x61'));_0x3b77e7[_0x3fa5('0x5a')]['UserId']=_0x3b77e7[_0x3fa5('0x5a')]['UserId']||_0x3b77e7['user']['id'];_0x43b791[_0x3fa5('0x62')]['id']=_0x3b77e7['body'][_0x3fa5('0x63')];return db['WhatsappMessage'][_0x3fa5('0x59')]({'where':{'id':_0x3b77e7[_0x3fa5('0x57')]['id'],'UserId':null}})[_0x3fa5('0x37')](handleEntityNotFound(_0x2a08ad,null))[_0x3fa5('0x37')](saveUpdates(_0x3b77e7['body'],null))[_0x3fa5('0x37')](function(_0x5a2b72){if(_0x5a2b72){_0x43b791[_0x3fa5('0x2a')]=_0x5a2b72[_0x3fa5('0x64')]({'plain':!![]});return db['WhatsappInteraction'][_0x3fa5('0x59')]({'where':{'id':_0x5a2b72[_0x3fa5('0x65')]}});}return null;})[_0x3fa5('0x37')](handleEntityNotFound(_0x2a08ad,null))['then'](function(_0x4c88dc){if(_0x4c88dc){return _0x4c88dc[_0x3fa5('0x36')]({'UserId':_0x3b77e7[_0x3fa5('0x5a')][_0x3fa5('0x63')],'read1stAt':_[_0x3fa5('0x66')](_0x4c88dc[_0x3fa5('0x67')])?moment()[_0x3fa5('0x60')](_0x3fa5('0x61')):undefined});}return null;})[_0x3fa5('0x37')](function(_0x5604b9){if(_0x5604b9){_0x43b791[_0x3fa5('0x68')]=_0x5604b9['get']({'plain':!![]});interaction_log[_0x3fa5('0x23')]('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3b77e7[_0x3fa5('0x69')]['id'],_0x3b77e7[_0x3fa5('0x69')][_0x3fa5('0x3b')],_0x3b77e7[_0x3fa5('0x69')]['role'],_0x43b791[_0x3fa5('0x68')]['id'],_0x3b77e7[_0x3fa5('0x5a')]?JSON[_0x3fa5('0x6a')](_0x3b77e7[_0x3fa5('0x5a')]):_0x3fa5('0x6b'));return respondWithRpcPromise(_0x3fa5('0x6c'),_0x3fa5('0x6d'),_0x43b791);}return null;})[_0x3fa5('0x37')](function(_0x1331ce){var _0x284fcf='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x1331ce[_0x3fa5('0x2a')][_0x3fa5('0x6e')];return db[_0x3fa5('0x6f')]['query'](_0x284fcf,{'type':db['Sequelize'][_0x3fa5('0x70')]['SELECT'],'raw':!![]})[_0x3fa5('0x37')](function(_0x33c5fa){return _0x33c5fa;});})[_0x3fa5('0x37')](function(_0x32c52b){if(_0x32c52b){_0x43b791[_0x3fa5('0x2a')][_0x3fa5('0x71')]=_0x32c52b[0x0];if(!_0x3b77e7['body'][_0x3fa5('0x63')])return;return db['User'][_0x3fa5('0x59')]({'where':{'id':_0x3b77e7[_0x3fa5('0x5a')][_0x3fa5('0x63')],'role':_0x3fa5('0x62')},'attributes':['id',_0x3fa5('0x3b'),'fullname',_0x3fa5('0x72'),_0x3fa5('0x73')],'raw':!![]});}return null;})[_0x3fa5('0x37')](function(_0x5d9900){if(!_0x5d9900)return null;_0x43b791[_0x3fa5('0x2a')]['agent']=_0x5d9900;return _0x43b791;})[_0x3fa5('0x37')](function(_0x462339){if(_0x462339){if(_0x3b77e7[_0x3fa5('0x5a')]['manual']){_0x43b791['message'][_0x3fa5('0x74')]=util[_0x3fa5('0x60')](_0x3fa5('0x75'),_0x3b77e7[_0x3fa5('0x69')]['name']);_0x43b791['message'][_0x3fa5('0x76')]=_0x43b791[_0x3fa5('0x76')];_0x43b791[_0x3fa5('0x2a')][_0x3fa5('0x77')]=_0x43b791[_0x3fa5('0x76')];_0x43b791[_0x3fa5('0x2a')]['event']=_0x3fa5('0x5d');return respondWithRpcPromise(_0x3fa5('0x78'),_0x3fa5('0x78'),{'event':_0x3fa5('0x79'),'message':_0x43b791[_0x3fa5('0x2a')]},client9002)[_0x3fa5('0x37')](function(){return _0x43b791;});}return _0x43b791;}return null;})[_0x3fa5('0x37')](respondWithResult(_0x2a08ad,null))[_0x3fa5('0x2b')](handleError(_0x2a08ad,null));};var interaction_log=require(_0x3fa5('0x16'))('whatsapp-interactions');exports[_0x3fa5('0x7a')]=function(_0x1b41dd,_0x4c3022,_0x3bd08b){var _0x2062b8={'agent':{},'channel':_0x3fa5('0x5e')};if(_0x1b41dd['body']['id']){delete _0x1b41dd['body']['id'];}_0x1b41dd['body'][_0x3fa5('0x63')]=_0x1b41dd[_0x3fa5('0x5a')][_0x3fa5('0x63')]||_0x1b41dd['user']['id'];_0x2062b8[_0x3fa5('0x62')]['id']=_0x1b41dd[_0x3fa5('0x5a')]['UserId'];return db[_0x3fa5('0x52')][_0x3fa5('0x59')]({'where':{'id':_0x1b41dd[_0x3fa5('0x57')]['id'],'UserId':null}})[_0x3fa5('0x37')](handleEntityNotFound(_0x4c3022,null))[_0x3fa5('0x37')](function(_0x313cea){if(_0x313cea){_0x2062b8['message']=_0x313cea[_0x3fa5('0x64')]({'plain':!![]});return db['WhatsappInteraction'][_0x3fa5('0x59')]({'where':{'id':_0x313cea[_0x3fa5('0x65')]}});}return null;})[_0x3fa5('0x37')](handleEntityNotFound(_0x4c3022,null))[_0x3fa5('0x37')](function(_0x48edd5){if(_0x48edd5){_0x2062b8[_0x3fa5('0x68')]=_0x48edd5['get']({'plain':!![]});interaction_log[_0x3fa5('0x23')]('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1b41dd[_0x3fa5('0x69')]['id'],_0x1b41dd[_0x3fa5('0x69')][_0x3fa5('0x3b')],_0x1b41dd['user'][_0x3fa5('0x7b')],_0x2062b8[_0x3fa5('0x68')]['id'],_0x1b41dd[_0x3fa5('0x5a')]?JSON[_0x3fa5('0x6a')](_0x1b41dd[_0x3fa5('0x5a')]):_0x3fa5('0x6b'));return respondWithRpcPromise(_0x3fa5('0x7c'),_0x3fa5('0x7d'),_0x2062b8);}return null;})[_0x3fa5('0x37')](function(_0x36191e){var _0x2d0d5e='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x36191e['message']['ContactId'];return db[_0x3fa5('0x6f')][_0x3fa5('0x45')](_0x2d0d5e,{'type':db[_0x3fa5('0x7e')][_0x3fa5('0x70')][_0x3fa5('0x7f')],'raw':!![]})[_0x3fa5('0x37')](function(_0x31f685){return _0x31f685;});})[_0x3fa5('0x37')](function(_0x4539ce){if(_0x4539ce){_0x2062b8[_0x3fa5('0x2a')][_0x3fa5('0x71')]=_0x4539ce[0x0];if(!_0x1b41dd['body'][_0x3fa5('0x63')])return;return db[_0x3fa5('0x80')][_0x3fa5('0x59')]({'where':{'id':_0x1b41dd[_0x3fa5('0x5a')]['UserId'],'role':_0x3fa5('0x62')},'attributes':['id',_0x3fa5('0x3b'),_0x3fa5('0x81'),'email',_0x3fa5('0x73')],'raw':!![]});}return null;})[_0x3fa5('0x37')](function(_0x5c6503){if(!_0x5c6503)return null;_0x2062b8[_0x3fa5('0x2a')]['agent']=_0x5c6503;return _0x2062b8;})[_0x3fa5('0x37')](function(_0x29ca32){if(_0x29ca32){_0x29ca32[_0x3fa5('0x2a')][_0x3fa5('0x74')]=util['format'](_0x3fa5('0x75'),_0x1b41dd['user'][_0x3fa5('0x3b')]);_0x29ca32[_0x3fa5('0x2a')][_0x3fa5('0x76')]=_0x2062b8[_0x3fa5('0x76')];_0x29ca32[_0x3fa5('0x2a')][_0x3fa5('0x77')]=_0x2062b8['channel'];_0x29ca32['message'][_0x3fa5('0x82')]=_0x3fa5('0x7a');respondWithRpcPromise(_0x3fa5('0x78'),'EventManager',{'event':_0x3fa5('0x83'),'message':_0x29ca32[_0x3fa5('0x2a')]},client9002);return _0x2062b8;}return null;})[_0x3fa5('0x37')](respondWithResult(_0x4c3022,null))[_0x3fa5('0x2b')](handleError(_0x4c3022,null));};exports['status']=function(_0x1c913a,_0x2c7ebd,_0x247017){if(_0x1c913a[_0x3fa5('0x5a')]['id']){delete _0x1c913a['body']['id'];}var _0x299f61;return db[_0x3fa5('0x52')][_0x3fa5('0x59')]({'where':{'id':_0x1c913a[_0x3fa5('0x57')]['id']}})[_0x3fa5('0x37')](handleEntityNotFound(_0x2c7ebd,null))[_0x3fa5('0x37')](function(_0x559cd5){if(_0x559cd5){_0x299f61=_0x559cd5;return db[_0x3fa5('0x84')][_0x3fa5('0x59')]({'where':{'id':_0x559cd5['WhatsappAccountId']}});}})[_0x3fa5('0x37')](handleEntityNotFound(_0x2c7ebd,null))['then'](function(_0x51a6cb){if(_0x51a6cb){logger[_0x3fa5('0x25')](_0x3fa5('0x85'),_0x3fa5('0x2c'),_0x3fa5('0x86'),_0x51a6cb[_0x3fa5('0x50')],util['inspect'](_0x1c913a[_0x3fa5('0x5a')],{'showHidden':![],'depth':null}));switch(_0x51a6cb[_0x3fa5('0x50')]){case _0x3fa5('0x87'):if(_0x1c913a[_0x3fa5('0x5a')][_0x3fa5('0x88')]&&_0x1c913a['body'][_0x3fa5('0x88')]===_0x299f61[_0x3fa5('0x89')]&&_0x1c913a[_0x3fa5('0x5a')]['MessageStatus']&&_0x1c913a[_0x3fa5('0x5a')][_0x3fa5('0x8a')]===_0x3fa5('0x8b')){return _0x299f61[_0x3fa5('0x36')]({'read':!![]});}else{logger['error']('WhatsappAccount,\x20%s,\x20%s,\x20%s','status','twilio',util[_0x3fa5('0x8c')](_0x1c913a[_0x3fa5('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0x299f61;}})[_0x3fa5('0x37')](respondWithResult(_0x2c7ebd,null))[_0x3fa5('0x2b')](handleError(_0x2c7ebd,null));}; \ No newline at end of file +var _0xf2b4=['fullname','email','internal','manual','interface','channel','event','EventManager','acceptmessage','WhatsappInteractionId','RejectMessage','rejectMessage','ContactId','SIP/%s','rejectmessage','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','rimraf','fast-json-patch','request-promise','bluebird','mustache','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','register','jayson/promise','client','http','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','destroy','end','stack','name','index','map','WhatsappMessage','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','create','update','body','whatsapp-interactions','accept','whatsapp','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','WhatsappInteraction','isNil','read1stAt','interaction','role','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','contact','User','agent'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xf2b4,0x1a8));var _0x4f2b=function(_0xbbc2cc,_0x3eacf8){_0xbbc2cc=_0xbbc2cc-0x0;var _0x5dbe7a=_0xf2b4[_0xbbc2cc];return _0x5dbe7a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4f2b('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4f2b('0x1'));var rp=require(_0x4f2b('0x2'));var moment=require('moment');var BPromise=require(_0x4f2b('0x3'));var Mustache=require(_0x4f2b('0x4'));var util=require('util');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(_0x4f2b('0x5'));var _=require(_0x4f2b('0x6'));var squel=require(_0x4f2b('0x7'));var crypto=require(_0x4f2b('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x4f2b('0x9'));var toCsv=require(_0x4f2b('0xa'));var querystring=require(_0x4f2b('0xb'));var Papa=require(_0x4f2b('0xc'));var Redis=require(_0x4f2b('0xd'));var authService=require(_0x4f2b('0xe'));var qs=require(_0x4f2b('0xf'));var as=require(_0x4f2b('0x10'));var hardwareService=require(_0x4f2b('0x11'));var logger=require(_0x4f2b('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x4f2b('0x13'));var licenseUtil=require(_0x4f2b('0x14'));var db=require(_0x4f2b('0x15'))['db'];config[_0x4f2b('0x16')]=_['defaults'](config[_0x4f2b('0x16')],{'host':_0x4f2b('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4f2b('0x16')]));require('./whatsappMessage.socket')[_0x4f2b('0x18')](socket);var jayson=require(_0x4f2b('0x19'));var client=jayson[_0x4f2b('0x1a')][_0x4f2b('0x1b')]({'port':0x232c});var client9002=jayson['client'][_0x4f2b('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x15d8eb,_0x41fdce,_0xac0537,_0x17562){return new BPromise(function(_0x140fdc,_0x1129f5){var _0x11a6f1=_0x17562||client;return _0x11a6f1[_0x4f2b('0x1c')](_0x15d8eb,_0xac0537)[_0x4f2b('0x1d')](function(_0x1b7d27){logger[_0x4f2b('0x1e')](_0x4f2b('0x1f'),_0x41fdce,_0x4f2b('0x20'));logger[_0x4f2b('0x21')](_0x4f2b('0x22'),_0x41fdce,_0x4f2b('0x20'),JSON[_0x4f2b('0x23')](_0x1b7d27));if(_0x1b7d27['error']){if(_0x1b7d27['error']['code']===0x1f4){logger[_0x4f2b('0x24')]('WhatsappMessage,\x20%s,\x20%s',_0x41fdce,_0x1b7d27[_0x4f2b('0x24')][_0x4f2b('0x25')]);return _0x1129f5(_0x1b7d27['error'][_0x4f2b('0x25')]);}logger['error'](_0x4f2b('0x1f'),_0x41fdce,_0x1b7d27[_0x4f2b('0x24')]['message']);return _0x140fdc(_0x1b7d27[_0x4f2b('0x24')]['message']);}else{logger[_0x4f2b('0x1e')](_0x4f2b('0x1f'),_0x41fdce,'request\x20sent');_0x140fdc(_0x1b7d27['result'][_0x4f2b('0x25')]);}})[_0x4f2b('0x26')](function(_0x45e212){logger[_0x4f2b('0x24')](_0x4f2b('0x1f'),_0x41fdce,_0x45e212);_0x1129f5(_0x45e212);});});}function respondWithStatusCode(_0x373543,_0x19137c){_0x19137c=_0x19137c||0xcc;return function(_0x5296f2){if(_0x5296f2){return _0x373543[_0x4f2b('0x27')](_0x19137c);}return _0x373543['status'](_0x19137c)['end']();};}function respondWithResult(_0x26c2e3,_0x56160d){_0x56160d=_0x56160d||0xc8;return function(_0x1fbe68){if(_0x1fbe68){return _0x26c2e3[_0x4f2b('0x28')](_0x56160d)[_0x4f2b('0x29')](_0x1fbe68);}};}function respondWithFilteredResult(_0x6df2cb,_0xc91728){return function(_0x4729aa){if(_0x4729aa){var _0x402421=typeof _0xc91728[_0x4f2b('0x2a')]===_0x4f2b('0x2b')&&typeof _0xc91728[_0x4f2b('0x2c')]==='undefined';var _0x107431=_0x4729aa[_0x4f2b('0x2d')];var _0xe803f6=_0x402421?0x0:_0xc91728[_0x4f2b('0x2a')];var _0x5b85f5=_0x402421?_0x4729aa[_0x4f2b('0x2d')]:_0xc91728[_0x4f2b('0x2a')]+_0xc91728[_0x4f2b('0x2c')];var _0x272fdb;if(_0x5b85f5>=_0x107431){_0x5b85f5=_0x107431;_0x272fdb=0xc8;}else{_0x272fdb=0xce;}_0x6df2cb[_0x4f2b('0x28')](_0x272fdb);return _0x6df2cb['set'](_0x4f2b('0x2e'),_0xe803f6+'-'+_0x5b85f5+'/'+_0x107431)[_0x4f2b('0x29')](_0x4729aa);}return null;};}function patchUpdates(_0x2ee2a3){return function(_0x4a03ee){try{jsonpatch[_0x4f2b('0x2f')](_0x4a03ee,_0x2ee2a3,!![]);}catch(_0x3a2113){return BPromise[_0x4f2b('0x30')](_0x3a2113);}return _0x4a03ee[_0x4f2b('0x31')]();};}function saveUpdates(_0x24b47c,_0xa34a7b){return function(_0x12c98b){if(_0x12c98b){return _0x12c98b['update'](_0x24b47c)[_0x4f2b('0x1d')](function(_0xe8be2e){return _0xe8be2e;});}return null;};}function removeEntity(_0x1ff0fe,_0x2b3a8c){return function(_0x1d3205){if(_0x1d3205){return _0x1d3205[_0x4f2b('0x32')]()[_0x4f2b('0x1d')](function(){_0x1ff0fe[_0x4f2b('0x28')](0xcc)[_0x4f2b('0x33')]();});}};}function handleEntityNotFound(_0x3bf23d,_0x8fb1e6){return function(_0x274290){if(!_0x274290){_0x3bf23d[_0x4f2b('0x27')](0x194);}return _0x274290;};}function handleError(_0xf63066,_0x5027d4){_0x5027d4=_0x5027d4||0x1f4;return function(_0x3f9326){logger['error'](_0x3f9326[_0x4f2b('0x34')]);if(_0x3f9326[_0x4f2b('0x35')]){delete _0x3f9326['name'];}_0xf63066[_0x4f2b('0x28')](_0x5027d4)['send'](_0x3f9326);};}exports[_0x4f2b('0x36')]=function(_0x3a0d41,_0x5e67b5){var _0x3ec8a2={},_0x71f13f={},_0xc0b964={'count':0x0,'rows':[]};var _0x4d8f38=_[_0x4f2b('0x37')](db[_0x4f2b('0x38')][_0x4f2b('0x39')],function(_0x1ebaf7){return{'name':_0x1ebaf7[_0x4f2b('0x3a')],'type':_0x1ebaf7[_0x4f2b('0x3b')]['key']};});_0x71f13f[_0x4f2b('0x3c')]=_[_0x4f2b('0x37')](_0x4d8f38,_0x4f2b('0x35'));_0x71f13f[_0x4f2b('0x3d')]=_[_0x4f2b('0x3e')](_0x3a0d41[_0x4f2b('0x3d')]);_0x71f13f[_0x4f2b('0x3f')]=_[_0x4f2b('0x40')](_0x71f13f[_0x4f2b('0x3c')],_0x71f13f[_0x4f2b('0x3d')]);_0x3ec8a2['attributes']=_[_0x4f2b('0x40')](_0x71f13f[_0x4f2b('0x3c')],qs[_0x4f2b('0x41')](_0x3a0d41[_0x4f2b('0x3d')]['fields']));_0x3ec8a2['attributes']=_0x3ec8a2['attributes']['length']?_0x3ec8a2[_0x4f2b('0x42')]:_0x71f13f[_0x4f2b('0x3c')];if(!_0x3a0d41[_0x4f2b('0x3d')][_0x4f2b('0x43')](_0x4f2b('0x44'))){_0x3ec8a2[_0x4f2b('0x2c')]=qs[_0x4f2b('0x2c')](_0x3a0d41[_0x4f2b('0x3d')][_0x4f2b('0x2c')]);_0x3ec8a2[_0x4f2b('0x2a')]=qs['offset'](_0x3a0d41[_0x4f2b('0x3d')][_0x4f2b('0x2a')]);}_0x3ec8a2[_0x4f2b('0x45')]=qs[_0x4f2b('0x46')](_0x3a0d41[_0x4f2b('0x3d')]['sort']);_0x3ec8a2[_0x4f2b('0x47')]=qs['filters'](_[_0x4f2b('0x48')](_0x3a0d41[_0x4f2b('0x3d')],_0x71f13f[_0x4f2b('0x3f')]),_0x4d8f38);if(_0x3a0d41[_0x4f2b('0x3d')][_0x4f2b('0x49')]){_0x3ec8a2[_0x4f2b('0x47')]=_[_0x4f2b('0x4a')](_0x3ec8a2[_0x4f2b('0x47')],{'$or':_[_0x4f2b('0x37')](_0x4d8f38,function(_0xb6b43d){if(_0xb6b43d[_0x4f2b('0x3b')]!==_0x4f2b('0x4b')){var _0x2879a4={};_0x2879a4[_0xb6b43d[_0x4f2b('0x35')]]={'$like':'%'+_0x3a0d41[_0x4f2b('0x3d')][_0x4f2b('0x49')]+'%'};return _0x2879a4;}})});}_0x3ec8a2=_[_0x4f2b('0x4a')]({},_0x3ec8a2,_0x3a0d41[_0x4f2b('0x4c')]);var _0x165d13={'where':_0x3ec8a2['where']};return db[_0x4f2b('0x38')][_0x4f2b('0x2d')](_0x165d13)[_0x4f2b('0x1d')](function(_0x16b169){_0xc0b964[_0x4f2b('0x2d')]=_0x16b169;if(_0x3a0d41[_0x4f2b('0x3d')][_0x4f2b('0x4d')]){_0x3ec8a2[_0x4f2b('0x4e')]=[{'all':!![]}];}return db[_0x4f2b('0x38')][_0x4f2b('0x4f')](_0x3ec8a2);})[_0x4f2b('0x1d')](function(_0x240a79){_0xc0b964[_0x4f2b('0x50')]=_0x240a79;return _0xc0b964;})['then'](respondWithFilteredResult(_0x5e67b5,_0x3ec8a2))[_0x4f2b('0x26')](handleError(_0x5e67b5,null));};exports[_0x4f2b('0x51')]=function(_0x416ca4,_0x1e287f){var _0x2409fa={'raw':!![],'where':{'id':_0x416ca4[_0x4f2b('0x52')]['id']}},_0x204ddf={};_0x204ddf[_0x4f2b('0x3c')]=_['keys'](db['WhatsappMessage'][_0x4f2b('0x39')]);_0x204ddf[_0x4f2b('0x3d')]=_[_0x4f2b('0x3e')](_0x416ca4[_0x4f2b('0x3d')]);_0x204ddf[_0x4f2b('0x3f')]=_['intersection'](_0x204ddf['model'],_0x204ddf[_0x4f2b('0x3d')]);_0x2409fa[_0x4f2b('0x42')]=_[_0x4f2b('0x40')](_0x204ddf[_0x4f2b('0x3c')],qs[_0x4f2b('0x41')](_0x416ca4[_0x4f2b('0x3d')][_0x4f2b('0x41')]));_0x2409fa['attributes']=_0x2409fa[_0x4f2b('0x42')]['length']?_0x2409fa['attributes']:_0x204ddf['model'];if(_0x416ca4[_0x4f2b('0x3d')][_0x4f2b('0x4d')]){_0x2409fa['include']=[{'all':!![]}];}_0x2409fa=_[_0x4f2b('0x4a')]({},_0x2409fa,_0x416ca4[_0x4f2b('0x4c')]);return db[_0x4f2b('0x38')][_0x4f2b('0x53')](_0x2409fa)[_0x4f2b('0x1d')](handleEntityNotFound(_0x1e287f,null))[_0x4f2b('0x1d')](respondWithResult(_0x1e287f,null))['catch'](handleError(_0x1e287f,null));};exports[_0x4f2b('0x54')]=function(_0x5a383f,_0x573f14){return db[_0x4f2b('0x38')][_0x4f2b('0x54')](_0x5a383f['body'],{})[_0x4f2b('0x1d')](respondWithResult(_0x573f14,0xc9))['catch'](handleError(_0x573f14,null));};exports[_0x4f2b('0x55')]=function(_0x276624,_0x252ecb){if(_0x276624['body']['id']){delete _0x276624[_0x4f2b('0x56')]['id'];}return db[_0x4f2b('0x38')][_0x4f2b('0x53')]({'where':{'id':_0x276624[_0x4f2b('0x52')]['id']}})[_0x4f2b('0x1d')](handleEntityNotFound(_0x252ecb,null))[_0x4f2b('0x1d')](saveUpdates(_0x276624[_0x4f2b('0x56')],null))[_0x4f2b('0x1d')](respondWithResult(_0x252ecb,null))[_0x4f2b('0x26')](handleError(_0x252ecb,null));};exports[_0x4f2b('0x32')]=function(_0x54f44d,_0x2fc91c){return db[_0x4f2b('0x38')][_0x4f2b('0x53')]({'where':{'id':_0x54f44d[_0x4f2b('0x52')]['id']}})[_0x4f2b('0x1d')](handleEntityNotFound(_0x2fc91c,null))[_0x4f2b('0x1d')](removeEntity(_0x2fc91c,null))[_0x4f2b('0x26')](handleError(_0x2fc91c,null));};exports['describe']=function(_0x41a959,_0x27a7c5){return db['WhatsappMessage']['describe']()[_0x4f2b('0x1d')](respondWithResult(_0x27a7c5,null))[_0x4f2b('0x26')](handleError(_0x27a7c5,null));};var interaction_log=require(_0x4f2b('0x12'))(_0x4f2b('0x57'));exports[_0x4f2b('0x58')]=function(_0x2fe612,_0x554053,_0x464fdc){var _0x3469b4={'agent':{},'channel':_0x4f2b('0x59')};if(_0x2fe612[_0x4f2b('0x56')]['id']){delete _0x2fe612[_0x4f2b('0x56')]['id'];}_0x2fe612[_0x4f2b('0x56')][_0x4f2b('0x5a')]=!![];_0x2fe612[_0x4f2b('0x56')][_0x4f2b('0x5b')]=moment()[_0x4f2b('0x5c')](_0x4f2b('0x5d'));_0x2fe612[_0x4f2b('0x56')][_0x4f2b('0x5e')]=_0x2fe612[_0x4f2b('0x56')][_0x4f2b('0x5e')]||_0x2fe612[_0x4f2b('0x5f')]['id'];_0x3469b4['agent']['id']=_0x2fe612[_0x4f2b('0x56')][_0x4f2b('0x5e')];return db[_0x4f2b('0x38')][_0x4f2b('0x53')]({'where':{'id':_0x2fe612[_0x4f2b('0x52')]['id'],'UserId':null}})[_0x4f2b('0x1d')](handleEntityNotFound(_0x554053,null))[_0x4f2b('0x1d')](saveUpdates(_0x2fe612[_0x4f2b('0x56')],null))[_0x4f2b('0x1d')](function(_0x49db3){if(_0x49db3){_0x3469b4[_0x4f2b('0x25')]=_0x49db3[_0x4f2b('0x60')]({'plain':!![]});return db[_0x4f2b('0x61')]['find']({'where':{'id':_0x49db3['WhatsappInteractionId']}});}return null;})[_0x4f2b('0x1d')](handleEntityNotFound(_0x554053,null))[_0x4f2b('0x1d')](function(_0x5b0f28){if(_0x5b0f28){return _0x5b0f28[_0x4f2b('0x55')]({'UserId':_0x2fe612[_0x4f2b('0x56')][_0x4f2b('0x5e')],'read1stAt':_[_0x4f2b('0x62')](_0x5b0f28[_0x4f2b('0x63')])?moment()[_0x4f2b('0x5c')](_0x4f2b('0x5d')):undefined});}return null;})[_0x4f2b('0x1d')](function(_0x1dbf9f){if(_0x1dbf9f){_0x3469b4[_0x4f2b('0x64')]=_0x1dbf9f[_0x4f2b('0x60')]({'plain':!![]});interaction_log[_0x4f2b('0x1e')]('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2fe612[_0x4f2b('0x5f')]['id'],_0x2fe612[_0x4f2b('0x5f')][_0x4f2b('0x35')],_0x2fe612[_0x4f2b('0x5f')][_0x4f2b('0x65')],_0x3469b4[_0x4f2b('0x64')]['id'],_0x2fe612['body']?JSON[_0x4f2b('0x23')](_0x2fe612['body']):_0x4f2b('0x66'));return respondWithRpcPromise('AcceptMessage',_0x4f2b('0x67'),_0x3469b4);}return null;})[_0x4f2b('0x1d')](function(_0x292c2d){var _0x2ad24d=_0x4f2b('0x68')+_0x292c2d[_0x4f2b('0x25')]['ContactId'];return db[_0x4f2b('0x69')][_0x4f2b('0x3d')](_0x2ad24d,{'type':db[_0x4f2b('0x6a')][_0x4f2b('0x6b')][_0x4f2b('0x6c')],'raw':!![]})['then'](function(_0x582c7c){return _0x582c7c;});})[_0x4f2b('0x1d')](function(_0x24d628){if(_0x24d628){_0x3469b4[_0x4f2b('0x25')][_0x4f2b('0x6d')]=_0x24d628[0x0];if(!_0x2fe612[_0x4f2b('0x56')][_0x4f2b('0x5e')])return;return db[_0x4f2b('0x6e')][_0x4f2b('0x53')]({'where':{'id':_0x2fe612['body'][_0x4f2b('0x5e')],'role':_0x4f2b('0x6f')},'attributes':['id','name',_0x4f2b('0x70'),_0x4f2b('0x71'),_0x4f2b('0x72')],'raw':!![]});}return null;})[_0x4f2b('0x1d')](function(_0x127a29){if(!_0x127a29)return null;_0x3469b4[_0x4f2b('0x25')][_0x4f2b('0x6f')]=_0x127a29;return _0x3469b4;})[_0x4f2b('0x1d')](function(_0x539c2c){if(_0x539c2c){if(_0x2fe612[_0x4f2b('0x56')][_0x4f2b('0x73')]){_0x3469b4[_0x4f2b('0x25')][_0x4f2b('0x74')]=util[_0x4f2b('0x5c')]('SIP/%s',_0x2fe612[_0x4f2b('0x5f')][_0x4f2b('0x35')]);_0x3469b4[_0x4f2b('0x25')][_0x4f2b('0x75')]=_0x3469b4[_0x4f2b('0x75')];_0x3469b4[_0x4f2b('0x25')]['motionChannel']=_0x3469b4[_0x4f2b('0x75')];_0x3469b4[_0x4f2b('0x25')][_0x4f2b('0x76')]=_0x4f2b('0x58');return respondWithRpcPromise(_0x4f2b('0x77'),_0x4f2b('0x77'),{'event':_0x4f2b('0x78'),'message':_0x3469b4[_0x4f2b('0x25')]},client9002)[_0x4f2b('0x1d')](function(){return _0x3469b4;});}return _0x3469b4;}return null;})[_0x4f2b('0x1d')](respondWithResult(_0x554053,null))['catch'](handleError(_0x554053,null));};var interaction_log=require(_0x4f2b('0x12'))(_0x4f2b('0x57'));exports[_0x4f2b('0x30')]=function(_0x3f73ef,_0x261ce9,_0x26a7a1){var _0x4b9789={'agent':{},'channel':_0x4f2b('0x59')};if(_0x3f73ef[_0x4f2b('0x56')]['id']){delete _0x3f73ef[_0x4f2b('0x56')]['id'];}_0x3f73ef[_0x4f2b('0x56')][_0x4f2b('0x5e')]=_0x3f73ef['body'][_0x4f2b('0x5e')]||_0x3f73ef['user']['id'];_0x4b9789[_0x4f2b('0x6f')]['id']=_0x3f73ef[_0x4f2b('0x56')][_0x4f2b('0x5e')];return db[_0x4f2b('0x38')][_0x4f2b('0x53')]({'where':{'id':_0x3f73ef['params']['id'],'UserId':null}})[_0x4f2b('0x1d')](handleEntityNotFound(_0x261ce9,null))[_0x4f2b('0x1d')](function(_0x2d2d14){if(_0x2d2d14){_0x4b9789[_0x4f2b('0x25')]=_0x2d2d14[_0x4f2b('0x60')]({'plain':!![]});return db['WhatsappInteraction']['find']({'where':{'id':_0x2d2d14[_0x4f2b('0x79')]}});}return null;})[_0x4f2b('0x1d')](handleEntityNotFound(_0x261ce9,null))[_0x4f2b('0x1d')](function(_0x32e549){if(_0x32e549){_0x4b9789[_0x4f2b('0x64')]=_0x32e549[_0x4f2b('0x60')]({'plain':!![]});interaction_log[_0x4f2b('0x1e')]('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3f73ef[_0x4f2b('0x5f')]['id'],_0x3f73ef[_0x4f2b('0x5f')][_0x4f2b('0x35')],_0x3f73ef[_0x4f2b('0x5f')][_0x4f2b('0x65')],_0x4b9789[_0x4f2b('0x64')]['id'],_0x3f73ef[_0x4f2b('0x56')]?JSON[_0x4f2b('0x23')](_0x3f73ef[_0x4f2b('0x56')]):_0x4f2b('0x66'));return respondWithRpcPromise(_0x4f2b('0x7a'),_0x4f2b('0x7b'),_0x4b9789);}return null;})[_0x4f2b('0x1d')](function(_0x341c61){var _0x31c763=_0x4f2b('0x68')+_0x341c61[_0x4f2b('0x25')][_0x4f2b('0x7c')];return db[_0x4f2b('0x69')][_0x4f2b('0x3d')](_0x31c763,{'type':db[_0x4f2b('0x6a')]['QueryTypes'][_0x4f2b('0x6c')],'raw':!![]})['then'](function(_0x261a80){return _0x261a80;});})[_0x4f2b('0x1d')](function(_0x215693){if(_0x215693){_0x4b9789[_0x4f2b('0x25')]['contact']=_0x215693[0x0];if(!_0x3f73ef[_0x4f2b('0x56')]['UserId'])return;return db[_0x4f2b('0x6e')][_0x4f2b('0x53')]({'where':{'id':_0x3f73ef[_0x4f2b('0x56')][_0x4f2b('0x5e')],'role':_0x4f2b('0x6f')},'attributes':['id','name',_0x4f2b('0x70'),'email',_0x4f2b('0x72')],'raw':!![]});}return null;})[_0x4f2b('0x1d')](function(_0x5ce09e){if(!_0x5ce09e)return null;_0x4b9789['message'][_0x4f2b('0x6f')]=_0x5ce09e;return _0x4b9789;})[_0x4f2b('0x1d')](function(_0x5c1478){if(_0x5c1478){_0x5c1478[_0x4f2b('0x25')][_0x4f2b('0x74')]=util[_0x4f2b('0x5c')](_0x4f2b('0x7d'),_0x3f73ef[_0x4f2b('0x5f')][_0x4f2b('0x35')]);_0x5c1478[_0x4f2b('0x25')]['channel']=_0x4b9789['channel'];_0x5c1478[_0x4f2b('0x25')]['motionChannel']=_0x4b9789[_0x4f2b('0x75')];_0x5c1478[_0x4f2b('0x25')][_0x4f2b('0x76')]=_0x4f2b('0x30');respondWithRpcPromise('EventManager','EventManager',{'event':_0x4f2b('0x7e'),'message':_0x5c1478[_0x4f2b('0x25')]},client9002);return _0x4b9789;}return null;})[_0x4f2b('0x1d')](respondWithResult(_0x261ce9,null))[_0x4f2b('0x26')](handleError(_0x261ce9,null));};exports['status']=function(_0x262ddb,_0xebb9a4,_0x368a13){if(_0x262ddb['body']['id']){delete _0x262ddb['body']['id'];}var _0x477914;return db[_0x4f2b('0x38')][_0x4f2b('0x53')]({'where':{'id':_0x262ddb[_0x4f2b('0x52')]['id']}})[_0x4f2b('0x1d')](handleEntityNotFound(_0xebb9a4,null))[_0x4f2b('0x1d')](function(_0x5a84f2){if(_0x5a84f2){_0x477914=_0x5a84f2;return db['WhatsappAccount'][_0x4f2b('0x53')]({'where':{'id':_0x5a84f2['WhatsappAccountId']}});}})[_0x4f2b('0x1d')](handleEntityNotFound(_0xebb9a4,null))['then'](function(_0x4ce851){if(_0x4ce851){logger['debug'](_0x4f2b('0x7f'),'status',_0x4f2b('0x80'),_0x4ce851['type'],util[_0x4f2b('0x81')](_0x262ddb[_0x4f2b('0x56')],{'showHidden':![],'depth':null}));switch(_0x4ce851[_0x4f2b('0x3b')]){case _0x4f2b('0x82'):if(_0x262ddb['body'][_0x4f2b('0x83')]&&_0x262ddb[_0x4f2b('0x56')]['MessageSid']===_0x477914[_0x4f2b('0x84')]&&_0x262ddb[_0x4f2b('0x56')][_0x4f2b('0x85')]&&_0x262ddb[_0x4f2b('0x56')][_0x4f2b('0x85')]===_0x4f2b('0x5a')){return _0x477914['update']({'read':!![]});}else{logger[_0x4f2b('0x24')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x4f2b('0x28'),_0x4f2b('0x82'),util[_0x4f2b('0x81')](_0x262ddb[_0x4f2b('0x56')],{'showHidden':![],'depth':null}));}break;}return _0x477914;}})[_0x4f2b('0x1d')](respondWithResult(_0xebb9a4,null))['catch'](handleError(_0xebb9a4,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index b38037e..0cbda55 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 _0x1c7c=['update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners'];(function(_0x4fa40c,_0x3785cd){var _0x4a7091=function(_0x393783){while(--_0x393783){_0x4fa40c['push'](_0x4fa40c['shift']());}};_0x4a7091(++_0x3785cd);}(_0x1c7c,0x164));var _0xc1c7=function(_0x360501,_0x4dbd8d){_0x360501=_0x360501-0x0;var _0x1719ad=_0x1c7c[_0x360501];return _0x1719ad;};'use strict';var EventEmitter=require(_0xc1c7('0x0'));var WhatsappMessage=require(_0xc1c7('0x1'))['db'][_0xc1c7('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xc1c7('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc1c7('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3cb551){return function(_0x20dad3,_0xbb9da0,_0x2a0383){WhatsappMessageEvents[_0xc1c7('0x5')](_0x3cb551+':'+_0x20dad3['id'],_0x20dad3);WhatsappMessageEvents[_0xc1c7('0x5')](_0x3cb551,_0x20dad3);_0x2a0383(null);};}for(var e in events){if(events[_0xc1c7('0x6')](e)){var event=events[e];WhatsappMessage[_0xc1c7('0x7')](e,emitEvent(event));}}module[_0xc1c7('0x8')]=WhatsappMessageEvents; \ No newline at end of file +var _0xcecc=['update','remove','emit','hasOwnProperty','hook','exports','events','WhatsappMessage'];(function(_0x2bb5a8,_0x2d3f5e){var _0x3bf03c=function(_0x519608){while(--_0x519608){_0x2bb5a8['push'](_0x2bb5a8['shift']());}};_0x3bf03c(++_0x2d3f5e);}(_0xcecc,0x186));var _0xccec=function(_0x4286a7,_0x4de86b){_0x4286a7=_0x4286a7-0x0;var _0x22f32f=_0xcecc[_0x4286a7];return _0x22f32f;};'use strict';var EventEmitter=require(_0xccec('0x0'));var WhatsappMessage=require('../../mysqldb')['db'][_0xccec('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xccec('0x2'),'afterDestroy':_0xccec('0x3')};function emitEvent(_0x338b16){return function(_0xa10c6f,_0x4b1996,_0x4b0fb9){WhatsappMessageEvents[_0xccec('0x4')](_0x338b16+':'+_0xa10c6f['id'],_0xa10c6f);WhatsappMessageEvents['emit'](_0x338b16,_0xa10c6f);_0x4b0fb9(null);};}for(var e in events){if(events[_0xccec('0x5')](e)){var event=events[e];WhatsappMessage[_0xccec('0x6')](e,emitEvent(event));}}module[_0xccec('0x7')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index e678c5b..8e2e66a 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 _0x8834=['fti_whatsapp_messages','body','FULLTEXT','models','get','direction','out','secret','isNil','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','then','error','WhatsappAccount','find','WhatsappAccountId','twilio','phone','accountSid','authToken','create','whatsapp:','remote','/status?token=','token','sid','update','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','baseUrl','/messages/','text','POST','Bearer\x20','application/json','statuses','message_id','err','WhatsappMessage,\x20%s','utf8mb4','lodash','util','../../config/logger','api','moment','node-fetch','path','rimraf','./whatsappMessage.attributes','exports','WhatsappMessage','whatsapp_messages','messageId'];(function(_0x416468,_0x2e7a72){var _0x2ee9b7=function(_0xf354ce){while(--_0xf354ce){_0x416468['push'](_0x416468['shift']());}};_0x2ee9b7(++_0x2e7a72);}(_0x8834,0x9b));var _0x4883=function(_0x5bbb06,_0xad79e2){_0x5bbb06=_0x5bbb06-0x0;var _0x24a210=_0x8834[_0x5bbb06];return _0x24a210;};'use strict';var _=require(_0x4883('0x0'));var util=require(_0x4883('0x1'));var logger=require(_0x4883('0x2'))(_0x4883('0x3'));var moment=require(_0x4883('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fetch=require(_0x4883('0x5'));var fs=require('fs');var path=require(_0x4883('0x6'));var rimraf=require(_0x4883('0x7'));var config=require('../../config/environment');var attributes=require(_0x4883('0x8'));module[_0x4883('0x9')]=function(_0x288559,_0x20aee1){return _0x288559['define'](_0x4883('0xa'),attributes,{'tableName':_0x4883('0xb'),'paranoid':![],'indexes':[{'name':_0x4883('0xc'),'fields':[_0x4883('0xc')]},{'name':_0x4883('0xd'),'fields':[_0x4883('0xe')],'type':_0x4883('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4968aa,_0x493854,_0x2d7b40){var _0x3762a0=_0x288559[_0x4883('0x10')];var _0x57fd00=_0x4968aa[_0x4883('0x11')]({'plain':!![]});if(_0x57fd00[_0x4883('0x12')]['toLowerCase']()==='in'||_0x57fd00[_0x4883('0x12')]['toLowerCase']()===_0x4883('0x13')&&!_0x57fd00[_0x4883('0x14')]&&!_[_0x4883('0x15')](_0x57fd00[_0x4883('0x16')])){_0x3762a0[_0x4883('0x17')][_0x4883('0x18')]({'where':{'id':_0x57fd00[_0x4883('0x19')]}})[_0x4883('0x1a')](function(_0x173e61){if(_0x173e61){_0x173e61['update']({'lastMsgAt':_0x57fd00['createdAt'],'lastMsgDirection':_0x57fd00[_0x4883('0x12')]['toLowerCase']()});}})['catch'](function(_0x38e9fd){console[_0x4883('0x1b')](_0x38e9fd);});}if(_0x57fd00[_0x4883('0x12')]===_0x4883('0x13')&&!_0x57fd00['secret']){var _0x4b62cf;_0x3762a0[_0x4883('0x1c')][_0x4883('0x1d')]({'where':{'id':_0x57fd00[_0x4883('0x1e')]},'raw':!![]})[_0x4883('0x1a')](function(_0x12b974){_0x4b62cf=_0x12b974;if(_0x4b62cf&&_0x4b62cf['type']){switch(_0x4b62cf['type']){case _0x4883('0x1f'):var _0x4ae089=require(_0x4883('0x1f'));if(_0x4b62cf['accountSid']&&_0x4b62cf['authToken']&&_0x4b62cf[_0x4883('0x20')]){var _0xdbe890=new _0x4ae089(_0x4b62cf[_0x4883('0x21')],_0x4b62cf[_0x4883('0x22')]);_0xdbe890['messages'][_0x4883('0x23')]({'body':_0x57fd00[_0x4883('0xe')],'to':_0x4883('0x24')+_0x57fd00[_0x4883('0x20')],'from':'whatsapp:'+_0x4b62cf[_0x4883('0x20')],'statusCallback':_0x4b62cf[_0x4883('0x25')]+'/api/whatsapp/messages/'+_0x57fd00['id']+_0x4883('0x26')+_0x4b62cf[_0x4883('0x27')]})[_0x4883('0x1a')](function(_0x3fce3e){if(_0x3fce3e[_0x4883('0x28')]){return _0x4968aa[_0x4883('0x29')]({'messageId':_0x3fce3e['sid']});}})['catch'](function(_0x566ca2){logger[_0x4883('0x1b')](_0x4883('0x2a'),_0x4883('0x2b'),'twilio',util[_0x4883('0x2c')](_0x566ca2,{'showHidden':![],'depth':null}));});}else{logger[_0x4883('0x1b')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x4883('0x2b'),_0x4883('0x1f'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case'sinch':var _0x494278=_0x4b62cf['accountSid'];var _0xc0bf5b=_0x4b62cf['authToken'];var _0x3af640=_0x4b62cf[_0x4883('0x2d')]+'/whatsapp/v1/'+_0x494278+_0x4883('0x2e');var _0x2e36b3={'to':[_0x57fd00['phone']],'message':{'type':_0x4883('0x2f'),'text':_0x57fd00[_0x4883('0xe')]}};var _0x517ea9={'method':_0x4883('0x30'),'uri':_0x3af640,'headers':{'Authorization':_0x4883('0x31')+_0xc0bf5b,'Content-Type':_0x4883('0x32')},'body':_0x2e36b3,'json':!![]};rp(_0x517ea9)['then'](function(_0x28d182){if(_0x28d182[_0x4883('0x33')][0x0][_0x4883('0x34')]){return _0x4968aa[_0x4883('0x29')]({'messageId':_0x28d182['statuses'][0x0]['message_id']});}})['catch'](function(_0x3db897){logger[_0x4883('0x35')](_0x4883('0x36'),_0x3db897);});break;}}})['finally'](function(){_0x2d7b40();});}else{_0x2d7b40();}}},'charset':_0x4883('0x37'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xb17f=['type','twilio','accountSid','authToken','phone','messages','create','whatsapp:','remote','/api/whatsapp/messages/','token','update','sid','catch','error','WhatsappMessage,\x20%s,\x20%s,\x20%s','inspect','sinch','baseUrl','/whatsapp/v1/','/messages/','body','POST','Bearer\x20','application/json','message_id','err','WhatsappMessage,\x20%s','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','WhatsappMessage','whatsapp_messages','messageId','models','get','direction','toLowerCase','out','secret','isNil','UserId','WhatsappInteraction','createdAt','find','WhatsappAccountId','then'];(function(_0x2a254f,_0x1e810f){var _0x44ae5c=function(_0x176239){while(--_0x176239){_0x2a254f['push'](_0x2a254f['shift']());}};_0x44ae5c(++_0x1e810f);}(_0xb17f,0x1ae));var _0xfb17=function(_0x2c5a9b,_0x4151bd){_0x2c5a9b=_0x2c5a9b-0x0;var _0x34511e=_0xb17f[_0x2c5a9b];return _0x34511e;};'use strict';var _=require(_0xfb17('0x0'));var util=require(_0xfb17('0x1'));var logger=require(_0xfb17('0x2'))('api');var moment=require(_0xfb17('0x3'));var BPromise=require('bluebird');var rp=require(_0xfb17('0x4'));var fetch=require('node-fetch');var fs=require('fs');var path=require(_0xfb17('0x5'));var rimraf=require(_0xfb17('0x6'));var config=require(_0xfb17('0x7'));var attributes=require(_0xfb17('0x8'));module[_0xfb17('0x9')]=function(_0x18fff9,_0x22f7d4){return _0x18fff9['define'](_0xfb17('0xa'),attributes,{'tableName':_0xfb17('0xb'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0xfb17('0xc')]},{'name':'fti_whatsapp_messages','fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0xf71b8b,_0xfe5000,_0x3b06cd){var _0xb75f2=_0x18fff9[_0xfb17('0xd')];var _0xfb44cc=_0xf71b8b[_0xfb17('0xe')]({'plain':!![]});if(_0xfb44cc[_0xfb17('0xf')]['toLowerCase']()==='in'||_0xfb44cc[_0xfb17('0xf')][_0xfb17('0x10')]()===_0xfb17('0x11')&&!_0xfb44cc[_0xfb17('0x12')]&&!_[_0xfb17('0x13')](_0xfb44cc[_0xfb17('0x14')])){_0xb75f2[_0xfb17('0x15')]['findOne']({'where':{'id':_0xfb44cc['WhatsappInteractionId']}})['then'](function(_0xdfa61){if(_0xdfa61){_0xdfa61['update']({'lastMsgAt':_0xfb44cc[_0xfb17('0x16')],'lastMsgDirection':_0xfb44cc['direction'][_0xfb17('0x10')]()});}})['catch'](function(_0x5420a0){console['error'](_0x5420a0);});}if(_0xfb44cc[_0xfb17('0xf')]==='out'&&!_0xfb44cc[_0xfb17('0x12')]){var _0x3c153f;_0xb75f2['WhatsappAccount'][_0xfb17('0x17')]({'where':{'id':_0xfb44cc[_0xfb17('0x18')]},'raw':!![]})[_0xfb17('0x19')](function(_0x3a402f){_0x3c153f=_0x3a402f;if(_0x3c153f&&_0x3c153f[_0xfb17('0x1a')]){switch(_0x3c153f[_0xfb17('0x1a')]){case _0xfb17('0x1b'):var _0x3187df=require(_0xfb17('0x1b'));if(_0x3c153f[_0xfb17('0x1c')]&&_0x3c153f[_0xfb17('0x1d')]&&_0x3c153f[_0xfb17('0x1e')]){var _0x123af4=new _0x3187df(_0x3c153f[_0xfb17('0x1c')],_0x3c153f['authToken']);_0x123af4[_0xfb17('0x1f')][_0xfb17('0x20')]({'body':_0xfb44cc['body'],'to':_0xfb17('0x21')+_0xfb44cc[_0xfb17('0x1e')],'from':_0xfb17('0x21')+_0x3c153f[_0xfb17('0x1e')],'statusCallback':_0x3c153f[_0xfb17('0x22')]+_0xfb17('0x23')+_0xfb44cc['id']+'/status?token='+_0x3c153f[_0xfb17('0x24')]})[_0xfb17('0x19')](function(_0x2983b3){if(_0x2983b3['sid']){return _0xf71b8b[_0xfb17('0x25')]({'messageId':_0x2983b3[_0xfb17('0x26')]});}})[_0xfb17('0x27')](function(_0x3f7250){logger[_0xfb17('0x28')](_0xfb17('0x29'),'afterCreate',_0xfb17('0x1b'),util[_0xfb17('0x2a')](_0x3f7250,{'showHidden':![],'depth':null}));});}else{logger[_0xfb17('0x28')]('WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xfb17('0x1b'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0xfb17('0x2b'):var _0x1f5719=_0x3c153f[_0xfb17('0x1c')];var _0x318e36=_0x3c153f[_0xfb17('0x1d')];var _0x203f41=_0x3c153f[_0xfb17('0x2c')]+_0xfb17('0x2d')+_0x1f5719+_0xfb17('0x2e');var _0x50bd3c={'to':[_0xfb44cc[_0xfb17('0x1e')]],'message':{'type':'text','text':_0xfb44cc[_0xfb17('0x2f')]}};var _0x24a0dd={'method':_0xfb17('0x30'),'uri':_0x203f41,'headers':{'Authorization':_0xfb17('0x31')+_0x318e36,'Content-Type':_0xfb17('0x32')},'body':_0x50bd3c,'json':!![]};rp(_0x24a0dd)[_0xfb17('0x19')](function(_0x1672ad){if(_0x1672ad['statuses'][0x0][_0xfb17('0x33')]){return _0xf71b8b[_0xfb17('0x25')]({'messageId':_0x1672ad['statuses'][0x0][_0xfb17('0x33')]});}})[_0xfb17('0x27')](function(_0x4e717e){logger[_0xfb17('0x34')](_0xfb17('0x35'),_0x4e717e);});break;}}})[_0xfb17('0x36')](function(){_0x3b06cd();});}else{_0x3b06cd();}}},'charset':_0xfb17('0x37'),'collate':_0xfb17('0x38')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 12a56a5..1c0fd37 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 _0x754f=['catch','WhatsappMessage','create','options','raw','then','CreateWhatsappMessage','lodash','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','request','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x27555f,_0x29c0bf){var _0x3e3c56=function(_0x241a2a){while(--_0x241a2a){_0x27555f['push'](_0x27555f['shift']());}};_0x3e3c56(++_0x29c0bf);}(_0x754f,0xe7));var _0xf754=function(_0x4c0cb9,_0x5870e6){_0x4c0cb9=_0x4c0cb9-0x0;var _0x5517ba=_0x754f[_0x4c0cb9];return _0x5517ba;};'use strict';var _=require(_0xf754('0x0'));var util=require('util');var moment=require(_0xf754('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf754('0x2'));var db=require(_0xf754('0x3'))['db'];var utils=require(_0xf754('0x4'));var logger=require('../../config/logger')(_0xf754('0x5'));var config=require(_0xf754('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xf754('0x7')][_0xf754('0x8')]({'port':0x232a});config[_0xf754('0x9')]=_['defaults'](config[_0xf754('0x9')],{'host':_0xf754('0xa'),'port':0x18eb});var socket=require(_0xf754('0xb'))(new Redis(config[_0xf754('0x9')]));require(_0xf754('0xc'))[_0xf754('0xd')](socket);function respondWithRpcPromise(_0x1b2008,_0x4dfe99,_0x579b2b){return new BPromise(function(_0x5ad137,_0x3f7f5f){return client[_0xf754('0xe')](_0x1b2008,_0x579b2b)['then'](function(_0x324b9c){logger['info'](_0xf754('0xf'),_0x4dfe99,_0xf754('0x10'));logger[_0xf754('0x11')](_0xf754('0x12'),_0x4dfe99,_0xf754('0x10'),JSON[_0xf754('0x13')](_0x324b9c));if(_0x324b9c['error']){if(_0x324b9c[_0xf754('0x14')][_0xf754('0x15')]===0x1f4){logger[_0xf754('0x14')](_0xf754('0xf'),_0x4dfe99,_0x324b9c[_0xf754('0x14')][_0xf754('0x16')]);return _0x3f7f5f(_0x324b9c[_0xf754('0x14')][_0xf754('0x16')]);}logger[_0xf754('0x14')](_0xf754('0xf'),_0x4dfe99,_0x324b9c[_0xf754('0x14')][_0xf754('0x16')]);return _0x5ad137(_0x324b9c[_0xf754('0x14')][_0xf754('0x16')]);}else{logger[_0xf754('0x17')](_0xf754('0xf'),_0x4dfe99,_0xf754('0x10'));_0x5ad137(_0x324b9c[_0xf754('0x18')]['message']);}})[_0xf754('0x19')](function(_0x5f1052){logger[_0xf754('0x14')](_0xf754('0xf'),_0x4dfe99,_0x5f1052);_0x3f7f5f(_0x5f1052);});});}exports['CreateWhatsappMessage']=function(_0x479a47){var _0x171627=this;return new Promise(function(_0x294e98,_0x1d7700){return db[_0xf754('0x1a')][_0xf754('0x1b')](_0x479a47['body'],{'raw':_0x479a47[_0xf754('0x1c')]?_0x479a47[_0xf754('0x1c')][_0xf754('0x1d')]===undefined?!![]:![]:!![]})[_0xf754('0x1e')](function(_0x3ea672){logger[_0xf754('0x17')](_0xf754('0x1f'),_0x479a47);logger[_0xf754('0x11')](_0xf754('0x1f'),_0x479a47,JSON[_0xf754('0x13')](_0x3ea672));_0x294e98(_0x3ea672);})[_0xf754('0x19')](function(_0x34e527){logger['error']('CreateWhatsappMessage',_0x34e527[_0xf754('0x16')],_0x479a47);_0x1d7700(_0x171627[_0xf754('0x14')](0x1f4,_0x34e527[_0xf754('0x16')]));});});}; \ No newline at end of file +var _0xa493=['register','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateWhatsappMessage','create','body','options','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket'];(function(_0x185e02,_0x5bd409){var _0x2d3b52=function(_0x1ca225){while(--_0x1ca225){_0x185e02['push'](_0x185e02['shift']());}};_0x2d3b52(++_0x5bd409);}(_0xa493,0x122));var _0x3a49=function(_0x4fbfd9,_0x3ab91a){_0x4fbfd9=_0x4fbfd9-0x0;var _0x31dc94=_0xa493[_0x4fbfd9];return _0x31dc94;};'use strict';var _=require('lodash');var util=require(_0x3a49('0x0'));var moment=require(_0x3a49('0x1'));var BPromise=require(_0x3a49('0x2'));var rs=require(_0x3a49('0x3'));var fs=require('fs');var Redis=require(_0x3a49('0x4'));var db=require(_0x3a49('0x5'))['db'];var utils=require(_0x3a49('0x6'));var logger=require('../../config/logger')(_0x3a49('0x7'));var config=require(_0x3a49('0x8'));var jayson=require(_0x3a49('0x9'));var client=jayson[_0x3a49('0xa')]['http']({'port':0x232a});config[_0x3a49('0xb')]=_[_0x3a49('0xc')](config[_0x3a49('0xb')],{'host':_0x3a49('0xd'),'port':0x18eb});var socket=require(_0x3a49('0xe'))(new Redis(config[_0x3a49('0xb')]));require(_0x3a49('0xf'))[_0x3a49('0x10')](socket);function respondWithRpcPromise(_0x33cb5f,_0x52aad8,_0x489557){return new BPromise(function(_0x2e3b62,_0x1d7087){return client[_0x3a49('0x11')](_0x33cb5f,_0x489557)[_0x3a49('0x12')](function(_0x1277d5){logger[_0x3a49('0x13')](_0x3a49('0x14'),_0x52aad8,_0x3a49('0x15'));logger[_0x3a49('0x16')](_0x3a49('0x17'),_0x52aad8,_0x3a49('0x15'),JSON[_0x3a49('0x18')](_0x1277d5));if(_0x1277d5[_0x3a49('0x19')]){if(_0x1277d5[_0x3a49('0x19')][_0x3a49('0x1a')]===0x1f4){logger['error'](_0x3a49('0x14'),_0x52aad8,_0x1277d5[_0x3a49('0x19')][_0x3a49('0x1b')]);return _0x1d7087(_0x1277d5[_0x3a49('0x19')][_0x3a49('0x1b')]);}logger[_0x3a49('0x19')]('WhatsappMessage,\x20%s,\x20%s',_0x52aad8,_0x1277d5[_0x3a49('0x19')][_0x3a49('0x1b')]);return _0x2e3b62(_0x1277d5['error'][_0x3a49('0x1b')]);}else{logger[_0x3a49('0x13')]('WhatsappMessage,\x20%s,\x20%s',_0x52aad8,_0x3a49('0x15'));_0x2e3b62(_0x1277d5[_0x3a49('0x1c')][_0x3a49('0x1b')]);}})['catch'](function(_0x3027da){logger[_0x3a49('0x19')](_0x3a49('0x14'),_0x52aad8,_0x3027da);_0x1d7087(_0x3027da);});});}exports[_0x3a49('0x1d')]=function(_0xad1939){var _0x5ec0ac=this;return new Promise(function(_0x2f9ac0,_0x345cf3){return db['WhatsappMessage'][_0x3a49('0x1e')](_0xad1939[_0x3a49('0x1f')],{'raw':_0xad1939[_0x3a49('0x20')]?_0xad1939['options'][_0x3a49('0x21')]===undefined?!![]:![]:!![]})[_0x3a49('0x12')](function(_0x367d0d){logger[_0x3a49('0x13')](_0x3a49('0x1d'),_0xad1939);logger['debug'](_0x3a49('0x1d'),_0xad1939,JSON[_0x3a49('0x18')](_0x367d0d));_0x2f9ac0(_0x367d0d);})['catch'](function(_0x32880c){logger['error'](_0x3a49('0x1d'),_0x32880c['message'],_0xad1939);_0x345cf3(_0x5ec0ac[_0x3a49('0x19')](0x1f4,_0x32880c[_0x3a49('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 435a30a..5f29b10 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 _0x3cbc=['length','whatsappMessage:','save','remove','update','emit','register'];(function(_0x637394,_0x4f11b5){var _0x2b0561=function(_0x44e7fb){while(--_0x44e7fb){_0x637394['push'](_0x637394['shift']());}};_0x2b0561(++_0x4f11b5);}(_0x3cbc,0xa3));var _0xc3cb=function(_0x2cfd43,_0x55e2a9){_0x2cfd43=_0x2cfd43-0x0;var _0x5d61a3=_0x3cbc[_0x2cfd43];return _0x5d61a3;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=[_0xc3cb('0x0'),_0xc3cb('0x1'),_0xc3cb('0x2')];function createListener(_0x3b74b3,_0x3d97fc){return function(_0x38dffe){_0x3d97fc[_0xc3cb('0x3')](_0x3b74b3,_0x38dffe);};}function removeListener(_0x4706aa,_0x57f251){return function(){WhatsappMessageEvents['removeListener'](_0x4706aa,_0x57f251);};}exports[_0xc3cb('0x4')]=function(_0x17cadb){for(var _0x325018=0x0,_0xb6836b=events[_0xc3cb('0x5')];_0x325018<_0xb6836b;_0x325018++){var _0xb54667=events[_0x325018];var _0x22c02f=createListener(_0xc3cb('0x6')+_0xb54667,_0x17cadb);WhatsappMessageEvents['on'](_0xb54667,_0x22c02f);}}; \ No newline at end of file +var _0xc455=['./whatsappMessage.events','remove','update','register','length'];(function(_0x403625,_0x4e5e34){var _0x2a37f1=function(_0x2ac73f){while(--_0x2ac73f){_0x403625['push'](_0x403625['shift']());}};_0x2a37f1(++_0x4e5e34);}(_0xc455,0x96));var _0x5c45=function(_0x31f07a,_0x323903){_0x31f07a=_0x31f07a-0x0;var _0x263ec6=_0xc455[_0x31f07a];return _0x263ec6;};'use strict';var WhatsappMessageEvents=require(_0x5c45('0x0'));var events=['save',_0x5c45('0x1'),_0x5c45('0x2')];function createListener(_0x1e67f3,_0x9eb3c0){return function(_0x2ff771){_0x9eb3c0['emit'](_0x1e67f3,_0x2ff771);};}function removeListener(_0x180297,_0x24dd5b){return function(){WhatsappMessageEvents['removeListener'](_0x180297,_0x24dd5b);};}exports[_0x5c45('0x3')]=function(_0x16694f){for(var _0x49c2ed=0x0,_0xcea600=events[_0x5c45('0x4')];_0x49c2ed<_0xcea600;_0x49c2ed++){var _0x1afd0b=events[_0x49c2ed];var _0x4f8f18=createListener('whatsappMessage:'+_0x1afd0b,_0x16694f);WhatsappMessageEvents['on'](_0x1afd0b,_0x4f8f18);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 7456f4d..5d3c32c 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 _0x78c9=['express','fs-extra','../../components/auth/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','index','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','getAgents','post','create','/:id/users','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports'];(function(_0x5da730,_0x27c81c){var _0x459c62=function(_0x506a8e){while(--_0x506a8e){_0x5da730['push'](_0x5da730['shift']());}};_0x459c62(++_0x27c81c);}(_0x78c9,0x68));var _0x978c=function(_0x5a486b,_0x184646){_0x5a486b=_0x5a486b-0x0;var _0x4b55a9=_0x78c9[_0x5a486b];return _0x4b55a9;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x978c('0x0'));var router=express['Router']();var fs_extra=require(_0x978c('0x1'));var auth=require(_0x978c('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x978c('0x3'));var controller=require(_0x978c('0x4'));router[_0x978c('0x5')]('/',auth[_0x978c('0x6')](),controller[_0x978c('0x7')]);router[_0x978c('0x5')]('/describe',auth[_0x978c('0x6')](),controller['describe']);router[_0x978c('0x5')](_0x978c('0x8'),auth['isAuthenticated'](),controller[_0x978c('0x9')]);router[_0x978c('0x5')](_0x978c('0xa'),auth[_0x978c('0x6')](),controller[_0x978c('0xb')]);router[_0x978c('0x5')](_0x978c('0xc'),auth[_0x978c('0x6')](),controller[_0x978c('0xd')]);router[_0x978c('0x5')]('/:id/users',auth[_0x978c('0x6')](),controller[_0x978c('0xe')]);router[_0x978c('0xf')]('/',auth[_0x978c('0x6')](),controller[_0x978c('0x10')]);router[_0x978c('0xf')](_0x978c('0xc'),auth['isAuthenticated'](),controller['addTeams']);router[_0x978c('0xf')](_0x978c('0x11'),auth['isAuthenticated'](),controller[_0x978c('0x12')]);router[_0x978c('0x13')](_0x978c('0x8'),auth[_0x978c('0x6')](),controller[_0x978c('0x14')]);router[_0x978c('0x15')](_0x978c('0x8'),auth['isAuthenticated'](),controller[_0x978c('0x16')]);router[_0x978c('0x15')]('/:id/teams',auth[_0x978c('0x6')](),controller[_0x978c('0x17')]);router[_0x978c('0x15')](_0x978c('0x11'),auth[_0x978c('0x6')](),controller[_0x978c('0x18')]);module[_0x978c('0x19')]=router; \ No newline at end of file +var _0x9a66=['index','isAuthenticated','describe','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','create','post','addTeams','addAgents','/:id','update','delete','destroy','removeTeams','removeAgents','exports','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x225756,_0x1d9e87){var _0x4ac557=function(_0x5640ca){while(--_0x5640ca){_0x225756['push'](_0x225756['shift']());}};_0x4ac557(++_0x1d9e87);}(_0x9a66,0xfd));var _0x69a6=function(_0x455366,_0x473d19){_0x455366=_0x455366-0x0;var _0x38ae6e=_0x9a66[_0x455366];return _0x38ae6e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x69a6('0x0'));var timeout=require(_0x69a6('0x1'));var express=require(_0x69a6('0x2'));var router=express['Router']();var fs_extra=require(_0x69a6('0x3'));var auth=require(_0x69a6('0x4'));var interaction=require(_0x69a6('0x5'));var config=require(_0x69a6('0x6'));var controller=require('./whatsappQueue.controller');router[_0x69a6('0x7')]('/',auth['isAuthenticated'](),controller[_0x69a6('0x8')]);router['get']('/describe',auth[_0x69a6('0x9')](),controller[_0x69a6('0xa')]);router[_0x69a6('0x7')]('/:id',auth[_0x69a6('0x9')](),controller[_0x69a6('0xb')]);router['get'](_0x69a6('0xc'),auth['isAuthenticated'](),controller[_0x69a6('0xd')]);router[_0x69a6('0x7')](_0x69a6('0xe'),auth[_0x69a6('0x9')](),controller[_0x69a6('0xf')]);router['get'](_0x69a6('0x10'),auth[_0x69a6('0x9')](),controller[_0x69a6('0x11')]);router['post']('/',auth[_0x69a6('0x9')](),controller[_0x69a6('0x12')]);router[_0x69a6('0x13')](_0x69a6('0xe'),auth[_0x69a6('0x9')](),controller[_0x69a6('0x14')]);router[_0x69a6('0x13')](_0x69a6('0x10'),auth['isAuthenticated'](),controller[_0x69a6('0x15')]);router['put'](_0x69a6('0x16'),auth['isAuthenticated'](),controller[_0x69a6('0x17')]);router[_0x69a6('0x18')](_0x69a6('0x16'),auth[_0x69a6('0x9')](),controller[_0x69a6('0x19')]);router[_0x69a6('0x18')](_0x69a6('0xe'),auth['isAuthenticated'](),controller[_0x69a6('0x1a')]);router[_0x69a6('0x18')](_0x69a6('0x10'),auth[_0x69a6('0x9')](),controller[_0x69a6('0x1b')]);module[_0x69a6('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 f2251a6..75206d2 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 _0x9bc3=['ENUM','rrmemory','beepall','sequelize','exports','STRING','INTEGER'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x9bc3,0x137));var _0x39bc=function(_0x103965,_0x1b794e){_0x103965=_0x103965-0x0;var _0x40c90b=_0x9bc3[_0x103965];return _0x40c90b;};'use strict';var Sequelize=require(_0x39bc('0x0'));module[_0x39bc('0x1')]={'name':{'type':Sequelize[_0x39bc('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x39bc('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x39bc('0x4')](_0x39bc('0x5'),_0x39bc('0x6'),'roundrobin')},'description':{'type':Sequelize[_0x39bc('0x2')]}}; \ No newline at end of file +var _0x4a3c=['ENUM','rrmemory','beepall','roundrobin','sequelize','STRING','name','INTEGER'];(function(_0x33f1fe,_0x4ccab4){var _0x4af6cd=function(_0x43a2bd){while(--_0x43a2bd){_0x33f1fe['push'](_0x33f1fe['shift']());}};_0x4af6cd(++_0x4ccab4);}(_0x4a3c,0x13c));var _0xc4a3=function(_0x11733a,_0x70897d){_0x11733a=_0x11733a-0x0;var _0x5db8cd=_0x4a3c[_0x11733a];return _0x5db8cd;};'use strict';var Sequelize=require(_0xc4a3('0x0'));module['exports']={'name':{'type':Sequelize[_0xc4a3('0x1')],'unique':_0xc4a3('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xc4a3('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xc4a3('0x4')](_0xc4a3('0x5'),_0xc4a3('0x6'),_0xc4a3('0x7'))},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index f07d5ab..29411ca 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 _0x4914=['compact','value','transaction','removeTeams','removeAgents','addAgents','omit','spread','userWhatsappQueue:save','isArray','userWhatsappQueue:remove','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappQueue.socket','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','then','destroy','get','WhatsappQueues','UserProfileResource','error','name','send','index','map','WhatsappQueue','rawAttributes','key','getOptions','where','include','findAll','rows','catch','show','params','model','query','keys','filters','intersection','attributes','fields','length','includeAll','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','describe','findOne','UserWhatsappQueue','hasOwnProperty','sort','pick','filter','merge','findAndCountAll','agent','whatsappPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','order','nolimit','ids','Agents','online','voicePause','interface','flatMap','sequelize','addTeams','each','findOrCreate','forEach','emit','User','field','tq.TeamId','from','team_has_whatsapp_queues','join','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','includes','all','union'];(function(_0x15468a,_0x2698b8){var _0x2d8105=function(_0x2ed2b5){while(--_0x2ed2b5){_0x15468a['push'](_0x15468a['shift']());}};_0x2d8105(++_0x2698b8);}(_0x4914,0x189));var _0x4491=function(_0x22f3c9,_0x7800c6){_0x22f3c9=_0x22f3c9-0x0;var _0x51f79d=_0x4914[_0x22f3c9];return _0x51f79d;};'use strict';var BPromise=require(_0x4491('0x0'));var util=require(_0x4491('0x1'));var _=require(_0x4491('0x2'));var squel=require(_0x4491('0x3'));var Redis=require(_0x4491('0x4'));var qs=require(_0x4491('0x5'));var logger=require(_0x4491('0x6'))(_0x4491('0x7'));var config=require(_0x4491('0x8'));var db=require(_0x4491('0x9'))['db'];config[_0x4491('0xa')]=_['defaults'](config[_0x4491('0xa')],{'host':_0x4491('0xb'),'port':0x18eb});var socket=require(_0x4491('0xc'))(new Redis(config[_0x4491('0xa')]));require(_0x4491('0xd'))['register'](socket);function respondWithStatusCode(_0x36cccd,_0x13ef21){_0x13ef21=_0x13ef21||0xcc;return function(_0x453df5){if(_0x453df5){return _0x36cccd[_0x4491('0xe')](_0x13ef21);}return _0x36cccd[_0x4491('0xf')](_0x13ef21)[_0x4491('0x10')]();};}function respondWithResult(_0x29e1fd,_0x138721){_0x138721=_0x138721||0xc8;return function(_0x310ea3){if(_0x310ea3){return _0x29e1fd[_0x4491('0xf')](_0x138721)[_0x4491('0x11')](_0x310ea3);}};}function respondWithFilteredResult(_0x1dba36,_0x16bd1a){return function(_0x53b970){if(_0x53b970){var _0x3c22c3=typeof _0x16bd1a['offset']===_0x4491('0x12')&&typeof _0x16bd1a[_0x4491('0x13')]==='undefined';var _0xb06df2=_0x53b970[_0x4491('0x14')];var _0x410bc6=_0x3c22c3?0x0:_0x16bd1a[_0x4491('0x15')];var _0x952e1e=_0x3c22c3?_0x53b970['count']:_0x16bd1a[_0x4491('0x15')]+_0x16bd1a[_0x4491('0x13')];var _0x17565e;if(_0x952e1e>=_0xb06df2){_0x952e1e=_0xb06df2;_0x17565e=0xc8;}else{_0x17565e=0xce;}_0x1dba36[_0x4491('0xf')](_0x17565e);return _0x1dba36[_0x4491('0x16')](_0x4491('0x17'),_0x410bc6+'-'+_0x952e1e+'/'+_0xb06df2)[_0x4491('0x11')](_0x53b970);}return null;};}function saveUpdates(_0x3e65cd){return function(_0x209edb){if(_0x209edb){return _0x209edb['update'](_0x3e65cd)[_0x4491('0x18')](function(_0x1a58c3){return _0x1a58c3;});}return null;};}function removeEntity(_0x30f916){return function(_0x55b403){if(_0x55b403){return _0x55b403[_0x4491('0x19')]()[_0x4491('0x18')](function(){var _0x4b9c8d=_0x55b403[_0x4491('0x1a')]({'plain':!![]});var _0xd093c1=_0x4491('0x1b');return db[_0x4491('0x1c')][_0x4491('0x19')]({'where':{'type':_0xd093c1,'resourceId':_0x4b9c8d['id']}})[_0x4491('0x18')](function(){return _0x55b403;});})['then'](function(){_0x30f916['status'](0xcc)[_0x4491('0x10')]();});}};}function handleEntityNotFound(_0x180b08){return function(_0x283144){if(!_0x283144){_0x180b08['sendStatus'](0x194);}return _0x283144;};}function handleError(_0x2e6a8d,_0x3c9bb6){_0x3c9bb6=_0x3c9bb6||0x1f4;return function(_0x42a0ae){logger[_0x4491('0x1d')](_0x42a0ae['stack']);if(_0x42a0ae['name']){delete _0x42a0ae[_0x4491('0x1e')];}_0x2e6a8d[_0x4491('0xf')](_0x3c9bb6)[_0x4491('0x1f')](_0x42a0ae);};}exports[_0x4491('0x20')]=function(_0x422e94,_0x341806){var _0x31ee25={};var _0x5ad841={'count':0x0,'rows':[]};var _0x3be547=_[_0x4491('0x21')](db[_0x4491('0x22')][_0x4491('0x23')],function(_0xe562fd){return{'name':_0xe562fd['fieldName'],'type':_0xe562fd['type'][_0x4491('0x24')]};});_0x31ee25=qs[_0x4491('0x25')](_0x3be547,_0x422e94);var _0x3ef860={'where':_0x31ee25[_0x4491('0x26')]};return db[_0x4491('0x22')][_0x4491('0x14')](_0x3ef860)[_0x4491('0x18')](function(_0x356e7e){_0x5ad841[_0x4491('0x14')]=_0x356e7e;_0x31ee25[_0x4491('0x27')]=qs[_0x4491('0x27')](_0x422e94['query']);return db[_0x4491('0x22')][_0x4491('0x28')](_0x31ee25);})['then'](function(_0x298f35){_0x5ad841[_0x4491('0x29')]=_0x298f35;return _0x5ad841;})[_0x4491('0x18')](respondWithFilteredResult(_0x341806,_0x31ee25))[_0x4491('0x2a')](handleError(_0x341806,null));};exports[_0x4491('0x2b')]=function(_0x4969e2,_0x28089d){var _0x124cbb={'raw':!![],'where':{'id':_0x4969e2[_0x4491('0x2c')]['id']}},_0x15f18d={};_0x15f18d[_0x4491('0x2d')]=_['keys'](db[_0x4491('0x22')][_0x4491('0x23')]);_0x15f18d[_0x4491('0x2e')]=_[_0x4491('0x2f')](_0x4969e2['query']);_0x15f18d[_0x4491('0x30')]=_[_0x4491('0x31')](_0x15f18d[_0x4491('0x2d')],_0x15f18d[_0x4491('0x2e')]);_0x124cbb[_0x4491('0x32')]=_[_0x4491('0x31')](_0x15f18d['model'],qs['fields'](_0x4969e2['query'][_0x4491('0x33')]));_0x124cbb[_0x4491('0x32')]=_0x124cbb[_0x4491('0x32')][_0x4491('0x34')]?_0x124cbb[_0x4491('0x32')]:_0x15f18d[_0x4491('0x2d')];if(_0x4969e2[_0x4491('0x2e')][_0x4491('0x35')]){_0x124cbb[_0x4491('0x27')]=[{'all':!![]}];}_0x124cbb=_['merge']({},_0x124cbb,_0x4969e2[_0x4491('0x36')]);return db[_0x4491('0x22')][_0x4491('0x37')](_0x124cbb)[_0x4491('0x18')](handleEntityNotFound(_0x28089d,null))['then'](respondWithResult(_0x28089d,null))[_0x4491('0x2a')](handleError(_0x28089d,null));};exports[_0x4491('0x38')]=function(_0x2f6d7d,_0x4917d3){return db[_0x4491('0x22')][_0x4491('0x38')](_0x2f6d7d[_0x4491('0x39')],{})[_0x4491('0x18')](function(_0x3e9509){var _0x156cad=_0x2f6d7d[_0x4491('0x3a')]['get']({'plain':!![]});if(!_0x156cad)throw new Error(_0x4491('0x3b'));if(_0x156cad[_0x4491('0x3c')]===_0x4491('0x3a')){var _0x3d1ca2=_0x3e9509['get']({'plain':!![]});var _0x1b4ae8='WhatsappQueues';return db[_0x4491('0x3d')][_0x4491('0x37')]({'where':{'name':_0x1b4ae8,'userProfileId':_0x156cad[_0x4491('0x3e')]},'raw':!![]})['then'](function(_0xb9e248){if(_0xb9e248&&_0xb9e248[_0x4491('0x3f')]===0x0){return db[_0x4491('0x1c')][_0x4491('0x38')]({'name':_0x3d1ca2[_0x4491('0x1e')],'resourceId':_0x3d1ca2['id'],'type':_0xb9e248[_0x4491('0x1e')],'sectionId':_0xb9e248['id']},{})['then'](function(){return _0x3e9509;});}else{return _0x3e9509;}})[_0x4491('0x2a')](function(_0x415001){logger[_0x4491('0x1d')](_0x4491('0x40'),_0x415001);throw _0x415001;});}return _0x3e9509;})[_0x4491('0x18')](respondWithResult(_0x4917d3,0xc9))[_0x4491('0x2a')](handleError(_0x4917d3,null));};exports['update']=function(_0x2d93fc,_0x369b54){if(_0x2d93fc[_0x4491('0x39')]['id']){delete _0x2d93fc[_0x4491('0x39')]['id'];}return db['WhatsappQueue']['find']({'where':{'id':_0x2d93fc[_0x4491('0x2c')]['id']}})['then'](handleEntityNotFound(_0x369b54,null))[_0x4491('0x18')](saveUpdates(_0x2d93fc[_0x4491('0x39')],null))['then'](respondWithResult(_0x369b54,null))['catch'](handleError(_0x369b54,null));};exports['destroy']=function(_0x5aa470,_0x106f8e){return db['WhatsappQueue']['find']({'where':{'id':_0x5aa470['params']['id']}})[_0x4491('0x18')](handleEntityNotFound(_0x106f8e,null))['then'](removeEntity(_0x106f8e,null))[_0x4491('0x2a')](handleError(_0x106f8e,null));};exports[_0x4491('0x41')]=function(_0x223c68,_0x3a14ea){return db[_0x4491('0x22')]['describe']()[_0x4491('0x18')](respondWithResult(_0x3a14ea,null))['catch'](handleError(_0x3a14ea,null));};exports['getMembers']=function(_0x575811,_0x19dbb6){var _0xfa95e4={'raw':!![],'where':{}},_0x27ee7f={},_0x4efe63;return db['WhatsappQueue'][_0x4491('0x42')]({'where':{'id':_0x575811[_0x4491('0x2c')]['id']}})[_0x4491('0x18')](handleEntityNotFound(_0x19dbb6,null))[_0x4491('0x18')](function(_0x1be877){if(_0x1be877){_0x4efe63=_0x1be877[_0x4491('0x1a')]({'plain':!![]});_0x27ee7f['model']=_[_0x4491('0x2f')](db[_0x4491('0x43')]['rawAttributes']);_0x27ee7f[_0x4491('0x2e')]=_['keys'](_0x575811[_0x4491('0x2e')]);_0x27ee7f[_0x4491('0x30')]=_['intersection'](_0x27ee7f['model'],_0x27ee7f[_0x4491('0x2e')]);_0xfa95e4[_0x4491('0x32')]=_['intersection'](_0x27ee7f['model'],qs[_0x4491('0x33')](_0x575811[_0x4491('0x2e')]['fields']));_0xfa95e4[_0x4491('0x32')]=_0xfa95e4[_0x4491('0x32')][_0x4491('0x34')]?_0xfa95e4['attributes']:_0x27ee7f['model'];if(!_0x575811[_0x4491('0x2e')][_0x4491('0x44')]('nolimit')){_0xfa95e4[_0x4491('0x13')]=qs[_0x4491('0x13')](_0x575811[_0x4491('0x2e')][_0x4491('0x13')]);_0xfa95e4[_0x4491('0x15')]=qs[_0x4491('0x15')](_0x575811['query'][_0x4491('0x15')]);}_0xfa95e4['order']=qs[_0x4491('0x45')](_0x575811[_0x4491('0x2e')][_0x4491('0x45')]);_0xfa95e4[_0x4491('0x26')]=qs[_0x4491('0x30')](_[_0x4491('0x46')](_0x575811[_0x4491('0x2e')],_0x27ee7f[_0x4491('0x30')]));_0xfa95e4[_0x4491('0x26')]['WhatsappQueueId']=_0x1be877['id'];if(_0x575811[_0x4491('0x2e')][_0x4491('0x47')]){_0xfa95e4[_0x4491('0x26')]=_[_0x4491('0x48')](_0xfa95e4['where'],{'$or':_['map'](_0xfa95e4[_0x4491('0x32')],function(_0x17a531){var _0xce30a={};_0xce30a[_0x17a531]={'$like':'%'+_0x575811['query'][_0x4491('0x47')]+'%'};return _0xce30a;})});}_0xfa95e4=_[_0x4491('0x48')]({},_0xfa95e4,_0x575811['options']);return db[_0x4491('0x43')][_0x4491('0x28')](_0xfa95e4);}})[_0x4491('0x18')](function(_0x43e016){if(_0x43e016){return db['User'][_0x4491('0x49')]({'where':{'id':_[_0x4491('0x21')](_0x43e016,'UserId'),'role':_0x4491('0x4a')},'attributes':['id',_0x4491('0x1e'),_0x4491('0x4b'),_0x4491('0x4c'),_0x4491('0x4d')]});}})[_0x4491('0x18')](function(_0x14c36f){if(_0x14c36f){return{'count':_0x14c36f[_0x4491('0x14')],'rows':_[_0x4491('0x21')](_0x14c36f['rows'],function(_0x49153e){return{'membername':_0x49153e[_0x4491('0x1e')],'UserId':_0x49153e['id'],'queue_name':_0x4efe63[_0x4491('0x1e')],'WhatsappQueueId':_0x4efe63['id'],'interface':util[_0x4491('0x4e')](_0x4491('0x4f'),_0x4491('0x50'),_0x49153e[_0x4491('0x1e')]),'penalty':0x0,'paused':_0x49153e['whatsappPause'],'createdAt':_0x49153e[_0x4491('0x4d')],'updatedAt':_0x49153e[_0x4491('0x4c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x4491('0x18')](respondWithFilteredResult(_0x19dbb6,_0xfa95e4))[_0x4491('0x2a')](handleError(_0x19dbb6,null));};exports[_0x4491('0x51')]=function(_0x39cd1e,_0x15d1d5){var _0x11c56c={};var _0xac2258={};var _0x2e93ae;var _0x56bb77;return db[_0x4491('0x22')]['findOne']({'where':{'id':_0x39cd1e['params']['id']}})['then'](handleEntityNotFound(_0x15d1d5,null))['then'](function(_0x291249){if(_0x291249){_0x2e93ae=_0x291249;_0xac2258[_0x4491('0x2d')]=_[_0x4491('0x2f')](db[_0x4491('0x52')]['rawAttributes']);_0xac2258[_0x4491('0x2e')]=_[_0x4491('0x2f')](_0x39cd1e['query']);_0xac2258[_0x4491('0x30')]=_[_0x4491('0x31')](_0xac2258[_0x4491('0x2d')],_0xac2258['query']);_0x11c56c[_0x4491('0x32')]=_[_0x4491('0x31')](_0xac2258[_0x4491('0x2d')],qs[_0x4491('0x33')](_0x39cd1e[_0x4491('0x2e')][_0x4491('0x33')]));_0x11c56c[_0x4491('0x32')]=_0x11c56c['attributes'][_0x4491('0x34')]?_0x11c56c[_0x4491('0x32')]:_0xac2258[_0x4491('0x2d')];_0x11c56c[_0x4491('0x53')]=qs[_0x4491('0x45')](_0x39cd1e[_0x4491('0x2e')]['sort']);_0x11c56c[_0x4491('0x26')]=qs[_0x4491('0x30')](_[_0x4491('0x46')](_0x39cd1e[_0x4491('0x2e')],_0xac2258['filters']));if(_0x39cd1e['query'][_0x4491('0x47')]){_0x11c56c['where']=_[_0x4491('0x48')](_0x11c56c['where'],{'$or':_[_0x4491('0x21')](_0x11c56c['attributes'],function(_0x2938a0){var _0x254347={};_0x254347[_0x2938a0]={'$like':'%'+_0x39cd1e[_0x4491('0x2e')]['filter']+'%'};return _0x254347;})});}_0x11c56c=_[_0x4491('0x48')]({},_0x11c56c,_0x39cd1e['options']);return _0x2e93ae['getTeams'](_0x11c56c);}})[_0x4491('0x18')](function(_0x62f0c7){if(_0x62f0c7){_0x56bb77=_0x62f0c7[_0x4491('0x34')];if(!_0x39cd1e['query'][_0x4491('0x44')](_0x4491('0x54'))){_0x11c56c[_0x4491('0x13')]=qs[_0x4491('0x13')](_0x39cd1e[_0x4491('0x2e')]['limit']);_0x11c56c[_0x4491('0x15')]=qs[_0x4491('0x15')](_0x39cd1e[_0x4491('0x2e')]['offset']);}return _0x2e93ae[_0x4491('0x51')](_0x11c56c);}})[_0x4491('0x18')](function(_0xcdf5a9){if(_0xcdf5a9){return _0xcdf5a9?{'count':_0x56bb77,'rows':_0xcdf5a9}:null;}})[_0x4491('0x18')](respondWithResult(_0x15d1d5,null))[_0x4491('0x2a')](handleError(_0x15d1d5,null));};exports['addTeams']=function(_0x49e36f,_0x13d29d){var _0x43c3a2=_0x49e36f[_0x4491('0x39')][_0x4491('0x55')];return db[_0x4491('0x52')][_0x4491('0x28')]({'where':{'id':_0x43c3a2},'attributes':['id'],'include':[{'model':db['User'],'as':_0x4491('0x56'),'attributes':['id',_0x4491('0x1e'),_0x4491('0x57'),_0x4491('0x58'),_0x4491('0x59')],'raw':!![]}]})[_0x4491('0x18')](function(_0x1bc5f7){if(_0x1bc5f7){var _0x3b2871=_[_0x4491('0x5a')](_0x1bc5f7,function(_0x5ccf53){var _0x3739f6=_0x5ccf53[_0x4491('0x1a')]({'plain':!![]});return _0x3739f6['Agents'];});return db[_0x4491('0x22')][_0x4491('0x37')]({'where':{'id':_0x49e36f[_0x4491('0x2c')]['id']}})[_0x4491('0x18')](function(_0x553b8c){return db[_0x4491('0x5b')]['transaction'](function(_0xf8e46c){return _0x553b8c[_0x4491('0x5c')](_0x43c3a2,{'transaction':_0xf8e46c})[_0x4491('0x18')](function(){return BPromise[_0x4491('0x5d')](_0x3b2871,function(_0x597fee){return db[_0x4491('0x43')][_0x4491('0x5e')]({'where':{'UserId':_0x597fee['id'],'WhatsappQueueId':_0x49e36f['params']['id']},'transaction':_0xf8e46c});});})[_0x4491('0x18')](function(){_0x3b2871[_0x4491('0x5f')](function(_0x4b68c8){socket[_0x4491('0x60')]('userWhatsappQueue:save',{'UserId':_0x4b68c8['id'],'WhatsappQueueId':_0x553b8c['id']});});});});});}})[_0x4491('0x18')](respondWithStatusCode(_0x13d29d,null))[_0x4491('0x2a')](handleError(_0x13d29d,null));};exports['removeTeams']=function(_0x3a1f01,_0x3ab2bc){return db[_0x4491('0x52')][_0x4491('0x28')]({'where':{'id':_0x3a1f01[_0x4491('0x2e')]['ids']},'attributes':['id'],'include':[{'model':db[_0x4491('0x61')],'as':_0x4491('0x56'),'attributes':['id'],'raw':!![]}]})[_0x4491('0x18')](handleEntityNotFound(_0x3ab2bc,null))[_0x4491('0x18')](function(_0x30e835){var _0x79046=_['map'](_0x30e835,'id');var _0x37f82e=[];var _0x387a2e=[];var _0x533c78=squel['select']();_0x533c78[_0x4491('0x62')](_0x4491('0x63'))[_0x4491('0x64')](_0x4491('0x65'),'tq')[_0x4491('0x66')]('user_has_teams','ut',_0x4491('0x67'))[_0x4491('0x26')](_0x4491('0x68'),_0x3a1f01['params']['id']);for(var _0x6bca4c=0x0;_0x6bca4c<_0x30e835[_0x4491('0x34')];_0x6bca4c+=0x1){let _0x438c01=_0x30e835[_0x6bca4c];for(var _0x4ded5c=0x0;_0x4ded5c<_0x438c01[_0x4491('0x56')][_0x4491('0x34')];_0x4ded5c+=0x1){let _0x273a2d=_0x438c01['Agents'][_0x4ded5c];var _0x2fd0ef=_0x533c78[_0x4491('0x69')]();_0x2fd0ef[_0x4491('0x26')](_0x4491('0x6a'),_0x273a2d['id']);_0x387a2e[_0x4491('0x6b')](db['sequelize'][_0x4491('0x2e')](_0x2fd0ef[_0x4491('0x6c')](),{'type':db[_0x4491('0x5b')][_0x4491('0x6d')][_0x4491('0x6e')]})[_0x4491('0x18')](function(_0x229cad){if(_0x229cad[_0x4491('0x34')]===0x1){return _0x273a2d['id'];}else{var _0x638cf5=_[_0x4491('0x6f')](_[_0x4491('0x21')](_0x229cad,'TeamId'),function(_0x507b66){return _[_0x4491('0x70')](_0x79046,_0x507b66);});if(_0x638cf5){return _0x273a2d['id'];}}}));}}return BPromise[_0x4491('0x71')](_0x387a2e)['then'](function(_0x2c413c){_0x37f82e=_(_0x37f82e)[_0x4491('0x72')](_0x2c413c)[_0x4491('0x73')]()[_0x4491('0x74')]();return db[_0x4491('0x22')]['find']({'where':{'id':_0x3a1f01[_0x4491('0x2c')]['id']}})[_0x4491('0x18')](function(_0x3e2e6a){return db['sequelize'][_0x4491('0x75')](function(_0x4de745){return _0x3e2e6a[_0x4491('0x76')](_0x3a1f01[_0x4491('0x2e')][_0x4491('0x55')],{'transaction':_0x4de745})[_0x4491('0x18')](function(){if(!_['isEmpty'](_0x37f82e)){return _0x3e2e6a[_0x4491('0x77')](_0x37f82e,{'transaction':_0x4de745});}})['then'](function(){_0x37f82e['forEach'](function(_0x3941dc){socket[_0x4491('0x60')]('userWhatsappQueue:remove',{'UserId':_0x3941dc,'WhatsappQueueId':_0x3e2e6a['id']});});});});});});})[_0x4491('0x18')](respondWithStatusCode(_0x3ab2bc,null))[_0x4491('0x2a')](handleError(_0x3ab2bc,null));};exports[_0x4491('0x78')]=function(_0x5af24e,_0x1a6d3d){return db[_0x4491('0x22')][_0x4491('0x37')]({'where':{'id':_0x5af24e[_0x4491('0x2c')]['id']}})['then'](handleEntityNotFound(_0x1a6d3d,null))[_0x4491('0x18')](function(_0x1fd816){if(_0x1fd816){return _0x1fd816[_0x4491('0x78')](_0x5af24e['body'][_0x4491('0x55')],_[_0x4491('0x79')](_0x5af24e[_0x4491('0x39')],[_0x4491('0x55'),'id'])||{})[_0x4491('0x7a')](function(_0x5694b1){for(var _0x26e701=0x0;_0x26e701<_0x5af24e['body']['ids'][_0x4491('0x34')];_0x26e701+=0x1){socket[_0x4491('0x60')](_0x4491('0x7b'),{'UserId':Number(_0x5af24e[_0x4491('0x39')][_0x4491('0x55')][_0x26e701]),'WhatsappQueueId':Number(_0x5af24e[_0x4491('0x2c')]['id'])});}return _0x5694b1;});}})[_0x4491('0x18')](respondWithResult(_0x1a6d3d,null))['catch'](handleError(_0x1a6d3d,null));};exports[_0x4491('0x77')]=function(_0x3aeb83,_0x171c78){return db['WhatsappQueue'][_0x4491('0x37')]({'where':{'id':_0x3aeb83['params']['id']}})[_0x4491('0x18')](handleEntityNotFound(_0x171c78,null))['then'](function(_0x29e817){if(_0x29e817){return _0x29e817[_0x4491('0x77')](_0x3aeb83['query'][_0x4491('0x55')])['then'](function(){if(_[_0x4491('0x7c')](_0x3aeb83[_0x4491('0x2e')][_0x4491('0x55')])){for(var _0x546570=0x0;_0x546570<_0x3aeb83[_0x4491('0x2e')][_0x4491('0x55')][_0x4491('0x34')];_0x546570+=0x1){socket[_0x4491('0x60')](_0x4491('0x7d'),{'UserId':Number(_0x3aeb83['query']['ids'][_0x546570]),'WhatsappQueueId':Number(_0x3aeb83[_0x4491('0x2c')]['id'])});}}else{socket[_0x4491('0x60')](_0x4491('0x7d'),{'UserId':Number(_0x3aeb83['query'][_0x4491('0x55')]),'WhatsappQueueId':Number(_0x3aeb83[_0x4491('0x2c')]['id'])});}});}})[_0x4491('0x18')](respondWithStatusCode(_0x171c78,null))['catch'](handleError(_0x171c78,null));};exports[_0x4491('0x7e')]=function(_0x212c8c,_0x250d54){var _0x407760={};var _0x432a0e={};var _0x5a63b0;var _0x41e2e9;return db['WhatsappQueue'][_0x4491('0x42')]({'where':{'id':_0x212c8c[_0x4491('0x2c')]['id']}})['then'](handleEntityNotFound(_0x250d54,null))[_0x4491('0x18')](function(_0x29284e){if(_0x29284e){_0x5a63b0=_0x29284e;_0x432a0e['model']=_['keys'](db[_0x4491('0x61')][_0x4491('0x23')]);_0x432a0e[_0x4491('0x2e')]=_[_0x4491('0x2f')](_0x212c8c[_0x4491('0x2e')]);_0x432a0e['filters']=_[_0x4491('0x31')](_0x432a0e['model'],_0x432a0e[_0x4491('0x2e')]);_0x407760[_0x4491('0x32')]=_[_0x4491('0x31')](_0x432a0e['model'],qs[_0x4491('0x33')](_0x212c8c[_0x4491('0x2e')][_0x4491('0x33')]));_0x407760[_0x4491('0x32')]=_0x407760[_0x4491('0x32')]['length']?_0x407760[_0x4491('0x32')]:_0x432a0e[_0x4491('0x2d')];_0x407760[_0x4491('0x53')]=qs[_0x4491('0x45')](_0x212c8c[_0x4491('0x2e')]['sort']);_0x407760[_0x4491('0x26')]=qs[_0x4491('0x30')](_[_0x4491('0x46')](_0x212c8c[_0x4491('0x2e')],_0x432a0e[_0x4491('0x30')]));if(_0x212c8c['query']['filter']){_0x407760[_0x4491('0x26')]=_[_0x4491('0x48')](_0x407760[_0x4491('0x26')],{'$or':_[_0x4491('0x21')](_0x407760[_0x4491('0x32')],function(_0x3dbbe3){var _0x86abfd={};_0x86abfd[_0x3dbbe3]={'$like':'%'+_0x212c8c['query'][_0x4491('0x47')]+'%'};return _0x86abfd;})});}_0x407760=_[_0x4491('0x48')]({},_0x407760,_0x212c8c[_0x4491('0x36')]);return _0x5a63b0[_0x4491('0x7e')](_0x407760);}})[_0x4491('0x18')](function(_0x33d39b){if(_0x33d39b){_0x41e2e9=_0x33d39b[_0x4491('0x34')];if(!_0x212c8c[_0x4491('0x2e')][_0x4491('0x44')](_0x4491('0x54'))){_0x407760[_0x4491('0x13')]=qs[_0x4491('0x13')](_0x212c8c[_0x4491('0x2e')][_0x4491('0x13')]);_0x407760['offset']=qs['offset'](_0x212c8c[_0x4491('0x2e')][_0x4491('0x15')]);}return _0x5a63b0[_0x4491('0x7e')](_0x407760);}})[_0x4491('0x18')](function(_0x3b2491){if(_0x3b2491){return _0x3b2491?{'count':_0x41e2e9,'rows':_0x3b2491}:null;}})[_0x4491('0x18')](respondWithResult(_0x250d54,null))[_0x4491('0x2a')](handleError(_0x250d54,null));}; \ No newline at end of file +var _0x5e8a=['compact','value','isEmpty','addAgents','omit','removeAgents','isArray','userWhatsappQueue:remove','getAgents','util','lodash','squel','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','update','then','destroy','get','WhatsappQueues','error','stack','index','WhatsappQueue','fieldName','getOptions','where','include','query','findAll','rows','catch','show','params','model','rawAttributes','keys','filters','intersection','attributes','fields','length','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','name','describe','findOne','UserWhatsappQueue','nolimit','order','sort','WhatsappQueueId','filter','map','User','UserId','agent','whatsappPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','pick','hasOwnProperty','addTeams','ids','Agents','online','voicePause','interface','sequelize','transaction','each','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','ut.UserId\x20=\x20?','QueryTypes','SELECT','every','includes','all','union'];(function(_0x5df467,_0x23c805){var _0x588c8c=function(_0x2e3c34){while(--_0x2e3c34){_0x5df467['push'](_0x5df467['shift']());}};_0x588c8c(++_0x23c805);}(_0x5e8a,0x1ed));var _0xa5e8=function(_0xfaf19d,_0x57304b){_0xfaf19d=_0xfaf19d-0x0;var _0x14a9d9=_0x5e8a[_0xfaf19d];return _0x14a9d9;};'use strict';var BPromise=require('bluebird');var util=require(_0xa5e8('0x0'));var _=require(_0xa5e8('0x1'));var squel=require(_0xa5e8('0x2'));var Redis=require('ioredis');var qs=require(_0xa5e8('0x3'));var logger=require(_0xa5e8('0x4'))(_0xa5e8('0x5'));var config=require(_0xa5e8('0x6'));var db=require('../../mysqldb')['db'];config[_0xa5e8('0x7')]=_[_0xa5e8('0x8')](config['redis'],{'host':_0xa5e8('0x9'),'port':0x18eb});var socket=require(_0xa5e8('0xa'))(new Redis(config[_0xa5e8('0x7')]));require(_0xa5e8('0xb'))[_0xa5e8('0xc')](socket);function respondWithStatusCode(_0x5fa91f,_0x336349){_0x336349=_0x336349||0xcc;return function(_0x42f17f){if(_0x42f17f){return _0x5fa91f[_0xa5e8('0xd')](_0x336349);}return _0x5fa91f[_0xa5e8('0xe')](_0x336349)[_0xa5e8('0xf')]();};}function respondWithResult(_0x4fdb47,_0x13cae8){_0x13cae8=_0x13cae8||0xc8;return function(_0x52c237){if(_0x52c237){return _0x4fdb47[_0xa5e8('0xe')](_0x13cae8)[_0xa5e8('0x10')](_0x52c237);}};}function respondWithFilteredResult(_0x3635bb,_0x4b8a3d){return function(_0x444df2){if(_0x444df2){var _0x220693=typeof _0x4b8a3d[_0xa5e8('0x11')]===_0xa5e8('0x12')&&typeof _0x4b8a3d[_0xa5e8('0x13')]===_0xa5e8('0x12');var _0x42acba=_0x444df2[_0xa5e8('0x14')];var _0x130bd4=_0x220693?0x0:_0x4b8a3d['offset'];var _0x4f3da1=_0x220693?_0x444df2[_0xa5e8('0x14')]:_0x4b8a3d[_0xa5e8('0x11')]+_0x4b8a3d['limit'];var _0x59f7e3;if(_0x4f3da1>=_0x42acba){_0x4f3da1=_0x42acba;_0x59f7e3=0xc8;}else{_0x59f7e3=0xce;}_0x3635bb[_0xa5e8('0xe')](_0x59f7e3);return _0x3635bb['set'](_0xa5e8('0x15'),_0x130bd4+'-'+_0x4f3da1+'/'+_0x42acba)[_0xa5e8('0x10')](_0x444df2);}return null;};}function saveUpdates(_0x46e5c5){return function(_0x1b3250){if(_0x1b3250){return _0x1b3250[_0xa5e8('0x16')](_0x46e5c5)[_0xa5e8('0x17')](function(_0x422fdb){return _0x422fdb;});}return null;};}function removeEntity(_0x1a5038){return function(_0x2c2c36){if(_0x2c2c36){return _0x2c2c36[_0xa5e8('0x18')]()['then'](function(){var _0x1c130e=_0x2c2c36[_0xa5e8('0x19')]({'plain':!![]});var _0x3529aa=_0xa5e8('0x1a');return db['UserProfileResource'][_0xa5e8('0x18')]({'where':{'type':_0x3529aa,'resourceId':_0x1c130e['id']}})[_0xa5e8('0x17')](function(){return _0x2c2c36;});})[_0xa5e8('0x17')](function(){_0x1a5038[_0xa5e8('0xe')](0xcc)[_0xa5e8('0xf')]();});}};}function handleEntityNotFound(_0x38440c){return function(_0x208fcb){if(!_0x208fcb){_0x38440c[_0xa5e8('0xd')](0x194);}return _0x208fcb;};}function handleError(_0x2e731b,_0x25fbef){_0x25fbef=_0x25fbef||0x1f4;return function(_0x678064){logger[_0xa5e8('0x1b')](_0x678064[_0xa5e8('0x1c')]);if(_0x678064['name']){delete _0x678064['name'];}_0x2e731b['status'](_0x25fbef)['send'](_0x678064);};}exports[_0xa5e8('0x1d')]=function(_0x5a73ae,_0x4ccc8f){var _0x2cc711={};var _0x1eadca={'count':0x0,'rows':[]};var _0x225a4c=_['map'](db[_0xa5e8('0x1e')]['rawAttributes'],function(_0x456514){return{'name':_0x456514[_0xa5e8('0x1f')],'type':_0x456514['type']['key']};});_0x2cc711=qs[_0xa5e8('0x20')](_0x225a4c,_0x5a73ae);var _0x3765be={'where':_0x2cc711[_0xa5e8('0x21')]};return db[_0xa5e8('0x1e')][_0xa5e8('0x14')](_0x3765be)[_0xa5e8('0x17')](function(_0x5a2a93){_0x1eadca[_0xa5e8('0x14')]=_0x5a2a93;_0x2cc711[_0xa5e8('0x22')]=qs[_0xa5e8('0x22')](_0x5a73ae[_0xa5e8('0x23')]);return db['WhatsappQueue'][_0xa5e8('0x24')](_0x2cc711);})['then'](function(_0x173072){_0x1eadca[_0xa5e8('0x25')]=_0x173072;return _0x1eadca;})[_0xa5e8('0x17')](respondWithFilteredResult(_0x4ccc8f,_0x2cc711))[_0xa5e8('0x26')](handleError(_0x4ccc8f,null));};exports[_0xa5e8('0x27')]=function(_0x4477c3,_0x4dabfd){var _0x303553={'raw':!![],'where':{'id':_0x4477c3[_0xa5e8('0x28')]['id']}},_0x314cca={};_0x314cca[_0xa5e8('0x29')]=_['keys'](db['WhatsappQueue'][_0xa5e8('0x2a')]);_0x314cca[_0xa5e8('0x23')]=_[_0xa5e8('0x2b')](_0x4477c3[_0xa5e8('0x23')]);_0x314cca[_0xa5e8('0x2c')]=_[_0xa5e8('0x2d')](_0x314cca[_0xa5e8('0x29')],_0x314cca['query']);_0x303553[_0xa5e8('0x2e')]=_[_0xa5e8('0x2d')](_0x314cca[_0xa5e8('0x29')],qs[_0xa5e8('0x2f')](_0x4477c3[_0xa5e8('0x23')][_0xa5e8('0x2f')]));_0x303553[_0xa5e8('0x2e')]=_0x303553['attributes'][_0xa5e8('0x30')]?_0x303553[_0xa5e8('0x2e')]:_0x314cca[_0xa5e8('0x29')];if(_0x4477c3[_0xa5e8('0x23')]['includeAll']){_0x303553[_0xa5e8('0x22')]=[{'all':!![]}];}_0x303553=_[_0xa5e8('0x31')]({},_0x303553,_0x4477c3[_0xa5e8('0x32')]);return db['WhatsappQueue'][_0xa5e8('0x33')](_0x303553)['then'](handleEntityNotFound(_0x4dabfd,null))[_0xa5e8('0x17')](respondWithResult(_0x4dabfd,null))[_0xa5e8('0x26')](handleError(_0x4dabfd,null));};exports['create']=function(_0x51c945,_0x3c430a){return db[_0xa5e8('0x1e')][_0xa5e8('0x34')](_0x51c945[_0xa5e8('0x35')],{})[_0xa5e8('0x17')](function(_0x302679){var _0x17c97f=_0x51c945[_0xa5e8('0x36')][_0xa5e8('0x19')]({'plain':!![]});if(!_0x17c97f)throw new Error(_0xa5e8('0x37'));if(_0x17c97f[_0xa5e8('0x38')]==='user'){var _0x5005df=_0x302679['get']({'plain':!![]});var _0xbb816e='WhatsappQueues';return db[_0xa5e8('0x39')][_0xa5e8('0x33')]({'where':{'name':_0xbb816e,'userProfileId':_0x17c97f[_0xa5e8('0x3a')]},'raw':!![]})[_0xa5e8('0x17')](function(_0x91624e){if(_0x91624e&&_0x91624e[_0xa5e8('0x3b')]===0x0){return db[_0xa5e8('0x3c')][_0xa5e8('0x34')]({'name':_0x5005df[_0xa5e8('0x3d')],'resourceId':_0x5005df['id'],'type':_0x91624e[_0xa5e8('0x3d')],'sectionId':_0x91624e['id']},{})[_0xa5e8('0x17')](function(){return _0x302679;});}else{return _0x302679;}})['catch'](function(_0x233888){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x233888);throw _0x233888;});}return _0x302679;})['then'](respondWithResult(_0x3c430a,0xc9))[_0xa5e8('0x26')](handleError(_0x3c430a,null));};exports[_0xa5e8('0x16')]=function(_0x29e5f2,_0x56fd0b){if(_0x29e5f2['body']['id']){delete _0x29e5f2['body']['id'];}return db[_0xa5e8('0x1e')][_0xa5e8('0x33')]({'where':{'id':_0x29e5f2[_0xa5e8('0x28')]['id']}})['then'](handleEntityNotFound(_0x56fd0b,null))['then'](saveUpdates(_0x29e5f2[_0xa5e8('0x35')],null))[_0xa5e8('0x17')](respondWithResult(_0x56fd0b,null))[_0xa5e8('0x26')](handleError(_0x56fd0b,null));};exports[_0xa5e8('0x18')]=function(_0x5c941b,_0x4e9fb6){return db[_0xa5e8('0x1e')][_0xa5e8('0x33')]({'where':{'id':_0x5c941b['params']['id']}})['then'](handleEntityNotFound(_0x4e9fb6,null))['then'](removeEntity(_0x4e9fb6,null))['catch'](handleError(_0x4e9fb6,null));};exports[_0xa5e8('0x3e')]=function(_0x51634c,_0x3a4a55){return db[_0xa5e8('0x1e')]['describe']()['then'](respondWithResult(_0x3a4a55,null))[_0xa5e8('0x26')](handleError(_0x3a4a55,null));};exports['getMembers']=function(_0x108b20,_0x2d955e){var _0x4dc4e5={'raw':!![],'where':{}},_0x34a7e0={},_0x11dd94;return db[_0xa5e8('0x1e')][_0xa5e8('0x3f')]({'where':{'id':_0x108b20[_0xa5e8('0x28')]['id']}})[_0xa5e8('0x17')](handleEntityNotFound(_0x2d955e,null))[_0xa5e8('0x17')](function(_0x5b9018){if(_0x5b9018){_0x11dd94=_0x5b9018['get']({'plain':!![]});_0x34a7e0['model']=_[_0xa5e8('0x2b')](db[_0xa5e8('0x40')][_0xa5e8('0x2a')]);_0x34a7e0['query']=_[_0xa5e8('0x2b')](_0x108b20['query']);_0x34a7e0[_0xa5e8('0x2c')]=_[_0xa5e8('0x2d')](_0x34a7e0[_0xa5e8('0x29')],_0x34a7e0[_0xa5e8('0x23')]);_0x4dc4e5[_0xa5e8('0x2e')]=_['intersection'](_0x34a7e0[_0xa5e8('0x29')],qs[_0xa5e8('0x2f')](_0x108b20[_0xa5e8('0x23')]['fields']));_0x4dc4e5[_0xa5e8('0x2e')]=_0x4dc4e5[_0xa5e8('0x2e')][_0xa5e8('0x30')]?_0x4dc4e5[_0xa5e8('0x2e')]:_0x34a7e0['model'];if(!_0x108b20[_0xa5e8('0x23')]['hasOwnProperty'](_0xa5e8('0x41'))){_0x4dc4e5[_0xa5e8('0x13')]=qs[_0xa5e8('0x13')](_0x108b20[_0xa5e8('0x23')]['limit']);_0x4dc4e5['offset']=qs['offset'](_0x108b20[_0xa5e8('0x23')][_0xa5e8('0x11')]);}_0x4dc4e5[_0xa5e8('0x42')]=qs[_0xa5e8('0x43')](_0x108b20[_0xa5e8('0x23')]['sort']);_0x4dc4e5[_0xa5e8('0x21')]=qs[_0xa5e8('0x2c')](_['pick'](_0x108b20[_0xa5e8('0x23')],_0x34a7e0[_0xa5e8('0x2c')]));_0x4dc4e5[_0xa5e8('0x21')][_0xa5e8('0x44')]=_0x5b9018['id'];if(_0x108b20[_0xa5e8('0x23')][_0xa5e8('0x45')]){_0x4dc4e5['where']=_['merge'](_0x4dc4e5['where'],{'$or':_[_0xa5e8('0x46')](_0x4dc4e5[_0xa5e8('0x2e')],function(_0x1151d3){var _0x2f9bbb={};_0x2f9bbb[_0x1151d3]={'$like':'%'+_0x108b20[_0xa5e8('0x23')]['filter']+'%'};return _0x2f9bbb;})});}_0x4dc4e5=_[_0xa5e8('0x31')]({},_0x4dc4e5,_0x108b20[_0xa5e8('0x32')]);return db[_0xa5e8('0x40')]['findAll'](_0x4dc4e5);}})[_0xa5e8('0x17')](function(_0x45a4c7){if(_0x45a4c7){return db[_0xa5e8('0x47')]['findAndCountAll']({'where':{'id':_[_0xa5e8('0x46')](_0x45a4c7,_0xa5e8('0x48')),'role':_0xa5e8('0x49')},'attributes':['id','name',_0xa5e8('0x4a'),_0xa5e8('0x4b'),_0xa5e8('0x4c')]});}})[_0xa5e8('0x17')](function(_0x2f5395){if(_0x2f5395){return{'count':_0x2f5395['count'],'rows':_['map'](_0x2f5395[_0xa5e8('0x25')],function(_0x1796d8){return{'membername':_0x1796d8[_0xa5e8('0x3d')],'UserId':_0x1796d8['id'],'queue_name':_0x11dd94[_0xa5e8('0x3d')],'WhatsappQueueId':_0x11dd94['id'],'interface':util[_0xa5e8('0x4d')](_0xa5e8('0x4e'),_0xa5e8('0x4f'),_0x1796d8['name']),'penalty':0x0,'paused':_0x1796d8[_0xa5e8('0x4a')],'createdAt':_0x1796d8['createdAt'],'updatedAt':_0x1796d8[_0xa5e8('0x4b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xa5e8('0x17')](respondWithFilteredResult(_0x2d955e,_0x4dc4e5))[_0xa5e8('0x26')](handleError(_0x2d955e,null));};exports[_0xa5e8('0x50')]=function(_0x1c2701,_0x303fdb){var _0x1cdddb={};var _0x1e728d={};var _0x2cb0b8;var _0x5b6990;return db[_0xa5e8('0x1e')][_0xa5e8('0x3f')]({'where':{'id':_0x1c2701['params']['id']}})[_0xa5e8('0x17')](handleEntityNotFound(_0x303fdb,null))[_0xa5e8('0x17')](function(_0x219e63){if(_0x219e63){_0x2cb0b8=_0x219e63;_0x1e728d[_0xa5e8('0x29')]=_[_0xa5e8('0x2b')](db[_0xa5e8('0x51')][_0xa5e8('0x2a')]);_0x1e728d[_0xa5e8('0x23')]=_[_0xa5e8('0x2b')](_0x1c2701[_0xa5e8('0x23')]);_0x1e728d['filters']=_[_0xa5e8('0x2d')](_0x1e728d[_0xa5e8('0x29')],_0x1e728d[_0xa5e8('0x23')]);_0x1cdddb['attributes']=_[_0xa5e8('0x2d')](_0x1e728d['model'],qs['fields'](_0x1c2701['query'][_0xa5e8('0x2f')]));_0x1cdddb[_0xa5e8('0x2e')]=_0x1cdddb[_0xa5e8('0x2e')][_0xa5e8('0x30')]?_0x1cdddb[_0xa5e8('0x2e')]:_0x1e728d[_0xa5e8('0x29')];_0x1cdddb[_0xa5e8('0x42')]=qs[_0xa5e8('0x43')](_0x1c2701[_0xa5e8('0x23')][_0xa5e8('0x43')]);_0x1cdddb[_0xa5e8('0x21')]=qs[_0xa5e8('0x2c')](_[_0xa5e8('0x52')](_0x1c2701[_0xa5e8('0x23')],_0x1e728d[_0xa5e8('0x2c')]));if(_0x1c2701[_0xa5e8('0x23')]['filter']){_0x1cdddb[_0xa5e8('0x21')]=_[_0xa5e8('0x31')](_0x1cdddb['where'],{'$or':_['map'](_0x1cdddb[_0xa5e8('0x2e')],function(_0x99298a){var _0x1b45ee={};_0x1b45ee[_0x99298a]={'$like':'%'+_0x1c2701[_0xa5e8('0x23')][_0xa5e8('0x45')]+'%'};return _0x1b45ee;})});}_0x1cdddb=_[_0xa5e8('0x31')]({},_0x1cdddb,_0x1c2701[_0xa5e8('0x32')]);return _0x2cb0b8[_0xa5e8('0x50')](_0x1cdddb);}})[_0xa5e8('0x17')](function(_0x15d7c8){if(_0x15d7c8){_0x5b6990=_0x15d7c8[_0xa5e8('0x30')];if(!_0x1c2701[_0xa5e8('0x23')][_0xa5e8('0x53')](_0xa5e8('0x41'))){_0x1cdddb[_0xa5e8('0x13')]=qs[_0xa5e8('0x13')](_0x1c2701[_0xa5e8('0x23')][_0xa5e8('0x13')]);_0x1cdddb['offset']=qs[_0xa5e8('0x11')](_0x1c2701[_0xa5e8('0x23')][_0xa5e8('0x11')]);}return _0x2cb0b8[_0xa5e8('0x50')](_0x1cdddb);}})[_0xa5e8('0x17')](function(_0x16ed75){if(_0x16ed75){return _0x16ed75?{'count':_0x5b6990,'rows':_0x16ed75}:null;}})[_0xa5e8('0x17')](respondWithResult(_0x303fdb,null))[_0xa5e8('0x26')](handleError(_0x303fdb,null));};exports[_0xa5e8('0x54')]=function(_0x253714,_0x28cb82){var _0x20bf4f=_0x253714[_0xa5e8('0x35')][_0xa5e8('0x55')];return db['Team']['findAll']({'where':{'id':_0x20bf4f},'attributes':['id'],'include':[{'model':db['User'],'as':_0xa5e8('0x56'),'attributes':['id','name',_0xa5e8('0x57'),_0xa5e8('0x58'),_0xa5e8('0x59')],'raw':!![]}]})['then'](function(_0x1b7527){if(_0x1b7527){var _0x4cdbd4=_['flatMap'](_0x1b7527,function(_0x501357){var _0x53a13c=_0x501357[_0xa5e8('0x19')]({'plain':!![]});return _0x53a13c[_0xa5e8('0x56')];});return db[_0xa5e8('0x1e')][_0xa5e8('0x33')]({'where':{'id':_0x253714[_0xa5e8('0x28')]['id']}})['then'](function(_0x50337b){return db[_0xa5e8('0x5a')][_0xa5e8('0x5b')](function(_0x4d72af){return _0x50337b[_0xa5e8('0x54')](_0x20bf4f,{'transaction':_0x4d72af})[_0xa5e8('0x17')](function(){return BPromise[_0xa5e8('0x5c')](_0x4cdbd4,function(_0x318522){return db[_0xa5e8('0x40')][_0xa5e8('0x5d')]({'where':{'UserId':_0x318522['id'],'WhatsappQueueId':_0x253714[_0xa5e8('0x28')]['id']},'transaction':_0x4d72af});});})['then'](function(){_0x4cdbd4[_0xa5e8('0x5e')](function(_0x407510){socket[_0xa5e8('0x5f')](_0xa5e8('0x60'),{'UserId':_0x407510['id'],'WhatsappQueueId':_0x50337b['id']});});});});});}})[_0xa5e8('0x17')](respondWithStatusCode(_0x28cb82,null))[_0xa5e8('0x26')](handleError(_0x28cb82,null));};exports[_0xa5e8('0x61')]=function(_0x20d378,_0x30b12a){return db[_0xa5e8('0x51')][_0xa5e8('0x24')]({'where':{'id':_0x20d378[_0xa5e8('0x23')][_0xa5e8('0x55')]},'attributes':['id'],'include':[{'model':db[_0xa5e8('0x47')],'as':_0xa5e8('0x56'),'attributes':['id'],'raw':!![]}]})[_0xa5e8('0x17')](handleEntityNotFound(_0x30b12a,null))[_0xa5e8('0x17')](function(_0x296a79){var _0x25bf20=_[_0xa5e8('0x46')](_0x296a79,'id');var _0x1532fe=[];var _0x117a25=[];var _0x111251=squel['select']();_0x111251[_0xa5e8('0x62')](_0xa5e8('0x63'))[_0xa5e8('0x64')]('team_has_whatsapp_queues','tq')[_0xa5e8('0x65')](_0xa5e8('0x66'),'ut',_0xa5e8('0x67'))['where'](_0xa5e8('0x68'),_0x20d378[_0xa5e8('0x28')]['id']);for(var _0xa8c6f9=0x0;_0xa8c6f9<_0x296a79[_0xa5e8('0x30')];_0xa8c6f9+=0x1){let _0x5b0725=_0x296a79[_0xa8c6f9];for(var _0x433118=0x0;_0x433118<_0x5b0725[_0xa5e8('0x56')][_0xa5e8('0x30')];_0x433118+=0x1){let _0x37771d=_0x5b0725[_0xa5e8('0x56')][_0x433118];var _0x19ac1f=_0x111251['clone']();_0x19ac1f[_0xa5e8('0x21')](_0xa5e8('0x69'),_0x37771d['id']);_0x117a25['push'](db[_0xa5e8('0x5a')][_0xa5e8('0x23')](_0x19ac1f['toString'](),{'type':db[_0xa5e8('0x5a')][_0xa5e8('0x6a')][_0xa5e8('0x6b')]})['then'](function(_0x30a6f7){if(_0x30a6f7[_0xa5e8('0x30')]===0x1){return _0x37771d['id'];}else{var _0x26ad04=_[_0xa5e8('0x6c')](_[_0xa5e8('0x46')](_0x30a6f7,'TeamId'),function(_0x3fb0fd){return _[_0xa5e8('0x6d')](_0x25bf20,_0x3fb0fd);});if(_0x26ad04){return _0x37771d['id'];}}}));}}return BPromise[_0xa5e8('0x6e')](_0x117a25)['then'](function(_0x34c519){_0x1532fe=_(_0x1532fe)[_0xa5e8('0x6f')](_0x34c519)[_0xa5e8('0x70')]()[_0xa5e8('0x71')]();return db[_0xa5e8('0x1e')][_0xa5e8('0x33')]({'where':{'id':_0x20d378['params']['id']}})[_0xa5e8('0x17')](function(_0x8db7b9){return db[_0xa5e8('0x5a')][_0xa5e8('0x5b')](function(_0x92a4d5){return _0x8db7b9[_0xa5e8('0x61')](_0x20d378[_0xa5e8('0x23')]['ids'],{'transaction':_0x92a4d5})[_0xa5e8('0x17')](function(){if(!_[_0xa5e8('0x72')](_0x1532fe)){return _0x8db7b9['removeAgents'](_0x1532fe,{'transaction':_0x92a4d5});}})['then'](function(){_0x1532fe[_0xa5e8('0x5e')](function(_0x4e783d){socket[_0xa5e8('0x5f')]('userWhatsappQueue:remove',{'UserId':_0x4e783d,'WhatsappQueueId':_0x8db7b9['id']});});});});});});})[_0xa5e8('0x17')](respondWithStatusCode(_0x30b12a,null))[_0xa5e8('0x26')](handleError(_0x30b12a,null));};exports[_0xa5e8('0x73')]=function(_0x2090f5,_0x53ec36){return db['WhatsappQueue'][_0xa5e8('0x33')]({'where':{'id':_0x2090f5[_0xa5e8('0x28')]['id']}})[_0xa5e8('0x17')](handleEntityNotFound(_0x53ec36,null))[_0xa5e8('0x17')](function(_0x5b900d){if(_0x5b900d){return _0x5b900d[_0xa5e8('0x73')](_0x2090f5[_0xa5e8('0x35')][_0xa5e8('0x55')],_[_0xa5e8('0x74')](_0x2090f5[_0xa5e8('0x35')],['ids','id'])||{})['spread'](function(_0x2f1e58){for(var _0x22cc77=0x0;_0x22cc77<_0x2090f5['body'][_0xa5e8('0x55')]['length'];_0x22cc77+=0x1){socket['emit'](_0xa5e8('0x60'),{'UserId':Number(_0x2090f5[_0xa5e8('0x35')]['ids'][_0x22cc77]),'WhatsappQueueId':Number(_0x2090f5[_0xa5e8('0x28')]['id'])});}return _0x2f1e58;});}})[_0xa5e8('0x17')](respondWithResult(_0x53ec36,null))[_0xa5e8('0x26')](handleError(_0x53ec36,null));};exports[_0xa5e8('0x75')]=function(_0x269d8c,_0x41106b){return db[_0xa5e8('0x1e')][_0xa5e8('0x33')]({'where':{'id':_0x269d8c[_0xa5e8('0x28')]['id']}})[_0xa5e8('0x17')](handleEntityNotFound(_0x41106b,null))[_0xa5e8('0x17')](function(_0x147b18){if(_0x147b18){return _0x147b18[_0xa5e8('0x75')](_0x269d8c[_0xa5e8('0x23')]['ids'])[_0xa5e8('0x17')](function(){if(_[_0xa5e8('0x76')](_0x269d8c[_0xa5e8('0x23')][_0xa5e8('0x55')])){for(var _0x341c2b=0x0;_0x341c2b<_0x269d8c[_0xa5e8('0x23')][_0xa5e8('0x55')][_0xa5e8('0x30')];_0x341c2b+=0x1){socket[_0xa5e8('0x5f')](_0xa5e8('0x77'),{'UserId':Number(_0x269d8c[_0xa5e8('0x23')][_0xa5e8('0x55')][_0x341c2b]),'WhatsappQueueId':Number(_0x269d8c['params']['id'])});}}else{socket['emit'](_0xa5e8('0x77'),{'UserId':Number(_0x269d8c[_0xa5e8('0x23')]['ids']),'WhatsappQueueId':Number(_0x269d8c[_0xa5e8('0x28')]['id'])});}});}})[_0xa5e8('0x17')](respondWithStatusCode(_0x41106b,null))['catch'](handleError(_0x41106b,null));};exports[_0xa5e8('0x78')]=function(_0x292b7b,_0x4dbc7f){var _0x3456f6={};var _0x2b39f7={};var _0xefc966;var _0x493c55;return db['WhatsappQueue'][_0xa5e8('0x3f')]({'where':{'id':_0x292b7b['params']['id']}})[_0xa5e8('0x17')](handleEntityNotFound(_0x4dbc7f,null))['then'](function(_0x52a752){if(_0x52a752){_0xefc966=_0x52a752;_0x2b39f7[_0xa5e8('0x29')]=_['keys'](db[_0xa5e8('0x47')][_0xa5e8('0x2a')]);_0x2b39f7[_0xa5e8('0x23')]=_[_0xa5e8('0x2b')](_0x292b7b[_0xa5e8('0x23')]);_0x2b39f7['filters']=_[_0xa5e8('0x2d')](_0x2b39f7[_0xa5e8('0x29')],_0x2b39f7['query']);_0x3456f6[_0xa5e8('0x2e')]=_[_0xa5e8('0x2d')](_0x2b39f7[_0xa5e8('0x29')],qs[_0xa5e8('0x2f')](_0x292b7b[_0xa5e8('0x23')][_0xa5e8('0x2f')]));_0x3456f6[_0xa5e8('0x2e')]=_0x3456f6[_0xa5e8('0x2e')][_0xa5e8('0x30')]?_0x3456f6[_0xa5e8('0x2e')]:_0x2b39f7[_0xa5e8('0x29')];_0x3456f6[_0xa5e8('0x42')]=qs[_0xa5e8('0x43')](_0x292b7b[_0xa5e8('0x23')][_0xa5e8('0x43')]);_0x3456f6[_0xa5e8('0x21')]=qs[_0xa5e8('0x2c')](_[_0xa5e8('0x52')](_0x292b7b[_0xa5e8('0x23')],_0x2b39f7[_0xa5e8('0x2c')]));if(_0x292b7b['query']['filter']){_0x3456f6[_0xa5e8('0x21')]=_[_0xa5e8('0x31')](_0x3456f6[_0xa5e8('0x21')],{'$or':_[_0xa5e8('0x46')](_0x3456f6[_0xa5e8('0x2e')],function(_0x41643b){var _0x2e02c8={};_0x2e02c8[_0x41643b]={'$like':'%'+_0x292b7b[_0xa5e8('0x23')][_0xa5e8('0x45')]+'%'};return _0x2e02c8;})});}_0x3456f6=_[_0xa5e8('0x31')]({},_0x3456f6,_0x292b7b['options']);return _0xefc966['getAgents'](_0x3456f6);}})[_0xa5e8('0x17')](function(_0x4ac189){if(_0x4ac189){_0x493c55=_0x4ac189[_0xa5e8('0x30')];if(!_0x292b7b[_0xa5e8('0x23')][_0xa5e8('0x53')]('nolimit')){_0x3456f6[_0xa5e8('0x13')]=qs[_0xa5e8('0x13')](_0x292b7b['query'][_0xa5e8('0x13')]);_0x3456f6[_0xa5e8('0x11')]=qs[_0xa5e8('0x11')](_0x292b7b[_0xa5e8('0x23')][_0xa5e8('0x11')]);}return _0xefc966[_0xa5e8('0x78')](_0x3456f6);}})[_0xa5e8('0x17')](function(_0x2c4069){if(_0x2c4069){return _0x2c4069?{'count':_0x493c55,'rows':_0x2c4069}:null;}})[_0xa5e8('0x17')](respondWithResult(_0x4dbc7f,null))[_0xa5e8('0x26')](handleError(_0x4dbc7f,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 6b3e034..f14afe5 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 _0x5b4b=['events','WhatsappQueue','setMaxListeners','save','emit','hasOwnProperty','hook','exports'];(function(_0x3fa514,_0x4aff7c){var _0xb7c138=function(_0x1dd8e8){while(--_0x1dd8e8){_0x3fa514['push'](_0x3fa514['shift']());}};_0xb7c138(++_0x4aff7c);}(_0x5b4b,0x1b8));var _0xb5b4=function(_0x368084,_0x401d23){_0x368084=_0x368084-0x0;var _0x2e4477=_0x5b4b[_0x368084];return _0x2e4477;};'use strict';var EventEmitter=require(_0xb5b4('0x0'));var WhatsappQueue=require('../../mysqldb')['db'][_0xb5b4('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xb5b4('0x2')](0x0);var events={'afterCreate':_0xb5b4('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2b728f){return function(_0x514d67,_0x5ea235,_0x594b8f){WhatsappQueueEvents[_0xb5b4('0x4')](_0x2b728f+':'+_0x514d67['id'],_0x514d67);WhatsappQueueEvents[_0xb5b4('0x4')](_0x2b728f,_0x514d67);_0x594b8f(null);};}for(var e in events){if(events[_0xb5b4('0x5')](e)){var event=events[e];WhatsappQueue[_0xb5b4('0x6')](e,emitEvent(event));}}module[_0xb5b4('0x7')]=WhatsappQueueEvents; \ No newline at end of file +var _0xcdd1=['remove','hasOwnProperty','exports','WhatsappQueue','setMaxListeners','save','update'];(function(_0x154940,_0x4a448a){var _0x401409=function(_0x45cdcf){while(--_0x45cdcf){_0x154940['push'](_0x154940['shift']());}};_0x401409(++_0x4a448a);}(_0xcdd1,0xa4));var _0x1cdd=function(_0x20d9ff,_0x1bcc4b){_0x20d9ff=_0x20d9ff-0x0;var _0x1f78aa=_0xcdd1[_0x20d9ff];return _0x1f78aa;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require('../../mysqldb')['db'][_0x1cdd('0x0')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x1cdd('0x1')](0x0);var events={'afterCreate':_0x1cdd('0x2'),'afterUpdate':_0x1cdd('0x3'),'afterDestroy':_0x1cdd('0x4')};function emitEvent(_0x2b4a0c){return function(_0x510e91,_0xe3c6bf,_0xf45e04){WhatsappQueueEvents['emit'](_0x2b4a0c+':'+_0x510e91['id'],_0x510e91);WhatsappQueueEvents['emit'](_0x2b4a0c,_0x510e91);_0xf45e04(null);};}for(var e in events){if(events[_0x1cdd('0x5')](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module[_0x1cdd('0x6')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 9bba61d..011376a 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 _0x454b=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappQueue.attributes','exports','define','WhatsappQueue','whatsapp_queues','lodash','util','../../config/logger','api'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x454b,0xbf));var _0xb454=function(_0x256684,_0x529c1e){_0x256684=_0x256684-0x0;var _0x37a0c9=_0x454b[_0x256684];return _0x37a0c9;};'use strict';var _=require(_0xb454('0x0'));var util=require(_0xb454('0x1'));var logger=require(_0xb454('0x2'))(_0xb454('0x3'));var moment=require(_0xb454('0x4'));var BPromise=require(_0xb454('0x5'));var rp=require(_0xb454('0x6'));var fs=require('fs');var path=require(_0xb454('0x7'));var rimraf=require(_0xb454('0x8'));var config=require(_0xb454('0x9'));var attributes=require(_0xb454('0xa'));module[_0xb454('0xb')]=function(_0x210a3a,_0x35ef24){return _0x210a3a[_0xb454('0xc')](_0xb454('0xd'),attributes,{'tableName':_0xb454('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3a71=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./whatsappQueue.attributes','exports','define','whatsapp_queues','lodash','util'];(function(_0x57d13b,_0x52d8cb){var _0x467696=function(_0x153000){while(--_0x153000){_0x57d13b['push'](_0x57d13b['shift']());}};_0x467696(++_0x52d8cb);}(_0x3a71,0x150));var _0x13a7=function(_0x400459,_0x4cdcd4){_0x400459=_0x400459-0x0;var _0x35ce1f=_0x3a71[_0x400459];return _0x35ce1f;};'use strict';var _=require(_0x13a7('0x0'));var util=require(_0x13a7('0x1'));var logger=require(_0x13a7('0x2'))(_0x13a7('0x3'));var moment=require(_0x13a7('0x4'));var BPromise=require(_0x13a7('0x5'));var rp=require(_0x13a7('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x13a7('0x7'));var config=require(_0x13a7('0x8'));var attributes=require(_0x13a7('0x9'));module[_0x13a7('0xa')]=function(_0x1f37c1,_0x2fe166){return _0x1f37c1[_0x13a7('0xb')]('WhatsappQueue',attributes,{'tableName':_0x13a7('0xc'),'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 36015cc..fdddefe 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 _0x2ece=['then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','WhatsappQueue','findAll','raw','options','where','attributes','limit','include','map','model','GetWhatsappQueue','ShowWhatsappQueue','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./whatsappQueue.socket','register'];(function(_0x1465c1,_0xa8fd77){var _0x104621=function(_0x2bd254){while(--_0x2bd254){_0x1465c1['push'](_0x1465c1['shift']());}};_0x104621(++_0xa8fd77);}(_0x2ece,0xb2));var _0xe2ec=function(_0x267c52,_0x3c0df3){_0x267c52=_0x267c52-0x0;var _0x46c47b=_0x2ece[_0x267c52];return _0x46c47b;};'use strict';var _=require('lodash');var util=require(_0xe2ec('0x0'));var moment=require(_0xe2ec('0x1'));var BPromise=require(_0xe2ec('0x2'));var rs=require(_0xe2ec('0x3'));var fs=require('fs');var Redis=require(_0xe2ec('0x4'));var db=require(_0xe2ec('0x5'))['db'];var utils=require(_0xe2ec('0x6'));var logger=require(_0xe2ec('0x7'))('rpc');var config=require(_0xe2ec('0x8'));var jayson=require(_0xe2ec('0x9'));var client=jayson[_0xe2ec('0xa')][_0xe2ec('0xb')]({'port':0x232a});config[_0xe2ec('0xc')]=_[_0xe2ec('0xd')](config[_0xe2ec('0xc')],{'host':_0xe2ec('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe2ec('0xc')]));require(_0xe2ec('0xf'))[_0xe2ec('0x10')](socket);function respondWithRpcPromise(_0x5d4fdb,_0x30ed50,_0x363a49){return new BPromise(function(_0x3e4178,_0x391ce2){return client['request'](_0x5d4fdb,_0x363a49)[_0xe2ec('0x11')](function(_0x7ec9ad){logger[_0xe2ec('0x12')](_0xe2ec('0x13'),_0x30ed50,_0xe2ec('0x14'));logger[_0xe2ec('0x15')]('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x30ed50,_0xe2ec('0x14'),JSON[_0xe2ec('0x16')](_0x7ec9ad));if(_0x7ec9ad[_0xe2ec('0x17')]){if(_0x7ec9ad[_0xe2ec('0x17')][_0xe2ec('0x18')]===0x1f4){logger[_0xe2ec('0x17')]('WhatsappQueue,\x20%s,\x20%s',_0x30ed50,_0x7ec9ad['error']['message']);return _0x391ce2(_0x7ec9ad[_0xe2ec('0x17')][_0xe2ec('0x19')]);}logger['error'](_0xe2ec('0x13'),_0x30ed50,_0x7ec9ad['error'][_0xe2ec('0x19')]);return _0x3e4178(_0x7ec9ad[_0xe2ec('0x17')][_0xe2ec('0x19')]);}else{logger[_0xe2ec('0x12')](_0xe2ec('0x13'),_0x30ed50,_0xe2ec('0x14'));_0x3e4178(_0x7ec9ad['result'][_0xe2ec('0x19')]);}})[_0xe2ec('0x1a')](function(_0x579391){logger[_0xe2ec('0x17')](_0xe2ec('0x13'),_0x30ed50,_0x579391);_0x391ce2(_0x579391);});});}exports['GetWhatsappQueue']=function(_0x2b6fe9){var _0x1667de=this;return new Promise(function(_0x1b0a91,_0x30a02f){return db[_0xe2ec('0x1b')][_0xe2ec('0x1c')]({'raw':_0x2b6fe9['options']?_0x2b6fe9['options'][_0xe2ec('0x1d')]===undefined?!![]:![]:!![],'where':_0x2b6fe9['options']?_0x2b6fe9[_0xe2ec('0x1e')][_0xe2ec('0x1f')]||null:null,'attributes':_0x2b6fe9[_0xe2ec('0x1e')]?_0x2b6fe9['options'][_0xe2ec('0x20')]||null:null,'limit':_0x2b6fe9[_0xe2ec('0x1e')]?_0x2b6fe9[_0xe2ec('0x1e')][_0xe2ec('0x21')]||null:null,'include':_0x2b6fe9[_0xe2ec('0x1e')]?_0x2b6fe9[_0xe2ec('0x1e')][_0xe2ec('0x22')]?_[_0xe2ec('0x23')](_0x2b6fe9[_0xe2ec('0x1e')][_0xe2ec('0x22')],function(_0x5a7d25){return{'model':db[_0x5a7d25['model']],'as':_0x5a7d25['as'],'attributes':_0x5a7d25['attributes'],'include':_0x5a7d25[_0xe2ec('0x22')]?_['map'](_0x5a7d25['include'],function(_0x2e7bca){return{'model':db[_0x2e7bca['model']],'as':_0x2e7bca['as'],'attributes':_0x2e7bca[_0xe2ec('0x20')],'include':_0x2e7bca[_0xe2ec('0x22')]?_[_0xe2ec('0x23')](_0x2e7bca[_0xe2ec('0x22')],function(_0xa29903){return{'model':db[_0xa29903[_0xe2ec('0x24')]],'as':_0xa29903['as'],'attributes':_0xa29903[_0xe2ec('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x56b5c9){logger[_0xe2ec('0x12')]('GetWhatsappQueue',_0x2b6fe9);logger['debug'](_0xe2ec('0x25'),_0x2b6fe9,JSON[_0xe2ec('0x16')](_0x56b5c9));_0x1b0a91(_0x56b5c9);})[_0xe2ec('0x1a')](function(_0x3fa65f){logger[_0xe2ec('0x17')]('GetWhatsappQueue',_0x3fa65f[_0xe2ec('0x19')],_0x2b6fe9);_0x30a02f(_0x1667de[_0xe2ec('0x17')](0x1f4,_0x3fa65f[_0xe2ec('0x19')]));});});};exports[_0xe2ec('0x26')]=function(_0x421009){var _0x559522=this;return new Promise(function(_0x52e73f,_0x3ae549){return db[_0xe2ec('0x1b')]['find']({'raw':_0x421009[_0xe2ec('0x1e')]?_0x421009['options']['raw']===undefined?!![]:![]:!![],'where':_0x421009[_0xe2ec('0x1e')]?_0x421009[_0xe2ec('0x1e')][_0xe2ec('0x1f')]||null:null,'attributes':_0x421009[_0xe2ec('0x1e')]?_0x421009['options'][_0xe2ec('0x20')]||null:null,'include':_0x421009[_0xe2ec('0x1e')]?_0x421009[_0xe2ec('0x1e')][_0xe2ec('0x22')]?_[_0xe2ec('0x23')](_0x421009[_0xe2ec('0x1e')][_0xe2ec('0x22')],function(_0x43c442){return{'model':db[_0x43c442[_0xe2ec('0x24')]],'as':_0x43c442['as'],'attributes':_0x43c442[_0xe2ec('0x20')],'include':_0x43c442[_0xe2ec('0x22')]?_[_0xe2ec('0x23')](_0x43c442['include'],function(_0x5bdb98){return{'model':db[_0x5bdb98[_0xe2ec('0x24')]],'as':_0x5bdb98['as'],'attributes':_0x5bdb98[_0xe2ec('0x20')],'include':_0x5bdb98[_0xe2ec('0x22')]?_['map'](_0x5bdb98[_0xe2ec('0x22')],function(_0x2cfe8f){return{'model':db[_0x2cfe8f[_0xe2ec('0x24')]],'as':_0x2cfe8f['as'],'attributes':_0x2cfe8f[_0xe2ec('0x20')]};}):[]};}):[]};}):[]:[]})[_0xe2ec('0x11')](function(_0x573241){logger[_0xe2ec('0x12')]('ShowWhatsappQueue',_0x421009);logger['debug'](_0xe2ec('0x26'),_0x421009,JSON[_0xe2ec('0x16')](_0x573241));_0x52e73f(_0x573241);})[_0xe2ec('0x1a')](function(_0x5dd5aa){logger[_0xe2ec('0x17')](_0xe2ec('0x26'),_0x5dd5aa['message'],_0x421009);_0x3ae549(_0x559522[_0xe2ec('0x17')](0x1f4,_0x5dd5aa[_0xe2ec('0x19')]));});});}; \ No newline at end of file +var _0x227b=['register','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','error','code','message','WhatsappQueue,\x20%s,\x20%s','result','catch','GetWhatsappQueue','options','raw','where','limit','include','map','model','attributes','then','info','ShowWhatsappQueue','WhatsappQueue','find','stringify','util','moment','bluebird','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./whatsappQueue.socket'];(function(_0x4ab99,_0x219ed2){var _0x29e39c=function(_0x2dd986){while(--_0x2dd986){_0x4ab99['push'](_0x4ab99['shift']());}};_0x29e39c(++_0x219ed2);}(_0x227b,0x18b));var _0xb227=function(_0x26a6cd,_0x44217c){_0x26a6cd=_0x26a6cd-0x0;var _0x3d560a=_0x227b[_0x26a6cd];return _0x3d560a;};'use strict';var _=require('lodash');var util=require(_0xb227('0x0'));var moment=require(_0xb227('0x1'));var BPromise=require(_0xb227('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb227('0x3'));var logger=require('../../config/logger')(_0xb227('0x4'));var config=require(_0xb227('0x5'));var jayson=require(_0xb227('0x6'));var client=jayson['client'][_0xb227('0x7')]({'port':0x232a});config[_0xb227('0x8')]=_['defaults'](config[_0xb227('0x8')],{'host':_0xb227('0x9'),'port':0x18eb});var socket=require(_0xb227('0xa'))(new Redis(config[_0xb227('0x8')]));require(_0xb227('0xb'))[_0xb227('0xc')](socket);function respondWithRpcPromise(_0x59a87e,_0x3ca084,_0x5be0c5){return new BPromise(function(_0x29da20,_0x3933df){return client['request'](_0x59a87e,_0x5be0c5)['then'](function(_0x947d6d){logger['info']('WhatsappQueue,\x20%s,\x20%s',_0x3ca084,_0xb227('0xd'));logger[_0xb227('0xe')](_0xb227('0xf'),_0x3ca084,_0xb227('0xd'),JSON['stringify'](_0x947d6d));if(_0x947d6d['error']){if(_0x947d6d[_0xb227('0x10')][_0xb227('0x11')]===0x1f4){logger['error']('WhatsappQueue,\x20%s,\x20%s',_0x3ca084,_0x947d6d['error'][_0xb227('0x12')]);return _0x3933df(_0x947d6d['error'][_0xb227('0x12')]);}logger['error'](_0xb227('0x13'),_0x3ca084,_0x947d6d[_0xb227('0x10')][_0xb227('0x12')]);return _0x29da20(_0x947d6d[_0xb227('0x10')][_0xb227('0x12')]);}else{logger['info'](_0xb227('0x13'),_0x3ca084,_0xb227('0xd'));_0x29da20(_0x947d6d[_0xb227('0x14')][_0xb227('0x12')]);}})[_0xb227('0x15')](function(_0x2e6ec5){logger[_0xb227('0x10')](_0xb227('0x13'),_0x3ca084,_0x2e6ec5);_0x3933df(_0x2e6ec5);});});}exports[_0xb227('0x16')]=function(_0x3c72ba){var _0x4eda73=this;return new Promise(function(_0xff1299,_0x5ad8ce){return db['WhatsappQueue']['findAll']({'raw':_0x3c72ba['options']?_0x3c72ba[_0xb227('0x17')][_0xb227('0x18')]===undefined?!![]:![]:!![],'where':_0x3c72ba['options']?_0x3c72ba[_0xb227('0x17')][_0xb227('0x19')]||null:null,'attributes':_0x3c72ba[_0xb227('0x17')]?_0x3c72ba[_0xb227('0x17')]['attributes']||null:null,'limit':_0x3c72ba[_0xb227('0x17')]?_0x3c72ba['options'][_0xb227('0x1a')]||null:null,'include':_0x3c72ba[_0xb227('0x17')]?_0x3c72ba[_0xb227('0x17')][_0xb227('0x1b')]?_[_0xb227('0x1c')](_0x3c72ba[_0xb227('0x17')][_0xb227('0x1b')],function(_0x354705){return{'model':db[_0x354705[_0xb227('0x1d')]],'as':_0x354705['as'],'attributes':_0x354705[_0xb227('0x1e')],'include':_0x354705[_0xb227('0x1b')]?_[_0xb227('0x1c')](_0x354705[_0xb227('0x1b')],function(_0x486afa){return{'model':db[_0x486afa[_0xb227('0x1d')]],'as':_0x486afa['as'],'attributes':_0x486afa['attributes'],'include':_0x486afa[_0xb227('0x1b')]?_[_0xb227('0x1c')](_0x486afa[_0xb227('0x1b')],function(_0x2c4744){return{'model':db[_0x2c4744[_0xb227('0x1d')]],'as':_0x2c4744['as'],'attributes':_0x2c4744['attributes']};}):[]};}):[]};}):[]:[]})[_0xb227('0x1f')](function(_0x7249c6){logger[_0xb227('0x20')]('GetWhatsappQueue',_0x3c72ba);logger[_0xb227('0xe')](_0xb227('0x16'),_0x3c72ba,JSON['stringify'](_0x7249c6));_0xff1299(_0x7249c6);})[_0xb227('0x15')](function(_0x29f3ac){logger['error'](_0xb227('0x16'),_0x29f3ac[_0xb227('0x12')],_0x3c72ba);_0x5ad8ce(_0x4eda73[_0xb227('0x10')](0x1f4,_0x29f3ac['message']));});});};exports[_0xb227('0x21')]=function(_0x725ebb){var _0x21e246=this;return new Promise(function(_0x421934,_0x1a81df){return db[_0xb227('0x22')][_0xb227('0x23')]({'raw':_0x725ebb[_0xb227('0x17')]?_0x725ebb[_0xb227('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x725ebb[_0xb227('0x17')]?_0x725ebb[_0xb227('0x17')][_0xb227('0x19')]||null:null,'attributes':_0x725ebb[_0xb227('0x17')]?_0x725ebb[_0xb227('0x17')][_0xb227('0x1e')]||null:null,'include':_0x725ebb[_0xb227('0x17')]?_0x725ebb[_0xb227('0x17')]['include']?_[_0xb227('0x1c')](_0x725ebb[_0xb227('0x17')]['include'],function(_0x35e10f){return{'model':db[_0x35e10f[_0xb227('0x1d')]],'as':_0x35e10f['as'],'attributes':_0x35e10f[_0xb227('0x1e')],'include':_0x35e10f[_0xb227('0x1b')]?_[_0xb227('0x1c')](_0x35e10f['include'],function(_0x54aff3){return{'model':db[_0x54aff3[_0xb227('0x1d')]],'as':_0x54aff3['as'],'attributes':_0x54aff3[_0xb227('0x1e')],'include':_0x54aff3[_0xb227('0x1b')]?_[_0xb227('0x1c')](_0x54aff3[_0xb227('0x1b')],function(_0x6de11){return{'model':db[_0x6de11[_0xb227('0x1d')]],'as':_0x6de11['as'],'attributes':_0x6de11[_0xb227('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xb227('0x1f')](function(_0x1a302f){logger['info'](_0xb227('0x21'),_0x725ebb);logger[_0xb227('0xe')](_0xb227('0x21'),_0x725ebb,JSON[_0xb227('0x24')](_0x1a302f));_0x421934(_0x1a302f);})[_0xb227('0x15')](function(_0x42b2e3){logger['error'](_0xb227('0x21'),_0x42b2e3[_0xb227('0x12')],_0x725ebb);_0x1a81df(_0x21e246['error'](0x1f4,_0x42b2e3[_0xb227('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 9742aa4..2afed2c 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 _0x1fc9=['save','remove','update','emit','removeListener','register','length','whatsappQueue:','./whatsappQueue.events'];(function(_0x209e12,_0x2ce907){var _0x3f5b89=function(_0x39cc7f){while(--_0x39cc7f){_0x209e12['push'](_0x209e12['shift']());}};_0x3f5b89(++_0x2ce907);}(_0x1fc9,0x1ee));var _0x91fc=function(_0x2e6c7d,_0x4a2375){_0x2e6c7d=_0x2e6c7d-0x0;var _0x361537=_0x1fc9[_0x2e6c7d];return _0x361537;};'use strict';var WhatsappQueueEvents=require(_0x91fc('0x0'));var events=[_0x91fc('0x1'),_0x91fc('0x2'),_0x91fc('0x3')];function createListener(_0x662bd6,_0x49c279){return function(_0x488f0e){_0x49c279[_0x91fc('0x4')](_0x662bd6,_0x488f0e);};}function removeListener(_0x16f993,_0x7422b5){return function(){WhatsappQueueEvents[_0x91fc('0x5')](_0x16f993,_0x7422b5);};}exports[_0x91fc('0x6')]=function(_0x3bf15b){for(var _0x533f7a=0x0,_0xba3c82=events[_0x91fc('0x7')];_0x533f7a<_0xba3c82;_0x533f7a++){var _0x20a513=events[_0x533f7a];var _0xd92045=createListener(_0x91fc('0x8')+_0x20a513,_0x3bf15b);WhatsappQueueEvents['on'](_0x20a513,_0xd92045);}}; \ No newline at end of file +var _0xcddb=['register','whatsappQueue:','./whatsappQueue.events','save','remove','emit'];(function(_0x451948,_0x2f25f3){var _0x19467a=function(_0x2dba42){while(--_0x2dba42){_0x451948['push'](_0x451948['shift']());}};_0x19467a(++_0x2f25f3);}(_0xcddb,0x16a));var _0xbcdd=function(_0x27761a,_0x1c1c52){_0x27761a=_0x27761a-0x0;var _0x28822e=_0xcddb[_0x27761a];return _0x28822e;};'use strict';var WhatsappQueueEvents=require(_0xbcdd('0x0'));var events=[_0xbcdd('0x1'),_0xbcdd('0x2'),'update'];function createListener(_0x5c1291,_0x408e8f){return function(_0x59b75b){_0x408e8f[_0xbcdd('0x3')](_0x5c1291,_0x59b75b);};}function removeListener(_0x19118d,_0x4e0825){return function(){WhatsappQueueEvents['removeListener'](_0x19118d,_0x4e0825);};}exports[_0xbcdd('0x4')]=function(_0xd5aa61){for(var _0x20d6e6=0x0,_0x5d5239=events['length'];_0x20d6e6<_0x5d5239;_0x20d6e6++){var _0x41f16e=events[_0x20d6e6];var _0xb884a6=createListener(_0xbcdd('0x5')+_0x41f16e,_0xd5aa61);WhatsappQueueEvents['on'](_0x41f16e,_0xb884a6);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 8d07de7..decda4c 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 _0x04aa=['index','get','/describe','describe','/:id','show','create','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','isAuthenticated'];(function(_0x3fe4c9,_0x415d4b){var _0x9bdd37=function(_0x1cf576){while(--_0x1cf576){_0x3fe4c9['push'](_0x3fe4c9['shift']());}};_0x9bdd37(++_0x415d4b);}(_0x04aa,0x6e));var _0xa04a=function(_0x547018,_0x4202c8){_0x547018=_0x547018-0x0;var _0x46effe=_0x04aa[_0x547018];return _0x46effe;};'use strict';var multer=require('multer');var util=require(_0xa04a('0x0'));var path=require(_0xa04a('0x1'));var timeout=require(_0xa04a('0x2'));var express=require(_0xa04a('0x3'));var router=express[_0xa04a('0x4')]();var fs_extra=require(_0xa04a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa04a('0x6'));var config=require(_0xa04a('0x7'));var controller=require(_0xa04a('0x8'));router['get']('/',auth[_0xa04a('0x9')](),controller[_0xa04a('0xa')]);router[_0xa04a('0xb')](_0xa04a('0xc'),auth['isAuthenticated'](),controller[_0xa04a('0xd')]);router[_0xa04a('0xb')](_0xa04a('0xe'),auth[_0xa04a('0x9')](),controller[_0xa04a('0xf')]);router['post']('/',auth[_0xa04a('0x9')](),controller[_0xa04a('0x10')]);router['put'](_0xa04a('0xe'),auth[_0xa04a('0x9')](),controller[_0xa04a('0x11')]);router[_0xa04a('0x12')](_0xa04a('0xe'),auth[_0xa04a('0x9')](),controller['destroy']);module[_0xa04a('0x13')]=router; \ No newline at end of file +var _0x336a=['update','delete','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','/describe','describe','/:id','show','create','put'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0x336a,0xa3));var _0xa336=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0x336a[_0x5f3f88];return _0xd08119;};'use strict';var multer=require(_0xa336('0x0'));var util=require(_0xa336('0x1'));var path=require(_0xa336('0x2'));var timeout=require('connect-timeout');var express=require(_0xa336('0x3'));var router=express[_0xa336('0x4')]();var fs_extra=require(_0xa336('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa336('0x6'));var config=require(_0xa336('0x7'));var controller=require(_0xa336('0x8'));router[_0xa336('0x9')]('/',auth[_0xa336('0xa')](),controller['index']);router[_0xa336('0x9')](_0xa336('0xb'),auth[_0xa336('0xa')](),controller[_0xa336('0xc')]);router[_0xa336('0x9')](_0xa336('0xd'),auth[_0xa336('0xa')](),controller[_0xa336('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa336('0xf')]);router[_0xa336('0x10')](_0xa336('0xd'),auth[_0xa336('0xa')](),controller[_0xa336('0x11')]);router[_0xa336('0x12')](_0xa336('0xd'),auth[_0xa336('0xa')](),controller['destroy']);module[_0xa336('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 bdf3446..2bd1cc9 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x46ff92,_0x355a59){var _0x93eb9d=function(_0xdfe592){while(--_0xdfe592){_0x46ff92['push'](_0x46ff92['shift']());}};_0x93eb9d(++_0x355a59);}(_0x7a54,0x106));var _0x47a5=function(_0x171074,_0x35e24f){_0x171074=_0x171074-0x0;var _0x42484a=_0x7a54[_0x171074];return _0x42484a;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file +var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x59f5bc,_0x142b64){var _0x2cdb73=function(_0x1e7945){while(--_0x1e7945){_0x59f5bc['push'](_0x59f5bc['shift']());}};_0x2cdb73(++_0x142b64);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'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 154311a..48a2c0e 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 _0xf7b4=['../../config/environment','sendStatus','end','status','json','offset','undefined','count','limit','set','apply','reject','save','update','then','stack','name','send','index','map','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','WhatsappQueueReport','rows','catch','show','params','find','create','body','destroy','describe','eml-format','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x424a9a,_0x2dd9af){var _0xa7831c=function(_0x512534){while(--_0x512534){_0x424a9a['push'](_0x424a9a['shift']());}};_0xa7831c(++_0x2dd9af);}(_0xf7b4,0x152));var _0x4f7b=function(_0x340bf1,_0x28154e){_0x340bf1=_0x340bf1-0x0;var _0x5d6835=_0xf7b4[_0x340bf1];return _0x5d6835;};'use strict';var emlformat=require(_0x4f7b('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4f7b('0x1'));var rp=require(_0x4f7b('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4f7b('0x3'));var util=require(_0x4f7b('0x4'));var path=require(_0x4f7b('0x5'));var sox=require(_0x4f7b('0x6'));var csv=require(_0x4f7b('0x7'));var ejs=require(_0x4f7b('0x8'));var fs=require('fs');var fs_extra=require(_0x4f7b('0x9'));var _=require(_0x4f7b('0xa'));var squel=require(_0x4f7b('0xb'));var crypto=require(_0x4f7b('0xc'));var jsforce=require(_0x4f7b('0xd'));var deskjs=require(_0x4f7b('0xe'));var toCsv=require(_0x4f7b('0x7'));var querystring=require('querystring');var Papa=require(_0x4f7b('0xf'));var Redis=require(_0x4f7b('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x4f7b('0x11'));var as=require(_0x4f7b('0x12'));var hardwareService=require(_0x4f7b('0x13'));var logger=require(_0x4f7b('0x14'))(_0x4f7b('0x15'));var utils=require('../../config/utils');var config=require(_0x4f7b('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xd9b349,_0x2e8dd9){_0x2e8dd9=_0x2e8dd9||0xcc;return function(_0x3c55e1){if(_0x3c55e1){return _0xd9b349[_0x4f7b('0x17')](_0x2e8dd9);}return _0xd9b349['status'](_0x2e8dd9)[_0x4f7b('0x18')]();};}function respondWithResult(_0x368091,_0x407cee){_0x407cee=_0x407cee||0xc8;return function(_0x43a51a){if(_0x43a51a){return _0x368091[_0x4f7b('0x19')](_0x407cee)[_0x4f7b('0x1a')](_0x43a51a);}};}function respondWithFilteredResult(_0x40ecb0,_0x2437cc){return function(_0x260667){if(_0x260667){var _0x29fdd5=typeof _0x2437cc[_0x4f7b('0x1b')]===_0x4f7b('0x1c')&&typeof _0x2437cc['limit']===_0x4f7b('0x1c');var _0x496322=_0x260667['count'];var _0x24e5cf=_0x29fdd5?0x0:_0x2437cc[_0x4f7b('0x1b')];var _0x519d90=_0x29fdd5?_0x260667[_0x4f7b('0x1d')]:_0x2437cc[_0x4f7b('0x1b')]+_0x2437cc[_0x4f7b('0x1e')];var _0xf2311f;if(_0x519d90>=_0x496322){_0x519d90=_0x496322;_0xf2311f=0xc8;}else{_0xf2311f=0xce;}_0x40ecb0['status'](_0xf2311f);return _0x40ecb0[_0x4f7b('0x1f')]('Content-Range',_0x24e5cf+'-'+_0x519d90+'/'+_0x496322)[_0x4f7b('0x1a')](_0x260667);}return null;};}function patchUpdates(_0x12374b){return function(_0xa2f54e){try{jsonpatch[_0x4f7b('0x20')](_0xa2f54e,_0x12374b,!![]);}catch(_0x27127b){return BPromise[_0x4f7b('0x21')](_0x27127b);}return _0xa2f54e[_0x4f7b('0x22')]();};}function saveUpdates(_0x1f545e,_0x2a8b50){return function(_0x5508bd){if(_0x5508bd){return _0x5508bd[_0x4f7b('0x23')](_0x1f545e)[_0x4f7b('0x24')](function(_0x2c9ea6){return _0x2c9ea6;});}return null;};}function removeEntity(_0x5bd43f,_0x150f57){return function(_0x4610a4){if(_0x4610a4){return _0x4610a4['destroy']()[_0x4f7b('0x24')](function(){_0x5bd43f['status'](0xcc)[_0x4f7b('0x18')]();});}};}function handleEntityNotFound(_0x2429be,_0x23c820){return function(_0x278c41){if(!_0x278c41){_0x2429be[_0x4f7b('0x17')](0x194);}return _0x278c41;};}function handleError(_0x94478b,_0x181e13){_0x181e13=_0x181e13||0x1f4;return function(_0x3ad769){logger['error'](_0x3ad769[_0x4f7b('0x25')]);if(_0x3ad769[_0x4f7b('0x26')]){delete _0x3ad769[_0x4f7b('0x26')];}_0x94478b['status'](_0x181e13)[_0x4f7b('0x27')](_0x3ad769);};}exports[_0x4f7b('0x28')]=function(_0x1db684,_0x3a56ff){var _0x1ccce0={},_0x4ebffa={},_0xac1f93={'count':0x0,'rows':[]};var _0x3331b2=_[_0x4f7b('0x29')](db['WhatsappQueueReport'][_0x4f7b('0x2a')],function(_0x5d13a1){return{'name':_0x5d13a1['fieldName'],'type':_0x5d13a1[_0x4f7b('0x2b')]['key']};});_0x4ebffa[_0x4f7b('0x2c')]=_[_0x4f7b('0x29')](_0x3331b2,_0x4f7b('0x26'));_0x4ebffa[_0x4f7b('0x2d')]=_[_0x4f7b('0x2e')](_0x1db684[_0x4f7b('0x2d')]);_0x4ebffa[_0x4f7b('0x2f')]=_[_0x4f7b('0x30')](_0x4ebffa[_0x4f7b('0x2c')],_0x4ebffa[_0x4f7b('0x2d')]);_0x1ccce0[_0x4f7b('0x31')]=_[_0x4f7b('0x30')](_0x4ebffa[_0x4f7b('0x2c')],qs[_0x4f7b('0x32')](_0x1db684[_0x4f7b('0x2d')][_0x4f7b('0x32')]));_0x1ccce0[_0x4f7b('0x31')]=_0x1ccce0[_0x4f7b('0x31')][_0x4f7b('0x33')]?_0x1ccce0[_0x4f7b('0x31')]:_0x4ebffa[_0x4f7b('0x2c')];if(!_0x1db684[_0x4f7b('0x2d')]['hasOwnProperty'](_0x4f7b('0x34'))){_0x1ccce0['limit']=qs[_0x4f7b('0x1e')](_0x1db684[_0x4f7b('0x2d')]['limit']);_0x1ccce0[_0x4f7b('0x1b')]=qs[_0x4f7b('0x1b')](_0x1db684[_0x4f7b('0x2d')]['offset']);}_0x1ccce0[_0x4f7b('0x35')]=qs[_0x4f7b('0x36')](_0x1db684[_0x4f7b('0x2d')][_0x4f7b('0x36')]);_0x1ccce0[_0x4f7b('0x37')]=qs[_0x4f7b('0x2f')](_[_0x4f7b('0x38')](_0x1db684['query'],_0x4ebffa[_0x4f7b('0x2f')]),_0x3331b2);if(_0x1db684['query'][_0x4f7b('0x39')]){_0x1ccce0[_0x4f7b('0x37')]=_[_0x4f7b('0x3a')](_0x1ccce0['where'],{'$or':_[_0x4f7b('0x29')](_0x3331b2,function(_0x53da14){if(_0x53da14[_0x4f7b('0x2b')]!==_0x4f7b('0x3b')){var _0x49644e={};_0x49644e[_0x53da14['name']]={'$like':'%'+_0x1db684[_0x4f7b('0x2d')]['filter']+'%'};return _0x49644e;}})});}_0x1ccce0=_[_0x4f7b('0x3a')]({},_0x1ccce0,_0x1db684[_0x4f7b('0x3c')]);var _0x54f9e8={'where':_0x1ccce0[_0x4f7b('0x37')]};return db['WhatsappQueueReport']['count'](_0x54f9e8)['then'](function(_0x1e4421){_0xac1f93[_0x4f7b('0x1d')]=_0x1e4421;if(_0x1db684[_0x4f7b('0x2d')][_0x4f7b('0x3d')]){_0x1ccce0['include']=[{'all':!![]}];}return db[_0x4f7b('0x3e')]['findAll'](_0x1ccce0);})[_0x4f7b('0x24')](function(_0x586406){_0xac1f93[_0x4f7b('0x3f')]=_0x586406;return _0xac1f93;})['then'](respondWithFilteredResult(_0x3a56ff,_0x1ccce0))[_0x4f7b('0x40')](handleError(_0x3a56ff,null));};exports[_0x4f7b('0x41')]=function(_0x302163,_0x3ab08f){var _0x2986cd={'raw':!![],'where':{'id':_0x302163[_0x4f7b('0x42')]['id']}},_0x325cd6={};_0x325cd6[_0x4f7b('0x2c')]=_[_0x4f7b('0x2e')](db[_0x4f7b('0x3e')][_0x4f7b('0x2a')]);_0x325cd6[_0x4f7b('0x2d')]=_[_0x4f7b('0x2e')](_0x302163[_0x4f7b('0x2d')]);_0x325cd6[_0x4f7b('0x2f')]=_[_0x4f7b('0x30')](_0x325cd6[_0x4f7b('0x2c')],_0x325cd6[_0x4f7b('0x2d')]);_0x2986cd['attributes']=_['intersection'](_0x325cd6[_0x4f7b('0x2c')],qs[_0x4f7b('0x32')](_0x302163[_0x4f7b('0x2d')][_0x4f7b('0x32')]));_0x2986cd['attributes']=_0x2986cd['attributes'][_0x4f7b('0x33')]?_0x2986cd[_0x4f7b('0x31')]:_0x325cd6[_0x4f7b('0x2c')];if(_0x302163[_0x4f7b('0x2d')]['includeAll']){_0x2986cd['include']=[{'all':!![]}];}_0x2986cd=_[_0x4f7b('0x3a')]({},_0x2986cd,_0x302163[_0x4f7b('0x3c')]);return db[_0x4f7b('0x3e')][_0x4f7b('0x43')](_0x2986cd)[_0x4f7b('0x24')](handleEntityNotFound(_0x3ab08f,null))['then'](respondWithResult(_0x3ab08f,null))[_0x4f7b('0x40')](handleError(_0x3ab08f,null));};exports[_0x4f7b('0x44')]=function(_0x35c0ea,_0x5df68e){return db[_0x4f7b('0x3e')][_0x4f7b('0x44')](_0x35c0ea[_0x4f7b('0x45')],{})[_0x4f7b('0x24')](respondWithResult(_0x5df68e,0xc9))[_0x4f7b('0x40')](handleError(_0x5df68e,null));};exports[_0x4f7b('0x23')]=function(_0xee485,_0x2e563f){if(_0xee485[_0x4f7b('0x45')]['id']){delete _0xee485[_0x4f7b('0x45')]['id'];}return db['WhatsappQueueReport'][_0x4f7b('0x43')]({'where':{'id':_0xee485[_0x4f7b('0x42')]['id']}})[_0x4f7b('0x24')](handleEntityNotFound(_0x2e563f,null))['then'](saveUpdates(_0xee485[_0x4f7b('0x45')],null))[_0x4f7b('0x24')](respondWithResult(_0x2e563f,null))[_0x4f7b('0x40')](handleError(_0x2e563f,null));};exports[_0x4f7b('0x46')]=function(_0x145dd7,_0x7e624){return db[_0x4f7b('0x3e')][_0x4f7b('0x43')]({'where':{'id':_0x145dd7[_0x4f7b('0x42')]['id']}})[_0x4f7b('0x24')](handleEntityNotFound(_0x7e624,null))['then'](removeEntity(_0x7e624,null))[_0x4f7b('0x40')](handleError(_0x7e624,null));};exports[_0x4f7b('0x47')]=function(_0x12b6a6,_0x4d1ac9){return db[_0x4f7b('0x3e')][_0x4f7b('0x47')]()[_0x4f7b('0x24')](respondWithResult(_0x4d1ac9,null))[_0x4f7b('0x40')](handleError(_0x4d1ac9,null));}; \ No newline at end of file +var _0x3f8c=['end','json','offset','limit','count','Content-Range','reject','save','update','then','error','stack','name','send','index','WhatsappQueueReport','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','show','params','create','body','find','destroy','describe','zip-dir','fast-json-patch','request-promise','moment','to-csv','ejs','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'];(function(_0x25d9d2,_0x2109f1){var _0x4bc8c2=function(_0x252915){while(--_0x252915){_0x25d9d2['push'](_0x25d9d2['shift']());}};_0x4bc8c2(++_0x2109f1);}(_0x3f8c,0x104));var _0xc3f8=function(_0x36e414,_0x107225){_0x36e414=_0x36e414-0x0;var _0xc4c6e2=_0x3f8c[_0x36e414];return _0xc4c6e2;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc3f8('0x0'));var jsonpatch=require(_0xc3f8('0x1'));var rp=require(_0xc3f8('0x2'));var moment=require(_0xc3f8('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xc3f8('0x4'));var ejs=require(_0xc3f8('0x5'));var fs=require('fs');var fs_extra=require(_0xc3f8('0x6'));var _=require(_0xc3f8('0x7'));var squel=require(_0xc3f8('0x8'));var crypto=require(_0xc3f8('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xc3f8('0xa'));var toCsv=require(_0xc3f8('0x4'));var querystring=require(_0xc3f8('0xb'));var Papa=require(_0xc3f8('0xc'));var Redis=require(_0xc3f8('0xd'));var authService=require(_0xc3f8('0xe'));var qs=require(_0xc3f8('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc3f8('0x10'));var logger=require(_0xc3f8('0x11'))(_0xc3f8('0x12'));var utils=require(_0xc3f8('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xc3f8('0x14'));var db=require(_0xc3f8('0x15'))['db'];function respondWithStatusCode(_0x256e3d,_0x155c80){_0x155c80=_0x155c80||0xcc;return function(_0x511763){if(_0x511763){return _0x256e3d[_0xc3f8('0x16')](_0x155c80);}return _0x256e3d[_0xc3f8('0x17')](_0x155c80)[_0xc3f8('0x18')]();};}function respondWithResult(_0x44632a,_0x6155e9){_0x6155e9=_0x6155e9||0xc8;return function(_0x47754c){if(_0x47754c){return _0x44632a[_0xc3f8('0x17')](_0x6155e9)[_0xc3f8('0x19')](_0x47754c);}};}function respondWithFilteredResult(_0x12b141,_0x2fd8e8){return function(_0x3cb28a){if(_0x3cb28a){var _0x2a9f64=typeof _0x2fd8e8[_0xc3f8('0x1a')]==='undefined'&&typeof _0x2fd8e8[_0xc3f8('0x1b')]==='undefined';var _0x51807b=_0x3cb28a[_0xc3f8('0x1c')];var _0x2e7c0f=_0x2a9f64?0x0:_0x2fd8e8[_0xc3f8('0x1a')];var _0xb4ab67=_0x2a9f64?_0x3cb28a['count']:_0x2fd8e8[_0xc3f8('0x1a')]+_0x2fd8e8[_0xc3f8('0x1b')];var _0x5df6f9;if(_0xb4ab67>=_0x51807b){_0xb4ab67=_0x51807b;_0x5df6f9=0xc8;}else{_0x5df6f9=0xce;}_0x12b141[_0xc3f8('0x17')](_0x5df6f9);return _0x12b141['set'](_0xc3f8('0x1d'),_0x2e7c0f+'-'+_0xb4ab67+'/'+_0x51807b)[_0xc3f8('0x19')](_0x3cb28a);}return null;};}function patchUpdates(_0x3b2e98){return function(_0x53ada5){try{jsonpatch['apply'](_0x53ada5,_0x3b2e98,!![]);}catch(_0x113cd2){return BPromise[_0xc3f8('0x1e')](_0x113cd2);}return _0x53ada5[_0xc3f8('0x1f')]();};}function saveUpdates(_0x25a4c7,_0x6522e9){return function(_0x251bf7){if(_0x251bf7){return _0x251bf7[_0xc3f8('0x20')](_0x25a4c7)[_0xc3f8('0x21')](function(_0x49aeea){return _0x49aeea;});}return null;};}function removeEntity(_0x571f92,_0x4b83f0){return function(_0x2559a4){if(_0x2559a4){return _0x2559a4['destroy']()[_0xc3f8('0x21')](function(){_0x571f92[_0xc3f8('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4569c2,_0x327b2d){return function(_0x2d237e){if(!_0x2d237e){_0x4569c2[_0xc3f8('0x16')](0x194);}return _0x2d237e;};}function handleError(_0x25088f,_0x9d43b4){_0x9d43b4=_0x9d43b4||0x1f4;return function(_0xf1d460){logger[_0xc3f8('0x22')](_0xf1d460[_0xc3f8('0x23')]);if(_0xf1d460[_0xc3f8('0x24')]){delete _0xf1d460[_0xc3f8('0x24')];}_0x25088f[_0xc3f8('0x17')](_0x9d43b4)[_0xc3f8('0x25')](_0xf1d460);};}exports[_0xc3f8('0x26')]=function(_0x59e4dd,_0x58b303){var _0x2909f8={},_0x218029={},_0x5bf6e2={'count':0x0,'rows':[]};var _0x151bba=_['map'](db[_0xc3f8('0x27')][_0xc3f8('0x28')],function(_0x47ab53){return{'name':_0x47ab53['fieldName'],'type':_0x47ab53[_0xc3f8('0x29')][_0xc3f8('0x2a')]};});_0x218029[_0xc3f8('0x2b')]=_[_0xc3f8('0x2c')](_0x151bba,_0xc3f8('0x24'));_0x218029[_0xc3f8('0x2d')]=_[_0xc3f8('0x2e')](_0x59e4dd[_0xc3f8('0x2d')]);_0x218029[_0xc3f8('0x2f')]=_[_0xc3f8('0x30')](_0x218029['model'],_0x218029[_0xc3f8('0x2d')]);_0x2909f8[_0xc3f8('0x31')]=_[_0xc3f8('0x30')](_0x218029[_0xc3f8('0x2b')],qs[_0xc3f8('0x32')](_0x59e4dd['query']['fields']));_0x2909f8[_0xc3f8('0x31')]=_0x2909f8[_0xc3f8('0x31')][_0xc3f8('0x33')]?_0x2909f8[_0xc3f8('0x31')]:_0x218029[_0xc3f8('0x2b')];if(!_0x59e4dd['query'][_0xc3f8('0x34')](_0xc3f8('0x35'))){_0x2909f8[_0xc3f8('0x1b')]=qs['limit'](_0x59e4dd[_0xc3f8('0x2d')][_0xc3f8('0x1b')]);_0x2909f8[_0xc3f8('0x1a')]=qs['offset'](_0x59e4dd[_0xc3f8('0x2d')][_0xc3f8('0x1a')]);}_0x2909f8['order']=qs[_0xc3f8('0x36')](_0x59e4dd[_0xc3f8('0x2d')][_0xc3f8('0x36')]);_0x2909f8[_0xc3f8('0x37')]=qs[_0xc3f8('0x2f')](_[_0xc3f8('0x38')](_0x59e4dd['query'],_0x218029[_0xc3f8('0x2f')]),_0x151bba);if(_0x59e4dd[_0xc3f8('0x2d')][_0xc3f8('0x39')]){_0x2909f8[_0xc3f8('0x37')]=_[_0xc3f8('0x3a')](_0x2909f8['where'],{'$or':_[_0xc3f8('0x2c')](_0x151bba,function(_0x4451a2){if(_0x4451a2[_0xc3f8('0x29')]!=='VIRTUAL'){var _0x316643={};_0x316643[_0x4451a2[_0xc3f8('0x24')]]={'$like':'%'+_0x59e4dd[_0xc3f8('0x2d')][_0xc3f8('0x39')]+'%'};return _0x316643;}})});}_0x2909f8=_['merge']({},_0x2909f8,_0x59e4dd[_0xc3f8('0x3b')]);var _0x45d416={'where':_0x2909f8[_0xc3f8('0x37')]};return db[_0xc3f8('0x27')]['count'](_0x45d416)[_0xc3f8('0x21')](function(_0x5db44d){_0x5bf6e2['count']=_0x5db44d;if(_0x59e4dd[_0xc3f8('0x2d')][_0xc3f8('0x3c')]){_0x2909f8[_0xc3f8('0x3d')]=[{'all':!![]}];}return db[_0xc3f8('0x27')]['findAll'](_0x2909f8);})['then'](function(_0x361a85){_0x5bf6e2[_0xc3f8('0x3e')]=_0x361a85;return _0x5bf6e2;})[_0xc3f8('0x21')](respondWithFilteredResult(_0x58b303,_0x2909f8))[_0xc3f8('0x3f')](handleError(_0x58b303,null));};exports[_0xc3f8('0x40')]=function(_0x465547,_0x3113b4){var _0x45e6ea={'raw':!![],'where':{'id':_0x465547[_0xc3f8('0x41')]['id']}},_0x13d8dc={};_0x13d8dc[_0xc3f8('0x2b')]=_['keys'](db[_0xc3f8('0x27')][_0xc3f8('0x28')]);_0x13d8dc['query']=_[_0xc3f8('0x2e')](_0x465547[_0xc3f8('0x2d')]);_0x13d8dc['filters']=_[_0xc3f8('0x30')](_0x13d8dc[_0xc3f8('0x2b')],_0x13d8dc[_0xc3f8('0x2d')]);_0x45e6ea[_0xc3f8('0x31')]=_[_0xc3f8('0x30')](_0x13d8dc[_0xc3f8('0x2b')],qs[_0xc3f8('0x32')](_0x465547[_0xc3f8('0x2d')][_0xc3f8('0x32')]));_0x45e6ea[_0xc3f8('0x31')]=_0x45e6ea[_0xc3f8('0x31')]['length']?_0x45e6ea[_0xc3f8('0x31')]:_0x13d8dc[_0xc3f8('0x2b')];if(_0x465547['query'][_0xc3f8('0x3c')]){_0x45e6ea[_0xc3f8('0x3d')]=[{'all':!![]}];}_0x45e6ea=_[_0xc3f8('0x3a')]({},_0x45e6ea,_0x465547[_0xc3f8('0x3b')]);return db['WhatsappQueueReport']['find'](_0x45e6ea)[_0xc3f8('0x21')](handleEntityNotFound(_0x3113b4,null))[_0xc3f8('0x21')](respondWithResult(_0x3113b4,null))[_0xc3f8('0x3f')](handleError(_0x3113b4,null));};exports['create']=function(_0x1b5777,_0x3a665e){return db[_0xc3f8('0x27')][_0xc3f8('0x42')](_0x1b5777[_0xc3f8('0x43')],{})['then'](respondWithResult(_0x3a665e,0xc9))[_0xc3f8('0x3f')](handleError(_0x3a665e,null));};exports[_0xc3f8('0x20')]=function(_0x5961ab,_0x1becae){if(_0x5961ab[_0xc3f8('0x43')]['id']){delete _0x5961ab[_0xc3f8('0x43')]['id'];}return db[_0xc3f8('0x27')][_0xc3f8('0x44')]({'where':{'id':_0x5961ab[_0xc3f8('0x41')]['id']}})[_0xc3f8('0x21')](handleEntityNotFound(_0x1becae,null))['then'](saveUpdates(_0x5961ab[_0xc3f8('0x43')],null))[_0xc3f8('0x21')](respondWithResult(_0x1becae,null))['catch'](handleError(_0x1becae,null));};exports[_0xc3f8('0x45')]=function(_0x2e9f93,_0x2448bf){return db[_0xc3f8('0x27')][_0xc3f8('0x44')]({'where':{'id':_0x2e9f93[_0xc3f8('0x41')]['id']}})[_0xc3f8('0x21')](handleEntityNotFound(_0x2448bf,null))['then'](removeEntity(_0x2448bf,null))[_0xc3f8('0x3f')](handleError(_0x2448bf,null));};exports[_0xc3f8('0x46')]=function(_0x425fee,_0x267c95){return db[_0xc3f8('0x27')][_0xc3f8('0x46')]()[_0xc3f8('0x21')](respondWithResult(_0x267c95,null))[_0xc3f8('0x3f')](handleError(_0x267c95,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index fc41146..7cc2c90 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 _0x9711=['./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','util','api','moment','path','rimraf','../../config/environment'];(function(_0x4c440b,_0x3ea627){var _0x2d48cf=function(_0x56bac7){while(--_0x56bac7){_0x4c440b['push'](_0x4c440b['shift']());}};_0x2d48cf(++_0x3ea627);}(_0x9711,0x1a6));var _0x1971=function(_0x261142,_0x3a461b){_0x261142=_0x261142-0x0;var _0x3e7098=_0x9711[_0x261142];return _0x3e7098;};'use strict';var _=require(_0x1971('0x0'));var util=require(_0x1971('0x1'));var logger=require('../../config/logger')(_0x1971('0x2'));var moment=require(_0x1971('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1971('0x4'));var rimraf=require(_0x1971('0x5'));var config=require(_0x1971('0x6'));var attributes=require(_0x1971('0x7'));module[_0x1971('0x8')]=function(_0x3e297d,_0x45e529){return _0x3e297d[_0x1971('0x9')](_0x1971('0xa'),attributes,{'tableName':_0x1971('0xb'),'paranoid':![],'indexes':[{'name':_0x1971('0xc'),'fields':[_0x1971('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf718=['../../config/logger','api','request-promise','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','WhatsappQueueReport','report_whatsapp_queue','uniqueid','util'];(function(_0x237546,_0xa81b26){var _0x233e29=function(_0x728aa4){while(--_0x728aa4){_0x237546['push'](_0x237546['shift']());}};_0x233e29(++_0xa81b26);}(_0xf718,0x15f));var _0x8f71=function(_0x5758e4,_0x1eccd3){_0x5758e4=_0x5758e4-0x0;var _0x4ce273=_0xf718[_0x5758e4];return _0x4ce273;};'use strict';var _=require('lodash');var util=require(_0x8f71('0x0'));var logger=require(_0x8f71('0x1'))(_0x8f71('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8f71('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8f71('0x4'));var config=require(_0x8f71('0x5'));var attributes=require(_0x8f71('0x6'));module[_0x8f71('0x7')]=function(_0x239712,_0xb644d2){return _0x239712['define'](_0x8f71('0x8'),attributes,{'tableName':_0x8f71('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x8f71('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 15b45c8..9addf92 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 _0x39d0=['UpdateWhatsappQueueReport','WhatsappQueueReport','update','options','where','attributes','limit','then','stringify','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','error','code','WhatsappQueueReport,\x20%s,\x20%s','message','result','catch','create','body','raw','CreateWhatsappQueueReport'];(function(_0x3cadf9,_0x348a67){var _0x2fa3b9=function(_0x3a8df6){while(--_0x3a8df6){_0x3cadf9['push'](_0x3cadf9['shift']());}};_0x2fa3b9(++_0x348a67);}(_0x39d0,0x144));var _0x039d=function(_0x30f25a,_0x481cde){_0x30f25a=_0x30f25a-0x0;var _0x3620cf=_0x39d0[_0x30f25a];return _0x3620cf;};'use strict';var _=require(_0x039d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x039d('0x1'));var rs=require(_0x039d('0x2'));var fs=require('fs');var Redis=require(_0x039d('0x3'));var db=require(_0x039d('0x4'))['db'];var utils=require(_0x039d('0x5'));var logger=require('../../config/logger')(_0x039d('0x6'));var config=require(_0x039d('0x7'));var jayson=require(_0x039d('0x8'));var client=jayson[_0x039d('0x9')][_0x039d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x7dcc60,_0x2f8c4b,_0x4705e8){return new BPromise(function(_0x425f6e,_0x210090){return client[_0x039d('0xb')](_0x7dcc60,_0x4705e8)['then'](function(_0x591f97){logger[_0x039d('0xc')]('WhatsappQueueReport,\x20%s,\x20%s',_0x2f8c4b,_0x039d('0xd'));logger[_0x039d('0xe')](_0x039d('0xf'),_0x2f8c4b,_0x039d('0xd'),JSON['stringify'](_0x591f97));if(_0x591f97[_0x039d('0x10')]){if(_0x591f97[_0x039d('0x10')][_0x039d('0x11')]===0x1f4){logger['error'](_0x039d('0x12'),_0x2f8c4b,_0x591f97[_0x039d('0x10')][_0x039d('0x13')]);return _0x210090(_0x591f97[_0x039d('0x10')][_0x039d('0x13')]);}logger[_0x039d('0x10')](_0x039d('0x12'),_0x2f8c4b,_0x591f97['error']['message']);return _0x425f6e(_0x591f97[_0x039d('0x10')][_0x039d('0x13')]);}else{logger[_0x039d('0xc')](_0x039d('0x12'),_0x2f8c4b,_0x039d('0xd'));_0x425f6e(_0x591f97[_0x039d('0x14')]['message']);}})[_0x039d('0x15')](function(_0x226853){logger[_0x039d('0x10')]('WhatsappQueueReport,\x20%s,\x20%s',_0x2f8c4b,_0x226853);_0x210090(_0x226853);});});}exports['CreateWhatsappQueueReport']=function(_0xaedb24){var _0xb01eb1=this;return new Promise(function(_0x360233,_0x4fad10){return db['WhatsappQueueReport'][_0x039d('0x16')](_0xaedb24[_0x039d('0x17')],{'raw':_0xaedb24['options']?_0xaedb24['options'][_0x039d('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x2a8602){logger[_0x039d('0xc')]('CreateWhatsappQueueReport',_0xaedb24);logger[_0x039d('0xe')](_0x039d('0x19'),_0xaedb24,JSON['stringify'](_0x2a8602));_0x360233(_0x2a8602);})[_0x039d('0x15')](function(_0x15dcaa){logger[_0x039d('0x10')](_0x039d('0x19'),_0x15dcaa[_0x039d('0x13')],_0xaedb24);_0x4fad10(_0xb01eb1['error'](0x1f4,_0x15dcaa[_0x039d('0x13')]));});});};exports[_0x039d('0x1a')]=function(_0x15b103){var _0x4d3983=this;return new Promise(function(_0x7fc307,_0x4a3177){return db[_0x039d('0x1b')][_0x039d('0x1c')](_0x15b103[_0x039d('0x17')],{'raw':_0x15b103['options']?_0x15b103[_0x039d('0x1d')][_0x039d('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x15b103[_0x039d('0x1d')]?_0x15b103[_0x039d('0x1d')][_0x039d('0x1e')]||null:null,'attributes':_0x15b103[_0x039d('0x1d')]?_0x15b103[_0x039d('0x1d')][_0x039d('0x1f')]||null:null,'limit':_0x15b103[_0x039d('0x1d')]?_0x15b103[_0x039d('0x1d')][_0x039d('0x20')]||null:null})[_0x039d('0x21')](function(_0x3d3a40){logger[_0x039d('0xc')](_0x039d('0x1a'),_0x15b103);logger[_0x039d('0xe')](_0x039d('0x1a'),_0x15b103,JSON[_0x039d('0x22')](_0x3d3a40));_0x7fc307(_0x3d3a40);})[_0x039d('0x15')](function(_0xf477c5){logger[_0x039d('0x10')](_0x039d('0x1a'),_0xf477c5[_0x039d('0x13')],_0x15b103);_0x4a3177(_0x4d3983[_0x039d('0x10')](0x1f4,_0xf477c5[_0x039d('0x13')]));});});}; \ No newline at end of file +var _0x7f08=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','WhatsappQueueReport','body','options','raw','then','CreateWhatsappQueueReport','update','where','attributes','limit','UpdateWhatsappQueueReport','util','moment'];(function(_0x1986c0,_0x35a8cb){var _0xeb39d7=function(_0x147d29){while(--_0x147d29){_0x1986c0['push'](_0x1986c0['shift']());}};_0xeb39d7(++_0x35a8cb);}(_0x7f08,0xca));var _0x87f0=function(_0x1e5db8,_0x44ef41){_0x1e5db8=_0x1e5db8-0x0;var _0x219a51=_0x7f08[_0x1e5db8];return _0x219a51;};'use strict';var _=require('lodash');var util=require(_0x87f0('0x0'));var moment=require(_0x87f0('0x1'));var BPromise=require(_0x87f0('0x2'));var rs=require(_0x87f0('0x3'));var fs=require('fs');var Redis=require(_0x87f0('0x4'));var db=require(_0x87f0('0x5'))['db'];var utils=require(_0x87f0('0x6'));var logger=require(_0x87f0('0x7'))(_0x87f0('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x87f0('0x9')][_0x87f0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x10a287,_0x1ee03e,_0x5cf1a6){return new BPromise(function(_0x30779c,_0x5f588b){return client[_0x87f0('0xb')](_0x10a287,_0x5cf1a6)['then'](function(_0xfc204){logger[_0x87f0('0xc')](_0x87f0('0xd'),_0x1ee03e,_0x87f0('0xe'));logger[_0x87f0('0xf')](_0x87f0('0x10'),_0x1ee03e,'request\x20sent',JSON[_0x87f0('0x11')](_0xfc204));if(_0xfc204['error']){if(_0xfc204['error'][_0x87f0('0x12')]===0x1f4){logger[_0x87f0('0x13')](_0x87f0('0xd'),_0x1ee03e,_0xfc204[_0x87f0('0x13')][_0x87f0('0x14')]);return _0x5f588b(_0xfc204[_0x87f0('0x13')]['message']);}logger['error'](_0x87f0('0xd'),_0x1ee03e,_0xfc204['error'][_0x87f0('0x14')]);return _0x30779c(_0xfc204[_0x87f0('0x13')][_0x87f0('0x14')]);}else{logger['info'](_0x87f0('0xd'),_0x1ee03e,_0x87f0('0xe'));_0x30779c(_0xfc204[_0x87f0('0x15')][_0x87f0('0x14')]);}})[_0x87f0('0x16')](function(_0x3c2119){logger[_0x87f0('0x13')]('WhatsappQueueReport,\x20%s,\x20%s',_0x1ee03e,_0x3c2119);_0x5f588b(_0x3c2119);});});}exports['CreateWhatsappQueueReport']=function(_0x25695a){var _0xa373dd=this;return new Promise(function(_0x228f66,_0xcfa5bd){return db[_0x87f0('0x17')]['create'](_0x25695a[_0x87f0('0x18')],{'raw':_0x25695a[_0x87f0('0x19')]?_0x25695a['options'][_0x87f0('0x1a')]===undefined?!![]:![]:!![]})[_0x87f0('0x1b')](function(_0xb5effa){logger['info'](_0x87f0('0x1c'),_0x25695a);logger[_0x87f0('0xf')](_0x87f0('0x1c'),_0x25695a,JSON[_0x87f0('0x11')](_0xb5effa));_0x228f66(_0xb5effa);})[_0x87f0('0x16')](function(_0x481e28){logger['error']('CreateWhatsappQueueReport',_0x481e28[_0x87f0('0x14')],_0x25695a);_0xcfa5bd(_0xa373dd[_0x87f0('0x13')](0x1f4,_0x481e28['message']));});});};exports['UpdateWhatsappQueueReport']=function(_0x57b814){var _0x3f6804=this;return new Promise(function(_0xa37eed,_0x570481){return db[_0x87f0('0x17')][_0x87f0('0x1d')](_0x57b814[_0x87f0('0x18')],{'raw':_0x57b814[_0x87f0('0x19')]?_0x57b814[_0x87f0('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x57b814[_0x87f0('0x19')]?_0x57b814[_0x87f0('0x19')][_0x87f0('0x1e')]||null:null,'attributes':_0x57b814[_0x87f0('0x19')]?_0x57b814[_0x87f0('0x19')][_0x87f0('0x1f')]||null:null,'limit':_0x57b814[_0x87f0('0x19')]?_0x57b814[_0x87f0('0x19')][_0x87f0('0x20')]||null:null})[_0x87f0('0x1b')](function(_0x86a539){logger[_0x87f0('0xc')]('UpdateWhatsappQueueReport',_0x57b814);logger[_0x87f0('0xf')](_0x87f0('0x21'),_0x57b814,JSON[_0x87f0('0x11')](_0x86a539));_0xa37eed(_0x86a539);})[_0x87f0('0x16')](function(_0x49c8f9){logger['error'](_0x87f0('0x21'),_0x49c8f9[_0x87f0('0x14')],_0x57b814);_0x570481(_0x3f6804[_0x87f0('0x13')](0x1f4,_0x49c8f9[_0x87f0('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index a80d173..0f4083f 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 _0x2db4=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','describe','/:id','isAuthenticated','show','post','create','update','delete','util','path','express','Router','fs-extra'];(function(_0x103bcf,_0x6327f){var _0x55a3e5=function(_0x106ab6){while(--_0x106ab6){_0x103bcf['push'](_0x103bcf['shift']());}};_0x55a3e5(++_0x6327f);}(_0x2db4,0x164));var _0x42db=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x2db4[_0x110c3d];return _0x226d67;};'use strict';var multer=require('multer');var util=require(_0x42db('0x0'));var path=require(_0x42db('0x1'));var timeout=require('connect-timeout');var express=require(_0x42db('0x2'));var router=express[_0x42db('0x3')]();var fs_extra=require(_0x42db('0x4'));var auth=require(_0x42db('0x5'));var interaction=require(_0x42db('0x6'));var config=require(_0x42db('0x7'));var controller=require('./whatsappTransferReport.controller');router[_0x42db('0x8')]('/',auth['isAuthenticated'](),controller[_0x42db('0x9')]);router[_0x42db('0x8')](_0x42db('0xa'),auth['isAuthenticated'](),controller[_0x42db('0xb')]);router[_0x42db('0x8')](_0x42db('0xc'),auth[_0x42db('0xd')](),controller[_0x42db('0xe')]);router[_0x42db('0xf')]('/',auth[_0x42db('0xd')](),controller[_0x42db('0x10')]);router['put'](_0x42db('0xc'),auth[_0x42db('0xd')](),controller[_0x42db('0x11')]);router[_0x42db('0x12')](_0x42db('0xc'),auth[_0x42db('0xd')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xe772=['../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x41285f,_0x242ecb){var _0x358377=function(_0xb4f14d){while(--_0xb4f14d){_0x41285f['push'](_0x41285f['shift']());}};_0x358377(++_0x242ecb);}(_0xe772,0xba));var _0x2e77=function(_0x2a1e2d,_0x195473){_0x2a1e2d=_0x2a1e2d-0x0;var _0x32b8cc=_0xe772[_0x2a1e2d];return _0x32b8cc;};'use strict';var multer=require(_0x2e77('0x0'));var util=require(_0x2e77('0x1'));var path=require(_0x2e77('0x2'));var timeout=require(_0x2e77('0x3'));var express=require(_0x2e77('0x4'));var router=express['Router']();var fs_extra=require(_0x2e77('0x5'));var auth=require(_0x2e77('0x6'));var interaction=require(_0x2e77('0x7'));var config=require(_0x2e77('0x8'));var controller=require(_0x2e77('0x9'));router[_0x2e77('0xa')]('/',auth['isAuthenticated'](),controller[_0x2e77('0xb')]);router['get'](_0x2e77('0xc'),auth[_0x2e77('0xd')](),controller[_0x2e77('0xe')]);router[_0x2e77('0xa')](_0x2e77('0xf'),auth[_0x2e77('0xd')](),controller[_0x2e77('0x10')]);router[_0x2e77('0x11')]('/',auth[_0x2e77('0xd')](),controller[_0x2e77('0x12')]);router[_0x2e77('0x13')](_0x2e77('0xf'),auth[_0x2e77('0xd')](),controller[_0x2e77('0x14')]);router[_0x2e77('0x15')]('/:id',auth[_0x2e77('0xd')](),controller[_0x2e77('0x16')]);module[_0x2e77('0x17')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 92074e5..594a4ab 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 _0xa8b1=['queue','sequelize','exports','STRING','ENUM','account','agent'];(function(_0x432fca,_0xb0b1b5){var _0x3adba4=function(_0x5e3ae4){while(--_0x5e3ae4){_0x432fca['push'](_0x432fca['shift']());}};_0x3adba4(++_0xb0b1b5);}(_0xa8b1,0x182));var _0x1a8b=function(_0x17c42e,_0xe062c6){_0x17c42e=_0x17c42e-0x0;var _0x4a7b23=_0xa8b1[_0x17c42e];return _0x4a7b23;};'use strict';var Sequelize=require(_0x1a8b('0x0'));module[_0x1a8b('0x1')]={'uniqueid':{'type':Sequelize[_0x1a8b('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x1a8b('0x3')](_0x1a8b('0x4'),_0x1a8b('0x5'),_0x1a8b('0x6')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0xb627=['ENUM','agent','queue','DATE','sequelize'];(function(_0x583c99,_0x4b9160){var _0x9fe52c=function(_0x292d48){while(--_0x292d48){_0x583c99['push'](_0x583c99['shift']());}};_0x9fe52c(++_0x4b9160);}(_0xb627,0x144));var _0x7b62=function(_0x2e808e,_0x1ef440){_0x2e808e=_0x2e808e-0x0;var _0x58089c=_0xb627[_0x2e808e];return _0x58089c;};'use strict';var Sequelize=require(_0x7b62('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x7b62('0x1')]('account',_0x7b62('0x2'),_0x7b62('0x3')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x7b62('0x4')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 5145c58..8bfd7fc 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 _0x19b6=['nolimit','order','sort','where','pick','filters','filter','merge','map','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','find','body','update','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','desk.js','to-csv','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','then','error','name','send','index','WhatsappTransferReport','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty'];(function(_0x3d9a1e,_0x105e76){var _0x1cc4be=function(_0x16937a){while(--_0x16937a){_0x3d9a1e['push'](_0x3d9a1e['shift']());}};_0x1cc4be(++_0x105e76);}(_0x19b6,0xa6));var _0x619b=function(_0x101e7b,_0x4ef05b){_0x101e7b=_0x101e7b-0x0;var _0x4995c0=_0x19b6[_0x101e7b];return _0x4995c0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x619b('0x0'));var zipdir=require(_0x619b('0x1'));var jsonpatch=require(_0x619b('0x2'));var rp=require(_0x619b('0x3'));var moment=require(_0x619b('0x4'));var BPromise=require(_0x619b('0x5'));var Mustache=require(_0x619b('0x6'));var util=require(_0x619b('0x7'));var path=require(_0x619b('0x8'));var sox=require(_0x619b('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x619b('0xa'));var squel=require(_0x619b('0xb'));var crypto=require(_0x619b('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x619b('0xd'));var toCsv=require(_0x619b('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x619b('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x619b('0x10'));var as=require(_0x619b('0x11'));var hardwareService=require(_0x619b('0x12'));var logger=require(_0x619b('0x13'))(_0x619b('0x14'));var utils=require(_0x619b('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x619b('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x33b9b2,_0x27bc08){_0x27bc08=_0x27bc08||0xcc;return function(_0x5e2aec){if(_0x5e2aec){return _0x33b9b2[_0x619b('0x17')](_0x27bc08);}return _0x33b9b2[_0x619b('0x18')](_0x27bc08)[_0x619b('0x19')]();};}function respondWithResult(_0x1eb854,_0x18cab3){_0x18cab3=_0x18cab3||0xc8;return function(_0x28f3ee){if(_0x28f3ee){return _0x1eb854[_0x619b('0x18')](_0x18cab3)[_0x619b('0x1a')](_0x28f3ee);}};}function respondWithFilteredResult(_0x24a5ee,_0x4d088f){return function(_0x8b0618){if(_0x8b0618){var _0xfec75e=typeof _0x4d088f[_0x619b('0x1b')]===_0x619b('0x1c')&&typeof _0x4d088f[_0x619b('0x1d')]===_0x619b('0x1c');var _0x2998a8=_0x8b0618[_0x619b('0x1e')];var _0x9bd7a1=_0xfec75e?0x0:_0x4d088f[_0x619b('0x1b')];var _0x9e8bc2=_0xfec75e?_0x8b0618[_0x619b('0x1e')]:_0x4d088f['offset']+_0x4d088f[_0x619b('0x1d')];var _0x131e09;if(_0x9e8bc2>=_0x2998a8){_0x9e8bc2=_0x2998a8;_0x131e09=0xc8;}else{_0x131e09=0xce;}_0x24a5ee[_0x619b('0x18')](_0x131e09);return _0x24a5ee[_0x619b('0x1f')]('Content-Range',_0x9bd7a1+'-'+_0x9e8bc2+'/'+_0x2998a8)[_0x619b('0x1a')](_0x8b0618);}return null;};}function patchUpdates(_0x4b0bbe){return function(_0x338821){try{jsonpatch[_0x619b('0x20')](_0x338821,_0x4b0bbe,!![]);}catch(_0x14c002){return BPromise['reject'](_0x14c002);}return _0x338821['save']();};}function saveUpdates(_0x21dbeb,_0x446ee0){return function(_0x26a8ef){if(_0x26a8ef){return _0x26a8ef['update'](_0x21dbeb)[_0x619b('0x21')](function(_0x590f2e){return _0x590f2e;});}return null;};}function removeEntity(_0x1db9fe,_0x36a6cf){return function(_0x333fbd){if(_0x333fbd){return _0x333fbd['destroy']()[_0x619b('0x21')](function(){_0x1db9fe[_0x619b('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x42cec3,_0x19a185){return function(_0x3a645f){if(!_0x3a645f){_0x42cec3[_0x619b('0x17')](0x194);}return _0x3a645f;};}function handleError(_0x336b3d,_0x4b7253){_0x4b7253=_0x4b7253||0x1f4;return function(_0x50332c){logger[_0x619b('0x22')](_0x50332c['stack']);if(_0x50332c[_0x619b('0x23')]){delete _0x50332c[_0x619b('0x23')];}_0x336b3d[_0x619b('0x18')](_0x4b7253)[_0x619b('0x24')](_0x50332c);};}exports[_0x619b('0x25')]=function(_0x3287ee,_0x32a38f){var _0x548c55={},_0x5ca2f8={},_0x39cc08={'count':0x0,'rows':[]};var _0x4493b1=_['map'](db[_0x619b('0x26')][_0x619b('0x27')],function(_0xfcf678){return{'name':_0xfcf678[_0x619b('0x28')],'type':_0xfcf678[_0x619b('0x29')][_0x619b('0x2a')]};});_0x5ca2f8[_0x619b('0x2b')]=_['map'](_0x4493b1,_0x619b('0x23'));_0x5ca2f8[_0x619b('0x2c')]=_['keys'](_0x3287ee[_0x619b('0x2c')]);_0x5ca2f8['filters']=_[_0x619b('0x2d')](_0x5ca2f8[_0x619b('0x2b')],_0x5ca2f8[_0x619b('0x2c')]);_0x548c55['attributes']=_[_0x619b('0x2d')](_0x5ca2f8[_0x619b('0x2b')],qs['fields'](_0x3287ee[_0x619b('0x2c')][_0x619b('0x2e')]));_0x548c55['attributes']=_0x548c55[_0x619b('0x2f')][_0x619b('0x30')]?_0x548c55[_0x619b('0x2f')]:_0x5ca2f8[_0x619b('0x2b')];if(!_0x3287ee[_0x619b('0x2c')][_0x619b('0x31')](_0x619b('0x32'))){_0x548c55[_0x619b('0x1d')]=qs[_0x619b('0x1d')](_0x3287ee[_0x619b('0x2c')][_0x619b('0x1d')]);_0x548c55['offset']=qs[_0x619b('0x1b')](_0x3287ee[_0x619b('0x2c')][_0x619b('0x1b')]);}_0x548c55[_0x619b('0x33')]=qs[_0x619b('0x34')](_0x3287ee[_0x619b('0x2c')]['sort']);_0x548c55[_0x619b('0x35')]=qs['filters'](_[_0x619b('0x36')](_0x3287ee[_0x619b('0x2c')],_0x5ca2f8[_0x619b('0x37')]),_0x4493b1);if(_0x3287ee[_0x619b('0x2c')][_0x619b('0x38')]){_0x548c55['where']=_[_0x619b('0x39')](_0x548c55[_0x619b('0x35')],{'$or':_[_0x619b('0x3a')](_0x4493b1,function(_0x56db10){if(_0x56db10[_0x619b('0x29')]!==_0x619b('0x3b')){var _0x578752={};_0x578752[_0x56db10[_0x619b('0x23')]]={'$like':'%'+_0x3287ee[_0x619b('0x2c')][_0x619b('0x38')]+'%'};return _0x578752;}})});}_0x548c55=_['merge']({},_0x548c55,_0x3287ee['options']);var _0x1293c1={'where':_0x548c55[_0x619b('0x35')]};return db[_0x619b('0x26')][_0x619b('0x1e')](_0x1293c1)['then'](function(_0x3cf5fa){_0x39cc08[_0x619b('0x1e')]=_0x3cf5fa;if(_0x3287ee['query'][_0x619b('0x3c')]){_0x548c55[_0x619b('0x3d')]=[{'all':!![]}];}return db['WhatsappTransferReport'][_0x619b('0x3e')](_0x548c55);})[_0x619b('0x21')](function(_0x2b300d){_0x39cc08[_0x619b('0x3f')]=_0x2b300d;return _0x39cc08;})[_0x619b('0x21')](respondWithFilteredResult(_0x32a38f,_0x548c55))[_0x619b('0x40')](handleError(_0x32a38f,null));};exports[_0x619b('0x41')]=function(_0x5974fb,_0x45934c){var _0x3e34a1={'raw':!![],'where':{'id':_0x5974fb[_0x619b('0x42')]['id']}},_0x4c0083={};_0x4c0083[_0x619b('0x2b')]=_['keys'](db[_0x619b('0x26')][_0x619b('0x27')]);_0x4c0083['query']=_['keys'](_0x5974fb[_0x619b('0x2c')]);_0x4c0083[_0x619b('0x37')]=_[_0x619b('0x2d')](_0x4c0083[_0x619b('0x2b')],_0x4c0083[_0x619b('0x2c')]);_0x3e34a1[_0x619b('0x2f')]=_[_0x619b('0x2d')](_0x4c0083[_0x619b('0x2b')],qs[_0x619b('0x2e')](_0x5974fb['query'][_0x619b('0x2e')]));_0x3e34a1['attributes']=_0x3e34a1[_0x619b('0x2f')][_0x619b('0x30')]?_0x3e34a1['attributes']:_0x4c0083[_0x619b('0x2b')];if(_0x5974fb[_0x619b('0x2c')][_0x619b('0x3c')]){_0x3e34a1[_0x619b('0x3d')]=[{'all':!![]}];}_0x3e34a1=_[_0x619b('0x39')]({},_0x3e34a1,_0x5974fb['options']);return db[_0x619b('0x26')][_0x619b('0x43')](_0x3e34a1)['then'](handleEntityNotFound(_0x45934c,null))[_0x619b('0x21')](respondWithResult(_0x45934c,null))[_0x619b('0x40')](handleError(_0x45934c,null));};exports['create']=function(_0x1ac657,_0x10a2a7){return db[_0x619b('0x26')]['create'](_0x1ac657[_0x619b('0x44')],{})['then'](respondWithResult(_0x10a2a7,0xc9))[_0x619b('0x40')](handleError(_0x10a2a7,null));};exports[_0x619b('0x45')]=function(_0x4dc12e,_0x45315a){if(_0x4dc12e[_0x619b('0x44')]['id']){delete _0x4dc12e[_0x619b('0x44')]['id'];}return db[_0x619b('0x26')][_0x619b('0x43')]({'where':{'id':_0x4dc12e[_0x619b('0x42')]['id']}})['then'](handleEntityNotFound(_0x45315a,null))[_0x619b('0x21')](saveUpdates(_0x4dc12e[_0x619b('0x44')],null))[_0x619b('0x21')](respondWithResult(_0x45315a,null))['catch'](handleError(_0x45315a,null));};exports[_0x619b('0x46')]=function(_0x34ba41,_0x1e0616){return db['WhatsappTransferReport'][_0x619b('0x43')]({'where':{'id':_0x34ba41[_0x619b('0x42')]['id']}})[_0x619b('0x21')](handleEntityNotFound(_0x1e0616,null))[_0x619b('0x21')](removeEntity(_0x1e0616,null))[_0x619b('0x40')](handleError(_0x1e0616,null));};exports[_0x619b('0x47')]=function(_0x1204e1,_0x16ec74){return db['WhatsappTransferReport'][_0x619b('0x47')]()['then'](respondWithResult(_0x16ec74,null))[_0x619b('0x40')](handleError(_0x16ec74,null));}; \ No newline at end of file +var _0xe285=['find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','ejs','fs-extra','lodash','squel','crypto','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','Content-Range','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','index','map','WhatsappTransferReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','count','include','rows','catch','show','params','rawAttributes','includeAll'];(function(_0x4a2490,_0x4d0cc2){var _0x206738=function(_0x161e9f){while(--_0x161e9f){_0x4a2490['push'](_0x4a2490['shift']());}};_0x206738(++_0x4d0cc2);}(_0xe285,0xe5));var _0x5e28=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0xe285[_0x334841];return _0x5beb4b;};'use strict';var emlformat=require(_0x5e28('0x0'));var rimraf=require(_0x5e28('0x1'));var zipdir=require(_0x5e28('0x2'));var jsonpatch=require(_0x5e28('0x3'));var rp=require(_0x5e28('0x4'));var moment=require(_0x5e28('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x5e28('0x6'));var sox=require(_0x5e28('0x7'));var csv=require('to-csv');var ejs=require(_0x5e28('0x8'));var fs=require('fs');var fs_extra=require(_0x5e28('0x9'));var _=require(_0x5e28('0xa'));var squel=require(_0x5e28('0xb'));var crypto=require(_0x5e28('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x5e28('0xd'));var querystring=require(_0x5e28('0xe'));var Papa=require('papaparse');var Redis=require(_0x5e28('0xf'));var authService=require(_0x5e28('0x10'));var qs=require(_0x5e28('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5e28('0x12'));var logger=require('../../config/logger')(_0x5e28('0x13'));var utils=require(_0x5e28('0x14'));var config=require(_0x5e28('0x15'));var licenseUtil=require(_0x5e28('0x16'));var db=require(_0x5e28('0x17'))['db'];function respondWithStatusCode(_0x54ee23,_0x1699e9){_0x1699e9=_0x1699e9||0xcc;return function(_0x1e88ea){if(_0x1e88ea){return _0x54ee23['sendStatus'](_0x1699e9);}return _0x54ee23[_0x5e28('0x18')](_0x1699e9)[_0x5e28('0x19')]();};}function respondWithResult(_0x425fd1,_0xc08077){_0xc08077=_0xc08077||0xc8;return function(_0x78d5aa){if(_0x78d5aa){return _0x425fd1[_0x5e28('0x18')](_0xc08077)[_0x5e28('0x1a')](_0x78d5aa);}};}function respondWithFilteredResult(_0x59625a,_0x353e87){return function(_0x1b24e6){if(_0x1b24e6){var _0x1a818b=typeof _0x353e87[_0x5e28('0x1b')]===_0x5e28('0x1c')&&typeof _0x353e87[_0x5e28('0x1d')]==='undefined';var _0x21abfd=_0x1b24e6['count'];var _0x26ab74=_0x1a818b?0x0:_0x353e87['offset'];var _0x5ab4d7=_0x1a818b?_0x1b24e6['count']:_0x353e87[_0x5e28('0x1b')]+_0x353e87[_0x5e28('0x1d')];var _0x5b9a60;if(_0x5ab4d7>=_0x21abfd){_0x5ab4d7=_0x21abfd;_0x5b9a60=0xc8;}else{_0x5b9a60=0xce;}_0x59625a[_0x5e28('0x18')](_0x5b9a60);return _0x59625a['set'](_0x5e28('0x1e'),_0x26ab74+'-'+_0x5ab4d7+'/'+_0x21abfd)[_0x5e28('0x1a')](_0x1b24e6);}return null;};}function patchUpdates(_0x515233){return function(_0xb16025){try{jsonpatch[_0x5e28('0x1f')](_0xb16025,_0x515233,!![]);}catch(_0x4dc9ea){return BPromise[_0x5e28('0x20')](_0x4dc9ea);}return _0xb16025[_0x5e28('0x21')]();};}function saveUpdates(_0x5e2aad,_0x1b2b7b){return function(_0x2c5f1d){if(_0x2c5f1d){return _0x2c5f1d['update'](_0x5e2aad)[_0x5e28('0x22')](function(_0x44b1f3){return _0x44b1f3;});}return null;};}function removeEntity(_0x4592fc,_0x3db322){return function(_0x4874cd){if(_0x4874cd){return _0x4874cd[_0x5e28('0x23')]()['then'](function(){_0x4592fc['status'](0xcc)[_0x5e28('0x19')]();});}};}function handleEntityNotFound(_0x448614,_0x128551){return function(_0x3cd329){if(!_0x3cd329){_0x448614[_0x5e28('0x24')](0x194);}return _0x3cd329;};}function handleError(_0x24955b,_0x46e0f7){_0x46e0f7=_0x46e0f7||0x1f4;return function(_0x2081cb){logger[_0x5e28('0x25')](_0x2081cb[_0x5e28('0x26')]);if(_0x2081cb[_0x5e28('0x27')]){delete _0x2081cb['name'];}_0x24955b[_0x5e28('0x18')](_0x46e0f7)[_0x5e28('0x28')](_0x2081cb);};}exports[_0x5e28('0x29')]=function(_0x15f050,_0x4f9f82){var _0x26fcb1={},_0x43fbcd={},_0x8e2665={'count':0x0,'rows':[]};var _0x10d8af=_[_0x5e28('0x2a')](db[_0x5e28('0x2b')]['rawAttributes'],function(_0x2502c7){return{'name':_0x2502c7[_0x5e28('0x2c')],'type':_0x2502c7[_0x5e28('0x2d')][_0x5e28('0x2e')]};});_0x43fbcd[_0x5e28('0x2f')]=_[_0x5e28('0x2a')](_0x10d8af,_0x5e28('0x27'));_0x43fbcd[_0x5e28('0x30')]=_[_0x5e28('0x31')](_0x15f050[_0x5e28('0x30')]);_0x43fbcd[_0x5e28('0x32')]=_[_0x5e28('0x33')](_0x43fbcd[_0x5e28('0x2f')],_0x43fbcd['query']);_0x26fcb1[_0x5e28('0x34')]=_['intersection'](_0x43fbcd[_0x5e28('0x2f')],qs[_0x5e28('0x35')](_0x15f050[_0x5e28('0x30')]['fields']));_0x26fcb1[_0x5e28('0x34')]=_0x26fcb1['attributes'][_0x5e28('0x36')]?_0x26fcb1[_0x5e28('0x34')]:_0x43fbcd[_0x5e28('0x2f')];if(!_0x15f050['query'][_0x5e28('0x37')](_0x5e28('0x38'))){_0x26fcb1[_0x5e28('0x1d')]=qs[_0x5e28('0x1d')](_0x15f050['query'][_0x5e28('0x1d')]);_0x26fcb1[_0x5e28('0x1b')]=qs['offset'](_0x15f050[_0x5e28('0x30')][_0x5e28('0x1b')]);}_0x26fcb1[_0x5e28('0x39')]=qs[_0x5e28('0x3a')](_0x15f050[_0x5e28('0x30')][_0x5e28('0x3a')]);_0x26fcb1[_0x5e28('0x3b')]=qs[_0x5e28('0x32')](_[_0x5e28('0x3c')](_0x15f050[_0x5e28('0x30')],_0x43fbcd[_0x5e28('0x32')]),_0x10d8af);if(_0x15f050[_0x5e28('0x30')][_0x5e28('0x3d')]){_0x26fcb1['where']=_['merge'](_0x26fcb1['where'],{'$or':_[_0x5e28('0x2a')](_0x10d8af,function(_0x16e65c){if(_0x16e65c[_0x5e28('0x2d')]!=='VIRTUAL'){var _0x31a190={};_0x31a190[_0x16e65c[_0x5e28('0x27')]]={'$like':'%'+_0x15f050['query'][_0x5e28('0x3d')]+'%'};return _0x31a190;}})});}_0x26fcb1=_['merge']({},_0x26fcb1,_0x15f050[_0x5e28('0x3e')]);var _0x54b44f={'where':_0x26fcb1[_0x5e28('0x3b')]};return db[_0x5e28('0x2b')][_0x5e28('0x3f')](_0x54b44f)['then'](function(_0x3bc9e4){_0x8e2665[_0x5e28('0x3f')]=_0x3bc9e4;if(_0x15f050[_0x5e28('0x30')]['includeAll']){_0x26fcb1[_0x5e28('0x40')]=[{'all':!![]}];}return db['WhatsappTransferReport']['findAll'](_0x26fcb1);})['then'](function(_0x10f862){_0x8e2665[_0x5e28('0x41')]=_0x10f862;return _0x8e2665;})[_0x5e28('0x22')](respondWithFilteredResult(_0x4f9f82,_0x26fcb1))[_0x5e28('0x42')](handleError(_0x4f9f82,null));};exports[_0x5e28('0x43')]=function(_0x32ec2a,_0xed1d86){var _0x5d1a58={'raw':!![],'where':{'id':_0x32ec2a[_0x5e28('0x44')]['id']}},_0x51c40d={};_0x51c40d[_0x5e28('0x2f')]=_['keys'](db[_0x5e28('0x2b')][_0x5e28('0x45')]);_0x51c40d[_0x5e28('0x30')]=_['keys'](_0x32ec2a[_0x5e28('0x30')]);_0x51c40d[_0x5e28('0x32')]=_['intersection'](_0x51c40d['model'],_0x51c40d['query']);_0x5d1a58[_0x5e28('0x34')]=_[_0x5e28('0x33')](_0x51c40d[_0x5e28('0x2f')],qs[_0x5e28('0x35')](_0x32ec2a[_0x5e28('0x30')]['fields']));_0x5d1a58['attributes']=_0x5d1a58[_0x5e28('0x34')][_0x5e28('0x36')]?_0x5d1a58['attributes']:_0x51c40d[_0x5e28('0x2f')];if(_0x32ec2a[_0x5e28('0x30')][_0x5e28('0x46')]){_0x5d1a58[_0x5e28('0x40')]=[{'all':!![]}];}_0x5d1a58=_['merge']({},_0x5d1a58,_0x32ec2a[_0x5e28('0x3e')]);return db[_0x5e28('0x2b')][_0x5e28('0x47')](_0x5d1a58)[_0x5e28('0x22')](handleEntityNotFound(_0xed1d86,null))[_0x5e28('0x22')](respondWithResult(_0xed1d86,null))['catch'](handleError(_0xed1d86,null));};exports[_0x5e28('0x48')]=function(_0x506821,_0x1d0b5a){return db[_0x5e28('0x2b')]['create'](_0x506821[_0x5e28('0x49')],{})[_0x5e28('0x22')](respondWithResult(_0x1d0b5a,0xc9))[_0x5e28('0x42')](handleError(_0x1d0b5a,null));};exports['update']=function(_0x5931c8,_0x573a36){if(_0x5931c8[_0x5e28('0x49')]['id']){delete _0x5931c8[_0x5e28('0x49')]['id'];}return db[_0x5e28('0x2b')][_0x5e28('0x47')]({'where':{'id':_0x5931c8['params']['id']}})[_0x5e28('0x22')](handleEntityNotFound(_0x573a36,null))[_0x5e28('0x22')](saveUpdates(_0x5931c8[_0x5e28('0x49')],null))[_0x5e28('0x22')](respondWithResult(_0x573a36,null))[_0x5e28('0x42')](handleError(_0x573a36,null));};exports[_0x5e28('0x23')]=function(_0xcc11d2,_0x1662c1){return db['WhatsappTransferReport'][_0x5e28('0x47')]({'where':{'id':_0xcc11d2['params']['id']}})[_0x5e28('0x22')](handleEntityNotFound(_0x1662c1,null))[_0x5e28('0x22')](removeEntity(_0x1662c1,null))[_0x5e28('0x42')](handleError(_0x1662c1,null));};exports['describe']=function(_0x260adb,_0x1be7d5){return db['WhatsappTransferReport'][_0x5e28('0x4a')]()[_0x5e28('0x22')](respondWithResult(_0x1be7d5,null))['catch'](handleError(_0x1be7d5,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 8f75ebc..a38d2c6 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 _0xd6c2=['uniqueid','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','define','report_whatsapp_transfer'];(function(_0x196d0a,_0x14eba8){var _0x1b63d8=function(_0x405583){while(--_0x405583){_0x196d0a['push'](_0x196d0a['shift']());}};_0x1b63d8(++_0x14eba8);}(_0xd6c2,0xe5));var _0x2d6c=function(_0x7bec8f,_0x1a4c91){_0x7bec8f=_0x7bec8f-0x0;var _0x2b36d0=_0xd6c2[_0x7bec8f];return _0x2b36d0;};'use strict';var _=require('lodash');var util=require(_0x2d6c('0x0'));var logger=require(_0x2d6c('0x1'))(_0x2d6c('0x2'));var moment=require('moment');var BPromise=require(_0x2d6c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2d6c('0x4'));var rimraf=require(_0x2d6c('0x5'));var config=require(_0x2d6c('0x6'));var attributes=require(_0x2d6c('0x7'));module[_0x2d6c('0x8')]=function(_0x40b0d0,_0xb19558){return _0x40b0d0[_0x2d6c('0x9')]('WhatsappTransferReport',attributes,{'tableName':_0x2d6c('0xa'),'paranoid':![],'indexes':[{'name':_0x2d6c('0xb'),'fields':[_0x2d6c('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd691=['define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','../../config/logger','api','moment','bluebird','../../config/environment','exports'];(function(_0x4e9adc,_0x24386d){var _0x4dd205=function(_0x5f439b){while(--_0x5f439b){_0x4e9adc['push'](_0x4e9adc['shift']());}};_0x4dd205(++_0x24386d);}(_0xd691,0x138));var _0x1d69=function(_0x4bec28,_0x3138a9){_0x4bec28=_0x4bec28-0x0;var _0x36cd6e=_0xd691[_0x4bec28];return _0x36cd6e;};'use strict';var _=require(_0x1d69('0x0'));var util=require('util');var logger=require(_0x1d69('0x1'))(_0x1d69('0x2'));var moment=require(_0x1d69('0x3'));var BPromise=require(_0x1d69('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1d69('0x5'));var attributes=require('./whatsappTransferReport.attributes');module[_0x1d69('0x6')]=function(_0x477733,_0xc2688f){return _0x477733[_0x1d69('0x7')](_0x1d69('0x8'),attributes,{'tableName':_0x1d69('0x9'),'paranoid':![],'indexes':[{'name':_0x1d69('0xa'),'fields':[_0x1d69('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 326b551..cd2ff3b 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 _0x5362=['lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x5362,0x14a));var _0x2536=function(_0x2368bf,_0x4174a7){_0x2368bf=_0x2368bf-0x0;var _0x19a3a4=_0x5362[_0x2368bf];return _0x19a3a4;};'use strict';var _=require(_0x2536('0x0'));var util=require(_0x2536('0x1'));var moment=require('moment');var BPromise=require(_0x2536('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2536('0x3'))['db'];var utils=require(_0x2536('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x2536('0x5'));var jayson=require(_0x2536('0x6'));var client=jayson[_0x2536('0x7')][_0x2536('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x6847d0,_0x47a8b5,_0xc1c742){return new BPromise(function(_0x1b691b,_0x31eb7f){return client[_0x2536('0x9')](_0x6847d0,_0xc1c742)[_0x2536('0xa')](function(_0x5c1f71){logger['info'](_0x2536('0xb'),_0x47a8b5,_0x2536('0xc'));logger[_0x2536('0xd')](_0x2536('0xe'),_0x47a8b5,_0x2536('0xc'),JSON[_0x2536('0xf')](_0x5c1f71));if(_0x5c1f71[_0x2536('0x10')]){if(_0x5c1f71[_0x2536('0x10')][_0x2536('0x11')]===0x1f4){logger[_0x2536('0x10')](_0x2536('0xb'),_0x47a8b5,_0x5c1f71[_0x2536('0x10')][_0x2536('0x12')]);return _0x31eb7f(_0x5c1f71[_0x2536('0x10')][_0x2536('0x12')]);}logger['error'](_0x2536('0xb'),_0x47a8b5,_0x5c1f71[_0x2536('0x10')][_0x2536('0x12')]);return _0x1b691b(_0x5c1f71[_0x2536('0x10')]['message']);}else{logger[_0x2536('0x13')](_0x2536('0xb'),_0x47a8b5,_0x2536('0xc'));_0x1b691b(_0x5c1f71[_0x2536('0x14')]['message']);}})[_0x2536('0x15')](function(_0x519e6c){logger['error'](_0x2536('0xb'),_0x47a8b5,_0x519e6c);_0x31eb7f(_0x519e6c);});});} \ No newline at end of file +var _0x0144=['moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util'];(function(_0x5b7c86,_0xb73732){var _0x56a21c=function(_0x4c264a){while(--_0x4c264a){_0x5b7c86['push'](_0x5b7c86['shift']());}};_0x56a21c(++_0xb73732);}(_0x0144,0xee));var _0x4014=function(_0x1aba25,_0x1faed1){_0x1aba25=_0x1aba25-0x0;var _0x47d997=_0x0144[_0x1aba25];return _0x47d997;};'use strict';var _=require(_0x4014('0x0'));var util=require(_0x4014('0x1'));var moment=require(_0x4014('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4014('0x3'));var db=require(_0x4014('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4014('0x5'))(_0x4014('0x6'));var config=require(_0x4014('0x7'));var jayson=require(_0x4014('0x8'));var client=jayson[_0x4014('0x9')][_0x4014('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x24d28d,_0x4b062b,_0x2bf527){return new BPromise(function(_0x5708e4,_0x1d99d2){return client['request'](_0x24d28d,_0x2bf527)['then'](function(_0x5647c3){logger[_0x4014('0xb')](_0x4014('0xc'),_0x4b062b,_0x4014('0xd'));logger['debug'](_0x4014('0xe'),_0x4b062b,'request\x20sent',JSON['stringify'](_0x5647c3));if(_0x5647c3['error']){if(_0x5647c3[_0x4014('0xf')][_0x4014('0x10')]===0x1f4){logger['error'](_0x4014('0xc'),_0x4b062b,_0x5647c3['error']['message']);return _0x1d99d2(_0x5647c3[_0x4014('0xf')][_0x4014('0x11')]);}logger[_0x4014('0xf')](_0x4014('0xc'),_0x4b062b,_0x5647c3['error'][_0x4014('0x11')]);return _0x5708e4(_0x5647c3[_0x4014('0xf')][_0x4014('0x11')]);}else{logger[_0x4014('0xb')]('WhatsappTransferReport,\x20%s,\x20%s',_0x4b062b,'request\x20sent');_0x5708e4(_0x5647c3[_0x4014('0x12')][_0x4014('0x11')]);}})[_0x4014('0x13')](function(_0x3f7d04){logger[_0x4014('0xf')]('WhatsappTransferReport,\x20%s,\x20%s',_0x4b062b,_0x3f7d04);_0x1d99d2(_0x3f7d04);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 76d04e7..c22a495 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0c75=['./rpc','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule/chat','./config/schedule/transcribe','sequelize','sync','then','default','listen','info','start','filter','exitCode','number','length','\x20processes\x20failed\x20at\x20startup:\x20','pm2_env','name','Online\x20apps:','online','join','Offline\x20apps:','map','status','None','log','App\x20Ready!','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','./mysqldb','./config/license'];(function(_0x279962,_0x2560f5){var _0x4d6d94=function(_0x482e54){while(--_0x482e54){_0x279962['push'](_0x279962['shift']());}};_0x4d6d94(++_0x2560f5);}(_0x0c75,0x6a));var _0x50c7=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x0c75[_0x2641f9];return _0x585741;};'use strict';var _=require('lodash');var db=require(_0x50c7('0x0'))['db'];var seedDb=require('./config/seedDB');var checkLicense=require(_0x50c7('0x1'));var rpc=require(_0x50c7('0x2'));var config=require(_0x50c7('0x3'));var logger=require(_0x50c7('0x4'))(_0x50c7('0x5'));var pm2=require(_0x50c7('0x6'));var pm2Config=require(_0x50c7('0x7'));var schedule=require('./config/schedule');var chat=require(_0x50c7('0x8'));var whatsapp=require('./config/schedule/whatsapp');var transcribe=require(_0x50c7('0x9'));var provider=require('./config/schedule/cloud-provider');function main(){return db[_0x50c7('0xa')][_0x50c7('0xb')]()[_0x50c7('0xc')](function(){if(config['seedDB']){return seedDb['default']();}})[_0x50c7('0xc')](function(){return checkLicense[_0x50c7('0xd')]();})[_0x50c7('0xc')](function(){return rpc[_0x50c7('0xe')]();})[_0x50c7('0xc')](function(_0x439417){logger[_0x50c7('0xf')](_0x439417);return chat['start']();})['then'](function(){return whatsapp[_0x50c7('0x10')]();})[_0x50c7('0xc')](function(){return schedule[_0x50c7('0x10')]();})['then'](function(){return transcribe[_0x50c7('0x10')]();})[_0x50c7('0xc')](function(){return provider[_0x50c7('0x10')]();})[_0x50c7('0xc')](function(_0x1e2dc5){logger['info'](_0x1e2dc5);return pm2['start'](pm2Config);})[_0x50c7('0xc')](function(_0x303a64){var _0x5c8fa7=_0x303a64[_0x50c7('0x11')](function(_0x1f1db1){return typeof _0x1f1db1[_0x50c7('0x12')]===_0x50c7('0x13')&&_0x1f1db1['exitCode']>=0x0;});if(_0x5c8fa7[_0x50c7('0x14')]>0x0){throw new Error(_0x5c8fa7[_0x50c7('0x14')]+_0x50c7('0x15')+_['map'](_0x5c8fa7,function(_0x473375){return'\x22'+_0x473375[_0x50c7('0x16')][_0x50c7('0x17')]+'\x22';}));}logger['info'](_0x50c7('0x18'),_['map'](_[_0x50c7('0x11')](_0x303a64,{'status':_0x50c7('0x19')}),_0x50c7('0x17'))[_0x50c7('0x1a')]());logger['info'](_0x50c7('0x1b'),_[_0x50c7('0x1c')](_[_0x50c7('0x11')](_0x303a64,function(_0xdea1fd){return _0xdea1fd[_0x50c7('0x1d')]!==_0x50c7('0x19');}),'name')[_0x50c7('0x1a')]()||_0x50c7('0x1e'));console[_0x50c7('0x1f')](_0x50c7('0x20'));})['catch'](function(_0x8bae63){console['log'](_0x50c7('0x21'),_0x8bae63);logger[_0x50c7('0x22')](_0x50c7('0x23'),_0x8bae63);process['exit'](0x1);});}main(); \ No newline at end of file +var _0x1696=['start','filter','number','exitCode','length','map','name','Online\x20apps:','online','Offline\x20apps:','status','join','log','catch','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','lodash','./config/seedDB','./config/license','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','sequelize','sync','then','seedDB','listen','info'];(function(_0x399a25,_0x1ae4c2){var _0x58bb4c=function(_0x47639b){while(--_0x47639b){_0x399a25['push'](_0x399a25['shift']());}};_0x58bb4c(++_0x1ae4c2);}(_0x1696,0x79));var _0x6169=function(_0x312fed,_0x4b828d){_0x312fed=_0x312fed-0x0;var _0x3a8e54=_0x1696[_0x312fed];return _0x3a8e54;};'use strict';var _=require(_0x6169('0x0'));var db=require('./mysqldb')['db'];var seedDb=require(_0x6169('0x1'));var checkLicense=require(_0x6169('0x2'));var rpc=require(_0x6169('0x3'));var config=require(_0x6169('0x4'));var logger=require(_0x6169('0x5'))(_0x6169('0x6'));var pm2=require(_0x6169('0x7'));var pm2Config=require(_0x6169('0x8'));var schedule=require(_0x6169('0x9'));var chat=require('./config/schedule/chat');var whatsapp=require(_0x6169('0xa'));var transcribe=require(_0x6169('0xb'));var provider=require(_0x6169('0xc'));function main(){return db[_0x6169('0xd')][_0x6169('0xe')]()[_0x6169('0xf')](function(){if(config[_0x6169('0x10')]){return seedDb['default']();}})[_0x6169('0xf')](function(){return checkLicense['default']();})[_0x6169('0xf')](function(){return rpc[_0x6169('0x11')]();})['then'](function(_0x46c85b){logger[_0x6169('0x12')](_0x46c85b);return chat[_0x6169('0x13')]();})[_0x6169('0xf')](function(){return whatsapp['start']();})['then'](function(){return schedule[_0x6169('0x13')]();})[_0x6169('0xf')](function(){return transcribe['start']();})[_0x6169('0xf')](function(){return provider[_0x6169('0x13')]();})[_0x6169('0xf')](function(_0x56e64a){logger['info'](_0x56e64a);return pm2['start'](pm2Config);})[_0x6169('0xf')](function(_0x2171d1){var _0x417e48=_0x2171d1[_0x6169('0x14')](function(_0x3ffa76){return typeof _0x3ffa76['exitCode']===_0x6169('0x15')&&_0x3ffa76[_0x6169('0x16')]>=0x0;});if(_0x417e48['length']>0x0){throw new Error(_0x417e48[_0x6169('0x17')]+'\x20processes\x20failed\x20at\x20startup:\x20'+_[_0x6169('0x18')](_0x417e48,function(_0x1e3b4e){return'\x22'+_0x1e3b4e['pm2_env'][_0x6169('0x19')]+'\x22';}));}logger[_0x6169('0x12')](_0x6169('0x1a'),_[_0x6169('0x18')](_[_0x6169('0x14')](_0x2171d1,{'status':_0x6169('0x1b')}),_0x6169('0x19'))['join']());logger['info'](_0x6169('0x1c'),_[_0x6169('0x18')](_['filter'](_0x2171d1,function(_0x34675a){return _0x34675a[_0x6169('0x1d')]!==_0x6169('0x1b');}),_0x6169('0x19'))[_0x6169('0x1e')]()||'None');console[_0x6169('0x1f')]('App\x20Ready!');})[_0x6169('0x20')](function(_0x3ec419){console[_0x6169('0x1f')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error!',_0x3ec419);logger[_0x6169('0x21')](_0x6169('0x22'),_0x3ec419);process['exit'](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 8712239..bd556b1 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 _0x7d2a=['smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswer','whatsappAutoanswerDelay','messengerSoundNotification','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','findOne','params','closed','disposition','then','query','forceDownload','status','unmanaged','json','Unmanaged.','Forbidden.','headers','authorization','Basic','User','name','authenticate','pass','Wrong\x20credentials.','catch','Bearer','apikey','getUuid','find','Setting','blockDuration','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key','blockedAt','add','Unknown\x20authorization\x20format','User\x20object\x20not\x20found.','canUpdate','getLicense','Forbidden','webrtc','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','ValidationError','validatePasswordHistory','decryptString','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.','Sequelize','updatePasswordsHistory','split','length','splice','unshift','encryptString','join','promisify','payload','options','verify','randomBytes','toString','floor','now','HS512','../../mysqldb','../../config/environment','../../config/license/util','lodash','express-jwt','composable-middleware','basic-auth','bluebird','util','moment','secrets','session','role','fullname','internal','email','permissions','md5secret','voicePause','mailPause','smsPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswerDelay','emailAutoanswer'];(function(_0x50bd30,_0x45ecd0){var _0x5bdd72=function(_0x59638a){while(--_0x59638a){_0x50bd30['push'](_0x50bd30['shift']());}};_0x5bdd72(++_0x45ecd0);}(_0x7d2a,0xe7));var _0xa7d2=function(_0x57f966,_0x2b55e8){_0x57f966=_0x57f966-0x0;var _0x1e1986=_0x7d2a[_0x57f966];return _0x1e1986;};'use strict';var db=require(_0xa7d2('0x0'))['db'];var config=require(_0xa7d2('0x1'));var hardwareConf=require('../../config/license/hardware');var licenseUtil=require(_0xa7d2('0x2'));var encryptor=require('../encryptor');var _=require(_0xa7d2('0x3'));var jwt=require('jsonwebtoken');var expressJwt=require(_0xa7d2('0x4'));var compose=require(_0xa7d2('0x5'));var basicAuth=require(_0xa7d2('0x6'));var crypto=require('crypto');var BPromise=require(_0xa7d2('0x7'));var util=require(_0xa7d2('0x8'));var moment=require(_0xa7d2('0x9'));var validateJwt=expressJwt({'secret':config[_0xa7d2('0xa')][_0xa7d2('0xb')]});var userAttributes=['id',_0xa7d2('0xc'),_0xa7d2('0xd'),'name',_0xa7d2('0xe'),_0xa7d2('0xf'),'userpic',_0xa7d2('0x10'),_0xa7d2('0x11'),_0xa7d2('0x12'),'chatPause',_0xa7d2('0x13'),'faxPause',_0xa7d2('0x14'),'openchannelPause',_0xa7d2('0x15'),_0xa7d2('0x16'),_0xa7d2('0x17'),_0xa7d2('0x18'),_0xa7d2('0x19'),'allowmessenger',_0xa7d2('0x1a'),_0xa7d2('0x1b'),_0xa7d2('0x1c'),_0xa7d2('0x1d'),_0xa7d2('0x1e'),_0xa7d2('0x1f'),_0xa7d2('0x20'),_0xa7d2('0x21'),'phoneBarExpires','phoneBarPrefixRequired',_0xa7d2('0x22'),_0xa7d2('0x23'),_0xa7d2('0x24'),'interface','userProfileId',_0xa7d2('0x25'),_0xa7d2('0x26'),_0xa7d2('0x27'),_0xa7d2('0x28'),_0xa7d2('0x29'),_0xa7d2('0x2a'),_0xa7d2('0x2b'),_0xa7d2('0x2c'),'chatAutoanswer',_0xa7d2('0x2d'),_0xa7d2('0x2e'),'emailAutoanswerDelay',_0xa7d2('0x2f'),_0xa7d2('0x30'),_0xa7d2('0x31'),_0xa7d2('0x32'),_0xa7d2('0x33'),_0xa7d2('0x34'),_0xa7d2('0x35'),_0xa7d2('0x36'),_0xa7d2('0x37')];exports[_0xa7d2('0x38')]=function(){return this[_0xa7d2('0x39')](!![])[_0xa7d2('0x3a')](function(_0xf45874,_0x458a09,_0x5ac39e){if(_0xf45874[_0xa7d2('0x3b')]){_0x5ac39e();}else{return db[_0xa7d2('0x3c')][_0xa7d2('0x3d')]({'where':{'id':_0xf45874[_0xa7d2('0x3e')]['id']},'attributes':['id',_0xa7d2('0x3f'),_0xa7d2('0x40')],'raw':!![]})[_0xa7d2('0x41')](function(_0x4054ad){if(_0x4054ad&&_0x4054ad[_0xa7d2('0x3f')]&&!_0xf45874[_0xa7d2('0x42')][_0xa7d2('0x43')]){return _0x458a09[_0xa7d2('0x44')](_0x4054ad[_0xa7d2('0x40')]===_0xa7d2('0x45')?0x195:0x193)[_0xa7d2('0x46')]({'message':_0x4054ad[_0xa7d2('0x40')]===_0xa7d2('0x45')?_0xa7d2('0x47'):_0xa7d2('0x48')});}else{_0x5ac39e();}})['catch'](function(_0x373216){_0x5ac39e(_0x373216);});}});};exports[_0xa7d2('0x39')]=function isAuthenticated(_0x4ccf8a){return compose()[_0xa7d2('0x3a')](function(_0xe94c2a,_0x3d3186,_0x4160fe){var _0x30d742;if(_0xe94c2a[_0xa7d2('0x49')][_0xa7d2('0x4a')]){if(_['startsWith'](_0xe94c2a[_0xa7d2('0x49')][_0xa7d2('0x4a')],_0xa7d2('0x4b'))){var _0x15cd84=basicAuth(_0xe94c2a);db[_0xa7d2('0x4c')]['find']({'where':{'name':_0x15cd84[_0xa7d2('0x4d')]}})[_0xa7d2('0x41')](function(_0x4ba689){if(!_0x4ba689||!_0x4ba689[_0xa7d2('0x4e')](_0x15cd84[_0xa7d2('0x4f')])){return _0x3d3186['status'](0x191)[_0xa7d2('0x46')]({'message':_0xa7d2('0x50')});}_0xe94c2a[_0xa7d2('0x3b')]={'id':_0x4ba689['id']};_0x4160fe();})[_0xa7d2('0x51')](function(_0x5c48b4){_0x4160fe(_0x5c48b4);});}else if(_['startsWith'](_0xe94c2a[_0xa7d2('0x49')][_0xa7d2('0x4a')],_0xa7d2('0x52'))){validateJwt(_0xe94c2a,_0x3d3186,_0x4160fe);}else{if(_0x4ccf8a){_0x4160fe();}else{return _0x3d3186[_0xa7d2('0x44')](0x193)[_0xa7d2('0x46')]({'message':'Unknown\x20authorization\x20format'});}}}else if(_0xe94c2a[_0xa7d2('0x42')][_0xa7d2('0x53')]){try{var _0xe4b7b0={'audience':hardwareConf[_0xa7d2('0x54')](),'issuer':hardwareConf[_0xa7d2('0x54')]()};verifyJwt(_0xe94c2a[_0xa7d2('0x42')][_0xa7d2('0x53')],_0xe4b7b0)[_0xa7d2('0x41')](function(_0x4cfdbb){return db[_0xa7d2('0x4c')][_0xa7d2('0x55')]({'where':{'id':_0x4cfdbb['sub']}})[_0xa7d2('0x41')](function(_0x4ac6aa){_0x30d742=_0x4ac6aa;return db[_0xa7d2('0x56')][_0xa7d2('0x3d')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xa7d2('0x57')],'raw':!![]});})[_0xa7d2('0x41')](function(_0x3e4bdd){if(!_0x30d742||!_['isEqual'](_0x30d742[_0xa7d2('0x58')],_0x4cfdbb[_0xa7d2('0x59')])){return _0x3d3186[_0xa7d2('0x44')](0x191)[_0xa7d2('0x46')]({'message':_0xa7d2('0x5a')});}if(_0x30d742['disabled']){return _0x3d3186['status'](0x191)[_0xa7d2('0x46')]({'message':_0xa7d2('0x5b')});}if(_0x30d742['blocked']){if(_0x3e4bdd[_0xa7d2('0x57')]>0x0){if(moment(_0x30d742[_0xa7d2('0x5c')])[_0xa7d2('0x5d')](_0x3e4bdd[_0xa7d2('0x57')],'minutes')>moment()){return _0x3d3186[_0xa7d2('0x44')](0x191)['json']({'message':_0xa7d2('0x5b')});}}else{return _0x3d3186[_0xa7d2('0x44')](0x191)[_0xa7d2('0x46')]({'message':_0xa7d2('0x5b')});}}_0xe94c2a[_0xa7d2('0x3b')]={'id':_0x30d742['id']};_0x4160fe();});})['catch'](function(){return _0x3d3186[_0xa7d2('0x44')](0x191)[_0xa7d2('0x46')]({'message':_0xa7d2('0x5b')});});}catch(_0x306cf0){_0x4160fe(_0x306cf0);}}else if(_0x4ccf8a){_0x4160fe();}else{return _0x3d3186['status'](0x193)[_0xa7d2('0x46')]({'message':_0xa7d2('0x5e')});}})['use'](function(_0x18f854,_0x547f34,_0x5c6b49){if(_0x18f854[_0xa7d2('0x3b')]){db[_0xa7d2('0x4c')][_0xa7d2('0x55')]({'where':{'id':_0x18f854[_0xa7d2('0x3b')]['id']},'attributes':userAttributes})['then'](function(_0x2e87ac){if(!_0x2e87ac){return _0x547f34[_0xa7d2('0x44')](0x194)[_0xa7d2('0x46')]({'message':'User\x20not\x20found.'});}_0x18f854['user']=_0x2e87ac;_0x5c6b49();})[_0xa7d2('0x51')](function(_0x5c46e8){_0x5c6b49(_0x5c46e8);});}else if(_0x4ccf8a){_0x5c6b49();}else{return _0x547f34['status'](0x194)[_0xa7d2('0x46')]({'message':_0xa7d2('0x5f')});}});};exports[_0xa7d2('0x60')]=function canUpdate(){return compose()['use'](function(_0x2f6af5,_0x1bede0,_0xa6d4ac){return licenseUtil[_0xa7d2('0x61')]()[_0xa7d2('0x41')](function(_0x59fcf4){if(_0x59fcf4['update']){_0xa6d4ac();}else{return _0x1bede0[_0xa7d2('0x44')](0x193)[_0xa7d2('0x46')]({'message':_0xa7d2('0x62')});}})[_0xa7d2('0x51')](function(_0x4e9eab){_0xa6d4ac(_0x4e9eab);});});};exports['isWebrtcLicence']=function isWebrtcLicence(){return compose()['use'](function(_0x40f55a,_0xb5219c,_0x5df26d){return licenseUtil[_0xa7d2('0x61')]()[_0xa7d2('0x41')](function(_0x30ad5f){if(_0x30ad5f[_0xa7d2('0x63')]){_0x5df26d();}else{return _0xb5219c['status'](0x193)[_0xa7d2('0x46')]({'message':_0xa7d2('0x62')});}})[_0xa7d2('0x51')](function(_0x4d71bd){_0x5df26d(_0x4d71bd);});});};exports['isMiddleware']=function(_0x58fc33,_0x29d424,_0x3b4d28){_0x58fc33['isMiddleware']=!![];return _0x3b4d28();};exports[_0xa7d2('0x64')]=function signToken(_0x4aa0ac){return signJwt(_0x4aa0ac);};exports[_0xa7d2('0x65')]=function(_0x52a10a,_0x32fc20){if(!_0x52a10a[_0xa7d2('0x3b')]){return _0x32fc20[_0xa7d2('0x44')](0x194)[_0xa7d2('0x46')]({'message':_0xa7d2('0x66')});}var _0x45352c={'payload':{'id':_0x52a10a[_0xa7d2('0x3b')]['id'],'role':_0x52a10a[_0xa7d2('0x3b')][_0xa7d2('0xc')]},'options':{'expiresIn':0x15180}};return signJwt(_0x45352c)[_0xa7d2('0x41')](function(_0x2f9fbe){_0x32fc20[_0xa7d2('0x67')](_0xa7d2('0x68'),_0x2f9fbe);_0x32fc20[_0xa7d2('0x69')]('/dashboards/general');})['catch'](function(_0x27051e){return _0x32fc20[_0xa7d2('0x44')](0x1f4)[_0xa7d2('0x6a')](_0x27051e);});};exports[_0xa7d2('0x6b')]=function(_0x548270){if(_[_0xa7d2('0x6c')](_0x548270['apiKeyNonce'])||_[_0xa7d2('0x6c')](_0x548270[_0xa7d2('0x6d')])){return null;}else{return createJwt(_0x548270);}};exports[_0xa7d2('0x6e')]=function(_0x27804d){_0x27804d[_0xa7d2('0x58')]=generateNonce();_0x27804d['apiKeyIat']=generateIssuedAt();return createJwt(_0x27804d);};exports[_0xa7d2('0x6f')]=function(_0x55f2f9,_0x1dad5a){var _0x4fd1dc=_0x55f2f9[_0xa7d2('0x42')]['apikey'];if(_0x4fd1dc){var _0x7016c5={'nonce':_0x1dad5a[_0xa7d2('0x58')],'iat':_0x1dad5a[_0xa7d2('0x6d')],'audience':hardwareConf[_0xa7d2('0x54')](),'issuer':hardwareConf[_0xa7d2('0x54')]()};return verifyJwt(_0x4fd1dc,_0x7016c5)[_0xa7d2('0x41')](function(){return generateApiKey(_0x1dad5a);});}else{throw{'message':_0xa7d2('0x70')};}};exports[_0xa7d2('0x71')]=function(_0x2b26aa){var _0x2540e2=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x2540e2[_0xa7d2('0x72')](_0x2b26aa))throw new db['Sequelize'][(_0xa7d2('0x73'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');return;};exports[_0xa7d2('0x74')]=function(_0x13425d,_0x44234a,_0x4aa797){var _0x246d01=encryptor[_0xa7d2('0x75')](_0x44234a)['split'](',');for(var _0x563b1a=0x0;_0x563b1a<_0x4aa797;_0x563b1a++){if(!_0x246d01[_0x563b1a])break;if(_0x13425d[_0xa7d2('0x76')]()===_0x246d01[_0x563b1a][_0xa7d2('0x76')]()){var _0xfb7210=util[_0xa7d2('0x77')](_0xa7d2('0x78'),_0x4aa797);if(_0x4aa797===0x1){_0xfb7210=_0xa7d2('0x79');}throw new db[(_0xa7d2('0x7a'))][(_0xa7d2('0x73'))](_0xfb7210);}}return;};exports[_0xa7d2('0x7b')]=function(_0x2f2211,_0x1d7a58){var _0x58892b=_0x1d7a58?encryptor[_0xa7d2('0x75')](_0x1d7a58)[_0xa7d2('0x7c')](','):[];if(_0x58892b[_0xa7d2('0x7d')]===0x5){_0x58892b[_0xa7d2('0x7e')](-0x1,0x1);}_0x58892b[_0xa7d2('0x7f')](_0x2f2211);return encryptor[_0xa7d2('0x80')](_0x58892b[_0xa7d2('0x81')](','));};function signJwt(_0x5ab099){var _0x45a540=BPromise[_0xa7d2('0x82')](jwt['sign'],{'context':jwt});var _0xa73c95=_0x5ab099['secret']||config[_0xa7d2('0xa')][_0xa7d2('0xb')];return new BPromise(function(_0x248ef4,_0x65af95){_0x45a540(_0x5ab099[_0xa7d2('0x83')],_0xa73c95,_0x5ab099[_0xa7d2('0x84')])[_0xa7d2('0x41')](function(_0x33d775){_0x248ef4(_0x33d775);})['catch'](function(_0x2c7331){_0x65af95(_0x2c7331);});});}function verifyJwt(_0x302eac,_0x5e1b60,_0x288ff2){var _0x51abb0=BPromise[_0xa7d2('0x82')](jwt[_0xa7d2('0x85')],{'context':jwt});var _0x586eae=_0x288ff2||config['secrets']['session'];return new BPromise(function(_0x301b39,_0x51b19f){_0x51abb0(_0x302eac,_0x586eae,_0x5e1b60)[_0xa7d2('0x41')](function(_0x303663){_0x301b39(_0x303663);})['catch'](function(_0x4745e0){_0x51b19f(_0x4745e0);});});}function generateNonce(){return crypto[_0xa7d2('0x86')](0x10)[_0xa7d2('0x87')]('hex');}function generateIssuedAt(){return Math[_0xa7d2('0x88')](Date[_0xa7d2('0x89')]()/0x3e8)[_0xa7d2('0x87')]();}function createJwt(_0x44a34f){var _0x7a203={'payload':{'iat':_0x44a34f['apiKeyIat'],'nonce':_0x44a34f[_0xa7d2('0x58')]},'options':{'algorithm':_0xa7d2('0x8a'),'subject':_0x44a34f['id'][_0xa7d2('0x87')](),'issuer':hardwareConf[_0xa7d2('0x54')](),'audience':hardwareConf[_0xa7d2('0x54')]()}};return signJwt(_0x7a203)['then'](function(_0x33123a){return{'iat':_0x44a34f[_0xa7d2('0x6d')],'nonce':_0x44a34f[_0xa7d2('0x58')],'token':_0x33123a};});} \ No newline at end of file +var _0x49fa=['phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','hotdesk','interface','userProfileId','settingsEnabled','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswer','whatsappAutoanswerDelay','messengerSoundNotification','use','user','ChatInteraction','findOne','params','closed','disposition','then','json','unmanaged','Forbidden.','catch','isAuthenticated','headers','authorization','startsWith','Basic','User','name','authenticate','pass','status','Wrong\x20credentials.','Bearer','query','getUuid','apikey','find','Setting','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','minutes','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','update','Forbidden','isWebrtcLicence','isMiddleware','signToken','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','/dashboards/general','send','isNil','generateApiKey','apiKeyIat','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','Sequelize','updatePasswordsHistory','splice','encryptString','join','promisify','secret','secrets','payload','options','verify','randomBytes','toString','hex','floor','now','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','lodash','jsonwebtoken','express-jwt','basic-auth','util','moment','session','role','fullname','internal','email','permissions','md5secret','voicePause','showWebBar','lastLoginAt','crudPermissions','passwordResetAt','alias','phoneBarAutoAnswer'];(function(_0x2b16be,_0x5758aa){var _0x50b555=function(_0x37fbfd){while(--_0x37fbfd){_0x2b16be['push'](_0x2b16be['shift']());}};_0x50b555(++_0x5758aa);}(_0x49fa,0xfb));var _0xa49f=function(_0x471ea2,_0x2b2d45){_0x471ea2=_0x471ea2-0x0;var _0x3fa329=_0x49fa[_0x471ea2];return _0x3fa329;};'use strict';var db=require(_0xa49f('0x0'))['db'];var config=require(_0xa49f('0x1'));var hardwareConf=require(_0xa49f('0x2'));var licenseUtil=require(_0xa49f('0x3'));var encryptor=require(_0xa49f('0x4'));var _=require(_0xa49f('0x5'));var jwt=require(_0xa49f('0x6'));var expressJwt=require(_0xa49f('0x7'));var compose=require('composable-middleware');var basicAuth=require(_0xa49f('0x8'));var crypto=require('crypto');var BPromise=require('bluebird');var util=require(_0xa49f('0x9'));var moment=require(_0xa49f('0xa'));var validateJwt=expressJwt({'secret':config['secrets'][_0xa49f('0xb')]});var userAttributes=['id',_0xa49f('0xc'),_0xa49f('0xd'),'name',_0xa49f('0xe'),_0xa49f('0xf'),'userpic',_0xa49f('0x10'),_0xa49f('0x11'),_0xa49f('0x12'),'chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType',_0xa49f('0x13'),_0xa49f('0x14'),'lastPauseAt',_0xa49f('0x15'),'allowmessenger',_0xa49f('0x16'),_0xa49f('0x17'),_0xa49f('0x18'),_0xa49f('0x19'),_0xa49f('0x1a'),_0xa49f('0x1b'),_0xa49f('0x1c'),_0xa49f('0x1d'),_0xa49f('0x1e'),_0xa49f('0x1f'),'phoneBarRemoteControl','phoneBarRemoteControlPort',_0xa49f('0x20'),_0xa49f('0x21'),_0xa49f('0x22'),'privacyEnabled',_0xa49f('0x23'),'wssPort',_0xa49f('0x24'),_0xa49f('0x25'),_0xa49f('0x26'),_0xa49f('0x27'),_0xa49f('0x28'),_0xa49f('0x29'),_0xa49f('0x2a'),'emailAutoanswer',_0xa49f('0x2b'),_0xa49f('0x2c'),_0xa49f('0x2d'),_0xa49f('0x2e'),_0xa49f('0x2f'),_0xa49f('0x30'),_0xa49f('0x31'),_0xa49f('0x32'),_0xa49f('0x33'),_0xa49f('0x34')];exports['isChatInteractionAuthorized']=function(){return this['isAuthenticated'](!![])[_0xa49f('0x35')](function(_0x3863e7,_0x15db0f,_0x3b975c){if(_0x3863e7[_0xa49f('0x36')]){_0x3b975c();}else{return db[_0xa49f('0x37')][_0xa49f('0x38')]({'where':{'id':_0x3863e7[_0xa49f('0x39')]['id']},'attributes':['id',_0xa49f('0x3a'),_0xa49f('0x3b')],'raw':!![]})[_0xa49f('0x3c')](function(_0xccff47){if(_0xccff47&&_0xccff47[_0xa49f('0x3a')]&&!_0x3863e7['query']['forceDownload']){return _0x15db0f['status'](_0xccff47[_0xa49f('0x3b')]==='unmanaged'?0x195:0x193)[_0xa49f('0x3d')]({'message':_0xccff47['disposition']===_0xa49f('0x3e')?'Unmanaged.':_0xa49f('0x3f')});}else{_0x3b975c();}})[_0xa49f('0x40')](function(_0x5de6e7){_0x3b975c(_0x5de6e7);});}});};exports[_0xa49f('0x41')]=function isAuthenticated(_0x9d872a){return compose()['use'](function(_0xfcd344,_0x4699d1,_0xd8f968){var _0x146e62;if(_0xfcd344[_0xa49f('0x42')][_0xa49f('0x43')]){if(_[_0xa49f('0x44')](_0xfcd344[_0xa49f('0x42')][_0xa49f('0x43')],_0xa49f('0x45'))){var _0x3def2f=basicAuth(_0xfcd344);db[_0xa49f('0x46')]['find']({'where':{'name':_0x3def2f[_0xa49f('0x47')]}})[_0xa49f('0x3c')](function(_0x13d859){if(!_0x13d859||!_0x13d859[_0xa49f('0x48')](_0x3def2f[_0xa49f('0x49')])){return _0x4699d1[_0xa49f('0x4a')](0x191)[_0xa49f('0x3d')]({'message':_0xa49f('0x4b')});}_0xfcd344[_0xa49f('0x36')]={'id':_0x13d859['id']};_0xd8f968();})[_0xa49f('0x40')](function(_0x81d745){_0xd8f968(_0x81d745);});}else if(_['startsWith'](_0xfcd344['headers']['authorization'],_0xa49f('0x4c'))){validateJwt(_0xfcd344,_0x4699d1,_0xd8f968);}else{if(_0x9d872a){_0xd8f968();}else{return _0x4699d1[_0xa49f('0x4a')](0x193)['json']({'message':'Unknown\x20authorization\x20format'});}}}else if(_0xfcd344[_0xa49f('0x4d')]['apikey']){try{var _0x11208e={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0xa49f('0x4e')]()};verifyJwt(_0xfcd344[_0xa49f('0x4d')][_0xa49f('0x4f')],_0x11208e)['then'](function(_0x16d3e6){return db[_0xa49f('0x46')][_0xa49f('0x50')]({'where':{'id':_0x16d3e6['sub']}})[_0xa49f('0x3c')](function(_0x1bbfb3){_0x146e62=_0x1bbfb3;return db[_0xa49f('0x51')]['findOne']({'where':{'id':0x1},'attributes':[_0xa49f('0x52'),_0xa49f('0x53')],'raw':!![]});})[_0xa49f('0x3c')](function(_0x2d920e){if(!_0x146e62||!_[_0xa49f('0x54')](_0x146e62[_0xa49f('0x55')],_0x16d3e6[_0xa49f('0x56')])){return _0x4699d1['status'](0x191)[_0xa49f('0x3d')]({'message':_0xa49f('0x57')});}if(_0x146e62[_0xa49f('0x58')]){return _0x4699d1[_0xa49f('0x4a')](0x191)[_0xa49f('0x3d')]({'message':_0xa49f('0x59')});}if(_0x146e62[_0xa49f('0x5a')]){if(_0x2d920e[_0xa49f('0x53')]>0x0){if(moment(_0x146e62[_0xa49f('0x5b')])[_0xa49f('0x5c')](_0x2d920e[_0xa49f('0x53')],_0xa49f('0x5d'))>moment()){return _0x4699d1[_0xa49f('0x4a')](0x191)['json']({'message':_0xa49f('0x59')});}}else{return _0x4699d1['status'](0x191)[_0xa49f('0x3d')]({'message':_0xa49f('0x59')});}}_0xfcd344[_0xa49f('0x36')]={'id':_0x146e62['id']};_0xd8f968();});})['catch'](function(){return _0x4699d1[_0xa49f('0x4a')](0x191)[_0xa49f('0x3d')]({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0x185b92){_0xd8f968(_0x185b92);}}else if(_0x9d872a){_0xd8f968();}else{return _0x4699d1[_0xa49f('0x4a')](0x193)[_0xa49f('0x3d')]({'message':'Unknown\x20authorization\x20format'});}})[_0xa49f('0x35')](function(_0x1498b1,_0x46bd42,_0x58a3a0){if(_0x1498b1['user']){db[_0xa49f('0x46')][_0xa49f('0x50')]({'where':{'id':_0x1498b1[_0xa49f('0x36')]['id']},'attributes':userAttributes})[_0xa49f('0x3c')](function(_0x417c3f){if(!_0x417c3f){return _0x46bd42[_0xa49f('0x4a')](0x194)[_0xa49f('0x3d')]({'message':_0xa49f('0x5e')});}_0x1498b1['user']=_0x417c3f;_0x58a3a0();})['catch'](function(_0x44a409){_0x58a3a0(_0x44a409);});}else if(_0x9d872a){_0x58a3a0();}else{return _0x46bd42[_0xa49f('0x4a')](0x194)['json']({'message':_0xa49f('0x5f')});}});};exports[_0xa49f('0x60')]=function canUpdate(){return compose()[_0xa49f('0x35')](function(_0x1902b3,_0x321f58,_0x317edc){return licenseUtil['getLicense']()['then'](function(_0x3264ab){if(_0x3264ab[_0xa49f('0x61')]){_0x317edc();}else{return _0x321f58[_0xa49f('0x4a')](0x193)[_0xa49f('0x3d')]({'message':_0xa49f('0x62')});}})[_0xa49f('0x40')](function(_0x3fac42){_0x317edc(_0x3fac42);});});};exports[_0xa49f('0x63')]=function isWebrtcLicence(){return compose()['use'](function(_0x3dc6c4,_0x319371,_0xbc16cd){return licenseUtil['getLicense']()[_0xa49f('0x3c')](function(_0x5965e0){if(_0x5965e0['webrtc']){_0xbc16cd();}else{return _0x319371[_0xa49f('0x4a')](0x193)['json']({'message':_0xa49f('0x62')});}})[_0xa49f('0x40')](function(_0x3e374b){_0xbc16cd(_0x3e374b);});});};exports['isMiddleware']=function(_0x54862c,_0x56f195,_0x1a0a52){_0x54862c[_0xa49f('0x64')]=!![];return _0x1a0a52();};exports[_0xa49f('0x65')]=function signToken(_0x3ae74a){return signJwt(_0x3ae74a);};exports['setTokenCookie']=function(_0x4c3565,_0x2ebc09){if(!_0x4c3565['user']){return _0x2ebc09['status'](0x194)['json']({'message':_0xa49f('0x66')});}var _0x59e16a={'payload':{'id':_0x4c3565[_0xa49f('0x36')]['id'],'role':_0x4c3565['user'][_0xa49f('0xc')]},'options':{'expiresIn':0x15180}};return signJwt(_0x59e16a)['then'](function(_0x2ff462){_0x2ebc09[_0xa49f('0x67')](_0xa49f('0x68'),_0x2ff462);_0x2ebc09['redirect'](_0xa49f('0x69'));})[_0xa49f('0x40')](function(_0x44c618){return _0x2ebc09['status'](0x1f4)[_0xa49f('0x6a')](_0x44c618);});};exports['retrieveApiKey']=function(_0x126967){if(_[_0xa49f('0x6b')](_0x126967[_0xa49f('0x55')])||_[_0xa49f('0x6b')](_0x126967['apiKeyIat'])){return null;}else{return createJwt(_0x126967);}};exports[_0xa49f('0x6c')]=function(_0x369ce9){_0x369ce9[_0xa49f('0x55')]=generateNonce();_0x369ce9['apiKeyIat']=generateIssuedAt();return createJwt(_0x369ce9);};exports['regenerateApiKey']=function(_0x51ead8,_0x39a052){var _0x2fbd2e=_0x51ead8[_0xa49f('0x4d')][_0xa49f('0x4f')];if(_0x2fbd2e){var _0x4581d4={'nonce':_0x39a052['apiKeyNonce'],'iat':_0x39a052[_0xa49f('0x6d')],'audience':hardwareConf[_0xa49f('0x4e')](),'issuer':hardwareConf[_0xa49f('0x4e')]()};return verifyJwt(_0x2fbd2e,_0x4581d4)[_0xa49f('0x3c')](function(){return generateApiKey(_0x39a052);});}else{throw{'message':_0xa49f('0x6e')};}};exports[_0xa49f('0x6f')]=function(_0x4841d0){var _0x1d7eaf=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x1d7eaf[_0xa49f('0x70')](_0x4841d0))throw new db['Sequelize'][(_0xa49f('0x71'))](_0xa49f('0x72'));return;};exports[_0xa49f('0x73')]=function(_0x48e9a7,_0x5eafc4,_0xf7cd1a){var _0x1b92e7=encryptor[_0xa49f('0x74')](_0x5eafc4)[_0xa49f('0x75')](',');for(var _0x35f62d=0x0;_0x35f62d<_0xf7cd1a;_0x35f62d++){if(!_0x1b92e7[_0x35f62d])break;if(_0x48e9a7[_0xa49f('0x76')]()===_0x1b92e7[_0x35f62d][_0xa49f('0x76')]()){var _0x440e8f=util[_0xa49f('0x77')](_0xa49f('0x78'),_0xf7cd1a);if(_0xf7cd1a===0x1){_0x440e8f='The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.';}throw new db[(_0xa49f('0x79'))][(_0xa49f('0x71'))](_0x440e8f);}}return;};exports[_0xa49f('0x7a')]=function(_0x1eda93,_0x21d4a8){var _0x44ef9b=_0x21d4a8?encryptor[_0xa49f('0x74')](_0x21d4a8)[_0xa49f('0x75')](','):[];if(_0x44ef9b['length']===0x5){_0x44ef9b[_0xa49f('0x7b')](-0x1,0x1);}_0x44ef9b['unshift'](_0x1eda93);return encryptor[_0xa49f('0x7c')](_0x44ef9b[_0xa49f('0x7d')](','));};function signJwt(_0x381ab6){var _0x50b6ca=BPromise[_0xa49f('0x7e')](jwt['sign'],{'context':jwt});var _0x55cdf8=_0x381ab6[_0xa49f('0x7f')]||config[_0xa49f('0x80')][_0xa49f('0xb')];return new BPromise(function(_0x1c85ef,_0x12dda8){_0x50b6ca(_0x381ab6[_0xa49f('0x81')],_0x55cdf8,_0x381ab6[_0xa49f('0x82')])[_0xa49f('0x3c')](function(_0xdf4b8b){_0x1c85ef(_0xdf4b8b);})[_0xa49f('0x40')](function(_0x13116f){_0x12dda8(_0x13116f);});});}function verifyJwt(_0x54de81,_0x40f175,_0x5d0b11){var _0x7b4923=BPromise['promisify'](jwt[_0xa49f('0x83')],{'context':jwt});var _0x550930=_0x5d0b11||config[_0xa49f('0x80')]['session'];return new BPromise(function(_0x1a6a8a,_0x4129ca){_0x7b4923(_0x54de81,_0x550930,_0x40f175)[_0xa49f('0x3c')](function(_0x5ede7a){_0x1a6a8a(_0x5ede7a);})[_0xa49f('0x40')](function(_0x4e7048){_0x4129ca(_0x4e7048);});});}function generateNonce(){return crypto[_0xa49f('0x84')](0x10)[_0xa49f('0x85')](_0xa49f('0x86'));}function generateIssuedAt(){return Math[_0xa49f('0x87')](Date[_0xa49f('0x88')]()/0x3e8)[_0xa49f('0x85')]();}function createJwt(_0xf592ec){var _0xcac635={'payload':{'iat':_0xf592ec['apiKeyIat'],'nonce':_0xf592ec[_0xa49f('0x55')]},'options':{'algorithm':_0xa49f('0x89'),'subject':_0xf592ec['id'][_0xa49f('0x85')](),'issuer':hardwareConf[_0xa49f('0x4e')](),'audience':hardwareConf[_0xa49f('0x4e')]()}};return signJwt(_0xcac635)[_0xa49f('0x3c')](function(_0x3374b2){return{'iat':_0xf592ec[_0xa49f('0x6d')],'nonce':_0xf592ec[_0xa49f('0x55')],'token':_0x3374b2};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index 4ded1ea..3249e9e 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 _0xfc84=['map','catch','./sql-utils','skipContactsQuery','getContactsSubquery','resolve','then','search','parseAdvancedSearchFilter','parseQueryParameters','where','default','fields','filter','clause','tags','user','ids','tag','countFilteredContacts','count','User','buildContactsQuery','rows','describe','CmContact','keys','startsWith','cf_','findOne','slice','all','length','fieldType','type'];(function(_0x4cb697,_0x59fb3a){var _0x3e905d=function(_0x3bfcfa){while(--_0x3bfcfa){_0x4cb697['push'](_0x4cb697['shift']());}};_0x3e905d(++_0x59fb3a);}(_0xfc84,0xd4));var _0x4fc8=function(_0x195f55,_0x264671){_0x195f55=_0x195f55-0x0;var _0x2ac18c=_0xfc84[_0x195f55];return _0x2ac18c;};'use strict';var _=require('lodash');var sqlUtils=require(_0x4fc8('0x0'));var db=require('../../mysqldb')['db'];exports['findAll']=function(_0x362dbd,_0x1fac96,_0x1c8d10,_0x5d7a32){var _0x5ad368={'count':0x0,'rows':[]};var _0x1f2f45=sqlUtils[_0x4fc8('0x1')](_0x1fac96,_0x362dbd);if(_0x1f2f45){return Promise['resolve'](_0x5ad368);}var _0x215622=sqlUtils[_0x4fc8('0x2')]();var _0x52ead5={};var _0x5dd921=![];var _0x5818b6=![];return Promise[_0x4fc8('0x3')]()[_0x4fc8('0x4')](function(){if(_0x362dbd[_0x4fc8('0x5')]){return sqlUtils[_0x4fc8('0x6')](_0x362dbd[_0x4fc8('0x5')],_0x5d7a32);}else{return sqlUtils[_0x4fc8('0x7')](_0x362dbd,_0x5d7a32);}})[_0x4fc8('0x4')](function(_0x160d2a){_0x215622[_0x4fc8('0x8')](_0x160d2a[_0x4fc8('0x9')]);_0x215622[_0x4fc8('0x8')](_0x160d2a[_0x4fc8('0xa')]);_0x215622['where'](_0x160d2a[_0x4fc8('0xb')]);_0x215622['where'](_0x160d2a['user'][_0x4fc8('0xc')]);_0x52ead5=_0x160d2a[_0x4fc8('0xd')];_0x5818b6=_0x160d2a[_0x4fc8('0xe')]['skip'];return sqlUtils['checkListsRestrictions'](_0x1fac96,_0x362dbd,_0x5818b6);})[_0x4fc8('0x4')](function(_0xa2ea11){_0x215622['where'](_0xa2ea11);var _0x2fbc85=_0x362dbd['search']?_0x52ead5[_0x4fc8('0xf')]:_0x362dbd[_0x4fc8('0x10')];_0x5dd921=_0x2fbc85?!![]:![];return sqlUtils[_0x4fc8('0x11')](_0x215622,_0x2fbc85);})[_0x4fc8('0x4')](function(_0x300065){_0x5ad368[_0x4fc8('0x12')]=_0x300065;if(_0x5ad368['count']===0x0){return;}if(_0x362dbd[_0x4fc8('0x13')]){_0x5818b6=!![];}return sqlUtils[_0x4fc8('0x14')](_0x215622,_0x362dbd[_0x4fc8('0xa')],_0x1c8d10,_0x5dd921,_0x52ead5[_0x4fc8('0xc')],_0x5818b6);})[_0x4fc8('0x4')](function(_0x25d06d){if(!_0x25d06d){return[];}return sqlUtils['getFilteredContacts'](_0x25d06d,_0x362dbd,_0x1c8d10);})['then'](function(_0x32c00a){_0x5ad368[_0x4fc8('0x15')]=_0x32c00a;return _0x5ad368;})['catch'](function(_0x5e2364){throw _0x5e2364;});};exports[_0x4fc8('0x16')]=function(){var _0x301fb7={};var _0x3892d4=[];return db[_0x4fc8('0x17')]['describe']()[_0x4fc8('0x4')](function(_0x3fe520){_0x301fb7=_0x3fe520;var _0x28db20=Object[_0x4fc8('0x18')](_0x301fb7)['filter'](function(_0x3dacce){return _[_0x4fc8('0x19')](_0x3dacce,_0x4fc8('0x1a'))?_0x3dacce:undefined;});var _0x3deb39=_0x28db20['map'](function(_0x27f500){return db['CmCustomField'][_0x4fc8('0x1b')]({'where':{'id':_0x27f500[_0x4fc8('0x1c')](0x3)},'raw':!![]});});return Promise[_0x4fc8('0x1d')](_0x3deb39);})[_0x4fc8('0x4')](function(_0x4d14fc){for(var _0x296f3b=0x0;_0x296f3b<_0x4d14fc[_0x4fc8('0x1e')];_0x296f3b++){if(_0x4d14fc[_0x296f3b]){var _0x4a2ac0='cf_'+_0x4d14fc[_0x296f3b]['id'];_0x301fb7[_0x4a2ac0][_0x4fc8('0x1f')]=_0x4d14fc[_0x296f3b][_0x4fc8('0x20')];}}_0x3892d4=_[_0x4fc8('0x21')](Object['keys'](_0x301fb7),function(_0x47ab36){return{'name':_0x47ab36,'type':_0x301fb7[_0x47ab36][_0x4fc8('0x20')]};});return _0x3892d4;})[_0x4fc8('0x22')](function(_0x28076c){throw _0x28076c;});}; \ No newline at end of file +var _0xab03=['parseQueryParameters','then','where','fields','user','clause','skip','tag','count','User','buildContactsQuery','getFilteredContacts','describe','CmContact','keys','filter','startsWith','cf_','map','CmCustomField','findOne','slice','all','type','lodash','findAll','skipContactsQuery','getContactsSubquery','search','parseAdvancedSearchFilter'];(function(_0x202055,_0x3e4838){var _0x5314a5=function(_0x5de5b5){while(--_0x5de5b5){_0x202055['push'](_0x202055['shift']());}};_0x5314a5(++_0x3e4838);}(_0xab03,0xcc));var _0x3ab0=function(_0x275be2,_0x12aa4c){_0x275be2=_0x275be2-0x0;var _0x470fff=_0xab03[_0x275be2];return _0x470fff;};'use strict';var _=require(_0x3ab0('0x0'));var sqlUtils=require('./sql-utils');var db=require('../../mysqldb')['db'];exports[_0x3ab0('0x1')]=function(_0x2c9e2b,_0x4640ef,_0x5d38fe,_0x572dae){var _0x2cb48f={'count':0x0,'rows':[]};var _0x2dffc9=sqlUtils[_0x3ab0('0x2')](_0x4640ef,_0x2c9e2b);if(_0x2dffc9){return Promise['resolve'](_0x2cb48f);}var _0x2cbd24=sqlUtils[_0x3ab0('0x3')]();var _0x5cce5c={};var _0xedc72b=![];var _0x129986=![];return Promise['resolve']()['then'](function(){if(_0x2c9e2b[_0x3ab0('0x4')]){return sqlUtils[_0x3ab0('0x5')](_0x2c9e2b[_0x3ab0('0x4')],_0x572dae);}else{return sqlUtils[_0x3ab0('0x6')](_0x2c9e2b,_0x572dae);}})[_0x3ab0('0x7')](function(_0x4e5868){_0x2cbd24[_0x3ab0('0x8')](_0x4e5868['default']);_0x2cbd24[_0x3ab0('0x8')](_0x4e5868[_0x3ab0('0x9')]);_0x2cbd24[_0x3ab0('0x8')](_0x4e5868['filter']);_0x2cbd24[_0x3ab0('0x8')](_0x4e5868[_0x3ab0('0xa')][_0x3ab0('0xb')]);_0x5cce5c=_0x4e5868['tags'];_0x129986=_0x4e5868[_0x3ab0('0xa')][_0x3ab0('0xc')];return sqlUtils['checkListsRestrictions'](_0x4640ef,_0x2c9e2b,_0x129986);})[_0x3ab0('0x7')](function(_0x196243){_0x2cbd24[_0x3ab0('0x8')](_0x196243);var _0x28f377=_0x2c9e2b['search']?_0x5cce5c['ids']:_0x2c9e2b[_0x3ab0('0xd')];_0xedc72b=_0x28f377?!![]:![];return sqlUtils['countFilteredContacts'](_0x2cbd24,_0x28f377);})[_0x3ab0('0x7')](function(_0x5e8c01){_0x2cb48f[_0x3ab0('0xe')]=_0x5e8c01;if(_0x2cb48f['count']===0x0){return;}if(_0x2c9e2b[_0x3ab0('0xf')]){_0x129986=!![];}return sqlUtils[_0x3ab0('0x10')](_0x2cbd24,_0x2c9e2b[_0x3ab0('0x9')],_0x5d38fe,_0xedc72b,_0x5cce5c[_0x3ab0('0xb')],_0x129986);})['then'](function(_0x448fd8){if(!_0x448fd8){return[];}return sqlUtils[_0x3ab0('0x11')](_0x448fd8,_0x2c9e2b,_0x5d38fe);})[_0x3ab0('0x7')](function(_0x10f12b){_0x2cb48f['rows']=_0x10f12b;return _0x2cb48f;})['catch'](function(_0x564b30){throw _0x564b30;});};exports[_0x3ab0('0x12')]=function(){var _0x45e9f5={};var _0x2b4ffc=[];return db[_0x3ab0('0x13')][_0x3ab0('0x12')]()['then'](function(_0x1535f4){_0x45e9f5=_0x1535f4;var _0x1acf02=Object[_0x3ab0('0x14')](_0x45e9f5)[_0x3ab0('0x15')](function(_0x111f3e){return _[_0x3ab0('0x16')](_0x111f3e,_0x3ab0('0x17'))?_0x111f3e:undefined;});var _0x5189e0=_0x1acf02[_0x3ab0('0x18')](function(_0x54e161){return db[_0x3ab0('0x19')][_0x3ab0('0x1a')]({'where':{'id':_0x54e161[_0x3ab0('0x1b')](0x3)},'raw':!![]});});return Promise[_0x3ab0('0x1c')](_0x5189e0);})[_0x3ab0('0x7')](function(_0x56ba08){for(var _0x2ffd1f=0x0;_0x2ffd1f<_0x56ba08['length'];_0x2ffd1f++){if(_0x56ba08[_0x2ffd1f]){var _0x565fbe=_0x3ab0('0x17')+_0x56ba08[_0x2ffd1f]['id'];_0x45e9f5[_0x565fbe]['fieldType']=_0x56ba08[_0x2ffd1f][_0x3ab0('0x1d')];}}_0x2b4ffc=_[_0x3ab0('0x18')](Object[_0x3ab0('0x14')](_0x45e9f5),function(_0x4633ab){return{'name':_0x4633ab,'type':_0x45e9f5[_0x4633ab][_0x3ab0('0x1d')]};});return _0x2b4ffc;})['catch'](function(_0x58eeab){throw _0x58eeab;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index af45722..6a64d71 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 _0x4154=['buildExpression','type','default','value','start','end','Tag','map','clause','and','tags','ids','User','user','skip','keys','compact','push','Contact','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','uc.UserId\x20=\x20?','\x20=\x20?','resolve','then','filter','getLists','c.ListId\x20IS\x20NULL','c.ListId\x20IN\x20?','attributes','group','limit','offset','having','order','DESC','from','color','SELECT','sequelize','query','toString','Tags','clone','c.id','isEmpty','t.id\x20IN\x20?','Sequelize','QueryTypes','exports','lodash','squel','../parsers/advancedSearch','../parsers/qs','../interaction/utils','../../mysqldb','role','agent','search','ListId','autocomplete','true','select','cm_contacts','where','c.deletedAt\x20IS\x20NULL','subqry','cm_user_has_contacts','uc.CmContactId\x20=\x20','.id','left_join','cm_contact_has_tags','ct.CmContactId\x20=\x20','tools_tags','firstName','lastName','phone','mobile','fax','CompanyId','createdAt','updatedAt','deletedAt','TagIds','includes','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)','isNumeric','c.id\x20LIKE\x20?','c.fax\x20LIKE\x20?','c.email\x20LIKE\x20?','c.lastName\x20LIKE\x20?','parseSearch','sqlOperator','conditions','name','fieldType','datetime','castTo','DATE'];(function(_0x129295,_0x397f6f){var _0x401f9c=function(_0x588bc7){while(--_0x588bc7){_0x129295['push'](_0x129295['shift']());}};_0x401f9c(++_0x397f6f);}(_0x4154,0x16f));var _0x4415=function(_0x54e4ec,_0x183144){_0x54e4ec=_0x54e4ec-0x0;var _0x44ef91=_0x4154[_0x54e4ec];return _0x44ef91;};'use strict';var _=require(_0x4415('0x0'));var squel=require(_0x4415('0x1'));var as=require(_0x4415('0x2'));var qs=require(_0x4415('0x3'));var utils=require(_0x4415('0x4'));var db=require(_0x4415('0x5'))['db'];function skipContactsQuery(_0x19bbd1,_0x36b109){var _0x2be31d=![];if(_0x19bbd1[_0x4415('0x6')]===_0x4415('0x7')&&!_0x36b109[_0x4415('0x8')]&&!_0x36b109[_0x4415('0x9')]&&_0x36b109[_0x4415('0xa')]!==_0x4415('0xb')){_0x2be31d=!![];}return _0x2be31d;}function getContactsSubquery(){return squel[_0x4415('0xc')]()['from'](_0x4415('0xd'),'c')[_0x4415('0xe')](_0x4415('0xf'));}function applyJoinClauses(_0x2266d4,_0x32aa2f){var _0x1376a4=_0x32aa2f?'c':_0x4415('0x10');_0x2266d4['left_join'](_0x4415('0x11'),'uc',_0x4415('0x12')+_0x1376a4+_0x4415('0x13'))[_0x4415('0x14')](_0x4415('0x15'),'ct',_0x4415('0x16')+_0x1376a4+'.id')['left_join'](_0x4415('0x17'),'t','t.id\x20=\x20ct.TagId');return _0x2266d4;}function addFieldsToQuery(_0xb88521,_0x1c8656,_0x168558,_0x29fbb8,_0x33b113){var _0x177826=_0x33b113?'c':_0x4415('0x10');if(!_0x1c8656){_0x1c8656=['id',_0x4415('0x18'),_0x4415('0x19'),_0x4415('0x1a'),_0x4415('0x1b'),_0x4415('0x1c'),'email','ListId',_0x4415('0x1d'),_0x4415('0x1e'),_0x4415('0x1f'),_0x4415('0x20'),_0x4415('0x21')];}else if(!_0x1c8656[_0x4415('0x22')]('id')){_0x1c8656['push']('id');}var _0x362d15=_0x168558&&_0x33b113||!_0x168558&&!_0x33b113;if(_0x29fbb8){_0x362d15=_0x29fbb8&&_0x33b113||!_0x29fbb8&&!_0x33b113;}_0x1c8656[_0x4415('0x23')](function(_0x3dbd97){if(_0x3dbd97===_0x4415('0x21')){if(_0x362d15){_0xb88521[_0x4415('0x24')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x3dbd97);}else if(_0x168558||_0x29fbb8){_0xb88521[_0x4415('0x24')](_0x177826+'.'+_0x3dbd97);}}else{_0xb88521[_0x4415('0x24')](_0x177826+'.'+_0x3dbd97);}});return _0xb88521;}function getSqlClauses(){var _0x300c0f={'default':squel[_0x4415('0x25')](),'fields':squel['expr'](),'filter':squel[_0x4415('0x25')](),'tags':{'clause':squel[_0x4415('0x25')](),'ids':null},'user':{'clause':squel[_0x4415('0x25')](),'skip':![]}};return _0x300c0f;}function parseTagParameter(_0x1dcd4d){var _0x276ae7=squel[_0x4415('0x25')]();if(_0x1dcd4d){var _0x5673c2=utils[_0x4415('0x26')](_0x1dcd4d);_0x5673c2[_0x4415('0x23')](function(_0x285fd9){_0x276ae7['or'](_0x4415('0x27'),'%,'+_0x285fd9+',%');});}return _0x276ae7;}function parseSearchFilter(_0x53e0f4){var _0x1be365=squel[_0x4415('0x25')]();if(_0x53e0f4){var _0x34e3c8=_0x53e0f4[_0x4415('0x28')]('\x5c','\x5c\x5c')[_0x4415('0x28')](/'/g,'\x27\x27');if(_0x34e3c8[_0x4415('0x29')]('\x20')[_0x4415('0x2a')]>0x1){_0x1be365['or'](_0x4415('0x2b'),qs['getFullTextValue'](_0x34e3c8,!![]),null);}else{if(qs[_0x4415('0x2c')](_0x34e3c8)){_0x1be365['or'](_0x4415('0x2d'),_0x34e3c8+'%');_0x1be365['or']('c.phone\x20LIKE\x20?',_0x34e3c8+'%');_0x1be365['or']('c.mobile\x20LIKE\x20?',_0x34e3c8+'%');_0x1be365['or'](_0x4415('0x2e'),_0x34e3c8+'%');}else if(qs['isEmail'](_0x34e3c8)){_0x1be365['or'](_0x4415('0x2f'),_0x34e3c8+'%');}else{_0x1be365['or']('c.firstName\x20LIKE\x20?','%'+_0x34e3c8+'%');_0x1be365['or'](_0x4415('0x30'),'%'+_0x34e3c8+'%');_0x1be365['or'](_0x4415('0x2f'),'%'+_0x34e3c8+'%');}}}return _0x1be365;}function parseAdvancedSearchFilter(_0x2a80f6,_0x41f237){var _0x1afc48=getSqlClauses();var _0x46d2c8=as[_0x4415('0x31')](_0x2a80f6);var _0x57f672=_0x46d2c8[_0x4415('0x32')];for(var _0x2c9ff5=0x0;_0x2c9ff5<_0x46d2c8['conditions'][_0x4415('0x2a')];_0x2c9ff5++){var _0x381c81=_0x46d2c8[_0x4415('0x33')][_0x2c9ff5];var _0x1b26c2='c';var _0x3d1314=_['find'](_0x41f237,[_0x4415('0x34'),_0x381c81[_0x4415('0x24')]]);if(_0x3d1314){if(_0x381c81[_0x4415('0x24')]==='dateOfBirth'||_0x3d1314[_0x4415('0x35')]===_0x4415('0x36')){_0x381c81[_0x4415('0x37')]=_0x4415('0x38');}var _0x3c26ad=as[_0x4415('0x39')](_0x1b26c2,_0x3d1314[_0x4415('0x3a')],_0x381c81);_0x1afc48[_0x4415('0x3b')][_0x57f672](_0x3c26ad['text'],_0x3c26ad[_0x4415('0x3c')][_0x4415('0x3d')],_0x3c26ad[_0x4415('0x3c')][_0x4415('0x3e')]);}else{if(_0x381c81[_0x4415('0x24')]===_0x4415('0x3f')){var _0x1f45f2=_0x381c81[_0x4415('0x3c')][_0x4415('0x29')](',')[_0x4415('0x40')](function(_0x4518ac){return Number(_0x4518ac);});var _0x46293f=parseTagParameter(_0x1f45f2);_0x1afc48['tags'][_0x4415('0x41')][_0x4415('0x42')](_0x46293f);_0x1afc48[_0x4415('0x43')][_0x4415('0x44')]=_0x1f45f2;}else if(_0x381c81[_0x4415('0x24')]===_0x4415('0x45')){_0x1afc48[_0x4415('0x46')][_0x4415('0x41')][_0x4415('0x42')]('uc.UserId\x20=\x20?',_0x381c81[_0x4415('0x3c')]);_0x1afc48[_0x4415('0x46')][_0x4415('0x47')]=!![];}}}return _0x1afc48;}function parseModelFields(_0x4af1b2,_0x27ac55){var _0x4dfaa5=squel['expr']();var _0x249b6a=_(_0x4af1b2)[_0x4415('0x48')]()[_0x4415('0x40')](function(_0x41a5b5){return _['some'](_0x27ac55,[_0x4415('0x34'),_0x41a5b5])?_0x41a5b5:undefined;})[_0x4415('0x49')]()['value']();if(_0x4af1b2['Contact']){_0x249b6a[_0x4415('0x4a')](_0x4415('0x4b'));}if(_0x4af1b2[_0x4415('0x45')]){_0x249b6a[_0x4415('0x4a')](_0x4415('0x45'));}if(_0x249b6a[_0x4415('0x2a')]>0x0){_0x249b6a[_0x4415('0x23')](function(_0x42d696){if(_0x42d696==='ListId'){_0x4dfaa5[_0x4415('0x42')]('c.ListId\x20IN\x20?',[]['concat'](_0x4af1b2[_0x42d696]));}else if(_0x42d696===_0x4415('0x4b')){var _0x5a59b3='%'+_0x4af1b2[_0x42d696]+'%';_0x4dfaa5[_0x4415('0x42')](_0x4415('0x4c'),_0x5a59b3);}else if(_0x42d696===_0x4415('0x45')){_0x4dfaa5['and'](_0x4415('0x4d'),_0x4af1b2[_0x42d696]);}else{_0x4dfaa5['and']('c.'+_0x42d696+_0x4415('0x4e'),_0x4af1b2[_0x42d696]);}});}return _0x4dfaa5;}function parseQueryParameters(_0x34483f,_0x142618){var _0x2ff113=getSqlClauses();return Promise[_0x4415('0x4f')]()['then'](function(){return parseModelFields(_0x34483f,_0x142618);})[_0x4415('0x50')](function(_0x31d68f){_0x2ff113['fields'][_0x4415('0x42')](_0x31d68f);return parseTagParameter(_0x34483f['tag']);})[_0x4415('0x50')](function(_0x3ac769){_0x2ff113[_0x4415('0x43')][_0x4415('0x41')][_0x4415('0x42')](_0x3ac769);return parseSearchFilter(_0x34483f[_0x4415('0x51')]);})[_0x4415('0x50')](function(_0x37fb98){_0x2ff113[_0x4415('0x51')]=_0x37fb98;return _0x2ff113;});}function checkListsRestrictions(_0x28675e,_0x1dc136,_0x56853f){var _0x355fe0=squel['expr']();return Promise[_0x4415('0x4f')]()[_0x4415('0x50')](function(){if(_0x1dc136[_0x4415('0x8')]&&_0x28675e[_0x4415('0x6')]==='agent'&&!_0x56853f){return _0x28675e[_0x4415('0x52')]({'attributes':['id'],'raw':!![]});}})[_0x4415('0x50')](function(_0x1683c7){if(_0x1683c7){if(_0x1683c7[_0x4415('0x2a')]===0x0){_0x355fe0[_0x4415('0x42')](_0x4415('0x53'));}else{_0x355fe0[_0x4415('0x42')](_0x4415('0x54'),_['map'](_0x1683c7,'id'));}}})[_0x4415('0x50')](function(){return _0x355fe0;});}function buildContactsQuery(_0x48f4cc,_0x526789,_0x45b15f,_0x14117e,_0x53319f,_0xbb26f2){if(_0x526789){_0x526789=_0x45b15f[_0x4415('0x55')];}_0x48f4cc=addFieldsToQuery(_0x48f4cc,_0x526789,_0x14117e,_0xbb26f2,!![]);var _0x419895=squel[_0x4415('0xc')]();_0x419895=addFieldsToQuery(_0x419895,_0x526789,_0x14117e,_0xbb26f2,![]);if(_0x14117e||_0xbb26f2){_0x48f4cc=applyJoinClauses(_0x48f4cc,!![]);_0x48f4cc[_0x4415('0x56')]('c.id');if(_0x45b15f[_0x4415('0x57')]){_0x419895[_0x4415('0x57')](_0x45b15f['limit']);}if(_0x45b15f[_0x4415('0x58')]){_0x419895[_0x4415('0x58')](_0x45b15f[_0x4415('0x58')]);}}else{_0x419895=applyJoinClauses(_0x419895,![]);_0x419895['group']('subqry.id');if(_0x45b15f['limit']){_0x48f4cc[_0x4415('0x57')](_0x45b15f[_0x4415('0x57')]);}if(_0x45b15f['offset']){_0x48f4cc[_0x4415('0x58')](_0x45b15f['offset']);}}_0x419895[_0x4415('0x59')](_0x53319f);if(_0x45b15f['order']){_0x45b15f[_0x4415('0x5a')][_0x4415('0x23')](function(_0x204377){_0x48f4cc[_0x4415('0x5a')]('c.'+_0x204377[0x0],_0x204377[0x1]===_0x4415('0x5b')?![]:!![]);_0x419895[_0x4415('0x5a')]('subqry.'+_0x204377[0x0],_0x204377[0x1]===_0x4415('0x5b')?![]:!![]);});}_0x419895[_0x4415('0x5c')](_0x48f4cc,_0x4415('0x10'));return _0x419895;}function getFilteredContacts(_0x455a94){var _0x147220=[];return db[_0x4415('0x3f')]['findAll']({'attributes':['id',_0x4415('0x34'),_0x4415('0x5d')],'raw':!![]})[_0x4415('0x50')](function(_0x54977f){_0x147220=_['keyBy'](_0x54977f,'id');var _0x3ae4e8={'type':db['Sequelize']['QueryTypes'][_0x4415('0x5e')],'model':db['CmContact'],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x4415('0x5f')][_0x4415('0x60')](_0x455a94[_0x4415('0x61')](),_0x3ae4e8);})[_0x4415('0x50')](function(_0x24d952){_0x24d952[_0x4415('0x23')](function(_0x40d663){if(_0x40d663[_0x4415('0x21')]){_0x40d663[_0x4415('0x62')]=[];_0x40d663['TagIds'][_0x4415('0x29')](',')[_0x4415('0x23')](function(_0x588b0e){_0x40d663[_0x4415('0x62')]['push'](_0x147220[_0x588b0e]);});}delete _0x40d663[_0x4415('0x21')];});return _0x24d952;});}function countFilteredContacts(_0x4f946c,_0x1444ae){var _0x53a5a7=_0x4f946c[_0x4415('0x63')]();_0x53a5a7[_0x4415('0x24')]('COUNT(*)');_0x53a5a7=applyJoinClauses(_0x53a5a7,!![]);_0x4f946c[_0x4415('0x56')](_0x4415('0x64'));var _0x46fd5a=utils[_0x4415('0x26')](_0x1444ae);if(!_[_0x4415('0x65')](_0x46fd5a)){_0x53a5a7[_0x4415('0xe')](_0x4415('0x66'),_0x46fd5a);}var _0x1b3c95={'type':db[_0x4415('0x67')][_0x4415('0x68')]['SELECT'],'raw':!![]};return db[_0x4415('0x5f')][_0x4415('0x60')](_0x53a5a7[_0x4415('0x61')](),_0x1b3c95)[_0x4415('0x50')](function(_0x1915fb){return _0x1915fb[0x0]['COUNT(*)'];});}module[_0x4415('0x69')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +var _0x3323=['fields','tag','filter','resolve','search','getLists','c.ListId\x20IS\x20NULL','attributes','group','c.id','limit','offset','order','DESC','name','color','keyBy','Sequelize','QueryTypes','SELECT','CmContact','sequelize','query','toString','Tags','clone','isEmpty','where','COUNT(*)','exports','squel','../parsers/advancedSearch','../parsers/qs','../interaction/utils','agent','ListId','true','select','cm_contacts','c.deletedAt\x20IS\x20NULL','subqry','left_join','cm_user_has_contacts','.id','ct.CmContactId\x20=\x20','tools_tags','t.id\x20=\x20ct.TagId','firstName','phone','mobile','fax','email','CompanyId','createdAt','updatedAt','deletedAt','push','TagIds','field','expr','getSelectedTags','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','split','length','getFullTextValue','c.phone\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','conditions','find','dateOfBirth','fieldType','castTo','DATE','buildExpression','type','default','text','value','start','end','Tag','tags','clause','and','ids','User','user','uc.UserId\x20=\x20?','skip','keys','map','compact','Contact','forEach','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','then'];(function(_0x52ed93,_0x39d838){var _0x23250e=function(_0x4d134b){while(--_0x4d134b){_0x52ed93['push'](_0x52ed93['shift']());}};_0x23250e(++_0x39d838);}(_0x3323,0x85));var _0x3332=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0x3323[_0x1e4360];return _0x31e6b4;};'use strict';var _=require('lodash');var squel=require(_0x3332('0x0'));var as=require(_0x3332('0x1'));var qs=require(_0x3332('0x2'));var utils=require(_0x3332('0x3'));var db=require('../../mysqldb')['db'];function skipContactsQuery(_0x2a9db4,_0x97c9a5){var _0x5e8ba8=![];if(_0x2a9db4['role']===_0x3332('0x4')&&!_0x97c9a5['search']&&!_0x97c9a5[_0x3332('0x5')]&&_0x97c9a5['autocomplete']!==_0x3332('0x6')){_0x5e8ba8=!![];}return _0x5e8ba8;}function getContactsSubquery(){return squel[_0x3332('0x7')]()['from'](_0x3332('0x8'),'c')['where'](_0x3332('0x9'));}function applyJoinClauses(_0x27632c,_0x270e14){var _0x744c2c=_0x270e14?'c':_0x3332('0xa');_0x27632c[_0x3332('0xb')](_0x3332('0xc'),'uc','uc.CmContactId\x20=\x20'+_0x744c2c+_0x3332('0xd'))[_0x3332('0xb')]('cm_contact_has_tags','ct',_0x3332('0xe')+_0x744c2c+_0x3332('0xd'))['left_join'](_0x3332('0xf'),'t',_0x3332('0x10'));return _0x27632c;}function addFieldsToQuery(_0x5f05e5,_0xd1fa1c,_0x5f1060,_0x4809e4,_0x20f1c6){var _0x58af7b=_0x20f1c6?'c':_0x3332('0xa');if(!_0xd1fa1c){_0xd1fa1c=['id',_0x3332('0x11'),'lastName',_0x3332('0x12'),_0x3332('0x13'),_0x3332('0x14'),_0x3332('0x15'),_0x3332('0x5'),_0x3332('0x16'),_0x3332('0x17'),_0x3332('0x18'),_0x3332('0x19'),'TagIds'];}else if(!_0xd1fa1c['includes']('id')){_0xd1fa1c[_0x3332('0x1a')]('id');}var _0x402e82=_0x5f1060&&_0x20f1c6||!_0x5f1060&&!_0x20f1c6;if(_0x4809e4){_0x402e82=_0x4809e4&&_0x20f1c6||!_0x4809e4&&!_0x20f1c6;}_0xd1fa1c['forEach'](function(_0x4bc14f){if(_0x4bc14f===_0x3332('0x1b')){if(_0x402e82){_0x5f05e5['field']('GROUP_CONCAT(DISTINCT\x20t.id)',_0x4bc14f);}else if(_0x5f1060||_0x4809e4){_0x5f05e5[_0x3332('0x1c')](_0x58af7b+'.'+_0x4bc14f);}}else{_0x5f05e5[_0x3332('0x1c')](_0x58af7b+'.'+_0x4bc14f);}});return _0x5f05e5;}function getSqlClauses(){var _0x14fb4e={'default':squel[_0x3332('0x1d')](),'fields':squel[_0x3332('0x1d')](),'filter':squel[_0x3332('0x1d')](),'tags':{'clause':squel[_0x3332('0x1d')](),'ids':null},'user':{'clause':squel['expr'](),'skip':![]}};return _0x14fb4e;}function parseTagParameter(_0x509ae1){var _0x27ecc3=squel[_0x3332('0x1d')]();if(_0x509ae1){var _0x1023ed=utils[_0x3332('0x1e')](_0x509ae1);_0x1023ed['forEach'](function(_0x1c96e1){_0x27ecc3['or'](_0x3332('0x1f'),'%,'+_0x1c96e1+',%');});}return _0x27ecc3;}function parseSearchFilter(_0x275f9f){var _0x218e14=squel[_0x3332('0x1d')]();if(_0x275f9f){var _0x44e8dc=_0x275f9f[_0x3332('0x20')]('\x5c','\x5c\x5c')[_0x3332('0x20')](/'/g,'\x27\x27');if(_0x44e8dc[_0x3332('0x21')]('\x20')[_0x3332('0x22')]>0x1){_0x218e14['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x3332('0x23')](_0x44e8dc,!![]),null);}else{if(qs['isNumeric'](_0x44e8dc)){_0x218e14['or']('c.id\x20LIKE\x20?',_0x44e8dc+'%');_0x218e14['or'](_0x3332('0x24'),_0x44e8dc+'%');_0x218e14['or']('c.mobile\x20LIKE\x20?',_0x44e8dc+'%');_0x218e14['or'](_0x3332('0x25'),_0x44e8dc+'%');}else if(qs[_0x3332('0x26')](_0x44e8dc)){_0x218e14['or'](_0x3332('0x27'),_0x44e8dc+'%');}else{_0x218e14['or'](_0x3332('0x28'),'%'+_0x44e8dc+'%');_0x218e14['or']('c.lastName\x20LIKE\x20?','%'+_0x44e8dc+'%');_0x218e14['or']('c.email\x20LIKE\x20?','%'+_0x44e8dc+'%');}}}return _0x218e14;}function parseAdvancedSearchFilter(_0x3e41fd,_0x2a98e7){var _0x229b7c=getSqlClauses();var _0x5bfbc0=as['parseSearch'](_0x3e41fd);var _0x2e3a53=_0x5bfbc0['sqlOperator'];for(var _0x1774f6=0x0;_0x1774f6<_0x5bfbc0[_0x3332('0x29')][_0x3332('0x22')];_0x1774f6++){var _0x3403a5=_0x5bfbc0[_0x3332('0x29')][_0x1774f6];var _0x20863e='c';var _0x5dd7a5=_[_0x3332('0x2a')](_0x2a98e7,['name',_0x3403a5[_0x3332('0x1c')]]);if(_0x5dd7a5){if(_0x3403a5[_0x3332('0x1c')]===_0x3332('0x2b')||_0x5dd7a5[_0x3332('0x2c')]==='datetime'){_0x3403a5[_0x3332('0x2d')]=_0x3332('0x2e');}var _0x9922ea=as[_0x3332('0x2f')](_0x20863e,_0x5dd7a5[_0x3332('0x30')],_0x3403a5);_0x229b7c[_0x3332('0x31')][_0x2e3a53](_0x9922ea[_0x3332('0x32')],_0x9922ea[_0x3332('0x33')][_0x3332('0x34')],_0x9922ea['value'][_0x3332('0x35')]);}else{if(_0x3403a5[_0x3332('0x1c')]===_0x3332('0x36')){var _0x4c0593=_0x3403a5[_0x3332('0x33')][_0x3332('0x21')](',')['map'](function(_0x3648df){return Number(_0x3648df);});var _0x5df05b=parseTagParameter(_0x4c0593);_0x229b7c[_0x3332('0x37')][_0x3332('0x38')][_0x3332('0x39')](_0x5df05b);_0x229b7c[_0x3332('0x37')][_0x3332('0x3a')]=_0x4c0593;}else if(_0x3403a5[_0x3332('0x1c')]===_0x3332('0x3b')){_0x229b7c[_0x3332('0x3c')][_0x3332('0x38')][_0x3332('0x39')](_0x3332('0x3d'),_0x3403a5[_0x3332('0x33')]);_0x229b7c[_0x3332('0x3c')][_0x3332('0x3e')]=!![];}}}return _0x229b7c;}function parseModelFields(_0x561a78,_0xae86ee){var _0xfca7ff=squel['expr']();var _0x57ae8b=_(_0x561a78)[_0x3332('0x3f')]()[_0x3332('0x40')](function(_0x5573dc){return _['some'](_0xae86ee,['name',_0x5573dc])?_0x5573dc:undefined;})[_0x3332('0x41')]()[_0x3332('0x33')]();if(_0x561a78[_0x3332('0x42')]){_0x57ae8b[_0x3332('0x1a')](_0x3332('0x42'));}if(_0x561a78[_0x3332('0x3b')]){_0x57ae8b['push'](_0x3332('0x3b'));}if(_0x57ae8b[_0x3332('0x22')]>0x0){_0x57ae8b[_0x3332('0x43')](function(_0x421ed5){if(_0x421ed5===_0x3332('0x5')){_0xfca7ff[_0x3332('0x39')](_0x3332('0x44'),[][_0x3332('0x45')](_0x561a78[_0x421ed5]));}else if(_0x421ed5===_0x3332('0x42')){var _0x27f5fe='%'+_0x561a78[_0x421ed5]+'%';_0xfca7ff[_0x3332('0x39')](_0x3332('0x46'),_0x27f5fe);}else if(_0x421ed5===_0x3332('0x3b')){_0xfca7ff[_0x3332('0x39')]('uc.UserId\x20=\x20?',_0x561a78[_0x421ed5]);}else{_0xfca7ff[_0x3332('0x39')]('c.'+_0x421ed5+_0x3332('0x47'),_0x561a78[_0x421ed5]);}});}return _0xfca7ff;}function parseQueryParameters(_0x3e1b05,_0x251a02){var _0x186f86=getSqlClauses();return Promise['resolve']()[_0x3332('0x48')](function(){return parseModelFields(_0x3e1b05,_0x251a02);})[_0x3332('0x48')](function(_0xbf6218){_0x186f86[_0x3332('0x49')]['and'](_0xbf6218);return parseTagParameter(_0x3e1b05[_0x3332('0x4a')]);})[_0x3332('0x48')](function(_0x3a3895){_0x186f86[_0x3332('0x37')]['clause'][_0x3332('0x39')](_0x3a3895);return parseSearchFilter(_0x3e1b05['filter']);})[_0x3332('0x48')](function(_0x2807e6){_0x186f86[_0x3332('0x4b')]=_0x2807e6;return _0x186f86;});}function checkListsRestrictions(_0x50ca05,_0x961a7a,_0x1fcb74){var _0x5cc8a7=squel[_0x3332('0x1d')]();return Promise[_0x3332('0x4c')]()[_0x3332('0x48')](function(){if(_0x961a7a[_0x3332('0x4d')]&&_0x50ca05['role']===_0x3332('0x4')&&!_0x1fcb74){return _0x50ca05[_0x3332('0x4e')]({'attributes':['id'],'raw':!![]});}})['then'](function(_0x364fff){if(_0x364fff){if(_0x364fff['length']===0x0){_0x5cc8a7[_0x3332('0x39')](_0x3332('0x4f'));}else{_0x5cc8a7['and'](_0x3332('0x44'),_[_0x3332('0x40')](_0x364fff,'id'));}}})[_0x3332('0x48')](function(){return _0x5cc8a7;});}function buildContactsQuery(_0x374c1b,_0x1445dd,_0x330331,_0xb5967f,_0x6e77a3,_0x411f4d){if(_0x1445dd){_0x1445dd=_0x330331[_0x3332('0x50')];}_0x374c1b=addFieldsToQuery(_0x374c1b,_0x1445dd,_0xb5967f,_0x411f4d,!![]);var _0x2593aa=squel[_0x3332('0x7')]();_0x2593aa=addFieldsToQuery(_0x2593aa,_0x1445dd,_0xb5967f,_0x411f4d,![]);if(_0xb5967f||_0x411f4d){_0x374c1b=applyJoinClauses(_0x374c1b,!![]);_0x374c1b[_0x3332('0x51')](_0x3332('0x52'));if(_0x330331[_0x3332('0x53')]){_0x2593aa[_0x3332('0x53')](_0x330331['limit']);}if(_0x330331[_0x3332('0x54')]){_0x2593aa[_0x3332('0x54')](_0x330331[_0x3332('0x54')]);}}else{_0x2593aa=applyJoinClauses(_0x2593aa,![]);_0x2593aa['group']('subqry.id');if(_0x330331[_0x3332('0x53')]){_0x374c1b[_0x3332('0x53')](_0x330331[_0x3332('0x53')]);}if(_0x330331['offset']){_0x374c1b[_0x3332('0x54')](_0x330331[_0x3332('0x54')]);}}_0x2593aa['having'](_0x6e77a3);if(_0x330331[_0x3332('0x55')]){_0x330331['order'][_0x3332('0x43')](function(_0x1c6a7e){_0x374c1b[_0x3332('0x55')]('c.'+_0x1c6a7e[0x0],_0x1c6a7e[0x1]===_0x3332('0x56')?![]:!![]);_0x2593aa[_0x3332('0x55')]('subqry.'+_0x1c6a7e[0x0],_0x1c6a7e[0x1]==='DESC'?![]:!![]);});}_0x2593aa['from'](_0x374c1b,_0x3332('0xa'));return _0x2593aa;}function getFilteredContacts(_0x3f7df1){var _0x107361=[];return db[_0x3332('0x36')]['findAll']({'attributes':['id',_0x3332('0x57'),_0x3332('0x58')],'raw':!![]})[_0x3332('0x48')](function(_0x527a73){_0x107361=_[_0x3332('0x59')](_0x527a73,'id');var _0x47edd6={'type':db[_0x3332('0x5a')][_0x3332('0x5b')][_0x3332('0x5c')],'model':db[_0x3332('0x5d')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x3332('0x5e')][_0x3332('0x5f')](_0x3f7df1[_0x3332('0x60')](),_0x47edd6);})[_0x3332('0x48')](function(_0x58ca4d){_0x58ca4d[_0x3332('0x43')](function(_0x283b49){if(_0x283b49[_0x3332('0x1b')]){_0x283b49['Tags']=[];_0x283b49[_0x3332('0x1b')][_0x3332('0x21')](',')['forEach'](function(_0x19ff68){_0x283b49[_0x3332('0x61')]['push'](_0x107361[_0x19ff68]);});}delete _0x283b49['TagIds'];});return _0x58ca4d;});}function countFilteredContacts(_0x546585,_0x1e5123){var _0x3444d1=_0x546585[_0x3332('0x62')]();_0x3444d1[_0x3332('0x1c')]('COUNT(*)');_0x3444d1=applyJoinClauses(_0x3444d1,!![]);_0x546585[_0x3332('0x51')](_0x3332('0x52'));var _0x215695=utils[_0x3332('0x1e')](_0x1e5123);if(!_[_0x3332('0x63')](_0x215695)){_0x3444d1[_0x3332('0x64')]('t.id\x20IN\x20?',_0x215695);}var _0x503969={'type':db[_0x3332('0x5a')][_0x3332('0x5b')][_0x3332('0x5c')],'raw':!![]};return db['sequelize'][_0x3332('0x5f')](_0x3444d1['toString'](),_0x503969)['then'](function(_0x2c4bd3){return _0x2c4bd3[0x0][_0x3332('0x65')];});}module[_0x3332('0x66')]={'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 7d2709c..4ae862f 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 _0x2895=['utf8','base64','crypto','bluebird','../../config/environment','../../config/logger','app','secrets','aes-256-ctr','aes192','encrypt','algorithm','join','error','test','getCiphers','filter','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','data','update','binary','write','end','final','close','createDecipher','unlink','encryptString','secret'];(function(_0x3a998c,_0xd49f3a){var _0x1be73e=function(_0x37dbb1){while(--_0x37dbb1){_0x3a998c['push'](_0x3a998c['shift']());}};_0x1be73e(++_0xd49f3a);}(_0x2895,0x10a));var _0x5289=function(_0x5dcaf7,_0x5a4575){_0x5dcaf7=_0x5dcaf7-0x0;var _0x430bc2=_0x2895[_0x5dcaf7];return _0x430bc2;};'use strict';var crypto=require(_0x5289('0x0'));var fs=require('fs');var BPromise=require(_0x5289('0x1'));var _=require('lodash');var config=require(_0x5289('0x2'));var logger=require(_0x5289('0x3'))(_0x5289('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x5289('0x5')]['session'],'algorithm':_0x5289('0x6')};const fileOptions={'algorithm':_0x5289('0x7')};if(config[_0x5289('0x8')]&&config['encrypt']['algorithm']){var isSupported=isAlgorithmSupported(config[_0x5289('0x8')][_0x5289('0x9')]);if(isSupported){fileOptions['algorithm']=config[_0x5289('0x8')]['algorithm'];}else{var supportedAlgorithms=getSupportedCiphers()[_0x5289('0xa')](',\x20');logger[_0x5289('0xb')](config[_0x5289('0x8')][_0x5289('0x9')],'is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:',supportedAlgorithms);}}function isASupportedCipher(_0x239f47){return AES_SUPPORTED_RX[_0x5289('0xc')](_0x239f47);}function getSupportedCiphers(){return crypto[_0x5289('0xd')]()[_0x5289('0xe')](isASupportedCipher);}function isAlgorithmSupported(_0x255362){return getSupportedCiphers()['indexOf'](_0x255362)>-0x1;}function combineOptions(_0x1e6c1e){var _0x2045db={};for(var _0x29ef10 in fileOptions){if(fileOptions['hasOwnProperty'](_0x29ef10)){_0x2045db[_0x29ef10]=fileOptions[_0x29ef10];}}if(_0x1e6c1e){for(var _0x48d6d6 in _0x1e6c1e){if(_0x1e6c1e[_0x5289('0xf')](_0x48d6d6)){_0x2045db[_0x48d6d6]=_0x1e6c1e[_0x48d6d6];}}}return _0x2045db;}exports[_0x5289('0x10')]=function(_0x5d7a46,_0x1f679b,_0x37c125,_0x31d76e){return new BPromise(function(_0x553811,_0x38fe26){_0x31d76e=combineOptions(_0x31d76e);var _0x5dff26=new Buffer(_0x37c125);var _0x1e1b9c=fs[_0x5289('0x11')](_0x5d7a46);var _0x1d97e3=fs[_0x5289('0x12')](_0x1f679b);var _0x4989e9=crypto[_0x5289('0x13')](_0x31d76e[_0x5289('0x9')],_0x5dff26);_0x1e1b9c['on'](_0x5289('0x14'),function(_0x3d9348){var _0xce656e=new Buffer(_0x4989e9[_0x5289('0x15')](_0x3d9348),_0x5289('0x16'));_0x1d97e3[_0x5289('0x17')](_0xce656e);});_0x1e1b9c['on'](_0x5289('0x18'),function(){try{var _0x2bd045=new Buffer(_0x4989e9[_0x5289('0x19')]('binary'),_0x5289('0x16'));_0x1d97e3['write'](_0x2bd045);_0x1d97e3[_0x5289('0x18')]();_0x1d97e3['on'](_0x5289('0x1a'),function(){return _0x553811(_0x1f679b);});}catch(_0x3bb282){fs['unlink'](_0x1f679b);return _0x38fe26(_0x3bb282);}});});};exports['decryptFile']=function(_0x5d641b,_0x33a468,_0x3b7157,_0x3b0c14){return new BPromise(function(_0x30bfb7,_0x219771){_0x3b0c14=combineOptions(_0x3b0c14);var _0x2b3786=new Buffer(_0x3b7157);var _0x1f2b9e=fs['createReadStream'](_0x5d641b);var _0x370e5f=fs[_0x5289('0x12')](_0x33a468);var _0x3b7b53=crypto[_0x5289('0x1b')](_0x3b0c14[_0x5289('0x9')],_0x2b3786);_0x1f2b9e['on'](_0x5289('0x14'),function(_0x2be696){var _0x2559b6=new Buffer(_0x3b7b53[_0x5289('0x15')](_0x2be696),'binary');_0x370e5f[_0x5289('0x17')](_0x2559b6);});_0x1f2b9e['on'](_0x5289('0x18'),function(){try{var _0x568650=new Buffer(_0x3b7b53['final'](_0x5289('0x16')),_0x5289('0x16'));_0x370e5f[_0x5289('0x17')](_0x568650);_0x370e5f[_0x5289('0x18')]();_0x370e5f['on'](_0x5289('0x1a'),function(){return _0x30bfb7(_0x33a468);});}catch(_0x4f4eb7){fs[_0x5289('0x1c')](_0x33a468);return _0x219771(_0x4f4eb7);}});});};exports[_0x5289('0x1d')]=function(_0x250584,_0xf985f7,_0x1c5ba0){var _0x57ffe7=_0x1c5ba0||stringOptions[_0x5289('0x9')];var _0x35aeb0=_0xf985f7||stringOptions[_0x5289('0x1e')];var _0x3b4ba0=crypto[_0x5289('0x13')](_0x57ffe7,_0x35aeb0);var _0x41d2b0=_0x3b4ba0['update'](_0x250584,_0x5289('0x1f'),_0x5289('0x20'));_0x41d2b0+=_0x3b4ba0[_0x5289('0x19')](_0x5289('0x20'));return _0x41d2b0;};exports['decryptString']=function(_0x395bec,_0xc56ede,_0x37ec8f){var _0x5683cd=_0x37ec8f||stringOptions['algorithm'];var _0xc34e86=_0xc56ede||stringOptions[_0x5289('0x1e')];var _0x46d6fe=crypto[_0x5289('0x1b')](_0x5683cd,_0xc34e86);var _0x442af8=_0x46d6fe[_0x5289('0x15')](_0x395bec,'base64',_0x5289('0x1f'));_0x442af8+=_0x46d6fe['final'](_0x5289('0x1f'));return _0x442af8;}; \ No newline at end of file +var _0x6ccf=['is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','data','update','binary','end','final','write','close','unlink','decryptFile','createDecipher','encryptString','utf8','base64','decryptString','secret','crypto','bluebird','lodash','../../config/environment','../../config/logger','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','join'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0x6ccf,0x1a4));var _0xf6cc=function(_0x1ebce2,_0x10e903){_0x1ebce2=_0x1ebce2-0x0;var _0x4a330c=_0x6ccf[_0x1ebce2];return _0x4a330c;};'use strict';var crypto=require(_0xf6cc('0x0'));var fs=require('fs');var BPromise=require(_0xf6cc('0x1'));var _=require(_0xf6cc('0x2'));var config=require(_0xf6cc('0x3'));var logger=require(_0xf6cc('0x4'))('app');const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xf6cc('0x5')][_0xf6cc('0x6')],'algorithm':_0xf6cc('0x7')};const fileOptions={'algorithm':_0xf6cc('0x8')};if(config[_0xf6cc('0x9')]&&config['encrypt']['algorithm']){var isSupported=isAlgorithmSupported(config['encrypt']['algorithm']);if(isSupported){fileOptions[_0xf6cc('0xa')]=config['encrypt'][_0xf6cc('0xa')];}else{var supportedAlgorithms=getSupportedCiphers()[_0xf6cc('0xb')](',\x20');logger['error'](config[_0xf6cc('0x9')][_0xf6cc('0xa')],_0xf6cc('0xc'),supportedAlgorithms);}}function isASupportedCipher(_0x5c663f){return AES_SUPPORTED_RX[_0xf6cc('0xd')](_0x5c663f);}function getSupportedCiphers(){return crypto[_0xf6cc('0xe')]()['filter'](isASupportedCipher);}function isAlgorithmSupported(_0xaeca6f){return getSupportedCiphers()[_0xf6cc('0xf')](_0xaeca6f)>-0x1;}function combineOptions(_0x5df1fd){var _0x3c294e={};for(var _0x256084 in fileOptions){if(fileOptions[_0xf6cc('0x10')](_0x256084)){_0x3c294e[_0x256084]=fileOptions[_0x256084];}}if(_0x5df1fd){for(var _0x465a90 in _0x5df1fd){if(_0x5df1fd[_0xf6cc('0x10')](_0x465a90)){_0x3c294e[_0x465a90]=_0x5df1fd[_0x465a90];}}}return _0x3c294e;}exports[_0xf6cc('0x11')]=function(_0x3e9d3b,_0x483bc5,_0x57088b,_0x59a6a7){return new BPromise(function(_0xe3a4dc,_0x5e7cfc){_0x59a6a7=combineOptions(_0x59a6a7);var _0x2331f9=new Buffer(_0x57088b);var _0x5572dd=fs[_0xf6cc('0x12')](_0x3e9d3b);var _0x4858b0=fs[_0xf6cc('0x13')](_0x483bc5);var _0x2b44cc=crypto[_0xf6cc('0x14')](_0x59a6a7[_0xf6cc('0xa')],_0x2331f9);_0x5572dd['on'](_0xf6cc('0x15'),function(_0xa50e0f){var _0x859540=new Buffer(_0x2b44cc[_0xf6cc('0x16')](_0xa50e0f),_0xf6cc('0x17'));_0x4858b0['write'](_0x859540);});_0x5572dd['on'](_0xf6cc('0x18'),function(){try{var _0x1830ca=new Buffer(_0x2b44cc[_0xf6cc('0x19')](_0xf6cc('0x17')),_0xf6cc('0x17'));_0x4858b0[_0xf6cc('0x1a')](_0x1830ca);_0x4858b0[_0xf6cc('0x18')]();_0x4858b0['on'](_0xf6cc('0x1b'),function(){return _0xe3a4dc(_0x483bc5);});}catch(_0x440754){fs[_0xf6cc('0x1c')](_0x483bc5);return _0x5e7cfc(_0x440754);}});});};exports[_0xf6cc('0x1d')]=function(_0xb0cfc2,_0x2214a0,_0x4aaf7c,_0x272eb1){return new BPromise(function(_0x3339e0,_0x508204){_0x272eb1=combineOptions(_0x272eb1);var _0x5bd257=new Buffer(_0x4aaf7c);var _0x417527=fs[_0xf6cc('0x12')](_0xb0cfc2);var _0x5743cd=fs[_0xf6cc('0x13')](_0x2214a0);var _0x3de440=crypto[_0xf6cc('0x1e')](_0x272eb1[_0xf6cc('0xa')],_0x5bd257);_0x417527['on']('data',function(_0x210efd){var _0x4921e1=new Buffer(_0x3de440[_0xf6cc('0x16')](_0x210efd),_0xf6cc('0x17'));_0x5743cd[_0xf6cc('0x1a')](_0x4921e1);});_0x417527['on'](_0xf6cc('0x18'),function(){try{var _0x180dda=new Buffer(_0x3de440['final'](_0xf6cc('0x17')),_0xf6cc('0x17'));_0x5743cd[_0xf6cc('0x1a')](_0x180dda);_0x5743cd[_0xf6cc('0x18')]();_0x5743cd['on'](_0xf6cc('0x1b'),function(){return _0x3339e0(_0x2214a0);});}catch(_0x3b55f7){fs[_0xf6cc('0x1c')](_0x2214a0);return _0x508204(_0x3b55f7);}});});};exports[_0xf6cc('0x1f')]=function(_0x51a398,_0x444895,_0x43ad7f){var _0x326af3=_0x43ad7f||stringOptions['algorithm'];var _0x4bb5a8=_0x444895||stringOptions['secret'];var _0x3c25d1=crypto[_0xf6cc('0x14')](_0x326af3,_0x4bb5a8);var _0x1e66ca=_0x3c25d1[_0xf6cc('0x16')](_0x51a398,_0xf6cc('0x20'),'base64');_0x1e66ca+=_0x3c25d1[_0xf6cc('0x19')](_0xf6cc('0x21'));return _0x1e66ca;};exports[_0xf6cc('0x22')]=function(_0x1c4c76,_0x14d435,_0x4dc80b){var _0x4b124c=_0x4dc80b||stringOptions[_0xf6cc('0xa')];var _0x11c631=_0x14d435||stringOptions[_0xf6cc('0x23')];var _0x4af21a=crypto[_0xf6cc('0x1e')](_0x4b124c,_0x11c631);var _0x1c5e47=_0x4af21a[_0xf6cc('0x16')](_0x1c4c76,_0xf6cc('0x21'),_0xf6cc('0x20'));_0x1c5e47+=_0x4af21a['final']('utf8');return _0x1c5e47;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 0c8b5a6..edd3e1c 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 _0x9f71=['splitSizeCsv','then','sequelize','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','split','length','isInteger','forEach','push','query','%s\x20limit\x20%d\x20OFFSET\x20%d','.csv','join','mkdirSync','each','%s%d.%s','csv','%s.%s','zip','zip\x20finished','info','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','exit','util','path','zip-dir','../../mysqldb','dbH','../../config/logger','argv','savename','AnalyticExtractedReport','update','format','CSV','Setting','find'];(function(_0x345c07,_0x23cb85){var _0x22aa0f=function(_0x1def0a){while(--_0x1def0a){_0x345c07['push'](_0x345c07['shift']());}};_0x22aa0f(++_0x23cb85);}(_0x9f71,0xfa));var _0x19f7=function(_0x152e48,_0x25f775){_0x152e48=_0x152e48-0x0;var _0x30b1a4=_0x9f71[_0x152e48];return _0x30b1a4;};'use strict';var util=require(_0x19f7('0x0'));var path=require(_0x19f7('0x1'));var _=require('lodash');var csv=require('to-csv');var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0x19f7('0x2'));var rimraf=require('rimraf');var db=require(_0x19f7('0x3'))['db'];var dbH=require(_0x19f7('0x3'))[_0x19f7('0x4')];var logger=require(_0x19f7('0x5'))('analytics');var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x19f7('0x6')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x4d287c,_0x389589){var _0x96e330={'status':_0x4d287c};var _0x1bbff9={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x389589){_0x96e330[_0x19f7('0x7')]=_0x389589;}return db[_0x19f7('0x8')][_0x19f7('0x9')](_0x96e330,_0x1bbff9);}function main(){var _0xef5a57=0x1388;var _0x189278;logger['info'](util[_0x19f7('0xa')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x19f7('0xb')));return db[_0x19f7('0xc')][_0x19f7('0xd')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x19f7('0xe')]})['then'](function(_0x142cea){if(_0x142cea){_0x189278=_0x142cea;_0xef5a57=_0x189278[_0x19f7('0xe')]||0x1388;}})[_0x19f7('0xf')](function(){return dbH[_0x19f7('0x10')]['query'](util['format'](_0x19f7('0x11'),QUERY),{'type':dbH['sequelize'][_0x19f7('0x12')][_0x19f7('0x13')]});})[_0x19f7('0xf')](function(_0x525eff){if(!_0x525eff[0x0][_0x19f7('0x14')]){return analyticExtractedReport(_0x19f7('0x15'));}var _0x4e88f8=[];var _0x53ba60=0x0;if(_0x189278[_0x19f7('0x16')]){if(_0x525eff&&_0x525eff[_0x19f7('0x17')]){var _0x9ea865=_['range'](_0x525eff[0x0][_0x19f7('0x14')]/_0xef5a57);var _0x58a14f=Number[_0x19f7('0x18')](_0x525eff[0x0][_0x19f7('0x14')]/_0xef5a57)?_0x525eff[0x0][_0x19f7('0x14')]%_0xef5a57:0x0;_0x9ea865[_0x19f7('0x19')](function(_0x2bf20a){if(_0x2bf20a>0x0){_0x53ba60+=_0xef5a57;}_0x4e88f8[_0x19f7('0x1a')](dbH[_0x19f7('0x10')][_0x19f7('0x1b')](util[_0x19f7('0xa')](_0x19f7('0x1c'),QUERY,_0xef5a57,_0x53ba60),{'type':dbH[_0x19f7('0x10')][_0x19f7('0x12')][_0x19f7('0x13')]}));});if(_0x58a14f>0x0){_0x53ba60+=_0xef5a57;_0x4e88f8['push'](dbH[_0x19f7('0x10')][_0x19f7('0x1b')](util['format'](_0x19f7('0x1c'),QUERY,_0x58a14f,_0x53ba60),{'type':dbH[_0x19f7('0x10')]['QueryTypes']['SELECT']}));}}}else{_0x4e88f8['push'](dbH[_0x19f7('0x10')][_0x19f7('0x1b')](QUERY,{'type':dbH[_0x19f7('0x10')][_0x19f7('0x12')]['SELECT']}));}var _0x3d2c3c=path['dirname'](PATH);var _0x1d47e5=path['basename'](PATH,_0x19f7('0x1d'));var _0x28ef94=_0x189278[_0x19f7('0x16')]&&_0x4e88f8[_0x19f7('0x17')]>0x1;var _0x2f9216=[];if(!fs['existsSync'](path[_0x19f7('0x1e')](_0x3d2c3c,_0x1d47e5))&&_0x28ef94){fs[_0x19f7('0x1f')](path[_0x19f7('0x1e')](_0x3d2c3c,_0x1d47e5));}return BPromise[_0x19f7('0x20')](_0x4e88f8,function(_0x5c7137){_0x2f9216['push'](_0x5c7137);})[_0x19f7('0xf')](function(){for(var _0x1ff471=0x0;_0x1ff471<_0x2f9216[_0x19f7('0x17')];_0x1ff471+=0x1){var _0xf46fe0;var _0x5057d5=_0x2f9216[_0x1ff471];if(_0x28ef94){_0xf46fe0=path[_0x19f7('0x1e')](_0x3d2c3c,_0x1d47e5,util[_0x19f7('0xa')](_0x19f7('0x21'),_0x1d47e5,_0x1ff471,_0x19f7('0x22')));}else{_0xf46fe0=path[_0x19f7('0x1e')](_0x3d2c3c,util['format'](_0x19f7('0x23'),_0x1d47e5,'csv'));}fs['writeFileSync'](_0xf46fe0,csv(_0x5057d5));}})[_0x19f7('0xf')](function(){if(_0x28ef94){return new Promise(function(_0x53986f){zipdir(path[_0x19f7('0x1e')](_0x3d2c3c,_0x1d47e5),{'saveTo':path['join'](_0x3d2c3c,util[_0x19f7('0xa')](_0x19f7('0x23'),_0x1d47e5,_0x19f7('0x24')))},function(_0x42ccae,_0x580725){rimraf(path[_0x19f7('0x1e')](_0x3d2c3c,_0x1d47e5),function(){});_0x53986f(_0x19f7('0x25'));});});}})['then'](function(){logger[_0x19f7('0x26')](util[_0x19f7('0xa')](_0x19f7('0x27'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0x19f7('0x28'),_0x28ef94?util[_0x19f7('0xa')](_0x19f7('0x23'),_0x1d47e5,_0x28ef94?'zip':_0x19f7('0x22')):null);});})['catch'](function(_0xb95542){logger['info'](util['format'](_0x19f7('0x29'),EXTRACTED_REPORT_ID,'CSV'),util['inspect'](_0xb95542,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x19f7('0x2a'));})['finally'](function(){process[_0x19f7('0x2b')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x9dea=['format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','Empty','length','range','num','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.csv','existsSync','join','mkdirSync','each','%s%d.%s','csv','%s.%s','zip','zip\x20finished','Completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','finally','exit','util','lodash','to-csv','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','AnalyticExtractedReport','update','info'];(function(_0x2bb452,_0x2dbbc0){var _0x5f50a6=function(_0x4f66ce){while(--_0x4f66ce){_0x2bb452['push'](_0x2bb452['shift']());}};_0x5f50a6(++_0x2dbbc0);}(_0x9dea,0x158));var _0xa9de=function(_0x178271,_0x1c518a){_0x178271=_0x178271-0x0;var _0x5c1885=_0x9dea[_0x178271];return _0x5c1885;};'use strict';var util=require(_0xa9de('0x0'));var path=require('path');var _=require(_0xa9de('0x1'));var csv=require(_0xa9de('0x2'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0xa9de('0x3'));var rimraf=require(_0xa9de('0x4'));var db=require(_0xa9de('0x5'))['db'];var dbH=require(_0xa9de('0x5'))[_0xa9de('0x6')];var logger=require(_0xa9de('0x7'))(_0xa9de('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0xa9de('0x9')][0x2]);var QUERY=process[_0xa9de('0x9')][0x3];var PATH=process[_0xa9de('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x488fdf,_0x4cb433){var _0x132ba0={'status':_0x488fdf};var _0x4b1f4f={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4cb433){_0x132ba0['savename']=_0x4cb433;}return db[_0xa9de('0xa')][_0xa9de('0xb')](_0x132ba0,_0x4b1f4f);}function main(){var _0x34687e=0x1388;var _0x2be642;logger[_0xa9de('0xc')](util[_0xa9de('0xd')](_0xa9de('0xe'),EXTRACTED_REPORT_ID,_0xa9de('0xf')));return db[_0xa9de('0x10')][_0xa9de('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xa9de('0x12'),_0xa9de('0x13')]})[_0xa9de('0x14')](function(_0x39b412){if(_0x39b412){_0x2be642=_0x39b412;_0x34687e=_0x2be642[_0xa9de('0x13')]||0x1388;}})[_0xa9de('0x14')](function(){return dbH[_0xa9de('0x15')][_0xa9de('0x16')](util[_0xa9de('0xd')](_0xa9de('0x17'),QUERY),{'type':dbH['sequelize'][_0xa9de('0x18')][_0xa9de('0x19')]});})[_0xa9de('0x14')](function(_0x2a9af8){if(!_0x2a9af8[0x0]['num']){return analyticExtractedReport(_0xa9de('0x1a'));}var _0x1342b9=[];var _0xd8b111=0x0;if(_0x2be642['split']){if(_0x2a9af8&&_0x2a9af8[_0xa9de('0x1b')]){var _0x23376f=_[_0xa9de('0x1c')](_0x2a9af8[0x0][_0xa9de('0x1d')]/_0x34687e);var _0x288b20=Number[_0xa9de('0x1e')](_0x2a9af8[0x0][_0xa9de('0x1d')]/_0x34687e)?_0x2a9af8[0x0][_0xa9de('0x1d')]%_0x34687e:0x0;_0x23376f[_0xa9de('0x1f')](function(_0x55425b){if(_0x55425b>0x0){_0xd8b111+=_0x34687e;}_0x1342b9[_0xa9de('0x20')](dbH[_0xa9de('0x15')][_0xa9de('0x16')](util[_0xa9de('0xd')](_0xa9de('0x21'),QUERY,_0x34687e,_0xd8b111),{'type':dbH[_0xa9de('0x15')]['QueryTypes'][_0xa9de('0x19')]}));});if(_0x288b20>0x0){_0xd8b111+=_0x34687e;_0x1342b9[_0xa9de('0x20')](dbH[_0xa9de('0x15')]['query'](util[_0xa9de('0xd')](_0xa9de('0x21'),QUERY,_0x288b20,_0xd8b111),{'type':dbH[_0xa9de('0x15')][_0xa9de('0x18')][_0xa9de('0x19')]}));}}}else{_0x1342b9[_0xa9de('0x20')](dbH[_0xa9de('0x15')][_0xa9de('0x16')](QUERY,{'type':dbH[_0xa9de('0x15')]['QueryTypes']['SELECT']}));}var _0x4dc1f9=path[_0xa9de('0x22')](PATH);var _0x23ae64=path[_0xa9de('0x23')](PATH,_0xa9de('0x24'));var _0x1f1709=_0x2be642[_0xa9de('0x12')]&&_0x1342b9[_0xa9de('0x1b')]>0x1;var _0x2cd562=[];if(!fs[_0xa9de('0x25')](path[_0xa9de('0x26')](_0x4dc1f9,_0x23ae64))&&_0x1f1709){fs[_0xa9de('0x27')](path['join'](_0x4dc1f9,_0x23ae64));}return BPromise[_0xa9de('0x28')](_0x1342b9,function(_0x442734){_0x2cd562[_0xa9de('0x20')](_0x442734);})[_0xa9de('0x14')](function(){for(var _0x7ef072=0x0;_0x7ef072<_0x2cd562[_0xa9de('0x1b')];_0x7ef072+=0x1){var _0x51f08f;var _0x2dca53=_0x2cd562[_0x7ef072];if(_0x1f1709){_0x51f08f=path[_0xa9de('0x26')](_0x4dc1f9,_0x23ae64,util[_0xa9de('0xd')](_0xa9de('0x29'),_0x23ae64,_0x7ef072,_0xa9de('0x2a')));}else{_0x51f08f=path[_0xa9de('0x26')](_0x4dc1f9,util[_0xa9de('0xd')](_0xa9de('0x2b'),_0x23ae64,_0xa9de('0x2a')));}fs['writeFileSync'](_0x51f08f,csv(_0x2dca53));}})[_0xa9de('0x14')](function(){if(_0x1f1709){return new Promise(function(_0x5e087d){zipdir(path['join'](_0x4dc1f9,_0x23ae64),{'saveTo':path['join'](_0x4dc1f9,util['format']('%s.%s',_0x23ae64,_0xa9de('0x2c')))},function(_0x336538,_0x449b9a){rimraf(path['join'](_0x4dc1f9,_0x23ae64),function(){});_0x5e087d(_0xa9de('0x2d'));});});}})[_0xa9de('0x14')](function(){logger[_0xa9de('0xc')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xa9de('0xf')));return analyticExtractedReport(_0xa9de('0x2e'),_0x1f1709?util[_0xa9de('0xd')]('%s.%s',_0x23ae64,_0x1f1709?'zip':'csv'):null);});})['catch'](function(_0x1f4697){logger[_0xa9de('0xc')](util[_0xa9de('0xd')](_0xa9de('0x2f'),EXTRACTED_REPORT_ID,'CSV'),util['inspect'](_0x1f4697,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xa9de('0x30'));})[_0xa9de('0x31')](function(){process[_0xa9de('0x32')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 351087d..94933f5 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 _0xcdde=['SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','inspect','Failed','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','center','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish','end','createPdfFromHTML','lodash','path','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','jsdom','window','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','map','tableHeader','toString','value','length','body','push','concat','keys','forEach','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','format','header','before','margin','footer','Arial','Setting','find','splitSizePdf','then','split','range','num','isInteger','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','basename','existsSync','join','each','flatten','createPdfKitDocument','%s%d.%s','pdf','%s.%s','all','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','findOne'];(function(_0x1ac578,_0xbb0ed2){var _0x363870=function(_0x111d7f){while(--_0x111d7f){_0x1ac578['push'](_0x1ac578['shift']());}};_0x363870(++_0xbb0ed2);}(_0xcdde,0xb7));var _0xecdd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcdde[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xecdd('0x0'));var fs=require('fs');var util=require('util');var path=require(_0xecdd('0x1'));var moment=require('moment');var htmlToPdfmake=require(_0xecdd('0x2'));var PdfPrinter=require(_0xecdd('0x3'));var zipdir=require(_0xecdd('0x4'));var rimraf=require(_0xecdd('0x5'));var JSDOM=require(_0xecdd('0x6'))['JSDOM'];var window=new JSDOM('')[_0xecdd('0x7')];var BPromise=require('bluebird');var db=require(_0xecdd('0x8'))['db'];var dbH=require('../../mysqldb')[_0xecdd('0x9')];var logger=require(_0xecdd('0xa'))(_0xecdd('0xb'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xecdd('0xc')][0x3];var PATH=process[_0xecdd('0xc')][0x4];var NAME=process[_0xecdd('0xc')][0x5];var FORMAT=_0xecdd('0xd');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x3e85f9,_0x162773){var _0x48b407={'status':_0x3e85f9};var _0x6da535={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x162773){_0x48b407[_0xecdd('0xe')]=_0x162773;}return db[_0xecdd('0xf')]['update'](_0x48b407,_0x6da535);}function getHeaders(_0x3c84bc){return _[_0xecdd('0x10')](_0x3c84bc,function(_0x407de9){return{'text':_0x407de9,'style':_0xecdd('0x11')};});}function getRows(_0x2087b2,_0x54503d){return _[_0xecdd('0x10')](_0x54503d,function(_0x578678){return _(_0x578678)['pick'](_0x2087b2)[_0xecdd('0x10')](function(_0x104635){return _0x104635?_[_0xecdd('0x12')](_0x104635):'';})[_0xecdd('0x13')]();});}function createTable(_0x22557a,_0x8e6e74){var _0x599174={'widths':_['fill'](Array(_0x22557a[_0xecdd('0x14')]),0x91),'heights':function(_0x3726b2){return _0x3726b2===0x0?'auto':0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0xfc26dc=getHeaders(_0x22557a);_0x599174[_0xecdd('0x15')][_0xecdd('0x16')](_0xfc26dc);var _0x2e6eb3=getRows(_0x22557a,_0x8e6e74);_0x599174[_0xecdd('0x15')]=_0x599174[_0xecdd('0x15')][_0xecdd('0x17')](_0x2e6eb3);return _0x599174;}function createTables(_0x2374dc){var _0x436aa7=[];var _0x31de4d=_['chunk'](Object[_0xecdd('0x18')](_0x2374dc[0x0]),0x5);_0x31de4d[_0xecdd('0x19')](function(_0x132d03){_0x436aa7[_0xecdd('0x16')](createTable(_0x132d03,_0x2374dc));});return _0x436aa7;}function getPDFDocDefinition(_0x1bc412){var _0x30a2d5=util['format'](_0xecdd('0x1a'),NAME,EXTRACTED_REPORT['name'],moment(EXTRACTED_REPORT['startDate'])['format'](FORMAT),moment(EXTRACTED_REPORT['endDate'])[_0xecdd('0x1b')](FORMAT));var _0x15488d=[];for(var _0x19167b=0x0;_0x19167b<_0x1bc412['length'];_0x19167b++){var _0x25912d=[];if(_0x19167b===0x0){_0x25912d[_0xecdd('0x16')]({'text':_0x30a2d5,'style':_0xecdd('0x1c')});}var _0x3689dd={'table':_0x1bc412[_0x19167b]};if(_0x19167b>0x0){_0x3689dd['pageBreak']=_0xecdd('0x1d');_0x3689dd[_0xecdd('0x1e')]=[0x0,0x46,0x0,0x0];}_0x25912d[_0xecdd('0x16')](_0x3689dd);_0x15488d[_0xecdd('0x16')](_0x25912d);}return{'pageSize':'A4','pageOrientation':'landscape','content':_0x15488d,'footer':function(_0x32b632,_0x57f00e){return{'text':_0x32b632[_0xecdd('0x12')]()+'\x20/\x20'+_0x57f00e,'style':_0xecdd('0x1f')};},'defaultStyle':{'font':_0xecdd('0x20')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'},'footer':{'alignment':'right','margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x58dd98){var _0x811e52=0x1388;var _0x4b6e0d;if(!_0x58dd98[0x0]['num']){return analyticExtractedReport('Empty');}return db[_0xecdd('0x21')][_0xecdd('0x22')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xecdd('0x23')]})[_0xecdd('0x24')](function(_0x241dd8){if(_0x241dd8){_0x4b6e0d=_0x241dd8;_0x811e52=_0x4b6e0d[_0xecdd('0x23')]||0x3e8;}})['then'](function(){var _0xf6543c=[];var _0x2f4572=0x0;if(_0x4b6e0d[_0xecdd('0x25')]){if(_0x58dd98&&_0x58dd98[_0xecdd('0x14')]){var _0x248200=_[_0xecdd('0x26')](_0x58dd98[0x0][_0xecdd('0x27')]/_0x811e52);var _0x2a03bf=Number[_0xecdd('0x28')](_0x58dd98[0x0][_0xecdd('0x27')]/_0x811e52)?_0x58dd98[0x0][_0xecdd('0x27')]%_0x811e52:0x0;_0x248200[_0xecdd('0x19')](function(_0x4f7a16){if(_0x4f7a16>0x0){_0x2f4572+=_0x811e52;}_0xf6543c[_0xecdd('0x16')](dbH[_0xecdd('0x29')][_0xecdd('0x2a')](util[_0xecdd('0x1b')](_0xecdd('0x2b'),QUERY,_0x811e52,_0x2f4572),{'type':dbH[_0xecdd('0x29')][_0xecdd('0x2c')][_0xecdd('0x2d')]}));});if(_0x2a03bf>0x0){_0x2f4572+=_0x811e52;_0xf6543c[_0xecdd('0x16')](dbH[_0xecdd('0x29')][_0xecdd('0x2a')](util[_0xecdd('0x1b')](_0xecdd('0x2b'),QUERY,_0x2a03bf,_0x2f4572),{'type':dbH['sequelize']['QueryTypes']['SELECT']}));}}}else{_0xf6543c['push'](dbH[_0xecdd('0x29')][_0xecdd('0x2a')](QUERY,{'type':dbH['sequelize'][_0xecdd('0x2c')][_0xecdd('0x2d')]}));}var _0x43a9fb=path['dirname'](PATH);var _0x1ca4f6=path[_0xecdd('0x2e')](PATH,'.pdf');var _0x4ffc7d=_0x4b6e0d['split']&&_0xf6543c[_0xecdd('0x14')]>0x1;var _0x14493a=[];if(!fs[_0xecdd('0x2f')](path[_0xecdd('0x30')](_0x43a9fb,_0x1ca4f6))&&_0x4ffc7d){fs['mkdirSync'](path['join'](_0x43a9fb,_0x1ca4f6));}return BPromise[_0xecdd('0x31')](_0xf6543c,function(_0x11dc1f){_0x14493a['push'](_0x11dc1f);})[_0xecdd('0x24')](function(){var _0x165ab9=[];for(var _0x38583a=0x0;_0x38583a<_0x14493a[_0xecdd('0x14')];_0x38583a+=0x1){var _0x4eda2b=_0x14493a[_0x38583a];var _0x443af8=createTables(_[_0xecdd('0x32')](_0x4eda2b));var _0x11eb93;var _0x4a15c0=getPDFDocDefinition(_0x443af8);var _0x936ca=getPDFPrinter();var _0x6f768=_0x936ca[_0xecdd('0x33')](_0x4a15c0);if(_0x4ffc7d){_0x11eb93=path[_0xecdd('0x30')](_0x43a9fb,_0x1ca4f6,util[_0xecdd('0x1b')](_0xecdd('0x34'),_0x1ca4f6,_0x38583a,_0xecdd('0x35')));}else{_0x11eb93=path[_0xecdd('0x30')](_0x43a9fb,util['format'](_0xecdd('0x36'),_0x1ca4f6,_0xecdd('0x35')));}_0x165ab9[_0xecdd('0x16')](writePDFDocument(_0x6f768,_0x11eb93));}return Promise[_0xecdd('0x37')](_0x165ab9);})[_0xecdd('0x24')](function(){if(_0x4ffc7d){return new Promise(function(_0x3baca3){zipdir(path[_0xecdd('0x30')](_0x43a9fb,_0x1ca4f6),{'saveTo':path[_0xecdd('0x30')](_0x43a9fb,util['format'](_0xecdd('0x36'),_0x1ca4f6,_0xecdd('0x38')))},function(){rimraf(path['join'](_0x43a9fb,_0x1ca4f6),function(){});_0x3baca3(_0xecdd('0x39'));});});}})[_0xecdd('0x24')](function(){if(!_0x4ffc7d)return;rimraf(path[_0xecdd('0x30')](_0x43a9fb,_0x1ca4f6),function(){});})[_0xecdd('0x24')](function(){logger[_0xecdd('0x3a')](util[_0xecdd('0x1b')](_0xecdd('0x3b'),EXTRACTED_REPORT_ID,_0xecdd('0x3c')));return analyticExtractedReport('Completed',_0x4ffc7d?util[_0xecdd('0x1b')](_0xecdd('0x36'),_0x1ca4f6,_0x4ffc7d?_0xecdd('0x38'):_0xecdd('0x35')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xecdd('0x3a')](util[_0xecdd('0x1b')](_0xecdd('0x3d'),EXTRACTED_REPORT_ID,'PDF'));return db[_0xecdd('0xf')][_0xecdd('0x3e')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xecdd('0x24')](function(_0x38dc82){EXTRACTED_REPORT=_0x38dc82;return dbH[_0xecdd('0x29')][_0xecdd('0x2a')](util['format'](_0xecdd('0x3f'),QUERY),{'type':dbH['sequelize'][_0xecdd('0x2c')][_0xecdd('0x2d')]});})[_0xecdd('0x24')](extractReport)[_0xecdd('0x40')](function(_0x4f40a3){logger[_0xecdd('0x3a')](util['format']('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xecdd('0x3c')),util[_0xecdd('0x41')](_0x4f40a3,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xecdd('0x42'));})[_0xecdd('0x43')](function(){process[_0xecdd('0x44')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x4c4343=new PdfPrinter({'Arial':{'normal':__dirname+_0xecdd('0x45'),'bold':__dirname+_0xecdd('0x46'),'italics':__dirname+'/fonts/arial-italic.ttf','bolditalics':__dirname+_0xecdd('0x47')}});return _0x4c4343;}function getPDFDocDefinitionFromHTML(_0x2f0166,_0x14d8dc){var _0x1e01c2=util[_0xecdd('0x1b')](_0xecdd('0x48'),_0x14d8dc[_0xecdd('0x49')],_0x14d8dc[_0xecdd('0x4a')]);var _0x323674=moment()['format']('YYYY-MM-DD')[_0xecdd('0x12')]();var _0x788222=htmlToPdfmake(_0x2f0166,{'window':window,'tableAutoSize':!![]});return{'content':[_0x788222],'defaultStyle':{'font':_0xecdd('0x20')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xecdd('0x4b'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xecdd('0x4b'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0xecdd('0x4b')}},'header':function(){return[{'text':'Interaction\x20Transcript','style':'header'}];},'footer':function(_0x4f0968,_0x283ebc){return[{'text':util[_0xecdd('0x1b')](_0xecdd('0x4c'),_0x1e01c2,_0x4f0968,_0x283ebc,_0x323674),'style':_0xecdd('0x1f')}];}};}function writePDFDocument(_0x347203,_0x56efca){return new Promise(function(_0x1f1b39,_0xe018ee){var _0x4390ad=_0x347203[_0xecdd('0x4d')](fs[_0xecdd('0x4e')](_0x56efca));_0x4390ad['on']('finish',function(){_0x1f1b39(_0xecdd('0x4f'));});_0x4390ad['on']('error',function(_0x47acbe){_0xe018ee(_0x47acbe);});_0x347203[_0xecdd('0x50')]();});}exports[_0xecdd('0x51')]=function(_0x5ada38,_0x46e532){var _0xd81968=getPDFPrinter();var _0x3e3bf0=getPDFDocDefinitionFromHTML(_0x5ada38,_0x46e532);var _0x3ff868=_0xd81968[_0xecdd('0x33')](_0x3e3bf0);return writePDFDocument(_0x3ff868,_0x46e532[_0xecdd('0x1')])[_0xecdd('0x40')](function(_0x23bc6f){throw _0x23bc6f;});}; \ No newline at end of file +var _0xff77=['/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','center','Interaction\x20Transcript','header','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','footer','pipe','error','end','createPdfFromHTML','path','util','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','jsdom','window','bluebird','../../mysqldb','dbH','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','update','map','tableHeader','pick','toString','value','fill','length','auto','body','concat','chunk','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','push','pageBreak','before','\x20/\x20','black','num','Setting','split','then','splitSizePdf','range','sequelize','query','QueryTypes','SELECT','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','existsSync','join','mkdirSync','each','flatten','createPdfKitDocument','%s%d.%s','pdf','%s.%s','all','zip','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','AnalyticExtractedReport','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xff77,0x11c));var _0x7ff7=function(_0xd3f7fc,_0x3fb698){_0xd3f7fc=_0xd3f7fc-0x0;var _0x33bc4a=_0xff77[_0xd3f7fc];return _0x33bc4a;};'use strict';var _=require('lodash');var fs=require('fs');var util=require(_0x7ff7('0x0'));var path=require('path');var moment=require(_0x7ff7('0x1'));var htmlToPdfmake=require(_0x7ff7('0x2'));var PdfPrinter=require(_0x7ff7('0x3'));var zipdir=require(_0x7ff7('0x4'));var rimraf=require(_0x7ff7('0x5'));var JSDOM=require(_0x7ff7('0x6'))['JSDOM'];var window=new JSDOM('')[_0x7ff7('0x7')];var BPromise=require(_0x7ff7('0x8'));var db=require(_0x7ff7('0x9'))['db'];var dbH=require('../../mysqldb')[_0x7ff7('0xa')];var logger=require('../../config/logger')(_0x7ff7('0xb'));var EXTRACTED_REPORT_ID=Number(process[_0x7ff7('0xc')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x7ff7('0xc')][0x4];var NAME=process['argv'][0x5];var FORMAT=_0x7ff7('0xd');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x37220e,_0x1af7d4){var _0x18afc3={'status':_0x37220e};var _0x4c70b6={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1af7d4){_0x18afc3['savename']=_0x1af7d4;}return db['AnalyticExtractedReport'][_0x7ff7('0xe')](_0x18afc3,_0x4c70b6);}function getHeaders(_0x349425){return _[_0x7ff7('0xf')](_0x349425,function(_0x5e69e7){return{'text':_0x5e69e7,'style':_0x7ff7('0x10')};});}function getRows(_0x2812a0,_0x7252ec){return _[_0x7ff7('0xf')](_0x7252ec,function(_0x5cf508){return _(_0x5cf508)[_0x7ff7('0x11')](_0x2812a0)['map'](function(_0x340abc){return _0x340abc?_[_0x7ff7('0x12')](_0x340abc):'';})[_0x7ff7('0x13')]();});}function createTable(_0x2366d4,_0x3188e9){var _0x5a7437={'widths':_[_0x7ff7('0x14')](Array(_0x2366d4[_0x7ff7('0x15')]),0x91),'heights':function(_0x578c13){return _0x578c13===0x0?_0x7ff7('0x16'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x536427=getHeaders(_0x2366d4);_0x5a7437[_0x7ff7('0x17')]['push'](_0x536427);var _0x4a48cd=getRows(_0x2366d4,_0x3188e9);_0x5a7437['body']=_0x5a7437['body'][_0x7ff7('0x18')](_0x4a48cd);return _0x5a7437;}function createTables(_0x44a204){var _0x2f2a97=[];var _0x5770de=_[_0x7ff7('0x19')](Object['keys'](_0x44a204[0x0]),0x5);_0x5770de[_0x7ff7('0x1a')](function(_0x534484){_0x2f2a97['push'](createTable(_0x534484,_0x44a204));});return _0x2f2a97;}function getPDFDocDefinition(_0x193016){var _0x15c03e=util[_0x7ff7('0x1b')](_0x7ff7('0x1c'),NAME,EXTRACTED_REPORT[_0x7ff7('0x1d')],moment(EXTRACTED_REPORT[_0x7ff7('0x1e')])[_0x7ff7('0x1b')](FORMAT),moment(EXTRACTED_REPORT['endDate'])[_0x7ff7('0x1b')](FORMAT));var _0x4f641b=[];for(var _0x2a8175=0x0;_0x2a8175<_0x193016[_0x7ff7('0x15')];_0x2a8175++){var _0x39427a=[];if(_0x2a8175===0x0){_0x39427a[_0x7ff7('0x1f')]({'text':_0x15c03e,'style':'header'});}var _0x215d52={'table':_0x193016[_0x2a8175]};if(_0x2a8175>0x0){_0x215d52[_0x7ff7('0x20')]=_0x7ff7('0x21');_0x215d52['margin']=[0x0,0x46,0x0,0x0];}_0x39427a[_0x7ff7('0x1f')](_0x215d52);_0x4f641b[_0x7ff7('0x1f')](_0x39427a);}return{'pageSize':'A4','pageOrientation':'landscape','content':_0x4f641b,'footer':function(_0x26ca82,_0x8f3801){return{'text':_0x26ca82['toString']()+_0x7ff7('0x22')+_0x8f3801,'style':'footer'};},'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x7ff7('0x23')},'footer':{'alignment':'right','margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x4e82d4){var _0x204495=0x1388;var _0x2f1f65;if(!_0x4e82d4[0x0][_0x7ff7('0x24')]){return analyticExtractedReport('Empty');}return db[_0x7ff7('0x25')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x7ff7('0x26'),'splitSizePdf']})[_0x7ff7('0x27')](function(_0x3b2122){if(_0x3b2122){_0x2f1f65=_0x3b2122;_0x204495=_0x2f1f65[_0x7ff7('0x28')]||0x3e8;}})[_0x7ff7('0x27')](function(){var _0x1ea6fa=[];var _0x57838e=0x0;if(_0x2f1f65[_0x7ff7('0x26')]){if(_0x4e82d4&&_0x4e82d4['length']){var _0x49d09a=_[_0x7ff7('0x29')](_0x4e82d4[0x0][_0x7ff7('0x24')]/_0x204495);var _0x343c88=Number['isInteger'](_0x4e82d4[0x0][_0x7ff7('0x24')]/_0x204495)?_0x4e82d4[0x0][_0x7ff7('0x24')]%_0x204495:0x0;_0x49d09a[_0x7ff7('0x1a')](function(_0x43682e){if(_0x43682e>0x0){_0x57838e+=_0x204495;}_0x1ea6fa[_0x7ff7('0x1f')](dbH[_0x7ff7('0x2a')][_0x7ff7('0x2b')](util[_0x7ff7('0x1b')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x204495,_0x57838e),{'type':dbH[_0x7ff7('0x2a')][_0x7ff7('0x2c')][_0x7ff7('0x2d')]}));});if(_0x343c88>0x0){_0x57838e+=_0x204495;_0x1ea6fa[_0x7ff7('0x1f')](dbH['sequelize'][_0x7ff7('0x2b')](util[_0x7ff7('0x1b')](_0x7ff7('0x2e'),QUERY,_0x343c88,_0x57838e),{'type':dbH[_0x7ff7('0x2a')][_0x7ff7('0x2c')]['SELECT']}));}}}else{_0x1ea6fa['push'](dbH['sequelize']['query'](QUERY,{'type':dbH['sequelize'][_0x7ff7('0x2c')][_0x7ff7('0x2d')]}));}var _0x391e53=path[_0x7ff7('0x2f')](PATH);var _0x3e67ec=path[_0x7ff7('0x30')](PATH,'.pdf');var _0x27986f=_0x2f1f65[_0x7ff7('0x26')]&&_0x1ea6fa[_0x7ff7('0x15')]>0x1;var _0x9d34dd=[];if(!fs[_0x7ff7('0x31')](path[_0x7ff7('0x32')](_0x391e53,_0x3e67ec))&&_0x27986f){fs[_0x7ff7('0x33')](path['join'](_0x391e53,_0x3e67ec));}return BPromise[_0x7ff7('0x34')](_0x1ea6fa,function(_0x2adf5d){_0x9d34dd[_0x7ff7('0x1f')](_0x2adf5d);})['then'](function(){var _0xa5ce64=[];for(var _0x1bf7a7=0x0;_0x1bf7a7<_0x9d34dd[_0x7ff7('0x15')];_0x1bf7a7+=0x1){var _0x412ab1=_0x9d34dd[_0x1bf7a7];var _0x4c2e16=createTables(_[_0x7ff7('0x35')](_0x412ab1));var _0x1373a9;var _0x189d91=getPDFDocDefinition(_0x4c2e16);var _0x57b1d8=getPDFPrinter();var _0x3621cc=_0x57b1d8[_0x7ff7('0x36')](_0x189d91);if(_0x27986f){_0x1373a9=path[_0x7ff7('0x32')](_0x391e53,_0x3e67ec,util[_0x7ff7('0x1b')](_0x7ff7('0x37'),_0x3e67ec,_0x1bf7a7,_0x7ff7('0x38')));}else{_0x1373a9=path[_0x7ff7('0x32')](_0x391e53,util[_0x7ff7('0x1b')](_0x7ff7('0x39'),_0x3e67ec,'pdf'));}_0xa5ce64[_0x7ff7('0x1f')](writePDFDocument(_0x3621cc,_0x1373a9));}return Promise[_0x7ff7('0x3a')](_0xa5ce64);})[_0x7ff7('0x27')](function(){if(_0x27986f){return new Promise(function(_0x3c2743){zipdir(path['join'](_0x391e53,_0x3e67ec),{'saveTo':path['join'](_0x391e53,util[_0x7ff7('0x1b')](_0x7ff7('0x39'),_0x3e67ec,_0x7ff7('0x3b')))},function(){rimraf(path[_0x7ff7('0x32')](_0x391e53,_0x3e67ec),function(){});_0x3c2743('zip\x20finished');});});}})['then'](function(){if(!_0x27986f)return;rimraf(path['join'](_0x391e53,_0x3e67ec),function(){});})[_0x7ff7('0x27')](function(){logger[_0x7ff7('0x3c')](util[_0x7ff7('0x1b')](_0x7ff7('0x3d'),EXTRACTED_REPORT_ID,_0x7ff7('0x3e')));return analyticExtractedReport('Completed',_0x27986f?util['format'](_0x7ff7('0x39'),_0x3e67ec,_0x27986f?_0x7ff7('0x3b'):_0x7ff7('0x38')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x7ff7('0x3c')](util[_0x7ff7('0x1b')](_0x7ff7('0x3f'),EXTRACTED_REPORT_ID,_0x7ff7('0x3e')));return db[_0x7ff7('0x40')][_0x7ff7('0x41')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x7ff7('0x27')](function(_0x3fff8a){EXTRACTED_REPORT=_0x3fff8a;return dbH['sequelize'][_0x7ff7('0x2b')](util[_0x7ff7('0x1b')](_0x7ff7('0x42'),QUERY),{'type':dbH['sequelize'][_0x7ff7('0x2c')][_0x7ff7('0x2d')]});})[_0x7ff7('0x27')](extractReport)[_0x7ff7('0x43')](function(_0x2f8112){logger[_0x7ff7('0x3c')](util[_0x7ff7('0x1b')](_0x7ff7('0x44'),EXTRACTED_REPORT_ID,_0x7ff7('0x3e')),util[_0x7ff7('0x45')](_0x2f8112,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x7ff7('0x46'));})[_0x7ff7('0x47')](function(){process['exit'](EXIT_CODE);});}main();function getPDFPrinter(){var _0x53c3b2=new PdfPrinter({'Arial':{'normal':__dirname+_0x7ff7('0x48'),'bold':__dirname+_0x7ff7('0x49'),'italics':__dirname+_0x7ff7('0x4a'),'bolditalics':__dirname+_0x7ff7('0x4b')}});return _0x53c3b2;}function getPDFDocDefinitionFromHTML(_0xeccc5f,_0x6f500f){var _0x4e270d=util[_0x7ff7('0x1b')](_0x7ff7('0x4c'),_0x6f500f[_0x7ff7('0x4d')],_0x6f500f[_0x7ff7('0x4e')]);var _0x151293=moment()['format']('YYYY-MM-DD')['toString']();var _0x2fc8b7=htmlToPdfmake(_0xeccc5f,{'window':window,'tableAutoSize':!![]});return{'content':[_0x2fc8b7],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':'center','margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x7ff7('0x4f'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x7ff7('0x4f')}},'header':function(){return[{'text':_0x7ff7('0x50'),'style':_0x7ff7('0x51')}];},'footer':function(_0x1ca3b2,_0x3f912d){return[{'text':util[_0x7ff7('0x1b')](_0x7ff7('0x52'),_0x4e270d,_0x1ca3b2,_0x3f912d,_0x151293),'style':_0x7ff7('0x53')}];}};}function writePDFDocument(_0x3f15ca,_0xa15873){return new Promise(function(_0x3bbe76,_0x1906fc){var _0x582659=_0x3f15ca[_0x7ff7('0x54')](fs['createWriteStream'](_0xa15873));_0x582659['on']('finish',function(){_0x3bbe76('finish');});_0x582659['on'](_0x7ff7('0x55'),function(_0x1785f1){_0x1906fc(_0x1785f1);});_0x3f15ca[_0x7ff7('0x56')]();});}exports[_0x7ff7('0x57')]=function(_0x36a4e0,_0x34251f){var _0x26ee9f=getPDFPrinter();var _0x41350c=getPDFDocDefinitionFromHTML(_0x36a4e0,_0x34251f);var _0x3f87af=_0x26ee9f[_0x7ff7('0x36')](_0x41350c);return writePDFDocument(_0x3f87af,_0x34251f[_0x7ff7('0x58')])[_0x7ff7('0x43')](function(_0x3fe754){throw _0x3fe754;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index b4ecc1f..8064aac 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 _0x2ec8=['join','%s%d.%s','%s.%s','xlsx','writeFileSync','binary','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','finally','exit','util','path','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','then','splitSizeXlsx','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','num','Empty','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','dirname','length','mkdirSync','each'];(function(_0xd047e1,_0x12d4d6){var _0x3c6056=function(_0x18d8a3){while(--_0x18d8a3){_0xd047e1['push'](_0xd047e1['shift']());}};_0x3c6056(++_0x12d4d6);}(_0x2ec8,0x6e));var _0x82ec=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x2ec8[_0x2f5ac5];return _0x37c9a8;};'use strict';var util=require(_0x82ec('0x0'));var path=require(_0x82ec('0x1'));var _=require('lodash');var fs=require('fs');var json2xls=require('json2xls');var BPromise=require(_0x82ec('0x2'));var zipdir=require(_0x82ec('0x3'));var rimraf=require(_0x82ec('0x4'));var db=require(_0x82ec('0x5'))['db'];var dbH=require(_0x82ec('0x5'))[_0x82ec('0x6')];var logger=require(_0x82ec('0x7'))(_0x82ec('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x82ec('0x9')][0x2]);var QUERY=process[_0x82ec('0x9')][0x3];var PATH=process[_0x82ec('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x17c182,_0x5573c5){var _0x2828ad={'status':_0x17c182};var _0x5519b2={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5573c5){_0x2828ad[_0x82ec('0xa')]=_0x5573c5;}return db[_0x82ec('0xb')][_0x82ec('0xc')](_0x2828ad,_0x5519b2);}function main(){var _0x4f05da=0x1388;var _0x283c70;logger[_0x82ec('0xd')](util[_0x82ec('0xe')](_0x82ec('0xf'),EXTRACTED_REPORT_ID,_0x82ec('0x10')));return db[_0x82ec('0x11')][_0x82ec('0x12')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x82ec('0x13'),'splitSizeXlsx']})[_0x82ec('0x14')](function(_0x1267d1){if(_0x1267d1){_0x283c70=_0x1267d1;_0x4f05da=_0x283c70[_0x82ec('0x15')]||0x1388;}})[_0x82ec('0x14')](function(){return dbH[_0x82ec('0x16')][_0x82ec('0x17')](util[_0x82ec('0xe')](_0x82ec('0x18'),QUERY),{'type':dbH['sequelize'][_0x82ec('0x19')]['SELECT']});})[_0x82ec('0x14')](function(_0x32b957){if(!_0x32b957[0x0][_0x82ec('0x1a')]){return analyticExtractedReport(_0x82ec('0x1b'));}var _0x3cfa85=[];var _0x38e5c7=0x0;if(_0x283c70[_0x82ec('0x13')]){if(_0x32b957&&_0x32b957['length']){var _0x336305=_['range'](_0x32b957[0x0][_0x82ec('0x1a')]/_0x4f05da);var _0x2487a4=Number[_0x82ec('0x1c')](_0x32b957[0x0][_0x82ec('0x1a')]/_0x4f05da)?_0x32b957[0x0][_0x82ec('0x1a')]%_0x4f05da:0x0;_0x336305[_0x82ec('0x1d')](function(_0x175b33){if(_0x175b33>0x0){_0x38e5c7+=_0x4f05da;}_0x3cfa85[_0x82ec('0x1e')](dbH[_0x82ec('0x16')][_0x82ec('0x17')](util['format'](_0x82ec('0x1f'),QUERY,_0x4f05da,_0x38e5c7),{'type':dbH['sequelize']['QueryTypes'][_0x82ec('0x20')]}));});if(_0x2487a4>0x0){_0x38e5c7+=_0x4f05da;_0x3cfa85[_0x82ec('0x1e')](dbH[_0x82ec('0x16')]['query'](util[_0x82ec('0xe')](_0x82ec('0x1f'),QUERY,_0x2487a4,_0x38e5c7),{'type':dbH[_0x82ec('0x16')][_0x82ec('0x19')][_0x82ec('0x20')]}));}}}else{_0x3cfa85[_0x82ec('0x1e')](dbH[_0x82ec('0x16')][_0x82ec('0x17')](QUERY,{'type':dbH[_0x82ec('0x16')]['QueryTypes'][_0x82ec('0x20')]}));}var _0x27075d=path[_0x82ec('0x21')](PATH);var _0x1a89bc=path['basename'](PATH,'.xlsx');var _0x102aef=_0x283c70[_0x82ec('0x13')]&&_0x3cfa85[_0x82ec('0x22')]>0x1;var _0x421b55=[];if(!fs['existsSync'](path['join'](_0x27075d,_0x1a89bc))&&_0x102aef){fs[_0x82ec('0x23')](path['join'](_0x27075d,_0x1a89bc));}return BPromise[_0x82ec('0x24')](_0x3cfa85,function(_0x2d6832){_0x421b55[_0x82ec('0x1e')](_0x2d6832);})[_0x82ec('0x14')](function(){for(var _0xddffb=0x0;_0xddffb<_0x421b55[_0x82ec('0x22')];_0xddffb+=0x1){var _0x1aa4d2;var _0x3a8593=_0x421b55[_0xddffb];if(_0x102aef){_0x1aa4d2=path[_0x82ec('0x25')](_0x27075d,_0x1a89bc,util[_0x82ec('0xe')](_0x82ec('0x26'),_0x1a89bc,_0xddffb,'xlsx'));}else{_0x1aa4d2=path[_0x82ec('0x25')](_0x27075d,util[_0x82ec('0xe')](_0x82ec('0x27'),_0x1a89bc,_0x82ec('0x28')));}fs[_0x82ec('0x29')](_0x1aa4d2,json2xls(_0x3a8593),_0x82ec('0x2a'));}})[_0x82ec('0x14')](function(){if(_0x102aef){return new Promise(function(_0x22a65e){zipdir(path[_0x82ec('0x25')](_0x27075d,_0x1a89bc),{'saveTo':path[_0x82ec('0x25')](_0x27075d,util[_0x82ec('0xe')]('%s.%s',_0x1a89bc,_0x82ec('0x2b')))},function(_0x116b2e,_0x5dc072){rimraf(path[_0x82ec('0x25')](_0x27075d,_0x1a89bc),function(){});_0x22a65e('zip\x20finished');});});}})[_0x82ec('0x14')](function(){logger[_0x82ec('0xd')](util[_0x82ec('0xe')](_0x82ec('0x2c'),EXTRACTED_REPORT_ID,_0x82ec('0x10')));return analyticExtractedReport(_0x82ec('0x2d'),_0x102aef?util['format'](_0x82ec('0x27'),_0x1a89bc,_0x102aef?_0x82ec('0x2b'):_0x82ec('0x28')):null);});})['catch'](function(_0x98387a){logger[_0x82ec('0xd')](util[_0x82ec('0xe')](_0x82ec('0x2e'),EXTRACTED_REPORT_ID,_0x82ec('0x10')),util['inspect'](_0x98387a,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x82ec('0x2f')](function(){process[_0x82ec('0x30')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x41f6=['info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','splitSizeXlsx','then','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','QueryTypes','SELECT','num','length','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','.xlsx','existsSync','mkdirSync','join','each','%s%d.%s','xlsx','writeFileSync','binary','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','%s.%s','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','exit','util','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update'];(function(_0x3711ef,_0x59f137){var _0x287bcb=function(_0x5e8d68){while(--_0x5e8d68){_0x3711ef['push'](_0x3711ef['shift']());}};_0x287bcb(++_0x59f137);}(_0x41f6,0x8e));var _0x641f=function(_0xbb14db,_0x3ee8c6){_0xbb14db=_0xbb14db-0x0;var _0x36bed7=_0x41f6[_0xbb14db];return _0x36bed7;};'use strict';var util=require(_0x641f('0x0'));var path=require('path');var _=require(_0x641f('0x1'));var fs=require('fs');var json2xls=require(_0x641f('0x2'));var BPromise=require(_0x641f('0x3'));var zipdir=require(_0x641f('0x4'));var rimraf=require(_0x641f('0x5'));var db=require(_0x641f('0x6'))['db'];var dbH=require(_0x641f('0x6'))[_0x641f('0x7')];var logger=require(_0x641f('0x8'))(_0x641f('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0x641f('0xa')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x641f('0xa')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x48c950,_0x5448f0){var _0x3425ca={'status':_0x48c950};var _0x116a33={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5448f0){_0x3425ca[_0x641f('0xb')]=_0x5448f0;}return db[_0x641f('0xc')][_0x641f('0xd')](_0x3425ca,_0x116a33);}function main(){var _0xba086a=0x1388;var _0x58a75b;logger[_0x641f('0xe')](util[_0x641f('0xf')](_0x641f('0x10'),EXTRACTED_REPORT_ID,_0x641f('0x11')));return db[_0x641f('0x12')][_0x641f('0x13')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x641f('0x14'),'splitSizeXlsx']})['then'](function(_0x589ac5){if(_0x589ac5){_0x58a75b=_0x589ac5;_0xba086a=_0x58a75b[_0x641f('0x15')]||0x1388;}})[_0x641f('0x16')](function(){return dbH['sequelize'][_0x641f('0x17')](util[_0x641f('0xf')](_0x641f('0x18'),QUERY),{'type':dbH[_0x641f('0x19')][_0x641f('0x1a')][_0x641f('0x1b')]});})[_0x641f('0x16')](function(_0x5b0660){if(!_0x5b0660[0x0][_0x641f('0x1c')]){return analyticExtractedReport('Empty');}var _0x5a1b7f=[];var _0x4fa8d7=0x0;if(_0x58a75b[_0x641f('0x14')]){if(_0x5b0660&&_0x5b0660[_0x641f('0x1d')]){var _0x2c1312=_['range'](_0x5b0660[0x0]['num']/_0xba086a);var _0x33bd72=Number[_0x641f('0x1e')](_0x5b0660[0x0]['num']/_0xba086a)?_0x5b0660[0x0][_0x641f('0x1c')]%_0xba086a:0x0;_0x2c1312[_0x641f('0x1f')](function(_0x58f8df){if(_0x58f8df>0x0){_0x4fa8d7+=_0xba086a;}_0x5a1b7f[_0x641f('0x20')](dbH[_0x641f('0x19')][_0x641f('0x17')](util['format'](_0x641f('0x21'),QUERY,_0xba086a,_0x4fa8d7),{'type':dbH[_0x641f('0x19')][_0x641f('0x1a')][_0x641f('0x1b')]}));});if(_0x33bd72>0x0){_0x4fa8d7+=_0xba086a;_0x5a1b7f[_0x641f('0x20')](dbH[_0x641f('0x19')]['query'](util[_0x641f('0xf')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x33bd72,_0x4fa8d7),{'type':dbH['sequelize'][_0x641f('0x1a')]['SELECT']}));}}}else{_0x5a1b7f[_0x641f('0x20')](dbH[_0x641f('0x19')][_0x641f('0x17')](QUERY,{'type':dbH[_0x641f('0x19')][_0x641f('0x1a')][_0x641f('0x1b')]}));}var _0x4a3d2a=path['dirname'](PATH);var _0x2b2452=path['basename'](PATH,_0x641f('0x22'));var _0x85a549=_0x58a75b[_0x641f('0x14')]&&_0x5a1b7f[_0x641f('0x1d')]>0x1;var _0x2e69bd=[];if(!fs[_0x641f('0x23')](path['join'](_0x4a3d2a,_0x2b2452))&&_0x85a549){fs[_0x641f('0x24')](path[_0x641f('0x25')](_0x4a3d2a,_0x2b2452));}return BPromise[_0x641f('0x26')](_0x5a1b7f,function(_0x5d7774){_0x2e69bd[_0x641f('0x20')](_0x5d7774);})['then'](function(){for(var _0x346bda=0x0;_0x346bda<_0x2e69bd['length'];_0x346bda+=0x1){var _0x2ec67b;var _0x4a4b9f=_0x2e69bd[_0x346bda];if(_0x85a549){_0x2ec67b=path[_0x641f('0x25')](_0x4a3d2a,_0x2b2452,util[_0x641f('0xf')](_0x641f('0x27'),_0x2b2452,_0x346bda,_0x641f('0x28')));}else{_0x2ec67b=path['join'](_0x4a3d2a,util[_0x641f('0xf')]('%s.%s',_0x2b2452,_0x641f('0x28')));}fs[_0x641f('0x29')](_0x2ec67b,json2xls(_0x4a4b9f),_0x641f('0x2a'));}})[_0x641f('0x16')](function(){if(_0x85a549){return new Promise(function(_0x2967a4){zipdir(path['join'](_0x4a3d2a,_0x2b2452),{'saveTo':path[_0x641f('0x25')](_0x4a3d2a,util['format']('%s.%s',_0x2b2452,_0x641f('0x2b')))},function(_0x2a2070,_0x41088b){rimraf(path[_0x641f('0x25')](_0x4a3d2a,_0x2b2452),function(){});_0x2967a4('zip\x20finished');});});}})[_0x641f('0x16')](function(){logger['info'](util['format'](_0x641f('0x2c'),EXTRACTED_REPORT_ID,_0x641f('0x11')));return analyticExtractedReport(_0x641f('0x2d'),_0x85a549?util[_0x641f('0xf')](_0x641f('0x2e'),_0x2b2452,_0x85a549?_0x641f('0x2b'):_0x641f('0x28')):null);});})[_0x641f('0x2f')](function(_0x160ad8){logger[_0x641f('0xe')](util[_0x641f('0xf')](_0x641f('0x30'),EXTRACTED_REPORT_ID,_0x641f('0x11')),util[_0x641f('0x31')](_0x160ad8,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x641f('0x32')](function(){process[_0x641f('0x33')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index c6892c0..5d5bb91 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 _0xe1cf=['hasOwnProperty','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','recordingFormat','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','length','toLowerCase','updatedAt','interval','*,*,*,*','IntervalId','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','last','concat','transaction','destroy','catch','error','rewrite','lodash','util','Interval','findAll','then','intervals','models','VoiceExtension','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','priority','extensions','extension','push','type','Set','format','CDR(type)=%s','VoiceExtensionId','inbound','CDR(routeid)=','context','outbound','${EXTEN:','cutdigits','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid='];(function(_0x4d3b0f,_0x4e338f){var _0x42cb20=function(_0x4f6911){while(--_0x4f6911){_0x4d3b0f['push'](_0x4d3b0f['shift']());}};_0x42cb20(++_0x4e338f);}(_0xe1cf,0x68));var _0xfe1c=function(_0x135a1f,_0x44e0af){_0x135a1f=_0x135a1f-0x0;var _0xce6342=_0xe1cf[_0x135a1f];return _0xce6342;};'use strict';var _=require(_0xfe1c('0x0'));var util=require(_0xfe1c('0x1'));function rewrite(_0x10f625,_0x529dfe){var _0x4a8817=this;return _0x10f625['models'][_0xfe1c('0x2')][_0xfe1c('0x3')]({'raw':!![]})[_0xfe1c('0x4')](function(_0x8ae822){_0x4a8817[_0xfe1c('0x5')]=_0x8ae822;return _0x10f625[_0xfe1c('0x6')]['VoiceExtension'][_0xfe1c('0x3')]({'where':{'IntervalId':_0x529dfe['IntervalId']},'raw':!![]});})[_0xfe1c('0x4')](function(_0x5873d2){return _0x10f625[_0xfe1c('0x6')][_0xfe1c('0x7')][_0xfe1c('0x3')]({'where':{'exten':{'$in':_[_0xfe1c('0x8')](_[_0xfe1c('0x9')](_0x5873d2,_0xfe1c('0xa')))}},'order':[{'raw':_0xfe1c('0xb')}],'raw':!![]});})[_0xfe1c('0x4')](function(_0x60eb23){var _0x4eb53c=_[_0xfe1c('0xc')](_0x60eb23,{'priority':'1'});var _0x432111=_[_0xfe1c('0xc')](_0x60eb23,{'isApp':0x1});var _0x88df1f=_[_0xfe1c('0xd')](_0x432111,_0xfe1c('0xa'));var _0x5911e7=[_0xfe1c('0xe'),_0xfe1c('0xf')];var _0x1e6baa=[];var _0x1c032a=[];for(var _0x1cebc2 in _0x88df1f){if(_0x88df1f['hasOwnProperty'](_0x1cebc2)){_0x4a8817[_0xfe1c('0x10')]=0x2;_0x4a8817[_0xfe1c('0x11')]=[];_0x4a8817[_0xfe1c('0x12')]=_['find'](_0x4eb53c,{'exten':_0x88df1f[_0x1cebc2][0x0][_0xfe1c('0xa')]});_0x4a8817['extensions'][_0xfe1c('0x13')]({'type':_0x88df1f[_0x1cebc2][0x0][_0xfe1c('0x14')],'app':_0xfe1c('0x15'),'appdata':util[_0xfe1c('0x16')](_0xfe1c('0x17'),_0x88df1f[_0x1cebc2][0x0][_0xfe1c('0x14')]),'context':_0x88df1f[_0x1cebc2][0x0]['context'],'exten':_0x88df1f[_0x1cebc2][0x0][_0xfe1c('0xa')],'priority':_0x4a8817[_0xfe1c('0x10')]++,'VoiceExtensionId':_0x88df1f[_0x1cebc2][0x0][_0xfe1c('0x18')]});if(_0x88df1f[_0x1cebc2][0x0][_0xfe1c('0x14')]===_0xfe1c('0x19')){_0x4a8817['extensions']['push']({'type':_0x88df1f[_0x1cebc2][0x0][_0xfe1c('0x14')],'app':_0xfe1c('0x15'),'appdata':_0xfe1c('0x1a')+_0x88df1f[_0x1cebc2][0x0][_0xfe1c('0x18')],'context':_0x88df1f[_0x1cebc2][0x0][_0xfe1c('0x1b')],'exten':_0x88df1f[_0x1cebc2][0x0][_0xfe1c('0xa')],'priority':_0x4a8817[_0xfe1c('0x10')]++,'VoiceExtensionId':_0x88df1f[_0x1cebc2][0x0][_0xfe1c('0x18')]});}else if(_0x88df1f[_0x1cebc2][0x0][_0xfe1c('0x14')]===_0xfe1c('0x1c')){if(_0x4a8817[_0xfe1c('0x12')]){_0x4a8817[_0xfe1c('0x11')]['push']({'type':_0x88df1f[_0x1cebc2][0x0][_0xfe1c('0x14')],'app':_0xfe1c('0x15'),'appdata':'CDR(destination)='+(_0x4a8817['extension']['cutdigits']?_0xfe1c('0x1d')+_0x4a8817[_0xfe1c('0x12')][_0xfe1c('0x1e')]+'}':'${EXTEN}'),'context':_0x88df1f[_0x1cebc2][0x0]['context'],'exten':_0x88df1f[_0x1cebc2][0x0][_0xfe1c('0xa')],'priority':_0x4a8817[_0xfe1c('0x10')]++,'VoiceExtensionId':_0x88df1f[_0x1cebc2][0x0][_0xfe1c('0x18')]});}_0x4a8817['extensions'][_0xfe1c('0x13')]({'type':_0x88df1f[_0x1cebc2][0x0][_0xfe1c('0x14')],'app':_0xfe1c('0x15'),'appdata':'CDR(routeid)='+_0x88df1f[_0x1cebc2][0x0]['VoiceExtensionId'],'context':_0x88df1f[_0x1cebc2][0x0][_0xfe1c('0x1b')],'exten':_0x88df1f[_0x1cebc2][0x0]['exten'],'priority':_0x4a8817['priority']++,'VoiceExtensionId':_0x88df1f[_0x1cebc2][0x0]['VoiceExtensionId']});var _0x1e4ca3=_0x4a8817[_0xfe1c('0x10')]++;_0x4a8817['extensions'][_0xfe1c('0x13')]({'type':_0x88df1f[_0x1cebc2][0x0]['type'],'app':_0xfe1c('0x1f'),'appdata':_0xfe1c('0x20')+(_0x1e4ca3+0x2)+'):Goto('+(_0x1e4ca3+0x1)+')','context':_0x88df1f[_0x1cebc2][0x0]['context'],'exten':_0x88df1f[_0x1cebc2][0x0]['exten'],'priority':_0x1e4ca3,'VoiceExtensionId':_0x88df1f[_0x1cebc2][0x0][_0xfe1c('0x18')]});if(_0x4a8817[_0xfe1c('0x12')]){_0x4a8817[_0xfe1c('0x11')][_0xfe1c('0x13')]({'type':_0x88df1f[_0x1cebc2][0x0][_0xfe1c('0x14')],'app':'Set','appdata':_0x4a8817[_0xfe1c('0x12')][_0xfe1c('0x1e')]?_0xfe1c('0x21')+_0x4a8817[_0xfe1c('0x12')]['cutdigits']+'}':_0xfe1c('0x22'),'context':_0x88df1f[_0x1cebc2][0x0]['context'],'exten':_0x88df1f[_0x1cebc2][0x0]['exten'],'priority':_0x4a8817['priority']++,'VoiceExtensionId':_0x88df1f[_0x1cebc2][0x0]['VoiceExtensionId']});}_0x4a8817[_0xfe1c('0x11')][_0xfe1c('0x13')]({'type':_0x88df1f[_0x1cebc2][0x0][_0xfe1c('0x14')],'app':_0xfe1c('0x15'),'appdata':_0xfe1c('0x23')+_0x88df1f[_0x1cebc2][0x0][_0xfe1c('0x18')],'context':_0x88df1f[_0x1cebc2][0x0][_0xfe1c('0x1b')],'exten':_0x88df1f[_0x1cebc2][0x0]['exten'],'priority':_0x4a8817[_0xfe1c('0x10')]++,'VoiceExtensionId':_0x88df1f[_0x1cebc2][0x0][_0xfe1c('0x18')]});if(_0x4a8817[_0xfe1c('0x12')]&&_0x4a8817['extension'][_0xfe1c('0x24')]('recordingFormat')&&_0x4a8817[_0xfe1c('0x12')]['recordingFormat']!==_0xfe1c('0x25')){_0x4a8817[_0xfe1c('0x11')]['push']({'type':_0x88df1f[_0x1cebc2][0x0]['type'],'app':_0xfe1c('0x15'),'appdata':_0xfe1c('0x26'),'context':_0x88df1f[_0x1cebc2][0x0]['context'],'exten':_0x88df1f[_0x1cebc2][0x0][_0xfe1c('0xa')],'priority':_0x4a8817[_0xfe1c('0x10')]++,'VoiceExtensionId':_0x88df1f[_0x1cebc2][0x0][_0xfe1c('0x18')]});_0x4a8817[_0xfe1c('0x11')]['push']({'type':_0x88df1f[_0x1cebc2][0x0][_0xfe1c('0x14')],'app':_0xfe1c('0x15'),'appdata':_0xfe1c('0x27')+_0x4a8817[_0xfe1c('0x12')][_0xfe1c('0x28')]||'wav','context':_0x88df1f[_0x1cebc2][0x0]['context'],'exten':_0x88df1f[_0x1cebc2][0x0][_0xfe1c('0xa')],'priority':_0x4a8817[_0xfe1c('0x10')]++,'VoiceExtensionId':_0x88df1f[_0x1cebc2][0x0][_0xfe1c('0x18')]});}}_0x4a8817[_0xfe1c('0x11')][_0xfe1c('0x13')]({'type':_0x88df1f[_0x1cebc2][0x0][_0xfe1c('0x14')],'app':'Set','appdata':_0xfe1c('0x29'),'context':_0x88df1f[_0x1cebc2][0x0][_0xfe1c('0x1b')],'exten':_0x88df1f[_0x1cebc2][0x0][_0xfe1c('0xa')],'priority':_0x4a8817['priority']++,'VoiceExtensionId':_0x88df1f[_0x1cebc2][0x0][_0xfe1c('0x18')]});_0x4a8817[_0xfe1c('0x11')][_0xfe1c('0x13')]({'type':_0x88df1f[_0x1cebc2][0x0]['type'],'app':_0xfe1c('0x15'),'appdata':_0xfe1c('0x2a'),'context':_0x88df1f[_0x1cebc2][0x0][_0xfe1c('0x1b')],'exten':_0x88df1f[_0x1cebc2][0x0]['exten'],'priority':_0x4a8817[_0xfe1c('0x10')]++,'VoiceExtensionId':_0x88df1f[_0x1cebc2][0x0][_0xfe1c('0x18')]});_0x4a8817[_0xfe1c('0x11')]['push']({'type':_0x88df1f[_0x1cebc2][0x0][_0xfe1c('0x14')],'app':_0xfe1c('0x15'),'appdata':'MONITOR_OPTIONS=ab','context':_0x88df1f[_0x1cebc2][0x0][_0xfe1c('0x1b')],'exten':_0x88df1f[_0x1cebc2][0x0][_0xfe1c('0xa')],'priority':_0x4a8817[_0xfe1c('0x10')]++,'VoiceExtensionId':_0x88df1f[_0x1cebc2][0x0]['VoiceExtensionId']});for(var _0x574100=0x0,_0x1f6e0b=0x0;_0x574100<_0x88df1f[_0x1cebc2][_0xfe1c('0x2b')];_0x574100+=0x1,_0x1f6e0b=0x0){var _0x2b0914=_0x88df1f[_0x1cebc2][_0x574100];if(_0x2b0914[_0xfe1c('0x14')]){_0x2b0914[_0xfe1c('0x14')]=_0x2b0914[_0xfe1c('0x14')][_0xfe1c('0x2c')]();}var _0x5a083e=[];var _0x3d78a4=[];delete _0x2b0914['id'];delete _0x2b0914['createdAt'];delete _0x2b0914[_0xfe1c('0x2d')];var _0x5e420b=_0x2b0914[_0xfe1c('0x2e')]!==_0xfe1c('0x2f')?[_0x2b0914[_0xfe1c('0x2e')]]:_0x2b0914[_0xfe1c('0x30')]?_['map'](_[_0xfe1c('0xc')](_0x4a8817['intervals'],{'IntervalId':_0x2b0914['IntervalId']}),_0xfe1c('0x2e')):[];if(_0x2b0914[_0xfe1c('0x24')](_0xfe1c('0x31'))){if(_0x2b0914[_0xfe1c('0x31')]&&_0x2b0914[_0xfe1c('0x31')]!=='--'){_0x5a083e[_0xfe1c('0x13')]({'type':_0x2b0914[_0xfe1c('0x14')],'app':_0xfe1c('0x15'),'appdata':_0xfe1c('0x32')+_0x2b0914[_0xfe1c('0x31')],'context':_0x2b0914[_0xfe1c('0x1b')],'exten':_0x2b0914['exten'],'priority':_0x5e420b[_0xfe1c('0x2b')]+_0x4a8817[_0xfe1c('0x10')]+_0x1f6e0b++,'VoiceExtensionId':_0x2b0914[_0xfe1c('0x18')]});}}if(_0x2b0914['type']===_0xfe1c('0x1c')&&_0x2b0914[_0xfe1c('0x24')]('callerID')){if(_0x2b0914[_0xfe1c('0x33')]){_0x5a083e['push']({'type':_0x2b0914[_0xfe1c('0x14')],'app':'ExecIf','appdata':_0xfe1c('0x34')+_0x2b0914[_0xfe1c('0x33')]+')','context':_0x2b0914[_0xfe1c('0x1b')],'exten':_0x2b0914[_0xfe1c('0xa')],'priority':_0x5e420b[_0xfe1c('0x2b')]+_0x4a8817[_0xfe1c('0x10')]+_0x1f6e0b++,'VoiceExtensionId':_0x2b0914[_0xfe1c('0x18')]});}else{_0x5a083e[_0xfe1c('0x13')]({'type':_0x2b0914['type'],'app':'ExecIf','appdata':_0xfe1c('0x35'),'context':_0x2b0914['context'],'exten':_0x2b0914[_0xfe1c('0xa')],'priority':_0x5e420b[_0xfe1c('0x2b')]+_0x4a8817[_0xfe1c('0x10')]+_0x1f6e0b++,'VoiceExtensionId':_0x2b0914[_0xfe1c('0x18')]});}}if(_0x2b0914[_0xfe1c('0x24')](_0xfe1c('0x36'))){if(_0x5911e7[_0xfe1c('0x37')](_0x2b0914['app'][_0xfe1c('0x2c')]())>=0x0&&_0x2b0914[_0xfe1c('0x38')]!==_0xfe1c('0x39')){if(_0x2b0914[_0xfe1c('0x36')]){_0x5a083e[_0xfe1c('0x13')]({'type':_0x2b0914[_0xfe1c('0x14')],'app':_0xfe1c('0x1f'),'appdata':_0xfe1c('0x3a'),'context':_0x2b0914['context'],'exten':_0x2b0914[_0xfe1c('0xa')],'priority':_0x5e420b[_0xfe1c('0x2b')]+_0x4a8817[_0xfe1c('0x10')]+_0x1f6e0b++,'VoiceExtensionId':_0x2b0914[_0xfe1c('0x18')]});_0x5a083e[_0xfe1c('0x13')]({'type':_0x2b0914[_0xfe1c('0x14')],'app':_0xfe1c('0x15'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x2b0914[_0xfe1c('0x1b')],'exten':_0x2b0914[_0xfe1c('0xa')],'priority':_0x5e420b[_0xfe1c('0x2b')]+_0x4a8817['priority']+_0x1f6e0b++,'VoiceExtensionId':_0x2b0914['VoiceExtensionId']});}else{_0x5a083e[_0xfe1c('0x13')]({'type':_0x2b0914['type'],'app':_0xfe1c('0x1f'),'appdata':_0xfe1c('0x3b'),'context':_0x2b0914[_0xfe1c('0x1b')],'exten':_0x2b0914['exten'],'priority':_0x5e420b['length']+_0x4a8817[_0xfe1c('0x10')]+_0x1f6e0b++,'VoiceExtensionId':_0x2b0914[_0xfe1c('0x18')]});_0x5a083e[_0xfe1c('0x13')]({'type':_0x2b0914['type'],'app':'Set','appdata':_0xfe1c('0x3c'),'context':_0x2b0914[_0xfe1c('0x1b')],'exten':_0x2b0914['exten'],'priority':_0x5e420b[_0xfe1c('0x2b')]+_0x4a8817['priority']+_0x1f6e0b++,'VoiceExtensionId':_0x2b0914[_0xfe1c('0x18')]});}}}for(var _0x3e5ff9=0x0;_0x3e5ff9<_0x5e420b[_0xfe1c('0x2b')];_0x3e5ff9+=0x1){var _0x540c9b=_0x4a8817[_0xfe1c('0x10')]+_0x5e420b[_0xfe1c('0x2b')];var _0x20bbd7=_0x3e5ff9===_0x5e420b['length']-0x1?_0x4a8817[_0xfe1c('0x10')]+_0x5a083e[_0xfe1c('0x2b')]+_0x3d78a4[_0xfe1c('0x2b')]+0x2:_0x4a8817[_0xfe1c('0x10')]+_0x3e5ff9+0x1;_0x5a083e[_0xfe1c('0x3d')](_0x3e5ff9,0x0,{'type':_0x2b0914[_0xfe1c('0x14')],'app':'GotoIfTime','appdata':_0x5e420b[_0x3e5ff9]+'?'+_0x2b0914['context']+_0xfe1c('0x3e')+_0x540c9b+':'+_0x2b0914[_0xfe1c('0x1b')]+_0xfe1c('0x3e')+_0x20bbd7,'exten':_0x2b0914[_0xfe1c('0xa')],'context':_0x2b0914[_0xfe1c('0x1b')],'priority':_0x4a8817[_0xfe1c('0x10')]+_0x3e5ff9,'VoiceExtensionId':_0x88df1f[_0x1cebc2][0x0][_0xfe1c('0x18')]});}_0x2b0914[_0xfe1c('0x10')]=_0x5a083e[_0xfe1c('0x2b')]?_[_0xfe1c('0x3f')](_0x5a083e)['priority']+0x1:_0x4a8817[_0xfe1c('0x10')];_0x4a8817[_0xfe1c('0x10')]=(_0x3d78a4['length']?_['last'](_0x3d78a4)[_0xfe1c('0x10')]:_0x2b0914[_0xfe1c('0x10')])+0x1;_0x4a8817[_0xfe1c('0x11')]=_['concat'](_0x4a8817[_0xfe1c('0x11')],_0x5a083e,[_0x2b0914],_0x3d78a4);}_0x4a8817[_0xfe1c('0x11')][_0xfe1c('0x13')]({'type':_0x88df1f[_0x1cebc2][0x0][_0xfe1c('0x14')],'app':'Hangup','exten':_0x88df1f[_0x1cebc2][0x0][_0xfe1c('0xa')],'context':_0x88df1f[_0x1cebc2][0x0][_0xfe1c('0x1b')],'priority':_0x4a8817[_0xfe1c('0x10')],'VoiceExtensionId':_0x88df1f[_0x1cebc2][0x0][_0xfe1c('0x18')]});_0x1e6baa[_0xfe1c('0x13')](_0x88df1f[_0x1cebc2][0x0][_0xfe1c('0x18')]);_0x1c032a=_[_0xfe1c('0x40')](_0x1c032a,_0x4a8817['extensions']);}}return _0x10f625[_0xfe1c('0x41')](function(_0x3a7ee9){return _0x10f625[_0xfe1c('0x6')][_0xfe1c('0x7')][_0xfe1c('0x42')]({'where':{'VoiceExtensionId':{'$in':_0x1e6baa}},'transaction':_0x3a7ee9})['then'](function(_0x2729d4){return _0x10f625[_0xfe1c('0x6')][_0xfe1c('0x7')]['bulkCreate'](_['sortBy'](_0x1c032a,_0xfe1c('0x10')),{'transaction':_0x3a7ee9});});});})[_0xfe1c('0x43')](function(_0x345d69){console[_0xfe1c('0x44')](_0x345d69);});}exports[_0xfe1c('0x45')]=rewrite; \ No newline at end of file +var _0xde3d=['XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','hasOwnProperty','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','length','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','transaction','VoiceExtension','destroy','bulkCreate','sortBy','catch','lodash','util','models','Interval','findAll','intervals','IntervalId','then','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','priority','extension','extensions','push','Set','format','CDR(type)=%s','type','inbound','CDR(routeid)=','context','VoiceExtensionId','outbound','cutdigits','${EXTEN:','ExecIf','):Goto(','outboundrouteid=','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav'];(function(_0x454165,_0x1f3e74){var _0x56db53=function(_0x23388c){while(--_0x23388c){_0x454165['push'](_0x454165['shift']());}};_0x56db53(++_0x1f3e74);}(_0xde3d,0x18a));var _0xdde3=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xde3d[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0xdde3('0x0'));var util=require(_0xdde3('0x1'));function rewrite(_0xb2eca2,_0x8d2e7a){var _0x50aaa5=this;return _0xb2eca2[_0xdde3('0x2')][_0xdde3('0x3')][_0xdde3('0x4')]({'raw':!![]})['then'](function(_0x54871c){_0x50aaa5[_0xdde3('0x5')]=_0x54871c;return _0xb2eca2[_0xdde3('0x2')]['VoiceExtension']['findAll']({'where':{'IntervalId':_0x8d2e7a[_0xdde3('0x6')]},'raw':!![]});})[_0xdde3('0x7')](function(_0x376b06){return _0xb2eca2[_0xdde3('0x2')]['VoiceExtension'][_0xdde3('0x4')]({'where':{'exten':{'$in':_[_0xdde3('0x8')](_[_0xdde3('0x9')](_0x376b06,_0xdde3('0xa')))}},'order':[{'raw':_0xdde3('0xb')}],'raw':!![]});})['then'](function(_0x3978ca){var _0x37e150=_[_0xdde3('0xc')](_0x3978ca,{'priority':'1'});var _0x44ebba=_[_0xdde3('0xc')](_0x3978ca,{'isApp':0x1});var _0x5a11e1=_[_0xdde3('0xd')](_0x44ebba,_0xdde3('0xa'));var _0x5e2212=[_0xdde3('0xe'),_0xdde3('0xf')];var _0x1f002a=[];var _0x592dd1=[];for(var _0x5ef25b in _0x5a11e1){if(_0x5a11e1['hasOwnProperty'](_0x5ef25b)){_0x50aaa5[_0xdde3('0x10')]=0x2;_0x50aaa5['extensions']=[];_0x50aaa5[_0xdde3('0x11')]=_['find'](_0x37e150,{'exten':_0x5a11e1[_0x5ef25b][0x0][_0xdde3('0xa')]});_0x50aaa5[_0xdde3('0x12')][_0xdde3('0x13')]({'type':_0x5a11e1[_0x5ef25b][0x0]['type'],'app':_0xdde3('0x14'),'appdata':util[_0xdde3('0x15')](_0xdde3('0x16'),_0x5a11e1[_0x5ef25b][0x0][_0xdde3('0x17')]),'context':_0x5a11e1[_0x5ef25b][0x0]['context'],'exten':_0x5a11e1[_0x5ef25b][0x0][_0xdde3('0xa')],'priority':_0x50aaa5[_0xdde3('0x10')]++,'VoiceExtensionId':_0x5a11e1[_0x5ef25b][0x0]['VoiceExtensionId']});if(_0x5a11e1[_0x5ef25b][0x0][_0xdde3('0x17')]===_0xdde3('0x18')){_0x50aaa5[_0xdde3('0x12')][_0xdde3('0x13')]({'type':_0x5a11e1[_0x5ef25b][0x0][_0xdde3('0x17')],'app':_0xdde3('0x14'),'appdata':_0xdde3('0x19')+_0x5a11e1[_0x5ef25b][0x0]['VoiceExtensionId'],'context':_0x5a11e1[_0x5ef25b][0x0][_0xdde3('0x1a')],'exten':_0x5a11e1[_0x5ef25b][0x0][_0xdde3('0xa')],'priority':_0x50aaa5[_0xdde3('0x10')]++,'VoiceExtensionId':_0x5a11e1[_0x5ef25b][0x0][_0xdde3('0x1b')]});}else if(_0x5a11e1[_0x5ef25b][0x0]['type']===_0xdde3('0x1c')){if(_0x50aaa5[_0xdde3('0x11')]){_0x50aaa5['extensions'][_0xdde3('0x13')]({'type':_0x5a11e1[_0x5ef25b][0x0][_0xdde3('0x17')],'app':_0xdde3('0x14'),'appdata':'CDR(destination)='+(_0x50aaa5[_0xdde3('0x11')][_0xdde3('0x1d')]?_0xdde3('0x1e')+_0x50aaa5['extension'][_0xdde3('0x1d')]+'}':'${EXTEN}'),'context':_0x5a11e1[_0x5ef25b][0x0][_0xdde3('0x1a')],'exten':_0x5a11e1[_0x5ef25b][0x0][_0xdde3('0xa')],'priority':_0x50aaa5[_0xdde3('0x10')]++,'VoiceExtensionId':_0x5a11e1[_0x5ef25b][0x0][_0xdde3('0x1b')]});}_0x50aaa5[_0xdde3('0x12')]['push']({'type':_0x5a11e1[_0x5ef25b][0x0][_0xdde3('0x17')],'app':_0xdde3('0x14'),'appdata':_0xdde3('0x19')+_0x5a11e1[_0x5ef25b][0x0][_0xdde3('0x1b')],'context':_0x5a11e1[_0x5ef25b][0x0]['context'],'exten':_0x5a11e1[_0x5ef25b][0x0]['exten'],'priority':_0x50aaa5['priority']++,'VoiceExtensionId':_0x5a11e1[_0x5ef25b][0x0][_0xdde3('0x1b')]});var _0x5d4d8d=_0x50aaa5[_0xdde3('0x10')]++;_0x50aaa5[_0xdde3('0x12')][_0xdde3('0x13')]({'type':_0x5a11e1[_0x5ef25b][0x0]['type'],'app':_0xdde3('0x1f'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x5d4d8d+0x2)+_0xdde3('0x20')+(_0x5d4d8d+0x1)+')','context':_0x5a11e1[_0x5ef25b][0x0][_0xdde3('0x1a')],'exten':_0x5a11e1[_0x5ef25b][0x0][_0xdde3('0xa')],'priority':_0x5d4d8d,'VoiceExtensionId':_0x5a11e1[_0x5ef25b][0x0]['VoiceExtensionId']});if(_0x50aaa5[_0xdde3('0x11')]){_0x50aaa5[_0xdde3('0x12')][_0xdde3('0x13')]({'type':_0x5a11e1[_0x5ef25b][0x0][_0xdde3('0x17')],'app':_0xdde3('0x14'),'appdata':_0x50aaa5[_0xdde3('0x11')][_0xdde3('0x1d')]?'CDR(prefix)=${EXTEN:0:'+_0x50aaa5[_0xdde3('0x11')][_0xdde3('0x1d')]+'}':'CDR(prefix)=noprefix','context':_0x5a11e1[_0x5ef25b][0x0]['context'],'exten':_0x5a11e1[_0x5ef25b][0x0][_0xdde3('0xa')],'priority':_0x50aaa5[_0xdde3('0x10')]++,'VoiceExtensionId':_0x5a11e1[_0x5ef25b][0x0][_0xdde3('0x1b')]});}_0x50aaa5[_0xdde3('0x12')]['push']({'type':_0x5a11e1[_0x5ef25b][0x0][_0xdde3('0x17')],'app':_0xdde3('0x14'),'appdata':_0xdde3('0x21')+_0x5a11e1[_0x5ef25b][0x0][_0xdde3('0x1b')],'context':_0x5a11e1[_0x5ef25b][0x0]['context'],'exten':_0x5a11e1[_0x5ef25b][0x0][_0xdde3('0xa')],'priority':_0x50aaa5[_0xdde3('0x10')]++,'VoiceExtensionId':_0x5a11e1[_0x5ef25b][0x0]['VoiceExtensionId']});if(_0x50aaa5[_0xdde3('0x11')]&&_0x50aaa5[_0xdde3('0x11')]['hasOwnProperty'](_0xdde3('0x22'))&&_0x50aaa5[_0xdde3('0x11')][_0xdde3('0x22')]!=='none'){_0x50aaa5[_0xdde3('0x12')][_0xdde3('0x13')]({'type':_0x5a11e1[_0x5ef25b][0x0]['type'],'app':'Set','appdata':_0xdde3('0x23'),'context':_0x5a11e1[_0x5ef25b][0x0][_0xdde3('0x1a')],'exten':_0x5a11e1[_0x5ef25b][0x0][_0xdde3('0xa')],'priority':_0x50aaa5['priority']++,'VoiceExtensionId':_0x5a11e1[_0x5ef25b][0x0][_0xdde3('0x1b')]});_0x50aaa5[_0xdde3('0x12')][_0xdde3('0x13')]({'type':_0x5a11e1[_0x5ef25b][0x0]['type'],'app':_0xdde3('0x14'),'appdata':_0xdde3('0x24')+_0x50aaa5['extension']['recordingFormat']||_0xdde3('0x25'),'context':_0x5a11e1[_0x5ef25b][0x0][_0xdde3('0x1a')],'exten':_0x5a11e1[_0x5ef25b][0x0][_0xdde3('0xa')],'priority':_0x50aaa5['priority']++,'VoiceExtensionId':_0x5a11e1[_0x5ef25b][0x0][_0xdde3('0x1b')]});}}_0x50aaa5['extensions'][_0xdde3('0x13')]({'type':_0x5a11e1[_0x5ef25b][0x0][_0xdde3('0x17')],'app':_0xdde3('0x14'),'appdata':_0xdde3('0x26'),'context':_0x5a11e1[_0x5ef25b][0x0][_0xdde3('0x1a')],'exten':_0x5a11e1[_0x5ef25b][0x0][_0xdde3('0xa')],'priority':_0x50aaa5[_0xdde3('0x10')]++,'VoiceExtensionId':_0x5a11e1[_0x5ef25b][0x0][_0xdde3('0x1b')]});_0x50aaa5[_0xdde3('0x12')][_0xdde3('0x13')]({'type':_0x5a11e1[_0x5ef25b][0x0][_0xdde3('0x17')],'app':'Set','appdata':_0xdde3('0x27'),'context':_0x5a11e1[_0x5ef25b][0x0][_0xdde3('0x1a')],'exten':_0x5a11e1[_0x5ef25b][0x0][_0xdde3('0xa')],'priority':_0x50aaa5[_0xdde3('0x10')]++,'VoiceExtensionId':_0x5a11e1[_0x5ef25b][0x0]['VoiceExtensionId']});_0x50aaa5[_0xdde3('0x12')][_0xdde3('0x13')]({'type':_0x5a11e1[_0x5ef25b][0x0]['type'],'app':_0xdde3('0x14'),'appdata':_0xdde3('0x28'),'context':_0x5a11e1[_0x5ef25b][0x0][_0xdde3('0x1a')],'exten':_0x5a11e1[_0x5ef25b][0x0][_0xdde3('0xa')],'priority':_0x50aaa5['priority']++,'VoiceExtensionId':_0x5a11e1[_0x5ef25b][0x0][_0xdde3('0x1b')]});for(var _0x394a4f=0x0,_0x38776c=0x0;_0x394a4f<_0x5a11e1[_0x5ef25b]['length'];_0x394a4f+=0x1,_0x38776c=0x0){var _0x12c7dc=_0x5a11e1[_0x5ef25b][_0x394a4f];if(_0x12c7dc[_0xdde3('0x17')]){_0x12c7dc[_0xdde3('0x17')]=_0x12c7dc[_0xdde3('0x17')][_0xdde3('0x29')]();}var _0x2acd82=[];var _0x4626d5=[];delete _0x12c7dc['id'];delete _0x12c7dc[_0xdde3('0x2a')];delete _0x12c7dc[_0xdde3('0x2b')];var _0x569da7=_0x12c7dc[_0xdde3('0x2c')]!==_0xdde3('0x2d')?[_0x12c7dc[_0xdde3('0x2c')]]:_0x12c7dc[_0xdde3('0x6')]?_[_0xdde3('0x9')](_[_0xdde3('0xc')](_0x50aaa5['intervals'],{'IntervalId':_0x12c7dc[_0xdde3('0x6')]}),_0xdde3('0x2c')):[];if(_0x12c7dc[_0xdde3('0x2e')](_0xdde3('0x2f'))){if(_0x12c7dc[_0xdde3('0x2f')]&&_0x12c7dc[_0xdde3('0x2f')]!=='--'){_0x2acd82[_0xdde3('0x13')]({'type':_0x12c7dc[_0xdde3('0x17')],'app':_0xdde3('0x14'),'appdata':_0xdde3('0x30')+_0x12c7dc[_0xdde3('0x2f')],'context':_0x12c7dc[_0xdde3('0x1a')],'exten':_0x12c7dc[_0xdde3('0xa')],'priority':_0x569da7['length']+_0x50aaa5[_0xdde3('0x10')]+_0x38776c++,'VoiceExtensionId':_0x12c7dc[_0xdde3('0x1b')]});}}if(_0x12c7dc['type']===_0xdde3('0x1c')&&_0x12c7dc['hasOwnProperty'](_0xdde3('0x31'))){if(_0x12c7dc[_0xdde3('0x31')]){_0x2acd82[_0xdde3('0x13')]({'type':_0x12c7dc['type'],'app':'ExecIf','appdata':_0xdde3('0x32')+_0x12c7dc['callerID']+')','context':_0x12c7dc['context'],'exten':_0x12c7dc[_0xdde3('0xa')],'priority':_0x569da7[_0xdde3('0x33')]+_0x50aaa5[_0xdde3('0x10')]+_0x38776c++,'VoiceExtensionId':_0x12c7dc[_0xdde3('0x1b')]});}else{_0x2acd82[_0xdde3('0x13')]({'type':_0x12c7dc[_0xdde3('0x17')],'app':_0xdde3('0x1f'),'appdata':_0xdde3('0x34'),'context':_0x12c7dc['context'],'exten':_0x12c7dc['exten'],'priority':_0x569da7[_0xdde3('0x33')]+_0x50aaa5[_0xdde3('0x10')]+_0x38776c++,'VoiceExtensionId':_0x12c7dc[_0xdde3('0x1b')]});}}if(_0x12c7dc[_0xdde3('0x2e')](_0xdde3('0x35'))){if(_0x5e2212['indexOf'](_0x12c7dc[_0xdde3('0x36')][_0xdde3('0x29')]())>=0x0&&_0x12c7dc[_0xdde3('0x37')]!==_0xdde3('0x38')){if(_0x12c7dc[_0xdde3('0x35')]){_0x2acd82[_0xdde3('0x13')]({'type':_0x12c7dc[_0xdde3('0x17')],'app':_0xdde3('0x1f'),'appdata':_0xdde3('0x39'),'context':_0x12c7dc[_0xdde3('0x1a')],'exten':_0x12c7dc[_0xdde3('0xa')],'priority':_0x569da7[_0xdde3('0x33')]+_0x50aaa5[_0xdde3('0x10')]+_0x38776c++,'VoiceExtensionId':_0x12c7dc[_0xdde3('0x1b')]});_0x2acd82[_0xdde3('0x13')]({'type':_0x12c7dc[_0xdde3('0x17')],'app':_0xdde3('0x14'),'appdata':_0xdde3('0x3a'),'context':_0x12c7dc[_0xdde3('0x1a')],'exten':_0x12c7dc['exten'],'priority':_0x569da7['length']+_0x50aaa5[_0xdde3('0x10')]+_0x38776c++,'VoiceExtensionId':_0x12c7dc[_0xdde3('0x1b')]});}else{_0x2acd82[_0xdde3('0x13')]({'type':_0x12c7dc[_0xdde3('0x17')],'app':_0xdde3('0x1f'),'appdata':_0xdde3('0x3b'),'context':_0x12c7dc[_0xdde3('0x1a')],'exten':_0x12c7dc['exten'],'priority':_0x569da7[_0xdde3('0x33')]+_0x50aaa5[_0xdde3('0x10')]+_0x38776c++,'VoiceExtensionId':_0x12c7dc[_0xdde3('0x1b')]});_0x2acd82[_0xdde3('0x13')]({'type':_0x12c7dc[_0xdde3('0x17')],'app':_0xdde3('0x14'),'appdata':_0xdde3('0x3c'),'context':_0x12c7dc[_0xdde3('0x1a')],'exten':_0x12c7dc[_0xdde3('0xa')],'priority':_0x569da7[_0xdde3('0x33')]+_0x50aaa5[_0xdde3('0x10')]+_0x38776c++,'VoiceExtensionId':_0x12c7dc['VoiceExtensionId']});}}}for(var _0x5d5c93=0x0;_0x5d5c93<_0x569da7[_0xdde3('0x33')];_0x5d5c93+=0x1){var _0x382b38=_0x50aaa5['priority']+_0x569da7[_0xdde3('0x33')];var _0xe3dd50=_0x5d5c93===_0x569da7[_0xdde3('0x33')]-0x1?_0x50aaa5[_0xdde3('0x10')]+_0x2acd82[_0xdde3('0x33')]+_0x4626d5[_0xdde3('0x33')]+0x2:_0x50aaa5[_0xdde3('0x10')]+_0x5d5c93+0x1;_0x2acd82[_0xdde3('0x3d')](_0x5d5c93,0x0,{'type':_0x12c7dc[_0xdde3('0x17')],'app':_0xdde3('0x3e'),'appdata':_0x569da7[_0x5d5c93]+'?'+_0x12c7dc[_0xdde3('0x1a')]+_0xdde3('0x3f')+_0x382b38+':'+_0x12c7dc[_0xdde3('0x1a')]+_0xdde3('0x3f')+_0xe3dd50,'exten':_0x12c7dc[_0xdde3('0xa')],'context':_0x12c7dc[_0xdde3('0x1a')],'priority':_0x50aaa5[_0xdde3('0x10')]+_0x5d5c93,'VoiceExtensionId':_0x5a11e1[_0x5ef25b][0x0][_0xdde3('0x1b')]});}_0x12c7dc[_0xdde3('0x10')]=_0x2acd82[_0xdde3('0x33')]?_[_0xdde3('0x40')](_0x2acd82)['priority']+0x1:_0x50aaa5['priority'];_0x50aaa5[_0xdde3('0x10')]=(_0x4626d5[_0xdde3('0x33')]?_['last'](_0x4626d5)[_0xdde3('0x10')]:_0x12c7dc[_0xdde3('0x10')])+0x1;_0x50aaa5['extensions']=_[_0xdde3('0x41')](_0x50aaa5[_0xdde3('0x12')],_0x2acd82,[_0x12c7dc],_0x4626d5);}_0x50aaa5[_0xdde3('0x12')][_0xdde3('0x13')]({'type':_0x5a11e1[_0x5ef25b][0x0][_0xdde3('0x17')],'app':'Hangup','exten':_0x5a11e1[_0x5ef25b][0x0][_0xdde3('0xa')],'context':_0x5a11e1[_0x5ef25b][0x0][_0xdde3('0x1a')],'priority':_0x50aaa5[_0xdde3('0x10')],'VoiceExtensionId':_0x5a11e1[_0x5ef25b][0x0][_0xdde3('0x1b')]});_0x1f002a['push'](_0x5a11e1[_0x5ef25b][0x0][_0xdde3('0x1b')]);_0x592dd1=_[_0xdde3('0x41')](_0x592dd1,_0x50aaa5[_0xdde3('0x12')]);}}return _0xb2eca2[_0xdde3('0x42')](function(_0x171144){return _0xb2eca2[_0xdde3('0x2')][_0xdde3('0x43')][_0xdde3('0x44')]({'where':{'VoiceExtensionId':{'$in':_0x1f002a}},'transaction':_0x171144})[_0xdde3('0x7')](function(_0x4cc2cc){return _0xb2eca2[_0xdde3('0x2')][_0xdde3('0x43')][_0xdde3('0x45')](_[_0xdde3('0x46')](_0x592dd1,_0xdde3('0x10')),{'transaction':_0x171144});});});})[_0xdde3('0x47')](function(_0x2c7f4d){console['error'](_0x2c7f4d);});}exports['rewrite']=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index d9b9fab..fbfb25e 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 _0x8757=['createdAt','deletedAt\x20IS\x20NULL','id\x20IN\x20?','phone\x20NOT\x20IN\x20(?)','calleridnum','cm_hopper_final','\x20=\x20?','str','ListId\x20=\x20?','outbound','dialCheckDuplicateType','CmList','Lists','get','sequelize','query','VoiceQueueId','onlyIfOpen','VoiceQueue','findAll','BlackLists','all','Campaign','always','CampaignId','cmContact,\x20%s,\x20%s','Error\x20processing\x20rows\x20block:','emit','contact:csv_','resume','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','CSV\x20import\x20process\x20stopped!','createReadStream','parse','pause','info','bluebird','squel','papaparse','ioredis','../../../mysqldb','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','register','argv','null','Missing\x20filepath\x20parameter!','undefined','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','contact','index','test','errors','length','map','message','join','hasOwnProperty','data','firstName','phone','birthDate','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','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','checkHopper','inspect','insert','into','cm_hopper','fromQuery','scheduledAt','updatedAt','field','NOW()','ContactId','toString','cm_contacts','where','phone\x20IS\x20NOT\x20NULL','from'];(function(_0x220afa,_0xf5f6cc){var _0x1b79d1=function(_0x178a39){while(--_0x178a39){_0x220afa['push'](_0x220afa['shift']());}};_0x1b79d1(++_0xf5f6cc);}(_0x8757,0x90));var _0x7875=function(_0x3ee868,_0x369c6e){_0x3ee868=_0x3ee868-0x0;var _0x1a2489=_0x8757[_0x3ee868];return _0x1a2489;};'use strict';var BPromise=require(_0x7875('0x0'));var util=require('util');var _=require('lodash');var fs=require('fs');var squel=require(_0x7875('0x1'));var Papa=require(_0x7875('0x2'));var Redis=require(_0x7875('0x3'));var db=require(_0x7875('0x4'))['db'];var config=require('../../../config/environment');var logger=require(_0x7875('0x5'))(_0x7875('0x6'));config[_0x7875('0x7')]=_[_0x7875('0x8')](config[_0x7875('0x7')],{'host':_0x7875('0x9'),'port':0x18eb});var socket=require(_0x7875('0xa'))(new Redis(config[_0x7875('0x7')]));require('../../../api/cmContact/cmContact.socket')[_0x7875('0xb')](socket);try{if(!process[_0x7875('0xc')][0x2]||process[_0x7875('0xc')][0x2]==='undefined'||process[_0x7875('0xc')][0x2]===_0x7875('0xd')){throw new Error(_0x7875('0xe'));}var FILEPATH=process['argv'][0x2];if(!process[_0x7875('0xc')][0x3]||process[_0x7875('0xc')][0x3]===_0x7875('0xf')||process[_0x7875('0xc')][0x3]===_0x7875('0xd')||!process[_0x7875('0xc')][0x4]||process['argv'][0x4]===_0x7875('0xf')||process[_0x7875('0xc')][0x4]===_0x7875('0xd')){throw new Error('Missing\x20binding\x20parameters!');}var FIELDS=_['zipObject'](process[_0x7875('0xc')][0x3][_0x7875('0x10')](','),process['argv'][0x4][_0x7875('0x10')](','));if(!process[_0x7875('0xc')][0x5]||process[_0x7875('0xc')][0x5]===_0x7875('0xf')||process[_0x7875('0xc')][0x5]==='null'){throw new Error(_0x7875('0x11'));}var LISTID=process[_0x7875('0xc')][0x5];var COMPANYID=process['argv'][0x6]&&process[_0x7875('0xc')][0x6]!==_0x7875('0xf')&&process[_0x7875('0xc')][0x6]!==_0x7875('0xd')?process[_0x7875('0xc')][0x6]:null;var DUPLICATES=process[_0x7875('0xc')][0x7]&&process[_0x7875('0xc')][0x7]!==_0x7875('0xf')&&process[_0x7875('0xc')][0x7]!=='null'?process[_0x7875('0xc')][0x7]:null;if(!process[_0x7875('0xc')][0x8]||process[_0x7875('0xc')][0x8]===_0x7875('0xf')||process[_0x7875('0xc')][0x8]==='null'){throw new Error(_0x7875('0x12'));}var SOCKET_TIMESTAMP=process[_0x7875('0xc')][0x8];}catch(_0x31fbb2){logger[_0x7875('0x13')](_0x31fbb2);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(_0x10278e,_0x2e8498,_0x5c1e5b,_0x30cec8){var _0x52b0cc={'message':_0x2e8498};_0x52b0cc[_0x10278e]=!![];if(_0x5c1e5b){_0x52b0cc[_0x7875('0x14')]=_0x5c1e5b;}if(_0x30cec8){_0x52b0cc[_0x7875('0x15')]=_0x30cec8;}return _0x52b0cc;}function isEmail(_0x5833e1){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))*$/[_0x7875('0x16')](_0x5833e1);}function checkRow(_0x3b4501,_0x5e74f1,_0xb3ad0b){return new BPromise(function(_0x42fb06,_0x556915){if(_['isNil'](_0x3b4501)){return _0x556915(handleCheckRowError('error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0xb3ad0b));}if(_0x3b4501[_0x7875('0x17')]&&_0x3b4501[_0x7875('0x17')][_0x7875('0x18')]){var _0x1c1c45=_[_0x7875('0x19')](_0x3b4501[_0x7875('0x17')],_0x7875('0x1a'))[_0x7875('0x1b')](';');return _0x556915(handleCheckRowError(_0x7875('0x13'),_0x1c1c45,null,_0xb3ad0b));}var _0x538f6c={};for(var _0x1225e1 in FIELDS){if(FIELDS[_0x7875('0x1c')](_0x1225e1)&&FIELDS[_0x1225e1]){_0x538f6c[_0x1225e1]=_0x3b4501[_0x7875('0x1d')][0x0][FIELDS[_0x1225e1]]||_0x3b4501[_0x7875('0x1d')][0x0]['\ufeff'+FIELDS[_0x1225e1]];}}if(!_0x538f6c[_0x7875('0x1e')]){return _0x556915(handleCheckRowError(_0x7875('0x13'),'firstName\x20not\x20specified!',null,_0xb3ad0b));}if(!_0x538f6c[_0x7875('0x1f')]){return _0x556915(handleCheckRowError(_0x7875('0x13'),'phone\x20not\x20specified!',null,_0xb3ad0b));}if(_0x538f6c['birthDate']){var _0x50853e=moment(_0x538f6c[_0x7875('0x20')],'YYYY-MM-DD');if(!_0x50853e['isValid']()){return _0x556915(handleCheckRowError('error',_0x7875('0x21'),null,_0xb3ad0b));}}if(_0x538f6c[_0x7875('0x22')]){if(!isEmail(_0x538f6c['email'])){return _0x556915(handleCheckRowError(_0x7875('0x13'),_0x7875('0x23'),null,_0xb3ad0b));}}_0x538f6c[_0x7875('0x24')]=LISTID;_0x538f6c[_0x7875('0x25')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x7875('0x18')]&&_0x5e74f1){var _0x3880d4={};for(var _0x13f96c=0x0,_0x282d4b=DUPLICATES[_0x7875('0x18')];_0x13f96c<_0x282d4b;_0x13f96c+=0x1){_0x3880d4[DUPLICATES[_0x13f96c]]=_0x538f6c[DUPLICATES[_0x13f96c]];}var _0x137cb5=_[_0x7875('0x26')](_0x5e74f1,_0x3880d4);if(_0x137cb5){return _0x556915(handleCheckRowError(_0x7875('0x27'),_0x7875('0x28'),_0x137cb5,_0xb3ad0b));}}return db[_0x7875('0x29')]['create'](_0x538f6c,{'raw':!![],'hooks':![],'fields':_[_0x7875('0x2a')](_0x538f6c)})[_0x7875('0x2b')](function(_0x15e8ea){if(DUPLICATES&&DUPLICATES[_0x7875('0x18')]&&_0x5e74f1){_0x5e74f1[_0x7875('0x2c')](_[_0x7875('0x2d')](_0x538f6c,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x15e8ea['id'];return _0x42fb06();})[_0x7875('0x2e')](function(_0x3eaa76){return _0x556915(handleCheckRowError(_0x7875('0x13'),_0x7875('0x2f')+(_0x3eaa76[_0x7875('0x1a')]||JSON[_0x7875('0x30')](_0x3eaa76)),null,_0xb3ad0b));});});}function checkHopper(){function _0x1327b9(){return function(_0x8e713f){logger[_0x7875('0x13')](_0x7875('0x31'),_0x7875('0x32'),util[_0x7875('0x33')](_0x8e713f,{'showHidden':![],'depth':null}));};}var _0x34af5a=function(_0x320685,_0x571a24){var _0x287cad=squel[_0x7875('0x34')]()[_0x7875('0x35')](_0x7875('0x36'))[_0x7875('0x37')]([_0x7875('0x1f'),_0x7875('0x38'),'ContactId','ListId',_0x571a24,'createdAt',_0x7875('0x39')],squel['select']()[_0x7875('0x3a')]('phone',_0x7875('0x1f'))[_0x7875('0x3a')](_0x7875('0x3b'),_0x7875('0x38'))[_0x7875('0x3a')]('id',_0x7875('0x3c'))[_0x7875('0x3a')](LISTID['toString'](),_0x7875('0x24'))[_0x7875('0x3a')](_0x320685['id'][_0x7875('0x3d')](),_0x571a24)[_0x7875('0x3a')](_0x7875('0x3b'),'createdAt')[_0x7875('0x3a')](_0x7875('0x3b'),_0x7875('0x39'))['from'](_0x7875('0x3e'))[_0x7875('0x3f')]('deletedAt\x20IS\x20NULL')[_0x7875('0x3f')]('ListId\x20=\x20?',LISTID['toString']())['where'](_0x7875('0x40'))[_0x7875('0x3f')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x7875('0x3a')](_0x7875('0x1f'))[_0x7875('0x41')](_0x7875('0x36'))[_0x7875('0x3f')](_0x571a24+'\x20=\x20?',_0x320685['id'][_0x7875('0x3d')]())))[_0x7875('0x3d')]();return _0x287cad;};var _0x4a6cec=function(_0x131c03,_0x4cf61c){var _0x2f2cc0=squel[_0x7875('0x34')]()['into'](_0x7875('0x36'))[_0x7875('0x37')](['phone',_0x7875('0x38'),_0x7875('0x3c'),_0x7875('0x24'),_0x4cf61c,_0x7875('0x42'),'updatedAt'],squel['select']()[_0x7875('0x3a')](_0x7875('0x1f'),_0x7875('0x1f'))['field'](_0x7875('0x3b'),_0x7875('0x38'))['field']('id','ContactId')['field'](LISTID[_0x7875('0x3d')](),_0x7875('0x24'))[_0x7875('0x3a')](_0x131c03['id'][_0x7875('0x3d')](),_0x4cf61c)[_0x7875('0x3a')]('NOW()','createdAt')[_0x7875('0x3a')]('NOW()',_0x7875('0x39'))[_0x7875('0x41')]('cm_contacts')[_0x7875('0x3f')](_0x7875('0x43'))['where']('ListId\x20=\x20?',LISTID[_0x7875('0x3d')]())['where'](_0x7875('0x44'),squel['str'](hopperContacts))[_0x7875('0x3f')](_0x7875('0x40'))['where'](_0x7875('0x45'),squel['select']()[_0x7875('0x3a')](_0x7875('0x46'))[_0x7875('0x41')](_0x7875('0x47'))[_0x7875('0x3f')](_0x4cf61c+_0x7875('0x48'),_0x131c03['id'][_0x7875('0x3d')]()))[_0x7875('0x3f')](_0x7875('0x45'),squel['select']()[_0x7875('0x3a')](_0x7875('0x1f'))[_0x7875('0x41')](_0x7875('0x36'))['where'](_0x4cf61c+_0x7875('0x48'),_0x131c03['id'][_0x7875('0x3d')]())))[_0x7875('0x3d')]();return _0x2f2cc0;};function _0x99eec7(_0x4c8930,_0x5db4db){var _0x5bf6c6=squel[_0x7875('0x34')]()[_0x7875('0x35')]('cm_hopper')[_0x7875('0x37')](['phone',_0x7875('0x38'),_0x7875('0x3c'),_0x7875('0x24'),_0x5db4db,_0x7875('0x42'),_0x7875('0x39')],squel['select']()['field'](_0x7875('0x1f'),'phone')[_0x7875('0x3a')](_0x7875('0x3b'),_0x7875('0x38'))[_0x7875('0x3a')]('id','ContactId')['field'](LISTID[_0x7875('0x3d')](),_0x7875('0x24'))[_0x7875('0x3a')](_0x4c8930['id']['toString'](),_0x5db4db)[_0x7875('0x3a')](_0x7875('0x3b'),_0x7875('0x42'))[_0x7875('0x3a')]('NOW()',_0x7875('0x39'))[_0x7875('0x41')](_0x7875('0x3e'))[_0x7875('0x3f')](_0x7875('0x43'))[_0x7875('0x3f')]('ListId\x20=\x20?',LISTID[_0x7875('0x3d')]())[_0x7875('0x3f')](_0x7875('0x44'),squel[_0x7875('0x49')](hopperContacts))[_0x7875('0x3f')]('phone\x20IS\x20NOT\x20NULL'))[_0x7875('0x3d')]();return _0x5bf6c6;}function _0x8eee45(_0x57270f,_0x4cabd4){var _0x4c2518=squel[_0x7875('0x34')]()[_0x7875('0x35')]('cm_hopper_black')['fromQuery'](['phone','ContactId',_0x7875('0x24'),_0x4cabd4,_0x7875('0x42'),_0x7875('0x39')],squel['select']()[_0x7875('0x3a')](_0x7875('0x1f'),_0x7875('0x1f'))[_0x7875('0x3a')]('id','ContactId')[_0x7875('0x3a')](LISTID['toString'](),_0x7875('0x24'))[_0x7875('0x3a')](_0x57270f['id'][_0x7875('0x3d')](),_0x4cabd4)[_0x7875('0x3a')](_0x7875('0x3b'),_0x7875('0x42'))[_0x7875('0x3a')](_0x7875('0x3b'),'updatedAt')[_0x7875('0x41')]('cm_contacts')[_0x7875('0x3f')](_0x7875('0x43'))['where'](_0x7875('0x4a'),LISTID[_0x7875('0x3d')]())[_0x7875('0x3f')](_0x7875('0x44'),squel['str'](hopperContacts))[_0x7875('0x3f')](_0x7875('0x40')))[_0x7875('0x3d')]();return _0x4c2518;}return db['VoiceQueue']['findAll']({'where':{'type':_0x7875('0x4b')},'attributes':['id',_0x7875('0x4c')],'include':[{'model':db[_0x7875('0x4d')],'as':_0x7875('0x4e'),'where':{'id':LISTID}}]})['then'](function(_0x3d6ba4){var _0x4d336a=[];if(_0x3d6ba4){var _0x5ae6d1;for(var _0x65f61d=0x0,_0x3ce460;_0x65f61d<_0x3d6ba4[_0x7875('0x18')];_0x65f61d+=0x1){_0x3ce460=_0x3d6ba4[_0x65f61d][_0x7875('0x4f')]({'plain':!![]});switch(_0x3ce460['dialCheckDuplicateType']){case'always':_0x4d336a[_0x7875('0x2c')](db[_0x7875('0x50')][_0x7875('0x51')](_0x4a6cec(_0x3ce460,_0x7875('0x52')))['then'](function(){})['catch'](_0x1327b9()));break;case _0x7875('0x53'):_0x4d336a['push'](db[_0x7875('0x50')][_0x7875('0x51')](_0x34af5a(_0x3ce460,_0x7875('0x52')))[_0x7875('0x2b')](function(){})[_0x7875('0x2e')](_0x1327b9()));break;default:_0x4d336a[_0x7875('0x2c')](db[_0x7875('0x50')][_0x7875('0x51')](_0x99eec7(_0x3ce460,_0x7875('0x52')))[_0x7875('0x2b')](function(){})[_0x7875('0x2e')](_0x1327b9()));}}}return _0x4d336a;})['all']()['then'](function(){return db[_0x7875('0x54')][_0x7875('0x55')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db[_0x7875('0x4d')],'as':_0x7875('0x56'),'where':{'id':LISTID}}]})['then'](function(_0x50ec77){var _0x1f52a0=[];if(_0x50ec77){var _0x156094;for(var _0x1be161=0x0,_0x3a2391;_0x1be161<_0x50ec77[_0x7875('0x18')];_0x1be161+=0x1){_0x3a2391=_0x50ec77[_0x1be161][_0x7875('0x4f')]({'plain':!![]});_0x1f52a0[_0x7875('0x2c')](db['sequelize'][_0x7875('0x51')](_0x8eee45(_0x3a2391,'VoiceQueueId'))[_0x7875('0x2b')](function(){})[_0x7875('0x2e')](_0x1327b9()));}}return _0x1f52a0;})[_0x7875('0x57')]();})[_0x7875('0x2b')](function(){return db[_0x7875('0x58')][_0x7875('0x55')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db['CmList'],'as':_0x7875('0x4e'),'where':{'id':LISTID}}]})[_0x7875('0x2b')](function(_0x5d6d8d){var _0x420c3e=[];if(_0x5d6d8d){for(var _0xedf341=0x0,_0x5cff33;_0xedf341<_0x5d6d8d['length'];_0xedf341+=0x1){_0x5cff33=_0x5d6d8d[_0xedf341][_0x7875('0x4f')]({'plain':!![]});switch(_0x5cff33[_0x7875('0x4c')]){case _0x7875('0x59'):_0x420c3e[_0x7875('0x2c')](db[_0x7875('0x50')][_0x7875('0x51')](_0x4a6cec(_0x5cff33,_0x7875('0x5a')))[_0x7875('0x2b')](function(){})[_0x7875('0x2e')](_0x1327b9()));break;case'onlyIfOpen':_0x420c3e[_0x7875('0x2c')](db[_0x7875('0x50')]['query'](_0x34af5a(_0x5cff33,'CampaignId'))[_0x7875('0x2b')](function(){})[_0x7875('0x2e')](_0x1327b9()));break;default:_0x420c3e[_0x7875('0x2c')](db['sequelize'][_0x7875('0x51')](_0x99eec7(_0x5cff33,_0x7875('0x5a')))[_0x7875('0x2b')](function(){})[_0x7875('0x2e')](_0x1327b9()));}}}return _0x420c3e;})['all']();})['then'](function(){return db[_0x7875('0x58')][_0x7875('0x55')]({'attributes':['id'],'include':[{'model':db[_0x7875('0x4d')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x7875('0x2b')](function(_0x1e6751){var _0xfb88fb=[];if(_0x1e6751){for(var _0x176e09=0x0,_0x456e1e;_0x176e09<_0x1e6751['length'];_0x176e09+=0x1){_0x456e1e=_0x1e6751[_0x176e09][_0x7875('0x4f')]({'plain':!![]});_0xfb88fb['push'](db[_0x7875('0x50')][_0x7875('0x51')](_0x8eee45(_0x456e1e,_0x7875('0x5a')))['then'](function(){})[_0x7875('0x2e')](_0x1327b9()));}}return _0xfb88fb;})['all']();})['catch'](function(_0x1c2715){logger[_0x7875('0x13')](_0x7875('0x5b'),'generalCheckHopper',_0x1c2715[_0x7875('0x1a')]);});}var processPromises=function(_0x1d25f2){return BPromise['all'](promises)[_0x7875('0x2b')](function(_0x31de7d){})[_0x7875('0x2e')](function(_0x1bf5e4){logger[_0x7875('0x13')](_0x7875('0x5c'),JSON[_0x7875('0x30')](_0x1bf5e4));})['finally'](function(){socket[_0x7875('0x5d')](_0x7875('0x5e')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x1d25f2){return _0x1d25f2[_0x7875('0x5f')]();}});};var endCsv=function(){return BPromise['resolve']()[_0x7875('0x2b')](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket['emit'](_0x7875('0x5e')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x7875('0x60')](FILEPATH);}catch(_0x39f7f0){logger['error'](_0x7875('0x61'),JSON[_0x7875('0x30')](_0x39f7f0));}finally{process[_0x7875('0x62')](0x0);}});};process['on'](_0x7875('0x63'),function(){logger['info'](_0x7875('0x64'));endCsv();});function main(){return BPromise['resolve']()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db[_0x7875('0x29')][_0x7875('0x55')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x7875('0x2b')](function(_0x83337){var _0x369792=fs[_0x7875('0x65')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x7875('0x66')](_0x369792,{'header':!![],'skipEmptyLines':!![],'step':function(_0xff782f,_0x4393b4){total+=0x1;var _0x409f38=total;promises['push'](checkRow(_0xff782f,_0x83337,_0x409f38)[_0x7875('0x2b')](function(){success+=0x1;})[_0x7875('0x2e')](function(_0x4c3e54){if(_0x4c3e54[_0x7875('0x13')]){errors+=0x1;delete _0x4c3e54[_0x7875('0x13')];}else if(_0x4c3e54[_0x7875('0x27')]){duplicates+=0x1;delete _0x4c3e54[_0x7875('0x27')];}rows[_0x7875('0x2c')](_0x4c3e54);}));if(total%0xc8===0x0){_0x4393b4[_0x7875('0x67')]();return processPromises(_0x4393b4);}},'complete':function(){return processPromises()['then'](function(){logger[_0x7875('0x68')]('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0xe24377,_0x2b146e){logger['info']('CSV\x20parse\x20error',JSON[_0x7875('0x30')](_0xe24377));endCsv();}});})['catch'](function(_0x190152){logger[_0x7875('0x13')]('Error\x20executing\x20contact\x20csv\x20import:',JSON[_0x7875('0x30')](_0x190152));});}main(); \ No newline at end of file +var _0x820b=['../../../mysqldb','api','redis','localhost','register','argv','null','Missing\x20filepath\x20parameter!','undefined','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20socket_timestamp\x20parameter!','contact','test','isNil','error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','length','map','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','Duplicate\x20Contact','create','keys','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','message','stringify','cmContact','checkHopper','inspect','insert','into','cm_hopper','fromQuery','scheduledAt','select','NOW()','ContactId','field','toString','createdAt','updatedAt','where','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','str','phone\x20IS\x20NOT\x20NULL','calleridnum','cm_hopper_final','from','cm_contacts','deletedAt\x20IS\x20NULL','id\x20IN\x20?','findAll','outbound','dialCheckDuplicateType','CmList','Lists','always','sequelize','VoiceQueueId','onlyIfOpen','query','all','BlackLists','get','CampaignId','Campaign','cmContact,\x20%s,\x20%s','Error\x20processing\x20rows\x20block:','contact:csv_','resume','resolve','emit','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CmContact','createReadStream','duplicate','pause','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','util','lodash','squel','papaparse','ioredis'];(function(_0x1dc007,_0xfb5b4c){var _0x476583=function(_0x55feab){while(--_0x55feab){_0x1dc007['push'](_0x1dc007['shift']());}};_0x476583(++_0xfb5b4c);}(_0x820b,0x68));var _0xb820=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x820b[_0x40a045];return _0x1a687c;};'use strict';var BPromise=require('bluebird');var util=require(_0xb820('0x0'));var _=require(_0xb820('0x1'));var fs=require('fs');var squel=require(_0xb820('0x2'));var Papa=require(_0xb820('0x3'));var Redis=require(_0xb820('0x4'));var db=require(_0xb820('0x5'))['db'];var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0xb820('0x6'));config[_0xb820('0x7')]=_['defaults'](config['redis'],{'host':_0xb820('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb820('0x7')]));require('../../../api/cmContact/cmContact.socket')[_0xb820('0x9')](socket);try{if(!process[_0xb820('0xa')][0x2]||process['argv'][0x2]==='undefined'||process[_0xb820('0xa')][0x2]===_0xb820('0xb')){throw new Error(_0xb820('0xc'));}var FILEPATH=process[_0xb820('0xa')][0x2];if(!process['argv'][0x3]||process['argv'][0x3]===_0xb820('0xd')||process['argv'][0x3]===_0xb820('0xb')||!process[_0xb820('0xa')][0x4]||process['argv'][0x4]==='undefined'||process[_0xb820('0xa')][0x4]==='null'){throw new Error(_0xb820('0xe'));}var FIELDS=_[_0xb820('0xf')](process[_0xb820('0xa')][0x3][_0xb820('0x10')](','),process[_0xb820('0xa')][0x4][_0xb820('0x10')](','));if(!process[_0xb820('0xa')][0x5]||process['argv'][0x5]===_0xb820('0xd')||process['argv'][0x5]==='null'){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process[_0xb820('0xa')][0x5];var COMPANYID=process[_0xb820('0xa')][0x6]&&process[_0xb820('0xa')][0x6]!==_0xb820('0xd')&&process[_0xb820('0xa')][0x6]!==_0xb820('0xb')?process[_0xb820('0xa')][0x6]:null;var DUPLICATES=process[_0xb820('0xa')][0x7]&&process[_0xb820('0xa')][0x7]!==_0xb820('0xd')&&process['argv'][0x7]!==_0xb820('0xb')?process[_0xb820('0xa')][0x7]:null;if(!process[_0xb820('0xa')][0x8]||process[_0xb820('0xa')][0x8]===_0xb820('0xd')||process[_0xb820('0xa')][0x8]==='null'){throw new Error(_0xb820('0x11'));}var SOCKET_TIMESTAMP=process[_0xb820('0xa')][0x8];}catch(_0x2528ec){logger['error'](_0x2528ec);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(_0x238477,_0x1c59fb,_0x502888,_0x31ccf8){var _0x5cab03={'message':_0x1c59fb};_0x5cab03[_0x238477]=!![];if(_0x502888){_0x5cab03[_0xb820('0x12')]=_0x502888;}if(_0x31ccf8){_0x5cab03['index']=_0x31ccf8;}return _0x5cab03;}function isEmail(_0x5ba729){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))*$/[_0xb820('0x13')](_0x5ba729);}function checkRow(_0x9a42cd,_0x3e776e,_0xd32ce4){return new BPromise(function(_0x1f61eb,_0x981880){if(_[_0xb820('0x14')](_0x9a42cd)){return _0x981880(handleCheckRowError(_0xb820('0x15'),_0xb820('0x16'),null,_0xd32ce4));}if(_0x9a42cd['errors']&&_0x9a42cd['errors'][_0xb820('0x17')]){var _0x581585=_[_0xb820('0x18')](_0x9a42cd['errors'],'message')[_0xb820('0x19')](';');return _0x981880(handleCheckRowError(_0xb820('0x15'),_0x581585,null,_0xd32ce4));}var _0xbe7f7c={};for(var _0x15dc7c in FIELDS){if(FIELDS[_0xb820('0x1a')](_0x15dc7c)&&FIELDS[_0x15dc7c]){_0xbe7f7c[_0x15dc7c]=_0x9a42cd[_0xb820('0x1b')][0x0][FIELDS[_0x15dc7c]]||_0x9a42cd['data'][0x0]['\ufeff'+FIELDS[_0x15dc7c]];}}if(!_0xbe7f7c[_0xb820('0x1c')]){return _0x981880(handleCheckRowError(_0xb820('0x15'),_0xb820('0x1d'),null,_0xd32ce4));}if(!_0xbe7f7c[_0xb820('0x1e')]){return _0x981880(handleCheckRowError(_0xb820('0x15'),_0xb820('0x1f'),null,_0xd32ce4));}if(_0xbe7f7c[_0xb820('0x20')]){var _0x2c9a85=moment(_0xbe7f7c[_0xb820('0x20')],_0xb820('0x21'));if(!_0x2c9a85['isValid']()){return _0x981880(handleCheckRowError(_0xb820('0x15'),_0xb820('0x22'),null,_0xd32ce4));}}if(_0xbe7f7c[_0xb820('0x23')]){if(!isEmail(_0xbe7f7c['email'])){return _0x981880(handleCheckRowError(_0xb820('0x15'),_0xb820('0x24'),null,_0xd32ce4));}}_0xbe7f7c[_0xb820('0x25')]=LISTID;_0xbe7f7c[_0xb820('0x26')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0xb820('0x17')]&&_0x3e776e){var _0x4749da={};for(var _0x3b3892=0x0,_0x58bf14=DUPLICATES[_0xb820('0x17')];_0x3b3892<_0x58bf14;_0x3b3892+=0x1){_0x4749da[DUPLICATES[_0x3b3892]]=_0xbe7f7c[DUPLICATES[_0x3b3892]];}var _0x42e954=_[_0xb820('0x27')](_0x3e776e,_0x4749da);if(_0x42e954){return _0x981880(handleCheckRowError('duplicate',_0xb820('0x28'),_0x42e954,_0xd32ce4));}}return db['CmContact'][_0xb820('0x29')](_0xbe7f7c,{'raw':!![],'hooks':![],'fields':_[_0xb820('0x2a')](_0xbe7f7c)})[_0xb820('0x2b')](function(_0x502795){if(DUPLICATES&&DUPLICATES['length']&&_0x3e776e){_0x3e776e[_0xb820('0x2c')](_[_0xb820('0x2d')](_0xbe7f7c,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x502795['id'];return _0x1f61eb();})[_0xb820('0x2e')](function(_0x4af9ee){return _0x981880(handleCheckRowError(_0xb820('0x15'),_0xb820('0x2f')+(_0x4af9ee[_0xb820('0x30')]||JSON[_0xb820('0x31')](_0x4af9ee)),null,_0xd32ce4));});});}function checkHopper(){function _0x17eaf4(){return function(_0x194215){logger[_0xb820('0x15')](_0xb820('0x32'),_0xb820('0x33'),util[_0xb820('0x34')](_0x194215,{'showHidden':![],'depth':null}));};}var _0x270680=function(_0x383c25,_0x2659c5){var _0x45c89c=squel[_0xb820('0x35')]()[_0xb820('0x36')](_0xb820('0x37'))[_0xb820('0x38')]([_0xb820('0x1e'),_0xb820('0x39'),'ContactId',_0xb820('0x25'),_0x2659c5,'createdAt','updatedAt'],squel[_0xb820('0x3a')]()['field'](_0xb820('0x1e'),_0xb820('0x1e'))['field'](_0xb820('0x3b'),_0xb820('0x39'))['field']('id',_0xb820('0x3c'))[_0xb820('0x3d')](LISTID[_0xb820('0x3e')](),_0xb820('0x25'))[_0xb820('0x3d')](_0x383c25['id'][_0xb820('0x3e')](),_0x2659c5)[_0xb820('0x3d')]('NOW()',_0xb820('0x3f'))[_0xb820('0x3d')](_0xb820('0x3b'),_0xb820('0x40'))['from']('cm_contacts')[_0xb820('0x41')]('deletedAt\x20IS\x20NULL')[_0xb820('0x41')](_0xb820('0x42'),LISTID['toString']())['where']('phone\x20IS\x20NOT\x20NULL')[_0xb820('0x41')](_0xb820('0x43'),squel['select']()[_0xb820('0x3d')](_0xb820('0x1e'))['from'](_0xb820('0x37'))[_0xb820('0x41')](_0x2659c5+_0xb820('0x44'),_0x383c25['id'][_0xb820('0x3e')]())))[_0xb820('0x3e')]();return _0x45c89c;};var _0x42bd8e=function(_0x5cbd9c,_0x5542f9){var _0x43ceeb=squel['insert']()[_0xb820('0x36')](_0xb820('0x37'))[_0xb820('0x38')]([_0xb820('0x1e'),_0xb820('0x39'),_0xb820('0x3c'),_0xb820('0x25'),_0x5542f9,_0xb820('0x3f'),_0xb820('0x40')],squel[_0xb820('0x3a')]()[_0xb820('0x3d')](_0xb820('0x1e'),'phone')[_0xb820('0x3d')](_0xb820('0x3b'),'scheduledAt')['field']('id',_0xb820('0x3c'))[_0xb820('0x3d')](LISTID[_0xb820('0x3e')](),'ListId')[_0xb820('0x3d')](_0x5cbd9c['id']['toString'](),_0x5542f9)['field'](_0xb820('0x3b'),_0xb820('0x3f'))[_0xb820('0x3d')](_0xb820('0x3b'),_0xb820('0x40'))['from']('cm_contacts')[_0xb820('0x41')]('deletedAt\x20IS\x20NULL')[_0xb820('0x41')](_0xb820('0x42'),LISTID[_0xb820('0x3e')]())[_0xb820('0x41')]('id\x20IN\x20?',squel[_0xb820('0x45')](hopperContacts))[_0xb820('0x41')](_0xb820('0x46'))['where'](_0xb820('0x43'),squel[_0xb820('0x3a')]()[_0xb820('0x3d')](_0xb820('0x47'))['from'](_0xb820('0x48'))[_0xb820('0x41')](_0x5542f9+'\x20=\x20?',_0x5cbd9c['id'][_0xb820('0x3e')]()))[_0xb820('0x41')](_0xb820('0x43'),squel[_0xb820('0x3a')]()[_0xb820('0x3d')]('phone')[_0xb820('0x49')](_0xb820('0x37'))['where'](_0x5542f9+_0xb820('0x44'),_0x5cbd9c['id'][_0xb820('0x3e')]())))[_0xb820('0x3e')]();return _0x43ceeb;};function _0x4b863b(_0x1a9b6a,_0x2f327e){var _0x398350=squel[_0xb820('0x35')]()[_0xb820('0x36')]('cm_hopper')[_0xb820('0x38')](['phone','scheduledAt',_0xb820('0x3c'),_0xb820('0x25'),_0x2f327e,_0xb820('0x3f'),_0xb820('0x40')],squel['select']()['field'](_0xb820('0x1e'),'phone')[_0xb820('0x3d')](_0xb820('0x3b'),'scheduledAt')['field']('id',_0xb820('0x3c'))[_0xb820('0x3d')](LISTID[_0xb820('0x3e')](),'ListId')[_0xb820('0x3d')](_0x1a9b6a['id'][_0xb820('0x3e')](),_0x2f327e)['field']('NOW()','createdAt')[_0xb820('0x3d')](_0xb820('0x3b'),_0xb820('0x40'))[_0xb820('0x49')](_0xb820('0x4a'))[_0xb820('0x41')](_0xb820('0x4b'))[_0xb820('0x41')](_0xb820('0x42'),LISTID['toString']())[_0xb820('0x41')](_0xb820('0x4c'),squel['str'](hopperContacts))['where'](_0xb820('0x46')))[_0xb820('0x3e')]();return _0x398350;}function _0x30f23d(_0x278594,_0x3bdbcd){var _0x5da03d=squel[_0xb820('0x35')]()[_0xb820('0x36')]('cm_hopper_black')[_0xb820('0x38')](['phone','ContactId',_0xb820('0x25'),_0x3bdbcd,_0xb820('0x3f'),_0xb820('0x40')],squel['select']()[_0xb820('0x3d')](_0xb820('0x1e'),_0xb820('0x1e'))[_0xb820('0x3d')]('id',_0xb820('0x3c'))[_0xb820('0x3d')](LISTID[_0xb820('0x3e')](),'ListId')[_0xb820('0x3d')](_0x278594['id']['toString'](),_0x3bdbcd)[_0xb820('0x3d')]('NOW()',_0xb820('0x3f'))[_0xb820('0x3d')](_0xb820('0x3b'),'updatedAt')['from'](_0xb820('0x4a'))[_0xb820('0x41')](_0xb820('0x4b'))[_0xb820('0x41')](_0xb820('0x42'),LISTID[_0xb820('0x3e')]())[_0xb820('0x41')](_0xb820('0x4c'),squel[_0xb820('0x45')](hopperContacts))[_0xb820('0x41')](_0xb820('0x46')))['toString']();return _0x5da03d;}return db['VoiceQueue'][_0xb820('0x4d')]({'where':{'type':_0xb820('0x4e')},'attributes':['id',_0xb820('0x4f')],'include':[{'model':db[_0xb820('0x50')],'as':_0xb820('0x51'),'where':{'id':LISTID}}]})[_0xb820('0x2b')](function(_0x378720){var _0x4f59b0=[];if(_0x378720){var _0x41ca0a;for(var _0x46c741=0x0,_0x5cfe92;_0x46c741<_0x378720[_0xb820('0x17')];_0x46c741+=0x1){_0x5cfe92=_0x378720[_0x46c741]['get']({'plain':!![]});switch(_0x5cfe92['dialCheckDuplicateType']){case _0xb820('0x52'):_0x4f59b0[_0xb820('0x2c')](db[_0xb820('0x53')]['query'](_0x42bd8e(_0x5cfe92,_0xb820('0x54')))[_0xb820('0x2b')](function(){})['catch'](_0x17eaf4()));break;case _0xb820('0x55'):_0x4f59b0[_0xb820('0x2c')](db[_0xb820('0x53')][_0xb820('0x56')](_0x270680(_0x5cfe92,_0xb820('0x54')))[_0xb820('0x2b')](function(){})[_0xb820('0x2e')](_0x17eaf4()));break;default:_0x4f59b0[_0xb820('0x2c')](db[_0xb820('0x53')]['query'](_0x4b863b(_0x5cfe92,_0xb820('0x54')))['then'](function(){})[_0xb820('0x2e')](_0x17eaf4()));}}}return _0x4f59b0;})[_0xb820('0x57')]()[_0xb820('0x2b')](function(){return db['VoiceQueue']['findAll']({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db['CmList'],'as':_0xb820('0x58'),'where':{'id':LISTID}}]})[_0xb820('0x2b')](function(_0x4be76a){var _0x487178=[];if(_0x4be76a){var _0x23b1db;for(var _0x5e3dc6=0x0,_0x31d747;_0x5e3dc6<_0x4be76a[_0xb820('0x17')];_0x5e3dc6+=0x1){_0x31d747=_0x4be76a[_0x5e3dc6][_0xb820('0x59')]({'plain':!![]});_0x487178[_0xb820('0x2c')](db[_0xb820('0x53')][_0xb820('0x56')](_0x30f23d(_0x31d747,_0xb820('0x54')))[_0xb820('0x2b')](function(){})[_0xb820('0x2e')](_0x17eaf4()));}}return _0x487178;})['all']();})[_0xb820('0x2b')](function(){return db['Campaign']['findAll']({'attributes':['id',_0xb820('0x4f')],'include':[{'model':db['CmList'],'as':_0xb820('0x51'),'where':{'id':LISTID}}]})[_0xb820('0x2b')](function(_0x1076ac){var _0x221b91=[];if(_0x1076ac){for(var _0xe1d161=0x0,_0x44634f;_0xe1d161<_0x1076ac[_0xb820('0x17')];_0xe1d161+=0x1){_0x44634f=_0x1076ac[_0xe1d161][_0xb820('0x59')]({'plain':!![]});switch(_0x44634f[_0xb820('0x4f')]){case _0xb820('0x52'):_0x221b91[_0xb820('0x2c')](db['sequelize']['query'](_0x42bd8e(_0x44634f,_0xb820('0x5a')))[_0xb820('0x2b')](function(){})['catch'](_0x17eaf4()));break;case _0xb820('0x55'):_0x221b91[_0xb820('0x2c')](db[_0xb820('0x53')][_0xb820('0x56')](_0x270680(_0x44634f,_0xb820('0x5a')))[_0xb820('0x2b')](function(){})[_0xb820('0x2e')](_0x17eaf4()));break;default:_0x221b91[_0xb820('0x2c')](db[_0xb820('0x53')][_0xb820('0x56')](_0x4b863b(_0x44634f,_0xb820('0x5a')))[_0xb820('0x2b')](function(){})[_0xb820('0x2e')](_0x17eaf4()));}}}return _0x221b91;})['all']();})['then'](function(){return db[_0xb820('0x5b')][_0xb820('0x4d')]({'attributes':['id'],'include':[{'model':db[_0xb820('0x50')],'as':_0xb820('0x58'),'where':{'id':LISTID}}]})[_0xb820('0x2b')](function(_0x443026){var _0x46f169=[];if(_0x443026){for(var _0x1316cc=0x0,_0x53aec4;_0x1316cc<_0x443026['length'];_0x1316cc+=0x1){_0x53aec4=_0x443026[_0x1316cc][_0xb820('0x59')]({'plain':!![]});_0x46f169['push'](db[_0xb820('0x53')][_0xb820('0x56')](_0x30f23d(_0x53aec4,'CampaignId'))['then'](function(){})[_0xb820('0x2e')](_0x17eaf4()));}}return _0x46f169;})[_0xb820('0x57')]();})[_0xb820('0x2e')](function(_0x23c85e){logger[_0xb820('0x15')](_0xb820('0x5c'),'generalCheckHopper',_0x23c85e['message']);});}var processPromises=function(_0x373dda){return BPromise[_0xb820('0x57')](promises)['then'](function(_0x417665){})['catch'](function(_0xaefd89){logger['error'](_0xb820('0x5d'),JSON[_0xb820('0x31')](_0xaefd89));})['finally'](function(){socket['emit'](_0xb820('0x5e')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x373dda){return _0x373dda[_0xb820('0x5f')]();}});};var endCsv=function(){return BPromise[_0xb820('0x60')]()[_0xb820('0x2b')](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket[_0xb820('0x61')](_0xb820('0x5e')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xb820('0x62')](FILEPATH);}catch(_0x4c307a){logger['error'](_0xb820('0x63'),JSON[_0xb820('0x31')](_0x4c307a));}finally{process[_0xb820('0x64')](0x0);}});};process['on'](_0xb820('0x65'),function(){logger[_0xb820('0x66')]('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise['resolve']()[_0xb820('0x2b')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db[_0xb820('0x67')][_0xb820('0x4d')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0x2c7b26){var _0x13b7f5=fs[_0xb820('0x68')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x13b7f5,{'header':!![],'skipEmptyLines':!![],'step':function(_0x8168c6,_0x53c766){total+=0x1;var _0x145627=total;promises[_0xb820('0x2c')](checkRow(_0x8168c6,_0x2c7b26,_0x145627)['then'](function(){success+=0x1;})['catch'](function(_0x542926){if(_0x542926[_0xb820('0x15')]){errors+=0x1;delete _0x542926[_0xb820('0x15')];}else if(_0x542926[_0xb820('0x69')]){duplicates+=0x1;delete _0x542926[_0xb820('0x69')];}rows[_0xb820('0x2c')](_0x542926);}));if(total%0xc8===0x0){_0x53c766[_0xb820('0x6a')]();return processPromises(_0x53c766);}},'complete':function(){return processPromises()[_0xb820('0x2b')](function(){logger[_0xb820('0x66')]('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x15f1e2,_0x2df339){logger[_0xb820('0x66')](_0xb820('0x6b'),JSON['stringify'](_0x15f1e2));endCsv();}});})[_0xb820('0x2e')](function(_0x4e15a3){logger[_0xb820('0x15')](_0xb820('0x6c'),JSON[_0xb820('0x31')](_0x4e15a3));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index ca797fc..806abb5 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 _0x9f7a=['affectedRows','unlink','complete','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','parse','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','map','SIGINT','path','lodash','util','bluebird','../../../mysqldb','../../../config/environment','../../../config/environment/shared','../../../config/logger','import','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','select','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','CmContact','findAll','AdditionalPhones','then','push','all','split','length','filter','CmContactHasItem','findOne','update','inserted','cm_contacts.scheduledat','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','cm_hopper','fromQuery','phone','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22onlyIfOpen\x22','toString','cm_contacts.phone','cm_contacts.id','into','field','cm_hopper_black','ListId\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','UserId','\x22always\x22','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_hopper.ListId\x20=\x20?','keys','CompanyId',')\x20NOT\x20IN\x20?','id\x20IN\x20?','MIN(id)','min_id','group','info','Received\x20SIGINT','message','exit','errors','code','sequelize','spread','error','campaigns.id','campaigns.dialTimezone','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','query','catch','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','timezones','dialTimezone','isNil','utcOffset','set','offset','main','binding','clone','socket_timestamp','server/files/tmp','.csv','includes','header','ContactItemType','name','writeFileSync','createReadStream','rows','data','find','_description','hasOwnProperty','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','trim','description','SystemRow','appendFileSync','emit','contact:import:','abort','SystemError','duplicates','cm_contacts_','CREATE\x20TABLE\x20','campaigns_','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','dialTimezone,utcOffset','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','contactId','contactTypeId','orderBy','voice_queues_has_cm_lists','voice_queues_has_cm_blacklists','CampaignId','VoiceQueueId','DROP\x20TABLE\x20'];(function(_0x2b83f6,_0x5c4af9){var _0x47e2b1=function(_0x3aeb09){while(--_0x3aeb09){_0x2b83f6['push'](_0x2b83f6['shift']());}};_0x47e2b1(++_0x5c4af9);}(_0x9f7a,0xc4));var _0xa9f7=function(_0x344a3f,_0x579a22){_0x344a3f=_0x344a3f-0x0;var _0x264712=_0x9f7a[_0x344a3f];return _0x264712;};'use strict';var fs=require('fs');var path=require(_0xa9f7('0x0'));var _=require(_0xa9f7('0x1'));var Papa=require('papaparse');var util=require(_0xa9f7('0x2'));var BPromise=require(_0xa9f7('0x3'));var moment=require('moment');var squel=require('squel');var Redis=require('ioredis');var db=require(_0xa9f7('0x4'))['db'];var config=require(_0xa9f7('0x5'));var shared=require(_0xa9f7('0x6'));var logger=require(_0xa9f7('0x7'))(_0xa9f7('0x8'));config[_0xa9f7('0x9')]=_['defaults'](config[_0xa9f7('0x9')],{'host':_0xa9f7('0xa'),'port':0x18eb});var socket=require(_0xa9f7('0xb'))(new Redis(config[_0xa9f7('0x9')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0xa9f7('0xc')](_0xa9f7('0xd'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x5b8005){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0x5b8005);}function selectNotIn(_0x22e2ac,_0x42ccb5,_0x5b0f18,_0x13b870,_0x1debeb){return squel[_0xa9f7('0xe')]()['field']('phone')[_0xa9f7('0xf')](_0x13b870)[_0xa9f7('0x10')](_0x42ccb5,null,_0x42ccb5+_0xa9f7('0x11')+_0x13b870+'.'+_0x5b0f18)[_0xa9f7('0x12')](_0x13b870+'.'+_0x5b0f18+_0xa9f7('0x13')+_0x22e2ac+'.'+_0x5b0f18)[_0xa9f7('0x12')](_0x42ccb5+_0xa9f7('0x14')+_0x1debeb['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x251883,_0x12dc42){promisesAdditionalPhones=[];return db[_0xa9f7('0x15')][_0xa9f7('0x16')]({'raw':!![],'attributes':['id',_0xa9f7('0x17')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0xa9f7('0x18')](function(_0x1e5181){if(_0x1e5181!==null){var _0x29aae1=[];for(var _0x218a91=0x0;_0x218a91<_0x1e5181['length'];_0x218a91++){var _0x59a558=_0x1e5181[_0x218a91];_0x29aae1[_0xa9f7('0x19')](insertAdditionalPhones(_0x59a558));}}Promise[_0xa9f7('0x1a')](_0x29aae1)[_0xa9f7('0x18')](function(){_0x251883({'val':0x1});});});});}function insertAdditionalPhones(_0x185fc8){return new Promise(function(_0x23689b,_0x5976f2){var _0x348a6c=_0x185fc8[_0xa9f7('0x17')];var _0x289e54=_0x348a6c[_0xa9f7('0x1b')](';');var _0x2aa582=[];orderBy=0x0;for(var _0x4e1d3f=0x0;_0x4e1d3f<_0x289e54[_0xa9f7('0x1c')];_0x4e1d3f++){_0x2aa582[_0xa9f7('0x19')](splitAdditionalPhone(_0x185fc8['id'],_0x289e54[_0x4e1d3f]));}Promise[_0xa9f7('0x1a')](_0x2aa582)['then'](function(){_0x23689b({'val':_0x289e54[_0xa9f7('0x1c')]});});});}function splitAdditionalPhone(_0x480b6f,_0x47f8b7){return new Promise(function(_0x16ffec,_0x4ad678){var _0x2231e2=_0x47f8b7[_0xa9f7('0x1b')](':');var _0x234b30=_0x2231e2[0x0];var _0x5581d9=_0x2231e2[0x1];if(!_['isNil'](_0x5581d9)){var _0x55eee4=_0x5581d9[_0xa9f7('0x1b')]('|');var _0x19c01a=[];for(var _0x59df73=0x0;_0x59df73<_0x55eee4[_0xa9f7('0x1c')];_0x59df73++){if(_0x55eee4[_0x59df73]!==''){var _0x1b25a9=_[_0xa9f7('0x1d')](promisesAdditionalPhones,{'contactId':_0x480b6f,'phone':_0x55eee4[_0x59df73]});if(_0x1b25a9['length']==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x480b6f,'contactTypeId':_0x234b30,'phone':_0x55eee4[_0x59df73],'orderBy':orderBy});}}}_0x16ffec({'ok':0x1});}else _0x16ffec({'res':0x0});});}function createAdditionalPhone(_0x592168,_0x3f9466,_0x1e54a2,_0x5d4a7f){var _0x24ed29='';var _0xeeb8b1='';var _0x5400d7=_0x1e54a2[_0xa9f7('0x1b')]('§');_0x24ed29=_0x5400d7[0x0];if(_0x5400d7[_0xa9f7('0x1c')]==0x2)_0xeeb8b1=_0x5400d7[0x1];return new Promise(function(_0x3c336c,_0x59f974){return db[_0xa9f7('0x1e')][_0xa9f7('0x1f')]({'where':{'CmContactId':_0x592168,'item':_0x24ed29}})[_0xa9f7('0x18')](function(_0x2eb869){if(_0x2eb869){return db['CmContactHasItem'][_0xa9f7('0x20')]({'ItemTypeId':_0x3f9466,'description':_0xeeb8b1,'OrderBy':_0x5d4a7f},{'where':{'CmContactId':_0x592168,'item':_0x24ed29}})[_0xa9f7('0x18')](function(_0x17625e){_0x3c336c({'res':'updated'});});}else{return db[_0xa9f7('0x1e')]['create']({'CmContactId':_0x592168,'item':_0x24ed29,'description':_0xeeb8b1,'ItemTypeId':_0x3f9466,'OrderBy':_0x5d4a7f,'ItemClass':'PHONE'})[_0xa9f7('0x18')](function(_0x2ab5c7){_0x3c336c({'res':_0xa9f7('0x21')});});}});});}function insertCmHopper(_0x30be4a,_0x408712,_0x29bacd,_0xb56ab9,_0xe08fd6){var _0x258e69=['cm_contacts.phone',_0xa9f7('0x22'),'cm_contacts.id',_0xa9f7('0x23'),_0x408712+'.'+_0xb56ab9,_0xa9f7('0x24'),_0xa9f7('0x25'),_0xa9f7('0x26'),_0xa9f7('0x27'),'\x22'+_0xe08fd6+'\x22'];return squel[_0xa9f7('0x28')]()['into'](_0xa9f7('0x29'))[_0xa9f7('0x2a')]([_0xa9f7('0x2b'),_0xa9f7('0x2c'),_0xa9f7('0x2d'),_0xa9f7('0x2e'),_0xb56ab9,_0xa9f7('0x2f'),_0xa9f7('0x30'),_0xa9f7('0x31'),'UserId',_0xa9f7('0x32')],squel[_0xa9f7('0xe')]()[_0xa9f7('0x33')](_0x258e69)['from'](_0x408712)[_0xa9f7('0x10')](_0xa9f7('0x34'),null,_0xa9f7('0x35')+_0x408712+'.CmListId')[_0xa9f7('0x10')](_0x29bacd,null,_0x29bacd+_0xa9f7('0x11')+_0x408712+'.'+_0xb56ab9)[_0xa9f7('0x12')](_0x408712+_0xa9f7('0x36'),_0x30be4a)[_0xa9f7('0x12')](_0xa9f7('0x37'),NOW)['where'](_0xa9f7('0x38'),selectNotIn(_0x408712,_0x29bacd,_0xb56ab9,_0xa9f7('0x29'),['\x22always\x22',_0xa9f7('0x39')]))['where'](_0xa9f7('0x38'),selectNotIn(_0x408712,_0x29bacd,_0xb56ab9,_0xa9f7('0x29'),['\x22always\x22'])))[_0xa9f7('0x3a')]();}function insertCmHopperBlack(_0x43e392,_0x5205e1,_0x2d0f64,_0x31d44a){var _0x8dcde3=[_0xa9f7('0x3b'),_0xa9f7('0x3c'),_0xa9f7('0x23'),_0x5205e1+'.'+_0x31d44a,_0xa9f7('0x24'),_0xa9f7('0x25')];return squel['insert']()[_0xa9f7('0x3d')]('cm_hopper_black')['fromQuery']([_0xa9f7('0x2b'),_0xa9f7('0x2d'),_0xa9f7('0x2e'),_0x31d44a,_0xa9f7('0x2f'),_0xa9f7('0x30')],squel[_0xa9f7('0xe')]()[_0xa9f7('0x33')](_0x8dcde3)[_0xa9f7('0xf')](_0x5205e1)[_0xa9f7('0x10')](_0xa9f7('0x34'),null,_0xa9f7('0x35')+_0x5205e1+'.CmListId')[_0xa9f7('0x10')](_0x2d0f64,null,_0x2d0f64+_0xa9f7('0x11')+_0x5205e1+'.'+_0x31d44a)[_0xa9f7('0x12')](_0x5205e1+_0xa9f7('0x36'),_0x43e392)[_0xa9f7('0x12')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xa9f7('0x12')](_0xa9f7('0x38'),squel[_0xa9f7('0xe')]()[_0xa9f7('0x3e')](_0xa9f7('0x2b'))[_0xa9f7('0xf')](_0xa9f7('0x3f'))[_0xa9f7('0x12')](_0xa9f7('0x40'),_0x43e392)[_0xa9f7('0x12')](_0x31d44a+_0xa9f7('0x13')+_0x5205e1+'.'+_0x31d44a)))[_0xa9f7('0x3a')]();}function insertTzCmHopper(_0xb811d0,_0x1119f8,_0x3231a4,_0x31c5f9,_0x594a4f,_0xf3483f){var _0x3a324b=[_0xa9f7('0x3b'),_0xa9f7('0x41')+_0xf3483f+_0xa9f7('0x42'),_0xa9f7('0x3c'),_0xa9f7('0x23'),_0x1119f8+'.'+_0x31c5f9,_0xa9f7('0x24'),_0xa9f7('0x25'),_0xa9f7('0x26'),_0xa9f7('0x27'),'\x22'+_0x594a4f+'\x22'];var _0xc02b58=squel[_0xa9f7('0x28')]()['into']('cm_hopper')['fromQuery'](['phone',_0xa9f7('0x2c'),_0xa9f7('0x2d'),_0xa9f7('0x2e'),_0x31c5f9,_0xa9f7('0x2f'),_0xa9f7('0x30'),_0xa9f7('0x31'),_0xa9f7('0x43'),_0xa9f7('0x32')],squel[_0xa9f7('0xe')]()[_0xa9f7('0x33')](_0x3a324b)['from'](_0x1119f8)[_0xa9f7('0x10')](_0xa9f7('0x34'),null,_0xa9f7('0x35')+_0x1119f8+'.CmListId')[_0xa9f7('0x10')](_0x3231a4,null,_0x3231a4+_0xa9f7('0x11')+_0x1119f8+'.'+_0x31c5f9)[_0xa9f7('0x10')](_0xf3483f,null,_0xf3483f+'.id\x20=\x20'+_0x1119f8+'.'+_0x31c5f9)[_0xa9f7('0x12')](_0x1119f8+_0xa9f7('0x36'),_0xb811d0)[_0xa9f7('0x12')](_0xa9f7('0x37'),NOW)['where'](_0xa9f7('0x38'),selectNotIn(_0x1119f8,_0x3231a4,_0x31c5f9,_0xa9f7('0x29'),[_0xa9f7('0x44'),_0xa9f7('0x39')]))['where'](_0xa9f7('0x38'),selectNotIn(_0x1119f8,_0x3231a4,_0x31c5f9,_0xa9f7('0x29'),['\x22always\x22'])))['toString']();return _0xc02b58;}function insertTzCmHopperBlack(_0x526b1e,_0x3fd647,_0x4aef79,_0x22f3c3){var _0xac23d4=[_0xa9f7('0x3b'),'cm_contacts.id',_0xa9f7('0x23'),_0x3fd647+'.'+_0x22f3c3,_0xa9f7('0x24'),_0xa9f7('0x25')];return squel['insert']()[_0xa9f7('0x3d')](_0xa9f7('0x3f'))[_0xa9f7('0x2a')]([_0xa9f7('0x2b'),_0xa9f7('0x2d'),_0xa9f7('0x2e'),_0x22f3c3,_0xa9f7('0x2f'),'updatedAt'],squel[_0xa9f7('0xe')]()[_0xa9f7('0x33')](_0xac23d4)[_0xa9f7('0xf')](_0x3fd647)[_0xa9f7('0x10')](_0xa9f7('0x34'),null,_0xa9f7('0x35')+_0x3fd647+'.CmListId')[_0xa9f7('0x10')](_0x4aef79,null,_0x4aef79+_0xa9f7('0x11')+_0x3fd647+'.'+_0x22f3c3)[_0xa9f7('0x12')](_0x3fd647+'.CmListId\x20=\x20?',_0x526b1e)[_0xa9f7('0x12')](_0xa9f7('0x37'),NOW)[_0xa9f7('0x12')](_0xa9f7('0x38'),squel[_0xa9f7('0xe')]()['field'](_0xa9f7('0x2b'))[_0xa9f7('0xf')](_0xa9f7('0x3f'))[_0xa9f7('0x12')](_0xa9f7('0x40'),_0x526b1e)[_0xa9f7('0x12')](_0x22f3c3+_0xa9f7('0x13')+_0x3fd647+'.'+_0x22f3c3)))[_0xa9f7('0x3a')]();}function insertCmHopperAdditionalPhones(_0x1f8324){var _0x581881=[_0xa9f7('0x45'),_0xa9f7('0x46'),_0xa9f7('0x47'),_0xa9f7('0x48'),_0xa9f7('0x49')];return squel[_0xa9f7('0x28')]()[_0xa9f7('0x3d')]('cm_hopper_additional_phones')[_0xa9f7('0x2a')]([_0xa9f7('0x4a'),_0xa9f7('0x2b'),_0xa9f7('0x4b'),_0xa9f7('0x2f'),_0xa9f7('0x30')],squel[_0xa9f7('0xe')]()['fields'](_0x581881)[_0xa9f7('0xf')]('cm_hopper')[_0xa9f7('0x10')](_0xa9f7('0x34'),null,_0xa9f7('0x4c'))[_0xa9f7('0x10')](_0xa9f7('0x4d'),null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')['where'](_0xa9f7('0x4e'),_0x1f8324)[_0xa9f7('0x12')]('cm_contacts.createdAt\x20=\x20?',NOW))[_0xa9f7('0x3a')]();}function insertCmContact(_0x40de3a,_0xd92a5f,_0x2b6be5,_0xb22926){var _0x30a7de=_['concat'](_[_0xa9f7('0x4f')](_0xb22926),[_0xa9f7('0x2e'),_0xa9f7('0x50'),_0xa9f7('0x2f'),_0xa9f7('0x30'),'scheduledAt']);return squel[_0xa9f7('0x28')]()[_0xa9f7('0x3d')](_0xa9f7('0x34'))['fromQuery'](_0x30a7de,squel[_0xa9f7('0xe')]()[_0xa9f7('0x33')](_0x30a7de)[_0xa9f7('0xf')](_0xd92a5f)[_0xa9f7('0x12')]('('+_0x2b6be5['join'](',')+_0xa9f7('0x51'),squel[_0xa9f7('0xe')]()[_0xa9f7('0x33')](_0x2b6be5)[_0xa9f7('0xf')](_0xa9f7('0x34'))['where'](_0xa9f7('0x40'),_0x40de3a)[_0xa9f7('0x12')]('deletedAt\x20IS\x20NULL'))[_0xa9f7('0x12')](_0xa9f7('0x52'),squel[_0xa9f7('0xe')]()['field'](_0xa9f7('0x53'),_0xa9f7('0x54'))[_0xa9f7('0xf')](_0xd92a5f)[_0xa9f7('0x55')](_0x2b6be5[_0xa9f7('0x10')](','))))[_0xa9f7('0x3a')]();}function handleStop(){logger[_0xa9f7('0x56')](_0xa9f7('0x57'));stopped=!![];}function handleUncaughtException(_0x4803e0){logger['error'](_0x4803e0[_0xa9f7('0x58')]);process[_0xa9f7('0x59')](0x1);}function handleError(_0x1f135e,_0x3ad5eb){stats[_0xa9f7('0x5a')][_0xa9f7('0x19')]({'name':_0x3ad5eb[_0xa9f7('0x5b')],'message':_0x3ad5eb[_0xa9f7('0x58')],'row':_0x1f135e});}function handleQuery(_0x561935){logger[_0xa9f7('0x56')](_0x561935);return db[_0xa9f7('0x5c')]['query'](_0x561935)[_0xa9f7('0x5d')](function(_0x9f9edd){results[_0xa9f7('0x19')](_0x9f9edd);})['catch'](function(_0x9ec13){logger[_0xa9f7('0x5e')](_0x9ec13[_0xa9f7('0x58')]);});}function updateTzCampaigns(_0x1eb569){return new Promise(function(_0x6ad324,_0x144e92){var _0x38bf87=squel['select']()[_0xa9f7('0x33')]([_0xa9f7('0x5f'),_0xa9f7('0x60')])['from'](_0xa9f7('0x61'))[_0xa9f7('0x10')](_0xa9f7('0x62'),null,_0xa9f7('0x63'))['where'](_0xa9f7('0x64')+_0x1eb569);db[_0xa9f7('0x5c')][_0xa9f7('0x65')](_0x38bf87['toString']())[_0xa9f7('0x5d')](function(_0x28b64b){var _0x41f2cd=[];for(var _0xa67b5e=0x0;_0xa67b5e<_0x28b64b[_0xa9f7('0x1c')];_0xa67b5e++){_0x41f2cd['push'](getTimezoneData(_0x28b64b[_0xa67b5e],tmp_campaigns));}BPromise[_0xa9f7('0x1a')](_0x41f2cd)[_0xa9f7('0x18')](function(){_0x6ad324({'val':0x1});});})[_0xa9f7('0x66')](function(_0x5185ce){logger[_0xa9f7('0x5e')](_0x5185ce[_0xa9f7('0x58')]);_0x6ad324({'val':0x0});});});}function updateTzVoiceQueues(_0x31fa0b){return new Promise(function(_0x3e7e0a,_0xd66506){var _0x24ad65=squel[_0xa9f7('0xe')]()[_0xa9f7('0x33')]([_0xa9f7('0x67'),_0xa9f7('0x68')])['from'](_0xa9f7('0x69'))[_0xa9f7('0x10')]('voice_queues_has_cm_lists',null,_0xa9f7('0x6a'))[_0xa9f7('0x12')]('voice_queues_has_cm_lists.CmListId='+_0x31fa0b);db[_0xa9f7('0x5c')]['query'](_0x24ad65[_0xa9f7('0x3a')]())['spread'](function(_0x3edd05){var _0x416136=[];for(var _0x469064=0x0;_0x469064<_0x3edd05[_0xa9f7('0x1c')];_0x469064++){_0x416136[_0xa9f7('0x19')](getTimezoneData(_0x3edd05[_0x469064],tmp_voice_queues));}BPromise[_0xa9f7('0x1a')](_0x416136)[_0xa9f7('0x18')](function(){_0x3e7e0a({'val':0x1});});})[_0xa9f7('0x66')](function(_0x1cb531){logger['error'](_0x1cb531['message']);_0x3e7e0a({'val':0x0});});});}function getTimezoneData(_0x3eca63,_0x3215b2){return new Promise(function(_0x2592c2,_0x23d869){var _0x2f7d14=shared[_0xa9f7('0x6b')];var _0x383f9b=_0x2f7d14[_0x3eca63[_0xa9f7('0x6c')]];if(_[_0xa9f7('0x6d')](_0x383f9b)){_0x2592c2({'ret':0x1});}else{var _0x37a606=_0x383f9b[_0xa9f7('0x6e')];var _0x3aa3fb=squel[_0xa9f7('0x28')]()[_0xa9f7('0x3d')](_0x3215b2)['set']('id',_0x3eca63['id'])[_0xa9f7('0x6f')](_0xa9f7('0x70'),_0x37a606)[_0xa9f7('0x6f')](_0xa9f7('0x6c'),_0x3eca63[_0xa9f7('0x6c')])[_0xa9f7('0x3a')]();return db['sequelize'][_0xa9f7('0x65')](_0x3aa3fb)[_0xa9f7('0x5d')](function(_0x1c36d1){_0x2592c2({'ret':0x1});})['catch'](function(_0x4b1071){logger[_0xa9f7('0x5e')](_0x4b1071[_0xa9f7('0x58')]);_0x23d869({'ret':0x1});});}});}function handleTZQuery(_0x4f43da){logger[_0xa9f7('0x56')](_0x4f43da);return db[_0xa9f7('0x5c')]['query'](_0x4f43da)[_0xa9f7('0x5d')](function(_0x137bb4){})[_0xa9f7('0x66')](function(_0xba4b26){logger['error'](_0xba4b26['message']);});}function main(_0x51b6a7,_0x4aec8d,_0x2ff419,_0x49a99d){logger[_0xa9f7('0x56')](_0xa9f7('0x71'),_0x51b6a7,JSON['stringify'](_0x4aec8d));process['send']('start');var _0x457c48=_0x4aec8d[_0xa9f7('0x72')];var _0x4d00ae=_[_0xa9f7('0x73')](_0x457c48);var _0x61ab4a=_0x4aec8d[_0xa9f7('0x74')];var _0x46fcf9=path[_0xa9f7('0x10')](config['root'],_0xa9f7('0x75'),_0x61ab4a+_0xa9f7('0x76'));hasTZ=_[_0xa9f7('0x4f')](_0x457c48)[_0xa9f7('0x77')](_0xa9f7('0x6c'));var _0x1d4ac4=_[_0xa9f7('0x4f')](_0x457c48)[_0xa9f7('0x10')]();logger['info'](_0xa9f7('0x78'),_0x1d4ac4);db[_0xa9f7('0x79')]['findAll']({'raw':!![],'attributes':['id','name']})[_0xa9f7('0x18')](function(_0x419d56){for(var _0x7556bc=0x0;_0x7556bc<_0x419d56[_0xa9f7('0x1c')];_0x7556bc++){if(_0x419d56[_0x7556bc]['name']in _0x457c48){contactItemTypes[_0xa9f7('0x19')](_0x419d56[_0x7556bc]);delete _0x4d00ae[_0x419d56[_0x7556bc][_0xa9f7('0x7a')]];hasAdditionalPhones=!![];}for(var _0x2a68cf in _0x457c48){if(_0x419d56[_0x7556bc][_0xa9f7('0x7a')]+'_description'===_0x2a68cf){phoneDescriptions[_0xa9f7('0x19')]({'itemTypeId':_0x419d56[_0x7556bc]['id'],'description':_0x2a68cf});delete _0x4d00ae[_0x2a68cf];}}}if(hasAdditionalPhones)_0x4d00ae[_0xa9f7('0x17')]='';var _0x3b3188=_[_0xa9f7('0x4f')](_0x4d00ae)[_0xa9f7('0x10')]();logger[_0xa9f7('0x56')](_0xa9f7('0x78'),_0x3b3188);fs[_0xa9f7('0x7b')](_0x46fcf9,_0x3b3188+'\x0a');Papa['parse'](fs[_0xa9f7('0x7c')](_0x51b6a7),{'header':!![],'skipEmptyLines':!![],'step':function(_0x35a36c,_0x494244){try{for(var _0x1928de=0x0,_0x13956f=[];_0x1928de<_0x35a36c['data'][_0xa9f7('0x1c')];_0x1928de++){stats[_0xa9f7('0x7d')]+=0x1;if(_0x35a36c['errors'][_0x1928de]){handleError(_0x35a36c[_0xa9f7('0x7e')][_0x1928de],_0x35a36c['errors'][_0x1928de]);}else{var _0x4e136b=[];var _0x352fa0=[];var _0x1726bb={};for(var _0x16a75e in _0x457c48){let _0x1d3604=contactItemTypes['find'](_0x4216ad=>_0x4216ad[_0xa9f7('0x7a')]===_0x16a75e);let _0x382a16=contactItemTypes[_0xa9f7('0x7f')](_0x509026=>_0x509026[_0xa9f7('0x7a')]+_0xa9f7('0x80')===_0x16a75e);if(_[_0xa9f7('0x6d')](_0x1d3604)&&_['isNil'](_0x382a16)){if(_0x457c48[_0xa9f7('0x81')](_0x16a75e)){if(_0x35a36c[_0xa9f7('0x7e')][_0x1928de][_0x457c48[_0x16a75e]]){var _0x35eb5e=_['trim'](_0x35a36c[_0xa9f7('0x7e')][_0x1928de][_0x457c48[_0x16a75e]][_0xa9f7('0x82')](/"/g,'\x27'));switch(_0x16a75e){case _0xa9f7('0x2c'):var _0xd1e9be=moment(_0x35eb5e,_0xa9f7('0xd'),!![]);if(_0xd1e9be[_0xa9f7('0x83')]()){_0x13956f['push']('\x22'+_0x35eb5e+'\x22');}else{_0x4e136b['push'](_0xa9f7('0x84'));}break;case'priority':var _0x37d647=parseInt(_0x35eb5e);_0x35eb5e=_[_0xa9f7('0x85')](_0x37d647)||_0x37d647<0x0||_0x37d647>0x4?_0x49a99d?0x3:0x2:_0x37d647;_0x13956f[_0xa9f7('0x19')]('\x22'+_0x35eb5e+'\x22');break;case _0xa9f7('0x43'):var _0x2662f0=parseInt(_0x35eb5e);if(_['isNumber'](_0x2662f0)&&_[_0xa9f7('0x77')](_0x2ff419,_0x2662f0)){_0x13956f['push']('\x22'+_0x2662f0+'\x22');}else{_0x4e136b[_0xa9f7('0x19')](_0xa9f7('0x86'));}break;case _0xa9f7('0x87'):if(isEmail(_0x35eb5e)){_0x13956f[_0xa9f7('0x19')]('\x22'+_0x35eb5e+'\x22');}else{_0x4e136b[_0xa9f7('0x19')](_0xa9f7('0x88'));}break;case _0xa9f7('0x89'):var _0x47cc18=moment(_0x35eb5e,_0xa9f7('0x8a'),!![]);if(_0x47cc18[_0xa9f7('0x83')]()){_0x13956f[_0xa9f7('0x19')]('\x22'+_0x35eb5e+'\x22');}else{_0x4e136b['push'](_0xa9f7('0x8b'));}break;case _0xa9f7('0x6c'):var _0xe16f8b=shared['timezones'];var _0x1cb731=_0xe16f8b[_0x35eb5e];if(!_[_0xa9f7('0x6d')](_0x1cb731)){var _0x24cd2e=_0x1cb731[_0xa9f7('0x6e')];_0x13956f['push']('\x22'+_0x35eb5e+'\x22');_0x13956f[_0xa9f7('0x19')]('\x22'+_0x24cd2e+'\x22');}break;default:_0x13956f[_0xa9f7('0x19')]('\x22'+_0x35eb5e+'\x22');}}else{switch(_0x16a75e){case _0xa9f7('0x8c'):case _0xa9f7('0x2b'):_0x4e136b[_0xa9f7('0x19')](_0x16a75e+_0xa9f7('0x8d'));break;default:_0x13956f[_0xa9f7('0x19')]('\x22\x22');}}}}else{var _0x439c44='';if(!_[_0xa9f7('0x6d')](_0x1d3604)){if(!_0x1726bb[_0xa9f7('0x81')](_0x1d3604['id'])){if(!_[_0xa9f7('0x6d')](_0x35a36c[_0xa9f7('0x7e')][_0x1928de][_0x457c48[_0x16a75e]])){var _0x35eb5e=_[_0xa9f7('0x8e')](_0x35a36c['data'][_0x1928de][_0x457c48[_0x16a75e]][_0xa9f7('0x82')](/"/g,'\x27'));var _0x19678f=phoneDescriptions[_0xa9f7('0x7f')](_0x42877f=>_0x42877f['itemTypeId']===_0x1d3604['id']);if(!_[_0xa9f7('0x6d')](_0x19678f)){var _0x59033e=_[_0xa9f7('0x8e')](_0x35a36c[_0xa9f7('0x7e')][_0x1928de][_0x457c48[_0x19678f[_0xa9f7('0x8f')]]]['replace'](/"/g,'\x27'));if(!_['isNil'](_0x59033e))_0x35eb5e=_0x35eb5e+'§'+_0x59033e;}if(_0x439c44=='')_0x439c44=_0x35eb5e;else _0x439c44+='|'+_0x35eb5e;}_0x352fa0[_0xa9f7('0x19')](_0x1d3604['id']+':'+_0x439c44);_0x1726bb[_0x1d3604['id']]=0x1;}}}}if(hasAdditionalPhones){_0x13956f[_0xa9f7('0x19')]('\x22'+_0x352fa0['join'](';')+'\x22');}if(_0x4e136b[_0xa9f7('0x1c')]){handleError(_0x35a36c[_0xa9f7('0x7e')][_0x1928de],{'code':_0xa9f7('0x90'),'message':_0x4e136b[_0xa9f7('0x10')]()});}else{fs[_0xa9f7('0x91')](_0x46fcf9,_0x13956f[_0xa9f7('0x10')]()+'\x0a');}_0x13956f=[];}if(!(stats[_0xa9f7('0x7d')]%0xc8)){socket[_0xa9f7('0x92')](_0xa9f7('0x93')+_0x61ab4a,stats);stats[_0xa9f7('0x5a')]=[];}}if(stopped){logger['info']('Abort\x20parser');_0x494244[_0xa9f7('0x94')]();}}catch(_0x570a6c){handleError(_0x35a36c['data'][_0x1928de],{'code':_0xa9f7('0x95'),'message':_0x570a6c['message']});logger['error']('step',_0x570a6c[_0xa9f7('0x58')]);}},'complete':function(){try{var _0x2ccb5b=[];var _0x4f65b5=[];var _0x47502c=_0xa9f7('0x34');if(_0x4aec8d[_0xa9f7('0x96')]&&_0x4aec8d[_0xa9f7('0x96')]['length']){_0x47502c=_0xa9f7('0x97')+_0x61ab4a;_0x2ccb5b[_0xa9f7('0x19')](_0xa9f7('0x98')+_0x47502c+'\x20LIKE\x20cm_contacts;');}tmp_campaigns=_0xa9f7('0x99')+_0x61ab4a;tmp_voice_queues=_0xa9f7('0x9a')+_0x61ab4a;_0x4f65b5[_0xa9f7('0x19')](_0xa9f7('0x98')+tmp_campaigns+_0xa9f7('0x9b'));_0x4f65b5['push'](_0xa9f7('0x98')+tmp_voice_queues+_0xa9f7('0x9b'));BPromise[_0xa9f7('0x9c')](_0x4f65b5,handleTZQuery)['then'](function(_0xf47528){updateTzCampaigns(_0x4aec8d[_0xa9f7('0x2e')])['then'](function(_0x461da3){updateTzVoiceQueues(_0x4aec8d[_0xa9f7('0x2e')])[_0xa9f7('0x18')](function(_0x24793e){if(hasTZ)_0x3b3188=_0x3b3188[_0xa9f7('0x82')]('dialTimezone',_0xa9f7('0x9d'));var _0x280070=util['format'](_0xa9f7('0x9e'),_0x46fcf9,_0x47502c,_0x3b3188,_0x4aec8d[_0xa9f7('0x2e')],_0x4aec8d[_0xa9f7('0x50')]||null,NOW,NOW);if(_[_0xa9f7('0x6d')](_0x457c48[_0xa9f7('0x2c')])){_0x280070+=_0xa9f7('0x9f');}_0x2ccb5b[_0xa9f7('0x19')](_0x280070);if(_0x4aec8d[_0xa9f7('0x96')]&&_0x4aec8d[_0xa9f7('0x96')]['length']){_0x2ccb5b[_0xa9f7('0x19')](insertCmContact(_0x4aec8d[_0xa9f7('0x2e')],_0x47502c,_0x4aec8d[_0xa9f7('0x96')],_0x457c48));_0x2ccb5b[_0xa9f7('0x19')]('DROP\x20TABLE\x20'+_0x47502c+';');}BPromise[_0xa9f7('0x9c')](_0x2ccb5b,handleQuery)['then'](function(_0x1d945a){BPromise[_0xa9f7('0x1a')]([handleAdditionalPhones()])[_0xa9f7('0x18')](function(){_0x2ccb5b=[];for(var _0x45a770=0x0;_0x45a770\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName','ListId\x20is\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','bluebird','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/environment/shared','../../../config/logger','import','defaults','redis','localhost','YYYY-MM-DD\x20HH:mm:ss','format','select','field','phone','from','\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','join','CmContact','findAll','then','push','all','AdditionalPhones','split','length','isNil','filter','CmContactHasItem'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x523c,0x96));var _0xc523=function(_0x4aee27,_0x33e880){_0x4aee27=_0x4aee27-0x0;var _0x33b597=_0x523c[_0x4aee27];return _0x33b597;};'use strict';var fs=require('fs');var path=require(_0xc523('0x0'));var _=require(_0xc523('0x1'));var Papa=require(_0xc523('0x2'));var util=require('util');var BPromise=require(_0xc523('0x3'));var moment=require('moment');var squel=require(_0xc523('0x4'));var Redis=require(_0xc523('0x5'));var db=require(_0xc523('0x6'))['db'];var config=require(_0xc523('0x7'));var shared=require(_0xc523('0x8'));var logger=require(_0xc523('0x9'))(_0xc523('0xa'));config['redis']=_[_0xc523('0xb')](config[_0xc523('0xc')],{'host':_0xc523('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc523('0xc')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()['format'](_0xc523('0xe'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0xc523('0xf')]('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x4ea220){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0x4ea220);}function selectNotIn(_0x55e7a2,_0x55e23e,_0x3eff43,_0x54cbcb,_0x3bc90a){return squel[_0xc523('0x10')]()[_0xc523('0x11')](_0xc523('0x12'))[_0xc523('0x13')](_0x54cbcb)['join'](_0x55e23e,null,_0x55e23e+'.id\x20=\x20'+_0x54cbcb+'.'+_0x3eff43)['where'](_0x54cbcb+'.'+_0x3eff43+_0xc523('0x14')+_0x55e7a2+'.'+_0x3eff43)[_0xc523('0x15')](_0x55e23e+_0xc523('0x16')+_0x3bc90a[_0xc523('0x17')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x484f7b,_0x17e1e3){promisesAdditionalPhones=[];return db[_0xc523('0x18')][_0xc523('0x19')]({'raw':!![],'attributes':['id','AdditionalPhones'],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0xc523('0x1a')](function(_0x2ed171){if(_0x2ed171!==null){var _0x9e1c81=[];for(var _0x5f75f4=0x0;_0x5f75f4<_0x2ed171['length'];_0x5f75f4++){var _0x178749=_0x2ed171[_0x5f75f4];_0x9e1c81[_0xc523('0x1b')](insertAdditionalPhones(_0x178749));}}Promise[_0xc523('0x1c')](_0x9e1c81)[_0xc523('0x1a')](function(){_0x484f7b({'val':0x1});});});});}function insertAdditionalPhones(_0x5238a0){return new Promise(function(_0x335dc2,_0x2b78f6){var _0x4fe827=_0x5238a0[_0xc523('0x1d')];var _0x51e732=_0x4fe827[_0xc523('0x1e')](';');var _0x1a498f=[];orderBy=0x0;for(var _0x4e3ffd=0x0;_0x4e3ffd<_0x51e732[_0xc523('0x1f')];_0x4e3ffd++){_0x1a498f[_0xc523('0x1b')](splitAdditionalPhone(_0x5238a0['id'],_0x51e732[_0x4e3ffd]));}Promise[_0xc523('0x1c')](_0x1a498f)[_0xc523('0x1a')](function(){_0x335dc2({'val':_0x51e732[_0xc523('0x1f')]});});});}function splitAdditionalPhone(_0x247b30,_0x2485a9){return new Promise(function(_0x1bcd9e,_0x1dad56){var _0x35b30e=_0x2485a9[_0xc523('0x1e')](':');var _0x1fd6f6=_0x35b30e[0x0];var _0x736628=_0x35b30e[0x1];if(!_[_0xc523('0x20')](_0x736628)){var _0x28d19b=_0x736628[_0xc523('0x1e')]('|');var _0x3a90b3=[];for(var _0x5f3712=0x0;_0x5f3712<_0x28d19b[_0xc523('0x1f')];_0x5f3712++){if(_0x28d19b[_0x5f3712]!==''){var _0x2b6d37=_[_0xc523('0x21')](promisesAdditionalPhones,{'contactId':_0x247b30,'phone':_0x28d19b[_0x5f3712]});if(_0x2b6d37[_0xc523('0x1f')]==0x0){orderBy++;promisesAdditionalPhones[_0xc523('0x1b')]({'contactId':_0x247b30,'contactTypeId':_0x1fd6f6,'phone':_0x28d19b[_0x5f3712],'orderBy':orderBy});}}}_0x1bcd9e({'ok':0x1});}else _0x1bcd9e({'res':0x0});});}function createAdditionalPhone(_0x50b099,_0x23eafb,_0x3d1064,_0x11f6f4){var _0x346357='';var _0x36cc78='';var _0x4c5f09=_0x3d1064[_0xc523('0x1e')]('§');_0x346357=_0x4c5f09[0x0];if(_0x4c5f09[_0xc523('0x1f')]==0x2)_0x36cc78=_0x4c5f09[0x1];return new Promise(function(_0x12d280,_0x58fb53){return db[_0xc523('0x22')][_0xc523('0x23')]({'where':{'CmContactId':_0x50b099,'item':_0x346357}})[_0xc523('0x1a')](function(_0x6aeaaa){if(_0x6aeaaa){return db[_0xc523('0x22')][_0xc523('0x24')]({'ItemTypeId':_0x23eafb,'description':_0x36cc78,'OrderBy':_0x11f6f4},{'where':{'CmContactId':_0x50b099,'item':_0x346357}})['then'](function(_0x761f4){_0x12d280({'res':_0xc523('0x25')});});}else{return db['CmContactHasItem'][_0xc523('0x26')]({'CmContactId':_0x50b099,'item':_0x346357,'description':_0x36cc78,'ItemTypeId':_0x23eafb,'OrderBy':_0x11f6f4,'ItemClass':_0xc523('0x27')})[_0xc523('0x1a')](function(_0x3d4895){_0x12d280({'res':'inserted'});});}});});}function insertCmHopper(_0xcfcd58,_0x5eb93d,_0x434786,_0x3e6dca,_0x3c9cf9){var _0x3cf05d=['cm_contacts.phone',_0xc523('0x28'),_0xc523('0x29'),'cm_contacts.ListId',_0x5eb93d+'.'+_0x3e6dca,_0xc523('0x2a'),_0xc523('0x2b'),_0xc523('0x2c'),'cm_contacts.UserId','\x22'+_0x3c9cf9+'\x22'];return squel['insert']()[_0xc523('0x2d')](_0xc523('0x2e'))['fromQuery']([_0xc523('0x12'),'scheduledat',_0xc523('0x2f'),_0xc523('0x30'),_0x3e6dca,_0xc523('0x31'),_0xc523('0x32'),_0xc523('0x33'),_0xc523('0x34'),_0xc523('0x35')],squel[_0xc523('0x10')]()[_0xc523('0x36')](_0x3cf05d)[_0xc523('0x13')](_0x5eb93d)[_0xc523('0x17')](_0xc523('0x37'),null,_0xc523('0x38')+_0x5eb93d+_0xc523('0x39'))['join'](_0x434786,null,_0x434786+_0xc523('0x3a')+_0x5eb93d+'.'+_0x3e6dca)['where'](_0x5eb93d+_0xc523('0x3b'),_0xcfcd58)[_0xc523('0x15')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xc523('0x15')](_0xc523('0x3c'),selectNotIn(_0x5eb93d,_0x434786,_0x3e6dca,'cm_hopper',[_0xc523('0x3d'),'\x22onlyIfOpen\x22']))[_0xc523('0x15')](_0xc523('0x3c'),selectNotIn(_0x5eb93d,_0x434786,_0x3e6dca,_0xc523('0x2e'),[_0xc523('0x3d')])))[_0xc523('0x3e')]();}function insertCmHopperBlack(_0x21817a,_0x5654d0,_0x4e58fc,_0x19b76b){var _0x387315=[_0xc523('0x3f'),_0xc523('0x29'),_0xc523('0x40'),_0x5654d0+'.'+_0x19b76b,_0xc523('0x2a'),'cm_contacts.updatedAt'];return squel[_0xc523('0x41')]()[_0xc523('0x2d')]('cm_hopper_black')['fromQuery']([_0xc523('0x12'),_0xc523('0x2f'),_0xc523('0x30'),_0x19b76b,_0xc523('0x31'),_0xc523('0x32')],squel[_0xc523('0x10')]()['fields'](_0x387315)['from'](_0x5654d0)['join']('cm_contacts',null,_0xc523('0x38')+_0x5654d0+_0xc523('0x39'))['join'](_0x4e58fc,null,_0x4e58fc+_0xc523('0x3a')+_0x5654d0+'.'+_0x19b76b)[_0xc523('0x15')](_0x5654d0+'.CmListId\x20=\x20?',_0x21817a)[_0xc523('0x15')](_0xc523('0x42'),NOW)[_0xc523('0x15')](_0xc523('0x3c'),squel[_0xc523('0x10')]()[_0xc523('0x11')]('phone')['from'](_0xc523('0x43'))[_0xc523('0x15')](_0xc523('0x44'),_0x21817a)['where'](_0x19b76b+_0xc523('0x14')+_0x5654d0+'.'+_0x19b76b)))['toString']();}function insertTzCmHopper(_0x4f438e,_0x421736,_0x1f7b1f,_0x2a1722,_0x2490af,_0x16b2b4){var _0x3925fa=[_0xc523('0x3f'),_0xc523('0x45')+_0x16b2b4+'.offset-cm_contacts.utcOffset\x20minute)','cm_contacts.id','cm_contacts.ListId',_0x421736+'.'+_0x2a1722,_0xc523('0x2a'),_0xc523('0x2b'),_0xc523('0x2c'),_0xc523('0x46'),'\x22'+_0x2490af+'\x22'];var _0x430fde=squel[_0xc523('0x41')]()[_0xc523('0x2d')](_0xc523('0x2e'))[_0xc523('0x47')](['phone',_0xc523('0x48'),_0xc523('0x2f'),_0xc523('0x30'),_0x2a1722,'createdAt',_0xc523('0x32'),_0xc523('0x33'),_0xc523('0x34'),_0xc523('0x35')],squel[_0xc523('0x10')]()['fields'](_0x3925fa)[_0xc523('0x13')](_0x421736)['join']('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x421736+_0xc523('0x39'))[_0xc523('0x17')](_0x1f7b1f,null,_0x1f7b1f+_0xc523('0x3a')+_0x421736+'.'+_0x2a1722)[_0xc523('0x17')](_0x16b2b4,null,_0x16b2b4+_0xc523('0x3a')+_0x421736+'.'+_0x2a1722)[_0xc523('0x15')](_0x421736+_0xc523('0x3b'),_0x4f438e)[_0xc523('0x15')](_0xc523('0x42'),NOW)[_0xc523('0x15')](_0xc523('0x3c'),selectNotIn(_0x421736,_0x1f7b1f,_0x2a1722,_0xc523('0x2e'),[_0xc523('0x3d'),'\x22onlyIfOpen\x22']))[_0xc523('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x421736,_0x1f7b1f,_0x2a1722,_0xc523('0x2e'),['\x22always\x22'])))[_0xc523('0x3e')]();return _0x430fde;}function insertTzCmHopperBlack(_0x4a3b5b,_0x175ade,_0x4669fe,_0x3601ae){var _0x2c84ad=[_0xc523('0x3f'),'cm_contacts.id',_0xc523('0x40'),_0x175ade+'.'+_0x3601ae,_0xc523('0x2a'),'cm_contacts.updatedAt'];return squel[_0xc523('0x41')]()[_0xc523('0x2d')](_0xc523('0x43'))[_0xc523('0x47')]([_0xc523('0x12'),'ContactId',_0xc523('0x30'),_0x3601ae,_0xc523('0x31'),_0xc523('0x32')],squel[_0xc523('0x10')]()[_0xc523('0x36')](_0x2c84ad)[_0xc523('0x13')](_0x175ade)[_0xc523('0x17')](_0xc523('0x37'),null,_0xc523('0x38')+_0x175ade+_0xc523('0x39'))[_0xc523('0x17')](_0x4669fe,null,_0x4669fe+_0xc523('0x3a')+_0x175ade+'.'+_0x3601ae)[_0xc523('0x15')](_0x175ade+_0xc523('0x3b'),_0x4a3b5b)[_0xc523('0x15')](_0xc523('0x42'),NOW)[_0xc523('0x15')](_0xc523('0x3c'),squel[_0xc523('0x10')]()['field']('phone')[_0xc523('0x13')](_0xc523('0x43'))[_0xc523('0x15')](_0xc523('0x44'),_0x4a3b5b)[_0xc523('0x15')](_0x3601ae+'\x20=\x20'+_0x175ade+'.'+_0x3601ae)))[_0xc523('0x3e')]();}function insertCmHopperAdditionalPhones(_0x505a27){var _0x2e635b=[_0xc523('0x49'),_0xc523('0x4a'),'cm_contact_has_items.OrderBy',_0xc523('0x4b'),'cm_contact_has_items.updatedAt'];return squel[_0xc523('0x41')]()[_0xc523('0x2d')]('cm_hopper_additional_phones')[_0xc523('0x47')]([_0xc523('0x4c'),_0xc523('0x12'),_0xc523('0x4d'),'createdAt',_0xc523('0x32')],squel['select']()['fields'](_0x2e635b)[_0xc523('0x13')](_0xc523('0x2e'))['join'](_0xc523('0x37'),null,_0xc523('0x4e'))[_0xc523('0x17')](_0xc523('0x4f'),null,_0xc523('0x50'))[_0xc523('0x15')](_0xc523('0x51'),_0x505a27)['where'](_0xc523('0x42'),NOW))['toString']();}function insertCmContact(_0x2daba7,_0x505138,_0x830ebf,_0x3cec87){var _0x567da2=_[_0xc523('0x52')](_[_0xc523('0x53')](_0x3cec87),[_0xc523('0x30'),_0xc523('0x54'),'createdAt','updatedAt',_0xc523('0x55')]);return squel[_0xc523('0x41')]()[_0xc523('0x2d')]('cm_contacts')[_0xc523('0x47')](_0x567da2,squel[_0xc523('0x10')]()[_0xc523('0x36')](_0x567da2)['from'](_0x505138)[_0xc523('0x15')]('('+_0x830ebf['join'](',')+_0xc523('0x56'),squel['select']()[_0xc523('0x36')](_0x830ebf)[_0xc523('0x13')]('cm_contacts')[_0xc523('0x15')](_0xc523('0x44'),_0x2daba7)[_0xc523('0x15')](_0xc523('0x57')))[_0xc523('0x15')](_0xc523('0x58'),squel[_0xc523('0x10')]()[_0xc523('0x11')](_0xc523('0x59'),_0xc523('0x5a'))[_0xc523('0x13')](_0x505138)[_0xc523('0x5b')](_0x830ebf['join'](','))))['toString']();}function handleStop(){logger['info'](_0xc523('0x5c'));stopped=!![];}function handleUncaughtException(_0x25b71d){logger[_0xc523('0x5d')](_0x25b71d['message']);process['exit'](0x1);}function handleError(_0x35156c,_0x1e2ee0){stats['errors'][_0xc523('0x1b')]({'name':_0x1e2ee0['code'],'message':_0x1e2ee0['message'],'row':_0x35156c});}function handleQuery(_0x545bae){logger[_0xc523('0x5e')](_0x545bae);return db[_0xc523('0x5f')][_0xc523('0x60')](_0x545bae)[_0xc523('0x61')](function(_0x4a5d56){results[_0xc523('0x1b')](_0x4a5d56);})[_0xc523('0x62')](function(_0xb01e39){logger['error'](_0xb01e39['message']);});}function updateTzCampaigns(_0x1474ed){return new Promise(function(_0x152f41,_0x2e2047){var _0xa7d812=squel[_0xc523('0x10')]()[_0xc523('0x36')]([_0xc523('0x63'),_0xc523('0x64')])[_0xc523('0x13')](_0xc523('0x65'))[_0xc523('0x17')](_0xc523('0x66'),null,_0xc523('0x67'))[_0xc523('0x15')](_0xc523('0x68')+_0x1474ed);db[_0xc523('0x5f')]['query'](_0xa7d812['toString']())[_0xc523('0x61')](function(_0x18994c){var _0x4839d5=[];for(var _0x357949=0x0;_0x357949<_0x18994c[_0xc523('0x1f')];_0x357949++){_0x4839d5[_0xc523('0x1b')](getTimezoneData(_0x18994c[_0x357949],tmp_campaigns));}BPromise[_0xc523('0x1c')](_0x4839d5)['then'](function(){_0x152f41({'val':0x1});});})[_0xc523('0x62')](function(_0x5335c5){logger[_0xc523('0x5d')](_0x5335c5['message']);_0x152f41({'val':0x0});});});}function updateTzVoiceQueues(_0x48435e){return new Promise(function(_0x3e50cd,_0x54b3c6){var _0x3f0706=squel[_0xc523('0x10')]()[_0xc523('0x36')]([_0xc523('0x69'),_0xc523('0x6a')])[_0xc523('0x13')](_0xc523('0x6b'))[_0xc523('0x17')](_0xc523('0x6c'),null,'voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId')['where']('voice_queues_has_cm_lists.CmListId='+_0x48435e);db['sequelize'][_0xc523('0x60')](_0x3f0706[_0xc523('0x3e')]())[_0xc523('0x61')](function(_0x5e1fe0){var _0x3259dc=[];for(var _0x34c7f1=0x0;_0x34c7f1<_0x5e1fe0[_0xc523('0x1f')];_0x34c7f1++){_0x3259dc['push'](getTimezoneData(_0x5e1fe0[_0x34c7f1],tmp_voice_queues));}BPromise[_0xc523('0x1c')](_0x3259dc)[_0xc523('0x1a')](function(){_0x3e50cd({'val':0x1});});})[_0xc523('0x62')](function(_0x2c6d4f){logger['error'](_0x2c6d4f[_0xc523('0x6d')]);_0x3e50cd({'val':0x0});});});}function getTimezoneData(_0x214f23,_0x11e680){return new Promise(function(_0x196536,_0x291566){var _0x480d83=shared[_0xc523('0x6e')];var _0x54aba1=_0x480d83[_0x214f23[_0xc523('0x6f')]];if(_[_0xc523('0x20')](_0x54aba1)){_0x196536({'ret':0x1});}else{var _0x529999=_0x54aba1[_0xc523('0x70')];var _0x1d0a08=squel[_0xc523('0x41')]()[_0xc523('0x2d')](_0x11e680)[_0xc523('0x71')]('id',_0x214f23['id'])[_0xc523('0x71')]('offset',_0x529999)[_0xc523('0x71')](_0xc523('0x6f'),_0x214f23['dialTimezone'])['toString']();return db[_0xc523('0x5f')][_0xc523('0x60')](_0x1d0a08)['spread'](function(_0x45f3c9){_0x196536({'ret':0x1});})[_0xc523('0x62')](function(_0x41d7c5){logger[_0xc523('0x5d')](_0x41d7c5[_0xc523('0x6d')]);_0x291566({'ret':0x1});});}});}function handleTZQuery(_0x54c6db){logger[_0xc523('0x5e')](_0x54c6db);return db[_0xc523('0x5f')][_0xc523('0x60')](_0x54c6db)['spread'](function(_0xf90042){})[_0xc523('0x62')](function(_0x2a2fb5){logger[_0xc523('0x5d')](_0x2a2fb5[_0xc523('0x6d')]);});}function main(_0x182cd6,_0x7ba2c8,_0x5e3138,_0x2ecc55){logger[_0xc523('0x5e')]('main',_0x182cd6,JSON[_0xc523('0x72')](_0x7ba2c8));process[_0xc523('0x73')](_0xc523('0x74'));var _0x6c1bf8=_0x7ba2c8[_0xc523('0x75')];var _0x44a798=_[_0xc523('0x76')](_0x6c1bf8);var _0x11a48b=_0x7ba2c8[_0xc523('0x77')];var _0x3da7bf=path[_0xc523('0x17')](config[_0xc523('0x78')],_0xc523('0x79'),_0x11a48b+_0xc523('0x7a'));hasTZ=_[_0xc523('0x53')](_0x6c1bf8)[_0xc523('0x7b')]('dialTimezone');var _0x2daa6e=_[_0xc523('0x53')](_0x6c1bf8)[_0xc523('0x17')]();logger[_0xc523('0x5e')](_0xc523('0x7c'),_0x2daa6e);db[_0xc523('0x7d')][_0xc523('0x19')]({'raw':!![],'attributes':['id',_0xc523('0x7e')]})[_0xc523('0x1a')](function(_0x18bc0c){for(var _0x209912=0x0;_0x209912<_0x18bc0c['length'];_0x209912++){if(_0x18bc0c[_0x209912]['name']in _0x6c1bf8){contactItemTypes[_0xc523('0x1b')](_0x18bc0c[_0x209912]);delete _0x44a798[_0x18bc0c[_0x209912][_0xc523('0x7e')]];hasAdditionalPhones=!![];}for(var _0x5e667c in _0x6c1bf8){if(_0x18bc0c[_0x209912][_0xc523('0x7e')]+'_description'===_0x5e667c){phoneDescriptions[_0xc523('0x1b')]({'itemTypeId':_0x18bc0c[_0x209912]['id'],'description':_0x5e667c});delete _0x44a798[_0x5e667c];}}}if(hasAdditionalPhones)_0x44a798['AdditionalPhones']='';var _0x5c0883=_[_0xc523('0x53')](_0x44a798)[_0xc523('0x17')]();logger[_0xc523('0x5e')](_0xc523('0x7c'),_0x5c0883);fs[_0xc523('0x7f')](_0x3da7bf,_0x5c0883+'\x0a');Papa[_0xc523('0x80')](fs[_0xc523('0x81')](_0x182cd6),{'header':!![],'skipEmptyLines':!![],'step':function(_0x115a3f,_0x54569c){try{for(var _0x488fcd=0x0,_0x3fd7df=[];_0x488fcd<_0x115a3f[_0xc523('0x82')]['length'];_0x488fcd++){stats[_0xc523('0x83')]+=0x1;if(_0x115a3f['errors'][_0x488fcd]){handleError(_0x115a3f['data'][_0x488fcd],_0x115a3f['errors'][_0x488fcd]);}else{var _0x375f7a=[];var _0x36ea03=[];var _0x525abc={};for(var _0x47e198 in _0x6c1bf8){let _0x3e690c=contactItemTypes[_0xc523('0x84')](_0x56829e=>_0x56829e['name']===_0x47e198);let _0x5e4d46=contactItemTypes['find'](_0x1c3343=>_0x1c3343[_0xc523('0x7e')]+'_description'===_0x47e198);if(_['isNil'](_0x3e690c)&&_['isNil'](_0x5e4d46)){if(_0x6c1bf8[_0xc523('0x85')](_0x47e198)){if(_0x115a3f[_0xc523('0x82')][_0x488fcd][_0x6c1bf8[_0x47e198]]){var _0x4ef80c=_[_0xc523('0x86')](_0x115a3f[_0xc523('0x82')][_0x488fcd][_0x6c1bf8[_0x47e198]][_0xc523('0x87')](/"/g,'\x27'));switch(_0x47e198){case _0xc523('0x48'):var _0x5d91e5=moment(_0x4ef80c,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x5d91e5['isValid']()){_0x3fd7df['push']('\x22'+_0x4ef80c+'\x22');}else{_0x375f7a['push'](_0xc523('0x88'));}break;case _0xc523('0x33'):var _0x4e6770=parseInt(_0x4ef80c);_0x4ef80c=_[_0xc523('0x89')](_0x4e6770)||_0x4e6770<0x0||_0x4e6770>0x4?_0x2ecc55?0x3:0x2:_0x4e6770;_0x3fd7df['push']('\x22'+_0x4ef80c+'\x22');break;case'UserId':var _0x4b0ef2=parseInt(_0x4ef80c);if(_[_0xc523('0x8a')](_0x4b0ef2)&&_[_0xc523('0x7b')](_0x5e3138,_0x4b0ef2)){_0x3fd7df[_0xc523('0x1b')]('\x22'+_0x4b0ef2+'\x22');}else{_0x375f7a[_0xc523('0x1b')]('agent\x20not\x20exists');}break;case'email':if(isEmail(_0x4ef80c)){_0x3fd7df[_0xc523('0x1b')]('\x22'+_0x4ef80c+'\x22');}else{_0x375f7a['push'](_0xc523('0x8b'));}break;case _0xc523('0x8c'):var _0x35e693=moment(_0x4ef80c,_0xc523('0x8d'),!![]);if(_0x35e693['isValid']()){_0x3fd7df[_0xc523('0x1b')]('\x22'+_0x4ef80c+'\x22');}else{_0x375f7a[_0xc523('0x1b')](_0xc523('0x8e'));}break;case'dialTimezone':var _0x1a8b64=shared[_0xc523('0x6e')];var _0x3cf694=_0x1a8b64[_0x4ef80c];if(!_[_0xc523('0x20')](_0x3cf694)){var _0x532f8f=_0x3cf694[_0xc523('0x70')];_0x3fd7df[_0xc523('0x1b')]('\x22'+_0x4ef80c+'\x22');_0x3fd7df[_0xc523('0x1b')]('\x22'+_0x532f8f+'\x22');}break;default:_0x3fd7df[_0xc523('0x1b')]('\x22'+_0x4ef80c+'\x22');}}else{switch(_0x47e198){case'firstName':case _0xc523('0x12'):_0x375f7a[_0xc523('0x1b')](_0x47e198+_0xc523('0x8f'));break;default:_0x3fd7df[_0xc523('0x1b')]('\x22\x22');}}}}else{var _0x1c461c='';if(!_[_0xc523('0x20')](_0x3e690c)){if(!_0x525abc[_0xc523('0x85')](_0x3e690c['id'])){if(!_[_0xc523('0x20')](_0x115a3f[_0xc523('0x82')][_0x488fcd][_0x6c1bf8[_0x47e198]])){var _0x4ef80c=_[_0xc523('0x86')](_0x115a3f[_0xc523('0x82')][_0x488fcd][_0x6c1bf8[_0x47e198]][_0xc523('0x87')](/"/g,'\x27'));var _0x59ca21=phoneDescriptions[_0xc523('0x84')](_0x5860f7=>_0x5860f7[_0xc523('0x90')]===_0x3e690c['id']);if(!_[_0xc523('0x20')](_0x59ca21)){var _0x475aa6=_[_0xc523('0x86')](_0x115a3f[_0xc523('0x82')][_0x488fcd][_0x6c1bf8[_0x59ca21[_0xc523('0x91')]]]['replace'](/"/g,'\x27'));if(!_['isNil'](_0x475aa6))_0x4ef80c=_0x4ef80c+'§'+_0x475aa6;}if(_0x1c461c=='')_0x1c461c=_0x4ef80c;else _0x1c461c+='|'+_0x4ef80c;}_0x36ea03[_0xc523('0x1b')](_0x3e690c['id']+':'+_0x1c461c);_0x525abc[_0x3e690c['id']]=0x1;}}}}if(hasAdditionalPhones){_0x3fd7df[_0xc523('0x1b')]('\x22'+_0x36ea03[_0xc523('0x17')](';')+'\x22');}if(_0x375f7a[_0xc523('0x1f')]){handleError(_0x115a3f[_0xc523('0x82')][_0x488fcd],{'code':_0xc523('0x92'),'message':_0x375f7a[_0xc523('0x17')]()});}else{fs[_0xc523('0x93')](_0x3da7bf,_0x3fd7df['join']()+'\x0a');}_0x3fd7df=[];}if(!(stats[_0xc523('0x83')]%0xc8)){socket[_0xc523('0x94')](_0xc523('0x95')+_0x11a48b,stats);stats[_0xc523('0x96')]=[];}}if(stopped){logger[_0xc523('0x5e')]('Abort\x20parser');_0x54569c['abort']();}}catch(_0x399c21){handleError(_0x115a3f[_0xc523('0x82')][_0x488fcd],{'code':_0xc523('0x97'),'message':_0x399c21[_0xc523('0x6d')]});logger[_0xc523('0x5d')](_0xc523('0x98'),_0x399c21[_0xc523('0x6d')]);}},'complete':function(){try{var _0x84c50f=[];var _0x5ae057=[];var _0x47308f='cm_contacts';if(_0x7ba2c8[_0xc523('0x99')]&&_0x7ba2c8[_0xc523('0x99')][_0xc523('0x1f')]){_0x47308f='cm_contacts_'+_0x11a48b;_0x84c50f[_0xc523('0x1b')](_0xc523('0x9a')+_0x47308f+_0xc523('0x9b'));}tmp_campaigns='campaigns_'+_0x11a48b;tmp_voice_queues=_0xc523('0x9c')+_0x11a48b;_0x5ae057[_0xc523('0x1b')]('CREATE\x20TABLE\x20'+tmp_campaigns+_0xc523('0x9d'));_0x5ae057[_0xc523('0x1b')](_0xc523('0x9a')+tmp_voice_queues+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');BPromise[_0xc523('0x9e')](_0x5ae057,handleTZQuery)[_0xc523('0x1a')](function(_0x2b4e20){updateTzCampaigns(_0x7ba2c8[_0xc523('0x30')])[_0xc523('0x1a')](function(_0x534b2c){updateTzVoiceQueues(_0x7ba2c8[_0xc523('0x30')])[_0xc523('0x1a')](function(_0x52a4b2){if(hasTZ)_0x5c0883=_0x5c0883[_0xc523('0x87')](_0xc523('0x6f'),_0xc523('0x9f'));var _0x40f745=util[_0xc523('0xf')](_0xc523('0xa0'),_0x3da7bf,_0x47308f,_0x5c0883,_0x7ba2c8['ListId'],_0x7ba2c8[_0xc523('0x54')]||null,NOW,NOW);if(_[_0xc523('0x20')](_0x6c1bf8[_0xc523('0x48')])){_0x40f745+=_0xc523('0xa1');}_0x84c50f['push'](_0x40f745);if(_0x7ba2c8[_0xc523('0x99')]&&_0x7ba2c8[_0xc523('0x99')][_0xc523('0x1f')]){_0x84c50f[_0xc523('0x1b')](insertCmContact(_0x7ba2c8[_0xc523('0x30')],_0x47308f,_0x7ba2c8[_0xc523('0x99')],_0x6c1bf8));_0x84c50f[_0xc523('0x1b')](_0xc523('0xa2')+_0x47308f+';');}BPromise[_0xc523('0x9e')](_0x84c50f,handleQuery)['then'](function(_0x5aa453){BPromise[_0xc523('0x1c')]([handleAdditionalPhones()])['then'](function(){_0x84c50f=[];for(var _0x2d9cfb=0x0;_0x2d9cfb\x20\x20','existsSync'];(function(_0x2b48ac,_0x29442a){var _0x20ab20=function(_0x3c19ee){while(--_0x3c19ee){_0x2b48ac['push'](_0x2b48ac['shift']());}};_0x20ab20(++_0x29442a);}(_0x110f,0x1e6));var _0xf110=function(_0x42f693,_0x221ee5){_0x42f693=_0x42f693-0x0;var _0x4414b1=_0x110f[_0x42f693];return _0x4414b1;};'use strict';var fs=require('fs');var path=require(_0xf110('0x0'));var _=require(_0xf110('0x1'));var Papa=require('papaparse');var util=require('util');var BPromise=require('bluebird');var moment=require(_0xf110('0x2'));var squel=require('squel');var Redis=require(_0xf110('0x3'));var db=require(_0xf110('0x4'))['db'];var config=require(_0xf110('0x5'));var logger=require('../../../config/logger')(_0xf110('0x6'));config[_0xf110('0x7')]=_[_0xf110('0x8')](config['redis'],{'host':_0xf110('0x9'),'port':0x18eb});var socket=require(_0xf110('0xa'))(new Redis(config[_0xf110('0x7')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()['format'](_0xf110('0xb'));var tempTableName=_0xf110('0xc')+moment()[_0xf110('0xd')]('YYYYMMDDHHmmss');var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x13e06b){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))*$/[_0xf110('0xe')](_0x13e06b);}function selectNotIn(_0x17a94a,_0x24ada7,_0x4fc7b9,_0x35e191,_0x13ced0){return squel['select']()[_0xf110('0xf')](_0xf110('0x10'))[_0xf110('0x11')](_0x35e191)[_0xf110('0x12')](_0x24ada7,null,_0x24ada7+'.id\x20=\x20'+_0x35e191+'.'+_0x4fc7b9)[_0xf110('0x13')](_0x35e191+'.'+_0x4fc7b9+_0xf110('0x14')+_0x17a94a+'.'+_0x4fc7b9)[_0xf110('0x13')](_0x24ada7+'.dialCheckDuplicateType\x20IN\x20('+_0x13ced0[_0xf110('0x12')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x206703,_0x5c33b8){promisesAdditionalPhones=[];promisesContact=[];return db[_0xf110('0x15')][_0xf110('0x16')](_0xf110('0x17')+tempTableName)[_0xf110('0x18')](function(_0x32df98){if(_0x32df98!==null){var _0x47cabf=[];for(var _0x5fbcdd=0x0;_0x5fbcdd<_0x32df98[_0xf110('0x19')];_0x5fbcdd++){var _0x3a0c81=_0x32df98[_0x5fbcdd];if(!_['isNil'](_0x3a0c81[_0xf110('0x10')])){if(!_[_0xf110('0x1a')](_0x3a0c81[_0xf110('0x1b')]))_0x47cabf['push'](insertAdditionalPhones(_0x3a0c81));promisesContact[_0xf110('0x1c')]({'contact':_0x3a0c81});}}}Promise['all'](_0x47cabf)[_0xf110('0x1d')](function(){_0x206703({'val':0x1});});})[_0xf110('0x1e')](function(_0x119e56){logger[_0xf110('0x1f')](_0x119e56[_0xf110('0x20')]);});});}function insertAdditionalPhones(_0x54513e){return new Promise(function(_0x3c1793,_0xed3418){var _0x52e6cf=_0x54513e[_0xf110('0x1b')];if(_[_0xf110('0x1a')](_0x52e6cf))_0xed3418({'val':0x0});else{var _0x44eb14=_0x52e6cf[_0xf110('0x21')](';');var _0x1634bf=[];orderBy=0x0;for(var _0x4e7aad=0x0;_0x4e7aad<_0x44eb14[_0xf110('0x19')];_0x4e7aad++){_0x1634bf[_0xf110('0x1c')](splitAdditionalPhone(_0x54513e['id'],_0x44eb14[_0x4e7aad]));}Promise['all'](_0x1634bf)[_0xf110('0x1d')](function(){_0x3c1793({'val':_0x44eb14[_0xf110('0x19')]});});}});}function splitAdditionalPhone(_0x11eb1c,_0x2f3ddd){return new Promise(function(_0x447934,_0x2f91fa){var _0x36ac5e=_0x2f3ddd['split'](':');var _0xb4fde2=_0x36ac5e[0x0];var _0x50d877=_0x36ac5e[0x1];if(_0x50d877!==''){var _0x38ba99=_0x50d877['split']('|');var _0x4eedb0=[];for(var _0x4cac86=0x0;_0x4cac86<_0x38ba99['length'];_0x4cac86++){if(_0x38ba99[_0x4cac86]!==''){var _0x16c81e=_[_0xf110('0x22')](promisesAdditionalPhones,{'contactId':_0x11eb1c,'phone':_0x38ba99[_0x4cac86]});if(_0x16c81e['length']==0x0){orderBy++;promisesAdditionalPhones[_0xf110('0x1c')]({'contactId':_0x11eb1c,'contactTypeId':_0xb4fde2,'phone':_0x38ba99[_0x4cac86],'orderBy':orderBy});}}}_0x447934({'ok':0x1});}else _0x447934({'res':0x0});});}function createAdditionalPhone(_0x1c2152,_0x32a4d3,_0x4e0087,_0x2f3488){var _0x2e0570='';var _0x56f9fd='';var _0x1a90c7=_0x4e0087[_0xf110('0x21')]('§');_0x2e0570=_0x1a90c7[0x0];if(_0x1a90c7[_0xf110('0x19')]==0x2)_0x56f9fd=_0x1a90c7[0x1];return new Promise(function(_0x44c603,_0x40afb3){return db[_0xf110('0x23')][_0xf110('0x24')]({'where':{'CmContactId':_0x1c2152,'item':_0x2e0570}})[_0xf110('0x1d')](function(_0x5143b0){if(_0x5143b0){return db['CmContactHasItem'][_0xf110('0x25')]({'ItemTypeId':_0x32a4d3,'description':_0x56f9fd,'OrderBy':_0x2f3488},{'where':{'CmContactId':_0x1c2152,'item':_0x2e0570}})['then'](function(_0x1d9824){_0x44c603({'res':_0xf110('0x26')});});}else{return db[_0xf110('0x23')][_0xf110('0x27')]({'CmContactId':_0x1c2152,'item':_0x2e0570,'ItemTypeId':_0x32a4d3,'description':_0x56f9fd,'OrderBy':_0x2f3488,'ItemClass':_0xf110('0x28')})[_0xf110('0x1d')](function(_0xd6c865){_0x44c603({'res':_0xf110('0x29')});});}});});}function updateContact(_0x235594){return new Promise(function(_0x526228,_0x36498c){var _0x4284bb=_0x235594['id'];delete _0x235594['id'];return db[_0xf110('0x2a')][_0xf110('0x25')](_0x235594,{'where':{'id':_0x4284bb}})[_0xf110('0x1d')](function(_0x31f485){updatedRows+=0x1;return db[_0xf110('0x2b')][_0xf110('0x25')]({'phone':_0x235594[_0xf110('0x10')]},{'where':{'ContactId':_0x4284bb}})[_0xf110('0x1d')](function(_0x47314c){_0x526228({'ret':'OK'});});});});}function insertCmHopper(_0x2a5a19,_0xe9c2d1,_0x226507,_0x55dbed,_0x1f7937){var _0x25fd7a=[_0xf110('0x2c'),_0xf110('0x2d'),_0xf110('0x2e'),_0xf110('0x2f'),_0xe9c2d1+'.'+_0x55dbed,_0xf110('0x30'),_0xf110('0x31'),_0xf110('0x32'),_0xf110('0x33'),'\x22'+_0x1f7937+'\x22'];return squel['insert']()[_0xf110('0x34')](_0xf110('0x35'))[_0xf110('0x36')]([_0xf110('0x10'),_0xf110('0x37'),_0xf110('0x38'),_0xf110('0x39'),_0x55dbed,_0xf110('0x3a'),_0xf110('0x3b'),_0xf110('0x3c'),_0xf110('0x3d'),_0xf110('0x3e')],squel['select']()['fields'](_0x25fd7a)[_0xf110('0x11')](_0xe9c2d1)[_0xf110('0x12')](_0xf110('0x3f'),null,_0xf110('0x40')+_0xe9c2d1+_0xf110('0x41'))['join'](_0x226507,null,_0x226507+_0xf110('0x42')+_0xe9c2d1+'.'+_0x55dbed)[_0xf110('0x13')](_0xe9c2d1+_0xf110('0x43'),_0x2a5a19)[_0xf110('0x13')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xf110('0x13')](_0xf110('0x44'),selectNotIn(_0xe9c2d1,_0x226507,_0x55dbed,'cm_hopper',[_0xf110('0x45'),_0xf110('0x46')]))[_0xf110('0x13')](_0xf110('0x44'),selectNotIn(_0xe9c2d1,_0x226507,_0x55dbed,'cm_hopper',[_0xf110('0x45')])))['toString']();}function insertCmHopperBlack(_0x2bf74d,_0x544f2e,_0x85a2ea,_0x11cb93){var _0x2f9fe5=['cm_contacts.phone',_0xf110('0x2e'),'cm_contacts.ListId',_0x544f2e+'.'+_0x11cb93,_0xf110('0x30'),_0xf110('0x31')];return squel[_0xf110('0x47')]()[_0xf110('0x34')](_0xf110('0x48'))[_0xf110('0x36')]([_0xf110('0x10'),_0xf110('0x38'),_0xf110('0x39'),_0x11cb93,_0xf110('0x3a'),'updatedAt'],squel['select']()[_0xf110('0x49')](_0x2f9fe5)[_0xf110('0x11')](_0x544f2e)['join'](_0xf110('0x3f'),null,'cm_contacts.ListId\x20=\x20'+_0x544f2e+_0xf110('0x41'))[_0xf110('0x12')](_0x85a2ea,null,_0x85a2ea+_0xf110('0x42')+_0x544f2e+'.'+_0x11cb93)[_0xf110('0x13')](_0x544f2e+_0xf110('0x43'),_0x2bf74d)[_0xf110('0x13')](_0xf110('0x4a'),NOW)[_0xf110('0x13')](_0xf110('0x44'),squel[_0xf110('0x4b')]()['field'](_0xf110('0x10'))[_0xf110('0x11')](_0xf110('0x48'))[_0xf110('0x13')]('ListId\x20=\x20?',_0x2bf74d)[_0xf110('0x13')](_0x11cb93+'\x20=\x20?',_0x544f2e+'.'+_0x11cb93)))['toString']();}function insertCmHopperAdditionalPhones(_0x45e710){var _0x1a8f98=[_0xf110('0x4c'),'cm_contact_has_items.item',_0xf110('0x4d'),_0xf110('0x4e'),_0xf110('0x4f')];return squel[_0xf110('0x47')]()[_0xf110('0x34')](_0xf110('0x50'))[_0xf110('0x36')]([_0xf110('0x51'),_0xf110('0x10'),_0xf110('0x52'),_0xf110('0x3a'),'updatedAt'],squel[_0xf110('0x4b')]()[_0xf110('0x49')](_0x1a8f98)['from'](_0xf110('0x35'))['join']('cm_contacts',null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')[_0xf110('0x12')](_0xf110('0x53'),null,_0xf110('0x54'))['where'](_0xf110('0x55'),_0x45e710)['where'](_0xf110('0x4a'),NOW))['toString']();}function insertCmContact(_0x50490a,_0x1d9f83,_0xef8c6c,_0x123b8c){var _0x1ea73d=_[_0xf110('0x56')](_[_0xf110('0x57')](_0x123b8c),[_0xf110('0x39'),_0xf110('0x58'),_0xf110('0x3a'),'updatedAt']);return squel[_0xf110('0x47')]()[_0xf110('0x34')](_0xf110('0x3f'))['fromQuery'](_0x1ea73d,squel[_0xf110('0x4b')]()[_0xf110('0x49')](_0x1ea73d)[_0xf110('0x11')](_0x1d9f83)[_0xf110('0x13')]('('+_0xef8c6c[_0xf110('0x12')](',')+_0xf110('0x59'),squel['select']()[_0xf110('0x49')](_0xef8c6c)[_0xf110('0x11')]('cm_contacts')[_0xf110('0x13')](_0xf110('0x5a'),_0x50490a))[_0xf110('0x13')](_0xf110('0x5b'),squel['select']()[_0xf110('0xf')](_0xf110('0x5c'),_0xf110('0x5d'))[_0xf110('0x11')](_0x1d9f83)['group'](_0xef8c6c[_0xf110('0x12')](','))))[_0xf110('0x5e')]();}function handleStop(){logger[_0xf110('0x5f')](_0xf110('0x60'));stopped=!![];}function handleUncaughtException(_0xeffa42){logger[_0xf110('0x1f')](_0xeffa42[_0xf110('0x20')]);process['exit'](0x1);}function handleError(_0x457b2d,_0x11cc24){stats[_0xf110('0x61')][_0xf110('0x1c')]({'name':_0x11cc24[_0xf110('0x62')],'message':_0x11cc24[_0xf110('0x20')],'row':_0x457b2d});}function handleQuery(_0x462d48){logger[_0xf110('0x5f')](_0x462d48);return db[_0xf110('0x15')][_0xf110('0x16')](_0x462d48)[_0xf110('0x18')](function(_0x43f2a1){results['push'](_0x43f2a1);})[_0xf110('0x1e')](function(_0x493060){logger[_0xf110('0x1f')](_0x493060['message']);});}function main(_0x16cdcf,_0x3e127e,_0x5aa8c5,_0x1dcb8d){logger[_0xf110('0x5f')]('main',_0x16cdcf,JSON[_0xf110('0x63')](_0x3e127e));process['send'](_0xf110('0x64'));var _0x13d29e=_0x3e127e[_0xf110('0x65')];var _0x1ff0bd=_[_0xf110('0x66')](_0x13d29e);var _0x482b53=_0x3e127e['socket_timestamp'];var _0x56635f=path[_0xf110('0x12')](config[_0xf110('0x67')],_0xf110('0x68'),_0x482b53+_0xf110('0x69'));logger[_0xf110('0x5f')]('body',_0x3e127e);db[_0xf110('0x6a')][_0xf110('0x6b')]({'raw':!![],'attributes':['id',_0xf110('0x6c')]})[_0xf110('0x1d')](function(_0x4016d4){for(var _0x32f596=0x0;_0x32f596<_0x4016d4[_0xf110('0x19')];_0x32f596++){if(_0x4016d4[_0x32f596][_0xf110('0x6c')]in _0x13d29e){contactItemTypes[_0xf110('0x1c')](_0x4016d4[_0x32f596]);delete _0x1ff0bd[_0x4016d4[_0x32f596][_0xf110('0x6c')]];hasAdditionalPhones=!![];}for(var _0xdfdb4f in _0x13d29e){if(_0x4016d4[_0x32f596][_0xf110('0x6c')]+_0xf110('0x6d')===_0xdfdb4f){phoneDescriptions[_0xf110('0x1c')]({'itemTypeId':_0x4016d4[_0x32f596]['id'],'description':_0xdfdb4f});delete _0x1ff0bd[_0xdfdb4f];}}}if(hasAdditionalPhones)_0x1ff0bd[_0xf110('0x1b')]='';var _0x12cf4f=_['keys'](_0x1ff0bd)[_0xf110('0x12')]();logger['info']('header',_0x12cf4f);fs['writeFileSync'](_0x56635f,_0x12cf4f+'\x0a');Papa[_0xf110('0x6e')](fs[_0xf110('0x6f')](_0x16cdcf),{'header':!![],'skipEmptyLines':!![],'step':function(_0x1b9b81,_0x5480a6){try{for(var _0x30a4bb=0x0,_0x43328c=[];_0x30a4bb<_0x1b9b81[_0xf110('0x70')][_0xf110('0x19')];_0x30a4bb++){stats['rows']+=0x1;if(_0x1b9b81['errors'][_0x30a4bb]){handleError(_0x1b9b81[_0xf110('0x70')][_0x30a4bb],_0x1b9b81['errors'][_0x30a4bb]);}else{var _0x7161e=[];var _0x588580=[];var _0x1d909c={};for(var _0x3d1c98 in _0x13d29e){let _0x4747e3=contactItemTypes[_0xf110('0x71')](_0x574cbc=>_0x574cbc[_0xf110('0x6c')]===_0x3d1c98);let _0x2c901d=contactItemTypes[_0xf110('0x71')](_0x374004=>_0x374004['name']+'_description'===_0x3d1c98);if(_['isNil'](_0x4747e3)&&_['isNil'](_0x2c901d)){if(_0x13d29e[_0xf110('0x72')](_0x3d1c98)){if(_0x1b9b81[_0xf110('0x70')][_0x30a4bb][_0x13d29e[_0x3d1c98]]){var _0x46c2c1=_[_0xf110('0x73')](_0x1b9b81[_0xf110('0x70')][_0x30a4bb][_0x13d29e[_0x3d1c98]][_0xf110('0x74')](/"/g,'\x27'));switch(_0x3d1c98){case _0xf110('0x37'):var _0x2dec30=moment(_0x46c2c1,_0xf110('0xb'),!![]);if(_0x2dec30[_0xf110('0x75')]()){_0x43328c['push']('\x22'+_0x46c2c1+'\x22');}else{_0x7161e[_0xf110('0x1c')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case'priority':var _0x5a2055=parseInt(_0x46c2c1);_0x46c2c1=_[_0xf110('0x76')](_0x5a2055)||_0x5a2055<0x0||_0x5a2055>0x4?_0x1dcb8d?0x3:0x2:_0x5a2055;_0x43328c[_0xf110('0x1c')]('\x22'+_0x46c2c1+'\x22');break;case _0xf110('0x3d'):var _0x284f81=parseInt(_0x46c2c1);if(_[_0xf110('0x77')](_0x284f81)&&_[_0xf110('0x78')](_0x5aa8c5,_0x284f81)){_0x43328c[_0xf110('0x1c')]('\x22'+_0x284f81+'\x22');}else{_0x7161e[_0xf110('0x1c')](_0xf110('0x79'));}break;case _0xf110('0x7a'):if(isEmail(_0x46c2c1)){_0x43328c[_0xf110('0x1c')]('\x22'+_0x46c2c1+'\x22');}else{_0x7161e['push'](_0xf110('0x7b'));}break;case'dateOfBirth':var _0x567323=moment(_0x46c2c1,_0xf110('0x7c'),!![]);if(_0x567323[_0xf110('0x75')]()){_0x43328c[_0xf110('0x1c')]('\x22'+_0x46c2c1+'\x22');}else{_0x7161e[_0xf110('0x1c')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x43328c[_0xf110('0x1c')]('\x22'+_0x46c2c1+'\x22');}}else{switch(_0x3d1c98){case _0xf110('0x7d'):case _0xf110('0x10'):_0x7161e[_0xf110('0x1c')](_0x3d1c98+_0xf110('0x7e'));break;default:_0x43328c[_0xf110('0x1c')]('\x22\x22');}}}}else{var _0x8f4328='';if(!_[_0xf110('0x1a')](_0x4747e3)){if(!_0x1d909c['hasOwnProperty'](_0x4747e3['id'])){for(var _0x962bd=0x0;_0x962bd<_0x13d29e[_0x3d1c98][_0xf110('0x19')];_0x962bd++){var _0x46c2c1=_[_0xf110('0x73')](_0x1b9b81[_0xf110('0x70')][_0x30a4bb][_0x13d29e[_0x3d1c98][_0x962bd]][_0xf110('0x74')](/"/g,'\x27'));var _0x46a1dc=phoneDescriptions['find'](_0x261fcd=>_0x261fcd['itemTypeId']===_0x4747e3['id']);if(!_[_0xf110('0x1a')](_0x46a1dc)){var _0x2915ad=_[_0xf110('0x73')](_0x1b9b81['data'][_0x30a4bb][_0x13d29e[_0x46a1dc[_0xf110('0x7f')]][0x0]][_0xf110('0x74')](/"/g,'\x27'));if(!_['isNil'](_0x2915ad))_0x46c2c1=_0x46c2c1+'§'+_0x2915ad;}if(_0x8f4328=='')_0x8f4328=_0x46c2c1;else _0x8f4328+='|'+_0x46c2c1;}_0x588580['push'](_0x4747e3['id']+':'+_0x8f4328);_0x1d909c[_0x4747e3['id']]=0x1;}}}}if(hasAdditionalPhones){_0x43328c[_0xf110('0x1c')]('\x22'+_0x588580[_0xf110('0x12')](';')+'\x22');}if(_0x7161e['length']){handleError(_0x1b9b81[_0xf110('0x70')][_0x30a4bb],{'code':_0xf110('0x80'),'message':_0x7161e[_0xf110('0x12')]()});}else{fs[_0xf110('0x81')](_0x56635f,_0x43328c['join']()+'\x0a');}_0x43328c=[];}if(!(stats[_0xf110('0x82')]%0xc8)){socket[_0xf110('0x83')](_0xf110('0x84')+_0x482b53,stats);stats[_0xf110('0x61')]=[];}}if(stopped){logger['info'](_0xf110('0x85'));_0x5480a6['abort']();}}catch(_0x427dde){handleError(_0x1b9b81[_0xf110('0x70')][_0x30a4bb],{'code':_0xf110('0x86'),'message':_0x427dde['message']});logger['error'](_0xf110('0x87'),_0x427dde[_0xf110('0x20')]);}},'complete':function(){try{var _0x33716c=[];var _0x45470b=tempTableName;_0x33716c[_0xf110('0x1c')]('CREATE\x20TABLE\x20'+_0x45470b+_0xf110('0x88'));logger['info'](_0xf110('0x89'),contactItemTypes[_0xf110('0x19')]);var _0x313b73=util[_0xf110('0xd')](_0xf110('0x8a'),_0x56635f,_0x45470b,_0x12cf4f,_0x3e127e['ListId'],_0x3e127e['CompanyId']||null,NOW,NOW);if(_[_0xf110('0x1a')](_0x13d29e[_0xf110('0x37')])){_0x313b73+=_0xf110('0x8b');}_0x33716c[_0xf110('0x1c')](_0x313b73);BPromise[_0xf110('0x8c')](_0x33716c,handleQuery)['then'](function(_0x50a809){BPromise[_0xf110('0x8d')]([handleAdditionalPhones()])[_0xf110('0x1d')](function(){_0x33716c=[];for(var _0x39c0a0=0x0;_0x39c0a0\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','SIGINT','path','papaparse','util','bluebird','squel','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis','localhost','format','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','YYYYMMDDHHmmss','test','select','field','phone','from','join','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','sequelize','query','select\x20*\x20from\x20','spread','isNil','push','all','then','catch','error','message','AdditionalPhones','split','length','filter','CmContactHasItem','findOne','update','create','inserted','CmContact','CmHopper','cm_contacts.phone','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.UserId','insert','cm_hopper','fromQuery','ContactId','ListId','createdAt','priority','UserId','recallme','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','into','cm_hopper_black','updatedAt','fields','.CmListId','ListId\x20=\x20?','\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','CmHopperId','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_hopper.ListId\x20=\x20?','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','id\x20IN\x20?','MIN(id)','min_id','group','errors','code','info','main','stringify','send','socket_timestamp','root','server/files/tmp','.csv','body','ContactItemType','findAll','name'];(function(_0x484c03,_0x13c1d2){var _0x294127=function(_0x45a834){while(--_0x45a834){_0x484c03['push'](_0x484c03['shift']());}};_0x294127(++_0x13c1d2);}(_0x1724,0xca));var _0x4172=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0x1724[_0xf50820];return _0x2a9b10;};'use strict';var fs=require('fs');var path=require(_0x4172('0x0'));var _=require('lodash');var Papa=require(_0x4172('0x1'));var util=require(_0x4172('0x2'));var BPromise=require(_0x4172('0x3'));var moment=require('moment');var squel=require(_0x4172('0x4'));var Redis=require('ioredis');var db=require(_0x4172('0x5'))['db'];var config=require(_0x4172('0x6'));var logger=require(_0x4172('0x7'))(_0x4172('0x8'));config[_0x4172('0x9')]=_['defaults'](config[_0x4172('0x9')],{'host':_0x4172('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4172('0x9')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0x4172('0xb')](_0x4172('0xc'));var tempTableName=_0x4172('0xd')+moment()[_0x4172('0xb')](_0x4172('0xe'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x5c5b09){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))*$/[_0x4172('0xf')](_0x5c5b09);}function selectNotIn(_0x139ee0,_0x24bf21,_0x2dc986,_0x879425,_0x400dc9){return squel[_0x4172('0x10')]()[_0x4172('0x11')](_0x4172('0x12'))[_0x4172('0x13')](_0x879425)[_0x4172('0x14')](_0x24bf21,null,_0x24bf21+_0x4172('0x15')+_0x879425+'.'+_0x2dc986)[_0x4172('0x16')](_0x879425+'.'+_0x2dc986+'\x20=\x20'+_0x139ee0+'.'+_0x2dc986)['where'](_0x24bf21+_0x4172('0x17')+_0x400dc9[_0x4172('0x14')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x5c83de,_0x742dae){promisesAdditionalPhones=[];promisesContact=[];return db[_0x4172('0x18')][_0x4172('0x19')](_0x4172('0x1a')+tempTableName)[_0x4172('0x1b')](function(_0x4a0b4e){if(_0x4a0b4e!==null){var _0x250bc7=[];for(var _0x3aa3f4=0x0;_0x3aa3f4<_0x4a0b4e['length'];_0x3aa3f4++){var _0x3d0760=_0x4a0b4e[_0x3aa3f4];if(!_[_0x4172('0x1c')](_0x3d0760[_0x4172('0x12')])){if(!_['isNil'](_0x3d0760['AdditionalPhones']))_0x250bc7[_0x4172('0x1d')](insertAdditionalPhones(_0x3d0760));promisesContact['push']({'contact':_0x3d0760});}}}Promise[_0x4172('0x1e')](_0x250bc7)[_0x4172('0x1f')](function(){_0x5c83de({'val':0x1});});})[_0x4172('0x20')](function(_0x154af3){logger[_0x4172('0x21')](_0x154af3[_0x4172('0x22')]);});});}function insertAdditionalPhones(_0x4c4e46){return new Promise(function(_0x560c32,_0x4dd773){var _0x24cb11=_0x4c4e46[_0x4172('0x23')];if(_['isNil'](_0x24cb11))_0x4dd773({'val':0x0});else{var _0x54f6fa=_0x24cb11[_0x4172('0x24')](';');var _0x29b01a=[];orderBy=0x0;for(var _0x1a5667=0x0;_0x1a5667<_0x54f6fa[_0x4172('0x25')];_0x1a5667++){_0x29b01a[_0x4172('0x1d')](splitAdditionalPhone(_0x4c4e46['id'],_0x54f6fa[_0x1a5667]));}Promise[_0x4172('0x1e')](_0x29b01a)[_0x4172('0x1f')](function(){_0x560c32({'val':_0x54f6fa[_0x4172('0x25')]});});}});}function splitAdditionalPhone(_0x5e90a4,_0x304804){return new Promise(function(_0x461e59,_0xe276e){var _0x47ed69=_0x304804[_0x4172('0x24')](':');var _0x370f7a=_0x47ed69[0x0];var _0x3f7bf5=_0x47ed69[0x1];if(_0x3f7bf5!==''){var _0x3aef07=_0x3f7bf5[_0x4172('0x24')]('|');var _0x1dcd06=[];for(var _0x1a1cd1=0x0;_0x1a1cd1<_0x3aef07[_0x4172('0x25')];_0x1a1cd1++){if(_0x3aef07[_0x1a1cd1]!==''){var _0xc758a2=_[_0x4172('0x26')](promisesAdditionalPhones,{'contactId':_0x5e90a4,'phone':_0x3aef07[_0x1a1cd1]});if(_0xc758a2[_0x4172('0x25')]==0x0){orderBy++;promisesAdditionalPhones[_0x4172('0x1d')]({'contactId':_0x5e90a4,'contactTypeId':_0x370f7a,'phone':_0x3aef07[_0x1a1cd1],'orderBy':orderBy});}}}_0x461e59({'ok':0x1});}else _0x461e59({'res':0x0});});}function createAdditionalPhone(_0x455ec6,_0x29b59d,_0x5f090d,_0x94bcf5){var _0x37b580='';var _0x20c415='';var _0x103431=_0x5f090d[_0x4172('0x24')]('§');_0x37b580=_0x103431[0x0];if(_0x103431[_0x4172('0x25')]==0x2)_0x20c415=_0x103431[0x1];return new Promise(function(_0x3ce66d,_0x5c7877){return db[_0x4172('0x27')][_0x4172('0x28')]({'where':{'CmContactId':_0x455ec6,'item':_0x37b580}})[_0x4172('0x1f')](function(_0x32929a){if(_0x32929a){return db['CmContactHasItem'][_0x4172('0x29')]({'ItemTypeId':_0x29b59d,'description':_0x20c415,'OrderBy':_0x94bcf5},{'where':{'CmContactId':_0x455ec6,'item':_0x37b580}})[_0x4172('0x1f')](function(_0x3ddee0){_0x3ce66d({'res':'updated'});});}else{return db['CmContactHasItem'][_0x4172('0x2a')]({'CmContactId':_0x455ec6,'item':_0x37b580,'ItemTypeId':_0x29b59d,'description':_0x20c415,'OrderBy':_0x94bcf5,'ItemClass':'PHONE'})[_0x4172('0x1f')](function(_0x55074a){_0x3ce66d({'res':_0x4172('0x2b')});});}});});}function updateContact(_0x109cff){return new Promise(function(_0x2f81ce,_0x1a6f94){var _0x3da467=_0x109cff['id'];delete _0x109cff['id'];return db[_0x4172('0x2c')][_0x4172('0x29')](_0x109cff,{'where':{'id':_0x3da467}})['then'](function(_0x54674d){updatedRows+=0x1;return db[_0x4172('0x2d')][_0x4172('0x29')]({'phone':_0x109cff[_0x4172('0x12')]},{'where':{'ContactId':_0x3da467}})[_0x4172('0x1f')](function(_0x4de295){_0x2f81ce({'ret':'OK'});});});});}function insertCmHopper(_0x15b8e7,_0x5ea781,_0x29863d,_0x15a94c,_0xceb1c4){var _0x2952b2=[_0x4172('0x2e'),'cm_contacts.scheduledat',_0x4172('0x2f'),_0x4172('0x30'),_0x5ea781+'.'+_0x15a94c,_0x4172('0x31'),'cm_contacts.updatedAt','cm_contacts.priority',_0x4172('0x32'),'\x22'+_0xceb1c4+'\x22'];return squel[_0x4172('0x33')]()['into'](_0x4172('0x34'))[_0x4172('0x35')]([_0x4172('0x12'),'scheduledat',_0x4172('0x36'),_0x4172('0x37'),_0x15a94c,_0x4172('0x38'),'updatedAt',_0x4172('0x39'),_0x4172('0x3a'),_0x4172('0x3b')],squel[_0x4172('0x10')]()['fields'](_0x2952b2)['from'](_0x5ea781)[_0x4172('0x14')](_0x4172('0x3c'),null,_0x4172('0x3d')+_0x5ea781+'.CmListId')[_0x4172('0x14')](_0x29863d,null,_0x29863d+_0x4172('0x15')+_0x5ea781+'.'+_0x15a94c)[_0x4172('0x16')](_0x5ea781+_0x4172('0x3e'),_0x15b8e7)[_0x4172('0x16')](_0x4172('0x3f'),NOW)[_0x4172('0x16')](_0x4172('0x40'),selectNotIn(_0x5ea781,_0x29863d,_0x15a94c,_0x4172('0x34'),[_0x4172('0x41'),_0x4172('0x42')]))[_0x4172('0x16')](_0x4172('0x40'),selectNotIn(_0x5ea781,_0x29863d,_0x15a94c,_0x4172('0x34'),[_0x4172('0x41')])))[_0x4172('0x43')]();}function insertCmHopperBlack(_0x427cc6,_0x3ae9ca,_0x5948eb,_0x21b37a){var _0x8742a9=[_0x4172('0x2e'),'cm_contacts.id','cm_contacts.ListId',_0x3ae9ca+'.'+_0x21b37a,'cm_contacts.createdAt','cm_contacts.updatedAt'];return squel[_0x4172('0x33')]()[_0x4172('0x44')](_0x4172('0x45'))['fromQuery']([_0x4172('0x12'),_0x4172('0x36'),_0x4172('0x37'),_0x21b37a,_0x4172('0x38'),_0x4172('0x46')],squel[_0x4172('0x10')]()[_0x4172('0x47')](_0x8742a9)['from'](_0x3ae9ca)['join'](_0x4172('0x3c'),null,'cm_contacts.ListId\x20=\x20'+_0x3ae9ca+_0x4172('0x48'))[_0x4172('0x14')](_0x5948eb,null,_0x5948eb+'.id\x20=\x20'+_0x3ae9ca+'.'+_0x21b37a)[_0x4172('0x16')](_0x3ae9ca+_0x4172('0x3e'),_0x427cc6)['where'](_0x4172('0x3f'),NOW)[_0x4172('0x16')](_0x4172('0x40'),squel[_0x4172('0x10')]()[_0x4172('0x11')]('phone')[_0x4172('0x13')](_0x4172('0x45'))[_0x4172('0x16')](_0x4172('0x49'),_0x427cc6)[_0x4172('0x16')](_0x21b37a+_0x4172('0x4a'),_0x3ae9ca+'.'+_0x21b37a)))['toString']();}function insertCmHopperAdditionalPhones(_0x54879a){var _0x52804f=[_0x4172('0x4b'),_0x4172('0x4c'),_0x4172('0x4d'),'cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt'];return squel['insert']()[_0x4172('0x44')]('cm_hopper_additional_phones')['fromQuery']([_0x4172('0x4e'),_0x4172('0x12'),'OrderBy','createdAt',_0x4172('0x46')],squel['select']()[_0x4172('0x47')](_0x52804f)[_0x4172('0x13')]('cm_hopper')[_0x4172('0x14')]('cm_contacts',null,_0x4172('0x4f'))[_0x4172('0x14')](_0x4172('0x50'),null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')[_0x4172('0x16')](_0x4172('0x51'),_0x54879a)[_0x4172('0x16')]('cm_contacts.createdAt\x20=\x20?',NOW))['toString']();}function insertCmContact(_0x44bee6,_0x1df149,_0x23b7dc,_0x3f1d22){var _0x15a06e=_[_0x4172('0x52')](_[_0x4172('0x53')](_0x3f1d22),[_0x4172('0x37'),_0x4172('0x54'),_0x4172('0x38'),_0x4172('0x46')]);return squel['insert']()[_0x4172('0x44')]('cm_contacts')[_0x4172('0x35')](_0x15a06e,squel[_0x4172('0x10')]()[_0x4172('0x47')](_0x15a06e)[_0x4172('0x13')](_0x1df149)[_0x4172('0x16')]('('+_0x23b7dc[_0x4172('0x14')](',')+_0x4172('0x55'),squel[_0x4172('0x10')]()[_0x4172('0x47')](_0x23b7dc)[_0x4172('0x13')](_0x4172('0x3c'))[_0x4172('0x16')](_0x4172('0x49'),_0x44bee6))[_0x4172('0x16')](_0x4172('0x56'),squel[_0x4172('0x10')]()[_0x4172('0x11')](_0x4172('0x57'),_0x4172('0x58'))[_0x4172('0x13')](_0x1df149)[_0x4172('0x59')](_0x23b7dc['join'](','))))[_0x4172('0x43')]();}function handleStop(){logger['info']('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x46b2a8){logger['error'](_0x46b2a8['message']);process['exit'](0x1);}function handleError(_0x34cda1,_0x58c8f9){stats[_0x4172('0x5a')][_0x4172('0x1d')]({'name':_0x58c8f9[_0x4172('0x5b')],'message':_0x58c8f9['message'],'row':_0x34cda1});}function handleQuery(_0x55f0fa){logger[_0x4172('0x5c')](_0x55f0fa);return db['sequelize'][_0x4172('0x19')](_0x55f0fa)[_0x4172('0x1b')](function(_0x5d085c){results[_0x4172('0x1d')](_0x5d085c);})[_0x4172('0x20')](function(_0x4022bb){logger[_0x4172('0x21')](_0x4022bb[_0x4172('0x22')]);});}function main(_0xda1680,_0x5bf8ed,_0x2a9a9c,_0x18a1ad){logger[_0x4172('0x5c')](_0x4172('0x5d'),_0xda1680,JSON[_0x4172('0x5e')](_0x5bf8ed));process[_0x4172('0x5f')]('start');var _0x12b2d8=_0x5bf8ed['binding'];var _0xb22f52=_['clone'](_0x12b2d8);var _0x10acfb=_0x5bf8ed[_0x4172('0x60')];var _0x22fd73=path[_0x4172('0x14')](config[_0x4172('0x61')],_0x4172('0x62'),_0x10acfb+_0x4172('0x63'));logger['info'](_0x4172('0x64'),_0x5bf8ed);db[_0x4172('0x65')][_0x4172('0x66')]({'raw':!![],'attributes':['id','name']})[_0x4172('0x1f')](function(_0x50d33c){for(var _0x577eac=0x0;_0x577eac<_0x50d33c['length'];_0x577eac++){if(_0x50d33c[_0x577eac][_0x4172('0x67')]in _0x12b2d8){contactItemTypes[_0x4172('0x1d')](_0x50d33c[_0x577eac]);delete _0xb22f52[_0x50d33c[_0x577eac][_0x4172('0x67')]];hasAdditionalPhones=!![];}for(var _0x7969d9 in _0x12b2d8){if(_0x50d33c[_0x577eac][_0x4172('0x67')]+_0x4172('0x68')===_0x7969d9){phoneDescriptions['push']({'itemTypeId':_0x50d33c[_0x577eac]['id'],'description':_0x7969d9});delete _0xb22f52[_0x7969d9];}}}if(hasAdditionalPhones)_0xb22f52[_0x4172('0x23')]='';var _0x2ee003=_[_0x4172('0x53')](_0xb22f52)['join']();logger[_0x4172('0x5c')]('header',_0x2ee003);fs[_0x4172('0x69')](_0x22fd73,_0x2ee003+'\x0a');Papa[_0x4172('0x6a')](fs[_0x4172('0x6b')](_0xda1680),{'header':!![],'skipEmptyLines':!![],'step':function(_0xf4ed1b,_0x2a2faf){try{for(var _0x5a459e=0x0,_0x11fa24=[];_0x5a459e<_0xf4ed1b['data'][_0x4172('0x25')];_0x5a459e++){stats['rows']+=0x1;if(_0xf4ed1b['errors'][_0x5a459e]){handleError(_0xf4ed1b[_0x4172('0x6c')][_0x5a459e],_0xf4ed1b[_0x4172('0x5a')][_0x5a459e]);}else{var _0x2ef626=[];var _0x537bf6=[];var _0x328635={};for(var _0x30b85a in _0x12b2d8){let _0x3d5b67=contactItemTypes['find'](_0x18e2bc=>_0x18e2bc[_0x4172('0x67')]===_0x30b85a);let _0x2907c1=contactItemTypes[_0x4172('0x6d')](_0x27cffa=>_0x27cffa[_0x4172('0x67')]+'_description'===_0x30b85a);if(_[_0x4172('0x1c')](_0x3d5b67)&&_[_0x4172('0x1c')](_0x2907c1)){if(_0x12b2d8['hasOwnProperty'](_0x30b85a)){if(_0xf4ed1b[_0x4172('0x6c')][_0x5a459e][_0x12b2d8[_0x30b85a]]){var _0x59b114=_['trim'](_0xf4ed1b[_0x4172('0x6c')][_0x5a459e][_0x12b2d8[_0x30b85a]][_0x4172('0x6e')](/"/g,'\x27'));switch(_0x30b85a){case _0x4172('0x6f'):var _0x48be3a=moment(_0x59b114,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x48be3a[_0x4172('0x70')]()){_0x11fa24['push']('\x22'+_0x59b114+'\x22');}else{_0x2ef626['push'](_0x4172('0x71'));}break;case _0x4172('0x39'):var _0x1b37e0=parseInt(_0x59b114);_0x59b114=_[_0x4172('0x72')](_0x1b37e0)||_0x1b37e0<0x0||_0x1b37e0>0x4?_0x18a1ad?0x3:0x2:_0x1b37e0;_0x11fa24[_0x4172('0x1d')]('\x22'+_0x59b114+'\x22');break;case'UserId':var _0x317a3f=parseInt(_0x59b114);if(_[_0x4172('0x73')](_0x317a3f)&&_[_0x4172('0x74')](_0x2a9a9c,_0x317a3f)){_0x11fa24[_0x4172('0x1d')]('\x22'+_0x317a3f+'\x22');}else{_0x2ef626['push'](_0x4172('0x75'));}break;case _0x4172('0x76'):if(isEmail(_0x59b114)){_0x11fa24[_0x4172('0x1d')]('\x22'+_0x59b114+'\x22');}else{_0x2ef626[_0x4172('0x1d')](_0x4172('0x77'));}break;case _0x4172('0x78'):var _0x22c44a=moment(_0x59b114,_0x4172('0x79'),!![]);if(_0x22c44a['isValid']()){_0x11fa24[_0x4172('0x1d')]('\x22'+_0x59b114+'\x22');}else{_0x2ef626[_0x4172('0x1d')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x11fa24[_0x4172('0x1d')]('\x22'+_0x59b114+'\x22');}}else{switch(_0x30b85a){case _0x4172('0x7a'):case _0x4172('0x12'):_0x2ef626['push'](_0x30b85a+_0x4172('0x7b'));break;default:_0x11fa24[_0x4172('0x1d')]('\x22\x22');}}}}else{var _0x34765c='';if(!_[_0x4172('0x1c')](_0x3d5b67)){if(!_0x328635['hasOwnProperty'](_0x3d5b67['id'])){for(var _0x3927e2=0x0;_0x3927e2<_0x12b2d8[_0x30b85a][_0x4172('0x25')];_0x3927e2++){var _0x59b114=_['trim'](_0xf4ed1b[_0x4172('0x6c')][_0x5a459e][_0x12b2d8[_0x30b85a][_0x3927e2]][_0x4172('0x6e')](/"/g,'\x27'));var _0xb586a2=phoneDescriptions[_0x4172('0x6d')](_0x4d02e3=>_0x4d02e3[_0x4172('0x7c')]===_0x3d5b67['id']);if(!_[_0x4172('0x1c')](_0xb586a2)){var _0x5ca8b5=_['trim'](_0xf4ed1b['data'][_0x5a459e][_0x12b2d8[_0xb586a2[_0x4172('0x7d')]][0x0]]['replace'](/"/g,'\x27'));if(!_[_0x4172('0x1c')](_0x5ca8b5))_0x59b114=_0x59b114+'§'+_0x5ca8b5;}if(_0x34765c=='')_0x34765c=_0x59b114;else _0x34765c+='|'+_0x59b114;}_0x537bf6[_0x4172('0x1d')](_0x3d5b67['id']+':'+_0x34765c);_0x328635[_0x3d5b67['id']]=0x1;}}}}if(hasAdditionalPhones){_0x11fa24[_0x4172('0x1d')]('\x22'+_0x537bf6[_0x4172('0x14')](';')+'\x22');}if(_0x2ef626[_0x4172('0x25')]){handleError(_0xf4ed1b[_0x4172('0x6c')][_0x5a459e],{'code':'SystemRow','message':_0x2ef626[_0x4172('0x14')]()});}else{fs[_0x4172('0x7e')](_0x22fd73,_0x11fa24[_0x4172('0x14')]()+'\x0a');}_0x11fa24=[];}if(!(stats[_0x4172('0x7f')]%0xc8)){socket[_0x4172('0x80')](_0x4172('0x81')+_0x10acfb,stats);stats[_0x4172('0x5a')]=[];}}if(stopped){logger[_0x4172('0x5c')](_0x4172('0x82'));_0x2a2faf[_0x4172('0x83')]();}}catch(_0x2fc5d7){handleError(_0xf4ed1b[_0x4172('0x6c')][_0x5a459e],{'code':'SystemError','message':_0x2fc5d7[_0x4172('0x22')]});logger[_0x4172('0x21')]('step',_0x2fc5d7[_0x4172('0x22')]);}},'complete':function(){try{var _0x5b6909=[];var _0x2097d5=tempTableName;_0x5b6909[_0x4172('0x1d')](_0x4172('0x84')+_0x2097d5+_0x4172('0x85'));logger[_0x4172('0x5c')]('CIS\x20len',contactItemTypes[_0x4172('0x25')]);var _0x4d61c2=util[_0x4172('0xb')](_0x4172('0x86'),_0x22fd73,_0x2097d5,_0x2ee003,_0x5bf8ed[_0x4172('0x37')],_0x5bf8ed[_0x4172('0x54')]||null,NOW,NOW);if(_[_0x4172('0x1c')](_0x12b2d8[_0x4172('0x6f')])){_0x4d61c2+=_0x4172('0x87');}_0x5b6909[_0x4172('0x1d')](_0x4d61c2);BPromise[_0x4172('0x88')](_0x5b6909,handleQuery)[_0x4172('0x1f')](function(_0x2495a4){BPromise[_0x4172('0x1e')]([handleAdditionalPhones()])[_0x4172('0x1f')](function(){_0x5b6909=[];for(var _0x1748d6=0x0;_0x1748d6\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','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','c.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','groupBy','Setting','enableEmailPreview','all','clone','COUNT(*)','isEmpty','exports','lodash','../parsers/advancedSearch','../parsers/qs','./update-interaction','updateInteraction','./utils','../../mysqldb','getAccountFK','role','agent','search','select','field','name','color','from','tools_tags','getInteractionFK','user_has_','_interactions'];(function(_0x2bafe1,_0x4476ab){var _0x48a06b=function(_0x236909){while(--_0x236909){_0x2bafe1['push'](_0x2bafe1['shift']());}};_0x48a06b(++_0x4476ab);}(_0x4b2e,0x1de));var _0xe4b2=function(_0x3f3200,_0x1d6262){_0x3f3200=_0x3f3200-0x0;var _0x4545d7=_0x4b2e[_0x3f3200];return _0x4545d7;};'use strict';var _=require(_0xe4b2('0x0'));var squel=require('squel');var as=require(_0xe4b2('0x1'));var qs=require(_0xe4b2('0x2'));var updateInteraction=require(_0xe4b2('0x3'))[_0xe4b2('0x4')];var utils=require(_0xe4b2('0x5'));var db=require(_0xe4b2('0x6'))['db'];function skipInteractionsQuery(_0x47663f,_0x39863c,_0x257b78){var _0x734b3=![];var _0x2f2f98=utils[_0xe4b2('0x7')](_0x47663f);if(_0x39863c[_0xe4b2('0x8')]===_0xe4b2('0x9')&&!_0x257b78[_0xe4b2('0xa')]&&!_0x257b78[_0x2f2f98]){_0x734b3=!![];}return _0x734b3;}function getTagsQuery(){return squel[_0xe4b2('0xb')]()[_0xe4b2('0xc')]('id')['field'](_0xe4b2('0xd'))['field'](_0xe4b2('0xe'))[_0xe4b2('0xf')](_0xe4b2('0x10'));}function getUsersQuery(_0x57f81f,_0x9730c1){var _0x98c3f7=utils[_0xe4b2('0x11')](_0x57f81f);var _0x5494b1=_0xe4b2('0x12')+_0x57f81f+_0xe4b2('0x13');var _0x78287b=squel[_0xe4b2('0xb')]()[_0xe4b2('0xc')](_0xe4b2('0x14'))[_0xe4b2('0xc')]('u.fullname')[_0xe4b2('0xc')]('ui.'+_0x98c3f7)[_0xe4b2('0xf')](_0x5494b1,'ui')['left_join'](_0xe4b2('0x15'),'u',_0xe4b2('0x16'));if(_0x9730c1[_0xe4b2('0x17')]>0x0){_0x78287b[_0xe4b2('0x18')](_0xe4b2('0x19')+_0x98c3f7+_0xe4b2('0x1a'),_[_0xe4b2('0x1b')](_0x9730c1,'id'));}return _0x78287b;}function getInteractionsQuery(_0xb46ae4){var _0x2a005f=utils[_0xe4b2('0x1c')](_0xb46ae4);var _0x1a872f=utils['getAccountFK'](_0xb46ae4);var _0x2a2dd7=utils[_0xe4b2('0x11')](_0xb46ae4);return squel[_0xe4b2('0xb')]()['from'](_0x2a005f[_0xe4b2('0x1d')],'i')[_0xe4b2('0x1e')](_0xe4b2('0x1f'),'c',_0xe4b2('0x20'))[_0xe4b2('0x1e')]('users','o','o.id\x20=\x20i.UserId')[_0xe4b2('0x1e')](_0x2a005f['accounts'],'a',_0xe4b2('0x21')+_0x1a872f)[_0xe4b2('0x1e')](_0x2a005f[_0xe4b2('0x22')],'me',_0xe4b2('0x23')+_0x2a2dd7+_0xe4b2('0x24'))[_0xe4b2('0x1e')](_0x2a005f[_0xe4b2('0x25')],'it','it.'+_0x2a2dd7+_0xe4b2('0x24'))[_0xe4b2('0x1e')]('tools_tags','t',_0xe4b2('0x26'));}function getSqlClauses(){var _0x570763={'body':squel[_0xe4b2('0x27')](),'contact':squel[_0xe4b2('0x27')](),'default':squel['expr'](),'fields':squel['expr'](),'filter':squel['expr'](),'read':squel[_0xe4b2('0x27')](),'tags':{'clause':squel[_0xe4b2('0x27')](),'ids':null},'user':squel[_0xe4b2('0x27')]()};return _0x570763;}function parseTagParameter(_0x3cd30a){var _0x113348=squel[_0xe4b2('0x27')]();if(_0x3cd30a){var _0x5357ba=utils['getSelectedTags'](_0x3cd30a);_0x5357ba[_0xe4b2('0x28')](function(_0xf879bf){_0x113348['or'](_0xe4b2('0x29'),'%,'+_0xf879bf+',%');});}return _0x113348;}function parseReadParameter(_0x1c8433){var _0x1f5097='';if(_0x1c8433){_0x1f5097=_0xe4b2('0x2a');if(_0x1c8433==='1'){_0x1f5097=_0x1f5097[_0xe4b2('0x2b')](_0xe4b2('0x2c'),'=');}else{_0x1f5097=_0x1f5097[_0xe4b2('0x2b')](_0xe4b2('0x2c'),'>');}}return _0x1f5097;}function parseSearchFilter(_0x31415a,_0x8ee0e4){var _0x5376a2=squel['expr']();if(_0x8ee0e4){var _0x41ca24=_0x8ee0e4[_0xe4b2('0x2b')]('\x5c','\x5c\x5c')[_0xe4b2('0x2b')](/'/g,'\x27\x27');if(qs[_0xe4b2('0x2d')](_0x41ca24)){_0x5376a2['or'](_0xe4b2('0x2e'),_0x41ca24+'%');if([_0xe4b2('0x2f'),_0xe4b2('0x30')]['includes'](_0x31415a)){_0x5376a2['or'](_0xe4b2('0x31'),_0x41ca24+'%');}else if(_0x31415a==='fax'){_0x5376a2['or']('i.fax\x20LIKE\x20?',_0x41ca24+'%');}else if(_0x31415a===_0xe4b2('0x32')){_0x5376a2['or'](_0xe4b2('0x33'),_0x41ca24+'%');}}else if(_0x31415a===_0xe4b2('0x34')&&qs[_0xe4b2('0x35')](_0x41ca24)){_0x5376a2['or']('c.email\x20LIKE\x20?',_0x41ca24+'%');}else{if(_0x31415a===_0xe4b2('0x34')){_0x5376a2['or'](_0xe4b2('0x36'),qs[_0xe4b2('0x37')](_0x41ca24,!![]))['or'](_0xe4b2('0x38'),qs[_0xe4b2('0x37')](_0x41ca24));}else if(_0x31415a!=='fax'){_0x5376a2['or'](_0xe4b2('0x39'),qs[_0xe4b2('0x37')](_0x41ca24));}_0x5376a2['or'](_0xe4b2('0x3a'),qs[_0xe4b2('0x37')](_0x41ca24,!![]),null);}}return _0x5376a2;}function parseAdvancedSearchFilter(_0x535809,_0x5826f2){var _0x1a22a3=getSqlClauses();var _0x529c21=as[_0xe4b2('0x3b')](_0x535809);var _0x54db67=_0x529c21['sqlOperator'];for(var _0x39e57e=0x0;_0x39e57e<_0x529c21[_0xe4b2('0x3c')][_0xe4b2('0x17')];_0x39e57e++){var _0x4bb257=_0x529c21[_0xe4b2('0x3c')][_0x39e57e];var _0x293b08='i';var _0x35fa29=_[_0xe4b2('0x3d')](_0x5826f2,['name',_0x4bb257[_0xe4b2('0xc')]]);if(_0x35fa29){var _0x4b4fcb=as[_0xe4b2('0x3e')](_0x293b08,_0x35fa29[_0xe4b2('0x3f')],_0x4bb257);_0x1a22a3['default'][_0x54db67](_0x4b4fcb['text'],_0x4b4fcb[_0xe4b2('0x40')]['start'],_0x4b4fcb[_0xe4b2('0x40')][_0xe4b2('0x41')]);}else{switch(_0x4bb257['field']){case _0xe4b2('0x42'):var _0x4e107e=parseReadParameter(_0x4bb257[_0xe4b2('0x40')]);_0x1a22a3[_0xe4b2('0x43')][_0xe4b2('0x44')](_0x4e107e);break;case'Contact':if(_0x4bb257[_0xe4b2('0x45')]==='$substring'){if(_0x4bb257['value'][_0xe4b2('0x46')]('\x20')[_0xe4b2('0x17')]>0x1){_0x1a22a3['contact'][_0x54db67](_0xe4b2('0x3a'),qs[_0xe4b2('0x37')](_0x4bb257[_0xe4b2('0x40')],!![]),null);}else{var _0x39debb='%'+_0x4bb257[_0xe4b2('0x40')]+'%';_0x1a22a3['contact'][_0x54db67](_0xe4b2('0x47'),_0x39debb,_0x39debb,_0x39debb);}}else{_0x35fa29=_[_0xe4b2('0x3d')](_0x5826f2,[_0xe4b2('0xd'),_0xe4b2('0x48')]);_0x4bb257[_0xe4b2('0xc')]=_0xe4b2('0x48');_0x4b4fcb=as[_0xe4b2('0x3e')](_0x293b08,_0x35fa29[_0xe4b2('0x3f')],_0x4bb257);_0x1a22a3[_0xe4b2('0x49')][_0x54db67](_0x4b4fcb[_0xe4b2('0x4a')],_0x4b4fcb[_0xe4b2('0x40')][_0xe4b2('0x4b')],_0x4b4fcb[_0xe4b2('0x40')][_0xe4b2('0x41')]);}break;case _0xe4b2('0x4c'):var _0x360fae=_0x4bb257['value'][_0xe4b2('0x46')](',')[_0xe4b2('0x1b')](function(_0x1b1d01){return Number(_0x1b1d01);});var _0x1a3eb0=parseTagParameter(_0x360fae);_0x1a22a3[_0xe4b2('0x4d')][_0xe4b2('0x4e')][_0xe4b2('0x44')](_0x1a3eb0);_0x1a22a3[_0xe4b2('0x4d')][_0xe4b2('0x4f')]=_0x360fae;break;case _0xe4b2('0x50'):if(_0x4bb257[_0xe4b2('0x45')]===_0xe4b2('0x51')){_0x1a22a3[_0xe4b2('0x52')][_0x54db67](_0xe4b2('0x53'),'%'+_0x4bb257[_0xe4b2('0x40')]+'%',null);}else{_0x35fa29=_[_0xe4b2('0x3d')](_0x5826f2,[_0xe4b2('0xd'),_0xe4b2('0x54')]);_0x4bb257[_0xe4b2('0xc')]=_0xe4b2('0x54');_0x4b4fcb=as[_0xe4b2('0x3e')](_0x293b08,_0x35fa29[_0xe4b2('0x3f')],_0x4bb257);_0x1a22a3[_0xe4b2('0x52')][_0x54db67](_0x4b4fcb[_0xe4b2('0x4a')],_0x4b4fcb[_0xe4b2('0x40')]['start'],_0x4b4fcb[_0xe4b2('0x40')]['end']);}break;case _0xe4b2('0x55'):case'plainBody':_0x4b4fcb=as[_0xe4b2('0x3e')]('me',null,_0x4bb257);_0x1a22a3[_0xe4b2('0x55')][_0x54db67](_0x4b4fcb[_0xe4b2('0x4a')],_0x4b4fcb[_0xe4b2('0x40')]['start'],_0x4b4fcb[_0xe4b2('0x40')]['end']);break;}}}return _0x1a22a3;}function parseModelFields(_0x8a4f19,_0x1c283b,_0xee07e2){var _0x30ef43=utils[_0xe4b2('0x7')](_0x8a4f19);var _0x1ab61d=squel[_0xe4b2('0x27')]();var _0x2ef6f3=_(_0x1c283b)['keys']()['map'](function(_0x177907){return _[_0xe4b2('0x56')](_0xee07e2,[_0xe4b2('0xd'),_0x177907])?_0x177907:undefined;})[_0xe4b2('0x57')]()[_0xe4b2('0x40')]();if(_0x2ef6f3['length']>0x0){_0x2ef6f3[_0xe4b2('0x28')](function(_0x5492a5){if(_0x5492a5===_0x30ef43){_0x1ab61d['and']('i.'+_0x30ef43+_0xe4b2('0x1a'),[][_0xe4b2('0x58')](_0x1c283b[_0x5492a5]));}else if(_0x5492a5==='createdAt'){var _0x2a3acb=JSON[_0xe4b2('0x59')](_0x1c283b[_0x5492a5])[_0xe4b2('0x5a')];var _0x556235=JSON[_0xe4b2('0x59')](_0x1c283b[_0x5492a5])[_0xe4b2('0x5b')];_0x1ab61d['and']('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x2a3acb,_0x556235);}else{if(_0x1c283b[_0x5492a5]===_0xe4b2('0x5c')){_0x1ab61d[_0xe4b2('0x44')]('i.'+_0x5492a5+_0xe4b2('0x5d'));}else{_0x1ab61d['and']('i.'+_0x5492a5+_0xe4b2('0x5e'),_0x1c283b[_0x5492a5]);}}});}return _0x1ab61d;}function parseQueryParameters(_0x104f85,_0x2d371d,_0x426828){var _0x46bd0e=getSqlClauses();return Promise['resolve']()['then'](function(){return parseModelFields(_0x104f85,_0x2d371d,_0x426828);})['then'](function(_0x20e1a6){_0x46bd0e[_0xe4b2('0x5f')]['and'](_0x20e1a6);return parseReadParameter(_0x2d371d['read']);})['then'](function(_0x20efa6){_0x46bd0e[_0xe4b2('0x43')][_0xe4b2('0x44')](_0x20efa6);return parseTagParameter(_0x2d371d[_0xe4b2('0x60')]);})['then'](function(_0x497c85){_0x46bd0e['tags'][_0xe4b2('0x4e')]['and'](_0x497c85);return parseSearchFilter(_0x104f85,_0x2d371d[_0xe4b2('0x61')]);})['then'](function(_0x1b73dd){_0x46bd0e[_0xe4b2('0x61')]=_0x1b73dd;return _0x46bd0e;});}function checkAccountsRestrictions(_0x3d0f33,_0xceb98b,_0x1bd6dd){var _0x5820c5=utils['getAccountFK'](_0x3d0f33);var _0x5af0fb=_0xe4b2('0x62')+_[_0xe4b2('0x63')](_0x3d0f33)+(_0x3d0f33===_0xe4b2('0x64')?_0xe4b2('0x65'):_0xe4b2('0x66'));var _0x4103ac=squel[_0xe4b2('0x27')]();return Promise[_0xe4b2('0x67')]()[_0xe4b2('0x68')](function(){if(_0x1bd6dd[_0xe4b2('0xa')]&&_0xceb98b[_0xe4b2('0x8')]===_0xe4b2('0x9')){return _0xceb98b[_0x5af0fb]({'attributes':['id'],'raw':!![]});}})[_0xe4b2('0x68')](function(_0x2b9086){if(_0x2b9086){if(_0x2b9086[_0xe4b2('0x17')]===0x0){_0x4103ac[_0xe4b2('0x44')]('i.'+_0x5820c5+_0xe4b2('0x5d'));}else{_0x4103ac[_0xe4b2('0x44')]('i.'+_0x5820c5+_0xe4b2('0x1a'),_[_0xe4b2('0x1b')](_0x2b9086,'id'));}}else if(!_0x1bd6dd[_0x5820c5]){_0x4103ac[_0xe4b2('0x44')]('i.'+_0x5820c5+'\x20IS\x20NOT\x20NULL');}})[_0xe4b2('0x68')](function(){return _0x4103ac;});}function getClosedOrderClause(_0x37b9d2,_0x4bcf5c){var _0x42b8ef='';var _0x1184c1=[_0xe4b2('0x69'),'i.secondDisposition',_0xe4b2('0x6a')];if(_0x37b9d2==='mail'){_0x1184c1[_0xe4b2('0x6b')](_0xe4b2('0x6c'));}if(_0x4bcf5c[_0xe4b2('0x6d')]==='0'&&_0x37b9d2===_0xe4b2('0x34')){_0x42b8ef='i.substatus';}else{if(_0x4bcf5c[_0xe4b2('0x6d')]==='1'){_0x1184c1[_0xe4b2('0x6e')]();}_0x42b8ef=_0xe4b2('0x6f')+_0x1184c1[_0xe4b2('0x70')](',\x20')+')';}return _0x42b8ef;}function getFilteredInteractions(_0x24fb9b,_0x14846f,_0x56543a,_0x4543f0){var _0x5e2ef4=utils[_0xe4b2('0x11')](_0x24fb9b);var _0x2a193d=_[_0xe4b2('0x63')](_0x24fb9b)+_0xe4b2('0x71');var _0x5e7e2b=[];var _0x2000e1=getTagsQuery();var _0x15744a={'type':db[_0xe4b2('0x72')][_0xe4b2('0x73')]['SELECT'],'raw':!![]};var _0x2a2e03=[];var _0xb5a063=[];return db[_0xe4b2('0x74')][_0xe4b2('0x75')](_0x2000e1[_0xe4b2('0x76')](),_0x15744a)[_0xe4b2('0x68')](function(_0x50cdfa){_0x5e7e2b=_['keyBy'](_0x50cdfa,'id');_0x15744a=_[_0xe4b2('0x77')](_0x15744a,{'model':db[_0x2a193d],'mapToModel':!![],'nest':!![]});if(_0x56543a[_0xe4b2('0x5f')]){_0x4543f0[_0xe4b2('0x78')][_0xe4b2('0x28')](function(_0x768fee){_0x14846f[_0xe4b2('0xc')]('i.'+_0x768fee);});}else{_0x14846f['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xe4b2('0x42'));_0x14846f[_0xe4b2('0xc')](_0xe4b2('0x79'),_0xe4b2('0x7a'));_0x14846f[_0xe4b2('0xc')](_0xe4b2('0x7b'),_0xe4b2('0x7c'));if(_0x24fb9b==='mail'){_0x14846f['field'](_0xe4b2('0x7d'),_0xe4b2('0x7e'));_0x14846f[_0xe4b2('0xc')]('CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName');_0x14846f[_0xe4b2('0xc')]('i.id');_0x14846f[_0xe4b2('0xc')]('i.createdAt');_0x14846f[_0xe4b2('0xc')](_0xe4b2('0x7f'));_0x14846f[_0xe4b2('0xc')]('i.closed');_0x14846f[_0xe4b2('0xc')](_0xe4b2('0x80'));_0x14846f[_0xe4b2('0xc')](_0xe4b2('0x81'));_0x14846f[_0xe4b2('0xc')]('i.lastMsgAt');_0x14846f['field'](_0xe4b2('0x82'));_0x14846f['field'](_0xe4b2('0x83'));_0x14846f['field'](_0xe4b2('0x6a'));_0x14846f[_0xe4b2('0xc')](_0xe4b2('0x84'));_0x14846f[_0xe4b2('0xc')]('i.thirdDisposition');_0x14846f[_0xe4b2('0xc')](_0xe4b2('0x6c'));_0x14846f[_0xe4b2('0xc')](_0xe4b2('0x85'));_0x14846f[_0xe4b2('0xc')](_0xe4b2('0x86'));_0x14846f['field'](_0xe4b2('0x87'));_0x14846f[_0xe4b2('0xc')](_0xe4b2('0x88'));}else if(_0x24fb9b===_0xe4b2('0x32')){_0x14846f[_0xe4b2('0xc')](_0xe4b2('0x89'),_0xe4b2('0x8a'));}else{_0x14846f[_0xe4b2('0xc')](_0xe4b2('0x8b'),_0xe4b2('0x8a'));}if(_0x24fb9b!=='mail'){_0x14846f['field'](_0xe4b2('0x8c'));}_0x14846f[_0xe4b2('0xc')]('c.firstName',_0xe4b2('0x8d'));_0x14846f[_0xe4b2('0xc')]('c.lastName',_0xe4b2('0x8e'));_0x14846f['field'](_0xe4b2('0x8f'),_0xe4b2('0x90'));_0x14846f['field'](_0xe4b2('0x91'),'Contact.phone');_0x14846f[_0xe4b2('0xc')](_0xe4b2('0x92'),_0xe4b2('0x93'));_0x14846f[_0xe4b2('0xc')](_0xe4b2('0x94'),_0xe4b2('0x95'));_0x14846f[_0xe4b2('0xc')](_0xe4b2('0x96'),_0xe4b2('0x97'));_0x14846f[_0xe4b2('0xc')](_0xe4b2('0x98'),_0xe4b2('0x99'));_0x14846f[_0xe4b2('0xc')](_0xe4b2('0x9a'),_0xe4b2('0x9b'));}if(_0x4543f0[_0xe4b2('0x9c')]){_0x14846f[_0xe4b2('0x9c')](_0x4543f0[_0xe4b2('0x9c')]);}if(_0x4543f0[_0xe4b2('0x9d')]){_0x14846f['offset'](_0x4543f0[_0xe4b2('0x9d')]);}return db['sequelize'][_0xe4b2('0x75')](_0x14846f['toString'](),_0x15744a);})['then'](function(_0x3d94a9){_0x2a2e03=_0x3d94a9;var _0xdf2cc3=getUsersQuery(_0x24fb9b,_0x2a2e03);return db[_0xe4b2('0x74')]['query'](_0xdf2cc3[_0xe4b2('0x76')](),_0x15744a);})[_0xe4b2('0x68')](function(_0x56122a){_0xb5a063=_[_0xe4b2('0x9e')](_0x56122a,_0x5e2ef4);if(_0x24fb9b==='mail'){return db[_0xe4b2('0x9f')]['findOne']({'attributes':[_0xe4b2('0xa0')],'raw':!![]});}})[_0xe4b2('0x68')](function(_0x4f4579){var _0x4754fc=_0x4f4579?_0x4f4579['enableEmailPreview']:undefined;var _0x287a8b=_0x2a2e03[_0xe4b2('0x1b')](function(_0x181e3c){return updateInteraction(_0x181e3c,_0x5e7e2b,_0xb5a063,_0x4754fc);});return Promise[_0xe4b2('0xa1')](_0x287a8b);});}function countFilteredInteractions(_0x829c2f,_0x588a65){var _0x32fa11=_0x829c2f[_0xe4b2('0xa2')]();_0x32fa11['field'](_0xe4b2('0xa3'));_0x32fa11[_0xe4b2('0xc')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');var _0x52580f=utils['getSelectedTags'](_0x588a65);if(!_[_0xe4b2('0xa4')](_0x52580f)){_0x32fa11[_0xe4b2('0x18')]('t.id\x20IN\x20?',_0x52580f);}var _0x39f363={'type':db[_0xe4b2('0x72')][_0xe4b2('0x73')]['SELECT'],'raw':!![]};return db[_0xe4b2('0x74')]['query'](_0x32fa11[_0xe4b2('0x76')](),_0x39f363);}module[_0xe4b2('0xa5')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file +var _0xf793=['Accounts','i.thirdDisposition','i.disposition','i.substatus','closed','shift','CONCAT_WS(\x27\x27,\x20','join','capitalize','Interaction','Sequelize','QueryTypes','SELECT','sequelize','query','toString','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.mandatoryDisposition','a.email','Account.email','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.subject','i.secondDisposition','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.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','o.internal','Owner.internal','TagIds','limit','groupBy','Setting','findOne','enableEmailPreview','all','COUNT(*)','t.id\x20IN\x20?','exports','lodash','squel','../parsers/advancedSearch','updateInteraction','./utils','../../mysqldb','agent','search','select','field','name','color','from','tools_tags','_interactions','u.fullname','ui.','left_join','users','where','\x20IN\x20?','map','getInteractionsTables','getAccountFK','getInteractionFK','interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.','messages','me.','interactionsTags','it.','t.id\x20=\x20it.TagId','expr','getSelectedTags','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','unreadMessages\x20{OPERATOR}\x200','{OPERATOR}','replace','isNumeric','i.id\x20LIKE\x20?','sms','whatsapp','i.phone\x20LIKE\x20?','fax','openchannel','i.from\x20LIKE\x20?','mail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','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','length','find','type','default','text','value','start','end','unreadMessages','read','Contact','operator','split','contact','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','Tag','tags','clause','ids','User','$substring','user','UserId','body','plainBody','keys','some','compact','forEach','and','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','resolve','then','filter','get','chat'];(function(_0x1f89aa,_0x2b9e53){var _0x456b7b=function(_0x4e14af){while(--_0x4e14af){_0x1f89aa['push'](_0x1f89aa['shift']());}};_0x456b7b(++_0x2b9e53);}(_0xf793,0x182));var _0x3f79=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xf793[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x3f79('0x0'));var squel=require(_0x3f79('0x1'));var as=require(_0x3f79('0x2'));var qs=require('../parsers/qs');var updateInteraction=require('./update-interaction')[_0x3f79('0x3')];var utils=require(_0x3f79('0x4'));var db=require(_0x3f79('0x5'))['db'];function skipInteractionsQuery(_0x13effa,_0x886ba9,_0x129f35){var _0x1929b7=![];var _0x27c522=utils['getAccountFK'](_0x13effa);if(_0x886ba9['role']===_0x3f79('0x6')&&!_0x129f35[_0x3f79('0x7')]&&!_0x129f35[_0x27c522]){_0x1929b7=!![];}return _0x1929b7;}function getTagsQuery(){return squel[_0x3f79('0x8')]()[_0x3f79('0x9')]('id')['field'](_0x3f79('0xa'))[_0x3f79('0x9')](_0x3f79('0xb'))[_0x3f79('0xc')](_0x3f79('0xd'));}function getUsersQuery(_0x365d48,_0x47ce1a){var _0x4ee5a1=utils['getInteractionFK'](_0x365d48);var _0xbd9531='user_has_'+_0x365d48+_0x3f79('0xe');var _0x327f97=squel[_0x3f79('0x8')]()[_0x3f79('0x9')]('u.id')['field'](_0x3f79('0xf'))[_0x3f79('0x9')](_0x3f79('0x10')+_0x4ee5a1)[_0x3f79('0xc')](_0xbd9531,'ui')[_0x3f79('0x11')](_0x3f79('0x12'),'u','u.id\x20=\x20ui.UserId');if(_0x47ce1a['length']>0x0){_0x327f97[_0x3f79('0x13')](_0x3f79('0x10')+_0x4ee5a1+_0x3f79('0x14'),_[_0x3f79('0x15')](_0x47ce1a,'id'));}return _0x327f97;}function getInteractionsQuery(_0x3963ed){var _0x1d3281=utils[_0x3f79('0x16')](_0x3963ed);var _0x5efa46=utils[_0x3f79('0x17')](_0x3963ed);var _0x486101=utils[_0x3f79('0x18')](_0x3963ed);return squel[_0x3f79('0x8')]()[_0x3f79('0xc')](_0x1d3281[_0x3f79('0x19')],'i')[_0x3f79('0x11')]('cm_contacts','c',_0x3f79('0x1a'))[_0x3f79('0x11')](_0x3f79('0x12'),'o',_0x3f79('0x1b'))[_0x3f79('0x11')](_0x1d3281['accounts'],'a',_0x3f79('0x1c')+_0x5efa46)[_0x3f79('0x11')](_0x1d3281[_0x3f79('0x1d')],'me',_0x3f79('0x1e')+_0x486101+'\x20=\x20i.id')['left_join'](_0x1d3281[_0x3f79('0x1f')],'it',_0x3f79('0x20')+_0x486101+'\x20=\x20i.id')[_0x3f79('0x11')](_0x3f79('0xd'),'t',_0x3f79('0x21'));}function getSqlClauses(){var _0x34938e={'body':squel[_0x3f79('0x22')](),'contact':squel[_0x3f79('0x22')](),'default':squel['expr'](),'fields':squel[_0x3f79('0x22')](),'filter':squel[_0x3f79('0x22')](),'read':squel[_0x3f79('0x22')](),'tags':{'clause':squel[_0x3f79('0x22')](),'ids':null},'user':squel[_0x3f79('0x22')]()};return _0x34938e;}function parseTagParameter(_0x13f76c){var _0x7f4653=squel['expr']();if(_0x13f76c){var _0x45dd21=utils[_0x3f79('0x23')](_0x13f76c);_0x45dd21['forEach'](function(_0x6d1bd1){_0x7f4653['or'](_0x3f79('0x24'),'%,'+_0x6d1bd1+',%');});}return _0x7f4653;}function parseReadParameter(_0x5d6855){var _0xb06b34='';if(_0x5d6855){_0xb06b34=_0x3f79('0x25');if(_0x5d6855==='1'){_0xb06b34=_0xb06b34['replace'](_0x3f79('0x26'),'=');}else{_0xb06b34=_0xb06b34[_0x3f79('0x27')]('{OPERATOR}','>');}}return _0xb06b34;}function parseSearchFilter(_0x1de536,_0x5d8bcb){var _0x6c624b=squel['expr']();if(_0x5d8bcb){var _0x398138=_0x5d8bcb[_0x3f79('0x27')]('\x5c','\x5c\x5c')[_0x3f79('0x27')](/'/g,'\x27\x27');if(qs[_0x3f79('0x28')](_0x398138)){_0x6c624b['or'](_0x3f79('0x29'),_0x398138+'%');if([_0x3f79('0x2a'),_0x3f79('0x2b')]['includes'](_0x1de536)){_0x6c624b['or'](_0x3f79('0x2c'),_0x398138+'%');}else if(_0x1de536===_0x3f79('0x2d')){_0x6c624b['or']('i.fax\x20LIKE\x20?',_0x398138+'%');}else if(_0x1de536===_0x3f79('0x2e')){_0x6c624b['or'](_0x3f79('0x2f'),_0x398138+'%');}}else if(_0x1de536===_0x3f79('0x30')&&qs['isEmail'](_0x398138)){_0x6c624b['or'](_0x3f79('0x31'),_0x398138+'%');}else{if(_0x1de536===_0x3f79('0x30')){_0x6c624b['or'](_0x3f79('0x32'),qs[_0x3f79('0x33')](_0x398138,!![]))['or'](_0x3f79('0x34'),qs['getFullTextValue'](_0x398138));}else if(_0x1de536!==_0x3f79('0x2d')){_0x6c624b['or'](_0x3f79('0x35'),qs['getFullTextValue'](_0x398138));}_0x6c624b['or'](_0x3f79('0x36'),qs[_0x3f79('0x33')](_0x398138,!![]),null);}}return _0x6c624b;}function parseAdvancedSearchFilter(_0x51a944,_0xde156d){var _0x5683b9=getSqlClauses();var _0x37f27d=as[_0x3f79('0x37')](_0x51a944);var _0x404052=_0x37f27d[_0x3f79('0x38')];for(var _0x519d71=0x0;_0x519d71<_0x37f27d[_0x3f79('0x39')][_0x3f79('0x3a')];_0x519d71++){var _0x3ba652=_0x37f27d[_0x3f79('0x39')][_0x519d71];var _0xba2578='i';var _0x42bdff=_[_0x3f79('0x3b')](_0xde156d,['name',_0x3ba652['field']]);if(_0x42bdff){var _0xe55151=as['buildExpression'](_0xba2578,_0x42bdff[_0x3f79('0x3c')],_0x3ba652);_0x5683b9[_0x3f79('0x3d')][_0x404052](_0xe55151[_0x3f79('0x3e')],_0xe55151[_0x3f79('0x3f')][_0x3f79('0x40')],_0xe55151[_0x3f79('0x3f')][_0x3f79('0x41')]);}else{switch(_0x3ba652[_0x3f79('0x9')]){case _0x3f79('0x42'):var _0x7646b2=parseReadParameter(_0x3ba652['value']);_0x5683b9[_0x3f79('0x43')]['and'](_0x7646b2);break;case _0x3f79('0x44'):if(_0x3ba652[_0x3f79('0x45')]==='$substring'){if(_0x3ba652['value'][_0x3f79('0x46')]('\x20')[_0x3f79('0x3a')]>0x1){_0x5683b9[_0x3f79('0x47')][_0x404052](_0x3f79('0x36'),qs[_0x3f79('0x33')](_0x3ba652['value'],!![]),null);}else{var _0x30c8bb='%'+_0x3ba652[_0x3f79('0x3f')]+'%';_0x5683b9[_0x3f79('0x47')][_0x404052](_0x3f79('0x48'),_0x30c8bb,_0x30c8bb,_0x30c8bb);}}else{_0x42bdff=_[_0x3f79('0x3b')](_0xde156d,[_0x3f79('0xa'),_0x3f79('0x49')]);_0x3ba652['field']=_0x3f79('0x49');_0xe55151=as[_0x3f79('0x4a')](_0xba2578,_0x42bdff[_0x3f79('0x3c')],_0x3ba652);_0x5683b9[_0x3f79('0x47')][_0x404052](_0xe55151[_0x3f79('0x3e')],_0xe55151[_0x3f79('0x3f')][_0x3f79('0x40')],_0xe55151[_0x3f79('0x3f')][_0x3f79('0x41')]);}break;case _0x3f79('0x4b'):var _0x329a25=_0x3ba652[_0x3f79('0x3f')][_0x3f79('0x46')](',')[_0x3f79('0x15')](function(_0x2d2258){return Number(_0x2d2258);});var _0x2ee531=parseTagParameter(_0x329a25);_0x5683b9[_0x3f79('0x4c')][_0x3f79('0x4d')]['and'](_0x2ee531);_0x5683b9[_0x3f79('0x4c')][_0x3f79('0x4e')]=_0x329a25;break;case _0x3f79('0x4f'):if(_0x3ba652[_0x3f79('0x45')]===_0x3f79('0x50')){_0x5683b9[_0x3f79('0x51')][_0x404052]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x3ba652[_0x3f79('0x3f')]+'%',null);}else{_0x42bdff=_[_0x3f79('0x3b')](_0xde156d,['name','UserId']);_0x3ba652['field']=_0x3f79('0x52');_0xe55151=as['buildExpression'](_0xba2578,_0x42bdff['type'],_0x3ba652);_0x5683b9[_0x3f79('0x51')][_0x404052](_0xe55151[_0x3f79('0x3e')],_0xe55151['value'][_0x3f79('0x40')],_0xe55151['value'][_0x3f79('0x41')]);}break;case _0x3f79('0x53'):case _0x3f79('0x54'):_0xe55151=as[_0x3f79('0x4a')]('me',null,_0x3ba652);_0x5683b9['body'][_0x404052](_0xe55151[_0x3f79('0x3e')],_0xe55151[_0x3f79('0x3f')]['start'],_0xe55151[_0x3f79('0x3f')][_0x3f79('0x41')]);break;}}}return _0x5683b9;}function parseModelFields(_0x18f0fe,_0x388e11,_0x52a2dc){var _0x3c793e=utils['getAccountFK'](_0x18f0fe);var _0x1a6231=squel[_0x3f79('0x22')]();var _0x17cb46=_(_0x388e11)[_0x3f79('0x55')]()['map'](function(_0x34843c){return _[_0x3f79('0x56')](_0x52a2dc,['name',_0x34843c])?_0x34843c:undefined;})[_0x3f79('0x57')]()['value']();if(_0x17cb46['length']>0x0){_0x17cb46[_0x3f79('0x58')](function(_0x233695){if(_0x233695===_0x3c793e){_0x1a6231[_0x3f79('0x59')]('i.'+_0x3c793e+'\x20IN\x20?',[][_0x3f79('0x5a')](_0x388e11[_0x233695]));}else if(_0x233695===_0x3f79('0x5b')){var _0x27b727=JSON['parse'](_0x388e11[_0x233695])['$gte'];var _0x56fd1b=JSON[_0x3f79('0x5c')](_0x388e11[_0x233695])[_0x3f79('0x5d')];_0x1a6231[_0x3f79('0x59')](_0x3f79('0x5e'),_0x27b727,_0x56fd1b);}else{if(_0x388e11[_0x233695]===_0x3f79('0x5f')){_0x1a6231[_0x3f79('0x59')]('i.'+_0x233695+_0x3f79('0x60'));}else{_0x1a6231[_0x3f79('0x59')]('i.'+_0x233695+_0x3f79('0x61'),_0x388e11[_0x233695]);}}});}return _0x1a6231;}function parseQueryParameters(_0xa706f0,_0x2f5339,_0x450e26){var _0x3ae3ab=getSqlClauses();return Promise[_0x3f79('0x62')]()[_0x3f79('0x63')](function(){return parseModelFields(_0xa706f0,_0x2f5339,_0x450e26);})[_0x3f79('0x63')](function(_0x4658d6){_0x3ae3ab['fields'][_0x3f79('0x59')](_0x4658d6);return parseReadParameter(_0x2f5339[_0x3f79('0x43')]);})[_0x3f79('0x63')](function(_0x164095){_0x3ae3ab[_0x3f79('0x43')][_0x3f79('0x59')](_0x164095);return parseTagParameter(_0x2f5339['tag']);})[_0x3f79('0x63')](function(_0x50d115){_0x3ae3ab['tags'][_0x3f79('0x4d')][_0x3f79('0x59')](_0x50d115);return parseSearchFilter(_0xa706f0,_0x2f5339[_0x3f79('0x64')]);})[_0x3f79('0x63')](function(_0x1b0cf4){_0x3ae3ab[_0x3f79('0x64')]=_0x1b0cf4;return _0x3ae3ab;});}function checkAccountsRestrictions(_0x523926,_0x54ac71,_0x508a40){var _0x336c73=utils['getAccountFK'](_0x523926);var _0x16e200=_0x3f79('0x65')+_['capitalize'](_0x523926)+(_0x523926===_0x3f79('0x66')?'Websites':_0x3f79('0x67'));var _0x42a0db=squel[_0x3f79('0x22')]();return Promise[_0x3f79('0x62')]()[_0x3f79('0x63')](function(){if(_0x508a40[_0x3f79('0x7')]&&_0x54ac71['role']===_0x3f79('0x6')){return _0x54ac71[_0x16e200]({'attributes':['id'],'raw':!![]});}})[_0x3f79('0x63')](function(_0x537ef6){if(_0x537ef6){if(_0x537ef6['length']===0x0){_0x42a0db['and']('i.'+_0x336c73+_0x3f79('0x60'));}else{_0x42a0db[_0x3f79('0x59')]('i.'+_0x336c73+_0x3f79('0x14'),_[_0x3f79('0x15')](_0x537ef6,'id'));}}else if(!_0x508a40[_0x336c73]){_0x42a0db[_0x3f79('0x59')]('i.'+_0x336c73+'\x20IS\x20NOT\x20NULL');}})[_0x3f79('0x63')](function(){return _0x42a0db;});}function getClosedOrderClause(_0xa7179d,_0x345166){var _0xe3d928='';var _0x21ba7f=[_0x3f79('0x68'),'i.secondDisposition',_0x3f79('0x69')];if(_0xa7179d===_0x3f79('0x30')){_0x21ba7f['unshift'](_0x3f79('0x6a'));}if(_0x345166[_0x3f79('0x6b')]==='0'&&_0xa7179d===_0x3f79('0x30')){_0xe3d928='i.substatus';}else{if(_0x345166[_0x3f79('0x6b')]==='1'){_0x21ba7f[_0x3f79('0x6c')]();}_0xe3d928=_0x3f79('0x6d')+_0x21ba7f[_0x3f79('0x6e')](',\x20')+')';}return _0xe3d928;}function getFilteredInteractions(_0x3c30ca,_0x48c975,_0x2215da,_0x33b1f5){var _0x320ed3=utils[_0x3f79('0x18')](_0x3c30ca);var _0x371595=_[_0x3f79('0x6f')](_0x3c30ca)+_0x3f79('0x70');var _0x3e4dc2=[];var _0x232ca6=getTagsQuery();var _0x5ce516={'type':db[_0x3f79('0x71')][_0x3f79('0x72')][_0x3f79('0x73')],'raw':!![]};var _0xf1d81b=[];var _0xd437b8=[];return db[_0x3f79('0x74')][_0x3f79('0x75')](_0x232ca6[_0x3f79('0x76')](),_0x5ce516)['then'](function(_0x402410){_0x3e4dc2=_['keyBy'](_0x402410,'id');_0x5ce516=_['merge'](_0x5ce516,{'model':db[_0x371595],'mapToModel':!![],'nest':!![]});if(_0x2215da['fields']){_0x33b1f5['attributes'][_0x3f79('0x58')](function(_0x52b818){_0x48c975[_0x3f79('0x9')]('i.'+_0x52b818);});}else{_0x48c975[_0x3f79('0x9')](_0x3f79('0x77'),_0x3f79('0x42'));_0x48c975[_0x3f79('0x9')](_0x3f79('0x78'),'Account.key');_0x48c975['field']('a.mandatoryDisposition',_0x3f79('0x79'));if(_0x3c30ca==='mail'){_0x48c975[_0x3f79('0x9')](_0x3f79('0x7a'),_0x3f79('0x7b'));_0x48c975[_0x3f79('0x9')](_0x3f79('0x7c'),_0x3f79('0x7d'));_0x48c975[_0x3f79('0x9')]('i.id');_0x48c975[_0x3f79('0x9')]('i.createdAt');_0x48c975[_0x3f79('0x9')](_0x3f79('0x7e'));_0x48c975[_0x3f79('0x9')](_0x3f79('0x7f'));_0x48c975['field'](_0x3f79('0x80'));_0x48c975['field'](_0x3f79('0x81'));_0x48c975[_0x3f79('0x9')](_0x3f79('0x82'));_0x48c975[_0x3f79('0x9')]('i.lastMsgDirection');_0x48c975['field'](_0x3f79('0x83'));_0x48c975[_0x3f79('0x9')]('i.disposition');_0x48c975[_0x3f79('0x9')](_0x3f79('0x84'));_0x48c975[_0x3f79('0x9')]('i.thirdDisposition');_0x48c975['field']('i.substatus');_0x48c975[_0x3f79('0x9')](_0x3f79('0x85'));_0x48c975[_0x3f79('0x9')](_0x3f79('0x86'));_0x48c975[_0x3f79('0x9')](_0x3f79('0x87'));_0x48c975['field'](_0x3f79('0x88'));}else if(_0x3c30ca===_0x3f79('0x2e')){_0x48c975[_0x3f79('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',_0x3f79('0x7d'));}else{_0x48c975['field'](_0x3f79('0x89'),_0x3f79('0x7d'));}if(_0x3c30ca!=='mail'){_0x48c975['field'](_0x3f79('0x8a'));}_0x48c975['field'](_0x3f79('0x8b'),_0x3f79('0x8c'));_0x48c975[_0x3f79('0x9')](_0x3f79('0x8d'),_0x3f79('0x8e'));_0x48c975['field'](_0x3f79('0x8f'),'Contact.email');_0x48c975[_0x3f79('0x9')](_0x3f79('0x90'),_0x3f79('0x91'));_0x48c975[_0x3f79('0x9')](_0x3f79('0x92'),_0x3f79('0x93'));_0x48c975[_0x3f79('0x9')](_0x3f79('0x94'),_0x3f79('0x95'));_0x48c975['field'](_0x3f79('0x96'),'Owner.fullname');_0x48c975['field'](_0x3f79('0x97'),_0x3f79('0x98'));_0x48c975['field']('GROUP_CONCAT(DISTINCT\x20t.id)',_0x3f79('0x99'));}if(_0x33b1f5[_0x3f79('0x9a')]){_0x48c975[_0x3f79('0x9a')](_0x33b1f5[_0x3f79('0x9a')]);}if(_0x33b1f5['offset']){_0x48c975['offset'](_0x33b1f5['offset']);}return db[_0x3f79('0x74')][_0x3f79('0x75')](_0x48c975['toString'](),_0x5ce516);})[_0x3f79('0x63')](function(_0x21c9e9){_0xf1d81b=_0x21c9e9;var _0x4b3dad=getUsersQuery(_0x3c30ca,_0xf1d81b);return db[_0x3f79('0x74')][_0x3f79('0x75')](_0x4b3dad[_0x3f79('0x76')](),_0x5ce516);})['then'](function(_0x326c76){_0xd437b8=_[_0x3f79('0x9b')](_0x326c76,_0x320ed3);if(_0x3c30ca==='mail'){return db[_0x3f79('0x9c')][_0x3f79('0x9d')]({'attributes':[_0x3f79('0x9e')],'raw':!![]});}})['then'](function(_0x23311f){var _0x37f1d5=_0x23311f?_0x23311f[_0x3f79('0x9e')]:undefined;var _0x4e14cf=_0xf1d81b[_0x3f79('0x15')](function(_0x41896b){return updateInteraction(_0x41896b,_0x3e4dc2,_0xd437b8,_0x37f1d5);});return Promise[_0x3f79('0x9f')](_0x4e14cf);});}function countFilteredInteractions(_0x2ab209,_0x55b285){var _0x54c827=_0x2ab209['clone']();_0x54c827['field'](_0x3f79('0xa0'));_0x54c827[_0x3f79('0x9')](_0x3f79('0x77'),_0x3f79('0x42'));var _0xdc10a4=utils[_0x3f79('0x23')](_0x55b285);if(!_['isEmpty'](_0xdc10a4)){_0x54c827[_0x3f79('0x13')](_0x3f79('0xa1'),_0xdc10a4);}var _0x24932c={'type':db[_0x3f79('0x71')]['QueryTypes'][_0x3f79('0x73')],'raw':!![]};return db[_0x3f79('0x74')]['query'](_0x54c827['toString'](),_0x24932c);}module[_0x3f79('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 4531809..92ada00 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 _0xdf08=['UserId','answered','disposition','MailMessage','findOne','out','plainBody','-id','then','trimStart','updateInteraction','Users','TagIds','catch','lodash','../../mysqldb','map','fullname','waiting','talking','unmanaged','abandoned','total'];(function(_0x15020e,_0x4ef0f9){var _0x4bd575=function(_0x5577f7){while(--_0x5577f7){_0x15020e['push'](_0x15020e['shift']());}};_0x4bd575(++_0x4ef0f9);}(_0xdf08,0x98));var _0x8df0=function(_0x4f0f28,_0x582c0b){_0x4f0f28=_0x4f0f28-0x0;var _0xec6ffc=_0xdf08[_0x4f0f28];return _0xec6ffc;};'use strict';var _=require(_0x8df0('0x0'));var db=require(_0x8df0('0x1'))['db'];function getInteractionUsers(_0x384457,_0x19b18b){return new Promise(function(_0x542f6d,_0x1e2d47){try{var _0x6bc725=[];if(_0x19b18b[_0x384457]){_0x6bc725=_0x19b18b[_0x384457][_0x8df0('0x2')](function(_0x458b7b){return{'id':_0x458b7b['id'],'fullname':_0x458b7b[_0x8df0('0x3')]};});}return _0x542f6d(_0x6bc725);}catch(_0x5a9ca0){_0x1e2d47(_0x5a9ca0);}});}function getInteractionTags(_0x4e80b1,_0x36b6d8){var _0x3be3f3=[];if(_0x4e80b1){_0x4e80b1['split'](',')['forEach'](function(_0x32a427){_0x3be3f3['push'](_0x36b6d8[_0x32a427]);});}return _0x3be3f3;}function updateWaitingCounter(_0x3abcd3){if(_0x3abcd3['waiting']){_0x3abcd3['waiting']-=0x1;}}function updateInteractionCounters(_0x5a4cfc){_0x5a4cfc[_0x8df0('0x4')]=0x0;_0x5a4cfc[_0x8df0('0x5')]=0x0;_0x5a4cfc['answered']=0x0;_0x5a4cfc[_0x8df0('0x6')]=0x0;_0x5a4cfc[_0x8df0('0x7')]=0x0;_0x5a4cfc[_0x8df0('0x8')]=0x0;if(_0x5a4cfc['closed']){if(_0x5a4cfc['disposition']==='abandoned'){_0x5a4cfc['abandoned']+=0x1;updateWaitingCounter(_0x5a4cfc);}if(_0x5a4cfc[_0x8df0('0x9')]){_0x5a4cfc[_0x8df0('0xa')]+=0x1;if(_0x5a4cfc['talking']){_0x5a4cfc['talking']-=0x1;}}else{if(_0x5a4cfc[_0x8df0('0xb')]){_0x5a4cfc[_0x8df0('0x6')]+=0x1;updateWaitingCounter(_0x5a4cfc);}}}else{if(!_0x5a4cfc[_0x8df0('0x9')]){_0x5a4cfc[_0x8df0('0x4')]+=0x1;}if(_0x5a4cfc['UserId']){_0x5a4cfc[_0x8df0('0x5')]+=0x1;updateWaitingCounter(_0x5a4cfc);}}_0x5a4cfc[_0x8df0('0x8')]+=0x1;return _0x5a4cfc;}function getLastMessageText(_0x26f0bc){return db[_0x8df0('0xc')][_0x8df0('0xd')]({'where':{'$and':[{'MailInteractionId':_0x26f0bc['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x8df0('0xe')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x8df0('0xf')],'order':_0x8df0('0x10'),'raw':!![]})[_0x8df0('0x11')](function(_0x485044){if(_0x485044&&_0x485044[_0x8df0('0xf')]){_0x26f0bc['lastMsgText']=_[_0x8df0('0x12')](_0x485044['plainBody']);}return _0x26f0bc;})['catch'](function(_0xae14c0){throw _0xae14c0;});}exports[_0x8df0('0x13')]=function(_0x17be16,_0x39abc0,_0x504457,_0x3fddce){return new Promise(function(_0x4b4dca,_0x30bf84){return getInteractionUsers(_0x17be16['id'],_0x504457)[_0x8df0('0x11')](function(_0x42b519){_0x17be16[_0x8df0('0x14')]=_0x42b519;return getInteractionTags(_0x17be16[_0x8df0('0x15')],_0x39abc0);})[_0x8df0('0x11')](function(_0x2e5ad0){_0x17be16['Tags']=_0x2e5ad0;delete _0x17be16[_0x8df0('0x15')];return updateInteractionCounters(_0x17be16);})['then'](function(_0x2815e4){if(_0x3fddce){return getLastMessageText(_0x2815e4);}else{return _0x2815e4;}})[_0x8df0('0x11')](function(_0x11e787){_0x4b4dca(_0x11e787);})[_0x8df0('0x16')](function(_0x42085c){_0x30bf84(_0x42085c);});});}; \ No newline at end of file +var _0x5165=['answered','talking','unmanaged','UserId','MailMessage','out','plainBody','-id','then','lastMsgText','trimStart','catch','updateInteraction','TagIds','Tags','lodash','../../mysqldb','fullname','split','forEach','push','waiting','abandoned','total','disposition'];(function(_0x3cdb0d,_0x1d6c58){var _0x151700=function(_0x46a3d8){while(--_0x46a3d8){_0x3cdb0d['push'](_0x3cdb0d['shift']());}};_0x151700(++_0x1d6c58);}(_0x5165,0x122));var _0x5516=function(_0x39fe25,_0x5a4624){_0x39fe25=_0x39fe25-0x0;var _0x15018f=_0x5165[_0x39fe25];return _0x15018f;};'use strict';var _=require(_0x5516('0x0'));var db=require(_0x5516('0x1'))['db'];function getInteractionUsers(_0x2f48dc,_0x4ad0ce){return new Promise(function(_0x51ad72,_0x4134c6){try{var _0x1b7a72=[];if(_0x4ad0ce[_0x2f48dc]){_0x1b7a72=_0x4ad0ce[_0x2f48dc]['map'](function(_0x1c8120){return{'id':_0x1c8120['id'],'fullname':_0x1c8120[_0x5516('0x2')]};});}return _0x51ad72(_0x1b7a72);}catch(_0x5d15a7){_0x4134c6(_0x5d15a7);}});}function getInteractionTags(_0x42f5f1,_0x521545){var _0x465d02=[];if(_0x42f5f1){_0x42f5f1[_0x5516('0x3')](',')[_0x5516('0x4')](function(_0x5c97f7){_0x465d02[_0x5516('0x5')](_0x521545[_0x5c97f7]);});}return _0x465d02;}function updateWaitingCounter(_0x1168d1){if(_0x1168d1[_0x5516('0x6')]){_0x1168d1[_0x5516('0x6')]-=0x1;}}function updateInteractionCounters(_0x3818c8){_0x3818c8['waiting']=0x0;_0x3818c8['talking']=0x0;_0x3818c8['answered']=0x0;_0x3818c8['unmanaged']=0x0;_0x3818c8[_0x5516('0x7')]=0x0;_0x3818c8[_0x5516('0x8')]=0x0;if(_0x3818c8['closed']){if(_0x3818c8[_0x5516('0x9')]===_0x5516('0x7')){_0x3818c8['abandoned']+=0x1;updateWaitingCounter(_0x3818c8);}if(_0x3818c8['UserId']){_0x3818c8[_0x5516('0xa')]+=0x1;if(_0x3818c8['talking']){_0x3818c8[_0x5516('0xb')]-=0x1;}}else{if(_0x3818c8[_0x5516('0x9')]){_0x3818c8[_0x5516('0xc')]+=0x1;updateWaitingCounter(_0x3818c8);}}}else{if(!_0x3818c8[_0x5516('0xd')]){_0x3818c8[_0x5516('0x6')]+=0x1;}if(_0x3818c8[_0x5516('0xd')]){_0x3818c8[_0x5516('0xb')]+=0x1;updateWaitingCounter(_0x3818c8);}}_0x3818c8[_0x5516('0x8')]+=0x1;return _0x3818c8;}function getLastMessageText(_0x162046){return db[_0x5516('0xe')]['findOne']({'where':{'$and':[{'MailInteractionId':_0x162046['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x5516('0xf')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x5516('0x10')],'order':_0x5516('0x11'),'raw':!![]})[_0x5516('0x12')](function(_0x533f3a){if(_0x533f3a&&_0x533f3a[_0x5516('0x10')]){_0x162046[_0x5516('0x13')]=_[_0x5516('0x14')](_0x533f3a[_0x5516('0x10')]);}return _0x162046;})[_0x5516('0x15')](function(_0x5a4571){throw _0x5a4571;});}exports[_0x5516('0x16')]=function(_0xd4eae7,_0xf74c78,_0x47b28b,_0x4518ef){return new Promise(function(_0x3e99c3,_0x13378e){return getInteractionUsers(_0xd4eae7['id'],_0x47b28b)['then'](function(_0x5af507){_0xd4eae7['Users']=_0x5af507;return getInteractionTags(_0xd4eae7[_0x5516('0x17')],_0xf74c78);})[_0x5516('0x12')](function(_0x3b9654){_0xd4eae7[_0x5516('0x18')]=_0x3b9654;delete _0xd4eae7['TagIds'];return updateInteractionCounters(_0xd4eae7);})[_0x5516('0x12')](function(_0xa5e013){if(_0x4518ef){return getLastMessageText(_0xa5e013);}else{return _0xa5e013;}})[_0x5516('0x12')](function(_0x499332){_0x3e99c3(_0x499332);})[_0x5516('0x15')](function(_0x523c24){_0x13378e(_0x523c24);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index efdc7de..8dbafec 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 _0x9533=['capitalize','chat','Website','InteractionId','upperFirst','unknown','_interactions','_interaction_has_tags','isArray','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','stringify','null','findOne','then','update','info','error','exports','../../mysqldb','../../config/logger','mail-interactions','sms-interactions'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0x9533,0x1a5));var _0x3953=function(_0x417a00,_0x1c04e5){_0x417a00=_0x417a00-0x0;var _0x425a69=_0x9533[_0x417a00];return _0x425a69;};'use strict';var _=require('lodash');var db=require(_0x3953('0x0'))['db'];var loggers={'openchannel':require(_0x3953('0x1'))('openchannel-interactions'),'mail':require('../../config/logger')(_0x3953('0x2')),'fax':require(_0x3953('0x1'))('fax-interactions'),'sms':require(_0x3953('0x1'))(_0x3953('0x3')),'chat':require('../../config/logger')('chat-interactions'),'whatsapp':require('../../config/logger')('whatsapp-interactions')};function getAccountFK(_0x15eb98){return _[_0x3953('0x4')](_0x15eb98)+(_0x15eb98===_0x3953('0x5')?_0x3953('0x6'):'Account')+'Id';}function getInteractionFK(_0x33ebe0){return _['capitalize'](_0x33ebe0)+_0x3953('0x7');}function getInteractionId(_0x2eac9f,_0x58c455,_0x27e743){if(_0x2eac9f&&_0x2eac9f[_['upperFirst'](_0x27e743)+_0x3953('0x7')]){return _0x2eac9f[_[_0x3953('0x8')](_0x27e743)+_0x3953('0x7')];}else if(_0x2eac9f&&_0x2eac9f['id']){return _0x2eac9f['id'];}else if(_0x58c455&&_0x58c455['id']){return _0x58c455['id'];}else{return _0x3953('0x9');}}function getInteractionsTables(_0x241fe9){return{'accounts':_0x241fe9+'_'+(_0x241fe9===_0x3953('0x5')?'websites':'accounts'),'interactions':_0x241fe9+_0x3953('0xa'),'interactionsTags':_0x241fe9+_0x3953('0xb'),'messages':_0x241fe9+'_messages','userInteractions':'user_has_'+_0x241fe9+_0x3953('0xa')};}function getSelectedTags(_0x4ace3e){var _0x27a39f=[];if(_0x4ace3e){_0x27a39f=Array[_0x3953('0xc')](_0x4ace3e)?_0x4ace3e:[_0x4ace3e];}return _0x27a39f;}function log(_0x284ff0,_0x4159dd,_0x8f4b91,_0xcbb04f,_0x578977,_0x3e632e){loggers[_0x578977[_0x3953('0xd')]()][_0x284ff0](_0x3953('0xe'),_0x3e632e[_0x3953('0xf')](),_0x4159dd?_0x4159dd['id']:null,_0x4159dd?_0x4159dd[_0x3953('0x10')]:null,_0x4159dd?_0x4159dd['role']:null,getInteractionId(_0x8f4b91,_0xcbb04f,_0x578977),_0x8f4b91?JSON[_0x3953('0x11')](_0x8f4b91):_0x3953('0x12'));}function updateUser(_0x160e1e,_0x2dde40,_0x966754,_0x4b941a,_0x17c525){db[_[_0x3953('0x8')](_0x4b941a)+'Interaction'][_0x3953('0x13')]({'where':{'id':getInteractionId(_0x2dde40,_0x966754,_0x4b941a)}})[_0x3953('0x14')](function(_0x4530b5){if(_0x4530b5){return _0x4530b5[_0x3953('0x15')]({'UserId':_0x160e1e?_0x160e1e['id']:null});}})[_0x3953('0x14')](function(_0x38b7c8){if(_0x38b7c8){log(_0x3953('0x16'),_0x160e1e,_0x2dde40,_0x966754,_0x4b941a,_0x17c525);}})['catch'](function(){log(_0x3953('0x17'),_0x160e1e,_0x2dde40,_0x966754,_0x4b941a,_0x17c525);});}module[_0x3953('0x18')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file +var _0x017a=['then','info','catch','lodash','../../mysqldb','../../config/logger','openchannel-interactions','fax-interactions','chat-interactions','whatsapp-interactions','capitalize','chat','Website','InteractionId','upperFirst','unknown','websites','_interaction_has_tags','user_has_','isArray','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','role','stringify','Interaction','findOne','update'];(function(_0x51ab83,_0x2721b9){var _0x14b6de=function(_0x243483){while(--_0x243483){_0x51ab83['push'](_0x51ab83['shift']());}};_0x14b6de(++_0x2721b9);}(_0x017a,0x153));var _0xa017=function(_0x1f3e88,_0x583f45){_0x1f3e88=_0x1f3e88-0x0;var _0x419b01=_0x017a[_0x1f3e88];return _0x419b01;};'use strict';var _=require(_0xa017('0x0'));var db=require(_0xa017('0x1'))['db'];var loggers={'openchannel':require(_0xa017('0x2'))(_0xa017('0x3')),'mail':require(_0xa017('0x2'))('mail-interactions'),'fax':require(_0xa017('0x2'))(_0xa017('0x4')),'sms':require(_0xa017('0x2'))('sms-interactions'),'chat':require(_0xa017('0x2'))(_0xa017('0x5')),'whatsapp':require(_0xa017('0x2'))(_0xa017('0x6'))};function getAccountFK(_0x4baa13){return _[_0xa017('0x7')](_0x4baa13)+(_0x4baa13===_0xa017('0x8')?_0xa017('0x9'):'Account')+'Id';}function getInteractionFK(_0x276c4c){return _[_0xa017('0x7')](_0x276c4c)+_0xa017('0xa');}function getInteractionId(_0x3df0fd,_0x46055a,_0xf7bb0c){if(_0x3df0fd&&_0x3df0fd[_[_0xa017('0xb')](_0xf7bb0c)+'InteractionId']){return _0x3df0fd[_['upperFirst'](_0xf7bb0c)+_0xa017('0xa')];}else if(_0x3df0fd&&_0x3df0fd['id']){return _0x3df0fd['id'];}else if(_0x46055a&&_0x46055a['id']){return _0x46055a['id'];}else{return _0xa017('0xc');}}function getInteractionsTables(_0x66c43){return{'accounts':_0x66c43+'_'+(_0x66c43===_0xa017('0x8')?_0xa017('0xd'):'accounts'),'interactions':_0x66c43+'_interactions','interactionsTags':_0x66c43+_0xa017('0xe'),'messages':_0x66c43+'_messages','userInteractions':_0xa017('0xf')+_0x66c43+'_interactions'};}function getSelectedTags(_0x2765c7){var _0x24d00b=[];if(_0x2765c7){_0x24d00b=Array[_0xa017('0x10')](_0x2765c7)?_0x2765c7:[_0x2765c7];}return _0x24d00b;}function log(_0x4c8053,_0x57830b,_0x267086,_0x16b3dd,_0x536710,_0x48c89c){loggers[_0x536710[_0xa017('0x11')]()][_0x4c8053](_0xa017('0x12'),_0x48c89c[_0xa017('0x13')](),_0x57830b?_0x57830b['id']:null,_0x57830b?_0x57830b['name']:null,_0x57830b?_0x57830b[_0xa017('0x14')]:null,getInteractionId(_0x267086,_0x16b3dd,_0x536710),_0x267086?JSON[_0xa017('0x15')](_0x267086):'null');}function updateUser(_0x5ba04d,_0x2b2bb3,_0x1452df,_0x421439,_0x5cc614){db[_['upperFirst'](_0x421439)+_0xa017('0x16')][_0xa017('0x17')]({'where':{'id':getInteractionId(_0x2b2bb3,_0x1452df,_0x421439)}})['then'](function(_0x27176e){if(_0x27176e){return _0x27176e[_0xa017('0x18')]({'UserId':_0x5ba04d?_0x5ba04d['id']:null});}})[_0xa017('0x19')](function(_0x102de9){if(_0x102de9){log(_0xa017('0x1a'),_0x5ba04d,_0x2b2bb3,_0x1452df,_0x421439,_0x5cc614);}})[_0xa017('0x1b')](function(){log('error',_0x5ba04d,_0x2b2bb3,_0x1452df,_0x421439,_0x5cc614);});}module['exports']={'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 e2e668a..e19dcaf 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 _0xad29=['status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','users','admin','user','isUserLimit','crypto','util','composable-middleware','../../config/environment','data1','license','split','aes-256-ctr','format','%s:%s:%s','update','base64','utf8','final','parse','hasOwnProperty','use','License','findOne','then','count'];(function(_0x3cfb3c,_0x8b172){var _0x5c3d52=function(_0x26b7c4){while(--_0x26b7c4){_0x3cfb3c['push'](_0x3cfb3c['shift']());}};_0x5c3d52(++_0x8b172);}(_0xad29,0xe7));var _0x9ad2=function(_0x5dbd4b,_0x2fb8fe){_0x5dbd4b=_0x5dbd4b-0x0;var _0x5d2723=_0xad29[_0x5dbd4b];return _0x5d2723;};'use strict';var crypto=require(_0x9ad2('0x0'));var util=require(_0x9ad2('0x1'));var compose=require(_0x9ad2('0x2'));var db=require('../../mysqldb')['db'];var config=require(_0x9ad2('0x3'));function getValueFromLicense(_0x3479e0,_0x16e6c1){if(_0x3479e0&&_0x16e6c1){if(_0x16e6c1[_0x9ad2('0x4')]&&_0x16e6c1[_0x9ad2('0x5')]){var _0x21e4ff=_0x16e6c1[_0x9ad2('0x4')];var _0x243391=_0x16e6c1['license'];var _0x167de6=_0x21e4ff[_0x9ad2('0x6')]('-')[0x4];var _0x5f135a=_0x21e4ff[_0x9ad2('0x6')]('-')[0x0];var _0x5b0e47=crypto['createDecipher'](_0x9ad2('0x7'),util[_0x9ad2('0x8')](_0x9ad2('0x9'),_0x167de6,_0x21e4ff,_0x5f135a));var _0x303730=_0x5b0e47[_0x9ad2('0xa')](_0x243391,_0x9ad2('0xb'),_0x9ad2('0xc'));_0x303730+=_0x5b0e47[_0x9ad2('0xd')]('utf8');var _0x17514f=JSON[_0x9ad2('0xe')](_0x303730);return _0x17514f[_0x9ad2('0xf')](_0x3479e0)?_0x17514f[_0x3479e0]:null;}}return null;}function isLimit(_0x2838ce,_0x43ccca,_0x166857,_0x14abfa){var _0xe78ede=_0x43ccca;return compose()[_0x9ad2('0x10')](function(_0x5f599f,_0x1d777a,_0x3db5a7){return db[_0x9ad2('0x11')][_0x9ad2('0x12')]({'where':{'id':0x1},'raw':!![]})[_0x9ad2('0x13')](function(_0xc1e081){var _0x3af1a0=getValueFromLicense(_0x2838ce,_0xc1e081);return _0x3af1a0?_0x3af1a0:_0xe78ede;})[_0x9ad2('0x13')](function(_0x2fa845){_0xe78ede=_0x2fa845;return _0x166857[_0x9ad2('0x14')](_0x14abfa);})[_0x9ad2('0x13')](function(_0x18de81){if(_0x18de81>=_0xe78ede){return _0x1d777a[_0x9ad2('0x15')](0x193)[_0x9ad2('0x16')]({'message':util[_0x9ad2('0x8')](_0x9ad2('0x17'),_0x2838ce)});}_0x3db5a7();})['catch'](function(_0x46992c){_0x3db5a7(_0x46992c);});});}function isUserLimit(){return isLimit(_0x9ad2('0x18'),0x1,db['User'],{'where':{'$or':[{'role':_0x9ad2('0x19')},{'role':_0x9ad2('0x1a')}]}});}exports[_0x9ad2('0x1b')]=isUserLimit; \ No newline at end of file +var _0x5631=['../../config/environment','license','data1','split','createDecipher','aes-256-ctr','format','base64','utf8','final','hasOwnProperty','use','License','findOne','then','count','status','json','catch','users','User','admin','user','crypto','composable-middleware','../../mysqldb'];(function(_0xb548b,_0x18a7bd){var _0x188c99=function(_0x1c0ca3){while(--_0x1c0ca3){_0xb548b['push'](_0xb548b['shift']());}};_0x188c99(++_0x18a7bd);}(_0x5631,0x65));var _0x1563=function(_0x3da612,_0x332456){_0x3da612=_0x3da612-0x0;var _0x1a9d1d=_0x5631[_0x3da612];return _0x1a9d1d;};'use strict';var crypto=require(_0x1563('0x0'));var util=require('util');var compose=require(_0x1563('0x1'));var db=require(_0x1563('0x2'))['db'];var config=require(_0x1563('0x3'));function getValueFromLicense(_0x339f62,_0x36c053){if(_0x339f62&&_0x36c053){if(_0x36c053['data1']&&_0x36c053[_0x1563('0x4')]){var _0xae1f50=_0x36c053[_0x1563('0x5')];var _0x2d534b=_0x36c053[_0x1563('0x4')];var _0x221975=_0xae1f50['split']('-')[0x4];var _0x574d99=_0xae1f50[_0x1563('0x6')]('-')[0x0];var _0x7d704d=crypto[_0x1563('0x7')](_0x1563('0x8'),util[_0x1563('0x9')]('%s:%s:%s',_0x221975,_0xae1f50,_0x574d99));var _0x3a38cb=_0x7d704d['update'](_0x2d534b,_0x1563('0xa'),_0x1563('0xb'));_0x3a38cb+=_0x7d704d[_0x1563('0xc')](_0x1563('0xb'));var _0x388ba9=JSON['parse'](_0x3a38cb);return _0x388ba9[_0x1563('0xd')](_0x339f62)?_0x388ba9[_0x339f62]:null;}}return null;}function isLimit(_0x828cb8,_0x16d092,_0xf628ea,_0x4bbbbf){var _0x4d07ef=_0x16d092;return compose()[_0x1563('0xe')](function(_0x5511f1,_0x1b4571,_0x54aee6){return db[_0x1563('0xf')][_0x1563('0x10')]({'where':{'id':0x1},'raw':!![]})[_0x1563('0x11')](function(_0x161b88){var _0x4e18e1=getValueFromLicense(_0x828cb8,_0x161b88);return _0x4e18e1?_0x4e18e1:_0x4d07ef;})['then'](function(_0x157ba0){_0x4d07ef=_0x157ba0;return _0xf628ea[_0x1563('0x12')](_0x4bbbbf);})['then'](function(_0x4672c1){if(_0x4672c1>=_0x4d07ef){return _0x1b4571[_0x1563('0x13')](0x193)[_0x1563('0x14')]({'message':util['format']('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x828cb8)});}_0x54aee6();})[_0x1563('0x15')](function(_0x4a62bd){_0x54aee6(_0x4a62bd);});});}function isUserLimit(){return isLimit(_0x1563('0x16'),0x1,db[_0x1563('0x17')],{'where':{'$or':[{'role':_0x1563('0x18')},{'role':_0x1563('0x19')}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 2c75831..767a4d1 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 _0x597c=['field','\x20AS\x20','includes','$ne','text','\x20OR\x20','$in','IN\x20?','$notIn','NOT\x20IN\x20?','$eq','<>\x20?','$substring','$startsWith','$endsWith','<\x20?','>\x20?','<=\x20?','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','utcOffset','hours','seconds','lodash','moment','parseSearch','sqlOperator','startsWith','and','replace','[$and]','[$or]','split','length','slice','forEach','shift','match','filter','indexOf','map','conditions','push','DATE','operator','$between','value','$gt','$lte','add','days','format','YYYY-MM-DD','castTo','CAST('];(function(_0x40f90d,_0x1e2f79){var _0x40de98=function(_0x3c2cd6){while(--_0x3c2cd6){_0x40f90d['push'](_0x40f90d['shift']());}};_0x40de98(++_0x1e2f79);}(_0x597c,0x168));var _0xc597=function(_0x46eec5,_0x526775){_0x46eec5=_0x46eec5-0x0;var _0x19054f=_0x597c[_0x46eec5];return _0x19054f;};'use strict';var _=require(_0xc597('0x0'));var moment=require(_0xc597('0x1'));exports[_0xc597('0x2')]=function(_0x292ae7){var _0x2d9287={'conditions':[]};_0x2d9287[_0xc597('0x3')]=_[_0xc597('0x4')](_0x292ae7,'[$or]')?'or':_0xc597('0x5');var _0x657d06=_0x292ae7[_0xc597('0x6')](_0xc597('0x7'),'')[_0xc597('0x6')](_0xc597('0x8'),'')[_0xc597('0x9')]('||');for(var _0x376bed=0x0;_0x376bed<_0x657d06[_0xc597('0xa')];_0x376bed++){var _0x4a5caf=_0x657d06[_0x376bed]['split'](':=');var _0x839bd1=_0x4a5caf[0x0];var _0x50e8c0=_0x4a5caf[_0xc597('0xb')](0x1);_0x50e8c0[_0xc597('0xc')](function(_0x52e02f){var _0x2c4e55=_0x52e02f[_0xc597('0x9')]('[')[_0xc597('0xd')]();var _0x26096f=_0x52e02f[_0xc597('0xe')](/\[(.*?)\]/g);_0x26096f[_0xc597('0xc')](function(_0x186013){var _0x29bda1=_0x186013[_0xc597('0x9')]('[')[_0xc597('0xf')](function(_0x26af30){return _0x26af30[_0xc597('0x10')](']')>-0x1;})[_0xc597('0x11')](function(_0x914763){return _0x914763[_0xc597('0x9')](']')[0x0];})[0x0];_0x2d9287[_0xc597('0x12')][_0xc597('0x13')]({'field':_0x839bd1,'operator':_0x2c4e55,'value':_0x29bda1});});});}return _0x2d9287;};exports['buildExpression']=function(_0x29f09c,_0x3653dd,_0x5d506f){var _0x5cf6d9={};if(_0x3653dd===_0xc597('0x14')){if(_0x5d506f[_0xc597('0x15')]==='$eq'){_0x5d506f[_0xc597('0x15')]=_0xc597('0x16');_0x5d506f[_0xc597('0x17')]+=','+_0x5d506f[_0xc597('0x17')];}else if(_['includes']([_0xc597('0x18'),_0xc597('0x19')],_0x5d506f[_0xc597('0x15')])){_0x5d506f[_0xc597('0x17')]=moment(_0x5d506f[_0xc597('0x17')])[_0xc597('0x1a')](0x1,_0xc597('0x1b'))[_0xc597('0x1c')](_0xc597('0x1d'));}}if(_0x5d506f[_0xc597('0x1e')]){_0x3653dd=_0x5d506f[_0xc597('0x1e')];_0x5cf6d9['text']=_0xc597('0x1f')+_0x29f09c+'.'+_0x5d506f[_0xc597('0x20')]+_0xc597('0x21')+_0x5d506f[_0xc597('0x1e')]+')\x20'+parseOperator(_0x5d506f[_0xc597('0x15')]);}else{_0x5cf6d9['text']=_0x29f09c+'.'+_0x5d506f[_0xc597('0x20')]+'\x20'+parseOperator(_0x5d506f[_0xc597('0x15')]);}if(_[_0xc597('0x22')]([_0xc597('0x23'),'$notIn'],_0x5d506f[_0xc597('0x15')]))_0x5cf6d9[_0xc597('0x24')]='('+_0x5cf6d9[_0xc597('0x24')]+_0xc597('0x25')+_0x29f09c+'.'+_0x5d506f['field']+'\x20IS\x20NULL)';_0x5cf6d9[_0xc597('0x17')]=parseValue(_0x3653dd,_0x5d506f[_0xc597('0x15')],_0x5d506f[_0xc597('0x17')]);return _0x5cf6d9;};function parseOperator(_0x45b670){var _0x324105;switch(_0x45b670){case _0xc597('0x26'):_0x324105=_0xc597('0x27');break;case _0xc597('0x28'):_0x324105=_0xc597('0x29');break;case _0xc597('0x2a'):_0x324105='=\x20?';break;case _0xc597('0x23'):_0x324105=_0xc597('0x2b');break;case _0xc597('0x2c'):case _0xc597('0x2d'):case _0xc597('0x2e'):_0x324105='LIKE\x20?';break;case'$lt':_0x324105=_0xc597('0x2f');break;case _0xc597('0x18'):_0x324105=_0xc597('0x30');break;case'$lte':_0x324105=_0xc597('0x31');break;case'$gte':_0x324105=_0xc597('0x32');break;case _0xc597('0x16'):_0x324105=_0xc597('0x33');break;}return _0x324105;}function parseValue(_0x413328,_0x1f8559,_0x2ea7e9){var _0x58e993={'start':undefined,'end':undefined};switch(_0x1f8559){case _0xc597('0x26'):case'$notIn':_0x58e993[_0xc597('0x34')]=_0x2ea7e9['split'](',');break;case _0xc597('0x2c'):_0x58e993[_0xc597('0x34')]='%'+_0x2ea7e9+'%';break;case'$startsWith':_0x58e993[_0xc597('0x34')]=_0x2ea7e9+'%';break;case _0xc597('0x2e'):_0x58e993['start']='%'+_0x2ea7e9;break;case _0xc597('0x16'):var _0x400fb7=_0x2ea7e9[_0xc597('0x9')](',');var _0x2ea7e9=_0x400fb7[_0xc597('0xd')]();var _0x337255=_0x400fb7['pop']();if(_0x413328===_0xc597('0x14')){_0x2ea7e9=moment(_0x2ea7e9)['utcOffset'](0x0,!![])[_0xc597('0x1c')]();_0x337255=moment(_0x337255)[_0xc597('0x35')](0x0,!![])[_0xc597('0x1a')](0x17,_0xc597('0x36'))[_0xc597('0x1a')](0x3b,'minutes')[_0xc597('0x1a')](0x3b,_0xc597('0x37'))[_0xc597('0x1c')]();}_0x58e993={'start':_0x2ea7e9,'end':_0x337255};break;default:_0x58e993['start']=_0x2ea7e9;break;}return _0x58e993;} \ No newline at end of file +var _0x4a60=['length','split','slice','shift','match','filter','map','conditions','push','buildExpression','operator','$between','value','$gt','format','castTo','text','CAST(','field','\x20AS\x20','includes','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','=\x20?','$substring','$endsWith','$lt','<\x20?','>\x20?','$lte','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','pop','DATE','utcOffset','add','hours','seconds','lodash','moment','parseSearch','sqlOperator','startsWith','[$or]','and','[$and]','replace'];(function(_0x14c65b,_0x10b662){var _0x7ed29a=function(_0x70006){while(--_0x70006){_0x14c65b['push'](_0x14c65b['shift']());}};_0x7ed29a(++_0x10b662);}(_0x4a60,0x1e6));var _0x04a6=function(_0x15f27e,_0x547fea){_0x15f27e=_0x15f27e-0x0;var _0x18da4f=_0x4a60[_0x15f27e];return _0x18da4f;};'use strict';var _=require(_0x04a6('0x0'));var moment=require(_0x04a6('0x1'));exports[_0x04a6('0x2')]=function(_0x23feba){var _0x3a34af={'conditions':[]};_0x3a34af[_0x04a6('0x3')]=_[_0x04a6('0x4')](_0x23feba,_0x04a6('0x5'))?'or':_0x04a6('0x6');var _0x5cd25b=_0x23feba['replace'](_0x04a6('0x7'),'')[_0x04a6('0x8')]('[$or]','')['split']('||');for(var _0xcce1be=0x0;_0xcce1be<_0x5cd25b[_0x04a6('0x9')];_0xcce1be++){var _0x175a9d=_0x5cd25b[_0xcce1be][_0x04a6('0xa')](':=');var _0x12be26=_0x175a9d[0x0];var _0x487622=_0x175a9d[_0x04a6('0xb')](0x1);_0x487622['forEach'](function(_0x25cf2c){var _0x5cc51b=_0x25cf2c[_0x04a6('0xa')]('[')[_0x04a6('0xc')]();var _0x9dac4c=_0x25cf2c[_0x04a6('0xd')](/\[(.*?)\]/g);_0x9dac4c['forEach'](function(_0x357299){var _0x133eef=_0x357299['split']('[')[_0x04a6('0xe')](function(_0xbb0e5f){return _0xbb0e5f['indexOf'](']')>-0x1;})[_0x04a6('0xf')](function(_0x4eb555){return _0x4eb555[_0x04a6('0xa')](']')[0x0];})[0x0];_0x3a34af[_0x04a6('0x10')][_0x04a6('0x11')]({'field':_0x12be26,'operator':_0x5cc51b,'value':_0x133eef});});});}return _0x3a34af;};exports[_0x04a6('0x12')]=function(_0x16f0f1,_0x213f93,_0x5e7951){var _0x24076e={};if(_0x213f93==='DATE'){if(_0x5e7951[_0x04a6('0x13')]==='$eq'){_0x5e7951[_0x04a6('0x13')]=_0x04a6('0x14');_0x5e7951[_0x04a6('0x15')]+=','+_0x5e7951['value'];}else if(_['includes']([_0x04a6('0x16'),'$lte'],_0x5e7951[_0x04a6('0x13')])){_0x5e7951['value']=moment(_0x5e7951[_0x04a6('0x15')])['add'](0x1,'days')[_0x04a6('0x17')]('YYYY-MM-DD');}}if(_0x5e7951[_0x04a6('0x18')]){_0x213f93=_0x5e7951[_0x04a6('0x18')];_0x24076e[_0x04a6('0x19')]=_0x04a6('0x1a')+_0x16f0f1+'.'+_0x5e7951[_0x04a6('0x1b')]+_0x04a6('0x1c')+_0x5e7951[_0x04a6('0x18')]+')\x20'+parseOperator(_0x5e7951[_0x04a6('0x13')]);}else{_0x24076e[_0x04a6('0x19')]=_0x16f0f1+'.'+_0x5e7951[_0x04a6('0x1b')]+'\x20'+parseOperator(_0x5e7951[_0x04a6('0x13')]);}if(_[_0x04a6('0x1d')]([_0x04a6('0x1e'),_0x04a6('0x1f')],_0x5e7951['operator']))_0x24076e[_0x04a6('0x19')]='('+_0x24076e[_0x04a6('0x19')]+_0x04a6('0x20')+_0x16f0f1+'.'+_0x5e7951[_0x04a6('0x1b')]+_0x04a6('0x21');_0x24076e['value']=parseValue(_0x213f93,_0x5e7951[_0x04a6('0x13')],_0x5e7951[_0x04a6('0x15')]);return _0x24076e;};function parseOperator(_0x2e4090){var _0x1ed026;switch(_0x2e4090){case _0x04a6('0x22'):_0x1ed026=_0x04a6('0x23');break;case'$notIn':_0x1ed026=_0x04a6('0x24');break;case'$eq':_0x1ed026=_0x04a6('0x25');break;case _0x04a6('0x1e'):_0x1ed026='<>\x20?';break;case _0x04a6('0x26'):case'$startsWith':case _0x04a6('0x27'):_0x1ed026='LIKE\x20?';break;case _0x04a6('0x28'):_0x1ed026=_0x04a6('0x29');break;case'$gt':_0x1ed026=_0x04a6('0x2a');break;case _0x04a6('0x2b'):_0x1ed026=_0x04a6('0x2c');break;case _0x04a6('0x2d'):_0x1ed026=_0x04a6('0x2e');break;case _0x04a6('0x14'):_0x1ed026=_0x04a6('0x2f');break;}return _0x1ed026;}function parseValue(_0x3e798d,_0x3ad685,_0x338270){var _0x2a8a42={'start':undefined,'end':undefined};switch(_0x3ad685){case _0x04a6('0x22'):case _0x04a6('0x1f'):_0x2a8a42[_0x04a6('0x30')]=_0x338270[_0x04a6('0xa')](',');break;case'$substring':_0x2a8a42['start']='%'+_0x338270+'%';break;case'$startsWith':_0x2a8a42[_0x04a6('0x30')]=_0x338270+'%';break;case'$endsWith':_0x2a8a42[_0x04a6('0x30')]='%'+_0x338270;break;case _0x04a6('0x14'):var _0x3cd728=_0x338270[_0x04a6('0xa')](',');var _0x338270=_0x3cd728[_0x04a6('0xc')]();var _0x462271=_0x3cd728[_0x04a6('0x31')]();if(_0x3e798d===_0x04a6('0x32')){_0x338270=moment(_0x338270)[_0x04a6('0x33')](0x0,!![])[_0x04a6('0x17')]();_0x462271=moment(_0x462271)[_0x04a6('0x33')](0x0,!![])[_0x04a6('0x34')](0x17,_0x04a6('0x35'))[_0x04a6('0x34')](0x3b,'minutes')[_0x04a6('0x34')](0x3b,_0x04a6('0x36'))[_0x04a6('0x17')]();}_0x2a8a42={'start':_0x338270,'end':_0x462271};break;default:_0x2a8a42['start']=_0x338270;break;}return _0x2a8a42;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 499d3c1..6d65f1b 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 _0x5aae=['isString','unset','hasOwnProperty','isNumeric','match','getFullTextValue','forEach','push','replace','{EXPR}','join','getOptions','query','$id','map','keys','filters','intersection','model','attributes','order','where','filter','value','merge','type','VIRTUAL','lower','options','include','includeAll','lodash','sequelize','moment','parse','includes','alias','fields','raw','split','isEmpty','forOwn','find','$gte','format','YYYY-MM-DD','utc','$lte','subtract','name','uniqueid','isArray','limit','offset','sort','indexOf','priority','cast','substr','DESC','col','unsigned','ASC','omit','length','isObject'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5aae,0xe5));var _0xe5aa=function(_0x477b78,_0x302499){_0x477b78=_0x477b78-0x0;var _0x2f3f99=_0x5aae[_0x477b78];return _0x2f3f99;};'use strict';var _=require(_0xe5aa('0x0'));var sequelize=require(_0xe5aa('0x1'));var moment=require(_0xe5aa('0x2'));var db=require('../../mysqldb')['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x4fe0a8){var _0x496b52=['ne'];try{var _0x2d37cc=JSON[_0xe5aa('0x3')](_0x4fe0a8);var _0x564f1e=Object['keys'](_0x2d37cc)[0x0];return _0x496b52[_0xe5aa('0x4')](_0x564f1e);}catch(_0x5e2b61){return![];}}function getOperatorValue(_0x11eb0b){var _0x9d4d8b=JSON['parse'](_0x11eb0b);var _0x20120b=Object['keys'](_0x9d4d8b)[0x0];var _0x438b1a=_0x9d4d8b[_0x20120b];return{['$'+_0x20120b]:_0x438b1a};}function parseIncludeModel(_0x4843bf){var _0x6537f2=JSON[_0xe5aa('0x3')](_0x4843bf);return{'model':db[_0x6537f2['model']],'as':_0x6537f2[_0xe5aa('0x5')],'attributes':_0x6537f2[_0xe5aa('0x6')],'raw':_0x6537f2[_0xe5aa('0x7')]};}exports[_0xe5aa('0x6')]=function(_0x5c3512){var _0x1663c4=null;if(_0x5c3512){_0x1663c4=_0x5c3512[_0xe5aa('0x8')](',');}return _0x1663c4;};exports['filters']=function(_0x31617f,_0x4069fb){var _0x5d30c5={};if(!_[_0xe5aa('0x9')](_0x31617f)){_[_0xe5aa('0xa')](_0x31617f,function(_0x4df815,_0xc99033){try{if(_0x4069fb){var _0x1f9c6f=_[_0xe5aa('0xb')](_0x4069fb,{'name':_0xc99033})||{};if(hasSequelizeOperator(_0x4df815)){_0x5d30c5[_0xc99033]=getOperatorValue(_0x4df815);}else if(_0x1f9c6f['type']==='DATE'&&_['isPlainObject'](_0x4df815)){var _0x240783=JSON[_0xe5aa('0x3')](_0x4df815);var _0xe136ca={'$gte':moment(moment(_0x240783[_0xe5aa('0xc')])[_0xe5aa('0xd')](_0xe5aa('0xe')))[_0xe5aa('0xf')]()[_0xe5aa('0xd')](),'$lte':moment(moment(_0x240783[_0xe5aa('0x10')])[_0xe5aa('0xd')](_0xe5aa('0xe')))[_0xe5aa('0xf')]()[_0xe5aa('0x11')](0x1,'s')[_0xe5aa('0xd')]()};_0x5d30c5[_0xc99033]=_0xe136ca;}else if(_0x1f9c6f[_0xe5aa('0x12')]===_0xe5aa('0x13')){_0x5d30c5[_0xc99033]=_0x4df815;}else{_0x5d30c5[_0xc99033]=_[_0xe5aa('0x14')](_0x4df815)?_0x4df815:JSON[_0xe5aa('0x3')](_0x4df815);}}else{_0x5d30c5[_0xc99033]=_['isArray'](_0x4df815)?_0x4df815:JSON['parse'](_0x4df815);}}catch(_0x18cca0){_0x5d30c5[_0xc99033]=_0x4df815[_0xe5aa('0x8')](',');}});}return _0x5d30c5;};exports[_0xe5aa('0x15')]=function(_0x3a3f11){_0x3a3f11=parseInt(_0x3a3f11,0xa);if(!_0x3a3f11||_0x3a3f11<0x0){_0x3a3f11=LIMIT_VALUE;}return _0x3a3f11;};exports[_0xe5aa('0x16')]=function(_0x9d72f5){_0x9d72f5=parseInt(_0x9d72f5,0xa);if(!_0x9d72f5||_0x9d72f5<0x0){_0x9d72f5=0x0;}return _0x9d72f5;};exports[_0xe5aa('0x17')]=function(_0x197d28){var _0x632849,_0x28aa98=null;if(_0x197d28){_0x632849=_0x197d28[_0xe5aa('0x8')](',');_0x28aa98=_['map'](_0x632849,function(_0x39cfad){if(_0x39cfad[_0xe5aa('0x18')]('-')===0x0){return[_0x39cfad===_0xe5aa('0x19')?sequelize[_0xe5aa('0x1a')](sequelize['col'](_0xe5aa('0x19')),'unsigned'):_0x39cfad[_0xe5aa('0x1b')](0x1),_0xe5aa('0x1c')];}else{return[_0x39cfad===_0xe5aa('0x19')?sequelize[_0xe5aa('0x1a')](sequelize[_0xe5aa('0x1d')](_0xe5aa('0x19')),_0xe5aa('0x1e')):_0x39cfad,_0xe5aa('0x1f')];}});}return _0x28aa98;};exports[_0xe5aa('0x20')]=function(_0x3e4ec3,_0x1f0e95){if(_['isEmpty'](_0x3e4ec3)){return _0x3e4ec3;}if(_[_0xe5aa('0x14')](_0x3e4ec3)){for(var _0x314b30=0x0;_0x314b30<_0x3e4ec3[_0xe5aa('0x21')];_0x314b30+=0x1){_0x3e4ec3[_0x314b30]=this[_0xe5aa('0x20')](_0x3e4ec3[_0x314b30],_0x1f0e95);}return _0x3e4ec3;}if(!_[_0xe5aa('0x22')](_0x3e4ec3)){return _0x3e4ec3;}if(_[_0xe5aa('0x23')](_0x1f0e95)){_0x1f0e95=[_0x1f0e95];}if(!_[_0xe5aa('0x14')](_0x1f0e95)){return _0x3e4ec3;}for(var _0x28487d=0x0;_0x28487d<_0x1f0e95['length'];_0x28487d+=0x1){_[_0xe5aa('0x24')](_0x3e4ec3,_0x1f0e95[_0x28487d]);}for(var _0x53c05a in _0x3e4ec3){if(_0x3e4ec3[_0xe5aa('0x25')](_0x53c05a)){_0x3e4ec3[_0x53c05a]=this[_0xe5aa('0x20')](_0x3e4ec3[_0x53c05a],_0x1f0e95);}}return _0x3e4ec3;};exports[_0xe5aa('0x26')]=function(_0x26688e){return _0x26688e[_0xe5aa('0x27')](RegExp('^[+]?[0-9]*$'))?!![]:![];};exports['isEmail']=function(_0x2067de){return _0x2067de[_0xe5aa('0x27')](/^\S+@\S+$/)?!![]:![];};exports[_0xe5aa('0x28')]=function(_0x3ef550,_0x147846){var _0x88fcb0=[];var _0x13dcb2=/[ `!@#$%^&*()_\-?~]/;var _0x5f2313=_0x147846?'\x22{EXPR}\x22':'{EXPR}';_0x3ef550[_0xe5aa('0x8')](/[ ,]+/)[_0xe5aa('0x29')](function(_0x46f774){_0x46f774=_0x46f774['replace'](/([^:]")"+/g,'$1');_0x46f774='+'+_0x46f774+'*';var _0x59313b=_0x46f774[_0xe5aa('0x27')](_0x13dcb2);if(_0x59313b){_0x46f774='\x22'+_0x46f774+'\x22';}_0x88fcb0[_0xe5aa('0x2a')](_0x46f774);});_0x5f2313=_0x5f2313[_0xe5aa('0x2b')](_0xe5aa('0x2c'),_0x88fcb0[_0xe5aa('0x2d')]('\x20'));return _0x5f2313;};exports[_0xe5aa('0x2e')]=function(_0x3457ba,_0xc3e2b,_0x583b8e){var _0x194f3d={},_0x36ba9f={};if(_0xc3e2b[_0xe5aa('0x2f')][_0xe5aa('0x30')]){_0xc3e2b[_0xe5aa('0x2f')]['id']=_0xc3e2b[_0xe5aa('0x2f')][_0xe5aa('0x30')];delete _0xc3e2b['query']['$id'];}_0x194f3d['model']=_[_0xe5aa('0x31')](_0x3457ba,_0xe5aa('0x12'));_0x194f3d[_0xe5aa('0x2f')]=_[_0xe5aa('0x32')](_0xc3e2b['query']);_0x194f3d[_0xe5aa('0x33')]=_[_0xe5aa('0x34')](_0x194f3d[_0xe5aa('0x35')],_0x194f3d[_0xe5aa('0x2f')]);_0x36ba9f[_0xe5aa('0x36')]=_[_0xe5aa('0x34')](_0x194f3d['model'],this[_0xe5aa('0x6')](_0xc3e2b[_0xe5aa('0x2f')][_0xe5aa('0x6')]));_0x36ba9f[_0xe5aa('0x36')]=_0x36ba9f[_0xe5aa('0x36')][_0xe5aa('0x21')]?_0x36ba9f[_0xe5aa('0x36')]:_0x194f3d[_0xe5aa('0x35')];if(!_0xc3e2b[_0xe5aa('0x2f')]['hasOwnProperty']('nolimit')){_0x36ba9f[_0xe5aa('0x15')]=this[_0xe5aa('0x15')](_0xc3e2b[_0xe5aa('0x2f')]['limit']);_0x36ba9f['offset']=this[_0xe5aa('0x16')](_0xc3e2b[_0xe5aa('0x2f')]['offset']);}_0x36ba9f[_0xe5aa('0x37')]=this[_0xe5aa('0x17')](_0xc3e2b[_0xe5aa('0x2f')]['sort']);_0x36ba9f[_0xe5aa('0x38')]=this['filters'](_['pick'](_0xc3e2b['query'],_0x194f3d[_0xe5aa('0x33')]),_0x3457ba);if(_0xc3e2b['query'][_0xe5aa('0x39')]){var _0x58d386=_0x3457ba;var _0x420bb9=_0xc3e2b['query'][_0xe5aa('0x39')];if(typeof _0x420bb9==='object'){_0x58d386=_[_0xe5aa('0x39')](_0x3457ba,function(_0x56f70a){return _[_0xe5aa('0x4')](_0x420bb9['columns'],_0x56f70a[_0xe5aa('0x12')]);});_0x420bb9=_0x420bb9[_0xe5aa('0x3a')];}_0x36ba9f[_0xe5aa('0x38')]=_[_0xe5aa('0x3b')](_0x36ba9f['where'],{'$or':_[_0xe5aa('0x31')](_0x58d386,function(_0x5eb81e){if(_0x5eb81e[_0xe5aa('0x3c')]!==_0xe5aa('0x3d')){if(_0x583b8e){return sequelize[_0xe5aa('0x38')](sequelize['fn'](_0xe5aa('0x3e'),sequelize['col'](_0x5eb81e['name'])),{'$like':sequelize['fn']('lower','%'+_0xc3e2b['query'][_0xe5aa('0x39')]+'%')});}else{var _0x3082f6={};_0x3082f6[_0x5eb81e['name']]={'$like':'%'+_0xc3e2b[_0xe5aa('0x2f')][_0xe5aa('0x39')]+'%'};return _0x3082f6;}}})});}_0x36ba9f=_['merge']({},_0x36ba9f,_0xc3e2b[_0xe5aa('0x3f')]);return _0x36ba9f;};exports[_0xe5aa('0x40')]=function(_0x2b9541){var _0x56a9e6=[];if(_0x2b9541[_0xe5aa('0x41')]){_0x56a9e6['push']({'all':!![]});}else if(_0x2b9541[_0xe5aa('0x40')]){if(Array[_0xe5aa('0x14')](_0x2b9541[_0xe5aa('0x40')])){_0x56a9e6=Object['keys'](_0x2b9541['include'])['map'](function(_0x559e5a){return parseIncludeModel(_0x2b9541[_0xe5aa('0x40')][_0x559e5a]);});}else{var _0x2254c7=parseIncludeModel(_0x2b9541[_0xe5aa('0x40')]);_0x56a9e6[_0xe5aa('0x2a')](_0x2254c7);}}return _0x56a9e6;}; \ No newline at end of file +var _0x3de2=['includeAll','lodash','moment','../../mysqldb','keys','includes','parse','model','fields','filters','isEmpty','forOwn','find','type','DATE','isPlainObject','format','YYYY-MM-DD','utc','subtract','name','uniqueid','isArray','split','sort','map','indexOf','priority','cast','unsigned','substr','DESC','col','length','omit','isObject','isString','match','^[+]?[0-9]*$','isEmail','getFullTextValue','{EXPR}','forEach','replace','push','query','$id','intersection','attributes','limit','offset','order','where','pick','filter','object','value','merge','lower','include'];(function(_0x5026d1,_0x2834a3){var _0x1a27cc=function(_0xb6eb84){while(--_0xb6eb84){_0x5026d1['push'](_0x5026d1['shift']());}};_0x1a27cc(++_0x2834a3);}(_0x3de2,0x79));var _0x23de=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0x3de2[_0x82129b];return _0x2ae5dc;};'use strict';var _=require(_0x23de('0x0'));var sequelize=require('sequelize');var moment=require(_0x23de('0x1'));var db=require(_0x23de('0x2'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x42993b){var _0x2f04b7=['ne'];try{var _0x48e21b=JSON['parse'](_0x42993b);var _0x13f461=Object[_0x23de('0x3')](_0x48e21b)[0x0];return _0x2f04b7[_0x23de('0x4')](_0x13f461);}catch(_0x1aa9c3){return![];}}function getOperatorValue(_0x485414){var _0x32f39c=JSON['parse'](_0x485414);var _0x44ee25=Object[_0x23de('0x3')](_0x32f39c)[0x0];var _0x2f9906=_0x32f39c[_0x44ee25];return{['$'+_0x44ee25]:_0x2f9906};}function parseIncludeModel(_0x33cb3){var _0x131fb3=JSON[_0x23de('0x5')](_0x33cb3);return{'model':db[_0x131fb3[_0x23de('0x6')]],'as':_0x131fb3['alias'],'attributes':_0x131fb3[_0x23de('0x7')],'raw':_0x131fb3['raw']};}exports[_0x23de('0x7')]=function(_0x879ac9){var _0x4c9ea3=null;if(_0x879ac9){_0x4c9ea3=_0x879ac9['split'](',');}return _0x4c9ea3;};exports[_0x23de('0x8')]=function(_0x4d64ce,_0x167254){var _0x5245e4={};if(!_[_0x23de('0x9')](_0x4d64ce)){_[_0x23de('0xa')](_0x4d64ce,function(_0x1d8c06,_0x32e241){try{if(_0x167254){var _0x9a82cd=_[_0x23de('0xb')](_0x167254,{'name':_0x32e241})||{};if(hasSequelizeOperator(_0x1d8c06)){_0x5245e4[_0x32e241]=getOperatorValue(_0x1d8c06);}else if(_0x9a82cd[_0x23de('0xc')]===_0x23de('0xd')&&_[_0x23de('0xe')](_0x1d8c06)){var _0x1593fc=JSON[_0x23de('0x5')](_0x1d8c06);var _0x32781b={'$gte':moment(moment(_0x1593fc['$gte'])[_0x23de('0xf')](_0x23de('0x10')))[_0x23de('0x11')]()[_0x23de('0xf')](),'$lte':moment(moment(_0x1593fc['$lte'])['format'](_0x23de('0x10')))[_0x23de('0x11')]()[_0x23de('0x12')](0x1,'s')[_0x23de('0xf')]()};_0x5245e4[_0x32e241]=_0x32781b;}else if(_0x9a82cd[_0x23de('0x13')]===_0x23de('0x14')){_0x5245e4[_0x32e241]=_0x1d8c06;}else{_0x5245e4[_0x32e241]=_[_0x23de('0x15')](_0x1d8c06)?_0x1d8c06:JSON[_0x23de('0x5')](_0x1d8c06);}}else{_0x5245e4[_0x32e241]=_['isArray'](_0x1d8c06)?_0x1d8c06:JSON[_0x23de('0x5')](_0x1d8c06);}}catch(_0x51a884){_0x5245e4[_0x32e241]=_0x1d8c06[_0x23de('0x16')](',');}});}return _0x5245e4;};exports['limit']=function(_0x5db027){_0x5db027=parseInt(_0x5db027,0xa);if(!_0x5db027||_0x5db027<0x0){_0x5db027=LIMIT_VALUE;}return _0x5db027;};exports['offset']=function(_0x24aaf9){_0x24aaf9=parseInt(_0x24aaf9,0xa);if(!_0x24aaf9||_0x24aaf9<0x0){_0x24aaf9=0x0;}return _0x24aaf9;};exports[_0x23de('0x17')]=function(_0xd239eb){var _0xf62c54,_0x12103c=null;if(_0xd239eb){_0xf62c54=_0xd239eb[_0x23de('0x16')](',');_0x12103c=_[_0x23de('0x18')](_0xf62c54,function(_0x1ac1c6){if(_0x1ac1c6[_0x23de('0x19')]('-')===0x0){return[_0x1ac1c6===_0x23de('0x1a')?sequelize[_0x23de('0x1b')](sequelize['col']('priority'),_0x23de('0x1c')):_0x1ac1c6[_0x23de('0x1d')](0x1),_0x23de('0x1e')];}else{return[_0x1ac1c6===_0x23de('0x1a')?sequelize[_0x23de('0x1b')](sequelize[_0x23de('0x1f')]('priority'),_0x23de('0x1c')):_0x1ac1c6,'ASC'];}});}return _0x12103c;};exports['omit']=function(_0x356d2b,_0x17398e){if(_[_0x23de('0x9')](_0x356d2b)){return _0x356d2b;}if(_[_0x23de('0x15')](_0x356d2b)){for(var _0xca0675=0x0;_0xca0675<_0x356d2b[_0x23de('0x20')];_0xca0675+=0x1){_0x356d2b[_0xca0675]=this[_0x23de('0x21')](_0x356d2b[_0xca0675],_0x17398e);}return _0x356d2b;}if(!_[_0x23de('0x22')](_0x356d2b)){return _0x356d2b;}if(_[_0x23de('0x23')](_0x17398e)){_0x17398e=[_0x17398e];}if(!_[_0x23de('0x15')](_0x17398e)){return _0x356d2b;}for(var _0x143742=0x0;_0x143742<_0x17398e[_0x23de('0x20')];_0x143742+=0x1){_['unset'](_0x356d2b,_0x17398e[_0x143742]);}for(var _0x530733 in _0x356d2b){if(_0x356d2b['hasOwnProperty'](_0x530733)){_0x356d2b[_0x530733]=this['omit'](_0x356d2b[_0x530733],_0x17398e);}}return _0x356d2b;};exports['isNumeric']=function(_0x1d7d9f){return _0x1d7d9f[_0x23de('0x24')](RegExp(_0x23de('0x25')))?!![]:![];};exports[_0x23de('0x26')]=function(_0x3041d8){return _0x3041d8['match'](/^\S+@\S+$/)?!![]:![];};exports[_0x23de('0x27')]=function(_0x47d4bf,_0x2e08af){var _0xe8d7c8=[];var _0x21a3e2=/[ `!@#$%^&*()_\-?~]/;var _0x39de41=_0x2e08af?'\x22{EXPR}\x22':_0x23de('0x28');_0x47d4bf[_0x23de('0x16')](/[ ,]+/)[_0x23de('0x29')](function(_0x6b2383){_0x6b2383=_0x6b2383[_0x23de('0x2a')](/([^:]")"+/g,'$1');_0x6b2383='+'+_0x6b2383+'*';var _0x48c004=_0x6b2383[_0x23de('0x24')](_0x21a3e2);if(_0x48c004){_0x6b2383='\x22'+_0x6b2383+'\x22';}_0xe8d7c8[_0x23de('0x2b')](_0x6b2383);});_0x39de41=_0x39de41[_0x23de('0x2a')](_0x23de('0x28'),_0xe8d7c8['join']('\x20'));return _0x39de41;};exports['getOptions']=function(_0x3dcdf6,_0x3966b4,_0x58f09d){var _0x4e79b7={},_0x463ee5={};if(_0x3966b4[_0x23de('0x2c')][_0x23de('0x2d')]){_0x3966b4[_0x23de('0x2c')]['id']=_0x3966b4[_0x23de('0x2c')][_0x23de('0x2d')];delete _0x3966b4[_0x23de('0x2c')][_0x23de('0x2d')];}_0x4e79b7[_0x23de('0x6')]=_[_0x23de('0x18')](_0x3dcdf6,_0x23de('0x13'));_0x4e79b7[_0x23de('0x2c')]=_['keys'](_0x3966b4[_0x23de('0x2c')]);_0x4e79b7[_0x23de('0x8')]=_[_0x23de('0x2e')](_0x4e79b7[_0x23de('0x6')],_0x4e79b7[_0x23de('0x2c')]);_0x463ee5[_0x23de('0x2f')]=_[_0x23de('0x2e')](_0x4e79b7[_0x23de('0x6')],this[_0x23de('0x7')](_0x3966b4[_0x23de('0x2c')][_0x23de('0x7')]));_0x463ee5['attributes']=_0x463ee5[_0x23de('0x2f')][_0x23de('0x20')]?_0x463ee5['attributes']:_0x4e79b7['model'];if(!_0x3966b4['query']['hasOwnProperty']('nolimit')){_0x463ee5[_0x23de('0x30')]=this[_0x23de('0x30')](_0x3966b4[_0x23de('0x2c')]['limit']);_0x463ee5[_0x23de('0x31')]=this[_0x23de('0x31')](_0x3966b4['query'][_0x23de('0x31')]);}_0x463ee5[_0x23de('0x32')]=this[_0x23de('0x17')](_0x3966b4[_0x23de('0x2c')][_0x23de('0x17')]);_0x463ee5[_0x23de('0x33')]=this[_0x23de('0x8')](_[_0x23de('0x34')](_0x3966b4[_0x23de('0x2c')],_0x4e79b7[_0x23de('0x8')]),_0x3dcdf6);if(_0x3966b4[_0x23de('0x2c')][_0x23de('0x35')]){var _0x2f78ec=_0x3dcdf6;var _0x529131=_0x3966b4[_0x23de('0x2c')]['filter'];if(typeof _0x529131===_0x23de('0x36')){_0x2f78ec=_['filter'](_0x3dcdf6,function(_0x3ce58c){return _[_0x23de('0x4')](_0x529131['columns'],_0x3ce58c['name']);});_0x529131=_0x529131[_0x23de('0x37')];}_0x463ee5['where']=_[_0x23de('0x38')](_0x463ee5[_0x23de('0x33')],{'$or':_[_0x23de('0x18')](_0x2f78ec,function(_0x563b24){if(_0x563b24[_0x23de('0xc')]!=='VIRTUAL'){if(_0x58f09d){return sequelize[_0x23de('0x33')](sequelize['fn'](_0x23de('0x39'),sequelize[_0x23de('0x1f')](_0x563b24[_0x23de('0x13')])),{'$like':sequelize['fn'](_0x23de('0x39'),'%'+_0x3966b4[_0x23de('0x2c')][_0x23de('0x35')]+'%')});}else{var _0x90a07e={};_0x90a07e[_0x563b24['name']]={'$like':'%'+_0x3966b4[_0x23de('0x2c')][_0x23de('0x35')]+'%'};return _0x90a07e;}}})});}_0x463ee5=_[_0x23de('0x38')]({},_0x463ee5,_0x3966b4['options']);return _0x463ee5;};exports[_0x23de('0x3a')]=function(_0x8df32d){var _0x54751f=[];if(_0x8df32d[_0x23de('0x3b')]){_0x54751f[_0x23de('0x2b')]({'all':!![]});}else if(_0x8df32d[_0x23de('0x3a')]){if(Array[_0x23de('0x15')](_0x8df32d[_0x23de('0x3a')])){_0x54751f=Object[_0x23de('0x3')](_0x8df32d[_0x23de('0x3a')])[_0x23de('0x18')](function(_0x9ee170){return parseIncludeModel(_0x8df32d['include'][_0x9ee170]);});}else{var _0x4a5c9d=parseIncludeModel(_0x8df32d[_0x23de('0x3a')]);_0x54751f['push'](_0x4a5c9d);}}return _0x54751f;}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index 188bfef..8387457 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 _0xa057=['unknown','unavailable','isNil','voiceStatus','faxStatus','mailStatus','openchannelStatus','smsStatus','whatsappStatus','request','Agents','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','then','catch','pause','*pause','getAgentStatus','isArray','startCase','Queue','map','findOne','getAgents','flatten','uniq','value','getAgentIdsByQueues','busy','getAgentIdsByStatus','resolve','includes','findAll','fullname','mailPause','whatsappPause','pauseType','find','merge','globalStatus','getSortedAgentsIdsByStatus','fields','order','startsWith','DESC','ASC','getUpdatedSortOptions','fullname,internal','internal','substring','indexOf','validateSortParameter','sort','toLowerCase','sortAgentsByStatus','online','lastLoginAt','lastPauseAt','address','faxPause','openchannelCapacity','mailCapacity','smsCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','whatsappCurrentCapacity','chatStatus','chatStatusTime','openchannelStatusTime','mailStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','omit','pick','filterAgentAttributes','name','role','userpic','smsStatusTime','chatCapacity','faxCurrentCapacity','lodash','jayson/promise','client','http','chatPause','openchannelPause','smsPause','voicePause','every','filter','length','idle'];(function(_0x1ec4c4,_0x943eb1){var _0x4977fb=function(_0x2009a2){while(--_0x2009a2){_0x1ec4c4['push'](_0x1ec4c4['shift']());}};_0x4977fb(++_0x943eb1);}(_0xa057,0x123));var _0x7a05=function(_0xd33f7e,_0x4d42d6){_0xd33f7e=_0xd33f7e-0x0;var _0x346abe=_0xa057[_0xd33f7e];return _0x346abe;};'use strict';var _=require(_0x7a05('0x0'));var jayson=require(_0x7a05('0x1'));var db=require('../../mysqldb')['db'];var amiClient=jayson[_0x7a05('0x2')][_0x7a05('0x3')]({'port':0x232a});var routingClient=jayson[_0x7a05('0x2')]['http']({'port':0x232c});function isAgentPaused(_0x2bcab9,_0x3d346d){var _0x5404f2=[_0x2bcab9[_0x7a05('0x4')],_0x2bcab9['faxPause'],_0x2bcab9['mailPause'],_0x2bcab9[_0x7a05('0x5')],_0x2bcab9[_0x7a05('0x6')],_0x2bcab9[_0x7a05('0x7')],_0x2bcab9['whatsappPause']];if(!_0x3d346d)return _[_0x7a05('0x8')](_0x5404f2);var _0x2135d2=_[_0x7a05('0x9')](_0x5404f2);return _0x2135d2['length']>0x0&&_0x2135d2[_0x7a05('0xa')]<_0x5404f2[_0x7a05('0xa')]?!![]:![];}function isIdle(_0x417ca9){return _0x417ca9===_0x7a05('0xb')||_0x417ca9===_0x7a05('0xc')||_0x417ca9===_0x7a05('0xd')||_0x417ca9==='ringing'||_[_0x7a05('0xe')](_0x417ca9);}function isAgentIdle(_0x463a80){if(_0x463a80['voiceStatus']!=='idle'&&_0x463a80[_0x7a05('0x7')]){_0x463a80[_0x7a05('0xf')]='pause';return![];}return _['every']([_0x463a80['chatStatus'],_0x463a80[_0x7a05('0x10')],_0x463a80[_0x7a05('0x11')],_0x463a80[_0x7a05('0x12')],_0x463a80[_0x7a05('0x13')],_0x463a80[_0x7a05('0xf')],_0x463a80[_0x7a05('0x14')]],isIdle);}function getRealtimeAgents(){return amiClient[_0x7a05('0x15')](_0x7a05('0x16'),{})['then'](function(_0x49d016){if(_0x49d016[_0x7a05('0x17')]){throw new Error(_0x7a05('0x18'));}var _0x480c8b=_0x49d016[_0x7a05('0x19')];return routingClient[_0x7a05('0x15')]('Agents',{})[_0x7a05('0x1a')](function(_0x449d86){if(_0x449d86[_0x7a05('0x17')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)');}var _0x519666=_0x449d86[_0x7a05('0x19')];return _['merge']({},_0x480c8b,_0x519666);});})[_0x7a05('0x1b')](function(_0x37a562){throw _0x37a562;});}exports['getRealtimeAgents']=getRealtimeAgents;function getAgentStatus(_0x5a6588){var _0x4d8c17=_0x7a05('0xc');if(isAgentPaused(_0x5a6588))_0x4d8c17=_0x7a05('0x1c');else if(isAgentPaused(_0x5a6588,!![]))_0x4d8c17=_0x7a05('0x1d');else if(isAgentIdle(_0x5a6588))_0x4d8c17=_0x7a05('0xb');else _0x4d8c17='busy';return _0x4d8c17;}exports[_0x7a05('0x1e')]=getAgentStatus;function getAgentIdsByQueues(_0x391ecf,_0x3e9ef2){var _0x593c1b=_[_0x7a05('0x1f')](_0x391ecf)?_0x391ecf:[_0x391ecf];var _0x5e30b9=_[_0x7a05('0x20')](_0x3e9ef2)+_0x7a05('0x21');var _0x1b62de=_[_0x7a05('0x22')](_0x593c1b,function(_0xb23a2a){return db[_0x5e30b9][_0x7a05('0x23')]({'where':{'id':_0xb23a2a}})[_0x7a05('0x1a')](function(_0x219a94){if(!_0x219a94)return[];return _0x219a94[_0x7a05('0x24')]({'attributes':['id'],'raw':!![]});});});return Promise['all'](_0x1b62de)['then'](function(_0x5a2fc5){var _0x39fb1c=_(_0x5a2fc5)[_0x7a05('0x25')]()[_0x7a05('0x22')]('id')[_0x7a05('0x26')]()[_0x7a05('0x27')]();return _0x39fb1c;});}exports[_0x7a05('0x28')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x2fafe7,_0x1cc98f,_0xc45b3e){try{if(_0x1cc98f['length']>0x0){_0x2fafe7=_0x2fafe7['filter'](function(_0x20a4f2){return _0x1cc98f['includes'](_0x20a4f2['id']);});}var _0x4f26bc=_0x2fafe7[_0x7a05('0x9')](function(_0x2ceb54){var _0x76f131=_0x7a05('0x29');if(isAgentIdle(_0x2ceb54)){_0x76f131=_0x7a05('0xb');}return _0x76f131===_0xc45b3e;});return _['map'](_0x4f26bc,'id');}catch(_0x1106ad){throw _0x1106ad;}}exports[_0x7a05('0x2a')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x37dbf1,_0x479c10,_0x3886a9){return Promise[_0x7a05('0x2b')]()[_0x7a05('0x1a')](function(){if(_0x479c10['length']>0x0){_0x37dbf1=_0x37dbf1[_0x7a05('0x9')](function(_0x1ecb7e){return _0x479c10[_0x7a05('0x2c')](_0x1ecb7e['id']);});}return _0x37dbf1;})[_0x7a05('0x1a')](function(){return db['User'][_0x7a05('0x2d')]({'attributes':['id','name',_0x7a05('0x2e'),_0x7a05('0x4'),'faxPause',_0x7a05('0x2f'),_0x7a05('0x5'),_0x7a05('0x6'),'voicePause',_0x7a05('0x30'),_0x7a05('0x31')],'where':{'id':{'$in':_['map'](_0x37dbf1,'id')}},'raw':!![]});})[_0x7a05('0x1a')](function(_0x40ed80){return _0x40ed80['map'](function(_0x5ec5e1){var _0x3de609=_[_0x7a05('0x32')](_0x37dbf1,['id',_0x5ec5e1['id']]);var _0x547c40=filterAgentAttributes(_0x3de609);_[_0x7a05('0x33')](_0x5ec5e1,_0x547c40);_0x5ec5e1[_0x7a05('0x34')]=getAgentStatus(_0x5ec5e1);return _0x5ec5e1;});})[_0x7a05('0x1a')](function(_0x238ad2){var _0x523566=sortAgentsByStatus(_0x238ad2,_0x3886a9);return _[_0x7a05('0x22')](_0x523566,'id');})[_0x7a05('0x1b')](function(_0x460a49){throw _0x460a49;});}exports[_0x7a05('0x35')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x58600c){var _0x5049d0={'fields':[],'order':null};var _0x3286df=_0x58600c['split'](',');_0x5049d0[_0x7a05('0x36')]=_['filter'](_0x3286df,function(_0x4d6da8){if(!_0x4d6da8[_0x7a05('0x2c')](_0x7a05('0x34'))){return!![];}_0x5049d0[_0x7a05('0x37')]=_[_0x7a05('0x38')](_0x4d6da8,'-')?_0x7a05('0x39'):_0x7a05('0x3a');return![];});return _0x5049d0;}exports[_0x7a05('0x3b')]=getUpdatedSortOptions;function validateSortParameter(_0xcace9b){if(!_0xcace9b){_0xcace9b=_0x7a05('0x3c');}if(_0xcace9b[_0x7a05('0x2c')]('fullname')&&!_0xcace9b['includes'](_0x7a05('0x3d'))){var _0x2d090d=_0xcace9b[_0x7a05('0x3e')](0x0,_0xcace9b[_0x7a05('0x3f')]('fullname'));_0xcace9b+=','+_0x2d090d+_0x7a05('0x3d');}return _0xcace9b;}exports[_0x7a05('0x40')]=validateSortParameter;function sortAgentsByStatus(_0x59b47c,_0x35078e){var _0xf632a=_0x59b47c[_0x7a05('0x41')](function(_0x44122e,_0x10b64a){if(_0x44122e[_0x7a05('0x34')]===_0x10b64a[_0x7a05('0x34')]){if(_0x44122e[_0x7a05('0x34')]==='pause'){if(_0x35078e===_0x7a05('0x39')){return(_0x44122e[_0x7a05('0x31')]||'')<(_0x10b64a[_0x7a05('0x31')]||'')||_0x44122e['fullname'][_0x7a05('0x42')]()>_0x10b64a[_0x7a05('0x2e')][_0x7a05('0x42')]()?0x1:-0x1;}else{return(_0x44122e[_0x7a05('0x31')]||'')<(_0x10b64a['pauseType']||'')||_0x44122e[_0x7a05('0x2e')]['toLowerCase']()>_0x10b64a['fullname'][_0x7a05('0x42')]()?-0x1:0x1;}}else{if(_0x35078e===_0x7a05('0x39')){return _0x44122e['fullname'][_0x7a05('0x42')]()<_0x10b64a[_0x7a05('0x2e')][_0x7a05('0x42')]()?0x1:-0x1;}else{return _0x44122e[_0x7a05('0x2e')][_0x7a05('0x42')]()<_0x10b64a[_0x7a05('0x2e')][_0x7a05('0x42')]()?-0x1:0x1;}}}else{if(_0x35078e===_0x7a05('0x39')){return _0x44122e[_0x7a05('0x34')]<_0x10b64a[_0x7a05('0x34')]?0x1:-0x1;}else{return _0x44122e[_0x7a05('0x34')]<_0x10b64a[_0x7a05('0x34')]?-0x1:0x1;}}});return _0xf632a;}exports[_0x7a05('0x43')]=sortAgentsByStatus;function filterAgentAttributes(_0x127e0c){var _0x2e7d3a=['userpic',_0x7a05('0x44'),_0x7a05('0x45'),_0x7a05('0x46'),_0x7a05('0x31'),'lastPauseAt',_0x7a05('0x3d'),_0x7a05('0x47'),_0x7a05('0x4'),_0x7a05('0x5'),'mailPause',_0x7a05('0x6'),'whatsappPause',_0x7a05('0x48'),_0x7a05('0x7'),'chatCapacity',_0x7a05('0x49'),_0x7a05('0x4a'),_0x7a05('0x4b'),'whatsappCapacity',_0x7a05('0x4c'),_0x7a05('0x4d'),_0x7a05('0x4e'),_0x7a05('0x4f'),'smsCurrentCapacity',_0x7a05('0x50'),'faxCurrentCapacity',_0x7a05('0x51'),_0x7a05('0x12'),_0x7a05('0x11'),_0x7a05('0x13'),_0x7a05('0x14'),_0x7a05('0x10'),_0x7a05('0xf'),_0x7a05('0x52'),_0x7a05('0x53'),_0x7a05('0x54'),'smsStatusTime',_0x7a05('0x55'),_0x7a05('0x56'),_0x7a05('0x57'),_0x7a05('0x58'),_0x7a05('0x59'),_0x7a05('0x5a'),_0x7a05('0x5b'),'phoneBarEnableAutomaticScreenRecording'];var _0x197b83=[_0x7a05('0x4'),_0x7a05('0x5'),'mailPause','smsPause',_0x7a05('0x30'),_0x7a05('0x48'),'voicePause',_0x7a05('0x44')];var _0x7534da=_(_0x127e0c)[_0x7a05('0x5c')](_0x197b83)[_0x7a05('0x5d')](_0x2e7d3a)[_0x7a05('0x27')]();return _0x7534da;}exports[_0x7a05('0x5e')]=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id',_0x7a05('0x5f'),'fullname',_0x7a05('0x60'),_0x7a05('0x3d'),_0x7a05('0x44'),_0x7a05('0x34'),_0x7a05('0x61'),_0x7a05('0x45'),_0x7a05('0x31'),_0x7a05('0x46'),_0x7a05('0x48'),_0x7a05('0x4'),_0x7a05('0x2f'),'openchannelPause',_0x7a05('0x6'),_0x7a05('0x7'),_0x7a05('0x30'),_0x7a05('0x51'),_0x7a05('0x10'),'mailStatus','openchannelStatus',_0x7a05('0x13'),_0x7a05('0xf'),'whatsappStatus','chatStatusTime',_0x7a05('0x56'),_0x7a05('0x54'),'openchannelStatusTime',_0x7a05('0x62'),_0x7a05('0x57'),_0x7a05('0x55'),_0x7a05('0x63'),_0x7a05('0x4c'),_0x7a05('0x4a'),_0x7a05('0x49'),_0x7a05('0x4b'),'whatsappCapacity',_0x7a05('0x4d'),_0x7a05('0x64'),_0x7a05('0x4f'),_0x7a05('0x4e'),'smsCurrentCapacity',_0x7a05('0x50'),_0x7a05('0x5b'),'phoneBarEnableAutomaticScreenRecording','destconnectedlinenum','onhold',_0x7a05('0x58'),'screenrecording'];}exports['getRealtimeAgentsQueryFields']=getRealtimeAgentsQueryFields; \ No newline at end of file +var _0x2015=['faxStatusTime','onhold','getRealtimeAgentsQueryFields','lodash','jayson/promise','../../mysqldb','client','http','chatPause','faxPause','mailPause','openchannelPause','smsPause','voicePause','whatsappPause','every','length','idle','unknown','ringing','isNil','voiceStatus','pause','chatStatus','faxStatus','mailStatus','smsStatus','Agents','then','request','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','result','getRealtimeAgents','*pause','busy','isArray','startCase','Queue','map','findOne','getAgents','all','uniq','getAgentIdsByQueues','filter','getAgentIdsByStatus','resolve','includes','findAll','name','fullname','pauseType','merge','globalStatus','getSortedAgentsIdsByStatus','split','fields','startsWith','DESC','ASC','getUpdatedSortOptions','fullname,internal','substring','indexOf','internal','sort','toLowerCase','sortAgentsByStatus','userpic','online','lastPauseAt','address','chatCapacity','openchannelCapacity','mailCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','smsCurrentCapacity','faxCurrentCapacity','chatStatusTime','openchannelStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','voiceStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','omit','pick','value','role','openchannelStatus','whatsappStatus'];(function(_0x112aa9,_0x51a391){var _0xebc169=function(_0x52ce81){while(--_0x52ce81){_0x112aa9['push'](_0x112aa9['shift']());}};_0xebc169(++_0x51a391);}(_0x2015,0x193));var _0x5201=function(_0x357d5b,_0x16667f){_0x357d5b=_0x357d5b-0x0;var _0xfb1028=_0x2015[_0x357d5b];return _0xfb1028;};'use strict';var _=require(_0x5201('0x0'));var jayson=require(_0x5201('0x1'));var db=require(_0x5201('0x2'))['db'];var amiClient=jayson[_0x5201('0x3')][_0x5201('0x4')]({'port':0x232a});var routingClient=jayson[_0x5201('0x3')][_0x5201('0x4')]({'port':0x232c});function isAgentPaused(_0x137f29,_0x598fde){var _0x95d6ae=[_0x137f29[_0x5201('0x5')],_0x137f29[_0x5201('0x6')],_0x137f29[_0x5201('0x7')],_0x137f29[_0x5201('0x8')],_0x137f29[_0x5201('0x9')],_0x137f29[_0x5201('0xa')],_0x137f29[_0x5201('0xb')]];if(!_0x598fde)return _[_0x5201('0xc')](_0x95d6ae);var _0x6fc2c3=_['filter'](_0x95d6ae);return _0x6fc2c3[_0x5201('0xd')]>0x0&&_0x6fc2c3[_0x5201('0xd')]<_0x95d6ae['length']?!![]:![];}function isIdle(_0x26e0d1){return _0x26e0d1===_0x5201('0xe')||_0x26e0d1===_0x5201('0xf')||_0x26e0d1==='unavailable'||_0x26e0d1===_0x5201('0x10')||_[_0x5201('0x11')](_0x26e0d1);}function isAgentIdle(_0x356a38){if(_0x356a38[_0x5201('0x12')]!==_0x5201('0xe')&&_0x356a38[_0x5201('0xa')]){_0x356a38[_0x5201('0x12')]=_0x5201('0x13');return![];}return _[_0x5201('0xc')]([_0x356a38[_0x5201('0x14')],_0x356a38[_0x5201('0x15')],_0x356a38[_0x5201('0x16')],_0x356a38['openchannelStatus'],_0x356a38[_0x5201('0x17')],_0x356a38[_0x5201('0x12')],_0x356a38['whatsappStatus']],isIdle);}function getRealtimeAgents(){return amiClient['request'](_0x5201('0x18'),{})[_0x5201('0x19')](function(_0x224f98){if(_0x224f98['error']){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)');}var _0x26856f=_0x224f98['result'];return routingClient[_0x5201('0x1a')]('Agents',{})[_0x5201('0x19')](function(_0x4d44d8){if(_0x4d44d8[_0x5201('0x1b')]){throw new Error(_0x5201('0x1c'));}var _0x2c230a=_0x4d44d8[_0x5201('0x1d')];return _['merge']({},_0x26856f,_0x2c230a);});})['catch'](function(_0x34665f){throw _0x34665f;});}exports[_0x5201('0x1e')]=getRealtimeAgents;function getAgentStatus(_0x468317){var _0x54a901=_0x5201('0xf');if(isAgentPaused(_0x468317))_0x54a901=_0x5201('0x13');else if(isAgentPaused(_0x468317,!![]))_0x54a901=_0x5201('0x1f');else if(isAgentIdle(_0x468317))_0x54a901=_0x5201('0xe');else _0x54a901=_0x5201('0x20');return _0x54a901;}exports['getAgentStatus']=getAgentStatus;function getAgentIdsByQueues(_0x15fade,_0x32aa89){var _0x33c2bb=_[_0x5201('0x21')](_0x15fade)?_0x15fade:[_0x15fade];var _0x1e2582=_[_0x5201('0x22')](_0x32aa89)+_0x5201('0x23');var _0x4d4142=_[_0x5201('0x24')](_0x33c2bb,function(_0x428ce9){return db[_0x1e2582][_0x5201('0x25')]({'where':{'id':_0x428ce9}})[_0x5201('0x19')](function(_0x3c655b){if(!_0x3c655b)return[];return _0x3c655b[_0x5201('0x26')]({'attributes':['id'],'raw':!![]});});});return Promise[_0x5201('0x27')](_0x4d4142)[_0x5201('0x19')](function(_0x171d20){var _0x2c7a2c=_(_0x171d20)['flatten']()[_0x5201('0x24')]('id')[_0x5201('0x28')]()['value']();return _0x2c7a2c;});}exports[_0x5201('0x29')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x5bc174,_0x4edc6a,_0x13d4f0){try{if(_0x4edc6a[_0x5201('0xd')]>0x0){_0x5bc174=_0x5bc174[_0x5201('0x2a')](function(_0x58f914){return _0x4edc6a['includes'](_0x58f914['id']);});}var _0x3b3d53=_0x5bc174[_0x5201('0x2a')](function(_0x453c7b){var _0x470f84='busy';if(isAgentIdle(_0x453c7b)){_0x470f84=_0x5201('0xe');}return _0x470f84===_0x13d4f0;});return _[_0x5201('0x24')](_0x3b3d53,'id');}catch(_0x19c352){throw _0x19c352;}}exports[_0x5201('0x2b')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x380107,_0x4bd170,_0x50764f){return Promise[_0x5201('0x2c')]()[_0x5201('0x19')](function(){if(_0x4bd170[_0x5201('0xd')]>0x0){_0x380107=_0x380107[_0x5201('0x2a')](function(_0x32d1ca){return _0x4bd170[_0x5201('0x2d')](_0x32d1ca['id']);});}return _0x380107;})[_0x5201('0x19')](function(){return db['User'][_0x5201('0x2e')]({'attributes':['id',_0x5201('0x2f'),_0x5201('0x30'),'chatPause',_0x5201('0x6'),_0x5201('0x7'),_0x5201('0x8'),_0x5201('0x9'),_0x5201('0xa'),_0x5201('0xb'),_0x5201('0x31')],'where':{'id':{'$in':_[_0x5201('0x24')](_0x380107,'id')}},'raw':!![]});})[_0x5201('0x19')](function(_0xb3a564){return _0xb3a564[_0x5201('0x24')](function(_0x2de67f){var _0x51568d=_['find'](_0x380107,['id',_0x2de67f['id']]);var _0xe0a16e=filterAgentAttributes(_0x51568d);_[_0x5201('0x32')](_0x2de67f,_0xe0a16e);_0x2de67f[_0x5201('0x33')]=getAgentStatus(_0x2de67f);return _0x2de67f;});})[_0x5201('0x19')](function(_0x31c963){var _0x1528b3=sortAgentsByStatus(_0x31c963,_0x50764f);return _[_0x5201('0x24')](_0x1528b3,'id');})['catch'](function(_0x4311fa){throw _0x4311fa;});}exports[_0x5201('0x34')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0xf86d5d){var _0x4ce9dc={'fields':[],'order':null};var _0x2fbe6b=_0xf86d5d[_0x5201('0x35')](',');_0x4ce9dc[_0x5201('0x36')]=_['filter'](_0x2fbe6b,function(_0x434c22){if(!_0x434c22[_0x5201('0x2d')]('globalStatus')){return!![];}_0x4ce9dc['order']=_[_0x5201('0x37')](_0x434c22,'-')?_0x5201('0x38'):_0x5201('0x39');return![];});return _0x4ce9dc;}exports[_0x5201('0x3a')]=getUpdatedSortOptions;function validateSortParameter(_0x235841){if(!_0x235841){_0x235841=_0x5201('0x3b');}if(_0x235841['includes'](_0x5201('0x30'))&&!_0x235841['includes']('internal')){var _0x14bc22=_0x235841[_0x5201('0x3c')](0x0,_0x235841[_0x5201('0x3d')](_0x5201('0x30')));_0x235841+=','+_0x14bc22+_0x5201('0x3e');}return _0x235841;}exports['validateSortParameter']=validateSortParameter;function sortAgentsByStatus(_0x21d83a,_0x4a34b8){var _0x161769=_0x21d83a[_0x5201('0x3f')](function(_0x26e8c6,_0x62a2a4){if(_0x26e8c6[_0x5201('0x33')]===_0x62a2a4['globalStatus']){if(_0x26e8c6['globalStatus']===_0x5201('0x13')){if(_0x4a34b8===_0x5201('0x38')){return(_0x26e8c6[_0x5201('0x31')]||'')<(_0x62a2a4[_0x5201('0x31')]||'')||_0x26e8c6[_0x5201('0x30')]['toLowerCase']()>_0x62a2a4['fullname'][_0x5201('0x40')]()?0x1:-0x1;}else{return(_0x26e8c6[_0x5201('0x31')]||'')<(_0x62a2a4[_0x5201('0x31')]||'')||_0x26e8c6[_0x5201('0x30')][_0x5201('0x40')]()>_0x62a2a4[_0x5201('0x30')][_0x5201('0x40')]()?-0x1:0x1;}}else{if(_0x4a34b8===_0x5201('0x38')){return _0x26e8c6[_0x5201('0x30')][_0x5201('0x40')]()<_0x62a2a4[_0x5201('0x30')]['toLowerCase']()?0x1:-0x1;}else{return _0x26e8c6['fullname'][_0x5201('0x40')]()<_0x62a2a4[_0x5201('0x30')][_0x5201('0x40')]()?-0x1:0x1;}}}else{if(_0x4a34b8===_0x5201('0x38')){return _0x26e8c6[_0x5201('0x33')]<_0x62a2a4['globalStatus']?0x1:-0x1;}else{return _0x26e8c6['globalStatus']<_0x62a2a4[_0x5201('0x33')]?-0x1:0x1;}}});return _0x161769;}exports[_0x5201('0x41')]=sortAgentsByStatus;function filterAgentAttributes(_0x144cd4){var _0x13b7f2=[_0x5201('0x42'),_0x5201('0x43'),'lastLoginAt','lastPauseAt','pauseType',_0x5201('0x44'),'internal',_0x5201('0x45'),_0x5201('0x5'),_0x5201('0x8'),_0x5201('0x7'),_0x5201('0x9'),'whatsappPause',_0x5201('0x6'),_0x5201('0xa'),_0x5201('0x46'),_0x5201('0x47'),_0x5201('0x48'),_0x5201('0x49'),_0x5201('0x4a'),_0x5201('0x4b'),_0x5201('0x4c'),_0x5201('0x4d'),'mailCurrentCapacity',_0x5201('0x4e'),'whatsappCurrentCapacity',_0x5201('0x4f'),_0x5201('0x14'),'openchannelStatus',_0x5201('0x16'),_0x5201('0x17'),'whatsappStatus',_0x5201('0x15'),'voiceStatus',_0x5201('0x50'),_0x5201('0x51'),_0x5201('0x52'),_0x5201('0x53'),_0x5201('0x54'),'faxStatusTime',_0x5201('0x55'),_0x5201('0x56'),_0x5201('0x57'),_0x5201('0x58'),_0x5201('0x59'),_0x5201('0x5a')];var _0x35fcac=[_0x5201('0x5'),_0x5201('0x8'),_0x5201('0x7'),_0x5201('0x9'),_0x5201('0xb'),'faxPause',_0x5201('0xa'),_0x5201('0x43')];var _0x131c96=_(_0x144cd4)[_0x5201('0x5b')](_0x35fcac)[_0x5201('0x5c')](_0x13b7f2)[_0x5201('0x5d')]();return _0x131c96;}exports['filterAgentAttributes']=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id',_0x5201('0x2f'),_0x5201('0x30'),_0x5201('0x5e'),_0x5201('0x3e'),_0x5201('0x43'),_0x5201('0x33'),_0x5201('0x42'),'lastLoginAt','pauseType',_0x5201('0x44'),_0x5201('0x6'),_0x5201('0x5'),_0x5201('0x7'),_0x5201('0x8'),'smsPause',_0x5201('0xa'),_0x5201('0xb'),_0x5201('0x14'),'faxStatus',_0x5201('0x16'),_0x5201('0x5f'),_0x5201('0x17'),_0x5201('0x12'),_0x5201('0x60'),'chatStatusTime',_0x5201('0x61'),'mailStatusTime',_0x5201('0x51'),_0x5201('0x53'),_0x5201('0x55'),_0x5201('0x54'),_0x5201('0x46'),'faxCapacity',_0x5201('0x48'),'openchannelCapacity',_0x5201('0x49'),_0x5201('0x4a'),_0x5201('0x4c'),_0x5201('0x4f'),'mailCurrentCapacity',_0x5201('0x4d'),_0x5201('0x4e'),'whatsappCurrentCapacity',_0x5201('0x59'),_0x5201('0x5a'),_0x5201('0x57'),_0x5201('0x62'),_0x5201('0x56'),'screenrecording'];}exports[_0x5201('0x63')]=getRealtimeAgentsQueryFields; \ No newline at end of file diff --git a/server/components/realtime/queues.js b/server/components/realtime/queues.js index 4de8a59..9261419 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 _0x356a=['voice','outbound','find','pick','jayson/promise','util','client','http','available','loggedIn','paused','waiting','busy','inUse','invalid','loggedInDb','notInUse','onHold','ringing','ringInUse','talking','unavailable','unknown','pTalking','message','statusMessage','dialActive','dialMethod','startPredictive','startProgressive','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','startCase','Queues','then','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','catch','inbound','concat','map'];(function(_0x109828,_0x44c0ef){var _0x3585b7=function(_0x12e76d){while(--_0x12e76d){_0x109828['push'](_0x109828['shift']());}};_0x3585b7(++_0x44c0ef);}(_0x356a,0x1ac));var _0xa356=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x356a[_0x397e5f];return _0x5302b8;};'use strict';var _=require('lodash');var jayson=require(_0xa356('0x0'));var util=require(_0xa356('0x1'));var amiClient=jayson[_0xa356('0x2')][_0xa356('0x3')]({'port':0x232a});var routingClient=jayson['client'][_0xa356('0x3')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0xa356('0x4'),_0xa356('0x5'),_0xa356('0x6'),_0xa356('0x7')];var VOICE_QUEUE_ATTRIBUTES=[_0xa356('0x8'),_0xa356('0x9'),_0xa356('0xa'),_0xa356('0xb'),_0xa356('0xc'),_0xa356('0xd'),_0xa356('0xe'),_0xa356('0xf'),_0xa356('0x10'),_0xa356('0x11'),_0xa356('0x12')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0xa356('0x13'),'originated',_0xa356('0x14'),_0xa356('0x15'),_0xa356('0x16'),_0xa356('0x17'),'Trunk',_0xa356('0x18'),_0xa356('0x19'),_0xa356('0x1a'),'erlangCallToSecond',_0xa356('0x1b'),_0xa356('0x1c'),_0xa356('0x1d'),_0xa356('0x1e'),_0xa356('0x1f'),_0xa356('0x20'),_0xa356('0x21'),_0xa356('0x22'),_0xa356('0x23'),_0xa356('0x24'),_0xa356('0x25'),_0xa356('0x26')];function getRealtimeQueues(_0xe09323,_0x38f9fd){var _0x474850=_0x38f9fd==='voice'?amiClient:routingClient;return _0x474850['request'](_[_0xa356('0x27')](_0x38f9fd)+_0xa356('0x28'),_0xe09323)[_0xa356('0x29')](function(_0x331343){if(_0x331343[_0xa356('0x2a')])throw new Error(util[_0xa356('0x2b')](_0xa356('0x2c'),_0x38f9fd));return _0x331343['result'];})[_0xa356('0x2d')](function(_0x4ca53a){throw _0x4ca53a;});}exports['getRealtimeQueues']=getRealtimeQueues;function initializeQueues(_0x3721bc,_0x35acc5,_0x44d0a8,_0x5b2d04){var _0x3e1f5c=DEFAULT_QUEUE_ATTRIBUTES;if(_0x44d0a8==='voice'){if(_0x5b2d04===_0xa356('0x2e')){_0x3e1f5c=_0x3e1f5c[_0xa356('0x2f')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x5b2d04==='outbound'){_0x3e1f5c=_0x3e1f5c['concat'](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x3721bc[_0xa356('0x30')](function(_0x4b84e2){var _0xc9e9c3=_0x4b84e2['get']({'plain':!![]});_0xc9e9c3[_0xa356('0x6')]=0x0;_0xc9e9c3[_0xa356('0xb')]=0x0;_0xc9e9c3[_0xa356('0x5')]=0x0;_0xc9e9c3[_0xa356('0x4')]=0x0;_0xc9e9c3[_0xa356('0x7')]=0x0;if(_0x44d0a8===_0xa356('0x31')){_0xc9e9c3[_0xa356('0x10')]=0x0;_0xc9e9c3['busy']=0x0;if(_0x5b2d04===_0xa356('0x32')){_0xc9e9c3[_0xa356('0x13')]=0x0;_0xc9e9c3['originated']=0x0;}}var _0x262b12=_[_0xa356('0x33')](_0x35acc5,['id',_0xc9e9c3['id']]);if(_0x262b12){_['merge'](_0xc9e9c3,_[_0xa356('0x34')](_0x262b12,_0x3e1f5c));}return _0xc9e9c3;});}exports['initializeQueues']=initializeQueues; \ No newline at end of file +var _0x6c38=['voice','inbound','concat','outbound','map','get','loggedInDb','pick','initializeQueues','client','http','available','loggedIn','paused','waiting','busy','invalid','onHold','ringing','ringInUse','talking','unavailable','unknown','pTalking','originated','dialActive','dialMethod','Trunk','startPredictive','erlangCalls','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','request','startCase','then','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','catch','getRealtimeQueues'];(function(_0x1b8050,_0x4d12c6){var _0x1ec2b1=function(_0x4c150a){while(--_0x4c150a){_0x1b8050['push'](_0x1b8050['shift']());}};_0x1ec2b1(++_0x4d12c6);}(_0x6c38,0x1c1));var _0x86c3=function(_0x4ff82e,_0x43cc73){_0x4ff82e=_0x4ff82e-0x0;var _0x2017c6=_0x6c38[_0x4ff82e];return _0x2017c6;};'use strict';var _=require('lodash');var jayson=require('jayson/promise');var util=require('util');var amiClient=jayson[_0x86c3('0x0')][_0x86c3('0x1')]({'port':0x232a});var routingClient=jayson[_0x86c3('0x0')][_0x86c3('0x1')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0x86c3('0x2'),_0x86c3('0x3'),_0x86c3('0x4'),_0x86c3('0x5')];var VOICE_QUEUE_ATTRIBUTES=[_0x86c3('0x6'),'inUse',_0x86c3('0x7'),'loggedInDb','notInUse',_0x86c3('0x8'),_0x86c3('0x9'),_0x86c3('0xa'),_0x86c3('0xb'),_0x86c3('0xc'),_0x86c3('0xd')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0x86c3('0xe'),_0x86c3('0xf'),'message','statusMessage',_0x86c3('0x10'),_0x86c3('0x11'),_0x86c3('0x12'),_0x86c3('0x13'),'startProgressive',_0x86c3('0x14'),'erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval',_0x86c3('0x15'),_0x86c3('0x16'),_0x86c3('0x17'),'predictiveIntervalTotalCalls',_0x86c3('0x18'),'predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit',_0x86c3('0x19'),_0x86c3('0x1a')];function getRealtimeQueues(_0x3bb766,_0xc0cebc){var _0x3b1efd=_0xc0cebc==='voice'?amiClient:routingClient;return _0x3b1efd[_0x86c3('0x1b')](_[_0x86c3('0x1c')](_0xc0cebc)+'Queues',_0x3bb766)[_0x86c3('0x1d')](function(_0x4eeaeb){if(_0x4eeaeb[_0x86c3('0x1e')])throw new Error(util[_0x86c3('0x1f')](_0x86c3('0x20'),_0xc0cebc));return _0x4eeaeb['result'];})[_0x86c3('0x21')](function(_0x45a387){throw _0x45a387;});}exports[_0x86c3('0x22')]=getRealtimeQueues;function initializeQueues(_0x57093b,_0x5d31be,_0x524ebc,_0x4f77cf){var _0x551427=DEFAULT_QUEUE_ATTRIBUTES;if(_0x524ebc===_0x86c3('0x23')){if(_0x4f77cf===_0x86c3('0x24')){_0x551427=_0x551427[_0x86c3('0x25')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x4f77cf===_0x86c3('0x26')){_0x551427=_0x551427[_0x86c3('0x25')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x57093b[_0x86c3('0x27')](function(_0x5cd1ac){var _0x1e1b4b=_0x5cd1ac[_0x86c3('0x28')]({'plain':!![]});_0x1e1b4b[_0x86c3('0x4')]=0x0;_0x1e1b4b[_0x86c3('0x29')]=0x0;_0x1e1b4b[_0x86c3('0x3')]=0x0;_0x1e1b4b[_0x86c3('0x2')]=0x0;_0x1e1b4b[_0x86c3('0x5')]=0x0;if(_0x524ebc===_0x86c3('0x23')){_0x1e1b4b[_0x86c3('0xb')]=0x0;_0x1e1b4b[_0x86c3('0x6')]=0x0;if(_0x4f77cf===_0x86c3('0x26')){_0x1e1b4b['pTalking']=0x0;_0x1e1b4b['originated']=0x0;}}var _0x28b399=_['find'](_0x5d31be,['id',_0x1e1b4b['id']]);if(_0x28b399){_['merge'](_0x1e1b4b,_[_0x86c3('0x2a')](_0x28b399,_0x551427));}return _0x1e1b4b;});}exports[_0x86c3('0x2b')]=initializeQueues; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index b1c0325..d084715 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(_0x3c8e9a,_0x384306){var _0x2d4c57=function(_0x43d408){while(--_0x43d408){_0x3c8e9a['push'](_0x3c8e9a['shift']());}};_0x2d4c57(++_0x384306);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'use strict';var express=require(_0x0a9e('0x0'));var methodOverride=require(_0x0a9e('0x1'));var cookieParser=require(_0x0a9e('0x2'));var errorHandler=require('errorhandler');var path=require('path');var passport=require(_0x0a9e('0x3'));var cors=require('cors');var config=require(_0x0a9e('0x4'));exports[_0x0a9e('0x5')]=function(_0x2ab90b){var _0x991246=_0x2ab90b[_0x0a9e('0x6')]('env');if(_0x991246===_0x0a9e('0x7')){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path['join'](config['root'],_0x0a9e('0xa')));}if(_0x991246==='development'||_0x991246==='test'){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path[_0x0a9e('0xb')](config[_0x0a9e('0xc')],_0x0a9e('0xd')));_0x2ab90b[_0x0a9e('0xe')](errorHandler());}_0x2ab90b['set']('json\x20replacer',function(_0x527cdd,_0x4cfe67){if(this[_0x527cdd]instanceof Date){_0x4cfe67=this[_0x527cdd][_0x0a9e('0xf')]()[_0x0a9e('0x10')]('.')[0x0]+'Z';}return _0x4cfe67;});_0x2ab90b[_0x0a9e('0xe')](express[_0x0a9e('0x11')](_0x2ab90b[_0x0a9e('0x6')](_0x0a9e('0x9'))));_0x2ab90b['set'](_0x0a9e('0x12'),config[_0x0a9e('0xc')]+_0x0a9e('0x13'));_0x2ab90b[_0x0a9e('0x14')](_0x0a9e('0x15'),require(_0x0a9e('0x16'))['renderFile']);_0x2ab90b[_0x0a9e('0x8')]('view\x20engine',_0x0a9e('0x15'));_0x2ab90b['use'](express[_0x0a9e('0x17')]({'limit':_0x0a9e('0x18'),'extended':!![]}));_0x2ab90b['use'](express[_0x0a9e('0x19')]({'limit':'50mb'}));_0x2ab90b[_0x0a9e('0xe')](cors());_0x2ab90b[_0x0a9e('0xe')](methodOverride());_0x2ab90b[_0x0a9e('0xe')](cookieParser());_0x2ab90b[_0x0a9e('0xe')](passport[_0x0a9e('0x1a')]());}; \ No newline at end of file +var _0xa9e0=['get','production','set','appPath','public','join','root','client','use','toISOString','split','static','views','/server/views','engine','html','ejs','urlencoded','50mb','json','initialize','express','method-override','cookie-parser','passport','./environment','default'];(function(_0x36bff5,_0x3156cb){var _0x80ade5=function(_0x5eee65){while(--_0x5eee65){_0x36bff5['push'](_0x36bff5['shift']());}};_0x80ade5(++_0x3156cb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'use strict';var express=require(_0x0a9e('0x0'));var methodOverride=require(_0x0a9e('0x1'));var cookieParser=require(_0x0a9e('0x2'));var errorHandler=require('errorhandler');var path=require('path');var passport=require(_0x0a9e('0x3'));var cors=require('cors');var config=require(_0x0a9e('0x4'));exports[_0x0a9e('0x5')]=function(_0x2ab90b){var _0x991246=_0x2ab90b[_0x0a9e('0x6')]('env');if(_0x991246===_0x0a9e('0x7')){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path['join'](config['root'],_0x0a9e('0xa')));}if(_0x991246==='development'||_0x991246==='test'){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path[_0x0a9e('0xb')](config[_0x0a9e('0xc')],_0x0a9e('0xd')));_0x2ab90b[_0x0a9e('0xe')](errorHandler());}_0x2ab90b['set']('json\x20replacer',function(_0x527cdd,_0x4cfe67){if(this[_0x527cdd]instanceof Date){_0x4cfe67=this[_0x527cdd][_0x0a9e('0xf')]()[_0x0a9e('0x10')]('.')[0x0]+'Z';}return _0x4cfe67;});_0x2ab90b[_0x0a9e('0xe')](express[_0x0a9e('0x11')](_0x2ab90b[_0x0a9e('0x6')](_0x0a9e('0x9'))));_0x2ab90b['set'](_0x0a9e('0x12'),config[_0x0a9e('0xc')]+_0x0a9e('0x13'));_0x2ab90b[_0x0a9e('0x14')](_0x0a9e('0x15'),require(_0x0a9e('0x16'))['renderFile']);_0x2ab90b[_0x0a9e('0x8')]('view\x20engine',_0x0a9e('0x15'));_0x2ab90b['use'](express[_0x0a9e('0x17')]({'limit':_0x0a9e('0x18'),'extended':!![]}));_0x2ab90b['use'](express[_0x0a9e('0x19')]({'limit':'50mb'}));_0x2ab90b[_0x0a9e('0xe')](cors());_0x2ab90b[_0x0a9e('0xe')](methodOverride());_0x2ab90b[_0x0a9e('0xe')](cookieParser());_0x2ab90b[_0x0a9e('0xe')](passport[_0x0a9e('0x1a')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index b1387af..b391014 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 _0x2554=['digest','getUuid','platform','licenseToken','test','win32','utf8','replace','hostname','macAddress','substring','lodash','crypto','child_process','execSync','networkInterfaces','orderBy','keys','filter','internal','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','map','model','join','createHash','md5','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2554,0xf9));var _0x4255=function(_0x59a7c8,_0x4644d0){_0x59a7c8=_0x59a7c8-0x0;var _0x242b6c=_0x2554[_0x59a7c8];return _0x242b6c;};'use strict';var _=require(_0x4255('0x0'));var os=require('os');var crypto=require(_0x4255('0x1'));var machine=require('bimedia-machine-uuid');var exec=require(_0x4255('0x2'))[_0x4255('0x3')];var config=require('../environment');function getInterfaces(){var _0x1dffc8=[];var _0x1a67c6=os[_0x4255('0x4')]();var _0xc56e45=_[_0x4255('0x5')](_[_0x4255('0x6')](_0x1a67c6));for(var _0x5f20e3=0x0;_0x5f20e3<_0xc56e45['length'];_0x5f20e3++){var _0x4996fd=_0x1a67c6[_0xc56e45[_0x5f20e3]][_0x4255('0x7')](function(_0x4342e0){return _0x4342e0['family']==='IPv4'&&_0x4342e0[_0x4255('0x8')]===![];});_0x1dffc8=_0x1dffc8[_0x4255('0x9')](_0x4996fd);}return _0x1dffc8;}function getFirstInterface(){var _0xf698a9=_[_0x4255('0xa')](getInterfaces());return{'macAddress':_0xf698a9&&_0xf698a9[_0x4255('0xb')]?_0xf698a9[_0x4255('0xb')]:_0x4255('0xc'),'ipAddress':_0xf698a9&&_0xf698a9['address']?_0xf698a9[_0x4255('0xd')]:_0x4255('0xe')};}exports[_0x4255('0xf')]=getFirstInterface;function getCPUhash(){var _0x5dcad4=_['orderBy'](os[_0x4255('0x10')]()[_0x4255('0x11')](function(_0x2e7ae2){return _0x2e7ae2[_0x4255('0x12')];}))[_0x4255('0x13')](':');return crypto[_0x4255('0x14')](_0x4255('0x15'))[_0x4255('0x16')](_0x5dcad4)[_0x4255('0x17')]('hex');}exports[_0x4255('0x18')]=function(){var _0x1c56da=os[_0x4255('0x19')]();var _0x32fc9c=/[0-9a-f-]{36}/;if(config[_0x4255('0x1a')]&&_0x32fc9c[_0x4255('0x1b')](config[_0x4255('0x1a')])){return config['licenseToken'];}else if(_0x1c56da===_0x4255('0x1c')){return exec('dmidecode\x20--string\x20system-uuid',{'encoding':_0x4255('0x1d')})[_0x4255('0x1e')]('\x0d\x0a','');}else{var _0x4073ce=getFirstInterface();var _0x3dc2a5=getCPUhash();var _0x16ede5=_0x3dc2a5+'|'+os[_0x4255('0x1f')]()+'|'+_0x4073ce[_0x4255('0x20')]+'|'+_0x4073ce['ipAddress'];var _0x5b89d1=crypto[_0x4255('0x14')](_0x4255('0x15'))[_0x4255('0x16')](_0x16ede5)[_0x4255('0x17')]('hex');return _0x5b89d1[_0x4255('0x21')](0x0,0x8)+'-'+_0x5b89d1['substring'](0x8,0xc)+'-'+_0x5b89d1[_0x4255('0x21')](0xc,0x10)+'-'+_0x5b89d1['substring'](0x10,0x14)+'-'+_0x5b89d1[_0x4255('0x21')](0x14);}}; \ No newline at end of file +var _0x13d7=['internal','mac','address','127.0.0.1','getFirstInterface','cpus','map','model','join','md5','update','digest','hex','getUuid','platform','licenseToken','win32','utf8','replace','ipAddress','createHash','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','networkInterfaces','orderBy','keys','length','filter'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0x13d7,0x176));var _0x713d=function(_0x280924,_0xd36640){_0x280924=_0x280924-0x0;var _0x4d8eda=_0x13d7[_0x280924];return _0x4d8eda;};'use strict';var _=require(_0x713d('0x0'));var os=require('os');var crypto=require(_0x713d('0x1'));var machine=require(_0x713d('0x2'));var exec=require(_0x713d('0x3'))[_0x713d('0x4')];var config=require('../environment');function getInterfaces(){var _0x474ae8=[];var _0x2d92f5=os[_0x713d('0x5')]();var _0x2a3dbf=_[_0x713d('0x6')](_[_0x713d('0x7')](_0x2d92f5));for(var _0xe1f1e2=0x0;_0xe1f1e2<_0x2a3dbf[_0x713d('0x8')];_0xe1f1e2++){var _0x5e7eec=_0x2d92f5[_0x2a3dbf[_0xe1f1e2]][_0x713d('0x9')](function(_0xb2a007){return _0xb2a007['family']==='IPv4'&&_0xb2a007[_0x713d('0xa')]===![];});_0x474ae8=_0x474ae8['concat'](_0x5e7eec);}return _0x474ae8;}function getFirstInterface(){var _0x2b0164=_['head'](getInterfaces());return{'macAddress':_0x2b0164&&_0x2b0164[_0x713d('0xb')]?_0x2b0164[_0x713d('0xb')]:'00:00:00:00:00:00','ipAddress':_0x2b0164&&_0x2b0164[_0x713d('0xc')]?_0x2b0164['address']:_0x713d('0xd')};}exports[_0x713d('0xe')]=getFirstInterface;function getCPUhash(){var _0x2eac53=_[_0x713d('0x6')](os[_0x713d('0xf')]()[_0x713d('0x10')](function(_0x152152){return _0x152152[_0x713d('0x11')];}))[_0x713d('0x12')](':');return crypto['createHash'](_0x713d('0x13'))[_0x713d('0x14')](_0x2eac53)[_0x713d('0x15')](_0x713d('0x16'));}exports[_0x713d('0x17')]=function(){var _0x54a4b8=os[_0x713d('0x18')]();var _0x176e32=/[0-9a-f-]{36}/;if(config[_0x713d('0x19')]&&_0x176e32['test'](config[_0x713d('0x19')])){return config['licenseToken'];}else if(_0x54a4b8===_0x713d('0x1a')){return exec('dmidecode\x20--string\x20system-uuid',{'encoding':_0x713d('0x1b')})[_0x713d('0x1c')]('\x0d\x0a','');}else{var _0x3d4fb9=getFirstInterface();var _0x580ddf=getCPUhash();var _0x4ae5fc=_0x580ddf+'|'+os['hostname']()+'|'+_0x3d4fb9['macAddress']+'|'+_0x3d4fb9[_0x713d('0x1d')];var _0x1cd1ee=crypto[_0x713d('0x1e')](_0x713d('0x13'))[_0x713d('0x14')](_0x4ae5fc)['digest'](_0x713d('0x16'));return _0x1cd1ee[_0x713d('0x1f')](0x0,0x8)+'-'+_0x1cd1ee['substring'](0x8,0xc)+'-'+_0x1cd1ee[_0x713d('0x1f')](0xc,0x10)+'-'+_0x1cd1ee[_0x713d('0x1f')](0x10,0x14)+'-'+_0x1cd1ee['substring'](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 7f72ee6..f92c8ca 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 _0xb82a=['bluebird','pkginfo','version','../../mysqldb','../../components/encryptor','./hardware','../logger','format','%s/api/servers/%s/check?version=%s','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','get','data1','data2','active','license','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','YYYY-MM-DD\x20HH:mm','encryptString','diff','days','DEMO\x20START\x20AT\x20%s','error','finally','getUuid','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','moment','request-promise'];(function(_0xaa6a4,_0x64b067){var _0xdc31a4=function(_0x4269d8){while(--_0x4269d8){_0xaa6a4['push'](_0xaa6a4['shift']());}};_0xdc31a4(++_0x64b067);}(_0xb82a,0xf3));var _0xab82=function(_0x3a7671,_0x56c896){_0x3a7671=_0x3a7671-0x0;var _0x29de9d=_0xb82a[_0x3a7671];return _0x29de9d;};'use strict';var util=require(_0xab82('0x0'));var moment=require(_0xab82('0x1'));var rp=require(_0xab82('0x2'));var BPromise=require(_0xab82('0x3'));var pkginfo=require(_0xab82('0x4'))(module,_0xab82('0x5'));var db=require(_0xab82('0x6'))['db'];var encryptor=require(_0xab82('0x7'));var hardware=require(_0xab82('0x8'));var logger=require(_0xab82('0x9'))('license');var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x103d91){return new BPromise(function(_0x5a26be,_0x599969){var _0x4fc823=util[_0xab82('0xa')](_0xab82('0xb'),HOST,_0x103d91,module['exports']['version']);if(oldToken){_0x4fc823=util[_0xab82('0xa')](_0xab82('0xc'),HOST,_0x103d91,module['exports']['version'],oldToken);}var _0x2dd1d2={'uri':_0x4fc823,'method':_0xab82('0xd'),'timeout':0xea60,'json':!![]};return rp(_0x2dd1d2)[_0xab82('0xe')](function(_0x3a7555){_0x5a26be(_0x3a7555);})[_0xab82('0xf')](function(_0x50b9b3){_0x599969(_0x50b9b3);});});}function manageLicense(_0x5f45b3,_0x2c1c93){var _0x2097db=_0x2c1c93[_0xab82('0x10')]({'plain':!![]});if(!isOldTokenSent&&_0x2097db[_0xab82('0x11')]!==_0x5f45b3&&!_0x2097db[_0xab82('0x12')]){oldToken=_0x2097db[_0xab82('0x11')];}httpRequest(_0x5f45b3)[_0xab82('0xe')](function(_0x164063){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x164063[_0xab82('0x13')]){isOldTokenSent=![];if(!_0x2097db[_0xab82('0x14')]&&_0x2097db['license']!=_0x164063[_0xab82('0x14')]||_0x2097db[_0xab82('0x14')]&&_0x2097db[_0xab82('0x12')]){logger[_0xab82('0x15')](_0xab82('0x16'));}if(_0x2097db['license']&&!_0x2097db[_0xab82('0x12')]&&_0x2097db[_0xab82('0x14')]!=_0x164063[_0xab82('0x14')]){logger['info']('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x2097db[_0xab82('0x14')]&&!_0x2097db[_0xab82('0x12')]&&_0x2097db['license']==_0x164063[_0xab82('0x14')]){return _0x2c1c93;}return _0x2c1c93[_0xab82('0x17')]({'data1':_0x5f45b3,'data2':null,'license':_0x164063[_0xab82('0x14')]});}else{if(_0x164063[_0xab82('0x14')]||_0x2097db[_0xab82('0x14')]){if(!_0x2097db[_0xab82('0x12')]){if(_0x2097db[_0xab82('0x11')]==_0x5f45b3){GRAY_PERIOD_REASON=_0xab82('0x18');logger['info'](_0xab82('0x19'));}else{GRAY_PERIOD_REASON=_0xab82('0x1a');logger['info'](_0xab82('0x1b'),_0x2097db['data1'],_0x5f45b3);}logger[_0xab82('0x15')](_0xab82('0x1c'),GRAY_PERIOD_REASON['toUpperCase'](),moment()[_0xab82('0xa')](_0xab82('0x1d')));return _0x2c1c93[_0xab82('0x17')]({'data2':encryptor[_0xab82('0x1e')](moment()[_0xab82('0xa')](_0xab82('0x1d')))});}else{if(moment()[_0xab82('0x1f')](encryptor['decryptString'](_0x2097db['data2']),_0xab82('0x20'))>DAYS){logger[_0xab82('0x15')](_0xab82('0x21'),moment()[_0xab82('0xa')](_0xab82('0x1d')));isOldTokenSent=![];return _0x2c1c93[_0xab82('0x17')]({'data1':_0x5f45b3,'data2':null,'license':null});}}}else{if(_0x2097db[_0xab82('0x11')]!=_0x5f45b3){logger[_0xab82('0x15')](_0xab82('0x1b'),_0x2097db[_0xab82('0x11')],_0x5f45b3);return _0x2c1c93['update']({'data1':_0x5f45b3,'data2':null,'license':null});}}}return _0x2c1c93;})[_0xab82('0xe')](function(_0x2670e8){_0x2c1c93=_0x2670e8;})[_0xab82('0xf')](function(_0x136d80){logger[_0xab82('0x22')](_0x136d80['message']);})[_0xab82('0x23')](function(){setTimeout(function(){manageLicense(hardware[_0xab82('0x24')](),_0x2c1c93);},TIME);});}function defaultLicense(){var _0x2f246e=hardware['getUuid']();if(_0x2f246e){return db['License'][_0xab82('0x25')]({'where':{'id':0x1},'defaults':{'data1':_0x2f246e}})[_0xab82('0x26')](function(_0x401bb9,_0x118d31){logger[_0xab82('0x15')](_0xab82('0x27'),_0x2f246e);manageLicense(_0x2f246e,_0x401bb9);})[_0xab82('0xf')](function(_0x1bc7ed){logger[_0xab82('0x22')](_0x1bc7ed['message']);});}}exports[_0xab82('0x28')]=defaultLicense; \ No newline at end of file +var _0xa41c=['util','moment','request-promise','bluebird','version','../../mysqldb','../../components/encryptor','./hardware','../logger','license','exports','format','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','data1','data2','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','YYYY-MM-DD\x20HH:mm','decryptString','error','message','finally','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default'];(function(_0x186376,_0x5d988a){var _0x2dbdd9=function(_0x96908e){while(--_0x96908e){_0x186376['push'](_0x186376['shift']());}};_0x2dbdd9(++_0x5d988a);}(_0xa41c,0x98));var _0xca41=function(_0x1955c2,_0x58dc5a){_0x1955c2=_0x1955c2-0x0;var _0x1f2e02=_0xa41c[_0x1955c2];return _0x1f2e02;};'use strict';var util=require(_0xca41('0x0'));var moment=require(_0xca41('0x1'));var rp=require(_0xca41('0x2'));var BPromise=require(_0xca41('0x3'));var pkginfo=require('pkginfo')(module,_0xca41('0x4'));var db=require(_0xca41('0x5'))['db'];var encryptor=require(_0xca41('0x6'));var hardware=require(_0xca41('0x7'));var logger=require(_0xca41('0x8'))(_0xca41('0x9'));var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x41f693){return new BPromise(function(_0x5dda7c,_0x104dc0){var _0x131eb3=util['format']('%s/api/servers/%s/check?version=%s',HOST,_0x41f693,module[_0xca41('0xa')][_0xca41('0x4')]);if(oldToken){_0x131eb3=util[_0xca41('0xb')](_0xca41('0xc'),HOST,_0x41f693,module[_0xca41('0xa')][_0xca41('0x4')],oldToken);}var _0x3f6151={'uri':_0x131eb3,'method':_0xca41('0xd'),'timeout':0xea60,'json':!![]};return rp(_0x3f6151)[_0xca41('0xe')](function(_0x564fcf){_0x5dda7c(_0x564fcf);})[_0xca41('0xf')](function(_0x405bda){_0x104dc0(_0x405bda);});});}function manageLicense(_0x787b01,_0x304716){var _0x32ded7=_0x304716['get']({'plain':!![]});if(!isOldTokenSent&&_0x32ded7[_0xca41('0x10')]!==_0x787b01&&!_0x32ded7[_0xca41('0x11')]){oldToken=_0x32ded7[_0xca41('0x10')];}httpRequest(_0x787b01)[_0xca41('0xe')](function(_0x2b9b37){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x2b9b37[_0xca41('0x12')]){isOldTokenSent=![];if(!_0x32ded7[_0xca41('0x9')]&&_0x32ded7[_0xca41('0x9')]!=_0x2b9b37[_0xca41('0x9')]||_0x32ded7['license']&&_0x32ded7[_0xca41('0x11')]){logger[_0xca41('0x13')](_0xca41('0x14'));}if(_0x32ded7['license']&&!_0x32ded7[_0xca41('0x11')]&&_0x32ded7[_0xca41('0x9')]!=_0x2b9b37['license']){logger[_0xca41('0x13')](_0xca41('0x15'));}if(_0x32ded7[_0xca41('0x9')]&&!_0x32ded7[_0xca41('0x11')]&&_0x32ded7[_0xca41('0x9')]==_0x2b9b37[_0xca41('0x9')]){return _0x304716;}return _0x304716[_0xca41('0x16')]({'data1':_0x787b01,'data2':null,'license':_0x2b9b37[_0xca41('0x9')]});}else{if(_0x2b9b37[_0xca41('0x9')]||_0x32ded7[_0xca41('0x9')]){if(!_0x32ded7[_0xca41('0x11')]){if(_0x32ded7[_0xca41('0x10')]==_0x787b01){GRAY_PERIOD_REASON=_0xca41('0x17');logger[_0xca41('0x13')]('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON=_0xca41('0x18');logger[_0xca41('0x13')](_0xca41('0x19'),_0x32ded7[_0xca41('0x10')],_0x787b01);}logger[_0xca41('0x13')](_0xca41('0x1a'),GRAY_PERIOD_REASON['toUpperCase'](),moment()['format'](_0xca41('0x1b')));return _0x304716[_0xca41('0x16')]({'data2':encryptor['encryptString'](moment()[_0xca41('0xb')](_0xca41('0x1b')))});}else{if(moment()['diff'](encryptor[_0xca41('0x1c')](_0x32ded7['data2']),'days')>DAYS){logger[_0xca41('0x13')]('DEMO\x20START\x20AT\x20%s',moment()[_0xca41('0xb')](_0xca41('0x1b')));isOldTokenSent=![];return _0x304716[_0xca41('0x16')]({'data1':_0x787b01,'data2':null,'license':null});}}}else{if(_0x32ded7['data1']!=_0x787b01){logger[_0xca41('0x13')](_0xca41('0x19'),_0x32ded7[_0xca41('0x10')],_0x787b01);return _0x304716[_0xca41('0x16')]({'data1':_0x787b01,'data2':null,'license':null});}}}return _0x304716;})[_0xca41('0xe')](function(_0x11c234){_0x304716=_0x11c234;})[_0xca41('0xf')](function(_0x2c623f){logger[_0xca41('0x1d')](_0x2c623f[_0xca41('0x1e')]);})[_0xca41('0x1f')](function(){setTimeout(function(){manageLicense(hardware[_0xca41('0x20')](),_0x304716);},TIME);});}function defaultLicense(){var _0x3c4e93=hardware[_0xca41('0x20')]();if(_0x3c4e93){return db[_0xca41('0x21')][_0xca41('0x22')]({'where':{'id':0x1},'defaults':{'data1':_0x3c4e93}})[_0xca41('0x23')](function(_0x1d0387,_0x26e37b){logger['info'](_0xca41('0x24'),_0x3c4e93);manageLicense(_0x3c4e93,_0x1d0387);})[_0xca41('0xf')](function(_0x500c3f){logger[_0xca41('0x1d')](_0x500c3f[_0xca41('0x1e')]);});}}exports[_0xca41('0x25')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 5f76404..823f89f 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 _0x2184=['isEmpty','License\x20key\x20value\x20not\x20found','data2','split','format','%s:%s:%s','parse','demo','gray','deadline','grayReason','changed','disabled','message','User','findAll','role','sequelize','COUNT','col','count','admin','users','forEach','user','telephone','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','moment','bluebird','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','License','find','defaults','then','catch','uuid','data1','license'];(function(_0x33381e,_0x2545aa){var _0x82b8d7=function(_0x32c975){while(--_0x32c975){_0x33381e['push'](_0x33381e['shift']());}};_0x82b8d7(++_0x2545aa);}(_0x2184,0xaa));var _0x4218=function(_0x5e7209,_0x171c09){_0x5e7209=_0x5e7209-0x0;var _0x252d03=_0x2184[_0x5e7209];return _0x252d03;};'use strict';var util=require(_0x4218('0x0'));var _=require('lodash');var moment=require(_0x4218('0x1'));var BPromise=require(_0x4218('0x2'));var hardware=require(_0x4218('0x3'));var encryptor=require(_0x4218('0x4'));var db=require(_0x4218('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x4218('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x4218('0x7'),'machineUuid':hardware[_0x4218('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x4218('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x4218('0x9'),'machineUuid':hardware[_0x4218('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x2f2054){return new BPromise(function(_0x1845dc,_0x123c7a){return db[_0x4218('0xa')][_0x4218('0xb')](_[_0x4218('0xc')](_0x2f2054,{'raw':!![],'where':{'id':0x1}}))[_0x4218('0xd')](function(_0x3805a2){return checkLicense(_0x3805a2,null);})['then'](function(_0x4c5703){_0x1845dc(_0x4c5703);return;})[_0x4218('0xe')](function(_0x2f1dfa){_0x123c7a(_0x2f1dfa);});});}function checkLicense(_0x25d5d1,_0xa06597){if(!_0x25d5d1){demoLicense[_0x4218('0xf')]=_0x25d5d1[_0x4218('0x10')];return demoLicense;}try{var _0x31b389=_0xa06597||_0x25d5d1[_0x4218('0x11')];if(_[_0x4218('0x12')](_0x31b389)){throw new Error(_0x4218('0x13'));}var _0x3a05c6=_0x25d5d1['data1'];var _0x38a2ad=_0x25d5d1[_0x4218('0x14')];var _0x17d442=_0x3a05c6[_0x4218('0x15')]('-')[0x4];var _0x1fb9a9=_0x3a05c6[_0x4218('0x15')]('-')[0x0];var _0x242f3d=encryptor['decryptString'](_0x31b389,util[_0x4218('0x16')](_0x4218('0x17'),_0x17d442,_0x3a05c6,_0x1fb9a9));var _0x40a1ee=JSON[_0x4218('0x18')](_0x242f3d);_0x40a1ee[_0x4218('0x19')]=![];_0x40a1ee[_0x4218('0xf')]=_0x3a05c6;_0x40a1ee['machineUuid']=hardware[_0x4218('0x8')]();if(_0x38a2ad){var _0x1b0ad2=encryptor['decryptString'](_0x38a2ad);_0x40a1ee[_0x4218('0x1a')]=_0x1b0ad2;_0x40a1ee[_0x4218('0x1b')]=moment(_0x1b0ad2)['add'](0x7,'days')['format']();_0x40a1ee[_0x4218('0x1c')]=_0x40a1ee['uuid']!=_0x40a1ee['machineUuid']?_0x4218('0x1d'):_0x4218('0x1e');}return _0x40a1ee;}catch(_0x3e6531){breakingLicense['uuid']=_0x25d5d1['data1'];breakingLicense[_0x4218('0x1f')]=_0x3e6531[_0x4218('0x1f')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x211178,_0x4a1ce9){getLicense()[_0x4218('0xd')](function(_0x24b967){return db[_0x4218('0x20')][_0x4218('0x21')]({'attributes':[_0x4218('0x22'),[db[_0x4218('0x23')]['fn'](_0x4218('0x24'),db[_0x4218('0x23')][_0x4218('0x25')](_0x4218('0x22'))),_0x4218('0x26')]],'group':_0x4218('0x22'),'where':{'role':{'$or':[_0x4218('0x27'),'user','telephone']}},'raw':!![]})['then'](function(_0x3c33e4){var _0x539fe3={'user':_0x24b967[_0x4218('0x28')]||0x0,'telephone':_0x24b967['telephones']||0x0};_0x3c33e4[_0x4218('0x29')](function(_0x330690){var _0x2b8116=_0x330690['role']==='admin'?'user':_0x330690[_0x4218('0x22')];_0x539fe3[_0x2b8116]-=_0x330690[_0x4218('0x26')];if(_0x539fe3[_0x2b8116]<0x0)_0x539fe3[_0x2b8116]=0x0;});_0x211178(_0x539fe3);return;});})[_0x4218('0xe')](function(_0x5d986a){_0x4a1ce9(_0x5d986a);});});}function checkUserLimits(_0x37a7b3){return new BPromise(function(_0x5a4c65,_0x15594b){getLimits()['then'](function(_0x2b3aca){var _0x69ce17=_['pick'](_['countBy'](_0x37a7b3,_0x4218('0x22')),[_0x4218('0x27'),_0x4218('0x2a'),_0x4218('0x2b')]);var _0x2d4875=(_0x69ce17[_0x4218('0x27')]||0x0)+(_0x69ce17[_0x4218('0x2a')]||0x0);var _0xda3519=_0x69ce17[_0x4218('0x2b')]||0x0;if(_0x2d4875>_0x2b3aca[_0x4218('0x2a')])return _0x15594b(_0x4218('0x2c'));if(_0xda3519>_0x2b3aca[_0x4218('0x2b')])return _0x15594b(_0x4218('0x2d'));return _0x5a4c65();})[_0x4218('0xe')](function(_0x50ed71){_0x15594b(_0x50ed71);});});}module[_0x4218('0x2e')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x78ff=['findAll','role','sequelize','COUNT','col','count','admin','user','telephone','users','telephones','forEach','pick','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','moment','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','find','then','catch','uuid','license','isEmpty','License\x20key\x20value\x20not\x20found','data1','data2','split','decryptString','format','%s:%s:%s','machineUuid','gray','deadline','add','days','grayReason','changed','disabled','message'];(function(_0x5b470d,_0x415733){var _0x1aa0ca=function(_0x3fb7fc){while(--_0x3fb7fc){_0x5b470d['push'](_0x5b470d['shift']());}};_0x1aa0ca(++_0x415733);}(_0x78ff,0x199));var _0xf78f=function(_0x3e32b4,_0x3e3856){_0x3e32b4=_0x3e32b4-0x0;var _0x1b5b1b=_0x78ff[_0x3e32b4];return _0x1b5b1b;};'use strict';var util=require(_0xf78f('0x0'));var _=require(_0xf78f('0x1'));var moment=require(_0xf78f('0x2'));var BPromise=require('bluebird');var hardware=require(_0xf78f('0x3'));var encryptor=require(_0xf78f('0x4'));var db=require(_0xf78f('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xf78f('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xf78f('0x7'),'machineUuid':hardware[_0xf78f('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xf78f('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xf78f('0x9'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x47ad76){return new BPromise(function(_0x2aa4d3,_0x500106){return db['License'][_0xf78f('0xa')](_['defaults'](_0x47ad76,{'raw':!![],'where':{'id':0x1}}))[_0xf78f('0xb')](function(_0x191f76){return checkLicense(_0x191f76,null);})[_0xf78f('0xb')](function(_0x2abf31){_0x2aa4d3(_0x2abf31);return;})[_0xf78f('0xc')](function(_0x527d88){_0x500106(_0x527d88);});});}function checkLicense(_0x55cce2,_0x4d4860){if(!_0x55cce2){demoLicense[_0xf78f('0xd')]=_0x55cce2['data1'];return demoLicense;}try{var _0x329ec8=_0x4d4860||_0x55cce2[_0xf78f('0xe')];if(_[_0xf78f('0xf')](_0x329ec8)){throw new Error(_0xf78f('0x10'));}var _0x47b333=_0x55cce2[_0xf78f('0x11')];var _0x5d82bd=_0x55cce2[_0xf78f('0x12')];var _0x33a0d1=_0x47b333[_0xf78f('0x13')]('-')[0x4];var _0x9f688d=_0x47b333[_0xf78f('0x13')]('-')[0x0];var _0x3d3ddf=encryptor[_0xf78f('0x14')](_0x329ec8,util[_0xf78f('0x15')](_0xf78f('0x16'),_0x33a0d1,_0x47b333,_0x9f688d));var _0xb6c9c0=JSON['parse'](_0x3d3ddf);_0xb6c9c0['demo']=![];_0xb6c9c0[_0xf78f('0xd')]=_0x47b333;_0xb6c9c0[_0xf78f('0x17')]=hardware[_0xf78f('0x8')]();if(_0x5d82bd){var _0xa44562=encryptor[_0xf78f('0x14')](_0x5d82bd);_0xb6c9c0[_0xf78f('0x18')]=_0xa44562;_0xb6c9c0[_0xf78f('0x19')]=moment(_0xa44562)[_0xf78f('0x1a')](0x7,_0xf78f('0x1b'))[_0xf78f('0x15')]();_0xb6c9c0[_0xf78f('0x1c')]=_0xb6c9c0[_0xf78f('0xd')]!=_0xb6c9c0[_0xf78f('0x17')]?_0xf78f('0x1d'):_0xf78f('0x1e');}return _0xb6c9c0;}catch(_0x34b7d3){breakingLicense[_0xf78f('0xd')]=_0x55cce2[_0xf78f('0x11')];breakingLicense[_0xf78f('0x1f')]=_0x34b7d3[_0xf78f('0x1f')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x4a5ca9,_0x3443dd){getLicense()[_0xf78f('0xb')](function(_0x4edf01){return db['User'][_0xf78f('0x20')]({'attributes':[_0xf78f('0x21'),[db[_0xf78f('0x22')]['fn'](_0xf78f('0x23'),db[_0xf78f('0x22')][_0xf78f('0x24')](_0xf78f('0x21'))),_0xf78f('0x25')]],'group':_0xf78f('0x21'),'where':{'role':{'$or':[_0xf78f('0x26'),_0xf78f('0x27'),_0xf78f('0x28')]}},'raw':!![]})[_0xf78f('0xb')](function(_0x3ccdf0){var _0xbe2915={'user':_0x4edf01[_0xf78f('0x29')]||0x0,'telephone':_0x4edf01[_0xf78f('0x2a')]||0x0};_0x3ccdf0[_0xf78f('0x2b')](function(_0x2c97d8){var _0x2ac79a=_0x2c97d8[_0xf78f('0x21')]==='admin'?_0xf78f('0x27'):_0x2c97d8['role'];_0xbe2915[_0x2ac79a]-=_0x2c97d8[_0xf78f('0x25')];if(_0xbe2915[_0x2ac79a]<0x0)_0xbe2915[_0x2ac79a]=0x0;});_0x4a5ca9(_0xbe2915);return;});})['catch'](function(_0x2ca9e8){_0x3443dd(_0x2ca9e8);});});}function checkUserLimits(_0x15fa60){return new BPromise(function(_0x4d3771,_0x3ff57f){getLimits()[_0xf78f('0xb')](function(_0x317680){var _0x314be2=_[_0xf78f('0x2c')](_[_0xf78f('0x2d')](_0x15fa60,_0xf78f('0x21')),[_0xf78f('0x26'),_0xf78f('0x27'),'telephone']);var _0x2ee6f0=(_0x314be2['admin']||0x0)+(_0x314be2[_0xf78f('0x27')]||0x0);var _0x5f020c=_0x314be2[_0xf78f('0x28')]||0x0;if(_0x2ee6f0>_0x317680[_0xf78f('0x27')])return _0x3ff57f(_0xf78f('0x2e'));if(_0x5f020c>_0x317680[_0xf78f('0x28')])return _0x3ff57f(_0xf78f('0x2f'));return _0x4d3771();})['catch'](function(_0x1acdac){_0x3ff57f(_0x1acdac);});});}module[_0xf78f('0x30')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index 118b8b5..720d3da 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 _0x955f=['secret','exports','http://localhost:9000','myappanuglar-secret','app-id'];(function(_0x216f48,_0x176ab3){var _0x11a10d=function(_0x2a6f4c){while(--_0x2a6f4c){_0x216f48['push'](_0x216f48['shift']());}};_0x11a10d(++_0x176ab3);}(_0x955f,0x1eb));var _0xf955=function(_0x1674a8,_0x466ded){_0x1674a8=_0x1674a8-0x0;var _0x5bb59a=_0x955f[_0x1674a8];return _0x5bb59a;};'use strict';module[_0xf955('0x0')]={'DOMAIN':_0xf955('0x1'),'SESSION_SECRET':_0xf955('0x2'),'GOOGLE_ID':_0xf955('0x3'),'GOOGLE_SECRET':_0xf955('0x4'),'DEBUG':''}; \ No newline at end of file +var _0xfcbb=['http://localhost:9000','myappanuglar-secret','exports'];(function(_0x11bda7,_0x35f4f9){var _0x4ac128=function(_0x55ce23){while(--_0x55ce23){_0x11bda7['push'](_0x11bda7['shift']());}};_0x4ac128(++_0x35f4f9);}(_0xfcbb,0x10d));var _0xbfcb=function(_0x520c1a,_0x5cb3b3){_0x520c1a=_0x520c1a-0x0;var _0x54c152=_0xfcbb[_0x520c1a];return _0x54c152;};'use strict';module[_0xbfcb('0x0')]={'DOMAIN':_0xbfcb('0x1'),'SESSION_SECRET':_0xbfcb('0x2'),'GOOGLE_ID':'app-id','GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index a8ca3c6..69c5bd3 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8fed=['../utils/loggers'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8fed,0x120));var _0xd8fe=function(_0x5ceacb,_0x3f1a9f){_0x5ceacb=_0x5ceacb-0x0;var _0x6ca350=_0x8fed[_0x5ceacb];return _0x6ca350;};'use strict';var fileLogger=require(_0xd8fe('0x0'))['fileLogger'];module['exports']=fileLogger; \ No newline at end of file +var _0xd06c=['exports','../utils/loggers'];(function(_0x1b745b,_0x3e2d40){var _0x120a9d=function(_0x882a6c){while(--_0x882a6c){_0x1b745b['push'](_0x1b745b['shift']());}};_0x120a9d(++_0x3e2d40);}(_0xd06c,0xf3));var _0xcd06=function(_0x34cfbe,_0x501dd2){_0x34cfbe=_0x34cfbe-0x0;var _0x1d2ec8=_0xd06c[_0x34cfbe];return _0x1d2ec8;};'use strict';var fileLogger=require(_0xcd06('0x0'))['fileLogger'];module[_0xcd06('0x1')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 5f81610..7c12d66 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 _0x9993=['join','root','express','ami','../../services/ami/index.js','agi','../../services/agi/index.js','email','../../services/email/index.js','routing','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','../../config/environment','resolve'];(function(_0x30972a,_0x6f2e6c){var _0x1ff27d=function(_0x4de216){while(--_0x4de216){_0x30972a['push'](_0x30972a['shift']());}};_0x1ff27d(++_0x6f2e6c);}(_0x9993,0x16e));var _0x3999=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x9993[_0x57b54c];return _0x59cc19;};'use strict';var path=require('path');var cfg=require(_0x3999('0x0'));var env={'NODE_PATH':path[_0x3999('0x1')](path[_0x3999('0x2')](cfg[_0x3999('0x3')],'legacy-libs'))};var pm2config={'apps':[{'name':_0x3999('0x4'),'script':path[_0x3999('0x2')](__dirname,'../../services/express/index.js'),'env':env},{'name':_0x3999('0x5'),'script':path['join'](__dirname,_0x3999('0x6')),'env':env},{'name':_0x3999('0x7'),'script':path['join'](__dirname,_0x3999('0x8')),'env':env},{'name':_0x3999('0x9'),'script':path[_0x3999('0x2')](__dirname,_0x3999('0xa')),'env':env},{'name':_0x3999('0xb'),'script':path[_0x3999('0x2')](__dirname,_0x3999('0xc')),'env':env},{'name':_0x3999('0xd'),'script':path[_0x3999('0x2')](__dirname,_0x3999('0xe')),'env':env}]};module[_0x3999('0xf')]=pm2config; \ No newline at end of file +var _0x8232=['resolve','join','legacy-libs','express','agi','email','../../services/email/index.js','routing','../../services/routing/index.js','xdr','path'];(function(_0x2c8b08,_0x48b1b4){var _0x1d133d=function(_0x1a7248){while(--_0x1a7248){_0x2c8b08['push'](_0x2c8b08['shift']());}};_0x1d133d(++_0x48b1b4);}(_0x8232,0x99));var _0x2823=function(_0x4d07cc,_0x587613){_0x4d07cc=_0x4d07cc-0x0;var _0x42de3b=_0x8232[_0x4d07cc];return _0x42de3b;};'use strict';var path=require(_0x2823('0x0'));var cfg=require('../../config/environment');var env={'NODE_PATH':path[_0x2823('0x1')](path[_0x2823('0x2')](cfg['root'],_0x2823('0x3')))};var pm2config={'apps':[{'name':_0x2823('0x4'),'script':path['join'](__dirname,'../../services/express/index.js'),'env':env},{'name':'ami','script':path[_0x2823('0x2')](__dirname,'../../services/ami/index.js'),'env':env},{'name':_0x2823('0x5'),'script':path['join'](__dirname,'../../services/agi/index.js'),'env':env},{'name':_0x2823('0x6'),'script':path[_0x2823('0x2')](__dirname,_0x2823('0x7')),'env':env},{'name':_0x2823('0x8'),'script':path['join'](__dirname,_0x2823('0x9')),'env':env},{'name':_0x2823('0xa'),'script':path[_0x2823('0x2')](__dirname,'../../services/xdr/index.js'),'env':env}]};module['exports']=pm2config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 1873600..34b7118 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 _0x6d28=['dump','saved','pm2','bluebird','./config','connect','connected','start','disconnect','stop','then','restart','list','delete'];(function(_0x200b49,_0x38f6b0){var _0xbb6840=function(_0x33ef5b){while(--_0x33ef5b){_0x200b49['push'](_0x200b49['shift']());}};_0xbb6840(++_0x38f6b0);}(_0x6d28,0xe2));var _0x86d2=function(_0x5cb97e,_0x132a39){_0x5cb97e=_0x5cb97e-0x0;var _0x1714b4=_0x6d28[_0x5cb97e];return _0x1714b4;};'use strict';var pm2=require(_0x86d2('0x0'));var BPromise=require(_0x86d2('0x1'));var config=require(_0x86d2('0x2'));function connect(){return new BPromise(function(_0x5781b0,_0x20ab78){return pm2[_0x86d2('0x3')](function(_0x5d98ff){if(_0x5d98ff){return _0x20ab78(_0x5d98ff);}return _0x5781b0(_0x86d2('0x4'));});});};exports[_0x86d2('0x5')]=function(_0x59c631){return connect()['then'](function(){return new BPromise(function(_0x68ffa5,_0x972065){return pm2[_0x86d2('0x5')](_0x59c631,function(_0x5a3052,_0x1ca1a4){if(_0x5a3052){return _0x972065(_0x5a3052);}pm2[_0x86d2('0x6')]();return _0x68ffa5(_0x1ca1a4);});});});};exports[_0x86d2('0x7')]=function(_0x238f6d){return connect()[_0x86d2('0x8')](function(){return new BPromise(function(_0x3be3f3,_0x5461b8){return pm2[_0x86d2('0x7')](_0x238f6d,function(_0x1136dc,_0x39b739){if(_0x1136dc){return _0x5461b8(_0x1136dc);}pm2[_0x86d2('0x6')]();return _0x3be3f3(_0x39b739);});});});};exports[_0x86d2('0x9')]=function(_0x2b7e22){return connect()[_0x86d2('0x8')](function(){return new BPromise(function(_0x2ce38e,_0x5ed12c){return pm2[_0x86d2('0x9')](_0x2b7e22,function(_0xd6a618,_0x5dcae9){if(_0xd6a618){return _0x5ed12c(_0xd6a618);}pm2['disconnect']();return _0x2ce38e(_0x5dcae9);});});});};exports['list']=function(){return connect()[_0x86d2('0x8')](function(){return new BPromise(function(_0x14d434,_0x10bfc4){return pm2[_0x86d2('0xa')](function(_0x52926e,_0x41cea5){if(_0x52926e){return _0x10bfc4(_0x52926e);}pm2[_0x86d2('0x6')]();return _0x14d434(_0x41cea5);});});});};exports['describe']=function(_0x174cb2){return connect()[_0x86d2('0x8')](function(){return new BPromise(function(_0x12f944,_0x23aa4f){return pm2['describe'](_0x174cb2,function(_0x185e85,_0x2d2e35){if(_0x185e85){return _0x23aa4f(_0x185e85);}pm2[_0x86d2('0x6')]();return _0x12f944(_0x2d2e35);});});});};exports[_0x86d2('0xb')]=function(_0x73a2c9){return connect()[_0x86d2('0x8')](function(){return new BPromise(function(_0x5e8312,_0x43700f){return pm2[_0x86d2('0xb')](_0x73a2c9,function(_0x2ed7a1,_0x229af0){if(_0x2ed7a1){return _0x43700f(_0x2ed7a1);}pm2[_0x86d2('0x6')]();return _0x5e8312(_0x229af0);});});});};exports['dump']=function(){return connect()[_0x86d2('0x8')](function(){return new BPromise(function(_0x4b7457,_0x370cd8){return pm2[_0x86d2('0xc')](function(_0xa53196){if(_0xa53196){return _0x370cd8(_0xa53196);}return _0x4b7457(_0x86d2('0xd'));});});});}; \ No newline at end of file +var _0x17c9=['describe','delete','dump','pm2','bluebird','./config','connect','connected','then','start','disconnect','stop','restart','list'];(function(_0x284a61,_0x231686){var _0x220e3c=function(_0x104496){while(--_0x104496){_0x284a61['push'](_0x284a61['shift']());}};_0x220e3c(++_0x231686);}(_0x17c9,0x145));var _0x917c=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0x17c9[_0x4a53d];return _0x27410e;};'use strict';var pm2=require(_0x917c('0x0'));var BPromise=require(_0x917c('0x1'));var config=require(_0x917c('0x2'));function connect(){return new BPromise(function(_0x29721d,_0x29cd0e){return pm2[_0x917c('0x3')](function(_0xf85f87){if(_0xf85f87){return _0x29cd0e(_0xf85f87);}return _0x29721d(_0x917c('0x4'));});});};exports['start']=function(_0x41b528){return connect()[_0x917c('0x5')](function(){return new BPromise(function(_0x1c95b5,_0x2ae0ca){return pm2[_0x917c('0x6')](_0x41b528,function(_0x2521ee,_0x3d37b4){if(_0x2521ee){return _0x2ae0ca(_0x2521ee);}pm2[_0x917c('0x7')]();return _0x1c95b5(_0x3d37b4);});});});};exports[_0x917c('0x8')]=function(_0x3d5bce){return connect()['then'](function(){return new BPromise(function(_0x58ef22,_0x458954){return pm2[_0x917c('0x8')](_0x3d5bce,function(_0x5d6158,_0x414ee8){if(_0x5d6158){return _0x458954(_0x5d6158);}pm2['disconnect']();return _0x58ef22(_0x414ee8);});});});};exports['restart']=function(_0x133287){return connect()[_0x917c('0x5')](function(){return new BPromise(function(_0xb78693,_0x173db6){return pm2[_0x917c('0x9')](_0x133287,function(_0x37579c,_0x436f58){if(_0x37579c){return _0x173db6(_0x37579c);}pm2[_0x917c('0x7')]();return _0xb78693(_0x436f58);});});});};exports[_0x917c('0xa')]=function(){return connect()['then'](function(){return new BPromise(function(_0xbba410,_0x131a42){return pm2[_0x917c('0xa')](function(_0x3c785,_0x5d9db1){if(_0x3c785){return _0x131a42(_0x3c785);}pm2[_0x917c('0x7')]();return _0xbba410(_0x5d9db1);});});});};exports['describe']=function(_0x3759bd){return connect()[_0x917c('0x5')](function(){return new BPromise(function(_0x5a6b0a,_0x36f021){return pm2[_0x917c('0xb')](_0x3759bd,function(_0x2112c7,_0x291903){if(_0x2112c7){return _0x36f021(_0x2112c7);}pm2[_0x917c('0x7')]();return _0x5a6b0a(_0x291903);});});});};exports[_0x917c('0xc')]=function(_0x1a2fa1){return connect()['then'](function(){return new BPromise(function(_0x282440,_0x24ea97){return pm2['delete'](_0x1a2fa1,function(_0x17fd1b,_0x34caa1){if(_0x17fd1b){return _0x24ea97(_0x17fd1b);}pm2[_0x917c('0x7')]();return _0x282440(_0x34caa1);});});});};exports[_0x917c('0xd')]=function(){return connect()[_0x917c('0x5')](function(){return new BPromise(function(_0x5675ce,_0x25669e){return pm2[_0x917c('0xd')](function(_0x2cfdb4){if(_0x2cfdb4){return _0x25669e(_0x2cfdb4);}return _0x5675ce('saved');});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 9710c6c..76084d4 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 _0x24f5=['find','chatTimeout','then','ChatInteraction','minutes','length','info','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','timeout','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','moment','ioredis','../../config/environment','../../mysqldb','../logger','schedule','redis','localhost','socket.io-emitter'];(function(_0x212b48,_0x193ff6){var _0xb005f8=function(_0x5dc1e3){while(--_0x5dc1e3){_0x212b48['push'](_0x212b48['shift']());}};_0xb005f8(++_0x193ff6);}(_0x24f5,0x1c7));var _0x524f=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x24f5[_0x17d9e3];return _0x14192d;};'use strict';var _=require('lodash');var moment=require(_0x524f('0x0'));var Redis=require(_0x524f('0x1'));var util=require('util');var config=require(_0x524f('0x2'));var db=require(_0x524f('0x3'))['db'];var logger=require(_0x524f('0x4'))(_0x524f('0x5'));config['redis']=_['defaults'](config[_0x524f('0x6')],{'host':_0x524f('0x7'),'port':0x18eb});var io=require(_0x524f('0x8'))(new Redis(config['redis']));function closeInteractions(){var _0xd0bffe=0x0;var _0x4ba0a0=[];return db['Setting'][_0x524f('0x9')]({'raw':!![],'attributes':['id',_0x524f('0xa')],'where':{'id':0x1}})[_0x524f('0xb')](function(_0x330f3c){_0xd0bffe=_0x330f3c[_0x524f('0xa')];if(_0xd0bffe){return db[_0x524f('0xc')]['findAll']({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x330f3c['chatTimeout'],_0x524f('0xd'))}}});}else{return[];}})[_0x524f('0xb')](function(_0x5769d9){if(_0x5769d9&&_0x5769d9[_0x524f('0xe')]){_0x4ba0a0=_['map'](_0x5769d9||[],'id');logger[_0x524f('0xf')](_0x524f('0x10'),_0x4ba0a0[_0x524f('0x11')]());return db[_0x524f('0xc')][_0x524f('0x12')]({'closeReason':_0x524f('0x13'),'disposition':_0x524f('0x14'),'closed':!![],'closedAt':moment()['format'](_0x524f('0x15'))},{'where':{'id':_0x4ba0a0}});}})[_0x524f('0xb')](function(){if(_0x4ba0a0&&_0x4ba0a0['length']){logger[_0x524f('0xf')](_0x524f('0x16'),_0x4ba0a0[_0x524f('0x11')]());for(var _0x5bb23f=0x0;_0x5bb23f<_0x4ba0a0[_0x524f('0xe')];_0x5bb23f++){io[_0x524f('0x17')](_0x524f('0x18'),{'id':_0x4ba0a0[_0x5bb23f],'closed':!![]});}}})[_0x524f('0x19')](function(_0xf9c8ee){logger[_0x524f('0x1a')](_0x524f('0x1b'),_0xf9c8ee?util[_0x524f('0x1c')](_0xf9c8ee,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x75cc=['socket.io-emitter','Setting','find','chatTimeout','then','ChatInteraction','findAll','lastMsgAt','subtract','minutes','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','format','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','catch','error','inspect','start','lodash','moment','ioredis','../../config/environment','../../mysqldb','schedule','defaults','redis','localhost'];(function(_0xc55698,_0x3de23c){var _0x3dd72c=function(_0x4940a6){while(--_0x4940a6){_0xc55698['push'](_0xc55698['shift']());}};_0x3dd72c(++_0x3de23c);}(_0x75cc,0x117));var _0xc75c=function(_0x1b90ce,_0xd558c5){_0x1b90ce=_0x1b90ce-0x0;var _0x16ac45=_0x75cc[_0x1b90ce];return _0x16ac45;};'use strict';var _=require(_0xc75c('0x0'));var moment=require(_0xc75c('0x1'));var Redis=require(_0xc75c('0x2'));var util=require('util');var config=require(_0xc75c('0x3'));var db=require(_0xc75c('0x4'))['db'];var logger=require('../logger')(_0xc75c('0x5'));config['redis']=_[_0xc75c('0x6')](config[_0xc75c('0x7')],{'host':_0xc75c('0x8'),'port':0x18eb});var io=require(_0xc75c('0x9'))(new Redis(config[_0xc75c('0x7')]));function closeInteractions(){var _0x3ed633=0x0;var _0xd45a7b=[];return db[_0xc75c('0xa')][_0xc75c('0xb')]({'raw':!![],'attributes':['id',_0xc75c('0xc')],'where':{'id':0x1}})[_0xc75c('0xd')](function(_0x1a90e4){_0x3ed633=_0x1a90e4[_0xc75c('0xc')];if(_0x3ed633){return db[_0xc75c('0xe')][_0xc75c('0xf')]({'raw':!![],'attributes':['id',_0xc75c('0x10')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xc75c('0x11')](_0x1a90e4[_0xc75c('0xc')],_0xc75c('0x12'))}}});}else{return[];}})[_0xc75c('0xd')](function(_0x89993e){if(_0x89993e&&_0x89993e[_0xc75c('0x13')]){_0xd45a7b=_[_0xc75c('0x14')](_0x89993e||[],'id');logger[_0xc75c('0x15')](_0xc75c('0x16'),_0xd45a7b[_0xc75c('0x17')]());return db['ChatInteraction'][_0xc75c('0x18')]({'closeReason':_0xc75c('0x19'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0xc75c('0x1a')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0xd45a7b}});}})[_0xc75c('0xd')](function(){if(_0xd45a7b&&_0xd45a7b[_0xc75c('0x13')]){logger[_0xc75c('0x15')](_0xc75c('0x1b'),_0xd45a7b[_0xc75c('0x17')]());for(var _0x5b2d5a=0x0;_0x5b2d5a<_0xd45a7b[_0xc75c('0x13')];_0x5b2d5a++){io['emit']('chatInteraction:update',{'id':_0xd45a7b[_0x5b2d5a],'closed':!![]});}}})[_0xc75c('0x1c')](function(_0xedec19){logger[_0xc75c('0x1d')]('[CHAT]\x20Error\x20closing\x20interactions',_0xedec19?util[_0xc75c('0x1e')](_0xedec19,{'showHidden':![],'depth':null}):'');});}exports[_0xc75c('0x1f')]=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 bd367b7..97de76a 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 _0x18b9=['exports','../../api/cloudProvider/cloudProvider.oauth.js','startAllRefreshIntervals'];(function(_0x1b3e49,_0x299f04){var _0x596fb2=function(_0x1594bd){while(--_0x1594bd){_0x1b3e49['push'](_0x1b3e49['shift']());}};_0x596fb2(++_0x299f04);}(_0x18b9,0xb5));var _0x918b=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x18b9[_0x465a0c];return _0x1e202e;};'use strict';function start(){var _0x13e458=require(_0x918b('0x0'));return _0x13e458[_0x918b('0x1')]();}module[_0x918b('0x2')]={'intervals':{},'start':start}; \ No newline at end of file +var _0x78b1=['exports','startAllRefreshIntervals'];(function(_0x403ca6,_0x24e284){var _0x4e0e05=function(_0x3a76ba){while(--_0x3a76ba){_0x403ca6['push'](_0x403ca6['shift']());}};_0x4e0e05(++_0x24e284);}(_0x78b1,0x17f));var _0x178b=function(_0x38c8fb,_0xf9f7a4){_0x38c8fb=_0x38c8fb-0x0;var _0x47074a=_0x78b1[_0x38c8fb];return _0x47074a;};'use strict';function start(){var _0x412c1d=require('../../api/cloudProvider/cloudProvider.oauth.js');return _0x412c1d[_0x178b('0x0')]();}module[_0x178b('0x1')]={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 470dc0a..4203a76 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 _0x5da1=['isBetween','startAt','endAt','cron','start','add\x20cron','exists','deleteJob','stop\x20cron','update','run','path','lodash','moment','jayson/promise','bluebird','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','http','number','AnalyticExtractedReport','findOne','then','catch','error','info','Try\x20to\x20send\x20a\x20mail\x20to','MailAccount','getSmtpOptions','format','\x22%s\x22\x20<%s>','name','email','user','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','join','../../files/reports','%s.%s','basename','savename','zip','existsSync','status','Sent','message','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','attachments','Empty','text','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','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','Failed','[handleSendEmail]\x20Unrecognized\x20status:','request','SendMail','error\x20mail','case\x20loading','currentAttempt','retryOptions','retries','data','operation','retry','still\x20loading','case\x20completed','job','stop','case\x20failed','dataValues','attempt','Job\x20ID\x20','\x20Attempt\x20#:','report\x20status:','Smtp','subtractNumber\x20null\x20or\x20undefined','isNil','subtractUnit\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','scheduled','exec\x20defaul\x20report\x20id:%s','DefaultReportId','runReport','CustomReportId','no\x20report\x20id','findAll','CloudProvider','jobs','map','toString','keyBy','difference','toRun','length','run\x20job','active'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x5da1,0x143));var _0x15da=function(_0x58af7f,_0x3ff122){_0x58af7f=_0x58af7f-0x0;var _0x263cc6=_0x5da1[_0x58af7f];return _0x263cc6;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0x15da('0x0'));var _=require(_0x15da('0x1'));var moment=require(_0x15da('0x2'));var CronJobManager=require('cron-job-manager');var jayson=require(_0x15da('0x3'));var BPromise=require(_0x15da('0x4'));var logger=require(_0x15da('0x5'))(_0x15da('0x6'));var db=require(_0x15da('0x7'))['db'];const retry=require('retry');var analyticCustomReportController=require(_0x15da('0x8'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson['client'][_0x15da('0x9')]({'port':0x232b});var manager=new CronJobManager();function getReportData(_0x16b5c7){const _0x166c28={};if(typeof _0x16b5c7===_0x15da('0xa')){_0x166c28['id']=_0x16b5c7;}return db[_0x15da('0xb')][_0x15da('0xc')]({'where':_0x166c28})[_0x15da('0xd')](function(_0xedbcf){return _0xedbcf;})[_0x15da('0xe')](function(_0x1067e9){logger[_0x15da('0xf')](_0x1067e9);});}function handleSendEmail(_0x2f1b73,_0x219d2f){logger[_0x15da('0x10')](_0x15da('0x11'),_0x2f1b73['email']);var _0x1ca566=!![];var _0x140f99=_0x2f1b73[_0x15da('0x12')][_0x15da('0x13')]();var _0x26cf39={'account':_0x140f99,'message':{'from':util[_0x15da('0x14')](_0x15da('0x15'),_0x2f1b73[_0x15da('0x12')][_0x15da('0x16')],_0x2f1b73[_0x15da('0x12')][_0x15da('0x17')]||_0x2f1b73[_0x15da('0x12')]['Smtp'][_0x15da('0x18')]),'to':_0x2f1b73[_0x15da('0x17')],'cc':_0x2f1b73['cc'],'bcc':_0x2f1b73['bcc'],'subject':util[_0x15da('0x14')](_0x15da('0x19'),_0x219d2f[_0x15da('0x16')],_0x2f1b73[_0x15da('0x1a')],_0x2f1b73[_0x15da('0x1b')])}};var _0x1bb71e=path[_0x15da('0x1c')](__dirname,_0x15da('0x1d'));var _0xc7217b=_0x219d2f['savename'];var _0x58d29c=util['format'](_0x15da('0x1e'),path[_0x15da('0x1f')](_0x219d2f[_0x15da('0x20')],path['extname'](_0x219d2f['savename'])),_0x15da('0x21'));var _0x272ede=path[_0x15da('0x1c')](_0x1bb71e,_0xc7217b);var _0x48f321=path[_0x15da('0x1c')](_0x1bb71e,_0x58d29c);if(fs[_0x15da('0x22')](_0x272ede)){_0x219d2f[_0x15da('0x23')]=_0x15da('0x24');_0x26cf39['message']['attachments']=[{'filename':_0xc7217b,'path':_0x272ede}];_0x26cf39[_0x15da('0x25')]['text']=util['format'](_0x15da('0x26'),JSON[_0x15da('0x27')](_0x219d2f,null,0x2));}else if(fs[_0x15da('0x22')](_0x48f321)){_0x219d2f[_0x15da('0x23')]=_0x15da('0x24');_0x26cf39[_0x15da('0x25')][_0x15da('0x28')]=[{'filename':_0x58d29c,'path':_0x48f321}];}else{if(_0x219d2f['status']===_0x15da('0x29')){_0x26cf39[_0x15da('0x25')][_0x15da('0x2a')]=_0x15da('0x2b');if(!_0x2f1b73[_0x15da('0x2c')]){_0x1ca566=![];logger[_0x15da('0x10')]('empty\x20file,\x20email\x20not\x20sent');}}else if(_0x219d2f[_0x15da('0x23')]===_0x15da('0x2d')){_0x26cf39[_0x15da('0x25')][_0x15da('0x2a')]=_0x15da('0x2e');}else if(_0x219d2f[_0x15da('0x23')]===_0x15da('0x2f')){_0x26cf39[_0x15da('0x25')][_0x15da('0x2a')]=_0x15da('0x30');}else if(_0x219d2f['status']===_0x15da('0x31')){_0x26cf39[_0x15da('0x25')][_0x15da('0x2a')]='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';}else{logger[_0x15da('0xf')](_0x15da('0x32'),_0x219d2f[_0x15da('0x23')]);}}if(_0x1ca566){return client[_0x15da('0x33')](_0x15da('0x34'),_0x26cf39)['then'](function(_0x57a696){if(_0x57a696[_0x15da('0xf')]){return logger[_0x15da('0xf')](_0x15da('0x35'),JSON[_0x15da('0x27')](_0x57a696));}return logger[_0x15da('0x10')]('email\x20sent');})[_0x15da('0xe')](function(_0x428997){return logger[_0x15da('0xf')](_0x15da('0x35'),JSON['stringify'](_0x428997));});}}function handleError(){return function(_0x350788){return logger[_0x15da('0xf')](JSON['stringify'](_0x350788));};}function loading(_0x11af10){logger[_0x15da('0x10')](_0x15da('0x36'));if(_0x11af10[_0x15da('0x37')]===_0x11af10[_0x15da('0x38')][_0x15da('0x39')]){handleSendEmail(_0x11af10['job'],_0x11af10[_0x15da('0x3a')]);_0x11af10[_0x15da('0x3b')]['stop']();}else{_0x11af10[_0x15da('0x3b')][_0x15da('0x3c')](_0x15da('0x3d'));}}function completed(_0x3ddd88){logger[_0x15da('0x10')](_0x15da('0x3e'));handleSendEmail(_0x3ddd88[_0x15da('0x3f')],_0x3ddd88[_0x15da('0x3a')]);_0x3ddd88['operation'][_0x15da('0x40')]();}function empty(_0x59794a){logger[_0x15da('0x10')]('case\x20empty');handleSendEmail(_0x59794a['job'],_0x59794a['data']);_0x59794a[_0x15da('0x3b')][_0x15da('0x40')]();}function failed(_0x17fb19){logger['info'](_0x15da('0x41'));handleSendEmail(_0x17fb19[_0x15da('0x3f')],_0x17fb19['data']);_0x17fb19[_0x15da('0x3b')][_0x15da('0x40')]();}function urecognized(_0x369ea0){logger[_0x15da('0xf')]('Unrecognized\x20status:',_0x369ea0['entity'][_0x15da('0x42')][_0x15da('0x23')]);_0x369ea0[_0x15da('0x3b')][_0x15da('0x40')]();}const reportStatusStrategies={'Loading':loading,'Completed':completed,'Empty':empty,'Failed':failed,'Unrecognized':urecognized};function retryer(_0x20e545,_0x1939c3){const _0x381aef={'retries':0x3,'factor':0x2,'minTimeout':0x5b*0x3e8,'maxTimeout':0xa*0x3c*0x3e8};const _0x57e2d0=retry[_0x15da('0x3b')](_0x381aef);_0x57e2d0[_0x15da('0x43')](_0x541b0c=>{logger[_0x15da('0x10')](_0x15da('0x44')+_0x20e545['id']+_0x15da('0x45')+_0x541b0c);try{getReportData(_0x1939c3['id'])[_0x15da('0xd')](function(_0xa62be9){_0x1939c3=_0xa62be9;logger[_0x15da('0x10')](_0x15da('0x46'),_0xa62be9['dataValues'][_0x15da('0x23')]);if(!reportStatusStrategies[_0xa62be9['dataValues'][_0x15da('0x23')]]){logger[_0x15da('0xf')]('report\x20status:',_0xa62be9[_0x15da('0x42')][_0x15da('0x23')]);_0x57e2d0[_0x15da('0x3c')]();}reportStatusStrategies[_0xa62be9[_0x15da('0x42')][_0x15da('0x23')]]({'operation':_0x57e2d0,'currentAttempt':_0x541b0c,'retryOptions':_0x381aef,'job':_0x20e545,'data':_0x1939c3,'entity':_0xa62be9});});}catch(_0x3e1e90){_0x57e2d0[_0x15da('0x3c')](_0x3e1e90);}});}function handleResult(_0x5f0da6){return function(_0x4fea2e){if(_0x5f0da6['sendMail']&&_0x5f0da6[_0x15da('0x12')]&&_0x5f0da6[_0x15da('0x12')][_0x15da('0x47')]&&!_['isNil'](_0x5f0da6['email'])){retryer(_0x5f0da6,_0x4fea2e);}};}function handleJob(_0x3cb007){return function(){try{if(_['isNil'](_0x3cb007['subtractNumber'])){return logger[_0x15da('0x10')](_0x15da('0x48'));}if(_[_0x15da('0x49')](_0x3cb007[_0x15da('0x1b')])){return logger['info'](_0x15da('0x4a'));}var _0x3b7530={'startDate':moment()['subtract'](_0x3cb007[_0x15da('0x1a')],_0x3cb007[_0x15da('0x1b')])[_0x15da('0x14')](_0x15da('0x4b')),'endDate':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'type':_0x15da('0x4c'),'output':_0x3cb007['output'],'name':_0x3cb007[_0x15da('0x16')]};if(!_[_0x15da('0x49')](_0x3cb007['DefaultReportId'])){logger[_0x15da('0x10')](_0x15da('0x4d'),_0x3cb007[_0x15da('0x4e')]);return analyticDefaultReportController[_0x15da('0x4f')]({'id':_0x3cb007[_0x15da('0x4e')]},_0x3b7530)[_0x15da('0xd')](handleResult(_0x3cb007))[_0x15da('0xe')](handleError());}if(!_['isNil'](_0x3cb007[_0x15da('0x50')])){logger[_0x15da('0x10')]('exec\x20custom\x20report\x20id:%s',_0x3cb007[_0x15da('0x50')]);return analyticCustomReportController[_0x15da('0x4f')]({'id':_0x3cb007['CustomReportId']},_0x3b7530)[_0x15da('0xd')](handleResult(_0x3cb007))['catch'](handleError());}}catch(_0x58e05e){logger[_0x15da('0xf')](JSON['stringify'](_0x58e05e));}return logger[_0x15da('0x10')](_0x15da('0x51'));};}function getJobs(_0x265596){var _0x4f7bf0={};if(_0x265596){_0x4f7bf0['id']=_0x265596;}return db['Schedule'][_0x15da('0x52')]({'where':_0x4f7bf0,'include':[{'model':db[_0x15da('0x12')],'attributes':['id','name',_0x15da('0x17')],'include':[{'model':db['MailServerOut'],'as':_0x15da('0x47'),'include':[{'model':db[_0x15da('0x53')],'as':_0x15da('0x53')}]}]}]})['then'](function(_0x55bbef){var _0x3ebb94=_['keys'](manager[_0x15da('0x54')]);var _0x35f9ae=_[_0x15da('0x55')](_0x55bbef,function(_0x3dab42){return _0x3dab42['id'][_0x15da('0x56')]();});var _0x9ff4f=_[_0x15da('0x57')](_0x55bbef,function(_0x337260){return _0x337260['id'][_0x15da('0x56')]();});var _0x1a1ac4=_0x265596?_0x35f9ae:_[_0x15da('0x58')](_0x35f9ae,_0x3ebb94);var _0x2e9790=_['intersection'](_0x35f9ae,_0x3ebb94);var _0x77bd9e=_[_0x15da('0x58')](_0x3ebb94,_0x35f9ae);var _0x3c089a;var _0x31de07;for(_0x3c089a=0x0;_0x3c089a<_0x77bd9e['length']&&!_0x265596;_0x3c089a+=0x1){_0x31de07=_0x77bd9e[_0x3c089a][_0x15da('0x56')]();if(manager['exists'](_0x31de07)){manager[_0x15da('0x40')](_0x31de07);manager['deleteJob'](_0x31de07);logger[_0x15da('0x10')]('delete\x20cron',_0x31de07);}}logger[_0x15da('0x10')](_0x15da('0x59'),JSON[_0x15da('0x27')](_0x1a1ac4));for(_0x3c089a=0x0;_0x3c089a<_0x1a1ac4[_0x15da('0x5a')];_0x3c089a+=0x1){_0x31de07=_0x1a1ac4[_0x3c089a]['toString']();if(_0x265596){logger[_0x15da('0x10')](JSON['stringify'](_0x9ff4f[_0x31de07]));BPromise['resolve']()['then'](handleJob(_0x9ff4f[_0x31de07]));logger['info'](_0x15da('0x5b'),_0x9ff4f[_0x31de07][_0x15da('0x16')],_0x9ff4f[_0x31de07]['cron']);}else if(_0x9ff4f[_0x31de07]['cron']&&_0x9ff4f[_0x31de07][_0x15da('0x5c')]&&moment()[_0x15da('0x5d')](_0x9ff4f[_0x31de07][_0x15da('0x5e')],_0x9ff4f[_0x31de07][_0x15da('0x5f')])){manager['add'](_0x31de07,_0x9ff4f[_0x31de07][_0x15da('0x60')],handleJob(_0x9ff4f[_0x31de07]));manager[_0x15da('0x61')](_0x31de07);logger[_0x15da('0x10')](_0x15da('0x62'),_0x9ff4f[_0x31de07][_0x15da('0x16')],_0x9ff4f[_0x31de07][_0x15da('0x60')]);}else if(manager[_0x15da('0x63')](_0x31de07)){manager['stop'](_0x31de07);manager[_0x15da('0x64')](_0x31de07);logger['info'](_0x15da('0x65'),_0x9ff4f[_0x31de07]['name'],_0x9ff4f[_0x31de07][_0x15da('0x60')]);}}for(_0x3c089a=0x0,_0x31de07;_0x3c089a<_0x2e9790['length']&&!_0x265596;_0x3c089a+=0x1){_0x31de07=_0x2e9790[_0x3c089a][_0x15da('0x56')]();if(manager['exists'](_0x31de07)){if(_0x9ff4f[_0x31de07]['cron']&&_0x9ff4f[_0x31de07][_0x15da('0x5c')]&&moment()[_0x15da('0x5d')](_0x9ff4f[_0x31de07][_0x15da('0x5e')],_0x9ff4f[_0x31de07][_0x15da('0x5f')])){manager[_0x15da('0x66')](_0x31de07,_0x9ff4f[_0x31de07]['cron'],handleJob(_0x9ff4f[_0x31de07]));logger['info']('update\x20cron',_0x9ff4f[_0x31de07]['name'],_0x9ff4f[_0x31de07][_0x15da('0x60')]);}else{manager[_0x15da('0x40')](_0x31de07);manager[_0x15da('0x64')](_0x31de07);logger['info'](_0x15da('0x65'),_0x9ff4f[_0x31de07]['name'],_0x9ff4f[_0x31de07]['cron']);}}}})['catch'](function(_0xe7a27a){logger[_0x15da('0xf')](JSON[_0x15da('0x27')](_0xe7a27a));});}exports[_0x15da('0x67')]=function(_0x4cab23){return getJobs(_0x4cab23);};exports[_0x15da('0x61')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x5d74=['retryOptions','retries','job','stop','operation','still\x20loading','case\x20completed','case\x20empty','data','entity','dataValues','Job\x20ID\x20','report\x20status:','sendMail','Smtp','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','exec\x20custom\x20report\x20id:%s','CustomReportId','no\x20report\x20id','findAll','MailServerOut','CloudProvider','map','keyBy','toString','difference','intersection','length','exists','deleteJob','delete\x20cron','toRun','run\x20job','cron','active','isBetween','startAt','endAt','add','stop\x20cron','update','update\x20cron','run','start','util','path','lodash','moment','cron-job-manager','jayson/promise','bluebird','../logger','schedule','retry','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','number','AnalyticExtractedReport','error','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','getSmtpOptions','format','\x22%s\x22\x20<%s>','name','subtractNumber','join','../../files/reports','%s.%s','savename','extname','zip','status','Sent','message','attachments','text','existsSync','Empty','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','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','then','error\x20mail','stringify','email\x20sent','catch','case\x20loading'];(function(_0x2f43ac,_0x463486){var _0x29a173=function(_0x219a88){while(--_0x219a88){_0x2f43ac['push'](_0x2f43ac['shift']());}};_0x29a173(++_0x463486);}(_0x5d74,0x1e6));var _0x45d7=function(_0x5b47f5,_0x97cc4){_0x5b47f5=_0x5b47f5-0x0;var _0x535f34=_0x5d74[_0x5b47f5];return _0x535f34;};'use strict';var fs=require('fs');var util=require(_0x45d7('0x0'));var path=require(_0x45d7('0x1'));var _=require(_0x45d7('0x2'));var moment=require(_0x45d7('0x3'));var CronJobManager=require(_0x45d7('0x4'));var jayson=require(_0x45d7('0x5'));var BPromise=require(_0x45d7('0x6'));var logger=require(_0x45d7('0x7'))(_0x45d7('0x8'));var db=require('../../mysqldb')['db'];const retry=require(_0x45d7('0x9'));var analyticCustomReportController=require(_0x45d7('0xa'));var analyticDefaultReportController=require(_0x45d7('0xb'));var client=jayson[_0x45d7('0xc')][_0x45d7('0xd')]({'port':0x232b});var manager=new CronJobManager();function getReportData(_0x27fab9){const _0x1f40e0={};if(typeof _0x27fab9===_0x45d7('0xe')){_0x1f40e0['id']=_0x27fab9;}return db[_0x45d7('0xf')]['findOne']({'where':_0x1f40e0})['then'](function(_0x58a13c){return _0x58a13c;})['catch'](function(_0xfa5d56){logger[_0x45d7('0x10')](_0xfa5d56);});}function handleSendEmail(_0x51e268,_0x2bdb06){logger[_0x45d7('0x11')](_0x45d7('0x12'),_0x51e268[_0x45d7('0x13')]);var _0x5ca41b=!![];var _0x3750df=_0x51e268[_0x45d7('0x14')][_0x45d7('0x15')]();var _0x1e379f={'account':_0x3750df,'message':{'from':util[_0x45d7('0x16')](_0x45d7('0x17'),_0x51e268['MailAccount'][_0x45d7('0x18')],_0x51e268['MailAccount'][_0x45d7('0x13')]||_0x51e268['MailAccount']['Smtp']['user']),'to':_0x51e268[_0x45d7('0x13')],'cc':_0x51e268['cc'],'bcc':_0x51e268['bcc'],'subject':util[_0x45d7('0x16')]('Report\x20%s\x20last\x20%s\x20%s',_0x2bdb06['name'],_0x51e268[_0x45d7('0x19')],_0x51e268['subtractUnit'])}};var _0x59a3ce=path[_0x45d7('0x1a')](__dirname,_0x45d7('0x1b'));var _0x1ae0d4=_0x2bdb06['savename'];var _0x465c44=util[_0x45d7('0x16')](_0x45d7('0x1c'),path['basename'](_0x2bdb06[_0x45d7('0x1d')],path[_0x45d7('0x1e')](_0x2bdb06[_0x45d7('0x1d')])),_0x45d7('0x1f'));var _0x52ca83=path[_0x45d7('0x1a')](_0x59a3ce,_0x1ae0d4);var _0x27e9fd=path[_0x45d7('0x1a')](_0x59a3ce,_0x465c44);if(fs['existsSync'](_0x52ca83)){_0x2bdb06[_0x45d7('0x20')]=_0x45d7('0x21');_0x1e379f[_0x45d7('0x22')][_0x45d7('0x23')]=[{'filename':_0x1ae0d4,'path':_0x52ca83}];_0x1e379f[_0x45d7('0x22')][_0x45d7('0x24')]=util[_0x45d7('0x16')]('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON['stringify'](_0x2bdb06,null,0x2));}else if(fs[_0x45d7('0x25')](_0x27e9fd)){_0x2bdb06[_0x45d7('0x20')]='Sent';_0x1e379f['message'][_0x45d7('0x23')]=[{'filename':_0x465c44,'path':_0x27e9fd}];}else{if(_0x2bdb06['status']===_0x45d7('0x26')){_0x1e379f[_0x45d7('0x22')][_0x45d7('0x24')]=_0x45d7('0x27');if(!_0x51e268['sendIfEmpty']){_0x5ca41b=![];logger[_0x45d7('0x11')](_0x45d7('0x28'));}}else if(_0x2bdb06[_0x45d7('0x20')]===_0x45d7('0x29')){_0x1e379f[_0x45d7('0x22')][_0x45d7('0x24')]=_0x45d7('0x2a');}else if(_0x2bdb06['status']==='Completed'){_0x1e379f[_0x45d7('0x22')][_0x45d7('0x24')]=_0x45d7('0x2b');}else if(_0x2bdb06['status']==='Failed'){_0x1e379f[_0x45d7('0x22')][_0x45d7('0x24')]=_0x45d7('0x2c');}else{logger[_0x45d7('0x10')](_0x45d7('0x2d'),_0x2bdb06[_0x45d7('0x20')]);}}if(_0x5ca41b){return client[_0x45d7('0x2e')](_0x45d7('0x2f'),_0x1e379f)[_0x45d7('0x30')](function(_0x24a19c){if(_0x24a19c['error']){return logger[_0x45d7('0x10')](_0x45d7('0x31'),JSON[_0x45d7('0x32')](_0x24a19c));}return logger[_0x45d7('0x11')](_0x45d7('0x33'));})[_0x45d7('0x34')](function(_0x59d685){return logger['error'](_0x45d7('0x31'),JSON[_0x45d7('0x32')](_0x59d685));});}}function handleError(){return function(_0x545836){return logger[_0x45d7('0x10')](JSON['stringify'](_0x545836));};}function loading(_0x4be869){logger[_0x45d7('0x11')](_0x45d7('0x35'));if(_0x4be869['currentAttempt']===_0x4be869[_0x45d7('0x36')][_0x45d7('0x37')]){handleSendEmail(_0x4be869[_0x45d7('0x38')],_0x4be869['data']);_0x4be869['operation'][_0x45d7('0x39')]();}else{_0x4be869[_0x45d7('0x3a')][_0x45d7('0x9')](_0x45d7('0x3b'));}}function completed(_0x4108bc){logger[_0x45d7('0x11')](_0x45d7('0x3c'));handleSendEmail(_0x4108bc['job'],_0x4108bc['data']);_0x4108bc[_0x45d7('0x3a')][_0x45d7('0x39')]();}function empty(_0x141c82){logger[_0x45d7('0x11')](_0x45d7('0x3d'));handleSendEmail(_0x141c82['job'],_0x141c82[_0x45d7('0x3e')]);_0x141c82[_0x45d7('0x3a')][_0x45d7('0x39')]();}function failed(_0x4263f7){logger['info']('case\x20failed');handleSendEmail(_0x4263f7[_0x45d7('0x38')],_0x4263f7[_0x45d7('0x3e')]);_0x4263f7[_0x45d7('0x3a')]['stop']();}function urecognized(_0x12cff5){logger[_0x45d7('0x10')]('Unrecognized\x20status:',_0x12cff5[_0x45d7('0x3f')][_0x45d7('0x40')]['status']);_0x12cff5['operation'][_0x45d7('0x39')]();}const reportStatusStrategies={'Loading':loading,'Completed':completed,'Empty':empty,'Failed':failed,'Unrecognized':urecognized};function retryer(_0x2a45db,_0x24f8dc){const _0x1915fc={'retries':0x3,'factor':0x2,'minTimeout':0x5b*0x3e8,'maxTimeout':0xa*0x3c*0x3e8};const _0x38a211=retry[_0x45d7('0x3a')](_0x1915fc);_0x38a211['attempt'](_0x101b29=>{logger[_0x45d7('0x11')](_0x45d7('0x41')+_0x2a45db['id']+'\x20Attempt\x20#:'+_0x101b29);try{getReportData(_0x24f8dc['id'])[_0x45d7('0x30')](function(_0x54f3f9){_0x24f8dc=_0x54f3f9;logger[_0x45d7('0x11')](_0x45d7('0x42'),_0x54f3f9[_0x45d7('0x40')][_0x45d7('0x20')]);if(!reportStatusStrategies[_0x54f3f9[_0x45d7('0x40')][_0x45d7('0x20')]]){logger[_0x45d7('0x10')](_0x45d7('0x42'),_0x54f3f9[_0x45d7('0x40')]['status']);_0x38a211[_0x45d7('0x9')]();}reportStatusStrategies[_0x54f3f9[_0x45d7('0x40')][_0x45d7('0x20')]]({'operation':_0x38a211,'currentAttempt':_0x101b29,'retryOptions':_0x1915fc,'job':_0x2a45db,'data':_0x24f8dc,'entity':_0x54f3f9});});}catch(_0x10a515){_0x38a211[_0x45d7('0x9')](_0x10a515);}});}function handleResult(_0x1f1795){return function(_0x516b7a){if(_0x1f1795[_0x45d7('0x43')]&&_0x1f1795[_0x45d7('0x14')]&&_0x1f1795['MailAccount'][_0x45d7('0x44')]&&!_['isNil'](_0x1f1795['email'])){retryer(_0x1f1795,_0x516b7a);}};}function handleJob(_0x38d18a){return function(){try{if(_[_0x45d7('0x45')](_0x38d18a[_0x45d7('0x19')])){return logger[_0x45d7('0x11')](_0x45d7('0x46'));}if(_[_0x45d7('0x45')](_0x38d18a[_0x45d7('0x47')])){return logger[_0x45d7('0x11')](_0x45d7('0x48'));}var _0xe4b2c0={'startDate':moment()[_0x45d7('0x49')](_0x38d18a[_0x45d7('0x19')],_0x38d18a[_0x45d7('0x47')])[_0x45d7('0x16')](_0x45d7('0x4a')),'endDate':moment()[_0x45d7('0x16')](_0x45d7('0x4a')),'type':_0x45d7('0x4b'),'output':_0x38d18a[_0x45d7('0x4c')],'name':_0x38d18a[_0x45d7('0x18')]};if(!_[_0x45d7('0x45')](_0x38d18a[_0x45d7('0x4d')])){logger[_0x45d7('0x11')](_0x45d7('0x4e'),_0x38d18a[_0x45d7('0x4d')]);return analyticDefaultReportController[_0x45d7('0x4f')]({'id':_0x38d18a[_0x45d7('0x4d')]},_0xe4b2c0)[_0x45d7('0x30')](handleResult(_0x38d18a))[_0x45d7('0x34')](handleError());}if(!_[_0x45d7('0x45')](_0x38d18a['CustomReportId'])){logger[_0x45d7('0x11')](_0x45d7('0x50'),_0x38d18a[_0x45d7('0x51')]);return analyticCustomReportController['runReport']({'id':_0x38d18a[_0x45d7('0x51')]},_0xe4b2c0)[_0x45d7('0x30')](handleResult(_0x38d18a))[_0x45d7('0x34')](handleError());}}catch(_0x4b2269){logger['error'](JSON['stringify'](_0x4b2269));}return logger[_0x45d7('0x11')](_0x45d7('0x52'));};}function getJobs(_0x255207){var _0x20f0bf={};if(_0x255207){_0x20f0bf['id']=_0x255207;}return db['Schedule'][_0x45d7('0x53')]({'where':_0x20f0bf,'include':[{'model':db[_0x45d7('0x14')],'attributes':['id',_0x45d7('0x18'),'email'],'include':[{'model':db[_0x45d7('0x54')],'as':'Smtp','include':[{'model':db[_0x45d7('0x55')],'as':_0x45d7('0x55')}]}]}]})[_0x45d7('0x30')](function(_0x146b0e){var _0x10807e=_['keys'](manager['jobs']);var _0x312140=_[_0x45d7('0x56')](_0x146b0e,function(_0x12eb9a){return _0x12eb9a['id']['toString']();});var _0x53ed60=_[_0x45d7('0x57')](_0x146b0e,function(_0xeb5c1c){return _0xeb5c1c['id'][_0x45d7('0x58')]();});var _0x15ec98=_0x255207?_0x312140:_[_0x45d7('0x59')](_0x312140,_0x10807e);var _0x54d494=_[_0x45d7('0x5a')](_0x312140,_0x10807e);var _0x3bad2f=_[_0x45d7('0x59')](_0x10807e,_0x312140);var _0xc4d492;var _0x7c6d0e;for(_0xc4d492=0x0;_0xc4d492<_0x3bad2f[_0x45d7('0x5b')]&&!_0x255207;_0xc4d492+=0x1){_0x7c6d0e=_0x3bad2f[_0xc4d492][_0x45d7('0x58')]();if(manager[_0x45d7('0x5c')](_0x7c6d0e)){manager['stop'](_0x7c6d0e);manager[_0x45d7('0x5d')](_0x7c6d0e);logger[_0x45d7('0x11')](_0x45d7('0x5e'),_0x7c6d0e);}}logger[_0x45d7('0x11')](_0x45d7('0x5f'),JSON[_0x45d7('0x32')](_0x15ec98));for(_0xc4d492=0x0;_0xc4d492<_0x15ec98[_0x45d7('0x5b')];_0xc4d492+=0x1){_0x7c6d0e=_0x15ec98[_0xc4d492][_0x45d7('0x58')]();if(_0x255207){logger['info'](JSON[_0x45d7('0x32')](_0x53ed60[_0x7c6d0e]));BPromise['resolve']()[_0x45d7('0x30')](handleJob(_0x53ed60[_0x7c6d0e]));logger[_0x45d7('0x11')](_0x45d7('0x60'),_0x53ed60[_0x7c6d0e]['name'],_0x53ed60[_0x7c6d0e][_0x45d7('0x61')]);}else if(_0x53ed60[_0x7c6d0e][_0x45d7('0x61')]&&_0x53ed60[_0x7c6d0e][_0x45d7('0x62')]&&moment()[_0x45d7('0x63')](_0x53ed60[_0x7c6d0e][_0x45d7('0x64')],_0x53ed60[_0x7c6d0e][_0x45d7('0x65')])){manager[_0x45d7('0x66')](_0x7c6d0e,_0x53ed60[_0x7c6d0e][_0x45d7('0x61')],handleJob(_0x53ed60[_0x7c6d0e]));manager['start'](_0x7c6d0e);logger[_0x45d7('0x11')]('add\x20cron',_0x53ed60[_0x7c6d0e][_0x45d7('0x18')],_0x53ed60[_0x7c6d0e][_0x45d7('0x61')]);}else if(manager[_0x45d7('0x5c')](_0x7c6d0e)){manager[_0x45d7('0x39')](_0x7c6d0e);manager[_0x45d7('0x5d')](_0x7c6d0e);logger[_0x45d7('0x11')](_0x45d7('0x67'),_0x53ed60[_0x7c6d0e][_0x45d7('0x18')],_0x53ed60[_0x7c6d0e][_0x45d7('0x61')]);}}for(_0xc4d492=0x0,_0x7c6d0e;_0xc4d492<_0x54d494[_0x45d7('0x5b')]&&!_0x255207;_0xc4d492+=0x1){_0x7c6d0e=_0x54d494[_0xc4d492][_0x45d7('0x58')]();if(manager[_0x45d7('0x5c')](_0x7c6d0e)){if(_0x53ed60[_0x7c6d0e][_0x45d7('0x61')]&&_0x53ed60[_0x7c6d0e][_0x45d7('0x62')]&&moment()[_0x45d7('0x63')](_0x53ed60[_0x7c6d0e]['startAt'],_0x53ed60[_0x7c6d0e][_0x45d7('0x65')])){manager[_0x45d7('0x68')](_0x7c6d0e,_0x53ed60[_0x7c6d0e][_0x45d7('0x61')],handleJob(_0x53ed60[_0x7c6d0e]));logger[_0x45d7('0x11')](_0x45d7('0x69'),_0x53ed60[_0x7c6d0e][_0x45d7('0x18')],_0x53ed60[_0x7c6d0e][_0x45d7('0x61')]);}else{manager[_0x45d7('0x39')](_0x7c6d0e);manager[_0x45d7('0x5d')](_0x7c6d0e);logger[_0x45d7('0x11')](_0x45d7('0x67'),_0x53ed60[_0x7c6d0e][_0x45d7('0x18')],_0x53ed60[_0x7c6d0e][_0x45d7('0x61')]);}}}})[_0x45d7('0x34')](function(_0x4630e9){logger['error'](JSON[_0x45d7('0x32')](_0x4630e9));});}exports[_0x45d7('0x6a')]=function(_0x46f9ba){return getJobs(_0x46f9ba);};exports[_0x45d7('0x6b')]=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 27ca072..dfe83f6 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 _0x7382=['SequelizeValidationError','start','aws-sdk','bluebird','../../config/logger','getTranscriptionJob','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data2','transcribeRegion','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','Transcript','TranscriptFileUri','then','results','transcripts','length','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','language','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','data1','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','bucket','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','catch','name','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Transcribe\x20not\x20configured','forEach','all'];(function(_0x3042c5,_0x36cb88){var _0x7cd140=function(_0x4cdcd8){while(--_0x4cdcd8){_0x3042c5['push'](_0x3042c5['shift']());}};_0x7cd140(++_0x36cb88);}(_0x7382,0x1f2));var _0x2738=function(_0x4c8303,_0x408e77){_0x4c8303=_0x4c8303-0x0;var _0x5452a4=_0x7382[_0x4c8303];return _0x5452a4;};var _=require('lodash');var AWS=require(_0x2738('0x0'));var rp=require('request-promise');var util=require('util');var BPromise=require(_0x2738('0x1'));var db=require('../../mysqldb')['db'];var logger=require(_0x2738('0x2'))('transcribe');function getTranscriptionJob(_0x402f25,_0x25ad1b,_0x4e9589,_0x471942){return new Promise(function(_0x267a1a,_0x457c61){var _0x1437b0=new AWS['TranscribeService']({'accessKeyId':_0x25ad1b,'secretAccessKey':_0x402f25,'region':_0x4e9589});_0x1437b0[_0x2738('0x3')]({'TranscriptionJobName':_0x471942},function(_0x20a64f,_0x351335){if(_0x20a64f){return _0x457c61(_0x20a64f);}else{return _0x267a1a(_0x351335);}});});}function sentiment(_0x24296e,_0x242183,_0x4d8c36,_0x2eb46d,_0xcd5079){return new Promise(function(_0x2322cd,_0x23db73){var _0x53111a=new AWS['Comprehend']({'accessKeyId':_0x242183,'secretAccessKey':_0x24296e,'region':_0x4d8c36});_0x53111a['detectSentiment']({'Text':_0x2eb46d,'LanguageCode':_0xcd5079['substring'](0x0,0x2)},function(_0x6545e9,_0x2d8019){if(_0x6545e9){return _0x23db73(_0x6545e9);}else{return _0x2322cd(_0x2d8019);}});});}function checkTranscribeJob(_0x38a830,_0x46072b,_0x263b48){var _0x41b111;return new BPromise(function(_0x39a20f,_0xe4e5e6){logger[_0x2738('0x4')](util[_0x2738('0x5')](_0x2738('0x6'),_0x38a830['id'],_0x38a830[_0x2738('0x7')]));return getTranscriptionJob(_0x263b48['data1'],_0x263b48[_0x2738('0x8')],_0x46072b[_0x2738('0x9')],_0x38a830['transcribeName'])['then'](function(_0x1542b6){logger[_0x2738('0x4')](util[_0x2738('0x5')]('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0x38a830['id'],_0x38a830[_0x2738('0x7')],_0x1542b6[_0x2738('0xa')][_0x2738('0xb')]));if(!_0x38a830[_0x2738('0xc')]){switch(_0x1542b6[_0x2738('0xa')]['TranscriptionJobStatus']){case _0x2738('0xd'):var _0xc512f9={'transcribeStatus':_0x1542b6[_0x2738('0xa')][_0x2738('0xb')],'fileUri':_0x1542b6[_0x2738('0xa')][_0x2738('0xe')][_0x2738('0xf')]};logger[_0x2738('0x4')](util[_0x2738('0x5')]('[RECORDING:%d]\x20Get\x20transcript',_0x38a830['id']));return rp({'uri':_0x1542b6[_0x2738('0xa')]['Transcript'][_0x2738('0xf')],'json':!![]})[_0x2738('0x10')](function(_0x264a56){logger[_0x2738('0x4')](util['format']('[RECORDING:%d]\x20Transcript\x20downloaded',_0x38a830['id']));if(_0x264a56&&_0x264a56[_0x2738('0x11')]&&_0x264a56[_0x2738('0x11')][_0x2738('0x12')]&&_0x264a56[_0x2738('0x11')]['transcripts'][_0x2738('0x13')]){_0xc512f9[_0x2738('0xc')]='';for(var _0x32574a=0x0;_0x32574a<_0x264a56[_0x2738('0x11')]['transcripts']['length'];_0x32574a++){_0xc512f9['fileText']+=_0x264a56[_0x2738('0x11')][_0x2738('0x12')][_0x32574a]['transcript']+'';}}return _0x38a830[_0x2738('0x14')](_0xc512f9);})[_0x2738('0x10')](function(){logger[_0x2738('0x4')](util['format'](_0x2738('0x15'),_0x38a830['id']));if(!_0x38a830[_0x2738('0x16')]){throw new db[(_0x2738('0x17'))][(_0x2738('0x18'))](_0x2738('0x19'));}if(!_0x46072b[_0x2738('0x1a')]||!_0x46072b[_0x2738('0x1b')]||!_0x46072b[_0x2738('0x1c')]||!_0x46072b[_0x2738('0x1d')]||!_0x46072b['bucket']){throw new db['Sequelize'][(_0x2738('0x18'))](_0x2738('0x1e'));}if(!_0xc512f9['fileText']){throw new Error('Transcript\x20not\x20available');}if(_0x46072b[_0x2738('0x1b')]===_0x263b48['id']){return _0x263b48;}else{return db[_0x2738('0x1f')][_0x2738('0x20')]({'where':{'id':_settings[_0x2738('0x1b')]}});}})[_0x2738('0x10')](function(_0x617ce9){if(!_0x617ce9){throw new db[(_0x2738('0x17'))][(_0x2738('0x18'))](_0x2738('0x21'));}if(!_0x617ce9['data1']||!_0x617ce9['data2']){throw new db[(_0x2738('0x17'))][(_0x2738('0x18'))](_0x2738('0x22'));}_0x41b111=_0x617ce9;logger[_0x2738('0x4')](util[_0x2738('0x5')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x38a830['id']));return sentiment(_0x41b111[_0x2738('0x23')],_0x41b111[_0x2738('0x8')],_0x46072b[_0x2738('0x1c')],_0xc512f9[_0x2738('0xc')],_0x46072b[_0x2738('0x1d')]);})[_0x2738('0x10')](function(_0x23ca9d){logger[_0x2738('0x4')](util[_0x2738('0x5')](_0x2738('0x24'),_0x38a830['id']));return _0x38a830[_0x2738('0x14')]({'sentiment':_0x23ca9d[_0x2738('0x25')],'sPositive':_0x23ca9d[_0x2738('0x26')][_0x2738('0x27')],'sNegative':_0x23ca9d[_0x2738('0x26')][_0x2738('0x28')],'sMixed':_0x23ca9d[_0x2738('0x26')][_0x2738('0x29')],'sNeutral':_0x23ca9d[_0x2738('0x26')][_0x2738('0x2a')]});})[_0x2738('0x10')](function(){logger[_0x2738('0x4')](util[_0x2738('0x5')](_0x2738('0x15'),_0x38a830['id']));_0x39a20f();});case _0x2738('0x2b'):return _0x38a830[_0x2738('0x14')]({'transcribeStatus':_0x2738('0x2b'),'failureReason':_0x1542b6[_0x2738('0xa')][_0x2738('0x2c')]})[_0x2738('0x10')](function(){logger[_0x2738('0x4')](util[_0x2738('0x5')](_0x2738('0x15'),_0x38a830['id']));_0x39a20f();});default:logger[_0x2738('0x4')](util['format'](_0x2738('0x2d'),_0x38a830['id']));break;}}else{return BPromise['resolve']()[_0x2738('0x10')](function(){if(!_0x38a830[_0x2738('0x16')]){throw new db[(_0x2738('0x17'))][(_0x2738('0x18'))](_0x2738('0x19'));}if(!_0x46072b[_0x2738('0x1a')]||!_0x46072b['sentimentAccountId']||!_0x46072b[_0x2738('0x1c')]||!_0x46072b['language']||!_0x46072b[_0x2738('0x2e')]){throw new db[(_0x2738('0x17'))][(_0x2738('0x18'))](_0x2738('0x1e'));}if(!_0x38a830[_0x2738('0xc')]){throw new Error('Transcript\x20not\x20available');}if(_0x46072b[_0x2738('0x1b')]===_0x263b48['id']){return _0x263b48;}else{return db[_0x2738('0x1f')]['findOne']({'where':{'id':_settings[_0x2738('0x1b')]}});}})[_0x2738('0x10')](function(_0x4a1de8){if(!_0x4a1de8){throw new db[(_0x2738('0x17'))][(_0x2738('0x18'))](_0x2738('0x21'));}if(!_0x4a1de8[_0x2738('0x23')]||!_0x4a1de8[_0x2738('0x8')]){throw new db['Sequelize'][(_0x2738('0x18'))](_0x2738('0x22'));}_0x41b111=_0x4a1de8;logger[_0x2738('0x4')](util[_0x2738('0x5')](_0x2738('0x2f'),_0x38a830['id']));return sentiment(_0x41b111[_0x2738('0x23')],_0x41b111['data2'],_0x46072b[_0x2738('0x1c')],_0x38a830[_0x2738('0xc')],_0x46072b[_0x2738('0x1d')]);})[_0x2738('0x10')](function(_0x2b5dbd){logger[_0x2738('0x4')](util[_0x2738('0x5')](_0x2738('0x24'),_0x38a830['id']));return _0x38a830[_0x2738('0x14')]({'sentiment':_0x2b5dbd[_0x2738('0x25')],'sPositive':_0x2b5dbd[_0x2738('0x26')]['Positive'],'sNegative':_0x2b5dbd[_0x2738('0x26')]['Negative'],'sMixed':_0x2b5dbd[_0x2738('0x26')][_0x2738('0x29')],'sNeutral':_0x2b5dbd['SentimentScore'][_0x2738('0x2a')],'transcribeStatus':'COMPLETED'});})['then'](function(){logger['info'](util[_0x2738('0x5')](_0x2738('0x15'),_0x38a830['id']));_0x39a20f();});}})[_0x2738('0x30')](function(_0x5d902b){if(_0x5d902b){if(!_0x5d902b['name']||_0x5d902b[_0x2738('0x31')]!=='SequelizeValidationError'){logger[_0x2738('0x32')](util[_0x2738('0x5')](_0x2738('0x33'),_0x38a830['id']),util['inspect'](_0x5d902b,{'showHidden':![],'depth':null}));}}_0x39a20f();});});}function checkTranscribe(){var _0x12c2ef;var _0xe9d761;var _0x4065a0;return db[_0x2738('0x34')][_0x2738('0x35')]({'where':{'transcribeStatus':_0x2738('0x36')}})['then'](function(_0xd45c22){if(!_0xd45c22||!_0xd45c22[_0x2738('0x13')]){throw new db[(_0x2738('0x17'))][(_0x2738('0x18'))](_0x2738('0x37'));}_0x12c2ef=_0xd45c22;return db[_0x2738('0x38')][_0x2738('0x20')]({'where':{'id':0x1}});})[_0x2738('0x10')](function(_0x3abe6e){if(!_0x3abe6e){throw new db[(_0x2738('0x17'))]['ValidationError']('Settings\x20not\x20available');}_0xe9d761=_0x3abe6e;if(!_0xe9d761['transcribe']||!_0xe9d761['transcribeAccountId']||!_0xe9d761[_0x2738('0x9')]||!_0xe9d761[_0x2738('0x1d')]||!_0xe9d761[_0x2738('0x2e')]){throw new db['Sequelize'][(_0x2738('0x18'))](_0x2738('0x39'));}return db[_0x2738('0x1f')]['findOne']({'where':{'id':_0xe9d761['transcribeAccountId']}});})['then'](function(_0x71063a){if(!_0x71063a){throw new db[(_0x2738('0x17'))][(_0x2738('0x18'))](_0x2738('0x21'));}if(!_0x71063a[_0x2738('0x23')]||!_0x71063a[_0x2738('0x8')]){throw new db[(_0x2738('0x17'))][(_0x2738('0x18'))](_0x2738('0x22'));}_0x4065a0=_0x71063a;var _0x5c89af=[];_0x12c2ef[_0x2738('0x3a')](function(_0x1945a9){_0x5c89af['push'](checkTranscribeJob(_0x1945a9,_0xe9d761,_0x4065a0));});return BPromise[_0x2738('0x3b')](_0x5c89af);})[_0x2738('0x30')](function(_0x28a95b){if(_0x28a95b){if(!_0x28a95b[_0x2738('0x31')]||_0x28a95b['name']!==_0x2738('0x3c')){logger[_0x2738('0x32')](util['inspect'](_0x28a95b,{'showHidden':![],'depth':null}));}}});}exports[_0x2738('0x3d')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x91b6=['Sequelize','ValidationError','sentiment','sentimentAccountId','sentimentRegion','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','language','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Positive','Negative','SentimentScore','Mixed','Neutral','FAILED','FailureReason','resolve','tempSentiment','findOne','Sentiment','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','push','catch','start','lodash','aws-sdk','util','../../config/logger','transcribe','TranscribeService','Comprehend','detectSentiment','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','fileText','TranscriptionJobStatus','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated'];(function(_0x41911,_0xc4a698){var _0x1fe5d5=function(_0x1085b3){while(--_0x1085b3){_0x41911['push'](_0x41911['shift']());}};_0x1fe5d5(++_0xc4a698);}(_0x91b6,0x18b));var _0x691b=function(_0x29740e,_0x200cc1){_0x29740e=_0x29740e-0x0;var _0x89660b=_0x91b6[_0x29740e];return _0x89660b;};var _=require(_0x691b('0x0'));var AWS=require(_0x691b('0x1'));var rp=require('request-promise');var util=require(_0x691b('0x2'));var BPromise=require('bluebird');var db=require('../../mysqldb')['db'];var logger=require(_0x691b('0x3'))(_0x691b('0x4'));function getTranscriptionJob(_0x22cf2d,_0x28f581,_0xeca3c,_0x3e19d0){return new Promise(function(_0x585420,_0x5586b9){var _0x448027=new AWS[(_0x691b('0x5'))]({'accessKeyId':_0x28f581,'secretAccessKey':_0x22cf2d,'region':_0xeca3c});_0x448027['getTranscriptionJob']({'TranscriptionJobName':_0x3e19d0},function(_0x223632,_0xceca6a){if(_0x223632){return _0x5586b9(_0x223632);}else{return _0x585420(_0xceca6a);}});});}function sentiment(_0x2fdbf8,_0x17aa85,_0xbd8767,_0x30204f,_0xc49113){return new Promise(function(_0x1073cb,_0x5ad4a9){var _0x3a4377=new AWS[(_0x691b('0x6'))]({'accessKeyId':_0x17aa85,'secretAccessKey':_0x2fdbf8,'region':_0xbd8767});_0x3a4377[_0x691b('0x7')]({'Text':_0x30204f,'LanguageCode':_0xc49113[_0x691b('0x8')](0x0,0x2)},function(_0x128bbf,_0x31eeb6){if(_0x128bbf){return _0x5ad4a9(_0x128bbf);}else{return _0x1073cb(_0x31eeb6);}});});}function checkTranscribeJob(_0x494e02,_0x3abde0,_0x152ebb){var _0xb9cc85;return new BPromise(function(_0x72a1eb,_0x592151){logger[_0x691b('0x9')](util[_0x691b('0xa')](_0x691b('0xb'),_0x494e02['id'],_0x494e02[_0x691b('0xc')]));return getTranscriptionJob(_0x152ebb[_0x691b('0xd')],_0x152ebb[_0x691b('0xe')],_0x3abde0[_0x691b('0xf')],_0x494e02['transcribeName'])[_0x691b('0x10')](function(_0x5952df){logger[_0x691b('0x9')](util[_0x691b('0xa')](_0x691b('0x11'),_0x494e02['id'],_0x494e02[_0x691b('0xc')],_0x5952df[_0x691b('0x12')]['TranscriptionJobStatus']));if(!_0x494e02[_0x691b('0x13')]){switch(_0x5952df[_0x691b('0x12')][_0x691b('0x14')]){case _0x691b('0x15'):var _0x15ed6b={'transcribeStatus':_0x5952df['TranscriptionJob'][_0x691b('0x14')],'fileUri':_0x5952df[_0x691b('0x12')][_0x691b('0x16')][_0x691b('0x17')]};logger[_0x691b('0x9')](util[_0x691b('0xa')]('[RECORDING:%d]\x20Get\x20transcript',_0x494e02['id']));return rp({'uri':_0x5952df[_0x691b('0x12')][_0x691b('0x16')]['TranscriptFileUri'],'json':!![]})[_0x691b('0x10')](function(_0x3d5a84){logger[_0x691b('0x9')](util['format'](_0x691b('0x18'),_0x494e02['id']));if(_0x3d5a84&&_0x3d5a84[_0x691b('0x19')]&&_0x3d5a84[_0x691b('0x19')]['transcripts']&&_0x3d5a84[_0x691b('0x19')][_0x691b('0x1a')]['length']){_0x15ed6b[_0x691b('0x13')]='';for(var _0x43ad07=0x0;_0x43ad07<_0x3d5a84[_0x691b('0x19')][_0x691b('0x1a')][_0x691b('0x1b')];_0x43ad07++){_0x15ed6b[_0x691b('0x13')]+=_0x3d5a84[_0x691b('0x19')]['transcripts'][_0x43ad07][_0x691b('0x1c')]+'';}}return _0x494e02[_0x691b('0x1d')](_0x15ed6b);})['then'](function(){logger[_0x691b('0x9')](util[_0x691b('0xa')](_0x691b('0x1e'),_0x494e02['id']));if(!_0x494e02['tempSentiment']){throw new db[(_0x691b('0x1f'))][(_0x691b('0x20'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x3abde0[_0x691b('0x21')]||!_0x3abde0[_0x691b('0x22')]||!_0x3abde0[_0x691b('0x23')]||!_0x3abde0['language']||!_0x3abde0[_0x691b('0x24')]){throw new db[(_0x691b('0x1f'))][(_0x691b('0x20'))](_0x691b('0x25'));}if(!_0x15ed6b[_0x691b('0x13')]){throw new Error(_0x691b('0x26'));}if(_0x3abde0[_0x691b('0x22')]===_0x152ebb['id']){return _0x152ebb;}else{return db[_0x691b('0x27')]['findOne']({'where':{'id':_settings[_0x691b('0x22')]}});}})[_0x691b('0x10')](function(_0x1aa5aa){if(!_0x1aa5aa){throw new db['Sequelize'][(_0x691b('0x20'))](_0x691b('0x28'));}if(!_0x1aa5aa['data1']||!_0x1aa5aa[_0x691b('0xe')]){throw new db[(_0x691b('0x1f'))][(_0x691b('0x20'))](_0x691b('0x29'));}_0xb9cc85=_0x1aa5aa;logger[_0x691b('0x9')](util[_0x691b('0xa')](_0x691b('0x2a'),_0x494e02['id']));return sentiment(_0xb9cc85[_0x691b('0xd')],_0xb9cc85['data2'],_0x3abde0[_0x691b('0x23')],_0x15ed6b[_0x691b('0x13')],_0x3abde0[_0x691b('0x2b')]);})['then'](function(_0x110827){logger[_0x691b('0x9')](util[_0x691b('0xa')](_0x691b('0x2c'),_0x494e02['id']));return _0x494e02[_0x691b('0x1d')]({'sentiment':_0x110827['Sentiment'],'sPositive':_0x110827['SentimentScore'][_0x691b('0x2d')],'sNegative':_0x110827['SentimentScore'][_0x691b('0x2e')],'sMixed':_0x110827[_0x691b('0x2f')][_0x691b('0x30')],'sNeutral':_0x110827[_0x691b('0x2f')][_0x691b('0x31')]});})[_0x691b('0x10')](function(){logger[_0x691b('0x9')](util[_0x691b('0xa')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x494e02['id']));_0x72a1eb();});case'FAILED':return _0x494e02[_0x691b('0x1d')]({'transcribeStatus':_0x691b('0x32'),'failureReason':_0x5952df[_0x691b('0x12')][_0x691b('0x33')]})[_0x691b('0x10')](function(){logger[_0x691b('0x9')](util[_0x691b('0xa')](_0x691b('0x1e'),_0x494e02['id']));_0x72a1eb();});default:logger[_0x691b('0x9')](util[_0x691b('0xa')]('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x494e02['id']));break;}}else{return BPromise[_0x691b('0x34')]()[_0x691b('0x10')](function(){if(!_0x494e02[_0x691b('0x35')]){throw new db[(_0x691b('0x1f'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x3abde0[_0x691b('0x21')]||!_0x3abde0[_0x691b('0x22')]||!_0x3abde0[_0x691b('0x23')]||!_0x3abde0['language']||!_0x3abde0['bucket']){throw new db[(_0x691b('0x1f'))][(_0x691b('0x20'))](_0x691b('0x25'));}if(!_0x494e02[_0x691b('0x13')]){throw new Error('Transcript\x20not\x20available');}if(_0x3abde0['sentimentAccountId']===_0x152ebb['id']){return _0x152ebb;}else{return db[_0x691b('0x27')][_0x691b('0x36')]({'where':{'id':_settings[_0x691b('0x22')]}});}})[_0x691b('0x10')](function(_0x280805){if(!_0x280805){throw new db[(_0x691b('0x1f'))][(_0x691b('0x20'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x280805['data1']||!_0x280805['data2']){throw new db['Sequelize'][(_0x691b('0x20'))](_0x691b('0x29'));}_0xb9cc85=_0x280805;logger['info'](util['format'](_0x691b('0x2a'),_0x494e02['id']));return sentiment(_0xb9cc85[_0x691b('0xd')],_0xb9cc85[_0x691b('0xe')],_0x3abde0[_0x691b('0x23')],_0x494e02[_0x691b('0x13')],_0x3abde0[_0x691b('0x2b')]);})[_0x691b('0x10')](function(_0x5440f1){logger[_0x691b('0x9')](util['format']('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x494e02['id']));return _0x494e02['update']({'sentiment':_0x5440f1[_0x691b('0x37')],'sPositive':_0x5440f1[_0x691b('0x2f')][_0x691b('0x2d')],'sNegative':_0x5440f1[_0x691b('0x2f')][_0x691b('0x2e')],'sMixed':_0x5440f1[_0x691b('0x2f')][_0x691b('0x30')],'sNeutral':_0x5440f1['SentimentScore'][_0x691b('0x31')],'transcribeStatus':_0x691b('0x15')});})[_0x691b('0x10')](function(){logger[_0x691b('0x9')](util[_0x691b('0xa')](_0x691b('0x1e'),_0x494e02['id']));_0x72a1eb();});}})['catch'](function(_0x1c1886){if(_0x1c1886){if(!_0x1c1886[_0x691b('0x38')]||_0x1c1886[_0x691b('0x38')]!==_0x691b('0x39')){logger[_0x691b('0x3a')](util[_0x691b('0xa')](_0x691b('0x3b'),_0x494e02['id']),util[_0x691b('0x3c')](_0x1c1886,{'showHidden':![],'depth':null}));}}_0x72a1eb();});});}function checkTranscribe(){var _0x5566ec;var _0x47f491;var _0x5dac4d;return db[_0x691b('0x3d')][_0x691b('0x3e')]({'where':{'transcribeStatus':_0x691b('0x3f')}})[_0x691b('0x10')](function(_0x3d69f5){if(!_0x3d69f5||!_0x3d69f5[_0x691b('0x1b')]){throw new db['Sequelize']['ValidationError'](_0x691b('0x40'));}_0x5566ec=_0x3d69f5;return db[_0x691b('0x41')][_0x691b('0x36')]({'where':{'id':0x1}});})[_0x691b('0x10')](function(_0x476b7f){if(!_0x476b7f){throw new db[(_0x691b('0x1f'))]['ValidationError'](_0x691b('0x42'));}_0x47f491=_0x476b7f;if(!_0x47f491[_0x691b('0x4')]||!_0x47f491[_0x691b('0x43')]||!_0x47f491[_0x691b('0xf')]||!_0x47f491['language']||!_0x47f491[_0x691b('0x24')]){throw new db[(_0x691b('0x1f'))][(_0x691b('0x20'))]('Transcribe\x20not\x20configured');}return db[_0x691b('0x27')][_0x691b('0x36')]({'where':{'id':_0x47f491[_0x691b('0x43')]}});})[_0x691b('0x10')](function(_0x8c51c7){if(!_0x8c51c7){throw new db['Sequelize'][(_0x691b('0x20'))](_0x691b('0x28'));}if(!_0x8c51c7[_0x691b('0xd')]||!_0x8c51c7[_0x691b('0xe')]){throw new db[(_0x691b('0x1f'))][(_0x691b('0x20'))]('Cloud\x20Provider\x20not\x20configured');}_0x5dac4d=_0x8c51c7;var _0x40964a=[];_0x5566ec['forEach'](function(_0x4be219){_0x40964a[_0x691b('0x44')](checkTranscribeJob(_0x4be219,_0x47f491,_0x5dac4d));});return BPromise['all'](_0x40964a);})[_0x691b('0x45')](function(_0x4b79b0){if(_0x4b79b0){if(!_0x4b79b0['name']||_0x4b79b0[_0x691b('0x38')]!==_0x691b('0x39')){logger['error'](util[_0x691b('0x3c')](_0x4b79b0,{'showHidden':![],'depth':null}));}}});}exports[_0x691b('0x46')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file diff --git a/server/config/schedule/whatsapp.js b/server/config/schedule/whatsapp.js index 5a075bb..28f99d0 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 _0x5a53=['[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','join','emit','whatsappInteraction:update','catch','error','inspect','start','moment','ioredis','util','../../config/environment','../logger','redis','localhost','socket.io-emitter','findAll','lastMsgAt','hours','length','map','[WHATSAPP]\x20Interactions\x20to\x20close:','WhatsappInteraction','update','system','timeout','YYYY-MM-DD\x20HH:mm:ss','then','info'];(function(_0x324bfe,_0x1b95f1){var _0x5060eb=function(_0x9ae3ca){while(--_0x9ae3ca){_0x324bfe['push'](_0x324bfe['shift']());}};_0x5060eb(++_0x1b95f1);}(_0x5a53,0x1d8));var _0x35a5=function(_0x4460b0,_0x5c3cdd){_0x4460b0=_0x4460b0-0x0;var _0x52356e=_0x5a53[_0x4460b0];return _0x52356e;};'use strict';var _=require('lodash');var moment=require(_0x35a5('0x0'));var Redis=require(_0x35a5('0x1'));var util=require(_0x35a5('0x2'));var config=require(_0x35a5('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0x35a5('0x4'))('schedule');config['redis']=_['defaults'](config[_0x35a5('0x5')],{'host':_0x35a5('0x6'),'port':0x18eb});var io=require(_0x35a5('0x7'))(new Redis(config['redis']));function closeInteractions(){var _0x283386=[];return db['WhatsappInteraction'][_0x35a5('0x8')]({'raw':!![],'attributes':['id',_0x35a5('0x9')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,_0x35a5('0xa'))}}})['then'](function(_0x1a187e){if(_0x1a187e&&_0x1a187e[_0x35a5('0xb')]){_0x283386=_[_0x35a5('0xc')](_0x1a187e||[],'id');logger['info'](_0x35a5('0xd'),_0x283386['join']());return db[_0x35a5('0xe')][_0x35a5('0xf')]({'closeReason':_0x35a5('0x10'),'disposition':_0x35a5('0x11'),'closed':!![],'closedAt':moment()['format'](_0x35a5('0x12'))},{'where':{'id':_0x283386}});}})[_0x35a5('0x13')](function(){if(_0x283386&&_0x283386[_0x35a5('0xb')]){logger[_0x35a5('0x14')](_0x35a5('0x15'),_0x283386[_0x35a5('0x16')]());for(var _0x40026a=0x0;_0x40026a<_0x283386['length'];_0x40026a++){io[_0x35a5('0x17')](_0x35a5('0x18'),{'id':_0x283386[_0x40026a],'closed':!![]});}}})[_0x35a5('0x19')](function(_0x1257c9){logger[_0x35a5('0x1a')]('[WHATSAPP]\x20Error\x20closing\x20interactions',_0x1257c9?util[_0x35a5('0x1b')](_0x1257c9,{'showHidden':![],'depth':null}):'');});}exports[_0x35a5('0x1c')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x073d=['info','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','start','moment','ioredis','util','../../mysqldb','schedule','redis','localhost','socket.io-emitter','WhatsappInteraction','findAll','lastMsgAt','subtract','hours','then','length','map','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0x073d,0xd2));var _0xd073=function(_0x353c53,_0x2102c0){_0x353c53=_0x353c53-0x0;var _0x2c55da=_0x073d[_0x353c53];return _0x2c55da;};'use strict';var _=require('lodash');var moment=require(_0xd073('0x0'));var Redis=require(_0xd073('0x1'));var util=require(_0xd073('0x2'));var config=require('../../config/environment');var db=require(_0xd073('0x3'))['db'];var logger=require('../logger')(_0xd073('0x4'));config[_0xd073('0x5')]=_['defaults'](config[_0xd073('0x5')],{'host':_0xd073('0x6'),'port':0x18eb});var io=require(_0xd073('0x7'))(new Redis(config[_0xd073('0x5')]));function closeInteractions(){var _0x2f5792=[];return db[_0xd073('0x8')][_0xd073('0x9')]({'raw':!![],'attributes':['id',_0xd073('0xa')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xd073('0xb')](0x18,_0xd073('0xc'))}}})[_0xd073('0xd')](function(_0x1c9295){if(_0x1c9295&&_0x1c9295[_0xd073('0xe')]){_0x2f5792=_[_0xd073('0xf')](_0x1c9295||[],'id');logger['info']('[WHATSAPP]\x20Interactions\x20to\x20close:',_0x2f5792[_0xd073('0x10')]());return db['WhatsappInteraction'][_0xd073('0x11')]({'closeReason':_0xd073('0x12'),'disposition':_0xd073('0x13'),'closed':!![],'closedAt':moment()[_0xd073('0x14')](_0xd073('0x15'))},{'where':{'id':_0x2f5792}});}})['then'](function(){if(_0x2f5792&&_0x2f5792[_0xd073('0xe')]){logger[_0xd073('0x16')](_0xd073('0x17'),_0x2f5792[_0xd073('0x10')]());for(var _0x589073=0x0;_0x589073<_0x2f5792[_0xd073('0xe')];_0x589073++){io[_0xd073('0x18')]('whatsappInteraction:update',{'id':_0x2f5792[_0x589073],'closed':!![]});}}})[_0xd073('0x19')](function(_0x3965a8){logger[_0xd073('0x1a')](_0xd073('0x1b'),_0x3965a8?util['inspect'](_0x3965a8,{'showHidden':![],'depth':null}):'');});}exports[_0xd073('0x1c')]=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 6a5480b..b12858e 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x14b0=['@xcally.com','then','CmContact','log','finished\x20populating','contacts1','CmHopper','destroy','bulkCreate','hopper1','contacts2','hopper2','catch','util','../mysqldb','push','Biondo','innocenzo.biondo','now','Innocenzo'];(function(_0x1d9837,_0xaf36cb){var _0x26d3a8=function(_0x4bc6e0){while(--_0x4bc6e0){_0x1d9837['push'](_0x1d9837['shift']());}};_0x26d3a8(++_0xaf36cb);}(_0x14b0,0x175));var _0x014b=function(_0x408d9b,_0x2252d8){_0x408d9b=_0x408d9b-0x0;var _0x4d3821=_0x14b0[_0x408d9b];return _0x4d3821;};'use strict';var util=require(_0x014b('0x0'));var db=require(_0x014b('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x014b('0x2')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x014b('0x3')+i,'phone':0xf879fb460+i,'email':_0x014b('0x4')+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x014b('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x014b('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x014b('0x5')](),'updatedAt':Date[_0x014b('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x014b('0x2')]({'id':i,'firstName':_0x014b('0x6')+i,'lastName':_0x014b('0x3')+i,'phone':0xf879fb460+i,'email':_0x014b('0x4')+i+_0x014b('0x7')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x014b('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x014b('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x014b('0x5')](),'updatedAt':Date[_0x014b('0x5')]()});}db['CmContact']['destroy']({'where':{}})[_0x014b('0x8')](function(){return db[_0x014b('0x9')]['bulkCreate'](contacts);})[_0x014b('0x8')](function(){console[_0x014b('0xa')](_0x014b('0xb'),_0x014b('0xc'));return db[_0x014b('0xd')][_0x014b('0xe')]({'where':{}});})[_0x014b('0x8')](function(){return db[_0x014b('0xd')][_0x014b('0xf')](hopper);})[_0x014b('0x8')](function(){console[_0x014b('0xa')](_0x014b('0xb'),_0x014b('0x10'));return db[_0x014b('0x9')][_0x014b('0xf')](contacts2);})[_0x014b('0x8')](function(){console[_0x014b('0xa')](_0x014b('0xb'),_0x014b('0x11'));return db[_0x014b('0xd')]['bulkCreate'](hopper2);})['then'](function(){console[_0x014b('0xa')](_0x014b('0xb'),_0x014b('0x12'));})[_0x014b('0x13')](function(_0x123b8b){console['log'](_0x123b8b);}); \ No newline at end of file +var _0x86cb=['Biondo','innocenzo.biondo','@xcally.com','now','CmContact','then','bulkCreate','log','contacts1','CmHopper','destroy','finished\x20populating','hopper1','hopper2','util','push','Innocenzo'];(function(_0x2f6f50,_0x1d21a7){var _0x2cf365=function(_0x1c40a7){while(--_0x1c40a7){_0x2f6f50['push'](_0x2f6f50['shift']());}};_0x2cf365(++_0x1d21a7);}(_0x86cb,0x1b7));var _0xb86c=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0x86cb[_0x2c7618];return _0x5ce3f0;};'use strict';var util=require(_0xb86c('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xb86c('0x1')]({'id':i,'firstName':_0xb86c('0x2')+i,'lastName':_0xb86c('0x3')+i,'phone':0xf879fb460+i,'email':_0xb86c('0x4')+i+_0xb86c('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xb86c('0x1')]({'id':i,'active':![],'scheduledat':Date[_0xb86c('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0xb86c('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xb86c('0x1')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0xb86c('0x3')+i,'phone':0xf879fb460+i,'email':_0xb86c('0x4')+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xb86c('0x1')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xb86c('0x6')](),'updatedAt':Date[_0xb86c('0x6')]()});}db[_0xb86c('0x7')]['destroy']({'where':{}})[_0xb86c('0x8')](function(){return db[_0xb86c('0x7')][_0xb86c('0x9')](contacts);})[_0xb86c('0x8')](function(){console[_0xb86c('0xa')]('finished\x20populating',_0xb86c('0xb'));return db[_0xb86c('0xc')][_0xb86c('0xd')]({'where':{}});})['then'](function(){return db[_0xb86c('0xc')][_0xb86c('0x9')](hopper);})[_0xb86c('0x8')](function(){console[_0xb86c('0xa')](_0xb86c('0xe'),_0xb86c('0xf'));return db['CmContact'][_0xb86c('0x9')](contacts2);})[_0xb86c('0x8')](function(){console[_0xb86c('0xa')](_0xb86c('0xe'),'contacts2');return db[_0xb86c('0xc')][_0xb86c('0x9')](hopper2);})[_0xb86c('0x8')](function(){console[_0xb86c('0xa')]('finished\x20populating',_0xb86c('0x10'));})['catch'](function(_0x1d18c9){console[_0xb86c('0xa')](_0x1d18c9);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 4f4d157..57de4a1 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5955=['udp','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','then','log','util','../mysqldb','push','format','%s%s','agent','%s%s@xcally.com','password','friend'];(function(_0x4fb4ad,_0x165cb7){var _0x40ed42=function(_0x28d648){while(--_0x28d648){_0x4fb4ad['push'](_0x4fb4ad['shift']());}};_0x40ed42(++_0x165cb7);}(_0x5955,0x1c5));var _0x5595=function(_0x587dd0,_0x273922){_0x587dd0=_0x587dd0-0x0;var _0x56f153=_0x5955[_0x587dd0];return _0x56f153;};'use strict';var util=require(_0x5595('0x0'));var db=require(_0x5595('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x5595('0x2')]({'name':util[_0x5595('0x3')]('%s%s','agent',i),'fullname':util['format'](_0x5595('0x4'),_0x5595('0x5'),i),'email':util['format'](_0x5595('0x6'),_0x5595('0x5'),i),'role':_0x5595('0x5'),'password':_0x5595('0x7'),'internal':0xfa0+i,'type':_0x5595('0x8'),'transport':[_0x5595('0x9'),'ws',_0x5595('0xa')],'disallow':[_0x5595('0xb')],'allow':[_0x5595('0xc')],'defaultuser':util[_0x5595('0x3')]('%s%s',_0x5595('0x5'),i),'encryption':_0x5595('0xd'),'avpf':_0x5595('0xd'),'force_avp':'yes','icesupport':_0x5595('0xd'),'dtlsenable':_0x5595('0xd'),'dtlsverify':'no','dtlscertfile':_0x5595('0xe'),'dtlsprivatekey':_0x5595('0xf'),'dtlssetup':_0x5595('0x10'),'callerid':util[_0x5595('0x3')](_0x5595('0x11'),util[_0x5595('0x3')](_0x5595('0x4'),_0x5595('0x5'),i),0xfa0+i)});}db[_0x5595('0x12')][_0x5595('0x13')](users)[_0x5595('0x14')](function(){console[_0x5595('0x15')]('add\x20user');})['catch'](function(_0x266209){console[_0x5595('0x15')](_0x266209);}); \ No newline at end of file +var _0xce9c=['friend','udp','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','User','log','add\x20user','catch','util','push','format','%s%s','%s%s@xcally.com','agent','password'];(function(_0x12321d,_0x1cf3bf){var _0x18fec7=function(_0x4b21c9){while(--_0x4b21c9){_0x12321d['push'](_0x12321d['shift']());}};_0x18fec7(++_0x1cf3bf);}(_0xce9c,0x189));var _0xcce9=function(_0x425d0d,_0x396c0d){_0x425d0d=_0x425d0d-0x0;var _0x36a8b8=_0xce9c[_0x425d0d];return _0x36a8b8;};'use strict';var util=require(_0xcce9('0x0'));var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xcce9('0x1')]({'name':util['format']('%s%s','agent',i),'fullname':util[_0xcce9('0x2')](_0xcce9('0x3'),'agent',i),'email':util[_0xcce9('0x2')](_0xcce9('0x4'),_0xcce9('0x5'),i),'role':_0xcce9('0x5'),'password':_0xcce9('0x6'),'internal':0xfa0+i,'type':_0xcce9('0x7'),'transport':[_0xcce9('0x8'),'ws',_0xcce9('0x9')],'disallow':[_0xcce9('0xa')],'allow':[_0xcce9('0xb')],'defaultuser':util['format']('%s%s',_0xcce9('0x5'),i),'encryption':_0xcce9('0xc'),'avpf':'yes','force_avp':'yes','icesupport':_0xcce9('0xc'),'dtlsenable':_0xcce9('0xc'),'dtlsverify':'no','dtlscertfile':_0xcce9('0xd'),'dtlsprivatekey':_0xcce9('0xe'),'dtlssetup':_0xcce9('0xf'),'callerid':util[_0xcce9('0x2')]('\x22%s\x22\x20<%s>',util['format'](_0xcce9('0x3'),_0xcce9('0x5'),i),0xfa0+i)});}db[_0xcce9('0x10')]['bulkCreate'](users)['then'](function(){console[_0xcce9('0x11')](_0xcce9('0x12'));})[_0xcce9('0x13')](function(_0x35e0c9){console['log'](_0x35e0c9);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 57a9586..6ce1c69 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9972=['Agents','format','user:%s','handshake','query','find','userProfileId','ChatInteraction','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','OpenchannelInteraction','WhatsappInteraction','WhatsappInteractions','admin','voice:outbound','push','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','Trunk','user','voice:inbound','VoiceQueues','ChatQueue','WhatsappQueues','WhatsappQueue','getVoiceQueues','getChatQueues','getFaxQueues','length','voice','chat','fax','whatsapp','telephone:%s','trunk:%s','leave','ChatInteractions','removeChatInteractions','emit','user_has_chat_interactions:remove','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','SmsInteractions','removeSmsInteractions','user_has_sms_interactions:remove','OpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','default','setMaxListeners','address','request','connection','remoteAddress','remotePort','connectedAt','SocketIO\x20','nsp','DISCONNECTED','CONNECTED','lodash','util','bluebird','../mysqldb','name','User','role','agent','telephone','type','ivr','findOne','then','autoAssociation','ChatQueues','SmsQueues','MailQueues','OpenchannelQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','where','Campaign','%s:queue:%s'];(function(_0x138969,_0x632ed5){var _0x18dcaf=function(_0x2d1b93){while(--_0x2d1b93){_0x138969['push'](_0x138969['shift']());}};_0x18dcaf(++_0x632ed5);}(_0x9972,0xaa));var _0x2997=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x9972[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x2997('0x0'));var util=require(_0x2997('0x1'));var BPromise=require(_0x2997('0x2'));var db=require(_0x2997('0x3'))['db'];var config=require('./environment');var queryQueues={'attributes':['id',_0x2997('0x4')],'include':[{'as':'Agents','model':db[_0x2997('0x5')],'attributes':['id','name',_0x2997('0x6')],'raw':!![],'where':{'role':_0x2997('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0x2997('0x8')}};var queryTrunks={'raw':!![],'attributes':['id',_0x2997('0x4')]};var queryAgents={'raw':!![],'attributes':['id',_0x2997('0x4')],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id',_0x2997('0x4'),_0x2997('0x9')],'where':{'type':_0x2997('0xa')}};function getAssociatedResources(_0x19ac49,_0x4537e0,_0x5d857){return db['UserProfileSection'][_0x2997('0xb')]({'where':{'name':_0x19ac49,'userProfileId':_0x4537e0},'raw':!![]})[_0x2997('0xc')](function(_0x4955cc){if(_0x4955cc){if(_0x4955cc[_0x2997('0xd')]){switch(_0x19ac49){case'VoiceQueues':case _0x2997('0xe'):case'FaxQueues':case _0x2997('0xf'):case _0x2997('0x10'):case _0x2997('0x11'):case'WhatsappQueues':return db[_0x5d857][_0x2997('0x12')](queryQueues);case _0x2997('0x13'):return db[_0x5d857]['findAll'](queryTelephones);case _0x2997('0x14'):return db[_0x5d857][_0x2997('0x12')](queryTrunks);case _0x2997('0x15'):return db[_0x5d857][_0x2997('0x12')](queryCampaigns);}}else{return db[_0x2997('0x16')][_0x2997('0x12')]({'attributes':[_0x2997('0x17')],'where':{'sectionId':_0x4955cc['id']},'raw':!![]})['then'](function(_0x1dfdd8){if(_0x1dfdd8){var _0x11f5df={'where':{'id':_[_0x2997('0x18')](_0x1dfdd8,'resourceId')},'raw':!![]};switch(_0x5d857){case _0x2997('0x5'):_0x11f5df[_0x2997('0x19')][_0x2997('0x6')]=_0x2997('0x8');break;case _0x2997('0x1a'):_0x11f5df['where'][_0x2997('0x9')]='ivr';break;}return db[_0x5d857][_0x2997('0x12')](_0x11f5df);}else{return[];}});}}else{return[];}})[_0x2997('0xc')](function(_0x5d2a65){return _0x5d2a65;});}function joinOrLeaveQueues(_0x37ef20,_0x217a40,_0x1185e8,_0x29fdef){_0x37ef20[_0x217a40](util['format'](_0x2997('0x1b'),_0x1185e8,_0x29fdef[_0x2997('0x4')]));if(_0x29fdef[_0x2997('0x1c')]){for(var _0x6d321=0x0;_0x6d321<_0x29fdef['Agents']['length'];_0x6d321+=0x1){_0x37ef20[_0x217a40](util[_0x2997('0x1d')](_0x2997('0x1e'),_0x29fdef[_0x2997('0x1c')][_0x6d321]['name']));}}}function joinOrLeave(_0x5ac238,_0x3c2f23,_0x694729){var _0x2205cd;if(_0x5ac238[_0x2997('0x1f')][_0x2997('0x20')]['id']){db[_0x2997('0x5')][_0x2997('0x21')]({'attributes':['id',_0x2997('0x4'),_0x2997('0x6'),_0x2997('0x22')],'where':{'id':_0x5ac238[_0x2997('0x1f')]['query']['id']},'include':[{'model':db[_0x2997('0x23')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x2997('0x24')],'as':_0x2997('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x2997('0x26')],'as':_0x2997('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0x2997('0x28')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x2997('0x29')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x2997('0x2a')],'as':_0x2997('0x2b'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x5d5d59){if(_0x5d5d59){_0x2205cd=_0x5d5d59;_0x5ac238[_0x3c2f23](util[_0x2997('0x1d')](_0x2997('0x1e'),_0x5d5d59[_0x2997('0x4')]));var _0x46b286=[];switch(_0x5d5d59['role']){case _0x2997('0x2c'):_0x5ac238[_0x3c2f23]('voice:inbound');_0x5ac238[_0x3c2f23](_0x2997('0x2d'));if(queryQueues['hasOwnProperty']('include')){delete queryQueues['include'];}_0x46b286[_0x2997('0x2e')](db['VoiceQueue'][_0x2997('0x12')](queryQueues));_0x46b286[_0x2997('0x2e')](db['ChatQueue']['findAll'](queryQueues));_0x46b286[_0x2997('0x2e')](db[_0x2997('0x2f')][_0x2997('0x12')](queryQueues));_0x46b286[_0x2997('0x2e')](db[_0x2997('0x30')][_0x2997('0x12')](queryQueues));_0x46b286[_0x2997('0x2e')](db[_0x2997('0x31')][_0x2997('0x12')](queryQueues));_0x46b286[_0x2997('0x2e')](db[_0x2997('0x32')]['findAll'](queryQueues));_0x46b286['push'](db['WhatsappQueue'][_0x2997('0x12')](queryQueues));_0x46b286[_0x2997('0x2e')](db[_0x2997('0x5')][_0x2997('0x12')](queryTelephones));_0x46b286[_0x2997('0x2e')](db[_0x2997('0x33')][_0x2997('0x12')](queryTrunks));_0x46b286[_0x2997('0x2e')](db[_0x2997('0x1a')][_0x2997('0x12')](queryCampaigns));_0x46b286['push'](db['User'][_0x2997('0x12')](queryAgents));break;case _0x2997('0x34'):_0x5ac238[_0x3c2f23](_0x2997('0x35'));_0x5ac238[_0x3c2f23](_0x2997('0x2d'));_0x46b286['push'](getAssociatedResources(_0x2997('0x36'),_0x5d5d59[_0x2997('0x22')],'VoiceQueue'));_0x46b286[_0x2997('0x2e')](getAssociatedResources('ChatQueues',_0x5d5d59[_0x2997('0x22')],_0x2997('0x37')));_0x46b286[_0x2997('0x2e')](getAssociatedResources('FaxQueues',_0x5d5d59[_0x2997('0x22')],_0x2997('0x2f')));_0x46b286[_0x2997('0x2e')](getAssociatedResources(_0x2997('0xf'),_0x5d5d59[_0x2997('0x22')],'SmsQueue'));_0x46b286['push'](getAssociatedResources(_0x2997('0x10'),_0x5d5d59['userProfileId'],_0x2997('0x31')));_0x46b286[_0x2997('0x2e')](getAssociatedResources(_0x2997('0x11'),_0x5d5d59['userProfileId'],'OpenchannelQueue'));_0x46b286['push'](getAssociatedResources(_0x2997('0x38'),_0x5d5d59[_0x2997('0x22')],_0x2997('0x39')));_0x46b286[_0x2997('0x2e')](getAssociatedResources(_0x2997('0x13'),_0x5d5d59[_0x2997('0x22')],_0x2997('0x5')));_0x46b286['push'](getAssociatedResources(_0x2997('0x14'),_0x5d5d59[_0x2997('0x22')],_0x2997('0x33')));_0x46b286['push'](getAssociatedResources(_0x2997('0x15'),_0x5d5d59[_0x2997('0x22')],_0x2997('0x1a')));_0x46b286[_0x2997('0x2e')](db[_0x2997('0x5')][_0x2997('0x12')](queryAgents));break;case _0x2997('0x7'):_0x5ac238[_0x3c2f23](_0x2997('0x35'));_0x5ac238[_0x3c2f23](_0x2997('0x2d'));_0x46b286['push'](_0x5d5d59[_0x2997('0x3a')]({'attributes':['id',_0x2997('0x4')]}));_0x46b286[_0x2997('0x2e')](_0x5d5d59[_0x2997('0x3b')]({'attributes':['id','name']}));_0x46b286['push'](_0x5d5d59[_0x2997('0x3c')]({'attributes':['id',_0x2997('0x4')]}));_0x46b286[_0x2997('0x2e')](_0x5d5d59['getSmsQueues']({'attributes':['id',_0x2997('0x4')]}));_0x46b286[_0x2997('0x2e')](_0x5d5d59['getMailQueues']({'attributes':['id',_0x2997('0x4')]}));_0x46b286['push'](_0x5d5d59['getOpenchannelQueues']({'attributes':['id',_0x2997('0x4')]}));_0x46b286[_0x2997('0x2e')](_0x5d5d59['getWhatsappQueues']({'attributes':['id',_0x2997('0x4')]}));break;}return BPromise['all'](_0x46b286);}})['then'](function(_0x412196){if(_0x412196&&_0x412196[_0x2997('0x3d')]){for(var _0x405793=0x0;_0x405793<_0x412196[_0x2997('0x3d')];_0x405793+=0x1){for(var _0x36e129=0x0;_0x36e129<_0x412196[_0x405793][_0x2997('0x3d')];_0x36e129+=0x1){switch(_0x405793){case 0x0:joinOrLeaveQueues(_0x5ac238,_0x3c2f23,_0x2997('0x3e'),_0x412196[_0x405793][_0x36e129]);break;case 0x1:joinOrLeaveQueues(_0x5ac238,_0x3c2f23,_0x2997('0x3f'),_0x412196[_0x405793][_0x36e129]);break;case 0x2:joinOrLeaveQueues(_0x5ac238,_0x3c2f23,_0x2997('0x40'),_0x412196[_0x405793][_0x36e129]);break;case 0x3:joinOrLeaveQueues(_0x5ac238,_0x3c2f23,'sms',_0x412196[_0x405793][_0x36e129]);break;case 0x4:joinOrLeaveQueues(_0x5ac238,_0x3c2f23,'mail',_0x412196[_0x405793][_0x36e129]);break;case 0x5:joinOrLeaveQueues(_0x5ac238,_0x3c2f23,'openchannel',_0x412196[_0x405793][_0x36e129]);break;case 0x6:joinOrLeaveQueues(_0x5ac238,_0x3c2f23,_0x2997('0x41'),_0x412196[_0x405793][_0x36e129]);break;case 0x7:if(_0x2205cd[_0x2997('0x6')]!==_0x2997('0x7'))_0x5ac238[_0x3c2f23](util[_0x2997('0x1d')](_0x2997('0x42'),_0x412196[_0x405793][_0x36e129][_0x2997('0x4')]));break;case 0x8:if(_0x2205cd['role']!==_0x2997('0x7'))_0x5ac238[_0x3c2f23](util[_0x2997('0x1d')](_0x2997('0x43'),_0x412196[_0x405793][_0x36e129]['name']));break;case 0x9:if(_0x2205cd[_0x2997('0x6')]!==_0x2997('0x7'))_0x5ac238[_0x3c2f23](util['format']('campaign:%s:%s',_0x412196[_0x405793][_0x36e129][_0x2997('0x9')],_0x412196[_0x405793][_0x36e129][_0x2997('0x4')]));break;case 0xa:_0x5ac238[_0x3c2f23](util[_0x2997('0x1d')](_0x2997('0x1e'),_0x412196[_0x405793][_0x36e129][_0x2997('0x4')]));break;}}}}})['then'](function(){if(_0x3c2f23===_0x2997('0x44')){var _0x1abc70=_[_0x2997('0x18')](_0x2205cd[_0x2997('0x45')],'id');return _0x2205cd[_0x2997('0x46')](_0x1abc70)[_0x2997('0xc')](function(){for(var _0x13f0df=0x0;_0x13f0df<_0x1abc70[_0x2997('0x3d')];_0x13f0df+=0x1){_0x694729[_0x2997('0x47')](_0x2997('0x48'),{'ChatInteractionId':Number(_0x1abc70[_0x13f0df]),'UserId':Number(_0x2205cd['id'])});}});}})['then'](function(){if(_0x3c2f23===_0x2997('0x44')){var _0x4fe392=_[_0x2997('0x18')](_0x2205cd[_0x2997('0x25')],'id');return _0x2205cd[_0x2997('0x49')](_0x4fe392)['then'](function(){for(var _0x3fbe23=0x0;_0x3fbe23<_0x4fe392[_0x2997('0x3d')];_0x3fbe23+=0x1){_0x694729[_0x2997('0x47')](_0x2997('0x4a'),{'MailInteractionId':Number(_0x4fe392[_0x3fbe23]),'UserId':Number(_0x2205cd['id'])});}});}})[_0x2997('0xc')](function(){if(_0x3c2f23===_0x2997('0x44')){var _0x5ba5f1=_[_0x2997('0x18')](_0x2205cd['FaxInteractions'],'id');return _0x2205cd[_0x2997('0x4b')](_0x5ba5f1)[_0x2997('0xc')](function(){for(var _0x534ad6=0x0;_0x534ad6<_0x5ba5f1[_0x2997('0x3d')];_0x534ad6+=0x1){_0x694729['emit']('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x5ba5f1[_0x534ad6]),'UserId':Number(_0x2205cd['id'])});}});}})[_0x2997('0xc')](function(){if(_0x3c2f23==='leave'){var _0x853b4d=_['map'](_0x2205cd[_0x2997('0x4c')],'id');return _0x2205cd[_0x2997('0x4d')](_0x853b4d)[_0x2997('0xc')](function(){for(var _0x3ce331=0x0;_0x3ce331<_0x853b4d[_0x2997('0x3d')];_0x3ce331+=0x1){_0x694729['emit'](_0x2997('0x4e'),{'SmsInteractionId':Number(_0x853b4d[_0x3ce331]),'UserId':Number(_0x2205cd['id'])});}});}})[_0x2997('0xc')](function(){if(_0x3c2f23===_0x2997('0x44')){var _0x45e415=_[_0x2997('0x18')](_0x2205cd[_0x2997('0x4f')],'id');return _0x2205cd[_0x2997('0x50')](_0x45e415)[_0x2997('0xc')](function(){for(var _0x4dabca=0x0;_0x4dabca<_0x45e415['length'];_0x4dabca+=0x1){_0x694729[_0x2997('0x47')](_0x2997('0x51'),{'OpenchannelInteractionId':Number(_0x45e415[_0x4dabca]),'UserId':Number(_0x2205cd['id'])});}});}})[_0x2997('0xc')](function(){if(_0x3c2f23===_0x2997('0x44')){var _0x9358e7=_[_0x2997('0x18')](_0x2205cd[_0x2997('0x2b')],'id');return _0x2205cd[_0x2997('0x52')](_0x9358e7)[_0x2997('0xc')](function(){for(var _0x415bf6=0x0;_0x415bf6<_0x9358e7[_0x2997('0x3d')];_0x415bf6+=0x1){_0x694729[_0x2997('0x47')](_0x2997('0x53'),{'WhatsappInteractionId':Number(_0x9358e7[_0x415bf6]),'UserId':Number(_0x2205cd['id'])});}});}})[_0x2997('0x54')](function(_0x3c4c09){_0x5ac238[_0x2997('0x55')](_0x3c4c09);});}}function onDisconnect(_0x3b637a,_0x4f403e){joinOrLeave(_0x3b637a,'leave',_0x4f403e);}function onConnect(_0x227526){joinOrLeave(_0x227526,_0x2997('0x56'));}exports[_0x2997('0x57')]=function(_0x48c420){_0x48c420['on']('connection',function(_0x2d0404){_0x2d0404[_0x2997('0x58')](0x0);_0x2d0404[_0x2997('0x59')]=_0x2d0404[_0x2997('0x5a')][_0x2997('0x5b')][_0x2997('0x5c')]+':'+_0x2d0404[_0x2997('0x5a')][_0x2997('0x5b')][_0x2997('0x5d')];_0x2d0404[_0x2997('0x5e')]=new Date();_0x2d0404[_0x2997('0x55')]=function(_0x1fb352){console[_0x2997('0x55')](_0x2997('0x5f')+_0x2d0404[_0x2997('0x60')][_0x2997('0x4')]+'['+_0x2d0404[_0x2997('0x59')]+']',_0x1fb352);};_0x2d0404['on']('disconnect',function(){onDisconnect(_0x2d0404,_0x48c420);_0x2d0404[_0x2997('0x55')](_0x2997('0x61'));});onConnect(_0x2d0404);_0x2d0404[_0x2997('0x55')](_0x2997('0x62'));});}; \ No newline at end of file +var _0xbd8e=['removeChatInteractions','user_has_chat_interactions:remove','MailInteractions','removeMailInteractions','emit','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','WhatsappInteractions','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','default','connection','setMaxListeners','address','request','remoteAddress','remotePort','connectedAt','SocketIO\x20','nsp','disconnect','log','CONNECTED','lodash','util','./environment','Agents','User','name','role','agent','telephone','ivr','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','MailQueues','WhatsappQueues','findAll','Trunks','map','resourceId','where','Campaign','type','then','format','%s:queue:%s','length','user:%s','handshake','query','find','ChatInteraction','ChatInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','voice:inbound','hasOwnProperty','include','push','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','voice:outbound','userProfileId','VoiceQueue','SmsQueues','OpenchannelQueues','Telephones','IvrCampaigns','getFaxQueues','getSmsQueues','getMailQueues','getWhatsappQueues','all','voice','chat','fax','sms','mail','openchannel','telephone:%s','trunk:%s','campaign:%s:%s','leave'];(function(_0x5e532b,_0xbb9974){var _0x522a09=function(_0x4ca9de){while(--_0x4ca9de){_0x5e532b['push'](_0x5e532b['shift']());}};_0x522a09(++_0xbb9974);}(_0xbd8e,0x1b5));var _0xebd8=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xbd8e[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0xebd8('0x0'));var util=require(_0xebd8('0x1'));var BPromise=require('bluebird');var db=require('../mysqldb')['db'];var config=require(_0xebd8('0x2'));var queryQueues={'attributes':['id','name'],'include':[{'as':_0xebd8('0x3'),'model':db[_0xebd8('0x4')],'attributes':['id',_0xebd8('0x5'),_0xebd8('0x6')],'raw':!![],'where':{'role':_0xebd8('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0xebd8('0x8')}};var queryTrunks={'raw':!![],'attributes':['id',_0xebd8('0x5')]};var queryAgents={'raw':!![],'attributes':['id',_0xebd8('0x5')],'where':{'role':_0xebd8('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0xebd8('0x5'),'type'],'where':{'type':_0xebd8('0x9')}};function getAssociatedResources(_0x3405f6,_0x234111,_0x13afa5){return db['UserProfileSection']['findOne']({'where':{'name':_0x3405f6,'userProfileId':_0x234111},'raw':!![]})['then'](function(_0x3fd649){if(_0x3fd649){if(_0x3fd649[_0xebd8('0xa')]){switch(_0x3405f6){case _0xebd8('0xb'):case _0xebd8('0xc'):case _0xebd8('0xd'):case'SmsQueues':case _0xebd8('0xe'):case'OpenchannelQueues':case _0xebd8('0xf'):return db[_0x13afa5][_0xebd8('0x10')](queryQueues);case'Telephones':return db[_0x13afa5][_0xebd8('0x10')](queryTelephones);case _0xebd8('0x11'):return db[_0x13afa5][_0xebd8('0x10')](queryTrunks);case'IvrCampaigns':return db[_0x13afa5][_0xebd8('0x10')](queryCampaigns);}}else{return db['UserProfileResource'][_0xebd8('0x10')]({'attributes':['resourceId'],'where':{'sectionId':_0x3fd649['id']},'raw':!![]})['then'](function(_0x3e50e0){if(_0x3e50e0){var _0x10d4eb={'where':{'id':_[_0xebd8('0x12')](_0x3e50e0,_0xebd8('0x13'))},'raw':!![]};switch(_0x13afa5){case _0xebd8('0x4'):_0x10d4eb[_0xebd8('0x14')][_0xebd8('0x6')]=_0xebd8('0x8');break;case _0xebd8('0x15'):_0x10d4eb[_0xebd8('0x14')][_0xebd8('0x16')]=_0xebd8('0x9');break;}return db[_0x13afa5][_0xebd8('0x10')](_0x10d4eb);}else{return[];}});}}else{return[];}})[_0xebd8('0x17')](function(_0x4e8ebc){return _0x4e8ebc;});}function joinOrLeaveQueues(_0x158940,_0x4577a9,_0x1ca9fa,_0x2fafc9){_0x158940[_0x4577a9](util[_0xebd8('0x18')](_0xebd8('0x19'),_0x1ca9fa,_0x2fafc9[_0xebd8('0x5')]));if(_0x2fafc9[_0xebd8('0x3')]){for(var _0x56f1f6=0x0;_0x56f1f6<_0x2fafc9['Agents'][_0xebd8('0x1a')];_0x56f1f6+=0x1){_0x158940[_0x4577a9](util[_0xebd8('0x18')](_0xebd8('0x1b'),_0x2fafc9[_0xebd8('0x3')][_0x56f1f6][_0xebd8('0x5')]));}}}function joinOrLeave(_0x1b3ce5,_0x12c460,_0x44493c){var _0x43903b;if(_0x1b3ce5[_0xebd8('0x1c')][_0xebd8('0x1d')]['id']){db[_0xebd8('0x4')][_0xebd8('0x1e')]({'attributes':['id','name',_0xebd8('0x6'),'userProfileId'],'where':{'id':_0x1b3ce5[_0xebd8('0x1c')][_0xebd8('0x1d')]['id']},'include':[{'model':db[_0xebd8('0x1f')],'as':_0xebd8('0x20'),'attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xebd8('0x21')],'as':_0xebd8('0x22'),'attributes':['id'],'raw':!![]},{'model':db[_0xebd8('0x23')],'as':_0xebd8('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0xebd8('0x25')],'as':_0xebd8('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0xebd8('0x27')],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})['then'](function(_0x352a96){if(_0x352a96){_0x43903b=_0x352a96;_0x1b3ce5[_0x12c460](util['format'](_0xebd8('0x1b'),_0x352a96['name']));var _0x463967=[];switch(_0x352a96[_0xebd8('0x6')]){case'admin':_0x1b3ce5[_0x12c460](_0xebd8('0x28'));_0x1b3ce5[_0x12c460]('voice:outbound');if(queryQueues[_0xebd8('0x29')](_0xebd8('0x2a'))){delete queryQueues[_0xebd8('0x2a')];}_0x463967['push'](db['VoiceQueue'][_0xebd8('0x10')](queryQueues));_0x463967[_0xebd8('0x2b')](db[_0xebd8('0x2c')]['findAll'](queryQueues));_0x463967[_0xebd8('0x2b')](db[_0xebd8('0x2d')][_0xebd8('0x10')](queryQueues));_0x463967[_0xebd8('0x2b')](db[_0xebd8('0x2e')][_0xebd8('0x10')](queryQueues));_0x463967[_0xebd8('0x2b')](db[_0xebd8('0x2f')][_0xebd8('0x10')](queryQueues));_0x463967[_0xebd8('0x2b')](db[_0xebd8('0x30')][_0xebd8('0x10')](queryQueues));_0x463967[_0xebd8('0x2b')](db[_0xebd8('0x31')][_0xebd8('0x10')](queryQueues));_0x463967[_0xebd8('0x2b')](db[_0xebd8('0x4')][_0xebd8('0x10')](queryTelephones));_0x463967['push'](db[_0xebd8('0x32')][_0xebd8('0x10')](queryTrunks));_0x463967['push'](db[_0xebd8('0x15')][_0xebd8('0x10')](queryCampaigns));_0x463967[_0xebd8('0x2b')](db[_0xebd8('0x4')][_0xebd8('0x10')](queryAgents));break;case'user':_0x1b3ce5[_0x12c460](_0xebd8('0x28'));_0x1b3ce5[_0x12c460](_0xebd8('0x33'));_0x463967[_0xebd8('0x2b')](getAssociatedResources(_0xebd8('0xb'),_0x352a96[_0xebd8('0x34')],_0xebd8('0x35')));_0x463967[_0xebd8('0x2b')](getAssociatedResources(_0xebd8('0xc'),_0x352a96['userProfileId'],_0xebd8('0x2c')));_0x463967[_0xebd8('0x2b')](getAssociatedResources('FaxQueues',_0x352a96[_0xebd8('0x34')],'FaxQueue'));_0x463967[_0xebd8('0x2b')](getAssociatedResources(_0xebd8('0x36'),_0x352a96[_0xebd8('0x34')],_0xebd8('0x2e')));_0x463967['push'](getAssociatedResources(_0xebd8('0xe'),_0x352a96[_0xebd8('0x34')],_0xebd8('0x2f')));_0x463967['push'](getAssociatedResources(_0xebd8('0x37'),_0x352a96[_0xebd8('0x34')],_0xebd8('0x30')));_0x463967[_0xebd8('0x2b')](getAssociatedResources(_0xebd8('0xf'),_0x352a96[_0xebd8('0x34')],_0xebd8('0x31')));_0x463967[_0xebd8('0x2b')](getAssociatedResources(_0xebd8('0x38'),_0x352a96[_0xebd8('0x34')],_0xebd8('0x4')));_0x463967[_0xebd8('0x2b')](getAssociatedResources('Trunks',_0x352a96[_0xebd8('0x34')],_0xebd8('0x32')));_0x463967['push'](getAssociatedResources(_0xebd8('0x39'),_0x352a96[_0xebd8('0x34')],_0xebd8('0x15')));_0x463967['push'](db['User']['findAll'](queryAgents));break;case _0xebd8('0x7'):_0x1b3ce5[_0x12c460](_0xebd8('0x28'));_0x1b3ce5[_0x12c460](_0xebd8('0x33'));_0x463967[_0xebd8('0x2b')](_0x352a96['getVoiceQueues']({'attributes':['id','name']}));_0x463967[_0xebd8('0x2b')](_0x352a96['getChatQueues']({'attributes':['id','name']}));_0x463967[_0xebd8('0x2b')](_0x352a96[_0xebd8('0x3a')]({'attributes':['id',_0xebd8('0x5')]}));_0x463967['push'](_0x352a96[_0xebd8('0x3b')]({'attributes':['id',_0xebd8('0x5')]}));_0x463967[_0xebd8('0x2b')](_0x352a96[_0xebd8('0x3c')]({'attributes':['id',_0xebd8('0x5')]}));_0x463967['push'](_0x352a96['getOpenchannelQueues']({'attributes':['id','name']}));_0x463967[_0xebd8('0x2b')](_0x352a96[_0xebd8('0x3d')]({'attributes':['id','name']}));break;}return BPromise[_0xebd8('0x3e')](_0x463967);}})[_0xebd8('0x17')](function(_0x28ec1e){if(_0x28ec1e&&_0x28ec1e[_0xebd8('0x1a')]){for(var _0x4f47d7=0x0;_0x4f47d7<_0x28ec1e[_0xebd8('0x1a')];_0x4f47d7+=0x1){for(var _0x51b023=0x0;_0x51b023<_0x28ec1e[_0x4f47d7][_0xebd8('0x1a')];_0x51b023+=0x1){switch(_0x4f47d7){case 0x0:joinOrLeaveQueues(_0x1b3ce5,_0x12c460,_0xebd8('0x3f'),_0x28ec1e[_0x4f47d7][_0x51b023]);break;case 0x1:joinOrLeaveQueues(_0x1b3ce5,_0x12c460,_0xebd8('0x40'),_0x28ec1e[_0x4f47d7][_0x51b023]);break;case 0x2:joinOrLeaveQueues(_0x1b3ce5,_0x12c460,_0xebd8('0x41'),_0x28ec1e[_0x4f47d7][_0x51b023]);break;case 0x3:joinOrLeaveQueues(_0x1b3ce5,_0x12c460,_0xebd8('0x42'),_0x28ec1e[_0x4f47d7][_0x51b023]);break;case 0x4:joinOrLeaveQueues(_0x1b3ce5,_0x12c460,_0xebd8('0x43'),_0x28ec1e[_0x4f47d7][_0x51b023]);break;case 0x5:joinOrLeaveQueues(_0x1b3ce5,_0x12c460,_0xebd8('0x44'),_0x28ec1e[_0x4f47d7][_0x51b023]);break;case 0x6:joinOrLeaveQueues(_0x1b3ce5,_0x12c460,'whatsapp',_0x28ec1e[_0x4f47d7][_0x51b023]);break;case 0x7:if(_0x43903b[_0xebd8('0x6')]!==_0xebd8('0x7'))_0x1b3ce5[_0x12c460](util[_0xebd8('0x18')](_0xebd8('0x45'),_0x28ec1e[_0x4f47d7][_0x51b023][_0xebd8('0x5')]));break;case 0x8:if(_0x43903b['role']!==_0xebd8('0x7'))_0x1b3ce5[_0x12c460](util[_0xebd8('0x18')](_0xebd8('0x46'),_0x28ec1e[_0x4f47d7][_0x51b023][_0xebd8('0x5')]));break;case 0x9:if(_0x43903b[_0xebd8('0x6')]!=='agent')_0x1b3ce5[_0x12c460](util[_0xebd8('0x18')](_0xebd8('0x47'),_0x28ec1e[_0x4f47d7][_0x51b023][_0xebd8('0x16')],_0x28ec1e[_0x4f47d7][_0x51b023][_0xebd8('0x5')]));break;case 0xa:_0x1b3ce5[_0x12c460](util[_0xebd8('0x18')](_0xebd8('0x1b'),_0x28ec1e[_0x4f47d7][_0x51b023][_0xebd8('0x5')]));break;}}}}})[_0xebd8('0x17')](function(){if(_0x12c460===_0xebd8('0x48')){var _0x52b481=_['map'](_0x43903b[_0xebd8('0x20')],'id');return _0x43903b[_0xebd8('0x49')](_0x52b481)[_0xebd8('0x17')](function(){for(var _0x478196=0x0;_0x478196<_0x52b481['length'];_0x478196+=0x1){_0x44493c['emit'](_0xebd8('0x4a'),{'ChatInteractionId':Number(_0x52b481[_0x478196]),'UserId':Number(_0x43903b['id'])});}});}})[_0xebd8('0x17')](function(){if(_0x12c460===_0xebd8('0x48')){var _0x5a5b61=_['map'](_0x43903b[_0xebd8('0x4b')],'id');return _0x43903b[_0xebd8('0x4c')](_0x5a5b61)['then'](function(){for(var _0x3f491d=0x0;_0x3f491d<_0x5a5b61['length'];_0x3f491d+=0x1){_0x44493c[_0xebd8('0x4d')](_0xebd8('0x4e'),{'MailInteractionId':Number(_0x5a5b61[_0x3f491d]),'UserId':Number(_0x43903b['id'])});}});}})[_0xebd8('0x17')](function(){if(_0x12c460===_0xebd8('0x48')){var _0x3bc07b=_['map'](_0x43903b[_0xebd8('0x22')],'id');return _0x43903b[_0xebd8('0x4f')](_0x3bc07b)[_0xebd8('0x17')](function(){for(var _0x17696f=0x0;_0x17696f<_0x3bc07b[_0xebd8('0x1a')];_0x17696f+=0x1){_0x44493c['emit'](_0xebd8('0x50'),{'FaxInteractionId':Number(_0x3bc07b[_0x17696f]),'UserId':Number(_0x43903b['id'])});}});}})['then'](function(){if(_0x12c460===_0xebd8('0x48')){var _0x282b5a=_['map'](_0x43903b[_0xebd8('0x24')],'id');return _0x43903b[_0xebd8('0x51')](_0x282b5a)[_0xebd8('0x17')](function(){for(var _0x487f0c=0x0;_0x487f0c<_0x282b5a[_0xebd8('0x1a')];_0x487f0c+=0x1){_0x44493c[_0xebd8('0x4d')](_0xebd8('0x52'),{'SmsInteractionId':Number(_0x282b5a[_0x487f0c]),'UserId':Number(_0x43903b['id'])});}});}})[_0xebd8('0x17')](function(){if(_0x12c460===_0xebd8('0x48')){var _0x92cb7f=_[_0xebd8('0x12')](_0x43903b['OpenchannelInteractions'],'id');return _0x43903b[_0xebd8('0x53')](_0x92cb7f)[_0xebd8('0x17')](function(){for(var _0x50230d=0x0;_0x50230d<_0x92cb7f[_0xebd8('0x1a')];_0x50230d+=0x1){_0x44493c[_0xebd8('0x4d')](_0xebd8('0x54'),{'OpenchannelInteractionId':Number(_0x92cb7f[_0x50230d]),'UserId':Number(_0x43903b['id'])});}});}})[_0xebd8('0x17')](function(){if(_0x12c460===_0xebd8('0x48')){var _0x3d5349=_[_0xebd8('0x12')](_0x43903b[_0xebd8('0x55')],'id');return _0x43903b[_0xebd8('0x56')](_0x3d5349)[_0xebd8('0x17')](function(){for(var _0x4f40a5=0x0;_0x4f40a5<_0x3d5349[_0xebd8('0x1a')];_0x4f40a5+=0x1){_0x44493c[_0xebd8('0x4d')](_0xebd8('0x57'),{'WhatsappInteractionId':Number(_0x3d5349[_0x4f40a5]),'UserId':Number(_0x43903b['id'])});}});}})[_0xebd8('0x58')](function(_0xbabeba){_0x1b3ce5['log'](_0xbabeba);});}}function onDisconnect(_0x4187d1,_0x4ac20c){joinOrLeave(_0x4187d1,_0xebd8('0x48'),_0x4ac20c);}function onConnect(_0x3d4759){joinOrLeave(_0x3d4759,'join');}exports[_0xebd8('0x59')]=function(_0x299016){_0x299016['on'](_0xebd8('0x5a'),function(_0x437ab1){_0x437ab1[_0xebd8('0x5b')](0x0);_0x437ab1[_0xebd8('0x5c')]=_0x437ab1[_0xebd8('0x5d')][_0xebd8('0x5a')][_0xebd8('0x5e')]+':'+_0x437ab1[_0xebd8('0x5d')][_0xebd8('0x5a')][_0xebd8('0x5f')];_0x437ab1[_0xebd8('0x60')]=new Date();_0x437ab1['log']=function(_0x29bbfa){console['log'](_0xebd8('0x61')+_0x437ab1[_0xebd8('0x62')]['name']+'['+_0x437ab1['address']+']',_0x29bbfa);};_0x437ab1['on'](_0xebd8('0x63'),function(){onDisconnect(_0x437ab1,_0x299016);_0x437ab1['log']('DISCONNECTED');});onConnect(_0x437ab1);_0x437ab1[_0xebd8('0x64')](_0xebd8('0x65'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 04b7d81..7dcc718 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 _0x2c99=['EventManager','info','Trigger,\x20%s','error','code','catch','get','channel','motionChannel','event','direction','resolve','then','ContactId','undefined','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','query','QueryTypes','SELECT','contact','UserId','format','name','agent','incomingmessage','outgoingmessage','offlineMessage','interface','AfterCreate','changed','closed','substatus','SIP/%s','AfterUpdate','find','fullname','internal','default','length','hasOwnProperty','model','hook','condition','util','../../mysqldb','jayson/promise','../logger','triggers','client','http','ChatInteraction','afterCreate','newinteraction','Chat','afterUpdate','closedinteraction','ChatMessage','newmessage','Sms','SmsInteraction','WhatsappInteraction','Whatsapp','WhatsappMessage','Fax','FaxInteraction','FaxMessage','Mail','MailInteraction','MailMessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2c99,0x10a));var _0x92c9=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0x2c99[_0x45d55e];return _0x29812a;};'use strict';var util=require(_0x92c9('0x0'));var db=require(_0x92c9('0x1'))['db'];var jayson=require(_0x92c9('0x2'));var logger=require(_0x92c9('0x3'))(_0x92c9('0x4'));var client=jayson[_0x92c9('0x5')][_0x92c9('0x6')]({'port':0x232a});var triggers=[{'channel':'Chat','model':_0x92c9('0x7'),'event':_0x92c9('0x8'),'condition':_0x92c9('0x9'),'callback':afterCreate},{'channel':_0x92c9('0xa'),'model':_0x92c9('0x7'),'event':_0x92c9('0xb'),'condition':_0x92c9('0xc'),'callback':afterUpdate},{'channel':_0x92c9('0xa'),'model':_0x92c9('0xd'),'event':_0x92c9('0x8'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x92c9('0xa'),'model':'ChatOfflineMessage','event':'afterCreate','condition':_0x92c9('0xe'),'callback':afterCreateOfflineMessage},{'channel':_0x92c9('0xf'),'model':_0x92c9('0x10'),'event':'afterCreate','condition':_0x92c9('0x9'),'callback':afterCreate},{'channel':_0x92c9('0xf'),'model':_0x92c9('0x10'),'event':_0x92c9('0xb'),'condition':_0x92c9('0xc'),'callback':afterUpdate},{'channel':_0x92c9('0xf'),'model':'SmsMessage','event':_0x92c9('0x8'),'condition':'newmessage','callback':afterCreateMessage},{'channel':'Whatsapp','model':_0x92c9('0x11'),'event':_0x92c9('0x8'),'condition':_0x92c9('0x9'),'callback':afterCreate},{'channel':_0x92c9('0x12'),'model':_0x92c9('0x11'),'event':_0x92c9('0xb'),'condition':_0x92c9('0xc'),'callback':afterUpdate},{'channel':_0x92c9('0x12'),'model':_0x92c9('0x13'),'event':'afterCreate','condition':_0x92c9('0xe'),'callback':afterCreateMessage},{'channel':_0x92c9('0x14'),'model':_0x92c9('0x15'),'event':_0x92c9('0x8'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x92c9('0x14'),'model':_0x92c9('0x15'),'event':_0x92c9('0xb'),'condition':_0x92c9('0xc'),'callback':afterUpdate},{'channel':_0x92c9('0x14'),'model':_0x92c9('0x16'),'event':_0x92c9('0x8'),'condition':_0x92c9('0xe'),'callback':afterCreateMessage},{'channel':_0x92c9('0x17'),'model':_0x92c9('0x18'),'event':_0x92c9('0x8'),'condition':_0x92c9('0x9'),'callback':afterCreate},{'channel':'Mail','model':'MailInteraction','event':_0x92c9('0xb'),'condition':_0x92c9('0xc'),'callback':afterUpdate},{'channel':'Mail','model':_0x92c9('0x19'),'event':_0x92c9('0x8'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x92c9('0x1a'),'model':_0x92c9('0x1b'),'event':_0x92c9('0x8'),'condition':'newinteraction','callback':afterCreate},{'channel':'Openchannel','model':'OpenchannelInteraction','event':_0x92c9('0xb'),'condition':_0x92c9('0xc'),'callback':afterUpdate},{'channel':_0x92c9('0x1a'),'model':_0x92c9('0x1c'),'event':_0x92c9('0x8'),'condition':_0x92c9('0xe'),'callback':afterCreateMessage}];function request(_0x47ca4b){return client[_0x92c9('0x1d')](_0x92c9('0x1e'),_0x47ca4b)['then'](function(_0x4d3758){logger[_0x92c9('0x1f')](_0x92c9('0x20'),_0x92c9('0x1e'),_0x4d3758);if(_0x4d3758[_0x92c9('0x21')]){if(_0x4d3758[_0x92c9('0x21')][_0x92c9('0x22')]===0x1f4){logger['error']('Trigger,\x20%s',_0x92c9('0x1e'),_0x4d3758[_0x92c9('0x21')]);}}})[_0x92c9('0x23')](function(_0x1b61be){logger[_0x92c9('0x21')](_0x92c9('0x20'),_0x92c9('0x1e'),_0x1b61be);});}function afterCreateMessage(_0x43905a){return function(_0x2f4855){_0x2f4855=_0x2f4855[_0x92c9('0x24')]({'plain':!![]});_0x2f4855[_0x92c9('0x25')]=_0x43905a;_0x2f4855[_0x92c9('0x26')]=_0x43905a;_0x2f4855[_0x92c9('0x27')]=_0x2f4855[_0x92c9('0x28')];Promise[_0x92c9('0x29')]()[_0x92c9('0x2a')](function(){if(typeof _0x2f4855[_0x92c9('0x2b')]===_0x92c9('0x2c'))return null;var _0x143c54=_0x92c9('0x2d')+_0x2f4855[_0x92c9('0x2b')];return db[_0x92c9('0x2e')][_0x92c9('0x2f')](_0x143c54,{'type':db['Sequelize'][_0x92c9('0x30')][_0x92c9('0x31')],'raw':!![]});})['then'](function(_0x9573a6){if(_0x9573a6){_0x2f4855[_0x92c9('0x32')]=_0x9573a6[0x0];}if(typeof _0x2f4855[_0x92c9('0x33')]==='undefined')return;return getAgent(_0x2f4855[_0x92c9('0x33')]);})[_0x92c9('0x2a')](function(_0x37e9b4){if(_0x37e9b4){_0x2f4855['interface']=util[_0x92c9('0x34')]('SIP/%s',_0x37e9b4[_0x92c9('0x35')]);_0x2f4855[_0x92c9('0x36')]=_0x37e9b4;_0x2f4855[_0x92c9('0x25')]=_0x43905a;return request({'event':_0x92c9('0x37'),'message':_0x2f4855});}else{return request({'event':_0x92c9('0x38'),'message':_0x2f4855});}})[_0x92c9('0x23')](function(_0x14c48a){logger[_0x92c9('0x21')](_0x92c9('0x20'),'AfterCreateMessage',_0x14c48a);});};}function afterCreateOfflineMessage(_0x419acc){return function(_0x1de21b){_0x1de21b=_0x1de21b[_0x92c9('0x24')]({'plain':!![]});_0x1de21b[_0x92c9('0x25')]=_0x419acc;_0x1de21b['motionChannel']=_0x419acc;_0x1de21b[_0x92c9('0x27')]=_0x92c9('0x39');return request({'event':_0x1de21b[_0x92c9('0x27')],'message':_0x1de21b});};}function afterCreate(_0x548b48,_0x597c8a){return function(_0x374c25){_0x374c25=_0x374c25[_0x92c9('0x24')]({'plain':!![]});_0x374c25[_0x92c9('0x25')]=_0x548b48;_0x374c25['motionChannel']=_0x548b48;_0x374c25['event']='opened';Promise['resolve']()[_0x92c9('0x2a')](function(){var _0x26d9df=_0x92c9('0x2d')+_0x374c25[_0x92c9('0x2b')];return db[_0x92c9('0x2e')]['query'](_0x26d9df,{'type':db['Sequelize'][_0x92c9('0x30')][_0x92c9('0x31')],'raw':!![]});})[_0x92c9('0x2a')](function(_0x5ecc61){if(_0x5ecc61){_0x374c25[_0x92c9('0x32')]=_0x5ecc61[0x0];}if(typeof _0x374c25[_0x92c9('0x33')]===_0x92c9('0x2c'))return;return getAgent(_0x374c25[_0x92c9('0x33')]);})['then'](function(_0x5dbcca){if(_0x5dbcca){_0x374c25[_0x92c9('0x3a')]=util[_0x92c9('0x34')]('SIP/%s',_0x5dbcca[_0x92c9('0x35')]);_0x374c25['agent']=_0x5dbcca;}return request({'event':_0x597c8a,'message':_0x374c25});})[_0x92c9('0x23')](function(_0x5561ac){logger[_0x92c9('0x21')](_0x92c9('0x20'),_0x92c9('0x3b'),_0x5561ac);});};}function afterUpdate(_0x1e1b73){return function(_0x11427c){var _0x1ed459=_0x11427c[_0x92c9('0x3c')](_0x92c9('0x3d'))&&_0x11427c[_0x92c9('0x3d')];var _0x47d7e8=_0x11427c['changed'](_0x92c9('0x3e'));if(_0x1ed459||_0x47d7e8){var _0x1c466e=_0x1ed459?_0x92c9('0xc'):_0x92c9('0x3e');var _0x24bfcf=_0x11427c[_0x92c9('0x24')]({'plain':!![]});_0x24bfcf[_0x92c9('0x25')]=_0x1e1b73;_0x24bfcf['motionChannel']=_0x1e1b73;_0x24bfcf[_0x92c9('0x27')]=_0x1ed459?_0x92c9('0x3d'):'substatus';var _0x1249f7=_0x92c9('0x2d')+_0x24bfcf[_0x92c9('0x2b')];return db[_0x92c9('0x2e')][_0x92c9('0x2f')](_0x1249f7,{'type':db['Sequelize'][_0x92c9('0x30')]['SELECT'],'raw':!![]})['then'](function(_0x1046c5){if(_0x1046c5){_0x24bfcf['contact']=_0x1046c5[0x0];}if(typeof _0x24bfcf[_0x92c9('0x33')]===_0x92c9('0x2c'))return;return getAgent(_0x24bfcf[_0x92c9('0x33')]);})[_0x92c9('0x2a')](function(_0x255db6){if(_0x255db6){_0x24bfcf[_0x92c9('0x3a')]=util[_0x92c9('0x34')](_0x92c9('0x3f'),_0x255db6[_0x92c9('0x35')]);_0x24bfcf[_0x92c9('0x36')]=_0x255db6;}return request({'event':_0x1c466e,'message':_0x24bfcf});})[_0x92c9('0x23')](function(_0x11eb1e){logger['error']('Trigger,\x20%s',_0x92c9('0x40'),_0x11eb1e);});}};}function getAgent(_0x1b84ad){return db['User'][_0x92c9('0x41')]({'where':{'id':_0x1b84ad},'attributes':['id',_0x92c9('0x35'),_0x92c9('0x42'),'email',_0x92c9('0x43')],'raw':!![]})['then'](function(_0x67e8f5){return _0x67e8f5;});}exports[_0x92c9('0x44')]=function(){for(var _0x4a0382=0x0;_0x4a0382=_0x37f5ad['agents']){throw Error(_0xa3e7('0x17'));}_0x3361c5(_0x27e80);})[_0xa3e7('0x18')](function(_0x43b6a1){_0x5c0135(_0x43b6a1);});});}; \ No newline at end of file +var _0x1d2c=['role','agent','User','count','then','agents','Maximum\x20login\x20has\x20been\x20reached','lodash','bluebird','./license/util','voice','chat','fax','openchannel','getChannels','isValidChannel','includes','clearBlockUser','isUndefined','blockedAt','getLicense'];(function(_0x453ebd,_0x1bc0ea){var _0x24140e=function(_0x5e00a6){while(--_0x5e00a6){_0x453ebd['push'](_0x453ebd['shift']());}};_0x24140e(++_0x1bc0ea);}(_0x1d2c,0x16c));var _0xc1d2=function(_0x33ae6f,_0x17fa0d){_0x33ae6f=_0x33ae6f-0x0;var _0x477cc5=_0x1d2c[_0x33ae6f];return _0x477cc5;};'use strict';var _=require(_0xc1d2('0x0'));var BPromise=require(_0xc1d2('0x1'));var db=require('../mysqldb')['db'];var util=require(_0xc1d2('0x2'));var channels=[_0xc1d2('0x3'),'mail',_0xc1d2('0x4'),_0xc1d2('0x5'),'sms','whatsapp',_0xc1d2('0x6')];exports[_0xc1d2('0x7')]=function(){return channels;};exports[_0xc1d2('0x8')]=function(_0x2aec38){_0x2aec38=_0x2aec38['toLowerCase']();return _[_0xc1d2('0x9')](channels,_0x2aec38);};exports[_0xc1d2('0xa')]=function(_0x1da2cb,_0x14fc2b,_0x3099e8,_0x545067){var _0x39b67d={'loginAttempts':_0x14fc2b,'blocked':_0x3099e8};if(!_[_0xc1d2('0xb')](_0x545067)){_0x39b67d[_0xc1d2('0xc')]=_0x545067;}return _0x1da2cb['updateAttributes'](_0x39b67d);};exports[_0xc1d2('0xd')]=function(_0x1320c6){return new BPromise(function(_0x264dff,_0x421f0e){var _0x1cc991=0x0;if(_0x1320c6[_0xc1d2('0xe')]!==_0xc1d2('0xf')){_0x264dff(_0x1320c6);}db[_0xc1d2('0x10')][_0xc1d2('0x11')]({'where':{'role':'agent','online':!![],'id':{'$ne':_0x1320c6['id']}}})[_0xc1d2('0x12')](function(_0x25c64c){_0x1cc991=_0x25c64c;return util[_0xc1d2('0xd')]();})['then'](function(_0x11441a){if(_0x11441a&&_0x11441a[_0xc1d2('0x13')]&&_0x1cc991>=_0x11441a['agents']){throw Error(_0xc1d2('0x14'));}_0x264dff(_0x1320c6);})['catch'](function(_0x4be11d){_0x421f0e(_0x4be11d);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index 39a4e81..1e03763 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5e10=['Forbidden','Entity\x20not\x20found','Not\x20Found','Message\x20sent\x20outside\x20a\x20valid\x20interval','Out\x20Of\x20Interval','code','details','OutOfInterval','Resource\x20Conflict','Conflict','status','send','exports','util','../config/logger','message','Internal\x20Server\x20Error','name','inherits','Bad\x20Request'];(function(_0x61fa6b,_0x47e0e3){var _0x40b1a2=function(_0x227e6a){while(--_0x227e6a){_0x61fa6b['push'](_0x61fa6b['shift']());}};_0x40b1a2(++_0x47e0e3);}(_0x5e10,0x1ed));var _0x05e1=function(_0x4b6778,_0x505a76){_0x4b6778=_0x4b6778-0x0;var _0x22dbb9=_0x5e10[_0x4b6778];return _0x22dbb9;};'use strict';var util=require(_0x05e1('0x0'));var logger=require(_0x05e1('0x1'))('api');var APIError=function(_0x114295,_0x2b2427){this[_0x05e1('0x2')]=_0x114295||_0x05e1('0x3');this[_0x05e1('0x4')]=_0x2b2427||'Error';util[_0x05e1('0x5')](APIError,Error);};var APIBadRequestError=function(_0x10daa9){this['message']=_0x10daa9||_0x05e1('0x6');this[_0x05e1('0x4')]=_0x05e1('0x6');util[_0x05e1('0x5')](APIBadRequestError,APIError);};var APIForbiddenError=function(_0x41176d){this[_0x05e1('0x2')]=_0x41176d||'Forbidden';this[_0x05e1('0x4')]=_0x05e1('0x7');util[_0x05e1('0x5')](APIForbiddenError,APIError);};var APINotFoundError=function(_0x28c50a){this['message']=_0x28c50a||_0x05e1('0x8');this[_0x05e1('0x4')]=_0x05e1('0x9');util[_0x05e1('0x5')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x21d057){this['message']=_0x21d057||_0x05e1('0xa');this[_0x05e1('0x4')]=_0x05e1('0xb');this[_0x05e1('0xc')]=0x193;this[_0x05e1('0xd')]={'type':_0x05e1('0xe')};util[_0x05e1('0x5')](APIOutOfIntervalError,APIError);};var APIConflictError=function(_0x3ba6b2){this['message']=_0x3ba6b2||_0x05e1('0xf');this[_0x05e1('0x4')]=_0x05e1('0x10');util[_0x05e1('0x5')](APIBadRequestError,APIError);};function getStatusCode(_0x34d844){switch(_0x34d844){case _0x05e1('0x6'):return 0x190;case _0x05e1('0x7'),_0x05e1('0xb'):return 0x193;case _0x05e1('0x9'):return 0x194;case _0x05e1('0x10'):return 0x199;default:return 0x1f4;}}function getCustomStatusMessage(_0x38c3a2){if(_0x38c3a2===_0x05e1('0xb'))return _0x38c3a2;return null;}function handleError(_0x4d5f77){return function(_0x32b2ea){logger['error'](_0x32b2ea['stack']);var _0x50f05b=getStatusCode(_0x32b2ea[_0x05e1('0x4')]);var _0x59eb68=getCustomStatusMessage(_0x32b2ea[_0x05e1('0x4')]);if(_0x32b2ea['name']){delete _0x32b2ea[_0x05e1('0x4')];}if(_0x59eb68){_0x4d5f77['statusMessage']=_0x59eb68;}return _0x4d5f77[_0x05e1('0x11')](_0x50f05b)[_0x05e1('0x12')](_0x32b2ea);};}module[_0x05e1('0x13')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIForbiddenError':APIForbiddenError,'APINotFoundError':APINotFoundError,'APIOutOfIntervalError':APIOutOfIntervalError,'APIConflict':APIConflictError,'handleError':handleError}; \ No newline at end of file +var _0xf61f=['exports','util','api','message','Internal\x20Server\x20Error','name','Bad\x20Request','inherits','Forbidden','Entity\x20not\x20found','Not\x20Found','Out\x20Of\x20Interval','Resource\x20Conflict','Conflict','error','status','send'];(function(_0x46459b,_0x79bba5){var _0x3df38d=function(_0x2187fb){while(--_0x2187fb){_0x46459b['push'](_0x46459b['shift']());}};_0x3df38d(++_0x79bba5);}(_0xf61f,0x89));var _0xff61=function(_0x53b3ee,_0x12feb7){_0x53b3ee=_0x53b3ee-0x0;var _0x50fae3=_0xf61f[_0x53b3ee];return _0x50fae3;};'use strict';var util=require(_0xff61('0x0'));var logger=require('../config/logger')(_0xff61('0x1'));var APIError=function(_0x3a084f,_0x8333cc){this[_0xff61('0x2')]=_0x3a084f||_0xff61('0x3');this[_0xff61('0x4')]=_0x8333cc||'Error';util['inherits'](APIError,Error);};var APIBadRequestError=function(_0x235d38){this[_0xff61('0x2')]=_0x235d38||_0xff61('0x5');this[_0xff61('0x4')]=_0xff61('0x5');util[_0xff61('0x6')](APIBadRequestError,APIError);};var APIForbiddenError=function(_0x435db5){this[_0xff61('0x2')]=_0x435db5||_0xff61('0x7');this[_0xff61('0x4')]='Forbidden';util[_0xff61('0x6')](APIForbiddenError,APIError);};var APINotFoundError=function(_0x14d131){this[_0xff61('0x2')]=_0x14d131||_0xff61('0x8');this[_0xff61('0x4')]=_0xff61('0x9');util[_0xff61('0x6')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x173f28){this['message']=_0x173f28||'Message\x20sent\x20outside\x20a\x20valid\x20interval';this[_0xff61('0x4')]=_0xff61('0xa');this['code']=0x193;this['details']={'type':'OutOfInterval'};util[_0xff61('0x6')](APIOutOfIntervalError,APIError);};var APIConflictError=function(_0x18cf30){this[_0xff61('0x2')]=_0x18cf30||_0xff61('0xb');this[_0xff61('0x4')]=_0xff61('0xc');util['inherits'](APIBadRequestError,APIError);};function getStatusCode(_0x5abc84){switch(_0x5abc84){case'Bad\x20Request':return 0x190;case _0xff61('0x7'),_0xff61('0xa'):return 0x193;case _0xff61('0x9'):return 0x194;case _0xff61('0xc'):return 0x199;default:return 0x1f4;}}function getCustomStatusMessage(_0x4136b1){if(_0x4136b1===_0xff61('0xa'))return _0x4136b1;return null;}function handleError(_0x38b5b8){return function(_0x1c2455){logger[_0xff61('0xd')](_0x1c2455['stack']);var _0x260348=getStatusCode(_0x1c2455[_0xff61('0x4')]);var _0xce23f0=getCustomStatusMessage(_0x1c2455[_0xff61('0x4')]);if(_0x1c2455[_0xff61('0x4')]){delete _0x1c2455['name'];}if(_0xce23f0){_0x38b5b8['statusMessage']=_0xce23f0;}return _0x38b5b8[_0xff61('0xe')](_0x260348)[_0xff61('0xf')](_0x1c2455);};}module[_0xff61('0x10')]={'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 82a9435..0aa18df 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5060=['404','status','json','send','exports'];(function(_0x2ba560,_0x42d557){var _0x46edd4=function(_0x24e68b){while(--_0x24e68b){_0x2ba560['push'](_0x2ba560['shift']());}};_0x46edd4(++_0x42d557);}(_0x5060,0x13f));var _0x0506=function(_0x5957f0,_0x530235){_0x5957f0=_0x5957f0-0x0;var _0x53cb51=_0x5060[_0x5957f0];return _0x53cb51;};'use strict';module[_0x0506('0x0')][0x194]=function pageNotFound(_0x3528a3,_0x1b0d9e){var _0x9d01bc=_0x0506('0x1');var _0x1f0687=0x194;var _0x7cc3ea={'status':_0x1f0687};_0x1b0d9e['status'](_0x7cc3ea['status']);_0x1b0d9e['render'](_0x9d01bc,{},function(_0x4c852d,_0x1b3c75){if(_0x4c852d){return _0x1b0d9e[_0x0506('0x2')](_0x7cc3ea[_0x0506('0x2')])[_0x0506('0x3')](_0x7cc3ea);}_0x1b0d9e[_0x0506('0x4')](_0x1b3c75);});}; \ No newline at end of file +var _0x5e30=['404','status','render','exports'];(function(_0x56a588,_0x29f688){var _0x2476f8=function(_0x397f4f){while(--_0x397f4f){_0x56a588['push'](_0x56a588['shift']());}};_0x2476f8(++_0x29f688);}(_0x5e30,0x7b));var _0x05e3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5e30[_0x3dd15e];return _0x231fd0;};'use strict';module[_0x05e3('0x0')][0x194]=function pageNotFound(_0x2c61e2,_0x1fdde9){var _0x3e3e2d=_0x05e3('0x1');var _0x5c88b3=0x194;var _0x5136f8={'status':_0x5c88b3};_0x1fdde9['status'](_0x5136f8[_0x05e3('0x2')]);_0x1fdde9[_0x05e3('0x3')](_0x3e3e2d,{},function(_0xb7eafa,_0x3b1120){if(_0xb7eafa){return _0x1fdde9[_0x05e3('0x2')](_0x5136f8[_0x05e3('0x2')])['json'](_0x5136f8);}_0x1fdde9['send'](_0x3b1120);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index d5cd435..605e5b7 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2426=['DeskField','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','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','../api/intServicenowField/intServicenowField.model','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesField/intFreshsalesField.model','Integration','Network','../api/network/network.model','../api/chatQueueReport/chatQueueReport.model','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','CmList','../api/cmList/cmList.model','../api/userProfile/userProfile.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','../api/user-setting/user-setting.model','MailInteractionHasTag','hasOne','UserId','userSetting','cascade','Recordings','UserVoiceQueueRt','VoiceQueuesRt','hasMany','Extensions','HopperFinals','HopperHistory','OpenchannelInteraction','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteractions','MailInteractions','UserNotifications','SenderId','SET\x20NULL','belongsTo','UserProfile','userProfileId','belongsToMany','Groups','chat_group_has_users','CmContact','Contacts','cm_user_has_contacts','Lists','user_has_teams','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','VoiceQueues','UserVoiceQueue','VoicePrefixes','MailQueues','UserChatQueue','FaxQueues','OpenchannelQueue','OpenchannelQueues','WhatsappQueues','cm_user_has_lists','user_has_chat_websites','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SpiedAgents','VoiceContext','Applications','Sounds','moh_has_sounds','Hoppers','VoiceQueueId','HopperBlacks','TrunkId','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','Teams','TeamVoiceQueue','Messages','mailboxuser','mailbox','QueueCalls','AgentReports','uniqueid','Contact','CloudProviderId','MailServerOut','MailAccountId','restrict','Imap','Answers','MailMessage','Interactions','List','ListId','TemplateId','UserMailQueue','MailInteractionId','Account','ContactId','Owner','mail_interaction_has_tags','Tags','ThroughTags','Interaction','ChatOfflineMessageId','TagId','Dashboard','Items','Dispositions','FaxAccountId','fax_interaction_has_tags','Users','FaxInteractionId','AttachmentId','SmsAccountId','SmsApplication','sms_interaction_has_tags','SmsInteractionId','SmsQueueId','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','user_has_openchannel_interactions','team_has_openchannel_queues','ChatWebsiteId','ProactiveActions','OpenchannelQueueReport','Agent','ChatQueue','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','team_has_chat_queues','ChatInternalMessage','ChatGroupId','Members','CompanyId','CmContactHasItem','Phones','CmContactId','HopperHistories','JscriptySessions','Company','cm_contact_has_tags','CmHopperAdditionalPhone','CmHopperId','CampaignId','Condition','All','OneAll','AutomationAllId','OneAny','Actions','ParentId','ChatApplications','FaxApplications','CustomReportId','Mohs','whatsapp_interaction_has_tags','ItemType','ItemTypeId','Hopper','AllConditions','AllCondition','TriggerAllId','AnyConditions','TriggerId','DefaultReportId','MetricId','SalesforceAccount','SalesforceConfiguration','Subjects','SalesforceField','Descriptions','FieldId','AccountId','Subject','DescriptionId','Field','VariableId','Configurations','SubjectId','Fields','Description','DeskAccount','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','Dynamics365Account','FreshsalesField','ChatQueueReport','FromId','ToId','SessionId','SmsQueueReport','ProjectId','JscriptyQuestionReport','ChatQueues','team_has_fax_queues','team_has_sms_queues','team_has_whatsapp_queues','VoicePrefix','SquareProject','SquareProjectId','campaigns_has_cm_lists','BlackLists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','FromChatWebsiteId','FromUserId','ToChatWebsiteId','ToFaxQueueId','ToFaxAccountId','ToAccount','ToOpenchannelQueueId','SmsTransferReport','FromSmsAccountId','ToSmsQueueId','CustomFields','UserProfileSection','UserProfileSections','sectionId','WhatsappAccount','WhatsappAccountId','user_has_whatsapp_interactions','WhatsappInteractionId','WhatsappQueueReport','FromWhatsappAccountId','ToWhatsappAccountId','WhatsappQueueId','Smtp','exports','../config/environment','sequelize','lodash','jstz','determine','defaultsDeep','motion2','xcall','mysql','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','xC@LL1234','database','password','options','User','import','../api/user/user.model','VoiceChanSpy','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/userVoiceQueueRt/userVoiceQueueRt.model','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','UserOpenchannelQueue','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailAccount','MailQueue','../api/mailQueue/mailQueue.model','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/dashboard/dashboard.model','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','Action','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','../api/cmContactHasItem/cmContactHasItem.model','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','../api/intSalesforceAccount/intSalesforceAccount.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model'];(function(_0x4171f2,_0x123f75){var _0x33eb8d=function(_0x5186ba){while(--_0x5186ba){_0x4171f2['push'](_0x4171f2['shift']());}};_0x33eb8d(++_0x123f75);}(_0x2426,0x155));var _0x6242=function(_0x4e7454,_0x5901d1){_0x4e7454=_0x4e7454-0x0;var _0x221492=_0x2426[_0x4e7454];return _0x221492;};'use strict';var config=require(_0x6242('0x0'));var Sequelize=require(_0x6242('0x1'));var _=require(_0x6242('0x2'));var jstz=require(_0x6242('0x3'));var timezone=jstz[_0x6242('0x4')]();config[_0x6242('0x1')]=_[_0x6242('0x5')](config['sequelize'],{'database':_0x6242('0x6'),'username':_0x6242('0x7'),'password':'xC@LL1234','options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x6242('0x8'),'dialectOptions':{'charset':_0x6242('0x9')},'logging':![],'timezone':timezone[_0x6242('0xa')](),'define':{'charset':_0x6242('0xb'),'collate':_0x6242('0xc')}}});config[_0x6242('0xd')]=_[_0x6242('0x5')](config[_0x6242('0xd')],{'database':_0x6242('0x6'),'username':'xcall','password':_0x6242('0xe'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x6242('0x8'),'dialectOptions':{'charset':_0x6242('0x9')},'logging':![],'timezone':timezone[_0x6242('0xa')](),'define':{'charset':_0x6242('0xb'),'collate':_0x6242('0xc')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x6242('0x1')][_0x6242('0xf')],config[_0x6242('0x1')]['username'],config[_0x6242('0x1')][_0x6242('0x10')],config['sequelize'][_0x6242('0x11')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x6242('0xd')][_0x6242('0xf')],config[_0x6242('0xd')]['username'],config[_0x6242('0xd')][_0x6242('0x10')],config[_0x6242('0xd')][_0x6242('0x11')])};db[_0x6242('0x12')]=db[_0x6242('0x1')][_0x6242('0x13')](_0x6242('0x14'));db[_0x6242('0x15')]=db['sequelize'][_0x6242('0x13')]('../api/voiceChanSpy/voiceChanSpy.model');db['VoiceContext']=db[_0x6242('0x1')][_0x6242('0x13')]('../api/voiceContext/voiceContext.model');db[_0x6242('0x16')]=db[_0x6242('0x1')][_0x6242('0x13')](_0x6242('0x17'));db[_0x6242('0x18')]=db['sequelize']['import'](_0x6242('0x19'));db[_0x6242('0x1a')]=db[_0x6242('0x1')]['import'](_0x6242('0x1b'));db[_0x6242('0x1c')]=db[_0x6242('0x1')][_0x6242('0x13')](_0x6242('0x1d'));db[_0x6242('0x1e')]=db[_0x6242('0x1')][_0x6242('0x13')]('../api/screenRecording/screenRecording.model');db[_0x6242('0x1f')]=db[_0x6242('0x1')]['import'](_0x6242('0x20'));db[_0x6242('0x21')]=db['sequelize'][_0x6242('0x13')](_0x6242('0x22'));db[_0x6242('0x23')]=db[_0x6242('0x1')][_0x6242('0x13')]('../api/voiceCallReport/voiceCallReport.model');db['VoiceDialReport']=db[_0x6242('0x1')][_0x6242('0x13')](_0x6242('0x24'));db['VoiceAgentReport']=db[_0x6242('0x1')]['import'](_0x6242('0x25'));db[_0x6242('0x26')]=db[_0x6242('0x1')][_0x6242('0x13')](_0x6242('0x27'));db['MemberReport']=db['sequelize'][_0x6242('0x13')](_0x6242('0x28'));db[_0x6242('0x29')]=db[_0x6242('0x1')][_0x6242('0x13')](_0x6242('0x2a'));db[_0x6242('0x2b')]=db[_0x6242('0x1')][_0x6242('0x13')]('../api/voiceTransferReport/voiceTransferReport.model');db['UserVoiceQueueRt']=db[_0x6242('0x1')][_0x6242('0x13')](_0x6242('0x2c'));db['UserVoiceQueue']=db[_0x6242('0x1')][_0x6242('0x13')](_0x6242('0x2d'));db['UserChatQueue']=db['sequelize'][_0x6242('0x13')](_0x6242('0x2e'));db['UserMailQueue']=db[_0x6242('0x1')]['import'](_0x6242('0x2f'));db[_0x6242('0x30')]=db[_0x6242('0x1')][_0x6242('0x13')](_0x6242('0x31'));db[_0x6242('0x32')]=db[_0x6242('0x1')]['import']('../api/userSmsQueue/userSmsQueue.model');db[_0x6242('0x33')]=db[_0x6242('0x1')][_0x6242('0x13')]('../api/userOpenchannelQueue/userOpenchannelQueue.model');db[_0x6242('0x34')]=db[_0x6242('0x1')][_0x6242('0x13')](_0x6242('0x35'));db[_0x6242('0x36')]=db[_0x6242('0x1')][_0x6242('0x13')](_0x6242('0x37'));db['MailServerOut']=db[_0x6242('0x1')][_0x6242('0x13')]('../api/mailServerOut/mailServerOut.model');db[_0x6242('0x38')]=db[_0x6242('0x1')][_0x6242('0x13')]('../api/mailAccount/mailAccount.model');db[_0x6242('0x39')]=db[_0x6242('0x1')][_0x6242('0x13')](_0x6242('0x3a'));db['MailSubstatus']=db[_0x6242('0x1')][_0x6242('0x13')](_0x6242('0x3b'));db[_0x6242('0x3c')]=db[_0x6242('0x1')][_0x6242('0x13')](_0x6242('0x3d'));db['MailMessage']=db[_0x6242('0x1')][_0x6242('0x13')](_0x6242('0x3e'));db[_0x6242('0x3f')]=db['sequelize']['import'](_0x6242('0x40'));db[_0x6242('0x41')]=db['sequelize'][_0x6242('0x13')]('../api/mailQueueReport/mailQueueReport.model');db['Dashboard']=db['sequelize'][_0x6242('0x13')](_0x6242('0x42'));db['DashboardItem']=db[_0x6242('0x1')][_0x6242('0x13')](_0x6242('0x43'));db[_0x6242('0x44')]=db[_0x6242('0x1')][_0x6242('0x13')](_0x6242('0x45'));db[_0x6242('0x46')]=db[_0x6242('0x1')]['import']('../api/faxApplication/faxApplication.model');db[_0x6242('0x47')]=db[_0x6242('0x1')][_0x6242('0x13')](_0x6242('0x48'));db[_0x6242('0x49')]=db[_0x6242('0x1')][_0x6242('0x13')](_0x6242('0x4a'));db[_0x6242('0x4b')]=db[_0x6242('0x1')][_0x6242('0x13')](_0x6242('0x4c'));db[_0x6242('0x4d')]=db[_0x6242('0x1')][_0x6242('0x13')](_0x6242('0x4e'));db[_0x6242('0x4f')]=db[_0x6242('0x1')][_0x6242('0x13')](_0x6242('0x50'));db['SmsApplication']=db[_0x6242('0x1')]['import'](_0x6242('0x51'));db[_0x6242('0x52')]=db[_0x6242('0x1')][_0x6242('0x13')](_0x6242('0x53'));db[_0x6242('0x54')]=db[_0x6242('0x1')][_0x6242('0x13')](_0x6242('0x55'));db[_0x6242('0x56')]=db[_0x6242('0x1')]['import']('../api/smsQueue/smsQueue.model');db[_0x6242('0x57')]=db[_0x6242('0x1')]['import'](_0x6242('0x58'));db[_0x6242('0x59')]=db[_0x6242('0x1')][_0x6242('0x13')](_0x6242('0x5a'));db['OpenchannelInteraction']=db[_0x6242('0x1')][_0x6242('0x13')](_0x6242('0x5b'));db[_0x6242('0x5c')]=db['sequelize'][_0x6242('0x13')](_0x6242('0x5d'));db['OpenchannelQueue']=db['sequelize'][_0x6242('0x13')](_0x6242('0x5e'));db[_0x6242('0x5f')]=db[_0x6242('0x1')]['import'](_0x6242('0x60'));db['OpenchannelQueueReport']=db[_0x6242('0x1')][_0x6242('0x13')](_0x6242('0x61'));db[_0x6242('0x62')]=db[_0x6242('0x1')]['import'](_0x6242('0x63'));db[_0x6242('0x64')]=db[_0x6242('0x1')][_0x6242('0x13')](_0x6242('0x65'));db[_0x6242('0x66')]=db[_0x6242('0x1')][_0x6242('0x13')](_0x6242('0x67'));db[_0x6242('0x68')]=db[_0x6242('0x1')][_0x6242('0x13')](_0x6242('0x69'));db['ChatQueue']=db[_0x6242('0x1')][_0x6242('0x13')](_0x6242('0x6a'));db[_0x6242('0x6b')]=db['sequelize'][_0x6242('0x13')](_0x6242('0x6c'));db[_0x6242('0x6d')]=db[_0x6242('0x1')][_0x6242('0x13')](_0x6242('0x6e'));db[_0x6242('0x6f')]=db[_0x6242('0x1')]['import'](_0x6242('0x70'));db['CmContact']=db['sequelize'][_0x6242('0x13')](_0x6242('0x71'));db[_0x6242('0x72')]=db[_0x6242('0x1')][_0x6242('0x13')](_0x6242('0x73'));db[_0x6242('0x74')]=db[_0x6242('0x1')][_0x6242('0x13')](_0x6242('0x75'));db[_0x6242('0x76')]=db['sequelize']['import'](_0x6242('0x77'));db[_0x6242('0x78')]=db['sequelize'][_0x6242('0x13')](_0x6242('0x79'));db[_0x6242('0x7a')]=db[_0x6242('0x1')][_0x6242('0x13')](_0x6242('0x7b'));db[_0x6242('0x7c')]=db[_0x6242('0x1')][_0x6242('0x13')]('../api/cmCustomField/cmCustomField.model');db[_0x6242('0x7d')]=db['sequelize']['import']('../api/action/action.model');db[_0x6242('0x7e')]=db[_0x6242('0x1')]['import'](_0x6242('0x7f'));db[_0x6242('0x80')]=db[_0x6242('0x1')]['import'](_0x6242('0x81'));db[_0x6242('0x82')]=db[_0x6242('0x1')]['import'](_0x6242('0x83'));db['Condition']=db[_0x6242('0x1')][_0x6242('0x13')]('../api/condition/condition.model');db[_0x6242('0x84')]=db[_0x6242('0x1')][_0x6242('0x13')](_0x6242('0x85'));db[_0x6242('0x86')]=db[_0x6242('0x1')]['import'](_0x6242('0x87'));db[_0x6242('0x88')]=db[_0x6242('0x1')]['import']('../api/cdr/cdr.model');db['VoiceQueuesLog']=db[_0x6242('0x1')][_0x6242('0x13')](_0x6242('0x89'));db[_0x6242('0x8a')]=db[_0x6242('0x1')][_0x6242('0x13')](_0x6242('0x8b'));db[_0x6242('0x8c')]=db[_0x6242('0x1')][_0x6242('0x13')](_0x6242('0x8d'));db[_0x6242('0x8e')]=db[_0x6242('0x1')][_0x6242('0x13')](_0x6242('0x8f'));db[_0x6242('0x90')]=db[_0x6242('0x1')]['import'](_0x6242('0x91'));db['CmContactHasItem']=db['sequelize'][_0x6242('0x13')](_0x6242('0x92'));db['CmHopperAdditionalPhone']=db[_0x6242('0x1')]['import'](_0x6242('0x93'));db[_0x6242('0x94')]=db[_0x6242('0x1')][_0x6242('0x13')](_0x6242('0x95'));db[_0x6242('0x96')]=db[_0x6242('0x1')][_0x6242('0x13')](_0x6242('0x97'));db[_0x6242('0x98')]=db[_0x6242('0x1')][_0x6242('0x13')](_0x6242('0x99'));db['Integration']=db[_0x6242('0x1')][_0x6242('0x13')](_0x6242('0x9a'));db[_0x6242('0x9b')]=db[_0x6242('0x1')]['import'](_0x6242('0x9c'));db[_0x6242('0x9d')]=db[_0x6242('0x1')][_0x6242('0x13')]('../api/analyticCustomReport/analyticCustomReport.model');db[_0x6242('0x9e')]=db['sequelize'][_0x6242('0x13')](_0x6242('0x9f'));db[_0x6242('0xa0')]=db['sequelize'][_0x6242('0x13')](_0x6242('0xa1'));db[_0x6242('0xa2')]=db[_0x6242('0x1')]['import'](_0x6242('0xa3'));db[_0x6242('0xa4')]=db[_0x6242('0x1')][_0x6242('0x13')](_0x6242('0xa5'));db[_0x6242('0xa6')]=db[_0x6242('0x1')][_0x6242('0x13')](_0x6242('0xa7'));db['SalesforceAccount']=db[_0x6242('0x1')][_0x6242('0x13')](_0x6242('0xa8'));db['SalesforceConfiguration']=db[_0x6242('0x1')][_0x6242('0x13')]('../api/intSalesforceConfiguration/intSalesforceConfiguration.model');db['SalesforceField']=db['sequelize']['import']('../api/intSalesforceField/intSalesforceField.model');db[_0x6242('0xa9')]=db[_0x6242('0x1')][_0x6242('0x13')](_0x6242('0xaa'));db[_0x6242('0xab')]=db['sequelize'][_0x6242('0x13')](_0x6242('0xac'));db[_0x6242('0xad')]=db[_0x6242('0x1')][_0x6242('0x13')](_0x6242('0xae'));db['DeskAccount']=db[_0x6242('0x1')][_0x6242('0x13')]('../api/intDeskAccount/intDeskAccount.model');db[_0x6242('0xaf')]=db[_0x6242('0x1')][_0x6242('0x13')](_0x6242('0xb0'));db[_0x6242('0xb1')]=db[_0x6242('0x1')][_0x6242('0x13')]('../api/intDeskField/intDeskField.model');db[_0x6242('0xb2')]=db[_0x6242('0x1')]['import'](_0x6242('0xb3'));db[_0x6242('0xb4')]=db['sequelize'][_0x6242('0x13')](_0x6242('0xb5'));db[_0x6242('0xb6')]=db[_0x6242('0x1')][_0x6242('0x13')](_0x6242('0xb7'));db[_0x6242('0xb8')]=db[_0x6242('0x1')][_0x6242('0x13')](_0x6242('0xb9'));db[_0x6242('0xba')]=db['sequelize']['import'](_0x6242('0xbb'));db[_0x6242('0xbc')]=db[_0x6242('0x1')]['import']('../api/intZendeskField/intZendeskField.model');db[_0x6242('0xbd')]=db['sequelize'][_0x6242('0x13')](_0x6242('0xbe'));db[_0x6242('0xbf')]=db[_0x6242('0x1')]['import'](_0x6242('0xc0'));db[_0x6242('0xc1')]=db[_0x6242('0x1')][_0x6242('0x13')]('../api/intFreshdeskField/intFreshdeskField.model');db[_0x6242('0xc2')]=db['sequelize'][_0x6242('0x13')](_0x6242('0xc3'));db[_0x6242('0xc4')]=db['sequelize']['import'](_0x6242('0xc5'));db[_0x6242('0xc6')]=db[_0x6242('0x1')][_0x6242('0x13')](_0x6242('0xc7'));db[_0x6242('0xc8')]=db[_0x6242('0x1')][_0x6242('0x13')](_0x6242('0xc9'));db[_0x6242('0xca')]=db[_0x6242('0x1')][_0x6242('0x13')](_0x6242('0xcb'));db[_0x6242('0xcc')]=db[_0x6242('0x1')][_0x6242('0x13')](_0x6242('0xcd'));db['Dynamics365Account']=db['sequelize'][_0x6242('0x13')](_0x6242('0xce'));db[_0x6242('0xcf')]=db['sequelize'][_0x6242('0x13')](_0x6242('0xd0'));db[_0x6242('0xd1')]=db['sequelize'][_0x6242('0x13')](_0x6242('0xd2'));db[_0x6242('0xd3')]=db[_0x6242('0x1')][_0x6242('0x13')](_0x6242('0xd4'));db[_0x6242('0xd5')]=db[_0x6242('0x1')]['import']('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db['FreshsalesField']=db[_0x6242('0x1')][_0x6242('0x13')](_0x6242('0xd6'));db[_0x6242('0xd7')]=db[_0x6242('0x1')][_0x6242('0x13')](_0x6242('0x9a'));db[_0x6242('0xd8')]=db[_0x6242('0x1')][_0x6242('0x13')](_0x6242('0xd9'));db['ChatQueueReport']=db[_0x6242('0x1')]['import'](_0x6242('0xda'));db['ChatInternalMessage']=db[_0x6242('0x1')][_0x6242('0x13')](_0x6242('0xdb'));db[_0x6242('0xdc')]=db[_0x6242('0x1')][_0x6242('0x13')](_0x6242('0xdd'));db['JscriptyQuestionReport']=db[_0x6242('0x1')][_0x6242('0x13')](_0x6242('0xde'));db[_0x6242('0xdf')]=db['sequelize'][_0x6242('0x13')]('../api/jscriptySessionReport/jscriptySessionReport.model');db['SmsQueueReport']=db[_0x6242('0x1')]['import'](_0x6242('0xe0'));db[_0x6242('0xe1')]=db['sequelize'][_0x6242('0x13')](_0x6242('0xe2'));db[_0x6242('0xe3')]=db[_0x6242('0x1')][_0x6242('0x13')](_0x6242('0xe4'));db[_0x6242('0xe5')]=db[_0x6242('0x1')][_0x6242('0x13')](_0x6242('0xe6'));db[_0x6242('0xe7')]=db[_0x6242('0x1')][_0x6242('0x13')](_0x6242('0xe8'));db[_0x6242('0xe9')]=db[_0x6242('0x1')][_0x6242('0x13')](_0x6242('0xea'));db['SquareProject']=db[_0x6242('0x1')]['import'](_0x6242('0xeb'));db[_0x6242('0xec')]=db[_0x6242('0x1')]['import'](_0x6242('0xed'));db[_0x6242('0xee')]=db[_0x6242('0x1')][_0x6242('0x13')](_0x6242('0xef'));db[_0x6242('0xf0')]=db['sequelize'][_0x6242('0x13')](_0x6242('0xf1'));db[_0x6242('0xf2')]=db[_0x6242('0x1')][_0x6242('0x13')](_0x6242('0xf3'));db[_0x6242('0xf4')]=db[_0x6242('0x1')][_0x6242('0x13')](_0x6242('0xf5'));db[_0x6242('0xf6')]=db['sequelize'][_0x6242('0x13')]('../api/migration/migration.model');db[_0x6242('0xf7')]=db[_0x6242('0x1')]['import'](_0x6242('0xf8'));db[_0x6242('0xf9')]=db['sequelize'][_0x6242('0x13')](_0x6242('0xfa'));db[_0x6242('0xfb')]=db[_0x6242('0x1')][_0x6242('0x13')](_0x6242('0xfc'));db[_0x6242('0xfd')]=db[_0x6242('0x1')][_0x6242('0x13')](_0x6242('0xfe'));db[_0x6242('0xff')]=db['sequelize'][_0x6242('0x13')]('../api/faxTransferReport/faxTransferReport.model');db[_0x6242('0x100')]=db[_0x6242('0x1')][_0x6242('0x13')](_0x6242('0x101'));db['SmsTransferReport']=db[_0x6242('0x1')][_0x6242('0x13')]('../api/smsTransferReport/smsTransferReport.model');db[_0x6242('0x102')]=db[_0x6242('0x1')][_0x6242('0x13')](_0x6242('0x103'));db['VoicePrefix']=db[_0x6242('0x1')]['import']('../api/voicePrefix/voicePrefix.model');db['UserProfile']=db['sequelize'][_0x6242('0x13')](_0x6242('0x104'));db['UserProfileSection']=db[_0x6242('0x1')]['import']('../api/userProfileSection/userProfileSection.model');db[_0x6242('0x105')]=db[_0x6242('0x1')][_0x6242('0x13')](_0x6242('0x106'));db[_0x6242('0x107')]=db[_0x6242('0x1')][_0x6242('0x13')](_0x6242('0x108'));db['WhatsappAccount']=db['sequelize'][_0x6242('0x13')]('../api/whatsappAccount/whatsappAccount.model');db[_0x6242('0x109')]=db[_0x6242('0x1')][_0x6242('0x13')](_0x6242('0x10a'));db[_0x6242('0x10b')]=db[_0x6242('0x1')][_0x6242('0x13')](_0x6242('0x10c'));db[_0x6242('0x10d')]=db['sequelize'][_0x6242('0x13')]('../api/whatsappMessage/whatsappMessage.model');db['WhatsappQueueReport']=db['sequelize']['import'](_0x6242('0x10e'));db[_0x6242('0x10f')]=db['sequelize']['import'](_0x6242('0x110'));db[_0x6242('0x111')]=db[_0x6242('0x1')][_0x6242('0x13')]('../api/whatsappQueue/whatsappQueue.model');db[_0x6242('0x112')]=db['sequelize'][_0x6242('0x13')](_0x6242('0x113'));db['TeamVoiceQueue']=db[_0x6242('0x1')][_0x6242('0x13')]('../api/teamVoiceQueue/teamVoiceQueue.model');db[_0x6242('0x114')]=db['sequelize']['import'](_0x6242('0x115'));db[_0x6242('0x116')]=db[_0x6242('0x1')][_0x6242('0x13')](_0x6242('0x117'));db[_0x6242('0x118')]=db[_0x6242('0x1')][_0x6242('0x13')](_0x6242('0x119'));db[_0x6242('0x11a')]=db[_0x6242('0x1')][_0x6242('0x13')]('../api/mailInteractionHasTag/mailInteractionHasTag.model');db[_0x6242('0x12')][_0x6242('0x11b')](db[_0x6242('0x1f')],{'as':'VoiceMail','onDelete':'cascade','foreignKey':_0x6242('0x11c')});db[_0x6242('0x12')][_0x6242('0x11b')](db[_0x6242('0x118')],{'as':_0x6242('0x11d'),'onDelete':_0x6242('0x11e'),'foreignKey':'UserId'});db[_0x6242('0x12')]['hasMany'](db[_0x6242('0x1c')],{'as':_0x6242('0x11f'),'foreignKey':_0x6242('0x11c')});db[_0x6242('0x12')]['hasMany'](db[_0x6242('0x120')],{'as':_0x6242('0x121'),'foreignKey':_0x6242('0x11c')});db[_0x6242('0x12')][_0x6242('0x122')](db['VoiceExtension'],{'as':_0x6242('0x123'),'onDelete':_0x6242('0x11e'),'hooks':!![]});db[_0x6242('0x12')]['hasMany'](db[_0x6242('0x76')],{'as':_0x6242('0x124'),'foreignKey':'UserId'});db[_0x6242('0x12')][_0x6242('0x122')](db[_0x6242('0x78')],{'as':_0x6242('0x125'),'foreignKey':'UserId'});db[_0x6242('0x12')]['hasMany'](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':_0x6242('0x11c')});db['User']['hasMany'](db[_0x6242('0x126')],{'as':_0x6242('0x127'),'foreignKey':_0x6242('0x11c')});db['User']['hasMany'](db[_0x6242('0x64')],{'as':_0x6242('0x128'),'foreignKey':_0x6242('0x11c')});db[_0x6242('0x12')][_0x6242('0x122')](db[_0x6242('0x52')],{'as':_0x6242('0x129'),'foreignKey':_0x6242('0x11c')});db[_0x6242('0x12')][_0x6242('0x122')](db['FaxInteraction'],{'as':_0x6242('0x12a'),'foreignKey':_0x6242('0x11c')});db[_0x6242('0x12')]['hasMany'](db[_0x6242('0x3c')],{'as':_0x6242('0x12b'),'foreignKey':_0x6242('0x11c')});db[_0x6242('0x12')]['hasMany'](db[_0x6242('0x10b')],{'as':'WhatsappInteractions','foreignKey':'UserId'});db[_0x6242('0x12')][_0x6242('0x122')](db[_0x6242('0x107')],{'as':_0x6242('0x12c'),'foreignKey':_0x6242('0x12d')});db[_0x6242('0x12')][_0x6242('0x122')](db[_0x6242('0x72')],{'as':'Hoppers','foreignKey':_0x6242('0x11c'),'onDelete':_0x6242('0x12e')});db[_0x6242('0x12')][_0x6242('0x12f')](db['UserProfile'],{'as':_0x6242('0x130'),'foreignKey':_0x6242('0x131')});db[_0x6242('0x12')][_0x6242('0x132')](db[_0x6242('0x6b')],{'as':_0x6242('0x133'),'through':_0x6242('0x134')});db[_0x6242('0x12')][_0x6242('0x132')](db[_0x6242('0x135')],{'as':_0x6242('0x136'),'through':_0x6242('0x137')});db[_0x6242('0x12')][_0x6242('0x132')](db[_0x6242('0x102')],{'as':_0x6242('0x138'),'through':'cm_user_has_lists'});db[_0x6242('0x12')]['belongsToMany'](db[_0x6242('0xf0')],{'through':_0x6242('0x139')});db[_0x6242('0x12')][_0x6242('0x132')](db[_0x6242('0x3c')],{'as':'MailInteractions','through':_0x6242('0x13a')});db[_0x6242('0x12')][_0x6242('0x132')](db[_0x6242('0x64')],{'as':_0x6242('0x128'),'through':_0x6242('0x13b')});db[_0x6242('0x12')][_0x6242('0x132')](db['FaxInteraction'],{'as':'FaxInteractions','through':_0x6242('0x13c')});db[_0x6242('0x12')]['belongsToMany'](db[_0x6242('0x52')],{'as':_0x6242('0x129'),'through':_0x6242('0x13d')});db[_0x6242('0x12')][_0x6242('0x132')](db[_0x6242('0x126')],{'as':_0x6242('0x127'),'through':'user_has_openchannel_interactions'});db['User']['belongsToMany'](db[_0x6242('0x10b')],{'as':'WhatsappInteractions','through':'user_has_whatsapp_interactions'});db[_0x6242('0x12')][_0x6242('0x132')](db[_0x6242('0x1a')],{'as':_0x6242('0x13e'),'through':_0x6242('0x13f'),'required':![]});db[_0x6242('0x12')][_0x6242('0x132')](db['VoicePrefix'],{'as':_0x6242('0x140'),'through':_0x6242('0x116'),'required':![]});db['User'][_0x6242('0x132')](db['MailQueue'],{'as':_0x6242('0x141'),'through':'UserMailQueue','required':![]});db[_0x6242('0x12')][_0x6242('0x132')](db['ChatQueue'],{'as':'ChatQueues','through':_0x6242('0x142'),'required':![],'hooks':!![]});db[_0x6242('0x12')]['belongsToMany'](db[_0x6242('0x4b')],{'as':_0x6242('0x143'),'through':'UserFaxQueue','required':![]});db['User'][_0x6242('0x132')](db[_0x6242('0x56')],{'as':'SmsQueues','through':'UserSmsQueue','required':![]});db[_0x6242('0x12')]['belongsToMany'](db[_0x6242('0x144')],{'as':_0x6242('0x145'),'through':'UserOpenchannelQueue','required':![]});db[_0x6242('0x12')]['belongsToMany'](db[_0x6242('0x111')],{'as':_0x6242('0x146'),'through':'UserWhatsappQueue','required':![]});db[_0x6242('0x12')][_0x6242('0x132')](db['CmList'],{'through':_0x6242('0x147')});db[_0x6242('0x12')]['belongsToMany'](db[_0x6242('0x5f')],{'as':'ChatWebsites','through':_0x6242('0x148')});db[_0x6242('0x12')][_0x6242('0x132')](db[_0x6242('0x44')],{'as':'FaxAccounts','through':'user_has_fax_accounts'});db[_0x6242('0x12')]['belongsToMany'](db['MailAccount'],{'as':_0x6242('0x149'),'through':_0x6242('0x14a')});db[_0x6242('0x12')][_0x6242('0x132')](db[_0x6242('0x57')],{'as':_0x6242('0x14b'),'through':_0x6242('0x14c')});db[_0x6242('0x12')][_0x6242('0x132')](db[_0x6242('0x4f')],{'as':_0x6242('0x14d'),'through':_0x6242('0x14e')});db['User'][_0x6242('0x132')](db['WhatsappAccount'],{'as':_0x6242('0x14f'),'through':_0x6242('0x150')});db[_0x6242('0x15')]['hasMany'](db[_0x6242('0x16')],{'as':_0x6242('0x151'),'onDelete':_0x6242('0x11e'),'foreignKey':'ChanSpyId'});db[_0x6242('0x152')][_0x6242('0x122')](db[_0x6242('0x16')],{'onDelete':_0x6242('0x11e')});db[_0x6242('0x16')][_0x6242('0x122')](db[_0x6242('0x16')],{'as':_0x6242('0x153'),'onDelete':_0x6242('0x11e')});db['VoiceMusicOnHold'][_0x6242('0x132')](db[_0x6242('0x8c')],{'as':_0x6242('0x154'),'through':_0x6242('0x155')});db[_0x6242('0x1a')][_0x6242('0x122')](db[_0x6242('0x120')],{'as':'Members','foreignKey':'VoiceQueueId'});db[_0x6242('0x1a')][_0x6242('0x122')](db['CmHopper'],{'as':_0x6242('0x156'),'foreignKey':'VoiceQueueId'});db[_0x6242('0x1a')][_0x6242('0x122')](db[_0x6242('0x76')],{'as':_0x6242('0x124'),'foreignKey':_0x6242('0x157')});db[_0x6242('0x1a')][_0x6242('0x122')](db[_0x6242('0x78')],{'as':'HopperHistories','foreignKey':'VoiceQueueId'});db[_0x6242('0x1a')][_0x6242('0x122')](db['ReportAgentPreview'],{'as':_0x6242('0x7a'),'foreignKey':_0x6242('0x157')});db[_0x6242('0x1a')][_0x6242('0x122')](db[_0x6242('0x74')],{'as':_0x6242('0x158'),'foreignKey':_0x6242('0x157')});db[_0x6242('0x1a')][_0x6242('0x122')](db[_0x6242('0xdf')],{'as':'JscriptySessions','foreignKey':_0x6242('0x157')});db[_0x6242('0x1a')]['belongsTo'](db[_0x6242('0x29')],{'as':'Trunk','foreignKey':_0x6242('0x159')});db['VoiceQueue'][_0x6242('0x12f')](db[_0x6242('0x29')],{'as':_0x6242('0x15a'),'foreignKey':_0x6242('0x15b')});db[_0x6242('0x1a')][_0x6242('0x12f')](db[_0x6242('0x84')],{'as':_0x6242('0x84'),'foreignKey':_0x6242('0x15c')});db[_0x6242('0x1a')]['belongsTo'](db[_0x6242('0x86')],{'as':_0x6242('0x15d'),'foreignKey':_0x6242('0x15e')});db[_0x6242('0x1a')][_0x6242('0x132')](db[_0x6242('0x102')],{'as':'Lists','through':_0x6242('0x15f')});db['VoiceQueue'][_0x6242('0x132')](db['User'],{'as':_0x6242('0x160'),'through':_0x6242('0x13f')});db[_0x6242('0x1a')]['belongsToMany'](db[_0x6242('0xf0')],{'as':_0x6242('0x161'),'through':_0x6242('0x162')});db[_0x6242('0x1a')]['belongsToMany'](db[_0x6242('0x102')],{'as':'BlackLists','through':'voice_queues_has_cm_blacklists'});db[_0x6242('0x1c')][_0x6242('0x12f')](db['User'],{'as':'User','foreignKey':_0x6242('0x11c')});db[_0x6242('0x1e')][_0x6242('0x12f')](db['User'],{'as':'User','foreignKey':_0x6242('0x11c')});db['VoiceMail']['hasMany'](db[_0x6242('0x21')],{'as':_0x6242('0x163'),'onDelete':'cascade','foreignKey':_0x6242('0x164'),'sourceKey':_0x6242('0x165')});db[_0x6242('0x21')][_0x6242('0x12f')](db['VoiceMail'],{'foreignKey':'mailboxuser','targetKey':_0x6242('0x165')});db[_0x6242('0x23')][_0x6242('0x122')](db[_0x6242('0x26')],{'as':_0x6242('0x166'),'foreignKey':'uniqueid','constraints':![]});db[_0x6242('0x23')][_0x6242('0x122')](db['VoiceAgentReport'],{'as':_0x6242('0x167'),'foreignKey':_0x6242('0x168'),'constraints':![]});db[_0x6242('0x23')]['belongsTo'](db['User'],{'as':_0x6242('0x12'),'foreignKey':'UserId'});db['VoiceCallReport'][_0x6242('0x12f')](db[_0x6242('0x135')],{'as':_0x6242('0x169'),'foreignKey':'ContactId'});db[_0x6242('0x36')][_0x6242('0x12f')](db[_0x6242('0x38')],{'as':'MailAccount','foreignKey':'MailAccountId'});db[_0x6242('0x36')][_0x6242('0x12f')](db['CloudProvider'],{'as':'CloudProvider','foreignKey':_0x6242('0x16a'),'onDelete':'restrict'});db[_0x6242('0x16b')][_0x6242('0x12f')](db[_0x6242('0x38')],{'as':_0x6242('0x38'),'foreignKey':_0x6242('0x16c')});db[_0x6242('0x16b')][_0x6242('0x12f')](db['CloudProvider'],{'as':'CloudProvider','foreignKey':_0x6242('0x16a'),'onDelete':_0x6242('0x16d')});db[_0x6242('0x38')][_0x6242('0x11b')](db[_0x6242('0x36')],{'as':_0x6242('0x16e'),'onDelete':_0x6242('0x11e')});db[_0x6242('0x38')][_0x6242('0x11b')](db[_0x6242('0x16b')],{'as':'Smtp','onDelete':_0x6242('0x11e')});db[_0x6242('0x38')][_0x6242('0x122')](db[_0x6242('0x82')],{'as':'Dispositions','foreignKey':_0x6242('0x16c'),'onDelete':_0x6242('0x11e')});db['MailAccount'][_0x6242('0x122')](db[_0x6242('0x80')],{'as':_0x6242('0x16f'),'foreignKey':'MailAccountId'});db[_0x6242('0x38')][_0x6242('0x122')](db[_0x6242('0x170')],{'as':_0x6242('0x163'),'foreignKey':_0x6242('0x16c')});db[_0x6242('0x38')][_0x6242('0x122')](db[_0x6242('0x3c')],{'as':_0x6242('0x171')});db[_0x6242('0x38')][_0x6242('0x122')](db['MailApplication'],{'as':_0x6242('0x153'),'foreignKey':_0x6242('0x16c'),'onDelete':_0x6242('0x11e')});db[_0x6242('0x38')][_0x6242('0x12f')](db[_0x6242('0x102')],{'as':_0x6242('0x172'),'foreignKey':_0x6242('0x173')});db[_0x6242('0x38')][_0x6242('0x12f')](db[_0x6242('0x94')],{'as':'Template','foreignKey':_0x6242('0x174')});db[_0x6242('0x38')][_0x6242('0x12f')](db[_0x6242('0x86')],{'as':'mandatoryDispositionPause','foreignKey':_0x6242('0x15e')});db[_0x6242('0x38')][_0x6242('0x132')](db[_0x6242('0x12')],{'as':'Agents','through':'user_has_mail_accounts'});db['MailQueue'][_0x6242('0x132')](db['User'],{'as':_0x6242('0x160'),'through':_0x6242('0x175')});db['MailQueue'][_0x6242('0x132')](db[_0x6242('0xf0')],{'through':'team_has_mail_queues','as':'Teams'});db[_0x6242('0x3c')]['hasMany'](db[_0x6242('0x170')],{'as':'Messages','onDelete':_0x6242('0x11e'),'foreignKey':_0x6242('0x176')});db['MailInteraction']['belongsTo'](db['MailAccount'],{'as':_0x6242('0x177'),'foreignKey':'MailAccountId'});db[_0x6242('0x3c')][_0x6242('0x12f')](db[_0x6242('0x135')],{'as':_0x6242('0x169'),'foreignKey':_0x6242('0x178')});db[_0x6242('0x3c')][_0x6242('0x12f')](db[_0x6242('0x12')],{'as':_0x6242('0x179'),'foreignKey':_0x6242('0x11c')});db[_0x6242('0x3c')][_0x6242('0x132')](db[_0x6242('0x8e')],{'through':_0x6242('0x17a'),'as':_0x6242('0x17b')});db[_0x6242('0x3c')][_0x6242('0x132')](db[_0x6242('0x8e')],{'through':'mail_interaction_has_tags','as':_0x6242('0x17c')});db[_0x6242('0x3c')][_0x6242('0x132')](db[_0x6242('0x12')],{'as':'Users','through':_0x6242('0x13a'),'foreignKey':'MailInteractionId'});db[_0x6242('0x170')][_0x6242('0x122')](db['Attachment'],{'as':'Attachments','onDelete':_0x6242('0x11e')});db[_0x6242('0x170')]['belongsTo'](db[_0x6242('0x12')],{'as':_0x6242('0x12')});db[_0x6242('0x170')][_0x6242('0x12f')](db['CmContact'],{'onDelete':'cascade','as':_0x6242('0x169')});db['MailMessage']['belongsTo'](db[_0x6242('0x3c')],{'as':_0x6242('0x17d'),'foreignKey':'MailInteractionId'});db[_0x6242('0x170')][_0x6242('0x12f')](db[_0x6242('0x38')],{'as':'Account','foreignKey':_0x6242('0x16c')});db[_0x6242('0x170')][_0x6242('0x12f')](db['ChatWebsite'],{'as':_0x6242('0x5f'),'foreignKey':'ChatWebsiteId'});db[_0x6242('0x170')][_0x6242('0x12f')](db[_0x6242('0x68')],{'as':_0x6242('0x68'),'foreignKey':_0x6242('0x17e')});db[_0x6242('0x3f')][_0x6242('0x12f')](db[_0x6242('0x12')],{'onDelete':'restrict'});db[_0x6242('0x3f')][_0x6242('0x12f')](db[_0x6242('0x39')],{'onDelete':'restrict'});db[_0x6242('0x3f')][_0x6242('0x12f')](db[_0x6242('0x38')],{'onDelete':'restrict'});db['MailApplication']['belongsTo'](db[_0x6242('0x84')],{'onDelete':'restrict','foreignKey':_0x6242('0x15c')});db[_0x6242('0x3f')][_0x6242('0x12f')](db['Tag'],{'onDelete':_0x6242('0x16d'),'foreignKey':_0x6242('0x17f')});db['MailQueueReport']['belongsTo'](db['MailAccount'],{});db[_0x6242('0x41')][_0x6242('0x12f')](db[_0x6242('0x102')],{'as':_0x6242('0x172'),'foreignKey':_0x6242('0x173')});db[_0x6242('0x41')][_0x6242('0x12f')](db[_0x6242('0x135')],{'as':'Contact','foreignKey':_0x6242('0x178')});db['MailQueueReport']['belongsTo'](db['MailInteraction'],{});db[_0x6242('0x41')][_0x6242('0x12f')](db[_0x6242('0x170')],{});db[_0x6242('0x41')]['belongsTo'](db[_0x6242('0x12')],{});db[_0x6242('0x41')][_0x6242('0x12f')](db[_0x6242('0x39')],{});db[_0x6242('0x180')]['hasMany'](db['DashboardItem'],{'as':_0x6242('0x181'),'onDelete':'cascade'});db['FaxAccount'][_0x6242('0x122')](db['Disposition'],{'as':_0x6242('0x182'),'foreignKey':_0x6242('0x183'),'onDelete':_0x6242('0x11e')});db[_0x6242('0x44')]['hasMany'](db['CannedAnswer'],{'as':_0x6242('0x16f'),'foreignKey':_0x6242('0x183')});db['FaxAccount']['hasMany'](db[_0x6242('0x47')],{'as':_0x6242('0x171')});db[_0x6242('0x44')][_0x6242('0x122')](db['FaxApplication'],{'as':_0x6242('0x153'),'foreignKey':'FaxAccountId','onDelete':'cascade'});db[_0x6242('0x44')][_0x6242('0x122')](db[_0x6242('0x16')],{'as':'Exntensions','onDelete':_0x6242('0x11e')});db[_0x6242('0x44')]['hasMany'](db[_0x6242('0x49')],{'as':'Messages'});db[_0x6242('0x44')][_0x6242('0x12f')](db['Trunk'],{'as':'Trunk'});db[_0x6242('0x44')]['belongsTo'](db[_0x6242('0x102')],{'as':_0x6242('0x172'),'foreignKey':_0x6242('0x173')});db[_0x6242('0x44')][_0x6242('0x12f')](db[_0x6242('0x86')],{'as':_0x6242('0x15d'),'foreignKey':'mandatoryDispositionPauseId'});db['FaxAccount'][_0x6242('0x132')](db['User'],{'as':_0x6242('0x160'),'through':'user_has_fax_accounts'});db['FaxApplication'][_0x6242('0x12f')](db[_0x6242('0x12')],{'onDelete':_0x6242('0x16d')});db[_0x6242('0x46')][_0x6242('0x12f')](db[_0x6242('0x4b')],{'onDelete':_0x6242('0x16d')});db[_0x6242('0x46')][_0x6242('0x12f')](db['FaxAccount'],{'onDelete':'restrict'});db[_0x6242('0x46')]['belongsTo'](db[_0x6242('0x8e')],{'onDelete':_0x6242('0x16d'),'foreignKey':_0x6242('0x17f')});db[_0x6242('0x47')][_0x6242('0x122')](db[_0x6242('0x49')],{'as':_0x6242('0x163'),'onDelete':'cascade','foreignKey':'FaxInteractionId'});db[_0x6242('0x47')][_0x6242('0x12f')](db[_0x6242('0x44')],{'as':_0x6242('0x177'),'foreignKey':_0x6242('0x183')});db[_0x6242('0x47')][_0x6242('0x12f')](db[_0x6242('0x135')],{'as':_0x6242('0x169'),'foreignKey':_0x6242('0x178')});db[_0x6242('0x47')][_0x6242('0x12f')](db[_0x6242('0x12')],{'as':_0x6242('0x179'),'foreignKey':_0x6242('0x11c')});db[_0x6242('0x47')][_0x6242('0x132')](db[_0x6242('0x8e')],{'through':'fax_interaction_has_tags','as':_0x6242('0x17b')});db[_0x6242('0x47')][_0x6242('0x132')](db[_0x6242('0x8e')],{'through':_0x6242('0x184'),'as':'ThroughTags'});db[_0x6242('0x47')][_0x6242('0x132')](db[_0x6242('0x12')],{'as':_0x6242('0x185'),'through':_0x6242('0x13c'),'foreignKey':_0x6242('0x186')});db[_0x6242('0x49')][_0x6242('0x12f')](db[_0x6242('0x12')],{'onDelete':_0x6242('0x11e'),'as':_0x6242('0x12')});db[_0x6242('0x49')][_0x6242('0x12f')](db[_0x6242('0x47')],{'as':_0x6242('0x17d'),'foreignKey':_0x6242('0x186')});db[_0x6242('0x49')][_0x6242('0x12f')](db['CmContact'],{'onDelete':_0x6242('0x11e'),'as':_0x6242('0x169')});db[_0x6242('0x49')][_0x6242('0x12f')](db[_0x6242('0xf7')],{'as':_0x6242('0xf7'),'foreignKey':_0x6242('0x187')});db[_0x6242('0x49')][_0x6242('0x12f')](db[_0x6242('0x44')],{'as':'Account','foreignKey':_0x6242('0x183')});db[_0x6242('0x4b')][_0x6242('0x132')](db[_0x6242('0x12')],{'as':_0x6242('0x160'),'through':_0x6242('0x30')});db[_0x6242('0x4b')][_0x6242('0x132')](db[_0x6242('0xf0')],{'through':'team_has_fax_queues','as':_0x6242('0x161')});db[_0x6242('0x4d')]['belongsTo'](db[_0x6242('0x44')],{});db['FaxQueueReport']['belongsTo'](db['CmList'],{'as':_0x6242('0x172'),'foreignKey':_0x6242('0x173')});db[_0x6242('0x4d')][_0x6242('0x12f')](db[_0x6242('0x135')],{'as':_0x6242('0x169'),'foreignKey':_0x6242('0x178')});db['FaxQueueReport']['belongsTo'](db[_0x6242('0x47')],{});db[_0x6242('0x4d')][_0x6242('0x12f')](db[_0x6242('0x49')],{});db[_0x6242('0x4d')][_0x6242('0x12f')](db[_0x6242('0x12')],{});db[_0x6242('0x4d')][_0x6242('0x12f')](db[_0x6242('0x4b')],{});db[_0x6242('0x4f')]['hasMany'](db[_0x6242('0x82')],{'as':_0x6242('0x182'),'foreignKey':'SmsAccountId','onDelete':_0x6242('0x11e')});db[_0x6242('0x4f')][_0x6242('0x122')](db[_0x6242('0x80')],{'as':_0x6242('0x16f'),'foreignKey':_0x6242('0x188')});db[_0x6242('0x4f')][_0x6242('0x122')](db['SmsMessage'],{'as':_0x6242('0x163'),'foreignKey':_0x6242('0x188')});db[_0x6242('0x4f')][_0x6242('0x122')](db[_0x6242('0x52')],{'as':_0x6242('0x171')});db['SmsAccount']['hasMany'](db[_0x6242('0x189')],{'as':'Applications','foreignKey':'SmsAccountId','onDelete':_0x6242('0x11e')});db[_0x6242('0x4f')][_0x6242('0x12f')](db[_0x6242('0x102')],{'as':_0x6242('0x172'),'foreignKey':_0x6242('0x173')});db[_0x6242('0x4f')][_0x6242('0x12f')](db[_0x6242('0x86')],{'as':_0x6242('0x15d'),'foreignKey':_0x6242('0x15e')});db[_0x6242('0x4f')][_0x6242('0x132')](db[_0x6242('0x12')],{'as':_0x6242('0x160'),'through':_0x6242('0x14e')});db[_0x6242('0x189')][_0x6242('0x12f')](db[_0x6242('0x12')],{'onDelete':'restrict'});db[_0x6242('0x189')]['belongsTo'](db[_0x6242('0x56')],{'onDelete':_0x6242('0x16d')});db[_0x6242('0x189')][_0x6242('0x12f')](db[_0x6242('0x4f')],{'onDelete':'restrict'});db[_0x6242('0x189')][_0x6242('0x12f')](db[_0x6242('0x84')],{'onDelete':_0x6242('0x16d'),'foreignKey':_0x6242('0x15c')});db[_0x6242('0x189')][_0x6242('0x12f')](db[_0x6242('0x8e')],{'onDelete':_0x6242('0x16d'),'foreignKey':'TagId'});db[_0x6242('0x52')][_0x6242('0x122')](db[_0x6242('0x54')],{'as':'Messages','onDelete':_0x6242('0x11e'),'foreignKey':'SmsInteractionId'});db[_0x6242('0x52')][_0x6242('0x12f')](db[_0x6242('0x4f')],{'as':_0x6242('0x177'),'foreignKey':_0x6242('0x188')});db[_0x6242('0x52')][_0x6242('0x12f')](db[_0x6242('0x135')],{'as':_0x6242('0x169'),'foreignKey':_0x6242('0x178')});db['SmsInteraction'][_0x6242('0x12f')](db[_0x6242('0x12')],{'as':_0x6242('0x179'),'foreignKey':_0x6242('0x11c')});db[_0x6242('0x52')][_0x6242('0x132')](db[_0x6242('0x8e')],{'through':_0x6242('0x18a'),'as':_0x6242('0x17b')});db[_0x6242('0x52')]['belongsToMany'](db[_0x6242('0x8e')],{'through':_0x6242('0x18a'),'as':_0x6242('0x17c')});db['SmsInteraction'][_0x6242('0x132')](db[_0x6242('0x12')],{'as':'Users','through':_0x6242('0x13d'),'foreignKey':_0x6242('0x18b')});db[_0x6242('0x54')]['belongsTo'](db['User'],{'as':'User'});db[_0x6242('0x54')][_0x6242('0x12f')](db[_0x6242('0x135')],{'onDelete':_0x6242('0x11e'),'as':_0x6242('0x169')});db[_0x6242('0x54')][_0x6242('0x12f')](db[_0x6242('0x52')],{'onDelete':_0x6242('0x11e'),'as':_0x6242('0x17d'),'foreignKey':_0x6242('0x18b')});db['SmsMessage'][_0x6242('0x12f')](db[_0x6242('0x4f')],{'as':'Account','foreignKey':_0x6242('0x188')});db[_0x6242('0x56')][_0x6242('0x132')](db[_0x6242('0x12')],{'as':_0x6242('0x160'),'through':_0x6242('0x32'),'foreignKey':_0x6242('0x18c')});db[_0x6242('0x56')][_0x6242('0x132')](db[_0x6242('0xf0')],{'through':'team_has_sms_queues','as':'Teams'});db['OpenchannelAccount']['hasMany'](db[_0x6242('0x82')],{'as':_0x6242('0x182'),'foreignKey':'OpenchannelAccountId','onDelete':_0x6242('0x11e')});db[_0x6242('0x57')]['hasMany'](db[_0x6242('0x80')],{'as':_0x6242('0x16f'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0x6242('0x122')](db[_0x6242('0x126')],{'as':_0x6242('0x171'),'foreignKey':_0x6242('0x18d')});db['OpenchannelAccount'][_0x6242('0x122')](db[_0x6242('0x5c')],{'as':'Messages','foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount']['hasMany'](db[_0x6242('0x59')],{'as':'Applications','foreignKey':_0x6242('0x18d'),'onDelete':_0x6242('0x11e')});db[_0x6242('0x57')][_0x6242('0x12f')](db[_0x6242('0x102')],{'as':'List','foreignKey':_0x6242('0x173')});db[_0x6242('0x57')][_0x6242('0x12f')](db[_0x6242('0x86')],{'as':_0x6242('0x15d'),'foreignKey':_0x6242('0x15e')});db[_0x6242('0x57')][_0x6242('0x132')](db['User'],{'as':'Agents','through':_0x6242('0x14c')});db[_0x6242('0x59')][_0x6242('0x12f')](db[_0x6242('0x12')],{'onDelete':'restrict'});db[_0x6242('0x59')][_0x6242('0x12f')](db[_0x6242('0x144')],{'onDelete':_0x6242('0x16d'),'foreignKey':_0x6242('0x18e')});db[_0x6242('0x59')][_0x6242('0x12f')](db[_0x6242('0x57')],{'onDelete':_0x6242('0x16d'),'foreignKey':_0x6242('0x18d')});db['OpenchannelApplication'][_0x6242('0x12f')](db[_0x6242('0x84')],{'onDelete':_0x6242('0x16d'),'foreignKey':'IntervalId'});db['OpenchannelApplication'][_0x6242('0x12f')](db[_0x6242('0x8e')],{'onDelete':'restrict','foreignKey':_0x6242('0x17f')});db[_0x6242('0x126')][_0x6242('0x122')](db[_0x6242('0x5c')],{'as':_0x6242('0x163'),'onDelete':'cascade','foreignKey':_0x6242('0x18f')});db[_0x6242('0x126')][_0x6242('0x12f')](db[_0x6242('0x57')],{'as':'Account','foreignKey':'OpenchannelAccountId'});db[_0x6242('0x126')][_0x6242('0x12f')](db[_0x6242('0x135')],{'as':_0x6242('0x169'),'foreignKey':_0x6242('0x178')});db[_0x6242('0x126')][_0x6242('0x12f')](db[_0x6242('0x12')],{'as':_0x6242('0x179'),'foreignKey':_0x6242('0x11c')});db[_0x6242('0x126')][_0x6242('0x132')](db[_0x6242('0x8e')],{'through':'openchannel_interaction_has_tags','as':_0x6242('0x17b')});db[_0x6242('0x126')][_0x6242('0x132')](db[_0x6242('0x8e')],{'through':_0x6242('0x190'),'as':_0x6242('0x17c')});db[_0x6242('0x126')][_0x6242('0x132')](db['User'],{'as':'Users','through':_0x6242('0x191'),'foreignKey':_0x6242('0x18f')});db[_0x6242('0x5c')][_0x6242('0x12f')](db[_0x6242('0x12')],{'onDelete':'cascade','as':'User'});db[_0x6242('0x5c')]['belongsTo'](db[_0x6242('0x135')],{'onDelete':_0x6242('0x11e'),'as':_0x6242('0x169')});db[_0x6242('0x5c')]['belongsTo'](db[_0x6242('0x126')],{'onDelete':_0x6242('0x11e'),'as':_0x6242('0x17d'),'foreignKey':'OpenchannelInteractionId'});db[_0x6242('0x5c')]['belongsTo'](db[_0x6242('0xf7')],{'as':_0x6242('0xf7'),'foreignKey':_0x6242('0x187')});db['OpenchannelMessage'][_0x6242('0x12f')](db['OpenchannelAccount'],{'as':_0x6242('0x177'),'foreignKey':'OpenchannelAccountId'});db[_0x6242('0x144')]['belongsToMany'](db[_0x6242('0x12')],{'as':_0x6242('0x160'),'through':_0x6242('0x33'),'foreignKey':_0x6242('0x18e')});db[_0x6242('0x144')][_0x6242('0x132')](db[_0x6242('0xf0')],{'through':_0x6242('0x192'),'as':'Teams'});db['ChatWebsite'][_0x6242('0x122')](db[_0x6242('0x82')],{'as':_0x6242('0x182'),'foreignKey':'ChatWebsiteId','onDelete':'cascade'});db[_0x6242('0x5f')][_0x6242('0x122')](db[_0x6242('0x80')],{'as':'Answers','foreignKey':_0x6242('0x193')});db[_0x6242('0x5f')]['hasMany'](db[_0x6242('0x6d')],{'as':_0x6242('0x194')});db[_0x6242('0x5f')][_0x6242('0x122')](db[_0x6242('0x64')],{'as':_0x6242('0x171')});db[_0x6242('0x5f')][_0x6242('0x122')](db[_0x6242('0x62')],{'as':_0x6242('0x153'),'foreignKey':_0x6242('0x193'),'onDelete':_0x6242('0x11e')});db['ChatWebsite']['hasMany'](db['ChatMessage'],{'as':'Messages'});db['ChatWebsite']['belongsTo'](db[_0x6242('0x102')],{'as':'List','foreignKey':_0x6242('0x173')});db[_0x6242('0x5f')]['belongsTo'](db['Interval'],{'as':_0x6242('0x84'),'foreignKey':_0x6242('0x15c')});db[_0x6242('0x5f')]['belongsTo'](db[_0x6242('0x38')],{'as':_0x6242('0x38'),'foreignKey':'MailAccountId'});db[_0x6242('0x5f')][_0x6242('0x12f')](db[_0x6242('0x86')],{'as':_0x6242('0x15d'),'foreignKey':'mandatoryDispositionPauseId'});db['ChatWebsite']['belongsToMany'](db['User'],{'as':_0x6242('0x160'),'through':_0x6242('0x148')});db[_0x6242('0x195')][_0x6242('0x12f')](db[_0x6242('0x57')],{});db['OpenchannelQueueReport']['belongsTo'](db[_0x6242('0x102')],{'as':_0x6242('0x172'),'foreignKey':'ListId'});db['OpenchannelQueueReport'][_0x6242('0x12f')](db[_0x6242('0x135')],{'as':_0x6242('0x169'),'foreignKey':_0x6242('0x178')});db[_0x6242('0x195')][_0x6242('0x12f')](db[_0x6242('0x126')],{});db['OpenchannelQueueReport']['belongsTo'](db[_0x6242('0x5c')],{});db[_0x6242('0x195')][_0x6242('0x12f')](db[_0x6242('0x12')],{});db[_0x6242('0x195')]['belongsTo'](db[_0x6242('0x144')],{});db[_0x6242('0x62')][_0x6242('0x12f')](db['User'],{'as':_0x6242('0x196'),'foreignKey':'UserId','onDelete':'restrict'});db[_0x6242('0x62')][_0x6242('0x12f')](db[_0x6242('0x197')],{'as':_0x6242('0x198'),'foreignKey':_0x6242('0x199'),'onDelete':_0x6242('0x16d')});db['ChatApplication'][_0x6242('0x12f')](db[_0x6242('0x5f')],{'as':_0x6242('0x19a'),'foreignKey':_0x6242('0x193'),'onDelete':_0x6242('0x16d')});db[_0x6242('0x62')][_0x6242('0x12f')](db[_0x6242('0x8e')],{'onDelete':_0x6242('0x16d'),'foreignKey':_0x6242('0x17f')});db[_0x6242('0x64')][_0x6242('0x122')](db[_0x6242('0x66')],{'as':_0x6242('0x163'),'onDelete':_0x6242('0x11e'),'foreignKey':_0x6242('0x19b')});db[_0x6242('0x64')][_0x6242('0x12f')](db['ChatWebsite'],{'as':_0x6242('0x177'),'foreignKey':'ChatWebsiteId'});db[_0x6242('0x64')][_0x6242('0x12f')](db[_0x6242('0x135')],{'as':_0x6242('0x169'),'foreignKey':_0x6242('0x178')});db[_0x6242('0x64')][_0x6242('0x12f')](db['User'],{'as':'Owner','foreignKey':'UserId'});db['ChatInteraction'][_0x6242('0x132')](db['Tag'],{'through':_0x6242('0x19c'),'as':_0x6242('0x17b')});db[_0x6242('0x64')][_0x6242('0x132')](db['Tag'],{'through':_0x6242('0x19c'),'as':_0x6242('0x17c')});db[_0x6242('0x64')][_0x6242('0x132')](db[_0x6242('0x12')],{'as':_0x6242('0x185'),'through':_0x6242('0x13b'),'foreignKey':'ChatInteractionId'});db[_0x6242('0x66')]['belongsTo'](db[_0x6242('0x12')],{'onDelete':_0x6242('0x11e'),'as':_0x6242('0x12')});db[_0x6242('0x66')][_0x6242('0x12f')](db[_0x6242('0x135')],{'onDelete':'cascade','as':_0x6242('0x169'),'foreignKey':_0x6242('0x178')});db[_0x6242('0x66')][_0x6242('0x12f')](db[_0x6242('0x64')],{'onDelete':_0x6242('0x11e'),'as':_0x6242('0x17d'),'foreignKey':_0x6242('0x19b')});db[_0x6242('0x66')]['belongsTo'](db['Attachment'],{'as':_0x6242('0xf7'),'foreignKey':_0x6242('0x187')});db[_0x6242('0x66')][_0x6242('0x12f')](db[_0x6242('0x5f')],{'as':_0x6242('0x177'),'foreignKey':_0x6242('0x193')});db[_0x6242('0x68')][_0x6242('0x122')](db[_0x6242('0xf7')],{'as':'Attachments','foreignKey':'ChatOfflineMessageId','onDelete':_0x6242('0x11e'),'hooks':!![]});db[_0x6242('0x68')][_0x6242('0x12f')](db[_0x6242('0x135')],{'onDelete':_0x6242('0x11e'),'as':_0x6242('0x169'),'foreignKey':_0x6242('0x178')});db['ChatOfflineMessage'][_0x6242('0x12f')](db['ChatWebsite'],{'as':_0x6242('0x177'),'foreignKey':_0x6242('0x193')});db[_0x6242('0x197')]['belongsToMany'](db[_0x6242('0x12')],{'as':_0x6242('0x160'),'through':_0x6242('0x142'),'hooks':!![]});db[_0x6242('0x197')][_0x6242('0x132')](db[_0x6242('0xf0')],{'through':_0x6242('0x19d'),'as':'Teams'});db[_0x6242('0x6b')][_0x6242('0x122')](db[_0x6242('0x19e')],{'as':_0x6242('0x163'),'foreignKey':_0x6242('0x19f'),'onDelete':_0x6242('0x11e')});db[_0x6242('0x6b')][_0x6242('0x132')](db['User'],{'as':_0x6242('0x1a0'),'through':'chat_group_has_users'});db[_0x6242('0x6d')][_0x6242('0x12f')](db[_0x6242('0x5f')],{'as':_0x6242('0x19a'),'foreignKey':_0x6242('0x193')});db['CmCompany'][_0x6242('0x122')](db['CmContact'],{'as':'Contacts','foreignKey':_0x6242('0x1a1')});db['CmContact']['hasMany'](db[_0x6242('0x1a2')],{'as':_0x6242('0x1a3'),'foreignKey':_0x6242('0x1a4')});db['CmContact'][_0x6242('0x122')](db[_0x6242('0x72')],{'as':_0x6242('0x156'),'foreignKey':_0x6242('0x178')});db['CmContact'][_0x6242('0x122')](db[_0x6242('0x76')],{'as':_0x6242('0x124'),'foreignKey':_0x6242('0x178')});db['CmContact'][_0x6242('0x122')](db[_0x6242('0x78')],{'as':_0x6242('0x1a5'),'foreignKey':_0x6242('0x178')});db[_0x6242('0x135')][_0x6242('0x122')](db[_0x6242('0x7a')],{'as':_0x6242('0x7a'),'foreignKey':_0x6242('0x178')});db[_0x6242('0x135')][_0x6242('0x122')](db[_0x6242('0xdf')],{'as':_0x6242('0x1a6'),'foreignKey':'ContactId'});db[_0x6242('0x135')]['hasMany'](db[_0x6242('0x126')],{'as':'OpenchannelInteractions','foreignKey':_0x6242('0x178'),'onDelete':_0x6242('0x16d')});db[_0x6242('0x135')][_0x6242('0x122')](db['ChatInteraction'],{'as':_0x6242('0x128'),'foreignKey':_0x6242('0x178'),'onDelete':'restrict'});db[_0x6242('0x135')][_0x6242('0x122')](db[_0x6242('0x52')],{'as':'SmsInteractions','foreignKey':_0x6242('0x178'),'onDelete':_0x6242('0x16d')});db['CmContact'][_0x6242('0x122')](db[_0x6242('0x47')],{'as':_0x6242('0x12a'),'foreignKey':_0x6242('0x178'),'onDelete':_0x6242('0x16d')});db[_0x6242('0x135')][_0x6242('0x122')](db[_0x6242('0x3c')],{'as':_0x6242('0x12b'),'foreignKey':_0x6242('0x178'),'onDelete':_0x6242('0x16d')});db[_0x6242('0x135')][_0x6242('0x12f')](db['CmCompany'],{'as':_0x6242('0x1a7'),'foreignKey':_0x6242('0x1a1')});db[_0x6242('0x135')]['belongsTo'](db['CmList'],{'as':'List','foreignKey':_0x6242('0x173'),'onDelete':_0x6242('0x11e')});db[_0x6242('0x135')][_0x6242('0x132')](db['User'],{'as':_0x6242('0x185'),'through':'cm_user_has_contacts'});db[_0x6242('0x135')][_0x6242('0x132')](db[_0x6242('0x8e')],{'as':_0x6242('0x17b'),'through':_0x6242('0x1a8')});db['CmContact'][_0x6242('0x132')](db[_0x6242('0x8e')],{'through':'cm_contact_has_tags','as':_0x6242('0x17c')});db[_0x6242('0x72')][_0x6242('0x122')](db[_0x6242('0x1a9')],{'as':'AdditionalPhones','foreignKey':_0x6242('0x1aa')});db[_0x6242('0x72')][_0x6242('0x12f')](db[_0x6242('0x135')],{'as':'Contact','foreignKey':_0x6242('0x178'),'onDelete':_0x6242('0x11e')});db[_0x6242('0x72')][_0x6242('0x12f')](db[_0x6242('0x102')],{'as':'List','foreignKey':_0x6242('0x173'),'onDelete':'cascade'});db[_0x6242('0x72')]['belongsTo'](db[_0x6242('0x12')],{'as':_0x6242('0x196'),'foreignKey':_0x6242('0x11c')});db['CmHopper']['belongsTo'](db[_0x6242('0x1a')],{'as':'Queue','foreignKey':'VoiceQueueId','onDelete':_0x6242('0x11e')});db[_0x6242('0x72')]['belongsTo'](db['Campaign'],{'as':_0x6242('0xf4'),'foreignKey':_0x6242('0x1ab'),'onDelete':_0x6242('0x11e')});db[_0x6242('0x72')]['belongsTo'](db[_0x6242('0x12')],{'as':'Owner','foreignKey':'OwnerId'});db[_0x6242('0x74')][_0x6242('0x12f')](db[_0x6242('0x135')],{'as':'Contact','foreignKey':_0x6242('0x178'),'onDelete':_0x6242('0x11e')});db[_0x6242('0x74')]['belongsTo'](db[_0x6242('0x102')],{'as':_0x6242('0x172'),'foreignKey':_0x6242('0x173'),'onDelete':'cascade'});db[_0x6242('0x74')][_0x6242('0x12f')](db[_0x6242('0x1a')],{'as':_0x6242('0x198'),'foreignKey':_0x6242('0x157'),'onDelete':_0x6242('0x11e')});db[_0x6242('0x74')][_0x6242('0x12f')](db[_0x6242('0xf4')],{'as':_0x6242('0xf4'),'foreignKey':_0x6242('0x1ab'),'onDelete':_0x6242('0x11e')});db[_0x6242('0x7e')][_0x6242('0x122')](db[_0x6242('0x1ac')],{'as':{'plural':_0x6242('0x1ad'),'singular':_0x6242('0x1ae')},'foreignKey':_0x6242('0x1af'),'onDelete':_0x6242('0x11e'),'hooks':!![]});db[_0x6242('0x7e')][_0x6242('0x122')](db[_0x6242('0x1ac')],{'as':{'plural':'Any','singular':_0x6242('0x1b0')},'foreignKey':'AutomationAnyId','onDelete':_0x6242('0x11e'),'hooks':!![]});db[_0x6242('0x7e')]['hasMany'](db[_0x6242('0x7d')],{'as':_0x6242('0x1b1'),'foreignKey':'AutomationId','onDelete':'cascade','hooks':!![]});db[_0x6242('0x82')][_0x6242('0x122')](db[_0x6242('0x82')],{'as':_0x6242('0x182'),'foreignKey':_0x6242('0x1b2'),'onDelete':_0x6242('0x11e')});db[_0x6242('0x84')][_0x6242('0x122')](db[_0x6242('0x84')],{'as':'Intervals','foreignKey':_0x6242('0x15c'),'onDelete':'cascade','hooks':!![],'required':![]});db[_0x6242('0x84')]['hasMany'](db[_0x6242('0x16')],{'as':_0x6242('0x123'),'foreignKey':_0x6242('0x15c'),'onDelete':_0x6242('0x16d')});db['Interval'][_0x6242('0x122')](db[_0x6242('0x3f')],{'as':'MailApplications','foreignKey':'IntervalId'});db[_0x6242('0x84')]['hasMany'](db[_0x6242('0x62')],{'as':_0x6242('0x1b3'),'foreignKey':_0x6242('0x15c')});db['Interval'][_0x6242('0x122')](db[_0x6242('0x46')],{'as':_0x6242('0x1b4'),'foreignKey':'IntervalId'});db[_0x6242('0x84')][_0x6242('0x122')](db['SmsApplication'],{'as':'SmsApplications','foreignKey':_0x6242('0x15c')});db[_0x6242('0x8a')][_0x6242('0x12f')](db[_0x6242('0x38')],{});db[_0x6242('0x8a')][_0x6242('0x12f')](db[_0x6242('0x9e')],{'foreignKey':'DefaultReportId'});db[_0x6242('0x8a')][_0x6242('0x12f')](db[_0x6242('0x9d')],{'foreignKey':_0x6242('0x1b5')});db[_0x6242('0x8c')][_0x6242('0x132')](db['VoiceMusicOnHold'],{'as':_0x6242('0x1b6'),'through':'moh_has_sounds','onDelete':_0x6242('0x16d')});db[_0x6242('0x8e')][_0x6242('0x132')](db[_0x6242('0x135')],{'through':'cm_contact_has_tags'});db['Tag'][_0x6242('0x132')](db['ChatInteraction'],{'through':_0x6242('0x19c')});db[_0x6242('0x8e')][_0x6242('0x132')](db[_0x6242('0x3c')],{'through':_0x6242('0x17a')});db[_0x6242('0x8e')][_0x6242('0x132')](db[_0x6242('0x52')],{'through':_0x6242('0x18a')});db[_0x6242('0x8e')]['belongsToMany'](db['FaxInteraction'],{'through':'fax_interaction_has_tags'});db[_0x6242('0x8e')][_0x6242('0x132')](db[_0x6242('0x126')],{'through':_0x6242('0x190')});db[_0x6242('0x8e')][_0x6242('0x132')](db['WhatsappInteraction'],{'through':_0x6242('0x1b7')});db['CmContactHasItem'][_0x6242('0x12f')](db[_0x6242('0x90')],{'as':_0x6242('0x1b8'),'foreignKey':_0x6242('0x1b9')});db[_0x6242('0x1a9')][_0x6242('0x12f')](db[_0x6242('0x72')],{'as':_0x6242('0x1ba'),'foreignKey':_0x6242('0x1aa')});db[_0x6242('0x1a2')][_0x6242('0x12f')](db[_0x6242('0x135')],{'as':_0x6242('0x169'),'foreignKey':_0x6242('0x1a4')});db['Trigger']['hasMany'](db[_0x6242('0x1ac')],{'as':{'plural':_0x6242('0x1bb'),'singular':_0x6242('0x1bc')},'foreignKey':_0x6242('0x1bd'),'onDelete':_0x6242('0x11e'),'hooks':!![]});db[_0x6242('0x96')][_0x6242('0x122')](db[_0x6242('0x1ac')],{'as':{'plural':_0x6242('0x1be'),'singular':'AnyCondition'},'foreignKey':'TriggerAnyId','onDelete':'cascade','hooks':!![]});db['Trigger'][_0x6242('0x122')](db['Action'],{'as':_0x6242('0x1b1'),'foreignKey':_0x6242('0x1bf'),'onDelete':_0x6242('0x11e'),'hooks':!![]});db[_0x6242('0x9d')][_0x6242('0x122')](db[_0x6242('0xa4')],{'as':'Fields','onDelete':_0x6242('0x11e'),'foreignKey':_0x6242('0x1b5'),'hooks':!![]});db[_0x6242('0x9e')][_0x6242('0x122')](db[_0x6242('0xa4')],{'as':'Fields','onDelete':_0x6242('0x11e'),'foreignKey':_0x6242('0x1c0')});db[_0x6242('0xa2')][_0x6242('0x122')](db[_0x6242('0xa4')],{'as':'Fields','onDelete':_0x6242('0x11e'),'foreignKey':_0x6242('0x1c1')});db[_0x6242('0xa4')][_0x6242('0x12f')](db[_0x6242('0xa2')],{'foreignKey':_0x6242('0x1c1')});db[_0x6242('0x1c2')][_0x6242('0x122')](db[_0x6242('0x1c3')],{'as':'Configurations','onDelete':_0x6242('0x11e'),'foreignKey':'AccountId'});db['SalesforceConfiguration'][_0x6242('0x122')](db['SalesforceField'],{'as':_0x6242('0x1c4'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x6242('0x1c3')][_0x6242('0x122')](db[_0x6242('0x1c5')],{'as':_0x6242('0x1c6'),'onDelete':'cascade','foreignKey':'DescriptionId'});db['SalesforceConfiguration'][_0x6242('0x122')](db[_0x6242('0x1c5')],{'as':'Fields','onDelete':_0x6242('0x11e'),'foreignKey':_0x6242('0x1c7')});db[_0x6242('0x1c3')][_0x6242('0x12f')](db['SalesforceAccount'],{'as':_0x6242('0x177'),'foreignKey':_0x6242('0x1c8')});db[_0x6242('0x1c5')][_0x6242('0x122')](db[_0x6242('0x1c5')],{'as':_0x6242('0x1c9'),'foreignKey':'SubjectId'});db[_0x6242('0x1c5')][_0x6242('0x122')](db[_0x6242('0x1c5')],{'as':'Description','foreignKey':_0x6242('0x1ca')});db['SalesforceField']['hasMany'](db[_0x6242('0x1c5')],{'as':_0x6242('0x1cb'),'foreignKey':_0x6242('0x1c7')});db[_0x6242('0x1c5')]['belongsTo'](db[_0x6242('0x98')],{'as':_0x6242('0x98'),'foreignKey':_0x6242('0x1cc')});db[_0x6242('0xa9')][_0x6242('0x122')](db['SugarcrmConfiguration'],{'as':_0x6242('0x1cd'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x6242('0xab')]['hasMany'](db[_0x6242('0xad')],{'as':_0x6242('0x1c4'),'onDelete':'cascade','foreignKey':_0x6242('0x1ce')});db[_0x6242('0xab')][_0x6242('0x122')](db['SugarcrmField'],{'as':_0x6242('0x1c6'),'onDelete':_0x6242('0x11e'),'foreignKey':_0x6242('0x1ca')});db['SugarcrmConfiguration'][_0x6242('0x122')](db[_0x6242('0xad')],{'as':_0x6242('0x1cf'),'onDelete':_0x6242('0x11e'),'foreignKey':_0x6242('0x1c7')});db[_0x6242('0xab')][_0x6242('0x12f')](db['SugarcrmAccount'],{'as':'Account','foreignKey':'AccountId'});db[_0x6242('0xad')][_0x6242('0x122')](db['SugarcrmField'],{'as':_0x6242('0x1c9'),'foreignKey':'SubjectId'});db[_0x6242('0xad')][_0x6242('0x122')](db[_0x6242('0xad')],{'as':_0x6242('0x1d0'),'foreignKey':_0x6242('0x1ca')});db[_0x6242('0xad')][_0x6242('0x122')](db[_0x6242('0xad')],{'as':_0x6242('0x1cb'),'foreignKey':_0x6242('0x1c7')});db['SugarcrmField'][_0x6242('0x12f')](db['Variable'],{'as':_0x6242('0x98'),'foreignKey':_0x6242('0x1cc')});db['DeskAccount']['hasMany'](db[_0x6242('0xaf')],{'as':_0x6242('0x1cd'),'onDelete':_0x6242('0x11e'),'foreignKey':'AccountId'});db[_0x6242('0xaf')][_0x6242('0x122')](db[_0x6242('0xb1')],{'as':_0x6242('0x1c4'),'onDelete':_0x6242('0x11e'),'foreignKey':_0x6242('0x1ce')});db['DeskConfiguration'][_0x6242('0x122')](db['DeskField'],{'as':'Descriptions','onDelete':'cascade','foreignKey':'DescriptionId'});db[_0x6242('0xaf')][_0x6242('0x122')](db[_0x6242('0xb1')],{'as':'Fields','onDelete':'cascade','foreignKey':_0x6242('0x1c7')});db[_0x6242('0xaf')]['belongsTo'](db[_0x6242('0x1d1')],{'as':_0x6242('0x177'),'foreignKey':'AccountId'});db[_0x6242('0xaf')][_0x6242('0x132')](db[_0x6242('0x8e')],{'through':'int_desk_configuration_has_tags'});db[_0x6242('0xb1')][_0x6242('0x122')](db[_0x6242('0xb1')],{'as':_0x6242('0x1c9'),'foreignKey':_0x6242('0x1ce')});db[_0x6242('0xb1')][_0x6242('0x122')](db[_0x6242('0xb1')],{'as':_0x6242('0x1d0'),'foreignKey':'DescriptionId'});db[_0x6242('0xb1')][_0x6242('0x122')](db[_0x6242('0xb1')],{'as':_0x6242('0x1cb'),'foreignKey':'FieldId'});db[_0x6242('0xb1')][_0x6242('0x12f')](db[_0x6242('0x98')],{'as':'Variable','foreignKey':'VariableId'});db[_0x6242('0xb2')][_0x6242('0x122')](db[_0x6242('0xb4')],{'as':_0x6242('0x1cd'),'onDelete':_0x6242('0x11e'),'foreignKey':_0x6242('0x1c8')});db[_0x6242('0xb4')]['hasMany'](db[_0x6242('0xb6')],{'as':_0x6242('0x1c4'),'onDelete':'cascade','foreignKey':_0x6242('0x1ce')});db[_0x6242('0xb4')][_0x6242('0x122')](db[_0x6242('0xb6')],{'as':_0x6242('0x1c6'),'onDelete':_0x6242('0x11e'),'foreignKey':'DescriptionId'});db[_0x6242('0xb4')]['hasMany'](db[_0x6242('0xb6')],{'as':_0x6242('0x1cf'),'onDelete':_0x6242('0x11e'),'foreignKey':_0x6242('0x1c7')});db[_0x6242('0xb4')][_0x6242('0x12f')](db[_0x6242('0xb2')],{'as':_0x6242('0x177'),'foreignKey':_0x6242('0x1c8')});db['ZohoField'][_0x6242('0x122')](db['ZohoField'],{'as':_0x6242('0x1c9'),'foreignKey':_0x6242('0x1ce')});db[_0x6242('0xb6')][_0x6242('0x122')](db[_0x6242('0xb6')],{'as':_0x6242('0x1d0'),'foreignKey':'DescriptionId'});db[_0x6242('0xb6')][_0x6242('0x122')](db[_0x6242('0xb6')],{'as':_0x6242('0x1cb'),'foreignKey':'FieldId'});db[_0x6242('0xb6')][_0x6242('0x12f')](db[_0x6242('0x98')],{'as':_0x6242('0x98'),'foreignKey':_0x6242('0x1cc')});db[_0x6242('0xb8')][_0x6242('0x122')](db['ZendeskConfiguration'],{'as':_0x6242('0x1cd'),'onDelete':_0x6242('0x11e'),'foreignKey':_0x6242('0x1c8')});db[_0x6242('0xba')][_0x6242('0x122')](db[_0x6242('0xbc')],{'as':_0x6242('0x1c4'),'foreignKey':'SubjectId'});db[_0x6242('0xba')]['hasMany'](db['ZendeskField'],{'as':_0x6242('0x1c6'),'foreignKey':_0x6242('0x1ca')});db['ZendeskConfiguration']['hasMany'](db[_0x6242('0xbc')],{'as':_0x6242('0x1cf'),'foreignKey':'FieldId'});db['ZendeskConfiguration'][_0x6242('0x12f')](db[_0x6242('0xb8')],{'as':_0x6242('0x177'),'foreignKey':_0x6242('0x1c8')});db[_0x6242('0xba')][_0x6242('0x132')](db[_0x6242('0x8e')],{'through':_0x6242('0x1d2')});db[_0x6242('0xbc')]['hasMany'](db[_0x6242('0xbc')],{'as':_0x6242('0x1c9'),'foreignKey':_0x6242('0x1ce')});db[_0x6242('0xbc')][_0x6242('0x122')](db[_0x6242('0xbc')],{'as':_0x6242('0x1d0'),'foreignKey':_0x6242('0x1ca')});db[_0x6242('0xbc')][_0x6242('0x122')](db[_0x6242('0xbc')],{'as':_0x6242('0x1cb'),'foreignKey':_0x6242('0x1c7')});db[_0x6242('0xbc')][_0x6242('0x12f')](db[_0x6242('0x98')],{'as':_0x6242('0x98'),'foreignKey':'VariableId'});db[_0x6242('0xbd')]['hasMany'](db[_0x6242('0xbf')],{'as':_0x6242('0x1cd'),'onDelete':'cascade','foreignKey':_0x6242('0x1c8')});db[_0x6242('0xbf')][_0x6242('0x122')](db['FreshdeskField'],{'as':_0x6242('0x1c4'),'onDelete':'cascade','foreignKey':_0x6242('0x1ce')});db[_0x6242('0xbf')]['hasMany'](db[_0x6242('0xc1')],{'as':_0x6242('0x1c6'),'onDelete':_0x6242('0x11e'),'foreignKey':'DescriptionId'});db[_0x6242('0xbf')][_0x6242('0x122')](db[_0x6242('0xc1')],{'as':_0x6242('0x1cf'),'onDelete':_0x6242('0x11e'),'foreignKey':_0x6242('0x1c7')});db[_0x6242('0xbf')]['belongsTo'](db[_0x6242('0xbd')],{'as':_0x6242('0x177'),'foreignKey':_0x6242('0x1c8')});db[_0x6242('0xbf')][_0x6242('0x132')](db[_0x6242('0x8e')],{'through':_0x6242('0x1d3')});db[_0x6242('0xc1')][_0x6242('0x122')](db['FreshdeskField'],{'as':_0x6242('0x1c9'),'foreignKey':_0x6242('0x1ce')});db[_0x6242('0xc1')][_0x6242('0x122')](db[_0x6242('0xc1')],{'as':'Description','foreignKey':_0x6242('0x1ca')});db[_0x6242('0xc1')][_0x6242('0x122')](db['FreshdeskField'],{'as':_0x6242('0x1cb'),'foreignKey':'FieldId'});db[_0x6242('0xc1')]['belongsTo'](db['Variable'],{'as':'Variable','foreignKey':'VariableId'});db[_0x6242('0xc2')]['hasMany'](db[_0x6242('0xc4')],{'as':_0x6242('0x1cd'),'onDelete':_0x6242('0x11e'),'foreignKey':_0x6242('0x1c8')});db[_0x6242('0xc4')][_0x6242('0x122')](db[_0x6242('0xc6')],{'as':_0x6242('0x1c4'),'foreignKey':_0x6242('0x1ce')});db[_0x6242('0xc4')][_0x6242('0x122')](db[_0x6242('0xc6')],{'as':_0x6242('0x1c6'),'foreignKey':_0x6242('0x1ca')});db[_0x6242('0xc4')][_0x6242('0x122')](db['VtigerField'],{'as':'Fields','foreignKey':_0x6242('0x1c7')});db[_0x6242('0xc4')][_0x6242('0x12f')](db[_0x6242('0xc2')],{'as':'Account','foreignKey':_0x6242('0x1c8')});db[_0x6242('0xc6')][_0x6242('0x122')](db['VtigerField'],{'as':_0x6242('0x1c9'),'foreignKey':_0x6242('0x1ce')});db[_0x6242('0xc6')][_0x6242('0x122')](db[_0x6242('0xc6')],{'as':_0x6242('0x1d0'),'foreignKey':_0x6242('0x1ca')});db[_0x6242('0xc6')][_0x6242('0x122')](db[_0x6242('0xc6')],{'as':_0x6242('0x1cb'),'foreignKey':_0x6242('0x1c7')});db['VtigerField'][_0x6242('0x12f')](db[_0x6242('0x98')],{'as':_0x6242('0x98'),'foreignKey':_0x6242('0x1cc')});db[_0x6242('0xc8')][_0x6242('0x122')](db[_0x6242('0xca')],{'as':_0x6242('0x1cd'),'onDelete':_0x6242('0x11e'),'foreignKey':_0x6242('0x1c8')});db[_0x6242('0xca')][_0x6242('0x122')](db[_0x6242('0xcc')],{'as':_0x6242('0x1c4'),'foreignKey':'SubjectId'});db['ServicenowConfiguration'][_0x6242('0x122')](db['ServicenowField'],{'as':_0x6242('0x1c6'),'foreignKey':'DescriptionId'});db[_0x6242('0xca')][_0x6242('0x122')](db[_0x6242('0xcc')],{'as':_0x6242('0x1cf'),'foreignKey':_0x6242('0x1c7')});db[_0x6242('0xca')][_0x6242('0x12f')](db[_0x6242('0xc8')],{'as':'Account','foreignKey':_0x6242('0x1c8')});db[_0x6242('0xcc')][_0x6242('0x122')](db['ServicenowField'],{'as':_0x6242('0x1c9'),'foreignKey':'SubjectId'});db[_0x6242('0xcc')][_0x6242('0x122')](db['ServicenowField'],{'as':_0x6242('0x1d0'),'foreignKey':_0x6242('0x1ca')});db['ServicenowField'][_0x6242('0x122')](db['ServicenowField'],{'as':'Field','foreignKey':_0x6242('0x1c7')});db[_0x6242('0xcc')][_0x6242('0x12f')](db[_0x6242('0x98')],{'as':_0x6242('0x98'),'foreignKey':'VariableId'});db[_0x6242('0x1d4')][_0x6242('0x122')](db['Dynamics365Configuration'],{'as':_0x6242('0x1cd'),'onDelete':_0x6242('0x11e'),'foreignKey':_0x6242('0x1c8')});db[_0x6242('0x1d4')][_0x6242('0x12f')](db[_0x6242('0x112')],{'as':_0x6242('0x112'),'foreignKey':_0x6242('0x16a')});db[_0x6242('0xcf')][_0x6242('0x122')](db[_0x6242('0xd1')],{'as':_0x6242('0x1c4'),'onDelete':'cascade','foreignKey':_0x6242('0x1ce')});db['Dynamics365Configuration'][_0x6242('0x122')](db[_0x6242('0xd1')],{'as':_0x6242('0x1c6'),'onDelete':'cascade','foreignKey':'DescriptionId'});db[_0x6242('0xcf')][_0x6242('0x122')](db[_0x6242('0xd1')],{'as':_0x6242('0x1cf'),'onDelete':_0x6242('0x11e'),'foreignKey':_0x6242('0x1c7')});db[_0x6242('0xcf')][_0x6242('0x12f')](db['Dynamics365Account'],{'as':_0x6242('0x177'),'foreignKey':'AccountId'});db[_0x6242('0xd1')][_0x6242('0x122')](db['Dynamics365Field'],{'as':_0x6242('0x1c9'),'foreignKey':_0x6242('0x1ce')});db[_0x6242('0xd1')][_0x6242('0x122')](db[_0x6242('0xd1')],{'as':_0x6242('0x1d0'),'foreignKey':_0x6242('0x1ca')});db[_0x6242('0xd1')][_0x6242('0x122')](db[_0x6242('0xd1')],{'as':_0x6242('0x1cb'),'foreignKey':'FieldId'});db[_0x6242('0xd1')][_0x6242('0x12f')](db['Variable'],{'as':_0x6242('0x98'),'foreignKey':_0x6242('0x1cc')});db[_0x6242('0xd3')]['hasMany'](db[_0x6242('0xd5')],{'as':_0x6242('0x1cd'),'onDelete':'cascade','foreignKey':_0x6242('0x1c8')});db['FreshsalesConfiguration'][_0x6242('0x122')](db[_0x6242('0x1d5')],{'as':_0x6242('0x1c4'),'foreignKey':_0x6242('0x1ce')});db[_0x6242('0xd5')]['hasMany'](db[_0x6242('0x1d5')],{'as':'Descriptions','foreignKey':_0x6242('0x1ca')});db[_0x6242('0xd5')][_0x6242('0x122')](db[_0x6242('0x1d5')],{'as':_0x6242('0x1cf'),'foreignKey':'FieldId'});db[_0x6242('0xd5')][_0x6242('0x12f')](db[_0x6242('0xd3')],{'as':_0x6242('0x177'),'foreignKey':'AccountId'});db[_0x6242('0x1d5')]['hasMany'](db[_0x6242('0x1d5')],{'as':_0x6242('0x1c9'),'foreignKey':_0x6242('0x1ce')});db[_0x6242('0x1d5')][_0x6242('0x122')](db[_0x6242('0x1d5')],{'as':_0x6242('0x1d0'),'foreignKey':_0x6242('0x1ca')});db[_0x6242('0x1d5')][_0x6242('0x122')](db['FreshsalesField'],{'as':_0x6242('0x1cb'),'foreignKey':_0x6242('0x1c7')});db['FreshsalesField'][_0x6242('0x12f')](db[_0x6242('0x98')],{'as':_0x6242('0x98'),'foreignKey':'VariableId'});db[_0x6242('0x1d6')][_0x6242('0x12f')](db[_0x6242('0x5f')],{});db[_0x6242('0x1d6')][_0x6242('0x12f')](db[_0x6242('0x102')],{'as':_0x6242('0x172'),'foreignKey':_0x6242('0x173')});db['ChatQueueReport'][_0x6242('0x12f')](db[_0x6242('0x135')],{'as':_0x6242('0x169'),'foreignKey':_0x6242('0x178')});db[_0x6242('0x1d6')]['belongsTo'](db[_0x6242('0x64')],{});db[_0x6242('0x1d6')][_0x6242('0x12f')](db[_0x6242('0x66')],{});db['ChatQueueReport'][_0x6242('0x12f')](db[_0x6242('0x12')],{});db[_0x6242('0x1d6')]['belongsTo'](db[_0x6242('0x197')],{});db['ChatInternalMessage']['belongsTo'](db['User'],{'onDelete':_0x6242('0x11e'),'foreignKey':_0x6242('0x1d7')});db[_0x6242('0x19e')][_0x6242('0x12f')](db[_0x6242('0x12')],{'onDelete':_0x6242('0x11e'),'foreignKey':_0x6242('0x1d8')});db[_0x6242('0xdf')][_0x6242('0x122')](db['JscriptyQuestionReport'],{'foreignKey':'SessionId','onDelete':_0x6242('0x11e')});db[_0x6242('0xdf')][_0x6242('0x122')](db[_0x6242('0xdc')],{'foreignKey':_0x6242('0x1d9'),'onDelete':'cascade'});db['SmsQueueReport']['belongsTo'](db[_0x6242('0x4f')],{});db['SmsQueueReport'][_0x6242('0x12f')](db[_0x6242('0x102')],{'as':'List','foreignKey':_0x6242('0x173')});db[_0x6242('0x1da')][_0x6242('0x12f')](db[_0x6242('0x135')],{'as':_0x6242('0x169'),'foreignKey':'ContactId'});db[_0x6242('0x1da')]['belongsTo'](db[_0x6242('0x52')],{});db[_0x6242('0x1da')]['belongsTo'](db[_0x6242('0x54')],{});db['SmsQueueReport'][_0x6242('0x12f')](db['User'],{});db[_0x6242('0x1da')][_0x6242('0x12f')](db['SmsQueue'],{});db['JscriptyProject'][_0x6242('0x122')](db['JscriptySessionReport'],{'foreignKey':_0x6242('0x1db')});db[_0x6242('0xe5')][_0x6242('0x122')](db[_0x6242('0x1dc')],{'foreignKey':_0x6242('0x1db')});db[_0x6242('0xe5')][_0x6242('0x122')](db[_0x6242('0xdc')],{'foreignKey':_0x6242('0x1db')});db[_0x6242('0xf0')][_0x6242('0x132')](db[_0x6242('0x12')],{'as':'Agents','through':'user_has_teams'});db[_0x6242('0xf0')][_0x6242('0x132')](db[_0x6242('0x1a')],{'through':_0x6242('0x162'),'as':_0x6242('0x13e')});db[_0x6242('0xf0')][_0x6242('0x132')](db[_0x6242('0x39')],{'through':'team_has_mail_queues','as':_0x6242('0x141')});db[_0x6242('0xf0')][_0x6242('0x132')](db['ChatQueue'],{'through':_0x6242('0x19d'),'as':_0x6242('0x1dd')});db['Team'][_0x6242('0x132')](db['FaxQueue'],{'through':_0x6242('0x1de'),'as':_0x6242('0x143')});db[_0x6242('0xf0')]['belongsToMany'](db['SmsQueue'],{'through':_0x6242('0x1df'),'as':'SmsQueues'});db['Team'][_0x6242('0x132')](db[_0x6242('0x144')],{'through':'team_has_openchannel_queues','as':'OpenchannelQueues'});db[_0x6242('0xf0')][_0x6242('0x132')](db[_0x6242('0x111')],{'through':_0x6242('0x1e0'),'as':_0x6242('0x146')});db['Team'][_0x6242('0x132')](db[_0x6242('0x1e1')],{'through':'TeamVoicePrefix','as':_0x6242('0x140')});db[_0x6242('0xf4')]['hasMany'](db['CmHopper'],{'as':_0x6242('0x156'),'foreignKey':_0x6242('0x1ab')});db[_0x6242('0xf4')][_0x6242('0x122')](db[_0x6242('0x76')],{'as':'HopperFinals','foreignKey':_0x6242('0x1ab')});db[_0x6242('0xf4')][_0x6242('0x122')](db[_0x6242('0x78')],{'as':_0x6242('0x1a5'),'foreignKey':_0x6242('0x1ab')});db['Campaign'][_0x6242('0x122')](db['CmHopperBlack'],{'as':_0x6242('0x158'),'foreignKey':_0x6242('0x1ab')});db[_0x6242('0xf4')]['belongsTo'](db[_0x6242('0x29')],{'as':_0x6242('0x29'),'foreignKey':_0x6242('0x159')});db[_0x6242('0xf4')][_0x6242('0x12f')](db[_0x6242('0x29')],{'as':_0x6242('0x15a'),'foreignKey':'TrunkBackupId'});db[_0x6242('0xf4')][_0x6242('0x12f')](db[_0x6242('0x84')],{'as':'Interval','foreignKey':_0x6242('0x15c')});db[_0x6242('0xf4')]['belongsTo'](db['SquareProject'],{'as':_0x6242('0x1e2'),'foreignKey':_0x6242('0x1e3')});db[_0x6242('0xf4')][_0x6242('0x132')](db[_0x6242('0x102')],{'as':_0x6242('0x138'),'through':_0x6242('0x1e4')});db[_0x6242('0xf4')]['belongsToMany'](db[_0x6242('0x102')],{'as':_0x6242('0x1e5'),'through':_0x6242('0x1e6')});db[_0x6242('0xf7')][_0x6242('0x12f')](db['ChatOfflineMessage'],{'as':_0x6242('0x68'),'foreignKey':'ChatOfflineMessageId'});db['MailTransferReport'][_0x6242('0x12f')](db[_0x6242('0x170')],{});db[_0x6242('0xfb')][_0x6242('0x12f')](db['MailInteraction'],{});db['MailTransferReport'][_0x6242('0x12f')](db[_0x6242('0x38')],{'foreignKey':_0x6242('0x1e7'),'as':_0x6242('0x1e8')});db[_0x6242('0xfb')]['belongsTo'](db[_0x6242('0x12')],{'foreignKey':'FromUserId','as':_0x6242('0x1e9')});db[_0x6242('0xfb')][_0x6242('0x12f')](db[_0x6242('0x12')],{'foreignKey':_0x6242('0x1ea'),'as':_0x6242('0x1eb')});db[_0x6242('0xfb')][_0x6242('0x12f')](db[_0x6242('0x39')],{'foreignKey':_0x6242('0x1ec'),'as':_0x6242('0x1ed')});db[_0x6242('0xfb')][_0x6242('0x12f')](db['MailAccount'],{'foreignKey':'ToMailAccountId','as':'ToAccount'});db['ChatTransferReport'][_0x6242('0x12f')](db['ChatMessage'],{});db[_0x6242('0xfd')]['belongsTo'](db[_0x6242('0x64')],{});db[_0x6242('0xfd')][_0x6242('0x12f')](db[_0x6242('0x5f')],{'foreignKey':_0x6242('0x1ee'),'as':_0x6242('0x1e8')});db[_0x6242('0xfd')][_0x6242('0x12f')](db[_0x6242('0x12')],{'foreignKey':_0x6242('0x1ef'),'as':_0x6242('0x1e9')});db[_0x6242('0xfd')]['belongsTo'](db[_0x6242('0x12')],{'foreignKey':_0x6242('0x1ea'),'as':_0x6242('0x1eb')});db[_0x6242('0xfd')][_0x6242('0x12f')](db[_0x6242('0x197')],{'foreignKey':'ToChatQueueId','as':_0x6242('0x1ed')});db[_0x6242('0xfd')]['belongsTo'](db[_0x6242('0x5f')],{'foreignKey':_0x6242('0x1f0'),'as':'ToAccount'});db['FaxTransferReport'][_0x6242('0x12f')](db[_0x6242('0x49')],{});db[_0x6242('0xff')][_0x6242('0x12f')](db[_0x6242('0x47')],{});db[_0x6242('0xff')][_0x6242('0x12f')](db[_0x6242('0x44')],{'foreignKey':'FromFaxAccountId','as':_0x6242('0x1e8')});db[_0x6242('0xff')][_0x6242('0x12f')](db[_0x6242('0x12')],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0x6242('0xff')][_0x6242('0x12f')](db[_0x6242('0x12')],{'foreignKey':_0x6242('0x1ea'),'as':_0x6242('0x1eb')});db['FaxTransferReport'][_0x6242('0x12f')](db[_0x6242('0x4b')],{'foreignKey':_0x6242('0x1f1'),'as':_0x6242('0x1ed')});db[_0x6242('0xff')][_0x6242('0x12f')](db[_0x6242('0x44')],{'foreignKey':_0x6242('0x1f2'),'as':_0x6242('0x1f3')});db[_0x6242('0x100')]['belongsTo'](db['OpenchannelMessage'],{});db[_0x6242('0x100')]['belongsTo'](db[_0x6242('0x126')],{});db['OpenchannelTransferReport'][_0x6242('0x12f')](db[_0x6242('0x57')],{'foreignKey':'FromOpenchannelAccountId','as':_0x6242('0x1e8')});db[_0x6242('0x100')][_0x6242('0x12f')](db[_0x6242('0x12')],{'foreignKey':_0x6242('0x1ef'),'as':_0x6242('0x1e9')});db[_0x6242('0x100')][_0x6242('0x12f')](db['User'],{'foreignKey':'ToUserId','as':_0x6242('0x1eb')});db[_0x6242('0x100')][_0x6242('0x12f')](db[_0x6242('0x144')],{'foreignKey':_0x6242('0x1f4'),'as':_0x6242('0x1ed')});db[_0x6242('0x100')][_0x6242('0x12f')](db[_0x6242('0x57')],{'foreignKey':'ToOpenchannelAccountId','as':_0x6242('0x1f3')});db['SmsTransferReport'][_0x6242('0x12f')](db[_0x6242('0x54')],{});db[_0x6242('0x1f5')][_0x6242('0x12f')](db[_0x6242('0x52')],{});db[_0x6242('0x1f5')][_0x6242('0x12f')](db[_0x6242('0x4f')],{'foreignKey':_0x6242('0x1f6'),'as':'FromAccount'});db[_0x6242('0x1f5')][_0x6242('0x12f')](db['User'],{'foreignKey':_0x6242('0x1ef'),'as':'FromAgent'});db['SmsTransferReport'][_0x6242('0x12f')](db[_0x6242('0x12')],{'foreignKey':_0x6242('0x1ea'),'as':_0x6242('0x1eb')});db[_0x6242('0x1f5')][_0x6242('0x12f')](db[_0x6242('0x56')],{'foreignKey':_0x6242('0x1f7'),'as':_0x6242('0x1ed')});db['SmsTransferReport'][_0x6242('0x12f')](db[_0x6242('0x4f')],{'foreignKey':'ToSmsAccountId','as':_0x6242('0x1f3')});db[_0x6242('0x102')]['hasMany'](db['Disposition'],{'as':_0x6242('0x182'),'foreignKey':'ListId','onDelete':_0x6242('0x11e')});db[_0x6242('0x102')][_0x6242('0x122')](db[_0x6242('0x7c')],{'as':_0x6242('0x1f8'),'foreignKey':_0x6242('0x173')});db['CmList'][_0x6242('0x122')](db[_0x6242('0x135')],{'as':'Contacts','onDelete':_0x6242('0x11e'),'foreignKey':'ListId'});db[_0x6242('0x102')][_0x6242('0x122')](db[_0x6242('0x76')],{'as':_0x6242('0x124'),'foreignKey':_0x6242('0x173')});db['CmList'][_0x6242('0x122')](db[_0x6242('0x78')],{'as':'HopperHistory','foreignKey':'ListId'});db[_0x6242('0x102')][_0x6242('0x122')](db[_0x6242('0x7a')],{'as':_0x6242('0x7a'),'foreignKey':_0x6242('0x173')});db[_0x6242('0x102')][_0x6242('0x132')](db['VoiceQueue'],{'as':'Queues','through':_0x6242('0x15f')});db[_0x6242('0x102')][_0x6242('0x132')](db[_0x6242('0x12')],{'as':_0x6242('0x160'),'through':_0x6242('0x147')});db['VoicePrefix'][_0x6242('0x122')](db[_0x6242('0x16')],{'as':_0x6242('0x123'),'onDelete':_0x6242('0x11e')});db[_0x6242('0x1e1')][_0x6242('0x132')](db['User'],{'as':_0x6242('0x160'),'through':'UserVoicePrefix'});db[_0x6242('0x1e1')][_0x6242('0x132')](db[_0x6242('0xf0')],{'through':_0x6242('0x114'),'as':'Teams'});db['UserProfile'][_0x6242('0x122')](db[_0x6242('0x12')],{'as':_0x6242('0x185'),'foreignKey':_0x6242('0x131')});db[_0x6242('0x130')][_0x6242('0x122')](db[_0x6242('0x1f9')],{'as':_0x6242('0x1fa'),'foreignKey':_0x6242('0x131'),'onDelete':_0x6242('0x11e')});db[_0x6242('0x1f9')][_0x6242('0x122')](db[_0x6242('0x105')],{'as':'Resources','foreignKey':_0x6242('0x1fb'),'onDelete':_0x6242('0x11e')});db[_0x6242('0x1fc')][_0x6242('0x122')](db[_0x6242('0x82')],{'as':_0x6242('0x182'),'foreignKey':_0x6242('0x1fd'),'onDelete':_0x6242('0x11e')});db[_0x6242('0x1fc')][_0x6242('0x122')](db['CannedAnswer'],{'as':_0x6242('0x16f'),'foreignKey':_0x6242('0x1fd')});db[_0x6242('0x1fc')][_0x6242('0x122')](db['WhatsappMessage'],{'as':_0x6242('0x163'),'foreignKey':_0x6242('0x1fd')});db['WhatsappAccount'][_0x6242('0x122')](db[_0x6242('0x10b')],{'as':_0x6242('0x171')});db[_0x6242('0x1fc')]['hasMany'](db[_0x6242('0x109')],{'as':'Applications','foreignKey':'WhatsappAccountId','onDelete':'cascade'});db['WhatsappAccount']['belongsTo'](db['CmList'],{'as':_0x6242('0x172'),'foreignKey':_0x6242('0x173')});db[_0x6242('0x1fc')][_0x6242('0x12f')](db[_0x6242('0x86')],{'as':_0x6242('0x15d'),'foreignKey':_0x6242('0x15e')});db[_0x6242('0x1fc')][_0x6242('0x132')](db[_0x6242('0x12')],{'as':_0x6242('0x160'),'through':'user_has_whatsapp_accounts'});db[_0x6242('0x109')][_0x6242('0x12f')](db['User'],{'onDelete':_0x6242('0x16d')});db[_0x6242('0x109')]['belongsTo'](db[_0x6242('0x111')],{'onDelete':_0x6242('0x16d')});db[_0x6242('0x109')][_0x6242('0x12f')](db[_0x6242('0x1fc')],{'onDelete':_0x6242('0x16d')});db[_0x6242('0x109')][_0x6242('0x12f')](db[_0x6242('0x84')],{'onDelete':_0x6242('0x16d'),'foreignKey':'IntervalId'});db[_0x6242('0x109')][_0x6242('0x12f')](db['Tag'],{'onDelete':_0x6242('0x16d'),'foreignKey':'TagId'});db[_0x6242('0x10b')][_0x6242('0x122')](db[_0x6242('0x10d')],{'as':'Messages','onDelete':'cascade','foreignKey':'WhatsappInteractionId'});db[_0x6242('0x10b')]['belongsTo'](db[_0x6242('0x1fc')],{'as':_0x6242('0x177'),'foreignKey':_0x6242('0x1fd')});db['WhatsappInteraction']['belongsTo'](db['CmContact'],{'as':'Contact','foreignKey':_0x6242('0x178')});db[_0x6242('0x10b')]['belongsTo'](db[_0x6242('0x12')],{'as':_0x6242('0x179'),'foreignKey':'UserId'});db[_0x6242('0x10b')][_0x6242('0x132')](db[_0x6242('0x8e')],{'through':_0x6242('0x1b7'),'as':_0x6242('0x17b')});db['WhatsappInteraction'][_0x6242('0x132')](db[_0x6242('0x8e')],{'through':'whatsapp_interaction_has_tags','as':_0x6242('0x17c')});db[_0x6242('0x10b')]['belongsToMany'](db[_0x6242('0x12')],{'as':_0x6242('0x185'),'through':_0x6242('0x1fe'),'foreignKey':_0x6242('0x1ff')});db[_0x6242('0x10d')][_0x6242('0x12f')](db[_0x6242('0x12')],{'as':'User'});db['WhatsappMessage'][_0x6242('0x12f')](db[_0x6242('0x135')],{'onDelete':_0x6242('0x11e'),'as':'Contact'});db[_0x6242('0x10d')]['belongsTo'](db[_0x6242('0x10b')],{'onDelete':_0x6242('0x11e'),'as':_0x6242('0x17d'),'foreignKey':_0x6242('0x1ff')});db[_0x6242('0x10d')][_0x6242('0x12f')](db['WhatsappAccount'],{'as':'Account','foreignKey':_0x6242('0x1fd')});db['WhatsappQueueReport'][_0x6242('0x12f')](db[_0x6242('0x1fc')],{});db['WhatsappQueueReport']['belongsTo'](db['CmList'],{'as':'List','foreignKey':_0x6242('0x173')});db['WhatsappQueueReport'][_0x6242('0x12f')](db[_0x6242('0x135')],{'as':_0x6242('0x169'),'foreignKey':'ContactId'});db['WhatsappQueueReport'][_0x6242('0x12f')](db[_0x6242('0x10b')],{});db['WhatsappQueueReport']['belongsTo'](db['WhatsappQueue'],{});db[_0x6242('0x200')][_0x6242('0x12f')](db[_0x6242('0x10d')],{});db[_0x6242('0x200')]['belongsTo'](db[_0x6242('0x12')],{});db[_0x6242('0x10f')]['belongsTo'](db[_0x6242('0x10d')],{});db[_0x6242('0x10f')][_0x6242('0x12f')](db[_0x6242('0x10b')],{});db['WhatsappTransferReport'][_0x6242('0x12f')](db[_0x6242('0x1fc')],{'foreignKey':_0x6242('0x201'),'as':_0x6242('0x1e8')});db[_0x6242('0x10f')][_0x6242('0x12f')](db[_0x6242('0x1fc')],{'foreignKey':_0x6242('0x202'),'as':'ToAccount'});db[_0x6242('0x10f')][_0x6242('0x12f')](db[_0x6242('0x111')],{'foreignKey':'ToQueueId','as':_0x6242('0x1ed')});db[_0x6242('0x10f')]['belongsTo'](db[_0x6242('0x12')],{'foreignKey':'FromUserId','as':_0x6242('0x1e9')});db[_0x6242('0x10f')][_0x6242('0x12f')](db['User'],{'foreignKey':_0x6242('0x1ea'),'as':_0x6242('0x1eb')});db[_0x6242('0x111')]['belongsToMany'](db['User'],{'as':'Agents','through':'UserWhatsappQueue','foreignKey':_0x6242('0x203')});db[_0x6242('0x111')]['belongsToMany'](db[_0x6242('0xf0')],{'through':_0x6242('0x1e0'),'as':_0x6242('0x161')});db['UserSetting'][_0x6242('0x12f')](db[_0x6242('0x12')],{'as':'user','foreignKey':'UserId','onDelete':_0x6242('0x11e'),'hooks':!![]});db[_0x6242('0x112')]['hasOne'](db['Dynamics365Account'],{'as':'Dynamics365Account','onDelete':_0x6242('0x16d')});db['CloudProvider']['hasOne'](db['MailServerIn'],{'as':_0x6242('0x16e'),'onDelete':_0x6242('0x16d')});db[_0x6242('0x112')][_0x6242('0x11b')](db[_0x6242('0x16b')],{'as':_0x6242('0x204'),'onDelete':_0x6242('0x16d')});module[_0x6242('0x205')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xf3ad=['Teams','BlackLists','ScreenRecording','Messages','mailboxuser','mailbox','AgentReports','uniqueid','Contact','ContactId','MailAccountId','MailServerOut','CloudProviderId','restrict','Smtp','Dispositions','CannedAnswer','Interactions','List','ListId','Agents','team_has_mail_queues','MailInteractionId','Account','Owner','mail_interaction_has_tags','Tags','Tag','Users','Attachment','Attachments','Interaction','ChatWebsiteId','Items','Disposition','FaxAccountId','Answers','FaxApplication','Exntensions','user_has_fax_accounts','TagId','fax_interaction_has_tags','ThroughTags','FaxInteractionId','AttachmentId','team_has_fax_queues','FaxQueueReport','SmsAccountId','SmsMessage','SmsApplication','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelMessage','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','user_has_openchannel_interactions','team_has_openchannel_queues','Agent','ChatApplication','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','ChatOfflineMessageId','team_has_chat_queues','ChatInternalMessage','Members','CompanyId','CmContactHasItem','Phones','CmContactId','JscriptySessions','cm_contact_has_tags','CmHopperAdditionalPhone','AdditionalPhones','CmHopperId','OwnerId','CampaignId','Condition','OneAll','AutomationAllId','Any','OneAny','AutomationAnyId','Actions','AutomationId','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','CustomReportId','Mohs','moh_has_sounds','whatsapp_interaction_has_tags','ContactItemType','ItemType','Hopper','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','TriggerId','Fields','DefaultReportId','MetricId','SalesforceAccount','Configurations','AccountId','SalesforceConfiguration','Subjects','Subject','SubjectId','Description','DescriptionId','FieldId','VariableId','Descriptions','Field','DeskConfiguration','DeskField','int_zendesk_configuration_has_tags','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','ServicenowField','FromId','ToId','JscriptyAnswerReport','SessionId','SmsQueueReport','ProjectId','JscriptyProject','user_has_teams','team_has_whatsapp_queues','WhatsappQueues','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','FromChatWebsiteId','ToChatQueueId','ToQueue','ToChatWebsiteId','ToAccount','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','Queues','voice_queues_has_cm_lists','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappQueue','WhatsappInteractionId','WhatsappQueueReport','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','user','Imap','sequelize','lodash','jstz','defaultsDeep','motion2','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','password','database','username','options','import','../api/user/user.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','MailServerIn','../api/mailServerOut/mailServerOut.model','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxInteraction','FaxMessage','FaxQueue','../api/faxQueue/faxQueue.model','SmsAccount','../api/smsApplication/smsApplication.model','SmsInteraction','SmsQueue','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','../api/reportAgentPreview/reportAgentPreview.model','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','Sound','../api/sound/sound.model','../api/tag/tag.model','../api/contactItemType/contactItemType.model','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','Integration','../api/integration/integration.model','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','../api/intSalesforceAccount/intSalesforceAccount.model','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskConfiguration/intDeskConfiguration.model','../api/intDeskField/intDeskField.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskField','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','../api/chatInternalMessage/chatInternalMessage.model','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','SquareDetailsReport','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','../api/attachment/attachment.model','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/voicePrefix/voicePrefix.model','UserProfile','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','WhatsappAccount','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','../api/whatsappQueueReport/whatsappQueueReport.model','../api/whatsappTransferReport/whatsappTransferReport.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','../api/user-setting/user-setting.model','MailInteractionHasTag','../api/mailInteractionHasTag/mailInteractionHasTag.model','User','hasOne','VoiceMail','cascade','UserId','UserSetting','userSetting','hasMany','VoiceQueuesRt','Extensions','HopperFinals','HopperHistory','ReportAgentPreview','OpenchannelInteractions','ChatInteraction','SmsInteractions','FaxInteractions','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','Hoppers','SET\x20NULL','belongsTo','userProfileId','belongsToMany','Groups','chat_group_has_users','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','user_has_whatsapp_interactions','VoiceQueues','UserVoiceQueue','VoicePrefix','VoicePrefixes','MailQueues','UserMailQueue','ChatQueues','FaxQueues','SmsQueues','OpenchannelQueues','ChatWebsites','user_has_chat_websites','FaxAccounts','MailAccount','MailAccounts','user_has_mail_accounts','OpenchannelAccount','OpenchannelAccounts','user_has_openchannel_accounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SpiedAgents','ChanSpyId','Applications','VoiceMusicOnHold','Sounds','VoiceQueueId','HopperHistories','HopperBlacks','TrunkId','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId'];(function(_0x3bca15,_0x2aa0fe){var _0x1377df=function(_0x52afce){while(--_0x52afce){_0x3bca15['push'](_0x3bca15['shift']());}};_0x1377df(++_0x2aa0fe);}(_0xf3ad,0xb6));var _0xdf3a=function(_0x2ded0b,_0x5b9f27){_0x2ded0b=_0x2ded0b-0x0;var _0x46ec76=_0xf3ad[_0x2ded0b];return _0x46ec76;};'use strict';var config=require('../config/environment');var Sequelize=require(_0xdf3a('0x0'));var _=require(_0xdf3a('0x1'));var jstz=require(_0xdf3a('0x2'));var timezone=jstz['determine']();config[_0xdf3a('0x0')]=_[_0xdf3a('0x3')](config[_0xdf3a('0x0')],{'database':_0xdf3a('0x4'),'username':_0xdf3a('0x5'),'password':_0xdf3a('0x6'),'options':{'host':_0xdf3a('0x7'),'port':0xcea,'dialect':_0xdf3a('0x8'),'dialectOptions':{'charset':_0xdf3a('0x9')},'logging':![],'timezone':timezone[_0xdf3a('0xa')](),'define':{'charset':_0xdf3a('0xb'),'collate':_0xdf3a('0xc')}}});config[_0xdf3a('0xd')]=_[_0xdf3a('0x3')](config[_0xdf3a('0xd')],{'database':_0xdf3a('0x4'),'username':_0xdf3a('0x5'),'password':_0xdf3a('0x6'),'options':{'host':_0xdf3a('0x7'),'port':0xcea,'dialect':_0xdf3a('0x8'),'dialectOptions':{'charset':_0xdf3a('0x9')},'logging':![],'timezone':timezone[_0xdf3a('0xa')](),'define':{'charset':_0xdf3a('0xb'),'collate':_0xdf3a('0xc')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xdf3a('0x0')]['database'],config[_0xdf3a('0x0')]['username'],config[_0xdf3a('0x0')][_0xdf3a('0xe')],config[_0xdf3a('0x0')]['options'])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xdf3a('0xd')][_0xdf3a('0xf')],config['sequelizeHistory'][_0xdf3a('0x10')],config['sequelizeHistory'][_0xdf3a('0xe')],config[_0xdf3a('0xd')][_0xdf3a('0x11')])};db['User']=db['sequelize'][_0xdf3a('0x12')](_0xdf3a('0x13'));db['VoiceChanSpy']=db[_0xdf3a('0x0')][_0xdf3a('0x12')]('../api/voiceChanSpy/voiceChanSpy.model');db[_0xdf3a('0x14')]=db[_0xdf3a('0x0')][_0xdf3a('0x12')](_0xdf3a('0x15'));db[_0xdf3a('0x16')]=db['sequelize'][_0xdf3a('0x12')](_0xdf3a('0x17'));db['VoiceMusicOnHold']=db[_0xdf3a('0x0')][_0xdf3a('0x12')](_0xdf3a('0x18'));db[_0xdf3a('0x19')]=db[_0xdf3a('0x0')][_0xdf3a('0x12')](_0xdf3a('0x1a'));db[_0xdf3a('0x1b')]=db['sequelize'][_0xdf3a('0x12')](_0xdf3a('0x1c'));db['ScreenRecording']=db[_0xdf3a('0x0')][_0xdf3a('0x12')]('../api/screenRecording/screenRecording.model');db['VoiceMail']=db[_0xdf3a('0x0')]['import'](_0xdf3a('0x1d'));db[_0xdf3a('0x1e')]=db[_0xdf3a('0x0')][_0xdf3a('0x12')](_0xdf3a('0x1f'));db[_0xdf3a('0x20')]=db[_0xdf3a('0x0')]['import'](_0xdf3a('0x21'));db['VoiceDialReport']=db['sequelize'][_0xdf3a('0x12')]('../api/voiceDialReport/voiceDialReport.model');db[_0xdf3a('0x22')]=db[_0xdf3a('0x0')][_0xdf3a('0x12')](_0xdf3a('0x23'));db[_0xdf3a('0x24')]=db['sequelize'][_0xdf3a('0x12')](_0xdf3a('0x25'));db[_0xdf3a('0x26')]=db[_0xdf3a('0x0')][_0xdf3a('0x12')](_0xdf3a('0x27'));db[_0xdf3a('0x28')]=db[_0xdf3a('0x0')][_0xdf3a('0x12')](_0xdf3a('0x29'));db['VoiceTransferReport']=db[_0xdf3a('0x0')][_0xdf3a('0x12')](_0xdf3a('0x2a'));db[_0xdf3a('0x2b')]=db['sequelize'][_0xdf3a('0x12')](_0xdf3a('0x2c'));db['UserVoiceQueue']=db[_0xdf3a('0x0')]['import'](_0xdf3a('0x2d'));db[_0xdf3a('0x2e')]=db[_0xdf3a('0x0')][_0xdf3a('0x12')](_0xdf3a('0x2f'));db['UserMailQueue']=db[_0xdf3a('0x0')][_0xdf3a('0x12')]('../api/userMailQueue/userMailQueue.model');db[_0xdf3a('0x30')]=db[_0xdf3a('0x0')][_0xdf3a('0x12')](_0xdf3a('0x31'));db[_0xdf3a('0x32')]=db[_0xdf3a('0x0')][_0xdf3a('0x12')]('../api/userSmsQueue/userSmsQueue.model');db[_0xdf3a('0x33')]=db['sequelize'][_0xdf3a('0x12')](_0xdf3a('0x34'));db[_0xdf3a('0x35')]=db['sequelize'][_0xdf3a('0x12')]('../api/userWhatsappQueue/userWhatsappQueue.model');db[_0xdf3a('0x36')]=db[_0xdf3a('0x0')][_0xdf3a('0x12')]('../api/mailServerIn/mailServerIn.model');db['MailServerOut']=db[_0xdf3a('0x0')][_0xdf3a('0x12')](_0xdf3a('0x37'));db['MailAccount']=db[_0xdf3a('0x0')][_0xdf3a('0x12')](_0xdf3a('0x38'));db[_0xdf3a('0x39')]=db[_0xdf3a('0x0')]['import'](_0xdf3a('0x3a'));db[_0xdf3a('0x3b')]=db[_0xdf3a('0x0')][_0xdf3a('0x12')]('../api/mailSubstatus/mailSubstatus.model');db[_0xdf3a('0x3c')]=db['sequelize'][_0xdf3a('0x12')](_0xdf3a('0x3d'));db[_0xdf3a('0x3e')]=db[_0xdf3a('0x0')][_0xdf3a('0x12')]('../api/mailMessage/mailMessage.model');db[_0xdf3a('0x3f')]=db[_0xdf3a('0x0')]['import'](_0xdf3a('0x40'));db[_0xdf3a('0x41')]=db['sequelize'][_0xdf3a('0x12')]('../api/mailQueueReport/mailQueueReport.model');db[_0xdf3a('0x42')]=db[_0xdf3a('0x0')]['import'](_0xdf3a('0x43'));db[_0xdf3a('0x44')]=db[_0xdf3a('0x0')][_0xdf3a('0x12')](_0xdf3a('0x45'));db[_0xdf3a('0x46')]=db['sequelize']['import'](_0xdf3a('0x47'));db['FaxApplication']=db[_0xdf3a('0x0')][_0xdf3a('0x12')]('../api/faxApplication/faxApplication.model');db[_0xdf3a('0x48')]=db[_0xdf3a('0x0')][_0xdf3a('0x12')]('../api/faxInteraction/faxInteraction.model');db[_0xdf3a('0x49')]=db[_0xdf3a('0x0')]['import']('../api/faxMessage/faxMessage.model');db[_0xdf3a('0x4a')]=db[_0xdf3a('0x0')][_0xdf3a('0x12')](_0xdf3a('0x4b'));db['FaxQueueReport']=db[_0xdf3a('0x0')]['import']('../api/faxQueueReport/faxQueueReport.model');db[_0xdf3a('0x4c')]=db[_0xdf3a('0x0')][_0xdf3a('0x12')]('../api/smsAccount/smsAccount.model');db['SmsApplication']=db[_0xdf3a('0x0')][_0xdf3a('0x12')](_0xdf3a('0x4d'));db[_0xdf3a('0x4e')]=db[_0xdf3a('0x0')][_0xdf3a('0x12')]('../api/smsInteraction/smsInteraction.model');db['SmsMessage']=db[_0xdf3a('0x0')][_0xdf3a('0x12')]('../api/smsMessage/smsMessage.model');db[_0xdf3a('0x4f')]=db[_0xdf3a('0x0')][_0xdf3a('0x12')]('../api/smsQueue/smsQueue.model');db['OpenchannelAccount']=db['sequelize']['import'](_0xdf3a('0x50'));db[_0xdf3a('0x51')]=db['sequelize'][_0xdf3a('0x12')](_0xdf3a('0x52'));db[_0xdf3a('0x53')]=db[_0xdf3a('0x0')][_0xdf3a('0x12')](_0xdf3a('0x54'));db['OpenchannelMessage']=db[_0xdf3a('0x0')][_0xdf3a('0x12')]('../api/openchannelMessage/openchannelMessage.model');db[_0xdf3a('0x55')]=db[_0xdf3a('0x0')][_0xdf3a('0x12')](_0xdf3a('0x56'));db[_0xdf3a('0x57')]=db[_0xdf3a('0x0')]['import'](_0xdf3a('0x58'));db[_0xdf3a('0x59')]=db[_0xdf3a('0x0')][_0xdf3a('0x12')](_0xdf3a('0x5a'));db['ChatApplication']=db['sequelize'][_0xdf3a('0x12')]('../api/chatApplication/chatApplication.model');db['ChatInteraction']=db['sequelize'][_0xdf3a('0x12')]('../api/chatInteraction/chatInteraction.model');db[_0xdf3a('0x5b')]=db[_0xdf3a('0x0')]['import'](_0xdf3a('0x5c'));db[_0xdf3a('0x5d')]=db[_0xdf3a('0x0')][_0xdf3a('0x12')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0xdf3a('0x5e')]=db[_0xdf3a('0x0')]['import'](_0xdf3a('0x5f'));db[_0xdf3a('0x60')]=db[_0xdf3a('0x0')][_0xdf3a('0x12')](_0xdf3a('0x61'));db[_0xdf3a('0x62')]=db[_0xdf3a('0x0')][_0xdf3a('0x12')](_0xdf3a('0x63'));db[_0xdf3a('0x64')]=db[_0xdf3a('0x0')]['import']('../api/cmCompany/cmCompany.model');db[_0xdf3a('0x65')]=db['sequelize']['import'](_0xdf3a('0x66'));db[_0xdf3a('0x67')]=db['sequelize'][_0xdf3a('0x12')](_0xdf3a('0x68'));db[_0xdf3a('0x69')]=db[_0xdf3a('0x0')][_0xdf3a('0x12')](_0xdf3a('0x6a'));db[_0xdf3a('0x6b')]=db[_0xdf3a('0x0')][_0xdf3a('0x12')](_0xdf3a('0x6c'));db[_0xdf3a('0x6d')]=db['sequelize'][_0xdf3a('0x12')](_0xdf3a('0x6e'));db['ReportAgentPreview']=db[_0xdf3a('0x0')]['import'](_0xdf3a('0x6f'));db['CmCustomField']=db['sequelize'][_0xdf3a('0x12')](_0xdf3a('0x70'));db[_0xdf3a('0x71')]=db[_0xdf3a('0x0')][_0xdf3a('0x12')](_0xdf3a('0x72'));db[_0xdf3a('0x73')]=db[_0xdf3a('0x0')]['import'](_0xdf3a('0x74'));db['CannedAnswer']=db[_0xdf3a('0x0')][_0xdf3a('0x12')](_0xdf3a('0x75'));db['Disposition']=db[_0xdf3a('0x0')]['import'](_0xdf3a('0x76'));db['Condition']=db[_0xdf3a('0x0')][_0xdf3a('0x12')]('../api/condition/condition.model');db[_0xdf3a('0x77')]=db[_0xdf3a('0x0')][_0xdf3a('0x12')](_0xdf3a('0x78'));db[_0xdf3a('0x79')]=db[_0xdf3a('0x0')][_0xdf3a('0x12')](_0xdf3a('0x7a'));db[_0xdf3a('0x7b')]=db[_0xdf3a('0x0')][_0xdf3a('0x12')](_0xdf3a('0x7c'));db[_0xdf3a('0x7d')]=db[_0xdf3a('0x0')]['import'](_0xdf3a('0x7e'));db[_0xdf3a('0x7f')]=db[_0xdf3a('0x0')]['import']('../api/schedule/schedule.model');db[_0xdf3a('0x80')]=db[_0xdf3a('0x0')][_0xdf3a('0x12')](_0xdf3a('0x81'));db['Tag']=db[_0xdf3a('0x0')][_0xdf3a('0x12')](_0xdf3a('0x82'));db['ContactItemType']=db[_0xdf3a('0x0')][_0xdf3a('0x12')](_0xdf3a('0x83'));db['CmContactHasItem']=db[_0xdf3a('0x0')][_0xdf3a('0x12')]('../api/cmContactHasItem/cmContactHasItem.model');db['CmHopperAdditionalPhone']=db['sequelize'][_0xdf3a('0x12')]('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model');db[_0xdf3a('0x84')]=db[_0xdf3a('0x0')][_0xdf3a('0x12')](_0xdf3a('0x85'));db[_0xdf3a('0x86')]=db[_0xdf3a('0x0')][_0xdf3a('0x12')](_0xdf3a('0x87'));db[_0xdf3a('0x88')]=db[_0xdf3a('0x0')][_0xdf3a('0x12')]('../api/variable/variable.model');db[_0xdf3a('0x89')]=db['sequelize'][_0xdf3a('0x12')](_0xdf3a('0x8a'));db['IntegrationReport']=db['sequelize'][_0xdf3a('0x12')](_0xdf3a('0x8b'));db[_0xdf3a('0x8c')]=db['sequelize'][_0xdf3a('0x12')](_0xdf3a('0x8d'));db[_0xdf3a('0x8e')]=db[_0xdf3a('0x0')][_0xdf3a('0x12')](_0xdf3a('0x8f'));db[_0xdf3a('0x90')]=db[_0xdf3a('0x0')][_0xdf3a('0x12')](_0xdf3a('0x91'));db[_0xdf3a('0x92')]=db['sequelize'][_0xdf3a('0x12')](_0xdf3a('0x93'));db[_0xdf3a('0x94')]=db[_0xdf3a('0x0')][_0xdf3a('0x12')](_0xdf3a('0x95'));db[_0xdf3a('0x96')]=db[_0xdf3a('0x0')][_0xdf3a('0x12')](_0xdf3a('0x97'));db['SalesforceAccount']=db[_0xdf3a('0x0')]['import'](_0xdf3a('0x98'));db['SalesforceConfiguration']=db[_0xdf3a('0x0')][_0xdf3a('0x12')](_0xdf3a('0x99'));db[_0xdf3a('0x9a')]=db[_0xdf3a('0x0')]['import'](_0xdf3a('0x9b'));db[_0xdf3a('0x9c')]=db['sequelize'][_0xdf3a('0x12')](_0xdf3a('0x9d'));db[_0xdf3a('0x9e')]=db['sequelize'][_0xdf3a('0x12')]('../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model');db[_0xdf3a('0x9f')]=db[_0xdf3a('0x0')][_0xdf3a('0x12')](_0xdf3a('0xa0'));db[_0xdf3a('0xa1')]=db[_0xdf3a('0x0')]['import']('../api/intDeskAccount/intDeskAccount.model');db['DeskConfiguration']=db['sequelize'][_0xdf3a('0x12')](_0xdf3a('0xa2'));db['DeskField']=db[_0xdf3a('0x0')][_0xdf3a('0x12')](_0xdf3a('0xa3'));db['ZohoAccount']=db[_0xdf3a('0x0')][_0xdf3a('0x12')]('../api/intZohoAccount/intZohoAccount.model');db[_0xdf3a('0xa4')]=db['sequelize']['import'](_0xdf3a('0xa5'));db[_0xdf3a('0xa6')]=db['sequelize'][_0xdf3a('0x12')](_0xdf3a('0xa7'));db[_0xdf3a('0xa8')]=db['sequelize'][_0xdf3a('0x12')]('../api/intZendeskAccount/intZendeskAccount.model');db[_0xdf3a('0xa9')]=db[_0xdf3a('0x0')][_0xdf3a('0x12')](_0xdf3a('0xaa'));db[_0xdf3a('0xab')]=db[_0xdf3a('0x0')][_0xdf3a('0x12')]('../api/intZendeskField/intZendeskField.model');db[_0xdf3a('0xac')]=db[_0xdf3a('0x0')][_0xdf3a('0x12')](_0xdf3a('0xad'));db['FreshdeskConfiguration']=db[_0xdf3a('0x0')]['import']('../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model');db[_0xdf3a('0xae')]=db['sequelize'][_0xdf3a('0x12')]('../api/intFreshdeskField/intFreshdeskField.model');db[_0xdf3a('0xaf')]=db[_0xdf3a('0x0')][_0xdf3a('0x12')](_0xdf3a('0xb0'));db[_0xdf3a('0xb1')]=db[_0xdf3a('0x0')][_0xdf3a('0x12')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0xdf3a('0xb2')]=db[_0xdf3a('0x0')]['import'](_0xdf3a('0xb3'));db[_0xdf3a('0xb4')]=db[_0xdf3a('0x0')][_0xdf3a('0x12')](_0xdf3a('0xb5'));db[_0xdf3a('0xb6')]=db[_0xdf3a('0x0')][_0xdf3a('0x12')]('../api/intServicenowConfiguration/intServicenowConfiguration.model');db['ServicenowField']=db[_0xdf3a('0x0')][_0xdf3a('0x12')]('../api/intServicenowField/intServicenowField.model');db[_0xdf3a('0xb7')]=db[_0xdf3a('0x0')][_0xdf3a('0x12')](_0xdf3a('0xb8'));db[_0xdf3a('0xb9')]=db[_0xdf3a('0x0')][_0xdf3a('0x12')]('../api/intDynamics365Configuration/intDynamics365Configuration.model');db[_0xdf3a('0xba')]=db['sequelize'][_0xdf3a('0x12')](_0xdf3a('0xbb'));db[_0xdf3a('0xbc')]=db['sequelize']['import'](_0xdf3a('0xbd'));db[_0xdf3a('0xbe')]=db[_0xdf3a('0x0')]['import'](_0xdf3a('0xbf'));db[_0xdf3a('0xc0')]=db[_0xdf3a('0x0')][_0xdf3a('0x12')](_0xdf3a('0xc1'));db[_0xdf3a('0x89')]=db[_0xdf3a('0x0')][_0xdf3a('0x12')](_0xdf3a('0x8a'));db[_0xdf3a('0xc2')]=db['sequelize']['import'](_0xdf3a('0xc3'));db[_0xdf3a('0xc4')]=db['sequelize'][_0xdf3a('0x12')](_0xdf3a('0xc5'));db['ChatInternalMessage']=db[_0xdf3a('0x0')][_0xdf3a('0x12')](_0xdf3a('0xc6'));db['JscriptyAnswerReport']=db[_0xdf3a('0x0')]['import'](_0xdf3a('0xc7'));db[_0xdf3a('0xc8')]=db[_0xdf3a('0x0')][_0xdf3a('0x12')](_0xdf3a('0xc9'));db[_0xdf3a('0xca')]=db['sequelize'][_0xdf3a('0x12')]('../api/jscriptySessionReport/jscriptySessionReport.model');db['SmsQueueReport']=db[_0xdf3a('0x0')][_0xdf3a('0x12')](_0xdf3a('0xcb'));db[_0xdf3a('0xcc')]=db['sequelize'][_0xdf3a('0x12')]('../api/squareReport/squareReport.model');db[_0xdf3a('0xcd')]=db[_0xdf3a('0x0')][_0xdf3a('0x12')]('../api/squareReportDetail/squareReportDetail.model');db['JscriptyProject']=db[_0xdf3a('0x0')]['import'](_0xdf3a('0xce'));db[_0xdf3a('0xcf')]=db[_0xdf3a('0x0')][_0xdf3a('0x12')](_0xdf3a('0xd0'));db['SquareOdbc']=db[_0xdf3a('0x0')]['import'](_0xdf3a('0xd1'));db[_0xdf3a('0xd2')]=db['sequelize'][_0xdf3a('0x12')](_0xdf3a('0xd3'));db[_0xdf3a('0xd4')]=db['sequelize']['import']('../api/squareRecording/squareRecording.model');db[_0xdf3a('0xd5')]=db[_0xdf3a('0x0')][_0xdf3a('0x12')](_0xdf3a('0xd6'));db[_0xdf3a('0xd7')]=db[_0xdf3a('0x0')][_0xdf3a('0x12')](_0xdf3a('0xd8'));db[_0xdf3a('0xd9')]=db[_0xdf3a('0x0')][_0xdf3a('0x12')](_0xdf3a('0xda'));db[_0xdf3a('0xdb')]=db[_0xdf3a('0x0')][_0xdf3a('0x12')](_0xdf3a('0xdc'));db[_0xdf3a('0xdd')]=db[_0xdf3a('0x0')][_0xdf3a('0x12')](_0xdf3a('0xde'));db['Attachment']=db['sequelize'][_0xdf3a('0x12')](_0xdf3a('0xdf'));db['Plugin']=db[_0xdf3a('0x0')]['import'](_0xdf3a('0xe0'));db[_0xdf3a('0xe1')]=db[_0xdf3a('0x0')][_0xdf3a('0x12')](_0xdf3a('0xe2'));db[_0xdf3a('0xe3')]=db['sequelize'][_0xdf3a('0x12')](_0xdf3a('0xe4'));db[_0xdf3a('0xe5')]=db[_0xdf3a('0x0')][_0xdf3a('0x12')](_0xdf3a('0xe6'));db[_0xdf3a('0xe7')]=db[_0xdf3a('0x0')]['import'](_0xdf3a('0xe8'));db[_0xdf3a('0xe9')]=db[_0xdf3a('0x0')][_0xdf3a('0x12')](_0xdf3a('0xea'));db[_0xdf3a('0xeb')]=db['sequelize'][_0xdf3a('0x12')]('../api/cmList/cmList.model');db['VoicePrefix']=db['sequelize'][_0xdf3a('0x12')](_0xdf3a('0xec'));db[_0xdf3a('0xed')]=db[_0xdf3a('0x0')][_0xdf3a('0x12')]('../api/userProfile/userProfile.model');db[_0xdf3a('0xee')]=db[_0xdf3a('0x0')][_0xdf3a('0x12')](_0xdf3a('0xef'));db[_0xdf3a('0xf0')]=db[_0xdf3a('0x0')][_0xdf3a('0x12')](_0xdf3a('0xf1'));db[_0xdf3a('0xf2')]=db[_0xdf3a('0x0')]['import']('../api/userNotification/userNotification.model');db[_0xdf3a('0xf3')]=db[_0xdf3a('0x0')]['import']('../api/whatsappAccount/whatsappAccount.model');db[_0xdf3a('0xf4')]=db[_0xdf3a('0x0')]['import'](_0xdf3a('0xf5'));db[_0xdf3a('0xf6')]=db[_0xdf3a('0x0')][_0xdf3a('0x12')](_0xdf3a('0xf7'));db[_0xdf3a('0xf8')]=db[_0xdf3a('0x0')][_0xdf3a('0x12')](_0xdf3a('0xf9'));db['WhatsappQueueReport']=db[_0xdf3a('0x0')][_0xdf3a('0x12')](_0xdf3a('0xfa'));db['WhatsappTransferReport']=db[_0xdf3a('0x0')][_0xdf3a('0x12')](_0xdf3a('0xfb'));db['WhatsappQueue']=db['sequelize']['import']('../api/whatsappQueue/whatsappQueue.model');db[_0xdf3a('0xfc')]=db[_0xdf3a('0x0')][_0xdf3a('0x12')](_0xdf3a('0xfd'));db[_0xdf3a('0xfe')]=db[_0xdf3a('0x0')][_0xdf3a('0x12')](_0xdf3a('0xff'));db[_0xdf3a('0x100')]=db[_0xdf3a('0x0')][_0xdf3a('0x12')](_0xdf3a('0x101'));db[_0xdf3a('0x102')]=db[_0xdf3a('0x0')][_0xdf3a('0x12')](_0xdf3a('0x103'));db['UserSetting']=db[_0xdf3a('0x0')][_0xdf3a('0x12')](_0xdf3a('0x104'));db[_0xdf3a('0x105')]=db['sequelize'][_0xdf3a('0x12')](_0xdf3a('0x106'));db[_0xdf3a('0x107')][_0xdf3a('0x108')](db['VoiceMail'],{'as':_0xdf3a('0x109'),'onDelete':_0xdf3a('0x10a'),'foreignKey':_0xdf3a('0x10b')});db[_0xdf3a('0x107')][_0xdf3a('0x108')](db[_0xdf3a('0x10c')],{'as':_0xdf3a('0x10d'),'onDelete':_0xdf3a('0x10a'),'foreignKey':'UserId'});db[_0xdf3a('0x107')][_0xdf3a('0x10e')](db[_0xdf3a('0x1b')],{'as':'Recordings','foreignKey':'UserId'});db[_0xdf3a('0x107')][_0xdf3a('0x10e')](db[_0xdf3a('0x2b')],{'as':_0xdf3a('0x10f'),'foreignKey':_0xdf3a('0x10b')});db[_0xdf3a('0x107')][_0xdf3a('0x10e')](db['VoiceExtension'],{'as':_0xdf3a('0x110'),'onDelete':_0xdf3a('0x10a'),'hooks':!![]});db[_0xdf3a('0x107')][_0xdf3a('0x10e')](db[_0xdf3a('0x6b')],{'as':_0xdf3a('0x111'),'foreignKey':_0xdf3a('0x10b')});db[_0xdf3a('0x107')][_0xdf3a('0x10e')](db[_0xdf3a('0x6d')],{'as':_0xdf3a('0x112'),'foreignKey':_0xdf3a('0x10b')});db[_0xdf3a('0x107')][_0xdf3a('0x10e')](db['ReportAgentPreview'],{'as':_0xdf3a('0x113'),'foreignKey':'UserId'});db[_0xdf3a('0x107')][_0xdf3a('0x10e')](db[_0xdf3a('0x53')],{'as':_0xdf3a('0x114'),'foreignKey':_0xdf3a('0x10b')});db[_0xdf3a('0x107')][_0xdf3a('0x10e')](db[_0xdf3a('0x115')],{'as':'ChatInteractions','foreignKey':_0xdf3a('0x10b')});db[_0xdf3a('0x107')][_0xdf3a('0x10e')](db[_0xdf3a('0x4e')],{'as':_0xdf3a('0x116'),'foreignKey':_0xdf3a('0x10b')});db[_0xdf3a('0x107')][_0xdf3a('0x10e')](db['FaxInteraction'],{'as':_0xdf3a('0x117'),'foreignKey':_0xdf3a('0x10b')});db[_0xdf3a('0x107')][_0xdf3a('0x10e')](db['MailInteraction'],{'as':_0xdf3a('0x118'),'foreignKey':_0xdf3a('0x10b')});db['User']['hasMany'](db['WhatsappInteraction'],{'as':_0xdf3a('0x119'),'foreignKey':_0xdf3a('0x10b')});db[_0xdf3a('0x107')][_0xdf3a('0x10e')](db[_0xdf3a('0xf2')],{'as':_0xdf3a('0x11a'),'foreignKey':_0xdf3a('0x11b')});db[_0xdf3a('0x107')]['hasMany'](db['CmHopper'],{'as':_0xdf3a('0x11c'),'foreignKey':'UserId','onDelete':_0xdf3a('0x11d')});db[_0xdf3a('0x107')][_0xdf3a('0x11e')](db[_0xdf3a('0xed')],{'as':_0xdf3a('0xed'),'foreignKey':_0xdf3a('0x11f')});db[_0xdf3a('0x107')][_0xdf3a('0x120')](db[_0xdf3a('0x60')],{'as':_0xdf3a('0x121'),'through':_0xdf3a('0x122')});db[_0xdf3a('0x107')]['belongsToMany'](db['CmContact'],{'as':_0xdf3a('0x123'),'through':_0xdf3a('0x124')});db['User']['belongsToMany'](db[_0xdf3a('0xeb')],{'as':_0xdf3a('0x125'),'through':_0xdf3a('0x126')});db[_0xdf3a('0x107')]['belongsToMany'](db['Team'],{'through':'user_has_teams'});db[_0xdf3a('0x107')]['belongsToMany'](db[_0xdf3a('0x3c')],{'as':_0xdf3a('0x118'),'through':'user_has_mail_interactions'});db['User'][_0xdf3a('0x120')](db[_0xdf3a('0x115')],{'as':'ChatInteractions','through':_0xdf3a('0x127')});db[_0xdf3a('0x107')]['belongsToMany'](db[_0xdf3a('0x48')],{'as':'FaxInteractions','through':_0xdf3a('0x128')});db[_0xdf3a('0x107')]['belongsToMany'](db[_0xdf3a('0x4e')],{'as':_0xdf3a('0x116'),'through':_0xdf3a('0x129')});db[_0xdf3a('0x107')][_0xdf3a('0x120')](db[_0xdf3a('0x53')],{'as':_0xdf3a('0x114'),'through':'user_has_openchannel_interactions'});db['User'][_0xdf3a('0x120')](db[_0xdf3a('0xf6')],{'as':_0xdf3a('0x119'),'through':_0xdf3a('0x12a')});db[_0xdf3a('0x107')]['belongsToMany'](db['VoiceQueue'],{'as':_0xdf3a('0x12b'),'through':_0xdf3a('0x12c'),'required':![]});db[_0xdf3a('0x107')][_0xdf3a('0x120')](db[_0xdf3a('0x12d')],{'as':_0xdf3a('0x12e'),'through':_0xdf3a('0x102'),'required':![]});db[_0xdf3a('0x107')][_0xdf3a('0x120')](db[_0xdf3a('0x39')],{'as':_0xdf3a('0x12f'),'through':_0xdf3a('0x130'),'required':![]});db[_0xdf3a('0x107')]['belongsToMany'](db[_0xdf3a('0x5e')],{'as':_0xdf3a('0x131'),'through':_0xdf3a('0x2e'),'required':![],'hooks':!![]});db[_0xdf3a('0x107')][_0xdf3a('0x120')](db[_0xdf3a('0x4a')],{'as':_0xdf3a('0x132'),'through':'UserFaxQueue','required':![]});db[_0xdf3a('0x107')][_0xdf3a('0x120')](db['SmsQueue'],{'as':_0xdf3a('0x133'),'through':_0xdf3a('0x32'),'required':![]});db[_0xdf3a('0x107')][_0xdf3a('0x120')](db['OpenchannelQueue'],{'as':_0xdf3a('0x134'),'through':_0xdf3a('0x33'),'required':![]});db[_0xdf3a('0x107')]['belongsToMany'](db['WhatsappQueue'],{'as':'WhatsappQueues','through':_0xdf3a('0x35'),'required':![]});db[_0xdf3a('0x107')][_0xdf3a('0x120')](db[_0xdf3a('0xeb')],{'through':_0xdf3a('0x126')});db['User']['belongsToMany'](db[_0xdf3a('0x57')],{'as':_0xdf3a('0x135'),'through':_0xdf3a('0x136')});db[_0xdf3a('0x107')][_0xdf3a('0x120')](db[_0xdf3a('0x46')],{'as':_0xdf3a('0x137'),'through':'user_has_fax_accounts'});db[_0xdf3a('0x107')][_0xdf3a('0x120')](db[_0xdf3a('0x138')],{'as':_0xdf3a('0x139'),'through':_0xdf3a('0x13a')});db['User'][_0xdf3a('0x120')](db[_0xdf3a('0x13b')],{'as':_0xdf3a('0x13c'),'through':_0xdf3a('0x13d')});db[_0xdf3a('0x107')][_0xdf3a('0x120')](db[_0xdf3a('0x4c')],{'as':'SmsAccounts','through':_0xdf3a('0x13e')});db[_0xdf3a('0x107')][_0xdf3a('0x120')](db[_0xdf3a('0xf3')],{'as':_0xdf3a('0x13f'),'through':_0xdf3a('0x140')});db['VoiceChanSpy'][_0xdf3a('0x10e')](db[_0xdf3a('0x16')],{'as':_0xdf3a('0x141'),'onDelete':_0xdf3a('0x10a'),'foreignKey':_0xdf3a('0x142')});db[_0xdf3a('0x14')][_0xdf3a('0x10e')](db[_0xdf3a('0x16')],{'onDelete':_0xdf3a('0x10a')});db[_0xdf3a('0x16')][_0xdf3a('0x10e')](db[_0xdf3a('0x16')],{'as':_0xdf3a('0x143'),'onDelete':_0xdf3a('0x10a')});db[_0xdf3a('0x144')][_0xdf3a('0x120')](db['Sound'],{'as':_0xdf3a('0x145'),'through':'moh_has_sounds'});db[_0xdf3a('0x19')][_0xdf3a('0x10e')](db[_0xdf3a('0x2b')],{'as':'Members','foreignKey':_0xdf3a('0x146')});db[_0xdf3a('0x19')][_0xdf3a('0x10e')](db[_0xdf3a('0x67')],{'as':_0xdf3a('0x11c'),'foreignKey':_0xdf3a('0x146')});db[_0xdf3a('0x19')][_0xdf3a('0x10e')](db['CmHopperFinal'],{'as':_0xdf3a('0x111'),'foreignKey':_0xdf3a('0x146')});db[_0xdf3a('0x19')]['hasMany'](db['CmHopperHistory'],{'as':_0xdf3a('0x147'),'foreignKey':'VoiceQueueId'});db[_0xdf3a('0x19')][_0xdf3a('0x10e')](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':_0xdf3a('0x146')});db[_0xdf3a('0x19')]['hasMany'](db[_0xdf3a('0x69')],{'as':_0xdf3a('0x148'),'foreignKey':_0xdf3a('0x146')});db[_0xdf3a('0x19')][_0xdf3a('0x10e')](db[_0xdf3a('0xca')],{'as':'JscriptySessions','foreignKey':_0xdf3a('0x146')});db['VoiceQueue'][_0xdf3a('0x11e')](db[_0xdf3a('0x28')],{'as':_0xdf3a('0x28'),'foreignKey':_0xdf3a('0x149')});db[_0xdf3a('0x19')][_0xdf3a('0x11e')](db[_0xdf3a('0x28')],{'as':_0xdf3a('0x14a'),'foreignKey':_0xdf3a('0x14b')});db[_0xdf3a('0x19')][_0xdf3a('0x11e')](db[_0xdf3a('0x77')],{'as':_0xdf3a('0x77'),'foreignKey':_0xdf3a('0x14c')});db[_0xdf3a('0x19')][_0xdf3a('0x11e')](db['Pause'],{'as':_0xdf3a('0x14d'),'foreignKey':_0xdf3a('0x14e')});db[_0xdf3a('0x19')]['belongsToMany'](db[_0xdf3a('0xeb')],{'as':_0xdf3a('0x125'),'through':'voice_queues_has_cm_lists'});db[_0xdf3a('0x19')]['belongsToMany'](db[_0xdf3a('0x107')],{'as':'Agents','through':'UserVoiceQueue'});db['VoiceQueue'][_0xdf3a('0x120')](db[_0xdf3a('0xd7')],{'as':_0xdf3a('0x14f'),'through':_0xdf3a('0xfe')});db[_0xdf3a('0x19')][_0xdf3a('0x120')](db[_0xdf3a('0xeb')],{'as':_0xdf3a('0x150'),'through':'voice_queues_has_cm_blacklists'});db[_0xdf3a('0x1b')][_0xdf3a('0x11e')](db[_0xdf3a('0x107')],{'as':'User','foreignKey':_0xdf3a('0x10b')});db[_0xdf3a('0x151')][_0xdf3a('0x11e')](db['User'],{'as':_0xdf3a('0x107'),'foreignKey':_0xdf3a('0x10b')});db[_0xdf3a('0x109')][_0xdf3a('0x10e')](db[_0xdf3a('0x1e')],{'as':_0xdf3a('0x152'),'onDelete':_0xdf3a('0x10a'),'foreignKey':_0xdf3a('0x153'),'sourceKey':_0xdf3a('0x154')});db[_0xdf3a('0x1e')]['belongsTo'](db[_0xdf3a('0x109')],{'foreignKey':'mailboxuser','targetKey':_0xdf3a('0x154')});db[_0xdf3a('0x20')][_0xdf3a('0x10e')](db['VoiceQueueReport'],{'as':'QueueCalls','foreignKey':'uniqueid','constraints':![]});db[_0xdf3a('0x20')][_0xdf3a('0x10e')](db[_0xdf3a('0x22')],{'as':_0xdf3a('0x155'),'foreignKey':_0xdf3a('0x156'),'constraints':![]});db[_0xdf3a('0x20')][_0xdf3a('0x11e')](db['User'],{'as':_0xdf3a('0x107'),'foreignKey':_0xdf3a('0x10b')});db[_0xdf3a('0x20')][_0xdf3a('0x11e')](db[_0xdf3a('0x65')],{'as':_0xdf3a('0x157'),'foreignKey':_0xdf3a('0x158')});db['MailServerIn'][_0xdf3a('0x11e')](db['MailAccount'],{'as':_0xdf3a('0x138'),'foreignKey':_0xdf3a('0x159')});db[_0xdf3a('0x36')]['belongsTo'](db[_0xdf3a('0xfc')],{'as':'CloudProvider','foreignKey':'CloudProviderId','onDelete':'restrict'});db['MailServerOut'][_0xdf3a('0x11e')](db[_0xdf3a('0x138')],{'as':_0xdf3a('0x138'),'foreignKey':_0xdf3a('0x159')});db[_0xdf3a('0x15a')][_0xdf3a('0x11e')](db[_0xdf3a('0xfc')],{'as':_0xdf3a('0xfc'),'foreignKey':_0xdf3a('0x15b'),'onDelete':_0xdf3a('0x15c')});db[_0xdf3a('0x138')]['hasOne'](db[_0xdf3a('0x36')],{'as':'Imap','onDelete':_0xdf3a('0x10a')});db['MailAccount'][_0xdf3a('0x108')](db[_0xdf3a('0x15a')],{'as':_0xdf3a('0x15d'),'onDelete':_0xdf3a('0x10a')});db['MailAccount'][_0xdf3a('0x10e')](db['Disposition'],{'as':_0xdf3a('0x15e'),'foreignKey':_0xdf3a('0x159'),'onDelete':'cascade'});db[_0xdf3a('0x138')]['hasMany'](db[_0xdf3a('0x15f')],{'as':'Answers','foreignKey':_0xdf3a('0x159')});db[_0xdf3a('0x138')][_0xdf3a('0x10e')](db[_0xdf3a('0x3e')],{'as':_0xdf3a('0x152'),'foreignKey':_0xdf3a('0x159')});db['MailAccount'][_0xdf3a('0x10e')](db['MailInteraction'],{'as':_0xdf3a('0x160')});db[_0xdf3a('0x138')][_0xdf3a('0x10e')](db['MailApplication'],{'as':_0xdf3a('0x143'),'foreignKey':_0xdf3a('0x159'),'onDelete':_0xdf3a('0x10a')});db[_0xdf3a('0x138')][_0xdf3a('0x11e')](db[_0xdf3a('0xeb')],{'as':_0xdf3a('0x161'),'foreignKey':_0xdf3a('0x162')});db[_0xdf3a('0x138')][_0xdf3a('0x11e')](db[_0xdf3a('0x84')],{'as':_0xdf3a('0x84'),'foreignKey':'TemplateId'});db[_0xdf3a('0x138')][_0xdf3a('0x11e')](db['Pause'],{'as':_0xdf3a('0x14d'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xdf3a('0x138')][_0xdf3a('0x120')](db['User'],{'as':_0xdf3a('0x163'),'through':_0xdf3a('0x13a')});db[_0xdf3a('0x39')]['belongsToMany'](db[_0xdf3a('0x107')],{'as':_0xdf3a('0x163'),'through':'UserMailQueue'});db[_0xdf3a('0x39')][_0xdf3a('0x120')](db[_0xdf3a('0xd7')],{'through':_0xdf3a('0x164'),'as':_0xdf3a('0x14f')});db['MailInteraction']['hasMany'](db[_0xdf3a('0x3e')],{'as':'Messages','onDelete':_0xdf3a('0x10a'),'foreignKey':_0xdf3a('0x165')});db['MailInteraction'][_0xdf3a('0x11e')](db[_0xdf3a('0x138')],{'as':_0xdf3a('0x166'),'foreignKey':_0xdf3a('0x159')});db[_0xdf3a('0x3c')][_0xdf3a('0x11e')](db[_0xdf3a('0x65')],{'as':_0xdf3a('0x157'),'foreignKey':_0xdf3a('0x158')});db[_0xdf3a('0x3c')]['belongsTo'](db[_0xdf3a('0x107')],{'as':_0xdf3a('0x167'),'foreignKey':_0xdf3a('0x10b')});db['MailInteraction']['belongsToMany'](db['Tag'],{'through':_0xdf3a('0x168'),'as':_0xdf3a('0x169')});db['MailInteraction'][_0xdf3a('0x120')](db[_0xdf3a('0x16a')],{'through':_0xdf3a('0x168'),'as':'ThroughTags'});db[_0xdf3a('0x3c')][_0xdf3a('0x120')](db[_0xdf3a('0x107')],{'as':_0xdf3a('0x16b'),'through':'user_has_mail_interactions','foreignKey':_0xdf3a('0x165')});db[_0xdf3a('0x3e')][_0xdf3a('0x10e')](db[_0xdf3a('0x16c')],{'as':_0xdf3a('0x16d'),'onDelete':_0xdf3a('0x10a')});db[_0xdf3a('0x3e')][_0xdf3a('0x11e')](db[_0xdf3a('0x107')],{'as':'User'});db[_0xdf3a('0x3e')][_0xdf3a('0x11e')](db[_0xdf3a('0x65')],{'onDelete':_0xdf3a('0x10a'),'as':'Contact'});db[_0xdf3a('0x3e')][_0xdf3a('0x11e')](db[_0xdf3a('0x3c')],{'as':_0xdf3a('0x16e'),'foreignKey':_0xdf3a('0x165')});db['MailMessage']['belongsTo'](db['MailAccount'],{'as':_0xdf3a('0x166'),'foreignKey':_0xdf3a('0x159')});db[_0xdf3a('0x3e')][_0xdf3a('0x11e')](db[_0xdf3a('0x57')],{'as':_0xdf3a('0x57'),'foreignKey':_0xdf3a('0x16f')});db[_0xdf3a('0x3e')]['belongsTo'](db[_0xdf3a('0x5d')],{'as':'ChatOfflineMessage','foreignKey':'ChatOfflineMessageId'});db['MailApplication'][_0xdf3a('0x11e')](db[_0xdf3a('0x107')],{'onDelete':_0xdf3a('0x15c')});db[_0xdf3a('0x3f')][_0xdf3a('0x11e')](db[_0xdf3a('0x39')],{'onDelete':_0xdf3a('0x15c')});db[_0xdf3a('0x3f')][_0xdf3a('0x11e')](db['MailAccount'],{'onDelete':_0xdf3a('0x15c')});db['MailApplication'][_0xdf3a('0x11e')](db[_0xdf3a('0x77')],{'onDelete':_0xdf3a('0x15c'),'foreignKey':_0xdf3a('0x14c')});db[_0xdf3a('0x3f')][_0xdf3a('0x11e')](db[_0xdf3a('0x16a')],{'onDelete':_0xdf3a('0x15c'),'foreignKey':'TagId'});db[_0xdf3a('0x41')][_0xdf3a('0x11e')](db[_0xdf3a('0x138')],{});db[_0xdf3a('0x41')][_0xdf3a('0x11e')](db[_0xdf3a('0xeb')],{'as':_0xdf3a('0x161'),'foreignKey':'ListId'});db[_0xdf3a('0x41')][_0xdf3a('0x11e')](db[_0xdf3a('0x65')],{'as':'Contact','foreignKey':'ContactId'});db[_0xdf3a('0x41')][_0xdf3a('0x11e')](db['MailInteraction'],{});db[_0xdf3a('0x41')]['belongsTo'](db[_0xdf3a('0x3e')],{});db[_0xdf3a('0x41')][_0xdf3a('0x11e')](db[_0xdf3a('0x107')],{});db[_0xdf3a('0x41')]['belongsTo'](db[_0xdf3a('0x39')],{});db['Dashboard']['hasMany'](db[_0xdf3a('0x44')],{'as':_0xdf3a('0x170'),'onDelete':_0xdf3a('0x10a')});db[_0xdf3a('0x46')][_0xdf3a('0x10e')](db[_0xdf3a('0x171')],{'as':_0xdf3a('0x15e'),'foreignKey':_0xdf3a('0x172'),'onDelete':_0xdf3a('0x10a')});db['FaxAccount']['hasMany'](db['CannedAnswer'],{'as':_0xdf3a('0x173'),'foreignKey':_0xdf3a('0x172')});db['FaxAccount']['hasMany'](db[_0xdf3a('0x48')],{'as':_0xdf3a('0x160')});db[_0xdf3a('0x46')]['hasMany'](db[_0xdf3a('0x174')],{'as':'Applications','foreignKey':_0xdf3a('0x172'),'onDelete':_0xdf3a('0x10a')});db[_0xdf3a('0x46')][_0xdf3a('0x10e')](db[_0xdf3a('0x16')],{'as':_0xdf3a('0x175'),'onDelete':_0xdf3a('0x10a')});db[_0xdf3a('0x46')][_0xdf3a('0x10e')](db['FaxMessage'],{'as':_0xdf3a('0x152')});db[_0xdf3a('0x46')][_0xdf3a('0x11e')](db['Trunk'],{'as':_0xdf3a('0x28')});db[_0xdf3a('0x46')]['belongsTo'](db[_0xdf3a('0xeb')],{'as':_0xdf3a('0x161'),'foreignKey':_0xdf3a('0x162')});db[_0xdf3a('0x46')]['belongsTo'](db[_0xdf3a('0x79')],{'as':'mandatoryDispositionPause','foreignKey':_0xdf3a('0x14e')});db[_0xdf3a('0x46')]['belongsToMany'](db['User'],{'as':_0xdf3a('0x163'),'through':_0xdf3a('0x176')});db['FaxApplication'][_0xdf3a('0x11e')](db[_0xdf3a('0x107')],{'onDelete':_0xdf3a('0x15c')});db['FaxApplication'][_0xdf3a('0x11e')](db['FaxQueue'],{'onDelete':_0xdf3a('0x15c')});db[_0xdf3a('0x174')][_0xdf3a('0x11e')](db[_0xdf3a('0x46')],{'onDelete':_0xdf3a('0x15c')});db[_0xdf3a('0x174')][_0xdf3a('0x11e')](db[_0xdf3a('0x16a')],{'onDelete':_0xdf3a('0x15c'),'foreignKey':_0xdf3a('0x177')});db[_0xdf3a('0x48')][_0xdf3a('0x10e')](db[_0xdf3a('0x49')],{'as':_0xdf3a('0x152'),'onDelete':_0xdf3a('0x10a'),'foreignKey':'FaxInteractionId'});db[_0xdf3a('0x48')][_0xdf3a('0x11e')](db[_0xdf3a('0x46')],{'as':_0xdf3a('0x166'),'foreignKey':_0xdf3a('0x172')});db[_0xdf3a('0x48')][_0xdf3a('0x11e')](db[_0xdf3a('0x65')],{'as':'Contact','foreignKey':_0xdf3a('0x158')});db['FaxInteraction']['belongsTo'](db[_0xdf3a('0x107')],{'as':_0xdf3a('0x167'),'foreignKey':_0xdf3a('0x10b')});db[_0xdf3a('0x48')][_0xdf3a('0x120')](db['Tag'],{'through':_0xdf3a('0x178'),'as':'Tags'});db[_0xdf3a('0x48')]['belongsToMany'](db['Tag'],{'through':_0xdf3a('0x178'),'as':_0xdf3a('0x179')});db[_0xdf3a('0x48')]['belongsToMany'](db[_0xdf3a('0x107')],{'as':'Users','through':_0xdf3a('0x128'),'foreignKey':_0xdf3a('0x17a')});db[_0xdf3a('0x49')][_0xdf3a('0x11e')](db['User'],{'onDelete':_0xdf3a('0x10a'),'as':_0xdf3a('0x107')});db[_0xdf3a('0x49')]['belongsTo'](db[_0xdf3a('0x48')],{'as':_0xdf3a('0x16e'),'foreignKey':_0xdf3a('0x17a')});db[_0xdf3a('0x49')]['belongsTo'](db['CmContact'],{'onDelete':_0xdf3a('0x10a'),'as':_0xdf3a('0x157')});db['FaxMessage']['belongsTo'](db[_0xdf3a('0x16c')],{'as':'Attachment','foreignKey':_0xdf3a('0x17b')});db[_0xdf3a('0x49')][_0xdf3a('0x11e')](db[_0xdf3a('0x46')],{'as':'Account','foreignKey':'FaxAccountId'});db['FaxQueue'][_0xdf3a('0x120')](db[_0xdf3a('0x107')],{'as':'Agents','through':_0xdf3a('0x30')});db['FaxQueue'][_0xdf3a('0x120')](db[_0xdf3a('0xd7')],{'through':_0xdf3a('0x17c'),'as':_0xdf3a('0x14f')});db['FaxQueueReport'][_0xdf3a('0x11e')](db[_0xdf3a('0x46')],{});db['FaxQueueReport']['belongsTo'](db[_0xdf3a('0xeb')],{'as':_0xdf3a('0x161'),'foreignKey':_0xdf3a('0x162')});db[_0xdf3a('0x17d')][_0xdf3a('0x11e')](db[_0xdf3a('0x65')],{'as':_0xdf3a('0x157'),'foreignKey':_0xdf3a('0x158')});db[_0xdf3a('0x17d')][_0xdf3a('0x11e')](db[_0xdf3a('0x48')],{});db[_0xdf3a('0x17d')][_0xdf3a('0x11e')](db['FaxMessage'],{});db[_0xdf3a('0x17d')]['belongsTo'](db[_0xdf3a('0x107')],{});db['FaxQueueReport'][_0xdf3a('0x11e')](db['FaxQueue'],{});db[_0xdf3a('0x4c')][_0xdf3a('0x10e')](db[_0xdf3a('0x171')],{'as':_0xdf3a('0x15e'),'foreignKey':_0xdf3a('0x17e'),'onDelete':'cascade'});db[_0xdf3a('0x4c')][_0xdf3a('0x10e')](db['CannedAnswer'],{'as':_0xdf3a('0x173'),'foreignKey':_0xdf3a('0x17e')});db[_0xdf3a('0x4c')][_0xdf3a('0x10e')](db[_0xdf3a('0x17f')],{'as':_0xdf3a('0x152'),'foreignKey':'SmsAccountId'});db[_0xdf3a('0x4c')][_0xdf3a('0x10e')](db[_0xdf3a('0x4e')],{'as':_0xdf3a('0x160')});db[_0xdf3a('0x4c')][_0xdf3a('0x10e')](db['SmsApplication'],{'as':_0xdf3a('0x143'),'foreignKey':_0xdf3a('0x17e'),'onDelete':'cascade'});db[_0xdf3a('0x4c')][_0xdf3a('0x11e')](db[_0xdf3a('0xeb')],{'as':_0xdf3a('0x161'),'foreignKey':'ListId'});db[_0xdf3a('0x4c')]['belongsTo'](db[_0xdf3a('0x79')],{'as':_0xdf3a('0x14d'),'foreignKey':'mandatoryDispositionPauseId'});db['SmsAccount']['belongsToMany'](db['User'],{'as':_0xdf3a('0x163'),'through':_0xdf3a('0x13e')});db[_0xdf3a('0x180')][_0xdf3a('0x11e')](db[_0xdf3a('0x107')],{'onDelete':_0xdf3a('0x15c')});db[_0xdf3a('0x180')][_0xdf3a('0x11e')](db[_0xdf3a('0x4f')],{'onDelete':_0xdf3a('0x15c')});db['SmsApplication'][_0xdf3a('0x11e')](db['SmsAccount'],{'onDelete':_0xdf3a('0x15c')});db[_0xdf3a('0x180')][_0xdf3a('0x11e')](db[_0xdf3a('0x77')],{'onDelete':'restrict','foreignKey':'IntervalId'});db[_0xdf3a('0x180')][_0xdf3a('0x11e')](db[_0xdf3a('0x16a')],{'onDelete':'restrict','foreignKey':_0xdf3a('0x177')});db['SmsInteraction'][_0xdf3a('0x10e')](db['SmsMessage'],{'as':'Messages','onDelete':_0xdf3a('0x10a'),'foreignKey':_0xdf3a('0x181')});db[_0xdf3a('0x4e')]['belongsTo'](db[_0xdf3a('0x4c')],{'as':_0xdf3a('0x166'),'foreignKey':_0xdf3a('0x17e')});db[_0xdf3a('0x4e')][_0xdf3a('0x11e')](db[_0xdf3a('0x65')],{'as':_0xdf3a('0x157'),'foreignKey':_0xdf3a('0x158')});db[_0xdf3a('0x4e')][_0xdf3a('0x11e')](db[_0xdf3a('0x107')],{'as':_0xdf3a('0x167'),'foreignKey':_0xdf3a('0x10b')});db[_0xdf3a('0x4e')]['belongsToMany'](db[_0xdf3a('0x16a')],{'through':_0xdf3a('0x182'),'as':'Tags'});db[_0xdf3a('0x4e')][_0xdf3a('0x120')](db['Tag'],{'through':_0xdf3a('0x182'),'as':'ThroughTags'});db[_0xdf3a('0x4e')][_0xdf3a('0x120')](db[_0xdf3a('0x107')],{'as':_0xdf3a('0x16b'),'through':_0xdf3a('0x129'),'foreignKey':_0xdf3a('0x181')});db[_0xdf3a('0x17f')]['belongsTo'](db['User'],{'as':_0xdf3a('0x107')});db['SmsMessage']['belongsTo'](db['CmContact'],{'onDelete':'cascade','as':_0xdf3a('0x157')});db['SmsMessage'][_0xdf3a('0x11e')](db[_0xdf3a('0x4e')],{'onDelete':_0xdf3a('0x10a'),'as':_0xdf3a('0x16e'),'foreignKey':_0xdf3a('0x181')});db['SmsMessage'][_0xdf3a('0x11e')](db[_0xdf3a('0x4c')],{'as':'Account','foreignKey':_0xdf3a('0x17e')});db[_0xdf3a('0x4f')][_0xdf3a('0x120')](db[_0xdf3a('0x107')],{'as':_0xdf3a('0x163'),'through':'UserSmsQueue','foreignKey':_0xdf3a('0x183')});db['SmsQueue'][_0xdf3a('0x120')](db[_0xdf3a('0xd7')],{'through':_0xdf3a('0x184'),'as':_0xdf3a('0x14f')});db[_0xdf3a('0x13b')]['hasMany'](db[_0xdf3a('0x171')],{'as':'Dispositions','foreignKey':_0xdf3a('0x185'),'onDelete':_0xdf3a('0x10a')});db[_0xdf3a('0x13b')][_0xdf3a('0x10e')](db['CannedAnswer'],{'as':_0xdf3a('0x173'),'foreignKey':_0xdf3a('0x185')});db[_0xdf3a('0x13b')]['hasMany'](db[_0xdf3a('0x53')],{'as':_0xdf3a('0x160'),'foreignKey':'OpenchannelAccountId'});db[_0xdf3a('0x13b')][_0xdf3a('0x10e')](db[_0xdf3a('0x186')],{'as':_0xdf3a('0x152'),'foreignKey':'OpenchannelAccountId'});db[_0xdf3a('0x13b')][_0xdf3a('0x10e')](db[_0xdf3a('0x51')],{'as':_0xdf3a('0x143'),'foreignKey':_0xdf3a('0x185'),'onDelete':'cascade'});db[_0xdf3a('0x13b')]['belongsTo'](db['CmList'],{'as':_0xdf3a('0x161'),'foreignKey':'ListId'});db[_0xdf3a('0x13b')][_0xdf3a('0x11e')](db[_0xdf3a('0x79')],{'as':_0xdf3a('0x14d'),'foreignKey':_0xdf3a('0x14e')});db[_0xdf3a('0x13b')][_0xdf3a('0x120')](db[_0xdf3a('0x107')],{'as':_0xdf3a('0x163'),'through':_0xdf3a('0x13d')});db['OpenchannelApplication']['belongsTo'](db[_0xdf3a('0x107')],{'onDelete':_0xdf3a('0x15c')});db[_0xdf3a('0x51')]['belongsTo'](db['OpenchannelQueue'],{'onDelete':_0xdf3a('0x15c'),'foreignKey':_0xdf3a('0x187')});db[_0xdf3a('0x51')][_0xdf3a('0x11e')](db[_0xdf3a('0x13b')],{'onDelete':'restrict','foreignKey':'OpenchannelAccountId'});db[_0xdf3a('0x51')][_0xdf3a('0x11e')](db[_0xdf3a('0x77')],{'onDelete':_0xdf3a('0x15c'),'foreignKey':_0xdf3a('0x14c')});db[_0xdf3a('0x51')]['belongsTo'](db[_0xdf3a('0x16a')],{'onDelete':_0xdf3a('0x15c'),'foreignKey':_0xdf3a('0x177')});db[_0xdf3a('0x53')]['hasMany'](db[_0xdf3a('0x186')],{'as':_0xdf3a('0x152'),'onDelete':'cascade','foreignKey':_0xdf3a('0x188')});db[_0xdf3a('0x53')]['belongsTo'](db['OpenchannelAccount'],{'as':'Account','foreignKey':'OpenchannelAccountId'});db[_0xdf3a('0x53')][_0xdf3a('0x11e')](db[_0xdf3a('0x65')],{'as':_0xdf3a('0x157'),'foreignKey':_0xdf3a('0x158')});db[_0xdf3a('0x53')][_0xdf3a('0x11e')](db[_0xdf3a('0x107')],{'as':_0xdf3a('0x167'),'foreignKey':_0xdf3a('0x10b')});db['OpenchannelInteraction'][_0xdf3a('0x120')](db[_0xdf3a('0x16a')],{'through':_0xdf3a('0x189'),'as':_0xdf3a('0x169')});db[_0xdf3a('0x53')][_0xdf3a('0x120')](db[_0xdf3a('0x16a')],{'through':_0xdf3a('0x189'),'as':_0xdf3a('0x179')});db['OpenchannelInteraction'][_0xdf3a('0x120')](db[_0xdf3a('0x107')],{'as':_0xdf3a('0x16b'),'through':_0xdf3a('0x18a'),'foreignKey':_0xdf3a('0x188')});db[_0xdf3a('0x186')][_0xdf3a('0x11e')](db[_0xdf3a('0x107')],{'onDelete':_0xdf3a('0x10a'),'as':_0xdf3a('0x107')});db['OpenchannelMessage'][_0xdf3a('0x11e')](db[_0xdf3a('0x65')],{'onDelete':_0xdf3a('0x10a'),'as':_0xdf3a('0x157')});db[_0xdf3a('0x186')][_0xdf3a('0x11e')](db['OpenchannelInteraction'],{'onDelete':_0xdf3a('0x10a'),'as':'Interaction','foreignKey':_0xdf3a('0x188')});db[_0xdf3a('0x186')][_0xdf3a('0x11e')](db[_0xdf3a('0x16c')],{'as':_0xdf3a('0x16c'),'foreignKey':'AttachmentId'});db[_0xdf3a('0x186')]['belongsTo'](db[_0xdf3a('0x13b')],{'as':_0xdf3a('0x166'),'foreignKey':_0xdf3a('0x185')});db[_0xdf3a('0x55')]['belongsToMany'](db['User'],{'as':'Agents','through':_0xdf3a('0x33'),'foreignKey':_0xdf3a('0x187')});db[_0xdf3a('0x55')]['belongsToMany'](db[_0xdf3a('0xd7')],{'through':_0xdf3a('0x18b'),'as':_0xdf3a('0x14f')});db[_0xdf3a('0x57')][_0xdf3a('0x10e')](db[_0xdf3a('0x171')],{'as':'Dispositions','foreignKey':_0xdf3a('0x16f'),'onDelete':_0xdf3a('0x10a')});db[_0xdf3a('0x57')][_0xdf3a('0x10e')](db[_0xdf3a('0x15f')],{'as':_0xdf3a('0x173'),'foreignKey':'ChatWebsiteId'});db[_0xdf3a('0x57')]['hasMany'](db[_0xdf3a('0x62')],{'as':'ProactiveActions'});db[_0xdf3a('0x57')]['hasMany'](db[_0xdf3a('0x115')],{'as':'Interactions'});db['ChatWebsite'][_0xdf3a('0x10e')](db['ChatApplication'],{'as':_0xdf3a('0x143'),'foreignKey':'ChatWebsiteId','onDelete':'cascade'});db[_0xdf3a('0x57')]['hasMany'](db[_0xdf3a('0x5b')],{'as':_0xdf3a('0x152')});db[_0xdf3a('0x57')][_0xdf3a('0x11e')](db[_0xdf3a('0xeb')],{'as':_0xdf3a('0x161'),'foreignKey':_0xdf3a('0x162')});db[_0xdf3a('0x57')]['belongsTo'](db[_0xdf3a('0x77')],{'as':'Interval','foreignKey':'IntervalId'});db[_0xdf3a('0x57')][_0xdf3a('0x11e')](db[_0xdf3a('0x138')],{'as':_0xdf3a('0x138'),'foreignKey':_0xdf3a('0x159')});db['ChatWebsite'][_0xdf3a('0x11e')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0xdf3a('0x14e')});db[_0xdf3a('0x57')]['belongsToMany'](db[_0xdf3a('0x107')],{'as':'Agents','through':_0xdf3a('0x136')});db[_0xdf3a('0x59')][_0xdf3a('0x11e')](db[_0xdf3a('0x13b')],{});db['OpenchannelQueueReport'][_0xdf3a('0x11e')](db[_0xdf3a('0xeb')],{'as':_0xdf3a('0x161'),'foreignKey':_0xdf3a('0x162')});db[_0xdf3a('0x59')][_0xdf3a('0x11e')](db[_0xdf3a('0x65')],{'as':_0xdf3a('0x157'),'foreignKey':_0xdf3a('0x158')});db[_0xdf3a('0x59')][_0xdf3a('0x11e')](db['OpenchannelInteraction'],{});db[_0xdf3a('0x59')][_0xdf3a('0x11e')](db[_0xdf3a('0x186')],{});db[_0xdf3a('0x59')][_0xdf3a('0x11e')](db[_0xdf3a('0x107')],{});db['OpenchannelQueueReport']['belongsTo'](db['OpenchannelQueue'],{});db['ChatApplication'][_0xdf3a('0x11e')](db['User'],{'as':_0xdf3a('0x18c'),'foreignKey':_0xdf3a('0x10b'),'onDelete':_0xdf3a('0x15c')});db[_0xdf3a('0x18d')]['belongsTo'](db['ChatQueue'],{'as':_0xdf3a('0x18e'),'foreignKey':_0xdf3a('0x18f'),'onDelete':'restrict'});db['ChatApplication']['belongsTo'](db[_0xdf3a('0x57')],{'as':_0xdf3a('0x190'),'foreignKey':_0xdf3a('0x16f'),'onDelete':_0xdf3a('0x15c')});db['ChatApplication'][_0xdf3a('0x11e')](db[_0xdf3a('0x16a')],{'onDelete':_0xdf3a('0x15c'),'foreignKey':_0xdf3a('0x177')});db[_0xdf3a('0x115')]['hasMany'](db[_0xdf3a('0x5b')],{'as':_0xdf3a('0x152'),'onDelete':'cascade','foreignKey':_0xdf3a('0x191')});db[_0xdf3a('0x115')][_0xdf3a('0x11e')](db[_0xdf3a('0x57')],{'as':_0xdf3a('0x166'),'foreignKey':'ChatWebsiteId'});db[_0xdf3a('0x115')][_0xdf3a('0x11e')](db[_0xdf3a('0x65')],{'as':_0xdf3a('0x157'),'foreignKey':'ContactId'});db['ChatInteraction']['belongsTo'](db[_0xdf3a('0x107')],{'as':_0xdf3a('0x167'),'foreignKey':_0xdf3a('0x10b')});db[_0xdf3a('0x115')]['belongsToMany'](db[_0xdf3a('0x16a')],{'through':'chat_interaction_has_tags','as':_0xdf3a('0x169')});db[_0xdf3a('0x115')]['belongsToMany'](db['Tag'],{'through':_0xdf3a('0x192'),'as':_0xdf3a('0x179')});db[_0xdf3a('0x115')][_0xdf3a('0x120')](db[_0xdf3a('0x107')],{'as':'Users','through':_0xdf3a('0x127'),'foreignKey':_0xdf3a('0x191')});db[_0xdf3a('0x5b')][_0xdf3a('0x11e')](db[_0xdf3a('0x107')],{'onDelete':_0xdf3a('0x10a'),'as':_0xdf3a('0x107')});db[_0xdf3a('0x5b')]['belongsTo'](db[_0xdf3a('0x65')],{'onDelete':_0xdf3a('0x10a'),'as':_0xdf3a('0x157'),'foreignKey':_0xdf3a('0x158')});db[_0xdf3a('0x5b')]['belongsTo'](db[_0xdf3a('0x115')],{'onDelete':_0xdf3a('0x10a'),'as':_0xdf3a('0x16e'),'foreignKey':_0xdf3a('0x191')});db[_0xdf3a('0x5b')]['belongsTo'](db[_0xdf3a('0x16c')],{'as':_0xdf3a('0x16c'),'foreignKey':_0xdf3a('0x17b')});db['ChatMessage'][_0xdf3a('0x11e')](db['ChatWebsite'],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0xdf3a('0x5d')][_0xdf3a('0x10e')](db[_0xdf3a('0x16c')],{'as':'Attachments','foreignKey':_0xdf3a('0x193'),'onDelete':_0xdf3a('0x10a'),'hooks':!![]});db[_0xdf3a('0x5d')][_0xdf3a('0x11e')](db[_0xdf3a('0x65')],{'onDelete':_0xdf3a('0x10a'),'as':_0xdf3a('0x157'),'foreignKey':'ContactId'});db[_0xdf3a('0x5d')][_0xdf3a('0x11e')](db[_0xdf3a('0x57')],{'as':'Account','foreignKey':_0xdf3a('0x16f')});db[_0xdf3a('0x5e')][_0xdf3a('0x120')](db[_0xdf3a('0x107')],{'as':_0xdf3a('0x163'),'through':_0xdf3a('0x2e'),'hooks':!![]});db['ChatQueue'][_0xdf3a('0x120')](db['Team'],{'through':_0xdf3a('0x194'),'as':'Teams'});db[_0xdf3a('0x60')][_0xdf3a('0x10e')](db[_0xdf3a('0x195')],{'as':_0xdf3a('0x152'),'foreignKey':'ChatGroupId','onDelete':_0xdf3a('0x10a')});db['ChatGroup'][_0xdf3a('0x120')](db[_0xdf3a('0x107')],{'as':_0xdf3a('0x196'),'through':_0xdf3a('0x122')});db[_0xdf3a('0x62')]['belongsTo'](db[_0xdf3a('0x57')],{'as':_0xdf3a('0x190'),'foreignKey':'ChatWebsiteId'});db[_0xdf3a('0x64')][_0xdf3a('0x10e')](db[_0xdf3a('0x65')],{'as':_0xdf3a('0x123'),'foreignKey':_0xdf3a('0x197')});db[_0xdf3a('0x65')][_0xdf3a('0x10e')](db[_0xdf3a('0x198')],{'as':_0xdf3a('0x199'),'foreignKey':_0xdf3a('0x19a')});db[_0xdf3a('0x65')][_0xdf3a('0x10e')](db[_0xdf3a('0x67')],{'as':'Hoppers','foreignKey':_0xdf3a('0x158')});db[_0xdf3a('0x65')][_0xdf3a('0x10e')](db[_0xdf3a('0x6b')],{'as':_0xdf3a('0x111'),'foreignKey':_0xdf3a('0x158')});db['CmContact'][_0xdf3a('0x10e')](db[_0xdf3a('0x6d')],{'as':'HopperHistories','foreignKey':_0xdf3a('0x158')});db['CmContact'][_0xdf3a('0x10e')](db[_0xdf3a('0x113')],{'as':'ReportAgentPreview','foreignKey':_0xdf3a('0x158')});db[_0xdf3a('0x65')][_0xdf3a('0x10e')](db[_0xdf3a('0xca')],{'as':_0xdf3a('0x19b'),'foreignKey':_0xdf3a('0x158')});db[_0xdf3a('0x65')][_0xdf3a('0x10e')](db[_0xdf3a('0x53')],{'as':_0xdf3a('0x114'),'foreignKey':_0xdf3a('0x158'),'onDelete':_0xdf3a('0x15c')});db[_0xdf3a('0x65')]['hasMany'](db['ChatInteraction'],{'as':'ChatInteractions','foreignKey':_0xdf3a('0x158'),'onDelete':_0xdf3a('0x15c')});db[_0xdf3a('0x65')]['hasMany'](db['SmsInteraction'],{'as':_0xdf3a('0x116'),'foreignKey':_0xdf3a('0x158'),'onDelete':_0xdf3a('0x15c')});db[_0xdf3a('0x65')][_0xdf3a('0x10e')](db[_0xdf3a('0x48')],{'as':_0xdf3a('0x117'),'foreignKey':_0xdf3a('0x158'),'onDelete':'restrict'});db[_0xdf3a('0x65')]['hasMany'](db['MailInteraction'],{'as':_0xdf3a('0x118'),'foreignKey':_0xdf3a('0x158'),'onDelete':_0xdf3a('0x15c')});db[_0xdf3a('0x65')][_0xdf3a('0x11e')](db[_0xdf3a('0x64')],{'as':'Company','foreignKey':_0xdf3a('0x197')});db[_0xdf3a('0x65')][_0xdf3a('0x11e')](db[_0xdf3a('0xeb')],{'as':_0xdf3a('0x161'),'foreignKey':_0xdf3a('0x162'),'onDelete':_0xdf3a('0x10a')});db[_0xdf3a('0x65')][_0xdf3a('0x120')](db[_0xdf3a('0x107')],{'as':_0xdf3a('0x16b'),'through':'cm_user_has_contacts'});db['CmContact'][_0xdf3a('0x120')](db[_0xdf3a('0x16a')],{'as':'Tags','through':_0xdf3a('0x19c')});db['CmContact'][_0xdf3a('0x120')](db['Tag'],{'through':_0xdf3a('0x19c'),'as':_0xdf3a('0x179')});db[_0xdf3a('0x67')]['hasMany'](db[_0xdf3a('0x19d')],{'as':_0xdf3a('0x19e'),'foreignKey':_0xdf3a('0x19f')});db['CmHopper'][_0xdf3a('0x11e')](db[_0xdf3a('0x65')],{'as':_0xdf3a('0x157'),'foreignKey':_0xdf3a('0x158'),'onDelete':'cascade'});db['CmHopper']['belongsTo'](db['CmList'],{'as':_0xdf3a('0x161'),'foreignKey':_0xdf3a('0x162'),'onDelete':_0xdf3a('0x10a')});db['CmHopper']['belongsTo'](db[_0xdf3a('0x107')],{'as':_0xdf3a('0x18c'),'foreignKey':_0xdf3a('0x10b')});db[_0xdf3a('0x67')]['belongsTo'](db[_0xdf3a('0x19')],{'as':_0xdf3a('0x18e'),'foreignKey':_0xdf3a('0x146'),'onDelete':_0xdf3a('0x10a')});db[_0xdf3a('0x67')][_0xdf3a('0x11e')](db[_0xdf3a('0xdb')],{'as':_0xdf3a('0xdb'),'foreignKey':'CampaignId','onDelete':_0xdf3a('0x10a')});db[_0xdf3a('0x67')]['belongsTo'](db['User'],{'as':'Owner','foreignKey':_0xdf3a('0x1a0')});db[_0xdf3a('0x69')][_0xdf3a('0x11e')](db[_0xdf3a('0x65')],{'as':'Contact','foreignKey':'ContactId','onDelete':_0xdf3a('0x10a')});db[_0xdf3a('0x69')][_0xdf3a('0x11e')](db[_0xdf3a('0xeb')],{'as':'List','foreignKey':'ListId','onDelete':_0xdf3a('0x10a')});db[_0xdf3a('0x69')][_0xdf3a('0x11e')](db[_0xdf3a('0x19')],{'as':_0xdf3a('0x18e'),'foreignKey':_0xdf3a('0x146'),'onDelete':_0xdf3a('0x10a')});db[_0xdf3a('0x69')][_0xdf3a('0x11e')](db['Campaign'],{'as':_0xdf3a('0xdb'),'foreignKey':_0xdf3a('0x1a1'),'onDelete':'cascade'});db['Automation'][_0xdf3a('0x10e')](db[_0xdf3a('0x1a2')],{'as':{'plural':'All','singular':_0xdf3a('0x1a3')},'foreignKey':_0xdf3a('0x1a4'),'onDelete':'cascade','hooks':!![]});db[_0xdf3a('0x73')][_0xdf3a('0x10e')](db[_0xdf3a('0x1a2')],{'as':{'plural':_0xdf3a('0x1a5'),'singular':_0xdf3a('0x1a6')},'foreignKey':_0xdf3a('0x1a7'),'onDelete':_0xdf3a('0x10a'),'hooks':!![]});db[_0xdf3a('0x73')][_0xdf3a('0x10e')](db[_0xdf3a('0x71')],{'as':_0xdf3a('0x1a8'),'foreignKey':_0xdf3a('0x1a9'),'onDelete':_0xdf3a('0x10a'),'hooks':!![]});db[_0xdf3a('0x171')][_0xdf3a('0x10e')](db[_0xdf3a('0x171')],{'as':_0xdf3a('0x15e'),'foreignKey':_0xdf3a('0x1aa'),'onDelete':'cascade'});db[_0xdf3a('0x77')]['hasMany'](db[_0xdf3a('0x77')],{'as':_0xdf3a('0x1ab'),'foreignKey':_0xdf3a('0x14c'),'onDelete':_0xdf3a('0x10a'),'hooks':!![],'required':![]});db[_0xdf3a('0x77')][_0xdf3a('0x10e')](db[_0xdf3a('0x16')],{'as':_0xdf3a('0x110'),'foreignKey':_0xdf3a('0x14c'),'onDelete':_0xdf3a('0x15c')});db[_0xdf3a('0x77')]['hasMany'](db[_0xdf3a('0x3f')],{'as':_0xdf3a('0x1ac'),'foreignKey':_0xdf3a('0x14c')});db[_0xdf3a('0x77')][_0xdf3a('0x10e')](db['ChatApplication'],{'as':_0xdf3a('0x1ad'),'foreignKey':_0xdf3a('0x14c')});db['Interval']['hasMany'](db[_0xdf3a('0x174')],{'as':_0xdf3a('0x1ae'),'foreignKey':_0xdf3a('0x14c')});db[_0xdf3a('0x77')]['hasMany'](db['SmsApplication'],{'as':_0xdf3a('0x1af'),'foreignKey':_0xdf3a('0x14c')});db[_0xdf3a('0x7f')][_0xdf3a('0x11e')](db[_0xdf3a('0x138')],{});db['Schedule'][_0xdf3a('0x11e')](db['AnalyticDefaultReport'],{'foreignKey':'DefaultReportId'});db[_0xdf3a('0x7f')][_0xdf3a('0x11e')](db[_0xdf3a('0x8c')],{'foreignKey':_0xdf3a('0x1b0')});db[_0xdf3a('0x80')][_0xdf3a('0x120')](db['VoiceMusicOnHold'],{'as':_0xdf3a('0x1b1'),'through':_0xdf3a('0x1b2'),'onDelete':_0xdf3a('0x15c')});db[_0xdf3a('0x16a')]['belongsToMany'](db[_0xdf3a('0x65')],{'through':_0xdf3a('0x19c')});db[_0xdf3a('0x16a')][_0xdf3a('0x120')](db['ChatInteraction'],{'through':'chat_interaction_has_tags'});db['Tag'][_0xdf3a('0x120')](db['MailInteraction'],{'through':_0xdf3a('0x168')});db['Tag'][_0xdf3a('0x120')](db[_0xdf3a('0x4e')],{'through':_0xdf3a('0x182')});db[_0xdf3a('0x16a')]['belongsToMany'](db[_0xdf3a('0x48')],{'through':_0xdf3a('0x178')});db['Tag'][_0xdf3a('0x120')](db['OpenchannelInteraction'],{'through':'openchannel_interaction_has_tags'});db[_0xdf3a('0x16a')]['belongsToMany'](db[_0xdf3a('0xf6')],{'through':_0xdf3a('0x1b3')});db[_0xdf3a('0x198')]['belongsTo'](db[_0xdf3a('0x1b4')],{'as':_0xdf3a('0x1b5'),'foreignKey':'ItemTypeId'});db[_0xdf3a('0x19d')][_0xdf3a('0x11e')](db[_0xdf3a('0x67')],{'as':_0xdf3a('0x1b6'),'foreignKey':_0xdf3a('0x19f')});db[_0xdf3a('0x198')][_0xdf3a('0x11e')](db[_0xdf3a('0x65')],{'as':_0xdf3a('0x157'),'foreignKey':_0xdf3a('0x19a')});db['Trigger'][_0xdf3a('0x10e')](db[_0xdf3a('0x1a2')],{'as':{'plural':_0xdf3a('0x1b7'),'singular':_0xdf3a('0x1b8')},'foreignKey':_0xdf3a('0x1b9'),'onDelete':_0xdf3a('0x10a'),'hooks':!![]});db[_0xdf3a('0x86')][_0xdf3a('0x10e')](db['Condition'],{'as':{'plural':_0xdf3a('0x1ba'),'singular':_0xdf3a('0x1bb')},'foreignKey':_0xdf3a('0x1bc'),'onDelete':_0xdf3a('0x10a'),'hooks':!![]});db[_0xdf3a('0x86')][_0xdf3a('0x10e')](db[_0xdf3a('0x71')],{'as':_0xdf3a('0x1a8'),'foreignKey':_0xdf3a('0x1bd'),'onDelete':_0xdf3a('0x10a'),'hooks':!![]});db['AnalyticCustomReport'][_0xdf3a('0x10e')](db[_0xdf3a('0x94')],{'as':_0xdf3a('0x1be'),'onDelete':_0xdf3a('0x10a'),'foreignKey':_0xdf3a('0x1b0'),'hooks':!![]});db[_0xdf3a('0x8e')]['hasMany'](db[_0xdf3a('0x94')],{'as':_0xdf3a('0x1be'),'onDelete':'cascade','foreignKey':_0xdf3a('0x1bf')});db['AnalyticMetric'][_0xdf3a('0x10e')](db[_0xdf3a('0x94')],{'as':'Fields','onDelete':_0xdf3a('0x10a'),'foreignKey':'MetricId'});db[_0xdf3a('0x94')][_0xdf3a('0x11e')](db[_0xdf3a('0x92')],{'foreignKey':_0xdf3a('0x1c0')});db[_0xdf3a('0x1c1')][_0xdf3a('0x10e')](db['SalesforceConfiguration'],{'as':_0xdf3a('0x1c2'),'onDelete':_0xdf3a('0x10a'),'foreignKey':_0xdf3a('0x1c3')});db[_0xdf3a('0x1c4')][_0xdf3a('0x10e')](db[_0xdf3a('0x9a')],{'as':_0xdf3a('0x1c5'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0xdf3a('0x1c4')][_0xdf3a('0x10e')](db['SalesforceField'],{'as':'Descriptions','onDelete':'cascade','foreignKey':'DescriptionId'});db[_0xdf3a('0x1c4')][_0xdf3a('0x10e')](db[_0xdf3a('0x9a')],{'as':_0xdf3a('0x1be'),'onDelete':_0xdf3a('0x10a'),'foreignKey':'FieldId'});db[_0xdf3a('0x1c4')][_0xdf3a('0x11e')](db[_0xdf3a('0x1c1')],{'as':_0xdf3a('0x166'),'foreignKey':_0xdf3a('0x1c3')});db[_0xdf3a('0x9a')][_0xdf3a('0x10e')](db[_0xdf3a('0x9a')],{'as':_0xdf3a('0x1c6'),'foreignKey':_0xdf3a('0x1c7')});db[_0xdf3a('0x9a')][_0xdf3a('0x10e')](db[_0xdf3a('0x9a')],{'as':_0xdf3a('0x1c8'),'foreignKey':_0xdf3a('0x1c9')});db[_0xdf3a('0x9a')]['hasMany'](db[_0xdf3a('0x9a')],{'as':'Field','foreignKey':_0xdf3a('0x1ca')});db[_0xdf3a('0x9a')][_0xdf3a('0x11e')](db[_0xdf3a('0x88')],{'as':_0xdf3a('0x88'),'foreignKey':_0xdf3a('0x1cb')});db[_0xdf3a('0x9c')][_0xdf3a('0x10e')](db[_0xdf3a('0x9e')],{'as':'Configurations','onDelete':_0xdf3a('0x10a'),'foreignKey':_0xdf3a('0x1c3')});db[_0xdf3a('0x9e')][_0xdf3a('0x10e')](db[_0xdf3a('0x9f')],{'as':'Subjects','onDelete':_0xdf3a('0x10a'),'foreignKey':'SubjectId'});db['SugarcrmConfiguration'][_0xdf3a('0x10e')](db['SugarcrmField'],{'as':_0xdf3a('0x1cc'),'onDelete':'cascade','foreignKey':_0xdf3a('0x1c9')});db[_0xdf3a('0x9e')][_0xdf3a('0x10e')](db[_0xdf3a('0x9f')],{'as':_0xdf3a('0x1be'),'onDelete':'cascade','foreignKey':_0xdf3a('0x1ca')});db['SugarcrmConfiguration']['belongsTo'](db[_0xdf3a('0x9c')],{'as':_0xdf3a('0x166'),'foreignKey':'AccountId'});db['SugarcrmField'][_0xdf3a('0x10e')](db[_0xdf3a('0x9f')],{'as':'Subject','foreignKey':'SubjectId'});db[_0xdf3a('0x9f')][_0xdf3a('0x10e')](db[_0xdf3a('0x9f')],{'as':'Description','foreignKey':_0xdf3a('0x1c9')});db[_0xdf3a('0x9f')][_0xdf3a('0x10e')](db['SugarcrmField'],{'as':_0xdf3a('0x1cd'),'foreignKey':_0xdf3a('0x1ca')});db['SugarcrmField'][_0xdf3a('0x11e')](db[_0xdf3a('0x88')],{'as':'Variable','foreignKey':'VariableId'});db[_0xdf3a('0xa1')]['hasMany'](db['DeskConfiguration'],{'as':'Configurations','onDelete':'cascade','foreignKey':_0xdf3a('0x1c3')});db[_0xdf3a('0x1ce')][_0xdf3a('0x10e')](db[_0xdf3a('0x1cf')],{'as':'Subjects','onDelete':'cascade','foreignKey':_0xdf3a('0x1c7')});db[_0xdf3a('0x1ce')][_0xdf3a('0x10e')](db[_0xdf3a('0x1cf')],{'as':_0xdf3a('0x1cc'),'onDelete':'cascade','foreignKey':'DescriptionId'});db[_0xdf3a('0x1ce')][_0xdf3a('0x10e')](db[_0xdf3a('0x1cf')],{'as':_0xdf3a('0x1be'),'onDelete':'cascade','foreignKey':_0xdf3a('0x1ca')});db['DeskConfiguration'][_0xdf3a('0x11e')](db[_0xdf3a('0xa1')],{'as':_0xdf3a('0x166'),'foreignKey':'AccountId'});db['DeskConfiguration'][_0xdf3a('0x120')](db['Tag'],{'through':'int_desk_configuration_has_tags'});db[_0xdf3a('0x1cf')][_0xdf3a('0x10e')](db[_0xdf3a('0x1cf')],{'as':_0xdf3a('0x1c6'),'foreignKey':_0xdf3a('0x1c7')});db['DeskField']['hasMany'](db[_0xdf3a('0x1cf')],{'as':_0xdf3a('0x1c8'),'foreignKey':_0xdf3a('0x1c9')});db[_0xdf3a('0x1cf')][_0xdf3a('0x10e')](db['DeskField'],{'as':_0xdf3a('0x1cd'),'foreignKey':_0xdf3a('0x1ca')});db[_0xdf3a('0x1cf')]['belongsTo'](db[_0xdf3a('0x88')],{'as':_0xdf3a('0x88'),'foreignKey':'VariableId'});db['ZohoAccount'][_0xdf3a('0x10e')](db['ZohoConfiguration'],{'as':_0xdf3a('0x1c2'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0xdf3a('0xa4')][_0xdf3a('0x10e')](db['ZohoField'],{'as':_0xdf3a('0x1c5'),'onDelete':'cascade','foreignKey':_0xdf3a('0x1c7')});db[_0xdf3a('0xa4')]['hasMany'](db[_0xdf3a('0xa6')],{'as':'Descriptions','onDelete':_0xdf3a('0x10a'),'foreignKey':_0xdf3a('0x1c9')});db[_0xdf3a('0xa4')][_0xdf3a('0x10e')](db[_0xdf3a('0xa6')],{'as':_0xdf3a('0x1be'),'onDelete':_0xdf3a('0x10a'),'foreignKey':_0xdf3a('0x1ca')});db['ZohoConfiguration'][_0xdf3a('0x11e')](db['ZohoAccount'],{'as':'Account','foreignKey':_0xdf3a('0x1c3')});db[_0xdf3a('0xa6')][_0xdf3a('0x10e')](db[_0xdf3a('0xa6')],{'as':_0xdf3a('0x1c6'),'foreignKey':_0xdf3a('0x1c7')});db[_0xdf3a('0xa6')][_0xdf3a('0x10e')](db[_0xdf3a('0xa6')],{'as':_0xdf3a('0x1c8'),'foreignKey':_0xdf3a('0x1c9')});db[_0xdf3a('0xa6')]['hasMany'](db[_0xdf3a('0xa6')],{'as':_0xdf3a('0x1cd'),'foreignKey':_0xdf3a('0x1ca')});db['ZohoField']['belongsTo'](db['Variable'],{'as':_0xdf3a('0x88'),'foreignKey':_0xdf3a('0x1cb')});db[_0xdf3a('0xa8')]['hasMany'](db['ZendeskConfiguration'],{'as':_0xdf3a('0x1c2'),'onDelete':_0xdf3a('0x10a'),'foreignKey':_0xdf3a('0x1c3')});db['ZendeskConfiguration'][_0xdf3a('0x10e')](db['ZendeskField'],{'as':_0xdf3a('0x1c5'),'foreignKey':'SubjectId'});db['ZendeskConfiguration'][_0xdf3a('0x10e')](db[_0xdf3a('0xab')],{'as':'Descriptions','foreignKey':'DescriptionId'});db[_0xdf3a('0xa9')][_0xdf3a('0x10e')](db[_0xdf3a('0xab')],{'as':_0xdf3a('0x1be'),'foreignKey':_0xdf3a('0x1ca')});db[_0xdf3a('0xa9')][_0xdf3a('0x11e')](db['ZendeskAccount'],{'as':_0xdf3a('0x166'),'foreignKey':_0xdf3a('0x1c3')});db[_0xdf3a('0xa9')][_0xdf3a('0x120')](db[_0xdf3a('0x16a')],{'through':_0xdf3a('0x1d0')});db[_0xdf3a('0xab')]['hasMany'](db[_0xdf3a('0xab')],{'as':_0xdf3a('0x1c6'),'foreignKey':_0xdf3a('0x1c7')});db[_0xdf3a('0xab')][_0xdf3a('0x10e')](db[_0xdf3a('0xab')],{'as':'Description','foreignKey':'DescriptionId'});db[_0xdf3a('0xab')][_0xdf3a('0x10e')](db[_0xdf3a('0xab')],{'as':_0xdf3a('0x1cd'),'foreignKey':_0xdf3a('0x1ca')});db[_0xdf3a('0xab')][_0xdf3a('0x11e')](db[_0xdf3a('0x88')],{'as':'Variable','foreignKey':_0xdf3a('0x1cb')});db[_0xdf3a('0xac')][_0xdf3a('0x10e')](db['FreshdeskConfiguration'],{'as':_0xdf3a('0x1c2'),'onDelete':_0xdf3a('0x10a'),'foreignKey':_0xdf3a('0x1c3')});db[_0xdf3a('0x1d1')][_0xdf3a('0x10e')](db['FreshdeskField'],{'as':_0xdf3a('0x1c5'),'onDelete':_0xdf3a('0x10a'),'foreignKey':_0xdf3a('0x1c7')});db[_0xdf3a('0x1d1')]['hasMany'](db[_0xdf3a('0xae')],{'as':_0xdf3a('0x1cc'),'onDelete':_0xdf3a('0x10a'),'foreignKey':_0xdf3a('0x1c9')});db[_0xdf3a('0x1d1')][_0xdf3a('0x10e')](db[_0xdf3a('0xae')],{'as':_0xdf3a('0x1be'),'onDelete':'cascade','foreignKey':'FieldId'});db[_0xdf3a('0x1d1')]['belongsTo'](db[_0xdf3a('0xac')],{'as':_0xdf3a('0x166'),'foreignKey':'AccountId'});db['FreshdeskConfiguration'][_0xdf3a('0x120')](db[_0xdf3a('0x16a')],{'through':_0xdf3a('0x1d2')});db[_0xdf3a('0xae')][_0xdf3a('0x10e')](db[_0xdf3a('0xae')],{'as':_0xdf3a('0x1c6'),'foreignKey':_0xdf3a('0x1c7')});db['FreshdeskField']['hasMany'](db[_0xdf3a('0xae')],{'as':_0xdf3a('0x1c8'),'foreignKey':_0xdf3a('0x1c9')});db[_0xdf3a('0xae')]['hasMany'](db[_0xdf3a('0xae')],{'as':_0xdf3a('0x1cd'),'foreignKey':_0xdf3a('0x1ca')});db['FreshdeskField'][_0xdf3a('0x11e')](db[_0xdf3a('0x88')],{'as':_0xdf3a('0x88'),'foreignKey':_0xdf3a('0x1cb')});db['VtigerAccount'][_0xdf3a('0x10e')](db[_0xdf3a('0xb1')],{'as':_0xdf3a('0x1c2'),'onDelete':'cascade','foreignKey':_0xdf3a('0x1c3')});db[_0xdf3a('0xb1')][_0xdf3a('0x10e')](db['VtigerField'],{'as':'Subjects','foreignKey':_0xdf3a('0x1c7')});db['VtigerConfiguration']['hasMany'](db[_0xdf3a('0xb2')],{'as':_0xdf3a('0x1cc'),'foreignKey':'DescriptionId'});db[_0xdf3a('0xb1')][_0xdf3a('0x10e')](db[_0xdf3a('0xb2')],{'as':'Fields','foreignKey':_0xdf3a('0x1ca')});db[_0xdf3a('0xb1')]['belongsTo'](db[_0xdf3a('0xaf')],{'as':_0xdf3a('0x166'),'foreignKey':_0xdf3a('0x1c3')});db[_0xdf3a('0xb2')]['hasMany'](db[_0xdf3a('0xb2')],{'as':'Subject','foreignKey':_0xdf3a('0x1c7')});db['VtigerField'][_0xdf3a('0x10e')](db['VtigerField'],{'as':_0xdf3a('0x1c8'),'foreignKey':'DescriptionId'});db[_0xdf3a('0xb2')]['hasMany'](db['VtigerField'],{'as':'Field','foreignKey':_0xdf3a('0x1ca')});db['VtigerField'][_0xdf3a('0x11e')](db[_0xdf3a('0x88')],{'as':'Variable','foreignKey':_0xdf3a('0x1cb')});db[_0xdf3a('0xb4')][_0xdf3a('0x10e')](db['ServicenowConfiguration'],{'as':'Configurations','onDelete':'cascade','foreignKey':_0xdf3a('0x1c3')});db[_0xdf3a('0xb6')][_0xdf3a('0x10e')](db[_0xdf3a('0x1d3')],{'as':_0xdf3a('0x1c5'),'foreignKey':_0xdf3a('0x1c7')});db[_0xdf3a('0xb6')]['hasMany'](db[_0xdf3a('0x1d3')],{'as':_0xdf3a('0x1cc'),'foreignKey':'DescriptionId'});db[_0xdf3a('0xb6')]['hasMany'](db['ServicenowField'],{'as':_0xdf3a('0x1be'),'foreignKey':_0xdf3a('0x1ca')});db[_0xdf3a('0xb6')]['belongsTo'](db[_0xdf3a('0xb4')],{'as':'Account','foreignKey':_0xdf3a('0x1c3')});db[_0xdf3a('0x1d3')][_0xdf3a('0x10e')](db[_0xdf3a('0x1d3')],{'as':_0xdf3a('0x1c6'),'foreignKey':_0xdf3a('0x1c7')});db[_0xdf3a('0x1d3')][_0xdf3a('0x10e')](db['ServicenowField'],{'as':_0xdf3a('0x1c8'),'foreignKey':_0xdf3a('0x1c9')});db[_0xdf3a('0x1d3')][_0xdf3a('0x10e')](db[_0xdf3a('0x1d3')],{'as':_0xdf3a('0x1cd'),'foreignKey':_0xdf3a('0x1ca')});db[_0xdf3a('0x1d3')]['belongsTo'](db['Variable'],{'as':_0xdf3a('0x88'),'foreignKey':_0xdf3a('0x1cb')});db[_0xdf3a('0xb7')][_0xdf3a('0x10e')](db['Dynamics365Configuration'],{'as':'Configurations','onDelete':_0xdf3a('0x10a'),'foreignKey':_0xdf3a('0x1c3')});db[_0xdf3a('0xb7')]['belongsTo'](db[_0xdf3a('0xfc')],{'as':_0xdf3a('0xfc'),'foreignKey':_0xdf3a('0x15b')});db[_0xdf3a('0xb9')]['hasMany'](db[_0xdf3a('0xba')],{'as':_0xdf3a('0x1c5'),'onDelete':'cascade','foreignKey':_0xdf3a('0x1c7')});db[_0xdf3a('0xb9')]['hasMany'](db[_0xdf3a('0xba')],{'as':_0xdf3a('0x1cc'),'onDelete':_0xdf3a('0x10a'),'foreignKey':'DescriptionId'});db['Dynamics365Configuration'][_0xdf3a('0x10e')](db[_0xdf3a('0xba')],{'as':_0xdf3a('0x1be'),'onDelete':_0xdf3a('0x10a'),'foreignKey':'FieldId'});db[_0xdf3a('0xb9')]['belongsTo'](db[_0xdf3a('0xb7')],{'as':_0xdf3a('0x166'),'foreignKey':_0xdf3a('0x1c3')});db[_0xdf3a('0xba')]['hasMany'](db[_0xdf3a('0xba')],{'as':_0xdf3a('0x1c6'),'foreignKey':'SubjectId'});db[_0xdf3a('0xba')][_0xdf3a('0x10e')](db[_0xdf3a('0xba')],{'as':_0xdf3a('0x1c8'),'foreignKey':_0xdf3a('0x1c9')});db[_0xdf3a('0xba')][_0xdf3a('0x10e')](db['Dynamics365Field'],{'as':'Field','foreignKey':'FieldId'});db['Dynamics365Field'][_0xdf3a('0x11e')](db['Variable'],{'as':'Variable','foreignKey':_0xdf3a('0x1cb')});db['FreshsalesAccount'][_0xdf3a('0x10e')](db[_0xdf3a('0xbe')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0xdf3a('0x1c3')});db[_0xdf3a('0xbe')]['hasMany'](db[_0xdf3a('0xc0')],{'as':_0xdf3a('0x1c5'),'foreignKey':'SubjectId'});db[_0xdf3a('0xbe')][_0xdf3a('0x10e')](db['FreshsalesField'],{'as':_0xdf3a('0x1cc'),'foreignKey':'DescriptionId'});db[_0xdf3a('0xbe')]['hasMany'](db[_0xdf3a('0xc0')],{'as':_0xdf3a('0x1be'),'foreignKey':_0xdf3a('0x1ca')});db[_0xdf3a('0xbe')][_0xdf3a('0x11e')](db[_0xdf3a('0xbc')],{'as':'Account','foreignKey':_0xdf3a('0x1c3')});db[_0xdf3a('0xc0')][_0xdf3a('0x10e')](db['FreshsalesField'],{'as':_0xdf3a('0x1c6'),'foreignKey':_0xdf3a('0x1c7')});db[_0xdf3a('0xc0')][_0xdf3a('0x10e')](db[_0xdf3a('0xc0')],{'as':_0xdf3a('0x1c8'),'foreignKey':_0xdf3a('0x1c9')});db[_0xdf3a('0xc0')][_0xdf3a('0x10e')](db['FreshsalesField'],{'as':'Field','foreignKey':_0xdf3a('0x1ca')});db[_0xdf3a('0xc0')][_0xdf3a('0x11e')](db[_0xdf3a('0x88')],{'as':'Variable','foreignKey':_0xdf3a('0x1cb')});db[_0xdf3a('0xc4')]['belongsTo'](db[_0xdf3a('0x57')],{});db[_0xdf3a('0xc4')][_0xdf3a('0x11e')](db['CmList'],{'as':'List','foreignKey':_0xdf3a('0x162')});db['ChatQueueReport']['belongsTo'](db['CmContact'],{'as':_0xdf3a('0x157'),'foreignKey':_0xdf3a('0x158')});db[_0xdf3a('0xc4')][_0xdf3a('0x11e')](db[_0xdf3a('0x115')],{});db[_0xdf3a('0xc4')][_0xdf3a('0x11e')](db[_0xdf3a('0x5b')],{});db['ChatQueueReport'][_0xdf3a('0x11e')](db['User'],{});db[_0xdf3a('0xc4')][_0xdf3a('0x11e')](db['ChatQueue'],{});db[_0xdf3a('0x195')]['belongsTo'](db[_0xdf3a('0x107')],{'onDelete':_0xdf3a('0x10a'),'foreignKey':_0xdf3a('0x1d4')});db[_0xdf3a('0x195')][_0xdf3a('0x11e')](db['User'],{'onDelete':'cascade','foreignKey':_0xdf3a('0x1d5')});db['JscriptySessionReport'][_0xdf3a('0x10e')](db[_0xdf3a('0xc8')],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0xdf3a('0xca')]['hasMany'](db[_0xdf3a('0x1d6')],{'foreignKey':_0xdf3a('0x1d7'),'onDelete':_0xdf3a('0x10a')});db[_0xdf3a('0x1d8')][_0xdf3a('0x11e')](db[_0xdf3a('0x4c')],{});db[_0xdf3a('0x1d8')]['belongsTo'](db['CmList'],{'as':'List','foreignKey':_0xdf3a('0x162')});db['SmsQueueReport']['belongsTo'](db[_0xdf3a('0x65')],{'as':_0xdf3a('0x157'),'foreignKey':_0xdf3a('0x158')});db[_0xdf3a('0x1d8')][_0xdf3a('0x11e')](db[_0xdf3a('0x4e')],{});db[_0xdf3a('0x1d8')][_0xdf3a('0x11e')](db['SmsMessage'],{});db[_0xdf3a('0x1d8')][_0xdf3a('0x11e')](db[_0xdf3a('0x107')],{});db[_0xdf3a('0x1d8')][_0xdf3a('0x11e')](db['SmsQueue'],{});db['JscriptyProject'][_0xdf3a('0x10e')](db[_0xdf3a('0xca')],{'foreignKey':_0xdf3a('0x1d9')});db['JscriptyProject']['hasMany'](db[_0xdf3a('0xc8')],{'foreignKey':'ProjectId'});db[_0xdf3a('0x1da')]['hasMany'](db[_0xdf3a('0x1d6')],{'foreignKey':'ProjectId'});db[_0xdf3a('0xd7')][_0xdf3a('0x120')](db[_0xdf3a('0x107')],{'as':_0xdf3a('0x163'),'through':_0xdf3a('0x1db')});db[_0xdf3a('0xd7')][_0xdf3a('0x120')](db['VoiceQueue'],{'through':_0xdf3a('0xfe'),'as':_0xdf3a('0x12b')});db['Team'][_0xdf3a('0x120')](db[_0xdf3a('0x39')],{'through':_0xdf3a('0x164'),'as':'MailQueues'});db['Team']['belongsToMany'](db[_0xdf3a('0x5e')],{'through':'team_has_chat_queues','as':_0xdf3a('0x131')});db['Team'][_0xdf3a('0x120')](db[_0xdf3a('0x4a')],{'through':_0xdf3a('0x17c'),'as':'FaxQueues'});db[_0xdf3a('0xd7')][_0xdf3a('0x120')](db[_0xdf3a('0x4f')],{'through':_0xdf3a('0x184'),'as':_0xdf3a('0x133')});db[_0xdf3a('0xd7')]['belongsToMany'](db['OpenchannelQueue'],{'through':'team_has_openchannel_queues','as':_0xdf3a('0x134')});db[_0xdf3a('0xd7')][_0xdf3a('0x120')](db['WhatsappQueue'],{'through':_0xdf3a('0x1dc'),'as':_0xdf3a('0x1dd')});db[_0xdf3a('0xd7')][_0xdf3a('0x120')](db['VoicePrefix'],{'through':_0xdf3a('0x100'),'as':_0xdf3a('0x12e')});db[_0xdf3a('0xdb')][_0xdf3a('0x10e')](db[_0xdf3a('0x67')],{'as':_0xdf3a('0x11c'),'foreignKey':_0xdf3a('0x1a1')});db['Campaign'][_0xdf3a('0x10e')](db[_0xdf3a('0x6b')],{'as':_0xdf3a('0x111'),'foreignKey':_0xdf3a('0x1a1')});db[_0xdf3a('0xdb')][_0xdf3a('0x10e')](db[_0xdf3a('0x6d')],{'as':_0xdf3a('0x147'),'foreignKey':_0xdf3a('0x1a1')});db['Campaign'][_0xdf3a('0x10e')](db['CmHopperBlack'],{'as':_0xdf3a('0x148'),'foreignKey':_0xdf3a('0x1a1')});db[_0xdf3a('0xdb')][_0xdf3a('0x11e')](db[_0xdf3a('0x28')],{'as':'Trunk','foreignKey':_0xdf3a('0x149')});db[_0xdf3a('0xdb')][_0xdf3a('0x11e')](db['Trunk'],{'as':_0xdf3a('0x14a'),'foreignKey':'TrunkBackupId'});db[_0xdf3a('0xdb')]['belongsTo'](db[_0xdf3a('0x77')],{'as':'Interval','foreignKey':_0xdf3a('0x14c')});db['Campaign']['belongsTo'](db[_0xdf3a('0xd2')],{'as':'SquareProject','foreignKey':_0xdf3a('0x1de')});db[_0xdf3a('0xdb')][_0xdf3a('0x120')](db[_0xdf3a('0xeb')],{'as':'Lists','through':_0xdf3a('0x1df')});db[_0xdf3a('0xdb')][_0xdf3a('0x120')](db['CmList'],{'as':_0xdf3a('0x150'),'through':_0xdf3a('0x1e0')});db[_0xdf3a('0x16c')][_0xdf3a('0x11e')](db[_0xdf3a('0x5d')],{'as':_0xdf3a('0x5d'),'foreignKey':'ChatOfflineMessageId'});db[_0xdf3a('0xe1')][_0xdf3a('0x11e')](db[_0xdf3a('0x3e')],{});db[_0xdf3a('0xe1')][_0xdf3a('0x11e')](db['MailInteraction'],{});db[_0xdf3a('0xe1')][_0xdf3a('0x11e')](db[_0xdf3a('0x138')],{'foreignKey':_0xdf3a('0x1e1'),'as':_0xdf3a('0x1e2')});db[_0xdf3a('0xe1')]['belongsTo'](db[_0xdf3a('0x107')],{'foreignKey':_0xdf3a('0x1e3'),'as':_0xdf3a('0x1e4')});db['MailTransferReport']['belongsTo'](db['User'],{'foreignKey':_0xdf3a('0x1e5'),'as':_0xdf3a('0x1e6')});db[_0xdf3a('0xe1')]['belongsTo'](db[_0xdf3a('0x39')],{'foreignKey':_0xdf3a('0x1e7'),'as':'ToQueue'});db[_0xdf3a('0xe1')][_0xdf3a('0x11e')](db['MailAccount'],{'foreignKey':'ToMailAccountId','as':'ToAccount'});db[_0xdf3a('0xe3')][_0xdf3a('0x11e')](db[_0xdf3a('0x5b')],{});db[_0xdf3a('0xe3')][_0xdf3a('0x11e')](db['ChatInteraction'],{});db[_0xdf3a('0xe3')][_0xdf3a('0x11e')](db[_0xdf3a('0x57')],{'foreignKey':_0xdf3a('0x1e8'),'as':_0xdf3a('0x1e2')});db[_0xdf3a('0xe3')][_0xdf3a('0x11e')](db[_0xdf3a('0x107')],{'foreignKey':'FromUserId','as':_0xdf3a('0x1e4')});db[_0xdf3a('0xe3')]['belongsTo'](db[_0xdf3a('0x107')],{'foreignKey':_0xdf3a('0x1e5'),'as':_0xdf3a('0x1e6')});db[_0xdf3a('0xe3')][_0xdf3a('0x11e')](db[_0xdf3a('0x5e')],{'foreignKey':_0xdf3a('0x1e9'),'as':_0xdf3a('0x1ea')});db['ChatTransferReport'][_0xdf3a('0x11e')](db['ChatWebsite'],{'foreignKey':_0xdf3a('0x1eb'),'as':_0xdf3a('0x1ec')});db[_0xdf3a('0xe5')]['belongsTo'](db[_0xdf3a('0x49')],{});db[_0xdf3a('0xe5')]['belongsTo'](db[_0xdf3a('0x48')],{});db[_0xdf3a('0xe5')][_0xdf3a('0x11e')](db[_0xdf3a('0x46')],{'foreignKey':'FromFaxAccountId','as':'FromAccount'});db[_0xdf3a('0xe5')][_0xdf3a('0x11e')](db[_0xdf3a('0x107')],{'foreignKey':_0xdf3a('0x1e3'),'as':_0xdf3a('0x1e4')});db[_0xdf3a('0xe5')][_0xdf3a('0x11e')](db[_0xdf3a('0x107')],{'foreignKey':_0xdf3a('0x1e5'),'as':_0xdf3a('0x1e6')});db[_0xdf3a('0xe5')][_0xdf3a('0x11e')](db[_0xdf3a('0x4a')],{'foreignKey':'ToFaxQueueId','as':_0xdf3a('0x1ea')});db['FaxTransferReport'][_0xdf3a('0x11e')](db['FaxAccount'],{'foreignKey':_0xdf3a('0x1ed'),'as':'ToAccount'});db[_0xdf3a('0xe7')][_0xdf3a('0x11e')](db[_0xdf3a('0x186')],{});db[_0xdf3a('0xe7')][_0xdf3a('0x11e')](db['OpenchannelInteraction'],{});db[_0xdf3a('0xe7')][_0xdf3a('0x11e')](db[_0xdf3a('0x13b')],{'foreignKey':_0xdf3a('0x1ee'),'as':_0xdf3a('0x1e2')});db[_0xdf3a('0xe7')][_0xdf3a('0x11e')](db[_0xdf3a('0x107')],{'foreignKey':_0xdf3a('0x1e3'),'as':'FromAgent'});db[_0xdf3a('0xe7')][_0xdf3a('0x11e')](db[_0xdf3a('0x107')],{'foreignKey':_0xdf3a('0x1e5'),'as':_0xdf3a('0x1e6')});db['OpenchannelTransferReport'][_0xdf3a('0x11e')](db['OpenchannelQueue'],{'foreignKey':_0xdf3a('0x1ef'),'as':_0xdf3a('0x1ea')});db[_0xdf3a('0xe7')][_0xdf3a('0x11e')](db['OpenchannelAccount'],{'foreignKey':_0xdf3a('0x1f0'),'as':'ToAccount'});db['SmsTransferReport'][_0xdf3a('0x11e')](db[_0xdf3a('0x17f')],{});db['SmsTransferReport'][_0xdf3a('0x11e')](db[_0xdf3a('0x4e')],{});db[_0xdf3a('0xe9')][_0xdf3a('0x11e')](db[_0xdf3a('0x4c')],{'foreignKey':_0xdf3a('0x1f1'),'as':_0xdf3a('0x1e2')});db['SmsTransferReport'][_0xdf3a('0x11e')](db['User'],{'foreignKey':_0xdf3a('0x1e3'),'as':_0xdf3a('0x1e4')});db[_0xdf3a('0xe9')]['belongsTo'](db[_0xdf3a('0x107')],{'foreignKey':_0xdf3a('0x1e5'),'as':'ToAgent'});db[_0xdf3a('0xe9')][_0xdf3a('0x11e')](db[_0xdf3a('0x4f')],{'foreignKey':_0xdf3a('0x1f2'),'as':'ToQueue'});db['SmsTransferReport'][_0xdf3a('0x11e')](db[_0xdf3a('0x4c')],{'foreignKey':_0xdf3a('0x1f3'),'as':_0xdf3a('0x1ec')});db[_0xdf3a('0xeb')][_0xdf3a('0x10e')](db[_0xdf3a('0x171')],{'as':_0xdf3a('0x15e'),'foreignKey':_0xdf3a('0x162'),'onDelete':_0xdf3a('0x10a')});db[_0xdf3a('0xeb')][_0xdf3a('0x10e')](db['CmCustomField'],{'as':_0xdf3a('0x1f4'),'foreignKey':'ListId'});db['CmList']['hasMany'](db[_0xdf3a('0x65')],{'as':_0xdf3a('0x123'),'onDelete':_0xdf3a('0x10a'),'foreignKey':_0xdf3a('0x162')});db[_0xdf3a('0xeb')]['hasMany'](db[_0xdf3a('0x6b')],{'as':_0xdf3a('0x111'),'foreignKey':_0xdf3a('0x162')});db[_0xdf3a('0xeb')][_0xdf3a('0x10e')](db['CmHopperHistory'],{'as':_0xdf3a('0x112'),'foreignKey':'ListId'});db['CmList'][_0xdf3a('0x10e')](db['ReportAgentPreview'],{'as':_0xdf3a('0x113'),'foreignKey':_0xdf3a('0x162')});db[_0xdf3a('0xeb')][_0xdf3a('0x120')](db['VoiceQueue'],{'as':_0xdf3a('0x1f5'),'through':_0xdf3a('0x1f6')});db[_0xdf3a('0xeb')]['belongsToMany'](db[_0xdf3a('0x107')],{'as':_0xdf3a('0x163'),'through':_0xdf3a('0x126')});db['VoicePrefix'][_0xdf3a('0x10e')](db[_0xdf3a('0x16')],{'as':_0xdf3a('0x110'),'onDelete':_0xdf3a('0x10a')});db[_0xdf3a('0x12d')][_0xdf3a('0x120')](db[_0xdf3a('0x107')],{'as':_0xdf3a('0x163'),'through':_0xdf3a('0x102')});db['VoicePrefix'][_0xdf3a('0x120')](db[_0xdf3a('0xd7')],{'through':_0xdf3a('0x100'),'as':_0xdf3a('0x14f')});db[_0xdf3a('0xed')][_0xdf3a('0x10e')](db[_0xdf3a('0x107')],{'as':'Users','foreignKey':_0xdf3a('0x11f')});db[_0xdf3a('0xed')][_0xdf3a('0x10e')](db[_0xdf3a('0xee')],{'as':_0xdf3a('0x1f7'),'foreignKey':_0xdf3a('0x11f'),'onDelete':_0xdf3a('0x10a')});db[_0xdf3a('0xee')][_0xdf3a('0x10e')](db['UserProfileResource'],{'as':_0xdf3a('0x1f8'),'foreignKey':_0xdf3a('0x1f9'),'onDelete':_0xdf3a('0x10a')});db[_0xdf3a('0xf3')][_0xdf3a('0x10e')](db[_0xdf3a('0x171')],{'as':'Dispositions','foreignKey':_0xdf3a('0x1fa'),'onDelete':_0xdf3a('0x10a')});db[_0xdf3a('0xf3')]['hasMany'](db[_0xdf3a('0x15f')],{'as':'Answers','foreignKey':'WhatsappAccountId'});db[_0xdf3a('0xf3')][_0xdf3a('0x10e')](db['WhatsappMessage'],{'as':_0xdf3a('0x152'),'foreignKey':_0xdf3a('0x1fa')});db[_0xdf3a('0xf3')][_0xdf3a('0x10e')](db[_0xdf3a('0xf6')],{'as':_0xdf3a('0x160')});db[_0xdf3a('0xf3')]['hasMany'](db[_0xdf3a('0xf4')],{'as':_0xdf3a('0x143'),'foreignKey':'WhatsappAccountId','onDelete':_0xdf3a('0x10a')});db[_0xdf3a('0xf3')][_0xdf3a('0x11e')](db[_0xdf3a('0xeb')],{'as':_0xdf3a('0x161'),'foreignKey':_0xdf3a('0x162')});db[_0xdf3a('0xf3')][_0xdf3a('0x11e')](db[_0xdf3a('0x79')],{'as':_0xdf3a('0x14d'),'foreignKey':_0xdf3a('0x14e')});db[_0xdf3a('0xf3')][_0xdf3a('0x120')](db[_0xdf3a('0x107')],{'as':_0xdf3a('0x163'),'through':'user_has_whatsapp_accounts'});db['WhatsappApplication'][_0xdf3a('0x11e')](db[_0xdf3a('0x107')],{'onDelete':'restrict'});db[_0xdf3a('0xf4')][_0xdf3a('0x11e')](db[_0xdf3a('0x1fb')],{'onDelete':_0xdf3a('0x15c')});db['WhatsappApplication'][_0xdf3a('0x11e')](db[_0xdf3a('0xf3')],{'onDelete':_0xdf3a('0x15c')});db[_0xdf3a('0xf4')][_0xdf3a('0x11e')](db['Interval'],{'onDelete':_0xdf3a('0x15c'),'foreignKey':_0xdf3a('0x14c')});db[_0xdf3a('0xf4')][_0xdf3a('0x11e')](db[_0xdf3a('0x16a')],{'onDelete':_0xdf3a('0x15c'),'foreignKey':_0xdf3a('0x177')});db[_0xdf3a('0xf6')][_0xdf3a('0x10e')](db[_0xdf3a('0xf8')],{'as':'Messages','onDelete':_0xdf3a('0x10a'),'foreignKey':_0xdf3a('0x1fc')});db[_0xdf3a('0xf6')][_0xdf3a('0x11e')](db[_0xdf3a('0xf3')],{'as':_0xdf3a('0x166'),'foreignKey':'WhatsappAccountId'});db[_0xdf3a('0xf6')]['belongsTo'](db[_0xdf3a('0x65')],{'as':_0xdf3a('0x157'),'foreignKey':_0xdf3a('0x158')});db['WhatsappInteraction']['belongsTo'](db[_0xdf3a('0x107')],{'as':'Owner','foreignKey':'UserId'});db[_0xdf3a('0xf6')][_0xdf3a('0x120')](db[_0xdf3a('0x16a')],{'through':'whatsapp_interaction_has_tags','as':_0xdf3a('0x169')});db[_0xdf3a('0xf6')]['belongsToMany'](db[_0xdf3a('0x16a')],{'through':'whatsapp_interaction_has_tags','as':'ThroughTags'});db[_0xdf3a('0xf6')][_0xdf3a('0x120')](db[_0xdf3a('0x107')],{'as':_0xdf3a('0x16b'),'through':'user_has_whatsapp_interactions','foreignKey':_0xdf3a('0x1fc')});db['WhatsappMessage'][_0xdf3a('0x11e')](db[_0xdf3a('0x107')],{'as':_0xdf3a('0x107')});db[_0xdf3a('0xf8')]['belongsTo'](db[_0xdf3a('0x65')],{'onDelete':'cascade','as':_0xdf3a('0x157')});db['WhatsappMessage'][_0xdf3a('0x11e')](db[_0xdf3a('0xf6')],{'onDelete':'cascade','as':_0xdf3a('0x16e'),'foreignKey':_0xdf3a('0x1fc')});db[_0xdf3a('0xf8')][_0xdf3a('0x11e')](db[_0xdf3a('0xf3')],{'as':'Account','foreignKey':_0xdf3a('0x1fa')});db[_0xdf3a('0x1fd')][_0xdf3a('0x11e')](db['WhatsappAccount'],{});db[_0xdf3a('0x1fd')]['belongsTo'](db[_0xdf3a('0xeb')],{'as':_0xdf3a('0x161'),'foreignKey':_0xdf3a('0x162')});db[_0xdf3a('0x1fd')]['belongsTo'](db['CmContact'],{'as':_0xdf3a('0x157'),'foreignKey':_0xdf3a('0x158')});db['WhatsappQueueReport'][_0xdf3a('0x11e')](db[_0xdf3a('0xf6')],{});db['WhatsappQueueReport'][_0xdf3a('0x11e')](db[_0xdf3a('0x1fb')],{});db[_0xdf3a('0x1fd')][_0xdf3a('0x11e')](db['WhatsappMessage'],{});db[_0xdf3a('0x1fd')][_0xdf3a('0x11e')](db[_0xdf3a('0x107')],{});db[_0xdf3a('0x1fe')][_0xdf3a('0x11e')](db[_0xdf3a('0xf8')],{});db['WhatsappTransferReport'][_0xdf3a('0x11e')](db['WhatsappInteraction'],{});db[_0xdf3a('0x1fe')][_0xdf3a('0x11e')](db[_0xdf3a('0xf3')],{'foreignKey':_0xdf3a('0x1ff'),'as':_0xdf3a('0x1e2')});db['WhatsappTransferReport'][_0xdf3a('0x11e')](db['WhatsappAccount'],{'foreignKey':_0xdf3a('0x200'),'as':_0xdf3a('0x1ec')});db[_0xdf3a('0x1fe')][_0xdf3a('0x11e')](db[_0xdf3a('0x1fb')],{'foreignKey':_0xdf3a('0x201'),'as':_0xdf3a('0x1ea')});db[_0xdf3a('0x1fe')][_0xdf3a('0x11e')](db['User'],{'foreignKey':'FromUserId','as':_0xdf3a('0x1e4')});db[_0xdf3a('0x1fe')]['belongsTo'](db[_0xdf3a('0x107')],{'foreignKey':'ToUserId','as':_0xdf3a('0x1e6')});db[_0xdf3a('0x1fb')][_0xdf3a('0x120')](db[_0xdf3a('0x107')],{'as':_0xdf3a('0x163'),'through':_0xdf3a('0x35'),'foreignKey':_0xdf3a('0x202')});db[_0xdf3a('0x1fb')]['belongsToMany'](db[_0xdf3a('0xd7')],{'through':_0xdf3a('0x1dc'),'as':_0xdf3a('0x14f')});db[_0xdf3a('0x10c')]['belongsTo'](db[_0xdf3a('0x107')],{'as':_0xdf3a('0x203'),'foreignKey':'UserId','onDelete':_0xdf3a('0x10a'),'hooks':!![]});db['CloudProvider']['hasOne'](db[_0xdf3a('0xb7')],{'as':_0xdf3a('0xb7'),'onDelete':_0xdf3a('0x15c')});db[_0xdf3a('0xfc')][_0xdf3a('0x108')](db[_0xdf3a('0x36')],{'as':_0xdf3a('0x204'),'onDelete':_0xdf3a('0x15c')});db['CloudProvider'][_0xdf3a('0x108')](db[_0xdf3a('0x15a')],{'as':_0xdf3a('0x15d'),'onDelete':'restrict'});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index fc42667..20ac6ac 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1b9c=['./api/cannedAnswer','/api/dispositions','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/pauses','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','./api/schedule','/api/contact_item_types','./api/contactItemType','/api/cm_contact_has_items','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceConfiguration','./api/intSalesforceField','./api/intSugarcrmAccount','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','/api/integrations/zendesk/fields','./api/intZendeskField','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','/api/integrations/servicenow/accounts','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','/api/integrations/dynamics365/configurations','./api/intDynamics365Field','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','./api/intFreshsalesField','/api/chat/reports/queue','./api/chatQueueReport','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/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/team','/api/license','./api/license','/api/campaigns','/api/migrations','./api/migration','/api/attachments','/api/plugins','./api/plugin','./api/mailTransferReport','/api/chat/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/voicePrefix','/api/userProfiles','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/realtime','./api/realtime','/api/user-settings','/api/mail_interaction_has_tags','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/version','/api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/api/logs','static','join','/apidoc','/www','root','/demo','/snippet','snippet','3.9.0','/server/files/plugins','route','get','resolve','/index.html','path','express','./config/environment','./utils/client-side-logger','./api/client-side-logs','use','./api/user','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceQueueReport','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','./api/mailQueue','/api/mail/messages','/api/mail/applications','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','./api/dashboardItem','/api/fax/accounts','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','/api/sms/interactions','/api/sms/messages','./api/smsMessage','/api/openchannel/accounts','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','/api/openchannel/messages','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','/api/chat/messages','./api/chatMessage','./api/chatOfflineMessage','/api/chat/queues','/api/chat/groups','./api/chatGroup','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','/api/canned_answers'];(function(_0x45aed2,_0x25dcc1){var _0x22046c=function(_0xa14159){while(--_0xa14159){_0x45aed2['push'](_0x45aed2['shift']());}};_0x22046c(++_0x25dcc1);}(_0x1b9c,0x1ad));var _0xc1b9=function(_0x19ba65,_0x4f0ec7){_0x19ba65=_0x19ba65-0x0;var _0x3bb002=_0x1b9c[_0x19ba65];return _0x3bb002;};'use strict';var path=require(_0xc1b9('0x0'));var express=require(_0xc1b9('0x1'));var errors=require('./errors');var config=require(_0xc1b9('0x2'));var setupLoggers=require(_0xc1b9('0x3'))['setupLoggers'];var clientSideLogs=require(_0xc1b9('0x4'));exports['default']=function(_0x90b4e4){return setupLoggers(_0x90b4e4)['then'](function(){_0x90b4e4[_0xc1b9('0x5')]('/api/users',require(_0xc1b9('0x6')));_0x90b4e4['use']('/api/voice/chanspy',require(_0xc1b9('0x7')));_0x90b4e4[_0xc1b9('0x5')](_0xc1b9('0x8'),require(_0xc1b9('0x9')));_0x90b4e4[_0xc1b9('0x5')](_0xc1b9('0xa'),require(_0xc1b9('0xb')));_0x90b4e4[_0xc1b9('0x5')]('/api/voice/mohs',require('./api/voiceMusicOnHold'));_0x90b4e4[_0xc1b9('0x5')]('/api/voice/queues',require('./api/voiceQueue'));_0x90b4e4[_0xc1b9('0x5')](_0xc1b9('0xc'),require(_0xc1b9('0xd')));_0x90b4e4[_0xc1b9('0x5')](_0xc1b9('0xe'),require(_0xc1b9('0xf')));_0x90b4e4[_0xc1b9('0x5')](_0xc1b9('0x10'),require(_0xc1b9('0x11')));_0x90b4e4[_0xc1b9('0x5')](_0xc1b9('0x12'),require(_0xc1b9('0x13')));_0x90b4e4[_0xc1b9('0x5')](_0xc1b9('0x14'),require(_0xc1b9('0x15')));_0x90b4e4['use'](_0xc1b9('0x16'),require('./api/voiceDialReport'));_0x90b4e4[_0xc1b9('0x5')]('/api/voice/agents/reports',require('./api/voiceAgentReport'));_0x90b4e4['use']('/api/voice/queues/reports',require(_0xc1b9('0x17')));_0x90b4e4[_0xc1b9('0x5')]('/api/members/reports',require(_0xc1b9('0x18')));_0x90b4e4['use'](_0xc1b9('0x19'),require(_0xc1b9('0x1a')));_0x90b4e4[_0xc1b9('0x5')](_0xc1b9('0x1b'),require(_0xc1b9('0x1c')));_0x90b4e4[_0xc1b9('0x5')]('/api/mail/out_servers',require(_0xc1b9('0x1d')));_0x90b4e4['use'](_0xc1b9('0x1e'),require(_0xc1b9('0x1f')));_0x90b4e4[_0xc1b9('0x5')]('/api/mail/queues',require(_0xc1b9('0x20')));_0x90b4e4[_0xc1b9('0x5')]('/api/mail/substatuses',require('./api/mailSubstatus'));_0x90b4e4['use']('/api/mail/interactions',require('./api/mailInteraction'));_0x90b4e4[_0xc1b9('0x5')](_0xc1b9('0x21'),require('./api/mailMessage'));_0x90b4e4[_0xc1b9('0x5')](_0xc1b9('0x22'),require('./api/mailApplication'));_0x90b4e4[_0xc1b9('0x5')](_0xc1b9('0x23'),require(_0xc1b9('0x24')));_0x90b4e4[_0xc1b9('0x5')](_0xc1b9('0x25'),require(_0xc1b9('0x26')));_0x90b4e4[_0xc1b9('0x5')]('/api/dashboards/items',require(_0xc1b9('0x27')));_0x90b4e4[_0xc1b9('0x5')](_0xc1b9('0x28'),require('./api/faxAccount'));_0x90b4e4[_0xc1b9('0x5')]('/api/fax/applications',require('./api/faxApplication'));_0x90b4e4['use'](_0xc1b9('0x29'),require(_0xc1b9('0x2a')));_0x90b4e4['use'](_0xc1b9('0x2b'),require('./api/faxMessage'));_0x90b4e4[_0xc1b9('0x5')](_0xc1b9('0x2c'),require(_0xc1b9('0x2d')));_0x90b4e4[_0xc1b9('0x5')](_0xc1b9('0x2e'),require(_0xc1b9('0x2f')));_0x90b4e4['use'](_0xc1b9('0x30'),require(_0xc1b9('0x31')));_0x90b4e4[_0xc1b9('0x5')](_0xc1b9('0x32'),require('./api/smsApplication'));_0x90b4e4[_0xc1b9('0x5')](_0xc1b9('0x33'),require('./api/smsInteraction'));_0x90b4e4[_0xc1b9('0x5')](_0xc1b9('0x34'),require(_0xc1b9('0x35')));_0x90b4e4['use']('/api/sms/queues',require('./api/smsQueue'));_0x90b4e4[_0xc1b9('0x5')](_0xc1b9('0x36'),require('./api/openchannelAccount'));_0x90b4e4[_0xc1b9('0x5')](_0xc1b9('0x37'),require(_0xc1b9('0x38')));_0x90b4e4[_0xc1b9('0x5')](_0xc1b9('0x39'),require('./api/openchannelInteraction'));_0x90b4e4[_0xc1b9('0x5')](_0xc1b9('0x3a'),require('./api/openchannelMessage'));_0x90b4e4['use'](_0xc1b9('0x3b'),require(_0xc1b9('0x3c')));_0x90b4e4[_0xc1b9('0x5')](_0xc1b9('0x3d'),require(_0xc1b9('0x3e')));_0x90b4e4[_0xc1b9('0x5')](_0xc1b9('0x3f'),require(_0xc1b9('0x40')));_0x90b4e4[_0xc1b9('0x5')](_0xc1b9('0x41'),require(_0xc1b9('0x42')));_0x90b4e4['use'](_0xc1b9('0x43'),require('./api/chatInteraction'));_0x90b4e4['use'](_0xc1b9('0x44'),require(_0xc1b9('0x45')));_0x90b4e4[_0xc1b9('0x5')]('/api/chat/offline_messages',require(_0xc1b9('0x46')));_0x90b4e4[_0xc1b9('0x5')](_0xc1b9('0x47'),require('./api/chatQueue'));_0x90b4e4[_0xc1b9('0x5')](_0xc1b9('0x48'),require(_0xc1b9('0x49')));_0x90b4e4[_0xc1b9('0x5')]('/api/chat/proactive_actions',require('./api/chatProactiveAction'));_0x90b4e4[_0xc1b9('0x5')](_0xc1b9('0x4a'),require(_0xc1b9('0x4b')));_0x90b4e4[_0xc1b9('0x5')](_0xc1b9('0x4c'),require(_0xc1b9('0x4d')));_0x90b4e4[_0xc1b9('0x5')](_0xc1b9('0x4e'),require(_0xc1b9('0x4f')));_0x90b4e4[_0xc1b9('0x5')]('/api/cm/hopper_black',require(_0xc1b9('0x50')));_0x90b4e4[_0xc1b9('0x5')](_0xc1b9('0x51'),require(_0xc1b9('0x52')));_0x90b4e4['use'](_0xc1b9('0x53'),require(_0xc1b9('0x54')));_0x90b4e4[_0xc1b9('0x5')](_0xc1b9('0x55'),require(_0xc1b9('0x56')));_0x90b4e4['use'](_0xc1b9('0x57'),require(_0xc1b9('0x58')));_0x90b4e4[_0xc1b9('0x5')](_0xc1b9('0x59'),require('./api/automation'));_0x90b4e4[_0xc1b9('0x5')](_0xc1b9('0x5a'),require(_0xc1b9('0x5b')));_0x90b4e4[_0xc1b9('0x5')](_0xc1b9('0x5c'),require('./api/disposition'));_0x90b4e4['use'](_0xc1b9('0x5d'),require(_0xc1b9('0x5e')));_0x90b4e4[_0xc1b9('0x5')](_0xc1b9('0x5f'),require(_0xc1b9('0x60')));_0x90b4e4['use'](_0xc1b9('0x61'),require('./api/pause'));_0x90b4e4[_0xc1b9('0x5')](_0xc1b9('0x62'),require(_0xc1b9('0x63')));_0x90b4e4[_0xc1b9('0x5')](_0xc1b9('0x64'),require(_0xc1b9('0x65')));_0x90b4e4[_0xc1b9('0x5')]('/api/schedules',require(_0xc1b9('0x66')));_0x90b4e4['use']('/api/sounds',require('./api/sound'));_0x90b4e4[_0xc1b9('0x5')]('/api/tags',require('./api/tag'));_0x90b4e4[_0xc1b9('0x5')](_0xc1b9('0x67'),require(_0xc1b9('0x68')));_0x90b4e4[_0xc1b9('0x5')](_0xc1b9('0x69'),require('./api/cmContactHasItem'));_0x90b4e4[_0xc1b9('0x5')](_0xc1b9('0x6a'),require(_0xc1b9('0x6b')));_0x90b4e4[_0xc1b9('0x5')](_0xc1b9('0x6c'),require('./api/template'));_0x90b4e4[_0xc1b9('0x5')](_0xc1b9('0x6d'),require(_0xc1b9('0x6e')));_0x90b4e4[_0xc1b9('0x5')](_0xc1b9('0x6f'),require(_0xc1b9('0x70')));_0x90b4e4[_0xc1b9('0x5')]('/api/integrations',require('./api/integration'));_0x90b4e4[_0xc1b9('0x5')]('/api/integrations/reports',require('./api/integrationReport'));_0x90b4e4[_0xc1b9('0x5')](_0xc1b9('0x71'),require(_0xc1b9('0x72')));_0x90b4e4[_0xc1b9('0x5')](_0xc1b9('0x73'),require(_0xc1b9('0x74')));_0x90b4e4[_0xc1b9('0x5')](_0xc1b9('0x75'),require(_0xc1b9('0x76')));_0x90b4e4[_0xc1b9('0x5')](_0xc1b9('0x77'),require(_0xc1b9('0x78')));_0x90b4e4[_0xc1b9('0x5')](_0xc1b9('0x79'),require('./api/analyticFieldReport'));_0x90b4e4[_0xc1b9('0x5')](_0xc1b9('0x7a'),require(_0xc1b9('0x7b')));_0x90b4e4[_0xc1b9('0x5')](_0xc1b9('0x7c'),require('./api/intSalesforceAccount'));_0x90b4e4[_0xc1b9('0x5')]('/api/integrations/salesforce/configurations',require(_0xc1b9('0x7d')));_0x90b4e4[_0xc1b9('0x5')]('/api/integrations/salesforce/fields',require(_0xc1b9('0x7e')));_0x90b4e4[_0xc1b9('0x5')]('/api/integrations/sugarcrm/accounts',require(_0xc1b9('0x7f')));_0x90b4e4['use']('/api/integrations/sugarcrm/configurations',require('./api/intSugarcrmConfiguration'));_0x90b4e4[_0xc1b9('0x5')]('/api/integrations/sugarcrm/fields',require('./api/intSugarcrmField'));_0x90b4e4[_0xc1b9('0x5')](_0xc1b9('0x80'),require(_0xc1b9('0x81')));_0x90b4e4['use'](_0xc1b9('0x82'),require(_0xc1b9('0x83')));_0x90b4e4['use'](_0xc1b9('0x84'),require(_0xc1b9('0x85')));_0x90b4e4[_0xc1b9('0x5')]('/api/integrations/zoho/accounts',require(_0xc1b9('0x86')));_0x90b4e4[_0xc1b9('0x5')](_0xc1b9('0x87'),require(_0xc1b9('0x88')));_0x90b4e4[_0xc1b9('0x5')](_0xc1b9('0x89'),require('./api/intZohoField'));_0x90b4e4[_0xc1b9('0x5')](_0xc1b9('0x8a'),require(_0xc1b9('0x8b')));_0x90b4e4[_0xc1b9('0x5')](_0xc1b9('0x8c'),require('./api/intZendeskConfiguration'));_0x90b4e4[_0xc1b9('0x5')](_0xc1b9('0x8d'),require(_0xc1b9('0x8e')));_0x90b4e4[_0xc1b9('0x5')]('/api/integrations/freshdesk/accounts',require(_0xc1b9('0x8f')));_0x90b4e4[_0xc1b9('0x5')](_0xc1b9('0x90'),require(_0xc1b9('0x91')));_0x90b4e4['use'](_0xc1b9('0x92'),require(_0xc1b9('0x93')));_0x90b4e4[_0xc1b9('0x5')]('/api/integrations/vtiger/accounts',require(_0xc1b9('0x94')));_0x90b4e4[_0xc1b9('0x5')](_0xc1b9('0x95'),require(_0xc1b9('0x96')));_0x90b4e4['use'](_0xc1b9('0x97'),require('./api/intVtigerField'));_0x90b4e4[_0xc1b9('0x5')](_0xc1b9('0x98'),require('./api/intServicenowAccount'));_0x90b4e4[_0xc1b9('0x5')](_0xc1b9('0x99'),require(_0xc1b9('0x9a')));_0x90b4e4[_0xc1b9('0x5')](_0xc1b9('0x9b'),require(_0xc1b9('0x9c')));_0x90b4e4[_0xc1b9('0x5')](_0xc1b9('0x9d'),require('./api/intDynamics365Account'));_0x90b4e4[_0xc1b9('0x5')](_0xc1b9('0x9e'),require('./api/intDynamics365Configuration'));_0x90b4e4['use']('/api/integrations/dynamics365/fields',require(_0xc1b9('0x9f')));_0x90b4e4[_0xc1b9('0x5')]('/api/integrations/freshsales/accounts',require('./api/intFreshsalesAccount'));_0x90b4e4[_0xc1b9('0x5')](_0xc1b9('0xa0'),require(_0xc1b9('0xa1')));_0x90b4e4[_0xc1b9('0x5')]('/api/integrations/freshsales/fields',require(_0xc1b9('0xa2')));_0x90b4e4[_0xc1b9('0x5')]('/api/networks',require('./api/network'));_0x90b4e4['use'](_0xc1b9('0xa3'),require(_0xc1b9('0xa4')));_0x90b4e4[_0xc1b9('0x5')]('/api/chat/internal/messages',require(_0xc1b9('0xa5')));_0x90b4e4[_0xc1b9('0x5')](_0xc1b9('0xa6'),require(_0xc1b9('0xa7')));_0x90b4e4[_0xc1b9('0x5')](_0xc1b9('0xa8'),require('./api/jscriptyQuestionReport'));_0x90b4e4['use']('/api/jscripty/sessions/reports',require(_0xc1b9('0xa9')));_0x90b4e4[_0xc1b9('0x5')](_0xc1b9('0xaa'),require(_0xc1b9('0xab')));_0x90b4e4[_0xc1b9('0x5')]('/api/square/reports',require(_0xc1b9('0xac')));_0x90b4e4[_0xc1b9('0x5')](_0xc1b9('0xad'),require(_0xc1b9('0xae')));_0x90b4e4[_0xc1b9('0x5')](_0xc1b9('0xaf'),require(_0xc1b9('0xb0')));_0x90b4e4['use'](_0xc1b9('0xb1'),require(_0xc1b9('0xb2')));_0x90b4e4[_0xc1b9('0x5')](_0xc1b9('0xb3'),require(_0xc1b9('0xb4')));_0x90b4e4['use'](_0xc1b9('0xb5'),require(_0xc1b9('0xb6')));_0x90b4e4['use'](_0xc1b9('0xb7'),require('./api/squareRecording'));_0x90b4e4[_0xc1b9('0x5')](_0xc1b9('0xb8'),require(_0xc1b9('0xb9')));_0x90b4e4[_0xc1b9('0x5')](_0xc1b9('0xba'),require(_0xc1b9('0xbb')));_0x90b4e4[_0xc1b9('0x5')](_0xc1b9('0xbc'),require(_0xc1b9('0xbd')));_0x90b4e4[_0xc1b9('0x5')](_0xc1b9('0xbe'),require('./api/campaign'));_0x90b4e4['use'](_0xc1b9('0xbf'),require(_0xc1b9('0xc0')));_0x90b4e4[_0xc1b9('0x5')](_0xc1b9('0xc1'),require('./api/attachment'));_0x90b4e4[_0xc1b9('0x5')](_0xc1b9('0xc2'),require(_0xc1b9('0xc3')));_0x90b4e4['use']('/api/mail/reports/transfer',require(_0xc1b9('0xc4')));_0x90b4e4[_0xc1b9('0x5')](_0xc1b9('0xc5'),require('./api/chatTransferReport'));_0x90b4e4[_0xc1b9('0x5')]('/api/fax/reports/transfer',require(_0xc1b9('0xc6')));_0x90b4e4[_0xc1b9('0x5')](_0xc1b9('0xc7'),require(_0xc1b9('0xc8')));_0x90b4e4[_0xc1b9('0x5')](_0xc1b9('0xc9'),require(_0xc1b9('0xca')));_0x90b4e4[_0xc1b9('0x5')](_0xc1b9('0xcb'),require(_0xc1b9('0xcc')));_0x90b4e4[_0xc1b9('0x5')](_0xc1b9('0xcd'),require(_0xc1b9('0xce')));_0x90b4e4[_0xc1b9('0x5')](_0xc1b9('0xcf'),require('./api/userProfile'));_0x90b4e4[_0xc1b9('0x5')](_0xc1b9('0xd0'),require(_0xc1b9('0xd1')));_0x90b4e4['use'](_0xc1b9('0xd2'),require(_0xc1b9('0xd3')));_0x90b4e4['use']('/api/userNotifications',require(_0xc1b9('0xd4')));_0x90b4e4[_0xc1b9('0x5')](_0xc1b9('0xd5'),require(_0xc1b9('0xd6')));_0x90b4e4[_0xc1b9('0x5')](_0xc1b9('0xd7'),require(_0xc1b9('0xd8')));_0x90b4e4['use'](_0xc1b9('0xd9'),require(_0xc1b9('0xda')));_0x90b4e4[_0xc1b9('0x5')]('/api/whatsapp/messages',require(_0xc1b9('0xdb')));_0x90b4e4['use'](_0xc1b9('0xdc'),require(_0xc1b9('0xdd')));_0x90b4e4['use']('/api/whatsapp/reports/transfer',require(_0xc1b9('0xde')));_0x90b4e4[_0xc1b9('0x5')](_0xc1b9('0xdf'),require(_0xc1b9('0xe0')));_0x90b4e4[_0xc1b9('0x5')]('/api/cloudProviders',require('./api/cloudProvider'));_0x90b4e4[_0xc1b9('0x5')](_0xc1b9('0xe1'),require(_0xc1b9('0xe2')));_0x90b4e4['use'](_0xc1b9('0xe3'),require('./api/user-setting'));_0x90b4e4['use'](_0xc1b9('0xe4'),require('./api/mailInteractionHasTag'));_0x90b4e4[_0xc1b9('0x5')](_0xc1b9('0xe5'),require(_0xc1b9('0xe6')));_0x90b4e4[_0xc1b9('0x5')](_0xc1b9('0xe7'),require(_0xc1b9('0xe8')));_0x90b4e4[_0xc1b9('0x5')](_0xc1b9('0xe9'),require(_0xc1b9('0xea')));_0x90b4e4[_0xc1b9('0x5')](_0xc1b9('0xeb'),require(_0xc1b9('0xec')));_0x90b4e4['use'](_0xc1b9('0xed'),require(_0xc1b9('0xee')));_0x90b4e4[_0xc1b9('0x5')](_0xc1b9('0xef'),require('./api/version'));_0x90b4e4[_0xc1b9('0x5')](_0xc1b9('0xf0'),require('./api/system'));_0x90b4e4[_0xc1b9('0x5')](_0xc1b9('0xf1'),require(_0xc1b9('0xf2')));_0x90b4e4[_0xc1b9('0x5')](_0xc1b9('0xf3'),require(_0xc1b9('0xf4')));_0x90b4e4['use'](_0xc1b9('0xf5'),clientSideLogs);_0x90b4e4[_0xc1b9('0x5')]('/apidoc',express[_0xc1b9('0xf6')](path[_0xc1b9('0xf7')](config['root'],_0xc1b9('0xf8'))));_0x90b4e4[_0xc1b9('0x5')](_0xc1b9('0xf9'),express[_0xc1b9('0xf6')](path[_0xc1b9('0xf7')](config[_0xc1b9('0xfa')],'/www')));_0x90b4e4['use'](_0xc1b9('0xfb'),express[_0xc1b9('0xf6')](path['join'](config[_0xc1b9('0xfa')],'/demo')));_0x90b4e4[_0xc1b9('0x5')](_0xc1b9('0xfc'),express['static'](path[_0xc1b9('0xf7')](config['root'],_0xc1b9('0xfd'),_0xc1b9('0xfe'))));_0x90b4e4[_0xc1b9('0x5')]('/plugins',express[_0xc1b9('0xf6')](path['join'](config['root'],_0xc1b9('0xff'))));_0x90b4e4[_0xc1b9('0x100')]('/:url(api|auth|components|app|bower_components|assets)/*')[_0xc1b9('0x101')](errors[0x194]);_0x90b4e4[_0xc1b9('0x100')]('/*')['get'](function(_0x47c7b9,_0x186a4a){_0x186a4a['sendFile'](path[_0xc1b9('0x102')](_0x90b4e4[_0xc1b9('0x101')]('appPath')+_0xc1b9('0x103')));});return _0x90b4e4;});}; \ No newline at end of file +var _0xcdb1=['/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','./api/faxQueue','/api/fax/reports/queue','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','./api/smsInteraction','/api/sms/messages','./api/smsMessage','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','/api/chat/applications','./api/chatApplication','./api/chatInteraction','./api/chatMessage','/api/chat/offline_messages','/api/chat/queues','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopperBlack','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','/api/intervals','/api/pauses','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','./api/schedule','./api/sound','/api/tags','/api/contact_item_types','./api/contactItemType','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','./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/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceField','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','./api/intZendeskAccount','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','/api/integrations/freshdesk/configurations','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','/api/integrations/dynamics365/accounts','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','./api/network','/api/chat/reports/queue','./api/chatQueueReport','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','/api/square/projects','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','/api/license','./api/license','/api/campaigns','./api/migration','/api/attachments','/api/mail/reports/transfer','./api/mailTransferReport','./api/faxTransferReport','/api/sms/reports/transfer','/api/cm/lists','./api/cmList','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userNotification','/api/whatsapp/accounts','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/realtime','/api/user-settings','./api/user-setting','/api/mail_interaction_has_tags','./api/mailInteractionHasTag','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','/api/rpc','./api/rpc','/api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','/api/logs','/apidoc','root','/www','join','/demo','static','snippet','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','appPath','/index.html','express','./errors','./config/environment','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','then','/api/users','./api/user','use','/api/voice/chanspy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','./api/voiceAgentReport','./api/voiceQueueReport','/api/members/reports','./api/memberReport','./api/trunk','./api/voiceTransferReport','./api/mailServerOut','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailApplication','/api/dashboards','./api/dashboard'];(function(_0x146c40,_0x291b7d){var _0x5cfab9=function(_0x5b5163){while(--_0x5b5163){_0x146c40['push'](_0x146c40['shift']());}};_0x5cfab9(++_0x291b7d);}(_0xcdb1,0x1eb));var _0x1cdb=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xcdb1[_0x4b369d];return _0x571a98;};'use strict';var path=require('path');var express=require(_0x1cdb('0x0'));var errors=require(_0x1cdb('0x1'));var config=require(_0x1cdb('0x2'));var setupLoggers=require(_0x1cdb('0x3'))[_0x1cdb('0x4')];var clientSideLogs=require(_0x1cdb('0x5'));exports[_0x1cdb('0x6')]=function(_0x921512){return setupLoggers(_0x921512)[_0x1cdb('0x7')](function(){_0x921512['use'](_0x1cdb('0x8'),require(_0x1cdb('0x9')));_0x921512[_0x1cdb('0xa')](_0x1cdb('0xb'),require('./api/voiceChanSpy'));_0x921512[_0x1cdb('0xa')](_0x1cdb('0xc'),require(_0x1cdb('0xd')));_0x921512[_0x1cdb('0xa')](_0x1cdb('0xe'),require('./api/voiceExtension'));_0x921512[_0x1cdb('0xa')](_0x1cdb('0xf'),require(_0x1cdb('0x10')));_0x921512[_0x1cdb('0xa')](_0x1cdb('0x11'),require('./api/voiceQueue'));_0x921512[_0x1cdb('0xa')](_0x1cdb('0x12'),require(_0x1cdb('0x13')));_0x921512[_0x1cdb('0xa')](_0x1cdb('0x14'),require(_0x1cdb('0x15')));_0x921512[_0x1cdb('0xa')]('/api/voice/mails',require(_0x1cdb('0x16')));_0x921512[_0x1cdb('0xa')](_0x1cdb('0x17'),require(_0x1cdb('0x18')));_0x921512[_0x1cdb('0xa')](_0x1cdb('0x19'),require(_0x1cdb('0x1a')));_0x921512['use']('/api/voice/dials/reports',require('./api/voiceDialReport'));_0x921512[_0x1cdb('0xa')]('/api/voice/agents/reports',require(_0x1cdb('0x1b')));_0x921512[_0x1cdb('0xa')]('/api/voice/queues/reports',require(_0x1cdb('0x1c')));_0x921512[_0x1cdb('0xa')](_0x1cdb('0x1d'),require(_0x1cdb('0x1e')));_0x921512[_0x1cdb('0xa')]('/api/trunks',require(_0x1cdb('0x1f')));_0x921512['use']('/api/voice/transfers/reports',require(_0x1cdb('0x20')));_0x921512[_0x1cdb('0xa')]('/api/mail/out_servers',require(_0x1cdb('0x21')));_0x921512[_0x1cdb('0xa')]('/api/mail/accounts',require(_0x1cdb('0x22')));_0x921512['use'](_0x1cdb('0x23'),require(_0x1cdb('0x24')));_0x921512['use'](_0x1cdb('0x25'),require(_0x1cdb('0x26')));_0x921512[_0x1cdb('0xa')](_0x1cdb('0x27'),require(_0x1cdb('0x28')));_0x921512[_0x1cdb('0xa')](_0x1cdb('0x29'),require('./api/mailMessage'));_0x921512[_0x1cdb('0xa')]('/api/mail/applications',require(_0x1cdb('0x2a')));_0x921512[_0x1cdb('0xa')]('/api/mail/reports/queue',require('./api/mailQueueReport'));_0x921512[_0x1cdb('0xa')](_0x1cdb('0x2b'),require(_0x1cdb('0x2c')));_0x921512[_0x1cdb('0xa')](_0x1cdb('0x2d'),require(_0x1cdb('0x2e')));_0x921512['use'](_0x1cdb('0x2f'),require(_0x1cdb('0x30')));_0x921512['use'](_0x1cdb('0x31'),require(_0x1cdb('0x32')));_0x921512[_0x1cdb('0xa')](_0x1cdb('0x33'),require(_0x1cdb('0x34')));_0x921512['use'](_0x1cdb('0x35'),require(_0x1cdb('0x36')));_0x921512[_0x1cdb('0xa')]('/api/fax/queues',require(_0x1cdb('0x37')));_0x921512[_0x1cdb('0xa')](_0x1cdb('0x38'),require('./api/faxQueueReport'));_0x921512[_0x1cdb('0xa')](_0x1cdb('0x39'),require(_0x1cdb('0x3a')));_0x921512[_0x1cdb('0xa')](_0x1cdb('0x3b'),require(_0x1cdb('0x3c')));_0x921512[_0x1cdb('0xa')]('/api/sms/interactions',require(_0x1cdb('0x3d')));_0x921512[_0x1cdb('0xa')](_0x1cdb('0x3e'),require(_0x1cdb('0x3f')));_0x921512[_0x1cdb('0xa')]('/api/sms/queues',require(_0x1cdb('0x40')));_0x921512['use'](_0x1cdb('0x41'),require(_0x1cdb('0x42')));_0x921512['use']('/api/openchannel/applications',require(_0x1cdb('0x43')));_0x921512[_0x1cdb('0xa')](_0x1cdb('0x44'),require(_0x1cdb('0x45')));_0x921512['use'](_0x1cdb('0x46'),require(_0x1cdb('0x47')));_0x921512[_0x1cdb('0xa')](_0x1cdb('0x48'),require('./api/openchannelQueue'));_0x921512[_0x1cdb('0xa')](_0x1cdb('0x49'),require(_0x1cdb('0x4a')));_0x921512['use'](_0x1cdb('0x4b'),require('./api/openchannelQueueReport'));_0x921512['use'](_0x1cdb('0x4c'),require(_0x1cdb('0x4d')));_0x921512['use']('/api/chat/interactions',require(_0x1cdb('0x4e')));_0x921512['use']('/api/chat/messages',require(_0x1cdb('0x4f')));_0x921512[_0x1cdb('0xa')](_0x1cdb('0x50'),require('./api/chatOfflineMessage'));_0x921512['use'](_0x1cdb('0x51'),require('./api/chatQueue'));_0x921512['use']('/api/chat/groups',require(_0x1cdb('0x52')));_0x921512[_0x1cdb('0xa')](_0x1cdb('0x53'),require(_0x1cdb('0x54')));_0x921512[_0x1cdb('0xa')](_0x1cdb('0x55'),require('./api/cmCompany'));_0x921512[_0x1cdb('0xa')](_0x1cdb('0x56'),require(_0x1cdb('0x57')));_0x921512[_0x1cdb('0xa')](_0x1cdb('0x58'),require('./api/cmHopper'));_0x921512['use']('/api/cm/hopper_black',require(_0x1cdb('0x59')));_0x921512[_0x1cdb('0xa')]('/api/cm/hopper_final',require(_0x1cdb('0x5a')));_0x921512[_0x1cdb('0xa')](_0x1cdb('0x5b'),require('./api/cmHopperHistory'));_0x921512[_0x1cdb('0xa')]('/api/cm/custom_fields',require(_0x1cdb('0x5c')));_0x921512[_0x1cdb('0xa')](_0x1cdb('0x5d'),require(_0x1cdb('0x5e')));_0x921512['use'](_0x1cdb('0x5f'),require(_0x1cdb('0x60')));_0x921512[_0x1cdb('0xa')](_0x1cdb('0x61'),require(_0x1cdb('0x62')));_0x921512[_0x1cdb('0xa')](_0x1cdb('0x63'),require(_0x1cdb('0x64')));_0x921512[_0x1cdb('0xa')](_0x1cdb('0x65'),require('./api/condition'));_0x921512[_0x1cdb('0xa')](_0x1cdb('0x66'),require('./api/interval'));_0x921512[_0x1cdb('0xa')](_0x1cdb('0x67'),require(_0x1cdb('0x68')));_0x921512[_0x1cdb('0xa')](_0x1cdb('0x69'),require(_0x1cdb('0x6a')));_0x921512[_0x1cdb('0xa')](_0x1cdb('0x6b'),require(_0x1cdb('0x6c')));_0x921512['use']('/api/schedules',require(_0x1cdb('0x6d')));_0x921512[_0x1cdb('0xa')]('/api/sounds',require(_0x1cdb('0x6e')));_0x921512[_0x1cdb('0xa')](_0x1cdb('0x6f'),require('./api/tag'));_0x921512[_0x1cdb('0xa')](_0x1cdb('0x70'),require(_0x1cdb('0x71')));_0x921512[_0x1cdb('0xa')](_0x1cdb('0x72'),require(_0x1cdb('0x73')));_0x921512['use'](_0x1cdb('0x74'),require(_0x1cdb('0x75')));_0x921512[_0x1cdb('0xa')](_0x1cdb('0x76'),require(_0x1cdb('0x77')));_0x921512[_0x1cdb('0xa')](_0x1cdb('0x78'),require(_0x1cdb('0x79')));_0x921512['use'](_0x1cdb('0x7a'),require(_0x1cdb('0x7b')));_0x921512[_0x1cdb('0xa')](_0x1cdb('0x7c'),require(_0x1cdb('0x7d')));_0x921512[_0x1cdb('0xa')](_0x1cdb('0x7e'),require(_0x1cdb('0x7f')));_0x921512[_0x1cdb('0xa')]('/api/analytics/custom_reports',require(_0x1cdb('0x80')));_0x921512[_0x1cdb('0xa')](_0x1cdb('0x81'),require(_0x1cdb('0x82')));_0x921512['use'](_0x1cdb('0x83'),require(_0x1cdb('0x84')));_0x921512[_0x1cdb('0xa')](_0x1cdb('0x85'),require('./api/analyticMetric'));_0x921512[_0x1cdb('0xa')]('/api/analytics/field_reports',require(_0x1cdb('0x86')));_0x921512[_0x1cdb('0xa')](_0x1cdb('0x87'),require(_0x1cdb('0x88')));_0x921512[_0x1cdb('0xa')](_0x1cdb('0x89'),require(_0x1cdb('0x8a')));_0x921512[_0x1cdb('0xa')](_0x1cdb('0x8b'),require('./api/intSalesforceConfiguration'));_0x921512[_0x1cdb('0xa')]('/api/integrations/salesforce/fields',require(_0x1cdb('0x8c')));_0x921512[_0x1cdb('0xa')]('/api/integrations/sugarcrm/accounts',require(_0x1cdb('0x8d')));_0x921512[_0x1cdb('0xa')](_0x1cdb('0x8e'),require(_0x1cdb('0x8f')));_0x921512['use'](_0x1cdb('0x90'),require(_0x1cdb('0x91')));_0x921512[_0x1cdb('0xa')](_0x1cdb('0x92'),require(_0x1cdb('0x93')));_0x921512[_0x1cdb('0xa')]('/api/integrations/desk/configurations',require('./api/intDeskConfiguration'));_0x921512['use'](_0x1cdb('0x94'),require(_0x1cdb('0x95')));_0x921512['use'](_0x1cdb('0x96'),require(_0x1cdb('0x97')));_0x921512[_0x1cdb('0xa')](_0x1cdb('0x98'),require(_0x1cdb('0x99')));_0x921512[_0x1cdb('0xa')](_0x1cdb('0x9a'),require(_0x1cdb('0x9b')));_0x921512[_0x1cdb('0xa')]('/api/integrations/zendesk/accounts',require(_0x1cdb('0x9c')));_0x921512[_0x1cdb('0xa')]('/api/integrations/zendesk/configurations',require(_0x1cdb('0x9d')));_0x921512[_0x1cdb('0xa')](_0x1cdb('0x9e'),require(_0x1cdb('0x9f')));_0x921512[_0x1cdb('0xa')](_0x1cdb('0xa0'),require('./api/intFreshdeskAccount'));_0x921512[_0x1cdb('0xa')](_0x1cdb('0xa1'),require('./api/intFreshdeskConfiguration'));_0x921512[_0x1cdb('0xa')]('/api/integrations/freshdesk/fields',require(_0x1cdb('0xa2')));_0x921512[_0x1cdb('0xa')](_0x1cdb('0xa3'),require(_0x1cdb('0xa4')));_0x921512[_0x1cdb('0xa')](_0x1cdb('0xa5'),require('./api/intVtigerConfiguration'));_0x921512[_0x1cdb('0xa')](_0x1cdb('0xa6'),require(_0x1cdb('0xa7')));_0x921512[_0x1cdb('0xa')](_0x1cdb('0xa8'),require('./api/intServicenowAccount'));_0x921512[_0x1cdb('0xa')](_0x1cdb('0xa9'),require(_0x1cdb('0xaa')));_0x921512[_0x1cdb('0xa')](_0x1cdb('0xab'),require('./api/intServicenowField'));_0x921512[_0x1cdb('0xa')](_0x1cdb('0xac'),require('./api/intDynamics365Account'));_0x921512['use']('/api/integrations/dynamics365/configurations',require(_0x1cdb('0xad')));_0x921512[_0x1cdb('0xa')](_0x1cdb('0xae'),require('./api/intDynamics365Field'));_0x921512['use'](_0x1cdb('0xaf'),require(_0x1cdb('0xb0')));_0x921512[_0x1cdb('0xa')](_0x1cdb('0xb1'),require(_0x1cdb('0xb2')));_0x921512['use'](_0x1cdb('0xb3'),require(_0x1cdb('0xb4')));_0x921512[_0x1cdb('0xa')]('/api/networks',require(_0x1cdb('0xb5')));_0x921512[_0x1cdb('0xa')](_0x1cdb('0xb6'),require(_0x1cdb('0xb7')));_0x921512[_0x1cdb('0xa')]('/api/chat/internal/messages',require(_0x1cdb('0xb8')));_0x921512[_0x1cdb('0xa')](_0x1cdb('0xb9'),require(_0x1cdb('0xba')));_0x921512[_0x1cdb('0xa')]('/api/jscripty/questions/reports',require(_0x1cdb('0xbb')));_0x921512[_0x1cdb('0xa')](_0x1cdb('0xbc'),require(_0x1cdb('0xbd')));_0x921512[_0x1cdb('0xa')]('/api/sms/reports/queue',require(_0x1cdb('0xbe')));_0x921512[_0x1cdb('0xa')](_0x1cdb('0xbf'),require(_0x1cdb('0xc0')));_0x921512[_0x1cdb('0xa')](_0x1cdb('0xc1'),require('./api/squareReportDetail'));_0x921512[_0x1cdb('0xa')](_0x1cdb('0xc2'),require(_0x1cdb('0xc3')));_0x921512[_0x1cdb('0xa')](_0x1cdb('0xc4'),require(_0x1cdb('0xc5')));_0x921512['use'](_0x1cdb('0xc6'),require('./api/squareOdbc'));_0x921512[_0x1cdb('0xa')](_0x1cdb('0xc7'),require('./api/squareProject'));_0x921512[_0x1cdb('0xa')](_0x1cdb('0xc8'),require(_0x1cdb('0xc9')));_0x921512[_0x1cdb('0xa')](_0x1cdb('0xca'),require(_0x1cdb('0xcb')));_0x921512['use'](_0x1cdb('0xcc'),require('./api/team'));_0x921512[_0x1cdb('0xa')](_0x1cdb('0xcd'),require(_0x1cdb('0xce')));_0x921512[_0x1cdb('0xa')](_0x1cdb('0xcf'),require('./api/campaign'));_0x921512[_0x1cdb('0xa')]('/api/migrations',require(_0x1cdb('0xd0')));_0x921512[_0x1cdb('0xa')](_0x1cdb('0xd1'),require('./api/attachment'));_0x921512[_0x1cdb('0xa')]('/api/plugins',require('./api/plugin'));_0x921512[_0x1cdb('0xa')](_0x1cdb('0xd2'),require(_0x1cdb('0xd3')));_0x921512[_0x1cdb('0xa')]('/api/chat/reports/transfer',require('./api/chatTransferReport'));_0x921512[_0x1cdb('0xa')]('/api/fax/reports/transfer',require(_0x1cdb('0xd4')));_0x921512['use']('/api/openchannel/reports/transfer',require('./api/openchannelTransferReport'));_0x921512[_0x1cdb('0xa')](_0x1cdb('0xd5'),require('./api/smsTransferReport'));_0x921512[_0x1cdb('0xa')](_0x1cdb('0xd6'),require(_0x1cdb('0xd7')));_0x921512[_0x1cdb('0xa')]('/api/voice/prefixes',require(_0x1cdb('0xd8')));_0x921512[_0x1cdb('0xa')](_0x1cdb('0xd9'),require(_0x1cdb('0xda')));_0x921512[_0x1cdb('0xa')](_0x1cdb('0xdb'),require(_0x1cdb('0xdc')));_0x921512[_0x1cdb('0xa')](_0x1cdb('0xdd'),require('./api/userProfileResource'));_0x921512['use']('/api/userNotifications',require(_0x1cdb('0xde')));_0x921512[_0x1cdb('0xa')](_0x1cdb('0xdf'),require('./api/whatsappAccount'));_0x921512[_0x1cdb('0xa')](_0x1cdb('0xe0'),require(_0x1cdb('0xe1')));_0x921512['use']('/api/whatsapp/interactions',require('./api/whatsappInteraction'));_0x921512[_0x1cdb('0xa')](_0x1cdb('0xe2'),require(_0x1cdb('0xe3')));_0x921512[_0x1cdb('0xa')](_0x1cdb('0xe4'),require(_0x1cdb('0xe5')));_0x921512['use']('/api/whatsapp/reports/transfer',require(_0x1cdb('0xe6')));_0x921512[_0x1cdb('0xa')](_0x1cdb('0xe7'),require(_0x1cdb('0xe8')));_0x921512[_0x1cdb('0xa')](_0x1cdb('0xe9'),require('./api/cloudProvider'));_0x921512[_0x1cdb('0xa')]('/api/realtime',require(_0x1cdb('0xea')));_0x921512[_0x1cdb('0xa')](_0x1cdb('0xeb'),require(_0x1cdb('0xec')));_0x921512[_0x1cdb('0xa')](_0x1cdb('0xed'),require(_0x1cdb('0xee')));_0x921512[_0x1cdb('0xa')](_0x1cdb('0xef'),require(_0x1cdb('0xf0')));_0x921512[_0x1cdb('0xa')](_0x1cdb('0xf1'),require(_0x1cdb('0xf2')));_0x921512['use'](_0x1cdb('0xf3'),require(_0x1cdb('0xf4')));_0x921512['use']('/api/jira',require('./api/jira'));_0x921512['use'](_0x1cdb('0xf5'),require(_0x1cdb('0xf6')));_0x921512['use'](_0x1cdb('0xf7'),require('./api/version'));_0x921512['use'](_0x1cdb('0xf8'),require(_0x1cdb('0xf9')));_0x921512[_0x1cdb('0xa')](_0x1cdb('0xfa'),require(_0x1cdb('0xfb')));_0x921512[_0x1cdb('0xa')](_0x1cdb('0xfc'),require('./api/webbar'));_0x921512[_0x1cdb('0xa')](_0x1cdb('0xfd'),clientSideLogs);_0x921512[_0x1cdb('0xa')](_0x1cdb('0xfe'),express['static'](path['join'](config[_0x1cdb('0xff')],_0x1cdb('0xfe'))));_0x921512[_0x1cdb('0xa')](_0x1cdb('0x100'),express['static'](path[_0x1cdb('0x101')](config[_0x1cdb('0xff')],_0x1cdb('0x100'))));_0x921512[_0x1cdb('0xa')](_0x1cdb('0x102'),express[_0x1cdb('0x103')](path['join'](config[_0x1cdb('0xff')],_0x1cdb('0x102'))));_0x921512[_0x1cdb('0xa')]('/snippet',express[_0x1cdb('0x103')](path[_0x1cdb('0x101')](config[_0x1cdb('0xff')],_0x1cdb('0x104'),'3.9.0')));_0x921512[_0x1cdb('0xa')](_0x1cdb('0x105'),express[_0x1cdb('0x103')](path[_0x1cdb('0x101')](config[_0x1cdb('0xff')],_0x1cdb('0x106'))));_0x921512[_0x1cdb('0x107')](_0x1cdb('0x108'))[_0x1cdb('0x109')](errors[0x194]);_0x921512[_0x1cdb('0x107')]('/*')[_0x1cdb('0x109')](function(_0x3f0bca,_0x580dce){_0x580dce['sendFile'](path['resolve'](_0x921512[_0x1cdb('0x109')](_0x1cdb('0x10a'))+_0x1cdb('0x10b')));});return _0x921512;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 3278508..c26a28a 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6717=['../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.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/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','port','rpc','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','lodash','listen','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailApplication/mailApplication.rpc','../api/faxAccount/faxAccount.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/chatInteraction/chatInteraction.rpc','../api/cmContact/cmContact.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/sound/sound.rpc'];(function(_0x29b2b3,_0x58cdd4){var _0x38f3bf=function(_0x347187){while(--_0x347187){_0x29b2b3['push'](_0x29b2b3['shift']());}};_0x38f3bf(++_0x58cdd4);}(_0x6717,0x1a1));var _0x7671=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6717[_0x3dd15e];return _0x231fd0;};'use strict';var jayson=require('jayson/promise');var _=require(_0x7671('0x0'));var config=require('../config/environment');exports[_0x7671('0x1')]=function(){return new Promise(function(_0x213ad2,_0x26b2e5){var _0x432fae={};_0x432fae=_[_0x7671('0x2')](_0x432fae,require('../api/user/user.rpc'));_0x432fae=_['merge'](_0x432fae,require(_0x7671('0x3')));_0x432fae=_[_0x7671('0x2')](_0x432fae,require(_0x7671('0x4')));_0x432fae=_['merge'](_0x432fae,require('../api/voiceRecording/voiceRecording.rpc'));_0x432fae=_['merge'](_0x432fae,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x432fae=_[_0x7671('0x2')](_0x432fae,require(_0x7671('0x5')));_0x432fae=_[_0x7671('0x2')](_0x432fae,require(_0x7671('0x6')));_0x432fae=_[_0x7671('0x2')](_0x432fae,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x432fae=_['merge'](_0x432fae,require(_0x7671('0x7')));_0x432fae=_[_0x7671('0x2')](_0x432fae,require(_0x7671('0x8')));_0x432fae=_[_0x7671('0x2')](_0x432fae,require(_0x7671('0x9')));_0x432fae=_[_0x7671('0x2')](_0x432fae,require(_0x7671('0xa')));_0x432fae=_[_0x7671('0x2')](_0x432fae,require(_0x7671('0xb')));_0x432fae=_[_0x7671('0x2')](_0x432fae,require(_0x7671('0xc')));_0x432fae=_['merge'](_0x432fae,require(_0x7671('0xd')));_0x432fae=_[_0x7671('0x2')](_0x432fae,require(_0x7671('0xe')));_0x432fae=_[_0x7671('0x2')](_0x432fae,require('../api/mailMessage/mailMessage.rpc'));_0x432fae=_['merge'](_0x432fae,require(_0x7671('0xf')));_0x432fae=_['merge'](_0x432fae,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x432fae=_[_0x7671('0x2')](_0x432fae,require(_0x7671('0x10')));_0x432fae=_[_0x7671('0x2')](_0x432fae,require('../api/faxApplication/faxApplication.rpc'));_0x432fae=_[_0x7671('0x2')](_0x432fae,require(_0x7671('0x11')));_0x432fae=_[_0x7671('0x2')](_0x432fae,require(_0x7671('0x12')));_0x432fae=_['merge'](_0x432fae,require(_0x7671('0x13')));_0x432fae=_[_0x7671('0x2')](_0x432fae,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x432fae=_[_0x7671('0x2')](_0x432fae,require(_0x7671('0x14')));_0x432fae=_[_0x7671('0x2')](_0x432fae,require(_0x7671('0x15')));_0x432fae=_[_0x7671('0x2')](_0x432fae,require(_0x7671('0x16')));_0x432fae=_['merge'](_0x432fae,require('../api/smsQueue/smsQueue.rpc'));_0x432fae=_[_0x7671('0x2')](_0x432fae,require(_0x7671('0x17')));_0x432fae=_[_0x7671('0x2')](_0x432fae,require(_0x7671('0x18')));_0x432fae=_[_0x7671('0x2')](_0x432fae,require(_0x7671('0x19')));_0x432fae=_[_0x7671('0x2')](_0x432fae,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x432fae=_[_0x7671('0x2')](_0x432fae,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x432fae=_[_0x7671('0x2')](_0x432fae,require(_0x7671('0x1a')));_0x432fae=_[_0x7671('0x2')](_0x432fae,require('../api/chatMessage/chatMessage.rpc'));_0x432fae=_[_0x7671('0x2')](_0x432fae,require('../api/chatQueue/chatQueue.rpc'));_0x432fae=_[_0x7671('0x2')](_0x432fae,require(_0x7671('0x1b')));_0x432fae=_['merge'](_0x432fae,require('../api/cmHopper/cmHopper.rpc'));_0x432fae=_[_0x7671('0x2')](_0x432fae,require(_0x7671('0x1c')));_0x432fae=_['merge'](_0x432fae,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x432fae=_[_0x7671('0x2')](_0x432fae,require(_0x7671('0x1d')));_0x432fae=_[_0x7671('0x2')](_0x432fae,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x432fae=_[_0x7671('0x2')](_0x432fae,require('../api/interval/interval.rpc'));_0x432fae=_[_0x7671('0x2')](_0x432fae,require('../api/pause/pause.rpc'));_0x432fae=_['merge'](_0x432fae,require(_0x7671('0x1e')));_0x432fae=_[_0x7671('0x2')](_0x432fae,require(_0x7671('0x1f')));_0x432fae=_[_0x7671('0x2')](_0x432fae,require(_0x7671('0x20')));_0x432fae=_[_0x7671('0x2')](_0x432fae,require('../api/trigger/trigger.rpc'));_0x432fae=_[_0x7671('0x2')](_0x432fae,require(_0x7671('0x21')));_0x432fae=_[_0x7671('0x2')](_0x432fae,require(_0x7671('0x22')));_0x432fae=_['merge'](_0x432fae,require(_0x7671('0x23')));_0x432fae=_[_0x7671('0x2')](_0x432fae,require(_0x7671('0x24')));_0x432fae=_[_0x7671('0x2')](_0x432fae,require(_0x7671('0x25')));_0x432fae=_[_0x7671('0x2')](_0x432fae,require(_0x7671('0x26')));_0x432fae=_['merge'](_0x432fae,require(_0x7671('0x27')));_0x432fae=_[_0x7671('0x2')](_0x432fae,require(_0x7671('0x28')));_0x432fae=_[_0x7671('0x2')](_0x432fae,require(_0x7671('0x29')));_0x432fae=_[_0x7671('0x2')](_0x432fae,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x432fae=_[_0x7671('0x2')](_0x432fae,require(_0x7671('0x2a')));_0x432fae=_[_0x7671('0x2')](_0x432fae,require(_0x7671('0x2b')));_0x432fae=_[_0x7671('0x2')](_0x432fae,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x432fae=_[_0x7671('0x2')](_0x432fae,require(_0x7671('0x2c')));_0x432fae=_['merge'](_0x432fae,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x432fae=_[_0x7671('0x2')](_0x432fae,require(_0x7671('0x2d')));_0x432fae=_[_0x7671('0x2')](_0x432fae,require(_0x7671('0x2e')));_0x432fae=_[_0x7671('0x2')](_0x432fae,require(_0x7671('0x2f')));_0x432fae=_[_0x7671('0x2')](_0x432fae,require('../api/squareRecording/squareRecording.rpc'));_0x432fae=_[_0x7671('0x2')](_0x432fae,require(_0x7671('0x30')));_0x432fae=_[_0x7671('0x2')](_0x432fae,require(_0x7671('0x31')));_0x432fae=_[_0x7671('0x2')](_0x432fae,require('../api/attachment/attachment.rpc'));_0x432fae=_[_0x7671('0x2')](_0x432fae,require(_0x7671('0x32')));_0x432fae=_[_0x7671('0x2')](_0x432fae,require(_0x7671('0x33')));_0x432fae=_[_0x7671('0x2')](_0x432fae,require(_0x7671('0x34')));_0x432fae=_['merge'](_0x432fae,require(_0x7671('0x35')));_0x432fae=_[_0x7671('0x2')](_0x432fae,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x432fae=_[_0x7671('0x2')](_0x432fae,require(_0x7671('0x36')));var _0x393622=jayson[_0x7671('0x37')](_0x432fae)[_0x7671('0x38')]();var _0x3e658b=config['rpc'][_0x7671('0x39')]||config['port']+0x1;var _0x5b76c6=config[_0x7671('0x3a')]['ip']||'localhost';_0x393622['on']('error',function(_0x238707){return _0x26b2e5(_0x238707);});_0x393622[_0x7671('0x1')](_0x3e658b,_0x5b76c6,function(){console[_0x7671('0x3b')](_0x7671('0x3c'),_0x5b76c6,_0x3e658b);require(_0x7671('0x3d'))[_0x7671('0x3e')]();return _0x213ad2(_0x7671('0x3f')+_0x5b76c6+':'+_0x3e658b);});});}; \ No newline at end of file +var _0x7553=['../api/intServicenowAccount/intServicenowAccount.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.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/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','RPC\x20listening\x20on\x20','jayson/promise','lodash','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/memberReport/memberReport.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/openchannelApplication/openchannelApplication.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/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/interval/interval.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x7553,0x1c3));var _0x3755=function(_0x1cd916,_0x333f5c){_0x1cd916=_0x1cd916-0x0;var _0x1ff07a=_0x7553[_0x1cd916];return _0x1ff07a;};'use strict';var jayson=require(_0x3755('0x0'));var _=require(_0x3755('0x1'));var config=require('../config/environment');exports[_0x3755('0x2')]=function(){return new Promise(function(_0x31ca01,_0x2545cf){var _0x4d195e={};_0x4d195e=_[_0x3755('0x3')](_0x4d195e,require(_0x3755('0x4')));_0x4d195e=_[_0x3755('0x3')](_0x4d195e,require(_0x3755('0x5')));_0x4d195e=_[_0x3755('0x3')](_0x4d195e,require('../api/voiceQueue/voiceQueue.rpc'));_0x4d195e=_[_0x3755('0x3')](_0x4d195e,require('../api/voiceRecording/voiceRecording.rpc'));_0x4d195e=_['merge'](_0x4d195e,require(_0x3755('0x6')));_0x4d195e=_[_0x3755('0x3')](_0x4d195e,require(_0x3755('0x7')));_0x4d195e=_[_0x3755('0x3')](_0x4d195e,require(_0x3755('0x8')));_0x4d195e=_[_0x3755('0x3')](_0x4d195e,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x4d195e=_[_0x3755('0x3')](_0x4d195e,require(_0x3755('0x9')));_0x4d195e=_['merge'](_0x4d195e,require('../api/trunk/trunk.rpc'));_0x4d195e=_[_0x3755('0x3')](_0x4d195e,require(_0x3755('0xa')));_0x4d195e=_[_0x3755('0x3')](_0x4d195e,require(_0x3755('0xb')));_0x4d195e=_[_0x3755('0x3')](_0x4d195e,require(_0x3755('0xc')));_0x4d195e=_[_0x3755('0x3')](_0x4d195e,require(_0x3755('0xd')));_0x4d195e=_[_0x3755('0x3')](_0x4d195e,require('../api/mailQueue/mailQueue.rpc'));_0x4d195e=_[_0x3755('0x3')](_0x4d195e,require(_0x3755('0xe')));_0x4d195e=_[_0x3755('0x3')](_0x4d195e,require(_0x3755('0xf')));_0x4d195e=_[_0x3755('0x3')](_0x4d195e,require(_0x3755('0x10')));_0x4d195e=_[_0x3755('0x3')](_0x4d195e,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x4d195e=_[_0x3755('0x3')](_0x4d195e,require(_0x3755('0x11')));_0x4d195e=_[_0x3755('0x3')](_0x4d195e,require(_0x3755('0x12')));_0x4d195e=_[_0x3755('0x3')](_0x4d195e,require(_0x3755('0x13')));_0x4d195e=_[_0x3755('0x3')](_0x4d195e,require('../api/faxMessage/faxMessage.rpc'));_0x4d195e=_[_0x3755('0x3')](_0x4d195e,require('../api/faxQueue/faxQueue.rpc'));_0x4d195e=_[_0x3755('0x3')](_0x4d195e,require(_0x3755('0x14')));_0x4d195e=_[_0x3755('0x3')](_0x4d195e,require(_0x3755('0x15')));_0x4d195e=_[_0x3755('0x3')](_0x4d195e,require(_0x3755('0x16')));_0x4d195e=_[_0x3755('0x3')](_0x4d195e,require(_0x3755('0x17')));_0x4d195e=_[_0x3755('0x3')](_0x4d195e,require('../api/smsQueue/smsQueue.rpc'));_0x4d195e=_['merge'](_0x4d195e,require(_0x3755('0x18')));_0x4d195e=_[_0x3755('0x3')](_0x4d195e,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x4d195e=_[_0x3755('0x3')](_0x4d195e,require(_0x3755('0x19')));_0x4d195e=_[_0x3755('0x3')](_0x4d195e,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x4d195e=_[_0x3755('0x3')](_0x4d195e,require(_0x3755('0x1a')));_0x4d195e=_[_0x3755('0x3')](_0x4d195e,require(_0x3755('0x1b')));_0x4d195e=_[_0x3755('0x3')](_0x4d195e,require(_0x3755('0x1c')));_0x4d195e=_[_0x3755('0x3')](_0x4d195e,require(_0x3755('0x1d')));_0x4d195e=_[_0x3755('0x3')](_0x4d195e,require(_0x3755('0x1e')));_0x4d195e=_[_0x3755('0x3')](_0x4d195e,require('../api/cmHopper/cmHopper.rpc'));_0x4d195e=_['merge'](_0x4d195e,require(_0x3755('0x1f')));_0x4d195e=_['merge'](_0x4d195e,require(_0x3755('0x20')));_0x4d195e=_[_0x3755('0x3')](_0x4d195e,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x4d195e=_[_0x3755('0x3')](_0x4d195e,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x4d195e=_[_0x3755('0x3')](_0x4d195e,require(_0x3755('0x21')));_0x4d195e=_[_0x3755('0x3')](_0x4d195e,require('../api/pause/pause.rpc'));_0x4d195e=_['merge'](_0x4d195e,require(_0x3755('0x22')));_0x4d195e=_['merge'](_0x4d195e,require(_0x3755('0x23')));_0x4d195e=_['merge'](_0x4d195e,require(_0x3755('0x24')));_0x4d195e=_[_0x3755('0x3')](_0x4d195e,require(_0x3755('0x25')));_0x4d195e=_['merge'](_0x4d195e,require(_0x3755('0x26')));_0x4d195e=_[_0x3755('0x3')](_0x4d195e,require(_0x3755('0x27')));_0x4d195e=_[_0x3755('0x3')](_0x4d195e,require(_0x3755('0x28')));_0x4d195e=_['merge'](_0x4d195e,require(_0x3755('0x29')));_0x4d195e=_[_0x3755('0x3')](_0x4d195e,require(_0x3755('0x2a')));_0x4d195e=_[_0x3755('0x3')](_0x4d195e,require(_0x3755('0x2b')));_0x4d195e=_[_0x3755('0x3')](_0x4d195e,require(_0x3755('0x2c')));_0x4d195e=_['merge'](_0x4d195e,require(_0x3755('0x2d')));_0x4d195e=_[_0x3755('0x3')](_0x4d195e,require(_0x3755('0x2e')));_0x4d195e=_['merge'](_0x4d195e,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x4d195e=_[_0x3755('0x3')](_0x4d195e,require(_0x3755('0x2f')));_0x4d195e=_[_0x3755('0x3')](_0x4d195e,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x4d195e=_[_0x3755('0x3')](_0x4d195e,require(_0x3755('0x30')));_0x4d195e=_['merge'](_0x4d195e,require(_0x3755('0x31')));_0x4d195e=_[_0x3755('0x3')](_0x4d195e,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x4d195e=_['merge'](_0x4d195e,require(_0x3755('0x32')));_0x4d195e=_[_0x3755('0x3')](_0x4d195e,require('../api/squareOdbc/squareOdbc.rpc'));_0x4d195e=_['merge'](_0x4d195e,require(_0x3755('0x33')));_0x4d195e=_[_0x3755('0x3')](_0x4d195e,require(_0x3755('0x34')));_0x4d195e=_[_0x3755('0x3')](_0x4d195e,require(_0x3755('0x35')));_0x4d195e=_[_0x3755('0x3')](_0x4d195e,require(_0x3755('0x36')));_0x4d195e=_['merge'](_0x4d195e,require(_0x3755('0x37')));_0x4d195e=_['merge'](_0x4d195e,require(_0x3755('0x38')));_0x4d195e=_['merge'](_0x4d195e,require(_0x3755('0x39')));_0x4d195e=_[_0x3755('0x3')](_0x4d195e,require(_0x3755('0x3a')));_0x4d195e=_[_0x3755('0x3')](_0x4d195e,require(_0x3755('0x3b')));_0x4d195e=_[_0x3755('0x3')](_0x4d195e,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x4d195e=_[_0x3755('0x3')](_0x4d195e,require(_0x3755('0x3c')));var _0x5ea8a2=jayson[_0x3755('0x3d')](_0x4d195e)[_0x3755('0x3e')]();var _0x489498=config[_0x3755('0x3f')][_0x3755('0x40')]||config[_0x3755('0x40')]+0x1;var _0x123cf3=config[_0x3755('0x3f')]['ip']||_0x3755('0x41');_0x5ea8a2['on'](_0x3755('0x42'),function(_0x2b9c08){return _0x2545cf(_0x2b9c08);});_0x5ea8a2[_0x3755('0x2')](_0x489498,_0x123cf3,function(){console[_0x3755('0x43')](_0x3755('0x44'),_0x123cf3,_0x489498);require(_0x3755('0x45'))['default']();return _0x31ca01(_0x3755('0x46')+_0x123cf3+':'+_0x489498);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index a909f7f..0084132 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 _0xcf54=['function','substring','no\x20code','replace','result=','indexOf','substr','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','inherits','prototype','sendRequest','sync','answer','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','NO\x20MESSAGE','join','EXEC\x20%s\x20%s','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','HANGUP','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','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','noop','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','BEEP','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','lodash','events','EventEmitter','./reply','./error','call','setEncoding','utf8','ready','line','toLowerCase','hangup','emit','search','520\x20End\x20of\x20proper'];(function(_0x2cd2f0,_0x2c1a55){var _0x137160=function(_0x62979c){while(--_0x62979c){_0x2cd2f0['push'](_0x2cd2f0['shift']());}};_0x137160(++_0x2c1a55);}(_0xcf54,0x125));var _0x4cf5=function(_0x44d9ab,_0x76bc69){_0x44d9ab=_0x44d9ab-0x0;var _0x31485e=_0xcf54[_0x44d9ab];return _0x31485e;};'use strict';var util=require('util');var _=require(_0x4cf5('0x0'));var EventEmitter=require(_0x4cf5('0x1'))[_0x4cf5('0x2')];var AGIReply=require(_0x4cf5('0x3'));var AGIError=require(_0x4cf5('0x4'));function AGIChannel(_0x26e26f){var _0x46e588=this,_0x4c5ffa=new AGIReply(),_0x28921a=![],_0x2d156a={};EventEmitter[_0x4cf5('0x5')](_0x46e588);_0x26e26f[_0x4cf5('0x6')](_0x4cf5('0x7'));_0x26e26f['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x4c5ffa[_0x4cf5('0x6')](_0x4cf5('0x7'));_0x4c5ffa['on']('headers',function(_0x4fe906){for(var _0x16a089 in _0x4fe906){_0x46e588[_0x16a089]=_0x4fe906[_0x16a089];}_0x46e588['emit'](_0x4cf5('0x8'));});_0x4c5ffa['on'](_0x4cf5('0x9'),function(_0x5cdd7d){if(_0x5cdd7d[_0x4cf5('0xa')]()==_0x4cf5('0xb')){_0x46e588[_0x4cf5('0xc')]('hangup');return;}if(_0x5cdd7d['substring'](0x0,0xb)=='520-Invalid'){_0x28921a=!![];}if(_0x28921a){_0x2d156a['rx']+=_0x5cdd7d+'\x0a';if(_0x5cdd7d[_0x4cf5('0xd')](_0x4cf5('0xe'))!=-0x1){_0x28921a=![];}}else{_0x2d156a['rx']=_0x5cdd7d;}if(_0x28921a){return;}if(typeof _0x2d156a['cb']==_0x4cf5('0xf')){var _0x4a677f=_0x2d156a['rx'][_0x4cf5('0x10')](0x0,0x3),_0x5cc929=null,_0x29af5e=null;_0x4a677f=parseInt(_0x4a677f);if(isNaN(_0x4a677f)){_0x2d156a['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x4cf5('0x11')});return;}if(_0x4a677f!=0xc8){_0x2d156a['cb'](null,{'code':_0x4a677f,'result':-0x1,'extra':'KO'});return;}_0x5cc929=_0x2d156a['rx'][_0x4cf5('0x10')](0x4)[_0x4cf5('0x12')](_0x4cf5('0x13'),'');if(_0x5cc929[_0x4cf5('0x14')]('\x20')!=-0x1){_0x5cc929=_0x5cc929[_0x4cf5('0x15')](0x0,_0x5cc929[_0x4cf5('0x14')]('\x20'));}if(_[_0x4cf5('0x16')](_0x5cc929,'-1')){_0x5cc929=parseInt(_0x5cc929);}_0x29af5e=_0x2d156a['rx'][_0x4cf5('0x17')]('\x20');if(_0x29af5e['length']==0x3){_0x29af5e=_0x29af5e[0x2][_0x4cf5('0x10')](0x1,_0x29af5e[0x2][_0x4cf5('0x18')]-0x1);}else if(_0x29af5e['length']>0x3){var _0x36460c=/\((.+)\)/;var _0x14de31=_0x2d156a['rx'][_0x4cf5('0x19')](_0x36460c);if(_0x14de31){_0x29af5e=_0x14de31[0x1];}else{_0x29af5e=null;}}else{_0x29af5e=null;}_0x2d156a['cb'](null,{'code':_0x4a677f,'result':_0x5cc929,'extra':_0x29af5e});}});_0x26e26f['on'](_0x4cf5('0x1a'),function(_0x2436c0){_0x46e588[_0x4cf5('0xc')]('error',new AGIError(_0x4cf5('0x1b'),_0x2436c0[_0x4cf5('0x1c')]));});_0x26e26f['on'](_0x4cf5('0x1d'),function(){_0x46e588['emit'](_0x4cf5('0x1d'),new AGIError('E_AGI_SOCKET_CLOSE'));});_0x26e26f['on'](_0x4cf5('0x1e'),function(){_0x46e588['emit'](_0x4cf5('0x1e'),new AGIError(_0x4cf5('0x1f')));_0x26e26f[_0x4cf5('0x20')]();});_0x26e26f[_0x4cf5('0x21')](_0x4c5ffa);this[_0x4cf5('0x22')]=function(_0x8524ed,_0x17a749){var _0x8524ed=_0x8524ed||'',_0x17a749=typeof _0x17a749==_0x4cf5('0xf')?_0x17a749:new Function();_0x2d156a={'tx':_0x8524ed,'rx':'','cb':_0x17a749};_0x26e26f['write'](_0x8524ed+'\x0a');},this[_0x4cf5('0x1d')]=function(){_0x26e26f[_0x4cf5('0x20')]();};}util[_0x4cf5('0x23')](AGIChannel,EventEmitter);AGIChannel[_0x4cf5('0x24')][_0x4cf5('0x25')]=function(_0x2407c6){return this[_0x4cf5('0x22')][_0x4cf5('0x26')](this,_0x2407c6);};AGIChannel[_0x4cf5('0x24')][_0x4cf5('0x27')]=function(){return this[_0x4cf5('0x25')]('ANSWER');};AGIChannel[_0x4cf5('0x24')][_0x4cf5('0x28')]=function(_0x1cdd2a,_0x36f038,_0x1e87bd){_0x1cdd2a=_0x1cdd2a===undefined?_0x4cf5('0x29'):_0x1cdd2a;_0x36f038=_0x36f038===undefined?'5':_0x36f038;_0x1e87bd=_0x1e87bd===undefined?'1':_0x1e87bd;return this[_0x4cf5('0x25')](util[_0x4cf5('0x2a')](_0x4cf5('0x2b'),_0x1cdd2a,_0x36f038*0x3e8,_0x1e87bd));};AGIChannel[_0x4cf5('0x24')]['noop']=function(_0x2b18af){_0x2b18af=_0x2b18af||_0x4cf5('0x2c');return this[_0x4cf5('0x25')](util[_0x4cf5('0x2a')]('VERBOSE\x20\x22%s\x22',_0x2b18af));};AGIChannel['prototype']['exec']=function(_0x48dc21,_0x158efa){if(_['isArray'](_0x158efa)){return this[_0x4cf5('0x25')](util[_0x4cf5('0x2a')]('EXEC\x20%s\x20%s',_0x48dc21,_0x158efa[_0x4cf5('0x2d')](',')));}return this['sendRequest'](util[_0x4cf5('0x2a')](_0x4cf5('0x2e'),_0x48dc21,_0x158efa));};AGIChannel[_0x4cf5('0x24')][_0x4cf5('0x2f')]=function(_0x4b0e05){return this[_0x4cf5('0x25')](util[_0x4cf5('0x2a')](_0x4cf5('0x30'),_0x4b0e05));};AGIChannel[_0x4cf5('0x24')][_0x4cf5('0x31')]=function(_0x26d40d){return this[_0x4cf5('0x25')](util[_0x4cf5('0x2a')](_0x4cf5('0x32'),_0x26d40d));};AGIChannel['prototype'][_0x4cf5('0x33')]=function(_0x4878db){return this[_0x4cf5('0x25')](util[_0x4cf5('0x2a')]('SET\x20PRIORITY\x20%s',_0x4878db));};AGIChannel['prototype'][_0x4cf5('0xb')]=function(){return this[_0x4cf5('0x25')](_0x4cf5('0x34'));};AGIChannel['prototype']['setVariable']=function(_0x4d919c,_0x10b7cb){var _0x3c04ba=_[_0x4cf5('0x35')](_0x10b7cb)||_[_0x4cf5('0x36')](_0x10b7cb)?_0x10b7cb['toString']():_0x10b7cb;return this[_0x4cf5('0x25')](util['format'](_0x4cf5('0x37'),_0x4d919c,_0x3c04ba?_0x3c04ba[_0x4cf5('0x38')]()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype'][_0x4cf5('0x39')]=function(_0x4caaaa,_0x52038a){return this['sendRequest'](util[_0x4cf5('0x2a')](_0x4cf5('0x3a'),_0x4caaaa,_0x52038a));};AGIChannel[_0x4cf5('0x24')][_0x4cf5('0x3b')]=function(_0x4dea86,_0x4d2d15){return this['sendRequest'](util[_0x4cf5('0x2a')](_0x4cf5('0x3c'),_0x4dea86,_0x4d2d15));};AGIChannel[_0x4cf5('0x24')][_0x4cf5('0x3d')]=function(_0x3de15f,_0x2b62a1){return this[_0x4cf5('0x25')](util[_0x4cf5('0x2a')](_0x4cf5('0x3e'),_0x3de15f,_0x2b62a1));};AGIChannel[_0x4cf5('0x24')][_0x4cf5('0x3f')]=function(_0x362a0,_0x424188,_0x4887b3){_0x424188=_0x424188||this['extension'];_0x4887b3=_0x4887b3||0x1;this[_0x4cf5('0x2f')](_0x362a0);this['setExtension'](_0x424188);this[_0x4cf5('0x33')](_0x4887b3);return this[_0x4cf5('0x40')](util['format']('GOTO\x20%s\x20%s\x20%s',_0x362a0,_0x424188,_0x4887b3));};AGIChannel['prototype'][_0x4cf5('0x41')]=function(_0x42276e){return this[_0x4cf5('0x25')](util['format'](_0x4cf5('0x42'),_0x42276e));};AGIChannel[_0x4cf5('0x24')][_0x4cf5('0x43')]=function(_0xa9a2b0,_0x39f091,_0x4381d4,_0x432013,_0x52dcfa,_0x823aca){_0x39f091=_0x39f091||'wav';_0x4381d4=_0x4381d4||'';_0x432013=_0x432013===undefined?-0x1:_0x432013==='-1'?-0x1:_0x432013*0x3e8;_0x52dcfa=_0x52dcfa===undefined?'':'s='+_0x52dcfa;_0x823aca=_0x823aca?_0x4cf5('0x44'):'';return this[_0x4cf5('0x25')](util['format']('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0xa9a2b0,_0x39f091,_0x4381d4,_0x432013,_0x823aca,_0x52dcfa));};AGIChannel[_0x4cf5('0x24')][_0x4cf5('0x45')]=function(_0x322250,_0x1df124){_0x1df124=_0x1df124||'';return this['sendRequest'](util[_0x4cf5('0x2a')](_0x4cf5('0x46'),_0x322250,_0x1df124));};AGIChannel[_0x4cf5('0x24')][_0x4cf5('0x47')]=function(_0xdb3156){return this['exec'](_0x4cf5('0x48'),_0xdb3156);};AGIChannel[_0x4cf5('0x24')][_0x4cf5('0x49')]=function(_0x26da65){return this['exec'](_0x4cf5('0x4a'),_0x26da65);};AGIChannel[_0x4cf5('0x24')]['error']=function(_0x226aaf,_0x3f3813){this[_0x4cf5('0x40')](util[_0x4cf5('0x2a')](_0x4cf5('0x4b'),_0x226aaf['id'],_0x226aaf[_0x4cf5('0x4c')],_0x3f3813));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file +var _0x7373=['VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','setContext','setExtension','SET\x20EXTENSION\x20%s','SET\x20PRIORITY\x20%s','isBoolean','isNumber','toString','sayNumber','SAY\x20NUMBER\x20%s\x20%s','SAY\x20DIGITS\x20%s\x20%s','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','setPriority','noop','GOTO\x20%s\x20%s\x20%s','recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','AGI','wait','WAIT','label','exports','util','events','EventEmitter','./reply','./error','call','utf8','setTimeout','setEncoding','headers','emit','toLowerCase','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','replace','result=','indexOf','substr','startsWith','split','length','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','destroy','pipe','write','inherits','prototype','command','sync','sendRequest','ANSWER','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','NO\x20MESSAGE'];(function(_0x35d525,_0x502576){var _0x1b3692=function(_0x58a387){while(--_0x58a387){_0x35d525['push'](_0x35d525['shift']());}};_0x1b3692(++_0x502576);}(_0x7373,0x1db));var _0x3737=function(_0x813156,_0x3fb4d2){_0x813156=_0x813156-0x0;var _0x160807=_0x7373[_0x813156];return _0x160807;};'use strict';var util=require(_0x3737('0x0'));var _=require('lodash');var EventEmitter=require(_0x3737('0x1'))[_0x3737('0x2')];var AGIReply=require(_0x3737('0x3'));var AGIError=require(_0x3737('0x4'));function AGIChannel(_0x3ae9c8){var _0xc213fb=this,_0xda40f7=new AGIReply(),_0x4c0061=![],_0xa0d96f={};EventEmitter[_0x3737('0x5')](_0xc213fb);_0x3ae9c8['setEncoding'](_0x3737('0x6'));_0x3ae9c8[_0x3737('0x7')](0x8*0x3c*0x3c*0x3e8);_0xda40f7[_0x3737('0x8')](_0x3737('0x6'));_0xda40f7['on'](_0x3737('0x9'),function(_0x4c32cb){for(var _0x3eccf4 in _0x4c32cb){_0xc213fb[_0x3eccf4]=_0x4c32cb[_0x3eccf4];}_0xc213fb[_0x3737('0xa')]('ready');});_0xda40f7['on']('line',function(_0x531475){if(_0x531475[_0x3737('0xb')]()==_0x3737('0xc')){_0xc213fb[_0x3737('0xa')](_0x3737('0xc'));return;}if(_0x531475[_0x3737('0xd')](0x0,0xb)==_0x3737('0xe')){_0x4c0061=!![];}if(_0x4c0061){_0xa0d96f['rx']+=_0x531475+'\x0a';if(_0x531475[_0x3737('0xf')](_0x3737('0x10'))!=-0x1){_0x4c0061=![];}}else{_0xa0d96f['rx']=_0x531475;}if(_0x4c0061){return;}if(typeof _0xa0d96f['cb']==_0x3737('0x11')){var _0x1e0562=_0xa0d96f['rx'][_0x3737('0xd')](0x0,0x3),_0x4af37d=null,_0x3c80cb=null;_0x1e0562=parseInt(_0x1e0562);if(isNaN(_0x1e0562)){_0xa0d96f['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x1e0562!=0xc8){_0xa0d96f['cb'](null,{'code':_0x1e0562,'result':-0x1,'extra':'KO'});return;}_0x4af37d=_0xa0d96f['rx'][_0x3737('0xd')](0x4)[_0x3737('0x12')](_0x3737('0x13'),'');if(_0x4af37d[_0x3737('0x14')]('\x20')!=-0x1){_0x4af37d=_0x4af37d[_0x3737('0x15')](0x0,_0x4af37d[_0x3737('0x14')]('\x20'));}if(_[_0x3737('0x16')](_0x4af37d,'-1')){_0x4af37d=parseInt(_0x4af37d);}_0x3c80cb=_0xa0d96f['rx'][_0x3737('0x17')]('\x20');if(_0x3c80cb[_0x3737('0x18')]==0x3){_0x3c80cb=_0x3c80cb[0x2]['substring'](0x1,_0x3c80cb[0x2][_0x3737('0x18')]-0x1);}else if(_0x3c80cb[_0x3737('0x18')]>0x3){var _0x43d972=/\((.+)\)/;var _0x3ff628=_0xa0d96f['rx']['match'](_0x43d972);if(_0x3ff628){_0x3c80cb=_0x3ff628[0x1];}else{_0x3c80cb=null;}}else{_0x3c80cb=null;}_0xa0d96f['cb'](null,{'code':_0x1e0562,'result':_0x4af37d,'extra':_0x3c80cb});}});_0x3ae9c8['on'](_0x3737('0x19'),function(_0x141fbe){_0xc213fb['emit'](_0x3737('0x19'),new AGIError(_0x3737('0x1a'),_0x141fbe[_0x3737('0x1b')]));});_0x3ae9c8['on'](_0x3737('0x1c'),function(){_0xc213fb[_0x3737('0xa')](_0x3737('0x1c'),new AGIError(_0x3737('0x1d')));});_0x3ae9c8['on'](_0x3737('0x1e'),function(){_0xc213fb['emit'](_0x3737('0x1e'),new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x3ae9c8[_0x3737('0x1f')]();});_0x3ae9c8[_0x3737('0x20')](_0xda40f7);this['command']=function(_0x1e158a,_0x711877){var _0x1e158a=_0x1e158a||'',_0x711877=typeof _0x711877=='function'?_0x711877:new Function();_0xa0d96f={'tx':_0x1e158a,'rx':'','cb':_0x711877};_0x3ae9c8[_0x3737('0x21')](_0x1e158a+'\x0a');},this[_0x3737('0x1c')]=function(){_0x3ae9c8[_0x3737('0x1f')]();};}util[_0x3737('0x22')](AGIChannel,EventEmitter);AGIChannel[_0x3737('0x23')]['sendRequest']=function(_0xd86d66){return this[_0x3737('0x24')][_0x3737('0x25')](this,_0xd86d66);};AGIChannel[_0x3737('0x23')]['answer']=function(){return this[_0x3737('0x26')](_0x3737('0x27'));};AGIChannel[_0x3737('0x23')]['getData']=function(_0x2173cd,_0x5e96f4,_0x47b19f){_0x2173cd=_0x2173cd===undefined?'beep':_0x2173cd;_0x5e96f4=_0x5e96f4===undefined?'5':_0x5e96f4;_0x47b19f=_0x47b19f===undefined?'1':_0x47b19f;return this[_0x3737('0x26')](util[_0x3737('0x28')](_0x3737('0x29'),_0x2173cd,_0x5e96f4*0x3e8,_0x47b19f));};AGIChannel[_0x3737('0x23')]['noop']=function(_0x1062b9){_0x1062b9=_0x1062b9||_0x3737('0x2a');return this[_0x3737('0x26')](util[_0x3737('0x28')](_0x3737('0x2b'),_0x1062b9));};AGIChannel['prototype'][_0x3737('0x2c')]=function(_0x1a3c68,_0x1ba6fa){if(_[_0x3737('0x2d')](_0x1ba6fa)){return this[_0x3737('0x26')](util[_0x3737('0x28')](_0x3737('0x2e'),_0x1a3c68,_0x1ba6fa[_0x3737('0x2f')](',')));}return this[_0x3737('0x26')](util[_0x3737('0x28')](_0x3737('0x2e'),_0x1a3c68,_0x1ba6fa));};AGIChannel[_0x3737('0x23')][_0x3737('0x30')]=function(_0x18343a){return this[_0x3737('0x26')](util['format']('SET\x20CONTEXT\x20%s',_0x18343a));};AGIChannel[_0x3737('0x23')][_0x3737('0x31')]=function(_0x87e3a8){return this[_0x3737('0x26')](util[_0x3737('0x28')](_0x3737('0x32'),_0x87e3a8));};AGIChannel[_0x3737('0x23')]['setPriority']=function(_0x32e4a7){return this[_0x3737('0x26')](util[_0x3737('0x28')](_0x3737('0x33'),_0x32e4a7));};AGIChannel[_0x3737('0x23')][_0x3737('0xc')]=function(){return this[_0x3737('0x26')]('HANGUP');};AGIChannel[_0x3737('0x23')]['setVariable']=function(_0x2a19fe,_0xc94f9f){var _0x2a2510=_[_0x3737('0x34')](_0xc94f9f)||_[_0x3737('0x35')](_0xc94f9f)?_0xc94f9f['toString']():_0xc94f9f;return this[_0x3737('0x26')](util['format']('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x2a19fe,_0x2a2510?_0x2a2510[_0x3737('0x36')]()[_0x3737('0x12')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype'][_0x3737('0x37')]=function(_0x332c80,_0x480fda){return this[_0x3737('0x26')](util[_0x3737('0x28')](_0x3737('0x38'),_0x332c80,_0x480fda));};AGIChannel['prototype']['sayDigits']=function(_0x237fcc,_0x12edde){return this[_0x3737('0x26')](util[_0x3737('0x28')](_0x3737('0x39'),_0x237fcc,_0x12edde));};AGIChannel[_0x3737('0x23')]['sayPhonetic']=function(_0x1d255f,_0x7496d6){return this[_0x3737('0x26')](util[_0x3737('0x28')](_0x3737('0x3a'),_0x1d255f,_0x7496d6));};AGIChannel[_0x3737('0x23')][_0x3737('0x3b')]=function(_0x27c5f1,_0x543afa,_0x3cae14){_0x543afa=_0x543afa||this[_0x3737('0x3c')];_0x3cae14=_0x3cae14||0x1;this[_0x3737('0x30')](_0x27c5f1);this['setExtension'](_0x543afa);this[_0x3737('0x3d')](_0x3cae14);return this[_0x3737('0x3e')](util[_0x3737('0x28')](_0x3737('0x3f'),_0x27c5f1,_0x543afa,_0x3cae14));};AGIChannel[_0x3737('0x23')]['getVariable']=function(_0x56e6ef){return this[_0x3737('0x26')](util[_0x3737('0x28')]('GET\x20VARIABLE\x20\x22%s\x22',_0x56e6ef));};AGIChannel['prototype'][_0x3737('0x40')]=function(_0xf5921c,_0x975105,_0x48ff38,_0x147717,_0x3c92f9,_0x577178){_0x975105=_0x975105||_0x3737('0x41');_0x48ff38=_0x48ff38||'';_0x147717=_0x147717===undefined?-0x1:_0x147717==='-1'?-0x1:_0x147717*0x3e8;_0x3c92f9=_0x3c92f9===undefined?'':'s='+_0x3c92f9;_0x577178=_0x577178?_0x3737('0x42'):'';return this[_0x3737('0x26')](util[_0x3737('0x28')](_0x3737('0x43'),_0xf5921c,_0x975105,_0x48ff38,_0x147717,_0x577178,_0x3c92f9));};AGIChannel['prototype'][_0x3737('0x44')]=function(_0x23cbc8,_0x47ed7f){_0x47ed7f=_0x47ed7f||'';return this[_0x3737('0x26')](util['format']('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x23cbc8,_0x47ed7f));};AGIChannel[_0x3737('0x23')]['agi']=function(_0x271d39){return this[_0x3737('0x2c')](_0x3737('0x45'),_0x271d39);};AGIChannel[_0x3737('0x23')][_0x3737('0x46')]=function(_0xea42df){return this['exec'](_0x3737('0x47'),_0xea42df);};AGIChannel[_0x3737('0x23')][_0x3737('0x19')]=function(_0x171390,_0x364d6a){this['noop'](util[_0x3737('0x28')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x171390['id'],_0x171390[_0x3737('0x48')],_0x364d6a));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x3737('0x49')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 28e3383..2a0831a 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 _0x0ea8=['name','exports','util','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','message'];(function(_0x1e5d37,_0x8115f1){var _0x5b3b8e=function(_0xa69629){while(--_0xa69629){_0x1e5d37['push'](_0x1e5d37['shift']());}};_0x5b3b8e(++_0x8115f1);}(_0x0ea8,0x1a2));var _0x80ea=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x0ea8[_0x1ac595];return _0x455fff;};'use strict';var util=require(_0x80ea('0x0'));var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':_0x80ea('0x1'),'E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':_0x80ea('0x2'),'E_AGI_SERVER_MAXCONNECTION':_0x80ea('0x3'),'E_AGI_SERVER_VOICE_DISABLED':_0x80ea('0x4'),'E_AGI_SOCKET_ERROR':_0x80ea('0x5'),'E_AGI_SOCKET_CLOSE':_0x80ea('0x6'),'E_AGI_SOCKET_TIMEOUT':_0x80ea('0x7'),'E_AGI_COMMAND_EMPTY':_0x80ea('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x80ea('0x9'),'E_AGI_IVR_ENTRY':_0x80ea('0xa')};function AGIError(_0x160ba8){var _0x160ba8=_0x160ba8||null,_0x15470e=_0x15470e||[],_0xd5e5a3=0x1,_0x112ecf='';if(!error[_0x160ba8]){_0x160ba8=_0x80ea('0xb');}_0x15470e[_0x80ea('0xc')](error[_0x160ba8]);while(arguments[_0xd5e5a3]){_0x15470e[_0x80ea('0xc')](arguments[_0xd5e5a3]);_0xd5e5a3++;}_0x112ecf=util['format']['apply'](util,_0x15470e);this[_0x80ea('0xd')]=_0x112ecf;this[_0x80ea('0xe')]=_0x160ba8;}module[_0x80ea('0xf')]=AGIError; \ No newline at end of file +var _0xdb7c=['message','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','apply'];(function(_0x5ee045,_0x313197){var _0x31a6f9=function(_0x551a8b){while(--_0x551a8b){_0x5ee045['push'](_0x5ee045['shift']());}};_0x31a6f9(++_0x313197);}(_0xdb7c,0x15f));var _0xcdb7=function(_0x2df413,_0x5303ae){_0x2df413=_0x2df413-0x0;var _0x1f5133=_0xdb7c[_0x2df413];return _0x1f5133;};'use strict';var util=require(_0xcdb7('0x0'));var error={'E_AGI_UNDEFINED':_0xcdb7('0x1'),'E_AGI_ARGUMENT_PORT':_0xcdb7('0x2'),'E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':_0xcdb7('0x3'),'E_AGI_SERVER_VOICE_DISABLED':_0xcdb7('0x4'),'E_AGI_SOCKET_ERROR':_0xcdb7('0x5'),'E_AGI_SOCKET_CLOSE':_0xcdb7('0x6'),'E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':_0xcdb7('0x7'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xcdb7('0x8'),'E_AGI_IVR_ENTRY':_0xcdb7('0x9')};function AGIError(_0xf4273e){var _0xf4273e=_0xf4273e||null,_0x1f1a08=_0x1f1a08||[],_0x3e2eba=0x1,_0x36824d='';if(!error[_0xf4273e]){_0xf4273e=_0xcdb7('0xa');}_0x1f1a08['push'](error[_0xf4273e]);while(arguments[_0x3e2eba]){_0x1f1a08[_0xcdb7('0xb')](arguments[_0x3e2eba]);_0x3e2eba++;}_0x36824d=util['format'][_0xcdb7('0xc')](util,_0x1f1a08);this[_0xcdb7('0xd')]=_0x36824d;this['name']=_0xf4273e;}module['exports']=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index 55ab95e..fad210d 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 _0x9091=['defaults','redis','localhost','subscribe','agi','emit','E_AGI_SERVER_ERROR','message','parse','projectUpdate','exports','lodash','events','EventEmitter','ioredis','./error','../../config/environment'];(function(_0x168424,_0x2bd624){var _0x140742=function(_0x491db3){while(--_0x491db3){_0x168424['push'](_0x168424['shift']());}};_0x140742(++_0x2bd624);}(_0x9091,0xb5));var _0x1909=function(_0x12d1c6,_0x5b9a72){_0x12d1c6=_0x12d1c6-0x0;var _0x1552f0=_0x9091[_0x12d1c6];return _0x1552f0;};'use strict';var _=require(_0x1909('0x0'));var EventEmitter=require(_0x1909('0x1'))[_0x1909('0x2')];var Redis=require(_0x1909('0x3'));var AGIError=require(_0x1909('0x4'));var config=require(_0x1909('0x5'));config['redis']=_[_0x1909('0x6')](config[_0x1909('0x7')],{'host':_0x1909('0x8'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x1909('0x7')]);sub[_0x1909('0x9')](_0x1909('0xa'),function(_0x388784){if(_0x388784)return eventEmitter[_0x1909('0xb')]('error',new AGIError(_0x1909('0xc'),_0x388784));});sub['on'](_0x1909('0xd'),function(_0x1a0b0b,_0x5bde6e){if(_0x1a0b0b!==_0x1909('0xa'))return;try{var _0x39f149=JSON[_0x1909('0xe')](_0x5bde6e);eventEmitter['emit'](_0x1909('0xf'),_0x39f149);}catch(_0x20f767){eventEmitter[_0x1909('0xb')]('error',new AGIError(_0x1909('0xc'),_0x20f767));}});module[_0x1909('0x10')]={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0x2c9e=['subscribe','agi','emit','error','E_AGI_SERVER_ERROR','parse','projectUpdate','lodash','events','EventEmitter','ioredis','../../config/environment','redis','localhost'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2c9e,0x103));var _0xe2c9=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x2c9e[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0xe2c9('0x0'));var EventEmitter=require(_0xe2c9('0x1'))[_0xe2c9('0x2')];var Redis=require(_0xe2c9('0x3'));var AGIError=require('./error');var config=require(_0xe2c9('0x4'));config[_0xe2c9('0x5')]=_['defaults'](config[_0xe2c9('0x5')],{'host':_0xe2c9('0x6'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0xe2c9('0x5')]);sub[_0xe2c9('0x7')](_0xe2c9('0x8'),function(_0x30043d){if(_0x30043d)return eventEmitter[_0xe2c9('0x9')](_0xe2c9('0xa'),new AGIError(_0xe2c9('0xb'),_0x30043d));});sub['on']('message',function(_0x262702,_0x2fbdc8){if(_0x262702!==_0xe2c9('0x8'))return;try{var _0x5cf124=JSON[_0xe2c9('0xc')](_0x2fbdc8);eventEmitter[_0xe2c9('0x9')](_0xe2c9('0xd'),_0x5cf124);}catch(_0x55076e){eventEmitter[_0xe2c9('0x9')](_0xe2c9('0xa'),new AGIError(_0xe2c9('0xb'),_0x55076e));}});module['exports']={'EventEmitter':eventEmitter}; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index f140665..2b28424 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 _0xcc4b=['default','menu','default\x20on\x20switch\x20not\x20found','includes','condition\x20not\x20found','getdigits','getsecretdigits','vertices','edges','numberOfEdges','addVertex','prototype','addEdge','push','size','relations','getVertex','traverseBFS','info','no\x20vertex\x20found','stop\x20traverse','no\x20edge/s\x20available','condition','split','length','agicommand','vswitch','target'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0xcc4b,0x155));var _0xbcc4=function(_0x23cd34,_0xe7e8f7){_0x23cd34=_0x23cd34-0x0;var _0x1e1e48=_0xcc4b[_0x23cd34];return _0x1e1e48;};'use strict';var _=require('lodash');var logger=require('../../../config/logger')('agi');var verticesWithRetry=['menu',_0xbcc4('0x0'),_0xbcc4('0x1')];var Graph=function(){this[_0xbcc4('0x2')]={};this[_0xbcc4('0x3')]={};this[_0xbcc4('0x4')]=0x0;};Graph['prototype'][_0xbcc4('0x5')]=function(_0x2abbc5){this[_0xbcc4('0x2')][_0x2abbc5['id']]=_0x2abbc5;this[_0xbcc4('0x3')][_0x2abbc5['id']]=[];};Graph[_0xbcc4('0x6')][_0xbcc4('0x7')]=function(_0x171ae4,_0x20000b,_0xbf8f32){this['edges'][_0x171ae4][_0xbcc4('0x8')]({'target':_0x20000b,'condition':_0xbf8f32});this[_0xbcc4('0x4')]+=0x1;};Graph[_0xbcc4('0x6')][_0xbcc4('0x9')]=function(){return _[_0xbcc4('0x9')](this[_0xbcc4('0x2')]);};Graph[_0xbcc4('0x6')][_0xbcc4('0xa')]=function(){return this[_0xbcc4('0x4')];};Graph['prototype'][_0xbcc4('0xb')]=function(_0x5dbc3e){return this[_0xbcc4('0x2')][_0x5dbc3e];};Graph[_0xbcc4('0x6')][_0xbcc4('0xc')]=function(_0x3b484b,_0xd19c47){if(!this[_0xbcc4('0x2')][_0x3b484b]){return logger[_0xbcc4('0xd')](_0xbcc4('0xe'));}var _0x3052c1=_0xd19c47(this[_0xbcc4('0x2')][_0x3b484b]);if(!_0x3052c1){return logger['info'](_0xbcc4('0xf'));}if(this['edges'][_0x3b484b]['length']===0x0){return logger[_0xbcc4('0xd')](_0xbcc4('0x10'));}for(var _0x156e81=0x0,_0x37c34a=[],_0x1639cd=![];_0x156e81\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','evtHangup','then','hasOwnProperty','indexOf','substring','variables','stringify','uniqueid','close','timeout'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x3ad3,0x8a));var _0x33ad=function(_0x3a50b1,_0x32e332){_0x3a50b1=_0x3a50b1-0x0;var _0x495a48=_0x3ad3[_0x3a50b1];return _0x495a48;};'use strict';var _=require(_0x33ad('0x0'));var syncho=require(_0x33ad('0x1'));var util=require(_0x33ad('0x2'));var config=require(_0x33ad('0x3'));var logger=require(_0x33ad('0x4'))(_0x33ad('0x5'));var utilLicense=require(_0x33ad('0x6'));var rpc=require(_0x33ad('0x7'));var Project=require(_0x33ad('0x8'));var AGIEmitter=require(_0x33ad('0x9'))[_0x33ad('0xa')];var projects=[];config[_0x33ad('0x5')]=_[_0x33ad('0xb')](config[_0x33ad('0x5')],{'ip':_0x33ad('0xc'),'port':0x11dd});AGIEmitter['on'](_0x33ad('0xd'),projectUpdateHandler);function connectionHandler(_0x100c38){process[_0x33ad('0xe')](function(){syncho(function(){try{setChannelVariables(_0x100c38);agiHandler(_0x100c38);}catch(_0x19ac30){logger[_0x33ad('0xf')](_0x19ac30['stack']);}});});}function projectUpdateHandler(_0x3e1f94){try{var _0x23a225=_[_0x33ad('0x10')](projects,['id',_0x3e1f94['id']]);if(_0x23a225>-0x1){if(_0x3e1f94[_0x33ad('0x11')]===!![]){projects['splice'](_0x23a225,0x1);}else{projects[_0x23a225]=_0x3e1f94;}}else{projects['push'](_0x3e1f94);}}catch(_0x91ab44){logger[_0x33ad('0xf')](_0x91ab44[_0x33ad('0x12')]);}}function listeningHandler(){console[_0x33ad('0x13')]('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config[_0x33ad('0x5')]['port']);logger[_0x33ad('0x14')](util['format']('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config[_0x33ad('0x5')]['ip'],config[_0x33ad('0x5')]['port']));}function errorHandler(_0x5b72da){if(_0x5b72da&&_0x5b72da[_0x33ad('0x15')]&&_0x5b72da[_0x33ad('0x16')]){logger[_0x33ad('0xf')](util[_0x33ad('0x17')]('[%s]\x20%s',_0x5b72da[_0x33ad('0x15')],_0x5b72da[_0x33ad('0x16')]));}else{logger[_0x33ad('0xf')](util[_0x33ad('0x17')](_0x33ad('0x18'),_0x5b72da[_0x33ad('0x12')]));}}function closeHandler(){logger[_0x33ad('0x14')](util['format'](_0x33ad('0x19'),this[_0x33ad('0x1a')],this[_0x33ad('0x1b')],this[_0x33ad('0x1c')],this[_0x33ad('0x1d')],this['uniqueid']));try{createSquareReport(this);}catch(_0x3dbab3){logger[_0x33ad('0xf')](_0x3dbab3['stack']);}}function timeoutHandler(){logger[_0x33ad('0x14')](util['format'](_0x33ad('0x1e'),this[_0x33ad('0x1a')],this[_0x33ad('0x1b')],this[_0x33ad('0x1c')],this[_0x33ad('0x1d')],this['uniqueid']));}function hangupHandler(){logger[_0x33ad('0x14')](util[_0x33ad('0x17')](_0x33ad('0x1f'),this[_0x33ad('0x1a')],this['calleridname'],this[_0x33ad('0x1c')],this[_0x33ad('0x1d')],this['uniqueid']));this[_0x33ad('0x20')]=!![];}function createSquareReport(_0x396bfd,_0x3d48e3){rpc['createSquareReport'](_0x396bfd)[_0x33ad('0x21')](function(_0x745660){if(_0x3d48e3){_0x3d48e3(null,_0x745660);}})['catch'](function(_0x4a452e){if(_0x3d48e3){_0x3d48e3(null,_0x4a452e);}});}function setChannelVariables(_0x547240){for(var _0x53c76f in _0x547240){if(_0x547240[_0x33ad('0x22')](_0x53c76f)){if(_0x53c76f[_0x33ad('0x23')]('agi_')===0x0){_0x547240[_0x53c76f[_0x33ad('0x24')](0x4)]=_0x547240[_0x53c76f];delete _0x547240[_0x53c76f];}}}}function agiHandler(_0x3c102f){logger['debug'](_0x33ad('0x25'),JSON[_0x33ad('0x26')](_0x3c102f,null,0x2));logger['info'](util[_0x33ad('0x17')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x3c102f[_0x33ad('0x1a')],_0x3c102f[_0x33ad('0x1b')],_0x3c102f[_0x33ad('0x1c')],_0x3c102f[_0x33ad('0x1d')],_0x3c102f[_0x33ad('0x27')]));_0x3c102f['on'](_0x33ad('0xf'),errorHandler);_0x3c102f['on'](_0x33ad('0x28'),closeHandler);_0x3c102f['on'](_0x33ad('0x29'),timeoutHandler);_0x3c102f[_0x33ad('0x20')]=![];_0x3c102f['on'](_0x33ad('0x2a'),hangupHandler);var _0x5b2402=_[_0x33ad('0x2b')](projects,[_0x33ad('0x15'),_0x3c102f[_0x33ad('0x1a')]]);if(!_0x5b2402)return Project[_0x33ad('0x2c')](_0x3c102f);if(!_0x5b2402[_0x33ad('0x2d')])return Project[_0x33ad('0x2e')](_0x3c102f);return Project[_0x33ad('0x2f')](_0x5b2402,_0x3c102f);}function main(){var _0x229e8c;return utilLicense[_0x33ad('0x30')]()[_0x33ad('0x21')](function(_0x4fcece){if(!_0x4fcece)return;if(_0x4fcece[_0x33ad('0x31')]){if(_0x4fcece[_0x33ad('0x32')]&&_0x4fcece[_0x33ad('0x32')]>0x0){logger[_0x33ad('0x14')](util[_0x33ad('0x17')]('[LICENSE]\x20CHANNELS:\x20%s',_0x4fcece[_0x33ad('0x32')]));_0x229e8c=_0x4fcece[_0x33ad('0x32')];}else{logger[_0x33ad('0x14')](_0x33ad('0x33'));}}else{logger[_0x33ad('0x14')](_0x33ad('0x34'));_0x229e8c=-0x1;}})['then'](function(){return Project[_0x33ad('0x35')]();})[_0x33ad('0x21')](function(_0x5ac833){projects=_0x5ac833;return;})[_0x33ad('0x36')](function(_0x5a394f){logger[_0x33ad('0xf')](_0x33ad('0x37'),_0x5a394f['stack']);})[_0x33ad('0x38')](function(){var _0x245a43=require(_0x33ad('0x39'))(config[_0x33ad('0x5')][_0x33ad('0x3a')],config[_0x33ad('0x5')]['ip'],_0x229e8c);_0x245a43['on'](_0x33ad('0xf'),errorHandler);_0x245a43['on']('listening',listeningHandler);_0x245a43['on'](_0x33ad('0x3b'),connectionHandler);_0x245a43['on']('close',closeHandler);});}main(); \ No newline at end of file +var _0x92f6=['handleUnpublished','initialize','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','[LICENSE]','./server','listening','connection','close','lodash','syncho','util','../../config/environment','agi','./project','./events','EventEmitter','defaults','127.0.0.1','projectUpdate','stack','findIndex','deleted','splice','error','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','[%s]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[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','timeout','find','handleNotFound','production'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x92f6,0x13f));var _0x692f=function(_0x473e36,_0x3835f0){_0x473e36=_0x473e36-0x0;var _0x32cd5a=_0x92f6[_0x473e36];return _0x32cd5a;};'use strict';var _=require(_0x692f('0x0'));var syncho=require(_0x692f('0x1'));var util=require(_0x692f('0x2'));var config=require(_0x692f('0x3'));var logger=require('../../config/logger')(_0x692f('0x4'));var utilLicense=require('../../config/license/util');var rpc=require('./rpc');var Project=require(_0x692f('0x5'));var AGIEmitter=require(_0x692f('0x6'))[_0x692f('0x7')];var projects=[];config[_0x692f('0x4')]=_[_0x692f('0x8')](config[_0x692f('0x4')],{'ip':_0x692f('0x9'),'port':0x11dd});AGIEmitter['on'](_0x692f('0xa'),projectUpdateHandler);function connectionHandler(_0x54400b){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x54400b);agiHandler(_0x54400b);}catch(_0x2ce90d){logger['error'](_0x2ce90d[_0x692f('0xb')]);}});});}function projectUpdateHandler(_0x548699){try{var _0x41c53d=_[_0x692f('0xc')](projects,['id',_0x548699['id']]);if(_0x41c53d>-0x1){if(_0x548699[_0x692f('0xd')]===!![]){projects[_0x692f('0xe')](_0x41c53d,0x1);}else{projects[_0x41c53d]=_0x548699;}}else{projects['push'](_0x548699);}}catch(_0x4cc49a){logger[_0x692f('0xf')](_0x4cc49a[_0x692f('0xb')]);}}function listeningHandler(){console[_0x692f('0x10')](_0x692f('0x11'),config[_0x692f('0x4')][_0x692f('0x12')]);logger[_0x692f('0x13')](util[_0x692f('0x14')](_0x692f('0x15'),config['agi']['ip'],config['agi'][_0x692f('0x12')]));}function errorHandler(_0x1e3346){if(_0x1e3346&&_0x1e3346[_0x692f('0x16')]&&_0x1e3346[_0x692f('0x17')]){logger[_0x692f('0xf')](util[_0x692f('0x14')](_0x692f('0x18'),_0x1e3346[_0x692f('0x16')],_0x1e3346[_0x692f('0x17')]));}else{logger[_0x692f('0xf')](util[_0x692f('0x14')]('[ERROR]\x20%s',_0x1e3346[_0x692f('0xb')]));}}function closeHandler(){logger[_0x692f('0x13')](util[_0x692f('0x14')](_0x692f('0x19'),this[_0x692f('0x1a')],this[_0x692f('0x1b')],this[_0x692f('0x1c')],this[_0x692f('0x1d')],this[_0x692f('0x1e')]));try{createSquareReport(this);}catch(_0x18e9a5){logger[_0x692f('0xf')](_0x18e9a5[_0x692f('0xb')]);}}function timeoutHandler(){logger['info'](util[_0x692f('0x14')](_0x692f('0x1f'),this[_0x692f('0x1a')],this[_0x692f('0x1b')],this[_0x692f('0x1c')],this[_0x692f('0x1d')],this[_0x692f('0x1e')]));}function hangupHandler(){logger['info'](util[_0x692f('0x14')](_0x692f('0x20'),this[_0x692f('0x1a')],this['calleridname'],this['callerid'],this[_0x692f('0x1d')],this[_0x692f('0x1e')]));this[_0x692f('0x21')]=!![];}function createSquareReport(_0x5dda29,_0x161690){rpc['createSquareReport'](_0x5dda29)[_0x692f('0x22')](function(_0x54deb1){if(_0x161690){_0x161690(null,_0x54deb1);}})[_0x692f('0x23')](function(_0x48c962){if(_0x161690){_0x161690(null,_0x48c962);}});}function setChannelVariables(_0x245b12){for(var _0x1371f7 in _0x245b12){if(_0x245b12[_0x692f('0x24')](_0x1371f7)){if(_0x1371f7[_0x692f('0x25')](_0x692f('0x26'))===0x0){_0x245b12[_0x1371f7[_0x692f('0x27')](0x4)]=_0x245b12[_0x1371f7];delete _0x245b12[_0x1371f7];}}}}function agiHandler(_0xbf34ca){logger[_0x692f('0x28')](_0x692f('0x29'),JSON[_0x692f('0x2a')](_0xbf34ca,null,0x2));logger[_0x692f('0x13')](util[_0x692f('0x14')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0xbf34ca[_0x692f('0x1a')],_0xbf34ca[_0x692f('0x1b')],_0xbf34ca[_0x692f('0x1c')],_0xbf34ca['dnid'],_0xbf34ca['uniqueid']));_0xbf34ca['on'](_0x692f('0xf'),errorHandler);_0xbf34ca['on']('close',closeHandler);_0xbf34ca['on'](_0x692f('0x2b'),timeoutHandler);_0xbf34ca[_0x692f('0x21')]=![];_0xbf34ca['on']('hangup',hangupHandler);var _0x400090=_[_0x692f('0x2c')](projects,[_0x692f('0x16'),_0xbf34ca[_0x692f('0x1a')]]);if(!_0x400090)return Project[_0x692f('0x2d')](_0xbf34ca);if(!_0x400090[_0x692f('0x2e')])return Project[_0x692f('0x2f')](_0xbf34ca);return Project[_0x692f('0x30')](_0x400090,_0xbf34ca);}function main(){var _0x326857;return utilLicense[_0x692f('0x31')]()[_0x692f('0x22')](function(_0x34671e){if(!_0x34671e)return;if(_0x34671e[_0x692f('0x32')]){if(_0x34671e['callysquare']&&_0x34671e[_0x692f('0x33')]>0x0){logger['info'](util[_0x692f('0x14')](_0x692f('0x34'),_0x34671e[_0x692f('0x33')]));_0x326857=_0x34671e[_0x692f('0x33')];}else{logger[_0x692f('0x13')](_0x692f('0x35'));}}else{logger[_0x692f('0x13')](_0x692f('0x36'));_0x326857=-0x1;}})[_0x692f('0x22')](function(){return Project[_0x692f('0x37')]();})[_0x692f('0x22')](function(_0x3de9cb){projects=_0x3de9cb;return;})[_0x692f('0x23')](function(_0x2b801b){logger['error'](_0x692f('0x38'),_0x2b801b[_0x692f('0xb')]);})['finally'](function(){var _0x47b1fe=require(_0x692f('0x39'))(config[_0x692f('0x4')][_0x692f('0x12')],config[_0x692f('0x4')]['ip'],_0x326857);_0x47b1fe['on'](_0x692f('0xf'),errorHandler);_0x47b1fe['on'](_0x692f('0x3a'),listeningHandler);_0x47b1fe['on'](_0x692f('0x3b'),connectionHandler);_0x47b1fe['on'](_0x692f('0x3c'),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 81049d9..228ba70 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 _0x13ca=['bluebird','jayson/promise','client','http','request','error','message','catch','SendMail'];(function(_0x20526e,_0x16ee55){var _0x5488da=function(_0x532a41){while(--_0x532a41){_0x20526e['push'](_0x20526e['shift']());}};_0x5488da(++_0x16ee55);}(_0x13ca,0xbd));var _0xa13c=function(_0xce5e05,_0x43e0b4){_0xce5e05=_0xce5e05-0x0;var _0x2357a4=_0x13ca[_0xce5e05];return _0x2357a4;};'use strict';var BPromise=require(_0xa13c('0x0'));var jayson=require(_0xa13c('0x1'));var client=jayson[_0xa13c('0x2')][_0xa13c('0x3')]({'port':0x232b});function request(_0x42eb0a,_0x3360e3){return new BPromise(function(_0x5a9823,_0x5cb240){return client[_0xa13c('0x4')](_0x42eb0a,_0x3360e3)['then'](function(_0x24d067){if(_0x24d067[_0xa13c('0x5')]){return _0x5cb240(_0x24d067[_0xa13c('0x5')][_0xa13c('0x6')]);}else{return _0x5a9823(_0x24d067['result']);}})[_0xa13c('0x7')](function(_0x4029d9){return _0x5cb240(_0x4029d9);});});}exports['sendMailMessage']=function(_0x1e7b2c,_0x250175){return request(_0xa13c('0x8'),{'account':_0x1e7b2c,'message':_0x250175});}; \ No newline at end of file +var _0x7b56=['SendMail','bluebird','jayson/promise','http','request','then','error','message','result','catch','sendMailMessage'];(function(_0x661afc,_0x343041){var _0x23e7fa=function(_0x166117){while(--_0x166117){_0x661afc['push'](_0x661afc['shift']());}};_0x23e7fa(++_0x343041);}(_0x7b56,0x1b9));var _0x67b5=function(_0xbc2510,_0x57dee1){_0xbc2510=_0xbc2510-0x0;var _0x456ca4=_0x7b56[_0xbc2510];return _0x456ca4;};'use strict';var BPromise=require(_0x67b5('0x0'));var jayson=require(_0x67b5('0x1'));var client=jayson['client'][_0x67b5('0x2')]({'port':0x232b});function request(_0x43553c,_0x324202){return new BPromise(function(_0xa2cb90,_0x62afab){return client[_0x67b5('0x3')](_0x43553c,_0x324202)[_0x67b5('0x4')](function(_0xfce591){if(_0xfce591[_0x67b5('0x5')]){return _0x62afab(_0xfce591[_0x67b5('0x5')][_0x67b5('0x6')]);}else{return _0xa2cb90(_0xfce591[_0x67b5('0x7')]);}})[_0x67b5('0x8')](function(_0x5a3936){return _0x62afab(_0x5a3936);});});}exports[_0x67b5('0x9')]=function(_0x6bb4c6,_0x513f30){return request(_0x67b5('0xa'),{'account':_0x6bb4c6,'message':_0x513f30});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index a1d7831..4043d16 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 _0x9239=['Project\x20%s\x20not\x20found','xml2json','util','agi','./rpc','./mailRpc','./graph','./vertices','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','hasOwnProperty','retry','isArray','length','source','addEdge','value','toJson','mxGraphModel','root','inspect','production','debug','stringify','format','YYYY-MM-DD\x20HH:mm:ss','mxCell','info','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','dnid','uniqueid','traverseBFS','start','vertex','gotoc','context','extension','priority','agicommand','response','code','isUndefined','result','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','clear','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','close'];(function(_0x32e956,_0x4e0011){var _0x66b395=function(_0x4489f1){while(--_0x4489f1){_0x32e956['push'](_0x32e956['shift']());}};_0x66b395(++_0x4e0011);}(_0x9239,0x1f0));var _0x9923=function(_0x45ad15,_0x5d1de9){_0x45ad15=_0x45ad15-0x0;var _0x1b2b03=_0x9239[_0x45ad15];return _0x1b2b03;};'use strict';var _=require('lodash');var moment=require('moment');var parser=require(_0x9923('0x0'));var util=require(_0x9923('0x1'));var logger=require('../../config/logger')(_0x9923('0x2'));var rpc=require(_0x9923('0x3'));var mailRpc=require(_0x9923('0x4'));var Graph=require(_0x9923('0x5'));var Vertices=require(_0x9923('0x6'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc['getSquareProjects']()[_0x9923('0x7')](function(_0x2a52b5){logger[_0x9923('0x8')](_0x9923('0x9'),_0x2a52b5[_0x9923('0xa')]);return[];});}function addVertex(_0x46da7c,_0x31bb01,_0x2a3e8b){_0x31bb01['agicommand']=_0x2a3e8b;if(_0x31bb01[_0x9923('0xb')](_0x9923('0xc'))){_0x31bb01['maxRetry']=parseInt(_0x31bb01[_0x9923('0xc')],0xa);}_0x46da7c['addVertex'](_['omit'](_0x31bb01,'mxCell'));}function initGraph(_0x7a424e,_0x261154){var _0x23f95b=new Graph();for(var _0x1088e2 in _0x7a424e){if(_0x7a424e[_0x9923('0xb')](_0x1088e2)){if(_[_0x9923('0xd')](_0x7a424e[_0x1088e2])){for(var _0x4b8474=0x0;_0x4b8474<_0x7a424e[_0x1088e2]['length'];_0x4b8474+=0x1){addVertex(_0x23f95b,_0x7a424e[_0x1088e2][_0x4b8474],_0x1088e2);}}else{addVertex(_0x23f95b,_0x7a424e[_0x1088e2],_0x1088e2);}}}for(var _0x501ff8=0x0;_0x501ff8<_0x261154[_0x9923('0xe')];_0x501ff8+=0x1){if(_0x261154[_0x501ff8][_0x9923('0xf')]&&_0x261154[_0x501ff8]['target']){_0x23f95b[_0x9923('0x10')](_0x261154[_0x501ff8][_0x9923('0xf')],_0x261154[_0x501ff8]['target'],_0x261154[_0x501ff8][_0x9923('0x11')]);}}return _0x23f95b;}function getRoot(_0x34f305){return parser[_0x9923('0x12')](_0x34f305,{'object':!![]})[_0x9923('0x13')][_0x9923('0x14')];}function inspect(_0x3c5bce){return util[_0x9923('0x15')](_0x3c5bce,{'showHidden':![],'depth':null});}function initialize(_0x3c89fb,_0x39d74e){var _0x37ac38=getRoot(_0x3c89fb[_0x9923('0x16')]);if(!_0x37ac38||!_0x37ac38['start'])return;var _0x2d33dd,_0x1e89d7,_0x14dd3e;logger[_0x9923('0x17')](_0x9923('0x14'),JSON[_0x9923('0x18')](_0x37ac38,null,0x2));_0x39d74e['joinAt']=moment()[_0x9923('0x19')](_0x9923('0x1a'));_0x2d33dd=initGraph(_['omit'](_0x37ac38,'mxCell'),_0x37ac38[_0x9923('0x1b')]);_0x1e89d7=new Vertices(_0x39d74e,rpc,mailRpc);logger[_0x9923('0x1c')](util['format'](_0x9923('0x1d'),_0x39d74e['arg_1'],_0x39d74e['calleridname'],_0x39d74e[_0x9923('0x1e')],_0x39d74e[_0x9923('0x1f')],_0x39d74e[_0x9923('0x20')]));_0x2d33dd[_0x9923('0x21')](_0x37ac38[_0x9923('0x22')]['id'],function(_0x2b5cb5){try{_0x2b5cb5=_0x1e89d7['clear'](_0x2b5cb5);logger[_0x9923('0x17')](_0x9923('0x23'),JSON[_0x9923('0x18')](_0x2b5cb5,null,0x2));if(_0x2b5cb5['agicommand']===_0x9923('0x24')){logger[_0x9923('0x1c')]('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x39d74e[_0x9923('0x25')]=_0x2b5cb5['context']||_0x39d74e['context'];_0x39d74e[_0x9923('0x26')]=_0x2b5cb5[_0x9923('0x26')];_0x39d74e[_0x9923('0x27')]=_0x2b5cb5['priority']?_0x2b5cb5[_0x9923('0x27')]-0x1:0x1;return null;}else if(_0x2b5cb5&&_0x1e89d7[_0x2b5cb5[_0x9923('0x28')]]){_0x14dd3e=_0x1e89d7[_0x2b5cb5['agicommand']](_0x2b5cb5);logger['info'](_0x9923('0x29'),JSON[_0x9923('0x18')](_0x14dd3e,null,0x2));if(_0x14dd3e&&_0x14dd3e[_0x9923('0x2a')]===AGI_CODE_SUCCESS&&_0x14dd3e['result']!==AGI_RESULT_ERROR&&!_0x39d74e['evtHangup']){logger[_0x9923('0x17')](_0x9923('0x29'),inspect(_0x14dd3e));return _[_0x9923('0x2b')](_0x14dd3e[_0x9923('0x2c')])?null:_0x14dd3e[_0x9923('0x2c')]['toString']();}else{logger['error'](_0x9923('0x29'),inspect(_0x14dd3e));return null;}}else{logger['error'](_0x9923('0x2d'));return null;}}catch(_0x26b304){logger[_0x9923('0x8')](_0x26b304['stack']);return null;}});if(_0x37ac38[_0x9923('0x2e')]){logger[_0x9923('0x1c')](util[_0x9923('0x19')](_0x9923('0x2f'),_0x39d74e[_0x9923('0x30')],_0x39d74e[_0x9923('0x31')],_0x39d74e[_0x9923('0x1e')],_0x39d74e[_0x9923('0x1f')],_0x39d74e[_0x9923('0x20')]));_0x2d33dd['traverseBFS'](_0x37ac38[_0x9923('0x2e')]['id'],function(_0x3c508c){try{_0x3c508c=_0x1e89d7[_0x9923('0x32')](_0x3c508c);logger['debug'](_0x9923('0x23'),JSON[_0x9923('0x18')](_0x3c508c,null,0x2));if(_0x3c508c&&_0x1e89d7[_0x3c508c[_0x9923('0x28')]]){_0x14dd3e=_0x1e89d7[_0x3c508c[_0x9923('0x28')]](_0x3c508c);if(_0x14dd3e){logger[_0x9923('0x17')](_0x9923('0x29'),inspect(_0x14dd3e));return _[_0x9923('0x2b')](_0x14dd3e[_0x9923('0x2c')])?null:_0x14dd3e[_0x9923('0x2c')]['toString']();}else{logger[_0x9923('0x8')](_0x9923('0x29'),inspect(_0x14dd3e));return null;}}else{logger[_0x9923('0x8')](_0x9923('0x2d'));return null;}}catch(_0x50d644){logger[_0x9923('0x8')](_0x50d644[_0x9923('0xa')]);return null;}});}logger[_0x9923('0x1c')](util['format']('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x39d74e['arg_1'],_0x39d74e['calleridname'],_0x39d74e[_0x9923('0x1e')],_0x39d74e[_0x9923('0x1f')],_0x39d74e[_0x9923('0x20')]));logger['info'](util[_0x9923('0x19')](_0x9923('0x33'),_0x39d74e['context'],_0x39d74e[_0x9923('0x26')],parseInt(_0x39d74e['priority'],0xa)+0x1));_0x39d74e[_0x9923('0x34')](_0x39d74e['context'],_0x39d74e[_0x9923('0x26')],parseInt(_0x39d74e[_0x9923('0x27')],0xa)+0x1);_0x39d74e[_0x9923('0x35')]();}function handleNotFound(_0x4d38c0){logger['error'](util[_0x9923('0x19')](_0x9923('0x36'),_0x4d38c0[_0x9923('0x30')]));_0x4d38c0[_0x9923('0x34')](_0x4d38c0[_0x9923('0x25')],_0x4d38c0[_0x9923('0x26')],parseInt(_0x4d38c0[_0x9923('0x27')],0xa)+0x1);_0x4d38c0[_0x9923('0x35')]();}function handleUnpublished(_0x5f5a00){logger[_0x9923('0x8')](util[_0x9923('0x19')]('Project\x20%s\x20not\x20published',_0x5f5a00[_0x9923('0x30')]));_0x5f5a00['continueAt'](_0x5f5a00[_0x9923('0x25')],_0x5f5a00[_0x9923('0x26')],parseInt(_0x5f5a00[_0x9923('0x27')],0xa)+0x1);_0x5f5a00['close']();}module['exports']={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0x51aa=['[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','close','Project\x20%s\x20not\x20found','continueAt','Project\x20%s\x20not\x20published','exports','moment','xml2json','util','../../config/logger','agi','./rpc','getSquareProjects','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','hasOwnProperty','retry','addVertex','omit','mxCell','length','target','addEdge','value','mxGraphModel','root','inspect','production','start','stringify','joinAt','format','YYYY-MM-DD\x20HH:mm:ss','info','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','callerid','uniqueid','traverseBFS','clear','debug','vertex','gotoc','context','extension','priority','response','result','evtHangup','isUndefined','toString','finally','dnid','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname'];(function(_0x16185e,_0x56e639){var _0x4201e3=function(_0x4894b3){while(--_0x4894b3){_0x16185e['push'](_0x16185e['shift']());}};_0x4201e3(++_0x56e639);}(_0x51aa,0x162));var _0xa51a=function(_0x2b7cbb,_0x12740c){_0x2b7cbb=_0x2b7cbb-0x0;var _0x20e17f=_0x51aa[_0x2b7cbb];return _0x20e17f;};'use strict';var _=require('lodash');var moment=require(_0xa51a('0x0'));var parser=require(_0xa51a('0x1'));var util=require(_0xa51a('0x2'));var logger=require(_0xa51a('0x3'))(_0xa51a('0x4'));var rpc=require(_0xa51a('0x5'));var mailRpc=require('./mailRpc');var Graph=require('./graph');var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0xa51a('0x6')]()[_0xa51a('0x7')](function(_0x517514){logger[_0xa51a('0x8')](_0xa51a('0x9'),_0x517514[_0xa51a('0xa')]);return[];});}function addVertex(_0x862c73,_0x1f01fa,_0x1b71e3){_0x1f01fa[_0xa51a('0xb')]=_0x1b71e3;if(_0x1f01fa[_0xa51a('0xc')](_0xa51a('0xd'))){_0x1f01fa['maxRetry']=parseInt(_0x1f01fa['retry'],0xa);}_0x862c73[_0xa51a('0xe')](_[_0xa51a('0xf')](_0x1f01fa,_0xa51a('0x10')));}function initGraph(_0x1fe841,_0x1005c2){var _0x3e6e49=new Graph();for(var _0x322978 in _0x1fe841){if(_0x1fe841[_0xa51a('0xc')](_0x322978)){if(_['isArray'](_0x1fe841[_0x322978])){for(var _0x56ed55=0x0;_0x56ed55<_0x1fe841[_0x322978][_0xa51a('0x11')];_0x56ed55+=0x1){addVertex(_0x3e6e49,_0x1fe841[_0x322978][_0x56ed55],_0x322978);}}else{addVertex(_0x3e6e49,_0x1fe841[_0x322978],_0x322978);}}}for(var _0x571c89=0x0;_0x571c89<_0x1005c2['length'];_0x571c89+=0x1){if(_0x1005c2[_0x571c89]['source']&&_0x1005c2[_0x571c89][_0xa51a('0x12')]){_0x3e6e49[_0xa51a('0x13')](_0x1005c2[_0x571c89]['source'],_0x1005c2[_0x571c89][_0xa51a('0x12')],_0x1005c2[_0x571c89][_0xa51a('0x14')]);}}return _0x3e6e49;}function getRoot(_0x377572){return parser['toJson'](_0x377572,{'object':!![]})[_0xa51a('0x15')][_0xa51a('0x16')];}function inspect(_0x39175f){return util[_0xa51a('0x17')](_0x39175f,{'showHidden':![],'depth':null});}function initialize(_0x4b797c,_0x573bca){var _0x2eb0ad=getRoot(_0x4b797c[_0xa51a('0x18')]);if(!_0x2eb0ad||!_0x2eb0ad[_0xa51a('0x19')])return;var _0x4459db,_0x392083,_0x102400;logger['debug'](_0xa51a('0x16'),JSON[_0xa51a('0x1a')](_0x2eb0ad,null,0x2));_0x573bca[_0xa51a('0x1b')]=moment()[_0xa51a('0x1c')](_0xa51a('0x1d'));_0x4459db=initGraph(_['omit'](_0x2eb0ad,'mxCell'),_0x2eb0ad[_0xa51a('0x10')]);_0x392083=new Vertices(_0x573bca,rpc,mailRpc);logger[_0xa51a('0x1e')](util[_0xa51a('0x1c')](_0xa51a('0x1f'),_0x573bca[_0xa51a('0x20')],_0x573bca['calleridname'],_0x573bca[_0xa51a('0x21')],_0x573bca['dnid'],_0x573bca[_0xa51a('0x22')]));_0x4459db[_0xa51a('0x23')](_0x2eb0ad['start']['id'],function(_0x3e75f7){try{_0x3e75f7=_0x392083[_0xa51a('0x24')](_0x3e75f7);logger[_0xa51a('0x25')](_0xa51a('0x26'),JSON[_0xa51a('0x1a')](_0x3e75f7,null,0x2));if(_0x3e75f7[_0xa51a('0xb')]===_0xa51a('0x27')){logger[_0xa51a('0x1e')]('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x573bca[_0xa51a('0x28')]=_0x3e75f7[_0xa51a('0x28')]||_0x573bca[_0xa51a('0x28')];_0x573bca[_0xa51a('0x29')]=_0x3e75f7[_0xa51a('0x29')];_0x573bca[_0xa51a('0x2a')]=_0x3e75f7[_0xa51a('0x2a')]?_0x3e75f7[_0xa51a('0x2a')]-0x1:0x1;return null;}else if(_0x3e75f7&&_0x392083[_0x3e75f7[_0xa51a('0xb')]]){_0x102400=_0x392083[_0x3e75f7[_0xa51a('0xb')]](_0x3e75f7);logger[_0xa51a('0x1e')](_0xa51a('0x2b'),JSON[_0xa51a('0x1a')](_0x102400,null,0x2));if(_0x102400&&_0x102400['code']===AGI_CODE_SUCCESS&&_0x102400[_0xa51a('0x2c')]!==AGI_RESULT_ERROR&&!_0x573bca[_0xa51a('0x2d')]){logger[_0xa51a('0x25')](_0xa51a('0x2b'),inspect(_0x102400));return _[_0xa51a('0x2e')](_0x102400[_0xa51a('0x2c')])?null:_0x102400[_0xa51a('0x2c')][_0xa51a('0x2f')]();}else{logger[_0xa51a('0x8')]('response',inspect(_0x102400));return null;}}else{logger['error']('agicommand\x20not\x20found');return null;}}catch(_0x416058){logger[_0xa51a('0x8')](_0x416058[_0xa51a('0xa')]);return null;}});if(_0x2eb0ad[_0xa51a('0x30')]){logger[_0xa51a('0x1e')](util[_0xa51a('0x1c')]('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x573bca[_0xa51a('0x20')],_0x573bca['calleridname'],_0x573bca['callerid'],_0x573bca[_0xa51a('0x31')],_0x573bca['uniqueid']));_0x4459db[_0xa51a('0x23')](_0x2eb0ad[_0xa51a('0x30')]['id'],function(_0x2beb04){try{_0x2beb04=_0x392083['clear'](_0x2beb04);logger[_0xa51a('0x25')]('vertex',JSON['stringify'](_0x2beb04,null,0x2));if(_0x2beb04&&_0x392083[_0x2beb04[_0xa51a('0xb')]]){_0x102400=_0x392083[_0x2beb04['agicommand']](_0x2beb04);if(_0x102400){logger[_0xa51a('0x25')](_0xa51a('0x2b'),inspect(_0x102400));return _[_0xa51a('0x2e')](_0x102400[_0xa51a('0x2c')])?null:_0x102400[_0xa51a('0x2c')][_0xa51a('0x2f')]();}else{logger[_0xa51a('0x8')](_0xa51a('0x2b'),inspect(_0x102400));return null;}}else{logger[_0xa51a('0x8')]('agicommand\x20not\x20found');return null;}}catch(_0x36b9c8){logger[_0xa51a('0x8')](_0x36b9c8[_0xa51a('0xa')]);return null;}});}logger[_0xa51a('0x1e')](util[_0xa51a('0x1c')](_0xa51a('0x32'),_0x573bca['arg_1'],_0x573bca[_0xa51a('0x33')],_0x573bca[_0xa51a('0x21')],_0x573bca[_0xa51a('0x31')],_0x573bca[_0xa51a('0x22')]));logger[_0xa51a('0x1e')](util[_0xa51a('0x1c')](_0xa51a('0x34'),_0x573bca[_0xa51a('0x28')],_0x573bca[_0xa51a('0x29')],parseInt(_0x573bca[_0xa51a('0x2a')],0xa)+0x1));_0x573bca['continueAt'](_0x573bca[_0xa51a('0x28')],_0x573bca[_0xa51a('0x29')],parseInt(_0x573bca[_0xa51a('0x2a')],0xa)+0x1);_0x573bca[_0xa51a('0x35')]();}function handleNotFound(_0x5dfccb){logger['error'](util[_0xa51a('0x1c')](_0xa51a('0x36'),_0x5dfccb['arg_1']));_0x5dfccb[_0xa51a('0x37')](_0x5dfccb[_0xa51a('0x28')],_0x5dfccb['extension'],parseInt(_0x5dfccb[_0xa51a('0x2a')],0xa)+0x1);_0x5dfccb['close']();}function handleUnpublished(_0x2498f6){logger[_0xa51a('0x8')](util[_0xa51a('0x1c')](_0xa51a('0x38'),_0x2498f6['arg_1']));_0x2498f6[_0xa51a('0x37')](_0x2498f6[_0xa51a('0x28')],_0x2498f6[_0xa51a('0x29')],parseInt(_0x2498f6[_0xa51a('0x2a')],0xa)+0x1);_0x2498f6[_0xa51a('0x35')]();}module[_0xa51a('0x39')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index c388c13..539ff94 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 _0xed59=['indexOf','slice','emit','headers','util','stream','Transform','call','_localBuffer','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','toString','substring','length','split'];(function(_0x323084,_0x2de48d){var _0x5ef1c5=function(_0x1d8263){while(--_0x1d8263){_0x323084['push'](_0x323084['shift']());}};_0x5ef1c5(++_0x2de48d);}(_0xed59,0x112));var _0x9ed5=function(_0x2cbe69,_0x5ec2ca){_0x2cbe69=_0x2cbe69-0x0;var _0x1bbb62=_0xed59[_0x2cbe69];return _0x1bbb62;};'use strict';var util=require(_0x9ed5('0x0'));var Transform=require(_0x9ed5('0x1'))[_0x9ed5('0x2')];function AGIReply(_0x4d6166){Transform[_0x9ed5('0x3')](this,_0x4d6166);this[_0x9ed5('0x4')]='';this[_0x9ed5('0x5')]=![];}util[_0x9ed5('0x6')](AGIReply,Transform);AGIReply[_0x9ed5('0x7')][_0x9ed5('0x8')]=function(_0x3f06fa,_0x3a3dca,_0x711df9){var _0xe3f447='\x0a',_0x30dd85=['\x0a\x0a',_0x9ed5('0x9')],_0x493b0f=-0x1,_0x15d9b1=-0x1,_0x108ae4='',_0x483827=0x0,_0xb19e95='',_0x55d9cf='';this['_localBuffer']+=_0x3f06fa[_0x9ed5('0xa')]();_0xb19e95=this[_0x9ed5('0x4')];if(!this[_0x9ed5('0x5')]){_0x483827=0x0;while(_0x30dd85[_0x483827]){while((_0x15d9b1=_0xb19e95['indexOf'](_0x30dd85[_0x483827]))!=-0x1){_0x108ae4=_0x30dd85[_0x483827];_0x55d9cf=_0xb19e95[_0x9ed5('0xb')](0x0,_0x15d9b1);_0xb19e95=_0xb19e95['substring'](_0x15d9b1+_0x108ae4[_0x9ed5('0xc')]);var _0x1ece74=_0x55d9cf[_0x9ed5('0xd')](_0xe3f447),_0x115e05=0x0,_0x52540d={},_0x144929='',_0x4a1ebe='',_0x124274=-0x1;while(_0x1ece74[_0x115e05]){_0x124274=_0x1ece74[_0x115e05][_0x9ed5('0xe')](':');if(_0x124274!=-0x1){_0x144929=_0x1ece74[_0x115e05]['slice'](0x0,_0x124274)['trim']();_0x4a1ebe=_0x1ece74[_0x115e05][_0x9ed5('0xf')](_0x124274+0x1)['trim']();if(_0x144929[_0x9ed5('0xc')]>0x0){_0x52540d[_0x144929]=_0x4a1ebe;}}else{}_0x115e05++;}this[_0x9ed5('0x10')](_0x9ed5('0x11'),_0x52540d);this[_0x9ed5('0x5')]=!![];}_0x483827++;}this[_0x9ed5('0x4')]=_0xb19e95;}else{while((_0x493b0f=_0xb19e95[_0x9ed5('0xe')](_0xe3f447))!=-0x1){_0x55d9cf=_0xb19e95[_0x9ed5('0xb')](0x0,_0x493b0f);this[_0x9ed5('0x10')]('line',_0x55d9cf);_0xb19e95=_0xb19e95[_0x9ed5('0xb')](_0x493b0f+_0xe3f447['length']);}this[_0x9ed5('0x4')]=_0xb19e95;}_0x711df9();};module['exports']=AGIReply; \ No newline at end of file +var _0x8248=['_localBuffer','_inBody','prototype','_transform','\x0d\x0a\x0d\x0a','length','indexOf','slice','trim','emit','headers','substring','line','util','stream'];(function(_0x40c1c5,_0x4e746a){var _0x2729d9=function(_0x4c1622){while(--_0x4c1622){_0x40c1c5['push'](_0x40c1c5['shift']());}};_0x2729d9(++_0x4e746a);}(_0x8248,0x67));var _0x8824=function(_0x5228a8,_0x11a1a4){_0x5228a8=_0x5228a8-0x0;var _0x4b99a3=_0x8248[_0x5228a8];return _0x4b99a3;};'use strict';var util=require(_0x8824('0x0'));var Transform=require(_0x8824('0x1'))['Transform'];function AGIReply(_0x44e44c){Transform['call'](this,_0x44e44c);this[_0x8824('0x2')]='';this[_0x8824('0x3')]=![];}util['inherits'](AGIReply,Transform);AGIReply[_0x8824('0x4')][_0x8824('0x5')]=function(_0xae2916,_0x238779,_0x1ff98a){var _0xec76ee='\x0a',_0x118b0e=['\x0a\x0a',_0x8824('0x6')],_0x23cad4=-0x1,_0x1771ec=-0x1,_0x28c64f='',_0x5a1d76=0x0,_0x3ef58c='',_0x2118f5='';this['_localBuffer']+=_0xae2916['toString']();_0x3ef58c=this['_localBuffer'];if(!this[_0x8824('0x3')]){_0x5a1d76=0x0;while(_0x118b0e[_0x5a1d76]){while((_0x1771ec=_0x3ef58c['indexOf'](_0x118b0e[_0x5a1d76]))!=-0x1){_0x28c64f=_0x118b0e[_0x5a1d76];_0x2118f5=_0x3ef58c['substring'](0x0,_0x1771ec);_0x3ef58c=_0x3ef58c['substring'](_0x1771ec+_0x28c64f[_0x8824('0x7')]);var _0xd42ff=_0x2118f5['split'](_0xec76ee),_0x3573f6=0x0,_0x5e21e7={},_0x73cad2='',_0x4e28c7='',_0x458a3f=-0x1;while(_0xd42ff[_0x3573f6]){_0x458a3f=_0xd42ff[_0x3573f6][_0x8824('0x8')](':');if(_0x458a3f!=-0x1){_0x73cad2=_0xd42ff[_0x3573f6][_0x8824('0x9')](0x0,_0x458a3f)[_0x8824('0xa')]();_0x4e28c7=_0xd42ff[_0x3573f6][_0x8824('0x9')](_0x458a3f+0x1)[_0x8824('0xa')]();if(_0x73cad2[_0x8824('0x7')]>0x0){_0x5e21e7[_0x73cad2]=_0x4e28c7;}}else{}_0x3573f6++;}this[_0x8824('0xb')](_0x8824('0xc'),_0x5e21e7);this[_0x8824('0x3')]=!![];}_0x5a1d76++;}this[_0x8824('0x2')]=_0x3ef58c;}else{while((_0x23cad4=_0x3ef58c[_0x8824('0x8')](_0xec76ee))!=-0x1){_0x2118f5=_0x3ef58c[_0x8824('0xd')](0x0,_0x23cad4);this[_0x8824('0xb')](_0x8824('0xe'),_0x2118f5);_0x3ef58c=_0x3ef58c['substring'](_0x23cad4+_0xec76ee[_0x8824('0x7')]);}this['_localBuffer']=_0x3ef58c;}_0x1ff98a();};module['exports']=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 112ffa8..f636449 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 _0x83d3=['Interval','Intervals','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','createCmContact','ShowCmHopper','ListId','then','CreateCmContact','ShowPause','agentLogin','LoginUser','PauseUser','UnpauseUser','lodash','moment','jayson/promise','client','http','request','message','result','catch','getSquareProjects','production','getSquareProject','ShowSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','name','getSquareProjectById','ShowVoiceQueue','getVariableById','getSquareOdbcById','dsn','getUserById','ShowUser','getContactByPhone','GetContactByPhone','phone','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById'];(function(_0x3073c5,_0x426ccc){var _0x35f385=function(_0x45b159){while(--_0x45b159){_0x3073c5['push'](_0x3073c5['shift']());}};_0x35f385(++_0x426ccc);}(_0x83d3,0x17c));var _0x383d=function(_0x2a7066,_0x279e23){_0x2a7066=_0x2a7066-0x0;var _0x21814e=_0x83d3[_0x2a7066];return _0x21814e;};'use strict';var _=require(_0x383d('0x0'));var moment=require(_0x383d('0x1'));var jayson=require(_0x383d('0x2'));var client=jayson[_0x383d('0x3')][_0x383d('0x4')]({'port':0x2329});function request(_0x5af289,_0x9287d4){return new Promise(function(_0x1184a6,_0x31cbfc){return client[_0x383d('0x5')](_0x5af289,_0x9287d4)['then'](function(_0x1f65b7){if(_0x1f65b7['error']){return _0x31cbfc(_0x1f65b7['error'][_0x383d('0x6')]);}else{return _0x1184a6(_0x1f65b7[_0x383d('0x7')]);}})[_0x383d('0x8')](function(_0x5641df){return _0x31cbfc(_0x5641df);});});}exports[_0x383d('0x9')]=function(){return request('GetSquareProjects',{'options':{'raw':![],'attributes':['id','name',_0x383d('0xa')]}});};exports[_0x383d('0xb')]=function(_0x52b7a5){return request(_0x383d('0xc'),{'options':{'raw':![],'where':{'name':_0x52b7a5},'attributes':[_0x383d('0xa')]}});};exports[_0x383d('0xd')]=function(_0x1542db){return request(_0x383d('0xe'),{'options':{'raw':![],'where':{'id':_0x1542db},'include':[{'model':_0x383d('0xf'),'as':'Smtp','include':[{'model':'CloudProvider','as':'CloudProvider'}]}],'attributes':['id',_0x383d('0x10'),'email'],'smtp':!![]}});};exports[_0x383d('0x11')]=function(_0x44bc6a){return request(_0x383d('0xc'),{'options':{'where':{'id':_0x44bc6a},'attributes':[_0x383d('0x10')]}});};exports['getVoiceQueueById']=function(_0x556fee){return request(_0x383d('0x12'),{'options':{'where':{'id':_0x556fee},'attributes':['name']}});};exports[_0x383d('0x13')]=function(_0x5afc53){return request('ShowVariable',{'options':{'where':{'id':_0x5afc53},'attributes':[_0x383d('0x10')]}});};exports[_0x383d('0x14')]=function(_0x57c09f){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x57c09f},'attributes':[_0x383d('0x15')]}});};exports[_0x383d('0x16')]=function(_0x5be3d7){return request(_0x383d('0x17'),{'options':{'where':{'id':_0x5be3d7},'attributes':[_0x383d('0x10')]}});};exports[_0x383d('0x18')]=function(_0xc7868){return request(_0x383d('0x19'),{'options':{'where':{'phone':_0xc7868[_0x383d('0x1a')]},'attributes':['id']}});};exports[_0x383d('0x1b')]=function(_0x55fb74){return request(_0x383d('0x1c'),{'options':{'where':{'id':_0x55fb74},'attributes':[_0x383d('0x10')]}});};exports[_0x383d('0x1d')]=function(_0x324ec4){return request(_0x383d('0x1e'),{'options':{'where':{'id':_0x324ec4},'attributes':[_0x383d('0x1f')]}});};exports[_0x383d('0x20')]=function(_0x562a28){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x562a28},'include':[{'model':_0x383d('0x21'),'as':_0x383d('0x22')}]}});};exports['getSmsAccountById']=function(_0x17d883){return request(_0x383d('0x23'),{'options':{'where':{'id':_0x17d883},'attributes':['id',_0x383d('0x10')]}});};exports[_0x383d('0x24')]=function(_0x3e36a2){return request(_0x383d('0x25'),{'body':_0x3e36a2});};exports[_0x383d('0x26')]=function(_0x3e447e){return request(_0x383d('0x27'),{'body':_0x3e447e});};exports[_0x383d('0x28')]=function(_0x4b2e89){return request('CreateSquareReport',{'body':_[_0x383d('0x29')](_0x4b2e89,{'project_name':_0x4b2e89[_0x383d('0x2a')],'prev_project_name':_0x4b2e89[_0x383d('0x2b')]||'','is_subproject':_0x4b2e89[_0x383d('0x2b')]?!![]:![],'leaveAt':moment()[_0x383d('0x2c')](_0x383d('0x2d'))})});};exports[_0x383d('0x2e')]=function(_0x4e1d6e){return request(_0x383d('0x2f'),{'body':_0x4e1d6e});};exports[_0x383d('0x30')]=function(_0x49c0cc){return request('CreateSquareMessage',{'body':_0x49c0cc});};exports[_0x383d('0x31')]=function(_0x3f86e2){return request(_0x383d('0x32'),{'options':{'raw':![],'where':{'phone':_0x3f86e2[_0x383d('0x1a')],'ListId':_0x3f86e2[_0x383d('0x33')]}}})[_0x383d('0x34')](function(_0x5deee9){if(_0x5deee9){return _0x5deee9;}return request(_0x383d('0x35'),{'body':_0x3f86e2});});};exports['getPauseById']=function(_0x543b8d){return request(_0x383d('0x36'),{'options':{'where':{'id':_0x543b8d},'attributes':[_0x383d('0x10')]}});};exports[_0x383d('0x37')]=function(_0x47a33d,_0x2aa461){return request(_0x383d('0x38'),{'body':{'interface':_0x2aa461},'options':{'where':_0x47a33d}});};exports['agentPause']=function(_0x1b2353,_0x1954cf,_0x58b347){return request(_0x383d('0x39'),{'body':{'type':_0x1954cf,'uniqueid':_0x58b347},'options':{'where':_0x1b2353}});};exports['agentUnpause']=function(_0x1617ce){return request(_0x383d('0x3a'),{'body':{},'options':{'where':_0x1617ce}});};exports['agentLogout']=function(_0x13b49a){return request('LogoutUser',{'body':{},'options':{'where':_0x13b49a}});}; \ No newline at end of file +var _0x28a2=['getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getContactByPhone','GetContactByPhone','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','Interval','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','arg_2','format','createSquareRecording','CreateSquareRecording','createCmContact','phone','ListId','CreateCmContact','getPauseById','LoginUser','agentPause','agentUnpause','UnpauseUser','agentLogout','LogoutUser','lodash','moment','jayson/promise','client','http','then','error','message','catch','getSquareProjects','GetSquareProjects','production','getSquareProject','ShowSquareProject','getMailAccountById','ShowMailAccount','CloudProvider','name','email','getSquareProjectById','getVoiceQueueById'];(function(_0x1960b5,_0x1835a4){var _0x18f387=function(_0x4f781b){while(--_0x4f781b){_0x1960b5['push'](_0x1960b5['shift']());}};_0x18f387(++_0x1835a4);}(_0x28a2,0x141));var _0x228a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x28a2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x228a('0x0'));var moment=require(_0x228a('0x1'));var jayson=require(_0x228a('0x2'));var client=jayson[_0x228a('0x3')][_0x228a('0x4')]({'port':0x2329});function request(_0x41d4aa,_0xfc342a){return new Promise(function(_0x5ce39e,_0x6efce7){return client['request'](_0x41d4aa,_0xfc342a)[_0x228a('0x5')](function(_0x135b7e){if(_0x135b7e[_0x228a('0x6')]){return _0x6efce7(_0x135b7e[_0x228a('0x6')][_0x228a('0x7')]);}else{return _0x5ce39e(_0x135b7e['result']);}})[_0x228a('0x8')](function(_0x7767ab){return _0x6efce7(_0x7767ab);});});}exports[_0x228a('0x9')]=function(){return request(_0x228a('0xa'),{'options':{'raw':![],'attributes':['id','name',_0x228a('0xb')]}});};exports[_0x228a('0xc')]=function(_0x3b20dd){return request(_0x228a('0xd'),{'options':{'raw':![],'where':{'name':_0x3b20dd},'attributes':[_0x228a('0xb')]}});};exports[_0x228a('0xe')]=function(_0x42d236){return request(_0x228a('0xf'),{'options':{'raw':![],'where':{'id':_0x42d236},'include':[{'model':'MailServerOut','as':'Smtp','include':[{'model':'CloudProvider','as':_0x228a('0x10')}]}],'attributes':['id',_0x228a('0x11'),_0x228a('0x12')],'smtp':!![]}});};exports[_0x228a('0x13')]=function(_0x23d138){return request('ShowSquareProject',{'options':{'where':{'id':_0x23d138},'attributes':[_0x228a('0x11')]}});};exports[_0x228a('0x14')]=function(_0x45f1b2){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x45f1b2},'attributes':['name']}});};exports[_0x228a('0x15')]=function(_0xdcc2c3){return request(_0x228a('0x16'),{'options':{'where':{'id':_0xdcc2c3},'attributes':[_0x228a('0x11')]}});};exports[_0x228a('0x17')]=function(_0x36f4d1){return request(_0x228a('0x18'),{'options':{'where':{'id':_0x36f4d1},'attributes':[_0x228a('0x19')]}});};exports['getUserById']=function(_0x34de98){return request('ShowUser',{'options':{'where':{'id':_0x34de98},'attributes':[_0x228a('0x11')]}});};exports[_0x228a('0x1a')]=function(_0x16c281){return request(_0x228a('0x1b'),{'options':{'where':{'phone':_0x16c281['phone']},'attributes':['id']}});};exports['getTrunkById']=function(_0x1334b8){return request(_0x228a('0x1c'),{'options':{'where':{'id':_0x1334b8},'attributes':[_0x228a('0x11')]}});};exports[_0x228a('0x1d')]=function(_0x233009){return request(_0x228a('0x1e'),{'options':{'where':{'id':_0x233009},'attributes':[_0x228a('0x1f')]}});};exports[_0x228a('0x20')]=function(_0x2f0f30){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x2f0f30},'include':[{'model':_0x228a('0x21'),'as':'Intervals'}]}});};exports[_0x228a('0x22')]=function(_0x4837af){return request(_0x228a('0x23'),{'options':{'where':{'id':_0x4837af},'attributes':['id',_0x228a('0x11')]}});};exports[_0x228a('0x24')]=function(_0x2203b7){return request(_0x228a('0x25'),{'body':_0x2203b7});};exports[_0x228a('0x26')]=function(_0x104c80){return request(_0x228a('0x27'),{'body':_0x104c80});};exports[_0x228a('0x28')]=function(_0x2fdffc){return request(_0x228a('0x29'),{'body':_['merge'](_0x2fdffc,{'project_name':_0x2fdffc['arg_1'],'prev_project_name':_0x2fdffc[_0x228a('0x2a')]||'','is_subproject':_0x2fdffc[_0x228a('0x2a')]?!![]:![],'leaveAt':moment()[_0x228a('0x2b')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0x228a('0x2c')]=function(_0x148a62){return request(_0x228a('0x2d'),{'body':_0x148a62});};exports['createSquareMessage']=function(_0x5e374d){return request('CreateSquareMessage',{'body':_0x5e374d});};exports[_0x228a('0x2e')]=function(_0x196f7){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x196f7[_0x228a('0x2f')],'ListId':_0x196f7[_0x228a('0x30')]}}})['then'](function(_0x53ad05){if(_0x53ad05){return _0x53ad05;}return request(_0x228a('0x31'),{'body':_0x196f7});});};exports[_0x228a('0x32')]=function(_0x59cc09){return request('ShowPause',{'options':{'where':{'id':_0x59cc09},'attributes':[_0x228a('0x11')]}});};exports['agentLogin']=function(_0x2811f1,_0x79dd28){return request(_0x228a('0x33'),{'body':{'interface':_0x79dd28},'options':{'where':_0x2811f1}});};exports[_0x228a('0x34')]=function(_0x5535c0,_0x86d597,_0x209d3e){return request('PauseUser',{'body':{'type':_0x86d597,'uniqueid':_0x209d3e},'options':{'where':_0x5535c0}});};exports[_0x228a('0x35')]=function(_0x269b81){return request(_0x228a('0x36'),{'body':{},'options':{'where':_0x269b81}});};exports[_0x228a('0x37')]=function(_0xf8f5bc){return request(_0x228a('0x38'),{'body':{},'options':{'where':_0xf8f5bc}});}; \ 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 d36185d..098f73d 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 _0x27a8=['exports'];(function(_0x34cfdd,_0x22f1aa){var _0x21a1b2=function(_0x5b5b3c){while(--_0x5b5b3c){_0x34cfdd['push'](_0x34cfdd['shift']());}};_0x21a1b2(++_0x22f1aa);}(_0x27a8,0x170));var _0x827a=function(_0x2354a9,_0x14c503){_0x2354a9=_0x2354a9-0x0;var _0x110967=_0x27a8[_0x2354a9];return _0x110967;};var polly=require('./polly');var lex=require('./lex');module[_0x827a('0x0')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0xafdd=['./lex','exports','./polly'];(function(_0x5102e3,_0x1330b1){var _0x161f3f=function(_0x528f97){while(--_0x528f97){_0x5102e3['push'](_0x5102e3['shift']());}};_0x161f3f(++_0x1330b1);}(_0xafdd,0x19a));var _0xdafd=function(_0x4fe0e5,_0x4ace15){_0x4fe0e5=_0x4fe0e5-0x0;var _0x1490e9=_0xafdd[_0x4fe0e5];return _0x1490e9;};var polly=require(_0xdafd('0x0'));var lex=require(_0xdafd('0x1'));module[_0xdafd('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index 0100b0f..496a26c 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 _0xb7e7=['./lib/api'];(function(_0x108c7b,_0x1c78c2){var _0x14cb98=function(_0x569560){while(--_0x569560){_0x108c7b['push'](_0x108c7b['shift']());}};_0x14cb98(++_0x1c78c2);}(_0xb7e7,0x121));var _0x7b7e=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xb7e7[_0x4b7b62];return _0x2280df;};'use strict';var lex=require(_0x7b7e('0x0'));module['exports']=function(_0x40e269,_0x518dc6,_0x1b7cc7,_0x54a37f,_0x3f5804,_0x556d68){return lex(_0x40e269,_0x518dc6,_0x1b7cc7,_0x54a37f,_0x3f5804,_0x556d68);}; \ No newline at end of file +var _0xa75b=['./lib/api'];(function(_0x9041ef,_0x9ea60){var _0x200332=function(_0x5124a5){while(--_0x5124a5){_0x9041ef['push'](_0x9041ef['shift']());}};_0x200332(++_0x9ea60);}(_0xa75b,0x170));var _0xba75=function(_0x3c2f80,_0x35c1c0){_0x3c2f80=_0x3c2f80-0x0;var _0x57a69d=_0xa75b[_0x3c2f80];return _0x57a69d;};'use strict';var lex=require(_0xba75('0x0'));module['exports']=function(_0x546e14,_0x10c0dd,_0x39dc19,_0x17b666,_0x3cde96,_0x1760c0){return lex(_0x546e14,_0x10c0dd,_0x39dc19,_0x17b666,_0x3cde96,_0x1760c0);}; \ 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 9c652c6..4143d33 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(_0x2d8908,_0x28a93f){var _0x145817=function(_0xac24b2){while(--_0xac24b2){_0x2d8908['push'](_0x2d8908['shift']());}};_0x145817(++_0x28a93f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'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(_0x17599a,_0x3fae6f){var _0x54917b=function(_0x52700a){while(--_0x52700a){_0x17599a['push'](_0x17599a['shift']());}};_0x54917b(++_0x3fae6f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'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 bf84a68..4fa8e40 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. * // * * // ************************************************************************* -'use strict';var polly=require('./lib/api');module['exports']=function(_0x5934e9,_0x182657,_0x528b2b,_0x2c2ab5,_0x150e66,_0xaea934,_0x5caeb8){return polly(_0x5934e9,_0x182657,_0x528b2b,_0x2c2ab5,_0x150e66,_0xaea934,_0x5caeb8);}; \ No newline at end of file +var _0x8358=['exports','./lib/api'];(function(_0x33c75e,_0x4f01fa){var _0x28c846=function(_0x42cd7a){while(--_0x42cd7a){_0x33c75e['push'](_0x33c75e['shift']());}};_0x28c846(++_0x4f01fa);}(_0x8358,0x185));var _0x8835=function(_0x3a7ea5,_0x422f46){_0x3a7ea5=_0x3a7ea5-0x0;var _0x5d53ca=_0x8358[_0x3a7ea5];return _0x5d53ca;};'use strict';var polly=require(_0x8835('0x0'));module[_0x8835('0x1')]=function(_0x2e6655,_0x4079fa,_0x50fbe2,_0x38876a,_0x57d1f2,_0x228eac,_0x183de7){return polly(_0x2e6655,_0x4079fa,_0x50fbe2,_0x38876a,_0x57d1f2,_0x228eac,_0x183de7);}; \ 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 80aa5e2..81736d9 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 _0xc989=['mp3','path','bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','Polly'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xc989,0x1b9));var _0x9c98=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xc989[_0x3bf83f];return _0x22c4a9;};'use strict';var fs=require('fs');var path=require(_0x9c98('0x0'));var BPromise=require(_0x9c98('0x1'));var rs=require(_0x9c98('0x2'));var AWS=require(_0x9c98('0x3'));function pollyResult(_0x50e3de,_0x47ae96,_0x467f55){return new BPromise(function(_0x1dbd59,_0xfbc9f){_0x50e3de[_0x9c98('0x4')](_0x47ae96,function(_0x2d684c,_0x1b34b9){if(_0x2d684c){_0xfbc9f(_0x2d684c);}else if(_0x1b34b9){if(_0x1b34b9['AudioStream']instanceof Buffer){fs['writeFile'](_0x467f55,_0x1b34b9[_0x9c98('0x5')],function(_0x2321b1){if(_0x2321b1){_0xfbc9f(_0x2321b1);}else{_0x1dbd59();}});}else{_0xfbc9f(new Error(_0x9c98('0x6')));}}else{_0xfbc9f(new Error(_0x9c98('0x7')));}});});}module['exports']=function(_0xb87a76,_0x42832a,_0x3cf6af,_0x514475,_0x259a21,_0xd23166,_0x4f9e6a){var _0x504804=new AWS[(_0x9c98('0x8'))]({'accessKeyId':_0xb87a76,'secretAccessKey':_0x42832a,'region':_0x3cf6af});var _0x2348d6={'Text':_0x259a21,'TextType':_0xd23166||'text','OutputFormat':_0x9c98('0x9'),'VoiceId':_0x514475};return pollyResult(_0x504804,_0x2348d6,_0x4f9e6a);}; \ No newline at end of file +var _0x0903=['aws-sdk','synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','exports','text','mp3','path','bluebird','randomstring'];(function(_0x1c902a,_0x1d3bd6){var _0x417067=function(_0x1d45e1){while(--_0x1d45e1){_0x1c902a['push'](_0x1c902a['shift']());}};_0x417067(++_0x1d3bd6);}(_0x0903,0xb8));var _0x3090=function(_0x3b76e9,_0x39efb2){_0x3b76e9=_0x3b76e9-0x0;var _0x43489c=_0x0903[_0x3b76e9];return _0x43489c;};'use strict';var fs=require('fs');var path=require(_0x3090('0x0'));var BPromise=require(_0x3090('0x1'));var rs=require(_0x3090('0x2'));var AWS=require(_0x3090('0x3'));function pollyResult(_0x3fcfdb,_0x36378c,_0x4e178f){return new BPromise(function(_0x25f0e0,_0x4c1dae){_0x3fcfdb[_0x3090('0x4')](_0x36378c,function(_0x882aeb,_0x4a6172){if(_0x882aeb){_0x4c1dae(_0x882aeb);}else if(_0x4a6172){if(_0x4a6172[_0x3090('0x5')]instanceof Buffer){fs[_0x3090('0x6')](_0x4e178f,_0x4a6172[_0x3090('0x5')],function(_0x5f4e31){if(_0x5f4e31){_0x4c1dae(_0x5f4e31);}else{_0x25f0e0();}});}else{_0x4c1dae(new Error(_0x3090('0x7')));}}else{_0x4c1dae(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module[_0x3090('0x8')]=function(_0x5c2742,_0x4d94db,_0x314866,_0x483048,_0x3b2778,_0x14afb8,_0xf123db){var _0x4e3005=new AWS['Polly']({'accessKeyId':_0x5c2742,'secretAccessKey':_0x4d94db,'region':_0x314866});var _0x5a911a={'Text':_0x3b2778,'TextType':_0x14afb8||_0x3090('0x9'),'OutputFormat':_0x3090('0xa'),'VoiceId':_0x483048};return pollyResult(_0x4e3005,_0x5a911a,_0xf123db);}; \ 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 d9d0e6d..9247a25 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 _0x74fc=['exports','./lib/api'];(function(_0x27804c,_0x6ea3be){var _0x11997c=function(_0x58db47){while(--_0x58db47){_0x27804c['push'](_0x27804c['shift']());}};_0x11997c(++_0x6ea3be);}(_0x74fc,0x8b));var _0xc74f=function(_0x1258d1,_0x2de089){_0x1258d1=_0x1258d1-0x0;var _0x3686b2=_0x74fc[_0x1258d1];return _0x3686b2;};'use strict';var asr=require(_0xc74f('0x0'));module[_0xc74f('0x1')]=function(_0x463674,_0x3ce20c,_0x4b0e47,_0x1aed8d){return asr(_0x463674,_0x3ce20c,_0x4b0e47);}; \ No newline at end of file +var _0x7b49=['./lib/api'];(function(_0x4dbaad,_0x730318){var _0x226c72=function(_0x501972){while(--_0x501972){_0x4dbaad['push'](_0x4dbaad['shift']());}};_0x226c72(++_0x730318);}(_0x7b49,0x114));var _0x97b4=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x7b49[_0x2641f9];return _0x585741;};'use strict';var asr=require(_0x97b4('0x0'));module['exports']=function(_0x1cd56c,_0x2dc40b,_0x5448ba,_0xe181a2){return asr(_0x1cd56c,_0x2dc40b,_0x5448ba);}; \ 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 ae1249f..348671d 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 _0xad36=['POST','/v1/speech:recognize?key=','LINEAR16','8000','bluebird','https://speech.googleapis.com','exports','length','filepath\x20should\x20be\x20a\x20string','string','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64'];(function(_0x101e7b,_0x4ef05b){var _0x4995c0=function(_0x1a6488){while(--_0x1a6488){_0x101e7b['push'](_0x101e7b['shift']());}};_0x4995c0(++_0x4ef05b);}(_0xad36,0x11c));var _0x6ad3=function(_0x531d54,_0x1281d1){_0x531d54=_0x531d54-0x0;var _0xe58e66=_0xad36[_0x531d54];return _0xe58e66;};'use strict';var url=require('url');var BPromise=require(_0x6ad3('0x0'));var fs=require('fs');var host=_0x6ad3('0x1');module[_0x6ad3('0x2')]=function(_0x1164e0,_0x32fb2f,_0x35a0ee){return new BPromise(function(_0xef54ab,_0x17a9b2){var _0x3d8fee;if(typeof _0x1164e0!=='string'||_0x1164e0[_0x6ad3('0x3')]===0x0){return _0x17a9b2(_0x6ad3('0x4'));}if(typeof _0x32fb2f!==_0x6ad3('0x5')||_0x32fb2f[_0x6ad3('0x3')]===0x0){return _0x17a9b2('key\x20should\x20be\x20a\x20string');}if(typeof _0x35a0ee!=='undefined'&&(typeof _0x35a0ee!=='string'||_0x35a0ee['length']===0x0)){return _0x17a9b2(_0x6ad3('0x6'));}try{_0x3d8fee=fs[_0x6ad3('0x7')](_0x1164e0)[_0x6ad3('0x8')](_0x6ad3('0x9'));}catch(_0x236745){return _0x17a9b2(_0x236745);}return _0xef54ab({'method':_0x6ad3('0xa'),'uri':host+_0x6ad3('0xb')+_0x32fb2f,'body':{'config':{'encoding':_0x6ad3('0xc'),'sampleRateHertz':_0x6ad3('0xd'),'languageCode':_0x35a0ee},'audio':{'content':_0x3d8fee}},'json':!![]});});}; \ No newline at end of file +var _0x37f8=['bluebird','https://speech.googleapis.com','exports','filepath\x20should\x20be\x20a\x20string','string','length','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','POST','/v1/speech:recognize?key=','LINEAR16'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x37f8,0xd2));var _0x837f=function(_0x114d13,_0xa5c67d){_0x114d13=_0x114d13-0x0;var _0x34a8d4=_0x37f8[_0x114d13];return _0x34a8d4;};'use strict';var url=require('url');var BPromise=require(_0x837f('0x0'));var fs=require('fs');var host=_0x837f('0x1');module[_0x837f('0x2')]=function(_0x2b4e2c,_0x4b8b19,_0x16bb5c){return new BPromise(function(_0x5184ad,_0x5f2d01){var _0x5a04e7;if(typeof _0x2b4e2c!=='string'||_0x2b4e2c['length']===0x0){return _0x5f2d01(_0x837f('0x3'));}if(typeof _0x4b8b19!==_0x837f('0x4')||_0x4b8b19[_0x837f('0x5')]===0x0){return _0x5f2d01(_0x837f('0x6'));}if(typeof _0x16bb5c!==_0x837f('0x7')&&(typeof _0x16bb5c!==_0x837f('0x4')||_0x16bb5c[_0x837f('0x5')]===0x0)){return _0x5f2d01(_0x837f('0x8'));}try{_0x5a04e7=fs[_0x837f('0x9')](_0x2b4e2c)[_0x837f('0xa')](_0x837f('0xb'));}catch(_0x1aea1e){return _0x5f2d01(_0x1aea1e);}return _0x5184ad({'method':_0x837f('0xc'),'uri':host+_0x837f('0xd')+_0x4b8b19,'body':{'config':{'encoding':_0x837f('0xe'),'sampleRateHertz':'8000','languageCode':_0x16bb5c},'audio':{'content':_0x5a04e7}},'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 1a59565..0dd0a46 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 _0xae11=['exports','./asr'];(function(_0x1bec0d,_0x338db4){var _0x49e3e3=function(_0x372c7a){while(--_0x372c7a){_0x1bec0d['push'](_0x1bec0d['shift']());}};_0x49e3e3(++_0x338db4);}(_0xae11,0xe1));var _0x1ae1=function(_0x2c27ed,_0x5c50f0){_0x2c27ed=_0x2c27ed-0x0;var _0x597bd1=_0xae11[_0x2c27ed];return _0x597bd1;};var asr=require(_0x1ae1('0x0'));module[_0x1ae1('0x1')]={'asr':asr}; \ No newline at end of file +var _0x30f2=['./asr'];(function(_0x1ffff7,_0x2f9ff6){var _0x49d017=function(_0x1d2483){while(--_0x1d2483){_0x1ffff7['push'](_0x1ffff7['shift']());}};_0x49d017(++_0x2f9ff6);}(_0x30f2,0x145));var _0x230f=function(_0x19e8e8,_0x38a3b4){_0x19e8e8=_0x19e8e8-0x0;var _0x2f072e=_0x30f2[_0x19e8e8];return _0x2f072e;};var asr=require(_0x230f('0x0'));module['exports']={'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 13edf68..4d2322e 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 _0xfc76=['nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','apiai-promise','bluebird','dialogflow','https','md5','path','querystring','request-promise','randomstring','sox','google-tts-api','url','parse','util','./google','./sestek','./tilde','../../../config/logger','agi','protocol','https:','host','WHAT_EVER','statusCode','statusMessage','request\x20to\x20','createWriteStream','finish','info','finish\x20download\x20file','close','error','unlink','download\x20error','pipe','get','\x20failed,\x20status\x20code\x20=\x20','data','end','transcode','error\x20convert','finish\x20to\x20convert','start','tmp','.wav','writeFileSync','base64','then','chmodSync','split','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','MP3','text:synthesize','generate','.mp3','from','resolve','777','googleCloudTTS\x20path','googleTTS','POST','application/x-www-form-urlencoded','f.req=','stringify','null','generic','slice','parse\x20response\x20failed:\x0a','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','goggleTTS\x20path','asr','uri','results','map','alternatives','transcript','join','confidence','[%s]\x20%s:%s','name','message','googleDialogflow','textRequest','result','source','resolvedQuery','action','actionIncomplete','fulfillment','speech','score','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','intent','displayName','isFallback','queryText','responseId','intentDetectionConfidence','fulfillmentText','tildeASR','awsPolly','polly','awsLex','lex','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','sestekNDA'];(function(_0x4df1f5,_0x39c6d2){var _0x56585b=function(_0x287b6e){while(--_0x287b6e){_0x4df1f5['push'](_0x4df1f5['shift']());}};_0x56585b(++_0x39c6d2);}(_0xfc76,0x124));var _0x6fc7=function(_0x17e48f,_0x2fa043){_0x17e48f=_0x17e48f-0x0;var _0x31a745=_0xfc76[_0x17e48f];return _0x31a745;};'use strict';var apiai=require(_0x6fc7('0x0'));var BPromise=require(_0x6fc7('0x1'));var dialogflow=require(_0x6fc7('0x2'));var fs=require('fs');var http=require('http');var https=require(_0x6fc7('0x3'));var md5=require(_0x6fc7('0x4'));var path=require(_0x6fc7('0x5'));var querystring=require(_0x6fc7('0x6'));var rp=require(_0x6fc7('0x7'));var rs=require(_0x6fc7('0x8'));var sox=require(_0x6fc7('0x9'));var tts=require(_0x6fc7('0xa'));var urlParse=require(_0x6fc7('0xb'))[_0x6fc7('0xc')];var util=require(_0x6fc7('0xd'));var aws=require('./aws');var google=require(_0x6fc7('0xe'));var sestek=require(_0x6fc7('0xf'));var tilde=require(_0x6fc7('0x10'));var logger=require(_0x6fc7('0x11'))(_0x6fc7('0x12'));var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0x5fe999,_0x51d1ac){return new BPromise(function(_0x408477,_0x1312fd){var _0x1246a0=urlParse(_0x5fe999);var _0x3483a5=_0x1246a0[_0x6fc7('0x13')]===_0x6fc7('0x14')?https:http;var _0x124c96={'host':_0x1246a0[_0x6fc7('0x15')],'path':_0x1246a0['path'],'headers':{'user-agent':_0x6fc7('0x16')}};_0x3483a5['get'](_0x124c96,function(_0x2ceca5){if(_0x2ceca5[_0x6fc7('0x17')]!==0xc8){logger['error']('request\x20to\x20'+_0x5fe999+'\x20failed,\x20status\x20code\x20=\x20'+_0x2ceca5[_0x6fc7('0x17')]+'\x20('+_0x2ceca5[_0x6fc7('0x18')]+')');_0x1312fd(new Error(_0x6fc7('0x19')+_0x5fe999+'\x20failed,\x20status\x20code\x20=\x20'+_0x2ceca5[_0x6fc7('0x17')]+'\x20('+_0x2ceca5[_0x6fc7('0x18')]+')'));return;}var _0x588206=fs[_0x6fc7('0x1a')](_0x51d1ac);_0x588206['on'](_0x6fc7('0x1b'),function(){logger[_0x6fc7('0x1c')](_0x6fc7('0x1d'));_0x588206[_0x6fc7('0x1e')](_0x408477);});_0x588206['on'](_0x6fc7('0x1f'),function(_0x2899b7){fs[_0x6fc7('0x20')](_0x51d1ac);logger[_0x6fc7('0x1f')](_0x6fc7('0x21'),_0x2899b7);_0x1312fd(_0x2899b7);});_0x2ceca5[_0x6fc7('0x22')](_0x588206);})['on'](_0x6fc7('0x1f'),function(_0x45540b){logger[_0x6fc7('0x1f')](_0x45540b);_0x1312fd(_0x45540b);})['end']();});}function uploadFile(_0x338800){return new BPromise(function(_0x4f450a,_0x5e9c65){var _0x242b6e=urlParse(_0x338800);var _0x243747=_0x242b6e['protocol']===_0x6fc7('0x14')?https:http;var _0x47e9a0={'host':_0x242b6e['host'],'path':_0x242b6e['path'],'headers':{'user-agent':'WHAT_EVER'}};_0x243747[_0x6fc7('0x23')](_0x47e9a0,function(_0x1f5a0d){if(_0x1f5a0d['statusCode']!==0xc8){_0x5e9c65(new Error(_0x6fc7('0x19')+_0x338800+_0x6fc7('0x24')+_0x1f5a0d[_0x6fc7('0x17')]+'\x20('+_0x1f5a0d[_0x6fc7('0x18')]+')'));return;}var _0x2e3ff2='';_0x1f5a0d['on'](_0x6fc7('0x25'),function(_0x861b3d){_0x2e3ff2+=_0x861b3d;});_0x1f5a0d['on'](_0x6fc7('0x26'),function(){_0x4f450a(_0x2e3ff2);});})['on'](_0x6fc7('0x1f'),function(_0xb43ac1){_0x5e9c65(_0xb43ac1);})[_0x6fc7('0x26')]();});}function convertFile(_0x18789f,_0xbd7331){return new BPromise(function(_0x87d8f0,_0xe3ea43){var _0x1b9018=sox[_0x6fc7('0x27')](_0x18789f,_0xbd7331,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x1b9018['on'](_0x6fc7('0x1f'),function(_0x456687){logger[_0x6fc7('0x1f')](_0x6fc7('0x28'),_0x456687);_0xe3ea43(_0x456687);});_0x1b9018['on'](_0x6fc7('0x26'),function(){logger[_0x6fc7('0x1c')](_0x6fc7('0x29'));_0x87d8f0();});_0x1b9018[_0x6fc7('0x2a')]();});}function base64Decode(_0x1f9ff8,_0x403c4b){var _0x466d4c=path['resolve'](__dirname,_0x6fc7('0x2b'),rs['generate'](0x4)+_0x6fc7('0x2c'));fs[_0x6fc7('0x2d')](_0x466d4c,_0x1f9ff8,_0x6fc7('0x2e'));return convertFile(_0x466d4c,_0x403c4b)[_0x6fc7('0x2f')](function(){try{fs['unlink'](_0x466d4c);fs[_0x6fc7('0x30')](_0x403c4b,'777');}catch(_0x541f62){logger[_0x6fc7('0x1f')](_0x541f62);}return _0x403c4b[_0x6fc7('0x31')]('.')[0x0];});}function base64Encode(_0x43719c){var _0x41bfd4=fs[_0x6fc7('0x32')](_0x43719c);return new Buffer(_0x41bfd4)[_0x6fc7('0x33')]('base64');}exports[_0x6fc7('0x34')]=function(_0x1ef372,_0x3a98ed,_0x51b0d1,_0x2f019d,_0x4e5b23,_0x4b69ed){var _0x2759a8,_0x195218;var _0x13f551=_0x6fc7('0x35');var _0x260037=_0x6fc7('0x36')+_0x1ef372;var _0x327725={};if(_0x3a98ed===_0x6fc7('0x37')){_0x327725[_0x6fc7('0x38')]={'ssml':_0x51b0d1};}else{_0x327725[_0x6fc7('0x38')]={'text':_0x51b0d1};};_0x327725[_0x6fc7('0x39')]={'languageCode':_0x2f019d,'ssmlGender':_0x4e5b23};_0x327725[_0x6fc7('0x3a')]={'audioEncoding':_0x6fc7('0x3b'),'sampleRateHertz':0x1f40};var _0x20a658={'url':_0x13f551+_0x6fc7('0x3c')+_0x260037,'method':'POST','json':!![],'body':_0x327725};return rp(_0x20a658)[_0x6fc7('0x2f')](function(_0x5b0ce3){return new BPromise(function(_0x31453e,_0x50fd44){_0x2759a8=path['resolve'](__dirname,_0x6fc7('0x2b'),rs[_0x6fc7('0x3d')](0x4)+_0x6fc7('0x3e'));var _0x42256c=Buffer[_0x6fc7('0x3f')](_0x5b0ce3['audioContent'],_0x6fc7('0x2e'));return fs['writeFile'](_0x2759a8,_0x42256c,function(_0x488fc9){_0x50fd44(_0x488fc9);},function(_0x139700){fs[_0x6fc7('0x30')](_0x2759a8,'777');_0x31453e(_0x139700);});});})[_0x6fc7('0x2f')](function(_0x3b87e8){_0x195218=path[_0x6fc7('0x40')](__dirname,_0x6fc7('0x2b'),rs[_0x6fc7('0x3d')](0x4)+_0x6fc7('0x2c'));return convertFile(_0x2759a8,_0x195218);})['then'](function(){try{fs[_0x6fc7('0x20')](_0x2759a8);fs[_0x6fc7('0x30')](_0x195218,_0x6fc7('0x41'));}catch(_0x5a58a8){logger[_0x6fc7('0x1f')](_0x5a58a8);}logger[_0x6fc7('0x1c')](_0x6fc7('0x42'),_0x195218[_0x6fc7('0x31')]('.')[0x0]);return _0x195218[_0x6fc7('0x31')]('.')[0x0];});};exports[_0x6fc7('0x43')]=function(_0x111584,_0x25475f){var _0x2c7620='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0x5146f3,_0xe44a5a;var _0x444e75;var _0x314741={'encoding':'utf8','method':_0x6fc7('0x44'),'timeout':0x2710,'url':_0x2c7620,'headers':{'Content-Type':_0x6fc7('0x45')},'body':_0x6fc7('0x46')+encodeURIComponent(JSON[_0x6fc7('0x47')]([[['jQ1olc',JSON[_0x6fc7('0x47')]([_0x111584,_0x25475f||'en',![],_0x6fc7('0x48')]),null,_0x6fc7('0x49')]]]))};return rp(_0x314741)[_0x6fc7('0x2f')](function(_0x1116c0){try{_0x444e75=eval(_0x1116c0[_0x6fc7('0x4a')](0x5))[0x0][0x2];}catch(_0x32889b){throw new Error(_0x6fc7('0x4b')+_0x1116c0['data']);}if(!_0x444e75){if(_0x111584['length']>0xc8){throw new Error(_0x6fc7('0x4c'));}else{throw new Error(_0x6fc7('0x4d')+_0x25475f+_0x6fc7('0x4e'));}}try{_0x444e75=eval(_0x444e75)[0x0];}catch(_0x4578b9){throw new Error(_0x6fc7('0x4b')+res[_0x6fc7('0x25')]);}const _0x1aa75e=_0x444e75;_0x5146f3=path[_0x6fc7('0x40')](__dirname,_0x6fc7('0x2b'),rs[_0x6fc7('0x3d')](0x4)+_0x6fc7('0x3e'));fs[_0x6fc7('0x2d')](_0x5146f3,_0x444e75,{'encoding':_0x6fc7('0x2e')});_0xe44a5a=path['resolve'](__dirname,_0x6fc7('0x2b'),rs['generate'](0x4)+_0x6fc7('0x2c'));return convertFile(_0x5146f3,_0xe44a5a);})[_0x6fc7('0x2f')](function(){try{fs['unlink'](_0x5146f3);fs['chmodSync'](_0xe44a5a,_0x6fc7('0x41'));}catch(_0x1dfab6){logger[_0x6fc7('0x1f')](_0x1dfab6);}logger[_0x6fc7('0x1c')](_0x6fc7('0x4f'),_0xe44a5a[_0x6fc7('0x31')]('.')[0x0]);return _0xe44a5a[_0x6fc7('0x31')]('.')[0x0];});};exports['googleASR']=function(_0x1b6e6a,_0x5f959f,_0x2c637a){return google[_0x6fc7('0x50')](_0x1b6e6a,_0x5f959f,_0x2c637a)[_0x6fc7('0x2f')](function(_0x4469c6){logger[_0x6fc7('0x1c')](_0x4469c6[_0x6fc7('0x51')]);return rp(_0x4469c6);})[_0x6fc7('0x2f')](function(_0x522f97){var _0xdd201b='';var _0x5d0e24=0x0;try{fs['unlink'](_0x1b6e6a);}catch(_0x3421c6){logger[_0x6fc7('0x1f')](_0x3421c6);}if(_0x522f97&&_0x522f97[_0x6fc7('0x52')]){_0xdd201b=_0x522f97[_0x6fc7('0x52')][_0x6fc7('0x53')](function(_0x176f16){return _0x176f16&&_0x176f16[_0x6fc7('0x54')][0x0]&&_0x176f16[_0x6fc7('0x54')][0x0][_0x6fc7('0x55')]?_0x176f16[_0x6fc7('0x54')][0x0][_0x6fc7('0x55')]:'';})[_0x6fc7('0x56')]('\x0a');_0x5d0e24=_0x522f97['results'][_0x6fc7('0x53')](function(_0x55eee2){return _0x55eee2&&_0x55eee2['alternatives'][0x0]&&_0x55eee2['alternatives'][0x0][_0x6fc7('0x57')]?_0x55eee2[_0x6fc7('0x54')][0x0][_0x6fc7('0x57')]:0x0;})['join']('\x0a');}logger[_0x6fc7('0x1c')]('googleASR\x20transcription',_0xdd201b);logger[_0x6fc7('0x1c')]('googleASR\x20confidence',_0x5d0e24);return{'transcript':_0xdd201b,'confidence':_0x5d0e24};})['catch'](function(_0x35cba1){logger[_0x6fc7('0x1f')](_0x6fc7('0x58'),_0x35cba1[_0x6fc7('0x17')],_0x35cba1[_0x6fc7('0x59')],_0x35cba1[_0x6fc7('0x5a')]);});};exports[_0x6fc7('0x5b')]=function(_0x11eeb8,_0x45e60c,_0x42bb3b,_0x449940){var _0x13ccff=apiai(_0x45e60c,{'language':_0x449940||'en'});return _0x13ccff[_0x6fc7('0x5c')](_0x42bb3b,{'sessionId':md5(_0x11eeb8)})[_0x6fc7('0x2f')](function(_0x3703cd){logger[_0x6fc7('0x1c')](JSON['stringify'](_0x3703cd));return{'source':_0x3703cd[_0x6fc7('0x5d')][_0x6fc7('0x5e')],'resolvedQuery':_0x3703cd[_0x6fc7('0x5d')][_0x6fc7('0x5f')],'action':_0x3703cd[_0x6fc7('0x5d')][_0x6fc7('0x60')],'actionIncomplete':_0x3703cd[_0x6fc7('0x5d')][_0x6fc7('0x61')],'speech':_0x3703cd['result'][_0x6fc7('0x62')][_0x6fc7('0x63')],'score':_0x3703cd['result'][_0x6fc7('0x64')],'statusCode':_0x3703cd['status'][_0x6fc7('0x65')],'endConversation':_0x3703cd[_0x6fc7('0x5d')][_0x6fc7('0x66')][_0x6fc7('0x67')]||![],'isFallbackIntent':_0x3703cd[_0x6fc7('0x5d')][_0x6fc7('0x66')][_0x6fc7('0x68')]};});};exports[_0x6fc7('0x69')]=function(_0x1b2aec,_0xeb375e,_0x46128d,_0x2a8331,_0x5d9822,_0x381a82){var _0x3851de=_0x2a8331[_0x6fc7('0x6a')](/\\n/g,'\x0a');var _0x3e5f2e={'credentials':{'private_key':_0x3851de,'client_email':_0x46128d}};var _0x357f22=new dialogflow[(_0x6fc7('0x6b'))](_0x3e5f2e);var _0x27ed6b=_0x357f22[_0x6fc7('0x6c')](_0xeb375e,md5(_0x1b2aec));var _0x2b2fd7={'session':_0x27ed6b,'queryInput':{'text':{'text':_0x5d9822,'languageCode':_0x381a82}}};return _0x357f22[_0x6fc7('0x6d')](_0x2b2fd7)[_0x6fc7('0x2f')](function(_0x60a88a){if(_0x60a88a&&_0x60a88a['length']){logger[_0x6fc7('0x1c')]('Dialogflow\x20V2\x20response:',JSON['stringify'](_0x60a88a));var _0x5b9005=_0x60a88a[0x0];if(_0x5b9005){var _0x140339={'action':_0x5b9005['queryResult'][_0x6fc7('0x60')],'allRequiredParamsPresent':_0x5b9005[_0x6fc7('0x6e')][_0x6fc7('0x6f')],'endConversation':_0x5b9005[_0x6fc7('0x6e')][_0x6fc7('0x70')]&&_0x5b9005[_0x6fc7('0x6e')][_0x6fc7('0x70')][_0x6fc7('0x71')]?_0x5b9005[_0x6fc7('0x6e')][_0x6fc7('0x70')]['fields'][_0x6fc7('0x72')]['boolValue']:![],'fulfillmentText':_0x5b9005[_0x6fc7('0x6e')]['fulfillmentText'],'intentName':_0x5b9005[_0x6fc7('0x6e')][_0x6fc7('0x73')][_0x6fc7('0x59')],'intentDisplayName':_0x5b9005['queryResult'][_0x6fc7('0x73')][_0x6fc7('0x74')],'isFallbackIntent':_0x5b9005[_0x6fc7('0x6e')][_0x6fc7('0x73')][_0x6fc7('0x75')],'languageCode':_0x5b9005[_0x6fc7('0x6e')]['languageCode'],'queryText':_0x5b9005[_0x6fc7('0x6e')][_0x6fc7('0x76')],'responseId':_0x5b9005[_0x6fc7('0x77')],'score':_0x5b9005['queryResult'][_0x6fc7('0x78')],'speech':_0x5b9005['queryResult'][_0x6fc7('0x79')],'providerResponse':JSON[_0x6fc7('0x47')](_0x60a88a)};return _0x140339;}}});};exports[_0x6fc7('0x7a')]=function(_0x5270dc,_0x48e761,_0x23f633,_0x249b14){return tilde['asr'](_0x5270dc,_0x48e761,_0x23f633,_0x249b14)[_0x6fc7('0x2f')](function(_0x13e55b){try{fs[_0x6fc7('0x20')](_0x5270dc);}catch(_0x4ee106){logger['error'](_0x4ee106);}logger['info']('Tilde\x20ASR\x20transcription',_0x13e55b[_0x6fc7('0x55')]);logger[_0x6fc7('0x1c')]('Tilde\x20ASR\x20confidence',_0x13e55b[_0x6fc7('0x57')]);return _0x13e55b;});};exports[_0x6fc7('0x7b')]=function(_0x489abb,_0x8bcfbc,_0x3ce34f,_0x13b27b,_0x4eba69,_0xc3f171){var _0xe14e3=path['resolve'](__dirname,_0x6fc7('0x2b'),rs[_0x6fc7('0x3d')](0x4)+_0x6fc7('0x3e'));var _0xb59be7;return aws[_0x6fc7('0x7c')](_0x489abb,_0x8bcfbc,_0x3ce34f,_0x13b27b,_0x4eba69,_0xc3f171,_0xe14e3)['then'](function(){_0xb59be7=path[_0x6fc7('0x40')](__dirname,_0x6fc7('0x2b'),rs[_0x6fc7('0x3d')](0x4)+_0x6fc7('0x2c'));return convertFile(_0xe14e3,_0xb59be7);})['then'](function(){try{fs['unlink'](_0xe14e3);fs['chmodSync'](_0xb59be7,_0x6fc7('0x41'));}catch(_0x579a85){logger[_0x6fc7('0x1f')](_0x579a85);}return _0xb59be7['split']('.')[0x0];});};exports[_0x6fc7('0x7d')]=function(_0x331be8,_0x215fbc,_0x30b39e,_0x47bc2d,_0x5a968b,_0x3646fe){return aws[_0x6fc7('0x7e')](_0x331be8,_0x215fbc,_0x30b39e,_0x47bc2d,_0x5a968b,_0x3646fe)[_0x6fc7('0x2f')](function(_0x34a93d){logger['info'](JSON[_0x6fc7('0x47')](_0x34a93d));return _0x34a93d;});};exports['ispeechTTS']=function(_0x56a74e,_0x211ad3,_0x4d1b3c,_0x4b3881){var _0x2920b9=util[_0x6fc7('0x7f')](_0x6fc7('0x80'),ISPEECH_API,_0x56a74e,encodeURIComponent(_0x211ad3),_0x4d1b3c,_0x4b3881);var _0x41d13a=path[_0x6fc7('0x40')](__dirname,_0x6fc7('0x2b'),rs[_0x6fc7('0x3d')](0x4)+_0x6fc7('0x3e'));var _0x211f9b;return downloadFile(_0x2920b9,_0x41d13a)[_0x6fc7('0x2f')](function(){_0x211f9b=path[_0x6fc7('0x40')](__dirname,_0x6fc7('0x2b'),rs[_0x6fc7('0x3d')](0x4)+_0x6fc7('0x2c'));return convertFile(_0x41d13a,_0x211f9b);})[_0x6fc7('0x2f')](function(){try{fs[_0x6fc7('0x20')](_0x41d13a);fs['chmodSync'](_0x211f9b,_0x6fc7('0x41'));}catch(_0x57bcdb){logger[_0x6fc7('0x1f')](_0x57bcdb);}return _0x211f9b[_0x6fc7('0x31')]('.')[0x0];});};exports[_0x6fc7('0x81')]=function(_0x3595f2,_0x1587d9,_0x4d29eb,_0x3760ca){var _0x311ba6=util[_0x6fc7('0x7f')](_0x6fc7('0x82'),ISPEECH_API,_0x1587d9,_0x4d29eb,base64Encode(_0x3595f2),_0x3760ca?util[_0x6fc7('0x7f')](_0x6fc7('0x83'),encodeURIComponent(_0x3760ca)):_0x6fc7('0x84'));return uploadFile(_0x311ba6)['then'](function(_0x4b6179){return querystring[_0x6fc7('0xc')](_0x4b6179);});};exports[_0x6fc7('0x85')]=function(_0x4707f5,_0x1f07a6){return sestek[_0x6fc7('0x86')](_0x4707f5,_0x1f07a6)['then'](function(_0x318c09){logger[_0x6fc7('0x1c')](JSON[_0x6fc7('0x47')](_0x318c09));var _0x5c2e09={'speech':_0x318c09[_0x6fc7('0x87')],'action':_0x318c09[_0x6fc7('0x88')]?_0x318c09['channelData'][_0x6fc7('0x89')]:undefined,'actiondata':_0x318c09[_0x6fc7('0x88')]?_0x318c09[_0x6fc7('0x88')][_0x6fc7('0x8a')]:undefined};if(_0x318c09[_0x6fc7('0x88')]&&_0x318c09[_0x6fc7('0x88')]['AudioFromTts']){return base64Decode(_0x318c09[_0x6fc7('0x88')][_0x6fc7('0x8b')][_0x6fc7('0x8c')],path[_0x6fc7('0x40')](__dirname,_0x6fc7('0x2b'),rs[_0x6fc7('0x3d')](0x4)+_0x6fc7('0x2c')))[_0x6fc7('0x2f')](function(_0x4e0d54){_0x5c2e09[_0x6fc7('0x8d')]=_0x4e0d54;return _0x5c2e09;});}return _0x5c2e09;});};exports['dirName']=function(){return __dirname;}; \ No newline at end of file +var _0x4f5d=['diagnosticInfo','fields','boolValue','fulfillmentText','intent','name','isFallback','languageCode','queryText','responseId','intentDetectionConfidence','tildeASR','awsPolly','polly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','sestekNDA','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise','bluebird','http','https','md5','path','querystring','request-promise','sox','google-tts-api','url','parse','./aws','./google','./sestek','./tilde','../../../config/logger','agi','host','WHAT_EVER','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','info','finish\x20download\x20file','close','unlink','pipe','end','data','wav','resolve','tmp','generate','.wav','writeFileSync','base64','chmodSync','777','split','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','audioConfig','MP3','text:synthesize','then','.mp3','audioContent','writeFile','googleCloudTTS\x20path','googleTTS','utf8','POST','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','null','generic','slice','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives','transcript','join','confidence','catch','message','googleDialogflow','textRequest','source','result','action','fulfillment','speech','code','endConversation','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','detectIntent','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent'];(function(_0x375173,_0x25e914){var _0x4d836b=function(_0x303451){while(--_0x303451){_0x375173['push'](_0x375173['shift']());}};_0x4d836b(++_0x25e914);}(_0x4f5d,0x12b));var _0xd4f5=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x4f5d[_0x16b9ed];return _0x66b1f8;};'use strict';var apiai=require(_0xd4f5('0x0'));var BPromise=require(_0xd4f5('0x1'));var dialogflow=require('dialogflow');var fs=require('fs');var http=require(_0xd4f5('0x2'));var https=require(_0xd4f5('0x3'));var md5=require(_0xd4f5('0x4'));var path=require(_0xd4f5('0x5'));var querystring=require(_0xd4f5('0x6'));var rp=require(_0xd4f5('0x7'));var rs=require('randomstring');var sox=require(_0xd4f5('0x8'));var tts=require(_0xd4f5('0x9'));var urlParse=require(_0xd4f5('0xa'))[_0xd4f5('0xb')];var util=require('util');var aws=require(_0xd4f5('0xc'));var google=require(_0xd4f5('0xd'));var sestek=require(_0xd4f5('0xe'));var tilde=require(_0xd4f5('0xf'));var logger=require(_0xd4f5('0x10'))(_0xd4f5('0x11'));var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0x2fc672,_0x2f5639){return new BPromise(function(_0x2f9b77,_0x406af9){var _0x7b849b=urlParse(_0x2fc672);var _0x26a9a4=_0x7b849b['protocol']==='https:'?https:http;var _0x29fc22={'host':_0x7b849b[_0xd4f5('0x12')],'path':_0x7b849b[_0xd4f5('0x5')],'headers':{'user-agent':_0xd4f5('0x13')}};_0x26a9a4[_0xd4f5('0x14')](_0x29fc22,function(_0xa055b1){if(_0xa055b1[_0xd4f5('0x15')]!==0xc8){logger[_0xd4f5('0x16')](_0xd4f5('0x17')+_0x2fc672+_0xd4f5('0x18')+_0xa055b1[_0xd4f5('0x15')]+'\x20('+_0xa055b1['statusMessage']+')');_0x406af9(new Error(_0xd4f5('0x17')+_0x2fc672+_0xd4f5('0x18')+_0xa055b1[_0xd4f5('0x15')]+'\x20('+_0xa055b1[_0xd4f5('0x19')]+')'));return;}var _0x57e31b=fs[_0xd4f5('0x1a')](_0x2f5639);_0x57e31b['on']('finish',function(){logger[_0xd4f5('0x1b')](_0xd4f5('0x1c'));_0x57e31b[_0xd4f5('0x1d')](_0x2f9b77);});_0x57e31b['on'](_0xd4f5('0x16'),function(_0x34bdce){fs[_0xd4f5('0x1e')](_0x2f5639);logger[_0xd4f5('0x16')]('download\x20error',_0x34bdce);_0x406af9(_0x34bdce);});_0xa055b1[_0xd4f5('0x1f')](_0x57e31b);})['on'](_0xd4f5('0x16'),function(_0xafd3ba){logger[_0xd4f5('0x16')](_0xafd3ba);_0x406af9(_0xafd3ba);})[_0xd4f5('0x20')]();});}function uploadFile(_0x5507a2){return new BPromise(function(_0x4c7271,_0x881ce3){var _0x4690f9=urlParse(_0x5507a2);var _0x509f78=_0x4690f9['protocol']==='https:'?https:http;var _0x4599ec={'host':_0x4690f9[_0xd4f5('0x12')],'path':_0x4690f9[_0xd4f5('0x5')],'headers':{'user-agent':_0xd4f5('0x13')}};_0x509f78['get'](_0x4599ec,function(_0x34cee7){if(_0x34cee7[_0xd4f5('0x15')]!==0xc8){_0x881ce3(new Error('request\x20to\x20'+_0x5507a2+_0xd4f5('0x18')+_0x34cee7['statusCode']+'\x20('+_0x34cee7[_0xd4f5('0x19')]+')'));return;}var _0x28fc4b='';_0x34cee7['on'](_0xd4f5('0x21'),function(_0x5d2d60){_0x28fc4b+=_0x5d2d60;});_0x34cee7['on']('end',function(){_0x4c7271(_0x28fc4b);});})['on'](_0xd4f5('0x16'),function(_0x21011e){_0x881ce3(_0x21011e);})[_0xd4f5('0x20')]();});}function convertFile(_0x57df52,_0x34e871){return new BPromise(function(_0x480c75,_0x41c1ad){var _0x2c9a3c=sox['transcode'](_0x57df52,_0x34e871,{'sampleRate':0x1f40,'format':_0xd4f5('0x22'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x2c9a3c['on']('error',function(_0x1028d5){logger[_0xd4f5('0x16')]('error\x20convert',_0x1028d5);_0x41c1ad(_0x1028d5);});_0x2c9a3c['on'](_0xd4f5('0x20'),function(){logger[_0xd4f5('0x1b')]('finish\x20to\x20convert');_0x480c75();});_0x2c9a3c['start']();});}function base64Decode(_0x3165c5,_0x41b30d){var _0x27deba=path[_0xd4f5('0x23')](__dirname,_0xd4f5('0x24'),rs[_0xd4f5('0x25')](0x4)+_0xd4f5('0x26'));fs[_0xd4f5('0x27')](_0x27deba,_0x3165c5,_0xd4f5('0x28'));return convertFile(_0x27deba,_0x41b30d)['then'](function(){try{fs[_0xd4f5('0x1e')](_0x27deba);fs[_0xd4f5('0x29')](_0x41b30d,_0xd4f5('0x2a'));}catch(_0x39fc37){logger[_0xd4f5('0x16')](_0x39fc37);}return _0x41b30d[_0xd4f5('0x2b')]('.')[0x0];});}function base64Encode(_0x36e489){var _0x231183=fs[_0xd4f5('0x2c')](_0x36e489);return new Buffer(_0x231183)[_0xd4f5('0x2d')](_0xd4f5('0x28'));}exports[_0xd4f5('0x2e')]=function(_0x5558e2,_0xe87038,_0x4a62ff,_0x238e52,_0x4b3dd7,_0x522faa){var _0x3f91e3,_0x45e14b;var _0x3f4440=_0xd4f5('0x2f');var _0x4383e9=_0xd4f5('0x30')+_0x5558e2;var _0x33b267={};if(_0xe87038===_0xd4f5('0x31')){_0x33b267[_0xd4f5('0x32')]={'ssml':_0x4a62ff};}else{_0x33b267[_0xd4f5('0x32')]={'text':_0x4a62ff};};_0x33b267['voice']={'languageCode':_0x238e52,'ssmlGender':_0x4b3dd7};_0x33b267[_0xd4f5('0x33')]={'audioEncoding':_0xd4f5('0x34'),'sampleRateHertz':0x1f40};var _0x309ed4={'url':_0x3f4440+_0xd4f5('0x35')+_0x4383e9,'method':'POST','json':!![],'body':_0x33b267};return rp(_0x309ed4)[_0xd4f5('0x36')](function(_0x50200c){return new BPromise(function(_0x380a61,_0x1d432e){_0x3f91e3=path['resolve'](__dirname,_0xd4f5('0x24'),rs[_0xd4f5('0x25')](0x4)+_0xd4f5('0x37'));var _0x177338=Buffer['from'](_0x50200c[_0xd4f5('0x38')],_0xd4f5('0x28'));return fs[_0xd4f5('0x39')](_0x3f91e3,_0x177338,function(_0x4af89d){_0x1d432e(_0x4af89d);},function(_0x20663b){fs['chmodSync'](_0x3f91e3,_0xd4f5('0x2a'));_0x380a61(_0x20663b);});});})[_0xd4f5('0x36')](function(_0x5cb756){_0x45e14b=path['resolve'](__dirname,_0xd4f5('0x24'),rs[_0xd4f5('0x25')](0x4)+'.wav');return convertFile(_0x3f91e3,_0x45e14b);})['then'](function(){try{fs[_0xd4f5('0x1e')](_0x3f91e3);fs[_0xd4f5('0x29')](_0x45e14b,_0xd4f5('0x2a'));}catch(_0x78c587){logger['error'](_0x78c587);}logger[_0xd4f5('0x1b')](_0xd4f5('0x3a'),_0x45e14b[_0xd4f5('0x2b')]('.')[0x0]);return _0x45e14b[_0xd4f5('0x2b')]('.')[0x0];});};exports[_0xd4f5('0x3b')]=function(_0x108371,_0x412fdf){var _0x5918b6='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0x16a180,_0x2dc9fa;var _0x1b05bf;var _0x3f2765={'encoding':_0xd4f5('0x3c'),'method':_0xd4f5('0x3d'),'timeout':0x2710,'url':_0x5918b6,'headers':{'Content-Type':_0xd4f5('0x3e')},'body':_0xd4f5('0x3f')+encodeURIComponent(JSON[_0xd4f5('0x40')]([[[_0xd4f5('0x41'),JSON[_0xd4f5('0x40')]([_0x108371,_0x412fdf||'en',![],_0xd4f5('0x42')]),null,_0xd4f5('0x43')]]]))};return rp(_0x3f2765)['then'](function(_0x15849f){try{_0x1b05bf=eval(_0x15849f[_0xd4f5('0x44')](0x5))[0x0][0x2];}catch(_0x2f0c1c){throw new Error(_0xd4f5('0x45')+_0x15849f[_0xd4f5('0x21')]);}if(!_0x1b05bf){if(_0x108371[_0xd4f5('0x46')]>0xc8){throw new Error(_0xd4f5('0x47'));}else{throw new Error(_0xd4f5('0x48')+_0x412fdf+_0xd4f5('0x49'));}}try{_0x1b05bf=eval(_0x1b05bf)[0x0];}catch(_0x3d82b4){throw new Error(_0xd4f5('0x45')+res['data']);}const _0x4d1be6=_0x1b05bf;_0x16a180=path[_0xd4f5('0x23')](__dirname,_0xd4f5('0x24'),rs[_0xd4f5('0x25')](0x4)+_0xd4f5('0x37'));fs[_0xd4f5('0x27')](_0x16a180,_0x1b05bf,{'encoding':_0xd4f5('0x28')});_0x2dc9fa=path[_0xd4f5('0x23')](__dirname,'tmp',rs[_0xd4f5('0x25')](0x4)+_0xd4f5('0x26'));return convertFile(_0x16a180,_0x2dc9fa);})[_0xd4f5('0x36')](function(){try{fs['unlink'](_0x16a180);fs[_0xd4f5('0x29')](_0x2dc9fa,'777');}catch(_0xa6ba4d){logger[_0xd4f5('0x16')](_0xa6ba4d);}logger[_0xd4f5('0x1b')](_0xd4f5('0x4a'),_0x2dc9fa['split']('.')[0x0]);return _0x2dc9fa[_0xd4f5('0x2b')]('.')[0x0];});};exports[_0xd4f5('0x4b')]=function(_0x112596,_0x1bfc91,_0x4b5847){return google[_0xd4f5('0x4c')](_0x112596,_0x1bfc91,_0x4b5847)['then'](function(_0x25ecd3){logger['info'](_0x25ecd3[_0xd4f5('0x4d')]);return rp(_0x25ecd3);})[_0xd4f5('0x36')](function(_0x365ce5){var _0x295af0='';var _0xa3342d=0x0;try{fs[_0xd4f5('0x1e')](_0x112596);}catch(_0x1b98f1){logger[_0xd4f5('0x16')](_0x1b98f1);}if(_0x365ce5&&_0x365ce5[_0xd4f5('0x4e')]){_0x295af0=_0x365ce5[_0xd4f5('0x4e')][_0xd4f5('0x4f')](function(_0xa0fa4e){return _0xa0fa4e&&_0xa0fa4e[_0xd4f5('0x50')][0x0]&&_0xa0fa4e[_0xd4f5('0x50')][0x0][_0xd4f5('0x51')]?_0xa0fa4e['alternatives'][0x0]['transcript']:'';})[_0xd4f5('0x52')]('\x0a');_0xa3342d=_0x365ce5[_0xd4f5('0x4e')][_0xd4f5('0x4f')](function(_0x1aa5ad){return _0x1aa5ad&&_0x1aa5ad['alternatives'][0x0]&&_0x1aa5ad['alternatives'][0x0][_0xd4f5('0x53')]?_0x1aa5ad[_0xd4f5('0x50')][0x0][_0xd4f5('0x53')]:0x0;})['join']('\x0a');}logger[_0xd4f5('0x1b')]('googleASR\x20transcription',_0x295af0);logger['info']('googleASR\x20confidence',_0xa3342d);return{'transcript':_0x295af0,'confidence':_0xa3342d};})[_0xd4f5('0x54')](function(_0x97671){logger[_0xd4f5('0x16')]('[%s]\x20%s:%s',_0x97671[_0xd4f5('0x15')],_0x97671['name'],_0x97671[_0xd4f5('0x55')]);});};exports[_0xd4f5('0x56')]=function(_0x97e965,_0x8fc04e,_0x153d3a,_0x2a78bb){var _0x2897fd=apiai(_0x8fc04e,{'language':_0x2a78bb||'en'});return _0x2897fd[_0xd4f5('0x57')](_0x153d3a,{'sessionId':md5(_0x97e965)})[_0xd4f5('0x36')](function(_0x45722b){logger[_0xd4f5('0x1b')](JSON[_0xd4f5('0x40')](_0x45722b));return{'source':_0x45722b['result'][_0xd4f5('0x58')],'resolvedQuery':_0x45722b[_0xd4f5('0x59')]['resolvedQuery'],'action':_0x45722b[_0xd4f5('0x59')][_0xd4f5('0x5a')],'actionIncomplete':_0x45722b[_0xd4f5('0x59')]['actionIncomplete'],'speech':_0x45722b['result'][_0xd4f5('0x5b')][_0xd4f5('0x5c')],'score':_0x45722b[_0xd4f5('0x59')]['score'],'statusCode':_0x45722b['status'][_0xd4f5('0x5d')],'endConversation':_0x45722b[_0xd4f5('0x59')]['metadata'][_0xd4f5('0x5e')]||![],'isFallbackIntent':_0x45722b['result']['metadata'][_0xd4f5('0x5f')]};});};exports[_0xd4f5('0x60')]=function(_0x163be0,_0x1c183b,_0xf261c3,_0x5cae57,_0x488e5a,_0x3dc10a){var _0x1eaf98=_0x5cae57[_0xd4f5('0x61')](/\\n/g,'\x0a');var _0xd1a56b={'credentials':{'private_key':_0x1eaf98,'client_email':_0xf261c3}};var _0x52b516=new dialogflow[(_0xd4f5('0x62'))](_0xd1a56b);var _0x417e68=_0x52b516['sessionPath'](_0x1c183b,md5(_0x163be0));var _0x3ce9da={'session':_0x417e68,'queryInput':{'text':{'text':_0x488e5a,'languageCode':_0x3dc10a}}};return _0x52b516[_0xd4f5('0x63')](_0x3ce9da)['then'](function(_0x129160){if(_0x129160&&_0x129160['length']){logger['info'](_0xd4f5('0x64'),JSON[_0xd4f5('0x40')](_0x129160));var _0x921438=_0x129160[0x0];if(_0x921438){var _0xb3f691={'action':_0x921438[_0xd4f5('0x65')][_0xd4f5('0x5a')],'allRequiredParamsPresent':_0x921438[_0xd4f5('0x65')][_0xd4f5('0x66')],'endConversation':_0x921438[_0xd4f5('0x65')][_0xd4f5('0x67')]&&_0x921438[_0xd4f5('0x65')]['diagnosticInfo'][_0xd4f5('0x68')]?_0x921438['queryResult'][_0xd4f5('0x67')][_0xd4f5('0x68')]['end_conversation'][_0xd4f5('0x69')]:![],'fulfillmentText':_0x921438[_0xd4f5('0x65')][_0xd4f5('0x6a')],'intentName':_0x921438[_0xd4f5('0x65')][_0xd4f5('0x6b')][_0xd4f5('0x6c')],'intentDisplayName':_0x921438['queryResult'][_0xd4f5('0x6b')]['displayName'],'isFallbackIntent':_0x921438['queryResult'][_0xd4f5('0x6b')][_0xd4f5('0x6d')],'languageCode':_0x921438['queryResult'][_0xd4f5('0x6e')],'queryText':_0x921438['queryResult'][_0xd4f5('0x6f')],'responseId':_0x921438[_0xd4f5('0x70')],'score':_0x921438[_0xd4f5('0x65')][_0xd4f5('0x71')],'speech':_0x921438['queryResult'][_0xd4f5('0x6a')],'providerResponse':JSON[_0xd4f5('0x40')](_0x129160)};return _0xb3f691;}}});};exports[_0xd4f5('0x72')]=function(_0x148113,_0xe25382,_0x426583,_0x5bc21c){return tilde[_0xd4f5('0x4c')](_0x148113,_0xe25382,_0x426583,_0x5bc21c)[_0xd4f5('0x36')](function(_0x1d10ea){try{fs[_0xd4f5('0x1e')](_0x148113);}catch(_0x26a50f){logger['error'](_0x26a50f);}logger[_0xd4f5('0x1b')]('Tilde\x20ASR\x20transcription',_0x1d10ea[_0xd4f5('0x51')]);logger[_0xd4f5('0x1b')]('Tilde\x20ASR\x20confidence',_0x1d10ea['confidence']);return _0x1d10ea;});};exports[_0xd4f5('0x73')]=function(_0x2c23f2,_0xe7ba40,_0x3e92df,_0x1a5362,_0x1eac09,_0x1e43df){var _0x3a41eb=path[_0xd4f5('0x23')](__dirname,_0xd4f5('0x24'),rs['generate'](0x4)+_0xd4f5('0x37'));var _0x3c4e89;return aws[_0xd4f5('0x74')](_0x2c23f2,_0xe7ba40,_0x3e92df,_0x1a5362,_0x1eac09,_0x1e43df,_0x3a41eb)[_0xd4f5('0x36')](function(){_0x3c4e89=path[_0xd4f5('0x23')](__dirname,_0xd4f5('0x24'),rs[_0xd4f5('0x25')](0x4)+_0xd4f5('0x26'));return convertFile(_0x3a41eb,_0x3c4e89);})[_0xd4f5('0x36')](function(){try{fs['unlink'](_0x3a41eb);fs['chmodSync'](_0x3c4e89,'777');}catch(_0x544a20){logger[_0xd4f5('0x16')](_0x544a20);}return _0x3c4e89['split']('.')[0x0];});};exports[_0xd4f5('0x75')]=function(_0x13b0c8,_0x9e8d05,_0x43661c,_0x2276b6,_0x42f374,_0x4e4cc7){return aws[_0xd4f5('0x76')](_0x13b0c8,_0x9e8d05,_0x43661c,_0x2276b6,_0x42f374,_0x4e4cc7)[_0xd4f5('0x36')](function(_0x49ebbc){logger[_0xd4f5('0x1b')](JSON[_0xd4f5('0x40')](_0x49ebbc));return _0x49ebbc;});};exports[_0xd4f5('0x77')]=function(_0xdcab41,_0x1c4ab5,_0x1ca62f,_0x19ccc0){var _0xf1cfd5=util[_0xd4f5('0x78')](_0xd4f5('0x79'),ISPEECH_API,_0xdcab41,encodeURIComponent(_0x1c4ab5),_0x1ca62f,_0x19ccc0);var _0x558405=path[_0xd4f5('0x23')](__dirname,_0xd4f5('0x24'),rs[_0xd4f5('0x25')](0x4)+'.mp3');var _0x1a4733;return downloadFile(_0xf1cfd5,_0x558405)[_0xd4f5('0x36')](function(){_0x1a4733=path[_0xd4f5('0x23')](__dirname,_0xd4f5('0x24'),rs[_0xd4f5('0x25')](0x4)+_0xd4f5('0x26'));return convertFile(_0x558405,_0x1a4733);})[_0xd4f5('0x36')](function(){try{fs[_0xd4f5('0x1e')](_0x558405);fs[_0xd4f5('0x29')](_0x1a4733,_0xd4f5('0x2a'));}catch(_0x438cfe){logger[_0xd4f5('0x16')](_0x438cfe);}return _0x1a4733[_0xd4f5('0x2b')]('.')[0x0];});};exports['ispeechASR']=function(_0x4cb7c3,_0x294805,_0x297f25,_0x5b66f0){var _0x2546be=util[_0xd4f5('0x78')](_0xd4f5('0x7a'),ISPEECH_API,_0x294805,_0x297f25,base64Encode(_0x4cb7c3),_0x5b66f0?util['format'](_0xd4f5('0x7b'),encodeURIComponent(_0x5b66f0)):_0xd4f5('0x7c'));return uploadFile(_0x2546be)[_0xd4f5('0x36')](function(_0x3c3c90){return querystring[_0xd4f5('0xb')](_0x3c3c90);});};exports[_0xd4f5('0x7d')]=function(_0x16eef7,_0x3e43b7){return sestek['nda'](_0x16eef7,_0x3e43b7)[_0xd4f5('0x36')](function(_0x543e7d){logger[_0xd4f5('0x1b')](JSON['stringify'](_0x543e7d));var _0x3646c0={'speech':_0x543e7d[_0xd4f5('0x7e')],'action':_0x543e7d['channelData']?_0x543e7d[_0xd4f5('0x7f')][_0xd4f5('0x80')]:undefined,'actiondata':_0x543e7d[_0xd4f5('0x7f')]?_0x543e7d[_0xd4f5('0x7f')][_0xd4f5('0x81')]:undefined};if(_0x543e7d['channelData']&&_0x543e7d[_0xd4f5('0x7f')]['AudioFromTts']){return base64Decode(_0x543e7d['channelData'][_0xd4f5('0x82')][_0xd4f5('0x83')],path[_0xd4f5('0x23')](__dirname,_0xd4f5('0x24'),rs[_0xd4f5('0x25')](0x4)+_0xd4f5('0x26')))[_0xd4f5('0x36')](function(_0x5a17f5){_0x3646c0[_0xd4f5('0x84')]=_0x5a17f5;return _0x3646c0;});}return _0x3646c0;});};exports[_0xd4f5('0x85')]=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 ce49676..8f34e03 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 _0x895c=['exports','./nda'];(function(_0x375e36,_0x145954){var _0x25ae31=function(_0xf498ed){while(--_0xf498ed){_0x375e36['push'](_0x375e36['shift']());}};_0x25ae31(++_0x145954);}(_0x895c,0x195));var _0xc895=function(_0x499fa3,_0x5f9a57){_0x499fa3=_0x499fa3-0x0;var _0x27199c=_0x895c[_0x499fa3];return _0x27199c;};var nda=require(_0xc895('0x0'));module[_0xc895('0x1')]={'nda':nda}; \ No newline at end of file +var nda=require('./nda');module['exports']={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index 2d5e9ac..c19aefe 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 _0x9993=['CustomAction','custom_action_data','CustomActionData','stringify','request-promise','../../../../../config/logger','agi','exports','POST','resolve','ndauth_url','password','username','then','/api/NaturalDialogAssistant/v1/Run','message','Nda','callerid','calleridname','dnid','extension','text','Bearer\x20','access_token','body','channelData','project','ndagenerate_audio','audio/wav'];(function(_0x43776a,_0x4eb74c){var _0x18eb8f=function(_0x319afb){while(--_0x319afb){_0x43776a['push'](_0x43776a['shift']());}};_0x18eb8f(++_0x4eb74c);}(_0x9993,0x109));var _0x3999=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0x9993[_0x4a53d];return _0x27410e;};'use strict';var rp=require(_0x3999('0x0'));var url=require('url');var logger=require(_0x3999('0x1'))(_0x3999('0x2'));module[_0x3999('0x3')]=function(_0x4b3123,_0x464d6f){var _0x4f3c12={'method':_0x3999('0x4'),'uri':url[_0x3999('0x5')](_0x464d6f[_0x3999('0x6')],'/token'),'form':{'grant_type':_0x3999('0x7'),'username':_0x464d6f[_0x3999('0x8')],'password':_0x464d6f['password']},'json':!![]};return rp(_0x4f3c12)[_0x3999('0x9')](function(_0x85b5af){var _0x4c1a49={'method':_0x3999('0x4'),'uri':url[_0x3999('0x5')](_0x464d6f['ndassistant_url'],_0x3999('0xa')),'body':{'type':_0x464d6f['ndaactivity_type']||_0x3999('0xb'),'channelId':_0x3999('0xc'),'conversation':{'id':_0x4b3123['uniqueid']},'from':{'id':_0x4b3123[_0x3999('0xd')],'name':_0x4b3123[_0x3999('0xe')]},'recipient':{'id':_0x4b3123[_0x3999('0xf')],'name':_0x4b3123[_0x3999('0x10')]},'text':_0x464d6f[_0x3999('0x11')],'channelData':{}},'headers':{'Authorization':_0x3999('0x12')+_0x85b5af[_0x3999('0x13')]},'json':!![]};if(_0x464d6f['project']){_0x4c1a49[_0x3999('0x14')][_0x3999('0x15')]['ProjectName']=_0x464d6f[_0x3999('0x16')];}if(_0x464d6f[_0x3999('0x17')]=='1'){_0x4c1a49[_0x3999('0x14')][_0x3999('0x15')]['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x3999('0x18')};}if(_0x464d6f['custom_action']){_0x4c1a49[_0x3999('0x14')]['channelData'][_0x3999('0x19')]=_0x464d6f['custom_action'];if(_0x464d6f[_0x3999('0x1a')]){_0x4c1a49[_0x3999('0x14')][_0x3999('0x15')][_0x3999('0x1b')]=_0x464d6f['custom_action_data'];}}logger['info'](JSON[_0x3999('0x1c')](_0x4c1a49));return rp(_0x4c1a49);});}; \ No newline at end of file +var _0x26bc=['ndauth_url','password','username','resolve','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','calleridname','dnid','extension','text','Bearer\x20','access_token','body','project','ndagenerate_audio','channelData','audio/wav','custom_action','CustomAction','custom_action_data','request-promise','url','../../../../../config/logger','agi','exports','POST'];(function(_0xec9735,_0x5965a5){var _0x31d2d1=function(_0x49df9e){while(--_0x49df9e){_0xec9735['push'](_0xec9735['shift']());}};_0x31d2d1(++_0x5965a5);}(_0x26bc,0x162));var _0xc26b=function(_0x11d50c,_0x133065){_0x11d50c=_0x11d50c-0x0;var _0x10d49d=_0x26bc[_0x11d50c];return _0x10d49d;};'use strict';var rp=require(_0xc26b('0x0'));var url=require(_0xc26b('0x1'));var logger=require(_0xc26b('0x2'))(_0xc26b('0x3'));module[_0xc26b('0x4')]=function(_0x4eda53,_0x21c373){var _0x1bb460={'method':_0xc26b('0x5'),'uri':url['resolve'](_0x21c373[_0xc26b('0x6')],'/token'),'form':{'grant_type':_0xc26b('0x7'),'username':_0x21c373[_0xc26b('0x8')],'password':_0x21c373[_0xc26b('0x7')]},'json':!![]};return rp(_0x1bb460)['then'](function(_0x11c6f5){var _0x453491={'method':_0xc26b('0x5'),'uri':url[_0xc26b('0x9')](_0x21c373[_0xc26b('0xa')],_0xc26b('0xb')),'body':{'type':_0x21c373[_0xc26b('0xc')]||_0xc26b('0xd'),'channelId':_0xc26b('0xe'),'conversation':{'id':_0x4eda53[_0xc26b('0xf')]},'from':{'id':_0x4eda53['callerid'],'name':_0x4eda53[_0xc26b('0x10')]},'recipient':{'id':_0x4eda53[_0xc26b('0x11')],'name':_0x4eda53[_0xc26b('0x12')]},'text':_0x21c373[_0xc26b('0x13')],'channelData':{}},'headers':{'Authorization':_0xc26b('0x14')+_0x11c6f5[_0xc26b('0x15')]},'json':!![]};if(_0x21c373['project']){_0x453491[_0xc26b('0x16')]['channelData']['ProjectName']=_0x21c373[_0xc26b('0x17')];}if(_0x21c373[_0xc26b('0x18')]=='1'){_0x453491[_0xc26b('0x16')][_0xc26b('0x19')]['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xc26b('0x1a')};}if(_0x21c373[_0xc26b('0x1b')]){_0x453491[_0xc26b('0x16')][_0xc26b('0x19')][_0xc26b('0x1c')]=_0x21c373[_0xc26b('0x1b')];if(_0x21c373['custom_action_data']){_0x453491[_0xc26b('0x16')][_0xc26b('0x19')]['CustomActionData']=_0x21c373[_0xc26b('0x1d')];}}logger['info'](JSON['stringify'](_0x453491));return rp(_0x453491);});}; \ 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 da36c12..d0f7a59 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 _0xcaf9=['exports','./lib/api'];(function(_0x42797d,_0xe3cfb0){var _0x14fa59=function(_0x5ce59d){while(--_0x5ce59d){_0x42797d['push'](_0x42797d['shift']());}};_0x14fa59(++_0xe3cfb0);}(_0xcaf9,0xb5));var _0x9caf=function(_0x42b4f1,_0x34f71d){_0x42b4f1=_0x42b4f1-0x0;var _0x2fa51f=_0xcaf9[_0x42b4f1];return _0x2fa51f;};'use strict';var asr=require(_0x9caf('0x0'));module[_0x9caf('0x1')]=function(_0x4850e4,_0x2b8223,_0x3080b3,_0x1e900c){return asr(_0x4850e4,_0x2b8223,_0x3080b3,_0x1e900c);}; \ No newline at end of file +var _0x6033=['exports'];(function(_0x1a595a,_0x263824){var _0x33f008=function(_0x1e2f9c){while(--_0x1e2f9c){_0x1a595a['push'](_0x1a595a['shift']());}};_0x33f008(++_0x263824);}(_0x6033,0x177));var _0x3603=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x6033[_0x502c7d];return _0x30b7ed;};'use strict';var asr=require('./lib/api');module[_0x3603('0x0')]=function(_0x4c5c71,_0x3a4e18,_0x69ff9,_0x4c781f){return asr(_0x4c5c71,_0x3a4e18,_0x69ff9,_0x4c781f);}; \ 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 aa39999..cb98e3a 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 _0xbe9a=['Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','open','message','moment','crypto','../../../../../../config/logger','agi','exports','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','sha1','update','hex','info','Open\x20Tilde\x20ASR\x20socket','unix','stringify','createReadStream','data','send','close','EOS','error','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result'];(function(_0x1cfda3,_0x32e81){var _0x45a82f=function(_0x19078e){while(--_0x19078e){_0x1cfda3['push'](_0x1cfda3['shift']());}};_0x45a82f(++_0x32e81);}(_0xbe9a,0x1c6));var _0xabe9=function(_0xbf6356,_0x39f7cd){_0xbf6356=_0xbf6356-0x0;var _0x3c2a12=_0xbe9a[_0xbf6356];return _0x3c2a12;};'use strict';var BPromise=require('bluebird');var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xabe9('0x0'));var crypto=require(_0xabe9('0x1'));var logger=require(_0xabe9('0x2'))(_0xabe9('0x3'));module[_0xabe9('0x4')]=function(_0x6a9051,_0x4ff291,_0x1f706d,_0x3ec918){return new BPromise(function(_0x11b9e3,_0x57ddbd){logger['info'](_0xabe9('0x5'),_0x3ec918||_0xabe9('0x6'));var _0x244ba8=new WebSocket(_0x3ec918||_0xabe9('0x6'),{'perMessageDeflate':![]});var _0x456272='';var _0x50091d='0';var _0x5e636b='1';var _0x23357c=_0xabe9('0x7');function _0x3e839e(_0x312bf8){var _0x42d1d8=crypto['createHash'](_0xabe9('0x8'));_0x42d1d8[_0xabe9('0x9')](_0x312bf8);return _0x42d1d8['digest'](_0xabe9('0xa'));}function _0x31d5b2(){try{logger[_0xabe9('0xb')](_0xabe9('0xc'));var _0x57c012=moment()[_0xabe9('0xd')]();var _0x34cc16=_0x3e839e(_0x57c012+_0x4ff291+_0x1f706d);_0x244ba8['send'](JSON[_0xabe9('0xe')]({'appID':_0x4ff291,'timestamp':_0x57c012,'appKey':_0x34cc16}));var _0x5ec102=fs[_0xabe9('0xf')](_0x6a9051);_0x5ec102['on'](_0xabe9('0x10'),function(_0x229efa){_0x244ba8[_0xabe9('0x11')](_0x229efa);});_0x5ec102['on'](_0xabe9('0x12'),function(){_0x244ba8[_0xabe9('0x11')](_0xabe9('0x13'));});}catch(_0x5ca7d3){logger[_0xabe9('0x14')](_0xabe9('0x15'),JSON['stringify'](_0x5ca7d3));_0x244ba8[_0xabe9('0x16')]();}}function _0x325ca7(_0xe5552d){try{if(_0xe5552d){var _0x27a83b=JSON[_0xabe9('0x17')](_0xe5552d);switch(_0x27a83b[_0xabe9('0x18')]){case 0x0:if(_0x27a83b[_0xabe9('0x19')]){if(_0x27a83b[_0xabe9('0x19')]['final']){logger[_0xabe9('0xb')](_0xabe9('0x1a'),JSON[_0xabe9('0xe')](_0x27a83b[_0xabe9('0x19')]['hypotheses']));_0x456272=_0x27a83b[_0xabe9('0x19')][_0xabe9('0x1b')][0x0][_0xabe9('0x1c')];_0x50091d=_0x27a83b['result'][_0xabe9('0x1b')][0x0][_0xabe9('0x1d')];_0x5e636b='0';_0x23357c='Success.';_0x244ba8['terminate']();}}break;case 0x1:logger[_0xabe9('0xb')](_0xabe9('0x7'));_0x5e636b='1';_0x23357c=_0xabe9('0x7');break;case 0x2:logger[_0xabe9('0xb')](_0xabe9('0x1e'));_0x5e636b='2';_0x23357c=_0xabe9('0x1e');break;case 0x9:logger['info'](_0xabe9('0x1f'));_0x5e636b='9';_0x23357c='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger['info']('Authentication\x20failed.');_0x5e636b='10';_0x23357c=_0xabe9('0x20');break;case 0xb:logger['info'](_0xabe9('0x21'));_0x5e636b='11';_0x23357c=_0xabe9('0x21');}}}catch(_0x24da62){logger[_0xabe9('0x14')](_0xabe9('0x22'),JSON[_0xabe9('0xe')](_0x24da62));_0x244ba8[_0xabe9('0x16')]();}}function _0x4f0350(){logger[_0xabe9('0xb')](_0xabe9('0x23'));_0x11b9e3({'transcript':_0x456272,'confidence':_0x50091d,'status':_0x5e636b,'status_message':_0x23357c});}function _0x3c2d55(_0x5c7efd){logger['error'](_0xabe9('0x24'));if(!_[_0xabe9('0x25')](_0x5c7efd)){logger[_0xabe9('0x14')](_['isObject'](_0x5c7efd)?JSON[_0xabe9('0xe')](_0x5c7efd):_0x5c7efd);}}_0x244ba8['on'](_0xabe9('0x26'),_0x31d5b2);_0x244ba8['on'](_0xabe9('0x27'),_0x325ca7);_0x244ba8['on']('close',_0x4f0350);_0x244ba8['on'](_0xabe9('0x14'),_0x3c2d55);});}; \ No newline at end of file +var _0x6fb0=['../../../../../../config/logger','exports','info','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','createReadStream','close','EOS','error','Tilde\x20ASR\x20send\x20error','parse','status','final','hypotheses','result','likelihood','terminate','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','bluebird','lodash','moment'];(function(_0x35b7d4,_0x5a5c43){var _0x4e8cee=function(_0x66859c){while(--_0x66859c){_0x35b7d4['push'](_0x35b7d4['shift']());}};_0x4e8cee(++_0x5a5c43);}(_0x6fb0,0x14a));var _0x06fb=function(_0x5c4d9c,_0x5ec9fc){_0x5c4d9c=_0x5c4d9c-0x0;var _0x473209=_0x6fb0[_0x5c4d9c];return _0x473209;};'use strict';var BPromise=require(_0x06fb('0x0'));var _=require(_0x06fb('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x06fb('0x2'));var crypto=require('crypto');var logger=require(_0x06fb('0x3'))('agi');module[_0x06fb('0x4')]=function(_0x1d8de1,_0x51467a,_0x530639,_0x303e06){return new BPromise(function(_0x3f9ee2,_0x35d5f0){logger[_0x06fb('0x5')]('Tilde\x20URI',_0x303e06||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x151da6=new WebSocket(_0x303e06||_0x06fb('0x6'),{'perMessageDeflate':![]});var _0x3812ae='';var _0x4b5cba='0';var _0x4e9484='1';var _0x23fa02=_0x06fb('0x7');function _0x2a2981(_0x45786c){var _0x15e9c9=crypto['createHash']('sha1');_0x15e9c9[_0x06fb('0x8')](_0x45786c);return _0x15e9c9[_0x06fb('0x9')](_0x06fb('0xa'));}function _0xfff200(){try{logger[_0x06fb('0x5')](_0x06fb('0xb'));var _0x220417=moment()[_0x06fb('0xc')]();var _0xdb802b=_0x2a2981(_0x220417+_0x51467a+_0x530639);_0x151da6[_0x06fb('0xd')](JSON[_0x06fb('0xe')]({'appID':_0x51467a,'timestamp':_0x220417,'appKey':_0xdb802b}));var _0x5876d6=fs[_0x06fb('0xf')](_0x1d8de1);_0x5876d6['on']('data',function(_0x503cda){_0x151da6[_0x06fb('0xd')](_0x503cda);});_0x5876d6['on'](_0x06fb('0x10'),function(){_0x151da6[_0x06fb('0xd')](_0x06fb('0x11'));});}catch(_0x23ecdb){logger[_0x06fb('0x12')](_0x06fb('0x13'),JSON[_0x06fb('0xe')](_0x23ecdb));_0x151da6['terminate']();}}function _0x4519ba(_0x49674c){try{if(_0x49674c){var _0x947a31=JSON[_0x06fb('0x14')](_0x49674c);switch(_0x947a31[_0x06fb('0x15')]){case 0x0:if(_0x947a31['result']){if(_0x947a31['result'][_0x06fb('0x16')]){logger[_0x06fb('0x5')]('Tilde\x20ASR\x20hypoteses',JSON[_0x06fb('0xe')](_0x947a31['result']['hypotheses']));_0x3812ae=_0x947a31['result'][_0x06fb('0x17')][0x0]['transcript'];_0x4b5cba=_0x947a31[_0x06fb('0x18')]['hypotheses'][0x0][_0x06fb('0x19')];_0x4e9484='0';_0x23fa02='Success.';_0x151da6[_0x06fb('0x1a')]();}}break;case 0x1:logger[_0x06fb('0x5')]('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x4e9484='1';_0x23fa02=_0x06fb('0x7');break;case 0x2:logger['info'](_0x06fb('0x1b'));_0x4e9484='2';_0x23fa02='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger[_0x06fb('0x5')](_0x06fb('0x1c'));_0x4e9484='9';_0x23fa02='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger['info'](_0x06fb('0x1d'));_0x4e9484='10';_0x23fa02=_0x06fb('0x1d');break;case 0xb:logger[_0x06fb('0x5')]('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0x4e9484='11';_0x23fa02=_0x06fb('0x1e');}}}catch(_0x44fdfb){logger['error'](_0x06fb('0x1f'),JSON['stringify'](_0x44fdfb));_0x151da6[_0x06fb('0x1a')]();}}function _0x13583b(){logger[_0x06fb('0x5')]('Close\x20Tilde\x20ASR\x20socket');_0x3f9ee2({'transcript':_0x3812ae,'confidence':_0x4b5cba,'status':_0x4e9484,'status_message':_0x23fa02});}function _0x2f32ff(_0x487e80){logger[_0x06fb('0x12')](_0x06fb('0x20'));if(!_[_0x06fb('0x21')](_0x487e80)){logger[_0x06fb('0x12')](_[_0x06fb('0x22')](_0x487e80)?JSON[_0x06fb('0xe')](_0x487e80):_0x487e80);}}_0x151da6['on'](_0x06fb('0x23'),_0xfff200);_0x151da6['on'](_0x06fb('0x24'),_0x4519ba);_0x151da6['on'](_0x06fb('0x10'),_0x13583b);_0x151da6['on'](_0x06fb('0x12'),_0x2f32ff);});}; \ 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 10cb4be..f0c3d6a 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 asr=require('./asr');module['exports']={'asr':asr}; \ No newline at end of file +var _0x0054=['./asr','exports'];(function(_0x510b8c,_0x1fa5ba){var _0x3749f3=function(_0x12c6dc){while(--_0x12c6dc){_0x510b8c['push'](_0x510b8c['shift']());}};_0x3749f3(++_0x1fa5ba);}(_0x0054,0x15a));var _0x4005=function(_0x343971,_0x4a2db7){_0x343971=_0x343971-0x0;var _0x2c902d=_0x0054[_0x343971];return _0x2c902d;};var asr=require(_0x4005('0x0'));module[_0x4005('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 980147e..a0d1c1c 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(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x9c44[_0x2d7f0e];return _0x110b07;};'use strict';var util=require('util');var net=require('net');var EventEmitter=require(_0x49c4('0x0'))[_0x49c4('0x1')];var AGIError=require(_0x49c4('0x2'));var AGIChannel=require(_0x49c4('0x3'));var AGIServer=function(_0x455700,_0x2ad237,_0x4e0313){var _0x4941f1=this;var _0x41a183=null;var _0x57effd=0x0;if(!_0x455700)_0x455700=0x11dd;if(!_0x2ad237)_0x2ad237=_0x49c4('0x4');EventEmitter[_0x49c4('0x5')](_0x4941f1);function _0x69bc41(){if(!_0x455700){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x41a183=net[_0x49c4('0x8')]();_0x41a183[_0x49c4('0x9')](_0x455700,_0x2ad237);_0x41a183['on'](_0x49c4('0xa'),function(){_0x4941f1[_0x49c4('0x6')]('listening');});_0x41a183['on']('connection',function(_0x451ea6){_0x41a183[_0x49c4('0xb')](function(_0x58cad7,_0xb611a1){if(_0x58cad7){_0x4941f1[_0x49c4('0x6')]('error',new AGIError('E_AGI_SERVER_ERROR',_0x58cad7));}else if(_0x4e0313&&_0x4e0313<0x0){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x451ea6[_0x49c4('0xc')]();}else if(_0x4e0313&&_0x4e0313>0x0&&_0x4e0313<_0xb611a1){_0x57effd+=0x1;_0x4941f1[_0x49c4('0x6')]('error',new AGIError(_0x49c4('0xd'),_0x57effd));_0x451ea6[_0x49c4('0xc')]();}else{var _0x21f15a=new AGIChannel(_0x451ea6);_0x21f15a['on'](_0x49c4('0xe'),function(){_0x4941f1[_0x49c4('0x6')](_0x49c4('0xf'),_0x21f15a);});}});});_0x41a183['on'](_0x49c4('0x7'),function(_0x3de397){_0x4941f1['emit'](_0x49c4('0x7'),new AGIError(_0x49c4('0x10'),_0x3de397[_0x49c4('0x11')]));});_0x41a183['on'](_0x49c4('0x12'),function(){_0x4941f1[_0x49c4('0x6')]('close',new AGIError(_0x49c4('0x13')));});}process[_0x49c4('0x14')](function(){_0x69bc41();});};util['inherits'](AGIServer,EventEmitter);module['exports']=function(_0x3c782d,_0x2f82d5,_0x3addb2){return new AGIServer(_0x3c782d,_0x2f82d5,_0x3addb2);}; \ No newline at end of file +var _0xa9e0=['ready','E_AGI_SERVER_ERROR','close','E_AGI_SERVER_CLOSE','inherits','exports','util','net','events','./channel','call','emit','createServer','listening','connection','getConnections','error','E_AGI_SERVER_VOICE_DISABLED','destroy'];(function(_0x1b7ea6,_0x195a62){var _0x4fcea6=function(_0x29ace1){while(--_0x29ace1){_0x1b7ea6['push'](_0x1b7ea6['shift']());}};_0x4fcea6(++_0x195a62);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'use strict';var util=require(_0x0a9e('0x0'));var net=require(_0x0a9e('0x1'));var EventEmitter=require(_0x0a9e('0x2'))['EventEmitter'];var AGIError=require('./error');var AGIChannel=require(_0x0a9e('0x3'));var AGIServer=function(_0x4ce2f1,_0x333808,_0x432180){var _0x2ab90b=this;var _0x991246=null;var _0x981158=0x0;if(!_0x4ce2f1)_0x4ce2f1=0x11dd;if(!_0x333808)_0x333808='127.0.0.1';EventEmitter[_0x0a9e('0x4')](_0x2ab90b);function _0x441e3a(){if(!_0x4ce2f1){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x991246=net[_0x0a9e('0x6')]();_0x991246['listen'](_0x4ce2f1,_0x333808);_0x991246['on']('listening',function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x7'));});_0x991246['on'](_0x0a9e('0x8'),function(_0x3ab53f){_0x991246[_0x0a9e('0x9')](function(_0xbd1168,_0x4a4c56){if(_0xbd1168){_0x2ab90b['emit']('error',new AGIError('E_AGI_SERVER_ERROR',_0xbd1168));}else if(_0x432180&&_0x432180<0x0){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError(_0x0a9e('0xb')));_0x3ab53f[_0x0a9e('0xc')]();}else if(_0x432180&&_0x432180>0x0&&_0x432180<_0x4a4c56){_0x981158+=0x1;_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x981158));_0x3ab53f[_0x0a9e('0xc')]();}else{var _0x239b12=new AGIChannel(_0x3ab53f);_0x239b12['on'](_0x0a9e('0xd'),function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x8'),_0x239b12);});}});});_0x991246['on'](_0x0a9e('0xa'),function(_0x52a03d){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError(_0x0a9e('0xe'),_0x52a03d['code']));});_0x991246['on'](_0x0a9e('0xf'),function(){_0x2ab90b[_0x0a9e('0x5')]('close',new AGIError(_0x0a9e('0x10')));});}process['nextTick'](function(){_0x441e3a();});};util[_0x0a9e('0x11')](AGIServer,EventEmitter);module[_0x0a9e('0x12')]=function(_0x106033,_0x205fd6,_0x31b1ca){return new AGIServer(_0x106033,_0x205fd6,_0x31b1ca);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index e56a326..52e8927 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 _0xb18e=['callback','Callback\x20scheduled\x20at\x20','toString','getPause','getPauseById','agent','agentUnpause','agentLogout','agentLogin','%s/%s@from-sip/n','trim','googleCloudTTS','google_cloud_tts_text_type','text','languageCode','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','method','timeout','number','POST','PUT','toUpperCase','body','parse','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','statusMessage','statusCode','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','dialogflowV2_project_id','client_email','private_key','ispeechTTS','ispeech_tts_language','en-US','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_secret_access_key','aws_polly_region','aws_polly_voice','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','includes','clone','hasOwnProperty','isString','replaceAllVariables','recursiveNodeIndex','length','saveRestApiResult','isPlainObject','%s.%s','isArray','setVariable','replaceObjectAllVariables','split','replaceAll','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','extra','maxRetry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','exec','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','minutes','callback_priority','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','MRCPSynth','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','Enter\x20in\x20DATABASE\x20(%s)\x20block','no\x20database\x20selected','odbc_id','no\x20query\x20configured','replace','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','SIP/%s','opts','Executed\x20command\x20%s','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','DIALOGFLOW_%s','speech','out','dialogflow','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20client_email\x20configured','Trying\x20DialogflowV2:\x20%s','googleDialogflowV2','providerResponse','DialogflowV2\x20Result\x20%s','sesteknda','ndauth_url','username','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','sestekNDA','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','unlink','.wav','SestekNDA\x20Result\x20%s','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','retry','file_id','no\x20file\x20audio\x20selected','getData','maxdigit','test','mindigit','hiddendigitsnum','generate','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','awspolly','aws_access_key_id','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','streamFile','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','intKey','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','appsecret','no\x20appsecret\x20configured','NOBEEP','recordFile','TILDE_ASR_%s','TildeASR\x20Result\x20%s','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','extension','Enter\x20in\x20GOTOIF\x20(%s)\x20block','no\x20condition\x20configured','condition','true','EVAL\x20CONDITION\x20%s\x20%s','false','no\x20interval\x20configured','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','Enter\x20in\x20HANGUP\x20(%s)\x20block','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','Trying\x20ispeech\x20TTS\x20%s','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','menu','Enter\x20in\x20MENU\x20(%s)\x20block','getSound','response','digit','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','agentPause','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','no\x20file\x20audio\x20found','PLAYBACK','queue','no\x20queue\x20selected','queue_id','no\x20queue\x20found','indexOf','XMCS-QUEUE','QUEUE','macro','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','%s_STATUS_CODE','200','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','account_id','getMailAccount','Smtp','no\x20mail\x20account\x20found','bcc','subject','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','sendFax','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','no\x20sms\x20account\x20configured','sms_account_id','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','subproject','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','host','127.0.0.1','AGI','shellCommand','command','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','apiKey','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','Google\x20TTS\x20is\x20unreachable','unpause','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','shelljs','randomstring','mustache','request-promise','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','getdigits','getsecretdigits','channel','rpc','mailRpc','prototype','getVariable','then','catch','getVoiceQueue','getSquareProjectById','name','getSquareOdbc','getSquareOdbcById','dsn','getUser','getUserById','getTrunk','getSoundById','getSoundPath','getMailAccountById','sendMailMessage','getIntervals','IntervalId','interval','map','Intervals','format','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','calleridname','context','priority','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','callback_','random','isNil','lastName','phone','list_id','scheduledAt'];(function(_0x45ceef,_0x202242){var _0x3ffcd2=function(_0x3b9c33){while(--_0x3b9c33){_0x45ceef['push'](_0x45ceef['shift']());}};_0x3ffcd2(++_0x202242);}(_0xb18e,0x181));var _0xeb18=function(_0xa990b7,_0x26c527){_0xa990b7=_0xa990b7-0x0;var _0x52c99c=_0xb18e[_0xa990b7];return _0x52c99c;};'use strict';var fs=require('fs');var util=require('util');var _=require('lodash');var sh=require(_0xeb18('0x0'));var odbc=require('odbc')();var rs=require(_0xeb18('0x1'));var moment=require('moment');var Mustache=require(_0xeb18('0x2'));var rp=require(_0xeb18('0x3'));var logger=require('../../config/logger')(_0xeb18('0x4'));var config=require(_0xeb18('0x5'));var scripts=require(_0xeb18('0x6'));var FILES_PATH=_0xeb18('0x7');var recursiveMapAttributes=[_0xeb18('0x8'),_0xeb18('0x9')];var verticesWithRetry=['menu',_0xeb18('0xa'),_0xeb18('0xb')];var AGIVertices=function(_0x534358,_0x979077,_0x17c70b){this[_0xeb18('0xc')]=_0x534358;this[_0xeb18('0xd')]=_0x979077;this[_0xeb18('0xe')]=_0x17c70b;};AGIVertices[_0xeb18('0xf')][_0xeb18('0x10')]=function(_0x41762b,_0x1c1aa2){this[_0xeb18('0xd')]['getVariableById'](_0x41762b)[_0xeb18('0x11')](function(_0xcf243f){_0x1c1aa2(null,_0xcf243f?_0xcf243f['name']:![]);})[_0xeb18('0x12')](function(_0x5399cc){_0x1c1aa2(_0x5399cc);});};AGIVertices['prototype'][_0xeb18('0x13')]=function(_0x27c190,_0x1d415a){this['rpc']['getVoiceQueueById'](_0x27c190)[_0xeb18('0x11')](function(_0x34a412){_0x1d415a(null,_0x34a412?_0x34a412['name']:![]);})[_0xeb18('0x12')](function(_0x1d7230){_0x1d415a(_0x1d7230);});};AGIVertices[_0xeb18('0xf')]['getSquareProject']=function(_0x314156,_0x1235b0){this[_0xeb18('0xd')][_0xeb18('0x14')](_0x314156)[_0xeb18('0x11')](function(_0x285400){_0x1235b0(null,_0x285400?_0x285400[_0xeb18('0x15')]:![]);})['catch'](function(_0x30f706){_0x1235b0(_0x30f706);});};AGIVertices['prototype'][_0xeb18('0x16')]=function(_0x3ceee5,_0x1ab144){this[_0xeb18('0xd')][_0xeb18('0x17')](_0x3ceee5)['then'](function(_0x399817){_0x1ab144(null,_0x399817?_0x399817[_0xeb18('0x18')]:![]);})[_0xeb18('0x12')](function(_0x3ab7e5){_0x1ab144(_0x3ab7e5);});};AGIVertices['prototype'][_0xeb18('0x19')]=function(_0x279c99,_0x22c7e4){this[_0xeb18('0xd')][_0xeb18('0x1a')](_0x279c99)[_0xeb18('0x11')](function(_0x145af1){_0x22c7e4(null,_0x145af1?_0x145af1[_0xeb18('0x15')]:![]);})[_0xeb18('0x12')](function(_0x7464fd){_0x22c7e4(_0x7464fd);});};AGIVertices[_0xeb18('0xf')][_0xeb18('0x1b')]=function(_0x584396,_0x23ae71){this['rpc']['getTrunkById'](_0x584396)[_0xeb18('0x11')](function(_0x42ae48){_0x23ae71(null,_0x42ae48?_0x42ae48[_0xeb18('0x15')]:![]);})[_0xeb18('0x12')](function(_0x361aaa){_0x23ae71(_0x361aaa);});};AGIVertices['prototype']['getSound']=function(_0x693669,_0x8dc2a4){var _0x3312d8=this;this['rpc'][_0xeb18('0x1c')](_0x693669)[_0xeb18('0x11')](function(_0x5d2f33){_0x8dc2a4(null,_0x5d2f33?_0x3312d8[_0xeb18('0x1d')](_0x5d2f33['save_name']):![]);})['catch'](function(_0x50c72f){_0x8dc2a4(_0x50c72f);});};AGIVertices['prototype']['getMailAccount']=function(_0x6e6c,_0x29a152){this[_0xeb18('0xd')][_0xeb18('0x1e')](_0x6e6c)[_0xeb18('0x11')](function(_0x8b7a1b){_0x29a152(null,_0x8b7a1b?_0x8b7a1b:![]);})['catch'](function(_0x4099cf){_0x29a152(_0x4099cf);});};AGIVertices[_0xeb18('0xf')][_0xeb18('0x1f')]=function(_0x1445ba,_0x37f568,_0x36b87b){this[_0xeb18('0xe')][_0xeb18('0x1f')](_0x1445ba,_0x37f568)['then'](function(){_0x36b87b(null);})[_0xeb18('0x12')](function(_0x340714){_0x36b87b(_0x340714);});};AGIVertices[_0xeb18('0xf')][_0xeb18('0x20')]=function(_0x199d50,_0x20e90f){this[_0xeb18('0xd')]['getIntervalById'](_0x199d50)[_0xeb18('0x11')](function(_0x58e92d){if(_0x58e92d){if(_0x58e92d[_0xeb18('0x21')]){_0x20e90f(null,[_0x58e92d[_0xeb18('0x22')]]);}else{_0x20e90f(null,_[_0xeb18('0x23')](_0x58e92d[_0xeb18('0x24')],'interval'));}}else{_0x20e90f(null,![]);}})[_0xeb18('0x12')](function(_0x26ad1d){_0x20e90f(_0x26ad1d);});};AGIVertices[_0xeb18('0xf')][_0xeb18('0x1d')]=function(_0x1d1701){return util[_0xeb18('0x25')]('%s/sounds/converted/%s',FILES_PATH,_0x1d1701);};AGIVertices[_0xeb18('0xf')][_0xeb18('0x26')]=function(_0x2037a3,_0x177ff4,_0x2c1473){odbc[_0xeb18('0x27')](_0x2037a3,function(_0x43cfc8){if(_0x43cfc8){logger[_0xeb18('0x28')](_0xeb18('0x29'),_0x43cfc8);_0x2c1473(_0x43cfc8);}else{logger[_0xeb18('0x2a')](_0xeb18('0x2b'));odbc[_0xeb18('0x2c')](_0x177ff4,function(_0x4b3fe9,_0x386297){if(_0x4b3fe9){logger[_0xeb18('0x2a')](_0xeb18('0x2d'),_0x177ff4);_0x2c1473(_0x4b3fe9);}else{logger[_0xeb18('0x2a')](_0xeb18('0x2e'),_0x177ff4);odbc['close'](function(_0x33bbda){if(_0x33bbda){logger[_0xeb18('0x28')](_0xeb18('0x2f'),_0x33bbda);}_0x2c1473(null,_0x386297);});}});}});};AGIVertices[_0xeb18('0xf')][_0xeb18('0x30')]=function(_0x517840,_0xdbe683){this['rpc'][_0xeb18('0x31')](_0x517840)[_0xeb18('0x11')](function(_0x3fc956){_0xdbe683(null,_0x3fc956?_0x3fc956:![]);})[_0xeb18('0x12')](function(_0x5efbf8){_0xdbe683(_0x5efbf8);});};AGIVertices['prototype'][_0xeb18('0x32')]=function(_0x3e2099,_0x205ad7){this['rpc']['createSmsMessage'](_0x3e2099)[_0xeb18('0x11')](function(_0x291f35){_0x205ad7(null,_0x291f35);})[_0xeb18('0x12')](function(_0x258a11){_0x205ad7(_0x258a11);});};AGIVertices[_0xeb18('0xf')]['createSquareDetailsReport']=function(_0x5189d3,_0x4a9a7b,_0x157ac7){this[_0xeb18('0xd')][_0xeb18('0x33')]({'uniqueid':this['channel'][_0xeb18('0x34')],'node':_0x5189d3[_0xeb18('0x35')],'application':_0x5189d3[_0xeb18('0x36')],'data':_0x4a9a7b||null,'project_name':this[_0xeb18('0xc')][_0xeb18('0x37')],'callerid':this[_0xeb18('0xc')][_0xeb18('0x38')]})['then'](function(_0xbe457d){if(_0x157ac7){_0x157ac7(null,_0xbe457d);}})[_0xeb18('0x12')](function(_0x8bdb39){if(_0x157ac7){_0x157ac7(_0x8bdb39);}});};AGIVertices[_0xeb18('0xf')][_0xeb18('0x39')]=function(_0x17d40d,_0x3fca3e,_0x4872fe,_0x2680c1){this[_0xeb18('0xd')][_0xeb18('0x39')]({'uniqueid':this[_0xeb18('0xc')][_0xeb18('0x34')],'callerid':this[_0xeb18('0xc')][_0xeb18('0x38')],'calleridname':this[_0xeb18('0xc')][_0xeb18('0x3a')],'context':this[_0xeb18('0xc')][_0xeb18('0x3b')],'extension':this['channel']['extension'],'priority':this[_0xeb18('0xc')][_0xeb18('0x3c')],'accountcode':this['channel'][_0xeb18('0x3d')],'dnid':this['channel'][_0xeb18('0x3e')],'projectName':this['channel'][_0xeb18('0x37')],'saveName':_0x3fca3e,'filename':_0x17d40d[_0xeb18('0x3f')]||_0x3fca3e,'savePath':_0x4872fe})['then'](function(_0x3d3b27){_0x2680c1(null,_0x3d3b27);})[_0xeb18('0x12')](function(_0x347b56){_0x2680c1(_0x347b56);});};AGIVertices[_0xeb18('0xf')][_0xeb18('0x40')]=function(_0x3fb691,_0x17fb52,_0x14c3ff,_0x4ade0f,_0x3d4474){this[_0xeb18('0xd')]['createSquareMessage']({'uniqueid':this[_0xeb18('0xc')][_0xeb18('0x34')],'body':_0x3fb691,'direction':_0x17fb52,'providerName':_0x14c3ff,'providerResponse':_0x4ade0f})[_0xeb18('0x11')](function(_0x4edb28){if(_0x3d4474){_0x3d4474(null,_0x4edb28);}})[_0xeb18('0x12')](function(_0x52673d){if(_0x3d4474){_0x3d4474(_0x52673d);}});};AGIVertices[_0xeb18('0xf')][_0xeb18('0x41')]=function(_0x4877f2,_0x2f462e){this[_0xeb18('0xd')][_0xeb18('0x41')]({'firstName':_[_0xeb18('0x42')](_0x4877f2[_0xeb18('0x15')])||_['isNil'](_0x4877f2['name'])?_0xeb18('0x43')+Math[_0xeb18('0x44')]():_0x4877f2['name'],'lastName':_[_0xeb18('0x42')](_0x4877f2['lastName'])||_[_0xeb18('0x45')](_0x4877f2['lastName'])?null:_0x4877f2[_0xeb18('0x46')],'phone':_0x4877f2[_0xeb18('0x47')],'ListId':_0x4877f2[_0xeb18('0x48')],'scheduledat':_0x4877f2[_0xeb18('0x49')],'callbackUniqueid':this[_0xeb18('0xc')][_0xeb18('0x34')],'tags':_0xeb18('0x4a'),'description':_0xeb18('0x4b')+_0x4877f2[_0xeb18('0x49')][_0xeb18('0x4c')](),'priority':_0x4877f2['callback_priority']})[_0xeb18('0x11')](function(_0x335bcc){_0x2f462e(null,_0x335bcc);})[_0xeb18('0x12')](function(_0x5f39af){_0x2f462e(_0x5f39af);});};AGIVertices['prototype'][_0xeb18('0x4d')]=function(_0x4bdd4c,_0x479a49){this[_0xeb18('0xd')][_0xeb18('0x4e')](_0x4bdd4c)['then'](function(_0x4482a8){_0x479a49(null,_0x4482a8?_0x4482a8['name']:![]);})[_0xeb18('0x12')](function(_0x3e4886){_0x479a49(_0x3e4886);});};AGIVertices[_0xeb18('0xf')]['agentPause']=function(_0x462f30,_0x550400,_0x24c427){var _0x577ca2={'role':_0xeb18('0x4f')};_0x577ca2[_0x462f30]=this[_0xeb18('0xc')]['callerid'];this[_0xeb18('0xd')]['agentPause'](_0x577ca2,_0x550400,this[_0xeb18('0xc')][_0xeb18('0x34')])[_0xeb18('0x11')](function(_0x423468){_0x24c427(null,_[_0xeb18('0x45')](_0x423468)?![]:!![]);})[_0xeb18('0x12')](function(_0x51cacf){logger['error'](_0x51cacf);_0x24c427(null,![]);});};AGIVertices[_0xeb18('0xf')]['agentUnpause']=function(_0x1a8754,_0x2e8dfc){var _0x102b3c={'role':_0xeb18('0x4f')};_0x102b3c[_0x1a8754]=this[_0xeb18('0xc')][_0xeb18('0x38')];this[_0xeb18('0xd')][_0xeb18('0x50')](_0x102b3c)['then'](function(_0x5c1454){_0x2e8dfc(null,_['isNil'](_0x5c1454)?![]:!![]);})[_0xeb18('0x12')](function(_0x34142d){logger[_0xeb18('0x28')](_0x34142d);_0x2e8dfc(null,![]);});};AGIVertices[_0xeb18('0xf')][_0xeb18('0x51')]=function(_0x47ac4d,_0x337241){var _0x4158df={'role':_0xeb18('0x4f')};_0x4158df[_0x47ac4d]=this['channel']['callerid'];this[_0xeb18('0xd')]['agentLogout'](_0x4158df)[_0xeb18('0x11')](function(_0x1ece13){_0x337241(null,_[_0xeb18('0x45')](_0x1ece13)?![]:!![]);})[_0xeb18('0x12')](function(_0x59b1fe){logger['error'](_0x59b1fe);_0x337241(null,![]);});};AGIVertices['prototype'][_0xeb18('0x52')]=function(_0x3f4778,_0x5f00eb){var _0x4b514e={'role':_0xeb18('0x4f')};_0x4b514e[_0x3f4778]=this['channel'][_0xeb18('0x38')];var _0x27b482=_0x3f4778!='internal'?util[_0xeb18('0x25')](_0xeb18('0x53'),'LOCAL',this[_0xeb18('0xc')][_0xeb18('0x38')]):undefined;this[_0xeb18('0xd')][_0xeb18('0x52')](_0x4b514e,_0x27b482)[_0xeb18('0x11')](function(_0x90059f){_0x5f00eb(null,_[_0xeb18('0x45')](_0x90059f)?![]:!![]);})[_0xeb18('0x12')](function(_0x412f23){logger[_0xeb18('0x28')](_0x412f23);_0x5f00eb(null,![]);});};AGIVertices[_0xeb18('0xf')]['shellCommand']=function(_0x4c42fb,_0x37d7ca){sh['exec'](_[_0xeb18('0x54')](_0x4c42fb),function(_0x3cb1ce,_0x267a1f){var _0x1804da=_0x267a1f['replace'](/(\r\n|\n|\r)/gm,'');_0x37d7ca(null,_0x1804da);});};AGIVertices[_0xeb18('0xf')][_0xeb18('0x55')]=function(_0x17d061,_0x37652c){scripts['googleCloudTTS'](_0x17d061['apiKey'],_0x17d061[_0xeb18('0x56')]||_0xeb18('0x57'),_0x17d061['text'],_0x17d061[_0xeb18('0x58')]||'en-US',_0x17d061[_0xeb18('0x59')]||_0xeb18('0x5a'),_0x17d061[_0xeb18('0x5b')]||_0xeb18('0x5c'))[_0xeb18('0x11')](function(_0x1c862d){_0x37652c(null,_0x1c862d);})[_0xeb18('0x12')](function(_0x4cc2c8){_0x37652c(_0x4cc2c8);});};AGIVertices[_0xeb18('0xf')][_0xeb18('0x5d')]=function(_0x5c0b52,_0xad0978){scripts[_0xeb18('0x5d')](_0x5c0b52['text'],_0x5c0b52[_0xeb18('0x5e')]||'en',0x1)['then'](function(_0x1d1827){_0xad0978(null,_0x1d1827);})[_0xeb18('0x12')](function(_0x2e8264){_0xad0978(_0x2e8264);});};AGIVertices[_0xeb18('0xf')][_0xeb18('0x5f')]=function(_0x2789c5,_0x1da422){var _0x42216b={'uri':_0x2789c5[_0xeb18('0x60')],'method':_0x2789c5[_0xeb18('0x61')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x2789c5[_0xeb18('0x62')])===_0xeb18('0x63')&&parseInt(_0x2789c5['timeout'])>=0x1?parseInt(_0x2789c5['timeout'])*0x3e8:0x5*0x3e8};if(_['includes']([_0xeb18('0x64'),_0xeb18('0x65')],_0x42216b[_0xeb18('0x61')][_0xeb18('0x66')]())){try{_0x42216b[_0xeb18('0x67')]=_0x2789c5[_0xeb18('0x9')]?JSON[_0xeb18('0x68')](_0x2789c5[_0xeb18('0x9')]):{};}catch(_0xa2d66c){logger[_0xeb18('0x28')]('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0xa2d66c);}}try{_0x42216b[_0xeb18('0x69')]=_0x2789c5[_0xeb18('0x8')]?JSON[_0xeb18('0x68')](_0x2789c5[_0xeb18('0x8')]):{};}catch(_0x1f5199){logger[_0xeb18('0x28')](_0xeb18('0x6a'),_0x1f5199);}if(_0x2789c5[_0xeb18('0x6b')]){try{var _0x47d9ce=require(_0x2789c5[_0xeb18('0x6b')])[_0xeb18('0x6c')](this,_0x42216b);_0x42216b[_0xeb18('0x6d')]=Mustache[_0xeb18('0x6e')](_0x2789c5['url'],_0x47d9ce,{},['$$','$$']);if(_0x42216b[_0xeb18('0x69')]){_0x42216b['headers']=JSON[_0xeb18('0x68')](Mustache[_0xeb18('0x6e')](JSON['stringify'](_0x42216b['headers']),_0x47d9ce,{},['$$','$$']));}if(_0x42216b['body']){_0x42216b[_0xeb18('0x67')]=JSON[_0xeb18('0x68')](Mustache[_0xeb18('0x6e')](JSON[_0xeb18('0x6f')](_0x42216b[_0xeb18('0x67')]),_0x47d9ce,{},['$$','$$']));}}catch(_0x3c9d45){logger[_0xeb18('0x28')](_0xeb18('0x70'),_0x3c9d45);}}rp(_0x42216b)[_0xeb18('0x11')](function(_0x205cd2){var _0x206688={'statusCode':_0x205cd2['statusCode']||0xc8,'statusMessage':_0x205cd2[_0xeb18('0x71')]||'OK','headers':_0x205cd2['headers']||{},'body':_0x205cd2[_0xeb18('0x67')]||{}};_0x1da422(null,_0x206688);})[_0xeb18('0x12')](function(_0x3f8a0c){var _0x3599b6={'statusCode':_0x3f8a0c[_0xeb18('0x72')]||0x1f4,'statusMessage':_0x3f8a0c[_0xeb18('0x73')]||_0xeb18('0x74'),'headers':_0x3f8a0c[_0xeb18('0x75')][_0xeb18('0x69')]||{},'body':_0x3f8a0c[_0xeb18('0x75')][_0xeb18('0x67')]||{}};_0x1da422(null,_0x3599b6);});};AGIVertices[_0xeb18('0xf')]['googleDialogflow']=function(_0x34dfa8,_0x55faa2){scripts[_0xeb18('0x76')](this[_0xeb18('0xc')][_0xeb18('0x34')],_0x34dfa8[_0xeb18('0x77')],_0x34dfa8[_0xeb18('0x57')],_0x34dfa8[_0xeb18('0x78')]||'en')[_0xeb18('0x11')](function(_0x1fa2c9){_0x55faa2(null,_0x1fa2c9);})[_0xeb18('0x12')](function(_0x1eb1b4){_0x55faa2(_0x1eb1b4);});};AGIVertices[_0xeb18('0xf')]['googleDialogflowV2']=function(_0x324604,_0x45c240){scripts['googleDialogflowV2'](this[_0xeb18('0xc')][_0xeb18('0x34')],_0x324604[_0xeb18('0x79')],_0x324604[_0xeb18('0x7a')],_0x324604[_0xeb18('0x7b')],_0x324604[_0xeb18('0x57')],_0x324604['dialogflowV2_language']||'en')[_0xeb18('0x11')](function(_0x6afad2){_0x45c240(null,_0x6afad2);})[_0xeb18('0x12')](function(_0x36fc5f){_0x45c240(_0x36fc5f);});};AGIVertices[_0xeb18('0xf')]['sestekNDA']=function(_0x2ae42e,_0x4eb214){scripts['sestekNDA'](this[_0xeb18('0xc')],_0x2ae42e)[_0xeb18('0x11')](function(_0x19c77a){_0x4eb214(null,_0x19c77a);})[_0xeb18('0x12')](function(_0x3b88e8){_0x4eb214(_0x3b88e8);});};AGIVertices[_0xeb18('0xf')][_0xeb18('0x7c')]=function(_0x193b79,_0xce7750){scripts[_0xeb18('0x7c')](_0x193b79[_0xeb18('0x77')],_0x193b79[_0xeb18('0x57')],_0x193b79[_0xeb18('0x7d')]||_0xeb18('0x7e'),_0x193b79[_0xeb18('0x7f')])[_0xeb18('0x11')](function(_0x4b2099){_0xce7750(null,_0x4b2099);})[_0xeb18('0x12')](function(_0x159fb8){_0xce7750(_0x159fb8);});};AGIVertices[_0xeb18('0xf')][_0xeb18('0x80')]=function(_0x1e30d2,_0x20a645,_0xcf8a5c){scripts[_0xeb18('0x80')](_0x20a645,_0x1e30d2[_0xeb18('0x77')],_0x1e30d2[_0xeb18('0x81')]||'en-US',this[_0xeb18('0x82')](_0x1e30d2[_0xeb18('0x83')])?_0x1e30d2[_0xeb18('0x83')]:undefined)[_0xeb18('0x11')](function(_0x1ffb5c){_0xcf8a5c(null,_0x1ffb5c);})['catch'](function(_0x5f3d62){_0xcf8a5c(_0x5f3d62);});};AGIVertices[_0xeb18('0xf')][_0xeb18('0x84')]=function(_0x262767,_0x462285){scripts['awsPolly'](_0x262767['aws_access_key_id'],_0x262767[_0xeb18('0x85')],_0x262767[_0xeb18('0x86')],_0x262767[_0xeb18('0x87')]||'Amy',_0x262767[_0xeb18('0x57')],_0x262767['aws_text_type']||_0xeb18('0x57'))[_0xeb18('0x11')](function(_0x1de983){_0x462285(null,_0x1de983);})[_0xeb18('0x12')](function(_0x3ef773){_0x462285(_0x3ef773);});};AGIVertices[_0xeb18('0xf')][_0xeb18('0x88')]=function(_0x2f7bf0,_0x38112c){scripts[_0xeb18('0x88')](this[_0xeb18('0xc')][_0xeb18('0x34')],_0x2f7bf0['aws_access_key_id'],_0x2f7bf0[_0xeb18('0x85')],_0x2f7bf0[_0xeb18('0x89')],_0x2f7bf0[_0xeb18('0x57')],_0x2f7bf0[_0xeb18('0x8a')])[_0xeb18('0x11')](function(_0x512d66){_0x38112c(null,_0x512d66);})[_0xeb18('0x12')](function(_0x1ced1a){_0x38112c(_0x1ced1a);});};AGIVertices[_0xeb18('0xf')][_0xeb18('0x8b')]=function(_0x9c5f12,_0x1a9833,_0xef333b){scripts[_0xeb18('0x8b')](_0x1a9833,_0x9c5f12[_0xeb18('0x77')],_0x9c5f12[_0xeb18('0x8c')]||_0xeb18('0x7e'))['then'](function(_0x447463){_0xef333b(null,_0x447463);})[_0xeb18('0x12')](function(_0xaabb41){_0xef333b(_0xaabb41);});};AGIVertices['prototype'][_0xeb18('0x8d')]=function(_0x3dd398,_0x340d2c,_0x3492b0){scripts[_0xeb18('0x8d')](_0x340d2c,_0x3dd398[_0xeb18('0x8e')],_0x3dd398['appsecret'],_0x3dd398['uri'])[_0xeb18('0x11')](function(_0xf36f22){_0x3492b0(null,_0xf36f22);})[_0xeb18('0x12')](function(_0x3ccbd1){_0x3492b0(_0x3ccbd1);});};AGIVertices[_0xeb18('0xf')]['clear']=function(_0x2f4d28){var _0x33e3f1=_[_0xeb18('0x8f')](verticesWithRetry,_0x2f4d28[_0xeb18('0x36')])?_0x2f4d28:_[_0xeb18('0x90')](_0x2f4d28);for(var _0x441bd2 in _0x33e3f1){if(_0x33e3f1[_0xeb18('0x91')](_0x441bd2)){if(_0x33e3f1[_0x441bd2]&&_[_0xeb18('0x92')](_0x33e3f1[_0x441bd2])){if(_[_0xeb18('0x8f')](recursiveMapAttributes,_0x441bd2)){_0x33e3f1[_0x441bd2]=this['replaceObjectAllVariables'](_0x33e3f1[_0x441bd2]);}else{_0x33e3f1[_0x441bd2]=this[_0xeb18('0x93')](_0x33e3f1[_0x441bd2]);}}}}return _0x33e3f1;};AGIVertices[_0xeb18('0xf')][_0xeb18('0x94')]=function(_0x3331cf){for(var _0x3c4c65 in _0x3331cf){if(_0x3331cf['hasOwnProperty'](_0x3c4c65)){if(_['isPlainObject'](_0x3331cf[_0x3c4c65])){this['recursiveNodeIndex'](_0x3331cf[_0x3c4c65]);}else if(_['isArray'](_0x3331cf[_0x3c4c65])){for(var _0x3b54e2=0x0;_0x3b54e2<_0x3331cf[_0x3c4c65][_0xeb18('0x95')];_0x3b54e2++){this[_0xeb18('0x94')](_0x3331cf[_0x3c4c65][_0x3b54e2]);}}else if(_[_0xeb18('0x92')](_0x3331cf[_0x3c4c65])){_0x3331cf[_0x3c4c65]=this[_0xeb18('0x93')](_0x3331cf[_0x3c4c65]);}}}};AGIVertices[_0xeb18('0xf')][_0xeb18('0x96')]=function(_0x57d926,_0x162bd2){for(var _0x36470a in _0x57d926){if(_0x57d926[_0xeb18('0x91')](_0x36470a)){if(_[_0xeb18('0x97')](_0x57d926[_0x36470a])){if(!_[_0xeb18('0x42')](_0x57d926[_0x36470a])){this[_0xeb18('0x96')](_0x57d926[_0x36470a],util[_0xeb18('0x25')](_0xeb18('0x98'),_0x162bd2,_0x36470a));}}else if(_[_0xeb18('0x99')](_0x57d926[_0x36470a])){for(var _0xb121f5=0x0;_0xb121f5<_0x57d926[_0x36470a][_0xeb18('0x95')];_0xb121f5++){this[_0xeb18('0x96')](_0x57d926[_0x36470a][_0xb121f5],util[_0xeb18('0x25')](_0xeb18('0x98'),_0x162bd2,_0x36470a+'['+_0xb121f5+']'));}}else{if(!_['isNil'](_0x57d926[_0x36470a])){this[_0xeb18('0xc')][_0xeb18('0x9a')](util[_0xeb18('0x25')](_0xeb18('0x98'),_0x162bd2,_0x36470a),_0x57d926[_0x36470a]);}}}}};AGIVertices['prototype'][_0xeb18('0x9b')]=function(_0x209960){try{var _0xa3c921=JSON['parse'](_0x209960);this['recursiveNodeIndex'](_0xa3c921);return JSON['stringify'](_0xa3c921);}catch(_0xd0097b){return this['replaceAllVariables'](_0x209960);}};AGIVertices[_0xeb18('0xf')][_0xeb18('0x93')]=function(_0x29bf9d){var _0x110b50=_0x29bf9d[_0xeb18('0x9c')]('{');for(var _0x4badd9=0x1;_0x4badd9<_0x110b50[_0xeb18('0x95')];_0x4badd9+=0x1){var _0x2886e0=_0x110b50[_0x4badd9][_0xeb18('0x9c')]('}');if(_0x2886e0[_0xeb18('0x95')]>0x1){_0x29bf9d=_0x29bf9d[_0xeb18('0x9d')]('{'+_0x2886e0[0x0]+'}',this['channel'][_0xeb18('0x10')](_0x2886e0[0x0])['extra']||_0x2886e0[0x0]);}}if(_0x110b50[_0xeb18('0x95')]===0x1){return _0x29bf9d[_0xeb18('0x4c')]();}return this[_0xeb18('0x93')](_0x29bf9d);};AGIVertices[_0xeb18('0xf')][_0xeb18('0x9e')]=function(_0x4cd847,_0x4e8921){var _0x30e975=this['channel'][_0xeb18('0x10')](_0x4cd847);if(_0x30e975[_0xeb18('0x9f')]===-0x1){return _0x30e975;}logger[_0xeb18('0x2a')](util[_0xeb18('0x25')](_0xeb18('0xa0'),_0x4e8921,_0x30e975[_0xeb18('0xa1')]));return this[_0xeb18('0xc')][_0xeb18('0x9a')](_0x4e8921,_0x30e975[_0xeb18('0xa1')]);};AGIVertices[_0xeb18('0xf')][_0xeb18('0x82')]=function(_0x1d42ea){return _0x1d42ea&&_0x1d42ea!=='0'&&_0x1d42ea!=='-1'&&_0x1d42ea!=='';};AGIVertices[_0xeb18('0xf')]['maxRetry']=function(_0x5523df){this['createSquareDetailsReport'][_0xeb18('0x6c')](this,_0x5523df,'-');_0x5523df['retry']=_0x5523df[_0xeb18('0xa2')];return{'code':0xc8,'result':'-'};};AGIVertices[_0xeb18('0xf')][_0xeb18('0xa3')]=function(_0xfc0a5a){logger[_0xeb18('0x2a')](util[_0xeb18('0x25')](_0xeb18('0xa4'),_0xfc0a5a[_0xeb18('0x35')]));if(!this['isConfigured'](_0xfc0a5a['text'])){return this[_0xeb18('0xc')][_0xeb18('0xa5')](_0xeb18('0xa6'));}var _0x1ea6d0='\x22'+_0xfc0a5a[_0xeb18('0x57')]+'\x22';if(this['isConfigured'](_0xfc0a5a[_0xeb18('0x75')])){_0x1ea6d0+=','+_0xfc0a5a[_0xeb18('0x75')];}var _0x533375=this[_0xeb18('0xc')][_0xeb18('0xa7')]('MRCPSynth',_0x1ea6d0);if(_0x533375[_0xeb18('0x9f')]===-0x1){return _0x533375;}return this['channel'][_0xeb18('0xa5')](util[_0xeb18('0x25')](_0xeb18('0xa8'),_0x1ea6d0));};AGIVertices[_0xeb18('0xf')][_0xeb18('0xa9')]=function(_0x5b0150){logger[_0xeb18('0x2a')](util[_0xeb18('0x25')](_0xeb18('0xaa'),_0x5b0150[_0xeb18('0x35')]));if(!this[_0xeb18('0x82')](_0x5b0150[_0xeb18('0xab')])){return this[_0xeb18('0xc')][_0xeb18('0xa5')](_0xeb18('0xac'));}var _0x4ae05f=_0x5b0150['grammar'];if(this[_0xeb18('0x82')](_0x5b0150[_0xeb18('0x75')])){_0x4ae05f+=','+_0x5b0150['options'];}var _0xd8c1f8=this[_0xeb18('0xc')][_0xeb18('0xa7')](_0xeb18('0xad'),_0x4ae05f);if(_0xd8c1f8[_0xeb18('0x9f')]===-0x1){return _0xd8c1f8;}var _0x52f0b7=this[_0xeb18('0x9e')](_0xeb18('0xae'),'MRCP_RECOG_CONFIDENCE');if(_0x52f0b7[_0xeb18('0x9f')]===-0x1){return _0x52f0b7;}var _0x172b54=this['getAndSetVariable'](_0xeb18('0xaf'),_0xeb18('0xb0'));if(_0x172b54[_0xeb18('0x9f')]===-0x1){return _0x172b54;}var _0x1daa82=this[_0xeb18('0x9e')]('RECOG_INSTANCE()',_0xeb18('0xb1'));if(_0x1daa82['result']===-0x1){return _0x1daa82;}return this[_0xeb18('0xc')][_0xeb18('0xa5')](util[_0xeb18('0x25')](_0xeb18('0xb2'),_0x4ae05f));};AGIVertices[_0xeb18('0xf')][_0xeb18('0x4')]=function(_0x560da6){logger['info'](util[_0xeb18('0x25')](_0xeb18('0xb3'),_0x560da6[_0xeb18('0x35')]));return this[_0xeb18('0xc')][_0xeb18('0x4')]([_0x560da6['command'],_0x560da6[_0xeb18('0xb4')]]);};AGIVertices[_0xeb18('0xf')][_0xeb18('0xb5')]=function(_0x474623){logger[_0xeb18('0x2a')](util[_0xeb18('0x25')](_0xeb18('0xb6'),_0x474623[_0xeb18('0x35')]));if(this[_0xeb18('0x82')](_0x474623[_0xeb18('0x62')])){logger[_0xeb18('0x2a')](util[_0xeb18('0x25')](_0xeb18('0xb7'),_0x474623['timeout']));var _0x14019d=this[_0xeb18('0xc')][_0xeb18('0xb8')](_0x474623[_0xeb18('0x62')]);if(_0x14019d[_0xeb18('0x9f')]===-0x1){return _0x14019d;}}return this[_0xeb18('0xc')][_0xeb18('0xb5')]();};AGIVertices[_0xeb18('0xf')][_0xeb18('0x4a')]=function(_0x165c9b){logger['info'](util[_0xeb18('0x25')](_0xeb18('0xb9'),_0x165c9b['label']));if(!this[_0xeb18('0x82')](_0x165c9b[_0xeb18('0x48')])){return this[_0xeb18('0xc')]['error'](_0x165c9b,_0xeb18('0xba'));}_0x165c9b['scheduledAt']=moment();if(this[_0xeb18('0x82')](_0x165c9b[_0xeb18('0xbb')])){_0x165c9b[_0xeb18('0x49')]=moment()['add'](_0x165c9b[_0xeb18('0xbb')],_0xeb18('0xbc'));}if(!this[_0xeb18('0x82')](_0x165c9b['callback_priority'])){_0x165c9b[_0xeb18('0xbd')]=0x2;}this[_0xeb18('0x41')][_0xeb18('0x6c')](this,_0x165c9b);return this['channel'][_0xeb18('0xa5')](util[_0xeb18('0x25')](_0xeb18('0xbe'),_0x165c9b[_0xeb18('0x47')],_0x165c9b[_0xeb18('0x48')],_0x165c9b[_0xeb18('0x49')]));};AGIVertices['prototype'][_0xeb18('0xbf')]=function(_0x109d89){logger['info'](util['format'](_0xeb18('0xc0'),_0x109d89[_0xeb18('0x35')]));var _0x5d0dc2=this[_0xeb18('0xc')][_0xeb18('0xa7')](_0x109d89[_0xeb18('0xc1')],_0x109d89[_0xeb18('0x75')]);if(_0x5d0dc2['result']===-0x1){return _0x5d0dc2;}return this[_0xeb18('0xc')][_0xeb18('0xa5')](util[_0xeb18('0x25')](_0xeb18('0xc2'),_0x109d89['application'],_0x109d89[_0xeb18('0x75')]));};AGIVertices[_0xeb18('0xf')][_0xeb18('0xc3')]=function(_0x5ca1e4){logger[_0xeb18('0x2a')](util[_0xeb18('0x25')](_0xeb18('0xc4'),_0x5ca1e4[_0xeb18('0x35')]));if(!this[_0xeb18('0x82')](_0x5ca1e4[_0xeb18('0x57')])){return this['channel'][_0xeb18('0xa5')](_0xeb18('0xa6'));}var _0x1e0f30='\x22'+_0x5ca1e4[_0xeb18('0x57')]+'\x22';if(this[_0xeb18('0x82')](_0x5ca1e4['options'])){_0x1e0f30+=','+_0x5ca1e4[_0xeb18('0x75')];}var _0x1a0bcc=this[_0xeb18('0xc')]['exec'](_0xeb18('0xc5'),_0x1e0f30);if(_0x1a0bcc['result']===-0x1){return _0x1a0bcc;}return this[_0xeb18('0xc')]['noop'](util['format'](_0xeb18('0xa8'),_0x1e0f30));};AGIVertices[_0xeb18('0xf')][_0xeb18('0xc6')]=function(_0x53ed70){logger[_0xeb18('0x2a')](util['format'](_0xeb18('0xc7'),_0x53ed70[_0xeb18('0x35')]));if(!this[_0xeb18('0x82')](_0x53ed70[_0xeb18('0x57')])){return this[_0xeb18('0xc')][_0xeb18('0xa5')]('no\x20text\x20configured');}var _0x281f74='\x22'+_0x53ed70['text']+'\x22';if(this[_0xeb18('0x82')](_0x53ed70['options'])){_0x281f74+=','+_0x53ed70[_0xeb18('0x75')];}var _0x2a3d63=this[_0xeb18('0xc')]['exec'](_0xeb18('0xc5'),_0x281f74);if(_0x2a3d63[_0xeb18('0x9f')]===-0x1){return _0x2a3d63;}return this[_0xeb18('0xc')]['noop'](util[_0xeb18('0x25')]('Executed\x20command\x20MRCPSynth\x20%s',_0x281f74));};AGIVertices[_0xeb18('0xf')][_0xeb18('0xc8')]=function(_0x46b703){logger[_0xeb18('0x2a')](util['format']('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x46b703['label']));if(!this[_0xeb18('0x82')](_0x46b703[_0xeb18('0xab')])){return this[_0xeb18('0xc')][_0xeb18('0xa5')](_0xeb18('0xac'));}var _0x11436e=_0x46b703[_0xeb18('0xab')];if(this['isConfigured'](_0x46b703[_0xeb18('0x75')])){_0x11436e+=','+_0x46b703['options'];}var _0x201d81=this[_0xeb18('0xc')][_0xeb18('0xa7')](_0xeb18('0xad'),_0x11436e);if(_0x201d81['result']===-0x1){return _0x201d81;}var _0x36794f=this[_0xeb18('0x9e')](_0xeb18('0xae'),_0xeb18('0xc9'));if(_0x36794f[_0xeb18('0x9f')]===-0x1){return _0x36794f;}var _0x180deb=this[_0xeb18('0x9e')](_0xeb18('0xaf'),_0xeb18('0xca'));if(_0x180deb['result']===-0x1){return _0x180deb;}var _0x1908af=this[_0xeb18('0x9e')](_0xeb18('0xcb'),_0xeb18('0xcc'));if(_0x1908af[_0xeb18('0x9f')]===-0x1){return _0x1908af;}return this[_0xeb18('0xc')][_0xeb18('0xa5')](util['format'](_0xeb18('0xb2'),_0x11436e));};AGIVertices[_0xeb18('0xf')]['sestekasr']=function(_0x108e69){logger[_0xeb18('0x2a')](util[_0xeb18('0x25')](_0xeb18('0xcd'),_0x108e69['label']));if(!this[_0xeb18('0x82')](_0x108e69[_0xeb18('0xab')])){return this['channel']['noop'](_0xeb18('0xac'));}var _0x1b6c10=_0x108e69[_0xeb18('0xab')];if(this[_0xeb18('0x82')](_0x108e69[_0xeb18('0x75')])){_0x1b6c10+=','+_0x108e69[_0xeb18('0x75')];}var _0x53df34=this['channel'][_0xeb18('0xa7')]('MRCPRecog',_0x1b6c10);if(_0x53df34['result']===-0x1){return _0x53df34;}var _0x2e44c3=this[_0xeb18('0x9e')](_0xeb18('0xae'),_0xeb18('0xce'));if(_0x2e44c3['result']===-0x1){return _0x2e44c3;}var _0x4e2cbe=this[_0xeb18('0x9e')]('RECOG_INPUT()',_0xeb18('0xcf'));if(_0x4e2cbe[_0xeb18('0x9f')]===-0x1){return _0x4e2cbe;}var _0x219138=this['getAndSetVariable']('RECOG_INSTANCE()',_0xeb18('0xd0'));if(_0x219138[_0xeb18('0x9f')]===-0x1){return _0x219138;}return this['channel'][_0xeb18('0xa5')](util[_0xeb18('0x25')]('Executed\x20command\x20MRCPRecog\x20%s',_0x1b6c10));};AGIVertices[_0xeb18('0xf')]['database']=function(_0x5709d2){logger['info'](util[_0xeb18('0x25')](_0xeb18('0xd1'),_0x5709d2[_0xeb18('0x35')]));if(!this[_0xeb18('0x82')](_0x5709d2['odbc_id'])){return this[_0xeb18('0xc')][_0xeb18('0x28')](_0x5709d2,_0xeb18('0xd2'));}var _0x1b6598=this[_0xeb18('0x16')][_0xeb18('0x6c')](this,_0x5709d2[_0xeb18('0xd3')]);if(!_0x1b6598){return this[_0xeb18('0xc')][_0xeb18('0x28')](_0x5709d2,'no\x20odbc\x20database\x20found');}if(!this[_0xeb18('0x82')](_0x5709d2[_0xeb18('0x2c')])){return this['channel'][_0xeb18('0x28')](_0x5709d2,_0xeb18('0xd4'));}var _0x15fa08=_0x5709d2['query'][_0xeb18('0xd5')](/(\r\n|\n|\r)/gm,'\x20');this[_0xeb18('0xc')][_0xeb18('0xa5')](util[_0xeb18('0x25')]('query:\x20%s',_0x15fa08));var _0x5aa1db=this[_0xeb18('0x26')][_0xeb18('0x6c')](this,_0x1b6598,_0x15fa08);this[_0xeb18('0x33')][_0xeb18('0x6c')](this,_0x5709d2,_0x15fa08);if(!this[_0xeb18('0x82')](_0x5709d2[_0xeb18('0xd6')])){return this[_0xeb18('0xc')][_0xeb18('0xa5')](_0xeb18('0xd7'));}var _0x8aa624=this['getVariable'][_0xeb18('0x6c')](this,_0x5709d2['variable_id']);if(!_0x8aa624){return this['channel'][_0xeb18('0x28')](_0x5709d2,_0xeb18('0xd8'));}var _0xcab3c1=this;_0x5aa1db[_0xeb18('0xd9')](function(_0x201d67,_0x1ddfd7){Object['keys'](_0x201d67)[_0xeb18('0xd9')](function(_0x147545){_0xcab3c1[_0xeb18('0xc')][_0xeb18('0x9a')](util['format'](_0xeb18('0xda'),_0x8aa624,_0x1ddfd7,_0x147545),_0x201d67[_0x147545]);});});this[_0xeb18('0xc')][_0xeb18('0x9a')](util[_0xeb18('0x25')](_0xeb18('0xdb'),_0x8aa624),_0x5aa1db[_0xeb18('0x95')]);return this['channel'][_0xeb18('0xa5')](util['format'](_0xeb18('0xdc'),_0x8aa624));};AGIVertices['prototype'][_0xeb18('0xdd')]=function(_0x53f865){logger[_0xeb18('0xde')](util[_0xeb18('0x25')]('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x53f865[_0xeb18('0x35')]));if(!this[_0xeb18('0x82')](_0x53f865[_0xeb18('0xdf')])){return this[_0xeb18('0xc')][_0xeb18('0x28')](_0x53f865,_0xeb18('0xe0'));}var _0x469b11=this[_0xeb18('0x19')][_0xeb18('0x6c')](this,_0x53f865[_0xeb18('0xdf')]);if(!_0x469b11){return this[_0xeb18('0xc')][_0xeb18('0x28')](_0x53f865,_0xeb18('0xe1'));}var _0x36de97=this[_0xeb18('0xc')][_0xeb18('0xa7')](_0xeb18('0xe2'),[util[_0xeb18('0x25')](_0xeb18('0xe3'),_0x469b11),_0x53f865['timeout'],_0x53f865[_0xeb18('0xe4')],_0x53f865[_0xeb18('0x60')]]);if(_0x36de97[_0xeb18('0x9f')]===-0x1){return _0x36de97;}return this['channel'][_0xeb18('0xa5')](util['format'](_0xeb18('0xe5'),'DIAL'));};AGIVertices[_0xeb18('0xf')]['dialogflow']=function(_0x4d4e3f){logger[_0xeb18('0x2a')](util[_0xeb18('0x25')](_0xeb18('0xe6'),_0x4d4e3f[_0xeb18('0x35')]));if(!this['isConfigured'](_0x4d4e3f['key'])){return this[_0xeb18('0xc')][_0xeb18('0xa5')](_0xeb18('0xe7'));}if(!this['isConfigured'](_0x4d4e3f['text'])){return this[_0xeb18('0xc')][_0xeb18('0xa5')](_0xeb18('0xa6'));}this[_0xeb18('0xc')][_0xeb18('0xe8')]=!![];this[_0xeb18('0x33')](_0x4d4e3f);this[_0xeb18('0x40')](_0x4d4e3f[_0xeb18('0x57')],'in','','');this[_0xeb18('0xc')][_0xeb18('0xa5')](util['format']('Trying\x20Dialogflow:\x20%s',_0x4d4e3f[_0xeb18('0x57')]));var _0x28088f=this[_0xeb18('0x76')][_0xeb18('0x6c')](this,_0x4d4e3f);if(_0x28088f){for(var _0x439180 in _0x28088f){if(_0x28088f[_0xeb18('0x91')](_0x439180)){this[_0xeb18('0xc')]['setVariable'](util['format'](_0xeb18('0xe9'),_0x439180[_0xeb18('0x66')]()),_0x28088f[_0x439180]);}}this['createSquareMessage'](_0x28088f[_0xeb18('0xea')],_0xeb18('0xeb'),_0xeb18('0xec'),'');return this['channel']['noop'](util[_0xeb18('0x25')](_0xeb18('0xed'),_0x28088f[_0xeb18('0xea')]));}return this[_0xeb18('0xc')]['error'](_0x4d4e3f,_0xeb18('0xee'));};AGIVertices[_0xeb18('0xf')][_0xeb18('0xef')]=function(_0x59011a){logger['info'](util[_0xeb18('0x25')](_0xeb18('0xf0'),_0x59011a[_0xeb18('0x35')]));if(!this['isConfigured'](_0x59011a['dialogflowV2_project_id'])){return this[_0xeb18('0xc')][_0xeb18('0xa5')]('no\x20project_id\x20configured');}if(!this[_0xeb18('0x82')](_0x59011a[_0xeb18('0x7a')])){return this['channel']['noop'](_0xeb18('0xf1'));}if(!this[_0xeb18('0x82')](_0x59011a[_0xeb18('0x7b')])){return this[_0xeb18('0xc')][_0xeb18('0xa5')]('no\x20private_key\x20configured');}if(!this[_0xeb18('0x82')](_0x59011a['dialogflowV2_language'])){return this[_0xeb18('0xc')][_0xeb18('0xa5')]('no\x20anguage\x20configured');}if(!this[_0xeb18('0x82')](_0x59011a[_0xeb18('0x57')])){return this['channel']['noop']('no\x20text\x20configured');}this[_0xeb18('0xc')][_0xeb18('0xe8')]=!![];this[_0xeb18('0x33')](_0x59011a);this[_0xeb18('0x40')](_0x59011a[_0xeb18('0x57')],'in','','');this[_0xeb18('0xc')]['noop'](util[_0xeb18('0x25')](_0xeb18('0xf2'),_0x59011a[_0xeb18('0x57')]));var _0x3ba7aa=this[_0xeb18('0xf3')][_0xeb18('0x6c')](this,_0x59011a);if(_0x3ba7aa){for(var _0x2b9e54 in _0x3ba7aa){if(_0x3ba7aa['hasOwnProperty'](_0x2b9e54)){if(_0x2b9e54!==_0xeb18('0xf4')){this[_0xeb18('0xc')]['setVariable'](util[_0xeb18('0x25')](_0xeb18('0xe9'),_0x2b9e54[_0xeb18('0x66')]()),_0x3ba7aa[_0x2b9e54]);}}}this[_0xeb18('0x40')](_0x3ba7aa[_0xeb18('0xea')],'out',_0xeb18('0xef'),_0x3ba7aa['providerResponse']);return this[_0xeb18('0xc')]['noop'](util[_0xeb18('0x25')](_0xeb18('0xf5'),_0x3ba7aa[_0xeb18('0xea')]));}return this[_0xeb18('0xc')][_0xeb18('0x28')](_0x59011a,'DialogflowV2\x20is\x20unreachable');};AGIVertices[_0xeb18('0xf')][_0xeb18('0xf6')]=function(_0xb045b7){logger[_0xeb18('0x2a')](util[_0xeb18('0x25')]('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0xb045b7['label']));if(!this[_0xeb18('0x82')](_0xb045b7[_0xeb18('0xf7')])){return this[_0xeb18('0xc')][_0xeb18('0xa5')]('no\x20ndauth\x20url\x20configured');}if(!this[_0xeb18('0x82')](_0xb045b7[_0xeb18('0xf8')])){return this['channel'][_0xeb18('0xa5')](_0xeb18('0xf9'));}if(!this['isConfigured'](_0xb045b7[_0xeb18('0xfa')])){return this[_0xeb18('0xc')]['noop'](_0xeb18('0xfb'));}if(!this[_0xeb18('0x82')](_0xb045b7[_0xeb18('0xfc')])){return this[_0xeb18('0xc')][_0xeb18('0xa5')](_0xeb18('0xa6'));}this[_0xeb18('0xc')]['bot']=!![];this[_0xeb18('0x33')](_0xb045b7);this[_0xeb18('0x40')](_0xb045b7[_0xeb18('0x57')],'in','','');this[_0xeb18('0xc')][_0xeb18('0xa5')](util['format'](_0xeb18('0xfd'),_0xb045b7[_0xeb18('0x57')]));var _0x1826e3=this[_0xeb18('0xfe')][_0xeb18('0x6c')](this,_0xb045b7);if(_0x1826e3){for(var _0x3cc3c9 in _0x1826e3){if(_0x1826e3[_0xeb18('0x91')](_0x3cc3c9)){this['channel'][_0xeb18('0x9a')](util[_0xeb18('0x25')](_0xeb18('0xff'),_0x3cc3c9[_0xeb18('0x66')]()),_0x1826e3[_0x3cc3c9]);}}this[_0xeb18('0x40')](_0x1826e3[_0xeb18('0xea')],_0xeb18('0xeb'),_0xeb18('0xf6'),'');if(_0x1826e3[_0xeb18('0x100')]){this[_0xeb18('0xc')]['noop'](util['format'](_0xeb18('0x101'),_0x1826e3[_0xeb18('0x100')]));var _0x498991=this[_0xeb18('0xc')]['streamFile'](_0x1826e3[_0xeb18('0x100')]);try{fs[_0xeb18('0x102')](_0x1826e3['audiofile']+_0xeb18('0x103'));}catch(_0x513369){logger[_0xeb18('0x28')](_0x513369);}return _0x498991;}else{return this[_0xeb18('0xc')][_0xeb18('0xa5')](util[_0xeb18('0x25')](_0xeb18('0x104'),_0x1826e3[_0xeb18('0xea')]));}}return this[_0xeb18('0xc')][_0xeb18('0x28')](_0xb045b7,'SestekNDA\x20is\x20unreachable');};AGIVertices['prototype'][_0xeb18('0x105')]=function(_0x315cd9){logger[_0xeb18('0x2a')](util['format'](_0xeb18('0x106'),_0x315cd9['label']));return this[_0xeb18('0xc')]['noop'](_0xeb18('0x105'));};AGIVertices['prototype'][_0xeb18('0x107')]=function(_0x3e7afa){logger[_0xeb18('0x2a')](util[_0xeb18('0x25')](_0xeb18('0x108'),_0x3e7afa['label']));var _0x4fc82b='';if(_0x3e7afa['trunk_id']){if(!this[_0xeb18('0x82')](_0x3e7afa[_0xeb18('0x109')])){return this['channel'][_0xeb18('0x28')](_0x3e7afa,_0xeb18('0x10a'));}else{var _0x14582a=parseInt(_0x3e7afa[_0xeb18('0x109')],0xa);if(isNaN(_0x14582a)){_0x4fc82b=_0x3e7afa[_0xeb18('0x109')];}else{_0x4fc82b=this['getTrunk'][_0xeb18('0x6c')](this,_0x3e7afa[_0xeb18('0x109')]);if(!_0x4fc82b){return this[_0xeb18('0xc')][_0xeb18('0x28')](_0x3e7afa,_0xeb18('0x10b'));}}}}else if(_0x3e7afa[_0xeb18('0x10c')]){_0x4fc82b=_0x3e7afa['trunk_name'];}else{return this[_0xeb18('0xc')][_0xeb18('0x28')](_0x3e7afa,_0xeb18('0x10a'));}var _0x8e73ec=this[_0xeb18('0xc')][_0xeb18('0xa7')](_0xeb18('0xe2'),[util['format'](_0xeb18('0x10d'),_0x4fc82b,_0x3e7afa['phone']),_0x3e7afa[_0xeb18('0x62')],_0x3e7afa[_0xeb18('0xe4')],_0x3e7afa[_0xeb18('0x60')]]);if(_0x8e73ec[_0xeb18('0x9f')]===-0x1){return _0x8e73ec;}return this['channel'][_0xeb18('0xa5')](util['format'](_0xeb18('0xe5'),_0xeb18('0xe2')));};AGIVertices[_0xeb18('0xf')][_0xeb18('0x10e')]=function(_0x3ef8a4){logger[_0xeb18('0x2a')](util[_0xeb18('0x25')](_0xeb18('0x10f'),_0x3ef8a4[_0xeb18('0x35')]));return this[_0xeb18('0xc')][_0xeb18('0xa5')](_0xeb18('0x10e'));};AGIVertices['prototype'][_0xeb18('0xa')]=function(_0x270c5e){logger['info'](util[_0xeb18('0x25')](_0xeb18('0x110'),_0x270c5e[_0xeb18('0x35')]));if(_0x270c5e['retry']===0x0){return this[_0xeb18('0xa2')](_0x270c5e);}_0x270c5e[_0xeb18('0x111')]-=0x1;if(!this[_0xeb18('0x82')](_0x270c5e[_0xeb18('0x112')])){return this[_0xeb18('0xc')][_0xeb18('0x28')](_0x270c5e,_0xeb18('0x113'));}var _0x33db87=this['getSound'][_0xeb18('0x6c')](this,_0x270c5e[_0xeb18('0x112')]);if(!_0x33db87){return this['channel'][_0xeb18('0x28')](_0x270c5e,'no\x20file\x20audio\x20found');}if(!this['isConfigured'](_0x270c5e[_0xeb18('0xd6')])){return this[_0xeb18('0xc')][_0xeb18('0x28')](_0xeb18('0xd7'));}var _0x4c8b5e=this[_0xeb18('0xc')][_0xeb18('0x114')](_0x33db87,_0x270c5e['response'],_0x270c5e[_0xeb18('0x115')]);var _0x587c92=_0x4c8b5e[_0xeb18('0x9f')]?_0x4c8b5e[_0xeb18('0x9f')]['toString']():'';logger[_0xeb18('0x2a')](_0xeb18('0x116'),JSON[_0xeb18('0x6f')](_0x4c8b5e));if(_0x4c8b5e[_0xeb18('0x9f')]===-0x1){this[_0xeb18('0x33')]['sync'](this,_0x270c5e,_0x587c92);return _0x4c8b5e;}else if(_0x4c8b5e['extra']===_0xeb18('0x62')){_0x4c8b5e[_0xeb18('0x9f')]=_0x587c92['length']>=parseInt(_0x270c5e[_0xeb18('0x117')])?'x':'i';}else{_0x4c8b5e[_0xeb18('0x9f')]=_0x587c92[_0xeb18('0x95')]>=parseInt(_0x270c5e[_0xeb18('0x117')])&&_0x587c92[_0xeb18('0x95')]<=parseInt(_0x270c5e[_0xeb18('0x115')])?'x':'i';}var _0x2c4591=this[_0xeb18('0x10')]['sync'](this,_0x270c5e['variable_id']);if(!_0x2c4591){return this[_0xeb18('0xc')]['error'](_0x270c5e,'no\x20variable\x20found');}this[_0xeb18('0xc')][_0xeb18('0x9a')](_0x2c4591,_0x587c92);if(this[_0xeb18('0x82')](_0x270c5e[_0xeb18('0x118')])){var _0x2944fd=parseInt(_0x270c5e[_0xeb18('0x118')],0xa);var _0x324dfd=rs[_0xeb18('0x119')]({'charset':'*','length':_0x2944fd});var _0x5b43ab=_0x587c92[_0xeb18('0x95')];if(_0x5b43ab>0x0){if(_0x5b43ab>_0x2944fd){this[_0xeb18('0x33')][_0xeb18('0x6c')](this,_0x270c5e,_0x270c5e['hiddendigitspos']===_0xeb18('0x11a')?_0x324dfd+_0x587c92[_0xeb18('0x11b')](_0x2944fd):_0x587c92['substr'](0x0,_0x5b43ab-_0x2944fd)+_0x324dfd);}else{this[_0xeb18('0x33')][_0xeb18('0x6c')](this,_0x270c5e,rs['generate']({'charset':'*','length':_0x5b43ab}));}}else{this[_0xeb18('0x33')][_0xeb18('0x6c')](this,_0x270c5e,'');}}else{this[_0xeb18('0x33')][_0xeb18('0x6c')](this,_0x270c5e,_0x587c92);}return _0x4c8b5e;};AGIVertices[_0xeb18('0xf')]['getsecretdigits']=function(_0xbe5899){logger[_0xeb18('0x2a')](util[_0xeb18('0x25')](_0xeb18('0x11c'),_0xbe5899[_0xeb18('0x35')]));return this[_0xeb18('0xa')](_0xbe5899);};AGIVertices['prototype'][_0xeb18('0x11d')]=function(_0x33ff0a){logger['info'](util[_0xeb18('0x25')](_0xeb18('0x11e'),_0x33ff0a['label']));this['createSquareDetailsReport'][_0xeb18('0x6c')](this,_0x33ff0a,_0x33ff0a[_0xeb18('0x11f')]);return this[_0xeb18('0xc')][_0xeb18('0xa5')](util['format']('GOAL\x20%s',_0x33ff0a[_0xeb18('0x11f')]));};AGIVertices[_0xeb18('0xf')][_0xeb18('0x120')]=function(_0x1ec1f0){logger[_0xeb18('0x2a')](util['format']('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x1ec1f0['label']));if(!this[_0xeb18('0x82')](_0x1ec1f0[_0xeb18('0x121')])||!this['isConfigured'](_0x1ec1f0[_0xeb18('0x85')])){return this['channel'][_0xeb18('0xa5')](_0xeb18('0x122'));}if(!this[_0xeb18('0x82')](_0x1ec1f0[_0xeb18('0x57')])){return this[_0xeb18('0xc')][_0xeb18('0xa5')](_0xeb18('0xa6'));}this['channel']['noop'](util[_0xeb18('0x25')](_0xeb18('0x123'),_0x1ec1f0['text']));var _0x3222ca=this[_0xeb18('0x84')]['sync'](this,_0x1ec1f0);if(_0x3222ca){this['channel'][_0xeb18('0xa5')](util[_0xeb18('0x25')](_0xeb18('0x124'),_0x3222ca));var _0x3b39cf=this['channel'][_0xeb18('0x125')](_0x3222ca);try{fs['unlink'](_0x3222ca+'.wav');}catch(_0x5c497c){logger[_0xeb18('0x28')](_0x5c497c);}return _0x3b39cf;}return this['channel'][_0xeb18('0x28')](_0x1ec1f0,'aws\x20Polly\x20is\x20unreachable');};AGIVertices[_0xeb18('0xf')][_0xeb18('0x126')]=function(_0x358f77){logger['info'](util[_0xeb18('0x25')](_0xeb18('0x127'),_0x358f77[_0xeb18('0x35')]));if(!this['isConfigured'](_0x358f77[_0xeb18('0x121')])||!this[_0xeb18('0x82')](_0x358f77[_0xeb18('0x85')])){return this[_0xeb18('0xc')]['noop'](_0xeb18('0x122'));}if(!this[_0xeb18('0x82')](_0x358f77[_0xeb18('0x8a')])){return this[_0xeb18('0xc')]['noop'](_0xeb18('0x128'));}if(!this[_0xeb18('0x82')](_0x358f77[_0xeb18('0x57')])){return this[_0xeb18('0xc')][_0xeb18('0xa5')](_0xeb18('0xa6'));}this['channel'][_0xeb18('0xe8')]=!![];this[_0xeb18('0x33')](_0x358f77);this[_0xeb18('0x40')](_0x358f77[_0xeb18('0x57')],'in','','');this[_0xeb18('0xc')][_0xeb18('0xa5')](util['format'](_0xeb18('0x129'),_0x358f77[_0xeb18('0x57')]));var _0x3bdb0d=this[_0xeb18('0x88')][_0xeb18('0x6c')](this,_0x358f77);if(_0x3bdb0d){for(var _0x5d7481 in _0x3bdb0d){if(_0x3bdb0d['hasOwnProperty'](_0x5d7481)&&_[_0xeb18('0x92')](_0x3bdb0d[_0x5d7481])){this['channel'][_0xeb18('0x9a')](util[_0xeb18('0x25')](_0xeb18('0x12a'),_0x5d7481[_0xeb18('0x66')]()),_0x3bdb0d[_0x5d7481]);}}if(_[_0xeb18('0x45')](_0x3bdb0d[_0xeb18('0x73')])){return this[_0xeb18('0xc')]['noop'](_0xeb18('0x12b'));}else{this[_0xeb18('0x40')](_0x3bdb0d['message'],_0xeb18('0xeb'),'amazonlex','');return this[_0xeb18('0xc')][_0xeb18('0xa5')](util[_0xeb18('0x25')](_0xeb18('0x12c'),_0x3bdb0d[_0xeb18('0x73')]));}}return this['channel'][_0xeb18('0x28')](_0x358f77,_0xeb18('0x12d'));};AGIVertices[_0xeb18('0xf')][_0xeb18('0x12e')]=function(_0x526699){logger[_0xeb18('0x2a')](util[_0xeb18('0x25')](_0xeb18('0x12f'),_0x526699[_0xeb18('0x35')],_0x526699[_0xeb18('0x62')]));if(!this[_0xeb18('0x82')](_0x526699['key'])){return this['channel'][_0xeb18('0xa5')]('no\x20key\x20configured');}var _0xe10429=_0xeb18('0x130');var _0x35823b=util[_0xeb18('0x25')](_0xeb18('0x131'),FILES_PATH,rs[_0xeb18('0x119')](0x4));var _0x104028=util[_0xeb18('0x25')]('%s.%s',_0x35823b,_0xe10429);var _0x1d98da=!![];if(_0x526699[_0xeb18('0x132')]==='NOBEEP'){_0x1d98da=![];}var _0x1565d1=this[_0xeb18('0xc')]['recordFile'](_0x35823b,_0xe10429,_0x526699[_0xeb18('0x133')],_0x526699[_0xeb18('0x62')],undefined,_0x1d98da);if(_0x1565d1['result']!==-0x1){this['channel'][_0xeb18('0xa5')](util[_0xeb18('0x25')]('google\x20%s\x20file\x20created',_0x104028));var _0x143768=this[_0xeb18('0x8b')][_0xeb18('0x6c')](this,_0x526699,_0x104028);if(_0x143768){for(var _0x19dd5d in _0x143768){if(_0x143768[_0xeb18('0x91')](_0x19dd5d)){this[_0xeb18('0xc')][_0xeb18('0x9a')](util[_0xeb18('0x25')](_0xeb18('0x134'),_0x19dd5d['toUpperCase']()),_0x143768[_0x19dd5d]);}}return this[_0xeb18('0xc')]['noop'](util['format'](_0xeb18('0x135'),JSON['stringify'](_0x143768)));}}return _0x1565d1;};AGIVertices[_0xeb18('0xf')][_0xeb18('0x136')]=function(_0x5863de){logger[_0xeb18('0x2a')](util['format'](_0xeb18('0x137'),_0x5863de[_0xeb18('0x35')]));if(!this['isConfigured'](_0x5863de[_0xeb18('0x8e')])){return this['channel'][_0xeb18('0xa5')](_0xeb18('0x138'));}if(!this['isConfigured'](_0x5863de[_0xeb18('0x139')])){return this['channel'][_0xeb18('0xa5')](_0xeb18('0x13a'));}var _0x995403=_0xeb18('0x130');var _0x39bda5=util[_0xeb18('0x25')](_0xeb18('0x131'),FILES_PATH,rs[_0xeb18('0x119')](0x4));var _0x33166a=util[_0xeb18('0x25')](_0xeb18('0x98'),_0x39bda5,_0x995403);var _0x6c3c8c=!![];if(_0x5863de[_0xeb18('0x132')]===_0xeb18('0x13b')){_0x6c3c8c=![];}var _0x30bd6a=this['channel'][_0xeb18('0x13c')](_0x39bda5,_0x995403,_0x5863de[_0xeb18('0x133')],_0x5863de[_0xeb18('0x62')],undefined,_0x6c3c8c);if(_0x30bd6a[_0xeb18('0x9f')]!==-0x1){this[_0xeb18('0xc')][_0xeb18('0xa5')](util[_0xeb18('0x25')]('tilde\x20%s\x20file\x20created',_0x33166a));var _0x34d252=this[_0xeb18('0x8d')][_0xeb18('0x6c')](this,_0x5863de,_0x33166a);if(_0x34d252){for(var _0x4a9a0a in _0x34d252){if(_0x34d252[_0xeb18('0x91')](_0x4a9a0a)){this[_0xeb18('0xc')][_0xeb18('0x9a')](util[_0xeb18('0x25')](_0xeb18('0x13d'),_0x4a9a0a[_0xeb18('0x66')]()),_0x34d252[_0x4a9a0a]);}}return this[_0xeb18('0xc')][_0xeb18('0xa5')](util[_0xeb18('0x25')](_0xeb18('0x13e'),JSON['stringify'](_0x34d252)));}}return _0x30bd6a;};AGIVertices[_0xeb18('0xf')]['gotoc']=function(_0x309e43){logger['info'](util[_0xeb18('0x25')](_0xeb18('0x13f'),_0x309e43[_0xeb18('0x35')]));return this[_0xeb18('0xc')][_0xeb18('0x140')](_0x309e43[_0xeb18('0x3b')],_0x309e43[_0xeb18('0x141')],_0x309e43[_0xeb18('0x3c')]);};AGIVertices[_0xeb18('0xf')]['gotoif']=function(_0x4554d4){logger[_0xeb18('0x2a')](util[_0xeb18('0x25')](_0xeb18('0x142'),_0x4554d4['label']));if(!this[_0xeb18('0x82')](_0x4554d4['condition'])){return this[_0xeb18('0xc')][_0xeb18('0x28')](_0x4554d4,_0xeb18('0x143'));}try{var _0x2b6204=eval(_0x4554d4[_0xeb18('0x144')])?_0xeb18('0x145'):'false';this[_0xeb18('0xc')][_0xeb18('0xa5')](util[_0xeb18('0x25')](_0xeb18('0x146'),_0x4554d4[_0xeb18('0x144')],_0x2b6204));return{'code':0xc8,'result':_0x2b6204};}catch(_0xa3c318){return{'code':0xc8,'result':_0xeb18('0x147')};}};AGIVertices['prototype']['gotoiftime']=function(_0x5e9059){logger[_0xeb18('0x2a')](util['format']('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x5e9059[_0xeb18('0x35')]));if(!this[_0xeb18('0x82')](_0x5e9059['interval_id'])){return this[_0xeb18('0xc')][_0xeb18('0x28')](_0x5e9059,_0xeb18('0x148'));}var _0x5402d9=this[_0xeb18('0x20')]['sync'](this,_0x5e9059[_0xeb18('0x149')]);if(!_0x5402d9){return this[_0xeb18('0xc')][_0xeb18('0x28')](_0x5e9059,_0xeb18('0x14a'));}for(var _0x4bba94=0x0;_0x4bba94<_0x5402d9[_0xeb18('0x95')];_0x4bba94+=0x1){var _0x1dd604=this[_0xeb18('0xc')][_0xeb18('0x10')](util[_0xeb18('0x25')](_0xeb18('0x14b'),_0x5402d9[_0x4bba94]));if(_0x1dd604[_0xeb18('0x9f')]===-0x1){return _0x1dd604;}logger[_0xeb18('0x2a')](util[_0xeb18('0x25')]('IFTIME\x20%s\x20%s',_0x5402d9[_0x4bba94],_0x1dd604[_0xeb18('0xa1')]));if(_0x1dd604['extra']==='true'){logger[_0xeb18('0x2a')](util['format'](_0xeb18('0x14c'),_0x5402d9[_0x4bba94],'true'));this[_0xeb18('0xc')][_0xeb18('0xa5')](util['format'](_0xeb18('0x14c'),_0x5402d9[_0x4bba94],_0xeb18('0x145')));return{'code':0xc8,'result':_0xeb18('0x145')};}else{logger[_0xeb18('0x2a')](util[_0xeb18('0x25')](_0xeb18('0x14c'),_0x5402d9[_0x4bba94],_0xeb18('0x147')));this['channel'][_0xeb18('0xa5')](util[_0xeb18('0x25')](_0xeb18('0x14c'),_0x5402d9[_0x4bba94],_0xeb18('0x147')));}}return{'code':0xc8,'result':_0xeb18('0x147')};};AGIVertices[_0xeb18('0xf')]['hangup']=function(_0x1f6553){logger[_0xeb18('0x2a')](util['format'](_0xeb18('0x14d'),_0x1f6553[_0xeb18('0x35')]));return this[_0xeb18('0xc')][_0xeb18('0x14e')]();};AGIVertices[_0xeb18('0xf')][_0xeb18('0x14f')]=function(_0x404495){logger[_0xeb18('0x2a')](util[_0xeb18('0x25')](_0xeb18('0x150'),_0x404495[_0xeb18('0x35')]));if(!this['isConfigured'](_0x404495['key'])){return this['channel'][_0xeb18('0xa5')](_0xeb18('0xe7'));}var _0x5e8865='wav';var _0x4b4b1e=util[_0xeb18('0x25')](_0xeb18('0x131'),FILES_PATH,rs[_0xeb18('0x119')](0x4));var _0x457664=util[_0xeb18('0x25')]('%s.%s',_0x4b4b1e,_0x5e8865);var _0x3d7703=!![];if(_0x404495[_0xeb18('0x132')]==='NOBEEP'){_0x3d7703=![];}var _0x233936=this[_0xeb18('0xc')][_0xeb18('0x13c')](_0x4b4b1e,_0x5e8865,_0x404495['intKey'],_0x404495[_0xeb18('0x62')],undefined,_0x3d7703);if(_0x233936[_0xeb18('0x9f')]!==-0x1){this[_0xeb18('0xc')][_0xeb18('0xa5')](util['format'](_0xeb18('0x151'),_0x457664));var _0x25a8ce=this[_0xeb18('0x80')][_0xeb18('0x6c')](this,_0x404495,_0x457664);if(_0x25a8ce){for(var _0x4d95cf in _0x25a8ce){if(_0x25a8ce['hasOwnProperty'](_0x4d95cf)){this[_0xeb18('0xc')]['setVariable'](util[_0xeb18('0x25')](_0xeb18('0x152'),_0x4d95cf['toUpperCase']()),_0x25a8ce[_0x4d95cf]);}}return this[_0xeb18('0xc')][_0xeb18('0xa5')](util['format'](_0xeb18('0x153'),JSON[_0xeb18('0x6f')](_0x25a8ce)));}}return _0x233936;};AGIVertices[_0xeb18('0xf')]['ispeechtts']=function(_0x1a2f51){logger['info'](util[_0xeb18('0x25')]('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x1a2f51[_0xeb18('0x35')]));if(!this[_0xeb18('0x82')](_0x1a2f51[_0xeb18('0x77')])){return this['channel']['noop'](_0xeb18('0xe7'));}if(!this[_0xeb18('0x82')](_0x1a2f51[_0xeb18('0x57')])){return this['channel'][_0xeb18('0xa5')](_0xeb18('0xa6'));}this[_0xeb18('0xc')][_0xeb18('0xa5')](util['format'](_0xeb18('0x154'),_0x1a2f51[_0xeb18('0x57')]));var _0x311275=this[_0xeb18('0x7c')]['sync'](this,_0x1a2f51);if(_0x311275){this['channel'][_0xeb18('0xa5')](util['format'](_0xeb18('0x151'),_0x311275));var _0x23ab9c=this[_0xeb18('0xc')]['streamFile'](_0x311275,_0x1a2f51[_0xeb18('0x133')]);try{fs[_0xeb18('0x102')](_0x311275+'.wav');}catch(_0x5bb41c){logger[_0xeb18('0x28')](_0x5bb41c);}return _0x23ab9c;}return this[_0xeb18('0xc')][_0xeb18('0x28')](_0x1a2f51,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices[_0xeb18('0xf')][_0xeb18('0x155')]=function(_0x227056){logger[_0xeb18('0x2a')](util[_0xeb18('0x25')](_0xeb18('0x156'),_0x227056['label']));if(!this[_0xeb18('0x82')](_0x227056[_0xeb18('0x157')])){return this['channel'][_0xeb18('0x28')](_0x227056,_0xeb18('0x158'));}logger[_0xeb18('0x2a')](util[_0xeb18('0x25')](_0xeb18('0x159'),this['channel'][_0xeb18('0x38')],_0x227056[_0xeb18('0x157')]));var _0x9f2d29=this[_0xeb18('0x52')]['sync'](this,_0x227056[_0xeb18('0x157')]);if(_0x9f2d29){logger[_0xeb18('0x2a')](util[_0xeb18('0x25')](_0xeb18('0x15a'),this['channel'][_0xeb18('0x38')],_0x227056['findBy']));this[_0xeb18('0xc')][_0xeb18('0xa5')](util['format'](_0xeb18('0x15a'),this['channel'][_0xeb18('0x38')],_0x227056[_0xeb18('0x157')]));return{'code':0xc8,'result':_0xeb18('0x15b')};}else{logger[_0xeb18('0x2a')](util[_0xeb18('0x25')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0xeb18('0x38')],_0x227056[_0xeb18('0x157')]));this[_0xeb18('0xc')][_0xeb18('0xa5')](util[_0xeb18('0x25')](_0xeb18('0x15c'),this[_0xeb18('0xc')][_0xeb18('0x38')],_0x227056[_0xeb18('0x157')]));return{'code':0xc8,'result':_0xeb18('0x15d')};}};AGIVertices[_0xeb18('0xf')][_0xeb18('0x15e')]=function(_0x93cb8b){logger[_0xeb18('0x2a')](util[_0xeb18('0x25')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x93cb8b[_0xeb18('0x35')]));if(!this['isConfigured'](_0x93cb8b['findBy'])){return this[_0xeb18('0xc')]['error'](_0x93cb8b,'no\x20find\x20by\x20configured');}logger[_0xeb18('0x2a')](util[_0xeb18('0x25')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xeb18('0xc')]['callerid'],_0x93cb8b[_0xeb18('0x157')]));var _0x16d08d=this['agentLogout'][_0xeb18('0x6c')](this,_0x93cb8b[_0xeb18('0x157')]);if(_0x16d08d){logger['info'](util[_0xeb18('0x25')](_0xeb18('0x15a'),this[_0xeb18('0xc')][_0xeb18('0x38')],_0x93cb8b[_0xeb18('0x157')]));this['channel']['noop'](util['format']('AGENT\x20%s\x20FOUND\x20BY',this['channel']['callerid'],_0x93cb8b[_0xeb18('0x157')]));return{'code':0xc8,'result':_0xeb18('0x15b')};}else{logger[_0xeb18('0x2a')](util['format'](_0xeb18('0x15c'),this['channel'][_0xeb18('0x38')],_0x93cb8b[_0xeb18('0x157')]));this['channel'][_0xeb18('0xa5')](util['format'](_0xeb18('0x15c'),this['channel']['callerid'],_0x93cb8b[_0xeb18('0x157')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xeb18('0xf')]['math']=function(_0xce2c30){logger['info'](util[_0xeb18('0x25')]('Enter\x20in\x20MATH\x20(%s)\x20block',_0xce2c30[_0xeb18('0x35')]));if(!this[_0xeb18('0x82')](_0xce2c30[_0xeb18('0x15f')])){return this['channel']['error'](_0xce2c30,_0xeb18('0x160'));}this[_0xeb18('0xc')][_0xeb18('0xa5')](util['format'](_0xeb18('0x161'),_0xce2c30['operation']));var _0x6a8643=eval(_0xce2c30[_0xeb18('0x15f')]);if(!this[_0xeb18('0x82')](_0xce2c30[_0xeb18('0xd6')])){return this[_0xeb18('0xc')][_0xeb18('0xa5')](_0xeb18('0xd7'));}var _0x36e8f6=this[_0xeb18('0x10')][_0xeb18('0x6c')](this,_0xce2c30[_0xeb18('0xd6')]);if(!_0x36e8f6){return this[_0xeb18('0xc')][_0xeb18('0x28')](_0xce2c30,_0xeb18('0xd8'));}if(_[_0xeb18('0x99')](_0x6a8643)){var _0x30777c=this;_0x6a8643['forEach'](function(_0x398934,_0x24778e){_0x30777c[_0xeb18('0xc')]['setVariable'](util['format'](_0xeb18('0x162'),_0x36e8f6,_0x24778e),_0x398934);});return this[_0xeb18('0xc')][_0xeb18('0xa5')](util['format'](_0xeb18('0x163'),_0x36e8f6));}else{return this[_0xeb18('0xc')]['setVariable'](_0x36e8f6,_0x6a8643);}};AGIVertices[_0xeb18('0xf')][_0xeb18('0x164')]=function(_0x254847){logger[_0xeb18('0x2a')](util[_0xeb18('0x25')](_0xeb18('0x165'),_0x254847['label']));if(_0x254847[_0xeb18('0x111')]===0x0){return this[_0xeb18('0xa2')](_0x254847);}_0x254847[_0xeb18('0x111')]-=0x1;if(!this[_0xeb18('0x82')](_0x254847['file_id'])){return this[_0xeb18('0xc')][_0xeb18('0x28')](_0x254847,_0xeb18('0x113'));}var _0xf114e0=this[_0xeb18('0x166')][_0xeb18('0x6c')](this,_0x254847[_0xeb18('0x112')]);if(!_0xf114e0){return this[_0xeb18('0xc')][_0xeb18('0x28')](_0x254847,'no\x20file\x20audio\x20found');}var _0x575d5e=this[_0xeb18('0xc')][_0xeb18('0x114')](_0xf114e0,_0x254847[_0xeb18('0x167')],_0x254847[_0xeb18('0x168')]);var _0x3cd6c9=_0x575d5e[_0xeb18('0x9f')];if(_0x575d5e['result']===-0x1){this[_0xeb18('0x33')][_0xeb18('0x6c')](this,_0x254847,'-1');return _0x575d5e;}else if(_0x575d5e[_0xeb18('0xa1')]==='timeout'){_0x575d5e[_0xeb18('0x9f')]=_0x575d5e[_0xeb18('0x9f')][_0xeb18('0x95')]>0x0?_0x575d5e['result']:'t';}else if(_[_0xeb18('0x42')](_0x575d5e[_0xeb18('0x9f')])){_0x575d5e[_0xeb18('0x9f')]='#';_0x3cd6c9='#';}if(!this['isConfigured'](_0x254847[_0xeb18('0xd6')])){this[_0xeb18('0xc')]['noop']('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x498c84=this[_0xeb18('0x10')][_0xeb18('0x6c')](this,_0x254847[_0xeb18('0xd6')]);if(!_0x498c84){return this[_0xeb18('0xc')][_0xeb18('0x28')](_0x254847,_0xeb18('0xd8'));}this['channel'][_0xeb18('0x9a')](_0x498c84,_0x3cd6c9);}this[_0xeb18('0x33')][_0xeb18('0x6c')](this,_0x254847,_0x3cd6c9);return _0x575d5e;};AGIVertices[_0xeb18('0xf')][_0xeb18('0xa5')]=function(_0x4fb659){logger[_0xeb18('0x2a')](util[_0xeb18('0x25')]('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x4fb659[_0xeb18('0x35')]));return this['channel'][_0xeb18('0xa5')](_0x4fb659[_0xeb18('0x169')]||_0x4fb659[_0xeb18('0x35')]);};AGIVertices['prototype'][_0xeb18('0x16a')]=function(_0x37dd45){logger[_0xeb18('0x2a')](util[_0xeb18('0x25')](_0xeb18('0x16b'),_0x37dd45[_0xeb18('0x35')]));if(!this[_0xeb18('0x82')](_0x37dd45['findBy'])){return this[_0xeb18('0xc')]['error'](_0x37dd45,_0xeb18('0x158'));}logger[_0xeb18('0x2a')](util[_0xeb18('0x25')](_0xeb18('0x159'),this[_0xeb18('0xc')][_0xeb18('0x38')],_0x37dd45[_0xeb18('0x157')]));var _0x19580c=this[_0xeb18('0x4d')]['sync'](this,_0x37dd45[_0xeb18('0x16c')]);var _0x45f3b3=this[_0xeb18('0x16d')]['sync'](this,_0x37dd45['findBy'],_0x19580c);if(_0x45f3b3){logger[_0xeb18('0x2a')](util[_0xeb18('0x25')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xeb18('0xc')][_0xeb18('0x38')],_0x37dd45['findBy']));this[_0xeb18('0xc')][_0xeb18('0xa5')](util[_0xeb18('0x25')](_0xeb18('0x15a'),this[_0xeb18('0xc')][_0xeb18('0x38')],_0x37dd45[_0xeb18('0x157')]));return{'code':0xc8,'result':_0xeb18('0x15b')};}else{logger['info'](util[_0xeb18('0x25')](_0xeb18('0x15c'),this[_0xeb18('0xc')][_0xeb18('0x38')],_0x37dd45['findBy']));this['channel'][_0xeb18('0xa5')](util[_0xeb18('0x25')](_0xeb18('0x15a'),this['channel'][_0xeb18('0x38')],_0x37dd45[_0xeb18('0x157')]));return{'code':0xc8,'result':_0xeb18('0x15d')};}};AGIVertices['prototype'][_0xeb18('0x16e')]=function(_0x3c44ba){logger[_0xeb18('0x2a')](util['format'](_0xeb18('0x16f'),_0x3c44ba['label']));if(!this[_0xeb18('0x82')](_0x3c44ba[_0xeb18('0x112')])){return this[_0xeb18('0xc')][_0xeb18('0x28')](_0x3c44ba,'no\x20file\x20audio\x20selected');}var _0x1a5e5d=this['getSound']['sync'](this,_0x3c44ba['file_id']);if(!_0x1a5e5d){return this[_0xeb18('0xc')][_0xeb18('0x28')](_0x3c44ba,_0xeb18('0x170'));}var _0x4c780c=this[_0xeb18('0xc')][_0xeb18('0xa7')](_0xeb18('0x171'),[_0x1a5e5d,_0x3c44ba['opts']]);if(_0x4c780c[_0xeb18('0x9f')]===-0x1){return _0x4c780c;}return this[_0xeb18('0xc')][_0xeb18('0xa5')](util[_0xeb18('0x25')](_0xeb18('0xc2'),_0xeb18('0x171'),_0x1a5e5d));};AGIVertices[_0xeb18('0xf')][_0xeb18('0x172')]=function(_0x4694c0){logger['info'](util[_0xeb18('0x25')]('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x4694c0[_0xeb18('0x35')]));if(!this[_0xeb18('0x82')](_0x4694c0['queue_id'])){return this[_0xeb18('0xc')][_0xeb18('0x28')](_0x4694c0,_0xeb18('0x173'));}var _0x4e9090='';var _0x49ac02=parseInt(_0x4694c0['queue_id'],0xa);if(isNaN(_0x49ac02)){_0x4e9090=_0x4694c0[_0xeb18('0x174')];}else{_0x4e9090=this[_0xeb18('0x13')][_0xeb18('0x6c')](this,_0x4694c0[_0xeb18('0x174')]);if(!_0x4e9090){return this['channel'][_0xeb18('0x28')](_0x4694c0,_0xeb18('0x175'));}}var _0x5fa5f2='';if(this['isConfigured'](_0x4694c0[_0xeb18('0x112')])){var _0xbc1949=this['getSound']['sync'](this,_0x4694c0['file_id']);if(_0xbc1949){_0x5fa5f2=_0xbc1949;}}this['createSquareDetailsReport'][_0xeb18('0x6c')](this,_0x4694c0,_0x4e9090);if(_0x4694c0[_0xeb18('0xe4')][_0xeb18('0x176')]('x')<0x0){_0x4694c0[_0xeb18('0xe4')]+='x';}if(_0x4694c0[_0xeb18('0xe4')][_0xeb18('0x176')]('X')<0x0){_0x4694c0[_0xeb18('0xe4')]+='X';}this['channel'][_0xeb18('0x9a')](_0xeb18('0x177'),_0x4e9090?_0x4e9090['toLowerCase']():'');var _0x2f12c4=this['channel'][_0xeb18('0xa7')](_0xeb18('0x178'),[_0x4e9090,_0x4694c0[_0xeb18('0xe4')],_0x4694c0[_0xeb18('0x60')],_0x5fa5f2,_0x4694c0[_0xeb18('0x62')],_0x4694c0[_0xeb18('0x4')],_0x4694c0[_0xeb18('0x179')],_0x4694c0['gosub'],'',_0x4694c0[_0xeb18('0x17a')]]);if(_0x2f12c4[_0xeb18('0x9f')]===-0x1){return _0x2f12c4;}return this['channel'][_0xeb18('0xa5')](util['format'](_0xeb18('0xc2'),'QUEUE',_0x4e9090));};AGIVertices[_0xeb18('0xf')][_0xeb18('0x17b')]=function(_0x16a650){logger[_0xeb18('0x2a')](util[_0xeb18('0x25')](_0xeb18('0x17c'),_0x16a650[_0xeb18('0x35')]));var _0x532ccc=_0x16a650[_0xeb18('0x17d')]||'wav';var _0x34fdbd=util[_0xeb18('0x25')](_0xeb18('0x17e'),this[_0xeb18('0xc')]['uniqueid'],rs['generate'](0x5));var _0x439e18=util['format']('%s/recordings/%s.%s',FILES_PATH,_0x34fdbd,_0x532ccc);var _0x2d7320=util['format'](_0xeb18('0x131'),FILES_PATH,_0x34fdbd);this[_0xeb18('0x39')][_0xeb18('0x6c')](this,_0x16a650,_0x34fdbd,_0x439e18);this['channel'][_0xeb18('0x9a')]('RECORDING_SAVENAME',_0x34fdbd);logger['info']('Recording\x20%s\x20%s\x20%s\x20%s',_0x2d7320,_0x532ccc,_0x16a650[_0xeb18('0x17f')],_0x16a650[_0xeb18('0x62')]);return this[_0xeb18('0xc')][_0xeb18('0x13c')](_0x2d7320,_0x532ccc,_0x16a650[_0xeb18('0x17f')],_0x16a650[_0xeb18('0x62')],undefined,!![]);};AGIVertices[_0xeb18('0xf')][_0xeb18('0x180')]=function(_0x4cf719){logger[_0xeb18('0x2a')](util['format'](_0xeb18('0x181'),_0x4cf719[_0xeb18('0x35')]));if(!this[_0xeb18('0x82')](_0x4cf719['url'])){return this[_0xeb18('0xc')][_0xeb18('0xa5')](_0xeb18('0x182'));}var _0x33c8b4=this[_0xeb18('0x5f')][_0xeb18('0x6c')](this,_0x4cf719);logger[_0xeb18('0x2a')](util[_0xeb18('0x25')](_0xeb18('0x183'),util['inspect'](_0x33c8b4,{'showHidden':![],'depth':null})));if(!this[_0xeb18('0x82')](_0x4cf719['variable_id'])){return this[_0xeb18('0xc')][_0xeb18('0xa5')]('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x5c51db=this['getVariable'][_0xeb18('0x6c')](this,_0x4cf719[_0xeb18('0xd6')]);if(!_0x5c51db){return this['channel'][_0xeb18('0x28')](_0x4cf719,_0xeb18('0xd8'));}this[_0xeb18('0xc')][_0xeb18('0x9a')](util[_0xeb18('0x25')](_0xeb18('0x184'),_0x5c51db),_0x33c8b4['statusCode']?_0x33c8b4[_0xeb18('0x72')]:_0xeb18('0x185'));this[_0xeb18('0xc')][_0xeb18('0x9a')](util[_0xeb18('0x25')]('%s_STATUS_MESSAGE',_0x5c51db),_0x33c8b4[_0xeb18('0x71')]?_0x33c8b4['statusMessage']:'OK');if(_0x33c8b4[_0xeb18('0x67')]){try{this[_0xeb18('0x96')](_0x33c8b4[_0xeb18('0x67')],_0x5c51db);}catch(_0x586f8b){logger['error'](util[_0xeb18('0x25')](_0xeb18('0x186'),_0x5c51db));}}return this[_0xeb18('0xc')][_0xeb18('0xa5')](util['format'](_0xeb18('0xdc'),_0x5c51db));};AGIVertices['prototype'][_0xeb18('0x187')]=function(_0x28787c){logger[_0xeb18('0x2a')](util[_0xeb18('0x25')](_0xeb18('0x188'),_0x28787c[_0xeb18('0x35')]));return this['channel'][_0xeb18('0x189')](_0x28787c['digits'][_0xeb18('0xd5')](/\s+/g,''),_0x28787c[_0xeb18('0x17f')]);};AGIVertices[_0xeb18('0xf')][_0xeb18('0x18a')]=function(_0x599569){logger[_0xeb18('0x2a')](util['format'](_0xeb18('0x18b'),_0x599569['label']));return this[_0xeb18('0xc')]['sayNumber'](_0x599569[_0xeb18('0x63')][_0xeb18('0xd5')](/\s+/g,''),_0x599569['escape_digits']);};AGIVertices[_0xeb18('0xf')][_0xeb18('0x18c')]=function(_0x363c6e){logger[_0xeb18('0x2a')](util[_0xeb18('0x25')](_0xeb18('0x18d'),_0x363c6e[_0xeb18('0x35')]));return this['channel'][_0xeb18('0x18e')](_0x363c6e[_0xeb18('0x57')],_0x363c6e[_0xeb18('0x17f')]);};AGIVertices[_0xeb18('0xf')][_0xeb18('0x18f')]=function(_0x543b89){logger[_0xeb18('0x2a')](util[_0xeb18('0x25')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x543b89['label']));if(!this[_0xeb18('0x82')](_0x543b89[_0xeb18('0x190')])){return this[_0xeb18('0xc')][_0xeb18('0xa5')]('no\x20mail\x20account\x20configured');}var _0x1c97e7=this[_0xeb18('0x191')][_0xeb18('0x6c')](this,_0x543b89[_0xeb18('0x190')]);if(!_0x1c97e7||!_0x1c97e7[_0xeb18('0x192')]){return this['channel'][_0xeb18('0x28')](_0x543b89,_0xeb18('0x193'));}var _0x4bb609={'from':util[_0xeb18('0x25')]('\x22%s\x22\x20<%s>',_0x1c97e7[_0xeb18('0x15')],_0x1c97e7['email']||_0x1c97e7[_0xeb18('0x192')]['user']),'to':_0x543b89['to']||'','cc':_0x543b89['cc']||'','bcc':_0x543b89[_0xeb18('0x194')]||'','subject':_0x543b89[_0xeb18('0x195')],'html':_0x543b89[_0xeb18('0x57')],'text':_0x543b89[_0xeb18('0x57')]};if(this[_0xeb18('0x82')](_0x543b89[_0xeb18('0x196')])){}logger['debug'](_0xeb18('0x197'),JSON[_0xeb18('0x6f')](_0x4bb609));this['createSquareDetailsReport'][_0xeb18('0x6c')](this,_0x543b89,_0x543b89[_0xeb18('0x190')]);this['channel'][_0xeb18('0xa5')](util[_0xeb18('0x25')](_0xeb18('0x198'),_0x1c97e7[_0xeb18('0x15')]));this[_0xeb18('0x1f')][_0xeb18('0x6c')](this,_0x1c97e7[_0xeb18('0x199')],_0x4bb609);return this[_0xeb18('0xc')]['noop']('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0xeb18('0xf')][_0xeb18('0x19a')]=function(_0x5b56cf){logger[_0xeb18('0x2a')](util[_0xeb18('0x25')]('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x5b56cf[_0xeb18('0x35')]));return this['channel']['noop'](_0xeb18('0x19b'));};AGIVertices[_0xeb18('0xf')][_0xeb18('0x19c')]=function(_0x2779da){logger[_0xeb18('0x2a')](util[_0xeb18('0x25')](_0xeb18('0x19d'),_0x2779da[_0xeb18('0x35')]));if(!this[_0xeb18('0x82')](_0x2779da['sms_account_id'])){return this[_0xeb18('0xc')][_0xeb18('0xa5')](_0xeb18('0x19e'));}var _0x3b4a1e=this[_0xeb18('0x30')][_0xeb18('0x6c')](this,_0x2779da[_0xeb18('0x19f')]);if(!_0x3b4a1e){return this[_0xeb18('0xc')]['error'](_0x2779da,'no\x20sms\x20account\x20found');}var _0x4bb583={'body':_0x2779da[_0xeb18('0x1a0')],'phone':_0x2779da['to']||'','SmsAccountId':_0x3b4a1e['id']};logger[_0xeb18('0xde')](_0xeb18('0x1a1'),JSON[_0xeb18('0x6f')](_0x4bb583));this[_0xeb18('0x33')]['sync'](this,_0x2779da,_0x2779da['sms_account_id']);this['channel'][_0xeb18('0xa5')](util[_0xeb18('0x25')](_0xeb18('0x1a2'),_0x3b4a1e[_0xeb18('0x15')]));this[_0xeb18('0x32')][_0xeb18('0x6c')](this,_0x4bb583);return this['channel'][_0xeb18('0xa5')](_0xeb18('0x1a3'));};AGIVertices[_0xeb18('0xf')][_0xeb18('0x1a4')]=function(_0x2b6abb){logger[_0xeb18('0x2a')](util[_0xeb18('0x25')](_0xeb18('0x1a5'),_0x2b6abb[_0xeb18('0x35')]));if(!this[_0xeb18('0x82')](_0x2b6abb[_0xeb18('0xd6')])){return this[_0xeb18('0xc')][_0xeb18('0x28')](_0x2b6abb,_0xeb18('0x1a6'));}var _0x4de6e9=this['getVariable'][_0xeb18('0x6c')](this,_0x2b6abb[_0xeb18('0xd6')]);if(!_0x4de6e9){return this['channel']['error'](_0x2b6abb,_0xeb18('0xd8'));}return this[_0xeb18('0xc')][_0xeb18('0x9a')](_0x4de6e9,_0x2b6abb[_0xeb18('0x1a7')]);};AGIVertices[_0xeb18('0xf')]['start']=function(_0x16a690){logger['info'](util[_0xeb18('0x25')](_0xeb18('0x1a8'),_0x16a690['label']));this[_0xeb18('0xc')][_0xeb18('0xa5')](_0xeb18('0x1a9'));var _0x2c20f5=this['channel'][_0xeb18('0x10')]('XMCS-UNIQUEID');if(!_[_0xeb18('0x42')](_0x2c20f5[_0xeb18('0xa1')])){this[_0xeb18('0xc')][_0xeb18('0x34')]=_0x2c20f5[_0xeb18('0xa1')];}if(_0x16a690[_0xeb18('0xb5')]===_0xeb18('0x1aa')){this[_0xeb18('0xc')][_0xeb18('0xa5')](_0xeb18('0x1ab'));return this[_0xeb18('0xc')][_0xeb18('0xb5')]();}return this[_0xeb18('0xc')]['noop']('Skipped\x20Answer');};AGIVertices[_0xeb18('0xf')][_0xeb18('0x1ac')]=function(_0x2c2687){logger[_0xeb18('0x2a')](util[_0xeb18('0x25')]('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x2c2687[_0xeb18('0x35')]));if(!this[_0xeb18('0x82')](_0x2c2687[_0xeb18('0x1ad')])){return this[_0xeb18('0xc')][_0xeb18('0x28')](_0x2c2687,_0xeb18('0x1ae'));}var _0x182efe=this['getSquareProject'][_0xeb18('0x6c')](this,_0x2c2687[_0xeb18('0x1ad')]);if(!this[_0xeb18('0x82')](_0x182efe)){return this[_0xeb18('0xc')][_0xeb18('0x28')](_0x2c2687,util[_0xeb18('0x25')](_0xeb18('0x1af'),_0x2c2687[_0xeb18('0x1ad')]));}if(_0x182efe===this[_0xeb18('0xc')][_0xeb18('0x37')]){return this[_0xeb18('0xc')][_0xeb18('0x28')](_0x2c2687,_0xeb18('0x1b0'));}this[_0xeb18('0x33')]['sync'](this,_0x2c2687,_0x182efe);var _0x4e6679=this[_0xeb18('0xc')][_0xeb18('0xa7')]('AGI',util[_0xeb18('0x25')]('agi://%s/square,\x22%s\x22,\x22%s\x22',config['agi'][_0xeb18('0x1b1')]||_0xeb18('0x1b2'),_0x182efe,this['channel']['arg_1']));if(_0x4e6679[_0xeb18('0x9f')]===-0x1){return _0x4e6679;}return this['channel'][_0xeb18('0xa5')](util['format'](_0xeb18('0xc2'),_0xeb18('0x1b3'),_0x182efe));};AGIVertices['prototype']['system']=function(_0x4d7e34){logger['info'](util[_0xeb18('0x25')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x4d7e34['label']));var _0x233db9=this[_0xeb18('0x1b4')][_0xeb18('0x6c')](this,_0x4d7e34[_0xeb18('0x1b5')]);this[_0xeb18('0x33')][_0xeb18('0x6c')](this,_0x4d7e34,_0x4d7e34[_0xeb18('0x1b5')]);if(this['isConfigured'](_0x4d7e34['variable_id'])){var _0x45501f=this[_0xeb18('0x10')][_0xeb18('0x6c')](this,_0x4d7e34[_0xeb18('0xd6')]);if(_0x45501f){this[_0xeb18('0xc')][_0xeb18('0x9a')](_0x45501f,_0x233db9);return this['channel'][_0xeb18('0xa5')](util['format']('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x4d7e34[_0xeb18('0x1b5')],_0x45501f));}}return this[_0xeb18('0xc')][_0xeb18('0xa5')](util[_0xeb18('0x25')](_0xeb18('0x1b6'),_0x4d7e34[_0xeb18('0x1b5')]));};AGIVertices[_0xeb18('0xf')][_0xeb18('0x1b7')]=function(_0x292041){logger[_0xeb18('0x2a')](util['format'](_0xeb18('0x1b8'),_0x292041[_0xeb18('0x35')]));_0x292041[_0xeb18('0x57')]=_0x292041[_0xeb18('0x57')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xeb18('0x82')](_0x292041[_0xeb18('0x1b9')])){return this['channel'][_0xeb18('0xa5')](_0xeb18('0x1ba'));}if(!this[_0xeb18('0x82')](_0x292041[_0xeb18('0x57')])){return this[_0xeb18('0xc')][_0xeb18('0xa5')](_0xeb18('0xa6'));}this[_0xeb18('0xc')][_0xeb18('0xa5')](util['format'](_0xeb18('0x1bb'),_0x292041[_0xeb18('0x57')]));var _0x5d8368=this[_0xeb18('0x55')][_0xeb18('0x6c')](this,_0x292041);if(_0x5d8368){this['channel'][_0xeb18('0xa5')](util[_0xeb18('0x25')](_0xeb18('0x1bc'),_0x5d8368));var _0x42ba8b=this['channel']['streamFile'](_0x5d8368);try{fs[_0xeb18('0x102')](_0x5d8368+_0xeb18('0x103'));}catch(_0xd61ff4){logger[_0xeb18('0x28')](_0xd61ff4);}return _0x42ba8b;}return this[_0xeb18('0xc')][_0xeb18('0x28')](_0x292041,_0xeb18('0x1bd'));};AGIVertices[_0xeb18('0xf')][_0xeb18('0x1be')]=function(_0xbc88bc){logger[_0xeb18('0x2a')](util[_0xeb18('0x25')](_0xeb18('0x1bf'),_0xbc88bc[_0xeb18('0x35')]));_0xbc88bc[_0xeb18('0x57')]=_0xbc88bc[_0xeb18('0x57')][_0xeb18('0xd5')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xeb18('0x82')](_0xbc88bc[_0xeb18('0x57')])){return this['channel'][_0xeb18('0xa5')](_0xeb18('0xa6'));}this['channel'][_0xeb18('0xa5')](util[_0xeb18('0x25')]('Trying\x20Google\x20TTS\x20%s',_0xbc88bc['text']));var _0x10904b=this['googleTTS'][_0xeb18('0x6c')](this,_0xbc88bc);if(_0x10904b){this[_0xeb18('0xc')][_0xeb18('0xa5')](util[_0xeb18('0x25')](_0xeb18('0x1c0'),_0x10904b));var _0xdd209=this[_0xeb18('0xc')][_0xeb18('0x125')](_0x10904b);try{fs[_0xeb18('0x102')](_0x10904b+_0xeb18('0x103'));}catch(_0x8e48d9){logger['error'](_0x8e48d9);}return _0xdd209;}return this['channel'][_0xeb18('0x28')](_0xbc88bc,_0xeb18('0x1c1'));};AGIVertices['prototype'][_0xeb18('0x1c2')]=function(_0x4aa697){logger[_0xeb18('0x2a')](util[_0xeb18('0x25')]('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x4aa697[_0xeb18('0x35')]));if(!this[_0xeb18('0x82')](_0x4aa697[_0xeb18('0x157')])){return this[_0xeb18('0xc')][_0xeb18('0x28')](_0x4aa697,'no\x20find\x20by\x20configured');}logger[_0xeb18('0x2a')](util['format'](_0xeb18('0x159'),this[_0xeb18('0xc')][_0xeb18('0x38')],_0x4aa697[_0xeb18('0x157')]));var _0x5d9bc9=this[_0xeb18('0x50')][_0xeb18('0x6c')](this,_0x4aa697[_0xeb18('0x157')]);if(_0x5d9bc9){logger[_0xeb18('0x2a')](util['format'](_0xeb18('0x15a'),this[_0xeb18('0xc')][_0xeb18('0x38')],_0x4aa697[_0xeb18('0x157')]));this[_0xeb18('0xc')][_0xeb18('0xa5')](util['format'](_0xeb18('0x15a'),this[_0xeb18('0xc')]['callerid'],_0x4aa697[_0xeb18('0x157')]));return{'code':0xc8,'result':_0xeb18('0x15b')};}else{logger['info'](util[_0xeb18('0x25')](_0xeb18('0x15c'),this[_0xeb18('0xc')]['callerid'],_0x4aa697[_0xeb18('0x157')]));this[_0xeb18('0xc')][_0xeb18('0xa5')](util[_0xeb18('0x25')](_0xeb18('0x15c'),this[_0xeb18('0xc')][_0xeb18('0x38')],_0x4aa697['findBy']));return{'code':0xc8,'result':_0xeb18('0x15d')};}};AGIVertices['prototype'][_0xeb18('0x1c3')]=function(_0x2d5fd3){logger['info'](util[_0xeb18('0x25')](_0xeb18('0x1c4'),_0x2d5fd3[_0xeb18('0x35')]));var _0x19c383=this['channel'][_0xeb18('0xa7')](_0xeb18('0x1c5'),[_0x2d5fd3[_0xeb18('0x1c6')],_0x2d5fd3['options']]);if(_0x19c383[_0xeb18('0x9f')]===-0x1){return _0x19c383;}return this[_0xeb18('0xc')][_0xeb18('0xa5')](util[_0xeb18('0x25')](_0xeb18('0xc2'),_0xeb18('0x1c5'),_0x2d5fd3[_0xeb18('0x1c6')]));};AGIVertices[_0xeb18('0xf')][_0xeb18('0x1c7')]=function(_0x14d983){logger[_0xeb18('0x2a')](util[_0xeb18('0x25')](_0xeb18('0x1c8'),_0x14d983[_0xeb18('0x35')]));if(!this[_0xeb18('0x82')](_0x14d983[_0xeb18('0xd6')])){return this[_0xeb18('0xc')][_0xeb18('0x28')](_0x14d983,_0xeb18('0x1a6'));}var _0x34bbe0=this[_0xeb18('0x10')][_0xeb18('0x6c')](this,_0x14d983[_0xeb18('0xd6')]);if(!_0x34bbe0){return this[_0xeb18('0xc')][_0xeb18('0x28')](_0x14d983,_0xeb18('0xd8'));}var _0x30cd2c=this[_0xeb18('0xc')][_0xeb18('0x10')](_0x34bbe0);return{'code':0xc8,'result':_0x30cd2c[_0xeb18('0xa1')]?_0x30cd2c[_0xeb18('0xa1')]:'-'};};String[_0xeb18('0xf')]['replaceAll']=function(_0x397cb7,_0xfb92fb){return this[_0xeb18('0x9c')](_0x397cb7)[_0xeb18('0x1c9')](_0xfb92fb);};module[_0xeb18('0x1ca')]=AGIVertices; \ No newline at end of file +var _0xa3e6=['trunk_id','no\x20trunk\x20found','trunk_name','no\x20trunk\x20selected','finally','file_id','no\x20file\x20audio\x20selected','no\x20variable\x20selected\x20for\x20the\x20result','getData','maxdigit','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','amazonlex','Amazon\x20Lex\x20Result\x20%s','no\x20key\x20configured','wav','%s/recordings/%s','beep','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','appid','no\x20appsecret\x20configured','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','NOBEEP','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','no\x20find\x20by\x20configured','math','Enter\x20in\x20MATH\x20(%s)\x20block','no\x20operation\x20configured','operation','isArray','%s[%s]','menu','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20found','digit','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','getPause','playback','PLAYBACK','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','macro','gosub','QUEUE','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','Response:','inspect','200','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','saynumber','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','no\x20mail\x20account\x20found','email','user','bcc','subject','template_id','debug','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SET\x20(%s)\x20block','variable_value','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','subproject','no\x20subproject\x20selected','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','agi://%s/square,\x22%s\x22,\x22%s\x22','host','127.0.0.1','AGI','system','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','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','no\x20variable\x20selected','replaceAll','join','exports','util','shelljs','randomstring','moment','mustache','../../config/logger','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','getdigits','getsecretdigits','mailRpc','getVariable','rpc','getVariableById','then','name','prototype','getVoiceQueue','getVoiceQueueById','catch','getSquareProject','getSquareOdbc','dsn','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','map','Intervals','format','%s/sounds/converted/%s','getQueryOdbc','open','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','channel','uniqueid','label','arg_1','createSquareRecording','callerid','calleridname','context','extension','priority','accountcode','file','createSquareMessage','createCmContact','callback_','random','isEmpty','lastName','phone','list_id','scheduledAt','Callback\x20scheduled\x20at\x20','getPauseById','agentPause','agent','error','agentUnpause','isNil','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','method','timeout','includes','PUT','toUpperCase','body','parse','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','url','render','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusMessage','statusCode','message','options','googleDialogflow','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','private_key','sestekNDA','ispeechTTS','key','ispeech_tts_language','speed','ispeechASR','isConfigured','model','awsPolly','aws_secret_access_key','aws_polly_voice','aws_text_type','awsLex','aws_access_key_id','aws_lex_region','aws_bot_name','google_asr_language','tildeASR','appsecret','agicommand','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','%s.%s','length','saveRestApiResult','setVariable','stringify','split','toString','getAndSetVariable','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','extra','maxRetry','retry','noop','no\x20text\x20configured','exec','MRCPSynth','result','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','agi','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Wait\x20%s\x20seconds\x20before\x20answer','callback','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','add','callback_priority','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Executed\x20command\x20%s\x20%s','application','lumenvoxtts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','query','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20found','forEach','keys','%s[%s][%s]','variable\x20%s\x20set','dial','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','out','Dialogflow\x20Result\x20%s','speech','Dialogflow\x20is\x20unreachable','dialogflowV2','no\x20project_id\x20configured','client_email','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','ndauth_url','no\x20ndauth\x20url\x20configured','password','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','ext_dial'];(function(_0x3197f2,_0x1a0391){var _0x40a239=function(_0x196f2b){while(--_0x196f2b){_0x3197f2['push'](_0x3197f2['shift']());}};_0x40a239(++_0x1a0391);}(_0xa3e6,0xbe));var _0x6a3e=function(_0x541195,_0x2afc89){_0x541195=_0x541195-0x0;var _0x5ce29f=_0xa3e6[_0x541195];return _0x5ce29f;};'use strict';var fs=require('fs');var util=require(_0x6a3e('0x0'));var _=require('lodash');var sh=require(_0x6a3e('0x1'));var odbc=require('odbc')();var rs=require(_0x6a3e('0x2'));var moment=require(_0x6a3e('0x3'));var Mustache=require(_0x6a3e('0x4'));var rp=require('request-promise');var logger=require(_0x6a3e('0x5'))('agi');var config=require(_0x6a3e('0x6'));var scripts=require(_0x6a3e('0x7'));var FILES_PATH=_0x6a3e('0x8');var recursiveMapAttributes=[_0x6a3e('0x9'),_0x6a3e('0xa')];var verticesWithRetry=['menu',_0x6a3e('0xb'),_0x6a3e('0xc')];var AGIVertices=function(_0x5c3b9f,_0x4891ba,_0x2d2477){this['channel']=_0x5c3b9f;this['rpc']=_0x4891ba;this[_0x6a3e('0xd')]=_0x2d2477;};AGIVertices['prototype'][_0x6a3e('0xe')]=function(_0x55d25d,_0xd21a09){this[_0x6a3e('0xf')][_0x6a3e('0x10')](_0x55d25d)[_0x6a3e('0x11')](function(_0x412b70){_0xd21a09(null,_0x412b70?_0x412b70[_0x6a3e('0x12')]:![]);})['catch'](function(_0x27e169){_0xd21a09(_0x27e169);});};AGIVertices[_0x6a3e('0x13')][_0x6a3e('0x14')]=function(_0x336c5d,_0x1364be){this[_0x6a3e('0xf')][_0x6a3e('0x15')](_0x336c5d)['then'](function(_0x2e911b){_0x1364be(null,_0x2e911b?_0x2e911b[_0x6a3e('0x12')]:![]);})[_0x6a3e('0x16')](function(_0x2a62a8){_0x1364be(_0x2a62a8);});};AGIVertices['prototype'][_0x6a3e('0x17')]=function(_0x24666d,_0x5de9a7){this['rpc']['getSquareProjectById'](_0x24666d)['then'](function(_0x48adf6){_0x5de9a7(null,_0x48adf6?_0x48adf6[_0x6a3e('0x12')]:![]);})[_0x6a3e('0x16')](function(_0x31a190){_0x5de9a7(_0x31a190);});};AGIVertices[_0x6a3e('0x13')][_0x6a3e('0x18')]=function(_0xc3d167,_0x1d6ccc){this[_0x6a3e('0xf')]['getSquareOdbcById'](_0xc3d167)[_0x6a3e('0x11')](function(_0x58b7b9){_0x1d6ccc(null,_0x58b7b9?_0x58b7b9[_0x6a3e('0x19')]:![]);})['catch'](function(_0x16c5e4){_0x1d6ccc(_0x16c5e4);});};AGIVertices[_0x6a3e('0x13')][_0x6a3e('0x1a')]=function(_0x350b66,_0x58721c){this['rpc'][_0x6a3e('0x1b')](_0x350b66)[_0x6a3e('0x11')](function(_0x188dee){_0x58721c(null,_0x188dee?_0x188dee[_0x6a3e('0x12')]:![]);})[_0x6a3e('0x16')](function(_0x1ae966){_0x58721c(_0x1ae966);});};AGIVertices[_0x6a3e('0x13')][_0x6a3e('0x1c')]=function(_0x2f95e2,_0x42a70e){this[_0x6a3e('0xf')][_0x6a3e('0x1d')](_0x2f95e2)[_0x6a3e('0x11')](function(_0x25fc14){_0x42a70e(null,_0x25fc14?_0x25fc14[_0x6a3e('0x12')]:![]);})['catch'](function(_0x4ec834){_0x42a70e(_0x4ec834);});};AGIVertices[_0x6a3e('0x13')][_0x6a3e('0x1e')]=function(_0x13bdc3,_0x410d4b){var _0x254a0e=this;this[_0x6a3e('0xf')][_0x6a3e('0x1f')](_0x13bdc3)[_0x6a3e('0x11')](function(_0xd87198){_0x410d4b(null,_0xd87198?_0x254a0e[_0x6a3e('0x20')](_0xd87198[_0x6a3e('0x21')]):![]);})['catch'](function(_0x4eec67){_0x410d4b(_0x4eec67);});};AGIVertices[_0x6a3e('0x13')]['getMailAccount']=function(_0x46b13a,_0x5db820){this['rpc'][_0x6a3e('0x22')](_0x46b13a)[_0x6a3e('0x11')](function(_0x57bdd1){_0x5db820(null,_0x57bdd1?_0x57bdd1:![]);})['catch'](function(_0x30f62b){_0x5db820(_0x30f62b);});};AGIVertices[_0x6a3e('0x13')][_0x6a3e('0x23')]=function(_0x44951e,_0x584d44,_0x540146){this[_0x6a3e('0xd')][_0x6a3e('0x23')](_0x44951e,_0x584d44)[_0x6a3e('0x11')](function(){_0x540146(null);})[_0x6a3e('0x16')](function(_0x576400){_0x540146(_0x576400);});};AGIVertices[_0x6a3e('0x13')][_0x6a3e('0x24')]=function(_0x5022e2,_0x51e98c){this['rpc'][_0x6a3e('0x25')](_0x5022e2)[_0x6a3e('0x11')](function(_0xec468e){if(_0xec468e){if(_0xec468e[_0x6a3e('0x26')]){_0x51e98c(null,[_0xec468e[_0x6a3e('0x27')]]);}else{_0x51e98c(null,_[_0x6a3e('0x28')](_0xec468e[_0x6a3e('0x29')],_0x6a3e('0x27')));}}else{_0x51e98c(null,![]);}})[_0x6a3e('0x16')](function(_0x377226){_0x51e98c(_0x377226);});};AGIVertices[_0x6a3e('0x13')][_0x6a3e('0x20')]=function(_0x2d8ae3){return util[_0x6a3e('0x2a')](_0x6a3e('0x2b'),FILES_PATH,_0x2d8ae3);};AGIVertices['prototype'][_0x6a3e('0x2c')]=function(_0x38deb6,_0xda602f,_0x5cf995){odbc[_0x6a3e('0x2d')](_0x38deb6,function(_0x23de6d){if(_0x23de6d){logger['error'](_0x6a3e('0x2e'),_0x23de6d);_0x5cf995(_0x23de6d);}else{logger[_0x6a3e('0x2f')](_0x6a3e('0x30'));odbc['query'](_0xda602f,function(_0x18c335,_0x19fa39){if(_0x18c335){logger[_0x6a3e('0x2f')](_0x6a3e('0x31'),_0xda602f);_0x5cf995(_0x18c335);}else{logger[_0x6a3e('0x2f')](_0x6a3e('0x32'),_0xda602f);odbc['close'](function(_0x3931c3){if(_0x3931c3){logger['error']('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x3931c3);}_0x5cf995(null,_0x19fa39);});}});}});};AGIVertices['prototype'][_0x6a3e('0x33')]=function(_0x4bb1ba,_0x1a6b68){this[_0x6a3e('0xf')][_0x6a3e('0x34')](_0x4bb1ba)[_0x6a3e('0x11')](function(_0xca83d2){_0x1a6b68(null,_0xca83d2?_0xca83d2:![]);})[_0x6a3e('0x16')](function(_0x480981){_0x1a6b68(_0x480981);});};AGIVertices['prototype'][_0x6a3e('0x35')]=function(_0x331ab0,_0x2bb14a){this[_0x6a3e('0xf')][_0x6a3e('0x35')](_0x331ab0)['then'](function(_0xbba7c6){_0x2bb14a(null,_0xbba7c6);})[_0x6a3e('0x16')](function(_0x58acb6){_0x2bb14a(_0x58acb6);});};AGIVertices[_0x6a3e('0x13')][_0x6a3e('0x36')]=function(_0x35c836,_0x53ad48,_0xda81a4){this[_0x6a3e('0xf')][_0x6a3e('0x36')]({'uniqueid':this[_0x6a3e('0x37')][_0x6a3e('0x38')],'node':_0x35c836[_0x6a3e('0x39')],'application':_0x35c836['agicommand'],'data':_0x53ad48||null,'project_name':this[_0x6a3e('0x37')][_0x6a3e('0x3a')],'callerid':this[_0x6a3e('0x37')]['callerid']})[_0x6a3e('0x11')](function(_0x58f78f){if(_0xda81a4){_0xda81a4(null,_0x58f78f);}})['catch'](function(_0x1b801e){if(_0xda81a4){_0xda81a4(_0x1b801e);}});};AGIVertices[_0x6a3e('0x13')][_0x6a3e('0x3b')]=function(_0x590638,_0x57f699,_0x2ac42e,_0x1ec7ce){this[_0x6a3e('0xf')][_0x6a3e('0x3b')]({'uniqueid':this[_0x6a3e('0x37')][_0x6a3e('0x38')],'callerid':this['channel'][_0x6a3e('0x3c')],'calleridname':this[_0x6a3e('0x37')][_0x6a3e('0x3d')],'context':this[_0x6a3e('0x37')][_0x6a3e('0x3e')],'extension':this[_0x6a3e('0x37')][_0x6a3e('0x3f')],'priority':this[_0x6a3e('0x37')][_0x6a3e('0x40')],'accountcode':this['channel'][_0x6a3e('0x41')],'dnid':this[_0x6a3e('0x37')]['dnid'],'projectName':this[_0x6a3e('0x37')]['arg_1'],'saveName':_0x57f699,'filename':_0x590638[_0x6a3e('0x42')]||_0x57f699,'savePath':_0x2ac42e})[_0x6a3e('0x11')](function(_0x28a3e9){_0x1ec7ce(null,_0x28a3e9);})['catch'](function(_0x25fa0c){_0x1ec7ce(_0x25fa0c);});};AGIVertices[_0x6a3e('0x13')]['createSquareMessage']=function(_0x4adc4b,_0x4997d7,_0x2537b6,_0x17d05a,_0x32fb36){this[_0x6a3e('0xf')][_0x6a3e('0x43')]({'uniqueid':this[_0x6a3e('0x37')][_0x6a3e('0x38')],'body':_0x4adc4b,'direction':_0x4997d7,'providerName':_0x2537b6,'providerResponse':_0x17d05a})[_0x6a3e('0x11')](function(_0x4615fa){if(_0x32fb36){_0x32fb36(null,_0x4615fa);}})[_0x6a3e('0x16')](function(_0x15872d){if(_0x32fb36){_0x32fb36(_0x15872d);}});};AGIVertices['prototype'][_0x6a3e('0x44')]=function(_0x26373e,_0x3fabf8){this[_0x6a3e('0xf')][_0x6a3e('0x44')]({'firstName':_['isEmpty'](_0x26373e[_0x6a3e('0x12')])||_['isNil'](_0x26373e[_0x6a3e('0x12')])?_0x6a3e('0x45')+Math[_0x6a3e('0x46')]():_0x26373e[_0x6a3e('0x12')],'lastName':_[_0x6a3e('0x47')](_0x26373e['lastName'])||_['isNil'](_0x26373e['lastName'])?null:_0x26373e[_0x6a3e('0x48')],'phone':_0x26373e[_0x6a3e('0x49')],'ListId':_0x26373e[_0x6a3e('0x4a')],'scheduledat':_0x26373e[_0x6a3e('0x4b')],'callbackUniqueid':this[_0x6a3e('0x37')][_0x6a3e('0x38')],'tags':'callback','description':_0x6a3e('0x4c')+_0x26373e['scheduledAt']['toString'](),'priority':_0x26373e['callback_priority']})[_0x6a3e('0x11')](function(_0xa1e944){_0x3fabf8(null,_0xa1e944);})['catch'](function(_0x3046a6){_0x3fabf8(_0x3046a6);});};AGIVertices[_0x6a3e('0x13')]['getPause']=function(_0x29e8c5,_0x1faf88){this[_0x6a3e('0xf')][_0x6a3e('0x4d')](_0x29e8c5)[_0x6a3e('0x11')](function(_0x47dc3b){_0x1faf88(null,_0x47dc3b?_0x47dc3b[_0x6a3e('0x12')]:![]);})[_0x6a3e('0x16')](function(_0x51d5fb){_0x1faf88(_0x51d5fb);});};AGIVertices[_0x6a3e('0x13')][_0x6a3e('0x4e')]=function(_0xbfecf4,_0x2603e9,_0x6d143d){var _0x1028cf={'role':_0x6a3e('0x4f')};_0x1028cf[_0xbfecf4]=this[_0x6a3e('0x37')][_0x6a3e('0x3c')];this[_0x6a3e('0xf')][_0x6a3e('0x4e')](_0x1028cf,_0x2603e9,this['channel'][_0x6a3e('0x38')])[_0x6a3e('0x11')](function(_0x437a88){_0x6d143d(null,_['isNil'](_0x437a88)?![]:!![]);})[_0x6a3e('0x16')](function(_0xfbc991){logger[_0x6a3e('0x50')](_0xfbc991);_0x6d143d(null,![]);});};AGIVertices[_0x6a3e('0x13')]['agentUnpause']=function(_0x3e29a8,_0x5ed33d){var _0x4294d7={'role':'agent'};_0x4294d7[_0x3e29a8]=this[_0x6a3e('0x37')][_0x6a3e('0x3c')];this[_0x6a3e('0xf')][_0x6a3e('0x51')](_0x4294d7)[_0x6a3e('0x11')](function(_0x1abfd4){_0x5ed33d(null,_[_0x6a3e('0x52')](_0x1abfd4)?![]:!![]);})[_0x6a3e('0x16')](function(_0x1c42ce){logger['error'](_0x1c42ce);_0x5ed33d(null,![]);});};AGIVertices[_0x6a3e('0x13')][_0x6a3e('0x53')]=function(_0x29b4b2,_0x444b08){var _0x145655={'role':_0x6a3e('0x4f')};_0x145655[_0x29b4b2]=this[_0x6a3e('0x37')][_0x6a3e('0x3c')];this[_0x6a3e('0xf')][_0x6a3e('0x53')](_0x145655)[_0x6a3e('0x11')](function(_0x318fd9){_0x444b08(null,_['isNil'](_0x318fd9)?![]:!![]);})[_0x6a3e('0x16')](function(_0x40213e){logger[_0x6a3e('0x50')](_0x40213e);_0x444b08(null,![]);});};AGIVertices['prototype'][_0x6a3e('0x54')]=function(_0x5c349f,_0x3fe425){var _0xf8a75f={'role':'agent'};_0xf8a75f[_0x5c349f]=this[_0x6a3e('0x37')][_0x6a3e('0x3c')];var _0x4b158f=_0x5c349f!=_0x6a3e('0x55')?util[_0x6a3e('0x2a')](_0x6a3e('0x56'),_0x6a3e('0x57'),this[_0x6a3e('0x37')]['callerid']):undefined;this[_0x6a3e('0xf')]['agentLogin'](_0xf8a75f,_0x4b158f)[_0x6a3e('0x11')](function(_0x4e7d6d){_0x3fe425(null,_[_0x6a3e('0x52')](_0x4e7d6d)?![]:!![]);})[_0x6a3e('0x16')](function(_0x332966){logger[_0x6a3e('0x50')](_0x332966);_0x3fe425(null,![]);});};AGIVertices['prototype']['shellCommand']=function(_0x18718f,_0x309e1c){sh['exec'](_[_0x6a3e('0x58')](_0x18718f),function(_0x1e11dd,_0x3e5f88){var _0x7b8d96=_0x3e5f88[_0x6a3e('0x59')](/(\r\n|\n|\r)/gm,'');_0x309e1c(null,_0x7b8d96);});};AGIVertices['prototype']['googleCloudTTS']=function(_0x4429f1,_0x385ef1){scripts[_0x6a3e('0x5a')](_0x4429f1[_0x6a3e('0x5b')],_0x4429f1[_0x6a3e('0x5c')]||_0x6a3e('0x5d'),_0x4429f1['text'],_0x4429f1[_0x6a3e('0x5e')]||_0x6a3e('0x5f'),_0x4429f1[_0x6a3e('0x60')]||_0x6a3e('0x61'),_0x4429f1[_0x6a3e('0x62')]||_0x6a3e('0x63'))['then'](function(_0x4ad723){_0x385ef1(null,_0x4ad723);})[_0x6a3e('0x16')](function(_0x358f35){_0x385ef1(_0x358f35);});};AGIVertices[_0x6a3e('0x13')][_0x6a3e('0x64')]=function(_0x28af16,_0x24b3fb){scripts[_0x6a3e('0x64')](_0x28af16[_0x6a3e('0x5d')],_0x28af16[_0x6a3e('0x65')]||'en',0x1)['then'](function(_0xa1924c){_0x24b3fb(null,_0xa1924c);})[_0x6a3e('0x16')](function(_0x360c93){_0x24b3fb(_0x360c93);});};AGIVertices[_0x6a3e('0x13')][_0x6a3e('0x66')]=function(_0x281fba,_0x7e983a){var _0x687f86={'uri':_0x281fba['url'],'method':_0x281fba[_0x6a3e('0x67')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x281fba['timeout'])==='number'&&parseInt(_0x281fba[_0x6a3e('0x68')])>=0x1?parseInt(_0x281fba[_0x6a3e('0x68')])*0x3e8:0x5*0x3e8};if(_[_0x6a3e('0x69')](['POST',_0x6a3e('0x6a')],_0x687f86[_0x6a3e('0x67')][_0x6a3e('0x6b')]())){try{_0x687f86[_0x6a3e('0x6c')]=_0x281fba[_0x6a3e('0xa')]?JSON[_0x6a3e('0x6d')](_0x281fba[_0x6a3e('0xa')]):{};}catch(_0x47454a){logger[_0x6a3e('0x50')]('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0x47454a);}}try{_0x687f86[_0x6a3e('0x6e')]=_0x281fba[_0x6a3e('0x9')]?JSON[_0x6a3e('0x6d')](_0x281fba[_0x6a3e('0x9')]):{};}catch(_0x427b8e){logger[_0x6a3e('0x50')](_0x6a3e('0x6f'),_0x427b8e);}if(_0x281fba[_0x6a3e('0x70')]){try{var _0x30a60a=require(_0x281fba[_0x6a3e('0x70')])[_0x6a3e('0x71')](this,_0x687f86);_0x687f86['uri']=Mustache['render'](_0x281fba[_0x6a3e('0x72')],_0x30a60a,{},['$$','$$']);if(_0x687f86[_0x6a3e('0x6e')]){_0x687f86['headers']=JSON['parse'](Mustache[_0x6a3e('0x73')](JSON['stringify'](_0x687f86[_0x6a3e('0x6e')]),_0x30a60a,{},['$$','$$']));}if(_0x687f86[_0x6a3e('0x6c')]){_0x687f86[_0x6a3e('0x6c')]=JSON[_0x6a3e('0x6d')](Mustache[_0x6a3e('0x73')](JSON['stringify'](_0x687f86[_0x6a3e('0x6c')]),_0x30a60a,{},['$$','$$']));}}catch(_0x5bb624){logger[_0x6a3e('0x50')](_0x6a3e('0x74'),_0x5bb624);}}rp(_0x687f86)[_0x6a3e('0x11')](function(_0x2da87b){var _0x5c6598={'statusCode':_0x2da87b['statusCode']||0xc8,'statusMessage':_0x2da87b[_0x6a3e('0x75')]||'OK','headers':_0x2da87b[_0x6a3e('0x6e')]||{},'body':_0x2da87b[_0x6a3e('0x6c')]||{}};_0x7e983a(null,_0x5c6598);})[_0x6a3e('0x16')](function(_0x4f35ed){var _0x49901f={'statusCode':_0x4f35ed[_0x6a3e('0x76')]||0x1f4,'statusMessage':_0x4f35ed[_0x6a3e('0x77')]||'500\x20-\x20Internal\x20Server\x20Error','headers':_0x4f35ed[_0x6a3e('0x78')][_0x6a3e('0x6e')]||{},'body':_0x4f35ed[_0x6a3e('0x78')]['body']||{}};_0x7e983a(null,_0x49901f);});};AGIVertices['prototype'][_0x6a3e('0x79')]=function(_0xe89e40,_0x35cefc){scripts['googleDialogflow'](this[_0x6a3e('0x37')][_0x6a3e('0x38')],_0xe89e40['key'],_0xe89e40[_0x6a3e('0x5d')],_0xe89e40[_0x6a3e('0x7a')]||'en')[_0x6a3e('0x11')](function(_0x321388){_0x35cefc(null,_0x321388);})['catch'](function(_0x5d6d71){_0x35cefc(_0x5d6d71);});};AGIVertices['prototype']['googleDialogflowV2']=function(_0x515764,_0x32aefd){scripts[_0x6a3e('0x7b')](this[_0x6a3e('0x37')][_0x6a3e('0x38')],_0x515764[_0x6a3e('0x7c')],_0x515764['client_email'],_0x515764[_0x6a3e('0x7d')],_0x515764[_0x6a3e('0x5d')],_0x515764['dialogflowV2_language']||'en')['then'](function(_0x48b49a){_0x32aefd(null,_0x48b49a);})['catch'](function(_0x2f0aa6){_0x32aefd(_0x2f0aa6);});};AGIVertices['prototype'][_0x6a3e('0x7e')]=function(_0xab1e8d,_0x1e4b20){scripts['sestekNDA'](this[_0x6a3e('0x37')],_0xab1e8d)[_0x6a3e('0x11')](function(_0x6ad189){_0x1e4b20(null,_0x6ad189);})[_0x6a3e('0x16')](function(_0x3341c4){_0x1e4b20(_0x3341c4);});};AGIVertices[_0x6a3e('0x13')][_0x6a3e('0x7f')]=function(_0x2e88a3,_0x5e8334){scripts[_0x6a3e('0x7f')](_0x2e88a3[_0x6a3e('0x80')],_0x2e88a3['text'],_0x2e88a3[_0x6a3e('0x81')]||_0x6a3e('0x5f'),_0x2e88a3[_0x6a3e('0x82')])['then'](function(_0x20e765){_0x5e8334(null,_0x20e765);})[_0x6a3e('0x16')](function(_0x2efbdf){_0x5e8334(_0x2efbdf);});};AGIVertices[_0x6a3e('0x13')][_0x6a3e('0x83')]=function(_0xb8f9bc,_0x2fd299,_0x4692c6){scripts[_0x6a3e('0x83')](_0x2fd299,_0xb8f9bc['key'],_0xb8f9bc['ispeech_asr_language']||_0x6a3e('0x5f'),this[_0x6a3e('0x84')](_0xb8f9bc[_0x6a3e('0x85')])?_0xb8f9bc['model']:undefined)[_0x6a3e('0x11')](function(_0x4cef57){_0x4692c6(null,_0x4cef57);})[_0x6a3e('0x16')](function(_0x51ded2){_0x4692c6(_0x51ded2);});};AGIVertices[_0x6a3e('0x13')]['awsPolly']=function(_0xf24e7,_0x29022b){scripts[_0x6a3e('0x86')](_0xf24e7['aws_access_key_id'],_0xf24e7[_0x6a3e('0x87')],_0xf24e7['aws_polly_region'],_0xf24e7[_0x6a3e('0x88')]||'Amy',_0xf24e7[_0x6a3e('0x5d')],_0xf24e7[_0x6a3e('0x89')]||_0x6a3e('0x5d'))[_0x6a3e('0x11')](function(_0x404c55){_0x29022b(null,_0x404c55);})[_0x6a3e('0x16')](function(_0x12aee6){_0x29022b(_0x12aee6);});};AGIVertices['prototype'][_0x6a3e('0x8a')]=function(_0xb4cb8c,_0x5b0482){scripts[_0x6a3e('0x8a')](this[_0x6a3e('0x37')][_0x6a3e('0x38')],_0xb4cb8c[_0x6a3e('0x8b')],_0xb4cb8c[_0x6a3e('0x87')],_0xb4cb8c[_0x6a3e('0x8c')],_0xb4cb8c['text'],_0xb4cb8c[_0x6a3e('0x8d')])['then'](function(_0x5b6904){_0x5b0482(null,_0x5b6904);})[_0x6a3e('0x16')](function(_0x467af8){_0x5b0482(_0x467af8);});};AGIVertices[_0x6a3e('0x13')]['googleASR']=function(_0x59fb89,_0x265cd8,_0x52624b){scripts['googleASR'](_0x265cd8,_0x59fb89['key'],_0x59fb89[_0x6a3e('0x8e')]||_0x6a3e('0x5f'))[_0x6a3e('0x11')](function(_0x34cb60){_0x52624b(null,_0x34cb60);})['catch'](function(_0x266f3d){_0x52624b(_0x266f3d);});};AGIVertices[_0x6a3e('0x13')][_0x6a3e('0x8f')]=function(_0x4ab935,_0x3faf57,_0x4f27f3){scripts[_0x6a3e('0x8f')](_0x3faf57,_0x4ab935['appid'],_0x4ab935[_0x6a3e('0x90')],_0x4ab935['uri'])[_0x6a3e('0x11')](function(_0x334a81){_0x4f27f3(null,_0x334a81);})[_0x6a3e('0x16')](function(_0x7d37f1){_0x4f27f3(_0x7d37f1);});};AGIVertices[_0x6a3e('0x13')]['clear']=function(_0x137dbe){var _0x156511=_[_0x6a3e('0x69')](verticesWithRetry,_0x137dbe[_0x6a3e('0x91')])?_0x137dbe:_[_0x6a3e('0x92')](_0x137dbe);for(var _0x2ae05e in _0x156511){if(_0x156511[_0x6a3e('0x93')](_0x2ae05e)){if(_0x156511[_0x2ae05e]&&_[_0x6a3e('0x94')](_0x156511[_0x2ae05e])){if(_[_0x6a3e('0x69')](recursiveMapAttributes,_0x2ae05e)){_0x156511[_0x2ae05e]=this[_0x6a3e('0x95')](_0x156511[_0x2ae05e]);}else{_0x156511[_0x2ae05e]=this[_0x6a3e('0x96')](_0x156511[_0x2ae05e]);}}}}return _0x156511;};AGIVertices['prototype'][_0x6a3e('0x97')]=function(_0x5e3093){for(var _0x568426 in _0x5e3093){if(_0x5e3093[_0x6a3e('0x93')](_0x568426)){if(_['isPlainObject'](_0x5e3093[_0x568426])){this['recursiveNodeIndex'](_0x5e3093[_0x568426]);}else if(_['isArray'](_0x5e3093[_0x568426])){for(var _0x38519a=0x0;_0x38519a<_0x5e3093[_0x568426]['length'];_0x38519a++){this[_0x6a3e('0x97')](_0x5e3093[_0x568426][_0x38519a]);}}else if(_[_0x6a3e('0x94')](_0x5e3093[_0x568426])){_0x5e3093[_0x568426]=this[_0x6a3e('0x96')](_0x5e3093[_0x568426]);}}}};AGIVertices[_0x6a3e('0x13')]['saveRestApiResult']=function(_0xe6ea77,_0x28175b){for(var _0x4306f2 in _0xe6ea77){if(_0xe6ea77[_0x6a3e('0x93')](_0x4306f2)){if(_[_0x6a3e('0x98')](_0xe6ea77[_0x4306f2])){if(!_[_0x6a3e('0x47')](_0xe6ea77[_0x4306f2])){this['saveRestApiResult'](_0xe6ea77[_0x4306f2],util[_0x6a3e('0x2a')](_0x6a3e('0x99'),_0x28175b,_0x4306f2));}}else if(_['isArray'](_0xe6ea77[_0x4306f2])){for(var _0x5220fc=0x0;_0x5220fc<_0xe6ea77[_0x4306f2][_0x6a3e('0x9a')];_0x5220fc++){this[_0x6a3e('0x9b')](_0xe6ea77[_0x4306f2][_0x5220fc],util[_0x6a3e('0x2a')](_0x6a3e('0x99'),_0x28175b,_0x4306f2+'['+_0x5220fc+']'));}}else{if(!_[_0x6a3e('0x52')](_0xe6ea77[_0x4306f2])){this[_0x6a3e('0x37')][_0x6a3e('0x9c')](util['format']('%s.%s',_0x28175b,_0x4306f2),_0xe6ea77[_0x4306f2]);}}}}};AGIVertices[_0x6a3e('0x13')][_0x6a3e('0x95')]=function(_0x5f4dfc){try{var _0x7a96c=JSON[_0x6a3e('0x6d')](_0x5f4dfc);this['recursiveNodeIndex'](_0x7a96c);return JSON[_0x6a3e('0x9d')](_0x7a96c);}catch(_0x2a4d0f){return this[_0x6a3e('0x96')](_0x5f4dfc);}};AGIVertices['prototype'][_0x6a3e('0x96')]=function(_0xf6a96e){var _0x359ad4=_0xf6a96e[_0x6a3e('0x9e')]('{');for(var _0x13e5ba=0x1;_0x13e5ba<_0x359ad4[_0x6a3e('0x9a')];_0x13e5ba+=0x1){var _0x264317=_0x359ad4[_0x13e5ba][_0x6a3e('0x9e')]('}');if(_0x264317['length']>0x1){_0xf6a96e=_0xf6a96e['replaceAll']('{'+_0x264317[0x0]+'}',this[_0x6a3e('0x37')][_0x6a3e('0xe')](_0x264317[0x0])['extra']||_0x264317[0x0]);}}if(_0x359ad4[_0x6a3e('0x9a')]===0x1){return _0xf6a96e[_0x6a3e('0x9f')]();}return this[_0x6a3e('0x96')](_0xf6a96e);};AGIVertices['prototype'][_0x6a3e('0xa0')]=function(_0x512871,_0x579e32){var _0x3ef55e=this[_0x6a3e('0x37')][_0x6a3e('0xe')](_0x512871);if(_0x3ef55e['result']===-0x1){return _0x3ef55e;}logger[_0x6a3e('0x2f')](util[_0x6a3e('0x2a')](_0x6a3e('0xa1'),_0x579e32,_0x3ef55e['extra']));return this[_0x6a3e('0x37')]['setVariable'](_0x579e32,_0x3ef55e[_0x6a3e('0xa2')]);};AGIVertices[_0x6a3e('0x13')][_0x6a3e('0x84')]=function(_0x7ae8b){return _0x7ae8b&&_0x7ae8b!=='0'&&_0x7ae8b!=='-1'&&_0x7ae8b!=='';};AGIVertices[_0x6a3e('0x13')][_0x6a3e('0xa3')]=function(_0xf95236){this['createSquareDetailsReport'][_0x6a3e('0x71')](this,_0xf95236,'-');_0xf95236[_0x6a3e('0xa4')]=_0xf95236[_0x6a3e('0xa3')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x6a3e('0x13')]['mrcpsynth']=function(_0x172817){logger[_0x6a3e('0x2f')](util[_0x6a3e('0x2a')]('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x172817[_0x6a3e('0x39')]));if(!this['isConfigured'](_0x172817[_0x6a3e('0x5d')])){return this[_0x6a3e('0x37')][_0x6a3e('0xa5')](_0x6a3e('0xa6'));}var _0x1ff611='\x22'+_0x172817['text']+'\x22';if(this[_0x6a3e('0x84')](_0x172817[_0x6a3e('0x78')])){_0x1ff611+=','+_0x172817['options'];}var _0x2c29dd=this[_0x6a3e('0x37')][_0x6a3e('0xa7')](_0x6a3e('0xa8'),_0x1ff611);if(_0x2c29dd[_0x6a3e('0xa9')]===-0x1){return _0x2c29dd;}return this['channel'][_0x6a3e('0xa5')](util[_0x6a3e('0x2a')](_0x6a3e('0xaa'),_0x1ff611));};AGIVertices[_0x6a3e('0x13')][_0x6a3e('0xab')]=function(_0x2a31b5){logger[_0x6a3e('0x2f')](util['format'](_0x6a3e('0xac'),_0x2a31b5[_0x6a3e('0x39')]));if(!this[_0x6a3e('0x84')](_0x2a31b5[_0x6a3e('0xad')])){return this[_0x6a3e('0x37')]['noop'](_0x6a3e('0xae'));}var _0xc2ca58=_0x2a31b5[_0x6a3e('0xad')];if(this['isConfigured'](_0x2a31b5[_0x6a3e('0x78')])){_0xc2ca58+=','+_0x2a31b5[_0x6a3e('0x78')];}var _0x128f27=this[_0x6a3e('0x37')][_0x6a3e('0xa7')](_0x6a3e('0xaf'),_0xc2ca58);if(_0x128f27[_0x6a3e('0xa9')]===-0x1){return _0x128f27;}var _0x36a6ed=this[_0x6a3e('0xa0')](_0x6a3e('0xb0'),_0x6a3e('0xb1'));if(_0x36a6ed[_0x6a3e('0xa9')]===-0x1){return _0x36a6ed;}var _0x3314e0=this[_0x6a3e('0xa0')](_0x6a3e('0xb2'),_0x6a3e('0xb3'));if(_0x3314e0[_0x6a3e('0xa9')]===-0x1){return _0x3314e0;}var _0x250806=this[_0x6a3e('0xa0')](_0x6a3e('0xb4'),'MRCP_RECOG_INSTANCE');if(_0x250806[_0x6a3e('0xa9')]===-0x1){return _0x250806;}return this[_0x6a3e('0x37')][_0x6a3e('0xa5')](util[_0x6a3e('0x2a')]('Executed\x20command\x20MRCPRecog\x20%s',_0xc2ca58));};AGIVertices[_0x6a3e('0x13')][_0x6a3e('0xb5')]=function(_0x439bed){logger[_0x6a3e('0x2f')](util[_0x6a3e('0x2a')](_0x6a3e('0xb6'),_0x439bed[_0x6a3e('0x39')]));return this[_0x6a3e('0x37')][_0x6a3e('0xb5')]([_0x439bed[_0x6a3e('0xb7')],_0x439bed[_0x6a3e('0xb8')]]);};AGIVertices[_0x6a3e('0x13')][_0x6a3e('0xb9')]=function(_0x2590b0){logger[_0x6a3e('0x2f')](util[_0x6a3e('0x2a')]('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x2590b0[_0x6a3e('0x39')]));if(this['isConfigured'](_0x2590b0['timeout'])){logger['info'](util[_0x6a3e('0x2a')](_0x6a3e('0xba'),_0x2590b0[_0x6a3e('0x68')]));var _0x1602c4=this[_0x6a3e('0x37')]['wait'](_0x2590b0[_0x6a3e('0x68')]);if(_0x1602c4[_0x6a3e('0xa9')]===-0x1){return _0x1602c4;}}return this[_0x6a3e('0x37')]['answer']();};AGIVertices[_0x6a3e('0x13')][_0x6a3e('0xbb')]=function(_0x45eca4){logger[_0x6a3e('0x2f')](util[_0x6a3e('0x2a')](_0x6a3e('0xbc'),_0x45eca4[_0x6a3e('0x39')]));if(!this['isConfigured'](_0x45eca4[_0x6a3e('0x4a')])){return this[_0x6a3e('0x37')]['error'](_0x45eca4,_0x6a3e('0xbd'));}_0x45eca4[_0x6a3e('0x4b')]=moment();if(this[_0x6a3e('0x84')](_0x45eca4[_0x6a3e('0xbe')])){_0x45eca4[_0x6a3e('0x4b')]=moment()[_0x6a3e('0xbf')](_0x45eca4['delay'],'minutes');}if(!this[_0x6a3e('0x84')](_0x45eca4[_0x6a3e('0xc0')])){_0x45eca4['callback_priority']=0x2;}this[_0x6a3e('0x44')][_0x6a3e('0x71')](this,_0x45eca4);return this[_0x6a3e('0x37')]['noop'](util[_0x6a3e('0x2a')](_0x6a3e('0xc1'),_0x45eca4[_0x6a3e('0x49')],_0x45eca4['list_id'],_0x45eca4[_0x6a3e('0x4b')]));};AGIVertices[_0x6a3e('0x13')][_0x6a3e('0xc2')]=function(_0x1671c8){logger[_0x6a3e('0x2f')](util[_0x6a3e('0x2a')]('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x1671c8[_0x6a3e('0x39')]));var _0x24a252=this['channel'][_0x6a3e('0xa7')](_0x1671c8['application'],_0x1671c8['options']);if(_0x24a252[_0x6a3e('0xa9')]===-0x1){return _0x24a252;}return this['channel'][_0x6a3e('0xa5')](util[_0x6a3e('0x2a')](_0x6a3e('0xc3'),_0x1671c8[_0x6a3e('0xc4')],_0x1671c8[_0x6a3e('0x78')]));};AGIVertices[_0x6a3e('0x13')][_0x6a3e('0xc5')]=function(_0x5e0119){logger['info'](util[_0x6a3e('0x2a')]('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0x5e0119[_0x6a3e('0x39')]));if(!this[_0x6a3e('0x84')](_0x5e0119[_0x6a3e('0x5d')])){return this[_0x6a3e('0x37')]['noop']('no\x20text\x20configured');}var _0x1db060='\x22'+_0x5e0119[_0x6a3e('0x5d')]+'\x22';if(this[_0x6a3e('0x84')](_0x5e0119[_0x6a3e('0x78')])){_0x1db060+=','+_0x5e0119[_0x6a3e('0x78')];}var _0x542e71=this['channel'][_0x6a3e('0xa7')](_0x6a3e('0xa8'),_0x1db060);if(_0x542e71['result']===-0x1){return _0x542e71;}return this[_0x6a3e('0x37')][_0x6a3e('0xa5')](util[_0x6a3e('0x2a')](_0x6a3e('0xaa'),_0x1db060));};AGIVertices[_0x6a3e('0x13')]['sestektts']=function(_0x29441b){logger[_0x6a3e('0x2f')](util[_0x6a3e('0x2a')](_0x6a3e('0xc6'),_0x29441b[_0x6a3e('0x39')]));if(!this[_0x6a3e('0x84')](_0x29441b[_0x6a3e('0x5d')])){return this['channel']['noop'](_0x6a3e('0xa6'));}var _0xeb3314='\x22'+_0x29441b['text']+'\x22';if(this['isConfigured'](_0x29441b[_0x6a3e('0x78')])){_0xeb3314+=','+_0x29441b[_0x6a3e('0x78')];}var _0x2d19cf=this[_0x6a3e('0x37')][_0x6a3e('0xa7')](_0x6a3e('0xa8'),_0xeb3314);if(_0x2d19cf['result']===-0x1){return _0x2d19cf;}return this[_0x6a3e('0x37')][_0x6a3e('0xa5')](util[_0x6a3e('0x2a')](_0x6a3e('0xaa'),_0xeb3314));};AGIVertices[_0x6a3e('0x13')][_0x6a3e('0xc7')]=function(_0x2f2d9f){logger[_0x6a3e('0x2f')](util['format'](_0x6a3e('0xc8'),_0x2f2d9f['label']));if(!this[_0x6a3e('0x84')](_0x2f2d9f[_0x6a3e('0xad')])){return this[_0x6a3e('0x37')][_0x6a3e('0xa5')](_0x6a3e('0xae'));}var _0x5a0256=_0x2f2d9f[_0x6a3e('0xad')];if(this[_0x6a3e('0x84')](_0x2f2d9f[_0x6a3e('0x78')])){_0x5a0256+=','+_0x2f2d9f['options'];}var _0x399bc6=this['channel']['exec']('MRCPRecog',_0x5a0256);if(_0x399bc6[_0x6a3e('0xa9')]===-0x1){return _0x399bc6;}var _0x73b270=this[_0x6a3e('0xa0')](_0x6a3e('0xb0'),'LUMENVOX_ASR_CONFIDENCE');if(_0x73b270[_0x6a3e('0xa9')]===-0x1){return _0x73b270;}var _0x12203f=this['getAndSetVariable'](_0x6a3e('0xb2'),'LUMENVOX_ASR_TRANSCRIPT');if(_0x12203f['result']===-0x1){return _0x12203f;}var _0xc60972=this['getAndSetVariable'](_0x6a3e('0xb4'),_0x6a3e('0xc9'));if(_0xc60972['result']===-0x1){return _0xc60972;}return this[_0x6a3e('0x37')][_0x6a3e('0xa5')](util[_0x6a3e('0x2a')](_0x6a3e('0xca'),_0x5a0256));};AGIVertices[_0x6a3e('0x13')]['sestekasr']=function(_0x13f23a){logger['info'](util['format'](_0x6a3e('0xcb'),_0x13f23a[_0x6a3e('0x39')]));if(!this['isConfigured'](_0x13f23a[_0x6a3e('0xad')])){return this[_0x6a3e('0x37')][_0x6a3e('0xa5')](_0x6a3e('0xae'));}var _0x2743eb=_0x13f23a[_0x6a3e('0xad')];if(this[_0x6a3e('0x84')](_0x13f23a[_0x6a3e('0x78')])){_0x2743eb+=','+_0x13f23a['options'];}var _0x126a70=this[_0x6a3e('0x37')]['exec'](_0x6a3e('0xaf'),_0x2743eb);if(_0x126a70['result']===-0x1){return _0x126a70;}var _0x4b04e0=this[_0x6a3e('0xa0')](_0x6a3e('0xb0'),'SESTEK_ASR_CONFIDENCE');if(_0x4b04e0['result']===-0x1){return _0x4b04e0;}var _0x3dccc5=this['getAndSetVariable']('RECOG_INPUT()',_0x6a3e('0xcc'));if(_0x3dccc5[_0x6a3e('0xa9')]===-0x1){return _0x3dccc5;}var _0x2ad9a5=this[_0x6a3e('0xa0')]('RECOG_INSTANCE()',_0x6a3e('0xcd'));if(_0x2ad9a5['result']===-0x1){return _0x2ad9a5;}return this[_0x6a3e('0x37')][_0x6a3e('0xa5')](util['format'](_0x6a3e('0xca'),_0x2743eb));};AGIVertices[_0x6a3e('0x13')][_0x6a3e('0xce')]=function(_0x1a7429){logger[_0x6a3e('0x2f')](util[_0x6a3e('0x2a')](_0x6a3e('0xcf'),_0x1a7429[_0x6a3e('0x39')]));if(!this[_0x6a3e('0x84')](_0x1a7429[_0x6a3e('0xd0')])){return this['channel'][_0x6a3e('0x50')](_0x1a7429,_0x6a3e('0xd1'));}var _0x892f9f=this[_0x6a3e('0x18')][_0x6a3e('0x71')](this,_0x1a7429[_0x6a3e('0xd0')]);if(!_0x892f9f){return this[_0x6a3e('0x37')]['error'](_0x1a7429,_0x6a3e('0xd2'));}if(!this['isConfigured'](_0x1a7429[_0x6a3e('0xd3')])){return this[_0x6a3e('0x37')]['error'](_0x1a7429,_0x6a3e('0xd4'));}var _0x1a6b5c=_0x1a7429[_0x6a3e('0xd3')][_0x6a3e('0x59')](/(\r\n|\n|\r)/gm,'\x20');this[_0x6a3e('0x37')]['noop'](util[_0x6a3e('0x2a')](_0x6a3e('0xd5'),_0x1a6b5c));var _0xf4c540=this[_0x6a3e('0x2c')][_0x6a3e('0x71')](this,_0x892f9f,_0x1a6b5c);this[_0x6a3e('0x36')][_0x6a3e('0x71')](this,_0x1a7429,_0x1a6b5c);if(!this['isConfigured'](_0x1a7429[_0x6a3e('0xd6')])){return this[_0x6a3e('0x37')][_0x6a3e('0xa5')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x58e7ed=this['getVariable'][_0x6a3e('0x71')](this,_0x1a7429['variable_id']);if(!_0x58e7ed){return this[_0x6a3e('0x37')][_0x6a3e('0x50')](_0x1a7429,_0x6a3e('0xd7'));}var _0x5c29ea=this;_0xf4c540[_0x6a3e('0xd8')](function(_0x161ca1,_0x25c96b){Object[_0x6a3e('0xd9')](_0x161ca1)[_0x6a3e('0xd8')](function(_0x15e6ba){_0x5c29ea['channel'][_0x6a3e('0x9c')](util[_0x6a3e('0x2a')](_0x6a3e('0xda'),_0x58e7ed,_0x25c96b,_0x15e6ba),_0x161ca1[_0x15e6ba]);});});this[_0x6a3e('0x37')]['setVariable'](util[_0x6a3e('0x2a')]('%s_ROWS_COUNT',_0x58e7ed),_0xf4c540['length']);return this[_0x6a3e('0x37')][_0x6a3e('0xa5')](util[_0x6a3e('0x2a')](_0x6a3e('0xdb'),_0x58e7ed));};AGIVertices['prototype'][_0x6a3e('0xdc')]=function(_0xc9843d){logger['debug'](util['format']('Enter\x20in\x20DIAL\x20(%s)\x20block',_0xc9843d[_0x6a3e('0x39')]));if(!this[_0x6a3e('0x84')](_0xc9843d[_0x6a3e('0xdd')])){return this[_0x6a3e('0x37')][_0x6a3e('0x50')](_0xc9843d,_0x6a3e('0xde'));}var _0x2da866=this[_0x6a3e('0x1a')][_0x6a3e('0x71')](this,_0xc9843d[_0x6a3e('0xdd')]);if(!_0x2da866){return this[_0x6a3e('0x37')][_0x6a3e('0x50')](_0xc9843d,_0x6a3e('0xdf'));}var _0x454fe3=this[_0x6a3e('0x37')][_0x6a3e('0xa7')](_0x6a3e('0xe0'),[util[_0x6a3e('0x2a')](_0x6a3e('0xe1'),_0x2da866),_0xc9843d['timeout'],_0xc9843d[_0x6a3e('0xe2')],_0xc9843d[_0x6a3e('0x72')]]);if(_0x454fe3['result']===-0x1){return _0x454fe3;}return this['channel']['noop'](util['format'](_0x6a3e('0xe3'),'DIAL'));};AGIVertices[_0x6a3e('0x13')][_0x6a3e('0xe4')]=function(_0x2b5c99){logger[_0x6a3e('0x2f')](util[_0x6a3e('0x2a')](_0x6a3e('0xe5'),_0x2b5c99['label']));if(!this[_0x6a3e('0x84')](_0x2b5c99[_0x6a3e('0x80')])){return this[_0x6a3e('0x37')][_0x6a3e('0xa5')]('no\x20key\x20configured');}if(!this[_0x6a3e('0x84')](_0x2b5c99[_0x6a3e('0x5d')])){return this[_0x6a3e('0x37')]['noop'](_0x6a3e('0xa6'));}this[_0x6a3e('0x37')][_0x6a3e('0xe6')]=!![];this[_0x6a3e('0x36')](_0x2b5c99);this['createSquareMessage'](_0x2b5c99[_0x6a3e('0x5d')],'in','','');this[_0x6a3e('0x37')][_0x6a3e('0xa5')](util[_0x6a3e('0x2a')](_0x6a3e('0xe7'),_0x2b5c99[_0x6a3e('0x5d')]));var _0x481f96=this[_0x6a3e('0x79')][_0x6a3e('0x71')](this,_0x2b5c99);if(_0x481f96){for(var _0x5d94ca in _0x481f96){if(_0x481f96['hasOwnProperty'](_0x5d94ca)){this[_0x6a3e('0x37')][_0x6a3e('0x9c')](util[_0x6a3e('0x2a')](_0x6a3e('0xe8'),_0x5d94ca[_0x6a3e('0x6b')]()),_0x481f96[_0x5d94ca]);}}this[_0x6a3e('0x43')](_0x481f96['speech'],_0x6a3e('0xe9'),_0x6a3e('0xe4'),'');return this[_0x6a3e('0x37')][_0x6a3e('0xa5')](util[_0x6a3e('0x2a')](_0x6a3e('0xea'),_0x481f96[_0x6a3e('0xeb')]));}return this[_0x6a3e('0x37')][_0x6a3e('0x50')](_0x2b5c99,_0x6a3e('0xec'));};AGIVertices['prototype'][_0x6a3e('0xed')]=function(_0x43a0f5){logger[_0x6a3e('0x2f')](util[_0x6a3e('0x2a')]('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x43a0f5[_0x6a3e('0x39')]));if(!this[_0x6a3e('0x84')](_0x43a0f5[_0x6a3e('0x7c')])){return this['channel']['noop'](_0x6a3e('0xee'));}if(!this[_0x6a3e('0x84')](_0x43a0f5[_0x6a3e('0xef')])){return this[_0x6a3e('0x37')][_0x6a3e('0xa5')](_0x6a3e('0xf0'));}if(!this[_0x6a3e('0x84')](_0x43a0f5['private_key'])){return this['channel'][_0x6a3e('0xa5')](_0x6a3e('0xf1'));}if(!this['isConfigured'](_0x43a0f5['dialogflowV2_language'])){return this[_0x6a3e('0x37')]['noop'](_0x6a3e('0xf2'));}if(!this['isConfigured'](_0x43a0f5[_0x6a3e('0x5d')])){return this[_0x6a3e('0x37')]['noop']('no\x20text\x20configured');}this[_0x6a3e('0x37')][_0x6a3e('0xe6')]=!![];this[_0x6a3e('0x36')](_0x43a0f5);this[_0x6a3e('0x43')](_0x43a0f5[_0x6a3e('0x5d')],'in','','');this['channel']['noop'](util[_0x6a3e('0x2a')](_0x6a3e('0xf3'),_0x43a0f5[_0x6a3e('0x5d')]));var _0x49ae0b=this[_0x6a3e('0x7b')][_0x6a3e('0x71')](this,_0x43a0f5);if(_0x49ae0b){for(var _0x360cb6 in _0x49ae0b){if(_0x49ae0b[_0x6a3e('0x93')](_0x360cb6)){if(_0x360cb6!=='providerResponse'){this[_0x6a3e('0x37')][_0x6a3e('0x9c')](util[_0x6a3e('0x2a')](_0x6a3e('0xe8'),_0x360cb6[_0x6a3e('0x6b')]()),_0x49ae0b[_0x360cb6]);}}}this[_0x6a3e('0x43')](_0x49ae0b[_0x6a3e('0xeb')],_0x6a3e('0xe9'),_0x6a3e('0xed'),_0x49ae0b[_0x6a3e('0xf4')]);return this[_0x6a3e('0x37')][_0x6a3e('0xa5')](util['format'](_0x6a3e('0xf5'),_0x49ae0b[_0x6a3e('0xeb')]));}return this['channel'][_0x6a3e('0x50')](_0x43a0f5,_0x6a3e('0xf6'));};AGIVertices['prototype'][_0x6a3e('0xf7')]=function(_0x47a776){logger[_0x6a3e('0x2f')](util[_0x6a3e('0x2a')]('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x47a776[_0x6a3e('0x39')]));if(!this[_0x6a3e('0x84')](_0x47a776[_0x6a3e('0xf8')])){return this[_0x6a3e('0x37')]['noop'](_0x6a3e('0xf9'));}if(!this[_0x6a3e('0x84')](_0x47a776['username'])){return this[_0x6a3e('0x37')]['noop']('no\x20username\x20configured');}if(!this[_0x6a3e('0x84')](_0x47a776[_0x6a3e('0xfa')])){return this[_0x6a3e('0x37')]['noop']('no\x20password\x20configured');}if(!this['isConfigured'](_0x47a776['ndassistant_url'])){return this[_0x6a3e('0x37')]['noop']('no\x20text\x20configured');}this['channel'][_0x6a3e('0xe6')]=!![];this['createSquareDetailsReport'](_0x47a776);this[_0x6a3e('0x43')](_0x47a776[_0x6a3e('0x5d')],'in','','');this[_0x6a3e('0x37')]['noop'](util[_0x6a3e('0x2a')](_0x6a3e('0xfb'),_0x47a776[_0x6a3e('0x5d')]));var _0x3b3a99=this[_0x6a3e('0x7e')][_0x6a3e('0x71')](this,_0x47a776);if(_0x3b3a99){for(var _0x2252d7 in _0x3b3a99){if(_0x3b3a99[_0x6a3e('0x93')](_0x2252d7)){this[_0x6a3e('0x37')][_0x6a3e('0x9c')](util[_0x6a3e('0x2a')](_0x6a3e('0xfc'),_0x2252d7[_0x6a3e('0x6b')]()),_0x3b3a99[_0x2252d7]);}}this[_0x6a3e('0x43')](_0x3b3a99['speech'],_0x6a3e('0xe9'),_0x6a3e('0xf7'),'');if(_0x3b3a99[_0x6a3e('0xfd')]){this[_0x6a3e('0x37')]['noop'](util[_0x6a3e('0x2a')](_0x6a3e('0xfe'),_0x3b3a99[_0x6a3e('0xfd')]));var _0x39310d=this[_0x6a3e('0x37')][_0x6a3e('0xff')](_0x3b3a99[_0x6a3e('0xfd')]);try{fs[_0x6a3e('0x100')](_0x3b3a99[_0x6a3e('0xfd')]+_0x6a3e('0x101'));}catch(_0x3b648f){logger[_0x6a3e('0x50')](_0x3b648f);}return _0x39310d;}else{return this[_0x6a3e('0x37')][_0x6a3e('0xa5')](util[_0x6a3e('0x2a')](_0x6a3e('0x102'),_0x3b3a99[_0x6a3e('0xeb')]));}}return this[_0x6a3e('0x37')][_0x6a3e('0x50')](_0x47a776,_0x6a3e('0x103'));};AGIVertices[_0x6a3e('0x13')][_0x6a3e('0x104')]=function(_0x383ffb){logger['info'](util[_0x6a3e('0x2a')]('Enter\x20in\x20END\x20(%s)\x20block',_0x383ffb[_0x6a3e('0x39')]));return this[_0x6a3e('0x37')][_0x6a3e('0xa5')]('end');};AGIVertices[_0x6a3e('0x13')][_0x6a3e('0x105')]=function(_0x3792b6){logger[_0x6a3e('0x2f')](util[_0x6a3e('0x2a')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x3792b6[_0x6a3e('0x39')]));var _0x19bad5='';if(_0x3792b6[_0x6a3e('0x106')]){if(!this[_0x6a3e('0x84')](_0x3792b6[_0x6a3e('0x106')])){return this[_0x6a3e('0x37')][_0x6a3e('0x50')](_0x3792b6,'no\x20trunk\x20selected');}else{var _0x407a55=parseInt(_0x3792b6['trunk_id'],0xa);if(isNaN(_0x407a55)){_0x19bad5=_0x3792b6['trunk_id'];}else{_0x19bad5=this['getTrunk'][_0x6a3e('0x71')](this,_0x3792b6[_0x6a3e('0x106')]);if(!_0x19bad5){return this[_0x6a3e('0x37')][_0x6a3e('0x50')](_0x3792b6,_0x6a3e('0x107'));}}}}else if(_0x3792b6[_0x6a3e('0x108')]){_0x19bad5=_0x3792b6['trunk_name'];}else{return this[_0x6a3e('0x37')][_0x6a3e('0x50')](_0x3792b6,_0x6a3e('0x109'));}var _0x54bb7e=this[_0x6a3e('0x37')][_0x6a3e('0xa7')](_0x6a3e('0xe0'),[util['format']('SIP/%s/%s',_0x19bad5,_0x3792b6[_0x6a3e('0x49')]),_0x3792b6[_0x6a3e('0x68')],_0x3792b6[_0x6a3e('0xe2')],_0x3792b6[_0x6a3e('0x72')]]);if(_0x54bb7e[_0x6a3e('0xa9')]===-0x1){return _0x54bb7e;}return this[_0x6a3e('0x37')][_0x6a3e('0xa5')](util['format'](_0x6a3e('0xe3'),_0x6a3e('0xe0')));};AGIVertices['prototype'][_0x6a3e('0x10a')]=function(_0x3e9f0d){logger[_0x6a3e('0x2f')](util['format']('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x3e9f0d[_0x6a3e('0x39')]));return this[_0x6a3e('0x37')]['noop'](_0x6a3e('0x10a'));};AGIVertices[_0x6a3e('0x13')][_0x6a3e('0xb')]=function(_0x5ce2a5){logger['info'](util[_0x6a3e('0x2a')]('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x5ce2a5[_0x6a3e('0x39')]));if(_0x5ce2a5[_0x6a3e('0xa4')]===0x0){return this[_0x6a3e('0xa3')](_0x5ce2a5);}_0x5ce2a5[_0x6a3e('0xa4')]-=0x1;if(!this[_0x6a3e('0x84')](_0x5ce2a5[_0x6a3e('0x10b')])){return this[_0x6a3e('0x37')][_0x6a3e('0x50')](_0x5ce2a5,_0x6a3e('0x10c'));}var _0x28553b=this[_0x6a3e('0x1e')][_0x6a3e('0x71')](this,_0x5ce2a5[_0x6a3e('0x10b')]);if(!_0x28553b){return this[_0x6a3e('0x37')][_0x6a3e('0x50')](_0x5ce2a5,'no\x20file\x20audio\x20found');}if(!this[_0x6a3e('0x84')](_0x5ce2a5[_0x6a3e('0xd6')])){return this['channel']['error'](_0x6a3e('0x10d'));}var _0x2df71f=this[_0x6a3e('0x37')][_0x6a3e('0x10e')](_0x28553b,_0x5ce2a5['response'],_0x5ce2a5[_0x6a3e('0x10f')]);var _0x147bf9=_0x2df71f['result']?_0x2df71f[_0x6a3e('0xa9')][_0x6a3e('0x9f')]():'';logger[_0x6a3e('0x2f')](_0x6a3e('0x110'),JSON[_0x6a3e('0x9d')](_0x2df71f));if(_0x2df71f['result']===-0x1){this['createSquareDetailsReport'][_0x6a3e('0x71')](this,_0x5ce2a5,_0x147bf9);return _0x2df71f;}else if(_0x2df71f[_0x6a3e('0xa2')]===_0x6a3e('0x68')){_0x2df71f[_0x6a3e('0xa9')]=_0x147bf9[_0x6a3e('0x9a')]>=parseInt(_0x5ce2a5[_0x6a3e('0x111')])?'x':'i';}else{_0x2df71f[_0x6a3e('0xa9')]=_0x147bf9['length']>=parseInt(_0x5ce2a5[_0x6a3e('0x111')])&&_0x147bf9['length']<=parseInt(_0x5ce2a5[_0x6a3e('0x10f')])?'x':'i';}var _0x25bb26=this[_0x6a3e('0xe')]['sync'](this,_0x5ce2a5[_0x6a3e('0xd6')]);if(!_0x25bb26){return this['channel']['error'](_0x5ce2a5,_0x6a3e('0xd7'));}this[_0x6a3e('0x37')][_0x6a3e('0x9c')](_0x25bb26,_0x147bf9);if(this['isConfigured'](_0x5ce2a5[_0x6a3e('0x112')])){var _0x4d38eb=parseInt(_0x5ce2a5[_0x6a3e('0x112')],0xa);var _0x3887bf=rs[_0x6a3e('0x113')]({'charset':'*','length':_0x4d38eb});var _0xfb42e2=_0x147bf9[_0x6a3e('0x9a')];if(_0xfb42e2>0x0){if(_0xfb42e2>_0x4d38eb){this[_0x6a3e('0x36')][_0x6a3e('0x71')](this,_0x5ce2a5,_0x5ce2a5[_0x6a3e('0x114')]===_0x6a3e('0x115')?_0x3887bf+_0x147bf9[_0x6a3e('0x116')](_0x4d38eb):_0x147bf9[_0x6a3e('0x116')](0x0,_0xfb42e2-_0x4d38eb)+_0x3887bf);}else{this[_0x6a3e('0x36')]['sync'](this,_0x5ce2a5,rs[_0x6a3e('0x113')]({'charset':'*','length':_0xfb42e2}));}}else{this[_0x6a3e('0x36')][_0x6a3e('0x71')](this,_0x5ce2a5,'');}}else{this['createSquareDetailsReport'][_0x6a3e('0x71')](this,_0x5ce2a5,_0x147bf9);}return _0x2df71f;};AGIVertices[_0x6a3e('0x13')][_0x6a3e('0xc')]=function(_0x52bad2){logger['info'](util['format'](_0x6a3e('0x117'),_0x52bad2[_0x6a3e('0x39')]));return this['getdigits'](_0x52bad2);};AGIVertices[_0x6a3e('0x13')][_0x6a3e('0x118')]=function(_0x22f398){logger['info'](util[_0x6a3e('0x2a')](_0x6a3e('0x119'),_0x22f398['label']));this[_0x6a3e('0x36')][_0x6a3e('0x71')](this,_0x22f398,_0x22f398[_0x6a3e('0x11a')]);return this[_0x6a3e('0x37')]['noop'](util[_0x6a3e('0x2a')](_0x6a3e('0x11b'),_0x22f398[_0x6a3e('0x11a')]));};AGIVertices['prototype']['awspolly']=function(_0x13e575){logger[_0x6a3e('0x2f')](util[_0x6a3e('0x2a')](_0x6a3e('0x11c'),_0x13e575[_0x6a3e('0x39')]));if(!this['isConfigured'](_0x13e575[_0x6a3e('0x8b')])||!this[_0x6a3e('0x84')](_0x13e575[_0x6a3e('0x87')])){return this[_0x6a3e('0x37')][_0x6a3e('0xa5')](_0x6a3e('0x11d'));}if(!this['isConfigured'](_0x13e575['text'])){return this[_0x6a3e('0x37')][_0x6a3e('0xa5')](_0x6a3e('0xa6'));}this[_0x6a3e('0x37')][_0x6a3e('0xa5')](util[_0x6a3e('0x2a')](_0x6a3e('0x11e'),_0x13e575['text']));var _0x372ebe=this[_0x6a3e('0x86')][_0x6a3e('0x71')](this,_0x13e575);if(_0x372ebe){this['channel'][_0x6a3e('0xa5')](util[_0x6a3e('0x2a')]('aws\x20Polly\x20%s\x20file\x20created',_0x372ebe));var _0x22289a=this['channel'][_0x6a3e('0xff')](_0x372ebe);try{fs[_0x6a3e('0x100')](_0x372ebe+_0x6a3e('0x101'));}catch(_0x2c12c0){logger[_0x6a3e('0x50')](_0x2c12c0);}return _0x22289a;}return this['channel'][_0x6a3e('0x50')](_0x13e575,'aws\x20Polly\x20is\x20unreachable');};AGIVertices[_0x6a3e('0x13')]['awslex']=function(_0x223d35){logger[_0x6a3e('0x2f')](util['format']('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x223d35[_0x6a3e('0x39')]));if(!this[_0x6a3e('0x84')](_0x223d35[_0x6a3e('0x8b')])||!this[_0x6a3e('0x84')](_0x223d35[_0x6a3e('0x87')])){return this['channel'][_0x6a3e('0xa5')](_0x6a3e('0x11d'));}if(!this[_0x6a3e('0x84')](_0x223d35[_0x6a3e('0x8d')])){return this['channel'][_0x6a3e('0xa5')]('no\x20bot\x20name\x20configured');}if(!this['isConfigured'](_0x223d35[_0x6a3e('0x5d')])){return this[_0x6a3e('0x37')][_0x6a3e('0xa5')]('no\x20text\x20configured');}this[_0x6a3e('0x37')][_0x6a3e('0xe6')]=!![];this[_0x6a3e('0x36')](_0x223d35);this[_0x6a3e('0x43')](_0x223d35[_0x6a3e('0x5d')],'in','','');this['channel'][_0x6a3e('0xa5')](util[_0x6a3e('0x2a')](_0x6a3e('0x11f'),_0x223d35['text']));var _0x20dd85=this[_0x6a3e('0x8a')]['sync'](this,_0x223d35);if(_0x20dd85){for(var _0x5a869b in _0x20dd85){if(_0x20dd85[_0x6a3e('0x93')](_0x5a869b)&&_[_0x6a3e('0x94')](_0x20dd85[_0x5a869b])){this[_0x6a3e('0x37')][_0x6a3e('0x9c')](util[_0x6a3e('0x2a')](_0x6a3e('0x120'),_0x5a869b[_0x6a3e('0x6b')]()),_0x20dd85[_0x5a869b]);}}if(_[_0x6a3e('0x52')](_0x20dd85[_0x6a3e('0x77')])){return this[_0x6a3e('0x37')]['noop']('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this['createSquareMessage'](_0x20dd85[_0x6a3e('0x77')],'out',_0x6a3e('0x121'),'');return this[_0x6a3e('0x37')][_0x6a3e('0xa5')](util[_0x6a3e('0x2a')](_0x6a3e('0x122'),_0x20dd85[_0x6a3e('0x77')]));}}return this[_0x6a3e('0x37')]['error'](_0x223d35,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices[_0x6a3e('0x13')]['googleasr']=function(_0x239799){logger[_0x6a3e('0x2f')](util[_0x6a3e('0x2a')]('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x239799[_0x6a3e('0x39')],_0x239799[_0x6a3e('0x68')]));if(!this[_0x6a3e('0x84')](_0x239799[_0x6a3e('0x80')])){return this[_0x6a3e('0x37')][_0x6a3e('0xa5')](_0x6a3e('0x123'));}var _0x493abb=_0x6a3e('0x124');var _0x386a9c=util[_0x6a3e('0x2a')](_0x6a3e('0x125'),FILES_PATH,rs[_0x6a3e('0x113')](0x4));var _0xd55ea2=util[_0x6a3e('0x2a')]('%s.%s',_0x386a9c,_0x493abb);var _0x130894=!![];if(_0x239799[_0x6a3e('0x126')]==='NOBEEP'){_0x130894=![];}var _0x25ac5b=this[_0x6a3e('0x37')][_0x6a3e('0x127')](_0x386a9c,_0x493abb,_0x239799[_0x6a3e('0x128')],_0x239799[_0x6a3e('0x68')],undefined,_0x130894);if(_0x25ac5b['result']!==-0x1){this[_0x6a3e('0x37')][_0x6a3e('0xa5')](util[_0x6a3e('0x2a')](_0x6a3e('0x129'),_0xd55ea2));var _0x31711d=this['googleASR'][_0x6a3e('0x71')](this,_0x239799,_0xd55ea2);if(_0x31711d){for(var _0x2e0636 in _0x31711d){if(_0x31711d['hasOwnProperty'](_0x2e0636)){this[_0x6a3e('0x37')]['setVariable'](util[_0x6a3e('0x2a')](_0x6a3e('0x12a'),_0x2e0636['toUpperCase']()),_0x31711d[_0x2e0636]);}}return this[_0x6a3e('0x37')][_0x6a3e('0xa5')](util[_0x6a3e('0x2a')](_0x6a3e('0x12b'),JSON[_0x6a3e('0x9d')](_0x31711d)));}}return _0x25ac5b;};AGIVertices[_0x6a3e('0x13')][_0x6a3e('0x12c')]=function(_0x393274){logger['info'](util[_0x6a3e('0x2a')](_0x6a3e('0x12d'),_0x393274[_0x6a3e('0x39')]));if(!this['isConfigured'](_0x393274[_0x6a3e('0x12e')])){return this[_0x6a3e('0x37')][_0x6a3e('0xa5')]('no\x20appid\x20configured');}if(!this[_0x6a3e('0x84')](_0x393274[_0x6a3e('0x90')])){return this[_0x6a3e('0x37')][_0x6a3e('0xa5')](_0x6a3e('0x12f'));}var _0x15c8a5=_0x6a3e('0x124');var _0x3e8c34=util['format'](_0x6a3e('0x125'),FILES_PATH,rs[_0x6a3e('0x113')](0x4));var _0x80676e=util[_0x6a3e('0x2a')](_0x6a3e('0x99'),_0x3e8c34,_0x15c8a5);var _0x4d996c=!![];if(_0x393274[_0x6a3e('0x126')]==='NOBEEP'){_0x4d996c=![];}var _0xeccad3=this[_0x6a3e('0x37')][_0x6a3e('0x127')](_0x3e8c34,_0x15c8a5,_0x393274['intKey'],_0x393274[_0x6a3e('0x68')],undefined,_0x4d996c);if(_0xeccad3[_0x6a3e('0xa9')]!==-0x1){this[_0x6a3e('0x37')][_0x6a3e('0xa5')](util[_0x6a3e('0x2a')](_0x6a3e('0x130'),_0x80676e));var _0x1978fb=this[_0x6a3e('0x8f')][_0x6a3e('0x71')](this,_0x393274,_0x80676e);if(_0x1978fb){for(var _0x791a34 in _0x1978fb){if(_0x1978fb[_0x6a3e('0x93')](_0x791a34)){this[_0x6a3e('0x37')][_0x6a3e('0x9c')](util[_0x6a3e('0x2a')](_0x6a3e('0x131'),_0x791a34[_0x6a3e('0x6b')]()),_0x1978fb[_0x791a34]);}}return this[_0x6a3e('0x37')][_0x6a3e('0xa5')](util[_0x6a3e('0x2a')](_0x6a3e('0x132'),JSON['stringify'](_0x1978fb)));}}return _0xeccad3;};AGIVertices[_0x6a3e('0x13')][_0x6a3e('0x133')]=function(_0x2b3d0e){logger['info'](util['format'](_0x6a3e('0x134'),_0x2b3d0e[_0x6a3e('0x39')]));return this['channel'][_0x6a3e('0x135')](_0x2b3d0e[_0x6a3e('0x3e')],_0x2b3d0e['extension'],_0x2b3d0e[_0x6a3e('0x40')]);};AGIVertices[_0x6a3e('0x13')][_0x6a3e('0x136')]=function(_0x1e0762){logger['info'](util['format'](_0x6a3e('0x137'),_0x1e0762[_0x6a3e('0x39')]));if(!this[_0x6a3e('0x84')](_0x1e0762[_0x6a3e('0x138')])){return this[_0x6a3e('0x37')]['error'](_0x1e0762,_0x6a3e('0x139'));}try{var _0x6f9d34=eval(_0x1e0762[_0x6a3e('0x138')])?_0x6a3e('0x13a'):_0x6a3e('0x13b');this['channel'][_0x6a3e('0xa5')](util[_0x6a3e('0x2a')]('EVAL\x20CONDITION\x20%s\x20%s',_0x1e0762[_0x6a3e('0x138')],_0x6f9d34));return{'code':0xc8,'result':_0x6f9d34};}catch(_0x22e7e3){return{'code':0xc8,'result':_0x6a3e('0x13b')};}};AGIVertices[_0x6a3e('0x13')][_0x6a3e('0x13c')]=function(_0x3f292a){logger[_0x6a3e('0x2f')](util[_0x6a3e('0x2a')](_0x6a3e('0x13d'),_0x3f292a[_0x6a3e('0x39')]));if(!this[_0x6a3e('0x84')](_0x3f292a['interval_id'])){return this[_0x6a3e('0x37')]['error'](_0x3f292a,'no\x20interval\x20configured');}var _0x5a2fbe=this['getIntervals'][_0x6a3e('0x71')](this,_0x3f292a[_0x6a3e('0x13e')]);if(!_0x5a2fbe){return this['channel'][_0x6a3e('0x50')](_0x3f292a,_0x6a3e('0x13f'));}for(var _0xad3f62=0x0;_0xad3f62<_0x5a2fbe[_0x6a3e('0x9a')];_0xad3f62+=0x1){var _0x5f3b47=this[_0x6a3e('0x37')][_0x6a3e('0xe')](util[_0x6a3e('0x2a')](_0x6a3e('0x140'),_0x5a2fbe[_0xad3f62]));if(_0x5f3b47[_0x6a3e('0xa9')]===-0x1){return _0x5f3b47;}logger['info'](util['format'](_0x6a3e('0x141'),_0x5a2fbe[_0xad3f62],_0x5f3b47['extra']));if(_0x5f3b47[_0x6a3e('0xa2')]===_0x6a3e('0x13a')){logger[_0x6a3e('0x2f')](util['format']('IFTIME\x20%s\x20%s',_0x5a2fbe[_0xad3f62],_0x6a3e('0x13a')));this[_0x6a3e('0x37')]['noop'](util[_0x6a3e('0x2a')](_0x6a3e('0x141'),_0x5a2fbe[_0xad3f62],'true'));return{'code':0xc8,'result':_0x6a3e('0x13a')};}else{logger[_0x6a3e('0x2f')](util[_0x6a3e('0x2a')](_0x6a3e('0x141'),_0x5a2fbe[_0xad3f62],_0x6a3e('0x13b')));this[_0x6a3e('0x37')]['noop'](util['format']('IFTIME\x20%s\x20%s',_0x5a2fbe[_0xad3f62],_0x6a3e('0x13b')));}}return{'code':0xc8,'result':'false'};};AGIVertices['prototype'][_0x6a3e('0x142')]=function(_0x234cf){logger[_0x6a3e('0x2f')](util[_0x6a3e('0x2a')]('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x234cf['label']));return this[_0x6a3e('0x37')][_0x6a3e('0x142')]();};AGIVertices[_0x6a3e('0x13')][_0x6a3e('0x143')]=function(_0x589c98){logger['info'](util[_0x6a3e('0x2a')](_0x6a3e('0x144'),_0x589c98['label']));if(!this[_0x6a3e('0x84')](_0x589c98['key'])){return this[_0x6a3e('0x37')]['noop'](_0x6a3e('0x123'));}var _0x2a46ee=_0x6a3e('0x124');var _0xb8e000=util[_0x6a3e('0x2a')]('%s/recordings/%s',FILES_PATH,rs[_0x6a3e('0x113')](0x4));var _0x3d4016=util[_0x6a3e('0x2a')](_0x6a3e('0x99'),_0xb8e000,_0x2a46ee);var _0x171318=!![];if(_0x589c98[_0x6a3e('0x126')]===_0x6a3e('0x145')){_0x171318=![];}var _0x5f2342=this[_0x6a3e('0x37')][_0x6a3e('0x127')](_0xb8e000,_0x2a46ee,_0x589c98[_0x6a3e('0x128')],_0x589c98['timeout'],undefined,_0x171318);if(_0x5f2342[_0x6a3e('0xa9')]!==-0x1){this[_0x6a3e('0x37')][_0x6a3e('0xa5')](util[_0x6a3e('0x2a')](_0x6a3e('0x146'),_0x3d4016));var _0x44f929=this[_0x6a3e('0x83')]['sync'](this,_0x589c98,_0x3d4016);if(_0x44f929){for(var _0x459546 in _0x44f929){if(_0x44f929['hasOwnProperty'](_0x459546)){this[_0x6a3e('0x37')][_0x6a3e('0x9c')](util[_0x6a3e('0x2a')](_0x6a3e('0x147'),_0x459546['toUpperCase']()),_0x44f929[_0x459546]);}}return this[_0x6a3e('0x37')]['noop'](util[_0x6a3e('0x2a')](_0x6a3e('0x148'),JSON[_0x6a3e('0x9d')](_0x44f929)));}}return _0x5f2342;};AGIVertices[_0x6a3e('0x13')][_0x6a3e('0x149')]=function(_0xaaddda){logger[_0x6a3e('0x2f')](util[_0x6a3e('0x2a')](_0x6a3e('0x14a'),_0xaaddda[_0x6a3e('0x39')]));if(!this['isConfigured'](_0xaaddda[_0x6a3e('0x80')])){return this[_0x6a3e('0x37')][_0x6a3e('0xa5')](_0x6a3e('0x123'));}if(!this[_0x6a3e('0x84')](_0xaaddda[_0x6a3e('0x5d')])){return this[_0x6a3e('0x37')][_0x6a3e('0xa5')]('no\x20text\x20configured');}this[_0x6a3e('0x37')][_0x6a3e('0xa5')](util[_0x6a3e('0x2a')](_0x6a3e('0x14b'),_0xaaddda[_0x6a3e('0x5d')]));var _0x5e181f=this[_0x6a3e('0x7f')]['sync'](this,_0xaaddda);if(_0x5e181f){this[_0x6a3e('0x37')][_0x6a3e('0xa5')](util[_0x6a3e('0x2a')](_0x6a3e('0x146'),_0x5e181f));var _0x48486f=this[_0x6a3e('0x37')][_0x6a3e('0xff')](_0x5e181f,_0xaaddda[_0x6a3e('0x128')]);try{fs[_0x6a3e('0x100')](_0x5e181f+_0x6a3e('0x101'));}catch(_0x2a99fc){logger[_0x6a3e('0x50')](_0x2a99fc);}return _0x48486f;}return this[_0x6a3e('0x37')][_0x6a3e('0x50')](_0xaaddda,_0x6a3e('0x14c'));};AGIVertices[_0x6a3e('0x13')][_0x6a3e('0x14d')]=function(_0x386667){logger[_0x6a3e('0x2f')](util['format'](_0x6a3e('0x14e'),_0x386667[_0x6a3e('0x39')]));if(!this['isConfigured'](_0x386667[_0x6a3e('0x14f')])){return this[_0x6a3e('0x37')][_0x6a3e('0x50')](_0x386667,'no\x20find\x20by\x20configured');}logger[_0x6a3e('0x2f')](util['format'](_0x6a3e('0x150'),this['channel']['callerid'],_0x386667['findBy']));var _0x30ed2c=this['agentLogin'][_0x6a3e('0x71')](this,_0x386667[_0x6a3e('0x14f')]);if(_0x30ed2c){logger['info'](util['format'](_0x6a3e('0x151'),this['channel']['callerid'],_0x386667[_0x6a3e('0x14f')]));this['channel'][_0x6a3e('0xa5')](util['format'](_0x6a3e('0x151'),this[_0x6a3e('0x37')]['callerid'],_0x386667[_0x6a3e('0x14f')]));return{'code':0xc8,'result':_0x6a3e('0x152')};}else{logger['info'](util[_0x6a3e('0x2a')](_0x6a3e('0x153'),this['channel'][_0x6a3e('0x3c')],_0x386667[_0x6a3e('0x14f')]));this[_0x6a3e('0x37')][_0x6a3e('0xa5')](util[_0x6a3e('0x2a')](_0x6a3e('0x153'),this[_0x6a3e('0x37')][_0x6a3e('0x3c')],_0x386667[_0x6a3e('0x14f')]));return{'code':0xc8,'result':_0x6a3e('0x154')};}};AGIVertices[_0x6a3e('0x13')][_0x6a3e('0x155')]=function(_0x5ebee5){logger[_0x6a3e('0x2f')](util[_0x6a3e('0x2a')](_0x6a3e('0x156'),_0x5ebee5[_0x6a3e('0x39')]));if(!this[_0x6a3e('0x84')](_0x5ebee5['findBy'])){return this[_0x6a3e('0x37')][_0x6a3e('0x50')](_0x5ebee5,_0x6a3e('0x157'));}logger[_0x6a3e('0x2f')](util[_0x6a3e('0x2a')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x6a3e('0x37')][_0x6a3e('0x3c')],_0x5ebee5[_0x6a3e('0x14f')]));var _0x1349d5=this['agentLogout'][_0x6a3e('0x71')](this,_0x5ebee5[_0x6a3e('0x14f')]);if(_0x1349d5){logger['info'](util[_0x6a3e('0x2a')](_0x6a3e('0x151'),this['channel'][_0x6a3e('0x3c')],_0x5ebee5[_0x6a3e('0x14f')]));this[_0x6a3e('0x37')]['noop'](util[_0x6a3e('0x2a')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x6a3e('0x3c')],_0x5ebee5[_0x6a3e('0x14f')]));return{'code':0xc8,'result':_0x6a3e('0x152')};}else{logger[_0x6a3e('0x2f')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x6a3e('0x37')][_0x6a3e('0x3c')],_0x5ebee5[_0x6a3e('0x14f')]));this[_0x6a3e('0x37')][_0x6a3e('0xa5')](util[_0x6a3e('0x2a')](_0x6a3e('0x153'),this[_0x6a3e('0x37')]['callerid'],_0x5ebee5[_0x6a3e('0x14f')]));return{'code':0xc8,'result':_0x6a3e('0x154')};}};AGIVertices[_0x6a3e('0x13')][_0x6a3e('0x158')]=function(_0x5dc47c){logger[_0x6a3e('0x2f')](util[_0x6a3e('0x2a')](_0x6a3e('0x159'),_0x5dc47c['label']));if(!this[_0x6a3e('0x84')](_0x5dc47c['operation'])){return this[_0x6a3e('0x37')]['error'](_0x5dc47c,_0x6a3e('0x15a'));}this['channel'][_0x6a3e('0xa5')](util['format']('math\x20%s',_0x5dc47c[_0x6a3e('0x15b')]));var _0x399248=eval(_0x5dc47c[_0x6a3e('0x15b')]);if(!this['isConfigured'](_0x5dc47c[_0x6a3e('0xd6')])){return this[_0x6a3e('0x37')][_0x6a3e('0xa5')](_0x6a3e('0x10d'));}var _0x4a19c7=this['getVariable'][_0x6a3e('0x71')](this,_0x5dc47c[_0x6a3e('0xd6')]);if(!_0x4a19c7){return this[_0x6a3e('0x37')][_0x6a3e('0x50')](_0x5dc47c,_0x6a3e('0xd7'));}if(_[_0x6a3e('0x15c')](_0x399248)){var _0x475a50=this;_0x399248['forEach'](function(_0x147dd6,_0x1eaf19){_0x475a50['channel']['setVariable'](util[_0x6a3e('0x2a')](_0x6a3e('0x15d'),_0x4a19c7,_0x1eaf19),_0x147dd6);});return this[_0x6a3e('0x37')]['noop'](util[_0x6a3e('0x2a')]('variable\x20%s[key]\x20set',_0x4a19c7));}else{return this[_0x6a3e('0x37')]['setVariable'](_0x4a19c7,_0x399248);}};AGIVertices[_0x6a3e('0x13')][_0x6a3e('0x15e')]=function(_0x1638ac){logger['info'](util[_0x6a3e('0x2a')](_0x6a3e('0x15f'),_0x1638ac[_0x6a3e('0x39')]));if(_0x1638ac[_0x6a3e('0xa4')]===0x0){return this[_0x6a3e('0xa3')](_0x1638ac);}_0x1638ac[_0x6a3e('0xa4')]-=0x1;if(!this['isConfigured'](_0x1638ac[_0x6a3e('0x10b')])){return this['channel'][_0x6a3e('0x50')](_0x1638ac,_0x6a3e('0x10c'));}var _0x4e3430=this[_0x6a3e('0x1e')][_0x6a3e('0x71')](this,_0x1638ac[_0x6a3e('0x10b')]);if(!_0x4e3430){return this[_0x6a3e('0x37')][_0x6a3e('0x50')](_0x1638ac,_0x6a3e('0x160'));}var _0x1d6231=this[_0x6a3e('0x37')][_0x6a3e('0x10e')](_0x4e3430,_0x1638ac['response'],_0x1638ac[_0x6a3e('0x161')]);var _0x25aabc=_0x1d6231[_0x6a3e('0xa9')];if(_0x1d6231[_0x6a3e('0xa9')]===-0x1){this[_0x6a3e('0x36')][_0x6a3e('0x71')](this,_0x1638ac,'-1');return _0x1d6231;}else if(_0x1d6231[_0x6a3e('0xa2')]===_0x6a3e('0x68')){_0x1d6231[_0x6a3e('0xa9')]=_0x1d6231['result']['length']>0x0?_0x1d6231[_0x6a3e('0xa9')]:'t';}else if(_['isEmpty'](_0x1d6231['result'])){_0x1d6231['result']='#';_0x25aabc='#';}if(!this[_0x6a3e('0x84')](_0x1638ac[_0x6a3e('0xd6')])){this[_0x6a3e('0x37')]['noop'](_0x6a3e('0x10d'));}else{var _0x5f3214=this[_0x6a3e('0xe')][_0x6a3e('0x71')](this,_0x1638ac[_0x6a3e('0xd6')]);if(!_0x5f3214){return this['channel'][_0x6a3e('0x50')](_0x1638ac,_0x6a3e('0xd7'));}this['channel'][_0x6a3e('0x9c')](_0x5f3214,_0x25aabc);}this[_0x6a3e('0x36')][_0x6a3e('0x71')](this,_0x1638ac,_0x25aabc);return _0x1d6231;};AGIVertices[_0x6a3e('0x13')][_0x6a3e('0xa5')]=function(_0x313ba5){logger[_0x6a3e('0x2f')](util[_0x6a3e('0x2a')]('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x313ba5[_0x6a3e('0x39')]));return this[_0x6a3e('0x37')][_0x6a3e('0xa5')](_0x313ba5['output']||_0x313ba5[_0x6a3e('0x39')]);};AGIVertices[_0x6a3e('0x13')][_0x6a3e('0x162')]=function(_0x24b215){logger['info'](util[_0x6a3e('0x2a')](_0x6a3e('0x163'),_0x24b215[_0x6a3e('0x39')]));if(!this[_0x6a3e('0x84')](_0x24b215['findBy'])){return this['channel'][_0x6a3e('0x50')](_0x24b215,_0x6a3e('0x157'));}logger[_0x6a3e('0x2f')](util[_0x6a3e('0x2a')](_0x6a3e('0x150'),this[_0x6a3e('0x37')]['callerid'],_0x24b215['findBy']));var _0x434ad5=this[_0x6a3e('0x164')][_0x6a3e('0x71')](this,_0x24b215['pause_id']);var _0x37a042=this[_0x6a3e('0x4e')][_0x6a3e('0x71')](this,_0x24b215[_0x6a3e('0x14f')],_0x434ad5);if(_0x37a042){logger[_0x6a3e('0x2f')](util['format'](_0x6a3e('0x151'),this[_0x6a3e('0x37')][_0x6a3e('0x3c')],_0x24b215[_0x6a3e('0x14f')]));this[_0x6a3e('0x37')][_0x6a3e('0xa5')](util[_0x6a3e('0x2a')](_0x6a3e('0x151'),this['channel'][_0x6a3e('0x3c')],_0x24b215[_0x6a3e('0x14f')]));return{'code':0xc8,'result':_0x6a3e('0x152')};}else{logger[_0x6a3e('0x2f')](util[_0x6a3e('0x2a')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x6a3e('0x37')][_0x6a3e('0x3c')],_0x24b215[_0x6a3e('0x14f')]));this[_0x6a3e('0x37')]['noop'](util['format'](_0x6a3e('0x151'),this['channel']['callerid'],_0x24b215[_0x6a3e('0x14f')]));return{'code':0xc8,'result':_0x6a3e('0x154')};}};AGIVertices[_0x6a3e('0x13')][_0x6a3e('0x165')]=function(_0x2578e1){logger[_0x6a3e('0x2f')](util[_0x6a3e('0x2a')]('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x2578e1[_0x6a3e('0x39')]));if(!this['isConfigured'](_0x2578e1['file_id'])){return this[_0x6a3e('0x37')][_0x6a3e('0x50')](_0x2578e1,_0x6a3e('0x10c'));}var _0x5aedab=this[_0x6a3e('0x1e')][_0x6a3e('0x71')](this,_0x2578e1[_0x6a3e('0x10b')]);if(!_0x5aedab){return this[_0x6a3e('0x37')][_0x6a3e('0x50')](_0x2578e1,'no\x20file\x20audio\x20found');}var _0x57da05=this['channel']['exec'](_0x6a3e('0x166'),[_0x5aedab,_0x2578e1[_0x6a3e('0xe2')]]);if(_0x57da05[_0x6a3e('0xa9')]===-0x1){return _0x57da05;}return this[_0x6a3e('0x37')][_0x6a3e('0xa5')](util[_0x6a3e('0x2a')](_0x6a3e('0xc3'),_0x6a3e('0x166'),_0x5aedab));};AGIVertices[_0x6a3e('0x13')]['queue']=function(_0x3b7b2b){logger['info'](util['format'](_0x6a3e('0x167'),_0x3b7b2b[_0x6a3e('0x39')]));if(!this[_0x6a3e('0x84')](_0x3b7b2b[_0x6a3e('0x168')])){return this['channel'][_0x6a3e('0x50')](_0x3b7b2b,_0x6a3e('0x169'));}var _0x575177='';var _0x345674=parseInt(_0x3b7b2b[_0x6a3e('0x168')],0xa);if(isNaN(_0x345674)){_0x575177=_0x3b7b2b[_0x6a3e('0x168')];}else{_0x575177=this[_0x6a3e('0x14')][_0x6a3e('0x71')](this,_0x3b7b2b[_0x6a3e('0x168')]);if(!_0x575177){return this['channel'][_0x6a3e('0x50')](_0x3b7b2b,_0x6a3e('0x16a'));}}var _0x2a6e9c='';if(this[_0x6a3e('0x84')](_0x3b7b2b['file_id'])){var _0xc50856=this['getSound']['sync'](this,_0x3b7b2b[_0x6a3e('0x10b')]);if(_0xc50856){_0x2a6e9c=_0xc50856;}}this[_0x6a3e('0x36')][_0x6a3e('0x71')](this,_0x3b7b2b,_0x575177);if(_0x3b7b2b['opts'][_0x6a3e('0x16b')]('x')<0x0){_0x3b7b2b['opts']+='x';}if(_0x3b7b2b['opts'][_0x6a3e('0x16b')]('X')<0x0){_0x3b7b2b[_0x6a3e('0xe2')]+='X';}this['channel'][_0x6a3e('0x9c')](_0x6a3e('0x16c'),_0x575177?_0x575177[_0x6a3e('0x16d')]():'');var _0x20342d=this[_0x6a3e('0x37')]['exec']('QUEUE',[_0x575177,_0x3b7b2b[_0x6a3e('0xe2')],_0x3b7b2b[_0x6a3e('0x72')],_0x2a6e9c,_0x3b7b2b['timeout'],_0x3b7b2b['agi'],_0x3b7b2b[_0x6a3e('0x16e')],_0x3b7b2b[_0x6a3e('0x16f')],'',_0x3b7b2b['position']]);if(_0x20342d['result']===-0x1){return _0x20342d;}return this['channel'][_0x6a3e('0xa5')](util[_0x6a3e('0x2a')](_0x6a3e('0xc3'),_0x6a3e('0x170'),_0x575177));};AGIVertices['prototype'][_0x6a3e('0x171')]=function(_0x18ad85){logger[_0x6a3e('0x2f')](util[_0x6a3e('0x2a')](_0x6a3e('0x172'),_0x18ad85['label']));var _0x407402=_0x18ad85[_0x6a3e('0x173')]||_0x6a3e('0x124');var _0x2ec655=util[_0x6a3e('0x2a')](_0x6a3e('0x174'),this[_0x6a3e('0x37')]['uniqueid'],rs[_0x6a3e('0x113')](0x5));var _0x1730af=util['format'](_0x6a3e('0x175'),FILES_PATH,_0x2ec655,_0x407402);var _0x17a7f8=util[_0x6a3e('0x2a')](_0x6a3e('0x125'),FILES_PATH,_0x2ec655);this[_0x6a3e('0x3b')]['sync'](this,_0x18ad85,_0x2ec655,_0x1730af);this[_0x6a3e('0x37')]['setVariable']('RECORDING_SAVENAME',_0x2ec655);logger[_0x6a3e('0x2f')](_0x6a3e('0x176'),_0x17a7f8,_0x407402,_0x18ad85[_0x6a3e('0x177')],_0x18ad85[_0x6a3e('0x68')]);return this[_0x6a3e('0x37')][_0x6a3e('0x127')](_0x17a7f8,_0x407402,_0x18ad85[_0x6a3e('0x177')],_0x18ad85['timeout'],undefined,!![]);};AGIVertices[_0x6a3e('0x13')][_0x6a3e('0x178')]=function(_0xf8e5ed){logger[_0x6a3e('0x2f')](util[_0x6a3e('0x2a')](_0x6a3e('0x179'),_0xf8e5ed[_0x6a3e('0x39')]));if(!this['isConfigured'](_0xf8e5ed['url'])){return this[_0x6a3e('0x37')][_0x6a3e('0xa5')]('no\x20url\x20configured');}var _0x3f4490=this['restAPI'][_0x6a3e('0x71')](this,_0xf8e5ed);logger[_0x6a3e('0x2f')](util['format'](_0x6a3e('0x17a'),util[_0x6a3e('0x17b')](_0x3f4490,{'showHidden':![],'depth':null})));if(!this[_0x6a3e('0x84')](_0xf8e5ed[_0x6a3e('0xd6')])){return this[_0x6a3e('0x37')][_0x6a3e('0xa5')]('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x4506ed=this[_0x6a3e('0xe')][_0x6a3e('0x71')](this,_0xf8e5ed[_0x6a3e('0xd6')]);if(!_0x4506ed){return this[_0x6a3e('0x37')][_0x6a3e('0x50')](_0xf8e5ed,_0x6a3e('0xd7'));}this[_0x6a3e('0x37')]['setVariable'](util['format']('%s_STATUS_CODE',_0x4506ed),_0x3f4490['statusCode']?_0x3f4490[_0x6a3e('0x76')]:_0x6a3e('0x17c'));this[_0x6a3e('0x37')]['setVariable'](util[_0x6a3e('0x2a')]('%s_STATUS_MESSAGE',_0x4506ed),_0x3f4490[_0x6a3e('0x75')]?_0x3f4490[_0x6a3e('0x75')]:'OK');if(_0x3f4490['body']){try{this[_0x6a3e('0x9b')](_0x3f4490[_0x6a3e('0x6c')],_0x4506ed);}catch(_0x200d1f){logger[_0x6a3e('0x50')](util['format'](_0x6a3e('0x17d'),_0x4506ed));}}return this[_0x6a3e('0x37')][_0x6a3e('0xa5')](util[_0x6a3e('0x2a')](_0x6a3e('0xdb'),_0x4506ed));};AGIVertices[_0x6a3e('0x13')][_0x6a3e('0x17e')]=function(_0xda0782){logger[_0x6a3e('0x2f')](util[_0x6a3e('0x2a')](_0x6a3e('0x17f'),_0xda0782[_0x6a3e('0x39')]));return this[_0x6a3e('0x37')][_0x6a3e('0x180')](_0xda0782['digits'][_0x6a3e('0x59')](/\s+/g,''),_0xda0782['escape_digits']);};AGIVertices[_0x6a3e('0x13')][_0x6a3e('0x181')]=function(_0x4251ff){logger[_0x6a3e('0x2f')](util[_0x6a3e('0x2a')]('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x4251ff['label']));return this[_0x6a3e('0x37')][_0x6a3e('0x182')](_0x4251ff['number'][_0x6a3e('0x59')](/\s+/g,''),_0x4251ff['escape_digits']);};AGIVertices[_0x6a3e('0x13')][_0x6a3e('0x183')]=function(_0x42714f){logger[_0x6a3e('0x2f')](util[_0x6a3e('0x2a')](_0x6a3e('0x184'),_0x42714f[_0x6a3e('0x39')]));return this[_0x6a3e('0x37')][_0x6a3e('0x185')](_0x42714f[_0x6a3e('0x5d')],_0x42714f[_0x6a3e('0x177')]);};AGIVertices['prototype'][_0x6a3e('0x186')]=function(_0xcccbbe){logger[_0x6a3e('0x2f')](util[_0x6a3e('0x2a')](_0x6a3e('0x187'),_0xcccbbe[_0x6a3e('0x39')]));if(!this[_0x6a3e('0x84')](_0xcccbbe[_0x6a3e('0x188')])){return this[_0x6a3e('0x37')]['noop'](_0x6a3e('0x189'));}var _0x320cd8=this['getMailAccount'][_0x6a3e('0x71')](this,_0xcccbbe['account_id']);if(!_0x320cd8||!_0x320cd8['Smtp']){return this[_0x6a3e('0x37')][_0x6a3e('0x50')](_0xcccbbe,_0x6a3e('0x18a'));}var _0x48b618={'from':util[_0x6a3e('0x2a')]('\x22%s\x22\x20<%s>',_0x320cd8[_0x6a3e('0x12')],_0x320cd8[_0x6a3e('0x18b')]||_0x320cd8['Smtp'][_0x6a3e('0x18c')]),'to':_0xcccbbe['to']||'','cc':_0xcccbbe['cc']||'','bcc':_0xcccbbe[_0x6a3e('0x18d')]||'','subject':_0xcccbbe[_0x6a3e('0x18e')],'html':_0xcccbbe['text'],'text':_0xcccbbe[_0x6a3e('0x5d')]};if(this[_0x6a3e('0x84')](_0xcccbbe[_0x6a3e('0x18f')])){}logger[_0x6a3e('0x190')](_0x6a3e('0x191'),JSON[_0x6a3e('0x9d')](_0x48b618));this[_0x6a3e('0x36')][_0x6a3e('0x71')](this,_0xcccbbe,_0xcccbbe[_0x6a3e('0x188')]);this[_0x6a3e('0x37')]['noop'](util[_0x6a3e('0x2a')](_0x6a3e('0x192'),_0x320cd8[_0x6a3e('0x12')]));this[_0x6a3e('0x23')]['sync'](this,_0x320cd8[_0x6a3e('0x193')],_0x48b618);return this['channel'][_0x6a3e('0xa5')](_0x6a3e('0x194'));};AGIVertices['prototype'][_0x6a3e('0x195')]=function(_0x410361){logger['info'](util[_0x6a3e('0x2a')]('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x410361[_0x6a3e('0x39')]));return this[_0x6a3e('0x37')][_0x6a3e('0xa5')]('SENDFAX\x20block\x20not\x20implemented');};AGIVertices[_0x6a3e('0x13')][_0x6a3e('0x196')]=function(_0x45d389){logger[_0x6a3e('0x2f')](util[_0x6a3e('0x2a')](_0x6a3e('0x197'),_0x45d389[_0x6a3e('0x39')]));if(!this[_0x6a3e('0x84')](_0x45d389[_0x6a3e('0x198')])){return this[_0x6a3e('0x37')]['noop'](_0x6a3e('0x199'));}var _0x403a6f=this[_0x6a3e('0x33')]['sync'](this,_0x45d389['sms_account_id']);if(!_0x403a6f){return this[_0x6a3e('0x37')][_0x6a3e('0x50')](_0x45d389,'no\x20sms\x20account\x20found');}var _0x686d8d={'body':_0x45d389[_0x6a3e('0x19a')],'phone':_0x45d389['to']||'','SmsAccountId':_0x403a6f['id']};logger['debug'](_0x6a3e('0x19b'),JSON[_0x6a3e('0x9d')](_0x686d8d));this['createSquareDetailsReport']['sync'](this,_0x45d389,_0x45d389[_0x6a3e('0x198')]);this[_0x6a3e('0x37')][_0x6a3e('0xa5')](util[_0x6a3e('0x2a')](_0x6a3e('0x19c'),_0x403a6f[_0x6a3e('0x12')]));this[_0x6a3e('0x35')][_0x6a3e('0x71')](this,_0x686d8d);return this['channel'][_0x6a3e('0xa5')](_0x6a3e('0x19d'));};AGIVertices['prototype']['set']=function(_0x50d558){logger[_0x6a3e('0x2f')](util[_0x6a3e('0x2a')](_0x6a3e('0x19e'),_0x50d558['label']));if(!this[_0x6a3e('0x84')](_0x50d558['variable_id'])){return this[_0x6a3e('0x37')][_0x6a3e('0x50')](_0x50d558,'no\x20variable\x20selected');}var _0x180717=this['getVariable']['sync'](this,_0x50d558[_0x6a3e('0xd6')]);if(!_0x180717){return this[_0x6a3e('0x37')]['error'](_0x50d558,_0x6a3e('0xd7'));}return this[_0x6a3e('0x37')]['setVariable'](_0x180717,_0x50d558[_0x6a3e('0x19f')]);};AGIVertices[_0x6a3e('0x13')]['start']=function(_0x240fef){logger[_0x6a3e('0x2f')](util[_0x6a3e('0x2a')](_0x6a3e('0x1a0'),_0x240fef[_0x6a3e('0x39')]));this[_0x6a3e('0x37')][_0x6a3e('0xa5')](_0x6a3e('0x1a1'));var _0x313cd5=this[_0x6a3e('0x37')][_0x6a3e('0xe')]('XMCS-UNIQUEID');if(!_['isEmpty'](_0x313cd5[_0x6a3e('0xa2')])){this['channel'][_0x6a3e('0x38')]=_0x313cd5[_0x6a3e('0xa2')];}if(_0x240fef[_0x6a3e('0xb9')]===_0x6a3e('0x1a2')){this[_0x6a3e('0x37')]['noop'](_0x6a3e('0x1a3'));return this[_0x6a3e('0x37')][_0x6a3e('0xb9')]();}return this[_0x6a3e('0x37')]['noop'](_0x6a3e('0x1a4'));};AGIVertices[_0x6a3e('0x13')][_0x6a3e('0x1a5')]=function(_0x107939){logger['info'](util[_0x6a3e('0x2a')]('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x107939[_0x6a3e('0x39')]));if(!this[_0x6a3e('0x84')](_0x107939['project_id'])){return this[_0x6a3e('0x37')][_0x6a3e('0x50')](_0x107939,_0x6a3e('0x1a6'));}var _0x307c5b=this[_0x6a3e('0x17')][_0x6a3e('0x71')](this,_0x107939[_0x6a3e('0x1a7')]);if(!this[_0x6a3e('0x84')](_0x307c5b)){return this[_0x6a3e('0x37')][_0x6a3e('0x50')](_0x107939,util[_0x6a3e('0x2a')](_0x6a3e('0x1a8'),_0x107939['project_id']));}if(_0x307c5b===this[_0x6a3e('0x37')][_0x6a3e('0x3a')]){return this[_0x6a3e('0x37')]['error'](_0x107939,_0x6a3e('0x1a9'));}this['createSquareDetailsReport']['sync'](this,_0x107939,_0x307c5b);var _0x2d0d2f=this[_0x6a3e('0x37')][_0x6a3e('0xa7')]('AGI',util[_0x6a3e('0x2a')](_0x6a3e('0x1aa'),config[_0x6a3e('0xb5')][_0x6a3e('0x1ab')]||_0x6a3e('0x1ac'),_0x307c5b,this[_0x6a3e('0x37')]['arg_1']));if(_0x2d0d2f['result']===-0x1){return _0x2d0d2f;}return this[_0x6a3e('0x37')][_0x6a3e('0xa5')](util[_0x6a3e('0x2a')](_0x6a3e('0xc3'),_0x6a3e('0x1ad'),_0x307c5b));};AGIVertices[_0x6a3e('0x13')][_0x6a3e('0x1ae')]=function(_0x1e424b){logger[_0x6a3e('0x2f')](util[_0x6a3e('0x2a')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x1e424b['label']));var _0xb3b45a=this['shellCommand'][_0x6a3e('0x71')](this,_0x1e424b[_0x6a3e('0xb7')]);this[_0x6a3e('0x36')][_0x6a3e('0x71')](this,_0x1e424b,_0x1e424b['command']);if(this['isConfigured'](_0x1e424b['variable_id'])){var _0x5d7b0e=this[_0x6a3e('0xe')][_0x6a3e('0x71')](this,_0x1e424b[_0x6a3e('0xd6')]);if(_0x5d7b0e){this[_0x6a3e('0x37')]['setVariable'](_0x5d7b0e,_0xb3b45a);return this[_0x6a3e('0x37')][_0x6a3e('0xa5')](util[_0x6a3e('0x2a')](_0x6a3e('0x1af'),_0x1e424b[_0x6a3e('0xb7')],_0x5d7b0e));}}return this['channel'][_0x6a3e('0xa5')](util['format'](_0x6a3e('0x1b0'),_0x1e424b[_0x6a3e('0xb7')]));};AGIVertices[_0x6a3e('0x13')]['google_cloud_tts']=function(_0x48aa88){logger[_0x6a3e('0x2f')](util['format'](_0x6a3e('0x1b1'),_0x48aa88[_0x6a3e('0x39')]));_0x48aa88['text']=_0x48aa88[_0x6a3e('0x5d')][_0x6a3e('0x59')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x6a3e('0x84')](_0x48aa88[_0x6a3e('0x5b')])){return this['channel']['noop'](_0x6a3e('0x1b2'));}if(!this[_0x6a3e('0x84')](_0x48aa88[_0x6a3e('0x5d')])){return this[_0x6a3e('0x37')][_0x6a3e('0xa5')](_0x6a3e('0xa6'));}this[_0x6a3e('0x37')][_0x6a3e('0xa5')](util[_0x6a3e('0x2a')](_0x6a3e('0x1b3'),_0x48aa88[_0x6a3e('0x5d')]));var _0x251657=this[_0x6a3e('0x5a')][_0x6a3e('0x71')](this,_0x48aa88);if(_0x251657){this['channel']['noop'](util[_0x6a3e('0x2a')](_0x6a3e('0x1b4'),_0x251657));var _0x32709a=this[_0x6a3e('0x37')][_0x6a3e('0xff')](_0x251657);try{fs['unlink'](_0x251657+_0x6a3e('0x101'));}catch(_0x244492){logger[_0x6a3e('0x50')](_0x244492);}return _0x32709a;}return this[_0x6a3e('0x37')][_0x6a3e('0x50')](_0x48aa88,_0x6a3e('0x1b5'));};AGIVertices['prototype'][_0x6a3e('0x1b6')]=function(_0x46ebf7){logger[_0x6a3e('0x2f')](util['format'](_0x6a3e('0x1b7'),_0x46ebf7[_0x6a3e('0x39')]));_0x46ebf7['text']=_0x46ebf7['text']['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x6a3e('0x84')](_0x46ebf7['text'])){return this[_0x6a3e('0x37')][_0x6a3e('0xa5')](_0x6a3e('0xa6'));}this[_0x6a3e('0x37')]['noop'](util['format']('Trying\x20Google\x20TTS\x20%s',_0x46ebf7[_0x6a3e('0x5d')]));var _0x2d3614=this[_0x6a3e('0x64')]['sync'](this,_0x46ebf7);if(_0x2d3614){this['channel'][_0x6a3e('0xa5')](util[_0x6a3e('0x2a')]('Google\x20TTS\x20%s\x20file\x20created',_0x2d3614));var _0x388004=this[_0x6a3e('0x37')]['streamFile'](_0x2d3614);try{fs[_0x6a3e('0x100')](_0x2d3614+_0x6a3e('0x101'));}catch(_0x3c4c5c){logger[_0x6a3e('0x50')](_0x3c4c5c);}return _0x388004;}return this[_0x6a3e('0x37')][_0x6a3e('0x50')](_0x46ebf7,_0x6a3e('0x1b8'));};AGIVertices['prototype'][_0x6a3e('0x1b9')]=function(_0x2d5b5a){logger['info'](util[_0x6a3e('0x2a')](_0x6a3e('0x1ba'),_0x2d5b5a[_0x6a3e('0x39')]));if(!this['isConfigured'](_0x2d5b5a[_0x6a3e('0x14f')])){return this[_0x6a3e('0x37')]['error'](_0x2d5b5a,_0x6a3e('0x157'));}logger[_0x6a3e('0x2f')](util['format'](_0x6a3e('0x150'),this[_0x6a3e('0x37')][_0x6a3e('0x3c')],_0x2d5b5a[_0x6a3e('0x14f')]));var _0x742bcf=this[_0x6a3e('0x51')][_0x6a3e('0x71')](this,_0x2d5b5a[_0x6a3e('0x14f')]);if(_0x742bcf){logger[_0x6a3e('0x2f')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x6a3e('0x37')]['callerid'],_0x2d5b5a[_0x6a3e('0x14f')]));this['channel'][_0x6a3e('0xa5')](util[_0x6a3e('0x2a')](_0x6a3e('0x151'),this[_0x6a3e('0x37')][_0x6a3e('0x3c')],_0x2d5b5a[_0x6a3e('0x14f')]));return{'code':0xc8,'result':_0x6a3e('0x152')};}else{logger['info'](util[_0x6a3e('0x2a')](_0x6a3e('0x153'),this['channel'][_0x6a3e('0x3c')],_0x2d5b5a[_0x6a3e('0x14f')]));this[_0x6a3e('0x37')]['noop'](util[_0x6a3e('0x2a')](_0x6a3e('0x153'),this[_0x6a3e('0x37')][_0x6a3e('0x3c')],_0x2d5b5a[_0x6a3e('0x14f')]));return{'code':0xc8,'result':_0x6a3e('0x154')};}};AGIVertices['prototype'][_0x6a3e('0x1bb')]=function(_0x393c6d){logger[_0x6a3e('0x2f')](util[_0x6a3e('0x2a')](_0x6a3e('0x1bc'),_0x393c6d[_0x6a3e('0x39')]));var _0x42d743=this[_0x6a3e('0x37')]['exec'](_0x6a3e('0x1bd'),[_0x393c6d[_0x6a3e('0x1be')],_0x393c6d[_0x6a3e('0x78')]]);if(_0x42d743[_0x6a3e('0xa9')]===-0x1){return _0x42d743;}return this[_0x6a3e('0x37')][_0x6a3e('0xa5')](util[_0x6a3e('0x2a')](_0x6a3e('0xc3'),_0x6a3e('0x1bd'),_0x393c6d['mailbox']));};AGIVertices['prototype'][_0x6a3e('0x1bf')]=function(_0x5396d8){logger['info'](util[_0x6a3e('0x2a')]('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x5396d8[_0x6a3e('0x39')]));if(!this[_0x6a3e('0x84')](_0x5396d8[_0x6a3e('0xd6')])){return this['channel'][_0x6a3e('0x50')](_0x5396d8,_0x6a3e('0x1c0'));}var _0x38187a=this[_0x6a3e('0xe')][_0x6a3e('0x71')](this,_0x5396d8['variable_id']);if(!_0x38187a){return this[_0x6a3e('0x37')][_0x6a3e('0x50')](_0x5396d8,_0x6a3e('0xd7'));}var _0x100dee=this['channel'][_0x6a3e('0xe')](_0x38187a);return{'code':0xc8,'result':_0x100dee[_0x6a3e('0xa2')]?_0x100dee[_0x6a3e('0xa2')]:'-'};};String[_0x6a3e('0x13')][_0x6a3e('0x1c1')]=function(_0x55ea0a,_0x3d88a8){return this[_0x6a3e('0x9e')](_0x55ea0a)[_0x6a3e('0x1c2')](_0x3d88a8);};module[_0x6a3e('0x1c3')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index df3654e..22661a8 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 _0xe5f0=['all','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','../ami','../../../config/logger','acw','../rpc/user','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','prototype','updateAcw','lastPauseAt','timer','update','uniqueid','then','info','[%s][UPDATE][ACWTIME:%s]','catch','[%s][UPDATE][ERRORS:%s]','startAcw','interface','ACW','mandatoryDisposition','mandatoryDispositionPause','Action','voicePause','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','available','paused','acwTimeout','format','YYYY-MM-DD\x20HH:mm:ss','queue','error','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','finally','message','stopAcw','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','syncHangupRequest','linkedid','isUndefined','[%s][HANGUP:LINKEDID]','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','stringify','[%s][BLINDTRANSFER:LINKEDID]','transfererlinkedid','autopause'];(function(_0x2dbcef,_0x1cfecb){var _0x5a90ea=function(_0x189054){while(--_0x189054){_0x2dbcef['push'](_0x2dbcef['shift']());}};_0x5a90ea(++_0x1cfecb);}(_0xe5f0,0xa6));var _0x0e5f=function(_0x456bd2,_0x156c79){_0x456bd2=_0x456bd2-0x0;var _0x2218c1=_0xe5f0[_0x456bd2];return _0x2218c1;};'use strict';var _=require(_0x0e5f('0x0'));var moment=require('moment');var ami=require(_0x0e5f('0x1'));var logger=require(_0x0e5f('0x2'))(_0x0e5f('0x3'));var RpcUser=require(_0x0e5f('0x4'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x372e22){this[_0x0e5f('0x5')]=_0x372e22['voiceQueues'];this[_0x0e5f('0x6')]=_0x372e22['agents'];this[_0x0e5f('0x7')]=_0x372e22[_0x0e5f('0x7')];this[_0x0e5f('0x8')]={};ami['on'](_0x0e5f('0x9'),this[_0x0e5f('0xa')][_0x0e5f('0xb')](this));ami['on']('hanguprequest',this['syncHangupRequest'][_0x0e5f('0xb')](this));ami['on'](_0x0e5f('0xc'),this[_0x0e5f('0xd')]['bind'](this));ami['on'](_0x0e5f('0xe'),this[_0x0e5f('0xf')][_0x0e5f('0xb')](this));ami['on'](_0x0e5f('0x10'),this[_0x0e5f('0x11')][_0x0e5f('0xb')](this));ami['on'](_0x0e5f('0x12'),this['syncBlindTransfer'][_0x0e5f('0xb')](this));ami['on'](_0x0e5f('0x13'),this[_0x0e5f('0x14')][_0x0e5f('0xb')](this));}function getDiff(_0xc3896f){var _0x5e7c9c=moment()[_0x0e5f('0x15')](0x0);var _0xf8c9f7=moment(_0xc3896f)['milliseconds'](0x0);return _0x5e7c9c['diff'](_0xf8c9f7,'seconds');}Acw[_0x0e5f('0x16')][_0x0e5f('0x17')]=function(_0x2e01e3,_0x4f8755){var _0x423da9=this;var _0x48418a=getDiff(_0x423da9[_0x0e5f('0x7')][_0x2e01e3][_0x0e5f('0x18')]);clearTimeout(_0x423da9[_0x0e5f('0x7')][_0x2e01e3][_0x0e5f('0x19')]);_0x423da9[_0x0e5f('0x7')][_0x2e01e3]['timer']=![];return RpcVoiceAgentReport[_0x0e5f('0x1a')]({'acwtime':_0x48418a},_0x423da9[_0x0e5f('0x7')][_0x2e01e3][_0x0e5f('0x1b')],_0x2e01e3)[_0x0e5f('0x1c')](function(_0xc7ab2a){logger[_0x0e5f('0x1d')](_0x0e5f('0x1e'),_0x4f8755,_0x48418a,_0xc7ab2a);})[_0x0e5f('0x1f')](function(_0x5230df){logger['error'](_0x0e5f('0x20'),_0x4f8755,_0x5230df);})['finally'](function(){delete _0x423da9[_0x0e5f('0x7')][_0x2e01e3];});};Acw[_0x0e5f('0x16')][_0x0e5f('0x21')]=function(_0x3e2867){try{var _0x31a2e2=this;var _0x4a1057=this[_0x0e5f('0x8')][_0x3e2867][_0x0e5f('0x22')];var _0x13dce3=this[_0x0e5f('0x8')][_0x3e2867]['queue'];var _0x1303c4=this['voiceQueues'][_0x13dce3];var _0x4a67eb=![];var _0x23e543=_0x0e5f('0x23');if(_0x1303c4[_0x0e5f('0x24')]&&_0x1303c4[_0x0e5f('0x25')]['name']){_0x4a67eb=!![];_0x23e543=_0x1303c4['mandatoryDispositionPause']['name'];}return ami[_0x0e5f('0x26')]({'action':'QueuePause','interface':_0x4a1057,'paused':!![],'reason':_0x23e543})['then'](function(){if(_0x31a2e2[_0x0e5f('0x6')][_0x4a1057]){return RpcUser['getAgent'](_0x31a2e2[_0x0e5f('0x6')][_0x4a1057]['id'])[_0x0e5f('0x1c')](function(_0x148c5a){if(!_0x148c5a||_0x148c5a[_0x0e5f('0x27')]){logger[_0x0e5f('0x1d')](_0x0e5f('0x28'),_0x3e2867,_0x4a1057,_0x13dce3);return;}logger[_0x0e5f('0x1d')]('[%s][START][AGENT:%s][QUEUE:%s]',_0x3e2867,_0x4a1057,_0x13dce3);var _0x430a7a=_0x31a2e2[_0x0e5f('0x8')][_0x3e2867][_0x0e5f('0x29')]&&_0x31a2e2[_0x0e5f('0x8')][_0x3e2867][_0x0e5f('0x2a')]?_0x31a2e2[_0x0e5f('0x8')][_0x3e2867][_0x0e5f('0x2a')]:_0x3e2867;return RpcUser[_0x0e5f('0x2b')](_0x31a2e2['agents'][_0x4a1057],_0x23e543,_0x430a7a)['then'](function(_0x4ba077){_0x31a2e2[_0x0e5f('0x5')][_0x13dce3][_0x0e5f('0x2c')]-=0x1;_0x31a2e2[_0x0e5f('0x5')][_0x13dce3][_0x0e5f('0x2d')]+=0x1;return _0x4ba077;});})['then'](function(_0x3b87c5){if(_0x4a67eb||!_0x3b87c5){return;}_0x31a2e2[_0x0e5f('0x7')][_0x4a1057]={};logger['info']('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x3e2867,_0x31a2e2[_0x0e5f('0x5')][_0x13dce3][_0x0e5f('0x2e')],_0x4a1057,_0x13dce3);_0x31a2e2[_0x0e5f('0x7')][_0x4a1057][_0x0e5f('0x19')]=setTimeout(_0x31a2e2['stopAcw'][_0x0e5f('0xb')](_0x31a2e2,_0x4a1057),_0x31a2e2['voiceQueues'][_0x13dce3][_0x0e5f('0x2e')]*0x3e8);_0x31a2e2[_0x0e5f('0x7')][_0x4a1057][_0x0e5f('0x18')]=moment()[_0x0e5f('0x2f')](_0x0e5f('0x30'));_0x31a2e2[_0x0e5f('0x7')][_0x4a1057][_0x0e5f('0x1b')]=_0x3e2867;_0x31a2e2[_0x0e5f('0x7')][_0x4a1057][_0x0e5f('0x31')]=_0x13dce3;_0x31a2e2[_0x0e5f('0x7')][_0x4a1057][_0x0e5f('0x17')]=_0x31a2e2[_0x0e5f('0x17')][_0x0e5f('0xb')](_0x31a2e2,_0x4a1057,_0x3e2867);});}})['catch'](function(){logger[_0x0e5f('0x32')](_0x0e5f('0x33'),_0x3e2867,_0x31a2e2['voiceQueues'][_0x13dce3][_0x0e5f('0x2e')],_0x4a1057,_0x13dce3);})[_0x0e5f('0x34')](function(){delete _0x31a2e2['channels'][_0x3e2867];});}catch(_0x5a88ec){logger['error']('[ACW][START]\x20%s',_0x5a88ec[_0x0e5f('0x35')]);}};Acw[_0x0e5f('0x16')][_0x0e5f('0x36')]=function(_0x16a706){try{var _0x5cc37e=this;if(_0x5cc37e['timers'][_0x16a706]){_0x5cc37e['timers'][_0x16a706][_0x0e5f('0x19')]=![];var _0x25e283=_0x5cc37e[_0x0e5f('0x7')][_0x16a706][_0x0e5f('0x1b')];var _0x180989=_0x5cc37e[_0x0e5f('0x7')][_0x16a706]['queue'];var _0xd91c7d=_0x5cc37e[_0x0e5f('0x5')][_0x180989]['acwTimeout'];logger[_0x0e5f('0x1d')](_0x0e5f('0x37'),_0x25e283,_0x16a706);RpcUser['getAgent'](this[_0x0e5f('0x6')][_0x16a706]['id'])[_0x0e5f('0x1c')](function(_0x1481b9){if(_0x1481b9['pauseType']===_0x0e5f('0x23')){return RpcUser[_0x0e5f('0x38')](_0x5cc37e['agents'][_0x16a706]);}});RpcVoiceAgentReport['update']({'acwtime':_0xd91c7d,'agentacw':!![]},_0x25e283,_0x16a706)[_0x0e5f('0x1c')](function(_0x18962b){logger[_0x0e5f('0x1d')](_0x0e5f('0x1e'),_0x25e283,_0xd91c7d,_0x18962b);})[_0x0e5f('0x1f')](function(_0xaa1455){logger['error']('[%s][UPDATE][ERRORS:%s]',_0x25e283,_0xaa1455);});}else{logger[_0x0e5f('0x32')](_0x0e5f('0x39'),_0x16a706);if(_0x5cc37e[_0x0e5f('0x7')]){logger[_0x0e5f('0x1d')](_0x0e5f('0x3a'),JSON['stringify'](_0x5cc37e[_0x0e5f('0x7')]));}}}catch(_0xd29d89){logger[_0x0e5f('0x32')]('[ACW][STOP]\x20%s',_0xd29d89[_0x0e5f('0x35')]);}};Acw[_0x0e5f('0x16')][_0x0e5f('0xa')]=function(_0x16c8d1){try{if(this['voiceQueues'][_0x16c8d1['queue']]&&(this[_0x0e5f('0x5')][_0x16c8d1[_0x0e5f('0x31')]]['acw']||this[_0x0e5f('0x5')][_0x16c8d1['queue']][_0x0e5f('0x24')])){if(this[_0x0e5f('0x6')][_0x16c8d1['interface']]){this[_0x0e5f('0x8')][_0x16c8d1[_0x0e5f('0x1b')]]={'queue':_0x16c8d1[_0x0e5f('0x31')],'interface':_0x16c8d1[_0x0e5f('0x22')],'destlinkedid':_0x16c8d1['destlinkedid']};}}}catch(_0x459180){logger['error'](_0x0e5f('0x3b'),_0x459180[_0x0e5f('0x35')]);}};Acw['prototype'][_0x0e5f('0x14')]=function(_0x551888){try{if(this[_0x0e5f('0x5')][_0x551888[_0x0e5f('0x31')]]&&(this['voiceQueues'][_0x551888[_0x0e5f('0x31')]][_0x0e5f('0x3')]||this[_0x0e5f('0x5')][_0x551888['queue']][_0x0e5f('0x24')])){if(this['agents'][_0x551888[_0x0e5f('0x22')]]){this[_0x0e5f('0x8')][_0x551888[_0x0e5f('0x1b')]]={'queue':_0x551888[_0x0e5f('0x31')],'interface':_0x551888['interface']};}}}catch(_0x515201){logger[_0x0e5f('0x32')](_0x0e5f('0x3c'),_0x515201[_0x0e5f('0x35')]);}};Acw[_0x0e5f('0x16')][_0x0e5f('0x3d')]=function(_0x255205){try{if(this[_0x0e5f('0x8')][_0x255205['uniqueid']]&&_['isUndefined'](this[_0x0e5f('0x8')][_0x255205[_0x0e5f('0x1b')]]['attended'])){logger[_0x0e5f('0x1d')]('[%s][HANGUP:UNIQUEID]',_0x255205[_0x0e5f('0x1b')]);this[_0x0e5f('0x21')](_0x255205[_0x0e5f('0x1b')]);}else if(this['channels'][_0x255205[_0x0e5f('0x3e')]]&&_[_0x0e5f('0x3f')](this[_0x0e5f('0x8')][_0x255205[_0x0e5f('0x3e')]][_0x0e5f('0x29')])){logger[_0x0e5f('0x1d')](_0x0e5f('0x40'),_0x255205[_0x0e5f('0x3e')]);this[_0x0e5f('0x21')](_0x255205[_0x0e5f('0x3e')]);}}catch(_0x3f7771){logger[_0x0e5f('0x32')]('[ACW][syncHangupRequest]\x20%s',_0x3f7771['message']);}};Acw[_0x0e5f('0x16')][_0x0e5f('0xd')]=function(_0x131d7d){try{if(this['channels'][_0x131d7d[_0x0e5f('0x1b')]]&&this[_0x0e5f('0x8')][_0x131d7d[_0x0e5f('0x1b')]][_0x0e5f('0x29')]){logger[_0x0e5f('0x1d')](_0x0e5f('0x41'),_0x131d7d[_0x0e5f('0x1b')]);this[_0x0e5f('0x21')](_0x131d7d[_0x0e5f('0x1b')]);}else if(this['channels'][_0x131d7d[_0x0e5f('0x3e')]]&&this[_0x0e5f('0x8')][_0x131d7d[_0x0e5f('0x3e')]][_0x0e5f('0x29')]){logger[_0x0e5f('0x1d')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x131d7d[_0x0e5f('0x3e')]);this[_0x0e5f('0x21')](_0x131d7d['linkedid']);}}catch(_0x4a30b8){logger[_0x0e5f('0x32')]('[ACW][syncHangup]\x20%s',_0x4a30b8[_0x0e5f('0x35')]);}};Acw['prototype'][_0x0e5f('0x11')]=function(_0x3b81be){try{if(!_[_0x0e5f('0x42')](this['channels'][_0x3b81be[_0x0e5f('0x43')]])){this[_0x0e5f('0x21')](_0x3b81be[_0x0e5f('0x43')]);if(this[_0x0e5f('0x8')][_0x3b81be[_0x0e5f('0x44')]]){this['channels'][_0x3b81be[_0x0e5f('0x44')]][_0x0e5f('0x29')]=!![];this[_0x0e5f('0x8')][_0x3b81be[_0x0e5f('0x45')]]=this[_0x0e5f('0x8')][_0x3b81be[_0x0e5f('0x44')]];delete this[_0x0e5f('0x8')][_0x3b81be[_0x0e5f('0x44')]];}}else if(!_[_0x0e5f('0x42')](this[_0x0e5f('0x8')][_0x3b81be[_0x0e5f('0x45')]])){this[_0x0e5f('0x21')](_0x3b81be[_0x0e5f('0x45')]);if(this[_0x0e5f('0x8')][_0x3b81be[_0x0e5f('0x46')]]){this[_0x0e5f('0x8')][_0x3b81be[_0x0e5f('0x46')]]['attended']=!![];this[_0x0e5f('0x8')][_0x3b81be['transfereeuniqueid']]=this[_0x0e5f('0x8')][_0x3b81be[_0x0e5f('0x46')]];delete this['channels'][_0x3b81be[_0x0e5f('0x46')]];}}}catch(_0xa44208){logger[_0x0e5f('0x32')]('[ACW][syncAttendedTransfer]\x20%s',_0xa44208[_0x0e5f('0x35')]);}};Acw[_0x0e5f('0x16')]['syncBlindTransfer']=function(_0x4e4ccb){try{if(this[_0x0e5f('0x8')][_0x4e4ccb[_0x0e5f('0x47')]]){logger['info'](_0x0e5f('0x48'),JSON[_0x0e5f('0x49')](_0x4e4ccb[_0x0e5f('0x47')]));this[_0x0e5f('0x21')](_0x4e4ccb['transfereruniqueid']);}else if(this[_0x0e5f('0x8')][_0x4e4ccb['transfererlinkedid']]){logger[_0x0e5f('0x1d')](_0x0e5f('0x4a'),JSON['stringify'](_0x4e4ccb[_0x0e5f('0x4b')]));this['startAcw'](_0x4e4ccb[_0x0e5f('0x4b')]);}}catch(_0x172c90){logger[_0x0e5f('0x32')]('[ACW][syncBlindTransfer]\x20%s',_0x172c90['message']);}};Acw[_0x0e5f('0x16')][_0x0e5f('0xf')]=function(_0x3f1d44){try{if(this[_0x0e5f('0x5')][_0x3f1d44[_0x0e5f('0x31')]]&&this[_0x0e5f('0x5')][_0x3f1d44[_0x0e5f('0x31')]][_0x0e5f('0x4c')]===_0x0e5f('0x4d')){if(this[_0x0e5f('0x6')][_0x3f1d44[_0x0e5f('0x22')]]){logger[_0x0e5f('0x1d')]('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x3f1d44[_0x0e5f('0x1b')],_0x3f1d44[_0x0e5f('0x22')],_0x3f1d44[_0x0e5f('0x31')]);return RpcUser[_0x0e5f('0x2b')](this['agents'][_0x3f1d44[_0x0e5f('0x22')]],_0x0e5f('0x4e'),_0x3f1d44['uniqueid']);}}}catch(_0x1a433f){logger[_0x0e5f('0x32')](_0x0e5f('0x4f'),_0x1a433f[_0x0e5f('0x35')]);}};module[_0x0e5f('0x50')]=Acw; \ No newline at end of file +var _0xaad5=['transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','syncAgentRingNoAnswer','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','agentconnect','bind','hanguprequest','syncHangupRequest','hangup','agentringnoanswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','updateAcw','lastPauseAt','timer','then','info','[%s][UPDATE][ACWTIME:%s]','catch','[%s][UPDATE][ERRORS:%s]','finally','startAcw','channels','interface','queue','ACW','mandatoryDispositionPause','name','Action','QueuePause','getAgent','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','available','paused','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','YYYY-MM-DD\x20HH:mm:ss','uniqueid','error','[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]','pauseType','update','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','[ACW][STOP]\x20%s','mandatoryDisposition','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','[%s][HANGUP:UNIQUEID]','linkedid','isUndefined','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','syncHangup','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','stringify'];(function(_0x56ccbe,_0x11e4be){var _0x15993c=function(_0x3bd9db){while(--_0x3bd9db){_0x56ccbe['push'](_0x56ccbe['shift']());}};_0x15993c(++_0x11e4be);}(_0xaad5,0xbf));var _0x5aad=function(_0x26b8b5,_0xf5c2c1){_0x26b8b5=_0x26b8b5-0x0;var _0x2150a9=_0xaad5[_0x26b8b5];return _0x2150a9;};'use strict';var _=require(_0x5aad('0x0'));var moment=require('moment');var ami=require('../ami');var logger=require('../../../config/logger')(_0x5aad('0x1'));var RpcUser=require(_0x5aad('0x2'));var RpcVoiceAgentReport=require(_0x5aad('0x3'));function Acw(_0x2b83f8){this[_0x5aad('0x4')]=_0x2b83f8[_0x5aad('0x4')];this[_0x5aad('0x5')]=_0x2b83f8[_0x5aad('0x5')];this['timers']=_0x2b83f8[_0x5aad('0x6')];this['channels']={};ami['on'](_0x5aad('0x7'),this['syncAgentConnect'][_0x5aad('0x8')](this));ami['on'](_0x5aad('0x9'),this[_0x5aad('0xa')][_0x5aad('0x8')](this));ami['on'](_0x5aad('0xb'),this['syncHangup'][_0x5aad('0x8')](this));ami['on'](_0x5aad('0xc'),this['syncAgentRingNoAnswer'][_0x5aad('0x8')](this));ami['on'](_0x5aad('0xd'),this[_0x5aad('0xe')][_0x5aad('0x8')](this));ami['on'](_0x5aad('0xf'),this[_0x5aad('0x10')][_0x5aad('0x8')](this));ami['on']('custom:agentConnectPreview',this[_0x5aad('0x11')][_0x5aad('0x8')](this));}function getDiff(_0x3be2eb){var _0x324de2=moment()['milliseconds'](0x0);var _0x20581d=moment(_0x3be2eb)[_0x5aad('0x12')](0x0);return _0x324de2[_0x5aad('0x13')](_0x20581d,_0x5aad('0x14'));}Acw[_0x5aad('0x15')][_0x5aad('0x16')]=function(_0x46d626,_0xd54c0a){var _0x215428=this;var _0x4df413=getDiff(_0x215428['timers'][_0x46d626][_0x5aad('0x17')]);clearTimeout(_0x215428[_0x5aad('0x6')][_0x46d626][_0x5aad('0x18')]);_0x215428[_0x5aad('0x6')][_0x46d626][_0x5aad('0x18')]=![];return RpcVoiceAgentReport['update']({'acwtime':_0x4df413},_0x215428[_0x5aad('0x6')][_0x46d626]['uniqueid'],_0x46d626)[_0x5aad('0x19')](function(_0x5964a2){logger[_0x5aad('0x1a')](_0x5aad('0x1b'),_0xd54c0a,_0x4df413,_0x5964a2);})[_0x5aad('0x1c')](function(_0x3c0759){logger['error'](_0x5aad('0x1d'),_0xd54c0a,_0x3c0759);})[_0x5aad('0x1e')](function(){delete _0x215428['timers'][_0x46d626];});};Acw[_0x5aad('0x15')][_0x5aad('0x1f')]=function(_0x449758){try{var _0x53ff78=this;var _0x2eb75b=this[_0x5aad('0x20')][_0x449758][_0x5aad('0x21')];var _0x10db46=this['channels'][_0x449758][_0x5aad('0x22')];var _0x394e70=this[_0x5aad('0x4')][_0x10db46];var _0x3ece5e=![];var _0x448779=_0x5aad('0x23');if(_0x394e70['mandatoryDisposition']&&_0x394e70[_0x5aad('0x24')][_0x5aad('0x25')]){_0x3ece5e=!![];_0x448779=_0x394e70[_0x5aad('0x24')][_0x5aad('0x25')];}return ami[_0x5aad('0x26')]({'action':_0x5aad('0x27'),'interface':_0x2eb75b,'paused':!![],'reason':_0x448779})[_0x5aad('0x19')](function(){if(_0x53ff78['agents'][_0x2eb75b]){return RpcUser[_0x5aad('0x28')](_0x53ff78[_0x5aad('0x5')][_0x2eb75b]['id'])[_0x5aad('0x19')](function(_0x4ba044){if(!_0x4ba044||_0x4ba044['voicePause']){logger[_0x5aad('0x1a')](_0x5aad('0x29'),_0x449758,_0x2eb75b,_0x10db46);return;}logger['info'](_0x5aad('0x2a'),_0x449758,_0x2eb75b,_0x10db46);var _0x414aac=_0x53ff78[_0x5aad('0x20')][_0x449758][_0x5aad('0x2b')]&&_0x53ff78[_0x5aad('0x20')][_0x449758][_0x5aad('0x2c')]?_0x53ff78[_0x5aad('0x20')][_0x449758][_0x5aad('0x2c')]:_0x449758;return RpcUser[_0x5aad('0x2d')](_0x53ff78[_0x5aad('0x5')][_0x2eb75b],_0x448779,_0x414aac)['then'](function(_0x2dcad8){_0x53ff78[_0x5aad('0x4')][_0x10db46][_0x5aad('0x2e')]-=0x1;_0x53ff78[_0x5aad('0x4')][_0x10db46][_0x5aad('0x2f')]+=0x1;return _0x2dcad8;});})[_0x5aad('0x19')](function(_0x4433f4){if(_0x3ece5e||!_0x4433f4){return;}_0x53ff78['timers'][_0x2eb75b]={};logger[_0x5aad('0x1a')](_0x5aad('0x30'),_0x449758,_0x53ff78[_0x5aad('0x4')][_0x10db46][_0x5aad('0x31')],_0x2eb75b,_0x10db46);_0x53ff78['timers'][_0x2eb75b][_0x5aad('0x18')]=setTimeout(_0x53ff78[_0x5aad('0x32')]['bind'](_0x53ff78,_0x2eb75b),_0x53ff78[_0x5aad('0x4')][_0x10db46]['acwTimeout']*0x3e8);_0x53ff78[_0x5aad('0x6')][_0x2eb75b][_0x5aad('0x17')]=moment()['format'](_0x5aad('0x33'));_0x53ff78[_0x5aad('0x6')][_0x2eb75b][_0x5aad('0x34')]=_0x449758;_0x53ff78[_0x5aad('0x6')][_0x2eb75b][_0x5aad('0x22')]=_0x10db46;_0x53ff78[_0x5aad('0x6')][_0x2eb75b][_0x5aad('0x16')]=_0x53ff78[_0x5aad('0x16')][_0x5aad('0x8')](_0x53ff78,_0x2eb75b,_0x449758);});}})[_0x5aad('0x1c')](function(){logger[_0x5aad('0x35')](_0x5aad('0x30'),_0x449758,_0x53ff78[_0x5aad('0x4')][_0x10db46][_0x5aad('0x31')],_0x2eb75b,_0x10db46);})[_0x5aad('0x1e')](function(){delete _0x53ff78['channels'][_0x449758];});}catch(_0x28f0e9){logger[_0x5aad('0x35')](_0x5aad('0x36'),_0x28f0e9[_0x5aad('0x37')]);}};Acw[_0x5aad('0x15')][_0x5aad('0x32')]=function(_0x29805e){try{var _0x13b604=this;if(_0x13b604[_0x5aad('0x6')][_0x29805e]){_0x13b604[_0x5aad('0x6')][_0x29805e][_0x5aad('0x18')]=![];var _0x1c2d84=_0x13b604['timers'][_0x29805e][_0x5aad('0x34')];var _0x18cdfb=_0x13b604[_0x5aad('0x6')][_0x29805e][_0x5aad('0x22')];var _0x1a6b99=_0x13b604['voiceQueues'][_0x18cdfb][_0x5aad('0x31')];logger[_0x5aad('0x1a')](_0x5aad('0x38'),_0x1c2d84,_0x29805e);RpcUser['getAgent'](this[_0x5aad('0x5')][_0x29805e]['id'])[_0x5aad('0x19')](function(_0x476248){if(_0x476248[_0x5aad('0x39')]===_0x5aad('0x23')){return RpcUser['saveUnpause'](_0x13b604['agents'][_0x29805e]);}});RpcVoiceAgentReport[_0x5aad('0x3a')]({'acwtime':_0x1a6b99,'agentacw':!![]},_0x1c2d84,_0x29805e)[_0x5aad('0x19')](function(_0x866cfa){logger['info'](_0x5aad('0x1b'),_0x1c2d84,_0x1a6b99,_0x866cfa);})[_0x5aad('0x1c')](function(_0x344131){logger[_0x5aad('0x35')](_0x5aad('0x1d'),_0x1c2d84,_0x344131);});}else{logger[_0x5aad('0x35')](_0x5aad('0x3b'),_0x29805e);if(_0x13b604[_0x5aad('0x6')]){logger[_0x5aad('0x1a')](_0x5aad('0x3c'),JSON['stringify'](_0x13b604[_0x5aad('0x6')]));}}}catch(_0x537616){logger[_0x5aad('0x35')](_0x5aad('0x3d'),_0x537616[_0x5aad('0x37')]);}};Acw['prototype']['syncAgentConnect']=function(_0x1f5f21){try{if(this['voiceQueues'][_0x1f5f21[_0x5aad('0x22')]]&&(this[_0x5aad('0x4')][_0x1f5f21[_0x5aad('0x22')]]['acw']||this['voiceQueues'][_0x1f5f21[_0x5aad('0x22')]][_0x5aad('0x3e')])){if(this[_0x5aad('0x5')][_0x1f5f21['interface']]){this[_0x5aad('0x20')][_0x1f5f21[_0x5aad('0x34')]]={'queue':_0x1f5f21['queue'],'interface':_0x1f5f21['interface'],'destlinkedid':_0x1f5f21['destlinkedid']};}}}catch(_0x3a2eb4){logger[_0x5aad('0x35')](_0x5aad('0x3f'),_0x3a2eb4[_0x5aad('0x37')]);}};Acw[_0x5aad('0x15')][_0x5aad('0x11')]=function(_0x31ed95){try{if(this[_0x5aad('0x4')][_0x31ed95['queue']]&&(this['voiceQueues'][_0x31ed95[_0x5aad('0x22')]][_0x5aad('0x1')]||this[_0x5aad('0x4')][_0x31ed95[_0x5aad('0x22')]]['mandatoryDisposition'])){if(this[_0x5aad('0x5')][_0x31ed95[_0x5aad('0x21')]]){this[_0x5aad('0x20')][_0x31ed95['uniqueid']]={'queue':_0x31ed95[_0x5aad('0x22')],'interface':_0x31ed95[_0x5aad('0x21')]};}}}catch(_0x440424){logger['error'](_0x5aad('0x40'),_0x440424[_0x5aad('0x37')]);}};Acw[_0x5aad('0x15')][_0x5aad('0xa')]=function(_0x52e3b5){try{if(this['channels'][_0x52e3b5[_0x5aad('0x34')]]&&_['isUndefined'](this['channels'][_0x52e3b5[_0x5aad('0x34')]]['attended'])){logger[_0x5aad('0x1a')](_0x5aad('0x41'),_0x52e3b5[_0x5aad('0x34')]);this[_0x5aad('0x1f')](_0x52e3b5[_0x5aad('0x34')]);}else if(this[_0x5aad('0x20')][_0x52e3b5[_0x5aad('0x42')]]&&_[_0x5aad('0x43')](this['channels'][_0x52e3b5['linkedid']]['attended'])){logger[_0x5aad('0x1a')](_0x5aad('0x44'),_0x52e3b5[_0x5aad('0x42')]);this[_0x5aad('0x1f')](_0x52e3b5[_0x5aad('0x42')]);}}catch(_0x481c82){logger[_0x5aad('0x35')](_0x5aad('0x45'),_0x481c82[_0x5aad('0x37')]);}};Acw['prototype'][_0x5aad('0x46')]=function(_0xb40067){try{if(this[_0x5aad('0x20')][_0xb40067[_0x5aad('0x34')]]&&this[_0x5aad('0x20')][_0xb40067[_0x5aad('0x34')]]['attended']){logger[_0x5aad('0x1a')](_0x5aad('0x47'),_0xb40067[_0x5aad('0x34')]);this['startAcw'](_0xb40067['uniqueid']);}else if(this[_0x5aad('0x20')][_0xb40067['linkedid']]&&this[_0x5aad('0x20')][_0xb40067[_0x5aad('0x42')]][_0x5aad('0x2b')]){logger[_0x5aad('0x1a')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0xb40067['linkedid']);this[_0x5aad('0x1f')](_0xb40067['linkedid']);}}catch(_0x4516c4){logger[_0x5aad('0x35')](_0x5aad('0x48'),_0x4516c4[_0x5aad('0x37')]);}};Acw[_0x5aad('0x15')][_0x5aad('0xe')]=function(_0x5f5939){try{if(!_[_0x5aad('0x49')](this[_0x5aad('0x20')][_0x5f5939['transfereeuniqueid']])){this[_0x5aad('0x1f')](_0x5f5939[_0x5aad('0x4a')]);if(this['channels'][_0x5f5939['secondtransfereruniqueid']]){this['channels'][_0x5f5939[_0x5aad('0x4b')]][_0x5aad('0x2b')]=!![];this['channels'][_0x5f5939[_0x5aad('0x4c')]]=this[_0x5aad('0x20')][_0x5f5939['secondtransfereruniqueid']];delete this[_0x5aad('0x20')][_0x5f5939['secondtransfereruniqueid']];}}else if(!_['isNil'](this[_0x5aad('0x20')][_0x5f5939[_0x5aad('0x4c')]])){this[_0x5aad('0x1f')](_0x5f5939[_0x5aad('0x4c')]);if(this['channels'][_0x5f5939[_0x5aad('0x4d')]]){this['channels'][_0x5f5939[_0x5aad('0x4d')]][_0x5aad('0x2b')]=!![];this[_0x5aad('0x20')][_0x5f5939['transfereeuniqueid']]=this[_0x5aad('0x20')][_0x5f5939['origtransfereruniqueid']];delete this[_0x5aad('0x20')][_0x5f5939[_0x5aad('0x4d')]];}}}catch(_0x2cfa0d){logger['error'](_0x5aad('0x4e'),_0x2cfa0d['message']);}};Acw['prototype'][_0x5aad('0x10')]=function(_0x1bcf7f){try{if(this[_0x5aad('0x20')][_0x1bcf7f[_0x5aad('0x4f')]]){logger[_0x5aad('0x1a')](_0x5aad('0x50'),JSON[_0x5aad('0x51')](_0x1bcf7f[_0x5aad('0x4f')]));this['startAcw'](_0x1bcf7f[_0x5aad('0x4f')]);}else if(this['channels'][_0x1bcf7f[_0x5aad('0x52')]]){logger[_0x5aad('0x1a')](_0x5aad('0x53'),JSON[_0x5aad('0x51')](_0x1bcf7f[_0x5aad('0x52')]));this['startAcw'](_0x1bcf7f[_0x5aad('0x52')]);}}catch(_0x491423){logger[_0x5aad('0x35')](_0x5aad('0x54'),_0x491423[_0x5aad('0x37')]);}};Acw[_0x5aad('0x15')][_0x5aad('0x55')]=function(_0x2eee55){try{if(this['voiceQueues'][_0x2eee55[_0x5aad('0x22')]]&&this['voiceQueues'][_0x2eee55['queue']]['autopause']===_0x5aad('0x56')){if(this[_0x5aad('0x5')][_0x2eee55[_0x5aad('0x21')]]){logger[_0x5aad('0x1a')](_0x5aad('0x57'),_0x2eee55[_0x5aad('0x34')],_0x2eee55[_0x5aad('0x21')],_0x2eee55[_0x5aad('0x22')]);return RpcUser['savePause'](this[_0x5aad('0x5')][_0x2eee55['interface']],_0x5aad('0x58'),_0x2eee55[_0x5aad('0x34')]);}}}catch(_0x5ad929){logger[_0x5aad('0x35')](_0x5aad('0x59'),_0x5ad929[_0x5aad('0x37')]);}};module[_0x5aad('0x5a')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 8a4d15a..8357c9f 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 _0x1145=['exports','asterisk-manager','util','../../config/logger','ami','../../config/environment','port','asterisk','password','keepConnected','Action','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','username','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','inspect','resolve','then','actionCoreShowChannels','catch','[ami.js][fullybooted]'];(function(_0x5eb5fb,_0x27f12c){var _0x2051e2=function(_0x421341){while(--_0x421341){_0x5eb5fb['push'](_0x5eb5fb['shift']());}};_0x2051e2(++_0x27f12c);}(_0x1145,0x1d5));var _0x5114=function(_0x580e56,_0x154e5d){_0x580e56=_0x580e56-0x0;var _0x23acc5=_0x1145[_0x580e56];return _0x23acc5;};'use strict';var Manager=require(_0x5114('0x0'));var BPromise=require('bluebird');var util=require(_0x5114('0x1'));var logger=require(_0x5114('0x2'))(_0x5114('0x3'));var config=require(_0x5114('0x4'));var ami=new Manager(config['asterisk'][_0x5114('0x5')],config[_0x5114('0x6')]['ip'],config[_0x5114('0x6')]['username'],config[_0x5114('0x6')][_0x5114('0x7')],!![]);ami[_0x5114('0x8')]();ami[_0x5114('0x9')]=BPromise['promisify'](ami[_0x5114('0xa')]);function error(_0x3ea56c){logger[_0x5114('0xb')](util[_0x5114('0xc')](_0x5114('0xd'),config[_0x5114('0x6')][_0x5114('0xe')],config[_0x5114('0x6')]['ip'],config[_0x5114('0x6')][_0x5114('0x5')],util['inspect'](_0x3ea56c,![],null)));}function close(){logger[_0x5114('0xb')](util['format'](_0x5114('0xf'),config['asterisk'][_0x5114('0xe')],config[_0x5114('0x6')]['ip'],config[_0x5114('0x6')][_0x5114('0x5')]));}ami[_0x5114('0x10')]=function(){return function(){return ami[_0x5114('0x9')]({'action':'sipshowregistry'});};};ami[_0x5114('0x11')]=function(){return function(){return ami[_0x5114('0x9')]({'action':_0x5114('0x12')});};};ami[_0x5114('0x13')]=function(){return function(){return ami[_0x5114('0x9')]({'action':_0x5114('0x14')});};};ami[_0x5114('0x15')]=function(){return function(){return ami[_0x5114('0x9')]({'action':_0x5114('0x16')});};};ami['actionCoreShowChannels']=function(){return function(){return ami[_0x5114('0x9')]({'action':'coreshowchannels'});};};function connect(){logger[_0x5114('0x17')](util[_0x5114('0xc')](_0x5114('0x18'),config['asterisk'][_0x5114('0xe')],config[_0x5114('0x6')]['ip'],config[_0x5114('0x6')][_0x5114('0x5')]));ami[_0x5114('0x19')]('error',error);ami[_0x5114('0x19')](_0x5114('0x1a'),close);}ami['on']('connect',connect);ami['on'](_0x5114('0x1b'),function(_0x2a007e){logger[_0x5114('0x17')](util[_0x5114('0xc')](_0x5114('0x1c'),config[_0x5114('0x6')][_0x5114('0xe')],config['asterisk']['ip'],config['asterisk'][_0x5114('0x5')],util[_0x5114('0x1d')](_0x2a007e,![],null)));});ami['on']('fullybooted',function(){logger[_0x5114('0x17')](util[_0x5114('0xc')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0x5114('0x6')][_0x5114('0xe')],config[_0x5114('0x6')]['ip'],config['asterisk'][_0x5114('0x5')]));return Promise[_0x5114('0x1e')]()['then'](ami[_0x5114('0x10')]())[_0x5114('0x1f')](ami[_0x5114('0x11')]())['then'](ami[_0x5114('0x13')]())[_0x5114('0x1f')](ami[_0x5114('0x15')]())[_0x5114('0x1f')](ami[_0x5114('0x20')]())[_0x5114('0x21')](function(_0x2169e5){logger[_0x5114('0xb')](_0x5114('0x22'),util['inspect'](_0x2169e5,{'showHidden':![],'depth':null}));});});ami[_0x5114('0x19')]('error',error);ami['once'](_0x5114('0x1a'),close);module[_0x5114('0x23')]=ami; \ No newline at end of file +var _0xa471=['connect','info','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionCoreShowChannels','catch','[ami.js][fullybooted]','close','exports','asterisk-manager','../../config/logger','ami','asterisk','port','username','password','keepConnected','Action','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','actionQueueSummary','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once'];(function(_0x24a3e,_0xb61af){var _0x1cbff9=function(_0x37e86c){while(--_0x37e86c){_0x24a3e['push'](_0x24a3e['shift']());}};_0x1cbff9(++_0xb61af);}(_0xa471,0x78));var _0x1a47=function(_0x53cf8e,_0x3d290f){_0x53cf8e=_0x53cf8e-0x0;var _0x459197=_0xa471[_0x53cf8e];return _0x459197;};'use strict';var Manager=require(_0x1a47('0x0'));var BPromise=require('bluebird');var util=require('util');var logger=require(_0x1a47('0x1'))(_0x1a47('0x2'));var config=require('../../config/environment');var ami=new Manager(config[_0x1a47('0x3')][_0x1a47('0x4')],config[_0x1a47('0x3')]['ip'],config['asterisk'][_0x1a47('0x5')],config[_0x1a47('0x3')][_0x1a47('0x6')],!![]);ami[_0x1a47('0x7')]();ami[_0x1a47('0x8')]=BPromise[_0x1a47('0x9')](ami[_0x1a47('0xa')]);function error(_0x52d794){logger[_0x1a47('0xb')](util[_0x1a47('0xc')](_0x1a47('0xd'),config[_0x1a47('0x3')][_0x1a47('0x5')],config[_0x1a47('0x3')]['ip'],config['asterisk'][_0x1a47('0x4')],util[_0x1a47('0xe')](_0x52d794,![],null)));}function close(){logger[_0x1a47('0xb')](util[_0x1a47('0xc')](_0x1a47('0xf'),config[_0x1a47('0x3')][_0x1a47('0x5')],config[_0x1a47('0x3')]['ip'],config[_0x1a47('0x3')]['port']));}ami[_0x1a47('0x10')]=function(){return function(){return ami[_0x1a47('0x8')]({'action':_0x1a47('0x11')});};};ami[_0x1a47('0x12')]=function(){return function(){return ami[_0x1a47('0x8')]({'action':_0x1a47('0x13')});};};ami[_0x1a47('0x14')]=function(){return function(){return ami[_0x1a47('0x8')]({'action':'sippeerstatus'});};};ami[_0x1a47('0x15')]=function(){return function(){return ami['Action']({'action':'queuesummary'});};};ami['actionCoreShowChannels']=function(){return function(){return ami[_0x1a47('0x8')]({'action':'coreshowchannels'});};};function connect(){logger['info'](util[_0x1a47('0xc')](_0x1a47('0x16'),config[_0x1a47('0x3')][_0x1a47('0x5')],config[_0x1a47('0x3')]['ip'],config['asterisk'][_0x1a47('0x4')]));ami['once'](_0x1a47('0xb'),error);ami[_0x1a47('0x17')]('close',close);}ami['on'](_0x1a47('0x18'),connect);ami['on']('shutdown',function(_0xa4ff68){logger[_0x1a47('0x19')](util[_0x1a47('0xc')](_0x1a47('0x1a'),config[_0x1a47('0x3')]['username'],config[_0x1a47('0x3')]['ip'],config[_0x1a47('0x3')]['port'],util[_0x1a47('0xe')](_0xa4ff68,![],null)));});ami['on'](_0x1a47('0x1b'),function(){logger[_0x1a47('0x19')](util[_0x1a47('0xc')](_0x1a47('0x1c'),config[_0x1a47('0x3')][_0x1a47('0x5')],config['asterisk']['ip'],config[_0x1a47('0x3')][_0x1a47('0x4')]));return Promise[_0x1a47('0x1d')]()['then'](ami['actionSipShowRegistry']())[_0x1a47('0x1e')](ami[_0x1a47('0x12')]())['then'](ami[_0x1a47('0x14')]())[_0x1a47('0x1e')](ami['actionQueueSummary']())[_0x1a47('0x1e')](ami[_0x1a47('0x1f')]())[_0x1a47('0x20')](function(_0x548fe2){logger[_0x1a47('0xb')](_0x1a47('0x21'),util[_0x1a47('0xe')](_0x548fe2,{'showHidden':![],'depth':null}));});});ami[_0x1a47('0x17')](_0x1a47('0xb'),error);ami[_0x1a47('0x17')](_0x1a47('0x22'),close);module[_0x1a47('0x23')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 0664b8b..5dffdd4 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 _0xac4a=['ami','client','http','then','debug','memberReport','error','message','result','catch','rpc','jayson/promise','bluebird','../../config/logger'];(function(_0x3fd531,_0x538738){var _0x5bd9db=function(_0x676411){while(--_0x676411){_0x3fd531['push'](_0x3fd531['shift']());}};_0x5bd9db(++_0x538738);}(_0xac4a,0x13f));var _0xaac4=function(_0x29c89d,_0x5ad6fa){_0x29c89d=_0x29c89d-0x0;var _0x46da06=_0xac4a[_0x29c89d];return _0x46da06;};'use strict';var jayson=require(_0xaac4('0x0'));var BPromise=require(_0xaac4('0x1'));var logger=require(_0xaac4('0x2'))(_0xaac4('0x3'));var client=jayson[_0xaac4('0x4')][_0xaac4('0x5')]({'port':0x2329});client['Request']=function(_0x58626e,_0x2af0f6){return new BPromise(function(_0x2a5762,_0x32d34c){return client['request'](_0x58626e,_0x2af0f6)[_0xaac4('0x6')](function(_0x53d03a){logger[_0xaac4('0x7')]('rpc',_0xaac4('0x8'),_0x58626e,_0x2af0f6,_0x53d03a);if(_0x53d03a[_0xaac4('0x9')]){logger['error']('rpc',_0xaac4('0x8'),_0x58626e,_0x53d03a['error'][_0xaac4('0xa')],_0x2af0f6);return _0x32d34c(_0x53d03a['error']['message']);}else{return _0x2a5762(_0x53d03a[_0xaac4('0xb')]);}})[_0xaac4('0xc')](function(_0x38d1d0){logger[_0xaac4('0x9')](_0xaac4('0xd'),'memberReport',_0x58626e,_0x38d1d0,_0x2af0f6);return _0x32d34c(_0x38d1d0);});});};module['exports']=client; \ No newline at end of file +var _0x9bde=['message','result','catch','exports','bluebird','ami','http','Request','request','debug','rpc','memberReport','error'];(function(_0x160248,_0x2a57e6){var _0x4e589d=function(_0x1ba722){while(--_0x1ba722){_0x160248['push'](_0x160248['shift']());}};_0x4e589d(++_0x2a57e6);}(_0x9bde,0xe1));var _0xe9bd=function(_0xdb4358,_0x212b26){_0xdb4358=_0xdb4358-0x0;var _0x217980=_0x9bde[_0xdb4358];return _0x217980;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xe9bd('0x0'));var logger=require('../../config/logger')(_0xe9bd('0x1'));var client=jayson['client'][_0xe9bd('0x2')]({'port':0x2329});client[_0xe9bd('0x3')]=function(_0x131f6a,_0x1c1b34){return new BPromise(function(_0x10822d,_0x1a4d14){return client[_0xe9bd('0x4')](_0x131f6a,_0x1c1b34)['then'](function(_0x4763e9){logger[_0xe9bd('0x5')](_0xe9bd('0x6'),_0xe9bd('0x7'),_0x131f6a,_0x1c1b34,_0x4763e9);if(_0x4763e9[_0xe9bd('0x8')]){logger[_0xe9bd('0x8')](_0xe9bd('0x6'),_0xe9bd('0x7'),_0x131f6a,_0x4763e9[_0xe9bd('0x8')][_0xe9bd('0x9')],_0x1c1b34);return _0x1a4d14(_0x4763e9['error']['message']);}else{return _0x10822d(_0x4763e9[_0xe9bd('0xa')]);}})[_0xe9bd('0xb')](function(_0x2601ac){logger['error'](_0xe9bd('0x6'),_0xe9bd('0x7'),_0x131f6a,_0x2601ac,_0x1c1b34);return _0x1a4d14(_0x2601ac);});});};module[_0xe9bd('0xc')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 073f11b..75fe4da 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 _0x0174=['dialTimezone','launchHandleIvr','[syncCampaigns]','checkDialMethod','dialMethod','handlePower','dialPowerLevel','booked','Queue','method\x20not\x20recognized','silly','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','intervalIftime','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','queue','uniqueid','ivr','updateOriginated','answertime','YYYY-MM-DD\x20HH:mm:ss','agiafterat','dialQueueProject2','createHistory','[syncAgentComplete][createHistory]','moveContactManagedDialer','[syncAgentComplete]','droptime','predictiveIntervalDroppedCallsTimeout','outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls','statedesc','Drop','dropreason','TIMEOUT','countglobal','callAdditionalPhoneAfterMin','verifyAdditionalPhones','voiceQueue','additional','queueCallerAbandonCreateState','add','dialDropRetryFrequency','minutes','ContactId','ListId','VoiceQueueId','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','CALLEREXIT','countabandonedretry','rescheduleContact','dialAbandonedRetryFrequency','CampaignId','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','syncNewExten','channel','actionid','roundrobin','isNil','locked','paused','stateinterface','rrmemory','syncQueueStatusComplete','strategy','preview','run','idHopper','[Catch][Preview][syncQueueStatusComplete]','finally','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock]','[unlock][syncQueueStatusComplete]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','responsetime','getQueue','Success','[callProgressDetecting]\x20','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','HangupInAMD','membername','AMD','custom:amd','buildObj','saveInDb','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','Machine','amd','[syncAgentComplete][createHistory][0]','countbusyretry','countnoanswerretry','countdropretry','countmachineretry','countagentrejectretry','stateGlobal','reason19\x20machine....','createStateFinal','reason\x2019\x20machine....','dialMachineRetryFrequency','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','countnosuchnumberretry','dialGlobalMaxRetry','dialMachineMaxRetry','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','cause-txt','Normal\x20Clearing','Unknow','running','isPreviewCampaign','statusMessage','getQueueCampaignStatusMessage','available','inUse','talking','pTalking','[syncQueueSummary]','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','throttle','filter','dialPreviewRecallmeReminder','online','reachable','map','Agent','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','clearZombieChannels','undefined','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','UserId','[emptyContact][createHistory]','[syncQueueCallerAbandon]\x20[Drop]','handleIvr','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','isOutboundQueue','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialAgiAfterHangupAgent','dialQueueTimeout','ACTIVE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','XMD-CAMPAIGNID','setXMDContactVariables','Contact','Trunk','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','extractCalleridName','variables','Action','SIP/%s/%s%s','dialPrefix','substring','dialCutDigit','from-sip','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','checkRetriveMax','countcongestionretry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','[rescheduleContact][Drop]','dialAbandonedMaxRetry','callProgressDetecting','entity\x20is\x20undefine','evt\x20is\x20undefine','reason','custom:agentnosuchnumber','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','buildNoAnswerEventPayload','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','outboundCongestionCallsDay','custom:agentcongestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','[syncAgentComplete][createHistory][20]','dialAgentRejectMaxRetry','reason\x2020\x20agentreject','outboundUnknownCallsDay','[syncAgentComplete][createHistory][?]','swapAdditionalPhones','Global','[callProgressDetecting]','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','floor','erlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Drop\x20in\x20this\x20interval','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','avgHandleTime','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','loggedIn','outboundQueuePauses','[CatchErlangB]','predictiveIntervalPauses','one\x20call\x20every:','milliseconds','[handlePredictive]','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[booked][checkContactBlack][else]','[unlockOriginate][syncQueueStatusComplete]','dialRecallMeTimeout','voicePause','unlockContact','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','temp','getContactDialerIvr','checkContactEmpty','[getContactCampaign2][Empty]','RUNNING','checkIsBlackListIvr','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','getContactDialer','countReScheduled','[actionOriginate]\x20','checkIsBlackList','tryOriginatePredictive','[handlePredictive][limitChannel]','dialOrderByScheduledAt','[countReScheduled]\x20','[actionOriginatePredictive]\x20','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','---------------------------','[abandonmentRate]','interval\x20=\x20','erlangb','----\x20Agent\x20Busy\x20Factor\x20----','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','m\x20=\x20','p\x20=\x20','Umin\x20=\x20','exports','lodash','uuid','moment','ioredis','./utils','../../../config/environment/','../../../config/logger','dialer','predictive','predictiveCalls','syncQueueSummary','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/voiceQueueRt','../rpc/setting','../rpc/interval','./models/history','./models/final','./models/hangup','env','127.0.0.1','prototype','enqueue','tail','sequence','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','queuesSummary','agentconnect','syncAgentConnect','queuecallerabandon','syncQueueCallerAbandon','bind','originateresponse','syncOriginateResponse','syncAgentComplete','custom:queuesummary','custom:queuesummarycomplete','syncQueueSummaryComplete','syncHangup','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','loopClearZombieChannels','getSettings','then','previewRecallmeReminderInterval','emit','type','outbound','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','format','voice:queue:%s','name','isEmpty','info','-----\x20Stats\x20Predictive\x20---','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','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','predictiveIntervalAvgTalktime','isUndefined','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','predictiveIntervalAvgHoldtime','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','merge','getSeconds','debug','startProgressive\x20value\x20cleared','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','checkContactLowerLimitOriginate','contactsRescheduled','message','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','contacts','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','state','endtime','starttime','[unlockQueueStatus][undefined]','queueStatusComplete','[booked][unlockQueueStatus]','stringify','pick','Interval','\x20INTERVAL_IS_NULL','Intervals','NULL_INTERVAL','isIVRCampaignActive','INACTIVE','isIVRCampaign','campaign:save','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','DISACTIVED','is\x20disactive','[ifTime][Action]','Error','isTrunkReachable','active','status','SIP/%s','unmonitored','checkIsTrunkReachable','TrunkBackup','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','ifTime','\x20Intervals\x20is\x20empty\x20','timezones','\x20Timezone\x20unknow\x20','isArray','length','command','iftime\x20%s,%s','interval','content','indexOf','true','catch','push','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','resetActiveCalls','syncCampaigns','resolve','dialGlobalInterval'];(function(_0x2cc681,_0x181189){var _0x1c9c22=function(_0x3ccc08){while(--_0x3ccc08){_0x2cc681['push'](_0x2cc681['shift']());}};_0x1c9c22(++_0x181189);}(_0x0174,0x176));var _0x4017=function(_0x21ca26,_0x5d8582){_0x21ca26=_0x21ca26-0x0;var _0x329238=_0x0174[_0x21ca26];return _0x329238;};'use strict';var util=require('util');var _=require(_0x4017('0x0'));var uuid=require(_0x4017('0x1'));var moment=require(_0x4017('0x2'));var rr=require('rr');var Redis=require(_0x4017('0x3'));var utils=require(_0x4017('0x4'));var hopperUtils=require('./utils/hopper');var ut=require('../preview/util/util');var config=require(_0x4017('0x5'));var logger=require(_0x4017('0x6'))(_0x4017('0x7'));var loggerBooked=require(_0x4017('0x6'))('booked');var loggerPredictive=require(_0x4017('0x6'))(_0x4017('0x8'));var loggerPredictiveCalls=require(_0x4017('0x6'))(_0x4017('0x9'));var loggerSyncQueueSummary=require(_0x4017('0x6'))(_0x4017('0xa'));var ami=require('../ami');config[_0x4017('0xb')]=_[_0x4017('0xc')](config[_0x4017('0xb')],{'host':_0x4017('0xd'),'port':0x18eb});var io=require(_0x4017('0xe'))(new Redis(config[_0x4017('0xb')]));var cmHopper=require(_0x4017('0xf'));var voiceQueueRt=require(_0x4017('0x10'));var RpcSetting=require(_0x4017('0x11'));var Interval=require(_0x4017('0x12'));var Action=require('./models/action');var History=require(_0x4017('0x13'));var Final=require(_0x4017('0x14'));var AgentComplete=require('./models/agentComplete');var QueueCallerAbandon=require('./models/queueCallerAbandon');var Hangup=require(_0x4017('0x15'));var ipAgi=process[_0x4017('0x16')]['XCALLY_IP_AGI']||_0x4017('0x17');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x4017('0x18')][_0x4017('0x19')]=function(_0x5bf204){this['tail']=this[_0x4017('0x1a')]?this['tail']['finally'](_0x5bf204):_0x5bf204();};function Dialer(_0x183ea,_0x16d367){this[_0x4017('0x1b')]=new Sequence();this['preview']=_0x16d367;this[_0x4017('0x1c')]=_0x183ea[_0x4017('0x1c')];this[_0x4017('0x1d')]=_0x183ea[_0x4017('0x1d')];this['agents']=_0x183ea[_0x4017('0x1e')];this[_0x4017('0x1f')]=_0x183ea['trunks'];this[_0x4017('0x20')]=config['maxNumberOriginate']||0x2;this[_0x4017('0x21')]={};this[_0x4017('0x22')]={};this[_0x4017('0x23')]={};this[_0x4017('0x24')]={};this[_0x4017('0x25')]={};this[_0x4017('0x26')]={};this[_0x4017('0x27')]={};this[_0x4017('0x28')]={};this[_0x4017('0x29')]={};this[_0x4017('0x2a')]={};this[_0x4017('0x2b')]={};ami['on'](_0x4017('0x2c'),this[_0x4017('0x2d')]['bind'](this));ami['on'](_0x4017('0x2e'),this[_0x4017('0x2f')][_0x4017('0x30')](this));ami['on'](_0x4017('0x31'),this[_0x4017('0x32')][_0x4017('0x30')](this));ami['on']('agentcomplete',this[_0x4017('0x33')]['bind'](this));ami['on'](_0x4017('0x34'),this[_0x4017('0xa')][_0x4017('0x30')](this));ami['on'](_0x4017('0x35'),this[_0x4017('0x36')][_0x4017('0x30')](this));ami['on']('hangup',this[_0x4017('0x37')][_0x4017('0x30')](this));ami['on']('newexten',this['syncNewExten'][_0x4017('0x30')](this));ami['on'](_0x4017('0x38'),this[_0x4017('0x39')][_0x4017('0x30')](this));ami['on'](_0x4017('0x3a'),this[_0x4017('0x3b')]['bind'](this));ami['on'](_0x4017('0x3c'),this['syncQueueStatusComplete']['bind'](this));this['loopCampaigns']();this[_0x4017('0x3d')]();RpcSetting[_0x4017('0x3e')]()[_0x4017('0x3f')](function(_0x41857b){previewRecallmeReminderInterval=_0x41857b[_0x4017('0x40')];});}function isNotNull(_0x4fdb41){return _0x4fdb41!==null&&!_['isUndefined'](_0x4fdb41);}function msgResponse(_0x101c19,_0x506098,_0x1be2f6){return{'action':_0x101c19,'response':_0x506098,'message':_0x1be2f6,'stack':_0x1be2f6};}function emit(_0x2389e6,_0x1110a7,_0x42e04c){io['to'](_0x2389e6)[_0x4017('0x41')](_0x1110a7,_0x42e04c);}function emitOutboundVoiceQueueSummary(_0x5839e1){if(_0x5839e1[_0x4017('0x42')]===_0x4017('0x43')){logger['debug'](_0x4017('0x44'),util[_0x4017('0x45')](_0x5839e1,{'showHidden':![],'depth':null}));emit(util[_0x4017('0x46')](_0x4017('0x47'),_0x5839e1[_0x4017('0x48')]),'voice_queue:save',_0x5839e1);}}function checkGetDataPredictive(_0x4efac8){if(isNotNull(_0x4efac8)&&!_[_0x4017('0x49')](_0x4efac8)){loggerPredictive[_0x4017('0x4a')](_0x4017('0x4b'));loggerPredictive[_0x4017('0x4a')]('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4efac8[_0x4017('0x4c')]);loggerPredictive[_0x4017('0x4a')]('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4efac8[_0x4017('0x4d')]);loggerPredictive[_0x4017('0x4a')]('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4efac8['predictiveIntervalDroppedCallsTimeout']);loggerPredictive[_0x4017('0x4a')](_0x4017('0x4e'),_0x4efac8[_0x4017('0x4f')]);loggerPredictive[_0x4017('0x4a')](_0x4017('0x50'),_0x4efac8['predictiveIntervalAvgHoldtime']);loggerPredictive[_0x4017('0x4a')]('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4efac8[_0x4017('0x51')]);loggerPredictive[_0x4017('0x4a')]('---------------------------');if(_0x4efac8[_0x4017('0x4c')]>0x0){if(!_[_0x4017('0x52')](_0x4efac8[_0x4017('0x51')])&&_0x4efac8[_0x4017('0x51')]>0x0){return!![];}loggerPredictive[_0x4017('0x4a')](_0x4017('0x53'));if(!_[_0x4017('0x52')](_0x4efac8[_0x4017('0x54')])&&_0x4efac8['predictiveIntervalAvgHoldtime']>0x0){return!![];}loggerPredictive['info'](_0x4017('0x55'));}else{loggerPredictive['info'](_0x4017('0x56'));}}else{loggerPredictive['info'](_0x4017('0x57'));}return![];}function mergeDataErlangB(_0x3bfe2a){return function(_0x692eec){loggerPredictive[_0x4017('0x4a')]('---------\x20ErlangB\x20---------');loggerPredictive[_0x4017('0x4a')](_0x4017('0x58'),_0x692eec['erlangCalls']);loggerPredictive[_0x4017('0x4a')](_0x4017('0x59'),_0x692eec[_0x4017('0x5a')]);loggerPredictive[_0x4017('0x4a')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x692eec[_0x4017('0x5b')]);loggerPredictive[_0x4017('0x4a')](_0x4017('0x5c'),_0x692eec[_0x4017('0x5d')]);loggerPredictive['info']('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x692eec['erlangAbandonmentRate']);loggerPredictive[_0x4017('0x4a')]('---------------------------');_[_0x4017('0x5e')](_0x3bfe2a,_0x692eec);};}function ifInterval(_0x24d838,_0x414a12){if(_[_0x4017('0x52')](_0x414a12)){return![];}return utils[_0x4017('0x5f')](undefined,_0x414a12)<_0x24d838*0x3c;}function clearPredictiveAttributes(_0x5bcd84){if(_0x5bcd84['startProgressive']){_0x5bcd84[_0x4017('0x27')]=undefined;loggerPredictive[_0x4017('0x60')](_0x5bcd84['name'],_0x4017('0x61'));}if(_0x5bcd84[_0x4017('0x26')]){_0x5bcd84[_0x4017('0x26')]=undefined;loggerPredictive[_0x4017('0x60')](_0x5bcd84[_0x4017('0x48')],_0x4017('0x62'));}if(_0x5bcd84[_0x4017('0x63')]){clearInterval(_0x5bcd84[_0x4017('0x63')]);_0x5bcd84[_0x4017('0x63')]=undefined;loggerPredictive[_0x4017('0x60')](_0x5bcd84['name'],_0x4017('0x64'));}}function loggerCatchPredictive(_0x426abf,_0x2d7f57){return function(_0x2bd28d){loggerPredictive[_0x4017('0x65')](_0x2d7f57['name'],_0x426abf);loggerPredictive[_0x4017('0x65')](_0x2bd28d['stack']);clearPredictiveAttributes(_0x2d7f57);};}function loggerCatch(_0x1fddfe){return function(_0x5d6770){logger[_0x4017('0x65')](_0x1fddfe,util[_0x4017('0x45')](_0x5d6770,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x60aadd,_0x4268ba,_0x1c3021){return function(_0x53d3f1){utils[_0x4017('0x66')](_0x4268ba,_0x1c3021,0x0);_0x4268ba['temp']=0x0;logger[_0x4017('0x65')](_0x60aadd,util[_0x4017('0x45')](_0x53d3f1,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x2b38ef){return function(_0xc0b9eb){if(isNotNull(_0xc0b9eb)&&isNotNull(_0xc0b9eb[0x0])){if(_0xc0b9eb[0x0][_0x4017('0x67')]>0x0){_0x2b38ef[_0x4017('0x68')]=utils[_0x4017('0x69')][_0x4017('0x6a')];logger[_0x4017('0x4a')]('[getContactDialer2][ReScheduled]'+_0x2b38ef[_0x4017('0x48')],_0xc0b9eb[0x0][_0x4017('0x67')],_0x4017('0x6b'));}else{_0x2b38ef[_0x4017('0x68')]=utils[_0x4017('0x69')][_0x4017('0x6c')];logger[_0x4017('0x4a')](_0x4017('0x6d')+_0x2b38ef[_0x4017('0x48')]);}}};}function createObjHistory(_0x1af29f,_0x2c1ead,_0x18f28a,_0x556509,_0x2c3b7f){_0x1af29f[_0x4017('0x68')]=_0x18f28a;var _0x1cdeed=new Action(_0x1af29f,_0x2c1ead);var _0x5a224b=new History(_0x1cdeed);_0x5a224b[_0x4017('0x6e')]=_0x556509;_0x5a224b['statedesc']=_0x2c3b7f;_0x5a224b[_0x4017('0x6f')]=_0x1cdeed[_0x4017('0x70')];return _0x5a224b;}function unlockQueueStatus(_0x396961,_0x4f538f){setTimeout(function(){if(_[_0x4017('0x52')](_0x396961['queueStatusComplete'])){loggerBooked[_0x4017('0x65')](_0x4017('0x71'),_0x4f538f);}_0x396961[_0x4017('0x72')]=!![];loggerBooked[_0x4017('0x4a')](_0x4017('0x73'),_0x4f538f,JSON[_0x4017('0x74')](_[_0x4017('0x75')](_0x396961,[_0x4017('0x48'),_0x4017('0x72')])));},0x1f3);}function checkInterval(_0x59dd85){return function(){if(!isNotNull(_0x59dd85[_0x4017('0x76')])){_0x59dd85[_0x4017('0x68')]=utils[_0x4017('0x69')]['NULL_INTERVAL'];throw _0x59dd85[_0x4017('0x48')]+_0x4017('0x77');}if(!isNotNull(_0x59dd85[_0x4017('0x76')][_0x4017('0x78')])){_0x59dd85[_0x4017('0x68')]=utils[_0x4017('0x69')][_0x4017('0x79')];throw _0x59dd85['name']+_0x4017('0x77');}if(!isNotNull(_[_0x4017('0x49')](_0x59dd85[_0x4017('0x76')]['Intervals']))){_0x59dd85[_0x4017('0x68')]=utils[_0x4017('0x69')]['NULL_INTERVAL'];throw _0x59dd85['name']+_0x4017('0x77');}};}function checkIsIVRCampaignActive(_0x46e199){return function(){if(!utils[_0x4017('0x7a')](_0x46e199)){_0x46e199[_0x4017('0x68')]=utils[_0x4017('0x69')][_0x4017('0x7b')];throw _0x46e199[_0x4017('0x48')]+'\x20NOT\x20Active';}};}function emitCampaignSummary(_0x344962){if(utils[_0x4017('0x7c')](_0x344962)){emit(util[_0x4017('0x46')]('campaign:ivr:%s',_0x344962[_0x4017('0x48')]),_0x4017('0x7d'),_0x344962);}}function loggerCatchQueueSummary(_0x47e788,_0x202b4c){return function(_0xb4f17){clearPredictiveAttributes(_0x202b4c);emitCampaignSummary(_0x202b4c);loggerSyncQueueSummary[_0x4017('0x60')](_0x47e788,util[_0x4017('0x45')](_0xb4f17,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x4de06e){if(_0x4de06e[_0x4017('0x7e')]){if(_0x4de06e['originated']===0x0){_0x4de06e[_0x4017('0x7e')]=![];_0x4de06e[_0x4017('0x68')]=utils[_0x4017('0x69')][_0x4017('0x7b')];loggerSyncQueueSummary['debug'](_0x4017('0x7f'),_0x4de06e[_0x4017('0x48')],'is\x20not\x20active');}else{_0x4de06e[_0x4017('0x68')]=utils[_0x4017('0x69')][_0x4017('0x80')];loggerSyncQueueSummary[_0x4017('0x60')](_0x4017('0x7f'),_0x4de06e['name'],_0x4017('0x81'));}emitCampaignSummary(_0x4de06e);}}function myreject(_0x296ef9){return function(_0x53c35c){return _0x296ef9(msgResponse(_0x4017('0x82'),_0x4017('0x83'),JSON[_0x4017('0x74')](_0x53c35c)));};}Dialer[_0x4017('0x18')][_0x4017('0x84')]=function(_0x54a182){return!_[_0x4017('0x52')](_0x54a182)&&_0x54a182&&!_['isUndefined'](_0x54a182[_0x4017('0x48')])&&!_[_0x4017('0x52')](_0x54a182[_0x4017('0x85')])&&_0x54a182[_0x4017('0x85')]&&(this[_0x4017('0x1f')][util[_0x4017('0x46')]('SIP/%s',_0x54a182[_0x4017('0x48')])][_0x4017('0x86')]==='reachable'||this['trunks'][util[_0x4017('0x46')](_0x4017('0x87'),_0x54a182[_0x4017('0x48')])]['status']===_0x4017('0x88'));};Dialer[_0x4017('0x18')][_0x4017('0x89')]=function(_0x163b55){var _0x267a8a=this;return function(){if(!_0x267a8a[_0x4017('0x84')](_0x163b55['Trunk'])){if(!_0x267a8a[_0x4017('0x84')](_0x163b55[_0x4017('0x8a')])){_0x163b55['message']=utils[_0x4017('0x69')][_0x4017('0x8b')];throw _0x163b55[_0x4017('0x48')]+_0x4017('0x8c');}}};};Dialer[_0x4017('0x18')][_0x4017('0x8d')]=function(_0x2245a8,_0x27a2ba,_0x1d498b,_0x5f5bba){var _0x553ad7=this;return function(){var _0x340130=!![];return _0x553ad7[_0x4017('0x8e')](_0x2245a8,_0x27a2ba,_0x1d498b,_0x5f5bba,_0x340130);};};Dialer[_0x4017('0x18')][_0x4017('0x8f')]=function(_0x2823e5,_0x51f851,_0x5d57e2,_0x3bd41e){var _0x5078c7=this;return function(){var _0x7d2928=![];return _0x5078c7[_0x4017('0x8e')](_0x2823e5[_0x4017('0x78')],_0x51f851,_0x5d57e2,_0x3bd41e,_0x7d2928);};};Dialer[_0x4017('0x18')][_0x4017('0x8e')]=function(_0x6f56f4,_0x13af83,_0x355bb4,_0x254d24,_0x34249e){var _0x483214=[];return new Promise(function(_0x19d6eb,_0x2032ff){if(!isNotNull(_0x6f56f4)){_0x254d24[_0x4017('0x68')]=utils[_0x4017('0x69')][_0x4017('0x79')];return _0x2032ff(msgResponse('ifTime',_0x4017('0x90'),_0x355bb4+_0x4017('0x91')));}if(_[_0x4017('0x49')](_0x6f56f4)){_0x254d24[_0x4017('0x68')]=utils['CAMPAIGN_STATUS']['EMPTY_INTERVAL'];return _0x2032ff(msgResponse(_0x4017('0x92'),'Failure',_0x355bb4+_0x4017('0x93')));}if(_0x13af83&&_[_0x4017('0x52')](config[_0x4017('0x94')][_0x13af83])){_0x254d24[_0x4017('0x68')]=utils['CAMPAIGN_STATUS']['UNKNOWN_TIMEZONE'];return _0x2032ff(msgResponse(_0x4017('0x92'),_0x4017('0x90'),_0x355bb4+_0x4017('0x95')+_0x13af83));}if(_[_0x4017('0x96')](_0x6f56f4)){for(var _0x4a4f11=0x0;_0x4a4f11<_0x6f56f4[_0x4017('0x97')];_0x4a4f11+=0x1){_0x483214['push'](ami['Action']({'action':_0x4017('0x98'),'command':util[_0x4017('0x46')](_0x4017('0x99'),_0x6f56f4[_0x4a4f11][_0x4017('0x9a')],!_['isUndefined'](config[_0x4017('0x94')][_0x13af83])?_0x13af83:'')})[_0x4017('0x3f')](function(_0x47dd44){return _0x47dd44[_0x4017('0x9b')][_0x4017('0x9c')](_0x4017('0x9d'))>=0x0;})[_0x4017('0x9e')](myreject(_0x2032ff)));}}else{_0x483214[_0x4017('0x9f')](ami['Action']({'action':_0x4017('0x98'),'command':util[_0x4017('0x46')](_0x4017('0x99'),_0x6f56f4,!_[_0x4017('0x52')](config[_0x4017('0x94')][_0x13af83])?_0x13af83:'')})['then'](function(_0x408404){return _0x408404['content'][_0x4017('0x9c')](_0x4017('0x9d'))>=0x0;})[_0x4017('0x9e')](myreject(_0x2032ff)));}Promise['all'](_0x483214)[_0x4017('0x3f')](function(_0x39ba4a){var _0x5d0273=_['some'](_0x39ba4a);if(_0x5d0273){return _0x19d6eb(_0x5d0273);}else{_0x254d24['message']=_0x34249e?utils[_0x4017('0x69')]['OVERTIME_GLOBAL_INTERVAL']:utils['CAMPAIGN_STATUS']['OVERTIME_INTERVAL'];return _0x2032ff(msgResponse(_0x4017('0xa0'),_0x4017('0x90'),_0x4017('0xa1')+_0x34249e+'\x20'+_0x355bb4+_0x4017('0xa2')+util[_0x4017('0x45')](_0x6f56f4,{'showHidden':![],'depth':null})+_0x4017('0xa3')+_0x13af83));}})['catch'](function(_0x307521){return _0x2032ff(msgResponse(_0x4017('0x92'),_0x4017('0x90'),JSON[_0x4017('0x74')](_0x307521)));});});};Dialer[_0x4017('0x18')]['loopCampaigns']=function(){var _0x13cdde=this;return cmHopper[_0x4017('0xa4')]({'active':![]},{'where':{'active':!![]}})['then'](function(){setInterval(function(){_0x13cdde[_0x4017('0xa5')]();},0x3e8);});};Dialer[_0x4017('0x18')][_0x4017('0xa5')]=function(){var _0x5bfcd3=this;var _0x55cec3;for(var _0x259fc5 in this[_0x4017('0x1d')]){if(typeof this[_0x4017('0x1d')][_0x259fc5]!=='undefined'){_0x55cec3=this[_0x4017('0x1d')][_0x259fc5];if(utils[_0x4017('0x7c')](_0x55cec3)&&utils[_0x4017('0x7a')](_0x55cec3)){_0x55cec3['sendMessageOneNotActive']=!![];Promise[_0x4017('0xa6')]()[_0x4017('0x3f')](checkIsIVRCampaignActive(_0x55cec3))[_0x4017('0x3f')](checkInterval(_0x55cec3))[_0x4017('0x3f')](_0x5bfcd3[_0x4017('0x89')](_0x55cec3))['then'](_0x5bfcd3[_0x4017('0x8d')](_0x55cec3[_0x4017('0xa7')],_0x55cec3[_0x4017('0xa8')],_0x55cec3['name'],_0x55cec3))[_0x4017('0x3f')](_0x5bfcd3[_0x4017('0x8f')](_0x55cec3[_0x4017('0x76')],_0x55cec3['dialTimezone'],_0x55cec3[_0x4017('0x48')],_0x55cec3))[_0x4017('0x3f')](_0x5bfcd3[_0x4017('0xa9')](_0x55cec3))[_0x4017('0x9e')](loggerCatchQueueSummary(_0x4017('0xaa'),_0x55cec3));}else{notSendMessagesCampaign(_0x55cec3);}}}};Dialer[_0x4017('0x18')][_0x4017('0xab')]=function(_0x131a12){if(_0x131a12[_0x4017('0xac')]!=='predictive'){clearPredictiveAttributes(_0x131a12);}switch(_0x131a12[_0x4017('0xac')]){case'progressive':this[_0x4017('0xad')](_0x131a12,0x1);break;case'power':this['handlePower'](_0x131a12,_0x131a12[_0x4017('0xae')]);break;case'predictive':this['predictive'](_0x131a12);break;case _0x4017('0xaf'):this[_0x4017('0xad')](_0x131a12,0x1);break;default:logger['error'](_0x4017('0xb0'),_0x131a12[_0x4017('0x48')],_0x4017('0xb1'));}};Dialer[_0x4017('0x18')][_0x4017('0x92')]=function(_0x3b5981,_0x5c7095){var _0x140f45=_0x3b5981[_0x4017('0xa8')];var _0x155990=_0x5c7095?_0x3b5981[_0x4017('0xa7')]:_0x3b5981['Interval']['Intervals'];logger[_0x4017('0xb2')](_0x4017('0xb3'),_0x155990,_0x140f45,_0x3b5981[_0x4017('0x48')],util[_0x4017('0x46')](_0x4017('0xb4'),_0x3b5981[_0x4017('0x48')],_0x3b5981['id']));var _0x3aa827=null;return Interval[_0x4017('0xb5')](_0x155990,_0x140f45)[_0x4017('0x3f')](function(_0x1a85a0){if(_0x1a85a0===!![]){return _0x1a85a0;}else{_0x3b5981[_0x4017('0x68')]=_0x5c7095?utils[_0x4017('0x69')][_0x4017('0xb6')]:utils[_0x4017('0x69')][_0x4017('0xb7')];_0x3aa827=msgResponse(_0x4017('0xa0'),'Failure','Global:\x20'+_0x5c7095+'\x20'+_0x3b5981[_0x4017('0x48')]+_0x4017('0xa2')+util[_0x4017('0x45')](_0x155990,{'showHidden':![],'depth':null})+_0x4017('0xa3')+_0x140f45);}if(_0x3aa827!==null){logger['silly'](_0x4017('0xb8'),_0x3aa827);_0x3aa827[_0x4017('0xb9')]=_0x5c7095;throw _0x3aa827;}})['catch'](function(_0x4ce45c){logger[_0x4017('0x65')]('AMI\x20IfTime',_0x4ce45c);throw msgResponse(_0x4017('0x82'),'Error',util['inspect'](_0x4ce45c,{'showHidden':![],'depth':null}));});};Dialer['prototype'][_0x4017('0x2d')]=function(_0x39f213){if(this[_0x4017('0x1c')][_0x39f213[_0x4017('0xba')]]){if(this['uniqueId'][_0x39f213[_0x4017('0xbb')]]&&this[_0x4017('0x24')][_0x39f213[_0x4017('0xbb')]]['type']!==_0x4017('0xbc')){this[_0x4017('0xbd')](this[_0x4017('0x1c')][_0x39f213[_0x4017('0xba')]]);this[_0x4017('0x24')][_0x39f213[_0x4017('0xbb')]][_0x4017('0xbe')]=moment()['format'](_0x4017('0xbf'));}}};Dialer[_0x4017('0x18')][_0x4017('0x33')]=function(_0x27ad6d){var _0x504a0b=this[_0x4017('0x24')][_0x27ad6d[_0x4017('0xbb')]];if(this[_0x4017('0x1c')][_0x27ad6d[_0x4017('0xba')]]){if(_0x504a0b&&_0x504a0b[_0x4017('0x42')]!==_0x4017('0xbc')){delete this[_0x4017('0x24')][_0x27ad6d[_0x4017('0xbb')]];this[_0x4017('0x1c')][_0x27ad6d[_0x4017('0xba')]]['outboundAnswerCallsDay']+=0x1;var _0x22a25e=new AgentComplete(_0x504a0b,_0x27ad6d);if(_0x27ad6d['reason']==='agent'){_0x22a25e[_0x4017('0xc0')]=this[_0x4017('0x1c')][_0x27ad6d['queue']][_0x4017('0xc1')]&&this['voiceQueues'][_0x27ad6d[_0x4017('0xba')]]['dialAgiAfterHangupAgent']?moment()[_0x4017('0x46')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;}hopperUtils[_0x4017('0xc2')](_0x22a25e)['catch'](loggerCatch(_0x4017('0xc3')));hopperUtils[_0x4017('0xc4')](_0x22a25e)[_0x4017('0x9e')](loggerCatch(_0x4017('0xc5')));}}};Dialer[_0x4017('0x18')][_0x4017('0x2f')]=function(_0x4bded6){var _0x4b949e=this[_0x4017('0x24')][_0x4bded6[_0x4017('0xbb')]];var _0x4e58f5=this;var _0x59fa46=![];var _0x26f5d5;var _0xa54c25;if(this['voiceQueues'][_0x4bded6[_0x4017('0xba')]]){if(_0x4b949e&&_0x4b949e['type']!=='ivr'){delete this[_0x4017('0x24')][_0x4bded6[_0x4017('0xbb')]];this['updateOriginated'](this[_0x4017('0x1c')][_0x4bded6['queue']]);_0x4b949e['droptime']=moment()[_0x4017('0x46')](_0x4017('0xbf'));var _0x30b4c0=new QueueCallerAbandon(_0x4b949e,_0x4bded6);if(utils['getSeconds'](_0x4b949e[_0x4017('0xc6')],_0x4b949e['responsetime'])>=_0x4b949e['dialQueueTimeout']){this[_0x4017('0x1c')][_0x4bded6['queue']][_0x4017('0xc7')]+=0x1;this['voiceQueues'][_0x4bded6[_0x4017('0xba')]][_0x4017('0xc8')]+=0x1;this[_0x4017('0x1c')][_0x4bded6[_0x4017('0xba')]][_0x4017('0xc9')]+=0x1;_0x30b4c0['state']=0xa;_0x30b4c0[_0x4017('0xca')]=_0x4017('0xcb');_0x30b4c0[_0x4017('0xcc')]=_0x4017('0xcd');_0x30b4c0[_0x4017('0xc0')]=this['voiceQueues'][_0x4bded6[_0x4017('0xba')]]['dialQueueProject2']?moment()[_0x4017('0x46')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x30b4c0['countdropretry']+=0x1;_0x30b4c0[_0x4017('0xce')]+=0x1;_0x26f5d5=this['voiceQueues'][_0x4bded6['queue']]['dialDropRetryFrequency'];_0xa54c25=this[_0x4017('0x1c')][_0x4bded6['queue']][_0x4017('0xcf')];hopperUtils[_0x4017('0xd0')](_0x30b4c0,_0x30b4c0['state'],_0x4b949e[_0x4017('0xd1')])['then'](function(_0x5617f8){_0x59fa46=_0x5617f8[_0x4017('0xd2')]==0x1;if(_0x30b4c0['countdropretry']>=_0x4e58f5[_0x4017('0x1c')][_0x4bded6[_0x4017('0xba')]]['dialDropMaxRetry']){_0x4e58f5[_0x4017('0xd3')](_0x30b4c0,_0x5617f8['additional']);}else{hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0x30b4c0['countdropretry'],'scheduledat':moment()[_0x4017('0xd4')](_0x4e58f5[_0x4017('0x1c')][_0x4bded6[_0x4017('0xba')]][_0x4017('0xd5')],_0x4017('0xd6'))[_0x4017('0x46')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4b949e[_0x4017('0xd7')],'ListId':_0x4b949e[_0x4017('0xd8')],'VoiceQueueId':_0x4b949e[_0x4017('0xd9')]||undefined,'CampaignId':_0x4b949e['CampaignId']||undefined})['catch'](loggerCatch('[rescheduleContact][Drop]'));var _0x172b1a=new History(_0x30b4c0);_0x172b1a[_0x4017('0x6e')]=0xa;_0x172b1a['statedesc']=_0x4017('0xcb');_0x172b1a[_0x4017('0x70')]=moment()[_0x4017('0x46')](_0x4017('0xbf'));_0x172b1a['endtime']=_0x172b1a[_0x4017('0x70')];_0x172b1a[_0x4017('0xda')]=_0x30b4c0['calleridname'];_0x172b1a[_0x4017('0xdb')]=_0x30b4c0[_0x4017('0xdb')];hopperUtils[_0x4017('0xc2')](_0x172b1a)[_0x4017('0x9e')](loggerCatch(_0x4017('0xdc')));}})[_0x4017('0x3f')](function(){if(_0x59fa46)hopperUtils['swapAdditionalPhones'](_0x30b4c0,_0x26f5d5,_0xa54c25)[_0x4017('0x3f')](function(){return 0x1;});});}else{this[_0x4017('0x1c')][_0x4bded6[_0x4017('0xba')]][_0x4017('0x4f')]+=0x1;this[_0x4017('0x1c')][_0x4bded6[_0x4017('0xba')]]['outboundDropCallsDayCallersExit']+=0x1;_0x30b4c0[_0x4017('0x6e')]=0xb;_0x30b4c0[_0x4017('0xca')]=_0x4017('0xdd');_0x30b4c0['dropreason']=_0x4017('0xde');_0x30b4c0[_0x4017('0xdf')]+=0x1;_0x30b4c0[_0x4017('0xce')]+=0x1;_0x26f5d5=this[_0x4017('0x1c')][_0x4bded6['queue']]['dialAbandonedRetryFrequency'];_0xa54c25=this[_0x4017('0x1c')][_0x4bded6[_0x4017('0xba')]][_0x4017('0xcf')];hopperUtils[_0x4017('0xd0')](_0x30b4c0,_0x30b4c0[_0x4017('0x6e')],_0x4b949e['voiceQueue'])['then'](function(_0x3beb86){if(_0x30b4c0[_0x4017('0xdf')]>=_0x4e58f5[_0x4017('0x1c')][_0x4bded6[_0x4017('0xba')]]['dialAbandonedMaxRetry']){_0x4e58f5[_0x4017('0xd3')](_0x30b4c0,_0x3beb86[_0x4017('0xd2')]);}else{hopperUtils[_0x4017('0xe0')]({'active':![],'countabandonedretry':_0x30b4c0[_0x4017('0xdf')],'scheduledat':moment()[_0x4017('0xd4')](_0x4e58f5[_0x4017('0x1c')][_0x4bded6['queue']][_0x4017('0xe1')],_0x4017('0xd6'))[_0x4017('0x46')](_0x4017('0xbf')),'ContactId':_0x4b949e[_0x4017('0xd7')],'ListId':_0x4b949e['ListId'],'VoiceQueueId':_0x4b949e[_0x4017('0xd9')]||undefined,'CampaignId':_0x4b949e[_0x4017('0xe2')]||undefined})[_0x4017('0x9e')](loggerCatch(_0x4017('0xe3')));var _0x1e935a=new History(_0x30b4c0);_0x1e935a['state']=0xb;_0x1e935a['statedesc']=_0x4017('0xdd');_0x1e935a[_0x4017('0x70')]=moment()['format'](_0x4017('0xbf'));_0x1e935a[_0x4017('0x6f')]=_0x1e935a[_0x4017('0x70')];_0x1e935a[_0x4017('0xda')]=_0x30b4c0[_0x4017('0xda')];_0x1e935a[_0x4017('0xdb')]=_0x30b4c0[_0x4017('0xdb')];hopperUtils['createHistory'](_0x1e935a)['catch'](loggerCatch(_0x4017('0xe4')));}})[_0x4017('0x3f')](function(){if(_0x59fa46)hopperUtils['swapAdditionalPhones'](_0x30b4c0,_0x26f5d5,_0xa54c25)['then'](function(){return 0x1;});});}}}};Dialer[_0x4017('0x18')][_0x4017('0xe5')]=function(_0x548147){if(this[_0x4017('0x22')][_0x548147['uniqueid']]){this[_0x4017('0x22')][_0x548147[_0x4017('0xbb')]][_0x4017('0xe6')]=_0x548147[_0x4017('0xe6')];}if(this[_0x4017('0x24')][_0x548147['uniqueid']]){this[_0x4017('0x24')][_0x548147[_0x4017('0xbb')]][_0x4017('0xe6')]=_0x548147['channel'];}};Dialer[_0x4017('0x18')][_0x4017('0x3b')]=function(_0x5e1153){if(!this[_0x4017('0x22')][_0x5e1153[_0x4017('0xe7')]]){return;}var _0x3411fa=this[_0x4017('0x1c')][this['actions'][_0x5e1153[_0x4017('0xe7')]][_0x4017('0xba')]]['strategy']||'rrmemory';if(_0x3411fa===_0x4017('0xe8')){if(this[_0x4017('0x22')][_0x5e1153[_0x4017('0xe7')]]&&_[_0x4017('0xe9')](this[_0x4017('0x22')][_0x5e1153[_0x4017('0xe7')]][_0x4017('0xea')])&&_0x5e1153[_0x4017('0x86')]==='1'&&_0x5e1153[_0x4017('0xeb')]==='0'){if(this[_0x4017('0x1e')][_0x5e1153['stateinterface']]){if(!this[_0x4017('0x1e')][_0x5e1153[_0x4017('0xec')]][_0x4017('0xea')]){this[_0x4017('0x1e')][_0x5e1153['stateinterface']][_0x4017('0xea')]=!![];this[_0x4017('0x22')][_0x5e1153[_0x4017('0xe7')]][_0x4017('0xea')]=!![];this['actions'][_0x5e1153['actionid']][_0x4017('0xec')]=_0x5e1153['stateinterface'];}}}}else if(_0x3411fa===_0x4017('0xed')){if(this[_0x4017('0x22')][_0x5e1153[_0x4017('0xe7')]]){if(this[_0x4017('0x1e')][_0x5e1153[_0x4017('0xec')]]){this[_0x4017('0x22')][_0x5e1153[_0x4017('0xe7')]][_0x4017('0xec')]=_0x5e1153['stateinterface'];if(_['isNil'](this[_0x4017('0x29')][this['actions'][_0x5e1153[_0x4017('0xe7')]][_0x4017('0xba')]])){this[_0x4017('0x29')][this['actions'][_0x5e1153[_0x4017('0xe7')]][_0x4017('0xba')]]=[];}this[_0x4017('0x29')][this[_0x4017('0x22')][_0x5e1153[_0x4017('0xe7')]][_0x4017('0xba')]][_0x4017('0x9f')](_[_0x4017('0x5e')](_[_0x4017('0x75')](this[_0x4017('0x22')][_0x5e1153['actionid']],['idHopper',_0x4017('0xec')]),{'status':_0x5e1153['status'],'paused':_0x5e1153[_0x4017('0xeb')]}));}}}};Dialer[_0x4017('0x18')][_0x4017('0xee')]=function(_0x3777d9){if(!this['actions'][_0x3777d9['actionid']]){return;}var _0x3a309d=this;var _0x50c45d=this[_0x4017('0x1c')][this[_0x4017('0x22')][_0x3777d9[_0x4017('0xe7')]][_0x4017('0xba')]];var _0x3ba2ba=_0x50c45d[_0x4017('0xef')]||'rrmemory';if(_0x3ba2ba===_0x4017('0xe8')){if(this[_0x4017('0x22')][_0x3777d9[_0x4017('0xe7')]]&&this['actions'][_0x3777d9['actionid']][_0x4017('0xec')]){this[_0x4017('0xf0')][_0x4017('0xf1')](this[_0x4017('0x22')][_0x3777d9[_0x4017('0xe7')]][_0x4017('0xf2')],this[_0x4017('0x22')][_0x3777d9['actionid']][_0x4017('0xec')])[_0x4017('0x9e')](function(_0x4d7d6a){logger[_0x4017('0x65')](_0x4017('0xf3'),util[_0x4017('0x45')](_0x4d7d6a,{'showHidden':![],'depth':null}));})[_0x4017('0xf4')](function(){_0x3a309d[_0x4017('0xbd')](_0x3a309d[_0x4017('0x1c')][_0x3a309d[_0x4017('0x22')][_0x3777d9['actionid']]['queue']]);_0x3a309d[_0x4017('0x1e')][_0x3a309d[_0x4017('0x22')][_0x3777d9[_0x4017('0xe7')]][_0x4017('0xec')]]['locked']=![];delete _0x3a309d[_0x4017('0x22')][_0x3777d9['actionid']];unlockQueueStatus(_0x50c45d);});}else{this[_0x4017('0xbd')](this['voiceQueues'][this[_0x4017('0x22')][_0x3777d9['actionid']][_0x4017('0xba')]]);hopperUtils[_0x4017('0xe0')]({'active':![],'ContactId':this[_0x4017('0x22')][_0x3777d9[_0x4017('0xe7')]][_0x4017('0xd7')],'ListId':this[_0x4017('0x22')][_0x3777d9[_0x4017('0xe7')]][_0x4017('0xd8')],'VoiceQueueId':this[_0x4017('0x22')][_0x3777d9[_0x4017('0xe7')]][_0x4017('0xd9')]||undefined,'CampaignId':this[_0x4017('0x22')][_0x3777d9[_0x4017('0xe7')]]['CampaignId']||undefined})[_0x4017('0x9e')](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this[_0x4017('0x22')][_0x3777d9[_0x4017('0xe7')]];unlockQueueStatus(_0x50c45d);}}else if(_0x3ba2ba==='rrmemory'){var _0x1efee1;if(this[_0x4017('0x22')][_0x3777d9[_0x4017('0xe7')]]&&!_[_0x4017('0x49')](this[_0x4017('0x29')][this[_0x4017('0x22')][_0x3777d9[_0x4017('0xe7')]][_0x4017('0xba')]])){if(this[_0x4017('0x2a')][_0x3a309d[_0x4017('0x22')][_0x3777d9[_0x4017('0xe7')]]['queue']]){this[_0x4017('0x2a')][_0x3a309d['actions'][_0x3777d9['actionid']][_0x4017('0xba')]]=this[_0x4017('0x2a')][this[_0x4017('0x22')][_0x3777d9[_0x4017('0xe7')]][_0x4017('0xba')]]?this[_0x4017('0x2a')][this['actions'][_0x3777d9[_0x4017('0xe7')]][_0x4017('0xba')]]:this[_0x4017('0x29')][this['actions'][_0x3777d9[_0x4017('0xe7')]][_0x4017('0xba')]]?this['queueBooked'][this[_0x4017('0x22')][_0x3777d9['actionid']]['queue']][_0x4017('0xf5')]||0x0:0x0;}this['queueBooked'][this[_0x4017('0x22')][_0x3777d9['actionid']][_0x4017('0xba')]][_0x4017('0xf5')]=this['queueBookedRR'][this[_0x4017('0x22')][_0x3777d9[_0x4017('0xe7')]]['queue']];for(var _0x5647c7=0x0;_0x5647c7=_0x20917b['dialGlobalMaxRetry']){_0x40d148[_0x4017('0x11c')](_0x245aa8,_0x319c40,_0x71d0bb,_0x4017('0x11d'));}else{if(_0x245aa8[_0x4017('0x11a')]>=_0x20917b['dialMachineMaxRetry']){_0x40d148[_0x4017('0x11e')](_0x245aa8,_0x319c40,_0x71d0bb,_0x4017('0x11f'));}else{hopperUtils[_0x4017('0xe0')]({'active':![],'countmachineretry':_0x245aa8[_0x4017('0x11a')],'scheduledat':moment()['add'](_0x20917b[_0x4017('0x120')],_0x4017('0xd6'))[_0x4017('0x46')](_0x4017('0xbf')),'ContactId':_0x245aa8[_0x4017('0xd7')],'ListId':_0x245aa8[_0x4017('0xd8')],'VoiceQueueId':_0x245aa8[_0x4017('0xd9')]||undefined,'CampaignId':_0x245aa8[_0x4017('0xe2')]||undefined})[_0x4017('0x9e')](loggerCatch(_0x4017('0x121')));_0x319c40({'reschedule':0x1});}}});}if(_0x141672['type']===_0x4017('0xbc')&&this[_0x4017('0x1d')][_0x141672['queue']][_0x4017('0x107')]&&_0x1a85ac[_0x4017('0x108')]===_0x4017('0x109')){delete this[_0x4017('0x24')][_0x1a85ac[_0x4017('0xbb')]];this[_0x4017('0xbd')](this[_0x4017('0x1d')][_0x141672['queue']]);_0x3f0fae=new Hangup(_0x141672,_0x1a85ac);_0x3f0fae[_0x4017('0x6e')]=0x12;_0x3f0fae[_0x4017('0xca')]=_0x4017('0x10c');_0x3f0fae['membername']=_0x4017('0x10e');ami[_0x4017('0x41')]('custom:amd',ut[_0x4017('0x110')](_0x3f0fae,'amd'));this[_0x4017('0x111')](_0x3f0fae,_0x4017('0x122'),_0x4017('0x123'));}if(_0x141672['type']===_0x4017('0xbc')&&this['campaigns'][_0x141672['queue']][_0x4017('0x107')]&&_0x1a85ac[_0x4017('0x108')]==='MACHINE'){return new Promise(function(_0x53653e,_0x24273a){delete _0x40d148[_0x4017('0x24')][_0x1a85ac[_0x4017('0xbb')]];_0x40d148[_0x4017('0xbd')](_0x40d148['campaigns'][_0x141672[_0x4017('0xba')]]);_0x40d148['campaigns'][_0x141672[_0x4017('0xba')]]['outboundAnswerCallsDay']+=0x1;_0x40d148[_0x4017('0x1d')][_0x141672['queue']][_0x4017('0x10b')]+=0x1;var _0xadaad0=_0x40d148[_0x4017('0x1d')][_0x141672['queue']];var _0xb8ddc1=new Hangup(_0x141672,_0x1a85ac);_0xb8ddc1['state']=0x13;_0xb8ddc1[_0x4017('0xca')]=_0x4017('0x114');_0xb8ddc1['membername']='AMD';_0xb8ddc1['countmachineretry']+=0x1;_0xb8ddc1[_0x4017('0xce')]+=0x1;_0xb8ddc1['amd']=!![];ami['emit'](_0x4017('0x10f'),ut[_0x4017('0x110')](_0xb8ddc1,_0x4017('0x115')));hopperUtils[_0x4017('0xc2')](_0xb8ddc1)[_0x4017('0x9e')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0xb8ddc1['countbusyretry']+_0xb8ddc1['countcongestionretry']+_0xb8ddc1['countnoanswerretry']+_0xb8ddc1[_0x4017('0x124')]+_0xb8ddc1[_0x4017('0x119')]+_0xb8ddc1['countabandonedretry']+_0xb8ddc1[_0x4017('0x11a')]+_0xb8ddc1[_0x4017('0x11b')]>=_0xadaad0[_0x4017('0x125')]){_0x40d148['stateGlobal'](_0xb8ddc1,_0x53653e,_0x24273a,'reason19\x20machine....');}else{if(_0xb8ddc1[_0x4017('0x11a')]>=_0xadaad0[_0x4017('0x126')]){_0x40d148[_0x4017('0x11e')](_0xb8ddc1,_0x53653e,_0x24273a,_0x4017('0x11f'));}else{hopperUtils[_0x4017('0xe0')]({'active':![],'countmachineretry':_0xb8ddc1[_0x4017('0x11a')],'scheduledat':moment()[_0x4017('0xd4')](_0xadaad0[_0x4017('0x120')],_0x4017('0xd6'))[_0x4017('0x46')](_0x4017('0xbf')),'ContactId':_0xb8ddc1[_0x4017('0xd7')],'ListId':_0xb8ddc1[_0x4017('0xd8')],'VoiceQueueId':_0xb8ddc1[_0x4017('0xd9')]||undefined,'CampaignId':_0xb8ddc1['CampaignId']||undefined})[_0x4017('0x9e')](loggerCatch(_0x4017('0x121')));_0x53653e({'reschedule':0x1});}}});}}};Dialer[_0x4017('0x18')][_0x4017('0x37')]=function(_0x2d25aa){var _0x1360a6=this['uniqueId'][_0x2d25aa[_0x4017('0xbb')]];var _0x3b189f;if(_0x1360a6&&_0x1360a6[_0x4017('0x42')]===_0x4017('0xbc')){delete this[_0x4017('0x24')][_0x2d25aa[_0x4017('0xbb')]];this[_0x4017('0xbd')](this[_0x4017('0x1d')][_0x1360a6[_0x4017('0xba')]]);this[_0x4017('0x1d')][_0x1360a6[_0x4017('0xba')]][_0x4017('0x127')]+=0x1;_0x3b189f=new Hangup(_0x1360a6,_0x2d25aa);hopperUtils['createHistory'](_0x3b189f)[_0x4017('0x9e')](loggerCatch(_0x4017('0x128')));hopperUtils[_0x4017('0xc4')](_0x3b189f)[_0x4017('0x9e')](loggerCatch(_0x4017('0x129')));}if(_0x1360a6&&_0x1360a6[_0x4017('0x42')]!=='ivr'&&isNotNull(this[_0x4017('0x1c')][_0x1360a6[_0x4017('0xba')]][_0x4017('0x12a')])){delete this[_0x4017('0x24')][_0x2d25aa[_0x4017('0xbb')]];this[_0x4017('0xbd')](this[_0x4017('0x1c')][_0x1360a6[_0x4017('0xba')]]);this[_0x4017('0x1c')][_0x1360a6[_0x4017('0xba')]][_0x4017('0x10a')]+=0x1;this[_0x4017('0x1c')][_0x1360a6[_0x4017('0xba')]][_0x4017('0x10b')]+=0x1;_0x3b189f=new Hangup(_0x1360a6,_0x2d25aa);_0x3b189f[_0x4017('0x6e')]=0x10;_0x3b189f['statedesc']=_0x4017('0x12b');_0x3b189f['membername']=_0x4017('0x12c');hopperUtils[_0x4017('0xc2')](_0x3b189f)[_0x4017('0x9e')](loggerCatch(_0x4017('0x128')));hopperUtils[_0x4017('0xc4')](_0x3b189f)[_0x4017('0x9e')](loggerCatch('[syncHangupIvr]'));}if(_0x1360a6&&_0x1360a6[_0x4017('0x42')]!==_0x4017('0xbc')&&!isNotNull(this[_0x4017('0x1c')][_0x1360a6[_0x4017('0xba')]][_0x4017('0x12a')])){if(_0x2d25aa[_0x4017('0x12d')]===_0x4017('0x12e')){delete this[_0x4017('0x24')][_0x2d25aa[_0x4017('0xbb')]];this[_0x4017('0x1c')][_0x1360a6['queue']][_0x4017('0x10a')]+=0x1;const _0x43d5f0=new AgentComplete(_0x1360a6,_0x2d25aa);_0x43d5f0[_0x4017('0xe2')]=this[_0x4017('0x1c')][_0x1360a6[_0x4017('0xba')]]['id'];hopperUtils[_0x4017('0xc2')](_0x43d5f0)[_0x4017('0x9e')](loggerCatch('[syncAgentComplete][createHistory]'));hopperUtils[_0x4017('0xc4')](_0x43d5f0)[_0x4017('0x9e')](loggerCatch(_0x4017('0xc5')));}else{delete this[_0x4017('0x24')][_0x2d25aa[_0x4017('0xbb')]];this['updateOriginated'](this[_0x4017('0x1c')][_0x1360a6[_0x4017('0xba')]]);this[_0x4017('0x1c')][_0x1360a6[_0x4017('0xba')]]['outboundUnknownCallsDay']+=0x1;_0x3b189f=new Hangup(_0x1360a6,_0x2d25aa);_0x3b189f[_0x4017('0x6e')]=0xc;_0x3b189f[_0x4017('0xca')]=_0x2d25aa['cause-txt'];_0x3b189f[_0x4017('0x10d')]=_0x4017('0x12f');hopperUtils[_0x4017('0xc2')](_0x3b189f)[_0x4017('0x9e')](loggerCatch(_0x4017('0x128')));hopperUtils['moveContactManagedDialer'](_0x3b189f)['catch'](loggerCatch(_0x4017('0x129')));}}};Dialer[_0x4017('0x18')]['syncQueueSummary']=function(_0x14be17){var _0xc6597e=this;if(!_0xc6597e[_0x4017('0x2b')][_0x14be17['name']]){_0xc6597e[_0x4017('0x2b')][_0x14be17['name']]={'running':![]};}else if(_0xc6597e[_0x4017('0x2b')][_0x14be17['name']][_0x4017('0x130')]===!![]){return;}else if(_0xc6597e['queuesSummary'][_0x14be17['name']][_0x4017('0x130')]===![]){_0xc6597e[_0x4017('0x2b')][_0x14be17[_0x4017('0x48')]][_0x4017('0x130')]=!![];}var _0x246a68=_0xc6597e[_0x4017('0x1c')][_0x14be17[_0x4017('0x48')]];var _0x36cf46=_0x246a68['message']!==utils[_0x4017('0x69')][_0x4017('0x7b')];var _0x30940b=utils[_0x4017('0x131')](_0x246a68);_0x246a68[_0x4017('0x132')]=utils[_0x4017('0x133')](_0x246a68,_0xc6597e[_0x4017('0x1f')]);Promise['resolve']()[_0x4017('0x3f')](function(){if(_0x246a68[_0x4017('0x132')]===utils[_0x4017('0x69')][_0x4017('0x7b')]){if(_0x36cf46){clearPredictiveAttributes(_0x246a68);_0x14be17[_0x4017('0x26')]=undefined;_0x14be17['startProgressive']=undefined;}if(_0x246a68[_0x4017('0x132')]===utils['CAMPAIGN_STATUS'][_0x4017('0x7b')]){_0x14be17[_0x4017('0x134')]=0x0;_0x14be17['paused']=0x0;_0x14be17[_0x4017('0x135')]=0x0;_0x14be17[_0x4017('0x136')]=0x0;_0x14be17[_0x4017('0x137')]=0x0;}}else if(_0x246a68[_0x4017('0x132')]===utils[_0x4017('0x69')]['ACTIVE']&&!_0x30940b){return _0xc6597e[_0x4017('0x92')](_0x246a68,!![])[_0x4017('0x3f')](function(){return _0xc6597e['ifTime'](_0x246a68,![]);})[_0x4017('0x3f')](function(){return _0xc6597e[_0x4017('0xab')](_0x246a68);})[_0x4017('0x9e')](function(_0x4bfba3){loggerSyncQueueSummary[_0x4017('0x60')](_0x4017('0x138'),util[_0x4017('0x45')](_0x4bfba3,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x246a68);});}else{clearPredictiveAttributes(_0x246a68);}})['then'](function(){var _0x3f68dd=_0x14be17[_0x4017('0x139')](_0x246a68);if(_0x3f68dd||_0x246a68[_0x4017('0x13a')]){_0x246a68[_0x4017('0x13a')]=![];_0x14be17[_0x4017('0x13b')](_0x246a68);Object[_0x4017('0x13c')](_0x246a68,_0x14be17);emitOutboundVoiceQueueSummary(_0x14be17);}_0xc6597e[_0x4017('0x2b')][_0x246a68[_0x4017('0x48')]][_0x4017('0x130')]=![];})[_0x4017('0x9e')](function(_0x203fbb){logger[_0x4017('0x65')](_0x4017('0x138'),util[_0x4017('0x45')](_0x203fbb,{'showHidden':![],'depth':null}));_0xc6597e[_0x4017('0x2b')][_0x246a68[_0x4017('0x48')]][_0x4017('0x130')]=![];});};Dialer[_0x4017('0x18')]['syncQueueSummaryComplete']=_[_0x4017('0x13d')](function(){var _0x1b4d94=_[_0x4017('0x13e')](this['voiceQueues'],function(_0x171b21){return _0x171b21[_0x4017('0x13f')];});var _0x5a225=_[_0x4017('0x13e')](this[_0x4017('0x1e')],function(_0x5beadd){return _0x5beadd[_0x4017('0x140')]&&_0x5beadd[_0x4017('0x86')]===_0x4017('0x141');});if(_0x1b4d94[_0x4017('0x97')]>0x0&&_0x5a225[_0x4017('0x97')]>0x0){return Promise[_0x4017('0xa6')]()[_0x4017('0x3f')](cmHopper['handlePreviewRecallNotifications'](_[_0x4017('0x142')](_0x1b4d94,'id'),previewRecallmeReminderInterval,_['map'](_0x5a225,'id')))[_0x4017('0x3f')](function(_0x2e8190){for(var _0x22d02f=0x0;_0x22d02f<_0x2e8190['length'];_0x22d02f++){var _0x4a3cba=_0x2e8190[_0x22d02f][_0x4017('0x143')][_0x4017('0x48')];if(_0x4a3cba)io['to'](util['format'](_0x4017('0x144'),_0x4a3cba))[_0x4017('0x41')](_0x4017('0x145'),{'hopper':_0x2e8190[_0x22d02f]});}})[_0x4017('0x9e')](function(_0x326900){logger['error'](_0x4017('0x146'),_0x326900);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x4017('0x18')][_0x4017('0x3d')]=function(){var _0x2a8767=this;setInterval(function(){_0x2a8767['clearZombieChannels'](_0x2a8767[_0x4017('0x24')],'[uniqueid]');_0x2a8767[_0x4017('0x147')](_0x2a8767['actions'],'[actions]');},0x32c8);};Dialer[_0x4017('0x18')][_0x4017('0x147')]=function(_0x31e1bf,_0x3cbc71){var _0x8762f0=this;for(var _0x2a671f in _0x31e1bf){if(typeof _0x31e1bf[_0x2a671f]!==_0x4017('0x148')){this[_0x4017('0x1b')][_0x4017('0x19')](function(){if(!_[_0x4017('0xe9')](_0x31e1bf[_0x2a671f])){return ami['Action']({'action':_0x4017('0x86'),'channel':_0x31e1bf[_0x2a671f][_0x4017('0xe6')]})[_0x4017('0x9e')](function(_0x113bd9){if(_0x113bd9[_0x4017('0x68')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x31e1bf[_0x2a671f]&&_0x31e1bf[_0x2a671f][_0x4017('0x42')]!==_0x4017('0xbc')){_0x8762f0[_0x4017('0xbd')](_0x8762f0[_0x4017('0x1c')][_0x31e1bf[_0x2a671f]['queue']]);logger[_0x4017('0x65')](_0x4017('0x149'),_0x3cbc71,_0x2a671f,_0x31e1bf[_0x2a671f][_0x4017('0xba')]);delete _0x31e1bf[_0x2a671f];}if(_0x31e1bf[_0x2a671f]&&_0x31e1bf[_0x2a671f][_0x4017('0x42')]==='ivr'){_0x8762f0[_0x4017('0xbd')](_0x8762f0['campaigns'][_0x31e1bf[_0x2a671f]['queue']]);logger['error'](_0x4017('0x14a'),_0x3cbc71,_0x2a671f,_0x31e1bf[_0x2a671f][_0x4017('0xba')]);delete _0x31e1bf[_0x2a671f];}},0x2328);}});}});}}};Dialer[_0x4017('0x18')]['getVoiceQueueRtPauses']=function(_0x5ac280){return Promise[_0x4017('0xa6')]()[_0x4017('0x3f')](voiceQueueRt[_0x4017('0x14b')](_0x5ac280))[_0x4017('0x9e')](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0x4017('0x18')][_0x4017('0xbd')]=function(_0x22c445){if(!_[_0x4017('0x52')](_0x22c445)&&_0x22c445!==null){if(typeof _0x22c445['originated']!==_0x4017('0x148')){if(_0x22c445[_0x4017('0x14c')]>0x0){_0x22c445[_0x4017('0x14c')]-=0x1;}else{logger[_0x4017('0x65')](_0x4017('0x14d'));}}}else{logger[_0x4017('0x65')](_0x4017('0x14e'));}};Dialer[_0x4017('0x18')][_0x4017('0x14f')]=function(_0xc057e4,_0x324ace){var _0x352f8f=this;return function(_0x325a83){_0x352f8f[_0x4017('0xbd')](_0x324ace);logger[_0x4017('0x65')](_0xc057e4,util[_0x4017('0x45')](_0x325a83,{'showHidden':![],'depth':null}));};};Dialer[_0x4017('0x18')][_0x4017('0x150')]=function(_0x3560c4,_0x2f3930,_0x2df777){var _0x1abe37={'state':0x19,'statedesc':'notFound'};this[_0x4017('0xbd')](_0x2f3930);this[_0x4017('0x111')](_[_0x4017('0x5e')](_0x1abe37,_[_0x4017('0x75')](_0x2df777,[_0x4017('0xd7'),_0x4017('0xd8'),_0x4017('0x151'),'VoiceQueueId','CampaignId'])),_0x4017('0x152'),'[emptyContact]');logger['error'](_0x3560c4);};Dialer[_0x4017('0x18')][_0x4017('0x111')]=function(_0x3deae4,_0x43b026,_0x24813a){hopperUtils['createHistory'](_0x3deae4)['catch'](loggerCatch(_0x43b026));hopperUtils['moveContactManagedDialer'](_0x3deae4)['catch'](loggerCatch(_0x24813a));};Dialer[_0x4017('0x18')][_0x4017('0xd3')]=function(_0x259e16,_0xb0e881){hopperUtils[_0x4017('0xc2')](_0x259e16)[_0x4017('0x9e')](loggerCatch('[syncAgentComplete][createHistory]'));if(_0xb0e881==0x0){hopperUtils['moveContactManagedDialer'](_0x259e16)[_0x4017('0x9e')](loggerCatch(_0x4017('0x153')));}};Dialer['prototype'][_0x4017('0x146')]=function(_0x2926c7){return Promise[_0x4017('0xa6')]()[_0x4017('0x3f')](cmHopper['handlePreviewRecallNotifications'](_0x2926c7['id'],previewRecallmeReminderInterval))[_0x4017('0x3f')](function(_0x3fee11){for(var _0xdb31b3=0x0;_0xdb31b3<_0x3fee11[_0x4017('0x97')];_0xdb31b3++){var _0x52f92e=_0x3fee11[_0xdb31b3][_0x4017('0x143')]['name'];if(_0x52f92e)io['to'](util[_0x4017('0x46')]('user:%s',_0x52f92e))[_0x4017('0x41')]('user:dialPreviewRecallReminder',{'hopper':_0x3fee11[_0xdb31b3]});}})[_0x4017('0x9e')](function(){});};Dialer[_0x4017('0x18')]['launchHandleIvr']=function(_0x2a9610){var _0x3f81c0=this;return function(){_0x3f81c0[_0x4017('0x154')](_0x2a9610);};};Dialer[_0x4017('0x18')][_0x4017('0x155')]=function(_0x10bb96,_0x1a0d5c){var _0x2dc7c3=this;var _0x462c6d=uuid['v4']();this[_0x4017('0x22')][_0x462c6d]=new Action(_0x10bb96,_0x1a0d5c,_0x462c6d);return new Promise(function(_0x1a61a8,_0x171945){if(_[_0x4017('0x52')](_0x10bb96)&&typeof _0x10bb96!==_0x4017('0x156')){return _0x171945(msgResponse(_0x4017('0x157'),'Failure',_0x4017('0x158')));}if(_[_0x4017('0x52')](_0x1a0d5c[_0x4017('0x159')])||_0x1a0d5c['phone']===null){return _0x171945(msgResponse(_0x4017('0x157'),'Failure',_0x4017('0x15a')));}var _0x2a8ba2={'XMD-CALLERID':_0x2dc7c3[_0x4017('0x22')][_0x462c6d][_0x4017('0x15b')](),'XMD-AGI':_0x10bb96['dialQueueProject']?util[_0x4017('0x46')](_0x4017('0x15c'),ipAgi,_0x10bb96['dialQueueProject']):_0x4017('0x15d'),'XMD-AGIAFTER':_0x10bb96[_0x4017('0xc1')]?util[_0x4017('0x46')](_0x4017('0x15c'),ipAgi,_0x10bb96[_0x4017('0xc1')]):_0x4017('0x15d'),'XMD-QUEUE':utils[_0x4017('0x15e')](_0x10bb96)?util[_0x4017('0x46')](_0x4017('0x15f'),_0x10bb96['name'],_0x10bb96[_0x4017('0x160')]||'',_0x10bb96[_0x4017('0x161')]?'c':'',_0x10bb96[_0x4017('0x162')]||0x3):_0x4017('0x15d'),'XMD-CONTACTID':_0x1a0d5c[_0x4017('0xd7')],'XMD-CDRTYPE':_0x4017('0x7'),'CALLERID(all)':_0x2dc7c3['actions'][_0x462c6d]['getCaller'](),'XMD-AMD':_0x10bb96['dialAMDActive']?_0x4017('0x163'):_0x4017('0x15d'),'XMD-DESTINATION':_0x4017('0x106')};if(_0x10bb96[_0x4017('0x107')]){_0x2a8ba2['XMD-AMDINITIALSILENCE']=_0x10bb96[_0x4017('0x164')]||0x9c4;_0x2a8ba2[_0x4017('0x165')]=_0x10bb96[_0x4017('0x166')]||0x5dc;_0x2a8ba2['XMD-AMDAFTERGREETINGSILENCE']=_0x10bb96[_0x4017('0x167')]||0x320;_0x2a8ba2[_0x4017('0x168')]=_0x10bb96['dialAMDTotalAnalysisTime']||0x1388;_0x2a8ba2['XMD-AMDMINWORDLENGTH']=_0x10bb96['dialAMDMinWordLength']||0x64;_0x2a8ba2[_0x4017('0x169')]=_0x10bb96[_0x4017('0x16a')]||0x32;_0x2a8ba2[_0x4017('0x16b')]=_0x10bb96['dialAMDMaximumNumberOfWords']||0x3;_0x2a8ba2[_0x4017('0x16c')]=_0x10bb96[_0x4017('0x16d')]||0x100;_0x2a8ba2[_0x4017('0x16e')]=_0x10bb96['dialAMDMaximumWordLength']||0x1388;}if(utils[_0x4017('0x15e')](_0x10bb96)){_0x2a8ba2['XMD-VOICEQUEUEID']=_0x1a0d5c[_0x4017('0xd9')];}else{_0x2a8ba2[_0x4017('0x16f')]=_0x1a0d5c[_0x4017('0xe2')];}var _0x10c0b6=utils[_0x4017('0x170')](_0x1a0d5c[_0x4017('0x171')]);Object[_0x4017('0x13c')](_0x2a8ba2,_0x10c0b6);var _0x357fc4=_0x2dc7c3[_0x4017('0x84')](_0x10bb96[_0x4017('0x172')])?utils[_0x4017('0x173')](_0x10bb96['Trunk'][_0x4017('0x174')],_0x10bb96[_0x4017('0x175')],_0x10bb96[_0x4017('0x176')]>0x0?utils[_0x4017('0x177')](_0x10bb96[_0x4017('0x178')],_0x10bb96[_0x4017('0x176')]):_0x10bb96[_0x4017('0x178')]):utils[_0x4017('0x173')](_[_0x4017('0xe9')](_0x10bb96[_0x4017('0x8a')])?_0x10bb96['Trunk'][_0x4017('0x174')]:_0x10bb96['TrunkBackup'][_0x4017('0x174')],_0x10bb96['dialOriginateCallerIdName'],_0x10bb96['dialRandomLastDigitCallerIdNumber']>0x0?utils[_0x4017('0x177')](_0x10bb96[_0x4017('0x178')],_0x10bb96[_0x4017('0x176')]):_0x10bb96['dialOriginateCallerIdNumber']);if(_0x357fc4){_0x2a8ba2[_0x4017('0x179')]=_0x2dc7c3[_0x4017('0x22')][_0x462c6d][_0x4017('0x17a')]=utils[_0x4017('0x17b')](_0x357fc4);_0x2a8ba2['XMD-ORIGINATECALLERIDNUM']=_0x1a0d5c[_0x4017('0x159')];}_0x10bb96[_0x4017('0x17c')]=_0x2a8ba2;return ami[_0x4017('0x17d')]({'actionid':_0x462c6d,'action':_0x4017('0x157'),'channel':_0x2dc7c3[_0x4017('0x84')](_0x10bb96[_0x4017('0x172')])?util[_0x4017('0x46')](_0x4017('0x17e'),_0x10bb96['Trunk'][_0x4017('0x48')],isNotNull(_0x10bb96[_0x4017('0x17f')])?_0x10bb96[_0x4017('0x17f')]['trim']()||'':'',_0x10bb96['dialCutDigit']>0x0?_0x1a0d5c[_0x4017('0x159')][_0x4017('0x180')](_0x10bb96[_0x4017('0x181')]):_0x1a0d5c['phone']):util['format']('SIP/%s/%s%s',_[_0x4017('0xe9')](_0x10bb96[_0x4017('0x8a')])?_0x10bb96[_0x4017('0x172')][_0x4017('0x48')]:_0x10bb96[_0x4017('0x8a')][_0x4017('0x48')],isNotNull(_0x10bb96[_0x4017('0x17f')])?_0x10bb96['dialPrefix']['trim']()||'':'',_0x10bb96[_0x4017('0x181')]>0x0?_0x1a0d5c[_0x4017('0x159')][_0x4017('0x180')](_0x10bb96[_0x4017('0x181')]):_0x1a0d5c['phone']),'callerid':_0x357fc4,'Exten':_0x4017('0x106'),'Context':_0x4017('0x182'),'Priority':'1','variable':_0x2a8ba2,'timeout':(_0x10bb96['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x462c6d})[_0x4017('0x3f')](function(_0x5a65bd){return _0x1a61a8(_0x5a65bd);})[_0x4017('0x9e')](function(_0x660778){_0x10bb96[_0x4017('0x183')]+=0x1;var _0x332b5d=new History(_0x2dc7c3[_0x4017('0x22')][_0x462c6d]);logger[_0x4017('0x65')](util[_0x4017('0x46')](_0x4017('0x184'),JSON['stringify'](_0x660778)));_0x332b5d['state']=0xe;_0x332b5d[_0x4017('0xca')]=_0x4017('0x185');_0x332b5d[_0x4017('0x70')]=moment()[_0x4017('0x46')]('YYYY-MM-DD\x20HH:mm:ss');_0x332b5d[_0x4017('0x6f')]=_0x332b5d[_0x4017('0x70')];hopperUtils['createHistory'](_0x332b5d)['catch'](loggerCatch('[originate][error]'));_0x2dc7c3[_0x4017('0xc4')](_0x332b5d)['catch'](loggerCatch(_0x4017('0x186')))[_0x4017('0xf4')](function(){delete _0x2dc7c3['actions'][_0x462c6d];return _0x171945(msgResponse(_0x4017('0x157'),'Error','originate\x20action\x20Error'));});});});};Dialer[_0x4017('0x18')][_0x4017('0x187')]=function(_0x239243,_0x210076,_0x32bc85){var _0x237c78=new History(_0x210076);if(_0x237c78[_0x4017('0x117')]+_0x237c78[_0x4017('0x188')]+_0x237c78[_0x4017('0x118')]+_0x237c78[_0x4017('0x124')]+_0x237c78[_0x4017('0x119')]+_0x237c78[_0x4017('0xdf')]+_0x237c78['countmachineretry']+_0x237c78[_0x4017('0x11b')]>=_0x32bc85[_0x4017('0x125')]-0x1){return!![];}switch(_0x239243){case 0x3:if(_0x237c78[_0x4017('0x118')]>=_0x32bc85[_0x4017('0x189')]-0x1){return!![];}hopperUtils[_0x4017('0xe0')]({'active':![],'countnoanswerretry':_0x237c78['countnoanswerretry']+=0x1,'scheduledat':moment()['add'](_0x32bc85[_0x4017('0x18a')],_0x4017('0xd6'))[_0x4017('0x46')](_0x4017('0xbf')),'ContactId':_0x237c78[_0x4017('0xd7')],'ListId':_0x237c78[_0x4017('0xd8')],'VoiceQueueId':_0x237c78[_0x4017('0xd9')]||undefined,'CampaignId':_0x237c78[_0x4017('0xe2')]||undefined})[_0x4017('0x9e')](loggerCatch(_0x4017('0x18b')));break;case 0x5:if(_0x237c78[_0x4017('0x117')]>=_0x32bc85[_0x4017('0x18c')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countbusyretry':_0x237c78[_0x4017('0x117')]+=0x1,'scheduledat':moment()[_0x4017('0xd4')](_0x32bc85[_0x4017('0x18d')],_0x4017('0xd6'))['format'](_0x4017('0xbf')),'ContactId':_0x237c78[_0x4017('0xd7')],'ListId':_0x237c78[_0x4017('0xd8')],'VoiceQueueId':_0x237c78[_0x4017('0xd9')]||undefined,'CampaignId':_0x237c78['CampaignId']||undefined})[_0x4017('0x9e')](loggerCatch(_0x4017('0x18e')));break;case 0x8:if(_0x237c78[_0x4017('0x188')]>=_0x32bc85[_0x4017('0x18f')]-0x1){return!![];}hopperUtils[_0x4017('0xe0')]({'active':![],'countcongestionretry':_0x237c78[_0x4017('0x188')]+=0x1,'scheduledat':moment()[_0x4017('0xd4')](_0x32bc85[_0x4017('0x190')],_0x4017('0xd6'))[_0x4017('0x46')](_0x4017('0xbf')),'ContactId':_0x237c78[_0x4017('0xd7')],'ListId':_0x237c78[_0x4017('0xd8')],'VoiceQueueId':_0x237c78['VoiceQueueId']||undefined,'CampaignId':_0x237c78[_0x4017('0xe2')]||undefined})[_0x4017('0x9e')](loggerCatch('[rescheduleContact]\x20[Congestion]'));break;case 0x0:if(_0x237c78[_0x4017('0x124')]>=_0x32bc85[_0x4017('0x191')]-0x1){return!![];}else{hopperUtils[_0x4017('0xe0')]({'active':![],'countnosuchnumberretry':_0x237c78[_0x4017('0x124')]+=0x1,'scheduledat':moment()['add'](_0x32bc85[_0x4017('0x192')],'minutes')[_0x4017('0x46')](_0x4017('0xbf')),'ContactId':_0x237c78[_0x4017('0xd7')],'ListId':_0x237c78['ListId'],'VoiceQueueId':_0x237c78[_0x4017('0xd9')]||undefined,'CampaignId':_0x237c78['CampaignId']||undefined})['catch'](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x237c78[_0x4017('0x119')]>=_0x32bc85[_0x4017('0x193')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0x237c78['countdropretry']+=0x1,'scheduledat':moment()['add'](_0x32bc85['dialDropRetryFrequency'],_0x4017('0xd6'))[_0x4017('0x46')](_0x4017('0xbf')),'ContactId':_0x237c78[_0x4017('0xd7')],'ListId':_0x237c78['ListId'],'VoiceQueueId':_0x237c78[_0x4017('0xd9')]||undefined,'CampaignId':_0x237c78[_0x4017('0xe2')]||undefined})[_0x4017('0x9e')](loggerCatch(_0x4017('0x194')));break;case 0xb:if(_0x237c78[_0x4017('0xdf')]>=_0x32bc85[_0x4017('0x195')]-0x1){return!![];}hopperUtils[_0x4017('0xe0')]({'active':![],'countabandonedretry':_0x237c78[_0x4017('0xdf')]+=0x1,'scheduledat':moment()[_0x4017('0xd4')](_0x32bc85[_0x4017('0xe1')],_0x4017('0xd6'))[_0x4017('0x46')](_0x4017('0xbf')),'ContactId':_0x237c78['ContactId'],'ListId':_0x237c78[_0x4017('0xd8')],'VoiceQueueId':_0x237c78['VoiceQueueId']||undefined,'CampaignId':_0x237c78['CampaignId']||undefined})[_0x4017('0x9e')](loggerCatch('[rescheduleContact][Abandoned]'));break;case 0x13:if(_0x237c78[_0x4017('0x11a')]>=_0x32bc85[_0x4017('0x126')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x237c78[_0x4017('0x11a')]+=0x1,'scheduledat':moment()['add'](_0x32bc85[_0x4017('0x120')],_0x4017('0xd6'))[_0x4017('0x46')](_0x4017('0xbf')),'ContactId':_0x237c78['ContactId'],'ListId':_0x237c78[_0x4017('0xd8')],'VoiceQueueId':_0x237c78[_0x4017('0xd9')]||undefined,'CampaignId':_0x237c78['CampaignId']||undefined})[_0x4017('0x9e')](loggerCatch(_0x4017('0x121')));break;case 0x14:if(_0x237c78[_0x4017('0x11b')]>=_0x32bc85['dialAgentRejectMaxRetry']-0x1){return!![];}hopperUtils[_0x4017('0xe0')]({'active':![],'countagentrejectretry':_0x237c78[_0x4017('0x11b')]+=0x1,'scheduledat':moment()[_0x4017('0xd4')](_0x32bc85['dialAgentRejectRetryFrequency'],_0x4017('0xd6'))[_0x4017('0x46')](_0x4017('0xbf')),'ContactId':_0x237c78[_0x4017('0xd7')],'ListId':_0x237c78[_0x4017('0xd8')],'VoiceQueueId':_0x237c78[_0x4017('0xd9')]||undefined,'CampaignId':_0x237c78[_0x4017('0xe2')]||undefined})['catch'](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer[_0x4017('0x18')][_0x4017('0x196')]=function(_0x3a7dd2,_0x2a8786,_0xa122fa){var _0x2d4fe8=this;var _0x1ad5f6=new History(_0x3a7dd2);var _0x524292=![];var _0xd51175;var _0x19fb2a;return new Promise(function(_0x1c5871,_0x517f0a){if(_[_0x4017('0x52')](_0x2a8786)&&typeof _0x2a8786!==_0x4017('0x156')){return _0x517f0a(msgResponse('[callProgressDetecting]','Failure',_0x4017('0x197')));}if(_[_0x4017('0x52')](_0xa122fa)&&typeof _0xa122fa!==_0x4017('0x156')){return _0x517f0a(msgResponse('[callProgressDetecting]',_0x4017('0x90'),_0x4017('0x198')));}hopperUtils[_0x4017('0xd0')](_0x1ad5f6,_0xa122fa[_0x4017('0x199')],_0x2a8786)['then'](function(_0x465440){if(_0x465440[_0x4017('0xd2')]==0x1)_0x524292=!![];switch(_0xa122fa[_0x4017('0x199')]){case'0':_0x2a8786['outboundNoSuchCallsDay']+=0x1;_0x1ad5f6['state']=0x0;_0x1ad5f6[_0x4017('0xca')]='NoSuchNumber';_0x1ad5f6[_0x4017('0x124')]+=0x1;_0x1ad5f6[_0x4017('0xce')]+=0x1;ami[_0x4017('0x41')](_0x4017('0x19a'),ut[_0x4017('0x110')](_0x3a7dd2,'nosuchnumber'));_0xd51175=_0x2a8786[_0x4017('0x192')];_0x19fb2a=_0x2a8786[_0x4017('0xcf')];hopperUtils[_0x4017('0xc2')](_0x1ad5f6)['catch'](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x2d4fe8[_0x4017('0x187')](0x0,_0x3a7dd2,_0x2a8786)&&!_0x524292){if(_0x1ad5f6[_0x4017('0x124')]>=_0x2a8786['dialNoSuchNumberMaxRetry']){_0x2d4fe8[_0x4017('0x11e')](_0x1ad5f6,_0x1c5871,_0x517f0a,_0x4017('0x19b'));}else{_0x2d4fe8[_0x4017('0x11c')](_0x1ad5f6,_0x1c5871,_0x517f0a,_0x4017('0x19b'));}}break;case'3':_0x2a8786[_0x4017('0x19c')]+=0x1;_0x1ad5f6[_0x4017('0x6e')]=0x3;_0x1ad5f6[_0x4017('0xca')]=_0x4017('0x19d');_0x1ad5f6[_0x4017('0x118')]+=0x1;_0x1ad5f6[_0x4017('0xce')]+=0x1;var _0x50f20a=ut[_0x4017('0x19e')](_0x3a7dd2,_0x2a8786);ami['emit'](_0x4017('0x19f'),_0x50f20a);_0xd51175=_0x2a8786[_0x4017('0x18a')];_0x19fb2a=_0x2a8786[_0x4017('0xcf')];hopperUtils['createHistory'](_0x1ad5f6)[_0x4017('0x9e')](loggerCatch(_0x4017('0x1a0')));if(_0x2d4fe8[_0x4017('0x187')](0x3,_0x3a7dd2,_0x2a8786)&&!_0x524292){if(_0x1ad5f6[_0x4017('0x118')]>=_0x2a8786[_0x4017('0x189')]){_0x2d4fe8[_0x4017('0x11e')](_0x1ad5f6,_0x1c5871,_0x517f0a,'reason\x203\x20ringing\x20no\x20answer');}else{_0x2d4fe8[_0x4017('0x11c')](_0x1ad5f6,_0x1c5871,_0x517f0a,_0x4017('0x1a1'));}}break;case'5':_0x2a8786[_0x4017('0x1a2')]+=0x1;_0x1ad5f6[_0x4017('0x6e')]=0x5;_0x1ad5f6['statedesc']=_0x4017('0x1a3');_0x1ad5f6['countbusyretry']+=0x1;_0x1ad5f6[_0x4017('0xce')]+=0x1;ami[_0x4017('0x41')](_0x4017('0x1a4'),ut[_0x4017('0x110')](_0x3a7dd2,_0x4017('0x1a5')));_0xd51175=_0x2a8786[_0x4017('0x18d')];_0x19fb2a=_0x2a8786['callAdditionalPhoneAfterMin'];hopperUtils['createHistory'](_0x1ad5f6)[_0x4017('0x9e')](loggerCatch(_0x4017('0x1a6')));if(_0x2d4fe8[_0x4017('0x187')](0x5,_0x3a7dd2,_0x2a8786)&&!_0x524292){if(_0x1ad5f6[_0x4017('0x117')]>=_0x2a8786[_0x4017('0x18c')]){_0x2d4fe8['createStateFinal'](_0x1ad5f6,_0x1c5871,_0x517f0a,_0x4017('0x1a7'));}else{_0x2d4fe8['stateGlobal'](_0x1ad5f6,_0x1c5871,_0x517f0a,_0x4017('0x1a7'));}}break;case'8':_0x2a8786[_0x4017('0x1a8')]+=0x1;_0x1ad5f6[_0x4017('0x6e')]=0x8;_0x1ad5f6[_0x4017('0xca')]='Congestion';_0x1ad5f6['countcongestionretry']+=0x1;_0x1ad5f6[_0x4017('0xce')]+=0x1;_0xd51175=_0x2a8786[_0x4017('0x190')];_0x19fb2a=_0x2a8786[_0x4017('0xcf')];ami[_0x4017('0x41')](_0x4017('0x1a9'),ut[_0x4017('0x110')](_0x3a7dd2,'congestion'));hopperUtils[_0x4017('0xc2')](_0x1ad5f6)[_0x4017('0x9e')](loggerCatch(_0x4017('0x1aa')));if(_0x2d4fe8[_0x4017('0x187')](0x8,_0x3a7dd2,_0x2a8786)&&!_0x524292){if(_0x1ad5f6[_0x4017('0x188')]>=_0x2a8786['dialCongestionMaxRetry']){_0x2d4fe8[_0x4017('0x11e')](_0x1ad5f6,_0x1c5871,_0x517f0a,_0x4017('0x1ab'));}else{_0x2d4fe8['stateGlobal'](_0x1ad5f6,_0x1c5871,_0x517f0a,'reason\x208\x20congestion');}}break;case'11':_0x2a8786[_0x4017('0x1ac')]+=0x1;_0x1ad5f6[_0x4017('0x6e')]=0xb;_0x1ad5f6[_0x4017('0xca')]=_0x4017('0xdd');_0x1ad5f6[_0x4017('0xdf')]+=0x1;_0x1ad5f6['countglobal']+=0x1;_0xd51175=_0x2a8786['dialAbandonedRetryFrequency'];_0x19fb2a=_0x2a8786['callAdditionalPhoneAfterMin'];hopperUtils[_0x4017('0xc2')](_0x1ad5f6)[_0x4017('0x9e')](loggerCatch(_0x4017('0xe4')));if(_0x2d4fe8[_0x4017('0x187')](0xb,_0x3a7dd2,_0x2a8786)&&!_0x524292){if(_0x1ad5f6[_0x4017('0xdf')]>=_0x2a8786[_0x4017('0x195')]){_0x2d4fe8['createStateFinal'](_0x1ad5f6,_0x1c5871,_0x517f0a,_0x4017('0x1ad'));}else{_0x2d4fe8[_0x4017('0x11c')](_0x1ad5f6,_0x1c5871,_0x517f0a,_0x4017('0x1ad'));}}break;case'20':_0x2a8786[_0x4017('0x1ae')]+=0x1;_0x1ad5f6['state']=0x14;_0x1ad5f6[_0x4017('0xca')]=_0x4017('0x1af');_0x1ad5f6['countagentrejectretry']+=0x1;_0x1ad5f6[_0x4017('0xce')]+=0x1;_0xd51175=_0x2a8786[_0x4017('0x1b0')];_0x19fb2a=_0x2a8786[_0x4017('0xcf')];ami[_0x4017('0x41')](_0x4017('0x1b1'),ut[_0x4017('0x110')](_0x3a7dd2,'agentreject'));hopperUtils[_0x4017('0xc2')](_0x1ad5f6)['catch'](loggerCatch(_0x4017('0x1b2')));if(_0x2d4fe8[_0x4017('0x187')](0x14,_0x3a7dd2,_0x2a8786)&&!_0x524292){if(_0x1ad5f6[_0x4017('0x11b')]>=_0x2a8786[_0x4017('0x1b3')]){_0x2d4fe8[_0x4017('0x11e')](_0x1ad5f6,_0x1c5871,_0x517f0a,'reason\x2020\x20agentreject');}else{_0x2d4fe8[_0x4017('0x11c')](_0x1ad5f6,_0x1c5871,_0x517f0a,_0x4017('0x1b4'));}}break;default:_0x2a8786[_0x4017('0x1b5')]+=0x1;_0x1ad5f6['state']=0xc;_0x1ad5f6[_0x4017('0xca')]=_0xa122fa[_0x4017('0x199')];_0xd51175=_0x2a8786[_0x4017('0x1b0')];_0x19fb2a=_0x2a8786[_0x4017('0xcf')];hopperUtils[_0x4017('0xc2')](_0x1ad5f6)[_0x4017('0x9e')](loggerCatch(_0x4017('0x1b6')));if(_0x2d4fe8[_0x4017('0x187')](_0xa122fa['reason'],_0x3a7dd2,_0x2a8786)&&!_0x524292){if(_0x1ad5f6[_0x4017('0x117')]+_0x1ad5f6[_0x4017('0x188')]+_0x1ad5f6[_0x4017('0x118')]+_0x1ad5f6[_0x4017('0x124')]+_0x1ad5f6['countdropretry']+_0x1ad5f6[_0x4017('0xdf')]+_0x1ad5f6[_0x4017('0x11a')]+_0x1ad5f6[_0x4017('0x11b')]>=_0x2a8786[_0x4017('0x125')]){_0x2d4fe8['stateGlobal'](_0x1ad5f6,_0x1c5871,_0x517f0a,_0xa122fa['reason']);}else{_0x2d4fe8[_0x4017('0x11e')](_0x1ad5f6,_0x1c5871,_0x517f0a,_0xa122fa[_0x4017('0x199')]);}}}})[_0x4017('0x3f')](function(){if(_0x524292){hopperUtils[_0x4017('0x1b7')](_0x1ad5f6,_0xd51175,_0x19fb2a)['then'](function(){return _0x1c5871(0x1);});}});});};Dialer['prototype']['stateGlobal']=function(_0x1fcfd4,_0x37e951,_0x25c79e,_0x43c8fc){var _0x461c31=new Final(_0x1fcfd4);_0x461c31[_0x4017('0x6e')]=0xf;_0x461c31[_0x4017('0xca')]=_0x4017('0x1b8');this[_0x4017('0x11e')](_0x461c31,_0x37e951,_0x25c79e,_0x43c8fc);};Dialer['prototype'][_0x4017('0x11e')]=function(_0x495fbb,_0x13b576,_0x577e5b,_0x28bbe9){hopperUtils[_0x4017('0xc4')](_0x495fbb)[_0x4017('0x3f')](function(){return _0x13b576(msgResponse(_0x4017('0x1b9'),_0x4017('0x101'),_0x28bbe9));})[_0x4017('0x9e')](function(){return _0x577e5b(msgResponse(_0x4017('0x1ba'),_0x4017('0x90'),_0x4017('0x1bb')));});};Dialer[_0x4017('0x18')]['predictive']=function(_0x1bc8d9){var _0x5271ef=_0x1bc8d9[_0x4017('0x1bc')]/0x64;var _0xd4c92e=_0x1bc8d9[_0x4017('0xc8')]/(_0x1bc8d9[_0x4017('0xc8')]+_0x1bc8d9[_0x4017('0x10a')]);var _0x5744ce=Math[_0x4017('0x1bd')](_0x1bc8d9[_0x4017('0x1be')]*(_0x1bc8d9[_0x4017('0x1bf')]/0x64));var _0x5bfe94=Math[_0x4017('0x1bd')](_0x1bc8d9[_0x4017('0x1be')]*(_0x1bc8d9['predictiveIntervalMinThreshold']/0x64));var _0x44ca16=_0x1bc8d9[_0x4017('0x134')]+_0x1bc8d9['talking'];var _0x42afae=Math[_0x4017('0x1c0')](_0x1bc8d9[_0x4017('0x1c1')]*_0x1bc8d9[_0x4017('0x5b')]*_0x1bc8d9[_0x4017('0x1c2')]*_0x1bc8d9[_0x4017('0x1c3')]);if(_['isUndefined'](_0x1bc8d9[_0x4017('0x27')])){if(!_[_0x4017('0x52')](_0x1bc8d9[_0x4017('0x26')])){_0x1bc8d9['startPredictive']=undefined;loggerPredictive[_0x4017('0x65')](_0x4017('0x1c4'),_0x4017('0x1c5'));}if(!_[_0x4017('0x52')](_0x1bc8d9[_0x4017('0x63')])){loggerPredictive[_0x4017('0x65')]('[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x1bc8d9[_0x4017('0x63')]);_0x1bc8d9[_0x4017('0x63')]=undefined;}_0x1bc8d9['startProgressive']=moment()[_0x4017('0x46')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x4017('0x4a')](_0x1bc8d9[_0x4017('0x48')],_0x4017('0x1c6'),_0x1bc8d9[_0x4017('0x27')]);this[_0x4017('0xad')](_0x1bc8d9,0x1);}else if(ifInterval(_0x1bc8d9[_0x4017('0x1c7')],_0x1bc8d9[_0x4017('0x27')])){this[_0x4017('0xad')](_0x1bc8d9,0x1);loggerPredictiveCalls[_0x4017('0x4a')]('[startMethodPredictive][StartProgressive][Loop]',_0x1bc8d9[_0x4017('0x27')],_0x1bc8d9[_0x4017('0x48')]);_0x1bc8d9[_0x4017('0x1c1')]=0x0;_0x1bc8d9[_0x4017('0xc9')]=0x0;}else if(_0x5271ef<_0xd4c92e&&_0x1bc8d9[_0x4017('0x1c8')]===_0x4017('0x1c9')){clearPredictiveAttributes(_0x1bc8d9);loggerPredictive[_0x4017('0x4a')](_0x4017('0x1ca'),_0x4017('0x1cb'),_0xd4c92e,'startProgressive',_0x1bc8d9[_0x4017('0x48')]);}else if(_0x42afae<_0x1bc8d9[_0x4017('0xc9')]&&_0x1bc8d9['dialPredictiveOptimization']===_0x4017('0x1c9')){clearPredictiveAttributes(_0x1bc8d9);loggerPredictive[_0x4017('0x4a')](_0x4017('0x1cc'),'Max\x20Drop\x20',_0x42afae,_0x4017('0x1cd'),_0x1bc8d9['predictiveIntervalErlangCallsDroppedCalls'],_0x4017('0x27'),_0x1bc8d9[_0x4017('0x48')]);}else if(!ifInterval(_0x1bc8d9[_0x4017('0x1c7')],_0x1bc8d9['startProgressive'])&&_[_0x4017('0x52')](_0x1bc8d9[_0x4017('0x26')])&&!_[_0x4017('0x52')](_0x1bc8d9[_0x4017('0x27')])){_0x1bc8d9[_0x4017('0x26')]=moment()[_0x4017('0x46')](_0x4017('0xbf'));loggerPredictive[_0x4017('0x4a')](_0x1bc8d9[_0x4017('0x48')],'started\x20in\x20predictive\x20at',_0x1bc8d9[_0x4017('0x26')]);hopperUtils['avgHandleTime'](_0x1bc8d9[_0x4017('0x1c7')])[_0x4017('0x3f')](this[_0x4017('0x1ce')](_0x1bc8d9))[_0x4017('0x3f')](mergeDataErlangB(_0x1bc8d9))['then'](this[_0x4017('0x1cf')](_0x1bc8d9))[_0x4017('0x9e')](loggerCatchPredictive(_0x4017('0x1d0'),_0x1bc8d9));}else if(!ifInterval(_0x1bc8d9[_0x4017('0x1c7')],_0x1bc8d9[_0x4017('0x26')])){_0x1bc8d9[_0x4017('0xc9')]=0x0;_0x1bc8d9[_0x4017('0x26')]=moment()[_0x4017('0x46')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x4017('0x4a')](_0x1bc8d9['name'],'recalculate\x20predictive\x20at',_0x1bc8d9[_0x4017('0x26')]);clearInterval(_0x1bc8d9['handlePredictive']);_0x1bc8d9['handlePredictive']=undefined;hopperUtils[_0x4017('0x1d1')](_0x1bc8d9[_0x4017('0x1c7')])[_0x4017('0x3f')](this[_0x4017('0x1ce')](_0x1bc8d9))[_0x4017('0x3f')](mergeDataErlangB(_0x1bc8d9))[_0x4017('0x3f')](this[_0x4017('0x1cf')](_0x1bc8d9))[_0x4017('0x9e')](loggerCatchPredictive(_0x4017('0x1d2'),_0x1bc8d9));}else if(_0x1bc8d9[_0x4017('0x1be')]&&_0x44ca16<_0x1bc8d9[_0x4017('0x1be')]-_0x5bfe94){clearPredictiveAttributes(_0x1bc8d9);loggerPredictive['info'](_0x1bc8d9[_0x4017('0x48')],_0x4017('0x1d3'),_0x44ca16,')\x20are\x20less\x20than\x20threshold\x20(',_0x1bc8d9[_0x4017('0x1be')],'-',_0x5bfe94,'=',_0x1bc8d9[_0x4017('0x1be')]-_0x5bfe94,')');}else if(_0x1bc8d9[_0x4017('0x1be')]&&_0x44ca16>_0x1bc8d9[_0x4017('0x1be')]+_0x5744ce){clearPredictiveAttributes(_0x1bc8d9);loggerPredictive[_0x4017('0x4a')](_0x1bc8d9['name'],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x44ca16,')\x20are\x20more\x20than\x20threshold\x20(',_0x1bc8d9[_0x4017('0x1be')],'+',_0x5744ce,'=',_0x1bc8d9[_0x4017('0x1be')]+_0x5744ce,')');}};Dialer[_0x4017('0x18')][_0x4017('0x1ce')]=function(_0x290b09){var _0x338c1a=this;return function(_0x2f92ab){return new Promise(function(_0x172b82,_0x1ba2f4){_[_0x4017('0x5e')](_0x290b09,_0x2f92ab[0x0]);if(checkGetDataPredictive(_0x2f92ab[0x0])){var _0x59e6ad=_0x290b09[_0x4017('0x1be')]=_0x290b09[_0x4017('0x136')]+_0x290b09[_0x4017('0x134')];var _0x2ced4b=_0x290b09['dialPredictiveInterval']*0x3c;var _0x41d8d8=_0x2f92ab[0x0][_0x4017('0x51')]+_0x2f92ab[0x0][_0x4017('0x54')];var _0x1d084b=(_0x2f92ab[0x0][_0x4017('0x4d')]+_0x2f92ab[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x2f92ab[0x0][_0x4017('0x4f')])/_0x2f92ab[0x0][_0x4017('0x4c')];_0x290b09['predictiveIntervalHitRate']=_0x1d084b>0x0?_0x1d084b:0x1;switch(_0x290b09['dialPredictiveOptimization']){case _0x4017('0x1c9'):var _0x21e94e=_0x290b09[_0x4017('0x1bc')]/0x64;return _0x338c1a[_0x4017('0x1d4')](_0x59e6ad,_0x2ced4b,_0x41d8d8,_0x1d084b,_0x21e94e)[_0x4017('0x3f')](function(_0x264cd5){return _0x172b82(_0x264cd5);});case _0x4017('0x1d5'):var _0x2a5bea=_0x290b09[_0x4017('0x1bc')]/0x64;return _0x338c1a[_0x4017('0x1d6')](_0x59e6ad,_0x2ced4b,_0x41d8d8,_0x1d084b,_0x2a5bea)[_0x4017('0x3f')](function(_0x3df73f){return _0x172b82(_0x3df73f);});default:return _0x1ba2f4(msgResponse(_0x4017('0x1d7'),_0x4017('0x90'),_0x4017('0x1d8')));}}else{return _0x1ba2f4(msgResponse(_0x4017('0x1d7'),_0x4017('0x90'),_0x4017('0x1d9')));}});};};Dialer[_0x4017('0x18')][_0x4017('0x1da')]=function(_0x5eb043){var _0x303fc3=this;return function(_0xda0266){return new Promise(function(_0x2fc7a0,_0x4dd094){_[_0x4017('0x5e')](_0x5eb043,_0xda0266[0x0]);if(checkGetDataPredictive(_0xda0266[0x0])){loggerPredictive[_0x4017('0x4a')](JSON[_0x4017('0x74')](_0xda0266[0x0]));if(_0x5eb043[_0x4017('0x1c8')]==='dropRate'){return _0x303fc3[_0x4017('0x14b')](_0x5eb043['id'])['then'](function(_0x2a9c1e){var _0x104c80=_0x5eb043[_0x4017('0x1db')]-_0x2a9c1e[0x0][_0x4017('0x1dc')];var _0x59bb24=_0x5eb043[_0x4017('0x1c7')]*0x3c;var _0x1e1e2c=_0xda0266[0x0][_0x4017('0x51')]+_0xda0266[0x0][_0x4017('0x54')];var _0x53757d=(_0xda0266[0x0][_0x4017('0x4d')]+_0xda0266[0x0][_0x4017('0xc7')]+_0xda0266[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0xda0266[0x0][_0x4017('0x4c')];var _0x59b8fa=_0x5eb043['dialPredictiveOptimizationPercentage']/0x64;_0x5eb043['predictiveIntervalPauses']=_0x2a9c1e[0x0][_0x4017('0x1dc')]||0x0;_0x5eb043[_0x4017('0x1c2')]=_0x53757d>0x0?_0x53757d:0x1;return _0x303fc3[_0x4017('0x1d4')](_0x104c80,_0x59bb24,_0x1e1e2c,_0x53757d,_0x59b8fa);})[_0x4017('0x3f')](function(_0x30b340){return _0x2fc7a0(_0x30b340);})[_0x4017('0x9e')](function(_0x207f86){return _0x4dd094(msgResponse(_0x4017('0x1dd'),_0x4017('0x90'),JSON[_0x4017('0x74')](_0x207f86)));});}if(_0x5eb043['dialPredictiveOptimization']===_0x4017('0x1d5')){return _0x303fc3[_0x4017('0x14b')](_0x5eb043['id'])[_0x4017('0x3f')](function(_0x45e5bb){var _0x1b8535=_0x5eb043['loggedIn']-_0x45e5bb[0x0][_0x4017('0x1dc')];var _0x4ed111=_0x5eb043[_0x4017('0x1c7')]*0x3c;var _0x25dd68=_0xda0266[0x0][_0x4017('0x51')]+_0xda0266[0x0]['predictiveIntervalAvgHoldtime'];var _0xb59404=(_0xda0266[0x0][_0x4017('0x4d')]+_0xda0266[0x0][_0x4017('0xc7')]+_0xda0266[0x0][_0x4017('0x4f')])/_0xda0266[0x0]['predictiveIntervalTotalCalls'];var _0x11e460=_0x5eb043['dialPredictiveOptimizationPercentage']/0x64;_0x5eb043[_0x4017('0x1de')]=_0x45e5bb[0x0][_0x4017('0x1dc')]||0x0;_0x5eb043['predictiveIntervalHitRate']=_0xb59404>0x0?_0xb59404:0x1;return _0x303fc3['busyFactor'](_0x1b8535,_0x4ed111,_0x25dd68,_0xb59404,_0x11e460);})[_0x4017('0x3f')](function(_0x202b5a){return _0x2fc7a0(_0x202b5a);})[_0x4017('0x9e')](function(_0x3c1198){return _0x4dd094(msgResponse(_0x4017('0x1dd'),_0x4017('0x90'),JSON['stringify'](_0x3c1198)));});}}else{return _0x4dd094(msgResponse(_0x4017('0x1d7'),_0x4017('0x90'),'check\x20failure'));}});};};Dialer['prototype'][_0x4017('0x1cf')]=function(_0x58c668){var _0x38286b=this;return function(){var _0x42ee4a=0x0;var _0x3b4391=Math[_0x4017('0x1c0')](_0x58c668['erlangCallToSecond']*0x3e8);if(_0x3b4391>0x0){_0x3b4391=_0x3b4391<0x64?0x64:_0x3b4391;loggerPredictive[_0x4017('0x4a')](_0x58c668['name'],_0x4017('0x1df'),_0x3b4391,_0x4017('0x1e0'));_0x58c668[_0x4017('0x63')]=setInterval(function(){_0x38286b[_0x4017('0x63')](_0x58c668);loggerPredictiveCalls['info'](_0x4017('0x1e1'),_0x42ee4a+=0x1);},_0x3b4391);}else{loggerPredictive[_0x4017('0x4a')](_0x58c668['name'],'fail\x20to\x20scheduled\x20calls');}};};Dialer[_0x4017('0x18')][_0x4017('0x1e2')]=function(_0x5385e3,_0x1d13cf){var _0x26cba0=this;return function(_0x49cc77){if(_['isEmpty'](_0x49cc77)){if(_['isNil'](_0x1d13cf[_0x4017('0x151')])||!_0x1d13cf[_0x4017('0x1e3')]){if(_0x5385e3['dialMethod']===_0x4017('0xaf')){_0x5385e3['queueStatusComplete']=_[_0x4017('0x52')](_0x5385e3[_0x4017('0x72')])?!![]:_0x5385e3['queueStatusComplete'];var _0xb2ed41=uuid['v4']();_0x26cba0[_0x4017('0x22')][_0xb2ed41]=new Action(_0x5385e3,_0x1d13cf,_0xb2ed41);loggerBooked[_0x4017('0x4a')](_0x4017('0x1e4'),_0xb2ed41,_0x4017('0x1e5'),JSON[_0x4017('0x74')](_0x5385e3['queueStatusComplete']),_0x4017('0x1e6'),_0x5385e3[_0x4017('0x48')]);if(_0x5385e3[_0x4017('0x72')]){_0x5385e3[_0x4017('0x72')]=![];_0x26cba0[_0x4017('0x29')][_0x26cba0[_0x4017('0x22')][_0xb2ed41]['queue']]=[];ami[_0x4017('0x17d')]({'actionid':_0xb2ed41,'action':_0x4017('0x1e7'),'queue':_0x5385e3['name']})[_0x4017('0x9e')](function(){_0x26cba0[_0x4017('0xbd')](_0x5385e3);hopperUtils[_0x4017('0xe0')]({'active':![],'ContactId':_0x26cba0[_0x4017('0x22')][_0xb2ed41][_0x4017('0xd7')],'ListId':_0x26cba0[_0x4017('0x22')][_0xb2ed41][_0x4017('0xd8')],'VoiceQueueId':_0x26cba0['actions'][_0xb2ed41][_0x4017('0xd9')]||undefined,'CampaignId':_0x26cba0['actions'][_0xb2ed41][_0x4017('0xe2')]||undefined})['catch'](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x26cba0[_0x4017('0x22')][_0xb2ed41];});}else{loggerBooked[_0x4017('0x4a')](_0x4017('0x1e8'),JSON[_0x4017('0x74')](_0x5385e3[_0x4017('0x72')]),_0x4017('0x1e6'),_0x5385e3[_0x4017('0x48')]);_0x26cba0[_0x4017('0xbd')](_0x5385e3);hopperUtils[_0x4017('0xe0')]({'active':![],'ContactId':_0x26cba0[_0x4017('0x22')][_0xb2ed41]['ContactId'],'ListId':_0x26cba0[_0x4017('0x22')][_0xb2ed41]['ListId'],'VoiceQueueId':_0x26cba0[_0x4017('0x22')][_0xb2ed41][_0x4017('0xd9')]||undefined,'CampaignId':_0x26cba0[_0x4017('0x22')][_0xb2ed41][_0x4017('0xe2')]||undefined})['catch'](loggerCatch(_0x4017('0x1e9')));delete _0x26cba0['actions'][_0xb2ed41];}}else{return _0x26cba0['actionOriginate'](_0x5385e3,_0x1d13cf);}}else{if(utils[_0x4017('0x5f')](undefined,_0x1d13cf['scheduledat'])<_0x5385e3[_0x4017('0x1ea')]*0x3c){if(_0x1d13cf[_0x4017('0x143')]&&!_0x1d13cf[_0x4017('0x143')][_0x4017('0x1eb')]){_0x26cba0[_0x4017('0xf0')][_0x4017('0xf1')](_0x1d13cf['id'])[_0x4017('0xf4')](function(){_0x26cba0['updateOriginated'](_0x5385e3);});}else{hopperUtils[_0x4017('0x1ec')]({'active':![]},_0x1d13cf['id'],0x1)[_0x4017('0xf4')](function(){_0x26cba0['updateOriginated'](_0x5385e3);});}}else{_0x5385e3[_0x4017('0x1ed')]+=0x1;_0x26cba0['updateOriginated'](_0x5385e3);if(_0x5385e3[_0x4017('0x1ee')]){hopperUtils[_0x4017('0xe0')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x1d13cf['ContactId'],'ListId':_0x1d13cf['ListId'],'VoiceQueueId':_0x1d13cf[_0x4017('0xd9')]||undefined,'CampaignId':_0x1d13cf[_0x4017('0xe2')]||undefined})[_0x4017('0x9e')](loggerCatch(_0x4017('0x1ef')));hopperUtils[_0x4017('0xc2')](createObjHistory(_0x5385e3,_0x1d13cf,utils['CAMPAIGN_STATUS'][_0x4017('0x1f0')],0x17,'RecallInQueue'))[_0x4017('0x9e')](loggerCatch(_0x4017('0x1f1')));}else{_0x26cba0[_0x4017('0x111')](createObjHistory(_0x5385e3,_0x1d13cf,utils['CAMPAIGN_STATUS'][_0x4017('0x1f2')],0x16,_0x4017('0x1f3')),'[Originate][HistoryRecallClose][historyCatch]',_0x4017('0x1f4'));}}}}else{_0x5385e3[_0x4017('0x1f5')]+=0x1;_0x26cba0[_0x4017('0x111')](createObjHistory(_0x5385e3,_0x1d13cf,utils[_0x4017('0x69')][_0x4017('0x1f6')],0xd,_0x4017('0x1f7')),_0x4017('0x1f8'),_0x4017('0x1f9'));throw _0x4017('0x1fa');}};};Dialer['prototype'][_0x4017('0x154')]=function(_0x44fca0){var _0x50ad85=this;var _0x25cc40=_0x44fca0[_0x4017('0x1fb')]-_0x44fca0[_0x4017('0x14c')];emitCampaignSummary(_0x44fca0);if(_0x25cc40>0x0&&_0x44fca0[_0x4017('0x1fc')]==0x0){if(_0x25cc40>this['maxNumberOriginate']){_0x25cc40=this[_0x4017('0x20')];}_0x44fca0[_0x4017('0x1fc')]=0x1;hopperUtils[_0x4017('0x1fd')](_0x44fca0,_0x25cc40)[_0x4017('0x3f')](function(_0x1b60e5){_0x44fca0[_0x4017('0x1fc')]=0x0;if(_0x1b60e5){if(!utils[_0x4017('0x1fe')](_0x1b60e5)){_0x44fca0[_0x4017('0x68')]=utils['CAMPAIGN_STATUS']['NO_AVAILABLE_CONTACTS'];logger['info'](_0x4017('0x1ff')+_0x44fca0['name']);}else{_0x44fca0[_0x4017('0x14c')]+=_0x1b60e5[_0x4017('0x97')];_0x44fca0['message']=utils[_0x4017('0x69')][_0x4017('0x200')];for(var _0x3f4e84=0x0;_0x3f4e84<_0x1b60e5[_0x4017('0x97')];_0x3f4e84+=0x1){_0x44fca0['ivrTotalCallsDays']+=0x1;if(_[_0x4017('0xe9')](_0x1b60e5[_0x3f4e84])||_[_0x4017('0xe9')](_0x1b60e5[_0x3f4e84][_0x4017('0x171')])||_[_0x4017('0xe9')](_0x1b60e5[_0x3f4e84][_0x4017('0x159')])){_0x50ad85['emptyContact']('[actionOriginate]\x20',_0x44fca0,_0x1b60e5[_0x3f4e84]);}else{hopperUtils[_0x4017('0x201')](_[_0x4017('0x75')](_0x1b60e5[_0x3f4e84],[_0x4017('0xe2'),'phone']))[_0x4017('0x3f')](_0x50ad85['checkContactBlack'](_0x44fca0,_0x1b60e5[_0x3f4e84]))[_0x4017('0x9e')](_0x50ad85[_0x4017('0x14f')](_0x4017('0x202'),_0x44fca0));}}}}})[_0x4017('0x9e')](loggerGetContactDialer(_0x4017('0x203'),_0x44fca0,_0x25cc40));}};Dialer['prototype']['handlePower']=function(_0x5dda86,_0x252821){var _0x67ae1c=this;var _0x37c075=[];if(_0x252821<0x1||_0x5dda86['dialMethod']==='booked'){_0x252821=0x1;}var _0x10ed0f=Math[_0x4017('0x1c0')](_0x5dda86[_0x4017('0x134')]*_0x252821)-_0x5dda86[_0x4017('0x14c')];if(_0x5dda86[_0x4017('0x204')]>0x0){var _0x48b0cb=_0x5dda86[_0x4017('0x204')]-_0x5dda86[_0x4017('0x14c')]-_0x5dda86[_0x4017('0x136')]-_0x5dda86[_0x4017('0x137')];if(_0x10ed0f>_0x48b0cb){_0x10ed0f=_0x48b0cb;}}if(_0x10ed0f>0x0&&_0x5dda86[_0x4017('0x1fc')]==0x0){if(_0x5dda86[_0x4017('0xac')]==='booked'){_0x10ed0f=0x1;}if(_0x10ed0f>this[_0x4017('0x20')]){_0x10ed0f=this[_0x4017('0x20')];}for(var _0x369930 in this[_0x4017('0x1e')]){if(typeof this[_0x4017('0x1e')][_0x369930]!==_0x4017('0x148')){if(this[_0x4017('0x1e')][_0x369930]['state']==='not_inuse'&&this['agents'][_0x369930][_0x4017('0x86')]===_0x4017('0x141')){_0x37c075['push'](this[_0x4017('0x1e')][_0x369930]['id']);}}}_0x5dda86[_0x4017('0x1fc')]=0x1;hopperUtils[_0x4017('0x205')](_0x5dda86,_0x37c075,_0x10ed0f)[_0x4017('0x3f')](function(_0x3c72e5){_0x5dda86[_0x4017('0x1fc')]=0x0;if(_0x3c72e5){if(!utils['checkContactEmpty'](_0x3c72e5)){hopperUtils[_0x4017('0x206')](_0x5dda86)['then'](sendMessageReschedule(_0x5dda86))[_0x4017('0x9e')](loggerCatch('[countReScheduled]\x20'));}else{_0x5dda86['originated']+=_0x3c72e5['length'];_0x5dda86[_0x4017('0x68')]=_0x5dda86[_0x4017('0xac')]===_0x4017('0xaf')?utils[_0x4017('0x69')][_0x4017('0x163')]:utils[_0x4017('0x69')][_0x4017('0x200')];for(var _0x242395=0x0;_0x242395<_0x3c72e5[_0x4017('0x97')];_0x242395+=0x1){if(_['isNil'](_0x3c72e5[_0x242395])||_['isNil'](_0x3c72e5[_0x242395][_0x4017('0x171')])||_['isNil'](_0x3c72e5[_0x242395][_0x4017('0x159')])){_0x67ae1c[_0x4017('0x150')](_0x4017('0x207'),_0x5dda86,_0x3c72e5[_0x242395]);}else{hopperUtils[_0x4017('0x208')](_[_0x4017('0x75')](_0x3c72e5[_0x242395],[_0x4017('0xd9'),'phone']))[_0x4017('0x3f')](_0x67ae1c['checkContactBlack'](_0x5dda86,_0x3c72e5[_0x242395]))[_0x4017('0x9e')](_0x67ae1c[_0x4017('0x14f')]('[actionOriginate]\x20',_0x5dda86));}}}}})[_0x4017('0x9e')](loggerGetContactDialer('[getContactDialer2]',_0x5dda86,_0x10ed0f));}};Dialer['prototype']['handlePredictive']=function(_0x3d6adc){if(_0x3d6adc[_0x4017('0x204')]>0x0){var _0x47b8b5=_0x3d6adc[_0x4017('0x204')]-_0x3d6adc[_0x4017('0x14c')]-_0x3d6adc['talking'];if(_0x47b8b5>0x0&&_0x3d6adc[_0x4017('0x1fc')]==0x0){this[_0x4017('0x209')](_0x3d6adc);}else{loggerPredictiveCalls[_0x4017('0x4a')](_0x4017('0x20a'));}}else{this[_0x4017('0x209')](_0x3d6adc);}};Dialer[_0x4017('0x18')][_0x4017('0x209')]=function(_0x24353f){var _0x4f9bc8=this;var _0x395b5b=[];_0x24353f[_0x4017('0x14c')]+=0x1;for(var _0x5633c4 in this[_0x4017('0x1e')]){if(typeof this[_0x4017('0x1e')][_0x5633c4]!=='undefined'){if(this[_0x4017('0x1e')][_0x5633c4][_0x4017('0x6e')]==='not_inuse'&&this['agents'][_0x5633c4][_0x4017('0x86')]==='reachable'){_0x395b5b[_0x4017('0x9f')](this[_0x4017('0x1e')][_0x5633c4]['id']);}}}_0x24353f[_0x4017('0x1fc')]=0x1;return this['getContactDialer'](_0x24353f['id'],_0x395b5b,0x1,_0x24353f[_0x4017('0x20b')],_0x24353f)['then'](function(_0x2a0b4f){_0x24353f[_0x4017('0x1fc')]=0x1;if(_0x2a0b4f){if(!utils[_0x4017('0x1fe')](_0x2a0b4f)){utils['checkContactLowerLimitOriginate'](_0x24353f,0x1,0x0);return hopperUtils[_0x4017('0x206')](_0x24353f)[_0x4017('0x3f')](sendMessageReschedule(_0x24353f))[_0x4017('0x9e')](loggerCatch(_0x4017('0x20c')));}else{_0x24353f['message']=utils[_0x4017('0x69')][_0x4017('0x200')];if(_[_0x4017('0xe9')](_0x2a0b4f[0x0])||_['isNil'](_0x2a0b4f[0x0][_0x4017('0x171')])||_[_0x4017('0xe9')](_0x2a0b4f[0x0]['phone'])){_0x4f9bc8[_0x4017('0x150')](_0x4017('0x207'),_0x24353f,_0x2a0b4f[0x0]);}else{return hopperUtils['checkIsBlackList'](_[_0x4017('0x75')](_0x2a0b4f[0x0],[_0x4017('0xd9'),_0x4017('0x159')]))['then'](_0x4f9bc8[_0x4017('0x1e2')](_0x24353f,_0x2a0b4f[0x0]))['catch'](_0x4f9bc8[_0x4017('0x14f')](_0x4017('0x20d'),_0x24353f));}}}})['catch'](loggerGetContactDialer('[getContactDialerPredictive]',_0x24353f,0x1));};Dialer[_0x4017('0x18')][_0x4017('0x1d4')]=function(_0x1d70e1,_0x39b77c,_0x236d10,_0xc5cd90,_0x590538,_0x28fc6e){loggerPredictive['info'](_0x4017('0x20e'));loggerPredictive['info'](_0x4017('0x20f'),_0x1d70e1);loggerPredictive['info'](_0x4017('0x210'),_0x39b77c);loggerPredictive[_0x4017('0x4a')](_0x4017('0x211'),_0x236d10);loggerPredictive[_0x4017('0x4a')](_0x4017('0x212'),_0xc5cd90);loggerPredictive[_0x4017('0x4a')]('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x590538);loggerPredictive['info'](_0x4017('0x213'));return new Promise(function(_0x3c0a0f,_0x47256e){if(_0x1d70e1<=0x0||isNaN(_0x1d70e1)){return _0x47256e(msgResponse(_0x4017('0x214'),_0x4017('0x83'),'m\x20=\x20'+_0x1d70e1));}if(_0x236d10<=0x0||isNaN(_0x236d10)){return _0x47256e(msgResponse(_0x4017('0x214'),_0x4017('0x83'),'Ts\x20=\x20'+_0x236d10));}if(_0xc5cd90<=0x0||isNaN(_0xc5cd90)){return _0x47256e(msgResponse(_0x4017('0x214'),_0x4017('0x83'),'p\x20=\x20'+_0xc5cd90));}if(_0x39b77c<=0x0||isNaN(_0x39b77c)){return _0x47256e(msgResponse('[abandonmentRate]','Error',_0x4017('0x215')+_0x39b77c));}if(_0x590538<=0x0||isNaN(_0x590538)){return _0x47256e(msgResponse(_0x4017('0x214'),_0x4017('0x83'),'Amax\x20=\x20'+_0x590538));}_0x28fc6e=_0x28fc6e||0x0;var _0x19e6ed=0x1/_0x236d10;var _0x421e40=0x0;var _0xef8bbf=0x0;var _0x5497e3=0x0;var _0x525fbb=0x0;for(var _0xb1fd15=0x0;_0x5497e3<_0x590538;_0xb1fd15+=0x1){_0xef8bbf=_0xb1fd15/_0x39b77c;_0x421e40=(_0xc5cd90*_0xef8bbf+_0x28fc6e)/_0x19e6ed;_0x5497e3=utils['erlangb'](_0x421e40,_0x1d70e1);_0x525fbb=_0x421e40/_0x1d70e1*(0x1-utils[_0x4017('0x216')](_0x421e40,_0x1d70e1));}return _0x3c0a0f({'erlangCalls':_0xb1fd15,'erlangCallToSecond':_0x39b77c/_0xb1fd15,'erlangAbandonmentRate':_0x5497e3,'erlangBusyFactor':_0x525fbb});});};Dialer[_0x4017('0x18')][_0x4017('0x1d6')]=function(_0x3b7f3e,_0x87c21d,_0x62086c,_0x53e205,_0x432b48,_0x2f6d79){loggerPredictive[_0x4017('0x4a')](_0x4017('0x217'));loggerPredictive[_0x4017('0x4a')]('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',_0x3b7f3e);loggerPredictive[_0x4017('0x4a')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x87c21d);loggerPredictive['info'](_0x4017('0x211'),_0x62086c);loggerPredictive[_0x4017('0x4a')](_0x4017('0x212'),_0x53e205);loggerPredictive[_0x4017('0x4a')](_0x4017('0x218'),_0x432b48);loggerPredictive['info'](_0x4017('0x213'));return new Promise(function(_0x170cab,_0x1df8cb){if(_0x3b7f3e<=0x0||isNaN(_0x3b7f3e)){return _0x1df8cb(msgResponse(_0x4017('0x219'),_0x4017('0x83'),_0x4017('0x21a')+_0x3b7f3e));}if(_0x62086c<=0x0||isNaN(_0x62086c)){return _0x1df8cb(msgResponse('[busyFactor]',_0x4017('0x83'),'Ts\x20=\x20'+_0x62086c));}if(_0x53e205<=0x0||isNaN(_0x53e205)){return _0x1df8cb(msgResponse(_0x4017('0x219'),_0x4017('0x83'),_0x4017('0x21b')+_0x53e205));}if(_0x87c21d<=0x0||isNaN(_0x87c21d)){return _0x1df8cb(msgResponse(_0x4017('0x219'),_0x4017('0x83'),_0x4017('0x215')+_0x87c21d));}if(_0x432b48<=0x0||isNaN(_0x432b48)){return _0x1df8cb(msgResponse(_0x4017('0x219'),_0x4017('0x83'),_0x4017('0x21c')+_0x432b48));}_0x2f6d79=_0x2f6d79||0x0;var _0x4fe4bc=0x1/_0x62086c;var _0x5561e2=0x0;var _0x40f7c2=0x0;var _0x3c8eef=0x0;var _0x463fea=0x0;for(var _0x36ec56=0x0;_0x463fea<_0x432b48;_0x36ec56+=0x1){_0x40f7c2=_0x36ec56/_0x87c21d;_0x5561e2=(_0x53e205*_0x40f7c2+_0x2f6d79)/_0x4fe4bc;_0x3c8eef=utils[_0x4017('0x216')](_0x5561e2,_0x3b7f3e);_0x463fea=_0x5561e2/_0x3b7f3e*(0x1-utils['erlangb'](_0x5561e2,_0x3b7f3e));}return _0x170cab({'erlangCalls':_0x36ec56,'erlangCallToSecond':_0x87c21d/_0x36ec56,'erlangAbandonmentRate':_0x3c8eef,'erlangBusyFactor':_0x463fea});});};module[_0x4017('0x21d')]=Dialer; \ No newline at end of file +var _0x59c3=['[syncAgentComplete][createHistory][11]','syncNewExten','channel','actionid','strategy','rrmemory','isNil','locked','paused','stateinterface','queueBooked','roundrobin','idHopper','[Catch][Preview][syncQueueStatusComplete]','finally','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','run','[booked][RR][finaly]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','response','Success','callProgressDetecting','[callProgressDetecting]\x20','variable','amdstatus','exten','dialAMDActive','HANGUP','outboundAnswerAgiCallsDay','HangupInAMD','emit','custom:amd','amd','saveInDb','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','value','MACHINE','Machine','membername','AMD','buildObj','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countmachineretry','countagentrejectretry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','dialMachineRetryFrequency','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','countnosuchnumberretry','dialGlobalMaxRetry','[rescheduleContact][Machine]','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','cause-txt','outboundUnknownCallsDay','Unknow','running','isPreviewCampaign','statusMessage','getQueueCampaignStatusMessage','available','talking','pTalking','ACTIVE','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','[syncQueueSummary]','throttle','filter','dialPreviewRecallmeReminder','online','handlePreviewRecallNotifications','map','Agent','user:%s','checkPreviewRecallReminder','clearZombieChannels','No\x20such\x20channel','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','UserId','[emptyContact][createHistory]','[emptyContact]','[syncQueueCallerAbandon]\x20[Drop]','user:dialPreviewRecallReminder','handleIvr','actionOriginate','object','originate','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','isOutboundQueue','dialQueueOptions','dialQueueTimeout','dialAMDInitialSilence','XMD-AMDGREETING','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','setXMDContactVariables','Contact','getCallerId','Trunk','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','XMD-ORIGINATECALLERIDNUM','phone','variables','dialPrefix','trim','dialCutDigit','SIP/%s/%s%s','xcally-motion-dialer','from-sip','dialOriginateTimeout','OriginateError','[originate][error]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','outboundNoSuchCallsDay','NoSuchNumber','nosuchnumber','checkRetriveMax','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','buildNoAnswerEventPayload','custom:agentnoanswer','dialNoAnswerRetryFrequency','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','outboundDropCallsDayTimeout','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','round','predictiveIntervalMinThreshold','floor','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','avgHandleTime','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','agentBusyFactor','busyFactor','[getDataPredictive]','getDataPredictiveOld','loggedIn','predictiveIntervalPauses','outboundQueuePauses','abandonmentRate','[CatchErlangB]','check\x20failure','one\x20call\x20every:','[handlePredictive]','checkContactBlack','[booked][checkContactBlack]','queueStatusComplete:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','voicePause','unlockContact','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','inBlackList','limitCalls','getContactDialerIvr','checkContactEmpty','NO_AVAILABLE_CONTACTS','[getContactCampaign2][Empty]','ivrTotalCallsDays','emptyContact','checkIsBlackListIvr','[actionOriginateIvr]\x20','[getContactCampaign2]','not_inuse','[countReScheduled]\x20','RUNNING','checkIsBlackList','tryOriginatePredictive','[handlePredictive][limitChannel]','getContactDialer','countReScheduled','[actionOriginate]\x20','[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','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','m\x20=\x20','[abandonmentRate]','Ts\x20=\x20','interval\x20=\x20','erlangb','----\x20Agent\x20Busy\x20Factor\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','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','p\x20=\x20','exports','util','lodash','uuid','moment','ioredis','./utils','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictive','predictiveCalls','syncQueueSummary','../ami','defaults','localhost','socket.io-emitter','redis','../rpc/cmHopper','../rpc/voiceQueueRt','../rpc/setting','./models/action','./models/history','./models/final','./models/agentComplete','./models/queueCallerAbandon','./models/hangup','env','XCALLY_IP_AGI','127.0.0.1','prototype','enqueue','tail','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','startPredictive','ivrOriginated','queueBookedRR','queuesSummary','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','custom:queuesummarycomplete','syncQueueSummaryComplete','syncHangup','newexten','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','getSettings','isUndefined','type','outbound','format','voice:queue:%s','voice_queue:save','isEmpty','info','-----\x20Stats\x20Predictive\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','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','predictiveIntervalAvgHoldtime','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','merge','getSeconds','startProgressive','debug','name','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','stack','inspect','checkContactLowerLimitOriginate','temp','contactsRescheduled','message','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','contacts','statedesc','starttime','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','pick','Interval','NULL_INTERVAL','Intervals','\x20INTERVAL_IS_NULL','campaign:ivr:%s','campaign:save','sendMessageOneNotActive','originated','INACTIVE','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','DISACTIVED','is\x20disactive','[ifTime][Action]','Error','stringify','isTrunkReachable','active','status','reachable','SIP/%s','unmonitored','checkIsTrunkReachable','TrunkBackup','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','Failure','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','ifTime','\x20Intervals\x20is\x20empty\x20','UNKNOWN_TIMEZONE','isArray','length','Action','command','then','indexOf','true','catch','push','iftime\x20%s,%s','timezones','content','all','some','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','resetActiveCalls','syncCampaigns','undefined','isIVRCampaign','isIVRCampaignActive','resolve','dialGlobalInterval','dialTimezone','checkIfTimeIntervals','launchHandleIvr','[syncCampaigns]','checkDialMethod','dialMethod','handlePower','power','dialPowerLevel','Queue','method\x20not\x20recognized','silly','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','AMI\x20IfTime','queue','uniqueid','outboundAnswerCallsDay','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','createHistory','[syncAgentComplete][createHistory]','moveContactManagedDialer','[syncAgentComplete]','ivr','updateOriginated','droptime','YYYY-MM-DD\x20HH:mm:ss','responsetime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','state','Drop','dropreason','TIMEOUT','countglobal','dialDropRetryFrequency','voiceQueue','additional','countdropretry','dialDropMaxRetry','queueCallerAbandonCreateState','minutes','ContactId','VoiceQueueId','CampaignId','[rescheduleContact][Drop]','endtime','calleridnum','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','predictiveIntervalDroppedCallsCallersExit','outboundDropCallsDayCallersExit','CALLEREXIT','countabandonedretry','dialAbandonedRetryFrequency','callAdditionalPhoneAfterMin','verifyAdditionalPhones','dialAbandonedMaxRetry','rescheduleContact','add','ListId','[rescheduleContact][Abandoned]','Abandoned','calleridname'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x59c3,0x133));var _0x359c=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0x59c3[_0x138f59];return _0x3d114d;};'use strict';var util=require(_0x359c('0x0'));var _=require(_0x359c('0x1'));var uuid=require(_0x359c('0x2'));var moment=require(_0x359c('0x3'));var rr=require('rr');var Redis=require(_0x359c('0x4'));var utils=require(_0x359c('0x5'));var hopperUtils=require('./utils/hopper');var ut=require(_0x359c('0x6'));var config=require(_0x359c('0x7'));var logger=require(_0x359c('0x8'))(_0x359c('0x9'));var loggerBooked=require(_0x359c('0x8'))(_0x359c('0xa'));var loggerPredictive=require('../../../config/logger')(_0x359c('0xb'));var loggerPredictiveCalls=require('../../../config/logger')(_0x359c('0xc'));var loggerSyncQueueSummary=require(_0x359c('0x8'))(_0x359c('0xd'));var ami=require(_0x359c('0xe'));config['redis']=_[_0x359c('0xf')](config['redis'],{'host':_0x359c('0x10'),'port':0x18eb});var io=require(_0x359c('0x11'))(new Redis(config[_0x359c('0x12')]));var cmHopper=require(_0x359c('0x13'));var voiceQueueRt=require(_0x359c('0x14'));var RpcSetting=require(_0x359c('0x15'));var Interval=require('../rpc/interval');var Action=require(_0x359c('0x16'));var History=require(_0x359c('0x17'));var Final=require(_0x359c('0x18'));var AgentComplete=require(_0x359c('0x19'));var QueueCallerAbandon=require(_0x359c('0x1a'));var Hangup=require(_0x359c('0x1b'));var ipAgi=process[_0x359c('0x1c')][_0x359c('0x1d')]||_0x359c('0x1e');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x359c('0x1f')][_0x359c('0x20')]=function(_0xd07946){this['tail']=this[_0x359c('0x21')]?this[_0x359c('0x21')]['finally'](_0xd07946):_0xd07946();};function Dialer(_0x80b8d8,_0x186e45){this[_0x359c('0x22')]=new Sequence();this[_0x359c('0x23')]=_0x186e45;this[_0x359c('0x24')]=_0x80b8d8[_0x359c('0x24')];this[_0x359c('0x25')]=_0x80b8d8[_0x359c('0x25')];this[_0x359c('0x26')]=_0x80b8d8[_0x359c('0x26')];this[_0x359c('0x27')]=_0x80b8d8[_0x359c('0x27')];this[_0x359c('0x28')]=config[_0x359c('0x28')]||0x2;this[_0x359c('0x29')]={};this[_0x359c('0x2a')]={};this[_0x359c('0x2b')]={};this[_0x359c('0x2c')]={};this['optionPredictive']={};this[_0x359c('0x2d')]={};this['startProgressive']={};this[_0x359c('0x2e')]={};this['queueBooked']={};this[_0x359c('0x2f')]={};this[_0x359c('0x30')]={};ami['on'](_0x359c('0x31'),this[_0x359c('0x32')][_0x359c('0x33')](this));ami['on'](_0x359c('0x34'),this[_0x359c('0x35')][_0x359c('0x33')](this));ami['on'](_0x359c('0x36'),this[_0x359c('0x37')][_0x359c('0x33')](this));ami['on'](_0x359c('0x38'),this[_0x359c('0x39')][_0x359c('0x33')](this));ami['on'](_0x359c('0x3a'),this[_0x359c('0xd')]['bind'](this));ami['on'](_0x359c('0x3b'),this[_0x359c('0x3c')][_0x359c('0x33')](this));ami['on']('hangup',this[_0x359c('0x3d')][_0x359c('0x33')](this));ami['on'](_0x359c('0x3e'),this['syncNewExten'][_0x359c('0x33')](this));ami['on']('varset',this[_0x359c('0x3f')][_0x359c('0x33')](this));ami['on'](_0x359c('0x40'),this[_0x359c('0x41')]['bind'](this));ami['on'](_0x359c('0x42'),this[_0x359c('0x43')][_0x359c('0x33')](this));this[_0x359c('0x44')]();this[_0x359c('0x45')]();RpcSetting[_0x359c('0x46')]()['then'](function(_0x49a517){previewRecallmeReminderInterval=_0x49a517['previewRecallmeReminderInterval'];});}function isNotNull(_0x1aec6c){return _0x1aec6c!==null&&!_[_0x359c('0x47')](_0x1aec6c);}function msgResponse(_0x575a51,_0x11b370,_0x3b4ad4){return{'action':_0x575a51,'response':_0x11b370,'message':_0x3b4ad4,'stack':_0x3b4ad4};}function emit(_0x6b6340,_0x36704b,_0x44e313){io['to'](_0x6b6340)['emit'](_0x36704b,_0x44e313);}function emitOutboundVoiceQueueSummary(_0x25934a){if(_0x25934a[_0x359c('0x48')]===_0x359c('0x49')){logger['debug']('[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:',util['inspect'](_0x25934a,{'showHidden':![],'depth':null}));emit(util[_0x359c('0x4a')](_0x359c('0x4b'),_0x25934a['name']),_0x359c('0x4c'),_0x25934a);}}function checkGetDataPredictive(_0x3a8ca7){if(isNotNull(_0x3a8ca7)&&!_[_0x359c('0x4d')](_0x3a8ca7)){loggerPredictive[_0x359c('0x4e')](_0x359c('0x4f'));loggerPredictive[_0x359c('0x4e')]('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3a8ca7[_0x359c('0x50')]);loggerPredictive[_0x359c('0x4e')](_0x359c('0x51'),_0x3a8ca7[_0x359c('0x52')]);loggerPredictive[_0x359c('0x4e')](_0x359c('0x53'),_0x3a8ca7['predictiveIntervalDroppedCallsTimeout']);loggerPredictive[_0x359c('0x4e')]('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3a8ca7['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive[_0x359c('0x4e')](_0x359c('0x54'),_0x3a8ca7['predictiveIntervalAvgHoldtime']);loggerPredictive[_0x359c('0x4e')](_0x359c('0x55'),_0x3a8ca7[_0x359c('0x56')]);loggerPredictive[_0x359c('0x4e')]('---------------------------');if(_0x3a8ca7[_0x359c('0x50')]>0x0){if(!_[_0x359c('0x47')](_0x3a8ca7[_0x359c('0x56')])&&_0x3a8ca7['predictiveIntervalAvgTalktime']>0x0){return!![];}loggerPredictive[_0x359c('0x4e')]('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_[_0x359c('0x47')](_0x3a8ca7['predictiveIntervalAvgHoldtime'])&&_0x3a8ca7[_0x359c('0x57')]>0x0){return!![];}loggerPredictive[_0x359c('0x4e')]('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive['info'](_0x359c('0x58'));}}else{loggerPredictive[_0x359c('0x4e')](_0x359c('0x59'));}return![];}function mergeDataErlangB(_0x567c43){return function(_0x43b07d){loggerPredictive[_0x359c('0x4e')](_0x359c('0x5a'));loggerPredictive[_0x359c('0x4e')]('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x43b07d[_0x359c('0x5b')]);loggerPredictive[_0x359c('0x4e')](_0x359c('0x5c'),_0x43b07d[_0x359c('0x5d')]);loggerPredictive[_0x359c('0x4e')](_0x359c('0x5e'),_0x43b07d[_0x359c('0x5f')]);loggerPredictive[_0x359c('0x4e')](_0x359c('0x60'),_0x43b07d['erlangBusyFactor']);loggerPredictive[_0x359c('0x4e')](_0x359c('0x5e'),_0x43b07d[_0x359c('0x5f')]);loggerPredictive[_0x359c('0x4e')](_0x359c('0x61'));_[_0x359c('0x62')](_0x567c43,_0x43b07d);};}function ifInterval(_0x55f48a,_0x27301d){if(_['isUndefined'](_0x27301d)){return![];}return utils[_0x359c('0x63')](undefined,_0x27301d)<_0x55f48a*0x3c;}function clearPredictiveAttributes(_0x4aef1c){if(_0x4aef1c['startProgressive']){_0x4aef1c[_0x359c('0x64')]=undefined;loggerPredictive[_0x359c('0x65')](_0x4aef1c[_0x359c('0x66')],'startProgressive\x20value\x20cleared');}if(_0x4aef1c[_0x359c('0x2d')]){_0x4aef1c[_0x359c('0x2d')]=undefined;loggerPredictive[_0x359c('0x65')](_0x4aef1c['name'],_0x359c('0x67'));}if(_0x4aef1c[_0x359c('0x68')]){clearInterval(_0x4aef1c['handlePredictive']);_0x4aef1c[_0x359c('0x68')]=undefined;loggerPredictive[_0x359c('0x65')](_0x4aef1c['name'],_0x359c('0x69'));}}function loggerCatchPredictive(_0x2a6afb,_0x5ec033){return function(_0x5a0e76){loggerPredictive[_0x359c('0x6a')](_0x5ec033[_0x359c('0x66')],_0x2a6afb);loggerPredictive[_0x359c('0x6a')](_0x5a0e76[_0x359c('0x6b')]);clearPredictiveAttributes(_0x5ec033);};}function loggerCatch(_0x494cc9){return function(_0x58db2c){logger['error'](_0x494cc9,util[_0x359c('0x6c')](_0x58db2c,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x2a13b1,_0x12e055,_0x85e034){return function(_0x3d7ce1){utils[_0x359c('0x6d')](_0x12e055,_0x85e034,0x0);_0x12e055[_0x359c('0x6e')]=0x0;logger[_0x359c('0x6a')](_0x2a13b1,util[_0x359c('0x6c')](_0x3d7ce1,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x3e061e){return function(_0x5d332a){if(isNotNull(_0x5d332a)&&isNotNull(_0x5d332a[0x0])){if(_0x5d332a[0x0][_0x359c('0x6f')]>0x0){_0x3e061e[_0x359c('0x70')]=utils[_0x359c('0x71')][_0x359c('0x72')];logger[_0x359c('0x4e')](_0x359c('0x73')+_0x3e061e['name'],_0x5d332a[0x0]['contactsRescheduled'],_0x359c('0x74'));}else{_0x3e061e[_0x359c('0x70')]=utils[_0x359c('0x71')]['NO_AVAILABLE_CONTACTS'];logger[_0x359c('0x4e')]('[getContactDialer2][Empty]'+_0x3e061e['name']);}}};}function createObjHistory(_0x4490fc,_0x15f83f,_0x5df068,_0x1f7a7a,_0x1d2655){_0x4490fc['message']=_0x5df068;var _0x9ecd0a=new Action(_0x4490fc,_0x15f83f);var _0xc90ab9=new History(_0x9ecd0a);_0xc90ab9['state']=_0x1f7a7a;_0xc90ab9[_0x359c('0x75')]=_0x1d2655;_0xc90ab9['endtime']=_0x9ecd0a[_0x359c('0x76')];return _0xc90ab9;}function unlockQueueStatus(_0x11c5fd,_0x2a929f){setTimeout(function(){if(_['isUndefined'](_0x11c5fd[_0x359c('0x77')])){loggerBooked[_0x359c('0x6a')](_0x359c('0x78'),_0x2a929f);}_0x11c5fd[_0x359c('0x77')]=!![];loggerBooked[_0x359c('0x4e')](_0x359c('0x79'),_0x2a929f,JSON['stringify'](_[_0x359c('0x7a')](_0x11c5fd,[_0x359c('0x66'),'queueStatusComplete'])));},0x1f3);}function checkInterval(_0x215e6f){return function(){if(!isNotNull(_0x215e6f[_0x359c('0x7b')])){_0x215e6f[_0x359c('0x70')]=utils[_0x359c('0x71')][_0x359c('0x7c')];throw _0x215e6f[_0x359c('0x66')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x215e6f[_0x359c('0x7b')][_0x359c('0x7d')])){_0x215e6f[_0x359c('0x70')]=utils[_0x359c('0x71')]['NULL_INTERVAL'];throw _0x215e6f[_0x359c('0x66')]+_0x359c('0x7e');}if(!isNotNull(_['isEmpty'](_0x215e6f[_0x359c('0x7b')]['Intervals']))){_0x215e6f[_0x359c('0x70')]=utils['CAMPAIGN_STATUS']['NULL_INTERVAL'];throw _0x215e6f[_0x359c('0x66')]+_0x359c('0x7e');}};}function checkIsIVRCampaignActive(_0x4df8a0){return function(){if(!utils['isIVRCampaignActive'](_0x4df8a0)){_0x4df8a0[_0x359c('0x70')]=utils[_0x359c('0x71')]['INACTIVE'];throw _0x4df8a0[_0x359c('0x66')]+'\x20NOT\x20Active';}};}function emitCampaignSummary(_0x1d18d7){if(utils['isIVRCampaign'](_0x1d18d7)){emit(util['format'](_0x359c('0x7f'),_0x1d18d7[_0x359c('0x66')]),_0x359c('0x80'),_0x1d18d7);}}function loggerCatchQueueSummary(_0x3e6292,_0x4e129e){return function(_0x2e3f4e){clearPredictiveAttributes(_0x4e129e);emitCampaignSummary(_0x4e129e);loggerSyncQueueSummary[_0x359c('0x65')](_0x3e6292,util[_0x359c('0x6c')](_0x2e3f4e,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x58e3e2){if(_0x58e3e2[_0x359c('0x81')]){if(_0x58e3e2[_0x359c('0x82')]===0x0){_0x58e3e2[_0x359c('0x81')]=![];_0x58e3e2['message']=utils['CAMPAIGN_STATUS'][_0x359c('0x83')];loggerSyncQueueSummary[_0x359c('0x65')](_0x359c('0x84'),_0x58e3e2[_0x359c('0x66')],'is\x20not\x20active');}else{_0x58e3e2[_0x359c('0x70')]=utils[_0x359c('0x71')][_0x359c('0x85')];loggerSyncQueueSummary['debug'](_0x359c('0x84'),_0x58e3e2[_0x359c('0x66')],_0x359c('0x86'));}emitCampaignSummary(_0x58e3e2);}}function myreject(_0x32ae51){return function(_0xc950c7){return _0x32ae51(msgResponse(_0x359c('0x87'),_0x359c('0x88'),JSON[_0x359c('0x89')](_0xc950c7)));};}Dialer[_0x359c('0x1f')][_0x359c('0x8a')]=function(_0x450a04){return!_[_0x359c('0x47')](_0x450a04)&&_0x450a04&&!_['isUndefined'](_0x450a04[_0x359c('0x66')])&&!_[_0x359c('0x47')](_0x450a04[_0x359c('0x8b')])&&_0x450a04[_0x359c('0x8b')]&&(this['trunks'][util[_0x359c('0x4a')]('SIP/%s',_0x450a04['name'])][_0x359c('0x8c')]===_0x359c('0x8d')||this['trunks'][util['format'](_0x359c('0x8e'),_0x450a04[_0x359c('0x66')])][_0x359c('0x8c')]===_0x359c('0x8f'));};Dialer[_0x359c('0x1f')][_0x359c('0x90')]=function(_0x5d457a){var _0x13d0ab=this;return function(){if(!_0x13d0ab[_0x359c('0x8a')](_0x5d457a['Trunk'])){if(!_0x13d0ab[_0x359c('0x8a')](_0x5d457a[_0x359c('0x91')])){_0x5d457a[_0x359c('0x70')]=utils['CAMPAIGN_STATUS'][_0x359c('0x92')];throw _0x5d457a[_0x359c('0x66')]+_0x359c('0x93');}}};};Dialer[_0x359c('0x1f')][_0x359c('0x94')]=function(_0x466455,_0x1eeb45,_0x100980,_0x251eed){var _0x27c3f4=this;return function(){var _0x190ac9=!![];return _0x27c3f4[_0x359c('0x95')](_0x466455,_0x1eeb45,_0x100980,_0x251eed,_0x190ac9);};};Dialer[_0x359c('0x1f')]['checkIfTimeIntervals']=function(_0x14764d,_0x4c8a42,_0x10fab4,_0x9665b4){var _0x549ba6=this;return function(){var _0xbc2be2=![];return _0x549ba6[_0x359c('0x95')](_0x14764d[_0x359c('0x7d')],_0x4c8a42,_0x10fab4,_0x9665b4,_0xbc2be2);};};Dialer['prototype'][_0x359c('0x95')]=function(_0x19edf1,_0x5029f1,_0x16be8b,_0x11160b,_0x51f78a){var _0x54281f=[];return new Promise(function(_0x360193,_0x1f4ab2){if(!isNotNull(_0x19edf1)){_0x11160b['message']=utils[_0x359c('0x71')][_0x359c('0x7c')];return _0x1f4ab2(msgResponse('ifTime',_0x359c('0x96'),_0x16be8b+_0x359c('0x97')));}if(_[_0x359c('0x4d')](_0x19edf1)){_0x11160b[_0x359c('0x70')]=utils[_0x359c('0x71')][_0x359c('0x98')];return _0x1f4ab2(msgResponse(_0x359c('0x99'),_0x359c('0x96'),_0x16be8b+_0x359c('0x9a')));}if(_0x5029f1&&_[_0x359c('0x47')](config['timezones'][_0x5029f1])){_0x11160b[_0x359c('0x70')]=utils[_0x359c('0x71')][_0x359c('0x9b')];return _0x1f4ab2(msgResponse(_0x359c('0x99'),'Failure',_0x16be8b+'\x20Timezone\x20unknow\x20'+_0x5029f1));}if(_[_0x359c('0x9c')](_0x19edf1)){for(var _0x4748d6=0x0;_0x4748d6<_0x19edf1[_0x359c('0x9d')];_0x4748d6+=0x1){_0x54281f['push'](ami[_0x359c('0x9e')]({'action':_0x359c('0x9f'),'command':util[_0x359c('0x4a')]('iftime\x20%s,%s',_0x19edf1[_0x4748d6]['interval'],!_[_0x359c('0x47')](config['timezones'][_0x5029f1])?_0x5029f1:'')})[_0x359c('0xa0')](function(_0x4ae3be){return _0x4ae3be['content'][_0x359c('0xa1')](_0x359c('0xa2'))>=0x0;})[_0x359c('0xa3')](myreject(_0x1f4ab2)));}}else{_0x54281f[_0x359c('0xa4')](ami['Action']({'action':_0x359c('0x9f'),'command':util['format'](_0x359c('0xa5'),_0x19edf1,!_[_0x359c('0x47')](config[_0x359c('0xa6')][_0x5029f1])?_0x5029f1:'')})[_0x359c('0xa0')](function(_0x51f00f){return _0x51f00f[_0x359c('0xa7')][_0x359c('0xa1')](_0x359c('0xa2'))>=0x0;})[_0x359c('0xa3')](myreject(_0x1f4ab2)));}Promise[_0x359c('0xa8')](_0x54281f)[_0x359c('0xa0')](function(_0x308b5c){var _0x52c364=_[_0x359c('0xa9')](_0x308b5c);if(_0x52c364){return _0x360193(_0x52c364);}else{_0x11160b[_0x359c('0x70')]=_0x51f78a?utils[_0x359c('0x71')][_0x359c('0xaa')]:utils[_0x359c('0x71')][_0x359c('0xab')];return _0x1f4ab2(msgResponse('[ifTime][promiseAll]','Failure',_0x359c('0xac')+_0x51f78a+'\x20'+_0x16be8b+_0x359c('0xad')+util[_0x359c('0x6c')](_0x19edf1,{'showHidden':![],'depth':null})+_0x359c('0xae')+_0x5029f1));}})['catch'](function(_0xc15db3){return _0x1f4ab2(msgResponse('ifTime','Failure',JSON['stringify'](_0xc15db3)));});});};Dialer[_0x359c('0x1f')][_0x359c('0x44')]=function(){var _0x4670b1=this;return cmHopper[_0x359c('0xaf')]({'active':![]},{'where':{'active':!![]}})['then'](function(){setInterval(function(){_0x4670b1[_0x359c('0xb0')]();},0x3e8);});};Dialer['prototype'][_0x359c('0xb0')]=function(){var _0x2e9d85=this;var _0x4f8f7e;for(var _0x204e7c in this[_0x359c('0x25')]){if(typeof this[_0x359c('0x25')][_0x204e7c]!==_0x359c('0xb1')){_0x4f8f7e=this[_0x359c('0x25')][_0x204e7c];if(utils[_0x359c('0xb2')](_0x4f8f7e)&&utils[_0x359c('0xb3')](_0x4f8f7e)){_0x4f8f7e[_0x359c('0x81')]=!![];Promise[_0x359c('0xb4')]()['then'](checkIsIVRCampaignActive(_0x4f8f7e))[_0x359c('0xa0')](checkInterval(_0x4f8f7e))[_0x359c('0xa0')](_0x2e9d85[_0x359c('0x90')](_0x4f8f7e))[_0x359c('0xa0')](_0x2e9d85['checkIfTime'](_0x4f8f7e[_0x359c('0xb5')],_0x4f8f7e[_0x359c('0xb6')],_0x4f8f7e[_0x359c('0x66')],_0x4f8f7e))[_0x359c('0xa0')](_0x2e9d85[_0x359c('0xb7')](_0x4f8f7e[_0x359c('0x7b')],_0x4f8f7e[_0x359c('0xb6')],_0x4f8f7e['name'],_0x4f8f7e))[_0x359c('0xa0')](_0x2e9d85[_0x359c('0xb8')](_0x4f8f7e))[_0x359c('0xa3')](loggerCatchQueueSummary(_0x359c('0xb9'),_0x4f8f7e));}else{notSendMessagesCampaign(_0x4f8f7e);}}}};Dialer['prototype'][_0x359c('0xba')]=function(_0x1c2a75){if(_0x1c2a75['dialMethod']!==_0x359c('0xb')){clearPredictiveAttributes(_0x1c2a75);}switch(_0x1c2a75[_0x359c('0xbb')]){case'progressive':this[_0x359c('0xbc')](_0x1c2a75,0x1);break;case _0x359c('0xbd'):this[_0x359c('0xbc')](_0x1c2a75,_0x1c2a75[_0x359c('0xbe')]);break;case _0x359c('0xb'):this['predictive'](_0x1c2a75);break;case _0x359c('0xa'):this['handlePower'](_0x1c2a75,0x1);break;default:logger[_0x359c('0x6a')](_0x359c('0xbf'),_0x1c2a75['name'],_0x359c('0xc0'));}};Dialer['prototype'][_0x359c('0x99')]=function(_0x406457,_0x30207d){var _0x2149a2=_0x406457[_0x359c('0xb6')];var _0x381e12=_0x30207d?_0x406457[_0x359c('0xb5')]:_0x406457['Interval'][_0x359c('0x7d')];logger[_0x359c('0xc1')](_0x359c('0xc2'),_0x381e12,_0x2149a2,_0x406457['name'],util[_0x359c('0x4a')](_0x359c('0xc3'),_0x406457[_0x359c('0x66')],_0x406457['id']));var _0x54ed40=null;return Interval['intervalIftime'](_0x381e12,_0x2149a2)[_0x359c('0xa0')](function(_0x3c0a09){if(_0x3c0a09===!![]){return _0x3c0a09;}else{_0x406457[_0x359c('0x70')]=_0x30207d?utils[_0x359c('0x71')][_0x359c('0xaa')]:utils[_0x359c('0x71')]['OVERTIME_INTERVAL'];_0x54ed40=msgResponse('[ifTime][promiseAll]',_0x359c('0x96'),_0x359c('0xac')+_0x30207d+'\x20'+_0x406457[_0x359c('0x66')]+'\x20Interval\x20is\x20overtime:\x20'+util[_0x359c('0x6c')](_0x381e12,{'showHidden':![],'depth':null})+_0x359c('0xae')+_0x2149a2);}if(_0x54ed40!==null){logger[_0x359c('0xc1')](_0x359c('0xc4'),_0x54ed40);_0x54ed40['isGlobal']=_0x30207d;throw _0x54ed40;}})[_0x359c('0xa3')](function(_0x1be4c7){logger[_0x359c('0x6a')](_0x359c('0xc5'),_0x1be4c7);throw msgResponse('[ifTime][Action]','Error',util[_0x359c('0x6c')](_0x1be4c7,{'showHidden':![],'depth':null}));});};Dialer[_0x359c('0x1f')][_0x359c('0x32')]=function(_0x40cca3){if(this[_0x359c('0x24')][_0x40cca3[_0x359c('0xc6')]]){if(this[_0x359c('0x2c')][_0x40cca3['uniqueid']]&&this['uniqueId'][_0x40cca3[_0x359c('0xc7')]][_0x359c('0x48')]!=='ivr'){this['updateOriginated'](this[_0x359c('0x24')][_0x40cca3['queue']]);this[_0x359c('0x2c')][_0x40cca3[_0x359c('0xc7')]]['answertime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer[_0x359c('0x1f')][_0x359c('0x39')]=function(_0x4e59d7){var _0x3af687=this[_0x359c('0x2c')][_0x4e59d7['uniqueid']];if(this[_0x359c('0x24')][_0x4e59d7[_0x359c('0xc6')]]){if(_0x3af687&&_0x3af687[_0x359c('0x48')]!=='ivr'){delete this[_0x359c('0x2c')][_0x4e59d7[_0x359c('0xc7')]];this['voiceQueues'][_0x4e59d7[_0x359c('0xc6')]][_0x359c('0xc8')]+=0x1;var _0xc47102=new AgentComplete(_0x3af687,_0x4e59d7);if(_0x4e59d7[_0x359c('0xc9')]===_0x359c('0xca')){_0xc47102[_0x359c('0xcb')]=this[_0x359c('0x24')][_0x4e59d7['queue']][_0x359c('0xcc')]&&this[_0x359c('0x24')][_0x4e59d7[_0x359c('0xc6')]][_0x359c('0xcd')]?moment()[_0x359c('0x4a')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;}hopperUtils[_0x359c('0xce')](_0xc47102)[_0x359c('0xa3')](loggerCatch(_0x359c('0xcf')));hopperUtils[_0x359c('0xd0')](_0xc47102)[_0x359c('0xa3')](loggerCatch(_0x359c('0xd1')));}}};Dialer[_0x359c('0x1f')]['syncQueueCallerAbandon']=function(_0x5f1c46){var _0x3a27d7=this[_0x359c('0x2c')][_0x5f1c46[_0x359c('0xc7')]];var _0x43835d=this;var _0x252dbd=![];var _0x36972e;var _0x59db86;if(this[_0x359c('0x24')][_0x5f1c46[_0x359c('0xc6')]]){if(_0x3a27d7&&_0x3a27d7[_0x359c('0x48')]!==_0x359c('0xd2')){delete this[_0x359c('0x2c')][_0x5f1c46[_0x359c('0xc7')]];this[_0x359c('0xd3')](this['voiceQueues'][_0x5f1c46[_0x359c('0xc6')]]);_0x3a27d7[_0x359c('0xd4')]=moment()['format'](_0x359c('0xd5'));var _0x5e90a0=new QueueCallerAbandon(_0x3a27d7,_0x5f1c46);if(utils[_0x359c('0x63')](_0x3a27d7[_0x359c('0xd4')],_0x3a27d7[_0x359c('0xd6')])>=_0x3a27d7['dialQueueTimeout']){this[_0x359c('0x24')][_0x5f1c46[_0x359c('0xc6')]][_0x359c('0xd7')]+=0x1;this['voiceQueues'][_0x5f1c46[_0x359c('0xc6')]]['outboundDropCallsDayTimeout']+=0x1;this['voiceQueues'][_0x5f1c46[_0x359c('0xc6')]][_0x359c('0xd8')]+=0x1;_0x5e90a0[_0x359c('0xd9')]=0xa;_0x5e90a0[_0x359c('0x75')]=_0x359c('0xda');_0x5e90a0[_0x359c('0xdb')]=_0x359c('0xdc');_0x5e90a0[_0x359c('0xcb')]=this['voiceQueues'][_0x5f1c46[_0x359c('0xc6')]][_0x359c('0xcc')]?moment()[_0x359c('0x4a')](_0x359c('0xd5')):undefined;_0x5e90a0['countdropretry']+=0x1;_0x5e90a0[_0x359c('0xdd')]+=0x1;_0x36972e=this['voiceQueues'][_0x5f1c46[_0x359c('0xc6')]][_0x359c('0xde')];_0x59db86=this['voiceQueues'][_0x5f1c46[_0x359c('0xc6')]]['callAdditionalPhoneAfterMin'];hopperUtils['verifyAdditionalPhones'](_0x5e90a0,_0x5e90a0[_0x359c('0xd9')],_0x3a27d7[_0x359c('0xdf')])['then'](function(_0x1b1188){_0x252dbd=_0x1b1188[_0x359c('0xe0')]==0x1;if(_0x5e90a0[_0x359c('0xe1')]>=_0x43835d[_0x359c('0x24')][_0x5f1c46[_0x359c('0xc6')]][_0x359c('0xe2')]){_0x43835d[_0x359c('0xe3')](_0x5e90a0,_0x1b1188[_0x359c('0xe0')]);}else{hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0x5e90a0['countdropretry'],'scheduledat':moment()['add'](_0x43835d['voiceQueues'][_0x5f1c46[_0x359c('0xc6')]][_0x359c('0xde')],_0x359c('0xe4'))['format'](_0x359c('0xd5')),'ContactId':_0x3a27d7[_0x359c('0xe5')],'ListId':_0x3a27d7['ListId'],'VoiceQueueId':_0x3a27d7[_0x359c('0xe6')]||undefined,'CampaignId':_0x3a27d7[_0x359c('0xe7')]||undefined})[_0x359c('0xa3')](loggerCatch(_0x359c('0xe8')));var _0x434f75=new History(_0x5e90a0);_0x434f75[_0x359c('0xd9')]=0xa;_0x434f75['statedesc']='Drop';_0x434f75[_0x359c('0x76')]=moment()[_0x359c('0x4a')](_0x359c('0xd5'));_0x434f75[_0x359c('0xe9')]=_0x434f75['starttime'];_0x434f75['calleridname']=_0x5e90a0['calleridname'];_0x434f75[_0x359c('0xea')]=_0x5e90a0['calleridnum'];hopperUtils['createHistory'](_0x434f75)[_0x359c('0xa3')](loggerCatch(_0x359c('0xeb')));}})[_0x359c('0xa0')](function(){if(_0x252dbd)hopperUtils[_0x359c('0xec')](_0x5e90a0,_0x36972e,_0x59db86)[_0x359c('0xa0')](function(){return 0x1;});});}else{this[_0x359c('0x24')][_0x5f1c46[_0x359c('0xc6')]][_0x359c('0xed')]+=0x1;this[_0x359c('0x24')][_0x5f1c46['queue']][_0x359c('0xee')]+=0x1;_0x5e90a0[_0x359c('0xd9')]=0xb;_0x5e90a0[_0x359c('0x75')]='Abandoned';_0x5e90a0['dropreason']=_0x359c('0xef');_0x5e90a0[_0x359c('0xf0')]+=0x1;_0x5e90a0['countglobal']+=0x1;_0x36972e=this[_0x359c('0x24')][_0x5f1c46[_0x359c('0xc6')]][_0x359c('0xf1')];_0x59db86=this[_0x359c('0x24')][_0x5f1c46[_0x359c('0xc6')]][_0x359c('0xf2')];hopperUtils[_0x359c('0xf3')](_0x5e90a0,_0x5e90a0['state'],_0x3a27d7['voiceQueue'])[_0x359c('0xa0')](function(_0x13e3e9){if(_0x5e90a0[_0x359c('0xf0')]>=_0x43835d[_0x359c('0x24')][_0x5f1c46['queue']][_0x359c('0xf4')]){_0x43835d['queueCallerAbandonCreateState'](_0x5e90a0,_0x13e3e9[_0x359c('0xe0')]);}else{hopperUtils[_0x359c('0xf5')]({'active':![],'countabandonedretry':_0x5e90a0[_0x359c('0xf0')],'scheduledat':moment()[_0x359c('0xf6')](_0x43835d[_0x359c('0x24')][_0x5f1c46['queue']][_0x359c('0xf1')],_0x359c('0xe4'))[_0x359c('0x4a')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3a27d7['ContactId'],'ListId':_0x3a27d7[_0x359c('0xf7')],'VoiceQueueId':_0x3a27d7[_0x359c('0xe6')]||undefined,'CampaignId':_0x3a27d7[_0x359c('0xe7')]||undefined})[_0x359c('0xa3')](loggerCatch(_0x359c('0xf8')));var _0x3a0332=new History(_0x5e90a0);_0x3a0332[_0x359c('0xd9')]=0xb;_0x3a0332[_0x359c('0x75')]=_0x359c('0xf9');_0x3a0332[_0x359c('0x76')]=moment()[_0x359c('0x4a')]('YYYY-MM-DD\x20HH:mm:ss');_0x3a0332[_0x359c('0xe9')]=_0x3a0332['starttime'];_0x3a0332['calleridname']=_0x5e90a0[_0x359c('0xfa')];_0x3a0332[_0x359c('0xea')]=_0x5e90a0[_0x359c('0xea')];hopperUtils[_0x359c('0xce')](_0x3a0332)[_0x359c('0xa3')](loggerCatch(_0x359c('0xfb')));}})[_0x359c('0xa0')](function(){if(_0x252dbd)hopperUtils['swapAdditionalPhones'](_0x5e90a0,_0x36972e,_0x59db86)[_0x359c('0xa0')](function(){return 0x1;});});}}}};Dialer[_0x359c('0x1f')][_0x359c('0xfc')]=function(_0x31f38a){if(this['actions'][_0x31f38a[_0x359c('0xc7')]]){this[_0x359c('0x2a')][_0x31f38a['uniqueid']][_0x359c('0xfd')]=_0x31f38a[_0x359c('0xfd')];}if(this[_0x359c('0x2c')][_0x31f38a[_0x359c('0xc7')]]){this[_0x359c('0x2c')][_0x31f38a['uniqueid']][_0x359c('0xfd')]=_0x31f38a[_0x359c('0xfd')];}};Dialer[_0x359c('0x1f')][_0x359c('0x41')]=function(_0x2eca78){if(!this[_0x359c('0x2a')][_0x2eca78[_0x359c('0xfe')]]){return;}var _0xbf5959=this[_0x359c('0x24')][this[_0x359c('0x2a')][_0x2eca78[_0x359c('0xfe')]][_0x359c('0xc6')]][_0x359c('0xff')]||_0x359c('0x100');if(_0xbf5959==='roundrobin'){if(this[_0x359c('0x2a')][_0x2eca78[_0x359c('0xfe')]]&&_[_0x359c('0x101')](this[_0x359c('0x2a')][_0x2eca78['actionid']][_0x359c('0x102')])&&_0x2eca78[_0x359c('0x8c')]==='1'&&_0x2eca78[_0x359c('0x103')]==='0'){if(this[_0x359c('0x26')][_0x2eca78[_0x359c('0x104')]]){if(!this['agents'][_0x2eca78[_0x359c('0x104')]][_0x359c('0x102')]){this['agents'][_0x2eca78[_0x359c('0x104')]][_0x359c('0x102')]=!![];this[_0x359c('0x2a')][_0x2eca78[_0x359c('0xfe')]][_0x359c('0x102')]=!![];this[_0x359c('0x2a')][_0x2eca78[_0x359c('0xfe')]][_0x359c('0x104')]=_0x2eca78[_0x359c('0x104')];}}}}else if(_0xbf5959==='rrmemory'){if(this[_0x359c('0x2a')][_0x2eca78[_0x359c('0xfe')]]){if(this[_0x359c('0x26')][_0x2eca78['stateinterface']]){this[_0x359c('0x2a')][_0x2eca78[_0x359c('0xfe')]]['stateinterface']=_0x2eca78[_0x359c('0x104')];if(_[_0x359c('0x101')](this[_0x359c('0x105')][this[_0x359c('0x2a')][_0x2eca78[_0x359c('0xfe')]][_0x359c('0xc6')]])){this['queueBooked'][this[_0x359c('0x2a')][_0x2eca78[_0x359c('0xfe')]][_0x359c('0xc6')]]=[];}this['queueBooked'][this['actions'][_0x2eca78[_0x359c('0xfe')]][_0x359c('0xc6')]][_0x359c('0xa4')](_[_0x359c('0x62')](_[_0x359c('0x7a')](this['actions'][_0x2eca78['actionid']],['idHopper',_0x359c('0x104')]),{'status':_0x2eca78[_0x359c('0x8c')],'paused':_0x2eca78[_0x359c('0x103')]}));}}}};Dialer[_0x359c('0x1f')][_0x359c('0x43')]=function(_0x2cfac1){if(!this['actions'][_0x2cfac1['actionid']]){return;}var _0x57e9dd=this;var _0x220f7b=this['voiceQueues'][this[_0x359c('0x2a')][_0x2cfac1[_0x359c('0xfe')]][_0x359c('0xc6')]];var _0x2388dd=_0x220f7b['strategy']||'rrmemory';if(_0x2388dd===_0x359c('0x106')){if(this[_0x359c('0x2a')][_0x2cfac1['actionid']]&&this['actions'][_0x2cfac1[_0x359c('0xfe')]][_0x359c('0x104')]){this[_0x359c('0x23')]['run'](this[_0x359c('0x2a')][_0x2cfac1[_0x359c('0xfe')]][_0x359c('0x107')],this['actions'][_0x2cfac1['actionid']][_0x359c('0x104')])[_0x359c('0xa3')](function(_0x13a241){logger[_0x359c('0x6a')](_0x359c('0x108'),util[_0x359c('0x6c')](_0x13a241,{'showHidden':![],'depth':null}));})[_0x359c('0x109')](function(){_0x57e9dd[_0x359c('0xd3')](_0x57e9dd[_0x359c('0x24')][_0x57e9dd['actions'][_0x2cfac1['actionid']][_0x359c('0xc6')]]);_0x57e9dd[_0x359c('0x26')][_0x57e9dd['actions'][_0x2cfac1[_0x359c('0xfe')]][_0x359c('0x104')]][_0x359c('0x102')]=![];delete _0x57e9dd[_0x359c('0x2a')][_0x2cfac1[_0x359c('0xfe')]];unlockQueueStatus(_0x220f7b);});}else{this[_0x359c('0xd3')](this['voiceQueues'][this[_0x359c('0x2a')][_0x2cfac1[_0x359c('0xfe')]][_0x359c('0xc6')]]);hopperUtils[_0x359c('0xf5')]({'active':![],'ContactId':this[_0x359c('0x2a')][_0x2cfac1['actionid']][_0x359c('0xe5')],'ListId':this[_0x359c('0x2a')][_0x2cfac1[_0x359c('0xfe')]][_0x359c('0xf7')],'VoiceQueueId':this[_0x359c('0x2a')][_0x2cfac1[_0x359c('0xfe')]][_0x359c('0xe6')]||undefined,'CampaignId':this[_0x359c('0x2a')][_0x2cfac1['actionid']][_0x359c('0xe7')]||undefined})[_0x359c('0xa3')](loggerCatch(_0x359c('0x10a')));delete this['actions'][_0x2cfac1[_0x359c('0xfe')]];unlockQueueStatus(_0x220f7b);}}else if(_0x2388dd===_0x359c('0x100')){var _0x45902c;if(this['actions'][_0x2cfac1[_0x359c('0xfe')]]&&!_[_0x359c('0x4d')](this['queueBooked'][this[_0x359c('0x2a')][_0x2cfac1[_0x359c('0xfe')]][_0x359c('0xc6')]])){if(this[_0x359c('0x2f')][_0x57e9dd[_0x359c('0x2a')][_0x2cfac1[_0x359c('0xfe')]]['queue']]){this['queueBookedRR'][_0x57e9dd[_0x359c('0x2a')][_0x2cfac1[_0x359c('0xfe')]][_0x359c('0xc6')]]=this['queueBookedRR'][this[_0x359c('0x2a')][_0x2cfac1[_0x359c('0xfe')]][_0x359c('0xc6')]]?this[_0x359c('0x2f')][this[_0x359c('0x2a')][_0x2cfac1['actionid']][_0x359c('0xc6')]]:this[_0x359c('0x105')][this[_0x359c('0x2a')][_0x2cfac1[_0x359c('0xfe')]]['queue']]?this[_0x359c('0x105')][this[_0x359c('0x2a')][_0x2cfac1[_0x359c('0xfe')]]['queue']][_0x359c('0x10b')]||0x0:0x0;}this[_0x359c('0x105')][this['actions'][_0x2cfac1[_0x359c('0xfe')]][_0x359c('0xc6')]][_0x359c('0x10b')]=this[_0x359c('0x2f')][this['actions'][_0x2cfac1[_0x359c('0xfe')]][_0x359c('0xc6')]];for(var _0x97687b=0x0;_0x97687b=_0x2790b8['dialGlobalMaxRetry']){_0x32d5f1[_0x359c('0x132')](_0x2c48b1,_0x197086,_0x2bfd35,_0x359c('0x133'));}else{if(_0x2c48b1[_0x359c('0x130')]>=_0x2790b8[_0x359c('0x134')]){_0x32d5f1[_0x359c('0x135')](_0x2c48b1,_0x197086,_0x2bfd35,_0x359c('0x136'));}else{hopperUtils[_0x359c('0xf5')]({'active':![],'countmachineretry':_0x2c48b1['countmachineretry'],'scheduledat':moment()[_0x359c('0xf6')](_0x2790b8[_0x359c('0x137')],'minutes')['format'](_0x359c('0xd5')),'ContactId':_0x2c48b1['ContactId'],'ListId':_0x2c48b1[_0x359c('0xf7')],'VoiceQueueId':_0x2c48b1[_0x359c('0xe6')]||undefined,'CampaignId':_0x2c48b1[_0x359c('0xe7')]||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));_0x197086({'reschedule':0x1});}}});}if(_0x1d2d0f['type']===_0x359c('0xd2')&&this[_0x359c('0x25')][_0x1d2d0f[_0x359c('0xc6')]][_0x359c('0x11c')]&&_0x21fed1['value']===_0x359c('0x11d')){delete this[_0x359c('0x2c')][_0x21fed1[_0x359c('0xc7')]];this[_0x359c('0xd3')](this[_0x359c('0x25')][_0x1d2d0f[_0x359c('0xc6')]]);_0x56de28=new Hangup(_0x1d2d0f,_0x21fed1);_0x56de28[_0x359c('0xd9')]=0x12;_0x56de28[_0x359c('0x75')]=_0x359c('0x11f');_0x56de28[_0x359c('0x129')]=_0x359c('0x12a');ami[_0x359c('0x120')]('custom:amd',ut[_0x359c('0x12b')](_0x56de28,'amd'));this['saveInDb'](_0x56de28,_0x359c('0x138'),_0x359c('0x139'));}if(_0x1d2d0f[_0x359c('0x48')]===_0x359c('0xd2')&&this['campaigns'][_0x1d2d0f[_0x359c('0xc6')]][_0x359c('0x11c')]&&_0x21fed1[_0x359c('0x126')]===_0x359c('0x127')){return new Promise(function(_0x1aed1c,_0x509f91){delete _0x32d5f1['uniqueId'][_0x21fed1['uniqueid']];_0x32d5f1[_0x359c('0xd3')](_0x32d5f1[_0x359c('0x25')][_0x1d2d0f[_0x359c('0xc6')]]);_0x32d5f1[_0x359c('0x25')][_0x1d2d0f[_0x359c('0xc6')]][_0x359c('0xc8')]+=0x1;_0x32d5f1[_0x359c('0x25')][_0x1d2d0f[_0x359c('0xc6')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x40b3f9=_0x32d5f1['campaigns'][_0x1d2d0f['queue']];var _0x2294f1=new Hangup(_0x1d2d0f,_0x21fed1);_0x2294f1[_0x359c('0xd9')]=0x13;_0x2294f1['statedesc']=_0x359c('0x128');_0x2294f1[_0x359c('0x129')]=_0x359c('0x12a');_0x2294f1[_0x359c('0x130')]+=0x1;_0x2294f1[_0x359c('0xdd')]+=0x1;_0x2294f1[_0x359c('0x122')]=!![];ami['emit'](_0x359c('0x121'),ut['buildObj'](_0x2294f1,_0x359c('0x122')));hopperUtils[_0x359c('0xce')](_0x2294f1)[_0x359c('0xa3')](loggerCatch(_0x359c('0x12c')));if(_0x2294f1[_0x359c('0x12d')]+_0x2294f1[_0x359c('0x12e')]+_0x2294f1['countnoanswerretry']+_0x2294f1[_0x359c('0x13a')]+_0x2294f1['countdropretry']+_0x2294f1['countabandonedretry']+_0x2294f1[_0x359c('0x130')]+_0x2294f1[_0x359c('0x131')]>=_0x40b3f9[_0x359c('0x13b')]){_0x32d5f1[_0x359c('0x132')](_0x2294f1,_0x1aed1c,_0x509f91,_0x359c('0x133'));}else{if(_0x2294f1[_0x359c('0x130')]>=_0x40b3f9[_0x359c('0x134')]){_0x32d5f1[_0x359c('0x135')](_0x2294f1,_0x1aed1c,_0x509f91,_0x359c('0x136'));}else{hopperUtils[_0x359c('0xf5')]({'active':![],'countmachineretry':_0x2294f1[_0x359c('0x130')],'scheduledat':moment()[_0x359c('0xf6')](_0x40b3f9['dialMachineRetryFrequency'],_0x359c('0xe4'))[_0x359c('0x4a')](_0x359c('0xd5')),'ContactId':_0x2294f1[_0x359c('0xe5')],'ListId':_0x2294f1['ListId'],'VoiceQueueId':_0x2294f1[_0x359c('0xe6')]||undefined,'CampaignId':_0x2294f1['CampaignId']||undefined})[_0x359c('0xa3')](loggerCatch(_0x359c('0x13c')));_0x1aed1c({'reschedule':0x1});}}});}}};Dialer[_0x359c('0x1f')][_0x359c('0x3d')]=function(_0x26e2dd){var _0x44a716=this[_0x359c('0x2c')][_0x26e2dd[_0x359c('0xc7')]];var _0x2c4d1a;if(_0x44a716&&_0x44a716[_0x359c('0x48')]===_0x359c('0xd2')){delete this[_0x359c('0x2c')][_0x26e2dd[_0x359c('0xc7')]];this[_0x359c('0xd3')](this[_0x359c('0x25')][_0x44a716[_0x359c('0xc6')]]);this['campaigns'][_0x44a716['queue']][_0x359c('0x13d')]+=0x1;_0x2c4d1a=new Hangup(_0x44a716,_0x26e2dd);hopperUtils[_0x359c('0xce')](_0x2c4d1a)[_0x359c('0xa3')](loggerCatch(_0x359c('0x13e')));hopperUtils[_0x359c('0xd0')](_0x2c4d1a)[_0x359c('0xa3')](loggerCatch(_0x359c('0x13f')));}if(_0x44a716&&_0x44a716[_0x359c('0x48')]!==_0x359c('0xd2')&&isNotNull(this[_0x359c('0x24')][_0x44a716['queue']][_0x359c('0x140')])){delete this['uniqueId'][_0x26e2dd['uniqueid']];this['updateOriginated'](this[_0x359c('0x24')][_0x44a716[_0x359c('0xc6')]]);this[_0x359c('0x24')][_0x44a716['queue']][_0x359c('0xc8')]+=0x1;this[_0x359c('0x24')][_0x44a716[_0x359c('0xc6')]][_0x359c('0x11e')]+=0x1;_0x2c4d1a=new Hangup(_0x44a716,_0x26e2dd);_0x2c4d1a[_0x359c('0xd9')]=0x10;_0x2c4d1a[_0x359c('0x75')]=_0x359c('0x141');_0x2c4d1a[_0x359c('0x129')]=_0x359c('0x142');hopperUtils[_0x359c('0xce')](_0x2c4d1a)[_0x359c('0xa3')](loggerCatch(_0x359c('0x13e')));hopperUtils[_0x359c('0xd0')](_0x2c4d1a)['catch'](loggerCatch(_0x359c('0x13f')));}if(_0x44a716&&_0x44a716[_0x359c('0x48')]!=='ivr'&&!isNotNull(this['voiceQueues'][_0x44a716[_0x359c('0xc6')]][_0x359c('0x140')])){if(_0x26e2dd[_0x359c('0x143')]==='Normal\x20Clearing'){delete this['uniqueId'][_0x26e2dd[_0x359c('0xc7')]];this[_0x359c('0x24')][_0x44a716[_0x359c('0xc6')]]['outboundAnswerCallsDay']+=0x1;const _0x340b80=new AgentComplete(_0x44a716,_0x26e2dd);_0x340b80[_0x359c('0xe7')]=this['voiceQueues'][_0x44a716['queue']]['id'];hopperUtils['createHistory'](_0x340b80)[_0x359c('0xa3')](loggerCatch(_0x359c('0xcf')));hopperUtils[_0x359c('0xd0')](_0x340b80)[_0x359c('0xa3')](loggerCatch(_0x359c('0xd1')));}else{delete this[_0x359c('0x2c')][_0x26e2dd['uniqueid']];this[_0x359c('0xd3')](this[_0x359c('0x24')][_0x44a716[_0x359c('0xc6')]]);this['voiceQueues'][_0x44a716[_0x359c('0xc6')]][_0x359c('0x144')]+=0x1;_0x2c4d1a=new Hangup(_0x44a716,_0x26e2dd);_0x2c4d1a[_0x359c('0xd9')]=0xc;_0x2c4d1a[_0x359c('0x75')]=_0x26e2dd['cause-txt'];_0x2c4d1a[_0x359c('0x129')]=_0x359c('0x145');hopperUtils['createHistory'](_0x2c4d1a)[_0x359c('0xa3')](loggerCatch(_0x359c('0x13e')));hopperUtils[_0x359c('0xd0')](_0x2c4d1a)[_0x359c('0xa3')](loggerCatch(_0x359c('0x13f')));}}};Dialer[_0x359c('0x1f')][_0x359c('0xd')]=function(_0x57cdc2){var _0x5654fc=this;if(!_0x5654fc['queuesSummary'][_0x57cdc2[_0x359c('0x66')]]){_0x5654fc['queuesSummary'][_0x57cdc2[_0x359c('0x66')]]={'running':![]};}else if(_0x5654fc[_0x359c('0x30')][_0x57cdc2[_0x359c('0x66')]]['running']===!![]){return;}else if(_0x5654fc[_0x359c('0x30')][_0x57cdc2['name']][_0x359c('0x146')]===![]){_0x5654fc[_0x359c('0x30')][_0x57cdc2[_0x359c('0x66')]]['running']=!![];}var _0x2a24e6=_0x5654fc[_0x359c('0x24')][_0x57cdc2[_0x359c('0x66')]];var _0x40d9c7=_0x2a24e6['message']!==utils[_0x359c('0x71')]['INACTIVE'];var _0x396ea8=utils[_0x359c('0x147')](_0x2a24e6);_0x2a24e6[_0x359c('0x148')]=utils[_0x359c('0x149')](_0x2a24e6,_0x5654fc[_0x359c('0x27')]);Promise['resolve']()[_0x359c('0xa0')](function(){if(_0x2a24e6[_0x359c('0x148')]===utils[_0x359c('0x71')][_0x359c('0x83')]){if(_0x40d9c7){clearPredictiveAttributes(_0x2a24e6);_0x57cdc2[_0x359c('0x2d')]=undefined;_0x57cdc2[_0x359c('0x64')]=undefined;}if(_0x2a24e6[_0x359c('0x148')]===utils['CAMPAIGN_STATUS'][_0x359c('0x83')]){_0x57cdc2[_0x359c('0x14a')]=0x0;_0x57cdc2[_0x359c('0x103')]=0x0;_0x57cdc2['inUse']=0x0;_0x57cdc2[_0x359c('0x14b')]=0x0;_0x57cdc2[_0x359c('0x14c')]=0x0;}}else if(_0x2a24e6['statusMessage']===utils[_0x359c('0x71')][_0x359c('0x14d')]&&!_0x396ea8){return _0x5654fc['ifTime'](_0x2a24e6,!![])[_0x359c('0xa0')](function(){return _0x5654fc[_0x359c('0x99')](_0x2a24e6,![]);})[_0x359c('0xa0')](function(){return _0x5654fc['checkDialMethod'](_0x2a24e6);})[_0x359c('0xa3')](function(_0x54bee3){loggerSyncQueueSummary[_0x359c('0x65')]('[syncQueueSummary]',util['inspect'](_0x54bee3,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x2a24e6);});}else{clearPredictiveAttributes(_0x2a24e6);}})['then'](function(){var _0x40753a=_0x57cdc2[_0x359c('0x14e')](_0x2a24e6);if(_0x40753a||_0x2a24e6['queueSummaryCountersUpdated']){_0x2a24e6[_0x359c('0x14f')]=![];_0x57cdc2[_0x359c('0x150')](_0x2a24e6);Object[_0x359c('0x151')](_0x2a24e6,_0x57cdc2);emitOutboundVoiceQueueSummary(_0x57cdc2);}_0x5654fc['queuesSummary'][_0x2a24e6['name']][_0x359c('0x146')]=![];})['catch'](function(_0x4f7566){logger[_0x359c('0x6a')](_0x359c('0x152'),util[_0x359c('0x6c')](_0x4f7566,{'showHidden':![],'depth':null}));_0x5654fc[_0x359c('0x30')][_0x2a24e6[_0x359c('0x66')]][_0x359c('0x146')]=![];});};Dialer[_0x359c('0x1f')][_0x359c('0x3c')]=_[_0x359c('0x153')](function(){var _0x3b9789=_[_0x359c('0x154')](this[_0x359c('0x24')],function(_0x1ff1b3){return _0x1ff1b3[_0x359c('0x155')];});var _0x1eb687=_[_0x359c('0x154')](this[_0x359c('0x26')],function(_0x3963ca){return _0x3963ca[_0x359c('0x156')]&&_0x3963ca['status']===_0x359c('0x8d');});if(_0x3b9789['length']>0x0&&_0x1eb687['length']>0x0){return Promise[_0x359c('0xb4')]()[_0x359c('0xa0')](cmHopper[_0x359c('0x157')](_[_0x359c('0x158')](_0x3b9789,'id'),previewRecallmeReminderInterval,_['map'](_0x1eb687,'id')))[_0x359c('0xa0')](function(_0x246226){for(var _0x46d9e4=0x0;_0x46d9e4<_0x246226['length'];_0x46d9e4++){var _0x458aeb=_0x246226[_0x46d9e4][_0x359c('0x159')][_0x359c('0x66')];if(_0x458aeb)io['to'](util[_0x359c('0x4a')](_0x359c('0x15a'),_0x458aeb))[_0x359c('0x120')]('user:dialPreviewRecallReminder',{'hopper':_0x246226[_0x46d9e4]});}})[_0x359c('0xa3')](function(_0x318fa3){logger[_0x359c('0x6a')](_0x359c('0x15b'),_0x318fa3);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x359c('0x1f')][_0x359c('0x45')]=function(){var _0x27b2d9=this;setInterval(function(){_0x27b2d9['clearZombieChannels'](_0x27b2d9[_0x359c('0x2c')],'[uniqueid]');_0x27b2d9[_0x359c('0x15c')](_0x27b2d9[_0x359c('0x2a')],'[actions]');},0x32c8);};Dialer[_0x359c('0x1f')][_0x359c('0x15c')]=function(_0x1b1e0b,_0x25df1c){var _0x1dad15=this;for(var _0x11704d in _0x1b1e0b){if(typeof _0x1b1e0b[_0x11704d]!==_0x359c('0xb1')){this[_0x359c('0x22')][_0x359c('0x20')](function(){if(!_['isNil'](_0x1b1e0b[_0x11704d])){return ami['Action']({'action':'status','channel':_0x1b1e0b[_0x11704d]['channel']})[_0x359c('0xa3')](function(_0x284356){if(_0x284356[_0x359c('0x70')]===_0x359c('0x15d')){setTimeout(function(){if(_0x1b1e0b[_0x11704d]&&_0x1b1e0b[_0x11704d][_0x359c('0x48')]!==_0x359c('0xd2')){_0x1dad15['updateOriginated'](_0x1dad15[_0x359c('0x24')][_0x1b1e0b[_0x11704d][_0x359c('0xc6')]]);logger[_0x359c('0x6a')](_0x359c('0x15e'),_0x25df1c,_0x11704d,_0x1b1e0b[_0x11704d][_0x359c('0xc6')]);delete _0x1b1e0b[_0x11704d];}if(_0x1b1e0b[_0x11704d]&&_0x1b1e0b[_0x11704d][_0x359c('0x48')]===_0x359c('0xd2')){_0x1dad15['updateOriginated'](_0x1dad15['campaigns'][_0x1b1e0b[_0x11704d]['queue']]);logger['error'](_0x359c('0x15f'),_0x25df1c,_0x11704d,_0x1b1e0b[_0x11704d][_0x359c('0xc6')]);delete _0x1b1e0b[_0x11704d];}},0x2328);}});}});}}};Dialer[_0x359c('0x1f')][_0x359c('0x160')]=function(_0x24d2d3){return Promise[_0x359c('0xb4')]()['then'](voiceQueueRt[_0x359c('0x160')](_0x24d2d3))['catch'](loggerCatch(_0x359c('0x161')));};Dialer[_0x359c('0x1f')]['updateOriginated']=function(_0x483612){if(!_['isUndefined'](_0x483612)&&_0x483612!==null){if(typeof _0x483612[_0x359c('0x82')]!==_0x359c('0xb1')){if(_0x483612[_0x359c('0x82')]>0x0){_0x483612[_0x359c('0x82')]-=0x1;}else{logger['error'](_0x359c('0x162'));}}}else{logger[_0x359c('0x6a')](_0x359c('0x163'));}};Dialer[_0x359c('0x1f')][_0x359c('0x164')]=function(_0x22ceb0,_0x26627d){var _0x3693a5=this;return function(_0x2774c5){_0x3693a5[_0x359c('0xd3')](_0x26627d);logger[_0x359c('0x6a')](_0x22ceb0,util['inspect'](_0x2774c5,{'showHidden':![],'depth':null}));};};Dialer['prototype']['emptyContact']=function(_0x3c85c7,_0x483f9d,_0x18c6c8){var _0x10da96={'state':0x19,'statedesc':'notFound'};this['updateOriginated'](_0x483f9d);this[_0x359c('0x123')](_['merge'](_0x10da96,_['pick'](_0x18c6c8,[_0x359c('0xe5'),_0x359c('0xf7'),_0x359c('0x165'),_0x359c('0xe6'),_0x359c('0xe7')])),_0x359c('0x166'),_0x359c('0x167'));logger[_0x359c('0x6a')](_0x3c85c7);};Dialer[_0x359c('0x1f')][_0x359c('0x123')]=function(_0x42eaea,_0x255d9b,_0x28024f){hopperUtils[_0x359c('0xce')](_0x42eaea)[_0x359c('0xa3')](loggerCatch(_0x255d9b));hopperUtils[_0x359c('0xd0')](_0x42eaea)[_0x359c('0xa3')](loggerCatch(_0x28024f));};Dialer[_0x359c('0x1f')]['queueCallerAbandonCreateState']=function(_0x5dbb2b,_0x2b6286){hopperUtils[_0x359c('0xce')](_0x5dbb2b)[_0x359c('0xa3')](loggerCatch(_0x359c('0xcf')));if(_0x2b6286==0x0){hopperUtils[_0x359c('0xd0')](_0x5dbb2b)['catch'](loggerCatch(_0x359c('0x168')));}};Dialer[_0x359c('0x1f')][_0x359c('0x15b')]=function(_0x28bb78){return Promise[_0x359c('0xb4')]()['then'](cmHopper[_0x359c('0x157')](_0x28bb78['id'],previewRecallmeReminderInterval))[_0x359c('0xa0')](function(_0x10d74d){for(var _0xe778f3=0x0;_0xe778f3<_0x10d74d[_0x359c('0x9d')];_0xe778f3++){var _0x2d91c2=_0x10d74d[_0xe778f3]['Agent'][_0x359c('0x66')];if(_0x2d91c2)io['to'](util[_0x359c('0x4a')](_0x359c('0x15a'),_0x2d91c2))[_0x359c('0x120')](_0x359c('0x169'),{'hopper':_0x10d74d[_0xe778f3]});}})[_0x359c('0xa3')](function(){});};Dialer[_0x359c('0x1f')][_0x359c('0xb8')]=function(_0x516654){var _0x44c55a=this;return function(){_0x44c55a[_0x359c('0x16a')](_0x516654);};};Dialer[_0x359c('0x1f')][_0x359c('0x16b')]=function(_0x29557f,_0x5f7a4c){var _0x2d5925=this;var _0x544ae9=uuid['v4']();this[_0x359c('0x2a')][_0x544ae9]=new Action(_0x29557f,_0x5f7a4c,_0x544ae9);return new Promise(function(_0x10fe4b,_0x7e1e15){if(_[_0x359c('0x47')](_0x29557f)&&typeof _0x29557f!==_0x359c('0x16c')){return _0x7e1e15(msgResponse(_0x359c('0x16d'),_0x359c('0x96'),'voiceQueue\x20is\x20undefine'));}if(_[_0x359c('0x47')](_0x5f7a4c['phone'])||_0x5f7a4c['phone']===null){return _0x7e1e15(msgResponse(_0x359c('0x16d'),_0x359c('0x96'),_0x359c('0x16e')));}var _0x50852a={'XMD-CALLERID':_0x2d5925['actions'][_0x544ae9][_0x359c('0x16f')](),'XMD-AGI':_0x29557f[_0x359c('0x140')]?util[_0x359c('0x4a')](_0x359c('0x170'),ipAgi,_0x29557f[_0x359c('0x140')]):'NONE','XMD-AGIAFTER':_0x29557f['dialQueueProject2']?util['format'](_0x359c('0x170'),ipAgi,_0x29557f['dialQueueProject2']):_0x359c('0x171'),'XMD-QUEUE':utils[_0x359c('0x172')](_0x29557f)?util[_0x359c('0x4a')]('\x22%s,%s%s,,,%s\x22',_0x29557f[_0x359c('0x66')],_0x29557f[_0x359c('0x173')]||'',_0x29557f[_0x359c('0xcd')]?'c':'',_0x29557f[_0x359c('0x174')]||0x3):'NONE','XMD-CONTACTID':_0x5f7a4c[_0x359c('0xe5')],'XMD-CDRTYPE':_0x359c('0x9'),'CALLERID(all)':_0x2d5925[_0x359c('0x2a')][_0x544ae9][_0x359c('0x16f')](),'XMD-AMD':_0x29557f[_0x359c('0x11c')]?'ACTIVE':_0x359c('0x171'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x29557f['dialAMDActive']){_0x50852a['XMD-AMDINITIALSILENCE']=_0x29557f[_0x359c('0x175')]||0x9c4;_0x50852a[_0x359c('0x176')]=_0x29557f['dialAMDGreeting']||0x5dc;_0x50852a[_0x359c('0x177')]=_0x29557f[_0x359c('0x178')]||0x320;_0x50852a['XMD-AMDTOTALANALYSISTIME']=_0x29557f['dialAMDTotalAnalysisTime']||0x1388;_0x50852a[_0x359c('0x179')]=_0x29557f[_0x359c('0x17a')]||0x64;_0x50852a[_0x359c('0x17b')]=_0x29557f[_0x359c('0x17c')]||0x32;_0x50852a[_0x359c('0x17d')]=_0x29557f[_0x359c('0x17e')]||0x3;_0x50852a[_0x359c('0x17f')]=_0x29557f[_0x359c('0x180')]||0x100;_0x50852a[_0x359c('0x181')]=_0x29557f['dialAMDMaximumWordLength']||0x1388;}if(utils['isOutboundQueue'](_0x29557f)){_0x50852a[_0x359c('0x182')]=_0x5f7a4c[_0x359c('0xe6')];}else{_0x50852a[_0x359c('0x183')]=_0x5f7a4c[_0x359c('0xe7')];}var _0x281cbf=utils[_0x359c('0x184')](_0x5f7a4c[_0x359c('0x185')]);Object[_0x359c('0x151')](_0x50852a,_0x281cbf);var _0x35bb64=_0x2d5925[_0x359c('0x8a')](_0x29557f['Trunk'])?utils[_0x359c('0x186')](_0x29557f[_0x359c('0x187')][_0x359c('0x188')],_0x29557f[_0x359c('0x189')],_0x29557f[_0x359c('0x18a')]>0x0?utils[_0x359c('0x18b')](_0x29557f['dialOriginateCallerIdNumber'],_0x29557f[_0x359c('0x18a')]):_0x29557f[_0x359c('0x18c')]):utils[_0x359c('0x186')](_[_0x359c('0x101')](_0x29557f[_0x359c('0x91')])?_0x29557f['Trunk'][_0x359c('0x188')]:_0x29557f[_0x359c('0x91')][_0x359c('0x188')],_0x29557f[_0x359c('0x189')],_0x29557f[_0x359c('0x18a')]>0x0?utils[_0x359c('0x18b')](_0x29557f[_0x359c('0x18c')],_0x29557f[_0x359c('0x18a')]):_0x29557f['dialOriginateCallerIdNumber']);if(_0x35bb64){_0x50852a['XMD-ORIGINATECALLERIDNAME']=_0x2d5925[_0x359c('0x2a')][_0x544ae9][_0x359c('0x18d')]=utils['extractCalleridName'](_0x35bb64);_0x50852a[_0x359c('0x18e')]=_0x5f7a4c[_0x359c('0x18f')];}_0x29557f[_0x359c('0x190')]=_0x50852a;return ami[_0x359c('0x9e')]({'actionid':_0x544ae9,'action':_0x359c('0x16d'),'channel':_0x2d5925[_0x359c('0x8a')](_0x29557f[_0x359c('0x187')])?util['format']('SIP/%s/%s%s',_0x29557f[_0x359c('0x187')]['name'],isNotNull(_0x29557f[_0x359c('0x191')])?_0x29557f['dialPrefix'][_0x359c('0x192')]()||'':'',_0x29557f[_0x359c('0x193')]>0x0?_0x5f7a4c['phone']['substring'](_0x29557f[_0x359c('0x193')]):_0x5f7a4c[_0x359c('0x18f')]):util[_0x359c('0x4a')](_0x359c('0x194'),_[_0x359c('0x101')](_0x29557f[_0x359c('0x91')])?_0x29557f[_0x359c('0x187')]['name']:_0x29557f[_0x359c('0x91')][_0x359c('0x66')],isNotNull(_0x29557f[_0x359c('0x191')])?_0x29557f[_0x359c('0x191')][_0x359c('0x192')]()||'':'',_0x29557f[_0x359c('0x193')]>0x0?_0x5f7a4c['phone']['substring'](_0x29557f['dialCutDigit']):_0x5f7a4c[_0x359c('0x18f')]),'callerid':_0x35bb64,'Exten':_0x359c('0x195'),'Context':_0x359c('0x196'),'Priority':'1','variable':_0x50852a,'timeout':(_0x29557f[_0x359c('0x197')]||0x1e)*0x3e8,'async':!![],'channelid':_0x544ae9})[_0x359c('0xa0')](function(_0x14ccd9){return _0x10fe4b(_0x14ccd9);})[_0x359c('0xa3')](function(_0x8d771d){_0x29557f['outboundOriginateFailureCallsDay']+=0x1;var _0x396259=new History(_0x2d5925[_0x359c('0x2a')][_0x544ae9]);logger[_0x359c('0x6a')](util['format']('[originateError]:\x20%s',JSON[_0x359c('0x89')](_0x8d771d)));_0x396259['state']=0xe;_0x396259[_0x359c('0x75')]=_0x359c('0x198');_0x396259[_0x359c('0x76')]=moment()[_0x359c('0x4a')](_0x359c('0xd5'));_0x396259['endtime']=_0x396259[_0x359c('0x76')];hopperUtils[_0x359c('0xce')](_0x396259)[_0x359c('0xa3')](loggerCatch(_0x359c('0x199')));_0x2d5925[_0x359c('0xd0')](_0x396259)['catch'](loggerCatch(_0x359c('0x199')))[_0x359c('0x109')](function(){delete _0x2d5925[_0x359c('0x2a')][_0x544ae9];return _0x7e1e15(msgResponse(_0x359c('0x16d'),'Error','originate\x20action\x20Error'));});});});};Dialer[_0x359c('0x1f')]['checkRetriveMax']=function(_0x5731b9,_0x4adecf,_0x41f966){var _0x502472=new History(_0x4adecf);if(_0x502472[_0x359c('0x12d')]+_0x502472[_0x359c('0x12e')]+_0x502472[_0x359c('0x12f')]+_0x502472[_0x359c('0x13a')]+_0x502472[_0x359c('0xe1')]+_0x502472[_0x359c('0xf0')]+_0x502472[_0x359c('0x130')]+_0x502472[_0x359c('0x131')]>=_0x41f966['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x5731b9){case 0x3:if(_0x502472[_0x359c('0x12f')]>=_0x41f966['dialNoAnswerMaxRetry']-0x1){return!![];}hopperUtils[_0x359c('0xf5')]({'active':![],'countnoanswerretry':_0x502472[_0x359c('0x12f')]+=0x1,'scheduledat':moment()[_0x359c('0xf6')](_0x41f966['dialNoAnswerRetryFrequency'],_0x359c('0xe4'))[_0x359c('0x4a')](_0x359c('0xd5')),'ContactId':_0x502472['ContactId'],'ListId':_0x502472['ListId'],'VoiceQueueId':_0x502472['VoiceQueueId']||undefined,'CampaignId':_0x502472[_0x359c('0xe7')]||undefined})[_0x359c('0xa3')](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0x502472[_0x359c('0x12d')]>=_0x41f966[_0x359c('0x19a')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countbusyretry':_0x502472['countbusyretry']+=0x1,'scheduledat':moment()['add'](_0x41f966[_0x359c('0x19b')],_0x359c('0xe4'))[_0x359c('0x4a')](_0x359c('0xd5')),'ContactId':_0x502472[_0x359c('0xe5')],'ListId':_0x502472[_0x359c('0xf7')],'VoiceQueueId':_0x502472[_0x359c('0xe6')]||undefined,'CampaignId':_0x502472['CampaignId']||undefined})[_0x359c('0xa3')](loggerCatch(_0x359c('0x19c')));break;case 0x8:if(_0x502472[_0x359c('0x12e')]>=_0x41f966[_0x359c('0x19d')]-0x1){return!![];}hopperUtils[_0x359c('0xf5')]({'active':![],'countcongestionretry':_0x502472[_0x359c('0x12e')]+=0x1,'scheduledat':moment()[_0x359c('0xf6')](_0x41f966['dialCongestionRetryFrequency'],_0x359c('0xe4'))[_0x359c('0x4a')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x502472[_0x359c('0xe5')],'ListId':_0x502472[_0x359c('0xf7')],'VoiceQueueId':_0x502472[_0x359c('0xe6')]||undefined,'CampaignId':_0x502472['CampaignId']||undefined})[_0x359c('0xa3')](loggerCatch(_0x359c('0x19e')));break;case 0x0:if(_0x502472[_0x359c('0x13a')]>=_0x41f966[_0x359c('0x19f')]-0x1){return!![];}else{hopperUtils[_0x359c('0xf5')]({'active':![],'countnosuchnumberretry':_0x502472['countnosuchnumberretry']+=0x1,'scheduledat':moment()[_0x359c('0xf6')](_0x41f966[_0x359c('0x1a0')],_0x359c('0xe4'))[_0x359c('0x4a')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x502472['ContactId'],'ListId':_0x502472[_0x359c('0xf7')],'VoiceQueueId':_0x502472[_0x359c('0xe6')]||undefined,'CampaignId':_0x502472[_0x359c('0xe7')]||undefined})[_0x359c('0xa3')](loggerCatch(_0x359c('0x1a1')));}break;case 0xa:if(_0x502472[_0x359c('0xe1')]>=_0x41f966[_0x359c('0xe2')]-0x1){return!![];}hopperUtils[_0x359c('0xf5')]({'active':![],'countdropretry':_0x502472[_0x359c('0xe1')]+=0x1,'scheduledat':moment()[_0x359c('0xf6')](_0x41f966['dialDropRetryFrequency'],_0x359c('0xe4'))[_0x359c('0x4a')](_0x359c('0xd5')),'ContactId':_0x502472['ContactId'],'ListId':_0x502472[_0x359c('0xf7')],'VoiceQueueId':_0x502472['VoiceQueueId']||undefined,'CampaignId':_0x502472['CampaignId']||undefined})[_0x359c('0xa3')](loggerCatch(_0x359c('0xe8')));break;case 0xb:if(_0x502472['countabandonedretry']>=_0x41f966['dialAbandonedMaxRetry']-0x1){return!![];}hopperUtils[_0x359c('0xf5')]({'active':![],'countabandonedretry':_0x502472['countabandonedretry']+=0x1,'scheduledat':moment()['add'](_0x41f966['dialAbandonedRetryFrequency'],_0x359c('0xe4'))['format'](_0x359c('0xd5')),'ContactId':_0x502472[_0x359c('0xe5')],'ListId':_0x502472[_0x359c('0xf7')],'VoiceQueueId':_0x502472['VoiceQueueId']||undefined,'CampaignId':_0x502472[_0x359c('0xe7')]||undefined})['catch'](loggerCatch('[rescheduleContact][Abandoned]'));break;case 0x13:if(_0x502472[_0x359c('0x130')]>=_0x41f966['dialMachineMaxRetry']-0x1){return!![];}hopperUtils[_0x359c('0xf5')]({'active':![],'countmachineretry':_0x502472[_0x359c('0x130')]+=0x1,'scheduledat':moment()[_0x359c('0xf6')](_0x41f966[_0x359c('0x137')],_0x359c('0xe4'))['format'](_0x359c('0xd5')),'ContactId':_0x502472[_0x359c('0xe5')],'ListId':_0x502472['ListId'],'VoiceQueueId':_0x502472['VoiceQueueId']||undefined,'CampaignId':_0x502472[_0x359c('0xe7')]||undefined})[_0x359c('0xa3')](loggerCatch(_0x359c('0x13c')));break;case 0x14:if(_0x502472[_0x359c('0x131')]>=_0x41f966[_0x359c('0x1a2')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countagentrejectretry':_0x502472['countagentrejectretry']+=0x1,'scheduledat':moment()[_0x359c('0xf6')](_0x41f966[_0x359c('0x1a3')],_0x359c('0xe4'))[_0x359c('0x4a')](_0x359c('0xd5')),'ContactId':_0x502472[_0x359c('0xe5')],'ListId':_0x502472[_0x359c('0xf7')],'VoiceQueueId':_0x502472[_0x359c('0xe6')]||undefined,'CampaignId':_0x502472[_0x359c('0xe7')]||undefined})['catch'](loggerCatch(_0x359c('0x1a4')));break;default:return!![];}};Dialer[_0x359c('0x1f')][_0x359c('0x117')]=function(_0x5cc8ed,_0x188285,_0x4068d8){var _0x20c5cd=this;var _0x297e94=new History(_0x5cc8ed);var _0x11c0a7=![];var _0x47c9ef;var _0x584f90;return new Promise(function(_0x20e93d,_0x1f919b){if(_[_0x359c('0x47')](_0x188285)&&typeof _0x188285!==_0x359c('0x16c')){return _0x1f919b(msgResponse(_0x359c('0x1a5'),_0x359c('0x96'),_0x359c('0x1a6')));}if(_['isUndefined'](_0x4068d8)&&typeof _0x4068d8!==_0x359c('0x16c')){return _0x1f919b(msgResponse(_0x359c('0x1a5'),_0x359c('0x96'),_0x359c('0x1a7')));}hopperUtils[_0x359c('0xf3')](_0x297e94,_0x4068d8[_0x359c('0xc9')],_0x188285)['then'](function(_0x43c0bc){if(_0x43c0bc['additional']==0x1)_0x11c0a7=!![];switch(_0x4068d8[_0x359c('0xc9')]){case'0':_0x188285[_0x359c('0x1a8')]+=0x1;_0x297e94[_0x359c('0xd9')]=0x0;_0x297e94[_0x359c('0x75')]=_0x359c('0x1a9');_0x297e94[_0x359c('0x13a')]+=0x1;_0x297e94[_0x359c('0xdd')]+=0x1;ami[_0x359c('0x120')]('custom:agentnosuchnumber',ut[_0x359c('0x12b')](_0x5cc8ed,_0x359c('0x1aa')));_0x47c9ef=_0x188285[_0x359c('0x1a0')];_0x584f90=_0x188285[_0x359c('0xf2')];hopperUtils[_0x359c('0xce')](_0x297e94)['catch'](loggerCatch(_0x359c('0x12c')));if(_0x20c5cd[_0x359c('0x1ab')](0x0,_0x5cc8ed,_0x188285)&&!_0x11c0a7){if(_0x297e94[_0x359c('0x13a')]>=_0x188285[_0x359c('0x19f')]){_0x20c5cd[_0x359c('0x135')](_0x297e94,_0x20e93d,_0x1f919b,_0x359c('0x1ac'));}else{_0x20c5cd[_0x359c('0x132')](_0x297e94,_0x20e93d,_0x1f919b,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x188285[_0x359c('0x1ad')]+=0x1;_0x297e94[_0x359c('0xd9')]=0x3;_0x297e94[_0x359c('0x75')]='NoAnswer';_0x297e94['countnoanswerretry']+=0x1;_0x297e94[_0x359c('0xdd')]+=0x1;var _0x5f40fa=ut[_0x359c('0x1ae')](_0x5cc8ed,_0x188285);ami['emit'](_0x359c('0x1af'),_0x5f40fa);_0x47c9ef=_0x188285[_0x359c('0x1b0')];_0x584f90=_0x188285[_0x359c('0xf2')];hopperUtils[_0x359c('0xce')](_0x297e94)[_0x359c('0xa3')](loggerCatch(_0x359c('0x1b1')));if(_0x20c5cd[_0x359c('0x1ab')](0x3,_0x5cc8ed,_0x188285)&&!_0x11c0a7){if(_0x297e94[_0x359c('0x12f')]>=_0x188285['dialNoAnswerMaxRetry']){_0x20c5cd[_0x359c('0x135')](_0x297e94,_0x20e93d,_0x1f919b,_0x359c('0x1b2'));}else{_0x20c5cd[_0x359c('0x132')](_0x297e94,_0x20e93d,_0x1f919b,_0x359c('0x1b2'));}}break;case'5':_0x188285[_0x359c('0x1b3')]+=0x1;_0x297e94[_0x359c('0xd9')]=0x5;_0x297e94[_0x359c('0x75')]='Busy';_0x297e94['countbusyretry']+=0x1;_0x297e94['countglobal']+=0x1;ami['emit'](_0x359c('0x1b4'),ut[_0x359c('0x12b')](_0x5cc8ed,_0x359c('0x1b5')));_0x47c9ef=_0x188285[_0x359c('0x19b')];_0x584f90=_0x188285[_0x359c('0xf2')];hopperUtils[_0x359c('0xce')](_0x297e94)[_0x359c('0xa3')](loggerCatch(_0x359c('0x1b6')));if(_0x20c5cd[_0x359c('0x1ab')](0x5,_0x5cc8ed,_0x188285)&&!_0x11c0a7){if(_0x297e94[_0x359c('0x12d')]>=_0x188285[_0x359c('0x19a')]){_0x20c5cd[_0x359c('0x135')](_0x297e94,_0x20e93d,_0x1f919b,_0x359c('0x1b7'));}else{_0x20c5cd[_0x359c('0x132')](_0x297e94,_0x20e93d,_0x1f919b,'reason\x205\x20busy');}}break;case'8':_0x188285[_0x359c('0x1b8')]+=0x1;_0x297e94[_0x359c('0xd9')]=0x8;_0x297e94[_0x359c('0x75')]=_0x359c('0x1b9');_0x297e94[_0x359c('0x12e')]+=0x1;_0x297e94[_0x359c('0xdd')]+=0x1;_0x47c9ef=_0x188285[_0x359c('0x1ba')];_0x584f90=_0x188285[_0x359c('0xf2')];ami['emit'](_0x359c('0x1bb'),ut[_0x359c('0x12b')](_0x5cc8ed,_0x359c('0x1bc')));hopperUtils[_0x359c('0xce')](_0x297e94)['catch'](loggerCatch(_0x359c('0x1bd')));if(_0x20c5cd[_0x359c('0x1ab')](0x8,_0x5cc8ed,_0x188285)&&!_0x11c0a7){if(_0x297e94[_0x359c('0x12e')]>=_0x188285[_0x359c('0x19d')]){_0x20c5cd[_0x359c('0x135')](_0x297e94,_0x20e93d,_0x1f919b,_0x359c('0x1be'));}else{_0x20c5cd[_0x359c('0x132')](_0x297e94,_0x20e93d,_0x1f919b,_0x359c('0x1be'));}}break;case'11':_0x188285['outboundAbandonedCallsDay']+=0x1;_0x297e94[_0x359c('0xd9')]=0xb;_0x297e94[_0x359c('0x75')]=_0x359c('0xf9');_0x297e94[_0x359c('0xf0')]+=0x1;_0x297e94['countglobal']+=0x1;_0x47c9ef=_0x188285[_0x359c('0xf1')];_0x584f90=_0x188285[_0x359c('0xf2')];hopperUtils['createHistory'](_0x297e94)[_0x359c('0xa3')](loggerCatch(_0x359c('0xfb')));if(_0x20c5cd[_0x359c('0x1ab')](0xb,_0x5cc8ed,_0x188285)&&!_0x11c0a7){if(_0x297e94[_0x359c('0xf0')]>=_0x188285[_0x359c('0xf4')]){_0x20c5cd['createStateFinal'](_0x297e94,_0x20e93d,_0x1f919b,_0x359c('0x1bf'));}else{_0x20c5cd['stateGlobal'](_0x297e94,_0x20e93d,_0x1f919b,'reason\x2011\x20abandoned');}}break;case'20':_0x188285[_0x359c('0x1c0')]+=0x1;_0x297e94[_0x359c('0xd9')]=0x14;_0x297e94[_0x359c('0x75')]=_0x359c('0x1c1');_0x297e94[_0x359c('0x131')]+=0x1;_0x297e94[_0x359c('0xdd')]+=0x1;_0x47c9ef=_0x188285[_0x359c('0x1a3')];_0x584f90=_0x188285[_0x359c('0xf2')];ami[_0x359c('0x120')](_0x359c('0x1c2'),ut[_0x359c('0x12b')](_0x5cc8ed,_0x359c('0x1c3')));hopperUtils[_0x359c('0xce')](_0x297e94)[_0x359c('0xa3')](loggerCatch(_0x359c('0x1c4')));if(_0x20c5cd['checkRetriveMax'](0x14,_0x5cc8ed,_0x188285)&&!_0x11c0a7){if(_0x297e94[_0x359c('0x131')]>=_0x188285[_0x359c('0x1a2')]){_0x20c5cd['createStateFinal'](_0x297e94,_0x20e93d,_0x1f919b,_0x359c('0x1c5'));}else{_0x20c5cd['stateGlobal'](_0x297e94,_0x20e93d,_0x1f919b,_0x359c('0x1c5'));}}break;default:_0x188285[_0x359c('0x144')]+=0x1;_0x297e94[_0x359c('0xd9')]=0xc;_0x297e94[_0x359c('0x75')]=_0x4068d8['reason'];_0x47c9ef=_0x188285[_0x359c('0x1a3')];_0x584f90=_0x188285[_0x359c('0xf2')];hopperUtils[_0x359c('0xce')](_0x297e94)[_0x359c('0xa3')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x20c5cd[_0x359c('0x1ab')](_0x4068d8['reason'],_0x5cc8ed,_0x188285)&&!_0x11c0a7){if(_0x297e94['countbusyretry']+_0x297e94[_0x359c('0x12e')]+_0x297e94[_0x359c('0x12f')]+_0x297e94[_0x359c('0x13a')]+_0x297e94[_0x359c('0xe1')]+_0x297e94[_0x359c('0xf0')]+_0x297e94[_0x359c('0x130')]+_0x297e94[_0x359c('0x131')]>=_0x188285[_0x359c('0x13b')]){_0x20c5cd['stateGlobal'](_0x297e94,_0x20e93d,_0x1f919b,_0x4068d8['reason']);}else{_0x20c5cd[_0x359c('0x135')](_0x297e94,_0x20e93d,_0x1f919b,_0x4068d8[_0x359c('0xc9')]);}}}})[_0x359c('0xa0')](function(){if(_0x11c0a7){hopperUtils[_0x359c('0xec')](_0x297e94,_0x47c9ef,_0x584f90)[_0x359c('0xa0')](function(){return _0x20e93d(0x1);});}});});};Dialer[_0x359c('0x1f')][_0x359c('0x132')]=function(_0x50258f,_0x44ccc4,_0x33609d,_0x30acf5){var _0x3e0d21=new Final(_0x50258f);_0x3e0d21[_0x359c('0xd9')]=0xf;_0x3e0d21['statedesc']='Global';this[_0x359c('0x135')](_0x3e0d21,_0x44ccc4,_0x33609d,_0x30acf5);};Dialer['prototype'][_0x359c('0x135')]=function(_0x49c2eb,_0x35ddd1,_0x144e9b,_0x15c83f){hopperUtils[_0x359c('0xd0')](_0x49c2eb)[_0x359c('0xa0')](function(){return _0x35ddd1(msgResponse('[callProgressDetecting]',_0x359c('0x116'),_0x15c83f));})[_0x359c('0xa3')](function(){return _0x144e9b(msgResponse(_0x359c('0x1c6'),_0x359c('0x96'),_0x359c('0x1c7')));});};Dialer[_0x359c('0x1f')][_0x359c('0xb')]=function(_0x1ca1e0){var _0x275115=_0x1ca1e0[_0x359c('0x1c8')]/0x64;var _0xb0b502=_0x1ca1e0[_0x359c('0x1c9')]/(_0x1ca1e0[_0x359c('0x1c9')]+_0x1ca1e0['outboundAnswerCallsDay']);var _0x221995=Math['round'](_0x1ca1e0[_0x359c('0x1ca')]*(_0x1ca1e0[_0x359c('0x1cb')]/0x64));var _0x3b4020=Math[_0x359c('0x1cc')](_0x1ca1e0[_0x359c('0x1ca')]*(_0x1ca1e0[_0x359c('0x1cd')]/0x64));var _0x37b425=_0x1ca1e0[_0x359c('0x14a')]+_0x1ca1e0[_0x359c('0x14b')];var _0xf03b0c=Math[_0x359c('0x1ce')](_0x1ca1e0[_0x359c('0x5b')]*_0x1ca1e0[_0x359c('0x5f')]*_0x1ca1e0[_0x359c('0x1cf')]*_0x1ca1e0[_0x359c('0x1d0')]);if(_[_0x359c('0x47')](_0x1ca1e0[_0x359c('0x64')])){if(!_[_0x359c('0x47')](_0x1ca1e0['startPredictive'])){_0x1ca1e0[_0x359c('0x2d')]=undefined;loggerPredictive['error'](_0x359c('0x1d1'),'check\x20predictive\x20is\x20not\x20undefine');}if(!_[_0x359c('0x47')](_0x1ca1e0[_0x359c('0x68')])){loggerPredictive['error'](_0x359c('0x1d1'),_0x359c('0x1d2'));clearInterval(_0x1ca1e0[_0x359c('0x68')]);_0x1ca1e0[_0x359c('0x68')]=undefined;}_0x1ca1e0[_0x359c('0x64')]=moment()[_0x359c('0x4a')](_0x359c('0xd5'));loggerPredictive[_0x359c('0x4e')](_0x1ca1e0[_0x359c('0x66')],_0x359c('0x1d3'),_0x1ca1e0[_0x359c('0x64')]);this[_0x359c('0xbc')](_0x1ca1e0,0x1);}else if(ifInterval(_0x1ca1e0[_0x359c('0x1d4')],_0x1ca1e0[_0x359c('0x64')])){this[_0x359c('0xbc')](_0x1ca1e0,0x1);loggerPredictiveCalls[_0x359c('0x4e')](_0x359c('0x1d5'),_0x1ca1e0[_0x359c('0x64')],_0x1ca1e0[_0x359c('0x66')]);_0x1ca1e0[_0x359c('0x5b')]=0x0;_0x1ca1e0[_0x359c('0xd8')]=0x0;}else if(_0x275115<_0xb0b502&&_0x1ca1e0[_0x359c('0x1d6')]==='dropRate'){clearPredictiveAttributes(_0x1ca1e0);loggerPredictive[_0x359c('0x4e')](_0x359c('0x1d7'),_0x359c('0x1d8'),_0xb0b502,_0x359c('0x64'),_0x1ca1e0[_0x359c('0x66')]);}else if(_0xf03b0c<_0x1ca1e0['predictiveIntervalErlangCallsDroppedCalls']&&_0x1ca1e0[_0x359c('0x1d6')]===_0x359c('0x1d9')){clearPredictiveAttributes(_0x1ca1e0);loggerPredictive[_0x359c('0x4e')](_0x359c('0x1da'),_0x359c('0x1db'),_0xf03b0c,_0x359c('0x1dc'),_0x1ca1e0[_0x359c('0xd8')],_0x359c('0x64'),_0x1ca1e0[_0x359c('0x66')]);}else if(!ifInterval(_0x1ca1e0[_0x359c('0x1d4')],_0x1ca1e0['startProgressive'])&&_['isUndefined'](_0x1ca1e0[_0x359c('0x2d')])&&!_['isUndefined'](_0x1ca1e0['startProgressive'])){_0x1ca1e0[_0x359c('0x2d')]=moment()[_0x359c('0x4a')](_0x359c('0xd5'));loggerPredictive['info'](_0x1ca1e0[_0x359c('0x66')],'started\x20in\x20predictive\x20at',_0x1ca1e0['startPredictive']);hopperUtils[_0x359c('0x1dd')](_0x1ca1e0[_0x359c('0x1d4')])[_0x359c('0xa0')](this[_0x359c('0x1de')](_0x1ca1e0))[_0x359c('0xa0')](mergeDataErlangB(_0x1ca1e0))['then'](this[_0x359c('0x1df')](_0x1ca1e0))['catch'](loggerCatchPredictive(_0x359c('0x1e0'),_0x1ca1e0));}else if(!ifInterval(_0x1ca1e0['dialPredictiveInterval'],_0x1ca1e0[_0x359c('0x2d')])){_0x1ca1e0[_0x359c('0xd8')]=0x0;_0x1ca1e0[_0x359c('0x2d')]=moment()[_0x359c('0x4a')](_0x359c('0xd5'));loggerPredictive['info'](_0x1ca1e0[_0x359c('0x66')],_0x359c('0x1e1'),_0x1ca1e0[_0x359c('0x2d')]);clearInterval(_0x1ca1e0[_0x359c('0x68')]);_0x1ca1e0[_0x359c('0x68')]=undefined;hopperUtils['avgHandleTime'](_0x1ca1e0[_0x359c('0x1d4')])['then'](this['getDataPredictive'](_0x1ca1e0))[_0x359c('0xa0')](mergeDataErlangB(_0x1ca1e0))[_0x359c('0xa0')](this['startMethodPredictive'](_0x1ca1e0))[_0x359c('0xa3')](loggerCatchPredictive(_0x359c('0x1e2'),_0x1ca1e0));}else if(_0x1ca1e0[_0x359c('0x1ca')]&&_0x37b425<_0x1ca1e0[_0x359c('0x1ca')]-_0x3b4020){clearPredictiveAttributes(_0x1ca1e0);loggerPredictive['info'](_0x1ca1e0[_0x359c('0x66')],_0x359c('0x1e3'),_0x37b425,_0x359c('0x1e4'),_0x1ca1e0[_0x359c('0x1ca')],'-',_0x3b4020,'=',_0x1ca1e0[_0x359c('0x1ca')]-_0x3b4020,')');}else if(_0x1ca1e0['predictiveIntervalAvailable']&&_0x37b425>_0x1ca1e0[_0x359c('0x1ca')]+_0x221995){clearPredictiveAttributes(_0x1ca1e0);loggerPredictive['info'](_0x1ca1e0[_0x359c('0x66')],_0x359c('0x1e3'),_0x37b425,_0x359c('0x1e5'),_0x1ca1e0[_0x359c('0x1ca')],'+',_0x221995,'=',_0x1ca1e0[_0x359c('0x1ca')]+_0x221995,')');}};Dialer['prototype'][_0x359c('0x1de')]=function(_0xca2db4){var _0x52ac82=this;return function(_0xa01477){return new Promise(function(_0x47dd3b,_0x52287c){_[_0x359c('0x62')](_0xca2db4,_0xa01477[0x0]);if(checkGetDataPredictive(_0xa01477[0x0])){var _0x1d89b5=_0xca2db4[_0x359c('0x1ca')]=_0xca2db4[_0x359c('0x14b')]+_0xca2db4['available'];var _0x165665=_0xca2db4[_0x359c('0x1d4')]*0x3c;var _0x466ef4=_0xa01477[0x0][_0x359c('0x56')]+_0xa01477[0x0][_0x359c('0x57')];var _0x24172b=(_0xa01477[0x0]['predictiveIntervalAnsweredCalls']+_0xa01477[0x0][_0x359c('0xd7')]+_0xa01477[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0xa01477[0x0][_0x359c('0x50')];_0xca2db4['predictiveIntervalHitRate']=_0x24172b>0x0?_0x24172b:0x1;switch(_0xca2db4['dialPredictiveOptimization']){case _0x359c('0x1d9'):var _0x521922=_0xca2db4['dialPredictiveOptimizationPercentage']/0x64;return _0x52ac82['abandonmentRate'](_0x1d89b5,_0x165665,_0x466ef4,_0x24172b,_0x521922)[_0x359c('0xa0')](function(_0x4cc6c6){return _0x47dd3b(_0x4cc6c6);});case _0x359c('0x1e6'):var _0xc3c4d8=_0xca2db4['dialPredictiveOptimizationPercentage']/0x64;return _0x52ac82[_0x359c('0x1e7')](_0x1d89b5,_0x165665,_0x466ef4,_0x24172b,_0xc3c4d8)[_0x359c('0xa0')](function(_0x2e6a92){return _0x47dd3b(_0x2e6a92);});default:return _0x52287c(msgResponse(_0x359c('0x1e8'),'Failure','Unknown\x20Predictive'));}}else{return _0x52287c(msgResponse(_0x359c('0x1e8'),_0x359c('0x96'),'check\x20failure'));}});};};Dialer[_0x359c('0x1f')][_0x359c('0x1e9')]=function(_0x5283f3){var _0x10eb84=this;return function(_0xba7a53){return new Promise(function(_0x45d5da,_0x2959ac){_[_0x359c('0x62')](_0x5283f3,_0xba7a53[0x0]);if(checkGetDataPredictive(_0xba7a53[0x0])){loggerPredictive[_0x359c('0x4e')](JSON[_0x359c('0x89')](_0xba7a53[0x0]));if(_0x5283f3[_0x359c('0x1d6')]===_0x359c('0x1d9')){return _0x10eb84[_0x359c('0x160')](_0x5283f3['id'])[_0x359c('0xa0')](function(_0x1652b0){var _0x1d3cc1=_0x5283f3[_0x359c('0x1ea')]-_0x1652b0[0x0]['outboundQueuePauses'];var _0x5cdcbe=_0x5283f3[_0x359c('0x1d4')]*0x3c;var _0x38f131=_0xba7a53[0x0][_0x359c('0x56')]+_0xba7a53[0x0]['predictiveIntervalAvgHoldtime'];var _0x4853a1=(_0xba7a53[0x0]['predictiveIntervalAnsweredCalls']+_0xba7a53[0x0]['predictiveIntervalDroppedCallsTimeout']+_0xba7a53[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0xba7a53[0x0][_0x359c('0x50')];var _0x365c01=_0x5283f3[_0x359c('0x1c8')]/0x64;_0x5283f3[_0x359c('0x1eb')]=_0x1652b0[0x0][_0x359c('0x1ec')]||0x0;_0x5283f3[_0x359c('0x1cf')]=_0x4853a1>0x0?_0x4853a1:0x1;return _0x10eb84[_0x359c('0x1ed')](_0x1d3cc1,_0x5cdcbe,_0x38f131,_0x4853a1,_0x365c01);})[_0x359c('0xa0')](function(_0x1c64b9){return _0x45d5da(_0x1c64b9);})[_0x359c('0xa3')](function(_0x3390d3){return _0x2959ac(msgResponse(_0x359c('0x1ee'),_0x359c('0x96'),JSON[_0x359c('0x89')](_0x3390d3)));});}if(_0x5283f3[_0x359c('0x1d6')]===_0x359c('0x1e6')){return _0x10eb84['getVoiceQueueRtPauses'](_0x5283f3['id'])[_0x359c('0xa0')](function(_0x2adb03){var _0x383e41=_0x5283f3[_0x359c('0x1ea')]-_0x2adb03[0x0][_0x359c('0x1ec')];var _0x1a3389=_0x5283f3['dialPredictiveInterval']*0x3c;var _0x334526=_0xba7a53[0x0]['predictiveIntervalAvgTalktime']+_0xba7a53[0x0][_0x359c('0x57')];var _0x5a514a=(_0xba7a53[0x0][_0x359c('0x52')]+_0xba7a53[0x0]['predictiveIntervalDroppedCallsTimeout']+_0xba7a53[0x0][_0x359c('0xed')])/_0xba7a53[0x0][_0x359c('0x50')];var _0x47b280=_0x5283f3[_0x359c('0x1c8')]/0x64;_0x5283f3[_0x359c('0x1eb')]=_0x2adb03[0x0][_0x359c('0x1ec')]||0x0;_0x5283f3[_0x359c('0x1cf')]=_0x5a514a>0x0?_0x5a514a:0x1;return _0x10eb84[_0x359c('0x1e7')](_0x383e41,_0x1a3389,_0x334526,_0x5a514a,_0x47b280);})[_0x359c('0xa0')](function(_0x481e8f){return _0x45d5da(_0x481e8f);})[_0x359c('0xa3')](function(_0x42f618){return _0x2959ac(msgResponse(_0x359c('0x1ee'),_0x359c('0x96'),JSON[_0x359c('0x89')](_0x42f618)));});}}else{return _0x2959ac(msgResponse(_0x359c('0x1e8'),_0x359c('0x96'),_0x359c('0x1ef')));}});};};Dialer['prototype']['startMethodPredictive']=function(_0x2a19b0){var _0x3376b6=this;return function(){var _0x5d20c2=0x0;var _0x430e5e=Math['floor'](_0x2a19b0['erlangCallToSecond']*0x3e8);if(_0x430e5e>0x0){_0x430e5e=_0x430e5e<0x64?0x64:_0x430e5e;loggerPredictive[_0x359c('0x4e')](_0x2a19b0['name'],_0x359c('0x1f0'),_0x430e5e,'milliseconds');_0x2a19b0[_0x359c('0x68')]=setInterval(function(){_0x3376b6[_0x359c('0x68')](_0x2a19b0);loggerPredictiveCalls['info'](_0x359c('0x1f1'),_0x5d20c2+=0x1);},_0x430e5e);}else{loggerPredictive[_0x359c('0x4e')](_0x2a19b0['name'],'fail\x20to\x20scheduled\x20calls');}};};Dialer[_0x359c('0x1f')][_0x359c('0x1f2')]=function(_0x23b64d,_0x455bc9){var _0x7adae8=this;return function(_0x890992){if(_[_0x359c('0x4d')](_0x890992)){if(_[_0x359c('0x101')](_0x455bc9[_0x359c('0x165')])||!_0x455bc9['recallme']){if(_0x23b64d[_0x359c('0xbb')]===_0x359c('0xa')){_0x23b64d[_0x359c('0x77')]=_[_0x359c('0x47')](_0x23b64d[_0x359c('0x77')])?!![]:_0x23b64d[_0x359c('0x77')];var _0x37e05e=uuid['v4']();_0x7adae8[_0x359c('0x2a')][_0x37e05e]=new Action(_0x23b64d,_0x455bc9,_0x37e05e);loggerBooked[_0x359c('0x4e')](_0x359c('0x1f3'),_0x37e05e,_0x359c('0x1f4'),JSON[_0x359c('0x89')](_0x23b64d[_0x359c('0x77')]),'Queue:\x20',_0x23b64d[_0x359c('0x66')]);if(_0x23b64d['queueStatusComplete']){_0x23b64d[_0x359c('0x77')]=![];_0x7adae8[_0x359c('0x105')][_0x7adae8[_0x359c('0x2a')][_0x37e05e][_0x359c('0xc6')]]=[];ami['Action']({'actionid':_0x37e05e,'action':_0x359c('0x1f5'),'queue':_0x23b64d[_0x359c('0x66')]})[_0x359c('0xa3')](function(){_0x7adae8['updateOriginated'](_0x23b64d);hopperUtils['rescheduleContact']({'active':![],'ContactId':_0x7adae8[_0x359c('0x2a')][_0x37e05e]['ContactId'],'ListId':_0x7adae8[_0x359c('0x2a')][_0x37e05e][_0x359c('0xf7')],'VoiceQueueId':_0x7adae8[_0x359c('0x2a')][_0x37e05e]['VoiceQueueId']||undefined,'CampaignId':_0x7adae8[_0x359c('0x2a')][_0x37e05e][_0x359c('0xe7')]||undefined})[_0x359c('0xa3')](loggerCatch(_0x359c('0x1f6')));delete _0x7adae8[_0x359c('0x2a')][_0x37e05e];});}else{loggerBooked[_0x359c('0x4e')](_0x359c('0x1f7'),JSON[_0x359c('0x89')](_0x23b64d[_0x359c('0x77')]),'Queue:\x20',_0x23b64d[_0x359c('0x66')]);_0x7adae8[_0x359c('0xd3')](_0x23b64d);hopperUtils[_0x359c('0xf5')]({'active':![],'ContactId':_0x7adae8[_0x359c('0x2a')][_0x37e05e][_0x359c('0xe5')],'ListId':_0x7adae8[_0x359c('0x2a')][_0x37e05e][_0x359c('0xf7')],'VoiceQueueId':_0x7adae8[_0x359c('0x2a')][_0x37e05e][_0x359c('0xe6')]||undefined,'CampaignId':_0x7adae8[_0x359c('0x2a')][_0x37e05e]['CampaignId']||undefined})['catch'](loggerCatch(_0x359c('0x1f6')));delete _0x7adae8[_0x359c('0x2a')][_0x37e05e];}}else{return _0x7adae8[_0x359c('0x16b')](_0x23b64d,_0x455bc9);}}else{if(utils[_0x359c('0x63')](undefined,_0x455bc9[_0x359c('0x1f8')])<_0x23b64d[_0x359c('0x1f9')]*0x3c){if(_0x455bc9[_0x359c('0x159')]&&!_0x455bc9['Agent'][_0x359c('0x1fa')]){_0x7adae8[_0x359c('0x23')][_0x359c('0x110')](_0x455bc9['id'])[_0x359c('0x109')](function(){_0x7adae8[_0x359c('0xd3')](_0x23b64d);});}else{hopperUtils[_0x359c('0x1fb')]({'active':![]},_0x455bc9['id'],0x1)[_0x359c('0x109')](function(){_0x7adae8[_0x359c('0xd3')](_0x23b64d);});}}else{_0x23b64d[_0x359c('0x1fc')]+=0x1;_0x7adae8[_0x359c('0xd3')](_0x23b64d);if(_0x23b64d[_0x359c('0x1fd')]){hopperUtils[_0x359c('0xf5')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x455bc9[_0x359c('0xe5')],'ListId':_0x455bc9[_0x359c('0xf7')],'VoiceQueueId':_0x455bc9[_0x359c('0xe6')]||undefined,'CampaignId':_0x455bc9['CampaignId']||undefined})[_0x359c('0xa3')](loggerCatch(_0x359c('0x1fe')));hopperUtils[_0x359c('0xce')](createObjHistory(_0x23b64d,_0x455bc9,utils[_0x359c('0x71')][_0x359c('0x1ff')],0x17,_0x359c('0x200')))['catch'](loggerCatch(_0x359c('0x201')));}else{_0x7adae8[_0x359c('0x123')](createObjHistory(_0x23b64d,_0x455bc9,utils[_0x359c('0x71')][_0x359c('0x202')],0x16,_0x359c('0x203')),_0x359c('0x204'),_0x359c('0x205'));}}}}else{_0x23b64d['outboundBlacklistCallsDay']+=0x1;_0x7adae8['saveInDb'](createObjHistory(_0x23b64d,_0x455bc9,utils[_0x359c('0x71')][_0x359c('0x206')],0xd,_0x359c('0x207')),'[Originate][historyBlacklist]','[Originate][MoveBlacklist]');throw _0x359c('0x208');}};};Dialer[_0x359c('0x1f')]['handleIvr']=function(_0x207550){var _0x277342=this;var _0x14eeee=_0x207550[_0x359c('0x209')]-_0x207550['originated'];emitCampaignSummary(_0x207550);if(_0x14eeee>0x0&&_0x207550[_0x359c('0x6e')]==0x0){if(_0x14eeee>this[_0x359c('0x28')]){_0x14eeee=this['maxNumberOriginate'];}_0x207550[_0x359c('0x6e')]=0x1;hopperUtils[_0x359c('0x20a')](_0x207550,_0x14eeee)[_0x359c('0xa0')](function(_0x5a7126){_0x207550['temp']=0x0;if(_0x5a7126){if(!utils[_0x359c('0x20b')](_0x5a7126)){_0x207550[_0x359c('0x70')]=utils[_0x359c('0x71')][_0x359c('0x20c')];logger[_0x359c('0x4e')](_0x359c('0x20d')+_0x207550[_0x359c('0x66')]);}else{_0x207550[_0x359c('0x82')]+=_0x5a7126[_0x359c('0x9d')];_0x207550[_0x359c('0x70')]=utils[_0x359c('0x71')]['RUNNING'];for(var _0x4dc3c6=0x0;_0x4dc3c6<_0x5a7126[_0x359c('0x9d')];_0x4dc3c6+=0x1){_0x207550[_0x359c('0x20e')]+=0x1;if(_[_0x359c('0x101')](_0x5a7126[_0x4dc3c6])||_['isNil'](_0x5a7126[_0x4dc3c6][_0x359c('0x185')])||_['isNil'](_0x5a7126[_0x4dc3c6]['phone'])){_0x277342[_0x359c('0x20f')]('[actionOriginate]\x20',_0x207550,_0x5a7126[_0x4dc3c6]);}else{hopperUtils[_0x359c('0x210')](_['pick'](_0x5a7126[_0x4dc3c6],[_0x359c('0xe7'),_0x359c('0x18f')]))[_0x359c('0xa0')](_0x277342[_0x359c('0x1f2')](_0x207550,_0x5a7126[_0x4dc3c6]))[_0x359c('0xa3')](_0x277342[_0x359c('0x164')](_0x359c('0x211'),_0x207550));}}}}})['catch'](loggerGetContactDialer(_0x359c('0x212'),_0x207550,_0x14eeee));}};Dialer[_0x359c('0x1f')][_0x359c('0xbc')]=function(_0x3ce7d6,_0x3f2a37){var _0x1a2623=this;var _0x5d6f6b=[];if(_0x3f2a37<0x1||_0x3ce7d6[_0x359c('0xbb')]===_0x359c('0xa')){_0x3f2a37=0x1;}var _0x3b0162=Math[_0x359c('0x1ce')](_0x3ce7d6[_0x359c('0x14a')]*_0x3f2a37)-_0x3ce7d6['originated'];if(_0x3ce7d6['dialLimitQueue']>0x0){var _0x259d88=_0x3ce7d6['dialLimitQueue']-_0x3ce7d6[_0x359c('0x82')]-_0x3ce7d6[_0x359c('0x14b')]-_0x3ce7d6[_0x359c('0x14c')];if(_0x3b0162>_0x259d88){_0x3b0162=_0x259d88;}}if(_0x3b0162>0x0&&_0x3ce7d6[_0x359c('0x6e')]==0x0){if(_0x3ce7d6[_0x359c('0xbb')]===_0x359c('0xa')){_0x3b0162=0x1;}if(_0x3b0162>this[_0x359c('0x28')]){_0x3b0162=this['maxNumberOriginate'];}for(var _0x51c0b1 in this[_0x359c('0x26')]){if(typeof this[_0x359c('0x26')][_0x51c0b1]!==_0x359c('0xb1')){if(this[_0x359c('0x26')][_0x51c0b1][_0x359c('0xd9')]===_0x359c('0x213')&&this[_0x359c('0x26')][_0x51c0b1][_0x359c('0x8c')]===_0x359c('0x8d')){_0x5d6f6b[_0x359c('0xa4')](this[_0x359c('0x26')][_0x51c0b1]['id']);}}}_0x3ce7d6['temp']=0x1;hopperUtils['getContactDialer'](_0x3ce7d6,_0x5d6f6b,_0x3b0162)[_0x359c('0xa0')](function(_0x83a3c5){_0x3ce7d6[_0x359c('0x6e')]=0x0;if(_0x83a3c5){if(!utils[_0x359c('0x20b')](_0x83a3c5)){hopperUtils['countReScheduled'](_0x3ce7d6)[_0x359c('0xa0')](sendMessageReschedule(_0x3ce7d6))[_0x359c('0xa3')](loggerCatch(_0x359c('0x214')));}else{_0x3ce7d6[_0x359c('0x82')]+=_0x83a3c5[_0x359c('0x9d')];_0x3ce7d6[_0x359c('0x70')]=_0x3ce7d6['dialMethod']===_0x359c('0xa')?utils[_0x359c('0x71')][_0x359c('0x14d')]:utils[_0x359c('0x71')][_0x359c('0x215')];for(var _0x1c390f=0x0;_0x1c390f<_0x83a3c5['length'];_0x1c390f+=0x1){if(_[_0x359c('0x101')](_0x83a3c5[_0x1c390f])||_['isNil'](_0x83a3c5[_0x1c390f]['Contact'])||_['isNil'](_0x83a3c5[_0x1c390f]['phone'])){_0x1a2623[_0x359c('0x20f')]('[actionOriginate]\x20',_0x3ce7d6,_0x83a3c5[_0x1c390f]);}else{hopperUtils[_0x359c('0x216')](_[_0x359c('0x7a')](_0x83a3c5[_0x1c390f],[_0x359c('0xe6'),_0x359c('0x18f')]))[_0x359c('0xa0')](_0x1a2623['checkContactBlack'](_0x3ce7d6,_0x83a3c5[_0x1c390f]))[_0x359c('0xa3')](_0x1a2623[_0x359c('0x164')]('[actionOriginate]\x20',_0x3ce7d6));}}}}})[_0x359c('0xa3')](loggerGetContactDialer('[getContactDialer2]',_0x3ce7d6,_0x3b0162));}};Dialer[_0x359c('0x1f')][_0x359c('0x68')]=function(_0x42564a){if(_0x42564a['dialLimitQueue']>0x0){var _0x32cefa=_0x42564a['dialLimitQueue']-_0x42564a['originated']-_0x42564a['talking'];if(_0x32cefa>0x0&&_0x42564a[_0x359c('0x6e')]==0x0){this[_0x359c('0x217')](_0x42564a);}else{loggerPredictiveCalls[_0x359c('0x4e')](_0x359c('0x218'));}}else{this[_0x359c('0x217')](_0x42564a);}};Dialer[_0x359c('0x1f')][_0x359c('0x217')]=function(_0x2d3174){var _0x352c30=this;var _0x494787=[];_0x2d3174['originated']+=0x1;for(var _0x465b9d in this['agents']){if(typeof this[_0x359c('0x26')][_0x465b9d]!==_0x359c('0xb1')){if(this['agents'][_0x465b9d][_0x359c('0xd9')]===_0x359c('0x213')&&this[_0x359c('0x26')][_0x465b9d][_0x359c('0x8c')]===_0x359c('0x8d')){_0x494787[_0x359c('0xa4')](this['agents'][_0x465b9d]['id']);}}}_0x2d3174[_0x359c('0x6e')]=0x1;return this[_0x359c('0x219')](_0x2d3174['id'],_0x494787,0x1,_0x2d3174['dialOrderByScheduledAt'],_0x2d3174)[_0x359c('0xa0')](function(_0x12f29a){_0x2d3174[_0x359c('0x6e')]=0x1;if(_0x12f29a){if(!utils[_0x359c('0x20b')](_0x12f29a)){utils[_0x359c('0x6d')](_0x2d3174,0x1,0x0);return hopperUtils[_0x359c('0x21a')](_0x2d3174)['then'](sendMessageReschedule(_0x2d3174))[_0x359c('0xa3')](loggerCatch(_0x359c('0x214')));}else{_0x2d3174[_0x359c('0x70')]=utils[_0x359c('0x71')][_0x359c('0x215')];if(_[_0x359c('0x101')](_0x12f29a[0x0])||_[_0x359c('0x101')](_0x12f29a[0x0][_0x359c('0x185')])||_[_0x359c('0x101')](_0x12f29a[0x0]['phone'])){_0x352c30[_0x359c('0x20f')](_0x359c('0x21b'),_0x2d3174,_0x12f29a[0x0]);}else{return hopperUtils[_0x359c('0x216')](_[_0x359c('0x7a')](_0x12f29a[0x0],[_0x359c('0xe6'),'phone']))[_0x359c('0xa0')](_0x352c30[_0x359c('0x1f2')](_0x2d3174,_0x12f29a[0x0]))[_0x359c('0xa3')](_0x352c30[_0x359c('0x164')](_0x359c('0x21c'),_0x2d3174));}}}})[_0x359c('0xa3')](loggerGetContactDialer(_0x359c('0x21d'),_0x2d3174,0x1));};Dialer[_0x359c('0x1f')][_0x359c('0x1ed')]=function(_0x5a4d7c,_0x3f9705,_0x265436,_0x3ba32d,_0x17f110,_0x396161){loggerPredictive[_0x359c('0x4e')](_0x359c('0x21e'));loggerPredictive['info'](_0x359c('0x21f'),_0x5a4d7c);loggerPredictive[_0x359c('0x4e')](_0x359c('0x220'),_0x3f9705);loggerPredictive[_0x359c('0x4e')](_0x359c('0x221'),_0x265436);loggerPredictive[_0x359c('0x4e')]('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',_0x3ba32d);loggerPredictive[_0x359c('0x4e')](_0x359c('0x222'),_0x17f110);loggerPredictive['info']('---------------------------');return new Promise(function(_0x9f306b,_0x17a54b){if(_0x5a4d7c<=0x0||isNaN(_0x5a4d7c)){return _0x17a54b(msgResponse('[abandonmentRate]',_0x359c('0x88'),_0x359c('0x223')+_0x5a4d7c));}if(_0x265436<=0x0||isNaN(_0x265436)){return _0x17a54b(msgResponse(_0x359c('0x224'),_0x359c('0x88'),_0x359c('0x225')+_0x265436));}if(_0x3ba32d<=0x0||isNaN(_0x3ba32d)){return _0x17a54b(msgResponse(_0x359c('0x224'),'Error','p\x20=\x20'+_0x3ba32d));}if(_0x3f9705<=0x0||isNaN(_0x3f9705)){return _0x17a54b(msgResponse(_0x359c('0x224'),_0x359c('0x88'),_0x359c('0x226')+_0x3f9705));}if(_0x17f110<=0x0||isNaN(_0x17f110)){return _0x17a54b(msgResponse(_0x359c('0x224'),_0x359c('0x88'),'Amax\x20=\x20'+_0x17f110));}_0x396161=_0x396161||0x0;var _0x46430b=0x1/_0x265436;var _0x554695=0x0;var _0x43625a=0x0;var _0x457c4f=0x0;var _0x2ec502=0x0;for(var _0x497e15=0x0;_0x457c4f<_0x17f110;_0x497e15+=0x1){_0x43625a=_0x497e15/_0x3f9705;_0x554695=(_0x3ba32d*_0x43625a+_0x396161)/_0x46430b;_0x457c4f=utils['erlangb'](_0x554695,_0x5a4d7c);_0x2ec502=_0x554695/_0x5a4d7c*(0x1-utils[_0x359c('0x227')](_0x554695,_0x5a4d7c));}return _0x9f306b({'erlangCalls':_0x497e15,'erlangCallToSecond':_0x3f9705/_0x497e15,'erlangAbandonmentRate':_0x457c4f,'erlangBusyFactor':_0x2ec502});});};Dialer[_0x359c('0x1f')][_0x359c('0x1e7')]=function(_0x3d3cab,_0x336cfa,_0x393fb6,_0x5e9f64,_0x46b4af,_0x1d1dd2){loggerPredictive[_0x359c('0x4e')](_0x359c('0x228'));loggerPredictive[_0x359c('0x4e')]('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',_0x3d3cab);loggerPredictive[_0x359c('0x4e')](_0x359c('0x220'),_0x336cfa);loggerPredictive[_0x359c('0x4e')](_0x359c('0x221'),_0x393fb6);loggerPredictive[_0x359c('0x4e')](_0x359c('0x229'),_0x5e9f64);loggerPredictive['info'](_0x359c('0x22a'),_0x46b4af);loggerPredictive[_0x359c('0x4e')]('---------------------------');return new Promise(function(_0x4fe9b2,_0x23a237){if(_0x3d3cab<=0x0||isNaN(_0x3d3cab)){return _0x23a237(msgResponse(_0x359c('0x22b'),_0x359c('0x88'),_0x359c('0x223')+_0x3d3cab));}if(_0x393fb6<=0x0||isNaN(_0x393fb6)){return _0x23a237(msgResponse(_0x359c('0x22b'),_0x359c('0x88'),_0x359c('0x225')+_0x393fb6));}if(_0x5e9f64<=0x0||isNaN(_0x5e9f64)){return _0x23a237(msgResponse('[busyFactor]',_0x359c('0x88'),_0x359c('0x22c')+_0x5e9f64));}if(_0x336cfa<=0x0||isNaN(_0x336cfa)){return _0x23a237(msgResponse('[busyFactor]',_0x359c('0x88'),_0x359c('0x226')+_0x336cfa));}if(_0x46b4af<=0x0||isNaN(_0x46b4af)){return _0x23a237(msgResponse('[busyFactor]',_0x359c('0x88'),'Umin\x20=\x20'+_0x46b4af));}_0x1d1dd2=_0x1d1dd2||0x0;var _0x265f3a=0x1/_0x393fb6;var _0x56b4de=0x0;var _0xce640=0x0;var _0x3d104a=0x0;var _0x97ef51=0x0;for(var _0x5f5dfa=0x0;_0x97ef51<_0x46b4af;_0x5f5dfa+=0x1){_0xce640=_0x5f5dfa/_0x336cfa;_0x56b4de=(_0x5e9f64*_0xce640+_0x1d1dd2)/_0x265f3a;_0x3d104a=utils[_0x359c('0x227')](_0x56b4de,_0x3d3cab);_0x97ef51=_0x56b4de/_0x3d3cab*(0x1-utils['erlangb'](_0x56b4de,_0x3d3cab));}return _0x4fe9b2({'erlangCalls':_0x5f5dfa,'erlangCallToSecond':_0x336cfa/_0x5f5dfa,'erlangAbandonmentRate':_0x3d104a,'erlangBusyFactor':_0x97ef51});});};module[_0x359c('0x22d')]=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 4bcd25b..f21b595 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 _0xc6f0=['lastName','number','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','ContactId','UserId','VoiceQueueId','CampaignId','ContactFirstName','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','substring','getQueue','exports','util','lodash','moment','isNil','string','voiceQueue','name','Contact','phone','firstName'];(function(_0x23c651,_0x143982){var _0xbe7bdb=function(_0x1979e2){while(--_0x1979e2){_0x23c651['push'](_0x23c651['shift']());}};_0xbe7bdb(++_0x143982);}(_0xc6f0,0x7a));var _0x0c6f=function(_0x530a58,_0x7d6123){_0x530a58=_0x530a58-0x0;var _0x5124e9=_0xc6f0[_0x530a58];return _0x5124e9;};'use strict';var util=require(_0x0c6f('0x0'));var _=require(_0x0c6f('0x1'));var moment=require(_0x0c6f('0x2'));function checkNameSurname(_0x10b4a2,_0x1b1152,_0x47d920){var _0x2b024b='';if(!_[_0x0c6f('0x3')](_0x1b1152)&&_0x0c6f('0x4')===typeof _0x1b1152){_0x2b024b+=_0x1b1152;}if(!_[_0x0c6f('0x3')](_0x47d920)&&_0x0c6f('0x4')===typeof _0x47d920){_0x2b024b+='\x20'+_0x47d920;}if(_0x2b024b!==''){return _0x2b024b;}return _0x10b4a2;}function Action(_0x4815e5,_0x54f9c9,_0x3a1773){this[_0x0c6f('0x5')]=_0x4815e5;this['uniqueid']=_0x3a1773||undefined;this[_0x0c6f('0x6')]=checkNameSurname(_0x54f9c9[_0x0c6f('0x7')][_0x0c6f('0x8')],_0x54f9c9[_0x0c6f('0x7')][_0x0c6f('0x9')],_0x54f9c9[_0x0c6f('0x7')][_0x0c6f('0xa')]);this[_0x0c6f('0xb')]=_0x54f9c9[_0x0c6f('0x8')];this[_0x0c6f('0xc')]=_0x4815e5[_0x0c6f('0x6')];this[_0x0c6f('0xd')]=_0x54f9c9['active']||![];this[_0x0c6f('0xe')]=_0x4815e5[_0x0c6f('0xe')];this[_0x0c6f('0xf')]=_0x4815e5[_0x0c6f('0xf')]||0x3;this['scheduledat']=_0x54f9c9[_0x0c6f('0x10')];this['countbusyretry']=_0x54f9c9[_0x0c6f('0x11')];this[_0x0c6f('0x12')]=_0x54f9c9['countcongestionretry'];this['countnoanswerretry']=_0x54f9c9[_0x0c6f('0x13')];this[_0x0c6f('0x14')]=_0x54f9c9[_0x0c6f('0x14')];this[_0x0c6f('0x15')]=_0x54f9c9['countdropretry'];this['countabandonedretry']=_0x54f9c9['countabandonedretry'];this[_0x0c6f('0x16')]=_0x54f9c9['countmachineretry'];this[_0x0c6f('0x17')]=_0x54f9c9['countagentrejectretry'];this[_0x0c6f('0x18')]=_0x54f9c9[_0x0c6f('0x18')];this['ListId']=_0x54f9c9['ListId'];this[_0x0c6f('0x19')]=_0x54f9c9[_0x0c6f('0x19')];this[_0x0c6f('0x1a')]=_0x54f9c9['VoiceQueueId'];this[_0x0c6f('0x1b')]=_0x54f9c9[_0x0c6f('0x1b')];this['idHopper']=_0x54f9c9['id'];this[_0x0c6f('0x1c')]=_0x54f9c9['Contact'][_0x0c6f('0x9')]||'';this['starttime']=moment()[_0x0c6f('0x1d')](_0x0c6f('0x1e'));this['callback']=_0x54f9c9[_0x0c6f('0x1f')];this[_0x0c6f('0x20')]=_0x54f9c9[_0x0c6f('0x20')];this[_0x0c6f('0x21')]=_0x54f9c9['callbackat'];this[_0x0c6f('0x22')]=_0x54f9c9[_0x0c6f('0x22')];this[_0x0c6f('0x23')]='';this[_0x0c6f('0x24')]='';}Action[_0x0c6f('0x25')][_0x0c6f('0x26')]=function(){return util[_0x0c6f('0x1d')](_0x0c6f('0x27'),this['name'],this[_0x0c6f('0x5')][_0x0c6f('0x28')]>0x0?this[_0x0c6f('0xb')][_0x0c6f('0x29')](this[_0x0c6f('0x5')]['dialCutDigit']):this[_0x0c6f('0xb')]);};Action[_0x0c6f('0x25')][_0x0c6f('0x2a')]=function(){return this['queue'];};module[_0x0c6f('0x2b')]=Action; \ No newline at end of file +var _0x1de1=['voiceQueue','uniqueid','phone','Contact','firstName','lastName','queue','active','type','dialQueueTimeout','scheduledat','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','format','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','prototype','name','dialCutDigit','number','getQueue','exports','util','moment','isNil','string'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x1de1,0x1ca));var _0x11de=function(_0x5efebc,_0xf36d8){_0x5efebc=_0x5efebc-0x0;var _0x5d3f9c=_0x1de1[_0x5efebc];return _0x5d3f9c;};'use strict';var util=require(_0x11de('0x0'));var _=require('lodash');var moment=require(_0x11de('0x1'));function checkNameSurname(_0x1d308b,_0x1995c9,_0x1b7392){var _0x2d5165='';if(!_['isNil'](_0x1995c9)&&'string'===typeof _0x1995c9){_0x2d5165+=_0x1995c9;}if(!_[_0x11de('0x2')](_0x1b7392)&&_0x11de('0x3')===typeof _0x1b7392){_0x2d5165+='\x20'+_0x1b7392;}if(_0x2d5165!==''){return _0x2d5165;}return _0x1d308b;}function Action(_0x5755df,_0x356adf,_0x279080){this[_0x11de('0x4')]=_0x5755df;this[_0x11de('0x5')]=_0x279080||undefined;this['name']=checkNameSurname(_0x356adf['Contact'][_0x11de('0x6')],_0x356adf[_0x11de('0x7')][_0x11de('0x8')],_0x356adf[_0x11de('0x7')][_0x11de('0x9')]);this['number']=_0x356adf[_0x11de('0x6')];this[_0x11de('0xa')]=_0x5755df['name'];this[_0x11de('0xb')]=_0x356adf[_0x11de('0xb')]||![];this[_0x11de('0xc')]=_0x5755df[_0x11de('0xc')];this[_0x11de('0xd')]=_0x5755df[_0x11de('0xd')]||0x3;this[_0x11de('0xe')]=_0x356adf['scheduledat'];this['countbusyretry']=_0x356adf['countbusyretry'];this['countcongestionretry']=_0x356adf[_0x11de('0xf')];this['countnoanswerretry']=_0x356adf[_0x11de('0x10')];this[_0x11de('0x11')]=_0x356adf['countnosuchnumberretry'];this[_0x11de('0x12')]=_0x356adf[_0x11de('0x12')];this[_0x11de('0x13')]=_0x356adf[_0x11de('0x13')];this[_0x11de('0x14')]=_0x356adf[_0x11de('0x14')];this[_0x11de('0x15')]=_0x356adf[_0x11de('0x15')];this[_0x11de('0x16')]=_0x356adf[_0x11de('0x16')];this[_0x11de('0x17')]=_0x356adf[_0x11de('0x17')];this[_0x11de('0x18')]=_0x356adf[_0x11de('0x18')];this[_0x11de('0x19')]=_0x356adf[_0x11de('0x19')];this[_0x11de('0x1a')]=_0x356adf[_0x11de('0x1a')];this[_0x11de('0x1b')]=_0x356adf['id'];this[_0x11de('0x1c')]=_0x356adf[_0x11de('0x7')][_0x11de('0x8')]||'';this[_0x11de('0x1d')]=moment()[_0x11de('0x1e')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x11de('0x1f')]=_0x356adf[_0x11de('0x1f')];this[_0x11de('0x20')]=_0x356adf['callbackuniqueid'];this[_0x11de('0x21')]=_0x356adf[_0x11de('0x21')];this[_0x11de('0x22')]=_0x356adf[_0x11de('0x22')];this[_0x11de('0x23')]='';this['originatecalleridname']='';}Action[_0x11de('0x24')]['getCaller']=function(){return util['format']('\x22%s\x22\x20<%s>',this[_0x11de('0x25')],this[_0x11de('0x4')][_0x11de('0x26')]>0x0?this[_0x11de('0x27')]['substring'](this[_0x11de('0x4')][_0x11de('0x26')]):this[_0x11de('0x27')]);};Action[_0x11de('0x24')][_0x11de('0x28')]=function(){return this[_0x11de('0xa')];};module[_0x11de('0x29')]=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 4ab19c0..2a1f3be 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 _0x7b67=['queue','membername','reason','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','agiafterat','exports','../utils','state','statedesc','scheduledat','type','campaigntype','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','calleridnum','number','starttime','responsetime','answertime','endtime','YYYY-MM-DD\x20HH:mm:ss','getSeconds','holdtime','talktime'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0x7b67,0xfe));var _0x77b6=function(_0x413c7b,_0x1b9015){_0x413c7b=_0x413c7b-0x0;var _0x41b9b2=_0x7b67[_0x413c7b];return _0x41b9b2;};'use strict';var moment=require('moment');var utils=require(_0x77b6('0x0'));function AgentComplete(_0x1c2a55,_0xc1d045){this[_0x77b6('0x1')]=0x4;this[_0x77b6('0x2')]='Answer';this['scheduledat']=_0x1c2a55[_0x77b6('0x3')];this[_0x77b6('0x4')]=_0x1c2a55[_0x77b6('0x4')];this[_0x77b6('0x5')]=_0x1c2a55[_0x77b6('0x4')]==='outbound'?'queue':_0x1c2a55[_0x77b6('0x4')];this[_0x77b6('0x6')]=_0x1c2a55['countbusyretry'];this[_0x77b6('0x7')]=_0x1c2a55[_0x77b6('0x7')];this[_0x77b6('0x8')]=_0x1c2a55['countnoanswerretry'];this[_0x77b6('0x9')]=_0x1c2a55[_0x77b6('0x6')]+_0x1c2a55[_0x77b6('0x7')]+_0x1c2a55[_0x77b6('0x8')]+_0x1c2a55['countnosuchnumberretry']+_0x1c2a55[_0x77b6('0xa')]+_0x1c2a55[_0x77b6('0xb')]+_0x1c2a55[_0x77b6('0xc')]+_0x1c2a55[_0x77b6('0xd')];this[_0x77b6('0xe')]=_0x1c2a55[_0x77b6('0xe')];this[_0x77b6('0xa')]=_0x1c2a55[_0x77b6('0xa')];this['countabandonedretry']=_0x1c2a55[_0x77b6('0xb')];this[_0x77b6('0xc')]=_0x1c2a55[_0x77b6('0xc')];this[_0x77b6('0xd')]=_0x1c2a55['countagentrejectretry'];this[_0x77b6('0xf')]=_0xc1d045[_0x77b6('0xf')];this['calleridname']=_0x1c2a55['name'];this[_0x77b6('0x10')]=_0x1c2a55[_0x77b6('0x11')];this[_0x77b6('0x12')]=_0x1c2a55['starttime'];this['responsetime']=_0x1c2a55[_0x77b6('0x13')];this['answertime']=_0x1c2a55[_0x77b6('0x14')];this[_0x77b6('0x15')]=moment()['format'](_0x77b6('0x16'));this['ringtime']=utils[_0x77b6('0x17')](_0x1c2a55[_0x77b6('0x13')],_0x1c2a55[_0x77b6('0x12')]);this[_0x77b6('0x18')]=utils['getSeconds'](_0x1c2a55[_0x77b6('0x14')],_0x1c2a55[_0x77b6('0x13')]);this[_0x77b6('0x19')]=utils[_0x77b6('0x17')](this[_0x77b6('0x15')],_0x1c2a55[_0x77b6('0x14')]);this[_0x77b6('0x1a')]=_0xc1d045[_0x77b6('0x1a')];this[_0x77b6('0x1b')]=_0xc1d045[_0x77b6('0x1b')];this[_0x77b6('0x1c')]=_0xc1d045[_0x77b6('0x1c')];this[_0x77b6('0x1d')]=_0x1c2a55['callback'];this[_0x77b6('0x1e')]=_0x1c2a55[_0x77b6('0x1e')];this['callbackat']=_0x1c2a55['callbackat'];this[_0x77b6('0x1f')]=_0x1c2a55[_0x77b6('0x1f')];this[_0x77b6('0x20')]=_0x1c2a55[_0x77b6('0x20')];this[_0x77b6('0x21')]=_0x1c2a55[_0x77b6('0x21')];this[_0x77b6('0x22')]=_0x1c2a55[_0x77b6('0x22')];this['VoiceQueueId']=_0x1c2a55[_0x77b6('0x23')];this['CampaignId']=_0x1c2a55['CampaignId'];this[_0x77b6('0x24')]=_0x1c2a55[_0x77b6('0x24')]||'';this[_0x77b6('0x25')]=_0x1c2a55['originatecalleridname']||'';this[_0x77b6('0x26')]=_0x1c2a55[_0x77b6('0x26')];}module[_0x77b6('0x27')]=AgentComplete; \ No newline at end of file +var _0xbf24=['CampaignId','originatecalleridnum','originatecalleridname','agiafterat','moment','../utils','state','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','name','calleridnum','starttime','responsetime','answertime','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','getSeconds','endtime','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId'];(function(_0x34bc30,_0x177cb0){var _0x5706de=function(_0x535a8c){while(--_0x535a8c){_0x34bc30['push'](_0x34bc30['shift']());}};_0x5706de(++_0x177cb0);}(_0xbf24,0x1d2));var _0x4bf2=function(_0x5cb1a5,_0x13016f){_0x5cb1a5=_0x5cb1a5-0x0;var _0x533f56=_0xbf24[_0x5cb1a5];return _0x533f56;};'use strict';var moment=require(_0x4bf2('0x0'));var utils=require(_0x4bf2('0x1'));function AgentComplete(_0x156fcf,_0x355774){this[_0x4bf2('0x2')]=0x4;this['statedesc']='Answer';this[_0x4bf2('0x3')]=_0x156fcf['scheduledat'];this[_0x4bf2('0x4')]=_0x156fcf[_0x4bf2('0x4')];this[_0x4bf2('0x5')]=_0x156fcf['type']===_0x4bf2('0x6')?_0x4bf2('0x7'):_0x156fcf[_0x4bf2('0x4')];this[_0x4bf2('0x8')]=_0x156fcf[_0x4bf2('0x8')];this['countcongestionretry']=_0x156fcf[_0x4bf2('0x9')];this[_0x4bf2('0xa')]=_0x156fcf[_0x4bf2('0xa')];this[_0x4bf2('0xb')]=_0x156fcf[_0x4bf2('0x8')]+_0x156fcf[_0x4bf2('0x9')]+_0x156fcf[_0x4bf2('0xa')]+_0x156fcf[_0x4bf2('0xc')]+_0x156fcf[_0x4bf2('0xd')]+_0x156fcf[_0x4bf2('0xe')]+_0x156fcf[_0x4bf2('0xf')]+_0x156fcf[_0x4bf2('0x10')];this[_0x4bf2('0xc')]=_0x156fcf[_0x4bf2('0xc')];this['countdropretry']=_0x156fcf[_0x4bf2('0xd')];this['countabandonedretry']=_0x156fcf[_0x4bf2('0xe')];this[_0x4bf2('0xf')]=_0x156fcf[_0x4bf2('0xf')];this[_0x4bf2('0x10')]=_0x156fcf[_0x4bf2('0x10')];this[_0x4bf2('0x11')]=_0x355774[_0x4bf2('0x11')];this['calleridname']=_0x156fcf[_0x4bf2('0x12')];this[_0x4bf2('0x13')]=_0x156fcf['number'];this[_0x4bf2('0x14')]=_0x156fcf[_0x4bf2('0x14')];this[_0x4bf2('0x15')]=_0x156fcf['responsetime'];this[_0x4bf2('0x16')]=_0x156fcf[_0x4bf2('0x16')];this['endtime']=moment()['format'](_0x4bf2('0x17'));this[_0x4bf2('0x18')]=utils['getSeconds'](_0x156fcf[_0x4bf2('0x15')],_0x156fcf[_0x4bf2('0x14')]);this[_0x4bf2('0x19')]=utils['getSeconds'](_0x156fcf['answertime'],_0x156fcf[_0x4bf2('0x15')]);this[_0x4bf2('0x1a')]=utils[_0x4bf2('0x1b')](this[_0x4bf2('0x1c')],_0x156fcf[_0x4bf2('0x16')]);this['queue']=_0x355774[_0x4bf2('0x7')];this['membername']=_0x355774['membername'];this[_0x4bf2('0x1d')]=_0x355774[_0x4bf2('0x1d')];this[_0x4bf2('0x1e')]=_0x156fcf['callback'];this['callbackuniqueid']=_0x156fcf[_0x4bf2('0x1f')];this[_0x4bf2('0x20')]=_0x156fcf[_0x4bf2('0x20')];this[_0x4bf2('0x21')]=_0x156fcf[_0x4bf2('0x21')];this[_0x4bf2('0x22')]=_0x156fcf['ContactId'];this[_0x4bf2('0x23')]=_0x156fcf[_0x4bf2('0x23')];this[_0x4bf2('0x24')]=_0x156fcf['UserId'];this[_0x4bf2('0x25')]=_0x156fcf[_0x4bf2('0x25')];this[_0x4bf2('0x26')]=_0x156fcf[_0x4bf2('0x26')];this[_0x4bf2('0x27')]=_0x156fcf[_0x4bf2('0x27')]||'';this[_0x4bf2('0x28')]=_0x156fcf[_0x4bf2('0x28')]||'';this['agiafterat']=_0x156fcf[_0x4bf2('0x29')];}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 2d3962f..fb67f40 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 _0x4a4a=['campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','calleridname','calleridnum','starttime','responsetime','endtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type'];(function(_0x19b448,_0x4a9ac3){var _0xc0a720=function(_0x28b83e){while(--_0x28b83e){_0x19b448['push'](_0x19b448['shift']());}};_0xc0a720(++_0x4a9ac3);}(_0x4a4a,0xf9));var _0xa4a4=function(_0xb23b1d,_0x41e2de){_0xb23b1d=_0xb23b1d-0x0;var _0x297e6b=_0x4a4a[_0xb23b1d];return _0x297e6b;};'use strict';function Final(_0x56fe25){this[_0xa4a4('0x0')]=_0x56fe25[_0xa4a4('0x0')];this['scheduledat']=_0x56fe25[_0xa4a4('0x1')];this[_0xa4a4('0x2')]=_0x56fe25[_0xa4a4('0x2')];this[_0xa4a4('0x3')]=_0x56fe25[_0xa4a4('0x2')]===_0xa4a4('0x4')?_0xa4a4('0x5'):_0x56fe25[_0xa4a4('0x2')];this['countbusyretry']=_0x56fe25[_0xa4a4('0x6')];this[_0xa4a4('0x7')]=_0x56fe25['countcongestionretry'];this[_0xa4a4('0x8')]=_0x56fe25[_0xa4a4('0x8')];this[_0xa4a4('0x9')]=_0x56fe25[_0xa4a4('0x6')]+_0x56fe25[_0xa4a4('0x7')]+_0x56fe25['countnoanswerretry']+_0x56fe25[_0xa4a4('0xa')]+_0x56fe25[_0xa4a4('0xb')]+_0x56fe25['countabandonedretry']+_0x56fe25[_0xa4a4('0xc')]+_0x56fe25[_0xa4a4('0xd')];this[_0xa4a4('0xa')]=_0x56fe25[_0xa4a4('0xa')];this[_0xa4a4('0xb')]=_0x56fe25[_0xa4a4('0xb')];this[_0xa4a4('0xe')]=_0x56fe25[_0xa4a4('0xe')];this['countmachineretry']=_0x56fe25[_0xa4a4('0xc')];this['countagentrejectretry']=_0x56fe25[_0xa4a4('0xd')];this[_0xa4a4('0x5')]=_0x56fe25[_0xa4a4('0x5')];this[_0xa4a4('0xf')]=_0x56fe25['calleridname'];this['calleridnum']=_0x56fe25[_0xa4a4('0x10')];this[_0xa4a4('0x11')]=_0x56fe25[_0xa4a4('0x11')];this['responsetime']=_0x56fe25[_0xa4a4('0x12')];this[_0xa4a4('0x13')]=_0x56fe25['responsetime'];this['ringtime']=_0x56fe25['ringtime']||0x0;this['holdtime']=_0x56fe25[_0xa4a4('0x14')]||0x0;this[_0xa4a4('0x15')]=_0x56fe25['talktime']||0x0;this[_0xa4a4('0x16')]=_0x56fe25['callback'];this[_0xa4a4('0x17')]=_0x56fe25[_0xa4a4('0x17')];this[_0xa4a4('0x18')]=_0x56fe25[_0xa4a4('0x18')];this[_0xa4a4('0x19')]=_0x56fe25[_0xa4a4('0x19')];this[_0xa4a4('0x1a')]=_0x56fe25[_0xa4a4('0x1a')];this[_0xa4a4('0x1b')]=_0x56fe25['ListId'];this['UserId']=_0x56fe25[_0xa4a4('0x1c')];this[_0xa4a4('0x1d')]=_0x56fe25[_0xa4a4('0x1d')];this[_0xa4a4('0x1e')]=_0x56fe25[_0xa4a4('0x1e')];this[_0xa4a4('0x1f')]=_0x56fe25[_0xa4a4('0x1f')]||'';this['originatecalleridname']=_0x56fe25[_0xa4a4('0x20')]||'';this[_0xa4a4('0x21')]=_0x56fe25[_0xa4a4('0x21')];this[_0xa4a4('0x22')]=_0x56fe25['statedesc'];}module[_0xa4a4('0x23')]=Final; \ No newline at end of file +var _0x05c0=['callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime'];(function(_0x4d47f7,_0x35a2fc){var _0xddfe38=function(_0x11c983){while(--_0x11c983){_0x4d47f7['push'](_0x4d47f7['shift']());}};_0xddfe38(++_0x35a2fc);}(_0x05c0,0x94));var _0x005c=function(_0x23c226,_0x474083){_0x23c226=_0x23c226-0x0;var _0x45e205=_0x05c0[_0x23c226];return _0x45e205;};'use strict';function Final(_0x598a20){this[_0x005c('0x0')]=_0x598a20[_0x005c('0x0')];this[_0x005c('0x1')]=_0x598a20[_0x005c('0x1')];this[_0x005c('0x2')]=_0x598a20['type'];this[_0x005c('0x3')]=_0x598a20[_0x005c('0x2')]==='outbound'?_0x005c('0x4'):_0x598a20['type'];this[_0x005c('0x5')]=_0x598a20[_0x005c('0x5')];this[_0x005c('0x6')]=_0x598a20[_0x005c('0x6')];this[_0x005c('0x7')]=_0x598a20[_0x005c('0x7')];this[_0x005c('0x8')]=_0x598a20[_0x005c('0x5')]+_0x598a20[_0x005c('0x6')]+_0x598a20[_0x005c('0x7')]+_0x598a20[_0x005c('0x9')]+_0x598a20[_0x005c('0xa')]+_0x598a20[_0x005c('0xb')]+_0x598a20[_0x005c('0xc')]+_0x598a20['countagentrejectretry'];this[_0x005c('0x9')]=_0x598a20[_0x005c('0x9')];this[_0x005c('0xa')]=_0x598a20[_0x005c('0xa')];this[_0x005c('0xb')]=_0x598a20[_0x005c('0xb')];this[_0x005c('0xc')]=_0x598a20[_0x005c('0xc')];this[_0x005c('0xd')]=_0x598a20[_0x005c('0xd')];this[_0x005c('0x4')]=_0x598a20[_0x005c('0x4')];this['calleridname']=_0x598a20[_0x005c('0xe')];this[_0x005c('0xf')]=_0x598a20['calleridnum'];this[_0x005c('0x10')]=_0x598a20[_0x005c('0x10')];this[_0x005c('0x11')]=_0x598a20[_0x005c('0x11')];this[_0x005c('0x12')]=_0x598a20['responsetime'];this[_0x005c('0x13')]=_0x598a20[_0x005c('0x13')]||0x0;this[_0x005c('0x14')]=_0x598a20[_0x005c('0x14')]||0x0;this[_0x005c('0x15')]=_0x598a20[_0x005c('0x15')]||0x0;this['callback']=_0x598a20[_0x005c('0x16')];this['callbackuniqueid']=_0x598a20['callbackuniqueid'];this['callbackat']=_0x598a20[_0x005c('0x17')];this[_0x005c('0x18')]=_0x598a20[_0x005c('0x18')];this[_0x005c('0x19')]=_0x598a20[_0x005c('0x19')];this[_0x005c('0x1a')]=_0x598a20[_0x005c('0x1a')];this[_0x005c('0x1b')]=_0x598a20[_0x005c('0x1b')];this[_0x005c('0x1c')]=_0x598a20[_0x005c('0x1c')];this[_0x005c('0x1d')]=_0x598a20[_0x005c('0x1d')];this[_0x005c('0x1e')]=_0x598a20[_0x005c('0x1e')]||'';this[_0x005c('0x1f')]=_0x598a20[_0x005c('0x1f')]||'';this[_0x005c('0x20')]=_0x598a20[_0x005c('0x20')];this[_0x005c('0x21')]=_0x598a20['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 8d12b4f..b647716 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 _0xa8bf=['../utils','state','Answer','scheduledat','type','campaigntype','outbound','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countabandonedretry','countagentrejectretry','countnosuchnumberretry','countmachineretry','uniqueid','calleridnum','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','getSeconds','holdtime','talktime','membername','IVR','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','moment'];(function(_0x2f7235,_0x28d27c){var _0x130c1c=function(_0x209b98){while(--_0x209b98){_0x2f7235['push'](_0x2f7235['shift']());}};_0x130c1c(++_0x28d27c);}(_0xa8bf,0x1c2));var _0xfa8b=function(_0x32cc05,_0x106d41){_0x32cc05=_0x32cc05-0x0;var _0x445e74=_0xa8bf[_0x32cc05];return _0x445e74;};'use strict';var moment=require(_0xfa8b('0x0'));var utils=require(_0xfa8b('0x1'));function Hangup(_0x105a0a,_0x333769){this[_0xfa8b('0x2')]=0x4;this['statedesc']=_0xfa8b('0x3');this['scheduledat']=_0x105a0a[_0xfa8b('0x4')];this[_0xfa8b('0x5')]=_0x105a0a['type'];this[_0xfa8b('0x6')]=_0x105a0a[_0xfa8b('0x5')]===_0xfa8b('0x7')?_0xfa8b('0x8'):_0x105a0a['type'];this['amd']=_0x105a0a[_0xfa8b('0x9')]||![];this[_0xfa8b('0xa')]=_0x105a0a[_0xfa8b('0xa')];this[_0xfa8b('0xb')]=_0x105a0a['countcongestionretry'];this[_0xfa8b('0xc')]=_0x105a0a[_0xfa8b('0xc')];this['countglobal']=_0x105a0a[_0xfa8b('0xa')]+_0x105a0a[_0xfa8b('0xb')]+_0x105a0a[_0xfa8b('0xc')]+_0x105a0a['countnosuchnumberretry']+_0x105a0a['countdropretry']+_0x105a0a[_0xfa8b('0xd')]+_0x105a0a['countmachineretry']+_0x105a0a[_0xfa8b('0xe')];this['countnosuchnumberretry']=_0x105a0a[_0xfa8b('0xf')];this['countdropretry']=_0x105a0a['countdropretry'];this[_0xfa8b('0xd')]=_0x105a0a['countabandonedretry'];this[_0xfa8b('0x10')]=_0x105a0a[_0xfa8b('0x10')];this['countagentrejectretry']=_0x105a0a[_0xfa8b('0xe')];this[_0xfa8b('0x11')]=_0x333769['uniqueid'];this['calleridname']=_0x105a0a['name'];this[_0xfa8b('0x12')]=_0x105a0a[_0xfa8b('0x13')];this[_0xfa8b('0x14')]=_0x105a0a['starttime'];this[_0xfa8b('0x15')]=_0x105a0a[_0xfa8b('0x15')];this[_0xfa8b('0x16')]=moment()[_0xfa8b('0x17')](_0xfa8b('0x18'));this['ringtime']=utils[_0xfa8b('0x19')](_0x105a0a[_0xfa8b('0x15')],_0x105a0a[_0xfa8b('0x14')]);this[_0xfa8b('0x1a')]=0x0;this[_0xfa8b('0x1b')]=utils['getSeconds'](this[_0xfa8b('0x16')],_0x105a0a[_0xfa8b('0x15')]);this[_0xfa8b('0x8')]=_0x105a0a['queue'];this[_0xfa8b('0x1c')]=_0xfa8b('0x1d');this[_0xfa8b('0x1e')]=_0x333769['cause-txt'];this[_0xfa8b('0x1f')]=_0x105a0a[_0xfa8b('0x1f')];this[_0xfa8b('0x20')]=_0x105a0a[_0xfa8b('0x20')];this['callbackat']=_0x105a0a[_0xfa8b('0x21')];this[_0xfa8b('0x22')]=_0x105a0a[_0xfa8b('0x22')];this['ContactId']=_0x105a0a[_0xfa8b('0x23')];this[_0xfa8b('0x24')]=_0x105a0a[_0xfa8b('0x24')];this[_0xfa8b('0x25')]=_0x105a0a[_0xfa8b('0x25')];this[_0xfa8b('0x26')]=_0x105a0a[_0xfa8b('0x26')];this[_0xfa8b('0x27')]=_0x105a0a[_0xfa8b('0x27')];}module[_0xfa8b('0x28')]=Hangup; \ No newline at end of file +var _0xa276=['countnosuchnumberretry','countmachineretry','countagentrejectretry','countdropretry','countabandonedretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','queue','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','../utils','state','statedesc','Answer','scheduledat','type','outbound','amd','countcongestionretry','countnoanswerretry','countbusyretry'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xa276,0x185));var _0x6a27=function(_0xdb5beb,_0x197234){_0xdb5beb=_0xdb5beb-0x0;var _0x5ee5ff=_0xa276[_0xdb5beb];return _0x5ee5ff;};'use strict';var moment=require('moment');var utils=require(_0x6a27('0x0'));function Hangup(_0x460661,_0x1ee558){this[_0x6a27('0x1')]=0x4;this[_0x6a27('0x2')]=_0x6a27('0x3');this[_0x6a27('0x4')]=_0x460661[_0x6a27('0x4')];this[_0x6a27('0x5')]=_0x460661[_0x6a27('0x5')];this['campaigntype']=_0x460661[_0x6a27('0x5')]===_0x6a27('0x6')?'queue':_0x460661[_0x6a27('0x5')];this['amd']=_0x460661[_0x6a27('0x7')]||![];this['countbusyretry']=_0x460661['countbusyretry'];this[_0x6a27('0x8')]=_0x460661[_0x6a27('0x8')];this[_0x6a27('0x9')]=_0x460661['countnoanswerretry'];this['countglobal']=_0x460661[_0x6a27('0xa')]+_0x460661[_0x6a27('0x8')]+_0x460661[_0x6a27('0x9')]+_0x460661[_0x6a27('0xb')]+_0x460661['countdropretry']+_0x460661['countabandonedretry']+_0x460661[_0x6a27('0xc')]+_0x460661[_0x6a27('0xd')];this[_0x6a27('0xb')]=_0x460661[_0x6a27('0xb')];this[_0x6a27('0xe')]=_0x460661[_0x6a27('0xe')];this['countabandonedretry']=_0x460661[_0x6a27('0xf')];this[_0x6a27('0xc')]=_0x460661[_0x6a27('0xc')];this[_0x6a27('0xd')]=_0x460661[_0x6a27('0xd')];this[_0x6a27('0x10')]=_0x1ee558[_0x6a27('0x10')];this[_0x6a27('0x11')]=_0x460661[_0x6a27('0x12')];this[_0x6a27('0x13')]=_0x460661['number'];this[_0x6a27('0x14')]=_0x460661['starttime'];this['responsetime']=_0x460661[_0x6a27('0x15')];this[_0x6a27('0x16')]=moment()[_0x6a27('0x17')](_0x6a27('0x18'));this[_0x6a27('0x19')]=utils['getSeconds'](_0x460661[_0x6a27('0x15')],_0x460661[_0x6a27('0x14')]);this['holdtime']=0x0;this['talktime']=utils[_0x6a27('0x1a')](this[_0x6a27('0x16')],_0x460661[_0x6a27('0x15')]);this[_0x6a27('0x1b')]=_0x460661[_0x6a27('0x1b')];this['membername']=_0x6a27('0x1c');this[_0x6a27('0x1d')]=_0x1ee558[_0x6a27('0x1e')];this[_0x6a27('0x1f')]=_0x460661[_0x6a27('0x1f')];this['callbackuniqueid']=_0x460661[_0x6a27('0x20')];this[_0x6a27('0x21')]=_0x460661[_0x6a27('0x21')];this[_0x6a27('0x22')]=_0x460661['recallme'];this['ContactId']=_0x460661[_0x6a27('0x23')];this['ListId']=_0x460661[_0x6a27('0x24')];this[_0x6a27('0x25')]=_0x460661[_0x6a27('0x25')];this[_0x6a27('0x26')]=_0x460661['VoiceQueueId'];this[_0x6a27('0x27')]=_0x460661[_0x6a27('0x27')];}module['exports']=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 cb34943..caf0096 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 _0x9271=['getSeconds','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','../utils','uniqueid','scheduledat','type','campaigntype','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','queue','calleridname','name','calleridnum','number','starttime','responsetime','endtime','ringtime'];(function(_0x34256a,_0x2a93a9){var _0x2ddfac=function(_0x24f8e0){while(--_0x24f8e0){_0x34256a['push'](_0x34256a['shift']());}};_0x2ddfac(++_0x2a93a9);}(_0x9271,0x1d7));var _0x1927=function(_0x435605,_0x392403){_0x435605=_0x435605-0x0;var _0x30f739=_0x9271[_0x435605];return _0x30f739;};'use strict';var utils=require(_0x1927('0x0'));function History(_0x3e1260){this[_0x1927('0x1')]=_0x3e1260['uniqueid'];this[_0x1927('0x2')]=_0x3e1260['scheduledat']||undefined;this['type']=_0x3e1260[_0x1927('0x3')];this[_0x1927('0x4')]=_0x3e1260[_0x1927('0x3')]==='outbound'?'queue':_0x3e1260[_0x1927('0x3')];this[_0x1927('0x5')]=_0x3e1260[_0x1927('0x5')];this[_0x1927('0x6')]=_0x3e1260[_0x1927('0x6')];this[_0x1927('0x7')]=_0x3e1260[_0x1927('0x7')];this[_0x1927('0x8')]=_0x3e1260['countbusyretry']+_0x3e1260[_0x1927('0x6')]+_0x3e1260[_0x1927('0x7')]+_0x3e1260[_0x1927('0x9')]+_0x3e1260['countdropretry']+_0x3e1260[_0x1927('0xa')]+_0x3e1260[_0x1927('0xb')]+_0x3e1260[_0x1927('0xc')];this['countnosuchnumberretry']=_0x3e1260[_0x1927('0x9')];this[_0x1927('0xd')]=_0x3e1260[_0x1927('0xd')];this['countabandonedretry']=_0x3e1260['countabandonedretry'];this[_0x1927('0xb')]=_0x3e1260[_0x1927('0xb')];this[_0x1927('0xc')]=_0x3e1260['countagentrejectretry'];this[_0x1927('0xe')]=_0x3e1260[_0x1927('0xe')];this[_0x1927('0xf')]=_0x3e1260[_0x1927('0x10')];this[_0x1927('0x11')]=_0x3e1260[_0x1927('0x12')];this[_0x1927('0x13')]=_0x3e1260[_0x1927('0x13')];this[_0x1927('0x14')]=_0x3e1260[_0x1927('0x14')];this[_0x1927('0x15')]=_0x3e1260['responsetime'];this[_0x1927('0x16')]=utils[_0x1927('0x17')](_0x3e1260[_0x1927('0x14')],_0x3e1260[_0x1927('0x13')]);this[_0x1927('0x18')]=0x0;this[_0x1927('0x19')]=0x0;this[_0x1927('0x1a')]=_0x3e1260[_0x1927('0x1a')];this[_0x1927('0x1b')]=_0x3e1260[_0x1927('0x1b')];this[_0x1927('0x1c')]=_0x3e1260[_0x1927('0x1c')];this['recallme']=_0x3e1260[_0x1927('0x1d')];this['ContactId']=_0x3e1260['ContactId'];this[_0x1927('0x1e')]=_0x3e1260['ListId'];this[_0x1927('0x1f')]=_0x3e1260['UserId'];this[_0x1927('0x20')]=_0x3e1260['VoiceQueueId'];this[_0x1927('0x21')]=_0x3e1260[_0x1927('0x21')];this[_0x1927('0x22')]=_0x3e1260[_0x1927('0x22')]||'';this[_0x1927('0x23')]=_0x3e1260[_0x1927('0x23')]||'';this['state']=_0x3e1260[_0x1927('0x24')];this['statedesc']=_0x3e1260[_0x1927('0x25')];}module['exports']=History; \ No newline at end of file +var _0xcb62=['name','number','starttime','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','state','statedesc','exports','uniqueid','scheduledat','type','queue','countnoanswerretry','countglobal','countbusyretry','countcongestionretry','countnosuchnumberretry','countmachineretry','countagentrejectretry','countdropretry','countabandonedretry'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xcb62,0x13d));var _0x2cb6=function(_0x4eb180,_0x404108){_0x4eb180=_0x4eb180-0x0;var _0x159bf2=_0xcb62[_0x4eb180];return _0x159bf2;};'use strict';var utils=require('../utils');function History(_0x1735b7){this[_0x2cb6('0x0')]=_0x1735b7[_0x2cb6('0x0')];this[_0x2cb6('0x1')]=_0x1735b7[_0x2cb6('0x1')]||undefined;this[_0x2cb6('0x2')]=_0x1735b7['type'];this['campaigntype']=_0x1735b7[_0x2cb6('0x2')]==='outbound'?_0x2cb6('0x3'):_0x1735b7['type'];this['countbusyretry']=_0x1735b7['countbusyretry'];this['countcongestionretry']=_0x1735b7['countcongestionretry'];this[_0x2cb6('0x4')]=_0x1735b7['countnoanswerretry'];this[_0x2cb6('0x5')]=_0x1735b7[_0x2cb6('0x6')]+_0x1735b7[_0x2cb6('0x7')]+_0x1735b7['countnoanswerretry']+_0x1735b7[_0x2cb6('0x8')]+_0x1735b7['countdropretry']+_0x1735b7['countabandonedretry']+_0x1735b7[_0x2cb6('0x9')]+_0x1735b7[_0x2cb6('0xa')];this[_0x2cb6('0x8')]=_0x1735b7[_0x2cb6('0x8')];this[_0x2cb6('0xb')]=_0x1735b7['countdropretry'];this[_0x2cb6('0xc')]=_0x1735b7[_0x2cb6('0xc')];this[_0x2cb6('0x9')]=_0x1735b7[_0x2cb6('0x9')];this[_0x2cb6('0xa')]=_0x1735b7['countagentrejectretry'];this[_0x2cb6('0x3')]=_0x1735b7['queue'];this['calleridname']=_0x1735b7[_0x2cb6('0xd')];this['calleridnum']=_0x1735b7[_0x2cb6('0xe')];this[_0x2cb6('0xf')]=_0x1735b7[_0x2cb6('0xf')];this[_0x2cb6('0x10')]=_0x1735b7[_0x2cb6('0x10')];this['endtime']=_0x1735b7[_0x2cb6('0x10')];this[_0x2cb6('0x11')]=utils['getSeconds'](_0x1735b7[_0x2cb6('0x10')],_0x1735b7[_0x2cb6('0xf')]);this[_0x2cb6('0x12')]=0x0;this[_0x2cb6('0x13')]=0x0;this[_0x2cb6('0x14')]=_0x1735b7[_0x2cb6('0x14')];this[_0x2cb6('0x15')]=_0x1735b7[_0x2cb6('0x15')];this['callbackat']=_0x1735b7[_0x2cb6('0x16')];this[_0x2cb6('0x17')]=_0x1735b7[_0x2cb6('0x17')];this[_0x2cb6('0x18')]=_0x1735b7[_0x2cb6('0x18')];this[_0x2cb6('0x19')]=_0x1735b7[_0x2cb6('0x19')];this[_0x2cb6('0x1a')]=_0x1735b7[_0x2cb6('0x1a')];this[_0x2cb6('0x1b')]=_0x1735b7['VoiceQueueId'];this[_0x2cb6('0x1c')]=_0x1735b7[_0x2cb6('0x1c')];this[_0x2cb6('0x1d')]=_0x1735b7['originatecalleridnum']||'';this['originatecalleridname']=_0x1735b7['originatecalleridname']||'';this[_0x2cb6('0x1e')]=_0x1735b7['state'];this[_0x2cb6('0x1f')]=_0x1735b7[_0x2cb6('0x1f')];}module[_0x2cb6('0x20')]=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 07e1f0a..9599593 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 _0x1fd7=['queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countmachineretry','countagentrejectretry','countdropretry','countabandonedretry','uniqueid','name','calleridnum','number','starttime','responsetime','droptime','dropreason','endtime','ringtime','talktime','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','exports','scheduledat','type','campaigntype','outbound'];(function(_0x350034,_0x341770){var _0x303eb4=function(_0x306295){while(--_0x306295){_0x350034['push'](_0x350034['shift']());}};_0x303eb4(++_0x341770);}(_0x1fd7,0x7a));var _0x71fd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1fd7[_0x3dd15e];return _0x231fd0;};'use strict';var utils=require('../utils');function QueueCallerAbandon(_0x32e92b,_0x16b4e0){this['scheduledat']=_0x32e92b[_0x71fd('0x0')];this[_0x71fd('0x1')]=_0x32e92b[_0x71fd('0x1')];this[_0x71fd('0x2')]=_0x32e92b['type']===_0x71fd('0x3')?_0x71fd('0x4'):_0x32e92b[_0x71fd('0x1')];this[_0x71fd('0x5')]=_0x32e92b[_0x71fd('0x5')];this[_0x71fd('0x6')]=_0x32e92b['countcongestionretry'];this[_0x71fd('0x7')]=_0x32e92b[_0x71fd('0x7')];this[_0x71fd('0x8')]=_0x32e92b[_0x71fd('0x5')]+_0x32e92b[_0x71fd('0x6')]+_0x32e92b[_0x71fd('0x7')]+_0x32e92b[_0x71fd('0x9')]+_0x32e92b['countdropretry']+_0x32e92b['countabandonedretry']+_0x32e92b[_0x71fd('0xa')]+_0x32e92b[_0x71fd('0xb')];this[_0x71fd('0x9')]=_0x32e92b['countnosuchnumberretry'];this[_0x71fd('0xc')]=_0x32e92b[_0x71fd('0xc')];this[_0x71fd('0xd')]=_0x32e92b[_0x71fd('0xd')];this[_0x71fd('0xa')]=_0x32e92b[_0x71fd('0xa')];this['countagentrejectretry']=_0x32e92b[_0x71fd('0xb')];this[_0x71fd('0xe')]=_0x16b4e0['uniqueid'];this['calleridname']=_0x32e92b[_0x71fd('0xf')];this[_0x71fd('0x10')]=_0x32e92b[_0x71fd('0x11')];this['starttime']=_0x32e92b[_0x71fd('0x12')];this[_0x71fd('0x13')]=_0x32e92b['responsetime'];this[_0x71fd('0x14')]=_0x32e92b[_0x71fd('0x14')];this[_0x71fd('0x15')]=_0x32e92b[_0x71fd('0x15')];this[_0x71fd('0x16')]=this['droptime'];this[_0x71fd('0x17')]=utils['getSeconds'](_0x32e92b['responsetime'],_0x32e92b[_0x71fd('0x12')]);this['holdtime']=utils['getSeconds'](this[_0x71fd('0x14')],_0x32e92b[_0x71fd('0x13')]);this[_0x71fd('0x18')]=0x0;this['queue']=_0x16b4e0[_0x71fd('0x4')];this['membername']=_0x16b4e0[_0x71fd('0x19')];this[_0x71fd('0x1a')]=_0x16b4e0['reason'];this[_0x71fd('0x1b')]=_0x32e92b['callback'];this[_0x71fd('0x1c')]=_0x32e92b[_0x71fd('0x1c')];this[_0x71fd('0x1d')]=_0x32e92b[_0x71fd('0x1d')];this['recallme']=_0x32e92b[_0x71fd('0x1e')];this[_0x71fd('0x1f')]=_0x32e92b['ContactId'];this[_0x71fd('0x20')]=_0x32e92b[_0x71fd('0x20')];this[_0x71fd('0x21')]=_0x32e92b[_0x71fd('0x21')];this['VoiceQueueId']=_0x32e92b[_0x71fd('0x22')];this[_0x71fd('0x23')]=_0x32e92b['CampaignId'];this[_0x71fd('0x24')]=_0x32e92b[_0x71fd('0x24')]||'';this['originatecalleridname']=_0x32e92b[_0x71fd('0x25')]||'';this['agiafterat']=_0x32e92b[_0x71fd('0x26')];this['state']=_0x32e92b[_0x71fd('0x27')];this[_0x71fd('0x28')]=_0x32e92b[_0x71fd('0x28')];}module[_0x71fd('0x29')]=QueueCallerAbandon; \ No newline at end of file +var _0x8812=['ringtime','getSeconds','holdtime','talktime','membername','connectedlinename','reason','callback','callbackat','recallme','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','statedesc','exports','../utils','scheduledat','type','outbound','queue','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','number','starttime','responsetime','droptime','dropreason'];(function(_0x369f04,_0x3627ea){var _0x18fec9=function(_0x2ac51b){while(--_0x2ac51b){_0x369f04['push'](_0x369f04['shift']());}};_0x18fec9(++_0x3627ea);}(_0x8812,0x1e7));var _0x2881=function(_0x1c5e82,_0x3f23de){_0x1c5e82=_0x1c5e82-0x0;var _0x55043e=_0x8812[_0x1c5e82];return _0x55043e;};'use strict';var utils=require(_0x2881('0x0'));function QueueCallerAbandon(_0x549ab1,_0x2e8cb1){this[_0x2881('0x1')]=_0x549ab1[_0x2881('0x1')];this[_0x2881('0x2')]=_0x549ab1[_0x2881('0x2')];this['campaigntype']=_0x549ab1[_0x2881('0x2')]===_0x2881('0x3')?_0x2881('0x4'):_0x549ab1[_0x2881('0x2')];this['countbusyretry']=_0x549ab1['countbusyretry'];this['countcongestionretry']=_0x549ab1[_0x2881('0x5')];this['countnoanswerretry']=_0x549ab1[_0x2881('0x6')];this[_0x2881('0x7')]=_0x549ab1['countbusyretry']+_0x549ab1['countcongestionretry']+_0x549ab1[_0x2881('0x6')]+_0x549ab1[_0x2881('0x8')]+_0x549ab1[_0x2881('0x9')]+_0x549ab1[_0x2881('0xa')]+_0x549ab1['countmachineretry']+_0x549ab1['countagentrejectretry'];this[_0x2881('0x8')]=_0x549ab1[_0x2881('0x8')];this[_0x2881('0x9')]=_0x549ab1[_0x2881('0x9')];this['countabandonedretry']=_0x549ab1[_0x2881('0xa')];this[_0x2881('0xb')]=_0x549ab1[_0x2881('0xb')];this[_0x2881('0xc')]=_0x549ab1['countagentrejectretry'];this[_0x2881('0xd')]=_0x2e8cb1[_0x2881('0xd')];this[_0x2881('0xe')]=_0x549ab1['name'];this['calleridnum']=_0x549ab1[_0x2881('0xf')];this['starttime']=_0x549ab1[_0x2881('0x10')];this[_0x2881('0x11')]=_0x549ab1[_0x2881('0x11')];this['droptime']=_0x549ab1[_0x2881('0x12')];this['dropreason']=_0x549ab1[_0x2881('0x13')];this['endtime']=this[_0x2881('0x12')];this[_0x2881('0x14')]=utils[_0x2881('0x15')](_0x549ab1[_0x2881('0x11')],_0x549ab1[_0x2881('0x10')]);this[_0x2881('0x16')]=utils[_0x2881('0x15')](this[_0x2881('0x12')],_0x549ab1[_0x2881('0x11')]);this[_0x2881('0x17')]=0x0;this[_0x2881('0x4')]=_0x2e8cb1[_0x2881('0x4')];this[_0x2881('0x18')]=_0x2e8cb1[_0x2881('0x19')];this[_0x2881('0x1a')]=_0x2e8cb1[_0x2881('0x1a')];this[_0x2881('0x1b')]=_0x549ab1[_0x2881('0x1b')];this['callbackuniqueid']=_0x549ab1['callbackuniqueid'];this[_0x2881('0x1c')]=_0x549ab1[_0x2881('0x1c')];this[_0x2881('0x1d')]=_0x549ab1[_0x2881('0x1d')];this['ContactId']=_0x549ab1['ContactId'];this[_0x2881('0x1e')]=_0x549ab1[_0x2881('0x1e')];this['UserId']=_0x549ab1[_0x2881('0x1f')];this[_0x2881('0x20')]=_0x549ab1[_0x2881('0x20')];this[_0x2881('0x21')]=_0x549ab1[_0x2881('0x21')];this[_0x2881('0x22')]=_0x549ab1[_0x2881('0x22')]||'';this[_0x2881('0x23')]=_0x549ab1[_0x2881('0x23')]||'';this[_0x2881('0x24')]=_0x549ab1[_0x2881('0x24')];this['state']=_0x549ab1['state'];this[_0x2881('0x25')]=_0x549ab1['statedesc'];}module[_0x2881('0x26')]=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 4095318..56c4c1b 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 _0xb145=['checkIsBlackListIvr','[checkIsBlackListIvr]','verifyAdditionalPhones','swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime','[avgHandleTime]','createHistory','../../../../config/logger','dialer','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperBlack','../../rpc/cmHopperHistory','inspect','getContactDialer','dialOrderByScheduledAt','temp','error','[getContactDialer]','getContactDialerIvr','catch','[getContactDialerIvr]','[countReScheduled]','countReScheduled','[rescheduleContact]','rescheduleContact','unlockContact','[moveContactManagedDialer]','moveContactManagedDialer','checkIsBlackList'];(function(_0x2d2b63,_0x277d0a){var _0x5d18f8=function(_0x4eca54){while(--_0x4eca54){_0x2d2b63['push'](_0x2d2b63['shift']());}};_0x5d18f8(++_0x277d0a);}(_0xb145,0xa3));var _0x5b14=function(_0xa7a2d2,_0x16e8bb){_0xa7a2d2=_0xa7a2d2-0x0;var _0x589c0a=_0xb145[_0xa7a2d2];return _0x589c0a;};'use strict';var util=require('util');var logger=require(_0x5b14('0x0'))(_0x5b14('0x1'));var cmHopper=require(_0x5b14('0x2'));var cmHopperAdditionalPhone=require(_0x5b14('0x3'));var cmHopperBlack=require(_0x5b14('0x4'));var cmHopperHistory=require(_0x5b14('0x5'));function inspectError(_0x31f6f0){return util[_0x5b14('0x6')](_0x31f6f0,{'showHidden':![],'depth':null});}function getContactDialer(_0x5111cd,_0x1e0b5b,_0x15490e){return cmHopper[_0x5b14('0x7')](_0x5111cd['id'],_0x1e0b5b,_0x15490e,_0x5111cd[_0x5b14('0x8')])['catch'](function(_0x1d12ed){_0x5111cd[_0x5b14('0x9')]=0x0;logger[_0x5b14('0xa')](_0x5b14('0xb'),inspectError(_0x1d12ed));});}exports[_0x5b14('0x7')]=getContactDialer;function getContactDialerIvr(_0x5f084f,_0x32d729){return cmHopper[_0x5b14('0xc')](_0x5f084f['id'],_0x32d729,_0x5f084f['dialOrderByScheduledAt'])[_0x5b14('0xd')](function(_0x17047f){_0x5f084f[_0x5b14('0x9')]=0x0;logger[_0x5b14('0xa')](_0x5b14('0xe'),inspectError(_0x17047f));});}exports['getContactDialerIvr']=getContactDialerIvr;function countReScheduled(_0x265df3){return cmHopper['countReScheduled'](_0x265df3)[_0x5b14('0xd')](function(_0x1903a5){logger[_0x5b14('0xa')](_0x5b14('0xf'),inspectError(_0x1903a5));});}exports[_0x5b14('0x10')]=countReScheduled;function rescheduleContact(_0x40577a){return cmHopper['rescheduleContact'](_0x40577a)[_0x5b14('0xd')](function(_0x16f2a1){logger[_0x5b14('0xa')](_0x5b14('0x11'),inspectError(_0x16f2a1));});}exports[_0x5b14('0x12')]=rescheduleContact;function unlockContact(_0x2a8fe5,_0x68f695,_0xe5af75){return cmHopper[_0x5b14('0x13')](_0x2a8fe5,_0x68f695,_0xe5af75)[_0x5b14('0xd')](function(_0x221344){logger[_0x5b14('0xa')]('[unlockContact]',inspectError(_0x221344));});}exports[_0x5b14('0x13')]=unlockContact;function moveContactManagedDialer(_0x50866a){return cmHopper['moveContactManagedDialer'](_0x50866a)['catch'](function(_0x3f397d){logger[_0x5b14('0xa')](_0x5b14('0x14'),inspectError(_0x3f397d));});}exports[_0x5b14('0x15')]=moveContactManagedDialer;function checkIsBlackList(_0x3786f7){return cmHopperBlack[_0x5b14('0x16')](_0x3786f7)[_0x5b14('0xd')](function(_0x4a4e60){logger['error']('[checkIsBlackList]',inspectError(_0x4a4e60));});}exports[_0x5b14('0x16')]=checkIsBlackList;function checkIsBlackListIvr(_0x2afa17){return cmHopperBlack[_0x5b14('0x17')](_0x2afa17)[_0x5b14('0xd')](function(_0x4c8080){logger[_0x5b14('0xa')](_0x5b14('0x18'),inspectError(_0x4c8080));});}exports['checkIsBlackListIvr']=checkIsBlackListIvr;function verifyAdditionalPhones(_0x2d7b38,_0x30734f,_0x50951f){return cmHopperAdditionalPhone[_0x5b14('0x19')](_0x2d7b38,_0x30734f,_0x50951f)['catch'](function(_0x59282c){logger['error']('[verifyAdditionalPhone]',inspectError(_0x59282c));});}exports[_0x5b14('0x19')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x2d5f56,_0x153a25,_0x5da505){return cmHopperAdditionalPhone[_0x5b14('0x1a')](_0x2d5f56,_0x153a25,_0x5da505)[_0x5b14('0xd')](function(_0x2ac7b0){logger[_0x5b14('0xa')](_0x5b14('0x1b'),inspectError(_0x2ac7b0));});}exports[_0x5b14('0x1a')]=swapAdditionalPhones;function avgHandleTime(_0x422d22){return cmHopperHistory[_0x5b14('0x1c')](_0x422d22)[_0x5b14('0xd')](function(_0x4e9609){logger[_0x5b14('0xa')](_0x5b14('0x1d'),inspectError(_0x4e9609));});}exports[_0x5b14('0x1c')]=avgHandleTime;function createHistory(_0x266bbe){return cmHopperHistory['createHistory'](_0x266bbe)[_0x5b14('0xd')](function(_0x18a76d){logger['error']('[createHistory]',inspectError(_0x18a76d));});}exports[_0x5b14('0x1e')]=createHistory; \ No newline at end of file +var _0x5496=['[getContactDialer]','getContactDialerIvr','[getContactDialerIvr]','countReScheduled','[countReScheduled]','rescheduleContact','[rescheduleContact]','unlockContact','[unlockContact]','moveContactManagedDialer','checkIsBlackList','[checkIsBlackList]','checkIsBlackListIvr','[checkIsBlackListIvr]','verifyAdditionalPhones','[verifyAdditionalPhone]','swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime','[avgHandleTime]','createHistory','util','../../../../config/logger','dialer','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperHistory','inspect','dialOrderByScheduledAt','catch','temp','error'];(function(_0xb77c9c,_0x49d278){var _0x186557=function(_0x40e99b){while(--_0x40e99b){_0xb77c9c['push'](_0xb77c9c['shift']());}};_0x186557(++_0x49d278);}(_0x5496,0x175));var _0x6549=function(_0x1877d4,_0x201b5c){_0x1877d4=_0x1877d4-0x0;var _0xff5ed4=_0x5496[_0x1877d4];return _0xff5ed4;};'use strict';var util=require(_0x6549('0x0'));var logger=require(_0x6549('0x1'))(_0x6549('0x2'));var cmHopper=require(_0x6549('0x3'));var cmHopperAdditionalPhone=require(_0x6549('0x4'));var cmHopperBlack=require('../../rpc/cmHopperBlack');var cmHopperHistory=require(_0x6549('0x5'));function inspectError(_0x4de1db){return util[_0x6549('0x6')](_0x4de1db,{'showHidden':![],'depth':null});}function getContactDialer(_0x8112c5,_0x3750cc,_0x4d0473){return cmHopper['getContactDialer'](_0x8112c5['id'],_0x3750cc,_0x4d0473,_0x8112c5[_0x6549('0x7')])[_0x6549('0x8')](function(_0x4fcffd){_0x8112c5[_0x6549('0x9')]=0x0;logger[_0x6549('0xa')](_0x6549('0xb'),inspectError(_0x4fcffd));});}exports['getContactDialer']=getContactDialer;function getContactDialerIvr(_0xa12086,_0x35d008){return cmHopper[_0x6549('0xc')](_0xa12086['id'],_0x35d008,_0xa12086[_0x6549('0x7')])[_0x6549('0x8')](function(_0x3e08a6){_0xa12086['temp']=0x0;logger['error'](_0x6549('0xd'),inspectError(_0x3e08a6));});}exports[_0x6549('0xc')]=getContactDialerIvr;function countReScheduled(_0x3c5f9b){return cmHopper[_0x6549('0xe')](_0x3c5f9b)[_0x6549('0x8')](function(_0x5bc018){logger['error'](_0x6549('0xf'),inspectError(_0x5bc018));});}exports[_0x6549('0xe')]=countReScheduled;function rescheduleContact(_0x57a149){return cmHopper[_0x6549('0x10')](_0x57a149)[_0x6549('0x8')](function(_0x195d25){logger[_0x6549('0xa')](_0x6549('0x11'),inspectError(_0x195d25));});}exports[_0x6549('0x10')]=rescheduleContact;function unlockContact(_0x55c112,_0x5db86d,_0x384f75){return cmHopper[_0x6549('0x12')](_0x55c112,_0x5db86d,_0x384f75)['catch'](function(_0x238a04){logger[_0x6549('0xa')](_0x6549('0x13'),inspectError(_0x238a04));});}exports[_0x6549('0x12')]=unlockContact;function moveContactManagedDialer(_0xffc8b9){return cmHopper['moveContactManagedDialer'](_0xffc8b9)['catch'](function(_0x26a212){logger['error']('[moveContactManagedDialer]',inspectError(_0x26a212));});}exports[_0x6549('0x14')]=moveContactManagedDialer;function checkIsBlackList(_0x1e5079){return cmHopperBlack[_0x6549('0x15')](_0x1e5079)[_0x6549('0x8')](function(_0x236fd9){logger['error'](_0x6549('0x16'),inspectError(_0x236fd9));});}exports['checkIsBlackList']=checkIsBlackList;function checkIsBlackListIvr(_0x125096){return cmHopperBlack[_0x6549('0x17')](_0x125096)[_0x6549('0x8')](function(_0x29c6b3){logger[_0x6549('0xa')](_0x6549('0x18'),inspectError(_0x29c6b3));});}exports[_0x6549('0x17')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x25bc01,_0x2be467,_0x6ae00c){return cmHopperAdditionalPhone[_0x6549('0x19')](_0x25bc01,_0x2be467,_0x6ae00c)[_0x6549('0x8')](function(_0x23c0ba){logger['error'](_0x6549('0x1a'),inspectError(_0x23c0ba));});}exports[_0x6549('0x19')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x53bbca,_0x126967,_0x29f89e){return cmHopperAdditionalPhone[_0x6549('0x1b')](_0x53bbca,_0x126967,_0x29f89e)['catch'](function(_0x31a95){logger[_0x6549('0xa')](_0x6549('0x1c'),inspectError(_0x31a95));});}exports[_0x6549('0x1b')]=swapAdditionalPhones;function avgHandleTime(_0x442862){return cmHopperHistory[_0x6549('0x1d')](_0x442862)[_0x6549('0x8')](function(_0xa6c718){logger['error'](_0x6549('0x1e'),inspectError(_0xa6c718));});}exports[_0x6549('0x1d')]=avgHandleTime;function createHistory(_0x17fdfb){return cmHopperHistory['createHistory'](_0x17fdfb)[_0x6549('0x8')](function(_0x4acaf5){logger['error']('[createHistory]',inspectError(_0x4acaf5));});}exports[_0x6549('0x1f')]=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 dcc94a5..b510374 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 _0x1c3b=['TIMEZONE_UNKNOW','CAMPAIGN_STATUS','dialMethod','preview','isPreviewCampaign','type','ivr','isIVRCampaign','outbound','isOutboundQueue','dialActive','isQueueCampaignActive','active','isIVRCampaignActive','milliseconds','diff','seconds','getSeconds','message','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','hasQueueCampaignDataChanged','dialTimezone','isNil','dialGlobalInterval','Interval','Intervals','NULL_INTERVAL','isEmpty','UNKNOWN_TIMEZONE','SIP/','unmonitored','status','TrunkBackup','includes','INACTIVE','NO_AGENTS_LOGGED','getQueueCampaignStatusMessage','getQueueCampaignActiveStatusMessage','match','extractCalleridName','string','isUndefined','\x22%s\x22\x20<%s>','format','\x22\x22\x20<>','replace','random','toString','getCallerIdRandom','error','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','decrementOriginate','checkContactEmpty','erlangb','createdAt','tags','updatedAt','description','toUpperCase','lodash','moment','util','../../../../config/logger','dialer','../../../../config/environment/shared','timezones','ACTIVE','BLACKLIST','DEACTIVATED','IS_DISACTIVED','INTERVAL_IS_EMPTY','NOT_ACTIVE','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','INTERVAL_IS_OVERTIME','GLOBAL_INTERVAL_IS_OVERTIME','RECALLINQUEUE','RECALLFAILEDTIMEOUT'];(function(_0x51b35f,_0x39f310){var _0x1f22d5=function(_0x17a962){while(--_0x17a962){_0x51b35f['push'](_0x51b35f['shift']());}};_0x1f22d5(++_0x39f310);}(_0x1c3b,0x9c));var _0xb1c3=function(_0x3db06e,_0x1c6e33){_0x3db06e=_0x3db06e-0x0;var _0x10ee14=_0x1c3b[_0x3db06e];return _0x10ee14;};'use strict';var _=require(_0xb1c3('0x0'));var moment=require(_0xb1c3('0x1'));var util=require(_0xb1c3('0x2'));var logger=require(_0xb1c3('0x3'))(_0xb1c3('0x4'));var timezones=require(_0xb1c3('0x5'))[_0xb1c3('0x6')];var CAMPAIGN_STATUS={'ACTIVE':_0xb1c3('0x7'),'BLACKLIST':_0xb1c3('0x8'),'CONTACTS_RESCHEDULED':'RESCHEDULED_CONTACTS','DEACTIVATED':_0xb1c3('0x9'),'DISACTIVED':_0xb1c3('0xa'),'EMPTY_INTERVAL':_0xb1c3('0xb'),'INACTIVE':_0xb1c3('0xc'),'NO_AGENTS_LOGGED':_0xb1c3('0xd'),'NO_AVAILABLE_CONTACTS':_0xb1c3('0xe'),'NULL_INTERVAL':_0xb1c3('0xf'),'OVERTIME_INTERVAL':_0xb1c3('0x10'),'OVERTIME_GLOBAL_INTERVAL':_0xb1c3('0x11'),'QUEUE_RECALL':_0xb1c3('0x12'),'RECALL_TIMEOUT':_0xb1c3('0x13'),'RUNNING':'RUNNING','UNKNOWN_TIMEZONE':_0xb1c3('0x14'),'UNREACHABLE_TRUNK':'TRUNK_IS_NOT_REACHABLE'};exports[_0xb1c3('0x15')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x2c2315){return _0x2c2315[_0xb1c3('0x16')]===_0xb1c3('0x17');}exports[_0xb1c3('0x18')]=isPreviewCampaign;function isIVRCampaign(_0x4f3019){return _0x4f3019[_0xb1c3('0x19')]===_0xb1c3('0x1a');}exports[_0xb1c3('0x1b')]=isIVRCampaign;function isOutboundQueue(_0x1ea5c4){return _0x1ea5c4[_0xb1c3('0x19')]===_0xb1c3('0x1c');}exports[_0xb1c3('0x1d')]=isOutboundQueue;function isQueueCampaignActive(_0x4611d5){return _0x4611d5[_0xb1c3('0x1e')];}exports[_0xb1c3('0x1f')]=isQueueCampaignActive;function isIVRCampaignActive(_0x510750){return _0x510750[_0xb1c3('0x20')];}exports[_0xb1c3('0x21')]=isIVRCampaignActive;function getSeconds(_0x274fe1,_0x266a1b){var _0xc334b5=moment(_0x274fe1)[_0xb1c3('0x22')](0x0);var _0x1e29ed=moment(_0x266a1b)['milliseconds'](0x0);return _0xc334b5[_0xb1c3('0x23')](_0x1e29ed,_0xb1c3('0x24'));}exports[_0xb1c3('0x25')]=getSeconds;function hasQueueCampaignDataChanged(_0x3a8c01,_0x2b855d){var _0x4937c1=![];var _0x440c77=_0x3a8c01['dialMethod']!==_0x2b855d[_0xb1c3('0x16')]||_0x3a8c01[_0xb1c3('0x1e')]!==_0x2b855d[_0xb1c3('0x1e')]||_0x3a8c01[_0xb1c3('0x26')]!==_0x2b855d[_0xb1c3('0x26')];var _0x89fba2=_0x3a8c01['available']!==_0x2b855d['available']||_0x3a8c01['loggedIn']!==_0x2b855d[_0xb1c3('0x27')]||_0x3a8c01[_0xb1c3('0x28')]!==_0x2b855d['loggedInDb']||_0x3a8c01[_0xb1c3('0x29')]!==_0x2b855d[_0xb1c3('0x29')]||_0x3a8c01[_0xb1c3('0x2a')]!==_0x2b855d[_0xb1c3('0x2a')]||_0x3a8c01[_0xb1c3('0x2b')]!==_0x2b855d[_0xb1c3('0x2b')]||_0x3a8c01['waiting']!==_0x2b855d[_0xb1c3('0x2c')]||_0x3a8c01[_0xb1c3('0x2d')]!==_0x2b855d[_0xb1c3('0x2d')]||_0x3a8c01[_0xb1c3('0x2e')]!==_0x2b855d[_0xb1c3('0x2e')];if(_0x3a8c01[_0xb1c3('0x2f')]&&_0x2b855d[_0xb1c3('0x2f')]){_0x4937c1=_0x3a8c01[_0xb1c3('0x2f')][_0xb1c3('0x30')]!==_0x2b855d[_0xb1c3('0x2f')][_0xb1c3('0x30')]||_0x3a8c01[_0xb1c3('0x2f')]['active']!==_0x2b855d[_0xb1c3('0x2f')]['active'];}return _0x440c77||_0x89fba2||_0x4937c1;}exports[_0xb1c3('0x31')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x3ebe7f){var _0x33be39=null;var _0x346b2d=_0x3ebe7f[_0xb1c3('0x32')];if(_[_0xb1c3('0x33')](_0x3ebe7f[_0xb1c3('0x34')])||_[_0xb1c3('0x33')](_0x3ebe7f[_0xb1c3('0x35')])||_[_0xb1c3('0x33')](_0x3ebe7f[_0xb1c3('0x35')][_0xb1c3('0x36')])){_0x33be39=CAMPAIGN_STATUS[_0xb1c3('0x37')];}else if(_[_0xb1c3('0x38')](_0x3ebe7f['dialGlobalInterval'])||_[_0xb1c3('0x38')](_0x3ebe7f[_0xb1c3('0x35')][_0xb1c3('0x36')])){_0x33be39=CAMPAIGN_STATUS['EMPTY_INTERVAL'];}else if(_0x346b2d&&!timezones[_0x346b2d]){_0x33be39=CAMPAIGN_STATUS[_0xb1c3('0x39')];}return _0x33be39;}function checkAnyValidTrunk(_0x5b8720,_0x2f4253){var _0x450ce7=null;var _0x4ed59e=_0xb1c3('0x3a');var _0x34db41=['reachable',_0xb1c3('0x3b')];var _0x4270a8=!![];if(_0x5b8720[_0xb1c3('0x2f')]&&_0x5b8720[_0xb1c3('0x2f')][_0xb1c3('0x20')]){_0x4ed59e+=_0x5b8720['Trunk']['name'];_0x450ce7=_0x2f4253[_0x4ed59e];_0x4270a8=_0x34db41['includes'](_0x450ce7[_0xb1c3('0x3c')]);}else if(_0x5b8720[_0xb1c3('0x3d')]&&_0x5b8720['TrunkBackup']['active']){_0x4ed59e+=_0x5b8720[_0xb1c3('0x3d')][_0xb1c3('0x30')];_0x450ce7=_0x2f4253[_0x4ed59e];_0x4270a8=_0x34db41[_0xb1c3('0x3e')](_0x450ce7['status']);}return _0x4270a8;}function getQueueCampaignStatusMessage(_0x5067b6,_0x33a8fd){var _0x5ed78f=CAMPAIGN_STATUS[_0xb1c3('0x7')];var _0x39fa83=isPreviewCampaign(_0x5067b6);if(!isQueueCampaignActive(_0x5067b6)){if(_0x39fa83){_0x5ed78f=CAMPAIGN_STATUS[_0xb1c3('0x3f')];}else{if(_0x5067b6[_0xb1c3('0x2e')]===0x0&&_0x5067b6['talking']===0x0&&_0x5067b6[_0xb1c3('0x2c')]===0x0&&(_0x5067b6[_0xb1c3('0x2b')]||0x0)===0x0){_0x5ed78f=CAMPAIGN_STATUS[_0xb1c3('0x3f')];}else{_0x5ed78f=CAMPAIGN_STATUS['DISACTIVED'];}}}else if(_0x5067b6[_0xb1c3('0x27')]===0x0){_0x5ed78f=CAMPAIGN_STATUS[_0xb1c3('0x40')];}else if(!checkAnyValidTrunk(_0x5067b6,_0x33a8fd)){_0x5ed78f=CAMPAIGN_STATUS['UNREACHABLE_TRUNK'];}else if(!isPreviewCampaign(_0x5067b6)){var _0x3ed24a=checkAnyValidQueueCampaignInterval(_0x5067b6);if(_0x3ed24a){_0x5ed78f=_0x3ed24a;}}return _0x5ed78f;}exports[_0xb1c3('0x41')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x1200bf){var _0x6717d9=CAMPAIGN_STATUS['DISACTIVED'];if(_0x1200bf[_0xb1c3('0x2e')]===0x0&&_0x1200bf[_0xb1c3('0x2a')]===0x0&&_0x1200bf[_0xb1c3('0x2c')]===0x0&&(_0x1200bf[_0xb1c3('0x2b')]||0x0)===0x0){_0x6717d9=CAMPAIGN_STATUS[_0xb1c3('0x3f')];}return _0x6717d9;}exports[_0xb1c3('0x42')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x51e5b4){var _0x1b1e3c=_0x51e5b4[_0xb1c3('0x43')](/"(.*?)"/);return _0x1b1e3c?_0x1b1e3c[0x1]:_0x51e5b4;}exports[_0xb1c3('0x44')]=extractCalleridName;function getCallerId(_0x4c9587,_0x46c8c2,_0x2194b4){if(!_['isUndefined'](_0x2194b4)&&typeof _0x2194b4===_0xb1c3('0x45')&&!_[_0xb1c3('0x38')](_0x2194b4)){if(!_[_0xb1c3('0x46')](_0x46c8c2)&&typeof _0x46c8c2==='string'&&!_[_0xb1c3('0x38')](_0x46c8c2)){return util['format'](_0xb1c3('0x47'),_0x46c8c2,_0x2194b4);}return util[_0xb1c3('0x48')]('\x22%s\x22\x20<%s>',_0x2194b4,_0x2194b4);}if(!_['isUndefined'](_0x4c9587)&&typeof _0x4c9587===_0xb1c3('0x45')&&!_['isEmpty'](_0x4c9587)){return _0x4c9587;}return _0xb1c3('0x49');}exports['getCallerId']=getCallerId;function getCallerIdRandom(_0x2ba6a5,_0x33c13a){var _0x1f3506;var _0x10aea3;var _0x84069c;if(_0x33c13a<=0x0){_0x33c13a=0x1;}_0x1f3506=new RegExp('\x5cw{0,'+_0x33c13a+'}$');_0x10aea3=Math['pow'](0xa,_0x33c13a-0x1);_0x84069c=Math['pow'](0xa,_0x33c13a)-0x1;return util[_0xb1c3('0x48')]('%s',_[_0xb1c3('0x4a')](_0x2ba6a5,_0x1f3506,_[_0xb1c3('0x4b')](_0x10aea3,_0x84069c)[_0xb1c3('0x4c')]()));}exports[_0xb1c3('0x4d')]=getCallerIdRandom;function decrementOriginate(_0x352318){if(_0x352318[_0xb1c3('0x2e')]&&_0x352318[_0xb1c3('0x2e')]>0x0){_0x352318[_0xb1c3('0x2e')]-=0x1;}else{logger[_0xb1c3('0x4e')](_0xb1c3('0x4f'));}}exports[_0xb1c3('0x50')]=decrementOriginate;function checkContactEmpty(_0x12aa87){return _0x12aa87&&_0x12aa87['length']>0x0;}exports[_0xb1c3('0x51')]=checkContactEmpty;function erlangb(_0x3115d6,_0x3e2704){if(_0x3e2704===0x0){return 0x0;}var _0x5278d5=0x1;for(var _0x1675af=0x1;_0x1675af<=_0x3e2704;_0x1675af+=0x1){_0x5278d5=0x1+_0x5278d5*_0x1675af/_0x3115d6;}return 0x1/_0x5278d5;}exports[_0xb1c3('0x52')]=erlangb;function checkContactLowerLimitOriginate(_0x572462,_0x140d38,_0x556f62){if(_0x140d38>_0x556f62){for(var _0x245f1f=0x0;_0x245f1f<_0x140d38-_0x556f62;_0x245f1f+=0x1){decrementOriginate(_0x572462);}}}exports['checkContactLowerLimitOriginate']=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x322a80){var _0x58a1ad={};var _0x28c863=['id',_0xb1c3('0x53'),_0xb1c3('0x54'),_0xb1c3('0x55')];const _0x7f96b5=0xfa;if(_0x322a80){for(var _0x1763fa in _0x322a80){if(typeof _0x322a80[_0x1763fa]!=='undefined'){if(!_[_0xb1c3('0x33')](_0x322a80[_0x1763fa])&&!_0x28c863[_0xb1c3('0x3e')](_0x1763fa)){if(_0x1763fa===_0xb1c3('0x56')&&_0x322a80[_0x1763fa]['length']>_0x7f96b5){_0x58a1ad['XMD-'+_0x1763fa[_0xb1c3('0x57')]()]=_0x322a80[_0x1763fa][_0xb1c3('0x4c')]()['substring'](0x0,_0x7f96b5);}else{_0x58a1ad['XMD-'+_0x1763fa[_0xb1c3('0x57')]()]=_0x322a80[_0x1763fa];}}}}}return _0x58a1ad;}exports['setXMDContactVariables']=setXMDContactVariables; \ No newline at end of file +var _0x677e=['hasQueueCampaignDataChanged','dialTimezone','isNil','dialGlobalInterval','Intervals','NULL_INTERVAL','isEmpty','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','SIP/','reachable','status','TrunkBackup','includes','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','getQueueCampaignStatusMessage','DISACTIVED','INACTIVE','getQueueCampaignActiveStatusMessage','match','extractCalleridName','isUndefined','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','\x5cw{0,','pow','replace','random','toString','getCallerIdRandom','error','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','decrementOriginate','createdAt','tags','updatedAt','undefined','description','length','XMD-','substring','toUpperCase','setXMDContactVariables','moment','util','../../../../config/logger','dialer','../../../../config/environment/shared','timezones','ACTIVE','BLACKLIST','RESCHEDULED_CONTACTS','DEACTIVATED','INTERVAL_IS_EMPTY','NOT_ACTIVE','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','INTERVAL_IS_OVERTIME','GLOBAL_INTERVAL_IS_OVERTIME','RECALLINQUEUE','RECALLFAILEDTIMEOUT','RUNNING','TIMEZONE_UNKNOW','TRUNK_IS_NOT_REACHABLE','CAMPAIGN_STATUS','dialMethod','preview','isPreviewCampaign','ivr','isIVRCampaign','type','outbound','isOutboundQueue','dialActive','active','milliseconds','diff','getSeconds','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name'];(function(_0x2898ee,_0x28fb35){var _0xaf68fc=function(_0x2e4fe2){while(--_0x2e4fe2){_0x2898ee['push'](_0x2898ee['shift']());}};_0xaf68fc(++_0x28fb35);}(_0x677e,0x8c));var _0xe677=function(_0x41059a,_0x4df43f){_0x41059a=_0x41059a-0x0;var _0x574108=_0x677e[_0x41059a];return _0x574108;};'use strict';var _=require('lodash');var moment=require(_0xe677('0x0'));var util=require(_0xe677('0x1'));var logger=require(_0xe677('0x2'))(_0xe677('0x3'));var timezones=require(_0xe677('0x4'))[_0xe677('0x5')];var CAMPAIGN_STATUS={'ACTIVE':_0xe677('0x6'),'BLACKLIST':_0xe677('0x7'),'CONTACTS_RESCHEDULED':_0xe677('0x8'),'DEACTIVATED':_0xe677('0x9'),'DISACTIVED':'IS_DISACTIVED','EMPTY_INTERVAL':_0xe677('0xa'),'INACTIVE':_0xe677('0xb'),'NO_AGENTS_LOGGED':_0xe677('0xc'),'NO_AVAILABLE_CONTACTS':_0xe677('0xd'),'NULL_INTERVAL':_0xe677('0xe'),'OVERTIME_INTERVAL':_0xe677('0xf'),'OVERTIME_GLOBAL_INTERVAL':_0xe677('0x10'),'QUEUE_RECALL':_0xe677('0x11'),'RECALL_TIMEOUT':_0xe677('0x12'),'RUNNING':_0xe677('0x13'),'UNKNOWN_TIMEZONE':_0xe677('0x14'),'UNREACHABLE_TRUNK':_0xe677('0x15')};exports[_0xe677('0x16')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x3ae0d2){return _0x3ae0d2[_0xe677('0x17')]===_0xe677('0x18');}exports[_0xe677('0x19')]=isPreviewCampaign;function isIVRCampaign(_0x284b35){return _0x284b35['type']===_0xe677('0x1a');}exports[_0xe677('0x1b')]=isIVRCampaign;function isOutboundQueue(_0xbac5a){return _0xbac5a[_0xe677('0x1c')]===_0xe677('0x1d');}exports[_0xe677('0x1e')]=isOutboundQueue;function isQueueCampaignActive(_0xdc2bf8){return _0xdc2bf8[_0xe677('0x1f')];}exports['isQueueCampaignActive']=isQueueCampaignActive;function isIVRCampaignActive(_0x158c49){return _0x158c49[_0xe677('0x20')];}exports['isIVRCampaignActive']=isIVRCampaignActive;function getSeconds(_0x320f25,_0x30b2b7){var _0x535749=moment(_0x320f25)[_0xe677('0x21')](0x0);var _0x4645ba=moment(_0x30b2b7)['milliseconds'](0x0);return _0x535749[_0xe677('0x22')](_0x4645ba,'seconds');}exports[_0xe677('0x23')]=getSeconds;function hasQueueCampaignDataChanged(_0x402af4,_0x1b9224){var _0x44e0f5=![];var _0x55adbe=_0x402af4[_0xe677('0x17')]!==_0x1b9224[_0xe677('0x17')]||_0x402af4['dialActive']!==_0x1b9224[_0xe677('0x1f')]||_0x402af4[_0xe677('0x24')]!==_0x1b9224[_0xe677('0x24')];var _0x36bb79=_0x402af4['available']!==_0x1b9224[_0xe677('0x25')]||_0x402af4[_0xe677('0x26')]!==_0x1b9224[_0xe677('0x26')]||_0x402af4[_0xe677('0x27')]!==_0x1b9224[_0xe677('0x27')]||_0x402af4[_0xe677('0x28')]!==_0x1b9224[_0xe677('0x28')]||_0x402af4[_0xe677('0x29')]!==_0x1b9224[_0xe677('0x29')]||_0x402af4[_0xe677('0x2a')]!==_0x1b9224[_0xe677('0x2a')]||_0x402af4[_0xe677('0x2b')]!==_0x1b9224['waiting']||_0x402af4[_0xe677('0x2c')]!==_0x1b9224['inUse']||_0x402af4[_0xe677('0x2d')]!==_0x1b9224[_0xe677('0x2d')];if(_0x402af4[_0xe677('0x2e')]&&_0x1b9224[_0xe677('0x2e')]){_0x44e0f5=_0x402af4[_0xe677('0x2e')][_0xe677('0x2f')]!==_0x1b9224['Trunk'][_0xe677('0x2f')]||_0x402af4[_0xe677('0x2e')][_0xe677('0x20')]!==_0x1b9224['Trunk']['active'];}return _0x55adbe||_0x36bb79||_0x44e0f5;}exports[_0xe677('0x30')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x26ca3b){var _0x1f1231=null;var _0x588d07=_0x26ca3b[_0xe677('0x31')];if(_[_0xe677('0x32')](_0x26ca3b[_0xe677('0x33')])||_[_0xe677('0x32')](_0x26ca3b['Interval'])||_[_0xe677('0x32')](_0x26ca3b['Interval'][_0xe677('0x34')])){_0x1f1231=CAMPAIGN_STATUS[_0xe677('0x35')];}else if(_[_0xe677('0x36')](_0x26ca3b[_0xe677('0x33')])||_[_0xe677('0x36')](_0x26ca3b['Interval'][_0xe677('0x34')])){_0x1f1231=CAMPAIGN_STATUS[_0xe677('0x37')];}else if(_0x588d07&&!timezones[_0x588d07]){_0x1f1231=CAMPAIGN_STATUS[_0xe677('0x38')];}return _0x1f1231;}function checkAnyValidTrunk(_0x2f0447,_0x570275){var _0xdb4e81=null;var _0x25649b=_0xe677('0x39');var _0x307afc=[_0xe677('0x3a'),'unmonitored'];var _0x34dbe1=!![];if(_0x2f0447['Trunk']&&_0x2f0447[_0xe677('0x2e')][_0xe677('0x20')]){_0x25649b+=_0x2f0447[_0xe677('0x2e')][_0xe677('0x2f')];_0xdb4e81=_0x570275[_0x25649b];_0x34dbe1=_0x307afc['includes'](_0xdb4e81[_0xe677('0x3b')]);}else if(_0x2f0447['TrunkBackup']&&_0x2f0447[_0xe677('0x3c')]['active']){_0x25649b+=_0x2f0447[_0xe677('0x3c')]['name'];_0xdb4e81=_0x570275[_0x25649b];_0x34dbe1=_0x307afc[_0xe677('0x3d')](_0xdb4e81[_0xe677('0x3b')]);}return _0x34dbe1;}function getQueueCampaignStatusMessage(_0x223e05,_0x460ca9){var _0x41028=CAMPAIGN_STATUS[_0xe677('0x6')];var _0x5a7a78=isPreviewCampaign(_0x223e05);if(!isQueueCampaignActive(_0x223e05)){if(_0x5a7a78){_0x41028=CAMPAIGN_STATUS['INACTIVE'];}else{if(_0x223e05[_0xe677('0x2d')]===0x0&&_0x223e05['talking']===0x0&&_0x223e05[_0xe677('0x2b')]===0x0&&(_0x223e05[_0xe677('0x2a')]||0x0)===0x0){_0x41028=CAMPAIGN_STATUS['INACTIVE'];}else{_0x41028=CAMPAIGN_STATUS['DISACTIVED'];}}}else if(_0x223e05[_0xe677('0x26')]===0x0){_0x41028=CAMPAIGN_STATUS[_0xe677('0x3e')];}else if(!checkAnyValidTrunk(_0x223e05,_0x460ca9)){_0x41028=CAMPAIGN_STATUS[_0xe677('0x3f')];}else if(!isPreviewCampaign(_0x223e05)){var _0x379177=checkAnyValidQueueCampaignInterval(_0x223e05);if(_0x379177){_0x41028=_0x379177;}}return _0x41028;}exports[_0xe677('0x40')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0xda05d0){var _0x17c2bf=CAMPAIGN_STATUS[_0xe677('0x41')];if(_0xda05d0[_0xe677('0x2d')]===0x0&&_0xda05d0['talking']===0x0&&_0xda05d0[_0xe677('0x2b')]===0x0&&(_0xda05d0[_0xe677('0x2a')]||0x0)===0x0){_0x17c2bf=CAMPAIGN_STATUS[_0xe677('0x42')];}return _0x17c2bf;}exports[_0xe677('0x43')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x11cc1c){var _0x17f24e=_0x11cc1c[_0xe677('0x44')](/"(.*?)"/);return _0x17f24e?_0x17f24e[0x1]:_0x11cc1c;}exports[_0xe677('0x45')]=extractCalleridName;function getCallerId(_0x8496a6,_0x1eec0f,_0x597a24){if(!_[_0xe677('0x46')](_0x597a24)&&typeof _0x597a24===_0xe677('0x47')&&!_['isEmpty'](_0x597a24)){if(!_[_0xe677('0x46')](_0x1eec0f)&&typeof _0x1eec0f===_0xe677('0x47')&&!_['isEmpty'](_0x1eec0f)){return util[_0xe677('0x48')](_0xe677('0x49'),_0x1eec0f,_0x597a24);}return util[_0xe677('0x48')]('\x22%s\x22\x20<%s>',_0x597a24,_0x597a24);}if(!_['isUndefined'](_0x8496a6)&&typeof _0x8496a6==='string'&&!_[_0xe677('0x36')](_0x8496a6)){return _0x8496a6;}return _0xe677('0x4a');}exports['getCallerId']=getCallerId;function getCallerIdRandom(_0x1af79b,_0x3cd96b){var _0x285ad5;var _0x563daf;var _0x54d23f;if(_0x3cd96b<=0x0){_0x3cd96b=0x1;}_0x285ad5=new RegExp(_0xe677('0x4b')+_0x3cd96b+'}$');_0x563daf=Math['pow'](0xa,_0x3cd96b-0x1);_0x54d23f=Math[_0xe677('0x4c')](0xa,_0x3cd96b)-0x1;return util[_0xe677('0x48')]('%s',_[_0xe677('0x4d')](_0x1af79b,_0x285ad5,_[_0xe677('0x4e')](_0x563daf,_0x54d23f)[_0xe677('0x4f')]()));}exports[_0xe677('0x50')]=getCallerIdRandom;function decrementOriginate(_0x432ba8){if(_0x432ba8[_0xe677('0x2d')]&&_0x432ba8[_0xe677('0x2d')]>0x0){_0x432ba8[_0xe677('0x2d')]-=0x1;}else{logger[_0xe677('0x51')](_0xe677('0x52'));}}exports[_0xe677('0x53')]=decrementOriginate;function checkContactEmpty(_0x475637){return _0x475637&&_0x475637['length']>0x0;}exports['checkContactEmpty']=checkContactEmpty;function erlangb(_0x2213bb,_0x291db1){if(_0x291db1===0x0){return 0x0;}var _0x424b7d=0x1;for(var _0x2b90a2=0x1;_0x2b90a2<=_0x291db1;_0x2b90a2+=0x1){_0x424b7d=0x1+_0x424b7d*_0x2b90a2/_0x2213bb;}return 0x1/_0x424b7d;}exports['erlangb']=erlangb;function checkContactLowerLimitOriginate(_0x7bc30d,_0xd8e973,_0x5625ca){if(_0xd8e973>_0x5625ca){for(var _0x482f78=0x0;_0x482f78<_0xd8e973-_0x5625ca;_0x482f78+=0x1){decrementOriginate(_0x7bc30d);}}}exports['checkContactLowerLimitOriginate']=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x16a186){var _0x361181={};var _0xbd03a=['id',_0xe677('0x54'),_0xe677('0x55'),_0xe677('0x56')];const _0x38d177=0xfa;if(_0x16a186){for(var _0x18e96e in _0x16a186){if(typeof _0x16a186[_0x18e96e]!==_0xe677('0x57')){if(!_[_0xe677('0x32')](_0x16a186[_0x18e96e])&&!_0xbd03a['includes'](_0x18e96e)){if(_0x18e96e===_0xe677('0x58')&&_0x16a186[_0x18e96e][_0xe677('0x59')]>_0x38d177){_0x361181[_0xe677('0x5a')+_0x18e96e['toUpperCase']()]=_0x16a186[_0x18e96e][_0xe677('0x4f')]()[_0xe677('0x5b')](0x0,_0x38d177);}else{_0x361181[_0xe677('0x5a')+_0x18e96e[_0xe677('0x5c')]()]=_0x16a186[_0x18e96e];}}}}}return _0x361181;}exports[_0xe677('0x5d')]=setXMDContactVariables; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 44be73a..485f680 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(_0x4ca52f,_0x282484){var _0x81f696=function(_0x431562){while(--_0x431562){_0x4ca52f['push'](_0x4ca52f['shift']());}};_0x81f696(++_0x282484);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0xa9e0[_0x1b828b];return _0x98da1a;};'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(_0x34a4e2,_0x16cb58){var _0x2be1b4=function(_0x2e600b){while(--_0x2e600b){_0x34a4e2['push'](_0x34a4e2['shift']());}};_0x2be1b4(++_0x16cb58);}(_0xa9e0,0x123));var _0x0a9e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa9e0[_0x297fd3];return _0x2af381;};'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 c34c3d7..e313d82 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 _0xf243=['actions','merge','pick','response','AttachmentId','update','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkTrunk','Trunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','XMF-PATH','variablesAction','Action','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','lodash','bluebird','uuid','moment','path','tiff2pdf','./util/gs','../../../config/logger','fax','../ami','./rpcDb','./channel','./util/util','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','syncNewchannel','bind','syncVarSet','newstate','syncNewState','newexten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','syncOriginateResponse','from-voip-provider','exten','localstationid','uniqueid','channel','name','info','hasOwnProperty','value','channelstate','channelstatedesc','prototype','syncNewExten','variable','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','message','create','parse','application/pdf','then','notify','.pdf','error','\x20notify\x20','catch','\x20receiveFax\x20','stringify'];(function(_0x516ac4,_0x8b2375){var _0x35c675=function(_0x3c0972){while(--_0x3c0972){_0x516ac4['push'](_0x516ac4['shift']());}};_0x35c675(++_0x8b2375);}(_0xf243,0x121));var _0x3f24=function(_0x571c8e,_0x18546d){_0x571c8e=_0x571c8e-0x0;var _0x1fe343=_0xf243[_0x571c8e];return _0x1fe343;};'use strict';var util=require(_0x3f24('0x0'));var _=require(_0x3f24('0x1'));var BPromise=require(_0x3f24('0x2'));var uuid=require(_0x3f24('0x3'));var moment=require(_0x3f24('0x4'));var path=require(_0x3f24('0x5'));var tiff2pdf=require(_0x3f24('0x6'));var gs=require(_0x3f24('0x7'));var logger=require(_0x3f24('0x8'))(_0x3f24('0x9'));var ami=require(_0x3f24('0xa'));var rpcDb=require(_0x3f24('0xb'));var Channel=require(_0x3f24('0xc'));var ut=require(_0x3f24('0xd'));var Action=require('./action');var faxAccount=require(_0x3f24('0xe'));var attachment=require(_0x3f24('0xf'));var faxMessage=require(_0x3f24('0x10'));function Fax(_0x5cc4bd){this[_0x3f24('0x11')]={};this['faxAccounts']=_0x5cc4bd[_0x3f24('0x12')];this['trunks']=_0x5cc4bd[_0x3f24('0x13')];this['actions']={};ami['on']('newchannel',this[_0x3f24('0x14')][_0x3f24('0x15')](this));ami['on']('varset',this[_0x3f24('0x16')]['bind'](this));ami['on'](_0x3f24('0x17'),this[_0x3f24('0x18')][_0x3f24('0x15')](this));ami['on'](_0x3f24('0x19'),this['syncNewExten'][_0x3f24('0x15')](this));ami['on'](_0x3f24('0x1a'),this[_0x3f24('0x1b')][_0x3f24('0x15')](this));ami['on'](_0x3f24('0x1c'),this[_0x3f24('0x1d')][_0x3f24('0x15')](this));ami['on'](_0x3f24('0x1e'),this[_0x3f24('0x1f')][_0x3f24('0x15')](this));ami['on']('originateresponse',this[_0x3f24('0x20')][_0x3f24('0x15')](this));}Fax['prototype'][_0x3f24('0x14')]=function(_0x23a887){if(_0x23a887['context']===_0x3f24('0x21')){for(var _0xd91c33 in this[_0x3f24('0x12')]){if(this[_0x3f24('0x12')]['hasOwnProperty'](_0xd91c33)){if(_0x23a887[_0x3f24('0x22')]===this[_0x3f24('0x12')][_0xd91c33][_0x3f24('0x23')]){this[_0x3f24('0x11')][_0x23a887[_0x3f24('0x24')]]={};this[_0x3f24('0x11')][_0x23a887['uniqueid']][_0x3f24('0x25')]=_0x23a887[_0x3f24('0x25')];this[_0x3f24('0x11')][_0x23a887['uniqueid']]['id']=this[_0x3f24('0x12')][_0xd91c33]['id'];this[_0x3f24('0x11')][_0x23a887['uniqueid']][_0x3f24('0x26')]=this['faxAccounts'][_0xd91c33][_0x3f24('0x26')];logger[_0x3f24('0x27')](_0x23a887[_0x3f24('0x24')],'\x20syncNewchannel\x20');}}}}if(this['actions'][_0x23a887[_0x3f24('0x24')]]){this['channels'][_0x23a887[_0x3f24('0x24')]]={};this['channels'][_0x23a887[_0x3f24('0x24')]]['channel']=_0x23a887['channel'];logger[_0x3f24('0x27')](_0x23a887[_0x3f24('0x24')],'\x20syncNewchannel\x20');}};Fax['prototype'][_0x3f24('0x16')]=function(_0x651432){if(this[_0x3f24('0x11')][_0x651432[_0x3f24('0x24')]]){for(var _0x4b0dbd in _0x651432['variable']){if(_0x651432['variable'][_0x3f24('0x28')](_0x4b0dbd)){this[_0x3f24('0x11')][_0x651432[_0x3f24('0x24')]][_0x4b0dbd]=_0x651432[_0x3f24('0x29')];}}}};Fax['prototype'][_0x3f24('0x18')]=function(_0x2a9a29){if(this[_0x3f24('0x11')][_0x2a9a29[_0x3f24('0x24')]]){this[_0x3f24('0x11')][_0x2a9a29[_0x3f24('0x24')]]['channelstate']=_0x2a9a29[_0x3f24('0x2a')];this[_0x3f24('0x11')][_0x2a9a29[_0x3f24('0x24')]][_0x3f24('0x2b')]=_0x2a9a29[_0x3f24('0x2b')];}};Fax[_0x3f24('0x2c')][_0x3f24('0x2d')]=function(_0x4f2dc1){if(this[_0x3f24('0x11')][_0x4f2dc1[_0x3f24('0x24')]]){for(var _0x47b235 in _0x4f2dc1['variable']){if(_0x4f2dc1[_0x3f24('0x2e')][_0x3f24('0x28')](_0x47b235)){this[_0x3f24('0x11')][_0x4f2dc1[_0x3f24('0x24')]][_0x47b235]=_0x4f2dc1[_0x3f24('0x29')];}}}};Fax[_0x3f24('0x2c')]['syncFaxStatus']=function(_0x41eb44){if(this[_0x3f24('0x11')][_0x41eb44['uniqueid']]){this[_0x3f24('0x11')][_0x41eb44[_0x3f24('0x24')]]['operation']=_0x41eb44['operation'];this['channels'][_0x41eb44[_0x3f24('0x24')]][_0x3f24('0x2f')]=_0x41eb44[_0x3f24('0x2f')];this[_0x3f24('0x11')][_0x41eb44[_0x3f24('0x24')]][_0x3f24('0x23')]=_0x41eb44[_0x3f24('0x23')];this[_0x3f24('0x11')][_0x41eb44['uniqueid']][_0x3f24('0x30')]=_0x41eb44[_0x3f24('0x30')];logger[_0x3f24('0x27')](_0x41eb44[_0x3f24('0x24')],_0x3f24('0x31'));}};Fax[_0x3f24('0x2c')][_0x3f24('0x1d')]=function(_0x269edc){var _0x738172=this;if(this['channels'][_0x269edc[_0x3f24('0x24')]]){var _0x236ab9=this[_0x3f24('0x11')][_0x269edc[_0x3f24('0x24')]]['id'];this['channels'][_0x269edc[_0x3f24('0x24')]][_0x3f24('0x32')]=_0x269edc[_0x3f24('0x32')];this[_0x3f24('0x11')][_0x269edc[_0x3f24('0x24')]][_0x3f24('0x33')]=_0x269edc[_0x3f24('0x33')];this['channels'][_0x269edc[_0x3f24('0x24')]][_0x3f24('0x23')]=_0x269edc[_0x3f24('0x23')];this['channels'][_0x269edc[_0x3f24('0x24')]][_0x3f24('0x34')]=_0x269edc[_0x3f24('0x34')];this[_0x3f24('0x11')][_0x269edc[_0x3f24('0x24')]]['transferrate']=_0x269edc[_0x3f24('0x35')];this['channels'][_0x269edc['uniqueid']][_0x3f24('0x30')]=_0x269edc[_0x3f24('0x30')];this['channels'][_0x269edc[_0x3f24('0x24')]][_0x3f24('0x36')]=_0x269edc['calleridnum'];if(this[_0x3f24('0x11')][_0x269edc[_0x3f24('0x24')]][_0x3f24('0x33')]>0x0){tiff2pdf(_0x269edc[_0x3f24('0x30')],_0x3f24('0x37'),function(_0x5c311b){logger[_0x3f24('0x27')](_0x269edc[_0x3f24('0x24')],'\x20result\x20conversion\x20file\x20',_0x5c311b[_0x3f24('0x38')]);attachment[_0x3f24('0x39')]({'name':path[_0x3f24('0x3a')](_0x269edc[_0x3f24('0x30')])[_0x3f24('0x26')],'basename':path['parse'](_0x269edc[_0x3f24('0x30')])[_0x3f24('0x26')]+'.pdf','type':_0x3f24('0x3b')})[_0x3f24('0x3c')](function(_0x5a8097){faxAccount[_0x3f24('0x3d')](_0x236ab9,{'from':_0x269edc['calleridnum'],'mapKey':_0x3f24('0x9'),'body':path[_0x3f24('0x3a')](_0x269edc[_0x3f24('0x30')])[_0x3f24('0x26')]+_0x3f24('0x3e'),'AttachmentId':_0x5a8097['id']})['catch'](function(_0xf9aab5){logger[_0x3f24('0x3f')](_0x269edc[_0x3f24('0x24')],_0x3f24('0x40'),JSON['stringify'](_0xf9aab5));});})[_0x3f24('0x41')](function(_0x2eb548){logger['error'](_0x269edc[_0x3f24('0x24')],_0x3f24('0x42'),JSON[_0x3f24('0x43')](_0x2eb548));});});}logger[_0x3f24('0x27')](_0x269edc[_0x3f24('0x24')],_0x3f24('0x42'));}};Fax['prototype'][_0x3f24('0x20')]=function(_0x1d94d4){if(this[_0x3f24('0x44')][_0x1d94d4[_0x3f24('0x24')]]){_[_0x3f24('0x45')](this[_0x3f24('0x11')][_0x1d94d4[_0x3f24('0x24')]],_[_0x3f24('0x46')](_0x1d94d4,[_0x3f24('0x47'),'reason']));}};function updateStatus(_0x4059ee){if(_0x4059ee[_0x3f24('0x48')]){faxMessage[_0x3f24('0x49')](_0x4059ee[_0x3f24('0x48')],{'failMessage':'SENDING\x20FAILED\x20'})['then'](function(_0x314911){ut[_0x3f24('0x4a')](_0x3f24('0x4b'),_0x314911);})[_0x3f24('0x41')](function(_0x50eaea){ut[_0x3f24('0x4a')](_0x3f24('0x4c'),_0x50eaea);});}else{ut[_0x3f24('0x4a')](_0x3f24('0x4d'));}}Fax[_0x3f24('0x2c')][_0x3f24('0x4e')]=function(_0x4cef35,_0x12c3ee,_0x42fbed){var _0x392095=this;var _0x3cd6b4={};if(_0x12c3ee){_0x3cd6b4={'read':_0x12c3ee};}else{_0x3cd6b4={'failMessage':_0x42fbed};}if(this['actions'][_0x4cef35][_0x3f24('0x48')]){faxMessage[_0x3f24('0x49')](this[_0x3f24('0x44')][_0x4cef35]['AttachmentId'],_0x3cd6b4)[_0x3f24('0x3c')](function(_0x8a3a7d){ut[_0x3f24('0x4a')](_0x3f24('0x4f'),_0x8a3a7d);})[_0x3f24('0x41')](function(_0x10ed81){ut[_0x3f24('0x4a')]('[Fax][Message][NoUpdate1]',_0x10ed81);})[_0x3f24('0x50')](function(){delete _0x392095[_0x3f24('0x11')][_0x4cef35];delete _0x392095['actions'][_0x4cef35];});}else{ut[_0x3f24('0x4a')](_0x3f24('0x51'));delete this[_0x3f24('0x11')][_0x4cef35];delete this['actions'][_0x4cef35];}};Fax['prototype'][_0x3f24('0x1f')]=function(_0x189840){var _0x15362c=this;if(this[_0x3f24('0x11')][_0x189840[_0x3f24('0x24')]]){if(this[_0x3f24('0x44')][_0x189840[_0x3f24('0x24')]]){this[_0x3f24('0x11')][_0x189840[_0x3f24('0x24')]]['id']=this[_0x3f24('0x44')][_0x189840[_0x3f24('0x24')]]['id'];this[_0x3f24('0x11')][_0x189840[_0x3f24('0x24')]]['name']=this['actions'][_0x189840[_0x3f24('0x24')]]['name'];}logger['info'](_0x189840[_0x3f24('0x24')],this[_0x3f24('0x44')][_0x189840[_0x3f24('0x24')]]?_0x3f24('0x52'):_0x3f24('0x53'),JSON[_0x3f24('0x43')](this['channels'][_0x189840[_0x3f24('0x24')]]));if(this[_0x3f24('0x44')][_0x189840['uniqueid']]){if(this['channels'][_0x189840[_0x3f24('0x24')]]['faxpages']>0x0&&this[_0x3f24('0x11')][_0x189840[_0x3f24('0x24')]][_0x3f24('0x1a')]===_0x3f24('0x54')){this[_0x3f24('0x4e')](_0x189840[_0x3f24('0x24')],!![]);}else{this['updateStatus'](_0x189840[_0x3f24('0x24')],![],this['channels'][_0x189840['uniqueid']][_0x3f24('0x55')]?_0x3f24('0x56')+this['channels'][_0x189840[_0x3f24('0x24')]][_0x3f24('0x55')]:_0x3f24('0x57'));}}}};Fax[_0x3f24('0x2c')]['send']=function(_0x2eac5c){var _0x208b57=this;return new BPromise(function(_0x1892c8,_0x1ebffa){_0x208b57[_0x3f24('0x58')](_0x2eac5c,_0x208b57[_0x3f24('0x12')][_0x2eac5c[_0x3f24('0x59')]])['then'](function(_0x491b68){ut[_0x3f24('0x4a')](_0x3f24('0x5a'),_0x491b68);_0x1892c8(ut['message'](_0x3f24('0x5b')));})[_0x3f24('0x41')](function(_0x583f6d){ut[_0x3f24('0x4a')](_0x3f24('0x5c'),_0x583f6d);updateStatus(_0x2eac5c);_0x1ebffa(ut[_0x3f24('0x38')](_0x3f24('0x5d')));});});};Fax['prototype']['checkAfterSend']=function(_0x25ac9d){var _0x278932=this;return new BPromise(function(_0x23b6b5,_0xb6c3fc){var _0x442bc5=_0x278932[_0x3f24('0x5e')](_0x278932[_0x3f24('0x12')][_0x25ac9d[_0x3f24('0x59')]][_0x3f24('0x5f')],_0x25ac9d);if(_0x442bc5[_0x3f24('0x60')]){_0x23b6b5(ut['message'](_0x3f24('0x61')));}else{_0xb6c3fc(ut[_0x3f24('0x38')](_0x442bc5[_0x3f24('0x38')]));}});};function originate(_0x37e578,_0xd05d2a,_0xfd5937){return new BPromise(function(_0x1d829c,_0x272e77){if(_0xfd5937){var _0x4f9f42=util[_0x3f24('0x62')](_0x3f24('0x63'),path[_0x3f24('0x3a')](_0x37e578[_0x3f24('0x5')])[_0x3f24('0x26')],_0x37e578['path']);gs[_0x3f24('0x64')](_0x4f9f42)[_0x3f24('0x3c')](function(){_0x37e578[_0x3f24('0x5')]=util[_0x3f24('0x62')]('%s/%s.tif',path['parse'](_0x37e578[_0x3f24('0x5')])['dir'],path[_0x3f24('0x3a')](_0x37e578[_0x3f24('0x5')])[_0x3f24('0x26')]);_0xd05d2a[_0x3f24('0x65')]=_0x37e578[_0x3f24('0x5')];ut['logger']('Convert\x20pdf\x20to\x20tif','');ami['Action'](ut[_0x3f24('0x66')](_0x37e578,_0xd05d2a))['then'](function(_0x2d94d8){_0x1d829c(_0x2d94d8);})['catch'](function(_0x4cefb8){_0x272e77(_0x4cefb8);});})[_0x3f24('0x41')](function(_0x1bbd6a){_0x272e77(_0x1bbd6a);});}else{ami[_0x3f24('0x67')](ut['variablesAction'](_0x37e578,_0xd05d2a))[_0x3f24('0x3c')](function(_0x39ecc0){_0x1d829c(_0x39ecc0);})[_0x3f24('0x41')](function(_0x4c004a){_0x272e77(_0x4c004a);});}});}Fax[_0x3f24('0x2c')][_0x3f24('0x58')]=function(_0x2fce16,_0x21cb3d){var _0x1c1b27=this;return new BPromise(function(_0xe903a2,_0x21ecd9){var _0x2a04a1=uuid['v4']();var _0xc806c5=ut[_0x3f24('0x68')](_0x2fce16,_0x21cb3d);_0x1c1b27[_0x3f24('0x44')][_0x2a04a1]=new Action(_0x2a04a1,_0x21cb3d,_0x2fce16);var _0x5d6946=_0x1c1b27[_0x3f24('0x44')][_0x2a04a1];if(path[_0x3f24('0x3a')](_0x2fce16[_0x3f24('0x5')])[_0x3f24('0x69')]===_0x3f24('0x3e')){originate(_0x5d6946,_0xc806c5,!![])['then'](function(_0x11dff8){_0xe903a2(_0x11dff8);})[_0x3f24('0x41')](function(_0x4ed7e5){_0x21ecd9(_0x4ed7e5);});}else{originate(_0x5d6946,_0xc806c5,![])[_0x3f24('0x3c')](function(_0x38ca1c){_0xe903a2(_0x38ca1c);})[_0x3f24('0x41')](function(_0x50712a){_0x21ecd9(_0x50712a);});}});};Fax[_0x3f24('0x2c')][_0x3f24('0x6a')]=function(_0x51e08d){return!_[_0x3f24('0x6b')](_0x51e08d)&&!_[_0x3f24('0x6b')](_0x51e08d[_0x3f24('0x26')])&&!_['isNil'](_0x51e08d[_0x3f24('0x6c')])&&_0x51e08d[_0x3f24('0x6c')]&&!_['isNil'](this[_0x3f24('0x13')][util[_0x3f24('0x62')]('SIP/%s',_0x51e08d[_0x3f24('0x26')])])&&!_['isNil'](this[_0x3f24('0x13')][util['format'](_0x3f24('0x6d'),_0x51e08d[_0x3f24('0x26')])]['status'])&&(this['trunks'][util[_0x3f24('0x62')](_0x3f24('0x6d'),_0x51e08d[_0x3f24('0x26')])][_0x3f24('0x2f')]===_0x3f24('0x6e')||this[_0x3f24('0x13')][util['format'](_0x3f24('0x6d'),_0x51e08d[_0x3f24('0x26')])]['status']==='unmonitored');};Fax[_0x3f24('0x2c')][_0x3f24('0x5e')]=function(_0x6f593b,_0x519ead){if(!this[_0x3f24('0x6a')](_0x6f593b)){ut[_0x3f24('0x4a')](_0x3f24('0x6f'),_[_0x3f24('0x6b')](_0x6f593b)?'':_0x6f593b['name']+_0x3f24('0x70'));return{'isValid':![],'message':_0x3f24('0x71')};}if(_[_0x3f24('0x6b')](_0x519ead['fax'])){ut[_0x3f24('0x4a')]('[Fax][checkTrunk][Empty\x20Fax]',JSON[_0x3f24('0x43')](_0x519ead));return{'isValid':![],'message':_0x3f24('0x72')};}if(_[_0x3f24('0x6b')](_0x519ead[_0x3f24('0x5')])){ut[_0x3f24('0x4a')](_0x3f24('0x73'),JSON['stringify'](_0x519ead));return{'isValid':![],'message':_0x3f24('0x74')};}return{'isValid':!![],'message':_0x3f24('0x75')};};module[_0x3f24('0x76')]=Fax; \ No newline at end of file +var _0x0163=['trunks','syncNewchannel','bind','varset','newstate','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','syncHangup','originateresponse','prototype','context','from-voip-provider','hasOwnProperty','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','actions','syncVarSet','variable','syncNewState','channelstate','channelstatedesc','value','operation','status','filename','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','parse','application/pdf','then','notify','.pdf','catch','error','stringify','\x20receiveFax\x20','merge','pick','response','reason','AttachmentId','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','update','[Fax][Message][Updated]','finally','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring','send','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','FaxAccountId','Trunk','isValid','Trunk\x20Reachable','format','path','execute','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','variablesAction','Action','execOriginate','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','Empty\x20path','Is\x20Valid','exports','util','lodash','bluebird','uuid','moment','tiff2pdf','./util/gs','../../../config/logger','fax','../ami','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','channels','faxAccounts'];(function(_0x3102b5,_0x2efe47){var _0x4ca841=function(_0x51b25e){while(--_0x51b25e){_0x3102b5['push'](_0x3102b5['shift']());}};_0x4ca841(++_0x2efe47);}(_0x0163,0x157));var _0x3016=function(_0x13b3d6,_0x3683d0){_0x13b3d6=_0x13b3d6-0x0;var _0x8f5266=_0x0163[_0x13b3d6];return _0x8f5266;};'use strict';var util=require(_0x3016('0x0'));var _=require(_0x3016('0x1'));var BPromise=require(_0x3016('0x2'));var uuid=require(_0x3016('0x3'));var moment=require(_0x3016('0x4'));var path=require('path');var tiff2pdf=require(_0x3016('0x5'));var gs=require(_0x3016('0x6'));var logger=require(_0x3016('0x7'))(_0x3016('0x8'));var ami=require(_0x3016('0x9'));var rpcDb=require('./rpcDb');var Channel=require(_0x3016('0xa'));var ut=require(_0x3016('0xb'));var Action=require(_0x3016('0xc'));var faxAccount=require(_0x3016('0xd'));var attachment=require(_0x3016('0xe'));var faxMessage=require('../rpc/faxMessage');function Fax(_0x24d8e5){this[_0x3016('0xf')]={};this[_0x3016('0x10')]=_0x24d8e5[_0x3016('0x10')];this['trunks']=_0x24d8e5[_0x3016('0x11')];this['actions']={};ami['on']('newchannel',this[_0x3016('0x12')][_0x3016('0x13')](this));ami['on'](_0x3016('0x14'),this['syncVarSet']['bind'](this));ami['on'](_0x3016('0x15'),this['syncNewState'][_0x3016('0x13')](this));ami['on'](_0x3016('0x16'),this[_0x3016('0x17')][_0x3016('0x13')](this));ami['on'](_0x3016('0x18'),this[_0x3016('0x19')][_0x3016('0x13')](this));ami['on'](_0x3016('0x1a'),this[_0x3016('0x1b')][_0x3016('0x13')](this));ami['on']('hangup',this[_0x3016('0x1c')][_0x3016('0x13')](this));ami['on'](_0x3016('0x1d'),this['syncOriginateResponse'][_0x3016('0x13')](this));}Fax[_0x3016('0x1e')][_0x3016('0x12')]=function(_0x11ed2d){if(_0x11ed2d[_0x3016('0x1f')]===_0x3016('0x20')){for(var _0x4c370f in this['faxAccounts']){if(this['faxAccounts'][_0x3016('0x21')](_0x4c370f)){if(_0x11ed2d['exten']===this[_0x3016('0x10')][_0x4c370f][_0x3016('0x22')]){this[_0x3016('0xf')][_0x11ed2d[_0x3016('0x23')]]={};this[_0x3016('0xf')][_0x11ed2d['uniqueid']][_0x3016('0x24')]=_0x11ed2d['channel'];this[_0x3016('0xf')][_0x11ed2d[_0x3016('0x23')]]['id']=this[_0x3016('0x10')][_0x4c370f]['id'];this['channels'][_0x11ed2d['uniqueid']][_0x3016('0x25')]=this[_0x3016('0x10')][_0x4c370f][_0x3016('0x25')];logger[_0x3016('0x26')](_0x11ed2d[_0x3016('0x23')],_0x3016('0x27'));}}}}if(this[_0x3016('0x28')][_0x11ed2d[_0x3016('0x23')]]){this[_0x3016('0xf')][_0x11ed2d[_0x3016('0x23')]]={};this[_0x3016('0xf')][_0x11ed2d[_0x3016('0x23')]][_0x3016('0x24')]=_0x11ed2d[_0x3016('0x24')];logger[_0x3016('0x26')](_0x11ed2d[_0x3016('0x23')],_0x3016('0x27'));}};Fax[_0x3016('0x1e')][_0x3016('0x29')]=function(_0x290590){if(this['channels'][_0x290590[_0x3016('0x23')]]){for(var _0x297472 in _0x290590[_0x3016('0x2a')]){if(_0x290590[_0x3016('0x2a')][_0x3016('0x21')](_0x297472)){this[_0x3016('0xf')][_0x290590[_0x3016('0x23')]][_0x297472]=_0x290590['value'];}}}};Fax[_0x3016('0x1e')][_0x3016('0x2b')]=function(_0x641bc5){if(this[_0x3016('0xf')][_0x641bc5[_0x3016('0x23')]]){this[_0x3016('0xf')][_0x641bc5[_0x3016('0x23')]][_0x3016('0x2c')]=_0x641bc5['channelstate'];this['channels'][_0x641bc5[_0x3016('0x23')]][_0x3016('0x2d')]=_0x641bc5[_0x3016('0x2d')];}};Fax[_0x3016('0x1e')]['syncNewExten']=function(_0x536f32){if(this['channels'][_0x536f32['uniqueid']]){for(var _0xfdb95e in _0x536f32[_0x3016('0x2a')]){if(_0x536f32['variable'][_0x3016('0x21')](_0xfdb95e)){this['channels'][_0x536f32['uniqueid']][_0xfdb95e]=_0x536f32[_0x3016('0x2e')];}}}};Fax['prototype'][_0x3016('0x19')]=function(_0x27f047){if(this['channels'][_0x27f047['uniqueid']]){this[_0x3016('0xf')][_0x27f047[_0x3016('0x23')]]['operation']=_0x27f047[_0x3016('0x2f')];this[_0x3016('0xf')][_0x27f047[_0x3016('0x23')]][_0x3016('0x30')]=_0x27f047[_0x3016('0x30')];this[_0x3016('0xf')][_0x27f047[_0x3016('0x23')]]['localstationid']=_0x27f047[_0x3016('0x22')];this[_0x3016('0xf')][_0x27f047[_0x3016('0x23')]][_0x3016('0x31')]=_0x27f047[_0x3016('0x31')];logger[_0x3016('0x26')](_0x27f047['uniqueid'],'\x20syncFaxStatus\x20');}};Fax[_0x3016('0x1e')][_0x3016('0x1b')]=function(_0x1ce33b){var _0x25d9d3=this;if(this[_0x3016('0xf')][_0x1ce33b[_0x3016('0x23')]]){var _0x4defd7=this[_0x3016('0xf')][_0x1ce33b[_0x3016('0x23')]]['id'];this[_0x3016('0xf')][_0x1ce33b['uniqueid']][_0x3016('0x32')]=_0x1ce33b[_0x3016('0x32')];this[_0x3016('0xf')][_0x1ce33b[_0x3016('0x23')]][_0x3016('0x33')]=_0x1ce33b[_0x3016('0x33')];this['channels'][_0x1ce33b[_0x3016('0x23')]][_0x3016('0x22')]=_0x1ce33b['localstationid'];this['channels'][_0x1ce33b[_0x3016('0x23')]]['resolution']=_0x1ce33b[_0x3016('0x34')];this[_0x3016('0xf')][_0x1ce33b[_0x3016('0x23')]][_0x3016('0x35')]=_0x1ce33b['transferrate'];this[_0x3016('0xf')][_0x1ce33b[_0x3016('0x23')]]['filename']=_0x1ce33b['filename'];this['channels'][_0x1ce33b[_0x3016('0x23')]][_0x3016('0x36')]=_0x1ce33b[_0x3016('0x36')];if(this[_0x3016('0xf')][_0x1ce33b['uniqueid']][_0x3016('0x33')]>0x0){tiff2pdf(_0x1ce33b[_0x3016('0x31')],_0x3016('0x37'),function(_0x4227dc){logger[_0x3016('0x26')](_0x1ce33b[_0x3016('0x23')],_0x3016('0x38'),_0x4227dc[_0x3016('0x39')]);attachment['create']({'name':path['parse'](_0x1ce33b[_0x3016('0x31')])[_0x3016('0x25')],'basename':path[_0x3016('0x3a')](_0x1ce33b['filename'])[_0x3016('0x25')]+'.pdf','type':_0x3016('0x3b')})[_0x3016('0x3c')](function(_0x89da9b){faxAccount[_0x3016('0x3d')](_0x4defd7,{'from':_0x1ce33b[_0x3016('0x36')],'mapKey':_0x3016('0x8'),'body':path['parse'](_0x1ce33b['filename'])[_0x3016('0x25')]+_0x3016('0x3e'),'AttachmentId':_0x89da9b['id']})[_0x3016('0x3f')](function(_0x11837a){logger[_0x3016('0x40')](_0x1ce33b[_0x3016('0x23')],'\x20notify\x20',JSON[_0x3016('0x41')](_0x11837a));});})[_0x3016('0x3f')](function(_0x54ebba){logger[_0x3016('0x40')](_0x1ce33b['uniqueid'],_0x3016('0x42'),JSON['stringify'](_0x54ebba));});});}logger[_0x3016('0x26')](_0x1ce33b[_0x3016('0x23')],_0x3016('0x42'));}};Fax['prototype']['syncOriginateResponse']=function(_0x48a6a5){if(this[_0x3016('0x28')][_0x48a6a5['uniqueid']]){_[_0x3016('0x43')](this[_0x3016('0xf')][_0x48a6a5[_0x3016('0x23')]],_[_0x3016('0x44')](_0x48a6a5,[_0x3016('0x45'),_0x3016('0x46')]));}};function updateStatus(_0x369fea){if(_0x369fea[_0x3016('0x47')]){faxMessage['update'](_0x369fea[_0x3016('0x47')],{'failMessage':'SENDING\x20FAILED\x20'})[_0x3016('0x3c')](function(_0x38321c){ut[_0x3016('0x48')](_0x3016('0x49'),_0x38321c);})[_0x3016('0x3f')](function(_0x2626d3){ut[_0x3016('0x48')](_0x3016('0x4a'),_0x2626d3);});}else{ut[_0x3016('0x48')](_0x3016('0x4b'));}}Fax[_0x3016('0x1e')][_0x3016('0x4c')]=function(_0x148b50,_0x18df20,_0x2e2131){var _0x224938=this;var _0xa507a8={};if(_0x18df20){_0xa507a8={'read':_0x18df20};}else{_0xa507a8={'failMessage':_0x2e2131};}if(this['actions'][_0x148b50]['AttachmentId']){faxMessage[_0x3016('0x4d')](this[_0x3016('0x28')][_0x148b50]['AttachmentId'],_0xa507a8)[_0x3016('0x3c')](function(_0x263edc){ut[_0x3016('0x48')](_0x3016('0x4e'),_0x263edc);})[_0x3016('0x3f')](function(_0x1681c1){ut[_0x3016('0x48')]('[Fax][Message][NoUpdate1]',_0x1681c1);})[_0x3016('0x4f')](function(){delete _0x224938['channels'][_0x148b50];delete _0x224938[_0x3016('0x28')][_0x148b50];});}else{ut[_0x3016('0x48')]('[Fax][Message][NoUpdate2]');delete this['channels'][_0x148b50];delete this[_0x3016('0x28')][_0x148b50];}};Fax['prototype']['syncHangup']=function(_0x1d1db6){var _0x4d41d4=this;if(this[_0x3016('0xf')][_0x1d1db6['uniqueid']]){if(this[_0x3016('0x28')][_0x1d1db6['uniqueid']]){this[_0x3016('0xf')][_0x1d1db6[_0x3016('0x23')]]['id']=this['actions'][_0x1d1db6[_0x3016('0x23')]]['id'];this[_0x3016('0xf')][_0x1d1db6[_0x3016('0x23')]][_0x3016('0x25')]=this['actions'][_0x1d1db6[_0x3016('0x23')]][_0x3016('0x25')];}logger[_0x3016('0x26')](_0x1d1db6[_0x3016('0x23')],this['actions'][_0x1d1db6[_0x3016('0x23')]]?_0x3016('0x50'):_0x3016('0x51'),JSON[_0x3016('0x41')](this[_0x3016('0xf')][_0x1d1db6[_0x3016('0x23')]]));if(this[_0x3016('0x28')][_0x1d1db6[_0x3016('0x23')]]){if(this[_0x3016('0xf')][_0x1d1db6[_0x3016('0x23')]][_0x3016('0x52')]>0x0&&this['channels'][_0x1d1db6[_0x3016('0x23')]][_0x3016('0x18')]===_0x3016('0x53')){this[_0x3016('0x4c')](_0x1d1db6[_0x3016('0x23')],!![]);}else{this[_0x3016('0x4c')](_0x1d1db6['uniqueid'],![],this['channels'][_0x1d1db6[_0x3016('0x23')]][_0x3016('0x54')]?'SENDING\x20FAILED:\x20'+this[_0x3016('0xf')][_0x1d1db6[_0x3016('0x23')]][_0x3016('0x54')]:'SENDING\x20FAILED');}}}};Fax[_0x3016('0x1e')][_0x3016('0x55')]=function(_0x559ab9){var _0xb75ded=this;return new BPromise(function(_0x35fc74,_0x853395){_0xb75ded['execOriginate'](_0x559ab9,_0xb75ded[_0x3016('0x10')][_0x559ab9['FaxAccountId']])[_0x3016('0x3c')](function(_0x39ca8d){ut['logger'](_0x3016('0x56'),_0x39ca8d);_0x35fc74(ut[_0x3016('0x39')](_0x3016('0x57')));})[_0x3016('0x3f')](function(_0x2e89dd){ut[_0x3016('0x48')](_0x3016('0x58'),_0x2e89dd);updateStatus(_0x559ab9);_0x853395(ut[_0x3016('0x39')](_0x3016('0x59')));});});};Fax['prototype'][_0x3016('0x5a')]=function(_0x1642de){var _0x5d8af9=this;return new BPromise(function(_0x5ed716,_0x373a5b){var _0x2efeda=_0x5d8af9[_0x3016('0x5b')](_0x5d8af9[_0x3016('0x10')][_0x1642de[_0x3016('0x5c')]][_0x3016('0x5d')],_0x1642de);if(_0x2efeda[_0x3016('0x5e')]){_0x5ed716(ut['message'](_0x3016('0x5f')));}else{_0x373a5b(ut[_0x3016('0x39')](_0x2efeda[_0x3016('0x39')]));}});};function originate(_0xcd3f6d,_0x180129,_0x585140){return new BPromise(function(_0x42fddd,_0x4eafc6){if(_0x585140){var _0x3b6dcc=util[_0x3016('0x60')]('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[_0x3016('0x3a')](_0xcd3f6d[_0x3016('0x61')])['name'],_0xcd3f6d[_0x3016('0x61')]);gs[_0x3016('0x62')](_0x3b6dcc)[_0x3016('0x3c')](function(){_0xcd3f6d[_0x3016('0x61')]=util[_0x3016('0x60')]('%s/%s.tif',path[_0x3016('0x3a')](_0xcd3f6d[_0x3016('0x61')])[_0x3016('0x63')],path[_0x3016('0x3a')](_0xcd3f6d[_0x3016('0x61')])[_0x3016('0x25')]);_0x180129[_0x3016('0x64')]=_0xcd3f6d['path'];ut[_0x3016('0x48')](_0x3016('0x65'),'');ami['Action'](ut[_0x3016('0x66')](_0xcd3f6d,_0x180129))[_0x3016('0x3c')](function(_0x38af72){_0x42fddd(_0x38af72);})['catch'](function(_0x54ab44){_0x4eafc6(_0x54ab44);});})[_0x3016('0x3f')](function(_0x586bbd){_0x4eafc6(_0x586bbd);});}else{ami[_0x3016('0x67')](ut['variablesAction'](_0xcd3f6d,_0x180129))['then'](function(_0x53ff18){_0x42fddd(_0x53ff18);})[_0x3016('0x3f')](function(_0x4d4687){_0x4eafc6(_0x4d4687);});}});}Fax['prototype'][_0x3016('0x68')]=function(_0x43bf57,_0x191430){var _0x2ef7df=this;return new BPromise(function(_0x41f1d3,_0x231f28){var _0x1d0097=uuid['v4']();var _0x1e4fb9=ut['addVariables'](_0x43bf57,_0x191430);_0x2ef7df[_0x3016('0x28')][_0x1d0097]=new Action(_0x1d0097,_0x191430,_0x43bf57);var _0x3c32d5=_0x2ef7df[_0x3016('0x28')][_0x1d0097];if(path[_0x3016('0x3a')](_0x43bf57[_0x3016('0x61')])[_0x3016('0x69')]===_0x3016('0x3e')){originate(_0x3c32d5,_0x1e4fb9,!![])[_0x3016('0x3c')](function(_0x57a469){_0x41f1d3(_0x57a469);})[_0x3016('0x3f')](function(_0x5b3d20){_0x231f28(_0x5b3d20);});}else{originate(_0x3c32d5,_0x1e4fb9,![])[_0x3016('0x3c')](function(_0x524876){_0x41f1d3(_0x524876);})[_0x3016('0x3f')](function(_0x4d6142){_0x231f28(_0x4d6142);});}});};Fax[_0x3016('0x1e')][_0x3016('0x6a')]=function(_0x51b0a4){return!_[_0x3016('0x6b')](_0x51b0a4)&&!_[_0x3016('0x6b')](_0x51b0a4['name'])&&!_[_0x3016('0x6b')](_0x51b0a4[_0x3016('0x6c')])&&_0x51b0a4[_0x3016('0x6c')]&&!_['isNil'](this[_0x3016('0x11')][util[_0x3016('0x60')](_0x3016('0x6d'),_0x51b0a4['name'])])&&!_[_0x3016('0x6b')](this['trunks'][util[_0x3016('0x60')](_0x3016('0x6d'),_0x51b0a4[_0x3016('0x25')])][_0x3016('0x30')])&&(this[_0x3016('0x11')][util[_0x3016('0x60')]('SIP/%s',_0x51b0a4[_0x3016('0x25')])]['status']===_0x3016('0x6e')||this['trunks'][util['format']('SIP/%s',_0x51b0a4['name'])][_0x3016('0x30')]===_0x3016('0x6f'));};Fax[_0x3016('0x1e')]['checkTrunk']=function(_0x88edc4,_0x5b4217){if(!this[_0x3016('0x6a')](_0x88edc4)){ut['logger'](_0x3016('0x70'),_[_0x3016('0x6b')](_0x88edc4)?'':_0x88edc4[_0x3016('0x25')]+_0x3016('0x71'));return{'isValid':![],'message':_0x3016('0x72')};}if(_[_0x3016('0x6b')](_0x5b4217['fax'])){ut['logger'](_0x3016('0x73'),JSON['stringify'](_0x5b4217));return{'isValid':![],'message':_0x3016('0x74')};}if(_[_0x3016('0x6b')](_0x5b4217[_0x3016('0x61')])){ut['logger']('[Fax][checkTrunk][Empty\x20path]',JSON[_0x3016('0x41')](_0x5b4217));return{'isValid':![],'message':_0x3016('0x75')};}return{'isValid':!![],'message':_0x3016('0x76')};};module[_0x3016('0x77')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 2fe4074..4e760b3 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 _0xbfe4=['preview','lodash','../rpc/faxAccount','notify','resolve','[Notify]\x20','util','bluebird','../../../config/logger'];(function(_0x4af1fd,_0x166611){var _0x2acc3a=function(_0x32aa97){while(--_0x32aa97){_0x4af1fd['push'](_0x4af1fd['shift']());}};_0x2acc3a(++_0x166611);}(_0xbfe4,0x1ec));var _0x4bfe=function(_0x3bbb91,_0x177da8){_0x3bbb91=_0x3bbb91-0x0;var _0x1a427f=_0xbfe4[_0x3bbb91];return _0x1a427f;};'use strict';var util=require(_0x4bfe('0x0'));var BPromise=require(_0x4bfe('0x1'));var logger=require(_0x4bfe('0x2'))(_0x4bfe('0x3'));var _=require(_0x4bfe('0x4'));var faxAccount=require(_0x4bfe('0x5'));function loggerCatch(_0xe52f96){return function(_0x24ff6e){logger['error'](_0xe52f96,util['inspect'](_0x24ff6e,{'showHidden':![],'depth':null}));};}exports[_0x4bfe('0x6')]=function(_0x49c394,_0x5566af){return BPromise[_0x4bfe('0x7')]()['then'](faxAccount[_0x4bfe('0x6')](_0x49c394,_0x5566af))['catch'](loggerCatch(_0x4bfe('0x8')));}; \ No newline at end of file +var _0x5056=['then','catch','[Notify]\x20','util','bluebird','../../../config/logger','lodash','../rpc/faxAccount','error','notify'];(function(_0x11619f,_0x295a90){var _0x81dd47=function(_0x4e3bce){while(--_0x4e3bce){_0x11619f['push'](_0x11619f['shift']());}};_0x81dd47(++_0x295a90);}(_0x5056,0xfd));var _0x6505=function(_0x410f33,_0x38ff65){_0x410f33=_0x410f33-0x0;var _0x23b1df=_0x5056[_0x410f33];return _0x23b1df;};'use strict';var util=require(_0x6505('0x0'));var BPromise=require(_0x6505('0x1'));var logger=require(_0x6505('0x2'))('preview');var _=require(_0x6505('0x3'));var faxAccount=require(_0x6505('0x4'));function loggerCatch(_0x1a1755){return function(_0x3cfa69){logger[_0x6505('0x5')](_0x1a1755,util['inspect'](_0x3cfa69,{'showHidden':![],'depth':null}));};}exports[_0x6505('0x6')]=function(_0x228597,_0x349220){return BPromise['resolve']()[_0x6505('0x7')](faxAccount[_0x6505('0x6')](_0x228597,_0x349220))[_0x6505('0x8')](loggerCatch(_0x6505('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 0c6b7a3..48c00f0 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 _0x2a1f=['inspect','../../../../config/logger','fax','bluebird','child_process','exec','execute','info','Exec\x20gs','\x20Error\x20:'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x2a1f,0x1e1));var _0xf2a1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2a1f[_0x3dd15e];return _0x231fd0;};'use strict';var util=require('util');var logger=require(_0xf2a1('0x0'))(_0xf2a1('0x1'));var BPromise=require(_0xf2a1('0x2'));var exec=require(_0xf2a1('0x3'))[_0xf2a1('0x4')];exports[_0xf2a1('0x5')]=function(_0x5e3cb8){return new BPromise(function(_0xee7a4a,_0x3e0de1){exec(_0x5e3cb8,function(_0x1e4809,_0x5d04d8,_0xb7765b){logger[_0xf2a1('0x6')](_0xf2a1('0x7'),_0x5d04d8);if(_0x1e4809){logger[_0xf2a1('0x6')]('Exec\x20gs',_0xf2a1('0x8'),util[_0xf2a1('0x9')](_0x1e4809,{'showHidden':![],'depth':null}),_0x5d04d8,_0xb7765b);_0x3e0de1(_0x1e4809);}_0xee7a4a(_0x5d04d8);});});}; \ No newline at end of file +var _0xff20=['bluebird','child_process','exec','execute','info','Exec\x20gs','inspect','util','../../../../config/logger','fax'];(function(_0x570d6f,_0x45f6f){var _0x54f264=function(_0x4d834f){while(--_0x4d834f){_0x570d6f['push'](_0x570d6f['shift']());}};_0x54f264(++_0x45f6f);}(_0xff20,0x13d));var _0x0ff2=function(_0x23d869,_0xe38812){_0x23d869=_0x23d869-0x0;var _0x4eaef3=_0xff20[_0x23d869];return _0x4eaef3;};'use strict';var util=require(_0x0ff2('0x0'));var logger=require(_0x0ff2('0x1'))(_0x0ff2('0x2'));var BPromise=require(_0x0ff2('0x3'));var exec=require(_0x0ff2('0x4'))[_0x0ff2('0x5')];exports[_0x0ff2('0x6')]=function(_0x4e69ea){return new BPromise(function(_0x4dc0ca,_0x1f3352){exec(_0x4e69ea,function(_0x17de61,_0xd32d53,_0x5c262f){logger[_0x0ff2('0x7')](_0x0ff2('0x8'),_0xd32d53);if(_0x17de61){logger['info'](_0x0ff2('0x8'),'\x20Error\x20:',util[_0x0ff2('0x9')](_0x17de61,{'showHidden':![],'depth':null}),_0xd32d53,_0x5c262f);_0x1f3352(_0x17de61);}_0x4dc0ca(_0xd32d53);});});}; \ 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 e91bcb3..2a1ac76 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 _0xf368=['message','info','inspect','ecm','headerinfo','minrate','maxrate','format','\x22%s\x22','modem','t38timeout','localstationid','variablesAction','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','util','lodash','moment','../../../../config/logger','fax'];(function(_0x38ebc4,_0x47148e){var _0x4be4d8=function(_0xafaf78){while(--_0xafaf78){_0x38ebc4['push'](_0x38ebc4['shift']());}};_0x4be4d8(++_0x47148e);}(_0xf368,0x95));var _0x8f36=function(_0x1f19c8,_0x400a24){_0x1f19c8=_0x1f19c8-0x0;var _0x48b90d=_0xf368[_0x1f19c8];return _0x48b90d;};'use strict';var util=require(_0x8f36('0x0'));var _=require(_0x8f36('0x1'));var moment=require(_0x8f36('0x2'));var logger=require(_0x8f36('0x3'))(_0x8f36('0x4'));exports[_0x8f36('0x5')]=function(_0x2592fd){return{'message':_0x2592fd};};exports['logger']=function(_0x460487,_0x570ccd){logger[_0x8f36('0x6')](_0x460487,util[_0x8f36('0x7')](_0x570ccd,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x39a8c1,_0x4fddbc){var _0x2e006f={'XMF-ECM':_0x4fddbc[_0x8f36('0x8')],'XMF-HEADERINFO':_0x4fddbc[_0x8f36('0x9')],'XMF-MINRATE':_0x4fddbc[_0x8f36('0xa')],'XMF-MAXRATE':_0x4fddbc[_0x8f36('0xb')],'XMF-MODEM':util[_0x8f36('0xc')](_0x8f36('0xd'),_0x4fddbc[_0x8f36('0xe')]),'XMF-GATEWAY':_0x4fddbc['gateway'],'XMF-FAXDETECT':_0x4fddbc['faxdetect'],'XMF-T38TIMEOUT':_0x4fddbc[_0x8f36('0xf')],'XMF-LOCALSTATIONID':_0x4fddbc[_0x8f36('0x10')],'XMF-PATH':_0x39a8c1['path']};return _0x2e006f;};exports[_0x8f36('0x11')]=function(_0x658206,_0x20a845){return{'actionid':_0x658206['uniqueid'],'action':'originate','channel':_0x658206[_0x8f36('0x12')],'Exten':_0x8f36('0x13'),'Context':_0x8f36('0x14'),'Priority':'1','callerid':util['format'](_0x8f36('0x15'),_0x658206[_0x8f36('0x9')]?_0x658206[_0x8f36('0x9')]:'',_0x658206[_0x8f36('0x10')]),'variable':_0x20a845,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x658206['uniqueid']};}; \ No newline at end of file +var _0x9300=['\x22%s\x22\x20<%s>','util','fax','message','logger','info','inspect','addVariables','ecm','headerinfo','maxrate','\x22%s\x22','modem','t38timeout','localstationid','variablesAction','uniqueid','channel','xcally-motion-fax','from-sip','format'];(function(_0x140ca7,_0x3e6411){var _0x1a9b7c=function(_0x1eb4f3){while(--_0x1eb4f3){_0x140ca7['push'](_0x140ca7['shift']());}};_0x1a9b7c(++_0x3e6411);}(_0x9300,0xfd));var _0x0930=function(_0x59dc02,_0x120477){_0x59dc02=_0x59dc02-0x0;var _0x556178=_0x9300[_0x59dc02];return _0x556178;};'use strict';var util=require(_0x0930('0x0'));var _=require('lodash');var moment=require('moment');var logger=require('../../../../config/logger')(_0x0930('0x1'));exports[_0x0930('0x2')]=function(_0x35c599){return{'message':_0x35c599};};exports[_0x0930('0x3')]=function(_0x5f4b72,_0x41d5a9){logger[_0x0930('0x4')](_0x5f4b72,util[_0x0930('0x5')](_0x41d5a9,{'showHidden':![],'depth':null}));};exports[_0x0930('0x6')]=function(_0x73ddbb,_0x3d342b){var _0x3b4d69={'XMF-ECM':_0x3d342b[_0x0930('0x7')],'XMF-HEADERINFO':_0x3d342b[_0x0930('0x8')],'XMF-MINRATE':_0x3d342b['minrate'],'XMF-MAXRATE':_0x3d342b[_0x0930('0x9')],'XMF-MODEM':util['format'](_0x0930('0xa'),_0x3d342b[_0x0930('0xb')]),'XMF-GATEWAY':_0x3d342b['gateway'],'XMF-FAXDETECT':_0x3d342b['faxdetect'],'XMF-T38TIMEOUT':_0x3d342b[_0x0930('0xc')],'XMF-LOCALSTATIONID':_0x3d342b[_0x0930('0xd')],'XMF-PATH':_0x73ddbb['path']};return _0x3b4d69;};exports[_0x0930('0xe')]=function(_0x59b25d,_0xae8751){return{'actionid':_0x59b25d[_0x0930('0xf')],'action':'originate','channel':_0x59b25d[_0x0930('0x10')],'Exten':_0x0930('0x11'),'Context':_0x0930('0x12'),'Priority':'1','callerid':util[_0x0930('0x13')](_0x0930('0x14'),_0x59b25d[_0x0930('0x8')]?_0x59b25d[_0x0930('0x8')]:'',_0x59b25d[_0x0930('0xd')]),'variable':_0xae8751,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x59b25d[_0x0930('0xf')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 7a2918e..3a9cfb3 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 _0x51be=['getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','initSugarcrmAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','getFaxAccounts','initFaxAccounts','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','catch','error','[index.js][initParams]','listen','sync','[index.js][main]','inspect','util','moment','./server','./report','./trigger','./dialer','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/template','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/vtiger','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','get','hour','resolve','then','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues'];(function(_0x1d4731,_0x347925){var _0x1056e8=function(_0x14c158){while(--_0x14c158){_0x1d4731['push'](_0x1d4731['shift']());}};_0x1056e8(++_0x347925);}(_0x51be,0x6c));var _0xe51b=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0x51be[_0x2c7618];return _0x5ce3f0;};'use strict';var util=require(_0xe51b('0x0'));var moment=require(_0xe51b('0x1'));var server=require(_0xe51b('0x2'));var Realtime=require('./realtime');var Report=require(_0xe51b('0x3'));var Acw=require('./acw');var Trigger=require(_0xe51b('0x4'));var Dialer=require(_0xe51b('0x5'));var Preview=require('./preview');var Fax=require('./fax');var user=require(_0xe51b('0x6'));var voiceQueue=require(_0xe51b('0x7'));var voiceQueueReport=require(_0xe51b('0x8'));var voiceCallReport=require(_0xe51b('0x9'));var trunk=require(_0xe51b('0xa'));var trigger=require('./rpc/trigger');var template=require(_0xe51b('0xb'));var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require('./rpc/campaign');var voiceExtension=require(_0xe51b('0xc'));var faxAccount=require(_0xe51b('0xd'));var zendesk=require(_0xe51b('0xe'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0xe51b('0xf'));var freshdesk=require(_0xe51b('0x10'));var desk=require(_0xe51b('0x11'));var zoho=require('./rpc/integrations/zoho');var vtiger=require(_0xe51b('0x12'));var freshsales=require('./rpc/integrations/freshsales');var servicenow=require(_0xe51b('0x13'));var dynamics365=require(_0xe51b('0x14'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0xe51b('0x15'))('ami');var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xe51b('0x16')](_0xe51b('0x17'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xe51b('0x16')](_0xe51b('0x17'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0xe51b('0x18')]()[_0xe51b('0x19')](user['getAgents']())[_0xe51b('0x19')](realtime['initAgents']())['then'](user[_0xe51b('0x1a')]())['then'](realtime[_0xe51b('0x1b')]())[_0xe51b('0x19')](trunk[_0xe51b('0x1c')]())[_0xe51b('0x19')](realtime[_0xe51b('0x1d')]())[_0xe51b('0x19')](voiceQueue[_0xe51b('0x1e')]())[_0xe51b('0x19')](realtime[_0xe51b('0x1f')]())[_0xe51b('0x19')](trigger[_0xe51b('0x20')]())[_0xe51b('0x19')](realtime[_0xe51b('0x21')]())[_0xe51b('0x19')](template[_0xe51b('0x22')]())[_0xe51b('0x19')](realtime[_0xe51b('0x23')]())[_0xe51b('0x19')](zendesk[_0xe51b('0x24')]())[_0xe51b('0x19')](realtime[_0xe51b('0x25')]())[_0xe51b('0x19')](salesforce[_0xe51b('0x26')]())[_0xe51b('0x19')](realtime[_0xe51b('0x27')]())[_0xe51b('0x19')](sugarcrm['getSugarcrmAccounts']())[_0xe51b('0x19')](realtime[_0xe51b('0x28')]())[_0xe51b('0x19')](freshdesk['getFreshdeskAccounts']())[_0xe51b('0x19')](realtime[_0xe51b('0x29')]())[_0xe51b('0x19')](desk[_0xe51b('0x2a')]())[_0xe51b('0x19')](realtime[_0xe51b('0x2b')]())[_0xe51b('0x19')](zoho['getZohoAccounts']())[_0xe51b('0x19')](realtime[_0xe51b('0x2c')]())['then'](vtiger[_0xe51b('0x2d')]())[_0xe51b('0x19')](realtime[_0xe51b('0x2e')]())['then'](freshsales[_0xe51b('0x2f')]())[_0xe51b('0x19')](realtime[_0xe51b('0x30')]())[_0xe51b('0x19')](servicenow[_0xe51b('0x31')]())[_0xe51b('0x19')](realtime['initServicenowAccounts']())[_0xe51b('0x19')](dynamics365[_0xe51b('0x32')]())[_0xe51b('0x19')](realtime[_0xe51b('0x33')]())[_0xe51b('0x19')](campaign[_0xe51b('0x34')]())[_0xe51b('0x19')](realtime[_0xe51b('0x35')]())[_0xe51b('0x19')](voiceExtension[_0xe51b('0x36')]())[_0xe51b('0x19')](realtime['initVoiceExtensions']())[_0xe51b('0x19')](faxAccount[_0xe51b('0x37')]())[_0xe51b('0x19')](realtime[_0xe51b('0x38')]())[_0xe51b('0x19')](function(){return realtime;});}function initParams(){return Promise[_0xe51b('0x18')]()[_0xe51b('0x19')](voiceQueueReport['getVoiceQueueReports']())[_0xe51b('0x19')](realtime[_0xe51b('0x39')]())['then'](cmHopperHistory[_0xe51b('0x3a')]())[_0xe51b('0x19')](realtime[_0xe51b('0x3b')]())[_0xe51b('0x19')](cmHopperHistory[_0xe51b('0x3c')]())[_0xe51b('0x19')](realtime[_0xe51b('0x3d')]())[_0xe51b('0x19')](voiceCallReport[_0xe51b('0x3e')]())[_0xe51b('0x19')](realtime['initVoiceCallReports']())[_0xe51b('0x3f')](function(_0xf55378){logger[_0xe51b('0x40')](_0xe51b('0x41'),util['inspect'](_0xf55378,{'showHidden':![],'depth':null}));});}function main(){return server[_0xe51b('0x42')](realtime,preview,fax)[_0xe51b('0x19')](function(){return initRealtime();})[_0xe51b('0x19')](function(){return initParams();})[_0xe51b('0x19')](function(){report[_0xe51b('0x43')]();setInterval(initRealtime,0x1388);})[_0xe51b('0x3f')](function(_0x4f936f){logger[_0xe51b('0x40')](_0xe51b('0x44'),util[_0xe51b('0x45')](_0x4f936f,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0x4387=['./rpc/integrations/servicenow','./rpc/integrations/dynamics365','ami','get','hour','then','initAgents','initTelephones','getTrunks','getVoiceQueues','initVoiceQueues','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','initSalesforceAccounts','getSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','initFreshsalesAccounts','initServicenowAccounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','resolve','getVoiceQueueReports','initVoiceQueueReports','initVoiceQueueHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','error','inspect','listen','sync','[index.js][main]','util','./server','./realtime','./dialer','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/sugarcrm','./rpc/integrations/zoho'];(function(_0x1a1d4a,_0x48ef2b){var _0x44fda1=function(_0x1c68b9){while(--_0x1c68b9){_0x1a1d4a['push'](_0x1a1d4a['shift']());}};_0x44fda1(++_0x48ef2b);}(_0x4387,0x174));var _0x7438=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4387[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x7438('0x0'));var moment=require('moment');var server=require(_0x7438('0x1'));var Realtime=require(_0x7438('0x2'));var Report=require('./report');var Acw=require('./acw');var Trigger=require('./trigger');var Dialer=require(_0x7438('0x3'));var Preview=require('./preview');var Fax=require(_0x7438('0x4'));var user=require(_0x7438('0x5'));var voiceQueue=require(_0x7438('0x6'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0x7438('0x7'));var trunk=require(_0x7438('0x8'));var trigger=require(_0x7438('0x9'));var template=require(_0x7438('0xa'));var cmHopperHistory=require(_0x7438('0xb'));var campaign=require(_0x7438('0xc'));var voiceExtension=require(_0x7438('0xd'));var faxAccount=require(_0x7438('0xe'));var zendesk=require(_0x7438('0xf'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0x7438('0x10'));var freshdesk=require('./rpc/integrations/freshdesk');var desk=require('./rpc/integrations/desk');var zoho=require(_0x7438('0x11'));var vtiger=require('./rpc/integrations/vtiger');var freshsales=require('./rpc/integrations/freshsales');var servicenow=require(_0x7438('0x12'));var dynamics365=require(_0x7438('0x13'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require('../../config/logger')(_0x7438('0x14'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x7438('0x15')](_0x7438('0x16'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get'](_0x7438('0x16'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise['resolve']()[_0x7438('0x17')](user['getAgents']())['then'](realtime[_0x7438('0x18')]())[_0x7438('0x17')](user['getTelephones']())[_0x7438('0x17')](realtime[_0x7438('0x19')]())[_0x7438('0x17')](trunk[_0x7438('0x1a')]())[_0x7438('0x17')](realtime['initTrunks']())[_0x7438('0x17')](voiceQueue[_0x7438('0x1b')]())[_0x7438('0x17')](realtime[_0x7438('0x1c')]())[_0x7438('0x17')](trigger['getTriggers']())[_0x7438('0x17')](realtime[_0x7438('0x1d')]())[_0x7438('0x17')](template[_0x7438('0x1e')]())[_0x7438('0x17')](realtime[_0x7438('0x1f')]())[_0x7438('0x17')](zendesk[_0x7438('0x20')]())[_0x7438('0x17')](realtime[_0x7438('0x21')]())[_0x7438('0x17')](salesforce['getSalesforceAccounts']())[_0x7438('0x17')](realtime[_0x7438('0x22')]())['then'](sugarcrm[_0x7438('0x23')]())[_0x7438('0x17')](realtime['initSugarcrmAccounts']())[_0x7438('0x17')](freshdesk[_0x7438('0x24')]())[_0x7438('0x17')](realtime[_0x7438('0x25')]())[_0x7438('0x17')](desk[_0x7438('0x26')]())[_0x7438('0x17')](realtime['initDeskAccounts']())[_0x7438('0x17')](zoho[_0x7438('0x27')]())['then'](realtime[_0x7438('0x28')]())['then'](vtiger[_0x7438('0x29')]())[_0x7438('0x17')](realtime[_0x7438('0x2a')]())[_0x7438('0x17')](freshsales['getFreshsalesAccounts']())[_0x7438('0x17')](realtime[_0x7438('0x2b')]())[_0x7438('0x17')](servicenow['getServicenowAccounts']())[_0x7438('0x17')](realtime[_0x7438('0x2c')]())[_0x7438('0x17')](dynamics365['getDynamics365Accounts']())['then'](realtime[_0x7438('0x2d')]())[_0x7438('0x17')](campaign[_0x7438('0x2e')]())[_0x7438('0x17')](realtime[_0x7438('0x2f')]())[_0x7438('0x17')](voiceExtension[_0x7438('0x30')]())['then'](realtime[_0x7438('0x31')]())['then'](faxAccount[_0x7438('0x32')]())['then'](realtime[_0x7438('0x33')]())[_0x7438('0x17')](function(){return realtime;});}function initParams(){return Promise[_0x7438('0x34')]()['then'](voiceQueueReport[_0x7438('0x35')]())[_0x7438('0x17')](realtime[_0x7438('0x36')]())[_0x7438('0x17')](cmHopperHistory['getVoiceQueueHopperHistory']())['then'](realtime[_0x7438('0x37')]())[_0x7438('0x17')](cmHopperHistory['getCampaignHopperHistory']())[_0x7438('0x17')](realtime[_0x7438('0x38')]())[_0x7438('0x17')](voiceCallReport[_0x7438('0x39')]())['then'](realtime[_0x7438('0x3a')]())[_0x7438('0x3b')](function(_0x460afa){logger[_0x7438('0x3c')]('[index.js][initParams]',util[_0x7438('0x3d')](_0x460afa,{'showHidden':![],'depth':null}));});}function main(){return server[_0x7438('0x3e')](realtime,preview,fax)['then'](function(){return initRealtime();})[_0x7438('0x17')](function(){return initParams();})[_0x7438('0x17')](function(){report[_0x7438('0x3f')]();setInterval(initRealtime,0x1388);})[_0x7438('0x3b')](function(_0x25d24d){logger['error'](_0x7438('0x40'),util[_0x7438('0x3d')](_0x25d24d,{'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 ab1ab27..15465a9 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 _0x397b=['user:%s','emit','user:ami:update','omit','exports','lodash','util','moment','md5','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','email','accountcode','fullname','state','unknown','stateTime','status','address','phone','mobile','interface','online','voiceStatus','voiceStatusCallerIdNumber','onhold','local','updateStatusRealtime','toLowerCase','not_inuse','idle','inuse','talking','statePause','voiceStatusTime','toNumber','stringify','format'];(function(_0x2fd745,_0x537e71){var _0x52ffb7=function(_0x3b5db2){while(--_0x3b5db2){_0x2fd745['push'](_0x2fd745['shift']());}};_0x52ffb7(++_0x537e71);}(_0x397b,0x17f));var _0xb397=function(_0x2f2750,_0x551688){_0x2f2750=_0x2f2750-0x0;var _0x40623f=_0x397b[_0x2f2750];return _0x40623f;};'use strict';var _=require(_0xb397('0x0'));var util=require(_0xb397('0x1'));var moment=require(_0xb397('0x2'));var md5=require(_0xb397('0x3'));var Redis=require(_0xb397('0x4'));var config=require(_0xb397('0x5'));config[_0xb397('0x6')]=_['defaults'](config['redis'],{'host':_0xb397('0x7'),'port':0x18eb});var io=require(_0xb397('0x8'))(new Redis(config[_0xb397('0x6')]));function Agent(_0x5484ad){this['id']=_0x5484ad['id']||0x0;this[_0xb397('0x9')]=_0x5484ad['name']||'';this[_0xb397('0xa')]=_0x5484ad[_0xb397('0xa')]||'';this[_0xb397('0xb')]=_0x5484ad[_0xb397('0xb')]||'';this[_0xb397('0xc')]=_0x5484ad[_0xb397('0xc')]||'';this[_0xb397('0xd')]=_0xb397('0xe');this[_0xb397('0xf')]=0x0;this[_0xb397('0x10')]='unknown';this[_0xb397('0x11')]='';this[_0xb397('0x12')]='';this[_0xb397('0x13')]='';this[_0xb397('0x14')]='';this[_0xb397('0x15')]=_0x5484ad[_0xb397('0x15')]||![];this[_0xb397('0x16')]=_0xb397('0xe');this['voiceStatusTime']=0x0;this[_0xb397('0x17')]='';this['voiceStatusQueue']='';this[_0xb397('0x18')]=![];this[_0xb397('0x19')]=![];this[_0xb397('0x3')]='';}Agent['prototype'][_0xb397('0x1a')]=function(_0x2f89ee){var _0x839f89;if(_0x2f89ee&&_0x2f89ee[_0xb397('0xd')]){_0x839f89=_0x2f89ee[_0xb397('0xd')][_0xb397('0x1b')]();switch(_0x839f89){case _0xb397('0x1c'):_0x839f89=_0xb397('0x1d');break;case _0xb397('0x1e'):_0x839f89=_0xb397('0x1f');break;}}if(_0x839f89&&this[_0xb397('0x16')]!==_0x839f89||_0x2f89ee[_0xb397('0x20')]){this[_0xb397('0x21')]=_[_0xb397('0x22')](moment()['format']('x'));}if(_0x839f89){this[_0xb397('0x16')]=_0x839f89;}var _0x159a22={'id':this['id'],'name':this[_0xb397('0x9')],'email':this['email'],'accountcode':this[_0xb397('0xb')],'fullname':this[_0xb397('0xc')],'state':this['state'],'stateTime':this['stateTime'],'status':this[_0xb397('0x10')],'address':this[_0xb397('0x11')],'online':this[_0xb397('0x15')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this[_0xb397('0x21')],'voiceStatusCallerIdNumber':this[_0xb397('0x17')],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this[_0xb397('0x14')],'onhold':this[_0xb397('0x18')]};var _0x596fd2=md5(JSON[_0xb397('0x23')](_0x159a22));if(this[_0xb397('0x3')]!==_0x596fd2){this[_0xb397('0x3')]=_0x596fd2;io['to'](util[_0xb397('0x24')](_0xb397('0x25'),_0x159a22[_0xb397('0x9')]))[_0xb397('0x26')](_0xb397('0x27'),_[_0xb397('0x28')](_0x159a22,['online']));io[_0xb397('0x26')]('user:presence',_0x159a22);}};module[_0xb397('0x29')]=Agent; \ No newline at end of file +var _0x4f02=['onhold','prototype','updateStatusRealtime','toLowerCase','not_inuse','idle','inuse','talking','toNumber','voiceStatusCallerIdNumber','stringify','format','user:ami:update','omit','user:presence','lodash','util','moment','md5','../../../config/environment','defaults','localhost','socket.io-emitter','redis','name','accountcode','fullname','state','stateTime','status','address','mobile','interface','online','voiceStatus','unknown','voiceStatusTime','voiceStatusQueue'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x4f02,0x1d7));var _0x24f0=function(_0x584636,_0x2512ef){_0x584636=_0x584636-0x0;var _0x3461b4=_0x4f02[_0x584636];return _0x3461b4;};'use strict';var _=require(_0x24f0('0x0'));var util=require(_0x24f0('0x1'));var moment=require(_0x24f0('0x2'));var md5=require(_0x24f0('0x3'));var Redis=require('ioredis');var config=require(_0x24f0('0x4'));config['redis']=_[_0x24f0('0x5')](config['redis'],{'host':_0x24f0('0x6'),'port':0x18eb});var io=require(_0x24f0('0x7'))(new Redis(config[_0x24f0('0x8')]));function Agent(_0x5eda76){this['id']=_0x5eda76['id']||0x0;this['name']=_0x5eda76[_0x24f0('0x9')]||'';this['email']=_0x5eda76['email']||'';this[_0x24f0('0xa')]=_0x5eda76[_0x24f0('0xa')]||'';this[_0x24f0('0xb')]=_0x5eda76[_0x24f0('0xb')]||'';this[_0x24f0('0xc')]='unknown';this[_0x24f0('0xd')]=0x0;this[_0x24f0('0xe')]='unknown';this[_0x24f0('0xf')]='';this['phone']='';this[_0x24f0('0x10')]='';this[_0x24f0('0x11')]='';this[_0x24f0('0x12')]=_0x5eda76[_0x24f0('0x12')]||![];this[_0x24f0('0x13')]=_0x24f0('0x14');this[_0x24f0('0x15')]=0x0;this['voiceStatusCallerIdNumber']='';this[_0x24f0('0x16')]='';this[_0x24f0('0x17')]=![];this['local']=![];this['md5']='';}Agent[_0x24f0('0x18')][_0x24f0('0x19')]=function(_0x204110){var _0x4a6d1a;if(_0x204110&&_0x204110[_0x24f0('0xc')]){_0x4a6d1a=_0x204110[_0x24f0('0xc')][_0x24f0('0x1a')]();switch(_0x4a6d1a){case _0x24f0('0x1b'):_0x4a6d1a=_0x24f0('0x1c');break;case _0x24f0('0x1d'):_0x4a6d1a=_0x24f0('0x1e');break;}}if(_0x4a6d1a&&this[_0x24f0('0x13')]!==_0x4a6d1a||_0x204110['statePause']){this[_0x24f0('0x15')]=_[_0x24f0('0x1f')](moment()['format']('x'));}if(_0x4a6d1a){this[_0x24f0('0x13')]=_0x4a6d1a;}var _0x29f119={'id':this['id'],'name':this[_0x24f0('0x9')],'email':this['email'],'accountcode':this[_0x24f0('0xa')],'fullname':this[_0x24f0('0xb')],'state':this['state'],'stateTime':this['stateTime'],'status':this[_0x24f0('0xe')],'address':this['address'],'online':this['online'],'voiceStatus':this[_0x24f0('0x13')],'voiceStatusTime':this[_0x24f0('0x15')],'voiceStatusCallerIdNumber':this[_0x24f0('0x20')],'voiceStatusQueue':this[_0x24f0('0x16')],'interface':this['interface'],'onhold':this[_0x24f0('0x17')]};var _0x5b961d=md5(JSON[_0x24f0('0x21')](_0x29f119));if(this[_0x24f0('0x3')]!==_0x5b961d){this['md5']=_0x5b961d;io['to'](util[_0x24f0('0x22')]('user:%s',_0x29f119[_0x24f0('0x9')]))['emit'](_0x24f0('0x23'),_[_0x24f0('0x24')](_0x29f119,['online']));io['emit'](_0x24f0('0x25'),_0x29f119);}};module['exports']=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 7d210ec..6374f43 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 _0x15ba=['dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','ivrAnswerCallsDay','ivrTotalCallsDays','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency'];(function(_0x3fad5a,_0x2d3b02){var _0x4ca713=function(_0x2abe58){while(--_0x2abe58){_0x3fad5a['push'](_0x3fad5a['shift']());}};_0x4ca713(++_0x2d3b02);}(_0x15ba,0x79));var _0xa15b=function(_0x34473f,_0x2b9c5c){_0x34473f=_0x34473f-0x0;var _0x25cf6f=_0x15ba[_0x34473f];return _0x25cf6f;};'use strict';function Campaign(_0x41ec8e){this['id']=_0x41ec8e['id']||0x0;this[_0xa15b('0x0')]=_0x41ec8e[_0xa15b('0x0')]||'';this[_0xa15b('0x1')]=_0x41ec8e[_0xa15b('0x1')]||_0xa15b('0x2');this['originated']=0x0;this['temp']=0x0;this[_0xa15b('0x3')]=0x0;this[_0xa15b('0x4')]=0x0;this['message']='';this[_0xa15b('0x5')]=!![];this['active']=_0x41ec8e[_0xa15b('0x6')];this['limitCalls']=_0x41ec8e[_0xa15b('0x7')];this[_0xa15b('0x8')]=_0x41ec8e[_0xa15b('0x8')]||null;this['dialGlobalInterval']=_0x41ec8e['dialGlobalInterval']?_0x41ec8e[_0xa15b('0x9')]:null;this[_0xa15b('0xa')]=_0x41ec8e[_0xa15b('0xa')];this[_0xa15b('0xb')]=_0x41ec8e['dialOriginateCallerIdNumber'];this[_0xa15b('0xc')]=_0x41ec8e[_0xa15b('0xc')]||0x1e;this[_0xa15b('0xd')]=_0x41ec8e[_0xa15b('0xd')];this[_0xa15b('0xe')]=_0x41ec8e['dialCongestionRetryFrequency'];this[_0xa15b('0xf')]=_0x41ec8e[_0xa15b('0xf')];this[_0xa15b('0x10')]=_0x41ec8e[_0xa15b('0x10')];this[_0xa15b('0x11')]=_0x41ec8e[_0xa15b('0x11')];this[_0xa15b('0x12')]=_0x41ec8e[_0xa15b('0x12')];this[_0xa15b('0x13')]=_0x41ec8e['dialGlobalMaxRetry'];this[_0xa15b('0x14')]=_0x41ec8e[_0xa15b('0x14')]||0x3;this[_0xa15b('0x15')]=_0x41ec8e[_0xa15b('0x15')]||0x96;this['dialDropMaxRetry']=_0x41ec8e[_0xa15b('0x16')]||0x3;this[_0xa15b('0x17')]=_0x41ec8e[_0xa15b('0x17')]||0x96;this[_0xa15b('0x18')]=_0x41ec8e[_0xa15b('0x18')]||0x3;this[_0xa15b('0x19')]=_0x41ec8e[_0xa15b('0x19')]||0x96;this['dialMachineMaxRetry']=_0x41ec8e[_0xa15b('0x1a')]||0x3;this['dialMachineRetryFrequency']=_0x41ec8e[_0xa15b('0x1b')]||0x96;this['dialAgentRejectMaxRetry']=_0x41ec8e['dialAgentRejectMaxRetry']||0x3;this[_0xa15b('0x1c')]=_0x41ec8e[_0xa15b('0x1c')]||0x96;this[_0xa15b('0x1d')]=_0x41ec8e[_0xa15b('0x1d')]||'DESC';this[_0xa15b('0x1e')]=_0x41ec8e[_0xa15b('0x1e')]||undefined;this[_0xa15b('0x1f')]=_0x41ec8e[_0xa15b('0x1f')]||undefined;this[_0xa15b('0x20')]=_0x41ec8e[_0xa15b('0x20')]||undefined;this[_0xa15b('0x21')]=_0x41ec8e[_0xa15b('0x21')]?_0x41ec8e[_0xa15b('0x21')]:undefined;this['Trunk']=_0x41ec8e[_0xa15b('0x22')]?_0x41ec8e['Trunk']:undefined;this[_0xa15b('0x23')]=_0x41ec8e[_0xa15b('0x23')]?_0x41ec8e[_0xa15b('0x23')]:undefined;this[_0xa15b('0x24')]=_0x41ec8e[_0xa15b('0x24')]?_0x41ec8e['SquareProject']:undefined;this[_0xa15b('0x25')]=_0x41ec8e['SquareProject']?_0x41ec8e[_0xa15b('0x24')][_0xa15b('0x0')]:undefined;this[_0xa15b('0x26')]=_0x41ec8e[_0xa15b('0x26')]||![];this[_0xa15b('0x27')]=_0x41ec8e[_0xa15b('0x27')];this[_0xa15b('0x28')]=_0x41ec8e[_0xa15b('0x28')];this['dialAMDAfterGreetingSilence']=_0x41ec8e[_0xa15b('0x29')];this[_0xa15b('0x2a')]=_0x41ec8e[_0xa15b('0x2a')];this[_0xa15b('0x2b')]=_0x41ec8e[_0xa15b('0x2b')];this['dialAMDBetweenWordsSilence']=_0x41ec8e[_0xa15b('0x2c')];this[_0xa15b('0x2d')]=_0x41ec8e[_0xa15b('0x2d')];this[_0xa15b('0x2e')]=_0x41ec8e[_0xa15b('0x2e')];this[_0xa15b('0x2f')]=_0x41ec8e[_0xa15b('0x2f')];}module[_0xa15b('0x30')]=Campaign; \ No newline at end of file +var _0x52f9=['dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','name','type','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence'];(function(_0x2cf2e9,_0xd58ea1){var _0xd3670d=function(_0x272868){while(--_0x272868){_0x2cf2e9['push'](_0x2cf2e9['shift']());}};_0xd3670d(++_0xd58ea1);}(_0x52f9,0x95));var _0x952f=function(_0x4bcc6f,_0x3c8136){_0x4bcc6f=_0x4bcc6f-0x0;var _0x5dfd0b=_0x52f9[_0x4bcc6f];return _0x5dfd0b;};'use strict';function Campaign(_0x2785b9){this['id']=_0x2785b9['id']||0x0;this[_0x952f('0x0')]=_0x2785b9[_0x952f('0x0')]||'';this[_0x952f('0x1')]=_0x2785b9[_0x952f('0x1')]||'campaign';this[_0x952f('0x2')]=0x0;this[_0x952f('0x3')]=0x0;this[_0x952f('0x4')]=0x0;this[_0x952f('0x5')]=0x0;this['message']='';this['sendMessageOneNotActive']=!![];this[_0x952f('0x6')]=_0x2785b9['active'];this[_0x952f('0x7')]=_0x2785b9[_0x952f('0x7')];this[_0x952f('0x8')]=_0x2785b9[_0x952f('0x8')]||null;this['dialGlobalInterval']=_0x2785b9[_0x952f('0x9')]?_0x2785b9['dialGlobalInterval']:null;this[_0x952f('0xa')]=_0x2785b9[_0x952f('0xa')];this[_0x952f('0xb')]=_0x2785b9[_0x952f('0xb')];this[_0x952f('0xc')]=_0x2785b9['dialOriginateTimeout']||0x1e;this[_0x952f('0xd')]=_0x2785b9[_0x952f('0xd')];this['dialCongestionRetryFrequency']=_0x2785b9[_0x952f('0xe')];this[_0x952f('0xf')]=_0x2785b9[_0x952f('0xf')];this[_0x952f('0x10')]=_0x2785b9[_0x952f('0x10')];this[_0x952f('0x11')]=_0x2785b9[_0x952f('0x11')];this['dialNoAnswerRetryFrequency']=_0x2785b9['dialNoAnswerRetryFrequency'];this[_0x952f('0x12')]=_0x2785b9[_0x952f('0x12')];this[_0x952f('0x13')]=_0x2785b9[_0x952f('0x13')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x2785b9[_0x952f('0x14')]||0x96;this['dialDropMaxRetry']=_0x2785b9['dialDropMaxRetry']||0x3;this[_0x952f('0x15')]=_0x2785b9[_0x952f('0x15')]||0x96;this[_0x952f('0x16')]=_0x2785b9[_0x952f('0x16')]||0x3;this[_0x952f('0x17')]=_0x2785b9[_0x952f('0x17')]||0x96;this['dialMachineMaxRetry']=_0x2785b9[_0x952f('0x18')]||0x3;this['dialMachineRetryFrequency']=_0x2785b9['dialMachineRetryFrequency']||0x96;this[_0x952f('0x19')]=_0x2785b9[_0x952f('0x19')]||0x3;this[_0x952f('0x1a')]=_0x2785b9[_0x952f('0x1a')]||0x96;this[_0x952f('0x1b')]=_0x2785b9[_0x952f('0x1b')]||_0x952f('0x1c');this[_0x952f('0x1d')]=_0x2785b9[_0x952f('0x1d')]||undefined;this[_0x952f('0x1e')]=_0x2785b9[_0x952f('0x1e')]||undefined;this[_0x952f('0x1f')]=_0x2785b9[_0x952f('0x1f')]||undefined;this[_0x952f('0x20')]=_0x2785b9[_0x952f('0x20')]?_0x2785b9[_0x952f('0x20')]:undefined;this[_0x952f('0x21')]=_0x2785b9[_0x952f('0x21')]?_0x2785b9['Trunk']:undefined;this[_0x952f('0x22')]=_0x2785b9['Interval']?_0x2785b9[_0x952f('0x22')]:undefined;this[_0x952f('0x23')]=_0x2785b9['SquareProject']?_0x2785b9[_0x952f('0x23')]:undefined;this[_0x952f('0x24')]=_0x2785b9[_0x952f('0x23')]?_0x2785b9[_0x952f('0x23')]['name']:undefined;this[_0x952f('0x25')]=_0x2785b9['dialAMDActive']||![];this[_0x952f('0x26')]=_0x2785b9[_0x952f('0x26')];this['dialAMDGreeting']=_0x2785b9[_0x952f('0x27')];this['dialAMDAfterGreetingSilence']=_0x2785b9[_0x952f('0x28')];this[_0x952f('0x29')]=_0x2785b9[_0x952f('0x29')];this[_0x952f('0x2a')]=_0x2785b9[_0x952f('0x2a')];this['dialAMDBetweenWordsSilence']=_0x2785b9[_0x952f('0x2b')];this[_0x952f('0x2c')]=_0x2785b9[_0x952f('0x2c')];this[_0x952f('0x2d')]=_0x2785b9[_0x952f('0x2d')];this[_0x952f('0x2e')]=_0x2785b9['dialAMDMaximumWordLength'];}module['exports']=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 7bac8c8..324b905 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 _0xb7d6=['transfercalleridnum','transferconnectedlinenum','mohtime','exports','calleridnum','calleridname','connectedlinenum','accountcode','context','uniqueid','linkedid','answered','answertime','endtime','unmanaged','abandoned','lastapplication','duration','billableseconds','holdtime','monitor','monitorFilename'];(function(_0x32be15,_0x2047b2){var _0x250f01=function(_0x2ce8d0){while(--_0x2ce8d0){_0x32be15['push'](_0x32be15['shift']());}};_0x250f01(++_0x2047b2);}(_0xb7d6,0xca));var _0x6b7d=function(_0x3c7869,_0x207240){_0x3c7869=_0x3c7869-0x0;var _0x23bc0b=_0xb7d6[_0x3c7869];return _0x23bc0b;};'use strict';function Channel(){this['starttime']=null;this['channel']='';this['destinationchannel']='';this[_0x6b7d('0x0')]=0x0;this[_0x6b7d('0x1')]='';this[_0x6b7d('0x2')]=undefined;this['connectedlinename']=undefined;this[_0x6b7d('0x3')]=0x0;this[_0x6b7d('0x4')]='';this[_0x6b7d('0x5')]=0x0;this[_0x6b7d('0x6')]=0x0;this['exten']=0x0;this[_0x6b7d('0x7')]=![];this[_0x6b7d('0x8')]=null;this[_0x6b7d('0x9')]=null;this[_0x6b7d('0xa')]=![];this[_0x6b7d('0xb')]=![];this[_0x6b7d('0xc')]='';this['lastdata']='';this[_0x6b7d('0xd')]=0x0;this[_0x6b7d('0xe')]=0x0;this[_0x6b7d('0xf')]=0x0;this['type']=null;this['tag']=null;this['disposition']=null;this[_0x6b7d('0x10')]=![];this[_0x6b7d('0x11')]=null;this['queue']=null;this['monitors']=[];this[_0x6b7d('0x12')]=undefined;this[_0x6b7d('0x13')]=undefined;this['transferType']=undefined;this[_0x6b7d('0x14')]=0x0;}module[_0x6b7d('0x15')]=Channel; \ No newline at end of file +var _0xef7e=['destinationchannel','calleridnum','connectedlinenum','accountcode','context','uniqueid','linkedid','exten','answered','answertime','endtime','unmanaged','abandoned','lastapplication','lastdata','duration','billableseconds','holdtime','type','disposition','monitorFilename','queue','monitors','transfercalleridnum','transferconnectedlinenum','transferType','starttime'];(function(_0x29af39,_0x343c56){var _0x3ab715=function(_0x24eaea){while(--_0x24eaea){_0x29af39['push'](_0x29af39['shift']());}};_0x3ab715(++_0x343c56);}(_0xef7e,0x194));var _0xeef7=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xef7e[_0x122ef9];return _0x42fba0;};'use strict';function Channel(){this[_0xeef7('0x0')]=null;this['channel']='';this[_0xeef7('0x1')]='';this[_0xeef7('0x2')]=0x0;this['calleridname']='';this[_0xeef7('0x3')]=undefined;this['connectedlinename']=undefined;this[_0xeef7('0x4')]=0x0;this[_0xeef7('0x5')]='';this[_0xeef7('0x6')]=0x0;this[_0xeef7('0x7')]=0x0;this[_0xeef7('0x8')]=0x0;this[_0xeef7('0x9')]=![];this[_0xeef7('0xa')]=null;this[_0xeef7('0xb')]=null;this[_0xeef7('0xc')]=![];this[_0xeef7('0xd')]=![];this[_0xeef7('0xe')]='';this[_0xeef7('0xf')]='';this[_0xeef7('0x10')]=0x0;this[_0xeef7('0x11')]=0x0;this[_0xeef7('0x12')]=0x0;this[_0xeef7('0x13')]=null;this['tag']=null;this[_0xeef7('0x14')]=null;this['monitor']=![];this[_0xeef7('0x15')]=null;this[_0xeef7('0x16')]=null;this[_0xeef7('0x17')]=[];this[_0xeef7('0x18')]=undefined;this[_0xeef7('0x19')]=undefined;this[_0xeef7('0x1a')]=undefined;this['mohtime']=0x0;}module['exports']=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 73d6547..7f633e7 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 _0x2e62=['consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name','remoteUri','authType','password'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2e62,0x14c));var _0x22e6=function(_0x2fe1de,_0x2ca69a){_0x2fe1de=_0x2fe1de-0x0;var _0x5d59fe=_0x2e62[_0x2fe1de];return _0x5d59fe;};'use strict';function DeskAccount(_0x3c3684){this['id']=_0x3c3684['id']||0x0;this[_0x22e6('0x0')]=_0x3c3684[_0x22e6('0x0')]||'';this['username']=_0x3c3684['username']||'';this[_0x22e6('0x1')]=_0x3c3684[_0x22e6('0x1')]||'';this['authType']=_0x3c3684[_0x22e6('0x2')]||'';this[_0x22e6('0x3')]=_0x3c3684[_0x22e6('0x3')]||'';this[_0x22e6('0x4')]=_0x3c3684['consumerKey']||'';this[_0x22e6('0x5')]=_0x3c3684[_0x22e6('0x5')]||'';this[_0x22e6('0x6')]=_0x3c3684[_0x22e6('0x6')]||'';this[_0x22e6('0x7')]=_0x3c3684[_0x22e6('0x7')]||'';this[_0x22e6('0x8')]=_0x3c3684[_0x22e6('0x8')]||'';this['serverUrl']=_0x3c3684[_0x22e6('0x9')]||'';this[_0x22e6('0xa')]=_0x3c3684[_0x22e6('0xa')]||{};}module[_0x22e6('0xb')]=DeskAccount; \ No newline at end of file +var _0xd6d7=['username','remoteUri','authType','password','consumerKey','consumerSecret','tokenSecret','type','serverUrl','Configurations','exports','name'];(function(_0x3f1b36,_0x205b14){var _0x56a704=function(_0x3fc084){while(--_0x3fc084){_0x3f1b36['push'](_0x3f1b36['shift']());}};_0x56a704(++_0x205b14);}(_0xd6d7,0xa7));var _0x7d6d=function(_0x23202d,_0x2c1b45){_0x23202d=_0x23202d-0x0;var _0x39bb25=_0xd6d7[_0x23202d];return _0x39bb25;};'use strict';function DeskAccount(_0x294be6){this['id']=_0x294be6['id']||0x0;this[_0x7d6d('0x0')]=_0x294be6[_0x7d6d('0x0')]||'';this[_0x7d6d('0x1')]=_0x294be6[_0x7d6d('0x1')]||'';this[_0x7d6d('0x2')]=_0x294be6[_0x7d6d('0x2')]||'';this[_0x7d6d('0x3')]=_0x294be6[_0x7d6d('0x3')]||'';this[_0x7d6d('0x4')]=_0x294be6['password']||'';this[_0x7d6d('0x5')]=_0x294be6[_0x7d6d('0x5')]||'';this[_0x7d6d('0x6')]=_0x294be6[_0x7d6d('0x6')]||'';this['token']=_0x294be6['token']||'';this[_0x7d6d('0x7')]=_0x294be6[_0x7d6d('0x7')]||'';this[_0x7d6d('0x8')]=_0x294be6[_0x7d6d('0x8')]||'';this[_0x7d6d('0x9')]=_0x294be6['serverUrl']||'';this[_0x7d6d('0xa')]=_0x294be6[_0x7d6d('0xa')]||{};}module[_0x7d6d('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 61f5245..ee04a4d 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 _0x0a82=['name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider','exports'];(function(_0x57a828,_0x32c096){var _0x58f277=function(_0x2f838f){while(--_0x2f838f){_0x57a828['push'](_0x57a828['shift']());}};_0x58f277(++_0x32c096);}(_0x0a82,0xb4));var _0x20a8=function(_0x3fd3ed,_0x46e931){_0x3fd3ed=_0x3fd3ed-0x0;var _0x3eba1b=_0x0a82[_0x3fd3ed];return _0x3eba1b;};'use strict';function Dynamics365Account(_0x41be01){this['id']=_0x41be01['id']||0x0;this[_0x20a8('0x0')]=_0x41be01[_0x20a8('0x0')]||'';this[_0x20a8('0x1')]=_0x41be01[_0x20a8('0x1')]||'';this[_0x20a8('0x2')]=_0x41be01[_0x20a8('0x2')]||'';this[_0x20a8('0x3')]=_0x41be01[_0x20a8('0x3')]||'';this[_0x20a8('0x4')]=_0x41be01['tenantId']||'';this[_0x20a8('0x5')]=_0x41be01[_0x20a8('0x5')]||'';this[_0x20a8('0x6')]=_0x41be01['clientSecret']||{};this[_0x20a8('0x7')]=_0x41be01['serverUrl']||'';this[_0x20a8('0x8')]=_0x41be01[_0x20a8('0x8')]||![];this[_0x20a8('0x9')]=_0x41be01[_0x20a8('0x9')]||{};this[_0x20a8('0xa')]=_0x41be01['CloudProvider']||{};}module[_0x20a8('0xb')]=Dynamics365Account; \ No newline at end of file +var _0x5719=['tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider','name','username','password','remoteUri'];(function(_0x14fad0,_0x278d75){var _0x5c665f=function(_0xe43a83){while(--_0xe43a83){_0x14fad0['push'](_0x14fad0['shift']());}};_0x5c665f(++_0x278d75);}(_0x5719,0x193));var _0x9571=function(_0x226f68,_0x5eb9ca){_0x226f68=_0x226f68-0x0;var _0x50bf88=_0x5719[_0x226f68];return _0x50bf88;};'use strict';function Dynamics365Account(_0x546e4c){this['id']=_0x546e4c['id']||0x0;this[_0x9571('0x0')]=_0x546e4c[_0x9571('0x0')]||'';this[_0x9571('0x1')]=_0x546e4c['username']||'';this[_0x9571('0x2')]=_0x546e4c[_0x9571('0x2')]||'';this[_0x9571('0x3')]=_0x546e4c['remoteUri']||'';this[_0x9571('0x4')]=_0x546e4c[_0x9571('0x4')]||'';this[_0x9571('0x5')]=_0x546e4c[_0x9571('0x5')]||'';this[_0x9571('0x6')]=_0x546e4c[_0x9571('0x6')]||{};this[_0x9571('0x7')]=_0x546e4c[_0x9571('0x7')]||'';this[_0x9571('0x8')]=_0x546e4c[_0x9571('0x8')]||![];this[_0x9571('0x9')]=_0x546e4c[_0x9571('0x9')]||{};this[_0x9571('0xa')]=_0x546e4c[_0x9571('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 292f58a..f2da37a 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 _0x2c23=['gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29'];(function(_0x104e21,_0x2ea86f){var _0x605b37=function(_0x580fce){while(--_0x580fce){_0x104e21['push'](_0x104e21['shift']());}};_0x605b37(++_0x2ea86f);}(_0x2c23,0x1ef));var _0x32c2=function(_0x241ada,_0x38127a){_0x241ada=_0x241ada-0x0;var _0x3662b7=_0x2c23[_0x241ada];return _0x3662b7;};'use strict';function FaxAccount(_0x2eeeb2){this['id']=_0x2eeeb2['id']||0x0;this[_0x32c2('0x0')]=_0x2eeeb2[_0x32c2('0x0')]||'';this[_0x32c2('0x1')]=_0x2eeeb2[_0x32c2('0x1')];this[_0x32c2('0x2')]=_0x2eeeb2[_0x32c2('0x2')];this[_0x32c2('0x3')]=_0x2eeeb2[_0x32c2('0x3')];this[_0x32c2('0x4')]=_0x2eeeb2['localstationid'];this[_0x32c2('0x5')]=_0x2eeeb2[_0x32c2('0x5')]||0x960;this[_0x32c2('0x6')]=_0x2eeeb2[_0x32c2('0x6')]||0x3840;this[_0x32c2('0x7')]=_0x2eeeb2['modem']||_0x32c2('0x8');this[_0x32c2('0x9')]=_0x2eeeb2[_0x32c2('0x9')]||'no';this['faxdetect']=_0x2eeeb2[_0x32c2('0xa')]||'no';this[_0x32c2('0xb')]=_0x2eeeb2[_0x32c2('0xb')]||0x1388;this[_0x32c2('0xc')]=_0x2eeeb2[_0x32c2('0xc')]||_0x32c2('0xd');this[_0x32c2('0xe')]=_0x2eeeb2[_0x32c2('0xe')]?_0x2eeeb2['Trunk']:undefined;this[_0x32c2('0xf')]=_0x2eeeb2[_0x32c2('0xf')];this[_0x32c2('0x10')]=_0x2eeeb2[_0x32c2('0x10')];}module[_0x32c2('0x11')]=FaxAccount; \ No newline at end of file +var _0x0874=['ListId','key','name','description','ecm','localstationid','minrate','maxrate','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk'];(function(_0x145f13,_0x9d9edf){var _0x5714f7=function(_0x33ed83){while(--_0x33ed83){_0x145f13['push'](_0x145f13['shift']());}};_0x5714f7(++_0x9d9edf);}(_0x0874,0x14c));var _0x4087=function(_0x5ed7fd,_0x3d9340){_0x5ed7fd=_0x5ed7fd-0x0;var _0x497b59=_0x0874[_0x5ed7fd];return _0x497b59;};'use strict';function FaxAccount(_0x4343fe){this['id']=_0x4343fe['id']||0x0;this[_0x4087('0x0')]=_0x4343fe['name']||'';this[_0x4087('0x1')]=_0x4343fe[_0x4087('0x1')];this[_0x4087('0x2')]=_0x4343fe[_0x4087('0x2')];this['headerinfo']=_0x4343fe['headerinfo'];this[_0x4087('0x3')]=_0x4343fe[_0x4087('0x3')];this[_0x4087('0x4')]=_0x4343fe[_0x4087('0x4')]||0x960;this[_0x4087('0x5')]=_0x4343fe['maxrate']||0x3840;this['modem']=_0x4343fe['modem']||_0x4087('0x6');this[_0x4087('0x7')]=_0x4343fe[_0x4087('0x7')]||'no';this[_0x4087('0x8')]=_0x4343fe[_0x4087('0x8')]||'no';this[_0x4087('0x9')]=_0x4343fe[_0x4087('0x9')]||0x1388;this['tech']=_0x4343fe[_0x4087('0xa')]||_0x4087('0xb');this[_0x4087('0xc')]=_0x4343fe[_0x4087('0xc')]?_0x4343fe['Trunk']:undefined;this[_0x4087('0xd')]=_0x4343fe['ListId'];this[_0x4087('0xe')]=_0x4343fe[_0x4087('0xe')];}module['exports']=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index d39ec61..1fb7ff9 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 _0x6862=['Configurations','exports','name','username','apiKey','remoteUri','serverUrl'];(function(_0x54c81c,_0x3a13ab){var _0x35931a=function(_0xab93ab){while(--_0xab93ab){_0x54c81c['push'](_0x54c81c['shift']());}};_0x35931a(++_0x3a13ab);}(_0x6862,0x167));var _0x2686=function(_0x3b49ad,_0x45c559){_0x3b49ad=_0x3b49ad-0x0;var _0x40a733=_0x6862[_0x3b49ad];return _0x40a733;};'use strict';function FreshdeskAccount(_0x315d44){this['id']=_0x315d44['id']||0x0;this[_0x2686('0x0')]=_0x315d44['name']||'';this[_0x2686('0x1')]=_0x315d44[_0x2686('0x1')]||'';this[_0x2686('0x2')]=_0x315d44['token']||'';this['remoteUri']=_0x315d44[_0x2686('0x3')]||'';this[_0x2686('0x4')]=_0x315d44[_0x2686('0x4')]||'';this['Configurations']=_0x315d44[_0x2686('0x5')]||{};}module[_0x2686('0x6')]=FreshdeskAccount; \ No newline at end of file +var _0x73f5=['name','username','apiKey','token','remoteUri','serverUrl','Configurations','exports'];(function(_0x143a91,_0x235332){var _0x1906f5=function(_0xd27eeb){while(--_0xd27eeb){_0x143a91['push'](_0x143a91['shift']());}};_0x1906f5(++_0x235332);}(_0x73f5,0x128));var _0x573f=function(_0x4d6015,_0x4cb603){_0x4d6015=_0x4d6015-0x0;var _0x1180fb=_0x73f5[_0x4d6015];return _0x1180fb;};'use strict';function FreshdeskAccount(_0x1c25ff){this['id']=_0x1c25ff['id']||0x0;this[_0x573f('0x0')]=_0x1c25ff['name']||'';this[_0x573f('0x1')]=_0x1c25ff[_0x573f('0x1')]||'';this[_0x573f('0x2')]=_0x1c25ff[_0x573f('0x3')]||'';this[_0x573f('0x4')]=_0x1c25ff[_0x573f('0x4')]||'';this[_0x573f('0x5')]=_0x1c25ff[_0x573f('0x5')]||'';this[_0x573f('0x6')]=_0x1c25ff[_0x573f('0x6')]||{};}module[_0x573f('0x7')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index b1522a6..08a5d00 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 _0x24ca=['serverUrl','Configurations','exports','name','username','token','remoteUri'];(function(_0x321202,_0x30f6f1){var _0xfb1edd=function(_0x79da74){while(--_0x79da74){_0x321202['push'](_0x321202['shift']());}};_0xfb1edd(++_0x30f6f1);}(_0x24ca,0x1bc));var _0xa24c=function(_0x5c14f6,_0x2979d8){_0x5c14f6=_0x5c14f6-0x0;var _0x4949b3=_0x24ca[_0x5c14f6];return _0x4949b3;};'use strict';function FreshsalesAccount(_0x26ecd3){this['id']=_0x26ecd3['id']||0x0;this['name']=_0x26ecd3[_0xa24c('0x0')]||'';this[_0xa24c('0x1')]=_0x26ecd3[_0xa24c('0x1')]||'';this['apiKey']=_0x26ecd3[_0xa24c('0x2')]||'';this[_0xa24c('0x3')]=_0x26ecd3[_0xa24c('0x3')]||'';this[_0xa24c('0x4')]=_0x26ecd3[_0xa24c('0x4')]||'';this[_0xa24c('0x5')]=_0x26ecd3[_0xa24c('0x5')]||{};}module[_0xa24c('0x6')]=FreshsalesAccount; \ No newline at end of file +var _0x9b6d=['token','remoteUri','serverUrl','Configurations','exports','name','username','apiKey'];(function(_0x1b034d,_0x561940){var _0x4b7018=function(_0xd1a1c7){while(--_0xd1a1c7){_0x1b034d['push'](_0x1b034d['shift']());}};_0x4b7018(++_0x561940);}(_0x9b6d,0x105));var _0xd9b6=function(_0x4340d0,_0x2f85ed){_0x4340d0=_0x4340d0-0x0;var _0x22270b=_0x9b6d[_0x4340d0];return _0x22270b;};'use strict';function FreshsalesAccount(_0x5f5a28){this['id']=_0x5f5a28['id']||0x0;this[_0xd9b6('0x0')]=_0x5f5a28[_0xd9b6('0x0')]||'';this[_0xd9b6('0x1')]=_0x5f5a28[_0xd9b6('0x1')]||'';this[_0xd9b6('0x2')]=_0x5f5a28[_0xd9b6('0x3')]||'';this[_0xd9b6('0x4')]=_0x5f5a28[_0xd9b6('0x4')]||'';this[_0xd9b6('0x5')]=_0x5f5a28[_0xd9b6('0x5')]||'';this[_0xd9b6('0x6')]=_0x5f5a28['Configurations']||{};}module[_0xd9b6('0x7')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 87275ac..55f8ee9 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 _0x9520=['originalposition','channel','connectedlinename','context','exten','holdtime','lastAssignedTo','motionChannel','voice','mohtime','variables','exports','type','calleridname','queue','queuecallerleaveAt','position','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x9520,0xfc));var _0x0952=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x9520[_0xa464c9];return _0x3d73c4;};'use strict';function QueueReport(){this[_0x0952('0x0')]='inbound';this['uniqueid']='';this['calleridnum']='';this[_0x0952('0x1')]='';this[_0x0952('0x2')]='';this['queuecallerjoinAt']=null;this[_0x0952('0x3')]=null;this[_0x0952('0x4')]=0x1;this['count']=0x1;this['queuecallerabandon']=![];this[_0x0952('0x5')]=null;this[_0x0952('0x6')]=![];this[_0x0952('0x7')]=null;this['queuecallerexit']=![];this['queuecallerexitAt']=null;this[_0x0952('0x8')]=0x1;this[_0x0952('0x9')]='';this['connectedlinenum']='';this[_0x0952('0xa')]='';this['accountcode']='';this[_0x0952('0xb')]='';this[_0x0952('0xc')]='';this['priority']='';this[_0x0952('0xd')]=0x0;this['assigned']=![];this[_0x0952('0xe')]='';this[_0x0952('0xf')]=_0x0952('0x10');this[_0x0952('0x11')]=0x0;this[_0x0952('0x12')]={};}module[_0x0952('0x13')]=QueueReport; \ No newline at end of file +var _0xaafd=['queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','originalposition','channel','connectedlinenum','connectedlinename','accountcode','exten','assigned','motionChannel','voice','mohtime','variables','exports','type','inbound','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','count','queuecallerabandon'];(function(_0x304f5f,_0xf5ccce){var _0x218247=function(_0x39e8c9){while(--_0x39e8c9){_0x304f5f['push'](_0x304f5f['shift']());}};_0x218247(++_0xf5ccce);}(_0xaafd,0x154));var _0xdaaf=function(_0x2382b7,_0x271ef2){_0x2382b7=_0x2382b7-0x0;var _0x4ea157=_0xaafd[_0x2382b7];return _0x4ea157;};'use strict';function QueueReport(){this[_0xdaaf('0x0')]=_0xdaaf('0x1');this[_0xdaaf('0x2')]='';this[_0xdaaf('0x3')]='';this[_0xdaaf('0x4')]='';this[_0xdaaf('0x5')]='';this[_0xdaaf('0x6')]=null;this[_0xdaaf('0x7')]=null;this['position']=0x1;this[_0xdaaf('0x8')]=0x1;this[_0xdaaf('0x9')]=![];this[_0xdaaf('0xa')]=null;this[_0xdaaf('0xb')]=![];this[_0xdaaf('0xc')]=null;this['queuecallerexit']=![];this['queuecallerexitAt']=null;this[_0xdaaf('0xd')]=0x1;this[_0xdaaf('0xe')]='';this[_0xdaaf('0xf')]='';this[_0xdaaf('0x10')]='';this[_0xdaaf('0x11')]='';this['context']='';this[_0xdaaf('0x12')]='';this['priority']='';this['holdtime']=0x0;this[_0xdaaf('0x13')]=![];this['lastAssignedTo']='';this[_0xdaaf('0x14')]=_0xdaaf('0x15');this[_0xdaaf('0x16')]=0x0;this[_0xdaaf('0x17')]={};}module[_0xdaaf('0x18')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 328ad76..3c156d7 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 _0xe862=['remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','exports','name','username'];(function(_0xe24204,_0x484b6e){var _0x6ce479=function(_0x479990){while(--_0x479990){_0xe24204['push'](_0xe24204['shift']());}};_0x6ce479(++_0x484b6e);}(_0xe862,0x76));var _0x2e86=function(_0x35d6fd,_0x20bdc4){_0x35d6fd=_0x35d6fd-0x0;var _0x580f93=_0xe862[_0x35d6fd];return _0x580f93;};'use strict';function SalesforceAccount(_0xbd3e63){this['id']=_0xbd3e63['id']||0x0;this['name']=_0xbd3e63[_0x2e86('0x0')]||'';this[_0x2e86('0x1')]=_0xbd3e63[_0x2e86('0x1')]||'';this['remoteUri']=_0xbd3e63[_0x2e86('0x2')]||'';this[_0x2e86('0x3')]=_0xbd3e63[_0x2e86('0x3')]||'';this[_0x2e86('0x4')]=_0xbd3e63[_0x2e86('0x4')]||'';this['clientSecret']=_0xbd3e63[_0x2e86('0x5')]||'';this[_0x2e86('0x6')]=_0xbd3e63[_0x2e86('0x6')]||'';this[_0x2e86('0x7')]=_0xbd3e63['type']||_0x2e86('0x8');this[_0x2e86('0x9')]=_0xbd3e63[_0x2e86('0x9')]||'';this['Configurations']=_0xbd3e63[_0x2e86('0xa')]||{};}module[_0x2e86('0xb')]=SalesforceAccount; \ No newline at end of file +var _0xab95=['username','remoteUri','password','clientId','clientSecret','securityToken','type','serverUrl','Configurations','exports','name'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0xab95,0xaf));var _0x5ab9=function(_0x5e2545,_0x43983e){_0x5e2545=_0x5e2545-0x0;var _0x5692d2=_0xab95[_0x5e2545];return _0x5692d2;};'use strict';function SalesforceAccount(_0x42bd41){this['id']=_0x42bd41['id']||0x0;this[_0x5ab9('0x0')]=_0x42bd41[_0x5ab9('0x0')]||'';this[_0x5ab9('0x1')]=_0x42bd41[_0x5ab9('0x1')]||'';this[_0x5ab9('0x2')]=_0x42bd41[_0x5ab9('0x2')]||'';this[_0x5ab9('0x3')]=_0x42bd41['password']||'';this['clientId']=_0x42bd41[_0x5ab9('0x4')]||'';this[_0x5ab9('0x5')]=_0x42bd41[_0x5ab9('0x5')]||'';this[_0x5ab9('0x6')]=_0x42bd41[_0x5ab9('0x6')]||'';this[_0x5ab9('0x7')]=_0x42bd41[_0x5ab9('0x7')]||'integrationTab';this[_0x5ab9('0x8')]=_0x42bd41[_0x5ab9('0x8')]||'';this[_0x5ab9('0x9')]=_0x42bd41[_0x5ab9('0x9')]||{};}module[_0x5ab9('0xa')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index b648f8f..6fb3018 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 _0x237f=['serverUrl','Configurations','name','username','password','remoteUri'];(function(_0x2b0c03,_0x4c11b2){var _0x4970b8=function(_0x2687c2){while(--_0x2687c2){_0x2b0c03['push'](_0x2b0c03['shift']());}};_0x4970b8(++_0x4c11b2);}(_0x237f,0x12e));var _0xf237=function(_0x22bdd3,_0x552e50){_0x22bdd3=_0x22bdd3-0x0;var _0x44d9d9=_0x237f[_0x22bdd3];return _0x44d9d9;};'use strict';function ServicenowAccount(_0x3db593){this['id']=_0x3db593['id']||0x0;this['name']=_0x3db593[_0xf237('0x0')]||'';this[_0xf237('0x1')]=_0x3db593[_0xf237('0x1')]||'';this[_0xf237('0x2')]=_0x3db593[_0xf237('0x2')]||'';this[_0xf237('0x3')]=_0x3db593[_0xf237('0x3')]||'';this[_0xf237('0x4')]=_0x3db593[_0xf237('0x4')]||'';this[_0xf237('0x5')]=_0x3db593['Configurations']||{};}module['exports']=ServicenowAccount; \ No newline at end of file +var _0x7ac2=['exports','name','password','remoteUri','serverUrl','Configurations'];(function(_0x5d65f1,_0x1cc772){var _0x3de0b0=function(_0xad48dc){while(--_0xad48dc){_0x5d65f1['push'](_0x5d65f1['shift']());}};_0x3de0b0(++_0x1cc772);}(_0x7ac2,0x10f));var _0x27ac=function(_0x7e6d00,_0x1660cf){_0x7e6d00=_0x7e6d00-0x0;var _0x2a81d7=_0x7ac2[_0x7e6d00];return _0x2a81d7;};'use strict';function ServicenowAccount(_0x12b283){this['id']=_0x12b283['id']||0x0;this[_0x27ac('0x0')]=_0x12b283['name']||'';this['username']=_0x12b283['username']||'';this['password']=_0x12b283[_0x27ac('0x1')]||'';this[_0x27ac('0x2')]=_0x12b283['remoteUri']||'';this[_0x27ac('0x3')]=_0x12b283[_0x27ac('0x3')]||'';this[_0x27ac('0x4')]=_0x12b283[_0x27ac('0x4')]||{};}module[_0x27ac('0x5')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index 91fcbb3..ad6a1ab 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 _0x4b93=['name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x1f6d21,_0x4cda66){var _0x5a0649=function(_0x7eb37a){while(--_0x7eb37a){_0x1f6d21['push'](_0x1f6d21['shift']());}};_0x5a0649(++_0x4cda66);}(_0x4b93,0x144));var _0x34b9=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0x4b93[_0x1e7b16];return _0x37fadc;};'use strict';function SugarcrmAccount(_0x187854){this['id']=_0x187854['id']||0x0;this[_0x34b9('0x0')]=_0x187854[_0x34b9('0x0')]||'';this[_0x34b9('0x1')]=_0x187854['username']||'';this[_0x34b9('0x2')]=_0x187854[_0x34b9('0x2')]||'';this[_0x34b9('0x3')]=_0x187854[_0x34b9('0x3')]||'';this[_0x34b9('0x4')]=_0x187854[_0x34b9('0x4')]||'';this[_0x34b9('0x5')]=_0x187854['Configurations']||{};}module['exports']=SugarcrmAccount; \ No newline at end of file +var _0x6ce8=['name','username','password','remoteUri','serverUrl','Configurations','exports'];(function(_0x359e8a,_0x46dfbd){var _0x16fba4=function(_0x137ef3){while(--_0x137ef3){_0x359e8a['push'](_0x359e8a['shift']());}};_0x16fba4(++_0x46dfbd);}(_0x6ce8,0x8c));var _0x86ce=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x6ce8[_0x8c43de];return _0xa6591b;};'use strict';function SugarcrmAccount(_0x44a4f4){this['id']=_0x44a4f4['id']||0x0;this[_0x86ce('0x0')]=_0x44a4f4['name']||'';this['username']=_0x44a4f4[_0x86ce('0x1')]||'';this['password']=_0x44a4f4[_0x86ce('0x2')]||'';this[_0x86ce('0x3')]=_0x44a4f4['remoteUri']||'';this[_0x86ce('0x4')]=_0x44a4f4[_0x86ce('0x4')]||'';this[_0x86ce('0x5')]=_0x44a4f4[_0x86ce('0x5')]||{};}module[_0x86ce('0x6')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index e1bc369..3a58f91 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 _0x851a=['state','unknown','stateTime','status','exports','name','accountcode'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x851a,0x19b));var _0xa851=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x851a[_0x27af45];return _0x18df21;};'use strict';function Telephone(_0x291f55){this['id']=_0x291f55['id']||0x0;this['name']=_0x291f55[_0xa851('0x0')]||'';this[_0xa851('0x1')]=_0x291f55[_0xa851('0x1')]||'';this[_0xa851('0x2')]=_0xa851('0x3');this[_0xa851('0x4')]=0x0;this[_0xa851('0x5')]=_0xa851('0x3');this['address']='';}module[_0xa851('0x6')]=Telephone; \ No newline at end of file +var _0xf99c=['stateTime','status','address','name','accountcode','state','unknown'];(function(_0x193b04,_0x4b0ebc){var _0x1546d5=function(_0x203f4b){while(--_0x203f4b){_0x193b04['push'](_0x193b04['shift']());}};_0x1546d5(++_0x4b0ebc);}(_0xf99c,0x129));var _0xcf99=function(_0x2731f3,_0x1b0cbc){_0x2731f3=_0x2731f3-0x0;var _0xf936c4=_0xf99c[_0x2731f3];return _0xf936c4;};'use strict';function Telephone(_0x5c76e9){this['id']=_0x5c76e9['id']||0x0;this[_0xcf99('0x0')]=_0x5c76e9[_0xcf99('0x0')]||'';this[_0xcf99('0x1')]=_0x5c76e9[_0xcf99('0x1')]||'';this[_0xcf99('0x2')]=_0xcf99('0x3');this[_0xcf99('0x4')]=0x0;this[_0xcf99('0x5')]=_0xcf99('0x3');this[_0xcf99('0x6')]='';}module['exports']=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 01f049d..f5f4d78 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(_0x1d5ab4,_0x59b107){var _0x576e7a=function(_0x87de27){while(--_0x87de27){_0x1d5ab4['push'](_0x1d5ab4['shift']());}};_0x576e7a(++_0x59b107);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xa9e0[_0xf0bcac];return _0x4e4c65;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file +var _0xa9e0=['exports','name'];(function(_0x284bfe,_0x15dbda){var _0x5dbd74=function(_0x5b6bd2){while(--_0x5b6bd2){_0x284bfe['push'](_0x284bfe['shift']());}};_0x5dbd74(++_0x15dbda);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xa9e0[_0x3a6efd];return _0x487b9a;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index fdcfa30..6109190 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 _0xbaf0=['Actions','exports','name','channel','voice','status','AllConditions','AnyConditions'];(function(_0x365be9,_0x3c88b9){var _0x185c12=function(_0xbadbbf){while(--_0xbadbbf){_0x365be9['push'](_0x365be9['shift']());}};_0x185c12(++_0x3c88b9);}(_0xbaf0,0x12a));var _0x0baf=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xbaf0[_0x432682];return _0x463d05;};'use strict';function Trigger(_0x61caa9){this['id']=_0x61caa9['id']||0x0;this[_0x0baf('0x0')]=_0x61caa9[_0x0baf('0x0')]||'';this[_0x0baf('0x1')]=_0x61caa9[_0x0baf('0x1')]||_0x0baf('0x2');this[_0x0baf('0x3')]=_0x61caa9['status']||![];this[_0x0baf('0x4')]=_0x61caa9[_0x0baf('0x4')]||[];this[_0x0baf('0x5')]=_0x61caa9[_0x0baf('0x5')]||[];this[_0x0baf('0x6')]=_0x61caa9[_0x0baf('0x6')]||[];}module[_0x0baf('0x7')]=Trigger; \ No newline at end of file +var _0x2032=['exports','name','channel','voice','status','AllConditions','AnyConditions','Actions'];(function(_0x323ac1,_0x273c58){var _0xcce58f=function(_0x423f71){while(--_0x423f71){_0x323ac1['push'](_0x323ac1['shift']());}};_0xcce58f(++_0x273c58);}(_0x2032,0xd9));var _0x2203=function(_0x3ae131,_0x2bf171){_0x3ae131=_0x3ae131-0x0;var _0x462654=_0x2032[_0x3ae131];return _0x462654;};'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 f62bc58..f67d349 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 _0xf72f=['host','port','domain','domainport','registrationtime','address','defaultuser','active','state','unknown','registry','split'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xf72f,0x1e7));var _0xff72=function(_0x3dd619,_0x34404d){_0x3dd619=_0x3dd619-0x0;var _0x49bf56=_0xf72f[_0x3dd619];return _0x49bf56;};'use strict';function Trunk(_0x15281a){this['id']=_0x15281a['id']||0x0;this[_0xff72('0x0')]=_0x15281a[_0xff72('0x0')]||![];this['name']=_0x15281a['name']||'';this[_0xff72('0x1')]=_0xff72('0x2');this['stateTime']=0x0;this['status']=_0xff72('0x2');this[_0xff72('0x3')]=_0x15281a[_0xff72('0x3')]&&_0x15281a[_0xff72('0x3')]['indexOf'](':')?_0x15281a[_0xff72('0x3')][_0xff72('0x4')](':')[0x0]:'';this[_0xff72('0x5')]='';this[_0xff72('0x6')]='';this[_0xff72('0x7')]='';this[_0xff72('0x8')]='';this['refresh']='';this['stateRegistry']='unknown';this[_0xff72('0x9')]='';this[_0xff72('0xa')]='';this[_0xff72('0xb')]=_0x15281a[_0xff72('0xb')]||'';}module['exports']=Trunk; \ No newline at end of file +var _0x824c=['registrationtime','address','defaultuser','exports','active','name','state','unknown','status','registry','split','host','port','domainport','refresh','stateRegistry'];(function(_0x4f66,_0x4c4a2e){var _0x4e3d42=function(_0xcbd4b0){while(--_0xcbd4b0){_0x4f66['push'](_0x4f66['shift']());}};_0x4e3d42(++_0x4c4a2e);}(_0x824c,0xb4));var _0xc824=function(_0x2340ec,_0x46a0d1){_0x2340ec=_0x2340ec-0x0;var _0x59c89f=_0x824c[_0x2340ec];return _0x59c89f;};'use strict';function Trunk(_0x15d9d2){this['id']=_0x15d9d2['id']||0x0;this[_0xc824('0x0')]=_0x15d9d2[_0xc824('0x0')]||![];this[_0xc824('0x1')]=_0x15d9d2['name']||'';this[_0xc824('0x2')]=_0xc824('0x3');this['stateTime']=0x0;this[_0xc824('0x4')]=_0xc824('0x3');this[_0xc824('0x5')]=_0x15d9d2['registry']&&_0x15d9d2['registry']['indexOf'](':')?_0x15d9d2[_0xc824('0x5')][_0xc824('0x6')](':')[0x0]:'';this[_0xc824('0x7')]='';this[_0xc824('0x8')]='';this['domain']='';this[_0xc824('0x9')]='';this[_0xc824('0xa')]='';this[_0xc824('0xb')]=_0xc824('0x3');this[_0xc824('0xc')]='';this[_0xc824('0xd')]='';this[_0xc824('0xe')]=_0x15d9d2['defaultuser']||'';}module[_0xc824('0xf')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 7648446..0c727ce 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 _0x453e=['recordingFormat','none','mandatoryDisposition','exports','exten'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x453e,0x72));var _0xe453=function(_0x169ca0,_0x48d215){_0x169ca0=_0x169ca0-0x0;var _0x2ce4df=_0x453e[_0x169ca0];return _0x2ce4df;};'use strict';function voiceExtension(_0x57bb7b){this['id']=_0x57bb7b['id']||0x0;this['exten']=_0x57bb7b[_0xe453('0x0')]||'';this[_0xe453('0x1')]=_0x57bb7b[_0xe453('0x1')]||_0xe453('0x2');this['mandatoryDisposition']=_0x57bb7b[_0xe453('0x3')]||![];}module[_0xe453('0x4')]=voiceExtension; \ No newline at end of file +var _0xe177=['exten','recordingFormat','none','mandatoryDisposition','exports'];(function(_0x4e2c69,_0x4aab6d){var _0x1ef669=function(_0x51755a){while(--_0x51755a){_0x4e2c69['push'](_0x4e2c69['shift']());}};_0x1ef669(++_0x4aab6d);}(_0xe177,0x159));var _0x7e17=function(_0x148ca6,_0x2057df){_0x148ca6=_0x148ca6-0x0;var _0x248276=_0xe177[_0x148ca6];return _0x248276;};'use strict';function voiceExtension(_0x3de33b){this['id']=_0x3de33b['id']||0x0;this[_0x7e17('0x0')]=_0x3de33b[_0x7e17('0x0')]||'';this[_0x7e17('0x1')]=_0x3de33b['recordingFormat']||_0x7e17('0x2');this[_0x7e17('0x3')]=_0x3de33b[_0x7e17('0x3')]||![];}module[_0x7e17('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 ddfda10..75f36b3 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 _0x5aae=['type','inbound','waiting','answered','sumDuration','sumHoldTime','sumBillable','abandoned','available','inUse','invalid','notInUse','onHold','ringing','ringInUse','talking','acw','acwTimeout','autopause','sendMessageOneNotActive','message','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','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','pTalking','timeout','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayCallersExit','outboundAbandonedDay','startPredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgTalktime','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','queueSummaryCountersUpdated','exports','wav','wav49','gsm','random','ringall','roundrobin','rrordered','name','monitor_format'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0x5aae,0xe5));var _0xe5aa=function(_0x52f975,_0x305404){_0x52f975=_0x52f975-0x0;var _0x1b15a3=_0x5aae[_0x52f975];return _0x1b15a3;};'use strict';var monitorFormat={'wav':_0xe5aa('0x0'),'wav49':_0xe5aa('0x1'),'gsm':_0xe5aa('0x2')};var strategy={'fewestcalls':'fewestcalls','leastrecent':'leastrecent','linear':'linear','random':_0xe5aa('0x3'),'ringall':_0xe5aa('0x4'),'rr':_0xe5aa('0x5'),'rrmemory':'rrmemory','rrordered':_0xe5aa('0x6'),'wrandom':'wrandom'};function VoiceQueue(_0x11eb0b){this['id']=_0x11eb0b['id']||0x0;this[_0xe5aa('0x7')]=_0x11eb0b['name']||'';this[_0xe5aa('0x8')]=_0x11eb0b['monitor_format']||'';this[_0xe5aa('0x9')]=_0x11eb0b['type']||_0xe5aa('0xa');this[_0xe5aa('0xb')]=0x0;this['total']=0x0;this[_0xe5aa('0xc')]=0x0;this[_0xe5aa('0xd')]=0x0;this[_0xe5aa('0xe')]=0x0;this[_0xe5aa('0xf')]=0x0;this['unmanaged']=0x0;this[_0xe5aa('0x10')]=0x0;this[_0xe5aa('0x11')]=0x0;this['busy']=0x0;this[_0xe5aa('0x12')]=0x0;this[_0xe5aa('0x13')]=0x0;this['loggedIn']=0x0;this[_0xe5aa('0x14')]=0x0;this[_0xe5aa('0x15')]=0x0;this['paused']=0x0;this[_0xe5aa('0x16')]=0x0;this[_0xe5aa('0x17')]=0x0;this[_0xe5aa('0x18')]=0x0;this['unavailable']=0x0;this['unknown']=0x0;this['acw']=_0x11eb0b[_0xe5aa('0x19')]||![];this[_0xe5aa('0x1a')]=_0x11eb0b[_0xe5aa('0x1a')]||0xa;this[_0xe5aa('0x1b')]=_0x11eb0b[_0xe5aa('0x1b')]||'no';this[_0xe5aa('0x1c')]=!![];this[_0xe5aa('0x1d')]='';this[_0xe5aa('0x1e')]='';this[_0xe5aa('0x1f')]=0x0;this[_0xe5aa('0x20')]=0x0;this[_0xe5aa('0x21')]=_0x11eb0b[_0xe5aa('0x21')]||null;this[_0xe5aa('0x22')]=_0x11eb0b[_0xe5aa('0x22')]?_0x11eb0b[_0xe5aa('0x22')]:null;this[_0xe5aa('0x23')]=_0x11eb0b[_0xe5aa('0x23')];this[_0xe5aa('0x24')]=_0x11eb0b['dialMethod']||'progressive';this[_0xe5aa('0x25')]=_0x11eb0b[_0xe5aa('0x25')]||0x0;this[_0xe5aa('0x26')]=_0x11eb0b[_0xe5aa('0x26')]||0x0;this[_0xe5aa('0x27')]=_0x11eb0b[_0xe5aa('0x27')]||0x1;this[_0xe5aa('0x28')]=_0x11eb0b[_0xe5aa('0x28')]||_0xe5aa('0x29');this[_0xe5aa('0x2a')]=_0x11eb0b[_0xe5aa('0x2a')]||0.03;this['dialPredictiveInterval']=_0x11eb0b[_0xe5aa('0x2b')]||0x258;this[_0xe5aa('0x2c')]=_0x11eb0b[_0xe5aa('0x2c')]||_0xe5aa('0x2d');this['dialOriginateCallerIdNumber']=_0x11eb0b[_0xe5aa('0x2e')]||'anonymous';this[_0xe5aa('0x2f')]=_0x11eb0b[_0xe5aa('0x2f')]||0x1e;this[_0xe5aa('0x30')]=_0x11eb0b[_0xe5aa('0x30')]||_0xe5aa('0x31');this[_0xe5aa('0x32')]=_0x11eb0b[_0xe5aa('0x32')]||0x3;this[_0xe5aa('0x33')]=_0x11eb0b[_0xe5aa('0x33')]||undefined;this[_0xe5aa('0x34')]=_0x11eb0b[_0xe5aa('0x34')]||0x3;this['dialCongestionRetryFrequency']=_0x11eb0b[_0xe5aa('0x35')]||0x96;this[_0xe5aa('0x36')]=_0x11eb0b[_0xe5aa('0x36')]||0x3;this[_0xe5aa('0x37')]=_0x11eb0b[_0xe5aa('0x37')]||0x96;this[_0xe5aa('0x38')]=_0x11eb0b[_0xe5aa('0x38')]||0x3;this[_0xe5aa('0x39')]=_0x11eb0b['dialNoAnswerRetryFrequency']||0x96;this[_0xe5aa('0x3a')]=_0x11eb0b['dialNoSuchNumberMaxRetry']||0x3;this[_0xe5aa('0x3b')]=_0x11eb0b[_0xe5aa('0x3b')]||0x96;this[_0xe5aa('0x3c')]=_0x11eb0b[_0xe5aa('0x3c')]||0x3;this[_0xe5aa('0x3d')]=_0x11eb0b['dialDropRetryFrequency']||0x96;this['dialAbandonedMaxRetry']=_0x11eb0b[_0xe5aa('0x3e')]||0x3;this[_0xe5aa('0x3f')]=_0x11eb0b[_0xe5aa('0x3f')]||0x96;this[_0xe5aa('0x40')]=_0x11eb0b[_0xe5aa('0x40')]||0x3;this[_0xe5aa('0x41')]=_0x11eb0b[_0xe5aa('0x41')]||0x96;this['dialAgentRejectMaxRetry']=_0x11eb0b['dialAgentRejectMaxRetry']||0x3;this['dialAgentRejectRetryFrequency']=_0x11eb0b[_0xe5aa('0x42')]||0x96;this[_0xe5aa('0x43')]=_0x11eb0b[_0xe5aa('0x43')]||0x3;this['dialGlobalMaxRetry']=_0x11eb0b['dialGlobalMaxRetry']||0x4;this[_0xe5aa('0x44')]=_0x11eb0b[_0xe5aa('0x44')]?_0x11eb0b[_0xe5aa('0x44')]:undefined;this[_0xe5aa('0x45')]=_0x11eb0b[_0xe5aa('0x45')]?_0x11eb0b[_0xe5aa('0x45')]:undefined;this[_0xe5aa('0x46')]=_0x11eb0b[_0xe5aa('0x46')]||undefined;this['Interval']=_0x11eb0b[_0xe5aa('0x47')]?_0x11eb0b[_0xe5aa('0x47')]:undefined;this[_0xe5aa('0x48')]=_0x11eb0b[_0xe5aa('0x48')]||_0xe5aa('0x49');this[_0xe5aa('0x4a')]=_0x11eb0b[_0xe5aa('0x4a')]||undefined;this['dialCutDigit']=_0x11eb0b['dialCutDigit']||undefined;this['strategy']=strategy[_0x11eb0b[_0xe5aa('0x4b')]];this[_0xe5aa('0x4c')]=!![];this[_0xe5aa('0x4d')]=_0x11eb0b[_0xe5aa('0x4d')]||![];this['dialAMDInitialSilence']=_0x11eb0b[_0xe5aa('0x4e')];this[_0xe5aa('0x4f')]=_0x11eb0b[_0xe5aa('0x4f')];this[_0xe5aa('0x50')]=_0x11eb0b[_0xe5aa('0x50')];this[_0xe5aa('0x51')]=_0x11eb0b['dialAMDTotalAnalysisTime'];this[_0xe5aa('0x52')]=_0x11eb0b[_0xe5aa('0x52')];this[_0xe5aa('0x53')]=_0x11eb0b[_0xe5aa('0x53')];this[_0xe5aa('0x54')]=_0x11eb0b[_0xe5aa('0x54')];this[_0xe5aa('0x55')]=_0x11eb0b[_0xe5aa('0x55')];this[_0xe5aa('0x56')]=_0x11eb0b['dialAMDMaximumWordLength'];this['outboundRejectCallsDay']=0x0;this[_0xe5aa('0x57')]=0x0;this[_0xe5aa('0x58')]=_0x11eb0b[_0xe5aa('0x58')];this['outboundAnswerCallsDay']=0x0;this['outboundAnswerAgiCallsDay']=0x0;this[_0xe5aa('0x59')]=0x0;this[_0xe5aa('0x5a')]=0x0;this['outboundCongestionCallsDay']=0x0;this[_0xe5aa('0x5b')]=0x0;this[_0xe5aa('0x5c')]=0x0;this[_0xe5aa('0x5d')]=0x0;this['outboundOriginateFailureCallsDay']=0x0;this[_0xe5aa('0x5e')]=0x0;this['outboundDropCallsDayTimeout']=0x0;this['outboundDropCallsDayACS']=0x0;this['outboundReCallsDay']=0x0;this[_0xe5aa('0x5f')]=0x0;this['startProgressive']=undefined;this[_0xe5aa('0x60')]=undefined;this['handlePredictive']=undefined;this[_0xe5aa('0x61')]=1.05;this['predictiveIntervalTotalCalls']=0x0;this[_0xe5aa('0x62')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this[_0xe5aa('0x63')]=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this[_0xe5aa('0x64')]=0x0;this['predictiveIntervalPauses']=0x0;this[_0xe5aa('0x65')]=0x0;this[_0xe5aa('0x66')]=_0x11eb0b[_0xe5aa('0x67')]||0x14;this[_0xe5aa('0x68')]=_0x11eb0b['dialPredictiveIntervalMaxThreshold']||0xa;this[_0xe5aa('0x69')]=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this[_0xe5aa('0x6a')]=0x1;this[_0xe5aa('0x6b')]=0x0;this[_0xe5aa('0x6c')]=0x0;this[_0xe5aa('0x6d')]=0x0;this['erlangBusyFactor']=0x0;this['dialRecallMeTimeout']=_0x11eb0b['dialRecallMeTimeout']||0x1e;this['dialRecallInQueue']=_0x11eb0b[_0xe5aa('0x6e')]||![];this[_0xe5aa('0x6f')]=!!_0x11eb0b['dialPreviewAutoRecallMe']||![];this[_0xe5aa('0x70')]=!!_0x11eb0b[_0xe5aa('0x70')]||![];this['dialQueueProject2']=_0x11eb0b[_0xe5aa('0x71')]||undefined;this[_0xe5aa('0x72')]=_0x11eb0b[_0xe5aa('0x72')]||![];this['dialAgiAfterHangupAgent']=_0x11eb0b[_0xe5aa('0x73')]||![];this['monitor_format']=monitorFormat[_0x11eb0b[_0xe5aa('0x8')]]?monitorFormat[_0x11eb0b[_0xe5aa('0x8')]]:undefined;this[_0xe5aa('0x74')]=_0x11eb0b['mandatoryDisposition']||![];this['mandatoryDispositionPause']=_0x11eb0b['mandatoryDispositionPause']?_0x11eb0b['mandatoryDispositionPause']:undefined;this[_0xe5aa('0x75')]=![];}module[_0xe5aa('0x76')]=VoiceQueue; \ No newline at end of file +var _0x90ec=['acw','acwTimeout','autopause','sendMessageOneNotActive','statusMessage','temp','dialTimezone','dialGlobalInterval','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','outboundRejectCallsDay','timeout','outboundAnswerAgiCallsDay','outboundCongestionCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalPauses','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','wav','wav49','fewestcalls','leastrecent','linear','random','ringall','rrmemory','rrordered','wrandom','name','monitor_format','type','inbound','waiting','total','answered','sumDuration','sumHoldTime','sumBillable','unmanaged','available','notInUse','onHold','ringing','ringInUse','unavailable','unknown'];(function(_0x396466,_0xe9857b){var _0x5e9ab4=function(_0x362f66){while(--_0x362f66){_0x396466['push'](_0x396466['shift']());}};_0x5e9ab4(++_0xe9857b);}(_0x90ec,0x1d4));var _0xc90e=function(_0x36061c,_0x5268f9){_0x36061c=_0x36061c-0x0;var _0x37531b=_0x90ec[_0x36061c];return _0x37531b;};'use strict';var monitorFormat={'wav':_0xc90e('0x0'),'wav49':_0xc90e('0x1'),'gsm':'gsm'};var strategy={'fewestcalls':_0xc90e('0x2'),'leastrecent':_0xc90e('0x3'),'linear':_0xc90e('0x4'),'random':_0xc90e('0x5'),'ringall':_0xc90e('0x6'),'rr':'roundrobin','rrmemory':_0xc90e('0x7'),'rrordered':_0xc90e('0x8'),'wrandom':_0xc90e('0x9')};function VoiceQueue(_0x54a0a8){this['id']=_0x54a0a8['id']||0x0;this[_0xc90e('0xa')]=_0x54a0a8['name']||'';this[_0xc90e('0xb')]=_0x54a0a8[_0xc90e('0xb')]||'';this['type']=_0x54a0a8[_0xc90e('0xc')]||_0xc90e('0xd');this[_0xc90e('0xe')]=0x0;this[_0xc90e('0xf')]=0x0;this[_0xc90e('0x10')]=0x0;this[_0xc90e('0x11')]=0x0;this[_0xc90e('0x12')]=0x0;this[_0xc90e('0x13')]=0x0;this[_0xc90e('0x14')]=0x0;this['abandoned']=0x0;this[_0xc90e('0x15')]=0x0;this['busy']=0x0;this['inUse']=0x0;this['invalid']=0x0;this['loggedIn']=0x0;this[_0xc90e('0x16')]=0x0;this[_0xc90e('0x17')]=0x0;this['paused']=0x0;this[_0xc90e('0x18')]=0x0;this[_0xc90e('0x19')]=0x0;this['talking']=0x0;this[_0xc90e('0x1a')]=0x0;this[_0xc90e('0x1b')]=0x0;this[_0xc90e('0x1c')]=_0x54a0a8[_0xc90e('0x1c')]||![];this[_0xc90e('0x1d')]=_0x54a0a8[_0xc90e('0x1d')]||0xa;this['autopause']=_0x54a0a8[_0xc90e('0x1e')]||'no';this[_0xc90e('0x1f')]=!![];this['message']='';this[_0xc90e('0x20')]='';this['originated']=0x0;this[_0xc90e('0x21')]=0x0;this[_0xc90e('0x22')]=_0x54a0a8['dialTimezone']||null;this[_0xc90e('0x23')]=_0x54a0a8[_0xc90e('0x23')]?_0x54a0a8[_0xc90e('0x23')]:null;this['dialActive']=_0x54a0a8['dialActive'];this['dialMethod']=_0x54a0a8[_0xc90e('0x24')]||_0xc90e('0x25');this[_0xc90e('0x26')]=_0x54a0a8[_0xc90e('0x26')]||0x0;this[_0xc90e('0x27')]=_0x54a0a8['dialLimitQueue']||0x0;this[_0xc90e('0x28')]=_0x54a0a8['dialPowerLevel']||0x1;this[_0xc90e('0x29')]=_0x54a0a8[_0xc90e('0x29')]||'dropRate';this[_0xc90e('0x2a')]=_0x54a0a8[_0xc90e('0x2a')]||0.03;this[_0xc90e('0x2b')]=_0x54a0a8[_0xc90e('0x2b')]||0x258;this[_0xc90e('0x2c')]=_0x54a0a8[_0xc90e('0x2c')]||_0xc90e('0x2d');this[_0xc90e('0x2e')]=_0x54a0a8[_0xc90e('0x2e')]||'anonymous';this[_0xc90e('0x2f')]=_0x54a0a8[_0xc90e('0x2f')]||0x1e;this[_0xc90e('0x30')]=_0x54a0a8[_0xc90e('0x30')]||_0xc90e('0x31');this['dialQueueTimeout']=_0x54a0a8[_0xc90e('0x32')]||0x3;this[_0xc90e('0x33')]=_0x54a0a8[_0xc90e('0x33')]||undefined;this['dialCongestionMaxRetry']=_0x54a0a8[_0xc90e('0x34')]||0x3;this[_0xc90e('0x35')]=_0x54a0a8[_0xc90e('0x35')]||0x96;this[_0xc90e('0x36')]=_0x54a0a8[_0xc90e('0x36')]||0x3;this[_0xc90e('0x37')]=_0x54a0a8['dialBusyRetryFrequency']||0x96;this['dialNoAnswerMaxRetry']=_0x54a0a8[_0xc90e('0x38')]||0x3;this['dialNoAnswerRetryFrequency']=_0x54a0a8[_0xc90e('0x39')]||0x96;this[_0xc90e('0x3a')]=_0x54a0a8[_0xc90e('0x3a')]||0x3;this[_0xc90e('0x3b')]=_0x54a0a8[_0xc90e('0x3b')]||0x96;this[_0xc90e('0x3c')]=_0x54a0a8[_0xc90e('0x3c')]||0x3;this['dialDropRetryFrequency']=_0x54a0a8[_0xc90e('0x3d')]||0x96;this[_0xc90e('0x3e')]=_0x54a0a8['dialAbandonedMaxRetry']||0x3;this[_0xc90e('0x3f')]=_0x54a0a8['dialAbandonedRetryFrequency']||0x96;this[_0xc90e('0x40')]=_0x54a0a8[_0xc90e('0x40')]||0x3;this[_0xc90e('0x41')]=_0x54a0a8[_0xc90e('0x41')]||0x96;this[_0xc90e('0x42')]=_0x54a0a8[_0xc90e('0x42')]||0x3;this[_0xc90e('0x43')]=_0x54a0a8[_0xc90e('0x43')]||0x96;this[_0xc90e('0x44')]=_0x54a0a8['callAdditionalPhoneAfterMin']||0x3;this['dialGlobalMaxRetry']=_0x54a0a8[_0xc90e('0x45')]||0x4;this[_0xc90e('0x46')]=_0x54a0a8[_0xc90e('0x46')]?_0x54a0a8[_0xc90e('0x46')]:undefined;this[_0xc90e('0x47')]=_0x54a0a8[_0xc90e('0x47')]?_0x54a0a8[_0xc90e('0x47')]:undefined;this[_0xc90e('0x48')]=_0x54a0a8[_0xc90e('0x48')]||undefined;this[_0xc90e('0x49')]=_0x54a0a8['Interval']?_0x54a0a8[_0xc90e('0x49')]:undefined;this[_0xc90e('0x4a')]=_0x54a0a8[_0xc90e('0x4a')]||_0xc90e('0x4b');this['dialRandomLastDigitCallerIdNumber']=_0x54a0a8['dialRandomLastDigitCallerIdNumber']||undefined;this['dialCutDigit']=_0x54a0a8[_0xc90e('0x4c')]||undefined;this[_0xc90e('0x4d')]=strategy[_0x54a0a8[_0xc90e('0x4d')]];this[_0xc90e('0x4e')]=!![];this[_0xc90e('0x4f')]=_0x54a0a8['dialAMDActive']||![];this[_0xc90e('0x50')]=_0x54a0a8[_0xc90e('0x50')];this[_0xc90e('0x51')]=_0x54a0a8[_0xc90e('0x51')];this[_0xc90e('0x52')]=_0x54a0a8[_0xc90e('0x52')];this[_0xc90e('0x53')]=_0x54a0a8[_0xc90e('0x53')];this[_0xc90e('0x54')]=_0x54a0a8[_0xc90e('0x54')];this[_0xc90e('0x55')]=_0x54a0a8[_0xc90e('0x55')];this[_0xc90e('0x56')]=_0x54a0a8['dialAMDMaximumNumberOfWords'];this[_0xc90e('0x57')]=_0x54a0a8[_0xc90e('0x57')];this['dialAMDMaximumWordLength']=_0x54a0a8['dialAMDMaximumWordLength'];this[_0xc90e('0x58')]=0x0;this['pTalking']=0x0;this[_0xc90e('0x59')]=_0x54a0a8[_0xc90e('0x59')];this['outboundAnswerCallsDay']=0x0;this[_0xc90e('0x5a')]=0x0;this['outboundNoAnswerCallsDay']=0x0;this['outboundBusyCallsDay']=0x0;this[_0xc90e('0x5b')]=0x0;this['outboundNoSuchCallsDay']=0x0;this['outboundUnknownCallsDay']=0x0;this[_0xc90e('0x5c')]=0x0;this[_0xc90e('0x5d')]=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0xc90e('0x5e')]=0x0;this[_0xc90e('0x5f')]=0x0;this[_0xc90e('0x60')]=0x0;this[_0xc90e('0x61')]=0x0;this[_0xc90e('0x62')]=undefined;this[_0xc90e('0x63')]=undefined;this[_0xc90e('0x64')]=undefined;this[_0xc90e('0x65')]=1.05;this['predictiveIntervalTotalCalls']=0x0;this[_0xc90e('0x66')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0xc90e('0x67')]=0x0;this['predictiveIntervalAvgTalktime']=0x0;this[_0xc90e('0x68')]=0x0;this['predictiveIntervalAvailable']=0x0;this[_0xc90e('0x69')]=_0x54a0a8[_0xc90e('0x6a')]||0x14;this[_0xc90e('0x6b')]=_0x54a0a8[_0xc90e('0x6a')]||0xa;this[_0xc90e('0x6c')]=0x0;this[_0xc90e('0x6d')]=0x0;this[_0xc90e('0x6e')]=0x1;this[_0xc90e('0x6f')]=0x0;this[_0xc90e('0x70')]=0x0;this['erlangAbandonmentRate']=0x0;this[_0xc90e('0x71')]=0x0;this[_0xc90e('0x72')]=_0x54a0a8[_0xc90e('0x72')]||0x1e;this[_0xc90e('0x73')]=_0x54a0a8['dialRecallInQueue']||![];this[_0xc90e('0x74')]=!!_0x54a0a8[_0xc90e('0x74')]||![];this[_0xc90e('0x75')]=!!_0x54a0a8['dialPreviewRecallmeReminder']||![];this[_0xc90e('0x76')]=_0x54a0a8['dialQueueProject2']||undefined;this[_0xc90e('0x77')]=_0x54a0a8['dialAgiAfterHangupClient']||![];this[_0xc90e('0x78')]=_0x54a0a8['dialAgiAfterHangupAgent']||![];this[_0xc90e('0xb')]=monitorFormat[_0x54a0a8[_0xc90e('0xb')]]?monitorFormat[_0x54a0a8[_0xc90e('0xb')]]:undefined;this[_0xc90e('0x79')]=_0x54a0a8[_0xc90e('0x79')]||![];this[_0xc90e('0x7a')]=_0x54a0a8[_0xc90e('0x7a')]?_0x54a0a8[_0xc90e('0x7a')]:undefined;this['queueSummaryCountersUpdated']=![];}module[_0xc90e('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 c687d6e..602017e 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 _0x15c6=['statusMessage','Trunk','active','loggedin','callers','online','incall','includes','status','booked','keys','length','queue','dialer','exten','prototype','compareToInboundQueue','some','compareToOutboundQueue','updateReportFromOutboundQueue','exports','available','loggedIn','loggedInDb','paused','ringing','talking','waiting','originated','outboundAbandonedCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundReCallsDay','outboundUnknownCallsDay','pTalking','total','name','strategy','abandoned','answered','busy','inUse','invalid','onHold','notInUse','sumBillable','sumDuration','sumHoldTime','type','unavailable','unknown','unmanaged','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startProgressive','message'];(function(_0x324951,_0x2998c1){var _0x39855d=function(_0x5a896a){while(--_0x5a896a){_0x324951['push'](_0x324951['shift']());}};_0x39855d(++_0x2998c1);}(_0x15c6,0x1cd));var _0x615c=function(_0x1fc4e2,_0x493c3b){_0x1fc4e2=_0x1fc4e2-0x0;var _0x2ba184=_0x15c6[_0x1fc4e2];return _0x2ba184;};'use strict';var INBOUND_COUNTERS=[_0x615c('0x0'),_0x615c('0x1'),_0x615c('0x2'),_0x615c('0x3'),_0x615c('0x4'),_0x615c('0x5'),_0x615c('0x6')];var OUTBOUND_COUNTERS=[_0x615c('0x0'),'answered','inUse','loggedIn',_0x615c('0x2'),_0x615c('0x7'),_0x615c('0x8'),'outboundAnswerCallsDay',_0x615c('0x9'),_0x615c('0xa'),_0x615c('0xb'),_0x615c('0xc'),'outboundNoSuchCallsDay',_0x615c('0xd'),'outboundRejectCallsDay',_0x615c('0xe'),_0x615c('0x3'),_0x615c('0xf'),_0x615c('0x5'),'sumBillable','sumDuration',_0x615c('0x10'),_0x615c('0x6')];function VoiceQueueSummary(_0x11a21e){this['id']=_0x11a21e['id'];this[_0x615c('0x11')]=_0x11a21e['name'];this['strategy']=_0x11a21e[_0x615c('0x12')];this[_0x615c('0x13')]=_0x11a21e['abandoned']||0x0;this[_0x615c('0x14')]=_0x11a21e['answered']||0x0;this['available']=_0x11a21e[_0x615c('0x0')]||0x0;this[_0x615c('0x15')]=_0x11a21e[_0x615c('0x15')]||0x0;this[_0x615c('0x16')]=_0x11a21e[_0x615c('0x16')]||0x0;this[_0x615c('0x17')]=_0x11a21e['invalid']||0x0;this[_0x615c('0x1')]=_0x11a21e[_0x615c('0x1')]||0x0;this[_0x615c('0x2')]=_0x11a21e['loggedInDb']||0x0;this[_0x615c('0x18')]=_0x11a21e[_0x615c('0x18')]||0x0;this[_0x615c('0x19')]=_0x11a21e[_0x615c('0x19')]||0x0;this[_0x615c('0x3')]=_0x11a21e[_0x615c('0x3')]||0x0;this[_0x615c('0x4')]=_0x11a21e[_0x615c('0x4')]||0x0;this['ringInUse']=_0x11a21e['ringInUse'];this['sumBillable']=_0x11a21e[_0x615c('0x1a')];this[_0x615c('0x1b')]=_0x11a21e[_0x615c('0x1b')];this[_0x615c('0x1c')]=_0x11a21e['sumHoldTime']||0x0;this['talking']=_0x11a21e[_0x615c('0x5')]||0x0;this['total']=_0x11a21e[_0x615c('0x10')]||0x0;this['type']=_0x11a21e[_0x615c('0x1d')];this['unavailable']=_0x11a21e[_0x615c('0x1e')]||0x0;this[_0x615c('0x1f')]=_0x11a21e['unknown']||0x0;this['unmanaged']=_0x11a21e[_0x615c('0x20')]||0x0;this[_0x615c('0x6')]=_0x11a21e[_0x615c('0x6')]||0x0;if(_0x11a21e[_0x615c('0x1d')]===_0x615c('0x21')){this['pTalking']=_0x11a21e[_0x615c('0xf')]||0x0;this[_0x615c('0x22')]=_0x11a21e['dialActive'];this['dialMethod']=_0x11a21e[_0x615c('0x23')];this[_0x615c('0x24')]=_0x11a21e[_0x615c('0x24')];this['dialOriginateCallerIdNumber']=_0x11a21e[_0x615c('0x25')];this[_0x615c('0x26')]=_0x11a21e[_0x615c('0x26')];this[_0x615c('0x27')]=_0x11a21e['dialPrefix'];this[_0x615c('0x28')]=_0x11a21e[_0x615c('0x28')];this[_0x615c('0x29')]=_0x11a21e[_0x615c('0x29')];this[_0x615c('0x2a')]=_0x11a21e[_0x615c('0x2a')];this[_0x615c('0x9')]=_0x11a21e[_0x615c('0x9')];this[_0x615c('0xa')]=_0x11a21e[_0x615c('0xa')];this[_0x615c('0xb')]=_0x11a21e[_0x615c('0xb')];this[_0x615c('0x2b')]=_0x11a21e[_0x615c('0x2b')];this['outboundDropCallsDayCallersExit']=_0x11a21e[_0x615c('0x2c')];this[_0x615c('0x2d')]=_0x11a21e[_0x615c('0x2d')];this[_0x615c('0xc')]=_0x11a21e[_0x615c('0xc')];this[_0x615c('0x2e')]=_0x11a21e['outboundNoSuchCallsDay'];this[_0x615c('0x2f')]=_0x11a21e[_0x615c('0x2f')];this[_0x615c('0xd')]=_0x11a21e[_0x615c('0xd')];this[_0x615c('0x30')]=_0x11a21e['outboundRejectCallsDay'];this[_0x615c('0xe')]=_0x11a21e['outboundUnknownCallsDay'];this[_0x615c('0x31')]=_0x11a21e[_0x615c('0x31')];this[_0x615c('0x32')]=_0x11a21e[_0x615c('0x32')];this[_0x615c('0x33')]=_0x11a21e[_0x615c('0x33')];this['predictiveIntervalDroppedCallsCallersExit']=_0x11a21e[_0x615c('0x34')];this[_0x615c('0x35')]=_0x11a21e[_0x615c('0x35')];this[_0x615c('0x36')]=_0x11a21e[_0x615c('0x36')];this[_0x615c('0x37')]=_0x11a21e[_0x615c('0x37')];this['predictiveIntervalHitRate']=_0x11a21e[_0x615c('0x38')];this[_0x615c('0x39')]=_0x11a21e[_0x615c('0x39')];this[_0x615c('0x3a')]=_0x11a21e['predictiveIntervalPauses'];this[_0x615c('0x3b')]=_0x11a21e[_0x615c('0x3b')];this[_0x615c('0x3c')]=_0x11a21e[_0x615c('0x3c')];this['originated']=_0x11a21e['originated'];this[_0x615c('0x3d')]=_0x11a21e[_0x615c('0x3d')];this[_0x615c('0x3e')]=_0x11a21e['erlangCallToSecond'];this[_0x615c('0x3f')]=_0x11a21e[_0x615c('0x3f')];this[_0x615c('0x40')]=_0x11a21e[_0x615c('0x40')];this['startPredictive']=_0x11a21e['startPredictive'];this[_0x615c('0x41')]=_0x11a21e['startProgressive'];this[_0x615c('0x42')]=_0x11a21e[_0x615c('0x42')];this[_0x615c('0x43')]=_0x11a21e['statusMessage'];}if(_0x11a21e[_0x615c('0x44')]){this[_0x615c('0x44')]={'id':_0x11a21e[_0x615c('0x44')]['id'],'name':_0x11a21e[_0x615c('0x44')][_0x615c('0x11')],'active':_0x11a21e['Trunk'][_0x615c('0x45')],'callerid':_0x11a21e[_0x615c('0x44')]['callerid']};}}VoiceQueueSummary['prototype']['createReport']=function(_0x1b8ce0,_0x2c87cd,_0x4eb491,_0x5dac11){this[_0x615c('0x2')]=0x0;this[_0x615c('0x5')]=0x0;this[_0x615c('0x3')]=0x0;this[_0x615c('0x1f')]=0x0;this[_0x615c('0x19')]=0x0;this[_0x615c('0x16')]=0x0;this[_0x615c('0x15')]=0x0;this[_0x615c('0x17')]=0x0;this[_0x615c('0x1e')]=0x0;this[_0x615c('0x4')]=0x0;this['ringInUse']=0x0;this[_0x615c('0x18')]=0x0;if(_0x4eb491){if(_0x4eb491[_0x615c('0x0')]){this[_0x615c('0x0')]=Number(_0x4eb491[_0x615c('0x0')]);}if(_0x4eb491['loggedin']){this[_0x615c('0x1')]=Number(_0x4eb491[_0x615c('0x46')]);}if(_0x4eb491[_0x615c('0x47')]){this[_0x615c('0x6')]=Number(_0x4eb491[_0x615c('0x47')]);}}for(var _0x45cc22=0x0;_0x45cc22<_0x1b8ce0['length'];_0x45cc22++){var _0x13a524=_0x2c87cd['SIP/'+_0x1b8ce0[_0x45cc22]['name']];if(_0x13a524&&_0x13a524[_0x615c('0x48')]){this['loggedInDb']+=0x1;}if(_0x1b8ce0[_0x45cc22][_0x615c('0x49')]==='1'){this[_0x615c('0x5')]+=0x1;}if(_0x1b8ce0[_0x45cc22][_0x615c('0x3')]==='1'&&!['2','7','8'][_0x615c('0x4a')](_0x1b8ce0[_0x45cc22][_0x615c('0x4b')])){this[_0x615c('0x3')]+=0x1;}switch(_0x1b8ce0[_0x45cc22][_0x615c('0x4b')]){case'0':this['unknown']+=0x1;break;case'1':this[_0x615c('0x19')]+=0x1;break;case'2':this[_0x615c('0x16')]+=0x1;break;case'3':this['busy']+=0x1;break;case'4':this[_0x615c('0x17')]+=0x1;break;case'5':this[_0x615c('0x1e')]+=0x1;break;case'6':this[_0x615c('0x4')]+=0x1;break;case'7':this['ringInUse']+=0x1;break;case'8':this[_0x615c('0x18')]+=0x1;break;}}if(this[_0x615c('0x23')]===_0x615c('0x4c')){var _0x562e4c=Object[_0x615c('0x4d')](_0x5dac11);for(var _0x546124=0x0;_0x546124<_0x562e4c[_0x615c('0x4e')];_0x546124++){var _0x41ea85=_0x562e4c[_0x546124];var _0x2d6a9d=_0x5dac11[_0x41ea85];if(_0x2d6a9d[_0x615c('0x4f')]===this[_0x615c('0x11')]&&_0x2d6a9d['type']===_0x615c('0x50')&&_0x2d6a9d[_0x615c('0x51')]==='xcally-motion-preview'){this[_0x615c('0x5')]+=0x1;}}if(this['talking']>this[_0x615c('0x16')]){this[_0x615c('0x5')]=this[_0x615c('0x16')];}this[_0x615c('0xf')]=0x0;}return this;};VoiceQueueSummary[_0x615c('0x52')][_0x615c('0x53')]=function(_0x71a8d7){var _0x36e911=![];if(_0x71a8d7){_0x36e911=INBOUND_COUNTERS[_0x615c('0x54')](function(_0x53a275){return this[_0x53a275]!==_0x71a8d7[_0x53a275];},this);}return _0x36e911;};VoiceQueueSummary[_0x615c('0x52')][_0x615c('0x55')]=function(_0x5bac0f){var _0x1331dd=![];var _0x116c4b=![];var _0x288f93=![];if(_0x5bac0f){_0x1331dd=this[_0x615c('0x23')]!==_0x5bac0f[_0x615c('0x23')]||this['dialActive']!==_0x5bac0f['dialActive']||this[_0x615c('0x42')]!==_0x5bac0f[_0x615c('0x42')]||this[_0x615c('0x43')]!==_0x5bac0f[_0x615c('0x43')];_0x116c4b=OUTBOUND_COUNTERS[_0x615c('0x54')](function(_0x4015bc){return this[_0x4015bc]!==_0x5bac0f[_0x4015bc];},this);if(this[_0x615c('0x44')]&&_0x5bac0f[_0x615c('0x44')]){_0x288f93=this[_0x615c('0x44')]['name']!==_0x5bac0f['Trunk']['name']||this['Trunk'][_0x615c('0x45')]!==_0x5bac0f[_0x615c('0x44')][_0x615c('0x45')];}}return _0x1331dd||_0x116c4b||_0x288f93;};VoiceQueueSummary[_0x615c('0x52')][_0x615c('0x56')]=function(_0x404074){this[_0x615c('0x14')]=_0x404074[_0x615c('0x14')];this[_0x615c('0x42')]=_0x404074[_0x615c('0x42')];this[_0x615c('0x43')]=_0x404074[_0x615c('0x43')];this['originated']=_0x404074[_0x615c('0x7')];this['outboundAbandonedCallsDay']=_0x404074['outboundAbandonedCallsDay'];this['outboundAnswerCallsDay']=_0x404074[_0x615c('0x2a')];this[_0x615c('0x9')]=_0x404074['outboundBlacklistCallsDay'];this[_0x615c('0xa')]=_0x404074[_0x615c('0xa')];this[_0x615c('0xb')]=_0x404074['outboundCongestionCallsDay'];this[_0x615c('0xc')]=_0x404074[_0x615c('0xc')];this[_0x615c('0x2e')]=_0x404074[_0x615c('0x2e')];this[_0x615c('0xd')]=_0x404074[_0x615c('0xd')];this[_0x615c('0x30')]=_0x404074[_0x615c('0x30')];this[_0x615c('0xe')]=_0x404074[_0x615c('0xe')];this[_0x615c('0x1a')]=_0x404074[_0x615c('0x1a')];this[_0x615c('0x1b')]=_0x404074[_0x615c('0x1b')];this['total']=_0x404074['total'];if(this['dialMethod']==='preview'){this['pTalking']=_0x404074['pTalking'];}};module[_0x615c('0x57')]=VoiceQueueSummary; \ No newline at end of file +var _0x2cd3=['invalid','onHold','notInUse','ringInUse','sumHoldTime','total','type','unavailable','unknown','unmanaged','dialMethod','dialOriginateCallerIdName','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','name','active','callerid','prototype','loggedin','callers','SIP/','online','incall','includes','status','booked','keys','length','queue','exten','compareToInboundQueue','some','compareToOutboundQueue','dialActive','updateReportFromOutboundQueue','preview','exports','available','loggedInDb','paused','ringing','talking','waiting','loggedIn','originated','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','pTalking','sumBillable','sumDuration','strategy','abandoned','answered','busy','inUse'];(function(_0x2af334,_0x29ef88){var _0x32e27a=function(_0x35f003){while(--_0x35f003){_0x2af334['push'](_0x2af334['shift']());}};_0x32e27a(++_0x29ef88);}(_0x2cd3,0xf1));var _0x32cd=function(_0x34021d,_0x753aa6){_0x34021d=_0x34021d-0x0;var _0x16597b=_0x2cd3[_0x34021d];return _0x16597b;};'use strict';var INBOUND_COUNTERS=[_0x32cd('0x0'),'loggedIn',_0x32cd('0x1'),_0x32cd('0x2'),_0x32cd('0x3'),_0x32cd('0x4'),_0x32cd('0x5')];var OUTBOUND_COUNTERS=[_0x32cd('0x0'),'answered','inUse',_0x32cd('0x6'),_0x32cd('0x1'),_0x32cd('0x7'),_0x32cd('0x8'),_0x32cd('0x9'),_0x32cd('0xa'),_0x32cd('0xb'),_0x32cd('0xc'),_0x32cd('0xd'),_0x32cd('0xe'),_0x32cd('0xf'),_0x32cd('0x10'),_0x32cd('0x11'),_0x32cd('0x2'),_0x32cd('0x12'),_0x32cd('0x4'),_0x32cd('0x13'),_0x32cd('0x14'),'total','waiting'];function VoiceQueueSummary(_0x39525c){this['id']=_0x39525c['id'];this['name']=_0x39525c['name'];this[_0x32cd('0x15')]=_0x39525c[_0x32cd('0x15')];this[_0x32cd('0x16')]=_0x39525c[_0x32cd('0x16')]||0x0;this[_0x32cd('0x17')]=_0x39525c[_0x32cd('0x17')]||0x0;this[_0x32cd('0x0')]=_0x39525c['available']||0x0;this['busy']=_0x39525c[_0x32cd('0x18')]||0x0;this[_0x32cd('0x19')]=_0x39525c[_0x32cd('0x19')]||0x0;this[_0x32cd('0x1a')]=_0x39525c['invalid']||0x0;this[_0x32cd('0x6')]=_0x39525c['loggedIn']||0x0;this['loggedInDb']=_0x39525c[_0x32cd('0x1')]||0x0;this[_0x32cd('0x1b')]=_0x39525c[_0x32cd('0x1b')]||0x0;this[_0x32cd('0x1c')]=_0x39525c[_0x32cd('0x1c')]||0x0;this[_0x32cd('0x2')]=_0x39525c['paused']||0x0;this[_0x32cd('0x3')]=_0x39525c[_0x32cd('0x3')]||0x0;this[_0x32cd('0x1d')]=_0x39525c['ringInUse'];this['sumBillable']=_0x39525c[_0x32cd('0x13')];this[_0x32cd('0x14')]=_0x39525c[_0x32cd('0x14')];this[_0x32cd('0x1e')]=_0x39525c[_0x32cd('0x1e')]||0x0;this['talking']=_0x39525c[_0x32cd('0x4')]||0x0;this[_0x32cd('0x1f')]=_0x39525c[_0x32cd('0x1f')]||0x0;this[_0x32cd('0x20')]=_0x39525c[_0x32cd('0x20')];this[_0x32cd('0x21')]=_0x39525c[_0x32cd('0x21')]||0x0;this[_0x32cd('0x22')]=_0x39525c['unknown']||0x0;this[_0x32cd('0x23')]=_0x39525c['unmanaged']||0x0;this['waiting']=_0x39525c[_0x32cd('0x5')]||0x0;if(_0x39525c['type']==='outbound'){this[_0x32cd('0x12')]=_0x39525c[_0x32cd('0x12')]||0x0;this['dialActive']=_0x39525c['dialActive'];this[_0x32cd('0x24')]=_0x39525c[_0x32cd('0x24')];this[_0x32cd('0x25')]=_0x39525c[_0x32cd('0x25')];this['dialOriginateCallerIdNumber']=_0x39525c['dialOriginateCallerIdNumber'];this['dialOriginateTimeout']=_0x39525c[_0x32cd('0x26')];this[_0x32cd('0x27')]=_0x39525c['dialPrefix'];this[_0x32cd('0x28')]=_0x39525c[_0x32cd('0x28')];this[_0x32cd('0x29')]=_0x39525c[_0x32cd('0x29')];this[_0x32cd('0x9')]=_0x39525c[_0x32cd('0x9')];this['outboundBlacklistCallsDay']=_0x39525c[_0x32cd('0xa')];this[_0x32cd('0xb')]=_0x39525c[_0x32cd('0xb')];this[_0x32cd('0xc')]=_0x39525c[_0x32cd('0xc')];this[_0x32cd('0x2a')]=_0x39525c['outboundDropCallsDayACS'];this[_0x32cd('0x2b')]=_0x39525c[_0x32cd('0x2b')];this[_0x32cd('0x2c')]=_0x39525c[_0x32cd('0x2c')];this[_0x32cd('0xd')]=_0x39525c[_0x32cd('0xd')];this['outboundNoSuchCallsDay']=_0x39525c[_0x32cd('0xe')];this[_0x32cd('0x2d')]=_0x39525c['outboundOriginateFailureCallsDay'];this[_0x32cd('0xf')]=_0x39525c[_0x32cd('0xf')];this[_0x32cd('0x10')]=_0x39525c[_0x32cd('0x10')];this[_0x32cd('0x11')]=_0x39525c[_0x32cd('0x11')];this[_0x32cd('0x2e')]=_0x39525c[_0x32cd('0x2e')];this[_0x32cd('0x2f')]=_0x39525c[_0x32cd('0x2f')];this[_0x32cd('0x30')]=_0x39525c[_0x32cd('0x30')];this[_0x32cd('0x31')]=_0x39525c['predictiveIntervalDroppedCallsCallersExit'];this[_0x32cd('0x32')]=_0x39525c[_0x32cd('0x32')];this[_0x32cd('0x33')]=_0x39525c[_0x32cd('0x33')];this['predictiveIntervalErlangCallsDroppedCalls']=_0x39525c['predictiveIntervalErlangCallsDroppedCalls'];this[_0x32cd('0x34')]=_0x39525c[_0x32cd('0x34')];this[_0x32cd('0x35')]=_0x39525c['predictiveIntervalMultiplicativeFactor'];this[_0x32cd('0x36')]=_0x39525c[_0x32cd('0x36')];this[_0x32cd('0x37')]=_0x39525c[_0x32cd('0x37')];this[_0x32cd('0x38')]=_0x39525c[_0x32cd('0x38')];this[_0x32cd('0x7')]=_0x39525c[_0x32cd('0x7')];this[_0x32cd('0x39')]=_0x39525c['erlangCalls'];this[_0x32cd('0x3a')]=_0x39525c['erlangCallToSecond'];this[_0x32cd('0x3b')]=_0x39525c[_0x32cd('0x3b')];this[_0x32cd('0x3c')]=_0x39525c[_0x32cd('0x3c')];this['startPredictive']=_0x39525c[_0x32cd('0x3d')];this[_0x32cd('0x3e')]=_0x39525c[_0x32cd('0x3e')];this[_0x32cd('0x3f')]=_0x39525c[_0x32cd('0x3f')];this[_0x32cd('0x40')]=_0x39525c[_0x32cd('0x40')];}if(_0x39525c[_0x32cd('0x41')]){this[_0x32cd('0x41')]={'id':_0x39525c[_0x32cd('0x41')]['id'],'name':_0x39525c[_0x32cd('0x41')][_0x32cd('0x42')],'active':_0x39525c[_0x32cd('0x41')][_0x32cd('0x43')],'callerid':_0x39525c[_0x32cd('0x41')][_0x32cd('0x44')]};}}VoiceQueueSummary[_0x32cd('0x45')]['createReport']=function(_0x285a48,_0x21370e,_0x4ba018,_0x2fdc69){this[_0x32cd('0x1')]=0x0;this[_0x32cd('0x4')]=0x0;this['paused']=0x0;this['unknown']=0x0;this[_0x32cd('0x1c')]=0x0;this[_0x32cd('0x19')]=0x0;this[_0x32cd('0x18')]=0x0;this[_0x32cd('0x1a')]=0x0;this['unavailable']=0x0;this[_0x32cd('0x3')]=0x0;this[_0x32cd('0x1d')]=0x0;this[_0x32cd('0x1b')]=0x0;if(_0x4ba018){if(_0x4ba018[_0x32cd('0x0')]){this[_0x32cd('0x0')]=Number(_0x4ba018[_0x32cd('0x0')]);}if(_0x4ba018[_0x32cd('0x46')]){this['loggedIn']=Number(_0x4ba018[_0x32cd('0x46')]);}if(_0x4ba018[_0x32cd('0x47')]){this['waiting']=Number(_0x4ba018[_0x32cd('0x47')]);}}for(var _0x13b579=0x0;_0x13b579<_0x285a48['length'];_0x13b579++){var _0x3b7d22=_0x21370e[_0x32cd('0x48')+_0x285a48[_0x13b579]['name']];if(_0x3b7d22&&_0x3b7d22[_0x32cd('0x49')]){this[_0x32cd('0x1')]+=0x1;}if(_0x285a48[_0x13b579][_0x32cd('0x4a')]==='1'){this['talking']+=0x1;}if(_0x285a48[_0x13b579][_0x32cd('0x2')]==='1'&&!['2','7','8'][_0x32cd('0x4b')](_0x285a48[_0x13b579][_0x32cd('0x4c')])){this['paused']+=0x1;}switch(_0x285a48[_0x13b579][_0x32cd('0x4c')]){case'0':this[_0x32cd('0x22')]+=0x1;break;case'1':this[_0x32cd('0x1c')]+=0x1;break;case'2':this[_0x32cd('0x19')]+=0x1;break;case'3':this[_0x32cd('0x18')]+=0x1;break;case'4':this[_0x32cd('0x1a')]+=0x1;break;case'5':this[_0x32cd('0x21')]+=0x1;break;case'6':this['ringing']+=0x1;break;case'7':this[_0x32cd('0x1d')]+=0x1;break;case'8':this['onHold']+=0x1;break;}}if(this[_0x32cd('0x24')]===_0x32cd('0x4d')){var _0x492320=Object[_0x32cd('0x4e')](_0x2fdc69);for(var _0x27aabc=0x0;_0x27aabc<_0x492320[_0x32cd('0x4f')];_0x27aabc++){var _0x18aa11=_0x492320[_0x27aabc];var _0xe18f78=_0x2fdc69[_0x18aa11];if(_0xe18f78[_0x32cd('0x50')]===this[_0x32cd('0x42')]&&_0xe18f78[_0x32cd('0x20')]==='dialer'&&_0xe18f78[_0x32cd('0x51')]==='xcally-motion-preview'){this[_0x32cd('0x4')]+=0x1;}}if(this[_0x32cd('0x4')]>this[_0x32cd('0x19')]){this[_0x32cd('0x4')]=this[_0x32cd('0x19')];}this[_0x32cd('0x12')]=0x0;}return this;};VoiceQueueSummary[_0x32cd('0x45')][_0x32cd('0x52')]=function(_0x523ad2){var _0x3abb23=![];if(_0x523ad2){_0x3abb23=INBOUND_COUNTERS[_0x32cd('0x53')](function(_0x22a0af){return this[_0x22a0af]!==_0x523ad2[_0x22a0af];},this);}return _0x3abb23;};VoiceQueueSummary['prototype'][_0x32cd('0x54')]=function(_0x1eb5e5){var _0x182d71=![];var _0x5d85e7=![];var _0x503a8e=![];if(_0x1eb5e5){_0x182d71=this[_0x32cd('0x24')]!==_0x1eb5e5['dialMethod']||this[_0x32cd('0x55')]!==_0x1eb5e5[_0x32cd('0x55')]||this['message']!==_0x1eb5e5['message']||this['statusMessage']!==_0x1eb5e5[_0x32cd('0x40')];_0x5d85e7=OUTBOUND_COUNTERS['some'](function(_0x5a10d3){return this[_0x5a10d3]!==_0x1eb5e5[_0x5a10d3];},this);if(this[_0x32cd('0x41')]&&_0x1eb5e5[_0x32cd('0x41')]){_0x503a8e=this[_0x32cd('0x41')][_0x32cd('0x42')]!==_0x1eb5e5[_0x32cd('0x41')][_0x32cd('0x42')]||this[_0x32cd('0x41')][_0x32cd('0x43')]!==_0x1eb5e5['Trunk']['active'];}}return _0x182d71||_0x5d85e7||_0x503a8e;};VoiceQueueSummary[_0x32cd('0x45')][_0x32cd('0x56')]=function(_0x54ea80){this[_0x32cd('0x17')]=_0x54ea80[_0x32cd('0x17')];this['message']=_0x54ea80[_0x32cd('0x3f')];this[_0x32cd('0x40')]=_0x54ea80[_0x32cd('0x40')];this[_0x32cd('0x7')]=_0x54ea80[_0x32cd('0x7')];this[_0x32cd('0x8')]=_0x54ea80['outboundAbandonedCallsDay'];this['outboundAnswerCallsDay']=_0x54ea80[_0x32cd('0x9')];this[_0x32cd('0xa')]=_0x54ea80[_0x32cd('0xa')];this[_0x32cd('0xb')]=_0x54ea80[_0x32cd('0xb')];this['outboundCongestionCallsDay']=_0x54ea80[_0x32cd('0xc')];this[_0x32cd('0xd')]=_0x54ea80[_0x32cd('0xd')];this[_0x32cd('0xe')]=_0x54ea80['outboundNoSuchCallsDay'];this[_0x32cd('0xf')]=_0x54ea80[_0x32cd('0xf')];this[_0x32cd('0x10')]=_0x54ea80[_0x32cd('0x10')];this['outboundUnknownCallsDay']=_0x54ea80[_0x32cd('0x11')];this['sumBillable']=_0x54ea80[_0x32cd('0x13')];this[_0x32cd('0x14')]=_0x54ea80[_0x32cd('0x14')];this[_0x32cd('0x1f')]=_0x54ea80['total'];if(this[_0x32cd('0x24')]===_0x32cd('0x57')){this[_0x32cd('0x12')]=_0x54ea80[_0x32cd('0x12')];}};module[_0x32cd('0x58')]=VoiceQueueSummary; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index ac6a636..ed7349b 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 _0xfdb1=['remoteUri','serverUrl','Configurations','exports','name','username','accessKey'];(function(_0x4638d7,_0x335a77){var _0x4db7eb=function(_0x5b6a8d){while(--_0x5b6a8d){_0x4638d7['push'](_0x4638d7['shift']());}};_0x4db7eb(++_0x335a77);}(_0xfdb1,0x66));var _0x1fdb=function(_0x482078,_0x3d6315){_0x482078=_0x482078-0x0;var _0x4621b8=_0xfdb1[_0x482078];return _0x4621b8;};'use strict';function VtigerAccount(_0x585f4c){this['id']=_0x585f4c['id']||0x0;this['name']=_0x585f4c[_0x1fdb('0x0')]||'';this[_0x1fdb('0x1')]=_0x585f4c[_0x1fdb('0x1')]||'';this[_0x1fdb('0x2')]=_0x585f4c['accessKey']||'';this[_0x1fdb('0x3')]=_0x585f4c['remoteUri']||'';this['serverUrl']=_0x585f4c[_0x1fdb('0x4')]||'';this[_0x1fdb('0x5')]=_0x585f4c[_0x1fdb('0x5')]||{};}module[_0x1fdb('0x6')]=VtigerAccount; \ No newline at end of file +var _0xb8b3=['serverUrl','Configurations','exports','name','username','accessKey','remoteUri'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xb8b3,0x1a0));var _0x3b8b=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xb8b3[_0x4e676e];return _0x336a3c;};'use strict';function VtigerAccount(_0x5099e7){this['id']=_0x5099e7['id']||0x0;this[_0x3b8b('0x0')]=_0x5099e7[_0x3b8b('0x0')]||'';this[_0x3b8b('0x1')]=_0x5099e7[_0x3b8b('0x1')]||'';this['accessKey']=_0x5099e7[_0x3b8b('0x2')]||'';this[_0x3b8b('0x3')]=_0x5099e7['remoteUri']||'';this['serverUrl']=_0x5099e7[_0x3b8b('0x4')]||'';this[_0x3b8b('0x5')]=_0x5099e7[_0x3b8b('0x5')]||{};}module[_0x3b8b('0x6')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index 033330e..df82373 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 _0x7126=['username','password','remoteUri','authType','type','integrationTab','serverUrl','Configurations','exports'];(function(_0x140609,_0x311a03){var _0x1a8e4a=function(_0x50df7c){while(--_0x50df7c){_0x140609['push'](_0x140609['shift']());}};_0x1a8e4a(++_0x311a03);}(_0x7126,0x17a));var _0x6712=function(_0x54dff0,_0x426b7d){_0x54dff0=_0x54dff0-0x0;var _0x15d7f9=_0x7126[_0x54dff0];return _0x15d7f9;};'use strict';function ZendeskAccount(_0x3c0d23){this['id']=_0x3c0d23['id']||0x0;this['name']=_0x3c0d23['name']||'';this[_0x6712('0x0')]=_0x3c0d23[_0x6712('0x0')]||'';this[_0x6712('0x1')]=_0x3c0d23[_0x6712('0x1')]||'';this['token']=_0x3c0d23['token']||'';this[_0x6712('0x2')]=_0x3c0d23['remoteUri']||'';this['authType']=_0x3c0d23[_0x6712('0x3')]||'';this[_0x6712('0x4')]=_0x3c0d23[_0x6712('0x4')]||_0x6712('0x5');this[_0x6712('0x6')]=_0x3c0d23['serverUrl']||'';this['Configurations']=_0x3c0d23[_0x6712('0x7')]||{};}module[_0x6712('0x8')]=ZendeskAccount; \ No newline at end of file +var _0x6ad5=['authType','type','integrationTab','serverUrl','Configurations','name','username','token','remoteUri'];(function(_0x479d95,_0xd0b6e4){var _0x2da255=function(_0x6bd4d6){while(--_0x6bd4d6){_0x479d95['push'](_0x479d95['shift']());}};_0x2da255(++_0xd0b6e4);}(_0x6ad5,0xa7));var _0x56ad=function(_0xcde3e7,_0x35f9ed){_0xcde3e7=_0xcde3e7-0x0;var _0x470578=_0x6ad5[_0xcde3e7];return _0x470578;};'use strict';function ZendeskAccount(_0x4f75e9){this['id']=_0x4f75e9['id']||0x0;this[_0x56ad('0x0')]=_0x4f75e9[_0x56ad('0x0')]||'';this[_0x56ad('0x1')]=_0x4f75e9[_0x56ad('0x1')]||'';this['password']=_0x4f75e9['password']||'';this[_0x56ad('0x2')]=_0x4f75e9[_0x56ad('0x2')]||'';this[_0x56ad('0x3')]=_0x4f75e9[_0x56ad('0x3')]||'';this[_0x56ad('0x4')]=_0x4f75e9[_0x56ad('0x4')]||'';this[_0x56ad('0x5')]=_0x4f75e9[_0x56ad('0x5')]||_0x56ad('0x6');this[_0x56ad('0x7')]=_0x4f75e9[_0x56ad('0x7')]||'';this[_0x56ad('0x8')]=_0x4f75e9['Configurations']||{};}module['exports']=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index c42b3af..e36e8f4 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 _0x3ceb=['code','refreshToken','Configurations','exports','name','description','host','zone','clientId','clientSecret','serverUrl'];(function(_0x3f3c1b,_0x64486){var _0x58759d=function(_0x1f4965){while(--_0x1f4965){_0x3f3c1b['push'](_0x3f3c1b['shift']());}};_0x58759d(++_0x64486);}(_0x3ceb,0x9e));var _0xb3ce=function(_0x4f03d3,_0x1f0b2a){_0x4f03d3=_0x4f03d3-0x0;var _0xff4908=_0x3ceb[_0x4f03d3];return _0xff4908;};'use strict';function ZohoAccount(_0x9fc744){this['id']=_0x9fc744['id']||0x0;this[_0xb3ce('0x0')]=_0x9fc744['name']||'';this['description']=_0x9fc744[_0xb3ce('0x1')]||'';this[_0xb3ce('0x2')]=_0x9fc744['host']||'';this[_0xb3ce('0x3')]=_0x9fc744[_0xb3ce('0x3')]||'';this[_0xb3ce('0x4')]=_0x9fc744[_0xb3ce('0x4')]||'';this['clientSecret']=_0x9fc744[_0xb3ce('0x5')]||'';this[_0xb3ce('0x6')]=_0x9fc744[_0xb3ce('0x6')]||'';this['code']=_0x9fc744[_0xb3ce('0x7')]||'';this[_0xb3ce('0x8')]=_0x9fc744['refreshToken']||'';this[_0xb3ce('0x9')]=_0x9fc744[_0xb3ce('0x9')]||{};}module[_0xb3ce('0xa')]=ZohoAccount; \ No newline at end of file +var _0x6d3d=['description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','name'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0x6d3d,0x103));var _0xd6d3=function(_0x1b1c0f,_0x543e8c){_0x1b1c0f=_0x1b1c0f-0x0;var _0x29adca=_0x6d3d[_0x1b1c0f];return _0x29adca;};'use strict';function ZohoAccount(_0x5b4fde){this['id']=_0x5b4fde['id']||0x0;this[_0xd6d3('0x0')]=_0x5b4fde['name']||'';this[_0xd6d3('0x1')]=_0x5b4fde[_0xd6d3('0x1')]||'';this[_0xd6d3('0x2')]=_0x5b4fde[_0xd6d3('0x2')]||'';this[_0xd6d3('0x3')]=_0x5b4fde[_0xd6d3('0x3')]||'';this['clientId']=_0x5b4fde[_0xd6d3('0x4')]||'';this[_0xd6d3('0x5')]=_0x5b4fde[_0xd6d3('0x5')]||'';this[_0xd6d3('0x6')]=_0x5b4fde[_0xd6d3('0x6')]||'';this['code']=_0x5b4fde[_0xd6d3('0x7')]||'';this['refreshToken']=_0x5b4fde[_0xd6d3('0x8')]||'';this[_0xd6d3('0x9')]=_0x5b4fde[_0xd6d3('0x9')]||{};}module['exports']=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index aaaf858..0013b19 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 _0xb574=['prototype','\x22%s\x22\x20<%s>','number','exports','util','lodash','isNil','string','queue','name','type','campaigntype','dialAnswer','membername','Agent','format','SIP/%s','calleridname','Contact','phone','firstName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname'];(function(_0x37412d,_0x4e2af8){var _0x24cd09=function(_0x465a1d){while(--_0x465a1d){_0x37412d['push'](_0x37412d['shift']());}};_0x24cd09(++_0x4e2af8);}(_0xb574,0x106));var _0x4b57=function(_0x4cf393,_0x4681ce){_0x4cf393=_0x4cf393-0x0;var _0x24c0f5=_0xb574[_0x4cf393];return _0x24c0f5;};'use strict';var util=require(_0x4b57('0x0'));var _=require(_0x4b57('0x1'));var moment=require('moment');function checkNameSurname(_0x213dde,_0x3d351b,_0x5a4911){var _0x413f1d='';if(!_[_0x4b57('0x2')](_0x3d351b)&&_0x4b57('0x3')===typeof _0x3d351b){_0x413f1d+=_0x3d351b;}if(!_[_0x4b57('0x2')](_0x5a4911)&&_0x4b57('0x3')===typeof _0x5a4911){_0x413f1d+='\x20'+_0x5a4911;}if(_0x413f1d!==''){return _0x413f1d;}return _0x213dde;}function Action(_0x4a3efa,_0x4eb019,_0x1c97e5,_0x4a4a0f,_0x585d86){this['uniqueid']=_0x1c97e5||undefined;this['idContact']=_0x4a3efa['id'];this[_0x4b57('0x4')]=_0x4eb019[_0x4b57('0x5')];this[_0x4b57('0x6')]=_0x4eb019[_0x4b57('0x6')];this[_0x4b57('0x7')]=_0x4b57('0x4');this[_0x4b57('0x8')]=![];this[_0x4b57('0x9')]=_['isNil'](_0x4a3efa[_0x4b57('0xa')])?undefined:_0x4a3efa[_0x4b57('0xa')][_0x4b57('0x5')];this['channelAgent']=this['membername']?util[_0x4b57('0xb')](_0x4b57('0xc'),this[_0x4b57('0x9')]):_0x4a4a0f||undefined;this[_0x4b57('0xd')]=checkNameSurname(_0x4a3efa[_0x4b57('0xe')][_0x4b57('0xf')],_0x4a3efa[_0x4b57('0xe')][_0x4b57('0x10')],_0x4a3efa[_0x4b57('0xe')]['lastName']);this['active']=_0x4a3efa[_0x4b57('0x11')]||![];this[_0x4b57('0x12')]=_0x4a3efa[_0x4b57('0xf')];this['scheduledat']=_0x4a3efa[_0x4b57('0x13')];this['countbusyretry']=_0x4a3efa[_0x4b57('0x14')]||0x0;this[_0x4b57('0x15')]=_0x4a3efa[_0x4b57('0x15')]||0x0;this[_0x4b57('0x16')]=_0x4a3efa[_0x4b57('0x16')]||0x0;this[_0x4b57('0x17')]=(_0x4a3efa['countbusyretry']||0x0)+(_0x4a3efa[_0x4b57('0x15')]||0x0)+(_0x4a3efa[_0x4b57('0x16')]||0x0)+(_0x4a3efa[_0x4b57('0x18')]||0x0)+(_0x4a3efa[_0x4b57('0x19')]||0x0)+(_0x4a3efa['countabandonedretry']||0x0)+(_0x4a3efa[_0x4b57('0x1a')]||0x0)+(_0x4a3efa[_0x4b57('0x1b')]||0x0);this[_0x4b57('0x18')]=_0x4a3efa[_0x4b57('0x18')]||0x0;this[_0x4b57('0x19')]=_0x4a3efa[_0x4b57('0x19')]||0x0;this['countabandonedretry']=_0x4a3efa[_0x4b57('0x1c')]||0x0;this[_0x4b57('0x1a')]=_0x4a3efa[_0x4b57('0x1a')]||0x0;this['countagentrejectretry']=_0x4a3efa[_0x4b57('0x1b')]||0x0;this[_0x4b57('0x1d')]=_0x4a3efa[_0x4b57('0x1d')];this[_0x4b57('0x1e')]=_0x4a3efa['callbackuniqueid'];this[_0x4b57('0x1f')]=_0x4a3efa[_0x4b57('0x1f')];this['recallme']=_0x4a3efa[_0x4b57('0x20')];this[_0x4b57('0x21')]=_0x4a3efa[_0x4b57('0x21')];this[_0x4b57('0x22')]=_0x4a3efa['ListId'];this[_0x4b57('0x23')]=_['isNil'](_0x4a3efa[_0x4b57('0xa')])?_0x4a3efa['UserId']:_0x4a3efa[_0x4b57('0xa')]['id'];this[_0x4b57('0x24')]=_0x4a3efa[_0x4b57('0x24')];this[_0x4b57('0x25')]='';this[_0x4b57('0x26')]='';}Action[_0x4b57('0x27')]['getCaller']=function(){return util['format'](_0x4b57('0x28'),this['calleridname'],this[_0x4b57('0x29')]);};module[_0x4b57('0x2a')]=Action; \ No newline at end of file +var _0x5b12=['active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countmachineretry','countdropretry','countabandonedretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','number','exports','util','lodash','moment','isNil','uniqueid','idContact','queue','name','type','campaigntype','dialAnswer','membername','Agent','channelAgent','format','SIP/%s','calleridname','Contact','phone','firstName','lastName'];(function(_0x7b366,_0x205997){var _0x14790a=function(_0x1acecf){while(--_0x1acecf){_0x7b366['push'](_0x7b366['shift']());}};_0x14790a(++_0x205997);}(_0x5b12,0xa3));var _0x25b1=function(_0x4d2ce6,_0x3438f5){_0x4d2ce6=_0x4d2ce6-0x0;var _0x4370f7=_0x5b12[_0x4d2ce6];return _0x4370f7;};'use strict';var util=require(_0x25b1('0x0'));var _=require(_0x25b1('0x1'));var moment=require(_0x25b1('0x2'));function checkNameSurname(_0x569948,_0x1c9b07,_0x5b457b){var _0x2d491e='';if(!_[_0x25b1('0x3')](_0x1c9b07)&&'string'===typeof _0x1c9b07){_0x2d491e+=_0x1c9b07;}if(!_[_0x25b1('0x3')](_0x5b457b)&&'string'===typeof _0x5b457b){_0x2d491e+='\x20'+_0x5b457b;}if(_0x2d491e!==''){return _0x2d491e;}return _0x569948;}function Action(_0x5248c2,_0x35d90b,_0x5523c9,_0x5bb95b,_0x1f715d){this[_0x25b1('0x4')]=_0x5523c9||undefined;this[_0x25b1('0x5')]=_0x5248c2['id'];this[_0x25b1('0x6')]=_0x35d90b[_0x25b1('0x7')];this[_0x25b1('0x8')]=_0x35d90b[_0x25b1('0x8')];this[_0x25b1('0x9')]='queue';this[_0x25b1('0xa')]=![];this[_0x25b1('0xb')]=_[_0x25b1('0x3')](_0x5248c2[_0x25b1('0xc')])?undefined:_0x5248c2[_0x25b1('0xc')][_0x25b1('0x7')];this[_0x25b1('0xd')]=this[_0x25b1('0xb')]?util[_0x25b1('0xe')](_0x25b1('0xf'),this[_0x25b1('0xb')]):_0x5bb95b||undefined;this[_0x25b1('0x10')]=checkNameSurname(_0x5248c2[_0x25b1('0x11')][_0x25b1('0x12')],_0x5248c2[_0x25b1('0x11')][_0x25b1('0x13')],_0x5248c2['Contact'][_0x25b1('0x14')]);this[_0x25b1('0x15')]=_0x5248c2['active']||![];this[_0x25b1('0x16')]=_0x5248c2[_0x25b1('0x12')];this[_0x25b1('0x17')]=_0x5248c2['scheduledat'];this['countbusyretry']=_0x5248c2[_0x25b1('0x18')]||0x0;this['countcongestionretry']=_0x5248c2[_0x25b1('0x19')]||0x0;this[_0x25b1('0x1a')]=_0x5248c2[_0x25b1('0x1a')]||0x0;this[_0x25b1('0x1b')]=(_0x5248c2[_0x25b1('0x18')]||0x0)+(_0x5248c2[_0x25b1('0x19')]||0x0)+(_0x5248c2[_0x25b1('0x1a')]||0x0)+(_0x5248c2[_0x25b1('0x1c')]||0x0)+(_0x5248c2['countdropretry']||0x0)+(_0x5248c2['countabandonedretry']||0x0)+(_0x5248c2[_0x25b1('0x1d')]||0x0)+(_0x5248c2['countagentrejectretry']||0x0);this[_0x25b1('0x1c')]=_0x5248c2['countnosuchnumberretry']||0x0;this[_0x25b1('0x1e')]=_0x5248c2['countdropretry']||0x0;this[_0x25b1('0x1f')]=_0x5248c2['countabandonedretry']||0x0;this[_0x25b1('0x1d')]=_0x5248c2['countmachineretry']||0x0;this['countagentrejectretry']=_0x5248c2['countagentrejectretry']||0x0;this[_0x25b1('0x20')]=_0x5248c2[_0x25b1('0x20')];this['callbackuniqueid']=_0x5248c2[_0x25b1('0x21')];this[_0x25b1('0x22')]=_0x5248c2[_0x25b1('0x22')];this[_0x25b1('0x23')]=_0x5248c2[_0x25b1('0x23')];this['ContactId']=_0x5248c2[_0x25b1('0x24')];this[_0x25b1('0x25')]=_0x5248c2[_0x25b1('0x25')];this[_0x25b1('0x26')]=_[_0x25b1('0x3')](_0x5248c2[_0x25b1('0xc')])?_0x5248c2['UserId']:_0x5248c2[_0x25b1('0xc')]['id'];this[_0x25b1('0x27')]=_0x5248c2[_0x25b1('0x27')];this['originatecalleridnum']='';this[_0x25b1('0x28')]='';}Action[_0x25b1('0x29')][_0x25b1('0x2a')]=function(){return util['format'](_0x25b1('0x2b'),this['calleridname'],this[_0x25b1('0x2c')]);};module[_0x25b1('0x2d')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index c25c27e..a05df1e 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(_0x1415c5,_0x7fb6da){var _0x1c7666=function(_0x150a25){while(--_0x150a25){_0x1415c5['push'](_0x1415c5['shift']());}};_0x1c7666(++_0x7fb6da);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'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 _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(_0x2f5f73,_0x508860){var _0x2a5a88=function(_0x5e5073){while(--_0x5e5073){_0x2f5f73['push'](_0x2f5f73['shift']());}};_0x2a5a88(++_0x508860);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'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 diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 878efb8..6b7aa48 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 _0xa0ac=['then','moveContactManagedDialer','catch','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','answertime','queuecallercomplete','queuecallercompleteAt','connectedlinename','membername','context','xcally-motion-preview','holdtime','assigned','lastAssignedTo','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/agentReportPreview','error','inspect','createHistory','[createHistory]\x20','resolve'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xa0ac,0x161));var _0xca0a=function(_0x284f7c,_0x3936b4){_0x284f7c=_0x284f7c-0x0;var _0x5b48e8=_0xa0ac[_0x284f7c];return _0x5b48e8;};'use strict';var util=require(_0xca0a('0x0'));var BPromise=require(_0xca0a('0x1'));var logger=require(_0xca0a('0x2'))('preview');var cmHopper=require(_0xca0a('0x3'));var cmHopperHistory=require(_0xca0a('0x4'));var cmHopperBlack=require('../rpc/cmHopperBlack');var agentReportPreview=require(_0xca0a('0x5'));var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0xdfacf3){return function(_0x38fecc){logger[_0xca0a('0x6')](_0xdfacf3,util[_0xca0a('0x7')](_0x38fecc,{'showHidden':![],'depth':null}));};}function create(_0x2daa45){return cmHopperHistory[_0xca0a('0x8')](_0x2daa45)['catch'](loggerCatch(_0xca0a('0x9')));}function createAgent(_0x505093){return BPromise[_0xca0a('0xa')]()[_0xca0a('0xb')](agentReportPreview[_0xca0a('0x8')](_0x505093))['catch'](loggerCatch(_0xca0a('0x9')));}function moveContact(_0x15f341){return cmHopper[_0xca0a('0xc')](_0x15f341,!![])[_0xca0a('0xd')](loggerCatch(_0xca0a('0xe')));}exports[_0xca0a('0xf')]=function(_0x3c81cb){return cmHopperBlack[_0xca0a('0xf')](_0x3c81cb)[_0xca0a('0xd')](loggerCatch(_0xca0a('0x10')));};exports[_0xca0a('0x11')]=function(_0x2585cf){return BPromise['resolve']()[_0xca0a('0xb')](cmHopper[_0xca0a('0x11')](_0x2585cf))[_0xca0a('0xd')](loggerCatch(_0xca0a('0x12')));};exports[_0xca0a('0x8')]=function(_0x4e05e9,_0x529dbf){create(_0x4e05e9)[_0xca0a('0xd')](loggerCatch(_0x529dbf));moveContact(_0x4e05e9)[_0xca0a('0xd')](loggerCatch(_0x529dbf));};exports['createAgentHistory']=function(_0x13bc33,_0x202b70){createAgent(_0x13bc33)[_0xca0a('0xd')](loggerCatch(_0x202b70));};exports[_0xca0a('0x13')]=function(_0x105ff9,_0x14b81b){create(_0x105ff9)[_0xca0a('0xd')](loggerCatch(_0x14b81b));};exports[_0xca0a('0x14')]=function(_0x19e8d2,_0x1c13c6){moveContact(_0x19e8d2)[_0xca0a('0xd')](loggerCatch(_0x1c13c6));};exports[_0xca0a('0x15')]=function(_0x397e17,_0x3f833d,_0x17feac){if(_0x3f833d){_0x397e17[_0xca0a('0x16')]=null;}if(_0x17feac){_0x397e17['active']=![];}return cmHopper[_0xca0a('0x15')](_0x397e17)[_0xca0a('0xd')](loggerCatch('[rescheduleContact]\x20'));};exports['countReScheduled']=function(_0x6aea92){return cmHopper['countReScheduled'](_0x6aea92)[_0xca0a('0xd')](loggerCatch(_0xca0a('0x17')));};exports[_0xca0a('0x18')]=function(_0xf99e4c){return cmHopper[_0xca0a('0x18')]({'UserId':null},_0xf99e4c,0x1)['catch'](loggerCatch(_0xca0a('0x19')));};exports['disableContact']=function(_0x1c5470){return cmHopper[_0xca0a('0x18')]({'active':![]},_0x1c5470,0x1)['catch'](loggerCatch(_0xca0a('0x1a')));};exports[_0xca0a('0x1b')]=function(_0x4a8db9){var _0x3a84a0={};_0x3a84a0['type']=_0x4a8db9[_0xca0a('0x1c')];_0x3a84a0[_0xca0a('0x1d')]=_0x4a8db9['uniqueid'];_0x3a84a0[_0xca0a('0x1e')]=_0x4a8db9['calleridnum'];_0x3a84a0[_0xca0a('0x1f')]=_0x4a8db9[_0xca0a('0x1f')];_0x3a84a0[_0xca0a('0x20')]=_0x4a8db9[_0xca0a('0x20')];_0x3a84a0[_0xca0a('0x21')]=_0x4a8db9['answertime'];_0x3a84a0[_0xca0a('0x22')]=_0x4a8db9[_0xca0a('0x23')];_0x3a84a0[_0xca0a('0x24')]=0x1;_0x3a84a0[_0xca0a('0x25')]=_0x4a8db9['endtime'];_0x3a84a0[_0xca0a('0x26')]=_0x4a8db9[_0xca0a('0x27')];_0x3a84a0[_0xca0a('0x28')]='from-sip';_0x3a84a0['exten']=_0xca0a('0x29');_0x3a84a0[_0xca0a('0x2a')]=0x0;_0x3a84a0[_0xca0a('0x2b')]=0x1;_0x3a84a0[_0xca0a('0x2c')]=_0x4a8db9[_0xca0a('0x27')];_0x3a84a0['queuecallerexitreason']=_0xca0a('0x2d');return BPromise[_0xca0a('0xa')]()[_0xca0a('0xb')](voiceQueueReport[_0xca0a('0x2e')](_0x3a84a0))[_0xca0a('0xd')](loggerCatch(_0xca0a('0x2f')));};exports[_0xca0a('0x30')]=function(_0x2e7374,_0x4b7ac0){return BPromise[_0xca0a('0xa')]()[_0xca0a('0xb')](cmHopper[_0xca0a('0x30')](_0x2e7374,_0x4b7ac0))[_0xca0a('0xd')](loggerCatch(_0xca0a('0x31')));};exports[_0xca0a('0x32')]=function(_0x282264){return cmHopper[_0xca0a('0x15')](_0x282264,!![],!![])[_0xca0a('0xd')](loggerCatch(_0xca0a('0x33')));}; \ No newline at end of file +var _0xa1e1=['uniqueid','calleridnum','queue','answertime','queuecallerleaveAt','membername','context','from-sip','exten','xcally-motion-preview','holdtime','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','util','bluebird','preview','../rpc/cmHopper','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','[createHistory]\x20','resolve','then','createHistory','catch','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','active','countReScheduled','unlockContact','crateCustomerReportQueue','type'];(function(_0x1eacc4,_0x26f265){var _0x5c549a=function(_0x481e53){while(--_0x481e53){_0x1eacc4['push'](_0x1eacc4['shift']());}};_0x5c549a(++_0x26f265);}(_0xa1e1,0x17b));var _0x1a1e=function(_0x9e2f4d,_0x5227e5){_0x9e2f4d=_0x9e2f4d-0x0;var _0x27bc29=_0xa1e1[_0x9e2f4d];return _0x27bc29;};'use strict';var util=require(_0x1a1e('0x0'));var BPromise=require(_0x1a1e('0x1'));var logger=require('../../../config/logger')(_0x1a1e('0x2'));var cmHopper=require(_0x1a1e('0x3'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require('../rpc/cmHopperBlack');var agentReportPreview=require(_0x1a1e('0x4'));var voiceQueueReport=require(_0x1a1e('0x5'));function loggerCatch(_0x1ffce2){return function(_0x278295){logger[_0x1a1e('0x6')](_0x1ffce2,util[_0x1a1e('0x7')](_0x278295,{'showHidden':![],'depth':null}));};}function create(_0x571278){return cmHopperHistory['createHistory'](_0x571278)['catch'](loggerCatch(_0x1a1e('0x8')));}function createAgent(_0xbfd025){return BPromise[_0x1a1e('0x9')]()[_0x1a1e('0xa')](agentReportPreview[_0x1a1e('0xb')](_0xbfd025))[_0x1a1e('0xc')](loggerCatch(_0x1a1e('0x8')));}function moveContact(_0x1ee8e9){return cmHopper['moveContactManagedDialer'](_0x1ee8e9,!![])[_0x1a1e('0xc')](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0x1a1e('0xd')]=function(_0x3095b5){return cmHopperBlack['checkIsBlackList'](_0x3095b5)[_0x1a1e('0xc')](loggerCatch(_0x1a1e('0xe')));};exports[_0x1a1e('0xf')]=function(_0x5c0c6f){return BPromise['resolve']()[_0x1a1e('0xa')](cmHopper['getContactPreview'](_0x5c0c6f))[_0x1a1e('0xc')](loggerCatch(_0x1a1e('0x10')));};exports[_0x1a1e('0xb')]=function(_0x4418e5,_0x3c0cdc){create(_0x4418e5)[_0x1a1e('0xc')](loggerCatch(_0x3c0cdc));moveContact(_0x4418e5)[_0x1a1e('0xc')](loggerCatch(_0x3c0cdc));};exports[_0x1a1e('0x11')]=function(_0x41fe64,_0x11d3bb){createAgent(_0x41fe64)[_0x1a1e('0xc')](loggerCatch(_0x11d3bb));};exports[_0x1a1e('0x12')]=function(_0x1c29a4,_0x5900c5){create(_0x1c29a4)[_0x1a1e('0xc')](loggerCatch(_0x5900c5));};exports[_0x1a1e('0x13')]=function(_0x40c98d,_0x348026){moveContact(_0x40c98d)['catch'](loggerCatch(_0x348026));};exports[_0x1a1e('0x14')]=function(_0x53f3ce,_0x13d56f,_0x400b0c){if(_0x13d56f){_0x53f3ce['UserId']=null;}if(_0x400b0c){_0x53f3ce[_0x1a1e('0x15')]=![];}return cmHopper[_0x1a1e('0x14')](_0x53f3ce)[_0x1a1e('0xc')](loggerCatch('[rescheduleContact]\x20'));};exports[_0x1a1e('0x16')]=function(_0x2775d7){return cmHopper[_0x1a1e('0x16')](_0x2775d7)['catch'](loggerCatch('[countReScheduled]\x20'));};exports[_0x1a1e('0x17')]=function(_0x1b86ea){return cmHopper['unlockContact']({'UserId':null},_0x1b86ea,0x1)[_0x1a1e('0xc')](loggerCatch('[unlockContact]\x20'));};exports['disableContact']=function(_0x303eea){return cmHopper[_0x1a1e('0x17')]({'active':![]},_0x303eea,0x1)[_0x1a1e('0xc')](loggerCatch('[activeContact]\x20'));};exports[_0x1a1e('0x18')]=function(_0x369fee){var _0x56bc3a={};_0x56bc3a['type']=_0x369fee[_0x1a1e('0x19')];_0x56bc3a['uniqueid']=_0x369fee[_0x1a1e('0x1a')];_0x56bc3a[_0x1a1e('0x1b')]=_0x369fee[_0x1a1e('0x1b')];_0x56bc3a['calleridname']=_0x369fee['calleridname'];_0x56bc3a[_0x1a1e('0x1c')]=_0x369fee[_0x1a1e('0x1c')];_0x56bc3a['queuecallerjoinAt']=_0x369fee[_0x1a1e('0x1d')];_0x56bc3a[_0x1a1e('0x1e')]=_0x369fee[_0x1a1e('0x1d')];_0x56bc3a['queuecallercomplete']=0x1;_0x56bc3a['queuecallercompleteAt']=_0x369fee['endtime'];_0x56bc3a['connectedlinename']=_0x369fee[_0x1a1e('0x1f')];_0x56bc3a[_0x1a1e('0x20')]=_0x1a1e('0x21');_0x56bc3a[_0x1a1e('0x22')]=_0x1a1e('0x23');_0x56bc3a[_0x1a1e('0x24')]=0x0;_0x56bc3a['assigned']=0x1;_0x56bc3a[_0x1a1e('0x25')]=_0x369fee[_0x1a1e('0x1f')];_0x56bc3a[_0x1a1e('0x26')]=_0x1a1e('0x27');return BPromise[_0x1a1e('0x9')]()[_0x1a1e('0xa')](voiceQueueReport[_0x1a1e('0x28')](_0x56bc3a))[_0x1a1e('0xc')](loggerCatch(_0x1a1e('0x29')));};exports[_0x1a1e('0x2a')]=function(_0x5ea84c,_0x4b679d){return BPromise[_0x1a1e('0x9')]()['then'](cmHopper['getContactRecallMe'](_0x5ea84c,_0x4b679d))[_0x1a1e('0xc')](loggerCatch(_0x1a1e('0x2b')));};exports[_0x1a1e('0x2c')]=function(_0x4ffcb5){return cmHopper[_0x1a1e('0x14')](_0x4ffcb5,!![],!![])[_0x1a1e('0xc')](loggerCatch('[rescheduleContactInQueue]\x20'));}; \ No newline at end of file diff --git a/server/services/ami/preview/util/util.js b/server/services/ami/preview/util/util.js index 0e6f537..d09c01a 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 _0x7c9e=['pow','replace','random','extractCalleridName','extractCalleridNumber','match','noanswer','variables','keys','forEach','toLowerCase','buildNoAnswerEventPayload','lodash','moment','../../../../config/logger','preview','XCALLY_IP_AGI','../../dialer/utils','loggerCatch','error','inspect','info','logger2','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isNil','addVariables','Queue','calleridname','calleridnum','dialOriginateTimeout','\x22rtTxX%s%s\x22','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','dialQueueProject2','originatecalleridnum','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','toLowerVariables','toLower','updateOriginated','hasOwnProperty','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','statedesc','responsetime','endtime','logAgent','state','ringtime','getSeconds','starttime','logLookAgent','UserId','logCustomer','talktime','answertime','isFailure','Failure','variablesAction','RECALL','BOOKED','uniqueid','originate','channelAgent','from-sip','countbusyretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','active','scheduledat','minutes','ContactId','ListId','VoiceQueueId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','IsNotLoggedIn','lastevent','name','queue','interface','voice','mandatoryDisposition','buildObj','agentReadyId','not_inuse','status','push','milliseconds','diff','seconds','createBody','CampaignId','filterKey','type','campaigntype','membername','countcongestionretry','callback','callbackuniqueid','sipcallid','xmd-queue','xmd-phone','xmd-listid','xmd-dialtimeout','xmd-dialid','xmd-dialchannel','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosloss','bridgepeer','bridgepvtcallid','\x5cw{0,'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x7c9e,0x124));var _0xe7c9=function(_0x561e2a,_0xbd4c22){_0x561e2a=_0x561e2a-0x0;var _0x29b6d0=_0x7c9e[_0x561e2a];return _0x29b6d0;};'use strict';var util=require('util');var _=require(_0xe7c9('0x0'));var moment=require(_0xe7c9('0x1'));var logger=require(_0xe7c9('0x2'))(_0xe7c9('0x3'));var ipAgi=process['env'][_0xe7c9('0x4')]||'127.0.0.1';var utils=require(_0xe7c9('0x5'));exports[_0xe7c9('0x6')]=function(_0x5d3573){return function(_0x2373c){logger[_0xe7c9('0x7')](_0x5d3573,util[_0xe7c9('0x8')](_0x2373c,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x5595c8,_0x362220){logger[_0xe7c9('0x9')](_0x5595c8,util[_0xe7c9('0x8')](_0x362220,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x2c6a71,_0x1f7158){logger[_0xe7c9('0x7')](_0x2c6a71,util[_0xe7c9('0x8')](_0x1f7158,{'showHidden':![],'depth':null}));};exports[_0xe7c9('0xa')]=function(_0x18a466){return function(_0x51ea8d){logger[_0xe7c9('0x9')](_0x18a466,util[_0xe7c9('0x8')](_0x51ea8d,{'showHidden':![],'depth':null}));};};exports[_0xe7c9('0xb')]=function(_0x55153c,_0x906af1,_0x972c99){return{'message':_0x55153c,'unlock':_0x906af1,'active':_0x972c99};};exports[_0xe7c9('0xc')]=function(_0x162a47,_0x123b0c,_0x21f14c){if(!_[_0xe7c9('0xd')](_0x21f14c)&&_0xe7c9('0xe')===typeof _0x21f14c&&!_[_0xe7c9('0xf')](_0x21f14c)){if(!_[_0xe7c9('0xd')](_0x123b0c)&&_0xe7c9('0xe')===typeof _0x123b0c&&!_[_0xe7c9('0xf')](_0x123b0c)){return util[_0xe7c9('0x10')](_0xe7c9('0x11'),_0x123b0c,_0x21f14c);}return util[_0xe7c9('0x10')](_0xe7c9('0x11'),_0x21f14c,_0x21f14c);}if(!_[_0xe7c9('0xd')](_0x162a47)&&_0xe7c9('0xe')===typeof _0x162a47&&!_[_0xe7c9('0xf')](_0x162a47)){return _0x162a47;}return _0xe7c9('0x12');};exports['isActive']=function(_0x9350d1){if(_[_0xe7c9('0x13')](_0x9350d1)){return![];}return _0x9350d1;};exports[_0xe7c9('0x14')]=function(_0x16e5e0,_0x1259b3,_0x568a84,_0x4f39a2,_0x3eaf52,_0x33bb50){var _0x502ac1={'XMD-QUEUE':_0x1259b3[_0xe7c9('0x15')]?_0x1259b3[_0xe7c9('0x15')]['name']:'','XMD-CALLERID':_0x4f39a2,'XMD-CALLERID-PREVIEW':_0x33bb50?util[_0xe7c9('0x10')](_0xe7c9('0x11'),_0x33bb50[_0xe7c9('0x16')],_0x33bb50[_0xe7c9('0x17')]):_0x4f39a2,'XMD-DIALID':_0x3eaf52,'XMD-CONTACTID':_0x1259b3['ContactId'],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x4f39a2,'XMD-VOICEQUEUEID':_0x1259b3['VoiceQueueId'],'XMD-DIALCHANNEL':_0x568a84,'XMD-DIALTIMEOUT':_0x16e5e0[_0xe7c9('0x18')]||0x1e,'XMD-DIALOPTIONS':util[_0xe7c9('0x10')](_0xe7c9('0x19'),_0x16e5e0['dialQueueProject2']?'g':'',_[_0xe7c9('0xf')](_0x16e5e0[_0xe7c9('0x1a')])?'':_0xe7c9('0x1b')),'XMD-DIALURL':_0x16e5e0[_0xe7c9('0x1c')]||'','XMD-AGI':_0x16e5e0[_0xe7c9('0x1d')]?util[_0xe7c9('0x10')](_0xe7c9('0x1e'),ipAgi,_0x16e5e0[_0xe7c9('0x1d')]):_0xe7c9('0x1f'),'XMD-AGIAFTER':_0x16e5e0['dialQueueProject2']?util[_0xe7c9('0x10')](_0xe7c9('0x1e'),ipAgi,_0x16e5e0[_0xe7c9('0x20')]):_0xe7c9('0x1f'),'XMD-ORIGINATECALLERIDNUM':_0x33bb50?_0x33bb50[_0xe7c9('0x21')]:'','XMD-ORIGINATECALLERIDNAME':_0x33bb50?_0x33bb50['originatecalleridname']:'','XMD-DESTINATION':_0xe7c9('0x22'),'SIPADDHEADER':_0xe7c9('0x23')};if(!_['isEmpty'](_0x16e5e0[_0xe7c9('0x1a')])){_0x502ac1[util[_0xe7c9('0x10')]('%s',_0xe7c9('0x24'))]=_0x16e5e0[_0xe7c9('0x1a')];_0x502ac1[util[_0xe7c9('0x10')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x3eaf52;}return _0x502ac1;};exports[_0xe7c9('0x25')]=function(_0x91bff9){var _0x3a90c3={};for(var _0x2a94c9 in _0x91bff9){if(_0x91bff9['hasOwnProperty'](_0x2a94c9)){_0x3a90c3[util['format']('%s',_[_0xe7c9('0x26')](_0x2a94c9))]=_0x91bff9[_0x2a94c9];}}return{'variables':_0x3a90c3};};exports[_0xe7c9('0x27')]=function(_0x4e49b4,_0x4189ec){if(!_['isNil'](_0x4e49b4)){if(_0x4e49b4[_0xe7c9('0x28')](_0xe7c9('0x29'))){if(_0x4e49b4[_0xe7c9('0x29')]>0x0){_0x4e49b4[_0xe7c9('0x29')]-=0x1;}else{logger[_0xe7c9('0x7')](_0xe7c9('0x2a'),_0x4189ec);}}}else{logger[_0xe7c9('0x7')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x4189ec);}};exports[_0xe7c9('0x2b')]=function(_0x5e241c){var _0x6b3858=moment()[_0xe7c9('0x10')](_0xe7c9('0x2c'));_0x5e241c['state']=0xd;_0x5e241c[_0xe7c9('0x2d')]='Blacklist';_0x5e241c['starttime']=_0x6b3858;_0x5e241c[_0xe7c9('0x2e')]=_0x6b3858;_0x5e241c[_0xe7c9('0x2f')]=_0x6b3858;};exports[_0xe7c9('0x30')]=function(_0x3f2e5e,_0x565a39,_0x57fb4f){var _0xb8eef6=moment()[_0xe7c9('0x10')](_0xe7c9('0x2c'));_0x3f2e5e[_0xe7c9('0x31')]=_0x565a39;_0x3f2e5e[_0xe7c9('0x2d')]=_0x57fb4f;_0x3f2e5e['responsetime']=_0xb8eef6;_0x3f2e5e[_0xe7c9('0x32')]=utils[_0xe7c9('0x33')](_0x3f2e5e[_0xe7c9('0x2e')],_0x3f2e5e[_0xe7c9('0x34')]);};exports[_0xe7c9('0x35')]=function(_0x42f85f,_0x180dae,_0x274768){_0x42f85f['membername']=_0x180dae;_0x42f85f[_0xe7c9('0x36')]=_0x274768;};exports[_0xe7c9('0x37')]=function(_0x3f59a7,_0x1c816d,_0x4ecca4){var _0x582a5f=moment()['format'](_0xe7c9('0x2c'));_0x3f59a7[_0xe7c9('0x31')]=_0x1c816d;_0x3f59a7[_0xe7c9('0x2d')]=_0x4ecca4;_0x3f59a7[_0xe7c9('0x2e')]=_0x3f59a7[_0xe7c9('0x2e')]?_0x3f59a7[_0xe7c9('0x2e')]:_0x582a5f;_0x3f59a7['endtime']=_0x3f59a7[_0xe7c9('0x2f')]?_0x3f59a7['endtime']:_0x582a5f;_0x3f59a7[_0xe7c9('0x32')]=utils[_0xe7c9('0x33')](_0x3f59a7[_0xe7c9('0x2e')]||0x0,_0x3f59a7['starttime']||0x0);_0x3f59a7[_0xe7c9('0x38')]=_0x3f59a7[_0xe7c9('0x39')]?utils['getSeconds'](_0x3f59a7[_0xe7c9('0x2f')],_0x3f59a7['answertime']):0x0;};exports[_0xe7c9('0x3a')]=function(_0x26d656){return _0x26d656===_0xe7c9('0x3b');};exports[_0xe7c9('0x3c')]=function(_0x18f7ac,_0x1c9bb5,_0x3c5cb0,_0x3d54f0,_0x85ffe5){var _0x1c67c4=_0x3d54f0?_0xe7c9('0x3d'):_0x18f7ac['calleridname'];_0x1c67c4=_0x85ffe5?_0xe7c9('0x3e'):_0x1c67c4;return{'actionid':_0x18f7ac[_0xe7c9('0x3f')],'action':_0xe7c9('0x40'),'channel':_0x18f7ac[_0xe7c9('0x41')],'callerid':util[_0xe7c9('0x10')](_0xe7c9('0x11'),_0x1c67c4,_0x18f7ac[_0xe7c9('0x17')]),'Exten':_0xe7c9('0x22'),'Context':_0xe7c9('0x42'),'Priority':'1','variable':_0x3c5cb0,'timeout':(_0x1c9bb5['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x18f7ac[_0xe7c9('0x3f')]};};exports['totalGlobal']=function(_0x56260c){return _0x56260c[_0xe7c9('0x43')]+_0x56260c['countcongestionretry']+_0x56260c[_0xe7c9('0x44')]+_0x56260c[_0xe7c9('0x45')]+_0x56260c[_0xe7c9('0x46')];};exports[_0xe7c9('0x47')]=function(_0x52af20){var _0x13941d=_[_0xe7c9('0x48')](_0x52af20);_0x13941d[_0xe7c9('0x31')]=0xf;_0x13941d[_0xe7c9('0x2d')]=_0xe7c9('0x49');return _0x13941d;};exports['scheduledAt']=function(_0x5caa87,_0x4c25db,_0x38913e){var _0x5abe93={};_0x5abe93[_0x4c25db]=_0x5caa87[_0x4c25db];_0x5abe93[_0xe7c9('0x4a')]=![];_0x5abe93[_0xe7c9('0x4b')]=moment()['add'](_0x38913e,_0xe7c9('0x4c'))[_0xe7c9('0x10')](_0xe7c9('0x2c'));_0x5abe93[_0xe7c9('0x4d')]=_0x5caa87[_0xe7c9('0x4d')];_0x5abe93[_0xe7c9('0x4e')]=_0x5caa87[_0xe7c9('0x4e')];_0x5abe93[_0xe7c9('0x4f')]=_0x5caa87[_0xe7c9('0x4f')]||undefined;return _0x5abe93;};exports[_0xe7c9('0x50')]=function(_0x4b8535,_0x35b9f3){if(!_['isNil'](_0x4b8535)){if(_0x4b8535[_0xe7c9('0x51')]>0x0){_0x4b8535['pTalking']-=0x1;}else{logger[_0xe7c9('0x7')](_0x35b9f3,_0xe7c9('0x52'));}}else{logger['error'](_0x35b9f3,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports[_0xe7c9('0x53')]=function(_0x1d4295){if(_0x1d4295<=0x0){return!![];}return![];};function buildObj(_0x3d0bf1,_0x196a78,_0x20dcbd){_0x3d0bf1[_0xe7c9('0x54')]=_0x196a78;_0x3d0bf1[_0xe7c9('0x55')]=_0x3d0bf1[_0xe7c9('0x56')];_0x3d0bf1[_0xe7c9('0x57')]=_0x3d0bf1[_0xe7c9('0x41')];_0x3d0bf1['motionChannel']=_0xe7c9('0x58');if(_0x20dcbd){_0x3d0bf1[_0xe7c9('0x59')]=_0x20dcbd[_0xe7c9('0x59')];}return _0x3d0bf1;}exports[_0xe7c9('0x5a')]=buildObj;exports[_0xe7c9('0x5b')]=function(_0x542491){var _0x4a8bea=[];for(var _0xe26547 in _0x542491){if(_0x542491[_0xe7c9('0x28')](_0xe26547)){if(!_[_0xe7c9('0x13')](_0x542491[_0xe26547])&&_0x542491[_0xe26547][_0xe7c9('0x31')]===_0xe7c9('0x5c')&&_0x542491[_0xe26547][_0xe7c9('0x5d')]==='reachable'){_0x4a8bea[_0xe7c9('0x5e')](_0x542491[_0xe26547]['id']);}}}return _0x4a8bea;};exports['getDiff']=function(_0xb5260e){var _0x367e68=moment()[_0xe7c9('0x5f')](0x0);var _0x5ce7a1=moment(_0xb5260e)[_0xe7c9('0x5f')](0x0);return _0x367e68[_0xe7c9('0x60')](_0x5ce7a1,_0xe7c9('0x61'));};exports[_0xe7c9('0x62')]=function(_0x459c9a){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x459c9a[_0xe7c9('0x4d')],'ListId':_0x459c9a['ListId'],'VoiceQueueId':_0x459c9a[_0xe7c9('0x4f')]||undefined,'CampaignId':_0x459c9a[_0xe7c9('0x63')]||undefined};};exports[_0xe7c9('0x64')]=function(_0x2e3869){if(_0x2e3869===_0xe7c9('0x3f')||_0x2e3869==='idContact'||_0x2e3869===_0xe7c9('0x56')||_0x2e3869===_0xe7c9('0x65')||_0x2e3869===_0xe7c9('0x66')||_0x2e3869==='dialAnswer'||_0x2e3869===_0xe7c9('0x67')||_0x2e3869==='channelAgent'||_0x2e3869===_0xe7c9('0x16')||_0x2e3869===_0xe7c9('0x4a')||_0x2e3869==='calleridnum'||_0x2e3869===_0xe7c9('0x4b')||_0x2e3869===_0xe7c9('0x43')||_0x2e3869===_0xe7c9('0x68')||_0x2e3869==='countnoanswerretry'||_0x2e3869==='countglobal'||_0x2e3869===_0xe7c9('0x69')||_0x2e3869===_0xe7c9('0x6a')||_0x2e3869==='callbackat'||_0x2e3869==='recallme'||_0x2e3869==='ContactId'||_0x2e3869==='ListId'||_0x2e3869===_0xe7c9('0x36')||_0x2e3869===_0xe7c9('0x4f')||_0x2e3869===_0xe7c9('0x6b')||_0x2e3869==='xmd-voicequeueid'||_0x2e3869===_0xe7c9('0x6c')||_0x2e3869===_0xe7c9('0x6d')||_0x2e3869===_0xe7c9('0x6e')||_0x2e3869==='xmd-dialurl'||_0x2e3869===_0xe7c9('0x6f')||_0x2e3869==='xmd-dialoptions'||_0x2e3869===_0xe7c9('0x70')||_0x2e3869===_0xe7c9('0x71')||_0x2e3869==='xmd-contactid'||_0x2e3869===_0xe7c9('0x72')||_0x2e3869===_0xe7c9('0x73')||_0x2e3869===_0xe7c9('0x74')||_0x2e3869===_0xe7c9('0x75')||_0x2e3869===_0xe7c9('0x76')||_0x2e3869===_0xe7c9('0x77')||_0x2e3869===_0xe7c9('0x78')||_0x2e3869===_0xe7c9('0x79')||_0x2e3869==='rtpaudioqosloss'||_0x2e3869===_0xe7c9('0x7a')||_0x2e3869===_0xe7c9('0x7b')||_0x2e3869==='rtpaudioqosrttbridged'||_0x2e3869===_0xe7c9('0x76')||_0x2e3869===_0xe7c9('0x77')||_0x2e3869===_0xe7c9('0x78')||_0x2e3869===_0xe7c9('0x79')||_0x2e3869===_0xe7c9('0x7c')||_0x2e3869==='rtpaudioqoslossbridged'||_0x2e3869==='rtpaudioqosrtt'||_0x2e3869==='rtpaudioqosrttbridged'||_0x2e3869===_0xe7c9('0x7d')||_0x2e3869===_0xe7c9('0x7e')||_0x2e3869===_0xe7c9('0x31')||_0x2e3869==='statedesc'){return![];}return!![];};exports['getCallerIdRandom']=function(_0xfafbfc,_0x1c9229){var _0x53159d,_0xab8a5,_0x543ff0;if(_0x1c9229<=0x0){_0x1c9229=0x1;}_0x53159d=new RegExp(_0xe7c9('0x7f')+_0x1c9229+'}$');_0xab8a5=Math[_0xe7c9('0x80')](0xa,_0x1c9229-0x1);_0x543ff0=Math[_0xe7c9('0x80')](0xa,_0x1c9229)-0x1;return util[_0xe7c9('0x10')]('%s',_[_0xe7c9('0x81')](_0xfafbfc,_0x53159d,_[_0xe7c9('0x82')](_0xab8a5,_0x543ff0)));};exports[_0xe7c9('0x83')]=function(_0x46681b){var _0x37aadb=_0x46681b['match'](/"(.*?)"/);return _0x37aadb?_0x37aadb[0x1]:_0x46681b;};exports[_0xe7c9('0x84')]=function(_0x272392){var _0x2f8358=_0x272392[_0xe7c9('0x85')](/<(.*?)>/);return _0x2f8358?_0x2f8358[0x1]:_0x272392;};function buildNoAnswerEventPayload(_0x51de65,_0x376f47){var _0xc1a3fa=buildObj(_0x51de65,_0xe7c9('0x86'));if(!_[_0xe7c9('0xf')](_0x376f47[_0xe7c9('0x87')])){Object[_0xe7c9('0x88')](_0x376f47[_0xe7c9('0x87')])[_0xe7c9('0x89')](function(_0x296e78){_0xc1a3fa[_0x296e78[_0xe7c9('0x8a')]()]=_0x376f47[_0xe7c9('0x87')][_0x296e78];});}return _0xc1a3fa;}exports[_0xe7c9('0x8b')]=buildNoAnswerEventPayload; \ No newline at end of file +var _0x5bd6=['isNil','addVariables','Queue','calleridname','calleridnum','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','dialQueueProject2','NONE','originatecalleridnum','xcally-motion-preview','Call-Type:\x20PREVIEW','monitor_format','_XCALLY_MIXMONITOR_FORMAT','toLowerVariables','hasOwnProperty','toLower','originated','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','responsetime','endtime','ringtime','getSeconds','logLookAgent','membername','UserId','logCustomer','answertime','isFailure','Failure','variablesAction','RECALL','uniqueid','originate','timeout','countbusyretry','countcongestionretry','countnoanswerretry','cloneAction','clone','Global','scheduledat','add','minutes','ContactId','ListId','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','lastevent','queue','interface','channelAgent','voice','mandatoryDisposition','agentReadyId','not_inuse','reachable','push','getDiff','diff','seconds','CampaignId','filterKey','idContact','campaigntype','dialAnswer','countglobal','callback','callbackuniqueid','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqos','bridgepeer','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','match','extractCalleridNumber','noanswer','variables','keys','forEach','toLowerCase','util','lodash','moment','../../../../config/logger','preview','env','../../dialer/utils','loggerCatch','error','logger','info','inspect','getCallerId','string','isEmpty','isUndefined','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive'];(function(_0x33eeda,_0x56b8d6){var _0x45c999=function(_0x12b65f){while(--_0x12b65f){_0x33eeda['push'](_0x33eeda['shift']());}};_0x45c999(++_0x56b8d6);}(_0x5bd6,0x76));var _0x65bd=function(_0x188703,_0x596b26){_0x188703=_0x188703-0x0;var _0x1a0c81=_0x5bd6[_0x188703];return _0x1a0c81;};'use strict';var util=require(_0x65bd('0x0'));var _=require(_0x65bd('0x1'));var moment=require(_0x65bd('0x2'));var logger=require(_0x65bd('0x3'))(_0x65bd('0x4'));var ipAgi=process[_0x65bd('0x5')]['XCALLY_IP_AGI']||'127.0.0.1';var utils=require(_0x65bd('0x6'));exports[_0x65bd('0x7')]=function(_0x27389a){return function(_0x426620){logger[_0x65bd('0x8')](_0x27389a,util['inspect'](_0x426620,{'showHidden':![],'depth':null}));};};exports[_0x65bd('0x9')]=function(_0x702344,_0x1faa90){logger[_0x65bd('0xa')](_0x702344,util[_0x65bd('0xb')](_0x1faa90,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x3d2783,_0x13a393){logger[_0x65bd('0x8')](_0x3d2783,util[_0x65bd('0xb')](_0x13a393,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x32f1da){return function(_0x5b07e1){logger[_0x65bd('0xa')](_0x32f1da,util[_0x65bd('0xb')](_0x5b07e1,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x38d058,_0x26a63e,_0x424737){return{'message':_0x38d058,'unlock':_0x26a63e,'active':_0x424737};};exports[_0x65bd('0xc')]=function(_0xdceddf,_0x52a846,_0x42a56f){if(!_['isUndefined'](_0x42a56f)&&_0x65bd('0xd')===typeof _0x42a56f&&!_[_0x65bd('0xe')](_0x42a56f)){if(!_[_0x65bd('0xf')](_0x52a846)&&_0x65bd('0xd')===typeof _0x52a846&&!_[_0x65bd('0xe')](_0x52a846)){return util[_0x65bd('0x10')](_0x65bd('0x11'),_0x52a846,_0x42a56f);}return util[_0x65bd('0x10')]('\x22%s\x22\x20<%s>',_0x42a56f,_0x42a56f);}if(!_[_0x65bd('0xf')](_0xdceddf)&&_0x65bd('0xd')===typeof _0xdceddf&&!_[_0x65bd('0xe')](_0xdceddf)){return _0xdceddf;}return _0x65bd('0x12');};exports[_0x65bd('0x13')]=function(_0x16554f){if(_[_0x65bd('0x14')](_0x16554f)){return![];}return _0x16554f;};exports[_0x65bd('0x15')]=function(_0x1eb719,_0x147b84,_0x307c51,_0x1f4c40,_0x44b0a8,_0x2929f1){var _0x5d75b1={'XMD-QUEUE':_0x147b84[_0x65bd('0x16')]?_0x147b84[_0x65bd('0x16')]['name']:'','XMD-CALLERID':_0x1f4c40,'XMD-CALLERID-PREVIEW':_0x2929f1?util['format'](_0x65bd('0x11'),_0x2929f1[_0x65bd('0x17')],_0x2929f1[_0x65bd('0x18')]):_0x1f4c40,'XMD-DIALID':_0x44b0a8,'XMD-CONTACTID':_0x147b84['ContactId'],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x1f4c40,'XMD-VOICEQUEUEID':_0x147b84[_0x65bd('0x19')],'XMD-DIALCHANNEL':_0x307c51,'XMD-DIALTIMEOUT':_0x1eb719[_0x65bd('0x1a')]||0x1e,'XMD-DIALOPTIONS':util['format'](_0x65bd('0x1b'),_0x1eb719['dialQueueProject2']?'g':'',_[_0x65bd('0xe')](_0x1eb719['monitor_format'])?'':_0x65bd('0x1c')),'XMD-DIALURL':_0x1eb719[_0x65bd('0x1d')]||'','XMD-AGI':_0x1eb719[_0x65bd('0x1e')]?util[_0x65bd('0x10')](_0x65bd('0x1f'),ipAgi,_0x1eb719[_0x65bd('0x1e')]):'NONE','XMD-AGIAFTER':_0x1eb719['dialQueueProject2']?util[_0x65bd('0x10')]('\x22agi://%s/square,%s\x22',ipAgi,_0x1eb719[_0x65bd('0x20')]):_0x65bd('0x21'),'XMD-ORIGINATECALLERIDNUM':_0x2929f1?_0x2929f1[_0x65bd('0x22')]:'','XMD-ORIGINATECALLERIDNAME':_0x2929f1?_0x2929f1['originatecalleridname']:'','XMD-DESTINATION':_0x65bd('0x23'),'SIPADDHEADER':_0x65bd('0x24')};if(!_[_0x65bd('0xe')](_0x1eb719[_0x65bd('0x25')])){_0x5d75b1[util[_0x65bd('0x10')]('%s',_0x65bd('0x26'))]=_0x1eb719[_0x65bd('0x25')];_0x5d75b1[util['format']('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x44b0a8;}return _0x5d75b1;};exports[_0x65bd('0x27')]=function(_0x314e9b){var _0x185640={};for(var _0x15e557 in _0x314e9b){if(_0x314e9b[_0x65bd('0x28')](_0x15e557)){_0x185640[util[_0x65bd('0x10')]('%s',_[_0x65bd('0x29')](_0x15e557))]=_0x314e9b[_0x15e557];}}return{'variables':_0x185640};};exports['updateOriginated']=function(_0xcb3bb7,_0x2472c6){if(!_[_0x65bd('0x14')](_0xcb3bb7)){if(_0xcb3bb7['hasOwnProperty']('originated')){if(_0xcb3bb7[_0x65bd('0x2a')]>0x0){_0xcb3bb7[_0x65bd('0x2a')]-=0x1;}else{logger[_0x65bd('0x8')]('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x2472c6);}}}else{logger[_0x65bd('0x8')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x2472c6);}};exports[_0x65bd('0x2b')]=function(_0x46ce3b){var _0x11c309=moment()[_0x65bd('0x10')](_0x65bd('0x2c'));_0x46ce3b[_0x65bd('0x2d')]=0xd;_0x46ce3b[_0x65bd('0x2e')]=_0x65bd('0x2f');_0x46ce3b[_0x65bd('0x30')]=_0x11c309;_0x46ce3b[_0x65bd('0x31')]=_0x11c309;_0x46ce3b[_0x65bd('0x32')]=_0x11c309;};exports['logAgent']=function(_0x3cac25,_0x4bfd33,_0x40e43e){var _0x218b75=moment()[_0x65bd('0x10')]('YYYY-MM-DD\x20HH:mm:ss');_0x3cac25[_0x65bd('0x2d')]=_0x4bfd33;_0x3cac25[_0x65bd('0x2e')]=_0x40e43e;_0x3cac25['responsetime']=_0x218b75;_0x3cac25[_0x65bd('0x33')]=utils[_0x65bd('0x34')](_0x3cac25[_0x65bd('0x31')],_0x3cac25[_0x65bd('0x30')]);};exports[_0x65bd('0x35')]=function(_0x47250c,_0x19b524,_0x155fdf){_0x47250c[_0x65bd('0x36')]=_0x19b524;_0x47250c[_0x65bd('0x37')]=_0x155fdf;};exports[_0x65bd('0x38')]=function(_0x148172,_0x473bcd,_0xd847a4){var _0xb659d2=moment()[_0x65bd('0x10')]('YYYY-MM-DD\x20HH:mm:ss');_0x148172['state']=_0x473bcd;_0x148172[_0x65bd('0x2e')]=_0xd847a4;_0x148172[_0x65bd('0x31')]=_0x148172[_0x65bd('0x31')]?_0x148172[_0x65bd('0x31')]:_0xb659d2;_0x148172[_0x65bd('0x32')]=_0x148172[_0x65bd('0x32')]?_0x148172['endtime']:_0xb659d2;_0x148172[_0x65bd('0x33')]=utils[_0x65bd('0x34')](_0x148172[_0x65bd('0x31')]||0x0,_0x148172[_0x65bd('0x30')]||0x0);_0x148172['talktime']=_0x148172[_0x65bd('0x39')]?utils['getSeconds'](_0x148172[_0x65bd('0x32')],_0x148172[_0x65bd('0x39')]):0x0;};exports[_0x65bd('0x3a')]=function(_0x283611){return _0x283611===_0x65bd('0x3b');};exports[_0x65bd('0x3c')]=function(_0x586704,_0x17f46b,_0x18c554,_0x5d65b4,_0x358436){var _0x5fbb9e=_0x5d65b4?_0x65bd('0x3d'):_0x586704[_0x65bd('0x17')];_0x5fbb9e=_0x358436?'BOOKED':_0x5fbb9e;return{'actionid':_0x586704[_0x65bd('0x3e')],'action':_0x65bd('0x3f'),'channel':_0x586704['channelAgent'],'callerid':util['format'](_0x65bd('0x11'),_0x5fbb9e,_0x586704[_0x65bd('0x18')]),'Exten':_0x65bd('0x23'),'Context':'from-sip','Priority':'1','variable':_0x18c554,'timeout':(_0x17f46b[_0x65bd('0x40')]||0x1e)*0x3e8,'async':!![],'channelid':_0x586704[_0x65bd('0x3e')]};};exports['totalGlobal']=function(_0x1c40aa){return _0x1c40aa[_0x65bd('0x41')]+_0x1c40aa[_0x65bd('0x42')]+_0x1c40aa[_0x65bd('0x43')]+_0x1c40aa['countagentrejectretry']+_0x1c40aa['countnosuchnumberretry'];};exports[_0x65bd('0x44')]=function(_0x28c935){var _0x1b42b7=_[_0x65bd('0x45')](_0x28c935);_0x1b42b7[_0x65bd('0x2d')]=0xf;_0x1b42b7[_0x65bd('0x2e')]=_0x65bd('0x46');return _0x1b42b7;};exports['scheduledAt']=function(_0x4ad679,_0x48eed5,_0x1be699){var _0xa36da6={};_0xa36da6[_0x48eed5]=_0x4ad679[_0x48eed5];_0xa36da6['active']=![];_0xa36da6[_0x65bd('0x47')]=moment()[_0x65bd('0x48')](_0x1be699,_0x65bd('0x49'))['format'](_0x65bd('0x2c'));_0xa36da6[_0x65bd('0x4a')]=_0x4ad679[_0x65bd('0x4a')];_0xa36da6[_0x65bd('0x4b')]=_0x4ad679[_0x65bd('0x4b')];_0xa36da6['VoiceQueueId']=_0x4ad679['VoiceQueueId']||undefined;return _0xa36da6;};exports['decrementTalkink']=function(_0x100c0a,_0x292167){if(!_[_0x65bd('0x14')](_0x100c0a)){if(_0x100c0a[_0x65bd('0x4c')]>0x0){_0x100c0a['pTalking']-=0x1;}else{logger[_0x65bd('0x8')](_0x292167,_0x65bd('0x4d'));}}else{logger['error'](_0x292167,_0x65bd('0x4e'));}};exports['IsNotLoggedIn']=function(_0x121fc1){if(_0x121fc1<=0x0){return!![];}return![];};function buildObj(_0x59a90f,_0x40476b,_0x2c0ff6){_0x59a90f[_0x65bd('0x4f')]=_0x40476b;_0x59a90f['name']=_0x59a90f[_0x65bd('0x50')];_0x59a90f[_0x65bd('0x51')]=_0x59a90f[_0x65bd('0x52')];_0x59a90f['motionChannel']=_0x65bd('0x53');if(_0x2c0ff6){_0x59a90f['mandatoryDisposition']=_0x2c0ff6[_0x65bd('0x54')];}return _0x59a90f;}exports['buildObj']=buildObj;exports[_0x65bd('0x55')]=function(_0x351785){var _0x4e21db=[];for(var _0xd47c91 in _0x351785){if(_0x351785[_0x65bd('0x28')](_0xd47c91)){if(!_[_0x65bd('0x14')](_0x351785[_0xd47c91])&&_0x351785[_0xd47c91]['state']===_0x65bd('0x56')&&_0x351785[_0xd47c91]['status']===_0x65bd('0x57')){_0x4e21db[_0x65bd('0x58')](_0x351785[_0xd47c91]['id']);}}}return _0x4e21db;};exports[_0x65bd('0x59')]=function(_0x100d8f){var _0x331927=moment()['milliseconds'](0x0);var _0x55d1ff=moment(_0x100d8f)['milliseconds'](0x0);return _0x331927[_0x65bd('0x5a')](_0x55d1ff,_0x65bd('0x5b'));};exports['createBody']=function(_0x4907f8){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x4907f8['ContactId'],'ListId':_0x4907f8[_0x65bd('0x4b')],'VoiceQueueId':_0x4907f8[_0x65bd('0x19')]||undefined,'CampaignId':_0x4907f8[_0x65bd('0x5c')]||undefined};};exports[_0x65bd('0x5d')]=function(_0x503ee6){if(_0x503ee6===_0x65bd('0x3e')||_0x503ee6===_0x65bd('0x5e')||_0x503ee6===_0x65bd('0x50')||_0x503ee6==='type'||_0x503ee6===_0x65bd('0x5f')||_0x503ee6===_0x65bd('0x60')||_0x503ee6==='membername'||_0x503ee6===_0x65bd('0x52')||_0x503ee6===_0x65bd('0x17')||_0x503ee6==='active'||_0x503ee6===_0x65bd('0x18')||_0x503ee6===_0x65bd('0x47')||_0x503ee6===_0x65bd('0x41')||_0x503ee6===_0x65bd('0x42')||_0x503ee6===_0x65bd('0x43')||_0x503ee6===_0x65bd('0x61')||_0x503ee6===_0x65bd('0x62')||_0x503ee6===_0x65bd('0x63')||_0x503ee6==='callbackat'||_0x503ee6===_0x65bd('0x64')||_0x503ee6===_0x65bd('0x4a')||_0x503ee6==='ListId'||_0x503ee6===_0x65bd('0x37')||_0x503ee6==='VoiceQueueId'||_0x503ee6===_0x65bd('0x65')||_0x503ee6===_0x65bd('0x66')||_0x503ee6===_0x65bd('0x67')||_0x503ee6===_0x65bd('0x68')||_0x503ee6===_0x65bd('0x69')||_0x503ee6===_0x65bd('0x6a')||_0x503ee6===_0x65bd('0x6b')||_0x503ee6===_0x65bd('0x6c')||_0x503ee6===_0x65bd('0x6d')||_0x503ee6===_0x65bd('0x6e')||_0x503ee6===_0x65bd('0x6f')||_0x503ee6===_0x65bd('0x70')||_0x503ee6===_0x65bd('0x71')||_0x503ee6===_0x65bd('0x72')||_0x503ee6===_0x65bd('0x73')||_0x503ee6==='rtpaudioqos'||_0x503ee6===_0x65bd('0x74')||_0x503ee6===_0x65bd('0x75')||_0x503ee6===_0x65bd('0x76')||_0x503ee6===_0x65bd('0x77')||_0x503ee6===_0x65bd('0x78')||_0x503ee6===_0x65bd('0x79')||_0x503ee6===_0x65bd('0x7a')||_0x503ee6===_0x65bd('0x7b')||_0x503ee6===_0x65bd('0x74')||_0x503ee6==='rtpaudioqosjitter'||_0x503ee6===_0x65bd('0x76')||_0x503ee6===_0x65bd('0x77')||_0x503ee6===_0x65bd('0x78')||_0x503ee6===_0x65bd('0x79')||_0x503ee6==='rtpaudioqosrttbridged'||_0x503ee6===_0x65bd('0x7c')||_0x503ee6==='bridgepvtcallid'||_0x503ee6===_0x65bd('0x2d')||_0x503ee6===_0x65bd('0x2e')){return![];}return!![];};exports[_0x65bd('0x7d')]=function(_0x4672e6,_0xb69271){var _0x40fe50,_0x1a21b5,_0x37c09a;if(_0xb69271<=0x0){_0xb69271=0x1;}_0x40fe50=new RegExp(_0x65bd('0x7e')+_0xb69271+'}$');_0x1a21b5=Math[_0x65bd('0x7f')](0xa,_0xb69271-0x1);_0x37c09a=Math[_0x65bd('0x7f')](0xa,_0xb69271)-0x1;return util[_0x65bd('0x10')]('%s',_[_0x65bd('0x80')](_0x4672e6,_0x40fe50,_[_0x65bd('0x81')](_0x1a21b5,_0x37c09a)));};exports[_0x65bd('0x82')]=function(_0x546441){var _0x14c7a2=_0x546441[_0x65bd('0x83')](/"(.*?)"/);return _0x14c7a2?_0x14c7a2[0x1]:_0x546441;};exports[_0x65bd('0x84')]=function(_0x123504){var _0x42e15f=_0x123504[_0x65bd('0x83')](/<(.*?)>/);return _0x42e15f?_0x42e15f[0x1]:_0x123504;};function buildNoAnswerEventPayload(_0x1ed6e1,_0x57f4b3){var _0x515199=buildObj(_0x1ed6e1,_0x65bd('0x85'));if(!_['isEmpty'](_0x57f4b3[_0x65bd('0x86')])){Object[_0x65bd('0x87')](_0x57f4b3[_0x65bd('0x86')])[_0x65bd('0x88')](function(_0x1f703a){_0x515199[_0x1f703a[_0x65bd('0x89')]()]=_0x57f4b3[_0x65bd('0x86')][_0x1f703a];});}return _0x515199;}exports['buildNoAnswerEventPayload']=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index b1c027f..1ce1cbf 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 _0x4948=['string','number','boolean','voicequeuechannel','voicechannel','voicequeuechannelredirect','queueadd'];(function(_0x408762,_0x1e2f39){var _0x5e9e3e=function(_0x1e4e3e){while(--_0x1e4e3e){_0x408762['push'](_0x408762['shift']());}};_0x5e9e3e(++_0x1e2f39);}(_0x4948,0x164));var _0x8494=function(_0x50f799,_0x4aba74){_0x50f799=_0x50f799-0x0;var _0x3471ca=_0x4948[_0x50f799];return _0x3471ca;};'use strict';exports[_0x8494('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':'string','required':!![]},'membername':{'type':_0x8494('0x1'),'required':!![]},'penalty':{'type':_0x8494('0x2'),'required':![]},'paused':{'type':_0x8494('0x3'),'required':![]}};exports['queueremove']={'queue':{'type':'string','required':!![]},'interface':{'type':_0x8494('0x1'),'required':!![]}};exports['queuepause']={'interface':{'type':_0x8494('0x1'),'required':!![]},'paused':{'type':_0x8494('0x3')},'reason':{'type':_0x8494('0x1'),'required':![]}};exports['reload']={'module':{'type':_0x8494('0x1'),'required':![]}};exports[_0x8494('0x4')]={'uniqueid':{'type':_0x8494('0x1'),'required':!![]}};exports[_0x8494('0x5')]={'uniqueid':{'type':_0x8494('0x1'),'required':!![]},'filename':{'type':_0x8494('0x1')},'format':{'type':_0x8494('0x1')},'mixmonitorid':{'type':_0x8494('0x1')}};exports['voicequeuechannelhangup']={'uniqueid':{'type':_0x8494('0x1'),'required':!![]}};exports[_0x8494('0x6')]={'uniqueid':{'type':_0x8494('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':_0x8494('0x1')}}; \ No newline at end of file +var _0xdf8b=['boolean','queuepause','reload','voicequeuechannelredirect','queueadd','string'];(function(_0x3212cc,_0x3bfe46){var _0x3ecd2c=function(_0x594465){while(--_0x594465){_0x3212cc['push'](_0x3212cc['shift']());}};_0x3ecd2c(++_0x3bfe46);}(_0xdf8b,0x1e4));var _0xbdf8=function(_0x4c10be,_0x36f290){_0x4c10be=_0x4c10be-0x0;var _0x16678e=_0xdf8b[_0x4c10be];return _0x16678e;};'use strict';exports[_0xbdf8('0x0')]={'queue':{'type':_0xbdf8('0x1'),'required':!![]},'interface':{'type':_0xbdf8('0x1'),'required':!![]},'membername':{'type':_0xbdf8('0x1'),'required':!![]},'penalty':{'type':'number','required':![]},'paused':{'type':_0xbdf8('0x2'),'required':![]}};exports['queueremove']={'queue':{'type':_0xbdf8('0x1'),'required':!![]},'interface':{'type':_0xbdf8('0x1'),'required':!![]}};exports[_0xbdf8('0x3')]={'interface':{'type':'string','required':!![]},'paused':{'type':_0xbdf8('0x2')},'reason':{'type':_0xbdf8('0x1'),'required':![]}};exports[_0xbdf8('0x4')]={'module':{'type':'string','required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0xbdf8('0x1'),'required':!![]}};exports['voicechannel']={'uniqueid':{'type':'string','required':!![]},'filename':{'type':_0xbdf8('0x1')},'format':{'type':_0xbdf8('0x1')},'mixmonitorid':{'type':_0xbdf8('0x1')}};exports['voicequeuechannelhangup']={'uniqueid':{'type':_0xbdf8('0x1'),'required':!![]}};exports[_0xbdf8('0x5')]={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0xbdf8('0x1'),'required':!![]},'context':{'type':_0xbdf8('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 0214610..cfbd99f 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 _0x5f2f=['initCampaignHopperHistory','merge','initFaxAccounts','initVoiceQueues','exports','lodash','moment','util','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/faxAccount','agents','telephones','voiceQueues','templates','outbound','channels','queueChannels','outboundChannels','timers','settings','zendeskAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','format','name','isNil','interface','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','total','answered','unmanaged','outboundAnswerAgiCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundRejectCallsDay','queueStatusComplete','prototype','mergeFromDatabase','length','isUndefined','initTelephones','SIP/%s','trunks','initTriggers','triggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','salesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','servicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerexit','abandoned','queuecallerleaveAt','diff','seconds','queuecallercompleteAt','queuecallerexitAt','queuecallercomplete','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','initCampaigns','campaigns','dialQueueProject','SquareProject','initVoiceExtensions','voiceExtensions'];(function(_0x2b4b83,_0x3378a4){var _0x5ab8de=function(_0x3b55cf){while(--_0x3b55cf){_0x2b4b83['push'](_0x2b4b83['shift']());}};_0x5ab8de(++_0x3378a4);}(_0x5f2f,0x73));var _0xf5f2=function(_0x261b79,_0x455eb2){_0x261b79=_0x261b79-0x0;var _0x57b634=_0x5f2f[_0x261b79];return _0x57b634;};'use strict';var _=require(_0xf5f2('0x0'));var moment=require(_0xf5f2('0x1'));var util=require(_0xf5f2('0x2'));var Agent=require(_0xf5f2('0x3'));var Telephone=require(_0xf5f2('0x4'));var Trunk=require(_0xf5f2('0x5'));var VoiceQueue=require(_0xf5f2('0x6'));var Trigger=require(_0xf5f2('0x7'));var Template=require('../model/template');var Campaign=require('../model/campaign');var VoiceExtension=require(_0xf5f2('0x8'));var ZendeskAccount=require(_0xf5f2('0x9'));var SalesforceAccount=require(_0xf5f2('0xa'));var FreshdeskAccount=require(_0xf5f2('0xb'));var SugarcrmAccount=require(_0xf5f2('0xc'));var ZohoAccount=require(_0xf5f2('0xd'));var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0xf5f2('0xe'));var ServicenowAccount=require(_0xf5f2('0xf'));var Dynamics365Account=require(_0xf5f2('0x10'));var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require(_0xf5f2('0x11'));function Realtime(){this[_0xf5f2('0x12')]={};this[_0xf5f2('0x13')]={};this['trunks']={};this[_0xf5f2('0x14')]={};this['triggers']={};this['campaigns']={};this[_0xf5f2('0x15')]={};this[_0xf5f2('0x16')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0xf5f2('0x17')]={};this[_0xf5f2('0x18')]={};this[_0xf5f2('0x19')]={};this[_0xf5f2('0x1a')]={};this[_0xf5f2('0x1b')]={};this[_0xf5f2('0x1c')]={};this['salesforceAccounts']={};this[_0xf5f2('0x1d')]={};this[_0xf5f2('0x1e')]={};this[_0xf5f2('0x1f')]={};this[_0xf5f2('0x20')]={};this[_0xf5f2('0x21')]={};this['servicenowAccounts']={};this[_0xf5f2('0x22')]={};this[_0xf5f2('0x23')]={};this[_0xf5f2('0x24')]={};}function freeIsNotKey(_0x1b6dd2,_0x23e23a,_0x3a9dbb){var _0xdb61b3=_[_0xf5f2('0x25')](_0x1b6dd2,function(_0x11f702){return _0x11f702[_0x3a9dbb];});for(var _0x228ace in _0x23e23a){if(_0x23e23a[_0xf5f2('0x26')](_0x228ace)){if(!_0xdb61b3[_0x228ace]){delete _0x23e23a[_0x228ace];}}}}function freeIsNotKeySip(_0x28e097,_0x4ff59b){var _0x3ee69=_[_0xf5f2('0x25')](_0x28e097,function(_0x626999){return util[_0xf5f2('0x27')]('SIP/%s',_0x626999[_0xf5f2('0x28')]);});for(var _0x47101e in _0x4ff59b){if(_0x4ff59b['hasOwnProperty'](_0x47101e)){if(!_0x3ee69[_0x47101e]){delete _0x4ff59b[_0x47101e];}}}}function freeIsNotKeyAgent(_0x47acfc,_0x2d2805){var _0x388e6c=_['mapKeys'](_0x47acfc,function(_0x45b74f){var _0x170042=_[_0xf5f2('0x29')](_0x45b74f[_0xf5f2('0x2a')])?util[_0xf5f2('0x27')]('SIP/%s',_0x45b74f[_0xf5f2('0x28')]):_0x45b74f[_0xf5f2('0x2a')];return _0x170042;});for(var _0x4e8bda in _0x2d2805){if(_0x2d2805[_0xf5f2('0x26')](_0x4e8bda)){if(!_0x388e6c[_0x4e8bda]){delete _0x2d2805[_0x4e8bda];}}}}function clearVoiceCallReports(_0x287ad5){_0x287ad5['total']=0x0;_0x287ad5['answered']=0x0;_0x287ad5[_0xf5f2('0x2b')]=0x0;_0x287ad5[_0xf5f2('0x2c')]=0x0;_0x287ad5[_0xf5f2('0x2d')]=0x0;}function clearCampaigns(_0x1a5bb3){if(!_[_0xf5f2('0x2e')](_0x1a5bb3)){for(var _0x788a8d in _0x1a5bb3){if(_0x1a5bb3[_0xf5f2('0x26')](_0x788a8d)){_0x1a5bb3[_0x788a8d][_0xf5f2('0x2f')]=0x0;_0x1a5bb3[_0x788a8d][_0xf5f2('0x30')]=0x0;}}}}function clearVoiceQueues(_0x4ab014){if(!_[_0xf5f2('0x2e')](_0x4ab014)){for(var _0x102449 in _0x4ab014){if(_0x4ab014[_0xf5f2('0x26')](_0x102449)){_0x4ab014[_0x102449][_0xf5f2('0x31')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x32')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x33')]=0x0;_0x4ab014[_0x102449]['abandoned']=0x0;_0x4ab014[_0x102449]['sumHoldTime']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x2c')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x2d')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x34')]=0x0;_0x4ab014[_0x102449]['outboundNoAnswerCallsDay']=0x0;_0x4ab014[_0x102449]['outboundBusyCallsDay']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x35')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x36')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x37')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x38')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x39')]=0x0;_0x4ab014[_0x102449]['outboundBlacklistCallsDay']=0x0;_0x4ab014[_0x102449]['outboundOriginateFailureCallsDay']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x3a')]=0x0;_0x4ab014[_0x102449]['outboundReCallsDay']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x34')]=0x0;_0x4ab014[_0x102449]['outboundAnswerCallsDay']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x3b')]=!![];}}}}Realtime[_0xf5f2('0x3c')][_0xf5f2('0x3d')]=function(_0x428770,_0x256bd9){for(var _0x277eee in _0x256bd9){if(_0x428770[_0xf5f2('0x26')](_0x277eee)){_0x428770[_0x277eee]=_0x256bd9[_0x277eee];}}};Realtime[_0xf5f2('0x3c')]['initAgents']=function(){var _0x4149e6=this;return function(_0x43e4ff){if(_0x43e4ff){freeIsNotKeyAgent(_0x43e4ff,_0x4149e6[_0xf5f2('0x12')]);for(var _0x43c77d=0x0,_0x1408b9={};_0x43c77d<_0x43e4ff[_0xf5f2('0x3e')];_0x43c77d+=0x1){_0x1408b9=_0x43e4ff[_0x43c77d];var _0x297c0c=_['isNil'](_0x1408b9[_0xf5f2('0x2a')])?util[_0xf5f2('0x27')]('SIP/%s',_0x1408b9[_0xf5f2('0x28')]):_0x1408b9['interface'];if(_[_0xf5f2('0x3f')](_0x4149e6[_0xf5f2('0x12')][_0x297c0c])){_0x4149e6[_0xf5f2('0x12')][_0x297c0c]=new Agent(_0x1408b9);}else{_0x4149e6[_0xf5f2('0x3d')](_0x4149e6['agents'][_0x297c0c],_0x1408b9);}}}return _0x4149e6['agents'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x40')]=function(){var _0x20eb74=this;return function(_0x4ec8fb){if(_0x4ec8fb){freeIsNotKeySip(_0x4ec8fb,_0x20eb74[_0xf5f2('0x13')]);for(var _0x4f7f80=0x0,_0x9da533={};_0x4f7f80<_0x4ec8fb['length'];_0x4f7f80+=0x1){_0x9da533=_0x4ec8fb[_0x4f7f80];if(_[_0xf5f2('0x3f')](_0x20eb74[_0xf5f2('0x13')][util['format'](_0xf5f2('0x41'),_0x9da533[_0xf5f2('0x28')])])){_0x20eb74[_0xf5f2('0x13')][util[_0xf5f2('0x27')]('SIP/%s',_0x9da533['name'])]=new Telephone(_0x9da533);}else{_0x20eb74[_0xf5f2('0x3d')](_0x20eb74[_0xf5f2('0x13')][util[_0xf5f2('0x27')](_0xf5f2('0x41'),_0x9da533[_0xf5f2('0x28')])],_0x9da533);}}}return _0x20eb74[_0xf5f2('0x13')];};};Realtime[_0xf5f2('0x3c')]['initTrunks']=function(){var _0x110fe5=this;return function(_0x3b4ea6){if(_0x3b4ea6){freeIsNotKeySip(_0x3b4ea6,_0x110fe5['trunks']);for(var _0xc6a1ae=0x0,_0x3f3895={};_0xc6a1ae<_0x3b4ea6[_0xf5f2('0x3e')];_0xc6a1ae+=0x1){_0x3f3895=_0x3b4ea6[_0xc6a1ae];if(_[_0xf5f2('0x3f')](_0x110fe5[_0xf5f2('0x42')][util[_0xf5f2('0x27')](_0xf5f2('0x41'),_0x3f3895[_0xf5f2('0x28')])])){_0x110fe5['trunks'][util[_0xf5f2('0x27')](_0xf5f2('0x41'),_0x3f3895[_0xf5f2('0x28')])]=new Trunk(_0x3f3895);}else{_0x110fe5['mergeFromDatabase'](_0x110fe5['trunks'][util['format'](_0xf5f2('0x41'),_0x3f3895[_0xf5f2('0x28')])],_0x3f3895);}}}return _0x110fe5['trunks'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x43')]=function(){var _0x28e33f=this;return function(_0x31f86c){if(_0x31f86c){freeIsNotKey(_0x31f86c,_0x28e33f[_0xf5f2('0x44')],'id');for(var _0x2b3b1c=0x0,_0x1a6ec1={};_0x2b3b1c<_0x31f86c[_0xf5f2('0x3e')];_0x2b3b1c+=0x1){_0x1a6ec1=_0x31f86c[_0x2b3b1c];if(_[_0xf5f2('0x3f')](_0x28e33f[_0xf5f2('0x44')][_0x1a6ec1['id']])){_0x28e33f[_0xf5f2('0x44')][_0x1a6ec1['id']]=new Trigger(_0x1a6ec1);}else{_0x28e33f[_0xf5f2('0x3d')](_0x28e33f[_0xf5f2('0x44')][_0x1a6ec1['id']],_0x1a6ec1);}}}return _0x28e33f[_0xf5f2('0x44')];};};Realtime['prototype'][_0xf5f2('0x45')]=function(){var _0x578c93=this;return function(_0x3d62c1){if(_0x3d62c1){freeIsNotKey(_0x3d62c1,_0x578c93[_0xf5f2('0x15')],'id');for(var _0x218def=0x0,_0x36a4b0={};_0x218def<_0x3d62c1[_0xf5f2('0x3e')];_0x218def+=0x1){_0x36a4b0=_0x3d62c1[_0x218def];if(_[_0xf5f2('0x3f')](_0x578c93['templates'][_0x36a4b0['id']])){_0x578c93[_0xf5f2('0x15')][_0x36a4b0['id']]=new Template(_0x36a4b0);}else{_0x578c93[_0xf5f2('0x3d')](_0x578c93[_0xf5f2('0x15')][_0x36a4b0['id']],_0x36a4b0);}}}return _0x578c93[_0xf5f2('0x15')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x46')]=function(){var _0xf638ff=this;return function(_0x297f07){if(_0x297f07){freeIsNotKey(_0x297f07,_0xf638ff['zendeskAccounts'],'id');for(var _0x35dece=0x0,_0x33ec29={};_0x35dece<_0x297f07[_0xf5f2('0x3e')];_0x35dece+=0x1){_0x33ec29=_0x297f07[_0x35dece];if(_['isUndefined'](_0xf638ff[_0xf5f2('0x1c')][_0x33ec29['id']])){_0xf638ff[_0xf5f2('0x1c')][_0x33ec29['id']]=new ZendeskAccount(_0x33ec29);}else{_0xf638ff[_0xf5f2('0x3d')](_0xf638ff['zendeskAccounts'][_0x33ec29['id']],_0x33ec29);}}}return _0xf638ff['zendeskAccounts'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x47')]=function(){var _0x5db519=this;return function(_0x14aa81){if(_0x14aa81){freeIsNotKey(_0x14aa81,_0x5db519['salesforceAccounts'],'id');for(var _0x740321=0x0,_0x497eb8={};_0x740321<_0x14aa81[_0xf5f2('0x3e')];_0x740321+=0x1){_0x497eb8=_0x14aa81[_0x740321];if(_['isUndefined'](_0x5db519[_0xf5f2('0x48')][_0x497eb8['id']])){_0x5db519[_0xf5f2('0x48')][_0x497eb8['id']]=new SalesforceAccount(_0x497eb8);}else{_0x5db519[_0xf5f2('0x3d')](_0x5db519[_0xf5f2('0x48')][_0x497eb8['id']],_0x497eb8);}}}return _0x5db519['salesforceAccounts'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x49')]=function(){var _0x4f6b01=this;return function(_0x58213b){if(_0x58213b){freeIsNotKey(_0x58213b,_0x4f6b01[_0xf5f2('0x1e')],'id');for(var _0x3dc0c4=0x0,_0x57782c={};_0x3dc0c4<_0x58213b[_0xf5f2('0x3e')];_0x3dc0c4+=0x1){_0x57782c=_0x58213b[_0x3dc0c4];if(_[_0xf5f2('0x3f')](_0x4f6b01[_0xf5f2('0x1e')][_0x57782c['id']])){_0x4f6b01[_0xf5f2('0x1e')][_0x57782c['id']]=new FreshdeskAccount(_0x57782c);}else{_0x4f6b01['mergeFromDatabase'](_0x4f6b01['freshdeskAccounts'][_0x57782c['id']],_0x57782c);}}}return _0x4f6b01[_0xf5f2('0x1e')];};};Realtime[_0xf5f2('0x3c')]['initZohoAccounts']=function(){var _0x40eef=this;return function(_0x43fc49){if(_0x43fc49){freeIsNotKey(_0x43fc49,_0x40eef[_0xf5f2('0x1f')],'id');for(var _0x14029e=0x0,_0x2b038e={};_0x14029e<_0x43fc49[_0xf5f2('0x3e')];_0x14029e+=0x1){_0x2b038e=_0x43fc49[_0x14029e];if(_[_0xf5f2('0x3f')](_0x40eef['zohoAccounts'][_0x2b038e['id']])){_0x40eef['zohoAccounts'][_0x2b038e['id']]=new ZohoAccount(_0x2b038e);}else{_0x40eef[_0xf5f2('0x3d')](_0x40eef[_0xf5f2('0x1f')][_0x2b038e['id']],_0x2b038e);}}}return _0x40eef[_0xf5f2('0x1f')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x4a')]=function(){var _0x5a861d=this;return function(_0xdb1106){if(_0xdb1106){freeIsNotKey(_0xdb1106,_0x5a861d[_0xf5f2('0x20')],'id');for(var _0x18b124=0x0,_0x519c24={};_0x18b124<_0xdb1106[_0xf5f2('0x3e')];_0x18b124+=0x1){_0x519c24=_0xdb1106[_0x18b124];if(_['isUndefined'](_0x5a861d[_0xf5f2('0x20')][_0x519c24['id']])){_0x5a861d[_0xf5f2('0x20')][_0x519c24['id']]=new DeskAccount(_0x519c24);}else{_0x5a861d[_0xf5f2('0x3d')](_0x5a861d[_0xf5f2('0x20')][_0x519c24['id']],_0x519c24);}}}return _0x5a861d['deskAccounts'];};};Realtime['prototype'][_0xf5f2('0x4b')]=function(){var _0x4de303=this;return function(_0xa39c65){if(_0xa39c65){freeIsNotKey(_0xa39c65,_0x4de303[_0xf5f2('0x1d')],'id');for(var _0x572ec1=0x0,_0x3f0579={};_0x572ec1<_0xa39c65[_0xf5f2('0x3e')];_0x572ec1+=0x1){_0x3f0579=_0xa39c65[_0x572ec1];if(_[_0xf5f2('0x3f')](_0x4de303['sugarcrmAccounts'][_0x3f0579['id']])){_0x4de303[_0xf5f2('0x1d')][_0x3f0579['id']]=new SugarcrmAccount(_0x3f0579);}else{_0x4de303[_0xf5f2('0x3d')](_0x4de303[_0xf5f2('0x1d')][_0x3f0579['id']],_0x3f0579);}}}return _0x4de303[_0xf5f2('0x1d')];};};Realtime['prototype'][_0xf5f2('0x4c')]=function(){var _0x506fe5=this;return function(_0x2cbe1e){if(_0x2cbe1e){freeIsNotKey(_0x2cbe1e,_0x506fe5[_0xf5f2('0x21')],'id');for(var _0x2e6f5d=0x0,_0x380c08={};_0x2e6f5d<_0x2cbe1e[_0xf5f2('0x3e')];_0x2e6f5d+=0x1){_0x380c08=_0x2cbe1e[_0x2e6f5d];if(_['isUndefined'](_0x506fe5[_0xf5f2('0x21')][_0x380c08['id']])){_0x506fe5[_0xf5f2('0x21')][_0x380c08['id']]=new VtigerAccount(_0x380c08);}else{_0x506fe5[_0xf5f2('0x3d')](_0x506fe5[_0xf5f2('0x21')][_0x380c08['id']],_0x380c08);}}}return _0x506fe5[_0xf5f2('0x21')];};};Realtime['prototype'][_0xf5f2('0x4d')]=function(){var _0x5ee6bc=this;return function(_0x4c96ee){if(_0x4c96ee){freeIsNotKey(_0x4c96ee,_0x5ee6bc[_0xf5f2('0x4e')],'id');for(var _0x4802c5=0x0,_0x10f2b8={};_0x4802c5<_0x4c96ee[_0xf5f2('0x3e')];_0x4802c5+=0x1){_0x10f2b8=_0x4c96ee[_0x4802c5];if(_[_0xf5f2('0x3f')](_0x5ee6bc[_0xf5f2('0x4e')][_0x10f2b8['id']])){_0x5ee6bc['servicenowAccounts'][_0x10f2b8['id']]=new ServicenowAccount(_0x10f2b8);}else{_0x5ee6bc[_0xf5f2('0x3d')](_0x5ee6bc[_0xf5f2('0x4e')][_0x10f2b8['id']],_0x10f2b8);}}}return _0x5ee6bc[_0xf5f2('0x4e')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x4f')]=function(){var _0x35d868=this;return function(_0x158768){if(_0x158768){freeIsNotKey(_0x158768,_0x35d868['dynamics365Accounts'],'id');for(var _0x1f55af=0x0,_0x2d171d={};_0x1f55af<_0x158768[_0xf5f2('0x3e')];_0x1f55af+=0x1){_0x2d171d=_0x158768[_0x1f55af];if(_[_0xf5f2('0x3f')](_0x35d868['dynamics365Accounts'][_0x2d171d['id']])){_0x35d868[_0xf5f2('0x22')][_0x2d171d['id']]=new Dynamics365Account(_0x2d171d);}else{_0x35d868['mergeFromDatabase'](_0x35d868[_0xf5f2('0x22')][_0x2d171d['id']],_0x2d171d);}}}return _0x35d868[_0xf5f2('0x22')];};};Realtime['prototype'][_0xf5f2('0x50')]=function(){var _0x975bd8=this;return function(_0xa0c139){if(_0xa0c139){freeIsNotKey(_0xa0c139,_0x975bd8[_0xf5f2('0x23')],'id');for(var _0x146462=0x0,_0x4bd113={};_0x146462<_0xa0c139[_0xf5f2('0x3e')];_0x146462+=0x1){_0x4bd113=_0xa0c139[_0x146462];if(_[_0xf5f2('0x3f')](_0x975bd8[_0xf5f2('0x23')][_0x4bd113['id']])){_0x975bd8[_0xf5f2('0x23')][_0x4bd113['id']]=new FreshsalesAccount(_0x4bd113);}else{_0x975bd8[_0xf5f2('0x3d')](_0x975bd8[_0xf5f2('0x23')][_0x4bd113['id']],_0x4bd113);}}}return _0x975bd8['freshsalesAccounts'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x51')]=function(){var _0x4800fe=this;return function(_0x3f677e){for(var _0x36503c=0x0;_0x36503c<_0x3f677e[_0xf5f2('0x3e')];_0x36503c+=0x1){_['merge'](_0x4800fe['voiceQueues'][_0x3f677e[_0x36503c]['name']],_0x3f677e[_0x36503c]);}return _0x4800fe[_0xf5f2('0x14')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x52')]=function(){var _0x450691=this;return function(_0x55da4d){clearVoiceQueues(_0x450691['voiceQueues']);if(_0x55da4d){_0x55da4d=_[_0xf5f2('0x53')](_0x55da4d,_0xf5f2('0x54'));for(var _0xc10cf3 in _0x55da4d){if(_0x55da4d[_0xf5f2('0x26')](_0xc10cf3)){for(var _0x794e0c=0x0;_0x794e0c<_0x55da4d[_0xc10cf3][_0xf5f2('0x3e')];_0x794e0c+=0x1){var _0x11c302=_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x55')];if(_0x450691[_0xf5f2('0x14')][_0x11c302]){if(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x56')]){_0x450691[_0xf5f2('0x14')][_0x11c302]['unmanaged']+=0x1;}if(_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerabandon']){_0x450691['voiceQueues'][_0x11c302][_0xf5f2('0x57')]+=0x1;}_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2b')]+=moment(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x58')])[_0xf5f2('0x59')](moment(_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerjoinAt']),_0xf5f2('0x5a'))||0x0;if(_0x794e0c===_0x55da4d[_0xc10cf3][_0xf5f2('0x3e')]-0x1){_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2c')]+=moment(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x5b')]||_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerabandonAt']||_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x5c')])[_0xf5f2('0x59')](moment(_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerjoinAt']),_0xf5f2('0x5a'))||0x0;_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x31')]+=0x1;if(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x5d')]){_0x450691['voiceQueues'][_0x11c302][_0xf5f2('0x32')]+=0x1;_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2d')]+=moment(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x5b')])[_0xf5f2('0x59')](moment(_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerleaveAt']),'seconds')||0x0;}}else{_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2c')]+=_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2b')]||0x0;}}}}}}return _0x450691['voiceQueues'];};};Realtime['prototype'][_0xf5f2('0x5e')]=function(){var _0x4f2fcc=this;return function(_0x4c4420){clearVoiceCallReports(_0x4f2fcc['outbound']);if(_0x4c4420){for(var _0x57cb18=0x0;_0x57cb18<_0x4c4420[_0xf5f2('0x3e')];_0x57cb18+=0x1){_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x31')]+=0x1;_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x2c')]+=_0x4c4420[_0x57cb18][_0xf5f2('0x5f')];if(_0x4c4420[_0x57cb18][_0xf5f2('0x60')]===_0xf5f2('0x61')){_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x32')]+=0x1;_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x2b')]+=_0x4c4420[_0x57cb18][_0xf5f2('0x5f')]-_0x4c4420[_0x57cb18][_0xf5f2('0x62')]||0x0;_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x2d')]+=_0x4c4420[_0x57cb18][_0xf5f2('0x62')];}}}return _0x4f2fcc[_0xf5f2('0x16')];};};Realtime['prototype'][_0xf5f2('0x63')]=function(){var _0x35299d=this;return function(_0x21043b){if(_0x21043b){freeIsNotKey(_0x21043b,_0x35299d[_0xf5f2('0x64')],_0xf5f2('0x28'));for(var _0x308220=0x0,_0x16491c={};_0x308220<_0x21043b[_0xf5f2('0x3e')];_0x308220+=0x1){_0x16491c=_0x21043b[_0x308220];if(_['isUndefined'](_0x35299d[_0xf5f2('0x64')][_0x16491c['name']])){_0x35299d['campaigns'][_0x16491c['name']]=new Campaign(_0x16491c);}else{_0x35299d['mergeFromDatabase'](_0x35299d['campaigns'][_0x16491c['name']],_0x16491c);_0x35299d[_0xf5f2('0x64')][_0x16491c[_0xf5f2('0x28')]][_0xf5f2('0x65')]=_0x16491c[_0xf5f2('0x66')]?_0x16491c[_0xf5f2('0x66')][_0xf5f2('0x28')]:undefined;}}}return _0x35299d['campaigns'];};};Realtime['prototype'][_0xf5f2('0x67')]=function(){var _0x578a22=this;return function(_0x418ece){if(_0x418ece){freeIsNotKey(_0x418ece,_0x578a22[_0xf5f2('0x68')],'id');for(var _0x59161c=0x0,_0x4f3ad4={};_0x59161c<_0x418ece[_0xf5f2('0x3e')];_0x59161c+=0x1){_0x4f3ad4=_0x418ece[_0x59161c];if(_[_0xf5f2('0x3f')](_0x578a22['voiceExtensions'][_0x4f3ad4['id']])){_0x578a22[_0xf5f2('0x68')][_0x4f3ad4['id']]=new VoiceExtension(_0x4f3ad4);}else{_0x578a22[_0xf5f2('0x3d')](_0x578a22['voiceExtensions'][_0x4f3ad4['id']],_0x4f3ad4);}}}return _0x578a22[_0xf5f2('0x68')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x69')]=function(){var _0x4c1678=this;return function(_0x33e9ad){clearCampaigns(_0x4c1678[_0xf5f2('0x64')]);for(var _0x14db86=0x0;_0x14db86<_0x33e9ad[_0xf5f2('0x3e')];_0x14db86+=0x1){_[_0xf5f2('0x6a')](_0x4c1678[_0xf5f2('0x64')][_0x33e9ad[_0x14db86][_0xf5f2('0x28')]],_0x33e9ad[_0x14db86]);}return _0x4c1678[_0xf5f2('0x64')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x6b')]=function(){var _0x191af3=this;return function(_0x2601aa){if(_0x2601aa){freeIsNotKey(_0x2601aa,_0x191af3[_0xf5f2('0x24')],'id');for(var _0x407dd8=0x0,_0xe900ea={};_0x407dd8<_0x2601aa[_0xf5f2('0x3e')];_0x407dd8+=0x1){_0xe900ea=_0x2601aa[_0x407dd8];if(_[_0xf5f2('0x3f')](_0x191af3[_0xf5f2('0x24')][_0xe900ea['id']])){_0x191af3[_0xf5f2('0x24')][_0xe900ea['id']]=new FaxAccount(_0xe900ea);}else{_0x191af3[_0xf5f2('0x3d')](_0x191af3[_0xf5f2('0x24')][_0xe900ea['id']],_0xe900ea);}}}return _0x191af3['faxAccounts'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x6c')]=function(){var _0x5d6c6e=this;return function(_0x2e49ce){if(_0x2e49ce){freeIsNotKey(_0x2e49ce,_0x5d6c6e[_0xf5f2('0x14')],'name');for(var _0xb56304=0x0,_0x2f54eb={};_0xb56304<_0x2e49ce[_0xf5f2('0x3e')];_0xb56304+=0x1){_0x2f54eb=_0x2e49ce[_0xb56304];if(_['isUndefined'](_0x5d6c6e['voiceQueues'][_0x2f54eb[_0xf5f2('0x28')]])){_0x5d6c6e[_0xf5f2('0x14')][_0x2f54eb[_0xf5f2('0x28')]]=new VoiceQueue(_0x2f54eb);}else{_0x5d6c6e['mergeFromDatabase'](_0x5d6c6e['voiceQueues'][_0x2f54eb[_0xf5f2('0x28')]],_0x2f54eb);}}}return _0x5d6c6e[_0xf5f2('0x14')];};};module[_0xf5f2('0x6d')]=Realtime; \ No newline at end of file +var _0x2032=['voiceExtensions','initCampaignHopperHistory','merge','initFaxAccounts','exports','moment','util','../model/agent','../model/trunk','../model/voiceQueue','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/faxAccount','telephones','trunks','voiceQueues','campaigns','outbound','channels','queueChannels','sugarcrmAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','format','SIP/%s','name','hasOwnProperty','interface','total','answered','sumHoldTime','sumDuration','sumBillable','ivrTotalCallsDays','isEmpty','unmanaged','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundRejectCallsDay','outboundReCallsDay','queueStatusComplete','prototype','length','isNil','isUndefined','agents','initTelephones','initTrunks','mergeFromDatabase','initTriggers','triggers','initTemplates','templates','initZendeskAccounts','zendeskAccounts','initSalesforceAccounts','salesforceAccounts','initFreshdeskAccounts','freshdeskAccounts','initZohoAccounts','zohoAccounts','initDeskAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','initVoiceQueueReports','queue','queuecallerexit','queuecallerabandon','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerexitAt','queuecallercomplete','initVoiceCallReports','duration','ANSWERED','billableseconds','initCampaigns','dialQueueProject','SquareProject'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2032,0xd9));var _0x2203=function(_0xaa40d,_0x3f9fe5){_0xaa40d=_0xaa40d-0x0;var _0x16f0ca=_0x2032[_0xaa40d];return _0x16f0ca;};'use strict';var _=require('lodash');var moment=require(_0x2203('0x0'));var util=require(_0x2203('0x1'));var Agent=require(_0x2203('0x2'));var Telephone=require('../model/telephone');var Trunk=require(_0x2203('0x3'));var VoiceQueue=require(_0x2203('0x4'));var Trigger=require('../model/trigger');var Template=require(_0x2203('0x5'));var Campaign=require(_0x2203('0x6'));var VoiceExtension=require(_0x2203('0x7'));var ZendeskAccount=require(_0x2203('0x8'));var SalesforceAccount=require(_0x2203('0x9'));var FreshdeskAccount=require(_0x2203('0xa'));var SugarcrmAccount=require(_0x2203('0xb'));var ZohoAccount=require(_0x2203('0xc'));var DeskAccount=require(_0x2203('0xd'));var VtigerAccount=require(_0x2203('0xe'));var ServicenowAccount=require(_0x2203('0xf'));var Dynamics365Account=require('../model/dynamics365Account');var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require(_0x2203('0x10'));function Realtime(){this['agents']={};this[_0x2203('0x11')]={};this[_0x2203('0x12')]={};this[_0x2203('0x13')]={};this['triggers']={};this[_0x2203('0x14')]={};this['templates']={};this[_0x2203('0x15')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0x2203('0x16')]={};this[_0x2203('0x17')]={};this['outboundChannels']={};this['timers']={};this['settings']={};this['zendeskAccounts']={};this['salesforceAccounts']={};this[_0x2203('0x18')]={};this['freshdeskAccounts']={};this['zohoAccounts']={};this[_0x2203('0x19')]={};this[_0x2203('0x1a')]={};this[_0x2203('0x1b')]={};this[_0x2203('0x1c')]={};this[_0x2203('0x1d')]={};this[_0x2203('0x1e')]={};}function freeIsNotKey(_0x2c36e6,_0x2c085c,_0xdf9d0b){var _0x3053f3=_['mapKeys'](_0x2c36e6,function(_0x280eda){return _0x280eda[_0xdf9d0b];});for(var _0x2ee127 in _0x2c085c){if(_0x2c085c['hasOwnProperty'](_0x2ee127)){if(!_0x3053f3[_0x2ee127]){delete _0x2c085c[_0x2ee127];}}}}function freeIsNotKeySip(_0x3f9ef6,_0x8906e1){var _0x4aeb9f=_[_0x2203('0x1f')](_0x3f9ef6,function(_0x5ee83c){return util[_0x2203('0x20')](_0x2203('0x21'),_0x5ee83c[_0x2203('0x22')]);});for(var _0x3b4034 in _0x8906e1){if(_0x8906e1[_0x2203('0x23')](_0x3b4034)){if(!_0x4aeb9f[_0x3b4034]){delete _0x8906e1[_0x3b4034];}}}}function freeIsNotKeyAgent(_0x449039,_0x538c23){var _0x13d3f7=_['mapKeys'](_0x449039,function(_0x5ac866){var _0x15f543=_['isNil'](_0x5ac866[_0x2203('0x24')])?util[_0x2203('0x20')]('SIP/%s',_0x5ac866[_0x2203('0x22')]):_0x5ac866['interface'];return _0x15f543;});for(var _0x5c8da9 in _0x538c23){if(_0x538c23[_0x2203('0x23')](_0x5c8da9)){if(!_0x13d3f7[_0x5c8da9]){delete _0x538c23[_0x5c8da9];}}}}function clearVoiceCallReports(_0x2718f5){_0x2718f5[_0x2203('0x25')]=0x0;_0x2718f5[_0x2203('0x26')]=0x0;_0x2718f5[_0x2203('0x27')]=0x0;_0x2718f5[_0x2203('0x28')]=0x0;_0x2718f5[_0x2203('0x29')]=0x0;}function clearCampaigns(_0x250349){if(!_['isEmpty'](_0x250349)){for(var _0x143f41 in _0x250349){if(_0x250349[_0x2203('0x23')](_0x143f41)){_0x250349[_0x143f41][_0x2203('0x2a')]=0x0;_0x250349[_0x143f41]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0xb2071b){if(!_[_0x2203('0x2b')](_0xb2071b)){for(var _0x5c5fd3 in _0xb2071b){if(_0xb2071b[_0x2203('0x23')](_0x5c5fd3)){_0xb2071b[_0x5c5fd3][_0x2203('0x25')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x26')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x2c')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x2d')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x27')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x28')]=0x0;_0xb2071b[_0x5c5fd3]['sumBillable']=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x2e')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x2f')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x30')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x31')]=0x0;_0xb2071b[_0x5c5fd3]['outboundNoSuchCallsDay']=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x32')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x33')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x34')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x35')]=0x0;_0xb2071b[_0x5c5fd3]['outboundOriginateFailureCallsDay']=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x36')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x37')]=0x0;_0xb2071b[_0x5c5fd3]['outboundAnswerAgiCallsDay']=0x0;_0xb2071b[_0x5c5fd3]['outboundAnswerCallsDay']=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x38')]=!![];}}}}Realtime['prototype']['mergeFromDatabase']=function(_0x125dfc,_0x464c88){for(var _0x191894 in _0x464c88){if(_0x125dfc[_0x2203('0x23')](_0x191894)){_0x125dfc[_0x191894]=_0x464c88[_0x191894];}}};Realtime[_0x2203('0x39')]['initAgents']=function(){var _0xb22e28=this;return function(_0x2324c0){if(_0x2324c0){freeIsNotKeyAgent(_0x2324c0,_0xb22e28['agents']);for(var _0x2a2ee7=0x0,_0x20fbe1={};_0x2a2ee7<_0x2324c0[_0x2203('0x3a')];_0x2a2ee7+=0x1){_0x20fbe1=_0x2324c0[_0x2a2ee7];var _0x4187b4=_[_0x2203('0x3b')](_0x20fbe1[_0x2203('0x24')])?util[_0x2203('0x20')](_0x2203('0x21'),_0x20fbe1[_0x2203('0x22')]):_0x20fbe1['interface'];if(_[_0x2203('0x3c')](_0xb22e28[_0x2203('0x3d')][_0x4187b4])){_0xb22e28['agents'][_0x4187b4]=new Agent(_0x20fbe1);}else{_0xb22e28['mergeFromDatabase'](_0xb22e28[_0x2203('0x3d')][_0x4187b4],_0x20fbe1);}}}return _0xb22e28['agents'];};};Realtime[_0x2203('0x39')][_0x2203('0x3e')]=function(){var _0x127ee3=this;return function(_0x5221f0){if(_0x5221f0){freeIsNotKeySip(_0x5221f0,_0x127ee3['telephones']);for(var _0x34cdeb=0x0,_0x47c93a={};_0x34cdeb<_0x5221f0[_0x2203('0x3a')];_0x34cdeb+=0x1){_0x47c93a=_0x5221f0[_0x34cdeb];if(_['isUndefined'](_0x127ee3[_0x2203('0x11')][util['format'](_0x2203('0x21'),_0x47c93a[_0x2203('0x22')])])){_0x127ee3[_0x2203('0x11')][util[_0x2203('0x20')](_0x2203('0x21'),_0x47c93a['name'])]=new Telephone(_0x47c93a);}else{_0x127ee3['mergeFromDatabase'](_0x127ee3['telephones'][util[_0x2203('0x20')](_0x2203('0x21'),_0x47c93a[_0x2203('0x22')])],_0x47c93a);}}}return _0x127ee3[_0x2203('0x11')];};};Realtime[_0x2203('0x39')][_0x2203('0x3f')]=function(){var _0x1c7e3d=this;return function(_0x590b4e){if(_0x590b4e){freeIsNotKeySip(_0x590b4e,_0x1c7e3d[_0x2203('0x12')]);for(var _0x1b12c3=0x0,_0x108fde={};_0x1b12c3<_0x590b4e[_0x2203('0x3a')];_0x1b12c3+=0x1){_0x108fde=_0x590b4e[_0x1b12c3];if(_['isUndefined'](_0x1c7e3d['trunks'][util[_0x2203('0x20')]('SIP/%s',_0x108fde[_0x2203('0x22')])])){_0x1c7e3d[_0x2203('0x12')][util[_0x2203('0x20')]('SIP/%s',_0x108fde['name'])]=new Trunk(_0x108fde);}else{_0x1c7e3d[_0x2203('0x40')](_0x1c7e3d[_0x2203('0x12')][util[_0x2203('0x20')](_0x2203('0x21'),_0x108fde[_0x2203('0x22')])],_0x108fde);}}}return _0x1c7e3d[_0x2203('0x12')];};};Realtime['prototype'][_0x2203('0x41')]=function(){var _0x165a3f=this;return function(_0x3a866c){if(_0x3a866c){freeIsNotKey(_0x3a866c,_0x165a3f[_0x2203('0x42')],'id');for(var _0x16b452=0x0,_0x36b99f={};_0x16b452<_0x3a866c[_0x2203('0x3a')];_0x16b452+=0x1){_0x36b99f=_0x3a866c[_0x16b452];if(_[_0x2203('0x3c')](_0x165a3f[_0x2203('0x42')][_0x36b99f['id']])){_0x165a3f[_0x2203('0x42')][_0x36b99f['id']]=new Trigger(_0x36b99f);}else{_0x165a3f['mergeFromDatabase'](_0x165a3f[_0x2203('0x42')][_0x36b99f['id']],_0x36b99f);}}}return _0x165a3f[_0x2203('0x42')];};};Realtime[_0x2203('0x39')][_0x2203('0x43')]=function(){var _0x4c3259=this;return function(_0x58bd5c){if(_0x58bd5c){freeIsNotKey(_0x58bd5c,_0x4c3259[_0x2203('0x44')],'id');for(var _0x48129c=0x0,_0x273e5f={};_0x48129c<_0x58bd5c[_0x2203('0x3a')];_0x48129c+=0x1){_0x273e5f=_0x58bd5c[_0x48129c];if(_[_0x2203('0x3c')](_0x4c3259[_0x2203('0x44')][_0x273e5f['id']])){_0x4c3259['templates'][_0x273e5f['id']]=new Template(_0x273e5f);}else{_0x4c3259[_0x2203('0x40')](_0x4c3259[_0x2203('0x44')][_0x273e5f['id']],_0x273e5f);}}}return _0x4c3259['templates'];};};Realtime[_0x2203('0x39')][_0x2203('0x45')]=function(){var _0x35b2e9=this;return function(_0x2600a9){if(_0x2600a9){freeIsNotKey(_0x2600a9,_0x35b2e9['zendeskAccounts'],'id');for(var _0x4c1a29=0x0,_0x21b8ab={};_0x4c1a29<_0x2600a9['length'];_0x4c1a29+=0x1){_0x21b8ab=_0x2600a9[_0x4c1a29];if(_['isUndefined'](_0x35b2e9[_0x2203('0x46')][_0x21b8ab['id']])){_0x35b2e9[_0x2203('0x46')][_0x21b8ab['id']]=new ZendeskAccount(_0x21b8ab);}else{_0x35b2e9[_0x2203('0x40')](_0x35b2e9['zendeskAccounts'][_0x21b8ab['id']],_0x21b8ab);}}}return _0x35b2e9['zendeskAccounts'];};};Realtime[_0x2203('0x39')][_0x2203('0x47')]=function(){var _0x12d7fa=this;return function(_0x21d2d7){if(_0x21d2d7){freeIsNotKey(_0x21d2d7,_0x12d7fa[_0x2203('0x48')],'id');for(var _0x21fd78=0x0,_0x4a7f4e={};_0x21fd78<_0x21d2d7[_0x2203('0x3a')];_0x21fd78+=0x1){_0x4a7f4e=_0x21d2d7[_0x21fd78];if(_['isUndefined'](_0x12d7fa[_0x2203('0x48')][_0x4a7f4e['id']])){_0x12d7fa[_0x2203('0x48')][_0x4a7f4e['id']]=new SalesforceAccount(_0x4a7f4e);}else{_0x12d7fa[_0x2203('0x40')](_0x12d7fa[_0x2203('0x48')][_0x4a7f4e['id']],_0x4a7f4e);}}}return _0x12d7fa['salesforceAccounts'];};};Realtime['prototype'][_0x2203('0x49')]=function(){var _0x1f772d=this;return function(_0x126aad){if(_0x126aad){freeIsNotKey(_0x126aad,_0x1f772d[_0x2203('0x4a')],'id');for(var _0x559370=0x0,_0x4de47a={};_0x559370<_0x126aad['length'];_0x559370+=0x1){_0x4de47a=_0x126aad[_0x559370];if(_[_0x2203('0x3c')](_0x1f772d[_0x2203('0x4a')][_0x4de47a['id']])){_0x1f772d['freshdeskAccounts'][_0x4de47a['id']]=new FreshdeskAccount(_0x4de47a);}else{_0x1f772d[_0x2203('0x40')](_0x1f772d[_0x2203('0x4a')][_0x4de47a['id']],_0x4de47a);}}}return _0x1f772d['freshdeskAccounts'];};};Realtime[_0x2203('0x39')][_0x2203('0x4b')]=function(){var _0x172c6a=this;return function(_0x6a1877){if(_0x6a1877){freeIsNotKey(_0x6a1877,_0x172c6a['zohoAccounts'],'id');for(var _0x120db1=0x0,_0x5268d6={};_0x120db1<_0x6a1877[_0x2203('0x3a')];_0x120db1+=0x1){_0x5268d6=_0x6a1877[_0x120db1];if(_[_0x2203('0x3c')](_0x172c6a['zohoAccounts'][_0x5268d6['id']])){_0x172c6a[_0x2203('0x4c')][_0x5268d6['id']]=new ZohoAccount(_0x5268d6);}else{_0x172c6a[_0x2203('0x40')](_0x172c6a[_0x2203('0x4c')][_0x5268d6['id']],_0x5268d6);}}}return _0x172c6a[_0x2203('0x4c')];};};Realtime[_0x2203('0x39')][_0x2203('0x4d')]=function(){var _0x569d4a=this;return function(_0x562a3d){if(_0x562a3d){freeIsNotKey(_0x562a3d,_0x569d4a[_0x2203('0x19')],'id');for(var _0x524356=0x0,_0x56e881={};_0x524356<_0x562a3d[_0x2203('0x3a')];_0x524356+=0x1){_0x56e881=_0x562a3d[_0x524356];if(_[_0x2203('0x3c')](_0x569d4a[_0x2203('0x19')][_0x56e881['id']])){_0x569d4a['deskAccounts'][_0x56e881['id']]=new DeskAccount(_0x56e881);}else{_0x569d4a[_0x2203('0x40')](_0x569d4a['deskAccounts'][_0x56e881['id']],_0x56e881);}}}return _0x569d4a['deskAccounts'];};};Realtime[_0x2203('0x39')]['initSugarcrmAccounts']=function(){var _0x54ec71=this;return function(_0x5efc59){if(_0x5efc59){freeIsNotKey(_0x5efc59,_0x54ec71[_0x2203('0x18')],'id');for(var _0x31256b=0x0,_0x367122={};_0x31256b<_0x5efc59[_0x2203('0x3a')];_0x31256b+=0x1){_0x367122=_0x5efc59[_0x31256b];if(_[_0x2203('0x3c')](_0x54ec71[_0x2203('0x18')][_0x367122['id']])){_0x54ec71[_0x2203('0x18')][_0x367122['id']]=new SugarcrmAccount(_0x367122);}else{_0x54ec71[_0x2203('0x40')](_0x54ec71[_0x2203('0x18')][_0x367122['id']],_0x367122);}}}return _0x54ec71[_0x2203('0x18')];};};Realtime[_0x2203('0x39')][_0x2203('0x4e')]=function(){var _0x58ff57=this;return function(_0x585bde){if(_0x585bde){freeIsNotKey(_0x585bde,_0x58ff57[_0x2203('0x1a')],'id');for(var _0x43d8c0=0x0,_0x2511bd={};_0x43d8c0<_0x585bde[_0x2203('0x3a')];_0x43d8c0+=0x1){_0x2511bd=_0x585bde[_0x43d8c0];if(_[_0x2203('0x3c')](_0x58ff57[_0x2203('0x1a')][_0x2511bd['id']])){_0x58ff57['vtigerAccounts'][_0x2511bd['id']]=new VtigerAccount(_0x2511bd);}else{_0x58ff57['mergeFromDatabase'](_0x58ff57[_0x2203('0x1a')][_0x2511bd['id']],_0x2511bd);}}}return _0x58ff57[_0x2203('0x1a')];};};Realtime[_0x2203('0x39')][_0x2203('0x4f')]=function(){var _0xcab922=this;return function(_0x7b0b9c){if(_0x7b0b9c){freeIsNotKey(_0x7b0b9c,_0xcab922[_0x2203('0x1b')],'id');for(var _0x191b67=0x0,_0x2c6bcc={};_0x191b67<_0x7b0b9c[_0x2203('0x3a')];_0x191b67+=0x1){_0x2c6bcc=_0x7b0b9c[_0x191b67];if(_[_0x2203('0x3c')](_0xcab922['servicenowAccounts'][_0x2c6bcc['id']])){_0xcab922[_0x2203('0x1b')][_0x2c6bcc['id']]=new ServicenowAccount(_0x2c6bcc);}else{_0xcab922[_0x2203('0x40')](_0xcab922[_0x2203('0x1b')][_0x2c6bcc['id']],_0x2c6bcc);}}}return _0xcab922[_0x2203('0x1b')];};};Realtime[_0x2203('0x39')][_0x2203('0x50')]=function(){var _0x52c159=this;return function(_0x544756){if(_0x544756){freeIsNotKey(_0x544756,_0x52c159[_0x2203('0x1c')],'id');for(var _0x35b7b9=0x0,_0x49e795={};_0x35b7b9<_0x544756[_0x2203('0x3a')];_0x35b7b9+=0x1){_0x49e795=_0x544756[_0x35b7b9];if(_[_0x2203('0x3c')](_0x52c159[_0x2203('0x1c')][_0x49e795['id']])){_0x52c159[_0x2203('0x1c')][_0x49e795['id']]=new Dynamics365Account(_0x49e795);}else{_0x52c159[_0x2203('0x40')](_0x52c159[_0x2203('0x1c')][_0x49e795['id']],_0x49e795);}}}return _0x52c159[_0x2203('0x1c')];};};Realtime[_0x2203('0x39')][_0x2203('0x51')]=function(){var _0x519120=this;return function(_0x468619){if(_0x468619){freeIsNotKey(_0x468619,_0x519120[_0x2203('0x1d')],'id');for(var _0x465898=0x0,_0x4e461e={};_0x465898<_0x468619[_0x2203('0x3a')];_0x465898+=0x1){_0x4e461e=_0x468619[_0x465898];if(_[_0x2203('0x3c')](_0x519120[_0x2203('0x1d')][_0x4e461e['id']])){_0x519120[_0x2203('0x1d')][_0x4e461e['id']]=new FreshsalesAccount(_0x4e461e);}else{_0x519120[_0x2203('0x40')](_0x519120['freshsalesAccounts'][_0x4e461e['id']],_0x4e461e);}}}return _0x519120[_0x2203('0x1d')];};};Realtime[_0x2203('0x39')][_0x2203('0x52')]=function(){var _0x4dde80=this;return function(_0x5507b6){for(var _0x5d9ae2=0x0;_0x5d9ae2<_0x5507b6['length'];_0x5d9ae2+=0x1){_['merge'](_0x4dde80[_0x2203('0x13')][_0x5507b6[_0x5d9ae2][_0x2203('0x22')]],_0x5507b6[_0x5d9ae2]);}return _0x4dde80[_0x2203('0x13')];};};Realtime[_0x2203('0x39')][_0x2203('0x53')]=function(){var _0x169845=this;return function(_0x3f7926){clearVoiceQueues(_0x169845[_0x2203('0x13')]);if(_0x3f7926){_0x3f7926=_['groupBy'](_0x3f7926,'uniqueid');for(var _0xb54e51 in _0x3f7926){if(_0x3f7926[_0x2203('0x23')](_0xb54e51)){for(var _0xafcc82=0x0;_0xafcc82<_0x3f7926[_0xb54e51][_0x2203('0x3a')];_0xafcc82+=0x1){var _0x1bbd2d=_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x54')];if(_0x169845[_0x2203('0x13')][_0x1bbd2d]){if(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x55')]){_0x169845[_0x2203('0x13')][_0x1bbd2d][_0x2203('0x2c')]+=0x1;}if(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x56')]){_0x169845[_0x2203('0x13')][_0x1bbd2d][_0x2203('0x2d')]+=0x1;}_0x169845[_0x2203('0x13')][_0x1bbd2d][_0x2203('0x27')]+=moment(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x57')])[_0x2203('0x58')](moment(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x59')]),_0x2203('0x5a'))||0x0;if(_0xafcc82===_0x3f7926[_0xb54e51]['length']-0x1){_0x169845[_0x2203('0x13')][_0x1bbd2d]['sumDuration']+=moment(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x5b')]||_0x3f7926[_0xb54e51][_0xafcc82]['queuecallerabandonAt']||_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x5c')])[_0x2203('0x58')](moment(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x59')]),_0x2203('0x5a'))||0x0;_0x169845[_0x2203('0x13')][_0x1bbd2d][_0x2203('0x25')]+=0x1;if(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x5d')]){_0x169845[_0x2203('0x13')][_0x1bbd2d]['answered']+=0x1;_0x169845['voiceQueues'][_0x1bbd2d][_0x2203('0x29')]+=moment(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x5b')])[_0x2203('0x58')](moment(_0x3f7926[_0xb54e51][_0xafcc82]['queuecallerleaveAt']),'seconds')||0x0;}}else{_0x169845['voiceQueues'][_0x1bbd2d][_0x2203('0x28')]+=_0x169845[_0x2203('0x13')][_0x1bbd2d][_0x2203('0x27')]||0x0;}}}}}}return _0x169845[_0x2203('0x13')];};};Realtime['prototype'][_0x2203('0x5e')]=function(){var _0x47a2c7=this;return function(_0x48bd5){clearVoiceCallReports(_0x47a2c7[_0x2203('0x15')]);if(_0x48bd5){for(var _0xe3bee5=0x0;_0xe3bee5<_0x48bd5[_0x2203('0x3a')];_0xe3bee5+=0x1){_0x47a2c7[_0x2203('0x15')]['total']+=0x1;_0x47a2c7[_0x2203('0x15')][_0x2203('0x28')]+=_0x48bd5[_0xe3bee5][_0x2203('0x5f')];if(_0x48bd5[_0xe3bee5]['disposition']===_0x2203('0x60')){_0x47a2c7[_0x2203('0x15')][_0x2203('0x26')]+=0x1;_0x47a2c7[_0x2203('0x15')][_0x2203('0x27')]+=_0x48bd5[_0xe3bee5][_0x2203('0x5f')]-_0x48bd5[_0xe3bee5][_0x2203('0x61')]||0x0;_0x47a2c7[_0x2203('0x15')][_0x2203('0x29')]+=_0x48bd5[_0xe3bee5][_0x2203('0x61')];}}}return _0x47a2c7[_0x2203('0x15')];};};Realtime['prototype'][_0x2203('0x62')]=function(){var _0x7f71b8=this;return function(_0x21b755){if(_0x21b755){freeIsNotKey(_0x21b755,_0x7f71b8[_0x2203('0x14')],_0x2203('0x22'));for(var _0x52c35e=0x0,_0x23f7b1={};_0x52c35e<_0x21b755[_0x2203('0x3a')];_0x52c35e+=0x1){_0x23f7b1=_0x21b755[_0x52c35e];if(_[_0x2203('0x3c')](_0x7f71b8[_0x2203('0x14')][_0x23f7b1[_0x2203('0x22')]])){_0x7f71b8[_0x2203('0x14')][_0x23f7b1['name']]=new Campaign(_0x23f7b1);}else{_0x7f71b8['mergeFromDatabase'](_0x7f71b8[_0x2203('0x14')][_0x23f7b1[_0x2203('0x22')]],_0x23f7b1);_0x7f71b8[_0x2203('0x14')][_0x23f7b1[_0x2203('0x22')]][_0x2203('0x63')]=_0x23f7b1['SquareProject']?_0x23f7b1[_0x2203('0x64')][_0x2203('0x22')]:undefined;}}}return _0x7f71b8['campaigns'];};};Realtime['prototype']['initVoiceExtensions']=function(){var _0x4fc51a=this;return function(_0x5e07d7){if(_0x5e07d7){freeIsNotKey(_0x5e07d7,_0x4fc51a[_0x2203('0x65')],'id');for(var _0x6319a3=0x0,_0x437095={};_0x6319a3<_0x5e07d7['length'];_0x6319a3+=0x1){_0x437095=_0x5e07d7[_0x6319a3];if(_['isUndefined'](_0x4fc51a['voiceExtensions'][_0x437095['id']])){_0x4fc51a[_0x2203('0x65')][_0x437095['id']]=new VoiceExtension(_0x437095);}else{_0x4fc51a[_0x2203('0x40')](_0x4fc51a[_0x2203('0x65')][_0x437095['id']],_0x437095);}}}return _0x4fc51a[_0x2203('0x65')];};};Realtime[_0x2203('0x39')][_0x2203('0x66')]=function(){var _0x3d1797=this;return function(_0x52f25e){clearCampaigns(_0x3d1797[_0x2203('0x14')]);for(var _0x74843=0x0;_0x74843<_0x52f25e[_0x2203('0x3a')];_0x74843+=0x1){_[_0x2203('0x67')](_0x3d1797[_0x2203('0x14')][_0x52f25e[_0x74843][_0x2203('0x22')]],_0x52f25e[_0x74843]);}return _0x3d1797[_0x2203('0x14')];};};Realtime['prototype'][_0x2203('0x68')]=function(){var _0x51a2fe=this;return function(_0x5d0176){if(_0x5d0176){freeIsNotKey(_0x5d0176,_0x51a2fe[_0x2203('0x1e')],'id');for(var _0x5cd030=0x0,_0xb9588e={};_0x5cd030<_0x5d0176[_0x2203('0x3a')];_0x5cd030+=0x1){_0xb9588e=_0x5d0176[_0x5cd030];if(_['isUndefined'](_0x51a2fe[_0x2203('0x1e')][_0xb9588e['id']])){_0x51a2fe[_0x2203('0x1e')][_0xb9588e['id']]=new FaxAccount(_0xb9588e);}else{_0x51a2fe[_0x2203('0x40')](_0x51a2fe[_0x2203('0x1e')][_0xb9588e['id']],_0xb9588e);}}}return _0x51a2fe[_0x2203('0x1e')];};};Realtime[_0x2203('0x39')]['initVoiceQueues']=function(){var _0x215638=this;return function(_0x3541b3){if(_0x3541b3){freeIsNotKey(_0x3541b3,_0x215638['voiceQueues'],'name');for(var _0x377176=0x0,_0x3fe71b={};_0x377176<_0x3541b3[_0x2203('0x3a')];_0x377176+=0x1){_0x3fe71b=_0x3541b3[_0x377176];if(_[_0x2203('0x3c')](_0x215638[_0x2203('0x13')][_0x3fe71b[_0x2203('0x22')]])){_0x215638[_0x2203('0x13')][_0x3fe71b[_0x2203('0x22')]]=new VoiceQueue(_0x3fe71b);}else{_0x215638[_0x2203('0x40')](_0x215638[_0x2203('0x13')][_0x3fe71b[_0x2203('0x22')]],_0x3fe71b);}}}return _0x215638[_0x2203('0x13')];};};module[_0x2203('0x69')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/realtime/utils.js b/server/services/ami/realtime/utils.js index 6d60300..06c78f2 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 _0xb88b=['mergeDBDataToRealtime','hasOwnProperty'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0xb88b,0x115));var _0xbb88=function(_0x7d5e82,_0x52f964){_0x7d5e82=_0x7d5e82-0x0;var _0x598cd1=_0xb88b[_0x7d5e82];return _0x598cd1;};'use strict';function mergeDBDataToRealtime(_0x38a7b8,_0x3357ce){var _0x2df95b=Object['assign']({},_0x38a7b8);for(var _0x3f01d2 in _0x3357ce){if(_0x2df95b[_0xbb88('0x0')](_0x3f01d2)){_0x2df95b[_0x3f01d2]=_0x3357ce[_0x3f01d2];}}return _0x2df95b;}exports[_0xbb88('0x1')]=mergeDBDataToRealtime; \ No newline at end of file +var _0x3aee=['assign','mergeDBDataToRealtime'];(function(_0x5999ff,_0x2d92d3){var _0x55073f=function(_0x15e2e9){while(--_0x15e2e9){_0x5999ff['push'](_0x5999ff['shift']());}};_0x55073f(++_0x2d92d3);}(_0x3aee,0x140));var _0xe3ae=function(_0xf34b0a,_0x11e116){_0xf34b0a=_0xf34b0a-0x0;var _0x5021e1=_0x3aee[_0xf34b0a];return _0x5021e1;};'use strict';function mergeDBDataToRealtime(_0x15704f,_0x5c75d6){var _0x471f69=Object[_0xe3ae('0x0')]({},_0x15704f);for(var _0xfe52a0 in _0x5c75d6){if(_0x471f69['hasOwnProperty'](_0xfe52a0)){_0x471f69[_0xfe52a0]=_0x5c75d6[_0xfe52a0];}}return _0x471f69;}exports[_0xe3ae('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 8638504..01d984b 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 _0xba22=['filename','createdAt','exten','connectedlinename','xcally-motion-dialer','isArray','forEach','startsWith','Local','substring','indexOf','phone','lastIndexOf','SIP/%s','transfererlinkedid','lodash','util','../../../config/environment','../ami','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceAgentReport','voiceAgentReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','find','accountcode','isNil','interface','format','length','findAgent','connectedlinenum','assigned','lastAssignedTo','name','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','YYYY-MM-DD\x20HH:mm:ss','create','getAgentByInternal','channel','split','calleridnum','outbound','destination','type','queue','lastdata','context','callerid','xcally-motion-preview','originatecalleridnum','destinationchannel','calleridpreview','disposition','ANSWERED','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','getCallType','UserId','membername','monitor','monitors'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0xba22,0xc5));var _0x2ba2=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xba22[_0xbb091];return _0x467a04;};'use strict';var _=require(_0x2ba2('0x0'));var moment=require('moment');var util=require(_0x2ba2('0x1'));var config=require(_0x2ba2('0x2'));var ami=require(_0x2ba2('0x3'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require(_0x2ba2('0x4'));var RpcVoiceDialReport=require(_0x2ba2('0x5'));var RpcMemberReport=require(_0x2ba2('0x6'));var RpcVoiceQueueReport=require(_0x2ba2('0x7'));var RpcVoiceRecording=require(_0x2ba2('0x8'));var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require(_0x2ba2('0x9'));var VoiceCallReport=require(_0x2ba2('0xa'));var VoiceAgentReport=require(_0x2ba2('0xb'));var VoiceDialReport=require(_0x2ba2('0xc'));var UserReport=require(_0x2ba2('0xd'));function Report(_0x4c70f6){this[_0x2ba2('0xe')]=_0x4c70f6;this[_0x2ba2('0xf')]=_0x4c70f6[_0x2ba2('0xf')];this[_0x2ba2('0x10')]=_0x4c70f6[_0x2ba2('0x10')];}Report[_0x2ba2('0x11')][_0x2ba2('0x12')]=function(_0x344305){var _0x39f3ce=new VoiceQueueReport(this['realtime']);var _0x25937a=new VoiceAgentReport(this['realtime']);var _0x478623=new VoiceDialReport(this[_0x2ba2('0xe')]);var _0x3cdb0f=new VoiceCallReport(this[_0x2ba2('0xe')]);var _0x311806=new UserReport(this[_0x2ba2('0xe')]);if(config[_0x2ba2('0x13')]&&config[_0x2ba2('0x13')][_0x2ba2('0x14')]){ami['on'](_0x2ba2('0x15'),this[_0x2ba2('0x16')][_0x2ba2('0x17')](this));ami['on']('custom:voiceCallReport',this['voiceCallReport']['bind'](this));ami['on'](_0x2ba2('0x18'),this[_0x2ba2('0x19')][_0x2ba2('0x17')](this));ami['on']('custom:voiceDialReport',this[_0x2ba2('0x1a')][_0x2ba2('0x17')](this));ami['on'](_0x2ba2('0x1b'),this[_0x2ba2('0x1c')][_0x2ba2('0x17')](this));ami['on'](_0x2ba2('0x1d'),this[_0x2ba2('0x1e')][_0x2ba2('0x17')](this));}};Report['prototype']['findAgent']=function(_0x36959a){var _0x36717b;_0x36717b=_[_0x2ba2('0x1f')](this[_0x2ba2('0xf')],function(_0x4d1dca){return _0x4d1dca[_0x2ba2('0x20')]==_0x36959a||_0x4d1dca['name']==_0x36959a;});if(_[_0x2ba2('0x21')](_0x36717b)){var _0x132f65=_[_0x2ba2('0x1f')](this[_0x2ba2('0x10')],function(_0x204344){return _0x204344[_0x2ba2('0x20')]==_0x36959a||_0x204344['name']==_0x36959a;});if(_0x132f65){_0x36717b=_[_0x2ba2('0x1f')](this['agents'],function(_0x6442e5){return _0x6442e5[_0x2ba2('0x22')]==util[_0x2ba2('0x23')]('SIP/%s',_0x132f65['name']);});}}return _0x36717b;};Report['prototype'][_0x2ba2('0x16')]=function(_0x5b494a){for(var _0x1251ed=0x0;_0x1251ed<_0x5b494a[_0x2ba2('0x24')];_0x1251ed+=0x1){var _0x2c5f8a=this[_0x2ba2('0x25')](_0x5b494a[_0x1251ed][_0x2ba2('0x26')]);if(_0x2c5f8a){_0x5b494a[_0x1251ed][_0x2ba2('0x20')]=_0x2c5f8a[_0x2ba2('0x20')];_0x5b494a[_0x1251ed][_0x2ba2('0x27')]=!![];_0x5b494a[_0x1251ed][_0x2ba2('0x28')]=_0x2c5f8a[_0x2ba2('0x29')];_0x5b494a[_0x1251ed][_0x2ba2('0x22')]=_[_0x2ba2('0x21')](_0x2c5f8a[_0x2ba2('0x22')])?util['format']('SIP/%s',_0x2c5f8a[_0x2ba2('0x29')]):_0x2c5f8a[_0x2ba2('0x22')];if(_0x5b494a[_0x1251ed][_0x2ba2('0x2a')]){_0x5b494a[_0x1251ed][_0x2ba2('0x2b')]=moment()[_0x2ba2('0x23')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x5b494a[_0x1251ed][_0x2ba2('0x2c')]){_0x5b494a[_0x1251ed][_0x2ba2('0x2d')]=moment()[_0x2ba2('0x23')](_0x2ba2('0x2e'));}RpcMemberReport['voiceQueueReport'](_0x5b494a[_0x1251ed]);}RpcVoiceQueueReport[_0x2ba2('0x2f')](_0x5b494a[_0x1251ed]);}};function extractCalleridNumber(_0x474d5d){var _0x5ceb51=_0x474d5d['match'](/<(.*?)>/);return _0x5ceb51?_0x5ceb51[0x1]:_0x474d5d;}Report['prototype'][_0x2ba2('0x30')]=function(_0x350767){for(var _0x2b772d=0x0;_0x2b772d','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','isNil','UserId','monitor','monitors','length','monitorFilename','filename','connectedlinename','membername','xcally-motion-dialer','isArray','forEach','voiceDialReport','startsWith','Local','substring','indexOf','mobile','phone','lastIndexOf','blindTransfer','exports','lodash','moment','util','../ami','../rpc/voiceAgentReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','xdr','disabled','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','blindtransfer','attendedtransfer','attendedTransfer','prototype','findAgent'];(function(_0x4a2183,_0x53e74d){var _0xc7c01d=function(_0x526d67){while(--_0x526d67){_0x4a2183['push'](_0x4a2183['shift']());}};_0xc7c01d(++_0x53e74d);}(_0x1787,0xa6));var _0x7178=function(_0x52c071,_0x3731a4){_0x52c071=_0x52c071-0x0;var _0x2246aa=_0x1787[_0x52c071];return _0x2246aa;};'use strict';var _=require(_0x7178('0x0'));var moment=require(_0x7178('0x1'));var util=require(_0x7178('0x2'));var config=require('../../../config/environment');var ami=require(_0x7178('0x3'));var RpcVoiceAgentReport=require(_0x7178('0x4'));var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require(_0x7178('0x5'));var RpcMemberReport=require(_0x7178('0x6'));var RpcVoiceQueueReport=require(_0x7178('0x7'));var RpcVoiceRecording=require(_0x7178('0x8'));var RpcVoiceTransferReport=require(_0x7178('0x9'));var VoiceQueueReport=require(_0x7178('0xa'));var VoiceCallReport=require(_0x7178('0xb'));var VoiceAgentReport=require(_0x7178('0xc'));var VoiceDialReport=require(_0x7178('0xd'));var UserReport=require(_0x7178('0xe'));function Report(_0x4f992c){this[_0x7178('0xf')]=_0x4f992c;this[_0x7178('0x10')]=_0x4f992c[_0x7178('0x10')];this[_0x7178('0x11')]=_0x4f992c[_0x7178('0x11')];}Report['prototype']['sync']=function(_0x17cbb8){var _0x34a38e=new VoiceQueueReport(this['realtime']);var _0x486094=new VoiceAgentReport(this[_0x7178('0xf')]);var _0x1356a1=new VoiceDialReport(this[_0x7178('0xf')]);var _0x282ab7=new VoiceCallReport(this[_0x7178('0xf')]);var _0x372940=new UserReport(this[_0x7178('0xf')]);if(config[_0x7178('0x12')]&&config[_0x7178('0x12')][_0x7178('0x13')]){ami['on']('custom:voiceQueueReport',this[_0x7178('0x14')][_0x7178('0x15')](this));ami['on'](_0x7178('0x16'),this[_0x7178('0x17')][_0x7178('0x15')](this));ami['on'](_0x7178('0x18'),this[_0x7178('0x19')][_0x7178('0x15')](this));ami['on'](_0x7178('0x1a'),this['voiceDialReport'][_0x7178('0x15')](this));ami['on'](_0x7178('0x1b'),this['blindTransfer'][_0x7178('0x15')](this));ami['on'](_0x7178('0x1c'),this[_0x7178('0x1d')][_0x7178('0x15')](this));}};Report[_0x7178('0x1e')][_0x7178('0x1f')]=function(_0x5c4737){var _0x39d3f5;_0x39d3f5=_[_0x7178('0x20')](this[_0x7178('0x10')],function(_0x5845b6){return _0x5845b6[_0x7178('0x21')]==_0x5c4737||_0x5845b6[_0x7178('0x22')]==_0x5c4737;});if(_['isNil'](_0x39d3f5)){var _0x23a015=_[_0x7178('0x20')](this[_0x7178('0x11')],function(_0x16fe60){return _0x16fe60[_0x7178('0x21')]==_0x5c4737||_0x16fe60[_0x7178('0x22')]==_0x5c4737;});if(_0x23a015){_0x39d3f5=_[_0x7178('0x20')](this[_0x7178('0x10')],function(_0x572bd0){return _0x572bd0[_0x7178('0x23')]==util[_0x7178('0x24')](_0x7178('0x25'),_0x23a015[_0x7178('0x22')]);});}}return _0x39d3f5;};Report[_0x7178('0x1e')][_0x7178('0x14')]=function(_0x215cc9){for(var _0x102d3e=0x0;_0x102d3e<_0x215cc9['length'];_0x102d3e+=0x1){var _0x9abd80=this['findAgent'](_0x215cc9[_0x102d3e][_0x7178('0x26')]);if(_0x9abd80){_0x215cc9[_0x102d3e][_0x7178('0x21')]=_0x9abd80[_0x7178('0x21')];_0x215cc9[_0x102d3e]['assigned']=!![];_0x215cc9[_0x102d3e][_0x7178('0x27')]=_0x9abd80[_0x7178('0x22')];_0x215cc9[_0x102d3e][_0x7178('0x23')]=_['isNil'](_0x9abd80[_0x7178('0x23')])?util[_0x7178('0x24')](_0x7178('0x25'),_0x9abd80['name']):_0x9abd80[_0x7178('0x23')];if(_0x215cc9[_0x102d3e]['queuecallercomplete']){_0x215cc9[_0x102d3e][_0x7178('0x28')]=moment()['format'](_0x7178('0x29'));}if(_0x215cc9[_0x102d3e][_0x7178('0x2a')]){_0x215cc9[_0x102d3e][_0x7178('0x2b')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport[_0x7178('0x14')](_0x215cc9[_0x102d3e]);}RpcVoiceQueueReport[_0x7178('0x2c')](_0x215cc9[_0x102d3e]);}};function extractCalleridNumber(_0xe6678c){var _0x14cab2=_0xe6678c[_0x7178('0x2d')](/<(.*?)>/);return _0x14cab2?_0x14cab2[0x1]:_0xe6678c;}Report[_0x7178('0x1e')][_0x7178('0x2e')]=function(_0xfb3759){for(var _0x49ca59=0x0;_0x49ca590x0?!![]:![];if(!_0x52ebf8){return this['syncQueueSummaryComplete'](this[_0xd92f('0x14')][_0xd92f('0x69')]);}};VoiceQueueReport[_0xd92f('0x8')][_0xd92f('0x19')]=function(_0x4a0334){var _0x582639=this[_0xd92f('0x14')]['id'];if(this[_0xd92f('0x14')][_0xd92f('0x5d')][_0x582639]&&this[_0xd92f('0x14')]['queuestatus'][_0x582639][_0x4a0334['actionid']]){this['summary'][_0xd92f('0x5d')][_0x582639][_0x4a0334[_0xd92f('0x5c')]][_0xd92f('0xf')][_0xd92f('0x6a')](_0x4a0334);}};VoiceQueueReport[_0xd92f('0x8')][_0xd92f('0x6b')]=function(_0x558b3b){var _0x130101=this;try{if(this['isNotNull'](_0x558b3b)&&this[_0xd92f('0x55')](_0x558b3b[_0xd92f('0x50')])){logger[_0xd92f('0x6c')](_0xd92f('0x6d'),util[_0xd92f('0x3f')](_0x558b3b,{'showHidden':![],'depth':null}));var _0x1a98db=this[_0xd92f('0x12')][_0x558b3b['queue']];if(_0x1a98db){logger[_0xd92f('0x6c')](_0xd92f('0x6e'),_0x1a98db[_0xd92f('0x61')]);this[_0xd92f('0x14')]['queues'][_0x1a98db[_0xd92f('0x61')]]={'summaryEvent':_0x558b3b};this[_0xd92f('0x14')]['statusRequests']+=0x1;return ami['Action']({'action':'queuestatus','queue':_0x1a98db[_0xd92f('0x61')]})[_0xd92f('0x5b')](function(_0x1d855c){if(!_0x130101[_0xd92f('0x14')][_0xd92f('0x5d')][_0x558b3b[_0xd92f('0x5c')]]){_0x130101[_0xd92f('0x14')]['queuestatus'][_0x558b3b[_0xd92f('0x5c')]]={};}_0x130101[_0xd92f('0x14')]['queuestatus'][_0x558b3b[_0xd92f('0x5c')]][_0x1d855c[_0xd92f('0x5c')]]={'queue':_0x1a98db[_0xd92f('0x61')],'agents':[]};})[_0xd92f('0x3a')](function(_0x18c51d){throw _0x18c51d;});}}}catch(_0x697419){logger['error']('[voiceQueueReport][queuesummary]',util[_0xd92f('0x3f')](_0x697419,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd92f('0x8')][_0xd92f('0x6f')]=function(_0x142c92){if(this[_0xd92f('0x14')][_0xd92f('0x68')]>0x0){this['summary']['completeEvent']=_0x142c92;return;}logger[_0xd92f('0x6c')]('[voiceQueueReport][queuesummarycomplete]\x20event:',util[_0xd92f('0x3f')](_0x142c92,{'showHidden':![],'depth':null}));this[_0xd92f('0x14')]=initializeSummary();ami[_0xd92f('0x45')](_0xd92f('0x70'),{});};VoiceQueueReport[_0xd92f('0x8')][_0xd92f('0x1d')]=function(_0x2b4119){try{if(this[_0xd92f('0x55')](_0x2b4119)){logger['debug'](_0xd92f('0x71'),_0x2b4119['uniqueid'],util[_0xd92f('0x3f')](_0x2b4119,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0xd92f('0xd')][_0x2b4119[_0xd92f('0x4e')]])){this[_0xd92f('0xd')][_0x2b4119[_0xd92f('0x4e')]]=[];}if(_[_0xd92f('0x56')](this[_0xd92f('0x10')][_0x2b4119[_0xd92f('0x4e')]])){this['channels'][_0x2b4119[_0xd92f('0x4e')]]={};}var _0x5c4481=new QueueReport();_0x5c4481[_0xd92f('0x50')]=_0x2b4119[_0xd92f('0x50')];_0x5c4481[_0xd92f('0x53')]=this[_0xd92f('0x12')][_0x5c4481[_0xd92f('0x50')]]&&this[_0xd92f('0x12')][_0x5c4481[_0xd92f('0x50')]]['type']?this[_0xd92f('0x12')][_0x5c4481[_0xd92f('0x50')]][_0xd92f('0x53')]||'inbound':_0xd92f('0x65');_0x5c4481[_0xd92f('0x72')]=moment()[_0xd92f('0x49')](_0xd92f('0x73'));_0x5c4481[_0xd92f('0x74')]=_0x2b4119[_0xd92f('0x74')];_0x5c4481['count']=_0x2b4119[_0xd92f('0x75')];_0x5c4481[_0xd92f('0x4e')]=_0x2b4119[_0xd92f('0x4e')];logger[_0xd92f('0x76')](_0xd92f('0x77'),_0x5c4481['queue'],_0x5c4481[_0xd92f('0x53')]);Object['assign'](_0x5c4481,_[_0xd92f('0x78')](_0x2b4119,_[_0xd92f('0x79')](_0x5c4481)));this[_0xd92f('0xd')][_0x2b4119['uniqueid']]['push'](_0x5c4481);this[_0xd92f('0x10')][_0x2b4119['uniqueid']]=_0x5c4481;this[_0xd92f('0x46')](_0x5c4481,_0xd92f('0x1c'));}}catch(_0x58bf08){logger[_0xd92f('0x3d')](_0xd92f('0x71'),_0x2b4119[_0xd92f('0x4e')],util[_0xd92f('0x3f')](_0x58bf08,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xd92f('0x1f')]=function(_0x42649d){try{if(this[_0xd92f('0x55')](_0x42649d)){logger[_0xd92f('0x6c')](_0xd92f('0x7a'),_0x42649d[_0xd92f('0x4e')],util[_0xd92f('0x3f')](_0x42649d,{'showHidden':![],'depth':null}));if(this[_0xd92f('0xd')][_0x42649d[_0xd92f('0x4e')]]){var _0x57f4a4=_[_0xd92f('0x7b')](this[_0xd92f('0xd')][_0x42649d[_0xd92f('0x4e')]]);_0x57f4a4['queuecallercomplete']=![];_0x57f4a4[_0xd92f('0x7c')]=null;_0x57f4a4[_0xd92f('0x7d')]=_0x42649d['holdtime'];_0x57f4a4[_0xd92f('0x7e')]=_0x42649d[_0xd92f('0x7e')];_0x57f4a4[_0xd92f('0x1e')]=!![];_0x57f4a4[_0xd92f('0x7f')]=moment()[_0xd92f('0x49')](_0xd92f('0x73'));_0x57f4a4[_0xd92f('0x80')]='ABANDONED';_0x57f4a4[_0xd92f('0x81')]=null;logger[_0xd92f('0x76')](_0xd92f('0x82'),_0x57f4a4['queue'],_0x57f4a4['type']);this['channels'][_0x42649d[_0xd92f('0x4e')]]=_0x57f4a4;this[_0xd92f('0x43')](_0x57f4a4,_0xd92f('0x1e'));}}}catch(_0x57e5fe){logger['error'](_0xd92f('0x7a'),_0x42649d['uniqueid'],util['inspect'](_0x57e5fe,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd92f('0x8')][_0xd92f('0x20')]=function(_0x356412){try{if(this['isNotNull'](_0x356412)){logger['debug'](_0xd92f('0x83'),_0x356412[_0xd92f('0x4e')],util[_0xd92f('0x3f')](_0x356412,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x356412[_0xd92f('0x4e')]]){var _0x54ee50=_[_0xd92f('0x7b')](this[_0xd92f('0xd')][_0x356412[_0xd92f('0x4e')]]);_0x54ee50[_0xd92f('0x84')]=moment()['format'](_0xd92f('0x73'));_0x54ee50[_0xd92f('0x85')]=_0x356412[_0xd92f('0x85')];_0x54ee50['connectedlinename']=_0x356412[_0xd92f('0x86')];logger['info']('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x54ee50[_0xd92f('0x50')],_0x54ee50['type'],_0x356412[_0xd92f('0x85')],_0x356412['connectedlinename']);this[_0xd92f('0x10')][_0x356412[_0xd92f('0x4e')]]=_0x54ee50;this['emitVoiceQueueChannelSave'](_0x54ee50,_0xd92f('0x87'));}}}catch(_0x16ef77){logger['error'](_0xd92f('0x83'),_0x356412['uniqueid'],util['inspect'](_0x16ef77,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd92f('0x8')]['syncAgentConnect']=function(_0x1178b2){try{if(this[_0xd92f('0x55')](_0x1178b2)){logger[_0xd92f('0x6c')](_0xd92f('0x88'),_0x1178b2['uniqueid'],util['inspect'](_0x1178b2,{'showHidden':![],'depth':null}));if(this[_0xd92f('0xd')][_0x1178b2['uniqueid']]){var _0x45e1c1=_[_0xd92f('0x7b')](this[_0xd92f('0xd')][_0x1178b2['uniqueid']]);_0x45e1c1[_0xd92f('0x89')]=!![];_0x45e1c1[_0xd92f('0x80')]='COMPLETEDBYAGENT';logger[_0xd92f('0x76')](_0xd92f('0x8a'),_0x45e1c1[_0xd92f('0x50')],_0x45e1c1[_0xd92f('0x53')]);}}}catch(_0x4c98be){logger[_0xd92f('0x3d')](_0xd92f('0x88'),_0x1178b2[_0xd92f('0x4e')],util[_0xd92f('0x3f')](_0x4c98be,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd92f('0x8')][_0xd92f('0x8b')]=function(_0x27b426){try{if(this[_0xd92f('0x55')](_0x27b426)){logger[_0xd92f('0x6c')](_0xd92f('0x8c'),_0x27b426[_0xd92f('0x4e')],util[_0xd92f('0x3f')](_0x27b426,{'showHidden':![],'depth':null}));if(this[_0xd92f('0xd')][_0x27b426[_0xd92f('0x4e')]]){var _0x53cd59=_[_0xd92f('0x7b')](this[_0xd92f('0xd')][_0x27b426[_0xd92f('0x4e')]]);_0x53cd59[_0xd92f('0x1e')]=![];_0x53cd59[_0xd92f('0x7f')]=null;_0x53cd59['assigned']=!![];_0x53cd59['lastAssignedTo']=_0x27b426[_0xd92f('0x8d')];_0x53cd59[_0xd92f('0x7d')]=_0x27b426[_0xd92f('0x7d')];_0x53cd59[_0xd92f('0x89')]=!![];_0x53cd59[_0xd92f('0x8e')]=![];_0x53cd59[_0xd92f('0x8f')]=null;if(!_0x53cd59[_0xd92f('0x90')]){if(_0x27b426['reason']==_0xd92f('0x90')){_0x53cd59[_0xd92f('0x80')]=_0xd92f('0x91');logger[_0xd92f('0x76')](_0xd92f('0x92'),_0x53cd59[_0xd92f('0x50')],_0x53cd59[_0xd92f('0x53')]);}else{if(_[_0xd92f('0x93')](_0x27b426[_0xd92f('0x94')]['toLowerCase'](),_0xd92f('0x95'))){if(this[_0xd92f('0xd')][_0x27b426[_0xd92f('0x96')]]){var _0x47a111=_[_0xd92f('0x7b')](this[_0xd92f('0xd')][_0x27b426[_0xd92f('0x96')]]);_0x47a111['queuecallercomplete']=![];_0x47a111[_0xd92f('0x8e')]=!![];_0x47a111['queuecallerexitAt']=moment(_0x53cd59['queuecallerjoinAt'])[_0xd92f('0x97')](_0x27b426['holdtime'],'seconds')[_0xd92f('0x49')]('YYYY-MM-DD\x20HH:mm:ss');_0x47a111[_0xd92f('0x80')]='FORWARDTRANSFER';_0x47a111[_0xd92f('0x90')]=!![];_0x47a111[_0xd92f('0x98')]=_0xd92f('0x99');_0x47a111[_0xd92f('0x9a')]=_0x27b426[_0xd92f('0x9b')];_0x47a111[_0xd92f('0x9c')]=_0x27b426[_0xd92f('0x4e')];logger[_0xd92f('0x76')](_0xd92f('0x9d'),_0x47a111[_0xd92f('0x50')],_0x47a111['type']);var _0x86c276=this[_0xd92f('0xd')][_0x27b426[_0xd92f('0x96')]];this[_0xd92f('0xd')][_0x27b426[_0xd92f('0x96')]]=this[_0xd92f('0xd')][_0x27b426[_0xd92f('0x4e')]];this['queueReports'][_0x27b426[_0xd92f('0x4e')]]=_0x86c276;}}else{_0x53cd59[_0xd92f('0x80')]=_0xd92f('0x9e')+_0x27b426[_0xd92f('0x9f')][_0xd92f('0xa0')]();logger[_0xd92f('0x76')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0x53cd59['queue'],_0x53cd59[_0xd92f('0x53')],_0x53cd59[_0xd92f('0x80')]);}}}this['channels'][_0x27b426[_0xd92f('0x4e')]]=_0x53cd59;}}}catch(_0x1ff1db){logger[_0xd92f('0x3d')](_0xd92f('0x8c'),_0x27b426[_0xd92f('0x4e')],util[_0xd92f('0x3f')](_0x1ff1db,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd92f('0x8')][_0xd92f('0x25')]=function(_0x5de8c3){try{if(this[_0xd92f('0x55')](_0x5de8c3)){logger[_0xd92f('0x6c')](_0xd92f('0xa1'),_0x5de8c3[_0xd92f('0x4e')],util[_0xd92f('0x3f')](_0x5de8c3,{'showHidden':![],'depth':null}));this['addVariable'](_0x5de8c3['uniqueid'],_['keys'](_0x5de8c3[_0xd92f('0xa2')])[0x0],_0x5de8c3[_0xd92f('0xa3')]);if(this[_0xd92f('0xd')][_0x5de8c3[_0xd92f('0x4e')]]){var _0x122385=_[_0xd92f('0x7b')](this[_0xd92f('0xd')][_0x5de8c3[_0xd92f('0x4e')]]);if(_0x122385){if(this[_0xd92f('0x55')](_0x5de8c3[_0xd92f('0xa2')])&&this['isNotNull'](_0x5de8c3['variable']['queuestatus'])){switch(_0x5de8c3[_0xd92f('0xa3')]){case _0xd92f('0xa4'):_0x122385[_0xd92f('0x8e')]=![];_0x122385[_0xd92f('0x8f')]=null;break;case _0xd92f('0xa5'):_0x122385['lastevent']=_0xd92f('0xa6');_0x122385[_0xd92f('0x8e')]=!![];_0x122385[_0xd92f('0x8f')]=moment()[_0xd92f('0x49')](_0xd92f('0x73'));_0x122385[_0xd92f('0x84')]=moment()[_0xd92f('0x49')]('YYYY-MM-DD\x20HH:mm:ss');logger[_0xd92f('0x6c')]('[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:',_0x5de8c3[_0xd92f('0x4e')],util[_0xd92f('0x3f')](_0x122385,{'showHidden':![],'depth':null}));ami['emit'](_0xd92f('0xa7'),_0x122385);break;default:_0x122385[_0xd92f('0x8e')]=!![];_0x122385['queuecallerexitAt']=moment()[_0xd92f('0x49')](_0xd92f('0x73'));_0x122385[_0xd92f('0x84')]=moment()['format'](_0xd92f('0x73'));}_0x122385[_0xd92f('0x1e')]=![];_0x122385['queuecallerabandonAt']=null;_0x122385[_0xd92f('0x80')]=_0x5de8c3[_0xd92f('0xa3')];this[_0xd92f('0x10')][_0x5de8c3['uniqueid']]=_0x122385;this['emitVoiceQueueChannelRemove'](_0x122385,'varset');}else if(this[_0xd92f('0x55')](_0x5de8c3['variable'])&&this[_0xd92f('0x55')](_0x5de8c3['variable']['queueposition'])){if(!_0x122385[_0xd92f('0x1e')]){_0x122385['queuecallerexit']=!![];_0x122385[_0xd92f('0x8f')]=moment()[_0xd92f('0x49')](_0xd92f('0x73'));_0x122385[_0xd92f('0x80')]=_0xd92f('0xa8');_0x122385[_0xd92f('0x84')]=moment()['format'](_0xd92f('0x73'));this[_0xd92f('0x10')][_0x5de8c3['uniqueid']]=_0x122385;}}logger[_0xd92f('0x76')](_0xd92f('0xa9'),_0x5de8c3['uniqueid'],_0x122385['queue'],_0x122385['type'],_['keys'](_0x5de8c3[_0xd92f('0xa2')])[0x0],_0x5de8c3[_0xd92f('0xa3')]);_0x122385[_0xd92f('0x40')]=this[_0xd92f('0x40')][_0x5de8c3[_0xd92f('0x4e')]];}}}}catch(_0x573cee){logger[_0xd92f('0x3d')]('[%s][voiceQueueReport][varset]',_0x5de8c3[_0xd92f('0x4e')],util[_0xd92f('0x3f')](_0x573cee,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd92f('0x8')][_0xd92f('0xaa')]=function(_0x31c18d,_0x3876f4,_0x4985bb){var _0x46806b=[_0xd92f('0xab'),_0xd92f('0xac'),_0xd92f('0xad'),'rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged',_0xd92f('0xae'),_0xd92f('0xaf'),_0xd92f('0xb0'),'sipuri',_0xd92f('0xb1'),_0xd92f('0xb2'),_0xd92f('0xb3'),_0xd92f('0xb4'),_0xd92f('0xb5'),'memberlastcall',_0xd92f('0x8d'),_0xd92f('0xb6'),_0xd92f('0xb7')];if(!_[_0xd92f('0x39')](_0x3876f4)&&!_[_0xd92f('0xb8')](_0x46806b,_0x3876f4)){if(_[_0xd92f('0x56')](this[_0xd92f('0x40')][_0x31c18d])){this[_0xd92f('0x40')][_0x31c18d]={};}this['variables'][_0x31c18d][_0x3876f4]=_0x4985bb;}};VoiceQueueReport[_0xd92f('0x8')]['handleHangup']=function(_0x557406,_0x35f32c,_0x2ea395){try{var _0x2ee41b={};if(this[_0xd92f('0xd')][_0x557406]){for(var _0x4ebc82=0x0;_0x4ebc820x0?!![]:![];if(!_0x472048){return this['syncQueueSummaryComplete'](this[_0x427e('0x5b')][_0x427e('0x69')]);}};VoiceQueueReport['prototype'][_0x427e('0x18')]=function(_0x562494){var _0x57cebc=this[_0x427e('0x5b')]['id'];if(this['summary']['queuestatus'][_0x57cebc]&&this[_0x427e('0x5b')]['queuestatus'][_0x57cebc][_0x562494[_0x427e('0x5d')]]){this['summary'][_0x427e('0x5e')][_0x57cebc][_0x562494[_0x427e('0x5d')]][_0x427e('0xe')][_0x427e('0x6a')](_0x562494);}};VoiceQueueReport['prototype'][_0x427e('0x6b')]=function(_0x4d6c49){var _0x16e3b0=this;try{if(this[_0x427e('0x6c')](_0x4d6c49)&&this[_0x427e('0x6c')](_0x4d6c49['queue'])){logger[_0x427e('0x49')]('[voiceQueueReport][queuesummary]\x20event:',util['inspect'](_0x4d6c49,{'showHidden':![],'depth':null}));var _0x328987=this['voiceQueues'][_0x4d6c49['queue']];if(_0x328987){logger[_0x427e('0x49')](_0x427e('0x6d'),_0x328987['name']);this[_0x427e('0x5b')][_0x427e('0x61')][_0x328987['name']]={'summaryEvent':_0x4d6c49};this['summary']['statusRequests']+=0x1;return ami['Action']({'action':_0x427e('0x5e'),'queue':_0x328987[_0x427e('0x56')]})['then'](function(_0x21ecf2){if(!_0x16e3b0[_0x427e('0x5b')][_0x427e('0x5e')][_0x4d6c49[_0x427e('0x5d')]]){_0x16e3b0[_0x427e('0x5b')][_0x427e('0x5e')][_0x4d6c49[_0x427e('0x5d')]]={};}_0x16e3b0['summary'][_0x427e('0x5e')][_0x4d6c49[_0x427e('0x5d')]][_0x21ecf2['actionid']]={'queue':_0x328987[_0x427e('0x56')],'agents':[]};})[_0x427e('0x59')](function(_0xc78511){throw _0xc78511;});}}}catch(_0x18ee13){logger[_0x427e('0x3e')](_0x427e('0x5f'),util['inspect'](_0x18ee13,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x427e('0xa')][_0x427e('0x17')]=function(_0x327586){if(this[_0x427e('0x5b')][_0x427e('0x68')]>0x0){this[_0x427e('0x5b')][_0x427e('0x69')]=_0x327586;return;}logger[_0x427e('0x49')](_0x427e('0x6e'),util[_0x427e('0x40')](_0x327586,{'showHidden':![],'depth':null}));this[_0x427e('0x5b')]=initializeSummary();ami['emit'](_0x427e('0x6f'),{});};VoiceQueueReport[_0x427e('0xa')][_0x427e('0x1b')]=function(_0x336105){try{if(this[_0x427e('0x6c')](_0x336105)){logger[_0x427e('0x49')](_0x427e('0x70'),_0x336105[_0x427e('0x51')],util[_0x427e('0x40')](_0x336105,{'showHidden':![],'depth':null}));if(_['isUndefined'](this['queueReports'][_0x336105['uniqueid']])){this[_0x427e('0xc')][_0x336105[_0x427e('0x51')]]=[];}if(_['isUndefined'](this[_0x427e('0xf')][_0x336105['uniqueid']])){this[_0x427e('0xf')][_0x336105[_0x427e('0x51')]]={};}var _0x235e71=new QueueReport();_0x235e71[_0x427e('0x4e')]=_0x336105[_0x427e('0x4e')];_0x235e71[_0x427e('0x65')]=this[_0x427e('0x11')][_0x235e71[_0x427e('0x4e')]]&&this[_0x427e('0x11')][_0x235e71['queue']][_0x427e('0x65')]?this[_0x427e('0x11')][_0x235e71['queue']][_0x427e('0x65')]||_0x427e('0x55'):_0x427e('0x55');_0x235e71[_0x427e('0x71')]=moment()[_0x427e('0x4c')](_0x427e('0x72'));_0x235e71[_0x427e('0x73')]=_0x336105['position'];_0x235e71[_0x427e('0x74')]=_0x336105[_0x427e('0x74')];_0x235e71['uniqueid']=_0x336105[_0x427e('0x51')];logger[_0x427e('0x75')](_0x427e('0x76'),_0x235e71[_0x427e('0x4e')],_0x235e71[_0x427e('0x65')]);Object[_0x427e('0x64')](_0x235e71,_[_0x427e('0x77')](_0x336105,_[_0x427e('0x78')](_0x235e71)));this[_0x427e('0xc')][_0x336105[_0x427e('0x51')]]['push'](_0x235e71);this[_0x427e('0xf')][_0x336105[_0x427e('0x51')]]=_0x235e71;this[_0x427e('0x48')](_0x235e71,_0x427e('0x79'));}}catch(_0x1a8302){logger[_0x427e('0x3e')](_0x427e('0x70'),_0x336105[_0x427e('0x51')],util['inspect'](_0x1a8302,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x427e('0xa')][_0x427e('0x7a')]=function(_0x728791){try{if(this['isNotNull'](_0x728791)){logger[_0x427e('0x49')]('[%s][voiceQueueReport][queuecallerabandon]',_0x728791['uniqueid'],util[_0x427e('0x40')](_0x728791,{'showHidden':![],'depth':null}));if(this[_0x427e('0xc')][_0x728791['uniqueid']]){var _0x5bfdbd=_[_0x427e('0x7b')](this[_0x427e('0xc')][_0x728791[_0x427e('0x51')]]);_0x5bfdbd['queuecallercomplete']=![];_0x5bfdbd[_0x427e('0x7c')]=null;_0x5bfdbd[_0x427e('0x7d')]=_0x728791[_0x427e('0x7d')];_0x5bfdbd[_0x427e('0x7e')]=_0x728791[_0x427e('0x7e')];_0x5bfdbd[_0x427e('0x34')]=!![];_0x5bfdbd[_0x427e('0x7f')]=moment()[_0x427e('0x4c')]('YYYY-MM-DD\x20HH:mm:ss');_0x5bfdbd[_0x427e('0x80')]=_0x427e('0x81');_0x5bfdbd[_0x427e('0x82')]=null;logger['info'](_0x427e('0x83'),_0x5bfdbd[_0x427e('0x4e')],_0x5bfdbd[_0x427e('0x65')]);this['channels'][_0x728791[_0x427e('0x51')]]=_0x5bfdbd;this[_0x427e('0x45')](_0x5bfdbd,_0x427e('0x34'));}}}catch(_0x1cb50d){logger[_0x427e('0x3e')](_0x427e('0x84'),_0x728791['uniqueid'],util['inspect'](_0x1cb50d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x427e('0xa')][_0x427e('0x1d')]=function(_0x5566d8){try{if(this[_0x427e('0x6c')](_0x5566d8)){logger['debug'](_0x427e('0x85'),_0x5566d8['uniqueid'],util['inspect'](_0x5566d8,{'showHidden':![],'depth':null}));if(this[_0x427e('0xc')][_0x5566d8[_0x427e('0x51')]]){var _0x836186=_['last'](this[_0x427e('0xc')][_0x5566d8['uniqueid']]);_0x836186[_0x427e('0x86')]=moment()[_0x427e('0x4c')](_0x427e('0x72'));_0x836186[_0x427e('0x87')]=_0x5566d8[_0x427e('0x87')];_0x836186['connectedlinename']=_0x5566d8[_0x427e('0x88')];logger[_0x427e('0x75')](_0x427e('0x89'),_0x836186[_0x427e('0x4e')],_0x836186['type'],_0x5566d8['connectedlinenum'],_0x5566d8['connectedlinename']);this[_0x427e('0xf')][_0x5566d8[_0x427e('0x51')]]=_0x836186;this['emitVoiceQueueChannelSave'](_0x836186,'queuecallerleave');}}}catch(_0x2612c6){logger[_0x427e('0x3e')](_0x427e('0x85'),_0x5566d8[_0x427e('0x51')],util[_0x427e('0x40')](_0x2612c6,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x427e('0x20')]=function(_0x31aae3){try{if(this[_0x427e('0x6c')](_0x31aae3)){logger['debug'](_0x427e('0x8a'),_0x31aae3[_0x427e('0x51')],util['inspect'](_0x31aae3,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x31aae3[_0x427e('0x51')]]){var _0x309740=_[_0x427e('0x7b')](this[_0x427e('0xc')][_0x31aae3['uniqueid']]);_0x309740[_0x427e('0x35')]=!![];_0x309740[_0x427e('0x80')]=_0x427e('0x8b');logger[_0x427e('0x75')](_0x427e('0x8c'),_0x309740[_0x427e('0x4e')],_0x309740['type']);}}}catch(_0x3e35d8){logger[_0x427e('0x3e')](_0x427e('0x8a'),_0x31aae3[_0x427e('0x51')],util[_0x427e('0x40')](_0x3e35d8,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x427e('0x1f')]=function(_0xb1ff7b){try{if(this[_0x427e('0x6c')](_0xb1ff7b)){logger[_0x427e('0x49')](_0x427e('0x8d'),_0xb1ff7b[_0x427e('0x51')],util[_0x427e('0x40')](_0xb1ff7b,{'showHidden':![],'depth':null}));if(this[_0x427e('0xc')][_0xb1ff7b['uniqueid']]){var _0x4bd857=_[_0x427e('0x7b')](this[_0x427e('0xc')][_0xb1ff7b[_0x427e('0x51')]]);_0x4bd857[_0x427e('0x34')]=![];_0x4bd857['queuecallerabandonAt']=null;_0x4bd857['assigned']=!![];_0x4bd857[_0x427e('0x82')]=_0xb1ff7b['membername'];_0x4bd857[_0x427e('0x7d')]=_0xb1ff7b[_0x427e('0x7d')];_0x4bd857['queuecallercomplete']=!![];_0x4bd857[_0x427e('0x8e')]=![];_0x4bd857[_0x427e('0x8f')]=null;if(!_0x4bd857[_0x427e('0x90')]){if(_0xb1ff7b['reason']==_0x427e('0x90')){_0x4bd857[_0x427e('0x80')]=_0x427e('0x91');logger[_0x427e('0x75')](_0x427e('0x92'),_0x4bd857['queue'],_0x4bd857[_0x427e('0x65')]);}else{if(_[_0x427e('0x93')](_0xb1ff7b['channel']['toLowerCase'](),_0x427e('0x94'))){if(this[_0x427e('0xc')][_0xb1ff7b['linkedid']]){var _0x353f76=_['last'](this[_0x427e('0xc')][_0xb1ff7b[_0x427e('0x95')]]);_0x353f76['queuecallercomplete']=![];_0x353f76[_0x427e('0x8e')]=!![];_0x353f76[_0x427e('0x8f')]=moment(_0x4bd857[_0x427e('0x71')])[_0x427e('0x96')](_0xb1ff7b['holdtime'],_0x427e('0x97'))[_0x427e('0x4c')](_0x427e('0x72'));_0x353f76[_0x427e('0x80')]='FORWARDTRANSFER';_0x353f76[_0x427e('0x90')]=!![];_0x353f76[_0x427e('0x98')]=_0x427e('0x99');_0x353f76['transferexten']=_0xb1ff7b[_0x427e('0x9a')];_0x353f76['transferuniqueid']=_0xb1ff7b[_0x427e('0x51')];logger['info']('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0x353f76[_0x427e('0x4e')],_0x353f76[_0x427e('0x65')]);var _0x38347c=this[_0x427e('0xc')][_0xb1ff7b[_0x427e('0x95')]];this[_0x427e('0xc')][_0xb1ff7b[_0x427e('0x95')]]=this[_0x427e('0xc')][_0xb1ff7b[_0x427e('0x51')]];this[_0x427e('0xc')][_0xb1ff7b['uniqueid']]=_0x38347c;}}else{_0x4bd857[_0x427e('0x80')]=_0x427e('0x9b')+_0xb1ff7b[_0x427e('0x9c')][_0x427e('0x9d')]();logger[_0x427e('0x75')](_0x427e('0x9e'),_0x4bd857[_0x427e('0x4e')],_0x4bd857[_0x427e('0x65')],_0x4bd857['queuecallerexitreason']);}}}this['channels'][_0xb1ff7b[_0x427e('0x51')]]=_0x4bd857;}}}catch(_0x2bf60a){logger[_0x427e('0x3e')](_0x427e('0x8d'),_0xb1ff7b['uniqueid'],util[_0x427e('0x40')](_0x2bf60a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x427e('0xa')][_0x427e('0x21')]=function(_0x5985b7){try{if(this['isNotNull'](_0x5985b7)){logger[_0x427e('0x49')]('[%s][voiceQueueReport][varset]',_0x5985b7[_0x427e('0x51')],util[_0x427e('0x40')](_0x5985b7,{'showHidden':![],'depth':null}));this[_0x427e('0x9f')](_0x5985b7['uniqueid'],_[_0x427e('0x78')](_0x5985b7[_0x427e('0xa0')])[0x0],_0x5985b7[_0x427e('0xa1')]);if(this[_0x427e('0xc')][_0x5985b7['uniqueid']]){var _0x4b93fc=_[_0x427e('0x7b')](this[_0x427e('0xc')][_0x5985b7['uniqueid']]);if(_0x4b93fc){if(this[_0x427e('0x6c')](_0x5985b7[_0x427e('0xa0')])&&this[_0x427e('0x6c')](_0x5985b7[_0x427e('0xa0')][_0x427e('0x5e')])){switch(_0x5985b7[_0x427e('0xa1')]){case'CONTINUE':_0x4b93fc[_0x427e('0x8e')]=![];_0x4b93fc[_0x427e('0x8f')]=null;break;case _0x427e('0xa2'):_0x4b93fc[_0x427e('0xa3')]=_0x427e('0xa4');_0x4b93fc['queuecallerexit']=!![];_0x4b93fc[_0x427e('0x8f')]=moment()[_0x427e('0x4c')]('YYYY-MM-DD\x20HH:mm:ss');_0x4b93fc[_0x427e('0x86')]=moment()[_0x427e('0x4c')](_0x427e('0x72'));logger['debug'](_0x427e('0xa5'),_0x5985b7[_0x427e('0x51')],util[_0x427e('0x40')](_0x4b93fc,{'showHidden':![],'depth':null}));ami[_0x427e('0x47')]('custom:timeout',_0x4b93fc);break;default:_0x4b93fc[_0x427e('0x8e')]=!![];_0x4b93fc[_0x427e('0x8f')]=moment()['format'](_0x427e('0x72'));_0x4b93fc[_0x427e('0x86')]=moment()[_0x427e('0x4c')](_0x427e('0x72'));}_0x4b93fc[_0x427e('0x34')]=![];_0x4b93fc['queuecallerabandonAt']=null;_0x4b93fc[_0x427e('0x80')]=_0x5985b7[_0x427e('0xa1')];this[_0x427e('0xf')][_0x5985b7[_0x427e('0x51')]]=_0x4b93fc;this[_0x427e('0x45')](_0x4b93fc,_0x427e('0xa6'));}else if(this[_0x427e('0x6c')](_0x5985b7[_0x427e('0xa0')])&&this[_0x427e('0x6c')](_0x5985b7[_0x427e('0xa0')][_0x427e('0xa7')])){if(!_0x4b93fc['queuecallerabandon']){_0x4b93fc[_0x427e('0x8e')]=!![];_0x4b93fc[_0x427e('0x8f')]=moment()[_0x427e('0x4c')](_0x427e('0x72'));_0x4b93fc[_0x427e('0x80')]=_0x427e('0xa8');_0x4b93fc[_0x427e('0x86')]=moment()[_0x427e('0x4c')](_0x427e('0x72'));this[_0x427e('0xf')][_0x5985b7[_0x427e('0x51')]]=_0x4b93fc;}}logger[_0x427e('0x75')](_0x427e('0xa9'),_0x5985b7[_0x427e('0x51')],_0x4b93fc['queue'],_0x4b93fc['type'],_[_0x427e('0x78')](_0x5985b7[_0x427e('0xa0')])[0x0],_0x5985b7[_0x427e('0xa1')]);_0x4b93fc[_0x427e('0x13')]=this[_0x427e('0x13')][_0x5985b7[_0x427e('0x51')]];}}}}catch(_0x386561){logger[_0x427e('0x3e')]('[%s][voiceQueueReport][varset]',_0x5985b7[_0x427e('0x51')],util[_0x427e('0x40')](_0x386561,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x427e('0xa')][_0x427e('0x9f')]=function(_0x2186b4,_0x304fa6,_0x5ce32){var _0x364bd7=[_0x427e('0xaa'),_0x427e('0xab'),'rtpaudioqosjitter',_0x427e('0xac'),_0x427e('0xad'),'rtpaudioqoslossbridged','rtpaudioqosrtt',_0x427e('0xae'),'sipcallid',_0x427e('0xaf'),_0x427e('0xb0'),_0x427e('0xb1'),'membercalls',_0x427e('0xb2'),_0x427e('0xb3'),_0x427e('0xb4'),_0x427e('0xb5'),_0x427e('0xb6'),'memberrealtime'];if(!_[_0x427e('0x39')](_0x304fa6)&&!_[_0x427e('0xb7')](_0x364bd7,_0x304fa6)){if(_[_0x427e('0x58')](this[_0x427e('0x13')][_0x2186b4])){this['variables'][_0x2186b4]={};}this[_0x427e('0x13')][_0x2186b4][_0x304fa6]=_0x5ce32;}};VoiceQueueReport[_0x427e('0xa')][_0x427e('0xb8')]=function(_0x1e0181,_0x45a328,_0x1a9b1d){try{var _0x5e4c58={};if(this[_0x427e('0xc')][_0x1e0181]){for(var _0x1e2078=0x0;_0x1e2078=0x0?moment(_0x438bd6[_0x96bb('0x17')])[_0x96bb('0xf')](_0x438bd6[_0x96bb('0x16')],_0x96bb('0x10')):null,'data1':'outbound','data2':_0x438bd6[_0x96bb('0x13')],'data3':_0x438bd6[_0x96bb('0x12')],'data4':_0x438bd6[_0x96bb('0x18')]||null,'role':_0x96bb('0x19'),'internal':_0x438bd6[_0x96bb('0x13')]?_['toNumber'](_0x438bd6['accountcode']):undefined,'uniqueid':_0x438bd6[_0x96bb('0x15')]},'log':'CreateMemberReport'});}; \ No newline at end of file +var _0x44d7=['queuecallerexitAt','Request','CreateMemberReport','voice','lastAssignedTo','isNil','format','SIP/%s','interface','TALKING','queuecallerleaveAt','diff','inbound','calleridnum','exten','accountcode','voiceDialReport','membername','starttime','endtime','seconds','outbound','dialstring','uniqueid','moment','lodash','util','../client','voiceQueueReport','queuecallercompleteAt'];(function(_0xe2070e,_0x3a8903){var _0x377eee=function(_0x1661bb){while(--_0x1661bb){_0xe2070e['push'](_0xe2070e['shift']());}};_0x377eee(++_0x3a8903);}(_0x44d7,0x180));var _0x744d=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x44d7[_0x15bc81];return _0x59440e;};'use strict';var moment=require(_0x744d('0x0'));var _=require(_0x744d('0x1'));var util=require(_0x744d('0x2'));var client=require(_0x744d('0x3'));exports[_0x744d('0x4')]=function(_0x227a08){var _0x190293=_0x227a08[_0x744d('0x5')]||_0x227a08[_0x744d('0x6')];return client[_0x744d('0x7')](_0x744d('0x8'),{'body':{'channel':_0x744d('0x9'),'membername':_0x227a08[_0x744d('0xa')],'interface':_[_0x744d('0xb')](_0x227a08['interface'])?util[_0x744d('0xc')](_0x744d('0xd'),_0x227a08[_0x744d('0xa')]):_0x227a08[_0x744d('0xe')],'type':_0x744d('0xf'),'enterAt':_0x227a08[_0x744d('0x10')],'exitAt':_0x190293,'duration':moment(_0x190293)[_0x744d('0x11')](_0x227a08[_0x744d('0x10')],'seconds'),'data1':_0x744d('0x12'),'data2':_0x227a08[_0x744d('0x13')],'data3':_0x227a08[_0x744d('0x14')],'data4':null,'data5':_0x227a08['queue'],'role':'agent','internal':_0x227a08['accountcode']?_['toNumber'](_0x227a08[_0x744d('0x15')]):undefined,'uniqueid':_0x227a08['uniqueid']},'log':_0x744d('0x8')});};exports[_0x744d('0x16')]=function(_0x17b47d){return client[_0x744d('0x7')](_0x744d('0x8'),{'body':{'channel':_0x744d('0x9'),'membername':_0x17b47d[_0x744d('0x17')],'interface':_0x17b47d[_0x744d('0xe')],'type':_0x744d('0xf'),'enterAt':_0x17b47d[_0x744d('0x18')],'exitAt':_0x17b47d[_0x744d('0x19')],'duration':moment(_0x17b47d['endtime'])['diff'](_0x17b47d['starttime'],_0x744d('0x1a'))>=0x0?moment(_0x17b47d[_0x744d('0x19')])[_0x744d('0x11')](_0x17b47d[_0x744d('0x18')],_0x744d('0x1a')):null,'data1':_0x744d('0x1b'),'data2':_0x17b47d[_0x744d('0x15')],'data3':_0x17b47d[_0x744d('0x14')],'data4':_0x17b47d[_0x744d('0x1c')]||null,'role':'agent','internal':_0x17b47d[_0x744d('0x15')]?_['toNumber'](_0x17b47d['accountcode']):undefined,'uniqueid':_0x17b47d[_0x744d('0x1d')]},'log':_0x744d('0x8')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index d778a96..e8bb700 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 _0xfc6d=['GetSettings','../client','getSettings','Request','ShowSetting'];(function(_0x507b72,_0x2d2426){var _0x4daa6f=function(_0x2de0d4){while(--_0x2de0d4){_0x507b72['push'](_0x507b72['shift']());}};_0x4daa6f(++_0x2d2426);}(_0xfc6d,0x1e6));var _0xdfc6=function(_0x381927,_0x684dab){_0x381927=_0x381927-0x0;var _0x5f2835=_0xfc6d[_0x381927];return _0x5f2835;};'use strict';var client=require(_0xdfc6('0x0'));exports[_0xdfc6('0x1')]=function(){return client[_0xdfc6('0x2')](_0xdfc6('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['stopRecordingOnTransfer','previewRecallmeReminderInterval']},'log':_0xdfc6('0x4')});}; \ No newline at end of file +var _0xfcc5=['getSettings','Request','ShowSetting','stopRecordingOnTransfer','GetSettings'];(function(_0x2bb052,_0x5be18f){var _0x3f910c=function(_0x4e6082){while(--_0x4e6082){_0x2bb052['push'](_0x2bb052['shift']());}};_0x3f910c(++_0x5be18f);}(_0xfcc5,0x14a));var _0x5fcc=function(_0x5c22a0,_0x392a95){_0x5c22a0=_0x5c22a0-0x0;var _0x12d21b=_0xfcc5[_0x5c22a0];return _0x12d21b;};'use strict';var client=require('../client');exports[_0x5fcc('0x0')]=function(){return client[_0x5fcc('0x1')](_0x5fcc('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x5fcc('0x3'),'previewRecallmeReminderInterval']},'log':_0x5fcc('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 9da3e51..52c9361 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 _0x14b7=['getTemplates','GetTemplate','name','html','../client'];(function(_0x57c9fc,_0x23d3dd){var _0xf5dcba=function(_0x2e6ef5){while(--_0x2e6ef5){_0x57c9fc['push'](_0x57c9fc['shift']());}};_0xf5dcba(++_0x23d3dd);}(_0x14b7,0x144));var _0x714b=function(_0x3700fd,_0x5bd346){_0x3700fd=_0x3700fd-0x0;var _0x4ffb6c=_0x14b7[_0x3700fd];return _0x4ffb6c;};'use strict';var client=require(_0x714b('0x0'));exports[_0x714b('0x1')]=function(_0x259c99){return function(_0x2a1bc6){return client['Request'](_0x714b('0x2'),{'options':{'raw':!![],'attributes':['id',_0x714b('0x3'),_0x714b('0x4')]},'log':_0x714b('0x2')});};}; \ No newline at end of file +var _0x9cbe=['Request','GetTemplate','name','html'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0x9cbe,0x114));var _0xe9cb=function(_0x556927,_0x34b53f){_0x556927=_0x556927-0x0;var _0x5f1235=_0x9cbe[_0x556927];return _0x5f1235;};'use strict';var client=require('../client');exports['getTemplates']=function(_0x497b9c){return function(_0x125213){return client[_0xe9cb('0x0')](_0xe9cb('0x1'),{'options':{'raw':!![],'attributes':['id',_0xe9cb('0x2'),_0xe9cb('0x3')]},'log':_0xe9cb('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 81a9682..33e7040 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 _0x8352=['name','Condition','AllConditions','AnyConditions','operator','value','Action','data4','data5','data7','getTriggers','Request','GetTrigger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8352,0x72));var _0x2835=function(_0x79ea76,_0x519c4b){_0x79ea76=_0x79ea76-0x0;var _0x39b6c9=_0x8352[_0x79ea76];return _0x39b6c9;};'use strict';var client=require('../client');exports[_0x2835('0x0')]=function(_0xb4a255){return function(_0x76d42e){return client[_0x2835('0x1')](_0x2835('0x2'),{'options':{'raw':![],'attributes':['id',_0x2835('0x3'),'channel','status'],'include':[{'model':_0x2835('0x4'),'as':_0x2835('0x5'),'attributes':['id','field','operator','value']},{'model':'Condition','as':_0x2835('0x6'),'attributes':['id','field',_0x2835('0x7'),_0x2835('0x8')]},{'model':_0x2835('0x9'),'as':'Actions','attributes':['id','action','data1','data2','data3',_0x2835('0xa'),_0x2835('0xb'),'data6',_0x2835('0xc')]}]},'log':_0x2835('0x2')});};}; \ No newline at end of file +var _0x1a15=['AllConditions','field','operator','value','Condition','AnyConditions','Action','Actions','data1','data3','data4','data7','../client','getTriggers','GetTrigger','name'];(function(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0x1a15,0x9c));var _0x51a1=function(_0x5f0e6a,_0x212e9b){_0x5f0e6a=_0x5f0e6a-0x0;var _0x4b1e95=_0x1a15[_0x5f0e6a];return _0x4b1e95;};'use strict';var client=require(_0x51a1('0x0'));exports[_0x51a1('0x1')]=function(_0x31f7f1){return function(_0x3409e0){return client['Request'](_0x51a1('0x2'),{'options':{'raw':![],'attributes':['id',_0x51a1('0x3'),'channel','status'],'include':[{'model':'Condition','as':_0x51a1('0x4'),'attributes':['id',_0x51a1('0x5'),_0x51a1('0x6'),_0x51a1('0x7')]},{'model':_0x51a1('0x8'),'as':_0x51a1('0x9'),'attributes':['id',_0x51a1('0x5'),_0x51a1('0x6'),'value']},{'model':_0x51a1('0xa'),'as':_0x51a1('0xb'),'attributes':['id','action',_0x51a1('0xc'),'data2',_0x51a1('0xd'),_0x51a1('0xe'),'data5','data6',_0x51a1('0xf')]}]},'log':_0x51a1('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 6a59995..86aff7c 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 _0xb13b=['Request','name','registry','GetTrunk','../client','getTrunks'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xb13b,0x1de));var _0xbb13=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0xb13b[_0x263a74];return _0x2aa86c;};'use strict';var client=require(_0xbb13('0x0'));exports[_0xbb13('0x1')]=function(_0x3f5d93){return function(_0x1c276a){return client[_0xbb13('0x2')]('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xbb13('0x3'),_0xbb13('0x4'),'defaultuser']},'log':_0xbb13('0x5')});};}; \ No newline at end of file +var _0x9789=['name','registry','defaultuser','../client','getTrunks','Request','GetTrunk'];(function(_0x4f0a3a,_0x14f8d9){var _0x430cca=function(_0x48ae46){while(--_0x48ae46){_0x4f0a3a['push'](_0x4f0a3a['shift']());}};_0x430cca(++_0x14f8d9);}(_0x9789,0x1bc));var _0x9978=function(_0x4952e1,_0x488c90){_0x4952e1=_0x4952e1-0x0;var _0x3d2a3f=_0x9789[_0x4952e1];return _0x3d2a3f;};'use strict';var client=require(_0x9978('0x0'));exports[_0x9978('0x1')]=function(_0x2479cb){return function(_0x104393){return client[_0x9978('0x2')](_0x9978('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x9978('0x4'),_0x9978('0x5'),_0x9978('0x6')]},'log':_0x9978('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 017a2d4..af264bc 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(_0x115fc9,_0x22021c){_0x115fc9=_0x115fc9-0x0;var _0x2d4bc2=_0xe706[_0x115fc9];return _0x2d4bc2;};'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 _0x9c44=['online','pauseType','Request','GetUser','agent','name','email','accountcode','lastLoginAt','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','telephone','internal','PauseUser','savePause','getAgent','ShowUser','fullname'];(function(_0x32970a,_0x51661a){var _0x1a82b4=function(_0x16b082){while(--_0x16b082){_0x32970a['push'](_0x32970a['shift']());}};_0x1a82b4(++_0x51661a);}(_0x9c44,0x178));var _0x49c4=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x9c44[_0x167cc1];return _0x10bc4b;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':![],'where':{'role':_0x49c4('0x2')},'attributes':['id',_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5'),'fullname','online',_0x49c4('0x6'),'pauseType',_0x49c4('0x7'),_0x49c4('0x8'),_0x49c4('0x9'),_0x49c4('0xa'),_0x49c4('0xb')]},'log':'getAgents'});};};exports[_0x49c4('0xc')]=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':!![],'where':{'role':_0x49c4('0xd')},'attributes':['id','name','accountcode',_0x49c4('0xe')]},'log':_0x49c4('0xc')});};};exports['savePause']=function(_0xb611a1,_0x459d09,_0x4adb3c){return client['Request'](_0x49c4('0xf'),{'body':{'type':_0x459d09,'uniqueid':_0x4adb3c},'options':{'where':{'id':_0xb611a1['id']}},'log':_0x49c4('0x10')});};exports['saveUnpause']=function(_0x7df3a9){return client[_0x49c4('0x0')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x7df3a9['id']}},'log':_0x49c4('0x10')});};exports[_0x49c4('0x11')]=function(_0x21f15a){return client[_0x49c4('0x0')](_0x49c4('0x12'),{'options':{'raw':![],'where':{'role':_0x49c4('0x2'),'id':_0x21f15a},'attributes':['id',_0x49c4('0x3'),_0x49c4('0x4'),'accountcode',_0x49c4('0x13'),_0x49c4('0x14'),_0x49c4('0x6'),_0x49c4('0x15'),_0x49c4('0x7'),'voicePause',_0x49c4('0xb')]},'log':_0x49c4('0x11')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 629cc5d..44248b8 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 _0x6b38=['update','../client','create','Request','CreateVoiceAgentReport'];(function(_0x59c301,_0x359c50){var _0x3866b9=function(_0x2d380e){while(--_0x2d380e){_0x59c301['push'](_0x59c301['shift']());}};_0x3866b9(++_0x359c50);}(_0x6b38,0x6f));var _0x86b3=function(_0x2add22,_0x4f2c96){_0x2add22=_0x2add22-0x0;var _0x5f1212=_0x6b38[_0x2add22];return _0x5f1212;};'use strict';var client=require(_0x86b3('0x0'));exports[_0x86b3('0x1')]=function(_0x23fee0){return client[_0x86b3('0x2')](_0x86b3('0x3'),{'body':_0x23fee0,'log':_0x86b3('0x3')});};exports[_0x86b3('0x4')]=function(_0x123cc5,_0x5d34b6,_0x46321e){return client[_0x86b3('0x2')]('UpdateVoiceAgentReport',{'body':_0x123cc5,'options':{'where':{'uniqueid':_0x5d34b6,'interface':_0x46321e,'agentcomplete':!![]}},'log':'UpdateVoiceAgentReport'});}; \ No newline at end of file +var _0x572b=['CreateVoiceAgentReport','update','UpdateVoiceAgentReport','../client','create','Request'];(function(_0x4df71f,_0x234d9b){var _0x7f292b=function(_0x3e4323){while(--_0x3e4323){_0x4df71f['push'](_0x4df71f['shift']());}};_0x7f292b(++_0x234d9b);}(_0x572b,0xf9));var _0xb572=function(_0x4c1ec2,_0x4f42b7){_0x4c1ec2=_0x4c1ec2-0x0;var _0x3f6f1c=_0x572b[_0x4c1ec2];return _0x3f6f1c;};'use strict';var client=require(_0xb572('0x0'));exports[_0xb572('0x1')]=function(_0x1b6904){return client[_0xb572('0x2')](_0xb572('0x3'),{'body':_0x1b6904,'log':_0xb572('0x3')});};exports[_0xb572('0x4')]=function(_0x44774f,_0x4eac6b,_0x16cc6c){return client[_0xb572('0x2')](_0xb572('0x5'),{'body':_0x44774f,'options':{'where':{'uniqueid':_0x4eac6b,'interface':_0x16cc6c,'agentcomplete':!![]}},'log':_0xb572('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index a4e9fb4..891211f 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 _0x7c2d=['create','Request','CreateVoiceCallReport','merge','context','callerid','DOCUMENTATION','outbound','startOf','day','endOf','format','YYYY-MM-DD\x20HH:mm:ss','type','disposition','duration','billableseconds','GetVoiceCallReports','moment','util','lodash'];(function(_0x50d8b2,_0x46f88d){var _0x2f9972=function(_0x4f728b){while(--_0x4f728b){_0x50d8b2['push'](_0x50d8b2['shift']());}};_0x2f9972(++_0x46f88d);}(_0x7c2d,0x123));var _0xd7c2=function(_0x556927,_0x34b53f){_0x556927=_0x556927-0x0;var _0x5f1235=_0x7c2d[_0x556927];return _0x5f1235;};'use strict';var moment=require(_0xd7c2('0x0'));var util=require(_0xd7c2('0x1'));var _=require(_0xd7c2('0x2'));var client=require('../client');exports[_0xd7c2('0x3')]=function(_0x3ae208){return client[_0xd7c2('0x4')](_0xd7c2('0x5'),{'body':_[_0xd7c2('0x6')](_0x3ae208,{'source':_0x3ae208['calleridnum'],'destinationcontext':_0x3ae208[_0xd7c2('0x7')],'callerid':_0x3ae208[_0xd7c2('0x8')],'amaflags':_0xd7c2('0x9')}),'log':_0xd7c2('0x5')});};exports['getVoiceCallReports']=function(){return function(){return client[_0xd7c2('0x4')]('GetVoiceCallReport',{'options':{'where':{'type':[_0xd7c2('0xa')],'createdAt':{'$between':[moment()[_0xd7c2('0xb')](_0xd7c2('0xc'))['format']('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0xd7c2('0xd')]('day')[_0xd7c2('0xe')](_0xd7c2('0xf'))]}},'attributes':[_0xd7c2('0x10'),_0xd7c2('0x11'),_0xd7c2('0x12'),_0xd7c2('0x13')]},'log':_0xd7c2('0x14')});};}; \ No newline at end of file +var _0x9c45=['type','GetVoiceCallReports','moment','util','lodash','../client','create','CreateVoiceCallReport','calleridnum','context','callerid','DOCUMENTATION','Request','GetVoiceCallReport','outbound','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf'];(function(_0x2a92a3,_0x58ba4d){var _0x3f0dfe=function(_0x807f33){while(--_0x807f33){_0x2a92a3['push'](_0x2a92a3['shift']());}};_0x3f0dfe(++_0x58ba4d);}(_0x9c45,0x87));var _0x59c4=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9c45[_0x14add3];return _0x4a174f;};'use strict';var moment=require(_0x59c4('0x0'));var util=require(_0x59c4('0x1'));var _=require(_0x59c4('0x2'));var client=require(_0x59c4('0x3'));exports[_0x59c4('0x4')]=function(_0x87eb55){return client['Request'](_0x59c4('0x5'),{'body':_['merge'](_0x87eb55,{'source':_0x87eb55[_0x59c4('0x6')],'destinationcontext':_0x87eb55[_0x59c4('0x7')],'callerid':_0x87eb55[_0x59c4('0x8')],'amaflags':_0x59c4('0x9')}),'log':'CreateVoiceCallReport'});};exports['getVoiceCallReports']=function(){return function(){return client[_0x59c4('0xa')](_0x59c4('0xb'),{'options':{'where':{'type':[_0x59c4('0xc')],'createdAt':{'$between':[moment()['startOf'](_0x59c4('0xd'))[_0x59c4('0xe')](_0x59c4('0xf')),moment()[_0x59c4('0x10')](_0x59c4('0xd'))[_0x59c4('0xe')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0x59c4('0x11'),'disposition','duration','billableseconds']},'log':_0x59c4('0x12')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 4ba85f2..1597280 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 _0x9c5f=['Request','CreateVoiceDialReport','../client'];(function(_0x359d13,_0x1a5c53){var _0x29502d=function(_0x44786d){while(--_0x44786d){_0x359d13['push'](_0x359d13['shift']());}};_0x29502d(++_0x1a5c53);}(_0x9c5f,0x131));var _0xf9c5=function(_0x319873,_0x17dc7b){_0x319873=_0x319873-0x0;var _0x18f933=_0x9c5f[_0x319873];return _0x18f933;};'use strict';var client=require(_0xf9c5('0x0'));exports['create']=function(_0x51b7e9){return client[_0xf9c5('0x1')](_0xf9c5('0x2'),{'body':_0x51b7e9,'log':_0xf9c5('0x2')});}; \ No newline at end of file +var _0xd19a=['CreateVoiceDialReport','../client','create','Request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd19a,0xf1));var _0xad19=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xd19a[_0x413feb];return _0x40ee88;};'use strict';var client=require(_0xad19('0x0'));exports[_0xad19('0x1')]=function(_0x1594e3){return client[_0xad19('0x2')]('CreateVoiceDialReport',{'body':_0x1594e3,'log':_0xad19('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 760a647..8071f09 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 _0x96cc=['Request','exten','recordingFormat','getVoiceExtensions','../client'];(function(_0x426ab0,_0x13c67d){var _0x3bdb3d=function(_0x14f669){while(--_0x14f669){_0x426ab0['push'](_0x426ab0['shift']());}};_0x3bdb3d(++_0x13c67d);}(_0x96cc,0x16c));var _0xc96c=function(_0xa8d7ef,_0x4b8b3d){_0xa8d7ef=_0xa8d7ef-0x0;var _0x239d5e=_0x96cc[_0xa8d7ef];return _0x239d5e;};'use strict';var client=require(_0xc96c('0x0'));exports['getVoiceExtensions']=function(){return function(){return client[_0xc96c('0x1')]('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id',_0xc96c('0x2'),_0xc96c('0x3')],'where':{'VoiceExtensionId':null}},'log':_0xc96c('0x4')});};}; \ No newline at end of file +var _0x2750=['exten','recordingFormat','getVoiceExtensions','../client','Request','GetVoiceExtension'];(function(_0xf263fc,_0x3474b9){var _0x5471c3=function(_0x315aaa){while(--_0x315aaa){_0xf263fc['push'](_0xf263fc['shift']());}};_0x5471c3(++_0x3474b9);}(_0x2750,0x13b));var _0x0275=function(_0x509d2e,_0x307fde){_0x509d2e=_0x509d2e-0x0;var _0x292a85=_0x2750[_0x509d2e];return _0x292a85;};'use strict';var client=require(_0x0275('0x0'));exports['getVoiceExtensions']=function(){return function(){return client[_0x0275('0x1')](_0x0275('0x2'),{'options':{'raw':!![],'attributes':['id',_0x0275('0x3'),_0x0275('0x4')],'where':{'VoiceExtensionId':null}},'log':_0x0275('0x5')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 000ac8f..8ef5e9f 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 _0x2624=['acwTimeout','autopause','monitor_format','type','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialGlobalInterval','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialCutDigit','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMinThreshold','Trunk','callerid','Pause','mandatoryDispositionPause','TrunkBackup','Interval','interval','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw'];(function(_0x28d225,_0x43be18){var _0x1f79e1=function(_0x362c23){while(--_0x362c23){_0x28d225['push'](_0x28d225['shift']());}};_0x1f79e1(++_0x43be18);}(_0x2624,0x7a));var _0x4262=function(_0x5b3efe,_0x52b185){_0x5b3efe=_0x5b3efe-0x0;var _0x41857b=_0x2624[_0x5b3efe];return _0x41857b;};'use strict';var client=require(_0x4262('0x0'));exports[_0x4262('0x1')]=function(){return function(){return client[_0x4262('0x2')](_0x4262('0x3'),{'options':{'raw':![],'attributes':['id',_0x4262('0x4'),_0x4262('0x5'),_0x4262('0x6'),_0x4262('0x7'),_0x4262('0x8'),_0x4262('0x9'),'dialActive',_0x4262('0xa'),_0x4262('0xb'),_0x4262('0xc'),_0x4262('0xd'),_0x4262('0xe'),_0x4262('0xf'),_0x4262('0x10'),_0x4262('0x11'),'dialOriginateCallerIdNumber',_0x4262('0x12'),_0x4262('0x13'),_0x4262('0x14'),_0x4262('0x15'),_0x4262('0x16'),_0x4262('0x17'),_0x4262('0x18'),'dialBusyRetryFrequency',_0x4262('0x19'),_0x4262('0x1a'),_0x4262('0x1b'),'dialTimezone',_0x4262('0x1c'),'dialPrefix',_0x4262('0x1d'),_0x4262('0x1e'),_0x4262('0x1f'),_0x4262('0x20'),_0x4262('0x21'),_0x4262('0x22'),_0x4262('0x23'),_0x4262('0x24'),_0x4262('0x25'),'dialAMDSilenceThreshold',_0x4262('0x26'),_0x4262('0x27'),_0x4262('0x28'),_0x4262('0x29'),_0x4262('0x2a'),_0x4262('0x2b'),_0x4262('0x2c'),'dialQueueProject2',_0x4262('0x8'),'strategy','dialRandomLastDigitCallerIdNumber',_0x4262('0x2d'),'dialNoSuchNumberMaxRetry',_0x4262('0x2e'),_0x4262('0x2f'),_0x4262('0x30'),_0x4262('0x31'),_0x4262('0x32'),_0x4262('0x33'),_0x4262('0x34'),_0x4262('0x35'),_0x4262('0x36'),_0x4262('0x37'),'dialPredictiveIntervalMaxThreshold',_0x4262('0x38'),'dialPreviewAutoRecallMe','dialPreviewRecallmeReminder'],'include':[{'model':_0x4262('0x39'),'as':_0x4262('0x39'),'attributes':['id',_0x4262('0x4'),_0x4262('0x3a'),'active']},{'model':_0x4262('0x3b'),'as':_0x4262('0x3c'),'attributes':['id',_0x4262('0x4')]},{'model':_0x4262('0x39'),'as':_0x4262('0x3d'),'attributes':['id','name','callerid','active']},{'model':_0x4262('0x3e'),'as':'Interval','attributes':['id',_0x4262('0x4')],'include':[{'model':'Interval','as':'Intervals','attributes':['id',_0x4262('0x4'),_0x4262('0x3f')]}]}]},'log':_0x4262('0x1')});};}; \ No newline at end of file +var _0x2ec8=['dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','timeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','name','callerid','active','Pause','TrunkBackup','Interval','getVoiceQueues','Request','GetVoiceQueue','acw','acwTimeout','autopause','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialQueueTimeout','dialQueueProject','dialCongestionRetryFrequency','dialBusyMaxRetry','dialNoAnswerMaxRetry','dialTimezone','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence'];(function(_0x6d7668,_0x594760){var _0x29d542=function(_0x348627){while(--_0x348627){_0x6d7668['push'](_0x6d7668['shift']());}};_0x29d542(++_0x594760);}(_0x2ec8,0x185));var _0x82ec=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x2ec8[_0x2dafbe];return _0x58a45a;};'use strict';var client=require('../client');exports[_0x82ec('0x0')]=function(){return function(){return client[_0x82ec('0x1')](_0x82ec('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x82ec('0x3'),_0x82ec('0x4'),_0x82ec('0x5'),_0x82ec('0x6'),_0x82ec('0x7'),_0x82ec('0x8'),_0x82ec('0x9'),_0x82ec('0xa'),'dialLimitQueue',_0x82ec('0xb'),_0x82ec('0xc'),_0x82ec('0xd'),_0x82ec('0xe'),_0x82ec('0xf'),_0x82ec('0x10'),'dialOriginateTimeout','dialQueueOptions',_0x82ec('0x11'),_0x82ec('0x12'),'dialCongestionMaxRetry',_0x82ec('0x13'),_0x82ec('0x14'),'dialBusyRetryFrequency',_0x82ec('0x15'),'dialNoAnswerRetryFrequency','dialGlobalMaxRetry',_0x82ec('0x16'),'dialGlobalInterval',_0x82ec('0x17'),_0x82ec('0x18'),_0x82ec('0x19'),_0x82ec('0x1a'),_0x82ec('0x1b'),_0x82ec('0x1c'),'dialAMDTotalAnalysisTime',_0x82ec('0x1d'),_0x82ec('0x1e'),_0x82ec('0x1f'),_0x82ec('0x20'),'dialAMDMaximumWordLength',_0x82ec('0x21'),'dialRecallMeTimeout',_0x82ec('0x22'),_0x82ec('0x23'),_0x82ec('0x24'),_0x82ec('0x25'),'dialQueueProject2',_0x82ec('0x6'),_0x82ec('0x26'),_0x82ec('0x27'),_0x82ec('0x28'),_0x82ec('0x29'),_0x82ec('0x2a'),_0x82ec('0x2b'),'dialDropRetryFrequency','dialAbandonedMaxRetry',_0x82ec('0x2c'),_0x82ec('0x2d'),_0x82ec('0x2e'),_0x82ec('0x2f'),_0x82ec('0x30'),_0x82ec('0x31'),_0x82ec('0x32'),'dialPredictiveIntervalMinThreshold',_0x82ec('0x33'),_0x82ec('0x34')],'include':[{'model':_0x82ec('0x35'),'as':_0x82ec('0x35'),'attributes':['id',_0x82ec('0x36'),_0x82ec('0x37'),_0x82ec('0x38')]},{'model':_0x82ec('0x39'),'as':'mandatoryDispositionPause','attributes':['id',_0x82ec('0x36')]},{'model':'Trunk','as':_0x82ec('0x3a'),'attributes':['id','name','callerid',_0x82ec('0x38')]},{'model':_0x82ec('0x3b'),'as':'Interval','attributes':['id',_0x82ec('0x36')],'include':[{'model':'Interval','as':'Intervals','attributes':['id',_0x82ec('0x36'),'interval']}]}]},'log':_0x82ec('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index b711ed8..7e9173b 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(_0x34d612,_0x6ca002){var _0x155246=function(_0x100d22){while(--_0x100d22){_0x34d612['push'](_0x34d612['shift']());}};_0x155246(++_0x6ca002);}(_0xa9e0,0x123));var _0x0a9e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa9e0[_0xa1e3e3];return _0xc980e9;};'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(_0xe50da3,_0x54315c){var _0x4ae019=function(_0x5bca3f){while(--_0x5bca3f){_0xe50da3['push'](_0xe50da3['shift']());}};_0x4ae019(++_0x54315c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa9e0[_0x2dafbe];return _0x58a45a;};'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 9a058a9..8f33510 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 _0x4bf1=['Request','getVoiceQueueRtPauses'];(function(_0x590a38,_0x2bc65c){var _0xf36626=function(_0x551cd1){while(--_0x551cd1){_0x590a38['push'](_0x590a38['shift']());}};_0xf36626(++_0x2bc65c);}(_0x4bf1,0x106));var _0x14bf=function(_0x32732e,_0x106af4){_0x32732e=_0x32732e-0x0;var _0x37b339=_0x4bf1[_0x32732e];return _0x37b339;};'use strict';var client=require('../client');exports['getVoiceQueueRtPauses']=function(_0x26d55c){return function(){return client[_0x14bf('0x0')]('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x26d55c,'paused':!![]},'raw':!![]},'log':_0x14bf('0x1')});};}; \ No newline at end of file +var _0x504b=['getVoiceQueueRtPauses','GetVoiceQueueRtPauses','../client'];(function(_0x2550ce,_0x45209b){var _0x25748d=function(_0x806ad5){while(--_0x806ad5){_0x2550ce['push'](_0x2550ce['shift']());}};_0x25748d(++_0x45209b);}(_0x504b,0xbc));var _0xb504=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x504b[_0x321bb2];return _0x9c12ed;};'use strict';var client=require(_0xb504('0x0'));exports[_0xb504('0x1')]=function(_0x441bf3){return function(){return client['Request'](_0xb504('0x2'),{'options':{'where':{'VoiceQueueId':_0x441bf3,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 143e821..f220ad6 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(_0x26bef4,_0x3ce7cd){var _0x301c15=function(_0x9a21b2){while(--_0x9a21b2){_0x26bef4['push'](_0x26bef4['shift']());}};_0x301c15(++_0x3ce7cd);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'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(_0x5533eb,_0x442cfa){var _0x555d8a=function(_0x50356e){while(--_0x50356e){_0x5533eb['push'](_0x5533eb['shift']());}};_0x555d8a(++_0x442cfa);}(_0x9957,0x93));var _0x7995=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9957[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 1065fb7..3d576e0 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 _0x382f=['result','transfererchannel','transferercalleridnum','transfererconnectedlinenum','transfererconnectedlinename','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereelinkedid','context','extension','blind','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','isexternal','origtransfererexten','attended','transfers','blindTransfer','Request','CreateVoiceTransferReport'];(function(_0x301196,_0xf69db4){var _0x5c4011=function(_0x19912b){while(--_0x19912b){_0x301196['push'](_0x301196['shift']());}};_0x5c4011(++_0xf69db4);}(_0x382f,0x13c));var _0xf382=function(_0x471702,_0x313088){_0x471702=_0x471702-0x0;var _0x2598a8=_0x382f[_0x471702];return _0x2598a8;};'use strict';var client=require('../client');exports[_0xf382('0x0')]={};exports[_0xf382('0x1')]=function(_0x1fe73c){return client[_0xf382('0x2')](_0xf382('0x3'),{'body':{'result':_0x1fe73c[_0xf382('0x4')],'transfererchannel':_0x1fe73c[_0xf382('0x5')],'transferercalleridnum':_0x1fe73c[_0xf382('0x6')],'transferercalleridname':_0x1fe73c['transferercalleridname'],'transfererconnectedlinenum':_0x1fe73c[_0xf382('0x7')],'transfererconnectedlinename':_0x1fe73c[_0xf382('0x8')],'transfereraccountcode':_0x1fe73c['transfereraccountcode'],'transferercontext':_0x1fe73c[_0xf382('0x9')],'transfererexten':_0x1fe73c[_0xf382('0xa')],'transfererlinkedid':_0x1fe73c[_0xf382('0xb')],'transfereechannel':_0x1fe73c[_0xf382('0xc')],'transfereecalleridnum':_0x1fe73c[_0xf382('0xd')],'transfereecalleridname':_0x1fe73c['transfereecalleridname'],'transfereeconnectedlinenum':_0x1fe73c[_0xf382('0xe')],'transfereeconnectedlinename':_0x1fe73c[_0xf382('0xf')],'transfereeaccountcode':_0x1fe73c[_0xf382('0x10')],'transfereecontext':_0x1fe73c[_0xf382('0x11')],'transfereeexten':_0x1fe73c['transfereeexten'],'transfereelinkedid':_0x1fe73c[_0xf382('0x12')],'isexternal':_0x1fe73c['isexternal'],'context':_0x1fe73c[_0xf382('0x13')],'extension':_0x1fe73c[_0xf382('0x14')],'type':_0xf382('0x15')},'log':_0xf382('0x3')});};exports['attendedTransfer']=function(_0x152935){return client[_0xf382('0x2')](_0xf382('0x3'),{'body':{'result':_0x152935[_0xf382('0x4')],'transfererchannel':_0x152935[_0xf382('0x16')],'transferercalleridnum':_0x152935[_0xf382('0x17')],'transferercalleridname':_0x152935[_0xf382('0x18')],'transfererconnectedlinenum':_0x152935[_0xf382('0x19')],'transfererconnectedlinename':_0x152935[_0xf382('0x1a')],'transfereraccountcode':_0x152935[_0xf382('0x1b')],'transferercontext':_0x152935[_0xf382('0x1c')],'transfererexten':_0x152935[_0xf382('0x1d')],'transfererlinkedid':_0x152935['origtransfererlinkedid'],'transfereechannel':_0x152935[_0xf382('0x1e')],'transfereecalleridnum':_0x152935[_0xf382('0x1f')],'transfereecalleridname':_0x152935[_0xf382('0x20')],'transfereeconnectedlinenum':_0x152935['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x152935[_0xf382('0x21')],'transfereeaccountcode':_0x152935[_0xf382('0x22')],'transfereecontext':_0x152935['transfertargetcontext'],'transfereeexten':_0x152935[_0xf382('0x23')],'transfereelinkedid':_0x152935[_0xf382('0x24')],'isexternal':_0x152935[_0xf382('0x25')],'context':_0x152935['origtransferercontext'],'extension':_0x152935[_0xf382('0x26')],'type':_0xf382('0x27')},'log':_0xf382('0x3')});}; \ No newline at end of file +var _0x7a1a=['transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererlinkedid','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','isexternal','extension','blind','Request','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinename','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetlinkedid','origtransferercontext','origtransfererexten','../client','transfers','blindTransfer','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname'];(function(_0x6e9de7,_0x2424fa){var _0x5edbc9=function(_0x248c94){while(--_0x248c94){_0x6e9de7['push'](_0x6e9de7['shift']());}};_0x5edbc9(++_0x2424fa);}(_0x7a1a,0xbb));var _0xa7a1=function(_0x1d638a,_0x2c4d2b){_0x1d638a=_0x1d638a-0x0;var _0x59a099=_0x7a1a[_0x1d638a];return _0x59a099;};'use strict';var client=require(_0xa7a1('0x0'));exports[_0xa7a1('0x1')]={};exports[_0xa7a1('0x2')]=function(_0x32bbea){return client['Request'](_0xa7a1('0x3'),{'body':{'result':_0x32bbea[_0xa7a1('0x4')],'transfererchannel':_0x32bbea[_0xa7a1('0x5')],'transferercalleridnum':_0x32bbea[_0xa7a1('0x6')],'transferercalleridname':_0x32bbea[_0xa7a1('0x7')],'transfererconnectedlinenum':_0x32bbea[_0xa7a1('0x8')],'transfererconnectedlinename':_0x32bbea[_0xa7a1('0x9')],'transfereraccountcode':_0x32bbea[_0xa7a1('0xa')],'transferercontext':_0x32bbea[_0xa7a1('0xb')],'transfererexten':_0x32bbea['transfererexten'],'transfererlinkedid':_0x32bbea[_0xa7a1('0xc')],'transfereechannel':_0x32bbea['transfereechannel'],'transfereecalleridnum':_0x32bbea[_0xa7a1('0xd')],'transfereecalleridname':_0x32bbea[_0xa7a1('0xe')],'transfereeconnectedlinenum':_0x32bbea[_0xa7a1('0xf')],'transfereeconnectedlinename':_0x32bbea[_0xa7a1('0x10')],'transfereeaccountcode':_0x32bbea[_0xa7a1('0x11')],'transfereecontext':_0x32bbea[_0xa7a1('0x12')],'transfereeexten':_0x32bbea['transfereeexten'],'transfereelinkedid':_0x32bbea['transfereelinkedid'],'isexternal':_0x32bbea[_0xa7a1('0x13')],'context':_0x32bbea['context'],'extension':_0x32bbea[_0xa7a1('0x14')],'type':_0xa7a1('0x15')},'log':_0xa7a1('0x3')});};exports['attendedTransfer']=function(_0x2545de){return client[_0xa7a1('0x16')](_0xa7a1('0x3'),{'body':{'result':_0x2545de[_0xa7a1('0x4')],'transfererchannel':_0x2545de[_0xa7a1('0x17')],'transferercalleridnum':_0x2545de[_0xa7a1('0x18')],'transferercalleridname':_0x2545de[_0xa7a1('0x19')],'transfererconnectedlinenum':_0x2545de['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x2545de[_0xa7a1('0x1a')],'transfereraccountcode':_0x2545de['origtransfereraccountcode'],'transferercontext':_0x2545de['secondtransferercontext'],'transfererexten':_0x2545de[_0xa7a1('0x1b')],'transfererlinkedid':_0x2545de[_0xa7a1('0x1c')],'transfereechannel':_0x2545de[_0xa7a1('0x1d')],'transfereecalleridnum':_0x2545de[_0xa7a1('0x1e')],'transfereecalleridname':_0x2545de[_0xa7a1('0x1f')],'transfereeconnectedlinenum':_0x2545de[_0xa7a1('0x20')],'transfereeconnectedlinename':_0x2545de[_0xa7a1('0x21')],'transfereeaccountcode':_0x2545de[_0xa7a1('0x22')],'transfereecontext':_0x2545de[_0xa7a1('0x23')],'transfereeexten':_0x2545de['transfertargetexten'],'transfereelinkedid':_0x2545de[_0xa7a1('0x24')],'isexternal':_0x2545de[_0xa7a1('0x13')],'context':_0x2545de[_0xa7a1('0x25')],'extension':_0x2545de[_0xa7a1('0x26')],'type':'attended'},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index a13e7c3..9a019f8 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 _0x7a54=['http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','moment','../../../config/environment','../ami','../model/voiceQueueSummary','listen','name','timers','updateAcw','agents','updateStatusRealtime','voiceStatus','pause','isConnected','error','asterisk','ami\x20disconnected','join','pick','keys','reload','Reload','message','catch','username','command','action','Command','then','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','channels','validate','map','uniqueid','channel','format','wav','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','isNil','toLowerCase','mixmonitorid','rec','status','Channel\x20doesn\x27t\x20exist','Action','StopMixMonitor','destinationchannel','stop','filename','queueChannels','type','outbound','includes','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannelhangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','run','custom:','event','faxAccounts','send'];(function(_0x526a78,_0x1e4f84){var _0x46a37c=function(_0x7094f8){while(--_0x7094f8){_0x526a78['push'](_0x526a78['shift']());}};_0x46a37c(++_0x1e4f84);}(_0x7a54,0x106));var _0x47a5=function(_0x5b0a32,_0xe4048f){_0x5b0a32=_0x5b0a32-0x0;var _0x47dd0d=_0x7a54[_0x5b0a32];return _0x47dd0d;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var jayson=require(_0x47a5('0x2'));var schema=require('validate');var moment=require(_0x47a5('0x3'));var config=require(_0x47a5('0x4'));var properties=require('../properties');var ami=require(_0x47a5('0x5'));var VoiceQueueSummary=require(_0x47a5('0x6'));exports[_0x47a5('0x7')]=function(_0x3717e1,_0xfdf934,_0x545a97){return new Promise(function(_0x3d5629,_0x59199c){var _0x343372={'QueuePause':function(_0x30e405){return new Promise(function(_0x506eda){var _0x194fb0=util['format']('%s/%s','SIP',_0x30e405[_0x47a5('0x8')]);if(_0x3717e1[_0x47a5('0x9')]&&_0x3717e1['timers'][_0x194fb0]&&_0x3717e1[_0x47a5('0x9')][_0x194fb0]['timer']){_0x3717e1['timers'][_0x194fb0][_0x47a5('0xa')]();}if(_0x3717e1[_0x47a5('0xb')][_0x194fb0]){_0x3717e1[_0x47a5('0xb')][_0x194fb0][_0x47a5('0xc')]({'state':_0x3717e1[_0x47a5('0xb')][_0x194fb0][_0x47a5('0xd')],'statePause':_0x30e405[_0x47a5('0xe')]?!![]:![]});}_0x506eda({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x44bd3e){var _0x221b54=this;return new Promise(function(_0x1cf309,_0x711793){if(ami[_0x47a5('0xf')]()==![]){return _0x711793(_0x221b54[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}_0x44bd3e=_[_0x47a5('0x14')](_0x44bd3e,_[_0x47a5('0x15')](properties[_0x47a5('0x16')]['module']));_0x44bd3e['action']=_0x47a5('0x17');return ami['Action'](_0x44bd3e)['then'](function(_0x423a81){_0x1cf309({'code':0xc8,'message':_0x423a81[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x1ef371){_0x711793(_0x221b54[_0x47a5('0x10')](0x1f5,_0x1ef371[_0x47a5('0x18')]));});});},'Command':function(_0x2763d6){var _0xe3c618=this;return new Promise(function(_0x3aed38,_0x4a9fcb){if(ami[_0x47a5('0xf')]()==![]){return _0x4a9fcb(_0xe3c618[_0x47a5('0x10')](0x1f4,[config['asterisk']['ip'],config[_0x47a5('0x11')][_0x47a5('0x1a')],_0x47a5('0x12')]['join']('\x20')));}_0x2763d6=_[_0x47a5('0x14')](_0x2763d6,_0x47a5('0x1b'));_0x2763d6[_0x47a5('0x1c')]=_0x47a5('0x1d');return ami['Action'](_0x2763d6)[_0x47a5('0x1e')](function(_0x385687){_0x3aed38({'code':0xc8,'message':_0x385687['content']});})[_0x47a5('0x19')](function(_0xc4cd63){_0x4a9fcb(_0xe3c618[_0x47a5('0x10')](0x1f5,_0xc4cd63[_0x47a5('0x18')]));});});},'VoiceQueues':function(){return new Promise(function(_0x3abd6a){var _0x50bf17=[];for(var _0x53078a in _0x3717e1[_0x47a5('0x1f')]){if(_0x3717e1['voiceQueues'][_0x47a5('0x20')](_0x53078a)){var _0x5b6c4e=_0x3717e1[_0x47a5('0x1f')][_0x53078a];var _0x378208=new VoiceQueueSummary(_0x5b6c4e);_0x50bf17[_0x47a5('0x21')](_0x378208);}}_0x3abd6a({'count':_0x50bf17[_0x47a5('0x22')],'rows':_0x50bf17});});},'UpdateVoiceQueue':function(_0x21f296){return new Promise(function(_0x3ba0b7,_0x24b162){var _0x136b14=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x1f')],{'id':parseInt(_0x21f296['id'])});var _0x1127f8=_[_0x47a5('0x24')](_0x21f296,['id']);if(_0x136b14){for(var _0x3ad507 in _0x1127f8){if(typeof _0x1127f8[_0x3ad507]!=='undefined'&&typeof _0x136b14[_0x3ad507]!==_0x47a5('0x25')){_0x136b14[_0x3ad507]=_0x1127f8[_0x3ad507];}}_0x3ba0b7(_0x136b14);}else{_0x24b162();}});},'VoiceChannels':function(){return new Promise(function(_0x51833b){var _0x2ef875=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x27')]);_0x51833b({'count':_0x2ef875['length'],'rows':_0x2ef875});});},'VoiceChannelMixMonitor':function(_0x256650){var _0x625952=this;return new Promise(function(_0x39b50b,_0x1f1c68){if(ami['isConnected']()==![]){return _0x1f1c68(_0x625952['error'](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],'ami\x20disconnected'][_0x47a5('0x13')]('\x20')));}var _0x51544e=schema(properties['voicechannel'])[_0x47a5('0x28')](_0x256650);if(_0x51544e['length']>0x0){return _0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x51544e,'message')['join'](',\x20')));}var _0x274e34=_['find'](_0x3717e1[_0x47a5('0x27')],{'uniqueid':_0x256650[_0x47a5('0x2a')]});if(_0x274e34&&_0x274e34[_0x47a5('0x2b')]){var _0x52749b=util[_0x47a5('0x2c')]('%s.%s',_0x256650['filename']||_0x256650[_0x47a5('0x2a')],_0x256650['format']||_0x47a5('0x2d'));return ami['Action']({'action':_0x47a5('0x2e'),'channel':_0x274e34[_0x47a5('0x2b')],'file':_0x52749b,'options':_0x47a5('0x2f')})[_0x47a5('0x1e')](function(_0x36add5){var _0xed6320=_[_0x47a5('0x23')](_0x274e34[_0x47a5('0x30')],{'filename':_0x47a5('0x31')+_0x52749b['toLowerCase']()});if(_[_0x47a5('0x32')](_0xed6320)){_0x274e34[_0x47a5('0x30')]['push']({'filename':_0x47a5('0x31')+_0x52749b[_0x47a5('0x33')](),'createdAt':moment()[_0x47a5('0x2c')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x36add5[_0x47a5('0x34')],'status':_0x47a5('0x35')});}else{_0xed6320['mixmonitorid']=_0x36add5[_0x47a5('0x34')];_0xed6320[_0x47a5('0x36')]='rec';}_0x39b50b({'code':0xc8,'message':[_0x256650['uniqueid'],'MixMonitor\x20Success',_0x36add5[_0x47a5('0x34')]]['join']('\x20'),'mixmonitorid':_0x36add5[_0x47a5('0x34')]});})[_0x47a5('0x19')](function(_0x301a85){_0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f5,[_0x256650[_0x47a5('0x2a')],_0x301a85[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f5,_0x47a5('0x37')));}});},'VoiceChannelStopMixMonitor':function(_0x280500){var _0x1658e8=this;return new Promise(function(_0x23d6d8,_0x56dbbd){if(ami[_0x47a5('0xf')]()==![]){return _0x56dbbd(_0x1658e8[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],_0x47a5('0x12')]['join']('\x20')));}var _0x47c7a2=schema(properties['voicechannel'])['validate'](_0x280500);if(_0x47c7a2[_0x47a5('0x22')]>0x0){return _0x56dbbd(_0x1658e8['error'](0x1f4,_[_0x47a5('0x29')](_0x47c7a2,_0x47a5('0x18'))[_0x47a5('0x13')](',\x20')));}var _0x494526=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x27')],{'uniqueid':_0x280500['uniqueid']});if(_0x494526){return Promise['resolve']()[_0x47a5('0x1e')](function(){if(_0x494526['channel']){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x39'),'channel':_0x494526[_0x47a5('0x2b')],'mixmonitorid':_0x280500[_0x47a5('0x34')]})[_0x47a5('0x19')](function(){});}})[_0x47a5('0x1e')](function(){if(_0x494526[_0x47a5('0x3a')]){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x39'),'channel':_0x494526[_0x47a5('0x3a')],'mixmonitorid':_0x280500[_0x47a5('0x34')]})[_0x47a5('0x19')](function(){});}})[_0x47a5('0x1e')](function(){var _0x3574d4=_[_0x47a5('0x23')](_0x494526[_0x47a5('0x30')],{'mixmonitorid':_0x280500['mixmonitorid']});if(_0x3574d4){_0x3574d4[_0x47a5('0x36')]=_0x47a5('0x3b');}})['then'](function(){var _0x52b3a8=util[_0x47a5('0x2c')]('%s.%s',_0x280500[_0x47a5('0x3c')]||_0x280500[_0x47a5('0x2a')],_0x280500['format']||'wav');var _0x3d85cc=_['find'](_0x494526[_0x47a5('0x30')],{'filename':_0x47a5('0x31')+_0x52b3a8[_0x47a5('0x33')]()});if(_0x3d85cc){_0x3d85cc[_0x47a5('0x36')]=_0x47a5('0x3b');}})[_0x47a5('0x1e')](function(){_0x23d6d8({'code':0xc8,'message':[_0x280500[_0x47a5('0x2a')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0x47a5('0x19')](function(_0x411230){_0x56dbbd(_0x1658e8[_0x47a5('0x10')](0x1f5,[_0x280500[_0x47a5('0x2a')],_0x411230[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x56dbbd(_0x1658e8['error'](0x1f5,_0x47a5('0x37')));}});},'VoiceQueuesChannels':function(_0x1c9a62){var _0x5f6a=this;return new Promise(function(_0x5c3c75){var _0x12ca40=_['values'](_0x3717e1[_0x47a5('0x3d')]);var _0xe31817={'count':_0x12ca40[_0x47a5('0x22')],'rows':_0x12ca40};if(_0x1c9a62&&_0x1c9a62[_0x47a5('0x3e')]){if(!['inbound',_0x47a5('0x3f')][_0x47a5('0x40')](_0x1c9a62[_0x47a5('0x3e')])){return _0x59199c(_0x5f6a[_0x47a5('0x10')](0x190,_0x47a5('0x41')));}var _0x6a53b3=_[_0x47a5('0x42')](_0x12ca40,function(_0x481089){return _0x481089[_0x47a5('0x3e')]===_0x1c9a62[_0x47a5('0x3e')];});_0xe31817[_0x47a5('0x43')]=_0x6a53b3[_0x47a5('0x22')];_0xe31817[_0x47a5('0x44')]=_0x6a53b3;}_0x5c3c75(_0xe31817);});},'VoiceQueuesChannel':function(_0x1ab0bf){var _0x572233=this;return new Promise(function(_0x1ad6a9,_0x245a15){var _0x1aa581=schema(properties['voicequeuechannel'])[_0x47a5('0x28')](_0x1ab0bf);if(_0x1aa581[_0x47a5('0x22')]>0x0){return _0x245a15(_0x572233[_0x47a5('0x10')](0x1f4,_['map'](_0x1aa581,'message')[_0x47a5('0x13')](',\x20')));}var _0x376e1d=_['find'](_0x3717e1['queueChannels'],{'uniqueid':_0x1ab0bf[_0x47a5('0x2a')]});if(_0x376e1d){_0x1ad6a9(_0x376e1d);}else{return _0x245a15(_0x572233['error'](0x1f5,_0x47a5('0x37')));}});},'VoiceQueuesChannelHangup':function(_0x5d383d){var _0x482de6=this;return new Promise(function(_0x389ed9,_0x46d2d3){if(ami['isConnected']()==![]){return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config['asterisk']['username'],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}var _0x867da0=schema(properties[_0x47a5('0x45')])['validate'](_0x5d383d);if(_0x867da0[_0x47a5('0x22')]>0x0){return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x867da0,'message')[_0x47a5('0x13')](',\x20')));}var _0x4db625=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x3d')],{'uniqueid':_0x5d383d[_0x47a5('0x2a')]});if(_0x4db625&&_0x4db625[_0x47a5('0x2b')]){return ami[_0x47a5('0x38')]({'action':'Hangup','channel':_0x4db625[_0x47a5('0x2b')]})['then'](function(_0x5cbe97){_0x389ed9({'code':0xc8,'message':[_0x5d383d['uniqueid'],_0x5cbe97['message'][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')});})[_0x47a5('0x19')](function(_0x52e3ee){_0x46d2d3(_0x482de6['error'](0x1f5,[_0x5d383d[_0x47a5('0x2a')],_0x52e3ee[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x3474b7){var _0x519e9e=this;return new Promise(function(_0x22c886,_0x274d31){if(ami['isConnected']()==![]){return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')][_0x47a5('0x1a')],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}var _0x35cca8=schema(properties[_0x47a5('0x46')])['validate'](_0x3474b7);if(_0x35cca8[_0x47a5('0x22')]>0x0){return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x35cca8,_0x47a5('0x18'))[_0x47a5('0x13')](',\x20')));}var _0x4bbe14=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x3d')],{'uniqueid':_0x3474b7[_0x47a5('0x2a')]});if(_0x4bbe14&&_0x4bbe14[_0x47a5('0x2b')]){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x47'),'channel':_0x4bbe14[_0x47a5('0x2b')],'exten':_0x3474b7[_0x47a5('0x48')],'context':_0x3474b7[_0x47a5('0x49')]||_0x4bbe14[_0x47a5('0x49')],'priority':0x1})[_0x47a5('0x1e')](function(_0x44fda9){_0x22c886({'code':0xc8,'message':[_0x3474b7[_0x47a5('0x2a')],_0x44fda9[_0x47a5('0x18')][_0x47a5('0x33')]()]['join']('\x20')});})[_0x47a5('0x19')](function(_0x284fb8){_0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f5,[_0x3474b7['uniqueid'],_0x284fb8[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x3ac402){return new Promise(function(_0x522ccf){var _0x2d5ee6=_['values'](_0x3717e1[_0x47a5('0xb')]);if(_0x3ac402&&_0x3ac402['id']){var _0x4cf7c5=_[_0x47a5('0x23')](_0x2d5ee6,function(_0x2f27c3){return _0x2f27c3['id']===_0x3ac402['id'];});_0x522ccf(_0x4cf7c5);}else{_0x522ccf({'count':_0x2d5ee6[_0x47a5('0x22')],'rows':_0x2d5ee6});}});},'Telephones':function(){return new Promise(function(_0x58473b){var _0x4af557=_['values'](_0x3717e1[_0x47a5('0x4a')]);_0x58473b({'count':_0x4af557[_0x47a5('0x22')],'rows':_0x4af557});});},'Trunks':function(){return new Promise(function(_0xe3c0a7){var _0x117510=_['values'](_0x3717e1[_0x47a5('0x4b')]);_0xe3c0a7({'count':_0x117510[_0x47a5('0x22')],'rows':_0x117510});});},'OutboundChannels':function(){return new Promise(function(_0x390bc0){var _0xd5b23f=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x4c')]);_0x390bc0({'count':_0xd5b23f[_0x47a5('0x22')],'rows':_0xd5b23f});});},'Outbound':function(){return new Promise(function(_0x39939a){_0x39939a(_0x3717e1[_0x47a5('0x3f')]);});},'Campaigns':function(){return new Promise(function(_0xc69a68){var _0x2e6fcc=_[_0x47a5('0x26')](_0x3717e1['campaigns']);_0xc69a68({'count':_0x2e6fcc[_0x47a5('0x22')],'rows':_0x2e6fcc});});},'VoiceQueuesPreview':function(_0x4833be){var _0x2ad00a=this;return new Promise(function(_0x2ac30f,_0x281e5f){_0xfdf934[_0x47a5('0x4d')](_0x4833be['id'])[_0x47a5('0x1e')](function(_0xa9c853){_0x2ac30f({'code':0xc8,'message':_0xa9c853[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x11c1db){_0x281e5f(_0x2ad00a[_0x47a5('0x10')](0x1f4,_0x11c1db[_0x47a5('0x18')]));});});},'EventManager':function(_0x1f07ac){var _0x8f0035=this;return new Promise(function(_0x2d434c,_0x441d64){if(!_0x1f07ac['event']){return _0x441d64(_0x8f0035['error'](0x1f4,'Event\x20name\x20mandatory'));}ami['emit'](_0x47a5('0x4e')+_0x1f07ac[_0x47a5('0x4f')],_0x1f07ac['message']);_0x2d434c({'code':0xc8,'message':_0x1f07ac});});},'FaxAccounts':function(){return new Promise(function(_0x732e00){var _0x44dda2=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x50')]);_0x732e00({'count':_0x44dda2[_0x47a5('0x22')],'rows':_0x44dda2});});},'SendFax':function(_0x930d25){var _0x218dfa=this;return new Promise(function(_0x1c7302,_0x2e9a96){_0x545a97[_0x47a5('0x51')](_0x930d25)[_0x47a5('0x1e')](function(_0x5e5f16){_0x1c7302({'code':0xc8,'message':_0x5e5f16[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x420671){_0x2e9a96(_0x218dfa['error'](0x1f4,_0x420671[_0x47a5('0x18')]));});});},'CheckAfterSend':function(_0x32f393){var _0x17b61d=this;return new Promise(function(_0x5d41d8,_0x19dc8c){_0x545a97['checkAfterSend'](_0x32f393)['then'](function(_0x356e16){_0x5d41d8({'code':0xc8,'message':_0x356e16[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x27333e){_0x19dc8c(_0x17b61d[_0x47a5('0x10')](0x1f4,_0x27333e[_0x47a5('0x18')]));});});}};var _0x479a82=jayson['server'](_0x343372)[_0x47a5('0x52')]();_0x479a82['on']('error',function(_0x24dbee){return _0x59199c(_0x24dbee);});_0x479a82[_0x47a5('0x7')](0x232a,_0x47a5('0x53'),function(){console[_0x47a5('0x54')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x3d5629(_0x47a5('0x55')+0x232a);});});}; \ No newline at end of file +var _0x7a54=['http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','moment','../../../config/environment','../ami','../model/voiceQueueSummary','listen','name','timers','updateAcw','agents','updateStatusRealtime','voiceStatus','pause','isConnected','error','asterisk','ami\x20disconnected','join','pick','keys','reload','Reload','message','catch','username','command','action','Command','then','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','channels','validate','map','uniqueid','channel','format','wav','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','isNil','toLowerCase','mixmonitorid','rec','status','Channel\x20doesn\x27t\x20exist','Action','StopMixMonitor','destinationchannel','stop','filename','queueChannels','type','outbound','includes','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannelhangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','run','custom:','event','faxAccounts','send'];(function(_0x2b8b2f,_0x29b648){var _0x30996b=function(_0x1619d1){while(--_0x1619d1){_0x2b8b2f['push'](_0x2b8b2f['shift']());}};_0x30996b(++_0x29b648);}(_0x7a54,0x106));var _0x47a5=function(_0x2a474f,_0x2a2e8d){_0x2a474f=_0x2a474f-0x0;var _0x277d0f=_0x7a54[_0x2a474f];return _0x277d0f;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var jayson=require(_0x47a5('0x2'));var schema=require('validate');var moment=require(_0x47a5('0x3'));var config=require(_0x47a5('0x4'));var properties=require('../properties');var ami=require(_0x47a5('0x5'));var VoiceQueueSummary=require(_0x47a5('0x6'));exports[_0x47a5('0x7')]=function(_0x3717e1,_0xfdf934,_0x545a97){return new Promise(function(_0x3d5629,_0x59199c){var _0x343372={'QueuePause':function(_0x30e405){return new Promise(function(_0x506eda){var _0x194fb0=util['format']('%s/%s','SIP',_0x30e405[_0x47a5('0x8')]);if(_0x3717e1[_0x47a5('0x9')]&&_0x3717e1['timers'][_0x194fb0]&&_0x3717e1[_0x47a5('0x9')][_0x194fb0]['timer']){_0x3717e1['timers'][_0x194fb0][_0x47a5('0xa')]();}if(_0x3717e1[_0x47a5('0xb')][_0x194fb0]){_0x3717e1[_0x47a5('0xb')][_0x194fb0][_0x47a5('0xc')]({'state':_0x3717e1[_0x47a5('0xb')][_0x194fb0][_0x47a5('0xd')],'statePause':_0x30e405[_0x47a5('0xe')]?!![]:![]});}_0x506eda({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x44bd3e){var _0x221b54=this;return new Promise(function(_0x1cf309,_0x711793){if(ami[_0x47a5('0xf')]()==![]){return _0x711793(_0x221b54[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}_0x44bd3e=_[_0x47a5('0x14')](_0x44bd3e,_[_0x47a5('0x15')](properties[_0x47a5('0x16')]['module']));_0x44bd3e['action']=_0x47a5('0x17');return ami['Action'](_0x44bd3e)['then'](function(_0x423a81){_0x1cf309({'code':0xc8,'message':_0x423a81[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x1ef371){_0x711793(_0x221b54[_0x47a5('0x10')](0x1f5,_0x1ef371[_0x47a5('0x18')]));});});},'Command':function(_0x2763d6){var _0xe3c618=this;return new Promise(function(_0x3aed38,_0x4a9fcb){if(ami[_0x47a5('0xf')]()==![]){return _0x4a9fcb(_0xe3c618[_0x47a5('0x10')](0x1f4,[config['asterisk']['ip'],config[_0x47a5('0x11')][_0x47a5('0x1a')],_0x47a5('0x12')]['join']('\x20')));}_0x2763d6=_[_0x47a5('0x14')](_0x2763d6,_0x47a5('0x1b'));_0x2763d6[_0x47a5('0x1c')]=_0x47a5('0x1d');return ami['Action'](_0x2763d6)[_0x47a5('0x1e')](function(_0x385687){_0x3aed38({'code':0xc8,'message':_0x385687['content']});})[_0x47a5('0x19')](function(_0xc4cd63){_0x4a9fcb(_0xe3c618[_0x47a5('0x10')](0x1f5,_0xc4cd63[_0x47a5('0x18')]));});});},'VoiceQueues':function(){return new Promise(function(_0x3abd6a){var _0x50bf17=[];for(var _0x53078a in _0x3717e1[_0x47a5('0x1f')]){if(_0x3717e1['voiceQueues'][_0x47a5('0x20')](_0x53078a)){var _0x5b6c4e=_0x3717e1[_0x47a5('0x1f')][_0x53078a];var _0x378208=new VoiceQueueSummary(_0x5b6c4e);_0x50bf17[_0x47a5('0x21')](_0x378208);}}_0x3abd6a({'count':_0x50bf17[_0x47a5('0x22')],'rows':_0x50bf17});});},'UpdateVoiceQueue':function(_0x21f296){return new Promise(function(_0x3ba0b7,_0x24b162){var _0x136b14=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x1f')],{'id':parseInt(_0x21f296['id'])});var _0x1127f8=_[_0x47a5('0x24')](_0x21f296,['id']);if(_0x136b14){for(var _0x3ad507 in _0x1127f8){if(typeof _0x1127f8[_0x3ad507]!=='undefined'&&typeof _0x136b14[_0x3ad507]!==_0x47a5('0x25')){_0x136b14[_0x3ad507]=_0x1127f8[_0x3ad507];}}_0x3ba0b7(_0x136b14);}else{_0x24b162();}});},'VoiceChannels':function(){return new Promise(function(_0x51833b){var _0x2ef875=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x27')]);_0x51833b({'count':_0x2ef875['length'],'rows':_0x2ef875});});},'VoiceChannelMixMonitor':function(_0x256650){var _0x625952=this;return new Promise(function(_0x39b50b,_0x1f1c68){if(ami['isConnected']()==![]){return _0x1f1c68(_0x625952['error'](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],'ami\x20disconnected'][_0x47a5('0x13')]('\x20')));}var _0x51544e=schema(properties['voicechannel'])[_0x47a5('0x28')](_0x256650);if(_0x51544e['length']>0x0){return _0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x51544e,'message')['join'](',\x20')));}var _0x274e34=_['find'](_0x3717e1[_0x47a5('0x27')],{'uniqueid':_0x256650[_0x47a5('0x2a')]});if(_0x274e34&&_0x274e34[_0x47a5('0x2b')]){var _0x52749b=util[_0x47a5('0x2c')]('%s.%s',_0x256650['filename']||_0x256650[_0x47a5('0x2a')],_0x256650['format']||_0x47a5('0x2d'));return ami['Action']({'action':_0x47a5('0x2e'),'channel':_0x274e34[_0x47a5('0x2b')],'file':_0x52749b,'options':_0x47a5('0x2f')})[_0x47a5('0x1e')](function(_0x36add5){var _0xed6320=_[_0x47a5('0x23')](_0x274e34[_0x47a5('0x30')],{'filename':_0x47a5('0x31')+_0x52749b['toLowerCase']()});if(_[_0x47a5('0x32')](_0xed6320)){_0x274e34[_0x47a5('0x30')]['push']({'filename':_0x47a5('0x31')+_0x52749b[_0x47a5('0x33')](),'createdAt':moment()[_0x47a5('0x2c')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x36add5[_0x47a5('0x34')],'status':_0x47a5('0x35')});}else{_0xed6320['mixmonitorid']=_0x36add5[_0x47a5('0x34')];_0xed6320[_0x47a5('0x36')]='rec';}_0x39b50b({'code':0xc8,'message':[_0x256650['uniqueid'],'MixMonitor\x20Success',_0x36add5[_0x47a5('0x34')]]['join']('\x20'),'mixmonitorid':_0x36add5[_0x47a5('0x34')]});})[_0x47a5('0x19')](function(_0x301a85){_0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f5,[_0x256650[_0x47a5('0x2a')],_0x301a85[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f5,_0x47a5('0x37')));}});},'VoiceChannelStopMixMonitor':function(_0x280500){var _0x1658e8=this;return new Promise(function(_0x23d6d8,_0x56dbbd){if(ami[_0x47a5('0xf')]()==![]){return _0x56dbbd(_0x1658e8[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],_0x47a5('0x12')]['join']('\x20')));}var _0x47c7a2=schema(properties['voicechannel'])['validate'](_0x280500);if(_0x47c7a2[_0x47a5('0x22')]>0x0){return _0x56dbbd(_0x1658e8['error'](0x1f4,_[_0x47a5('0x29')](_0x47c7a2,_0x47a5('0x18'))[_0x47a5('0x13')](',\x20')));}var _0x494526=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x27')],{'uniqueid':_0x280500['uniqueid']});if(_0x494526){return Promise['resolve']()[_0x47a5('0x1e')](function(){if(_0x494526['channel']){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x39'),'channel':_0x494526[_0x47a5('0x2b')],'mixmonitorid':_0x280500[_0x47a5('0x34')]})[_0x47a5('0x19')](function(){});}})[_0x47a5('0x1e')](function(){if(_0x494526[_0x47a5('0x3a')]){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x39'),'channel':_0x494526[_0x47a5('0x3a')],'mixmonitorid':_0x280500[_0x47a5('0x34')]})[_0x47a5('0x19')](function(){});}})[_0x47a5('0x1e')](function(){var _0x3574d4=_[_0x47a5('0x23')](_0x494526[_0x47a5('0x30')],{'mixmonitorid':_0x280500['mixmonitorid']});if(_0x3574d4){_0x3574d4[_0x47a5('0x36')]=_0x47a5('0x3b');}})['then'](function(){var _0x52b3a8=util[_0x47a5('0x2c')]('%s.%s',_0x280500[_0x47a5('0x3c')]||_0x280500[_0x47a5('0x2a')],_0x280500['format']||'wav');var _0x3d85cc=_['find'](_0x494526[_0x47a5('0x30')],{'filename':_0x47a5('0x31')+_0x52b3a8[_0x47a5('0x33')]()});if(_0x3d85cc){_0x3d85cc[_0x47a5('0x36')]=_0x47a5('0x3b');}})[_0x47a5('0x1e')](function(){_0x23d6d8({'code':0xc8,'message':[_0x280500[_0x47a5('0x2a')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0x47a5('0x19')](function(_0x411230){_0x56dbbd(_0x1658e8[_0x47a5('0x10')](0x1f5,[_0x280500[_0x47a5('0x2a')],_0x411230[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x56dbbd(_0x1658e8['error'](0x1f5,_0x47a5('0x37')));}});},'VoiceQueuesChannels':function(_0x1c9a62){var _0x5f6a=this;return new Promise(function(_0x5c3c75){var _0x12ca40=_['values'](_0x3717e1[_0x47a5('0x3d')]);var _0xe31817={'count':_0x12ca40[_0x47a5('0x22')],'rows':_0x12ca40};if(_0x1c9a62&&_0x1c9a62[_0x47a5('0x3e')]){if(!['inbound',_0x47a5('0x3f')][_0x47a5('0x40')](_0x1c9a62[_0x47a5('0x3e')])){return _0x59199c(_0x5f6a[_0x47a5('0x10')](0x190,_0x47a5('0x41')));}var _0x6a53b3=_[_0x47a5('0x42')](_0x12ca40,function(_0x481089){return _0x481089[_0x47a5('0x3e')]===_0x1c9a62[_0x47a5('0x3e')];});_0xe31817[_0x47a5('0x43')]=_0x6a53b3[_0x47a5('0x22')];_0xe31817[_0x47a5('0x44')]=_0x6a53b3;}_0x5c3c75(_0xe31817);});},'VoiceQueuesChannel':function(_0x1ab0bf){var _0x572233=this;return new Promise(function(_0x1ad6a9,_0x245a15){var _0x1aa581=schema(properties['voicequeuechannel'])[_0x47a5('0x28')](_0x1ab0bf);if(_0x1aa581[_0x47a5('0x22')]>0x0){return _0x245a15(_0x572233[_0x47a5('0x10')](0x1f4,_['map'](_0x1aa581,'message')[_0x47a5('0x13')](',\x20')));}var _0x376e1d=_['find'](_0x3717e1['queueChannels'],{'uniqueid':_0x1ab0bf[_0x47a5('0x2a')]});if(_0x376e1d){_0x1ad6a9(_0x376e1d);}else{return _0x245a15(_0x572233['error'](0x1f5,_0x47a5('0x37')));}});},'VoiceQueuesChannelHangup':function(_0x5d383d){var _0x482de6=this;return new Promise(function(_0x389ed9,_0x46d2d3){if(ami['isConnected']()==![]){return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config['asterisk']['username'],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}var _0x867da0=schema(properties[_0x47a5('0x45')])['validate'](_0x5d383d);if(_0x867da0[_0x47a5('0x22')]>0x0){return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x867da0,'message')[_0x47a5('0x13')](',\x20')));}var _0x4db625=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x3d')],{'uniqueid':_0x5d383d[_0x47a5('0x2a')]});if(_0x4db625&&_0x4db625[_0x47a5('0x2b')]){return ami[_0x47a5('0x38')]({'action':'Hangup','channel':_0x4db625[_0x47a5('0x2b')]})['then'](function(_0x5cbe97){_0x389ed9({'code':0xc8,'message':[_0x5d383d['uniqueid'],_0x5cbe97['message'][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')});})[_0x47a5('0x19')](function(_0x52e3ee){_0x46d2d3(_0x482de6['error'](0x1f5,[_0x5d383d[_0x47a5('0x2a')],_0x52e3ee[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x3474b7){var _0x519e9e=this;return new Promise(function(_0x22c886,_0x274d31){if(ami['isConnected']()==![]){return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')][_0x47a5('0x1a')],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}var _0x35cca8=schema(properties[_0x47a5('0x46')])['validate'](_0x3474b7);if(_0x35cca8[_0x47a5('0x22')]>0x0){return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x35cca8,_0x47a5('0x18'))[_0x47a5('0x13')](',\x20')));}var _0x4bbe14=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x3d')],{'uniqueid':_0x3474b7[_0x47a5('0x2a')]});if(_0x4bbe14&&_0x4bbe14[_0x47a5('0x2b')]){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x47'),'channel':_0x4bbe14[_0x47a5('0x2b')],'exten':_0x3474b7[_0x47a5('0x48')],'context':_0x3474b7[_0x47a5('0x49')]||_0x4bbe14[_0x47a5('0x49')],'priority':0x1})[_0x47a5('0x1e')](function(_0x44fda9){_0x22c886({'code':0xc8,'message':[_0x3474b7[_0x47a5('0x2a')],_0x44fda9[_0x47a5('0x18')][_0x47a5('0x33')]()]['join']('\x20')});})[_0x47a5('0x19')](function(_0x284fb8){_0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f5,[_0x3474b7['uniqueid'],_0x284fb8[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x3ac402){return new Promise(function(_0x522ccf){var _0x2d5ee6=_['values'](_0x3717e1[_0x47a5('0xb')]);if(_0x3ac402&&_0x3ac402['id']){var _0x4cf7c5=_[_0x47a5('0x23')](_0x2d5ee6,function(_0x2f27c3){return _0x2f27c3['id']===_0x3ac402['id'];});_0x522ccf(_0x4cf7c5);}else{_0x522ccf({'count':_0x2d5ee6[_0x47a5('0x22')],'rows':_0x2d5ee6});}});},'Telephones':function(){return new Promise(function(_0x58473b){var _0x4af557=_['values'](_0x3717e1[_0x47a5('0x4a')]);_0x58473b({'count':_0x4af557[_0x47a5('0x22')],'rows':_0x4af557});});},'Trunks':function(){return new Promise(function(_0xe3c0a7){var _0x117510=_['values'](_0x3717e1[_0x47a5('0x4b')]);_0xe3c0a7({'count':_0x117510[_0x47a5('0x22')],'rows':_0x117510});});},'OutboundChannels':function(){return new Promise(function(_0x390bc0){var _0xd5b23f=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x4c')]);_0x390bc0({'count':_0xd5b23f[_0x47a5('0x22')],'rows':_0xd5b23f});});},'Outbound':function(){return new Promise(function(_0x39939a){_0x39939a(_0x3717e1[_0x47a5('0x3f')]);});},'Campaigns':function(){return new Promise(function(_0xc69a68){var _0x2e6fcc=_[_0x47a5('0x26')](_0x3717e1['campaigns']);_0xc69a68({'count':_0x2e6fcc[_0x47a5('0x22')],'rows':_0x2e6fcc});});},'VoiceQueuesPreview':function(_0x4833be){var _0x2ad00a=this;return new Promise(function(_0x2ac30f,_0x281e5f){_0xfdf934[_0x47a5('0x4d')](_0x4833be['id'])[_0x47a5('0x1e')](function(_0xa9c853){_0x2ac30f({'code':0xc8,'message':_0xa9c853[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x11c1db){_0x281e5f(_0x2ad00a[_0x47a5('0x10')](0x1f4,_0x11c1db[_0x47a5('0x18')]));});});},'EventManager':function(_0x1f07ac){var _0x8f0035=this;return new Promise(function(_0x2d434c,_0x441d64){if(!_0x1f07ac['event']){return _0x441d64(_0x8f0035['error'](0x1f4,'Event\x20name\x20mandatory'));}ami['emit'](_0x47a5('0x4e')+_0x1f07ac[_0x47a5('0x4f')],_0x1f07ac['message']);_0x2d434c({'code':0xc8,'message':_0x1f07ac});});},'FaxAccounts':function(){return new Promise(function(_0x732e00){var _0x44dda2=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x50')]);_0x732e00({'count':_0x44dda2[_0x47a5('0x22')],'rows':_0x44dda2});});},'SendFax':function(_0x930d25){var _0x218dfa=this;return new Promise(function(_0x1c7302,_0x2e9a96){_0x545a97[_0x47a5('0x51')](_0x930d25)[_0x47a5('0x1e')](function(_0x5e5f16){_0x1c7302({'code':0xc8,'message':_0x5e5f16[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x420671){_0x2e9a96(_0x218dfa['error'](0x1f4,_0x420671[_0x47a5('0x18')]));});});},'CheckAfterSend':function(_0x32f393){var _0x17b61d=this;return new Promise(function(_0x5d41d8,_0x19dc8c){_0x545a97['checkAfterSend'](_0x32f393)['then'](function(_0x356e16){_0x5d41d8({'code':0xc8,'message':_0x356e16[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x27333e){_0x19dc8c(_0x17b61d[_0x47a5('0x10')](0x1f4,_0x27333e[_0x47a5('0x18')]));});});}};var _0x479a82=jayson['server'](_0x343372)[_0x47a5('0x52')]();_0x479a82['on']('error',function(_0x24dbee){return _0x59199c(_0x24dbee);});_0x479a82[_0x47a5('0x7')](0x232a,_0x47a5('0x53'),function(){console[_0x47a5('0x54')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x3d5629(_0x47a5('0x55')+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 067ba4d..59fe1eb 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 _0x1ed7=['trigger:%s','action','toLowerCase','merge','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','defaults','redis','localhost','socket.io-emitter','info','[CM][%s][%s]','emit','data2','isNil','data5','xmd-contactid','ListId','data3','split','phone','map','calleridnum','routeId','firstName','lastName','mobile','createdAt','union','resolve','getContacts','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','join','data4','[CM][%s][%s]\x20Autocreate\x20enabled','calleridname','','Unknown','destcalleridname','then','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','destcalleridnum','user:%s','name','format'];(function(_0x7f8baa,_0x408d08){var _0x285987=function(_0x3798a1){while(--_0x3798a1){_0x7f8baa['push'](_0x7f8baa['shift']());}};_0x285987(++_0x408d08);}(_0x1ed7,0x6e));var _0x71ed=function(_0x240e82,_0x53fdaa){_0x240e82=_0x240e82-0x0;var _0x3249ee=_0x1ed7[_0x240e82];return _0x3249ee;};'use strict';var _=require('lodash');var BPromise=require('bluebird');var Redis=require('ioredis');var util=require(_0x71ed('0x0'));var config=require(_0x71ed('0x1'));var logger=require(_0x71ed('0x2'))(_0x71ed('0x3'));var cmContactRpc=require(_0x71ed('0x4'));config['redis']=_[_0x71ed('0x5')](config[_0x71ed('0x6')],{'host':_0x71ed('0x7'),'port':0x18eb});var io=require(_0x71ed('0x8'))(new Redis(config['redis']));function emit(_0x572ad8,_0x159d75,_0x1eaefe,_0x1dfb6d,_0x3eedbe){logger[_0x71ed('0x9')](_0x71ed('0xa'),_0x572ad8,_0x159d75['id'],_0x1eaefe,_0x1dfb6d,JSON['stringify'](_0x3eedbe));io['to'](_0x1eaefe)[_0x71ed('0xb')](_0x1dfb6d,_0x3eedbe);}exports['exec']=function(_0x1894ea,_0xc4e59d,_0x2641ab,_0xcfa100){var _0x29f82c,_0x24987b;var _0x3c5902={};var _0x28670d;var _0x43d6dc=Number(_0x2641ab['data1']);var _0x363084=_0x2641ab[_0x71ed('0xc')]?Boolean(Number(_0x2641ab[_0x71ed('0xc')])):![];var _0x34ebc4;var _0x4ffb57=![];if(!_[_0x71ed('0xd')](_0x2641ab[_0x71ed('0xe')])){if(_0x2641ab['data5']=='1')_0x4ffb57=!![];}if(!_0x4ffb57){if(_0xcfa100['xmd-contactid']){_0x3c5902['id']=_0xcfa100[_0x71ed('0xf')];}}if(!_0x3c5902['id']){_0x3c5902[_0x71ed('0x10')]=_0x43d6dc;_0x34ebc4=_0x2641ab[_0x71ed('0x11')]&&_0x2641ab[_0x71ed('0x11')]!=='0'?_0x2641ab['data3'][_0x71ed('0x12')](','):[_0x71ed('0x13')];_0x3c5902['$or']=_[_0x71ed('0x14')](_0x34ebc4,function(_0x1c0585){var _0x53099f={};_0x53099f[_0x1c0585]=_0xcfa100['routeId']?_0xcfa100['destcalleridnum']:_0xcfa100[_0x71ed('0x15')];return _0x53099f;});_0x28670d=_0xcfa100[_0x71ed('0x16')]?_0xcfa100['destcalleridnum']:_0xcfa100[_0x71ed('0x15')];}var _0x255776=['id',_0x71ed('0x17'),_0x71ed('0x18'),'phone',_0x71ed('0x19'),'fax',_0x71ed('0x10'),_0x71ed('0x1a'),'scheduledAt','updatedAt'];var _0xb6f5ad=_[_0x71ed('0x1b')](_0x255776,_0x34ebc4);BPromise[_0x71ed('0x1c')]()['then'](cmContactRpc[_0x71ed('0x1d')]({'attributes':_0xb6f5ad,'where':_0x3c5902,'phone':_0x28670d}))['then'](function(_0x3b9775){_0x24987b=_0x3b9775;if(!_[_0x71ed('0x1e')](_0x24987b)){if(_0x24987b[_0x71ed('0x1f')]===0x1){_0x29f82c=_0x24987b[0x0];logger[_0x71ed('0x9')](_0x71ed('0x20'),_0xcfa100[_0x71ed('0x21')],_0xc4e59d['id'],_0x29f82c['id']);}else{logger['info']('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0xcfa100[_0x71ed('0x21')],_0xc4e59d['id'],_[_0x71ed('0x14')](_0x24987b,'id')[_0x71ed('0x22')](','));}return;}else{logger[_0x71ed('0x9')]('[CM][%s][%s]\x20Contact\x20not\x20found',_0xcfa100[_0x71ed('0x21')],_0xc4e59d['id']);var _0x57b5b3={'ListId':_0x43d6dc};var _0x187e9c=_0x2641ab['data4']&&_0x2641ab[_0x71ed('0x23')]!=='0'?_0x2641ab[_0x71ed('0x23')]:'phone';if(_0x363084){logger['info'](_0x71ed('0x24'),_0xcfa100[_0x71ed('0x21')],_0xc4e59d['id']);_0x57b5b3[_0x187e9c]=_[_0x71ed('0xd')](_0xcfa100[_0x71ed('0x16')])?_0xcfa100['calleridnum']:_0xcfa100['destcalleridnum'];if(_[_0x71ed('0xd')](_0xcfa100['routeId'])){_0x57b5b3[_0x71ed('0x17')]=_0xcfa100['calleridname']&&_0xcfa100[_0x71ed('0x25')]!==_0x71ed('0x26')?_0xcfa100[_0x71ed('0x25')]:_0x71ed('0x27');}else{_0x57b5b3['firstName']=_0xcfa100[_0x71ed('0x28')]&&_0xcfa100[_0x71ed('0x28')]!==''?_0xcfa100[_0x71ed('0x28')]:_0x71ed('0x27');}return BPromise[_0x71ed('0x1c')]()[_0x71ed('0x29')](cmContactRpc[_0x71ed('0x2a')](_0x57b5b3))[_0x71ed('0x29')](function(_0x39e01e){_0x29f82c=_0x39e01e;_0x24987b[_0x71ed('0x2b')](_0x39e01e);if(_0x29f82c){logger['info'](_0x71ed('0x2c'),_0xcfa100[_0x71ed('0x21')],_0xc4e59d['id'],_0x29f82c['id']);}return;});}else{logger[_0x71ed('0x9')]('[CM][%s][%s]\x20Autocreate\x20disabled',_0xcfa100[_0x71ed('0x21')],_0xc4e59d['id']);_0x57b5b3[_0x187e9c]=_[_0x71ed('0xd')](_0xcfa100[_0x71ed('0x16')])?_0xcfa100['calleridnum']:_0xcfa100[_0x71ed('0x2d')];if(_['isNil'](_0xcfa100['routeId'])){_0x57b5b3[_0x71ed('0x17')]=_0xcfa100[_0x71ed('0x25')]&&_0xcfa100[_0x71ed('0x25')]!==''?_0xcfa100[_0x71ed('0x25')]:_0x71ed('0x27');}else{_0x57b5b3[_0x71ed('0x17')]=_0xcfa100[_0x71ed('0x28')]&&_0xcfa100['destcalleridname']!==_0x71ed('0x26')?_0xcfa100[_0x71ed('0x28')]:_0x71ed('0x27');}_0x29f82c=_0x57b5b3;_0x24987b[_0x71ed('0x2b')](_0x57b5b3);return;}}})['then'](function(){if(_0x1894ea){emit(_0xcfa100['uniqueid'],_0xc4e59d,util['format'](_0x71ed('0x2e'),_0x1894ea[_0x71ed('0x2f')]),util[_0x71ed('0x30')](_0x71ed('0x31'),_0x2641ab[_0x71ed('0x32')][_0x71ed('0x33')]()),{'evt':_[_0x71ed('0x34')](_0xcfa100,{'autoCreate':_0x363084}),'contact':_0x29f82c===undefined?{}:_0x29f82c,'contacts':_0x24987b['length']===0x0?undefined:_0x24987b});}});}; \ No newline at end of file +var _0xa8d8=['destcalleridnum','calleridnum','firstName','phone','fax','createdAt','updatedAt','union','then','isEmpty','length','info','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','data4','[CM][%s][%s]\x20Autocreate\x20enabled','calleridname','destcalleridname','resolve','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','isNil','Unknown','','format','user:%s','name','trigger:%s','action','toLowerCase','merge','bluebird','ioredis','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','[CM][%s][%s]','emit','exec','data1','data2','data5','xmd-contactid','ListId','data3','$or','map','routeId'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xa8d8,0x179));var _0x8a8d=function(_0x103314,_0x319d36){_0x103314=_0x103314-0x0;var _0x2f0601=_0xa8d8[_0x103314];return _0x2f0601;};'use strict';var _=require('lodash');var BPromise=require(_0x8a8d('0x0'));var Redis=require(_0x8a8d('0x1'));var util=require('util');var config=require(_0x8a8d('0x2'));var logger=require(_0x8a8d('0x3'))(_0x8a8d('0x4'));var cmContactRpc=require(_0x8a8d('0x5'));config[_0x8a8d('0x6')]=_[_0x8a8d('0x7')](config[_0x8a8d('0x6')],{'host':_0x8a8d('0x8'),'port':0x18eb});var io=require(_0x8a8d('0x9'))(new Redis(config[_0x8a8d('0x6')]));function emit(_0x595cfc,_0x41ccf9,_0x575282,_0x423b57,_0x26a2e6){logger['info'](_0x8a8d('0xa'),_0x595cfc,_0x41ccf9['id'],_0x575282,_0x423b57,JSON['stringify'](_0x26a2e6));io['to'](_0x575282)[_0x8a8d('0xb')](_0x423b57,_0x26a2e6);}exports[_0x8a8d('0xc')]=function(_0x5e2d0b,_0x3d5ece,_0x49285b,_0x38ae06){var _0x3a5248,_0x55fc78;var _0x348ba3={};var _0x14f33c;var _0x3ea406=Number(_0x49285b[_0x8a8d('0xd')]);var _0x5efc17=_0x49285b[_0x8a8d('0xe')]?Boolean(Number(_0x49285b[_0x8a8d('0xe')])):![];var _0x54f7ae;var _0x1e800c=![];if(!_['isNil'](_0x49285b[_0x8a8d('0xf')])){if(_0x49285b[_0x8a8d('0xf')]=='1')_0x1e800c=!![];}if(!_0x1e800c){if(_0x38ae06[_0x8a8d('0x10')]){_0x348ba3['id']=_0x38ae06[_0x8a8d('0x10')];}}if(!_0x348ba3['id']){_0x348ba3[_0x8a8d('0x11')]=_0x3ea406;_0x54f7ae=_0x49285b[_0x8a8d('0x12')]&&_0x49285b['data3']!=='0'?_0x49285b[_0x8a8d('0x12')]['split'](','):['phone'];_0x348ba3[_0x8a8d('0x13')]=_[_0x8a8d('0x14')](_0x54f7ae,function(_0x3b6704){var _0x401a3f={};_0x401a3f[_0x3b6704]=_0x38ae06[_0x8a8d('0x15')]?_0x38ae06[_0x8a8d('0x16')]:_0x38ae06[_0x8a8d('0x17')];return _0x401a3f;});_0x14f33c=_0x38ae06[_0x8a8d('0x15')]?_0x38ae06[_0x8a8d('0x16')]:_0x38ae06[_0x8a8d('0x17')];}var _0x43b990=['id',_0x8a8d('0x18'),'lastName',_0x8a8d('0x19'),'mobile',_0x8a8d('0x1a'),_0x8a8d('0x11'),_0x8a8d('0x1b'),'scheduledAt',_0x8a8d('0x1c')];var _0x3ebd33=_[_0x8a8d('0x1d')](_0x43b990,_0x54f7ae);BPromise['resolve']()[_0x8a8d('0x1e')](cmContactRpc['getContacts']({'attributes':_0x3ebd33,'where':_0x348ba3,'phone':_0x14f33c}))[_0x8a8d('0x1e')](function(_0x35da8d){_0x55fc78=_0x35da8d;if(!_[_0x8a8d('0x1f')](_0x55fc78)){if(_0x55fc78[_0x8a8d('0x20')]===0x1){_0x3a5248=_0x55fc78[0x0];logger[_0x8a8d('0x21')](_0x8a8d('0x22'),_0x38ae06[_0x8a8d('0x23')],_0x3d5ece['id'],_0x3a5248['id']);}else{logger[_0x8a8d('0x21')](_0x8a8d('0x24'),_0x38ae06[_0x8a8d('0x23')],_0x3d5ece['id'],_[_0x8a8d('0x14')](_0x55fc78,'id')[_0x8a8d('0x25')](','));}return;}else{logger[_0x8a8d('0x21')]('[CM][%s][%s]\x20Contact\x20not\x20found',_0x38ae06[_0x8a8d('0x23')],_0x3d5ece['id']);var _0x495d99={'ListId':_0x3ea406};var _0x180c4f=_0x49285b['data4']&&_0x49285b[_0x8a8d('0x26')]!=='0'?_0x49285b['data4']:_0x8a8d('0x19');if(_0x5efc17){logger[_0x8a8d('0x21')](_0x8a8d('0x27'),_0x38ae06[_0x8a8d('0x23')],_0x3d5ece['id']);_0x495d99[_0x180c4f]=_['isNil'](_0x38ae06['routeId'])?_0x38ae06[_0x8a8d('0x17')]:_0x38ae06[_0x8a8d('0x16')];if(_['isNil'](_0x38ae06[_0x8a8d('0x15')])){_0x495d99['firstName']=_0x38ae06[_0x8a8d('0x28')]&&_0x38ae06['calleridname']!==''?_0x38ae06[_0x8a8d('0x28')]:'Unknown';}else{_0x495d99[_0x8a8d('0x18')]=_0x38ae06[_0x8a8d('0x29')]&&_0x38ae06['destcalleridname']!==''?_0x38ae06[_0x8a8d('0x29')]:'Unknown';}return BPromise[_0x8a8d('0x2a')]()[_0x8a8d('0x1e')](cmContactRpc[_0x8a8d('0x2b')](_0x495d99))[_0x8a8d('0x1e')](function(_0x5a717d){_0x3a5248=_0x5a717d;_0x55fc78[_0x8a8d('0x2c')](_0x5a717d);if(_0x3a5248){logger[_0x8a8d('0x21')](_0x8a8d('0x2d'),_0x38ae06['uniqueid'],_0x3d5ece['id'],_0x3a5248['id']);}return;});}else{logger[_0x8a8d('0x21')](_0x8a8d('0x2e'),_0x38ae06['uniqueid'],_0x3d5ece['id']);_0x495d99[_0x180c4f]=_[_0x8a8d('0x2f')](_0x38ae06[_0x8a8d('0x15')])?_0x38ae06[_0x8a8d('0x17')]:_0x38ae06[_0x8a8d('0x16')];if(_[_0x8a8d('0x2f')](_0x38ae06[_0x8a8d('0x15')])){_0x495d99[_0x8a8d('0x18')]=_0x38ae06[_0x8a8d('0x28')]&&_0x38ae06[_0x8a8d('0x28')]!==''?_0x38ae06[_0x8a8d('0x28')]:_0x8a8d('0x30');}else{_0x495d99[_0x8a8d('0x18')]=_0x38ae06['destcalleridname']&&_0x38ae06[_0x8a8d('0x29')]!==_0x8a8d('0x31')?_0x38ae06[_0x8a8d('0x29')]:_0x8a8d('0x30');}_0x3a5248=_0x495d99;_0x55fc78['push'](_0x495d99);return;}}})[_0x8a8d('0x1e')](function(){if(_0x5e2d0b){emit(_0x38ae06['uniqueid'],_0x3d5ece,util[_0x8a8d('0x32')](_0x8a8d('0x33'),_0x5e2d0b[_0x8a8d('0x34')]),util['format'](_0x8a8d('0x35'),_0x49285b[_0x8a8d('0x36')][_0x8a8d('0x37')]()),{'evt':_[_0x8a8d('0x38')](_0x38ae06,{'autoCreate':_0x5efc17}),'contact':_0x3a5248===undefined?{}:_0x3a5248,'contacts':_0x55fc78[_0x8a8d('0x20')]===0x0?undefined:_0x55fc78});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index ac3d6cd..96f7c4f 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 _0xc624=['zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','custom:agentcalled','syncCustomEvent','bind','custom:agentconnect','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentcongestion','custom:agentreject','custom:amd','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:rejectmessage','custom:offlineMessage','prototype','emit','info','clone','motionChannel','undefined','voice','debug','checkTriggers','interface','hasOwnProperty','status','checkTrigger','merge','length','Actions','action','toLowerCase','contactmanager','motionbar','data2','template\x20not\x20found','uri','isNil','uriLocation','windowWidth','data5','800','windowHeight','data6','600','winApplication','render','winArguments','data3','user:%s','name','format','trigger:%s:%s','data1','jscripty','trigger:%s','integration','urlforward','exec','buildUri','parse','query','search','replace','channel','every','AnyConditions','checkConditions','checkTrigger:\x20trigger','evt','inspect','field','account','chat','ChatWebsiteId','operator','value','upperFirst','AccountId','message','event','queue','agent','membername','lastevent','routeId','mailSubstatus','substatus','offlineMessage','created','equals','util','mustache','ioredis','./urlforward','./integration','./cmContact','../../../config/environment','../../../config/logger','../ami','redis','defaults','popup','url','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xc624,0x65));var _0x4c62=function(_0x119b79,_0x4b0875){_0x119b79=_0x119b79-0x0;var _0x3da1f8=_0xc624[_0x119b79];return _0x3da1f8;};'use strict';var util=require(_0x4c62('0x0'));var _=require('lodash');var url=require('url');var Mustache=require(_0x4c62('0x1'));var Redis=require(_0x4c62('0x2'));var urlforward=require(_0x4c62('0x3'));var integration=require(_0x4c62('0x4'));var cmContact=require(_0x4c62('0x5'));var script=require('./script');var config=require(_0x4c62('0x6'));var logger=require(_0x4c62('0x7'))('trigger');var ami=require(_0x4c62('0x8'));config[_0x4c62('0x9')]=_[_0x4c62('0xa')](config[_0x4c62('0x9')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4c62('0x9')]));var operators={'equals':function(_0x10c1d4,_0x273cce){return _0x10c1d4==_0x273cce;},'not_equals':function(_0xa13be4,_0x3cc924){return _0xa13be4!=_0x3cc924;}};var barAndWebActions=[_0x4c62('0xb'),_0x4c62('0xc'),_0x4c62('0xd')];function Trigger(_0x350899){this[_0x4c62('0xe')]=_0x350899['triggers'];this[_0x4c62('0xf')]=_0x350899['agents'];this[_0x4c62('0x10')]=_0x350899[_0x4c62('0x10')];this[_0x4c62('0x11')]=_0x350899[_0x4c62('0x11')];this[_0x4c62('0x12')]=_0x350899[_0x4c62('0x12')];this['zendeskAccounts']=_0x350899[_0x4c62('0x13')];this[_0x4c62('0x14')]=_0x350899[_0x4c62('0x14')];this[_0x4c62('0x15')]=_0x350899[_0x4c62('0x15')];this[_0x4c62('0x16')]=_0x350899[_0x4c62('0x16')];this[_0x4c62('0x17')]=_0x350899[_0x4c62('0x17')];this[_0x4c62('0x18')]=_0x350899[_0x4c62('0x18')];this['vtigerAccounts']=_0x350899[_0x4c62('0x19')];this[_0x4c62('0x1a')]=_0x350899[_0x4c62('0x1a')];this[_0x4c62('0x1b')]=_0x350899['dynamics365Accounts'];this[_0x4c62('0x1c')]=_0x350899[_0x4c62('0x1c')];this[_0x4c62('0x1d')]={'zendesk':this['zendeskAccounts'],'salesforce':this['salesforceAccounts'],'freshdesk':this[_0x4c62('0x14')],'sugarcrm':this[_0x4c62('0x16')],'zoho':this[_0x4c62('0x17')],'desk':this[_0x4c62('0x18')],'vtiger':this['vtigerAccounts'],'dynamics365':this[_0x4c62('0x1b')],'freshsales':this[_0x4c62('0x1c')],'servicenow':this['servicenowAccounts']};ami['on'](_0x4c62('0x1e'),this[_0x4c62('0x1f')][_0x4c62('0x20')](this));ami['on'](_0x4c62('0x21'),this[_0x4c62('0x1f')]['bind'](this));ami['on']('custom:agentringnoanswer',this['syncCustomEvent'][_0x4c62('0x20')](this));ami['on']('custom:agentcomplete',this['syncCustomEvent'][_0x4c62('0x20')](this));ami['on'](_0x4c62('0x22'),this[_0x4c62('0x1f')][_0x4c62('0x20')](this));ami['on'](_0x4c62('0x23'),this[_0x4c62('0x1f')][_0x4c62('0x20')](this));ami['on']('custom:agentbusy',this[_0x4c62('0x1f')]['bind'](this));ami['on'](_0x4c62('0x24'),this[_0x4c62('0x1f')][_0x4c62('0x20')](this));ami['on'](_0x4c62('0x25'),this['syncCustomEvent']['bind'](this));ami['on'](_0x4c62('0x26'),this['syncCustomEvent'][_0x4c62('0x20')](this));ami['on']('custom:queuecallerabandon',this['syncCustomEvent']['bind'](this));ami['on']('custom:timeout',this['syncCustomEvent'][_0x4c62('0x20')](this));ami['on'](_0x4c62('0x27'),this[_0x4c62('0x28')][_0x4c62('0x20')](this));ami['on'](_0x4c62('0x29'),this[_0x4c62('0x28')][_0x4c62('0x20')](this));ami['on'](_0x4c62('0x2a'),this['syncAgentDial']['bind'](this));ami['on'](_0x4c62('0x2b'),this[_0x4c62('0x1f')]['bind'](this));ami['on'](_0x4c62('0x2c'),this[_0x4c62('0x1f')][_0x4c62('0x20')](this));ami['on']('custom:substatus',this[_0x4c62('0x1f')][_0x4c62('0x20')](this));ami['on']('custom:incomingmessage',this[_0x4c62('0x1f')][_0x4c62('0x20')](this));ami['on']('custom:outgoingmessage',this['syncCustomEvent'][_0x4c62('0x20')](this));ami['on']('custom:acceptmessage',this['syncCustomEvent']['bind'](this));ami['on'](_0x4c62('0x2d'),this[_0x4c62('0x1f')][_0x4c62('0x20')](this));ami['on'](_0x4c62('0x2e'),this[_0x4c62('0x1f')]['bind'](this));}Trigger[_0x4c62('0x2f')][_0x4c62('0x30')]=function(_0x37e32b,_0x5ec0cb,_0x44bec7){logger[_0x4c62('0x31')](_0x37e32b,_0x5ec0cb,JSON['stringify'](_0x44bec7));io['to'](_0x37e32b)[_0x4c62('0x30')](_0x5ec0cb,_0x44bec7);};Trigger[_0x4c62('0x2f')]['syncCustomEvent']=function(_0x5a9756){var _0x1125ac=_[_0x4c62('0x32')](_0x5a9756);if(typeof _0x1125ac[_0x4c62('0x33')]===_0x4c62('0x34')){_0x1125ac[_0x4c62('0x33')]=_0x4c62('0x35');}logger[_0x4c62('0x36')]('syncCustomEvent',util['inspect'](_0x1125ac,{'showHidden':!![],'depth':null}));this[_0x4c62('0x37')](_0x1125ac);};Trigger['prototype']['syncAgentDial']=function(_0x4d5d30){if(this['agents'][_0x4d5d30[_0x4c62('0x38')]]){this[_0x4c62('0x1f')](_0x4d5d30);}};Trigger[_0x4c62('0x2f')][_0x4c62('0x37')]=function(_0x21be12){var _0x4f1fab;for(var _0x1c1507 in this['triggers']){if(this[_0x4c62('0xe')][_0x4c62('0x39')](_0x1c1507)){if(this[_0x4c62('0xe')][_0x1c1507][_0x4c62('0x3a')]){_0x4f1fab=this[_0x4c62('0x3b')](this[_0x4c62('0xe')][_0x1c1507],_0x21be12);if(_0x4f1fab){_[_0x4c62('0x3c')](_0x21be12,_0x21be12['variables']);for(var _0x4ae83c=0x0,_0x253913,_0x3646b5,_0x300a43;_0x4ae83c0x0){_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 +var _0x55ca=['debug','[HTTP]','stringify','GET','authType','basic','%s:%s','username','token','%s/token:%s','toString','base64','Searching\x20enduser\x20with\x20phone','Enduser\x20found!','_embedded','entries','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/customers','POST','length','forEach','includes','picklist','type','nameField','customField','toLowerCase','content','string','idField','custom_fields','variable','variableName','customVariable','Variable','name','priority','merge','xCALLY','Motion','CTI','concat','Tags','getString','Descriptions','/api/v2/users/%d','user','Fields','stripTrailingSlash','serverUrl','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','calleridname','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','integrationTab','user:%s','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','error','Desk\x20account\x20type\x20not\x20recognized','outbound','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','%s/agent/tickets/%s','catch','unmanaged','monitor_format','lastevent','toUpperCase','Recording\x20is\x20enabled!','lodash','request-promise','./util','../../../../config/environment','desk','redis','defaults','localhost','socket.io-emitter','application/json','validateEmail','info','Getting\x20agent\x20with\x20email','format','%s/users','remoteUri','then','total_entries','find','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me'];(function(_0x4ed601,_0x4b8b06){var _0x1e5aab=function(_0x30b07e){while(--_0x30b07e){_0x4ed601['push'](_0x4ed601['shift']());}};_0x1e5aab(++_0x4b8b06);}(_0x55ca,0x126));var _0xa55c=function(_0x2f163c,_0x27bd79){_0x2f163c=_0x2f163c-0x0;var _0x3dd996=_0x55ca[_0x2f163c];return _0x3dd996;};'use strict';var _=require(_0xa55c('0x0'));var rp=require(_0xa55c('0x1'));var md5=require('md5');var util=require('util');var Redis=require('ioredis');var intUtil=require(_0xa55c('0x2'));var config=require(_0xa55c('0x3'));var logger=require('../../../../config/logger')(_0xa55c('0x4'));config[_0xa55c('0x5')]=_[_0xa55c('0x6')](config[_0xa55c('0x5')],{'host':_0xa55c('0x7'),'port':0x18eb});var io=require(_0xa55c('0x8'))(new Redis(config[_0xa55c('0x5')]));function emit(_0x4d0624,_0x2121fd,_0x2537f0){io['to'](_0x4d0624)['emit'](_0x2121fd,_0x2537f0);}var headers={'Content-Type':_0xa55c('0x9'),'Accept':_0xa55c('0x9')};function getUser(_0x52a3bc,_0x5849ad){if(intUtil[_0xa55c('0xa')](_0x5849ad)===!![]){logger[_0xa55c('0xb')](_0xa55c('0xc'),_0x5849ad);return request({'uri':util[_0xa55c('0xd')](_0xa55c('0xe'),_0x52a3bc[_0xa55c('0xf')])})[_0xa55c('0x10')](function(_0x70c2de){if(_0x70c2de[_0xa55c('0x11')]){return _[_0xa55c('0x12')](_0x70c2de['_embedded']['entries'],{'email':_0x5849ad});}})[_0xa55c('0x10')](function(_0x576044){if(_0x576044){logger['info']('Agent\x20found!');return _0x576044;}else{logger[_0xa55c('0xb')](_0xa55c('0x13'));return request({'uri':util[_0xa55c('0xd')](_0xa55c('0x14'),_0x52a3bc[_0xa55c('0xf')])});}});}else{logger[_0xa55c('0xb')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xa55c('0xd')](_0xa55c('0x14'),_0x52a3bc[_0xa55c('0xf')])});}}function request(_0x31e10d){logger[_0xa55c('0x15')](_0xa55c('0x16'),JSON[_0xa55c('0x17')](_0x31e10d));return rp(_[_0xa55c('0x6')](_0x31e10d,{'method':_0xa55c('0x18'),'headers':headers,'json':!![]}));}function getAuth(_0x4cee3c){var _0x3d4c9e;if(_0x4cee3c[_0xa55c('0x19')]===_0xa55c('0x1a')){_0x3d4c9e=util[_0xa55c('0xd')](_0xa55c('0x1b'),_0x4cee3c[_0xa55c('0x1c')],_0x4cee3c['password']);}else if(_0x4cee3c['authType']===_0xa55c('0x1d')){_0x3d4c9e=util[_0xa55c('0xd')](_0xa55c('0x1e'),_0x4cee3c['username'],_0x4cee3c[_0xa55c('0x1d')]);}return util[_0xa55c('0xd')]('Basic\x20%s',new Buffer(_0x3d4c9e)[_0xa55c('0x1f')](_0xa55c('0x20')));}function getEndUser(_0x940f28,_0x1965f1,_0x234372){logger['info'](_0xa55c('0x21'),_0x234372);return request({'uri':util['format']('%s/customers/search',_0x940f28['remoteUri']),'qs':{'phone':_0x234372}})[_0xa55c('0x10')](function(_0x54b038){if(_0x54b038[_0xa55c('0x11')]){logger[_0xa55c('0xb')](_0xa55c('0x22'));return _0x54b038[_0xa55c('0x23')][_0xa55c('0x24')][0x0];}else{logger[_0xa55c('0xb')](_0xa55c('0x25'));return request({'uri':util[_0xa55c('0xd')](_0xa55c('0x26'),_0x940f28[_0xa55c('0xf')]),'method':_0xa55c('0x27'),'body':{'first_name':_0x1965f1,'title':_0x1965f1,'phone_numbers':[{'type':'work','value':_0x234372}]}});}});}function getTags(_0x430d55,_0x28814f){var _0x1c9f6b=[];if(_0x430d55&&_0x430d55[_0xa55c('0x28')]>0x0){_0x1c9f6b=_['map'](_0x430d55,_0x28814f);}return _0x1c9f6b;}function getCustomFields(_0x1377b0,_0x22f6b6){var _0x1b8388=[];var _0x201941={'custom_fields':{}};if(_0x1377b0[_0xa55c('0x28')]>0x0){_[_0xa55c('0x29')](_0x1377b0,function(_0x52d37f){if(_[_0xa55c('0x2a')](['string',_0xa55c('0x2b')],_0x52d37f[_0xa55c('0x2c')])&&_0x52d37f[_0xa55c('0x2d')]&&!_0x52d37f[_0xa55c('0x2e')]){_0x201941[_0x52d37f['nameField'][_0xa55c('0x2f')]()]=_0x52d37f[_0xa55c('0x30')][_0xa55c('0x1f')]();}else if(_[_0xa55c('0x2a')]([_0xa55c('0x31'),_0xa55c('0x2b')],_0x52d37f[_0xa55c('0x2c')])&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x201941[_0xa55c('0x33')][_0x52d37f[_0xa55c('0x32')]]=_0x52d37f['content']['toString']();}else if(_0x52d37f[_0xa55c('0x2c')]===_0xa55c('0x34')&&_0x52d37f['variableName']&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x22f6b6[_0x52d37f[_0xa55c('0x35')]]&&(_0x201941[_0xa55c('0x33')][_0x52d37f[_0xa55c('0x32')]]=_0x22f6b6[_0x52d37f[_0xa55c('0x35')]][_0xa55c('0x1f')]());}else if(_0x52d37f[_0xa55c('0x2c')]===_0xa55c('0x36')&&_0x52d37f['Variable']&&_0x52d37f['Variable']['name']&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x22f6b6[_0x52d37f[_0xa55c('0x37')]['name'][_0xa55c('0x2f')]()]&&(_0x201941['custom_fields'][_0x52d37f[_0xa55c('0x32')]]=_0x22f6b6[_0x52d37f['Variable'][_0xa55c('0x38')][_0xa55c('0x2f')]()][_0xa55c('0x1f')]());}});}if(_0x201941['priority']){_0x201941[_0xa55c('0x39')]=Number(_0x201941[_0xa55c('0x39')]);}return _0x201941;}function getTicket(_0x47e93c,_0x6f9c4c,_0x194e78,_0x4d9083,_0x529ff8){logger[_0xa55c('0xb')]('Creating\x20new\x20ticket...');var _0x1e75dc=_[_0xa55c('0x3a')]({'subject':intUtil['getString'](_0x4d9083['Subjects'],_0x529ff8,'\x20'),'type':'phone','status':'new','labels':[_0xa55c('0x3b'),_0xa55c('0x3c'),_0xa55c('0x3d')][_0xa55c('0x3e')](getTags(_0x4d9083[_0xa55c('0x3f')],'name')),'description':intUtil[_0xa55c('0x40')](_0x4d9083[_0xa55c('0x41')],_0x529ff8,'\x0a'),'_links':{'assigned_user':{'href':util[_0xa55c('0xd')](_0xa55c('0x42'),_0x6f9c4c['id']),'class':_0xa55c('0x43')}},'message':{'direction':'in','body':intUtil[_0xa55c('0x40')](_0x4d9083['Descriptions'],_0x529ff8,'\x0a')}},getCustomFields(_0x4d9083[_0xa55c('0x44')],_0x529ff8));return request({'uri':util['format']('%s/customers/%d/cases',_0x47e93c[_0xa55c('0xf')],_0x194e78['id']),'method':_0xa55c('0x27'),'body':_0x1e75dc});}exports['queue']=function(_0x2bd98b,_0x508bd3,_0x5f25f7,_0x2f8449,_0x3fea03,_0x1630ac){var _0x540337,_0x1b2708;_0x1630ac[_0xa55c('0xf')]=intUtil['stripTrailingSlash'](_0x1630ac[_0xa55c('0xf')]);_0x1630ac['serverUrl']=intUtil[_0xa55c('0x45')](_0x1630ac[_0xa55c('0x46')]);if(_0x3fea03&&_0x3fea03['monitor_format']){logger[_0xa55c('0xb')](_0xa55c('0x47'),'Recording\x20is\x20enabled!');_0x508bd3[_0xa55c('0x48')]=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x1630ac['serverUrl'],_0x508bd3[_0xa55c('0x4a')],md5(_0x508bd3['uniqueid']));}else{_0x508bd3[_0xa55c('0x48')]='';}headers[_0xa55c('0x4b')]=getAuth(_0x1630ac);return getUser(_0x1630ac,_0x2f8449[_0xa55c('0x4c')])['then'](function(_0x41eab1){_0x540337=_0x41eab1;logger[_0xa55c('0xb')]('The\x20User\x20ID\x20is:',_0x540337['id']);return getEndUser(_0x1630ac,_0x508bd3[_0xa55c('0x4d')],_0x508bd3[_0xa55c('0x4e')]);})['then'](function(_0x11ff1d){_0x1b2708=_0x11ff1d;logger[_0xa55c('0xb')]('The\x20Enduser\x20ID\x20is:',_0x1b2708['id']);return getTicket(_0x1630ac,_0x540337,_0x1b2708,_0x5f25f7,_0x508bd3);})[_0xa55c('0x10')](function(_0x81cee8){if(_0x81cee8){logger[_0xa55c('0xb')](_0xa55c('0x4f'));logger['info'](_0xa55c('0x50'),_0x81cee8['id']);switch(_0x1630ac['type']){case _0xa55c('0x51'):logger[_0xa55c('0xb')](_0xa55c('0x47'),'Displaying\x20ticket\x20to\x20agent...');emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2f8449['name']),_0xa55c('0x53'),{'recordId':_0x81cee8['id']});break;case _0xa55c('0x54'):logger[_0xa55c('0xb')](_0xa55c('0x47'),_0xa55c('0x55'));emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2f8449[_0xa55c('0x38')]),_0xa55c('0x56'),{'uri':util[_0xa55c('0xd')]('https://xcally.desk.com/web/agent/case/%d',_0x81cee8['id'])});break;default:logger[_0xa55c('0x57')](_0xa55c('0x47'),_0xa55c('0x58'));}}})['catch'](function(_0x4c3095){console[_0xa55c('0x57')](_0x4c3095);logger['error'](_0xa55c('0x47'),JSON['stringify'](_0x4c3095));});};exports[_0xa55c('0x59')]=function(_0x228df4,_0x181802,_0x3f9313,_0x2ecf79,_0x5b1cf3,_0x44b7c1,_0x4607ca){var _0x4b85cc,_0x3929a6;_0x44b7c1[_0xa55c('0xf')]=intUtil[_0xa55c('0x45')](_0x44b7c1[_0xa55c('0xf')]);_0x44b7c1['serverUrl']=intUtil['stripTrailingSlash'](_0x44b7c1[_0xa55c('0x46')]);if(_0x4607ca&&_0x4607ca[_0xa55c('0x5a')]&&_0x4607ca[_0xa55c('0x5a')]!==_0xa55c('0x5b')){logger['info'](_0xa55c('0x5c'),'Recording\x20is\x20enabled!');_0x181802[_0xa55c('0x48')]=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x44b7c1[_0xa55c('0x46')],_0x181802[_0xa55c('0x4a')],md5(_0x181802['uniqueid']));}headers[_0xa55c('0x4b')]=getAuth(_0x44b7c1);return getUser(_0x44b7c1,_0x2ecf79['email'])[_0xa55c('0x10')](function(_0x157afe){_0x4b85cc=_0x157afe;logger[_0xa55c('0xb')](_0xa55c('0x5d'),_0x4b85cc['id']);return getEndUser(_0x44b7c1,_0x181802[_0xa55c('0x5e')],_0x181802[_0xa55c('0x5f')]);})[_0xa55c('0x10')](function(_0x53e2be){_0x3929a6=_0x53e2be;logger[_0xa55c('0xb')](_0xa55c('0x60'),_0x3929a6['id']);return getTicket(_0x44b7c1,_0x4b85cc,_0x3929a6,_0x3f9313,_0x181802);})[_0xa55c('0x10')](function(_0x23a30e){if(_0x23a30e){logger[_0xa55c('0xb')]('Ticket\x20created!');logger[_0xa55c('0xb')](_0xa55c('0x50'),_0x23a30e['id']);switch(_0x44b7c1[_0xa55c('0x2c')]){case _0xa55c('0x51'):logger[_0xa55c('0xb')]('[QUEUE]',_0xa55c('0x61'));emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2ecf79[_0xa55c('0x38')]),_0xa55c('0x53'),{'recordId':_0x23a30e['id']});break;case'newTab':logger[_0xa55c('0xb')]('[QUEUE]',_0xa55c('0x55'));emit(util['format'](_0xa55c('0x52'),_0x2ecf79['name']),_0xa55c('0x56'),{'uri':util[_0xa55c('0xd')](_0xa55c('0x62'),_0x44b7c1[_0xa55c('0xf')],_0x23a30e['id'])});break;default:logger[_0xa55c('0x57')](_0xa55c('0x5c'),_0xa55c('0x58'));}}})[_0xa55c('0x63')](function(_0x14b515){logger[_0xa55c('0x57')]('[OUTBOUND]',JSON[_0xa55c('0x17')](_0x14b515));});};exports[_0xa55c('0x64')]=function(_0x4ef914,_0x18b928,_0x2b8b88,_0x3e3b4b,_0x9fe234,_0x1b8b06){var _0xa38271,_0x3cef1f;_0x1b8b06[_0xa55c('0xf')]=intUtil['stripTrailingSlash'](_0x1b8b06[_0xa55c('0xf')]);_0x1b8b06[_0xa55c('0x46')]=intUtil[_0xa55c('0x45')](_0x1b8b06[_0xa55c('0x46')]);if(_0x9fe234&&_0x9fe234[_0xa55c('0x65')]){logger[_0xa55c('0xb')]('['+_0x18b928[_0xa55c('0x66')][_0xa55c('0x67')]()+']',_0xa55c('0x68'));_0x18b928['recordingURL']=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x1b8b06[_0xa55c('0x46')],_0x18b928[_0xa55c('0x4a')],md5(_0x18b928[_0xa55c('0x4a')]));}else{_0x18b928[_0xa55c('0x48')]='';}headers[_0xa55c('0x4b')]=getAuth(_0x1b8b06);return getUser(_0x1b8b06)[_0xa55c('0x10')](function(_0x2e4cf7){_0xa38271=_0x2e4cf7;logger[_0xa55c('0xb')](_0xa55c('0x5d'),_0xa38271['id']);return getEndUser(_0x1b8b06,_0x18b928['calleridname'],_0x18b928[_0xa55c('0x4e')]);})['then'](function(_0x1228a4){_0x3cef1f=_0x1228a4;logger[_0xa55c('0xb')](_0xa55c('0x60'),_0x3cef1f['id']);return getTicket(_0x1b8b06,_0xa38271,_0x3cef1f,_0x2b8b88,_0x18b928);})['then'](function(_0x4d9722){if(_0x4d9722){logger[_0xa55c('0xb')](_0xa55c('0x4f'));logger[_0xa55c('0xb')](_0xa55c('0x50'),_0x4d9722['id']);}})['catch'](function(_0x149cb9){logger[_0xa55c('0x57')]('['+_0x18b928[_0xa55c('0x66')][_0xa55c('0x67')]()+']',JSON[_0xa55c('0x17')](_0x149cb9));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index dc81c94..2d4fcf8 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 _0x46e2=['calleridnum','contacts','Bearer\x20','4.0','body','headers','odata-entityid','substring','lastIndexOf','enduserId','toLowerCase','destcalleridnum','telephone1','contacts?$select=','\x20eq\x20\x27','replace','%2b','nothing',']\x20Enduser\x20created!','forEach','includes','picklist','nameField','idField','indexOf','ticketType','incident','incidents','assign','getString','Subjects','Descriptions','/contacts(','/systemusers(','Fields','phonecall','callDirection','queue','phonecalls','ticketId','format','user:%s','emit','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','request-promise','util','md5','dynamics365','../../../../config/environment','redis','localhost','socket.io-emitter','modernAuthentication','remoteUri','data7','CloudProvider','data2','resolve','POST','username','password','clientSecret','then','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','value','isNil','email','userEmail','length','isdisabled','systemuserid','userId','info',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','internalemailaddress','message','outbound'];(function(_0x266600,_0x2afa01){var _0x564a48=function(_0x115cfe){while(--_0x115cfe){_0x266600['push'](_0x266600['shift']());}};_0x564a48(++_0x2afa01);}(_0x46e2,0x117));var _0x246e=function(_0x3e1bac,_0x445840){_0x3e1bac=_0x3e1bac-0x0;var _0x3c3d9d=_0x46e2[_0x3e1bac];return _0x3c3d9d;};'use strict';var _=require('lodash');var rp=require(_0x246e('0x0'));var util=require(_0x246e('0x1'));var intUtil=require('./util');var md5=require(_0x246e('0x2'));var Redis=require('ioredis');var logger=require('../../../../config/logger')(_0x246e('0x3'));var config=require(_0x246e('0x4'));config[_0x246e('0x5')]=_['defaults'](config[_0x246e('0x5')],{'host':_0x246e('0x6'),'port':0x18eb});var io=require(_0x246e('0x7'))(new Redis(config['redis']));function getAuthToken(_0x4dd942,_0x32ef5a,_0x3161e2){if(_0x4dd942[_0x246e('0x8')]){_0x4dd942[_0x246e('0x9')]=_0x4dd942['CloudProvider'][_0x246e('0xa')];_0x4dd942['tenantId']=_0x4dd942[_0x246e('0xb')][_0x246e('0xc')];return Promise[_0x246e('0xd')](_0x4dd942['CloudProvider']['data5']);}var _0x460bad={'method':_0x246e('0xe'),'uri':_0x32ef5a,'form':{'client_id':_0x4dd942['clientId'],'resource':_0x4dd942[_0x246e('0x9')],'username':_0x4dd942[_0x246e('0xf')],'password':_0x4dd942[_0x246e('0x10')],'grant_type':_0x246e('0x10'),'client_secret':_0x4dd942[_0x246e('0x11')]},'json':!![]};return rp(_0x460bad)[_0x246e('0x12')](function(_0x3eec0e){return _0x3eec0e[_0x246e('0x13')];})[_0x246e('0x14')](function(_0x109ea8){logger[_0x246e('0x15')]('['+[_0x3161e2[_0x246e('0x16')]()]+_0x246e('0x17'));return _0x109ea8['message'];});}function getUser(_0x133a80,_0x41b599,_0x54fb45,_0x426f3b,_0x278fdd,_0x49bdc5){return new Promise(function(_0x4b7ba9,_0xe8d7fd){return getAuthToken(_0x41b599,_0x426f3b,_0x49bdc5)[_0x246e('0x12')](function(_0x35d236){var _0x4e8853={'method':_0x246e('0x18'),'uri':_0x278fdd+_0x246e('0x19'),'headers':{'Authorization':'Bearer\x20'+_0x35d236,'OData-Version':'4.0'},'json':!![]};return rp(_0x4e8853);})['then'](function(_0x27ca04){var _0x15b1a1=_0x27ca04[_0x246e('0x1a')];var _0x5c54f3=![];var _0x4763a3=null;if(!_[_0x246e('0x1b')](_0x54fb45)){if(intUtil['validateEmail'](_0x54fb45[_0x246e('0x1c')])){_0x133a80[_0x246e('0x1d')]=_0x54fb45[_0x246e('0x1c')];for(_0x4763a3=0x0;_0x4763a3<_0x15b1a1[_0x246e('0x1e')];_0x4763a3++){if(_0x15b1a1[_0x4763a3]['internalemailaddress']===_0x54fb45['email']&&!_0x15b1a1[_0x4763a3][_0x246e('0x1f')]){_0x5c54f3=!![];logger['info']('['+[_0x49bdc5['toUpperCase']()]+']\x20Agent\x20found\x20'+_0x15b1a1[_0x4763a3][_0x246e('0x20')]+'!');_0x133a80[_0x246e('0x21')]=_0x15b1a1[_0x4763a3][_0x246e('0x20')];}}}}if(!_0x5c54f3){logger[_0x246e('0x22')]('['+[_0x49bdc5[_0x246e('0x16')]()]+_0x246e('0x23'));_0x133a80[_0x246e('0x1d')]=_0x41b599['username'];for(_0x4763a3=0x0;_0x4763a3<_0x15b1a1[_0x246e('0x1e')];_0x4763a3++){if(_0x15b1a1[_0x4763a3][_0x246e('0x24')]===_0x41b599[_0x246e('0xf')]){_0x133a80[_0x246e('0x21')]=_0x15b1a1[_0x4763a3][_0x246e('0x20')];}}}_0x4b7ba9(_0x133a80);})['catch'](function(_0x570f30){_0xe8d7fd(_0x570f30[_0x246e('0x25')]);});});}function createEndUser(_0x399c4c,_0x4faf15,_0x41ab3a,_0x1feaf8,_0x1f09f8,_0x2e231b,_0x52e52c){return new Promise(function(_0x370278,_0x20c386){return getAuthToken(_0x4faf15,_0x41ab3a,_0x2e231b)[_0x246e('0x12')](function(_0x1c6977){var _0x347066=_0x2e231b['toLowerCase']()===_0x246e('0x26')?_0x1f09f8['destcalleridnum']:_0x1f09f8[_0x246e('0x27')];var _0x45718f={'method':_0x246e('0xe'),'uri':_0x1feaf8+_0x246e('0x28'),'body':{'fullname':_0x347066,'firstname':_0x347066,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x399c4c[_0x246e('0x21')]+')'},'headers':{'Authorization':_0x246e('0x29')+_0x1c6977,'OData-Version':_0x246e('0x2a')},'json':!![],'resolveWithFullResponse':!![]};_0x45718f[_0x246e('0x2b')][_0x52e52c]=_0x347066;return rp(_0x45718f);})['then'](function(_0x2fe405){var _0x564cfb=_0x2fe405[_0x246e('0x2c')][_0x246e('0x2d')];var _0x27d162=_0x564cfb[_0x246e('0x2e')](_0x564cfb[_0x246e('0x2f')]('(')+0x1,_0x564cfb[_0x246e('0x2f')](')'));_0x399c4c[_0x246e('0x30')]=_0x27d162;_0x370278(_0x399c4c);})[_0x246e('0x14')](function(_0x4c5222){_0x20c386(_0x4c5222[_0x246e('0x25')]);});});}function getEndUser(_0x4e7cb9,_0x306f3f,_0x7a5cc0,_0x396441,_0x3e487f,_0x168dde,_0x24da29,_0x58a5b3){var _0x349d1c=_0x168dde[_0x246e('0x31')]()===_0x246e('0x26')?_0x3e487f[_0x246e('0x32')]:_0x3e487f['calleridnum'];return getAuthToken(_0x306f3f,_0x7a5cc0,_0x168dde)[_0x246e('0x12')](function(_0x28c8ff){_0x58a5b3=_0x58a5b3?_0x58a5b3:_0x246e('0x33');var _0xb5e19f={'method':_0x246e('0x18'),'uri':_0x396441+_0x246e('0x34')+_0x58a5b3+'&$filter='+_0x58a5b3+_0x246e('0x35')+_0x349d1c[_0x246e('0x36')]('+',_0x246e('0x37'))+'\x27','headers':{'Authorization':_0x246e('0x29')+_0x28c8ff,'If-None-Match':null,'OData-Version':_0x246e('0x2a')},'json':!![]};return rp(_0xb5e19f);})[_0x246e('0x12')](function(_0x48c0d5){var _0x504b3f=![];if(!_0x48c0d5)return _0x504b3f;var _0x3d35cb=_0x48c0d5[_0x246e('0x1a')];for(var _0x53398d=0x0;_0x53398d<_0x3d35cb[_0x246e('0x1e')];_0x53398d++){if(_0x3d35cb[_0x53398d][_0x58a5b3]===_0x349d1c){_0x504b3f=!![];_0x4e7cb9[_0x246e('0x30')]=_0x3d35cb[_0x53398d]['contactid'];}}return _0x504b3f;})[_0x246e('0x12')](function(_0x411fd2){if(_0x411fd2)return _0x4e7cb9;if(_0x24da29===_0x246e('0x38')){logger[_0x246e('0x22')]('['+[_0x168dde['toUpperCase']()]+']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing');return _0x4e7cb9;}return createEndUser(_0x4e7cb9,_0x306f3f,_0x7a5cc0,_0x396441,_0x3e487f,_0x168dde,_0x58a5b3)[_0x246e('0x12')](function(_0x35f145){logger[_0x246e('0x22')]('['+[_0x168dde[_0x246e('0x16')]()]+_0x246e('0x39'),_0x35f145['enduserId']);return _0x35f145;});});}function getCustomFields(_0x578b1a,_0x51018a,_0x27d9f1){var _0x1a3a98={};if(_0x578b1a['length']>0x0){_[_0x246e('0x3a')](_0x578b1a,function(_0x1f2a17){if(_[_0x246e('0x3b')](['string',_0x246e('0x3c')],_0x1f2a17['type'])&&_0x1f2a17[_0x246e('0x3d')]&&!_0x1f2a17['customField']){var _0x3f07e6=_0x1f2a17[_0x246e('0x3e')][_0x246e('0x31')]();var _0x41f8a9=_0x3f07e6[_0x246e('0x2e')](0x0,_0x3f07e6[_0x246e('0x3f')]('_'));var _0x1cad6b=_0x3f07e6['substring'](_0x3f07e6[_0x246e('0x3f')]('_')+0x1);if(_0x41f8a9===_0x27d9f1){_0x1a3a98[_0x1cad6b]=_0x1f2a17['content'];}}});}return _0x1a3a98;}function getTicket(_0x1cb67e,_0x203bdf,_0x5a1905,_0x151d40,_0x5c1f2e,_0x354938,_0x3f9e71){return new Promise(function(_0x5dc201,_0x2908d5){var _0x2847d3;return getAuthToken(_0x203bdf,_0x5a1905,_0x3f9e71)[_0x246e('0x12')](function(_0x4dec64){if(_0x354938[_0x246e('0x40')]===_0x246e('0x41')){_0x2847d3={'method':_0x246e('0xe'),'uri':_0x151d40+_0x246e('0x42'),'body':Object[_0x246e('0x43')]({},{'title':intUtil[_0x246e('0x44')](_0x354938[_0x246e('0x45')],_0x5c1f2e,'\x20'),'description':intUtil[_0x246e('0x44')](_0x354938[_0x246e('0x46')],_0x5c1f2e,'\x0a'),'customerid_contact@odata.bind':_0x1cb67e[_0x246e('0x30')]?_0x246e('0x47')+_0x1cb67e[_0x246e('0x30')]+')':undefined,'ownerid@odata.bind':_0x246e('0x48')+_0x1cb67e[_0x246e('0x21')]+')','caseorigincode':'1'},getCustomFields(_0x354938[_0x246e('0x49')],_0x5c1f2e,_0x354938[_0x246e('0x40')])),'headers':{'Authorization':_0x246e('0x29')+_0x4dec64,'OData-Version':_0x246e('0x2a')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x354938[_0x246e('0x40')]===_0x246e('0x4a')){var _0x2924bb=_0x1cb67e['enduserId']?[{'partyid_systemuser@odata.bind':_0x246e('0x48')+_0x1cb67e[_0x246e('0x21')]+')','participationtypemask':_0x1cb67e['callDirection']==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0x246e('0x47')+_0x1cb67e[_0x246e('0x30')]+')','participationtypemask':_0x1cb67e[_0x246e('0x4b')]===_0x246e('0x4c')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x246e('0x48')+_0x1cb67e[_0x246e('0x21')]+')','participationtypemask':_0x1cb67e[_0x246e('0x4b')]===_0x246e('0x4c')?0x2:0x1}];_0x2847d3={'method':_0x246e('0xe'),'uri':_0x151d40+_0x246e('0x4d'),'body':Object[_0x246e('0x43')]({},{'subject':intUtil[_0x246e('0x44')](_0x354938[_0x246e('0x45')],_0x5c1f2e,'\x20'),'phonenumber':String(_0x5c1f2e[_0x246e('0x27')]),'description':intUtil[_0x246e('0x44')](_0x354938[_0x246e('0x46')],_0x5c1f2e,'\x0a'),'regardingobjectid_contact@odata.bind':_0x1cb67e[_0x246e('0x30')]?_0x246e('0x47')+_0x1cb67e[_0x246e('0x30')]+')':undefined,'ownerid@odata.bind':_0x246e('0x48')+_0x1cb67e['userId']+')','directioncode':_0x1cb67e[_0x246e('0x4b')]===_0x246e('0x4c')?![]:!![],'phonecall_activity_parties':_0x2924bb},getCustomFields(_0x354938['Fields'],_0x5c1f2e,_0x354938[_0x246e('0x40')])),'headers':{'Authorization':_0x246e('0x29')+_0x4dec64,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x2847d3);})[_0x246e('0x12')](function(_0x4df0b3){var _0x2f4637=_0x4df0b3[_0x246e('0x2c')][_0x246e('0x2d')];var _0x1aaab4=_0x2f4637['substring'](_0x2f4637[_0x246e('0x2f')]('(')+0x1,_0x2f4637[_0x246e('0x2f')](')'));_0x1cb67e[_0x246e('0x4e')]=_0x1aaab4;_0x5dc201(_0x1cb67e);})['catch'](function(_0x510126){_0x2908d5(_0x510126[_0x246e('0x25')]);});});}function emit(_0x21b045,_0x3d5e7d,_0x5238a6,_0x1565d8){var _0x25f3b8={'uri':util[_0x246e('0x4f')]('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x21b045,_0x5238a6,_0x1565d8)};io['to'](util['format'](_0x246e('0x50'),_0x3d5e7d))[_0x246e('0x51')]('trigger:browser:url',_0x25f3b8);}exports['cs']=function(_0x85c102,_0x31fce6,_0x42b6b9,_0x3651e9,_0x5801d6,_0x3865f8,_0x3d3f61,_0x23abad){var _0x4b66c4={};_0x3865f8[_0x246e('0x9')]=_0x3865f8[_0x246e('0x8')]?intUtil[_0x246e('0x52')](_0x3865f8[_0x246e('0xb')]['data7']):intUtil[_0x246e('0x52')](_0x3865f8[_0x246e('0x9')]);_0x3865f8[_0x246e('0x53')]=intUtil['stripTrailingSlash'](_0x3865f8[_0x246e('0x53')]);_0x4b66c4[_0x246e('0x4b')]=_0x23abad===_0x246e('0x4c')||_0x23abad===_0x246e('0x54')?_0x246e('0x4c'):_0x246e('0x26');var _0x2aeb49=_0x3865f8[_0x246e('0x8')]?util['format'](_0x246e('0x55'),_0x3865f8['CloudProvider']['data7']):util[_0x246e('0x4f')](_0x246e('0x55'),_0x3865f8['remoteUri']);var _0x133f43=util[_0x246e('0x4f')](_0x246e('0x56'),_0x3865f8[_0x246e('0x57')]);var _0x4c77d9=util[_0x246e('0x4f')](_0x246e('0x58'),_0x3865f8[_0x246e('0x53')],_0x31fce6['uniqueid'],md5(_0x31fce6['uniqueid']));if(_0x5801d6&&_0x5801d6[_0x246e('0x59')]){logger[_0x246e('0x22')]('[QUEUE]',_0x246e('0x5a'));_0x31fce6[_0x246e('0x5b')]=_0x4c77d9;}else if(_0x3d3f61&&_0x3d3f61['recordingFormat']&&_0x3d3f61[_0x246e('0x5c')]!==_0x246e('0x5d')){logger['info'](_0x246e('0x5e'),_0x246e('0x5a'));_0x31fce6[_0x246e('0x5b')]=_0x4c77d9;}else{_0x31fce6[_0x246e('0x5b')]='';}return getUser(_0x4b66c4,_0x3865f8,_0x3651e9,_0x133f43,_0x2aeb49,_0x23abad)['then'](function(_0x48f22c){logger[_0x246e('0x22')]('['+_0x23abad['toUpperCase']()+_0x246e('0x5f'),_0x48f22c[_0x246e('0x21')]);logger[_0x246e('0x22')]('['+_0x23abad['toUpperCase']()+_0x246e('0x60'),_0x48f22c[_0x246e('0x1d')]);return getEndUser(_0x48f22c,_0x3865f8,_0x133f43,_0x2aeb49,_0x31fce6,_0x23abad,_0x42b6b9[_0x246e('0x61')],_0x42b6b9[_0x246e('0x62')]);})['then'](function(_0x2c33ee){logger[_0x246e('0x22')]('['+_0x23abad[_0x246e('0x16')]()+']\x20The\x20Enduser\x20ID\x20is:',_0x2c33ee[_0x246e('0x30')]);logger[_0x246e('0x22')]('['+_0x23abad[_0x246e('0x16')]()+_0x246e('0x63'),_0x31fce6[_0x246e('0x27')]);return getTicket(_0x2c33ee,_0x3865f8,_0x133f43,_0x2aeb49,_0x31fce6,_0x42b6b9,_0x23abad);})['then'](function(_0x3841e5){logger[_0x246e('0x22')](util[_0x246e('0x4f')]('['+_0x23abad[_0x246e('0x16')]()+_0x246e('0x64'),_0x42b6b9[_0x246e('0x40')],_0x3841e5['ticketId']));logger[_0x246e('0x22')](util['format']('['+_0x23abad[_0x246e('0x16')]()+_0x246e('0x65'),_0x23abad));if(_0x23abad!=='unmanaged'&&_0x42b6b9[_0x246e('0x66')]){logger[_0x246e('0x22')]('['+_0x23abad['toUpperCase']()+']',_0x246e('0x67'));emit(_0x3865f8[_0x246e('0x9')],_0x3651e9['name'],_0x42b6b9[_0x246e('0x40')],_0x3841e5[_0x246e('0x4e')]);}})[_0x246e('0x14')](function(_0x5904fc){logger[_0x246e('0x15')]('['+_0x23abad['toUpperCase']()+_0x246e('0x68'),_0x5904fc[_0x246e('0x25')]);console[_0x246e('0x15')](_0x246e('0x69'),_0x5904fc);});}; \ No newline at end of file +var _0x11a8=['length','isdisabled','info','toUpperCase',']\x20Agent\x20found\x20','systemuserid','userEmail','internalemailaddress','userId','catch','toLowerCase','POST','contacts','/systemusers(','4.0','body','headers','odata-entityid','substring','lastIndexOf','outbound','destcalleridnum','calleridnum','telephone1','contacts?$select=','&$filter=','replace','%2b','enduserId','contactid','nothing',']\x20Enduser\x20created!','includes','string','idField','indexOf','content','ticketType','incident','incidents','getString','Subjects','Descriptions','Fields','callDirection','/contacts(','queue','phonecalls','assign','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','none','Recording\x20is\x20enabled!',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate',']\x20The\x20Enduser\x20phone\x20is:','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','request-promise','util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','modernAuthentication','remoteUri','data7','CloudProvider','resolve','data5','username','password','clientSecret','then','error','message','GET','Bearer\x20','value','isNil','validateEmail','email'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0x11a8,0xb9));var _0x811a=function(_0x3bbb82,_0x132a9d){_0x3bbb82=_0x3bbb82-0x0;var _0x594c0c=_0x11a8[_0x3bbb82];return _0x594c0c;};'use strict';var _=require('lodash');var rp=require(_0x811a('0x0'));var util=require(_0x811a('0x1'));var intUtil=require('./util');var md5=require(_0x811a('0x2'));var Redis=require(_0x811a('0x3'));var logger=require(_0x811a('0x4'))(_0x811a('0x5'));var config=require(_0x811a('0x6'));config[_0x811a('0x7')]=_[_0x811a('0x8')](config['redis'],{'host':_0x811a('0x9'),'port':0x18eb});var io=require(_0x811a('0xa'))(new Redis(config[_0x811a('0x7')]));function getAuthToken(_0x2e1994,_0x549698,_0x13b0d2){if(_0x2e1994[_0x811a('0xb')]){_0x2e1994[_0x811a('0xc')]=_0x2e1994['CloudProvider'][_0x811a('0xd')];_0x2e1994['tenantId']=_0x2e1994[_0x811a('0xe')]['data2'];return Promise[_0x811a('0xf')](_0x2e1994['CloudProvider'][_0x811a('0x10')]);}var _0x5eba10={'method':'POST','uri':_0x549698,'form':{'client_id':_0x2e1994['clientId'],'resource':_0x2e1994[_0x811a('0xc')],'username':_0x2e1994[_0x811a('0x11')],'password':_0x2e1994[_0x811a('0x12')],'grant_type':_0x811a('0x12'),'client_secret':_0x2e1994[_0x811a('0x13')]},'json':!![]};return rp(_0x5eba10)[_0x811a('0x14')](function(_0x466f20){return _0x466f20['access_token'];})['catch'](function(_0x2c2886){logger[_0x811a('0x15')]('['+[_0x13b0d2['toUpperCase']()]+']\x20Wrong\x20credentials!');return _0x2c2886[_0x811a('0x16')];});}function getUser(_0x1e2848,_0x3e3e3a,_0xb1cf85,_0x5844af,_0x150ee5,_0x9435d4){return new Promise(function(_0x4bc954,_0x4d958f){return getAuthToken(_0x3e3e3a,_0x5844af,_0x9435d4)[_0x811a('0x14')](function(_0x56f95d){var _0x4d7e93={'method':_0x811a('0x17'),'uri':_0x150ee5+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':_0x811a('0x18')+_0x56f95d,'OData-Version':'4.0'},'json':!![]};return rp(_0x4d7e93);})['then'](function(_0x5f219b){var _0x319321=_0x5f219b[_0x811a('0x19')];var _0x119401=![];var _0x341216=null;if(!_[_0x811a('0x1a')](_0xb1cf85)){if(intUtil[_0x811a('0x1b')](_0xb1cf85[_0x811a('0x1c')])){_0x1e2848['userEmail']=_0xb1cf85[_0x811a('0x1c')];for(_0x341216=0x0;_0x341216<_0x319321[_0x811a('0x1d')];_0x341216++){if(_0x319321[_0x341216]['internalemailaddress']===_0xb1cf85[_0x811a('0x1c')]&&!_0x319321[_0x341216][_0x811a('0x1e')]){_0x119401=!![];logger[_0x811a('0x1f')]('['+[_0x9435d4[_0x811a('0x20')]()]+_0x811a('0x21')+_0x319321[_0x341216][_0x811a('0x22')]+'!');_0x1e2848['userId']=_0x319321[_0x341216][_0x811a('0x22')];}}}}if(!_0x119401){logger[_0x811a('0x1f')]('['+[_0x9435d4[_0x811a('0x20')]()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x1e2848[_0x811a('0x23')]=_0x3e3e3a[_0x811a('0x11')];for(_0x341216=0x0;_0x341216<_0x319321[_0x811a('0x1d')];_0x341216++){if(_0x319321[_0x341216][_0x811a('0x24')]===_0x3e3e3a['username']){_0x1e2848[_0x811a('0x25')]=_0x319321[_0x341216]['systemuserid'];}}}_0x4bc954(_0x1e2848);})[_0x811a('0x26')](function(_0x62a8ae){_0x4d958f(_0x62a8ae[_0x811a('0x16')]);});});}function createEndUser(_0x449926,_0x2f2765,_0x5cb6ff,_0x1ac328,_0x1dfcd2,_0x344bb9,_0x1d534d){return new Promise(function(_0x42d449,_0x26f382){return getAuthToken(_0x2f2765,_0x5cb6ff,_0x344bb9)[_0x811a('0x14')](function(_0x2928bd){var _0x362153=_0x344bb9[_0x811a('0x27')]()==='outbound'?_0x1dfcd2['destcalleridnum']:_0x1dfcd2['calleridnum'];var _0x2df884={'method':_0x811a('0x28'),'uri':_0x1ac328+_0x811a('0x29'),'body':{'fullname':_0x362153,'firstname':_0x362153,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x811a('0x2a')+_0x449926[_0x811a('0x25')]+')'},'headers':{'Authorization':_0x811a('0x18')+_0x2928bd,'OData-Version':_0x811a('0x2b')},'json':!![],'resolveWithFullResponse':!![]};_0x2df884[_0x811a('0x2c')][_0x1d534d]=_0x362153;return rp(_0x2df884);})['then'](function(_0x224b34){var _0x222477=_0x224b34[_0x811a('0x2d')][_0x811a('0x2e')];var _0x2bd600=_0x222477[_0x811a('0x2f')](_0x222477[_0x811a('0x30')]('(')+0x1,_0x222477[_0x811a('0x30')](')'));_0x449926['enduserId']=_0x2bd600;_0x42d449(_0x449926);})[_0x811a('0x26')](function(_0x8424ef){_0x26f382(_0x8424ef['message']);});});}function getEndUser(_0x1d667d,_0xdcebe6,_0x1206db,_0x54e5cb,_0x373b01,_0x1edcdd,_0x484945,_0x5113c5){var _0x528b63=_0x1edcdd['toLowerCase']()===_0x811a('0x31')?_0x373b01[_0x811a('0x32')]:_0x373b01[_0x811a('0x33')];return getAuthToken(_0xdcebe6,_0x1206db,_0x1edcdd)['then'](function(_0x2372c1){_0x5113c5=_0x5113c5?_0x5113c5:_0x811a('0x34');var _0x44394a={'method':'GET','uri':_0x54e5cb+_0x811a('0x35')+_0x5113c5+_0x811a('0x36')+_0x5113c5+'\x20eq\x20\x27'+_0x528b63[_0x811a('0x37')]('+',_0x811a('0x38'))+'\x27','headers':{'Authorization':'Bearer\x20'+_0x2372c1,'If-None-Match':null,'OData-Version':_0x811a('0x2b')},'json':!![]};return rp(_0x44394a);})[_0x811a('0x14')](function(_0x58307b){var _0x124eb2=![];if(!_0x58307b)return _0x124eb2;var _0x4a3920=_0x58307b[_0x811a('0x19')];for(var _0x2e4992=0x0;_0x2e4992<_0x4a3920[_0x811a('0x1d')];_0x2e4992++){if(_0x4a3920[_0x2e4992][_0x5113c5]===_0x528b63){_0x124eb2=!![];_0x1d667d[_0x811a('0x39')]=_0x4a3920[_0x2e4992][_0x811a('0x3a')];}}return _0x124eb2;})[_0x811a('0x14')](function(_0x272cac){if(_0x272cac)return _0x1d667d;if(_0x484945===_0x811a('0x3b')){logger[_0x811a('0x1f')]('['+[_0x1edcdd[_0x811a('0x20')]()]+']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing');return _0x1d667d;}return createEndUser(_0x1d667d,_0xdcebe6,_0x1206db,_0x54e5cb,_0x373b01,_0x1edcdd,_0x5113c5)[_0x811a('0x14')](function(_0x1555e9){logger[_0x811a('0x1f')]('['+[_0x1edcdd[_0x811a('0x20')]()]+_0x811a('0x3c'),_0x1555e9[_0x811a('0x39')]);return _0x1555e9;});});}function getCustomFields(_0x25c29d,_0x105ede,_0x22ad1b){var _0x2408ed={};if(_0x25c29d['length']>0x0){_['forEach'](_0x25c29d,function(_0x2a34d8){if(_[_0x811a('0x3d')]([_0x811a('0x3e'),'picklist'],_0x2a34d8['type'])&&_0x2a34d8['nameField']&&!_0x2a34d8['customField']){var _0x335f61=_0x2a34d8[_0x811a('0x3f')]['toLowerCase']();var _0x163546=_0x335f61['substring'](0x0,_0x335f61[_0x811a('0x40')]('_'));var _0x470436=_0x335f61[_0x811a('0x2f')](_0x335f61[_0x811a('0x40')]('_')+0x1);if(_0x163546===_0x22ad1b){_0x2408ed[_0x470436]=_0x2a34d8[_0x811a('0x41')];}}});}return _0x2408ed;}function getTicket(_0x15122c,_0x7a08d7,_0x3299b0,_0x464a11,_0x195751,_0x2ce1e2,_0x507698){return new Promise(function(_0x5d2e14,_0x57bfd6){var _0x496680;return getAuthToken(_0x7a08d7,_0x3299b0,_0x507698)[_0x811a('0x14')](function(_0x53bd36){if(_0x2ce1e2[_0x811a('0x42')]===_0x811a('0x43')){_0x496680={'method':_0x811a('0x28'),'uri':_0x464a11+_0x811a('0x44'),'body':Object['assign']({},{'title':intUtil[_0x811a('0x45')](_0x2ce1e2[_0x811a('0x46')],_0x195751,'\x20'),'description':intUtil[_0x811a('0x45')](_0x2ce1e2[_0x811a('0x47')],_0x195751,'\x0a'),'customerid_contact@odata.bind':_0x15122c[_0x811a('0x39')]?'/contacts('+_0x15122c['enduserId']+')':undefined,'ownerid@odata.bind':_0x811a('0x2a')+_0x15122c[_0x811a('0x25')]+')','caseorigincode':'1'},getCustomFields(_0x2ce1e2[_0x811a('0x48')],_0x195751,_0x2ce1e2['ticketType'])),'headers':{'Authorization':'Bearer\x20'+_0x53bd36,'OData-Version':_0x811a('0x2b')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x2ce1e2['ticketType']==='phonecall'){var _0x16be03=_0x15122c[_0x811a('0x39')]?[{'partyid_systemuser@odata.bind':_0x811a('0x2a')+_0x15122c[_0x811a('0x25')]+')','participationtypemask':_0x15122c[_0x811a('0x49')]==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0x811a('0x4a')+_0x15122c['enduserId']+')','participationtypemask':_0x15122c[_0x811a('0x49')]===_0x811a('0x4b')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x811a('0x2a')+_0x15122c['userId']+')','participationtypemask':_0x15122c[_0x811a('0x49')]===_0x811a('0x4b')?0x2:0x1}];_0x496680={'method':_0x811a('0x28'),'uri':_0x464a11+_0x811a('0x4c'),'body':Object[_0x811a('0x4d')]({},{'subject':intUtil[_0x811a('0x45')](_0x2ce1e2[_0x811a('0x46')],_0x195751,'\x20'),'phonenumber':String(_0x195751[_0x811a('0x33')]),'description':intUtil['getString'](_0x2ce1e2[_0x811a('0x47')],_0x195751,'\x0a'),'regardingobjectid_contact@odata.bind':_0x15122c[_0x811a('0x39')]?_0x811a('0x4a')+_0x15122c[_0x811a('0x39')]+')':undefined,'ownerid@odata.bind':_0x811a('0x2a')+_0x15122c['userId']+')','directioncode':_0x15122c[_0x811a('0x49')]===_0x811a('0x4b')?![]:!![],'phonecall_activity_parties':_0x16be03},getCustomFields(_0x2ce1e2[_0x811a('0x48')],_0x195751,_0x2ce1e2[_0x811a('0x42')])),'headers':{'Authorization':_0x811a('0x18')+_0x53bd36,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x496680);})[_0x811a('0x14')](function(_0x37d9e2){var _0x41736c=_0x37d9e2[_0x811a('0x2d')][_0x811a('0x2e')];var _0x1da79d=_0x41736c[_0x811a('0x2f')](_0x41736c[_0x811a('0x30')]('(')+0x1,_0x41736c['lastIndexOf'](')'));_0x15122c[_0x811a('0x4e')]=_0x1da79d;_0x5d2e14(_0x15122c);})['catch'](function(_0x57e928){_0x57bfd6(_0x57e928['message']);});});}function emit(_0x8a79d1,_0x59ee54,_0xfddda0,_0x40de3f){var _0x22e43e={'uri':util[_0x811a('0x4f')](_0x811a('0x50'),_0x8a79d1,_0xfddda0,_0x40de3f)};io['to'](util[_0x811a('0x4f')](_0x811a('0x51'),_0x59ee54))[_0x811a('0x52')](_0x811a('0x53'),_0x22e43e);}exports['cs']=function(_0x315bfb,_0xf9b4c1,_0x133add,_0x5216b0,_0x34dbf6,_0x566427,_0x308136,_0x132234){var _0x2d1b61={};_0x566427['remoteUri']=_0x566427[_0x811a('0xb')]?intUtil[_0x811a('0x54')](_0x566427[_0x811a('0xe')][_0x811a('0xd')]):intUtil[_0x811a('0x54')](_0x566427[_0x811a('0xc')]);_0x566427[_0x811a('0x55')]=intUtil['stripTrailingSlash'](_0x566427[_0x811a('0x55')]);_0x2d1b61[_0x811a('0x49')]=_0x132234===_0x811a('0x4b')||_0x132234===_0x811a('0x56')?'queue':_0x811a('0x31');var _0x226f87=_0x566427[_0x811a('0xb')]?util['format'](_0x811a('0x57'),_0x566427[_0x811a('0xe')][_0x811a('0xd')]):util[_0x811a('0x4f')]('%s/api/data/v9.0/',_0x566427['remoteUri']);var _0x5e7fe2=util[_0x811a('0x4f')](_0x811a('0x58'),_0x566427[_0x811a('0x59')]);var _0x43d771=util[_0x811a('0x4f')](_0x811a('0x5a'),_0x566427[_0x811a('0x55')],_0xf9b4c1[_0x811a('0x5b')],md5(_0xf9b4c1[_0x811a('0x5b')]));if(_0x34dbf6&&_0x34dbf6[_0x811a('0x5c')]){logger[_0x811a('0x1f')](_0x811a('0x5d'),'Recording\x20is\x20enabled!');_0xf9b4c1[_0x811a('0x5e')]=_0x43d771;}else if(_0x308136&&_0x308136['recordingFormat']&&_0x308136[_0x811a('0x5f')]!==_0x811a('0x60')){logger[_0x811a('0x1f')]('[OUTBOUND]',_0x811a('0x61'));_0xf9b4c1[_0x811a('0x5e')]=_0x43d771;}else{_0xf9b4c1['recordingURL']='';}return getUser(_0x2d1b61,_0x566427,_0x5216b0,_0x5e7fe2,_0x226f87,_0x132234)[_0x811a('0x14')](function(_0x535c9d){logger[_0x811a('0x1f')]('['+_0x132234[_0x811a('0x20')]()+_0x811a('0x62'),_0x535c9d[_0x811a('0x25')]);logger[_0x811a('0x1f')]('['+_0x132234[_0x811a('0x20')]()+_0x811a('0x63'),_0x535c9d[_0x811a('0x23')]);return getEndUser(_0x535c9d,_0x566427,_0x5e7fe2,_0x226f87,_0xf9b4c1,_0x132234,_0x133add[_0x811a('0x64')],_0x133add['additionalSearchContact']);})[_0x811a('0x14')](function(_0x2a8a1d){logger['info']('['+_0x132234[_0x811a('0x20')]()+']\x20The\x20Enduser\x20ID\x20is:',_0x2a8a1d[_0x811a('0x39')]);logger[_0x811a('0x1f')]('['+_0x132234[_0x811a('0x20')]()+_0x811a('0x65'),_0xf9b4c1['calleridnum']);return getTicket(_0x2a8a1d,_0x566427,_0x5e7fe2,_0x226f87,_0xf9b4c1,_0x133add,_0x132234);})['then'](function(_0x320d05){logger[_0x811a('0x1f')](util[_0x811a('0x4f')]('['+_0x132234[_0x811a('0x20')]()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x133add[_0x811a('0x42')],_0x320d05[_0x811a('0x4e')]));logger[_0x811a('0x1f')](util['format']('['+_0x132234['toUpperCase']()+']\x20Call\x20direction:\x20%s',_0x132234));if(_0x132234!==_0x811a('0x56')&&_0x133add[_0x811a('0x66')]){logger[_0x811a('0x1f')]('['+_0x132234[_0x811a('0x20')]()+']',_0x811a('0x67'));emit(_0x566427[_0x811a('0xc')],_0x5216b0[_0x811a('0x68')],_0x133add['ticketType'],_0x320d05[_0x811a('0x4e')]);}})[_0x811a('0x26')](function(_0x14e5bc){logger['error']('['+_0x132234[_0x811a('0x20')]()+_0x811a('0x69'),_0x14e5bc['message']);console[_0x811a('0x15')](_0x811a('0x6a'),_0x14e5bc);});}; \ 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 8c5ab7d..c8d464d 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 _0x60df=['The\x20User\x20ID\x20is:','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','outbound','recordingFormat','[OUTBOUND]','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','unmanaged','Recording\x20is\x20enabled!','lastevent','toUpperCase','lodash','request-promise','md5','ioredis','../../../../config/environment','redis','localhost','socket.io-emitter','application/json','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','
','Tags','name','custom_fields','mapValues','value','%s/api/v2/tickets','POST','then','info','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','Agent\x20found!','contact','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','remoteUri','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','find','Enduser\x20created.','Basic\x20%s','apiKey','toString','debug','[HTTP]','stringify','GET','includes','picklist','type','nameField','string','idField','variable','variableName','push','customVariable','Variable','customField','toLowerCase','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','email'];(function(_0x5b78e8,_0x55096b){var _0xf2c321=function(_0x4e0cff){while(--_0x4e0cff){_0x5b78e8['push'](_0x5b78e8['shift']());}};_0xf2c321(++_0x55096b);}(_0x60df,0x1d4));var _0xf60d=function(_0x723376,_0xfd1118){_0x723376=_0x723376-0x0;var _0x38ed18=_0x60df[_0x723376];return _0x38ed18;};'use strict';var _=require(_0xf60d('0x0'));var rp=require(_0xf60d('0x1'));var md5=require(_0xf60d('0x2'));var util=require('util');var Redis=require(_0xf60d('0x3'));var intUtil=require('./util');var config=require(_0xf60d('0x4'));var logger=require('../../../../config/logger')('freshdesk');config[_0xf60d('0x5')]=_['defaults'](config[_0xf60d('0x5')],{'host':_0xf60d('0x6'),'port':0x18eb});var io=require(_0xf60d('0x7'))(new Redis(config[_0xf60d('0x5')]));var headers={'Content-Type':'application/json','Accept':_0xf60d('0x8')};function emit(_0x5c07a3,_0x704a23,_0x31220d){io['to'](_0x5c07a3)['emit'](_0x704a23,_0x31220d);}function getTicket(_0x5716b5,_0x268dc9,_0x21bee4,_0x31a68f,_0x4b80f7){logger['info'](_0xf60d('0x9'));var _0x890db8=_[_0xf60d('0xa')]({'responder_id':_0x268dc9['id'],'requester_id':_0x21bee4['id'],'name':util[_0xf60d('0xb')](_0xf60d('0xc'),_0x4b80f7[_0xf60d('0xd')]),'phone':_0x4b80f7[_0xf60d('0xe')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xf60d('0xf')](_0x31a68f[_0xf60d('0x10')],_0x4b80f7,'\x20'),'description':intUtil[_0xf60d('0xf')](_0x31a68f['Descriptions'],_0x4b80f7,_0xf60d('0x11')),'tags':getTags(_0x31a68f[_0xf60d('0x12')],_0xf60d('0x13'))},getCustomFields(_0x31a68f['Fields'],_0x4b80f7));_0x890db8[_0xf60d('0x14')]=_[_0xf60d('0x15')](_['keyBy'](_0x890db8[_0xf60d('0x14')],'id'),_0xf60d('0x16'));return request({'uri':util[_0xf60d('0xb')](_0xf60d('0x17'),_0x5716b5['remoteUri']),'method':_0xf60d('0x18'),'body':_0x890db8})[_0xf60d('0x19')](function(_0x6e7abd){logger[_0xf60d('0x1a')](_0xf60d('0x1b'));return _0x6e7abd;});}function getUser(_0x5f33cc,_0x4092f8){if(intUtil[_0xf60d('0x1c')](_0x4092f8)){return request({'uri':util[_0xf60d('0xb')](_0xf60d('0x1d'),_0x5f33cc['remoteUri']),'qs':{'email':_0x4092f8}})[_0xf60d('0x19')](function(_0x197699){if(_0x197699[_0xf60d('0x1e')]){logger[_0xf60d('0x1a')](_0xf60d('0x1f'));return _['find'](_0x197699,function(_0xfb2836){return _0xfb2836[_0xf60d('0x20')]['email']===_0x4092f8;});}else{logger['info'](_0xf60d('0x21'));return request({'uri':util[_0xf60d('0xb')](_0xf60d('0x22'),_0x5f33cc[_0xf60d('0x23')])})[_0xf60d('0x19')](function(_0x542f63){logger[_0xf60d('0x1a')]('Admin\x20account\x20selected.');return _0x542f63;});}});}else{logger[_0xf60d('0x1a')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xf60d('0xb')]('%s/api/v2/agents/me',_0x5f33cc[_0xf60d('0x23')])})[_0xf60d('0x19')](function(_0x366637){logger[_0xf60d('0x1a')](_0xf60d('0x24'));return _0x366637;});}}function getEndUser(_0x59c76a,_0x2060a0,_0x4cad31){logger[_0xf60d('0x1a')](_0xf60d('0x25'),_0x4cad31);return request({'uri':util[_0xf60d('0xb')](_0xf60d('0x26'),_0x59c76a['remoteUri']),'qs':{'phone':_0x4cad31}})['then'](function(_0x30f5e2){if(_0x30f5e2[_0xf60d('0x1e')]){logger['info'](_0xf60d('0x27'));return _[_0xf60d('0x28')](_0x30f5e2,{'phone':_0x4cad31});}else{logger[_0xf60d('0x1a')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util['format'](_0xf60d('0x26'),_0x59c76a[_0xf60d('0x23')]),'method':'POST','body':{'name':_0x2060a0,'phone':_0x4cad31}})[_0xf60d('0x19')](function(_0x45f105){logger[_0xf60d('0x1a')](_0xf60d('0x29'));return _0x45f105;});}});}function getAuth(_0x4366b4){return util[_0xf60d('0xb')](_0xf60d('0x2a'),new Buffer(_0x4366b4[_0xf60d('0x2b')]+':X')[_0xf60d('0x2c')]('base64'));}function request(_0x25ae3f){logger[_0xf60d('0x2d')](_0xf60d('0x2e'),JSON[_0xf60d('0x2f')](_0x25ae3f));return rp(_['defaults'](_0x25ae3f,{'method':_0xf60d('0x30'),'headers':headers,'json':!![]}));}function getTags(_0x18ee14,_0x3b4f60){var _0x175830=[];if(_0x18ee14&&_0x18ee14['length']>0x0){_0x175830=_['map'](_0x18ee14,_0x3b4f60);}return _0x175830;}function getCustomFields(_0x4a8f6b,_0xe05442){var _0x523976=[];var _0x3ce36c={'custom_fields':[]};if(_0x4a8f6b[_0xf60d('0x1e')]>0x0){_['forEach'](_0x4a8f6b,function(_0x311a06){if(_[_0xf60d('0x31')](['string',_0xf60d('0x32')],_0x311a06[_0xf60d('0x33')])&&_0x311a06[_0xf60d('0x34')]&&!_0x311a06['customField']){_0x3ce36c[_0x311a06[_0xf60d('0x34')]['toLowerCase']()]=_0x311a06['content'][_0xf60d('0x2c')]();}else if(_['includes']([_0xf60d('0x35'),_0xf60d('0x32')],_0x311a06[_0xf60d('0x33')])&&_0x311a06['idField']&&_0x311a06['customField']){_0x3ce36c[_0xf60d('0x14')]['push']({'id':_0x311a06[_0xf60d('0x36')],'value':_0x311a06['content'][_0xf60d('0x2c')]()});}else if(_0x311a06[_0xf60d('0x33')]===_0xf60d('0x37')&&_0x311a06['variableName']&&_0x311a06['idField']&&_0x311a06['customField']){_0xe05442[_0x311a06[_0xf60d('0x38')]]&&_0x3ce36c['custom_fields'][_0xf60d('0x39')]({'id':_0x311a06[_0xf60d('0x36')],'value':_0xe05442[_0x311a06[_0xf60d('0x38')]][_0xf60d('0x2c')]()});}else if(_0x311a06[_0xf60d('0x33')]===_0xf60d('0x3a')&&_0x311a06[_0xf60d('0x3b')]&&_0x311a06[_0xf60d('0x3b')][_0xf60d('0x13')]&&_0x311a06[_0xf60d('0x36')]&&_0x311a06[_0xf60d('0x3c')]){_0xe05442[_0x311a06[_0xf60d('0x3b')][_0xf60d('0x13')][_0xf60d('0x3d')]()]&&_0x3ce36c[_0xf60d('0x14')][_0xf60d('0x39')]({'id':_0x311a06[_0xf60d('0x36')],'value':_0xe05442[_0x311a06[_0xf60d('0x3b')][_0xf60d('0x13')]['toLowerCase']()][_0xf60d('0x2c')]()});}});}return _0x3ce36c;}exports[_0xf60d('0x3e')]=function(_0x54c8c1,_0x50a172,_0x229d12,_0x9c273d,_0x399656,_0x3885cc){var _0x2b80a4,_0xdfb620;_0x3885cc[_0xf60d('0x23')]=intUtil[_0xf60d('0x3f')](_0x3885cc[_0xf60d('0x23')]);_0x3885cc[_0xf60d('0x40')]=intUtil['stripTrailingSlash'](_0x3885cc[_0xf60d('0x40')]);if(_0x399656&&_0x399656[_0xf60d('0x41')]){logger[_0xf60d('0x1a')](_0xf60d('0x42'),'Recording\x20is\x20enabled!');_0x50a172['recordingURL']=util[_0xf60d('0xb')](_0xf60d('0x43'),_0x3885cc[_0xf60d('0x40')],_0x50a172[_0xf60d('0x44')],md5(_0x50a172['uniqueid']));}else{_0x50a172[_0xf60d('0x45')]='';}headers[_0xf60d('0x46')]=getAuth(_0x3885cc);return getUser(_0x3885cc,_0x9c273d[_0xf60d('0x47')])[_0xf60d('0x19')](function(_0x444199){_0x2b80a4=_0x444199;logger[_0xf60d('0x1a')](_0xf60d('0x48'),_0x2b80a4['id']);return getEndUser(_0x3885cc,_0x50a172['calleridname'],_0x50a172[_0xf60d('0xe')]);})[_0xf60d('0x19')](function(_0x1d4f06){_0xdfb620=_0x1d4f06;logger[_0xf60d('0x1a')]('The\x20Enduser\x20ID\x20is:',_0xdfb620['id']);return getTicket(_0x3885cc,_0x2b80a4,_0xdfb620,_0x229d12,_0x50a172);})[_0xf60d('0x19')](function(_0x12d2b8){if(_0x12d2b8&&_0x12d2b8['id']){logger['info'](_0xf60d('0x1b'));logger[_0xf60d('0x1a')]('The\x20Ticket\x20ID\x20is:',_0x12d2b8['id']);logger[_0xf60d('0x1a')](_0xf60d('0x42'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xf60d('0xb')](_0xf60d('0x49'),_0x9c273d[_0xf60d('0x13')]),_0xf60d('0x4a'),{'uri':util[_0xf60d('0xb')](_0xf60d('0x4b'),_0x3885cc[_0xf60d('0x23')],_0x12d2b8['id'])});}})[_0xf60d('0x4c')](function(_0x5e2e13){logger[_0xf60d('0x4d')](_0xf60d('0x42'),JSON[_0xf60d('0x2f')](_0x5e2e13));});};exports[_0xf60d('0x4e')]=function(_0x445d37,_0x403b42,_0x519f45,_0x32ce68,_0x5a6d13,_0x12e88c,_0x318fa5){var _0x1efad7,_0x366159;_0x12e88c['remoteUri']=intUtil[_0xf60d('0x3f')](_0x12e88c[_0xf60d('0x23')]);_0x12e88c['serverUrl']=intUtil[_0xf60d('0x3f')](_0x12e88c[_0xf60d('0x40')]);if(_0x318fa5&&_0x318fa5['recordingFormat']&&_0x318fa5[_0xf60d('0x4f')]!=='none'){logger[_0xf60d('0x1a')](_0xf60d('0x50'),'Recording\x20is\x20enabled!');_0x403b42['recordingURL']=util['format'](_0xf60d('0x43'),_0x12e88c['serverUrl'],_0x403b42[_0xf60d('0x44')],md5(_0x403b42[_0xf60d('0x44')]));}headers['Authorization']=getAuth(_0x12e88c);return getUser(_0x12e88c,_0x32ce68['email'])[_0xf60d('0x19')](function(_0x2c85ee){_0x1efad7=_0x2c85ee;logger[_0xf60d('0x1a')](_0xf60d('0x48'),_0x1efad7['id']);return getEndUser(_0x12e88c,_0x403b42[_0xf60d('0x51')],_0x403b42[_0xf60d('0x52')]);})[_0xf60d('0x19')](function(_0x37fdba){_0x366159=_0x37fdba;logger['info'](_0xf60d('0x53'),_0x366159['id']);return getTicket(_0x12e88c,_0x1efad7,_0x366159,_0x519f45,_0x403b42);})[_0xf60d('0x19')](function(_0x489168){if(_0x489168&&_0x489168['id']){logger[_0xf60d('0x1a')](_0xf60d('0x1b'));logger[_0xf60d('0x1a')](_0xf60d('0x54'),_0x489168['id']);logger[_0xf60d('0x1a')](_0xf60d('0x50'),_0xf60d('0x55'));emit(util[_0xf60d('0xb')](_0xf60d('0x49'),_0x32ce68['name']),'trigger:browser:url',{'uri':util[_0xf60d('0xb')](_0xf60d('0x4b'),_0x12e88c[_0xf60d('0x23')],_0x489168['id'])});}})[_0xf60d('0x4c')](function(_0x45d6bd){logger['error'](_0xf60d('0x50'),JSON[_0xf60d('0x2f')](_0x45d6bd));});};exports[_0xf60d('0x56')]=function(_0x3fb05e,_0x286af7,_0x28d2e3,_0x5afafd,_0x380afc,_0x4ed782){var _0x5cf772,_0x423713;_0x4ed782[_0xf60d('0x23')]=intUtil[_0xf60d('0x3f')](_0x4ed782[_0xf60d('0x23')]);_0x4ed782[_0xf60d('0x40')]=intUtil[_0xf60d('0x3f')](_0x4ed782[_0xf60d('0x40')]);if(_0x380afc&&_0x380afc[_0xf60d('0x41')]){logger['info']('['+_0x286af7['lastevent']['toUpperCase']()+']',_0xf60d('0x57'));_0x286af7[_0xf60d('0x45')]=util[_0xf60d('0xb')](_0xf60d('0x43'),_0x4ed782['serverUrl'],_0x286af7['uniqueid'],md5(_0x286af7['uniqueid']));}else{_0x286af7[_0xf60d('0x45')]='';}headers[_0xf60d('0x46')]=getAuth(_0x4ed782);return getUser(_0x4ed782,'')[_0xf60d('0x19')](function(_0x2a7832){_0x5cf772=_0x2a7832;logger[_0xf60d('0x1a')](_0xf60d('0x48'),_0x5cf772['id']);return getEndUser(_0x4ed782,_0x286af7[_0xf60d('0xd')],_0x286af7[_0xf60d('0xe')]);})[_0xf60d('0x19')](function(_0x2b70f4){_0x423713=_0x2b70f4;logger['info'](_0xf60d('0x53'),_0x423713['id']);return getTicket(_0x4ed782,_0x5cf772,_0x423713,_0x28d2e3,_0x286af7);})[_0xf60d('0x19')](function(_0x48a8cb){if(_0x48a8cb){logger[_0xf60d('0x1a')]('Ticket\x20created!');logger[_0xf60d('0x1a')](_0xf60d('0x54'),_0x48a8cb['id']);}})[_0xf60d('0x4c')](function(_0xfbe2c5){logger[_0xf60d('0x4d')]('['+_0x286af7[_0xf60d('0x58')][_0xf60d('0x59')]()+']',JSON[_0xf60d('0x2f')](_0xfbe2c5));});}; \ No newline at end of file +var _0xbc18=['validateEmail','%s/api/v2/agents','length','Agent\x20found!','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','find','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','apiKey','toString','base64','debug','stringify','GET','map','forEach','string','picklist','type','nameField','toLowerCase','content','includes','idField','customField','push','variable','variableName','customVariable','Variable','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','error','outbound','recordingFormat','[OUTBOUND]','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','catch','lodash','util','./util','../../../../config/environment','freshdesk','redis','defaults','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Descriptions','
','Tags','name','Fields','custom_fields','mapValues','keyBy','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!'];(function(_0x2e630d,_0x1c6f80){var _0x228475=function(_0x4a01a5){while(--_0x4a01a5){_0x2e630d['push'](_0x2e630d['shift']());}};_0x228475(++_0x1c6f80);}(_0xbc18,0x1b2));var _0x8bc1=function(_0xf1603b,_0x257c11){_0xf1603b=_0xf1603b-0x0;var _0x298fab=_0xbc18[_0xf1603b];return _0x298fab;};'use strict';var _=require(_0x8bc1('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require(_0x8bc1('0x1'));var Redis=require('ioredis');var intUtil=require(_0x8bc1('0x2'));var config=require(_0x8bc1('0x3'));var logger=require('../../../../config/logger')(_0x8bc1('0x4'));config[_0x8bc1('0x5')]=_[_0x8bc1('0x6')](config[_0x8bc1('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x8bc1('0x7'))(new Redis(config['redis']));var headers={'Content-Type':_0x8bc1('0x8'),'Accept':_0x8bc1('0x8')};function emit(_0x24d3ef,_0x730ba7,_0x1d3cf1){io['to'](_0x24d3ef)[_0x8bc1('0x9')](_0x730ba7,_0x1d3cf1);}function getTicket(_0x5baed1,_0x428b6c,_0x19ebbd,_0x10f9db,_0x510361){logger[_0x8bc1('0xa')](_0x8bc1('0xb'));var _0x2f4a2f=_['merge']({'responder_id':_0x428b6c['id'],'requester_id':_0x19ebbd['id'],'name':util[_0x8bc1('0xc')](_0x8bc1('0xd'),_0x510361[_0x8bc1('0xe')]),'phone':_0x510361[_0x8bc1('0xf')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x8bc1('0x10')](_0x10f9db[_0x8bc1('0x11')],_0x510361,'\x20'),'description':intUtil['getString'](_0x10f9db[_0x8bc1('0x12')],_0x510361,_0x8bc1('0x13')),'tags':getTags(_0x10f9db[_0x8bc1('0x14')],_0x8bc1('0x15'))},getCustomFields(_0x10f9db[_0x8bc1('0x16')],_0x510361));_0x2f4a2f[_0x8bc1('0x17')]=_[_0x8bc1('0x18')](_[_0x8bc1('0x19')](_0x2f4a2f[_0x8bc1('0x17')],'id'),'value');return request({'uri':util[_0x8bc1('0xc')](_0x8bc1('0x1a'),_0x5baed1[_0x8bc1('0x1b')]),'method':_0x8bc1('0x1c'),'body':_0x2f4a2f})[_0x8bc1('0x1d')](function(_0x1a897d){logger['info'](_0x8bc1('0x1e'));return _0x1a897d;});}function getUser(_0xf637ce,_0x1e702f){if(intUtil[_0x8bc1('0x1f')](_0x1e702f)){return request({'uri':util['format'](_0x8bc1('0x20'),_0xf637ce[_0x8bc1('0x1b')]),'qs':{'email':_0x1e702f}})[_0x8bc1('0x1d')](function(_0xcdf8e9){if(_0xcdf8e9[_0x8bc1('0x21')]){logger[_0x8bc1('0xa')](_0x8bc1('0x22'));return _['find'](_0xcdf8e9,function(_0x192f81){return _0x192f81[_0x8bc1('0x23')][_0x8bc1('0x24')]===_0x1e702f;});}else{logger[_0x8bc1('0xa')](_0x8bc1('0x25'));return request({'uri':util[_0x8bc1('0xc')]('%s/api/v2/agents/me',_0xf637ce[_0x8bc1('0x1b')])})[_0x8bc1('0x1d')](function(_0x55b28e){logger[_0x8bc1('0xa')]('Admin\x20account\x20selected.');return _0x55b28e;});}});}else{logger[_0x8bc1('0xa')](_0x8bc1('0x26'));return request({'uri':util[_0x8bc1('0xc')]('%s/api/v2/agents/me',_0xf637ce['remoteUri'])})[_0x8bc1('0x1d')](function(_0x301b60){logger[_0x8bc1('0xa')](_0x8bc1('0x27'));return _0x301b60;});}}function getEndUser(_0x541829,_0x4ea531,_0x16c910){logger[_0x8bc1('0xa')](_0x8bc1('0x28'),_0x16c910);return request({'uri':util[_0x8bc1('0xc')](_0x8bc1('0x29'),_0x541829[_0x8bc1('0x1b')]),'qs':{'phone':_0x16c910}})[_0x8bc1('0x1d')](function(_0x3c26c6){if(_0x3c26c6[_0x8bc1('0x21')]){logger[_0x8bc1('0xa')](_0x8bc1('0x2a'));return _[_0x8bc1('0x2b')](_0x3c26c6,{'phone':_0x16c910});}else{logger[_0x8bc1('0xa')](_0x8bc1('0x2c'));return request({'uri':util[_0x8bc1('0xc')]('%s/api/v2/contacts',_0x541829[_0x8bc1('0x1b')]),'method':_0x8bc1('0x1c'),'body':{'name':_0x4ea531,'phone':_0x16c910}})[_0x8bc1('0x1d')](function(_0x99b99d){logger[_0x8bc1('0xa')](_0x8bc1('0x2d'));return _0x99b99d;});}});}function getAuth(_0x530d80){return util[_0x8bc1('0xc')]('Basic\x20%s',new Buffer(_0x530d80[_0x8bc1('0x2e')]+':X')[_0x8bc1('0x2f')](_0x8bc1('0x30')));}function request(_0x37e60e){logger[_0x8bc1('0x31')]('[HTTP]',JSON[_0x8bc1('0x32')](_0x37e60e));return rp(_[_0x8bc1('0x6')](_0x37e60e,{'method':_0x8bc1('0x33'),'headers':headers,'json':!![]}));}function getTags(_0x5e3087,_0x426563){var _0x49c474=[];if(_0x5e3087&&_0x5e3087[_0x8bc1('0x21')]>0x0){_0x49c474=_[_0x8bc1('0x34')](_0x5e3087,_0x426563);}return _0x49c474;}function getCustomFields(_0x2a7e3d,_0x12ae40){var _0x1f37ab=[];var _0x4a1ba0={'custom_fields':[]};if(_0x2a7e3d[_0x8bc1('0x21')]>0x0){_[_0x8bc1('0x35')](_0x2a7e3d,function(_0x596363){if(_['includes']([_0x8bc1('0x36'),_0x8bc1('0x37')],_0x596363[_0x8bc1('0x38')])&&_0x596363[_0x8bc1('0x39')]&&!_0x596363['customField']){_0x4a1ba0[_0x596363['nameField'][_0x8bc1('0x3a')]()]=_0x596363[_0x8bc1('0x3b')]['toString']();}else if(_[_0x8bc1('0x3c')]([_0x8bc1('0x36'),_0x8bc1('0x37')],_0x596363[_0x8bc1('0x38')])&&_0x596363[_0x8bc1('0x3d')]&&_0x596363[_0x8bc1('0x3e')]){_0x4a1ba0[_0x8bc1('0x17')][_0x8bc1('0x3f')]({'id':_0x596363['idField'],'value':_0x596363[_0x8bc1('0x3b')][_0x8bc1('0x2f')]()});}else if(_0x596363[_0x8bc1('0x38')]===_0x8bc1('0x40')&&_0x596363[_0x8bc1('0x41')]&&_0x596363[_0x8bc1('0x3d')]&&_0x596363['customField']){_0x12ae40[_0x596363[_0x8bc1('0x41')]]&&_0x4a1ba0[_0x8bc1('0x17')][_0x8bc1('0x3f')]({'id':_0x596363[_0x8bc1('0x3d')],'value':_0x12ae40[_0x596363[_0x8bc1('0x41')]][_0x8bc1('0x2f')]()});}else if(_0x596363[_0x8bc1('0x38')]===_0x8bc1('0x42')&&_0x596363['Variable']&&_0x596363[_0x8bc1('0x43')][_0x8bc1('0x15')]&&_0x596363[_0x8bc1('0x3d')]&&_0x596363[_0x8bc1('0x3e')]){_0x12ae40[_0x596363[_0x8bc1('0x43')]['name']['toLowerCase']()]&&_0x4a1ba0[_0x8bc1('0x17')][_0x8bc1('0x3f')]({'id':_0x596363['idField'],'value':_0x12ae40[_0x596363[_0x8bc1('0x43')][_0x8bc1('0x15')]['toLowerCase']()][_0x8bc1('0x2f')]()});}});}return _0x4a1ba0;}exports[_0x8bc1('0x44')]=function(_0x387db4,_0x4cb2e7,_0x4fb4b8,_0x96b5a8,_0x115227,_0x47bc42){var _0x2ad9fe,_0x1310b2;_0x47bc42[_0x8bc1('0x1b')]=intUtil['stripTrailingSlash'](_0x47bc42[_0x8bc1('0x1b')]);_0x47bc42[_0x8bc1('0x45')]=intUtil[_0x8bc1('0x46')](_0x47bc42[_0x8bc1('0x45')]);if(_0x115227&&_0x115227[_0x8bc1('0x47')]){logger['info'](_0x8bc1('0x48'),_0x8bc1('0x49'));_0x4cb2e7[_0x8bc1('0x4a')]=util[_0x8bc1('0xc')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x47bc42[_0x8bc1('0x45')],_0x4cb2e7[_0x8bc1('0x4b')],md5(_0x4cb2e7[_0x8bc1('0x4b')]));}else{_0x4cb2e7['recordingURL']='';}headers[_0x8bc1('0x4c')]=getAuth(_0x47bc42);return getUser(_0x47bc42,_0x96b5a8[_0x8bc1('0x24')])[_0x8bc1('0x1d')](function(_0x58ffb1){_0x2ad9fe=_0x58ffb1;logger['info'](_0x8bc1('0x4d'),_0x2ad9fe['id']);return getEndUser(_0x47bc42,_0x4cb2e7['calleridname'],_0x4cb2e7[_0x8bc1('0xf')]);})[_0x8bc1('0x1d')](function(_0x4502f6){_0x1310b2=_0x4502f6;logger['info']('The\x20Enduser\x20ID\x20is:',_0x1310b2['id']);return getTicket(_0x47bc42,_0x2ad9fe,_0x1310b2,_0x4fb4b8,_0x4cb2e7);})[_0x8bc1('0x1d')](function(_0x5a65f7){if(_0x5a65f7&&_0x5a65f7['id']){logger[_0x8bc1('0xa')]('Ticket\x20created!');logger[_0x8bc1('0xa')](_0x8bc1('0x4e'),_0x5a65f7['id']);logger['info'](_0x8bc1('0x48'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x8bc1('0x4f'),_0x96b5a8[_0x8bc1('0x15')]),_0x8bc1('0x50'),{'uri':util['format'](_0x8bc1('0x51'),_0x47bc42['remoteUri'],_0x5a65f7['id'])});}})['catch'](function(_0x11997d){logger[_0x8bc1('0x52')](_0x8bc1('0x48'),JSON[_0x8bc1('0x32')](_0x11997d));});};exports[_0x8bc1('0x53')]=function(_0x212ae4,_0x2d89e3,_0x4fbd35,_0x236229,_0x496cef,_0x4eb627,_0x5ab258){var _0x25f0b1,_0x463882;_0x4eb627['remoteUri']=intUtil['stripTrailingSlash'](_0x4eb627[_0x8bc1('0x1b')]);_0x4eb627['serverUrl']=intUtil[_0x8bc1('0x46')](_0x4eb627[_0x8bc1('0x45')]);if(_0x5ab258&&_0x5ab258[_0x8bc1('0x54')]&&_0x5ab258[_0x8bc1('0x54')]!=='none'){logger['info'](_0x8bc1('0x55'),_0x8bc1('0x49'));_0x2d89e3[_0x8bc1('0x4a')]=util[_0x8bc1('0xc')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4eb627[_0x8bc1('0x45')],_0x2d89e3[_0x8bc1('0x4b')],md5(_0x2d89e3[_0x8bc1('0x4b')]));}headers[_0x8bc1('0x4c')]=getAuth(_0x4eb627);return getUser(_0x4eb627,_0x236229[_0x8bc1('0x24')])['then'](function(_0xf5afe9){_0x25f0b1=_0xf5afe9;logger[_0x8bc1('0xa')](_0x8bc1('0x4d'),_0x25f0b1['id']);return getEndUser(_0x4eb627,_0x2d89e3[_0x8bc1('0x56')],_0x2d89e3[_0x8bc1('0x57')]);})[_0x8bc1('0x1d')](function(_0x237000){_0x463882=_0x237000;logger[_0x8bc1('0xa')](_0x8bc1('0x58'),_0x463882['id']);return getTicket(_0x4eb627,_0x25f0b1,_0x463882,_0x4fbd35,_0x2d89e3);})[_0x8bc1('0x1d')](function(_0xa7d84c){if(_0xa7d84c&&_0xa7d84c['id']){logger[_0x8bc1('0xa')](_0x8bc1('0x1e'));logger[_0x8bc1('0xa')](_0x8bc1('0x4e'),_0xa7d84c['id']);logger[_0x8bc1('0xa')](_0x8bc1('0x55'),_0x8bc1('0x59'));emit(util['format'](_0x8bc1('0x4f'),_0x236229[_0x8bc1('0x15')]),_0x8bc1('0x50'),{'uri':util[_0x8bc1('0xc')](_0x8bc1('0x51'),_0x4eb627['remoteUri'],_0xa7d84c['id'])});}})['catch'](function(_0x4b20f2){logger[_0x8bc1('0x52')](_0x8bc1('0x55'),JSON[_0x8bc1('0x32')](_0x4b20f2));});};exports[_0x8bc1('0x5a')]=function(_0x507f2b,_0xb612f7,_0x3d7635,_0x4f9067,_0x380e69,_0x1b9a2a){var _0x2c57d9,_0x3e58c7;_0x1b9a2a[_0x8bc1('0x1b')]=intUtil['stripTrailingSlash'](_0x1b9a2a[_0x8bc1('0x1b')]);_0x1b9a2a[_0x8bc1('0x45')]=intUtil[_0x8bc1('0x46')](_0x1b9a2a[_0x8bc1('0x45')]);if(_0x380e69&&_0x380e69[_0x8bc1('0x47')]){logger[_0x8bc1('0xa')]('['+_0xb612f7['lastevent']['toUpperCase']()+']','Recording\x20is\x20enabled!');_0xb612f7[_0x8bc1('0x4a')]=util['format'](_0x8bc1('0x5b'),_0x1b9a2a[_0x8bc1('0x45')],_0xb612f7[_0x8bc1('0x4b')],md5(_0xb612f7[_0x8bc1('0x4b')]));}else{_0xb612f7[_0x8bc1('0x4a')]='';}headers[_0x8bc1('0x4c')]=getAuth(_0x1b9a2a);return getUser(_0x1b9a2a,'')[_0x8bc1('0x1d')](function(_0x4b5fd0){_0x2c57d9=_0x4b5fd0;logger['info'](_0x8bc1('0x4d'),_0x2c57d9['id']);return getEndUser(_0x1b9a2a,_0xb612f7['calleridname'],_0xb612f7[_0x8bc1('0xf')]);})['then'](function(_0x4e3126){_0x3e58c7=_0x4e3126;logger[_0x8bc1('0xa')]('The\x20Enduser\x20ID\x20is:',_0x3e58c7['id']);return getTicket(_0x1b9a2a,_0x2c57d9,_0x3e58c7,_0x3d7635,_0xb612f7);})[_0x8bc1('0x1d')](function(_0x28d3b4){if(_0x28d3b4){logger[_0x8bc1('0xa')]('Ticket\x20created!');logger['info'](_0x8bc1('0x4e'),_0x28d3b4['id']);}})[_0x8bc1('0x5c')](function(_0x8d8695){logger[_0x8bc1('0x52')]('['+_0xb612f7['lastevent']['toUpperCase']()+']',JSON[_0x8bc1('0x32')](_0x8d8695));});}; \ 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 7af06cd..d7fcd61 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 _0x7b84=['Admin\x20selected','/api/lookup?q=','&f=','&entities=contact','find','contacts','mobile_number','contactNumber','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20created:','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','Creating\x20new\x20task','POST','/api/tasks','Subjects','Descriptions','Contact','format','task','Task\x20created:','ticketId','/contacts/','user:%s','emit','Token\x20token=','apiKey','stripTrailingSlash','remoteUri','serverUrl','username','toLowerCase','destcalleridnum','callDirection','unmanaged','outbound','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','[OUTBOUND]','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','inspect','lodash','request-promise','md5','util','moment','bluebird','ioredis','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','socket.io-emitter','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','users','length','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','Getting\x20user\x20with\x20email','agentEmail','userEmail','userId','User\x20found:'];(function(_0x21125f,_0x8079f8){var _0x2f421d=function(_0x231299){while(--_0x231299){_0x21125f['push'](_0x21125f['shift']());}};_0x2f421d(++_0x8079f8);}(_0x7b84,0x17c));var _0x47b8=function(_0x3e0654,_0x5a6156){_0x3e0654=_0x3e0654-0x0;var _0x402bc1=_0x7b84[_0x3e0654];return _0x402bc1;};'use strict';var _=require(_0x47b8('0x0'));var rp=require(_0x47b8('0x1'));var md5=require(_0x47b8('0x2'));var util=require(_0x47b8('0x3'));var moment=require(_0x47b8('0x4'));var Promise=require(_0x47b8('0x5'));var Redis=require(_0x47b8('0x6'));var intUtil=require('./util');var config=require(_0x47b8('0x7'));var logger=require(_0x47b8('0x8'))(_0x47b8('0x9'));config[_0x47b8('0xa')]=_[_0x47b8('0xb')](config[_0x47b8('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0x47b8('0xc'))(new Redis(config[_0x47b8('0xa')]));function getAdminId(_0x46245a,_0xb845c9,_0x2289d5,_0x1af17f){return new Promise(function(_0x24d240,_0x4570d4){var _0x9414c2=![];var _0x429262={'method':_0x47b8('0xd'),'uri':_0x1af17f+_0x47b8('0xe'),'json':!![]};_0x429262[_0x47b8('0xf')]=_0x2289d5;logger[_0x47b8('0x10')](_0x47b8('0x11'));return rp(_0x429262)[_0x47b8('0x12')](function(_0x34bb18){if(_0x34bb18){var _0x2a10d2=_0x34bb18[_0x47b8('0x13')];var _0x289ac7=null;for(_0x289ac7=0x0;_0x289ac7<_0x2a10d2[_0x47b8('0x14')];_0x289ac7++){if(_0x2a10d2[_0x289ac7][_0x47b8('0x15')]===_0x46245a[_0x47b8('0x16')]){_0x46245a[_0x47b8('0x17')]=_0x2a10d2[_0x289ac7]['id'];_0x9414c2=!![];}}if(_0x9414c2){logger[_0x47b8('0x10')](_0x47b8('0x18'),_0x46245a[_0x47b8('0x17')]);_0x24d240(_0x46245a);}else{_0x4570d4({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x4570d4({'statusCode':0x194,'message':_0x47b8('0x19')});}})[_0x47b8('0x1a')](function(_0x3e760a){logger[_0x47b8('0x1b')]('['+[_0xb845c9[_0x47b8('0x1c')]()]+']',_0x3e760a[_0x47b8('0x1d')]);_0x4570d4(_0x3e760a);});});}function getUser(_0x4765ad,_0x5ad3ae,_0x3cc9d9){return function(_0x5c2b2c){return new Promise(function(_0x525fd6,_0x4f7317){var _0x299195={'method':_0x47b8('0xd'),'uri':_0x3cc9d9+_0x47b8('0xe'),'json':!![]};_0x299195['headers']=_0x5ad3ae;logger['info']('Getting\x20user\x20list');return rp(_0x299195)[_0x47b8('0x12')](function(_0x5531a2){if(_0x5531a2){var _0x2a4fa7=_0x5531a2[_0x47b8('0x13')];var _0x303f19=![];var _0xfccf56=null;if(_0x5c2b2c['agentEmail']!==null){logger[_0x47b8('0x10')](_0x47b8('0x1e'),_0x5c2b2c[_0x47b8('0x1f')]);_0x5c2b2c[_0x47b8('0x20')]=_0x5c2b2c[_0x47b8('0x1f')];for(_0xfccf56=0x0;_0xfccf56<_0x2a4fa7[_0x47b8('0x14')];_0xfccf56++){if(_0x2a4fa7[_0xfccf56]['email']===_0x5c2b2c[_0x47b8('0x1f')]){_0x303f19=!![];_0x5c2b2c[_0x47b8('0x21')]=_0x2a4fa7[_0xfccf56]['id'];logger['info'](_0x47b8('0x22'),_0x5c2b2c[_0x47b8('0x21')]);}}}if(!_0x303f19){logger[_0x47b8('0x10')](_0x47b8('0x23'));_0x5c2b2c['userEmail']=_0x5c2b2c[_0x47b8('0x16')];_0x5c2b2c[_0x47b8('0x21')]=_0x5c2b2c[_0x47b8('0x17')];_0x303f19=!![];}if(_0x303f19){_0x525fd6(_0x5c2b2c);}else{_0x4f7317({'statusCode':0x194,'message':_0x47b8('0x19')});}}else{_0x4f7317({'statusCode':0x194,'message':_0x47b8('0x19')});}})[_0x47b8('0x1a')](function(_0x40918f){logger['error']('['+[_0x4765ad[_0x47b8('0x1c')]()]+']',_0x40918f[_0x47b8('0x1d')]);_0x4f7317(_0x40918f);});});};}function searchContact(_0x4bcc98,_0x195a66,_0x6d517a,_0x147878){return new Promise(function(_0x3dcf1a,_0x4da0e0){var _0x162d96={'method':'GET','headers':_0x195a66,'uri':_0x4bcc98+_0x47b8('0x24')+_0x147878+_0x47b8('0x25')+_0x6d517a+_0x47b8('0x26'),'json':!![]};rp(_0x162d96)[_0x47b8('0x12')](function(_0x47e2a1){var _0x35fbbb=_[_0x47b8('0x27')](_0x47e2a1[_0x47b8('0x28')][_0x47b8('0x28')],[_0x6d517a,_0x147878]);_0x3dcf1a(_0x35fbbb);})[_0x47b8('0x1a')](function(_0x197cb5){_0x4da0e0(_0x197cb5);});});}function getEndUser(_0x52922b,_0x49326d,_0x52599e){return function(_0x12fc03){return new Promise(function(_0x5de5dc,_0x2767ee){logger['info'](util['format']('Searching\x20contact\x20with\x20phone\x20%s',_0x12fc03['contactNumber']));searchContact(_0x52599e,_0x49326d,_0x47b8('0x29'),_0x12fc03[_0x47b8('0x2a')])[_0x47b8('0x12')](function(_0x14a7e5){if(_0x14a7e5){_0x12fc03[_0x47b8('0x2b')]=_0x14a7e5['id'];logger[_0x47b8('0x10')](_0x47b8('0x2c'),_0x12fc03[_0x47b8('0x2b')]);return _0x5de5dc(_0x12fc03);}searchContact(_0x52599e,_0x49326d,_0x47b8('0x2d'),_0x12fc03['contactNumber'])['then'](function(_0x44ca76){if(_0x44ca76){_0x12fc03[_0x47b8('0x2b')]=_0x44ca76['id'];logger['info']('Contact\x20found\x20work_number:',_0x12fc03[_0x47b8('0x2b')]);return _0x5de5dc(_0x12fc03);}createEndUser(_0x12fc03,_0x52922b,_0x49326d,_0x52599e)[_0x47b8('0x12')](function(_0x171e2f){logger['info'](_0x47b8('0x2e'),_0x171e2f[_0x47b8('0x2b')]);return _0x5de5dc(_0x171e2f);});});})['catch'](function(_0x4e9471){_0x2767ee(_0x4e9471);});});};}function createEndUser(_0x4f1892,_0x5133e1,_0x8ec36e,_0x12078e){return new Promise(function(_0x3b09ce,_0x42393b){var _0xed7a2b=moment();var _0x3c24c1={'method':'POST','uri':_0x12078e+'/api/contacts','body':{'contact':{'last_name':_0x4f1892[_0x47b8('0x2a')],'work_number':_0x4f1892[_0x47b8('0x2a')],'mobile_number':_0x4f1892[_0x47b8('0x2a')],'owner_id':_0x4f1892['userId'],'created_at':_0xed7a2b['format'](_0x47b8('0x2f'))}},'json':!![]};_0x3c24c1[_0x47b8('0xf')]=_0x8ec36e;logger['info'](_0x47b8('0x30'));return rp(_0x3c24c1)[_0x47b8('0x12')](function(_0x4b6443){_0x4f1892['endUserId']=_0x4b6443['contact']['id'];_0x3b09ce(_0x4f1892);})['catch'](function(_0xfeae8e){logger[_0x47b8('0x1b')]('['+[_0x5133e1[_0x47b8('0x1c')]()]+']',_0xfeae8e[_0x47b8('0x1d')]);_0x42393b(_0xfeae8e[_0x47b8('0x1d')]);});});}function getTicket(_0x5abcd1,_0x1ff8b3,_0x598ec2,_0x40b995,_0x8dc3fd){return function(_0x42318b){logger['info'](_0x47b8('0x31'));return new Promise(function(_0x217be1,_0x157f73){var _0xf22edb=moment();var _0x3eaf01={'method':_0x47b8('0x32'),'uri':_0x598ec2+_0x47b8('0x33'),'body':{'title':intUtil['getString'](_0x40b995[_0x47b8('0x34')],_0x8dc3fd,'\x20'),'description':intUtil['getString'](_0x40b995[_0x47b8('0x35')],_0x8dc3fd,'\x0a'),'owner_id':_0x42318b[_0x47b8('0x21')],'creater_id':_0x42318b[_0x47b8('0x17')],'targetable_id':_0x42318b[_0x47b8('0x2b')],'targetable_type':_0x47b8('0x36'),'created_at':_0xf22edb[_0x47b8('0x37')]('YYYY-MM-DDTHH:mm:ss'),'due_date':_0xf22edb['add'](0x1e,'m')[_0x47b8('0x37')](_0x47b8('0x2f'))},'json':!![]};_0x3eaf01[_0x47b8('0xf')]=_0x1ff8b3;return rp(_0x3eaf01)['then'](function(_0x28e58d){_0x42318b['ticketId']=_0x28e58d[_0x47b8('0x38')]['id'];logger[_0x47b8('0x10')](_0x47b8('0x39'),_0x42318b[_0x47b8('0x3a')]);_0x217be1(_0x42318b);})[_0x47b8('0x1a')](function(_0x5c26c7){logger[_0x47b8('0x1b')]('['+[_0x5abcd1[_0x47b8('0x1c')]()]+']',_0x5c26c7[_0x47b8('0x1d')]);_0x157f73(_0x5c26c7[_0x47b8('0x1d')]);});});};}function emit(_0x1dce38,_0x324a2b,_0x46e648){var _0x4d09c2={'uri':_0x1dce38+_0x47b8('0x3b')+_0x46e648};io['to'](util['format'](_0x47b8('0x3c'),_0x324a2b))[_0x47b8('0x3d')]('trigger:browser:url',_0x4d09c2);}exports['cs']=function(_0x132e9a,_0x1e1d73,_0x119585,_0x33ae87,_0x223443,_0x167f24,_0x1b1733,_0x381d3a){var _0x4ad8a8={};var _0xf69232={'Authorization':_0x47b8('0x3e')+_0x167f24[_0x47b8('0x3f')]};_0x167f24['remoteUri']=intUtil[_0x47b8('0x40')](_0x167f24[_0x47b8('0x41')]);_0x167f24[_0x47b8('0x42')]=intUtil[_0x47b8('0x40')](_0x167f24['serverUrl']);var _0x37d1ec=_0x167f24[_0x47b8('0x41')];_0x4ad8a8['adminEmail']=_0x167f24[_0x47b8('0x43')];_0x4ad8a8[_0x47b8('0x2a')]=_0x381d3a[_0x47b8('0x44')]()==='outbound'?_0x1e1d73[_0x47b8('0x45')]:_0x1e1d73['calleridnum'];_0x4ad8a8[_0x47b8('0x46')]=_0x381d3a==='queue'||_0x381d3a===_0x47b8('0x47')?'queue':_0x47b8('0x48');if(_0x33ae87){_0x4ad8a8[_0x47b8('0x1f')]=_0x33ae87[_0x47b8('0x15')];}var _0x5ec3f9=util['format'](_0x47b8('0x49'),_0x167f24[_0x47b8('0x42')],_0x1e1d73[_0x47b8('0x4a')],md5(_0x1e1d73[_0x47b8('0x4a')]));if(_0x223443&&_0x223443['monitor_format']){logger[_0x47b8('0x10')](_0x47b8('0x4b'),_0x47b8('0x4c'));_0x1e1d73['recordingURL']=_0x5ec3f9;}else if(_0x1b1733&&_0x1b1733['recordingFormat']&&_0x1b1733[_0x47b8('0x4d')]!=='none'){logger[_0x47b8('0x10')](_0x47b8('0x4e'),_0x47b8('0x4c'));_0x1e1d73[_0x47b8('0x4f')]=_0x5ec3f9;}else{_0x1e1d73['recordingURL']='';}return getAdminId(_0x4ad8a8,_0x381d3a,_0xf69232,_0x37d1ec)[_0x47b8('0x12')](getUser(_0x381d3a,_0xf69232,_0x37d1ec))[_0x47b8('0x12')](getEndUser(_0x381d3a,_0xf69232,_0x37d1ec))[_0x47b8('0x12')](getTicket(_0x381d3a,_0xf69232,_0x37d1ec,_0x119585,_0x1e1d73))['then'](function(_0x55465c){logger[_0x47b8('0x10')](util[_0x47b8('0x37')](_0x47b8('0x50'),_0x55465c['ticketId']));if(_0x381d3a!==_0x47b8('0x47')){logger[_0x47b8('0x10')]('['+[_0x381d3a[_0x47b8('0x1c')]()]+']',_0x47b8('0x51'));emit(_0x37d1ec,_0x33ae87['name'],_0x55465c[_0x47b8('0x2b')]);}})[_0x47b8('0x1a')](function(_0x3523){logger['error']('['+[_0x381d3a[_0x47b8('0x1c')]()]+']\x20Error\x20running\x20Freshsales\x20integration',util[_0x47b8('0x52')](_0x3523,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x5657=['The\x20ticket\x20ID\x20is:\x20%s','ticketId','Displaying\x20task\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Freshsales\x20integration','lodash','request-promise','md5','util','moment','bluebird','ioredis','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','socket.io-emitter','GET','headers','info','Getting\x20admin\x20information','then','users','length','adminId','Requested\x20Resource\x20not\x20Found','error','toUpperCase','message','Getting\x20user\x20list','agentEmail','userId','User\x20found:','Admin\x20selected','userEmail','adminEmail','catch','/api/lookup?q=','&entities=contact','find','contacts','contactNumber','endUserId','Contact\x20found\x20mobile_number:','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','format','YYYY-MM-DDTHH:mm:ss','contact','/api/tasks','Subjects','getString','Descriptions','add','task','Task\x20created:','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','serverUrl','username','toLowerCase','outbound','calleridnum','callDirection','unmanaged','queue','email','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','recordingURL'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x5657,0x19e));var _0x7565=function(_0x2b7482,_0xd7709e){_0x2b7482=_0x2b7482-0x0;var _0x17c20b=_0x5657[_0x2b7482];return _0x17c20b;};'use strict';var _=require(_0x7565('0x0'));var rp=require(_0x7565('0x1'));var md5=require(_0x7565('0x2'));var util=require(_0x7565('0x3'));var moment=require(_0x7565('0x4'));var Promise=require(_0x7565('0x5'));var Redis=require(_0x7565('0x6'));var intUtil=require('./util');var config=require(_0x7565('0x7'));var logger=require(_0x7565('0x8'))(_0x7565('0x9'));config[_0x7565('0xa')]=_[_0x7565('0xb')](config[_0x7565('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0x7565('0xc'))(new Redis(config[_0x7565('0xa')]));function getAdminId(_0x2aee01,_0x417bdb,_0x1d19ce,_0x534f33){return new Promise(function(_0x3e4147,_0x21e3d1){var _0x43e372=![];var _0x1ff4cb={'method':_0x7565('0xd'),'uri':_0x534f33+'/api/selector/owners','json':!![]};_0x1ff4cb[_0x7565('0xe')]=_0x1d19ce;logger[_0x7565('0xf')](_0x7565('0x10'));return rp(_0x1ff4cb)[_0x7565('0x11')](function(_0x1e4ee4){if(_0x1e4ee4){var _0x520566=_0x1e4ee4[_0x7565('0x12')];var _0x2ae8ff=null;for(_0x2ae8ff=0x0;_0x2ae8ff<_0x520566[_0x7565('0x13')];_0x2ae8ff++){if(_0x520566[_0x2ae8ff]['email']===_0x2aee01['adminEmail']){_0x2aee01[_0x7565('0x14')]=_0x520566[_0x2ae8ff]['id'];_0x43e372=!![];}}if(_0x43e372){logger[_0x7565('0xf')]('Admin\x20found:',_0x2aee01[_0x7565('0x14')]);_0x3e4147(_0x2aee01);}else{_0x21e3d1({'statusCode':0x194,'message':_0x7565('0x15')});}}else{_0x21e3d1({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})['catch'](function(_0xbf33d4){logger[_0x7565('0x16')]('['+[_0x417bdb[_0x7565('0x17')]()]+']',_0xbf33d4[_0x7565('0x18')]);_0x21e3d1(_0xbf33d4);});});}function getUser(_0x543caa,_0x5a3c0d,_0x15c75e){return function(_0x4dd055){return new Promise(function(_0x59b98f,_0x11eec6){var _0x4d2089={'method':'GET','uri':_0x15c75e+'/api/selector/owners','json':!![]};_0x4d2089[_0x7565('0xe')]=_0x5a3c0d;logger[_0x7565('0xf')](_0x7565('0x19'));return rp(_0x4d2089)[_0x7565('0x11')](function(_0x2f9a6e){if(_0x2f9a6e){var _0x5725cd=_0x2f9a6e['users'];var _0x3a99c6=![];var _0x5a2efd=null;if(_0x4dd055[_0x7565('0x1a')]!==null){logger[_0x7565('0xf')]('Getting\x20user\x20with\x20email',_0x4dd055[_0x7565('0x1a')]);_0x4dd055['userEmail']=_0x4dd055[_0x7565('0x1a')];for(_0x5a2efd=0x0;_0x5a2efd<_0x5725cd[_0x7565('0x13')];_0x5a2efd++){if(_0x5725cd[_0x5a2efd]['email']===_0x4dd055[_0x7565('0x1a')]){_0x3a99c6=!![];_0x4dd055[_0x7565('0x1b')]=_0x5725cd[_0x5a2efd]['id'];logger['info'](_0x7565('0x1c'),_0x4dd055[_0x7565('0x1b')]);}}}if(!_0x3a99c6){logger[_0x7565('0xf')](_0x7565('0x1d'));_0x4dd055[_0x7565('0x1e')]=_0x4dd055[_0x7565('0x1f')];_0x4dd055[_0x7565('0x1b')]=_0x4dd055['adminId'];_0x3a99c6=!![];}if(_0x3a99c6){_0x59b98f(_0x4dd055);}else{_0x11eec6({'statusCode':0x194,'message':_0x7565('0x15')});}}else{_0x11eec6({'statusCode':0x194,'message':_0x7565('0x15')});}})[_0x7565('0x20')](function(_0x285d0c){logger['error']('['+[_0x543caa[_0x7565('0x17')]()]+']',_0x285d0c[_0x7565('0x18')]);_0x11eec6(_0x285d0c);});});};}function searchContact(_0x46de22,_0x410de3,_0x5f4f3a,_0x511749){return new Promise(function(_0x53c6fb,_0x2d4f61){var _0x3460d8={'method':_0x7565('0xd'),'headers':_0x410de3,'uri':_0x46de22+_0x7565('0x21')+_0x511749+'&f='+_0x5f4f3a+_0x7565('0x22'),'json':!![]};rp(_0x3460d8)['then'](function(_0x20038a){var _0x4e3693=_[_0x7565('0x23')](_0x20038a[_0x7565('0x24')]['contacts'],[_0x5f4f3a,_0x511749]);_0x53c6fb(_0x4e3693);})[_0x7565('0x20')](function(_0x3d762e){_0x2d4f61(_0x3d762e);});});}function getEndUser(_0x38e73b,_0x447446,_0x530f40){return function(_0x2b10c2){return new Promise(function(_0x3771ee,_0x278135){logger['info'](util['format']('Searching\x20contact\x20with\x20phone\x20%s',_0x2b10c2['contactNumber']));searchContact(_0x530f40,_0x447446,'mobile_number',_0x2b10c2[_0x7565('0x25')])['then'](function(_0x42bccc){if(_0x42bccc){_0x2b10c2[_0x7565('0x26')]=_0x42bccc['id'];logger['info'](_0x7565('0x27'),_0x2b10c2[_0x7565('0x26')]);return _0x3771ee(_0x2b10c2);}searchContact(_0x530f40,_0x447446,'work_number',_0x2b10c2[_0x7565('0x25')])['then'](function(_0x3d57a8){if(_0x3d57a8){_0x2b10c2[_0x7565('0x26')]=_0x3d57a8['id'];logger[_0x7565('0xf')](_0x7565('0x28'),_0x2b10c2[_0x7565('0x26')]);return _0x3771ee(_0x2b10c2);}createEndUser(_0x2b10c2,_0x38e73b,_0x447446,_0x530f40)['then'](function(_0x295356){logger['info'](_0x7565('0x29'),_0x295356[_0x7565('0x26')]);return _0x3771ee(_0x295356);});});})['catch'](function(_0x35d0d4){_0x278135(_0x35d0d4);});});};}function createEndUser(_0x41ebd0,_0x1f9973,_0x1d7298,_0x317a01){return new Promise(function(_0x368c79,_0xa75805){var _0x12a87b=moment();var _0x4e23f9={'method':_0x7565('0x2a'),'uri':_0x317a01+_0x7565('0x2b'),'body':{'contact':{'last_name':_0x41ebd0['contactNumber'],'work_number':_0x41ebd0[_0x7565('0x25')],'mobile_number':_0x41ebd0[_0x7565('0x25')],'owner_id':_0x41ebd0[_0x7565('0x1b')],'created_at':_0x12a87b[_0x7565('0x2c')](_0x7565('0x2d'))}},'json':!![]};_0x4e23f9[_0x7565('0xe')]=_0x1d7298;logger[_0x7565('0xf')]('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x4e23f9)[_0x7565('0x11')](function(_0x1f03b7){_0x41ebd0[_0x7565('0x26')]=_0x1f03b7[_0x7565('0x2e')]['id'];_0x368c79(_0x41ebd0);})[_0x7565('0x20')](function(_0x4e3129){logger[_0x7565('0x16')]('['+[_0x1f9973[_0x7565('0x17')]()]+']',_0x4e3129['message']);_0xa75805(_0x4e3129[_0x7565('0x18')]);});});}function getTicket(_0x24515a,_0x4f27e0,_0x1f26ba,_0x126ed0,_0x1614ae){return function(_0x557778){logger['info']('Creating\x20new\x20task');return new Promise(function(_0x32dd83,_0xe638de){var _0x38c68a=moment();var _0x2c0c64={'method':_0x7565('0x2a'),'uri':_0x1f26ba+_0x7565('0x2f'),'body':{'title':intUtil['getString'](_0x126ed0[_0x7565('0x30')],_0x1614ae,'\x20'),'description':intUtil[_0x7565('0x31')](_0x126ed0[_0x7565('0x32')],_0x1614ae,'\x0a'),'owner_id':_0x557778[_0x7565('0x1b')],'creater_id':_0x557778[_0x7565('0x14')],'targetable_id':_0x557778[_0x7565('0x26')],'targetable_type':'Contact','created_at':_0x38c68a[_0x7565('0x2c')]('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x38c68a[_0x7565('0x33')](0x1e,'m')[_0x7565('0x2c')](_0x7565('0x2d'))},'json':!![]};_0x2c0c64['headers']=_0x4f27e0;return rp(_0x2c0c64)['then'](function(_0x2c0530){_0x557778['ticketId']=_0x2c0530[_0x7565('0x34')]['id'];logger[_0x7565('0xf')](_0x7565('0x35'),_0x557778['ticketId']);_0x32dd83(_0x557778);})[_0x7565('0x20')](function(_0x127a86){logger[_0x7565('0x16')]('['+[_0x24515a[_0x7565('0x17')]()]+']',_0x127a86[_0x7565('0x18')]);_0xe638de(_0x127a86[_0x7565('0x18')]);});});};}function emit(_0x2f32d0,_0x5841fb,_0x37e053){var _0x1f30bb={'uri':_0x2f32d0+_0x7565('0x36')+_0x37e053};io['to'](util[_0x7565('0x2c')](_0x7565('0x37'),_0x5841fb))[_0x7565('0x38')](_0x7565('0x39'),_0x1f30bb);}exports['cs']=function(_0x5c6850,_0x55e9c1,_0x5532da,_0x169ff0,_0x109412,_0x2247fa,_0x530f79,_0xef70a2){var _0x4f554e={};var _0x4e7ebe={'Authorization':_0x7565('0x3a')+_0x2247fa[_0x7565('0x3b')]};_0x2247fa[_0x7565('0x3c')]=intUtil['stripTrailingSlash'](_0x2247fa['remoteUri']);_0x2247fa[_0x7565('0x3d')]=intUtil['stripTrailingSlash'](_0x2247fa['serverUrl']);var _0x473cba=_0x2247fa[_0x7565('0x3c')];_0x4f554e[_0x7565('0x1f')]=_0x2247fa[_0x7565('0x3e')];_0x4f554e[_0x7565('0x25')]=_0xef70a2[_0x7565('0x3f')]()===_0x7565('0x40')?_0x55e9c1['destcalleridnum']:_0x55e9c1[_0x7565('0x41')];_0x4f554e[_0x7565('0x42')]=_0xef70a2==='queue'||_0xef70a2===_0x7565('0x43')?_0x7565('0x44'):'outbound';if(_0x169ff0){_0x4f554e[_0x7565('0x1a')]=_0x169ff0[_0x7565('0x45')];}var _0x54cc9e=util[_0x7565('0x2c')](_0x7565('0x46'),_0x2247fa['serverUrl'],_0x55e9c1[_0x7565('0x47')],md5(_0x55e9c1[_0x7565('0x47')]));if(_0x109412&&_0x109412[_0x7565('0x48')]){logger[_0x7565('0xf')](_0x7565('0x49'),_0x7565('0x4a'));_0x55e9c1['recordingURL']=_0x54cc9e;}else if(_0x530f79&&_0x530f79[_0x7565('0x4b')]&&_0x530f79[_0x7565('0x4b')]!==_0x7565('0x4c')){logger[_0x7565('0xf')]('[OUTBOUND]',_0x7565('0x4a'));_0x55e9c1[_0x7565('0x4d')]=_0x54cc9e;}else{_0x55e9c1[_0x7565('0x4d')]='';}return getAdminId(_0x4f554e,_0xef70a2,_0x4e7ebe,_0x473cba)[_0x7565('0x11')](getUser(_0xef70a2,_0x4e7ebe,_0x473cba))[_0x7565('0x11')](getEndUser(_0xef70a2,_0x4e7ebe,_0x473cba))[_0x7565('0x11')](getTicket(_0xef70a2,_0x4e7ebe,_0x473cba,_0x5532da,_0x55e9c1))[_0x7565('0x11')](function(_0x1628af){logger['info'](util[_0x7565('0x2c')](_0x7565('0x4e'),_0x1628af[_0x7565('0x4f')]));if(_0xef70a2!=='unmanaged'){logger[_0x7565('0xf')]('['+[_0xef70a2[_0x7565('0x17')]()]+']',_0x7565('0x50'));emit(_0x473cba,_0x169ff0['name'],_0x1628af['endUserId']);}})[_0x7565('0x20')](function(_0xbf8f0f){logger[_0x7565('0x16')]('['+[_0xef70a2[_0x7565('0x17')]()]+_0x7565('0x51'),util['inspect'](_0xbf8f0f,{'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 399b7a9..04a8451 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 _0xe27b=['exec','data1','data2','find','Configurations','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','toLowerCase','dynamics365','unknown\x20integration','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','../../../../config/logger','%s\x20account\x20#%s\x20not\x20found','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./vtiger','./servicenow','./dynamics365','zendesk','salesforce','sugarcrm','freshdesk','zoho','desk','vtiger','freshsales'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0xe27b,0xf9));var _0xbe27=function(_0x66be16,_0x4d9a71){_0x66be16=_0x66be16-0x0;var _0x45de40=_0xe27b[_0x66be16];return _0x45de40;};'use strict';var _=require('lodash');var util=require(_0xbe27('0x0'));var zendesk=require(_0xbe27('0x1'));var salesforce=require(_0xbe27('0x2'));var sugarcrm=require(_0xbe27('0x3'));var freshdesk=require(_0xbe27('0x4'));var zoho=require(_0xbe27('0x5'));var desk=require('./desk');var vtiger=require(_0xbe27('0x6'));var servicenow=require(_0xbe27('0x7'));var dynamics365=require(_0xbe27('0x8'));var freshsales=require('./freshsales');var integrations=[_0xbe27('0x9'),_0xbe27('0xa'),_0xbe27('0xb'),_0xbe27('0xc'),_0xbe27('0xd'),_0xbe27('0xe'),_0xbe27('0xf'),'dynamics365',_0xbe27('0x10'),'servicenow'];exports[_0xbe27('0x11')]=function(_0xa23a12,_0x2397a2,_0x436f37,_0x579f54,_0x233384,_0x234b8f){if(_0x436f37){if(_['includes'](integrations,_0xa23a12[_0xbe27('0x12')]['toLowerCase']())){try{var _0x4e1514=null;var _0x239f6b='';var _0x4c56b3=_0x436f37[_0xa23a12[_0xbe27('0x12')]['toLowerCase']()];if(_0x4c56b3){var _0x595da2=_0x4c56b3[_0xa23a12[_0xbe27('0x13')]];if(_0x595da2){var _0x59fb15=_[_0xbe27('0x14')](_0x595da2[_0xbe27('0x15')],{'id':parseInt(_0xa23a12[_0xbe27('0x16')],0xa)});if(_0x59fb15){if(_0x579f54){if(_0x233384&&_0x2397a2[_0xbe27('0x17')]){_0x239f6b=_0xbe27('0x17');}else if(_0x2397a2[_0xbe27('0x18')]){_0x239f6b=_0xbe27('0x19');}else{console[_0xbe27('0x1a')](_0xbe27('0x1b'),_0x2397a2);}}else{_0x239f6b=_0xbe27('0x1c');}switch(_0xa23a12[_0xbe27('0x12')][_0xbe27('0x1d')]()){case _0xbe27('0x9'):zendesk[_0x239f6b](_0xa23a12,_0x2397a2,_0x59fb15,_0x579f54,_0x233384,_0x595da2,_0x234b8f);break;case _0xbe27('0xa'):salesforce[_0x239f6b](_0xa23a12,_0x2397a2,_0x59fb15,_0x579f54,_0x233384,_0x595da2,_0x234b8f);break;case _0xbe27('0xb'):sugarcrm[_0x239f6b](_0xa23a12,_0x2397a2,_0x59fb15,_0x579f54,_0x233384,_0x595da2,_0x234b8f);break;case _0xbe27('0xc'):freshdesk[_0x239f6b](_0xa23a12,_0x2397a2,_0x59fb15,_0x579f54,_0x233384,_0x595da2,_0x234b8f);break;case'zoho':zoho[_0x239f6b](_0xa23a12,_0x2397a2,_0x59fb15,_0x579f54,_0x233384,_0x595da2,_0x234b8f);break;case'desk':desk[_0x239f6b](_0xa23a12,_0x2397a2,_0x59fb15,_0x579f54,_0x233384,_0x595da2,_0x234b8f);break;case _0xbe27('0xf'):vtiger[_0x239f6b](_0xa23a12,_0x2397a2,_0x59fb15,_0x579f54,_0x233384,_0x595da2,_0x234b8f);break;case _0xbe27('0x10'):freshsales['cs'](_0xa23a12,_0x2397a2,_0x59fb15,_0x579f54,_0x233384,_0x595da2,_0x234b8f,_0x239f6b);break;case'servicenow':servicenow['cs'](_0xa23a12,_0x2397a2,_0x59fb15,_0x579f54,_0x233384,_0x595da2,_0x234b8f,_0x239f6b);break;case _0xbe27('0x1e'):dynamics365['cs'](_0xa23a12,_0x2397a2,_0x59fb15,_0x579f54,_0x233384,_0x595da2,_0x234b8f,_0x239f6b);break;default:console[_0xbe27('0x1a')](_0xbe27('0x1f'));}}else{_0x4e1514=require('../../../../config/logger')(_0xa23a12[_0xbe27('0x12')][_0xbe27('0x1d')]());_0x4e1514[_0xbe27('0x20')](_0xbe27('0x21'),util[_0xbe27('0x22')](_0xbe27('0x23'),_0xa23a12['data1']['toLowerCase'](),_0xa23a12[_0xbe27('0x16')]));}}else{_0x4e1514=require(_0xbe27('0x24'))(_0xa23a12[_0xbe27('0x12')][_0xbe27('0x1d')]());_0x4e1514[_0xbe27('0x20')](_0xbe27('0x21'),util[_0xbe27('0x22')](_0xbe27('0x25'),_0xa23a12[_0xbe27('0x12')]['toLowerCase'](),_0xa23a12[_0xbe27('0x13')]));}}else{}}catch(_0xa43431){console['error'](_0xa43431);}}}}; \ No newline at end of file +var _0x4e6e=['toLowerCase','data1','data2','find','Configurations','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','zendesk','unknown\x20integration','../../../../config/logger','error','format','%s\x20configuration\x20#%s\x20not\x20found','[EXEC]','lodash','util','./zendesk','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','./freshsales','salesforce','sugarcrm','freshdesk','zoho','desk','vtiger','dynamics365','freshsales','servicenow','exec'];(function(_0x42e612,_0x4ee2ab){var _0x466dcc=function(_0x740f8b){while(--_0x740f8b){_0x42e612['push'](_0x42e612['shift']());}};_0x466dcc(++_0x4ee2ab);}(_0x4e6e,0x169));var _0xe4e6=function(_0x174ef5,_0x256e8e){_0x174ef5=_0x174ef5-0x0;var _0x1cc379=_0x4e6e[_0x174ef5];return _0x1cc379;};'use strict';var _=require(_0xe4e6('0x0'));var util=require(_0xe4e6('0x1'));var zendesk=require(_0xe4e6('0x2'));var salesforce=require('./salesforce');var sugarcrm=require(_0xe4e6('0x3'));var freshdesk=require(_0xe4e6('0x4'));var zoho=require(_0xe4e6('0x5'));var desk=require(_0xe4e6('0x6'));var vtiger=require(_0xe4e6('0x7'));var servicenow=require('./servicenow');var dynamics365=require('./dynamics365');var freshsales=require(_0xe4e6('0x8'));var integrations=['zendesk',_0xe4e6('0x9'),_0xe4e6('0xa'),_0xe4e6('0xb'),_0xe4e6('0xc'),_0xe4e6('0xd'),_0xe4e6('0xe'),_0xe4e6('0xf'),_0xe4e6('0x10'),_0xe4e6('0x11')];exports[_0xe4e6('0x12')]=function(_0x1f306b,_0x5dc9a5,_0x5c11ec,_0x150cc2,_0x21701f,_0x3086cf){if(_0x5c11ec){if(_['includes'](integrations,_0x1f306b['data1'][_0xe4e6('0x13')]())){try{var _0x28aea0=null;var _0x4a0c41='';var _0x3548ec=_0x5c11ec[_0x1f306b[_0xe4e6('0x14')][_0xe4e6('0x13')]()];if(_0x3548ec){var _0x378c88=_0x3548ec[_0x1f306b[_0xe4e6('0x15')]];if(_0x378c88){var _0xe3d09a=_[_0xe4e6('0x16')](_0x378c88[_0xe4e6('0x17')],{'id':parseInt(_0x1f306b[_0xe4e6('0x18')],0xa)});if(_0xe3d09a){if(_0x150cc2){if(_0x21701f&&_0x5dc9a5['queue']){_0x4a0c41=_0xe4e6('0x19');}else if(_0x5dc9a5[_0xe4e6('0x1a')]){_0x4a0c41=_0xe4e6('0x1b');}else{console[_0xe4e6('0x1c')](_0xe4e6('0x1d'),_0x5dc9a5);}}else{_0x4a0c41=_0xe4e6('0x1e');}switch(_0x1f306b['data1'][_0xe4e6('0x13')]()){case _0xe4e6('0x1f'):zendesk[_0x4a0c41](_0x1f306b,_0x5dc9a5,_0xe3d09a,_0x150cc2,_0x21701f,_0x378c88,_0x3086cf);break;case _0xe4e6('0x9'):salesforce[_0x4a0c41](_0x1f306b,_0x5dc9a5,_0xe3d09a,_0x150cc2,_0x21701f,_0x378c88,_0x3086cf);break;case _0xe4e6('0xa'):sugarcrm[_0x4a0c41](_0x1f306b,_0x5dc9a5,_0xe3d09a,_0x150cc2,_0x21701f,_0x378c88,_0x3086cf);break;case _0xe4e6('0xb'):freshdesk[_0x4a0c41](_0x1f306b,_0x5dc9a5,_0xe3d09a,_0x150cc2,_0x21701f,_0x378c88,_0x3086cf);break;case'zoho':zoho[_0x4a0c41](_0x1f306b,_0x5dc9a5,_0xe3d09a,_0x150cc2,_0x21701f,_0x378c88,_0x3086cf);break;case _0xe4e6('0xd'):desk[_0x4a0c41](_0x1f306b,_0x5dc9a5,_0xe3d09a,_0x150cc2,_0x21701f,_0x378c88,_0x3086cf);break;case _0xe4e6('0xe'):vtiger[_0x4a0c41](_0x1f306b,_0x5dc9a5,_0xe3d09a,_0x150cc2,_0x21701f,_0x378c88,_0x3086cf);break;case'freshsales':freshsales['cs'](_0x1f306b,_0x5dc9a5,_0xe3d09a,_0x150cc2,_0x21701f,_0x378c88,_0x3086cf,_0x4a0c41);break;case _0xe4e6('0x11'):servicenow['cs'](_0x1f306b,_0x5dc9a5,_0xe3d09a,_0x150cc2,_0x21701f,_0x378c88,_0x3086cf,_0x4a0c41);break;case _0xe4e6('0xf'):dynamics365['cs'](_0x1f306b,_0x5dc9a5,_0xe3d09a,_0x150cc2,_0x21701f,_0x378c88,_0x3086cf,_0x4a0c41);break;default:console[_0xe4e6('0x1c')](_0xe4e6('0x20'));}}else{_0x28aea0=require(_0xe4e6('0x21'))(_0x1f306b[_0xe4e6('0x14')][_0xe4e6('0x13')]());_0x28aea0[_0xe4e6('0x22')]('[EXEC]',util[_0xe4e6('0x23')](_0xe4e6('0x24'),_0x1f306b['data1'][_0xe4e6('0x13')](),_0x1f306b[_0xe4e6('0x18')]));}}else{_0x28aea0=require(_0xe4e6('0x21'))(_0x1f306b[_0xe4e6('0x14')]['toLowerCase']());_0x28aea0[_0xe4e6('0x22')](_0xe4e6('0x25'),util[_0xe4e6('0x23')]('%s\x20account\x20#%s\x20not\x20found',_0x1f306b[_0xe4e6('0x14')]['toLowerCase'](),_0x1f306b[_0xe4e6('0x15')]));}}else{}}catch(_0x4bed92){console[_0xe4e6('0x22')](_0x4bed92);}}}}; \ 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 50bdeb1..74bbfc4 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 _0xaf0b=['lead','leadId','info','sobject','create','isNil','validateEmail','User','find','execute','then','Email','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','contact_lead','cloneDeep','$or','Contact','length','additionalSearchLead','merge','Lead','additionalSearchAccount','Account','additionalSearchContact','first','Phone','attributes','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','moduleCreate','LastName','','format','Caller\x20-\x20%s','Company','upperFirst','forEach','includes','string','type','idField','content','toString','variable','variableName','Variable','name','password','concat','securityToken','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','username','Connection\x20established.','queue','stripTrailingSlash','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','trigger:salesforce:display','user:%s','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','recordingFormat','none','destcalleridname','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','newTab','trigger:browser:url','[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','monitor_format','lastevent','toUpperCase','calleridname','calleridnum',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','jsforce','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','defaults','localhost','socket.io-emitter','redis','emit','Subjects','Descriptions','ticketType','ActivityDate','IsRecurrence','contact','WhoId','endUserType','account','WhatId','Case','ContactId','AccountId'];(function(_0x1e0846,_0x4aea1b){var _0x57e5d7=function(_0x2f9fb3){while(--_0x2f9fb3){_0x1e0846['push'](_0x1e0846['shift']());}};_0x57e5d7(++_0x4aea1b);}(_0xaf0b,0x167));var _0xbaf0=function(_0x410408,_0x1753ec){_0x410408=_0x410408-0x0;var _0x351265=_0xaf0b[_0x410408];return _0x351265;};'use strict';var _=require(_0xbaf0('0x0'));var rp=require(_0xbaf0('0x1'));var moment=require(_0xbaf0('0x2'));var BPromise=require(_0xbaf0('0x3'));var md5=require('md5');var jsforce=require(_0xbaf0('0x4'));var util=require('util');var Redis=require(_0xbaf0('0x5'));var intUtil=require(_0xbaf0('0x6'));var config=require(_0xbaf0('0x7'));var logger=require(_0xbaf0('0x8'))(_0xbaf0('0x9'));config['redis']=_[_0xbaf0('0xa')](config['redis'],{'host':_0xbaf0('0xb'),'port':0x18eb});var io=require(_0xbaf0('0xc'))(new Redis(config[_0xbaf0('0xd')]));function emit(_0x52db2d,_0x1f6de6,_0x38dc2b){io['to'](_0x52db2d)[_0xbaf0('0xe')](_0x1f6de6,_0x38dc2b);}function getTicket(_0x2780bb,_0x10b4c3,_0x3962f9,_0x10c170,_0x587732,_0x4d8c59,_0x403b2f,_0x5867a0){var _0x3365de=Object['assign']({},{'OwnerId':_0x10b4c3['id'],'Subject':intUtil['getString'](_0x10c170[_0xbaf0('0xf')],_0x587732,'\x20'),'Description':intUtil['getString'](_0x10c170[_0xbaf0('0x10')],_0x587732,'\x0a')},getCustomFields(_0x4d8c59,_0x587732));if(_0x3962f9){if(_0x10c170[_0xbaf0('0x11')]==='Task'){_0x3365de[_0xbaf0('0x12')]=moment['utc']();_0x3365de['IsReminderSet']=![];_0x3365de[_0xbaf0('0x13')]=![];if(_0x3962f9['endUserType']===_0xbaf0('0x14')||_0x3962f9['endUserType']==='lead'){_0x3365de[_0xbaf0('0x15')]=_0x3962f9['id'];}else if(_0x3962f9[_0xbaf0('0x16')]===_0xbaf0('0x17')){_0x3365de[_0xbaf0('0x18')]=_0x3962f9['id'];}}else if(_0x10c170[_0xbaf0('0x11')]===_0xbaf0('0x19')){if(_0x3962f9['endUserType']===_0xbaf0('0x14')){_0x3365de[_0xbaf0('0x1a')]=_0x3962f9['id'];}else if(_0x3962f9[_0xbaf0('0x16')]===_0xbaf0('0x17')){_0x3365de[_0xbaf0('0x1b')]=_0x3962f9['id'];}else if(_0x3962f9[_0xbaf0('0x16')]===_0xbaf0('0x1c')&&_0x10c170['leadId']){_0x3365de[_0x10c170[_0xbaf0('0x1d')]]=_0x3962f9['id'];}else{logger[_0xbaf0('0x1e')]('Association\x20between\x20Case\x20and\x20Lead\x20skipped');}}}return _0x403b2f[_0xbaf0('0x1f')](_0x10c170[_0xbaf0('0x11')])[_0xbaf0('0x20')](_0x3365de);}function getUser(_0x399429,_0x436d38,_0x214195){if(!_[_0xbaf0('0x21')](_0x436d38)&&intUtil[_0xbaf0('0x22')](_0x436d38)){var _0x3f7138={'Email':_0x436d38};var _0x3acd07={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x214195['sobject'](_0xbaf0('0x23'))[_0xbaf0('0x24')](_0x3f7138,_0x3acd07)[_0xbaf0('0x25')]()[_0xbaf0('0x26')](function(_0x5dd7c5){if(_0x5dd7c5['length']){var _0x4c7f58=_[_0xbaf0('0x24')](_0x5dd7c5,function(_0x30884c){return _0x30884c[_0xbaf0('0x27')]===_0x436d38;});if(_0x4c7f58){logger[_0xbaf0('0x1e')](_0xbaf0('0x28'),_0x436d38);return BPromise[_0xbaf0('0x29')]({'id':_0x4c7f58['Id'],'name':_0x4c7f58[_0xbaf0('0x2a')]});}}else{logger[_0xbaf0('0x1e')](_0xbaf0('0x2b'),_0x436d38);return _0x214195[_0xbaf0('0x2c')]()['then'](function(_0x186def){return BPromise[_0xbaf0('0x29')]({'id':_0x186def[_0xbaf0('0x2d')],'name':_0x186def['display_name']});});}});}else{logger[_0xbaf0('0x1e')](_0xbaf0('0x2b'),_0x436d38);return _0x214195[_0xbaf0('0x2c')]()['then'](function(_0x1df2cb){return BPromise[_0xbaf0('0x29')]({'id':_0x1df2cb[_0xbaf0('0x2d')],'name':_0x1df2cb['display_name']});});}}function getEndUser(_0x196d1a,_0x1d864b,_0x48b4a6,_0x15111e,_0x4ac1cb){var _0x360be3={'$or':{'Phone':_0x15111e}};var _0x4441da={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xbaf0('0x29')]()[_0xbaf0('0x26')](function(){logger[_0xbaf0('0x1e')](_0xbaf0('0x2e'),_0x15111e,_0x1d864b['moduleSearch']);switch(_0x1d864b['moduleSearch']){case _0xbaf0('0x2f'):var _0x20202b=_[_0xbaf0('0x30')](_0x360be3);if(_0x1d864b['additionalSearchContact']){var _0xf2898e={};_0xf2898e[_0x1d864b['additionalSearchContact']]=_0x15111e;_['merge'](_0x20202b[_0xbaf0('0x31')],_0xf2898e);}return _0x4ac1cb['sobject'](_0xbaf0('0x32'))[_0xbaf0('0x24')](_0x20202b,_0x4441da)[_0xbaf0('0x25')]()[_0xbaf0('0x26')](function(_0x3b760b){if(_0x3b760b&&_0x3b760b[_0xbaf0('0x33')]){return _0x3b760b;}else{var _0x20bc95=_['cloneDeep'](_0x360be3);if(_0x1d864b[_0xbaf0('0x34')]){var _0x5cee71={};_0x5cee71[_0x1d864b['additionalSearchLead']]=_0x15111e;_[_0xbaf0('0x35')](_0x20bc95['$or'],_0x5cee71);}return _0x4ac1cb[_0xbaf0('0x1f')](_0xbaf0('0x36'))['find'](_0x20bc95,_0x4441da);}});case'account_contact_lead':var _0x32d068=_['cloneDeep'](_0x360be3);if(_0x1d864b[_0xbaf0('0x37')]){var _0xf2898e={};_0xf2898e[_0x1d864b['additionalSearchAccount']]=_0x15111e;_[_0xbaf0('0x35')](_0x32d068['$or'],_0xf2898e);}return _0x4ac1cb[_0xbaf0('0x1f')](_0xbaf0('0x38'))[_0xbaf0('0x24')](_0x32d068,_0x4441da)['execute']()[_0xbaf0('0x26')](function(_0x2836d7){if(_0x2836d7&&_0x2836d7['length']){return _0x2836d7;}else{var _0x15c094=_[_0xbaf0('0x30')](_0x360be3);if(_0x1d864b[_0xbaf0('0x39')]){var _0x206933={};_0x206933[_0x1d864b[_0xbaf0('0x39')]]=_0x15111e;_[_0xbaf0('0x35')](_0x15c094[_0xbaf0('0x31')],_0x206933);}return _0x4ac1cb[_0xbaf0('0x1f')](_0xbaf0('0x32'))[_0xbaf0('0x24')](_0x15c094,_0x4441da)['then'](function(_0x5e8bd8){if(_0x5e8bd8&&_0x5e8bd8[_0xbaf0('0x33')]){return _0x5e8bd8;}else{var _0x5aa5d0=_[_0xbaf0('0x30')](_0x360be3);if(_0x1d864b['additionalSearchLead']){var _0x4bbf1a={};_0x4bbf1a[_0x1d864b[_0xbaf0('0x34')]]=_0x15111e;_['merge'](_0x5aa5d0[_0xbaf0('0x31')],_0x4bbf1a);}return _0x4ac1cb['sobject']('Lead')[_0xbaf0('0x24')](_0x5aa5d0,_0x4441da);}});}});case _0xbaf0('0x14'):var _0x20202b=_[_0xbaf0('0x30')](_0x360be3);if(_0x1d864b[_0xbaf0('0x39')]){var _0xf2898e={};_0xf2898e[_0x1d864b[_0xbaf0('0x39')]]=_0x15111e;_[_0xbaf0('0x35')](_0x20202b[_0xbaf0('0x31')],_0xf2898e);}return _0x4ac1cb[_0xbaf0('0x1f')](_0xbaf0('0x32'))[_0xbaf0('0x24')](_0x20202b,_0x4441da)[_0xbaf0('0x25')]();case _0xbaf0('0x1c'):var _0x3a8767=_['cloneDeep'](_0x360be3);if(_0x1d864b[_0xbaf0('0x34')]){var _0xf2898e={};_0xf2898e[_0x1d864b[_0xbaf0('0x34')]]=_0x15111e;_['merge'](_0x3a8767['$or'],_0xf2898e);}return _0x4ac1cb[_0xbaf0('0x1f')]('Lead')[_0xbaf0('0x24')](_0x3a8767,_0x4441da);case _0xbaf0('0x17'):var _0x32d068=_['cloneDeep'](_0x360be3);if(_0x1d864b['additionalSearchAccount']){var _0xf2898e={};_0xf2898e[_0x1d864b[_0xbaf0('0x37')]]=_0x15111e;_[_0xbaf0('0x35')](_0x32d068['$or'],_0xf2898e);}return _0x4ac1cb['sobject'](_0xbaf0('0x38'))['find'](_0x32d068,_0x4441da);default:return null;}})[_0xbaf0('0x26')](function(_0xb661bb){if(_0xb661bb&&_0xb661bb[_0xbaf0('0x33')]){var _0x1e4bd8=_[_0xbaf0('0x3a')](_0xb661bb);if(_0x1e4bd8){return BPromise[_0xbaf0('0x29')]({'id':_0x1e4bd8['Id'],'name':_0x1e4bd8[_0xbaf0('0x2a')],'phone':_0x1e4bd8[_0xbaf0('0x3b')],'endUserType':_0x1e4bd8[_0xbaf0('0x3c')]['type'][_0xbaf0('0x3d')]()});}}})[_0xbaf0('0x26')](function(_0x235953){if(_0x235953){logger[_0xbaf0('0x1e')](_0xbaf0('0x3e'),_0x235953[_0xbaf0('0x16')],_0x15111e);return BPromise[_0xbaf0('0x29')](_0x235953);}else{logger[_0xbaf0('0x1e')](_0xbaf0('0x3f'),_0x15111e);var _0x4bada8={'Phone':_0x15111e};if(_0x1d864b['moduleCreate']){if(_0x1d864b['moduleCreate']===_0xbaf0('0x14')){logger[_0xbaf0('0x1e')](_0xbaf0('0x40'),_0x15111e,_0x1d864b[_0xbaf0('0x41')]);_0x4bada8[_0xbaf0('0x42')]=_0x48b4a6!==''?_0x48b4a6:util['format']('Caller\x20-\x20%s',_0x15111e);}else if(_0x1d864b[_0xbaf0('0x41')]===_0xbaf0('0x1c')){logger[_0xbaf0('0x1e')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x15111e,_0x1d864b['moduleCreate']);_0x4bada8[_0xbaf0('0x42')]=_0x48b4a6!==_0xbaf0('0x43')?_0x48b4a6:util[_0xbaf0('0x44')](_0xbaf0('0x45'),_0x15111e);_0x4bada8[_0xbaf0('0x46')]='No\x20Company';}else if(_0x1d864b[_0xbaf0('0x41')]===_0xbaf0('0x17')){logger[_0xbaf0('0x1e')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x15111e,_0x1d864b[_0xbaf0('0x41')]);_0x4bada8[_0xbaf0('0x2a')]=_0x48b4a6!==_0xbaf0('0x43')?_0x48b4a6:util[_0xbaf0('0x44')](_0xbaf0('0x45'),_0x15111e);}else{return null;}}return _0x4ac1cb[_0xbaf0('0x1f')](_[_0xbaf0('0x47')](_0x1d864b[_0xbaf0('0x41')]))[_0xbaf0('0x20')](_0x4bada8)[_0xbaf0('0x26')](function(_0x1def1c){return BPromise[_0xbaf0('0x29')]({'id':_0x1def1c['id'],'endUserType':_0x1d864b[_0xbaf0('0x41')]});});}});}function getCustomFields(_0x5d6c7a,_0x46dbe2){var _0x4d6cba={};if(_0x5d6c7a[_0xbaf0('0x33')]>0x0){_[_0xbaf0('0x48')](_0x5d6c7a,function(_0x2ff8c7){if(_[_0xbaf0('0x49')]([_0xbaf0('0x4a'),'picklist'],_0x2ff8c7[_0xbaf0('0x4b')])&&_0x2ff8c7[_0xbaf0('0x4c')]){_0x4d6cba[_0x2ff8c7[_0xbaf0('0x4c')]]=_0x2ff8c7[_0xbaf0('0x4d')][_0xbaf0('0x4e')]();}else if(_0x2ff8c7['type']===_0xbaf0('0x4f')&&_0x2ff8c7[_0xbaf0('0x50')]&&_0x2ff8c7[_0xbaf0('0x4c')]){_0x46dbe2[_0x2ff8c7[_0xbaf0('0x50')]]&&(_0x4d6cba[_0x2ff8c7[_0xbaf0('0x4c')]]=_0x46dbe2[_0x2ff8c7[_0xbaf0('0x50')]][_0xbaf0('0x4e')]());}else if(_0x2ff8c7['type']==='customVariable'&&_0x2ff8c7[_0xbaf0('0x51')]&&_0x2ff8c7[_0xbaf0('0x51')][_0xbaf0('0x52')]&&_0x2ff8c7[_0xbaf0('0x4c')]){_0x46dbe2[_0x2ff8c7[_0xbaf0('0x51')][_0xbaf0('0x52')][_0xbaf0('0x3d')]()]&&(_0x4d6cba[_0x2ff8c7['idField']]=_0x46dbe2[_0x2ff8c7[_0xbaf0('0x51')][_0xbaf0('0x52')][_0xbaf0('0x3d')]()][_0xbaf0('0x4e')]());}});}return _0x4d6cba;}function getConnection(_0xa944e0){var _0xf82bc3=_0xa944e0[_0xbaf0('0x53')][_0xbaf0('0x54')](_0xa944e0[_0xbaf0('0x55')]);var _0x34ecf7=new jsforce['Connection']({'oauth2':{'loginUrl':_0xa944e0[_0xbaf0('0x56')]||_0xbaf0('0x57'),'clientId':_0xa944e0[_0xbaf0('0x58')],'clientSecret':_0xa944e0[_0xbaf0('0x59')]}});return _0x34ecf7[_0xbaf0('0x5a')](_0xa944e0[_0xbaf0('0x5b')],_0xf82bc3)[_0xbaf0('0x26')](function(){logger[_0xbaf0('0x1e')](_0xbaf0('0x5c'));return _0x34ecf7;});}exports[_0xbaf0('0x5d')]=function(_0x44fafc,_0x338c60,_0x136779,_0x560624,_0x4d876a,_0x5a4bb1){var _0x1de116,_0x5a4aac,_0x166d9e,_0x42a83d;_0x5a4bb1['serverUrl']=intUtil['stripTrailingSlash'](_0x5a4bb1['serverUrl']);_0x5a4bb1[_0xbaf0('0x56')]=intUtil[_0xbaf0('0x5e')](_0x5a4bb1[_0xbaf0('0x56')]);if(_0x4d876a&&_0x4d876a['monitor_format']){logger['info'](_0xbaf0('0x5f'),_0xbaf0('0x60'));_0x338c60[_0xbaf0('0x61')]=util[_0xbaf0('0x44')](_0xbaf0('0x62'),_0x5a4bb1[_0xbaf0('0x63')],_0x338c60[_0xbaf0('0x64')],md5(_0x338c60[_0xbaf0('0x64')]));}else{_0x338c60[_0xbaf0('0x61')]='';}return getConnection(_0x5a4bb1)[_0xbaf0('0x26')](function(_0x18ef09){_0x42a83d=_0x18ef09;return getUser(_0x5a4bb1,_0x560624[_0xbaf0('0x65')],_0x42a83d);})[_0xbaf0('0x26')](function(_0x4fe9a0){_0x1de116=_0x4fe9a0;return getEndUser(_0x5a4bb1,_0x136779,_0x338c60['calleridname'],_0x338c60['calleridnum'],_0x42a83d);})['then'](function(_0xa3b146){_0x5a4aac=_0xa3b146;return getTicket(_0x5a4bb1,_0x1de116,_0x5a4aac,_0x136779,_0x338c60,_0x136779['Fields'],_0x42a83d,'queue');})['then'](function(_0x1bfa53){_0x166d9e=_0x1bfa53;logger[_0xbaf0('0x1e')]('[QUEUE]\x20Ticket\x20%s\x20created',_0x166d9e['id']);logger['info'](_0xbaf0('0x66'),_0x166d9e['id'],_0x560624[_0xbaf0('0x52')],_0x5a4bb1[_0xbaf0('0x4b')]);switch(_0x5a4bb1[_0xbaf0('0x4b')]){case _0xbaf0('0x67'):emit(util[_0xbaf0('0x44')]('user:%s',_0x560624[_0xbaf0('0x52')]),_0xbaf0('0x68'),{'recordId':_0x166d9e['id']});break;case'newTab':emit(util[_0xbaf0('0x44')](_0xbaf0('0x69'),_0x560624[_0xbaf0('0x52')]),'trigger:browser:url',{'uri':util['format'](_0xbaf0('0x6a'),_0x42a83d[_0xbaf0('0x6b')],_0x166d9e['id'])});break;default:logger[_0xbaf0('0x6c')](_0xbaf0('0x6d'));}})[_0xbaf0('0x6e')](function(_0x2e01c6){logger[_0xbaf0('0x6c')](_0xbaf0('0x5f'),_0x2e01c6);});};exports[_0xbaf0('0x6f')]=function(_0x4ccdf4,_0x21967f,_0x287c3a,_0x21a3e9,_0x4175c0,_0x1cd374,_0x334cdd){var _0x1e358f,_0x2ae91e,_0x3926ec,_0x55df1f;_0x1cd374[_0xbaf0('0x63')]=intUtil[_0xbaf0('0x5e')](_0x1cd374['serverUrl']);_0x1cd374['remoteUri']=intUtil[_0xbaf0('0x5e')](_0x1cd374[_0xbaf0('0x56')]);if(_0x334cdd&&_0x334cdd[_0xbaf0('0x70')]&&_0x334cdd[_0xbaf0('0x70')]!==_0xbaf0('0x71')){logger[_0xbaf0('0x1e')]('[OUTBOUND]',_0xbaf0('0x60'));_0x21967f['recordingURL']=util[_0xbaf0('0x44')](_0xbaf0('0x62'),_0x1cd374['serverUrl'],_0x21967f[_0xbaf0('0x64')],md5(_0x21967f['uniqueid']));}return getConnection(_0x1cd374)['then'](function(_0x2c685f){_0x55df1f=_0x2c685f;return getUser(_0x1cd374,_0x21a3e9[_0xbaf0('0x65')],_0x55df1f);})[_0xbaf0('0x26')](function(_0x10553c){_0x1e358f=_0x10553c;return getEndUser(_0x1cd374,_0x287c3a,_0x21967f[_0xbaf0('0x72')],_0x21967f['destcalleridnum'],_0x55df1f);})[_0xbaf0('0x26')](function(_0x2f8c03){_0x2ae91e=_0x2f8c03;return getTicket(_0x1cd374,_0x1e358f,_0x2ae91e,_0x287c3a,_0x21967f,_0x287c3a['Fields'],_0x55df1f,_0xbaf0('0x6f'));})[_0xbaf0('0x26')](function(_0x58ee95){_0x3926ec=_0x58ee95;logger[_0xbaf0('0x1e')](_0xbaf0('0x73'),_0x3926ec['id']);logger[_0xbaf0('0x1e')](_0xbaf0('0x74'),_0x3926ec['id'],_0x21a3e9[_0xbaf0('0x52')],_0x1cd374[_0xbaf0('0x4b')]);switch(_0x1cd374[_0xbaf0('0x4b')]){case _0xbaf0('0x67'):emit(util[_0xbaf0('0x44')]('user:%s',_0x21a3e9[_0xbaf0('0x52')]),_0xbaf0('0x68'),{'recordId':_0x3926ec['id']});break;case _0xbaf0('0x75'):emit(util[_0xbaf0('0x44')](_0xbaf0('0x69'),_0x21a3e9['name']),_0xbaf0('0x76'),{'uri':util[_0xbaf0('0x44')]('%s/%s/e',_0x55df1f[_0xbaf0('0x6b')],_0x3926ec['id'])});break;default:logger[_0xbaf0('0x6c')](_0xbaf0('0x77'),_0xbaf0('0x78'));}})[_0xbaf0('0x6e')](function(_0x335127){logger[_0xbaf0('0x6c')]('[OUTBOUND]',_0x335127);});};exports[_0xbaf0('0x79')]=function(_0x342cdc,_0x136b08,_0x262581,_0x5f67c6,_0x543075,_0x2520e7){var _0x4ae6cb,_0x51f581,_0x51c29e,_0x5a648a;_0x2520e7[_0xbaf0('0x63')]=intUtil[_0xbaf0('0x5e')](_0x2520e7[_0xbaf0('0x63')]);_0x2520e7[_0xbaf0('0x56')]=intUtil[_0xbaf0('0x5e')](_0x2520e7[_0xbaf0('0x56')]);if(_0x543075&&_0x543075[_0xbaf0('0x7a')]){logger[_0xbaf0('0x1e')]('['+_0x136b08[_0xbaf0('0x7b')][_0xbaf0('0x7c')]()+']',_0xbaf0('0x60'));_0x136b08['recordingURL']=util[_0xbaf0('0x44')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2520e7[_0xbaf0('0x63')],_0x136b08[_0xbaf0('0x64')],md5(_0x136b08[_0xbaf0('0x64')]));}else{_0x136b08[_0xbaf0('0x61')]='';}return getConnection(_0x2520e7)[_0xbaf0('0x26')](function(_0x245121){_0x5a648a=_0x245121;if(!_[_0xbaf0('0x21')](_0x5f67c6)){return getUser(_0x2520e7,_0x5f67c6[_0xbaf0('0x52')],_0x5a648a);}else{return getUser(_0x2520e7,null,_0x5a648a);}})['then'](function(_0x3f0e3b){_0x4ae6cb=_0x3f0e3b;return getEndUser(_0x2520e7,_0x262581,_0x136b08[_0xbaf0('0x7d')],_0x136b08[_0xbaf0('0x7e')],_0x5a648a);})[_0xbaf0('0x26')](function(_0x3bc3c0){_0x51f581=_0x3bc3c0;return getTicket(_0x2520e7,_0x4ae6cb,_0x51f581,_0x262581,_0x136b08,_0x262581['Fields'],_0x5a648a);})[_0xbaf0('0x26')](function(_0x19b3c4){_0x51c29e=_0x19b3c4;logger['info']('['+_0x136b08['lastevent'][_0xbaf0('0x7c')]()+_0xbaf0('0x7f'),_0x51c29e['id']);logger[_0xbaf0('0x1e')]('['+_0x136b08[_0xbaf0('0x7b')][_0xbaf0('0x7c')]()+_0xbaf0('0x80'),_0x2520e7[_0xbaf0('0x4b')]);})['catch'](function(_0xa1b3a){logger[_0xbaf0('0x6c')]('['+_0x136b08[_0xbaf0('0x7b')][_0xbaf0('0x7c')]()+']',_0xa1b3a);});}; \ No newline at end of file +var _0x8a47=['recordingFormat','none','[OUTBOUND]','email','destcalleridnum','Fields','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','newTab','trigger:browser:url','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.','request-promise','bluebird','md5','jsforce','../../../../config/logger','salesforce','redis','defaults','emit','assign','getString','Subjects','Descriptions','ticketType','Task','ActivityDate','utc','contact','endUserType','lead','WhoId','account','WhatId','Case','ContactId','leadId','info','isNil','sobject','find','execute','then','length','Agent\x20%s\x20found.','resolve','Name','identity','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','Contact','additionalSearchLead','$or','Lead','account_contact_lead','additionalSearchAccount','Account','first','Phone','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','','format','LastName','Caller\x20-\x20%s','Company','upperFirst','create','forEach','includes','idField','toString','variable','variableName','customVariable','Variable','name','password','concat','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridnum','[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','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound'];(function(_0x274e49,_0x198fd3){var _0x1932bd=function(_0x504a55){while(--_0x504a55){_0x274e49['push'](_0x274e49['shift']());}};_0x1932bd(++_0x198fd3);}(_0x8a47,0x17d));var _0x78a4=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8a47[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var rp=require(_0x78a4('0x0'));var moment=require('moment');var BPromise=require(_0x78a4('0x1'));var md5=require(_0x78a4('0x2'));var jsforce=require(_0x78a4('0x3'));var util=require('util');var Redis=require('ioredis');var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x78a4('0x4'))(_0x78a4('0x5'));config[_0x78a4('0x6')]=_[_0x78a4('0x7')](config[_0x78a4('0x6')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x4d6b5e,_0x183562,_0x2535ef){io['to'](_0x4d6b5e)[_0x78a4('0x8')](_0x183562,_0x2535ef);}function getTicket(_0x18d865,_0x227f0a,_0x5be72d,_0x3c1d33,_0x5e8d4d,_0x330ea9,_0x52a08e,_0x46ef87){var _0x553287=Object[_0x78a4('0x9')]({},{'OwnerId':_0x227f0a['id'],'Subject':intUtil[_0x78a4('0xa')](_0x3c1d33[_0x78a4('0xb')],_0x5e8d4d,'\x20'),'Description':intUtil[_0x78a4('0xa')](_0x3c1d33[_0x78a4('0xc')],_0x5e8d4d,'\x0a')},getCustomFields(_0x330ea9,_0x5e8d4d));if(_0x5be72d){if(_0x3c1d33[_0x78a4('0xd')]===_0x78a4('0xe')){_0x553287[_0x78a4('0xf')]=moment[_0x78a4('0x10')]();_0x553287['IsReminderSet']=![];_0x553287['IsRecurrence']=![];if(_0x5be72d['endUserType']===_0x78a4('0x11')||_0x5be72d[_0x78a4('0x12')]===_0x78a4('0x13')){_0x553287[_0x78a4('0x14')]=_0x5be72d['id'];}else if(_0x5be72d[_0x78a4('0x12')]===_0x78a4('0x15')){_0x553287[_0x78a4('0x16')]=_0x5be72d['id'];}}else if(_0x3c1d33[_0x78a4('0xd')]===_0x78a4('0x17')){if(_0x5be72d[_0x78a4('0x12')]===_0x78a4('0x11')){_0x553287[_0x78a4('0x18')]=_0x5be72d['id'];}else if(_0x5be72d[_0x78a4('0x12')]===_0x78a4('0x15')){_0x553287['AccountId']=_0x5be72d['id'];}else if(_0x5be72d[_0x78a4('0x12')]==='lead'&&_0x3c1d33[_0x78a4('0x19')]){_0x553287[_0x3c1d33[_0x78a4('0x19')]]=_0x5be72d['id'];}else{logger[_0x78a4('0x1a')]('Association\x20between\x20Case\x20and\x20Lead\x20skipped');}}}return _0x52a08e['sobject'](_0x3c1d33[_0x78a4('0xd')])['create'](_0x553287);}function getUser(_0x1a4b7d,_0x5c5613,_0x3d5116){if(!_[_0x78a4('0x1b')](_0x5c5613)&&intUtil['validateEmail'](_0x5c5613)){var _0x4bdd92={'Email':_0x5c5613};var _0x13f756={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x3d5116[_0x78a4('0x1c')]('User')[_0x78a4('0x1d')](_0x4bdd92,_0x13f756)[_0x78a4('0x1e')]()[_0x78a4('0x1f')](function(_0x2a559e){if(_0x2a559e[_0x78a4('0x20')]){var _0x2fd4d4=_['find'](_0x2a559e,function(_0xc6d237){return _0xc6d237['Email']===_0x5c5613;});if(_0x2fd4d4){logger[_0x78a4('0x1a')](_0x78a4('0x21'),_0x5c5613);return BPromise[_0x78a4('0x22')]({'id':_0x2fd4d4['Id'],'name':_0x2fd4d4[_0x78a4('0x23')]});}}else{logger[_0x78a4('0x1a')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x5c5613);return _0x3d5116[_0x78a4('0x24')]()[_0x78a4('0x1f')](function(_0x5ab7bd){return BPromise[_0x78a4('0x22')]({'id':_0x5ab7bd[_0x78a4('0x25')],'name':_0x5ab7bd[_0x78a4('0x26')]});});}});}else{logger[_0x78a4('0x1a')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x5c5613);return _0x3d5116[_0x78a4('0x24')]()[_0x78a4('0x1f')](function(_0x37c364){return BPromise[_0x78a4('0x22')]({'id':_0x37c364[_0x78a4('0x25')],'name':_0x37c364['display_name']});});}}function getEndUser(_0x4da045,_0x2ccd56,_0xccac65,_0x5315a2,_0x15d5fc){var _0x562469={'$or':{'Phone':_0x5315a2}};var _0x331b34={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x78a4('0x22')]()[_0x78a4('0x1f')](function(){logger[_0x78a4('0x1a')](_0x78a4('0x27'),_0x5315a2,_0x2ccd56[_0x78a4('0x28')]);switch(_0x2ccd56[_0x78a4('0x28')]){case _0x78a4('0x29'):var _0xe68554=_[_0x78a4('0x2a')](_0x562469);if(_0x2ccd56[_0x78a4('0x2b')]){var _0x563038={};_0x563038[_0x2ccd56[_0x78a4('0x2b')]]=_0x5315a2;_[_0x78a4('0x2c')](_0xe68554['$or'],_0x563038);}return _0x15d5fc[_0x78a4('0x1c')](_0x78a4('0x2d'))[_0x78a4('0x1d')](_0xe68554,_0x331b34)['execute']()['then'](function(_0x14afd1){if(_0x14afd1&&_0x14afd1[_0x78a4('0x20')]){return _0x14afd1;}else{var _0x3bfc35=_[_0x78a4('0x2a')](_0x562469);if(_0x2ccd56[_0x78a4('0x2e')]){var _0xd0c979={};_0xd0c979[_0x2ccd56['additionalSearchLead']]=_0x5315a2;_[_0x78a4('0x2c')](_0x3bfc35[_0x78a4('0x2f')],_0xd0c979);}return _0x15d5fc[_0x78a4('0x1c')](_0x78a4('0x30'))[_0x78a4('0x1d')](_0x3bfc35,_0x331b34);}});case _0x78a4('0x31'):var _0x4838f4=_[_0x78a4('0x2a')](_0x562469);if(_0x2ccd56[_0x78a4('0x32')]){var _0x563038={};_0x563038[_0x2ccd56[_0x78a4('0x32')]]=_0x5315a2;_[_0x78a4('0x2c')](_0x4838f4[_0x78a4('0x2f')],_0x563038);}return _0x15d5fc[_0x78a4('0x1c')]('Account')[_0x78a4('0x1d')](_0x4838f4,_0x331b34)[_0x78a4('0x1e')]()['then'](function(_0x44cda3){if(_0x44cda3&&_0x44cda3[_0x78a4('0x20')]){return _0x44cda3;}else{var _0x36f39b=_[_0x78a4('0x2a')](_0x562469);if(_0x2ccd56[_0x78a4('0x2b')]){var _0x4d638a={};_0x4d638a[_0x2ccd56[_0x78a4('0x2b')]]=_0x5315a2;_[_0x78a4('0x2c')](_0x36f39b[_0x78a4('0x2f')],_0x4d638a);}return _0x15d5fc['sobject']('Contact')[_0x78a4('0x1d')](_0x36f39b,_0x331b34)[_0x78a4('0x1f')](function(_0x42fb79){if(_0x42fb79&&_0x42fb79[_0x78a4('0x20')]){return _0x42fb79;}else{var _0x7b534c=_[_0x78a4('0x2a')](_0x562469);if(_0x2ccd56[_0x78a4('0x2e')]){var _0x2d9d03={};_0x2d9d03[_0x2ccd56[_0x78a4('0x2e')]]=_0x5315a2;_[_0x78a4('0x2c')](_0x7b534c[_0x78a4('0x2f')],_0x2d9d03);}return _0x15d5fc['sobject']('Lead')[_0x78a4('0x1d')](_0x7b534c,_0x331b34);}});}});case _0x78a4('0x11'):var _0xe68554=_[_0x78a4('0x2a')](_0x562469);if(_0x2ccd56[_0x78a4('0x2b')]){var _0x563038={};_0x563038[_0x2ccd56[_0x78a4('0x2b')]]=_0x5315a2;_[_0x78a4('0x2c')](_0xe68554[_0x78a4('0x2f')],_0x563038);}return _0x15d5fc[_0x78a4('0x1c')](_0x78a4('0x2d'))[_0x78a4('0x1d')](_0xe68554,_0x331b34)[_0x78a4('0x1e')]();case _0x78a4('0x13'):var _0xbea55c=_[_0x78a4('0x2a')](_0x562469);if(_0x2ccd56[_0x78a4('0x2e')]){var _0x563038={};_0x563038[_0x2ccd56[_0x78a4('0x2e')]]=_0x5315a2;_[_0x78a4('0x2c')](_0xbea55c[_0x78a4('0x2f')],_0x563038);}return _0x15d5fc[_0x78a4('0x1c')](_0x78a4('0x30'))['find'](_0xbea55c,_0x331b34);case'account':var _0x4838f4=_['cloneDeep'](_0x562469);if(_0x2ccd56[_0x78a4('0x32')]){var _0x563038={};_0x563038[_0x2ccd56[_0x78a4('0x32')]]=_0x5315a2;_[_0x78a4('0x2c')](_0x4838f4[_0x78a4('0x2f')],_0x563038);}return _0x15d5fc[_0x78a4('0x1c')](_0x78a4('0x33'))[_0x78a4('0x1d')](_0x4838f4,_0x331b34);default:return null;}})['then'](function(_0x5000bc){if(_0x5000bc&&_0x5000bc[_0x78a4('0x20')]){var _0x840618=_[_0x78a4('0x34')](_0x5000bc);if(_0x840618){return BPromise[_0x78a4('0x22')]({'id':_0x840618['Id'],'name':_0x840618[_0x78a4('0x23')],'phone':_0x840618[_0x78a4('0x35')],'endUserType':_0x840618[_0x78a4('0x36')][_0x78a4('0x37')][_0x78a4('0x38')]()});}}})[_0x78a4('0x1f')](function(_0x236197){if(_0x236197){logger['info'](_0x78a4('0x39'),_0x236197[_0x78a4('0x12')],_0x5315a2);return BPromise['resolve'](_0x236197);}else{logger[_0x78a4('0x1a')](_0x78a4('0x3a'),_0x5315a2);var _0x57edbd={'Phone':_0x5315a2};if(_0x2ccd56[_0x78a4('0x3b')]){if(_0x2ccd56['moduleCreate']===_0x78a4('0x11')){logger[_0x78a4('0x1a')](_0x78a4('0x3c'),_0x5315a2,_0x2ccd56[_0x78a4('0x3b')]);_0x57edbd['LastName']=_0xccac65!==_0x78a4('0x3d')?_0xccac65:util[_0x78a4('0x3e')]('Caller\x20-\x20%s',_0x5315a2);}else if(_0x2ccd56[_0x78a4('0x3b')]==='lead'){logger[_0x78a4('0x1a')](_0x78a4('0x3c'),_0x5315a2,_0x2ccd56['moduleCreate']);_0x57edbd[_0x78a4('0x3f')]=_0xccac65!==_0x78a4('0x3d')?_0xccac65:util[_0x78a4('0x3e')](_0x78a4('0x40'),_0x5315a2);_0x57edbd[_0x78a4('0x41')]='No\x20Company';}else if(_0x2ccd56['moduleCreate']===_0x78a4('0x15')){logger['info'](_0x78a4('0x3c'),_0x5315a2,_0x2ccd56[_0x78a4('0x3b')]);_0x57edbd['Name']=_0xccac65!==''?_0xccac65:util[_0x78a4('0x3e')](_0x78a4('0x40'),_0x5315a2);}else{return null;}}return _0x15d5fc[_0x78a4('0x1c')](_[_0x78a4('0x42')](_0x2ccd56['moduleCreate']))[_0x78a4('0x43')](_0x57edbd)[_0x78a4('0x1f')](function(_0x2c3715){return BPromise[_0x78a4('0x22')]({'id':_0x2c3715['id'],'endUserType':_0x2ccd56['moduleCreate']});});}});}function getCustomFields(_0x2d4cfd,_0xb95022){var _0x42459e={};if(_0x2d4cfd[_0x78a4('0x20')]>0x0){_[_0x78a4('0x44')](_0x2d4cfd,function(_0x573b52){if(_[_0x78a4('0x45')](['string','picklist'],_0x573b52['type'])&&_0x573b52[_0x78a4('0x46')]){_0x42459e[_0x573b52[_0x78a4('0x46')]]=_0x573b52['content'][_0x78a4('0x47')]();}else if(_0x573b52[_0x78a4('0x37')]===_0x78a4('0x48')&&_0x573b52[_0x78a4('0x49')]&&_0x573b52['idField']){_0xb95022[_0x573b52['variableName']]&&(_0x42459e[_0x573b52[_0x78a4('0x46')]]=_0xb95022[_0x573b52['variableName']][_0x78a4('0x47')]());}else if(_0x573b52[_0x78a4('0x37')]===_0x78a4('0x4a')&&_0x573b52['Variable']&&_0x573b52[_0x78a4('0x4b')][_0x78a4('0x4c')]&&_0x573b52[_0x78a4('0x46')]){_0xb95022[_0x573b52['Variable'][_0x78a4('0x4c')][_0x78a4('0x38')]()]&&(_0x42459e[_0x573b52[_0x78a4('0x46')]]=_0xb95022[_0x573b52['Variable'][_0x78a4('0x4c')][_0x78a4('0x38')]()][_0x78a4('0x47')]());}});}return _0x42459e;}function getConnection(_0x7a91cb){var _0x3bc490=_0x7a91cb[_0x78a4('0x4d')][_0x78a4('0x4e')](_0x7a91cb['securityToken']);var _0x38ea90=new jsforce[(_0x78a4('0x4f'))]({'oauth2':{'loginUrl':_0x7a91cb[_0x78a4('0x50')]||_0x78a4('0x51'),'clientId':_0x7a91cb[_0x78a4('0x52')],'clientSecret':_0x7a91cb[_0x78a4('0x53')]}});return _0x38ea90[_0x78a4('0x54')](_0x7a91cb[_0x78a4('0x55')],_0x3bc490)['then'](function(){logger[_0x78a4('0x1a')](_0x78a4('0x56'));return _0x38ea90;});}exports[_0x78a4('0x57')]=function(_0xe07396,_0xd63de0,_0x35cf58,_0x1305f8,_0x64849f,_0x324407){var _0x42b97c,_0x3ad1e7,_0x457c26,_0x306556;_0x324407[_0x78a4('0x58')]=intUtil[_0x78a4('0x59')](_0x324407[_0x78a4('0x58')]);_0x324407[_0x78a4('0x50')]=intUtil['stripTrailingSlash'](_0x324407[_0x78a4('0x50')]);if(_0x64849f&&_0x64849f[_0x78a4('0x5a')]){logger[_0x78a4('0x1a')]('[QUEUE]',_0x78a4('0x5b'));_0xd63de0[_0x78a4('0x5c')]=util[_0x78a4('0x3e')](_0x78a4('0x5d'),_0x324407['serverUrl'],_0xd63de0[_0x78a4('0x5e')],md5(_0xd63de0[_0x78a4('0x5e')]));}else{_0xd63de0[_0x78a4('0x5c')]='';}return getConnection(_0x324407)['then'](function(_0x47ccde){_0x306556=_0x47ccde;return getUser(_0x324407,_0x1305f8['email'],_0x306556);})['then'](function(_0x20b879){_0x42b97c=_0x20b879;return getEndUser(_0x324407,_0x35cf58,_0xd63de0['calleridname'],_0xd63de0[_0x78a4('0x5f')],_0x306556);})[_0x78a4('0x1f')](function(_0x59ce55){_0x3ad1e7=_0x59ce55;return getTicket(_0x324407,_0x42b97c,_0x3ad1e7,_0x35cf58,_0xd63de0,_0x35cf58['Fields'],_0x306556,_0x78a4('0x57'));})[_0x78a4('0x1f')](function(_0x240664){_0x457c26=_0x240664;logger[_0x78a4('0x1a')](_0x78a4('0x60'),_0x457c26['id']);logger[_0x78a4('0x1a')](_0x78a4('0x61'),_0x457c26['id'],_0x1305f8['name'],_0x324407[_0x78a4('0x37')]);switch(_0x324407[_0x78a4('0x37')]){case _0x78a4('0x62'):emit(util[_0x78a4('0x3e')](_0x78a4('0x63'),_0x1305f8[_0x78a4('0x4c')]),_0x78a4('0x64'),{'recordId':_0x457c26['id']});break;case'newTab':emit(util[_0x78a4('0x3e')]('user:%s',_0x1305f8['name']),'trigger:browser:url',{'uri':util['format'](_0x78a4('0x65'),_0x306556[_0x78a4('0x66')],_0x457c26['id'])});break;default:logger[_0x78a4('0x67')](_0x78a4('0x68'));}})[_0x78a4('0x69')](function(_0xbf1cbe){logger[_0x78a4('0x67')]('[QUEUE]',_0xbf1cbe);});};exports[_0x78a4('0x6a')]=function(_0x14b5d5,_0x53a321,_0x33494b,_0x2707cd,_0xbf554c,_0x53f13e,_0x592033){var _0x33a5bf,_0x14a97f,_0x55100b,_0x23c15c;_0x53f13e[_0x78a4('0x58')]=intUtil[_0x78a4('0x59')](_0x53f13e[_0x78a4('0x58')]);_0x53f13e['remoteUri']=intUtil[_0x78a4('0x59')](_0x53f13e[_0x78a4('0x50')]);if(_0x592033&&_0x592033[_0x78a4('0x6b')]&&_0x592033[_0x78a4('0x6b')]!==_0x78a4('0x6c')){logger[_0x78a4('0x1a')](_0x78a4('0x6d'),_0x78a4('0x5b'));_0x53a321[_0x78a4('0x5c')]=util[_0x78a4('0x3e')](_0x78a4('0x5d'),_0x53f13e[_0x78a4('0x58')],_0x53a321['uniqueid'],md5(_0x53a321[_0x78a4('0x5e')]));}return getConnection(_0x53f13e)[_0x78a4('0x1f')](function(_0x410f06){_0x23c15c=_0x410f06;return getUser(_0x53f13e,_0x2707cd[_0x78a4('0x6e')],_0x23c15c);})[_0x78a4('0x1f')](function(_0x15007a){_0x33a5bf=_0x15007a;return getEndUser(_0x53f13e,_0x33494b,_0x53a321['destcalleridname'],_0x53a321[_0x78a4('0x6f')],_0x23c15c);})[_0x78a4('0x1f')](function(_0x41aa68){_0x14a97f=_0x41aa68;return getTicket(_0x53f13e,_0x33a5bf,_0x14a97f,_0x33494b,_0x53a321,_0x33494b[_0x78a4('0x70')],_0x23c15c,_0x78a4('0x6a'));})[_0x78a4('0x1f')](function(_0x13e143){_0x55100b=_0x13e143;logger['info'](_0x78a4('0x71'),_0x55100b['id']);logger[_0x78a4('0x1a')](_0x78a4('0x72'),_0x55100b['id'],_0x2707cd['name'],_0x53f13e[_0x78a4('0x37')]);switch(_0x53f13e[_0x78a4('0x37')]){case _0x78a4('0x62'):emit(util[_0x78a4('0x3e')](_0x78a4('0x63'),_0x2707cd[_0x78a4('0x4c')]),_0x78a4('0x64'),{'recordId':_0x55100b['id']});break;case _0x78a4('0x73'):emit(util[_0x78a4('0x3e')]('user:%s',_0x2707cd[_0x78a4('0x4c')]),_0x78a4('0x74'),{'uri':util[_0x78a4('0x3e')](_0x78a4('0x65'),_0x23c15c[_0x78a4('0x66')],_0x55100b['id'])});break;default:logger[_0x78a4('0x67')](_0x78a4('0x6d'),_0x78a4('0x75'));}})['catch'](function(_0x330a88){logger[_0x78a4('0x67')](_0x78a4('0x6d'),_0x330a88);});};exports[_0x78a4('0x76')]=function(_0x3a99ea,_0x3a1826,_0x28e533,_0x47bc40,_0x3acb06,_0x23918f){var _0xdaab3c,_0x43e36d,_0x12b5ab,_0xbfb869;_0x23918f['serverUrl']=intUtil[_0x78a4('0x59')](_0x23918f[_0x78a4('0x58')]);_0x23918f['remoteUri']=intUtil['stripTrailingSlash'](_0x23918f['remoteUri']);if(_0x3acb06&&_0x3acb06['monitor_format']){logger[_0x78a4('0x1a')]('['+_0x3a1826[_0x78a4('0x77')]['toUpperCase']()+']',_0x78a4('0x5b'));_0x3a1826[_0x78a4('0x5c')]=util['format'](_0x78a4('0x5d'),_0x23918f[_0x78a4('0x58')],_0x3a1826['uniqueid'],md5(_0x3a1826[_0x78a4('0x5e')]));}else{_0x3a1826[_0x78a4('0x5c')]='';}return getConnection(_0x23918f)[_0x78a4('0x1f')](function(_0x18e6f1){_0xbfb869=_0x18e6f1;if(!_['isNil'](_0x47bc40)){return getUser(_0x23918f,_0x47bc40[_0x78a4('0x4c')],_0xbfb869);}else{return getUser(_0x23918f,null,_0xbfb869);}})[_0x78a4('0x1f')](function(_0x1c7e2d){_0xdaab3c=_0x1c7e2d;return getEndUser(_0x23918f,_0x28e533,_0x3a1826['calleridname'],_0x3a1826[_0x78a4('0x5f')],_0xbfb869);})[_0x78a4('0x1f')](function(_0x517396){_0x43e36d=_0x517396;return getTicket(_0x23918f,_0xdaab3c,_0x43e36d,_0x28e533,_0x3a1826,_0x28e533['Fields'],_0xbfb869);})[_0x78a4('0x1f')](function(_0x4a8634){_0x12b5ab=_0x4a8634;logger['info']('['+_0x3a1826[_0x78a4('0x77')][_0x78a4('0x78')]()+_0x78a4('0x79'),_0x12b5ab['id']);logger[_0x78a4('0x1a')]('['+_0x3a1826[_0x78a4('0x77')][_0x78a4('0x78')]()+']\x20Integration\x20account\x20type\x20%s.',_0x23918f[_0x78a4('0x37')]);})[_0x78a4('0x69')](function(_0x22e6e6){logger['error']('['+_0x3a1826['lastevent'][_0x78a4('0x78')]()+']',_0x22e6e6);});}; \ 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 94533c7..e2ffe3c 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 _0xde0f=['message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','length','active','userId','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','adminEmail','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','true','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','forEach','includes','string','picklist','type','nameField','customField','content','idField','toLowerCase','toString','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','Incident','Incident\x20-\x20','push',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','all','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','trigger:browser:url','username','password','sysparm_limit=1','stripTrailingSlash','remoteUri','serverUrl','isNil','email','destcalleridnum','calleridnum','unmanaged','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','util','ioredis','./util','../../../../config/environment','servicenow','redis','defaults','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','adminId','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error'];(function(_0xcc6ae,_0x11bc90){var _0x57e3a8=function(_0x2dc713){while(--_0x2dc713){_0xcc6ae['push'](_0xcc6ae['shift']());}};_0x57e3a8(++_0x11bc90);}(_0xde0f,0x1ab));var _0xfde0=function(_0x4addbf,_0x194235){_0x4addbf=_0x4addbf-0x0;var _0x2e8d60=_0xde0f[_0x4addbf];return _0x2e8d60;};'use strict';var _=require(_0xfde0('0x0'));var Promise=require('bluebird');var rp=require('request-promise');var util=require(_0xfde0('0x1'));var md5=require('md5');var Redis=require(_0xfde0('0x2'));var intUtil=require(_0xfde0('0x3'));var config=require(_0xfde0('0x4'));var logger=require('../../../../config/logger')(_0xfde0('0x5'));config[_0xfde0('0x6')]=_[_0xfde0('0x7')](config[_0xfde0('0x6')],{'host':_0xfde0('0x8'),'port':0x18eb});var io=require(_0xfde0('0x9'))(new Redis(config[_0xfde0('0x6')]));function getAdminUser(_0x383429,_0x3b3859,_0x3f3414,_0x1faff9,_0x38f04b,_0x82b38c){return new Promise(function(_0xf297ec,_0x275965){var _0x1bf06f={'method':_0xfde0('0xa'),'uri':_0x1faff9+_0xfde0('0xb')+'&'+_0x38f04b+'&'+_0x82b38c,'auth':_0x3b3859,'json':!![]};return rp(_0x1bf06f)[_0xfde0('0xc')](function(_0x59403f){if(_0x59403f[_0xfde0('0xd')]['length']>0x0){_0x3f3414[_0xfde0('0xe')]=_0x59403f[_0xfde0('0xd')][0x0][_0xfde0('0xf')];}logger[_0xfde0('0x10')]('['+[_0x383429[_0xfde0('0x11')]()]+_0xfde0('0x12'),_0x3f3414);_0xf297ec(_0x3f3414);})[_0xfde0('0x13')](function(_0x4a59e0){logger[_0xfde0('0x14')]('['+[_0x383429[_0xfde0('0x11')]()]+']',_0x4a59e0[_0xfde0('0x15')]);_0x275965(_0x4a59e0[_0xfde0('0x15')]);});});}function getUser(_0x4fd867,_0x3e3b17,_0x45661f,_0x2396fb,_0x1f2619){return function(_0x2ea1f2){logger[_0xfde0('0x10')]('['+[_0x4fd867[_0xfde0('0x11')]()]+_0xfde0('0x16'),_0x2ea1f2);return new Promise(function(_0x6dc6ee,_0x14cc3c){if(intUtil[_0xfde0('0x17')](_0x2ea1f2[_0xfde0('0x18')])){var _0x1d720c={'method':'GET','uri':_0x45661f+_0xfde0('0x19')+_0x2ea1f2[_0xfde0('0x18')]+'&'+_0x2396fb+'&'+_0x1f2619,'auth':_0x3e3b17,'json':!![]};logger[_0xfde0('0x10')]('['+[_0x4fd867['toUpperCase']()]+_0xfde0('0x1a'),_0x1d720c);return rp(_0x1d720c)[_0xfde0('0xc')](function(_0x4846b7){logger[_0xfde0('0x10')]('['+[_0x4fd867[_0xfde0('0x11')]()]+_0xfde0('0x1b'),_0x4846b7);if(_0x4846b7[_0xfde0('0xd')][_0xfde0('0x1c')]>0x0&&String(_0x4846b7[_0xfde0('0xd')][0x0][_0xfde0('0x1d')])==='true'){_0x2ea1f2[_0xfde0('0x1e')]=_0x4846b7[_0xfde0('0xd')][0x0][_0xfde0('0xf')];}else{_0x2ea1f2[_0xfde0('0x1e')]=_0x2ea1f2[_0xfde0('0xe')];_0x2ea1f2[_0xfde0('0x18')]=_0x2ea1f2['adminEmail'];}logger[_0xfde0('0x10')]('['+[_0x4fd867[_0xfde0('0x11')]()]+_0xfde0('0x1f'),_0x2ea1f2);_0x6dc6ee(_0x2ea1f2);})[_0xfde0('0x13')](function(_0x29e247){logger[_0xfde0('0x14')]('['+[_0x4fd867[_0xfde0('0x11')]()]+']',_0x29e247[_0xfde0('0x15')]);_0x14cc3c(_0x29e247[_0xfde0('0x15')]);});}else{logger[_0xfde0('0x10')]('['+[_0x4fd867['toUpperCase']()]+_0xfde0('0x20'));_0x2ea1f2['userId']=_0x2ea1f2[_0xfde0('0xe')];_0x2ea1f2[_0xfde0('0x18')]=_0x2ea1f2[_0xfde0('0x21')];_0x6dc6ee(_0x2ea1f2);}});};}function createEndUser(_0x1d2e32,_0x5d9349,_0x72e051,_0x2d4d1f,_0x911d11){logger[_0xfde0('0x10')]('['+[_0x1d2e32[_0xfde0('0x11')]()]+_0xfde0('0x22'),_0x72e051);return new Promise(function(_0x285933,_0x4e7c50){var _0x1df6f5={'method':_0xfde0('0x23'),'uri':_0x2d4d1f+_0xfde0('0x24')+_0x911d11,'body':{'user_name':_0x72e051[_0xfde0('0x25')],'roles':_0xfde0('0x26'),'first_name':_0x72e051['endUserNumber'],'active':_0xfde0('0x27'),'date_format':_0xfde0('0x28'),'phone':_0x72e051[_0xfde0('0x25')]},'auth':_0x5d9349,'json':!![]};return rp(_0x1df6f5)['then'](function(_0x592dc4){logger['info']('['+[_0x1d2e32[_0xfde0('0x11')]()]+_0xfde0('0x29'),_0x592dc4['result']);_0x72e051[_0xfde0('0x2a')]=_0x592dc4[_0xfde0('0xd')][_0xfde0('0xf')];_0x285933(_0x72e051);})[_0xfde0('0x13')](function(_0x53a808){logger[_0xfde0('0x14')]('['+[_0x1d2e32['toUpperCase']()]+']',_0x53a808['message']);_0x4e7c50(_0x53a808[_0xfde0('0x15')]);});});}function getEndUser(_0x262c57,_0x2e5a5b,_0x68a12c,_0x5ad36a,_0x48a1ad){return function(_0x588a36){logger[_0xfde0('0x10')]('['+[_0x262c57[_0xfde0('0x11')]()]+_0xfde0('0x2b'),_0x588a36);return new Promise(function(_0x1f7dce,_0x1612ab){var _0x3c6e26={'method':_0xfde0('0xa'),'uri':_0x68a12c+'sys_user?sysparm_query=phone%3D'+_0x588a36['endUserNumber']+'&'+_0x5ad36a+'&'+_0x48a1ad,'auth':_0x2e5a5b,'json':!![]};return rp(_0x3c6e26)['then'](function(_0x1fe96a){if(_0x1fe96a[_0xfde0('0xd')]['length']>0x0){_0x588a36[_0xfde0('0x2a')]=_0x1fe96a[_0xfde0('0xd')][0x0]['sys_id'];logger[_0xfde0('0x10')]('['+[_0x262c57[_0xfde0('0x11')]()]+'],\x20getEndUser\x20crm',_0x588a36);_0x1f7dce(_0x588a36);}else{return createEndUser(_0x262c57,_0x2e5a5b,_0x588a36,_0x68a12c,_0x5ad36a)[_0xfde0('0xc')](function(_0x381429){logger['info']('['+[_0x262c57[_0xfde0('0x11')]()]+'],\x20createEndUser\x20crm',_0x381429);_0x1f7dce(_0x381429);});}})[_0xfde0('0x13')](function(_0xa4f835){logger[_0xfde0('0x14')]('['+[_0x262c57[_0xfde0('0x11')]()]+']',_0xa4f835[_0xfde0('0x15')]);_0x1612ab(_0xa4f835[_0xfde0('0x15')]);});});};}function getCustomFields(_0xb58fef,_0x46b84f){var _0x5b35ee={};if(_0xb58fef[_0xfde0('0x1c')]>0x0){_[_0xfde0('0x2c')](_0xb58fef,function(_0x5946d1){if(_[_0xfde0('0x2d')]([_0xfde0('0x2e'),_0xfde0('0x2f')],_0x5946d1[_0xfde0('0x30')])&&_0x5946d1[_0xfde0('0x31')]&&!_0x5946d1[_0xfde0('0x32')]){_0x5b35ee[_0x5946d1['nameField']['toLowerCase']()]=_0x5946d1[_0xfde0('0x33')]['toString']();}else if(_['includes']([_0xfde0('0x2e'),_0xfde0('0x2f')],_0x5946d1[_0xfde0('0x30')])&&_0x5946d1[_0xfde0('0x34')]&&_0x5946d1[_0xfde0('0x32')]){_0x5b35ee[_0x5946d1[_0xfde0('0x34')][_0xfde0('0x35')]()]=_0x5946d1[_0xfde0('0x33')][_0xfde0('0x36')]();}else if(_0x5946d1[_0xfde0('0x30')]==='variable'&&_0x5946d1['variableName']&&_0x5946d1[_0xfde0('0x34')]&&_0x5946d1[_0xfde0('0x32')]){_0x5b35ee[_0x5946d1[_0xfde0('0x34')][_0xfde0('0x35')]()]=_0x46b84f[_0x5946d1[_0xfde0('0x37')]][_0xfde0('0x36')]();}else if(_0x5946d1['type']===_0xfde0('0x38')&&_0x5946d1[_0xfde0('0x39')]&&_0x5946d1[_0xfde0('0x39')][_0xfde0('0x3a')]&&_0x5946d1[_0xfde0('0x34')]&&_0x5946d1[_0xfde0('0x32')]){_0x5b35ee[_0x5946d1[_0xfde0('0x34')][_0xfde0('0x35')]()]=_0x46b84f[_0x5946d1[_0xfde0('0x39')]['name']['toLowerCase']()]['toString']();}});}return _0x5b35ee;}function getTicket(_0x4f04fe,_0x5b7a39,_0x74a799,_0x457667,_0x488fcb,_0x47d1e3){return function(_0x341bc7){logger[_0xfde0('0x10')]('['+[_0x4f04fe[_0xfde0('0x11')]()]+_0xfde0('0x3b'),_0x341bc7);return new Promise(function(_0x1652a7,_0x5c9fe0){var _0x29a1dc=_0x4f04fe['toLowerCase']()===_0xfde0('0x3c')?_0x341bc7[_0xfde0('0x1e')]:_0x341bc7[_0xfde0('0x2a')];var _0x2bdb48={'method':_0xfde0('0x23'),'uri':_0x74a799+_0xfde0('0x3d')+'?'+_0x47d1e3,'body':Object[_0xfde0('0x3e')]({},{'active':_0xfde0('0x27'),'caller_id':_0x29a1dc,'assigned_to':_0x341bc7[_0xfde0('0x1e')],'short_description':intUtil[_0xfde0('0x3f')](_0x457667[_0xfde0('0x40')],_0x488fcb,'\x20'),'description':intUtil[_0xfde0('0x3f')](_0x457667[_0xfde0('0x41')],_0x488fcb,'\x0a')},getCustomFields(_0x457667[_0xfde0('0x42')],_0x488fcb)),'auth':_0x5b7a39,'json':!![]};return rp(_0x2bdb48)[_0xfde0('0xc')](function(_0x12d6bf){logger[_0xfde0('0x10')]('['+[_0x4f04fe[_0xfde0('0x11')]()]+_0xfde0('0x43'),_0x12d6bf[_0xfde0('0xd')]);_0x341bc7[_0xfde0('0x44')]=_0x12d6bf[_0xfde0('0xd')][_0xfde0('0xf')];_0x341bc7[_0xfde0('0x45')]=_0x12d6bf[_0xfde0('0xd')][_0xfde0('0x46')];logger['info']('['+[_0x4f04fe[_0xfde0('0x11')]()]+_0xfde0('0x47'),_0x341bc7);_0x1652a7(_0x341bc7);})['catch'](function(_0x41c395){logger[_0xfde0('0x14')]('['+[_0x4f04fe['toUpperCase']()]+']',_0x41c395[_0xfde0('0x15')]);_0x5c9fe0(_0x41c395[_0xfde0('0x15')]);});});};}function createRemoteTag(_0x3c9160,_0x2d4d6b,_0x395cbf,_0x170bb7){return new Promise(function(_0x26bcc0,_0x38f6c0){var _0x2b795f={'method':_0xfde0('0x23'),'uri':_0x395cbf+_0xfde0('0x48')+'?'+_0x170bb7,'body':{'short_description':_0x3c9160,'global':!![],'active':!![],'name':_0x3c9160},'auth':_0x2d4d6b,'json':!![]};return rp(_0x2b795f)[_0xfde0('0xc')](function(_0x28e3e1){var _0x47b7ff=_0x28e3e1[_0xfde0('0xd')][_0xfde0('0xf')];_0x26bcc0(_0x47b7ff);});});}function getRemoteTag(_0x2da49a,_0x39f056,_0x367a2c,_0x4c2353,_0x4e9250){return new Promise(function(_0x4366b5,_0x364a3f){var _0x4bfcba={'method':_0xfde0('0xa'),'uri':_0x367a2c+_0xfde0('0x48')+_0xfde0('0x49')+_0x2da49a+'&'+_0x4c2353,'auth':_0x39f056,'json':!![]};return rp(_0x4bfcba)[_0xfde0('0xc')](function(_0x318d21){if(_0x318d21[_0xfde0('0xd')][_0xfde0('0x1c')]>0x0){var _0x4a3e1e=_0x318d21[_0xfde0('0xd')][0x0][_0xfde0('0xf')];_0x4366b5(_0x4a3e1e);}else{return createRemoteTag(_0x2da49a,_0x39f056,_0x367a2c,_0x4c2353)['then'](function(_0x416f06){_0x4366b5(_0x416f06);});}});});}function assignTagToIncident(_0x5f439e,_0x52e38e,_0x3656b4,_0x27569c,_0x56e748){return new Promise(function(_0x45c5e7,_0x360c3c){var _0x17abda={'method':_0xfde0('0x23'),'uri':_0x3656b4+'label_entry'+'?'+_0x56e748,'body':{'label':_0x5f439e,'table':_0xfde0('0x3d'),'id_type':_0xfde0('0x4a'),'table_key':_0x27569c['ticketId'],'title':_0xfde0('0x4b')+_0x27569c[_0xfde0('0x45')],'id_display':_0x27569c[_0xfde0('0x45')]},'auth':_0x52e38e,'json':!![]};return rp(_0x17abda)[_0xfde0('0xc')](function(_0x34c912){_0x45c5e7();})[_0xfde0('0x13')](function(){_0x45c5e7();});});}function manageTags(_0x35c359,_0x2c4008,_0x535cad,_0x52afbe,_0x2f4508,_0x5b9ee3,_0x15e607){return new Promise(function(_0x556c90,_0x2ab3c7){var _0x4c769b=[];_0x2c4008[_0xfde0('0x2c')](function(_0x16b5d1){_0x4c769b[_0xfde0('0x4c')](getRemoteTag(_0x16b5d1,_0x535cad,_0x52afbe,_0x5b9ee3,_0x15e607));});return Promise['all'](_0x4c769b)[_0xfde0('0xc')](function(_0x585264){if(_0x585264[_0xfde0('0x1c')]){logger[_0xfde0('0x10')]('['+[_0x35c359[_0xfde0('0x11')]()]+_0xfde0('0x4d'),_0x585264);var _0x3477ee=[];_0x585264[_0xfde0('0x2c')](function(_0x11d7e9){_0x3477ee[_0xfde0('0x4c')](assignTagToIncident(_0x11d7e9,_0x535cad,_0x52afbe,_0x2f4508,_0x5b9ee3));});return Promise[_0xfde0('0x4e')](_0x3477ee)[_0xfde0('0xc')](function(){_0x556c90();})[_0xfde0('0x13')](function(){_0x556c90();});}else{_0x556c90();}});});}function getTags(_0x4f73ef,_0x1a8ee3,_0x23c54f,_0x4a8cd6,_0x304448,_0x4265c5){return function(_0x2e3ed4){return new Promise(function(_0x1a48fc,_0x23205e){var _0x1e235c=[];var _0x29e1b8=_0x4a8cd6[_0xfde0('0x4f')];if(_0x29e1b8&&_0x29e1b8[_0xfde0('0x1c')]>0x0){_0x1e235c=_[_0xfde0('0x50')](_0x29e1b8,_0xfde0('0x3a'));}if(_0x1e235c['length']>0x0){return manageTags(_0x4f73ef,_0x1e235c,_0x1a8ee3,_0x23c54f,_0x2e3ed4,_0x304448,_0x4265c5)['then'](function(){_0x1a48fc(_0x2e3ed4);});}else{_0x1a48fc(_0x2e3ed4);}});};}function emit(_0x2d6fe5,_0x56faac,_0x4725df){var _0x303f96=_0xfde0('0x51')+_0xfde0('0x52')+'%26sysparm_record_list%3Dactive%253Dtrue'+_0xfde0('0x53');var _0x3270c9={'uri':_0x2d6fe5+_0xfde0('0x54')+_0x4725df+_0x303f96};io['to'](util[_0xfde0('0x55')]('user:%s',_0x56faac))['emit'](_0xfde0('0x56'),_0x3270c9);}exports['cs']=function(_0x2b770e,_0x21f638,_0x235462,_0x3eae11,_0x2821e6,_0x52f6f9,_0x508477,_0x35d59a){var _0x531882={};var _0x18215e={'user':_0x52f6f9[_0xfde0('0x57')],'pass':_0x52f6f9[_0xfde0('0x58')]};var _0x5189fd=_0xfde0('0x59');var _0x3c93b2='sysparm_display_value=true';_0x52f6f9['remoteUri']=intUtil[_0xfde0('0x5a')](_0x52f6f9[_0xfde0('0x5b')]);_0x52f6f9[_0xfde0('0x5c')]=intUtil[_0xfde0('0x5a')](_0x52f6f9[_0xfde0('0x5c')]);var _0x50e9f4=util[_0xfde0('0x55')]('%s/api/now/table/',_0x52f6f9[_0xfde0('0x5b')]);_0x531882['userEmail']=!_[_0xfde0('0x5d')](_0x3eae11)?_0x3eae11['email']:null;_0x531882[_0xfde0('0x21')]=_0x52f6f9[_0xfde0('0x5e')];_0x531882[_0xfde0('0x25')]=_0x35d59a[_0xfde0('0x35')]()===_0xfde0('0x3c')?_0x21f638[_0xfde0('0x5f')]:_0x21f638[_0xfde0('0x60')];_0x531882['callDirection']=_0x35d59a==='queue'||_0x35d59a===_0xfde0('0x61')?_0xfde0('0x62'):_0xfde0('0x3c');var _0x779eac=util['format'](_0xfde0('0x63'),_0x52f6f9[_0xfde0('0x5c')],_0x21f638[_0xfde0('0x64')],md5(_0x21f638[_0xfde0('0x64')]));if(_0x2821e6&&_0x2821e6[_0xfde0('0x65')]){logger[_0xfde0('0x10')]('[QUEUE]','Recording\x20is\x20enabled!');_0x21f638['recordingURL']=_0x779eac;}else if(_0x508477&&_0x508477[_0xfde0('0x66')]&&_0x508477[_0xfde0('0x66')]!==_0xfde0('0x67')){logger[_0xfde0('0x10')](_0xfde0('0x68'),_0xfde0('0x69'));_0x21f638[_0xfde0('0x6a')]=_0x779eac;}else{_0x21f638[_0xfde0('0x6a')]='';}return getAdminUser(_0x35d59a,_0x18215e,_0x531882,_0x50e9f4,_0x3c93b2,_0x5189fd)[_0xfde0('0xc')](getUser(_0x35d59a,_0x18215e,_0x50e9f4,_0x3c93b2,_0x5189fd))['then'](getEndUser(_0x35d59a,_0x18215e,_0x50e9f4,_0x3c93b2,_0x5189fd))[_0xfde0('0xc')](getTicket(_0x35d59a,_0x18215e,_0x50e9f4,_0x235462,_0x21f638,_0x3c93b2))[_0xfde0('0xc')](function(_0x2b6dcb){logger[_0xfde0('0x10')](util[_0xfde0('0x55')](_0xfde0('0x6b'),_0x2b6dcb[_0xfde0('0x44')]));logger[_0xfde0('0x10')](util[_0xfde0('0x55')](_0xfde0('0x6c'),_0x35d59a));if(_0x35d59a!==_0xfde0('0x61')){logger[_0xfde0('0x10')]('['+[_0x35d59a[_0xfde0('0x11')]()]+']',_0xfde0('0x6d'));emit(_0x52f6f9['remoteUri'],_0x3eae11['name'],_0x2b6dcb[_0xfde0('0x44')]);}})['catch'](function(_0x58cba7){logger[_0xfde0('0x14')]('['+[_0x35d59a[_0xfde0('0x11')]()]+_0xfde0('0x6e'),util[_0xfde0('0x6f')](_0x58cba7,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xafed=['],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','picklist','type','nameField','customField','toString','idField','toLowerCase','content','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','incident','assign','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number','label','?sysparm_query=name%3D','Incident','Incident\x20-\x20','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','username','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','email','destcalleridnum','calleridnum','callDirection','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL','call\x20direction:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','util','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','localhost','socket.io-emitter','GET','then','result','length','sys_id','info','toUpperCase','catch','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','active','true','userId','adminId','adminEmail','],\x20getUser\x20crm','error',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','sys_user?','user','endUserNumber','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D'];(function(_0x16b973,_0x38d209){var _0x3b408a=function(_0x4ea2ad){while(--_0x4ea2ad){_0x16b973['push'](_0x16b973['shift']());}};_0x3b408a(++_0x38d209);}(_0xafed,0x1a0));var _0xdafe=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xafed[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xdafe('0x0'));var Promise=require('bluebird');var rp=require('request-promise');var util=require(_0xdafe('0x1'));var md5=require(_0xdafe('0x2'));var Redis=require(_0xdafe('0x3'));var intUtil=require(_0xdafe('0x4'));var config=require(_0xdafe('0x5'));var logger=require(_0xdafe('0x6'))(_0xdafe('0x7'));config[_0xdafe('0x8')]=_['defaults'](config[_0xdafe('0x8')],{'host':_0xdafe('0x9'),'port':0x18eb});var io=require(_0xdafe('0xa'))(new Redis(config['redis']));function getAdminUser(_0x77401a,_0x2e1804,_0x12bd52,_0x405418,_0x4d7eb1,_0xac10ff){return new Promise(function(_0x3b9b27,_0x230976){var _0x181fb3={'method':_0xdafe('0xb'),'uri':_0x405418+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x4d7eb1+'&'+_0xac10ff,'auth':_0x2e1804,'json':!![]};return rp(_0x181fb3)[_0xdafe('0xc')](function(_0x12fa9d){if(_0x12fa9d[_0xdafe('0xd')][_0xdafe('0xe')]>0x0){_0x12bd52['adminId']=_0x12fa9d[_0xdafe('0xd')][0x0][_0xdafe('0xf')];}logger[_0xdafe('0x10')]('['+[_0x77401a[_0xdafe('0x11')]()]+'],\x20getAdminUser\x20crm',_0x12bd52);_0x3b9b27(_0x12bd52);})[_0xdafe('0x12')](function(_0x33fa81){logger['error']('['+[_0x77401a[_0xdafe('0x11')]()]+']',_0x33fa81[_0xdafe('0x13')]);_0x230976(_0x33fa81[_0xdafe('0x13')]);});});}function getUser(_0x2dd68c,_0x59bf28,_0x2cfb26,_0x46ad01,_0x4cc48c){return function(_0x2b018e){logger[_0xdafe('0x10')]('['+[_0x2dd68c['toUpperCase']()]+_0xdafe('0x14'),_0x2b018e);return new Promise(function(_0x1c715d,_0x30d15c){if(intUtil[_0xdafe('0x15')](_0x2b018e[_0xdafe('0x16')])){var _0x5cd304={'method':'GET','uri':_0x2cfb26+_0xdafe('0x17')+_0x2b018e[_0xdafe('0x16')]+'&'+_0x46ad01+'&'+_0x4cc48c,'auth':_0x59bf28,'json':!![]};logger[_0xdafe('0x10')]('['+[_0x2dd68c['toUpperCase']()]+_0xdafe('0x18'),_0x5cd304);return rp(_0x5cd304)[_0xdafe('0xc')](function(_0x5088b8){logger[_0xdafe('0x10')]('['+[_0x2dd68c['toUpperCase']()]+_0xdafe('0x19'),_0x5088b8);if(_0x5088b8[_0xdafe('0xd')]['length']>0x0&&String(_0x5088b8[_0xdafe('0xd')][0x0][_0xdafe('0x1a')])===_0xdafe('0x1b')){_0x2b018e['userId']=_0x5088b8[_0xdafe('0xd')][0x0][_0xdafe('0xf')];}else{_0x2b018e[_0xdafe('0x1c')]=_0x2b018e[_0xdafe('0x1d')];_0x2b018e['userEmail']=_0x2b018e[_0xdafe('0x1e')];}logger['info']('['+[_0x2dd68c[_0xdafe('0x11')]()]+_0xdafe('0x1f'),_0x2b018e);_0x1c715d(_0x2b018e);})[_0xdafe('0x12')](function(_0x4f2456){logger[_0xdafe('0x20')]('['+[_0x2dd68c[_0xdafe('0x11')]()]+']',_0x4f2456[_0xdafe('0x13')]);_0x30d15c(_0x4f2456['message']);});}else{logger[_0xdafe('0x10')]('['+[_0x2dd68c[_0xdafe('0x11')]()]+_0xdafe('0x21'));_0x2b018e['userId']=_0x2b018e['adminId'];_0x2b018e[_0xdafe('0x16')]=_0x2b018e[_0xdafe('0x1e')];_0x1c715d(_0x2b018e);}});};}function createEndUser(_0x5b39b7,_0xad5547,_0x2aa545,_0x2a427b,_0x1bc865){logger['info']('['+[_0x5b39b7[_0xdafe('0x11')]()]+_0xdafe('0x22'),_0x2aa545);return new Promise(function(_0x4f1ede,_0x1f4688){var _0x5cbdc2={'method':_0xdafe('0x23'),'uri':_0x2a427b+_0xdafe('0x24')+_0x1bc865,'body':{'user_name':_0x2aa545['endUserNumber'],'roles':_0xdafe('0x25'),'first_name':_0x2aa545[_0xdafe('0x26')],'active':_0xdafe('0x1b'),'date_format':_0xdafe('0x27'),'phone':_0x2aa545[_0xdafe('0x26')]},'auth':_0xad5547,'json':!![]};return rp(_0x5cbdc2)[_0xdafe('0xc')](function(_0x7108fa){logger[_0xdafe('0x10')]('['+[_0x5b39b7[_0xdafe('0x11')]()]+_0xdafe('0x28'),_0x7108fa[_0xdafe('0xd')]);_0x2aa545[_0xdafe('0x29')]=_0x7108fa[_0xdafe('0xd')][_0xdafe('0xf')];_0x4f1ede(_0x2aa545);})['catch'](function(_0x5e4f52){logger[_0xdafe('0x20')]('['+[_0x5b39b7[_0xdafe('0x11')]()]+']',_0x5e4f52[_0xdafe('0x13')]);_0x1f4688(_0x5e4f52['message']);});});}function getEndUser(_0x1ab200,_0xea7418,_0x285227,_0x480c2a,_0x2d6f04){return function(_0x5e2800){logger['info']('['+[_0x1ab200[_0xdafe('0x11')]()]+_0xdafe('0x2a'),_0x5e2800);return new Promise(function(_0x10f3e8,_0xcae1d0){var _0xfa28eb={'method':_0xdafe('0xb'),'uri':_0x285227+_0xdafe('0x2b')+_0x5e2800['endUserNumber']+'&'+_0x480c2a+'&'+_0x2d6f04,'auth':_0xea7418,'json':!![]};return rp(_0xfa28eb)[_0xdafe('0xc')](function(_0x441c6d){if(_0x441c6d[_0xdafe('0xd')]['length']>0x0){_0x5e2800['endUserId']=_0x441c6d['result'][0x0][_0xdafe('0xf')];logger['info']('['+[_0x1ab200['toUpperCase']()]+_0xdafe('0x2c'),_0x5e2800);_0x10f3e8(_0x5e2800);}else{return createEndUser(_0x1ab200,_0xea7418,_0x5e2800,_0x285227,_0x480c2a)[_0xdafe('0xc')](function(_0x2c6703){logger['info']('['+[_0x1ab200['toUpperCase']()]+_0xdafe('0x2d'),_0x2c6703);_0x10f3e8(_0x2c6703);});}})[_0xdafe('0x12')](function(_0x4c1fdf){logger[_0xdafe('0x20')]('['+[_0x1ab200[_0xdafe('0x11')]()]+']',_0x4c1fdf[_0xdafe('0x13')]);_0xcae1d0(_0x4c1fdf[_0xdafe('0x13')]);});});};}function getCustomFields(_0x4e2647,_0x6a7cc5){var _0x10c707={};if(_0x4e2647[_0xdafe('0xe')]>0x0){_[_0xdafe('0x2e')](_0x4e2647,function(_0x5435b7){if(_[_0xdafe('0x2f')](['string',_0xdafe('0x30')],_0x5435b7[_0xdafe('0x31')])&&_0x5435b7[_0xdafe('0x32')]&&!_0x5435b7[_0xdafe('0x33')]){_0x10c707[_0x5435b7['nameField']['toLowerCase']()]=_0x5435b7['content'][_0xdafe('0x34')]();}else if(_[_0xdafe('0x2f')](['string','picklist'],_0x5435b7[_0xdafe('0x31')])&&_0x5435b7[_0xdafe('0x35')]&&_0x5435b7[_0xdafe('0x33')]){_0x10c707[_0x5435b7[_0xdafe('0x35')][_0xdafe('0x36')]()]=_0x5435b7[_0xdafe('0x37')][_0xdafe('0x34')]();}else if(_0x5435b7['type']===_0xdafe('0x38')&&_0x5435b7[_0xdafe('0x39')]&&_0x5435b7[_0xdafe('0x35')]&&_0x5435b7[_0xdafe('0x33')]){_0x10c707[_0x5435b7[_0xdafe('0x35')][_0xdafe('0x36')]()]=_0x6a7cc5[_0x5435b7[_0xdafe('0x39')]][_0xdafe('0x34')]();}else if(_0x5435b7[_0xdafe('0x31')]===_0xdafe('0x3a')&&_0x5435b7[_0xdafe('0x3b')]&&_0x5435b7['Variable']['name']&&_0x5435b7[_0xdafe('0x35')]&&_0x5435b7[_0xdafe('0x33')]){_0x10c707[_0x5435b7[_0xdafe('0x35')][_0xdafe('0x36')]()]=_0x6a7cc5[_0x5435b7[_0xdafe('0x3b')][_0xdafe('0x3c')]['toLowerCase']()][_0xdafe('0x34')]();}});}return _0x10c707;}function getTicket(_0x5e0bab,_0x24a7f7,_0x30a932,_0x49773c,_0x5a8710,_0x549c67){return function(_0x5382f5){logger['info']('['+[_0x5e0bab[_0xdafe('0x11')]()]+_0xdafe('0x3d'),_0x5382f5);return new Promise(function(_0xe765e,_0x1318fd){var _0x2d499d=_0x5e0bab[_0xdafe('0x36')]()==='outbound'?_0x5382f5[_0xdafe('0x1c')]:_0x5382f5[_0xdafe('0x29')];var _0x36613d={'method':'POST','uri':_0x30a932+_0xdafe('0x3e')+'?'+_0x549c67,'body':Object[_0xdafe('0x3f')]({},{'active':_0xdafe('0x1b'),'caller_id':_0x2d499d,'assigned_to':_0x5382f5[_0xdafe('0x1c')],'short_description':intUtil[_0xdafe('0x40')](_0x49773c[_0xdafe('0x41')],_0x5a8710,'\x20'),'description':intUtil['getString'](_0x49773c[_0xdafe('0x42')],_0x5a8710,'\x0a')},getCustomFields(_0x49773c[_0xdafe('0x43')],_0x5a8710)),'auth':_0x24a7f7,'json':!![]};return rp(_0x36613d)['then'](function(_0x474b7d){logger[_0xdafe('0x10')]('['+[_0x5e0bab[_0xdafe('0x11')]()]+_0xdafe('0x44'),_0x474b7d[_0xdafe('0xd')]);_0x5382f5[_0xdafe('0x45')]=_0x474b7d[_0xdafe('0xd')][_0xdafe('0xf')];_0x5382f5[_0xdafe('0x46')]=_0x474b7d['result'][_0xdafe('0x47')];logger['info']('['+[_0x5e0bab[_0xdafe('0x11')]()]+']\x20getTicket\x20crm',_0x5382f5);_0xe765e(_0x5382f5);})[_0xdafe('0x12')](function(_0x4a7338){logger[_0xdafe('0x20')]('['+[_0x5e0bab[_0xdafe('0x11')]()]+']',_0x4a7338[_0xdafe('0x13')]);_0x1318fd(_0x4a7338[_0xdafe('0x13')]);});});};}function createRemoteTag(_0x100439,_0x1acd77,_0x2ffad9,_0x2450f5){return new Promise(function(_0xa0ea13,_0x5a73b3){var _0x22f935={'method':_0xdafe('0x23'),'uri':_0x2ffad9+_0xdafe('0x48')+'?'+_0x2450f5,'body':{'short_description':_0x100439,'global':!![],'active':!![],'name':_0x100439},'auth':_0x1acd77,'json':!![]};return rp(_0x22f935)[_0xdafe('0xc')](function(_0x590f93){var _0x4b17f7=_0x590f93[_0xdafe('0xd')]['sys_id'];_0xa0ea13(_0x4b17f7);});});}function getRemoteTag(_0x15fdaf,_0x4eec16,_0x25944e,_0x3636eb,_0x23bf0e){return new Promise(function(_0xa92393,_0x4fa66c){var _0x118ecf={'method':_0xdafe('0xb'),'uri':_0x25944e+_0xdafe('0x48')+_0xdafe('0x49')+_0x15fdaf+'&'+_0x3636eb,'auth':_0x4eec16,'json':!![]};return rp(_0x118ecf)[_0xdafe('0xc')](function(_0x2004a3){if(_0x2004a3[_0xdafe('0xd')][_0xdafe('0xe')]>0x0){var _0x57ead1=_0x2004a3[_0xdafe('0xd')][0x0][_0xdafe('0xf')];_0xa92393(_0x57ead1);}else{return createRemoteTag(_0x15fdaf,_0x4eec16,_0x25944e,_0x3636eb)['then'](function(_0x47241d){_0xa92393(_0x47241d);});}});});}function assignTagToIncident(_0x558bec,_0x38831c,_0x5a195f,_0x18aed6,_0xa95ab5){return new Promise(function(_0x4a4230,_0x254f9c){var _0x4aec2e={'method':_0xdafe('0x23'),'uri':_0x5a195f+'label_entry'+'?'+_0xa95ab5,'body':{'label':_0x558bec,'table':'incident','id_type':_0xdafe('0x4a'),'table_key':_0x18aed6[_0xdafe('0x45')],'title':_0xdafe('0x4b')+_0x18aed6[_0xdafe('0x46')],'id_display':_0x18aed6[_0xdafe('0x46')]},'auth':_0x38831c,'json':!![]};return rp(_0x4aec2e)[_0xdafe('0xc')](function(_0x51ae46){_0x4a4230();})[_0xdafe('0x12')](function(){_0x4a4230();});});}function manageTags(_0x269cea,_0x1cc872,_0x1d1d82,_0x39ed2b,_0x5240a1,_0x5f35da,_0x5c325e){return new Promise(function(_0x2f4765,_0x448ecb){var _0x188573=[];_0x1cc872['forEach'](function(_0x1b0384){_0x188573[_0xdafe('0x4c')](getRemoteTag(_0x1b0384,_0x1d1d82,_0x39ed2b,_0x5f35da,_0x5c325e));});return Promise[_0xdafe('0x4d')](_0x188573)[_0xdafe('0xc')](function(_0xc0e74e){if(_0xc0e74e[_0xdafe('0xe')]){logger[_0xdafe('0x10')]('['+[_0x269cea[_0xdafe('0x11')]()]+_0xdafe('0x4e'),_0xc0e74e);var _0x53af8a=[];_0xc0e74e[_0xdafe('0x2e')](function(_0x246d5c){_0x53af8a[_0xdafe('0x4c')](assignTagToIncident(_0x246d5c,_0x1d1d82,_0x39ed2b,_0x5240a1,_0x5f35da));});return Promise['all'](_0x53af8a)[_0xdafe('0xc')](function(){_0x2f4765();})[_0xdafe('0x12')](function(){_0x2f4765();});}else{_0x2f4765();}});});}function getTags(_0x1369bf,_0x5b45df,_0x4cb8cd,_0xf4dbe8,_0x2901cb,_0x49d810){return function(_0x1cbeb3){return new Promise(function(_0x1c3f65,_0x8c7c97){var _0x5686fc=[];var _0x26fca6=_0xf4dbe8[_0xdafe('0x4f')];if(_0x26fca6&&_0x26fca6['length']>0x0){_0x5686fc=_['map'](_0x26fca6,_0xdafe('0x3c'));}if(_0x5686fc[_0xdafe('0xe')]>0x0){return manageTags(_0x1369bf,_0x5686fc,_0x5b45df,_0x4cb8cd,_0x1cbeb3,_0x2901cb,_0x49d810)[_0xdafe('0xc')](function(){_0x1c3f65(_0x1cbeb3);});}else{_0x1c3f65(_0x1cbeb3);}});};}function emit(_0x3debb1,_0x196244,_0xf471b5){var _0x34eb37='%26sysparm_record_target%3Dincident'+_0xdafe('0x50')+_0xdafe('0x51')+_0xdafe('0x52');var _0x1a9faa={'uri':_0x3debb1+_0xdafe('0x53')+_0xf471b5+_0x34eb37};io['to'](util[_0xdafe('0x54')](_0xdafe('0x55'),_0x196244))[_0xdafe('0x56')](_0xdafe('0x57'),_0x1a9faa);}exports['cs']=function(_0x3a1e32,_0x30e991,_0x4e7fb0,_0x226a9f,_0x4c5afe,_0x17a3a4,_0x28e989,_0x528f1c){var _0x251fa5={};var _0x3c88d3={'user':_0x17a3a4[_0xdafe('0x58')],'pass':_0x17a3a4[_0xdafe('0x59')]};var _0x4c7151=_0xdafe('0x5a');var _0x197cd1=_0xdafe('0x5b');_0x17a3a4[_0xdafe('0x5c')]=intUtil[_0xdafe('0x5d')](_0x17a3a4[_0xdafe('0x5c')]);_0x17a3a4[_0xdafe('0x5e')]=intUtil[_0xdafe('0x5d')](_0x17a3a4[_0xdafe('0x5e')]);var _0xe6285b=util[_0xdafe('0x54')](_0xdafe('0x5f'),_0x17a3a4[_0xdafe('0x5c')]);_0x251fa5[_0xdafe('0x16')]=!_['isNil'](_0x226a9f)?_0x226a9f[_0xdafe('0x60')]:null;_0x251fa5[_0xdafe('0x1e')]=_0x17a3a4[_0xdafe('0x60')];_0x251fa5[_0xdafe('0x26')]=_0x528f1c['toLowerCase']()==='outbound'?_0x30e991[_0xdafe('0x61')]:_0x30e991[_0xdafe('0x62')];_0x251fa5[_0xdafe('0x63')]=_0x528f1c===_0xdafe('0x64')||_0x528f1c==='unmanaged'?'queue':'outbound';var _0x43ac74=util[_0xdafe('0x54')](_0xdafe('0x65'),_0x17a3a4['serverUrl'],_0x30e991[_0xdafe('0x66')],md5(_0x30e991[_0xdafe('0x66')]));if(_0x4c5afe&&_0x4c5afe[_0xdafe('0x67')]){logger[_0xdafe('0x10')](_0xdafe('0x68'),_0xdafe('0x69'));_0x30e991['recordingURL']=_0x43ac74;}else if(_0x28e989&&_0x28e989[_0xdafe('0x6a')]&&_0x28e989[_0xdafe('0x6a')]!==_0xdafe('0x6b')){logger[_0xdafe('0x10')](_0xdafe('0x6c'),_0xdafe('0x69'));_0x30e991[_0xdafe('0x6d')]=_0x43ac74;}else{_0x30e991[_0xdafe('0x6d')]='';}return getAdminUser(_0x528f1c,_0x3c88d3,_0x251fa5,_0xe6285b,_0x197cd1,_0x4c7151)['then'](getUser(_0x528f1c,_0x3c88d3,_0xe6285b,_0x197cd1,_0x4c7151))[_0xdafe('0xc')](getEndUser(_0x528f1c,_0x3c88d3,_0xe6285b,_0x197cd1,_0x4c7151))[_0xdafe('0xc')](getTicket(_0x528f1c,_0x3c88d3,_0xe6285b,_0x4e7fb0,_0x30e991,_0x197cd1))[_0xdafe('0xc')](function(_0x32f181){logger[_0xdafe('0x10')](util['format']('The\x20ticket\x20ID\x20is:\x20%s',_0x32f181[_0xdafe('0x45')]));logger[_0xdafe('0x10')](util['format'](_0xdafe('0x6e'),_0x528f1c));if(_0x528f1c!==_0xdafe('0x6f')){logger[_0xdafe('0x10')]('['+[_0x528f1c[_0xdafe('0x11')]()]+']',_0xdafe('0x70'));emit(_0x17a3a4[_0xdafe('0x5c')],_0x226a9f[_0xdafe('0x3c')],_0x32f181['ticketId']);}})['catch'](function(_0x311258){logger[_0xdafe('0x20')]('['+[_0x528f1c['toUpperCase']()]+_0xdafe('0x71'),util[_0xdafe('0x72')](_0x311258,{'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 c74c5c0..5b54838 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 _0xb56e=['resolve','name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','then','Contacts','first_name','Enduser\x20created.','[HTTP]','merge','map','string','nameField','customField','type','idField','custom_fields','content','customVariable','Variable','toLowerCase','POST','login','password','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','Calls','queue','remoteUri','stripTrailingSlash','serverUrl','uri','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','contacts','version','charAt','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','error','outbound','%s/service/v4_1/rest.php','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','Outbound','users','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','trigger:browser:url','catch','monitor_format','lastevent','toUpperCase','calleridnum','lodash','request-promise','bluebird','md5','ioredis','./util','../../../../config/environment','sugarcrm','redis','localhost','info','Creating\x20new\x20ticket...','getString','assigned_user_id','created_by','description','Descriptions','date_start','toISOString','slice','duration_minutes','parent_id','parent_type','length','forEach','variableName','push','set_entry','JSON','stringify','format','Basic\x20%s','apiKey','toString','base64','isNil','Getting\x20agent\x20with\x20name','get_entry_list','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','find','entry_list','name_value_list','user_name','value','Agent\x20found!'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xb56e,0xb9));var _0xeb56=function(_0x3b5971,_0x2bc3c9){_0x3b5971=_0x3b5971-0x0;var _0x3d3deb=_0xb56e[_0x3b5971];return _0x3d3deb;};'use strict';var _=require(_0xeb56('0x0'));var rp=require(_0xeb56('0x1'));var BPromise=require(_0xeb56('0x2'));var md5=require(_0xeb56('0x3'));var util=require('util');var Redis=require(_0xeb56('0x4'));var intUtil=require(_0xeb56('0x5'));var config=require(_0xeb56('0x6'));var logger=require('../../../../config/logger')(_0xeb56('0x7'));config[_0xeb56('0x8')]=_['defaults'](config['redis'],{'host':_0xeb56('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xeb56('0x8')]));var def={'method':'POST','json':!![]};function emit(_0x5ac440,_0x431422,_0x1787a4){io['to'](_0x5ac440)['emit'](_0x431422,_0x1787a4);}function getTicket(_0x53b633,_0xe4d988,_0x8bb47,_0x14eecb,_0x2aabcd,_0x379062,_0x50992c,_0x5d4acf){logger[_0xeb56('0xa')](_0xeb56('0xb'));var _0x11d5e8=new Date();var _0x14385f=[{'name':'name','value':intUtil[_0xeb56('0xc')](_0x14eecb['Subjects'],_0x2aabcd,'\x20')},{'name':_0xeb56('0xd'),'value':_0xe4d988['id']},{'name':_0xeb56('0xe'),'value':_0xe4d988['id']},{'name':_0xeb56('0xf'),'value':intUtil['getString'](_0x14eecb[_0xeb56('0x10')],_0x2aabcd,'\x0a')},{'name':_0xeb56('0x11'),'value':_0x11d5e8[_0xeb56('0x12')]()[_0xeb56('0x13')](0x0,0x13)['replace']('T','\x20')},{'name':'duration_hours','value':'0'},{'name':_0xeb56('0x14'),'value':'15'},{'name':_0xeb56('0x15'),'value':_0x8bb47['id']},{'name':_0xeb56('0x16'),'value':'Contacts'},{'name':'parent_name','value':_0x8bb47['name']},{'name':'direction','value':_0x5d4acf}];if(_0x379062[_0xeb56('0x17')]){_[_0xeb56('0x18')](_0x379062,function(_0x32b563){if(_0x2aabcd[_0x32b563[_0xeb56('0x19')]]){_0x14385f[_0xeb56('0x1a')]({'name':_0x32b563['idField'],'value':_0x2aabcd[_0x32b563[_0xeb56('0x19')]]});}});}return request({'form':{'method':_0xeb56('0x1b'),'input_type':_0xeb56('0x1c'),'response_type':_0xeb56('0x1c'),'rest_data':JSON[_0xeb56('0x1d')]({'session':_0x50992c['id'],'module_name':'Calls','name_value_list':_0x14385f})}});}function getAuth(_0x3f46c0){return util[_0xeb56('0x1e')](_0xeb56('0x1f'),new Buffer(_0x3f46c0[_0xeb56('0x20')]+':X')[_0xeb56('0x21')](_0xeb56('0x22')));}function getServerInfo(_0x332885){return request({'form':{'method':'get_server_info','input_type':_0xeb56('0x1c'),'response_type':_0xeb56('0x1c'),'rest_data':JSON[_0xeb56('0x1d')]({'session':_0x332885['id']})}});}function getUser(_0x53b7b4,_0x87d536,_0x583e85){if(!_[_0xeb56('0x23')](_0x87d536)){logger['info'](_0xeb56('0x24'),_0x87d536);return request({'form':{'method':_0xeb56('0x25'),'input_type':_0xeb56('0x1c'),'response_type':'JSON','rest_data':JSON[_0xeb56('0x1d')]({'session':_0x583e85['id'],'module_name':'Employees','query':util[_0xeb56('0x1e')](_0xeb56('0x26'),_0x87d536),'order_by':'','offset':'0','select_fields':['id','name','user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x13e921){if(_0x13e921['entry_list'][_0xeb56('0x17')]){var _0x443746=_[_0xeb56('0x27')](_0x13e921[_0xeb56('0x28')],function(_0x19b172){return _0x19b172[_0xeb56('0x29')][_0xeb56('0x2a')][_0xeb56('0x2b')]===_0x87d536;});if(_0x443746){logger[_0xeb56('0xa')](_0xeb56('0x2c'));return BPromise[_0xeb56('0x2d')]({'id':_0x443746['name_value_list']['id'][_0xeb56('0x2b')],'name':_0x443746[_0xeb56('0x29')][_0xeb56('0x2e')]['value']});}}logger[_0xeb56('0xa')](_0xeb56('0x2f'));return BPromise[_0xeb56('0x2d')]({'id':_0x583e85[_0xeb56('0x29')][_0xeb56('0x30')][_0xeb56('0x2b')],'name':_0x583e85[_0xeb56('0x29')][_0xeb56('0x2a')][_0xeb56('0x2b')]});});}else{logger[_0xeb56('0xa')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0xeb56('0x2d')]({'id':_0x583e85[_0xeb56('0x29')]['user_id'][_0xeb56('0x2b')],'name':_0x583e85['name_value_list'][_0xeb56('0x2a')][_0xeb56('0x2b')]});}}function getEndUser(_0x248a59,_0x3fe3eb,_0x214530,_0x1e00f2){logger[_0xeb56('0xa')](_0xeb56('0x31'),_0x214530);return request({'form':{'method':_0xeb56('0x25'),'input_type':_0xeb56('0x1c'),'response_type':_0xeb56('0x1c'),'rest_data':JSON[_0xeb56('0x1d')]({'session':_0x1e00f2['id'],'module_name':'Contacts','query':util[_0xeb56('0x1e')](_0xeb56('0x32'),_0x214530),'order_by':'','offset':'0','select_fields':['id',_0xeb56('0x2e'),_0xeb56('0x33')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xeb56('0x34')](function(_0x2cb8da){if(_0x2cb8da[_0xeb56('0x28')][_0xeb56('0x17')]){var _0x30c890=_[_0xeb56('0x27')](_0x2cb8da[_0xeb56('0x28')],function(_0x17ae32){return _0x17ae32[_0xeb56('0x29')][_0xeb56('0x33')]['value']===_0x214530;});if(_0x30c890){logger[_0xeb56('0xa')]('Enduser\x20found!');return BPromise[_0xeb56('0x2d')]({'id':_0x30c890[_0xeb56('0x29')]['id']['value'],'name':_0x30c890['name_value_list'][_0xeb56('0x2e')][_0xeb56('0x2b')],'phone':_0x30c890[_0xeb56('0x29')][_0xeb56('0x33')][_0xeb56('0x2b')]});}}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0xeb56('0x1b'),'input_type':_0xeb56('0x1c'),'response_type':_0xeb56('0x1c'),'rest_data':JSON[_0xeb56('0x1d')]({'session':_0x1e00f2['id'],'module_name':_0xeb56('0x35'),'name_value_list':[{'name':_0xeb56('0x36'),'value':_0x3fe3eb!==''?_0x3fe3eb:util['format']('Caller\x20-\x20%s',_0x214530)},{'name':_0xeb56('0x33'),'value':_0x214530}]})}})['then'](function(_0xf2df8e){logger[_0xeb56('0xa')](_0xeb56('0x37'));return BPromise['resolve']({'id':_0xf2df8e['id'],'name':_0xf2df8e[_0xeb56('0x28')][_0xeb56('0x36')]['value'],'phone':_0xf2df8e[_0xeb56('0x28')]['phone_home'][_0xeb56('0x2b')]});});}});}function request(_0x222044){logger['debug'](_0xeb56('0x38'),JSON['stringify'](_0x222044));return rp(_[_0xeb56('0x39')](def,_0x222044));}function getTags(_0x3a7f85,_0x41212c){var _0x5a148a=[];if(_0x3a7f85&&_0x3a7f85[_0xeb56('0x17')]>0x0){_0x5a148a=_[_0xeb56('0x3a')](_0x3a7f85,_0x41212c);}return _0x5a148a;}function getCustomFields(_0xe092a2,_0x155879){var _0x54eed4=[];var _0x140069={'custom_fields':[]};if(_0xe092a2[_0xeb56('0x17')]>0x0){_[_0xeb56('0x18')](_0xe092a2,function(_0x481b67){if(_0x481b67['type']===_0xeb56('0x3b')&&_0x481b67[_0xeb56('0x3c')]&&!_0x481b67[_0xeb56('0x3d')]){_0x140069[_0x481b67[_0xeb56('0x3c')]['toLowerCase']()]=_0x481b67['content'][_0xeb56('0x21')]();}else if(_0x481b67[_0xeb56('0x3e')]==='string'&&_0x481b67[_0xeb56('0x3f')]&&_0x481b67[_0xeb56('0x3d')]){_0x140069[_0xeb56('0x40')][_0xeb56('0x1a')]({'id':_0x481b67[_0xeb56('0x3f')],'value':_0x481b67[_0xeb56('0x41')][_0xeb56('0x21')]()});}else if(_0x481b67[_0xeb56('0x3e')]==='variable'&&_0x481b67[_0xeb56('0x19')]&&_0x481b67[_0xeb56('0x3f')]&&_0x481b67[_0xeb56('0x3d')]){_0x155879[_0x481b67[_0xeb56('0x19')]]&&_0x140069[_0xeb56('0x40')][_0xeb56('0x1a')]({'id':_0x481b67[_0xeb56('0x3f')],'value':_0x155879[_0x481b67['variableName']]['toString']()});}else if(_0x481b67[_0xeb56('0x3e')]===_0xeb56('0x42')&&_0x481b67[_0xeb56('0x43')]&&_0x481b67[_0xeb56('0x43')][_0xeb56('0x2e')]&&_0x481b67['idField']&&_0x481b67[_0xeb56('0x3d')]){_0x155879[_0x481b67['Variable'][_0xeb56('0x2e')][_0xeb56('0x44')]()]&&_0x140069[_0xeb56('0x40')][_0xeb56('0x1a')]({'id':_0x481b67['idField'],'value':_0x155879[_0x481b67[_0xeb56('0x43')][_0xeb56('0x2e')]['toLowerCase']()]['toString']()});}});}return _0x140069;}function getConnection(_0x413c79){return request({'method':_0xeb56('0x45'),'form':{'method':_0xeb56('0x46'),'input_type':'JSON','response_type':_0xeb56('0x1c'),'rest_data':JSON[_0xeb56('0x1d')]({'user_auth':{'user_name':_0x413c79['username'],'password':_0x413c79[_0xeb56('0x47')],'encryption':'PLAIN'},'application':_0xeb56('0x48')})}})[_0xeb56('0x34')](function(_0x516165){var _0x20fd55=_0x516165;if(_0x20fd55['id']){def[_0xeb56('0x49')]=_0x20fd55['id'];return BPromise[_0xeb56('0x2d')](_0x20fd55);}else{throw new Error(util[_0xeb56('0x1e')](_0xeb56('0x4a'),_0x413c79['id']));}});}function setRelationship(_0x54bbc1,_0x59b0e8,_0x499ceb,_0x48ea34){return request({'form':{'method':_0xeb56('0x4b'),'input_type':_0xeb56('0x1c'),'response_type':_0xeb56('0x1c'),'rest_data':JSON[_0xeb56('0x1d')]({'session':_0x54bbc1['id'],'module_name':_0xeb56('0x4c'),'module_id':_0x499ceb['id'],'link_field_name':_0x48ea34,'related_ids':[_0x59b0e8['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xeb56('0x4d')]=function(_0x57e1d5,_0x469a8e,_0x2875f0,_0x4c0b6d,_0x93498c,_0x1f00b9){var _0x50ca28,_0x5817f9,_0x4567df,_0x2c4b79;_0x1f00b9[_0xeb56('0x4e')]=intUtil[_0xeb56('0x4f')](_0x1f00b9[_0xeb56('0x4e')]);_0x1f00b9[_0xeb56('0x50')]=intUtil['stripTrailingSlash'](_0x1f00b9[_0xeb56('0x50')]);def[_0xeb56('0x51')]=util[_0xeb56('0x1e')]('%s/service/v4_1/rest.php',_0x1f00b9[_0xeb56('0x4e')]);if(_0x93498c&&_0x93498c['monitor_format']){logger[_0xeb56('0xa')]('[QUEUE]',_0xeb56('0x52'));_0x469a8e[_0xeb56('0x53')]=util[_0xeb56('0x1e')](_0xeb56('0x54'),_0x1f00b9[_0xeb56('0x50')],_0x469a8e['uniqueid'],md5(_0x469a8e[_0xeb56('0x55')]));}else{_0x469a8e[_0xeb56('0x53')]='';}return getConnection(_0x1f00b9)[_0xeb56('0x34')](function(_0x12a2c0){_0x2c4b79=_0x12a2c0;return getUser(_0x1f00b9,_0x4c0b6d[_0xeb56('0x2e')],_0x2c4b79);})[_0xeb56('0x34')](function(_0x253186){_0x50ca28=_0x253186;logger[_0xeb56('0xa')](_0xeb56('0x56'),_0x50ca28['id']);return getEndUser(_0x1f00b9,_0x469a8e[_0xeb56('0x57')],_0x469a8e['calleridnum'],_0x2c4b79);})['then'](function(_0x1edeea){_0x5817f9=_0x1edeea;logger[_0xeb56('0xa')]('The\x20Enduser\x20ID\x20is:',_0x5817f9['id']);return getTicket(_0x1f00b9,_0x50ca28,_0x5817f9,_0x2875f0,_0x469a8e,_0x2875f0[_0xeb56('0x58')],_0x2c4b79,_0xeb56('0x59'));})['then'](function(_0x3ec71f){_0x4567df=_0x3ec71f;logger[_0xeb56('0xa')](_0xeb56('0x5a'));logger[_0xeb56('0xa')](_0xeb56('0x5b'),_0x4567df['id']);return setRelationship(_0x2c4b79,_0x50ca28,_0x4567df,'users');})[_0xeb56('0x34')](function(){return setRelationship(_0x2c4b79,_0x5817f9,_0x4567df,_0xeb56('0x5c'));})[_0xeb56('0x34')](function(){return getServerInfo(_0x2c4b79);})[_0xeb56('0x34')](function(_0x46d5bd){var _0x3f9832=parseInt(_0x46d5bd[_0xeb56('0x5d')][_0xeb56('0x5e')](0x0));var _0x5041a1=util[_0xeb56('0x1e')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x1f00b9['remoteUri'],_0x4567df['id']);if(_0x3f9832>0x6){_0x5041a1=util[_0xeb56('0x1e')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x1f00b9[_0xeb56('0x4e')],_0x4567df['id']);}logger[_0xeb56('0xa')]('[QUEUE]',_0xeb56('0x5f'));emit(util['format'](_0xeb56('0x60'),_0x4c0b6d[_0xeb56('0x2e')]),'trigger:browser:url',{'uri':_0x5041a1});})['catch'](function(_0x555121){logger[_0xeb56('0x61')]('[QUEUE]',JSON[_0xeb56('0x1d')](_0x555121));});};exports[_0xeb56('0x62')]=function(_0x22f566,_0x558436,_0x44cf3a,_0x30aed3,_0x5f53e0,_0x519167,_0x11c3aa){var _0x2dd788,_0x1e4d51,_0x40b7a5,_0xce1b21;_0x519167[_0xeb56('0x4e')]=intUtil['stripTrailingSlash'](_0x519167[_0xeb56('0x4e')]);_0x519167[_0xeb56('0x50')]=intUtil['stripTrailingSlash'](_0x519167[_0xeb56('0x50')]);def[_0xeb56('0x51')]=util[_0xeb56('0x1e')](_0xeb56('0x63'),_0x519167[_0xeb56('0x4e')]);if(_0x11c3aa&&_0x11c3aa[_0xeb56('0x64')]&&_0x11c3aa[_0xeb56('0x64')]!==_0xeb56('0x65')){logger[_0xeb56('0xa')](_0xeb56('0x66'),_0xeb56('0x52'));_0x558436[_0xeb56('0x53')]=util[_0xeb56('0x1e')](_0xeb56('0x54'),_0x519167['serverUrl'],_0x558436['uniqueid'],md5(_0x558436[_0xeb56('0x55')]));}return getConnection(_0x519167)[_0xeb56('0x34')](function(_0x13ce67){_0xce1b21=_0x13ce67;return getUser(_0x519167,_0x30aed3[_0xeb56('0x2e')],_0xce1b21);})[_0xeb56('0x34')](function(_0x4e1b74){_0x2dd788=_0x4e1b74;logger['info'](_0xeb56('0x56'),_0x2dd788['id']);return getEndUser(_0x519167,_0x558436[_0xeb56('0x67')],_0x558436[_0xeb56('0x68')],_0xce1b21);})[_0xeb56('0x34')](function(_0x4d8982){_0x1e4d51=_0x4d8982;logger['info'](_0xeb56('0x69'),_0x1e4d51['id']);return getTicket(_0x519167,_0x2dd788,_0x1e4d51,_0x44cf3a,_0x558436,_0x44cf3a[_0xeb56('0x58')],_0xce1b21,_0xeb56('0x6a'));})[_0xeb56('0x34')](function(_0x44e810){_0x40b7a5=_0x44e810;logger[_0xeb56('0xa')](_0xeb56('0x5a'));logger[_0xeb56('0xa')](_0xeb56('0x5b'),_0x40b7a5['id']);return setRelationship(_0xce1b21,_0x2dd788,_0x40b7a5,_0xeb56('0x6b'));})[_0xeb56('0x34')](function(){return setRelationship(_0xce1b21,_0x1e4d51,_0x40b7a5,_0xeb56('0x5c'));})[_0xeb56('0x34')](function(){return getServerInfo(_0xce1b21);})['then'](function(_0x43a5a7){var _0x3b3dae=parseInt(_0x43a5a7['version'][_0xeb56('0x5e')](0x0));var _0x8a0264=util[_0xeb56('0x1e')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x519167[_0xeb56('0x4e')],_0x40b7a5['id']);if(_0x3b3dae>0x6){_0x8a0264=util[_0xeb56('0x1e')](_0xeb56('0x6c'),_0x519167[_0xeb56('0x4e')],_0x40b7a5['id']);}logger['info']('[OUTBOUND]',_0xeb56('0x5f'));emit(util[_0xeb56('0x1e')](_0xeb56('0x60'),_0x30aed3[_0xeb56('0x2e')]),_0xeb56('0x6d'),{'uri':_0x8a0264});})[_0xeb56('0x6e')](function(_0x29892e){logger[_0xeb56('0x61')](_0xeb56('0x66'),JSON['stringify'](_0x29892e));});};exports['unmanaged']=function(_0x1d0089,_0x5cf7dd,_0x1efed7,_0x53a4a5,_0x437f89,_0x3abeb1){var _0x5a4c62,_0x42859c,_0x30bcf3,_0x1e1575;_0x3abeb1[_0xeb56('0x4e')]=intUtil[_0xeb56('0x4f')](_0x3abeb1[_0xeb56('0x4e')]);_0x3abeb1[_0xeb56('0x50')]=intUtil[_0xeb56('0x4f')](_0x3abeb1['serverUrl']);def['uri']=util[_0xeb56('0x1e')]('%s/service/v4_1/rest.php',_0x3abeb1['remoteUri']);if(_0x437f89&&_0x437f89[_0xeb56('0x6f')]){logger[_0xeb56('0xa')]('['+_0x5cf7dd[_0xeb56('0x70')][_0xeb56('0x71')]()+']',_0xeb56('0x52'));_0x5cf7dd['recordingURL']=util[_0xeb56('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3abeb1[_0xeb56('0x50')],_0x5cf7dd[_0xeb56('0x55')],md5(_0x5cf7dd['uniqueid']));}else{_0x5cf7dd[_0xeb56('0x53')]='';}return getConnection(_0x3abeb1)[_0xeb56('0x34')](function(_0x307587){_0x1e1575=_0x307587;if(!_[_0xeb56('0x23')](_0x53a4a5)){return getUser(_0x3abeb1,_0x53a4a5[_0xeb56('0x2e')],_0x1e1575);}else{return getUser(_0x3abeb1,null,_0x1e1575);}})[_0xeb56('0x34')](function(_0x5a7150){_0x5a4c62=_0x5a7150;logger[_0xeb56('0xa')](_0xeb56('0x56'),_0x5a4c62['id']);return getEndUser(_0x3abeb1,_0x5cf7dd['calleridname'],_0x5cf7dd[_0xeb56('0x72')],_0x1e1575);})['then'](function(_0x547164){_0x42859c=_0x547164;logger[_0xeb56('0xa')](_0xeb56('0x69'),_0x42859c['id']);return getTicket(_0x3abeb1,_0x5a4c62,_0x42859c,_0x1efed7,_0x5cf7dd,_0x1efed7[_0xeb56('0x58')],_0x1e1575,'Inbound');})['then'](function(_0x2b9b02){_0x30bcf3=_0x2b9b02;logger[_0xeb56('0xa')]('Ticket\x20created!');logger[_0xeb56('0xa')](_0xeb56('0x5b'),_0x30bcf3['id']);return setRelationship(_0x1e1575,_0x5a4c62,_0x30bcf3,_0xeb56('0x6b'));})[_0xeb56('0x34')](function(){return setRelationship(_0x1e1575,_0x42859c,_0x30bcf3,_0xeb56('0x5c'));})[_0xeb56('0x34')](function(){return getServerInfo(_0x1e1575);})['catch'](function(_0x432d22){logger[_0xeb56('0x61')]('['+_0x5cf7dd['lastevent'][_0xeb56('0x71')]()+']',JSON[_0xeb56('0x1d')](_0x432d22));});}; \ No newline at end of file +var _0xa12c=['nameField','toLowerCase','content','customField','variable','custom_fields','customVariable','Variable','login','username','password','xCALLY\x20Motion\x20integration','sessionID','set_relationship','queue','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','remoteUri','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','users','contacts','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','[QUEUE]','trigger:browser:url','none','[OUTBOUND]','destcalleridname','destcalleridnum','Outbound','version','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','catch','error','unmanaged','toUpperCase','calleridnum','The\x20Ticket\x20ID\x20is:','request-promise','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','POST','info','name','getString','Subjects','assigned_user_id','created_by','description','date_start','toISOString','slice','duration_hours','duration_minutes','parent_name','length','forEach','variableName','push','idField','set_entry','JSON','stringify','Calls','format','Basic\x20%s','toString','base64','get_server_info','isNil','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','entry_list','name_value_list','value','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','Contacts','phone_home','then','find','Enduser\x20found!','','Caller\x20-\x20%s','Enduser\x20created.','first_name','[HTTP]','merge','map','type'];(function(_0x5d8019,_0x46aff3){var _0x5cf7f3=function(_0x1cc1d8){while(--_0x1cc1d8){_0x5d8019['push'](_0x5d8019['shift']());}};_0x5cf7f3(++_0x46aff3);}(_0xa12c,0x190));var _0xca12=function(_0x426f94,_0x52b840){_0x426f94=_0x426f94-0x0;var _0x5a4143=_0xa12c[_0x426f94];return _0x5a4143;};'use strict';var _=require('lodash');var rp=require(_0xca12('0x0'));var BPromise=require('bluebird');var md5=require('md5');var util=require(_0xca12('0x1'));var Redis=require(_0xca12('0x2'));var intUtil=require(_0xca12('0x3'));var config=require(_0xca12('0x4'));var logger=require(_0xca12('0x5'))('sugarcrm');config[_0xca12('0x6')]=_[_0xca12('0x7')](config[_0xca12('0x6')],{'host':_0xca12('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xca12('0x6')]));var def={'method':_0xca12('0x9'),'json':!![]};function emit(_0xf22f3c,_0x21d8a4,_0x13485a){io['to'](_0xf22f3c)['emit'](_0x21d8a4,_0x13485a);}function getTicket(_0x410923,_0x59a718,_0x3e7d91,_0x2ed172,_0xe36ff7,_0x47c6ce,_0x43c888,_0x371f00){logger[_0xca12('0xa')]('Creating\x20new\x20ticket...');var _0x4edd6f=new Date();var _0x5395c9=[{'name':_0xca12('0xb'),'value':intUtil[_0xca12('0xc')](_0x2ed172[_0xca12('0xd')],_0xe36ff7,'\x20')},{'name':_0xca12('0xe'),'value':_0x59a718['id']},{'name':_0xca12('0xf'),'value':_0x59a718['id']},{'name':_0xca12('0x10'),'value':intUtil['getString'](_0x2ed172['Descriptions'],_0xe36ff7,'\x0a')},{'name':_0xca12('0x11'),'value':_0x4edd6f[_0xca12('0x12')]()[_0xca12('0x13')](0x0,0x13)['replace']('T','\x20')},{'name':_0xca12('0x14'),'value':'0'},{'name':_0xca12('0x15'),'value':'15'},{'name':'parent_id','value':_0x3e7d91['id']},{'name':'parent_type','value':'Contacts'},{'name':_0xca12('0x16'),'value':_0x3e7d91['name']},{'name':'direction','value':_0x371f00}];if(_0x47c6ce[_0xca12('0x17')]){_[_0xca12('0x18')](_0x47c6ce,function(_0x564010){if(_0xe36ff7[_0x564010[_0xca12('0x19')]]){_0x5395c9[_0xca12('0x1a')]({'name':_0x564010[_0xca12('0x1b')],'value':_0xe36ff7[_0x564010[_0xca12('0x19')]]});}});}return request({'form':{'method':_0xca12('0x1c'),'input_type':_0xca12('0x1d'),'response_type':'JSON','rest_data':JSON[_0xca12('0x1e')]({'session':_0x43c888['id'],'module_name':_0xca12('0x1f'),'name_value_list':_0x5395c9})}});}function getAuth(_0x5af7e4){return util[_0xca12('0x20')](_0xca12('0x21'),new Buffer(_0x5af7e4['apiKey']+':X')[_0xca12('0x22')](_0xca12('0x23')));}function getServerInfo(_0x22062c){return request({'form':{'method':_0xca12('0x24'),'input_type':_0xca12('0x1d'),'response_type':_0xca12('0x1d'),'rest_data':JSON[_0xca12('0x1e')]({'session':_0x22062c['id']})}});}function getUser(_0x9bc4f2,_0x268157,_0x5881d9){if(!_[_0xca12('0x25')](_0x268157)){logger['info'](_0xca12('0x26'),_0x268157);return request({'form':{'method':_0xca12('0x27'),'input_type':_0xca12('0x1d'),'response_type':_0xca12('0x1d'),'rest_data':JSON[_0xca12('0x1e')]({'session':_0x5881d9['id'],'module_name':_0xca12('0x28'),'query':util[_0xca12('0x20')](_0xca12('0x29'),_0x268157),'order_by':'','offset':'0','select_fields':['id',_0xca12('0xb'),_0xca12('0x2a')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x54c14b){if(_0x54c14b[_0xca12('0x2b')][_0xca12('0x17')]){var _0x23e5b7=_['find'](_0x54c14b['entry_list'],function(_0x3b2793){return _0x3b2793[_0xca12('0x2c')]['user_name'][_0xca12('0x2d')]===_0x268157;});if(_0x23e5b7){logger[_0xca12('0xa')]('Agent\x20found!');return BPromise[_0xca12('0x2e')]({'id':_0x23e5b7['name_value_list']['id'][_0xca12('0x2d')],'name':_0x23e5b7['name_value_list'][_0xca12('0xb')][_0xca12('0x2d')]});}}logger[_0xca12('0xa')](_0xca12('0x2f'));return BPromise['resolve']({'id':_0x5881d9['name_value_list'][_0xca12('0x30')][_0xca12('0x2d')],'name':_0x5881d9[_0xca12('0x2c')][_0xca12('0x2a')][_0xca12('0x2d')]});});}else{logger[_0xca12('0xa')](_0xca12('0x31'));return BPromise[_0xca12('0x2e')]({'id':_0x5881d9['name_value_list'][_0xca12('0x30')][_0xca12('0x2d')],'name':_0x5881d9[_0xca12('0x2c')]['user_name']['value']});}}function getEndUser(_0x36656b,_0x6e2e3d,_0x3e35e6,_0xff8757){logger[_0xca12('0xa')](_0xca12('0x32'),_0x3e35e6);return request({'form':{'method':_0xca12('0x27'),'input_type':_0xca12('0x1d'),'response_type':_0xca12('0x1d'),'rest_data':JSON[_0xca12('0x1e')]({'session':_0xff8757['id'],'module_name':_0xca12('0x33'),'query':util[_0xca12('0x20')]('contacts.phone_home\x20=\x20\x22%s\x22',_0x3e35e6),'order_by':'','offset':'0','select_fields':['id','name',_0xca12('0x34')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xca12('0x35')](function(_0x5f2f3c){if(_0x5f2f3c[_0xca12('0x2b')][_0xca12('0x17')]){var _0x122e47=_[_0xca12('0x36')](_0x5f2f3c[_0xca12('0x2b')],function(_0xb9bed0){return _0xb9bed0[_0xca12('0x2c')][_0xca12('0x34')][_0xca12('0x2d')]===_0x3e35e6;});if(_0x122e47){logger[_0xca12('0xa')](_0xca12('0x37'));return BPromise[_0xca12('0x2e')]({'id':_0x122e47[_0xca12('0x2c')]['id']['value'],'name':_0x122e47[_0xca12('0x2c')][_0xca12('0xb')][_0xca12('0x2d')],'phone':_0x122e47[_0xca12('0x2c')][_0xca12('0x34')]['value']});}}else{logger[_0xca12('0xa')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0xca12('0x1c'),'input_type':_0xca12('0x1d'),'response_type':'JSON','rest_data':JSON[_0xca12('0x1e')]({'session':_0xff8757['id'],'module_name':_0xca12('0x33'),'name_value_list':[{'name':'first_name','value':_0x6e2e3d!==_0xca12('0x38')?_0x6e2e3d:util['format'](_0xca12('0x39'),_0x3e35e6)},{'name':_0xca12('0x34'),'value':_0x3e35e6}]})}})[_0xca12('0x35')](function(_0x4f8a2e){logger[_0xca12('0xa')](_0xca12('0x3a'));return BPromise[_0xca12('0x2e')]({'id':_0x4f8a2e['id'],'name':_0x4f8a2e['entry_list'][_0xca12('0x3b')][_0xca12('0x2d')],'phone':_0x4f8a2e[_0xca12('0x2b')][_0xca12('0x34')][_0xca12('0x2d')]});});}});}function request(_0x3d013b){logger['debug'](_0xca12('0x3c'),JSON['stringify'](_0x3d013b));return rp(_[_0xca12('0x3d')](def,_0x3d013b));}function getTags(_0xdaf887,_0x591c10){var _0x25d9bf=[];if(_0xdaf887&&_0xdaf887[_0xca12('0x17')]>0x0){_0x25d9bf=_[_0xca12('0x3e')](_0xdaf887,_0x591c10);}return _0x25d9bf;}function getCustomFields(_0x356e83,_0xcb6cfa){var _0x1e7c07=[];var _0x2beec4={'custom_fields':[]};if(_0x356e83[_0xca12('0x17')]>0x0){_[_0xca12('0x18')](_0x356e83,function(_0x5e7e13){if(_0x5e7e13[_0xca12('0x3f')]==='string'&&_0x5e7e13[_0xca12('0x40')]&&!_0x5e7e13['customField']){_0x2beec4[_0x5e7e13['nameField'][_0xca12('0x41')]()]=_0x5e7e13[_0xca12('0x42')][_0xca12('0x22')]();}else if(_0x5e7e13[_0xca12('0x3f')]==='string'&&_0x5e7e13[_0xca12('0x1b')]&&_0x5e7e13[_0xca12('0x43')]){_0x2beec4['custom_fields'][_0xca12('0x1a')]({'id':_0x5e7e13[_0xca12('0x1b')],'value':_0x5e7e13['content'][_0xca12('0x22')]()});}else if(_0x5e7e13[_0xca12('0x3f')]===_0xca12('0x44')&&_0x5e7e13[_0xca12('0x19')]&&_0x5e7e13['idField']&&_0x5e7e13[_0xca12('0x43')]){_0xcb6cfa[_0x5e7e13[_0xca12('0x19')]]&&_0x2beec4[_0xca12('0x45')]['push']({'id':_0x5e7e13['idField'],'value':_0xcb6cfa[_0x5e7e13[_0xca12('0x19')]][_0xca12('0x22')]()});}else if(_0x5e7e13[_0xca12('0x3f')]===_0xca12('0x46')&&_0x5e7e13[_0xca12('0x47')]&&_0x5e7e13[_0xca12('0x47')][_0xca12('0xb')]&&_0x5e7e13['idField']&&_0x5e7e13[_0xca12('0x43')]){_0xcb6cfa[_0x5e7e13[_0xca12('0x47')]['name']['toLowerCase']()]&&_0x2beec4[_0xca12('0x45')][_0xca12('0x1a')]({'id':_0x5e7e13[_0xca12('0x1b')],'value':_0xcb6cfa[_0x5e7e13['Variable'][_0xca12('0xb')][_0xca12('0x41')]()][_0xca12('0x22')]()});}});}return _0x2beec4;}function getConnection(_0x2b4097){return request({'method':_0xca12('0x9'),'form':{'method':_0xca12('0x48'),'input_type':_0xca12('0x1d'),'response_type':_0xca12('0x1d'),'rest_data':JSON[_0xca12('0x1e')]({'user_auth':{'user_name':_0x2b4097[_0xca12('0x49')],'password':_0x2b4097[_0xca12('0x4a')],'encryption':'PLAIN'},'application':_0xca12('0x4b')})}})[_0xca12('0x35')](function(_0x280f94){var _0x57511a=_0x280f94;if(_0x57511a['id']){def[_0xca12('0x4c')]=_0x57511a['id'];return BPromise[_0xca12('0x2e')](_0x57511a);}else{throw new Error(util[_0xca12('0x20')]('Account\x20%d\x20is\x20not\x20valid',_0x2b4097['id']));}});}function setRelationship(_0x42b517,_0x1474e9,_0x1ae20c,_0x4a73fa){return request({'form':{'method':_0xca12('0x4d'),'input_type':_0xca12('0x1d'),'response_type':'JSON','rest_data':JSON[_0xca12('0x1e')]({'session':_0x42b517['id'],'module_name':_0xca12('0x1f'),'module_id':_0x1ae20c['id'],'link_field_name':_0x4a73fa,'related_ids':[_0x1474e9['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xca12('0x4e')]=function(_0x112a8b,_0x21c0d7,_0x164aed,_0x3f0f5c,_0x14bcaa,_0xaac74b){var _0x39490a,_0x2697af,_0x47994a,_0x2b0274;_0xaac74b['remoteUri']=intUtil[_0xca12('0x4f')](_0xaac74b['remoteUri']);_0xaac74b['serverUrl']=intUtil['stripTrailingSlash'](_0xaac74b[_0xca12('0x50')]);def[_0xca12('0x51')]=util[_0xca12('0x20')](_0xca12('0x52'),_0xaac74b[_0xca12('0x53')]);if(_0x14bcaa&&_0x14bcaa[_0xca12('0x54')]){logger[_0xca12('0xa')]('[QUEUE]',_0xca12('0x55'));_0x21c0d7[_0xca12('0x56')]=util[_0xca12('0x20')](_0xca12('0x57'),_0xaac74b[_0xca12('0x50')],_0x21c0d7[_0xca12('0x58')],md5(_0x21c0d7[_0xca12('0x58')]));}else{_0x21c0d7[_0xca12('0x56')]='';}return getConnection(_0xaac74b)[_0xca12('0x35')](function(_0x2440de){_0x2b0274=_0x2440de;return getUser(_0xaac74b,_0x3f0f5c[_0xca12('0xb')],_0x2b0274);})[_0xca12('0x35')](function(_0x311a2f){_0x39490a=_0x311a2f;logger[_0xca12('0xa')](_0xca12('0x59'),_0x39490a['id']);return getEndUser(_0xaac74b,_0x21c0d7[_0xca12('0x5a')],_0x21c0d7['calleridnum'],_0x2b0274);})[_0xca12('0x35')](function(_0x465f12){_0x2697af=_0x465f12;logger[_0xca12('0xa')](_0xca12('0x5b'),_0x2697af['id']);return getTicket(_0xaac74b,_0x39490a,_0x2697af,_0x164aed,_0x21c0d7,_0x164aed[_0xca12('0x5c')],_0x2b0274,_0xca12('0x5d'));})[_0xca12('0x35')](function(_0x2402e2){_0x47994a=_0x2402e2;logger[_0xca12('0xa')](_0xca12('0x5e'));logger[_0xca12('0xa')]('The\x20Ticket\x20ID\x20is:',_0x47994a['id']);return setRelationship(_0x2b0274,_0x39490a,_0x47994a,_0xca12('0x5f'));})[_0xca12('0x35')](function(){return setRelationship(_0x2b0274,_0x2697af,_0x47994a,_0xca12('0x60'));})[_0xca12('0x35')](function(){return getServerInfo(_0x2b0274);})[_0xca12('0x35')](function(_0x3e46a7){var _0x323ade=parseInt(_0x3e46a7['version'][_0xca12('0x61')](0x0));var _0x26a4d8=util[_0xca12('0x20')](_0xca12('0x62'),_0xaac74b[_0xca12('0x53')],_0x47994a['id']);if(_0x323ade>0x6){_0x26a4d8=util[_0xca12('0x20')](_0xca12('0x63'),_0xaac74b[_0xca12('0x53')],_0x47994a['id']);}logger[_0xca12('0xa')](_0xca12('0x64'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x3f0f5c[_0xca12('0xb')]),_0xca12('0x65'),{'uri':_0x26a4d8});})['catch'](function(_0x33bd49){logger['error']('[QUEUE]',JSON[_0xca12('0x1e')](_0x33bd49));});};exports['outbound']=function(_0x119bbc,_0x308f01,_0x5abdd0,_0x18bc58,_0x1722bf,_0x272bb0,_0x37979c){var _0x6cf112,_0x516891,_0xa2b8f6,_0x1b17eb;_0x272bb0[_0xca12('0x53')]=intUtil['stripTrailingSlash'](_0x272bb0[_0xca12('0x53')]);_0x272bb0['serverUrl']=intUtil[_0xca12('0x4f')](_0x272bb0['serverUrl']);def['uri']=util[_0xca12('0x20')](_0xca12('0x52'),_0x272bb0[_0xca12('0x53')]);if(_0x37979c&&_0x37979c['recordingFormat']&&_0x37979c['recordingFormat']!==_0xca12('0x66')){logger[_0xca12('0xa')](_0xca12('0x67'),_0xca12('0x55'));_0x308f01[_0xca12('0x56')]=util[_0xca12('0x20')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x272bb0[_0xca12('0x50')],_0x308f01['uniqueid'],md5(_0x308f01[_0xca12('0x58')]));}return getConnection(_0x272bb0)[_0xca12('0x35')](function(_0x1b2d5f){_0x1b17eb=_0x1b2d5f;return getUser(_0x272bb0,_0x18bc58[_0xca12('0xb')],_0x1b17eb);})[_0xca12('0x35')](function(_0x5d9562){_0x6cf112=_0x5d9562;logger[_0xca12('0xa')]('The\x20User\x20ID\x20is:',_0x6cf112['id']);return getEndUser(_0x272bb0,_0x308f01[_0xca12('0x68')],_0x308f01[_0xca12('0x69')],_0x1b17eb);})[_0xca12('0x35')](function(_0x15dc9f){_0x516891=_0x15dc9f;logger['info'](_0xca12('0x5b'),_0x516891['id']);return getTicket(_0x272bb0,_0x6cf112,_0x516891,_0x5abdd0,_0x308f01,_0x5abdd0[_0xca12('0x5c')],_0x1b17eb,_0xca12('0x6a'));})[_0xca12('0x35')](function(_0x44f8d8){_0xa2b8f6=_0x44f8d8;logger[_0xca12('0xa')](_0xca12('0x5e'));logger['info']('The\x20Ticket\x20ID\x20is:',_0xa2b8f6['id']);return setRelationship(_0x1b17eb,_0x6cf112,_0xa2b8f6,'users');})['then'](function(){return setRelationship(_0x1b17eb,_0x516891,_0xa2b8f6,_0xca12('0x60'));})[_0xca12('0x35')](function(){return getServerInfo(_0x1b17eb);})[_0xca12('0x35')](function(_0x46c5dc){var _0x4f2561=parseInt(_0x46c5dc[_0xca12('0x6b')][_0xca12('0x61')](0x0));var _0x3ffd9c=util[_0xca12('0x20')](_0xca12('0x62'),_0x272bb0[_0xca12('0x53')],_0xa2b8f6['id']);if(_0x4f2561>0x6){_0x3ffd9c=util[_0xca12('0x20')](_0xca12('0x63'),_0x272bb0[_0xca12('0x53')],_0xa2b8f6['id']);}logger[_0xca12('0xa')](_0xca12('0x67'),_0xca12('0x6c'));emit(util[_0xca12('0x20')](_0xca12('0x6d'),_0x18bc58[_0xca12('0xb')]),'trigger:browser:url',{'uri':_0x3ffd9c});})[_0xca12('0x6e')](function(_0x5c0ef6){logger[_0xca12('0x6f')]('[OUTBOUND]',JSON['stringify'](_0x5c0ef6));});};exports[_0xca12('0x70')]=function(_0x4ce94e,_0x54170b,_0x273bb4,_0x5c1f3c,_0x526883,_0x35dc9b){var _0x1af327,_0x344b93,_0x21c36d,_0xc3a3d8;_0x35dc9b[_0xca12('0x53')]=intUtil[_0xca12('0x4f')](_0x35dc9b[_0xca12('0x53')]);_0x35dc9b[_0xca12('0x50')]=intUtil[_0xca12('0x4f')](_0x35dc9b[_0xca12('0x50')]);def[_0xca12('0x51')]=util[_0xca12('0x20')](_0xca12('0x52'),_0x35dc9b[_0xca12('0x53')]);if(_0x526883&&_0x526883[_0xca12('0x54')]){logger[_0xca12('0xa')]('['+_0x54170b['lastevent'][_0xca12('0x71')]()+']',_0xca12('0x55'));_0x54170b[_0xca12('0x56')]=util[_0xca12('0x20')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x35dc9b[_0xca12('0x50')],_0x54170b['uniqueid'],md5(_0x54170b[_0xca12('0x58')]));}else{_0x54170b['recordingURL']='';}return getConnection(_0x35dc9b)['then'](function(_0x194247){_0xc3a3d8=_0x194247;if(!_[_0xca12('0x25')](_0x5c1f3c)){return getUser(_0x35dc9b,_0x5c1f3c['name'],_0xc3a3d8);}else{return getUser(_0x35dc9b,null,_0xc3a3d8);}})['then'](function(_0x26d666){_0x1af327=_0x26d666;logger['info'](_0xca12('0x59'),_0x1af327['id']);return getEndUser(_0x35dc9b,_0x54170b['calleridname'],_0x54170b[_0xca12('0x72')],_0xc3a3d8);})[_0xca12('0x35')](function(_0x1cf111){_0x344b93=_0x1cf111;logger[_0xca12('0xa')](_0xca12('0x5b'),_0x344b93['id']);return getTicket(_0x35dc9b,_0x1af327,_0x344b93,_0x273bb4,_0x54170b,_0x273bb4['Fields'],_0xc3a3d8,'Inbound');})[_0xca12('0x35')](function(_0x496c77){_0x21c36d=_0x496c77;logger[_0xca12('0xa')]('Ticket\x20created!');logger['info'](_0xca12('0x73'),_0x21c36d['id']);return setRelationship(_0xc3a3d8,_0x1af327,_0x21c36d,_0xca12('0x5f'));})['then'](function(){return setRelationship(_0xc3a3d8,_0x344b93,_0x21c36d,_0xca12('0x60'));})[_0xca12('0x35')](function(){return getServerInfo(_0xc3a3d8);})['catch'](function(_0x280c70){logger[_0xca12('0x6f')]('['+_0x54170b['lastevent']['toUpperCase']()+']',JSON[_0xca12('0x1e')](_0x280c70));});}; \ 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 710168a..110f41f 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 _0x84c4=['getString','length','sortBy','type','string','push','content','toString','customVariable','Variable','name','toLowerCase','keyType','format','key','keyContent','variableName','%s:\x20%s','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail','isNil','test','lodash','util'];(function(_0x8cb2f9,_0x2b8706){var _0x164887=function(_0x1812cc){while(--_0x1812cc){_0x8cb2f9['push'](_0x8cb2f9['shift']());}};_0x164887(++_0x2b8706);}(_0x84c4,0x178));var _0x484c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x84c4[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x484c('0x0'));var util=require(_0x484c('0x1'));exports[_0x484c('0x2')]=function(_0x28c454,_0x278752,_0x5807a9){var _0x59d844=[];if(_0x28c454[_0x484c('0x3')]>0x0){var _0x55f91f=_[_0x484c('0x4')](_0x28c454,['id']);for(var _0x47514b=0x0;_0x47514b<_0x55f91f[_0x484c('0x3')];_0x47514b++){var _0xf484cc=_0x55f91f[_0x47514b];if(_0xf484cc[_0x484c('0x5')]===_0x484c('0x6')){_0x59d844[_0x484c('0x7')](_0xf484cc[_0x484c('0x8')]);}else if(_0xf484cc[_0x484c('0x5')]==='variable'&&_0xf484cc['variableName']){_0x278752[_0xf484cc['variableName']]&&_0x59d844[_0x484c('0x7')](_0x278752[_0xf484cc['variableName']][_0x484c('0x9')]());}else if(_0xf484cc[_0x484c('0x5')]===_0x484c('0xa')&&_0xf484cc[_0x484c('0xb')]&&_0xf484cc[_0x484c('0xb')][_0x484c('0xc')]){_0x278752[_0xf484cc[_0x484c('0xb')][_0x484c('0xc')][_0x484c('0xd')]()]&&_0x59d844['push'](_0x278752[_0xf484cc[_0x484c('0xb')]['name'][_0x484c('0xd')]()]['toString']());}else if(_0xf484cc['type']==='keyValue'){if(_0xf484cc[_0x484c('0xe')]===_0x484c('0x6')&&_0xf484cc['key']){_0x59d844[_0x484c('0x7')](util[_0x484c('0xf')]('%s:\x20%s',_0xf484cc[_0x484c('0x10')],_0xf484cc[_0x484c('0x11')]));}else if(_0xf484cc['keyType']==='variable'&&_0xf484cc[_0x484c('0x12')]&&_0xf484cc[_0x484c('0x10')]){_0x278752[_0xf484cc[_0x484c('0x12')]]&&_0x59d844[_0x484c('0x7')](util[_0x484c('0xf')](_0x484c('0x13'),_0xf484cc[_0x484c('0x10')],_0x278752[_0xf484cc[_0x484c('0x12')]]));}else if(_0xf484cc[_0x484c('0xe')]==='customVariable'&&_0xf484cc[_0x484c('0xb')]&&_0xf484cc[_0x484c('0xb')][_0x484c('0xc')]&&_0xf484cc[_0x484c('0x10')]){_0x278752[_0xf484cc[_0x484c('0xb')][_0x484c('0xc')][_0x484c('0xd')]()]&&_0x59d844[_0x484c('0x7')](util['format'](_0x484c('0x13'),_0xf484cc['key'],_0x278752[_0xf484cc[_0x484c('0xb')][_0x484c('0xc')][_0x484c('0xd')]()]));}}}}return _0x59d844['join'](_0x5807a9);};exports[_0x484c('0x14')]=function(_0x529d89){var _0x27e1f1=_0x529d89[_0x484c('0x15')](-0x1);if(_0x27e1f1==='/'){_0x529d89=_0x529d89[_0x484c('0x16')](0x0,_0x529d89[_0x484c('0x17')](_0x27e1f1));}return _0x529d89;};exports[_0x484c('0x18')]=function(_0x204173){if(!_[_0x484c('0x19')](_0x204173)&&_0x204173!==''){var _0x3d9c2b=/^(([^<>()\[\]\\.,;:\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 _0x3d9c2b[_0x484c('0x1a')](String(_0x204173)[_0x484c('0xd')]());}else{return![];}}; \ No newline at end of file +var _0xb409=['key','keyContent','customVariable','%s:\x20%s','join','stripTrailingSlash','slice','substring','lastIndexOf','test','lodash','getString','sortBy','length','push','content','variable','variableName','toString','type','Variable','name','toLowerCase','keyValue','keyType','string','format'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb409,0x91));var _0x9b40=function(_0x17b8b1,_0x4171f7){_0x17b8b1=_0x17b8b1-0x0;var _0xf46445=_0xb409[_0x17b8b1];return _0xf46445;};'use strict';var _=require(_0x9b40('0x0'));var util=require('util');exports[_0x9b40('0x1')]=function(_0x202dc1,_0x3cf97f,_0x4b7484){var _0x47e94a=[];if(_0x202dc1['length']>0x0){var _0x1b48e9=_[_0x9b40('0x2')](_0x202dc1,['id']);for(var _0x6e221b=0x0;_0x6e221b<_0x1b48e9[_0x9b40('0x3')];_0x6e221b++){var _0x40135c=_0x1b48e9[_0x6e221b];if(_0x40135c['type']==='string'){_0x47e94a[_0x9b40('0x4')](_0x40135c[_0x9b40('0x5')]);}else if(_0x40135c['type']===_0x9b40('0x6')&&_0x40135c['variableName']){_0x3cf97f[_0x40135c[_0x9b40('0x7')]]&&_0x47e94a[_0x9b40('0x4')](_0x3cf97f[_0x40135c[_0x9b40('0x7')]][_0x9b40('0x8')]());}else if(_0x40135c[_0x9b40('0x9')]==='customVariable'&&_0x40135c['Variable']&&_0x40135c[_0x9b40('0xa')][_0x9b40('0xb')]){_0x3cf97f[_0x40135c['Variable']['name'][_0x9b40('0xc')]()]&&_0x47e94a['push'](_0x3cf97f[_0x40135c[_0x9b40('0xa')]['name']['toLowerCase']()][_0x9b40('0x8')]());}else if(_0x40135c[_0x9b40('0x9')]===_0x9b40('0xd')){if(_0x40135c[_0x9b40('0xe')]===_0x9b40('0xf')&&_0x40135c['key']){_0x47e94a[_0x9b40('0x4')](util[_0x9b40('0x10')]('%s:\x20%s',_0x40135c[_0x9b40('0x11')],_0x40135c[_0x9b40('0x12')]));}else if(_0x40135c[_0x9b40('0xe')]===_0x9b40('0x6')&&_0x40135c[_0x9b40('0x7')]&&_0x40135c[_0x9b40('0x11')]){_0x3cf97f[_0x40135c[_0x9b40('0x7')]]&&_0x47e94a[_0x9b40('0x4')](util['format']('%s:\x20%s',_0x40135c[_0x9b40('0x11')],_0x3cf97f[_0x40135c['variableName']]));}else if(_0x40135c['keyType']===_0x9b40('0x13')&&_0x40135c[_0x9b40('0xa')]&&_0x40135c[_0x9b40('0xa')][_0x9b40('0xb')]&&_0x40135c['key']){_0x3cf97f[_0x40135c['Variable'][_0x9b40('0xb')][_0x9b40('0xc')]()]&&_0x47e94a[_0x9b40('0x4')](util[_0x9b40('0x10')](_0x9b40('0x14'),_0x40135c[_0x9b40('0x11')],_0x3cf97f[_0x40135c[_0x9b40('0xa')][_0x9b40('0xb')][_0x9b40('0xc')]()]));}}}}return _0x47e94a[_0x9b40('0x15')](_0x4b7484);};exports[_0x9b40('0x16')]=function(_0x2e717d){var _0x4fad3c=_0x2e717d[_0x9b40('0x17')](-0x1);if(_0x4fad3c==='/'){_0x2e717d=_0x2e717d[_0x9b40('0x18')](0x0,_0x2e717d[_0x9b40('0x19')](_0x4fad3c));}return _0x2e717d;};exports['validateEmail']=function(_0x35b4c9){if(!_['isNil'](_0x35b4c9)&&_0x35b4c9!==''){var _0x5a855c=/^(([^<>()\[\]\\.,;:\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 _0x5a855c[_0x9b40('0x1a')](String(_0x35b4c9)[_0x9b40('0xc')]());}else{return![];}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index 0d4f207..a485c08 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(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'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(_0x33bc64,_0x4d1e92){var _0x3fdd34=function(_0x4b40a4){while(--_0x4b40a4){_0x33bc64['push'](_0x33bc64['shift']());}};_0x3fdd34(++_0x4d1e92);}(_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 e914641..f84ffff 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 _0x156e=['%s/agent/tickets/%s','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','recordingFormat','none','[OUTBOUND]','Authorization','The\x20User\x20ID\x20is:','user:%s','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','calleridname','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','request-promise','md5','util','ioredis','../../../../config/environment','../../../../config/logger','defaults','redis','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','POST','Tags','name','getString','Subjects','Descriptions','Fields','then','Ticket\x20created!','ticket','Getting\x20agent\x20with\x20email','%s/search.json','remoteUri','find','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','results','filter','length','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','end-user','Caller\x20-\x20%s','authType','password','%s:%s','username','%s/token:%s','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','GET','forEach','includes','string','picklist','type','nameField','toLowerCase','content','custom_fields','push','idField','variable','variableName','customField','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','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...','trigger:browser:url'];(function(_0x365d9a,_0x45aa50){var _0xfbbb98=function(_0x278fa7){while(--_0x278fa7){_0x365d9a['push'](_0x365d9a['shift']());}};_0xfbbb98(++_0x45aa50);}(_0x156e,0xec));var _0xe156=function(_0x249398,_0x1aab7a){_0x249398=_0x249398-0x0;var _0x5d668a=_0x156e[_0x249398];return _0x5d668a;};'use strict';var _=require('lodash');var rp=require(_0xe156('0x0'));var md5=require(_0xe156('0x1'));var util=require(_0xe156('0x2'));var Redis=require(_0xe156('0x3'));var intUtil=require('./util');var config=require(_0xe156('0x4'));var logger=require(_0xe156('0x5'))('zendesk');config['redis']=_[_0xe156('0x6')](config[_0xe156('0x7')],{'host':_0xe156('0x8'),'port':0x18eb});var io=require(_0xe156('0x9'))(new Redis(config[_0xe156('0x7')]));function emit(_0x577f48,_0x36bdc8,_0x3b8176){io['to'](_0x577f48)[_0xe156('0xa')](_0x36bdc8,_0x3b8176);}var headers={'Content-Type':'application/json','Accept':_0xe156('0xb')};function getTicket(_0x541529,_0x566dee,_0x5bfbfa,_0x74f9d6,_0x5987e3){logger[_0xe156('0xc')](_0xe156('0xd'));return request({'uri':util[_0xe156('0xe')](_0xe156('0xf'),_0x541529['remoteUri']),'method':_0xe156('0x10'),'body':{'ticket':_['merge']({'requester_id':_0x5bfbfa['id'],'submitter_id':_0x566dee?_0x566dee['id']:undefined,'assignee_id':_0x566dee?_0x566dee['id']:undefined,'tags':getTags(_0x74f9d6[_0xe156('0x11')],_0xe156('0x12')),'subject':intUtil[_0xe156('0x13')](_0x74f9d6[_0xe156('0x14')],_0x5987e3,'\x20'),'description':intUtil['getString'](_0x74f9d6[_0xe156('0x15')],_0x5987e3,'\x0a'),'comment':{'public':![],'body':intUtil[_0xe156('0x13')](_0x74f9d6['Descriptions'],_0x5987e3,'\x0a')}},getCustomFields(_0x74f9d6[_0xe156('0x16')],_0x5987e3))}})[_0xe156('0x17')](function(_0x29d75a){logger[_0xe156('0xc')](_0xe156('0x18'));return _0x29d75a[_0xe156('0x19')];});}function getUser(_0x2da161,_0x21793f){if(intUtil['validateEmail'](_0x21793f)){logger[_0xe156('0xc')](_0xe156('0x1a'),_0x21793f);return request({'uri':util[_0xe156('0xe')](_0xe156('0x1b'),_0x2da161[_0xe156('0x1c')]),'qs':{'query':util[_0xe156('0xe')]('type:user\x20role:agent\x20email:%s',_0x21793f)}})['then'](function(_0x41bd7b){if(_0x41bd7b['count']){logger[_0xe156('0xc')]('Agent\x20found!');return _[_0xe156('0x1d')](_0x41bd7b['results'],{'email':_0x21793f,'role':_0xe156('0x1e')});}else{logger[_0xe156('0xc')](_0xe156('0x1f'));return request({'uri':util['format'](_0xe156('0x20'),_0x2da161[_0xe156('0x1c')])})[_0xe156('0x17')](function(_0x2163d0){logger['info'](_0xe156('0x21'));return _0x2163d0['user'];});}});}else{logger[_0xe156('0xc')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xe156('0xe')](_0xe156('0x20'),_0x2da161[_0xe156('0x1c')])})[_0xe156('0x17')](function(_0x249967){logger[_0xe156('0xc')](_0xe156('0x21'));return _0x249967[_0xe156('0x22')];});}}function getEndUser(_0x2017ce,_0x3fe506,_0x5e90dc){logger[_0xe156('0xc')](_0xe156('0x23'),_0x5e90dc);return request({'uri':util['format'](_0xe156('0x1b'),_0x2017ce[_0xe156('0x1c')]),'qs':{'query':util[_0xe156('0xe')](_0xe156('0x24'),_0x5e90dc)}})['then'](function(_0x47180e){var _0x39537a;if(_0x47180e[_0xe156('0x25')]['length']){_0x47180e[_0xe156('0x25')]=_[_0xe156('0x26')](_0x47180e['results'],{'suspended':![],'role':'end-user'});if(_0x47180e[_0xe156('0x25')][_0xe156('0x27')]){_0x39537a=_['first'](_0x47180e['results']);}}if(_0x39537a){logger[_0xe156('0xc')](_0xe156('0x28'));return _0x39537a;}else{logger[_0xe156('0xc')](_0xe156('0x29'));return request({'uri':util['format']('%s/users.json',_0x2017ce[_0xe156('0x1c')]),'method':'POST','body':{'user':{'role':_0xe156('0x2a'),'name':util[_0xe156('0xe')](_0xe156('0x2b'),_0x3fe506||_0x5e90dc),'phone':_0x5e90dc}}})[_0xe156('0x17')](function(_0x4ea564){logger[_0xe156('0xc')]('Enduser\x20created.');return _0x4ea564[_0xe156('0x22')];});}});}function getAuth(_0x5a4e02){var _0x2a07cf;if(_0x5a4e02[_0xe156('0x2c')]===_0xe156('0x2d')){_0x2a07cf=util[_0xe156('0xe')](_0xe156('0x2e'),_0x5a4e02[_0xe156('0x2f')],_0x5a4e02[_0xe156('0x2d')]);}else if(_0x5a4e02['authType']==='token'){_0x2a07cf=util[_0xe156('0xe')](_0xe156('0x30'),_0x5a4e02[_0xe156('0x2f')],_0x5a4e02['token']);}return util[_0xe156('0xe')](_0xe156('0x31'),new Buffer(_0x2a07cf)[_0xe156('0x32')](_0xe156('0x33')));}function request(_0x931d98){logger[_0xe156('0x34')](_0xe156('0x35'),JSON[_0xe156('0x36')](_0x931d98));return rp(_[_0xe156('0x6')](_0x931d98,{'method':_0xe156('0x37'),'headers':headers,'json':!![]}));}function getTags(_0x4748e7,_0x181c46){var _0x5603b7=[];if(_0x4748e7&&_0x4748e7[_0xe156('0x27')]>0x0){_0x5603b7=_['map'](_0x4748e7,_0x181c46);}return _0x5603b7;}function getCustomFields(_0x4fbdbb,_0x156d0f){var _0x1be6eb=[];var _0x36703e={'custom_fields':[]};if(_0x4fbdbb[_0xe156('0x27')]>0x0){_[_0xe156('0x38')](_0x4fbdbb,function(_0x58a598){if(_[_0xe156('0x39')]([_0xe156('0x3a'),_0xe156('0x3b')],_0x58a598[_0xe156('0x3c')])&&_0x58a598[_0xe156('0x3d')]&&!_0x58a598['customField']){_0x36703e[_0x58a598['nameField'][_0xe156('0x3e')]()]=_0x58a598[_0xe156('0x3f')][_0xe156('0x32')]();}else if(_['includes']([_0xe156('0x3a'),_0xe156('0x3b')],_0x58a598[_0xe156('0x3c')])&&_0x58a598['idField']&&_0x58a598['customField']){_0x36703e[_0xe156('0x40')][_0xe156('0x41')]({'id':_0x58a598[_0xe156('0x42')],'value':_0x58a598[_0xe156('0x3f')]['toString']()});}else if(_0x58a598['type']===_0xe156('0x43')&&_0x58a598[_0xe156('0x44')]&&_0x58a598[_0xe156('0x42')]&&_0x58a598[_0xe156('0x45')]){_0x156d0f[_0x58a598[_0xe156('0x44')]]&&_0x36703e['custom_fields'][_0xe156('0x41')]({'id':_0x58a598[_0xe156('0x42')],'value':_0x156d0f[_0x58a598[_0xe156('0x44')]]['toString']()});}else if(_0x58a598[_0xe156('0x3c')]==='customVariable'&&_0x58a598['Variable']&&_0x58a598['Variable'][_0xe156('0x12')]&&_0x58a598[_0xe156('0x42')]&&_0x58a598[_0xe156('0x45')]){_0x156d0f[_0x58a598['Variable'][_0xe156('0x12')][_0xe156('0x3e')]()]&&_0x36703e[_0xe156('0x40')]['push']({'id':_0x58a598[_0xe156('0x42')],'value':_0x156d0f[_0x58a598['Variable'][_0xe156('0x12')][_0xe156('0x3e')]()][_0xe156('0x32')]()});}});}return _0x36703e;}exports[_0xe156('0x46')]=function(_0x3d2a5f,_0x543071,_0xa75579,_0x157903,_0x5899c1,_0x22a49a){var _0x501bc5,_0x532a7d;_0x22a49a[_0xe156('0x1c')]=intUtil[_0xe156('0x47')](_0x22a49a[_0xe156('0x1c')]);_0x22a49a['serverUrl']=intUtil[_0xe156('0x47')](_0x22a49a[_0xe156('0x48')]);if(_0x5899c1&&_0x5899c1[_0xe156('0x49')]){logger['info'](_0xe156('0x4a'),_0xe156('0x4b'));_0x543071[_0xe156('0x4c')]=util['format'](_0xe156('0x4d'),_0x22a49a['serverUrl'],_0x543071[_0xe156('0x4e')],md5(_0x543071[_0xe156('0x4e')]));}else{_0x543071[_0xe156('0x4c')]='';}headers['Authorization']=getAuth(_0x22a49a);return getUser(_0x22a49a,_0x157903[_0xe156('0x4f')])['then'](function(_0x3ee211){_0x501bc5=_0x3ee211;logger[_0xe156('0xc')]('The\x20User\x20ID\x20is:',_0x501bc5['id']);return getEndUser(_0x22a49a,_0x543071['calleridname'],_0x543071['calleridnum']);})[_0xe156('0x17')](function(_0x5b40fd){_0x532a7d=_0x5b40fd;logger['info'](_0xe156('0x50'),_0x532a7d['id']);return getTicket(_0x22a49a,_0x501bc5,_0x532a7d,_0xa75579,_0x543071);})['then'](function(_0x110f01){if(_0x110f01){logger[_0xe156('0xc')](_0xe156('0x51'),_0x110f01['id']);switch(_0x22a49a[_0xe156('0x3c')]){case _0xe156('0x52'):logger[_0xe156('0xc')](_0xe156('0x4a'),_0xe156('0x53'));return request({'uri':util[_0xe156('0xe')](_0xe156('0x54'),_0x22a49a[_0xe156('0x1c')],_0x501bc5['id'],_0x110f01['id']),'method':_0xe156('0x10')});case _0xe156('0x55'):logger['info'](_0xe156('0x4a'),_0xe156('0x56'));emit(util[_0xe156('0xe')]('user:%s',_0x157903[_0xe156('0x12')]),_0xe156('0x57'),{'uri':util[_0xe156('0xe')](_0xe156('0x58'),_0x22a49a['remoteUri'][_0xe156('0x59')](_0xe156('0x5a'),''),_0x110f01['id'])});break;default:logger[_0xe156('0x5b')](_0xe156('0x4a'),_0xe156('0x5c'));}}})[_0xe156('0x5d')](function(_0x5264a0){logger[_0xe156('0x5b')](_0xe156('0x5e'),util[_0xe156('0x5f')](_0x5264a0,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x7bcf15,_0x2902bb,_0x11ac0e,_0x4a0b17,_0x50d47f,_0x455013,_0x5781e){var _0x5bc675,_0x2154ea;_0x455013['remoteUri']=intUtil[_0xe156('0x47')](_0x455013[_0xe156('0x1c')]);_0x455013[_0xe156('0x48')]=intUtil[_0xe156('0x47')](_0x455013[_0xe156('0x48')]);if(_0x5781e&&_0x5781e['recordingFormat']&&_0x5781e[_0xe156('0x60')]!==_0xe156('0x61')){logger[_0xe156('0xc')](_0xe156('0x62'),_0xe156('0x4b'));_0x2902bb[_0xe156('0x4c')]=util[_0xe156('0xe')](_0xe156('0x4d'),_0x455013[_0xe156('0x48')],_0x2902bb[_0xe156('0x4e')],md5(_0x2902bb[_0xe156('0x4e')]));}headers[_0xe156('0x63')]=getAuth(_0x455013);return getUser(_0x455013,_0x4a0b17['email'])[_0xe156('0x17')](function(_0x165142){_0x5bc675=_0x165142;logger['info'](_0xe156('0x64'),_0x5bc675['id']);return getEndUser(_0x455013,_0x2902bb['destcalleridname'],_0x2902bb['destcalleridnum']);})[_0xe156('0x17')](function(_0x412958){_0x2154ea=_0x412958;logger['info'](_0xe156('0x50'),_0x2154ea['id']);return getTicket(_0x455013,_0x5bc675,_0x2154ea,_0x11ac0e,_0x2902bb);})[_0xe156('0x17')](function(_0x2a03e6){if(_0x2a03e6){logger[_0xe156('0xc')]('The\x20Ticket\x20ID\x20is:',_0x2a03e6['id']);switch(_0x455013[_0xe156('0x3c')]){case _0xe156('0x52'):logger[_0xe156('0xc')](_0xe156('0x62'),_0xe156('0x53'));return request({'uri':util[_0xe156('0xe')](_0xe156('0x54'),_0x455013['remoteUri'],_0x5bc675['id'],_0x2a03e6['id']),'method':_0xe156('0x10')});case'newTab':logger[_0xe156('0xc')](_0xe156('0x62'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0xe156('0x65'),_0x4a0b17['name']),_0xe156('0x57'),{'uri':util[_0xe156('0xe')](_0xe156('0x58'),_0x455013['remoteUri'][_0xe156('0x59')]('/api/v2',''),_0x2a03e6['id'])});break;default:logger[_0xe156('0x5b')](_0xe156('0x62'),_0xe156('0x5c'));}}})[_0xe156('0x5d')](function(_0x3a0c18){logger['error'](_0xe156('0x66'),util['inspect'](_0x3a0c18,{'showHidden':!![],'depth':null}));});};exports[_0xe156('0x67')]=function(_0xab1c43,_0x48de04,_0x51c92d,_0x4fe91e,_0x4e9902,_0x220324){var _0x29b9bf,_0x15e25a;_0x220324[_0xe156('0x1c')]=intUtil['stripTrailingSlash'](_0x220324[_0xe156('0x1c')]);_0x220324[_0xe156('0x48')]=intUtil[_0xe156('0x47')](_0x220324[_0xe156('0x48')]);if(_0x4e9902&&_0x4e9902[_0xe156('0x49')]){logger[_0xe156('0xc')]('['+_0x48de04[_0xe156('0x68')]['toUpperCase']()+']',_0xe156('0x4b'));_0x48de04['recordingURL']=util[_0xe156('0xe')](_0xe156('0x4d'),_0x220324[_0xe156('0x48')],_0x48de04[_0xe156('0x4e')],md5(_0x48de04[_0xe156('0x4e')]));}else{_0x48de04[_0xe156('0x4c')]='';}headers[_0xe156('0x63')]=getAuth(_0x220324);return getUser(_0x220324)[_0xe156('0x17')](function(_0x411152){_0x29b9bf=_0x411152;logger[_0xe156('0xc')](_0xe156('0x64'),_0x29b9bf['id']);return getEndUser(_0x220324,_0x48de04[_0xe156('0x69')],_0x48de04['calleridnum']);})[_0xe156('0x17')](function(_0x21b9a4){_0x15e25a=_0x21b9a4;logger[_0xe156('0xc')](_0xe156('0x50'),_0x15e25a['id']);return getTicket(_0x220324,_0x29b9bf,_0x15e25a,_0x51c92d,_0x48de04);})['then'](function(_0x31ce40){if(_0x31ce40){logger['info']('The\x20Ticket\x20ID\x20is:',_0x31ce40['id']);}})['catch'](function(_0x5e58f7){logger['error']('['+_0x48de04[_0xe156('0x68')][_0xe156('0x6a')]()+']'+_0xe156('0x6b'),util[_0xe156('0x5f')](_0x5e58f7,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xa6c4=['Variable','name','queue','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','recordingURL','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','%s/agent/tickets/%s','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','inspect','outbound','recordingFormat','none','[OUTBOUND]','uniqueid','destcalleridname','destcalleridnum','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:browser:url','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','request-promise','md5','util','ioredis','../../../../config/environment','../../../../config/logger','redis','localhost','socket.io-emitter','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','getString','Subjects','Descriptions','Fields','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','count','Agent\x20found!','find','agent','%s/users/me.json','Admin\x20account\x20selected.','user','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','results','filter','length','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','end-user','Caller\x20-\x20%s','authType','password','%s:%s','token','%s/token:%s','username','Basic\x20%s','toString','base64','[HTTP]','defaults','includes','string','type','nameField','customField','toLowerCase','content','picklist','idField','variable','variableName','custom_fields','push'];(function(_0xa03bf4,_0x529b06){var _0x33db2c=function(_0x455104){while(--_0x455104){_0xa03bf4['push'](_0xa03bf4['shift']());}};_0x33db2c(++_0x529b06);}(_0xa6c4,0x9a));var _0x4a6c=function(_0xc8db6b,_0x320abd){_0xc8db6b=_0xc8db6b-0x0;var _0x12cb81=_0xa6c4[_0xc8db6b];return _0x12cb81;};'use strict';var _=require('lodash');var rp=require(_0x4a6c('0x0'));var md5=require(_0x4a6c('0x1'));var util=require(_0x4a6c('0x2'));var Redis=require(_0x4a6c('0x3'));var intUtil=require('./util');var config=require(_0x4a6c('0x4'));var logger=require(_0x4a6c('0x5'))('zendesk');config['redis']=_['defaults'](config[_0x4a6c('0x6')],{'host':_0x4a6c('0x7'),'port':0x18eb});var io=require(_0x4a6c('0x8'))(new Redis(config[_0x4a6c('0x6')]));function emit(_0x11ce21,_0x3d8be8,_0x21ab85){io['to'](_0x11ce21)['emit'](_0x3d8be8,_0x21ab85);}var headers={'Content-Type':_0x4a6c('0x9'),'Accept':_0x4a6c('0x9')};function getTicket(_0x283d91,_0x37313c,_0x2860f7,_0x52a848,_0x42a48b){logger[_0x4a6c('0xa')](_0x4a6c('0xb'));return request({'uri':util[_0x4a6c('0xc')](_0x4a6c('0xd'),_0x283d91[_0x4a6c('0xe')]),'method':_0x4a6c('0xf'),'body':{'ticket':_['merge']({'requester_id':_0x2860f7['id'],'submitter_id':_0x37313c?_0x37313c['id']:undefined,'assignee_id':_0x37313c?_0x37313c['id']:undefined,'tags':getTags(_0x52a848['Tags'],'name'),'subject':intUtil[_0x4a6c('0x10')](_0x52a848[_0x4a6c('0x11')],_0x42a48b,'\x20'),'description':intUtil[_0x4a6c('0x10')](_0x52a848[_0x4a6c('0x12')],_0x42a48b,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x52a848[_0x4a6c('0x12')],_0x42a48b,'\x0a')}},getCustomFields(_0x52a848[_0x4a6c('0x13')],_0x42a48b))}})[_0x4a6c('0x14')](function(_0x3abd5c){logger['info'](_0x4a6c('0x15'));return _0x3abd5c[_0x4a6c('0x16')];});}function getUser(_0x4497b8,_0x64dd64){if(intUtil[_0x4a6c('0x17')](_0x64dd64)){logger[_0x4a6c('0xa')](_0x4a6c('0x18'),_0x64dd64);return request({'uri':util['format']('%s/search.json',_0x4497b8[_0x4a6c('0xe')]),'qs':{'query':util[_0x4a6c('0xc')]('type:user\x20role:agent\x20email:%s',_0x64dd64)}})[_0x4a6c('0x14')](function(_0x486252){if(_0x486252[_0x4a6c('0x19')]){logger[_0x4a6c('0xa')](_0x4a6c('0x1a'));return _[_0x4a6c('0x1b')](_0x486252['results'],{'email':_0x64dd64,'role':_0x4a6c('0x1c')});}else{logger[_0x4a6c('0xa')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x4a6c('0xc')](_0x4a6c('0x1d'),_0x4497b8['remoteUri'])})[_0x4a6c('0x14')](function(_0x3a050b){logger['info'](_0x4a6c('0x1e'));return _0x3a050b[_0x4a6c('0x1f')];});}});}else{logger['info'](_0x4a6c('0x20'));return request({'uri':util[_0x4a6c('0xc')](_0x4a6c('0x1d'),_0x4497b8[_0x4a6c('0xe')])})[_0x4a6c('0x14')](function(_0xec7710){logger[_0x4a6c('0xa')](_0x4a6c('0x1e'));return _0xec7710[_0x4a6c('0x1f')];});}}function getEndUser(_0x303f0a,_0x45362d,_0x3126ef){logger['info'](_0x4a6c('0x21'),_0x3126ef);return request({'uri':util[_0x4a6c('0xc')]('%s/search.json',_0x303f0a[_0x4a6c('0xe')]),'qs':{'query':util['format'](_0x4a6c('0x22'),_0x3126ef)}})['then'](function(_0x4318d0){var _0x585376;if(_0x4318d0[_0x4a6c('0x23')]['length']){_0x4318d0['results']=_[_0x4a6c('0x24')](_0x4318d0[_0x4a6c('0x23')],{'suspended':![],'role':'end-user'});if(_0x4318d0[_0x4a6c('0x23')][_0x4a6c('0x25')]){_0x585376=_[_0x4a6c('0x26')](_0x4318d0['results']);}}if(_0x585376){logger[_0x4a6c('0xa')](_0x4a6c('0x27'));return _0x585376;}else{logger['info'](_0x4a6c('0x28'));return request({'uri':util[_0x4a6c('0xc')](_0x4a6c('0x29'),_0x303f0a[_0x4a6c('0xe')]),'method':'POST','body':{'user':{'role':_0x4a6c('0x2a'),'name':util[_0x4a6c('0xc')](_0x4a6c('0x2b'),_0x45362d||_0x3126ef),'phone':_0x3126ef}}})[_0x4a6c('0x14')](function(_0x26ac67){logger[_0x4a6c('0xa')]('Enduser\x20created.');return _0x26ac67[_0x4a6c('0x1f')];});}});}function getAuth(_0x175ca4){var _0x3bf5c8;if(_0x175ca4[_0x4a6c('0x2c')]===_0x4a6c('0x2d')){_0x3bf5c8=util['format'](_0x4a6c('0x2e'),_0x175ca4['username'],_0x175ca4[_0x4a6c('0x2d')]);}else if(_0x175ca4['authType']===_0x4a6c('0x2f')){_0x3bf5c8=util[_0x4a6c('0xc')](_0x4a6c('0x30'),_0x175ca4[_0x4a6c('0x31')],_0x175ca4[_0x4a6c('0x2f')]);}return util[_0x4a6c('0xc')](_0x4a6c('0x32'),new Buffer(_0x3bf5c8)[_0x4a6c('0x33')](_0x4a6c('0x34')));}function request(_0x1db65d){logger['debug'](_0x4a6c('0x35'),JSON['stringify'](_0x1db65d));return rp(_[_0x4a6c('0x36')](_0x1db65d,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x9d34a1,_0x24d500){var _0x57b85f=[];if(_0x9d34a1&&_0x9d34a1[_0x4a6c('0x25')]>0x0){_0x57b85f=_['map'](_0x9d34a1,_0x24d500);}return _0x57b85f;}function getCustomFields(_0x2c4ab7,_0x3d0937){var _0x4b6a63=[];var _0x8ee76e={'custom_fields':[]};if(_0x2c4ab7['length']>0x0){_['forEach'](_0x2c4ab7,function(_0x18efb6){if(_[_0x4a6c('0x37')]([_0x4a6c('0x38'),'picklist'],_0x18efb6[_0x4a6c('0x39')])&&_0x18efb6[_0x4a6c('0x3a')]&&!_0x18efb6[_0x4a6c('0x3b')]){_0x8ee76e[_0x18efb6['nameField'][_0x4a6c('0x3c')]()]=_0x18efb6[_0x4a6c('0x3d')][_0x4a6c('0x33')]();}else if(_[_0x4a6c('0x37')]([_0x4a6c('0x38'),_0x4a6c('0x3e')],_0x18efb6['type'])&&_0x18efb6[_0x4a6c('0x3f')]&&_0x18efb6[_0x4a6c('0x3b')]){_0x8ee76e['custom_fields']['push']({'id':_0x18efb6[_0x4a6c('0x3f')],'value':_0x18efb6[_0x4a6c('0x3d')]['toString']()});}else if(_0x18efb6['type']===_0x4a6c('0x40')&&_0x18efb6[_0x4a6c('0x41')]&&_0x18efb6[_0x4a6c('0x3f')]&&_0x18efb6[_0x4a6c('0x3b')]){_0x3d0937[_0x18efb6['variableName']]&&_0x8ee76e[_0x4a6c('0x42')][_0x4a6c('0x43')]({'id':_0x18efb6['idField'],'value':_0x3d0937[_0x18efb6[_0x4a6c('0x41')]][_0x4a6c('0x33')]()});}else if(_0x18efb6[_0x4a6c('0x39')]==='customVariable'&&_0x18efb6[_0x4a6c('0x44')]&&_0x18efb6[_0x4a6c('0x44')][_0x4a6c('0x45')]&&_0x18efb6[_0x4a6c('0x3f')]&&_0x18efb6[_0x4a6c('0x3b')]){_0x3d0937[_0x18efb6['Variable']['name'][_0x4a6c('0x3c')]()]&&_0x8ee76e[_0x4a6c('0x42')][_0x4a6c('0x43')]({'id':_0x18efb6[_0x4a6c('0x3f')],'value':_0x3d0937[_0x18efb6[_0x4a6c('0x44')][_0x4a6c('0x45')]['toLowerCase']()][_0x4a6c('0x33')]()});}});}return _0x8ee76e;}exports[_0x4a6c('0x46')]=function(_0x1ea54c,_0x329ba9,_0x2efe06,_0x1dc27c,_0x461911,_0x5cdd35){var _0x1ed50b,_0x3098ed;_0x5cdd35['remoteUri']=intUtil[_0x4a6c('0x47')](_0x5cdd35['remoteUri']);_0x5cdd35[_0x4a6c('0x48')]=intUtil['stripTrailingSlash'](_0x5cdd35[_0x4a6c('0x48')]);if(_0x461911&&_0x461911[_0x4a6c('0x49')]){logger['info']('[QUEUE]',_0x4a6c('0x4a'));_0x329ba9['recordingURL']=util['format'](_0x4a6c('0x4b'),_0x5cdd35[_0x4a6c('0x48')],_0x329ba9['uniqueid'],md5(_0x329ba9['uniqueid']));}else{_0x329ba9[_0x4a6c('0x4c')]='';}headers[_0x4a6c('0x4d')]=getAuth(_0x5cdd35);return getUser(_0x5cdd35,_0x1dc27c[_0x4a6c('0x4e')])[_0x4a6c('0x14')](function(_0xdd4cd4){_0x1ed50b=_0xdd4cd4;logger[_0x4a6c('0xa')](_0x4a6c('0x4f'),_0x1ed50b['id']);return getEndUser(_0x5cdd35,_0x329ba9[_0x4a6c('0x50')],_0x329ba9[_0x4a6c('0x51')]);})[_0x4a6c('0x14')](function(_0x151c15){_0x3098ed=_0x151c15;logger[_0x4a6c('0xa')](_0x4a6c('0x52'),_0x3098ed['id']);return getTicket(_0x5cdd35,_0x1ed50b,_0x3098ed,_0x2efe06,_0x329ba9);})[_0x4a6c('0x14')](function(_0x90a5c2){if(_0x90a5c2){logger['info'](_0x4a6c('0x53'),_0x90a5c2['id']);switch(_0x5cdd35[_0x4a6c('0x39')]){case _0x4a6c('0x54'):logger[_0x4a6c('0xa')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x4a6c('0xc')](_0x4a6c('0x55'),_0x5cdd35[_0x4a6c('0xe')],_0x1ed50b['id'],_0x90a5c2['id']),'method':'POST'});case _0x4a6c('0x56'):logger[_0x4a6c('0xa')](_0x4a6c('0x57'),_0x4a6c('0x58'));emit(util[_0x4a6c('0xc')]('user:%s',_0x1dc27c['name']),'trigger:browser:url',{'uri':util[_0x4a6c('0xc')](_0x4a6c('0x59'),_0x5cdd35[_0x4a6c('0xe')][_0x4a6c('0x5a')](_0x4a6c('0x5b'),''),_0x90a5c2['id'])});break;default:logger[_0x4a6c('0x5c')]('[QUEUE]',_0x4a6c('0x5d'));}}})[_0x4a6c('0x5e')](function(_0x37b7da){logger[_0x4a6c('0x5c')]('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util[_0x4a6c('0x5f')](_0x37b7da,{'showHidden':!![],'depth':null}));});};exports[_0x4a6c('0x60')]=function(_0x520760,_0x3f971e,_0xc80e17,_0x29b515,_0x1b0c0e,_0x5c1f46,_0x28b24b){var _0x24d034,_0x4dcf6c;_0x5c1f46[_0x4a6c('0xe')]=intUtil[_0x4a6c('0x47')](_0x5c1f46[_0x4a6c('0xe')]);_0x5c1f46[_0x4a6c('0x48')]=intUtil['stripTrailingSlash'](_0x5c1f46[_0x4a6c('0x48')]);if(_0x28b24b&&_0x28b24b[_0x4a6c('0x61')]&&_0x28b24b[_0x4a6c('0x61')]!==_0x4a6c('0x62')){logger[_0x4a6c('0xa')](_0x4a6c('0x63'),_0x4a6c('0x4a'));_0x3f971e['recordingURL']=util[_0x4a6c('0xc')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5c1f46[_0x4a6c('0x48')],_0x3f971e[_0x4a6c('0x64')],md5(_0x3f971e['uniqueid']));}headers[_0x4a6c('0x4d')]=getAuth(_0x5c1f46);return getUser(_0x5c1f46,_0x29b515[_0x4a6c('0x4e')])[_0x4a6c('0x14')](function(_0x4f591e){_0x24d034=_0x4f591e;logger[_0x4a6c('0xa')]('The\x20User\x20ID\x20is:',_0x24d034['id']);return getEndUser(_0x5c1f46,_0x3f971e[_0x4a6c('0x65')],_0x3f971e[_0x4a6c('0x66')]);})[_0x4a6c('0x14')](function(_0x5c830c){_0x4dcf6c=_0x5c830c;logger['info'](_0x4a6c('0x52'),_0x4dcf6c['id']);return getTicket(_0x5c1f46,_0x24d034,_0x4dcf6c,_0xc80e17,_0x3f971e);})['then'](function(_0x54c27a){if(_0x54c27a){logger[_0x4a6c('0xa')](_0x4a6c('0x53'),_0x54c27a['id']);switch(_0x5c1f46[_0x4a6c('0x39')]){case'integrationTab':logger[_0x4a6c('0xa')]('[OUTBOUND]',_0x4a6c('0x67'));return request({'uri':util[_0x4a6c('0xc')](_0x4a6c('0x55'),_0x5c1f46[_0x4a6c('0xe')],_0x24d034['id'],_0x54c27a['id']),'method':_0x4a6c('0xf')});case'newTab':logger[_0x4a6c('0xa')](_0x4a6c('0x63'),_0x4a6c('0x58'));emit(util[_0x4a6c('0xc')](_0x4a6c('0x68'),_0x29b515[_0x4a6c('0x45')]),_0x4a6c('0x69'),{'uri':util[_0x4a6c('0xc')](_0x4a6c('0x59'),_0x5c1f46[_0x4a6c('0xe')]['replace'](_0x4a6c('0x5b'),''),_0x54c27a['id'])});break;default:logger['error'](_0x4a6c('0x63'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})['catch'](function(_0x304860){logger['error'](_0x4a6c('0x6a'),util['inspect'](_0x304860,{'showHidden':!![],'depth':null}));});};exports[_0x4a6c('0x6b')]=function(_0x5ad38a,_0x3eb752,_0x5cdffc,_0x2684fd,_0x8aa24c,_0x1120be){var _0x2219ab,_0x6e4d8c;_0x1120be['remoteUri']=intUtil['stripTrailingSlash'](_0x1120be[_0x4a6c('0xe')]);_0x1120be[_0x4a6c('0x48')]=intUtil[_0x4a6c('0x47')](_0x1120be[_0x4a6c('0x48')]);if(_0x8aa24c&&_0x8aa24c[_0x4a6c('0x49')]){logger['info']('['+_0x3eb752[_0x4a6c('0x6c')][_0x4a6c('0x6d')]()+']','Recording\x20is\x20enabled!');_0x3eb752[_0x4a6c('0x4c')]=util[_0x4a6c('0xc')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1120be[_0x4a6c('0x48')],_0x3eb752[_0x4a6c('0x64')],md5(_0x3eb752[_0x4a6c('0x64')]));}else{_0x3eb752[_0x4a6c('0x4c')]='';}headers[_0x4a6c('0x4d')]=getAuth(_0x1120be);return getUser(_0x1120be)['then'](function(_0xee27c6){_0x2219ab=_0xee27c6;logger[_0x4a6c('0xa')]('The\x20User\x20ID\x20is:',_0x2219ab['id']);return getEndUser(_0x1120be,_0x3eb752['calleridname'],_0x3eb752['calleridnum']);})[_0x4a6c('0x14')](function(_0x2f680c){_0x6e4d8c=_0x2f680c;logger[_0x4a6c('0xa')]('The\x20Enduser\x20ID\x20is:',_0x6e4d8c['id']);return getTicket(_0x1120be,_0x2219ab,_0x6e4d8c,_0x5cdffc,_0x3eb752);})[_0x4a6c('0x14')](function(_0x56ffc5){if(_0x56ffc5){logger[_0x4a6c('0xa')]('The\x20Ticket\x20ID\x20is:',_0x56ffc5['id']);}})[_0x4a6c('0x5e')](function(_0x217fda){logger[_0x4a6c('0x5c')]('['+_0x3eb752[_0x4a6c('0x6c')][_0x4a6c('0x6d')]()+']'+_0x4a6c('0x6e'),util['inspect'](_0x217fda,{'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 726dc28..a0c88db 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 _0xd594=['recordingURL','zoho.eu','com','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','[QUEUE]','outbound','recordingFormat','uniqueid','destcalleridname','destcalleridnum','[OUTBOUND]','unmanaged','toUpperCase','lodash','request-promise','md5','./util','moment','ioredis','../../../../config/environment','../../../../config/logger','zoho','defaults','redis','localhost','socket.io-emitter','debug','[HTTP]','stringify','length','forEach','idField','content','toString','type','variable','variableName','Variable','toLowerCase','name','indexOf','split','isNil','isBefore','expires_in','access_token','zone','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','/oauth/v2/token','clientId','refresh_token','then','seconds','catch','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','isArrayLikeObject','users','Agent\x20found!','Using\x20the\x20admin\x20account!','findIndex','profile','Administrator','user','The\x20failing\x20result\x20is','error','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','startCase','moduleCreate','role','first_name','last_name','code','Error:\x20','log','CREATE\x20ERROR','moduleSearch','contact_lead','uri','https://www.zohoapis.','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','Creating\x20new\x20call...','Owner','administrator','getString','Subjects','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','Call_Duration','mm:ss','endtime','utc','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','Call_Result','Called','connect','Answered','Rejected','Abandoned','timeout','Call_Start_Time','agentcalledAt','Call_Type','Inbound','/crm/v2/Calls','SUCCESS','Call\x20created!','details','err','queue','host','stripTrailingSlash','serverUrl','Recording\x20is\x20enabled!','/api/voice/recordings/','/downloads?type=uniqueid&token='];(function(_0x3708c1,_0x1e5d1c){var _0x4cedf5=function(_0xebd76e){while(--_0xebd76e){_0x3708c1['push'](_0x3708c1['shift']());}};_0x4cedf5(++_0x1e5d1c);}(_0xd594,0xab));var _0x4d59=function(_0x11cc77,_0x1d35eb){_0x11cc77=_0x11cc77-0x0;var _0x4f57a5=_0xd594[_0x11cc77];return _0x4f57a5;};'use strict';var _=require(_0x4d59('0x0'));var rp=require(_0x4d59('0x1'));var md5=require(_0x4d59('0x2'));var util=require('util');var intUtil=require(_0x4d59('0x3'));var moment=require(_0x4d59('0x4'));var Redis=require(_0x4d59('0x5'));var BPromise=require('bluebird');var config=require(_0x4d59('0x6'));var logger=require(_0x4d59('0x7'))(_0x4d59('0x8'));config['redis']=_[_0x4d59('0x9')](config[_0x4d59('0xa')],{'host':_0x4d59('0xb'),'port':0x18eb});var io=require(_0x4d59('0xc'))(new Redis(config['redis']));function emit(_0xad057b,_0x2b5446,_0x45b685){io['to'](_0xad057b)['emit'](_0x2b5446,_0x45b685);}function request(_0x50714d){logger[_0x4d59('0xd')](_0x4d59('0xe'),JSON[_0x4d59('0xf')](_0x50714d));return rp(_0x50714d);}function getCustomFields(_0x2eea9b,_0x2601a6){var _0x297db9={};if(_0x2eea9b[_0x4d59('0x10')]>0x0){_[_0x4d59('0x11')](_0x2eea9b,function(_0x204fdf){if(_['includes'](['string','picklist'],_0x204fdf['type'])&&_0x204fdf['idField']){_0x297db9[_0x204fdf[_0x4d59('0x12')]]=_0x204fdf[_0x4d59('0x13')][_0x4d59('0x14')]();}else if(_0x204fdf[_0x4d59('0x15')]===_0x4d59('0x16')&&_0x204fdf['variableName']&&_0x204fdf[_0x4d59('0x12')]&&_0x2601a6[_0x204fdf[_0x4d59('0x17')]]){_0x297db9[_0x204fdf[_0x4d59('0x12')]]=_0x2601a6[_0x204fdf[_0x4d59('0x17')]]['toString']();}else if(_0x204fdf[_0x4d59('0x15')]==='customVariable'&&_0x204fdf[_0x4d59('0x18')]&&_0x204fdf[_0x4d59('0x18')]['name']&&_0x204fdf[_0x4d59('0x12')]&&_0x2601a6[_0x204fdf[_0x4d59('0x18')]['name'][_0x4d59('0x19')]()]){_0x297db9[_0x204fdf[_0x4d59('0x12')]]=_0x2601a6[_0x204fdf[_0x4d59('0x18')][_0x4d59('0x1a')][_0x4d59('0x19')]()][_0x4d59('0x14')]();}});}return _0x297db9;}function getName(_0x44eec7){if(_0x44eec7[_0x4d59('0x1b')]('\x20')>0x0){var _0x5d943b=_0x44eec7[_0x4d59('0x1c')](/ (.+)/);if(_0x5d943b[0x1]){return _0x5d943b;}}return[_0x44eec7,_0x44eec7];}var accountsTokens={};function getAccessToken(_0x5d9294){return new Promise(function(_0x4b953,_0x1149c1){if(!_[_0x4d59('0x1d')](accountsTokens[_0x5d9294['id']])&&!_[_0x4d59('0x1d')](accountsTokens[_0x5d9294['id']]['access_token'])){if(moment()[_0x4d59('0x1e')](accountsTokens[_0x5d9294['id']][_0x4d59('0x1f')])){_0x4b953(accountsTokens[_0x5d9294['id']][_0x4d59('0x20')]);}}var _0x404363;switch(_0x5d9294[_0x4d59('0x21')]){case'US':_0x404363=_0x4d59('0x22');break;case'AU':_0x404363='https://accounts.zoho.com.au';break;case'EU':_0x404363=_0x4d59('0x23');break;case'IN':_0x404363='https://accounts.zoho.in';break;case'CN':_0x404363=_0x4d59('0x24');break;default:_0x404363=_0x4d59('0x23');break;}var _0x1b0bc4={'method':_0x4d59('0x25'),'uri':_0x404363+_0x4d59('0x26'),'qs':{'refresh_token':_0x5d9294['refreshToken'],'client_id':_0x5d9294[_0x4d59('0x27')],'client_secret':_0x5d9294['clientSecret'],'grant_type':_0x4d59('0x28')},'json':!![]};return rp(_0x1b0bc4)[_0x4d59('0x29')](function(_0x1021c0){accountsTokens[_0x5d9294['id']]={'access_token':_0x1021c0[_0x4d59('0x20')],'expires_in':moment()['add'](_0x1021c0[_0x4d59('0x1f')],_0x4d59('0x2a'))};_0x4b953(_0x1021c0['access_token']);})[_0x4d59('0x2b')](function(_0x2aa7b3){logger['error'](_0x4d59('0x2c'),_0x2aa7b3[_0x4d59('0x2d')]);_0x1149c1(_0x2aa7b3);});});}function getUser(_0x11013c,_0x14a919,_0x1b40ea,_0x3383d4){logger[_0x4d59('0x2e')](_0x4d59('0x2f'));return request({'method':_0x4d59('0x30'),'uri':util[_0x4d59('0x31')](_0x4d59('0x32'),_0x14a919),'qs':{'type':_0x4d59('0x33')},'headers':{'Authorization':_0x4d59('0x34')+_0x11013c},'json':!![]})[_0x4d59('0x29')](function(_0x500c62){if(_0x500c62['users']){var _0x1f8b1a=-0x1;if(_[_0x4d59('0x35')](_0x500c62[_0x4d59('0x36')])){if(!_[_0x4d59('0x1d')](_0x3383d4)){_0x1f8b1a=_['findIndex'](_0x500c62[_0x4d59('0x36')],function(_0x443a7c){return _0x443a7c['email']===_0x3383d4;});}if(_0x1f8b1a>=0x0){logger['info'](_0x4d59('0x37'));}else{logger[_0x4d59('0x2e')](_0x4d59('0x38'));_0x1f8b1a=_[_0x4d59('0x39')](_0x500c62[_0x4d59('0x36')],function(_0x29bfd1){return _0x29bfd1[_0x4d59('0x3a')][_0x4d59('0x1a')]===_0x4d59('0x3b');});}return _0x500c62[_0x4d59('0x36')][_0x1f8b1a];}else{if(_0x500c62['user'][_0x4d59('0x3a')][_0x4d59('0x1a')]===_0x4d59('0x3b')){logger[_0x4d59('0x2e')]('Using\x20the\x20admin\x20account!');user=_0x500c62[_0x4d59('0x3c')];return user;}else{logger['error'](_0x4d59('0x3d'),JSON[_0x4d59('0xf')](_0x500c62));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x4d59('0xf')](_0x500c62));}}}else{logger[_0x4d59('0x3e')](_0x4d59('0x3d'),JSON['stringify'](_0x500c62));throw new Error(_0x4d59('0x3f')+JSON[_0x4d59('0xf')](_0x500c62));}})[_0x4d59('0x2b')](function(_0x13cdd8){console[_0x4d59('0x3e')](_0x13cdd8);});}function getZohoUser(_0x1bfbf5,_0x486bde){return new BPromise(function(_0x4f77d3,_0x2d7677){request(_0x1bfbf5)[_0x4d59('0x29')](function(_0x21e41e){var _0x2e131d=null;if(_0x21e41e){_0x2e131d=_0x21e41e[_0x4d59('0x40')][0x0];_0x2e131d[_0x4d59('0x41')]=_0x486bde;}_0x4f77d3(_0x2e131d);})[_0x4d59('0x2b')](function(_0x105b5d){_0x2d7677(_0x105b5d);});});}function createEndUser(_0x41961d,_0x4b9cd8,_0x711252,_0x567e99,_0x112857,_0x7e2441){var _0x711252=getName(_0x711252);return request({'method':_0x4d59('0x25'),'uri':'https://www.zohoapis.'+_0x4b9cd8+'/crm/v2/'+_[_0x4d59('0x42')](_0x7e2441[_0x4d59('0x43')])+'s','body':{'data':[{'Last_Name':_0x711252[0x1],'First_Name':_0x711252[0x0],'Phone':_0x567e99,'Owner':{'name':!_[_0x4d59('0x1d')](_0x112857[_0x4d59('0x44')][_0x4d59('0x1a')])?_0x112857[_0x4d59('0x44')][_0x4d59('0x1a')]:!_[_0x4d59('0x1d')](_0x112857[_0x4d59('0x45')])?_0x112857[_0x4d59('0x45')]+'\x20'+_0x112857['last_name']:_0x112857[_0x4d59('0x46')],'id':_0x112857['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x41961d},'json':!![]})[_0x4d59('0x29')](function(_0x178220){if(_0x178220&&_0x178220[_0x4d59('0x40')][0x0][_0x4d59('0x47')]==='SUCCESS'){var _0x21e03c=_0x178220['data'][0x0]['details'];_0x21e03c[_0x4d59('0x41')]=_[_0x4d59('0x42')](_0x7e2441[_0x4d59('0x43')])+'s';return _0x21e03c;}logger[_0x4d59('0x3e')](_0x4d59('0x3d'),JSON['stringify'](data));throw new Error(_0x4d59('0x48')+JSON['stringify'](data));})[_0x4d59('0x2b')](function(_0x4efe15){console[_0x4d59('0x49')](_0x4d59('0x4a'),_0x4efe15);});}function getEndUser(_0x3dcad3,_0x190a4d,_0x2c750a,_0x537934,_0x1d3647,_0x284797,_0x1d46c6){var _0x18394d={'method':'GET','uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x3dcad3},'json':!![]};switch(_0x1d46c6[_0x4d59('0x4b')]){case _0x4d59('0x4c'):_0x18394d[_0x4d59('0x4d')]=_0x4d59('0x4e')+_0x190a4d+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x1d3647+'))';return getZohoUser(_0x18394d,_0x4d59('0x4f'))['then'](function(_0x450e82){if(_0x450e82)return _0x450e82;_0x18394d[_0x4d59('0x4d')]='https://www.zohoapis.'+_0x190a4d+_0x4d59('0x50')+_0x1d3647+'))';return getZohoUser(_0x18394d,_0x4d59('0x51'))['then'](function(_0x5a0ce4){if(_0x5a0ce4)return _0x5a0ce4;if(_0x1d46c6[_0x4d59('0x43')]!=_0x4d59('0x52')){return createEndUser(_0x3dcad3,_0x190a4d,_0x537934,_0x1d3647,_0x284797,_0x1d46c6);}else{return{};}});});break;case _0x4d59('0x53'):_0x18394d['uri']=_0x4d59('0x4e')+_0x190a4d+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x1d3647+'))';return getZohoUser(_0x18394d,'Contacts')[_0x4d59('0x29')](function(_0x3d643b){if(_0x3d643b)return _0x3d643b;if(_0x1d46c6[_0x4d59('0x43')]!=_0x4d59('0x52')){return createEndUser(_0x3dcad3,_0x190a4d,_0x537934,_0x1d3647,_0x284797,_0x1d46c6);}else{return{};}});break;case'lead':_0x18394d[_0x4d59('0x4d')]=_0x4d59('0x4e')+_0x190a4d+_0x4d59('0x50')+_0x1d3647+'))';return getZohoUser(_0x18394d,_0x4d59('0x51'))[_0x4d59('0x29')](function(_0x893a00){if(_0x893a00)return _0x893a00;if(_0x1d46c6[_0x4d59('0x43')]!=_0x4d59('0x52')){return createEndUser(_0x3dcad3,_0x190a4d,_0x537934,_0x1d3647,_0x284797,_0x1d46c6);}else{return{};}});break;}}function getCall(_0x589aa6,_0x3f6efa,_0x158ff7,_0x24535a,_0x469bb9,_0xc152e6,_0x502e16,_0x4ad5c6){logger[_0x4d59('0x2e')](_0x4d59('0x54'));var _0x7b782d={};_0x7b782d[_0x4d59('0x55')]={'name':!_[_0x4d59('0x1d')](_0x24535a[_0x4d59('0x44')][_0x4d59('0x1a')])&&!_[_0x4d59('0x1d')](_0x24535a['profile'][_0x4d59('0x1a')])&&_0x24535a[_0x4d59('0x3a')][_0x4d59('0x1a')]===_0x4d59('0x56')?_0x24535a[_0x4d59('0x44')][_0x4d59('0x1a')]:!_['isNil'](_0x24535a[_0x4d59('0x45')])?_0x24535a[_0x4d59('0x45')]+'\x20'+_0x24535a['last_name']:_0x24535a[_0x4d59('0x46')],'id':_0x24535a['id']};_0x7b782d['Subject']=intUtil[_0x4d59('0x57')](_0xc152e6[_0x4d59('0x58')],_0x502e16,'\x20');_0x7b782d[_0x4d59('0x59')]=intUtil[_0x4d59('0x57')](_0xc152e6[_0x4d59('0x5a')],_0x502e16,'\x0a');if(_0x469bb9[_0x4d59('0x41')]===_0x4d59('0x4f')){_0x7b782d[_0x4d59('0x5b')]={'name':!_[_0x4d59('0x1d')](_0x469bb9[_0x4d59('0x5c')])?_0x469bb9['Full_Name']:!_['isNil'](_0x469bb9['First_Name'])?_0x469bb9[_0x4d59('0x5d')]+'\x20'+_0x469bb9[_0x4d59('0x5e')]:_0x469bb9[_0x4d59('0x5e')],'id':_0x469bb9['id']};}if(_0x469bb9[_0x4d59('0x41')]===_0x4d59('0x51')){_0x7b782d[_0x4d59('0x5f')]={'name':!_['isNil'](_0x469bb9[_0x4d59('0x5c')])?_0x469bb9[_0x4d59('0x5c')]:!_[_0x4d59('0x1d')](_0x469bb9['First_Name'])?_0x469bb9[_0x4d59('0x5d')]+'\x20'+_0x469bb9[_0x4d59('0x5e')]:_0x469bb9[_0x4d59('0x5e')],'id':_0x469bb9['id']};_0x7b782d[_0x4d59('0x60')]=_[_0x4d59('0x42')](_0x469bb9[_0x4d59('0x41')]);}if(_0x502e16[_0x4d59('0x61')]){_0x7b782d[_0x4d59('0x62')]=moment['utc'](parseInt(_0x502e16[_0x4d59('0x61')])*0x3e8)['format'](_0x4d59('0x63'));}else if(_0x502e16['answertime']&&_0x502e16[_0x4d59('0x64')]){_0x7b782d[_0x4d59('0x62')]=moment[_0x4d59('0x65')](moment(_0x502e16[_0x4d59('0x64')],_0x4d59('0x66'))[_0x4d59('0x67')](moment(_0x502e16[_0x4d59('0x68')],_0x4d59('0x66'))))['format'](_0x4d59('0x63'));}switch(_0x502e16[_0x4d59('0x69')]){case'called':_0x7b782d[_0x4d59('0x6a')]=_0x4d59('0x6b');break;case'complete':case _0x4d59('0x6c'):_0x7b782d['Call_Result']=_0x4d59('0x6d');break;case'rejected':_0x7b782d['Call_Result']=_0x4d59('0x6e');break;case'abandoned':_0x7b782d[_0x4d59('0x6a')]=_0x4d59('0x6f');break;case _0x4d59('0x70'):_0x7b782d['Call_Result']='Timeout';default:}_0x7b782d[_0x4d59('0x71')]=(_0x4ad5c6==='outbound'?moment(_0x502e16[_0x4d59('0x68')])['format'](_0x4d59('0x66')):moment(_0x502e16[_0x4d59('0x72')])['format'](_0x4d59('0x66')))||moment()[_0x4d59('0x31')](_0x4d59('0x66'));_0x7b782d[_0x4d59('0x73')]=_0x4ad5c6||_0x4d59('0x74');_0x7b782d=_['merge'](_0x7b782d,getCustomFields(_0xc152e6['Fields'],_0x502e16));return request({'method':_0x4d59('0x25'),'uri':_0x4d59('0x4e')+_0x3f6efa+_0x4d59('0x75'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x589aa6},'body':{'data':[_0x7b782d]},'json':!![]})[_0x4d59('0x29')](function(_0x4dc608){if(_0x4dc608&&_0x4dc608[_0x4d59('0x40')][0x0]['code']===_0x4d59('0x76')){logger[_0x4d59('0x2e')](_0x4d59('0x77'));return{'id':_0x4dc608[_0x4d59('0x40')][0x0][_0x4d59('0x78')]['id']};}})['catch'](function(_0x3d11a9){logger[_0x4d59('0x2e')](_0x4d59('0x79'),_0x3d11a9[_0x4d59('0x2d')]);console['log'](_0x4d59('0x79'),_0x3d11a9);});}exports[_0x4d59('0x7a')]=function(_0xf4e374,_0x3a6e3c,_0x3f5fc9,_0x490bbe,_0x23ed08,_0xf2d715){var _0x3d4f80,_0x24daa,_0x3c5b19;_0xf2d715[_0x4d59('0x7b')]=intUtil[_0x4d59('0x7c')](_0xf2d715[_0x4d59('0x7b')]);_0xf2d715[_0x4d59('0x7d')]=intUtil[_0x4d59('0x7c')](_0xf2d715[_0x4d59('0x7d')]);if(_0x23ed08&&_0x23ed08['monitor_format']){logger['info']('[QUEUE]',_0x4d59('0x7e'));_0x3a6e3c['recordingURL']=_0xf2d715[_0x4d59('0x7d')]+_0x4d59('0x7f')+_0x3a6e3c['uniqueid']+_0x4d59('0x80')+md5(_0x3a6e3c['uniqueid']);}else{_0x3a6e3c[_0x4d59('0x81')]='';}var _0xe6ebe5=_0xf2d715[_0x4d59('0x7b')]===_0x4d59('0x82')?'eu':_0x4d59('0x83');return getAccessToken(_0xf2d715)[_0x4d59('0x29')](function(_0x8273ec){_0x3c5b19=_0x8273ec;return getUser(_0x3c5b19,_0xe6ebe5,_0xf2d715,_0x490bbe[_0x4d59('0x84')]);})[_0x4d59('0x29')](function(_0x403903){_0x3d4f80=_0x403903;logger['info'](_0x4d59('0x85'),_0x3d4f80['id']);return getEndUser(_0x3c5b19,_0xe6ebe5,_0xf2d715,_0x3a6e3c[_0x4d59('0x86')],_0x3a6e3c[_0x4d59('0x87')],_0x3d4f80,_0x3f5fc9);})[_0x4d59('0x29')](function(_0x2a5a90){_0x24daa=_0x2a5a90;return getCall(_0x3c5b19,_0xe6ebe5,_0xf2d715,_0x3d4f80,_0x24daa,_0x3f5fc9,_0x3a6e3c,'Inbound');})[_0x4d59('0x29')](function(_0x1b5cb1){if(_0x1b5cb1){logger[_0x4d59('0x2e')](_0x4d59('0x88'),_0x1b5cb1['id']);logger[_0x4d59('0x2e')]('[QUEUE]',_0x4d59('0x89'));emit(util[_0x4d59('0x31')](_0x4d59('0x8a'),_0x490bbe[_0x4d59('0x1a')]),_0x4d59('0x8b'),{'uri':_0x4d59('0x8c')+_0xf2d715['host']+'/crm/EntityInfo.do?module=Calls&id='+_0x1b5cb1['id']});}})[_0x4d59('0x2b')](function(_0x466b49){logger[_0x4d59('0x3e')](_0x4d59('0x8d'),JSON['stringify'](_0x466b49));});};exports[_0x4d59('0x8e')]=function(_0x4929cb,_0x288417,_0x203c7c,_0x5b1e15,_0x462e54,_0x20954c,_0x430fd7){var _0x3ce4e8,_0x1dcecc,_0x19076a;_0x20954c[_0x4d59('0x7b')]=intUtil[_0x4d59('0x7c')](_0x20954c[_0x4d59('0x7b')]);_0x20954c[_0x4d59('0x7d')]=intUtil[_0x4d59('0x7c')](_0x20954c[_0x4d59('0x7d')]);if(_0x430fd7&&_0x430fd7[_0x4d59('0x8f')]&&_0x430fd7[_0x4d59('0x8f')]!=='none'){logger[_0x4d59('0x2e')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x288417[_0x4d59('0x81')]=_0x20954c[_0x4d59('0x7d')]+_0x4d59('0x7f')+_0x288417[_0x4d59('0x90')]+'/downloads?type=uniqueid&token='+md5(_0x288417[_0x4d59('0x90')]);}var _0x4abbbd=_0x20954c[_0x4d59('0x7b')]===_0x4d59('0x82')?'eu':_0x4d59('0x83');return getAccessToken(_0x20954c)[_0x4d59('0x29')](function(_0x3224bc){_0x19076a=_0x3224bc;return getUser(_0x19076a,_0x4abbbd,_0x20954c,_0x5b1e15[_0x4d59('0x84')]);})[_0x4d59('0x29')](function(_0x44f024){_0x3ce4e8=_0x44f024;logger[_0x4d59('0x2e')](_0x4d59('0x85'),_0x3ce4e8['id']);return getEndUser(_0x19076a,_0x4abbbd,_0x20954c,_0x288417[_0x4d59('0x91')],_0x288417[_0x4d59('0x92')],_0x3ce4e8,_0x203c7c);})[_0x4d59('0x29')](function(_0x4f1048){_0x1dcecc=_0x4f1048;return getCall(_0x19076a,_0x4abbbd,_0x20954c,_0x3ce4e8,_0x1dcecc,_0x203c7c,_0x288417,'Outbound');})['then'](function(_0x49af00){if(_0x49af00){logger[_0x4d59('0x2e')](_0x4d59('0x88'),_0x49af00['id']);logger[_0x4d59('0x2e')](_0x4d59('0x93'),_0x4d59('0x89'));emit(util[_0x4d59('0x31')]('user:%s',_0x5b1e15[_0x4d59('0x1a')]),_0x4d59('0x8b'),{'uri':_0x4d59('0x8c')+_0x20954c[_0x4d59('0x7b')]+'/crm/EntityInfo.do?module=Calls&id='+_0x49af00['id']});}})['catch'](function(_0x266902){logger[_0x4d59('0x3e')](_0x4d59('0x93'),JSON[_0x4d59('0xf')](_0x266902));});};exports[_0x4d59('0x94')]=function(_0x158b81,_0x53dad0,_0x2a25f6,_0x30901f,_0x1d8aa0,_0x5666db){var _0x37dac7,_0x660303,_0xf7cf95;_0x5666db[_0x4d59('0x7b')]=intUtil[_0x4d59('0x7c')](_0x5666db[_0x4d59('0x7b')]);_0x5666db[_0x4d59('0x7d')]=intUtil[_0x4d59('0x7c')](_0x5666db['serverUrl']);if(_0x1d8aa0&&_0x1d8aa0['monitor_format']){logger[_0x4d59('0x2e')]('['+_0x53dad0[_0x4d59('0x69')][_0x4d59('0x95')]()+']',_0x4d59('0x7e'));_0x53dad0[_0x4d59('0x81')]=_0x5666db['serverUrl']+_0x4d59('0x7f')+_0x53dad0[_0x4d59('0x90')]+_0x4d59('0x80')+md5(_0x53dad0[_0x4d59('0x90')]);}else{_0x53dad0[_0x4d59('0x81')]='';}var _0x5760be=_0x5666db[_0x4d59('0x7b')]===_0x4d59('0x82')?'eu':_0x4d59('0x83');return getAccessToken(_0x5666db)[_0x4d59('0x29')](function(_0x42fe81){_0xf7cf95=_0x42fe81;return getUser(_0xf7cf95,_0x5760be,_0x5666db);})[_0x4d59('0x29')](function(_0x45f00e){_0x37dac7=_0x45f00e;logger[_0x4d59('0x2e')](_0x4d59('0x85'),_0x37dac7['id']);return getEndUser(_0xf7cf95,_0x5760be,_0x5666db,_0x53dad0[_0x4d59('0x86')],_0x53dad0[_0x4d59('0x87')],_0x37dac7,_0x2a25f6);})['then'](function(_0x3da804){_0x660303=_0x3da804;return getCall(_0xf7cf95,_0x5760be,_0x5666db,_0x37dac7,_0x660303,_0x2a25f6,_0x53dad0,_0x4d59('0x74'));})[_0x4d59('0x29')](function(_0x4d1033){if(_0x4d1033){logger[_0x4d59('0x2e')](_0x4d59('0x88'),_0x4d1033['id']);}})[_0x4d59('0x2b')](function(_0x1932f0){logger[_0x4d59('0x3e')]('['+_0x53dad0[_0x4d59('0x69')][_0x4d59('0x95')]()+']',JSON['stringify'](_0x1932f0));});}; \ No newline at end of file +var _0xde5d=['Subjects','Description','Who_Id','Full_Name','First_Name','Last_Name','Leads','What_Id','$se_module','talktime','Call_Duration','utc','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','Call_Result','Answered','rejected','Rejected','abandoned','Timeout','Call_Start_Time','outbound','agentcalledAt','Call_Type','Inbound','merge','Fields','/crm/v2/Calls','details','err','stack','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','destcalleridname','Outbound','The\x20Call\x20ID\x20is:','[OUTBOUND]','unmanaged','toUpperCase','lodash','md5','util','ioredis','bluebird','../../../../config/environment','zoho','redis','defaults','socket.io-emitter','emit','debug','stringify','length','forEach','includes','type','idField','variable','variableName','Variable','name','toLowerCase','toString','indexOf','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','refresh_token','then','add','catch','Failing\x20creating\x20the\x20access_token','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','isArrayLikeObject','findIndex','email','Agent\x20found!','info','Using\x20the\x20admin\x20account!','users','Administrator','user','profile','error','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','https://www.zohoapis.','/crm/v2/','startCase','role','first_name','last_name','code','SUCCESS','moduleCreate','The\x20failing\x20result\x20is','Error:\x20','log','CREATE\x20ERROR','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','lead','nothing','Creating\x20new\x20call...','Owner','Subject','getString'];(function(_0x307296,_0x49b881){var _0x32f975=function(_0x4ed150){while(--_0x4ed150){_0x307296['push'](_0x307296['shift']());}};_0x32f975(++_0x49b881);}(_0xde5d,0xd7));var _0xdde5=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xde5d[_0x432682];return _0x463d05;};'use strict';var _=require(_0xdde5('0x0'));var rp=require('request-promise');var md5=require(_0xdde5('0x1'));var util=require(_0xdde5('0x2'));var intUtil=require('./util');var moment=require('moment');var Redis=require(_0xdde5('0x3'));var BPromise=require(_0xdde5('0x4'));var config=require(_0xdde5('0x5'));var logger=require('../../../../config/logger')(_0xdde5('0x6'));config[_0xdde5('0x7')]=_[_0xdde5('0x8')](config[_0xdde5('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0xdde5('0x9'))(new Redis(config['redis']));function emit(_0x39b7f0,_0x560b14,_0x3cfb8f){io['to'](_0x39b7f0)[_0xdde5('0xa')](_0x560b14,_0x3cfb8f);}function request(_0x501ef0){logger[_0xdde5('0xb')]('[HTTP]',JSON[_0xdde5('0xc')](_0x501ef0));return rp(_0x501ef0);}function getCustomFields(_0x114b1a,_0x74e206){var _0x5dde60={};if(_0x114b1a[_0xdde5('0xd')]>0x0){_[_0xdde5('0xe')](_0x114b1a,function(_0x133841){if(_[_0xdde5('0xf')](['string','picklist'],_0x133841[_0xdde5('0x10')])&&_0x133841[_0xdde5('0x11')]){_0x5dde60[_0x133841[_0xdde5('0x11')]]=_0x133841['content']['toString']();}else if(_0x133841[_0xdde5('0x10')]===_0xdde5('0x12')&&_0x133841['variableName']&&_0x133841['idField']&&_0x74e206[_0x133841[_0xdde5('0x13')]]){_0x5dde60[_0x133841[_0xdde5('0x11')]]=_0x74e206[_0x133841[_0xdde5('0x13')]]['toString']();}else if(_0x133841[_0xdde5('0x10')]==='customVariable'&&_0x133841[_0xdde5('0x14')]&&_0x133841[_0xdde5('0x14')][_0xdde5('0x15')]&&_0x133841[_0xdde5('0x11')]&&_0x74e206[_0x133841[_0xdde5('0x14')]['name'][_0xdde5('0x16')]()]){_0x5dde60[_0x133841['idField']]=_0x74e206[_0x133841[_0xdde5('0x14')][_0xdde5('0x15')][_0xdde5('0x16')]()][_0xdde5('0x17')]();}});}return _0x5dde60;}function getName(_0x5149f8){if(_0x5149f8[_0xdde5('0x18')]('\x20')>0x0){var _0x21003f=_0x5149f8['split'](/ (.+)/);if(_0x21003f[0x1]){return _0x21003f;}}return[_0x5149f8,_0x5149f8];}var accountsTokens={};function getAccessToken(_0x25f516){return new Promise(function(_0x1e6e6b,_0x29c1b2){if(!_[_0xdde5('0x19')](accountsTokens[_0x25f516['id']])&&!_[_0xdde5('0x19')](accountsTokens[_0x25f516['id']][_0xdde5('0x1a')])){if(moment()[_0xdde5('0x1b')](accountsTokens[_0x25f516['id']][_0xdde5('0x1c')])){_0x1e6e6b(accountsTokens[_0x25f516['id']][_0xdde5('0x1a')]);}}var _0x30b2a3;switch(_0x25f516[_0xdde5('0x1d')]){case'US':_0x30b2a3=_0xdde5('0x1e');break;case'AU':_0x30b2a3=_0xdde5('0x1f');break;case'EU':_0x30b2a3=_0xdde5('0x20');break;case'IN':_0x30b2a3='https://accounts.zoho.in';break;case'CN':_0x30b2a3=_0xdde5('0x21');break;default:_0x30b2a3=_0xdde5('0x20');break;}var _0x252b60={'method':_0xdde5('0x22'),'uri':_0x30b2a3+_0xdde5('0x23'),'qs':{'refresh_token':_0x25f516[_0xdde5('0x24')],'client_id':_0x25f516[_0xdde5('0x25')],'client_secret':_0x25f516['clientSecret'],'grant_type':_0xdde5('0x26')},'json':!![]};return rp(_0x252b60)[_0xdde5('0x27')](function(_0x40f66e){accountsTokens[_0x25f516['id']]={'access_token':_0x40f66e[_0xdde5('0x1a')],'expires_in':moment()[_0xdde5('0x28')](_0x40f66e[_0xdde5('0x1c')],'seconds')};_0x1e6e6b(_0x40f66e['access_token']);})[_0xdde5('0x29')](function(_0x53c7f9){logger['error'](_0xdde5('0x2a'),_0x53c7f9['stack']);_0x29c1b2(_0x53c7f9);});});}function getUser(_0x178657,_0x2b536a,_0x260694,_0xa5e3e2){logger['info'](_0xdde5('0x2b'));return request({'method':_0xdde5('0x2c'),'uri':util[_0xdde5('0x2d')](_0xdde5('0x2e'),_0x2b536a),'qs':{'type':_0xdde5('0x2f')},'headers':{'Authorization':_0xdde5('0x30')+_0x178657},'json':!![]})[_0xdde5('0x27')](function(_0x4b05c7){if(_0x4b05c7['users']){var _0x5aa092=-0x1;if(_[_0xdde5('0x31')](_0x4b05c7['users'])){if(!_['isNil'](_0xa5e3e2)){_0x5aa092=_[_0xdde5('0x32')](_0x4b05c7['users'],function(_0x393755){return _0x393755[_0xdde5('0x33')]===_0xa5e3e2;});}if(_0x5aa092>=0x0){logger['info'](_0xdde5('0x34'));}else{logger[_0xdde5('0x35')](_0xdde5('0x36'));_0x5aa092=_['findIndex'](_0x4b05c7[_0xdde5('0x37')],function(_0x405483){return _0x405483['profile']['name']===_0xdde5('0x38');});}return _0x4b05c7[_0xdde5('0x37')][_0x5aa092];}else{if(_0x4b05c7[_0xdde5('0x39')][_0xdde5('0x3a')][_0xdde5('0x15')]==='Administrator'){logger[_0xdde5('0x35')](_0xdde5('0x36'));user=_0x4b05c7[_0xdde5('0x39')];return user;}else{logger[_0xdde5('0x3b')]('The\x20failing\x20result\x20is',JSON[_0xdde5('0xc')](_0x4b05c7));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0xdde5('0xc')](_0x4b05c7));}}}else{logger[_0xdde5('0x3b')]('The\x20failing\x20result\x20is',JSON[_0xdde5('0xc')](_0x4b05c7));throw new Error(_0xdde5('0x3c')+JSON[_0xdde5('0xc')](_0x4b05c7));}})[_0xdde5('0x29')](function(_0x392181){console[_0xdde5('0x3b')](_0x392181);});}function getZohoUser(_0x2184e5,_0x34317f){return new BPromise(function(_0x303489,_0x1f3a94){request(_0x2184e5)['then'](function(_0x250739){var _0x2e9dcf=null;if(_0x250739){_0x2e9dcf=_0x250739[_0xdde5('0x3d')][0x0];_0x2e9dcf[_0xdde5('0x3e')]=_0x34317f;}_0x303489(_0x2e9dcf);})[_0xdde5('0x29')](function(_0x2ac370){_0x1f3a94(_0x2ac370);});});}function createEndUser(_0x1e4111,_0x21648f,_0x1db539,_0x591957,_0x1d15d1,_0x4695d1){var _0x1db539=getName(_0x1db539);return request({'method':_0xdde5('0x22'),'uri':_0xdde5('0x3f')+_0x21648f+_0xdde5('0x40')+_[_0xdde5('0x41')](_0x4695d1['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x1db539[0x1],'First_Name':_0x1db539[0x0],'Phone':_0x591957,'Owner':{'name':!_[_0xdde5('0x19')](_0x1d15d1['role']['name'])?_0x1d15d1[_0xdde5('0x42')][_0xdde5('0x15')]:!_[_0xdde5('0x19')](_0x1d15d1[_0xdde5('0x43')])?_0x1d15d1[_0xdde5('0x43')]+'\x20'+_0x1d15d1[_0xdde5('0x44')]:_0x1d15d1[_0xdde5('0x44')],'id':_0x1d15d1['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x1e4111},'json':!![]})[_0xdde5('0x27')](function(_0x1760f8){if(_0x1760f8&&_0x1760f8[_0xdde5('0x3d')][0x0][_0xdde5('0x45')]===_0xdde5('0x46')){var _0x25bee9=_0x1760f8[_0xdde5('0x3d')][0x0]['details'];_0x25bee9[_0xdde5('0x3e')]=_[_0xdde5('0x41')](_0x4695d1[_0xdde5('0x47')])+'s';return _0x25bee9;}logger[_0xdde5('0x3b')](_0xdde5('0x48'),JSON[_0xdde5('0xc')](data));throw new Error(_0xdde5('0x49')+JSON[_0xdde5('0xc')](data));})[_0xdde5('0x29')](function(_0x477a23){console[_0xdde5('0x4a')](_0xdde5('0x4b'),_0x477a23);});}function getEndUser(_0x6fa32d,_0x50c79a,_0x58a48d,_0x3f26f6,_0x56f224,_0x3acb7e,_0x5c4335){var _0x4fedc5={'method':_0xdde5('0x2c'),'uri':'','headers':{'Authorization':_0xdde5('0x30')+_0x6fa32d},'json':!![]};switch(_0x5c4335['moduleSearch']){case _0xdde5('0x4c'):_0x4fedc5[_0xdde5('0x4d')]=_0xdde5('0x3f')+_0x50c79a+_0xdde5('0x4e')+_0x56f224+'))';return getZohoUser(_0x4fedc5,_0xdde5('0x4f'))[_0xdde5('0x27')](function(_0x5972d8){if(_0x5972d8)return _0x5972d8;_0x4fedc5[_0xdde5('0x4d')]='https://www.zohoapis.'+_0x50c79a+_0xdde5('0x50')+_0x56f224+'))';return getZohoUser(_0x4fedc5,'Leads')[_0xdde5('0x27')](function(_0xc76fdb){if(_0xc76fdb)return _0xc76fdb;if(_0x5c4335[_0xdde5('0x47')]!='nothing'){return createEndUser(_0x6fa32d,_0x50c79a,_0x3f26f6,_0x56f224,_0x3acb7e,_0x5c4335);}else{return{};}});});break;case'contact':_0x4fedc5['uri']=_0xdde5('0x3f')+_0x50c79a+_0xdde5('0x4e')+_0x56f224+'))';return getZohoUser(_0x4fedc5,_0xdde5('0x4f'))[_0xdde5('0x27')](function(_0x50bb99){if(_0x50bb99)return _0x50bb99;if(_0x5c4335[_0xdde5('0x47')]!='nothing'){return createEndUser(_0x6fa32d,_0x50c79a,_0x3f26f6,_0x56f224,_0x3acb7e,_0x5c4335);}else{return{};}});break;case _0xdde5('0x51'):_0x4fedc5['uri']='https://www.zohoapis.'+_0x50c79a+_0xdde5('0x50')+_0x56f224+'))';return getZohoUser(_0x4fedc5,'Leads')['then'](function(_0x15e4e9){if(_0x15e4e9)return _0x15e4e9;if(_0x5c4335[_0xdde5('0x47')]!=_0xdde5('0x52')){return createEndUser(_0x6fa32d,_0x50c79a,_0x3f26f6,_0x56f224,_0x3acb7e,_0x5c4335);}else{return{};}});break;}}function getCall(_0x186e6,_0x113e91,_0x3abfc3,_0x321a08,_0x1b7c5b,_0x2ca8a6,_0x3eac1b,_0x1f2beb){logger['info'](_0xdde5('0x53'));var _0x11fb7c={};_0x11fb7c[_0xdde5('0x54')]={'name':!_['isNil'](_0x321a08[_0xdde5('0x42')][_0xdde5('0x15')])&&!_['isNil'](_0x321a08[_0xdde5('0x3a')][_0xdde5('0x15')])&&_0x321a08['profile']['name']==='administrator'?_0x321a08[_0xdde5('0x42')][_0xdde5('0x15')]:!_[_0xdde5('0x19')](_0x321a08[_0xdde5('0x43')])?_0x321a08['first_name']+'\x20'+_0x321a08[_0xdde5('0x44')]:_0x321a08[_0xdde5('0x44')],'id':_0x321a08['id']};_0x11fb7c[_0xdde5('0x55')]=intUtil[_0xdde5('0x56')](_0x2ca8a6[_0xdde5('0x57')],_0x3eac1b,'\x20');_0x11fb7c[_0xdde5('0x58')]=intUtil[_0xdde5('0x56')](_0x2ca8a6['Descriptions'],_0x3eac1b,'\x0a');if(_0x1b7c5b[_0xdde5('0x3e')]===_0xdde5('0x4f')){_0x11fb7c[_0xdde5('0x59')]={'name':!_[_0xdde5('0x19')](_0x1b7c5b[_0xdde5('0x5a')])?_0x1b7c5b['Full_Name']:!_[_0xdde5('0x19')](_0x1b7c5b[_0xdde5('0x5b')])?_0x1b7c5b[_0xdde5('0x5b')]+'\x20'+_0x1b7c5b[_0xdde5('0x5c')]:_0x1b7c5b[_0xdde5('0x5c')],'id':_0x1b7c5b['id']};}if(_0x1b7c5b['enduserType']===_0xdde5('0x5d')){_0x11fb7c[_0xdde5('0x5e')]={'name':!_[_0xdde5('0x19')](_0x1b7c5b[_0xdde5('0x5a')])?_0x1b7c5b[_0xdde5('0x5a')]:!_['isNil'](_0x1b7c5b[_0xdde5('0x5b')])?_0x1b7c5b[_0xdde5('0x5b')]+'\x20'+_0x1b7c5b[_0xdde5('0x5c')]:_0x1b7c5b[_0xdde5('0x5c')],'id':_0x1b7c5b['id']};_0x11fb7c[_0xdde5('0x5f')]=_[_0xdde5('0x41')](_0x1b7c5b[_0xdde5('0x3e')]);}if(_0x3eac1b[_0xdde5('0x60')]){_0x11fb7c[_0xdde5('0x61')]=moment[_0xdde5('0x62')](parseInt(_0x3eac1b[_0xdde5('0x60')])*0x3e8)['format'](_0xdde5('0x63'));}else if(_0x3eac1b[_0xdde5('0x64')]&&_0x3eac1b[_0xdde5('0x65')]){_0x11fb7c[_0xdde5('0x61')]=moment[_0xdde5('0x62')](moment(_0x3eac1b[_0xdde5('0x65')],_0xdde5('0x66'))[_0xdde5('0x67')](moment(_0x3eac1b[_0xdde5('0x68')],_0xdde5('0x66'))))[_0xdde5('0x2d')](_0xdde5('0x63'));}switch(_0x3eac1b[_0xdde5('0x69')]){case'called':_0x11fb7c[_0xdde5('0x6a')]='Called';break;case'complete':case'connect':_0x11fb7c['Call_Result']=_0xdde5('0x6b');break;case _0xdde5('0x6c'):_0x11fb7c[_0xdde5('0x6a')]=_0xdde5('0x6d');break;case _0xdde5('0x6e'):_0x11fb7c['Call_Result']='Abandoned';break;case'timeout':_0x11fb7c[_0xdde5('0x6a')]=_0xdde5('0x6f');default:}_0x11fb7c[_0xdde5('0x70')]=(_0x1f2beb===_0xdde5('0x71')?moment(_0x3eac1b[_0xdde5('0x68')])[_0xdde5('0x2d')](_0xdde5('0x66')):moment(_0x3eac1b[_0xdde5('0x72')])[_0xdde5('0x2d')]('YYYY-MM-DDTHH:mm:ss'))||moment()[_0xdde5('0x2d')](_0xdde5('0x66'));_0x11fb7c[_0xdde5('0x73')]=_0x1f2beb||_0xdde5('0x74');_0x11fb7c=_[_0xdde5('0x75')](_0x11fb7c,getCustomFields(_0x2ca8a6[_0xdde5('0x76')],_0x3eac1b));return request({'method':_0xdde5('0x22'),'uri':_0xdde5('0x3f')+_0x113e91+_0xdde5('0x77'),'headers':{'Authorization':_0xdde5('0x30')+_0x186e6},'body':{'data':[_0x11fb7c]},'json':!![]})[_0xdde5('0x27')](function(_0x597d15){if(_0x597d15&&_0x597d15[_0xdde5('0x3d')][0x0][_0xdde5('0x45')]===_0xdde5('0x46')){logger['info']('Call\x20created!');return{'id':_0x597d15[_0xdde5('0x3d')][0x0][_0xdde5('0x78')]['id']};}})[_0xdde5('0x29')](function(_0x51bfe4){logger[_0xdde5('0x35')](_0xdde5('0x79'),_0x51bfe4[_0xdde5('0x7a')]);console['log'](_0xdde5('0x79'),_0x51bfe4);});}exports['queue']=function(_0x3670bf,_0x519fa3,_0xc9730,_0x3aed1f,_0x301309,_0x8cc3aa){var _0x370e9b,_0x45c8b2,_0x3636b7;_0x8cc3aa[_0xdde5('0x7b')]=intUtil[_0xdde5('0x7c')](_0x8cc3aa[_0xdde5('0x7b')]);_0x8cc3aa[_0xdde5('0x7d')]=intUtil[_0xdde5('0x7c')](_0x8cc3aa[_0xdde5('0x7d')]);if(_0x301309&&_0x301309[_0xdde5('0x7e')]){logger[_0xdde5('0x35')](_0xdde5('0x7f'),_0xdde5('0x80'));_0x519fa3[_0xdde5('0x81')]=_0x8cc3aa[_0xdde5('0x7d')]+_0xdde5('0x82')+_0x519fa3[_0xdde5('0x83')]+_0xdde5('0x84')+md5(_0x519fa3[_0xdde5('0x83')]);}else{_0x519fa3[_0xdde5('0x81')]='';}var _0x1b771a=_0x8cc3aa[_0xdde5('0x7b')]===_0xdde5('0x85')?'eu':_0xdde5('0x86');return getAccessToken(_0x8cc3aa)[_0xdde5('0x27')](function(_0x17ae36){_0x3636b7=_0x17ae36;return getUser(_0x3636b7,_0x1b771a,_0x8cc3aa,_0x3aed1f[_0xdde5('0x33')]);})[_0xdde5('0x27')](function(_0x4d48e2){_0x370e9b=_0x4d48e2;logger[_0xdde5('0x35')](_0xdde5('0x87'),_0x370e9b['id']);return getEndUser(_0x3636b7,_0x1b771a,_0x8cc3aa,_0x519fa3[_0xdde5('0x88')],_0x519fa3[_0xdde5('0x89')],_0x370e9b,_0xc9730);})[_0xdde5('0x27')](function(_0x59056f){_0x45c8b2=_0x59056f;return getCall(_0x3636b7,_0x1b771a,_0x8cc3aa,_0x370e9b,_0x45c8b2,_0xc9730,_0x519fa3,_0xdde5('0x74'));})[_0xdde5('0x27')](function(_0x421e59){if(_0x421e59){logger[_0xdde5('0x35')]('The\x20Call\x20ID\x20is:',_0x421e59['id']);logger[_0xdde5('0x35')](_0xdde5('0x7f'),_0xdde5('0x8a'));emit(util[_0xdde5('0x2d')](_0xdde5('0x8b'),_0x3aed1f[_0xdde5('0x15')]),_0xdde5('0x8c'),{'uri':_0xdde5('0x8d')+_0x8cc3aa['host']+_0xdde5('0x8e')+_0x421e59['id']});}})['catch'](function(_0xd65d8f){logger['error'](_0xdde5('0x7f'),JSON[_0xdde5('0xc')](_0xd65d8f));});};exports['outbound']=function(_0x16814e,_0x11e309,_0x2cb133,_0x177ff3,_0x139c6b,_0x4a14a4,_0x524268){var _0x44de2d,_0xe9a0ac,_0x28e105;_0x4a14a4['host']=intUtil[_0xdde5('0x7c')](_0x4a14a4[_0xdde5('0x7b')]);_0x4a14a4[_0xdde5('0x7d')]=intUtil[_0xdde5('0x7c')](_0x4a14a4[_0xdde5('0x7d')]);if(_0x524268&&_0x524268['recordingFormat']&&_0x524268[_0xdde5('0x8f')]!==_0xdde5('0x90')){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0x11e309[_0xdde5('0x81')]=_0x4a14a4[_0xdde5('0x7d')]+_0xdde5('0x82')+_0x11e309[_0xdde5('0x83')]+_0xdde5('0x84')+md5(_0x11e309['uniqueid']);}var _0x3defcb=_0x4a14a4[_0xdde5('0x7b')]===_0xdde5('0x85')?'eu':'com';return getAccessToken(_0x4a14a4)[_0xdde5('0x27')](function(_0x33772f){_0x28e105=_0x33772f;return getUser(_0x28e105,_0x3defcb,_0x4a14a4,_0x177ff3[_0xdde5('0x33')]);})[_0xdde5('0x27')](function(_0xd16c3f){_0x44de2d=_0xd16c3f;logger[_0xdde5('0x35')](_0xdde5('0x87'),_0x44de2d['id']);return getEndUser(_0x28e105,_0x3defcb,_0x4a14a4,_0x11e309[_0xdde5('0x91')],_0x11e309['destcalleridnum'],_0x44de2d,_0x2cb133);})[_0xdde5('0x27')](function(_0x44fb89){_0xe9a0ac=_0x44fb89;return getCall(_0x28e105,_0x3defcb,_0x4a14a4,_0x44de2d,_0xe9a0ac,_0x2cb133,_0x11e309,_0xdde5('0x92'));})['then'](function(_0x2b4015){if(_0x2b4015){logger[_0xdde5('0x35')](_0xdde5('0x93'),_0x2b4015['id']);logger[_0xdde5('0x35')](_0xdde5('0x94'),_0xdde5('0x8a'));emit(util['format'](_0xdde5('0x8b'),_0x177ff3[_0xdde5('0x15')]),_0xdde5('0x8c'),{'uri':_0xdde5('0x8d')+_0x4a14a4['host']+'/crm/EntityInfo.do?module=Calls&id='+_0x2b4015['id']});}})[_0xdde5('0x29')](function(_0x119d36){logger[_0xdde5('0x3b')](_0xdde5('0x94'),JSON['stringify'](_0x119d36));});};exports[_0xdde5('0x95')]=function(_0xa6866,_0x2414c8,_0x1c9f9b,_0x55c830,_0x2dd96a,_0x283674){var _0x153b2c,_0x37f83c,_0x3f00d9;_0x283674[_0xdde5('0x7b')]=intUtil[_0xdde5('0x7c')](_0x283674[_0xdde5('0x7b')]);_0x283674['serverUrl']=intUtil[_0xdde5('0x7c')](_0x283674['serverUrl']);if(_0x2dd96a&&_0x2dd96a[_0xdde5('0x7e')]){logger[_0xdde5('0x35')]('['+_0x2414c8[_0xdde5('0x69')][_0xdde5('0x96')]()+']',_0xdde5('0x80'));_0x2414c8[_0xdde5('0x81')]=_0x283674['serverUrl']+_0xdde5('0x82')+_0x2414c8[_0xdde5('0x83')]+'/downloads?type=uniqueid&token='+md5(_0x2414c8['uniqueid']);}else{_0x2414c8[_0xdde5('0x81')]='';}var _0x425694=_0x283674['host']===_0xdde5('0x85')?'eu':_0xdde5('0x86');return getAccessToken(_0x283674)['then'](function(_0x2a7cf3){_0x3f00d9=_0x2a7cf3;return getUser(_0x3f00d9,_0x425694,_0x283674);})[_0xdde5('0x27')](function(_0x260045){_0x153b2c=_0x260045;logger[_0xdde5('0x35')](_0xdde5('0x87'),_0x153b2c['id']);return getEndUser(_0x3f00d9,_0x425694,_0x283674,_0x2414c8['calleridname'],_0x2414c8['calleridnum'],_0x153b2c,_0x1c9f9b);})['then'](function(_0x44a202){_0x37f83c=_0x44a202;return getCall(_0x3f00d9,_0x425694,_0x283674,_0x153b2c,_0x37f83c,_0x1c9f9b,_0x2414c8,_0xdde5('0x74'));})[_0xdde5('0x27')](function(_0x2817db){if(_0x2817db){logger[_0xdde5('0x35')](_0xdde5('0x93'),_0x2817db['id']);}})['catch'](function(_0x9b2405){logger[_0xdde5('0x3b')]('['+_0x2414c8[_0xdde5('0x69')][_0xdde5('0x96')]()+']',JSON[_0xdde5('0xc')](_0x9b2405));});}; \ 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 c4b1fca..01bdce1 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 _0x3fd2=['data3','error','format','info','shelljs','mustache','../../../../config/logger','exec','data2','render'];(function(_0x8de54f,_0x271987){var _0x14cba4=function(_0x58ed41){while(--_0x58ed41){_0x8de54f['push'](_0x8de54f['shift']());}};_0x14cba4(++_0x271987);}(_0x3fd2,0x14e));var _0x23fd=function(_0x165317,_0x5f2b29){_0x165317=_0x165317-0x0;var _0x4ff99e=_0x3fd2[_0x165317];return _0x4ff99e;};'use strict';var util=require('util');var sh=require(_0x23fd('0x0'));var Mustache=require(_0x23fd('0x1'));var logger=require(_0x23fd('0x2'))('trigger');exports[_0x23fd('0x3')]=function(_0x2ec1ef,_0x4628a7){var _0xbf70da=_0x2ec1ef['data2']?_0x2ec1ef[_0x23fd('0x4')]:'Script';var _0x187a1d=_0x2ec1ef['data3']?Mustache[_0x23fd('0x5')](_0x2ec1ef[_0x23fd('0x6')],_0x4628a7):_0x4628a7;sh[_0x23fd('0x3')](_0x187a1d,function(_0xa359d4,_0x2af072,_0x47d07b){if(_0xa359d4!==0x0){logger[_0x23fd('0x7')](util[_0x23fd('0x8')]('%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s',_0xbf70da,_0x187a1d,_0xa359d4,_0x47d07b));}else{logger[_0x23fd('0x9')](util[_0x23fd('0x8')]('%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s',_0xbf70da,_0x187a1d,_0x2af072));}});}; \ No newline at end of file +var _0x0b08=['trigger','exec','data2','Script','data3','error','format','info','util','shelljs','../../../../config/logger'];(function(_0x5eb67b,_0x1c9e9d){var _0x477275=function(_0xfa0f1){while(--_0xfa0f1){_0x5eb67b['push'](_0x5eb67b['shift']());}};_0x477275(++_0x1c9e9d);}(_0x0b08,0x110));var _0x80b0=function(_0x3c13b1,_0x1c975a){_0x3c13b1=_0x3c13b1-0x0;var _0x48c4b5=_0x0b08[_0x3c13b1];return _0x48c4b5;};'use strict';var util=require(_0x80b0('0x0'));var sh=require(_0x80b0('0x1'));var Mustache=require('mustache');var logger=require(_0x80b0('0x2'))(_0x80b0('0x3'));exports[_0x80b0('0x4')]=function(_0x5deadf,_0x58adb0){var _0x2bb50a=_0x5deadf[_0x80b0('0x5')]?_0x5deadf[_0x80b0('0x5')]:_0x80b0('0x6');var _0x3c726c=_0x5deadf['data3']?Mustache['render'](_0x5deadf[_0x80b0('0x7')],_0x58adb0):_0x58adb0;sh[_0x80b0('0x4')](_0x3c726c,function(_0x43ca98,_0x304c42,_0x4ed77d){if(_0x43ca98!==0x0){logger[_0x80b0('0x8')](util[_0x80b0('0x9')]('%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s',_0x2bb50a,_0x3c726c,_0x43ca98,_0x4ed77d));}else{logger[_0x80b0('0xa')](util['format']('%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s',_0x2bb50a,_0x3c726c,_0x304c42));}});}; \ 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 134d706..75e52de 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 _0xc25b=['trigger','exec','data1','toUpperCase','render','data2','data5','number','headers','data6','parse','stack','GET','POST','data7','body','error','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil',',\x20request\x20body:\x20','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','message','util','lodash','mustache'];(function(_0xfda486,_0x518041){var _0x20a9d5=function(_0x251386){while(--_0x251386){_0xfda486['push'](_0xfda486['shift']());}};_0x20a9d5(++_0x518041);}(_0xc25b,0x189));var _0xbc25=function(_0x30f57d,_0x2e6777){_0x30f57d=_0x30f57d-0x0;var _0x6f17a4=_0xc25b[_0x30f57d];return _0x6f17a4;};'use strict';var rp=require('request-promise');var util=require(_0xbc25('0x0'));var _=require(_0xbc25('0x1'));var Mustache=require(_0xbc25('0x2'));var logger=require('../../../../config/logger')(_0xbc25('0x3'));exports[_0xbc25('0x4')]=function(_0x46651c,_0x36930c){var _0x2b50f1,_0x447c0b;var _0x5eeb2c={'method':_0x46651c[_0xbc25('0x5')][_0xbc25('0x6')](),'uri':Mustache[_0xbc25('0x7')](_0x46651c[_0xbc25('0x8')],_0x36930c),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x46651c[_0xbc25('0x9')])===_0xbc25('0xa')&&parseInt(_0x46651c[_0xbc25('0x9')])>=0x1&&parseInt(_0x46651c[_0xbc25('0x9')])<=0xa?parseInt(_0x46651c[_0xbc25('0x9')])*0x3e8:0x5*0x3e8};try{_0x5eeb2c[_0xbc25('0xb')]=_0x46651c[_0xbc25('0xc')]?JSON[_0xbc25('0xd')](Mustache[_0xbc25('0x7')](_0x46651c['data6'],_0x36930c)):{};}catch(_0x2011d4){logger['error'](_0x2011d4[_0xbc25('0xe')]);}switch(_0x46651c['data1']['toUpperCase']()){case _0xbc25('0xf'):case'DELETE':_0x2b50f1=null;_0x5eeb2c['qs']=_0x36930c;break;case _0xbc25('0x10'):case'PUT':if(_0x46651c[_0xbc25('0x11')]){try{_0x2b50f1=JSON[_0xbc25('0xd')](Mustache[_0xbc25('0x7')](_0x46651c[_0xbc25('0x11')],_0x36930c));_0x5eeb2c[_0xbc25('0x12')]=_0x2b50f1;}catch(_0x402411){logger[_0xbc25('0x13')](_0x402411[_0xbc25('0xe')]);logger[_0xbc25('0x13')](_0xbc25('0x14'));}}else{_0x2b50f1=_0x36930c;_0x5eeb2c[_0xbc25('0x12')]=_0x2b50f1;}break;}logger[_0xbc25('0x15')](util[_0xbc25('0x16')](_0xbc25('0x17'),_0x46651c[_0xbc25('0x5')],_0x46651c['data2'],JSON[_0xbc25('0x18')](_0x5eeb2c)));rp(_0x5eeb2c)[_0xbc25('0x19')](function(_0x4c1541){_0x2b50f1=!_[_0xbc25('0x1a')](_0x2b50f1)?_0xbc25('0x1b')+_0x2b50f1:'';_0x447c0b=typeof _0x4c1541[_0xbc25('0x12')]==='object'?JSON[_0xbc25('0x18')](_0x4c1541[_0xbc25('0x12')]):_0x4c1541[_0xbc25('0x12')];logger['info'](util[_0xbc25('0x16')](_0xbc25('0x1c'),_0x46651c[_0xbc25('0x5')],_0x46651c[_0xbc25('0x8')],_0x4c1541[_0xbc25('0x1d')],_0x447c0b));})[_0xbc25('0x1e')](function(_0x2f5818){logger[_0xbc25('0x13')](util[_0xbc25('0x16')](_0xbc25('0x1f'),_0x46651c['data1'],_0x46651c[_0xbc25('0x8')],_0x2f5818['statusCode'],_0x2f5818['name'],_0x2f5818[_0xbc25('0x20')]));});}; \ No newline at end of file +var _0x9c37=['parse','error','stack','toUpperCase','GET','DELETE','POST','PUT','data7','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','body','info','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s',',\x20request\x20body:\x20','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','data2','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','lodash','mustache','trigger','exec','data1','render','data5','number','headers','data6'];(function(_0x542da8,_0x509c26){var _0x533d7e=function(_0x2a3d04){while(--_0x2a3d04){_0x542da8['push'](_0x542da8['shift']());}};_0x533d7e(++_0x509c26);}(_0x9c37,0xd5));var _0x79c3=function(_0x3cd5ba,_0x1fe2c1){_0x3cd5ba=_0x3cd5ba-0x0;var _0x3669f4=_0x9c37[_0x3cd5ba];return _0x3669f4;};'use strict';var rp=require(_0x79c3('0x0'));var util=require('util');var _=require(_0x79c3('0x1'));var Mustache=require(_0x79c3('0x2'));var logger=require('../../../../config/logger')(_0x79c3('0x3'));exports[_0x79c3('0x4')]=function(_0x1ff174,_0xe907a7){var _0x28d4e8,_0x5cd72d;var _0xb17204={'method':_0x1ff174[_0x79c3('0x5')]['toUpperCase'](),'uri':Mustache[_0x79c3('0x6')](_0x1ff174['data2'],_0xe907a7),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x1ff174[_0x79c3('0x7')])===_0x79c3('0x8')&&parseInt(_0x1ff174[_0x79c3('0x7')])>=0x1&&parseInt(_0x1ff174[_0x79c3('0x7')])<=0xa?parseInt(_0x1ff174[_0x79c3('0x7')])*0x3e8:0x5*0x3e8};try{_0xb17204[_0x79c3('0x9')]=_0x1ff174[_0x79c3('0xa')]?JSON[_0x79c3('0xb')](Mustache[_0x79c3('0x6')](_0x1ff174[_0x79c3('0xa')],_0xe907a7)):{};}catch(_0x5e22c6){logger[_0x79c3('0xc')](_0x5e22c6[_0x79c3('0xd')]);}switch(_0x1ff174[_0x79c3('0x5')][_0x79c3('0xe')]()){case _0x79c3('0xf'):case _0x79c3('0x10'):_0x28d4e8=null;_0xb17204['qs']=_0xe907a7;break;case _0x79c3('0x11'):case _0x79c3('0x12'):if(_0x1ff174[_0x79c3('0x13')]){try{_0x28d4e8=JSON[_0x79c3('0xb')](Mustache[_0x79c3('0x6')](_0x1ff174[_0x79c3('0x13')],_0xe907a7));_0xb17204['body']=_0x28d4e8;}catch(_0xd5c3c6){logger[_0x79c3('0xc')](_0xd5c3c6[_0x79c3('0xd')]);logger['error'](_0x79c3('0x14'));}}else{_0x28d4e8=_0xe907a7;_0xb17204[_0x79c3('0x15')]=_0x28d4e8;}break;}logger[_0x79c3('0x16')](util['format'](_0x79c3('0x17'),_0x1ff174[_0x79c3('0x5')],_0x1ff174['data2'],JSON['stringify'](_0xb17204)));rp(_0xb17204)['then'](function(_0x264d1c){_0x28d4e8=!_['isNil'](_0x28d4e8)?_0x79c3('0x18')+_0x28d4e8:'';_0x5cd72d=typeof _0x264d1c[_0x79c3('0x15')]==='object'?JSON['stringify'](_0x264d1c[_0x79c3('0x15')]):_0x264d1c[_0x79c3('0x15')];logger[_0x79c3('0x16')](util['format'](_0x79c3('0x19'),_0x1ff174['data1'],_0x1ff174[_0x79c3('0x1a')],_0x264d1c[_0x79c3('0x1b')],_0x5cd72d));})[_0x79c3('0x1c')](function(_0x4d0b78){logger[_0x79c3('0xc')](util['format'](_0x79c3('0x1d'),_0x1ff174[_0x79c3('0x5')],_0x1ff174[_0x79c3('0x1a')],_0x4d0b78['statusCode'],_0x4d0b78[_0x79c3('0x1e')],_0x4d0b78[_0x79c3('0x1f')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index abc9d51..0ccfb4f 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 _0xdf40=['Request','request','rpc','error','result','exports','bluebird','../../config/logger','routing','client','http'];(function(_0x193302,_0x31c981){var _0x56ab6b=function(_0x453431){while(--_0x453431){_0x193302['push'](_0x193302['shift']());}};_0x56ab6b(++_0x31c981);}(_0xdf40,0x1c9));var _0x0df4=function(_0x556634,_0x520958){_0x556634=_0x556634-0x0;var _0x4429fd=_0xdf40[_0x556634];return _0x4429fd;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x0df4('0x0'));var logger=require(_0x0df4('0x1'))(_0x0df4('0x2'));var client=jayson[_0x0df4('0x3')][_0x0df4('0x4')]({'port':0x2329});client[_0x0df4('0x5')]=function(_0xf75a98,_0x3542f4){return new BPromise(function(_0x2bc93d,_0x571ba0){return client[_0x0df4('0x6')](_0xf75a98,_0x3542f4)['then'](function(_0x2321e0){logger['debug'](_0x0df4('0x7'),_0x0df4('0x2'),_0xf75a98,_0x3542f4,_0x2321e0);if(_0x2321e0[_0x0df4('0x8')]){logger[_0x0df4('0x8')](_0x0df4('0x7'),_0x0df4('0x2'),_0xf75a98,_0x2321e0['error']['message'],_0x3542f4);return _0x571ba0(_0x2321e0[_0x0df4('0x8')]['message']);}else{return _0x2bc93d(_0x2321e0[_0x0df4('0x9')]);}})['catch'](function(_0x2ba646){logger[_0x0df4('0x8')](_0x0df4('0x7'),_0x0df4('0x2'),_0xf75a98,_0x2ba646,_0x3542f4);return _0x571ba0(_0x2ba646);});});};module[_0x0df4('0xa')]=client; \ No newline at end of file +var _0xe0c8=['jayson/promise','bluebird','../../config/logger','routing','client','http','request','debug','rpc','error','message','result','catch','exports'];(function(_0x2250e7,_0x2aab04){var _0x3b890a=function(_0x5d93d7){while(--_0x5d93d7){_0x2250e7['push'](_0x2250e7['shift']());}};_0x3b890a(++_0x2aab04);}(_0xe0c8,0x1c0));var _0x8e0c=function(_0x31bc48,_0x18759e){_0x31bc48=_0x31bc48-0x0;var _0x3abd4a=_0xe0c8[_0x31bc48];return _0x3abd4a;};'use strict';var jayson=require(_0x8e0c('0x0'));var BPromise=require(_0x8e0c('0x1'));var logger=require(_0x8e0c('0x2'))(_0x8e0c('0x3'));var client=jayson[_0x8e0c('0x4')][_0x8e0c('0x5')]({'port':0x2329});client['Request']=function(_0x210eb0,_0x2a3868){return new BPromise(function(_0x2b68bf,_0x22873a){return client[_0x8e0c('0x6')](_0x210eb0,_0x2a3868)['then'](function(_0x5a2f08){logger[_0x8e0c('0x7')](_0x8e0c('0x8'),_0x8e0c('0x3'),_0x210eb0,_0x2a3868,_0x5a2f08);if(_0x5a2f08[_0x8e0c('0x9')]){logger[_0x8e0c('0x9')](_0x8e0c('0x8'),'routing',_0x210eb0,_0x5a2f08['error']['message'],_0x2a3868);return _0x22873a(_0x5a2f08[_0x8e0c('0x9')][_0x8e0c('0xa')]);}else{return _0x2b68bf(_0x5a2f08[_0x8e0c('0xb')]);}})[_0x8e0c('0xc')](function(_0x12aa66){logger[_0x8e0c('0x9')](_0x8e0c('0x8'),_0x8e0c('0x3'),_0x210eb0,_0x12aa66,_0x2a3868);return _0x22873a(_0x12aa66);});});};module[_0x8e0c('0xd')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index c46c2b1..754dc30 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 _0x1e61=['email','getMailAccounts','then','initMailAccounts','refresh','mailAccounts','getSettings','loginMailFrequency','./server','./realtime','./lib/email','../../config/logger'];(function(_0x3e3b0a,_0x24cfa2){var _0x50f210=function(_0x13a1ac){while(--_0x13a1ac){_0x3e3b0a['push'](_0x3e3b0a['shift']());}};_0x50f210(++_0x24cfa2);}(_0x1e61,0x1b8));var _0x11e6=function(_0x5ee3c3,_0x5eb531){_0x5ee3c3=_0x5ee3c3-0x0;var _0x24103e=_0x1e61[_0x5ee3c3];return _0x24103e;};'use strict';var server=require(_0x11e6('0x0'));var Realtime=require(_0x11e6('0x1'));var EmailChannel=require(_0x11e6('0x2'));var mailAccount=require('./rpc/mailAccount');var setting=require('./rpc/setting');var logger=require(_0x11e6('0x3'))(_0x11e6('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise['resolve']()['then'](mailAccount[_0x11e6('0x5')]())[_0x11e6('0x6')](realtime[_0x11e6('0x7')]())[_0x11e6('0x6')](function(){email[_0x11e6('0x8')](realtime[_0x11e6('0x9')]);return realtime;});}function main(){return server['listen'](realtime,email)[_0x11e6('0x6')](function(){return initRealtime();})[_0x11e6('0x6')](function(){return setting[_0x11e6('0xa')]();})[_0x11e6('0x6')](function(_0x3e92ed){return setInterval(initRealtime,_0x3e92ed[_0x11e6('0xb')]*0x3e8);})['catch'](function(_0x4a93a8){logger['error']('Email\x20service\x20initialization',_0x4a93a8);});}main(); \ No newline at end of file +var _0x3b8e=['initMailAccounts','refresh','mailAccounts','listen','loginMailFrequency','catch','error','./server','./realtime','./lib/email','./rpc/setting','../../config/logger','email','then','getMailAccounts'];(function(_0x3392aa,_0x39a092){var _0x4b4378=function(_0x284ba5){while(--_0x284ba5){_0x3392aa['push'](_0x3392aa['shift']());}};_0x4b4378(++_0x39a092);}(_0x3b8e,0x1d8));var _0xe3b8=function(_0x1bd526,_0x7f95c9){_0x1bd526=_0x1bd526-0x0;var _0x271710=_0x3b8e[_0x1bd526];return _0x271710;};'use strict';var server=require(_0xe3b8('0x0'));var Realtime=require(_0xe3b8('0x1'));var EmailChannel=require(_0xe3b8('0x2'));var mailAccount=require('./rpc/mailAccount');var setting=require(_0xe3b8('0x3'));var logger=require(_0xe3b8('0x4'))(_0xe3b8('0x5'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise['resolve']()[_0xe3b8('0x6')](mailAccount[_0xe3b8('0x7')]())[_0xe3b8('0x6')](realtime[_0xe3b8('0x8')]())[_0xe3b8('0x6')](function(){email[_0xe3b8('0x9')](realtime[_0xe3b8('0xa')]);return realtime;});}function main(){return server[_0xe3b8('0xb')](realtime,email)['then'](function(){return initRealtime();})[_0xe3b8('0x6')](function(){return setting['getSettings']();})[_0xe3b8('0x6')](function(_0x2a716a){return setInterval(initRealtime,_0x2a716a[_0xe3b8('0xc')]*0x3e8);})[_0xe3b8('0xd')](function(_0x3fd8e4){logger[_0xe3b8('0xe')]('Email\x20service\x20initialization',_0x3fd8e4);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 18c1332..75c2418 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 _0x8cb8=['lastName','from','notify','then','info','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','sendMail','smtp','send','verifySmtp','Smtp','verify','verified','exports','lodash','moment','../../../config/environment','../../../config/logger','email','redis','localhost','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','start\x20email\x20channel','prototype','emit','mailAccounts','name','key','active','Imap','status','messageStatus','isNil','stringify','mailAccount:update','refresh','hasOwnProperty','service','custom','provider','imapAccounts','bind','handleImapEmail','handleImapEnd','error','handleImapBox','messages','total','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s'];(function(_0x1c231f,_0x39b506){var _0x3e5423=function(_0x515347){while(--_0x515347){_0x1c231f['push'](_0x1c231f['shift']());}};_0x3e5423(++_0x39b506);}(_0x8cb8,0x7f));var _0x88cb=function(_0x49052b,_0x3ba709){_0x49052b=_0x49052b-0x0;var _0x48c045=_0x8cb8[_0x49052b];return _0x48c045;};'use strict';var _=require(_0x88cb('0x0'));var moment=require(_0x88cb('0x1'));var BPromise=require('bluebird');var md5=require('md5');var Redis=require('ioredis');var config=require(_0x88cb('0x2'));var logger=require(_0x88cb('0x3'))(_0x88cb('0x4'));config[_0x88cb('0x5')]=_['defaults'](config[_0x88cb('0x5')],{'host':_0x88cb('0x6'),'port':0x18eb});var io=require(_0x88cb('0x7'))(new Redis(config[_0x88cb('0x5')]));var EmailImap=require(_0x88cb('0x8'));var EmailSmtp=require(_0x88cb('0x9'));var mailAccount=require(_0x88cb('0xa'));var md5Accounts={};function EmailChannel(_0x24f1bb){logger['info'](_0x88cb('0xb'));this['mailAccounts']=_0x24f1bb['mailAccounts'];this['imapAccounts']={};this['smtp']=new EmailSmtp();}EmailChannel[_0x88cb('0xc')][_0x88cb('0xd')]=function(_0x2d8ac8){var _0x1d52c6=this[_0x88cb('0xe')][_0x2d8ac8];var _0x3e1bbd={'id':_0x1d52c6['id'],'name':_0x1d52c6[_0x88cb('0xf')],'key':_0x1d52c6[_0x88cb('0x10')],'active':_0x1d52c6[_0x88cb('0x11')],'Imap':{'status':_0x1d52c6[_0x88cb('0x12')][_0x88cb('0x13')],'messageStatus':_0x1d52c6[_0x88cb('0x12')][_0x88cb('0x14')],'total':_0x1d52c6[_0x88cb('0x12')]['total']}};if(_[_0x88cb('0x15')](md5Accounts[_0x2d8ac8])){md5Accounts[_0x2d8ac8]={};}var _0x4fedc5=md5(JSON[_0x88cb('0x16')](_0x3e1bbd));if(md5Accounts[_0x2d8ac8]['md5']!==_0x4fedc5){md5Accounts[_0x2d8ac8]['md5']=_0x4fedc5;io[_0x88cb('0xd')](_0x88cb('0x17'),_0x3e1bbd);}};EmailChannel[_0x88cb('0xc')][_0x88cb('0x18')]=function(_0x5beea9){for(var _0x855ee6 in _0x5beea9){if(_0x5beea9[_0x88cb('0x19')](_0x855ee6)){if(_0x5beea9[_0x855ee6][_0x88cb('0x12')]&&_0x5beea9[_0x855ee6][_0x88cb('0x11')]){var _0x1bf97c=_0x5beea9[_0x855ee6][_0x88cb('0x12')];if(!_0x1bf97c[_0x88cb('0x1a')]&&_0x5beea9[_0x855ee6]['provider']!==_0x88cb('0x1b'))_0x1bf97c[_0x88cb('0x1a')]=_0x5beea9[_0x855ee6][_0x88cb('0x1c')];if(!this['imapAccounts'][_0x88cb('0x19')](_0x1bf97c['id'])){this['imapAccounts'][_0x1bf97c['id']]=new EmailImap(_0x1bf97c,_0x5beea9[_0x855ee6][_0x88cb('0x4')]);this[_0x88cb('0x1d')][_0x1bf97c['id']]['on']('box',this['handleImapBox'][_0x88cb('0x1e')](this,_0x855ee6));this['imapAccounts'][_0x1bf97c['id']]['on'](_0x88cb('0x4'),this[_0x88cb('0x1f')][_0x88cb('0x1e')](this,_0x855ee6));this[_0x88cb('0x1d')][_0x1bf97c['id']]['on']('end',this[_0x88cb('0x20')][_0x88cb('0x1e')](this,_0x855ee6));this[_0x88cb('0x1d')][_0x1bf97c['id']]['on'](_0x88cb('0x21'),this['handleImapError'][_0x88cb('0x1e')](this,_0x855ee6));}}else{if(_[_0x88cb('0x15')](this[_0x88cb('0xe')][_0x855ee6][_0x88cb('0x12')])){this[_0x88cb('0xe')][_0x855ee6][_0x88cb('0x12')]={};}this[_0x88cb('0xe')][_0x855ee6][_0x88cb('0x12')][_0x88cb('0x13')]='disabled';this['mailAccounts'][_0x855ee6][_0x88cb('0x12')][_0x88cb('0x14')]='';this['emit'](_0x855ee6);}}}};EmailChannel['prototype'][_0x88cb('0x22')]=function(_0x13ae6a,_0x42841c){if(this['mailAccounts'][_0x13ae6a]){this[_0x88cb('0xe')][_0x13ae6a]['Imap']['status']='connected';this[_0x88cb('0xe')][_0x13ae6a]['Imap'][_0x88cb('0x14')]=_0x42841c[_0x88cb('0xf')];if(_0x42841c[_0x88cb('0x23')]){this[_0x88cb('0xe')][_0x13ae6a]['Imap'][_0x88cb('0x24')]=_0x42841c['messages'][_0x88cb('0x24')];}return this['emit'](_0x13ae6a);}};EmailChannel[_0x88cb('0xc')][_0x88cb('0x1f')]=function(_0x2279c1,_0x1cdee9){logger['info'](_0x88cb('0x25'),_0x1cdee9['firstName'],_0x1cdee9[_0x88cb('0x26')],_0x1cdee9[_0x88cb('0x27')],_0x2279c1);if(this[_0x88cb('0xe')][_0x2279c1]){return mailAccount[_0x88cb('0x28')](_0x2279c1,_0x1cdee9)[_0x88cb('0x29')](function(_0x46779a){if(_0x46779a){logger[_0x88cb('0x2a')](_0x88cb('0x2b'));}})[_0x88cb('0x2c')](function(_0x3f7204){logger[_0x88cb('0x21')](_0x88cb('0x2d'),JSON[_0x88cb('0x16')](_0x3f7204));});}};EmailChannel[_0x88cb('0xc')][_0x88cb('0x20')]=function(_0xd9d9af){if(this[_0x88cb('0xe')][_0xd9d9af]&&this[_0x88cb('0xe')][_0xd9d9af]['Imap']){if(this['imapAccounts'][this[_0x88cb('0xe')][_0xd9d9af][_0x88cb('0x12')]['id']]){delete this[_0x88cb('0x1d')][this[_0x88cb('0xe')][_0xd9d9af]['Imap']['id']];}this[_0x88cb('0xe')][_0xd9d9af][_0x88cb('0x12')][_0x88cb('0x2e')]=moment();this[_0x88cb('0xd')](_0xd9d9af);}};EmailChannel[_0x88cb('0xc')]['handleImapError']=function(_0x22b345,_0x4e7391){if(this[_0x88cb('0xe')][_0x22b345]){this[_0x88cb('0xe')][_0x22b345][_0x88cb('0x12')]['status']=_0x88cb('0x21');this[_0x88cb('0xe')][_0x22b345][_0x88cb('0x12')][_0x88cb('0x14')]=_0x4e7391;return this[_0x88cb('0xd')](_0x22b345);}};EmailChannel['prototype'][_0x88cb('0x2f')]=function(_0x513ab0,_0x5b5a31){return this[_0x88cb('0x30')][_0x88cb('0x31')](_0x513ab0,_0x5b5a31);};EmailChannel['prototype'][_0x88cb('0x32')]=function(_0x2a0044){var _0x3d2374=this;if(this[_0x88cb('0xe')][_0x2a0044['id']]){if(_[_0x88cb('0x15')](this[_0x88cb('0xe')][_0x2a0044['id']][_0x88cb('0x33')])){this['mailAccounts'][_0x2a0044['id']][_0x88cb('0x33')]={};}this[_0x88cb('0xe')][_0x2a0044['id']][_0x88cb('0x33')][_0x88cb('0x2e')]=moment();return new BPromise(function(_0x1d3cc7,_0x509af4){return _0x3d2374[_0x88cb('0x30')][_0x88cb('0x34')](_0x2a0044)[_0x88cb('0x29')](function(_0xde1729){_0x3d2374[_0x88cb('0xe')][_0x2a0044['id']][_0x88cb('0x33')][_0x88cb('0x13')]=_0x88cb('0x35');_0x3d2374[_0x88cb('0xe')][_0x2a0044['id']][_0x88cb('0x33')]['messageStatus']='';_0x3d2374[_0x88cb('0xd')](_0x2a0044['id']);_0x1d3cc7(_0xde1729);})['catch'](function(_0x437780){_0x3d2374['mailAccounts'][_0x2a0044['id']][_0x88cb('0x33')][_0x88cb('0x13')]=_0x88cb('0x21');_0x3d2374[_0x88cb('0xe')][_0x2a0044['id']]['Smtp'][_0x88cb('0x14')]=_0x437780;_0x3d2374['emit'](_0x2a0044['id']);_0x509af4(_0x437780);});});}return this['smtp'][_0x88cb('0x34')](_0x2a0044);};module[_0x88cb('0x36')]=EmailChannel; \ No newline at end of file +var _0xa7e8=['hasOwnProperty','provider','custom','box','handleImapBox','bind','handleImapEnd','error','handleImapError','disabled','connected','name','messages','info','firstName','lastName','from','notify','Mail\x20accepted\x20from\x20routing','sendMail','send','verifySmtp','Smtp','verify','verified','exports','lodash','md5','ioredis','../../../config/environment','../../../config/logger','email','redis','localhost','socket.io-emitter','../rpc/mailAccount','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','key','active','Imap','status','messageStatus','total','isNil','stringify','emit','refresh'];(function(_0x181f86,_0x21f4b9){var _0x80bc75=function(_0x540aa5){while(--_0x540aa5){_0x181f86['push'](_0x181f86['shift']());}};_0x80bc75(++_0x21f4b9);}(_0xa7e8,0x14c));var _0x8a7e=function(_0x3479f1,_0x2b66d8){_0x3479f1=_0x3479f1-0x0;var _0x39b73e=_0xa7e8[_0x3479f1];return _0x39b73e;};'use strict';var _=require(_0x8a7e('0x0'));var moment=require('moment');var BPromise=require('bluebird');var md5=require(_0x8a7e('0x1'));var Redis=require(_0x8a7e('0x2'));var config=require(_0x8a7e('0x3'));var logger=require(_0x8a7e('0x4'))(_0x8a7e('0x5'));config[_0x8a7e('0x6')]=_['defaults'](config['redis'],{'host':_0x8a7e('0x7'),'port':0x18eb});var io=require(_0x8a7e('0x8'))(new Redis(config[_0x8a7e('0x6')]));var EmailImap=require('./imap');var EmailSmtp=require('./smtp');var mailAccount=require(_0x8a7e('0x9'));var md5Accounts={};function EmailChannel(_0x45ef5f){logger['info'](_0x8a7e('0xa'));this['mailAccounts']=_0x45ef5f[_0x8a7e('0xb')];this[_0x8a7e('0xc')]={};this[_0x8a7e('0xd')]=new EmailSmtp();}EmailChannel[_0x8a7e('0xe')]['emit']=function(_0x362f65){var _0x3dbddc=this[_0x8a7e('0xb')][_0x362f65];var _0x3345be={'id':_0x3dbddc['id'],'name':_0x3dbddc['name'],'key':_0x3dbddc[_0x8a7e('0xf')],'active':_0x3dbddc[_0x8a7e('0x10')],'Imap':{'status':_0x3dbddc[_0x8a7e('0x11')][_0x8a7e('0x12')],'messageStatus':_0x3dbddc[_0x8a7e('0x11')][_0x8a7e('0x13')],'total':_0x3dbddc[_0x8a7e('0x11')][_0x8a7e('0x14')]}};if(_[_0x8a7e('0x15')](md5Accounts[_0x362f65])){md5Accounts[_0x362f65]={};}var _0x3a88f7=md5(JSON[_0x8a7e('0x16')](_0x3345be));if(md5Accounts[_0x362f65][_0x8a7e('0x1')]!==_0x3a88f7){md5Accounts[_0x362f65][_0x8a7e('0x1')]=_0x3a88f7;io[_0x8a7e('0x17')]('mailAccount:update',_0x3345be);}};EmailChannel[_0x8a7e('0xe')][_0x8a7e('0x18')]=function(_0x123b3f){for(var _0x30a64a in _0x123b3f){if(_0x123b3f[_0x8a7e('0x19')](_0x30a64a)){if(_0x123b3f[_0x30a64a][_0x8a7e('0x11')]&&_0x123b3f[_0x30a64a]['active']){var _0x1bae8c=_0x123b3f[_0x30a64a][_0x8a7e('0x11')];if(!_0x1bae8c['service']&&_0x123b3f[_0x30a64a][_0x8a7e('0x1a')]!==_0x8a7e('0x1b'))_0x1bae8c['service']=_0x123b3f[_0x30a64a]['provider'];if(!this[_0x8a7e('0xc')][_0x8a7e('0x19')](_0x1bae8c['id'])){this[_0x8a7e('0xc')][_0x1bae8c['id']]=new EmailImap(_0x1bae8c,_0x123b3f[_0x30a64a][_0x8a7e('0x5')]);this[_0x8a7e('0xc')][_0x1bae8c['id']]['on'](_0x8a7e('0x1c'),this[_0x8a7e('0x1d')][_0x8a7e('0x1e')](this,_0x30a64a));this[_0x8a7e('0xc')][_0x1bae8c['id']]['on']('email',this['handleImapEmail'][_0x8a7e('0x1e')](this,_0x30a64a));this[_0x8a7e('0xc')][_0x1bae8c['id']]['on']('end',this[_0x8a7e('0x1f')][_0x8a7e('0x1e')](this,_0x30a64a));this[_0x8a7e('0xc')][_0x1bae8c['id']]['on'](_0x8a7e('0x20'),this[_0x8a7e('0x21')][_0x8a7e('0x1e')](this,_0x30a64a));}}else{if(_[_0x8a7e('0x15')](this['mailAccounts'][_0x30a64a][_0x8a7e('0x11')])){this[_0x8a7e('0xb')][_0x30a64a]['Imap']={};}this['mailAccounts'][_0x30a64a][_0x8a7e('0x11')][_0x8a7e('0x12')]=_0x8a7e('0x22');this['mailAccounts'][_0x30a64a]['Imap'][_0x8a7e('0x13')]='';this[_0x8a7e('0x17')](_0x30a64a);}}}};EmailChannel[_0x8a7e('0xe')][_0x8a7e('0x1d')]=function(_0x15dcad,_0x9dee98){if(this[_0x8a7e('0xb')][_0x15dcad]){this[_0x8a7e('0xb')][_0x15dcad][_0x8a7e('0x11')][_0x8a7e('0x12')]=_0x8a7e('0x23');this[_0x8a7e('0xb')][_0x15dcad]['Imap'][_0x8a7e('0x13')]=_0x9dee98[_0x8a7e('0x24')];if(_0x9dee98[_0x8a7e('0x25')]){this[_0x8a7e('0xb')][_0x15dcad][_0x8a7e('0x11')][_0x8a7e('0x14')]=_0x9dee98['messages']['total'];}return this['emit'](_0x15dcad);}};EmailChannel[_0x8a7e('0xe')]['handleImapEmail']=function(_0x2b28fb,_0x41eb2c){logger[_0x8a7e('0x26')]('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x41eb2c[_0x8a7e('0x27')],_0x41eb2c[_0x8a7e('0x28')],_0x41eb2c[_0x8a7e('0x29')],_0x2b28fb);if(this['mailAccounts'][_0x2b28fb]){return mailAccount[_0x8a7e('0x2a')](_0x2b28fb,_0x41eb2c)['then'](function(_0x2de75c){if(_0x2de75c){logger[_0x8a7e('0x26')](_0x8a7e('0x2b'));}})['catch'](function(_0x59a6ee){logger['error']('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON[_0x8a7e('0x16')](_0x59a6ee));});}};EmailChannel[_0x8a7e('0xe')][_0x8a7e('0x1f')]=function(_0x5624b2){if(this[_0x8a7e('0xb')][_0x5624b2]&&this['mailAccounts'][_0x5624b2][_0x8a7e('0x11')]){if(this[_0x8a7e('0xc')][this[_0x8a7e('0xb')][_0x5624b2][_0x8a7e('0x11')]['id']]){delete this['imapAccounts'][this[_0x8a7e('0xb')][_0x5624b2][_0x8a7e('0x11')]['id']];}this[_0x8a7e('0xb')][_0x5624b2][_0x8a7e('0x11')]['lastSync']=moment();this[_0x8a7e('0x17')](_0x5624b2);}};EmailChannel['prototype'][_0x8a7e('0x21')]=function(_0x5424e2,_0x3985f2){if(this[_0x8a7e('0xb')][_0x5424e2]){this[_0x8a7e('0xb')][_0x5424e2][_0x8a7e('0x11')]['status']=_0x8a7e('0x20');this[_0x8a7e('0xb')][_0x5424e2]['Imap'][_0x8a7e('0x13')]=_0x3985f2;return this['emit'](_0x5424e2);}};EmailChannel[_0x8a7e('0xe')][_0x8a7e('0x2c')]=function(_0x561f6c,_0x4f1389){return this[_0x8a7e('0xd')][_0x8a7e('0x2d')](_0x561f6c,_0x4f1389);};EmailChannel['prototype'][_0x8a7e('0x2e')]=function(_0x5e6766){var _0x18f463=this;if(this['mailAccounts'][_0x5e6766['id']]){if(_[_0x8a7e('0x15')](this['mailAccounts'][_0x5e6766['id']][_0x8a7e('0x2f')])){this[_0x8a7e('0xb')][_0x5e6766['id']][_0x8a7e('0x2f')]={};}this[_0x8a7e('0xb')][_0x5e6766['id']]['Smtp']['lastSync']=moment();return new BPromise(function(_0x21c83e,_0x244ed5){return _0x18f463['smtp'][_0x8a7e('0x30')](_0x5e6766)['then'](function(_0x4eb421){_0x18f463[_0x8a7e('0xb')][_0x5e6766['id']]['Smtp'][_0x8a7e('0x12')]=_0x8a7e('0x31');_0x18f463[_0x8a7e('0xb')][_0x5e6766['id']][_0x8a7e('0x2f')]['messageStatus']='';_0x18f463[_0x8a7e('0x17')](_0x5e6766['id']);_0x21c83e(_0x4eb421);})['catch'](function(_0x478541){_0x18f463[_0x8a7e('0xb')][_0x5e6766['id']]['Smtp'][_0x8a7e('0x12')]=_0x8a7e('0x20');_0x18f463[_0x8a7e('0xb')][_0x5e6766['id']]['Smtp'][_0x8a7e('0x13')]=_0x478541;_0x18f463[_0x8a7e('0x17')](_0x5e6766['id']);_0x244ed5(_0x478541);});});}return this[_0x8a7e('0xd')][_0x8a7e('0x30')](_0x5e6766);};module[_0x8a7e('0x32')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 183e0e7..131d2db 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 _0x6f58=['handleCloseBox','end','search','UNSEEN','handleReadUnseen','length','fetch','handleFetchMessage','handleFetchError','handleFetchEnd','body','handleMessageAttributes','handleMessageBody','handleSimpleParser','handleMessageEnd','closeBox','stringify','textCode','upperFirst','exports','lodash','util','imap','mailparser','Iconv','./utils','email','mailbox','getAccount','account','once','ready','bind','error','handleError','inherits','prototype','connTimeout','authTimeout','modernAuthentication','xoauth2','generateXOAuth2Token','CloudProvider','data5','user','password','authentication','anonymous@xcally.com','host','port','tls','autotls','required','handleReady','openBox','handleOpenBox','emit','box','readUnseen'];(function(_0x54b0f3,_0x1fe2f7){var _0x5ae957=function(_0x2749eb){while(--_0x2749eb){_0x54b0f3['push'](_0x54b0f3['shift']());}};_0x5ae957(++_0x1fe2f7);}(_0x6f58,0x1ec));var _0x86f5=function(_0x4a561d,_0x34dd8c){_0x4a561d=_0x4a561d-0x0;var _0x294afa=_0x6f58[_0x4a561d];return _0x294afa;};'use strict';var _=require(_0x86f5('0x0'));var util=require(_0x86f5('0x1'));var Imap=require(_0x86f5('0x2'));var simpleParser=require(_0x86f5('0x3'))['simpleParser'];var Iconv=require('iconv')[_0x86f5('0x4')];var EventEmitter=require('events')['EventEmitter'];var utils=require(_0x86f5('0x5'));var logger=require('../../../config/logger')(_0x86f5('0x6'));function EmailImap(_0x359cc9,_0x168278){this[_0x86f5('0x7')]=_0x359cc9['mailbox'];this['account']=this[_0x86f5('0x8')](_0x359cc9,_0x168278);this[_0x86f5('0x2')]=new Imap(this[_0x86f5('0x9')]);this[_0x86f5('0x2')][_0x86f5('0xa')](_0x86f5('0xb'),this['handleReady']['bind'](this));this['imap']['once']('end',this['handleEnd'][_0x86f5('0xc')](this));this[_0x86f5('0x2')]['on'](_0x86f5('0xd'),this[_0x86f5('0xe')][_0x86f5('0xc')](this));this[_0x86f5('0x2')]['connect']();}util[_0x86f5('0xf')](EmailImap,EventEmitter);EmailImap[_0x86f5('0x10')][_0x86f5('0x8')]=function(_0x1e4d64,_0x322c58){var _0x35003f={'connTimeout':_0x1e4d64[_0x86f5('0x11')]?_0x1e4d64[_0x86f5('0x11')]*0x3e8:0x2710,'authTimeout':_0x1e4d64[_0x86f5('0x12')]?_0x1e4d64['authTimeout']*0x3e8:0x1388};if(_0x1e4d64['service']){_0x35003f['user']=_0x1e4d64['user'];if(_0x1e4d64[_0x86f5('0x13')]){_0x35003f[_0x86f5('0x14')]=utils[_0x86f5('0x15')](_0x1e4d64[_0x86f5('0x16')][_0x86f5('0x17')],_0x1e4d64[_0x86f5('0x18')]);}else{_0x35003f[_0x86f5('0x19')]=_0x1e4d64[_0x86f5('0x19')];}}else{if(_0x1e4d64[_0x86f5('0x1a')]){_0x35003f[_0x86f5('0x18')]=_0x1e4d64[_0x86f5('0x18')];_0x35003f[_0x86f5('0x19')]=_0x1e4d64['password'];}}_0x35003f[_0x86f5('0x6')]=_0x322c58||_0x1e4d64[_0x86f5('0x18')]||_0x86f5('0x1b');_0x35003f[_0x86f5('0x1c')]=_0x1e4d64[_0x86f5('0x1c')];_0x35003f[_0x86f5('0x1d')]=_0x1e4d64['port']||0x3e1;if(_0x1e4d64[_0x86f5('0x1e')]){_0x35003f['tls']=!![];}else{_0x35003f[_0x86f5('0x1e')]=![];_0x35003f[_0x86f5('0x1f')]=_0x86f5('0x20');}return _0x35003f;};EmailImap[_0x86f5('0x10')][_0x86f5('0x21')]=function(){this[_0x86f5('0x2')][_0x86f5('0x22')](this['mailbox'],![],this[_0x86f5('0x23')][_0x86f5('0xc')](this));};EmailImap[_0x86f5('0x10')][_0x86f5('0x23')]=function(_0x200c79,_0x36a40d){if(_0x200c79){this['handleError'](_0x200c79,!![]);}else{this[_0x86f5('0x24')](_0x86f5('0x25'),_0x36a40d);this[_0x86f5('0x26')]();}};EmailImap[_0x86f5('0x10')][_0x86f5('0x27')]=function(_0xf98fcc){if(_0xf98fcc){this[_0x86f5('0xe')](_0xf98fcc,!![]);}else{this[_0x86f5('0x2')][_0x86f5('0x28')]();}};EmailImap['prototype']['readUnseen']=function(){this['imap'][_0x86f5('0x29')]([_0x86f5('0x2a')],this[_0x86f5('0x2b')][_0x86f5('0xc')](this));};EmailImap[_0x86f5('0x10')]['handleReadUnseen']=function(_0xff5654,_0x3a44b4){if(_0xff5654){this['handleError'](_0xff5654,!![]);}else{if(_0x3a44b4[_0x86f5('0x2c')]){try{var _0x451665=this[_0x86f5('0x2')][_0x86f5('0x2d')](_0x3a44b4,{'bodies':'','markSeen':!![]});_0x451665['on']('message',this[_0x86f5('0x2e')][_0x86f5('0xc')](this));_0x451665[_0x86f5('0xa')](_0x86f5('0xd'),this[_0x86f5('0x2f')]['bind'](this));_0x451665[_0x86f5('0xa')](_0x86f5('0x28'),this[_0x86f5('0x30')][_0x86f5('0xc')](this));}catch(_0x20ae83){logger[_0x86f5('0xd')](_0x20ae83);}}else{this[_0x86f5('0x2')]['closeBox'](!![],this['handleCloseBox'][_0x86f5('0xc')](this));}}};EmailImap[_0x86f5('0x10')][_0x86f5('0x2e')]=function(_0x2210d6){_0x2210d6['on'](_0x86f5('0x31'),this['handleMessageBody'][_0x86f5('0xc')](this));_0x2210d6[_0x86f5('0xa')]('attributes',this[_0x86f5('0x32')][_0x86f5('0xc')](this));_0x2210d6[_0x86f5('0xa')](_0x86f5('0x28'),this['handleMessageEnd'][_0x86f5('0xc')](this));};EmailImap[_0x86f5('0x10')][_0x86f5('0x33')]=function(_0x3c1c5f){simpleParser(_0x3c1c5f,{'Iconv':Iconv},this[_0x86f5('0x34')]['bind'](this));};EmailImap[_0x86f5('0x10')][_0x86f5('0x32')]=function(){};EmailImap['prototype'][_0x86f5('0x35')]=function(){};EmailImap[_0x86f5('0x10')]['handleSimpleParser']=function(_0x55fe60,_0x2e1e2e){if(_0x55fe60){logger[_0x86f5('0xd')](_0x55fe60);}else{var _0x3a92cd=this;utils['parser'](this['account'],_0x2e1e2e,function(_0x5e2129){_0x3a92cd[_0x86f5('0x24')](_0x86f5('0x6'),_0x5e2129);});}};EmailImap['prototype']['handleFetchEnd']=function(){this[_0x86f5('0x2')][_0x86f5('0x36')](!![],this[_0x86f5('0x27')]['bind'](this));};EmailImap['prototype'][_0x86f5('0x2f')]=function(_0x3f1e52){this['handleError'](_0x3f1e52);this['imap'][_0x86f5('0x36')](!![],this['handleCloseBox'][_0x86f5('0xc')](this));};EmailImap[_0x86f5('0x10')]['handleEnd']=function(){this[_0x86f5('0x24')](_0x86f5('0x28'));};EmailImap['prototype'][_0x86f5('0xe')]=function(_0x45bdab,_0x37c4d3){logger[_0x86f5('0xd')](_0x86f5('0xe'),this[_0x86f5('0x9')]['email'],JSON[_0x86f5('0x37')](_0x45bdab));var _0x2d7642='';if(_0x45bdab){if(_0x45bdab[_0x86f5('0x38')]){_0x2d7642=_0x45bdab[_0x86f5('0x38')];}else{for(var _0x2f3597 in _0x45bdab){if(_0x45bdab['hasOwnProperty'](_0x2f3597)){_0x2d7642+=_[_0x86f5('0x39')](_0x2f3597)+':\x20'+_0x45bdab[_0x2f3597]+'\x0a';}}}}if(_0x37c4d3){this[_0x86f5('0x2')][_0x86f5('0x28')]();}else{this[_0x86f5('0x24')](_0x86f5('0xd'),_0x2d7642);this[_0x86f5('0x24')](_0x86f5('0x28'));}};module[_0x86f5('0x3a')]=EmailImap; \ No newline at end of file +var _0xca66=['handleFetchError','closeBox','body','attributes','handleMessageAttributes','handleMessageEnd','handleMessageBody','handleSimpleParser','parser','handleFetchEnd','stringify','textCode','hasOwnProperty','upperFirst','exports','lodash','mailparser','simpleParser','iconv','events','./utils','email','mailbox','account','getAccount','imap','once','ready','handleReady','bind','end','handleEnd','error','handleError','connect','prototype','connTimeout','service','user','modernAuthentication','xoauth2','generateXOAuth2Token','CloudProvider','password','authentication','anonymous@xcally.com','host','port','tls','required','openBox','handleOpenBox','emit','box','readUnseen','handleCloseBox','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchMessage'];(function(_0x5b5478,_0x1be678){var _0x8d0118=function(_0x2dd8f1){while(--_0x2dd8f1){_0x5b5478['push'](_0x5b5478['shift']());}};_0x8d0118(++_0x1be678);}(_0xca66,0x8b));var _0x6ca6=function(_0x6e3024,_0x110caf){_0x6e3024=_0x6e3024-0x0;var _0x1e72bf=_0xca66[_0x6e3024];return _0x1e72bf;};'use strict';var _=require(_0x6ca6('0x0'));var util=require('util');var Imap=require('imap');var simpleParser=require(_0x6ca6('0x1'))[_0x6ca6('0x2')];var Iconv=require(_0x6ca6('0x3'))['Iconv'];var EventEmitter=require(_0x6ca6('0x4'))['EventEmitter'];var utils=require(_0x6ca6('0x5'));var logger=require('../../../config/logger')(_0x6ca6('0x6'));function EmailImap(_0x27d8c6,_0x34836f){this[_0x6ca6('0x7')]=_0x27d8c6[_0x6ca6('0x7')];this[_0x6ca6('0x8')]=this[_0x6ca6('0x9')](_0x27d8c6,_0x34836f);this['imap']=new Imap(this[_0x6ca6('0x8')]);this[_0x6ca6('0xa')][_0x6ca6('0xb')](_0x6ca6('0xc'),this[_0x6ca6('0xd')][_0x6ca6('0xe')](this));this[_0x6ca6('0xa')]['once'](_0x6ca6('0xf'),this[_0x6ca6('0x10')][_0x6ca6('0xe')](this));this[_0x6ca6('0xa')]['on'](_0x6ca6('0x11'),this[_0x6ca6('0x12')]['bind'](this));this[_0x6ca6('0xa')][_0x6ca6('0x13')]();}util['inherits'](EmailImap,EventEmitter);EmailImap[_0x6ca6('0x14')][_0x6ca6('0x9')]=function(_0x3f417f,_0x3570f1){var _0xc774c={'connTimeout':_0x3f417f[_0x6ca6('0x15')]?_0x3f417f['connTimeout']*0x3e8:0x2710,'authTimeout':_0x3f417f['authTimeout']?_0x3f417f['authTimeout']*0x3e8:0x1388};if(_0x3f417f[_0x6ca6('0x16')]){_0xc774c[_0x6ca6('0x17')]=_0x3f417f[_0x6ca6('0x17')];if(_0x3f417f[_0x6ca6('0x18')]){_0xc774c[_0x6ca6('0x19')]=utils[_0x6ca6('0x1a')](_0x3f417f[_0x6ca6('0x1b')]['data5'],_0x3f417f[_0x6ca6('0x17')]);}else{_0xc774c[_0x6ca6('0x1c')]=_0x3f417f[_0x6ca6('0x1c')];}}else{if(_0x3f417f[_0x6ca6('0x1d')]){_0xc774c[_0x6ca6('0x17')]=_0x3f417f[_0x6ca6('0x17')];_0xc774c[_0x6ca6('0x1c')]=_0x3f417f[_0x6ca6('0x1c')];}}_0xc774c[_0x6ca6('0x6')]=_0x3570f1||_0x3f417f[_0x6ca6('0x17')]||_0x6ca6('0x1e');_0xc774c['host']=_0x3f417f[_0x6ca6('0x1f')];_0xc774c[_0x6ca6('0x20')]=_0x3f417f[_0x6ca6('0x20')]||0x3e1;if(_0x3f417f[_0x6ca6('0x21')]){_0xc774c[_0x6ca6('0x21')]=!![];}else{_0xc774c[_0x6ca6('0x21')]=![];_0xc774c['autotls']=_0x6ca6('0x22');}return _0xc774c;};EmailImap[_0x6ca6('0x14')]['handleReady']=function(){this['imap'][_0x6ca6('0x23')](this[_0x6ca6('0x7')],![],this[_0x6ca6('0x24')][_0x6ca6('0xe')](this));};EmailImap[_0x6ca6('0x14')]['handleOpenBox']=function(_0x222373,_0x1d6caa){if(_0x222373){this[_0x6ca6('0x12')](_0x222373,!![]);}else{this[_0x6ca6('0x25')](_0x6ca6('0x26'),_0x1d6caa);this[_0x6ca6('0x27')]();}};EmailImap[_0x6ca6('0x14')][_0x6ca6('0x28')]=function(_0x516daf){if(_0x516daf){this['handleError'](_0x516daf,!![]);}else{this[_0x6ca6('0xa')][_0x6ca6('0xf')]();}};EmailImap[_0x6ca6('0x14')][_0x6ca6('0x27')]=function(){this['imap']['search']([_0x6ca6('0x29')],this['handleReadUnseen']['bind'](this));};EmailImap[_0x6ca6('0x14')][_0x6ca6('0x2a')]=function(_0x4a15cb,_0x50aa5a){if(_0x4a15cb){this[_0x6ca6('0x12')](_0x4a15cb,!![]);}else{if(_0x50aa5a[_0x6ca6('0x2b')]){try{var _0x566543=this['imap'][_0x6ca6('0x2c')](_0x50aa5a,{'bodies':'','markSeen':!![]});_0x566543['on'](_0x6ca6('0x2d'),this[_0x6ca6('0x2e')][_0x6ca6('0xe')](this));_0x566543['once'](_0x6ca6('0x11'),this[_0x6ca6('0x2f')][_0x6ca6('0xe')](this));_0x566543[_0x6ca6('0xb')]('end',this['handleFetchEnd']['bind'](this));}catch(_0x56dd6a){logger['error'](_0x56dd6a);}}else{this[_0x6ca6('0xa')][_0x6ca6('0x30')](!![],this[_0x6ca6('0x28')]['bind'](this));}}};EmailImap[_0x6ca6('0x14')][_0x6ca6('0x2e')]=function(_0x12d057){_0x12d057['on'](_0x6ca6('0x31'),this['handleMessageBody'][_0x6ca6('0xe')](this));_0x12d057[_0x6ca6('0xb')](_0x6ca6('0x32'),this[_0x6ca6('0x33')]['bind'](this));_0x12d057[_0x6ca6('0xb')]('end',this[_0x6ca6('0x34')]['bind'](this));};EmailImap['prototype'][_0x6ca6('0x35')]=function(_0xf73708){simpleParser(_0xf73708,{'Iconv':Iconv},this[_0x6ca6('0x36')][_0x6ca6('0xe')](this));};EmailImap['prototype']['handleMessageAttributes']=function(){};EmailImap[_0x6ca6('0x14')][_0x6ca6('0x34')]=function(){};EmailImap['prototype'][_0x6ca6('0x36')]=function(_0x598e63,_0x2af41f){if(_0x598e63){logger['error'](_0x598e63);}else{var _0x1ada8b=this;utils[_0x6ca6('0x37')](this[_0x6ca6('0x8')],_0x2af41f,function(_0x1eee08){_0x1ada8b[_0x6ca6('0x25')](_0x6ca6('0x6'),_0x1eee08);});}};EmailImap[_0x6ca6('0x14')][_0x6ca6('0x38')]=function(){this['imap'][_0x6ca6('0x30')](!![],this['handleCloseBox']['bind'](this));};EmailImap[_0x6ca6('0x14')][_0x6ca6('0x2f')]=function(_0x52cc41){this[_0x6ca6('0x12')](_0x52cc41);this['imap'][_0x6ca6('0x30')](!![],this[_0x6ca6('0x28')][_0x6ca6('0xe')](this));};EmailImap[_0x6ca6('0x14')]['handleEnd']=function(){this['emit'](_0x6ca6('0xf'));};EmailImap[_0x6ca6('0x14')][_0x6ca6('0x12')]=function(_0x3423e2,_0x4e6d4){logger['error'](_0x6ca6('0x12'),this[_0x6ca6('0x8')]['email'],JSON[_0x6ca6('0x39')](_0x3423e2));var _0x3b60db='';if(_0x3423e2){if(_0x3423e2[_0x6ca6('0x3a')]){_0x3b60db=_0x3423e2[_0x6ca6('0x3a')];}else{for(var _0x1c516e in _0x3423e2){if(_0x3423e2[_0x6ca6('0x3b')](_0x1c516e)){_0x3b60db+=_[_0x6ca6('0x3c')](_0x1c516e)+':\x20'+_0x3423e2[_0x1c516e]+'\x0a';}}}}if(_0x4e6d4){this[_0x6ca6('0xa')][_0x6ca6('0xf')]();}else{this['emit'](_0x6ca6('0x11'),_0x3b60db);this[_0x6ca6('0x25')](_0x6ca6('0xf'));}};module[_0x6ca6('0x3d')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index ce4e1ff..992fd2a 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 _0x6541=['toString','Not\x20verifired','nodemailer-plugin-inline-base64','prototype','send','createTransport','sendMail'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0x6541,0xe2));var _0x1654=function(_0x535331,_0x190990){_0x535331=_0x535331-0x0;var _0x1633cd=_0x6541[_0x535331];return _0x1633cd;};'use strict';var nodemailer=require('nodemailer');var inlineBase64=require(_0x1654('0x0'));function EmailSmtp(){}EmailSmtp[_0x1654('0x1')][_0x1654('0x2')]=function(_0x37737f,_0x46ce7b){return new Promise(function(_0x31989b,_0xc154c1){var _0x1a009f=nodemailer[_0x1654('0x3')](_0x37737f);_0x1a009f['use']('compile',inlineBase64());_0x1a009f[_0x1654('0x4')](_0x46ce7b,function(_0x59f459,_0x3a9e30){if(_0x59f459){_0xc154c1(_0x59f459[_0x1654('0x5')]());}else{_0x31989b(_0x3a9e30);}});});};EmailSmtp[_0x1654('0x1')]['verify']=function(_0x2f5fa3){return new Promise(function(_0x3a5437,_0x4f84dc){var _0x5eea2b=nodemailer['createTransport'](_0x2f5fa3);_0x5eea2b['verify'](function(_0x4528c9,_0x520eac){if(_0x4528c9){_0x4f84dc(_0x4528c9[_0x1654('0x5')]());}else{if(_0x520eac){_0x3a5437(_0x520eac);}else{_0x4f84dc(_0x1654('0x6'));}}});});};module['exports']=EmailSmtp; \ No newline at end of file +var _0xcdae=['toString','verify','createTransport','Not\x20verifired','exports','nodemailer','nodemailer-plugin-inline-base64','prototype','send','use','compile','sendMail'];(function(_0x4a7e98,_0x250137){var _0x27d10d=function(_0x378768){while(--_0x378768){_0x4a7e98['push'](_0x4a7e98['shift']());}};_0x27d10d(++_0x250137);}(_0xcdae,0x1d9));var _0xecda=function(_0x3f6b2b,_0x3dad93){_0x3f6b2b=_0x3f6b2b-0x0;var _0xb7cfd2=_0xcdae[_0x3f6b2b];return _0xb7cfd2;};'use strict';var nodemailer=require(_0xecda('0x0'));var inlineBase64=require(_0xecda('0x1'));function EmailSmtp(){}EmailSmtp[_0xecda('0x2')][_0xecda('0x3')]=function(_0x10efd0,_0x256a84){return new Promise(function(_0x35e104,_0x70a0a4){var _0xce88f1=nodemailer['createTransport'](_0x10efd0);_0xce88f1[_0xecda('0x4')](_0xecda('0x5'),inlineBase64());_0xce88f1[_0xecda('0x6')](_0x256a84,function(_0x5f5c55,_0x4b2b15){if(_0x5f5c55){_0x70a0a4(_0x5f5c55[_0xecda('0x7')]());}else{_0x35e104(_0x4b2b15);}});});};EmailSmtp['prototype'][_0xecda('0x8')]=function(_0x29483f){return new Promise(function(_0x2e797c,_0x25395c){var _0x193fee=nodemailer[_0xecda('0x9')](_0x29483f);_0x193fee['verify'](function(_0x360c82,_0x5dc8d8){if(_0x360c82){_0x25395c(_0x360c82[_0xecda('0x7')]());}else{if(_0x5dc8d8){_0x2e797c(_0x5dc8d8);}else{_0x25395c(_0xecda('0xa'));}}});});};module[_0xecda('0xb')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index d06954e..46b55d1 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 _0x0a49=['Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','parseBuffer','BodyHTML','

Empty\x20message

','Attachments','Title','Data','generateXOAuth2Token','utf-8','toString','base64','lodash','moment','path','util','node-tnef','email','head','value','address','anonymous','generate','@xcally.com','name','split','join','length','isEmpty','html','test','replace','includes','\x20[Attachment:\x20','\x20]','body','0x1?_0x47dd60['slice'](0x0,-0x1)[_0x90a4('0xe')]('\x20'):_0x1a5569[_0x90a4('0xc')];}return'Anonymous';}function getLastName(_0x51e928){var _0x11fd02=_[_0x90a4('0x6')](_0x51e928[_0x90a4('0x7')]);if(_0x11fd02&&_0x11fd02['name']){var _0x5cc4a7=_0x11fd02['name'][_0x90a4('0xd')](/\s+/);return _0x5cc4a7[_0x90a4('0xf')]>0x1?_0x5cc4a7['pop']():'';}return'';}function getMails(_0x3e2ddd,_0x41d411){var _0x1d7d5b='';for(var _0x30de66=0x0;_0x30de66<_0x41d411[_0x90a4('0x7')][_0x90a4('0xf')];_0x30de66+=0x1){if(_0x41d411[_0x90a4('0x7')][_0x30de66][_0x90a4('0x8')]!==_0x3e2ddd){if(!_[_0x90a4('0x10')](_0x1d7d5b)){_0x1d7d5b+=',';}_0x1d7d5b+=_0x41d411[_0x90a4('0x7')][_0x30de66][_0x90a4('0xc')]||_0x41d411[_0x90a4('0x7')][_0x30de66]['address']||'';_0x1d7d5b+='\x20<';_0x1d7d5b+=_0x41d411[_0x90a4('0x7')][_0x30de66][_0x90a4('0x8')]?_0x41d411[_0x90a4('0x7')][_0x30de66][_0x90a4('0x8')]:_0x90a4('0x9')+random[_0x90a4('0xa')](0x6)+_0x90a4('0xb');_0x1d7d5b+='>';}}return _0x1d7d5b;}function parseEmail(_0x48ff99,_0x11b8d5,_0x19b79f){if(_0x11b8d5[_0x90a4('0x11')]){var _0x4bfb21=/)<[^<]*)*<\/script>/gi;while(_0x4bfb21[_0x90a4('0x12')](_0x11b8d5[_0x90a4('0x11')])){_0x11b8d5[_0x90a4('0x11')]=_0x11b8d5[_0x90a4('0x11')][_0x90a4('0x13')](_0x4bfb21,'');}if(_0x11b8d5['html'][_0x90a4('0x14')](_0x90a4('0x15'))){var _0x523ce6=[];_0x11b8d5[_0x90a4('0x16')][_0x90a4('0x17')](_0x8f28f6=>{_0x523ce6[_0x90a4('0x18')](_0x8f28f6[_0x90a4('0x19')]);});var _0x5de1a1=/]+>/g;var _0x10e3b8=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x2f08df=_0x11b8d5[_0x90a4('0x11')][_0x90a4('0x13')](_0x10e3b8,_0x90a4('0x1a'));var _0x1a79ac=_0x2f08df[_0x90a4('0x13')](_0x5de1a1,_0x90a4('0x1b'));for(let _0x2a3a45=0x0;_0x2a3a45<_0x523ce6[_0x90a4('0xf')];_0x2a3a45++){var _0x3558b7=_0x1a79ac[_0x90a4('0x13')](_0x90a4('0x1b'),_0x90a4('0x1c')+_0x523ce6[_0x2a3a45]+_0x90a4('0x1d'));_0x1a79ac=_0x3558b7;}_0x11b8d5[_0x90a4('0x11')]=_0x1a79ac;}_0x19b79f[_0x90a4('0x1e')]=_0x11b8d5['html'];}else{_0x19b79f['body']=_0x11b8d5['textAsHtml'];}if(_0x19b79f[_0x90a4('0x1e')]){_0x19b79f[_0x90a4('0x1e')]=_0x19b79f[_0x90a4('0x1e')][_0x90a4('0x13')](/0x0){var _0xd9f782=[_0x90a4('0x2d'),_0x90a4('0x2e'),_0x90a4('0x2f')];for(var _0x3fea1a=0x0;_0x3fea1a<_0x11b8d5[_0x90a4('0x2c')]['length'];_0x3fea1a++){var _0xb1e145=_[_0x90a4('0x30')](_0xd9f782,_0x11b8d5['headerLines'][_0x3fea1a][_0x90a4('0x31')]);if(_0xb1e145>=0x0){_0x19b79f[_0x90a4('0x32')]=!![];}}}return _0x19b79f;}exports['parser']=function(_0x1c5675,_0xa9c327,_0xf5f26){var _0x9dcb04={'from':getAddress(_0xa9c327['from']),'firstName':getFirstName(_0xa9c327['from']),'lastName':getLastName(_0xa9c327[_0x90a4('0x33')]),'mapKey':_0x90a4('0x5'),'message':{'from':getMails(_0x1c5675['email'],_0xa9c327[_0x90a4('0x33')]),'to':_0x1c5675[_0x90a4('0x5')],'cc':'','subject':_0xa9c327[_0x90a4('0x34')]||'','messageId':_0xa9c327[_0x90a4('0x35')],'inReplyTo':_0xa9c327[_0x90a4('0x36')],'sentAt':moment(_0xa9c327[_0x90a4('0x37')])[_0x90a4('0x26')](_0x90a4('0x38')),'attach':![],'attachments':[]}};if(!_0xa9c327[_0x90a4('0x11')]&&!_0xa9c327['textAsHtml']){var _0x9cf416=_[_0x90a4('0x39')](_0xa9c327[_0x90a4('0x16')],{'contentType':'application/ms-tnef'});if(_0x9cf416[_0x90a4('0xf')]){logger['info'](util[_0x90a4('0x26')](_0x90a4('0x3a'),_0xa9c327['messageId']));tnef[_0x90a4('0x3b')](_['first'](_0x9cf416)[_0x90a4('0x2a')],function(_0x3a75c0,_0xe6239d){if(_0xe6239d){_0xa9c327[_0x90a4('0x11')]=_0xe6239d[_0x90a4('0x3c')]||_0x90a4('0x3d');if(_0xe6239d[_0x90a4('0x3e')]){for(var _0x89c7c8=0x0;_0x89c7c8<_0xe6239d['Attachments'][_0x90a4('0xf')];_0x89c7c8++){var _0xfae0a0=_0xe6239d[_0x90a4('0x3e')][_0x89c7c8];_0x9dcb04[_0x90a4('0x20')][_0x90a4('0x16')][_0x90a4('0x18')]({'filename':_0xfae0a0[_0x90a4('0x3f')],'content':Buffer[_0x90a4('0x33')](_0xfae0a0[_0x90a4('0x40')])});}}}_0xf5f26(parseEmail(_0x1c5675,_0xa9c327,_0x9dcb04));});}else{_0xa9c327[_0x90a4('0x11')]=_0x90a4('0x3d');_0xf5f26(parseEmail(_0x1c5675,_0xa9c327,_0x9dcb04));}}else{_0xf5f26(parseEmail(_0x1c5675,_0xa9c327,_0x9dcb04));}};exports[_0x90a4('0x41')]=function(_0x1d9545,_0x9a8672){var _0x5bf588=['user='+(_0x9a8672||''),'auth=Bearer\x20'+_0x1d9545,'',''];return Buffer[_0x90a4('0x33')](_0x5bf588[_0x90a4('0xe')](''),_0x90a4('0x42'))[_0x90a4('0x43')](_0x90a4('0x44'));}; \ No newline at end of file +var _0x62bd=['message','includes','originCc','type','format','now','server/files/attachments/','writeFileSync','content','Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply','headerLines','line','isAutoreply','from','subject','messageId','inReplyTo','YYYY-MM-DD\x20HH:mm:ss','filter','application/ms-tnef','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','BodyHTML','Attachments','Title','Data','

Empty\x20message

','generateXOAuth2Token','user=','auth=Bearer\x20','utf-8','toString','randomstring','path','util','../../../config/logger','email','../../../config/environment','value','address','anonymous','generate','@xcally.com','name','substring','indexOf','split','join','Anonymous','head','length','isEmpty','html','test','replace','\x20[Attachment:\x20','\x20]','body','textAsHtml','0x1?_0x5c79f3['slice'](0x0,-0x1)[_0xd62b('0xf')]('\x20'):_0x123be1[_0xd62b('0xb')];}return _0xd62b('0x10');}function getLastName(_0x49426d){var _0x416d6f=_[_0xd62b('0x11')](_0x49426d['value']);if(_0x416d6f&&_0x416d6f['name']){var _0x1811c9=_0x416d6f[_0xd62b('0xb')][_0xd62b('0xe')](/\s+/);return _0x1811c9[_0xd62b('0x12')]>0x1?_0x1811c9['pop']():'';}return'';}function getMails(_0x49e30c,_0x48ff3b){var _0x4773e0='';for(var _0x111e0d=0x0;_0x111e0d<_0x48ff3b[_0xd62b('0x6')][_0xd62b('0x12')];_0x111e0d+=0x1){if(_0x48ff3b[_0xd62b('0x6')][_0x111e0d]['address']!==_0x49e30c){if(!_[_0xd62b('0x13')](_0x4773e0)){_0x4773e0+=',';}_0x4773e0+=_0x48ff3b[_0xd62b('0x6')][_0x111e0d][_0xd62b('0xb')]||_0x48ff3b[_0xd62b('0x6')][_0x111e0d][_0xd62b('0x7')]||'';_0x4773e0+='\x20<';_0x4773e0+=_0x48ff3b[_0xd62b('0x6')][_0x111e0d][_0xd62b('0x7')]?_0x48ff3b[_0xd62b('0x6')][_0x111e0d][_0xd62b('0x7')]:'anonymous'+random['generate'](0x6)+_0xd62b('0xa');_0x4773e0+='>';}}return _0x4773e0;}function parseEmail(_0x21962e,_0x3b1936,_0x502c55){if(_0x3b1936[_0xd62b('0x14')]){var _0x39882f=/)<[^<]*)*<\/script>/gi;while(_0x39882f[_0xd62b('0x15')](_0x3b1936[_0xd62b('0x14')])){_0x3b1936[_0xd62b('0x14')]=_0x3b1936['html'][_0xd62b('0x16')](_0x39882f,'');}if(_0x3b1936[_0xd62b('0x14')]['includes'](_0xd62b('0x17'))){var _0x1be68c=[];_0x3b1936[_0xd62b('0x18')]['forEach'](_0x3bcb3b=>{_0x1be68c[_0xd62b('0x19')](_0x3bcb3b[_0xd62b('0x1a')]);});var _0xeae4dd=/]+>/g;var _0x223ee1=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x21bd0d=_0x3b1936[_0xd62b('0x14')][_0xd62b('0x16')](_0x223ee1,_0xd62b('0x1b'));var _0x2bdc19=_0x21bd0d['replace'](_0xeae4dd,'_IMG');for(let _0x457131=0x0;_0x457131<_0x1be68c[_0xd62b('0x12')];_0x457131++){var _0x3e6c0d=_0x2bdc19['replace']('_IMG',_0xd62b('0x1c')+_0x1be68c[_0x457131]+_0xd62b('0x1d'));_0x2bdc19=_0x3e6c0d;}_0x3b1936[_0xd62b('0x14')]=_0x2bdc19;}_0x502c55[_0xd62b('0x1e')]=_0x3b1936[_0xd62b('0x14')];}else{_0x502c55['body']=_0x3b1936[_0xd62b('0x1f')];}if(_0x502c55[_0xd62b('0x1e')]){_0x502c55[_0xd62b('0x1e')]=_0x502c55['body']['replace'](/0x0){var _0x371165=[_0xd62b('0x2a'),_0xd62b('0x2b'),_0xd62b('0x2c')];for(var _0x382e32=0x0;_0x382e32<_0x3b1936[_0xd62b('0x2d')][_0xd62b('0x12')];_0x382e32++){var _0x4cbee7=_[_0xd62b('0xd')](_0x371165,_0x3b1936[_0xd62b('0x2d')][_0x382e32][_0xd62b('0x2e')]);if(_0x4cbee7>=0x0){_0x502c55[_0xd62b('0x2f')]=!![];}}}return _0x502c55;}exports['parser']=function(_0x33cd8e,_0x264cba,_0x2ef60c){var _0x203673={'from':getAddress(_0x264cba['from']),'firstName':getFirstName(_0x264cba[_0xd62b('0x30')]),'lastName':getLastName(_0x264cba['from']),'mapKey':'email','message':{'from':getMails(_0x33cd8e[_0xd62b('0x4')],_0x264cba[_0xd62b('0x30')]),'to':_0x33cd8e['email'],'cc':'','subject':_0x264cba[_0xd62b('0x31')]||'','messageId':_0x264cba[_0xd62b('0x32')],'inReplyTo':_0x264cba[_0xd62b('0x33')],'sentAt':moment(_0x264cba['date'])[_0xd62b('0x25')](_0xd62b('0x34')),'attach':![],'attachments':[]}};if(!_0x264cba[_0xd62b('0x14')]&&!_0x264cba[_0xd62b('0x1f')]){var _0x35c953=_[_0xd62b('0x35')](_0x264cba[_0xd62b('0x18')],{'contentType':_0xd62b('0x36')});if(_0x35c953[_0xd62b('0x12')]){logger[_0xd62b('0x37')](util[_0xd62b('0x25')](_0xd62b('0x38'),_0x264cba['messageId']));tnef['parseBuffer'](_['first'](_0x35c953)[_0xd62b('0x29')],function(_0x104580,_0x1c8ba6){if(_0x1c8ba6){_0x264cba[_0xd62b('0x14')]=_0x1c8ba6[_0xd62b('0x39')]||'

Empty\x20message

';if(_0x1c8ba6['Attachments']){for(var _0x1f77d7=0x0;_0x1f77d7<_0x1c8ba6[_0xd62b('0x3a')][_0xd62b('0x12')];_0x1f77d7++){var _0x303e96=_0x1c8ba6[_0xd62b('0x3a')][_0x1f77d7];_0x203673[_0xd62b('0x21')][_0xd62b('0x18')][_0xd62b('0x19')]({'filename':_0x303e96[_0xd62b('0x3b')],'content':Buffer[_0xd62b('0x30')](_0x303e96[_0xd62b('0x3c')])});}}}_0x2ef60c(parseEmail(_0x33cd8e,_0x264cba,_0x203673));});}else{_0x264cba[_0xd62b('0x14')]=_0xd62b('0x3d');_0x2ef60c(parseEmail(_0x33cd8e,_0x264cba,_0x203673));}}else{_0x2ef60c(parseEmail(_0x33cd8e,_0x264cba,_0x203673));}};exports[_0xd62b('0x3e')]=function(_0x4e37cc,_0x11d2a2){var _0xcf6233=[_0xd62b('0x3f')+(_0x11d2a2||''),_0xd62b('0x40')+_0x4e37cc,'',''];return Buffer[_0xd62b('0x30')](_0xcf6233[_0xd62b('0xf')](''),_0xd62b('0x41'))[_0xd62b('0x42')]('base64');}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 2a20a7f..ad931e1 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 _0x0faa=['Imap','Smtp','name','Service','key','SERV','active'];(function(_0x44dc4c,_0x357e6a){var _0x4e644e=function(_0x2f033e){while(--_0x2f033e){_0x44dc4c['push'](_0x44dc4c['shift']());}};_0x4e644e(++_0x357e6a);}(_0x0faa,0x1bb));var _0xa0fa=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x0faa[_0x5d2803];return _0xdcad2c;};'use strict';var _=require('lodash');function MailAccount(_0x2fba46){this['id']=_0x2fba46['id']||0x0;this[_0xa0fa('0x0')]=_0x2fba46[_0xa0fa('0x0')]||_0xa0fa('0x1');this[_0xa0fa('0x2')]=_0x2fba46[_0xa0fa('0x2')]||_0xa0fa('0x3');this[_0xa0fa('0x4')]=_0x2fba46[_0xa0fa('0x4')]||![];this[_0xa0fa('0x5')]=_0x2fba46['Imap']||[];this[_0xa0fa('0x6')]=_0x2fba46['Smtp']||[];}module['exports']=MailAccount; \ No newline at end of file +var _0x8b68=['exports','lodash','Service','key','Imap','Smtp'];(function(_0x27c24e,_0x5db1c7){var _0x39004a=function(_0x44286d){while(--_0x44286d){_0x27c24e['push'](_0x27c24e['shift']());}};_0x39004a(++_0x5db1c7);}(_0x8b68,0x133));var _0x88b6=function(_0x298175,_0x2dd1c7){_0x298175=_0x298175-0x0;var _0x55b2aa=_0x8b68[_0x298175];return _0x55b2aa;};'use strict';var _=require(_0x88b6('0x0'));function MailAccount(_0x3f1ccf){this['id']=_0x3f1ccf['id']||0x0;this['name']=_0x3f1ccf['name']||_0x88b6('0x1');this[_0x88b6('0x2')]=_0x3f1ccf[_0x88b6('0x2')]||'SERV';this['active']=_0x3f1ccf['active']||![];this['Imap']=_0x3f1ccf[_0x88b6('0x3')]||[];this[_0x88b6('0x4')]=_0x3f1ccf[_0x88b6('0x4')]||[];}module[_0x88b6('0x5')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index d19e051..0a1bf7a 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 _0xcaa0=['hasOwnProperty','prototype','initMailAccounts','isUndefined','exports','lodash','../model/mailAccount','mailAccounts','mapKeys'];(function(_0x23fbe6,_0x22f15c){var _0x1264ce=function(_0x2cea28){while(--_0x2cea28){_0x23fbe6['push'](_0x23fbe6['shift']());}};_0x1264ce(++_0x22f15c);}(_0xcaa0,0x101));var _0x0caa=function(_0x49ebed,_0x2ed245){_0x49ebed=_0x49ebed-0x0;var _0x247194=_0xcaa0[_0x49ebed];return _0x247194;};'use strict';var _=require(_0x0caa('0x0'));var MailAccount=require(_0x0caa('0x1'));var Realtime=function(){this[_0x0caa('0x2')]={};};function freeIsNotKey(_0x7169c0,_0x1b3211,_0x256870){var _0x35e8b8=_[_0x0caa('0x3')](_0x7169c0,function(_0x43c9ce,_0x4a6845){return _0x43c9ce[_0x256870];});for(var _0x3b6c26 in _0x1b3211){if(_0x1b3211[_0x0caa('0x4')](_0x3b6c26)){if(!_0x35e8b8[_0x3b6c26]){delete _0x1b3211[_0x3b6c26];}}}}Realtime[_0x0caa('0x5')]['mergeFromDatabase']=function(_0x5ef22d,_0x37d601){for(var _0x291d19 in _0x37d601){if(_0x5ef22d[_0x0caa('0x4')](_0x291d19)){_0x5ef22d[_0x291d19]=_0x37d601[_0x291d19];}}};Realtime[_0x0caa('0x5')][_0x0caa('0x6')]=function(){var _0x1411a7=this;return function(_0x291c5b){if(_0x291c5b){freeIsNotKey(_0x291c5b,_0x1411a7[_0x0caa('0x2')],'id');for(var _0x5d1f1c=0x0,_0x31429b={},_0x1e1cae={};_0x5d1f1c<_0x291c5b['length'];_0x5d1f1c+=0x1){_0x31429b=_0x291c5b[_0x5d1f1c];if(_[_0x0caa('0x7')](_0x1411a7[_0x0caa('0x2')][_0x31429b['id']])){_0x1411a7['mailAccounts'][_0x31429b['id']]=new MailAccount(_0x31429b);}else{_['merge'](_0x1411a7['mailAccounts'][_0x31429b['id']],_0x31429b);}}}return _0x1411a7[_0x0caa('0x2')];};};module[_0x0caa('0x8')]=Realtime; \ No newline at end of file +var _0x767b=['length','isUndefined','merge','lodash','../model/mailAccount','mailAccounts','mapKeys','prototype','mergeFromDatabase','hasOwnProperty','initMailAccounts'];(function(_0x3ea283,_0x39259a){var _0x37e07e=function(_0x46b663){while(--_0x46b663){_0x3ea283['push'](_0x3ea283['shift']());}};_0x37e07e(++_0x39259a);}(_0x767b,0x184));var _0xb767=function(_0x1233d1,_0x15cf04){_0x1233d1=_0x1233d1-0x0;var _0x56ee5e=_0x767b[_0x1233d1];return _0x56ee5e;};'use strict';var _=require(_0xb767('0x0'));var MailAccount=require(_0xb767('0x1'));var Realtime=function(){this[_0xb767('0x2')]={};};function freeIsNotKey(_0xbed517,_0x9d8c99,_0x59bc87){var _0x32e3a4=_[_0xb767('0x3')](_0xbed517,function(_0x4ef7f1,_0x4a83b4){return _0x4ef7f1[_0x59bc87];});for(var _0x50bf2e in _0x9d8c99){if(_0x9d8c99['hasOwnProperty'](_0x50bf2e)){if(!_0x32e3a4[_0x50bf2e]){delete _0x9d8c99[_0x50bf2e];}}}}Realtime[_0xb767('0x4')][_0xb767('0x5')]=function(_0x195935,_0x4acc39){for(var _0x4b5e14 in _0x4acc39){if(_0x195935[_0xb767('0x6')](_0x4b5e14)){_0x195935[_0x4b5e14]=_0x4acc39[_0x4b5e14];}}};Realtime[_0xb767('0x4')][_0xb767('0x7')]=function(){var _0xb8e981=this;return function(_0x39c741){if(_0x39c741){freeIsNotKey(_0x39c741,_0xb8e981[_0xb767('0x2')],'id');for(var _0x187346=0x0,_0x5b7abe={},_0x80d753={};_0x187346<_0x39c741[_0xb767('0x8')];_0x187346+=0x1){_0x5b7abe=_0x39c741[_0x187346];if(_[_0xb767('0x9')](_0xb8e981[_0xb767('0x2')][_0x5b7abe['id']])){_0xb8e981[_0xb767('0x2')][_0x5b7abe['id']]=new MailAccount(_0x5b7abe);}else{_[_0xb767('0xa')](_0xb8e981[_0xb767('0x2')][_0x5b7abe['id']],_0x5b7abe);}}}return _0xb8e981[_0xb767('0x2')];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index a376895..3a95977 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 _0x2687=['provider','email','active','key','TemplateId','MailServerIn','Imap','service','type','data5','CloudProvider','MailServerOut','Smtp','getMailAccount','notify','Request','NotifyMailAccount','../client','getMailAccounts','GetMailAccount','name'];(function(_0x447c01,_0x54baa7){var _0x7cfc39=function(_0x1bc594){while(--_0x1bc594){_0x447c01['push'](_0x447c01['shift']());}};_0x7cfc39(++_0x54baa7);}(_0x2687,0x8f));var _0x7268=function(_0x27af8e,_0x44328b){_0x27af8e=_0x27af8e-0x0;var _0x3d00f8=_0x2687[_0x27af8e];return _0x3d00f8;};'use strict';var client=require(_0x7268('0x0'));exports[_0x7268('0x1')]=function(){return function(){return client['Request'](_0x7268('0x2'),{'options':{'attributes':['id',_0x7268('0x3'),_0x7268('0x4'),'service',_0x7268('0x5'),_0x7268('0x6'),_0x7268('0x7'),'ListId',_0x7268('0x8')],'raw':![],'include':[{'model':_0x7268('0x9'),'as':_0x7268('0xa'),'include':[{'model':'CloudProvider','attributes':['id','name',_0x7268('0xb'),_0x7268('0xc'),_0x7268('0xd')],'as':_0x7268('0xe')}]},{'model':_0x7268('0xf'),'as':_0x7268('0x10'),'include':[{'model':_0x7268('0xe'),'attributes':['id',_0x7268('0x3'),_0x7268('0xb'),_0x7268('0xc'),_0x7268('0xd')],'as':_0x7268('0xe')}]}]},'log':_0x7268('0x11')});};};exports[_0x7268('0x12')]=function(_0x544ab8,_0x2cf06c){return client[_0x7268('0x13')](_0x7268('0x14'),{'account':{'id':_0x544ab8},'body':_0x2cf06c,'log':_0x7268('0x14')});}; \ No newline at end of file +var _0x8458=['getMailAccount','notify','NotifyMailAccount','../client','Request','GetMailAccount','name','provider','service','active','key','ListId','TemplateId','MailServerIn','CloudProvider','type','data5','MailServerOut','Smtp'];(function(_0x27ddf5,_0x5a3e18){var _0x26e74a=function(_0x5f24ac){while(--_0x5f24ac){_0x27ddf5['push'](_0x27ddf5['shift']());}};_0x26e74a(++_0x5a3e18);}(_0x8458,0x1a5));var _0x8845=function(_0x103c7e,_0x1a0adb){_0x103c7e=_0x103c7e-0x0;var _0x5a9e68=_0x8458[_0x103c7e];return _0x5a9e68;};'use strict';var client=require(_0x8845('0x0'));exports['getMailAccounts']=function(){return function(){return client[_0x8845('0x1')](_0x8845('0x2'),{'options':{'attributes':['id',_0x8845('0x3'),_0x8845('0x4'),_0x8845('0x5'),'email',_0x8845('0x6'),_0x8845('0x7'),_0x8845('0x8'),_0x8845('0x9')],'raw':![],'include':[{'model':_0x8845('0xa'),'as':'Imap','include':[{'model':_0x8845('0xb'),'attributes':['id','name',_0x8845('0x5'),_0x8845('0xc'),_0x8845('0xd')],'as':'CloudProvider'}]},{'model':_0x8845('0xe'),'as':_0x8845('0xf'),'include':[{'model':'CloudProvider','attributes':['id',_0x8845('0x3'),_0x8845('0x5'),'type',_0x8845('0xd')],'as':_0x8845('0xb')}]}]},'log':_0x8845('0x10')});};};exports[_0x8845('0x11')]=function(_0x1bacfd,_0x2191ad){return client[_0x8845('0x1')](_0x8845('0x12'),{'account':{'id':_0x1bacfd},'body':_0x2191ad,'log':_0x8845('0x12')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 2ca7e16..19bc68e 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 _0x512a=['Request','ShowSetting','loginMailFrequency','GetSettings','../client','getSettings'];(function(_0x229186,_0x1c0132){var _0x404187=function(_0x3c673a){while(--_0x3c673a){_0x229186['push'](_0x229186['shift']());}};_0x404187(++_0x1c0132);}(_0x512a,0xe8));var _0xa512=function(_0x219acd,_0x523c15){_0x219acd=_0x219acd-0x0;var _0x54fb1c=_0x512a[_0x219acd];return _0x54fb1c;};'use strict';var client=require(_0xa512('0x0'));exports[_0xa512('0x1')]=function(){return client[_0xa512('0x2')](_0xa512('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xa512('0x4')]},'log':_0xa512('0x5')});}; \ No newline at end of file +var _0x2702=['loginMailFrequency','GetSettings','getSettings','Request','ShowSetting'];(function(_0x211f6a,_0x1a2e20){var _0x3aaff0=function(_0x1c866d){while(--_0x1c866d){_0x211f6a['push'](_0x211f6a['shift']());}};_0x3aaff0(++_0x1a2e20);}(_0x2702,0x89));var _0x2270=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x2702[_0x4154a6];return _0x3b2786;};'use strict';var client=require('../client');exports[_0x2270('0x0')]=function(){return client[_0x2270('0x1')](_0x2270('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x2270('0x3')]},'log':_0x2270('0x4')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index f102453..030e67a 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(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file +var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'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 0c49c62..ad5a73e 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 _0x873a=['localhost','adapter','socket.io-redis','../../config/triggers','default','../../config/express','../../routes','log','Express\x20server\x20listening\x20on\x20port\x20%d!','http','express','sticky-session','ioredis','../../config/environment','createServer','timeout','listen','port','redis','defaults'];(function(_0x4b3365,_0x2ab1d3){var _0x49db42=function(_0x86372b){while(--_0x86372b){_0x4b3365['push'](_0x4b3365['shift']());}};_0x49db42(++_0x2ab1d3);}(_0x873a,0x1ad));var _0xa873=function(_0x393ebe,_0x767a0e){_0x393ebe=_0x393ebe-0x0;var _0xd31f16=_0x873a[_0x393ebe];return _0xd31f16;};'use strict';var _=require('lodash');var http=require(_0xa873('0x0'));var express=require(_0xa873('0x1'));var sticky=require(_0xa873('0x2'));var Redis=require(_0xa873('0x3'));var config=require(_0xa873('0x4'));var app=express();var server=http[_0xa873('0x5')](app);server[_0xa873('0x6')]=0xdbba0;if(sticky[_0xa873('0x7')](server,config[_0xa873('0x8')])){var socketio=require('socket.io')(server,{'transports':['websocket','polling']});config[_0xa873('0x9')]=_[_0xa873('0xa')](config[_0xa873('0x9')],{'host':_0xa873('0xb'),'port':0x18eb});socketio[_0xa873('0xc')](require(_0xa873('0xd'))({'pubClient':new Redis(config[_0xa873('0x9')]),'subClient':new Redis(config[_0xa873('0x9')])}));require(_0xa873('0xe'))['default']();require('../../config/socketio')[_0xa873('0xf')](socketio);require(_0xa873('0x10'))[_0xa873('0xf')](app);require(_0xa873('0x11'))['default'](app);}else{server['once']('listening',function(){console[_0xa873('0x12')](_0xa873('0x13'),config[_0xa873('0x8')]);});}exports=module['exports']=app; \ No newline at end of file +var _0x1bf5=['log','lodash','http','express','ioredis','../../config/environment','createServer','timeout','listen','port','polling','redis','defaults','localhost','adapter','socket.io-redis','default','../../config/socketio','../../config/express','../../routes','listening'];(function(_0x1cd9d7,_0x112754){var _0x41522f=function(_0x4ab6bb){while(--_0x4ab6bb){_0x1cd9d7['push'](_0x1cd9d7['shift']());}};_0x41522f(++_0x112754);}(_0x1bf5,0x127));var _0x51bf=function(_0x4819c3,_0x36732d){_0x4819c3=_0x4819c3-0x0;var _0x3c6537=_0x1bf5[_0x4819c3];return _0x3c6537;};'use strict';var _=require(_0x51bf('0x0'));var http=require(_0x51bf('0x1'));var express=require(_0x51bf('0x2'));var sticky=require('sticky-session');var Redis=require(_0x51bf('0x3'));var config=require(_0x51bf('0x4'));var app=express();var server=http[_0x51bf('0x5')](app);server[_0x51bf('0x6')]=0xdbba0;if(sticky[_0x51bf('0x7')](server,config[_0x51bf('0x8')])){var socketio=require('socket.io')(server,{'transports':['websocket',_0x51bf('0x9')]});config[_0x51bf('0xa')]=_[_0x51bf('0xb')](config['redis'],{'host':_0x51bf('0xc'),'port':0x18eb});socketio[_0x51bf('0xd')](require(_0x51bf('0xe'))({'pubClient':new Redis(config['redis']),'subClient':new Redis(config[_0x51bf('0xa')])}));require('../../config/triggers')[_0x51bf('0xf')]();require(_0x51bf('0x10'))[_0x51bf('0xf')](socketio);require(_0x51bf('0x11'))[_0x51bf('0xf')](app);require(_0x51bf('0x12'))[_0x51bf('0xf')](app);}else{server['once'](_0x51bf('0x13'),function(){console[_0x51bf('0x14')]('Express\x20server\x20listening\x20on\x20port\x20%d!',config[_0x51bf('0x8')]);});}exports=module['exports']=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index e624128..a2c7597 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 _0xfede=['error','message','result','catch','exports','jayson/promise','../../config/logger','client','Request','request','then','debug','rpc','routing'];(function(_0x2802f3,_0x1becfd){var _0x360179=function(_0x50f8bb){while(--_0x50f8bb){_0x2802f3['push'](_0x2802f3['shift']());}};_0x360179(++_0x1becfd);}(_0xfede,0x163));var _0xefed=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0xfede[_0x2b5eae];return _0x5f3ac9;};'use strict';var jayson=require(_0xefed('0x0'));var BPromise=require('bluebird');var logger=require(_0xefed('0x1'))('routing');var client=jayson[_0xefed('0x2')]['http']({'port':0x2329});client[_0xefed('0x3')]=function(_0x5948b9,_0xdaef26){return new BPromise(function(_0x3561ed,_0x3174f9){return client[_0xefed('0x4')](_0x5948b9,_0xdaef26)[_0xefed('0x5')](function(_0x91bd9){logger[_0xefed('0x6')](_0xefed('0x7'),_0xefed('0x8'),_0x5948b9,_0xdaef26,_0x91bd9);if(_0x91bd9[_0xefed('0x9')]){logger[_0xefed('0x9')](_0xefed('0x7'),_0xefed('0x8'),_0x5948b9,_0x91bd9['error'][_0xefed('0xa')],_0xdaef26);return _0x3174f9(_0x91bd9[_0xefed('0x9')][_0xefed('0xa')]);}else{return _0x3561ed(_0x91bd9[_0xefed('0xb')]);}})[_0xefed('0xc')](function(_0x2ded55){logger[_0xefed('0x9')](_0xefed('0x7'),_0xefed('0x8'),_0x5948b9,_0x2ded55,_0xdaef26);return _0x3174f9(_0x2ded55);});});};module[_0xefed('0xd')]=client; \ No newline at end of file +var _0x1fb1=['routing','client','Request','request','then','debug','rpc','error','message','result','catch','jayson/promise','bluebird','../../config/logger'];(function(_0x1e561f,_0x73c8d9){var _0x49414c=function(_0x27553a){while(--_0x27553a){_0x1e561f['push'](_0x1e561f['shift']());}};_0x49414c(++_0x73c8d9);}(_0x1fb1,0x1bd));var _0x11fb=function(_0x32ab11,_0x7e6ee7){_0x32ab11=_0x32ab11-0x0;var _0x33f32d=_0x1fb1[_0x32ab11];return _0x33f32d;};'use strict';var jayson=require(_0x11fb('0x0'));var BPromise=require(_0x11fb('0x1'));var logger=require(_0x11fb('0x2'))(_0x11fb('0x3'));var client=jayson[_0x11fb('0x4')]['http']({'port':0x2329});client[_0x11fb('0x5')]=function(_0x1e935d,_0x2b88c9){return new BPromise(function(_0x2cf7e7,_0x37353a){return client[_0x11fb('0x6')](_0x1e935d,_0x2b88c9)[_0x11fb('0x7')](function(_0x15557c){logger[_0x11fb('0x8')](_0x11fb('0x9'),_0x11fb('0x3'),_0x1e935d,_0x2b88c9,_0x15557c);if(_0x15557c[_0x11fb('0xa')]){logger['error'](_0x11fb('0x9'),'routing',_0x1e935d,_0x15557c[_0x11fb('0xa')][_0x11fb('0xb')],_0x2b88c9);return _0x37353a(_0x15557c[_0x11fb('0xa')][_0x11fb('0xb')]);}else{return _0x2cf7e7(_0x15557c[_0x11fb('0xc')]);}})[_0x11fb('0xd')](function(_0xc5f573){logger[_0x11fb('0xa')]('rpc',_0x11fb('0x3'),_0x1e935d,_0xc5f573,_0x2b88c9);return _0x37353a(_0xc5f573);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 71eb47f..d9deeff 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 _0x47d2=['listen','catch','log','bluebird','./realtime','./rpc/user','./rpc/openchannelQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','getAgents','initAgents','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues'];(function(_0x323430,_0x3d2b6d){var _0x9eecd1=function(_0xab855a){while(--_0xab855a){_0x323430['push'](_0x323430['shift']());}};_0x9eecd1(++_0x3d2b6d);}(_0x47d2,0x77));var _0x247d=function(_0x4e89bb,_0x2d79e3){_0x4e89bb=_0x4e89bb-0x0;var _0x5e3fd6=_0x47d2[_0x4e89bb];return _0x5e3fd6;};'use strict';var BPromise=require(_0x247d('0x0'));var server=require('./server');var Realtime=require(_0x247d('0x1'));var user=require(_0x247d('0x2'));var interval=require('./rpc/interval');var openchannelQueue=require(_0x247d('0x3'));var chatQueue=require('./rpc/chatQueue');var smsQueue=require(_0x247d('0x4'));var mailQueue=require(_0x247d('0x5'));var faxQueue=require(_0x247d('0x6'));var whatsappQueue=require(_0x247d('0x7'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x247d('0x8')]()[_0x247d('0x9')](user[_0x247d('0xa')]())[_0x247d('0x9')](realtime[_0x247d('0xb')]())[_0x247d('0x9')](interval[_0x247d('0xc')]())[_0x247d('0x9')](realtime[_0x247d('0xd')]())[_0x247d('0x9')](openchannelQueue[_0x247d('0xe')]())[_0x247d('0x9')](realtime[_0x247d('0xf')]())[_0x247d('0x9')](chatQueue[_0x247d('0x10')]())[_0x247d('0x9')](realtime[_0x247d('0x11')]())[_0x247d('0x9')](smsQueue[_0x247d('0x12')]())[_0x247d('0x9')](realtime[_0x247d('0x13')]())[_0x247d('0x9')](mailQueue[_0x247d('0x14')]())[_0x247d('0x9')](realtime[_0x247d('0x15')]())[_0x247d('0x9')](faxQueue[_0x247d('0x16')]())['then'](realtime[_0x247d('0x17')]())[_0x247d('0x9')](whatsappQueue[_0x247d('0x18')]())[_0x247d('0x9')](realtime[_0x247d('0x19')]())[_0x247d('0x9')](function(){return realtime;});}function main(){return server[_0x247d('0x1a')](realtime)[_0x247d('0x9')](function(_0xd181d8){return initRealtime();})['then'](function(_0x3f2560){return setInterval(initRealtime,0x1388);})[_0x247d('0x1b')](function(_0x30bfac){console[_0x247d('0x1c')](_0x30bfac);});}main(); \ No newline at end of file +var _0xa044=['log','bluebird','./server','./realtime','./rpc/user','./rpc/openchannelQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','then','getAgents','initAgents','getIntervals','initIntervals','getOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','initWhatsappQueues','listen','catch'];(function(_0x1626f1,_0x20eb13){var _0x4e7f52=function(_0x21e1cf){while(--_0x21e1cf){_0x1626f1['push'](_0x1626f1['shift']());}};_0x4e7f52(++_0x20eb13);}(_0xa044,0x1ef));var _0x4a04=function(_0x50f19a,_0xa5fafe){_0x50f19a=_0x50f19a-0x0;var _0xde90b6=_0xa044[_0x50f19a];return _0xde90b6;};'use strict';var BPromise=require(_0x4a04('0x0'));var server=require(_0x4a04('0x1'));var Realtime=require(_0x4a04('0x2'));var user=require(_0x4a04('0x3'));var interval=require('./rpc/interval');var openchannelQueue=require(_0x4a04('0x4'));var chatQueue=require('./rpc/chatQueue');var smsQueue=require(_0x4a04('0x5'));var mailQueue=require(_0x4a04('0x6'));var faxQueue=require(_0x4a04('0x7'));var whatsappQueue=require('./rpc/whatsappQueue');var realtime=new Realtime();function initRealtime(){return BPromise['resolve']()[_0x4a04('0x8')](user[_0x4a04('0x9')]())['then'](realtime[_0x4a04('0xa')]())['then'](interval[_0x4a04('0xb')]())[_0x4a04('0x8')](realtime[_0x4a04('0xc')]())['then'](openchannelQueue[_0x4a04('0xd')]())[_0x4a04('0x8')](realtime['initOpenchannelQueues']())[_0x4a04('0x8')](chatQueue[_0x4a04('0xe')]())[_0x4a04('0x8')](realtime[_0x4a04('0xf')]())[_0x4a04('0x8')](smsQueue[_0x4a04('0x10')]())[_0x4a04('0x8')](realtime[_0x4a04('0x11')]())[_0x4a04('0x8')](mailQueue[_0x4a04('0x12')]())[_0x4a04('0x8')](realtime[_0x4a04('0x13')]())['then'](faxQueue[_0x4a04('0x14')]())[_0x4a04('0x8')](realtime[_0x4a04('0x15')]())[_0x4a04('0x8')](whatsappQueue['getWhatsappQueues']())[_0x4a04('0x8')](realtime[_0x4a04('0x16')]())['then'](function(){return realtime;});}function main(){return server[_0x4a04('0x17')](realtime)['then'](function(_0x371771){return initRealtime();})[_0x4a04('0x8')](function(_0x2d5faf){return setInterval(initRealtime,0x1388);})[_0x4a04('0x18')](function(_0x198def){console[_0x4a04('0x19')](_0x198def);});}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 3aeff18..bf9f389 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 _0x7a54=['turn','prioritize','priority','toJSON','map','toString','fromJSON','isString','object','exports','lodash','util','events','isNil','register','ignoreFactChanges','inherits','init','rules','activeRules','concat','prototype','sync','filter','orderBy','asc','execute','clone','consequence','ruleRef','name','index_','nextTick','push','call','isEqual','restart','length','condition','matchPath','noop','findRules'];(function(_0x20b931,_0x1a5889){var _0x13272d=function(_0x168158){while(--_0x168158){_0x20b931['push'](_0x20b931['shift']());}};_0x13272d(++_0x1a5889);}(_0x7a54,0x106));var _0x47a5=function(_0x51344c,_0xfc9fc5){_0x51344c=_0x51344c-0x0;var _0x44aa28=_0x7a54[_0x51344c];return _0x44aa28;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var EventEmitter=require(_0x47a5('0x2'))['EventEmitter'];function RuleEngine(_0x1d33e,_0x4086cd){this['init']();if(!_[_0x47a5('0x3')](_0x1d33e)){this[_0x47a5('0x4')](_0x1d33e);}if(_0x4086cd){this[_0x47a5('0x5')]=_0x4086cd[_0x47a5('0x5')];}return this;}util[_0x47a5('0x6')](RuleEngine,EventEmitter);RuleEngine['prototype'][_0x47a5('0x7')]=function(_0x59199c){this[_0x47a5('0x8')]=[];this[_0x47a5('0x9')]=[];};RuleEngine['prototype'][_0x47a5('0x4')]=function(_0x5077f3){if(Array['isArray'](_0x5077f3)){this['rules']=this[_0x47a5('0x8')][_0x47a5('0xa')](_0x5077f3);}else if(_0x5077f3!==null&&_['isObject'](_0x5077f3)){this[_0x47a5('0x8')]['push'](_0x5077f3);}this['sync']();};RuleEngine[_0x47a5('0xb')][_0x47a5('0xc')]=function(){this[_0x47a5('0x9')]=this[_0x47a5('0x8')][_0x47a5('0xd')](function(_0xd308b8){if(_[_0x47a5('0x3')](_0xd308b8['on'])){_0xd308b8['on']=!![];}if(_0xd308b8['on']===!![]){return _0xd308b8;}});this['activeRules']=_[_0x47a5('0xe')](this[_0x47a5('0x9')],['p'],[_0x47a5('0xf')]);};RuleEngine[_0x47a5('0xb')][_0x47a5('0x10')]=function(_0x620ee9,_0x3c6c46){var _0x190faa=![];_0x620ee9['result']=!![];var _0x362359=_[_0x47a5('0x11')](_0x620ee9);var _0x3b001e=_[_0x47a5('0x11')](_0x620ee9);var _0x1ef44c=this['activeRules'];var _0x549de3=[];var _0x138bc0=this['ignoreFactChanges'];(function FnRuleLoop(_0x5247fd){var _0x423a81={'rules':function(){return _0x1ef44c;},'rule':function(){return _0x1ef44c[_0x5247fd];},'when':function(_0xaf70a6){if(_0xaf70a6){var _0x2ce454=_0x1ef44c[_0x5247fd][_0x47a5('0x12')];_0x2ce454[_0x47a5('0x13')]=_0x1ef44c[_0x5247fd]['id']||_0x1ef44c[_0x5247fd][_0x47a5('0x14')]||_0x47a5('0x15')+_0x5247fd;process[_0x47a5('0x16')](function(){_0x549de3[_0x47a5('0x17')](_0x2ce454['ruleRef']);_0x2ce454[_0x47a5('0x18')](_0x362359,_0x423a81);});}else{process[_0x47a5('0x16')](function(){_0x423a81['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x190faa=!![];return FnRuleLoop(0x0);},'next':function(_0x2b0360){if(!_0x138bc0&&!_[_0x47a5('0x19')](_0x3b001e,_0x362359)){_0x3b001e=_[_0x47a5('0x11')](_0x362359);process['nextTick'](function(){_0x423a81[_0x47a5('0x1a')]();});}else{process[_0x47a5('0x16')](function(){if(_[_0x47a5('0x3')](_0x2b0360)){return FnRuleLoop(_0x5247fd+0x1);}else{return FnRuleLoop(_0x2b0360);}});}}};if(_0x5247fd<_0x1ef44c[_0x47a5('0x1b')]&&_0x190faa===![]){var _0x5ef1b1=_0x1ef44c[_0x5247fd][_0x47a5('0x1c')];_0x5ef1b1[_0x47a5('0x18')](_0x362359,_0x423a81);}else{process['nextTick'](function(){_0x362359[_0x47a5('0x1d')]=_0x549de3;return _0x3c6c46?_0x3c6c46(_0x362359):_[_0x47a5('0x1e')]();});}}(0x0));};RuleEngine[_0x47a5('0xb')][_0x47a5('0x1f')]=function(_0x3abd6a){if(_['isNil'](_0x3abd6a)){return this['rules'];}else{var _0x136745=_['matches'](_0x3abd6a);return _[_0x47a5('0xd')](this['rules'],_0x136745);}};RuleEngine[_0x47a5('0xb')][_0x47a5('0x20')]=function(_0x36ad34,_0x1dac65){var _0x21f296=_0x36ad34==='on'||_0x36ad34==='ON'?!![]:![];var _0x3ba0b7=this[_0x47a5('0x1f')](_0x1dac65);for(var _0x136b14=0x0,_0x16631f=_0x3ba0b7[_0x47a5('0x1b')];_0x136b14<_0x16631f;_0x136b14+=0x1){_0x3ba0b7[_0x136b14]['on']=_0x21f296;}this[_0x47a5('0xc')]();};RuleEngine[_0x47a5('0xb')][_0x47a5('0x21')]=function(_0x528582,_0x243210){_0x528582=parseInt(_0x528582,0xa);var _0x51833b=this[_0x47a5('0x1f')](_0x243210);for(var _0x9ac908=0x0,_0x16901f=_0x51833b['length'];_0x9ac908<_0x16901f;_0x9ac908+=0x1){_0x51833b[_0x9ac908][_0x47a5('0x22')]=_0x528582;}this[_0x47a5('0xc')]();};RuleEngine[_0x47a5('0xb')][_0x47a5('0x23')]=function(){var _0x51cc81=this['rules'];if(_0x51cc81 instanceof Array){_0x51cc81=_0x51cc81[_0x47a5('0x24')](function(_0xfb5ddb){_0xfb5ddb['condition']=_0xfb5ddb['condition'][_0x47a5('0x25')]();_0xfb5ddb[_0x47a5('0x12')]=_0xfb5ddb['consequence'][_0x47a5('0x25')]();return _0xfb5ddb;});}else if(!_['isNil'](_0x51cc81)){_0x51cc81[_0x47a5('0x1c')]=_0x51cc81[_0x47a5('0x1c')]['toString']();_0x51cc81['consequence']=_0x51cc81[_0x47a5('0x12')]['toString']();}return _0x51cc81;};RuleEngine[_0x47a5('0xb')][_0x47a5('0x26')]=function(_0xf269a8){this['init']();if(_[_0x47a5('0x27')](_0xf269a8)){_0xf269a8=JSON['parse'](_0xf269a8);}if(_0xf269a8 instanceof Array){_0xf269a8=_0xf269a8['map'](function(_0x65542e){_0x65542e['condition']=eval('('+_0x65542e[_0x47a5('0x1c')]+')');_0x65542e['consequence']=eval('('+_0x65542e[_0x47a5('0x12')]+')');return _0x65542e;});}else if(_0xf269a8!==null&&typeof _0xf269a8==_0x47a5('0x28')){_0xf269a8[_0x47a5('0x1c')]=eval('('+_0xf269a8[_0x47a5('0x1c')]+')');_0xf269a8[_0x47a5('0x12')]=eval('('+_0xf269a8[_0x47a5('0x12')]+')');}this[_0x47a5('0x4')](_0xf269a8);};module[_0x47a5('0x29')]=RuleEngine; \ No newline at end of file +var _0x2ef3=['next','isEqual','restart','condition','matches','filter','turn','prioritize','findRules','length','priority','toJSON','map','toString','fromJSON','parse','object','exports','lodash','util','events','EventEmitter','isNil','register','ignoreFactChanges','inherits','rules','activeRules','prototype','isArray','concat','push','sync','orderBy','result','clone','consequence','name','index_','nextTick','ruleRef','call'];(function(_0x17bdaa,_0x5e5a1e){var _0x151601=function(_0x52c042){while(--_0x52c042){_0x17bdaa['push'](_0x17bdaa['shift']());}};_0x151601(++_0x5e5a1e);}(_0x2ef3,0xba));var _0x32ef=function(_0xc51fcf,_0x188f85){_0xc51fcf=_0xc51fcf-0x0;var _0x66eeab=_0x2ef3[_0xc51fcf];return _0x66eeab;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var EventEmitter=require(_0x32ef('0x2'))[_0x32ef('0x3')];function RuleEngine(_0x3944df,_0x38047b){this['init']();if(!_[_0x32ef('0x4')](_0x3944df)){this[_0x32ef('0x5')](_0x3944df);}if(_0x38047b){this['ignoreFactChanges']=_0x38047b[_0x32ef('0x6')];}return this;}util[_0x32ef('0x7')](RuleEngine,EventEmitter);RuleEngine['prototype']['init']=function(_0x2c0089){this[_0x32ef('0x8')]=[];this[_0x32ef('0x9')]=[];};RuleEngine[_0x32ef('0xa')][_0x32ef('0x5')]=function(_0x298066){if(Array[_0x32ef('0xb')](_0x298066)){this[_0x32ef('0x8')]=this[_0x32ef('0x8')][_0x32ef('0xc')](_0x298066);}else if(_0x298066!==null&&_['isObject'](_0x298066)){this['rules'][_0x32ef('0xd')](_0x298066);}this[_0x32ef('0xe')]();};RuleEngine[_0x32ef('0xa')][_0x32ef('0xe')]=function(){this['activeRules']=this[_0x32ef('0x8')]['filter'](function(_0x1a5106){if(_['isNil'](_0x1a5106['on'])){_0x1a5106['on']=!![];}if(_0x1a5106['on']===!![]){return _0x1a5106;}});this[_0x32ef('0x9')]=_[_0x32ef('0xf')](this['activeRules'],['p'],['asc']);};RuleEngine[_0x32ef('0xa')]['execute']=function(_0x326fce,_0x40a6e6){var _0x93d492=![];_0x326fce[_0x32ef('0x10')]=!![];var _0x57aff1=_['clone'](_0x326fce);var _0x531e30=_[_0x32ef('0x11')](_0x326fce);var _0x3950e6=this[_0x32ef('0x9')];var _0x53a5ca=[];var _0x5d559b=this[_0x32ef('0x6')];(function FnRuleLoop(_0x1a9476){var _0x286bfb={'rules':function(){return _0x3950e6;},'rule':function(){return _0x3950e6[_0x1a9476];},'when':function(_0x57863c){if(_0x57863c){var _0xbe37f6=_0x3950e6[_0x1a9476][_0x32ef('0x12')];_0xbe37f6['ruleRef']=_0x3950e6[_0x1a9476]['id']||_0x3950e6[_0x1a9476][_0x32ef('0x13')]||_0x32ef('0x14')+_0x1a9476;process[_0x32ef('0x15')](function(){_0x53a5ca[_0x32ef('0xd')](_0xbe37f6[_0x32ef('0x16')]);_0xbe37f6[_0x32ef('0x17')](_0x57aff1,_0x286bfb);});}else{process['nextTick'](function(){_0x286bfb[_0x32ef('0x18')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x93d492=!![];return FnRuleLoop(0x0);},'next':function(_0x5cc3ef){if(!_0x5d559b&&!_[_0x32ef('0x19')](_0x531e30,_0x57aff1)){_0x531e30=_[_0x32ef('0x11')](_0x57aff1);process['nextTick'](function(){_0x286bfb[_0x32ef('0x1a')]();});}else{process[_0x32ef('0x15')](function(){if(_[_0x32ef('0x4')](_0x5cc3ef)){return FnRuleLoop(_0x1a9476+0x1);}else{return FnRuleLoop(_0x5cc3ef);}});}}};if(_0x1a9476<_0x3950e6['length']&&_0x93d492===![]){var _0x57f5e5=_0x3950e6[_0x1a9476][_0x32ef('0x1b')];_0x57f5e5[_0x32ef('0x17')](_0x57aff1,_0x286bfb);}else{process[_0x32ef('0x15')](function(){_0x57aff1['matchPath']=_0x53a5ca;return _0x40a6e6?_0x40a6e6(_0x57aff1):_['noop']();});}}(0x0));};RuleEngine[_0x32ef('0xa')]['findRules']=function(_0x51a412){if(_[_0x32ef('0x4')](_0x51a412)){return this[_0x32ef('0x8')];}else{var _0x371540=_[_0x32ef('0x1c')](_0x51a412);return _[_0x32ef('0x1d')](this[_0x32ef('0x8')],_0x371540);}};RuleEngine[_0x32ef('0xa')][_0x32ef('0x1e')]=function(_0x338f19,_0x2f52d7){var _0x1335e2=_0x338f19==='on'||_0x338f19==='ON'?!![]:![];var _0xba4b3f=this['findRules'](_0x2f52d7);for(var _0xd65fde=0x0,_0x2f5d06=_0xba4b3f['length'];_0xd65fde<_0x2f5d06;_0xd65fde+=0x1){_0xba4b3f[_0xd65fde]['on']=_0x1335e2;}this[_0x32ef('0xe')]();};RuleEngine[_0x32ef('0xa')][_0x32ef('0x1f')]=function(_0x26e207,_0x50a95b){_0x26e207=parseInt(_0x26e207,0xa);var _0x10e38c=this[_0x32ef('0x20')](_0x50a95b);for(var _0x31dbc3=0x0,_0x2ac686=_0x10e38c[_0x32ef('0x21')];_0x31dbc3<_0x2ac686;_0x31dbc3+=0x1){_0x10e38c[_0x31dbc3][_0x32ef('0x22')]=_0x26e207;}this[_0x32ef('0xe')]();};RuleEngine['prototype'][_0x32ef('0x23')]=function(){var _0x537214=this[_0x32ef('0x8')];if(_0x537214 instanceof Array){_0x537214=_0x537214[_0x32ef('0x24')](function(_0x5a9565){_0x5a9565[_0x32ef('0x1b')]=_0x5a9565[_0x32ef('0x1b')][_0x32ef('0x25')]();_0x5a9565[_0x32ef('0x12')]=_0x5a9565[_0x32ef('0x12')]['toString']();return _0x5a9565;});}else if(!_['isNil'](_0x537214)){_0x537214[_0x32ef('0x1b')]=_0x537214['condition'][_0x32ef('0x25')]();_0x537214[_0x32ef('0x12')]=_0x537214[_0x32ef('0x12')][_0x32ef('0x25')]();}return _0x537214;};RuleEngine[_0x32ef('0xa')][_0x32ef('0x26')]=function(_0x566b56){this['init']();if(_['isString'](_0x566b56)){_0x566b56=JSON[_0x32ef('0x27')](_0x566b56);}if(_0x566b56 instanceof Array){_0x566b56=_0x566b56[_0x32ef('0x24')](function(_0x136b02){_0x136b02['condition']=eval('('+_0x136b02['condition']+')');_0x136b02[_0x32ef('0x12')]=eval('('+_0x136b02[_0x32ef('0x12')]+')');return _0x136b02;});}else if(_0x566b56!==null&&typeof _0x566b56==_0x32ef('0x28')){_0x566b56['condition']=eval('('+_0x566b56['condition']+')');_0x566b56[_0x32ef('0x12')]=eval('('+_0x566b56[_0x32ef('0x12')]+')');}this[_0x32ef('0x5')](_0x566b56);};module[_0x32ef('0x29')]=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 67169dd..81782c4 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 _0xc5a4=['catch','sendMailMessage','bluebird','jayson/promise','client','http','request','error','message','result'];(function(_0x5d14b2,_0x7006c2){var _0x43c243=function(_0x4ebb4e){while(--_0x4ebb4e){_0x5d14b2['push'](_0x5d14b2['shift']());}};_0x43c243(++_0x7006c2);}(_0xc5a4,0x98));var _0x4c5a=function(_0x238a9f,_0x118735){_0x238a9f=_0x238a9f-0x0;var _0x5073e2=_0xc5a4[_0x238a9f];return _0x5073e2;};'use strict';var BPromise=require(_0x4c5a('0x0'));var jayson=require(_0x4c5a('0x1'));var client=jayson[_0x4c5a('0x2')][_0x4c5a('0x3')]({'port':0x232b});function request(_0x4f372a,_0x7ae485){return new BPromise(function(_0x3f12d8,_0x39d562){return client[_0x4c5a('0x4')](_0x4f372a,_0x7ae485)['then'](function(_0x23d8ef){if(_0x23d8ef[_0x4c5a('0x5')]){return _0x39d562(_0x23d8ef[_0x4c5a('0x5')][_0x4c5a('0x6')]);}else{return _0x3f12d8(_0x23d8ef[_0x4c5a('0x7')]);}})[_0x4c5a('0x8')](function(_0x3912c1){return _0x39d562(_0x3912c1);});});}exports[_0x4c5a('0x9')]=function(_0x50bc25,_0x360ebb){return request('SendMail',{'account':_0x50bc25,'message':_0x360ebb});}; \ No newline at end of file +var _0x3b18=['message','catch','SendMail','bluebird','jayson/promise','client','http','request','then','error'];(function(_0x32f35f,_0x446be5){var _0x42cc92=function(_0x5bc02f){while(--_0x5bc02f){_0x32f35f['push'](_0x32f35f['shift']());}};_0x42cc92(++_0x446be5);}(_0x3b18,0x125));var _0x83b1=function(_0xa6e970,_0x3bece5){_0xa6e970=_0xa6e970-0x0;var _0x2e42ae=_0x3b18[_0xa6e970];return _0x2e42ae;};'use strict';var BPromise=require(_0x83b1('0x0'));var jayson=require(_0x83b1('0x1'));var client=jayson[_0x83b1('0x2')][_0x83b1('0x3')]({'port':0x232b});function request(_0xd50f46,_0x187b9d){return new BPromise(function(_0x5c192d,_0x39b5ae){return client[_0x83b1('0x4')](_0xd50f46,_0x187b9d)[_0x83b1('0x5')](function(_0x27cf73){if(_0x27cf73[_0x83b1('0x6')]){return _0x39b5ae(_0x27cf73['error'][_0x83b1('0x7')]);}else{return _0x5c192d(_0x27cf73['result']);}})[_0x83b1('0x8')](function(_0x1da59c){return _0x39b5ae(_0x1da59c);});});}exports['sendMailMessage']=function(_0x5f3541,_0x4379ea){return request(_0x83b1('0x9'),{'account':_0x5f3541,'message':_0x4379ea});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index d55b2ed..91b5093 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 _0x0598=['Status','StatusTime','toNumber','format','openchannelPause','chatStatusTime','chatCapacity','faxStatus','faxStatusTime','smsStatus','smsStatusTime','whatsappStatusTime','openchannelWaitingInteractions','stringify','emit','user:routing:update','omit','exports','lodash','md5','ioredis','defaults','redis','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','chatStatus','unknown','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxCapacity','faxCurrentCapacity','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','busy','chatWaitingInteractions','faxWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','updateRealtime','prototype','CurrentCapacity','Capacity','maxcapacity','working','idle','mail','chat','openchannel','sms','whatsapp'];(function(_0x1d1f89,_0x11f30b){var _0x509422=function(_0x4357e5){while(--_0x4357e5){_0x1d1f89['push'](_0x1d1f89['shift']());}};_0x509422(++_0x11f30b);}(_0x0598,0x92));var _0x8059=function(_0x5c72d6,_0x5921d8){_0x5c72d6=_0x5c72d6-0x0;var _0x52361d=_0x0598[_0x5c72d6];return _0x52361d;};'use strict';var _=require(_0x8059('0x0'));var md5=require(_0x8059('0x1'));var moment=require('moment');var Redis=require(_0x8059('0x2'));var config=require('../../../config/environment');config['redis']=_[_0x8059('0x3')](config[_0x8059('0x4')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function Agent(_0x467206){this['id']=_0x467206['id']||0x0;this[_0x8059('0x5')]=_0x467206['name']||'';this['online']=_0x467206[_0x8059('0x6')]||!![];this[_0x8059('0x7')]=_0x467206[_0x8059('0x7')]||![];this[_0x8059('0x8')]=_0x467206['chatPause']||![];this['mailPause']=_0x467206[_0x8059('0x9')]||![];this[_0x8059('0xa')]=_0x467206[_0x8059('0xa')]||![];this[_0x8059('0xb')]=_0x467206[_0x8059('0xb')]||![];this['openchannelPause']=_0x467206['openchannelPause']||![];this[_0x8059('0xc')]=_0x8059('0xd');this['chatStatusTime']=0x0;this['chatCapacity']=_0x467206['chatCapacity']||0x0;this[_0x8059('0xe')]=0x0;this[_0x8059('0xf')]=_0x8059('0xd');this[_0x8059('0x10')]=0x0;this[_0x8059('0x11')]=_0x467206['mailCapacity']||0x0;this[_0x8059('0x12')]=0x0;this['faxStatus']=_0x8059('0xd');this['faxStatusTime']=0x0;this[_0x8059('0x13')]=_0x467206[_0x8059('0x13')]||0x0;this[_0x8059('0x14')]=0x0;this['smsStatus']='unknown';this['smsStatusTime']=0x0;this[_0x8059('0x15')]=_0x467206[_0x8059('0x15')]||0x0;this[_0x8059('0x16')]=0x0;this[_0x8059('0x17')]=_0x8059('0xd');this['whatsappStatusTime']=0x0;this[_0x8059('0x18')]=_0x467206[_0x8059('0x18')]||0x0;this[_0x8059('0x19')]=0x0;this[_0x8059('0x1a')]='unknown';this[_0x8059('0x1b')]=0x0;this['openchannelCapacity']=_0x467206[_0x8059('0x1c')]||0x0;this['openchannelCurrentCapacity']=0x0;this[_0x8059('0x1d')]=![];this['busyQueue']=undefined;this[_0x8059('0x1')]='';this[_0x8059('0x1e')]={};this[_0x8059('0x1f')]={};this['mailWaitingInteractions']={};this['openchannelWaitingInteractions']={};this[_0x8059('0x20')]={};this[_0x8059('0x21')]={};this[_0x8059('0x22')]();}Agent[_0x8059('0x23')]['getChannelStatus']=function(_0x3bc226){if(this[_0x3bc226+_0x8059('0x24')]>0x0){if(this[_0x3bc226+_0x8059('0x25')]>0x0&&this[_0x3bc226+'CurrentCapacity']>=this[_0x3bc226+_0x8059('0x25')]){return _0x8059('0x26');}else{return _0x8059('0x27');}}else{return _0x8059('0x28');}};Agent['prototype'][_0x8059('0x22')]=function(){var _0x2cd179=[_0x8059('0x29'),_0x8059('0x2a'),_0x8059('0x2b'),'fax',_0x8059('0x2c'),_0x8059('0x2d')];for(var _0xd1fa7e=0x0;_0xd1fa7e<_0x2cd179['length'];_0xd1fa7e+=0x1){var _0x582321=this['getChannelStatus'](_0x2cd179[_0xd1fa7e]);if(this[_0x2cd179[_0xd1fa7e]+_0x8059('0x2e')]!==_0x582321){this[_0x2cd179[_0xd1fa7e]+_0x8059('0x2f')]=_[_0x8059('0x30')](moment()[_0x8059('0x31')]('x'));}this[_0x2cd179[_0xd1fa7e]+'Status']=_0x582321;}var _0x1eb71b={'id':this['id'],'name':this['name'],'online':this[_0x8059('0x6')],'voicePause':this[_0x8059('0x7')],'chatPause':this['chatPause'],'mailPause':this[_0x8059('0x9')],'smsPause':this[_0x8059('0xb')],'faxPause':this[_0x8059('0xa')],'openchannelPause':this[_0x8059('0x32')],'chatStatus':this[_0x8059('0xc')],'chatStatusTime':this[_0x8059('0x33')],'chatCapacity':this[_0x8059('0x34')],'chatCurrentCapacity':this[_0x8059('0xe')],'mailStatus':this['mailStatus'],'mailStatusTime':this[_0x8059('0x10')],'mailCapacity':this[_0x8059('0x11')],'mailCurrentCapacity':this[_0x8059('0x12')],'faxStatus':this[_0x8059('0x35')],'faxStatusTime':this[_0x8059('0x36')],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this[_0x8059('0x14')],'smsStatus':this[_0x8059('0x37')],'smsStatusTime':this[_0x8059('0x38')],'smsCapacity':this[_0x8059('0x15')],'smsCurrentCapacity':this[_0x8059('0x16')],'whatsappStatus':this[_0x8059('0x17')],'whatsappStatusTime':this[_0x8059('0x39')],'whatsappCapacity':this[_0x8059('0x18')],'whatsappCurrentCapacity':this[_0x8059('0x19')],'openchannelStatus':this[_0x8059('0x1a')],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this[_0x8059('0x1c')],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this[_0x8059('0x1d')],'busyQueue':this['busyQueue'],'chatWaitingInteractions':this['chatWaitingInteractions'],'faxWaitingInteractions':this[_0x8059('0x1f')],'mailWaitingInteractions':this['mailWaitingInteractions'],'openchannelWaitingInteractions':this[_0x8059('0x3a')],'smsWaitingInteractions':this['smsWaitingInteractions'],'whatsappWaitingInteractions':this[_0x8059('0x21')]};var _0x55ddda=md5(JSON[_0x8059('0x3b')](_0x1eb71b));if(this[_0x8059('0x1')]!==_0x55ddda){this['md5']=_0x55ddda;io[_0x8059('0x3c')](_0x8059('0x3d'),_[_0x8059('0x3e')](_0x1eb71b,['online']));}};module[_0x8059('0x3f')]=Agent; \ No newline at end of file +var _0x6d11=['md5','moment','../../../config/environment','defaults','redis','name','online','voicePause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','mailStatus','mailStatusTime','mailCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','openchannelStatus','busy','chatWaitingInteractions','faxWaitingInteractions','mailWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','updateRealtime','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','idle','prototype','mail','chat','openchannel','fax','whatsapp','length','Status','StatusTime','toNumber','format','chatPause','chatCurrentCapacity','mailCurrentCapacity','whatsappCurrentCapacity','openchannelStatusTime','busyQueue','emit','user:routing:update','exports','lodash'];(function(_0x1eb117,_0x2dad73){var _0x21692d=function(_0x50d60c){while(--_0x50d60c){_0x1eb117['push'](_0x1eb117['shift']());}};_0x21692d(++_0x2dad73);}(_0x6d11,0xbf));var _0x16d1=function(_0x54ea86,_0xe47fd6){_0x54ea86=_0x54ea86-0x0;var _0xfa6413=_0x6d11[_0x54ea86];return _0xfa6413;};'use strict';var _=require(_0x16d1('0x0'));var md5=require(_0x16d1('0x1'));var moment=require(_0x16d1('0x2'));var Redis=require('ioredis');var config=require(_0x16d1('0x3'));config['redis']=_[_0x16d1('0x4')](config[_0x16d1('0x5')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x16d1('0x5')]));function Agent(_0x46f7d7){this['id']=_0x46f7d7['id']||0x0;this[_0x16d1('0x6')]=_0x46f7d7[_0x16d1('0x6')]||'';this[_0x16d1('0x7')]=_0x46f7d7[_0x16d1('0x7')]||!![];this[_0x16d1('0x8')]=_0x46f7d7['voicePause']||![];this['chatPause']=_0x46f7d7['chatPause']||![];this[_0x16d1('0x9')]=_0x46f7d7[_0x16d1('0x9')]||![];this[_0x16d1('0xa')]=_0x46f7d7[_0x16d1('0xa')]||![];this['smsPause']=_0x46f7d7[_0x16d1('0xb')]||![];this[_0x16d1('0xc')]=_0x46f7d7[_0x16d1('0xc')]||![];this[_0x16d1('0xd')]=_0x16d1('0xe');this[_0x16d1('0xf')]=0x0;this[_0x16d1('0x10')]=_0x46f7d7[_0x16d1('0x10')]||0x0;this['chatCurrentCapacity']=0x0;this[_0x16d1('0x11')]=_0x16d1('0xe');this[_0x16d1('0x12')]=0x0;this[_0x16d1('0x13')]=_0x46f7d7[_0x16d1('0x13')]||0x0;this['mailCurrentCapacity']=0x0;this[_0x16d1('0x14')]=_0x16d1('0xe');this[_0x16d1('0x15')]=0x0;this[_0x16d1('0x16')]=_0x46f7d7[_0x16d1('0x16')]||0x0;this[_0x16d1('0x17')]=0x0;this[_0x16d1('0x18')]='unknown';this[_0x16d1('0x19')]=0x0;this[_0x16d1('0x1a')]=_0x46f7d7['smsCapacity']||0x0;this['smsCurrentCapacity']=0x0;this[_0x16d1('0x1b')]='unknown';this[_0x16d1('0x1c')]=0x0;this['whatsappCapacity']=_0x46f7d7[_0x16d1('0x1d')]||0x0;this['whatsappCurrentCapacity']=0x0;this[_0x16d1('0x1e')]=_0x16d1('0xe');this['openchannelStatusTime']=0x0;this['openchannelCapacity']=_0x46f7d7['openchannelCapacity']||0x0;this['openchannelCurrentCapacity']=0x0;this[_0x16d1('0x1f')]=![];this['busyQueue']=undefined;this[_0x16d1('0x1')]='';this[_0x16d1('0x20')]={};this[_0x16d1('0x21')]={};this[_0x16d1('0x22')]={};this['openchannelWaitingInteractions']={};this[_0x16d1('0x23')]={};this[_0x16d1('0x24')]={};this[_0x16d1('0x25')]();}Agent['prototype'][_0x16d1('0x26')]=function(_0x8c7266){if(this[_0x8c7266+_0x16d1('0x27')]>0x0){if(this[_0x8c7266+_0x16d1('0x28')]>0x0&&this[_0x8c7266+_0x16d1('0x27')]>=this[_0x8c7266+_0x16d1('0x28')]){return _0x16d1('0x29');}else{return _0x16d1('0x2a');}}else{return _0x16d1('0x2b');}};Agent[_0x16d1('0x2c')][_0x16d1('0x25')]=function(){var _0x15203b=[_0x16d1('0x2d'),_0x16d1('0x2e'),_0x16d1('0x2f'),_0x16d1('0x30'),'sms',_0x16d1('0x31')];for(var _0x440a47=0x0;_0x440a47<_0x15203b[_0x16d1('0x32')];_0x440a47+=0x1){var _0x49fc1b=this[_0x16d1('0x26')](_0x15203b[_0x440a47]);if(this[_0x15203b[_0x440a47]+_0x16d1('0x33')]!==_0x49fc1b){this[_0x15203b[_0x440a47]+_0x16d1('0x34')]=_[_0x16d1('0x35')](moment()[_0x16d1('0x36')]('x'));}this[_0x15203b[_0x440a47]+_0x16d1('0x33')]=_0x49fc1b;}var _0x1dd574={'id':this['id'],'name':this['name'],'online':this[_0x16d1('0x7')],'voicePause':this[_0x16d1('0x8')],'chatPause':this[_0x16d1('0x37')],'mailPause':this[_0x16d1('0x9')],'smsPause':this['smsPause'],'faxPause':this['faxPause'],'openchannelPause':this[_0x16d1('0xc')],'chatStatus':this[_0x16d1('0xd')],'chatStatusTime':this[_0x16d1('0xf')],'chatCapacity':this[_0x16d1('0x10')],'chatCurrentCapacity':this[_0x16d1('0x38')],'mailStatus':this[_0x16d1('0x11')],'mailStatusTime':this[_0x16d1('0x12')],'mailCapacity':this[_0x16d1('0x13')],'mailCurrentCapacity':this[_0x16d1('0x39')],'faxStatus':this[_0x16d1('0x14')],'faxStatusTime':this[_0x16d1('0x15')],'faxCapacity':this[_0x16d1('0x16')],'faxCurrentCapacity':this[_0x16d1('0x17')],'smsStatus':this[_0x16d1('0x18')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0x16d1('0x1a')],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this[_0x16d1('0x1b')],'whatsappStatusTime':this[_0x16d1('0x1c')],'whatsappCapacity':this[_0x16d1('0x1d')],'whatsappCurrentCapacity':this[_0x16d1('0x3a')],'openchannelStatus':this[_0x16d1('0x1e')],'openchannelStatusTime':this[_0x16d1('0x3b')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this['busy'],'busyQueue':this[_0x16d1('0x3c')],'chatWaitingInteractions':this[_0x16d1('0x20')],'faxWaitingInteractions':this[_0x16d1('0x21')],'mailWaitingInteractions':this[_0x16d1('0x22')],'openchannelWaitingInteractions':this['openchannelWaitingInteractions'],'smsWaitingInteractions':this[_0x16d1('0x23')],'whatsappWaitingInteractions':this[_0x16d1('0x24')]};var _0x4cbac1=md5(JSON['stringify'](_0x1dd574));if(this['md5']!==_0x4cbac1){this[_0x16d1('0x1')]=_0x4cbac1;io[_0x16d1('0x3d')](_0x16d1('0x3e'),_['omit'](_0x1dd574,[_0x16d1('0x7')]));}};module[_0x16d1('0x3f')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 1939db7..b8f15f9 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 _0xf025=['exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','_rr','loggedIn','paused','length','online','chatPause','available','stringify','chat:queue:%s'];(function(_0x3b5250,_0x7a0b2c){var _0xc844a1=function(_0x2fbc98){while(--_0x2fbc98){_0x3b5250['push'](_0x3b5250['shift']());}};_0xc844a1(++_0x7a0b2c);}(_0xf025,0x1b4));var _0x5f02=function(_0x12b683,_0x124186){_0x12b683=_0x12b683-0x0;var _0xfb150b=_0xf025[_0x12b683];return _0xfb150b;};'use strict';var _=require(_0x5f02('0x0'));var md5=require(_0x5f02('0x1'));var util=require(_0x5f02('0x2'));var Redis=require(_0x5f02('0x3'));var config=require(_0x5f02('0x4'));config[_0x5f02('0x5')]=_[_0x5f02('0x6')](config[_0x5f02('0x5')],{'host':_0x5f02('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5f02('0x5')]));function ChatQueue(_0x503c2e){this['id']=_0x503c2e['id']||0x0;this[_0x5f02('0x8')]=_0x503c2e['name']||'';this[_0x5f02('0x9')]=_0x503c2e[_0x5f02('0x9')]||0xa;this[_0x5f02('0xa')]=_0x503c2e['strategy']||_0x5f02('0xb');this[_0x5f02('0xc')]=_0x503c2e[_0x5f02('0xc')];this[_0x5f02('0xd')]={};this[_0x5f02('0xe')]=0x0;this[_0x5f02('0x1')]='';this[_0x5f02('0xf')]();this[_0x5f02('0x10')]();}ChatQueue[_0x5f02('0x11')]['updateRouting']=function(){var _0x2ae501=this['mapAgentsId']['_rr'];this[_0x5f02('0xd')]=_[_0x5f02('0x12')](this[_0x5f02('0xc')],'id');this['mapAgentsId'][_0x5f02('0x13')]=_0x2ae501;};ChatQueue[_0x5f02('0x11')][_0x5f02('0x10')]=function(){this[_0x5f02('0x14')]=0x0;this[_0x5f02('0x15')]=0x0;for(var _0x3b1ac6=0x0;_0x3b1ac6=0x0?this['available']:0x0;var _0x5651fc={'id':this['id'],'available':this[_0x5f02('0x19')],'loggedIn':this[_0x5f02('0x14')],'name':this[_0x5f02('0x8')],'paused':this['paused'],'waiting':this[_0x5f02('0xe')]};var _0x5c13b0=md5(JSON[_0x5f02('0x1a')](_0x5651fc));if(this[_0x5f02('0x1')]!==_0x5c13b0){this['md5']=_0x5c13b0;io['to'](util['format'](_0x5f02('0x1b'),_0x5651fc['name']))['emit']('chat_queue:save',_0x5651fc);}};module[_0x5f02('0x1c')]=ChatQueue; \ No newline at end of file +var _0xeac1=['prototype','_rr','map','paused','length','online','chatPause','available','loggedIn','stringify','format','emit','chat_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime'];(function(_0x4956bd,_0x559e26){var _0x34d5e6=function(_0x495a06){while(--_0x495a06){_0x4956bd['push'](_0x4956bd['shift']());}};_0x34d5e6(++_0x559e26);}(_0xeac1,0x169));var _0x1eac=function(_0x211d4f,_0x56ab00){_0x211d4f=_0x211d4f-0x0;var _0x39e0ff=_0xeac1[_0x211d4f];return _0x39e0ff;};'use strict';var _=require(_0x1eac('0x0'));var md5=require(_0x1eac('0x1'));var util=require(_0x1eac('0x2'));var Redis=require(_0x1eac('0x3'));var config=require(_0x1eac('0x4'));config[_0x1eac('0x5')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x1eac('0x6'))(new Redis(config['redis']));function ChatQueue(_0x491b9c){this['id']=_0x491b9c['id']||0x0;this['name']=_0x491b9c[_0x1eac('0x7')]||'';this[_0x1eac('0x8')]=_0x491b9c[_0x1eac('0x8')]||0xa;this['strategy']=_0x491b9c[_0x1eac('0x9')]||_0x1eac('0xa');this[_0x1eac('0xb')]=_0x491b9c[_0x1eac('0xb')];this[_0x1eac('0xc')]={};this[_0x1eac('0xd')]=0x0;this['md5']='';this[_0x1eac('0xe')]();this[_0x1eac('0xf')]();}ChatQueue[_0x1eac('0x10')]['updateRouting']=function(){var _0x54a9bd=this[_0x1eac('0xc')][_0x1eac('0x11')];this[_0x1eac('0xc')]=_[_0x1eac('0x12')](this[_0x1eac('0xb')],'id');this[_0x1eac('0xc')]['_rr']=_0x54a9bd;};ChatQueue[_0x1eac('0x10')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x1eac('0x13')]=0x0;for(var _0x2ef7b8=0x0;_0x2ef7b8=0x0?this[_0x1eac('0x17')]:0x0;var _0x37c154={'id':this['id'],'available':this[_0x1eac('0x17')],'loggedIn':this[_0x1eac('0x18')],'name':this['name'],'paused':this[_0x1eac('0x13')],'waiting':this['waiting']};var _0x3bb1c7=md5(JSON[_0x1eac('0x19')](_0x37c154));if(this[_0x1eac('0x1')]!==_0x3bb1c7){this[_0x1eac('0x1')]=_0x3bb1c7;io['to'](util[_0x1eac('0x1a')]('chat:queue:%s',_0x37c154[_0x1eac('0x7')]))[_0x1eac('0x1b')](_0x1eac('0x1c'),_0x37c154);}};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 ec76cf5..8708354 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 _0x0db6=['loggedIn','paused','length','online','faxPause','available','stringify','format','fax:queue:%s','emit','exports','lodash','md5','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','prototype','_rr','updateRealtime'];(function(_0xb68772,_0x5253ac){var _0x4189bb=function(_0x1b0cf3){while(--_0x1b0cf3){_0xb68772['push'](_0xb68772['shift']());}};_0x4189bb(++_0x5253ac);}(_0x0db6,0x97));var _0x60db=function(_0x26ce19,_0x56cb79){_0x26ce19=_0x26ce19-0x0;var _0x3b923e=_0x0db6[_0x26ce19];return _0x3b923e;};'use strict';var _=require(_0x60db('0x0'));var md5=require(_0x60db('0x1'));var util=require('util');var Redis=require('ioredis');var config=require(_0x60db('0x2'));config['redis']=_['defaults'](config[_0x60db('0x3')],{'host':_0x60db('0x4'),'port':0x18eb});var io=require(_0x60db('0x5'))(new Redis(config[_0x60db('0x3')]));function FaxQueue(_0x209af2){this['id']=_0x209af2['id']||0x0;this[_0x60db('0x6')]=_0x209af2[_0x60db('0x6')]||'';this[_0x60db('0x7')]=_0x209af2['timeout']||0xa;this[_0x60db('0x8')]=_0x209af2[_0x60db('0x8')]||_0x60db('0x9');this[_0x60db('0xa')]=_0x209af2['Agents'];this[_0x60db('0xb')]={};this[_0x60db('0xc')]=0x0;this['md5']='';this[_0x60db('0xd')]();this['updateRealtime']();}FaxQueue[_0x60db('0xe')]['updateRouting']=function(){var _0x5c8edb=this['mapAgentsId']['_rr'];this[_0x60db('0xb')]=_['map'](this[_0x60db('0xa')],'id');this[_0x60db('0xb')][_0x60db('0xf')]=_0x5c8edb;};FaxQueue[_0x60db('0xe')][_0x60db('0x10')]=function(){this[_0x60db('0x11')]=0x0;this[_0x60db('0x12')]=0x0;for(var _0x8b457e=0x0;_0x8b457e=0x0?this['available']:0x0;var _0x24e488={'id':this['id'],'available':this[_0x60db('0x16')],'loggedIn':this['loggedIn'],'name':this[_0x60db('0x6')],'paused':this[_0x60db('0x12')],'waiting':this['waiting']};var _0x483367=md5(JSON[_0x60db('0x17')](_0x24e488));if(this[_0x60db('0x1')]!==_0x483367){this[_0x60db('0x1')]=_0x483367;io['to'](util[_0x60db('0x18')](_0x60db('0x19'),_0x24e488[_0x60db('0x6')]))[_0x60db('0x1a')]('fax_queue:save',_0x24e488);}};module[_0x60db('0x1b')]=FaxQueue; \ No newline at end of file +var _0x2ef0=['../../../config/environment','redis','defaults','localhost','name','timeout','Agents','mapAgentsId','waiting','md5','prototype','updateRouting','map','_rr','updateRealtime','loggedIn','length','online','faxPause','paused','available','stringify','exports','lodash','util','ioredis'];(function(_0x26fa3e,_0xbea5d7){var _0x3a7ec9=function(_0x2c4f30){while(--_0x2c4f30){_0x26fa3e['push'](_0x26fa3e['shift']());}};_0x3a7ec9(++_0xbea5d7);}(_0x2ef0,0x65));var _0x02ef=function(_0x19aee6,_0xcb2918){_0x19aee6=_0x19aee6-0x0;var _0x511975=_0x2ef0[_0x19aee6];return _0x511975;};'use strict';var _=require(_0x02ef('0x0'));var md5=require('md5');var util=require(_0x02ef('0x1'));var Redis=require(_0x02ef('0x2'));var config=require(_0x02ef('0x3'));config[_0x02ef('0x4')]=_[_0x02ef('0x5')](config[_0x02ef('0x4')],{'host':_0x02ef('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x02ef('0x4')]));function FaxQueue(_0x56ad70){this['id']=_0x56ad70['id']||0x0;this[_0x02ef('0x7')]=_0x56ad70[_0x02ef('0x7')]||'';this[_0x02ef('0x8')]=_0x56ad70[_0x02ef('0x8')]||0xa;this['strategy']=_0x56ad70['strategy']||'beepall';this[_0x02ef('0x9')]=_0x56ad70[_0x02ef('0x9')];this[_0x02ef('0xa')]={};this[_0x02ef('0xb')]=0x0;this[_0x02ef('0xc')]='';this['updateRouting']();this['updateRealtime']();}FaxQueue[_0x02ef('0xd')][_0x02ef('0xe')]=function(){var _0x3c1a0f=this[_0x02ef('0xa')]['_rr'];this[_0x02ef('0xa')]=_[_0x02ef('0xf')](this['Agents'],'id');this[_0x02ef('0xa')][_0x02ef('0x10')]=_0x3c1a0f;};FaxQueue[_0x02ef('0xd')][_0x02ef('0x11')]=function(){this[_0x02ef('0x12')]=0x0;this['paused']=0x0;for(var _0x29db82=0x0;_0x29db82=0x0?this[_0x02ef('0x17')]:0x0;var _0x5d2e91={'id':this['id'],'available':this[_0x02ef('0x17')],'loggedIn':this[_0x02ef('0x12')],'name':this[_0x02ef('0x7')],'paused':this[_0x02ef('0x16')],'waiting':this[_0x02ef('0xb')]};var _0x2cdaa6=md5(JSON[_0x02ef('0x18')](_0x5d2e91));if(this[_0x02ef('0xc')]!==_0x2cdaa6){this[_0x02ef('0xc')]=_0x2cdaa6;io['to'](util['format']('fax:queue:%s',_0x5d2e91['name']))['emit']('fax_queue:save',_0x5d2e91);}};module[_0x02ef('0x19')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index fd8a449..f8405dd 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 _0x678f=['Intervals','exports','name'];(function(_0x4d199c,_0x50903a){var _0x3573f0=function(_0x430f15){while(--_0x430f15){_0x4d199c['push'](_0x4d199c['shift']());}};_0x3573f0(++_0x50903a);}(_0x678f,0x1f1));var _0xf678=function(_0x543c51,_0xff0084){_0x543c51=_0x543c51-0x0;var _0x360555=_0x678f[_0x543c51];return _0x360555;};'use strict';function Interval(_0x20e625){this['id']=_0x20e625['id']||0x0;this['name']=_0x20e625[_0xf678('0x0')]||'';this[_0xf678('0x1')]=_0x20e625[_0xf678('0x1')]||{};}module[_0xf678('0x2')]=Interval; \ No newline at end of file +var _0x173c=['Intervals','exports','name'];(function(_0x21a3d4,_0x239ab8){var _0xf9639b=function(_0x261cd4){while(--_0x261cd4){_0x21a3d4['push'](_0x21a3d4['shift']());}};_0xf9639b(++_0x239ab8);}(_0x173c,0xb9));var _0xc173=function(_0x1dc3c2,_0x1fd7b1){_0x1dc3c2=_0x1dc3c2-0x0;var _0x3f5b48=_0x173c[_0x1dc3c2];return _0x3f5b48;};'use strict';function Interval(_0x2cfa1d){this['id']=_0x2cfa1d['id']||0x0;this[_0xc173('0x0')]=_0x2cfa1d[_0xc173('0x0')]||'';this[_0xc173('0x1')]=_0x2cfa1d['Intervals']||{};}module[_0xc173('0x2')]=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index 8c69032..855b93d 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 _0xdec9=['updateRealtime','prototype','mapAgentsId','_rr','map','loggedIn','paused','length','mailPause','available','format','emit','mail_queue:save','exports','lodash','util','ioredis','redis','defaults','socket.io-emitter','name','timeout','beepall','Agents','waiting','md5','updateRouting'];(function(_0x37e51f,_0x1e8751){var _0x11a67d=function(_0x1e56bc){while(--_0x1e56bc){_0x37e51f['push'](_0x37e51f['shift']());}};_0x11a67d(++_0x1e8751);}(_0xdec9,0x1f4));var _0x9dec=function(_0x54ad04,_0x491857){_0x54ad04=_0x54ad04-0x0;var _0x2ab36a=_0xdec9[_0x54ad04];return _0x2ab36a;};'use strict';var _=require(_0x9dec('0x0'));var md5=require('md5');var util=require(_0x9dec('0x1'));var Redis=require(_0x9dec('0x2'));var config=require('../../../config/environment');config[_0x9dec('0x3')]=_[_0x9dec('0x4')](config[_0x9dec('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0x9dec('0x5'))(new Redis(config[_0x9dec('0x3')]));function MailQueue(_0x36aeaf){this['id']=_0x36aeaf['id']||0x0;this[_0x9dec('0x6')]=_0x36aeaf[_0x9dec('0x6')]||'';this[_0x9dec('0x7')]=_0x36aeaf['timeout']||0xa;this['strategy']=_0x36aeaf['strategy']||_0x9dec('0x8');this[_0x9dec('0x9')]=_0x36aeaf['Agents'];this['mapAgentsId']={};this[_0x9dec('0xa')]=0x0;this[_0x9dec('0xb')]='';this[_0x9dec('0xc')]();this[_0x9dec('0xd')]();}MailQueue[_0x9dec('0xe')][_0x9dec('0xc')]=function(){var _0x34199b=this[_0x9dec('0xf')][_0x9dec('0x10')];this['mapAgentsId']=_[_0x9dec('0x11')](this['Agents'],'id');this[_0x9dec('0xf')][_0x9dec('0x10')]=_0x34199b;};MailQueue[_0x9dec('0xe')]['updateRealtime']=function(){this[_0x9dec('0x12')]=0x0;this[_0x9dec('0x13')]=0x0;for(var _0x5e5797=0x0;_0x5e5797=0x0?this[_0x9dec('0x16')]:0x0;var _0x166464={'id':this['id'],'available':this[_0x9dec('0x16')],'loggedIn':this[_0x9dec('0x12')],'name':this[_0x9dec('0x6')],'paused':this['paused'],'waiting':this['waiting']};var _0x5c7665=md5(JSON['stringify'](_0x166464));if(this[_0x9dec('0xb')]!==_0x5c7665){this[_0x9dec('0xb')]=_0x5c7665;io['to'](util[_0x9dec('0x17')]('mail:queue:%s',_0x166464[_0x9dec('0x6')]))[_0x9dec('0x18')](_0x9dec('0x19'),_0x166464);}};module[_0x9dec('0x1a')]=MailQueue; \ No newline at end of file +var _0x83db=['socket.io-emitter','name','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','map','loggedIn','length','mailPause','available','paused','stringify','format','mail:queue:%s','emit','exports','md5','util','../../../config/environment','redis','localhost'];(function(_0x584991,_0x20c113){var _0x372087=function(_0x13dabe){while(--_0x13dabe){_0x584991['push'](_0x584991['shift']());}};_0x372087(++_0x20c113);}(_0x83db,0x193));var _0xb83d=function(_0x45c9ab,_0xa83fe5){_0x45c9ab=_0x45c9ab-0x0;var _0x56e92b=_0x83db[_0x45c9ab];return _0x56e92b;};'use strict';var _=require('lodash');var md5=require(_0xb83d('0x0'));var util=require(_0xb83d('0x1'));var Redis=require('ioredis');var config=require(_0xb83d('0x2'));config[_0xb83d('0x3')]=_['defaults'](config[_0xb83d('0x3')],{'host':_0xb83d('0x4'),'port':0x18eb});var io=require(_0xb83d('0x5'))(new Redis(config[_0xb83d('0x3')]));function MailQueue(_0x320252){this['id']=_0x320252['id']||0x0;this[_0xb83d('0x6')]=_0x320252[_0xb83d('0x6')]||'';this['timeout']=_0x320252['timeout']||0xa;this[_0xb83d('0x7')]=_0x320252[_0xb83d('0x7')]||'beepall';this['Agents']=_0x320252[_0xb83d('0x8')];this[_0xb83d('0x9')]={};this[_0xb83d('0xa')]=0x0;this[_0xb83d('0x0')]='';this[_0xb83d('0xb')]();this[_0xb83d('0xc')]();}MailQueue['prototype'][_0xb83d('0xb')]=function(){var _0x278236=this['mapAgentsId']['_rr'];this[_0xb83d('0x9')]=_[_0xb83d('0xd')](this[_0xb83d('0x8')],'id');this['mapAgentsId']['_rr']=_0x278236;};MailQueue['prototype']['updateRealtime']=function(){this[_0xb83d('0xe')]=0x0;this['paused']=0x0;for(var _0x3e08f3=0x0;_0x3e08f3=0x0?this[_0xb83d('0x11')]:0x0;var _0x21f79d={'id':this['id'],'available':this['available'],'loggedIn':this[_0xb83d('0xe')],'name':this[_0xb83d('0x6')],'paused':this[_0xb83d('0x12')],'waiting':this[_0xb83d('0xa')]};var _0x2fb661=md5(JSON[_0xb83d('0x13')](_0x21f79d));if(this[_0xb83d('0x0')]!==_0x2fb661){this['md5']=_0x2fb661;io['to'](util[_0xb83d('0x14')](_0xb83d('0x15'),_0x21f79d[_0xb83d('0x6')]))[_0xb83d('0x16')]('mail_queue:save',_0x21f79d);}};module[_0xb83d('0x17')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index aa3216e..3174476 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 _0xc4aa=['strategy','Agents','mapAgentsId','updateRouting','updateRealtime','map','_rr','prototype','loggedIn','paused','length','online','available','waiting','stringify','format','openchannel:queue:%s','emit','openchannel_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis','socket.io-emitter','name','timeout'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0xc4aa[_0x4d613c];return _0x301fe3;};'use strict';var _=require(_0xac4a('0x0'));var md5=require(_0xac4a('0x1'));var util=require(_0xac4a('0x2'));var Redis=require(_0xac4a('0x3'));var config=require(_0xac4a('0x4'));config[_0xac4a('0x5')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xac4a('0x6'))(new Redis(config[_0xac4a('0x5')]));function OpenchannelQueue(_0x730a38){this['id']=_0x730a38['id']||0x0;this[_0xac4a('0x7')]=_0x730a38[_0xac4a('0x7')]||'';this[_0xac4a('0x8')]=_0x730a38[_0xac4a('0x8')]||0xa;this[_0xac4a('0x9')]=_0x730a38['strategy']||'beepall';this[_0xac4a('0xa')]=_0x730a38[_0xac4a('0xa')];this[_0xac4a('0xb')]={};this['waiting']=0x0;this[_0xac4a('0x1')]='';this[_0xac4a('0xc')]();this[_0xac4a('0xd')]();}OpenchannelQueue['prototype'][_0xac4a('0xc')]=function(){var _0x488e3c=this[_0xac4a('0xb')]['_rr'];this[_0xac4a('0xb')]=_[_0xac4a('0xe')](this[_0xac4a('0xa')],'id');this['mapAgentsId'][_0xac4a('0xf')]=_0x488e3c;};OpenchannelQueue[_0xac4a('0x10')][_0xac4a('0xd')]=function(){this[_0xac4a('0x11')]=0x0;this[_0xac4a('0x12')]=0x0;for(var _0x3b71c0=0x0;_0x3b71c0=0x0?this[_0xac4a('0x15')]:0x0;var _0x44ec59={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0xac4a('0x7')],'paused':this[_0xac4a('0x12')],'waiting':this[_0xac4a('0x16')]};var _0x4d837c=md5(JSON[_0xac4a('0x17')](_0x44ec59));if(this[_0xac4a('0x1')]!==_0x4d837c){this[_0xac4a('0x1')]=_0x4d837c;io['to'](util[_0xac4a('0x18')](_0xac4a('0x19'),_0x44ec59[_0xac4a('0x7')]))[_0xac4a('0x1a')](_0xac4a('0x1b'),_0x44ec59);}};module['exports']=OpenchannelQueue; \ No newline at end of file +var _0xadb5=['../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','_rr','prototype','updateRealtime','paused','loggedIn','openchannelPause','available','stringify','format','openchannel:queue:%s','emit','md5','ioredis'];(function(_0x533e4e,_0x4eba54){var _0x1f14bb=function(_0x33a485){while(--_0x33a485){_0x533e4e['push'](_0x533e4e['shift']());}};_0x1f14bb(++_0x4eba54);}(_0xadb5,0xad));var _0x5adb=function(_0x6ee934,_0x19aaef){_0x6ee934=_0x6ee934-0x0;var _0x2f1a96=_0xadb5[_0x6ee934];return _0x2f1a96;};'use strict';var _=require('lodash');var md5=require(_0x5adb('0x0'));var util=require('util');var Redis=require(_0x5adb('0x1'));var config=require(_0x5adb('0x2'));config[_0x5adb('0x3')]=_['defaults'](config[_0x5adb('0x3')],{'host':_0x5adb('0x4'),'port':0x18eb});var io=require(_0x5adb('0x5'))(new Redis(config['redis']));function OpenchannelQueue(_0x35a5d3){this['id']=_0x35a5d3['id']||0x0;this[_0x5adb('0x6')]=_0x35a5d3[_0x5adb('0x6')]||'';this[_0x5adb('0x7')]=_0x35a5d3[_0x5adb('0x7')]||0xa;this[_0x5adb('0x8')]=_0x35a5d3[_0x5adb('0x8')]||_0x5adb('0x9');this[_0x5adb('0xa')]=_0x35a5d3[_0x5adb('0xa')];this[_0x5adb('0xb')]={};this[_0x5adb('0xc')]=0x0;this[_0x5adb('0x0')]='';this[_0x5adb('0xd')]();this['updateRealtime']();}OpenchannelQueue['prototype'][_0x5adb('0xd')]=function(){var _0x1ea238=this[_0x5adb('0xb')]['_rr'];this[_0x5adb('0xb')]=_['map'](this[_0x5adb('0xa')],'id');this['mapAgentsId'][_0x5adb('0xe')]=_0x1ea238;};OpenchannelQueue[_0x5adb('0xf')][_0x5adb('0x10')]=function(){this['loggedIn']=0x0;this[_0x5adb('0x11')]=0x0;for(var _0x34af2c=0x0;_0x34af2c=0x0?this['available']:0x0;var _0x3fff62={'id':this['id'],'available':this['available'],'loggedIn':this[_0x5adb('0x12')],'name':this['name'],'paused':this[_0x5adb('0x11')],'waiting':this['waiting']};var _0x5e218c=md5(JSON[_0x5adb('0x15')](_0x3fff62));if(this[_0x5adb('0x0')]!==_0x5e218c){this[_0x5adb('0x0')]=_0x5e218c;io['to'](util[_0x5adb('0x16')](_0x5adb('0x17'),_0x3fff62['name']))[_0x5adb('0x18')]('openchannel_queue:save',_0x3fff62);}};module['exports']=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 83540f3..4be6f5a 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 _0x402f=['mapAgentsId','waiting','md5','updateRouting','updateRealtime','paused','length','online','loggedIn','available','stringify','format','sms:queue:%s','emit','sms_queue:save','lodash','util','redis','defaults','socket.io-emitter','name','timeout','beepall','Agents'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0x402f,0x6f));var _0xf402=function(_0xe70d09,_0x418aba){_0xe70d09=_0xe70d09-0x0;var _0x215e35=_0x402f[_0xe70d09];return _0x215e35;};'use strict';var _=require(_0xf402('0x0'));var md5=require('md5');var util=require(_0xf402('0x1'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0xf402('0x2')]=_[_0xf402('0x3')](config[_0xf402('0x2')],{'host':'localhost','port':0x18eb});var io=require(_0xf402('0x4'))(new Redis(config['redis']));function SmsQueue(_0x20c2cc){this['id']=_0x20c2cc['id']||0x0;this[_0xf402('0x5')]=_0x20c2cc[_0xf402('0x5')]||'';this[_0xf402('0x6')]=_0x20c2cc[_0xf402('0x6')]||0xa;this['strategy']=_0x20c2cc['strategy']||_0xf402('0x7');this[_0xf402('0x8')]=_0x20c2cc[_0xf402('0x8')];this[_0xf402('0x9')]={};this[_0xf402('0xa')]=0x0;this[_0xf402('0xb')]='';this[_0xf402('0xc')]();this[_0xf402('0xd')]();}SmsQueue['prototype'][_0xf402('0xc')]=function(){var _0x496916=this['mapAgentsId']['_rr'];this['mapAgentsId']=_['map'](this[_0xf402('0x8')],'id');this['mapAgentsId']['_rr']=_0x496916;};SmsQueue['prototype'][_0xf402('0xd')]=function(){this['loggedIn']=0x0;this[_0xf402('0xe')]=0x0;for(var _0xb3deb6=0x0;_0xb3deb6=0x0?this[_0xf402('0x12')]:0x0;var _0x5d7236={'id':this['id'],'available':this[_0xf402('0x12')],'loggedIn':this[_0xf402('0x11')],'name':this[_0xf402('0x5')],'paused':this[_0xf402('0xe')],'waiting':this['waiting']};var _0x14fdcc=md5(JSON[_0xf402('0x13')](_0x5d7236));if(this[_0xf402('0xb')]!==_0x14fdcc){this[_0xf402('0xb')]=_0x14fdcc;io['to'](util[_0xf402('0x14')](_0xf402('0x15'),_0x5d7236[_0xf402('0x5')]))[_0xf402('0x16')](_0xf402('0x17'),_0x5d7236);}};module['exports']=SmsQueue; \ No newline at end of file +var _0xbec5=['Agents','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','map','loggedIn','paused','length','online','smsPause','available','stringify','sms:queue:%s','emit','sms_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall'];(function(_0x442a09,_0x5d35b1){var _0xcd5d45=function(_0x125eb2){while(--_0x125eb2){_0x442a09['push'](_0x442a09['shift']());}};_0xcd5d45(++_0x5d35b1);}(_0xbec5,0xe5));var _0x5bec=function(_0x284807,_0x4be925){_0x284807=_0x284807-0x0;var _0x50c774=_0xbec5[_0x284807];return _0x50c774;};'use strict';var _=require(_0x5bec('0x0'));var md5=require(_0x5bec('0x1'));var util=require('util');var Redis=require(_0x5bec('0x2'));var config=require(_0x5bec('0x3'));config[_0x5bec('0x4')]=_[_0x5bec('0x5')](config[_0x5bec('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x5bec('0x6'))(new Redis(config[_0x5bec('0x4')]));function SmsQueue(_0x3a963f){this['id']=_0x3a963f['id']||0x0;this['name']=_0x3a963f[_0x5bec('0x7')]||'';this[_0x5bec('0x8')]=_0x3a963f[_0x5bec('0x8')]||0xa;this[_0x5bec('0x9')]=_0x3a963f[_0x5bec('0x9')]||_0x5bec('0xa');this[_0x5bec('0xb')]=_0x3a963f[_0x5bec('0xb')];this['mapAgentsId']={};this[_0x5bec('0xc')]=0x0;this['md5']='';this[_0x5bec('0xd')]();this[_0x5bec('0xe')]();}SmsQueue[_0x5bec('0xf')]['updateRouting']=function(){var _0x288d1b=this[_0x5bec('0x10')][_0x5bec('0x11')];this['mapAgentsId']=_[_0x5bec('0x12')](this[_0x5bec('0xb')],'id');this['mapAgentsId'][_0x5bec('0x11')]=_0x288d1b;};SmsQueue[_0x5bec('0xf')][_0x5bec('0xe')]=function(){this[_0x5bec('0x13')]=0x0;this[_0x5bec('0x14')]=0x0;for(var _0xcd6d90=0x0;_0xcd6d90=0x0?this['available']:0x0;var _0x5295f0={'id':this['id'],'available':this[_0x5bec('0x18')],'loggedIn':this[_0x5bec('0x13')],'name':this['name'],'paused':this[_0x5bec('0x14')],'waiting':this[_0x5bec('0xc')]};var _0x32a846=md5(JSON[_0x5bec('0x19')](_0x5295f0));if(this['md5']!==_0x32a846){this[_0x5bec('0x1')]=_0x32a846;io['to'](util['format'](_0x5bec('0x1a'),_0x5295f0[_0x5bec('0x7')]))[_0x5bec('0x1b')](_0x5bec('0x1c'),_0x5295f0);}};module[_0x5bec('0x1d')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 1636d57..2adb539 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 _0x749e=['timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','prototype','_rr','mapAgentsId','map','loggedIn','paused','length','online','whatsappPause','available','stringify','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name'];(function(_0x3e82fd,_0x4c1baa){var _0x355dcb=function(_0xd2190d){while(--_0xd2190d){_0x3e82fd['push'](_0x3e82fd['shift']());}};_0x355dcb(++_0x4c1baa);}(_0x749e,0xf0));var _0xe749=function(_0x196a27,_0xc1d170){_0x196a27=_0x196a27-0x0;var _0x99cb8e=_0x749e[_0x196a27];return _0x99cb8e;};'use strict';var _=require(_0xe749('0x0'));var md5=require(_0xe749('0x1'));var util=require('util');var Redis=require(_0xe749('0x2'));var config=require(_0xe749('0x3'));config[_0xe749('0x4')]=_[_0xe749('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xe749('0x6'))(new Redis(config[_0xe749('0x4')]));function WhatsappQueue(_0x1feffb){this['id']=_0x1feffb['id']||0x0;this[_0xe749('0x7')]=_0x1feffb[_0xe749('0x7')]||'';this['timeout']=_0x1feffb[_0xe749('0x8')]||0xa;this['strategy']=_0x1feffb[_0xe749('0x9')]||_0xe749('0xa');this['Agents']=_0x1feffb[_0xe749('0xb')];this['mapAgentsId']={};this[_0xe749('0xc')]=0x0;this[_0xe749('0x1')]='';this[_0xe749('0xd')]();this[_0xe749('0xe')]();}WhatsappQueue[_0xe749('0xf')][_0xe749('0xd')]=function(){var _0x532023=this['mapAgentsId'][_0xe749('0x10')];this[_0xe749('0x11')]=_[_0xe749('0x12')](this[_0xe749('0xb')],'id');this[_0xe749('0x11')]['_rr']=_0x532023;};WhatsappQueue[_0xe749('0xf')][_0xe749('0xe')]=function(){this[_0xe749('0x13')]=0x0;this[_0xe749('0x14')]=0x0;for(var _0xb3d755=0x0;_0xb3d755=0x0?this[_0xe749('0x18')]:0x0;var _0x25f731={'id':this['id'],'available':this[_0xe749('0x18')],'loggedIn':this[_0xe749('0x13')],'name':this[_0xe749('0x7')],'paused':this[_0xe749('0x14')],'waiting':this[_0xe749('0xc')]};var _0x3dda7e=md5(JSON[_0xe749('0x19')](_0x25f731));if(this['md5']!==_0x3dda7e){this[_0xe749('0x1')]=_0x3dda7e;io['to'](util[_0xe749('0x1a')](_0xe749('0x1b'),_0x25f731[_0xe749('0x7')]))[_0xe749('0x1c')](_0xe749('0x1d'),_0x25f731);}};module[_0xe749('0x1e')]=WhatsappQueue; \ No newline at end of file +var _0x8c70=['waiting','updateRouting','updateRealtime','_rr','map','prototype','paused','length','whatsappPause','available','loggedIn','format','whatsapp:queue:%s','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0x8c70,0x7e));var _0x08c7=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0x8c70[_0x29b609];return _0x54c952;};'use strict';var _=require(_0x08c7('0x0'));var md5=require(_0x08c7('0x1'));var util=require(_0x08c7('0x2'));var Redis=require(_0x08c7('0x3'));var config=require(_0x08c7('0x4'));config[_0x08c7('0x5')]=_[_0x08c7('0x6')](config[_0x08c7('0x5')],{'host':_0x08c7('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x08c7('0x5')]));function WhatsappQueue(_0x321031){this['id']=_0x321031['id']||0x0;this[_0x08c7('0x8')]=_0x321031['name']||'';this['timeout']=_0x321031[_0x08c7('0x9')]||0xa;this[_0x08c7('0xa')]=_0x321031[_0x08c7('0xa')]||_0x08c7('0xb');this['Agents']=_0x321031[_0x08c7('0xc')];this[_0x08c7('0xd')]={};this[_0x08c7('0xe')]=0x0;this['md5']='';this[_0x08c7('0xf')]();this[_0x08c7('0x10')]();}WhatsappQueue['prototype']['updateRouting']=function(){var _0x3b64b2=this[_0x08c7('0xd')][_0x08c7('0x11')];this[_0x08c7('0xd')]=_[_0x08c7('0x12')](this[_0x08c7('0xc')],'id');this[_0x08c7('0xd')][_0x08c7('0x11')]=_0x3b64b2;};WhatsappQueue[_0x08c7('0x13')][_0x08c7('0x10')]=function(){this['loggedIn']=0x0;this[_0x08c7('0x14')]=0x0;for(var _0x259263=0x0;_0x259263=0x0?this[_0x08c7('0x17')]:0x0;var _0x132b19={'id':this['id'],'available':this['available'],'loggedIn':this[_0x08c7('0x18')],'name':this[_0x08c7('0x8')],'paused':this[_0x08c7('0x14')],'waiting':this['waiting']};var _0x5d45c1=md5(JSON['stringify'](_0x132b19));if(this['md5']!==_0x5d45c1){this[_0x08c7('0x1')]=_0x5d45c1;io['to'](util[_0x08c7('0x19')](_0x08c7('0x1a'),_0x132b19[_0x08c7('0x8')]))['emit']('whatsapp_queue:save',_0x132b19);}};module[_0x08c7('0x1b')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 8f56edf..4f3aefe 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file +var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xa9e0[_0x55f8b4];return _0x2475f9;};'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 8bde8c5..62068e0 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 _0x71ac=['addTagsToChatInteraction','../client','update','Request','UpdateChatInteraction','updateChatInteraction','addTags'];(function(_0x495ec6,_0x4c9d90){var _0x5210f1=function(_0x497015){while(--_0x497015){_0x495ec6['push'](_0x495ec6['shift']());}};_0x5210f1(++_0x4c9d90);}(_0x71ac,0xbe));var _0xc71a=function(_0x2e50a2,_0x27f31e){_0x2e50a2=_0x2e50a2-0x0;var _0x47e5de=_0x71ac[_0x2e50a2];return _0x47e5de;};'use strict';var client=require(_0xc71a('0x0'));exports[_0xc71a('0x1')]=function(_0x2e09b8,_0x10b4e0){return client[_0xc71a('0x2')](_0xc71a('0x3'),{'body':_0x10b4e0,'options':{'where':{'id':_0x2e09b8}},'log':_0xc71a('0x4')});};exports[_0xc71a('0x5')]=function(_0x4c0c80,_0x382baf){return client[_0xc71a('0x2')]('AddTagsToChatInteraction',{'body':_0x382baf,'options':{'where':{'id':_0x4c0c80}},'log':_0xc71a('0x6')});}; \ No newline at end of file +var _0x76b1=['update','UpdateChatInteraction','updateChatInteraction','addTags','Request','addTagsToChatInteraction','../client'];(function(_0x3d78d7,_0x44acea){var _0x4b6784=function(_0x284157){while(--_0x284157){_0x3d78d7['push'](_0x3d78d7['shift']());}};_0x4b6784(++_0x44acea);}(_0x76b1,0x1db));var _0x176b=function(_0x2cd75d,_0x5e66f2){_0x2cd75d=_0x2cd75d-0x0;var _0x3bbdc8=_0x76b1[_0x2cd75d];return _0x3bbdc8;};'use strict';var client=require(_0x176b('0x0'));exports[_0x176b('0x1')]=function(_0x35ea28,_0x16c43e){return client['Request'](_0x176b('0x2'),{'body':_0x16c43e,'options':{'where':{'id':_0x35ea28}},'log':_0x176b('0x3')});};exports[_0x176b('0x4')]=function(_0x3f8f83,_0x59dc67){return client[_0x176b('0x5')]('AddTagsToChatInteraction',{'body':_0x59dc67,'options':{'where':{'id':_0x3f8f83}},'log':_0x176b('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index df8e8c8..acfd520 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 _0xdb4b=['../client','create','Request','CreateChatMessage','createChatMessage'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0xdb4b,0x1cc));var _0xbdb4=function(_0x5b7606,_0x3367ef){_0x5b7606=_0x5b7606-0x0;var _0x186584=_0xdb4b[_0x5b7606];return _0x186584;};'use strict';var client=require(_0xbdb4('0x0'));exports[_0xbdb4('0x1')]=function(_0x7c85e2){return client[_0xbdb4('0x2')](_0xbdb4('0x3'),{'body':_0x7c85e2,'log':_0xbdb4('0x4')});}; \ No newline at end of file +var _0x69f1=['../client','CreateChatMessage','createChatMessage'];(function(_0xb30207,_0xe8518e){var _0x31b402=function(_0x268463){while(--_0x268463){_0xb30207['push'](_0xb30207['shift']());}};_0x31b402(++_0xe8518e);}(_0x69f1,0x117));var _0x169f=function(_0x3c06e5,_0xc45069){_0x3c06e5=_0x3c06e5-0x0;var _0x4afc12=_0x69f1[_0x3c06e5];return _0x4afc12;};'use strict';var client=require(_0x169f('0x0'));exports['create']=function(_0x5d7c0a){return client['Request'](_0x169f('0x1'),{'body':_0x5d7c0a,'log':_0x169f('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index c4a333f..d1f496a 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 _0x814b=['Request','GetChatQueue','name','timeout','User','Agents','online','chatPause','../client','getChatQueues'];(function(_0x286a98,_0x28b547){var _0x4e4b7f=function(_0x14fd76){while(--_0x14fd76){_0x286a98['push'](_0x286a98['shift']());}};_0x4e4b7f(++_0x28b547);}(_0x814b,0x1a2));var _0xb814=function(_0x19aa84,_0x549537){_0x19aa84=_0x19aa84-0x0;var _0x536146=_0x814b[_0x19aa84];return _0x536146;};'use strict';var client=require(_0xb814('0x0'));exports[_0xb814('0x1')]=function(){return function(){return client[_0xb814('0x2')](_0xb814('0x3'),{'options':{'raw':![],'attributes':['id',_0xb814('0x4'),_0xb814('0x5'),'strategy'],'include':[{'model':_0xb814('0x6'),'as':_0xb814('0x7'),'attributes':['id',_0xb814('0x4'),_0xb814('0x8'),_0xb814('0x9')]}]},'log':_0xb814('0x1')});};}; \ No newline at end of file +var _0x5697=['name','online','../client','Request','GetChatQueue'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x5697,0x1b5));var _0x7569=function(_0x2e7c1b,_0x232f79){_0x2e7c1b=_0x2e7c1b-0x0;var _0x42f565=_0x5697[_0x2e7c1b];return _0x42f565;};'use strict';var client=require(_0x7569('0x0'));exports['getChatQueues']=function(){return function(){return client[_0x7569('0x1')](_0x7569('0x2'),{'options':{'raw':![],'attributes':['id',_0x7569('0x3'),'timeout','strategy'],'include':[{'model':'User','as':'Agents','attributes':['id','name',_0x7569('0x4'),'chatPause']}]},'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 89db7c2..3cea58b 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 _0x54ef=['CreateChatQueueReport','update','Request','UpdateChatQueueReport','../client','create'];(function(_0x5cd01b,_0x32aa05){var _0x232cce=function(_0x21e194){while(--_0x21e194){_0x5cd01b['push'](_0x5cd01b['shift']());}};_0x232cce(++_0x32aa05);}(_0x54ef,0x112));var _0xf54e=function(_0x4e1970,_0x5d6da3){_0x4e1970=_0x4e1970-0x0;var _0x196bbd=_0x54ef[_0x4e1970];return _0x196bbd;};'use strict';var client=require(_0xf54e('0x0'));exports[_0xf54e('0x1')]=function(_0x12c070){return client['Request'](_0xf54e('0x2'),{'body':_0x12c070,'log':_0xf54e('0x2')});};exports[_0xf54e('0x3')]=function(_0x42b9b2,_0x8b6bb6){return client[_0xf54e('0x4')](_0xf54e('0x5'),{'body':_0x8b6bb6,'options':{'where':{'uniqueid':_0x42b9b2},'order':[['id','DESC']],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file +var _0xba33=['update','UpdateChatQueueReport','DESC','../client','create','Request','CreateChatQueueReport'];(function(_0x2d7842,_0x5e1932){var _0x35485d=function(_0x56843a){while(--_0x56843a){_0x2d7842['push'](_0x2d7842['shift']());}};_0x35485d(++_0x5e1932);}(_0xba33,0xf1));var _0x3ba3=function(_0x5c2d11,_0x1457d1){_0x5c2d11=_0x5c2d11-0x0;var _0x542116=_0xba33[_0x5c2d11];return _0x542116;};'use strict';var client=require(_0x3ba3('0x0'));exports[_0x3ba3('0x1')]=function(_0x385c61){return client[_0x3ba3('0x2')]('CreateChatQueueReport',{'body':_0x385c61,'log':_0x3ba3('0x3')});};exports[_0x3ba3('0x4')]=function(_0x12472e,_0x77ca36){return client[_0x3ba3('0x2')](_0x3ba3('0x5'),{'body':_0x77ca36,'options':{'where':{'uniqueid':_0x12472e},'order':[['id',_0x3ba3('0x6')]],'limit':0x1},'log':_0x3ba3('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index dc5133c..8d83cf8 100644 --- a/server/services/routing/rpc/faxInteraction.js +++ b/server/services/routing/rpc/faxInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x1ac6e5,_0x40f47f){var _0x5877dc=function(_0x99caea){while(--_0x99caea){_0x1ac6e5['push'](_0x1ac6e5['shift']());}};_0x5877dc(++_0x40f47f);}(_0x7a54,0x106));var _0x47a5=function(_0x2df413,_0x19852b){_0x2df413=_0x2df413-0x0;var _0x2da67a=_0x7a54[_0x2df413];return _0x2da67a;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file +var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x451402,_0x561cb8){var _0x4ffb7f=function(_0x1c263a){while(--_0x1c263a){_0x451402['push'](_0x451402['shift']());}};_0x4ffb7f(++_0x561cb8);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index bf70eae..32e909a 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 _0xa696=['Request','create'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xa696,0xef));var _0x6a69=function(_0xef8146,_0x459c34){_0xef8146=_0xef8146-0x0;var _0x5a6cb0=_0xa696[_0xef8146];return _0x5a6cb0;};'use strict';var client=require('../client');exports[_0x6a69('0x0')]=function(_0x273472){return client[_0x6a69('0x1')]('CreateFaxMessage',{'body':_0x273472,'log':'createFaxMessage'});}; \ No newline at end of file +var _0x5065=['createFaxMessage','../client','Request'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5065,0x151));var _0x5506=function(_0x48639f,_0x3a4420){_0x48639f=_0x48639f-0x0;var _0x41a489=_0x5065[_0x48639f];return _0x41a489;};'use strict';var client=require(_0x5506('0x0'));exports['create']=function(_0x45a172){return client[_0x5506('0x1')]('CreateFaxMessage',{'body':_0x45a172,'log':_0x5506('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 4d1630a..021975d 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 _0xa0b1=['faxPause','getFaxQueues','Request','name','strategy','online'];(function(_0x100e36,_0x4da225){var _0x1df0c9=function(_0xe4b84f){while(--_0xe4b84f){_0x100e36['push'](_0x100e36['shift']());}};_0x1df0c9(++_0x4da225);}(_0xa0b1,0x1e7));var _0x1a0b=function(_0x6d6a66,_0x2924af){_0x6d6a66=_0x6d6a66-0x0;var _0x11eb6e=_0xa0b1[_0x6d6a66];return _0x11eb6e;};'use strict';var client=require('../client');exports[_0x1a0b('0x0')]=function(){return function(){return client[_0x1a0b('0x1')]('GetFaxQueue',{'options':{'raw':![],'attributes':['id',_0x1a0b('0x2'),'timeout',_0x1a0b('0x3')],'include':[{'model':'User','as':'Agents','attributes':['id','name',_0x1a0b('0x4'),_0x1a0b('0x5')]}]},'log':_0x1a0b('0x0')});};}; \ No newline at end of file +var _0x91eb=['getFaxQueues','GetFaxQueue','name','strategy','User','online','faxPause','../client'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x91eb,0xef));var _0xb91e=function(_0x3e9800,_0x556d9d){_0x3e9800=_0x3e9800-0x0;var _0xff95e9=_0x91eb[_0x3e9800];return _0xff95e9;};'use strict';var client=require(_0xb91e('0x0'));exports[_0xb91e('0x1')]=function(){return function(){return client['Request'](_0xb91e('0x2'),{'options':{'raw':![],'attributes':['id',_0xb91e('0x3'),'timeout',_0xb91e('0x4')],'include':[{'model':_0xb91e('0x5'),'as':'Agents','attributes':['id',_0xb91e('0x3'),_0xb91e('0x6'),_0xb91e('0x7')]}]},'log':_0xb91e('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 35e3dc3..287125c 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 _0x88ce=['update','UpdateFaxQueueReport','DESC','create','Request','CreateFaxQueueReport'];(function(_0x996bc8,_0x291e01){var _0x20b0ea=function(_0x5ba992){while(--_0x5ba992){_0x996bc8['push'](_0x996bc8['shift']());}};_0x20b0ea(++_0x291e01);}(_0x88ce,0xab));var _0xe88c=function(_0x5e41f9,_0x574f03){_0x5e41f9=_0x5e41f9-0x0;var _0x13fc80=_0x88ce[_0x5e41f9];return _0x13fc80;};'use strict';var client=require('../client');exports[_0xe88c('0x0')]=function(_0x4eff90){return client[_0xe88c('0x1')](_0xe88c('0x2'),{'body':_0x4eff90,'log':_0xe88c('0x2')});};exports[_0xe88c('0x3')]=function(_0x27f975,_0x14e9c6){return client['Request'](_0xe88c('0x4'),{'body':_0x14e9c6,'options':{'where':{'uniqueid':_0x27f975},'order':[['id',_0xe88c('0x5')]],'limit':0x1},'log':_0xe88c('0x4')});}; \ No newline at end of file +var _0xee69=['create','CreateFaxQueueReport','Request','UpdateFaxQueueReport','../client'];(function(_0x498102,_0x341767){var _0x47adba=function(_0x51a59e){while(--_0x51a59e){_0x498102['push'](_0x498102['shift']());}};_0x47adba(++_0x341767);}(_0xee69,0x15d));var _0x9ee6=function(_0x4c8756,_0x532595){_0x4c8756=_0x4c8756-0x0;var _0x3c2405=_0xee69[_0x4c8756];return _0x3c2405;};'use strict';var client=require(_0x9ee6('0x0'));exports[_0x9ee6('0x1')]=function(_0x525bc0){return client['Request']('CreateFaxQueueReport',{'body':_0x525bc0,'log':_0x9ee6('0x2')});};exports['update']=function(_0x6c715,_0x1f7526){return client[_0x9ee6('0x3')](_0x9ee6('0x4'),{'body':_0x1f7526,'options':{'where':{'uniqueid':_0x6c715},'order':[['id','DESC']],'limit':0x1},'log':_0x9ee6('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 19188db..bed427c 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 _0xe5cc=['Intervals','interval','../client','getIntervals','Request','GetInterval','Interval'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xe5cc,0x105));var _0xce5c=function(_0x4fcdb7,_0x39f7fa){_0x4fcdb7=_0x4fcdb7-0x0;var _0x3264cb=_0xe5cc[_0x4fcdb7];return _0x3264cb;};'use strict';var client=require(_0xce5c('0x0'));exports[_0xce5c('0x1')]=function(){return function(){return client[_0xce5c('0x2')](_0xce5c('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0xce5c('0x4'),'as':_0xce5c('0x5'),'attributes':['id','name',_0xce5c('0x6')]}]},'log':_0xce5c('0x1')});};}; \ No newline at end of file +var _0x87b2=['Interval','Intervals','../client','getIntervals','name'];(function(_0x2037a8,_0x2d7d36){var _0x27bd43=function(_0x188fcc){while(--_0x188fcc){_0x2037a8['push'](_0x2037a8['shift']());}};_0x27bd43(++_0x2d7d36);}(_0x87b2,0x110));var _0x287b=function(_0x5ee946,_0x680816){_0x5ee946=_0x5ee946-0x0;var _0x57e823=_0x87b2[_0x5ee946];return _0x57e823;};'use strict';var client=require(_0x287b('0x0'));exports[_0x287b('0x1')]=function(){return function(){return client['Request']('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x287b('0x2')],'include':[{'model':_0x287b('0x3'),'as':_0x287b('0x4'),'attributes':['id','name','interval']}]},'log':'getIntervals'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 0fde7be..d8eec2b 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 _0x8f4c=['update','Request','UpdateMailInteraction','addTags','AddTagsToMailInteraction','../client'];(function(_0x3d9866,_0x226ff8){var _0x1d6f97=function(_0xe9695f){while(--_0xe9695f){_0x3d9866['push'](_0x3d9866['shift']());}};_0x1d6f97(++_0x226ff8);}(_0x8f4c,0x113));var _0xc8f4=function(_0xfacee2,_0x29c3b0){_0xfacee2=_0xfacee2-0x0;var _0x4cc9ea=_0x8f4c[_0xfacee2];return _0x4cc9ea;};'use strict';var client=require(_0xc8f4('0x0'));exports[_0xc8f4('0x1')]=function(_0xce26f2,_0x43926b){return client[_0xc8f4('0x2')](_0xc8f4('0x3'),{'body':_0x43926b,'options':{'where':{'id':_0xce26f2}},'log':'updateMailInteraction'});};exports[_0xc8f4('0x4')]=function(_0x47350d,_0x133764){return client['Request'](_0xc8f4('0x5'),{'body':_0x133764,'options':{'where':{'id':_0x47350d}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x1c7c=['update','UpdateMailInteraction','addTags','Request','AddTagsToMailInteraction','addTagsToChatInteraction','../client'];(function(_0x5ad0d7,_0x2645f8){var _0xd83bd=function(_0x33d3bd){while(--_0x33d3bd){_0x5ad0d7['push'](_0x5ad0d7['shift']());}};_0xd83bd(++_0x2645f8);}(_0x1c7c,0x164));var _0xc1c7=function(_0x494bdd,_0x16ff71){_0x494bdd=_0x494bdd-0x0;var _0xdcf013=_0x1c7c[_0x494bdd];return _0xdcf013;};'use strict';var client=require(_0xc1c7('0x0'));exports[_0xc1c7('0x1')]=function(_0x38fc99,_0x3a93f0){return client['Request'](_0xc1c7('0x2'),{'body':_0x3a93f0,'options':{'where':{'id':_0x38fc99}},'log':'updateMailInteraction'});};exports[_0xc1c7('0x3')]=function(_0x20dad3,_0xbb9da0){return client[_0xc1c7('0x4')](_0xc1c7('0x5'),{'body':_0xbb9da0,'options':{'where':{'id':_0x20dad3}},'log':_0xc1c7('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index ce07875..a0da991 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 _0x1d62=['create','Request','createMailMessage','../client'];(function(_0x3430aa,_0x57cd92){var _0x2ac5c=function(_0x3068dd){while(--_0x3068dd){_0x3430aa['push'](_0x3430aa['shift']());}};_0x2ac5c(++_0x57cd92);}(_0x1d62,0xcb));var _0x21d6=function(_0x37d0e5,_0x991e83){_0x37d0e5=_0x37d0e5-0x0;var _0x1079dd=_0x1d62[_0x37d0e5];return _0x1079dd;};'use strict';var client=require(_0x21d6('0x0'));exports[_0x21d6('0x1')]=function(_0x2fb104){return client[_0x21d6('0x2')]('CreateMailMessage',{'body':_0x2fb104,'log':_0x21d6('0x3')});}; \ No newline at end of file +var _0x035a=['create','Request','CreateMailMessage','createMailMessage'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x035a,0x78));var _0xa035=function(_0x221e0e,_0x589d6c){_0x221e0e=_0x221e0e-0x0;var _0x65b0dc=_0x035a[_0x221e0e];return _0x65b0dc;};'use strict';var client=require('../client');exports[_0xa035('0x0')]=function(_0x368021){return client[_0xa035('0x1')](_0xa035('0x2'),{'body':_0x368021,'log':_0xa035('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 4134f4b..befed77 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 _0x5bea=['Request','name','timeout','strategy','Agents','online','getMailQueues'];(function(_0x2b9cf5,_0x2a7804){var _0xd0cf15=function(_0x92a896){while(--_0x92a896){_0x2b9cf5['push'](_0x2b9cf5['shift']());}};_0xd0cf15(++_0x2a7804);}(_0x5bea,0x141));var _0xa5be=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x5bea[_0x46698a];return _0x356db0;};'use strict';var client=require('../client');exports[_0xa5be('0x0')]=function(){return function(){return client[_0xa5be('0x1')]('GetMailQueue',{'options':{'raw':![],'attributes':['id',_0xa5be('0x2'),_0xa5be('0x3'),_0xa5be('0x4')],'include':[{'model':'User','as':_0xa5be('0x5'),'attributes':['id',_0xa5be('0x2'),_0xa5be('0x6'),'mailPause']}]},'log':_0xa5be('0x0')});};}; \ No newline at end of file +var _0xa687=['online','mailPause','getMailQueues','GetMailQueue','name','timeout','strategy','User','Agents'];(function(_0x3839fc,_0x39759c){var _0x416679=function(_0x40b73c){while(--_0x40b73c){_0x3839fc['push'](_0x3839fc['shift']());}};_0x416679(++_0x39759c);}(_0xa687,0x158));var _0x7a68=function(_0x39cc8f,_0xb60cd8){_0x39cc8f=_0x39cc8f-0x0;var _0x15e616=_0xa687[_0x39cc8f];return _0x15e616;};'use strict';var client=require('../client');exports[_0x7a68('0x0')]=function(){return function(){return client['Request'](_0x7a68('0x1'),{'options':{'raw':![],'attributes':['id',_0x7a68('0x2'),_0x7a68('0x3'),_0x7a68('0x4')],'include':[{'model':_0x7a68('0x5'),'as':_0x7a68('0x6'),'attributes':['id',_0x7a68('0x2'),_0x7a68('0x7'),_0x7a68('0x8')]}]},'log':_0x7a68('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 246a0fd..ba21d83 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 _0x6b31=['Request','UpdateMailQueueReport','DESC','../client','CreateMailQueueReport','update'];(function(_0x148f22,_0x5a5572){var _0x50ccfa=function(_0x22492f){while(--_0x22492f){_0x148f22['push'](_0x148f22['shift']());}};_0x50ccfa(++_0x5a5572);}(_0x6b31,0x11d));var _0x16b3=function(_0x4c0ca5,_0xf33ad7){_0x4c0ca5=_0x4c0ca5-0x0;var _0x1458aa=_0x6b31[_0x4c0ca5];return _0x1458aa;};'use strict';var client=require(_0x16b3('0x0'));exports['create']=function(_0x5e129d){return client['Request']('CreateMailQueueReport',{'body':_0x5e129d,'log':_0x16b3('0x1')});};exports[_0x16b3('0x2')]=function(_0xd485bc,_0x26a6d9){return client[_0x16b3('0x3')](_0x16b3('0x4'),{'body':_0x26a6d9,'options':{'where':{'uniqueid':_0xd485bc},'order':[['id',_0x16b3('0x5')]],'limit':0x1},'log':_0x16b3('0x4')});}; \ No newline at end of file +var _0x6fe5=['UpdateMailQueueReport','../client','create','Request','CreateMailQueueReport','update'];(function(_0x51057a,_0x2c8c27){var _0x3cbdaa=function(_0x168adf){while(--_0x168adf){_0x51057a['push'](_0x51057a['shift']());}};_0x3cbdaa(++_0x2c8c27);}(_0x6fe5,0x139));var _0x56fe=function(_0x4d71d5,_0x47fcd2){_0x4d71d5=_0x4d71d5-0x0;var _0x4383a2=_0x6fe5[_0x4d71d5];return _0x4383a2;};'use strict';var client=require(_0x56fe('0x0'));exports[_0x56fe('0x1')]=function(_0x4b6663){return client[_0x56fe('0x2')](_0x56fe('0x3'),{'body':_0x4b6663,'log':_0x56fe('0x3')});};exports[_0x56fe('0x4')]=function(_0x367032,_0x184380){return client[_0x56fe('0x2')]('UpdateMailQueueReport',{'body':_0x184380,'options':{'where':{'uniqueid':_0x367032},'order':[['id','DESC']],'limit':0x1},'log':_0x56fe('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 382e611..4a84993 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 _0xaec5=['UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','update'];(function(_0x43b487,_0x21893a){var _0x2f707a=function(_0x477ee0){while(--_0x477ee0){_0x43b487['push'](_0x43b487['shift']());}};_0x2f707a(++_0x21893a);}(_0xaec5,0x1b0));var _0x5aec=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xaec5[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x5aec('0x0'));exports[_0x5aec('0x1')]=function(_0x172e54,_0x42a6e9){return client['Request'](_0x5aec('0x2'),{'body':_0x42a6e9,'options':{'where':{'id':_0x172e54}},'log':_0x5aec('0x3')});};exports[_0x5aec('0x4')]=function(_0x49a6c4,_0x4f417c){return client['Request'](_0x5aec('0x5'),{'body':_0x4f417c,'options':{'where':{'id':_0x49a6c4}},'log':_0x5aec('0x6')});}; \ No newline at end of file +var _0x7e15=['Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','update'];(function(_0x163555,_0x27ce78){var _0x250307=function(_0x27c529){while(--_0x27c529){_0x163555['push'](_0x163555['shift']());}};_0x250307(++_0x27ce78);}(_0x7e15,0x163));var _0x57e1=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7e15[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0x57e1('0x0'));exports[_0x57e1('0x1')]=function(_0x3caf3a,_0x2d1236){return client[_0x57e1('0x2')](_0x57e1('0x3'),{'body':_0x2d1236,'options':{'where':{'id':_0x3caf3a}},'log':_0x57e1('0x4')});};exports['addTags']=function(_0x104580,_0x3a7c51){return client[_0x57e1('0x2')](_0x57e1('0x5'),{'body':_0x3a7c51,'options':{'where':{'id':_0x104580}},'log':_0x57e1('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index f6058b4..38dd3a0 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 _0xd628=['CreateOpenchannelMessage','createOpenchannelMessage','create'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd628,0x98));var _0x8d62=function(_0x38b81d,_0x32695a){_0x38b81d=_0x38b81d-0x0;var _0x11224f=_0xd628[_0x38b81d];return _0x11224f;};'use strict';var client=require('../client');exports[_0x8d62('0x0')]=function(_0x46f5bf){return client['Request'](_0x8d62('0x1'),{'body':_0x46f5bf,'log':_0x8d62('0x2')});}; \ No newline at end of file +var _0x4ff1=['CreateOpenchannelMessage','../client','create','Request'];(function(_0x3de92d,_0x4713c1){var _0x39c45c=function(_0x30fcf6){while(--_0x30fcf6){_0x3de92d['push'](_0x3de92d['shift']());}};_0x39c45c(++_0x4713c1);}(_0x4ff1,0x1dd));var _0x14ff=function(_0x17f891,_0x34c577){_0x17f891=_0x17f891-0x0;var _0x5bf2d4=_0x4ff1[_0x17f891];return _0x5bf2d4;};'use strict';var client=require(_0x14ff('0x0'));exports[_0x14ff('0x1')]=function(_0xac785d){return client[_0x14ff('0x2')](_0x14ff('0x3'),{'body':_0xac785d,'log':'createOpenchannelMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 75661bd..71431f1 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 _0x2db4=['name','timeout','strategy','User','openchannelPause','getOpenchannelQueues','Request','GetOpenchannelQueue'];(function(_0x59eefb,_0x2151ce){var _0x1a49e8=function(_0x5a758c){while(--_0x5a758c){_0x59eefb['push'](_0x59eefb['shift']());}};_0x1a49e8(++_0x2151ce);}(_0x2db4,0xd5));var _0x42db=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x2db4[_0x2d7f0e];return _0x110b07;};'use strict';var client=require('../client');exports[_0x42db('0x0')]=function(){return function(){return client[_0x42db('0x1')](_0x42db('0x2'),{'options':{'raw':![],'attributes':['id',_0x42db('0x3'),_0x42db('0x4'),_0x42db('0x5')],'include':[{'model':_0x42db('0x6'),'as':'Agents','attributes':['id',_0x42db('0x3'),'online',_0x42db('0x7')]}]},'log':_0x42db('0x0')});};}; \ No newline at end of file +var _0xa454=['name','User','Agents','online','getOpenchannelQueues','Request','GetOpenchannelQueue'];(function(_0x1d393d,_0x26262){var _0x8a557d=function(_0x2637e0){while(--_0x2637e0){_0x1d393d['push'](_0x1d393d['shift']());}};_0x8a557d(++_0x26262);}(_0xa454,0xc8));var _0x4a45=function(_0xeae3cf,_0x74e8bd){_0xeae3cf=_0xeae3cf-0x0;var _0x6c390d=_0xa454[_0xeae3cf];return _0x6c390d;};'use strict';var client=require('../client');exports[_0x4a45('0x0')]=function(){return function(){return client[_0x4a45('0x1')](_0x4a45('0x2'),{'options':{'raw':![],'attributes':['id',_0x4a45('0x3'),'timeout','strategy'],'include':[{'model':_0x4a45('0x4'),'as':_0x4a45('0x5'),'attributes':['id','name',_0x4a45('0x6'),'openchannelPause']}]},'log':_0x4a45('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 3636b23..485c5ac 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 _0xd353=['../client','create','Request','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','DESC'];(function(_0x474c7e,_0x131f66){var _0x284608=function(_0x5c4841){while(--_0x5c4841){_0x474c7e['push'](_0x474c7e['shift']());}};_0x284608(++_0x131f66);}(_0xd353,0x7e));var _0x3d35=function(_0x4baccc,_0x1b3c7e){_0x4baccc=_0x4baccc-0x0;var _0x29fc8f=_0xd353[_0x4baccc];return _0x29fc8f;};'use strict';var client=require(_0x3d35('0x0'));exports[_0x3d35('0x1')]=function(_0x56074b){return client[_0x3d35('0x2')](_0x3d35('0x3'),{'body':_0x56074b,'log':'CreateOpenchannelQueueReport'});};exports['update']=function(_0x197cc6,_0x4e0869){return client[_0x3d35('0x2')](_0x3d35('0x4'),{'body':_0x4e0869,'options':{'where':{'uniqueid':_0x197cc6},'order':[['id',_0x3d35('0x5')]],'limit':0x1},'log':_0x3d35('0x4')});}; \ No newline at end of file +var _0x8729=['UpdateOpenchannelQueueReport','../client','create','Request','CreateOpenchannelQueueReport','update'];(function(_0xeb3587,_0x5285a3){var _0x205295=function(_0x49db7e){while(--_0x49db7e){_0xeb3587['push'](_0xeb3587['shift']());}};_0x205295(++_0x5285a3);}(_0x8729,0x181));var _0x9872=function(_0x5ab42b,_0x200cca){_0x5ab42b=_0x5ab42b-0x0;var _0x4ac895=_0x8729[_0x5ab42b];return _0x4ac895;};'use strict';var client=require(_0x9872('0x0'));exports[_0x9872('0x1')]=function(_0x56d24c){return client[_0x9872('0x2')]('CreateOpenchannelQueueReport',{'body':_0x56d24c,'log':_0x9872('0x3')});};exports[_0x9872('0x4')]=function(_0x4642c6,_0x1b8e58){return client[_0x9872('0x2')](_0x9872('0x5'),{'body':_0x1b8e58,'options':{'where':{'uniqueid':_0x4642c6},'order':[['id','DESC']],'limit':0x1},'log':_0x9872('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 3b2cce6..0d54f18 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 _0x956a=['update','Request','UpdateSmsInteraction','updateSmsInteraction','addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction'];(function(_0x1a98f9,_0x537cf6){var _0x4a64ec=function(_0x179fa7){while(--_0x179fa7){_0x1a98f9['push'](_0x1a98f9['shift']());}};_0x4a64ec(++_0x537cf6);}(_0x956a,0xb6));var _0xa956=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x956a[_0x432682];return _0x463d05;};'use strict';var client=require('../client');exports[_0xa956('0x0')]=function(_0x238805,_0x450ebd){return client[_0xa956('0x1')](_0xa956('0x2'),{'body':_0x450ebd,'options':{'where':{'id':_0x238805}},'log':_0xa956('0x3')});};exports[_0xa956('0x4')]=function(_0x38c808,_0x48bb8a){return client['Request'](_0xa956('0x5'),{'body':_0x48bb8a,'options':{'where':{'id':_0x38c808}},'log':_0xa956('0x6')});}; \ No newline at end of file +var _0xa37e=['UpdateSmsInteraction','addTags','AddTagsToSmsInteraction','Request'];(function(_0x3bfe81,_0x5a4d7f){var _0x152748=function(_0x2eb5f0){while(--_0x2eb5f0){_0x3bfe81['push'](_0x3bfe81['shift']());}};_0x152748(++_0x5a4d7f);}(_0xa37e,0x97));var _0xea37=function(_0x4608a5,_0xae0b94){_0x4608a5=_0x4608a5-0x0;var _0x46c2c9=_0xa37e[_0x4608a5];return _0x46c2c9;};'use strict';var client=require('../client');exports['update']=function(_0x474450,_0x42f098){return client[_0xea37('0x0')](_0xea37('0x1'),{'body':_0x42f098,'options':{'where':{'id':_0x474450}},'log':'updateSmsInteraction'});};exports[_0xea37('0x2')]=function(_0x537c5a,_0x360ed5){return client[_0xea37('0x0')](_0xea37('0x3'),{'body':_0x360ed5,'options':{'where':{'id':_0x537c5a}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index ede954b..bbdc689 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 _0xe8f1=['Request','createSmsMessage','create'];(function(_0x1c1a1c,_0x16318b){var _0x560c2b=function(_0xf6c619){while(--_0xf6c619){_0x1c1a1c['push'](_0x1c1a1c['shift']());}};_0x560c2b(++_0x16318b);}(_0xe8f1,0x1d9));var _0x1e8f=function(_0x43ddf5,_0x71f223){_0x43ddf5=_0x43ddf5-0x0;var _0x1a0269=_0xe8f1[_0x43ddf5];return _0x1a0269;};'use strict';var client=require('../client');exports[_0x1e8f('0x0')]=function(_0x1ea1a4){return client[_0x1e8f('0x1')]('CreateSmsMessage',{'body':_0x1ea1a4,'log':_0x1e8f('0x2')});}; \ No newline at end of file +var _0xd84e=['createSmsMessage','../client','create','Request','CreateSmsMessage'];(function(_0x44f65f,_0x2b08cd){var _0x1f2610=function(_0x3704a6){while(--_0x3704a6){_0x44f65f['push'](_0x44f65f['shift']());}};_0x1f2610(++_0x2b08cd);}(_0xd84e,0x137));var _0xed84=function(_0x23d683,_0x342264){_0x23d683=_0x23d683-0x0;var _0x59a6cd=_0xd84e[_0x23d683];return _0x59a6cd;};'use strict';var client=require(_0xed84('0x0'));exports[_0xed84('0x1')]=function(_0x5f296c){return client[_0xed84('0x2')](_0xed84('0x3'),{'body':_0x5f296c,'log':_0xed84('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 1ebc2ca..f30afd3 100644 --- a/server/services/routing/rpc/smsQueue.js +++ b/server/services/routing/rpc/smsQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['User','Agents','online','../client','getSmsQueues','Request','timeout','strategy'];(function(_0x4434c6,_0x11d834){var _0x5ddd6d=function(_0x10e917){while(--_0x10e917){_0x4434c6['push'](_0x4434c6['shift']());}};_0x5ddd6d(++_0x11d834);}(_0x70e0,0x17b));var _0x070e=function(_0x33df47,_0x1e1015){_0x33df47=_0x33df47-0x0;var _0x37223b=_0x70e0[_0x33df47];return _0x37223b;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(){return function(){return client[_0x070e('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x070e('0x3'),_0x070e('0x4')],'include':[{'model':_0x070e('0x5'),'as':_0x070e('0x6'),'attributes':['id','name',_0x070e('0x7'),'smsPause']}]},'log':_0x070e('0x1')});};}; \ No newline at end of file +var _0x0713=['getSmsQueues','Request','GetSmsQueue','name','timeout','strategy','Agents','online','smsPause'];(function(_0x32358b,_0x5c7c35){var _0x58c21d=function(_0x238a63){while(--_0x238a63){_0x32358b['push'](_0x32358b['shift']());}};_0x58c21d(++_0x5c7c35);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client[_0x3071('0x0')](_0x3071('0x1'),{'options':{'raw':![],'attributes':['id',_0x3071('0x2'),_0x3071('0x3'),_0x3071('0x4')],'include':[{'model':'User','as':_0x3071('0x5'),'attributes':['id',_0x3071('0x2'),_0x3071('0x6'),_0x3071('0x7')]}]},'log':_0x3071('0x8')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 653d1a4..521f53d 100644 --- a/server/services/routing/rpc/smsQueueReport.js +++ b/server/services/routing/rpc/smsQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['create','CreateSmsQueueReport','update','UpdateSmsQueueReport','../client'];(function(_0x36e4dc,_0x4cc695){var _0x303297=function(_0x33f6e9){while(--_0x33f6e9){_0x36e4dc['push'](_0x36e4dc['shift']());}};_0x303297(++_0x4cc695);}(_0x70e0,0x17b));var _0x070e=function(_0x47aa3e,_0x1fd279){_0x47aa3e=_0x47aa3e-0x0;var _0x5d0792=_0x70e0[_0x47aa3e];return _0x5d0792;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(_0x198c2e){return client['Request']('CreateSmsQueueReport',{'body':_0x198c2e,'log':_0x070e('0x2')});};exports[_0x070e('0x3')]=function(_0x277d32,_0x2593e5){return client['Request'](_0x070e('0x4'),{'body':_0x2593e5,'options':{'where':{'uniqueid':_0x277d32},'order':[['id','DESC']],'limit':0x1},'log':_0x070e('0x4')});}; \ No newline at end of file +var _0x55ca=['../client','create','CreateSmsQueueReport','update','Request','UpdateSmsQueueReport','DESC'];(function(_0x4b2299,_0x2aa0cb){var _0x52ae69=function(_0x21eb8b){while(--_0x21eb8b){_0x4b2299['push'](_0x4b2299['shift']());}};_0x52ae69(++_0x2aa0cb);}(_0x55ca,0x126));var _0xa55c=function(_0x5d23be,_0x3b4f3c){_0x5d23be=_0x5d23be-0x0;var _0x4d60a9=_0x55ca[_0x5d23be];return _0x4d60a9;};'use strict';var client=require(_0xa55c('0x0'));exports[_0xa55c('0x1')]=function(_0x4e78b4){return client['Request']('CreateSmsQueueReport',{'body':_0x4e78b4,'log':_0xa55c('0x2')});};exports[_0xa55c('0x3')]=function(_0x5dc716,_0x3b478a){return client[_0xa55c('0x4')](_0xa55c('0x5'),{'body':_0x3b478a,'options':{'where':{'uniqueid':_0x5dc716},'order':[['id',_0xa55c('0x6')]],'limit':0x1},'log':_0xa55c('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index abba2c2..e375f84 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(_0x689f74,_0x3c83e6){var _0x55da9c=function(_0x34ad8d){while(--_0x34ad8d){_0x689f74['push'](_0x689f74['shift']());}};_0x55da9c(++_0x3c83e6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'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(_0x5a7bc0,_0x300466){var _0x2ebcb4=function(_0x6542b8){while(--_0x6542b8){_0x5a7bc0['push'](_0x5a7bc0['shift']());}};_0x2ebcb4(++_0x300466);}(_0xa9e0,0x123));var _0x0a9e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa9e0[_0x28947d];return _0x12d2ee;};'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 764d324..944c009 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 _0x553a=['UpdateWhatsappInteraction','AddTagsToWhatsappInteraction','update','Request'];(function(_0x2d3b13,_0x5691fa){var _0x28978a=function(_0x47e3c3){while(--_0x47e3c3){_0x2d3b13['push'](_0x2d3b13['shift']());}};_0x28978a(++_0x5691fa);}(_0x553a,0x192));var _0xa553=function(_0x529059,_0x294a33){_0x529059=_0x529059-0x0;var _0x156bc2=_0x553a[_0x529059];return _0x156bc2;};'use strict';var client=require('../client');exports[_0xa553('0x0')]=function(_0x493b9c,_0x2a960e){return client[_0xa553('0x1')](_0xa553('0x2'),{'body':_0x2a960e,'options':{'where':{'id':_0x493b9c}},'log':'updateWhatsappInteraction'});};exports['addTags']=function(_0x367421,_0x50ecee){return client['Request'](_0xa553('0x3'),{'body':_0x50ecee,'options':{'where':{'id':_0x367421}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file +var _0x3595=['Request','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','addTagsToWhatsappInteraction','../client','update'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0x3595,0x147));var _0x5359=function(_0x967868,_0x17fe83){_0x967868=_0x967868-0x0;var _0x317856=_0x3595[_0x967868];return _0x317856;};'use strict';var client=require(_0x5359('0x0'));exports[_0x5359('0x1')]=function(_0xa74118,_0x52b0f5){return client[_0x5359('0x2')](_0x5359('0x3'),{'body':_0x52b0f5,'options':{'where':{'id':_0xa74118}},'log':_0x5359('0x4')});};exports[_0x5359('0x5')]=function(_0x1fa814,_0x125c76){return client['Request']('AddTagsToWhatsappInteraction',{'body':_0x125c76,'options':{'where':{'id':_0x1fa814}},'log':_0x5359('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 588cc45..2b59ee7 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 _0x14a3=['../client','create','Request','CreateWhatsappMessage','createWhatsappMessage'];(function(_0x5ddafe,_0x3b8075){var _0x3816a3=function(_0x33db0c){while(--_0x33db0c){_0x5ddafe['push'](_0x5ddafe['shift']());}};_0x3816a3(++_0x3b8075);}(_0x14a3,0x1b8));var _0x314a=function(_0x333798,_0x9f6561){_0x333798=_0x333798-0x0;var _0x389f4e=_0x14a3[_0x333798];return _0x389f4e;};'use strict';var client=require(_0x314a('0x0'));exports[_0x314a('0x1')]=function(_0x206d24){return client[_0x314a('0x2')](_0x314a('0x3'),{'body':_0x206d24,'log':_0x314a('0x4')});}; \ No newline at end of file +var _0xf19c=['CreateWhatsappMessage','createWhatsappMessage','create','Request'];(function(_0x3a02ac,_0x14656a){var _0x186ef0=function(_0x3f1e28){while(--_0x3f1e28){_0x3a02ac['push'](_0x3a02ac['shift']());}};_0x186ef0(++_0x14656a);}(_0xf19c,0x8e));var _0xcf19=function(_0x54a09a,_0x4ab02a){_0x54a09a=_0x54a09a-0x0;var _0x1529e3=_0xf19c[_0x54a09a];return _0x1529e3;};'use strict';var client=require('../client');exports[_0xcf19('0x0')]=function(_0xc0e83e){return client[_0xcf19('0x1')](_0xcf19('0x2'),{'body':_0xc0e83e,'log':_0xcf19('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index add46e4..9ed4f74 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 _0x5163=['online','whatsappPause','../client','getWhatsappQueues','Request','GetWhatsappQueue','name','timeout','strategy','User','Agents'];(function(_0x34145e,_0x689e31){var _0x27ed04=function(_0x297fc7){while(--_0x297fc7){_0x34145e['push'](_0x34145e['shift']());}};_0x27ed04(++_0x689e31);}(_0x5163,0x91));var _0x3516=function(_0x227525,_0x4b8b08){_0x227525=_0x227525-0x0;var _0x113ae0=_0x5163[_0x227525];return _0x113ae0;};'use strict';var client=require(_0x3516('0x0'));exports[_0x3516('0x1')]=function(){return function(){return client[_0x3516('0x2')](_0x3516('0x3'),{'options':{'raw':![],'attributes':['id',_0x3516('0x4'),_0x3516('0x5'),_0x3516('0x6')],'include':[{'model':_0x3516('0x7'),'as':_0x3516('0x8'),'attributes':['id',_0x3516('0x4'),_0x3516('0x9'),_0x3516('0xa')]}]},'log':_0x3516('0x1')});};}; \ No newline at end of file +var _0x6ed8=['strategy','User','Agents','online','../client','getWhatsappQueues','Request','GetWhatsappQueue'];(function(_0x38c317,_0x2f03df){var _0x1a1033=function(_0x20280f){while(--_0x20280f){_0x38c317['push'](_0x38c317['shift']());}};_0x1a1033(++_0x2f03df);}(_0x6ed8,0x13c));var _0x86ed=function(_0x21384d,_0xca16){_0x21384d=_0x21384d-0x0;var _0x118772=_0x6ed8[_0x21384d];return _0x118772;};'use strict';var client=require(_0x86ed('0x0'));exports[_0x86ed('0x1')]=function(){return function(){return client[_0x86ed('0x2')](_0x86ed('0x3'),{'options':{'raw':![],'attributes':['id','name','timeout',_0x86ed('0x4')],'include':[{'model':_0x86ed('0x5'),'as':_0x86ed('0x6'),'attributes':['id','name',_0x86ed('0x7'),'whatsappPause']}]},'log':_0x86ed('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 0c249c1..c7d6ea5 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 _0x6f34=['CreateWhatsappQueueReport','UpdateWhatsappQueueReport','DESC','../client','Request'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0x6f34,0x1ed));var _0x46f3=function(_0x219905,_0x11ef49){_0x219905=_0x219905-0x0;var _0x4bfe2d=_0x6f34[_0x219905];return _0x4bfe2d;};'use strict';var client=require(_0x46f3('0x0'));exports['create']=function(_0x17ca66){return client[_0x46f3('0x1')](_0x46f3('0x2'),{'body':_0x17ca66,'log':_0x46f3('0x2')});};exports['update']=function(_0x28cac8,_0x3a6a6a){return client['Request'](_0x46f3('0x3'),{'body':_0x3a6a6a,'options':{'where':{'uniqueid':_0x28cac8},'order':[['id',_0x46f3('0x4')]],'limit':0x1},'log':_0x46f3('0x3')});}; \ No newline at end of file +var _0x3234=['update','UpdateWhatsappQueueReport','DESC','../client','create','Request','CreateWhatsappQueueReport'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0x3234,0xff));var _0x4323=function(_0x134c2e,_0x1704d3){_0x134c2e=_0x134c2e-0x0;var _0x317bbe=_0x3234[_0x134c2e];return _0x317bbe;};'use strict';var client=require(_0x4323('0x0'));exports[_0x4323('0x1')]=function(_0x3eeed0){return client[_0x4323('0x2')](_0x4323('0x3'),{'body':_0x3eeed0,'log':'CreateWhatsappQueueReport'});};exports[_0x4323('0x4')]=function(_0x571828,_0x115f6e){return client[_0x4323('0x2')](_0x4323('0x5'),{'body':_0x115f6e,'options':{'where':{'uniqueid':_0x571828},'order':[['id',_0x4323('0x6')]],'limit':0x1},'log':_0x4323('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index 318dc1c..5ffc985 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 _0xbad4=['[%s][AGENT]\x20%s','map','message','join','stop','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','stack','validate','lodash','seq-queue','../../../../config/logger','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbad4,0x156));var _0x4bad=function(_0xe1190c,_0x3ded4c){_0xe1190c=_0xe1190c-0x0;var _0x5b15fa=_0xbad4[_0xe1190c];return _0x5b15fa;};'use strict';var schema=require(_0x4bad('0x0'));var _=require(_0x4bad('0x1'));var util=require('util');var seqqueue=require(_0x4bad('0x2'));var logger=require(_0x4bad('0x3'))(_0x4bad('0x4'));var strategy=require(_0x4bad('0x5'));var queue=schema({'name':{'type':_0x4bad('0x6'),'required':!![],'message':_0x4bad('0x7')},'timeout':{'type':_0x4bad('0x8'),'message':_0x4bad('0x9')}});function writeLog(_0x15ea4c,_0x49f3f7,_0x44834e){return logger[_0x4bad('0xa')](util[_0x4bad('0xb')](_0x4bad('0xc'),_0x15ea4c,_0x49f3f7[_0x4bad('0xd')],_0x44834e));}function handleFindAgent(_0x2411a5){return function(_0x19c648){return _0x19c648[_0x4bad('0xd')]['toLowerCase']()===_0x2411a5[_0x4bad('0xe')]();};}exports[_0x4bad('0xf')]=function(_0x4e4ec0,_0x31464e,_0x402706,_0x4604b0){return function(_0x587138){try{var _0x2d1fab={'name':_0x31464e[0x0],'timeout':_0x31464e[0x1]};var _0x29ecc5=queue[_0x4bad('0x0')](_0x2d1fab,{'typecast':!![]});if(_0x29ecc5[_0x4bad('0x10')]){logger[_0x4bad('0x11')](_0x4bad('0x12'),_0x4e4ec0,_[_0x4bad('0x13')](_0x29ecc5,_0x4bad('0x14'))[_0x4bad('0x15')](',\x20'));_0x587138[_0x4bad('0x16')]();}else{var _0x16bdc0=_['find'](_0x402706[_0x4bad('0x17')],handleFindAgent(_0x2d1fab[_0x4bad('0xd')]));if(_0x16bdc0){var _0x568f5d=(_0x2d1fab[_0x4bad('0x18')]||0xa)*0x3e8;var _0x5d28d6,_0x392027;var _0x307aa5=seqqueue[_0x4bad('0x19')](_0x568f5d);_0x307aa5['id']=_0x4e4ec0;_0x307aa5[_0x4bad('0x1a')]=_0x568f5d;_0x307aa5[_0x4bad('0x1b')]=_0x4604b0[_0x4bad('0x1b')];writeLog(_0x4e4ec0,_0x16bdc0,util[_0x4bad('0xb')](_0x4bad('0x1c'),_0x568f5d));_0x402706[_0x4bad('0x1d')][_0x4e4ec0]['on'](_0x4bad('0x1e'),function(){logger['info'](_0x4bad('0x1f'),_0x4e4ec0);clearTimeout(_0x392027);_0x392027=undefined;_0x307aa5[_0x4bad('0x20')]();if(_0x402706[_0x4bad('0x1d')][_0x4e4ec0]){delete _0x402706[_0x4bad('0x1d')][_0x4e4ec0];}_0x587138[_0x4bad('0x16')]();});_0x402706['rules'][_0x4e4ec0]['on'](_0x4bad('0x21'),function(){if(_0x402706[_0x4bad('0x1d')][_0x4e4ec0]){delete _0x402706[_0x4bad('0x1d')][_0x4e4ec0];}});_0x392027=setTimeout(function(){logger[_0x4bad('0xa')](_0x4bad('0x22'),_0x4e4ec0);clearTimeout(_0x392027);_0x307aa5[_0x4bad('0x20')]();_0x587138[_0x4bad('0x23')]();},_0x568f5d);strategy[_0x4bad('0x24')](_0x307aa5,_0x16bdc0,_0x402706,_0x4604b0);}else{logger[_0x4bad('0x11')](_0x4bad('0x25'),_0x4e4ec0,_0x2d1fab[_0x4bad('0xd')]);_0x587138['stop']();}}}catch(_0x261180){console[_0x4bad('0x26')](_0x261180);logger[_0x4bad('0x11')]('[%s][QUEUE]\x20%s',_0x4e4ec0,_0x261180[_0x4bad('0x27')]);_0x587138[_0x4bad('0x16')]();}};}; \ No newline at end of file +var _0x8a29=['timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','consequence','validate','length','[%s][AGENT]\x20%s','map','message','join','find','agents','createQueue','atimeout','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','stop','complete','[%s][AGENT]\x20ROUTING\x20END','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','error','[%s][QUEUE]\x20%s','stack','lodash','util','routing','./strategy','number'];(function(_0x35b18a,_0x6b2fbe){var _0x4db1bd=function(_0x389e62){while(--_0x389e62){_0x35b18a['push'](_0x35b18a['shift']());}};_0x4db1bd(++_0x6b2fbe);}(_0x8a29,0xfe));var _0x98a2=function(_0x3ff4c8,_0x2201f6){_0x3ff4c8=_0x3ff4c8-0x0;var _0x1fd97c=_0x8a29[_0x3ff4c8];return _0x1fd97c;};'use strict';var schema=require('validate');var _=require(_0x98a2('0x0'));var util=require(_0x98a2('0x1'));var seqqueue=require('seq-queue');var logger=require('../../../../config/logger')(_0x98a2('0x2'));var strategy=require(_0x98a2('0x3'));var queue=schema({'name':{'type':'string','required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x98a2('0x4'),'message':_0x98a2('0x5')}});function writeLog(_0x489781,_0x58a15d,_0x29579d){return logger[_0x98a2('0x6')](util[_0x98a2('0x7')](_0x98a2('0x8'),_0x489781,_0x58a15d[_0x98a2('0x9')],_0x29579d));}function handleFindAgent(_0x4c377e){return function(_0x98f1c7){return _0x98f1c7[_0x98a2('0x9')]['toLowerCase']()===_0x4c377e['toLowerCase']();};}exports[_0x98a2('0xa')]=function(_0x5da1ed,_0x3f4063,_0x27d207,_0x5a280a){return function(_0x552f50){try{var _0x5720b5={'name':_0x3f4063[0x0],'timeout':_0x3f4063[0x1]};var _0x3e15c0=queue[_0x98a2('0xb')](_0x5720b5,{'typecast':!![]});if(_0x3e15c0[_0x98a2('0xc')]){logger['error'](_0x98a2('0xd'),_0x5da1ed,_[_0x98a2('0xe')](_0x3e15c0,_0x98a2('0xf'))[_0x98a2('0x10')](',\x20'));_0x552f50['stop']();}else{var _0x8b9575=_[_0x98a2('0x11')](_0x27d207[_0x98a2('0x12')],handleFindAgent(_0x5720b5[_0x98a2('0x9')]));if(_0x8b9575){var _0x2576c8=(_0x5720b5['timeout']||0xa)*0x3e8;var _0x4161c7,_0x5afd8f;var _0x4c636e=seqqueue[_0x98a2('0x13')](_0x2576c8);_0x4c636e['id']=_0x5da1ed;_0x4c636e[_0x98a2('0x14')]=_0x2576c8;_0x4c636e[_0x98a2('0x15')]=_0x5a280a['channel'];writeLog(_0x5da1ed,_0x8b9575,util['format'](_0x98a2('0x16'),_0x2576c8));_0x27d207[_0x98a2('0x17')][_0x5da1ed]['on'](_0x98a2('0x18'),function(){logger[_0x98a2('0x6')](_0x98a2('0x19'),_0x5da1ed);clearTimeout(_0x5afd8f);_0x5afd8f=undefined;_0x4c636e[_0x98a2('0x1a')]();if(_0x27d207[_0x98a2('0x17')][_0x5da1ed]){delete _0x27d207[_0x98a2('0x17')][_0x5da1ed];}_0x552f50[_0x98a2('0x1b')]();});_0x27d207[_0x98a2('0x17')][_0x5da1ed]['on'](_0x98a2('0x1c'),function(){if(_0x27d207[_0x98a2('0x17')][_0x5da1ed]){delete _0x27d207[_0x98a2('0x17')][_0x5da1ed];}});_0x5afd8f=setTimeout(function(){logger[_0x98a2('0x6')](_0x98a2('0x1d'),_0x5da1ed);clearTimeout(_0x5afd8f);_0x4c636e['close']();_0x552f50[_0x98a2('0x1e')]();},_0x2576c8);strategy[_0x98a2('0x1f')](_0x4c636e,_0x8b9575,_0x27d207,_0x5a280a);}else{logger['error'](_0x98a2('0x20'),_0x5da1ed,_0x5720b5[_0x98a2('0x9')]);_0x552f50['stop']();}}}catch(_0x3ba28a){console[_0x98a2('0x21')](_0x3ba28a);logger[_0x98a2('0x22')](_0x98a2('0x23'),_0x5da1ed,_0x3ba28a[_0x98a2('0x24')]);_0x552f50[_0x98a2('0x1b')]();}};}; \ 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 807f05a..64b26c1 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 _0x5013=['routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','isNil','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','next','contact','format','out','channel','sms','whatsapp','phone','chat','account','upperFirst','AccountId','InteractionId','isEmpty','body','catch','error','stringify','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','toString','postText','amazonlex','providerResponse','Message','create','then','dialogState','aws-sdk','./utils','../../../../config/logger'];(function(_0x2091d2,_0x877116){var _0x1c0c31=function(_0x181d01){while(--_0x181d01){_0x2091d2['push'](_0x2091d2['shift']());}};_0x1c0c31(++_0x877116);}(_0x5013,0x13f));var _0x3501=function(_0xdd827a,_0x482ad2){_0xdd827a=_0xdd827a-0x0;var _0x2f46f1=_0x5013[_0xdd827a];return _0x2f46f1;};'use strict';var _=require('lodash');var moment=require('moment');var AWS=require(_0x3501('0x0'));var utils=require(_0x3501('0x1'));var logger=require(_0x3501('0x2'))(_0x3501('0x3'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x3501('0x4')),'mailMessage':require(_0x3501('0x5')),'smsMessage':require(_0x3501('0x6')),'faxMessage':require(_0x3501('0x7')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x3501('0x8')]=function(_0x428194,_0x12e80a){return function(_0x56b656){try{if(!_[_0x3501('0x9')](this[_0x3501('0xa')][_0x3501('0xb')])){logger[_0x3501('0xc')](_0x3501('0xd'),_0x428194,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x56b656[_0x3501('0xe')]();}var _0x4653d8={'ContactId':this[_0x3501('0xf')]['id'],'sentAt':moment()[_0x3501('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x3501('0x11')};if(this[_0x3501('0x12')]===_0x3501('0x13')||this[_0x3501('0x12')]===_0x3501('0x14')){_0x4653d8[_0x3501('0x15')]=this['interaction'][_0x3501('0x15')];}var _0x27481b=this[_0x3501('0x12')];if(_0x27481b===_0x3501('0x16')){_0x4653d8['ChatWebsiteId']=this[_0x3501('0x17')]['id'];}else{_0x4653d8[_[_0x3501('0x18')](_0x27481b)+_0x3501('0x19')]=this['account']['id'];}_0x4653d8[_[_0x3501('0x18')](_0x27481b)+_0x3501('0x1a')]=this[_0x3501('0xa')]['id'];if(this[_0x3501('0xa')]['created']){var _0x353584=_0x12e80a[0x4];if(!_[_0x3501('0x1b')](_0x353584)){_0x4653d8[_0x3501('0x1c')]=utils['getMustacheRender'](_0x353584,this);return rpc[_0x27481b+'Message']['create'](_0x4653d8)['then'](function(_0x174c0a){logger[_0x3501('0xc')](_0x3501('0xd'),_0x428194,_0x4653d8[_0x3501('0x1c')]);})[_0x3501('0x1d')](function(_0x33bac3){logger[_0x3501('0x1e')](_0x3501('0xd'),_0x428194,JSON[_0x3501('0x1f')](_0x33bac3));})['finally'](function(){logger[_0x3501('0xc')](_0x3501('0x20'),_0x428194);_0x56b656[_0x3501('0x21')]();});}else{logger[_0x3501('0xc')](_0x3501('0x22'),_0x428194);_0x56b656[_0x3501('0x21')]();}}else{var _0x23b3b0=this;var _0x167d2b=new AWS[(_0x3501('0x23'))]({'accessKeyId':_0x12e80a[0x0],'secretAccessKey':_0x12e80a[0x1],'region':_0x12e80a[0x2]});var _0x2a936b={'botAlias':_0x3501('0x24'),'botName':_0x12e80a[0x3],'inputText':this[_0x3501('0x25')][_0x3501('0x1c')],'userId':this[_0x3501('0x12')]+':'+this[_0x3501('0xa')]['id'][_0x3501('0x26')]()};_0x167d2b[_0x3501('0x27')](_0x2a936b,function(_0x162db0,_0x904477){if(_0x162db0){logger['error'](_0x3501('0xd'),_0x428194,_0x162db0[_0x3501('0x25')]);_0x56b656[_0x3501('0xe')]();}else if(_0x904477&&_0x904477[_0x3501('0x25')]){_0x23b3b0[_0x3501('0x1c')][_0x3501('0x28')]=_0x904477;_0x4653d8['body']=_0x904477['message'];_0x4653d8['providerName']=_0x3501('0x28');_0x4653d8[_0x3501('0x29')]=JSON[_0x3501('0x1f')](_0x904477);return rpc[_0x27481b+_0x3501('0x2a')][_0x3501('0x2b')](_0x4653d8)[_0x3501('0x2c')](function(_0xc43354){logger[_0x3501('0xc')]('[%s][AMAZONLEX]\x20%s',_0x428194,_0x4653d8[_0x3501('0x1c')]);if(_0x904477[_0x3501('0x2d')]=='Failed'){_0x56b656['next']();}else{_0x56b656[_0x3501('0x21')]();}})[_0x3501('0x1d')](function(_0x537305){logger[_0x3501('0x1e')](_0x3501('0xd'),_0x428194,JSON[_0x3501('0x1f')](_0x537305));_0x56b656[_0x3501('0xe')]();});}else{_0x56b656[_0x3501('0xe')]();}});}}catch(_0x10ef75){logger['error'](_0x3501('0xd'),_0x428194,JSON[_0x3501('0x1f')](_0x10ef75));_0x56b656[_0x3501('0x21')]();}};}; \ No newline at end of file +var _0x1fab=['isEmpty','body','getMustacheRender','Message','create','catch','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','toString','postText','amazonlex','providerName','providerResponse','dialogState','stop','lodash','aws-sdk','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','account','upperFirst','AccountId','InteractionId','created'];(function(_0x2c9c5d,_0x177f66){var _0x1caa4b=function(_0x49431d){while(--_0x49431d){_0x2c9c5d['push'](_0x2c9c5d['shift']());}};_0x1caa4b(++_0x177f66);}(_0x1fab,0x10a));var _0xb1fa=function(_0x3b654f,_0x3e3de6){_0x3b654f=_0x3b654f-0x0;var _0x341d81=_0x1fab[_0x3b654f];return _0x341d81;};'use strict';var _=require(_0xb1fa('0x0'));var moment=require('moment');var AWS=require(_0xb1fa('0x1'));var utils=require(_0xb1fa('0x2'));var logger=require('../../../../config/logger')('routing');var rpc={'chatMessage':require(_0xb1fa('0x3')),'openchannelMessage':require(_0xb1fa('0x4')),'mailMessage':require(_0xb1fa('0x5')),'smsMessage':require(_0xb1fa('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xb1fa('0x7'))};exports[_0xb1fa('0x8')]=function(_0x878334,_0x3cc04b){return function(_0x3fbec3){try{if(!_['isNil'](this[_0xb1fa('0x9')][_0xb1fa('0xa')])){logger[_0xb1fa('0xb')](_0xb1fa('0xc'),_0x878334,_0xb1fa('0xd'));return _0x3fbec3[_0xb1fa('0xe')]();}var _0x1c7b5f={'ContactId':this['contact']['id'],'sentAt':moment()[_0xb1fa('0xf')](_0xb1fa('0x10')),'direction':_0xb1fa('0x11')};if(this[_0xb1fa('0x12')]===_0xb1fa('0x13')||this[_0xb1fa('0x12')]===_0xb1fa('0x14')){_0x1c7b5f['phone']=this[_0xb1fa('0x9')][_0xb1fa('0x15')];}var _0x32d2c8=this[_0xb1fa('0x12')];if(_0x32d2c8===_0xb1fa('0x16')){_0x1c7b5f['ChatWebsiteId']=this[_0xb1fa('0x17')]['id'];}else{_0x1c7b5f[_[_0xb1fa('0x18')](_0x32d2c8)+_0xb1fa('0x19')]=this[_0xb1fa('0x17')]['id'];}_0x1c7b5f[_[_0xb1fa('0x18')](_0x32d2c8)+_0xb1fa('0x1a')]=this[_0xb1fa('0x9')]['id'];if(this['interaction'][_0xb1fa('0x1b')]){var _0x36f490=_0x3cc04b[0x4];if(!_[_0xb1fa('0x1c')](_0x36f490)){_0x1c7b5f[_0xb1fa('0x1d')]=utils[_0xb1fa('0x1e')](_0x36f490,this);return rpc[_0x32d2c8+_0xb1fa('0x1f')][_0xb1fa('0x20')](_0x1c7b5f)['then'](function(_0x2a10b5){logger[_0xb1fa('0xb')](_0xb1fa('0xc'),_0x878334,_0x1c7b5f[_0xb1fa('0x1d')]);})[_0xb1fa('0x21')](function(_0x3b5643){logger[_0xb1fa('0x22')](_0xb1fa('0xc'),_0x878334,JSON[_0xb1fa('0x23')](_0x3b5643));})[_0xb1fa('0x24')](function(){logger[_0xb1fa('0xb')](_0xb1fa('0x25'),_0x878334);_0x3fbec3['stop']();});}else{logger[_0xb1fa('0xb')](_0xb1fa('0x26'),_0x878334);_0x3fbec3['stop']();}}else{var _0x27e88d=this;var _0x476742=new AWS[(_0xb1fa('0x27'))]({'accessKeyId':_0x3cc04b[0x0],'secretAccessKey':_0x3cc04b[0x1],'region':_0x3cc04b[0x2]});var _0x419cf1={'botAlias':_0xb1fa('0x28'),'botName':_0x3cc04b[0x3],'inputText':this[_0xb1fa('0x29')][_0xb1fa('0x1d')],'userId':this['channel']+':'+this[_0xb1fa('0x9')]['id'][_0xb1fa('0x2a')]()};_0x476742[_0xb1fa('0x2b')](_0x419cf1,function(_0x66e2a9,_0x293cd1){if(_0x66e2a9){logger[_0xb1fa('0x22')](_0xb1fa('0xc'),_0x878334,_0x66e2a9[_0xb1fa('0x29')]);_0x3fbec3['next']();}else if(_0x293cd1&&_0x293cd1[_0xb1fa('0x29')]){_0x27e88d[_0xb1fa('0x1d')][_0xb1fa('0x2c')]=_0x293cd1;_0x1c7b5f[_0xb1fa('0x1d')]=_0x293cd1['message'];_0x1c7b5f[_0xb1fa('0x2d')]=_0xb1fa('0x2c');_0x1c7b5f[_0xb1fa('0x2e')]=JSON[_0xb1fa('0x23')](_0x293cd1);return rpc[_0x32d2c8+_0xb1fa('0x1f')]['create'](_0x1c7b5f)['then'](function(_0x4163fe){logger[_0xb1fa('0xb')](_0xb1fa('0xc'),_0x878334,_0x1c7b5f[_0xb1fa('0x1d')]);if(_0x293cd1[_0xb1fa('0x2f')]=='Failed'){_0x3fbec3[_0xb1fa('0xe')]();}else{_0x3fbec3['stop']();}})['catch'](function(_0xd63da3){logger[_0xb1fa('0x22')](_0xb1fa('0xc'),_0x878334,JSON[_0xb1fa('0x23')](_0xd63da3));_0x3fbec3[_0xb1fa('0xe')]();});}else{_0x3fbec3['next']();}});}}catch(_0x5c4a2f){logger[_0xb1fa('0x22')](_0xb1fa('0xc'),_0x878334,JSON[_0xb1fa('0x23')](_0x5c4a2f));_0x3fbec3[_0xb1fa('0x30')]();}};}; \ 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 d8bb860..12bb0a2 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 _0x8e05=['created','info','Autoreply\x20already\x20sent','next','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','YYYY-MM-DD\x20HH:mm:ss','out','mail','body','getMustacheRender','message','from','phone','read','subject','Re:','Re:\x20','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','Message','inReplyTo','messageId','','replace','','headers','auto-replied','All','auto_reply','sendMailMessage','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','stringify','[RPC][%s][AUTOREPLY]\x20%s','finally','then','update','catch','error','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','stop','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','channel','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','isNil','interaction'];(function(_0x5e96d3,_0x24c453){var _0x382c0b=function(_0x42df22){while(--_0x42df22){_0x5e96d3['push'](_0x5e96d3['shift']());}};_0x382c0b(++_0x24c453);}(_0x8e05,0x1ce));var _0x58e0=function(_0x320b8e,_0x1da3fe){_0x320b8e=_0x320b8e-0x0;var _0x55a10a=_0x8e05[_0x320b8e];return _0x55a10a;};'use strict';var _=require(_0x58e0('0x0'));var moment=require(_0x58e0('0x1'));var utils=require(_0x58e0('0x2'));var logger=require(_0x58e0('0x3'))(_0x58e0('0x4'));var rpc={'chatMessage':require(_0x58e0('0x5')),'openchannelMessage':require(_0x58e0('0x6')),'mailMessage':require(_0x58e0('0x7')),'smsMessage':require(_0x58e0('0x8')),'faxMessage':require(_0x58e0('0x9')),'whatsappMessage':require(_0x58e0('0xa')),'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x58e0('0xb')),'mailInteraction':require(_0x58e0('0xc')),'smsInteraction':require('../../rpc/smsInteraction'),'faxInteraction':require(_0x58e0('0xd')),'whatsappInteraction':require(_0x58e0('0xe'))};var mailRpc=require(_0x58e0('0xf'));exports['consequence']=function(_0x413a43,_0x48b07e,_0x157b99,_0x398ea9){return function(_0x56847d){try{var _0xc7c2a7=this[_0x58e0('0x10')];if(_0xc7c2a7==='mail'&&_0x398ea9['body']['isAutoreply']){logger['info'](_0x58e0('0x11'),_0x413a43,_0x58e0('0x12'));return _0x56847d['next']();}if(_0x48b07e[0x0]==='1'&&(_[_0x58e0('0x13')](this[_0x58e0('0x14')]['created'])||!this['interaction'][_0x58e0('0x15')])){logger[_0x58e0('0x16')](_0x58e0('0x11'),_0x413a43,_0x58e0('0x17'));return _0x56847d[_0x58e0('0x18')]();}if(_0x48b07e[0x0]==='2'&&this[_0x58e0('0x14')][_0x58e0('0x19')]){logger[_0x58e0('0x16')](_0x58e0('0x1a'),_0x413a43,_0x58e0('0x1b'));return _0x56847d[_0x58e0('0x18')]();}var _0x2ff751={'ContactId':this['contact']['id'],'sentAt':moment()['format'](_0x58e0('0x1c')),'direction':_0x58e0('0x1d')};if(this[_0x58e0('0x10')]===_0x58e0('0x1e')){_0x2ff751[_0x58e0('0x1f')]=utils[_0x58e0('0x20')](_0x48b07e[0x2],this);}else{_0x2ff751['body']=utils[_0x58e0('0x20')](_0x48b07e[0x1],this);}if(this['message']){_0x2ff751['to']=this[_0x58e0('0x21')][_0x58e0('0x22')]||'';if(this[_0x58e0('0x10')]===_0x58e0('0x1e')&&_0x48b07e[0x1]==='1'){_0x2ff751['cc']=this[_0x58e0('0x21')]['cc']||'';}_0x2ff751[_0x58e0('0x22')]=this[_0x58e0('0x21')]['to']||'';_0x2ff751['phone']=this[_0x58e0('0x21')][_0x58e0('0x23')]||'';_0x2ff751[_0x58e0('0x24')]=!![];if(this[_0x58e0('0x21')]['subject']){_0x2ff751['subject']='';_0x2ff751[_0x58e0('0x25')]+=_['startsWith'](this[_0x58e0('0x21')][_0x58e0('0x25')],_0x58e0('0x26'))?'':_0x58e0('0x27');_0x2ff751[_0x58e0('0x25')]+=this['message']['subject'];}}if(this['channel']===_0x58e0('0x28')){_0x2ff751[_0x58e0('0x29')]=this[_0x58e0('0x2a')]['id'];}else{_0x2ff751[_[_0x58e0('0x2b')](this['channel'])+_0x58e0('0x2c')]=this[_0x58e0('0x2a')]['id'];}_0x2ff751[_[_0x58e0('0x2b')](this[_0x58e0('0x10')])+_0x58e0('0x2d')]=this[_0x58e0('0x14')]['id'];var _0x21eef4=this[_0x58e0('0x14')];if(rpc[this[_0x58e0('0x10')]+_0x58e0('0x2e')]){if(this[_0x58e0('0x10')]===_0x58e0('0x1e')){_0x2ff751[_0x58e0('0x2f')]=this[_0x58e0('0x21')][_0x58e0('0x30')];_0x2ff751['html']=_0x58e0('0x31')+_[_0x58e0('0x32')](_0x2ff751[_0x58e0('0x1f')],'','','headers','auto-replied','All','auto_reply','sendMailMessage','smtpOptions','[%s][AUTOREPLY]\x20SMTP\x20SENT','Message','then','stringify','error','[RPC][%s][AUTOREPLY]\x20%s','finally','resolve','catch','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','Interaction','update','stop','lodash','../../../../config/logger','routing','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','channel','body','isAutoreply','info','[%s][AUTOREPLY]\x20%s','next','isNil','interaction','created','Autoreply\x20already\x20sent','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','out','getMustacheRender','message','from','phone','read','subject','startsWith','Re:','Re:\x20','chat','ChatWebsiteId','account','upperFirst','mail','inReplyTo'];(function(_0x2c7487,_0x1f59c6){var _0x27a602=function(_0x3a5626){while(--_0x3a5626){_0x2c7487['push'](_0x2c7487['shift']());}};_0x27a602(++_0x1f59c6);}(_0xfea2,0x15e));var _0x2fea=function(_0x5be869,_0x9b30d2){_0x5be869=_0x5be869-0x0;var _0x514548=_0xfea2[_0x5be869];return _0x514548;};'use strict';var _=require(_0x2fea('0x0'));var moment=require('moment');var utils=require('./utils');var logger=require(_0x2fea('0x1'))(_0x2fea('0x2'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x2fea('0x3')),'faxMessage':require(_0x2fea('0x4')),'whatsappMessage':require('../../rpc/whatsappMessage'),'chatInteraction':require(_0x2fea('0x5')),'openchannelInteraction':require(_0x2fea('0x6')),'mailInteraction':require(_0x2fea('0x7')),'smsInteraction':require(_0x2fea('0x8')),'faxInteraction':require(_0x2fea('0x9')),'whatsappInteraction':require(_0x2fea('0xa'))};var mailRpc=require('../../mailRpc');exports[_0x2fea('0xb')]=function(_0x2d2199,_0x4a5f4b,_0x5c90a8,_0x25b8b8){return function(_0x187802){try{var _0x1721cd=this[_0x2fea('0xc')];if(_0x1721cd==='mail'&&_0x25b8b8[_0x2fea('0xd')][_0x2fea('0xe')]){logger[_0x2fea('0xf')](_0x2fea('0x10'),_0x2d2199,'Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)');return _0x187802[_0x2fea('0x11')]();}if(_0x4a5f4b[0x0]==='1'&&(_[_0x2fea('0x12')](this[_0x2fea('0x13')][_0x2fea('0x14')])||!this[_0x2fea('0x13')][_0x2fea('0x14')])){logger['info']('[%s][AUTOREPLY]\x20%s',_0x2d2199,_0x2fea('0x15'));return _0x187802['next']();}if(_0x4a5f4b[0x0]==='2'&&this[_0x2fea('0x13')][_0x2fea('0x16')]){logger['info'](_0x2fea('0x17'),_0x2d2199,'One\x20Time\x20already\x20sent');return _0x187802[_0x2fea('0x11')]();}var _0x494ac5={'ContactId':this['contact']['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x2fea('0x18')};if(this[_0x2fea('0xc')]==='mail'){_0x494ac5[_0x2fea('0xd')]=utils[_0x2fea('0x19')](_0x4a5f4b[0x2],this);}else{_0x494ac5[_0x2fea('0xd')]=utils['getMustacheRender'](_0x4a5f4b[0x1],this);}if(this[_0x2fea('0x1a')]){_0x494ac5['to']=this[_0x2fea('0x1a')][_0x2fea('0x1b')]||'';if(this[_0x2fea('0xc')]==='mail'&&_0x4a5f4b[0x1]==='1'){_0x494ac5['cc']=this[_0x2fea('0x1a')]['cc']||'';}_0x494ac5[_0x2fea('0x1b')]=this[_0x2fea('0x1a')]['to']||'';_0x494ac5['phone']=this[_0x2fea('0x1a')][_0x2fea('0x1c')]||'';_0x494ac5[_0x2fea('0x1d')]=!![];if(this[_0x2fea('0x1a')][_0x2fea('0x1e')]){_0x494ac5['subject']='';_0x494ac5[_0x2fea('0x1e')]+=_[_0x2fea('0x1f')](this[_0x2fea('0x1a')][_0x2fea('0x1e')],_0x2fea('0x20'))?'':_0x2fea('0x21');_0x494ac5[_0x2fea('0x1e')]+=this[_0x2fea('0x1a')][_0x2fea('0x1e')];}}if(this[_0x2fea('0xc')]===_0x2fea('0x22')){_0x494ac5[_0x2fea('0x23')]=this[_0x2fea('0x24')]['id'];}else{_0x494ac5[_[_0x2fea('0x25')](this[_0x2fea('0xc')])+'AccountId']=this[_0x2fea('0x24')]['id'];}_0x494ac5[_[_0x2fea('0x25')](this[_0x2fea('0xc')])+'InteractionId']=this[_0x2fea('0x13')]['id'];var _0x4f5700=this[_0x2fea('0x13')];if(rpc[this[_0x2fea('0xc')]+'Message']){if(this[_0x2fea('0xc')]===_0x2fea('0x26')){_0x494ac5[_0x2fea('0x27')]=this[_0x2fea('0x1a')][_0x2fea('0x28')];_0x494ac5[_0x2fea('0x29')]=_0x2fea('0x2a')+_['replace'](_0x494ac5[_0x2fea('0xd')],_0x2fea('0x2b'),_0x2fea('0x2c'))+_0x2fea('0x2d');_0x494ac5[_0x2fea('0x2e')]={'Auto-Submitted':_0x2fea('0x2f'),'X-Auto-Response-Suppress':_0x2fea('0x30'),'Precedence':_0x2fea('0x31')};return mailRpc[_0x2fea('0x32')](this[_0x2fea('0x24')][_0x2fea('0x33')],_0x494ac5)['then'](function(_0x10e8b9){logger[_0x2fea('0xf')](_0x2fea('0x34'),_0x2d2199);_0x494ac5['messageId']=_0x10e8b9[_0x2fea('0x1a')][_0x2fea('0x28')];return rpc[_0x1721cd+_0x2fea('0x35')]['create'](_0x494ac5);})[_0x2fea('0x36')](function(_0x517389){logger['info'](_0x2fea('0x10'),_0x2d2199,JSON[_0x2fea('0x37')](_0x517389));})['catch'](function(_0x1b6bfb){logger[_0x2fea('0x38')](_0x2fea('0x39'),_0x2d2199,JSON[_0x2fea('0x37')](_0x1b6bfb));})[_0x2fea('0x3a')](function(){Promise[_0x2fea('0x3b')]()[_0x2fea('0x36')](function(){if(_0x4a5f4b[0x0]!=='2'||_0x4f5700[_0x2fea('0x16')])return;return rpc[_0x1721cd+'Interaction']['update'](_0x4f5700['id'],{'autoreplyExecuted':!![]})[_0x2fea('0x36')](function(_0x26d312){logger[_0x2fea('0xf')](_0x2fea('0x17'),_0x2d2199,JSON[_0x2fea('0x37')](_0x26d312));})[_0x2fea('0x3c')](function(_0xe4ec0f){logger[_0x2fea('0x38')](_0x2fea('0x3d'),_0x2d2199,JSON['stringify'](_0xe4ec0f));});})[_0x2fea('0x36')](function(){_0x187802[_0x2fea('0x11')]();});});}else{return rpc[this[_0x2fea('0xc')]+_0x2fea('0x35')]['create'](_0x494ac5)['then'](function(){logger['info'](_0x2fea('0x10'),_0x2d2199,_0x494ac5[_0x2fea('0xd')]);})['catch'](function(_0x5c8f5c){logger[_0x2fea('0x38')](_0x2fea('0x10'),_0x2d2199,JSON[_0x2fea('0x37')](_0x5c8f5c));})[_0x2fea('0x3a')](function(){Promise[_0x2fea('0x3b')]()['then'](function(){if(_0x4a5f4b[0x0]!=='2'||_0x4f5700[_0x2fea('0x16')])return;return rpc[_0x1721cd+_0x2fea('0x3e')][_0x2fea('0x3f')](_0x4f5700['id'],{'autoreplyExecuted':!![]})[_0x2fea('0x36')](function(_0x513eac){logger['info'](_0x2fea('0x17'),_0x2d2199,JSON[_0x2fea('0x37')](_0x513eac));})[_0x2fea('0x3c')](function(_0x22616b){logger[_0x2fea('0x38')](_0x2fea('0x3d'),_0x2d2199,JSON[_0x2fea('0x37')](_0x22616b));});})[_0x2fea('0x36')](function(){_0x187802[_0x2fea('0x11')]();});});}}}catch(_0x2d4558){logger[_0x2fea('0x38')]('[%s][AUTOREPLY]\x20%s',_0x2d2199,JSON['stringify'](_0x2d4558));_0x187802[_0x2fea('0x40')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/close.js b/server/services/routing/server/applications/close.js index e5ec560..bce8414 100644 --- a/server/services/routing/server/applications/close.js +++ b/server/services/routing/server/applications/close.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbca5=['[%s][CLOSE]\x20%s','finally','stop','stringify','moment','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','info','format','system','channel','update','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error'];(function(_0x35b7cf,_0x1e0489){var _0x488cd0=function(_0x51c561){while(--_0x51c561){_0x35b7cf['push'](_0x35b7cf['shift']());}};_0x488cd0(++_0x1e0489);}(_0xbca5,0xd3));var _0x5bca=function(_0xce9195,_0x1963e1){_0xce9195=_0xce9195-0x0;var _0x530fe6=_0xbca5[_0xce9195];return _0x530fe6;};'use strict';var moment=require(_0x5bca('0x0'));var logger=require(_0x5bca('0x1'))(_0x5bca('0x2'));var rpc={'chatInteraction':require(_0x5bca('0x3')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x5bca('0x4')),'mailInteraction':require(_0x5bca('0x5')),'faxInteraction':require(_0x5bca('0x6')),'whatsappInteraction':require(_0x5bca('0x7'))};exports[_0x5bca('0x8')]=function(_0xfcfbce,_0x3f7c0b,_0x24833f,_0x5d3940){return function(_0x4d1d97){try{logger[_0x5bca('0x9')]('[%s][CLOSE]\x20reason\x20%s',_0xfcfbce,_0x3f7c0b[0x0]);var _0x519737={'closed':0x1,'closedAt':moment()[_0x5bca('0xa')]('YYYY-MM-DD\x20HH:mm:ss'),'closeReason':_0x5bca('0xb'),'disposition':_0x3f7c0b[0x0]};if(rpc[_0x5d3940['channel']+'Interaction']){rpc[_0x5d3940[_0x5bca('0xc')]+'Interaction'][_0x5bca('0xd')](_0x5d3940[_0x5bca('0xe')]['id'],_0x519737)[_0x5bca('0xf')](function(_0x5bbe6c){logger[_0x5bca('0x9')](_0x5bca('0x10'),_0xfcfbce,_0x5d3940[_0x5bca('0xe')]['id']);})[_0x5bca('0x11')](function(_0x55b227){logger[_0x5bca('0x12')](_0x5bca('0x13'),_0xfcfbce,JSON['stringify'](_0x55b227));})[_0x5bca('0x14')](function(){_0x4d1d97[_0x5bca('0x15')]();});}}catch(_0xe2d9cd){logger['error']('[%s][CLOSE]\x20%s',_0xfcfbce,JSON[_0x5bca('0x16')](_0xe2d9cd));_0x4d1d97[_0x5bca('0x15')]();}};}; \ No newline at end of file +var _0x32ad=['interaction','catch','stringify','finally','stop','[%s][CLOSE]\x20%s','moment','../../../../config/logger','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','consequence','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','then','info'];(function(_0x3b9028,_0x57ac10){var _0x4106bd=function(_0x431d03){while(--_0x431d03){_0x3b9028['push'](_0x3b9028['shift']());}};_0x4106bd(++_0x57ac10);}(_0x32ad,0xba));var _0xd32a=function(_0x3c5797,_0x3b59e2){_0x3c5797=_0x3c5797-0x0;var _0x49798d=_0x32ad[_0x3c5797];return _0x49798d;};'use strict';var moment=require(_0xd32a('0x0'));var logger=require(_0xd32a('0x1'))('routing');var rpc={'chatInteraction':require(_0xd32a('0x2')),'openchannelInteraction':require(_0xd32a('0x3')),'smsInteraction':require(_0xd32a('0x4')),'mailInteraction':require(_0xd32a('0x5')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0xd32a('0x6'))};exports[_0xd32a('0x7')]=function(_0x427ef2,_0x598a42,_0x3cd3fc,_0x585a35){return function(_0x4d9d4a){try{logger['info']('[%s][CLOSE]\x20reason\x20%s',_0x427ef2,_0x598a42[0x0]);var _0x4e417a={'closed':0x1,'closedAt':moment()['format'](_0xd32a('0x8')),'closeReason':_0xd32a('0x9'),'disposition':_0x598a42[0x0]};if(rpc[_0x585a35[_0xd32a('0xa')]+'Interaction']){rpc[_0x585a35[_0xd32a('0xa')]+_0xd32a('0xb')]['update'](_0x585a35['interaction']['id'],_0x4e417a)[_0xd32a('0xc')](function(_0x11712b){logger[_0xd32a('0xd')]('[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!',_0x427ef2,_0x585a35[_0xd32a('0xe')]['id']);})[_0xd32a('0xf')](function(_0x2e50c2){logger['error']('[%s][CLOSE]\x20%s',_0x427ef2,JSON[_0xd32a('0x10')](_0x2e50c2));})[_0xd32a('0x11')](function(){_0x4d9d4a[_0xd32a('0x12')]();});}}catch(_0x1b4b01){logger['error'](_0xd32a('0x13'),_0x427ef2,JSON[_0xd32a('0x10')](_0x1b4b01));_0x4d9d4a[_0xd32a('0x12')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflow.js b/server/services/routing/server/applications/dialogflow.js index 220deb9..68913a9 100644 --- a/server/services/routing/server/applications/dialogflow.js +++ b/server/services/routing/server/applications/dialogflow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1b20=['finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','textRequest','message','dialogflow','result','fulfillment','speech','providerResponse','stringify','error','moment','apiai-promise','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','interaction','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','channel','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','isEmpty','body','Message','create','then','catch'];(function(_0x230942,_0x1c52e9){var _0x176bd8=function(_0x5b4f82){while(--_0x5b4f82){_0x230942['push'](_0x230942['shift']());}};_0x176bd8(++_0x1c52e9);}(_0x1b20,0x66));var _0x01b2=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x1b20[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require('lodash');var moment=require(_0x01b2('0x0'));var apiai=require(_0x01b2('0x1'));var md5=require('md5');var utils=require('./utils');var logger=require(_0x01b2('0x2'))(_0x01b2('0x3'));var rpc={'chatMessage':require(_0x01b2('0x4')),'openchannelMessage':require(_0x01b2('0x5')),'mailMessage':require(_0x01b2('0x6')),'smsMessage':require(_0x01b2('0x7')),'faxMessage':require(_0x01b2('0x8')),'whatsappMessage':require(_0x01b2('0x9'))};exports[_0x01b2('0xa')]=function(_0xa64ad1,_0x43d561){return function(_0x323470){try{if(!_['isNil'](this[_0x01b2('0xb')]['UserId'])){logger[_0x01b2('0xc')](_0x01b2('0xd'),_0xa64ad1,_0x01b2('0xe'));return _0x323470[_0x01b2('0xf')]();}var _0x9c411f={'ContactId':this[_0x01b2('0x10')]['id'],'sentAt':moment()[_0x01b2('0x11')](_0x01b2('0x12')),'direction':'out'};if(this[_0x01b2('0x13')]==='sms'||this[_0x01b2('0x13')]==='whatsapp'){_0x9c411f[_0x01b2('0x14')]=this[_0x01b2('0xb')][_0x01b2('0x14')];}var _0x5ed1e2=this['channel'];if(_0x5ed1e2===_0x01b2('0x15')){_0x9c411f[_0x01b2('0x16')]=this[_0x01b2('0x17')]['id'];}else{_0x9c411f[_[_0x01b2('0x18')](_0x5ed1e2)+_0x01b2('0x19')]=this['account']['id'];}_0x9c411f[_[_0x01b2('0x18')](_0x5ed1e2)+_0x01b2('0x1a')]=this[_0x01b2('0xb')]['id'];if(this[_0x01b2('0xb')]['created']){var _0x523b80=_0x43d561[0x2];if(!_[_0x01b2('0x1b')](_0x523b80)){_0x9c411f[_0x01b2('0x1c')]=utils['getMustacheRender'](_0x523b80,this);return rpc[_0x5ed1e2+_0x01b2('0x1d')][_0x01b2('0x1e')](_0x9c411f)[_0x01b2('0x1f')](function(_0x5986f5){logger[_0x01b2('0xc')](_0x01b2('0xd'),_0xa64ad1,_0x9c411f[_0x01b2('0x1c')]);})[_0x01b2('0x20')](function(_0x1391f5){logger['error'](_0x01b2('0xd'),_0xa64ad1,JSON['stringify'](_0x1391f5));})[_0x01b2('0x21')](function(){logger['info'](_0x01b2('0x22'),_0xa64ad1);_0x323470[_0x01b2('0x23')]();});}else{logger[_0x01b2('0xc')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0xa64ad1);_0x323470[_0x01b2('0x23')]();}}else{var _0x2f01b0=this;var _0xc3027=apiai(_0x43d561[0x0],{'language':_0x43d561[0x1]||'en'});return _0xc3027[_0x01b2('0x24')](this[_0x01b2('0x25')]['body'],{'sessionId':md5(this[_0x01b2('0xb')]['id'])})['then'](function(_0x54e866){_0x2f01b0[_0x01b2('0x1c')][_0x01b2('0x26')]=_0x54e866;_0x9c411f[_0x01b2('0x1c')]=_0x54e866[_0x01b2('0x27')][_0x01b2('0x28')][_0x01b2('0x29')];_0x9c411f['providerName']=_0x01b2('0x26');_0x9c411f[_0x01b2('0x2a')]=JSON[_0x01b2('0x2b')](_0x54e866);return rpc[_0x5ed1e2+_0x01b2('0x1d')]['create'](_0x9c411f)[_0x01b2('0x1f')](function(_0x586814){logger[_0x01b2('0xc')](_0x01b2('0xd'),_0xa64ad1,_0x9c411f['body']);if(_0x54e866[_0x01b2('0x27')]['metadata']['endConversation']){_0x323470[_0x01b2('0xf')]();}else{_0x323470[_0x01b2('0x23')]();}})['catch'](function(_0x24ed7d){logger[_0x01b2('0x2c')](_0x01b2('0xd'),_0xa64ad1,JSON[_0x01b2('0x2b')](_0x24ed7d));_0x323470[_0x01b2('0xf')]();});})[_0x01b2('0x20')](function(_0xd60b46){logger[_0x01b2('0x2c')](_0x01b2('0xd'),_0xa64ad1,_0xd60b46[_0x01b2('0x25')]);_0x323470[_0x01b2('0xf')]();});}}catch(_0x5e6981){logger[_0x01b2('0x2c')](_0x01b2('0xd'),_0xa64ad1,JSON[_0x01b2('0x2b')](_0x5e6981));_0x323470[_0x01b2('0x23')]();}};}; \ No newline at end of file +var _0xdb8b=['body','getMustacheRender','Message','[%s][DIALOGFLOW]\x20%s','catch','error','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','then','result','speech','providerName','providerResponse','create','endConversation','moment','apiai-promise','md5','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','isNil','interaction','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created'];(function(_0x1bc5b2,_0x59473c){var _0x3d0a0d=function(_0x2566c6){while(--_0x2566c6){_0x1bc5b2['push'](_0x1bc5b2['shift']());}};_0x3d0a0d(++_0x59473c);}(_0xdb8b,0x1c4));var _0xbdb8=function(_0x12601c,_0x1b34fe){_0x12601c=_0x12601c-0x0;var _0x218547=_0xdb8b[_0x12601c];return _0x218547;};'use strict';var _=require('lodash');var moment=require(_0xbdb8('0x0'));var apiai=require(_0xbdb8('0x1'));var md5=require(_0xbdb8('0x2'));var utils=require('./utils');var logger=require('../../../../config/logger')(_0xbdb8('0x3'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xbdb8('0x4')),'mailMessage':require(_0xbdb8('0x5')),'smsMessage':require(_0xbdb8('0x6')),'faxMessage':require(_0xbdb8('0x7')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0xbdb8('0x8')]=function(_0x482c12,_0x387bb4){return function(_0x2f2825){try{if(!_[_0xbdb8('0x9')](this[_0xbdb8('0xa')][_0xbdb8('0xb')])){logger[_0xbdb8('0xc')]('[%s][DIALOGFLOW]\x20%s',_0x482c12,_0xbdb8('0xd'));return _0x2f2825[_0xbdb8('0xe')]();}var _0x3cc8d1={'ContactId':this[_0xbdb8('0xf')]['id'],'sentAt':moment()[_0xbdb8('0x10')](_0xbdb8('0x11')),'direction':_0xbdb8('0x12')};if(this['channel']==='sms'||this[_0xbdb8('0x13')]==='whatsapp'){_0x3cc8d1[_0xbdb8('0x14')]=this['interaction'][_0xbdb8('0x14')];}var _0x568205=this[_0xbdb8('0x13')];if(_0x568205===_0xbdb8('0x15')){_0x3cc8d1[_0xbdb8('0x16')]=this[_0xbdb8('0x17')]['id'];}else{_0x3cc8d1[_[_0xbdb8('0x18')](_0x568205)+_0xbdb8('0x19')]=this[_0xbdb8('0x17')]['id'];}_0x3cc8d1[_[_0xbdb8('0x18')](_0x568205)+_0xbdb8('0x1a')]=this[_0xbdb8('0xa')]['id'];if(this[_0xbdb8('0xa')][_0xbdb8('0x1b')]){var _0x29b2f7=_0x387bb4[0x2];if(!_['isEmpty'](_0x29b2f7)){_0x3cc8d1[_0xbdb8('0x1c')]=utils[_0xbdb8('0x1d')](_0x29b2f7,this);return rpc[_0x568205+_0xbdb8('0x1e')]['create'](_0x3cc8d1)['then'](function(_0x133800){logger['info'](_0xbdb8('0x1f'),_0x482c12,_0x3cc8d1[_0xbdb8('0x1c')]);})[_0xbdb8('0x20')](function(_0x442393){logger[_0xbdb8('0x21')](_0xbdb8('0x1f'),_0x482c12,JSON[_0xbdb8('0x22')](_0x442393));})[_0xbdb8('0x23')](function(){logger[_0xbdb8('0xc')](_0xbdb8('0x24'),_0x482c12);_0x2f2825[_0xbdb8('0x25')]();});}else{logger[_0xbdb8('0xc')](_0xbdb8('0x26'),_0x482c12);_0x2f2825[_0xbdb8('0x25')]();}}else{var _0x2074e0=this;var _0x3588ee=apiai(_0x387bb4[0x0],{'language':_0x387bb4[0x1]||'en'});return _0x3588ee[_0xbdb8('0x27')](this[_0xbdb8('0x28')][_0xbdb8('0x1c')],{'sessionId':md5(this[_0xbdb8('0xa')]['id'])})[_0xbdb8('0x29')](function(_0x50c6db){_0x2074e0[_0xbdb8('0x1c')]['dialogflow']=_0x50c6db;_0x3cc8d1[_0xbdb8('0x1c')]=_0x50c6db[_0xbdb8('0x2a')]['fulfillment'][_0xbdb8('0x2b')];_0x3cc8d1[_0xbdb8('0x2c')]='dialogflow';_0x3cc8d1[_0xbdb8('0x2d')]=JSON[_0xbdb8('0x22')](_0x50c6db);return rpc[_0x568205+_0xbdb8('0x1e')][_0xbdb8('0x2e')](_0x3cc8d1)[_0xbdb8('0x29')](function(_0x2fe157){logger[_0xbdb8('0xc')]('[%s][DIALOGFLOW]\x20%s',_0x482c12,_0x3cc8d1[_0xbdb8('0x1c')]);if(_0x50c6db['result']['metadata'][_0xbdb8('0x2f')]){_0x2f2825[_0xbdb8('0xe')]();}else{_0x2f2825[_0xbdb8('0x25')]();}})[_0xbdb8('0x20')](function(_0x4bc79c){logger[_0xbdb8('0x21')](_0xbdb8('0x1f'),_0x482c12,JSON[_0xbdb8('0x22')](_0x4bc79c));_0x2f2825[_0xbdb8('0xe')]();});})['catch'](function(_0x422f80){logger[_0xbdb8('0x21')](_0xbdb8('0x1f'),_0x482c12,_0x422f80[_0xbdb8('0x28')]);_0x2f2825[_0xbdb8('0xe')]();});}}catch(_0x4584d0){logger[_0xbdb8('0x21')]('[%s][DIALOGFLOW]\x20%s',_0x482c12,JSON[_0xbdb8('0x22')](_0x4584d0));_0x2f2825[_0xbdb8('0x25')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflowV2.js b/server/services/routing/server/applications/dialogflowV2.js index 0d656db..a17a93e 100644 --- a/server/services/routing/server/applications/dialogflowV2.js +++ b/server/services/routing/server/applications/dialogflowV2.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8d83=['fulfillmentText','push','stop','stack','lodash','dialogflow','md5','../../../../config/logger','routing','./utils','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','body','Message','create','then','[%s][DIALOGFLOWV2]\x20%s','catch','stringify','interaction','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','getMustacheRender','error','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','SessionsClient','message','length','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','intent','name','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName'];(function(_0x4644e6,_0x38d859){var _0x40dbd2=function(_0x3c2d65){while(--_0x3c2d65){_0x4644e6['push'](_0x4644e6['shift']());}};_0x40dbd2(++_0x38d859);}(_0x8d83,0xdf));var _0x38d8=function(_0x24546d,_0x35fc04){_0x24546d=_0x24546d-0x0;var _0x3993aa=_0x8d83[_0x24546d];return _0x3993aa;};'use strict';var _=require(_0x38d8('0x0'));var dialogflow=require(_0x38d8('0x1'));var md5=require(_0x38d8('0x2'));var moment=require('moment');var Promise=require('bluebird');var logger=require(_0x38d8('0x3'))(_0x38d8('0x4'));var utils=require(_0x38d8('0x5'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x38d8('0x6')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x38d8('0x7')),'faxMessage':require(_0x38d8('0x8')),'whatsappMessage':require(_0x38d8('0x9'))};function createMessage(_0xc88663,_0x11e683,_0x5c2291,_0x194753){return new Promise(function(_0x5a14d5,_0xc0a8f0){var _0x5f126d=_[_0x38d8('0xa')](_0x5c2291);_0x5f126d[_0x38d8('0xb')]=_0x194753;return rpc[_0x11e683+_0x38d8('0xc')][_0x38d8('0xd')](_0x5f126d)[_0x38d8('0xe')](function(){logger['info'](_0x38d8('0xf'),_0xc88663,_0x5f126d[_0x38d8('0xb')]);_0x5a14d5();})[_0x38d8('0x10')](function(_0x4e9f41){logger['error'](_0x38d8('0xf'),_0xc88663,JSON[_0x38d8('0x11')](_0x4e9f41));_0xc0a8f0(_0x4e9f41);});});}exports['consequence']=function(_0x2e6526,_0x39ab2f){return function(_0x3396ea){try{if(!_['isNil'](this[_0x38d8('0x12')][_0x38d8('0x13')])){logger[_0x38d8('0x14')](_0x38d8('0xf'),_0x2e6526,_0x38d8('0x15'));return _0x3396ea[_0x38d8('0x16')]();}var _0x5120c4={'ContactId':this[_0x38d8('0x17')]['id'],'sentAt':moment()['format'](_0x38d8('0x18')),'direction':_0x38d8('0x19')};if(this[_0x38d8('0x1a')]===_0x38d8('0x1b')||this[_0x38d8('0x1a')]===_0x38d8('0x1c')){_0x5120c4['phone']=this['interaction'][_0x38d8('0x1d')];}var _0x309c20=this['channel'];if(_0x309c20===_0x38d8('0x1e')){_0x5120c4[_0x38d8('0x1f')]=this[_0x38d8('0x20')]['id'];}else{_0x5120c4[_[_0x38d8('0x21')](_0x309c20)+_0x38d8('0x22')]=this[_0x38d8('0x20')]['id'];}_0x5120c4[_[_0x38d8('0x21')](_0x309c20)+_0x38d8('0x23')]=this[_0x38d8('0x12')]['id'];if(this[_0x38d8('0x12')][_0x38d8('0x24')]){var _0x30f58f=_0x39ab2f[0x4];if(!_[_0x38d8('0x25')](_0x30f58f)){_0x5120c4[_0x38d8('0xb')]=utils[_0x38d8('0x26')](_0x30f58f,this);return rpc[_0x309c20+_0x38d8('0xc')][_0x38d8('0xd')](_0x5120c4)[_0x38d8('0xe')](function(_0x3da03f){logger[_0x38d8('0x14')](_0x38d8('0xf'),_0x2e6526,_0x5120c4[_0x38d8('0xb')]);})['catch'](function(_0x29c0c2){logger[_0x38d8('0x27')](_0x38d8('0xf'),_0x2e6526,JSON[_0x38d8('0x11')](_0x29c0c2));})[_0x38d8('0x28')](function(){logger[_0x38d8('0x14')](_0x38d8('0x29'),_0x2e6526);_0x3396ea['stop']();});}else{logger[_0x38d8('0x14')](_0x38d8('0x2a'),_0x2e6526);_0x3396ea['stop']();}}else{var _0x429860=this;var _0x2ee535=_0x39ab2f[0x2]['replace'](/\\n/g,'\x0a');var _0x51f65c={'credentials':{'private_key':_0x2ee535,'client_email':_0x39ab2f[0x1]}};var _0x5b04af=new dialogflow[(_0x38d8('0x2b'))](_0x51f65c);var _0xd2c5a6=_0x5b04af['sessionPath'](_0x39ab2f[0x0],md5(_0x429860['interaction']['id']));var _0x4b9ebe={'session':_0xd2c5a6,'queryInput':{'text':{'text':_0x429860[_0x38d8('0x2c')][_0x38d8('0xb')],'languageCode':_0x39ab2f[0x3]||'en'}}};return _0x5b04af['detectIntent'](_0x4b9ebe)[_0x38d8('0xe')](function(_0x4b309f){if(_0x4b309f&&_0x4b309f[_0x38d8('0x2d')]){_0x429860['body'][_0x38d8('0x2e')]=_0x4b309f;var _0x3f2c2e=_0x4b309f[0x0];var _0x38d3be=_0x3f2c2e[_0x38d8('0x2f')][_0x38d8('0x30')]&&_0x3f2c2e['queryResult'][_0x38d8('0x30')][_0x38d8('0x31')]?_0x3f2c2e[_0x38d8('0x2f')][_0x38d8('0x30')][_0x38d8('0x31')][_0x38d8('0x32')][_0x38d8('0x33')]:![];_0x429860['body'][_0x38d8('0x34')]=_0x3f2c2e['queryResult'][_0x38d8('0x35')];_0x429860['body'][_0x38d8('0x36')]=_0x3f2c2e[_0x38d8('0x2f')][_0x38d8('0x37')];_0x429860[_0x38d8('0xb')][_0x38d8('0x38')]=_0x3f2c2e[_0x38d8('0x2f')]['diagnosticInfo']&&_0x3f2c2e['queryResult'][_0x38d8('0x30')]['fields']?_0x3f2c2e['queryResult'][_0x38d8('0x30')]['fields'][_0x38d8('0x32')]['boolValue']:![];_0x429860[_0x38d8('0xb')]['DIALOGFLOWV2_INTENTNAME']=_0x3f2c2e[_0x38d8('0x2f')][_0x38d8('0x39')][_0x38d8('0x3a')];_0x429860['body']['DIALOGFLOWV2_INTENTDISPLAYNAME']=_0x3f2c2e[_0x38d8('0x2f')][_0x38d8('0x39')][_0x38d8('0x3b')];_0x429860[_0x38d8('0xb')][_0x38d8('0x3c')]=_0x3f2c2e['queryResult'][_0x38d8('0x39')][_0x38d8('0x3d')];_0x429860[_0x38d8('0xb')][_0x38d8('0x3e')]=_0x3f2c2e[_0x38d8('0x2f')][_0x38d8('0x3f')];_0x429860[_0x38d8('0xb')][_0x38d8('0x40')]=_0x3f2c2e[_0x38d8('0x2f')][_0x38d8('0x41')];_0x429860[_0x38d8('0xb')][_0x38d8('0x42')]=_0x3f2c2e[_0x38d8('0x2f')][_0x38d8('0x43')];_0x5120c4[_0x38d8('0x44')]=_0x38d8('0x2e');_0x5120c4['providerResponse']=JSON['stringify'](_0x4b309f);var _0x3f653e=[];for(var _0x193a0a=0x0;_0x193a0a<_0x4b309f['length'];_0x193a0a++){var _0x227a13=_0x4b309f[_0x193a0a];if(_0x227a13&&_0x227a13[_0x38d8('0x2f')]&&_0x227a13[_0x38d8('0x2f')][_0x38d8('0x45')]){_0x3f653e[_0x38d8('0x46')](createMessage(_0x2e6526,_0x309c20,_0x5120c4,_0x227a13[_0x38d8('0x2f')][_0x38d8('0x45')]));}}return Promise['all'](_0x3f653e)[_0x38d8('0xe')](function(){if(_0x38d3be){_0x3396ea[_0x38d8('0x16')]();}else{_0x3396ea[_0x38d8('0x47')]();}})['catch'](function(_0x2ec64e){logger[_0x38d8('0x27')](_0x38d8('0xf'),_0x2e6526,JSON[_0x38d8('0x11')](_0x2ec64e));_0x3396ea['next']();});}})['catch'](function(_0x5425c4){logger[_0x38d8('0x27')](_0x38d8('0xf'),_0x2e6526,_0x5425c4['message'],_0x5425c4[_0x38d8('0x48')]);_0x3396ea[_0x38d8('0x16')]();});}}catch(_0x1919d7){logger[_0x38d8('0x27')](_0x38d8('0xf'),_0x2e6526,JSON[_0x38d8('0x11')](_0x1919d7));_0x3396ea['stop']();}};}; \ No newline at end of file +var _0x191d=['displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','providerName','push','fulfillmentText','all','next','stack','lodash','dialogflow','md5','moment','bluebird','../../../../config/logger','routing','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','body','Message','create','then','[%s][DIALOGFLOWV2]\x20%s','catch','stringify','isNil','interaction','UserId','info','contact','format','out','channel','sms','whatsapp','phone','ChatWebsiteId','upperFirst','AccountId','account','created','isEmpty','error','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','replace','sessionPath','message','detectIntent','length','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','DIALOGFLOWV2_INTENTNAME','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME'];(function(_0x5ad5d0,_0x4f8716){var _0x3bed91=function(_0x133f0a){while(--_0x133f0a){_0x5ad5d0['push'](_0x5ad5d0['shift']());}};_0x3bed91(++_0x4f8716);}(_0x191d,0x1d5));var _0xd191=function(_0x32ef1d,_0x3543b9){_0x32ef1d=_0x32ef1d-0x0;var _0x3989e4=_0x191d[_0x32ef1d];return _0x3989e4;};'use strict';var _=require(_0xd191('0x0'));var dialogflow=require(_0xd191('0x1'));var md5=require(_0xd191('0x2'));var moment=require(_0xd191('0x3'));var Promise=require(_0xd191('0x4'));var logger=require(_0xd191('0x5'))(_0xd191('0x6'));var utils=require(_0xd191('0x7'));var rpc={'chatMessage':require(_0xd191('0x8')),'openchannelMessage':require(_0xd191('0x9')),'mailMessage':require(_0xd191('0xa')),'smsMessage':require(_0xd191('0xb')),'faxMessage':require(_0xd191('0xc')),'whatsappMessage':require(_0xd191('0xd'))};function createMessage(_0x12b20e,_0x373ae0,_0x5212f8,_0x4a279a){return new Promise(function(_0x188e11,_0x4484ce){var _0x4e79bd=_['clone'](_0x5212f8);_0x4e79bd[_0xd191('0xe')]=_0x4a279a;return rpc[_0x373ae0+_0xd191('0xf')][_0xd191('0x10')](_0x4e79bd)[_0xd191('0x11')](function(){logger['info'](_0xd191('0x12'),_0x12b20e,_0x4e79bd[_0xd191('0xe')]);_0x188e11();})[_0xd191('0x13')](function(_0x50af1a){logger['error'](_0xd191('0x12'),_0x12b20e,JSON[_0xd191('0x14')](_0x50af1a));_0x4484ce(_0x50af1a);});});}exports['consequence']=function(_0x5ddbf6,_0x228133){return function(_0x18a91b){try{if(!_[_0xd191('0x15')](this[_0xd191('0x16')][_0xd191('0x17')])){logger[_0xd191('0x18')](_0xd191('0x12'),_0x5ddbf6,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x18a91b['next']();}var _0x2dc30b={'ContactId':this[_0xd191('0x19')]['id'],'sentAt':moment()[_0xd191('0x1a')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xd191('0x1b')};if(this[_0xd191('0x1c')]===_0xd191('0x1d')||this[_0xd191('0x1c')]===_0xd191('0x1e')){_0x2dc30b[_0xd191('0x1f')]=this[_0xd191('0x16')]['phone'];}var _0x225eb2=this[_0xd191('0x1c')];if(_0x225eb2==='chat'){_0x2dc30b[_0xd191('0x20')]=this['account']['id'];}else{_0x2dc30b[_[_0xd191('0x21')](_0x225eb2)+_0xd191('0x22')]=this[_0xd191('0x23')]['id'];}_0x2dc30b[_[_0xd191('0x21')](_0x225eb2)+'InteractionId']=this['interaction']['id'];if(this[_0xd191('0x16')][_0xd191('0x24')]){var _0x1ebd6c=_0x228133[0x4];if(!_[_0xd191('0x25')](_0x1ebd6c)){_0x2dc30b['body']=utils['getMustacheRender'](_0x1ebd6c,this);return rpc[_0x225eb2+'Message']['create'](_0x2dc30b)['then'](function(_0x15d6be){logger[_0xd191('0x18')](_0xd191('0x12'),_0x5ddbf6,_0x2dc30b[_0xd191('0xe')]);})[_0xd191('0x13')](function(_0x31fc1d){logger[_0xd191('0x26')]('[%s][DIALOGFLOWV2]\x20%s',_0x5ddbf6,JSON[_0xd191('0x14')](_0x31fc1d));})[_0xd191('0x27')](function(){logger[_0xd191('0x18')](_0xd191('0x28'),_0x5ddbf6);_0x18a91b['stop']();});}else{logger['info'](_0xd191('0x29'),_0x5ddbf6);_0x18a91b[_0xd191('0x2a')]();}}else{var _0xfc512b=this;var _0xc37f40=_0x228133[0x2][_0xd191('0x2b')](/\\n/g,'\x0a');var _0x52e544={'credentials':{'private_key':_0xc37f40,'client_email':_0x228133[0x1]}};var _0xe1628d=new dialogflow['SessionsClient'](_0x52e544);var _0x101f6a=_0xe1628d[_0xd191('0x2c')](_0x228133[0x0],md5(_0xfc512b['interaction']['id']));var _0x4f0dac={'session':_0x101f6a,'queryInput':{'text':{'text':_0xfc512b[_0xd191('0x2d')][_0xd191('0xe')],'languageCode':_0x228133[0x3]||'en'}}};return _0xe1628d[_0xd191('0x2e')](_0x4f0dac)[_0xd191('0x11')](function(_0x12f3a4){if(_0x12f3a4&&_0x12f3a4[_0xd191('0x2f')]){_0xfc512b[_0xd191('0xe')][_0xd191('0x30')]=_0x12f3a4;var _0x2372ee=_0x12f3a4[0x0];var _0x5bb8b8=_0x2372ee[_0xd191('0x31')][_0xd191('0x32')]&&_0x2372ee[_0xd191('0x31')][_0xd191('0x32')][_0xd191('0x33')]?_0x2372ee[_0xd191('0x31')][_0xd191('0x32')][_0xd191('0x33')][_0xd191('0x34')][_0xd191('0x35')]:![];_0xfc512b[_0xd191('0xe')][_0xd191('0x36')]=_0x2372ee[_0xd191('0x31')][_0xd191('0x37')];_0xfc512b[_0xd191('0xe')][_0xd191('0x38')]=_0x2372ee['queryResult'][_0xd191('0x39')];_0xfc512b['body'][_0xd191('0x3a')]=_0x2372ee[_0xd191('0x31')][_0xd191('0x32')]&&_0x2372ee['queryResult'][_0xd191('0x32')][_0xd191('0x33')]?_0x2372ee[_0xd191('0x31')]['diagnosticInfo'][_0xd191('0x33')][_0xd191('0x34')][_0xd191('0x35')]:![];_0xfc512b[_0xd191('0xe')][_0xd191('0x3b')]=_0x2372ee[_0xd191('0x31')][_0xd191('0x3c')][_0xd191('0x3d')];_0xfc512b['body'][_0xd191('0x3e')]=_0x2372ee[_0xd191('0x31')]['intent'][_0xd191('0x3f')];_0xfc512b[_0xd191('0xe')][_0xd191('0x40')]=_0x2372ee[_0xd191('0x31')][_0xd191('0x3c')][_0xd191('0x41')];_0xfc512b['body'][_0xd191('0x42')]=_0x2372ee[_0xd191('0x31')][_0xd191('0x43')];_0xfc512b[_0xd191('0xe')][_0xd191('0x44')]=_0x2372ee[_0xd191('0x31')][_0xd191('0x45')];_0xfc512b[_0xd191('0xe')]['DIALOGFLOWV2_SCORE']=_0x2372ee[_0xd191('0x31')]['intentDetectionConfidence'];_0x2dc30b[_0xd191('0x46')]=_0xd191('0x30');_0x2dc30b['providerResponse']=JSON[_0xd191('0x14')](_0x12f3a4);var _0x39eda7=[];for(var _0x370d1a=0x0;_0x370d1a<_0x12f3a4[_0xd191('0x2f')];_0x370d1a++){var _0x14af7b=_0x12f3a4[_0x370d1a];if(_0x14af7b&&_0x14af7b[_0xd191('0x31')]&&_0x14af7b[_0xd191('0x31')]['fulfillmentText']){_0x39eda7[_0xd191('0x47')](createMessage(_0x5ddbf6,_0x225eb2,_0x2dc30b,_0x14af7b[_0xd191('0x31')][_0xd191('0x48')]));}}return Promise[_0xd191('0x49')](_0x39eda7)[_0xd191('0x11')](function(){if(_0x5bb8b8){_0x18a91b[_0xd191('0x4a')]();}else{_0x18a91b[_0xd191('0x2a')]();}})[_0xd191('0x13')](function(_0x189a34){logger['error'](_0xd191('0x12'),_0x5ddbf6,JSON[_0xd191('0x14')](_0x189a34));_0x18a91b['next']();});}})['catch'](function(_0x505667){logger[_0xd191('0x26')](_0xd191('0x12'),_0x5ddbf6,_0x505667[_0xd191('0x2d')],_0x505667[_0xd191('0x4b')]);_0x18a91b[_0xd191('0x4a')]();});}}catch(_0x2ec6d1){logger[_0xd191('0x26')](_0xd191('0x12'),_0x5ddbf6,JSON['stringify'](_0x2ec6d1));_0x18a91b[_0xd191('0x2a')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotoif.js b/server/services/routing/server/applications/gotoif.js index 8b14f1e..6619c71 100644 --- a/server/services/routing/server/applications/gotoif.js +++ b/server/services/routing/server/applications/gotoif.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x45a9=['[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','condition','findIndex','next','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','stop','error','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','validate','lodash','html-to-text','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','[%s][GOTOIF]\x20%s','map','message','join','priorityTrue','priorityFalse','info'];(function(_0x9db9e,_0x4a52b0){var _0x12af4a=function(_0x17e8e4){while(--_0x17e8e4){_0x9db9e['push'](_0x9db9e['shift']());}};_0x12af4a(++_0x4a52b0);}(_0x45a9,0x1bc));var _0x945a=function(_0x248d9b,_0x7dab63){_0x248d9b=_0x248d9b-0x0;var _0x548610=_0x45a9[_0x248d9b];return _0x548610;};'use strict';var schema=require(_0x945a('0x0'));var _=require(_0x945a('0x1'));var htmlToText=require(_0x945a('0x2'));var utils=require('./utils');var logger=require(_0x945a('0x3'))(_0x945a('0x4'));var gotoif=schema({'condition':{'type':_0x945a('0x5'),'required':!![],'message':_0x945a('0x6')},'priorityTrue':{'type':_0x945a('0x7'),'message':_0x945a('0x8')},'priorityFalse':{'type':_0x945a('0x7'),'message':_0x945a('0x9')}});exports[_0x945a('0xa')]=function(_0xac5684,_0xa86c1d){return function(_0x19601c){try{var _0x2438cf={'condition':htmlToText[_0x945a('0xb')](utils[_0x945a('0xc')](_0xa86c1d[0x0],this),{'wordwrap':![]})['replace'](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0xa86c1d[0x1],'priorityFalse':_0xa86c1d[0x2]};var _0x290809=gotoif['validate'](_0x2438cf,{'typecast':!![]});if(_0x290809['length']){logger['error'](_0x945a('0xd'),_0xac5684,_[_0x945a('0xe')](_0x290809,_0x945a('0xf'))[_0x945a('0x10')](',\x20'));_0x19601c['stop']();}else{try{var _0x16260c=eval('('+_0x2438cf['condition']+')');var _0x833627=_0x16260c?_0x2438cf[_0x945a('0x11')]:_0x2438cf[_0x945a('0x12')];logger[_0x945a('0x13')](_0x945a('0x14'),_0xac5684,_0x2438cf[_0x945a('0x15')],_0x16260c,_0x833627||'next');if(_0x833627){var _0x5000f4=_[_0x945a('0x16')](_0x19601c['rules'](),{'p':_0x833627});if(_0x5000f4>=0x0){logger['info']('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0xac5684,_0x833627||_0x945a('0x17'),_0x5000f4);_0x19601c[_0x945a('0x17')](_0x5000f4);}else{logger[_0x945a('0x13')](_0x945a('0x18'),_0xac5684,_0x833627||_0x945a('0x17'));_0x19601c[_0x945a('0x19')]();}}else{_0x19601c['next']();}}catch(_0x17d847){logger[_0x945a('0x1a')](_0x945a('0x1b'),_0xac5684,_0x17d847[_0x945a('0xf')]);_0x19601c['stop']();}}}catch(_0x1864ef){logger[_0x945a('0x1a')](_0x945a('0xd'),_0xac5684,JSON[_0x945a('0x1c')](_0x1864ef));_0x19601c[_0x945a('0x19')]();}};}; \ No newline at end of file +var _0x5e33=['[%s][GOTOIF]\x20eval\x20error:\x20%s','error','validate','lodash','html-to-text','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','consequence','fromString','getMustacheRender','replace','length','[%s][GOTOIF]\x20%s','message','condition','priorityTrue','priorityFalse','info','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','stop'];(function(_0x529c86,_0x2b7759){var _0x1f8789=function(_0x3ba1d8){while(--_0x3ba1d8){_0x529c86['push'](_0x529c86['shift']());}};_0x1f8789(++_0x2b7759);}(_0x5e33,0x120));var _0x35e3=function(_0x49bdf9,_0x3ba69d){_0x49bdf9=_0x49bdf9-0x0;var _0x58574c=_0x5e33[_0x49bdf9];return _0x58574c;};'use strict';var schema=require(_0x35e3('0x0'));var _=require(_0x35e3('0x1'));var htmlToText=require(_0x35e3('0x2'));var utils=require('./utils');var logger=require('../../../../config/logger')(_0x35e3('0x3'));var gotoif=schema({'condition':{'type':_0x35e3('0x4'),'required':!![],'message':_0x35e3('0x5')},'priorityTrue':{'type':_0x35e3('0x6'),'message':_0x35e3('0x7')},'priorityFalse':{'type':_0x35e3('0x6'),'message':'priority\x20false\x20is\x20a\x20number'}});exports[_0x35e3('0x8')]=function(_0x12f13e,_0xdc2f01){return function(_0x125373){try{var _0x33a279={'condition':htmlToText[_0x35e3('0x9')](utils[_0x35e3('0xa')](_0xdc2f01[0x0],this),{'wordwrap':![]})[_0x35e3('0xb')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0xdc2f01[0x1],'priorityFalse':_0xdc2f01[0x2]};var _0x487b3a=gotoif[_0x35e3('0x0')](_0x33a279,{'typecast':!![]});if(_0x487b3a[_0x35e3('0xc')]){logger['error'](_0x35e3('0xd'),_0x12f13e,_['map'](_0x487b3a,_0x35e3('0xe'))['join'](',\x20'));_0x125373['stop']();}else{try{var _0x1a4133=eval('('+_0x33a279[_0x35e3('0xf')]+')');var _0x4ab0e0=_0x1a4133?_0x33a279[_0x35e3('0x10')]:_0x33a279[_0x35e3('0x11')];logger[_0x35e3('0x12')]('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x12f13e,_0x33a279[_0x35e3('0xf')],_0x1a4133,_0x4ab0e0||_0x35e3('0x13'));if(_0x4ab0e0){var _0x302690=_[_0x35e3('0x14')](_0x125373[_0x35e3('0x15')](),{'p':_0x4ab0e0});if(_0x302690>=0x0){logger[_0x35e3('0x12')]('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x12f13e,_0x4ab0e0||_0x35e3('0x13'),_0x302690);_0x125373[_0x35e3('0x13')](_0x302690);}else{logger[_0x35e3('0x12')](_0x35e3('0x16'),_0x12f13e,_0x4ab0e0||_0x35e3('0x13'));_0x125373[_0x35e3('0x17')]();}}else{_0x125373[_0x35e3('0x13')]();}}catch(_0x5a1992){logger['error'](_0x35e3('0x18'),_0x12f13e,_0x5a1992[_0x35e3('0xe')]);_0x125373[_0x35e3('0x17')]();}}}catch(_0x3956f5){logger[_0x35e3('0x19')]('[%s][GOTOIF]\x20%s',_0x12f13e,JSON['stringify'](_0x3956f5));_0x125373['stop']();}};}; \ 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 2095dbe..77232d1 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 _0xe506=['[%s][GOTOP]\x20%s','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','stringify','validate','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error'];(function(_0x1a22e9,_0x5a2229){var _0x5dafe9=function(_0x5b560f){while(--_0x5b560f){_0x1a22e9['push'](_0x1a22e9['shift']());}};_0x5dafe9(++_0x5a2229);}(_0xe506,0x76));var _0x6e50=function(_0x144c0c,_0x113cfe){_0x144c0c=_0x144c0c-0x0;var _0x436221=_0xe506[_0x144c0c];return _0x436221;};'use strict';var schema=require(_0x6e50('0x0'));var _=require('lodash');var logger=require(_0x6e50('0x1'))(_0x6e50('0x2'));var gotop=schema({'priority':{'type':_0x6e50('0x3'),'required':!![],'message':_0x6e50('0x4')}});exports[_0x6e50('0x5')]=function(_0x259fcc,_0x142d96){return function(_0x513dfe){try{var _0x45f9bf={'priority':_0x142d96[0x0]};var _0xfd3c78=gotop[_0x6e50('0x0')](_0x45f9bf,{'typecast':!![]});if(_0xfd3c78[_0x6e50('0x6')]){logger[_0x6e50('0x7')](_0x6e50('0x8'),_0x259fcc,_['map'](_0xfd3c78,'message')[_0x6e50('0x9')](',\x20'));_0x513dfe[_0x6e50('0xa')]();}else{logger[_0x6e50('0xb')](_0x6e50('0xc'),_0x259fcc,_0x45f9bf[_0x6e50('0xd')]);if(_0x45f9bf[_0x6e50('0xd')]){var _0x270af7=_['findIndex'](_0x513dfe[_0x6e50('0xe')](),{'p':_0x45f9bf['priority']});if(_0x270af7>=0x0){logger[_0x6e50('0xb')](_0x6e50('0xf'),_0x259fcc,_0x45f9bf[_0x6e50('0xd')]||_0x6e50('0x10'),_0x270af7);_0x513dfe[_0x6e50('0x10')](_0x270af7);}else{logger[_0x6e50('0xb')]('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x259fcc,_0x45f9bf[_0x6e50('0xd')]||_0x6e50('0x10'));_0x513dfe[_0x6e50('0xa')]();}}else{_0x513dfe[_0x6e50('0x10')]();}}}catch(_0x3782de){logger[_0x6e50('0x7')](_0x6e50('0x8'),_0x259fcc,JSON[_0x6e50('0x11')](_0x3782de));_0x513dfe[_0x6e50('0xa')]();}};}; \ No newline at end of file +var _0x7068=['priority','rules','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','next','stringify','stop','validate','lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','length','error','[%s][GOTOP]\x20%s','map','info','[%s][GOTOP]\x20priority\x20%s'];(function(_0x3a58f2,_0x514900){var _0x4d7d6b=function(_0xf51391){while(--_0xf51391){_0x3a58f2['push'](_0x3a58f2['shift']());}};_0x4d7d6b(++_0x514900);}(_0x7068,0x126));var _0x8706=function(_0x9dfc10,_0x19c2d5){_0x9dfc10=_0x9dfc10-0x0;var _0x4f938a=_0x7068[_0x9dfc10];return _0x4f938a;};'use strict';var schema=require(_0x8706('0x0'));var _=require(_0x8706('0x1'));var logger=require(_0x8706('0x2'))(_0x8706('0x3'));var gotop=schema({'priority':{'type':_0x8706('0x4'),'required':!![],'message':_0x8706('0x5')}});exports['consequence']=function(_0x4ee96c,_0x1522b9){return function(_0xdbfc90){try{var _0x55e728={'priority':_0x1522b9[0x0]};var _0x4cef86=gotop['validate'](_0x55e728,{'typecast':!![]});if(_0x4cef86[_0x8706('0x6')]){logger[_0x8706('0x7')](_0x8706('0x8'),_0x4ee96c,_[_0x8706('0x9')](_0x4cef86,'message')['join'](',\x20'));_0xdbfc90['stop']();}else{logger[_0x8706('0xa')](_0x8706('0xb'),_0x4ee96c,_0x55e728[_0x8706('0xc')]);if(_0x55e728[_0x8706('0xc')]){var _0x1f3ca7=_['findIndex'](_0xdbfc90[_0x8706('0xd')](),{'p':_0x55e728[_0x8706('0xc')]});if(_0x1f3ca7>=0x0){logger[_0x8706('0xa')]('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x4ee96c,_0x55e728[_0x8706('0xc')]||'next',_0x1f3ca7);_0xdbfc90['next'](_0x1f3ca7);}else{logger[_0x8706('0xa')](_0x8706('0xe'),_0x4ee96c,_0x55e728['priority']||_0x8706('0xf'));_0xdbfc90['stop']();}}else{_0xdbfc90['next']();}}}catch(_0xb7556e){logger['error'](_0x8706('0x8'),_0x4ee96c,JSON[_0x8706('0x10')](_0xb7556e));_0xdbfc90[_0x8706('0x11')]();}};}; \ 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 b466a6b..f01f80c 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 _0xd96a=['../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/whatsappMessage','contact','channel','chat','ChatWebsiteId','upperFirst','account','InteractionId','Message','then','info','body','next','catch','stringify','error','[%s][MESSAGE]\x20%s','stop','../../../../config/logger','routing'];(function(_0x2f589d,_0x4cad6e){var _0xb98730=function(_0x422848){while(--_0x422848){_0x2f589d['push'](_0x2f589d['shift']());}};_0xb98730(++_0x4cad6e);}(_0xd96a,0x15e));var _0xad96=function(_0x15282a,_0xa2a200){_0x15282a=_0x15282a-0x0;var _0x14c940=_0xd96a[_0x15282a];return _0x14c940;};'use strict';var _=require('lodash');var utils=require('./utils');var logger=require(_0xad96('0x0'))(_0xad96('0x1'));var rpc={'chatMessage':require(_0xad96('0x2')),'openchannelMessage':require(_0xad96('0x3')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xad96('0x4'))};exports['consequence']=function(_0x2ac4ab,_0x3560d8){return function(_0x3faf15){try{var _0x163084={'body':utils['getMustacheRender'](_0x3560d8[0x0],this),'ContactId':this[_0xad96('0x5')]['id']};if(this[_0xad96('0x6')]===_0xad96('0x7')){_0x163084[_0xad96('0x8')]=this['account']['id'];}else{_0x163084[_[_0xad96('0x9')](this[_0xad96('0x6')])+'AccountId']=this[_0xad96('0xa')]['id'];}_0x163084[_[_0xad96('0x9')](this[_0xad96('0x6')])+_0xad96('0xb')]=this['interaction']['id'];if(rpc[this[_0xad96('0x6')]+_0xad96('0xc')]){return rpc[this[_0xad96('0x6')]+'Message']['create'](_0x163084)[_0xad96('0xd')](function(_0x5cbfaa){logger[_0xad96('0xe')]('[%s][MESSAGE]\x20%s',_0x2ac4ab,_0x163084[_0xad96('0xf')]);_0x3faf15[_0xad96('0x10')]();})[_0xad96('0x11')](function(_0x3aa9c6){logger['error']('[%s][MESSAGE]\x20%s',_0x2ac4ab,JSON[_0xad96('0x12')](_0x3aa9c6));_0x3faf15['stop']();});}}catch(_0x1a60f5){logger[_0xad96('0x13')](_0xad96('0x14'),_0x2ac4ab,JSON[_0xad96('0x12')](_0x1a60f5));_0x3faf15[_0xad96('0x15')]();}};}; \ No newline at end of file +var _0x135b=['upperFirst','AccountId','InteractionId','interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','next','error','stringify','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','channel','ChatWebsiteId','account'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x135b,0xaf));var _0xb135=function(_0x2869f8,_0x9756fb){_0x2869f8=_0x2869f8-0x0;var _0x2a9fe6=_0x135b[_0x2869f8];return _0x2a9fe6;};'use strict';var _=require(_0xb135('0x0'));var utils=require(_0xb135('0x1'));var logger=require(_0xb135('0x2'))(_0xb135('0x3'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xb135('0x4')),'mailMessage':require(_0xb135('0x5')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xb135('0x6')),'whatsappMessage':require(_0xb135('0x7'))};exports[_0xb135('0x8')]=function(_0x54483a,_0x51a09c){return function(_0x5b96fe){try{var _0x11780d={'body':utils[_0xb135('0x9')](_0x51a09c[0x0],this),'ContactId':this[_0xb135('0xa')]['id']};if(this[_0xb135('0xb')]==='chat'){_0x11780d[_0xb135('0xc')]=this[_0xb135('0xd')]['id'];}else{_0x11780d[_[_0xb135('0xe')](this[_0xb135('0xb')])+_0xb135('0xf')]=this[_0xb135('0xd')]['id'];}_0x11780d[_[_0xb135('0xe')](this[_0xb135('0xb')])+_0xb135('0x10')]=this[_0xb135('0x11')]['id'];if(rpc[this[_0xb135('0xb')]+_0xb135('0x12')]){return rpc[this[_0xb135('0xb')]+_0xb135('0x12')][_0xb135('0x13')](_0x11780d)[_0xb135('0x14')](function(_0x13b157){logger[_0xb135('0x15')](_0xb135('0x16'),_0x54483a,_0x11780d['body']);_0x5b96fe[_0xb135('0x17')]();})['catch'](function(_0x10770e){logger[_0xb135('0x18')](_0xb135('0x16'),_0x54483a,JSON[_0xb135('0x19')](_0x10770e));_0x5b96fe[_0xb135('0x1a')]();});}}catch(_0x28b9d3){logger[_0xb135('0x18')](_0xb135('0x16'),_0x54483a,JSON[_0xb135('0x19')](_0x28b9d3));_0x5b96fe['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/noop.js b/server/services/routing/server/applications/noop.js index a40afdf..f75ba22 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 _0x5a0a=['next','error','[%s][NOOP]\x20%s','stop','routing','consequence','info','getMustacheRender'];(function(_0x4c6d6f,_0x291557){var _0x2d4478=function(_0x106946){while(--_0x106946){_0x4c6d6f['push'](_0x4c6d6f['shift']());}};_0x2d4478(++_0x291557);}(_0x5a0a,0x19c));var _0xa5a0=function(_0x23de6f,_0xb26d78){_0x23de6f=_0x23de6f-0x0;var _0x433be2=_0x5a0a[_0x23de6f];return _0x433be2;};'use strict';var utils=require('./utils');var logger=require('../../../../config/logger')(_0xa5a0('0x0'));exports[_0xa5a0('0x1')]=function(_0x134568,_0x4df377){return function(_0x10e003){try{logger[_0xa5a0('0x2')]('[%s][NOOP]\x20%s',_0x134568,utils[_0xa5a0('0x3')](_0x4df377[0x0],this));_0x10e003[_0xa5a0('0x4')]();}catch(_0x37d616){logger[_0xa5a0('0x5')](_0xa5a0('0x6'),_0x134568,JSON['stringify'](_0x37d616));_0x10e003[_0xa5a0('0x7')]();}};}; \ No newline at end of file +var _0x4f59=['../../../../config/logger','routing','consequence','info','[%s][NOOP]\x20%s','getMustacheRender','next','error','stop','./utils'];(function(_0x377009,_0x16c4a5){var _0x35edc4=function(_0xf1adab){while(--_0xf1adab){_0x377009['push'](_0x377009['shift']());}};_0x35edc4(++_0x16c4a5);}(_0x4f59,0x81));var _0x94f5=function(_0x47623f,_0x148f3a){_0x47623f=_0x47623f-0x0;var _0x282ce8=_0x4f59[_0x47623f];return _0x282ce8;};'use strict';var utils=require(_0x94f5('0x0'));var logger=require(_0x94f5('0x1'))(_0x94f5('0x2'));exports[_0x94f5('0x3')]=function(_0x29055b,_0x2d2dfb){return function(_0x4a08ea){try{logger[_0x94f5('0x4')](_0x94f5('0x5'),_0x29055b,utils[_0x94f5('0x6')](_0x2d2dfb[0x0],this));_0x4a08ea[_0x94f5('0x7')]();}catch(_0x3af999){logger[_0x94f5('0x8')]('[%s][NOOP]\x20%s',_0x29055b,JSON['stringify'](_0x3af999));_0x4a08ea[_0x94f5('0x9')]();}};}; \ 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 0026593..196e269 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 _0x2947=['map','join','stop','find','Queues','createQueue','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','validate','lodash','util','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','defaults','redis','localhost','socket.io-emitter','queue_id','queue','from','joinAt','emit','clone','account','push','capitalize','format','pick','%sQueuesWaitingInteractions','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','../../rpc/chatInteraction','../../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','contact','list','channel','QueueId','InteractionId','interaction','upperFirst','message','chat','AccountId','WebsiteId','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','create\x20queue\x20report','YYYY-MM-DD\x20HH:mm:ss','accepted','info','[%s][STOP:QUEUE][NAME:%s]','Interaction','update','then','update\x20queue\x20report','timeout','toLowerCase','consequence','length','[%s][QUEUE]\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2947,0x1e0));var _0x7294=function(_0xe840f2,_0x5b4543){_0xe840f2=_0xe840f2-0x0;var _0xfc0581=_0x2947[_0xe840f2];return _0xfc0581;};'use strict';var schema=require(_0x7294('0x0'));var _=require(_0x7294('0x1'));var util=require(_0x7294('0x2'));var seqqueue=require(_0x7294('0x3'));var moment=require(_0x7294('0x4'));var Redis=require(_0x7294('0x5'));var config=require(_0x7294('0x6'));var logger=require(_0x7294('0x7'))(_0x7294('0x8'));var strategy=require(_0x7294('0x9'));config['redis']=_[_0x7294('0xa')](config[_0x7294('0xb')],{'host':_0x7294('0xc'),'port':0x18eb});var io=require(_0x7294('0xd'))(new Redis(config[_0x7294('0xb')]));var attributes=['id',_0x7294('0xe'),'account',_0x7294('0xf'),_0x7294('0x10'),_0x7294('0x11')];function emit(_0x2488cb,_0x1f3702,_0x5501b4){io['to'](_0x2488cb)[_0x7294('0x12')](_0x1f3702,_0x5501b4);}function emitChannelQueueInteraction(_0x4f91e2,_0x59dbc8,_0x1ed626,_0x577da5,_0xce0e99,_0x206c69,_0x14ad80,_0x32a956){var _0x4ce9a3=_[_0x7294('0x13')](_0x1ed626);_0x4ce9a3[_0x7294('0xe')]=_0x32a956;_0x4ce9a3[_0x7294('0xf')]=_0x59dbc8;_0x4ce9a3[_0x7294('0x14')]=_0x577da5;_0x4ce9a3['id']=_0xce0e99;if(_0x206c69){attributes[_0x7294('0x15')](_[_0x7294('0x16')](_0x4f91e2)+'InteractionId');_0x14ad80[util[_0x7294('0x17')]('%sQueuesWaitingInteractions',_0x4f91e2)][_0xce0e99]=_[_0x7294('0x18')](_0x4ce9a3,attributes);}else{delete _0x14ad80[util[_0x7294('0x17')](_0x7294('0x19'),_0x4f91e2)][_0xce0e99];}emit(util[_0x7294('0x17')]('%s:queue:%s',_0x4f91e2,_0x59dbc8),util[_0x7294('0x17')](_0x7294('0x1a'),_0x4f91e2,_0x206c69?_0x7294('0x1b'):_0x7294('0x1c')),_[_0x7294('0x18')](_0x4ce9a3,attributes));}var rpc={'openchannelQueueReport':require(_0x7294('0x1d')),'mailQueueReport':require(_0x7294('0x1e')),'chatQueueReport':require(_0x7294('0x1f')),'smsQueueReport':require(_0x7294('0x20')),'faxQueueReport':require(_0x7294('0x21')),'whatsappQueueReport':require(_0x7294('0x22')),'chatInteraction':require(_0x7294('0x23')),'faxInteraction':require(_0x7294('0x24')),'mailInteraction':require(_0x7294('0x25')),'openchannelInteraction':require(_0x7294('0x26')),'smsInteraction':require(_0x7294('0x27')),'whatsappInteraction':require(_0x7294('0x28'))};var queue=schema({'name':{'type':_0x7294('0x29'),'required':!![],'message':_0x7294('0x2a')},'timeout':{'type':_0x7294('0x2b'),'message':_0x7294('0x2c')}});function startRouting(_0x127c74,_0x510ff3,_0xe5d7e6,_0x25d6ff){if(_0x127c74&&_0x510ff3&&_0xe5d7e6){_0x510ff3[_0x7294('0x2d')]+=0x1;var _0x46fa69={'uniqueid':_0x127c74,'from':_0xe5d7e6['body']?_0xe5d7e6[_0x7294('0x2e')]['from']:'','joinAt':moment()[_0x7294('0x17')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0xe5d7e6[_0x7294('0x2f')]?_0xe5d7e6[_0x7294('0x2f')]['id']:null,'ListId':_0xe5d7e6[_0x7294('0x30')]?_0xe5d7e6[_0x7294('0x30')]['id']:null};_0x46fa69[_['upperFirst'](_0xe5d7e6[_0x7294('0x31')])+_0x7294('0x32')]=_0x510ff3['id']||null;_0x46fa69[_['upperFirst'](_0xe5d7e6['channel'])+_0x7294('0x33')]=_0xe5d7e6[_0x7294('0x34')]?_0xe5d7e6[_0x7294('0x34')]['id']:null;_0x46fa69[_[_0x7294('0x35')](_0xe5d7e6[_0x7294('0x31')])+'MessageId']=_0xe5d7e6['message']?_0xe5d7e6[_0x7294('0x36')]['id']:null;_0x46fa69[_['upperFirst'](_0xe5d7e6['channel'])+(_0xe5d7e6[_0x7294('0x31')]!==_0x7294('0x37')?_0x7294('0x38'):_0x7294('0x39'))]=_0xe5d7e6[_0x7294('0x14')]?_0xe5d7e6['account']['id']:null;logger['info'](util[_0x7294('0x17')](_0x7294('0x3a'),_0x127c74,_0x510ff3['name']));emitChannelQueueInteraction(_0xe5d7e6[_0x7294('0x31')],_0x510ff3[_0x7294('0x3b')],_0x46fa69,_0xe5d7e6[_0x7294('0x14')][_0x7294('0x3b')],_0xe5d7e6[_0x7294('0x36')]['id'],!![],_0x25d6ff,_0x510ff3['id']);if(rpc[_0xe5d7e6[_0x7294('0x31')]+_0x7294('0x3c')]){return rpc[_0xe5d7e6[_0x7294('0x31')]+_0x7294('0x3c')][_0x7294('0x3d')](_0x46fa69)[_0x7294('0x3e')](function(_0x3c836b){logger[_0x7294('0x3f')](_0x7294('0x40'),_0x3c836b);});}}}function stopRouting(_0x5d2d01,_0x20e317,_0x143a4b,_0x4141af){if(_0x5d2d01&&_0x20e317){_0x20e317[_0x7294('0x2d')]-=0x1;var _0x69bf3={'leaveAt':moment()[_0x7294('0x17')](_0x7294('0x41')),'acceptAt':moment()[_0x7294('0x17')](_0x7294('0x41')),'reason':_0x7294('0x42')};logger[_0x7294('0x43')](util[_0x7294('0x17')](_0x7294('0x44'),_0x5d2d01,_0x20e317[_0x7294('0x3b')]));emitChannelQueueInteraction(_0x143a4b['channel'],_0x20e317['name'],_0x143a4b[_0x7294('0x2e')],_0x143a4b[_0x7294('0x14')][_0x7294('0x3b')],_0x143a4b['message']['id'],![],_0x4141af,_0x20e317['id']);return rpc[_0x143a4b[_0x7294('0x31')]+_0x7294('0x45')][_0x7294('0x46')](_0x143a4b[_0x7294('0x34')]['id'],{'queueId':_0x20e317['id']})[_0x7294('0x47')](function(){if(rpc[_0x143a4b[_0x7294('0x31')]+'QueueReport']){return rpc[_0x143a4b[_0x7294('0x31')]+'QueueReport']['update'](_0x5d2d01,_0x69bf3)[_0x7294('0x3e')](function(_0x230005){logger['error'](_0x7294('0x48'),_0x230005);});}});}}function endRouting(_0x1600d8,_0x589361,_0x5aba39,_0x2f0ee5){if(_0x1600d8&&_0x589361){_0x589361[_0x7294('0x2d')]-=0x1;var _0x3c29e6={'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()[_0x7294('0x17')](_0x7294('0x41')),'reason':_0x7294('0x49')};logger[_0x7294('0x43')](util[_0x7294('0x17')]('[%s][END:QUEUE][NAME:%s]',_0x1600d8,_0x589361[_0x7294('0x3b')]));emitChannelQueueInteraction(_0x5aba39['channel'],_0x589361['name'],_0x5aba39[_0x7294('0x2e')],_0x5aba39['account'][_0x7294('0x3b')],_0x5aba39['message']['id'],![],_0x2f0ee5);if(rpc[_0x5aba39[_0x7294('0x31')]+_0x7294('0x3c')]){return rpc[_0x5aba39[_0x7294('0x31')]+_0x7294('0x3c')][_0x7294('0x46')](_0x1600d8,_0x3c29e6)[_0x7294('0x3e')](function(_0x3592e8){logger[_0x7294('0x3f')]('update\x20queue\x20report',_0x3592e8);});}}}function handleFindQueue(_0x3994ff){return function(_0x2d0a2d){return _0x2d0a2d['name']['toLowerCase']()===_0x3994ff[_0x7294('0x4a')]();};}exports[_0x7294('0x4b')]=function(_0x1aae15,_0x95a0fb,_0x2638ed,_0x18586d){return function(_0x311f76){try{var _0x1ddd6e={'name':_0x95a0fb[0x0],'timeout':_0x95a0fb[0x1]};var _0x269ba4=queue['validate'](_0x1ddd6e,{'typecast':!![]});if(_0x269ba4[_0x7294('0x4c')]){logger['error'](_0x7294('0x4d'),_0x1aae15,_[_0x7294('0x4e')](_0x269ba4,_0x7294('0x36'))[_0x7294('0x4f')](',\x20'));_0x311f76[_0x7294('0x50')]();}else{var _0x385c30=_[_0x7294('0x51')](_0x2638ed[_0x18586d[_0x7294('0x31')]+_0x7294('0x52')],handleFindQueue(_0x1ddd6e[_0x7294('0x3b')]));if(_0x385c30){startRouting(_0x1aae15,_0x385c30,_0x18586d,_0x2638ed);var _0x579b0d=(_0x385c30[_0x7294('0x49')]||0xa)*0x3e8;var _0x3c4ea0=(_0x1ddd6e[_0x7294('0x49')]||0x14)*0x3e8;var _0x384e0c;if(_0x579b0d>_0x3c4ea0){_0x3c4ea0=_0x579b0d;}var _0x1c3f0f=seqqueue[_0x7294('0x53')](_0x579b0d);_0x1c3f0f['id']=_0x1aae15;_0x1c3f0f['atimeout']=_0x579b0d;_0x1c3f0f[_0x7294('0x54')]=_0x3c4ea0;_0x1c3f0f[_0x7294('0x31')]=_0x18586d[_0x7294('0x31')];_0x2638ed[_0x7294('0x55')][_0x1aae15]['on'](_0x7294('0x56'),function(){logger[_0x7294('0x43')](_0x7294('0x57'),_0x1aae15);stopRouting(_0x1aae15,_0x385c30,_0x18586d,_0x2638ed);clearTimeout(_0x384e0c);_0x384e0c=undefined;_0x1c3f0f[_0x7294('0x58')](!![]);if(_0x2638ed[_0x7294('0x55')][_0x1aae15]){delete _0x2638ed[_0x7294('0x55')][_0x1aae15];}_0x311f76[_0x7294('0x50')]();});_0x2638ed[_0x7294('0x55')][_0x1aae15]['on']('complete',function(){if(_0x2638ed[_0x7294('0x55')][_0x1aae15]){delete _0x2638ed[_0x7294('0x55')][_0x1aae15];}});_0x384e0c=setTimeout(function(){logger['info'](_0x7294('0x59'),_0x1aae15);endRouting(_0x1aae15,_0x385c30,_0x18586d,_0x2638ed);clearTimeout(_0x384e0c);_0x1c3f0f[_0x7294('0x58')](!![]);_0x311f76[_0x7294('0x5a')]();},_0x3c4ea0);switch(_0x385c30[_0x7294('0x5b')]){case _0x7294('0x5c'):strategy[_0x7294('0x5c')](_0x1c3f0f,_0x385c30,_0x2638ed,_0x18586d);break;default:strategy['beepall'](_0x1c3f0f,_0x385c30,_0x2638ed,_0x18586d);}}else{logger[_0x7294('0x3f')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x1aae15,_0x1ddd6e[_0x7294('0x3b')]);_0x311f76[_0x7294('0x50')]();}}}catch(_0x49340e){logger[_0x7294('0x3f')](_0x7294('0x4d'),_0x1aae15,_0x49340e['stack']);_0x311f76[_0x7294('0x50')]();}};}; \ No newline at end of file +var _0x0f69=['timeout','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','join','stop','Queues','createQueue','atimeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','lodash','util','seq-queue','../../../../config/environment','routing','./strategy','defaults','redis','localhost','queue_id','account','queue','emit','push','capitalize','InteractionId','format','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','pick','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','../../rpc/chatInteraction','../../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','from','contact','list','upperFirst','channel','QueueId','interaction','MessageId','message','chat','AccountId','WebsiteId','info','name','QueueReport','create','catch','error','create\x20queue\x20report','YYYY-MM-DD\x20HH:mm:ss','accepted','[%s][STOP:QUEUE][NAME:%s]','Interaction','then','update','update\x20queue\x20report'];(function(_0x15bc29,_0x574eda){var _0x52edbc=function(_0x5aae47){while(--_0x5aae47){_0x15bc29['push'](_0x15bc29['shift']());}};_0x52edbc(++_0x574eda);}(_0x0f69,0x6c));var _0x90f6=function(_0x35885a,_0x42fed7){_0x35885a=_0x35885a-0x0;var _0xe86249=_0x0f69[_0x35885a];return _0xe86249;};'use strict';var schema=require('validate');var _=require(_0x90f6('0x0'));var util=require(_0x90f6('0x1'));var seqqueue=require(_0x90f6('0x2'));var moment=require('moment');var Redis=require('ioredis');var config=require(_0x90f6('0x3'));var logger=require('../../../../config/logger')(_0x90f6('0x4'));var strategy=require(_0x90f6('0x5'));config['redis']=_[_0x90f6('0x6')](config[_0x90f6('0x7')],{'host':_0x90f6('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var attributes=['id',_0x90f6('0x9'),_0x90f6('0xa'),_0x90f6('0xb'),'from','joinAt'];function emit(_0x461fdd,_0x3fe773,_0x3543d2){io['to'](_0x461fdd)[_0x90f6('0xc')](_0x3fe773,_0x3543d2);}function emitChannelQueueInteraction(_0x1a6b5d,_0x44ed68,_0x1203fc,_0x59bd4c,_0xdd5b23,_0x362d71,_0x32e546,_0x27abcf){var _0x568ea5=_['clone'](_0x1203fc);_0x568ea5[_0x90f6('0x9')]=_0x27abcf;_0x568ea5[_0x90f6('0xb')]=_0x44ed68;_0x568ea5['account']=_0x59bd4c;_0x568ea5['id']=_0xdd5b23;if(_0x362d71){attributes[_0x90f6('0xd')](_[_0x90f6('0xe')](_0x1a6b5d)+_0x90f6('0xf'));_0x32e546[util[_0x90f6('0x10')]('%sQueuesWaitingInteractions',_0x1a6b5d)][_0xdd5b23]=_['pick'](_0x568ea5,attributes);}else{delete _0x32e546[util['format']('%sQueuesWaitingInteractions',_0x1a6b5d)][_0xdd5b23];}emit(util[_0x90f6('0x10')](_0x90f6('0x11'),_0x1a6b5d,_0x44ed68),util[_0x90f6('0x10')](_0x90f6('0x12'),_0x1a6b5d,_0x362d71?_0x90f6('0x13'):_0x90f6('0x14')),_[_0x90f6('0x15')](_0x568ea5,attributes));}var rpc={'openchannelQueueReport':require(_0x90f6('0x16')),'mailQueueReport':require(_0x90f6('0x17')),'chatQueueReport':require(_0x90f6('0x18')),'smsQueueReport':require(_0x90f6('0x19')),'faxQueueReport':require(_0x90f6('0x1a')),'whatsappQueueReport':require(_0x90f6('0x1b')),'chatInteraction':require(_0x90f6('0x1c')),'faxInteraction':require(_0x90f6('0x1d')),'mailInteraction':require(_0x90f6('0x1e')),'openchannelInteraction':require(_0x90f6('0x1f')),'smsInteraction':require(_0x90f6('0x20')),'whatsappInteraction':require(_0x90f6('0x21'))};var queue=schema({'name':{'type':_0x90f6('0x22'),'required':!![],'message':_0x90f6('0x23')},'timeout':{'type':_0x90f6('0x24'),'message':_0x90f6('0x25')}});function startRouting(_0x515bf8,_0x5d3d9a,_0x5571e2,_0x595634){if(_0x515bf8&&_0x5d3d9a&&_0x5571e2){_0x5d3d9a[_0x90f6('0x26')]+=0x1;var _0x45e118={'uniqueid':_0x515bf8,'from':_0x5571e2[_0x90f6('0x27')]?_0x5571e2[_0x90f6('0x27')][_0x90f6('0x28')]:'','joinAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5571e2['contact']?_0x5571e2[_0x90f6('0x29')]['id']:null,'ListId':_0x5571e2[_0x90f6('0x2a')]?_0x5571e2[_0x90f6('0x2a')]['id']:null};_0x45e118[_[_0x90f6('0x2b')](_0x5571e2[_0x90f6('0x2c')])+_0x90f6('0x2d')]=_0x5d3d9a['id']||null;_0x45e118[_[_0x90f6('0x2b')](_0x5571e2[_0x90f6('0x2c')])+'InteractionId']=_0x5571e2['interaction']?_0x5571e2[_0x90f6('0x2e')]['id']:null;_0x45e118[_['upperFirst'](_0x5571e2[_0x90f6('0x2c')])+_0x90f6('0x2f')]=_0x5571e2[_0x90f6('0x30')]?_0x5571e2['message']['id']:null;_0x45e118[_['upperFirst'](_0x5571e2[_0x90f6('0x2c')])+(_0x5571e2[_0x90f6('0x2c')]!==_0x90f6('0x31')?_0x90f6('0x32'):_0x90f6('0x33'))]=_0x5571e2[_0x90f6('0xa')]?_0x5571e2[_0x90f6('0xa')]['id']:null;logger[_0x90f6('0x34')](util[_0x90f6('0x10')]('[%s][START:QUEUE][NAME:%s]',_0x515bf8,_0x5d3d9a[_0x90f6('0x35')]));emitChannelQueueInteraction(_0x5571e2[_0x90f6('0x2c')],_0x5d3d9a[_0x90f6('0x35')],_0x45e118,_0x5571e2['account'][_0x90f6('0x35')],_0x5571e2['message']['id'],!![],_0x595634,_0x5d3d9a['id']);if(rpc[_0x5571e2[_0x90f6('0x2c')]+_0x90f6('0x36')]){return rpc[_0x5571e2[_0x90f6('0x2c')]+_0x90f6('0x36')][_0x90f6('0x37')](_0x45e118)[_0x90f6('0x38')](function(_0x443ce3){logger[_0x90f6('0x39')](_0x90f6('0x3a'),_0x443ce3);});}}}function stopRouting(_0x3d0ab3,_0x2f1c53,_0x195b13,_0x281c1f){if(_0x3d0ab3&&_0x2f1c53){_0x2f1c53[_0x90f6('0x26')]-=0x1;var _0x480da1={'leaveAt':moment()['format'](_0x90f6('0x3b')),'acceptAt':moment()[_0x90f6('0x10')](_0x90f6('0x3b')),'reason':_0x90f6('0x3c')};logger[_0x90f6('0x34')](util[_0x90f6('0x10')](_0x90f6('0x3d'),_0x3d0ab3,_0x2f1c53[_0x90f6('0x35')]));emitChannelQueueInteraction(_0x195b13['channel'],_0x2f1c53['name'],_0x195b13['body'],_0x195b13['account'][_0x90f6('0x35')],_0x195b13[_0x90f6('0x30')]['id'],![],_0x281c1f,_0x2f1c53['id']);return rpc[_0x195b13['channel']+_0x90f6('0x3e')]['update'](_0x195b13[_0x90f6('0x2e')]['id'],{'queueId':_0x2f1c53['id']})[_0x90f6('0x3f')](function(){if(rpc[_0x195b13[_0x90f6('0x2c')]+_0x90f6('0x36')]){return rpc[_0x195b13['channel']+'QueueReport'][_0x90f6('0x40')](_0x3d0ab3,_0x480da1)[_0x90f6('0x38')](function(_0x371237){logger[_0x90f6('0x39')](_0x90f6('0x41'),_0x371237);});}});}}function endRouting(_0x320b6b,_0x4a631c,_0x7f8f3a,_0x4fd187){if(_0x320b6b&&_0x4a631c){_0x4a631c['waiting']-=0x1;var _0x4c35a7={'leaveAt':moment()['format'](_0x90f6('0x3b')),'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x90f6('0x42')};logger[_0x90f6('0x34')](util[_0x90f6('0x10')]('[%s][END:QUEUE][NAME:%s]',_0x320b6b,_0x4a631c[_0x90f6('0x35')]));emitChannelQueueInteraction(_0x7f8f3a[_0x90f6('0x2c')],_0x4a631c[_0x90f6('0x35')],_0x7f8f3a[_0x90f6('0x27')],_0x7f8f3a['account'][_0x90f6('0x35')],_0x7f8f3a[_0x90f6('0x30')]['id'],![],_0x4fd187);if(rpc[_0x7f8f3a['channel']+_0x90f6('0x36')]){return rpc[_0x7f8f3a['channel']+_0x90f6('0x36')][_0x90f6('0x40')](_0x320b6b,_0x4c35a7)['catch'](function(_0x3e27da){logger[_0x90f6('0x39')](_0x90f6('0x41'),_0x3e27da);});}}}function handleFindQueue(_0x49e3d1){return function(_0xce96a4){return _0xce96a4[_0x90f6('0x35')][_0x90f6('0x43')]()===_0x49e3d1[_0x90f6('0x43')]();};}exports[_0x90f6('0x44')]=function(_0x1933a4,_0x33c6a6,_0x3ec471,_0x53cfd3){return function(_0x3e8f3c){try{var _0x280ca6={'name':_0x33c6a6[0x0],'timeout':_0x33c6a6[0x1]};var _0x2fedf5=queue['validate'](_0x280ca6,{'typecast':!![]});if(_0x2fedf5[_0x90f6('0x45')]){logger['error'](_0x90f6('0x46'),_0x1933a4,_['map'](_0x2fedf5,_0x90f6('0x30'))[_0x90f6('0x47')](',\x20'));_0x3e8f3c[_0x90f6('0x48')]();}else{var _0x423599=_['find'](_0x3ec471[_0x53cfd3[_0x90f6('0x2c')]+_0x90f6('0x49')],handleFindQueue(_0x280ca6['name']));if(_0x423599){startRouting(_0x1933a4,_0x423599,_0x53cfd3,_0x3ec471);var _0x244699=(_0x423599[_0x90f6('0x42')]||0xa)*0x3e8;var _0x3deeee=(_0x280ca6['timeout']||0x14)*0x3e8;var _0x18f838;if(_0x244699>_0x3deeee){_0x3deeee=_0x244699;}var _0x2ad87d=seqqueue[_0x90f6('0x4a')](_0x244699);_0x2ad87d['id']=_0x1933a4;_0x2ad87d[_0x90f6('0x4b')]=_0x244699;_0x2ad87d[_0x90f6('0x4c')]=_0x3deeee;_0x2ad87d['channel']=_0x53cfd3[_0x90f6('0x2c')];_0x3ec471[_0x90f6('0x4d')][_0x1933a4]['on'](_0x90f6('0x4e'),function(){logger[_0x90f6('0x34')](_0x90f6('0x4f'),_0x1933a4);stopRouting(_0x1933a4,_0x423599,_0x53cfd3,_0x3ec471);clearTimeout(_0x18f838);_0x18f838=undefined;_0x2ad87d[_0x90f6('0x50')](!![]);if(_0x3ec471[_0x90f6('0x4d')][_0x1933a4]){delete _0x3ec471[_0x90f6('0x4d')][_0x1933a4];}_0x3e8f3c[_0x90f6('0x48')]();});_0x3ec471[_0x90f6('0x4d')][_0x1933a4]['on'](_0x90f6('0x51'),function(){if(_0x3ec471['rules'][_0x1933a4]){delete _0x3ec471[_0x90f6('0x4d')][_0x1933a4];}});_0x18f838=setTimeout(function(){logger[_0x90f6('0x34')](_0x90f6('0x52'),_0x1933a4);endRouting(_0x1933a4,_0x423599,_0x53cfd3,_0x3ec471);clearTimeout(_0x18f838);_0x2ad87d[_0x90f6('0x50')](!![]);_0x3e8f3c[_0x90f6('0x53')]();},_0x3deeee);switch(_0x423599[_0x90f6('0x54')]){case _0x90f6('0x55'):strategy[_0x90f6('0x55')](_0x2ad87d,_0x423599,_0x3ec471,_0x53cfd3);break;default:strategy['beepall'](_0x2ad87d,_0x423599,_0x3ec471,_0x53cfd3);}}else{logger['error'](_0x90f6('0x56'),_0x1933a4,_0x280ca6[_0x90f6('0x35')]);_0x3e8f3c[_0x90f6('0x48')]();}}}catch(_0x224cb3){logger[_0x90f6('0x39')](_0x90f6('0x46'),_0x1933a4,_0x224cb3['stack']);_0x3e8f3c[_0x90f6('0x48')]();}};}; \ 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 a407c4f..5039766 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 _0xd2ea=['push','handleRun','handleTimeout','bind','timeout','drained','handleDrained','prototype','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','debug','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','busy','busyQueue','saveWaitingNotification','channel','showNotification','writeLog',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','removeWaitingNotification','STOP','TIMEOUT','exports','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','agent','realtime'];(function(_0x4c7e68,_0x5c9537){var _0x24e23c=function(_0x190728){while(--_0x190728){_0x4c7e68['push'](_0x4c7e68['shift']());}};_0x24e23c(++_0x5c9537);}(_0xd2ea,0x15f));var _0xad2e=function(_0x1c8b42,_0x134903){_0x1c8b42=_0x1c8b42-0x0;var _0x888687=_0xd2ea[_0x1c8b42];return _0x888687;};'use strict';var _=require(_0xad2e('0x0'));var uuid=require(_0xad2e('0x1'));var util=require(_0xad2e('0x2'));var logger=require(_0xad2e('0x3'))(_0xad2e('0x4'));var Agent=function(_0x5c9fa9,_0x3a9d11,_0x46a911,_0xcba7cb){this[_0xad2e('0x5')]=uuid['v4']();this[_0xad2e('0x6')]=_0x5c9fa9;this[_0xad2e('0x7')]=_0x3a9d11;this[_0xad2e('0x8')]=_0x46a911;this['routing']=_0xcba7cb;this[_0xad2e('0x6')][_0xad2e('0x9')](this[_0xad2e('0xa')]['bind'](this),this[_0xad2e('0xb')][_0xad2e('0xc')](this));this['squeue']['on'](_0xad2e('0xd'),this['handleTimeout'][_0xad2e('0xc')](this));this[_0xad2e('0x6')]['on'](_0xad2e('0xe'),this[_0xad2e('0xf')]['bind'](this));};Agent[_0xad2e('0x10')]['push']=function(){this[_0xad2e('0x6')][_0xad2e('0x9')](this[_0xad2e('0xa')][_0xad2e('0xc')](this),this['handleTimeout'][_0xad2e('0xc')](this));};Agent['prototype'][_0xad2e('0xf')]=function(){this['handleTimeout'](!![]);};Agent['prototype']['handleRun']=function(){logger['debug'](_0xad2e('0x11'),this[_0xad2e('0x6')]['id'],this[_0xad2e('0x7')]['id']);if(_[_0xad2e('0x12')](this[_0xad2e('0x8')][_0xad2e('0x13')][this[_0xad2e('0x7')]['id']])){logger[_0xad2e('0x14')](_0xad2e('0x15'),this[_0xad2e('0x6')]['id'],this[_0xad2e('0x7')]['id']);setTimeout(this[_0xad2e('0x9')][_0xad2e('0xc')](this),0x3e8);}else{if(this[_0xad2e('0x4')][_0xad2e('0x16')]||util['isAgentAvailable'](this[_0xad2e('0x6')]['id'],this[_0xad2e('0x8')]['agents'][this['agent']['id']],this['squeue']['channel'],![])){this[_0xad2e('0x8')][_0xad2e('0x13')][this[_0xad2e('0x7')]['id']][_0xad2e('0x17')]=!![];this[_0xad2e('0x8')][_0xad2e('0x13')][this[_0xad2e('0x7')]['id']][_0xad2e('0x18')]=undefined;util[_0xad2e('0x19')](this[_0xad2e('0x8')],this[_0xad2e('0x4')],this[_0xad2e('0x7')],this[_0xad2e('0x6')][_0xad2e('0x1a')]);util[_0xad2e('0x1b')](this[_0xad2e('0x5')],this['squeue']['id'],this[_0xad2e('0x8')][_0xad2e('0x13')][this[_0xad2e('0x7')]['id']],null,this[_0xad2e('0x4')]);util[_0xad2e('0x1c')](this[_0xad2e('0x6')]['id'],this[_0xad2e('0x8')][_0xad2e('0x13')][this[_0xad2e('0x7')]['id']],'RINGING'+(this[_0xad2e('0x4')]['forcedOwnership']?_0xad2e('0x1d'):''));}else{logger[_0xad2e('0x14')](_0xad2e('0x1e'),this[_0xad2e('0x6')]['id'],this[_0xad2e('0x7')]['id']);setTimeout(this[_0xad2e('0x9')][_0xad2e('0xc')](this),0x3e8);}}};Agent[_0xad2e('0x10')][_0xad2e('0xb')]=function(_0x31857f){if(_['isNil'](this[_0xad2e('0x8')][_0xad2e('0x13')][this[_0xad2e('0x7')]['id']])){return logger[_0xad2e('0x14')](_0xad2e('0x15'),this[_0xad2e('0x6')]['id'],this[_0xad2e('0x7')]['id']);}else{logger[_0xad2e('0x14')](_0xad2e('0x1f'),this[_0xad2e('0x6')]['id'],this[_0xad2e('0x7')]['id']);util['hideNotification'](this[_0xad2e('0x5')],this['squeue']['id'],this[_0xad2e('0x8')][_0xad2e('0x13')][this[_0xad2e('0x7')]['id']],null,this[_0xad2e('0x4')]);this[_0xad2e('0x8')]['agents'][this[_0xad2e('0x7')]['id']][_0xad2e('0x17')]=![];this['realtime'][_0xad2e('0x13')][this[_0xad2e('0x7')]['id']]['busyQueue']=undefined;util[_0xad2e('0x20')](this[_0xad2e('0x8')],this[_0xad2e('0x4')],this[_0xad2e('0x7')],this[_0xad2e('0x6')][_0xad2e('0x1a')]);util[_0xad2e('0x1c')](this['squeue']['id'],this[_0xad2e('0x8')][_0xad2e('0x13')][this['agent']['id']],_0x31857f?_0xad2e('0x21'):_0xad2e('0x22'));}if(!_0x31857f){setTimeout(this[_0xad2e('0x9')][_0xad2e('0xc')](this),0x3e8);}};function agent(_0x48c77b,_0xf4ae70,_0x4fe4f6,_0x5d6ac1){return new Agent(_0x48c77b,_0xf4ae70,_0x4fe4f6,_0x5d6ac1);}module[_0xad2e('0x23')]=agent; \ No newline at end of file +var _0x00bb=['bind','handleTimeout','drained','handleDrained','prototype','[%s][AGENT]\x20try\x20with\x20%s','realtime','debug','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','agent','forcedOwnership','agents','busy','busyQueue','channel','writeLog',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','isNil','[%s][AGENT]\x20timeout\x20with\x20%s','removeWaitingNotification','STOP','TIMEOUT','exports','lodash','uuid','./util','routing','notificationId','squeue','push','handleRun'];(function(_0x25e14e,_0x250eee){var _0x4fb43b=function(_0x5142ae){while(--_0x5142ae){_0x25e14e['push'](_0x25e14e['shift']());}};_0x4fb43b(++_0x250eee);}(_0x00bb,0x1d8));var _0xb00b=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0x00bb[_0x2bf141];return _0x48277b;};'use strict';var _=require(_0xb00b('0x0'));var uuid=require(_0xb00b('0x1'));var util=require(_0xb00b('0x2'));var logger=require('../../../../../config/logger')(_0xb00b('0x3'));var Agent=function(_0x47a3bf,_0x278c5e,_0x464fe7,_0x582ef9){this[_0xb00b('0x4')]=uuid['v4']();this[_0xb00b('0x5')]=_0x47a3bf;this['agent']=_0x278c5e;this['realtime']=_0x464fe7;this['routing']=_0x582ef9;this[_0xb00b('0x5')][_0xb00b('0x6')](this[_0xb00b('0x7')][_0xb00b('0x8')](this),this[_0xb00b('0x9')][_0xb00b('0x8')](this));this['squeue']['on']('timeout',this[_0xb00b('0x9')][_0xb00b('0x8')](this));this[_0xb00b('0x5')]['on'](_0xb00b('0xa'),this[_0xb00b('0xb')]['bind'](this));};Agent[_0xb00b('0xc')]['push']=function(){this['squeue']['push'](this[_0xb00b('0x7')][_0xb00b('0x8')](this),this[_0xb00b('0x9')][_0xb00b('0x8')](this));};Agent[_0xb00b('0xc')][_0xb00b('0xb')]=function(){this['handleTimeout'](!![]);};Agent[_0xb00b('0xc')][_0xb00b('0x7')]=function(){logger['debug'](_0xb00b('0xd'),this[_0xb00b('0x5')]['id'],this['agent']['id']);if(_['isNil'](this[_0xb00b('0xe')]['agents'][this['agent']['id']])){logger[_0xb00b('0xf')](_0xb00b('0x10'),this[_0xb00b('0x5')]['id'],this[_0xb00b('0x11')]['id']);setTimeout(this['push'][_0xb00b('0x8')](this),0x3e8);}else{if(this['routing'][_0xb00b('0x12')]||util['isAgentAvailable'](this[_0xb00b('0x5')]['id'],this['realtime'][_0xb00b('0x13')][this[_0xb00b('0x11')]['id']],this['squeue']['channel'],![])){this[_0xb00b('0xe')]['agents'][this[_0xb00b('0x11')]['id']][_0xb00b('0x14')]=!![];this[_0xb00b('0xe')][_0xb00b('0x13')][this['agent']['id']][_0xb00b('0x15')]=undefined;util['saveWaitingNotification'](this[_0xb00b('0xe')],this[_0xb00b('0x3')],this['agent'],this[_0xb00b('0x5')][_0xb00b('0x16')]);util['showNotification'](this[_0xb00b('0x4')],this[_0xb00b('0x5')]['id'],this['realtime'][_0xb00b('0x13')][this[_0xb00b('0x11')]['id']],null,this[_0xb00b('0x3')]);util[_0xb00b('0x17')](this['squeue']['id'],this['realtime'][_0xb00b('0x13')][this['agent']['id']],'RINGING'+(this['routing'][_0xb00b('0x12')]?_0xb00b('0x18'):''));}else{logger[_0xb00b('0xf')](_0xb00b('0x19'),this[_0xb00b('0x5')]['id'],this[_0xb00b('0x11')]['id']);setTimeout(this[_0xb00b('0x6')]['bind'](this),0x3e8);}}};Agent[_0xb00b('0xc')]['handleTimeout']=function(_0x450129){if(_[_0xb00b('0x1a')](this[_0xb00b('0xe')]['agents'][this[_0xb00b('0x11')]['id']])){return logger[_0xb00b('0xf')](_0xb00b('0x10'),this[_0xb00b('0x5')]['id'],this[_0xb00b('0x11')]['id']);}else{logger[_0xb00b('0xf')](_0xb00b('0x1b'),this[_0xb00b('0x5')]['id'],this[_0xb00b('0x11')]['id']);util['hideNotification'](this[_0xb00b('0x4')],this[_0xb00b('0x5')]['id'],this['realtime'][_0xb00b('0x13')][this[_0xb00b('0x11')]['id']],null,this['routing']);this[_0xb00b('0xe')]['agents'][this[_0xb00b('0x11')]['id']][_0xb00b('0x14')]=![];this[_0xb00b('0xe')][_0xb00b('0x13')][this[_0xb00b('0x11')]['id']][_0xb00b('0x15')]=undefined;util[_0xb00b('0x1c')](this['realtime'],this['routing'],this['agent'],this[_0xb00b('0x5')][_0xb00b('0x16')]);util[_0xb00b('0x17')](this[_0xb00b('0x5')]['id'],this['realtime'][_0xb00b('0x13')][this[_0xb00b('0x11')]['id']],_0x450129?_0xb00b('0x1d'):_0xb00b('0x1e'));}if(!_0x450129){setTimeout(this[_0xb00b('0x6')][_0xb00b('0x8')](this),0x3e8);}};function agent(_0x8785ec,_0x3302ac,_0x5efc18,_0x55451e){return new Agent(_0x8785ec,_0x3302ac,_0x5efc18,_0x55451e);}module[_0xb00b('0x1f')]=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 35c9c08..9b659bb 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 _0x83d0=['agents','RINGING','busy','busyQueue','name','showNotification','debug','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','writeLog','STOP','TIMEOUT','removeWaitingNotification','exports','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','queue','squeue','push','handleRun','bind','handleTimeout','prototype','handleDrained','isNil','Agents','length','realtime','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','channel'];(function(_0x2e5aa1,_0x2295c2){var _0x55e030=function(_0x48986f){while(--_0x48986f){_0x2e5aa1['push'](_0x2e5aa1['shift']());}};_0x55e030(++_0x2295c2);}(_0x83d0,0x1a6));var _0x083d=function(_0x3f22e2,_0x4805b0){_0x3f22e2=_0x3f22e2-0x0;var _0x95201a=_0x83d0[_0x3f22e2];return _0x95201a;};'use strict';var _=require(_0x083d('0x0'));var uuid=require(_0x083d('0x1'));var util=require(_0x083d('0x2'));var logger=require(_0x083d('0x3'))(_0x083d('0x4'));var Beepall=function(_0x4062c8,_0x468e68,_0x3f0eb2,_0xcefc50){this[_0x083d('0x5')]=uuid['v4']();this['squeue']=_0x4062c8;this[_0x083d('0x6')]=_0x468e68;this['realtime']=_0x3f0eb2;this[_0x083d('0x4')]=_0xcefc50;this[_0x083d('0x7')][_0x083d('0x8')](this[_0x083d('0x9')][_0x083d('0xa')](this),this['handleTimeout']['bind'](this));this[_0x083d('0x7')]['on']('timeout',this['handleTimeout'][_0x083d('0xa')](this));this[_0x083d('0x7')]['on']('drained',this['handleDrained'][_0x083d('0xa')](this));};Beepall['prototype'][_0x083d('0x8')]=function(){this[_0x083d('0x7')][_0x083d('0x8')](this['handleRun'][_0x083d('0xa')](this),this[_0x083d('0xb')][_0x083d('0xa')](this));};Beepall[_0x083d('0xc')][_0x083d('0xd')]=function(){this[_0x083d('0xb')](!![]);};Beepall[_0x083d('0xc')][_0x083d('0x9')]=function(){var _0x38ef68=!![];if(!_[_0x083d('0xe')](this[_0x083d('0x6')])&&!_[_0x083d('0xe')](this[_0x083d('0x6')][_0x083d('0xf')])&&this[_0x083d('0x6')][_0x083d('0xf')][_0x083d('0x10')]>0x0){for(var _0x371098=0x0,_0x272e05;_0x3710980x0){for(var _0x11341c=0x0,_0x9269fb;_0x11341c0x0&&_0x59ea2a[_0x456525+_0x5014('0x24')]>=_0x59ea2a[_0x456525+'Capacity']){writeLog(_0x18a7d5,_0x59ea2a,_0x456525[_0x5014('0x25')]()+_0x5014('0x26'));return![];}}return!![];};exports[_0x5014('0x27')]=function(_0x3d35d7,_0x94fed7,_0x358f62,_0x52193e,_0x1b84cc){return sendNotification(!![],_0x3d35d7,_0x94fed7,_0x358f62,_0x52193e,_0x1b84cc);};exports['hideNotification']=function(_0x5b9387,_0x421b3d,_0x2890b6,_0x33bbca,_0x5b6e58){return sendNotification(![],_0x5b9387,_0x421b3d,_0x2890b6,_0x33bbca,_0x5b6e58);};exports['checkWaitingNotifications']=function(_0x1505bd,_0x14d6a2,_0x45e63f){var _0x5beaec=_0x14d6a2[_0x5014('0x28')][_0x5014('0x29')];if(!_0x5beaec&&_0x45e63f){_0x5beaec=_0x45e63f['id'];}var _0xc40ef1=_['some'](_0x1505bd[_0x14d6a2['channel']+_0x5014('0x2a')],function(_0x55f98c){var _0x2fb596=_[_0x5014('0x2b')](_0x14d6a2[_0x5014('0x2c')])+_0x5014('0x2d');return _0x55f98c[_0x2fb596]===_0x14d6a2[_0x5014('0x28')]['id'];});if(!_0xc40ef1&&_0x5beaec&&_0x1505bd['agents'][_0x5beaec]){_0xc40ef1=_['some'](_0x1505bd[_0x5014('0x2e')][_0x5beaec][_0x14d6a2['channel']+_0x5014('0x2f')],function(_0x958dd9){return _0x958dd9['id']===_0x14d6a2[_0x5014('0x28')]['id'];});}return _0xc40ef1;};exports[_0x5014('0x30')]=function(_0x5bedee,_0x889f69,_0x2cf96b,_0x4954bd){if(_0x2cf96b&&_0x2cf96b['id']&&_0x5bedee[_0x5014('0x2e')]&&_0x5bedee['agents'][_0x2cf96b['id']]){_0x5bedee[_0x5014('0x2e')][_0x2cf96b['id']][_0x4954bd+_0x5014('0x2f')][_0x889f69[_0x5014('0x17')]['id']]={'id':_0x889f69['interaction']['id']};}};exports[_0x5014('0x31')]=function(_0x52feaa,_0x2908d5,_0x18ab0e,_0xb609c1){if(_0x18ab0e&&_0x18ab0e['id']&&_0x52feaa[_0x5014('0x2e')]&&_0x52feaa[_0x5014('0x2e')][_0x18ab0e['id']]){delete _0x52feaa['agents'][_0x18ab0e['id']][_0xb609c1+'WaitingInteractions'][_0x2908d5['message']['id']];}};exports['writeLog']=writeLog; \ No newline at end of file +var _0xa76e=['OFFLINE','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','toUpperCase','\x20MAXCAPACITY','showNotification','checkWaitingNotifications','some','channel','QueuesWaitingInteractions','capitalize','InteractionId','interaction','agents','WaitingInteractions','saveWaitingNotification','removeWaitingNotification','util','../utils','../../../../../config/logger','redis','defaults','socket.io-emitter','split','name','account','notificationSound','notificationShake','body','queue','msg','getMustacheRender','notificationTemplate','error','format','[%s][QUEUE]\x20%s','message','user:%s','emit','notification:%s','save','remove','[%s][QUEUE][AGENT:%s][STATUS:%s]','busy','BUSY'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0xa76e,0xfe));var _0xea76=function(_0x455c6c,_0x1e78b7){_0x455c6c=_0x455c6c-0x0;var _0x488242=_0xa76e[_0x455c6c];return _0x488242;};'use strict';var _=require('lodash');var util=require(_0xea76('0x0'));var utils=require(_0xea76('0x1'));var Redis=require('ioredis');var config=require('../../../../../config/environment');var logger=require(_0xea76('0x2'))('routing');config[_0xea76('0x3')]=_[_0xea76('0x4')](config[_0xea76('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0xea76('0x5'))(new Redis(config['redis']));function sendNotification(_0x337097,_0x4ee974,_0x45ac1b,_0x1735ff,_0x5eb746,_0x55aae7){var _0x344005=_0x55aae7||{};var _0x13eb11=_0x45ac1b[_0xea76('0x6')]('.');var _0x1792cc={'uniqueid':_0x4ee974,'channel':_0x13eb11[0x0],'id':_0x13eb11[0x1],'title':_0x13eb11[0x0]+'\x20interaction','interactionId':_0x13eb11[0x2],'queue':_0x5eb746?_0x5eb746[_0xea76('0x7')]:null,'sound':_0x344005[_0xea76('0x8')][_0xea76('0x9')],'shake':_0x344005['account'][_0xea76('0xa')]};try{if(!_0x344005[_0xea76('0xb')]){_0x344005[_0xea76('0xb')]={};}if(_0x5eb746){_0x344005[_0xea76('0xb')][_0xea76('0xc')]=_0x5eb746;}else if(_0x344005[_0xea76('0xb')][_0xea76('0xc')]){delete _0x344005[_0xea76('0xb')][_0xea76('0xc')];}_0x1792cc[_0xea76('0xd')]=utils[_0xea76('0xe')](_0x344005[_0xea76('0x8')][_0xea76('0xf')],_0x344005);}catch(_0x4184f3){_0x1792cc[_0xea76('0xd')]='I\x20can\x27t\x20render\x20your\x20template';logger[_0xea76('0x10')](util[_0xea76('0x11')](_0xea76('0x12'),_0x4ee974,_0x4184f3[_0xea76('0x13')]));}io['to'](util[_0xea76('0x11')](_0xea76('0x14'),_0x1735ff[_0xea76('0x7')]))[_0xea76('0x15')](util[_0xea76('0x11')](_0xea76('0x16'),_0x337097?_0xea76('0x17'):_0xea76('0x18')),_0x1792cc);}function writeLog(_0x5ecdd1,_0x49bc4a,_0x376d78){return logger['debug'](util[_0xea76('0x11')](_0xea76('0x19'),_0x5ecdd1,_0x49bc4a[_0xea76('0x7')],_0x376d78));}exports['isAgentAvailable']=function(_0x5d7f91,_0x4bfc66,_0x2ab3b2,_0x2a934e){if(_0x4bfc66[_0xea76('0x1a')]){writeLog(_0x5d7f91,_0x4bfc66,_0xea76('0x1b'));return![];}if(!_0x4bfc66['online']){writeLog(_0x5d7f91,_0x4bfc66,_0xea76('0x1c'));return![];}if(_0x4bfc66[_0x2ab3b2+'Pause']){writeLog(_0x5d7f91,_0x4bfc66,_0xea76('0x1d'));return![];}if(_0x2a934e&&_0x4bfc66[_0xea76('0x1e')](_0x2ab3b2+_0xea76('0x1f'))&&_0x4bfc66[_0xea76('0x1e')](_0x2ab3b2+_0xea76('0x20'))){if(_0x4bfc66[_0x2ab3b2+_0xea76('0x1f')]>0x0&&_0x4bfc66[_0x2ab3b2+_0xea76('0x20')]>=_0x4bfc66[_0x2ab3b2+_0xea76('0x1f')]){writeLog(_0x5d7f91,_0x4bfc66,_0x2ab3b2[_0xea76('0x21')]()+_0xea76('0x22'));return![];}}return!![];};exports[_0xea76('0x23')]=function(_0x1729a2,_0xb511a6,_0x44d877,_0x3fb762,_0xe58cbc){return sendNotification(!![],_0x1729a2,_0xb511a6,_0x44d877,_0x3fb762,_0xe58cbc);};exports['hideNotification']=function(_0x163dc7,_0x52cab0,_0x5911c2,_0x2d7255,_0x8a66ac){return sendNotification(![],_0x163dc7,_0x52cab0,_0x5911c2,_0x2d7255,_0x8a66ac);};exports[_0xea76('0x24')]=function(_0x39034f,_0x2bd5b2,_0x436b6c){var _0x3e61ca=_0x2bd5b2['interaction']['UserId'];if(!_0x3e61ca&&_0x436b6c){_0x3e61ca=_0x436b6c['id'];}var _0x2335de=_[_0xea76('0x25')](_0x39034f[_0x2bd5b2[_0xea76('0x26')]+_0xea76('0x27')],function(_0x1e7a30){var _0x20d23e=_[_0xea76('0x28')](_0x2bd5b2[_0xea76('0x26')])+_0xea76('0x29');return _0x1e7a30[_0x20d23e]===_0x2bd5b2[_0xea76('0x2a')]['id'];});if(!_0x2335de&&_0x3e61ca&&_0x39034f[_0xea76('0x2b')][_0x3e61ca]){_0x2335de=_[_0xea76('0x25')](_0x39034f[_0xea76('0x2b')][_0x3e61ca][_0x2bd5b2[_0xea76('0x26')]+_0xea76('0x2c')],function(_0x4c2dfb){return _0x4c2dfb['id']===_0x2bd5b2[_0xea76('0x2a')]['id'];});}return _0x2335de;};exports[_0xea76('0x2d')]=function(_0x62fa2a,_0x56ec3a,_0x37912b,_0x2350e8){if(_0x37912b&&_0x37912b['id']&&_0x62fa2a[_0xea76('0x2b')]&&_0x62fa2a[_0xea76('0x2b')][_0x37912b['id']]){_0x62fa2a['agents'][_0x37912b['id']][_0x2350e8+_0xea76('0x2c')][_0x56ec3a['message']['id']]={'id':_0x56ec3a['interaction']['id']};}};exports[_0xea76('0x2e')]=function(_0x565cfe,_0x56b434,_0x3a88b3,_0x450aa9){if(_0x3a88b3&&_0x3a88b3['id']&&_0x565cfe[_0xea76('0x2b')]&&_0x565cfe[_0xea76('0x2b')][_0x3a88b3['id']]){delete _0x565cfe[_0xea76('0x2b')][_0x3a88b3['id']][_0x450aa9+'WaitingInteractions'][_0x56b434[_0xea76('0x13')]['id']];}};exports['writeLog']=writeLog; \ No newline at end of file diff --git a/server/services/routing/server/applications/system.js b/server/services/routing/server/applications/system.js index 52bf8f1..0e609e7 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 _0x71e8=['message','info','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','body','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','lodash','./utils','../../../../config/logger','routing','string','validate','error','[%s][SYSTEM]\x20%s','map'];(function(_0x333714,_0x3370ac){var _0x4c211e=function(_0x34219b){while(--_0x34219b){_0x333714['push'](_0x333714['shift']());}};_0x4c211e(++_0x3370ac);}(_0x71e8,0x9f));var _0x871e=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x71e8[_0xa464c9];return _0x3d73c4;};'use strict';var schema=require('validate');var sh=require('shelljs');var _=require(_0x871e('0x0'));var utils=require(_0x871e('0x1'));var logger=require(_0x871e('0x2'))(_0x871e('0x3'));var system=schema({'command':{'type':_0x871e('0x4'),'required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports['consequence']=function(_0x1afe53,_0x122d69){return function(_0x2503a2){try{var _0x5f4407={'command':_0x122d69[0x0]};var _0x5e1863=system[_0x871e('0x5')](_0x5f4407,{'typecast':!![]});if(_0x5e1863['length']){logger[_0x871e('0x6')](_0x871e('0x7'),_0x1afe53,_[_0x871e('0x8')](_0x5e1863,_0x871e('0x9'))['join'](',\x20'));logger[_0x871e('0xa')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x1afe53);_0x2503a2[_0x871e('0xb')]();}else{var _0x5cb420=this;var _0x5734e0=utils[_0x871e('0xc')](_0x122d69[0x0],this);logger[_0x871e('0xa')](_0x871e('0xd'),_0x1afe53,_0x5734e0);sh[_0x871e('0xe')](_[_0x871e('0xf')](_0x5734e0),function(_0x4a0533,_0x4346b4){logger['info'](_0x871e('0x10'),_0x1afe53,_0x4a0533);if(_0x4a0533==0x0){var _0x136b2a=_0x4346b4[_0x871e('0x11')](/(\r\n|\n|\r)/gm,'');if(_[_0x871e('0x12')](_0x122d69[0x1])||_[_0x871e('0x13')](_0x122d69[0x1])){logger[_0x871e('0xa')](_0x871e('0x14'),_0x1afe53);_0x5cb420['body'][_0x122d69[0x1]]=_0x136b2a;}else{logger[_0x871e('0xa')](_0x871e('0x15'),_0x1afe53,_0x122d69[0x1],_0x136b2a);_0x5cb420[_0x871e('0x16')][_0x122d69[0x1]]=_0x136b2a;}}_0x2503a2[_0x871e('0xb')]();});}}catch(_0xc2091a){logger[_0x871e('0x6')]('[%s][SYSTEM]\x20%s',_0x1afe53,_['isObject'](_0xc2091a)?JSON['stringify'](_0xc2091a):_0xc2091a);logger[_0x871e('0xa')](_0x871e('0x17'),_0x1afe53);_0x2503a2[_0x871e('0xb')]();}};}; \ No newline at end of file +var _0x7398=['[%s][SYSTEM]\x20result\x20code:\x20%s','isNil','body','isObject','shelljs','./utils','../../../../config/logger','string','consequence','length','error','[%s][SYSTEM]\x20%s','map','message','join','info','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim'];(function(_0x3d56db,_0x342296){var _0x418b9a=function(_0x5db376){while(--_0x5db376){_0x3d56db['push'](_0x3d56db['shift']());}};_0x418b9a(++_0x342296);}(_0x7398,0x82));var _0x8739=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x7398[_0x1694f5];return _0x5b4321;};'use strict';var schema=require('validate');var sh=require(_0x8739('0x0'));var _=require('lodash');var utils=require(_0x8739('0x1'));var logger=require(_0x8739('0x2'))('routing');var system=schema({'command':{'type':_0x8739('0x3'),'required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x8739('0x4')]=function(_0x490050,_0x4fc176){return function(_0xb1018e){try{var _0x269cea={'command':_0x4fc176[0x0]};var _0x431179=system['validate'](_0x269cea,{'typecast':!![]});if(_0x431179[_0x8739('0x5')]){logger[_0x8739('0x6')](_0x8739('0x7'),_0x490050,_[_0x8739('0x8')](_0x431179,_0x8739('0x9'))[_0x8739('0xa')](',\x20'));logger[_0x8739('0xb')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x490050);_0xb1018e[_0x8739('0xc')]();}else{var _0x5de800=this;var _0x3304db=utils[_0x8739('0xd')](_0x4fc176[0x0],this);logger[_0x8739('0xb')](_0x8739('0xe'),_0x490050,_0x3304db);sh[_0x8739('0xf')](_[_0x8739('0x10')](_0x3304db),function(_0x436ba2,_0xf0d9dc){logger[_0x8739('0xb')](_0x8739('0x11'),_0x490050,_0x436ba2);if(_0x436ba2==0x0){var _0x2ed2ea=_0xf0d9dc['replace'](/(\r\n|\n|\r)/gm,'');if(_[_0x8739('0x12')](_0x4fc176[0x1])||_['isEmpty'](_0x4fc176[0x1])){logger[_0x8739('0xb')]('[%s][SYSTEM]\x20no\x20variable',_0x490050);_0x5de800[_0x8739('0x13')][_0x4fc176[0x1]]=_0x2ed2ea;}else{logger['info']('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x490050,_0x4fc176[0x1],_0x2ed2ea);_0x5de800[_0x8739('0x13')][_0x4fc176[0x1]]=_0x2ed2ea;}}_0xb1018e[_0x8739('0xc')]();});}}catch(_0x34dd58){logger[_0x8739('0x6')](_0x8739('0x7'),_0x490050,_[_0x8739('0x14')](_0x34dd58)?JSON['stringify'](_0x34dd58):_0x34dd58);logger['info']('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x490050);_0xb1018e[_0x8739('0xc')]();}};}; \ 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 c01808b..e3d75d4 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 _0x2954=['../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][TAG]\x20%s','next','Interaction','channel','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','stringify','info','finally','isObject','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x2954,0x1c6));var _0x4295=function(_0x5e6ea3,_0x9addd2){_0x5e6ea3=_0x5e6ea3-0x0;var _0x4048b5=_0x2954[_0x5e6ea3];return _0x4048b5;};'use strict';var schema=require(_0x4295('0x0'));var _=require(_0x4295('0x1'));var rpc={'chatInteraction':require(_0x4295('0x2')),'openchannelInteraction':require(_0x4295('0x3')),'smsInteraction':require(_0x4295('0x4')),'mailInteraction':require(_0x4295('0x5')),'faxInteraction':require(_0x4295('0x6')),'whatsappInteraction':require(_0x4295('0x7'))};var logger=require(_0x4295('0x8'))(_0x4295('0x9'));var tag=schema({'tag':{'type':_0x4295('0xa'),'required':!![],'message':_0x4295('0xb')}});exports[_0x4295('0xc')]=function(_0x2e6542,_0x289326,_0x21ea3f,_0x4abcbc){return function(_0x388e16){try{var _0x3e6ed6={'tag':_0x289326[0x0]};var _0x397528=tag[_0x4295('0x0')](_0x3e6ed6,{'typecast':!![]});if(_0x397528[_0x4295('0xd')]){logger[_0x4295('0xe')](_0x4295('0xf'),_0x2e6542,_['map'](_0x397528,'message')['join'](',\x20'));logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x2e6542);_0x388e16[_0x4295('0x10')]();}else{var _0xf2e1fc={'ids':[_0x289326[0x0]]};if(rpc[_0x4abcbc['channel']+_0x4295('0x11')]){rpc[_0x4abcbc[_0x4295('0x12')]+_0x4295('0x11')]['addTags'](_0x4abcbc[_0x4295('0x13')]['id'],_0xf2e1fc)[_0x4295('0x14')](function(_0x482fa8){logger['info'](_0x4295('0x15'),_0x2e6542,_0x289326[0x1],_0x4abcbc['channel'],_0x4abcbc[_0x4295('0x13')]['id']);})['catch'](function(_0x46c264){logger['error'](_0x4295('0xf'),_0x2e6542,JSON[_0x4295('0x16')](_0x46c264));logger[_0x4295('0x17')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x2e6542);})[_0x4295('0x18')](function(){_0x388e16[_0x4295('0x10')]();});}}}catch(_0x3b3469){logger[_0x4295('0xe')]('[%s][TAG]\x20%s',_0x2e6542,_[_0x4295('0x19')](_0x3b3469)?JSON['stringify'](_0x3b3469):_0x3b3469);logger[_0x4295('0x17')](_0x4295('0x1a'),_0x2e6542);_0x388e16['next']();}};}; \ No newline at end of file +var _0x4224=['catch','error','stringify','finally','validate','lodash','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../../../config/logger','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','[%s][TAG]\x20%s','map','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','Interaction','channel','addTags','then','interaction'];(function(_0x21f931,_0x598b2d){var _0x3f083c=function(_0x1c7c49){while(--_0x1c7c49){_0x21f931['push'](_0x21f931['shift']());}};_0x3f083c(++_0x598b2d);}(_0x4224,0x18b));var _0x4422=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x4224[_0x20a584];return _0x4b41a8;};'use strict';var schema=require(_0x4422('0x0'));var _=require(_0x4422('0x1'));var rpc={'chatInteraction':require(_0x4422('0x2')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x4422('0x3')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x4422('0x4')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require(_0x4422('0x5'))('routing');var tag=schema({'tag':{'type':'number','required':!![],'message':_0x4422('0x6')}});exports[_0x4422('0x7')]=function(_0xecebcd,_0x5d2724,_0x2214a2,_0x4aee77){return function(_0x19d15d){try{var _0x3b5408={'tag':_0x5d2724[0x0]};var _0x15ca08=tag[_0x4422('0x0')](_0x3b5408,{'typecast':!![]});if(_0x15ca08['length']){logger['error'](_0x4422('0x8'),_0xecebcd,_[_0x4422('0x9')](_0x15ca08,'message')[_0x4422('0xa')](',\x20'));logger[_0x4422('0xb')](_0x4422('0xc'),_0xecebcd);_0x19d15d[_0x4422('0xd')]();}else{var _0x4ab0de={'ids':[_0x5d2724[0x0]]};if(rpc[_0x4aee77['channel']+_0x4422('0xe')]){rpc[_0x4aee77[_0x4422('0xf')]+'Interaction'][_0x4422('0x10')](_0x4aee77['interaction']['id'],_0x4ab0de)[_0x4422('0x11')](function(_0x69592d){logger['info']('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0xecebcd,_0x5d2724[0x1],_0x4aee77[_0x4422('0xf')],_0x4aee77[_0x4422('0x12')]['id']);})[_0x4422('0x13')](function(_0x1a701d){logger[_0x4422('0x14')]('[%s][TAG]\x20%s',_0xecebcd,JSON[_0x4422('0x15')](_0x1a701d));logger['info'](_0x4422('0xc'),_0xecebcd);})[_0x4422('0x16')](function(){_0x19d15d[_0x4422('0xd')]();});}}}catch(_0x1830e2){logger[_0x4422('0x14')](_0x4422('0x8'),_0xecebcd,_['isObject'](_0x1830e2)?JSON[_0x4422('0x15')](_0x1830e2):_0x1830e2);logger[_0x4422('0xb')](_0x4422('0xc'),_0xecebcd);_0x19d15d[_0x4422('0xd')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tvox.js b/server/services/routing/server/applications/tvox.js index 72cad25..68aad02 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 _0xc575=['includes','push','urlOnAnswer','?params=','urlOnRing','title','2.0','login','stringify','utf8','application/json-rpc','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','&serviceId=','&sessionId=','then','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','catch','error','[%s][TVOX]\x20%s','isObject','stop','info','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','../../../../config/logger','routing','lodash','consequence','replace'];(function(_0x4ddef8,_0x3c78fe){var _0x456403=function(_0x439273){while(--_0x439273){_0x4ddef8['push'](_0x4ddef8['shift']());}};_0x456403(++_0x3c78fe);}(_0xc575,0x1ba));var _0x5c57=function(_0x4d275c,_0x522396){_0x4d275c=_0x4d275c-0x0;var _0x55b75f=_0xc575[_0x4d275c];return _0x55b75f;};'use strict';var rp=require(_0x5c57('0x0'));var logger=require(_0x5c57('0x1'))(_0x5c57('0x2'));var _=require(_0x5c57('0x3'));var arr=[];exports[_0x5c57('0x4')]=function(_0x4ecb4d,_0x49dbb4){return function(_0x491e44){var _0x591411=_0x49dbb4[0xa];var _0x43e786=_0x49dbb4[0xb];var _0x182e0e=_0x49dbb4[0xc];var _0x13c893=_0x49dbb4[0xd];var _0x48ba4f=_0x49dbb4[0xe];var _0x1f8f1b=_0x49dbb4[0xf][_0x5c57('0x5')](/\n/g,'\x20-\x20');var _0x9ce2b1=_0x49dbb4[0x10]['replace'](/\n/g,'\x20');if(!arr[_0x5c57('0x6')](_0x43e786)){arr[_0x5c57('0x7')](_0x43e786);var _0x1809e7=_0x49dbb4[0x3];var _0x1b9597=_0x49dbb4[0x4];var _0x161bec=_0x49dbb4[0x1];var _0x3ddcaf=_0x49dbb4[0x0];var _0x16fc95={};_0x16fc95[_0x5c57('0x8')]=_0x49dbb4[0x8]+_0x5c57('0x9')+_0x182e0e+'|'+_0x591411+'|'+_0x13c893+'|'+_0x43e786+'|'+_0x48ba4f;_0x16fc95[_0x5c57('0xa')]=_0x49dbb4[0x7]+_0x5c57('0x9')+_0x182e0e+'|'+_0x591411+'|'+_0x13c893+'|'+_0x43e786+'|'+_0x48ba4f+'|'+_0x1f8f1b+'|'+_0x9ce2b1;_0x16fc95[_0x5c57('0xb')]=_0x49dbb4[0x9];var _0x1d76b5={};_0x1d76b5['jsonrpc']=_0x5c57('0xc');_0x1d76b5['method']=_0x5c57('0xd');var _0x1464c=[];_0x1464c['push'](_0x49dbb4[0x2]);_0x1464c[_0x5c57('0x7')](_0x49dbb4[0x5]);_0x1464c[_0x5c57('0x7')](_0x49dbb4[0x6]);_0x1d76b5['params']=_0x1464c;_0x1d76b5['id']=0x1;var _0x4d5270=JSON[_0x5c57('0xe')](_0x1d76b5);var _0x131972={'encoding':_0x5c57('0xf'),'method':'POST','timeout':0x2710,'url':_0x1809e7,'headers':{'Content-Type':_0x5c57('0x10')},'body':_0x4d5270};return rp(_0x131972)['then'](function(_0x53a915){const _0x36946e=JSON['parse'](_0x53a915);if(!_0x36946e[_0x5c57('0x11')][_0x5c57('0x12')]){throw new Error(_0x5c57('0x13'));}var _0x381eb7=_0x43e786;var _0x1af4e8='channelId='+_0x161bec+_0x5c57('0x14')+_0x3ddcaf+_0x5c57('0x15')+_0x381eb7+'&data='+JSON[_0x5c57('0xe')](_0x16fc95);var _0x183d1f=_0x1b9597+'?'+_0x1af4e8;return rp(_0x183d1f);})[_0x5c57('0x16')](function(_0x14fe4e){logger['info'](_0x5c57('0x17'),_0x4ecb4d,_0x14fe4e);_0x491e44['stop']();})[_0x5c57('0x18')](function(_0x1b9865){logger[_0x5c57('0x19')](_0x5c57('0x1a'),_0x4ecb4d,_[_0x5c57('0x1b')](_0x1b9865)?JSON[_0x5c57('0xe')](_0x1b9865):_0x1b9865);_0x491e44[_0x5c57('0x1c')]();});}else{logger[_0x5c57('0x1d')](_0x5c57('0x1e'),_0x4ecb4d);_0x491e44[_0x5c57('0x1f')]();}};}; \ No newline at end of file +var _0xd00d=['POST','application/json-rpc','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&sessionId=','stringify','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','error','[%s][TVOX]\x20%s','next','request-promise','routing','lodash','\x20-\x20','replace','includes','push','?params=','title','jsonrpc','2.0','method','login','params','utf8'];(function(_0x44946b,_0xf874ec){var _0x249bc4=function(_0x40a23e){while(--_0x40a23e){_0x44946b['push'](_0x44946b['shift']());}};_0x249bc4(++_0xf874ec);}(_0xd00d,0x177));var _0xdd00=function(_0x41ee16,_0xfa94c3){_0x41ee16=_0x41ee16-0x0;var _0x1f60de=_0xd00d[_0x41ee16];return _0x1f60de;};'use strict';var rp=require(_0xdd00('0x0'));var logger=require('../../../../config/logger')(_0xdd00('0x1'));var _=require(_0xdd00('0x2'));var arr=[];exports['consequence']=function(_0x4a597b,_0x2d4dc6){return function(_0x5c1443){var _0x9aa957=_0x2d4dc6[0xa];var _0x457a59=_0x2d4dc6[0xb];var _0x1ea552=_0x2d4dc6[0xc];var _0x390f97=_0x2d4dc6[0xd];var _0x54e483=_0x2d4dc6[0xe];var _0x41c51d=_0x2d4dc6[0xf]['replace'](/\n/g,_0xdd00('0x3'));var _0x477943=_0x2d4dc6[0x10][_0xdd00('0x4')](/\n/g,'\x20');if(!arr[_0xdd00('0x5')](_0x457a59)){arr[_0xdd00('0x6')](_0x457a59);var _0xc20110=_0x2d4dc6[0x3];var _0x4d5d81=_0x2d4dc6[0x4];var _0x5ab7d4=_0x2d4dc6[0x1];var _0x4df2a7=_0x2d4dc6[0x0];var _0x27057f={};_0x27057f['urlOnAnswer']=_0x2d4dc6[0x8]+'?params='+_0x1ea552+'|'+_0x9aa957+'|'+_0x390f97+'|'+_0x457a59+'|'+_0x54e483;_0x27057f['urlOnRing']=_0x2d4dc6[0x7]+_0xdd00('0x7')+_0x1ea552+'|'+_0x9aa957+'|'+_0x390f97+'|'+_0x457a59+'|'+_0x54e483+'|'+_0x41c51d+'|'+_0x477943;_0x27057f[_0xdd00('0x8')]=_0x2d4dc6[0x9];var _0x1a9332={};_0x1a9332[_0xdd00('0x9')]=_0xdd00('0xa');_0x1a9332[_0xdd00('0xb')]=_0xdd00('0xc');var _0x4287cd=[];_0x4287cd[_0xdd00('0x6')](_0x2d4dc6[0x2]);_0x4287cd[_0xdd00('0x6')](_0x2d4dc6[0x5]);_0x4287cd['push'](_0x2d4dc6[0x6]);_0x1a9332[_0xdd00('0xd')]=_0x4287cd;_0x1a9332['id']=0x1;var _0x85c88=JSON['stringify'](_0x1a9332);var _0x2a96e3={'encoding':_0xdd00('0xe'),'method':_0xdd00('0xf'),'timeout':0x2710,'url':_0xc20110,'headers':{'Content-Type':_0xdd00('0x10')},'body':_0x85c88};return rp(_0x2a96e3)['then'](function(_0x432a94){const _0x499ed8=JSON['parse'](_0x432a94);if(!_0x499ed8[_0xdd00('0x11')][_0xdd00('0x12')]){throw new Error(_0xdd00('0x13'));}var _0x5334d3=_0x457a59;var _0x44a9fb=_0xdd00('0x14')+_0x5ab7d4+_0xdd00('0x15')+_0x4df2a7+_0xdd00('0x16')+_0x5334d3+'&data='+JSON[_0xdd00('0x17')](_0x27057f);var _0x742f2e=_0x4d5d81+'?'+_0x44a9fb;return rp(_0x742f2e);})['then'](function(_0x43ed6f){logger[_0xdd00('0x18')](_0xdd00('0x19'),_0x4a597b,_0x43ed6f);_0x5c1443[_0xdd00('0x1a')]();})['catch'](function(_0x345e39){logger[_0xdd00('0x1b')](_0xdd00('0x1c'),_0x4a597b,_['isObject'](_0x345e39)?JSON['stringify'](_0x345e39):_0x345e39);_0x5c1443['stop']();});}else{logger[_0xdd00('0x18')]('[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next',_0x4a597b);_0x5c1443[_0xdd00('0x1d')]();}};}; \ 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 668dcab..8cbb49e 100644 --- a/server/services/routing/server/applications/utils.js +++ b/server/services/routing/server/applications/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['message','account','interaction','mustache','lodash','exports','render','body','contact'];(function(_0x24ca6f,_0x2fe69a){var _0x323cc5=function(_0x300cb8){while(--_0x300cb8){_0x24ca6f['push'](_0x24ca6f['shift']());}};_0x323cc5(++_0x2fe69a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xa9e0[_0x36dfbd];return _0x4ecad9;};'use strict';var Mustache=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'getMustacheRender':function(_0x5dd881,_0x550fbc){return Mustache[_0x0a9e('0x3')](_0x5dd881,_['merge'](_0x550fbc[_0x0a9e('0x4')],{'contact':_0x550fbc[_0x0a9e('0x5')],'message':_0x550fbc[_0x0a9e('0x6')],'account':_0x550fbc[_0x0a9e('0x7')],'interaction':_0x550fbc[_0x0a9e('0x8')],'list':_0x550fbc['list']}))||'';}}; \ No newline at end of file +var _0xa9e0=['message','account','interaction','mustache','lodash','exports','render','body','contact'];(function(_0x3ece7b,_0x411293){var _0x53d3eb=function(_0x4d77cb){while(--_0x4d77cb){_0x3ece7b['push'](_0x3ece7b['shift']());}};_0x53d3eb(++_0x411293);}(_0xa9e0,0x123));var _0x0a9e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'use strict';var Mustache=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'getMustacheRender':function(_0x5dd881,_0x550fbc){return Mustache[_0x0a9e('0x3')](_0x5dd881,_['merge'](_0x550fbc[_0x0a9e('0x4')],{'contact':_0x550fbc[_0x0a9e('0x5')],'message':_0x550fbc[_0x0a9e('0x6')],'account':_0x550fbc[_0x0a9e('0x7')],'interaction':_0x550fbc[_0x0a9e('0x8')],'list':_0x550fbc['list']}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 99b8d39..00f02a3 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 _0xf643=['../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','channel','message','interaction','checkWaitingNotifications','applications','length','join','.js','appdata','split','mail','push','slice','dialogflowv2','amazonlex','tag','TagId','getMustacheRender','notificationTemplate','ChatWebsiteId','ContactId','body','%s:%s:%s','./interval','condition','intervals','./applications/','consequence','priority','info','Push\x20new\x20rule','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','app','rules','execute','Applications\x20executed','stringify','matchPath','emit','complete','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','busy','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','busyQueue','end','hasOwnProperty','capacity','CurrentCapacity','agent\x20not\x20found','values','find','chatQueues','loggedIn','name','paused','mailQueues','available','waiting','openchannelQueues','smsQueues','faxQueues','chatQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','./applications/utils','./applications/strategy/util','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport'];(function(_0x1df87c,_0x4cb3a4){var _0x39c08d=function(_0x35196f){while(--_0x35196f){_0x1df87c['push'](_0x1df87c['shift']());}};_0x39c08d(++_0x4cb3a4);}(_0xf643,0x122));var _0x3f64=function(_0x2378ef,_0x1b182e){_0x2378ef=_0x2378ef-0x0;var _0x9dc6fb=_0xf643[_0x2378ef];return _0x9dc6fb;};'use strict';var _=require(_0x3f64('0x0'));var util=require(_0x3f64('0x1'));var path=require(_0x3f64('0x2'));var fs=require('fs');var jayson=require(_0x3f64('0x3'));var BPromise=require('bluebird');var utils=require(_0x3f64('0x4'));var sUtils=require(_0x3f64('0x5'));var logger=require('../../../config/logger')(_0x3f64('0x6'));var rpc={'openchannelQueueReport':require(_0x3f64('0x7')),'mailQueueReport':require(_0x3f64('0x8')),'chatQueueReport':require(_0x3f64('0x9')),'smsQueueReport':require(_0x3f64('0xa')),'faxQueueReport':require(_0x3f64('0xb')),'whatsappQueueReport':require(_0x3f64('0xc'))};var RuleEngine=require(_0x3f64('0xd'));function getId(_0x40b245,_0x2a7c90,_0x219dcb){return util[_0x3f64('0xe')](_0x3f64('0xf'),_0x40b245,_0x2a7c90||0x0,_0x219dcb||0x0);}function getIntervals(_0x268ef2,_0x2ec7ba){var _0x4ff35e=[];if(!_[_0x3f64('0x10')](_0x2ec7ba[_0x3f64('0x11')])&&!_[_0x3f64('0x10')](_0x268ef2[_0x2ec7ba['IntervalId']])&&!_[_0x3f64('0x10')](_0x268ef2[_0x2ec7ba[_0x3f64('0x11')]][_0x3f64('0x12')])){_0x4ff35e=_[_0x3f64('0x13')](_0x268ef2[_0x2ec7ba[_0x3f64('0x11')]][_0x3f64('0x12')],_0x3f64('0x14'));}else if(!_[_0x3f64('0x10')](_0x2ec7ba[_0x3f64('0x14')])){_0x4ff35e=[_0x2ec7ba[_0x3f64('0x14')]];}return _0x4ff35e;}exports[_0x3f64('0x15')]=function(_0x3165b6){_0x3165b6['rules']={};return new BPromise(function(_0x84d3a9,_0x1af45b){var _0x3fb0bd={'Start':function(_0x1f215d){var _0x52acab=this;return new Promise(function(_0x1c4059,_0x1c17bb){if(_0x1f215d){try{var _0x2650a1=[];var _0x3e9c46=getId(_0x1f215d[_0x3f64('0x16')],_0x1f215d[_0x3f64('0x17')]?_0x1f215d[_0x3f64('0x17')]['id']:0x0,_0x1f215d['interaction']?_0x1f215d[_0x3f64('0x18')]['id']:0x0);var _0x7bca32=sUtils[_0x3f64('0x19')](_0x3165b6,_0x1f215d);if(_0x1f215d['transfer']||!_0x7bca32&&_0x1f215d[_0x3f64('0x1a')]&&_['isArray'](_0x1f215d['applications'])&&_0x1f215d[_0x3f64('0x1a')][_0x3f64('0x1b')]){for(var _0x15d0fb=0x0;_0x15d0fb<_0x1f215d['applications'][_0x3f64('0x1b')];_0x15d0fb+=0x1){var _0x301d72=_0x1f215d[_0x3f64('0x1a')][_0x15d0fb];if(fs['existsSync'](path[_0x3f64('0x1c')](__dirname,_0x3f64('0x1a'),_0x301d72['app']+_0x3f64('0x1d')))){var _0x3faf46=[];switch(_0x301d72['app']['toLowerCase']()){case'autoreply':var _0x3f1bb2=_0x301d72[_0x3f64('0x1e')][_0x3f64('0x1f')](',');if(_0x1f215d[_0x3f64('0x16')]===_0x3f64('0x20')){_0x3faf46['push'](_0x3f1bb2[0x0]);_0x3faf46[_0x3f64('0x21')](_0x3f1bb2[0x1]);_0x3faf46[_0x3f64('0x21')](_0x3f1bb2[_0x3f64('0x22')](0x2,_0x3f1bb2[_0x3f64('0x1b')])[_0x3f64('0x1c')](','));}else{_0x3faf46[_0x3f64('0x21')](_0x3f1bb2[0x0]);_0x3faf46[_0x3f64('0x21')](_0x3f1bb2[_0x3f64('0x22')](0x1,_0x3f1bb2['length'])[_0x3f64('0x1c')](','));}break;case'dialogflow':var _0x473b46=_0x301d72[_0x3f64('0x1e')][_0x3f64('0x1f')](',');_0x3faf46[_0x3f64('0x21')](_0x473b46[0x0]);_0x3faf46[_0x3f64('0x21')](_0x473b46[0x1]);_0x3faf46[_0x3f64('0x21')](_0x473b46[_0x3f64('0x22')](0x2,_0x473b46[_0x3f64('0x1b')])[_0x3f64('0x1c')](','));break;case _0x3f64('0x23'):var _0x545cc8=_0x301d72['appdata'][_0x3f64('0x1f')](',');_0x3faf46['push'](_0x545cc8[0x0]);_0x3faf46[_0x3f64('0x21')](_0x545cc8[0x1]);_0x3faf46[_0x3f64('0x21')](_0x545cc8[0x2]);_0x3faf46[_0x3f64('0x21')](_0x545cc8[0x3]);_0x3faf46[_0x3f64('0x21')](_0x545cc8['slice'](0x4,_0x545cc8['length'])[_0x3f64('0x1c')](','));break;case _0x3f64('0x24'):var _0x1851c6=_0x301d72[_0x3f64('0x1e')]['split'](',');_0x3faf46[_0x3f64('0x21')](_0x1851c6[0x0]);_0x3faf46['push'](_0x1851c6[0x1]);_0x3faf46['push'](_0x1851c6[0x2]);_0x3faf46['push'](_0x1851c6[0x3]);_0x3faf46[_0x3f64('0x21')](_0x1851c6['slice'](0x4,_0x1851c6[_0x3f64('0x1b')])['join'](','));break;case _0x3f64('0x17'):_0x3faf46[_0x3f64('0x21')](_0x301d72[_0x3f64('0x1e')]);break;case _0x3f64('0x25'):_0x3faf46['push'](_0x301d72[_0x3f64('0x26')]);_0x3faf46[_0x3f64('0x21')](_0x301d72[_0x3f64('0x1e')]);break;case'tvox':var _0x54648f=utils[_0x3f64('0x27')](_0x1f215d['account'][_0x3f64('0x28')],_0x1f215d);var _0x112940=_0x301d72[_0x3f64('0x1e')]['split'](',');_0x3faf46[_0x3f64('0x21')](_0x112940[0x0]);_0x3faf46[_0x3f64('0x21')](_0x112940[0x1]);_0x3faf46[_0x3f64('0x21')](_0x112940[0x2]);_0x3faf46[_0x3f64('0x21')](_0x112940[0x3]);_0x3faf46[_0x3f64('0x21')](_0x112940[0x4]);_0x3faf46[_0x3f64('0x21')](_0x112940[0x5]);_0x3faf46[_0x3f64('0x21')](_0x112940[0x6]);_0x3faf46[_0x3f64('0x21')](_0x112940[0x7]);_0x3faf46[_0x3f64('0x21')](_0x112940[0x8]);_0x3faf46[_0x3f64('0x21')](_0x112940[0x9]);_0x3faf46[_0x3f64('0x21')](_0x112940[0xa]);_0x3faf46[_0x3f64('0x21')](_0x1f215d[_0x3f64('0x18')]['id']);_0x3faf46[_0x3f64('0x21')](_0x1f215d['message']['id']);_0x3faf46[_0x3f64('0x21')](_0x301d72[_0x3f64('0x29')]);_0x3faf46[_0x3f64('0x21')](_0x1f215d['interaction'][_0x3f64('0x2a')]);_0x3faf46[_0x3f64('0x21')](_0x1f215d[_0x3f64('0x2b')][_0x3f64('0x2b')]);_0x3faf46[_0x3f64('0x21')](_0x54648f);break;default:_0x3faf46=_[_0x3f64('0x10')](_0x301d72['appdata'])?[]:_0x301d72[_0x3f64('0x1e')]['split'](',');}var _0x1c91e7={'id':util[_0x3f64('0xe')](_0x3f64('0x2c'),_0x3e9c46,_0x301d72['id'],_0x301d72['app']),'condition':require(_0x3f64('0x2d'))[_0x3f64('0x2e')](_0x3e9c46,getIntervals(_0x3165b6[_0x3f64('0x2f')],_0x301d72),_0x3165b6),'consequence':require(_0x3f64('0x30')+_0x301d72['app'])[_0x3f64('0x31')](_0x3e9c46,_0x3faf46,_0x3165b6,_0x1f215d),'p':_0x301d72[_0x3f64('0x32')]||0x0};logger[_0x3f64('0x33')](_0x3f64('0x34'),_0x1c91e7['id'],'on\x20interval',getIntervals(_0x3165b6['intervals'],_0x301d72)[_0x3f64('0x1c')](_0x3f64('0x35')));_0x2650a1['push'](_0x1c91e7);}else{logger[_0x3f64('0x36')](_0x3f64('0x37'),path[_0x3f64('0x1c')](__dirname,'applications',_0x301d72[_0x3f64('0x38')]+_0x3f64('0x1d')));}}_0x3165b6['rules'][_0x3e9c46]=new RuleEngine(_0x2650a1);_0x3165b6[_0x3f64('0x39')][_0x3e9c46][_0x3f64('0x3a')](_0x1f215d,function(_0x12a382){logger[_0x3f64('0x33')](_0x3f64('0x3b'),JSON[_0x3f64('0x3c')](_0x12a382[_0x3f64('0x3d')]));if(_0x3165b6[_0x3f64('0x39')][_0x3e9c46]){_0x3165b6[_0x3f64('0x39')][_0x3e9c46][_0x3f64('0x3e')](_0x3f64('0x3f'));}});return _0x1c4059({'code':0xc8,'message':_0x1f215d});}else{if(_0x7bca32){logger[_0x3f64('0x33')](util[_0x3f64('0xe')]('Skipped\x20routing\x20for\x20%s',_0x3e9c46));}else{logger['info'](_0x3f64('0x40'));}return _0x1c4059({'code':0xc8,'message':_0x1f215d});}}catch(_0x1cb5c7){logger[_0x3f64('0x36')](_0x1cb5c7[_0x3f64('0x41')]);return _0x1c17bb(_0x52acab['error'](0x1f4,_0x1cb5c7));}}return _0x1c17bb(_0x3f64('0x42'));});},'AcceptMessage':function(_0x21b2ca){var _0x2a14b7=this;return new Promise(function(_0x2f5a71,_0x3d0e01){if(_0x21b2ca[_0x3f64('0x43')]&&_0x21b2ca[_0x3f64('0x43')]['id']){if(_0x3165b6[_0x3f64('0x44')][_0x21b2ca[_0x3f64('0x43')]['id']]){_0x3165b6['agents'][_0x21b2ca[_0x3f64('0x43')]['id']][_0x3f64('0x45')]=![];_0x3165b6[_0x3f64('0x44')][_0x21b2ca[_0x3f64('0x43')]['id']]['busyQueue']=undefined;}}if(_0x21b2ca[_0x3f64('0x17')]&&_0x21b2ca[_0x3f64('0x17')]['id']){try{var _0x4cb526=getId(_0x21b2ca[_0x3f64('0x16')],_0x21b2ca[_0x3f64('0x17')]?_0x21b2ca[_0x3f64('0x17')]['id']:0x0,_0x21b2ca[_0x3f64('0x18')]?_0x21b2ca[_0x3f64('0x18')]['id']:0x0);if(_0x3165b6['rules'][_0x4cb526]){_0x3165b6['rules'][_0x4cb526][_0x3f64('0x3e')]('end');if(rpc[_0x21b2ca[_0x3f64('0x16')]+_0x3f64('0x46')]){rpc[_0x21b2ca[_0x3f64('0x16')]+'QueueReport'][_0x3f64('0x47')](_0x4cb526,{'UserId':_0x21b2ca[_0x3f64('0x17')][_0x3f64('0x48')]})[_0x3f64('0x49')](function(){logger['error'](_0x3f64('0x4a'));});}}return _0x2f5a71({'code':0xc8,'message':_0x21b2ca});}catch(_0x4b4634){logger['error'](_0x4b4634[_0x3f64('0x41')]);return _0x3d0e01(_0x2a14b7[_0x3f64('0x36')](0x1f4,_0x4b4634));}}logger[_0x3f64('0x36')](_0x3f64('0x4b'));return _0x3d0e01(_0x2a14b7['error'](0x1f4,_0x3f64('0x4b')));});},'RejectMessage':function(_0x59d824){var _0x3a2fb9=this;return new Promise(function(_0x52132b,_0x569613){if(_0x59d824[_0x3f64('0x43')]&&_0x59d824[_0x3f64('0x43')]['id']){try{if(_0x3165b6[_0x3f64('0x44')][_0x59d824[_0x3f64('0x43')]['id']]){_0x3165b6[_0x3f64('0x44')][_0x59d824[_0x3f64('0x43')]['id']][_0x3f64('0x45')]=![];_0x3165b6[_0x3f64('0x44')][_0x59d824['agent']['id']][_0x3f64('0x4c')]=undefined;}return _0x52132b({'code':0xc8,'message':_0x59d824});}catch(_0x3cd135){logger[_0x3f64('0x36')](_0x3cd135[_0x3f64('0x41')]);return _0x569613(_0x3a2fb9[_0x3f64('0x36')](0x1f4,_0x3cd135));}}logger['error']('message\x20is\x20empty');return _0x569613(_0x3a2fb9[_0x3f64('0x36')](0x1f4,_0x3f64('0x4b')));});},'AbandonInteraction':function(_0x1bb093){var _0x2ad021=this;return new Promise(function(_0x5f05b8,_0x2b0233){if(_0x1bb093[_0x3f64('0x16')]&&_0x1bb093[_0x3f64('0x18')]&&_0x1bb093[_0x3f64('0x18')]['id']){try{var _0x1c40aa=getId(_0x1bb093['channel'],_0x1bb093[_0x3f64('0x17')]?_0x1bb093['message']['id']:0x0,_0x1bb093[_0x3f64('0x18')]?_0x1bb093[_0x3f64('0x18')]['id']:0x0);if(_0x3165b6[_0x3f64('0x39')][_0x1c40aa]){_0x3165b6['rules'][_0x1c40aa][_0x3f64('0x3e')](_0x3f64('0x4d'));}return _0x5f05b8({'code':0xc8,'message':_0x1bb093});}catch(_0x2e8e3c){logger['error'](_0x2e8e3c[_0x3f64('0x41')]);return _0x2b0233(_0x2ad021[_0x3f64('0x36')](0x1f4,_0x2e8e3c));}}logger[_0x3f64('0x36')]('message\x20is\x20empty');return _0x2b0233(_0x2ad021[_0x3f64('0x36')](0x1f4,_0x3f64('0x4b')));});},'AgentCapacity':function(_0x47bd9e){var _0x350c5f=this;return new Promise(function(_0x2ea0fb,_0x44d59c){if(_0x3165b6['agents'][_0x3f64('0x4e')](_0x47bd9e['id'])){for(var _0x54c3c9 in _0x47bd9e['capacity']){if(_0x47bd9e[_0x3f64('0x4f')][_0x3f64('0x4e')](_0x54c3c9)){if(_0x3165b6[_0x3f64('0x44')][_0x47bd9e['id']][_0x3f64('0x4e')](_0x54c3c9+_0x3f64('0x50'))){_0x3165b6[_0x3f64('0x44')][_0x47bd9e['id']][_0x54c3c9+_0x3f64('0x50')]=parseInt(_0x47bd9e[_0x3f64('0x4f')][_0x54c3c9],0xa);}}}_0x3165b6[_0x3f64('0x44')][_0x47bd9e['id']]['updateRealtime']();return _0x2ea0fb({'code':0xc8,'message':_0x3165b6['agents'][_0x47bd9e['id']]});}else{return _0x44d59c(_0x350c5f[_0x3f64('0x36')](0x1f4,_0x3f64('0x51')));}});},'Agents':function(_0x53e5af){return new Promise(function(_0x104f89){var _0x4ad862=_[_0x3f64('0x52')](_0x3165b6[_0x3f64('0x44')]);if(_0x53e5af&&_0x53e5af['id']){var _0x10f07f=_[_0x3f64('0x53')](_0x4ad862,function(_0x246c80){return _0x246c80['id']===_0x53e5af['id'];});_0x104f89(_0x10f07f);}else{_0x104f89({'count':_0x4ad862[_0x3f64('0x1b')],'rows':_0x4ad862});}});},'ChatQueues':function(){return new Promise(function(_0x2c9a4c){var _0x5a6783=[];for(var _0xcb95c0 in _0x3165b6[_0x3f64('0x54')]){if(_0x3165b6[_0x3f64('0x54')][_0x3f64('0x4e')](_0xcb95c0)){var _0x3bb188=_0x3165b6[_0x3f64('0x54')][_0xcb95c0];var _0x517f40={'id':_0x3bb188['id'],'available':_0x3bb188['available'],'loggedIn':_0x3bb188[_0x3f64('0x55')],'name':_0x3bb188[_0x3f64('0x56')],'paused':_0x3bb188[_0x3f64('0x57')],'waiting':_0x3bb188['waiting']};_0x5a6783[_0x3f64('0x21')](_0x517f40);}}_0x2c9a4c({'count':_0x5a6783[_0x3f64('0x1b')],'rows':_0x5a6783});});},'MailQueues':function(){return new Promise(function(_0x39c72a){var _0x2cc4df=[];for(var _0x45abbd in _0x3165b6['mailQueues']){if(_0x3165b6[_0x3f64('0x58')][_0x3f64('0x4e')](_0x45abbd)){var _0x56c94f=_0x3165b6[_0x3f64('0x58')][_0x45abbd];var _0x16034e={'id':_0x56c94f['id'],'available':_0x56c94f[_0x3f64('0x59')],'loggedIn':_0x56c94f['loggedIn'],'name':_0x56c94f[_0x3f64('0x56')],'paused':_0x56c94f['paused'],'waiting':_0x56c94f[_0x3f64('0x5a')]};_0x2cc4df[_0x3f64('0x21')](_0x16034e);}}_0x39c72a({'count':_0x2cc4df[_0x3f64('0x1b')],'rows':_0x2cc4df});});},'OpenchannelQueues':function(){return new Promise(function(_0x3af4e1){var _0x3a349d=[];for(var _0x45d803 in _0x3165b6[_0x3f64('0x5b')]){if(_0x3165b6['openchannelQueues']['hasOwnProperty'](_0x45d803)){var _0x50d3cf=_0x3165b6[_0x3f64('0x5b')][_0x45d803];var _0xcf5dd4={'id':_0x50d3cf['id'],'available':_0x50d3cf[_0x3f64('0x59')],'loggedIn':_0x50d3cf[_0x3f64('0x55')],'name':_0x50d3cf[_0x3f64('0x56')],'paused':_0x50d3cf['paused'],'waiting':_0x50d3cf[_0x3f64('0x5a')]};_0x3a349d[_0x3f64('0x21')](_0xcf5dd4);}}_0x3af4e1({'count':_0x3a349d[_0x3f64('0x1b')],'rows':_0x3a349d});});},'SmsQueues':function(){return new Promise(function(_0x142442){var _0x513aed=[];for(var _0x1af86d in _0x3165b6[_0x3f64('0x5c')]){if(_0x3165b6[_0x3f64('0x5c')]['hasOwnProperty'](_0x1af86d)){var _0x92b8a8=_0x3165b6[_0x3f64('0x5c')][_0x1af86d];var _0x3c61ab={'id':_0x92b8a8['id'],'available':_0x92b8a8[_0x3f64('0x59')],'loggedIn':_0x92b8a8[_0x3f64('0x55')],'name':_0x92b8a8[_0x3f64('0x56')],'paused':_0x92b8a8[_0x3f64('0x57')],'waiting':_0x92b8a8[_0x3f64('0x5a')]};_0x513aed['push'](_0x3c61ab);}}_0x142442({'count':_0x513aed['length'],'rows':_0x513aed});});},'FaxQueues':function(){return new Promise(function(_0x134e00){var _0x1c4450=[];for(var _0x559399 in _0x3165b6[_0x3f64('0x5d')]){if(_0x3165b6[_0x3f64('0x5d')][_0x3f64('0x4e')](_0x559399)){var _0x4a0274=_0x3165b6[_0x3f64('0x5d')][_0x559399];var _0x3d3cd0={'id':_0x4a0274['id'],'available':_0x4a0274[_0x3f64('0x59')],'loggedIn':_0x4a0274[_0x3f64('0x55')],'name':_0x4a0274[_0x3f64('0x56')],'paused':_0x4a0274[_0x3f64('0x57')],'waiting':_0x4a0274[_0x3f64('0x5a')]};_0x1c4450[_0x3f64('0x21')](_0x3d3cd0);}}_0x134e00({'count':_0x1c4450[_0x3f64('0x1b')],'rows':_0x1c4450});});},'WhatsappQueues':function(){return new Promise(function(_0x3015e5){var _0x5736b1=[];for(var _0x47dccd in _0x3165b6['whatsappQueues']){if(_0x3165b6['whatsappQueues'][_0x3f64('0x4e')](_0x47dccd)){var _0x34e5fa=_0x3165b6['whatsappQueues'][_0x47dccd];var _0x2dc3f4={'id':_0x34e5fa['id'],'available':_0x34e5fa[_0x3f64('0x59')],'loggedIn':_0x34e5fa[_0x3f64('0x55')],'name':_0x34e5fa[_0x3f64('0x56')],'paused':_0x34e5fa['paused'],'waiting':_0x34e5fa['waiting']};_0x5736b1[_0x3f64('0x21')](_0x2dc3f4);}}_0x3015e5({'count':_0x5736b1['length'],'rows':_0x5736b1});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x6f0dc){var _0x5870d4=_['values'](_0x3165b6[_0x3f64('0x5e')]);_0x6f0dc({'count':_0x5870d4[_0x3f64('0x1b')],'rows':_0x5870d4});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x2fa1ed){var _0x8e8a38=_[_0x3f64('0x52')](_0x3165b6['mailQueuesWaitingInteractions']);_0x2fa1ed({'count':_0x8e8a38[_0x3f64('0x1b')],'rows':_0x8e8a38});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x3aa76b){var _0x10d1fc=_[_0x3f64('0x52')](_0x3165b6[_0x3f64('0x5f')]);_0x3aa76b({'count':_0x10d1fc[_0x3f64('0x1b')],'rows':_0x10d1fc});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x377cd5){var _0x2ff5d4=_[_0x3f64('0x52')](_0x3165b6[_0x3f64('0x60')]);_0x377cd5({'count':_0x2ff5d4['length'],'rows':_0x2ff5d4});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x4a3960){var _0x2ee21d=_[_0x3f64('0x52')](_0x3165b6['faxQueuesWaitingInteractions']);_0x4a3960({'count':_0x2ee21d['length'],'rows':_0x2ee21d});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x1b269f){var _0x439e65=_[_0x3f64('0x52')](_0x3165b6[_0x3f64('0x61')]);_0x1b269f({'count':_0x439e65[_0x3f64('0x1b')],'rows':_0x439e65});});}};var _0x4af95a=jayson[_0x3f64('0x62')](_0x3fb0bd)[_0x3f64('0x63')]();_0x4af95a['on'](_0x3f64('0x36'),function(_0x51938e){logger['error'](JSON['stringify'](_0x51938e));return _0x1af45b(_0x51938e);});_0x4af95a[_0x3f64('0x15')](0x232c,'127.0.0.1',function(){console['log']('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x84d3a9(_0x3f64('0x64')+0x232c);});});}; \ No newline at end of file +var _0x3c8b=['log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','util','jayson/promise','bluebird','./applications/utils','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','format','isNil','IntervalId','Intervals','interval','listen','channel','message','interaction','checkWaitingNotifications','transfer','applications','join','app','.js','toLowerCase','appdata','split','mail','push','slice','length','dialogflowv2','amazonlex','TagId','tvox','account','ChatWebsiteId','body','%s:%s:%s','./interval','condition','intervals','./applications/','consequence','priority','info','Push\x20new\x20rule','\x20|\x20','Please\x20create\x20a\x20new\x20file\x20under','rules','execute','stringify','emit','complete','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','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','values','find','chatQueues','paused','waiting','mailQueues','loggedIn','openchannelQueues','available','name','smsQueues','faxQueues','whatsappQueues','openchannelQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','127.0.0.1'];(function(_0x4f6c36,_0x3ce971){var _0x344008=function(_0x39aa77){while(--_0x39aa77){_0x4f6c36['push'](_0x4f6c36['shift']());}};_0x344008(++_0x3ce971);}(_0x3c8b,0x18b));var _0xb3c8=function(_0x8add64,_0x190dc5){_0x8add64=_0x8add64-0x0;var _0x1ace07=_0x3c8b[_0x8add64];return _0x1ace07;};'use strict';var _=require('lodash');var util=require(_0xb3c8('0x0'));var path=require('path');var fs=require('fs');var jayson=require(_0xb3c8('0x1'));var BPromise=require(_0xb3c8('0x2'));var utils=require(_0xb3c8('0x3'));var sUtils=require('./applications/strategy/util');var logger=require(_0xb3c8('0x4'))(_0xb3c8('0x5'));var rpc={'openchannelQueueReport':require(_0xb3c8('0x6')),'mailQueueReport':require(_0xb3c8('0x7')),'chatQueueReport':require(_0xb3c8('0x8')),'smsQueueReport':require(_0xb3c8('0x9')),'faxQueueReport':require(_0xb3c8('0xa')),'whatsappQueueReport':require(_0xb3c8('0xb'))};var RuleEngine=require('../lib/rule-engine');function getId(_0x13c8f3,_0x5ec6a7,_0x460956){return util[_0xb3c8('0xc')]('%s.%s.%s',_0x13c8f3,_0x5ec6a7||0x0,_0x460956||0x0);}function getIntervals(_0x5cb72f,_0x4790d0){var _0x3cea69=[];if(!_[_0xb3c8('0xd')](_0x4790d0[_0xb3c8('0xe')])&&!_['isNil'](_0x5cb72f[_0x4790d0[_0xb3c8('0xe')]])&&!_[_0xb3c8('0xd')](_0x5cb72f[_0x4790d0[_0xb3c8('0xe')]][_0xb3c8('0xf')])){_0x3cea69=_['map'](_0x5cb72f[_0x4790d0[_0xb3c8('0xe')]]['Intervals'],_0xb3c8('0x10'));}else if(!_['isNil'](_0x4790d0[_0xb3c8('0x10')])){_0x3cea69=[_0x4790d0[_0xb3c8('0x10')]];}return _0x3cea69;}exports[_0xb3c8('0x11')]=function(_0x5eaa0f){_0x5eaa0f['rules']={};return new BPromise(function(_0xa2a80c,_0x2b38e4){var _0xcaf9a7={'Start':function(_0x48a430){var _0x5b079a=this;return new Promise(function(_0x89f267,_0x1ae662){if(_0x48a430){try{var _0x124ab6=[];var _0x47edd7=getId(_0x48a430[_0xb3c8('0x12')],_0x48a430[_0xb3c8('0x13')]?_0x48a430[_0xb3c8('0x13')]['id']:0x0,_0x48a430[_0xb3c8('0x14')]?_0x48a430[_0xb3c8('0x14')]['id']:0x0);var _0x98399d=sUtils[_0xb3c8('0x15')](_0x5eaa0f,_0x48a430);if(_0x48a430[_0xb3c8('0x16')]||!_0x98399d&&_0x48a430[_0xb3c8('0x17')]&&_['isArray'](_0x48a430['applications'])&&_0x48a430[_0xb3c8('0x17')]['length']){for(var _0x4d4bda=0x0;_0x4d4bda<_0x48a430[_0xb3c8('0x17')]['length'];_0x4d4bda+=0x1){var _0x133372=_0x48a430['applications'][_0x4d4bda];if(fs['existsSync'](path[_0xb3c8('0x18')](__dirname,'applications',_0x133372[_0xb3c8('0x19')]+_0xb3c8('0x1a')))){var _0x34b11c=[];switch(_0x133372['app'][_0xb3c8('0x1b')]()){case'autoreply':var _0xdd0720=_0x133372[_0xb3c8('0x1c')][_0xb3c8('0x1d')](',');if(_0x48a430[_0xb3c8('0x12')]===_0xb3c8('0x1e')){_0x34b11c[_0xb3c8('0x1f')](_0xdd0720[0x0]);_0x34b11c[_0xb3c8('0x1f')](_0xdd0720[0x1]);_0x34b11c[_0xb3c8('0x1f')](_0xdd0720[_0xb3c8('0x20')](0x2,_0xdd0720['length'])[_0xb3c8('0x18')](','));}else{_0x34b11c['push'](_0xdd0720[0x0]);_0x34b11c[_0xb3c8('0x1f')](_0xdd0720[_0xb3c8('0x20')](0x1,_0xdd0720[_0xb3c8('0x21')])[_0xb3c8('0x18')](','));}break;case'dialogflow':var _0x446c77=_0x133372[_0xb3c8('0x1c')][_0xb3c8('0x1d')](',');_0x34b11c[_0xb3c8('0x1f')](_0x446c77[0x0]);_0x34b11c[_0xb3c8('0x1f')](_0x446c77[0x1]);_0x34b11c[_0xb3c8('0x1f')](_0x446c77[_0xb3c8('0x20')](0x2,_0x446c77['length'])[_0xb3c8('0x18')](','));break;case _0xb3c8('0x22'):var _0x4bd70e=_0x133372[_0xb3c8('0x1c')][_0xb3c8('0x1d')](',');_0x34b11c[_0xb3c8('0x1f')](_0x4bd70e[0x0]);_0x34b11c[_0xb3c8('0x1f')](_0x4bd70e[0x1]);_0x34b11c[_0xb3c8('0x1f')](_0x4bd70e[0x2]);_0x34b11c[_0xb3c8('0x1f')](_0x4bd70e[0x3]);_0x34b11c[_0xb3c8('0x1f')](_0x4bd70e['slice'](0x4,_0x4bd70e[_0xb3c8('0x21')])[_0xb3c8('0x18')](','));break;case _0xb3c8('0x23'):var _0x320e3f=_0x133372[_0xb3c8('0x1c')]['split'](',');_0x34b11c[_0xb3c8('0x1f')](_0x320e3f[0x0]);_0x34b11c[_0xb3c8('0x1f')](_0x320e3f[0x1]);_0x34b11c[_0xb3c8('0x1f')](_0x320e3f[0x2]);_0x34b11c[_0xb3c8('0x1f')](_0x320e3f[0x3]);_0x34b11c[_0xb3c8('0x1f')](_0x320e3f[_0xb3c8('0x20')](0x4,_0x320e3f[_0xb3c8('0x21')])[_0xb3c8('0x18')](','));break;case _0xb3c8('0x13'):_0x34b11c['push'](_0x133372[_0xb3c8('0x1c')]);break;case'tag':_0x34b11c[_0xb3c8('0x1f')](_0x133372[_0xb3c8('0x24')]);_0x34b11c[_0xb3c8('0x1f')](_0x133372[_0xb3c8('0x1c')]);break;case _0xb3c8('0x25'):var _0x34e73f=utils['getMustacheRender'](_0x48a430[_0xb3c8('0x26')]['notificationTemplate'],_0x48a430);var _0x3e825d=_0x133372[_0xb3c8('0x1c')][_0xb3c8('0x1d')](',');_0x34b11c[_0xb3c8('0x1f')](_0x3e825d[0x0]);_0x34b11c['push'](_0x3e825d[0x1]);_0x34b11c[_0xb3c8('0x1f')](_0x3e825d[0x2]);_0x34b11c[_0xb3c8('0x1f')](_0x3e825d[0x3]);_0x34b11c[_0xb3c8('0x1f')](_0x3e825d[0x4]);_0x34b11c[_0xb3c8('0x1f')](_0x3e825d[0x5]);_0x34b11c[_0xb3c8('0x1f')](_0x3e825d[0x6]);_0x34b11c[_0xb3c8('0x1f')](_0x3e825d[0x7]);_0x34b11c['push'](_0x3e825d[0x8]);_0x34b11c[_0xb3c8('0x1f')](_0x3e825d[0x9]);_0x34b11c[_0xb3c8('0x1f')](_0x3e825d[0xa]);_0x34b11c[_0xb3c8('0x1f')](_0x48a430[_0xb3c8('0x14')]['id']);_0x34b11c[_0xb3c8('0x1f')](_0x48a430['message']['id']);_0x34b11c['push'](_0x133372[_0xb3c8('0x27')]);_0x34b11c[_0xb3c8('0x1f')](_0x48a430[_0xb3c8('0x14')]['ContactId']);_0x34b11c[_0xb3c8('0x1f')](_0x48a430['body'][_0xb3c8('0x28')]);_0x34b11c[_0xb3c8('0x1f')](_0x34e73f);break;default:_0x34b11c=_[_0xb3c8('0xd')](_0x133372['appdata'])?[]:_0x133372[_0xb3c8('0x1c')][_0xb3c8('0x1d')](',');}var _0x2737bd={'id':util[_0xb3c8('0xc')](_0xb3c8('0x29'),_0x47edd7,_0x133372['id'],_0x133372[_0xb3c8('0x19')]),'condition':require(_0xb3c8('0x2a'))[_0xb3c8('0x2b')](_0x47edd7,getIntervals(_0x5eaa0f[_0xb3c8('0x2c')],_0x133372),_0x5eaa0f),'consequence':require(_0xb3c8('0x2d')+_0x133372['app'])[_0xb3c8('0x2e')](_0x47edd7,_0x34b11c,_0x5eaa0f,_0x48a430),'p':_0x133372[_0xb3c8('0x2f')]||0x0};logger[_0xb3c8('0x30')](_0xb3c8('0x31'),_0x2737bd['id'],'on\x20interval',getIntervals(_0x5eaa0f['intervals'],_0x133372)[_0xb3c8('0x18')](_0xb3c8('0x32')));_0x124ab6[_0xb3c8('0x1f')](_0x2737bd);}else{logger['error'](_0xb3c8('0x33'),path[_0xb3c8('0x18')](__dirname,_0xb3c8('0x17'),_0x133372[_0xb3c8('0x19')]+_0xb3c8('0x1a')));}}_0x5eaa0f['rules'][_0x47edd7]=new RuleEngine(_0x124ab6);_0x5eaa0f[_0xb3c8('0x34')][_0x47edd7][_0xb3c8('0x35')](_0x48a430,function(_0x314304){logger['info']('Applications\x20executed',JSON[_0xb3c8('0x36')](_0x314304['matchPath']));if(_0x5eaa0f[_0xb3c8('0x34')][_0x47edd7]){_0x5eaa0f[_0xb3c8('0x34')][_0x47edd7][_0xb3c8('0x37')](_0xb3c8('0x38'));}});return _0x89f267({'code':0xc8,'message':_0x48a430});}else{if(_0x98399d){logger['info'](util['format'](_0xb3c8('0x39'),_0x47edd7));}else{logger[_0xb3c8('0x30')](_0xb3c8('0x3a'));}return _0x89f267({'code':0xc8,'message':_0x48a430});}}catch(_0x411884){logger['error'](_0x411884['stack']);return _0x1ae662(_0x5b079a['error'](0x1f4,_0x411884));}}return _0x1ae662(_0xb3c8('0x3b'));});},'AcceptMessage':function(_0x35f3b2){var _0x1ae0bf=this;return new Promise(function(_0x91bad9,_0x2af6d6){if(_0x35f3b2['agent']&&_0x35f3b2[_0xb3c8('0x3c')]['id']){if(_0x5eaa0f[_0xb3c8('0x3d')][_0x35f3b2[_0xb3c8('0x3c')]['id']]){_0x5eaa0f[_0xb3c8('0x3d')][_0x35f3b2[_0xb3c8('0x3c')]['id']][_0xb3c8('0x3e')]=![];_0x5eaa0f[_0xb3c8('0x3d')][_0x35f3b2[_0xb3c8('0x3c')]['id']][_0xb3c8('0x3f')]=undefined;}}if(_0x35f3b2['message']&&_0x35f3b2[_0xb3c8('0x13')]['id']){try{var _0x2f0b20=getId(_0x35f3b2[_0xb3c8('0x12')],_0x35f3b2[_0xb3c8('0x13')]?_0x35f3b2[_0xb3c8('0x13')]['id']:0x0,_0x35f3b2['interaction']?_0x35f3b2[_0xb3c8('0x14')]['id']:0x0);if(_0x5eaa0f['rules'][_0x2f0b20]){_0x5eaa0f[_0xb3c8('0x34')][_0x2f0b20][_0xb3c8('0x37')](_0xb3c8('0x40'));if(rpc[_0x35f3b2[_0xb3c8('0x12')]+_0xb3c8('0x41')]){rpc[_0x35f3b2[_0xb3c8('0x12')]+_0xb3c8('0x41')][_0xb3c8('0x42')](_0x2f0b20,{'UserId':_0x35f3b2[_0xb3c8('0x13')][_0xb3c8('0x43')]})[_0xb3c8('0x44')](function(){logger[_0xb3c8('0x45')]('error\x20update\x20queue\x20report');});}}return _0x91bad9({'code':0xc8,'message':_0x35f3b2});}catch(_0x7ff03f){logger[_0xb3c8('0x45')](_0x7ff03f[_0xb3c8('0x46')]);return _0x2af6d6(_0x1ae0bf[_0xb3c8('0x45')](0x1f4,_0x7ff03f));}}logger['error'](_0xb3c8('0x47'));return _0x2af6d6(_0x1ae0bf['error'](0x1f4,_0xb3c8('0x47')));});},'RejectMessage':function(_0x374ea6){var _0x48f7c7=this;return new Promise(function(_0x3b5ed0,_0x5bc14c){if(_0x374ea6[_0xb3c8('0x3c')]&&_0x374ea6[_0xb3c8('0x3c')]['id']){try{if(_0x5eaa0f[_0xb3c8('0x3d')][_0x374ea6[_0xb3c8('0x3c')]['id']]){_0x5eaa0f[_0xb3c8('0x3d')][_0x374ea6[_0xb3c8('0x3c')]['id']][_0xb3c8('0x3e')]=![];_0x5eaa0f[_0xb3c8('0x3d')][_0x374ea6['agent']['id']][_0xb3c8('0x3f')]=undefined;}return _0x3b5ed0({'code':0xc8,'message':_0x374ea6});}catch(_0x117f86){logger[_0xb3c8('0x45')](_0x117f86[_0xb3c8('0x46')]);return _0x5bc14c(_0x48f7c7[_0xb3c8('0x45')](0x1f4,_0x117f86));}}logger[_0xb3c8('0x45')](_0xb3c8('0x47'));return _0x5bc14c(_0x48f7c7[_0xb3c8('0x45')](0x1f4,_0xb3c8('0x47')));});},'AbandonInteraction':function(_0x495955){var _0x471c48=this;return new Promise(function(_0x2d6d64,_0x5c1903){if(_0x495955[_0xb3c8('0x12')]&&_0x495955[_0xb3c8('0x14')]&&_0x495955['interaction']['id']){try{var _0x37376d=getId(_0x495955[_0xb3c8('0x12')],_0x495955[_0xb3c8('0x13')]?_0x495955[_0xb3c8('0x13')]['id']:0x0,_0x495955[_0xb3c8('0x14')]?_0x495955['interaction']['id']:0x0);if(_0x5eaa0f[_0xb3c8('0x34')][_0x37376d]){_0x5eaa0f[_0xb3c8('0x34')][_0x37376d][_0xb3c8('0x37')](_0xb3c8('0x40'));}return _0x2d6d64({'code':0xc8,'message':_0x495955});}catch(_0x3b802c){logger[_0xb3c8('0x45')](_0x3b802c[_0xb3c8('0x46')]);return _0x5c1903(_0x471c48[_0xb3c8('0x45')](0x1f4,_0x3b802c));}}logger[_0xb3c8('0x45')](_0xb3c8('0x47'));return _0x5c1903(_0x471c48[_0xb3c8('0x45')](0x1f4,_0xb3c8('0x47')));});},'AgentCapacity':function(_0x180691){var _0x1b9e13=this;return new Promise(function(_0x460bb4,_0x29f726){if(_0x5eaa0f['agents'][_0xb3c8('0x48')](_0x180691['id'])){for(var _0x2b52f4 in _0x180691[_0xb3c8('0x49')]){if(_0x180691['capacity']['hasOwnProperty'](_0x2b52f4)){if(_0x5eaa0f[_0xb3c8('0x3d')][_0x180691['id']][_0xb3c8('0x48')](_0x2b52f4+_0xb3c8('0x4a'))){_0x5eaa0f[_0xb3c8('0x3d')][_0x180691['id']][_0x2b52f4+_0xb3c8('0x4a')]=parseInt(_0x180691[_0xb3c8('0x49')][_0x2b52f4],0xa);}}}_0x5eaa0f[_0xb3c8('0x3d')][_0x180691['id']][_0xb3c8('0x4b')]();return _0x460bb4({'code':0xc8,'message':_0x5eaa0f['agents'][_0x180691['id']]});}else{return _0x29f726(_0x1b9e13[_0xb3c8('0x45')](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x4eb698){return new Promise(function(_0x16e1fb){var _0x553770=_[_0xb3c8('0x4c')](_0x5eaa0f[_0xb3c8('0x3d')]);if(_0x4eb698&&_0x4eb698['id']){var _0x19e818=_[_0xb3c8('0x4d')](_0x553770,function(_0x3adfbf){return _0x3adfbf['id']===_0x4eb698['id'];});_0x16e1fb(_0x19e818);}else{_0x16e1fb({'count':_0x553770[_0xb3c8('0x21')],'rows':_0x553770});}});},'ChatQueues':function(){return new Promise(function(_0x4b7b7f){var _0x1c96ee=[];for(var _0x44013c in _0x5eaa0f['chatQueues']){if(_0x5eaa0f[_0xb3c8('0x4e')]['hasOwnProperty'](_0x44013c)){var _0x22f843=_0x5eaa0f[_0xb3c8('0x4e')][_0x44013c];var _0x1c99bd={'id':_0x22f843['id'],'available':_0x22f843['available'],'loggedIn':_0x22f843['loggedIn'],'name':_0x22f843['name'],'paused':_0x22f843[_0xb3c8('0x4f')],'waiting':_0x22f843[_0xb3c8('0x50')]};_0x1c96ee[_0xb3c8('0x1f')](_0x1c99bd);}}_0x4b7b7f({'count':_0x1c96ee['length'],'rows':_0x1c96ee});});},'MailQueues':function(){return new Promise(function(_0x4eb015){var _0xdec8e=[];for(var _0x1e034d in _0x5eaa0f[_0xb3c8('0x51')]){if(_0x5eaa0f[_0xb3c8('0x51')][_0xb3c8('0x48')](_0x1e034d)){var _0x10273b=_0x5eaa0f[_0xb3c8('0x51')][_0x1e034d];var _0x1d754b={'id':_0x10273b['id'],'available':_0x10273b['available'],'loggedIn':_0x10273b[_0xb3c8('0x52')],'name':_0x10273b['name'],'paused':_0x10273b['paused'],'waiting':_0x10273b[_0xb3c8('0x50')]};_0xdec8e[_0xb3c8('0x1f')](_0x1d754b);}}_0x4eb015({'count':_0xdec8e[_0xb3c8('0x21')],'rows':_0xdec8e});});},'OpenchannelQueues':function(){return new Promise(function(_0xfc5341){var _0x412280=[];for(var _0x214291 in _0x5eaa0f[_0xb3c8('0x53')]){if(_0x5eaa0f[_0xb3c8('0x53')]['hasOwnProperty'](_0x214291)){var _0x1168a5=_0x5eaa0f[_0xb3c8('0x53')][_0x214291];var _0x4216ab={'id':_0x1168a5['id'],'available':_0x1168a5[_0xb3c8('0x54')],'loggedIn':_0x1168a5[_0xb3c8('0x52')],'name':_0x1168a5[_0xb3c8('0x55')],'paused':_0x1168a5[_0xb3c8('0x4f')],'waiting':_0x1168a5['waiting']};_0x412280['push'](_0x4216ab);}}_0xfc5341({'count':_0x412280[_0xb3c8('0x21')],'rows':_0x412280});});},'SmsQueues':function(){return new Promise(function(_0x310fb8){var _0x410f33=[];for(var _0x4634de in _0x5eaa0f['smsQueues']){if(_0x5eaa0f[_0xb3c8('0x56')][_0xb3c8('0x48')](_0x4634de)){var _0x1edb8e=_0x5eaa0f['smsQueues'][_0x4634de];var _0x5bf6c8={'id':_0x1edb8e['id'],'available':_0x1edb8e[_0xb3c8('0x54')],'loggedIn':_0x1edb8e[_0xb3c8('0x52')],'name':_0x1edb8e[_0xb3c8('0x55')],'paused':_0x1edb8e[_0xb3c8('0x4f')],'waiting':_0x1edb8e[_0xb3c8('0x50')]};_0x410f33['push'](_0x5bf6c8);}}_0x310fb8({'count':_0x410f33[_0xb3c8('0x21')],'rows':_0x410f33});});},'FaxQueues':function(){return new Promise(function(_0x7ee449){var _0x2d842e=[];for(var _0x4e4ef3 in _0x5eaa0f[_0xb3c8('0x57')]){if(_0x5eaa0f['faxQueues'][_0xb3c8('0x48')](_0x4e4ef3)){var _0x337fa2=_0x5eaa0f[_0xb3c8('0x57')][_0x4e4ef3];var _0x13faaa={'id':_0x337fa2['id'],'available':_0x337fa2[_0xb3c8('0x54')],'loggedIn':_0x337fa2[_0xb3c8('0x52')],'name':_0x337fa2[_0xb3c8('0x55')],'paused':_0x337fa2[_0xb3c8('0x4f')],'waiting':_0x337fa2[_0xb3c8('0x50')]};_0x2d842e[_0xb3c8('0x1f')](_0x13faaa);}}_0x7ee449({'count':_0x2d842e[_0xb3c8('0x21')],'rows':_0x2d842e});});},'WhatsappQueues':function(){return new Promise(function(_0x577d91){var _0xba3942=[];for(var _0x510931 in _0x5eaa0f[_0xb3c8('0x58')]){if(_0x5eaa0f['whatsappQueues'][_0xb3c8('0x48')](_0x510931)){var _0x44c297=_0x5eaa0f[_0xb3c8('0x58')][_0x510931];var _0x201e16={'id':_0x44c297['id'],'available':_0x44c297[_0xb3c8('0x54')],'loggedIn':_0x44c297[_0xb3c8('0x52')],'name':_0x44c297[_0xb3c8('0x55')],'paused':_0x44c297[_0xb3c8('0x4f')],'waiting':_0x44c297[_0xb3c8('0x50')]};_0xba3942[_0xb3c8('0x1f')](_0x201e16);}}_0x577d91({'count':_0xba3942['length'],'rows':_0xba3942});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x3ad9e2){var _0x5257a6=_['values'](_0x5eaa0f['chatQueuesWaitingInteractions']);_0x3ad9e2({'count':_0x5257a6['length'],'rows':_0x5257a6});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x57dae6){var _0x13745d=_[_0xb3c8('0x4c')](_0x5eaa0f['mailQueuesWaitingInteractions']);_0x57dae6({'count':_0x13745d['length'],'rows':_0x13745d});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x44ff6d){var _0xc3fc60=_[_0xb3c8('0x4c')](_0x5eaa0f[_0xb3c8('0x59')]);_0x44ff6d({'count':_0xc3fc60[_0xb3c8('0x21')],'rows':_0xc3fc60});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x367f96){var _0x2c12a2=_['values'](_0x5eaa0f['smsQueuesWaitingInteractions']);_0x367f96({'count':_0x2c12a2[_0xb3c8('0x21')],'rows':_0x2c12a2});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x26c26b){var _0x10ba7c=_[_0xb3c8('0x4c')](_0x5eaa0f[_0xb3c8('0x5a')]);_0x26c26b({'count':_0x10ba7c[_0xb3c8('0x21')],'rows':_0x10ba7c});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x540365){var _0x1a4d7b=_['values'](_0x5eaa0f[_0xb3c8('0x5b')]);_0x540365({'count':_0x1a4d7b[_0xb3c8('0x21')],'rows':_0x1a4d7b});});}};var _0x42e40c=jayson[_0xb3c8('0x5c')](_0xcaf9a7)[_0xb3c8('0x5d')]();_0x42e40c['on'](_0xb3c8('0x45'),function(_0x2601ca){logger['error'](JSON[_0xb3c8('0x36')](_0x2601ca));return _0x2b38e4(_0x2601ca);});_0x42e40c[_0xb3c8('0x11')](0x232c,_0xb3c8('0x5e'),function(){console[_0xb3c8('0x5f')](_0xb3c8('0x60'),0x232c);return _0xa2a80c(_0xb3c8('0x61')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 440ff84..828e574 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 _0x3e0e=['request','then','error','message','result','catch','condition','rules','info','stop','push','format','iftime\x20%s','some','[%s][INTERVAL]\x20%s\x20%s','join','when','\x20|\x20','stack','util','bluebird','jayson/promise','routing','client'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0x3e0e,0x1db));var _0xe3e0=function(_0x481ab4,_0x9505b7){_0x481ab4=_0x481ab4-0x0;var _0xa45bac=_0x3e0e[_0x481ab4];return _0xa45bac;};'use strict';var util=require(_0xe3e0('0x0'));var BPromise=require(_0xe3e0('0x1'));var jayson=require(_0xe3e0('0x2'));var _=require('lodash');var logger=require('../../../config/logger')(_0xe3e0('0x3'));var client=jayson[_0xe3e0('0x4')]['http']({'port':0x232a});function request(_0x4ceff6,_0x4c6400){return new BPromise(function(_0x35d44d,_0x1b40ee){return client[_0xe3e0('0x5')](_0x4ceff6,_0x4c6400)[_0xe3e0('0x6')](function(_0x27debb){if(_0x27debb[_0xe3e0('0x7')]){return _0x1b40ee(_0x27debb[_0xe3e0('0x7')][_0xe3e0('0x8')]);}else{return _0x35d44d(_0x27debb[_0xe3e0('0x9')]);}})[_0xe3e0('0xa')](function(_0x3dc1b7){return _0x1b40ee(_0x3dc1b7);});});}exports[_0xe3e0('0xb')]=function(_0x2d586f,_0x389bb9,_0x3512f6){return function(_0x494746){if(_0x3512f6[_0xe3e0('0xc')]&&!_0x3512f6[_0xe3e0('0xc')][_0x2d586f]){logger[_0xe3e0('0xd')]('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x2d586f);return _0x494746[_0xe3e0('0xe')]();}var _0x4b3f6f=[];for(var _0x41b04d=0x0;_0x41b04d<_0x389bb9['length'];_0x41b04d+=0x1){_0x4b3f6f[_0xe3e0('0xf')](request('Command',{'command':util[_0xe3e0('0x10')](_0xe3e0('0x11'),_0x389bb9[_0x41b04d])})[_0xe3e0('0x6')](function(_0x4921c5){return _0x4921c5&&_0x4921c5['message']&&_0x4921c5[_0xe3e0('0x8')]['indexOf']('true')>=0x0?!![]:![];})[_0xe3e0('0xa')](function(){logger['error']('[%s][INTERVAL]\x20%s',_0x2d586f,_0x389bb9[_0x41b04d]);}));}BPromise['all'](_0x4b3f6f)[_0xe3e0('0x6')](function(_0x55a6cd){var _0x1a8ceb=_[_0xe3e0('0x12')](_0x55a6cd);logger[_0xe3e0('0xd')](_0xe3e0('0x13'),_0x2d586f,_0x389bb9[_0xe3e0('0x14')]('\x20|\x20'),_0x1a8ceb);_0x494746[_0xe3e0('0x15')](_0x1a8ceb);})[_0xe3e0('0xa')](function(_0x2193a8){logger[_0xe3e0('0x7')](_0xe3e0('0x13'),_0x2d586f,_0x389bb9[_0xe3e0('0x14')](_0xe3e0('0x16')),_0x2193a8[_0xe3e0('0x17')]);_0x494746[_0xe3e0('0xe')]();});};}; \ No newline at end of file +var _0x64b7=['format','iftime\x20%s','indexOf','true','[%s][INTERVAL]\x20%s','some','join','\x20|\x20','when','[%s][INTERVAL]\x20%s\x20%s','util','bluebird','jayson/promise','lodash','../../../config/logger','client','http','request','error','message','catch','condition','rules','info','stop','length','push','Command'];(function(_0x5a7f9c,_0x18ae78){var _0x3f22b7=function(_0x1c9f4f){while(--_0x1c9f4f){_0x5a7f9c['push'](_0x5a7f9c['shift']());}};_0x3f22b7(++_0x18ae78);}(_0x64b7,0x1ae));var _0x764b=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x64b7[_0x3bf83f];return _0x22c4a9;};'use strict';var util=require(_0x764b('0x0'));var BPromise=require(_0x764b('0x1'));var jayson=require(_0x764b('0x2'));var _=require(_0x764b('0x3'));var logger=require(_0x764b('0x4'))('routing');var client=jayson[_0x764b('0x5')][_0x764b('0x6')]({'port':0x232a});function request(_0x3eed73,_0x1a90d5){return new BPromise(function(_0x30da44,_0x56a45e){return client[_0x764b('0x7')](_0x3eed73,_0x1a90d5)['then'](function(_0x326ac5){if(_0x326ac5['error']){return _0x56a45e(_0x326ac5[_0x764b('0x8')][_0x764b('0x9')]);}else{return _0x30da44(_0x326ac5['result']);}})[_0x764b('0xa')](function(_0x12ef02){return _0x56a45e(_0x12ef02);});});}exports[_0x764b('0xb')]=function(_0x5d1b83,_0x18f3d1,_0x417292){return function(_0x17e1ca){if(_0x417292['rules']&&!_0x417292[_0x764b('0xc')][_0x5d1b83]){logger[_0x764b('0xd')]('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x5d1b83);return _0x17e1ca[_0x764b('0xe')]();}var _0x4ef83e=[];for(var _0x5e509a=0x0;_0x5e509a<_0x18f3d1[_0x764b('0xf')];_0x5e509a+=0x1){_0x4ef83e[_0x764b('0x10')](request(_0x764b('0x11'),{'command':util[_0x764b('0x12')](_0x764b('0x13'),_0x18f3d1[_0x5e509a])})['then'](function(_0x71f9c0){return _0x71f9c0&&_0x71f9c0['message']&&_0x71f9c0['message'][_0x764b('0x14')](_0x764b('0x15'))>=0x0?!![]:![];})[_0x764b('0xa')](function(){logger['error'](_0x764b('0x16'),_0x5d1b83,_0x18f3d1[_0x5e509a]);}));}BPromise['all'](_0x4ef83e)['then'](function(_0x1b188c){var _0x15f08f=_[_0x764b('0x17')](_0x1b188c);logger['info']('[%s][INTERVAL]\x20%s\x20%s',_0x5d1b83,_0x18f3d1[_0x764b('0x18')](_0x764b('0x19')),_0x15f08f);_0x17e1ca[_0x764b('0x1a')](_0x15f08f);})[_0x764b('0xa')](function(_0x44ab0d){logger['error'](_0x764b('0x1b'),_0x5d1b83,_0x18f3d1[_0x764b('0x18')](_0x764b('0x19')),_0x44ab0d['stack']);_0x17e1ca[_0x764b('0xe')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index f7c0ffd..03d9d89 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 _0xcb91=['blind','transferexten','extension','transferuniqueid','[%s][agents][attendedtransfer]','origtransfereruniqueid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','transfer','ATTENDED','transfereeuniqueid','clone','calleridname','agententerreason','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','hangup','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agent','[%s][agents][hangup]','./utils','info','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','queue','membername','calleridnum','connectedlinenum','getVoiceQueueByName','then','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','debug','format','[%s][agents][agentcalled]','destuniqueid','agentcalledAt','now','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','isNil','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswer','agentringnoanswerAt','lastevent','timeout','reason','holdtime','ringtime','talktime','push','[%s][agents][queuecallerabandon]','abandoned','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentcomplete]','agentcompleteAt','diffTime','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfertype'];(function(_0x13a61c,_0x17c53a){var _0x2d0c84=function(_0x5c6f77){while(--_0x5c6f77){_0x13a61c['push'](_0x13a61c['shift']());}};_0x2d0c84(++_0x17c53a);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x378b4,_0x5ca7fa){_0x378b4=_0x378b4-0x0;var _0x11d07b=_0xcb91[_0x378b4];return _0x11d07b;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x1cb9('0x0'));var agents={};var transfers={};var unanswered=[];function writeDB(_0xe4a5bf,_0x17d4ec){utils[_0x1cb9('0x1')](util['format'](_0x1cb9('0x2'),_0xe4a5bf[_0x1cb9('0x3')],_0xe4a5bf['channel'],_0xe4a5bf[_0x1cb9('0x4')],_0xe4a5bf[_0x1cb9('0x5')],_0xe4a5bf['interface'],_0xe4a5bf[_0x1cb9('0x6')],_0xe4a5bf[_0x1cb9('0x7')],_0xe4a5bf['lastevent']));if(_0xe4a5bf[_0x1cb9('0x4')]){utils[_0x1cb9('0x8')](_0xe4a5bf['queue'])[_0x1cb9('0x9')](function(_0x5a0e99){if(_0x5a0e99){_0xe4a5bf['type']=_0x5a0e99[_0x1cb9('0xa')];_0xe4a5bf[_0x1cb9('0xb')]=_0xe4a5bf[_0x1cb9('0xc')]?_0x5a0e99[_0x1cb9('0xd')]:![];_0xe4a5bf[_0x1cb9('0xe')]=_0xe4a5bf['agentacw']?_0x5a0e99[_0x1cb9('0xf')]:0x0;}utils[_0x1cb9('0x10')](_0x1cb9('0x11'),_0xe4a5bf);});}else{utils[_0x1cb9('0x10')](_0x1cb9('0x11'),_0xe4a5bf);}if(_0x17d4ec){delete transfers[_0xe4a5bf['uniqueid']];}else{delete agents[_0xe4a5bf['destuniqueid']];}}exports['agentcalled']=function(_0x358866){try{utils[_0x1cb9('0x12')](util[_0x1cb9('0x13')](_0x1cb9('0x14'),_0x358866['uniqueid']),_0x358866);agents[_0x358866[_0x1cb9('0x15')]]=_0x358866;agents[_0x358866[_0x1cb9('0x15')]][_0x1cb9('0x16')]=utils[_0x1cb9('0x17')]();agents[_0x358866[_0x1cb9('0x15')]]['lastevent']='called';agents[_0x358866[_0x1cb9('0x15')]][_0x1cb9('0x7')]=null;agents[_0x358866[_0x1cb9('0x15')]][_0x1cb9('0x18')]=null;utils[_0x1cb9('0x1')](util[_0x1cb9('0x13')](_0x1cb9('0x19'),_0x358866['uniqueid'],agents[_0x358866['destuniqueid']][_0x1cb9('0x5')],_0x358866[_0x1cb9('0x15')]));}catch(_0x2b2669){utils[_0x1cb9('0x1a')](util[_0x1cb9('0x13')](_0x1cb9('0x14'),_0x358866[_0x1cb9('0x3')]),_0x2b2669);}};exports['agentringnoanswer']=function(_0x559bcc){try{if(!_[_0x1cb9('0x1b')](agents[_0x559bcc['destuniqueid']])){utils[_0x1cb9('0x12')](util[_0x1cb9('0x13')]('[%s][agents][agentringnoanswer]',_0x559bcc['uniqueid']),_0x559bcc);utils[_0x1cb9('0x1')](util[_0x1cb9('0x13')](_0x1cb9('0x1c'),_0x559bcc[_0x1cb9('0x3')],agents[_0x559bcc[_0x1cb9('0x15')]][_0x1cb9('0x5')],_0x559bcc['destuniqueid']));agents[_0x559bcc['destuniqueid']][_0x1cb9('0x1d')]=!![];agents[_0x559bcc['destuniqueid']][_0x1cb9('0x1e')]=utils[_0x1cb9('0x17')]();agents[_0x559bcc[_0x1cb9('0x15')]][_0x1cb9('0x1f')]=_0x1cb9('0x20');agents[_0x559bcc['destuniqueid']][_0x1cb9('0x21')]=_0x1cb9('0x20');agents[_0x559bcc['destuniqueid']][_0x1cb9('0x22')]=_0x559bcc[_0x1cb9('0x23')]?parseInt(_0x559bcc[_0x1cb9('0x23')])/0x3e8:0x0;agents[_0x559bcc[_0x1cb9('0x15')]][_0x1cb9('0x24')]=0x0;unanswered[_0x1cb9('0x25')](_0x559bcc[_0x1cb9('0x15')]);}}catch(_0xb644b3){utils[_0x1cb9('0x1a')](util[_0x1cb9('0x13')]('[%s][agents][agentringnoanswer]',_0x559bcc[_0x1cb9('0x3')]),_0xb644b3);}};exports['queuecallerabandon']=function(_0x110282){try{_['forIn'](agents,function(_0x278327,_0x41011c){if(_0x278327[_0x1cb9('0x3')]==_0x110282[_0x1cb9('0x3')]&&!_['includes'](unanswered,_0x278327[_0x1cb9('0x15')])){utils['debug'](util[_0x1cb9('0x13')](_0x1cb9('0x26'),_0x110282[_0x1cb9('0x3')]),_0x110282);utils['info'](util[_0x1cb9('0x13')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x110282[_0x1cb9('0x3')],_0x278327['membername'],_0x278327[_0x1cb9('0x15')]));_0x278327[_0x1cb9('0x1d')]=!![];_0x278327[_0x1cb9('0x1e')]=utils[_0x1cb9('0x17')]();_0x278327['lastevent']=_0x1cb9('0x27');_0x278327[_0x1cb9('0x21')]=_0x1cb9('0x27');_0x278327[_0x1cb9('0x22')]=_0x110282[_0x1cb9('0x22')];_0x278327[_0x1cb9('0x24')]=0x0;writeDB(_0x278327);}});}catch(_0xc6d5fd){utils[_0x1cb9('0x1a')](util[_0x1cb9('0x13')](_0x1cb9('0x26'),_0x110282[_0x1cb9('0x3')]),_0xc6d5fd);}};exports[_0x1cb9('0x28')]=function(_0x29f149){try{if(agents[_0x29f149['destuniqueid']]){utils['debug'](util[_0x1cb9('0x13')](_0x1cb9('0x29'),_0x29f149[_0x1cb9('0x3')]),_0x29f149);utils[_0x1cb9('0x1')](util[_0x1cb9('0x13')](_0x1cb9('0x2a'),_0x29f149[_0x1cb9('0x3')],agents[_0x29f149[_0x1cb9('0x15')]]['membername'],_0x29f149[_0x1cb9('0x15')]));agents[_0x29f149[_0x1cb9('0x15')]][_0x1cb9('0x2b')]=utils['now']();agents[_0x29f149[_0x1cb9('0x15')]]['connectedlinenum']=_0x29f149[_0x1cb9('0x7')];agents[_0x29f149['destuniqueid']][_0x1cb9('0x18')]=_0x29f149[_0x1cb9('0x18')];agents[_0x29f149[_0x1cb9('0x15')]][_0x1cb9('0x22')]=_0x29f149[_0x1cb9('0x23')];agents[_0x29f149[_0x1cb9('0x15')]][_0x1cb9('0x1f')]='connect';_['forIn'](agents,function(_0x4111b8,_0x1d2723){if(_0x4111b8[_0x1cb9('0x15')]!=_0x29f149[_0x1cb9('0x15')]&&_0x4111b8[_0x1cb9('0x3')]==_0x29f149[_0x1cb9('0x3')]){_0x4111b8[_0x1cb9('0x24')]=0x0;_0x4111b8['holdtime']=_0x29f149[_0x1cb9('0x23')];_0x4111b8['agentringnoanswer']=!![];_0x4111b8['agentringnoanswerAt']=utils['now']();_0x4111b8[_0x1cb9('0x1f')]=_0x1cb9('0x2c');_0x4111b8[_0x1cb9('0x21')]=_0x1cb9('0x2c');_0x4111b8[_0x1cb9('0x2d')]=_0x29f149['destuniqueid'];_0x4111b8[_0x1cb9('0x2e')]=_0x29f149['membername'];writeDB(_0x4111b8);}});}}catch(_0x91121){utils[_0x1cb9('0x1a')](util[_0x1cb9('0x13')]('[%s][agents][agentconnect]',_0x29f149[_0x1cb9('0x3')]),_0x91121);}};exports['agentcomplete']=function(_0xda1a44){try{if(!_[_0x1cb9('0x1b')](agents[_0xda1a44['destuniqueid']])){utils['debug'](util[_0x1cb9('0x13')](_0x1cb9('0x2f'),_0xda1a44[_0x1cb9('0x3')]),_0xda1a44);utils[_0x1cb9('0x1')](util[_0x1cb9('0x13')]('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0xda1a44[_0x1cb9('0x3')],agents[_0xda1a44['destuniqueid']]['membername'],_0xda1a44['destuniqueid']));agents[_0xda1a44[_0x1cb9('0x15')]][_0x1cb9('0xc')]=!![];agents[_0xda1a44[_0x1cb9('0x15')]][_0x1cb9('0x30')]=utils[_0x1cb9('0x17')]();agents[_0xda1a44[_0x1cb9('0x15')]][_0x1cb9('0x24')]=utils[_0x1cb9('0x31')](agents[_0xda1a44[_0x1cb9('0x15')]][_0x1cb9('0x30')],agents[_0xda1a44[_0x1cb9('0x15')]]['agentconnectAt']);agents[_0xda1a44[_0x1cb9('0x15')]][_0x1cb9('0x21')]=_0xda1a44[_0x1cb9('0x21')];agents[_0xda1a44['destuniqueid']][_0x1cb9('0x1f')]=_0x1cb9('0x32');writeDB(agents[_0xda1a44[_0x1cb9('0x15')]]);}}catch(_0x2efdbb){utils[_0x1cb9('0x1a')](util['format'](_0x1cb9('0x2f'),_0xda1a44['uniqueid']),_0x2efdbb);}};exports[_0x1cb9('0x33')]=function(_0x4ac483){try{if(!_[_0x1cb9('0x1b')](agents[_0x4ac483[_0x1cb9('0x34')]])){utils[_0x1cb9('0x12')](util[_0x1cb9('0x13')]('[%s][agents][blindtransfer]',_0x4ac483[_0x1cb9('0x3')]),_0x4ac483);utils[_0x1cb9('0x1')](util[_0x1cb9('0x13')](_0x1cb9('0x35'),_0x4ac483[_0x1cb9('0x3')],agents[_0x4ac483[_0x1cb9('0x34')]][_0x1cb9('0x5')],agents[_0x4ac483[_0x1cb9('0x34')]][_0x1cb9('0x3')]));agents[_0x4ac483[_0x1cb9('0x34')]]['transfer']=!![];agents[_0x4ac483['transfereruniqueid']][_0x1cb9('0x36')]=_0x1cb9('0x37');agents[_0x4ac483[_0x1cb9('0x34')]][_0x1cb9('0x38')]=_0x4ac483[_0x1cb9('0x39')];agents[_0x4ac483[_0x1cb9('0x34')]][_0x1cb9('0x3a')]=agents[_0x4ac483[_0x1cb9('0x34')]][_0x1cb9('0x3')];}}catch(_0x166ca2){utils['error'](util[_0x1cb9('0x13')]('[%s][agents][blindtransfer]',_0x4ac483[_0x1cb9('0x3')]),_0x166ca2);}};exports['attendedtransfer']=function(_0x135795){try{utils['debug'](util['format'](_0x1cb9('0x3b'),_0x135795[_0x1cb9('0x3c')]),_0x135795);if(_0x135795[_0x1cb9('0x3c')]==_0x135795['origtransfererlinkedid']){if(!_[_0x1cb9('0x1b')](agents[_0x135795[_0x1cb9('0x3d')]])){utils['info'](util['format'](_0x1cb9('0x3e'),_0x135795[_0x1cb9('0x3c')],agents[_0x135795[_0x1cb9('0x3d')]][_0x1cb9('0x5')]));agents[_0x135795[_0x1cb9('0x3d')]][_0x1cb9('0x3f')]=!![];agents[_0x135795[_0x1cb9('0x3d')]]['transfertype']=_0x1cb9('0x40');agents[_0x135795[_0x1cb9('0x3d')]][_0x1cb9('0x38')]=_0x135795['origtransfererexten'];agents[_0x135795[_0x1cb9('0x3d')]][_0x1cb9('0x3a')]=_0x135795[_0x1cb9('0x3c')];}if(_0x135795[_0x1cb9('0x41')]&&agents[_0x135795[_0x1cb9('0x41')]]){agents[_0x135795[_0x1cb9('0x41')]]['agententerreason']=0x1;transfers[_0x135795[_0x1cb9('0x41')]]=_[_0x1cb9('0x42')](agents[_0x135795[_0x1cb9('0x41')]]);transfers[_0x135795[_0x1cb9('0x41')]][_0x1cb9('0x6')]=agents[_0x135795[_0x1cb9('0x3d')]][_0x1cb9('0x6')];transfers[_0x135795[_0x1cb9('0x41')]][_0x1cb9('0x43')]=agents[_0x135795[_0x1cb9('0x3d')]][_0x1cb9('0x43')];transfers[_0x135795['transfereeuniqueid']][_0x1cb9('0x16')]=utils[_0x1cb9('0x17')]();transfers[_0x135795[_0x1cb9('0x41')]][_0x1cb9('0x2b')]=utils['now']();transfers[_0x135795['transfereeuniqueid']][_0x1cb9('0x22')]=0x0;transfers[_0x135795[_0x1cb9('0x41')]][_0x1cb9('0x44')]=0x2;}}else if(_0x135795[_0x1cb9('0x3d')]==_0x135795[_0x1cb9('0x45')]){if(!_[_0x1cb9('0x1b')](agents[_0x135795[_0x1cb9('0x3c')]])){utils[_0x1cb9('0x1')](util['format']('[%s][agents][attendedtransfer]\x20agent:%s',_0x135795[_0x1cb9('0x3c')],agents[_0x135795['origtransfereruniqueid']]['membername']));agents[_0x135795['origtransfereruniqueid']]['transfer']=!![];agents[_0x135795['origtransfereruniqueid']][_0x1cb9('0x36')]=_0x1cb9('0x40');agents[_0x135795[_0x1cb9('0x3c')]][_0x1cb9('0x38')]=_0x135795[_0x1cb9('0x46')];agents[_0x135795[_0x1cb9('0x3c')]]['transferuniqueid']=_0x135795[_0x1cb9('0x3d')];}if(_0x135795[_0x1cb9('0x47')]&&agents[_0x135795['transfertargetuniqueid']]){agents[_0x135795['transfertargetuniqueid']][_0x1cb9('0x44')]=0x1;transfers[_0x135795[_0x1cb9('0x47')]]=_[_0x1cb9('0x42')](agents[_0x135795[_0x1cb9('0x47')]]);transfers[_0x135795[_0x1cb9('0x47')]]['calleridnum']=agents[_0x135795['origtransfereruniqueid']]['calleridnum'];transfers[_0x135795[_0x1cb9('0x47')]][_0x1cb9('0x43')]=agents[_0x135795[_0x1cb9('0x3c')]][_0x1cb9('0x43')];transfers[_0x135795[_0x1cb9('0x47')]]['agentcalledAt']=utils[_0x1cb9('0x17')]();transfers[_0x135795[_0x1cb9('0x47')]]['agentconnectAt']=utils['now']();transfers[_0x135795[_0x1cb9('0x47')]]['holdtime']=0x0;transfers[_0x135795[_0x1cb9('0x47')]][_0x1cb9('0x44')]=0x2;}}}catch(_0x2c54ea){utils[_0x1cb9('0x1a')](util[_0x1cb9('0x13')](_0x1cb9('0x3b'),_0x135795['origtransfereruniqueid']),_0x2c54ea);}};exports[_0x1cb9('0x48')]=function(_0x15fc04){try{utils[_0x1cb9('0x12')](util[_0x1cb9('0x13')]('[%s][agents][hangup]',_0x15fc04['uniqueid']),_0x15fc04);if(agents[_0x15fc04[_0x1cb9('0x3')]]&&agents[_0x15fc04[_0x1cb9('0x3')]][_0x1cb9('0x21')]===_0x1cb9('0x20')){if(_0x15fc04[_0x1cb9('0x49')]==='21'){agents[_0x15fc04[_0x1cb9('0x3')]]['reason']=_0x1cb9('0x4a');agents[_0x15fc04['uniqueid']][_0x1cb9('0x1f')]=_0x1cb9('0x4a');}utils['info'](util[_0x1cb9('0x13')](_0x1cb9('0x4b'),_0x15fc04[_0x1cb9('0x3')],agents[_0x15fc04['uniqueid']][_0x1cb9('0x5')],agents[_0x15fc04[_0x1cb9('0x3')]][_0x1cb9('0x21')],agents[_0x15fc04[_0x1cb9('0x3')]][_0x1cb9('0x1f')]));writeDB(agents[_0x15fc04[_0x1cb9('0x3')]]);var _0x5a3f1d=unanswered[_0x1cb9('0x4c')](_0x15fc04[_0x1cb9('0x3')]);if(_0x5a3f1d>-0x1){unanswered[_0x1cb9('0x4d')](_0x5a3f1d,0x1);}}if(transfers[_0x15fc04[_0x1cb9('0x3')]]){transfers[_0x15fc04[_0x1cb9('0x3')]][_0x1cb9('0xc')]=!![];transfers[_0x15fc04[_0x1cb9('0x3')]][_0x1cb9('0x30')]=utils['now']();transfers[_0x15fc04[_0x1cb9('0x3')]][_0x1cb9('0x24')]=utils['diffTime'](transfers[_0x15fc04[_0x1cb9('0x3')]]['agentcompleteAt'],transfers[_0x15fc04[_0x1cb9('0x3')]]['agentconnectAt']);transfers[_0x15fc04['uniqueid']][_0x1cb9('0x21')]=_0x1cb9('0x4e');transfers[_0x15fc04['uniqueid']][_0x1cb9('0x1f')]='complete';utils[_0x1cb9('0x1')](util[_0x1cb9('0x13')](_0x1cb9('0x4b'),_0x15fc04[_0x1cb9('0x3')],transfers[_0x15fc04['uniqueid']][_0x1cb9('0x5')],transfers[_0x15fc04[_0x1cb9('0x3')]][_0x1cb9('0x21')],transfers[_0x15fc04[_0x1cb9('0x3')]][_0x1cb9('0x1f')]));writeDB(transfers[_0x15fc04[_0x1cb9('0x3')]],!![]);}if(agents[_0x15fc04['uniqueid']]&&agents[_0x15fc04[_0x1cb9('0x3')]][_0x1cb9('0x2b')]){agents[_0x15fc04[_0x1cb9('0x3')]][_0x1cb9('0xc')]=!![];agents[_0x15fc04[_0x1cb9('0x3')]][_0x1cb9('0x30')]=utils['now']();agents[_0x15fc04[_0x1cb9('0x3')]][_0x1cb9('0x24')]=utils['diffTime'](agents[_0x15fc04[_0x1cb9('0x3')]][_0x1cb9('0x30')],agents[_0x15fc04[_0x1cb9('0x3')]][_0x1cb9('0x2b')]);agents[_0x15fc04[_0x1cb9('0x3')]][_0x1cb9('0x21')]=agents[_0x15fc04[_0x1cb9('0x3')]]['transfer']?_0x1cb9('0x3f'):'agent';agents[_0x15fc04[_0x1cb9('0x3')]][_0x1cb9('0x1f')]='complete';utils[_0x1cb9('0x1')](util[_0x1cb9('0x13')](_0x1cb9('0x4b'),_0x15fc04[_0x1cb9('0x3')],agents[_0x15fc04['uniqueid']][_0x1cb9('0x5')],agents[_0x15fc04[_0x1cb9('0x3')]][_0x1cb9('0x21')],agents[_0x15fc04['uniqueid']][_0x1cb9('0x1f')]));writeDB(agents[_0x15fc04[_0x1cb9('0x3')]]);}}catch(_0x3b456a){utils[_0x1cb9('0x1a')](util[_0x1cb9('0x13')](_0x1cb9('0x4f'),_0x15fc04[_0x1cb9('0x3')]),_0x3b456a);}}; \ No newline at end of file +var _0x2f68=['called','connectedlinenum','connectedlinename','info','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','reason','holdtime','ringtime','talktime','push','[%s][agents][agentringnoanswer]','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','now','abandoned','agentconnect','[%s][agents][agentconnect]','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','agentcomplete','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','agentconnectAt','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfereruniqueid','transfer','transfertype','blind','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfereruniqueid','transferexten','origtransfererexten','transferuniqueid','transfereeuniqueid','clone','calleridnum','calleridname','agententerreason','secondtransfererlinkedid','ATTENDED','secondtransfererexten','transfertargetuniqueid','hangup','[%s][agents][hangup]','cause','rejected','splice','complete','agent','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','util','./utils','format','uniqueid','channel','membername','interface','lastevent','queue','then','type','agentacw','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','agentcalled','debug','[%s][agents][agentcalled]','destuniqueid','agentcalledAt'];(function(_0xe05a95,_0x2d476b){var _0x3017df=function(_0x414b9f){while(--_0x414b9f){_0xe05a95['push'](_0xe05a95['shift']());}};_0x3017df(++_0x2d476b);}(_0x2f68,0x9a));var _0x82f6=function(_0x37bba0,_0x1242a4){_0x37bba0=_0x37bba0-0x0;var _0x2cccb1=_0x2f68[_0x37bba0];return _0x2cccb1;};'use strict';var _=require('lodash');var util=require(_0x82f6('0x0'));var utils=require(_0x82f6('0x1'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x24c877,_0x3a9c8f){utils['info'](util[_0x82f6('0x2')]('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x24c877[_0x82f6('0x3')],_0x24c877[_0x82f6('0x4')],_0x24c877['queue'],_0x24c877[_0x82f6('0x5')],_0x24c877[_0x82f6('0x6')],_0x24c877['calleridnum'],_0x24c877['connectedlinenum'],_0x24c877[_0x82f6('0x7')]));if(_0x24c877['queue']){utils['getVoiceQueueByName'](_0x24c877[_0x82f6('0x8')])[_0x82f6('0x9')](function(_0x250d71){if(_0x250d71){_0x24c877['type']=_0x250d71[_0x82f6('0xa')];_0x24c877[_0x82f6('0xb')]=_0x24c877['agentcomplete']?_0x250d71[_0x82f6('0xc')]:![];_0x24c877[_0x82f6('0xd')]=_0x24c877[_0x82f6('0xb')]?_0x250d71[_0x82f6('0xe')]:0x0;}utils[_0x82f6('0xf')](_0x82f6('0x10'),_0x24c877);});}else{utils['request'](_0x82f6('0x10'),_0x24c877);}if(_0x3a9c8f){delete transfers[_0x24c877[_0x82f6('0x3')]];}else{delete agents[_0x24c877['destuniqueid']];}}exports[_0x82f6('0x11')]=function(_0x1f8bf5){try{utils[_0x82f6('0x12')](util[_0x82f6('0x2')](_0x82f6('0x13'),_0x1f8bf5[_0x82f6('0x3')]),_0x1f8bf5);agents[_0x1f8bf5[_0x82f6('0x14')]]=_0x1f8bf5;agents[_0x1f8bf5[_0x82f6('0x14')]][_0x82f6('0x15')]=utils['now']();agents[_0x1f8bf5[_0x82f6('0x14')]]['lastevent']=_0x82f6('0x16');agents[_0x1f8bf5[_0x82f6('0x14')]][_0x82f6('0x17')]=null;agents[_0x1f8bf5[_0x82f6('0x14')]][_0x82f6('0x18')]=null;utils[_0x82f6('0x19')](util[_0x82f6('0x2')](_0x82f6('0x1a'),_0x1f8bf5[_0x82f6('0x3')],agents[_0x1f8bf5[_0x82f6('0x14')]][_0x82f6('0x5')],_0x1f8bf5[_0x82f6('0x14')]));}catch(_0x2652a9){utils[_0x82f6('0x1b')](util[_0x82f6('0x2')]('[%s][agents][agentcalled]',_0x1f8bf5[_0x82f6('0x3')]),_0x2652a9);}};exports[_0x82f6('0x1c')]=function(_0x55cbce){try{if(!_[_0x82f6('0x1d')](agents[_0x55cbce[_0x82f6('0x14')]])){utils[_0x82f6('0x12')](util[_0x82f6('0x2')]('[%s][agents][agentringnoanswer]',_0x55cbce[_0x82f6('0x3')]),_0x55cbce);utils['info'](util[_0x82f6('0x2')](_0x82f6('0x1e'),_0x55cbce['uniqueid'],agents[_0x55cbce['destuniqueid']][_0x82f6('0x5')],_0x55cbce[_0x82f6('0x14')]));agents[_0x55cbce['destuniqueid']]['agentringnoanswer']=!![];agents[_0x55cbce[_0x82f6('0x14')]][_0x82f6('0x1f')]=utils['now']();agents[_0x55cbce[_0x82f6('0x14')]][_0x82f6('0x7')]='timeout';agents[_0x55cbce['destuniqueid']][_0x82f6('0x20')]='timeout';agents[_0x55cbce[_0x82f6('0x14')]][_0x82f6('0x21')]=_0x55cbce['ringtime']?parseInt(_0x55cbce[_0x82f6('0x22')])/0x3e8:0x0;agents[_0x55cbce[_0x82f6('0x14')]][_0x82f6('0x23')]=0x0;unanswered[_0x82f6('0x24')](_0x55cbce['destuniqueid']);}}catch(_0x40a071){utils[_0x82f6('0x1b')](util[_0x82f6('0x2')](_0x82f6('0x25'),_0x55cbce[_0x82f6('0x3')]),_0x40a071);}};exports[_0x82f6('0x26')]=function(_0x27e473){try{_[_0x82f6('0x27')](agents,function(_0x1e1aa4,_0x402449){if(_0x1e1aa4[_0x82f6('0x3')]==_0x27e473[_0x82f6('0x3')]&&!_[_0x82f6('0x28')](unanswered,_0x1e1aa4[_0x82f6('0x14')])){utils['debug'](util[_0x82f6('0x2')](_0x82f6('0x29'),_0x27e473[_0x82f6('0x3')]),_0x27e473);utils['info'](util[_0x82f6('0x2')](_0x82f6('0x2a'),_0x27e473[_0x82f6('0x3')],_0x1e1aa4[_0x82f6('0x5')],_0x1e1aa4[_0x82f6('0x14')]));_0x1e1aa4[_0x82f6('0x1c')]=!![];_0x1e1aa4[_0x82f6('0x1f')]=utils[_0x82f6('0x2b')]();_0x1e1aa4[_0x82f6('0x7')]=_0x82f6('0x2c');_0x1e1aa4[_0x82f6('0x20')]=_0x82f6('0x2c');_0x1e1aa4[_0x82f6('0x21')]=_0x27e473[_0x82f6('0x21')];_0x1e1aa4['talktime']=0x0;writeDB(_0x1e1aa4);}});}catch(_0x13a409){utils[_0x82f6('0x1b')](util[_0x82f6('0x2')](_0x82f6('0x29'),_0x27e473[_0x82f6('0x3')]),_0x13a409);}};exports[_0x82f6('0x2d')]=function(_0x34c2f1){try{if(agents[_0x34c2f1[_0x82f6('0x14')]]){utils[_0x82f6('0x12')](util[_0x82f6('0x2')](_0x82f6('0x2e'),_0x34c2f1[_0x82f6('0x3')]),_0x34c2f1);utils[_0x82f6('0x19')](util[_0x82f6('0x2')]('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x34c2f1[_0x82f6('0x3')],agents[_0x34c2f1['destuniqueid']]['membername'],_0x34c2f1[_0x82f6('0x14')]));agents[_0x34c2f1[_0x82f6('0x14')]]['agentconnectAt']=utils[_0x82f6('0x2b')]();agents[_0x34c2f1[_0x82f6('0x14')]][_0x82f6('0x17')]=_0x34c2f1['connectedlinenum'];agents[_0x34c2f1[_0x82f6('0x14')]]['connectedlinename']=_0x34c2f1[_0x82f6('0x18')];agents[_0x34c2f1['destuniqueid']][_0x82f6('0x21')]=_0x34c2f1['ringtime'];agents[_0x34c2f1[_0x82f6('0x14')]][_0x82f6('0x7')]='connect';_[_0x82f6('0x27')](agents,function(_0x368c11,_0x3e7c53){if(_0x368c11[_0x82f6('0x14')]!=_0x34c2f1['destuniqueid']&&_0x368c11[_0x82f6('0x3')]==_0x34c2f1[_0x82f6('0x3')]){_0x368c11[_0x82f6('0x23')]=0x0;_0x368c11[_0x82f6('0x21')]=_0x34c2f1['ringtime'];_0x368c11[_0x82f6('0x1c')]=!![];_0x368c11[_0x82f6('0x1f')]=utils['now']();_0x368c11[_0x82f6('0x7')]=_0x82f6('0x2f');_0x368c11[_0x82f6('0x20')]=_0x82f6('0x2f');_0x368c11[_0x82f6('0x30')]=_0x34c2f1['destuniqueid'];_0x368c11[_0x82f6('0x31')]=_0x34c2f1['membername'];writeDB(_0x368c11);}});}}catch(_0x139614){utils[_0x82f6('0x1b')](util[_0x82f6('0x2')](_0x82f6('0x2e'),_0x34c2f1[_0x82f6('0x3')]),_0x139614);}};exports[_0x82f6('0x32')]=function(_0x43fefc){try{if(!_['isNil'](agents[_0x43fefc[_0x82f6('0x14')]])){utils[_0x82f6('0x12')](util[_0x82f6('0x2')](_0x82f6('0x33'),_0x43fefc['uniqueid']),_0x43fefc);utils[_0x82f6('0x19')](util['format'](_0x82f6('0x34'),_0x43fefc[_0x82f6('0x3')],agents[_0x43fefc[_0x82f6('0x14')]][_0x82f6('0x5')],_0x43fefc[_0x82f6('0x14')]));agents[_0x43fefc[_0x82f6('0x14')]]['agentcomplete']=!![];agents[_0x43fefc[_0x82f6('0x14')]][_0x82f6('0x35')]=utils[_0x82f6('0x2b')]();agents[_0x43fefc[_0x82f6('0x14')]][_0x82f6('0x23')]=utils[_0x82f6('0x36')](agents[_0x43fefc[_0x82f6('0x14')]][_0x82f6('0x35')],agents[_0x43fefc['destuniqueid']][_0x82f6('0x37')]);agents[_0x43fefc[_0x82f6('0x14')]]['reason']=_0x43fefc[_0x82f6('0x20')];agents[_0x43fefc['destuniqueid']][_0x82f6('0x7')]='complete';writeDB(agents[_0x43fefc[_0x82f6('0x14')]]);}}catch(_0x31dec7){utils[_0x82f6('0x1b')](util[_0x82f6('0x2')](_0x82f6('0x33'),_0x43fefc[_0x82f6('0x3')]),_0x31dec7);}};exports['blindtransfer']=function(_0x3cb1f0){try{if(!_[_0x82f6('0x1d')](agents[_0x3cb1f0['transfereruniqueid']])){utils['debug'](util[_0x82f6('0x2')](_0x82f6('0x38'),_0x3cb1f0[_0x82f6('0x3')]),_0x3cb1f0);utils['info'](util[_0x82f6('0x2')](_0x82f6('0x39'),_0x3cb1f0[_0x82f6('0x3')],agents[_0x3cb1f0[_0x82f6('0x3a')]]['membername'],agents[_0x3cb1f0['transfereruniqueid']][_0x82f6('0x3')]));agents[_0x3cb1f0[_0x82f6('0x3a')]][_0x82f6('0x3b')]=!![];agents[_0x3cb1f0['transfereruniqueid']][_0x82f6('0x3c')]=_0x82f6('0x3d');agents[_0x3cb1f0['transfereruniqueid']]['transferexten']=_0x3cb1f0['extension'];agents[_0x3cb1f0[_0x82f6('0x3a')]]['transferuniqueid']=agents[_0x3cb1f0[_0x82f6('0x3a')]]['uniqueid'];}}catch(_0x33c359){utils['error'](util[_0x82f6('0x2')]('[%s][agents][blindtransfer]',_0x3cb1f0[_0x82f6('0x3')]),_0x33c359);}};exports[_0x82f6('0x3e')]=function(_0x44de65){try{utils[_0x82f6('0x12')](util[_0x82f6('0x2')](_0x82f6('0x3f'),_0x44de65['origtransfereruniqueid']),_0x44de65);if(_0x44de65[_0x82f6('0x40')]==_0x44de65[_0x82f6('0x41')]){if(!_[_0x82f6('0x1d')](agents[_0x44de65['secondtransfereruniqueid']])){utils['info'](util[_0x82f6('0x2')](_0x82f6('0x42'),_0x44de65[_0x82f6('0x40')],agents[_0x44de65[_0x82f6('0x43')]]['membername']));agents[_0x44de65[_0x82f6('0x43')]][_0x82f6('0x3b')]=!![];agents[_0x44de65[_0x82f6('0x43')]]['transfertype']='ATTENDED';agents[_0x44de65['secondtransfereruniqueid']][_0x82f6('0x44')]=_0x44de65[_0x82f6('0x45')];agents[_0x44de65[_0x82f6('0x43')]][_0x82f6('0x46')]=_0x44de65[_0x82f6('0x40')];}if(_0x44de65[_0x82f6('0x47')]&&agents[_0x44de65[_0x82f6('0x47')]]){agents[_0x44de65[_0x82f6('0x47')]]['agententerreason']=0x1;transfers[_0x44de65[_0x82f6('0x47')]]=_[_0x82f6('0x48')](agents[_0x44de65[_0x82f6('0x47')]]);transfers[_0x44de65[_0x82f6('0x47')]]['calleridnum']=agents[_0x44de65['secondtransfereruniqueid']][_0x82f6('0x49')];transfers[_0x44de65[_0x82f6('0x47')]]['calleridname']=agents[_0x44de65[_0x82f6('0x43')]][_0x82f6('0x4a')];transfers[_0x44de65[_0x82f6('0x47')]]['agentcalledAt']=utils[_0x82f6('0x2b')]();transfers[_0x44de65[_0x82f6('0x47')]][_0x82f6('0x37')]=utils[_0x82f6('0x2b')]();transfers[_0x44de65[_0x82f6('0x47')]][_0x82f6('0x21')]=0x0;transfers[_0x44de65['transfereeuniqueid']][_0x82f6('0x4b')]=0x2;}}else if(_0x44de65[_0x82f6('0x43')]==_0x44de65[_0x82f6('0x4c')]){if(!_[_0x82f6('0x1d')](agents[_0x44de65[_0x82f6('0x40')]])){utils['info'](util[_0x82f6('0x2')](_0x82f6('0x42'),_0x44de65[_0x82f6('0x40')],agents[_0x44de65[_0x82f6('0x40')]][_0x82f6('0x5')]));agents[_0x44de65[_0x82f6('0x40')]][_0x82f6('0x3b')]=!![];agents[_0x44de65[_0x82f6('0x40')]]['transfertype']=_0x82f6('0x4d');agents[_0x44de65['origtransfereruniqueid']][_0x82f6('0x44')]=_0x44de65[_0x82f6('0x4e')];agents[_0x44de65['origtransfereruniqueid']][_0x82f6('0x46')]=_0x44de65[_0x82f6('0x43')];}if(_0x44de65[_0x82f6('0x4f')]&&agents[_0x44de65['transfertargetuniqueid']]){agents[_0x44de65['transfertargetuniqueid']][_0x82f6('0x4b')]=0x1;transfers[_0x44de65[_0x82f6('0x4f')]]=_['clone'](agents[_0x44de65['transfertargetuniqueid']]);transfers[_0x44de65[_0x82f6('0x4f')]][_0x82f6('0x49')]=agents[_0x44de65[_0x82f6('0x40')]][_0x82f6('0x49')];transfers[_0x44de65[_0x82f6('0x4f')]][_0x82f6('0x4a')]=agents[_0x44de65[_0x82f6('0x40')]][_0x82f6('0x4a')];transfers[_0x44de65[_0x82f6('0x4f')]][_0x82f6('0x15')]=utils[_0x82f6('0x2b')]();transfers[_0x44de65[_0x82f6('0x4f')]]['agentconnectAt']=utils[_0x82f6('0x2b')]();transfers[_0x44de65[_0x82f6('0x4f')]][_0x82f6('0x21')]=0x0;transfers[_0x44de65[_0x82f6('0x4f')]][_0x82f6('0x4b')]=0x2;}}}catch(_0x4ef838){utils[_0x82f6('0x1b')](util[_0x82f6('0x2')](_0x82f6('0x3f'),_0x44de65['origtransfereruniqueid']),_0x4ef838);}};exports[_0x82f6('0x50')]=function(_0x192dc7){try{utils[_0x82f6('0x12')](util[_0x82f6('0x2')](_0x82f6('0x51'),_0x192dc7[_0x82f6('0x3')]),_0x192dc7);if(agents[_0x192dc7[_0x82f6('0x3')]]&&agents[_0x192dc7['uniqueid']][_0x82f6('0x20')]==='timeout'){if(_0x192dc7[_0x82f6('0x52')]==='21'){agents[_0x192dc7[_0x82f6('0x3')]][_0x82f6('0x20')]=_0x82f6('0x53');agents[_0x192dc7[_0x82f6('0x3')]][_0x82f6('0x7')]=_0x82f6('0x53');}utils[_0x82f6('0x19')](util[_0x82f6('0x2')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x192dc7[_0x82f6('0x3')],agents[_0x192dc7[_0x82f6('0x3')]][_0x82f6('0x5')],agents[_0x192dc7[_0x82f6('0x3')]][_0x82f6('0x20')],agents[_0x192dc7[_0x82f6('0x3')]]['lastevent']));writeDB(agents[_0x192dc7[_0x82f6('0x3')]]);var _0x443547=unanswered['indexOf'](_0x192dc7['uniqueid']);if(_0x443547>-0x1){unanswered[_0x82f6('0x54')](_0x443547,0x1);}}if(transfers[_0x192dc7[_0x82f6('0x3')]]){transfers[_0x192dc7[_0x82f6('0x3')]][_0x82f6('0x32')]=!![];transfers[_0x192dc7[_0x82f6('0x3')]][_0x82f6('0x35')]=utils['now']();transfers[_0x192dc7[_0x82f6('0x3')]]['talktime']=utils[_0x82f6('0x36')](transfers[_0x192dc7['uniqueid']][_0x82f6('0x35')],transfers[_0x192dc7['uniqueid']][_0x82f6('0x37')]);transfers[_0x192dc7[_0x82f6('0x3')]][_0x82f6('0x20')]='agent';transfers[_0x192dc7[_0x82f6('0x3')]]['lastevent']=_0x82f6('0x55');utils[_0x82f6('0x19')](util[_0x82f6('0x2')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x192dc7[_0x82f6('0x3')],transfers[_0x192dc7[_0x82f6('0x3')]][_0x82f6('0x5')],transfers[_0x192dc7['uniqueid']]['reason'],transfers[_0x192dc7[_0x82f6('0x3')]][_0x82f6('0x7')]));writeDB(transfers[_0x192dc7[_0x82f6('0x3')]],!![]);}if(agents[_0x192dc7[_0x82f6('0x3')]]&&agents[_0x192dc7[_0x82f6('0x3')]][_0x82f6('0x37')]){agents[_0x192dc7[_0x82f6('0x3')]][_0x82f6('0x32')]=!![];agents[_0x192dc7['uniqueid']][_0x82f6('0x35')]=utils[_0x82f6('0x2b')]();agents[_0x192dc7['uniqueid']][_0x82f6('0x23')]=utils[_0x82f6('0x36')](agents[_0x192dc7[_0x82f6('0x3')]]['agentcompleteAt'],agents[_0x192dc7[_0x82f6('0x3')]][_0x82f6('0x37')]);agents[_0x192dc7[_0x82f6('0x3')]][_0x82f6('0x20')]=agents[_0x192dc7['uniqueid']][_0x82f6('0x3b')]?_0x82f6('0x3b'):_0x82f6('0x56');agents[_0x192dc7[_0x82f6('0x3')]][_0x82f6('0x7')]=_0x82f6('0x55');utils['info'](util[_0x82f6('0x2')](_0x82f6('0x57'),_0x192dc7[_0x82f6('0x3')],agents[_0x192dc7[_0x82f6('0x3')]][_0x82f6('0x5')],agents[_0x192dc7['uniqueid']][_0x82f6('0x20')],agents[_0x192dc7['uniqueid']][_0x82f6('0x7')]));writeDB(agents[_0x192dc7[_0x82f6('0x3')]]);}}catch(_0x425e33){utils[_0x82f6('0x1b')](util[_0x82f6('0x2')](_0x82f6('0x51'),_0x192dc7[_0x82f6('0x3')]),_0x425e33);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index b59e176..9d453d5 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 _0x6162=['endtime','billableseconds','diffTime','attendedtransfer','origtransfereruniqueid','localtwolinkedid','transfereechannel','secondtransfererchannel','_attended','transfertargetchannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfererchannel','userfield','[%s][calls][attendedtransfer]','musiconholdstartAt','[%s][calls][musiconholdstart]','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','Queue','lastdata','xmd-contactid','ContactId','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','[%s][calls][varset]','newexten','[%s][calls][newexten]','appdata','application','toLowerCase','set','startsWith','split','substring','lastIndexOf','includes','hangup','noop','gotoif','lastapplication','lodash','util','./utils','NO\x20ANSWER','ANSWERED','BUSY','FAILED','info','uniqueid','queue','interface','calleridnum','lastevent','accountcode','getUserByInternal','then','UserId','CreateVoiceCallReport','request','newchannel','debug','[%s][calls][newchannel]','channel','OutgoingSpoolFailed','format','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','now','error','newstate','[%s][calls][newstate]','isNil','systemanswertime','linkedid','channelstate','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','duration'];(function(_0x1cb7b9,_0x1d2489){var _0x13f4a3=function(_0x4a1cef){while(--_0x4a1cef){_0x1cb7b9['push'](_0x1cb7b9['shift']());}};_0x13f4a3(++_0x1d2489);}(_0x6162,0x172));var _0x2616=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x6162[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x2616('0x0'));var util=require(_0x2616('0x1'));var utils=require(_0x2616('0x2'));var dispositions=[_0x2616('0x3'),'FAILED','FAILED',_0x2616('0x3'),_0x2616('0x3'),_0x2616('0x3'),_0x2616('0x4'),_0x2616('0x5'),_0x2616('0x6'),_0x2616('0x6'),'FAILED'];var channels={};function writeDB(_0x5f57c3){utils[_0x2616('0x7')](util['format']('[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x5f57c3[_0x2616('0x8')],_0x5f57c3['channel'],_0x5f57c3[_0x2616('0x9')],_0x5f57c3['membername'],_0x5f57c3[_0x2616('0xa')],_0x5f57c3[_0x2616('0xb')],_0x5f57c3['connectedlinenum'],_0x5f57c3[_0x2616('0xc')]));if(_0x5f57c3[_0x2616('0xd')]){utils[_0x2616('0xe')](_0x5f57c3['accountcode'])[_0x2616('0xf')](function(_0x36a52a){if(_0x36a52a){_0x5f57c3[_0x2616('0x10')]=_0x36a52a['id'];}utils['request'](_0x2616('0x11'),_0x5f57c3);});}else{utils[_0x2616('0x12')]('CreateVoiceCallReport',_0x5f57c3);}if(channels[_0x5f57c3[_0x2616('0x8')]]){delete channels[_0x5f57c3[_0x2616('0x8')]];}}exports[_0x2616('0x13')]=function(_0x1839f8){try{utils[_0x2616('0x14')](util['format'](_0x2616('0x15'),_0x1839f8[_0x2616('0x8')]),_0x1839f8);if(_0x1839f8[_0x2616('0x8')]==_0x1839f8['linkedid']&&_0x1839f8[_0x2616('0x16')]!=_0x2616('0x17')){utils['info'](util[_0x2616('0x18')](_0x2616('0x19'),_0x1839f8[_0x2616('0x8')],_0x1839f8[_0x2616('0x1a')],_0x1839f8['exten']));channels[_0x1839f8['uniqueid']]={'uniqueid':_0x1839f8['uniqueid'],'accountcode':_0x1839f8[_0x2616('0xd')],'source':_0x1839f8[_0x2616('0xb')],'destination':_0x1839f8['exten'],'destinationcontext':_0x1839f8[_0x2616('0x1a')],'channel':_0x1839f8[_0x2616('0x16')],'starttime':utils[_0x2616('0x1b')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x2616('0x3'),'amaflags':'DOCUMENTATION'};}}catch(_0x26dd91){utils[_0x2616('0x1c')](util['format'](_0x2616('0x15'),_0x1839f8[_0x2616('0x8')]),_0x26dd91);}};exports[_0x2616('0x1d')]=function(_0x74b7eb){try{utils[_0x2616('0x14')](util['format'](_0x2616('0x1e'),_0x74b7eb[_0x2616('0x8')]),_0x74b7eb);if(!_[_0x2616('0x1f')](channels[_0x74b7eb['uniqueid']])&&_0x74b7eb['channelstate']==0x6){utils[_0x2616('0x7')](util[_0x2616('0x18')]('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x74b7eb[_0x2616('0x8')],_0x74b7eb[_0x2616('0x1a')],_0x74b7eb[_0x2616('0x16')]));if(_[_0x2616('0x1f')](channels[_0x74b7eb[_0x2616('0x8')]]['systemanswertime'])){channels[_0x74b7eb[_0x2616('0x8')]][_0x2616('0x20')]=utils[_0x2616('0x1b')]();}}else if(!_[_0x2616('0x1f')](channels[_0x74b7eb[_0x2616('0x21')]])&&_0x74b7eb[_0x2616('0x22')]==0x6&&_0x74b7eb[_0x2616('0x1a')]!=_0x2616('0x23')){utils[_0x2616('0x7')](util[_0x2616('0x18')](_0x2616('0x24'),_0x74b7eb[_0x2616('0x8')],_0x74b7eb['linkedid'],_0x74b7eb[_0x2616('0x1a')],_0x74b7eb[_0x2616('0x16')]));channels[_0x74b7eb[_0x2616('0x21')]][_0x2616('0xd')]=_0x74b7eb['accountcode'];channels[_0x74b7eb[_0x2616('0x21')]][_0x2616('0x25')]=_0x74b7eb[_0x2616('0x16')];if(_[_0x2616('0x1f')](channels[_0x74b7eb[_0x2616('0x21')]][_0x2616('0x26')])){channels[_0x74b7eb[_0x2616('0x21')]]['answertime']=utils[_0x2616('0x1b')]();}channels[_0x74b7eb[_0x2616('0x21')]][_0x2616('0x27')]=dispositions[_['toNumber'](_0x74b7eb[_0x2616('0x22')])]||_0x2616('0x4');}}catch(_0x52eaa8){utils['error'](util[_0x2616('0x18')](_0x2616('0x1e'),_0x74b7eb[_0x2616('0x8')]),_0x52eaa8);}};exports['hangup']=function(_0x5749e2){try{if(!_[_0x2616('0x1f')](channels[_0x5749e2['uniqueid']])){utils['debug'](util[_0x2616('0x18')](_0x2616('0x28'),_0x5749e2['uniqueid']),_0x5749e2);if(_[_0x2616('0x1f')](channels[_0x5749e2[_0x2616('0x8')]][_0x2616('0x29')])){channels[_0x5749e2[_0x2616('0x8')]]['callerid']=_0x5749e2[_0x2616('0x2a')]+'\x20<'+_0x5749e2[_0x2616('0xb')]+'>';}utils['info'](util[_0x2616('0x18')](_0x2616('0x2b'),_0x5749e2[_0x2616('0x8')],channels[_0x5749e2['uniqueid']][_0x2616('0x29')],_0x5749e2[_0x2616('0x2c')]));channels[_0x5749e2[_0x2616('0x8')]]['endtime']=utils[_0x2616('0x1b')]();channels[_0x5749e2[_0x2616('0x8')]][_0x2616('0x2d')]=utils['diffTime'](channels[_0x5749e2[_0x2616('0x8')]][_0x2616('0x2e')],channels[_0x5749e2[_0x2616('0x8')]]['starttime']);channels[_0x5749e2[_0x2616('0x8')]][_0x2616('0x2f')]=channels[_0x5749e2[_0x2616('0x8')]][_0x2616('0x26')]?utils[_0x2616('0x30')](channels[_0x5749e2[_0x2616('0x8')]]['endtime'],channels[_0x5749e2['uniqueid']][_0x2616('0x26')]):0x0;writeDB(channels[_0x5749e2[_0x2616('0x8')]]);}}catch(_0x1da559){utils[_0x2616('0x1c')](util['format'](_0x2616('0x28'),_0x5749e2[_0x2616('0x8')]),_0x1da559);}};exports[_0x2616('0x31')]=function(_0x1fcdd1){try{if(!_[_0x2616('0x1f')](channels[_0x1fcdd1['localtwolinkedid']])){utils[_0x2616('0x14')](util['format']('[%s][calls][attendedtransfer]',_0x1fcdd1[_0x2616('0x32')]),_0x1fcdd1);if(channels[_0x1fcdd1[_0x2616('0x33')]]['channel']==_0x1fcdd1[_0x2616('0x34')]){utils[_0x2616('0x7')](util[_0x2616('0x18')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x1fcdd1[_0x2616('0x32')],_0x1fcdd1['localtwolinkedid'],_0x1fcdd1[_0x2616('0x35')]));channels[_0x1fcdd1['localtwolinkedid']][_0x2616('0x25')]=_0x1fcdd1[_0x2616('0x35')];channels[_0x1fcdd1[_0x2616('0x33')]]['userfield']=_0x2616('0x36');}else if(channels[_0x1fcdd1[_0x2616('0x33')]][_0x2616('0x16')]=_0x1fcdd1[_0x2616('0x37')]){utils['info'](util['format'](_0x2616('0x38'),_0x1fcdd1[_0x2616('0x32')],_0x1fcdd1[_0x2616('0x33')],_0x1fcdd1[_0x2616('0x39')]));channels[_0x1fcdd1[_0x2616('0x33')]]['destinationchannel']=_0x1fcdd1[_0x2616('0x39')];channels[_0x1fcdd1['localtwolinkedid']][_0x2616('0x3a')]=_0x2616('0x36');}}}catch(_0x2e7f26){utils['error'](util[_0x2616('0x18')](_0x2616('0x3b'),_0x1fcdd1[_0x2616('0x32')]),_0x2e7f26);}};exports['musiconholdstart']=function(_0x175c4e){try{if(!_[_0x2616('0x1f')](channels[_0x175c4e[_0x2616('0x8')]])){utils[_0x2616('0x14')](util['format']('[%s][calls][musiconholdstart]',_0x175c4e['uniqueid']),_0x175c4e);channels[_0x175c4e[_0x2616('0x8')]][_0x2616('0x3c')]=utils[_0x2616('0x1b')]();utils[_0x2616('0x7')](util[_0x2616('0x18')]('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x175c4e[_0x2616('0x8')],channels[_0x175c4e[_0x2616('0x8')]][_0x2616('0x3c')]));}}catch(_0x251108){utils[_0x2616('0x1c')](util[_0x2616('0x18')](_0x2616('0x3d'),_0x175c4e[_0x2616('0x8')]),_0x251108);}};exports['musiconholdstop']=function(_0x442ccf){try{if(!_[_0x2616('0x1f')](channels[_0x442ccf['uniqueid']])){utils[_0x2616('0x14')](util[_0x2616('0x18')](_0x2616('0x3e'),_0x442ccf[_0x2616('0x8')]),_0x442ccf);if(!_[_0x2616('0x1f')](channels[_0x442ccf['uniqueid']][_0x2616('0x3c')])){channels[_0x442ccf[_0x2616('0x8')]][_0x2616('0x3f')]+=utils[_0x2616('0x30')](utils[_0x2616('0x1b')](),channels[_0x442ccf[_0x2616('0x8')]][_0x2616('0x3c')]);utils[_0x2616('0x7')](util[_0x2616('0x18')](_0x2616('0x40'),_0x442ccf[_0x2616('0x8')],channels[_0x442ccf[_0x2616('0x8')]][_0x2616('0x3f')]));delete channels[_0x442ccf['uniqueid']][_0x2616('0x3c')];}}}catch(_0x17b16c){utils[_0x2616('0x1c')](util[_0x2616('0x18')](_0x2616('0x3e'),_0x442ccf[_0x2616('0x8')]),_0x17b16c);}};exports[_0x2616('0x41')]=function(_0x4385fb){try{if(!_[_0x2616('0x1f')](channels[_0x4385fb[_0x2616('0x8')]])){utils[_0x2616('0x14')](util[_0x2616('0x18')]('[%s][calls][varset]',_0x4385fb['uniqueid']),_0x4385fb);if(!_[_0x2616('0x1f')](_0x4385fb[_0x2616('0x42')][_0x2616('0x43')])){utils['info'](util['format'](_0x2616('0x44'),_0x4385fb['uniqueid'],_0x4385fb[_0x2616('0x45')]));channels[_0x4385fb['uniqueid']][_0x2616('0x46')]=_0x4385fb[_0x2616('0x45')];}if(!_[_0x2616('0x1f')](_0x4385fb[_0x2616('0x42')]['xmd-phone'])){utils[_0x2616('0x7')](util['format'](_0x2616('0x47'),_0x4385fb['uniqueid'],_0x4385fb['value']));channels[_0x4385fb[_0x2616('0x8')]][_0x2616('0x48')]=_0x4385fb['value'];channels[_0x4385fb[_0x2616('0x8')]]['callerid']='\x22'+_0x4385fb[_0x2616('0x45')]+_0x2616('0x49')+_0x4385fb[_0x2616('0x45')]+'>';}if(!_[_0x2616('0x1f')](_0x4385fb[_0x2616('0x42')][_0x2616('0x4a')])||!_[_0x2616('0x1f')](_0x4385fb['variable'][_0x2616('0x4b')])){utils['info'](util[_0x2616('0x18')](_0x2616('0x4c'),_0x4385fb[_0x2616('0x8')],!_[_0x2616('0x1f')](_0x4385fb[_0x2616('0x42')][_0x2616('0x4a')])?_0x2616('0x4a'):'xmd-callerid',_0x4385fb['value']));channels[_0x4385fb[_0x2616('0x8')]][_0x2616('0x29')]=_0x4385fb[_0x2616('0x45')];}if(!_[_0x2616('0x1f')](_0x4385fb[_0x2616('0x42')][_0x2616('0x4d')])||!_[_0x2616('0x1f')](_0x4385fb[_0x2616('0x42')][_0x2616('0x4e')])){utils[_0x2616('0x7')](util[_0x2616('0x18')](_0x2616('0x4c'),_0x4385fb[_0x2616('0x8')],!_[_0x2616('0x1f')](_0x4385fb[_0x2616('0x42')][_0x2616('0x4d')])?_0x2616('0x4d'):_0x2616('0x4e'),_0x4385fb[_0x2616('0x45')]));channels[_0x4385fb[_0x2616('0x8')]]['lastapplication']=_0x2616('0x4f');channels[_0x4385fb[_0x2616('0x8')]][_0x2616('0x50')]=_0x4385fb[_0x2616('0x45')];channels[_0x4385fb[_0x2616('0x8')]]['queue']=!![];}if(!_[_0x2616('0x1f')](_0x4385fb[_0x2616('0x42')][_0x2616('0x51')])){utils[_0x2616('0x7')](util[_0x2616('0x18')]('[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s',_0x4385fb[_0x2616('0x8')],_0x4385fb[_0x2616('0x45')]));channels[_0x4385fb['uniqueid']][_0x2616('0x52')]=_0x4385fb[_0x2616('0x45')];}if(!_[_0x2616('0x1f')](_0x4385fb['variable']['xmd-cdrtype'])){utils['info'](util[_0x2616('0x18')](_0x2616('0x53'),_0x4385fb['uniqueid'],_0x4385fb['value']));channels[_0x4385fb['uniqueid']][_0x2616('0x54')]=_0x4385fb[_0x2616('0x45')];}if(!_[_0x2616('0x1f')](_0x4385fb['variable'][_0x2616('0x55')])){utils['info'](util[_0x2616('0x18')]('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x4385fb['uniqueid'],_0x4385fb[_0x2616('0x45')]));channels[_0x4385fb['uniqueid']]['routeid']=_0x4385fb[_0x2616('0x45')];}if(!_['isNil'](_0x4385fb[_0x2616('0x42')][_0x2616('0x56')])){utils[_0x2616('0x7')](util['format'](_0x2616('0x57'),_0x4385fb['uniqueid'],_0x4385fb['value']));channels[_0x4385fb[_0x2616('0x8')]][_0x2616('0x56')]=_0x4385fb[_0x2616('0x45')];}}}catch(_0x5e8243){utils[_0x2616('0x1c')](util[_0x2616('0x18')](_0x2616('0x58'),_0x4385fb[_0x2616('0x8')]),_0x5e8243);}};exports[_0x2616('0x59')]=function(_0x463536){try{if(!_[_0x2616('0x1f')](channels[_0x463536[_0x2616('0x8')]])){utils[_0x2616('0x14')](util[_0x2616('0x18')](_0x2616('0x5a'),_0x463536['uniqueid']),_0x463536);utils[_0x2616('0x7')](util[_0x2616('0x18')]('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0x463536['uniqueid'],_0x463536['application'],_0x463536[_0x2616('0x5b')]));if(_0x463536[_0x2616('0x5c')][_0x2616('0x5d')]()==_0x2616('0x5e')&&_[_0x2616('0x5f')](_0x463536['appdata'][_0x2616('0x5d')](),'cdr')){var _0x14114f=_0x463536[_0x2616('0x5b')][_0x2616('0x60')]('=');var _0x17ca73=_0x14114f[0x0][_0x2616('0x61')](_0x14114f[0x0][_0x2616('0x62')]('(')+0x1,_0x14114f[0x0][_0x2616('0x62')](')'));var _0x3772e9=_0x14114f[0x1];channels[_0x463536[_0x2616('0x8')]][_0x17ca73]=_0x3772e9;}if(!_[_0x2616('0x63')]([_0x2616('0x64'),_0x2616('0x65'),'execif',_0x2616('0x5e'),_0x2616('0x66')],_0x463536[_0x2616('0x5c')][_0x2616('0x5d')]())){channels[_0x463536['uniqueid']][_0x2616('0x67')]=_0x463536[_0x2616('0x5c')];channels[_0x463536[_0x2616('0x8')]]['lastdata']=_0x463536[_0x2616('0x5b')];}}}catch(_0x5e0e46){utils['error'](util[_0x2616('0x18')](_0x2616('0x5a'),_0x463536['uniqueid']),_0x5e0e46);}}; \ No newline at end of file +var _0xde30=['[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','[%s][calls][varset]','newexten','[%s][calls][newexten]','application','appdata','startsWith','toLowerCase','cdr','substring','lastIndexOf','includes','gotoif','lodash','util','./utils','NO\x20ANSWER','FAILED','BUSY','info','format','uniqueid','channel','queue','membername','interface','connectedlinenum','lastevent','accountcode','getUserByInternal','then','request','CreateVoiceCallReport','newchannel','debug','[%s][calls][newchannel]','linkedid','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','calleridnum','now','DOCUMENTATION','error','newstate','[%s][calls][newstate]','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','isNil','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','answertime','toNumber','ANSWERED','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','diffTime','starttime','billableseconds','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','destinationchannel','userfield','_attended','transfertargetchannel','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','xmd-phone','destination','\x22\x20<','xmd-callerid','xmd-callerid-preview','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','xmd-cdrtype','type','outboundrouteid'];(function(_0xd6d4fb,_0x3f0a0e){var _0x37650c=function(_0x20d46b){while(--_0x20d46b){_0xd6d4fb['push'](_0xd6d4fb['shift']());}};_0x37650c(++_0x3f0a0e);}(_0xde30,0xe4));var _0x0de3=function(_0x59a1a7,_0x2432be){_0x59a1a7=_0x59a1a7-0x0;var _0x502d1c=_0xde30[_0x59a1a7];return _0x502d1c;};'use strict';var _=require(_0x0de3('0x0'));var util=require(_0x0de3('0x1'));var utils=require(_0x0de3('0x2'));var dispositions=[_0x0de3('0x3'),_0x0de3('0x4'),_0x0de3('0x4'),_0x0de3('0x3'),_0x0de3('0x3'),'NO\x20ANSWER','ANSWERED',_0x0de3('0x5'),_0x0de3('0x4'),_0x0de3('0x4'),_0x0de3('0x4')];var channels={};function writeDB(_0x51b8f4){utils[_0x0de3('0x6')](util[_0x0de3('0x7')]('[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x51b8f4[_0x0de3('0x8')],_0x51b8f4[_0x0de3('0x9')],_0x51b8f4[_0x0de3('0xa')],_0x51b8f4[_0x0de3('0xb')],_0x51b8f4[_0x0de3('0xc')],_0x51b8f4['calleridnum'],_0x51b8f4[_0x0de3('0xd')],_0x51b8f4[_0x0de3('0xe')]));if(_0x51b8f4[_0x0de3('0xf')]){utils[_0x0de3('0x10')](_0x51b8f4['accountcode'])[_0x0de3('0x11')](function(_0x2b44fa){if(_0x2b44fa){_0x51b8f4['UserId']=_0x2b44fa['id'];}utils[_0x0de3('0x12')](_0x0de3('0x13'),_0x51b8f4);});}else{utils[_0x0de3('0x12')](_0x0de3('0x13'),_0x51b8f4);}if(channels[_0x51b8f4[_0x0de3('0x8')]]){delete channels[_0x51b8f4[_0x0de3('0x8')]];}}exports[_0x0de3('0x14')]=function(_0x41bae6){try{utils[_0x0de3('0x15')](util['format'](_0x0de3('0x16'),_0x41bae6['uniqueid']),_0x41bae6);if(_0x41bae6[_0x0de3('0x8')]==_0x41bae6[_0x0de3('0x17')]&&_0x41bae6['channel']!='OutgoingSpoolFailed'){utils['info'](util['format'](_0x0de3('0x18'),_0x41bae6[_0x0de3('0x8')],_0x41bae6[_0x0de3('0x19')],_0x41bae6[_0x0de3('0x1a')]));channels[_0x41bae6[_0x0de3('0x8')]]={'uniqueid':_0x41bae6['uniqueid'],'accountcode':_0x41bae6[_0x0de3('0xf')],'source':_0x41bae6[_0x0de3('0x1b')],'destination':_0x41bae6[_0x0de3('0x1a')],'destinationcontext':_0x41bae6[_0x0de3('0x19')],'channel':_0x41bae6[_0x0de3('0x9')],'starttime':utils[_0x0de3('0x1c')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x0de3('0x3'),'amaflags':_0x0de3('0x1d')};}}catch(_0x122942){utils[_0x0de3('0x1e')](util[_0x0de3('0x7')](_0x0de3('0x16'),_0x41bae6[_0x0de3('0x8')]),_0x122942);}};exports[_0x0de3('0x1f')]=function(_0xb84148){try{utils[_0x0de3('0x15')](util[_0x0de3('0x7')](_0x0de3('0x20'),_0xb84148[_0x0de3('0x8')]),_0xb84148);if(!_['isNil'](channels[_0xb84148[_0x0de3('0x8')]])&&_0xb84148[_0x0de3('0x21')]==0x6){utils[_0x0de3('0x6')](util['format'](_0x0de3('0x22'),_0xb84148[_0x0de3('0x8')],_0xb84148[_0x0de3('0x19')],_0xb84148[_0x0de3('0x9')]));if(_[_0x0de3('0x23')](channels[_0xb84148[_0x0de3('0x8')]][_0x0de3('0x24')])){channels[_0xb84148[_0x0de3('0x8')]][_0x0de3('0x24')]=utils[_0x0de3('0x1c')]();}}else if(!_[_0x0de3('0x23')](channels[_0xb84148[_0x0de3('0x17')]])&&_0xb84148['channelstate']==0x6&&_0xb84148[_0x0de3('0x19')]!=_0x0de3('0x25')){utils[_0x0de3('0x6')](util['format'](_0x0de3('0x26'),_0xb84148[_0x0de3('0x8')],_0xb84148[_0x0de3('0x17')],_0xb84148[_0x0de3('0x19')],_0xb84148[_0x0de3('0x9')]));channels[_0xb84148[_0x0de3('0x17')]][_0x0de3('0xf')]=_0xb84148[_0x0de3('0xf')];channels[_0xb84148['linkedid']]['destinationchannel']=_0xb84148['channel'];if(_[_0x0de3('0x23')](channels[_0xb84148[_0x0de3('0x17')]]['answertime'])){channels[_0xb84148['linkedid']][_0x0de3('0x27')]=utils[_0x0de3('0x1c')]();}channels[_0xb84148[_0x0de3('0x17')]]['disposition']=dispositions[_[_0x0de3('0x28')](_0xb84148['channelstate'])]||_0x0de3('0x29');}}catch(_0xfe9804){utils[_0x0de3('0x1e')](util[_0x0de3('0x7')](_0x0de3('0x20'),_0xb84148[_0x0de3('0x8')]),_0xfe9804);}};exports[_0x0de3('0x2a')]=function(_0x4ce866){try{if(!_[_0x0de3('0x23')](channels[_0x4ce866[_0x0de3('0x8')]])){utils['debug'](util[_0x0de3('0x7')](_0x0de3('0x2b'),_0x4ce866['uniqueid']),_0x4ce866);if(_[_0x0de3('0x23')](channels[_0x4ce866['uniqueid']][_0x0de3('0x2c')])){channels[_0x4ce866[_0x0de3('0x8')]]['callerid']=_0x4ce866[_0x0de3('0x2d')]+'\x20<'+_0x4ce866[_0x0de3('0x1b')]+'>';}utils['info'](util[_0x0de3('0x7')](_0x0de3('0x2e'),_0x4ce866[_0x0de3('0x8')],channels[_0x4ce866[_0x0de3('0x8')]][_0x0de3('0x2c')],_0x4ce866[_0x0de3('0x2f')]));channels[_0x4ce866[_0x0de3('0x8')]][_0x0de3('0x30')]=utils['now']();channels[_0x4ce866[_0x0de3('0x8')]][_0x0de3('0x31')]=utils[_0x0de3('0x32')](channels[_0x4ce866[_0x0de3('0x8')]][_0x0de3('0x30')],channels[_0x4ce866[_0x0de3('0x8')]][_0x0de3('0x33')]);channels[_0x4ce866[_0x0de3('0x8')]][_0x0de3('0x34')]=channels[_0x4ce866[_0x0de3('0x8')]][_0x0de3('0x27')]?utils[_0x0de3('0x32')](channels[_0x4ce866['uniqueid']][_0x0de3('0x30')],channels[_0x4ce866[_0x0de3('0x8')]]['answertime']):0x0;writeDB(channels[_0x4ce866[_0x0de3('0x8')]]);}}catch(_0x30b3b7){utils[_0x0de3('0x1e')](util[_0x0de3('0x7')](_0x0de3('0x2b'),_0x4ce866[_0x0de3('0x8')]),_0x30b3b7);}};exports[_0x0de3('0x35')]=function(_0x1c7306){try{if(!_[_0x0de3('0x23')](channels[_0x1c7306[_0x0de3('0x36')]])){utils[_0x0de3('0x15')](util[_0x0de3('0x7')](_0x0de3('0x37'),_0x1c7306[_0x0de3('0x38')]),_0x1c7306);if(channels[_0x1c7306[_0x0de3('0x36')]]['channel']==_0x1c7306[_0x0de3('0x39')]){utils[_0x0de3('0x6')](util[_0x0de3('0x7')](_0x0de3('0x3a'),_0x1c7306[_0x0de3('0x38')],_0x1c7306['localtwolinkedid'],_0x1c7306[_0x0de3('0x3b')]));channels[_0x1c7306[_0x0de3('0x36')]][_0x0de3('0x3c')]=_0x1c7306[_0x0de3('0x3b')];channels[_0x1c7306[_0x0de3('0x36')]][_0x0de3('0x3d')]=_0x0de3('0x3e');}else if(channels[_0x1c7306[_0x0de3('0x36')]][_0x0de3('0x9')]=_0x1c7306[_0x0de3('0x3f')]){utils['info'](util['format'](_0x0de3('0x3a'),_0x1c7306['origtransfereruniqueid'],_0x1c7306[_0x0de3('0x36')],_0x1c7306['origtransfererchannel']));channels[_0x1c7306[_0x0de3('0x36')]][_0x0de3('0x3c')]=_0x1c7306['origtransfererchannel'];channels[_0x1c7306[_0x0de3('0x36')]][_0x0de3('0x3d')]=_0x0de3('0x3e');}}}catch(_0x389e5f){utils[_0x0de3('0x1e')](util[_0x0de3('0x7')]('[%s][calls][attendedtransfer]',_0x1c7306[_0x0de3('0x38')]),_0x389e5f);}};exports['musiconholdstart']=function(_0x5abaf4){try{if(!_[_0x0de3('0x23')](channels[_0x5abaf4[_0x0de3('0x8')]])){utils[_0x0de3('0x15')](util[_0x0de3('0x7')](_0x0de3('0x40'),_0x5abaf4['uniqueid']),_0x5abaf4);channels[_0x5abaf4[_0x0de3('0x8')]][_0x0de3('0x41')]=utils['now']();utils['info'](util[_0x0de3('0x7')](_0x0de3('0x42'),_0x5abaf4['uniqueid'],channels[_0x5abaf4[_0x0de3('0x8')]][_0x0de3('0x41')]));}}catch(_0x54a9c5){utils[_0x0de3('0x1e')](util[_0x0de3('0x7')](_0x0de3('0x40'),_0x5abaf4[_0x0de3('0x8')]),_0x54a9c5);}};exports['musiconholdstop']=function(_0x303fab){try{if(!_[_0x0de3('0x23')](channels[_0x303fab['uniqueid']])){utils['debug'](util['format'](_0x0de3('0x43'),_0x303fab['uniqueid']),_0x303fab);if(!_[_0x0de3('0x23')](channels[_0x303fab['uniqueid']][_0x0de3('0x41')])){channels[_0x303fab[_0x0de3('0x8')]][_0x0de3('0x44')]+=utils[_0x0de3('0x32')](utils[_0x0de3('0x1c')](),channels[_0x303fab['uniqueid']]['musiconholdstartAt']);utils[_0x0de3('0x6')](util[_0x0de3('0x7')](_0x0de3('0x45'),_0x303fab['uniqueid'],channels[_0x303fab[_0x0de3('0x8')]][_0x0de3('0x44')]));delete channels[_0x303fab[_0x0de3('0x8')]][_0x0de3('0x41')];}}}catch(_0x3909a8){utils[_0x0de3('0x1e')](util[_0x0de3('0x7')](_0x0de3('0x43'),_0x303fab[_0x0de3('0x8')]),_0x3909a8);}};exports[_0x0de3('0x46')]=function(_0x567b88){try{if(!_[_0x0de3('0x23')](channels[_0x567b88[_0x0de3('0x8')]])){utils[_0x0de3('0x15')](util[_0x0de3('0x7')]('[%s][calls][varset]',_0x567b88[_0x0de3('0x8')]),_0x567b88);if(!_[_0x0de3('0x23')](_0x567b88[_0x0de3('0x47')][_0x0de3('0x48')])){utils[_0x0de3('0x6')](util['format'](_0x0de3('0x49'),_0x567b88[_0x0de3('0x8')],_0x567b88[_0x0de3('0x4a')]));channels[_0x567b88[_0x0de3('0x8')]]['source']=_0x567b88[_0x0de3('0x4a')];}if(!_[_0x0de3('0x23')](_0x567b88[_0x0de3('0x47')][_0x0de3('0x4b')])){utils[_0x0de3('0x6')](util['format']('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0x567b88[_0x0de3('0x8')],_0x567b88[_0x0de3('0x4a')]));channels[_0x567b88[_0x0de3('0x8')]][_0x0de3('0x4c')]=_0x567b88['value'];channels[_0x567b88['uniqueid']][_0x0de3('0x2c')]='\x22'+_0x567b88[_0x0de3('0x4a')]+_0x0de3('0x4d')+_0x567b88[_0x0de3('0x4a')]+'>';}if(!_[_0x0de3('0x23')](_0x567b88[_0x0de3('0x47')]['xmd-callerid-preview'])||!_[_0x0de3('0x23')](_0x567b88[_0x0de3('0x47')][_0x0de3('0x4e')])){utils[_0x0de3('0x6')](util['format']('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x567b88[_0x0de3('0x8')],!_[_0x0de3('0x23')](_0x567b88[_0x0de3('0x47')][_0x0de3('0x4f')])?_0x0de3('0x4f'):_0x0de3('0x4e'),_0x567b88[_0x0de3('0x4a')]));channels[_0x567b88['uniqueid']][_0x0de3('0x2c')]=_0x567b88['value'];}if(!_[_0x0de3('0x23')](_0x567b88[_0x0de3('0x47')][_0x0de3('0x50')])||!_[_0x0de3('0x23')](_0x567b88[_0x0de3('0x47')][_0x0de3('0x51')])){utils[_0x0de3('0x6')](util[_0x0de3('0x7')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x567b88['uniqueid'],!_[_0x0de3('0x23')](_0x567b88['variable'][_0x0de3('0x50')])?_0x0de3('0x50'):_0x0de3('0x51'),_0x567b88[_0x0de3('0x4a')]));channels[_0x567b88[_0x0de3('0x8')]][_0x0de3('0x52')]=_0x0de3('0x53');channels[_0x567b88['uniqueid']][_0x0de3('0x54')]=_0x567b88[_0x0de3('0x4a')];channels[_0x567b88[_0x0de3('0x8')]]['queue']=!![];}if(!_['isNil'](_0x567b88[_0x0de3('0x47')][_0x0de3('0x55')])){utils[_0x0de3('0x6')](util[_0x0de3('0x7')](_0x0de3('0x56'),_0x567b88[_0x0de3('0x8')],_0x567b88[_0x0de3('0x4a')]));channels[_0x567b88[_0x0de3('0x8')]]['ContactId']=_0x567b88[_0x0de3('0x4a')];}if(!_[_0x0de3('0x23')](_0x567b88[_0x0de3('0x47')][_0x0de3('0x57')])){utils[_0x0de3('0x6')](util[_0x0de3('0x7')]('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x567b88['uniqueid'],_0x567b88['value']));channels[_0x567b88[_0x0de3('0x8')]][_0x0de3('0x58')]=_0x567b88[_0x0de3('0x4a')];}if(!_[_0x0de3('0x23')](_0x567b88[_0x0de3('0x47')][_0x0de3('0x59')])){utils[_0x0de3('0x6')](util['format'](_0x0de3('0x5a'),_0x567b88[_0x0de3('0x8')],_0x567b88['value']));channels[_0x567b88[_0x0de3('0x8')]][_0x0de3('0x5b')]=_0x567b88[_0x0de3('0x4a')];}if(!_[_0x0de3('0x23')](_0x567b88[_0x0de3('0x47')][_0x0de3('0x5c')])){utils[_0x0de3('0x6')](util[_0x0de3('0x7')](_0x0de3('0x5d'),_0x567b88[_0x0de3('0x8')],_0x567b88[_0x0de3('0x4a')]));channels[_0x567b88[_0x0de3('0x8')]][_0x0de3('0x5c')]=_0x567b88[_0x0de3('0x4a')];}}}catch(_0x1951b6){utils['error'](util[_0x0de3('0x7')](_0x0de3('0x5e'),_0x567b88[_0x0de3('0x8')]),_0x1951b6);}};exports[_0x0de3('0x5f')]=function(_0x53558b){try{if(!_[_0x0de3('0x23')](channels[_0x53558b['uniqueid']])){utils[_0x0de3('0x15')](util[_0x0de3('0x7')](_0x0de3('0x60'),_0x53558b['uniqueid']),_0x53558b);utils[_0x0de3('0x6')](util[_0x0de3('0x7')]('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0x53558b[_0x0de3('0x8')],_0x53558b[_0x0de3('0x61')],_0x53558b[_0x0de3('0x62')]));if(_0x53558b[_0x0de3('0x61')]['toLowerCase']()=='set'&&_[_0x0de3('0x63')](_0x53558b[_0x0de3('0x62')][_0x0de3('0x64')](),_0x0de3('0x65'))){var _0xf5f8a0=_0x53558b[_0x0de3('0x62')]['split']('=');var _0x4d7e8c=_0xf5f8a0[0x0][_0x0de3('0x66')](_0xf5f8a0[0x0][_0x0de3('0x67')]('(')+0x1,_0xf5f8a0[0x0][_0x0de3('0x67')](')'));var _0x25b650=_0xf5f8a0[0x1];channels[_0x53558b[_0x0de3('0x8')]][_0x4d7e8c]=_0x25b650;}if(!_[_0x0de3('0x68')]([_0x0de3('0x2a'),'noop','execif','set',_0x0de3('0x69')],_0x53558b[_0x0de3('0x61')][_0x0de3('0x64')]())){channels[_0x53558b['uniqueid']][_0x0de3('0x52')]=_0x53558b['application'];channels[_0x53558b['uniqueid']][_0x0de3('0x54')]=_0x53558b[_0x0de3('0x62')];}}}catch(_0x413328){utils[_0x0de3('0x1e')](util[_0x0de3('0x7')](_0x0de3('0x60'),_0x53558b[_0x0de3('0x8')]),_0x413328);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index f378acb..a6ecf0a 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 _0xf4cb=['[core]\x20error','close','managerevent','connect','info','[core]\x20connected','shutdown','[core]\x20shutdown','fullybooted','error'];(function(_0x5b550f,_0x5b75aa){var _0x2bdb60=function(_0x41f851){while(--_0x41f851){_0x5b550f['push'](_0x5b550f['shift']());}};_0x2bdb60(++_0x5b75aa);}(_0xf4cb,0x1c5));var _0xbf4c=function(_0x3357e8,_0x12e746){_0x3357e8=_0x3357e8-0x0;var _0x231d91=_0xf4cb[_0x3357e8];return _0x231d91;};'use strict';var utils=require('./utils');exports[_0xbf4c('0x0')]=function(){utils[_0xbf4c('0x1')](_0xbf4c('0x2'));};exports[_0xbf4c('0x3')]=function(){utils[_0xbf4c('0x1')](_0xbf4c('0x4'));};exports[_0xbf4c('0x5')]=function(){utils[_0xbf4c('0x1')]('[core]\x20fullybooted');};exports[_0xbf4c('0x6')]=function(_0x2aaf07){utils['error'](_0xbf4c('0x7'),_0x2aaf07);};exports[_0xbf4c('0x8')]=function(){utils[_0xbf4c('0x1')]('[core]\x20close');};exports[_0xbf4c('0x9')]=function(_0x5813fa){}; \ No newline at end of file +var _0x1348=['fullybooted','[core]\x20fullybooted','error','[core]\x20error','managerevent','./utils','connect','[core]\x20connected','shutdown','info','[core]\x20shutdown'];(function(_0x376ee3,_0x477f4e){var _0x9b9882=function(_0xb12bd){while(--_0xb12bd){_0x376ee3['push'](_0x376ee3['shift']());}};_0x9b9882(++_0x477f4e);}(_0x1348,0x9f));var _0x8134=function(_0x5dcc13,_0x20521c){_0x5dcc13=_0x5dcc13-0x0;var _0x3e80e4=_0x1348[_0x5dcc13];return _0x3e80e4;};'use strict';var utils=require(_0x8134('0x0'));exports[_0x8134('0x1')]=function(){utils['info'](_0x8134('0x2'));};exports[_0x8134('0x3')]=function(){utils[_0x8134('0x4')](_0x8134('0x5'));};exports[_0x8134('0x6')]=function(){utils[_0x8134('0x4')](_0x8134('0x7'));};exports[_0x8134('0x8')]=function(_0x523c8b){utils[_0x8134('0x8')](_0x8134('0x9'),_0x523c8b);};exports['close']=function(){utils[_0x8134('0x4')]('[core]\x20close');};exports[_0x8134('0xa')]=function(_0x7a7f39){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 0b67769..30d310f 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 _0xb410=['[%s][dials][hangup]','util','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','channel','dialstring','calleridnum','connectedlinenum','dialstatus','request','newexten','uniqueid','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','startsWith','appdata','split','error','[%s][dials][newexten]','varset','debug','[%s][dials][varset]','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','[%s][dials][dialbegin]','assign','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','isNil','[%s][dials][dialend]','ANSWER','answertime','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','hangup','calleridname','cause-txt','complete','diffTime','endtime'];(function(_0x6de7b7,_0x1e7344){var _0x4bd7a5=function(_0x5ab98a){while(--_0x5ab98a){_0x6de7b7['push'](_0x6de7b7['shift']());}};_0x4bd7a5(++_0x1e7344);}(_0xb410,0x1eb));var _0x0b41=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0xb410[_0x9cd4c3];return _0x4c9025;};'use strict';var _=require('lodash');var util=require(_0x0b41('0x0'));var utils=require(_0x0b41('0x1'));var dials={};function writeDB(_0x1afdb6){utils[_0x0b41('0x2')](util[_0x0b41('0x3')](_0x0b41('0x4'),_0x1afdb6['uniqueid'],_0x1afdb6[_0x0b41('0x5')],_0x1afdb6[_0x0b41('0x6')],_0x1afdb6[_0x0b41('0x7')],_0x1afdb6[_0x0b41('0x8')],_0x1afdb6[_0x0b41('0x9')]));utils[_0x0b41('0xa')]('CreateVoiceDialReport',_0x1afdb6);delete dials[_0x1afdb6['uniqueid']];}exports[_0x0b41('0xb')]=function(_0x25bd99){try{utils['debug'](util[_0x0b41('0x3')]('[%s][dials][newexten]',_0x25bd99[_0x0b41('0xc')]),_0x25bd99);utils[_0x0b41('0x2')](util[_0x0b41('0x3')](_0x0b41('0xd'),_0x25bd99[_0x0b41('0xc')],_0x25bd99['application'],_0x25bd99['appdata']));if(_0x25bd99[_0x0b41('0xe')][_0x0b41('0xf')]()==_0x0b41('0x10')&&_[_0x0b41('0x11')](_0x25bd99[_0x0b41('0x12')][_0x0b41('0xf')](),'cdr(routeid)')){var _0x3626af=_0x25bd99[_0x0b41('0x12')][_0x0b41('0x13')]('=');dials[_0x25bd99['uniqueid']]={'routeId':_0x3626af[0x1]};}}catch(_0x2252f7){utils[_0x0b41('0x14')](util[_0x0b41('0x3')](_0x0b41('0x15'),_0x25bd99[_0x0b41('0xc')]),_0x2252f7);}};exports[_0x0b41('0x16')]=function(_0x10cd98){try{utils[_0x0b41('0x17')](util[_0x0b41('0x3')](_0x0b41('0x18'),_0x10cd98[_0x0b41('0xc')]),_0x10cd98);if(!_['isNil'](_0x10cd98[_0x0b41('0x19')][_0x0b41('0x1a')])){utils[_0x0b41('0x2')](util[_0x0b41('0x3')](_0x0b41('0x1b'),_0x10cd98[_0x0b41('0xc')],_0x10cd98[_0x0b41('0x1c')]));dials[_0x10cd98[_0x0b41('0xc')]]={'routeId':_0x10cd98[_0x0b41('0x1c')]};}}catch(_0x143fa6){utils[_0x0b41('0x14')](util['format']('[%s][dials][varset]',_0x10cd98[_0x0b41('0xc')]),_0x143fa6);}};exports['dialbegin']=function(_0x22770e){try{if(!_['isNil'](dials[_0x22770e[_0x0b41('0xc')]])){utils[_0x0b41('0x17')](util[_0x0b41('0x3')](_0x0b41('0x1d'),_0x22770e['uniqueid']),_0x22770e);dials[_0x22770e[_0x0b41('0xc')]]=_[_0x0b41('0x1e')](dials[_0x22770e[_0x0b41('0xc')]],_0x22770e);dials[_0x22770e[_0x0b41('0xc')]][_0x0b41('0x1f')]=utils[_0x0b41('0x20')]();dials[_0x22770e[_0x0b41('0xc')]][_0x0b41('0x21')]=_0x0b41('0x22');utils[_0x0b41('0x2')](util['format'](_0x0b41('0x23'),_0x22770e[_0x0b41('0xc')],dials[_0x22770e['uniqueid']][_0x0b41('0x1f')]));}}catch(_0x53f6d6){utils[_0x0b41('0x14')](util['format'](_0x0b41('0x1d'),_0x22770e[_0x0b41('0xc')]),_0x53f6d6);}};exports[_0x0b41('0x24')]=function(_0x5e72e5){try{if(!_[_0x0b41('0x25')](dials[_0x5e72e5[_0x0b41('0xc')]])){utils['debug'](util['format'](_0x0b41('0x26'),_0x5e72e5[_0x0b41('0xc')]),_0x5e72e5);dials[_0x5e72e5['uniqueid']][_0x0b41('0x9')]=_0x5e72e5['dialstatus'];if(_0x5e72e5['dialstatus']==_0x0b41('0x27')){dials[_0x5e72e5[_0x0b41('0xc')]]=_['assign'](dials[_0x5e72e5[_0x0b41('0xc')]],_0x5e72e5);dials[_0x5e72e5[_0x0b41('0xc')]][_0x0b41('0x28')]=utils[_0x0b41('0x20')]();dials[_0x5e72e5[_0x0b41('0xc')]][_0x0b41('0x21')]='connect';utils['info'](util[_0x0b41('0x3')](_0x0b41('0x29'),_0x5e72e5['uniqueid'],_0x5e72e5[_0x0b41('0x9')],dials[_0x5e72e5[_0x0b41('0xc')]][_0x0b41('0x28')]));}else{utils[_0x0b41('0x2')](util[_0x0b41('0x3')]('[%s][dials][dialend]\x20dialstatus:%s',_0x5e72e5[_0x0b41('0xc')],_0x5e72e5['dialstatus']));}}}catch(_0x221365){utils[_0x0b41('0x14')](util[_0x0b41('0x3')](_0x0b41('0x26'),_0x5e72e5[_0x0b41('0xc')]),_0x221365);}};exports[_0x0b41('0x2a')]=function(_0x3ded17){try{if(!_[_0x0b41('0x25')](dials[_0x3ded17[_0x0b41('0xc')]])){utils[_0x0b41('0x17')](util[_0x0b41('0x3')]('[%s][dials][hangup]',_0x3ded17[_0x0b41('0xc')]),_0x3ded17);utils[_0x0b41('0x2')](util[_0x0b41('0x3')]('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x3ded17[_0x0b41('0xc')],_0x3ded17['calleridnum'],_0x3ded17[_0x0b41('0x2b')],_0x3ded17[_0x0b41('0x2c')]));dials[_0x3ded17[_0x0b41('0xc')]]=_[_0x0b41('0x1e')](dials[_0x3ded17[_0x0b41('0xc')]],{'endtime':utils[_0x0b41('0x20')](),'lastevent':_0x0b41('0x2d')});dials[_0x3ded17[_0x0b41('0xc')]]['duration']=utils['diffTime'](dials[_0x3ded17[_0x0b41('0xc')]]['endtime'],dials[_0x3ded17[_0x0b41('0xc')]][_0x0b41('0x1f')]);dials[_0x3ded17[_0x0b41('0xc')]]['holdtime']=utils[_0x0b41('0x2e')](dials[_0x3ded17[_0x0b41('0xc')]][_0x0b41('0x28')]||dials[_0x3ded17[_0x0b41('0xc')]][_0x0b41('0x2f')],dials[_0x3ded17['uniqueid']][_0x0b41('0x1f')]);dials[_0x3ded17[_0x0b41('0xc')]]['billableseconds']=dials[_0x3ded17[_0x0b41('0xc')]][_0x0b41('0x28')]?utils[_0x0b41('0x2e')](dials[_0x3ded17[_0x0b41('0xc')]]['endtime'],dials[_0x3ded17[_0x0b41('0xc')]][_0x0b41('0x28')]):0x0;writeDB(dials[_0x3ded17['uniqueid']]);}}catch(_0x2afb73){utils[_0x0b41('0x14')](util[_0x0b41('0x3')](_0x0b41('0x30'),_0x3ded17[_0x0b41('0xc')]),_0x2afb73);}}; \ No newline at end of file +var _0xf0c1=['holdtime','billableseconds','diffTime','lodash','util','info','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','calleridnum','connectedlinenum','request','debug','format','[%s][dials][newexten]\x20application:%s\x20appdata:%s','appdata','application','set','startsWith','cdr(routeid)','split','error','[%s][dials][newexten]','varset','[%s][dials][varset]','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','[%s][dials][dialbegin]','assign','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','[%s][dials][dialend]','dialstatus','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','answertime','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','complete','duration','endtime'];(function(_0x2b737c,_0x274adf){var _0x466ed5=function(_0x593124){while(--_0x593124){_0x2b737c['push'](_0x2b737c['shift']());}};_0x466ed5(++_0x274adf);}(_0xf0c1,0x99));var _0x1f0c=function(_0xbbfe59,_0x46067f){_0xbbfe59=_0xbbfe59-0x0;var _0x28a2a4=_0xf0c1[_0xbbfe59];return _0x28a2a4;};'use strict';var _=require(_0x1f0c('0x0'));var util=require(_0x1f0c('0x1'));var utils=require('./utils');var dials={};function writeDB(_0x40c6b1){utils[_0x1f0c('0x2')](util['format'](_0x1f0c('0x3'),_0x40c6b1[_0x1f0c('0x4')],_0x40c6b1[_0x1f0c('0x5')],_0x40c6b1['dialstring'],_0x40c6b1[_0x1f0c('0x6')],_0x40c6b1[_0x1f0c('0x7')],_0x40c6b1['dialstatus']));utils[_0x1f0c('0x8')]('CreateVoiceDialReport',_0x40c6b1);delete dials[_0x40c6b1[_0x1f0c('0x4')]];}exports['newexten']=function(_0x7bf213){try{utils[_0x1f0c('0x9')](util[_0x1f0c('0xa')]('[%s][dials][newexten]',_0x7bf213[_0x1f0c('0x4')]),_0x7bf213);utils[_0x1f0c('0x2')](util[_0x1f0c('0xa')](_0x1f0c('0xb'),_0x7bf213[_0x1f0c('0x4')],_0x7bf213['application'],_0x7bf213[_0x1f0c('0xc')]));if(_0x7bf213[_0x1f0c('0xd')]['toLowerCase']()==_0x1f0c('0xe')&&_[_0x1f0c('0xf')](_0x7bf213[_0x1f0c('0xc')]['toLowerCase'](),_0x1f0c('0x10'))){var _0x1f2cf9=_0x7bf213[_0x1f0c('0xc')][_0x1f0c('0x11')]('=');dials[_0x7bf213[_0x1f0c('0x4')]]={'routeId':_0x1f2cf9[0x1]};}}catch(_0x40efdc){utils[_0x1f0c('0x12')](util[_0x1f0c('0xa')](_0x1f0c('0x13'),_0x7bf213['uniqueid']),_0x40efdc);}};exports[_0x1f0c('0x14')]=function(_0x37c657){try{utils[_0x1f0c('0x9')](util['format'](_0x1f0c('0x15'),_0x37c657['uniqueid']),_0x37c657);if(!_[_0x1f0c('0x16')](_0x37c657[_0x1f0c('0x17')][_0x1f0c('0x18')])){utils[_0x1f0c('0x2')](util[_0x1f0c('0xa')](_0x1f0c('0x19'),_0x37c657['uniqueid'],_0x37c657[_0x1f0c('0x1a')]));dials[_0x37c657[_0x1f0c('0x4')]]={'routeId':_0x37c657[_0x1f0c('0x1a')]};}}catch(_0x369d30){utils['error'](util['format']('[%s][dials][varset]',_0x37c657[_0x1f0c('0x4')]),_0x369d30);}};exports[_0x1f0c('0x1b')]=function(_0x175006){try{if(!_['isNil'](dials[_0x175006[_0x1f0c('0x4')]])){utils['debug'](util[_0x1f0c('0xa')](_0x1f0c('0x1c'),_0x175006[_0x1f0c('0x4')]),_0x175006);dials[_0x175006[_0x1f0c('0x4')]]=_[_0x1f0c('0x1d')](dials[_0x175006[_0x1f0c('0x4')]],_0x175006);dials[_0x175006[_0x1f0c('0x4')]][_0x1f0c('0x1e')]=utils[_0x1f0c('0x1f')]();dials[_0x175006['uniqueid']][_0x1f0c('0x20')]=_0x1f0c('0x21');utils[_0x1f0c('0x2')](util[_0x1f0c('0xa')](_0x1f0c('0x22'),_0x175006['uniqueid'],dials[_0x175006['uniqueid']]['starttime']));}}catch(_0x5ae84e){utils['error'](util[_0x1f0c('0xa')](_0x1f0c('0x1c'),_0x175006['uniqueid']),_0x5ae84e);}};exports['dialend']=function(_0x41fa8c){try{if(!_[_0x1f0c('0x16')](dials[_0x41fa8c[_0x1f0c('0x4')]])){utils[_0x1f0c('0x9')](util[_0x1f0c('0xa')](_0x1f0c('0x23'),_0x41fa8c['uniqueid']),_0x41fa8c);dials[_0x41fa8c[_0x1f0c('0x4')]]['dialstatus']=_0x41fa8c[_0x1f0c('0x24')];if(_0x41fa8c['dialstatus']=='ANSWER'){dials[_0x41fa8c[_0x1f0c('0x4')]]=_[_0x1f0c('0x1d')](dials[_0x41fa8c['uniqueid']],_0x41fa8c);dials[_0x41fa8c[_0x1f0c('0x4')]]['answertime']=utils['now']();dials[_0x41fa8c[_0x1f0c('0x4')]][_0x1f0c('0x20')]='connect';utils[_0x1f0c('0x2')](util[_0x1f0c('0xa')](_0x1f0c('0x25'),_0x41fa8c[_0x1f0c('0x4')],_0x41fa8c[_0x1f0c('0x24')],dials[_0x41fa8c[_0x1f0c('0x4')]][_0x1f0c('0x26')]));}else{utils[_0x1f0c('0x2')](util[_0x1f0c('0xa')]('[%s][dials][dialend]\x20dialstatus:%s',_0x41fa8c[_0x1f0c('0x4')],_0x41fa8c[_0x1f0c('0x24')]));}}}catch(_0x2ce9d9){utils[_0x1f0c('0x12')](util[_0x1f0c('0xa')]('[%s][dials][dialend]',_0x41fa8c[_0x1f0c('0x4')]),_0x2ce9d9);}};exports[_0x1f0c('0x27')]=function(_0x3c56f7){try{if(!_[_0x1f0c('0x16')](dials[_0x3c56f7[_0x1f0c('0x4')]])){utils['debug'](util[_0x1f0c('0xa')](_0x1f0c('0x28'),_0x3c56f7[_0x1f0c('0x4')]),_0x3c56f7);utils['info'](util[_0x1f0c('0xa')](_0x1f0c('0x29'),_0x3c56f7[_0x1f0c('0x4')],_0x3c56f7[_0x1f0c('0x6')],_0x3c56f7[_0x1f0c('0x2a')],_0x3c56f7[_0x1f0c('0x2b')]));dials[_0x3c56f7[_0x1f0c('0x4')]]=_[_0x1f0c('0x1d')](dials[_0x3c56f7['uniqueid']],{'endtime':utils[_0x1f0c('0x1f')](),'lastevent':_0x1f0c('0x2c')});dials[_0x3c56f7[_0x1f0c('0x4')]][_0x1f0c('0x2d')]=utils['diffTime'](dials[_0x3c56f7[_0x1f0c('0x4')]][_0x1f0c('0x2e')],dials[_0x3c56f7[_0x1f0c('0x4')]][_0x1f0c('0x1e')]);dials[_0x3c56f7[_0x1f0c('0x4')]][_0x1f0c('0x2f')]=utils['diffTime'](dials[_0x3c56f7[_0x1f0c('0x4')]][_0x1f0c('0x26')]||dials[_0x3c56f7[_0x1f0c('0x4')]][_0x1f0c('0x2e')],dials[_0x3c56f7[_0x1f0c('0x4')]][_0x1f0c('0x1e')]);dials[_0x3c56f7[_0x1f0c('0x4')]][_0x1f0c('0x30')]=dials[_0x3c56f7['uniqueid']][_0x1f0c('0x26')]?utils[_0x1f0c('0x31')](dials[_0x3c56f7[_0x1f0c('0x4')]][_0x1f0c('0x2e')],dials[_0x3c56f7['uniqueid']][_0x1f0c('0x26')]):0x0;writeDB(dials[_0x3c56f7[_0x1f0c('0x4')]]);}}catch(_0x1290a1){utils[_0x1f0c('0x12')](util[_0x1f0c('0xa')](_0x1f0c('0x28'),_0x3c56f7[_0x1f0c('0x4')]),_0x1290a1);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 3eb150c..28ab107 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 _0xc81f=['[%s][index][agentcomplete]','[%s][index][queuecallerabandon]','queuecallerabandon','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','[%s][index][musiconholdstart]','musiconholdstart','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','origtransfereruniqueid','[%s][index][varset]','varset','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','[%s][index][dialend]','./utils','util','xdr','disabled','env','production','asterisk','port','username','password','keepConnected','info','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device','agentcalled','[%s][index][agentcalled]','uniqueid','[%s][index][agentringnoanswer]','agentringnoanswer','[%s][index][agentconnect]','agentconnect','agentcomplete'];(function(_0x5e448c,_0x4bbd3c){var _0x5649a7=function(_0x27a81f){while(--_0x27a81f){_0x5e448c['push'](_0x5e448c['shift']());}};_0x5649a7(++_0x4bbd3c);}(_0xc81f,0x133));var _0xfc81=function(_0x16ea87,_0x378d8b){_0x16ea87=_0x16ea87-0x0;var _0x6e7b1c=_0xc81f[_0x16ea87];return _0x6e7b1c;};var AsteriskManager=require('asterisk-manager');var config=require('../../config/environment');var utils=require(_0xfc81('0x0'));var util=require(_0xfc81('0x1'));var isXDREnabled=config[_0xfc81('0x2')]&&config[_0xfc81('0x2')][_0xfc81('0x3')]?!config[_0xfc81('0x2')][_0xfc81('0x3')]:!![];var isProduction=config[_0xfc81('0x4')]===_0xfc81('0x5')||![];var isLocalAsterisk=config[_0xfc81('0x2')]&&config[_0xfc81('0x2')]['local']===!![]||![];var ami=new AsteriskManager(config[_0xfc81('0x6')][_0xfc81('0x7')],config['asterisk']['ip'],config[_0xfc81('0x6')][_0xfc81('0x8')],config[_0xfc81('0x6')][_0xfc81('0x9')],!![]);ami[_0xfc81('0xa')]();if(!isXDREnabled){utils[_0xfc81('0xb')](_0xfc81('0xc'));}else if(!isProduction&&!isLocalAsterisk){utils[_0xfc81('0xb')](_0xfc81('0xd'));}else{var agents=require(_0xfc81('0xe'));var calls=require('./calls.controller');var queues=require(_0xfc81('0xf'));var recordings=require(_0xfc81('0x10'));var members=require(_0xfc81('0x11'));var dials=require(_0xfc81('0x12'));var transfers=require(_0xfc81('0x13'));var core=require('./core.controller');ami['on']('connect',core['connect']);ami['on'](_0xfc81('0x14'),core['shutdown']);ami['on'](_0xfc81('0x15'),core[_0xfc81('0x15')]);ami['on']('error',core[_0xfc81('0x16')]);ami['on'](_0xfc81('0x17'),core['close']);ami['on'](_0xfc81('0x18'),core[_0xfc81('0x18')]);ami['on'](_0xfc81('0x19'),function(_0x1b9781){try{utils[_0xfc81('0x1a')](util[_0xfc81('0x1b')](_0xfc81('0x1c'),_0x1b9781[_0xfc81('0x1d')]),_0x1b9781);members[_0xfc81('0x19')](_0x1b9781);}catch(_0x270970){utils[_0xfc81('0x16')](util[_0xfc81('0x1b')]('[%s][index][devicestatechange]',_0x1b9781['device']),_0x270970);}});ami['on'](_0xfc81('0x1e'),function(_0x28cec8){try{utils[_0xfc81('0x1a')](util[_0xfc81('0x1b')](_0xfc81('0x1f'),_0x28cec8[_0xfc81('0x20')]),_0x28cec8);agents['agentcalled'](_0x28cec8);}catch(_0x52b3ec){utils['error'](util[_0xfc81('0x1b')](_0xfc81('0x1f'),_0x28cec8['uniqueid']),_0x52b3ec);}});ami['on']('agentringnoanswer',function(_0x4f8b11){try{utils['debug'](util[_0xfc81('0x1b')](_0xfc81('0x21'),_0x4f8b11['uniqueid']),_0x4f8b11);agents[_0xfc81('0x22')](_0x4f8b11);}catch(_0x457164){utils['error'](util[_0xfc81('0x1b')](_0xfc81('0x21'),_0x4f8b11[_0xfc81('0x20')]),_0x457164);}});ami['on']('agentconnect',function(_0x4eb7bd){try{utils[_0xfc81('0x1a')](util[_0xfc81('0x1b')](_0xfc81('0x23'),_0x4eb7bd[_0xfc81('0x20')]),_0x4eb7bd);agents[_0xfc81('0x24')](_0x4eb7bd);queues['agentconnect'](_0x4eb7bd);}catch(_0x3bd45b){utils[_0xfc81('0x16')](util[_0xfc81('0x1b')](_0xfc81('0x23'),_0x4eb7bd['uniqueid']),_0x3bd45b);}});ami['on'](_0xfc81('0x25'),function(_0x99f0cc){try{utils[_0xfc81('0x1a')](util[_0xfc81('0x1b')]('[%s][index][agentcomplete]',_0x99f0cc[_0xfc81('0x20')]),_0x99f0cc);agents[_0xfc81('0x25')](_0x99f0cc);queues[_0xfc81('0x25')](_0x99f0cc);members['agentcomplete'](_0x99f0cc);}catch(_0x3977b0){utils['error'](util['format'](_0xfc81('0x26'),_0x99f0cc[_0xfc81('0x20')]),_0x3977b0);}});ami['on']('queuecallerabandon',function(_0xd9bc58){try{utils['debug'](util[_0xfc81('0x1b')](_0xfc81('0x27'),_0xd9bc58[_0xfc81('0x20')]),_0xd9bc58);agents[_0xfc81('0x28')](_0xd9bc58);queues[_0xfc81('0x28')](_0xd9bc58);}catch(_0x28e827){utils[_0xfc81('0x16')](util[_0xfc81('0x1b')]('[%s][index][queuecallerabandon]',_0xd9bc58[_0xfc81('0x20')]),_0x28e827);}});ami['on'](_0xfc81('0x29'),function(_0x37849a){try{utils[_0xfc81('0x1a')](util[_0xfc81('0x1b')]('[%s][index][queuecallerjoin]',_0x37849a[_0xfc81('0x20')]),_0x37849a);queues[_0xfc81('0x29')](_0x37849a);recordings[_0xfc81('0x29')](_0x37849a);}catch(_0x35aead){utils[_0xfc81('0x16')](util[_0xfc81('0x1b')](_0xfc81('0x2a'),_0x37849a[_0xfc81('0x20')]),_0x35aead);}});ami['on'](_0xfc81('0x2b'),function(_0x4c8d4d){try{utils[_0xfc81('0x1a')](util['format'](_0xfc81('0x2c'),_0x4c8d4d[_0xfc81('0x20')]),_0x4c8d4d);queues[_0xfc81('0x2b')](_0x4c8d4d);}catch(_0x573463){utils[_0xfc81('0x16')](util[_0xfc81('0x1b')](_0xfc81('0x2c'),_0x4c8d4d['uniqueid']),_0x573463);}});ami['on']('musiconholdstart',function(_0x20e7df){try{utils[_0xfc81('0x1a')](util[_0xfc81('0x1b')](_0xfc81('0x2d'),_0x20e7df['uniqueid']),_0x20e7df);queues[_0xfc81('0x2e')](_0x20e7df);calls[_0xfc81('0x2e')](_0x20e7df);}catch(_0x1aa643){utils[_0xfc81('0x16')](util[_0xfc81('0x1b')](_0xfc81('0x2d'),_0x20e7df[_0xfc81('0x20')]),_0x1aa643);}});ami['on'](_0xfc81('0x2f'),function(_0x1b23c6){try{utils[_0xfc81('0x1a')](util[_0xfc81('0x1b')](_0xfc81('0x30'),_0x1b23c6[_0xfc81('0x20')]),_0x1b23c6);queues[_0xfc81('0x2f')](_0x1b23c6);calls[_0xfc81('0x2f')](_0x1b23c6);}catch(_0x2cdd4d){utils['error'](util[_0xfc81('0x1b')](_0xfc81('0x30'),_0x1b23c6['uniqueid']),_0x2cdd4d);}});ami['on'](_0xfc81('0x31'),function(_0x169fd6){try{utils['debug'](util['format'](_0xfc81('0x32'),_0x169fd6[_0xfc81('0x20')]),_0x169fd6);calls[_0xfc81('0x31')](_0x169fd6);recordings[_0xfc81('0x31')](_0x169fd6);}catch(_0x1b4942){utils['error'](util['format'](_0xfc81('0x32'),_0x169fd6[_0xfc81('0x20')]),_0x1b4942);}});ami['on'](_0xfc81('0x33'),function(_0x39a1c9){try{utils[_0xfc81('0x1a')](util[_0xfc81('0x1b')](_0xfc81('0x34'),_0x39a1c9[_0xfc81('0x20')]),_0x39a1c9);calls['hangup'](_0x39a1c9);recordings[_0xfc81('0x33')](_0x39a1c9);dials[_0xfc81('0x33')](_0x39a1c9);agents[_0xfc81('0x33')](_0x39a1c9);queues[_0xfc81('0x33')](_0x39a1c9);}catch(_0x3f57e8){utils[_0xfc81('0x16')](util['format'](_0xfc81('0x34'),_0x39a1c9[_0xfc81('0x20')]),_0x3f57e8);}});ami['on'](_0xfc81('0x35'),function(_0xc2991f){try{utils[_0xfc81('0x1a')](util[_0xfc81('0x1b')]('[%s][index][cdr]',_0xc2991f[_0xfc81('0x20')]),_0xc2991f);members[_0xfc81('0x35')](_0xc2991f);}catch(_0x34b89b){utils['error'](util[_0xfc81('0x1b')](_0xfc81('0x36'),_0xc2991f['uniqueid']),_0x34b89b);}});ami['on'](_0xfc81('0x37'),function(_0x55660b){try{utils['debug'](util[_0xfc81('0x1b')](_0xfc81('0x38'),_0x55660b[_0xfc81('0x20')]),_0x55660b);queues[_0xfc81('0x37')](_0x55660b);agents[_0xfc81('0x37')](_0x55660b);transfers['blindtransfer'](_0x55660b);}catch(_0x3a25c7){utils['error'](util[_0xfc81('0x1b')](_0xfc81('0x38'),_0x55660b[_0xfc81('0x20')]),_0x3a25c7);}});ami['on'](_0xfc81('0x39'),function(_0x57e67b){try{utils[_0xfc81('0x1a')](util[_0xfc81('0x1b')]('[%s][index][attendedtransfer]',_0x57e67b[_0xfc81('0x3a')]),_0x57e67b);queues['attendedtransfer'](_0x57e67b);transfers['attendedtransfer'](_0x57e67b);agents[_0xfc81('0x39')](_0x57e67b);calls[_0xfc81('0x39')](_0x57e67b);}catch(_0x44e9cd){utils[_0xfc81('0x16')](util[_0xfc81('0x1b')]('[%s][index][attendedtransfer]',_0x57e67b[_0xfc81('0x3a')]),_0x44e9cd);}});ami['on']('varset',function(_0x56c10a){try{utils['debug'](util[_0xfc81('0x1b')](_0xfc81('0x3b'),_0x56c10a['uniqueid']),_0x56c10a);queues['varset'](_0x56c10a);recordings[_0xfc81('0x3c')](_0x56c10a);calls['varset'](_0x56c10a);dials['varset'](_0x56c10a);}catch(_0x35c9f3){utils['error'](util[_0xfc81('0x1b')](_0xfc81('0x3b'),_0x56c10a[_0xfc81('0x20')]),_0x35c9f3);}});ami['on'](_0xfc81('0x3d'),function(_0x1c1bb5){try{utils[_0xfc81('0x1a')](util[_0xfc81('0x1b')](_0xfc81('0x3e'),_0x1c1bb5[_0xfc81('0x20')]),_0x1c1bb5);calls[_0xfc81('0x3d')](_0x1c1bb5);recordings[_0xfc81('0x3d')](_0x1c1bb5);dials['newexten'](_0x1c1bb5);}catch(_0x32fdbb){utils['error'](util['format']('[%s][index][newexten]',_0x1c1bb5['uniqueid']),_0x32fdbb);}});ami['on'](_0xfc81('0x3f'),function(_0x18cb11){try{utils[_0xfc81('0x1a')](util[_0xfc81('0x1b')](_0xfc81('0x40'),_0x18cb11[_0xfc81('0x20')]),_0x18cb11);calls[_0xfc81('0x3f')](_0x18cb11);recordings['newchannel'](_0x18cb11);}catch(_0x23daf4){utils[_0xfc81('0x16')](util[_0xfc81('0x1b')]('[%s][index][newchannel]',_0x18cb11[_0xfc81('0x20')]),_0x23daf4);}});ami['on'](_0xfc81('0x41'),function(_0x34f8ab){try{utils[_0xfc81('0x1a')](util['format'](_0xfc81('0x42'),_0x34f8ab[_0xfc81('0x20')]),_0x34f8ab);dials[_0xfc81('0x41')](_0x34f8ab);}catch(_0x48fa2d){utils[_0xfc81('0x16')](util[_0xfc81('0x1b')](_0xfc81('0x43'),_0x34f8ab[_0xfc81('0x20')]),_0x48fa2d);}});ami['on']('dialend',function(_0x14d9eb){try{utils[_0xfc81('0x1a')](util['format']('[%s][index][dialend]',_0x14d9eb[_0xfc81('0x20')]),_0x14d9eb);dials['dialend'](_0x14d9eb);}catch(_0x201be5){utils[_0xfc81('0x16')](util[_0xfc81('0x1b')](_0xfc81('0x44'),_0x14d9eb[_0xfc81('0x20')]),_0x201be5);}});} \ No newline at end of file +var _0x9a3f=['disabled','env','production','local','asterisk','password','keepConnected','info','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./calls.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','shutdown','fullybooted','error','close','managerevent','devicestatechange','device','agentcalled','debug','format','[%s][index][agentcalled]','uniqueid','[%s][index][agentringnoanswer]','agentringnoanswer','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','[%s][index][queuecallerjoin]','queuecallerjoin','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','[%s][index][hangup]','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','dialend','[%s][index][dialend]','asterisk-manager','./utils','util','xdr'];(function(_0x298ed3,_0x4ab5e1){var _0x5aad28=function(_0x168687){while(--_0x168687){_0x298ed3['push'](_0x298ed3['shift']());}};_0x5aad28(++_0x4ab5e1);}(_0x9a3f,0x88));var _0xf9a3=function(_0x4949cc,_0x3f7a45){_0x4949cc=_0x4949cc-0x0;var _0x5dc06b=_0x9a3f[_0x4949cc];return _0x5dc06b;};var AsteriskManager=require(_0xf9a3('0x0'));var config=require('../../config/environment');var utils=require(_0xf9a3('0x1'));var util=require(_0xf9a3('0x2'));var isXDREnabled=config[_0xf9a3('0x3')]&&config[_0xf9a3('0x3')][_0xf9a3('0x4')]?!config[_0xf9a3('0x3')][_0xf9a3('0x4')]:!![];var isProduction=config[_0xf9a3('0x5')]===_0xf9a3('0x6')||![];var isLocalAsterisk=config[_0xf9a3('0x3')]&&config[_0xf9a3('0x3')][_0xf9a3('0x7')]===!![]||![];var ami=new AsteriskManager(config[_0xf9a3('0x8')]['port'],config['asterisk']['ip'],config[_0xf9a3('0x8')]['username'],config[_0xf9a3('0x8')][_0xf9a3('0x9')],!![]);ami[_0xf9a3('0xa')]();if(!isXDREnabled){utils[_0xf9a3('0xb')](_0xf9a3('0xc'));}else if(!isProduction&&!isLocalAsterisk){utils[_0xf9a3('0xb')](_0xf9a3('0xd'));}else{var agents=require(_0xf9a3('0xe'));var calls=require(_0xf9a3('0xf'));var queues=require('./queues.controller');var recordings=require(_0xf9a3('0x10'));var members=require(_0xf9a3('0x11'));var dials=require(_0xf9a3('0x12'));var transfers=require(_0xf9a3('0x13'));var core=require(_0xf9a3('0x14'));ami['on']('connect',core['connect']);ami['on'](_0xf9a3('0x15'),core[_0xf9a3('0x15')]);ami['on'](_0xf9a3('0x16'),core[_0xf9a3('0x16')]);ami['on'](_0xf9a3('0x17'),core[_0xf9a3('0x17')]);ami['on'](_0xf9a3('0x18'),core[_0xf9a3('0x18')]);ami['on'](_0xf9a3('0x19'),core['managerevent']);ami['on'](_0xf9a3('0x1a'),function(_0x3dd303){try{utils['debug'](util['format']('[%s][index][devicestatechange]',_0x3dd303[_0xf9a3('0x1b')]),_0x3dd303);members[_0xf9a3('0x1a')](_0x3dd303);}catch(_0x114cd4){utils[_0xf9a3('0x17')](util['format']('[%s][index][devicestatechange]',_0x3dd303[_0xf9a3('0x1b')]),_0x114cd4);}});ami['on'](_0xf9a3('0x1c'),function(_0x56861a){try{utils[_0xf9a3('0x1d')](util[_0xf9a3('0x1e')]('[%s][index][agentcalled]',_0x56861a['uniqueid']),_0x56861a);agents[_0xf9a3('0x1c')](_0x56861a);}catch(_0x18d76a){utils[_0xf9a3('0x17')](util[_0xf9a3('0x1e')](_0xf9a3('0x1f'),_0x56861a[_0xf9a3('0x20')]),_0x18d76a);}});ami['on']('agentringnoanswer',function(_0x4fbb3e){try{utils[_0xf9a3('0x1d')](util[_0xf9a3('0x1e')](_0xf9a3('0x21'),_0x4fbb3e[_0xf9a3('0x20')]),_0x4fbb3e);agents[_0xf9a3('0x22')](_0x4fbb3e);}catch(_0x538810){utils[_0xf9a3('0x17')](util[_0xf9a3('0x1e')](_0xf9a3('0x21'),_0x4fbb3e['uniqueid']),_0x538810);}});ami['on'](_0xf9a3('0x23'),function(_0x1ca218){try{utils[_0xf9a3('0x1d')](util['format'](_0xf9a3('0x24'),_0x1ca218[_0xf9a3('0x20')]),_0x1ca218);agents['agentconnect'](_0x1ca218);queues[_0xf9a3('0x23')](_0x1ca218);}catch(_0x13f8a3){utils[_0xf9a3('0x17')](util['format'](_0xf9a3('0x24'),_0x1ca218['uniqueid']),_0x13f8a3);}});ami['on'](_0xf9a3('0x25'),function(_0x251815){try{utils[_0xf9a3('0x1d')](util[_0xf9a3('0x1e')](_0xf9a3('0x26'),_0x251815[_0xf9a3('0x20')]),_0x251815);agents['agentcomplete'](_0x251815);queues[_0xf9a3('0x25')](_0x251815);members[_0xf9a3('0x25')](_0x251815);}catch(_0x3664e5){utils[_0xf9a3('0x17')](util[_0xf9a3('0x1e')]('[%s][index][agentcomplete]',_0x251815[_0xf9a3('0x20')]),_0x3664e5);}});ami['on'](_0xf9a3('0x27'),function(_0x1a01c8){try{utils[_0xf9a3('0x1d')](util['format'](_0xf9a3('0x28'),_0x1a01c8[_0xf9a3('0x20')]),_0x1a01c8);agents['queuecallerabandon'](_0x1a01c8);queues[_0xf9a3('0x27')](_0x1a01c8);}catch(_0x2081d2){utils[_0xf9a3('0x17')](util['format'](_0xf9a3('0x28'),_0x1a01c8['uniqueid']),_0x2081d2);}});ami['on']('queuecallerjoin',function(_0x2895ef){try{utils[_0xf9a3('0x1d')](util[_0xf9a3('0x1e')](_0xf9a3('0x29'),_0x2895ef[_0xf9a3('0x20')]),_0x2895ef);queues[_0xf9a3('0x2a')](_0x2895ef);recordings['queuecallerjoin'](_0x2895ef);}catch(_0x5f13de){utils[_0xf9a3('0x17')](util[_0xf9a3('0x1e')]('[%s][index][queuecallerjoin]',_0x2895ef[_0xf9a3('0x20')]),_0x5f13de);}});ami['on'](_0xf9a3('0x2b'),function(_0x56d727){try{utils[_0xf9a3('0x1d')](util[_0xf9a3('0x1e')](_0xf9a3('0x2c'),_0x56d727[_0xf9a3('0x20')]),_0x56d727);queues[_0xf9a3('0x2b')](_0x56d727);}catch(_0x2c24cb){utils[_0xf9a3('0x17')](util[_0xf9a3('0x1e')](_0xf9a3('0x2c'),_0x56d727['uniqueid']),_0x2c24cb);}});ami['on']('musiconholdstart',function(_0x1f6328){try{utils[_0xf9a3('0x1d')](util[_0xf9a3('0x1e')]('[%s][index][musiconholdstart]',_0x1f6328['uniqueid']),_0x1f6328);queues[_0xf9a3('0x2d')](_0x1f6328);calls[_0xf9a3('0x2d')](_0x1f6328);}catch(_0x1730f9){utils[_0xf9a3('0x17')](util[_0xf9a3('0x1e')](_0xf9a3('0x2e'),_0x1f6328[_0xf9a3('0x20')]),_0x1730f9);}});ami['on'](_0xf9a3('0x2f'),function(_0x48d5fc){try{utils[_0xf9a3('0x1d')](util[_0xf9a3('0x1e')]('[%s][index][musiconholdstop]',_0x48d5fc[_0xf9a3('0x20')]),_0x48d5fc);queues[_0xf9a3('0x2f')](_0x48d5fc);calls['musiconholdstop'](_0x48d5fc);}catch(_0x258c67){utils[_0xf9a3('0x17')](util[_0xf9a3('0x1e')](_0xf9a3('0x30'),_0x48d5fc['uniqueid']),_0x258c67);}});ami['on'](_0xf9a3('0x31'),function(_0x1312dc){try{utils[_0xf9a3('0x1d')](util[_0xf9a3('0x1e')](_0xf9a3('0x32'),_0x1312dc[_0xf9a3('0x20')]),_0x1312dc);calls['newstate'](_0x1312dc);recordings[_0xf9a3('0x31')](_0x1312dc);}catch(_0x3c00e1){utils[_0xf9a3('0x17')](util[_0xf9a3('0x1e')](_0xf9a3('0x32'),_0x1312dc['uniqueid']),_0x3c00e1);}});ami['on']('hangup',function(_0x5dae77){try{utils[_0xf9a3('0x1d')](util[_0xf9a3('0x1e')](_0xf9a3('0x33'),_0x5dae77['uniqueid']),_0x5dae77);calls[_0xf9a3('0x34')](_0x5dae77);recordings[_0xf9a3('0x34')](_0x5dae77);dials[_0xf9a3('0x34')](_0x5dae77);agents[_0xf9a3('0x34')](_0x5dae77);queues['hangup'](_0x5dae77);}catch(_0x4e6790){utils[_0xf9a3('0x17')](util[_0xf9a3('0x1e')](_0xf9a3('0x33'),_0x5dae77['uniqueid']),_0x4e6790);}});ami['on'](_0xf9a3('0x35'),function(_0x43e5f3){try{utils[_0xf9a3('0x1d')](util[_0xf9a3('0x1e')](_0xf9a3('0x36'),_0x43e5f3[_0xf9a3('0x20')]),_0x43e5f3);members['cdr'](_0x43e5f3);}catch(_0x4c7e96){utils[_0xf9a3('0x17')](util[_0xf9a3('0x1e')](_0xf9a3('0x36'),_0x43e5f3[_0xf9a3('0x20')]),_0x4c7e96);}});ami['on'](_0xf9a3('0x37'),function(_0x105d61){try{utils[_0xf9a3('0x1d')](util['format'](_0xf9a3('0x38'),_0x105d61[_0xf9a3('0x20')]),_0x105d61);queues['blindtransfer'](_0x105d61);agents['blindtransfer'](_0x105d61);transfers[_0xf9a3('0x37')](_0x105d61);}catch(_0x290bbf){utils['error'](util[_0xf9a3('0x1e')]('[%s][index][blindtransfer]',_0x105d61[_0xf9a3('0x20')]),_0x290bbf);}});ami['on'](_0xf9a3('0x39'),function(_0x4cf1d7){try{utils[_0xf9a3('0x1d')](util['format'](_0xf9a3('0x3a'),_0x4cf1d7[_0xf9a3('0x3b')]),_0x4cf1d7);queues[_0xf9a3('0x39')](_0x4cf1d7);transfers[_0xf9a3('0x39')](_0x4cf1d7);agents[_0xf9a3('0x39')](_0x4cf1d7);calls[_0xf9a3('0x39')](_0x4cf1d7);}catch(_0x425e4a){utils['error'](util[_0xf9a3('0x1e')](_0xf9a3('0x3a'),_0x4cf1d7[_0xf9a3('0x3b')]),_0x425e4a);}});ami['on'](_0xf9a3('0x3c'),function(_0x5822c){try{utils['debug'](util[_0xf9a3('0x1e')](_0xf9a3('0x3d'),_0x5822c['uniqueid']),_0x5822c);queues['varset'](_0x5822c);recordings[_0xf9a3('0x3c')](_0x5822c);calls['varset'](_0x5822c);dials[_0xf9a3('0x3c')](_0x5822c);}catch(_0x1526d5){utils[_0xf9a3('0x17')](util[_0xf9a3('0x1e')](_0xf9a3('0x3d'),_0x5822c[_0xf9a3('0x20')]),_0x1526d5);}});ami['on'](_0xf9a3('0x3e'),function(_0x565684){try{utils['debug'](util['format'](_0xf9a3('0x3f'),_0x565684[_0xf9a3('0x20')]),_0x565684);calls[_0xf9a3('0x3e')](_0x565684);recordings[_0xf9a3('0x3e')](_0x565684);dials[_0xf9a3('0x3e')](_0x565684);}catch(_0xbde1c7){utils[_0xf9a3('0x17')](util[_0xf9a3('0x1e')](_0xf9a3('0x3f'),_0x565684[_0xf9a3('0x20')]),_0xbde1c7);}});ami['on'](_0xf9a3('0x40'),function(_0x280b41){try{utils['debug'](util[_0xf9a3('0x1e')]('[%s][index][newchannel]',_0x280b41[_0xf9a3('0x20')]),_0x280b41);calls['newchannel'](_0x280b41);recordings[_0xf9a3('0x40')](_0x280b41);}catch(_0x1e11ae){utils[_0xf9a3('0x17')](util[_0xf9a3('0x1e')](_0xf9a3('0x41'),_0x280b41[_0xf9a3('0x20')]),_0x1e11ae);}});ami['on']('dialbegin',function(_0x2e0ccf){try{utils[_0xf9a3('0x1d')](util[_0xf9a3('0x1e')]('[%s][index][dialbegin]',_0x2e0ccf[_0xf9a3('0x20')]),_0x2e0ccf);dials[_0xf9a3('0x42')](_0x2e0ccf);}catch(_0x401946){utils[_0xf9a3('0x17')](util[_0xf9a3('0x1e')](_0xf9a3('0x43'),_0x2e0ccf[_0xf9a3('0x20')]),_0x401946);}});ami['on'](_0xf9a3('0x44'),function(_0x2b7301){try{utils[_0xf9a3('0x1d')](util[_0xf9a3('0x1e')](_0xf9a3('0x45'),_0x2b7301[_0xf9a3('0x20')]),_0x2b7301);dials[_0xf9a3('0x44')](_0x2b7301);}catch(_0x5872d6){utils['error'](util[_0xf9a3('0x1e')]('[%s][index][dialend]',_0x2b7301['uniqueid']),_0x5872d6);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index a9ba49f..1a9e296 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 _0x8443=['device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','now','agent','isNil','diffTime','exitAt','agentcomplete','[%s][members][agentcomplete]','queue','assign','[%s][members][cdr]','channel','data1','source','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data3','destinationchannel','lodash','util','Queue:','info','format','interface','data2','membername','type','getUserByInterface','name','CreateMemberReport','getUserByName','split','then','internal','request','catch','error','[%s][members][writeDB]','uniqueid','some','devicestatechange','debug','[%s][members][devicestatechange]'];(function(_0x336b2a,_0x3f3790){var _0x49baba=function(_0x447a26){while(--_0x447a26){_0x336b2a['push'](_0x336b2a['shift']());}};_0x49baba(++_0x3f3790);}(_0x8443,0x101));var _0x3844=function(_0x1b371,_0x157d6c){_0x1b371=_0x1b371-0x0;var _0x1a348b=_0x8443[_0x1b371];return _0x1a348b;};'use strict';var _=require(_0x3844('0x0'));var util=require(_0x3844('0x1'));var utils=require('./utils');var members={};var exclude=['Local/_attended@transfer',_0x3844('0x2')];function writeDB(_0x56da3f){utils[_0x3844('0x3')](util[_0x3844('0x4')]('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0x56da3f['uniqueid'],_0x56da3f[_0x3844('0x5')],_0x56da3f['channel'],_0x56da3f[_0x3844('0x6')],_0x56da3f[_0x3844('0x7')],_0x56da3f[_0x3844('0x8')]));if(_0x56da3f[_0x3844('0x5')]){utils[_0x3844('0x9')](_0x56da3f[_0x3844('0x5')])['then'](function(_0x1816f7){if(_0x1816f7){_0x56da3f[_0x3844('0x7')]=_0x1816f7[_0x3844('0xa')];_0x56da3f['internal']=_0x1816f7['internal'];utils['request'](_0x3844('0xb'),_0x56da3f);}else{utils[_0x3844('0xc')](_0x56da3f['interface'][_0x3844('0xd')]('/')[0x1])[_0x3844('0xe')](function(_0x38c407){if(_0x38c407){_0x56da3f['membername']=_0x38c407[_0x3844('0xa')];_0x56da3f['internal']=_0x38c407[_0x3844('0xf')];utils[_0x3844('0x10')](_0x3844('0xb'),_0x56da3f);}});}})[_0x3844('0x11')](function(_0x42c6de){utils[_0x3844('0x12')](util[_0x3844('0x4')](_0x3844('0x13'),_0x56da3f[_0x3844('0x14')]),_0x42c6de);});}delete members[_0x56da3f[_0x3844('0x5')]];}function startsWith(_0x21f8ce,_0x1e3152){return _[_0x3844('0x15')](_0x21f8ce,function(_0xc6b803){return _['startsWith'](_0x1e3152,_0xc6b803);});}exports[_0x3844('0x16')]=function(_0x599395){try{utils[_0x3844('0x17')](util['format'](_0x3844('0x18'),members[_0x599395[_0x3844('0x19')]]?members[_0x599395[_0x3844('0x19')]]['uniqueid']:_0x599395[_0x3844('0x19')]),_0x599395);utils[_0x3844('0x3')](util[_0x3844('0x4')](_0x3844('0x1a'),members[_0x599395[_0x3844('0x19')]]?members[_0x599395['device']][_0x3844('0x14')]:_0x599395['device'],_0x599395[_0x3844('0x1b')],_0x599395['device']));switch(_0x599395[_0x3844('0x1b')]){case _0x3844('0x1c'):case _0x3844('0x1d'):if(!startsWith(exclude,_0x599395['device'])){members[_0x599395[_0x3844('0x19')]]={'channel':'voice','interface':_0x599395[_0x3844('0x19')],'type':'TALKING','enterAt':utils[_0x3844('0x1e')](),'role':_0x3844('0x1f')};}break;case'NOT_INUSE':if(!_[_0x3844('0x20')](members[_0x599395[_0x3844('0x19')]])){members[_0x599395[_0x3844('0x19')]]['exitAt']=utils['now']();members[_0x599395[_0x3844('0x19')]]['duration']=utils[_0x3844('0x21')](members[_0x599395['device']][_0x3844('0x22')],members[_0x599395[_0x3844('0x19')]]['enterAt']);if(members[_0x599395['device']][_0x3844('0x14')]){writeDB(members[_0x599395[_0x3844('0x19')]]);}}break;default:break;}}catch(_0x30f853){utils[_0x3844('0x12')](util[_0x3844('0x4')]('[%s][members][devicestatechange]',members[_0x599395['device']]?members[_0x599395[_0x3844('0x19')]]['uniqueid']:_0x599395['device']),_0x30f853);}};exports[_0x3844('0x23')]=function(_0x32d420){try{if(!_[_0x3844('0x20')](members[_0x32d420[_0x3844('0x5')]])){utils[_0x3844('0x17')](util[_0x3844('0x4')](_0x3844('0x24'),_0x32d420[_0x3844('0x14')]),_0x32d420);utils[_0x3844('0x3')](util[_0x3844('0x4')]('[%s][members][agentcomplete]\x20interface:%s\x20queue:%s',_0x32d420[_0x3844('0x14')],_0x32d420[_0x3844('0x5')],_0x32d420[_0x3844('0x25')]));members[_0x32d420[_0x3844('0x5')]]=_[_0x3844('0x26')](members[_0x32d420[_0x3844('0x5')]],{'data4':_0x32d420[_0x3844('0x25')],'uniqueid':_0x32d420[_0x3844('0x14')]});}}catch(_0x2dec1d){utils[_0x3844('0x12')](util['format'](_0x3844('0x24'),_0x32d420['uniqueid']),_0x2dec1d);}};exports['cdr']=function(_0x1bbb53){try{utils[_0x3844('0x17')](util['format'](_0x3844('0x27'),_0x1bbb53['uniqueid']),_0x1bbb53);if(_0x1bbb53[_0x3844('0x28')]){var _0x425f5c=_0x1bbb53['channel'][_0x3844('0xd')]('-')[0x0];if(!_['isNil'](members[_0x425f5c])){members[_0x425f5c]=_[_0x3844('0x26')](members[_0x425f5c],{'data1':members[_0x425f5c][_0x3844('0x29')]||_0x1bbb53[_0x3844('0x8')],'data2':members[_0x425f5c][_0x3844('0x6')]||_0x1bbb53[_0x3844('0x2a')],'data3':members[_0x425f5c]['data3']||_0x1bbb53[_0x3844('0x2b')],'uniqueid':members[_0x425f5c][_0x3844('0x14')]||_0x1bbb53[_0x3844('0x14')]});utils[_0x3844('0x3')](util['format'](_0x3844('0x2c'),_0x1bbb53[_0x3844('0x14')],members[_0x425f5c][_0x3844('0x29')],members[_0x425f5c]['data2'],members[_0x425f5c][_0x3844('0x2d')]));if(members[_0x425f5c]['exitAt']){writeDB(members[_0x425f5c]);}}}if(_0x1bbb53[_0x3844('0x2e')]){var _0x1edc29=_0x1bbb53[_0x3844('0x2e')][_0x3844('0xd')]('-')[0x0];if(!_['isNil'](members[_0x1edc29])){members[_0x1edc29]=_[_0x3844('0x26')](members[_0x1edc29],{'data1':members[_0x1edc29][_0x3844('0x29')]||_0x1bbb53[_0x3844('0x8')],'data2':members[_0x1edc29][_0x3844('0x6')]||_0x1bbb53[_0x3844('0x2a')],'data3':members[_0x1edc29][_0x3844('0x2d')]||_0x1bbb53[_0x3844('0x2b')],'uniqueid':members[_0x1edc29]['uniqueid']||_0x1bbb53[_0x3844('0x14')]});utils[_0x3844('0x3')](util['format'](_0x3844('0x2c'),_0x1bbb53[_0x3844('0x14')],members[_0x1edc29][_0x3844('0x29')],members[_0x1edc29]['data2'],members[_0x1edc29]['data3']));if(members[_0x1edc29][_0x3844('0x22')]){writeDB(members[_0x1edc29]);}}}}catch(_0x1e7276){utils[_0x3844('0x12')](util['format']('[%s][members][cdr]',_0x1bbb53[_0x3844('0x14')]),_0x1e7276);}}; \ No newline at end of file +var _0x23cd=['request','getUserByName','split','membername','CreateMemberReport','error','format','[%s][members][writeDB]','some','startsWith','devicestatechange','debug','device','state','INUSE','BUSY','voice','TALKING','now','NOT_INUSE','exitAt','duration','diffTime','enterAt','[%s][members][devicestatechange]','isNil','[%s][members][agentcomplete]','assign','queue','[%s][members][cdr]','data1','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','source','data3','destination','util','Local/_attended@transfer','Queue:','info','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','data2','type','getUserByInterface','then','name','internal'];(function(_0x1fc2dd,_0x468741){var _0x281777=function(_0xee61a8){while(--_0xee61a8){_0x1fc2dd['push'](_0x1fc2dd['shift']());}};_0x281777(++_0x468741);}(_0x23cd,0x182));var _0xd23c=function(_0x483043,_0x18c2df){_0x483043=_0x483043-0x0;var _0x7a9f02=_0x23cd[_0x483043];return _0x7a9f02;};'use strict';var _=require('lodash');var util=require(_0xd23c('0x0'));var utils=require('./utils');var members={};var exclude=[_0xd23c('0x1'),_0xd23c('0x2')];function writeDB(_0x40d85a){utils[_0xd23c('0x3')](util['format'](_0xd23c('0x4'),_0x40d85a[_0xd23c('0x5')],_0x40d85a[_0xd23c('0x6')],_0x40d85a[_0xd23c('0x7')],_0x40d85a[_0xd23c('0x8')],_0x40d85a['membername'],_0x40d85a[_0xd23c('0x9')]));if(_0x40d85a[_0xd23c('0x6')]){utils[_0xd23c('0xa')](_0x40d85a['interface'])[_0xd23c('0xb')](function(_0xd070d9){if(_0xd070d9){_0x40d85a['membername']=_0xd070d9[_0xd23c('0xc')];_0x40d85a[_0xd23c('0xd')]=_0xd070d9[_0xd23c('0xd')];utils[_0xd23c('0xe')]('CreateMemberReport',_0x40d85a);}else{utils[_0xd23c('0xf')](_0x40d85a['interface'][_0xd23c('0x10')]('/')[0x1])[_0xd23c('0xb')](function(_0x334f9a){if(_0x334f9a){_0x40d85a[_0xd23c('0x11')]=_0x334f9a['name'];_0x40d85a[_0xd23c('0xd')]=_0x334f9a[_0xd23c('0xd')];utils[_0xd23c('0xe')](_0xd23c('0x12'),_0x40d85a);}});}})['catch'](function(_0x583fba){utils[_0xd23c('0x13')](util[_0xd23c('0x14')](_0xd23c('0x15'),_0x40d85a['uniqueid']),_0x583fba);});}delete members[_0x40d85a[_0xd23c('0x6')]];}function startsWith(_0x44757c,_0x40acc3){return _[_0xd23c('0x16')](_0x44757c,function(_0x6647d8){return _[_0xd23c('0x17')](_0x40acc3,_0x6647d8);});}exports[_0xd23c('0x18')]=function(_0xb4e29){try{utils[_0xd23c('0x19')](util['format']('[%s][members][devicestatechange]',members[_0xb4e29[_0xd23c('0x1a')]]?members[_0xb4e29['device']][_0xd23c('0x5')]:_0xb4e29['device']),_0xb4e29);utils['info'](util['format']('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0xb4e29['device']]?members[_0xb4e29[_0xd23c('0x1a')]][_0xd23c('0x5')]:_0xb4e29[_0xd23c('0x1a')],_0xb4e29[_0xd23c('0x1b')],_0xb4e29[_0xd23c('0x1a')]));switch(_0xb4e29['state']){case _0xd23c('0x1c'):case _0xd23c('0x1d'):if(!startsWith(exclude,_0xb4e29[_0xd23c('0x1a')])){members[_0xb4e29[_0xd23c('0x1a')]]={'channel':_0xd23c('0x1e'),'interface':_0xb4e29['device'],'type':_0xd23c('0x1f'),'enterAt':utils[_0xd23c('0x20')](),'role':'agent'};}break;case _0xd23c('0x21'):if(!_['isNil'](members[_0xb4e29[_0xd23c('0x1a')]])){members[_0xb4e29[_0xd23c('0x1a')]][_0xd23c('0x22')]=utils[_0xd23c('0x20')]();members[_0xb4e29[_0xd23c('0x1a')]][_0xd23c('0x23')]=utils[_0xd23c('0x24')](members[_0xb4e29[_0xd23c('0x1a')]]['exitAt'],members[_0xb4e29[_0xd23c('0x1a')]][_0xd23c('0x25')]);if(members[_0xb4e29[_0xd23c('0x1a')]]['uniqueid']){writeDB(members[_0xb4e29[_0xd23c('0x1a')]]);}}break;default:break;}}catch(_0x5f2e50){utils[_0xd23c('0x13')](util[_0xd23c('0x14')](_0xd23c('0x26'),members[_0xb4e29['device']]?members[_0xb4e29[_0xd23c('0x1a')]][_0xd23c('0x5')]:_0xb4e29[_0xd23c('0x1a')]),_0x5f2e50);}};exports['agentcomplete']=function(_0x36e7ac){try{if(!_[_0xd23c('0x27')](members[_0x36e7ac[_0xd23c('0x6')]])){utils['debug'](util[_0xd23c('0x14')](_0xd23c('0x28'),_0x36e7ac['uniqueid']),_0x36e7ac);utils[_0xd23c('0x3')](util[_0xd23c('0x14')]('[%s][members][agentcomplete]\x20interface:%s\x20queue:%s',_0x36e7ac[_0xd23c('0x5')],_0x36e7ac[_0xd23c('0x6')],_0x36e7ac['queue']));members[_0x36e7ac[_0xd23c('0x6')]]=_[_0xd23c('0x29')](members[_0x36e7ac[_0xd23c('0x6')]],{'data4':_0x36e7ac[_0xd23c('0x2a')],'uniqueid':_0x36e7ac[_0xd23c('0x5')]});}}catch(_0x1b0383){utils[_0xd23c('0x13')](util[_0xd23c('0x14')]('[%s][members][agentcomplete]',_0x36e7ac['uniqueid']),_0x1b0383);}};exports['cdr']=function(_0xc75f0c){try{utils[_0xd23c('0x19')](util[_0xd23c('0x14')](_0xd23c('0x2b'),_0xc75f0c[_0xd23c('0x5')]),_0xc75f0c);if(_0xc75f0c['channel']){var _0x21fcba=_0xc75f0c[_0xd23c('0x7')][_0xd23c('0x10')]('-')[0x0];if(!_['isNil'](members[_0x21fcba])){members[_0x21fcba]=_[_0xd23c('0x29')](members[_0x21fcba],{'data1':members[_0x21fcba][_0xd23c('0x2c')]||_0xc75f0c[_0xd23c('0x9')],'data2':members[_0x21fcba][_0xd23c('0x8')]||_0xc75f0c['source'],'data3':members[_0x21fcba]['data3']||_0xc75f0c['destination'],'uniqueid':members[_0x21fcba][_0xd23c('0x5')]||_0xc75f0c[_0xd23c('0x5')]});utils[_0xd23c('0x3')](util[_0xd23c('0x14')](_0xd23c('0x2d'),_0xc75f0c[_0xd23c('0x5')],members[_0x21fcba][_0xd23c('0x2c')],members[_0x21fcba]['data2'],members[_0x21fcba]['data3']));if(members[_0x21fcba][_0xd23c('0x22')]){writeDB(members[_0x21fcba]);}}}if(_0xc75f0c[_0xd23c('0x2e')]){var _0x9ebe12=_0xc75f0c['destinationchannel'][_0xd23c('0x10')]('-')[0x0];if(!_['isNil'](members[_0x9ebe12])){members[_0x9ebe12]=_['assign'](members[_0x9ebe12],{'data1':members[_0x9ebe12][_0xd23c('0x2c')]||_0xc75f0c[_0xd23c('0x9')],'data2':members[_0x9ebe12]['data2']||_0xc75f0c[_0xd23c('0x2f')],'data3':members[_0x9ebe12][_0xd23c('0x30')]||_0xc75f0c[_0xd23c('0x31')],'uniqueid':members[_0x9ebe12]['uniqueid']||_0xc75f0c[_0xd23c('0x5')]});utils[_0xd23c('0x3')](util['format']('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0xc75f0c[_0xd23c('0x5')],members[_0x9ebe12]['data1'],members[_0x9ebe12]['data2'],members[_0x9ebe12]['data3']));if(members[_0x9ebe12]['exitAt']){writeDB(members[_0x9ebe12]);}}}}catch(_0x4795f3){utils[_0xd23c('0x13')](util[_0xd23c('0x14')](_0xd23c('0x2b'),_0xc75f0c['uniqueid']),_0x4795f3);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index ba29659..cda2abd 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 _0xb4c5=['hangup','isNil','[%s][queues][hangup]','queuecallerabandon','queuecallerexit','queuecallercomplete','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','transfereduniqueid','error','varset','[%s][queues][varset]','value','CONTINUE','queuecallerabandonAt','queuecallerexitAt','toUpperCase','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','name','queueposition','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','holdtime','diffTime','queuecallerleaveAt','queuecallerjoinAt','count','agentconnect','[%s][queues][agentconnect]','membername','destaccountcode','assigned','accountcode','agentcomplete','[%s][queues][agentcomplete]','queuecallercompleteAt','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','[%s][queues][attendedtransfer]','origtransfereruniqueid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','ATTENDED','transferexten','origtransfererexten','ATTENDEDTRANSFER','origtransfererlinkedid','transfereelinkedid','queuecallerenterreason','clone','transfertargetuniqueid','calleridnum','calleridname','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertype','transfertargetlinkedid','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','util','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','lastAssignedTo','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','debug','position','assign','now'];(function(_0x1d211b,_0x475f3b){var _0x47c88b=function(_0x3126f5){while(--_0x3126f5){_0x1d211b['push'](_0x1d211b['shift']());}};_0x47c88b(++_0x475f3b);}(_0xb4c5,0x11c));var _0x5b4c=function(_0x58789f,_0xe36d53){_0x58789f=_0x58789f-0x0;var _0xa1a99c=_0xb4c5[_0x58789f];return _0xa1a99c;};'use strict';var _=require('lodash');var util=require(_0x5b4c('0x0'));var utils=require(_0x5b4c('0x1'));var queues={};function writeDB(_0x4becee){utils[_0x5b4c('0x2')](util[_0x5b4c('0x3')](_0x5b4c('0x4'),_0x4becee[_0x5b4c('0x5')],_0x4becee[_0x5b4c('0x6')],_0x4becee[_0x5b4c('0x7')],_0x4becee[_0x5b4c('0x8')],_0x4becee['calleridnum'],_0x4becee['accountcode'],_0x4becee[_0x5b4c('0x9')]));if(_0x4becee[_0x5b4c('0x7')]){utils[_0x5b4c('0xa')](_0x4becee[_0x5b4c('0x7')])[_0x5b4c('0xb')](function(_0x16166a){if(_0x16166a){_0x4becee['type']=_0x16166a[_0x5b4c('0xc')];}utils[_0x5b4c('0xd')]('CreateVoiceQueueReport',_0x4becee);});}else{utils[_0x5b4c('0xd')](_0x5b4c('0xe'),_0x4becee);}if(_0x4becee['transfereduniqueid']){delete queues[_0x4becee['transfereduniqueid']];}else{delete queues[_0x4becee[_0x5b4c('0x5')]];}}exports['queuecallerjoin']=function(_0x1cf98c){try{utils[_0x5b4c('0xf')](util[_0x5b4c('0x3')]('[%s][queues][queuecallerjoin]',_0x1cf98c['uniqueid']),_0x1cf98c);utils['info'](util[_0x5b4c('0x3')]('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0x1cf98c[_0x5b4c('0x5')],_0x1cf98c['queue'],_0x1cf98c[_0x5b4c('0x10')]));queues[_0x1cf98c['uniqueid']]=_[_0x5b4c('0x11')](_0x1cf98c,{'originalposition':_0x1cf98c[_0x5b4c('0x10')],'queuecallerjoinAt':utils[_0x5b4c('0x12')](),'mohtime':0x0});}catch(_0x1ba7c4){utils['error'](util[_0x5b4c('0x3')]('[%s][queues][queuecallerjoin]',_0x1cf98c[_0x5b4c('0x5')]),_0x1ba7c4);}};exports[_0x5b4c('0x13')]=function(_0xca4ef9){try{if(!_[_0x5b4c('0x14')](queues[_0xca4ef9[_0x5b4c('0x5')]])){utils[_0x5b4c('0xf')](util[_0x5b4c('0x3')](_0x5b4c('0x15'),_0xca4ef9[_0x5b4c('0x5')]),_0xca4ef9);if(queues[_0xca4ef9[_0x5b4c('0x5')]]['queuecallerleaveAt']){if(!queues[_0xca4ef9[_0x5b4c('0x5')]][_0x5b4c('0x16')]&&!queues[_0xca4ef9[_0x5b4c('0x5')]][_0x5b4c('0x17')]){queues[_0xca4ef9['uniqueid']][_0x5b4c('0x18')]=!![];queues[_0xca4ef9[_0x5b4c('0x5')]]['queuecallercompleteAt']=utils[_0x5b4c('0x12')]();queues[_0xca4ef9['uniqueid']][_0x5b4c('0x9')]=_0x5b4c('0x19');}utils[_0x5b4c('0x2')](util[_0x5b4c('0x3')]('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0xca4ef9[_0x5b4c('0x5')],queues[_0xca4ef9[_0x5b4c('0x5')]]['name'],queues[_0xca4ef9[_0x5b4c('0x5')]][_0x5b4c('0x9')]));writeDB(queues[_0xca4ef9['uniqueid']]);}else if(queues[_0xca4ef9[_0x5b4c('0x5')]]['transfereduniqueid']){utils[_0x5b4c('0x2')](util[_0x5b4c('0x3')](_0x5b4c('0x1a'),_0xca4ef9['uniqueid'],queues[_0xca4ef9[_0x5b4c('0x5')]]['name'],queues[_0xca4ef9['uniqueid']][_0x5b4c('0x1b')]));queues[queues[_0xca4ef9[_0x5b4c('0x5')]][_0x5b4c('0x1b')]]=queues[_0xca4ef9[_0x5b4c('0x5')]];queues[queues[_0xca4ef9[_0x5b4c('0x5')]][_0x5b4c('0x1b')]]['queuecallerenterreason']=0x2;delete queues[_0xca4ef9[_0x5b4c('0x5')]];}}}catch(_0x55265d){utils[_0x5b4c('0x1c')](util[_0x5b4c('0x3')]('[%s][queues][hangup]',_0xca4ef9[_0x5b4c('0x5')]),_0x55265d);}};exports[_0x5b4c('0x1d')]=function(_0x116a95){try{utils[_0x5b4c('0xf')](util['format'](_0x5b4c('0x1e'),_0x116a95[_0x5b4c('0x5')]),_0x116a95);if(!_[_0x5b4c('0x14')](_0x116a95['variable']['queuestatus'])&&_0x116a95[_0x5b4c('0x1f')]['toUpperCase']()!==_0x5b4c('0x20')){if(!_[_0x5b4c('0x14')](queues[_0x116a95['uniqueid']])){queues[_0x116a95[_0x5b4c('0x5')]][_0x5b4c('0x16')]=![];queues[_0x116a95[_0x5b4c('0x5')]][_0x5b4c('0x21')]=null;queues[_0x116a95[_0x5b4c('0x5')]][_0x5b4c('0x17')]=!![];queues[_0x116a95['uniqueid']][_0x5b4c('0x22')]=utils[_0x5b4c('0x12')]();queues[_0x116a95[_0x5b4c('0x5')]][_0x5b4c('0x9')]=_0x116a95['value'][_0x5b4c('0x23')]();utils[_0x5b4c('0x2')](util[_0x5b4c('0x3')](_0x5b4c('0x24'),_0x116a95[_0x5b4c('0x5')],queues[_0x116a95[_0x5b4c('0x5')]][_0x5b4c('0x25')],_0x116a95[_0x5b4c('0x1f')],queues[_0x116a95[_0x5b4c('0x5')]]['queuecallerexitreason']));writeDB(queues[_0x116a95[_0x5b4c('0x5')]]);}}else if(!_['isNil'](_0x116a95['variable'][_0x5b4c('0x26')])){if(!_[_0x5b4c('0x14')](queues[_0x116a95[_0x5b4c('0x5')]])&&!queues[_0x116a95[_0x5b4c('0x5')]][_0x5b4c('0x16')]){queues[_0x116a95[_0x5b4c('0x5')]][_0x5b4c('0x16')]=![];queues[_0x116a95[_0x5b4c('0x5')]][_0x5b4c('0x21')]=null;queues[_0x116a95[_0x5b4c('0x5')]]['queuecallerexit']=!![];queues[_0x116a95[_0x5b4c('0x5')]][_0x5b4c('0x22')]=utils[_0x5b4c('0x12')]();queues[_0x116a95[_0x5b4c('0x5')]][_0x5b4c('0x9')]=_0x5b4c('0x27');utils[_0x5b4c('0x2')](util[_0x5b4c('0x3')](_0x5b4c('0x28'),_0x116a95['uniqueid'],queues[_0x116a95[_0x5b4c('0x5')]]['name'],_0x116a95[_0x5b4c('0x1f')],queues[_0x116a95[_0x5b4c('0x5')]][_0x5b4c('0x9')]));}}}catch(_0x395964){utils['error'](util['format'](_0x5b4c('0x1e'),_0x116a95['uniqueid']),_0x395964);}};exports['queuecallerabandon']=function(_0x5398d6){try{if(!_[_0x5b4c('0x14')](queues[_0x5398d6[_0x5b4c('0x5')]])){utils[_0x5b4c('0xf')](util['format'](_0x5b4c('0x29'),_0x5398d6[_0x5b4c('0x5')]),_0x5398d6);queues[_0x5398d6[_0x5b4c('0x5')]][_0x5b4c('0x17')]=![];queues[_0x5398d6['uniqueid']][_0x5b4c('0x22')]=null;queues[_0x5398d6[_0x5b4c('0x5')]][_0x5b4c('0x16')]=!![];queues[_0x5398d6[_0x5b4c('0x5')]][_0x5b4c('0x21')]=utils[_0x5b4c('0x12')]();queues[_0x5398d6[_0x5b4c('0x5')]]['queuecallerexitreason']='ABANDONED';utils[_0x5b4c('0x2')](util[_0x5b4c('0x3')](_0x5b4c('0x2a'),_0x5398d6['uniqueid'],queues[_0x5398d6['uniqueid']]['name'],queues[_0x5398d6[_0x5b4c('0x5')]][_0x5b4c('0x9')]));}}catch(_0x2b829e){utils[_0x5b4c('0x1c')](util[_0x5b4c('0x3')](_0x5b4c('0x29'),_0x5398d6['uniqueid']),_0x2b829e);}};exports['queuecallerleave']=function(_0x2fb0ef){try{if(!_[_0x5b4c('0x14')](queues[_0x2fb0ef[_0x5b4c('0x5')]])){utils['debug'](util['format'](_0x5b4c('0x2b'),_0x2fb0ef[_0x5b4c('0x5')]),_0x2fb0ef);utils[_0x5b4c('0x2')](util[_0x5b4c('0x3')](_0x5b4c('0x2c'),_0x2fb0ef[_0x5b4c('0x5')],queues[_0x2fb0ef[_0x5b4c('0x5')]][_0x5b4c('0x25')],_0x2fb0ef[_0x5b4c('0x2d')],_0x2fb0ef[_0x5b4c('0x2e')]));queues[_0x2fb0ef[_0x5b4c('0x5')]]['queuecallerleave']=!![];queues[_0x2fb0ef[_0x5b4c('0x5')]]['queuecallerleaveAt']=utils[_0x5b4c('0x12')]();queues[_0x2fb0ef[_0x5b4c('0x5')]][_0x5b4c('0x2f')]=utils[_0x5b4c('0x30')](queues[_0x2fb0ef[_0x5b4c('0x5')]][_0x5b4c('0x31')],queues[_0x2fb0ef['uniqueid']][_0x5b4c('0x32')]);queues[_0x2fb0ef['uniqueid']][_0x5b4c('0x10')]=_0x2fb0ef[_0x5b4c('0x10')];queues[_0x2fb0ef[_0x5b4c('0x5')]][_0x5b4c('0x33')]=_0x2fb0ef[_0x5b4c('0x33')];queues[_0x2fb0ef[_0x5b4c('0x5')]]['connectedlinenum']=_0x2fb0ef[_0x5b4c('0x2d')];queues[_0x2fb0ef[_0x5b4c('0x5')]][_0x5b4c('0x2e')]=_0x2fb0ef[_0x5b4c('0x2e')];}}catch(_0x7b50ae){utils[_0x5b4c('0x1c')](util[_0x5b4c('0x3')]('[%s][queues][queuecallerleave]',_0x2fb0ef['uniqueid']),_0x7b50ae);}};exports[_0x5b4c('0x34')]=function(_0x4ed427){try{if(!_[_0x5b4c('0x14')](queues[_0x4ed427[_0x5b4c('0x5')]])){utils['debug'](util['format'](_0x5b4c('0x35'),_0x4ed427[_0x5b4c('0x5')]),_0x4ed427);utils[_0x5b4c('0x2')](util[_0x5b4c('0x3')]('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x4ed427[_0x5b4c('0x5')],queues[_0x4ed427[_0x5b4c('0x5')]]['name'],_0x4ed427[_0x5b4c('0x36')],_0x4ed427[_0x5b4c('0x37')]));queues[_0x4ed427['uniqueid']][_0x5b4c('0x16')]=![];queues[_0x4ed427[_0x5b4c('0x5')]]['queuecallerabandon']=![];queues[_0x4ed427[_0x5b4c('0x5')]][_0x5b4c('0x21')]=null;queues[_0x4ed427[_0x5b4c('0x5')]][_0x5b4c('0x17')]=![];queues[_0x4ed427[_0x5b4c('0x5')]][_0x5b4c('0x9')]=null;queues[_0x4ed427[_0x5b4c('0x5')]][_0x5b4c('0x22')]=null;queues[_0x4ed427[_0x5b4c('0x5')]][_0x5b4c('0x38')]=!![];queues[_0x4ed427[_0x5b4c('0x5')]][_0x5b4c('0x39')]=_0x4ed427['destaccountcode'];queues[_0x4ed427[_0x5b4c('0x5')]][_0x5b4c('0x8')]=_0x4ed427[_0x5b4c('0x36')];}}catch(_0x2b6f27){utils['error'](util[_0x5b4c('0x3')](_0x5b4c('0x35'),_0x4ed427[_0x5b4c('0x5')]),_0x2b6f27);}};exports[_0x5b4c('0x3a')]=function(_0x33a8ff){try{if(!_[_0x5b4c('0x14')](queues[_0x33a8ff[_0x5b4c('0x5')]])){if(queues[_0x33a8ff[_0x5b4c('0x5')]][_0x5b4c('0x31')]){utils['debug'](util[_0x5b4c('0x3')](_0x5b4c('0x3b'),_0x33a8ff[_0x5b4c('0x5')]),_0x33a8ff);queues[_0x33a8ff['uniqueid']][_0x5b4c('0x16')]=![];queues[_0x33a8ff[_0x5b4c('0x5')]][_0x5b4c('0x16')]=![];queues[_0x33a8ff['uniqueid']]['queuecallerabandonAt']=null;queues[_0x33a8ff['uniqueid']][_0x5b4c('0x17')]=![];queues[_0x33a8ff[_0x5b4c('0x5')]][_0x5b4c('0x22')]=null;queues[_0x33a8ff['uniqueid']][_0x5b4c('0x38')]=!![];queues[_0x33a8ff[_0x5b4c('0x5')]][_0x5b4c('0x8')]=_0x33a8ff['membername'];queues[_0x33a8ff[_0x5b4c('0x5')]]['queuecallercomplete']=!![];queues[_0x33a8ff[_0x5b4c('0x5')]][_0x5b4c('0x3c')]=utils[_0x5b4c('0x12')]();if(_0x33a8ff[_0x5b4c('0x3d')]==_0x5b4c('0x3e')){if(!queues[_0x33a8ff['uniqueid']][_0x5b4c('0x3e')]){queues[_0x33a8ff[_0x5b4c('0x5')]]['queuecallerexitreason']=_0x5b4c('0x3f');}}else{queues[_0x33a8ff[_0x5b4c('0x5')]]['queuecallerexitreason']=_0x5b4c('0x40')+_0x33a8ff[_0x5b4c('0x3d')][_0x5b4c('0x23')]();}utils[_0x5b4c('0x2')](util[_0x5b4c('0x3')](_0x5b4c('0x41'),_0x33a8ff['uniqueid'],queues[_0x33a8ff[_0x5b4c('0x5')]][_0x5b4c('0x25')],_0x33a8ff['membername'],queues[_0x33a8ff[_0x5b4c('0x5')]][_0x5b4c('0x9')]));writeDB(queues[_0x33a8ff[_0x5b4c('0x5')]]);}}}catch(_0xd9e252){utils['error'](util[_0x5b4c('0x3')]('[%s][queues][agentcomplete]',_0x33a8ff[_0x5b4c('0x5')]),_0xd9e252);}};exports[_0x5b4c('0x42')]=function(_0x4d41e2){try{if(!_['isNil'](queues[_0x4d41e2[_0x5b4c('0x43')]])){utils[_0x5b4c('0xf')](util['format'](_0x5b4c('0x44'),_0x4d41e2[_0x5b4c('0x5')]),_0x4d41e2);queues[_0x4d41e2[_0x5b4c('0x43')]]['transfer']=!![];queues[_0x4d41e2[_0x5b4c('0x43')]]['transfertype']='BLIND';queues[_0x4d41e2[_0x5b4c('0x43')]]['transferexten']=_0x4d41e2[_0x5b4c('0x45')];queues[_0x4d41e2[_0x5b4c('0x43')]][_0x5b4c('0x46')]=_0x4d41e2[_0x5b4c('0x43')];queues[_0x4d41e2[_0x5b4c('0x43')]]['queuecallerexitreason']=_0x5b4c('0x47');utils[_0x5b4c('0x2')](util[_0x5b4c('0x3')](_0x5b4c('0x48'),_0x4d41e2[_0x5b4c('0x5')],queues[_0x4d41e2[_0x5b4c('0x43')]][_0x5b4c('0x25')],_0x4d41e2[_0x5b4c('0x43')],_0x4d41e2['extension']));}}catch(_0x38ac5a){utils[_0x5b4c('0x1c')](util[_0x5b4c('0x3')](_0x5b4c('0x44'),_0x4d41e2['uniqueid']),_0x38ac5a);}};exports['attendedtransfer']=function(_0x160cb9){try{utils[_0x5b4c('0xf')](util['format'](_0x5b4c('0x49'),_0x160cb9[_0x5b4c('0x4a')]),_0x160cb9);if(_0x160cb9[_0x5b4c('0x4a')]==_0x160cb9['origtransfererlinkedid']){if(!_[_0x5b4c('0x14')](queues[_0x160cb9[_0x5b4c('0x4b')]])){utils[_0x5b4c('0x2')](util['format'](_0x5b4c('0x4c'),_0x160cb9[_0x5b4c('0x4a')],queues[_0x160cb9['secondtransfererlinkedid']][_0x5b4c('0x25')],_0x160cb9['origtransfererexten']));queues[_0x160cb9[_0x5b4c('0x4b')]][_0x5b4c('0x3e')]=!![];queues[_0x160cb9['secondtransfererlinkedid']]['transfertype']=_0x5b4c('0x4d');queues[_0x160cb9[_0x5b4c('0x4b')]][_0x5b4c('0x4e')]=_0x160cb9[_0x5b4c('0x4f')];queues[_0x160cb9['secondtransfererlinkedid']][_0x5b4c('0x46')]=_0x160cb9[_0x5b4c('0x4a')];queues[_0x160cb9[_0x5b4c('0x4b')]][_0x5b4c('0x9')]=_0x5b4c('0x50');}if(!_['isNil'](queues[_0x160cb9[_0x5b4c('0x51')]])){if(_0x160cb9[_0x5b4c('0x52')]&&queues[_0x160cb9[_0x5b4c('0x52')]]){queues[_0x160cb9[_0x5b4c('0x52')]][_0x5b4c('0x53')]=0x1;queues[_0x160cb9[_0x5b4c('0x43')]]=_[_0x5b4c('0x54')](queues[_0x160cb9[_0x5b4c('0x52')]]);queues[_0x160cb9[_0x5b4c('0x43')]][_0x5b4c('0x1b')]=_0x160cb9[_0x5b4c('0x55')];queues[_0x160cb9[_0x5b4c('0x43')]][_0x5b4c('0x53')]=0x2;queues[_0x160cb9[_0x5b4c('0x43')]][_0x5b4c('0x56')]=queues[_0x160cb9[_0x5b4c('0x4b')]][_0x5b4c('0x56')];queues[_0x160cb9['transfereeuniqueid']][_0x5b4c('0x57')]=queues[_0x160cb9[_0x5b4c('0x4b')]][_0x5b4c('0x57')];queues[_0x160cb9[_0x5b4c('0x43')]][_0x5b4c('0x32')]=utils[_0x5b4c('0x12')]();queues[_0x160cb9[_0x5b4c('0x43')]][_0x5b4c('0x31')]=utils[_0x5b4c('0x12')]();queues[_0x160cb9[_0x5b4c('0x43')]][_0x5b4c('0x2f')]=0x0;queues[_0x160cb9[_0x5b4c('0x43')]]['mohtime']=0x0;utils['info'](util['format'](_0x5b4c('0x58'),_0x160cb9[_0x5b4c('0x4a')],queues[_0x160cb9['transfereeuniqueid']][_0x5b4c('0x25')],queues[_0x160cb9[_0x5b4c('0x43')]][_0x5b4c('0x56')],queues[_0x160cb9['transfereeuniqueid']]['calleridname']));}else{utils[_0x5b4c('0x2')](util[_0x5b4c('0x3')](_0x5b4c('0x59'),_0x160cb9[_0x5b4c('0x4a')],queues[_0x160cb9['origtransfererlinkedid']][_0x5b4c('0x25')],_0x160cb9['secondtransfererlinkedid']));queues[_0x160cb9[_0x5b4c('0x51')]][_0x5b4c('0x1b')]=_0x160cb9[_0x5b4c('0x4b')];}}}else if(_0x160cb9[_0x5b4c('0x5a')]==_0x160cb9[_0x5b4c('0x4b')]){if(!_['isNil'](queues[_0x160cb9[_0x5b4c('0x51')]])){utils[_0x5b4c('0x2')](util[_0x5b4c('0x3')](_0x5b4c('0x5b'),_0x160cb9[_0x5b4c('0x4a')],queues[_0x160cb9[_0x5b4c('0x51')]]['name'],_0x160cb9[_0x5b4c('0x5a')],_0x160cb9[_0x5b4c('0x5c')]));queues[_0x160cb9[_0x5b4c('0x51')]][_0x5b4c('0x3e')]=!![];queues[_0x160cb9[_0x5b4c('0x51')]][_0x5b4c('0x5d')]=_0x5b4c('0x4d');queues[_0x160cb9[_0x5b4c('0x51')]][_0x5b4c('0x4e')]=_0x160cb9['secondtransfererexten'];queues[_0x160cb9[_0x5b4c('0x51')]][_0x5b4c('0x46')]=_0x160cb9[_0x5b4c('0x5a')];queues[_0x160cb9[_0x5b4c('0x51')]][_0x5b4c('0x9')]=_0x5b4c('0x50');}if(!_['isNil'](queues[_0x160cb9[_0x5b4c('0x4b')]])){if(_0x160cb9[_0x5b4c('0x5e')]&&queues[_0x160cb9['transfertargetlinkedid']]){queues[_0x160cb9['transfertargetlinkedid']][_0x5b4c('0x53')]=0x1;queues[_0x160cb9[_0x5b4c('0x55')]]=_['clone'](queues[_0x160cb9[_0x5b4c('0x5e')]]);queues[_0x160cb9[_0x5b4c('0x55')]][_0x5b4c('0x1b')]=_0x160cb9[_0x5b4c('0x55')];queues[_0x160cb9[_0x5b4c('0x55')]][_0x5b4c('0x53')]=0x2;queues[_0x160cb9[_0x5b4c('0x55')]][_0x5b4c('0x56')]=queues[_0x160cb9[_0x5b4c('0x51')]]['calleridnum'];queues[_0x160cb9['transfertargetuniqueid']][_0x5b4c('0x57')]=queues[_0x160cb9[_0x5b4c('0x51')]][_0x5b4c('0x57')];queues[_0x160cb9[_0x5b4c('0x55')]][_0x5b4c('0x32')]=utils[_0x5b4c('0x12')]();queues[_0x160cb9['transfertargetuniqueid']][_0x5b4c('0x31')]=utils[_0x5b4c('0x12')]();queues[_0x160cb9[_0x5b4c('0x55')]][_0x5b4c('0x2f')]=0x0;queues[_0x160cb9[_0x5b4c('0x55')]][_0x5b4c('0x5f')]=0x0;utils['info'](util[_0x5b4c('0x3')](_0x5b4c('0x60'),_0x160cb9[_0x5b4c('0x4a')],queues[_0x160cb9[_0x5b4c('0x55')]][_0x5b4c('0x25')],queues[_0x160cb9[_0x5b4c('0x55')]]['transfereduniqueid'],queues[_0x160cb9[_0x5b4c('0x55')]][_0x5b4c('0x56')],queues[_0x160cb9[_0x5b4c('0x55')]][_0x5b4c('0x57')]));}else{utils[_0x5b4c('0x2')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x160cb9[_0x5b4c('0x4a')],queues[_0x160cb9[_0x5b4c('0x4b')]][_0x5b4c('0x25')],_0x160cb9[_0x5b4c('0x51')]));queues[_0x160cb9[_0x5b4c('0x4b')]][_0x5b4c('0x1b')]=_0x160cb9[_0x5b4c('0x51')];}}}}catch(_0x525799){utils[_0x5b4c('0x1c')](util[_0x5b4c('0x3')](_0x5b4c('0x49'),_0x160cb9[_0x5b4c('0x4a')]),_0x525799);}};exports[_0x5b4c('0x61')]=function(_0x814bcb){try{if(!_['isNil'](queues[_0x814bcb[_0x5b4c('0x5')]])){utils['debug'](util['format'](_0x5b4c('0x62'),_0x814bcb[_0x5b4c('0x5')]),_0x814bcb);queues[_0x814bcb[_0x5b4c('0x5')]]['musiconholdstartAt']=utils[_0x5b4c('0x12')]();utils[_0x5b4c('0x2')](util['format']('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0x814bcb['uniqueid'],queues[_0x814bcb[_0x5b4c('0x5')]]['name'],queues[_0x814bcb[_0x5b4c('0x5')]][_0x5b4c('0x63')]));}}catch(_0x4fe8f6){utils[_0x5b4c('0x1c')](util[_0x5b4c('0x3')](_0x5b4c('0x62'),_0x814bcb[_0x5b4c('0x5')]),_0x4fe8f6);}};exports['musiconholdstop']=function(_0x2ac247){try{if(!_[_0x5b4c('0x14')](queues[_0x2ac247[_0x5b4c('0x5')]])){if(!_[_0x5b4c('0x14')](queues[_0x2ac247[_0x5b4c('0x5')]]['musiconholdstartAt'])){utils[_0x5b4c('0xf')](util['format']('[%s][queues][musiconholdstop]',_0x2ac247['uniqueid']),_0x2ac247);queues[_0x2ac247['uniqueid']][_0x5b4c('0x5f')]+=utils[_0x5b4c('0x30')](utils[_0x5b4c('0x12')](),queues[_0x2ac247['uniqueid']]['musiconholdstartAt']);utils[_0x5b4c('0x2')](util['format'](_0x5b4c('0x64'),_0x2ac247[_0x5b4c('0x5')],queues[_0x2ac247['uniqueid']]['name'],queues[_0x2ac247[_0x5b4c('0x5')]][_0x5b4c('0x5f')]));delete queues[_0x2ac247[_0x5b4c('0x5')]][_0x5b4c('0x63')];}}}catch(_0x488730){utils[_0x5b4c('0x1c')](util[_0x5b4c('0x3')]('[%s][queues][musiconholdstop]',_0x2ac247['uniqueid']),_0x488730);}}; \ No newline at end of file +var _0x9acd=['membername','destaccountcode','assigned','accountcode','agentcomplete','[%s][queues][agentcomplete]','reason','transfer','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','transfertype','transferuniqueid','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','extension','[%s][queues][blindtransfer]','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','transferexten','origtransfererexten','ATTENDEDTRANSFER','origtransfererlinkedid','transfereelinkedid','clone','transfertargetuniqueid','calleridnum','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','ATTENDED','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','./utils','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','lastAssignedTo','queuecallerexitreason','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','position','error','isNil','queuecallerleaveAt','queuecallerexit','queuecallercompleteAt','now','COMPLETEDBYAGENT','info','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','[%s][queues][hangup]','[%s][queues][varset]','variable','queuestatus','value','CONTINUE','queuecallerabandon','queuecallerabandonAt','queuecallerexitAt','toUpperCase','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','holdtime','diffTime','queuecallerjoinAt','count','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s'];(function(_0x2053aa,_0x3df40e){var _0x30f5bb=function(_0x1b3f36){while(--_0x1b3f36){_0x2053aa['push'](_0x2053aa['shift']());}};_0x30f5bb(++_0x3df40e);}(_0x9acd,0x8f));var _0xd9ac=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x9acd[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0xd9ac('0x0'));var util=require(_0xd9ac('0x1'));var utils=require(_0xd9ac('0x2'));var queues={};function writeDB(_0x4a7a7f){utils['info'](util[_0xd9ac('0x3')](_0xd9ac('0x4'),_0x4a7a7f[_0xd9ac('0x5')],_0x4a7a7f[_0xd9ac('0x6')],_0x4a7a7f[_0xd9ac('0x7')],_0x4a7a7f[_0xd9ac('0x8')],_0x4a7a7f['calleridnum'],_0x4a7a7f['accountcode'],_0x4a7a7f[_0xd9ac('0x9')]));if(_0x4a7a7f['queue']){utils['getVoiceQueueByName'](_0x4a7a7f[_0xd9ac('0x7')])[_0xd9ac('0xa')](function(_0x3e8d2b){if(_0x3e8d2b){_0x4a7a7f[_0xd9ac('0xb')]=_0x3e8d2b['type'];}utils[_0xd9ac('0xc')](_0xd9ac('0xd'),_0x4a7a7f);});}else{utils[_0xd9ac('0xc')]('CreateVoiceQueueReport',_0x4a7a7f);}if(_0x4a7a7f['transfereduniqueid']){delete queues[_0x4a7a7f[_0xd9ac('0xe')]];}else{delete queues[_0x4a7a7f[_0xd9ac('0x5')]];}}exports[_0xd9ac('0xf')]=function(_0x3b84bf){try{utils[_0xd9ac('0x10')](util[_0xd9ac('0x3')](_0xd9ac('0x11'),_0x3b84bf[_0xd9ac('0x5')]),_0x3b84bf);utils['info'](util[_0xd9ac('0x3')]('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0x3b84bf[_0xd9ac('0x5')],_0x3b84bf[_0xd9ac('0x7')],_0x3b84bf[_0xd9ac('0x12')]));queues[_0x3b84bf[_0xd9ac('0x5')]]=_['assign'](_0x3b84bf,{'originalposition':_0x3b84bf[_0xd9ac('0x12')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x433acb){utils[_0xd9ac('0x13')](util['format'](_0xd9ac('0x11'),_0x3b84bf['uniqueid']),_0x433acb);}};exports['hangup']=function(_0xafb26e){try{if(!_[_0xd9ac('0x14')](queues[_0xafb26e[_0xd9ac('0x5')]])){utils['debug'](util[_0xd9ac('0x3')]('[%s][queues][hangup]',_0xafb26e['uniqueid']),_0xafb26e);if(queues[_0xafb26e[_0xd9ac('0x5')]][_0xd9ac('0x15')]){if(!queues[_0xafb26e['uniqueid']]['queuecallerabandon']&&!queues[_0xafb26e[_0xd9ac('0x5')]][_0xd9ac('0x16')]){queues[_0xafb26e['uniqueid']]['queuecallercomplete']=!![];queues[_0xafb26e[_0xd9ac('0x5')]][_0xd9ac('0x17')]=utils[_0xd9ac('0x18')]();queues[_0xafb26e[_0xd9ac('0x5')]][_0xd9ac('0x9')]=_0xd9ac('0x19');}utils[_0xd9ac('0x1a')](util['format'](_0xd9ac('0x1b'),_0xafb26e['uniqueid'],queues[_0xafb26e['uniqueid']][_0xd9ac('0x1c')],queues[_0xafb26e['uniqueid']][_0xd9ac('0x9')]));writeDB(queues[_0xafb26e['uniqueid']]);}else if(queues[_0xafb26e['uniqueid']]['transfereduniqueid']){utils[_0xd9ac('0x1a')](util[_0xd9ac('0x3')](_0xd9ac('0x1d'),_0xafb26e[_0xd9ac('0x5')],queues[_0xafb26e[_0xd9ac('0x5')]][_0xd9ac('0x1c')],queues[_0xafb26e[_0xd9ac('0x5')]][_0xd9ac('0xe')]));queues[queues[_0xafb26e['uniqueid']][_0xd9ac('0xe')]]=queues[_0xafb26e[_0xd9ac('0x5')]];queues[queues[_0xafb26e[_0xd9ac('0x5')]][_0xd9ac('0xe')]][_0xd9ac('0x1e')]=0x2;delete queues[_0xafb26e['uniqueid']];}}}catch(_0x31d200){utils[_0xd9ac('0x13')](util['format'](_0xd9ac('0x1f'),_0xafb26e[_0xd9ac('0x5')]),_0x31d200);}};exports['varset']=function(_0x3df825){try{utils[_0xd9ac('0x10')](util[_0xd9ac('0x3')](_0xd9ac('0x20'),_0x3df825[_0xd9ac('0x5')]),_0x3df825);if(!_[_0xd9ac('0x14')](_0x3df825[_0xd9ac('0x21')][_0xd9ac('0x22')])&&_0x3df825[_0xd9ac('0x23')]['toUpperCase']()!==_0xd9ac('0x24')){if(!_[_0xd9ac('0x14')](queues[_0x3df825[_0xd9ac('0x5')]])){queues[_0x3df825[_0xd9ac('0x5')]][_0xd9ac('0x25')]=![];queues[_0x3df825['uniqueid']][_0xd9ac('0x26')]=null;queues[_0x3df825[_0xd9ac('0x5')]]['queuecallerexit']=!![];queues[_0x3df825['uniqueid']][_0xd9ac('0x27')]=utils[_0xd9ac('0x18')]();queues[_0x3df825[_0xd9ac('0x5')]][_0xd9ac('0x9')]=_0x3df825[_0xd9ac('0x23')][_0xd9ac('0x28')]();utils[_0xd9ac('0x1a')](util[_0xd9ac('0x3')](_0xd9ac('0x29'),_0x3df825['uniqueid'],queues[_0x3df825['uniqueid']][_0xd9ac('0x1c')],_0x3df825[_0xd9ac('0x23')],queues[_0x3df825['uniqueid']]['queuecallerexitreason']));writeDB(queues[_0x3df825[_0xd9ac('0x5')]]);}}else if(!_['isNil'](_0x3df825[_0xd9ac('0x21')]['queueposition'])){if(!_[_0xd9ac('0x14')](queues[_0x3df825['uniqueid']])&&!queues[_0x3df825['uniqueid']][_0xd9ac('0x25')]){queues[_0x3df825['uniqueid']][_0xd9ac('0x25')]=![];queues[_0x3df825[_0xd9ac('0x5')]]['queuecallerabandonAt']=null;queues[_0x3df825[_0xd9ac('0x5')]][_0xd9ac('0x16')]=!![];queues[_0x3df825[_0xd9ac('0x5')]][_0xd9ac('0x27')]=utils['now']();queues[_0x3df825[_0xd9ac('0x5')]][_0xd9ac('0x9')]=_0xd9ac('0x2a');utils[_0xd9ac('0x1a')](util['format'](_0xd9ac('0x2b'),_0x3df825[_0xd9ac('0x5')],queues[_0x3df825[_0xd9ac('0x5')]][_0xd9ac('0x1c')],_0x3df825[_0xd9ac('0x23')],queues[_0x3df825[_0xd9ac('0x5')]][_0xd9ac('0x9')]));}}}catch(_0x40a57d){utils[_0xd9ac('0x13')](util[_0xd9ac('0x3')](_0xd9ac('0x20'),_0x3df825[_0xd9ac('0x5')]),_0x40a57d);}};exports['queuecallerabandon']=function(_0x1486e2){try{if(!_[_0xd9ac('0x14')](queues[_0x1486e2['uniqueid']])){utils[_0xd9ac('0x10')](util['format'](_0xd9ac('0x2c'),_0x1486e2[_0xd9ac('0x5')]),_0x1486e2);queues[_0x1486e2[_0xd9ac('0x5')]][_0xd9ac('0x16')]=![];queues[_0x1486e2['uniqueid']][_0xd9ac('0x27')]=null;queues[_0x1486e2[_0xd9ac('0x5')]][_0xd9ac('0x25')]=!![];queues[_0x1486e2[_0xd9ac('0x5')]][_0xd9ac('0x26')]=utils[_0xd9ac('0x18')]();queues[_0x1486e2['uniqueid']][_0xd9ac('0x9')]=_0xd9ac('0x2d');utils['info'](util[_0xd9ac('0x3')](_0xd9ac('0x2e'),_0x1486e2['uniqueid'],queues[_0x1486e2[_0xd9ac('0x5')]][_0xd9ac('0x1c')],queues[_0x1486e2['uniqueid']]['queuecallerexitreason']));}}catch(_0x265128){utils[_0xd9ac('0x13')](util[_0xd9ac('0x3')](_0xd9ac('0x2c'),_0x1486e2[_0xd9ac('0x5')]),_0x265128);}};exports[_0xd9ac('0x2f')]=function(_0x4e5b4e){try{if(!_[_0xd9ac('0x14')](queues[_0x4e5b4e['uniqueid']])){utils[_0xd9ac('0x10')](util['format'](_0xd9ac('0x30'),_0x4e5b4e['uniqueid']),_0x4e5b4e);utils['info'](util['format'](_0xd9ac('0x31'),_0x4e5b4e[_0xd9ac('0x5')],queues[_0x4e5b4e[_0xd9ac('0x5')]][_0xd9ac('0x1c')],_0x4e5b4e[_0xd9ac('0x32')],_0x4e5b4e[_0xd9ac('0x33')]));queues[_0x4e5b4e[_0xd9ac('0x5')]][_0xd9ac('0x2f')]=!![];queues[_0x4e5b4e[_0xd9ac('0x5')]]['queuecallerleaveAt']=utils[_0xd9ac('0x18')]();queues[_0x4e5b4e[_0xd9ac('0x5')]][_0xd9ac('0x34')]=utils[_0xd9ac('0x35')](queues[_0x4e5b4e[_0xd9ac('0x5')]][_0xd9ac('0x15')],queues[_0x4e5b4e[_0xd9ac('0x5')]][_0xd9ac('0x36')]);queues[_0x4e5b4e[_0xd9ac('0x5')]][_0xd9ac('0x12')]=_0x4e5b4e[_0xd9ac('0x12')];queues[_0x4e5b4e['uniqueid']]['count']=_0x4e5b4e[_0xd9ac('0x37')];queues[_0x4e5b4e[_0xd9ac('0x5')]][_0xd9ac('0x32')]=_0x4e5b4e[_0xd9ac('0x32')];queues[_0x4e5b4e[_0xd9ac('0x5')]]['connectedlinename']=_0x4e5b4e[_0xd9ac('0x33')];}}catch(_0x456a3a){utils[_0xd9ac('0x13')](util[_0xd9ac('0x3')](_0xd9ac('0x30'),_0x4e5b4e[_0xd9ac('0x5')]),_0x456a3a);}};exports[_0xd9ac('0x38')]=function(_0x4d2c12){try{if(!_[_0xd9ac('0x14')](queues[_0x4d2c12[_0xd9ac('0x5')]])){utils['debug'](util[_0xd9ac('0x3')](_0xd9ac('0x39'),_0x4d2c12[_0xd9ac('0x5')]),_0x4d2c12);utils[_0xd9ac('0x1a')](util[_0xd9ac('0x3')](_0xd9ac('0x3a'),_0x4d2c12[_0xd9ac('0x5')],queues[_0x4d2c12[_0xd9ac('0x5')]][_0xd9ac('0x1c')],_0x4d2c12[_0xd9ac('0x3b')],_0x4d2c12[_0xd9ac('0x3c')]));queues[_0x4d2c12[_0xd9ac('0x5')]][_0xd9ac('0x25')]=![];queues[_0x4d2c12[_0xd9ac('0x5')]][_0xd9ac('0x25')]=![];queues[_0x4d2c12['uniqueid']][_0xd9ac('0x26')]=null;queues[_0x4d2c12[_0xd9ac('0x5')]][_0xd9ac('0x16')]=![];queues[_0x4d2c12[_0xd9ac('0x5')]][_0xd9ac('0x9')]=null;queues[_0x4d2c12[_0xd9ac('0x5')]][_0xd9ac('0x27')]=null;queues[_0x4d2c12[_0xd9ac('0x5')]][_0xd9ac('0x3d')]=!![];queues[_0x4d2c12[_0xd9ac('0x5')]][_0xd9ac('0x3e')]=_0x4d2c12[_0xd9ac('0x3c')];queues[_0x4d2c12[_0xd9ac('0x5')]][_0xd9ac('0x8')]=_0x4d2c12[_0xd9ac('0x3b')];}}catch(_0x8d7572){utils[_0xd9ac('0x13')](util['format'](_0xd9ac('0x39'),_0x4d2c12['uniqueid']),_0x8d7572);}};exports[_0xd9ac('0x3f')]=function(_0x2f2464){try{if(!_['isNil'](queues[_0x2f2464[_0xd9ac('0x5')]])){if(queues[_0x2f2464['uniqueid']]['queuecallerleaveAt']){utils[_0xd9ac('0x10')](util['format'](_0xd9ac('0x40'),_0x2f2464[_0xd9ac('0x5')]),_0x2f2464);queues[_0x2f2464[_0xd9ac('0x5')]][_0xd9ac('0x25')]=![];queues[_0x2f2464['uniqueid']][_0xd9ac('0x25')]=![];queues[_0x2f2464['uniqueid']][_0xd9ac('0x26')]=null;queues[_0x2f2464[_0xd9ac('0x5')]][_0xd9ac('0x16')]=![];queues[_0x2f2464[_0xd9ac('0x5')]][_0xd9ac('0x27')]=null;queues[_0x2f2464[_0xd9ac('0x5')]][_0xd9ac('0x3d')]=!![];queues[_0x2f2464[_0xd9ac('0x5')]][_0xd9ac('0x8')]=_0x2f2464[_0xd9ac('0x3b')];queues[_0x2f2464[_0xd9ac('0x5')]]['queuecallercomplete']=!![];queues[_0x2f2464['uniqueid']]['queuecallercompleteAt']=utils[_0xd9ac('0x18')]();if(_0x2f2464[_0xd9ac('0x41')]=='transfer'){if(!queues[_0x2f2464['uniqueid']][_0xd9ac('0x42')]){queues[_0x2f2464[_0xd9ac('0x5')]]['queuecallerexitreason']='TRANSFER';}}else{queues[_0x2f2464[_0xd9ac('0x5')]]['queuecallerexitreason']='COMPLETEDBY'+_0x2f2464[_0xd9ac('0x41')]['toUpperCase']();}utils[_0xd9ac('0x1a')](util[_0xd9ac('0x3')](_0xd9ac('0x43'),_0x2f2464['uniqueid'],queues[_0x2f2464[_0xd9ac('0x5')]][_0xd9ac('0x1c')],_0x2f2464[_0xd9ac('0x3b')],queues[_0x2f2464[_0xd9ac('0x5')]]['queuecallerexitreason']));writeDB(queues[_0x2f2464[_0xd9ac('0x5')]]);}}}catch(_0xbf1a3f){utils[_0xd9ac('0x13')](util[_0xd9ac('0x3')](_0xd9ac('0x40'),_0x2f2464[_0xd9ac('0x5')]),_0xbf1a3f);}};exports[_0xd9ac('0x44')]=function(_0x396274){try{if(!_[_0xd9ac('0x14')](queues[_0x396274['transfereeuniqueid']])){utils[_0xd9ac('0x10')](util[_0xd9ac('0x3')]('[%s][queues][blindtransfer]',_0x396274['uniqueid']),_0x396274);queues[_0x396274[_0xd9ac('0x45')]][_0xd9ac('0x42')]=!![];queues[_0x396274[_0xd9ac('0x45')]][_0xd9ac('0x46')]='BLIND';queues[_0x396274['transfereeuniqueid']]['transferexten']=_0x396274['extension'];queues[_0x396274[_0xd9ac('0x45')]][_0xd9ac('0x47')]=_0x396274[_0xd9ac('0x45')];queues[_0x396274[_0xd9ac('0x45')]][_0xd9ac('0x9')]='BLINDTRANSFER';utils['info'](util[_0xd9ac('0x3')](_0xd9ac('0x48'),_0x396274[_0xd9ac('0x5')],queues[_0x396274[_0xd9ac('0x45')]][_0xd9ac('0x1c')],_0x396274[_0xd9ac('0x45')],_0x396274[_0xd9ac('0x49')]));}}catch(_0x1b5698){utils[_0xd9ac('0x13')](util[_0xd9ac('0x3')](_0xd9ac('0x4a'),_0x396274[_0xd9ac('0x5')]),_0x1b5698);}};exports[_0xd9ac('0x4b')]=function(_0x434349){try{utils[_0xd9ac('0x10')](util[_0xd9ac('0x3')](_0xd9ac('0x4c'),_0x434349[_0xd9ac('0x4d')]),_0x434349);if(_0x434349[_0xd9ac('0x4d')]==_0x434349['origtransfererlinkedid']){if(!_[_0xd9ac('0x14')](queues[_0x434349[_0xd9ac('0x4e')]])){utils['info'](util[_0xd9ac('0x3')](_0xd9ac('0x4f'),_0x434349['origtransfereruniqueid'],queues[_0x434349['secondtransfererlinkedid']]['name'],_0x434349['origtransfererexten']));queues[_0x434349[_0xd9ac('0x4e')]][_0xd9ac('0x42')]=!![];queues[_0x434349[_0xd9ac('0x4e')]][_0xd9ac('0x46')]='ATTENDED';queues[_0x434349['secondtransfererlinkedid']][_0xd9ac('0x50')]=_0x434349[_0xd9ac('0x51')];queues[_0x434349[_0xd9ac('0x4e')]][_0xd9ac('0x47')]=_0x434349[_0xd9ac('0x4d')];queues[_0x434349[_0xd9ac('0x4e')]]['queuecallerexitreason']=_0xd9ac('0x52');}if(!_[_0xd9ac('0x14')](queues[_0x434349[_0xd9ac('0x53')]])){if(_0x434349['transfereelinkedid']&&queues[_0x434349['transfereelinkedid']]){queues[_0x434349[_0xd9ac('0x54')]][_0xd9ac('0x1e')]=0x1;queues[_0x434349['transfereeuniqueid']]=_[_0xd9ac('0x55')](queues[_0x434349[_0xd9ac('0x54')]]);queues[_0x434349[_0xd9ac('0x45')]]['transfereduniqueid']=_0x434349[_0xd9ac('0x56')];queues[_0x434349[_0xd9ac('0x45')]][_0xd9ac('0x1e')]=0x2;queues[_0x434349['transfereeuniqueid']][_0xd9ac('0x57')]=queues[_0x434349[_0xd9ac('0x4e')]][_0xd9ac('0x57')];queues[_0x434349['transfereeuniqueid']][_0xd9ac('0x58')]=queues[_0x434349[_0xd9ac('0x4e')]][_0xd9ac('0x58')];queues[_0x434349[_0xd9ac('0x45')]][_0xd9ac('0x36')]=utils['now']();queues[_0x434349[_0xd9ac('0x45')]]['queuecallerleaveAt']=utils['now']();queues[_0x434349['transfereeuniqueid']][_0xd9ac('0x34')]=0x0;queues[_0x434349[_0xd9ac('0x45')]][_0xd9ac('0x59')]=0x0;utils[_0xd9ac('0x1a')](util[_0xd9ac('0x3')](_0xd9ac('0x5a'),_0x434349[_0xd9ac('0x4d')],queues[_0x434349[_0xd9ac('0x45')]][_0xd9ac('0x1c')],queues[_0x434349['transfereeuniqueid']][_0xd9ac('0x57')],queues[_0x434349[_0xd9ac('0x45')]]['calleridname']));}else{utils[_0xd9ac('0x1a')](util['format'](_0xd9ac('0x5b'),_0x434349[_0xd9ac('0x4d')],queues[_0x434349[_0xd9ac('0x53')]][_0xd9ac('0x1c')],_0x434349[_0xd9ac('0x4e')]));queues[_0x434349[_0xd9ac('0x53')]][_0xd9ac('0xe')]=_0x434349[_0xd9ac('0x4e')];}}}else if(_0x434349[_0xd9ac('0x5c')]==_0x434349[_0xd9ac('0x4e')]){if(!_[_0xd9ac('0x14')](queues[_0x434349['origtransfererlinkedid']])){utils[_0xd9ac('0x1a')](util[_0xd9ac('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x434349[_0xd9ac('0x4d')],queues[_0x434349['origtransfererlinkedid']][_0xd9ac('0x1c')],_0x434349[_0xd9ac('0x5c')],_0x434349['secondtransfererexten']));queues[_0x434349['origtransfererlinkedid']][_0xd9ac('0x42')]=!![];queues[_0x434349[_0xd9ac('0x53')]]['transfertype']=_0xd9ac('0x5d');queues[_0x434349[_0xd9ac('0x53')]]['transferexten']=_0x434349['secondtransfererexten'];queues[_0x434349[_0xd9ac('0x53')]][_0xd9ac('0x47')]=_0x434349['secondtransfereruniqueid'];queues[_0x434349['origtransfererlinkedid']]['queuecallerexitreason']=_0xd9ac('0x52');}if(!_[_0xd9ac('0x14')](queues[_0x434349[_0xd9ac('0x4e')]])){if(_0x434349[_0xd9ac('0x5e')]&&queues[_0x434349[_0xd9ac('0x5e')]]){queues[_0x434349[_0xd9ac('0x5e')]][_0xd9ac('0x1e')]=0x1;queues[_0x434349[_0xd9ac('0x56')]]=_[_0xd9ac('0x55')](queues[_0x434349[_0xd9ac('0x5e')]]);queues[_0x434349[_0xd9ac('0x56')]][_0xd9ac('0xe')]=_0x434349[_0xd9ac('0x56')];queues[_0x434349[_0xd9ac('0x56')]][_0xd9ac('0x1e')]=0x2;queues[_0x434349['transfertargetuniqueid']]['calleridnum']=queues[_0x434349['origtransfererlinkedid']]['calleridnum'];queues[_0x434349[_0xd9ac('0x56')]][_0xd9ac('0x58')]=queues[_0x434349[_0xd9ac('0x53')]][_0xd9ac('0x58')];queues[_0x434349['transfertargetuniqueid']][_0xd9ac('0x36')]=utils[_0xd9ac('0x18')]();queues[_0x434349[_0xd9ac('0x56')]]['queuecallerleaveAt']=utils[_0xd9ac('0x18')]();queues[_0x434349[_0xd9ac('0x56')]][_0xd9ac('0x34')]=0x0;queues[_0x434349['transfertargetuniqueid']]['mohtime']=0x0;utils['info'](util['format'](_0xd9ac('0x5f'),_0x434349['origtransfereruniqueid'],queues[_0x434349['transfertargetuniqueid']]['name'],queues[_0x434349[_0xd9ac('0x56')]]['transfereduniqueid'],queues[_0x434349[_0xd9ac('0x56')]][_0xd9ac('0x57')],queues[_0x434349['transfertargetuniqueid']][_0xd9ac('0x58')]));}else{utils[_0xd9ac('0x1a')](util[_0xd9ac('0x3')](_0xd9ac('0x5b'),_0x434349['origtransfereruniqueid'],queues[_0x434349['secondtransfererlinkedid']][_0xd9ac('0x1c')],_0x434349[_0xd9ac('0x53')]));queues[_0x434349[_0xd9ac('0x4e')]][_0xd9ac('0xe')]=_0x434349[_0xd9ac('0x53')];}}}}catch(_0x59d969){utils[_0xd9ac('0x13')](util[_0xd9ac('0x3')](_0xd9ac('0x4c'),_0x434349['origtransfereruniqueid']),_0x59d969);}};exports[_0xd9ac('0x60')]=function(_0x103b24){try{if(!_[_0xd9ac('0x14')](queues[_0x103b24[_0xd9ac('0x5')]])){utils['debug'](util[_0xd9ac('0x3')](_0xd9ac('0x61'),_0x103b24[_0xd9ac('0x5')]),_0x103b24);queues[_0x103b24['uniqueid']][_0xd9ac('0x62')]=utils['now']();utils['info'](util[_0xd9ac('0x3')](_0xd9ac('0x63'),_0x103b24['uniqueid'],queues[_0x103b24[_0xd9ac('0x5')]][_0xd9ac('0x1c')],queues[_0x103b24[_0xd9ac('0x5')]][_0xd9ac('0x62')]));}}catch(_0x451f3e){utils['error'](util[_0xd9ac('0x3')]('[%s][queues][musiconholdstart]',_0x103b24[_0xd9ac('0x5')]),_0x451f3e);}};exports['musiconholdstop']=function(_0x2f56c3){try{if(!_[_0xd9ac('0x14')](queues[_0x2f56c3[_0xd9ac('0x5')]])){if(!_[_0xd9ac('0x14')](queues[_0x2f56c3[_0xd9ac('0x5')]]['musiconholdstartAt'])){utils[_0xd9ac('0x10')](util[_0xd9ac('0x3')]('[%s][queues][musiconholdstop]',_0x2f56c3['uniqueid']),_0x2f56c3);queues[_0x2f56c3[_0xd9ac('0x5')]][_0xd9ac('0x59')]+=utils['diffTime'](utils['now'](),queues[_0x2f56c3[_0xd9ac('0x5')]][_0xd9ac('0x62')]);utils[_0xd9ac('0x1a')](util['format'](_0xd9ac('0x64'),_0x2f56c3[_0xd9ac('0x5')],queues[_0x2f56c3[_0xd9ac('0x5')]][_0xd9ac('0x1c')],queues[_0x2f56c3[_0xd9ac('0x5')]][_0xd9ac('0x59')]));delete queues[_0x2f56c3[_0xd9ac('0x5')]][_0xd9ac('0x62')];}}}catch(_0x1b4d91){utils[_0xd9ac('0x13')](util['format']('[%s][queues][musiconholdstop]',_0x2f56c3[_0xd9ac('0x5')]),_0x1b4d91);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 5d5385f..35c901b 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 _0xe16a=['.wav49','.WAV','find','monitors','hangup','[%s][recordings][hangup]','calleridname','cause-txt','calleridnum','connectedlinenum','connectedlinename','type','outbound','clone','newexten','[%s][recordings][newexten]','application','toLowerCase','set','startsWith','appdata','cdr','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','util','info','format','[%s][recordings][writeDB]','uniqueid','accountcode','getUserByInternal','membername','UserId','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','exten','context','channel','error','newstate','[%s][recordings][newstate]','isNil','channelstate','linkedid','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value'];(function(_0xca3ce9,_0x427378){var _0xf4e55b=function(_0x3d5a7e){while(--_0x3d5a7e){_0xca3ce9['push'](_0xca3ce9['shift']());}};_0xf4e55b(++_0x427378);}(_0xe16a,0x185));var _0xae16=function(_0x25c620,_0x566694){_0x25c620=_0x25c620-0x0;var _0x2bb028=_0xe16a[_0x25c620];return _0x2bb028;};'use strict';var _=require('lodash');var util=require(_0xae16('0x0'));var utils=require('./utils');var recordings={};function writeDB(_0x292bb7){utils[_0xae16('0x1')](util[_0xae16('0x2')](_0xae16('0x3'),_0x292bb7[_0xae16('0x4')]));if(_0x292bb7[_0xae16('0x5')]){utils[_0xae16('0x6')](_0x292bb7[_0xae16('0x5')])['then'](function(_0x154400){if(_0x154400){_0x292bb7[_0xae16('0x7')]=_0x154400['name'];_0x292bb7[_0xae16('0x8')]=_0x154400['id'];}utils[_0xae16('0x9')](_0xae16('0xa'),_0x292bb7);});}else{utils['request']('CreateVoiceRecording',_0x292bb7);}}exports[_0xae16('0xb')]=function(_0x32c695){try{utils[_0xae16('0xc')](util['format']('[%s][recordings][newchannel]',_0x32c695[_0xae16('0x4')]),_0x32c695);if(_0x32c695[_0xae16('0x4')]==_0x32c695['linkedid']){utils[_0xae16('0x1')](util[_0xae16('0x2')](_0xae16('0xd'),_0x32c695[_0xae16('0x4')],_0x32c695['context'],_0x32c695[_0xae16('0xe')]));recordings[_0x32c695['uniqueid']]={'uniqueid':_0x32c695['uniqueid'],'accountcode':_0x32c695[_0xae16('0x5')],'exten':_0x32c695[_0xae16('0xe')],'context':_0x32c695[_0xae16('0xf')],'channel':_0x32c695[_0xae16('0x10')],'monitors':[]};}}catch(_0x3206f5){utils[_0xae16('0x11')](util[_0xae16('0x2')]('[%s][recordings][newchannel]',_0x32c695[_0xae16('0x4')]),_0x3206f5);}};exports[_0xae16('0x12')]=function(_0x31a30d){try{utils[_0xae16('0xc')](util[_0xae16('0x2')](_0xae16('0x13'),_0x31a30d[_0xae16('0x4')]),_0x31a30d);if(!_[_0xae16('0x14')](recordings[_0x31a30d[_0xae16('0x4')]])&&_0x31a30d[_0xae16('0x15')]==0x6){utils[_0xae16('0x1')](util[_0xae16('0x2')]('[%s][recordings][newstate]\x20context:%s\x20channel:%s',_0x31a30d[_0xae16('0x4')],_0x31a30d[_0xae16('0xf')],_0x31a30d['channel']));}else if(!_[_0xae16('0x14')](recordings[_0x31a30d[_0xae16('0x16')]])&&_0x31a30d[_0xae16('0x15')]==0x6&&_0x31a30d['context']!=_0xae16('0x17')){utils[_0xae16('0x1')](util[_0xae16('0x2')](_0xae16('0x18'),_0x31a30d[_0xae16('0x4')],_0x31a30d[_0xae16('0x16')],_0x31a30d['context'],_0x31a30d[_0xae16('0x10')]));recordings[_0x31a30d[_0xae16('0x16')]][_0xae16('0x5')]=_0x31a30d['accountcode'];}}catch(_0x15913a){utils['error'](util[_0xae16('0x2')]('[%s][recordings][newstate]',_0x31a30d[_0xae16('0x4')]),_0x15913a);}};exports[_0xae16('0x19')]=function(_0x5b4017){try{if(!_[_0xae16('0x14')](_0x5b4017[_0xae16('0x1a')])&&!_[_0xae16('0x14')](_0x5b4017[_0xae16('0x1a')][_0xae16('0x1b')])){utils['debug'](util['format'](_0xae16('0x1c'),_0x5b4017[_0xae16('0x4')]),_0x5b4017);utils['info'](util[_0xae16('0x2')](_0xae16('0x1d'),_0x5b4017[_0xae16('0x4')],_0x5b4017['variable'],_0x5b4017[_0xae16('0x1e')]));if(_['endsWith'](_0x5b4017[_0xae16('0x1e')],'.wav49')){_0x5b4017[_0xae16('0x1e')]=_0x5b4017[_0xae16('0x1e')]['replace'](_0xae16('0x1f'),_0xae16('0x20'));}if(recordings[_0x5b4017[_0xae16('0x16')]]){var _0xde052a=_[_0xae16('0x21')](recordings[_0x5b4017[_0xae16('0x16')]][_0xae16('0x22')],{'value':_0x5b4017[_0xae16('0x1e')]});if(_[_0xae16('0x14')](_0xde052a)){recordings[_0x5b4017[_0xae16('0x16')]]['monitors']['push']({'value':_0x5b4017[_0xae16('0x1e')]});}}}}catch(_0x54fd9f){utils[_0xae16('0x11')](util[_0xae16('0x2')]('[%s][recordings][varset]',_0x5b4017[_0xae16('0x4')]),_0x54fd9f);}};exports[_0xae16('0x23')]=function(_0x32bf94){try{if(!_[_0xae16('0x14')](recordings[_0x32bf94[_0xae16('0x4')]])){utils['debug'](util['format'](_0xae16('0x24'),_0x32bf94['uniqueid']),_0x32bf94);utils[_0xae16('0x1')](util[_0xae16('0x2')]('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x32bf94['uniqueid'],_0x32bf94['calleridnum'],_0x32bf94[_0xae16('0x25')],_0x32bf94[_0xae16('0x26')]));recordings[_0x32bf94['uniqueid']][_0xae16('0x27')]=_0x32bf94['calleridnum'];recordings[_0x32bf94[_0xae16('0x4')]][_0xae16('0x25')]=_0x32bf94['calleridname'];recordings[_0x32bf94['uniqueid']]['connectedlinenum']=_0x32bf94[_0xae16('0x28')];recordings[_0x32bf94['uniqueid']][_0xae16('0x29')]=_0x32bf94[_0xae16('0x29')];if(recordings[_0x32bf94['uniqueid']][_0xae16('0x2a')]==_0xae16('0x2b')&&recordings[_0x32bf94[_0xae16('0x4')]][_0xae16('0x5')]){recordings[_0x32bf94['uniqueid']][_0xae16('0x28')]=recordings[_0x32bf94['uniqueid']][_0xae16('0x5')];recordings[_0x32bf94[_0xae16('0x4')]][_0xae16('0x29')]='';}recordings[_0x32bf94['uniqueid']][_0xae16('0x22')]['forEach'](function(_0x4a8c76){var _0x132184=_[_0xae16('0x2c')](recordings[_0x32bf94[_0xae16('0x4')]]);_0x132184[_0xae16('0x1e')]=_0x4a8c76[_0xae16('0x1e')];writeDB(_0x132184);});delete recordings[_0x32bf94['uniqueid']];}}catch(_0x26dd93){utils[_0xae16('0x11')](util['format'](_0xae16('0x24'),_0x32bf94['uniqueid']),_0x26dd93);}};exports[_0xae16('0x2d')]=function(_0x2923f){try{if(!_[_0xae16('0x14')](recordings[_0x2923f[_0xae16('0x4')]])){utils['debug'](util['format'](_0xae16('0x2e'),_0x2923f[_0xae16('0x4')]),_0x2923f);utils[_0xae16('0x1')](util[_0xae16('0x2')]('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x2923f['uniqueid'],_0x2923f[_0xae16('0x2f')],_0x2923f['appdata']));if(_0x2923f['application'][_0xae16('0x30')]()==_0xae16('0x31')&&_[_0xae16('0x32')](_0x2923f[_0xae16('0x33')][_0xae16('0x30')](),_0xae16('0x34'))){var _0x1cae14=_0x2923f['appdata'][_0xae16('0x35')]('=');var _0x59713f=_0x1cae14[0x0][_0xae16('0x36')](_0x1cae14[0x0][_0xae16('0x37')]('(')+0x1,_0x1cae14[0x0][_0xae16('0x37')](')'));var _0xcfa129=_0x1cae14[0x1];recordings[_0x2923f[_0xae16('0x4')]][_0x59713f]=_0xcfa129;}}}catch(_0x50e264){utils['error'](util['format'](_0xae16('0x2e'),_0x2923f[_0xae16('0x4')]),_0x50e264);}};exports[_0xae16('0x38')]=function(_0x390d55){try{if(!_[_0xae16('0x14')](recordings[_0x390d55[_0xae16('0x4')]])){utils['debug'](util[_0xae16('0x2')](_0xae16('0x39'),_0x390d55[_0xae16('0x4')]),_0x390d55);utils[_0xae16('0x1')](util[_0xae16('0x2')](_0xae16('0x3a'),_0x390d55[_0xae16('0x4')],_0x390d55[_0xae16('0x3b')]));recordings[_0x390d55[_0xae16('0x4')]][_0xae16('0x3b')]=_0x390d55[_0xae16('0x3b')];}}catch(_0x1e9f42){utils[_0xae16('0x11')](util[_0xae16('0x2')]('[%s][recordings][queuecallerjoin]',_0x390d55[_0xae16('0x4')]),_0x1e9f42);}}; \ No newline at end of file +var _0x7dad=['push','[%s][recordings][varset]','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','connectedlinenum','connectedlinename','type','forEach','clone','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','appdata','application','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','./utils','info','format','uniqueid','accountcode','then','membername','request','CreateVoiceRecording','debug','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','exten','context','channel','error','[%s][recordings][newchannel]','newstate','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','mixmonitor_filename','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','replace','.WAV','monitors'];(function(_0x35228c,_0x1e6824){var _0x56b5c0=function(_0x11886f){while(--_0x11886f){_0x35228c['push'](_0x35228c['shift']());}};_0x56b5c0(++_0x1e6824);}(_0x7dad,0x18f));var _0xd7da=function(_0x2858d3,_0x547bd){_0x2858d3=_0x2858d3-0x0;var _0x1c2657=_0x7dad[_0x2858d3];return _0x1c2657;};'use strict';var _=require(_0xd7da('0x0'));var util=require(_0xd7da('0x1'));var utils=require(_0xd7da('0x2'));var recordings={};function writeDB(_0x21f89c){utils[_0xd7da('0x3')](util[_0xd7da('0x4')]('[%s][recordings][writeDB]',_0x21f89c[_0xd7da('0x5')]));if(_0x21f89c[_0xd7da('0x6')]){utils['getUserByInternal'](_0x21f89c['accountcode'])[_0xd7da('0x7')](function(_0x46f5b5){if(_0x46f5b5){_0x21f89c[_0xd7da('0x8')]=_0x46f5b5['name'];_0x21f89c['UserId']=_0x46f5b5['id'];}utils[_0xd7da('0x9')]('CreateVoiceRecording',_0x21f89c);});}else{utils[_0xd7da('0x9')](_0xd7da('0xa'),_0x21f89c);}}exports['newchannel']=function(_0x4ad6a3){try{utils[_0xd7da('0xb')](util[_0xd7da('0x4')]('[%s][recordings][newchannel]',_0x4ad6a3[_0xd7da('0x5')]),_0x4ad6a3);if(_0x4ad6a3[_0xd7da('0x5')]==_0x4ad6a3[_0xd7da('0xc')]){utils[_0xd7da('0x3')](util[_0xd7da('0x4')](_0xd7da('0xd'),_0x4ad6a3[_0xd7da('0x5')],_0x4ad6a3['context'],_0x4ad6a3[_0xd7da('0xe')]));recordings[_0x4ad6a3[_0xd7da('0x5')]]={'uniqueid':_0x4ad6a3[_0xd7da('0x5')],'accountcode':_0x4ad6a3[_0xd7da('0x6')],'exten':_0x4ad6a3[_0xd7da('0xe')],'context':_0x4ad6a3[_0xd7da('0xf')],'channel':_0x4ad6a3[_0xd7da('0x10')],'monitors':[]};}}catch(_0x59fbf6){utils[_0xd7da('0x11')](util[_0xd7da('0x4')](_0xd7da('0x12'),_0x4ad6a3['uniqueid']),_0x59fbf6);}};exports[_0xd7da('0x13')]=function(_0x28dcc8){try{utils['debug'](util[_0xd7da('0x4')](_0xd7da('0x14'),_0x28dcc8[_0xd7da('0x5')]),_0x28dcc8);if(!_[_0xd7da('0x15')](recordings[_0x28dcc8[_0xd7da('0x5')]])&&_0x28dcc8[_0xd7da('0x16')]==0x6){utils['info'](util['format'](_0xd7da('0x17'),_0x28dcc8['uniqueid'],_0x28dcc8[_0xd7da('0xf')],_0x28dcc8[_0xd7da('0x10')]));}else if(!_['isNil'](recordings[_0x28dcc8[_0xd7da('0xc')]])&&_0x28dcc8[_0xd7da('0x16')]==0x6&&_0x28dcc8[_0xd7da('0xf')]!='transfer'){utils[_0xd7da('0x3')](util[_0xd7da('0x4')](_0xd7da('0x18'),_0x28dcc8[_0xd7da('0x5')],_0x28dcc8['linkedid'],_0x28dcc8['context'],_0x28dcc8[_0xd7da('0x10')]));recordings[_0x28dcc8[_0xd7da('0xc')]]['accountcode']=_0x28dcc8[_0xd7da('0x6')];}}catch(_0x173a19){utils[_0xd7da('0x11')](util['format'](_0xd7da('0x14'),_0x28dcc8['uniqueid']),_0x173a19);}};exports[_0xd7da('0x19')]=function(_0x3dc5bc){try{if(!_[_0xd7da('0x15')](_0x3dc5bc[_0xd7da('0x1a')])&&!_[_0xd7da('0x15')](_0x3dc5bc[_0xd7da('0x1a')][_0xd7da('0x1b')])){utils[_0xd7da('0xb')](util[_0xd7da('0x4')]('[%s][recordings][varset]',_0x3dc5bc[_0xd7da('0x5')]),_0x3dc5bc);utils[_0xd7da('0x3')](util[_0xd7da('0x4')](_0xd7da('0x1c'),_0x3dc5bc['uniqueid'],_0x3dc5bc[_0xd7da('0x1a')],_0x3dc5bc[_0xd7da('0x1d')]));if(_[_0xd7da('0x1e')](_0x3dc5bc[_0xd7da('0x1d')],_0xd7da('0x1f'))){_0x3dc5bc[_0xd7da('0x1d')]=_0x3dc5bc[_0xd7da('0x1d')][_0xd7da('0x20')](_0xd7da('0x1f'),_0xd7da('0x21'));}if(recordings[_0x3dc5bc[_0xd7da('0xc')]]){var _0x1d7e51=_['find'](recordings[_0x3dc5bc[_0xd7da('0xc')]][_0xd7da('0x22')],{'value':_0x3dc5bc[_0xd7da('0x1d')]});if(_[_0xd7da('0x15')](_0x1d7e51)){recordings[_0x3dc5bc[_0xd7da('0xc')]][_0xd7da('0x22')][_0xd7da('0x23')]({'value':_0x3dc5bc['value']});}}}}catch(_0x4145f0){utils[_0xd7da('0x11')](util['format'](_0xd7da('0x24'),_0x3dc5bc[_0xd7da('0x5')]),_0x4145f0);}};exports[_0xd7da('0x25')]=function(_0xd238a3){try{if(!_[_0xd7da('0x15')](recordings[_0xd238a3['uniqueid']])){utils[_0xd7da('0xb')](util[_0xd7da('0x4')](_0xd7da('0x26'),_0xd238a3[_0xd7da('0x5')]),_0xd238a3);utils['info'](util[_0xd7da('0x4')](_0xd7da('0x27'),_0xd238a3[_0xd7da('0x5')],_0xd238a3[_0xd7da('0x28')],_0xd238a3[_0xd7da('0x29')],_0xd238a3['cause-txt']));recordings[_0xd238a3[_0xd7da('0x5')]][_0xd7da('0x28')]=_0xd238a3[_0xd7da('0x28')];recordings[_0xd238a3[_0xd7da('0x5')]][_0xd7da('0x29')]=_0xd238a3[_0xd7da('0x29')];recordings[_0xd238a3['uniqueid']][_0xd7da('0x2a')]=_0xd238a3[_0xd7da('0x2a')];recordings[_0xd238a3['uniqueid']][_0xd7da('0x2b')]=_0xd238a3['connectedlinename'];if(recordings[_0xd238a3['uniqueid']][_0xd7da('0x2c')]=='outbound'&&recordings[_0xd238a3['uniqueid']]['accountcode']){recordings[_0xd238a3[_0xd7da('0x5')]][_0xd7da('0x2a')]=recordings[_0xd238a3[_0xd7da('0x5')]][_0xd7da('0x6')];recordings[_0xd238a3[_0xd7da('0x5')]]['connectedlinename']='';}recordings[_0xd238a3[_0xd7da('0x5')]]['monitors'][_0xd7da('0x2d')](function(_0x1333b8){var _0x261345=_[_0xd7da('0x2e')](recordings[_0xd238a3[_0xd7da('0x5')]]);_0x261345[_0xd7da('0x1d')]=_0x1333b8[_0xd7da('0x1d')];writeDB(_0x261345);});delete recordings[_0xd238a3['uniqueid']];}}catch(_0x4a9678){utils[_0xd7da('0x11')](util[_0xd7da('0x4')](_0xd7da('0x26'),_0xd238a3['uniqueid']),_0x4a9678);}};exports['newexten']=function(_0xb797a5){try{if(!_[_0xd7da('0x15')](recordings[_0xb797a5[_0xd7da('0x5')]])){utils[_0xd7da('0xb')](util['format'](_0xd7da('0x2f'),_0xb797a5[_0xd7da('0x5')]),_0xb797a5);utils[_0xd7da('0x3')](util['format'](_0xd7da('0x30'),_0xb797a5['uniqueid'],_0xb797a5['application'],_0xb797a5[_0xd7da('0x31')]));if(_0xb797a5[_0xd7da('0x32')][_0xd7da('0x33')]()==_0xd7da('0x34')&&_[_0xd7da('0x35')](_0xb797a5[_0xd7da('0x31')][_0xd7da('0x33')](),_0xd7da('0x36'))){var _0x268ace=_0xb797a5[_0xd7da('0x31')][_0xd7da('0x37')]('=');var _0x2de9ec=_0x268ace[0x0][_0xd7da('0x38')](_0x268ace[0x0][_0xd7da('0x39')]('(')+0x1,_0x268ace[0x0][_0xd7da('0x39')](')'));var _0x55c11d=_0x268ace[0x1];recordings[_0xb797a5['uniqueid']][_0x2de9ec]=_0x55c11d;}}}catch(_0x4096fa){utils[_0xd7da('0x11')](util[_0xd7da('0x4')]('[%s][recordings][newexten]',_0xb797a5[_0xd7da('0x5')]),_0x4096fa);}};exports[_0xd7da('0x3a')]=function(_0x3b7e3a){try{if(!_[_0xd7da('0x15')](recordings[_0x3b7e3a[_0xd7da('0x5')]])){utils[_0xd7da('0xb')](util['format'](_0xd7da('0x3b'),_0x3b7e3a[_0xd7da('0x5')]),_0x3b7e3a);utils[_0xd7da('0x3')](util['format'](_0xd7da('0x3c'),_0x3b7e3a[_0xd7da('0x5')],_0x3b7e3a[_0xd7da('0x3d')]));recordings[_0x3b7e3a[_0xd7da('0x5')]][_0xd7da('0x3d')]=_0x3b7e3a[_0xd7da('0x3d')];}}catch(_0x1c817a){utils[_0xd7da('0x11')](util[_0xd7da('0x4')]('[%s][recordings][queuecallerjoin]',_0x3b7e3a[_0xd7da('0x5')]),_0x1c817a);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index b179e28..70139a8 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 _0xd189=['util','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','attended','origtransfereruniqueid','uniqueid','type','request','CreateVoiceTransferReport','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridname','transfereecalleridname','blind','attendedtransfer','debug','[%s][transfers][attendedtransfer]','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransfererexten','isNil','transfereechannel','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetexten','transfertargetlinkedid','error','lodash'];(function(_0x4db3c4,_0x35fdb0){var _0x773cf5=function(_0x379472){while(--_0x379472){_0x4db3c4['push'](_0x4db3c4['shift']());}};_0x773cf5(++_0x35fdb0);}(_0xd189,0x9f));var _0x9d18=function(_0x260c08,_0x165187){_0x260c08=_0x260c08-0x0;var _0x408add=_0xd189[_0x260c08];return _0x408add;};'use strict';var _=require(_0x9d18('0x0'));var util=require(_0x9d18('0x1'));var utils=require(_0x9d18('0x2'));function writeDB(_0x286919){utils[_0x9d18('0x3')](util[_0x9d18('0x4')](_0x9d18('0x5'),_0x286919['type']===_0x9d18('0x6')?_0x286919[_0x9d18('0x7')]:_0x286919[_0x9d18('0x8')],_0x286919[_0x9d18('0x9')]));utils[_0x9d18('0xa')](_0x9d18('0xb'),_0x286919);}exports['blindtransfer']=function(_0x58926e){try{utils['debug'](util[_0x9d18('0x4')](_0x9d18('0xc'),_0x58926e[_0x9d18('0x8')]),_0x58926e);utils[_0x9d18('0x3')](util['format'](_0x9d18('0xd'),_0x58926e['uniqueid'],_0x58926e['transferercalleridnum'],_0x58926e[_0x9d18('0xe')],_0x58926e['transfereecalleridnum'],_0x58926e[_0x9d18('0xf')]));_0x58926e['type']=_0x9d18('0x10');writeDB(_0x58926e);}catch(_0x5d021a){utils['error'](util[_0x9d18('0x4')](_0x9d18('0xc'),_0x58926e[_0x9d18('0x8')]),_0x5d021a);}};exports[_0x9d18('0x11')]=function(_0x40c16b){try{utils[_0x9d18('0x12')](util['format'](_0x9d18('0x13'),_0x40c16b[_0x9d18('0x7')]),_0x40c16b);utils['info'](util[_0x9d18('0x4')]('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x40c16b[_0x9d18('0x7')],_0x40c16b[_0x9d18('0x14')],_0x40c16b[_0x9d18('0x15')],_0x40c16b[_0x9d18('0x16')],_0x40c16b[_0x9d18('0x17')]));_0x40c16b=_[_0x9d18('0x18')](_0x40c16b,{'transfererchannel':_0x40c16b[_0x9d18('0x19')],'transferercalleridnum':_0x40c16b[_0x9d18('0x14')],'transferercalleridname':_0x40c16b[_0x9d18('0x15')],'transfererconnectedlinenum':_0x40c16b[_0x9d18('0x1a')],'transfererconnectedlinename':_0x40c16b['secondtransfererconnectedlinename'],'transfereraccountcode':_0x40c16b[_0x9d18('0x1b')],'transferercontext':_0x40c16b[_0x9d18('0x1c')],'transfererexten':_0x40c16b[_0x9d18('0x1d')],'transfererlinkedid':_0x40c16b[_0x9d18('0x1e')],'context':_0x40c16b['origtransferercontext'],'extension':_0x40c16b[_0x9d18('0x1f')],'type':_0x9d18('0x6')});if(_[_0x9d18('0x20')](_0x40c16b[_0x9d18('0x21')])){_0x40c16b=_['assign'](_0x40c16b,{'transfereechannel':_0x40c16b[_0x9d18('0x22')],'transfereecalleridnum':_0x40c16b[_0x9d18('0x16')],'transfereecalleridname':_0x40c16b[_0x9d18('0x17')],'transfereeconnectedlinenum':_0x40c16b[_0x9d18('0x23')],'transfereeconnectedlinename':_0x40c16b[_0x9d18('0x24')],'transfereeaccountcode':_0x40c16b['transfertargetaccountcode'],'transfereecontext':_0x40c16b['transfertargetcontext'],'transfereeexten':_0x40c16b[_0x9d18('0x25')],'transfereelinkedid':_0x40c16b[_0x9d18('0x26')]});}writeDB(_0x40c16b);}catch(_0x5d8039){utils[_0x9d18('0x27')](util[_0x9d18('0x4')](_0x9d18('0x13'),_0x40c16b['origtransfereruniqueid']),_0x5d8039);}}; \ No newline at end of file +var _0x8ee9=['debug','transferercalleridnum','transferercalleridname','transfereecalleridname','blind','error','origtransferercalleridnum','transfertargetcalleridname','origtransfererchannel','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransferercontext','origtransfererlinkedid','origtransfererexten','attended','transfereechannel','assign','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','lodash','util','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','origtransfereruniqueid','uniqueid','type','request','CreateVoiceTransferReport','blindtransfer'];(function(_0x2fe15c,_0x48713a){var _0x26ec58=function(_0x3e475a){while(--_0x3e475a){_0x2fe15c['push'](_0x2fe15c['shift']());}};_0x26ec58(++_0x48713a);}(_0x8ee9,0xc0));var _0x98ee=function(_0x30a88c,_0x57707d){_0x30a88c=_0x30a88c-0x0;var _0xbe2f0=_0x8ee9[_0x30a88c];return _0xbe2f0;};'use strict';var _=require(_0x98ee('0x0'));var util=require(_0x98ee('0x1'));var utils=require(_0x98ee('0x2'));function writeDB(_0x178633){utils[_0x98ee('0x3')](util[_0x98ee('0x4')](_0x98ee('0x5'),_0x178633['type']==='attended'?_0x178633[_0x98ee('0x6')]:_0x178633[_0x98ee('0x7')],_0x178633[_0x98ee('0x8')]));utils[_0x98ee('0x9')](_0x98ee('0xa'),_0x178633);}exports[_0x98ee('0xb')]=function(_0x3cd067){try{utils[_0x98ee('0xc')](util[_0x98ee('0x4')]('[%s][transfers][blindtransfer]',_0x3cd067[_0x98ee('0x7')]),_0x3cd067);utils[_0x98ee('0x3')](util[_0x98ee('0x4')]('[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x3cd067[_0x98ee('0x7')],_0x3cd067[_0x98ee('0xd')],_0x3cd067[_0x98ee('0xe')],_0x3cd067['transfereecalleridnum'],_0x3cd067[_0x98ee('0xf')]));_0x3cd067[_0x98ee('0x8')]=_0x98ee('0x10');writeDB(_0x3cd067);}catch(_0x17a7bc){utils[_0x98ee('0x11')](util['format']('[%s][transfers][blindtransfer]',_0x3cd067[_0x98ee('0x7')]),_0x17a7bc);}};exports['attendedtransfer']=function(_0x4648a8){try{utils[_0x98ee('0xc')](util['format']('[%s][transfers][attendedtransfer]',_0x4648a8[_0x98ee('0x6')]),_0x4648a8);utils[_0x98ee('0x3')](util['format']('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x4648a8[_0x98ee('0x6')],_0x4648a8[_0x98ee('0x12')],_0x4648a8['origtransferercalleridname'],_0x4648a8['transfertargetcalleridnum'],_0x4648a8[_0x98ee('0x13')]));_0x4648a8=_['assign'](_0x4648a8,{'transfererchannel':_0x4648a8[_0x98ee('0x14')],'transferercalleridnum':_0x4648a8['origtransferercalleridnum'],'transferercalleridname':_0x4648a8['origtransferercalleridname'],'transfererconnectedlinenum':_0x4648a8[_0x98ee('0x15')],'transfererconnectedlinename':_0x4648a8['secondtransfererconnectedlinename'],'transfereraccountcode':_0x4648a8[_0x98ee('0x16')],'transferercontext':_0x4648a8[_0x98ee('0x17')],'transfererexten':_0x4648a8['secondtransfererexten'],'transfererlinkedid':_0x4648a8[_0x98ee('0x18')],'context':_0x4648a8['origtransferercontext'],'extension':_0x4648a8[_0x98ee('0x19')],'type':_0x98ee('0x1a')});if(_['isNil'](_0x4648a8[_0x98ee('0x1b')])){_0x4648a8=_[_0x98ee('0x1c')](_0x4648a8,{'transfereechannel':_0x4648a8[_0x98ee('0x1d')],'transfereecalleridnum':_0x4648a8['transfertargetcalleridnum'],'transfereecalleridname':_0x4648a8['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x4648a8[_0x98ee('0x1e')],'transfereeconnectedlinename':_0x4648a8[_0x98ee('0x1f')],'transfereeaccountcode':_0x4648a8[_0x98ee('0x20')],'transfereecontext':_0x4648a8[_0x98ee('0x21')],'transfereeexten':_0x4648a8['transfertargetexten'],'transfereelinkedid':_0x4648a8['transfertargetlinkedid']});}writeDB(_0x4648a8);}catch(_0x44ba0a){utils[_0x98ee('0x11')](util['format']('[%s][transfers][attendedtransfer]',_0x4648a8['origtransfereruniqueid']),_0x44ba0a);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index b9a95fc..e8d99f1 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 _0x3c81=['GetVoiceQueue','type','acw','acwTimeout','addTime','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diff','sumTime','now','isAfter','isBefore','bluebird','jayson/promise','util','client','http','../../config/logger','debug','inspect','error','request','catch','[utils][request]\x20name:%s','GetUser','internal','name','[utils][getUser]\x20where:%s','stringify','result','length','getUserByInternal','info','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','[utils][getUserByInternal]','getUserByInterface','then','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]'];(function(_0x2eb8d5,_0x286712){var _0xc6e6cf=function(_0x372d1e){while(--_0x372d1e){_0x2eb8d5['push'](_0x2eb8d5['shift']());}};_0xc6e6cf(++_0x286712);}(_0x3c81,0x1e5));var _0x13c8=function(_0x15417d,_0x2fc6fb){_0x15417d=_0x15417d-0x0;var _0x43b3f8=_0x3c81[_0x15417d];return _0x43b3f8;};'use strict';var BPromise=require(_0x13c8('0x0'));var jayson=require(_0x13c8('0x1'));var moment=require('moment');var util=require(_0x13c8('0x2'));var client=jayson[_0x13c8('0x3')][_0x13c8('0x4')]({'port':0x2329});var logger=require(_0x13c8('0x5'))('xdr');exports['info']=function(_0x1a652a,_0x37195b){logger['info'](_0x1a652a,_0x37195b?util['inspect'](_0x37195b,{'showHidden':![],'depth':null}):'');};exports[_0x13c8('0x6')]=function(_0x1867c8,_0x35c35f){logger[_0x13c8('0x6')](_0x1867c8,_0x35c35f?util[_0x13c8('0x7')](_0x35c35f,{'showHidden':![],'depth':null}):'');};exports[_0x13c8('0x8')]=function(_0x29a5dd,_0x2bce6c){logger[_0x13c8('0x8')](_0x29a5dd,_0x2bce6c?util[_0x13c8('0x7')](_0x2bce6c,{'showHidden':![],'depth':null}):'');};exports[_0x13c8('0x9')]=function(_0x2fc7c6,_0x1a5492){return client[_0x13c8('0x9')](_0x2fc7c6,{'body':_0x1a5492})['then'](function(_0x1005b9){logger['debug']('[utils][request]\x20name:%s',_0x2fc7c6,_0x1005b9?util[_0x13c8('0x7')](_0x1005b9,{'showHidden':![],'depth':null}):'');})[_0x13c8('0xa')](function(_0x1fd13d){logger[_0x13c8('0x8')](_0x13c8('0xb'),_0x2fc7c6,_0x1fd13d?util['inspect'](_0x1fd13d,{'showHidden':![],'depth':null}):'');});};function getUser(_0x4b3836){return client[_0x13c8('0x9')](_0x13c8('0xc'),{'options':{'raw':!![],'attributes':['id',_0x13c8('0xd'),_0x13c8('0xe'),'interface'],'where':_0x4b3836,'limit':0x1}})['then'](function(_0x37f7cc){logger[_0x13c8('0x6')](_0x13c8('0xf'),JSON[_0x13c8('0x10')](_0x4b3836),_0x37f7cc?util[_0x13c8('0x7')](_0x37f7cc,{'showHidden':![],'depth':null}):'');return _0x37f7cc[_0x13c8('0x11')][_0x13c8('0x12')]?_0x37f7cc[_0x13c8('0x11')][0x0]:null;});}exports[_0x13c8('0x13')]=function(_0x3f202d){return new BPromise(function(_0x1fc78a,_0x5567a6){if(_0x3f202d){return getUser({'internal':_0x3f202d})['then'](function(_0x36a52d){logger[_0x13c8('0x14')](_0x13c8('0x15'),_0x3f202d,_0x36a52d?_0x13c8('0x16'):_0x13c8('0x17'));return _0x1fc78a(_0x36a52d);})[_0x13c8('0xa')](function(_0x4b38ca){logger[_0x13c8('0x8')](_0x13c8('0x18'),_0x4b38ca?util[_0x13c8('0x7')](_0x4b38ca,{'showHidden':![],'depth':null}):'');return _0x1fc78a(null);});}return _0x1fc78a(null);});};exports[_0x13c8('0x19')]=function(_0x42abed){return new BPromise(function(_0x22889e,_0x2a0c2f){if(_0x42abed){return getUser({'interface':_0x42abed})[_0x13c8('0x1a')](function(_0x50d0af){logger[_0x13c8('0x14')](_0x13c8('0x1b'),_0x42abed,_0x50d0af?'found':_0x13c8('0x17'));return _0x22889e(_0x50d0af);})[_0x13c8('0xa')](function(_0x1281d5){logger[_0x13c8('0x8')](_0x13c8('0x1c'),_0x1281d5?util['inspect'](_0x1281d5,{'showHidden':![],'depth':null}):'');return _0x22889e(null);});}return _0x22889e(null);});};exports[_0x13c8('0x1d')]=function(_0x52393d){return new BPromise(function(_0x2113f1,_0xd02b40){if(_0x52393d){return getUser({'name':_0x52393d})[_0x13c8('0x1a')](function(_0x509133){logger[_0x13c8('0x14')](_0x13c8('0x1e'),_0x52393d,_0x509133?_0x13c8('0x16'):_0x13c8('0x17'));return _0x2113f1(_0x509133);})[_0x13c8('0xa')](function(_0x382704){logger[_0x13c8('0x8')](_0x13c8('0x1f'),_0x382704?util[_0x13c8('0x7')](_0x382704,{'showHidden':![],'depth':null}):'');return _0x2113f1(null);});}return _0x2113f1(null);});};exports['getVoiceQueueByName']=function(_0x34c11a){return new BPromise(function(_0x16d3e8,_0x16adef){if(_0x34c11a){return client['request'](_0x13c8('0x20'),{'options':{'raw':!![],'attributes':['id',_0x13c8('0xe'),_0x13c8('0x21'),_0x13c8('0x22'),_0x13c8('0x23')],'where':{'name':_0x34c11a},'limit':0x1}})[_0x13c8('0x1a')](function(_0x202a3d){logger[_0x13c8('0x6')]('[utils][getVoiceQueueByName]\x20name:%s',_0x34c11a,_0x202a3d?util['inspect'](_0x202a3d,{'showHidden':![],'depth':null}):'');logger[_0x13c8('0x14')]('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x34c11a,_0x202a3d?_0x13c8('0x16'):'notfound');return _0x16d3e8(_0x202a3d[_0x13c8('0x11')]['length']?_0x202a3d[_0x13c8('0x11')][0x0]:null);})[_0x13c8('0xa')](function(_0x557443){logger['error']('[utils][getVoiceQueueByName]',_0x557443?util[_0x13c8('0x7')](_0x557443,{'showHidden':![],'depth':null}):'');return _0x16d3e8(null);});}return _0x16d3e8(null);});};exports[_0x13c8('0x24')]=function(_0x357657,_0x40141a){return moment(_0x357657)['add'](_0x40141a,_0x13c8('0x25'))[_0x13c8('0x26')](_0x13c8('0x27'));};exports[_0x13c8('0x28')]=function(_0x7d3166,_0x1afd65){return moment(_0x7d3166)[_0x13c8('0x29')](_0x1afd65,_0x13c8('0x25'))[_0x13c8('0x26')](_0x13c8('0x27'));};exports['diffTime']=function(_0x4853bc,_0x52024a){return moment(_0x4853bc)[_0x13c8('0x2a')](moment(_0x52024a),_0x13c8('0x25'));};exports[_0x13c8('0x2b')]=function(_0xcf6edf,_0x184194){return parseInt(_0xcf6edf,0xa)+parseInt(_0x184194,0xa);};exports[_0x13c8('0x2c')]=function(){return moment()[_0x13c8('0x26')](_0x13c8('0x27'));};exports['isAfter']=function(_0x5811e9,_0x419650){if(_0x419650){return moment(_0x5811e9)[_0x13c8('0x2d')](_0x419650);}return!![];};exports[_0x13c8('0x2e')]=function(_0x152e98,_0x9d96d5){if(_0x9d96d5){return moment(_0x152e98)[_0x13c8('0x2e')](_0x9d96d5);}else if(_0x152e98){return!![];}return![];}; \ No newline at end of file +var _0xc2e3=['xdr','info','inspect','debug','error','then','[utils][request]\x20name:%s','request','interface','[utils][getUser]\x20where:%s','stringify','result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','[utils][getUserByInterface]\x20interface:%s\x20%s','catch','getVoiceQueueByName','GetVoiceQueue','name','type','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]','add','seconds','subtractTime','subtract','format','YYYY-MM-DD\x20HH:mm:ss','diffTime','diff','sumTime','now','isAfter','isBefore','bluebird','util','client','http','../../config/logger'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xc2e3,0x1f3));var _0x3c2e=function(_0x9a7bb1,_0x33e385){_0x9a7bb1=_0x9a7bb1-0x0;var _0x5c8328=_0xc2e3[_0x9a7bb1];return _0x5c8328;};'use strict';var BPromise=require(_0x3c2e('0x0'));var jayson=require('jayson/promise');var moment=require('moment');var util=require(_0x3c2e('0x1'));var client=jayson[_0x3c2e('0x2')][_0x3c2e('0x3')]({'port':0x2329});var logger=require(_0x3c2e('0x4'))(_0x3c2e('0x5'));exports['info']=function(_0x35a665,_0x3eef97){logger[_0x3c2e('0x6')](_0x35a665,_0x3eef97?util[_0x3c2e('0x7')](_0x3eef97,{'showHidden':![],'depth':null}):'');};exports[_0x3c2e('0x8')]=function(_0x51be99,_0x43763c){logger[_0x3c2e('0x8')](_0x51be99,_0x43763c?util[_0x3c2e('0x7')](_0x43763c,{'showHidden':![],'depth':null}):'');};exports[_0x3c2e('0x9')]=function(_0x4d99e5,_0x12589f){logger['error'](_0x4d99e5,_0x12589f?util[_0x3c2e('0x7')](_0x12589f,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x5c59c3,_0x3c934d){return client['request'](_0x5c59c3,{'body':_0x3c934d})[_0x3c2e('0xa')](function(_0x33ab8d){logger['debug'](_0x3c2e('0xb'),_0x5c59c3,_0x33ab8d?util[_0x3c2e('0x7')](_0x33ab8d,{'showHidden':![],'depth':null}):'');})['catch'](function(_0x98dbb){logger[_0x3c2e('0x9')](_0x3c2e('0xb'),_0x5c59c3,_0x98dbb?util[_0x3c2e('0x7')](_0x98dbb,{'showHidden':![],'depth':null}):'');});};function getUser(_0x5753b6){return client[_0x3c2e('0xc')]('GetUser',{'options':{'raw':!![],'attributes':['id','internal','name',_0x3c2e('0xd')],'where':_0x5753b6,'limit':0x1}})[_0x3c2e('0xa')](function(_0xf91824){logger[_0x3c2e('0x8')](_0x3c2e('0xe'),JSON[_0x3c2e('0xf')](_0x5753b6),_0xf91824?util[_0x3c2e('0x7')](_0xf91824,{'showHidden':![],'depth':null}):'');return _0xf91824[_0x3c2e('0x10')]['length']?_0xf91824[_0x3c2e('0x10')][0x0]:null;});}exports[_0x3c2e('0x11')]=function(_0x443809){return new BPromise(function(_0x35cb85,_0x11dd29){if(_0x443809){return getUser({'internal':_0x443809})[_0x3c2e('0xa')](function(_0x25bc74){logger[_0x3c2e('0x6')](_0x3c2e('0x12'),_0x443809,_0x25bc74?_0x3c2e('0x13'):_0x3c2e('0x14'));return _0x35cb85(_0x25bc74);})['catch'](function(_0x59ab55){logger[_0x3c2e('0x9')]('[utils][getUserByInternal]',_0x59ab55?util[_0x3c2e('0x7')](_0x59ab55,{'showHidden':![],'depth':null}):'');return _0x35cb85(null);});}return _0x35cb85(null);});};exports['getUserByInterface']=function(_0x4d3606){return new BPromise(function(_0x228d5b,_0x49e75b){if(_0x4d3606){return getUser({'interface':_0x4d3606})[_0x3c2e('0xa')](function(_0x664882){logger[_0x3c2e('0x6')](_0x3c2e('0x15'),_0x4d3606,_0x664882?_0x3c2e('0x13'):_0x3c2e('0x14'));return _0x228d5b(_0x664882);})[_0x3c2e('0x16')](function(_0x55aa1c){logger[_0x3c2e('0x9')]('[utils][getUserByInterface]',_0x55aa1c?util[_0x3c2e('0x7')](_0x55aa1c,{'showHidden':![],'depth':null}):'');return _0x228d5b(null);});}return _0x228d5b(null);});};exports['getUserByName']=function(_0x2a6778){return new BPromise(function(_0x1f4ebb,_0x245a17){if(_0x2a6778){return getUser({'name':_0x2a6778})[_0x3c2e('0xa')](function(_0x565d87){logger[_0x3c2e('0x6')]('[utils][getUserByName]\x20name:%s\x20%s',_0x2a6778,_0x565d87?'found':_0x3c2e('0x14'));return _0x1f4ebb(_0x565d87);})[_0x3c2e('0x16')](function(_0x538e2b){logger[_0x3c2e('0x9')]('[utils][getUserByName]',_0x538e2b?util[_0x3c2e('0x7')](_0x538e2b,{'showHidden':![],'depth':null}):'');return _0x1f4ebb(null);});}return _0x1f4ebb(null);});};exports[_0x3c2e('0x17')]=function(_0xe88a5a){return new BPromise(function(_0x3a90a1,_0x29ae6e){if(_0xe88a5a){return client[_0x3c2e('0xc')](_0x3c2e('0x18'),{'options':{'raw':!![],'attributes':['id',_0x3c2e('0x19'),_0x3c2e('0x1a'),'acw',_0x3c2e('0x1b')],'where':{'name':_0xe88a5a},'limit':0x1}})['then'](function(_0x471da1){logger[_0x3c2e('0x8')](_0x3c2e('0x1c'),_0xe88a5a,_0x471da1?util[_0x3c2e('0x7')](_0x471da1,{'showHidden':![],'depth':null}):'');logger['info']('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0xe88a5a,_0x471da1?'found':_0x3c2e('0x14'));return _0x3a90a1(_0x471da1[_0x3c2e('0x10')]['length']?_0x471da1[_0x3c2e('0x10')][0x0]:null);})[_0x3c2e('0x16')](function(_0x39bb41){logger[_0x3c2e('0x9')](_0x3c2e('0x1d'),_0x39bb41?util[_0x3c2e('0x7')](_0x39bb41,{'showHidden':![],'depth':null}):'');return _0x3a90a1(null);});}return _0x3a90a1(null);});};exports['addTime']=function(_0x27d3cf,_0x3a1c7f){return moment(_0x27d3cf)[_0x3c2e('0x1e')](_0x3a1c7f,_0x3c2e('0x1f'))['format']('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x3c2e('0x20')]=function(_0x436189,_0x1ffbae){return moment(_0x436189)[_0x3c2e('0x21')](_0x1ffbae,_0x3c2e('0x1f'))[_0x3c2e('0x22')](_0x3c2e('0x23'));};exports[_0x3c2e('0x24')]=function(_0x3ac302,_0xf1f560){return moment(_0x3ac302)[_0x3c2e('0x25')](moment(_0xf1f560),_0x3c2e('0x1f'));};exports[_0x3c2e('0x26')]=function(_0x109d64,_0x31d5d5){return parseInt(_0x109d64,0xa)+parseInt(_0x31d5d5,0xa);};exports[_0x3c2e('0x27')]=function(){return moment()[_0x3c2e('0x22')](_0x3c2e('0x23'));};exports[_0x3c2e('0x28')]=function(_0x33a2d9,_0x1e30e1){if(_0x1e30e1){return moment(_0x33a2d9)[_0x3c2e('0x28')](_0x1e30e1);}return!![];};exports[_0x3c2e('0x29')]=function(_0x487081,_0x15fff2){if(_0x15fff2){return moment(_0x487081)[_0x3c2e('0x29')](_0x15fff2);}else if(_0x487081){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 834c148..c95d8b1 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 _0x9e9d=['agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','remoteAddress','device','other','agent_name','url','setupLoggers','fs-extra','lodash','express-winston','path','util','fileLogger','./safe-template','safeTemplate','./mask-sensitive-data','maskSensitiveData','join','/var','log','xcally','client','name','then','catch','user','data','timestamp','error','api','set','client-side-logger','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','body','\x20body=%s','format','method','headers','x-forwarded-for','statusCode','responseTime','role','inspect','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s'];(function(_0x58f457,_0x990c9b){var _0x2e8229=function(_0x53b2aa){while(--_0x53b2aa){_0x58f457['push'](_0x58f457['shift']());}};_0x2e8229(++_0x990c9b);}(_0x9e9d,0x151));var _0xd9e9=function(_0x1c87de,_0x29a678){_0x1c87de=_0x1c87de-0x0;var _0x45a6e=_0x9e9d[_0x1c87de];return _0x45a6e;};var fs=require(_0xd9e9('0x0'));var _=require(_0xd9e9('0x1'));var ewinston=require(_0xd9e9('0x2'));var path=require(_0xd9e9('0x3'));var util=require(_0xd9e9('0x4'));var fileLogger=require('./loggers')[_0xd9e9('0x5')];var safeTemplate=require(_0xd9e9('0x6'))[_0xd9e9('0x7')];var maskSensitiveData=require(_0xd9e9('0x8'))[_0xd9e9('0x9')];function ClientSideLogger(){function _0xb7de6(_0xb33e88){var _0x5820ed=path[_0xd9e9('0xa')](_0xd9e9('0xb'),_0xd9e9('0xc'),_0xd9e9('0xd'));var _0x339c81=path[_0xd9e9('0xa')](_0xd9e9('0xe'),_0xb33e88['role']+'-'+_0xb33e88[_0xd9e9('0xf')]);return fs['ensureDir'](path[_0xd9e9('0xa')](_0x5820ed,_0x339c81))[_0xd9e9('0x10')](function(){var _0x26a9e9=fileLogger(_0xd9e9('0xe'),path['join'](_0x5820ed,_0x339c81));return _0x26a9e9;})[_0xd9e9('0x11')](function(_0x5d7f48){throw _0x5d7f48;});}this['log']=function(_0x2117a4,_0x4abcf2,_0x19f12c,_0x2540bf){return _0xb7de6(_0x2117a4[_0xd9e9('0x12')])[_0xd9e9('0x10')](function(_0x441217){var _0x3a5f2a=_0x441217[_0x4abcf2];return _0x3a5f2a;})[_0xd9e9('0x10')](function(_0x22f734){var _0x497a09=_0x2117a4[_0xd9e9('0x12')]?_0x2117a4['user']['id']:'no-user';var _0x16bbe5=_0x2540bf[_0xd9e9('0x13')];var _0xbe77e3=_0x2540bf[_0xd9e9('0x14')];var _0x1848d4=new Date(Number(_0xbe77e3));return _0x22f734(_0x497a09,_0x1848d4,_0x19f12c,_0x16bbe5);})[_0xd9e9('0x11')](function(_0x3717f0){fileLogger(_0xd9e9('0xe'))[_0xd9e9('0x15')](_0x3717f0);});};}function setupLoggers(_0x22e526){return new Promise(function(_0x2d1d65){var _0x23e88c=new ClientSideLogger();var _0x19b895=fileLogger(_0xd9e9('0x16'));var _0x28fff1=fileLogger('auth');_0x22e526[_0xd9e9('0x17')](_0xd9e9('0x18'),_0x23e88c);_0x22e526['use'](ewinston[_0xd9e9('0x19')]({'winstonInstance':_0x19b895,'meta':![],'statusLevels':!![],'msg':function(_0xb96f79,_0x5019f3){var _0xccf1a1=_0xd9e9('0x1a');if(!_['isEmpty'](_0xb96f79[_0xd9e9('0x1b')])){_0xccf1a1+=_0xd9e9('0x1c');var _0x1e3a4e=_0xb96f79[_0xd9e9('0x1b')];maskSensitiveData(_0x1e3a4e);}return safeTemplate(util[_0xd9e9('0x1d')](_0xccf1a1,_0xb96f79[_0xd9e9('0x1e')],_0xb96f79[_0xd9e9('0x1f')][_0xd9e9('0x20')]?_0xb96f79[_0xd9e9('0x1f')][_0xd9e9('0x20')]:_0xb96f79['connection']['remoteAddress']||_0xb96f79['ip'],_0xb96f79['url'],_0x5019f3[_0xd9e9('0x21')],_0x5019f3[_0xd9e9('0x22')],_0xb96f79['user']?_0xb96f79[_0xd9e9('0x12')]['id']:null,_0xb96f79[_0xd9e9('0x12')]?_0xb96f79[_0xd9e9('0x12')][_0xd9e9('0xf')]:null,_0xb96f79[_0xd9e9('0x12')]?_0xb96f79['user'][_0xd9e9('0x23')]:null,_0x1e3a4e?util[_0xd9e9('0x24')](_0x1e3a4e,![],null):''));}}));_0x22e526[_0xd9e9('0x25')](ewinston[_0xd9e9('0x19')]({'winstonInstance':_0x28fff1,'meta':![],'statusLevels':!![],'msg':function(_0x2b763f,_0x2a518a){var _0x5dbfaf=_0xd9e9('0x26');if(_0x2b763f[_0xd9e9('0x1b')]&&_0x2b763f['body']['device']&&_0x2b763f[_0xd9e9('0x1b')][_0xd9e9('0x27')]){_0x5dbfaf=_0xd9e9('0x28');}return util[_0xd9e9('0x1d')](_0x5dbfaf,_0x2b763f[_0xd9e9('0x1e')],_0x2b763f[_0xd9e9('0x1f')][_0xd9e9('0x20')]?_0x2b763f[_0xd9e9('0x1f')]['x-forwarded-for']:_0x2b763f['connection'][_0xd9e9('0x29')]||_0x2b763f['ip'],_0x2b763f['url'],_0x2a518a[_0xd9e9('0x21')],_0x2a518a[_0xd9e9('0x22')],_0x2b763f[_0xd9e9('0x12')]?_0x2b763f[_0xd9e9('0x12')]['id']:null,_0x2b763f[_0xd9e9('0x12')]?_0x2b763f['user'][_0xd9e9('0xf')]:null,_0x2b763f[_0xd9e9('0x12')]?_0x2b763f[_0xd9e9('0x12')]['role']:null,_0x2b763f['body']&&_0x2b763f[_0xd9e9('0x1b')][_0xd9e9('0x2a')]?_0x2b763f[_0xd9e9('0x1b')]['device']:_0xd9e9('0x2b'),_0x2b763f[_0xd9e9('0x1b')]&&_0x2b763f[_0xd9e9('0x1b')][_0xd9e9('0x27')]?_0x2b763f[_0xd9e9('0x1b')][_0xd9e9('0x27')]:'',_0x2b763f['body']&&_0x2b763f[_0xd9e9('0x1b')][_0xd9e9('0x2c')]?_0x2b763f['body'][_0xd9e9('0x2c')]:'');},'ignoreRoute':function(_0xbe11cd){var _0x2e3b23=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x2e3b23['test'](_0xbe11cd[_0xd9e9('0x2d')]);}}));return _0x2d1d65();});}exports[_0xd9e9('0x2e')]=setupLoggers; \ No newline at end of file +var _0x2f21=['/var','log','client','name','then','catch','user','data','error','auth','client-side-logger','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','format','method','headers','x-forwarded-for','connection','remoteAddress','url','statusCode','responseTime','role','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)','other','agent_name','test','fs-extra','lodash','path','util','./loggers','maskSensitiveData','join'];(function(_0x6c0123,_0x4c8d3b){var _0x5a87d2=function(_0x1ff614){while(--_0x1ff614){_0x6c0123['push'](_0x6c0123['shift']());}};_0x5a87d2(++_0x4c8d3b);}(_0x2f21,0x9d));var _0x12f2=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0x2f21[_0x4b2863];return _0x567d67;};var fs=require(_0x12f2('0x0'));var _=require(_0x12f2('0x1'));var ewinston=require('express-winston');var path=require(_0x12f2('0x2'));var util=require(_0x12f2('0x3'));var fileLogger=require(_0x12f2('0x4'))['fileLogger'];var safeTemplate=require('./safe-template')['safeTemplate'];var maskSensitiveData=require('./mask-sensitive-data')[_0x12f2('0x5')];function ClientSideLogger(){function _0x500fd5(_0x4297bd){var _0x31823f=path[_0x12f2('0x6')](_0x12f2('0x7'),_0x12f2('0x8'),'xcally');var _0x2b379e=path[_0x12f2('0x6')](_0x12f2('0x9'),_0x4297bd['role']+'-'+_0x4297bd[_0x12f2('0xa')]);return fs['ensureDir'](path['join'](_0x31823f,_0x2b379e))[_0x12f2('0xb')](function(){var _0x553cdf=fileLogger(_0x12f2('0x9'),path[_0x12f2('0x6')](_0x31823f,_0x2b379e));return _0x553cdf;})[_0x12f2('0xc')](function(_0xb9d555){throw _0xb9d555;});}this[_0x12f2('0x8')]=function(_0x4e9013,_0x5d258d,_0x26f028,_0x468952){return _0x500fd5(_0x4e9013['user'])[_0x12f2('0xb')](function(_0x445ade){var _0x2156da=_0x445ade[_0x5d258d];return _0x2156da;})[_0x12f2('0xb')](function(_0x70f734){var _0x4e4f8d=_0x4e9013[_0x12f2('0xd')]?_0x4e9013[_0x12f2('0xd')]['id']:'no-user';var _0x4b1d33=_0x468952[_0x12f2('0xe')];var _0x52769c=_0x468952['timestamp'];var _0x6181cc=new Date(Number(_0x52769c));return _0x70f734(_0x4e4f8d,_0x6181cc,_0x26f028,_0x4b1d33);})[_0x12f2('0xc')](function(_0x3d5730){fileLogger(_0x12f2('0x9'))[_0x12f2('0xf')](_0x3d5730);});};}function setupLoggers(_0x569180){return new Promise(function(_0x1b5ba8){var _0x49207d=new ClientSideLogger();var _0x223312=fileLogger('api');var _0x3bc2aa=fileLogger(_0x12f2('0x10'));_0x569180['set'](_0x12f2('0x11'),_0x49207d);_0x569180[_0x12f2('0x12')](ewinston[_0x12f2('0x13')]({'winstonInstance':_0x223312,'meta':![],'statusLevels':!![],'msg':function(_0x48e1d2,_0x2f4d70){var _0x3241c8=_0x12f2('0x14');if(!_[_0x12f2('0x15')](_0x48e1d2[_0x12f2('0x16')])){_0x3241c8+='\x20body=%s';var _0x4aea34=_0x48e1d2[_0x12f2('0x16')];maskSensitiveData(_0x4aea34);}return safeTemplate(util[_0x12f2('0x17')](_0x3241c8,_0x48e1d2[_0x12f2('0x18')],_0x48e1d2[_0x12f2('0x19')]['x-forwarded-for']?_0x48e1d2[_0x12f2('0x19')][_0x12f2('0x1a')]:_0x48e1d2[_0x12f2('0x1b')][_0x12f2('0x1c')]||_0x48e1d2['ip'],_0x48e1d2[_0x12f2('0x1d')],_0x2f4d70[_0x12f2('0x1e')],_0x2f4d70[_0x12f2('0x1f')],_0x48e1d2[_0x12f2('0xd')]?_0x48e1d2[_0x12f2('0xd')]['id']:null,_0x48e1d2[_0x12f2('0xd')]?_0x48e1d2[_0x12f2('0xd')]['name']:null,_0x48e1d2[_0x12f2('0xd')]?_0x48e1d2[_0x12f2('0xd')][_0x12f2('0x20')]:null,_0x4aea34?util[_0x12f2('0x21')](_0x4aea34,![],null):''));}}));_0x569180['use'](ewinston[_0x12f2('0x13')]({'winstonInstance':_0x3bc2aa,'meta':![],'statusLevels':!![],'msg':function(_0x3fa575,_0x524b3b){var _0x39fbbb=_0x12f2('0x22');if(_0x3fa575[_0x12f2('0x16')]&&_0x3fa575[_0x12f2('0x16')][_0x12f2('0x23')]&&_0x3fa575[_0x12f2('0x16')][_0x12f2('0x24')]){_0x39fbbb=_0x12f2('0x25');}return util[_0x12f2('0x17')](_0x39fbbb,_0x3fa575[_0x12f2('0x18')],_0x3fa575[_0x12f2('0x19')][_0x12f2('0x1a')]?_0x3fa575[_0x12f2('0x19')]['x-forwarded-for']:_0x3fa575['connection'][_0x12f2('0x1c')]||_0x3fa575['ip'],_0x3fa575[_0x12f2('0x1d')],_0x524b3b[_0x12f2('0x1e')],_0x524b3b['responseTime'],_0x3fa575[_0x12f2('0xd')]?_0x3fa575[_0x12f2('0xd')]['id']:null,_0x3fa575[_0x12f2('0xd')]?_0x3fa575[_0x12f2('0xd')][_0x12f2('0xa')]:null,_0x3fa575['user']?_0x3fa575[_0x12f2('0xd')][_0x12f2('0x20')]:null,_0x3fa575[_0x12f2('0x16')]&&_0x3fa575[_0x12f2('0x16')]['device']?_0x3fa575[_0x12f2('0x16')]['device']:_0x12f2('0x26'),_0x3fa575[_0x12f2('0x16')]&&_0x3fa575[_0x12f2('0x16')]['agent_id']?_0x3fa575[_0x12f2('0x16')][_0x12f2('0x24')]:'',_0x3fa575['body']&&_0x3fa575['body']['agent_name']?_0x3fa575[_0x12f2('0x16')][_0x12f2('0x27')]:'');},'ignoreRoute':function(_0x50c2bc){var _0x1c7c0c=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x1c7c0c[_0x12f2('0x28')](_0x50c2bc[_0x12f2('0x1d')]);}}));return _0x1b5ba8();});}exports['setupLoggers']=setupLoggers; \ No newline at end of file diff --git a/server/utils/iftime.js b/server/utils/iftime.js index c85f7b1..a229e70 100644 --- a/server/utils/iftime.js +++ b/server/utils/iftime.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6a5a=['isBetween','timeCompare','format','includes','dowCompare','daysInMonth','max','min','domCompare','MMM','monthCompare','guess','test','isMoment','length','lodash','map','source','join','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','isValid','split','locale','weekdaysShort','toLowerCase','indexOf','slice','concat','exports','circularDoWInterval','monthsShort','circularMonthInterval','clone','hours','startOf','endOf','day'];(function(_0xb70557,_0x3e33ea){var _0x5d79f6=function(_0x158897){while(--_0x158897){_0xb70557['push'](_0xb70557['shift']());}};_0x5d79f6(++_0x3e33ea);}(_0x6a5a,0x18b));var _0xa6a5=function(_0x40e2eb,_0x35eb7d){_0x40e2eb=_0x40e2eb-0x0;var _0x59feae=_0x6a5a[_0x40e2eb];return _0x59feae;};var _=require(_0xa6a5('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][_0xa6a5('0x1')](function(_0x34a661){return _0x34a661[_0xa6a5('0x2')];})[_0xa6a5('0x3')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0xa6a5('0x4');var EINVALID_DATE=_0xa6a5('0x5');function throwIfDateNotValid(_0x1d886c){if(!_0x1d886c[_0xa6a5('0x6')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0xfd7bb9){var _0x137223=_0xfd7bb9[_0xa6a5('0x7')](':')[_0xa6a5('0x1')](function(_0x9d6eb6){return parseInt(_0x9d6eb6,0xa);});var _0x4ad038=_0x137223[0x0];var _0x2670f8=_0x137223[0x1];if(_0x4ad038<0x0||_0x4ad038>0x17||_0x2670f8<0x0||_0x2670f8>0x3b){throw new Error(EINVALID_DATE);}return[_0x4ad038,_0x2670f8];}function circularDoWInterval(_0xf8a62d,_0x30b45c){if(_0xf8a62d===_0x30b45c){return[_0xf8a62d];}else{var _0x428a13=moment[_0xa6a5('0x8')]();moment['locale']('en');var _0x3a2c68=moment[_0xa6a5('0x9')]()[_0xa6a5('0x1')](function(_0x3d3fe2){return _0x3d3fe2[_0xa6a5('0xa')]();});moment[_0xa6a5('0x8')](_0x428a13);var _0x44226d=_0x3a2c68[_0xa6a5('0xb')](_0xf8a62d);var _0x5be9b9=_0x3a2c68[_0xa6a5('0xb')](_0x30b45c);if(_0x5be9b9>_0x44226d){return _0x3a2c68[_0xa6a5('0xc')](_0x44226d,_0x5be9b9+0x1);}else{var _0x5e8d33=_0x3a2c68[_0xa6a5('0xc')](0x0,_0x5be9b9+0x1);var _0x4ea939=_0x3a2c68['slice'](_0x44226d);return _0x4ea939[_0xa6a5('0xd')](_0x5e8d33);}}}module[_0xa6a5('0xe')][_0xa6a5('0xf')]=circularDoWInterval;function circularMonthInterval(_0x19e6eb,_0x3d04e3){if(_0x19e6eb===_0x3d04e3){return[_0x19e6eb];}else{var _0x20729d=moment['locale']();moment[_0xa6a5('0x8')]('en');var _0x560f85=moment[_0xa6a5('0x10')]()['map'](function(_0x1f11a2){return _0x1f11a2[_0xa6a5('0xa')]();});moment[_0xa6a5('0x8')](_0x20729d);var _0x572514=_0x560f85['indexOf'](_0x19e6eb);var _0x4ea816=_0x560f85[_0xa6a5('0xb')](_0x3d04e3);if(_0x4ea816>_0x572514){return _0x560f85[_0xa6a5('0xc')](_0x572514,_0x4ea816+0x1);}else{var _0x103274=_0x560f85[_0xa6a5('0xc')](0x0,_0x4ea816+0x1);var _0x39e8e3=_0x560f85['slice'](_0x572514);return _0x39e8e3[_0xa6a5('0xd')](_0x103274);}}}module[_0xa6a5('0xe')][_0xa6a5('0x11')]=circularMonthInterval;function parseDom(_0x2d8f6b){var _0x1295a7=parseInt(_0x2d8f6b,0xa);if(_0x1295a7<0x1||_0x1295a7>0x1f){throw new Error(EINVALID_DATE);}return _0x1295a7;}function timeCompare(_0x4d77d3,_0x33a4c7,_0x52f845){var _0x3adb63=_0x4d77d3[_0xa6a5('0x12')]();var _0x5e00e3=extractTime(_0x33a4c7);var _0x218418=_0x5e00e3[0x0];var _0x1807ac=_0x5e00e3[0x1];var _0x5e842b=_0x4d77d3[_0xa6a5('0x12')]()[_0xa6a5('0x13')](_0x218418)['minutes'](_0x1807ac);throwIfDateNotValid(_0x5e842b);var _0x2f1b05=extractTime(_0x52f845);var _0xc1df2d=_0x2f1b05[0x0];var _0x211e12=_0x2f1b05[0x1];var _0x316119=_0x4d77d3[_0xa6a5('0x12')]()['hours'](_0xc1df2d)['minutes'](_0x211e12);throwIfDateNotValid(_0x316119);if(_0x316119['isBefore'](_0x5e842b)){var _0x1efe66=_0x3adb63[_0xa6a5('0x12')]()[_0xa6a5('0x14')]('day');var _0x1a4108=_0x3adb63['clone']()[_0xa6a5('0x15')](_0xa6a5('0x16'));return _0x3adb63['isBetween'](_0x5e842b,_0x1a4108,undefined,'[]')||_0x3adb63[_0xa6a5('0x17')](_0x1efe66,_0x316119,undefined,'[]');}else{return _0x3adb63['isBetween'](_0x5e842b,_0x316119,undefined,'[]');}}module[_0xa6a5('0xe')][_0xa6a5('0x18')]=timeCompare;function dowCompare(_0xea6eb,_0x5315fc,_0xe40a47){var _0x255819=_0xea6eb[_0xa6a5('0x8')]('en')[_0xa6a5('0x19')]('ddd')[_0xa6a5('0xa')]();return circularDoWInterval(_0x5315fc,_0xe40a47)[_0xa6a5('0x1a')](_0x255819);}module[_0xa6a5('0xe')][_0xa6a5('0x1b')]=dowCompare;function domCompare(_0x39f554,_0x408b11,_0x5ca4c8){var _0x45f479=_0x39f554['date']();if(_0x408b11===_0x5ca4c8){return _0x45f479===_0x408b11;}else{var _0x3dd3dc=_0x39f554[_0xa6a5('0x1c')]();var _0x474536=_0x408b11<_0x5ca4c8;let _0x2c2861=![];var _0x1ed1a5=0x0;var _0x31d04c=0x0;if(_0x474536){_0x1ed1a5=Math[_0xa6a5('0x1d')](0x1,_0x408b11);_0x31d04c=Math['min'](_0x5ca4c8,_0x3dd3dc);_0x2c2861=_0x45f479>=_0x1ed1a5&&_0x45f479<=_0x31d04c;}else{_0x1ed1a5=Math[_0xa6a5('0x1e')](_0x408b11,_0x3dd3dc);_0x31d04c=Math[_0xa6a5('0x1d')](0x1,_0x5ca4c8);_0x2c2861=_0x45f479>=_0x1ed1a5||_0x45f479<=_0x31d04c;}return _0x2c2861;}}module['exports'][_0xa6a5('0x1f')]=domCompare;function monthCompare(_0x116978,_0x183fb3,_0x58bc76){var _0x36d37a=_0x116978[_0xa6a5('0x8')]('en')[_0xa6a5('0x19')](_0xa6a5('0x20'))[_0xa6a5('0xa')]();return circularMonthInterval(_0x183fb3,_0x58bc76)[_0xa6a5('0x1a')](_0x36d37a);}module[_0xa6a5('0xe')][_0xa6a5('0x21')]=monthCompare;function iftime(_0x14fdf0,_0x18f79c=moment['tz'][_0xa6a5('0x22')](),_0x58f523=moment()){if(!validateRx[_0xa6a5('0x23')](_0x14fdf0)){throw new Error(EINVALID_STRING);}else{var _0x3b9696=(moment[_0xa6a5('0x24')](_0x58f523)?_0x58f523[_0xa6a5('0x12')]():moment(_0x58f523))['tz'](_0x18f79c)[_0xa6a5('0x8')]('en');throwIfDateNotValid(_0x3b9696);var _0x5caba0=_0x14fdf0[_0xa6a5('0x7')](',');var _0x1e0111=_0x5caba0[0x0];var _0x1c0a2d=_0x5caba0[0x1];var _0x3efaef=_0x5caba0[0x2];var _0x338b81=_0x5caba0[0x3];let _0x26fc15=!![];if(_0x1e0111!=='*'){var _0x4aeafe=_0x1e0111[_0xa6a5('0x7')]('-');var _0x17146c=_['padStart'](_0x4aeafe[0x0],0x5,'0');var _0x21d65b=_0x4aeafe[_0xa6a5('0x25')]===0x2?_['padStart'](_0x4aeafe[0x1],0x5,'0'):_0x17146c;_0x26fc15=timeCompare(_0x3b9696,_0x17146c,_0x21d65b);}let _0x3d2348=!![];if(_0x1c0a2d!=='*'){var _0x4465bd=_0x1c0a2d[_0xa6a5('0x7')]('-');var _0x1bd28f=_0x4465bd[0x0];var _0x197398=_0x4465bd['length']===0x2?_0x4465bd[0x1]:_0x1bd28f;_0x3d2348=dowCompare(_0x3b9696,_0x1bd28f,_0x197398);}let _0x2ef903=!![];if(_0x3efaef!=='*'){var _0x4b262b=_0x3efaef[_0xa6a5('0x7')]('-');var _0x4a3978=parseDom(_0x4b262b[0x0]);var _0x5d0fe1=_0x4b262b[_0xa6a5('0x25')]===0x2?parseDom(_0x4b262b[0x1]):_0x4a3978;_0x2ef903=domCompare(_0x3b9696,_0x4a3978,_0x5d0fe1);}let _0x5c2e1f=!![];if(_0x338b81!=='*'){var _0x483063=_0x338b81['split']('-');var _0x309573=_0x483063[0x0];var _0x8904ed=_0x483063[_0xa6a5('0x25')]===0x2?_0x483063[0x1]:_0x483063[0x0];_0x5c2e1f=monthCompare(_0x3b9696,_0x309573,_0x8904ed);}return _0x26fc15&&_0x3d2348&&_0x2ef903&&_0x5c2e1f;}}module[_0xa6a5('0xe')]['iftime']=iftime; \ No newline at end of file +var _0xf6ec=['concat','circularDoWInterval','monthsShort','toLowerCase','circularMonthInterval','clone','minutes','hours','isBefore','startOf','day','endOf','isBetween','exports','ddd','includes','daysInMonth','max','domCompare','MMM','monthCompare','test','isMoment','padStart','length','lodash','moment-timezone','map','join','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','split','locale','indexOf','slice'];(function(_0x41ecf4,_0xc5eda8){var _0x355c7f=function(_0x17730a){while(--_0x17730a){_0x41ecf4['push'](_0x41ecf4['shift']());}};_0x355c7f(++_0xc5eda8);}(_0xf6ec,0x177));var _0xcf6e=function(_0x145fa8,_0x396ab3){_0x145fa8=_0x145fa8-0x0;var _0x240a9c=_0xf6ec[_0x145fa8];return _0x240a9c;};var _=require(_0xcf6e('0x0'));var moment=require(_0xcf6e('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][_0xcf6e('0x2')](function(_0x4c9743){return _0x4c9743['source'];})[_0xcf6e('0x3')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0xcf6e('0x4');var EINVALID_DATE=_0xcf6e('0x5');function throwIfDateNotValid(_0x364c41){if(!_0x364c41['isValid']()){throw new Error(EINVALID_DATE);}}function extractTime(_0x4c0382){var _0x3362f0=_0x4c0382[_0xcf6e('0x6')](':')['map'](function(_0x56d8eb){return parseInt(_0x56d8eb,0xa);});var _0x58cada=_0x3362f0[0x0];var _0x362346=_0x3362f0[0x1];if(_0x58cada<0x0||_0x58cada>0x17||_0x362346<0x0||_0x362346>0x3b){throw new Error(EINVALID_DATE);}return[_0x58cada,_0x362346];}function circularDoWInterval(_0x420f4d,_0x33c714){if(_0x420f4d===_0x33c714){return[_0x420f4d];}else{var _0xb07079=moment[_0xcf6e('0x7')]();moment[_0xcf6e('0x7')]('en');var _0xa2082=moment['weekdaysShort']()[_0xcf6e('0x2')](function(_0x57cf8d){return _0x57cf8d['toLowerCase']();});moment[_0xcf6e('0x7')](_0xb07079);var _0x7fd4a=_0xa2082[_0xcf6e('0x8')](_0x420f4d);var _0x3ed222=_0xa2082[_0xcf6e('0x8')](_0x33c714);if(_0x3ed222>_0x7fd4a){return _0xa2082[_0xcf6e('0x9')](_0x7fd4a,_0x3ed222+0x1);}else{var _0x32f79c=_0xa2082[_0xcf6e('0x9')](0x0,_0x3ed222+0x1);var _0x1b5e9f=_0xa2082['slice'](_0x7fd4a);return _0x1b5e9f[_0xcf6e('0xa')](_0x32f79c);}}}module['exports'][_0xcf6e('0xb')]=circularDoWInterval;function circularMonthInterval(_0x5869e5,_0x10520f){if(_0x5869e5===_0x10520f){return[_0x5869e5];}else{var _0x1172f8=moment['locale']();moment[_0xcf6e('0x7')]('en');var _0x1dfa52=moment[_0xcf6e('0xc')]()['map'](function(_0x4c15aa){return _0x4c15aa[_0xcf6e('0xd')]();});moment[_0xcf6e('0x7')](_0x1172f8);var _0x26e2c9=_0x1dfa52[_0xcf6e('0x8')](_0x5869e5);var _0x3eaa28=_0x1dfa52[_0xcf6e('0x8')](_0x10520f);if(_0x3eaa28>_0x26e2c9){return _0x1dfa52[_0xcf6e('0x9')](_0x26e2c9,_0x3eaa28+0x1);}else{var _0xd44742=_0x1dfa52['slice'](0x0,_0x3eaa28+0x1);var _0x1219bc=_0x1dfa52[_0xcf6e('0x9')](_0x26e2c9);return _0x1219bc[_0xcf6e('0xa')](_0xd44742);}}}module['exports'][_0xcf6e('0xe')]=circularMonthInterval;function parseDom(_0x251b94){var _0x2c565f=parseInt(_0x251b94,0xa);if(_0x2c565f<0x1||_0x2c565f>0x1f){throw new Error(EINVALID_DATE);}return _0x2c565f;}function timeCompare(_0x26d256,_0x34a6c1,_0x15b1a3){var _0xebaa84=_0x26d256[_0xcf6e('0xf')]();var _0x5c130e=extractTime(_0x34a6c1);var _0x1589c7=_0x5c130e[0x0];var _0x2accaf=_0x5c130e[0x1];var _0x1d7c8b=_0x26d256[_0xcf6e('0xf')]()['hours'](_0x1589c7)[_0xcf6e('0x10')](_0x2accaf);throwIfDateNotValid(_0x1d7c8b);var _0x2ff515=extractTime(_0x15b1a3);var _0x77e8cd=_0x2ff515[0x0];var _0x239f52=_0x2ff515[0x1];var _0x6abe5d=_0x26d256[_0xcf6e('0xf')]()[_0xcf6e('0x11')](_0x77e8cd)[_0xcf6e('0x10')](_0x239f52);throwIfDateNotValid(_0x6abe5d);if(_0x6abe5d[_0xcf6e('0x12')](_0x1d7c8b)){var _0x242729=_0xebaa84[_0xcf6e('0xf')]()[_0xcf6e('0x13')](_0xcf6e('0x14'));var _0x38f431=_0xebaa84[_0xcf6e('0xf')]()[_0xcf6e('0x15')](_0xcf6e('0x14'));return _0xebaa84[_0xcf6e('0x16')](_0x1d7c8b,_0x38f431,undefined,'[]')||_0xebaa84['isBetween'](_0x242729,_0x6abe5d,undefined,'[]');}else{return _0xebaa84[_0xcf6e('0x16')](_0x1d7c8b,_0x6abe5d,undefined,'[]');}}module[_0xcf6e('0x17')]['timeCompare']=timeCompare;function dowCompare(_0x4bcab5,_0x50c9d8,_0x4baa7d){var _0x49d127=_0x4bcab5[_0xcf6e('0x7')]('en')['format'](_0xcf6e('0x18'))[_0xcf6e('0xd')]();return circularDoWInterval(_0x50c9d8,_0x4baa7d)[_0xcf6e('0x19')](_0x49d127);}module[_0xcf6e('0x17')]['dowCompare']=dowCompare;function domCompare(_0x25bc8d,_0x5e6c28,_0x50aebf){var _0x3aa59a=_0x25bc8d['date']();if(_0x5e6c28===_0x50aebf){return _0x3aa59a===_0x5e6c28;}else{var _0x30de70=_0x25bc8d[_0xcf6e('0x1a')]();var _0x13f8db=_0x5e6c28<_0x50aebf;let _0x318bdc=![];var _0x1e3445=0x0;var _0x29baa2=0x0;if(_0x13f8db){_0x1e3445=Math[_0xcf6e('0x1b')](0x1,_0x5e6c28);_0x29baa2=Math['min'](_0x50aebf,_0x30de70);_0x318bdc=_0x3aa59a>=_0x1e3445&&_0x3aa59a<=_0x29baa2;}else{_0x1e3445=Math['min'](_0x5e6c28,_0x30de70);_0x29baa2=Math[_0xcf6e('0x1b')](0x1,_0x50aebf);_0x318bdc=_0x3aa59a>=_0x1e3445||_0x3aa59a<=_0x29baa2;}return _0x318bdc;}}module['exports'][_0xcf6e('0x1c')]=domCompare;function monthCompare(_0x4e5961,_0x371844,_0xce8c67){var _0x5a0265=_0x4e5961[_0xcf6e('0x7')]('en')['format'](_0xcf6e('0x1d'))[_0xcf6e('0xd')]();return circularMonthInterval(_0x371844,_0xce8c67)[_0xcf6e('0x19')](_0x5a0265);}module[_0xcf6e('0x17')][_0xcf6e('0x1e')]=monthCompare;function iftime(_0x2060b2,_0x55c1fb=moment['tz']['guess'](),_0x35707b=moment()){if(!validateRx[_0xcf6e('0x1f')](_0x2060b2)){throw new Error(EINVALID_STRING);}else{var _0xead959=(moment[_0xcf6e('0x20')](_0x35707b)?_0x35707b['clone']():moment(_0x35707b))['tz'](_0x55c1fb)['locale']('en');throwIfDateNotValid(_0xead959);var _0x26262e=_0x2060b2['split'](',');var _0x5e9530=_0x26262e[0x0];var _0x2bd8cd=_0x26262e[0x1];var _0x55782a=_0x26262e[0x2];var _0x136ca4=_0x26262e[0x3];let _0x3c530d=!![];if(_0x5e9530!=='*'){var _0x5743db=_0x5e9530[_0xcf6e('0x6')]('-');var _0xb4f610=_[_0xcf6e('0x21')](_0x5743db[0x0],0x5,'0');var _0x1d609d=_0x5743db[_0xcf6e('0x22')]===0x2?_[_0xcf6e('0x21')](_0x5743db[0x1],0x5,'0'):_0xb4f610;_0x3c530d=timeCompare(_0xead959,_0xb4f610,_0x1d609d);}let _0x2a18d9=!![];if(_0x2bd8cd!=='*'){var _0x1e3175=_0x2bd8cd['split']('-');var _0x55760f=_0x1e3175[0x0];var _0x19cec0=_0x1e3175[_0xcf6e('0x22')]===0x2?_0x1e3175[0x1]:_0x55760f;_0x2a18d9=dowCompare(_0xead959,_0x55760f,_0x19cec0);}let _0x458832=!![];if(_0x55782a!=='*'){var _0x1ab430=_0x55782a[_0xcf6e('0x6')]('-');var _0x4413f=parseDom(_0x1ab430[0x0]);var _0x308e5a=_0x1ab430['length']===0x2?parseDom(_0x1ab430[0x1]):_0x4413f;_0x458832=domCompare(_0xead959,_0x4413f,_0x308e5a);}let _0x294432=!![];if(_0x136ca4!=='*'){var _0x7c9a44=_0x136ca4['split']('-');var _0x449daf=_0x7c9a44[0x0];var _0x284406=_0x7c9a44['length']===0x2?_0x7c9a44[0x1]:_0x7c9a44[0x0];_0x294432=monthCompare(_0xead959,_0x449daf,_0x284406);}return _0x3c530d&&_0x2a18d9&&_0x458832&&_0x294432;}}module['exports']['iftime']=iftime; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index 918390d..01b0c15 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x79a5=['addColors','/var/log/xcally','join','format','%s-%s.log','message','replace','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','meta','keys','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','Logger','transports','Console','warn','File','%s-%s','error','consoleLogger','fileLogger','path','util','moment','winston','debugLevel','redBG\x20white','red','bold\x20yellow','white','bold\x20white','bold\x20magenta','bold\x20blue','bold\x20cyan'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0x79a5,0x165));var _0x579a=function(_0x46d0c9,_0x526bfa){_0x46d0c9=_0x46d0c9-0x0;var _0x174506=_0x79a5[_0x46d0c9];return _0x174506;};'use strict';var path=require(_0x579a('0x0'));var util=require(_0x579a('0x1'));var moment=require(_0x579a('0x2'));var winston=require(_0x579a('0x3'));var config=require('../config/environment');var debugLevel=config[_0x579a('0x4')]?config[_0x579a('0x4')]['toLowerCase']():'info';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':_0x579a('0x5'),'error':_0x579a('0x6'),'warn':_0x579a('0x7'),'info':_0x579a('0x8'),'print':_0x579a('0x9'),'success':'bold\x20green','http':'gray','verbose':_0x579a('0xa'),'debug':_0x579a('0xb'),'silly':_0x579a('0xc')};winston[_0x579a('0xd')](XC_LOG_COLORS);function getLogFileName(_0x2b78a8,_0x4ce18c,_0x2cc05e){var _0x2a440f=_0x2b78a8||_0x579a('0xe');return path[_0x579a('0xf')](_0x2a440f,util[_0x579a('0x10')](_0x579a('0x11'),_0x4ce18c,_0x2cc05e));}function formatter(_0x3898f8,_0x4c81f8){_0x4c81f8[_0x579a('0x12')]=_0x4c81f8[_0x579a('0x12')]['replace'](/@@{/g,'{{{')[_0x579a('0x13')](/}@@/g,'}}}')[_0x579a('0x13')](/@{/g,'{{')[_0x579a('0x13')](/}@/g,'}}');return util[_0x579a('0x10')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0x579a('0x10')](_0x579a('0x14')),_0x4c81f8[_0x579a('0x15')][_0x579a('0x16')](),_0x3898f8,_0x4c81f8['message']);}function fileFormat(_0xaccb67,_0x413b49){_0x413b49['message']=_0x413b49[_0x579a('0x12')][_0x579a('0x13')](/@@{/g,'{{{')['replace'](/}@@/g,'}}}')[_0x579a('0x13')](/@{/g,'{{')[_0x579a('0x13')](/}@/g,'}}');var _0x4ed37f=_0x413b49[_0x579a('0x17')]&&Object[_0x579a('0x18')](_0x413b49[_0x579a('0x17')])[_0x579a('0x19')]?'\x0a\x09'+JSON[_0x579a('0x1a')](_0x413b49['meta']):'';return util[_0x579a('0x10')](_0x579a('0x1b'),moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),_0x413b49[_0x579a('0x15')]['toUpperCase'](),_0xaccb67,_0x413b49[_0x579a('0x12')],_0x4ed37f);}function consoleLogger(){var _0x3e0baf=new winston[(_0x579a('0x1c'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x579a('0x1d'))][(_0x579a('0x1e'))]({'level':_0x579a('0x1f'),'json':![],'formatter':function(_0x51e9bb){return formatter('',_0x51e9bb);}})]});return _0x3e0baf;}function fileLogger(_0x18abdf,_0x215130){var _0x43f38d=new winston[(_0x579a('0x1c'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x579a('0x1d'))][(_0x579a('0x20'))]({'name':util[_0x579a('0x10')](_0x579a('0x21'),_0x18abdf,_0x579a('0x22')),'filename':getLogFileName(_0x215130,_0x18abdf,_0x579a('0x22')),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x266c9b){return fileFormat(_0x18abdf,_0x266c9b);}}),new winston[(_0x579a('0x1d'))][(_0x579a('0x20'))]({'name':util[_0x579a('0x10')](_0x579a('0x21'),_0x18abdf,debugLevel),'filename':getLogFileName(_0x215130,_0x18abdf,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x4ff696){return fileFormat(_0x18abdf,_0x4ff696);}}),new winston['transports']['Console']({'level':_0x579a('0x1f'),'json':![],'formatter':function(_0x37cec7){return fileFormat(_0x18abdf,_0x37cec7);}})]});return _0x43f38d;}exports[_0x579a('0x23')]=consoleLogger;exports[_0x579a('0x24')]=fileLogger; \ No newline at end of file +var _0x47db=['redBG\x20white','red','white','bold\x20white','bold\x20green','gray','bold\x20magenta','bold\x20blue','bold\x20cyan','addColors','/var/log/xcally','format','%s-%s.log','message','replace','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','meta','keys','length','stringify','toUpperCase','Console','warn','transports','File','%s-%s','error','fileLogger','path','util','moment','winston','debugLevel','toLowerCase','info'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x47db,0xdd));var _0xb47d=function(_0x59a4bd,_0x36eae1){_0x59a4bd=_0x59a4bd-0x0;var _0x39aa96=_0x47db[_0x59a4bd];return _0x39aa96;};'use strict';var path=require(_0xb47d('0x0'));var util=require(_0xb47d('0x1'));var moment=require(_0xb47d('0x2'));var winston=require(_0xb47d('0x3'));var config=require('../config/environment');var debugLevel=config[_0xb47d('0x4')]?config[_0xb47d('0x4')][_0xb47d('0x5')]():_0xb47d('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':_0xb47d('0x7'),'error':_0xb47d('0x8'),'warn':'bold\x20yellow','info':_0xb47d('0x9'),'print':_0xb47d('0xa'),'success':_0xb47d('0xb'),'http':_0xb47d('0xc'),'verbose':_0xb47d('0xd'),'debug':_0xb47d('0xe'),'silly':_0xb47d('0xf')};winston[_0xb47d('0x10')](XC_LOG_COLORS);function getLogFileName(_0x3917b0,_0x7df20a,_0x2e6dee){var _0x3ea854=_0x3917b0||_0xb47d('0x11');return path['join'](_0x3ea854,util[_0xb47d('0x12')](_0xb47d('0x13'),_0x7df20a,_0x2e6dee));}function formatter(_0x5278a2,_0x4185d2){_0x4185d2[_0xb47d('0x14')]=_0x4185d2['message'][_0xb47d('0x15')](/@@{/g,'{{{')[_0xb47d('0x15')](/}@@/g,_0xb47d('0x16'))[_0xb47d('0x15')](/@{/g,'{{')[_0xb47d('0x15')](/}@/g,'}}');return util[_0xb47d('0x12')](_0xb47d('0x17'),moment()[_0xb47d('0x12')](_0xb47d('0x18')),_0x4185d2[_0xb47d('0x19')]['toUpperCase'](),_0x5278a2,_0x4185d2[_0xb47d('0x14')]);}function fileFormat(_0x4b439b,_0x25a915){_0x25a915[_0xb47d('0x14')]=_0x25a915[_0xb47d('0x14')][_0xb47d('0x15')](/@@{/g,'{{{')[_0xb47d('0x15')](/}@@/g,_0xb47d('0x16'))[_0xb47d('0x15')](/@{/g,'{{')[_0xb47d('0x15')](/}@/g,'}}');var _0x2d84f9=_0x25a915[_0xb47d('0x1a')]&&Object[_0xb47d('0x1b')](_0x25a915[_0xb47d('0x1a')])[_0xb47d('0x1c')]?'\x0a\x09'+JSON[_0xb47d('0x1d')](_0x25a915[_0xb47d('0x1a')]):'';return util[_0xb47d('0x12')]('[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s',moment()[_0xb47d('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),_0x25a915[_0xb47d('0x19')][_0xb47d('0x1e')](),_0x4b439b,_0x25a915[_0xb47d('0x14')],_0x2d84f9);}function consoleLogger(){var _0x32d2eb=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0xb47d('0x1f'))]({'level':_0xb47d('0x20'),'json':![],'formatter':function(_0x199c10){return formatter('',_0x199c10);}})]});return _0x32d2eb;}function fileLogger(_0x1d669b,_0xec38ed){var _0x9e1557=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xb47d('0x21'))][(_0xb47d('0x22'))]({'name':util[_0xb47d('0x12')](_0xb47d('0x23'),_0x1d669b,_0xb47d('0x24')),'filename':getLogFileName(_0xec38ed,_0x1d669b,_0xb47d('0x24')),'level':_0xb47d('0x24'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x5b9017){return fileFormat(_0x1d669b,_0x5b9017);}}),new winston[(_0xb47d('0x21'))][(_0xb47d('0x22'))]({'name':util['format'](_0xb47d('0x23'),_0x1d669b,debugLevel),'filename':getLogFileName(_0xec38ed,_0x1d669b,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x3fe31c){return fileFormat(_0x1d669b,_0x3fe31c);}}),new winston[(_0xb47d('0x21'))][(_0xb47d('0x1f'))]({'level':_0xb47d('0x20'),'json':![],'formatter':function(_0xa754c0){return fileFormat(_0x1d669b,_0xa754c0);}})]});return _0x9e1557;}exports['consoleLogger']=consoleLogger;exports[_0xb47d('0x25')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index 74005c7..da21a1a 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 _0x7a54=['code','accessKey','token','authToken','consumerKey','membername','exten','vidaooApiKey','clientEmail','privateKey','accesskeyid','secretaccesskey','key','pass','accountSid','localstationid','dsn','secret','registry','oldPassword','isPlainObject','isArray','length','replace','}@@','includes','exports','maskSensitiveData','lodash','username','password','apiKey','firstName','street','phone','mobile','fax','email','clientSecret'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7a54,0x106));var _0x47a5=function(_0x3a86ef,_0x29fc41){_0x3a86ef=_0x3a86ef-0x0;var _0x1d3895=_0x7a54[_0x3a86ef];return _0x1d3895;};var _=require(_0x47a5('0x0'));var sensitiveFields=[_0x47a5('0x1'),_0x47a5('0x2'),'newPassword',_0x47a5('0x3'),_0x47a5('0x4'),'lastName',_0x47a5('0x5'),_0x47a5('0x6'),_0x47a5('0x7'),_0x47a5('0x8'),_0x47a5('0x9'),'clientId',_0x47a5('0xa'),'securityToken',_0x47a5('0xb'),_0x47a5('0xc'),'tenantId',_0x47a5('0xd'),'channelSecret','accessToken','accessTokenSecret',_0x47a5('0xe'),_0x47a5('0xf'),'consumerSecret',_0x47a5('0x10'),'calleridname','calleridnum',_0x47a5('0x11'),_0x47a5('0x12'),_0x47a5('0x13'),_0x47a5('0x14'),_0x47a5('0x15'),_0x47a5('0x16'),_0x47a5('0x17'),'user',_0x47a5('0x18'),_0x47a5('0x19'),_0x47a5('0x1a'),_0x47a5('0x1b'),_0x47a5('0x1c'),_0x47a5('0x1d'),_0x47a5('0x1e')];function maskSensitiveData(_0x190faa){const _0x4e99a8=/(?!^)[\s\S](?!$)/g;if(_[_0x47a5('0x1f')](_0x190faa)){for(const _0x11faf5 in _0x190faa){if(_[_0x47a5('0x20')](_0x190faa[_0x11faf5])){for(let _0x2a2cbb=0x0;_0x2a2cbb<_0x190faa[_0x11faf5][_0x47a5('0x21')];_0x2a2cbb++){maskSensitiveData(_0x190faa[_0x11faf5][_0x2a2cbb]);}}else if(_['isPlainObject'](_0x190faa[_0x11faf5])){maskSensitiveData(_0x190faa[_0x11faf5]);}else if(_['isString'](_0x190faa[_0x11faf5])){_0x190faa[_0x11faf5]=_0x190faa[_0x11faf5][_0x47a5('0x22')](/{{{/g,'@@{')['replace'](/}}}/g,_0x47a5('0x23'))[_0x47a5('0x22')](/{{/g,'@{')[_0x47a5('0x22')](/}}/g,'}@');if(_[_0x47a5('0x24')](sensitiveFields,_0x11faf5)){_0x190faa[_0x11faf5]=_0x190faa[_0x11faf5][_0x47a5('0x22')](_0x4e99a8,'*');}}}}}module[_0x47a5('0x25')][_0x47a5('0x26')]=maskSensitiveData; \ No newline at end of file +var _0x14a0=['membername','calleridnum','exten','clientEmail','privateKey','accesskeyid','secretaccesskey','key','user','pass','accountSid','localstationid','dsn','secret','registry','isArray','length','isPlainObject','isString','replace','@@{','}@@','includes','exports','maskSensitiveData','username','password','newPassword','apiKey','firstName','lastName','street','fax','email','clientId','code','accessKey','tenantId','accessToken'];(function(_0x4bcbe6,_0x389666){var _0x15ac5f=function(_0x3aca02){while(--_0x3aca02){_0x4bcbe6['push'](_0x4bcbe6['shift']());}};_0x15ac5f(++_0x389666);}(_0x14a0,0x8e));var _0x014a=function(_0x3d87d6,_0x27a4b2){_0x3d87d6=_0x3d87d6-0x0;var _0x4a03d4=_0x14a0[_0x3d87d6];return _0x4a03d4;};var _=require('lodash');var sensitiveFields=[_0x014a('0x0'),_0x014a('0x1'),_0x014a('0x2'),_0x014a('0x3'),_0x014a('0x4'),_0x014a('0x5'),_0x014a('0x6'),'phone','mobile',_0x014a('0x7'),_0x014a('0x8'),_0x014a('0x9'),'clientSecret','securityToken',_0x014a('0xa'),_0x014a('0xb'),_0x014a('0xc'),'token','channelSecret',_0x014a('0xd'),'accessTokenSecret','authToken','consumerKey','consumerSecret',_0x014a('0xe'),'calleridname',_0x014a('0xf'),_0x014a('0x10'),'vidaooApiKey',_0x014a('0x11'),_0x014a('0x12'),_0x014a('0x13'),_0x014a('0x14'),_0x014a('0x15'),_0x014a('0x16'),_0x014a('0x17'),_0x014a('0x18'),_0x014a('0x19'),_0x014a('0x1a'),_0x014a('0x1b'),_0x014a('0x1c'),'oldPassword'];function maskSensitiveData(_0x130d13){const _0x3cf92f=/(?!^)[\s\S](?!$)/g;if(_['isPlainObject'](_0x130d13)){for(const _0x3a836f in _0x130d13){if(_[_0x014a('0x1d')](_0x130d13[_0x3a836f])){for(let _0x59a4ea=0x0;_0x59a4ea<_0x130d13[_0x3a836f][_0x014a('0x1e')];_0x59a4ea++){maskSensitiveData(_0x130d13[_0x3a836f][_0x59a4ea]);}}else if(_[_0x014a('0x1f')](_0x130d13[_0x3a836f])){maskSensitiveData(_0x130d13[_0x3a836f]);}else if(_[_0x014a('0x20')](_0x130d13[_0x3a836f])){_0x130d13[_0x3a836f]=_0x130d13[_0x3a836f][_0x014a('0x21')](/{{{/g,_0x014a('0x22'))[_0x014a('0x21')](/}}}/g,_0x014a('0x23'))[_0x014a('0x21')](/{{/g,'@{')[_0x014a('0x21')](/}}/g,'}@');if(_[_0x014a('0x24')](sensitiveFields,_0x3a836f)){_0x130d13[_0x3a836f]=_0x130d13[_0x3a836f][_0x014a('0x21')](_0x3cf92f,'*');}}}}}module[_0x014a('0x25')][_0x014a('0x26')]=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/misc.js b/server/utils/misc.js index fb49dcb..b1adc69 100644 --- a/server/utils/misc.js +++ b/server/utils/misc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['exports','\x5c$&'];(function(_0x25b452,_0x3cedd1){var _0x55a1b3=function(_0x514d9e){while(--_0x514d9e){_0x25b452['push'](_0x25b452['shift']());}};_0x55a1b3(++_0x3cedd1);}(_0x7a54,0x106));var _0x47a5=function(_0x23ae36,_0x279e5f){_0x23ae36=_0x23ae36-0x0;var _0xccaecc=_0x7a54[_0x23ae36];return _0xccaecc;};module[_0x47a5('0x0')]={'escapeRegExp'(_0x46f3fa,_0x44b31e=/[-[\]{}()*+?.,\\\/^$|#\s]/g){return _0x46f3fa['replace'](_0x44b31e,_0x47a5('0x1'));}}; \ No newline at end of file +var _0xf494=['exports','\x5c$&'];(function(_0x4bc692,_0x3f8dcd){var _0x3f9e66=function(_0x120ca9){while(--_0x120ca9){_0x4bc692['push'](_0x4bc692['shift']());}};_0x3f9e66(++_0x3f8dcd);}(_0xf494,0x1c6));var _0x4f49=function(_0x5a7031,_0x3d1b82){_0x5a7031=_0x5a7031-0x0;var _0x1b6093=_0xf494[_0x5a7031];return _0x1b6093;};module[_0x4f49('0x0')]={'escapeRegExp'(_0x32e808,_0x3063f3=/[-[\]{}()*+?.,\\\/^$|#\s]/g){return _0x32e808['replace'](_0x3063f3,_0x4f49('0x1'));}}; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index 176f495..d7d4439 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 _0x0abf=['safeTemplate','lodash','{\x20{\x20','\x20}\x20}','string','isArray','map','isPlainObject','keys','reduce','exports'];(function(_0x30f95e,_0x46cd4c){var _0xbcdfe7=function(_0xb3c5e6){while(--_0xb3c5e6){_0x30f95e['push'](_0x30f95e['shift']());}};_0xbcdfe7(++_0x46cd4c);}(_0x0abf,0xe8));var _0xf0ab=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x0abf[_0x6c993a];return _0x27f547;};var _=require(_0xf0ab('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x4d04cc){return _0x4d04cc==='{{'?_0xf0ab('0x1'):_0xf0ab('0x2');}function safeTemplate(_0x528ef7){var _0x598001=_0x528ef7;if(typeof _0x528ef7===_0xf0ab('0x3')){_0x598001=_0x528ef7['replace'](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0xf0ab('0x4')](_0x528ef7)){_0x598001=_0x528ef7[_0xf0ab('0x5')](function(_0x2efe43){return safeTemplate(_0x2efe43);});}else if(_[_0xf0ab('0x6')](_0x528ef7)){_0x598001=Object[_0xf0ab('0x7')](_0x528ef7)[_0xf0ab('0x8')](function(_0x233afe,_0x57ff3b){_0x233afe[_0x57ff3b]=safeTemplate(_0x528ef7[_0x57ff3b]);return _0x233afe;},{});}return _0x598001;}module[_0xf0ab('0x9')][_0xf0ab('0xa')]=safeTemplate; \ No newline at end of file +var _0x8f4c=['map','isPlainObject','safeTemplate','lodash','{\x20{\x20','\x20}\x20}','replace','isArray'];(function(_0x5b1a78,_0x4d122d){var _0x240023=function(_0x41a55a){while(--_0x41a55a){_0x5b1a78['push'](_0x5b1a78['shift']());}};_0x240023(++_0x4d122d);}(_0x8f4c,0x113));var _0xc8f4=function(_0x33cece,_0x54b9da){_0x33cece=_0x33cece-0x0;var _0x1a2efd=_0x8f4c[_0x33cece];return _0x1a2efd;};var _=require(_0xc8f4('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x292fb6){return _0x292fb6==='{{'?_0xc8f4('0x1'):_0xc8f4('0x2');}function safeTemplate(_0x19893b){var _0x134d73=_0x19893b;if(typeof _0x19893b==='string'){_0x134d73=_0x19893b[_0xc8f4('0x3')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0xc8f4('0x4')](_0x19893b)){_0x134d73=_0x19893b[_0xc8f4('0x5')](function(_0x56c9b1){return safeTemplate(_0x56c9b1);});}else if(_[_0xc8f4('0x6')](_0x19893b)){_0x134d73=Object['keys'](_0x19893b)['reduce'](function(_0x520063,_0x373506){_0x520063[_0x373506]=safeTemplate(_0x19893b[_0x373506]);return _0x520063;},{});}return _0x134d73;}module['exports'][_0xc8f4('0x7')]=safeTemplate; \ No newline at end of file diff --git a/server/utils/update-app-config.js b/server/utils/update-app-config.js index e74f167..cfbacac 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 _0x7a23=['fs-extra','path','root','resolve','legacy-libs','isArray','apps','findIndex','name','motion2','NODE_PATH','string','env','pathExists','then','readJSON','info','Updating\x20app.json','writeJSON','exports'];(function(_0x12a020,_0x85b476){var _0x63cddd=function(_0x13bff5){while(--_0x13bff5){_0x12a020['push'](_0x12a020['shift']());}};_0x63cddd(++_0x85b476);}(_0x7a23,0xc8));var _0x37a2=function(_0x9d92bb,_0x3c7a2a){_0x9d92bb=_0x9d92bb-0x0;var _0x5f27a6=_0x7a23[_0x9d92bb];return _0x5f27a6;};var fs=require(_0x37a2('0x0'));var path=require(_0x37a2('0x1'));var config=require('../config/environment');var root=config[_0x37a2('0x2')];var APP_JSON_PATH=path[_0x37a2('0x3')](root,'server/app.json');var NODEPATH=path[_0x37a2('0x3')](root,_0x37a2('0x4'));function setLegacyLibsNodeEnvPath(_0x514333){let _0x14ca6d=![];if(Array[_0x37a2('0x5')](_0x514333[_0x37a2('0x6')])){var _0x21ca47=_0x514333[_0x37a2('0x6')][_0x37a2('0x7')](function(_0x41a75a){return _0x41a75a[_0x37a2('0x8')]===_0x37a2('0x9');});if(_0x21ca47>-0x1){var _0x3c9225=_0x514333[_0x37a2('0x6')][_0x21ca47];if(typeof _0x3c9225['env'][_0x37a2('0xa')]!==_0x37a2('0xb')){_0x3c9225[_0x37a2('0xc')][_0x37a2('0xa')]=NODEPATH;_0x14ca6d=!![];}}return{'appConfig':_0x514333,'updated':_0x14ca6d};}}function updateAppConfig(_0x4c6ddd){return fs[_0x37a2('0xd')](APP_JSON_PATH)[_0x37a2('0xe')](function(_0xb0116c){if(_0xb0116c){return fs[_0x37a2('0xf')](APP_JSON_PATH)[_0x37a2('0xe')](function(_0x26ed3d){var _0x3cf0c9=setLegacyLibsNodeEnvPath(_0x26ed3d);if(_0x3cf0c9['updated']){_0x4c6ddd[_0x37a2('0x10')](_0x37a2('0x11'));return fs[_0x37a2('0x12')](APP_JSON_PATH,_0x26ed3d,{'spaces':0x2});}else{return Promise['resolve']();}});}else{return Promise['resolve']();}});}module[_0x37a2('0x13')]=updateAppConfig; \ No newline at end of file +var _0xe54d=['readJSON','info','Updating\x20app.json','writeJSON','exports','fs-extra','../config/environment','root','resolve','server/app.json','apps','findIndex','name','motion2','env','string','NODE_PATH','pathExists','then'];(function(_0x2e8e5b,_0xc04c50){var _0x3e97c2=function(_0xb8cc69){while(--_0xb8cc69){_0x2e8e5b['push'](_0x2e8e5b['shift']());}};_0x3e97c2(++_0xc04c50);}(_0xe54d,0x1f3));var _0xde54=function(_0x566eb9,_0x19d620){_0x566eb9=_0x566eb9-0x0;var _0x341af6=_0xe54d[_0x566eb9];return _0x341af6;};var fs=require(_0xde54('0x0'));var path=require('path');var config=require(_0xde54('0x1'));var root=config[_0xde54('0x2')];var APP_JSON_PATH=path[_0xde54('0x3')](root,_0xde54('0x4'));var NODEPATH=path[_0xde54('0x3')](root,'legacy-libs');function setLegacyLibsNodeEnvPath(_0x3a863d){let _0x4bd217=![];if(Array['isArray'](_0x3a863d[_0xde54('0x5')])){var _0x10dcee=_0x3a863d[_0xde54('0x5')][_0xde54('0x6')](function(_0x179d88){return _0x179d88[_0xde54('0x7')]===_0xde54('0x8');});if(_0x10dcee>-0x1){var _0x5d51e7=_0x3a863d[_0xde54('0x5')][_0x10dcee];if(typeof _0x5d51e7[_0xde54('0x9')]['NODE_PATH']!==_0xde54('0xa')){_0x5d51e7[_0xde54('0x9')][_0xde54('0xb')]=NODEPATH;_0x4bd217=!![];}}return{'appConfig':_0x3a863d,'updated':_0x4bd217};}}function updateAppConfig(_0x5de2b){return fs[_0xde54('0xc')](APP_JSON_PATH)[_0xde54('0xd')](function(_0x492352){if(_0x492352){return fs[_0xde54('0xe')](APP_JSON_PATH)[_0xde54('0xd')](function(_0x432f13){var _0x45b3fd=setLegacyLibsNodeEnvPath(_0x432f13);if(_0x45b3fd['updated']){_0x5de2b[_0xde54('0xf')](_0xde54('0x10'));return fs[_0xde54('0x11')](APP_JSON_PATH,_0x432f13,{'spaces':0x2});}else{return Promise[_0xde54('0x3')]();}});}else{return Promise[_0xde54('0x3')]();}});}module[_0xde54('0x12')]=updateAppConfig; \ No newline at end of file